@seatlayer/core 0.76.0 → 0.77.1
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-ESLFQEY3.js +1 -0
- package/dist/be-7WI4WG2B.js +1 -0
- package/dist/bg-KKEOOUYL.js +1 -0
- package/dist/ca-L36KKI76.js +1 -0
- package/dist/{categoryInventory-Cy5pQ0KW.d.ts → categoryInventory-C_NIm0jr.d.ts} +1 -1
- package/dist/{categoryInventory-CBuJy9KM.d.cts → categoryInventory-IgpsH6KG.d.cts} +1 -1
- package/dist/chunk-QJXSZT3H.js +1 -0
- package/dist/chunk-SGYNM3SG.js +1 -0
- package/dist/core/chart-ops/index.d.cts +5 -5
- package/dist/core/chart-ops/index.d.ts +5 -5
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +4 -4
- package/dist/core/inventory/index.d.ts +4 -4
- package/dist/core/layout/index.d.cts +5 -5
- package/dist/core/layout/index.d.ts +5 -5
- package/dist/core/quality/index.d.cts +3 -3
- package/dist/core/quality/index.d.ts +3 -3
- package/dist/core/render-assets/index.d.cts +1 -1
- package/dist/core/render-assets/index.d.ts +1 -1
- package/dist/core/seatConfidence.d.cts +1 -1
- package/dist/core/seatConfidence.d.ts +1 -1
- package/dist/core/sections/index.d.cts +5 -5
- package/dist/core/sections/index.d.ts +5 -5
- package/dist/cs-2IEWVOHA.js +1 -0
- package/dist/cy-A5YBQD5Q.js +1 -0
- package/dist/da-IDXUY3QI.js +1 -0
- package/dist/de-L5PFY4CY.js +1 -0
- package/dist/el-4DPNHJGB.js +1 -0
- package/dist/es-IMADA3UR.js +1 -0
- package/dist/et-G6PPK4SF.js +1 -0
- package/dist/{eventConfigurations-CqfrYWAb.d.cts → eventConfigurations-71rHjKl7.d.ts} +5 -5
- package/dist/{eventConfigurations-Dhauc9V3.d.ts → eventConfigurations-vOMFVz7c.d.cts} +5 -5
- package/dist/fa-3RYGYXBU.js +1 -0
- package/dist/fi-KRSYZSV4.js +1 -0
- package/dist/fr-FOSKFLMV.js +1 -0
- package/dist/he-RXSGTRSH.js +1 -0
- package/dist/hr-IMBN4Z7O.js +1 -0
- package/dist/hu-UYWLVBH3.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +198 -148
- package/dist/index.d.ts +198 -148
- package/dist/index.js +1 -1
- package/dist/it-ZAWFQCOM.js +1 -0
- package/dist/ja-QZGXTROI.js +1 -0
- package/dist/ku-ZCTX4KKG.js +1 -0
- package/dist/{labeling-BwPEI5JN.d.ts → labeling-BnjyAEbI.d.ts} +1 -1
- package/dist/{labeling-B1xsmowB.d.cts → labeling-pdEv7UN1.d.cts} +1 -1
- package/dist/localeLoaders-BZZWN35C.js +1 -0
- package/dist/lt-N2OMHLDZ.js +1 -0
- package/dist/lv-WLIXXNIX.js +1 -0
- package/dist/nl-LZILGXRW.js +1 -0
- package/dist/no-2OJ4BSZI.js +1 -0
- package/dist/pl-FZUMWN56.js +1 -0
- package/dist/pt-R4XWF7UT.js +1 -0
- package/dist/{renderedQuality-1E9KuJvY.d.cts → renderedQuality-CRLkEGf8.d.cts} +1 -1
- package/dist/{renderedQuality-ChAZNV2N.d.ts → renderedQuality-DN8SFFjk.d.ts} +1 -1
- package/dist/{renderer-BRmVrITG.d.cts → renderer-B6kkgOHz.d.cts} +43 -1
- package/dist/{renderer-q7viZLGZ.d.ts → renderer-ByLmyQe_.d.ts} +43 -1
- package/dist/ro-WK3CNXGW.js +1 -0
- package/dist/ru-AGP7UPXQ.js +1 -0
- package/dist/{sections-CA-bBex5.d.cts → sections-CQ0sd37E.d.cts} +1 -1
- package/dist/{sections-ByTMouG8.d.ts → sections-F6wMlVqx.d.ts} +1 -1
- package/dist/{segmentedRowModel-DcvJVKLD.d.ts → segmentedRowModel-D-CEgxg7.d.ts} +1 -1
- package/dist/{segmentedRowModel-C7XOEjHk.d.cts → segmentedRowModel-DqFhb-7Q.d.cts} +1 -1
- package/dist/sk-LNR3ENI4.js +1 -0
- package/dist/sl-UG367TMJ.js +1 -0
- package/dist/sr-IHG5CL3F.js +1 -0
- package/dist/sv-RIFQBC5U.js +1 -0
- package/dist/{tableSizing-D8e8QAJ-.d.ts → tableSizing-B0JegL6B.d.ts} +3 -3
- package/dist/{tableSizing-BdCyNeqX.d.cts → tableSizing-DKygWd7z.d.cts} +3 -3
- package/dist/{ticketRestrictions-CorjMY49.d.ts → ticketRestrictions-Bp7ET0j4.d.ts} +2 -2
- package/dist/{ticketRestrictions-CPZglNvw.d.cts → ticketRestrictions-CvGDnGS8.d.cts} +2 -2
- package/dist/tr-LWSQYBXN.js +1 -0
- package/dist/{types-CqaNLbU6.d.ts → types-Dq-ipTBG.d.cts} +13 -15
- package/dist/{types-CqaNLbU6.d.cts → types-Dq-ipTBG.d.ts} +13 -15
- package/dist/uk-ZSWFWCW7.js +1 -0
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +27 -27
- package/dist/view3d/index.d.cts +3 -3
- package/dist/view3d/index.d.ts +3 -3
- package/dist/view3d/index.js +25 -25
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/dist/zh-Hans-P4CJH4VJ.js +1 -0
- package/dist/zh-Hant-X7CHEXML.js +1 -0
- package/package.json +1 -1
- package/dist/ar-JOSU54ZZ.js +0 -1
- package/dist/be-UDIVAZGH.js +0 -1
- package/dist/bg-AJX2SNK4.js +0 -1
- package/dist/ca-MC23KMQH.js +0 -1
- package/dist/chunk-JQL77POQ.js +0 -1
- package/dist/cs-Q4OEV3NE.js +0 -1
- package/dist/cy-TPDRMPTK.js +0 -1
- package/dist/da-U6XXTCII.js +0 -1
- package/dist/de-ZV54ZWHR.js +0 -1
- package/dist/el-5VQKNNQV.js +0 -1
- package/dist/es-Y3BNIAEW.js +0 -1
- package/dist/et-HCCA6TE3.js +0 -1
- package/dist/fa-SZ3EAODM.js +0 -1
- package/dist/fi-S34TMT35.js +0 -1
- package/dist/fr-RQIXNHQ5.js +0 -1
- package/dist/he-PPNABESI.js +0 -1
- package/dist/hr-IZOGRWC5.js +0 -1
- package/dist/hu-K7EOGFAB.js +0 -1
- package/dist/it-PD5WJDNR.js +0 -1
- package/dist/ja-3CFZ2KK6.js +0 -1
- package/dist/ku-MQJTRLDV.js +0 -1
- package/dist/localeLoaders-ETY2H7H3.js +0 -1
- package/dist/lt-6Q5DJHXR.js +0 -1
- package/dist/lv-BQ3LWGW6.js +0 -1
- package/dist/nl-ZPVH2YGT.js +0 -1
- package/dist/no-R7I6YW7N.js +0 -1
- package/dist/pl-EU2O5DYI.js +0 -1
- package/dist/pt-UMSFOY5P.js +0 -1
- package/dist/ro-GR35LU2L.js +0 -1
- package/dist/ru-CXYAZQEV.js +0 -1
- package/dist/sk-GUB52YMC.js +0 -1
- package/dist/sl-J7N6LDON.js +0 -1
- package/dist/sr-A7GQEH7K.js +0 -1
- package/dist/sv-ARLHHSPZ.js +0 -1
- package/dist/tr-6TE3U7WM.js +0 -1
- package/dist/uk-RMVPSRMH.js +0 -1
- package/dist/zh-Hans-SNO4DA32.js +0 -1
- package/dist/zh-Hant-TVIKBD5S.js +0 -1
package/dist/view3d/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ChartDoc } from '../types-
|
|
2
|
-
import {
|
|
3
|
-
import { E as ExpandedSeat } from '../renderer-
|
|
1
|
+
import { C as ChartDoc } from '../types-Dq-ipTBG.cjs';
|
|
2
|
+
import { E as EventConfigurationProductionElementKind, a as EventConfigurationOcclusion, b as EventConfigurationVersion } from '../eventConfigurations-vOMFVz7c.cjs';
|
|
3
|
+
import { E as ExpandedSeat } from '../renderer-B6kkgOHz.cjs';
|
|
4
4
|
import { SeatView } from './crossfade/panorama.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/view3d/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ChartDoc } from '../types-
|
|
2
|
-
import {
|
|
3
|
-
import { E as ExpandedSeat } from '../renderer-
|
|
1
|
+
import { C as ChartDoc } from '../types-Dq-ipTBG.js';
|
|
2
|
+
import { E as EventConfigurationProductionElementKind, a as EventConfigurationOcclusion, b as EventConfigurationVersion } from '../eventConfigurations-71rHjKl7.js';
|
|
3
|
+
import { E as ExpandedSeat } from '../renderer-ByLmyQe_.js';
|
|
4
4
|
import { SeatView } from './crossfade/panorama.js';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/view3d/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{a as me,b as qt,c as jt,d as Xe,e as Se,f as vt,g as bt,h as Kt,i as Qt,j as Ie,k as $t,l as gt,m as Zt,n as Jt,o as eo,p as to,q as fe,r as oo,s as no,t as ro,u as io,v as yt,w as Te}from"../chunk-JQL77POQ.js";import"../chunk-PRED5KHO.js";import"../chunk-WXGW2SYC.js";import"../chunk-UL5OIGIF.js";import{Wa as Ut}from"../chunk-24O23MNB.js";import{d as Yt,l as Xt}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";import{Renderer as Tn}from"ogl";function Vn(){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 qe=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 Tn({canvas:this.canvas,dpr:Vn(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Xe.top[0],Xe.top[1],Xe.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 _n,Vec3 as xt}from"ogl";var re=Math.PI/180,wt=15*re,St=80*re,Me=.12,ao=35,so=1.25,je=class{constructor(e,o,r,n){this.fovY=ao;this.target=new xt;this.azimuth=-30*re;this.polar=55*re;this.distance=10;this.azT=-30*re;this.polT=55*re;this.distT=10;this.minDist=1;this.maxDist=100;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 xt;this.panAnchor=new xt;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new _n(e,{fov:ao,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 l=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-l)*.005)),this.fireGesture()),this.pinchDist=l;let u=this.pinchCentroid();this.panBy(u.x-this.pinchCx,u.y-this.pinchCy),this.pinchCx=u.x,this.pinchCy=u.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}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(s!==0||a!==0)&&this.fireGesture(),this.azT-=s*.006,this.polT=Math.max(wt,Math.min(St,this.polT-a*.006)),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*re;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(wt,Math.min(St,this.polT+(i.key==="ArrowUp"?-s:s)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);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*re/2)/r,i=Math.sin(this.azimuth),s=Math.cos(this.azimuth),a=s,l=-i,u=Math.cos(this.polar),f=Math.sin(this.polar),p=-i*u,b=-s*u;this.targetT.x+=(-e*a+o*p)*n,this.targetT.z+=(-e*l+o*b)*n,this.targetT.y+=o*f*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())}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*re/2,l=n?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(a)*l);this.azT=r??-30*re,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*re;let f=this.fitDistance(e,a,u,this.azT,this.polT);this.distT=f*Math.max(1.05,Math.min(2,i?.margin??so)),this.minDist=Math.max(2,s*.12),this.maxDist=f*4,o?(this.azimuth=this.azT,this.polar=12*re,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*re/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))*re;let l=this.fitDistance(e,i,a,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,n?.margin??so))}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 u=Math.sin(i),f=-u*Math.sin(n),p=-Math.cos(i),b=-u*Math.cos(n);if(Math.abs(p)>.999)return a;let c=-b,d=f,E=Math.hypot(c,d);c/=E,d/=E;let P=-d*p,M=d*f-c*b,k=c*p,y=Math.tan(r),F=Math.tan(o),v=1;for(let w=0;w<8;w++){let D=(w&1?l.max[0]:l.min[0])-e.center[0],T=(w&2?l.max[1]:l.min[1])-e.center[1],L=(w&4?l.max[2]:l.min[2])-e.center[2],z=D*f+T*p+L*b,C=Math.abs(D*c+L*d),Q=Math.abs(D*P+T*M+L*k);v=Math.max(v,C/y-z,Q/F-z)}return Math.min(a,Math.max(v,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*Me,this.polar+=o*Me,this.distance+=r*Me,this.target.x+=n*Me,this.target.y+=i*Me,this.target.z+=s*Me,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(wt,Math.min(St,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 Ke=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 Pe=2.5,kn=1.15,Ve=6,Ce=10,lo=6,co=9.5,uo=.9,mo=2.2,Mt=30,Pt=4,Qe=8192;var ii=Ce+Pt;function po(t,e){let o=e*1.4,r=e*3.2;if(t<=o)return{scale:1,fade:0,minPixels:Pe};let n=Math.min(1,(t-o)/Math.max(.001,r-o));return{scale:1-n*.4,fade:n*.55,minPixels:Pe+n*(kn-Pe)}}function ho(t,e,o){return!(t>0)||!(e>0)||!(o>0)?!1:e*o/t>=64}function fo(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 Ln=88,On=20,Ct={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:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},_e=new Set(["row","seat"]),vo={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},$e={row:{x:62,y:16},seat:{x:46,y:18}},bo=Yt,At=t=>Xt(t);function go(t,e){let o=At(t),r=At(e);return(Math.max(o,r)+.05)/(Math.min(o,r)+.05)}function Et(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 zn(t,e=[.04,.06,.1],o=!0){let r=At(e)<.42,n=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",s=o?Et(i,e):e,a=bo(t),l=o?7:4.5,u=a&&go(a,s)>=l?t:n;return r?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}var Nn='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Ze=class{constructor(e,o={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;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||Nn,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}`))}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;let a=eo(n,i,{hasZoneLabels:this.labels.some(y=>y.kind==="zone")});this.forcedDense&&(a.add("row"),a.add("seat"));let l=[];for(let y of this.labels){if(!a.has(y.kind))continue;let F=fe(e,y.anchor,o,r);if(!F.visible)continue;let v=no(y.text,Ct[y.kind].size,!_e.has(y.kind)),w=!_e.has(y.kind),D=to(F,v/2,Ct[y.kind].size/2+(w?4:1),o,r),T=s?Math.hypot(y.anchor[0]-s[0],y.anchor[1]-s[1],y.anchor[2]-s[2]):1;l.push({label:y,screen:D,focus:io(D,T,o,r),halfWidth:v/2,...this.selectedSeatLabelIds.has(y.id)?{priority:1}:{}})}let u=Jt(l.filter(y=>y.label.kind==="floor"),o),f=[...l.filter(y=>!_e.has(y.label.kind)&&y.label.kind!=="floor"),...u],p=oo(f,Ln,On),b=ro(o),c=yt(l.filter(y=>y.label.kind==="row"),$e.row.x,$e.row.y,b.row,p),d=yt(l.filter(y=>y.label.kind==="seat"),$e.seat.x,$e.seat.y,b.seat,[...p,...c]),E=[...p,...c,...d],P=new Set(E.map(y=>y.label.id));for(let{label:y,screen:F}of E){let w=this.nodeFor(y).style;w.display="",w.transform=`translate(-50%, -50%) translate(${F.x.toFixed(1)}px, ${F.y.toFixed(1)}px)`}let M=E.filter(({label:y})=>!_e.has(y.kind)).sort((y,F)=>vo[F.label.kind]-vo[y.label.kind]||y.screen.depth-F.screen.depth||y.focus-F.focus),k=[];for(let{label:y}of M){let F=this.nodes.get(y.id);if(!F||F.style.display==="none")continue;let v=F.getBoundingClientRect();k.some(D=>v.left<D.right+3&&v.right+3>D.left&&v.top<D.bottom+3&&v.bottom+3>D.top)?F.style.display="none":k.push(v)}for(let[y,F]of this.nodes)P.has(y)||(F.style.display="none")}nodeFor(e){let o=this.nodes.get(e.id);if(!o){o=document.createElement("div");let p=o.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.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=Ct[e.kind],i=o.style;i.fontSize=`${n.size}px`,i.fontWeight=r?"800":n.weight,i.opacity=r?"1":String(n.opacity);let s=!_e.has(e.kind),a=zn(e.color??this.opts.ink,this.opts.backgroundRgb,s);i.color=r?"#ecf8ff":a.ink,i.background=r?"rgba(10,28,45,.9)":s?a.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${a.border}`:"",i.borderRadius=r||s?"999px":"",i.padding=r||s?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=e.kind==="zone"||e.kind==="floor"?"0.08em":"0.02em";let l=this.opts.backgroundRgb??[.04,.06,.1],u=bo(r?"#ecf8ff":a.ink)??[1,1,1],f=r?Et("rgba(10,28,45,.9)",l):s?Et(a.backing,l):l;return o.dataset.qualityContrast=go(u,f).toFixed(3),(e.kind==="zone"||e.kind==="floor")&&(i.textTransform="uppercase"),o}dispose(){this.root.remove(),this.nodes.clear()}};var Bn=1;var Gn=new Set(["floor","zone","section","ga","booth","annotation"]);function Hn(t){return t.every(e=>Number.isFinite(e))}function Wn(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 yo(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function ge(t){return Math.round(t*1e4)/1e4}function Un(t){if(t)return{box:{x:ge(t.box.x),y:ge(t.box.y),width:ge(t.box.width),height:ge(t.box.height)},horizontalFillRatio:ge(t.horizontalFillRatio),verticalFillRatio:ge(t.verticalFillRatio),visibleAreaRatio:ge(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 Rt(t){let e=t.labels.filter(a=>a.visible&&a.screenBox),o=e.filter(a=>Gn.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)Wn(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",Hn(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:u})=>({id:a,kind:l,text:u})).sort((a,l)=>a.kind.localeCompare(l.kind)||a.id.localeCompare(l.id)),framing:Un(t.framing)},metrics:{minimumHierarchyFontPx:yo(o.map(a=>a.renderedFontPx)),minimumHierarchyContrast:yo(o.map(a=>a.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:s}}import{Geometry as ke,Mesh as Le,Program as lr,Texture as cr,Transform as Io}from"ogl";import{Program as ye}from"ogl";var Je=`
|
|
1
|
+
import{a as me,b as Kt,c as Qt,d as Ye,e as we,f as vt,g as bt,h as $t,i as Zt,j as Te,k as Jt,l as gt,m as eo,n as to,o as oo,p as no,q as fe,r as ro,s as io,t as ao,u as so,v as yt,w as lo,x as Ie}from"../chunk-SGYNM3SG.js";import"../chunk-PRED5KHO.js";import"../chunk-QJXSZT3H.js";import"../chunk-WXGW2SYC.js";import"../chunk-UL5OIGIF.js";import{Wa as Xt}from"../chunk-24O23MNB.js";import{d as qt,l as jt}from"../chunk-JBOTRSMY.js";import"../chunk-CRCGO52K.js";import{Renderer as zn}from"ogl";function Nn(){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 Xe=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 zn({canvas:this.canvas,dpr:Nn(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ye.top[0],Ye.top[1],Ye.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 Bn,Vec3 as xt}from"ogl";var ie=Math.PI/180,St=15*ie,wt=80*ie,Me=.12,co=35,uo=1.25,qe=class{constructor(e,o,r,n){this.fovY=co;this.target=new xt;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.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 xt;this.panAnchor=new xt;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new Bn(e,{fov:co,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 l=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-l)*.005)),this.fireGesture()),this.pinchDist=l;let u=this.pinchCentroid();this.panBy(u.x-this.pinchCx,u.y-this.pinchCy),this.pinchCx=u.x,this.pinchCy=u.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}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(s!==0||a!==0)&&this.fireGesture(),this.azT-=s*.006,this.polT=Math.max(St,Math.min(wt,this.polT-a*.006)),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(St,Math.min(wt,this.polT+(i.key==="ArrowUp"?-s:s)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);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,u=Math.cos(this.polar),f=Math.sin(this.polar),p=-i*u,v=-s*u;this.targetT.x+=(-e*a+o*p)*n,this.targetT.z+=(-e*l+o*v)*n,this.targetT.y+=o*f*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())}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,u=Math.atan(Math.tan(a)*l);this.azT=r??-30*ie,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*ie;let f=this.fitDistance(e,a,u,this.azT,this.polT);this.distT=f*Math.max(1.05,Math.min(2,i?.margin??uo)),this.minDist=Math.max(2,s*.12),this.maxDist=f*4,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??uo))}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 u=Math.sin(i),f=-u*Math.sin(n),p=-Math.cos(i),v=-u*Math.cos(n);if(Math.abs(p)>.999)return a;let c=-v,d=f,E=Math.hypot(c,d);c/=E,d/=E;let C=-d*p,M=d*f-c*v,k=c*p,y=Math.tan(r),D=Math.tan(o),P=1;for(let x=0;x<8;x++){let S=(x&1?l.max[0]:l.min[0])-e.center[0],T=(x&2?l.max[1]:l.min[1])-e.center[1],_=(x&4?l.max[2]:l.min[2])-e.center[2],O=S*f+T*p+_*v,R=Math.abs(S*c+_*d),Y=Math.abs(S*C+T*M+_*k);P=Math.max(P,R/y-O,Y/D-O)}return Math.min(a,Math.max(P,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*Me,this.polar+=o*Me,this.distance+=r*Me,this.target.x+=n*Me,this.target.y+=i*Me,this.target.z+=s*Me,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(St,Math.min(wt,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 je=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 Pe=2.5,Gn=1.15,Ve=6,Ce=10,mo=6,po=9.5,ho=.9,fo=2.2,Mt=30,Pt=4,Ke=8192;var vi=Ce+Pt;function vo(t,e){let o=e*1.4,r=e*3.2;if(t<=o)return{scale:1,fade:0,minPixels:Pe};let n=Math.min(1,(t-o)/Math.max(.001,r-o));return{scale:1-n*.4,fade:n*.55,minPixels:Pe+n*(Gn-Pe)}}function bo(t,e,o){return!(t>0)||!(e>0)||!(o>0)?!1:e*o/t>=64}function go(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 Hn=88,Wn=20,Ct={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}},yo="rgba(10,14,22,.62)",Un="#f4f7fb",xo=5,So=2,Yn=6,Qe=new Set(["row","seat"]),wo={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},$e={row:{x:66,y:20},seat:{x:52,y:22}},Et=qt,At=t=>jt(t);function Rt(t,e){let o=At(t),r=At(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 Xn(t,e=[.04,.06,.1],o=!0){let r=At(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=Et(t),l=o?7:4.5,u=a&&Rt(a,s)>=l?t:n;return r?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}function qn(t,e=[.04,.06,.1]){let o=Ft(yo,e),r=Et(t);return{ink:r&&Rt(r,o)>=4.5?t:Un,backing:yo}}var jn='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Ze=class{constructor(e,o={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;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||jn,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}`))}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;let a=oo(n,i,{hasZoneLabels:this.labels.some(y=>y.kind==="zone")});this.forcedDense&&(a.add("row"),a.add("seat"));let l=[];for(let y of this.labels){if(!a.has(y.kind))continue;let D=fe(e,y.anchor,o,r);if(!D.visible)continue;let P=Qe.has(y.kind),x=io(y.text,Ct[y.kind].size,!P)+(P?xo*2:0),S=no(D,x/2,Ct[y.kind].size/2+(P?So:4),o,r),T=s?Math.hypot(y.anchor[0]-s[0],y.anchor[1]-s[1],y.anchor[2]-s[2]):1;l.push({label:y,screen:S,focus:so(S,T,o,r),halfWidth:x/2,...this.selectedSeatLabelIds.has(y.id)?{priority:1}:{}})}let u=to(l.filter(y=>y.label.kind==="floor"),o),f=[...l.filter(y=>!Qe.has(y.label.kind)&&y.label.kind!=="floor"),...u],p=ro(f,Hn,Wn),v=ao(o),c=yt(l.filter(y=>y.label.kind==="row"),$e.row.x,$e.row.y,v.row,p),d=yt(l.filter(y=>y.label.kind==="seat"),$e.seat.x,$e.seat.y,v.seat,[...p,...c]),E=[...p,...c,...d],C=new Set(E.map(y=>y.label.id));for(let{label:y,screen:D}of E){let x=this.nodeFor(y).style;x.display="",x.transform=`translate(-50%, -50%) translate(${D.x.toFixed(1)}px, ${D.y.toFixed(1)}px)`}let M=E.filter(({label:y})=>!Qe.has(y.kind)).sort((y,D)=>wo[D.label.kind]-wo[y.label.kind]||y.screen.depth-D.screen.depth||y.focus-D.focus),k=[];for(let{label:y}of M){let D=this.nodes.get(y.id);if(!D||D.style.display==="none")continue;let P=D.getBoundingClientRect();k.some(S=>P.left<S.right+3&&P.right+3>S.left&&P.top<S.bottom+3&&P.bottom+3>S.top)?D.style.display="none":k.push(P)}for(let[y,D]of this.nodes)C.has(y)||(D.style.display="none")}nodeFor(e){let o=this.nodes.get(e.id);if(!o){o=document.createElement("div");let c=o.style;c.position="absolute",c.left="0",c.top="0",c.whiteSpace="nowrap",c.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",c.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=Ct[e.kind],i=o.style;i.fontSize=`${n.size}px`,i.fontWeight=r?"800":n.weight,i.opacity=r?"1":String(n.opacity);let s=Qe.has(e.kind),a=!s,l=Xn(e.color??this.opts.ink,this.opts.backgroundRgb,!0),u=s?qn(e.color??this.opts.ink,this.opts.backgroundRgb):l;i.color=r?"#ecf8ff":u.ink,i.background=r?"rgba(10,28,45,.9)":u.backing,i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${l.border}`:"",i.borderRadius=r||a?"999px":`${Yn}px`,i.padding=r||a?"3px 7px":`${So}px ${xo}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 f=this.opts.backgroundRgb??[.04,.06,.1],p=Et(r?"#ecf8ff":u.ink)??[1,1,1],v=Ft(r?"rgba(10,28,45,.9)":u.backing,f);return o.dataset.qualityContrast=Rt(p,v).toFixed(3),(e.kind==="zone"||e.kind==="floor")&&(i.textTransform="uppercase"),o}dispose(){this.root.remove(),this.nodes.clear()}};var Kn=1;var Qn=new Set(["floor","zone","section","ga","booth","annotation"]);function $n(t){return t.every(e=>Number.isFinite(e))}function Zn(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 Mo(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function ge(t){return Math.round(t*1e4)/1e4}function Jn(t){if(t)return{box:{x:ge(t.box.x),y:ge(t.box.y),width:ge(t.box.width),height:ge(t.box.height)},horizontalFillRatio:ge(t.horizontalFillRatio),verticalFillRatio:ge(t.verticalFillRatio),visibleAreaRatio:ge(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 Dt(t){let e=t.labels.filter(a=>a.visible&&a.screenBox),o=e.filter(a=>Qn.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)Zn(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",$n(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:u})=>({id:a,kind:l,text:u})).sort((a,l)=>a.kind.localeCompare(l.kind)||a.id.localeCompare(l.id)),framing:Jn(t.framing)},metrics:{minimumHierarchyFontPx:Mo(o.map(a=>a.renderedFontPx)),minimumHierarchyContrast:Mo(o.map(a=>a.contrast)),projectedReliefPx:Math.round(t.scene.projectedReliefPx*100)/100},findings:s}}import{Geometry as _e,Mesh as ke,Program as br,Texture as gr,Transform as ko}from"ogl";import{Program as ye}from"ogl";var Je=`
|
|
2
2
|
float chairWeight(float depth) {
|
|
3
3
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
4
|
-
}`,
|
|
4
|
+
}`,Po=`
|
|
5
5
|
float occupantWeight(float depth) {
|
|
6
|
-
float nearWeight = smoothstep(${
|
|
7
|
-
float farWeight = 1.0 - smoothstep(${
|
|
6
|
+
float nearWeight = smoothstep(${ho.toFixed(1)}, ${fo.toFixed(1)}, depth);
|
|
7
|
+
float farWeight = 1.0 - smoothstep(${mo.toFixed(1)}, ${po.toFixed(1)}, depth);
|
|
8
8
|
return nearWeight * farWeight;
|
|
9
|
-
}`,
|
|
9
|
+
}`,Co=`
|
|
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
|
+
}`,er=`#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
|
+
}`,tr=`#version 300 es
|
|
97
97
|
precision highp float;
|
|
98
98
|
in vec3 vColor;
|
|
99
99
|
in vec3 vNormalWorld;
|
|
@@ -166,7 +166,7 @@ void main() {
|
|
|
166
166
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
167
167
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
168
168
|
fragColor = vec4(base, 1.0);
|
|
169
|
-
}`,
|
|
169
|
+
}`,or=`#version 300 es
|
|
170
170
|
precision highp float;
|
|
171
171
|
in vec2 position; // quad corner in [-1,1]
|
|
172
172
|
in vec3 iOffset; // per-instance world position
|
|
@@ -225,7 +225,7 @@ void main() {
|
|
|
225
225
|
vPhysicalSeat = iPhysicalSeat;
|
|
226
226
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
227
227
|
gl_Position = projectionMatrix * mv;
|
|
228
|
-
}`,
|
|
228
|
+
}`,nr=`#version 300 es
|
|
229
229
|
precision highp float;
|
|
230
230
|
in vec2 vUv;
|
|
231
231
|
in vec3 vColor;
|
|
@@ -284,7 +284,7 @@ void main() {
|
|
|
284
284
|
alpha *= vDotWeight;
|
|
285
285
|
if (alpha <= 0.0) discard;
|
|
286
286
|
fragColor = vec4(c, alpha);
|
|
287
|
-
}`,
|
|
287
|
+
}`,rr=`#version 300 es
|
|
288
288
|
precision highp float;
|
|
289
289
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
290
290
|
in vec3 normal;
|
|
@@ -316,8 +316,8 @@ out float vDim;
|
|
|
316
316
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
317
317
|
out vec3 vOccupantTint;
|
|
318
318
|
${Je}
|
|
319
|
-
${
|
|
320
|
-
${
|
|
319
|
+
${Po}
|
|
320
|
+
${Co}
|
|
321
321
|
void main() {
|
|
322
322
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
323
323
|
float viewDepth = -anchor.z;
|
|
@@ -403,7 +403,7 @@ void main() {
|
|
|
403
403
|
vRing = iRing;
|
|
404
404
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
405
405
|
gl_Position = projectionMatrix * mv;
|
|
406
|
-
}`,
|
|
406
|
+
}`,ir=`#version 300 es
|
|
407
407
|
precision highp float;
|
|
408
408
|
in vec3 vColor;
|
|
409
409
|
in vec3 vNormalWorld;
|
|
@@ -460,14 +460,14 @@ void main() {
|
|
|
460
460
|
float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
|
|
461
461
|
base += vec3(0.26, 0.31, 0.38) * fres * 0.55 * mix(sheen, 1.0, vOccupant);
|
|
462
462
|
fragColor = vec4(base, 1.0);
|
|
463
|
-
}
|
|
463
|
+
}`,ar=`#version 300 es
|
|
464
464
|
precision highp float;
|
|
465
465
|
in vec2 position;
|
|
466
466
|
out vec2 vUv;
|
|
467
467
|
void main() {
|
|
468
468
|
vUv = position * 0.5 + 0.5;
|
|
469
469
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
470
|
-
}`,
|
|
470
|
+
}`,sr=`#version 300 es
|
|
471
471
|
precision highp float;
|
|
472
472
|
in vec2 vUv;
|
|
473
473
|
uniform vec3 uTop;
|
|
@@ -478,7 +478,7 @@ void main() {
|
|
|
478
478
|
vec2 c = vUv - 0.5;
|
|
479
479
|
float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
|
|
480
480
|
fragColor = vec4(col * vig, 1.0);
|
|
481
|
-
}`,
|
|
481
|
+
}`,lr=`#version 300 es
|
|
482
482
|
precision highp float;
|
|
483
483
|
in vec2 position;
|
|
484
484
|
in vec3 iOffset;
|
|
@@ -515,7 +515,7 @@ void main() {
|
|
|
515
515
|
vPhysicalSeat = iPhysicalSeat;
|
|
516
516
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
517
517
|
gl_Position = projectionMatrix * mv;
|
|
518
|
-
}`,
|
|
518
|
+
}`,cr=`#version 300 es
|
|
519
519
|
precision highp float;
|
|
520
520
|
in vec2 vUv;
|
|
521
521
|
in float vPhysicalSeat;
|
|
@@ -529,7 +529,7 @@ void main() {
|
|
|
529
529
|
float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
|
|
530
530
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
531
531
|
fragColor = vec4(vPick, 1.0);
|
|
532
|
-
}`,
|
|
532
|
+
}`,ur=`#version 300 es
|
|
533
533
|
precision highp float;
|
|
534
534
|
in vec3 position;
|
|
535
535
|
in float part;
|
|
@@ -551,8 +551,8 @@ uniform float uFocusFloor;
|
|
|
551
551
|
flat out vec3 vPick;
|
|
552
552
|
out float vHidden;
|
|
553
553
|
${Je}
|
|
554
|
-
${
|
|
555
|
-
${
|
|
554
|
+
${Po}
|
|
555
|
+
${Co}
|
|
556
556
|
void main() {
|
|
557
557
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
558
558
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -585,7 +585,7 @@ void main() {
|
|
|
585
585
|
float c = cos(iYaw), s = sin(iYaw);
|
|
586
586
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
587
587
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
588
|
-
}`,
|
|
588
|
+
}`,dr=`#version 300 es
|
|
589
589
|
precision highp float;
|
|
590
590
|
flat in vec3 vPick;
|
|
591
591
|
in float vHidden;
|
|
@@ -593,7 +593,7 @@ out vec4 fragColor;
|
|
|
593
593
|
void main() {
|
|
594
594
|
if (vHidden > 0.5) discard;
|
|
595
595
|
fragColor = vec4(vPick, 1.0);
|
|
596
|
-
}`,
|
|
596
|
+
}`,mr=`#version 300 es
|
|
597
597
|
precision highp float;
|
|
598
598
|
in vec3 position;
|
|
599
599
|
in float floorIndex;
|
|
@@ -604,14 +604,14 @@ out float vHidden;
|
|
|
604
604
|
void main() {
|
|
605
605
|
vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
606
606
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
607
|
-
}`,
|
|
607
|
+
}`,pr=`#version 300 es
|
|
608
608
|
precision highp float;
|
|
609
609
|
in float vHidden;
|
|
610
610
|
out vec4 fragColor;
|
|
611
611
|
void main() {
|
|
612
612
|
if (vHidden > 0.5) discard;
|
|
613
613
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
614
|
-
}`;function
|
|
614
|
+
}`;function Ao(t){return new ye(t,{vertex:lr,fragment:cr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:Pe},uPixelToWorld:{value:.002},uChairFull:{value:Ve},uChairNone:{value:Ce},uFocusFloor:{value:-1}}})}function Eo(t){return new ye(t,{vertex:ur,fragment:dr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:Ve},uChairNone:{value:Ce},uBackRake:{value:vt},uBackBase:{value:bt},uFocusFloor:{value:-1}}})}function Ro(t){return new ye(t,{vertex:mr,fragment:pr,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Fo(t,e=.78){return new ye(t,{vertex:er,fragment:tr,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:e}}})}function Do(t){return new ye(t,{vertex:or,fragment:nr,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:Pe},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:Ve},uChairNone:{value:Ce}}})}function To(t,e=.78){return new ye(t,{vertex:rr,fragment:ir,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:Ve},uChairNone:{value:Ce},uBackRake:{value:vt},uBackBase:{value:bt},uFocusFloor:{value:-1},uRoughness:{value:e}}})}function Io(t,e,o){return new ye(t,{vertex:ar,fragment:sr,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(e)},uBottom:{value:new Float32Array(o)}}})}var hr=.65,fr=new Set(["dimmed","sold"]),vr=new Set(["dimmed","sold","held"]);function Vo(t,e,o){let r=new Set,n=!1,i=me.indexOf("dimmed"),s=!1;for(let l=0;l<o.length;l+=1)if(o[l]===i){s=!0;break}let a=s?vr:fr;for(let l of t){let u=e.get(l.sectionId);if(!u||!u.length){r.add(l.sectionId);continue}let f=!1;for(let p of u){let v=me[o[p]]??"available";if(!a.has(v)){f=!0;break}}f?r.add(l.sectionId):n=!0}return{lit:r,anyUnlit:n}}function _o(t,e,o,r,n,i){let s=[];for(let a of t){let l=n===null||n.has(a.sectionId);if(r.get(a.sectionId)===l)continue;r.set(a.sectionId,l);let u=(a.start+a.count)*3;for(let f=a.start*3;f<u;f++)e[f]=l?o[f]:o[f]+(i[f%3]-o[f])*hr;s.push(a)}return s}function Lo(t,e,o,r,n,i){for(let s=o;s<o+r;s++){let l=i&&e[s]===0?null:n[e[s]]??n[0];t[s*3]=l?l[0]:i[s*3],t[s*3+1]=l?l[1]:i[s*3+1],t[s*3+2]=l?l[2]:i[s*3+2]}}var yr=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),xr=new Float32Array([-1,-1,3,-1,-1,3]);function Oo(t,e){let o=new ko,r=new ko,n=new _e(t,{position:{size:2,data:xr}}),i=Io(t,e.theme.background.top,e.theme.background.bottom),s=new ke(t,{geometry:n,program:i});s.frustumCulled=!1,s.setParent(r);let a=new _e(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=Fo(t,e.theme.materials.roughness),u=new ke(t,{geometry:a,program:l});u.frustumCulled=!1,u.setParent(o);let f=Do(t),p=new Float32Array(e.seats.count*3),v=me.map(V=>e.theme.seatStates[V]);Lo(p,e.seats.iState,0,e.seats.count,v,e.seats.iCategory);let c=new _e(t,{position:{size:2,data:yr},iOffset:{size:3,data:e.seats.iPosition,instanced:1},iColor:{size:3,data:p,instanced:1},iMaxRadius:{size:1,data:e.seats.iMaxRadius,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}}),d=new ke(t,{geometry:c,program:f});d.frustumCulled=!1,e.seats.count>0&&d.setParent(o);let E=c.attributes.iColor,C=e.solids.color.slice(),M=e.theme.structure.ground,k=new Map(e.sectionSolidRanges.map(V=>[V.sectionId,!0])),y=Zt(),D=To(t,e.theme.materials.roughness),P=Ke,x=new Float32Array(P*3),S=new Float32Array(P*3),T=new Float32Array(P),_=new Float32Array(P),O=new Float32Array(P),R=new Float32Array(P*3),Y=new Float32Array(P),j=new Float32Array(P),L=new Float32Array(P),G=new Float32Array(P),g=new _e(t,{position:{size:3,data:y.position},normal:{size:3,data:y.normal},part:{size:1,data:y.part},index:{data:y.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:S,instanced:1},iRadius:{size:1,data:T,instanced:1},iYaw:{size:1,data:_,instanced:1},iGlyph:{size:1,data:O,instanced:1},iRing:{size:3,data:R,instanced:1},iFloor:{size:1,data:Y,instanced:1},iPhysicalSeat:{size:1,data:j,instanced:1},iSeed:{size:1,data:G,instanced:1},iPickIndex:{size:1,data:L,instanced:1}}),w=new ke(t,{geometry:g,program:D});w.frustumCulled=!1;let W=0,b=!1,z=!1,$=null,U=null,ee=null,Z=new Int32Array(0),le=()=>{let V=e.seats;for(let N=0;N<W;N++){let F=Z[N];G[N]=Jt(V.iState[F],F);let B=V.iCategory&&V.iState[F]===0?null:v[V.iState[F]]??v[0];if(B)S[N*3]=B[0],S[N*3+1]=B[1],S[N*3+2]=B[2];else{let K=e.theme.materials.seat??Qt([V.iCategory[F*3],V.iCategory[F*3+1],V.iCategory[F*3+2]]);S[N*3]=K[0],S[N*3+1]=K[1],S[N*3+2]=K[2]}}g.attributes.iColor.needsUpdate=!0,g.attributes.iSeed.needsUpdate=!0},oe={main:o,background:r,seatProgram:f,solidProgram:l,chairProgram:D,seatGeometry:c,chairGeometry:g,solidGeometry:a,drawCalls:3,setNearSeats(V,N){let F=Math.min(N,P);if(Z=V,W=F,F===0){w.parent&&w.setParent(null),g.instancedCount=0,oe.drawCalls=3+(b?1:0);return}let q=e.seats;for(let B=0;B<F;B++){let K=V[B];x[B*3]=q.iPosition[K*3],x[B*3+1]=q.iPosition[K*3+1],x[B*3+2]=q.iPosition[K*3+2],T[B]=q.iChairWidth[K],_[B]=q.iYaw[K],O[B]=q.iGlyph[K],R[B*3]=q.iRing[K*3],R[B*3+1]=q.iRing[K*3+1],R[B*3+2]=q.iRing[K*3+2],Y[B]=q.iFloor[K],j[B]=q.iPhysicalSeat[K],L[B]=K+1}le(),g.attributes.iOffset.needsUpdate=!0,g.attributes.iRadius.needsUpdate=!0,g.attributes.iYaw.needsUpdate=!0,g.attributes.iGlyph.needsUpdate=!0,g.attributes.iRing.needsUpdate=!0,g.attributes.iFloor.needsUpdate=!0,g.attributes.iPhysicalSeat.needsUpdate=!0,g.attributes.iSeed.needsUpdate=!0,g.attributes.iPickIndex.needsUpdate=!0,g.instancedCount=F,w.parent||w.setParent(o),oe.drawCalls=4+(b?1:0)},nearSeatCount(){return W},setSectionShellLit(V){let N=_o(e.sectionSolidRanges,e.solids.color,C,k,V,M);if(!N.length)return;let F=a.attributes.color,q=F.buffer;if(!q){F.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,q);for(let B of N){let K=e.solids.color.subarray(B.start*3,(B.start+B.count)*3);t.bufferSubData(t.ARRAY_BUFFER,B.start*3*Float32Array.BYTES_PER_ELEMENT,K)}},uploadSeatStateRuns(V){if(!V.length)return;W&&le();for(let F of V)Lo(p,e.seats.iState,F.start,F.length,v,e.seats.iCategory);let N=E.buffer;if(!N){E.needsUpdate=!0;return}t.bindBuffer(t.ARRAY_BUFFER,N);for(let F of V){let q=p.subarray(F.start*3,(F.start+F.length)*3);t.bufferSubData(t.ARRAY_BUFFER,F.start*3*Float32Array.BYTES_PER_ELEMENT,q)}},dispose(){z=!0,n.remove(),i.remove(),a.remove(),l.remove(),c.remove(),f.remove(),g.remove(),D.remove(),$?.remove(),U?.remove(),ee?.texture&&t.deleteTexture(ee.texture)}},J=e.productionElements.find(V=>V.contentImageUrl&&V.contentPlane);if(J?.contentImageUrl&&J.contentPlane?.length===4&&typeof Image<"u"){let V=new Image;V.crossOrigin="anonymous",V.onload=()=>{if(z)return;let N=J.contentPlane;$=new _e(t,{position:{size:3,data:new Float32Array(N.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(J.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),ee=new gr(t,{image:V,generateMipmaps:!0,wrapS:t.CLAMP_TO_EDGE,wrapT:t.CLAMP_TO_EDGE,flipY:!1}),U=new br(t,{vertex:`#version 300 es
|
|
615
615
|
precision highp float;
|
|
616
616
|
in vec3 position; in vec2 uv; in float floorIndex;
|
|
617
617
|
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
|
|
@@ -619,4 +619,4 @@ void main() {
|
|
|
619
619
|
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
620
|
precision highp float;
|
|
621
621
|
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 R=new Le(t,{geometry:J,program:W});R.frustumCulled=!1,R.setParent(o),oe.screenProgram=W,g=!0,oe.drawCalls=3+(X?1:0)+1},I.src=Z.contentImageUrl}return oe}import{Mesh as Ft,RenderTarget as pr,Transform as Dt}from"ogl";function mr(t,e,o){let r=t+(e<<8)+(o<<16);return r===0?-1:r-1}function _o(t,e,o,r,n,i){let s=-1,a=1/0;for(let l=0;l<o;l++)for(let u=0;u<e;u++){let f=(l*e+u)*4,p=mr(t[f],t[f+1],t[f+2]);if(p<0||p>=i)continue;let b=u-r,c=l-n,d=b*b+c*c;d<a&&(a=d,s=p)}return s}function ko(t,e,o,r,n,i){let s=t-o.left,a=e-o.top,l=Math.round(s*r),u=Math.round((o.height-a)*r);return{x:Math.max(0,Math.min(n-1,l)),y:Math.max(0,Math.min(i-1,u))}}var hr=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],et=class{constructor(e,o,r,n,i){this.seatScene=new Dt;this.chairScene=new Dt;this.solidScene=new Dt;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=i,this.seatProg=So(this.gl),this.chairProg=Mo(this.gl),this.depthProg=Po(this.gl);let s=new Ft(this.gl,{geometry:o,program:this.seatProg});s.frustumCulled=!1,s.setParent(this.seatScene);let a=new Ft(this.gl,{geometry:r,program:this.chairProg});a.frustumCulled=!1,a.setParent(this.chairScene);let l=new Ft(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 hr)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 pr(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,u=Math.max(0,o-n),f=Math.max(0,r-n),p=Math.max(1,Math.min(a,o+n+1)-u),b=Math.max(1,Math.min(l,r+n+1)-f);i.enable(i.SCISSOR_TEST),i.scissor(u,f,p,b);let[c,d,E]=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,d,E,1),i.disable(i.SCISSOR_TEST);let P=new Uint8Array(p*b*4);return this.renderer.bindFramebuffer(s),i.readPixels(u,f,p,b,i.RGBA,i.UNSIGNED_BYTE,P),this.renderer.bindFramebuffer(),_o(P,p,b,o-u,r-f,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Lo(t,e){let o=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,qt(r.state)):o.push(r);return o}function Oo(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 Oe,Vec3 as br}from"ogl";function fr(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function zo(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function vr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function No(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 It(t){let e=Math.max(0,Math.min(1,t));return e*e*e*(e*(e*6-15)+10)}function Tt(t,e){return Math.max(0,Math.min(1,t+e))}function Bo(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],u=t[i+1],f=t[Math.min(o-1,i+2)],p=s*s,b=p*s,c=[0,0,0];for(let d=0;d<3;d++)c[d]=.5*(2*l[d]+(-a[d]+u[d])*s+(2*a[d]-5*l[d]+4*u[d]-f[d])*p+(-a[d]+3*l[d]-3*u[d]+f[d])*b);return c}function Vt(t,e,o,r,n){let i=No(fr(e,o));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let s=zo(zo(e,vr(i,2.5)),[0,1.5,0]),a=[e[0]-r[0],0,e[2]-r[2]],l=No(a);l[0]===0&&l[2]===0&&(l=[i[0],0,i[2]]);let u=Math.max(1,n),f=[r[0]+l[0]*u*1.3,r[1]+u*.75,r[2]+l[2]*u*1.3];return{waypoints:[t,f,s],finalPos:s}}function _t(t,e,o=35,r=28){let n=It(e),i=Bo(t,n),s=It(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:i,fov:o+(r-o)*s,eased:n}}function Uo(t,e,o){let r=t.position.clone(),n=new Oe().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 Oe().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(n),i}var tt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new Oe;this.endQuat=new Oe;this.outQuat=new Oe;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}=_t(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,Tt(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 Yo=Kt,gr=.12,yr=.25,xr=1.5;function Xo(t,e,o=0,r,n){let i=[e.x*Se,o+xr,e.y*Se],s=n?[n[0],n[1],n[2]]:i,a=t[1],l=Number.isFinite(a)?a+Yo:Number.isFinite(r)?o+r:o+Yo,u=i[0]-t[0],f=i[2]-t[2],p=Math.hypot(u,f),b=p>.001?Math.min(gr,p*yr):0,c=p>.001?u/p:0,d=p>.001?f/p:0;return{eye:[t[0]+c*b,l,t[2]+d*b],focal:s}}var xe=Math.PI/180,wr=45,qo=80,ot=70,Sr=1,Mr=.99;function Pr(t,e){if(!(t<Sr))return qo;if(!(Number.isFinite(e)&&e>0))return ot;let o=2*Math.atan(e/(2*nt*Mr)/Math.max(.05,t))/xe;return Math.max(ot,Math.min(qo,o))}var Cr=.25,nt=1,Ar=.25,Er=12*xe,Rr=.2,Fr=1.5,jo=.8,Ko=6,Jo=1.9,Dr=2/3,Ir=.12,Tr=.9,Vr=1.2,_r=2,en=.05,kr=6;function tn(t,e,o=0){if(!t.length)return{min:[e[0]-6,o,e[2]-6],max:[e[0]+6,Math.max(o+jo,e[1]),e[2]+6]};let r=1/0,n=-1/0,i=1/0,s=-1/0,a=o;for(let d of t)r=Math.min(r,d.cx-d.halfX),n=Math.max(n,d.cx+d.halfX),i=Math.min(i,d.cz-d.halfZ),s=Math.max(s,d.cz+d.halfZ),a=Math.max(a,d.y);let l=n-r,u=s-i,f=Math.max(l,Math.min(u,Ko))/2,p=Math.max(u,Math.min(l,Ko))/2,b=(r+n)/2,c=(i+s)/2;return{min:[b-f,o,c-p],max:[b+f,Math.max(o+jo,a),c+p]}}function Lr(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+Jo,t.max[2]]}}function kt(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+Fr,e+Rr,e+Jo*Dr),(t.min[2]+t.max[2])/2]}function on(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 Qo(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,u=Math.hypot(a,l);if(u<1e-6)return 1/0;a/=u,l/=u;let f=1/0,p=-1/0;for(let b=0;b<8;b++){let c=(b&1?o.max[0]:o.min[0])-t[0],d=(b&2?o.max[1]:o.min[1])-t[1],E=(b&4?o.max[2]:o.min[2])-t[2],P=Math.max(en,c*r+d*n+E*i),M=(c*a+E*l)/P;M<f&&(f=M),M>p&&(p=M)}return p-f}function $o(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,u=Math.hypot(a,l);if(u<1e-6)return 1/0;a/=u,l/=u;let f=-l*n,p=l*r-a*i,b=a*n,c=1/0,d=-1/0;for(let E=0;E<8;E++){let P=(E&1?o.max[0]:o.min[0])-t[0],M=(E&2?o.max[1]:o.min[1])-t[1],k=(E&4?o.max[2]:o.min[2])-t[2],y=Math.max(en,P*r+M*n+k*i),F=(P*f+M*p+k*b)/y;F<c&&(c=F),F>d&&(d=F)}return d-c}function rt(t,e){return Math.tan(t*xe/2)*Math.max(.05,e)}function Zo(t,e,o){let r=Pr(o,t),n=l=>Math.max(wr,Math.min(r,l)),i=l=>2*Math.atan(l)/xe,s=Number.isFinite(t)&&t>0?n(i(t/(2*Cr)/Math.max(.05,o))):r;if(!(Number.isFinite(e)&&e>0))return s;let a=Math.min(s,n(i(e/(2*Ir))));return t/(2*rt(a,o))>nt?s:a}function nn(t,e,o){let r=kt(e),n=[t[0],t[1],t[2]],i=0,s=0,a=c=>{if(!(c>0))return;let d=on(n,r);n[0]+=d.x*c,n[2]+=d.z*c,s+=c},l=e.max[1]+Ar-n[1];l>0&&(n[1]+=l,i=l,a(l/Math.tan(Er)));let u=Lr(e),f=Qo(n,r,e),p=Zo(f,$o(n,r,u),o),b=f/(2*rt(p,o));for(let c=0;c<kr&&b>nt;c++){let d=Math.max(1,Math.hypot(n[0]-r[0],n[2]-r[2])),E=Number.isFinite(b)?b/nt:2;a(Math.min(60,d*(Math.min(4,E)-1)+.5)),f=Qo(n,r,e),p=Zo(f,$o(n,r,u),o),b=f/(2*rt(p,o))}return{eye:n,focal:r,fov:p,raisedM:i,pulledBackM:s,stageFrameWidth:b}}function Or(t,e,o){let r=Math.tan(e*xe/2),n=rt(e,o);return Math.max(1,t/Math.max(.05,Math.min(r,n)))}function rn(t,e){let{aspect:o,venue:r}=e,n=t.focal,i=on(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=_r*(e.rowDepthM??Tr);a.push({name:"row",eye:[t.eye[0]+i.x*l,t.eye[1]+Vr,t.eye[2]+i.z*l],focal:n,fov:t.fov});let u=(b,c,d,E)=>{let P=Or(d,t.fov,o)*1.08,M=P*Math.sin(E*xe),k=P*Math.cos(E*xe);return{name:b,eye:[c[0]+i.x*k,c[1]+M,c[2]+i.z*k],focal:c,fov:t.fov}};e.section&&e.section.radius>0&&a.push(u("section",e.section.center,e.section.radius,14)),a.push(u("venue",r.center,Math.max(1,r.radius),26));let f=[],p=-1/0;for(let b of a){let c=s(b.eye);f.length&&c<=p+.5||(f.push(b),p=c)}return f}import{Vec3 as zr}from"ogl";var Ne=Math.PI/180,an=320,sn=70*Ne,Nr=32*Ne,Br=24*Ne,ln=.0026,Gr=.22,Hr=.006,Wr=180,Ur=4,se=(t,e,o)=>Math.max(e,Math.min(o,t)),cn=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function un(t){let{canvas:e,camera:o}=t,r=[],n=!1,i=0,s=0,a=0,l=0,u=0,f=0,p=!1,b=[0,0],c=0,d=!1,E=null,P=null,M=new Map,k=!1,y=0,F=0,v=0,w=0,D=()=>n&&r.length?r[se(Math.round(i),0,r.length-1)].name:null,T=()=>{let g=D();g!==E&&(E=g,t.onStopChange?.(g))},L=()=>{if(!n||!r.length)return;let g=r[se(Math.floor(i),0,r.length-1)],O=r[se(Math.ceil(i),0,r.length-1)],J=se(i-Math.floor(i),0,1),W=(Be,Ge)=>Be+(Ge-Be)*J,ee=[W(g.eye[0],O.eye[0]),W(g.eye[1],O.eye[1]),W(g.eye[2],O.eye[2])],$=[W(g.focal[0],O.focal[0]),W(g.focal[1],O.focal[1]),W(g.focal[2],O.focal[2])],le=$[0]-ee[0],oe=$[1]-ee[1],Z=$[2]-ee[2],I=Math.hypot(le,oe,Z)||1,N=Math.atan2(le,Z),R=Math.asin(se(oe/I,-1,1)),U=N+s,B=se(R+a,-80*Ne,80*Ne),q=Math.cos(B)*I;le=Math.sin(U)*q,oe=Math.sin(B)*I,Z=Math.cos(U)*q,o.position.set(ee[0],ee[1],ee[2]),o.fov=W(g.fov,O.fov),o.updateProjectionMatrix(),o.lookAt(new zr(ee[0]+le,ee[1]+oe,ee[2]+Z)),t.onApplied?.()},z=()=>{if(!n||!r.length)return;let g=se(Math.round(i),0,r.length-1);if(t.reducedMotion()){p=!1,i=g,L(),T(),t.requestRender();return}if(Math.abs(g-i)<.001){p=!1,T();return}l=i,u=g,f=performance.now(),p=!0,t.requestRender()},C=g=>{!n||r.length<2||(p=!1,i=se(i+g,0,r.length-1),L(),T(),t.requestRender())},Q=(g,O)=>{n&&(p=!1,d=!1,s=se(s-g*ln,-sn,sn),a=se(a-O*ln,-Br,Nr),L(),t.requestRender())},K=g=>{n&&(M.set(g.pointerId,{x:g.clientX,y:g.clientY}),M.size===1?(k=!0,w=0,y=g.clientX,F=g.clientY):M.size===2&&(k=!1,v=V()))},V=()=>{let g=[...M.values()];return g.length<2?0:Math.hypot(g[0].x-g[1].x,g[0].y-g[1].y)},G=g=>{if(!n||!M.has(g.pointerId))return;if(M.set(g.pointerId,{x:g.clientX,y:g.clientY}),M.size>=2){let W=V();v>0&&C((v-W)*Hr),v=W;return}if(!k)return;let O=g.clientX-y,J=g.clientY-F;y=g.clientX,F=g.clientY,w+=Math.abs(O)+Math.abs(J),!(w<=Ur)&&Q(O,J)},x=g=>{M.delete(g.pointerId)&&(M.size<2&&(v=0),M.size===0&&(k=!1,z()))},S=g=>{if(!n)return;g.preventDefault();let O=g.deltaMode===1?16:g.deltaMode===2?100:1,J=se(g.deltaY*O/100,-2,2);C(J*Gr),P&&clearTimeout(P),P=setTimeout(()=>{P=null,z()},Wr)},X=()=>{n&&(n=!1,p=!1,d=!1,r=[],M.clear(),k=!1,P&&(clearTimeout(P),P=null),E!==null&&(E=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",K),e.addEventListener("pointermove",G),e.addEventListener("pointerup",x),e.addEventListener("pointercancel",x),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,p=!1,d=!1,E=null,L(),T(),t.requestRender()},exit:X,recentre(){return n?Math.abs(s)<1e-4&&Math.abs(a)<1e-4?!0:t.reducedMotion()?(d=!1,s=0,a=0,L(),t.requestRender(),!0):(b=[s,a],c=performance.now(),d=!0,t.requestRender(),!0):!1},update(g){if(!n)return!1;let O=!1;if(d){let J=se((g-c)/an,0,1),W=1-cn(J);s=b[0]*W,a=b[1]*W,J>=1?(d=!1,s=0,a=0):O=!0}if(p){let J=se((g-f)/an,0,1);i=l+(u-l)*cn(J),J>=1?(p=!1,i=u,T()):O=!0}return L(),O},currentStop:D,dispose(){X(),e.removeEventListener("pointerdown",K),e.removeEventListener("pointermove",G),e.removeEventListener("pointerup",x),e.removeEventListener("pointercancel",x),e.removeEventListener("wheel",S)}}}function dn(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var Lt=null;function mn(){return Lt??=import("../openPanorama-6FMXAJ6O.js").catch(t=>{throw Lt=null,t}),Lt}var pn=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),it=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=pn(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(pn()-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 hn(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function fn(t){let{container:e,model:o,opts:r,expandedSeatById:n,seatIdsByRow:i,isNarrow:s}=t,a=null,l=()=>{if(!a)return;let p=s();Object.assign(a.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{a?.remove(),a=null};return{show:(p,b,c=!1)=>{if(u(),t.isDisposed())return null;let d=document.createElement("div");d.setAttribute("role","group"),Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let E=r.chrome?.caption!==!1,P=r.chrome?.seatStepper!==!1;if(!E&&!P)return null;let M=n.get(p),k=M?.sectionId?o.sections.find(z=>z.id===M.sectionId):void 0,y=M?.label??p;d.setAttribute("aria-label",`Explore views near ${k?.label?`${k.label}, `:""}seat ${y}`);let F=document.createElement("span");F.textContent=r.seatViewCaption?.(p)??["Live 3D seat view",k?.label,y].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)"}),E&&d.appendChild(F);let v=document.createElement("div");Object.assign(v.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),d.appendChild(v);let w=M?.rowId?i.get(M.rowId):void 0,D=w?.indexOf(p)??-1,T=D>=0?[w?.[D-1],w?.[D+1]]:[void 0,void 0],L=(z,C,Q,K=!1)=>{let V=document.createElement("button");V.type="button",V.textContent=z,V.setAttribute("aria-label",C),Object.assign(V.style,{minHeight:"44px",padding:K?"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"}),K||(V.style.minWidth="44px"),K&&(V.dataset.panoramaTrigger=""),V.addEventListener("click",Q),v.appendChild(V)};if(P&&T[0]){let z=n.get(T[0])?.label??T[0];L("\u2039",`View previous seat ${z}`,()=>{t.flyToSeat(T[0])})}if(P&&r.getSeatView){let z=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";L(c?`\u21BB Retry ${z}`:`\u25C9 ${z}`,`${c?"Retry":z} from seat ${y}`,()=>{if(t.isDisposed()||b!==t.flightGen()){u();return}u(),t.openPanorama(p,400,b)},!0)}if(P&&T[1]){let z=n.get(T[1])?.label??T[1];L("\u203A",`View next seat ${z}`,()=>{t.flyToSeat(T[1])})}return!v.childElementCount&&!E?null:(e.appendChild(d),a=d,l(),d)},remove:u,layout:l}}function vn(t){let{container:e,orbit:o,isNarrow:r}=t,n=document.createElement("div"),i=!1;n.className="sl-3d-navigation-controls",Object.assign(n.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D drag mode"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D view controls"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("button");l.type="button",l.textContent="\u21BB",l.setAttribute("aria-label","Drag to rotate the 3D venue"),l.dataset.tooltip="Rotate venue";let u=document.createElement("button");u.type="button",u.textContent="\u2725",u.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),u.dataset.tooltip="Move venue";let f=document.createElement("button");f.type="button",f.textContent="\u2212",f.setAttribute("aria-label","Zoom out of the 3D venue"),f.dataset.tooltip="Zoom out";let p=document.createElement("button");p.type="button",p.textContent="+",p.setAttribute("aria-label","Zoom into the 3D venue"),p.dataset.tooltip="Zoom in";for(let P of[l,u,f,p])P.className="sl-3d-icon-control",Object.assign(P.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"});s.append(l,u),a.append(p,f);let b=P=>{o.setPrimaryDragMode(P);let M=P==="orbit";l.setAttribute("aria-pressed",String(M)),u.setAttribute("aria-pressed",String(!M)),l.style.background=M?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",u.style.background=M?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",n.title=M?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};l.addEventListener("click",()=>b("orbit")),u.addEventListener("click",()=>b("pan")),f.addEventListener("click",()=>o.zoomBy(1.22)),p.addEventListener("click",()=>o.zoomBy(.82)),n.append(s,a),b("orbit"),e.appendChild(n);let c=t.enabled!==!1,d=()=>{let P=r();n.style.display=i||!c?"none":"flex",n.style.right=P?"12px":"14px",n.style.bottom=P?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",s.style.display=P?"none":"flex",p.style.display=P?"none":"",f.style.display=P?"none":""};return d(),{element:n,utilityControls:a,setNavigationMode:b,setSeatViewLocked:P=>{i=P,o.setInteractionEnabled(!P),d()},seatViewLocked:()=>i,layout:d}}function bn(t){let{glctx:e,orbit:o,model:r,seats:n,opts:i,cinematic:s,analytics:a,seatIdByIndex:l,sectionIdBySeatId:u,tapSlop:f,tapMs:p,cancelFlight:b,focusSectionCamera:c,setSelection:d,ensureSeatView:E}=t,P=0,M=0,k=0,y=-1,F=!1,v=!1,w=C=>{t.seatViewLocked()||y===-1&&(y=C.pointerId,P=C.clientX,M=C.clientY,k=performance.now(),F=!1,v=s.active,s.active&&(a.cinematicCancelled(),b(),i.onViewTargetChange?.(null)))},D=C=>{C.pointerId===y&&Math.hypot(C.clientX-P,C.clientY-M)>f&&(F=!0)},T=(C,Q,K,V,G)=>{let x=e.canvas.getBoundingClientRect(),S=e.canvas.clientWidth||x.width||1,X=e.canvas.clientHeight||x.height||1,g=C-x.left,O=Q-x.top,J=V*V,W=-1,ee=J,$=1/0;for(let le of n){if(K&&le.sectionId!==K)continue;let oe=r.seats.idToIndex.get(le.id);if(oe===void 0)continue;if(G){let B=Math.round(r.seats.iState[oe]??0);if(B!==0&&B!==3)continue}let Z=oe*3,I=fe(o.camera.projectionViewMatrix,[r.seats.iPosition[Z],r.seats.iPosition[Z+1]+.55,r.seats.iPosition[Z+2]],S,X);if(!I.visible)continue;let N=I.x-g,R=I.y-O,U=N*N+R*R;(U<ee||Math.abs(U-ee)<1&&I.depth<$)&&(W=oe,ee=U,$=I.depth)}return W},L=(C,Q)=>{let K=t.gpu(),V=t.pick();if(!K||!V)return-1;V.syncFromSeatProgram(K.seatProgram);let G=e.canvas.getBoundingClientRect(),x=e.renderer.dpr,{x:S,y:X}=ko(C,Q,G,x,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),g=Math.max(2,Math.round(8*x));return V.pick(o.camera,S,X,g)};return{onDown:w,onMove:D,onUp:C=>{if(C.pointerId!==y)return;let Q=!F&&performance.now()-k<p;if(y=-1,v){v=!1;return}let K=t.gpu(),V=t.pick();if(!Q||!K||!V)return;let G=L(C.clientX,C.clientY);if(t.focusedSectionId()&&G>=0){let X=l[G],g=X?u.get(X):void 0;if(g&&g!==t.focusedSectionId()&&c(g))return}if(t.focusedSectionId()&&G<0&&(G=T(C.clientX,C.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&G<0){let X=T(C.clientX,C.clientY,null,72,!1),g=X>=0?l[X]:void 0,O=g?u.get(g):void 0;if(O&&O!==t.focusedSectionId()&&c(O))return}if(!t.focusedSectionId()){G<0&&(G=T(C.clientX,C.clientY,null,42,!1));let X=G>=0?l[G]:void 0,g=X?u.get(X):void 0;if(g&&c(g))return}if(G<0||G>=l.length){t.selection().size&&(d([]),i.onViewTargetChange?.(null));return}let x=l[G],S=me[Math.round(r.seats.iState[G]??0)]??"available";if(S!=="available"&&S!=="selected"){i.onSeatInspect?.(x,S);return}if(t.selection().has(x)&&t.selection().size===1){d([]),i.onViewTargetChange?.(null),i.onSeatPick?.(x);return}d([x]),E(x),a.seatPicked(x,u.get(x)),i.onSeatPick?.(x)}}}var at=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 d=e[c*3],E=e[c*3+2];d<o&&(o=d),d>n&&(n=d),E<r&&(r=E),E>i&&(i=E)}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,u=new Int32Array(l+1),f=c=>{let d=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+d};for(let c=0;c<this.count;c++)u[f(c)+1]++;for(let c=0;c<l;c++)u[c+1]+=u[c];let p=new Int32Array(this.count),b=u.slice(0,l);for(let c=0;c<this.count;c++)p[b[f(c)]++]=c;this.cellStart=u,this.cellItems=p}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,u=Math.floor((e-this.minX)/this.cell),f=Math.floor((o-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,b=this.iPosition,c=0;for(let d=0;d<=p&&c<a;d++){let E=f-d,P=f+d,M=u-d,k=u+d;for(let y=E;y<=P&&c<a;y++){if(y<0||y>=this.rows)continue;let F=y===E||y===P;for(let v=M;v<=k&&c<a;v++){if(!F&&v!==M&&v!==k){v=k-1;continue}if(v<0||v>=this.cols)continue;let w=y*this.cols+v;for(let D=i[w],T=i[w+1];D<T&&c<a;D++){let L=s[D],z=b[L*3]-e,C=b[L*3+2]-o;z*z+C*C<=l&&(n[c++]=L)}}}}return c}};var st=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Qe);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new at(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)<Pt)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>Mt){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let a=this.nearIndex.gather(n.x,n.z,Mt,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 Yr,Vec3 as Xr}from"ogl";function gn(){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 yn(t){let{container:e,model:o,opts:r,orbit:n,cinematic:i,analytics:s,loop:a,labelOverlay:l,stageAzimuth:u,overviewFraming:f}=t,p=0,b=-1,c=(v,w,D=28)=>{n.camera.position.set(v[0],v[1],v[2]),n.camera.lookAt(new Xr(w[0],w[1],w[2])),n.camera.fov=D,n.camera.updateProjectionMatrix()},d=document.createElement("button");d.className="sl-3d-overview-control sl-3d-icon-control",d.type="button",d.replaceChildren(gn()),d.setAttribute("aria-label","Fit the active level or whole venue in view"),d.dataset.tooltip="Fit view",Object.assign(d.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=()=>{d.firstElementChild||d.replaceChildren(gn())};E();let P=v=>{b=v;let w=t.gpu();w&&(w.seatProgram.uniforms.uFocusFloor.value=v,w.solidProgram.uniforms.uFocusFloor.value=v,w.chairProgram.uniforms.uFocusFloor.value=v),t.showSectionSeatLabels(null)},M=()=>{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(),d.style.display="",l.setVisible(!0),t.setFrozen(!1);let v=b>=0?o.floors[b]:null;if(t.setNearFieldDetailEnabled(!!v),t.setSeatViewLocked(!1),k(),t.removeArriveChip(),t.setNavigationMode("orbit"),v){let w=v.focalWorld[0]-v.center[0],D=v.focalWorld[2]-v.center[2],T=Math.hypot(w,D)>v.radius*.12?Math.atan2(w,D):u,L={center:v.center,radius:v.radius,box:v.box},z={polarDeg:58,margin:1.12};t.reducedMotion()?n.frame(L,!1,T,!1,z):n.frameSoft(L,T,!1,z)}else t.reducedMotion()?n.frame(o.bounds,!1,u,r.portraitOverviewCrop===!0,f):n.frameSoft(o.bounds,u,r.portraitOverviewCrop===!0,f);t.showSectionSeatLabels(null),a.requestRender()},k=()=>{p++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),i.active&&(i.cancel(),n.resumeAfterFlight(o.focalWorld))},y=v=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let w=o.seats.idToIndex.get(v);if(w===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(v),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),d.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 T=++p;D?t.showArriveChip(v,T):t.removeArriveChip();let{eye:L,focal:z}=t.resolvedSeatViewPose(v,w),C=r.arriveAtSeatEye?t.seatViewArrival(v,w):null,Q=C?C.focal:z,K=[n.camera.position.x,n.camera.position.y,n.camera.position.z],V=Vt(K,C?.eye??L,Q,o.bounds.center,o.bounds.radius),G=C?C.eye:r.arriveAtSeatEye?L:V.finalPos,x=C?C.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?ot:65:28,S=[V.waypoints[0],V.waypoints[1],G];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),c(G,Q,x),a.requestRender(),s.cinematicSkipped(),t.isDisposed()||n.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),C&&t.enterSeatView(C.stops),t.showArriveChip(v,T),Promise.resolve();let X=new Yr().copy(n.camera.quaternion),g=Uo(n.camera,G,Q);a.requestRender();let O=D?700:2500;return i.start(S,X,g,O,x).then(()=>{t.isDisposed()||T!==p||(t.setSeatStepping(!1),s.cinematicPlayed(O),n.resumeAfterFlight(Q),t.setSeatViewLocked(r.arriveAtSeatEye===!0),C&&t.enterSeatView(C.stops),a.requestRender(),t.showArriveChip(v,T))})},F=v=>{let w=o.sections.find(z=>z.id===v);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&&P(w.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(v);let D=w.focalWorld[0]-w.center[0],T=w.focalWorld[2]-w.center[2],L=Math.hypot(D,T)>w.radius*.12?Math.atan2(D,T):void 0;return n.frame({center:w.center,radius:Math.max(5,w.radius*.5)},!1,L),r.onSectionFocusChange?.(v),a.requestRender(),!0};return d.addEventListener("click",M),{overviewChip:d,layoutOverviewChip:E,flightGen:()=>p,focusedFloor:()=>b,applyFloorFocus:P,placeCameraFinal:c,cancelFlight:k,focusOverview:M,flyToSeat:y,focusSectionCamera:F}}function xn(t){let e=performance.now();return{model:Te(t),buildMs:performance.now()-e,source:"main"}}function qr(t){let e=Ut(t.doc);return{...xn({...t,seats:e}),seats:e}}function wn(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=u=>{i||(i=!0,clearTimeout(l),r.terminate(),n(u))},a=()=>s(e()),l=window.setTimeout(a,15e3);r.onerror=a,r.onmessage=u=>{let f=o(u.data);f?s(f):a()},r.postMessage(t)})}function jr(t){return wn(t,()=>xn(t),({model:e,buildMs:o})=>({model:e,buildMs:o,source:"worker"}))}function Kr(t){return wn(t,()=>qr(t),({model:e,buildMs:o,seats:r})=>r?{model:e,buildMs:o,seats:r,source:"worker"}:null)}var Qr=Math.PI/180,$r=6,Zr=500;function qa(t,e,o={}){let r=performance.now(),n=e.prepared?.model??Te(e),i=new it(o.onAnalytics),s=new Array(n.seats.count);for(let[m,h]of n.seats.idToIndex)s[h]=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 h=l.get(m.rowId);h?h.push(m.id):l.set(m.rowId,[m.id])}let u=new Map;for(let m of e.seats)u.set(m.id,m.sectionId);let f=new Map;for(let[m,h]of n.seats.idToIndex){let A=u.get(m);if(!A)continue;let H=f.get(A);H?H.push(h):f.set(A,[h])}let p=()=>{if(!c||!n.sectionSolidRanges.length)return;let{lit:m,anyUnlit:h}=Fo(n.sectionSolidRanges,f,n.seats.iState);c.setSectionShellLit(h?m:null)},b=e.doc.floors?.some(h=>(h.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(h=>h.objects)??e.doc.objects).some(h=>h.type==="section"&&((h.height??0)>0||(h.rake??0)>0)),c=null,d=null,E=!1,P=!1,M=!1,k=new Map,y=null,F=null,v=null,w=new Map,D=null,T=()=>{v===null&&(v=t.style.zIndex,t.style.zIndex="20")},L=()=>{v!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=v),v=null)},z=!1,C=()=>z?ie.focusedFloor():-1,Q=()=>{c=Vo(x.gl,n),p(),d=new et(x.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,n.seats.count),x.setClearColor(n.theme.background.top),d.setRestoreClear(n.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=Ie*n.theme.seatScale,c.seatProgram.uniforms.uFocusFloor.value=C(),c.solidProgram.uniforms.uFocusFloor.value=C(),c.chairProgram.uniforms.uFocusFloor.value=C(),c.screenProgram&&(c.screenProgram.uniforms.uFocusFloor.value=C()),V.forceRegather()},K=!1,V=new st({model:n,orbit:()=>S,gpu:()=>c}),G=m=>V.setDetailEnabled(m),x=new qe(t,{onContextLost:()=>{M||i.contextLost(),E=!0,R.stop(),c=null,d=null},onContextRestored:()=>{Q(),E=!1,M||i.contextRestored(),R.requestRender()}}),S=new je(x.gl,x.canvas,()=>R.requestRender(),()=>i.orbitEngaged());S.setAspect(x.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],h=n.focalWorld[2]-n.bounds.center[2];return Math.hypot(m,h)>n.bounds.radius*.12?Math.atan2(m,h):void 0})(),O=n.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},J=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;S.frame(n.bounds,!J&&o.skipInitialOverviewAnimation!==!0,g,o.portraitOverviewCrop===!0,O);let W=new tt(S.camera),ee=hn(t),$=new Ze(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:n.theme.background.top}),le=n.labels,oe=()=>Zt(le,n.floors.length,C());$.setLabels(oe());let Z=null,I=m=>{if(Z=m,$.setForcedDense(!!m),!m){$.setLabels(oe());return}let h=e.seats.filter(_=>_.sectionId===m),A=new Set(h.map(_=>_.id)),H=new Set(h.map(_=>_.rowId)),Y=new Set(k.keys()),j=new Set(h.filter(_=>Y.has(_.id)).map(_=>_.id)),te=oe().filter(_=>_.kind!=="row"&&_.kind!=="seat"||(_.kind==="row"?H.has(_.id.slice(4)):A.has(_.id.slice(5))&&(j.size===0||j.has(_.id.slice(5)))));if(n.seatCount<=6e3&&j.size===0){$.setLabels(te);return}let ne=j.size?h.filter(_=>j.has(_.id)):h,ve=new Set(ne.map(_=>`seat:${_.id}`)),he=ne.flatMap(_=>{let ae=n.seats.idToIndex.get(_.id);if(ae===void 0)return[];let ce=ae*3;return[{id:`seat:${_.id}`,kind:"seat",text:_.displayLabel||_.label,anchor:[n.seats.iPosition[ce],n.seats.iPosition[ce+1]+(Y.has(_.id)?1.05:.55),n.seats.iPosition[ce+2]]}]});$.setLabels([...te.filter(_=>!ve.has(_.id)),...he])};Q();let N=null,R=new Ke(m=>{if(E||!c||P)return!1;let h=dn({flying:W.active,panoramaMounted:y!==null,seatViewActive:N?.active===!0}),A=h==="cinematic"?W.update(performance.now()):h==="seatView"?N.update(performance.now()):h==="orbit"?S.update():!1,H=C()>=0?n.floors[C()]:null,Y=H?.radius??n.bounds.radius,j=po(S.currentDistance,Y),te=K?{center:[S.camera.position.x,S.camera.position.y,S.camera.position.z],radius:520}:n.renderBounds;S.updateClipping(te);let ne=H?.center??n.renderBounds.center,ve=H?.radius??n.renderBounds.radius,he=(ue,De)=>Math.hypot(S.camera.position.x-ue[0],S.camera.position.y-ue[1],S.camera.position.z-ue[2])<=De*(V.detailVisible?1.8:1.55),_=he(ne,ve);if(!_&&Z){let ue=n.sections.find(De=>De.id===Z);ue&&(_=he(ue.center,Math.max(12,ue.radius*2)))}V.detailVisible=_;let ae=c.seatProgram.uniforms;ae.uSeatScale.value=j.scale,ae.uSeatFade.value=j.fade;let ce=!!H&&ho(H.seatCount,x.canvas.clientWidth||1,x.canvas.clientHeight||1),We=fo(n.seats.count,Y,S.currentDistance,S.camera.fov,x.canvas.clientHeight||1),Fe=V.detailVisible||ce||We?1:0,Ue=V.detailVisible||C()>=0||n.floors.length>1?1:0;return V.ease(m,Fe,Ue),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*Qr/2)/Math.max(1,x.pixelHeight),V.update(V.detailVisible),x.renderer.render({scene:c.background,clear:!0}),x.renderer.render({scene:c.main,camera:S.camera,clear:!1}),$.update(S.camera.projectionViewMatrix,x.canvas.clientWidth||1,x.canvas.clientHeight||1,S.currentDistance,Y,[S.camera.position.x,S.camera.position.y,S.camera.position.z]),A||V.seatDetailMix!==Fe||V.structureDetailMix!==Ue}),U=typeof ResizeObserver<"u"?new ResizeObserver(()=>ht.resize()):null;U?.observe(t);let B=m=>{let h=Y=>{let j=n.seats.idToIndex.get(Y);return j===void 0?void 0:n.seats.iState[j]},{updates:A,next:H}=Oo(k,m,h);if(k=H,$.setSelectedSeatIds(k.keys()),Z&&I(Z),A.length){let Y=gt(n.seats,A);c&&c.uploadSeatStateRuns(Y),p(),R.requestRender()}},q=()=>D!==null?D:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Be=8,Ge=m=>{if(!o.getSeatView)return null;let h=w.get(m);if(!h)for(h=Promise.resolve(o.getSeatView(m)),w.set(m,h),h.catch(()=>{w.get(m)===h&&w.delete(m)});w.size>Be;){let A=w.keys().next().value;if(A===void 0)break;w.delete(A)}return h},Ot=tn(n.stages,n.focalWorld,n.bounds.groundY??0),Sn=kt(Ot),lt=(m,h)=>{let A=a.get(m),H=Math.max(0,Math.round(n.seats.iFloor[h]??0)),Y=e.doc.floors?.[H],j=n.floors[H],te=Y?.focalPoint??e.doc.focalPoint,ne=j?{x:j.focalWorld[0]/Se,y:j.focalWorld[2]/Se}:te,ve=A?.focalPoint?{x:A.focalPoint.x+ne.x-te.x,y:A.focalPoint.y+ne.y-te.y}:ne,he=[n.seats.iPosition[h*3],n.seats.iPosition[h*3+1],n.seats.iPosition[h*3+2]];return Xo(he,ve,Y?.baseHeightM??0,A?.eyeHeightM,Sn)},zt=()=>(t.clientWidth||x.canvas.clientWidth)<=520,ct=null,Nt=null,Mn=async(m,h,A)=>{if(!o.getSeatView||M||A!==ie.flightGen())return;let H;try{H=await mn()}catch{if(i.panoramaFailed(m,"mount"),!M&&A===ie.flightGen()){let Y=dt(m,A,!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(M||A!==ie.flightGen()||!ct))return Nt??=H.createOpenPanorama(ct),Nt(m,h,A)},ut=fn({container:t,model:n,opts:o,expandedSeatById:a,seatIdsByRow:l,isNarrow:zt,isDisposed:()=>M,flightGen:()=>ie.flightGen(),flyToSeat:m=>Ht(m),openPanorama:(m,h,A)=>Mn(m,h,A)}),dt=ut.show,mt=ut.remove,Pn=ut.layout,we=vn({container:t,orbit:S,isNarrow:zt,enabled:o.chrome?.controlDock!==!1}),Cn=we.element,Ee=we.setNavigationMode,An=we.layout,En=we.utilityControls,Re=null,Bt=!1,He=m=>{we.setSeatViewLocked(m),m||N?.exit()};N=un({canvas:x.canvas,camera:S.camera,requestRender:()=>R.requestRender(),reducedMotion:q,onStopChange:m=>{let h=m??(Bt?"seat":null);Re=h;try{o.onSeatViewStopChange?.(h)}catch{}},onApplied:()=>{M||S.syncFromCamera()}});let Rn=(m,h)=>{let{eye:A}=lt(m,h),H=(t.clientWidth||x.canvas.clientWidth||1)/Math.max(1,t.clientHeight||x.canvas.clientHeight||1),Y=nn(A,Ot,H);if(o.seatViewStops===!1)return{...Y,stops:[]};let j=u.get(m),te=j?n.sections.find(ne=>ne.id===j):void 0;return{...Y,stops:rn(Y,{aspect:H,section:te&&te.seatCount>0?{center:te.center,radius:te.radius}:null,venue:{center:n.bounds.center,radius:n.bounds.radius}})}},ie=yn({container:t,model:n,opts:o,orbit:S,cinematic:W,analytics:i,loop:R,labelOverlay:$,stageAzimuth:g,overviewFraming:O,gpu:()=>c,isDisposed:()=>M,panorama:()=>y,setPanorama:m=>{y=m},setPanoramaSphereVisible:m=>{K=m},panoramaLoadAbort:()=>F,setPanoramaLoadAbort:m=>{F=m},setFrozen:m=>{P=m},restorePanoramaLayer:L,reducedMotion:q,resolvedSeatViewPose:lt,showSectionSeatLabels:I,setNearFieldDetailEnabled:G,setSeatViewLocked:He,setNavigationMode:Ee,showArriveChip:dt,removeArriveChip:mt,inSeatView:()=>Re!==null,setSeatStepping:m=>{Bt=m},seatViewArrival:(m,h)=>o.arriveAtSeatEye?Rn(m,h):null,enterSeatView:m=>N?.enter(m)});z=!0;let pt=ie.overviewChip,Fn=ie.layoutOverviewChip,Dn=ie.applyFloorFocus,In=ie.focusOverview,Gt=ie.cancelFlight,Ht=ie.flyToSeat,Wt=ie.focusSectionCamera;En.appendChild(pt),ct={container:t,model:n,opts:o,analytics:i,orbit:S,loop:R,seatsById:a,ensureSeatView:Ge,resolvedSeatViewPose:lt,gpu:()=>c,gl:x.gl,isContextLost:()=>E,isDisposed:()=>M,flightGen:()=>ie.flightGen(),setPanorama:m=>{y=m},getLoadAbort:()=>F,setLoadAbort:m=>{F=m},setPanoramaSphereVisible:m=>{K=m,m&&N?.exit()},setFrozen:m=>{P=m},raisePanoramaLayer:T,restorePanoramaLayer:L,getOverviewChip:()=>pt,labelOverlay:$,reducedMotion:q,removeArriveChip:mt,showArriveChip:dt};let pe=bn({glctx:x,orbit:S,model:n,seats:e.seats,opts:o,cinematic:W,analytics:i,seatIdByIndex:s,sectionIdBySeatId:u,tapSlop:$r,tapMs:Zr,gpu:()=>c,pick:()=>d,seatViewLocked:()=>we.seatViewLocked(),focusedSectionId:()=>Z,selection:()=>k,cancelFlight:Gt,focusSectionCamera:Wt,setSelection:B,ensureSeatView:Ge});x.canvas.addEventListener("pointerdown",pe.onDown),x.canvas.addEventListener("pointermove",pe.onMove),x.canvas.addEventListener("pointerup",pe.onUp),x.canvas.addEventListener("pointercancel",pe.onUp),R.requestRender();let ht={setAvailability(m){let h=Lo(k,m),A=gt(n.seats,h);A.length&&c&&c.uploadSeatStateRuns(A),p(),R.requestRender()},setSelection:B,setNavigationMode:Ee,zoomIn(){S.zoomBy(.82),R.requestRender()},zoomOut(){S.zoomBy(1.22),R.requestRender()},flyToSeat:Ht,focusOverview:In,seatViewStop:()=>Re,recentreSeatView:()=>N?.recentre()??!1,resize(){let{width:m,height:h}=x.resize();S.setAspect(m/Math.max(1,h)),Pn(),An(),Fn(),R.requestRender()},stats(){return{...R.stats(),drawCalls:c?c.drawCalls:0,seatCount:n.seatCount}},getQualityEvidence(){let m=R.stats(),h=x.canvas.clientWidth||1,A=x.canvas.clientHeight||1,H=n.bounds.center,Y=fe(S.camera.projectionViewMatrix,[H[0],n.bounds.box.min[1],H[2]],h,A),j=fe(S.camera.projectionViewMatrix,[H[0],n.bounds.box.max[1],H[2]],h,A),te=n.bounds.box,ne=[te.min[0],te.max[0]].flatMap(_=>[te.min[1],te.max[1]].flatMap(ae=>[te.min[2],te.max[2]].map(ce=>fe(S.camera.projectionViewMatrix,[_,ae,ce],h,A)))).filter(_=>Number.isFinite(_.x)&&Number.isFinite(_.y)&&Number.isFinite(_.depth)),ve=ne.length?(()=>{let _=Math.min(...ne.map(be=>be.x)),ae=Math.max(...ne.map(be=>be.x)),ce=Math.min(...ne.map(be=>be.y)),We=Math.max(...ne.map(be=>be.y)),Fe=Math.max(0,_),Ue=Math.min(h,ae),ue=Math.max(0,ce),De=Math.min(A,We),Ye=Math.max(0,Ue-Fe),ft=Math.max(0,De-ue);return{box:{x:Fe,y:ue,width:Ye,height:ft},horizontalFillRatio:Ye/h,verticalFillRatio:ft/A,visibleAreaRatio:Ye*ft/(h*A),clippedEdges:[...ce<0?["top"]:[],...ae>h?["right"]:[],...We>A?["bottom"]:[],..._<0?["left"]:[]]}})():void 0,he=String(x.gl.getParameter(x.gl.VERSION)??"");return{viewport:{width:h,height:A},context:{webgl2:/webgl\s*2/i.test(he),lost:E},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:Y.visible&&j.visible?Math.abs(Y.y-j.y):0},labels:$.qualityEvidence(),framing:ve,...Re?{seatView:{fovDeg:S.camera.fov,stop:Re}}:{}}},getQualityReport(){return Rt(ht.getQualityEvidence())},loseContextForTest(){x.simulateContextLossCycle()},floors(){return n.floors},focusFloor(m){if(m!==null&&!n.floors.some(A=>A.index===m))return!1;let h=m??-1;if(G(m!==null),He(!1),Dn(h),Ee("orbit"),m===null)W.cancel(),q()?S.frame(n.bounds,!1,g,o.portraitOverviewCrop===!0,O):S.frameSoft(n.bounds,g,o.portraitOverviewCrop===!0,O);else{let A=n.floors[m];if(A.seatCount>0){W.cancel();let H=A.focalWorld[0]-A.center[0],Y=A.focalWorld[2]-A.center[2],j=Math.hypot(H,Y)>A.radius*.12?Math.atan2(H,Y):g;S.frame({center:A.center,radius:A.radius,box:A.box},!1,j,!1,{polarDeg:58,margin:1.12})}}return R.requestRender(),!0},zones(){return n.zones},focusZone(m){let h=n.zones.find(j=>j.id===m);if(!h||h.seatCount===0)return!1;G(!1),He(!1),W.cancel(),Ee("orbit"),I(null),o.onSectionFocusChange?.(null);let A=h.focalWorld[0]-h.center[0],H=h.focalWorld[2]-h.center[2],Y=Math.hypot(A,H)>h.radius*.12?Math.atan2(A,H):void 0;return S.frame({center:h.center,radius:h.radius*1.25},!1,Y),R.requestRender(),!0},sections(){return n.sections},focusSection(m){return Wt(m)},rows(m){return m?n.rows.filter(h=>h.sectionId===m):n.rows},seatsInRow(m){return e.seats.filter(h=>h.rowId===m).map(h=>({id:h.id,label:h.displayLabel||h.label}))},focusRow(m){let h=n.rows.find(A=>A.id===m);return!h||h.seatCount===0?!1:(G(!0),He(!1),W.cancel(),Ee("pan"),h.sectionId&&(I(h.sectionId),o.onSectionFocusChange?.(h.sectionId)),S.frame({center:h.center,radius:Math.max(2.5,h.radius*.65)}),R.requestRender(),!0)},setReducedMotionForTest(m){D=m},dispose(){M=!0,mt(),pt.remove(),Cn.remove(),Gt(),N?.dispose(),R.stop(),$.dispose(),U?.disconnect(),y&&(y.dispose(),y=null),L(),ee(),x.canvas.removeEventListener("pointerdown",pe.onDown),x.canvas.removeEventListener("pointermove",pe.onMove),x.canvas.removeEventListener("pointerup",pe.onUp),x.canvas.removeEventListener("pointercancel",pe.onUp),S.dispose(),d&&d.dispose(),c&&c.dispose(),c=null,d=null,x.dispose()}};return i.opened(n.seatCount,b,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),ht}export{Bn as VENUE3D_QUALITY_REPORT_VERSION,Te as buildSceneModel,Rt as inspectVenue3DQualityEvidence,qa as mountVenue3D,jr as prepareVenue3D,Kr as prepareVenue3DFromChart};
|
|
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 F=new ke(t,{geometry:$,program:U});F.frustumCulled=!1,F.setParent(o),oe.screenProgram=U,b=!0,oe.drawCalls=3+(W?1:0)+1},V.src=J.contentImageUrl}return oe}import{Mesh as Tt,RenderTarget as wr,Transform as It}from"ogl";function Sr(t,e,o){let r=t+(e<<8)+(o<<16);return r===0?-1:r-1}function zo(t,e,o,r,n,i){let s=-1,a=1/0;for(let l=0;l<o;l++)for(let u=0;u<e;u++){let f=(l*e+u)*4,p=Sr(t[f],t[f+1],t[f+2]);if(p<0||p>=i)continue;let v=u-r,c=l-n,d=v*v+c*c;d<a&&(a=d,s=p)}return s}function No(t,e,o,r,n,i){let s=t-o.left,a=e-o.top,l=Math.round(s*r),u=Math.round((o.height-a)*r);return{x:Math.max(0,Math.min(n-1,l)),y:Math.max(0,Math.min(i-1,u))}}var Mr=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],et=class{constructor(e,o,r,n,i){this.seatScene=new It;this.chairScene=new It;this.solidScene=new It;this.target=null;this.restoreClear=[0,0,0];this.renderer=e,this.gl=e.gl,this.maxIndex=i,this.seatProg=Ao(this.gl),this.chairProg=Eo(this.gl),this.depthProg=Ro(this.gl);let s=new Tt(this.gl,{geometry:o,program:this.seatProg});s.frustumCulled=!1,s.setParent(this.seatScene);let a=new Tt(this.gl,{geometry:r,program:this.chairProg});a.frustumCulled=!1,a.setParent(this.chairScene);let l=new Tt(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 Mr)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 wr(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,u=Math.max(0,o-n),f=Math.max(0,r-n),p=Math.max(1,Math.min(a,o+n+1)-u),v=Math.max(1,Math.min(l,r+n+1)-f);i.enable(i.SCISSOR_TEST),i.scissor(u,f,p,v);let[c,d,E]=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,d,E,1),i.disable(i.SCISSOR_TEST);let C=new Uint8Array(p*v*4);return this.renderer.bindFramebuffer(s),i.readPixels(u,f,p,v,i.RGBA,i.UNSIGNED_BYTE,C),this.renderer.bindFramebuffer(),zo(C,p,v,o-u,r-f,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Bo(t,e){let o=[];for(let r of e)t.has(r.seatId)?t.set(r.seatId,Kt(r.state)):o.push(r);return o}function Go(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 Le,Vec3 as Ar}from"ogl";function Pr(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function Ho(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function Cr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Wo(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 _t(t,e){return Math.max(0,Math.min(1,t+e))}function Uo(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],u=t[i+1],f=t[Math.min(o-1,i+2)],p=s*s,v=p*s,c=[0,0,0];for(let d=0;d<3;d++)c[d]=.5*(2*l[d]+(-a[d]+u[d])*s+(2*a[d]-5*l[d]+4*u[d]-f[d])*p+(-a[d]+3*l[d]-3*u[d]+f[d])*v);return c}function kt(t,e,o,r,n){let i=Wo(Pr(e,o));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let s=Ho(Ho(e,Cr(i,2.5)),[0,1.5,0]),a=[e[0]-r[0],0,e[2]-r[2]],l=Wo(a);l[0]===0&&l[2]===0&&(l=[i[0],0,i[2]]);let u=Math.max(1,n),f=[r[0]+l[0]*u*1.3,r[1]+u*.75,r[2]+l[2]*u*1.3];return{waypoints:[t,f,s],finalPos:s}}function Lt(t,e,o=35,r=28){let n=Vt(e),i=Uo(t,n),s=Vt(Math.max(0,Math.min(1,(e-.66)/.34)));return{pos:i,fov:o+(r-o)*s,eased:n}}function jo(t,e,o){let r=t.position.clone(),n=new Le().copy(t.quaternion);t.position.set(e[0],e[1],e[2]),t.lookAt(new Ar(o[0],o[1],o[2]));let i=new Le().copy(t.quaternion);return t.position.copy(r),t.quaternion.copy(n),i}var tt=class{constructor(e){this.active=!1;this.waypoints=[];this.startQuat=new Le;this.endQuat=new Le;this.outQuat=new Le;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}=Lt(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,_t(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 Ko=$t,Er=.12,Rr=.25,Fr=1.5;function Qo(t,e,o=0,r,n){let i=[e.x*we,o+Fr,e.y*we],s=n?[n[0],n[1],n[2]]:i,a=t[1],l=Number.isFinite(a)?a+Ko:Number.isFinite(r)?o+r:o+Ko,u=i[0]-t[0],f=i[2]-t[2],p=Math.hypot(u,f),v=p>.001?Math.min(Er,p*Rr):0,c=p>.001?u/p:0,d=p>.001?f/p:0;return{eye:[t[0]+c*v,l,t[2]+d*v],focal:s}}var xe=Math.PI/180,Dr=45,$o=80,ot=70,Tr=1,Ir=.99;function Vr(t,e){if(!(t<Tr))return $o;if(!(Number.isFinite(e)&&e>0))return ot;let o=2*Math.atan(e/(2*nt*Ir)/Math.max(.05,t))/xe;return Math.max(ot,Math.min($o,o))}var _r=.25,nt=1,kr=.25,Lr=12*xe,Or=.2,zr=1.5,Zo=.8,Jo=6,nn=1.9,Nr=2/3,Br=.12,Gr=.9,Hr=1.2,Wr=2,rn=.05,Ur=6;function an(t,e,o=0){if(!t.length)return{min:[e[0]-6,o,e[2]-6],max:[e[0]+6,Math.max(o+Zo,e[1]),e[2]+6]};let r=1/0,n=-1/0,i=1/0,s=-1/0,a=o;for(let d of t)r=Math.min(r,d.cx-d.halfX),n=Math.max(n,d.cx+d.halfX),i=Math.min(i,d.cz-d.halfZ),s=Math.max(s,d.cz+d.halfZ),a=Math.max(a,d.y);let l=n-r,u=s-i,f=Math.max(l,Math.min(u,Jo))/2,p=Math.max(u,Math.min(l,Jo))/2,v=(r+n)/2,c=(i+s)/2;return{min:[v-f,o,c-p],max:[v+f,Math.max(o+Zo,a),c+p]}}function Yr(t){return{min:[t.min[0],t.min[1],t.min[2]],max:[t.max[0],t.max[1]+nn,t.max[2]]}}function Ot(t){let e=t.max[1];return[(t.min[0]+t.max[0])/2,Math.max(t.min[1]+zr,e+Or,e+nn*Nr),(t.min[2]+t.max[2])/2]}function sn(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 en(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,u=Math.hypot(a,l);if(u<1e-6)return 1/0;a/=u,l/=u;let f=1/0,p=-1/0;for(let v=0;v<8;v++){let c=(v&1?o.max[0]:o.min[0])-t[0],d=(v&2?o.max[1]:o.min[1])-t[1],E=(v&4?o.max[2]:o.min[2])-t[2],C=Math.max(rn,c*r+d*n+E*i),M=(c*a+E*l)/C;M<f&&(f=M),M>p&&(p=M)}return p-f}function tn(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,u=Math.hypot(a,l);if(u<1e-6)return 1/0;a/=u,l/=u;let f=-l*n,p=l*r-a*i,v=a*n,c=1/0,d=-1/0;for(let E=0;E<8;E++){let C=(E&1?o.max[0]:o.min[0])-t[0],M=(E&2?o.max[1]:o.min[1])-t[1],k=(E&4?o.max[2]:o.min[2])-t[2],y=Math.max(rn,C*r+M*n+k*i),D=(C*f+M*p+k*v)/y;D<c&&(c=D),D>d&&(d=D)}return d-c}function rt(t,e){return Math.tan(t*xe/2)*Math.max(.05,e)}function on(t,e,o){let r=Vr(o,t),n=l=>Math.max(Dr,Math.min(r,l)),i=l=>2*Math.atan(l)/xe,s=Number.isFinite(t)&&t>0?n(i(t/(2*_r)/Math.max(.05,o))):r;if(!(Number.isFinite(e)&&e>0))return s;let a=Math.min(s,n(i(e/(2*Br))));return t/(2*rt(a,o))>nt?s:a}function ln(t,e,o){let r=Ot(e),n=[t[0],t[1],t[2]],i=0,s=0,a=c=>{if(!(c>0))return;let d=sn(n,r);n[0]+=d.x*c,n[2]+=d.z*c,s+=c},l=e.max[1]+kr-n[1];l>0&&(n[1]+=l,i=l,a(l/Math.tan(Lr)));let u=Yr(e),f=en(n,r,e),p=on(f,tn(n,r,u),o),v=f/(2*rt(p,o));for(let c=0;c<Ur&&v>nt;c++){let d=Math.max(1,Math.hypot(n[0]-r[0],n[2]-r[2])),E=Number.isFinite(v)?v/nt:2;a(Math.min(60,d*(Math.min(4,E)-1)+.5)),f=en(n,r,e),p=on(f,tn(n,r,u),o),v=f/(2*rt(p,o))}return{eye:n,focal:r,fov:p,raisedM:i,pulledBackM:s,stageFrameWidth:v}}function Xr(t,e,o){let r=Math.tan(e*xe/2),n=rt(e,o);return Math.max(1,t/Math.max(.05,Math.min(r,n)))}function cn(t,e){let{aspect:o,venue:r}=e,n=t.focal,i=sn(t.eye,n),s=v=>(v[0]-n[0])*i.x+(v[2]-n[2])*i.z,a=[{name:"seat",eye:t.eye,focal:n,fov:t.fov}],l=Wr*(e.rowDepthM??Gr);a.push({name:"row",eye:[t.eye[0]+i.x*l,t.eye[1]+Hr,t.eye[2]+i.z*l],focal:n,fov:t.fov});let u=(v,c,d,E)=>{let C=Xr(d,t.fov,o)*1.08,M=C*Math.sin(E*xe),k=C*Math.cos(E*xe);return{name:v,eye:[c[0]+i.x*k,c[1]+M,c[2]+i.z*k],focal:c,fov:t.fov}};e.section&&e.section.radius>0&&a.push(u("section",e.section.center,e.section.radius,14)),a.push(u("venue",r.center,Math.max(1,r.radius),26));let f=[],p=-1/0;for(let v of a){let c=s(v.eye);f.length&&c<=p+.5||(f.push(v),p=c)}return f}import{Vec3 as qr}from"ogl";var ze=Math.PI/180,un=320,dn=70*ze,jr=32*ze,Kr=24*ze,mn=.0026,Qr=.22,$r=.006,Zr=180,Jr=4,se=(t,e,o)=>Math.max(e,Math.min(o,t)),pn=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function hn(t){let{canvas:e,camera:o}=t,r=[],n=!1,i=0,s=0,a=0,l=0,u=0,f=0,p=!1,v=[0,0],c=0,d=!1,E=null,C=null,M=new Map,k=!1,y=0,D=0,P=0,x=0,S=()=>n&&r.length?r[se(Math.round(i),0,r.length-1)].name:null,T=()=>{let b=S();b!==E&&(E=b,t.onStopChange?.(b))},_=()=>{if(!n||!r.length)return;let b=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=(Ne,Be)=>Ne+(Be-Ne)*$,ee=[U(b.eye[0],z.eye[0]),U(b.eye[1],z.eye[1]),U(b.eye[2],z.eye[2])],Z=[U(b.focal[0],z.focal[0]),U(b.focal[1],z.focal[1]),U(b.focal[2],z.focal[2])],le=Z[0]-ee[0],oe=Z[1]-ee[1],J=Z[2]-ee[2],V=Math.hypot(le,oe,J)||1,N=Math.atan2(le,J),F=Math.asin(se(oe/V,-1,1)),q=N+s,B=se(F+a,-80*ze,80*ze),K=Math.cos(B)*V;le=Math.sin(q)*K,oe=Math.sin(B)*V,J=Math.cos(q)*K,o.position.set(ee[0],ee[1],ee[2]),o.fov=U(b.fov,z.fov),o.updateProjectionMatrix(),o.lookAt(new qr(ee[0]+le,ee[1]+oe,ee[2]+J)),t.onApplied?.()},O=()=>{if(!n||!r.length)return;let b=se(Math.round(i),0,r.length-1);if(t.reducedMotion()){p=!1,i=b,_(),T(),t.requestRender();return}if(Math.abs(b-i)<.001){p=!1,T();return}l=i,u=b,f=performance.now(),p=!0,t.requestRender()},R=b=>{!n||r.length<2||(p=!1,i=se(i+b,0,r.length-1),_(),T(),t.requestRender())},Y=(b,z)=>{n&&(p=!1,d=!1,s=se(s-b*mn,-dn,dn),a=se(a-z*mn,-Kr,jr),_(),t.requestRender())},j=b=>{n&&(M.set(b.pointerId,{x:b.clientX,y:b.clientY}),M.size===1?(k=!0,x=0,y=b.clientX,D=b.clientY):M.size===2&&(k=!1,P=L()))},L=()=>{let b=[...M.values()];return b.length<2?0:Math.hypot(b[0].x-b[1].x,b[0].y-b[1].y)},G=b=>{if(!n||!M.has(b.pointerId))return;if(M.set(b.pointerId,{x:b.clientX,y:b.clientY}),M.size>=2){let U=L();P>0&&R((P-U)*$r),P=U;return}if(!k)return;let z=b.clientX-y,$=b.clientY-D;y=b.clientX,D=b.clientY,x+=Math.abs(z)+Math.abs($),!(x<=Jr)&&Y(z,$)},g=b=>{M.delete(b.pointerId)&&(M.size<2&&(P=0),M.size===0&&(k=!1,O()))},w=b=>{if(!n)return;b.preventDefault();let z=b.deltaMode===1?16:b.deltaMode===2?100:1,$=se(b.deltaY*z/100,-2,2);R($*Qr),C&&clearTimeout(C),C=setTimeout(()=>{C=null,O()},Zr)},W=()=>{n&&(n=!1,p=!1,d=!1,r=[],M.clear(),k=!1,C&&(clearTimeout(C),C=null),E!==null&&(E=null,t.onStopChange?.(null)))};return e.addEventListener("pointerdown",j),e.addEventListener("pointermove",G),e.addEventListener("pointerup",g),e.addEventListener("pointercancel",g),e.addEventListener("wheel",w,{passive:!1}),{get active(){return n},enter(b){if(b.length<2){W();return}r=b,n=!0,i=0,s=0,a=0,p=!1,d=!1,E=null,_(),T(),t.requestRender()},exit:W,recentre(){return n?Math.abs(s)<1e-4&&Math.abs(a)<1e-4?!0:t.reducedMotion()?(d=!1,s=0,a=0,_(),t.requestRender(),!0):(v=[s,a],c=performance.now(),d=!0,t.requestRender(),!0):!1},update(b){if(!n)return!1;let z=!1;if(d){let $=se((b-c)/un,0,1),U=1-pn($);s=v[0]*U,a=v[1]*U,$>=1?(d=!1,s=0,a=0):z=!0}if(p){let $=se((b-f)/un,0,1);i=l+(u-l)*pn($),$>=1?(p=!1,i=u,T()):z=!0}return _(),z},currentStop:S,dispose(){W(),e.removeEventListener("pointerdown",j),e.removeEventListener("pointermove",G),e.removeEventListener("pointerup",g),e.removeEventListener("pointercancel",g),e.removeEventListener("wheel",w)}}}function fn(t){return t.flying?"cinematic":t.panoramaMounted?"panorama":t.seatViewActive?"seatView":"orbit"}var zt=null;function vn(){return zt??=import("../openPanorama-6FMXAJ6O.js").catch(t=>{throw zt=null,t}),zt}var bn=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),it=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=bn(),this.emit("3d_panorama_opened")}panoramaClosed(){let e=this.panoramaOpenedAt?Math.round(bn()-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 gn(t){let e=t.style.position;return getComputedStyle(t).position!=="static"?()=>{}:(t.style.position="relative",()=>{t.style.position==="relative"&&(t.style.position=e)})}function yn(t){let{container:e,model:o,opts:r,expandedSeatById:n,seatIdsByRow:i,isNarrow:s}=t,a=null,l=()=>{if(!a)return;let p=s();Object.assign(a.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{a?.remove(),a=null};return{show:(p,v,c=!1)=>{if(u(),t.isDisposed())return null;let d=document.createElement("div");d.setAttribute("role","group"),Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let E=r.chrome?.caption!==!1,C=r.chrome?.seatStepper!==!1;if(!E&&!C)return null;let M=n.get(p),k=M?.sectionId?o.sections.find(O=>O.id===M.sectionId):void 0,y=M?.label??p;d.setAttribute("aria-label",`Explore views near ${k?.label?`${k.label}, `:""}seat ${y}`);let D=document.createElement("span");D.textContent=r.seatViewCaption?.(p)??["Live 3D seat view",k?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(D.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)"}),E&&d.appendChild(D);let P=document.createElement("div");Object.assign(P.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),d.appendChild(P);let x=M?.rowId?i.get(M.rowId):void 0,S=x?.indexOf(p)??-1,T=S>=0?[x?.[S-1],x?.[S+1]]:[void 0,void 0],_=(O,R,Y,j=!1)=>{let L=document.createElement("button");L.type="button",L.textContent=O,L.setAttribute("aria-label",R),Object.assign(L.style,{minHeight:"44px",padding:j?"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"}),j||(L.style.minWidth="44px"),j&&(L.dataset.panoramaTrigger=""),L.addEventListener("click",Y),P.appendChild(L)};if(C&&T[0]){let O=n.get(T[0])?.label??T[0];_("\u2039",`View previous seat ${O}`,()=>{t.flyToSeat(T[0])})}if(C&&r.getSeatView){let O=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";_(c?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${c?"Retry":O} from seat ${y}`,()=>{if(t.isDisposed()||v!==t.flightGen()){u();return}u(),t.openPanorama(p,400,v)},!0)}if(C&&T[1]){let O=n.get(T[1])?.label??T[1];_("\u203A",`View next seat ${O}`,()=>{t.flyToSeat(T[1])})}return!P.childElementCount&&!E?null:(e.appendChild(d),a=d,l(),d)},remove:u,layout:l}}function xn(t){let{container:e,orbit:o,isNarrow:r}=t,n=document.createElement("div"),i=!1;n.className="sl-3d-navigation-controls",Object.assign(n.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D drag mode"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D view controls"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("button");l.type="button",l.textContent="\u21BB",l.setAttribute("aria-label","Drag to rotate the 3D venue"),l.dataset.tooltip="Rotate venue";let u=document.createElement("button");u.type="button",u.textContent="\u2725",u.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),u.dataset.tooltip="Move venue";let f=document.createElement("button");f.type="button",f.textContent="\u2212",f.setAttribute("aria-label","Zoom out of the 3D venue"),f.dataset.tooltip="Zoom out";let p=document.createElement("button");p.type="button",p.textContent="+",p.setAttribute("aria-label","Zoom into the 3D venue"),p.dataset.tooltip="Zoom in";for(let C of[l,u,f,p])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"});s.append(l,u),a.append(p,f);let v=C=>{o.setPrimaryDragMode(C);let M=C==="orbit";l.setAttribute("aria-pressed",String(M)),u.setAttribute("aria-pressed",String(!M)),l.style.background=M?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",u.style.background=M?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",n.title=M?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};l.addEventListener("click",()=>v("orbit")),u.addEventListener("click",()=>v("pan")),f.addEventListener("click",()=>o.zoomBy(1.22)),p.addEventListener("click",()=>o.zoomBy(.82)),n.append(s,a),v("orbit"),e.appendChild(n);let c=t.enabled!==!1,d=()=>{let C=r();n.style.display=i||!c?"none":"flex",n.style.right=C?"12px":"14px",n.style.bottom=C?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",s.style.display=C?"none":"flex",p.style.display=C?"none":"",f.style.display=C?"none":""};return d(),{element:n,utilityControls:a,setNavigationMode:v,setSeatViewLocked:C=>{i=C,o.setInteractionEnabled(!C),d()},seatViewLocked:()=>i,layout:d}}var ei=12;function ti(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)>ei}function Sn(t){let{glctx:e,orbit:o,model:r,seats:n,opts:i,cinematic:s,analytics:a,seatIdByIndex:l,sectionIdBySeatId:u,tapSlop:f,tapMs:p,cancelFlight:v,focusSectionCamera:c,setSelection:d,ensureSeatView:E}=t,C=0,M=0,k=0,y=-1,D=!1,P=!1,x=R=>{t.seatViewLocked()||y===-1&&(y=R.pointerId,C=R.clientX,M=R.clientY,k=performance.now(),D=!1,P=s.active,s.active&&(a.cinematicCancelled(),v(),i.onViewTargetChange?.(null)))},S=R=>{R.pointerId===y&&Math.hypot(R.clientX-C,R.clientY-M)>f&&(D=!0)},T=(R,Y,j,L,G)=>{let g=e.canvas.getBoundingClientRect(),w=e.canvas.clientWidth||g.width||1,W=e.canvas.clientHeight||g.height||1,b=R-g.left,z=Y-g.top,$=L*L,U=-1,ee=$,Z=1/0;for(let le of n){if(j&&le.sectionId!==j)continue;let oe=r.seats.idToIndex.get(le.id);if(oe===void 0)continue;if(G){let B=Math.round(r.seats.iState[oe]??0);if(B!==0&&B!==3)continue}let J=oe*3,V=fe(o.camera.projectionViewMatrix,[r.seats.iPosition[J],r.seats.iPosition[J+1]+.55,r.seats.iPosition[J+2]],w,W);if(!V.visible)continue;let N=V.x-b,F=V.y-z,q=N*N+F*F;(q<ee||Math.abs(q-ee)<1&&V.depth<Z)&&(U=oe,ee=q,Z=V.depth)}return U},_=(R,Y)=>{let j=t.gpu(),L=t.pick();if(!j||!L)return-1;L.syncFromSeatProgram(j.seatProgram);let G=e.canvas.getBoundingClientRect(),g=e.renderer.dpr,{x:w,y:W}=No(R,Y,G,g,e.gl.drawingBufferWidth,e.gl.drawingBufferHeight),b=Math.max(2,Math.round(8*g));return L.pick(o.camera,w,W,b)};return{onDown:x,onMove:S,onUp:R=>{if(R.pointerId!==y)return;let Y=!D&&performance.now()-k<p;if(y=-1,P){P=!1;return}let j=t.gpu(),L=t.pick();if(!Y||!j||!L)return;let G=_(R.clientX,R.clientY);if(t.focusedSectionId()&&G>=0){let W=l[G],b=W?u.get(W):void 0;if(b&&b!==t.focusedSectionId()&&c(b))return}if(t.focusedSectionId()&&G<0&&(G=T(R.clientX,R.clientY,t.focusedSectionId(),44,!1)),t.focusedSectionId()&&G<0){let W=T(R.clientX,R.clientY,null,72,!1),b=W>=0?l[W]:void 0,z=b?u.get(b):void 0;if(z&&z!==t.focusedSectionId()&&c(z))return}if(!t.focusedSectionId()){G<0&&(G=T(R.clientX,R.clientY,null,42,!1));let W=G>=0?l[G]:void 0,b=W?u.get(W):void 0;if(b&&c(b))return}if(G<0||G>=l.length){t.selection().size&&(d([]),i.onViewTargetChange?.(null));return}let g=l[G],w=me[Math.round(r.seats.iState[G]??0)]??"available";if(w!=="available"&&w!=="selected"){i.onSeatInspect?.(g,w);return}if(t.selection().has(g)&&t.selection().size===1){d([]),i.onViewTargetChange?.(null),i.onSeatPick?.(g);return}if(d([g]),E(g),a.seatPicked(g,u.get(g)),i.onSeatPick?.(g),t.focusedSectionId()){let W=G*3,b=[r.seats.iPosition[W],r.seats.iPosition[W+1],r.seats.iPosition[W+2]];ti(o.camera?.position,b)&&t.focusSeatCamera(g)}}}}var at=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 d=e[c*3],E=e[c*3+2];d<o&&(o=d),d>n&&(n=d),E<r&&(r=E),E>i&&(i=E)}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,u=new Int32Array(l+1),f=c=>{let d=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+d};for(let c=0;c<this.count;c++)u[f(c)+1]++;for(let c=0;c<l;c++)u[c+1]+=u[c];let p=new Int32Array(this.count),v=u.slice(0,l);for(let c=0;c<this.count;c++)p[v[f(c)]++]=c;this.cellStart=u,this.cellItems=p}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,u=Math.floor((e-this.minX)/this.cell),f=Math.floor((o-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,v=this.iPosition,c=0;for(let d=0;d<=p&&c<a;d++){let E=f-d,C=f+d,M=u-d,k=u+d;for(let y=E;y<=C&&c<a;y++){if(y<0||y>=this.rows)continue;let D=y===E||y===C;for(let P=M;P<=k&&c<a;P++){if(!D&&P!==M&&P!==k){P=k-1;continue}if(P<0||P>=this.cols)continue;let x=y*this.cols+P;for(let S=i[x],T=i[x+1];S<T&&c<a;S++){let _=s[S],O=v[_*3]-e,R=v[_*3+2]-o;O*O+R*R<=l&&(n[c++]=_)}}}}return c}};var st=class{constructor(e){this.ctx=e;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Ke);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new at(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)<Pt)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>Mt){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let a=this.nearIndex.gather(n.x,n.z,Mt,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 oi,Vec3 as ni}from"ogl";function wn(){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 Cn(t){let{container:e,model:o,opts:r,orbit:n,cinematic:i,analytics:s,loop:a,labelOverlay:l,stageAzimuth:u,overviewFraming:f}=t,p=0,v=-1,c=(x,S,T=28)=>{n.camera.position.set(x[0],x[1],x[2]),n.camera.lookAt(new ni(S[0],S[1],S[2])),n.camera.fov=T,n.camera.updateProjectionMatrix()},d=document.createElement("button");d.className="sl-3d-overview-control sl-3d-icon-control",d.type="button",d.replaceChildren(wn()),d.setAttribute("aria-label","Fit the active level or whole venue in view"),d.dataset.tooltip="Fit view",Object.assign(d.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=()=>{d.firstElementChild||d.replaceChildren(wn())};E();let C=x=>{v=x;let S=t.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=x,S.solidProgram.uniforms.uFocusFloor.value=x,S.chairProgram.uniforms.uFocusFloor.value=x),t.showSectionSeatLabels(null)},M=()=>{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(),d.style.display="",l.setVisible(!0),t.setFrozen(!1);let x=v>=0?o.floors[v]:null;if(t.setNearFieldDetailEnabled(!!x),t.setSeatViewLocked(!1),k(),t.removeArriveChip(),t.setNavigationMode("orbit"),x){let S=x.focalWorld[0]-x.center[0],T=x.focalWorld[2]-x.center[2],_=Math.hypot(S,T)>x.radius*.12?Math.atan2(S,T):u,O={center:x.center,radius:x.radius,box:x.box},R={polarDeg:58,margin:1.12};t.reducedMotion()?n.frame(O,!1,_,!1,R):n.frameSoft(O,_,!1,R)}else t.reducedMotion()?n.frame(o.bounds,!1,u,r.portraitOverviewCrop===!0,f):n.frameSoft(o.bounds,u,r.portraitOverviewCrop===!0,f);t.showSectionSeatLabels(null),a.requestRender()},k=()=>{p++,t.setSeatStepping(!1),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),i.active&&(i.cancel(),n.resumeAfterFlight(o.focalWorld))},y=x=>{if(t.isDisposed()||!t.gpu())return Promise.resolve();let S=o.seats.idToIndex.get(x);if(S===void 0)return Promise.resolve();t.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(x),t.panorama()&&(t.panorama().dispose(),t.setPanorama(null),t.setPanoramaSphereVisible(!1),d.style.display="",t.restorePanoramaLayer()),t.panoramaLoadAbort()?.abort(),t.setPanoramaLoadAbort(null),t.setFrozen(!1);let T=t.inSeatView()&&r.arriveAtSeatEye===!0;t.setSeatStepping(T),t.setSeatViewLocked(!1);let _=++p;T?t.showArriveChip(x,_):t.removeArriveChip();let{eye:O,focal:R}=t.resolvedSeatViewPose(x,S),Y=r.arriveAtSeatEye?t.seatViewArrival(x,S):null,j=Y?Y.focal:R,L=[n.camera.position.x,n.camera.position.y,n.camera.position.z],G=kt(L,Y?.eye??O,j,o.bounds.center,o.bounds.radius),g=Y?Y.eye:r.arriveAtSeatEye?O:G.finalPos,w=Y?Y.fov:r.arriveAtSeatEye?e.clientWidth/Math.max(1,e.clientHeight)<.7?ot:65:28,W=[G.waypoints[0],G.waypoints[1],g];if(l.setVisible(!1),t.reducedMotion())return t.setSeatStepping(!1),c(g,j,w),a.requestRender(),s.cinematicSkipped(),t.isDisposed()||n.syncFromCamera(),t.setSeatViewLocked(r.arriveAtSeatEye===!0),Y&&t.enterSeatView(Y.stops),t.showArriveChip(x,_),Promise.resolve();let b=new oi().copy(n.camera.quaternion),z=jo(n.camera,g,j);a.requestRender();let $=T?700:2500;return i.start(W,b,z,$,w).then(()=>{t.isDisposed()||_!==p||(t.setSeatStepping(!1),s.cinematicPlayed($),n.resumeAfterFlight(j),t.setSeatViewLocked(r.arriveAtSeatEye===!0),Y&&t.enterSeatView(Y.stops),a.requestRender(),t.showArriveChip(x,_))})},D=x=>{let S=o.sections.find(R=>R.id===x);if(!S||S.seatCount===0)return!1;t.setNearFieldDetailEnabled(!0),t.setSeatStepping(!1),t.setSeatViewLocked(!1),i.cancel(),t.removeArriveChip(),o.floors.length>1&&v!==S.floorIndex&&C(S.floorIndex),t.setNavigationMode("pan"),t.showSectionSeatLabels(x);let T=S.focalWorld[0]-S.center[0],_=S.focalWorld[2]-S.center[2],O=Math.hypot(T,_)>S.radius*.12?Math.atan2(T,_):void 0;return n.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,O),r.onSectionFocusChange?.(x),a.requestRender(),!0},P=x=>{if(t.isDisposed()||!t.gpu())return!1;let S=o.seats.idToIndex.get(x);if(S===void 0)return!1;let T=S*3,_=[o.seats.iPosition[T],o.seats.iPosition[T+1]+.55,o.seats.iPosition[T+2]];return t.reducedMotion()?n.frame({center:_,radius:Mn},!1,void 0,!1,Pn):n.frameSoft({center:_,radius:Mn},void 0,!1,Pn),a.requestRender(),!0};return d.addEventListener("click",M),{overviewChip:d,layoutOverviewChip:E,flightGen:()=>p,focusedFloor:()=>v,applyFloorFocus:C,placeCameraFinal:c,cancelFlight:k,focusOverview:M,flyToSeat:y,focusSectionCamera:D,focusSeatCamera:P}}var Mn=4.5,Pn={polarDeg:48,margin:1.25};function An(t){let e=performance.now();return{model:Ie(t),buildMs:performance.now()-e,source:"main"}}function ri(t){let e=Xt(t.doc);return{...An({...t,seats:e}),seats:e}}function En(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=u=>{i||(i=!0,clearTimeout(l),r.terminate(),n(u))},a=()=>s(e()),l=window.setTimeout(a,15e3);r.onerror=a,r.onmessage=u=>{let f=o(u.data);f?s(f):a()},r.postMessage(t)})}function ii(t){return En(t,()=>An(t),({model:e,buildMs:o})=>({model:e,buildMs:o,source:"worker"}))}function ai(t){return En(t,()=>ri(t),({model:e,buildMs:o,seats:r})=>r?{model:e,buildMs:o,seats:r,source:"worker"}:null)}var si=Math.PI/180,li=6,ci=500;function is(t,e,o={}){let r=performance.now(),n=e.prepared?.model??Ie(e),i=new it(o.onAnalytics),s=new Array(n.seats.count);for(let[m,h]of n.seats.idToIndex)s[h]=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 h=l.get(m.rowId);h?h.push(m.id):l.set(m.rowId,[m.id])}let u=new Map;for(let m of e.seats)u.set(m.id,m.sectionId);let f=new Map;for(let[m,h]of n.seats.idToIndex){let A=u.get(m);if(!A)continue;let H=f.get(A);H?H.push(h):f.set(A,[h])}let p=()=>{if(!c||!n.sectionSolidRanges.length)return;let{lit:m,anyUnlit:h}=Vo(n.sectionSolidRanges,f,n.seats.iState);c.setSectionShellLit(h?m:null)},v=e.doc.floors?.some(h=>(h.baseHeightM??0)>0)?!0:(e.doc.floors?.flatMap(h=>h.objects)??e.doc.objects).some(h=>h.type==="section"&&((h.height??0)>0||(h.rake??0)>0)),c=null,d=null,E=!1,C=!1,M=!1,k=new Map,y=null,D=null,P=null,x=new Map,S=null,T=()=>{P===null&&(P=t.style.zIndex,t.style.zIndex="20")},_=()=>{P!==null&&(t.style.zIndex==="20"&&(t.style.zIndex=P),P=null)},O=!1,R=()=>O?re.focusedFloor():-1,Y=()=>{c=Oo(g.gl,n),p(),d=new et(g.renderer,c.seatGeometry,c.chairGeometry,c.solidGeometry,n.seats.count),g.setClearColor(n.theme.background.top),d.setRestoreClear(n.theme.background.top),c.seatProgram.uniforms.uSeatRadius.value=Te*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()),L.forceRegather()},j=!1,L=new st({model:n,orbit:()=>w,gpu:()=>c}),G=m=>L.setDetailEnabled(m),g=new Xe(t,{onContextLost:()=>{M||i.contextLost(),E=!0,F.stop(),c=null,d=null},onContextRestored:()=>{Y(),E=!1,M||i.contextRestored(),F.requestRender()}}),w=new qe(g.gl,g.canvas,()=>F.requestRender(),()=>i.orbitEngaged());w.setAspect(g.aspect);let W=(e.doc.floors?.flatMap(m=>m.objects)??e.doc.objects).some(m=>m.type==="section"&&m.physical3dProvenance?.surfaceKind?.status==="inferred"),b=(()=>{if(W&&n.stages.length===0)return;let m=n.focalWorld[0]-n.bounds.center[0],h=n.focalWorld[2]-n.bounds.center[2];return Math.hypot(m,h)>n.bounds.radius*.12?Math.atan2(m,h):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;w.frame(n.bounds,!$&&o.skipInitialOverviewAnimation!==!0,b,o.portraitOverviewCrop===!0,z);let U=new tt(w.camera),ee=gn(t),Z=new Ze(t,{fontFamily:e.doc.theme?.fontFamily,ink:e.doc.theme?.textColor,backgroundRgb:n.theme.background.top}),le=n.labels,oe=()=>eo(le,n.floors.length,R());Z.setLabels(oe());let J=null,V=m=>{if(J=m,Z.setForcedDense(!!m),!m){Z.setLabels(oe());return}let h=e.seats.filter(I=>I.sectionId===m),A=new Set(h.map(I=>I.id)),H=new Set(h.map(I=>I.rowId)),X=new Set(k.keys()),Q=new Set(h.filter(I=>X.has(I.id)).map(I=>I.id)),te=oe().filter(I=>I.kind!=="row"&&I.kind!=="seat"||(I.kind==="row"?H.has(I.id.slice(4)):A.has(I.id.slice(5))&&(Q.size===0||Q.has(I.id.slice(5)))));if(n.seatCount<=6e3&&Q.size===0){Z.setLabels(te);return}let ne=Q.size?h.filter(I=>Q.has(I.id)):h,ve=new Set(ne.map(I=>`seat:${I.id}`)),he=ne.flatMap(I=>{let ae=n.seats.idToIndex.get(I.id);if(ae===void 0)return[];let ce=ae*3;return[{id:`seat:${I.id}`,kind:"seat",text:X.has(I.id)?I.displayLabel||I.label:lo(I.displayLabel||I.label),anchor:[n.seats.iPosition[ce],n.seats.iPosition[ce+1]+(X.has(I.id)?1.05:.55),n.seats.iPosition[ce+2]]}]});Z.setLabels([...te.filter(I=>!ve.has(I.id)),...he])};Y();let N=null,F=new je(m=>{if(E||!c||C)return!1;let h=fn({flying:U.active,panoramaMounted:y!==null,seatViewActive:N?.active===!0}),A=h==="cinematic"?U.update(performance.now()):h==="seatView"?N.update(performance.now()):h==="orbit"?w.update():!1,H=R()>=0?n.floors[R()]:null,X=H?.radius??n.bounds.radius,Q=vo(w.currentDistance,X),te=j?{center:[w.camera.position.x,w.camera.position.y,w.camera.position.z],radius:520}:n.renderBounds;w.updateClipping(te);let ne=H?.center??n.renderBounds.center,ve=H?.radius??n.renderBounds.radius,he=(ue,De)=>Math.hypot(w.camera.position.x-ue[0],w.camera.position.y-ue[1],w.camera.position.z-ue[2])<=De*(L.detailVisible?1.8:1.55),I=he(ne,ve);if(!I&&J){let ue=n.sections.find(De=>De.id===J);ue&&(I=he(ue.center,Math.max(12,ue.radius*2)))}L.detailVisible=I;let ae=c.seatProgram.uniforms;ae.uSeatScale.value=Q.scale,ae.uSeatFade.value=Q.fade;let ce=!!H&&bo(H.seatCount,g.canvas.clientWidth||1,g.canvas.clientHeight||1),He=go(n.seats.count,X,w.currentDistance,w.camera.fov,g.canvas.clientHeight||1),Fe=L.detailVisible||ce||He?1:0,We=L.detailVisible||R()>=0||n.floors.length>1?1:0;return L.ease(m,Fe,We),ae.uSeatDetail.value=L.seatDetailMix,c.solidProgram.uniforms.uStructureDetail.value=L.structureDetailMix,ae.uMinPixels.value=Q.minPixels,ae.uPixelToWorld.value=2*Math.tan(w.camera.fov*si/2)/Math.max(1,g.pixelHeight),L.update(L.detailVisible),g.renderer.render({scene:c.background,clear:!0}),g.renderer.render({scene:c.main,camera:w.camera,clear:!1}),Z.update(w.camera.projectionViewMatrix,g.canvas.clientWidth||1,g.canvas.clientHeight||1,w.currentDistance,X,[w.camera.position.x,w.camera.position.y,w.camera.position.z]),A||L.seatDetailMix!==Fe||L.structureDetailMix!==We}),q=typeof ResizeObserver<"u"?new ResizeObserver(()=>ht.resize()):null;q?.observe(t);let B=m=>{let h=X=>{let Q=n.seats.idToIndex.get(X);return Q===void 0?void 0:n.seats.iState[Q]},{updates:A,next:H}=Go(k,m,h);if(k=H,Z.setSelectedSeatIds(k.keys()),J&&V(J),A.length){let X=gt(n.seats,A);c&&c.uploadSeatStateRuns(X),p(),F.requestRender()}},K=()=>S!==null?S:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ne=8,Be=m=>{if(!o.getSeatView)return null;let h=x.get(m);if(!h)for(h=Promise.resolve(o.getSeatView(m)),x.set(m,h),h.catch(()=>{x.get(m)===h&&x.delete(m)});x.size>Ne;){let A=x.keys().next().value;if(A===void 0)break;x.delete(A)}return h},Nt=an(n.stages,n.focalWorld,n.bounds.groundY??0),Rn=Ot(Nt),lt=(m,h)=>{let A=a.get(m),H=Math.max(0,Math.round(n.seats.iFloor[h]??0)),X=e.doc.floors?.[H],Q=n.floors[H],te=X?.focalPoint??e.doc.focalPoint,ne=Q?{x:Q.focalWorld[0]/we,y:Q.focalWorld[2]/we}:te,ve=A?.focalPoint?{x:A.focalPoint.x+ne.x-te.x,y:A.focalPoint.y+ne.y-te.y}:ne,he=[n.seats.iPosition[h*3],n.seats.iPosition[h*3+1],n.seats.iPosition[h*3+2]];return Qo(he,ve,X?.baseHeightM??0,A?.eyeHeightM,Rn)},Bt=()=>(t.clientWidth||g.canvas.clientWidth)<=520,ct=null,Gt=null,Fn=async(m,h,A)=>{if(!o.getSeatView||M||A!==re.flightGen())return;let H;try{H=await vn()}catch{if(i.panoramaFailed(m,"mount"),!M&&A===re.flightGen()){let X=dt(m,A,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(M||A!==re.flightGen()||!ct))return Gt??=H.createOpenPanorama(ct),Gt(m,h,A)},ut=yn({container:t,model:n,opts:o,expandedSeatById:a,seatIdsByRow:l,isNarrow:Bt,isDisposed:()=>M,flightGen:()=>re.flightGen(),flyToSeat:m=>Ut(m),openPanorama:(m,h,A)=>Fn(m,h,A)}),dt=ut.show,mt=ut.remove,Dn=ut.layout,Se=xn({container:t,orbit:w,isNarrow:Bt,enabled:o.chrome?.controlDock!==!1}),Tn=Se.element,Ee=Se.setNavigationMode,In=Se.layout,Vn=Se.utilityControls,Re=null,Ht=!1,Ge=m=>{Se.setSeatViewLocked(m),m||N?.exit()};N=hn({canvas:g.canvas,camera:w.camera,requestRender:()=>F.requestRender(),reducedMotion:K,onStopChange:m=>{let h=m??(Ht?"seat":null);Re=h;try{o.onSeatViewStopChange?.(h)}catch{}},onApplied:()=>{M||w.syncFromCamera()}});let _n=(m,h)=>{let{eye:A}=lt(m,h),H=(t.clientWidth||g.canvas.clientWidth||1)/Math.max(1,t.clientHeight||g.canvas.clientHeight||1),X=ln(A,Nt,H);if(o.seatViewStops===!1)return{...X,stops:[]};let Q=u.get(m),te=Q?n.sections.find(ne=>ne.id===Q):void 0;return{...X,stops:cn(X,{aspect:H,section:te&&te.seatCount>0?{center:te.center,radius:te.radius}:null,venue:{center:n.bounds.center,radius:n.bounds.radius}})}},re=Cn({container:t,model:n,opts:o,orbit:w,cinematic:U,analytics:i,loop:F,labelOverlay:Z,stageAzimuth:b,overviewFraming:z,gpu:()=>c,isDisposed:()=>M,panorama:()=>y,setPanorama:m=>{y=m},setPanoramaSphereVisible:m=>{j=m},panoramaLoadAbort:()=>D,setPanoramaLoadAbort:m=>{D=m},setFrozen:m=>{C=m},restorePanoramaLayer:_,reducedMotion:K,resolvedSeatViewPose:lt,showSectionSeatLabels:V,setNearFieldDetailEnabled:G,setSeatViewLocked:Ge,setNavigationMode:Ee,showArriveChip:dt,removeArriveChip:mt,inSeatView:()=>Re!==null,setSeatStepping:m=>{Ht=m},seatViewArrival:(m,h)=>o.arriveAtSeatEye?_n(m,h):null,enterSeatView:m=>N?.enter(m)});O=!0;let pt=re.overviewChip,kn=re.layoutOverviewChip,Ln=re.applyFloorFocus,On=re.focusOverview,Wt=re.cancelFlight,Ut=re.flyToSeat,Yt=re.focusSectionCamera;Vn.appendChild(pt),ct={container:t,model:n,opts:o,analytics:i,orbit:w,loop:F,seatsById:a,ensureSeatView:Be,resolvedSeatViewPose:lt,gpu:()=>c,gl:g.gl,isContextLost:()=>E,isDisposed:()=>M,flightGen:()=>re.flightGen(),setPanorama:m=>{y=m},getLoadAbort:()=>D,setLoadAbort:m=>{D=m},setPanoramaSphereVisible:m=>{j=m,m&&N?.exit()},setFrozen:m=>{C=m},raisePanoramaLayer:T,restorePanoramaLayer:_,getOverviewChip:()=>pt,labelOverlay:Z,reducedMotion:K,removeArriveChip:mt,showArriveChip:dt};let pe=Sn({glctx:g,orbit:w,model:n,seats:e.seats,opts:o,cinematic:U,analytics:i,seatIdByIndex:s,sectionIdBySeatId:u,tapSlop:li,tapMs:ci,gpu:()=>c,pick:()=>d,seatViewLocked:()=>Se.seatViewLocked(),focusedSectionId:()=>J,selection:()=>k,cancelFlight:Wt,focusSectionCamera:Yt,focusSeatCamera:re.focusSeatCamera,setSelection:B,ensureSeatView:Be});g.canvas.addEventListener("pointerdown",pe.onDown),g.canvas.addEventListener("pointermove",pe.onMove),g.canvas.addEventListener("pointerup",pe.onUp),g.canvas.addEventListener("pointercancel",pe.onUp),F.requestRender();let ht={setAvailability(m){let h=Bo(k,m),A=gt(n.seats,h);A.length&&c&&c.uploadSeatStateRuns(A),p(),F.requestRender()},setSelection:B,setNavigationMode:Ee,zoomIn(){w.zoomBy(.82),F.requestRender()},zoomOut(){w.zoomBy(1.22),F.requestRender()},flyToSeat:Ut,focusOverview:On,seatViewStop:()=>Re,recentreSeatView:()=>N?.recentre()??!1,resize(){let{width:m,height:h}=g.resize();w.setAspect(m/Math.max(1,h)),Dn(),In(),kn(),F.requestRender()},stats(){return{...F.stats(),drawCalls:c?c.drawCalls:0,seatCount:n.seatCount}},getQualityEvidence(){let m=F.stats(),h=g.canvas.clientWidth||1,A=g.canvas.clientHeight||1,H=n.bounds.center,X=fe(w.camera.projectionViewMatrix,[H[0],n.bounds.box.min[1],H[2]],h,A),Q=fe(w.camera.projectionViewMatrix,[H[0],n.bounds.box.max[1],H[2]],h,A),te=n.bounds.box,ne=[te.min[0],te.max[0]].flatMap(I=>[te.min[1],te.max[1]].flatMap(ae=>[te.min[2],te.max[2]].map(ce=>fe(w.camera.projectionViewMatrix,[I,ae,ce],h,A)))).filter(I=>Number.isFinite(I.x)&&Number.isFinite(I.y)&&Number.isFinite(I.depth)),ve=ne.length?(()=>{let I=Math.min(...ne.map(be=>be.x)),ae=Math.max(...ne.map(be=>be.x)),ce=Math.min(...ne.map(be=>be.y)),He=Math.max(...ne.map(be=>be.y)),Fe=Math.max(0,I),We=Math.min(h,ae),ue=Math.max(0,ce),De=Math.min(A,He),Ue=Math.max(0,We-Fe),ft=Math.max(0,De-ue);return{box:{x:Fe,y:ue,width:Ue,height:ft},horizontalFillRatio:Ue/h,verticalFillRatio:ft/A,visibleAreaRatio:Ue*ft/(h*A),clippedEdges:[...ce<0?["top"]:[],...ae>h?["right"]:[],...He>A?["bottom"]:[],...I<0?["left"]:[]]}})():void 0,he=String(g.gl.getParameter(g.gl.VERSION)??"");return{viewport:{width:h,height:A},context:{webgl2:/webgl\s*2/i.test(he),lost:E},frame:{rendered:m.rendered,idle:m.idle},camera:{position:[w.camera.position.x,w.camera.position.y,w.camera.position.z],distance:w.currentDistance,verticalFovDeg:w.fovY},scene:{seatCount:n.seatCount,floorCount:n.floors.length,zoneCount:n.zones.length,sectionCount:n.sections.length,authoredRelief:v,renderedVerticalSpanM:Math.max(0,n.bounds.box.max[1]-n.bounds.box.min[1]),projectedReliefPx:X.visible&&Q.visible?Math.abs(X.y-Q.y):0},labels:Z.qualityEvidence(),framing:ve,...Re?{seatView:{fovDeg:w.camera.fov,stop:Re}}:{}}},getQualityReport(){return Dt(ht.getQualityEvidence())},loseContextForTest(){g.simulateContextLossCycle()},floors(){return n.floors},focusFloor(m){if(m!==null&&!n.floors.some(A=>A.index===m))return!1;let h=m??-1;if(G(m!==null),Ge(!1),Ln(h),Ee("orbit"),m===null)U.cancel(),K()?w.frame(n.bounds,!1,b,o.portraitOverviewCrop===!0,z):w.frameSoft(n.bounds,b,o.portraitOverviewCrop===!0,z);else{let A=n.floors[m];if(A.seatCount>0){U.cancel();let H=A.focalWorld[0]-A.center[0],X=A.focalWorld[2]-A.center[2],Q=Math.hypot(H,X)>A.radius*.12?Math.atan2(H,X):b;w.frame({center:A.center,radius:A.radius,box:A.box},!1,Q,!1,{polarDeg:58,margin:1.12})}}return F.requestRender(),!0},zones(){return n.zones},focusZone(m){let h=n.zones.find(Q=>Q.id===m);if(!h||h.seatCount===0)return!1;G(!1),Ge(!1),U.cancel(),Ee("orbit"),V(null),o.onSectionFocusChange?.(null);let A=h.focalWorld[0]-h.center[0],H=h.focalWorld[2]-h.center[2],X=Math.hypot(A,H)>h.radius*.12?Math.atan2(A,H):void 0;return w.frame({center:h.center,radius:h.radius*1.25},!1,X),F.requestRender(),!0},sections(){return n.sections},focusSection(m){return Yt(m)},rows(m){return m?n.rows.filter(h=>h.sectionId===m):n.rows},seatsInRow(m){return e.seats.filter(h=>h.rowId===m).map(h=>({id:h.id,label:h.displayLabel||h.label}))},focusRow(m){let h=n.rows.find(A=>A.id===m);return!h||h.seatCount===0?!1:(G(!0),Ge(!1),U.cancel(),Ee("pan"),h.sectionId&&(V(h.sectionId),o.onSectionFocusChange?.(h.sectionId)),w.frame({center:h.center,radius:Math.max(2.5,h.radius*.65)}),F.requestRender(),!0)},setReducedMotionForTest(m){S=m},dispose(){M=!0,mt(),pt.remove(),Tn.remove(),Wt(),N?.dispose(),F.stop(),Z.dispose(),q?.disconnect(),y&&(y.dispose(),y=null),_(),ee(),g.canvas.removeEventListener("pointerdown",pe.onDown),g.canvas.removeEventListener("pointermove",pe.onMove),g.canvas.removeEventListener("pointerup",pe.onUp),g.canvas.removeEventListener("pointercancel",pe.onUp),w.dispose(),d&&d.dispose(),c&&c.dispose(),c=null,d=null,g.dispose()}};return i.opened(n.seatCount,v,e.prepared?.buildMs??performance.now()-r,e.prepared?.source??"inline"),ht}export{Kn as VENUE3D_QUALITY_REPORT_VERSION,Ie as buildSceneModel,Dt as inspectVenue3DQualityEvidence,is as mountVenue3D,ii as prepareVenue3D,ai as prepareVenue3DFromChart};
|