@seatlayer/core 0.62.0 → 0.63.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.
Files changed (49) hide show
  1. package/dist/{categoryInventory-EaqLUHxJ.d.ts → categoryInventory-C3RogGHF.d.ts} +1 -1
  2. package/dist/{categoryInventory-C4-bA5Nx.d.cts → categoryInventory-DEgsjxCC.d.cts} +1 -1
  3. package/dist/chunk-UL5OIGIF.js +1 -0
  4. package/dist/core/chart-ops/index.cjs +1 -1
  5. package/dist/core/chart-ops/index.d.cts +6 -4
  6. package/dist/core/chart-ops/index.d.ts +6 -4
  7. package/dist/core/chart-ops/index.js +1 -1
  8. package/dist/core/inventory/index.d.cts +4 -4
  9. package/dist/core/inventory/index.d.ts +4 -4
  10. package/dist/core/layout/index.d.cts +4 -4
  11. package/dist/core/layout/index.d.ts +4 -4
  12. package/dist/core/quality/index.d.cts +3 -3
  13. package/dist/core/quality/index.d.ts +3 -3
  14. package/dist/core/render-assets/index.cjs +1 -1
  15. package/dist/core/render-assets/index.d.cts +11 -6
  16. package/dist/core/render-assets/index.d.ts +11 -6
  17. package/dist/core/render-assets/index.js +1 -1
  18. package/dist/core/seatConfidence.d.cts +1 -1
  19. package/dist/core/seatConfidence.d.ts +1 -1
  20. package/dist/core/sections/index.d.cts +5 -5
  21. package/dist/core/sections/index.d.ts +5 -5
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.d.cts +14 -10
  24. package/dist/index.d.ts +14 -10
  25. package/dist/index.js +1 -1
  26. package/dist/{labeling-Cwufmw3W.d.cts → labeling-DRFC35VK.d.cts} +1 -1
  27. package/dist/{labeling-B4i6gdAb.d.ts → labeling-DTHo03rf.d.ts} +1 -1
  28. package/dist/{layout-CVumqAiR.d.ts → layout-BXB8Rf4n.d.ts} +3 -3
  29. package/dist/{layout-CGKQ3Pi2.d.cts → layout-DRB0-NGc.d.cts} +3 -3
  30. package/dist/{renderedQuality-C86YHszi.d.ts → renderedQuality-BjSBiqkN.d.ts} +1 -1
  31. package/dist/{renderedQuality-Bvj_f4Ep.d.cts → renderedQuality-DK7IGCju.d.cts} +1 -1
  32. package/dist/{renderer-Bq6tKuUD.d.cts → renderer-BNzVBOBW.d.cts} +1 -1
  33. package/dist/{renderer-DwYiuiuC.d.ts → renderer-Bhc5CgOS.d.ts} +1 -1
  34. package/dist/{sections-hr18lj4d.d.ts → sections-BrQV1WzI.d.ts} +1 -1
  35. package/dist/{sections-CXMjxU_S.d.cts → sections-D2bxgVgg.d.cts} +1 -1
  36. package/dist/{segmentedRowModel-Cgp4cK2q.d.cts → segmentedRowModel-BQYSdf7k.d.cts} +1 -1
  37. package/dist/{segmentedRowModel-lcp9clIL.d.ts → segmentedRowModel-Cl3X8SKt.d.ts} +1 -1
  38. package/dist/{ticketRestrictions-NW94Eo3R.d.ts → ticketRestrictions-B9WkJ6YG.d.ts} +2 -2
  39. package/dist/{ticketRestrictions-BY7Nvzc-.d.cts → ticketRestrictions-QBvY3Zi7.d.cts} +2 -2
  40. package/dist/{types-D_pq-iqz.d.cts → types-DmgX-iuD.d.cts} +1 -1
  41. package/dist/{types-D_pq-iqz.d.ts → types-DmgX-iuD.d.ts} +1 -1
  42. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  43. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  44. package/dist/view3d/index.cjs +104 -40
  45. package/dist/view3d/index.d.cts +4 -2
  46. package/dist/view3d/index.d.ts +4 -2
  47. package/dist/view3d/index.js +106 -42
  48. package/package.json +1 -1
  49. package/dist/chunk-6CNWW47A.js +0 -1
@@ -1,12 +1,61 @@
1
- "use strict";var Si=Object.create;var Tt=Object.defineProperty;var wi=Object.getOwnPropertyDescriptor;var Pi=Object.getOwnPropertyNames;var Ci=Object.getPrototypeOf,Ai=Object.prototype.hasOwnProperty;var Ri=(e,t)=>{for(var n in t)Tt(e,n,{get:t[n],enumerable:!0})},$n=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Pi(t))!Ai.call(e,o)&&o!==n&&Tt(e,o,{get:()=>t[o],enumerable:!(r=wi(t,o))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?Si(Ci(e)):{},$n(t||!e||!e.__esModule?Tt(n,"default",{value:e,enumerable:!0}):n,e)),Ii=e=>$n(Tt({},"__esModule",{value:!0}),e);var fc={};Ri(fc,{VENUE3D_QUALITY_REPORT_VERSION:()=>Lr,buildSceneModel:()=>ct,inspectVenue3DQualityEvidence:()=>Zt,mountVenue3D:()=>mc,prepareVenue3D:()=>gi});module.exports=Ii(fc);var eo=require("ogl");var Ei=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ti(e){let t=Ei.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ee(e){let t=Ti(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function hn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function ki(e){return .2126*hn(e[0])+.7152*hn(e[1])+.0722*hn(e[2])}function Zn(e){return ki([e[0]*255,e[1]*255,e[2]*255])}function Fi(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function he(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function ht(e,t){let n=Fi(e);return he(e,[n,n,n],t)}var ge=["available","held","sold","selected","dimmed"];function pt(e){let t=ge.indexOf(e);return t<0?0:t}var Qn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Jn(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var pn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Ke={top:[.05,.06,.08],bottom:[.1,.12,.15]};function be(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Di(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var kt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,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 eo.Renderer({canvas:this.canvas,dpr:Di(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ke.top[0],Ke.top[1],Ke.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var nt=require("ogl"),de=Math.PI/180,bn=15*de,yn=80*de,tt=.12,to=35,no=1.25,Ft=class{constructor(t,n,r,o){this.fovY=to;this.target=new nt.Vec3;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;this.distT=10;this.minDist=1;this.maxDist=100;this.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 nt.Vec3;this.panAnchor=new nt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new nt.Camera(t,{fov:to,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,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 a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,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 a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.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 c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(bn,Math.min(yn,this.polT-s*.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 a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*de;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"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(bn,Math.min(yn,this.polT+(i.key==="ArrowUp"?-a:a)));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()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*de/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),d=-i*l,m=-a*l;this.targetT.x+=(-t*s+n*d)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*de/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??no)),this.minDist=Math.max(2,a*.12),this.maxDist=u*4,n?(this.azimuth=this.azT,this.polar=12*de,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*de/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??no))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let l=Math.sin(i),u=-l*Math.sin(o),d=-Math.cos(i),m=-l*Math.cos(o);if(Math.abs(d)>.999)return s;let f=-m,h=u,p=Math.hypot(f,h);f/=p,h/=p;let b=-h*d,y=h*u-f*m,g=f*d,x=Math.tan(r),w=Math.tan(n),A=1;for(let M=0;M<8;M++){let D=(M&1?c.max[0]:c.min[0])-t.center[0],B=(M&2?c.max[1]:c.min[1])-t.center[1],N=(M&4?c.max[2]:c.min[2])-t.center[2],H=D*u+B*d+N*m,O=Math.abs(D*f+N*h),S=Math.abs(D*b+B*y+N*g);A=Math.max(A,O/x-H,S/w-H)}return Math.min(s,Math.max(A,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*tt,this.polar+=n*tt,this.distance+=r*tt,this.target.x+=o*tt,this.target.y+=i*tt,this.target.z+=a*tt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(bn,Math.min(yn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),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 Dt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}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 ot=2.5,Li=1.15,bt=6,rt=10,oo=6,ro=9.5,io=.9,ao=2.2,gn=30,xn=4,Lt=8192;var Sc=rt+xn;function so(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ot};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ot+o*(Li-ot)}}function co(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function lo(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var _i=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],Pc=new Map(_i.map(e=>[e.key,e]));var Oi={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function uo(e){let t=e?.[0];return t&&Oi[t]||"#3b82f6"}var Bi=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],Cc=new Map(Bi.map(e=>[e.key,e]));var Ni=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Ac=new Set(Ni);var we=.02291666666666667,Be=1/we,Vi=58,zi=Vi*we;var Gi=3,mo=0,vn=120,Hi=0,Ui=45,ji=7,_t=1.2;function Mn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Xi(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=ji?e:Gi}function fo(e,t={}){let n=Mn(t.floorBaseHeightM,mo,vn,0),r=Math.min(vn,n+Xi(e.elevation)*zi),o=e.height===void 0?r:Mn(e.height,mo,vn,r),i=Mn(e.rake,Hi,Ui,0);return{height:o,rake:i}}var po=et(require("earcut"),1),bo=et(require("polygon-clipping"),1);var kc=Math.PI/180;function Sn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function yt(e){return e.length?Sn(e):null}function qe(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function gt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var _=we,Yi=.002;function Wi(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<Yi}var $e=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Nt=class{constructor(){this.pos=new $e;this.nor=new $e;this.col=new $e;this.flr=new $e;this.mat=new $e;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){Wi(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,l=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function Ki(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=o*c-i*s,u=i*a-r*c,d=r*s-o*a,m=Math.hypot(l,u,d)||1;return l/=m,u/=m,d/=m,[l,u,d]}function qi(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,po.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function wn(e){return qe(e)<0?[...e].reverse():e}var $i=3;function Zi(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(f,h,p,b)=>Math.abs(r({x:(f.x+h.x)/2,y:(f.y+h.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,d=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-u)),m=(f,h,p)=>{let b=Math.abs(r({x:(f+c)/2,y:(h+l)/2})-(p+u)/2);b>d&&(d=b)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),d}function xt(e,t,n,r,o){if(o<=0)return Zi(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(xt(e,i,s,r,o-1),xt(i,t,a,r,o-1),xt(s,a,n,r,o-1),xt(i,a,s,r,o-1))}function vt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},f={x:(n.x+r.x)/2,y:(n.y+r.y)/2},h={x:(r.x+t.x)/2,y:(r.y+t.y)/2};vt(e,t,m,h,o,i,a-1,s),vt(e,m,n,f,o,i,a-1,s),vt(e,h,f,r,o,i,a-1,s),vt(e,m,f,h,o,i,a-1,s);return}let c=[t.x*_,o(t),t.y*_],l=[n.x*_,o(n),n.y*_],u=[r.x*_,o(r),r.y*_];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let d=Ki(c,l,u);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(c,l,u,d,i)}var Qi=8;function ho(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},d=t(u);if(Math.abs(d-(s+c)/2)>n){o(i,u,s,d,l-1),o(u,a,d,c,l-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),Qi)}return r}function Ot(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l);u>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var Bt=.001*Be*.1;function se(e,t,n,r,o,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(qe(t))<1e-4))return;let u=Ot(ho(Ot(wn(t),Bt),r,c),Bt),d=n?.map(M=>Ot(ho(Ot(wn(M),Bt),r,c),Bt)).filter(M=>M.length>=3&&Math.abs(qe(M))>=1e-4),{pts:m,tris:f}=qi(u,d),h=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<$i;g++){let M=0;for(let D=0;D<f.length;D+=3){let B=xt(m[f[D]],m[f[D+1]],m[f[D+2]],r,g);B>M&&(M=B)}if(M<=c)break}for(let M=0;M<f.length;M+=3){let D=m[f[M]],B=m[f[M+1]],N=m[f[M+2]];vt(e,D,B,N,r,h,g,l);let H=[D.x*_,o,D.y*_],O=[B.x*_,o,B.y*_],S=[N.x*_,o,N.y*_];e.tri(H,S,O,[0,-1,0],p)}let x=M=>{if(g<=0)return M;let D=1<<g,B=[];for(let N=0;N<M.length;N++){let H=M[N],O=M[(N+1)%M.length];for(let S=0;S<D;S++){let v=S/D;B.push({x:H.x+(O.x-H.x)*v,y:H.y+(O.y-H.y)*v})}}return B},w=Sn(u),A=[{ring:x(u),flip:!1}];if(d)for(let M of d)M.length>=3&&A.push({ring:x(M),flip:!0});for(let{ring:M,flip:D}of A)for(let B=0;B<M.length;B++){let N=M[B],H=M[(B+1)%M.length],O=(H.x-N.x)*_,v=(H.y-N.y)*_,R=-O,C=Math.hypot(v,R)||1;v/=C,R/=C;let T=(N.x+H.x)/2-w.x,P=(N.y+H.y)/2-w.y,F=v*T+R*P;D&&(F=-F),F<0&&(v=-v,R=-R);let I=[v,0,R],z=[N.x*_,r(N),N.y*_],E=[H.x*_,r(H),H.y*_],L=[N.x*_,o,N.y*_],G=[H.x*_,o,H.y*_];e.tri(z,E,G,I,b,b,y),e.tri(z,G,L,I,b,y,y)}}function yo(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function Vt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=wn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,d=l.y-c.y,m=Math.hypot(u,d)||1;i.push({x:d/m,y:-u/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],d=l.x+u.x,m=l.y+u.y,f=Math.hypot(d,m),h=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(f<1e-9){h();continue}d/=f,m/=f;let p=d*l.x+m*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){h();continue}a.push([c.x+d*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=bo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let d of s){let m=Math.abs(qe(d[0].map(([f,h])=>({x:f,y:h}))));m>l&&(l=m,c=d[0])}if(!c)return e;let u=c.map(([d,m])=>({x:d,y:m}));if(u.length>1){let d=u[0],m=u[u.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function zt(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function Mt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var le={pedestal:0,pad:1,back:2,body:3,head:4},Ji=.44,ea=.15,ta=.3,na=.24;function go(e){return e===void 0||!Number.isFinite(e)||e<=0?na:Math.min(ta,Math.max(ea,e*Ji))}var Pn=.21,oa=.05,Cn=.45,Gt=Cn+oa,ra=[{part:le.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:le.pad,min:[-1,.36,-.95],max:[1,Cn,1]},{part:le.back,min:[-1,Gt,-1],max:[1,.92,-.72]}],ia=[{part:le.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:le.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:le.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:le.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:le.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],aa=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function xo(){let e=[],t=[],n=[],r=[],o=(C,T,P)=>{let F=n.length,[I,z,E]=C,L=[z[0]-I[0],z[1]-I[1],z[2]-I[2]],G=[E[0]-I[0],E[1]-I[1],E[2]-I[2]],X=L[1]*G[2]-L[2]*G[1],V=L[2]*G[0]-L[0]*G[2],k=L[0]*G[1]-L[1]*G[0],Y=Math.hypot(X,V,k);Y>1e-9?(X/=Y,V/=Y,k/=Y):[X,V,k]=T,X*T[0]+V*T[1]+k*T[2]<0&&(X=-X,V=-V,k=-k);for(let K of C)e.push(...K),t.push(X,V,k),n.push(P);r.push(F,F+1,F+2,F,F+2,F+3)},i=C=>{for(let T of aa){let P=T.c.map(F=>F.map((I,z)=>I?C.max[z]:C.min[z]));o(P,T.n,C.part)}};for(let C of ra)i(C);for(let C of ia)i(C);let a=Cn,s=1.08,c=.47,l=.69,u=-.55,d=.08,m=-.48,f=.01,h=[-c,a,u],p=[c,a,u],b=[-c,a,d],y=[c,a,d],g=[-l,s,m],x=[l,s,m],w=[-l,s,f],A=[l,s,f];o([p,x,A,y],[1,0,0],le.body),o([b,w,g,h],[-1,0,0],le.body),o([w,A,x,g],[0,1,0],le.body),o([h,p,y,b],[0,-1,0],le.body),o([y,A,w,b],[0,0,1],le.body),o([h,g,x,p],[0,0,-1],le.body);let M=10,D=8,B=[0,1.205,-.23],N=[.42,.115,.38],H=n.length;for(let C=0;C<=D;C++){let T=Math.PI*C/D,P=Math.cos(T),F=Math.sin(T);for(let I=0;I<=M;I++){let z=Math.PI*2*I/M,E=F*Math.cos(z),L=F*Math.sin(z);e.push(B[0]+N[0]*E,B[1]+N[1]*P,B[2]+N[2]*L);let G=E/N[0],X=P/N[1],V=L/N[2],k=Math.hypot(G,X,V)||1;G/=k,X/=k,V/=k,t.push(G,X,V),n.push(le.head)}}for(let C=0;C<D;C++)for(let T=0;T<M;T++){let P=H+C*(M+1)+T,F=P+M+1;r.push(P,F,P+1,P+1,F,F+1)}let O=new Float32Array(e),S=new Float32Array(t),v=new Float32Array(n),R=new Uint16Array(r);return{position:O,normal:S,part:v,index:R,vertexCount:n.length,indexCount:r.length}}function vo(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let d=u-l;for(let m=l;m<u;m++){let[f,h]=r(m),p=f-i(m),b=h-a(m);if(d>=2){let y=Math.max(l,m-1),g=Math.min(u-1,m+1),x=i(g)-i(y),w=a(g)-a(y),A=Math.hypot(x,w);if(A>1e-6){let M=-w/A,D=x/A;M*p+D*b<0&&(M=-M,D=-D),p=M,b=D}}o[m]=p===0&&b===0?0:Math.atan2(p,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var ke=.22;function Mo(e,t){let n=ge[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var sa=.42;function ca(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let h of e)h.x<r&&(r=h.x),h.y<o&&(o=h.y),h.x>i&&(i=h.x),h.y>a&&(a=h.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),d=Math.max(1,Math.ceil(c/l)+1),m=new Map,f=(h,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((h-r)/l)));return Math.min(d-1,Math.max(0,Math.floor((p-o)/l)))*u+b};for(let h=0;h<t;h++){let p=f(e[h].x,e[h].y),b=m.get(p);b?b.push(h):m.set(p,[h])}for(let h=0;h<t;h++){let p=e[h],b=Math.min(u-1,Math.max(0,Math.floor((p.x-r)/l))),y=Math.min(d-1,Math.max(0,Math.floor((p.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let w=y-x;w<=y+x;w++)if(!(w<0||w>=d))for(let A=b-x;A<=b+x;A++){if(A<0||A>=u||x>1&&Math.abs(w-y)<x&&Math.abs(A-b)<x)continue;let M=m.get(w*u+A);if(M)for(let D of M){if(D===h)continue;let B=Math.hypot(e[D].x-p.x,e[D].y-p.y);B<g&&(g=B)}}if(Number.isFinite(g)&&g<=x*l)break}n[h]=g}return n}function la(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-_t):0}function So(e,t,n,r,o){let i=e.length,a=new Float32Array(i*3),s=new Float32Array(i),c=new Float32Array(i*3),l=new Float32Array(i),u=new Float32Array(i),d=new Float32Array(i),m=new Float32Array(i*3),f=new Map,h=ca(e);for(let p=0;p<i;p++){let b=e[p],g=(n?.seatPitchU(p)??h[p])*_;l[p]=Number.isFinite(g)?Math.max(.06,Math.min(ke,g*sa)):ke,u[p]=go(Number.isFinite(g)?g:void 0),d[p]=b.wheelchairSpaceType==="no-seat"?0:1,a[p*3]=b.x*_,a[p*3+1]=n?n.seatDeckY(p):la(b),a[p*3+2]=b.y*_,s[p]=pt(t?t(b):"available");let x=ee(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[p*3]=x[0],c[p*3+1]=x[1],c[p*3+2]=x[2],b.accessibility?.length){let w=ee(uo(b.accessibility));w&&(m[p*3]=w[0],m[p*3+1]=w[1],m[p*3+2]=w[2])}f.set(b.id,p)}return{count:i,iPosition:a,iState:s,iCategory:c,iMaxRadius:l,iRing:m,idToIndex:f,iChairWidth:u,iPhysicalSeat:d,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var ua=64;function An(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=pt(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+ua){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var da=.15,ma=.9,fa=1.76,ha=.7,pa=1.6;function ba(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:pn,seatStates:{...Qn},seatScale:1}}function wo(e){let t=ba();if(!e)return t;let n=ee(e.background);if(n){t.background={top:be(n,ma),bottom:be(n,fa)};let i={};for(let[a,s]of Object.entries(pn))i[a]=he(s,n,da);t.structure=i}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(pa,Math.max(ha,o))),t}function Po(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Co(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function it(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function ya(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function Ao(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Rn(e,t){let n=1/0;for(let r of Co(e)){let o=it(t,r.x,r.y);o<n&&(n=o)}for(let r of Co(t)){let o=it(e,r.x,r.y);o<n&&(n=o)}return n}function ga(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let d=Math.hypot(u.x-n,u.y-r);d>o&&(o=d,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,d)=>({p:u,i:d,t:(u.x-n)*a+(u.y-r)*s})).sort((u,d)=>u.t-d.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function In(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let x=g.x-n,w=g.y-r;o+=x*x,a+=w*w,i+=x*w,s+=x*x*x,c+=w*w*w,l+=x*w*w,u+=w*x*x}let d=o*a-i*i;if(Math.abs(d)<1e-9)return null;let m=(s+l)/2,f=(c+u)/2,h=(m*a-f*i)/d,p=(f*o-m*i)/d,b=h+n,y=p+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var xa=.15;function va(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,w=0;for(let A of g.pts)x+=A.x,w+=A.y;return{x:x/g.pts.length,y:w/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,w=g.y-r;o+=x*x,i+=x*w,a+=w*w}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,d;Math.abs(i)>1e-12?(u=l-a,d=i):o>=a?(u=1,d=0):(u=0,d=1);let m=Math.hypot(u,d);if(!(m>1e-12))return null;u/=m,d/=m;let f=1/0,h=-1/0,p=[];for(let g of e){let x=1/0,w=-1/0;for(let A of g.pts){let M=A.x*u+A.y*d;M<x&&(x=M),M>w&&(w=M),M<f&&(f=M),M>h&&(h=M)}p.push(w-x)}let b=h-f;return b>1e-9?(p.sort((g,x)=>g-x),p[Math.min(p.length-1,Math.floor(p.length*.9))]/b<=Ma?{x:u,y:d}:null):null}var Ma=.35;function Ro(e,t,n,r){let o=new Map;for(let b of n){let y=t[b],g=y.rowId||`__seat-${b}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:y.x,y:y.y}),x.idx.push(b)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,y]of o){let g=ga(y.pts,y.idx),x=0;for(let w of g.pts)x+=Math.hypot(w.x-r.x,w.y-r.y);i.push({id:b,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(b=>ya(b.pts)),s=[];for(let b=0;b<i.length;b++){let y=1/0;for(let g=0;g<i.length;g++){if(b===g||Ao(a[b],a[g])>=y)continue;let x=Rn(i[b].pts,i[g].pts);x<y&&(y=x)}Number.isFinite(y)&&s.push(y)}s.sort((b,y)=>b-y);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let y=b+1;y<i.length;y++)Ao(a[b],a[y])>l||Rn(i[b].pts,i[y].pts)<=l&&(u[b].push(y),u[y].push(b));let d=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let y=d++,g=[b];for(i[b].blockId=y;g.length;){let x=g.pop();for(let w of u[x])i[w].blockId===-1&&(i[w].blockId=y,g.push(w))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let f=[];for(let b of i){if(b.pts.length<4)continue;let y=In(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||f.push({x:y.cx,y:y.cy}))}let h=f.length>=2?(()=>{let b=f.map(x=>x.x).sort((x,w)=>x-w),y=f.map(x=>x.y).sort((x,w)=>x-w),g=Math.floor(f.length/2);return{cx:b[g],cy:y[g]}})():null;if(h){let b=M=>Math.hypot(M.x-h.cx,M.y-h.cy),y=1/0,g=-1/0,x=[];for(let M of i){let D=1/0,B=-1/0;for(let N of M.pts){let H=b(N);H<D&&(D=H),H>B&&(B=H)}x.push(B-D),D<y&&(y=D),B>g&&(g=B)}let w=g-y;x.sort((M,D)=>M-D);let A=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(w>1e-9&&A/w<=xa){let M=i.map(T=>{let P=0;for(let F of T.pts)P+=b(F);return{row:T,radius:P/T.pts.length}}),D=0,B=0;for(let T of M)D+=T.radius,B+=T.row.focalDistance;D/=M.length,B/=M.length;let N=0;for(let T of M)N+=(T.radius-D)*(T.row.focalDistance-B);if(N<0)for(let T of M)T.radius=-T.radius;let O=1/0;for(let T of M)T.radius<O&&(O=T.radius);M.sort((T,P)=>T.radius-P.radius);let S=-1,v=-1/0,R=w/Math.max(1,M.length)*.5,C=[];for(let T of M)T.radius-v>R&&(S++,v=T.radius),T.row.ordinal=S,T.row.blockDepth=T.radius-O,C.push(T.row);return{sectionId:e,rows:C,blockCount:d}}}let p=[];for(let[,b]of m){let y=va(b);if(y){let g=w=>{let A=0;for(let M of w.pts)A+=M.x*y.x+M.y*y.y;return A/w.pts.length};b.sort((w,A)=>g(w)-g(A)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let x=0;for(let w=0;w<b.length;w++)w>0&&(x+=Rn(b[w-1].pts,b[w].pts)),b[w].ordinal=w,b[w].blockDepth=x,p.push(b[w])}else{let g=1/0;for(let x of b)x.focalDistance<g&&(g=x.focalDistance);b.sort((x,w)=>x.focalDistance-w.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-g),p.push(b[x])}}return{sectionId:e,rows:p,blockCount:d}}var qc=Math.PI/180;function Io(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Sa(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function Eo(e,t,n){return Io(e,t)&&!(n??[]).some(r=>Io(e,r)||Sa(e,r))}function wa(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function Pa(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let f of e)n+=f.x,r+=f.y,o+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let f of e){let h=Math.hypot(f.x-n,f.y-r);h>s&&(s=h,a=f)}let c=a.x-n,l=a.y-r,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let d=[...e].sort((f,h)=>(f.x-n)*c+(f.y-r)*l-((h.x-n)*c+(h.y-r)*l)),m=0;for(let f of d){let h=Math.hypot(f.x-n,f.y-r);h>m&&(m=h)}return{pts:d,cx:n,cy:r,radius:m,depth:o}}function To(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,d=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(t-(a.x+d*c),n-(a.y+d*l));m<o&&(o=m)}return o}var Ht=8;function Ca(e,t,n){let r=new Array(Ht).fill(1/0),o=new Array(Ht).fill(-1);for(let u=0;u<e.length;u++){let d=e[u],m=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let f=0;f<Ht;f++)if(m<r[f]){for(let h=Ht-1;h>f;h--)r[h]=r[h-1],o[h]=o[h-1];r[f]=m,o[f]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let d=To(e[u],t,n);for(let m=0;m<3;m++)if(d<i[m]){for(let f=2;f>m;f--)i[f]=i[f-1],a[f]=a[f-1];i[m]=d,a[m]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let d=a[u];if(d<0||i[u]>s)continue;let m=1/(i[u]*i[u]);c+=m*e[d].depth,l+=m}return l>0?c/l:e[a[0]].depth}function Aa(e){let t=(r,o)=>Ca(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let l=To(c,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function ko(e,t){let n=[];for(let r of e){let o=Pa(r.points,t);o&&n.push(o)}return n.length<2?wa(t):(n.sort((r,o)=>r.depth-o.depth),Aa(n))}var kn=et(require("polygon-clipping"),1);var _o=et(require("earcut"),1);var Ra=.58,Fo=.01,ye=ke*1.5*Be,Ia=.5,Ea=.6;function Ta(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,u=c.y-s.y,d=Math.hypot(l,u);if(d<1e-9){r.push([0,0]);continue}l/=d,u/=d,r.push([-u,l])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function ka(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Do=Math.PI/12;function Fa(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Oo(e,t){if(!e.length||!(t>0))return[];let n=Fa(e),r=(s,c,l,u)=>{let d=l-c;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let m=Math.max(1,Math.ceil(d/Do)),f=t/Math.cos(d/m/2);for(let h=0;h<=m;h++){let p=c+d*h/m;u.push({x:s.x+Math.cos(p)*f,y:s.y+Math.sin(p)*f})}};if(n.length<3){let s=0,c=0;for(let f of n)s+=f.x,c+=f.y;s/=n.length||1,c/=n.length||1;let l=0;for(let f of n)l=Math.max(l,Math.hypot(f.x-s,f.y-c));let u=[],d=Math.max(3,Math.ceil(Math.PI*2/Do)),m=(l+t)/Math.cos(Math.PI/d);for(let f=0;f<d;f++){let h=f/d*Math.PI*2;u.push({x:s+Math.cos(h)*m,y:c+Math.sin(h)*m})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return Go(a)}function Da(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function Ut(e){let t=e.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let l of o.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let d=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let f=t[m],h=Math.hypot(u.x-f.cx,u.y-f.cy)-f.rad;if(h>=d&&h>=s)continue;let p=Da(e[m].pts,u.x,u.y);p<d&&(d=p),e[m].depth<e[o].depth&&p<s&&(s=p,c=e[m].y)}Number.isFinite(d)&&d>0&&a.push(d)}a.sort((u,d)=>u-d);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function Bo(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],d=u.x-r.x,m=u.y-r.y,f=Math.hypot(d,m)||1;d/=f,m/=f;let h=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*h,y:u.y-d*h},{x:u.x-m*h,y:u.y+d*h}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let d=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);d>1e-6&&(a+=d,s++)}let c=s>0?a/s:0,l=ka(i,Math.max(c*Ea,ye));return{pts:l,nrm:Ta(l,r),front:Math.max(n[t].pitch*Ra,ye),back:Math.max(n[t].pitch*Ia,ye)}}var at=1.5,No=.3;function En(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let d=1;d<e.length-1;d++){let m=e[d],f=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);f>s&&(s=f,c=d)}if(s<=t||c<0)return[n,r];let l=En(e.slice(0,c+1),t),u=En(e.slice(c),t);return[...l.slice(0,-1),...u]}function Vo(e,t){if(e.length<4)return e;let n=En([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function zo(e,t,n){if(e.length<2)return[];let r=n??Ut(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let l=s.map(g=>Bo(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+at),y:g.pts[x].y-g.nrm[x][1]*(g.front+at)}),d=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+at),y:g.pts[x].y+g.nrm[x][1]*(g.back+at)}),m=l[0],f=l[l.length-1],h=[];for(let g=0;g<m.pts.length;g++)h.push(u(m,g));for(let g of l)h.push(d(g,g.pts.length-1));for(let g=f.pts.length-1;g>=0;g--)h.push(d(f,g));for(let g=l.length-1;g>=0;g--)h.push(u(l[g],0));let p=Go(h),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(qe(p))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return gt(p,x.x,x.y)})){i.push({outline:Vo(p,No),holes:[],topY:b});continue}for(let g of La(l))i.push({outline:g,holes:[],topY:b})}return i}function La(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+at,a=n.back+at;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];r.push([l.x-u[0]*i,l.y-u[1]*i]),o.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=kn.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(Vo(i,No))}return r}catch{return[]}}function Go(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Tn=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!gt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Lo(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],u=r[0];for(let d=1;d+1<r.length;d++){let m=r[d],f=r[d+1];e.tri([u.x*_,o,u.y*_],[m.x*_,o,m.y*_],[f.x*_,o,f.y*_],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=kn.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],d=[],m=[];for(let h=0;h<u.length-1;h++)d.push(u[h][0],u[h][1]),m.push([u[h][0],u[h][1]]);if(m.length<3)continue;let f=(0,_o.default)(d,void 0,2);for(let h=0;h<f.length;h+=3){let p=m[f[h]],b=m[f[h+1]],y=m[f[h+2]];e.tri([p[0]*_,o,p[1]*_],[b[0]*_,o,b[1]*_],[y[0]*_,o,y[1]*_],c,i)}}}function Ho(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Ut(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Tn([[...i]]):null,d=f=>{e.setMaterial(2),f(),e.setMaterial(0)},m=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let h=t[f];if(h.patch&&h.patch.length>=3){let A=[...h.patch],M=s[f].belowY??r;if(m(()=>{if(l&&u)Lo(e,l,u,A,h.y,o.tread);else{let D=A[0];for(let B=1;B+1<A.length;B++){let N=A[B],H=A[B+1];e.tri([D.x*_,h.y,D.y*_],[N.x*_,h.y,N.y*_],[H.x*_,h.y,H.y*_],c,o.tread)}}}),h.y>M+Fo){let D=0,B=0;for(let N of A)D+=N.x,B+=N.y;D/=A.length,B/=A.length,d(()=>{for(let N=0;N<A.length;N++){let H=A[N],O=A[(N+1)%A.length],S=O.x-H.x,v=O.y-H.y,R=Math.hypot(S,v);if(R<1e-6)continue;let C=v/R,T=-S/R;(H.x-D)*C+(H.y-B)*T<0&&(C=-C,T=-T);let P=[C,0,T],F=[H.x*_,h.y,H.y*_],I=[O.x*_,h.y,O.y*_],z=[H.x*_,M,H.y*_],E=[O.x*_,M,O.y*_];e.tri(F,I,E,P,o.riser),e.tri(F,E,z,P,o.riser)}})}continue}let p=Bo(t,f,s,n);if(!p)continue;let{pts:b,nrm:y,front:g,back:x}=p,w=s[f].belowY??r;for(let A=0;A+1<b.length;A++){let M=b[A],D=b[A+1],B=y[A],N=y[A+1];if(Math.hypot(D.x-M.x,D.y-M.y)<1e-6||B[0]===0&&B[1]===0||N[0]===0&&N[1]===0)continue;let H=[(M.x-B[0]*g)*_,h.y,(M.y-B[1]*g)*_],O=[(D.x-N[0]*g)*_,h.y,(D.y-N[1]*g)*_],S=[(M.x+B[0]*x)*_,h.y,(M.y+B[1]*x)*_],v=[(D.x+N[0]*x)*_,h.y,(D.y+N[1]*x)*_];if(m(()=>{l&&u?Lo(e,l,u,[{x:M.x-B[0]*g,y:M.y-B[1]*g},{x:D.x-N[0]*g,y:D.y-N[1]*g},{x:D.x+N[0]*x,y:D.y+N[1]*x},{x:M.x+B[0]*x,y:M.y+B[1]*x}],h.y,o.tread):(e.tri(H,O,v,c,o.tread),e.tri(H,v,S,c,o.tread))}),h.y>w+Fo){let R=[H[0],w,H[2]],C=[O[0],w,O[2]],T=[-B[0],0,-B[1]];d(()=>{e.tri(H,O,C,T,o.riser),e.tri(H,C,R,T,o.riser)})}}}}function Uo(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function jt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Fn=et(require("polygon-clipping"),1);function _a(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function jo(e,t){return e.filter(n=>n.type!=="shape"||_a(n,t))}function Xo(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:jo(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:jo(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Oa={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function st(e){return Uo(e)??Oa}function Yo(e,t){let n=Vt(e.outline,ye),r=st(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&jt(r,st(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Fn.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function Wo(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=Fn.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Ba=.05,Ko=.05,Na=.15,Dn=25;function qo(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],u=new Set;for(let d=0;d<e.length;d+=1){let m=e[d];for(let f of m.objects){if(f.type==="table"&&u.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let h=Vt(f.outline,ye);c.set(f.id,{section:f,unit:m,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:f.id,floorIndex:d,box:st(h),section:f,unit:m,outline:h})}}for(let d=0;d<t.length;d++){let m=t[d];for(let f of l){if(n&&f.floorIndex!==n[d]||m.x<f.box.minX||m.x>f.box.maxX||m.y<f.box.minY||m.y>f.box.maxY||!Eo({x:m.x,y:m.y},f.outline,f.section.holes))continue;o[d]=f.id;let h=c.get(f.id);h.hasSeats=!0;let p=m.focalPoint??f.unit.focal,b=Math.hypot(m.x-p.x,m.y-p.y);b<h.frontU&&(h.frontU=b),h.seatIndices.push(d);let y=m.rowId||`__seat-${d}`,g=h.rows.get(y);g?g.push({x:m.x,y:m.y}):h.rows.set(y,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let f=fo(m.section,{floorBaseHeightM:m.unit.baseHeightM}),h=m.unit.baseHeightM,p=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=h+.001,y=m.section.surfaceKind,g=y==="flat"?!0:y==="rakedRows"&&f.rake>.01?!1:b,x=m.hasSeats?Ro(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},A=x.rows.length<2?ko([...m.rows.values()].map(P=>({points:P})),m.unit.focal):null,M=1/0;if(A){if(m.hasSeats)for(let P of m.rows.values())for(let F of P){let I=A.depthAt(F.x,F.y);I<M&&(M=I)}if(!m.hasSeats||!Number.isFinite(M)){M=1/0;for(let P of m.section.outline){let F=A.depthAt(P.x,P.y);F<M&&(M=F)}}}let D=h+Ba,B=Math.max(D,f.height),N=P=>{let F=Math.max(0,P-M)*we,I=Math.min(F*p,Dn);return Math.max(D,f.height+I)},H=P=>{let F=Math.max(0,P)*we,I=Math.min(F*p,Dn);return Math.max(D,f.height+I)},O=g?[]:x.rows.map(P=>({pts:P.pts,y:H(P.blockDepth),depth:P.blockDepth,blockId:P.blockId,...u.has(P.id)?{patch:Oo(P.pts,ye)}:{}})),S=O.length?O[0].y:B,v=O.map(P=>{let F=P.patch&&P.patch.length>=3?P.patch:P.pts,I=0,z=0;for(let G of F)I+=G.x,z+=G.y;let E=F.length||1;I/=E,z/=E;let L=0;for(let G of F){let X=Math.hypot(G.x-I,G.y-z);X>L&&(L=X)}return{cx:I,cy:z,rad:L}}),R=g?()=>B:O.length>=2?(P,F)=>{let I=1/0,z=S;for(let E=0;E<O.length;E++){let L=v[E];if(Math.hypot(P-L.cx,F-L.cy)-L.rad>=I)continue;let G=O[E].patch,X=G&&G.length>=3?gt(G,P,F)?0:it(G,P,F):it(O[E].pts,P,F);X<I&&(I=X,z=O[E].y)}return z}:(P,F)=>A?N(A.depthAt(P,F)):B,C=[0,1,0],T=O.length>=2||g?()=>C:(P,F)=>{if(!A)return C;let I=A.depthAt(P,F);if(I<=M)return C;let z=(I-M)*we;if(z*p>=Dn||f.height+z*p<=D)return C;let[E,L]=A.gradientAt(P,F);if(E===0&&L===0)return C;let G=1/Math.hypot(p,1);return[-E*p*G,G,-L*p*G]};if(!g)for(let P of x.rows){let F=H(P.blockDepth);for(let I of P.seatIndices)a[I]=F}for(let P of x.rows){let F=[];for(let G=1;G<P.pts.length;G++){let X=Math.hypot(P.pts[G].x-P.pts[G-1].x,P.pts[G].y-P.pts[G-1].y);X>1e-6&&F.push(X)}F.sort((G,X)=>G-X);let I=F.length?F[Math.floor(F.length/2)]:1/0,z=1/0,E=P.pts[Math.floor(P.pts.length/2)];if(E)for(let G of x.rows){if(G===P||G.blockId!==P.blockId)continue;let X=it(G.pts,E.x,E.y);X>1e-6&&X<z&&(z=X)}let L=Math.min(I,Math.max(z,I*.5));if(Number.isFinite(L)&&L>0)for(let G of P.seatIndices)s[G]=L}r.set(d,{sectionId:d,deckAt:R,normalAt:T,flat:g,bottomY:h,rowLevels:O,landingY:S})}for(let d=0;d<t.length;d++){let m=o[d],f=t[d];if(m){let p=a[d];i[d]=(p??r.get(m).deckAt(f.x,f.y))+Na;continue}let h=f.eyeHeightM;i[d]=Number.isFinite(h)?Math.max(0,h-_t):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function Fe(e,t){if(!e)return t;let n=be(ht(e,.4),.62);return he(t,n,.72)}function $o(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,l=0,u=0;for(let[d,m]of a){let f=ee(n.get(d));f&&(s+=f[0]*m,c+=f[1]*m,l+=f[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function Zo(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var vl=Math.PI*2;function Qo(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Jo=et(require("polygon-clipping"),1);function Va(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Xt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=st(t),i=this.rings.filter((c,l)=>jt(o,this.boxes[l])&&Va(n,this.levels[l])),a=[[r]];if(i.length)try{a=Jo.default.difference([r],...i).map(l=>l.map(u=>u.map(([d,m])=>[d,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function za(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)n=Math.min(n,d.x),r=Math.max(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(d=>{let m=d.x-a,f=d.y-s;return{x:a+m*l-f*u,y:s+m*u+f*l}})}function St(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Mt(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=zt(n,r,e.width/2,e.height/2)}return t?za(t,e.rotation):null}function wt(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&Qo(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Ga=.08;function er(e,t){let n=St(e),r=wt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let l=o;for(let u of t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&l<=u.topOffsetM+1e-6&&(l=u.topOffsetM+Ga);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Ne(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function tr(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Pt(e,t,n){return[Ne(e[0],e[1],t),Ne(e[0],e[1],n),Ne(e[3],e[2],n),Ne(e[3],e[2],t)]}function nr(e,t,n){return[Ne(e[0],e[3],t),Ne(e[1],e[2],t),Ne(e[1],e[2],n),Ne(e[0],e[3],n)]}function De(e,t,n,r,o,i){se(e,t,void 0,()=>n,r,o,i,ae)}var Ln=2.4,Ha=.75,Ua=.15;function Ct(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,d])=>({x:t.x+u*a-d*s,y:t.y+u*s+d*a}))}function or(e,t,n,r,o){let i=Ct(t);i&&se(e,i,void 0,()=>n+Ln,n,Fe(r,o.boothTop),o.boothWall,ae)}function _n(e){if(e.shape==="round"){let u=e.radius;return u?zt(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,d])=>({x:o.x+u*a-d*s,y:o.y+u*s+d*a}))}function rr(e,t,n,r,o){let i=_n(t);i&&se(e,i,void 0,()=>n+Ha,n,Fe(r,o.tableTop),o.tableWall,ae)}function ir(e,t,n,r,o,i,a){let s=St(t);if(!s)return;let c=t.role==="stage",l=wt(t),u=n+r;if(c&&a){let p=1/0,b=-1/0,y=1/0,g=-1/0;for(let x of s)x.x<p&&(p=x.x),x.x>b&&(b=x.x),x.y<y&&(y=x.y),x.y>g&&(g=x.y);a.push({cx:(p+b)/2*_,cz:(y+g)/2*_,y:u,halfX:Math.max((b-p)/2*_,.5),halfZ:Math.max((g-y)/2*_,.5)})}let d=ee(t.fill),m=c&&d?he(o.stageTop,be(ht(d,.18),.9),.9):Fe(d,c?o.stageTop:o.decorTop),f=t.role==="screen"?d:null,h=c?d?he(o.stageWall,be(d,.58),.82):o.stageWall:t.role==="screen"?f?he(be(f,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Fe(ee(t.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let p=tr(s);De(e,Pt(p,0,.16),u,n,m,h),De(e,Pt(p,.84,1),u,n,m,h),De(e,p,u,Math.max(n,u-.35),m,h);return}if(l.kind==="suite"&&s.length===4){let p=s.map((g,x)=>{let w=s[(x+1)%4],A=(g.x+w.x)/2,M=(g.y+w.y)/2;return Math.hypot(A-i.x,M-i.y)}),b=p.indexOf(Math.min(...p)),y=[0,1,2,3].map(g=>s[(b+g)%4]);De(e,Pt(y,0,.08),u,n,m,h),De(e,Pt(y,.92,1),u,n,m,h),De(e,nr(y,.88,1),u,n,m,h),De(e,y,u,Math.max(n,u-.18),m,h);return}De(e,s,u,n,m,h)}function On(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=r/2,d=o/2;return[[-u,-d],[u,-d],[u,d],[-u,d]].map(([m,f])=>({x:i+m*c-f*l,y:a+m*l+f*c}))}function ja(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ee(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=ee(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>he(s,c,1/(l+1)),a[0]):null}function ar(e,t,n,r){if(t.layer==="foreground")return;let o=On(t);if(!o)return;let i=n+Ua,a=Fe(ja(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),se(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ae)}function sr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Fe(r,o.gaTop);se(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ae)}var Xa=Math.PI/180,Q=96,Ya=6,Wa=60,Ka=150,cr=.2,qa=.35;function $a(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Xa;return n<0?n+360:n}function Yt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function Wt(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=e[l],s++}o[i]=a/s}return o}function lr(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let f of m.rows){for(let h of f.pts)o+=h.x,i+=h.y,a++;if(f.pts.length>=4){let h=In(f.pts);h&&Number.isFinite(h.cx)&&Number.isFinite(h.cy)&&r.push({x:h.cx,y:h.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=Yt(r.map(y=>y.x)),f=Yt(r.map(y=>y.y)),h=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let w=Math.hypot(x.x-s.x,x.y-s.y);w>h&&(h=w)}let p=0,b=h*.2;for(let y of n)for(let g of y.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-f)<b&&p++;Math.hypot(m-s.x,f-s.y)<=h&&p/a<.01&&(c={x:m,y:f})}let l=[];for(let m of n){let f={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let h of m.rows)for(let p of h.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),y=Math.min(Q-1,Math.floor($a(c,p)/(360/Q)));f.samples.push({r:b,bin:y,levelM:h.levelM}),b<f.rMin&&(f.rMin=b),b>f.rMax&&(f.rMax=b)}f.samples.length&&l.push(f)}if(!l.length)return null;l.sort((m,f)=>m.rMin+m.rMax-(f.rMin+f.rMax));let u=[];for(let m of l){let f=!1;for(let h of u){let p=Math.min(m.rMax,h.rMax)-Math.max(m.rMin,h.rMin),b=Math.min(m.rMax-m.rMin,h.rMax-h.rMin);if(b>1e-9&&p>=qa*b){h.members.push(m),h.rMin=Math.min(h.rMin,m.rMin),h.rMax=Math.max(h.rMax,m.rMax),f=!0;break}}f||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let d=[];for(let m of u){let f=new Array(Q).fill(null);for(let v of m.members)for(let R of v.samples){let C=f[R.bin];C||(C={samples:[]},f[R.bin]=C),C.samples.push({r:R.r,levelM:R.levelM})}let h=f.map(v=>!!v);if(!h.filter(Boolean).length)continue;let b=[],y=[];for(let v of f){if(!v)continue;let R=1/0,C=-1/0;for(let T of v.samples)T.r<R&&(R=T.r),T.r>C&&(C=T.r);b.push(R),y.push(C)}let g=Yt(b),x=Yt(y);if(!(g>=cr*x)||!(x>0))continue;let w=[...b].sort((v,R)=>v-R);if(!(w[Math.floor(w.length*.1)]>=cr*x))continue;let M=f.map(v=>{if(!v)return null;let R=[...v.samples].sort((L,G)=>L.r-G.r),C=R[0].r,T=R[R.length-1].r,P=R[0].levelM,F=-1/0;for(let L of R)L.levelM>F&&(F=L.levelM);let I=[];for(let L of R){let G={r:L.r,l:L.levelM};for(;I.length&&Math.abs(I[I.length-1].r-G.r)<1e-9;){if(I[I.length-1].l<=G.l){G.skip=!0;break}I.pop()}if(!G.skip){for(;I.length>=2;){let X=I[I.length-2],V=I[I.length-1];if((V.r-X.r)*(G.l-X.l)-(V.l-X.l)*(G.r-X.r)<=0)I.pop();else break}I.push(G)}}let z=I.map(L=>L.r),E=I.map(L=>L.l);return{inner:C,outer:T,front:P,top:F,profile:{rs:z,ls:E}}}),D=h.slice();for(let v=0;v<Q;v++){if(D[v])continue;let R=-1,C=-1,T=0;for(let k=1;k<=Q;k++){let Y=(v-k+Q*2)%Q;if(D[Y]){R=Y;break}}for(let k=1;k<=Q;k++){let Y=(v+k)%Q;if(D[Y]){C=Y,T=k;break}}if(R<0||C<0)continue;let P=0;for(let k=1;k<=Q;k++){let Y=(v-k+Q*2)%Q;if(h[Y]){P=k;break}}if(P-1+T>Ya)continue;let I=M[R],z=M[C],E=P/(P+T),L=I.inner+(z.inner-I.inner)*E,G=I.outer+(z.outer-I.outer)*E,X=I.front+(z.front-I.front)*E,V=I.top+(z.top-I.top)*E;M[v]={inner:L,outer:G,front:X,top:V,profile:{rs:[L,G],ls:[X,V]}}}for(let v=0;v<Q;v++)M[v]&&(D[v]=!0);let B=360/Q,N=[],H=D.filter(Boolean).length,O=[];if(H===Q)O.push({start:0,len:Q});else{let v=0;for(;D[v];)v=(v+1)%Q;let R=-1;for(let C=0;C<=Q;C++){let T=(v+C)%Q,P=C<Q&&D[T];if(P&&R<0)R=T;else if(!P&&R>=0){let F=(T-R+Q)%Q||Q;O.push({start:R,len:F}),R=-1}}}for(let v of O){if(v.len*B<Wa&&v.len<Q)continue;let R=v.len===Q,C=new Float64Array(v.len),T=new Float64Array(v.len),P=new Float64Array(v.len),F=new Float64Array(v.len),I=[];for(let k=0;k<v.len;k++){let Y=M[(v.start+k)%Q];C[k]=Y.inner,T[k]=Y.outer,P[k]=Y.front,F[k]=Y.top,I.push(Y.profile??{rs:[Y.inner,Y.outer],ls:[Y.front,Y.top]})}let z=Wt(C,R),E=Wt(T,R),L=Wt(P,R),G=Wt(F,R);for(let k=0;k<v.len;k++)z[k]>C[k]&&(z[k]=C[k]),E[k]<T[k]&&(E[k]=T[k]),z[k]>E[k]-1e-6&&(z[k]=Math.max(0,E[k]-1e-6)),G[k]<L[k]&&(G[k]=L[k]);let X={startBin:v.start,binCount:v.len,closed:R,innerR:z,outerR:E,frontLevelM:L,topLevelM:G,profiles:I},V=(k,Y,K)=>{let J=I[k],Z=J.rs,$=J.ls;if(Y<=Z[0]){$[0]>K&&($[0]=K);return}if(Y>=Z[Z.length-1]){$[$.length-1]>K&&($[$.length-1]=K);return}for(let te=0;te+1<Z.length;te++)if(Y<=Z[te+1]){$[te]>K&&($[te]=K),$[te+1]>K&&($[te+1]=K);return}};for(let k=0;k<v.len;k++){let Y=f[(v.start+k)%Q];if(Y)for(let K of Y.samples){V(k,K.r,K.levelM);let J=R?(k-1+v.len)%v.len:k-1,Z=R?(k+1)%v.len:k+1;J>=0&&V(J,K.r,K.levelM),Z<v.len&&V(Z,K.r,K.levelM)}}N.push(X)}N.reduce((v,R)=>v+R.binCount*B,0)<Ka||d.push({arcs:N,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:g,outerRMedian:x})}if(!d.length)return null;if(d.sort((m,f)=>m.innerRMedian-f.innerRMedian),t){let m=d[d.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:Q,binStepDeg:360/Q,rings:d}}function ur(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=u=>{let d=t.profiles[u],m=d.rs,f=d.ls;if(r<=m[0])return f[0];if(r>=m[m.length-1])return f[f.length-1];for(let h=0;h+1<m.length;h++)if(r<=m[h+1]){let p=m[h+1]-m[h],b=p>1e-9?(r-m[h])/p:0;return f[h]+(f[h+1]-f[h])*b}return f[f.length-1]};return l(a)*(1-c)+l(s)*c}var Za=.25,Qa=1.2,Ja=.6,es=.45,ts=2.3,ns=Math.PI/180;function Ze(e,t,n){let r=n*ns;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function os(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var rs=24;function is(e,t,n,r,o,i,a,s){let c=n.binCount,l=rs,u=we,d=i+.02,m=[];for(let S=0;S<c;S++){let v=(n.startBin+S+.5)*t.binStepDeg,R=new Float64Array(l+1);for(let C=0;C<=l;C++){let T=r[S]+(o[S]-r[S])*C/l;R[C]=Math.max(d,ur(t,n,v,T)-Za)}m.push(R)}let f=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],h=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],p=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],b=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(S,v)=>{let R=(n.startBin+S+.5)*t.binStepDeg,C=r[S]+(o[S]-r[S])*v/l,T=Ze(t.centre,C,R);return[T.x*u,m[S][v],T.y*u]};{let S=Math.tan(12*Math.PI/180);for(let v=0;v<6;v++){let R=!1;for(let T=0;T<c;T++)for(let P=l-1;P>=0;P--)m[T][P]>m[T][P+1]&&(m[T][P]=m[T][P+1],R=!0);let C=n.closed?c:c-1;for(let T=0;T<C;T++){let P=(T+1)%c;for(let F=0;F<=l;F++){let I=m[P][F]-m[T][F];if(Math.abs(I)>1)continue;let z=r[T]+(o[T]-r[T])*F/l,E=r[P]+(o[P]-r[P])*F/l,L=Ze(t.centre,z,(n.startBin+T+.5)*t.binStepDeg),G=Ze(t.centre,E,(n.startBin+P+.5)*t.binStepDeg),X=S*Math.hypot(G.x-L.x,G.y-L.y)*u;I>X?(m[P][F]=m[T][F]+X,R=!0):-I>X&&(m[T][F]=m[P][F]+X,R=!0)}}if(!R)break}}let g=1,x=(S,v)=>{for(let R=0;R<=l;R+=4)if(Math.abs(m[S][R]-m[v][R])>g)return!0;return Math.abs(m[S][l]-m[v][l])>g},w=Math.tan(38*Math.PI/180),A=S=>(o[S]-r[S])/l*u,M=(S,v)=>m[S][v+1]-m[S][v]>w*Math.max(1e-6,A(S)),D=(S,v)=>{let R=n.closed?(S-1+c)%c:Math.max(0,S-1),C=n.closed?(S+1)%c:Math.min(c-1,S+1);Math.abs(m[R][v]-m[S][v])>g&&(R=S),Math.abs(m[C][v]-m[S][v])>g&&(C=S);let T=Math.max(0,v-1),P=Math.min(l,v+1);T<v&&M(S,T)&&(T=v),P>v&&M(S,v)&&(P=v);let F=y(R,v),I=y(C,v),z=y(S,T),E=y(S,P),L=I[0]-F[0],G=I[1]-F[1],X=I[2]-F[2],V=E[0]-z[0],k=E[1]-z[1],Y=E[2]-z[2],K=G*Y-X*k,J=X*V-L*Y,Z=L*k-G*V,$=Math.hypot(K,J,Z);return $>1e-12?(K/=$,J/=$,Z/=$,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},B=(S,v)=>{let R=[S[0],i,S[2]],C=[v[0],i,v[2]],T=v[0]-S[0],P=v[2]-S[2],F=Math.hypot(T,P);if(!(F>1e-12))return;let I=[P/F,0,-T/F];e.tri(S,v,C,I,p,p,b),e.tri(S,C,R,I,p,b,b)},N=.05*Be,H=S=>o[S]-r[S]<N,O=n.closed?c:c-1;for(let S=0;S<O;S++){let v=(S+1)%c;if(H(S)||H(v))continue;if(x(S,v)){let I=(n.startBin+S+1)*t.binStepDeg,z=(k,Y)=>{let K=(r[S]+r[v])/2,J=(o[S]+o[v])/2,Z=K+(J-K)*Y/l,$=Ze(t.centre,Z,I);return[$.x*u,m[k][Y],$.y*u]};for(let k=0;k<l;k++){let Y=y(S,k),K=y(S,k+1),J=z(S,k),Z=z(S,k+1),$=D(S,k),te=D(S,k+1);e.triN(Y,J,Z,$,$,te,f),e.triN(Y,Z,K,$,te,te,f);let Ue=y(v,k),je=y(v,k+1),Re=z(v,k),Ie=z(v,k+1),Ee=D(v,k),xe=D(v,k+1);e.triN(Re,Ue,je,Ee,Ee,xe,f),e.triN(Re,je,Ie,Ee,xe,xe,f);let ve=z(S,k),ie=z(S,k+1),Je=z(v,k+1),Le=z(v,k),Te=ie[0]-ve[0],Xe=ie[2]-ve[2],dt=Math.hypot(Te,Xe);if(dt>1e-12){let me=[Xe/dt,0,-Te/dt];e.tri(ve,ie,Je,me,p),e.tri(ve,Je,Le,me,p)}}let E=y(S,0),L=y(v,0),G=y(v,l),X=y(S,l),V=k=>[k[0],i,k[2]];e.tri(V(E),V(G),V(L),[0,-1,0],h),e.tri(V(E),V(X),V(G),[0,-1,0],h),B(E,L),B(X,G);continue}for(let I=0;I<l;I++){let z=D(S,I),E=D(v,I),L=D(v,I+1),G=D(S,I+1);if(M(S,I)||M(v,I)){let K=(ie,Je)=>{let Le=(n.startBin+ie+.5)*t.binStepDeg,Te=r[ie]+(o[ie]-r[ie])*(I+.5)/l,Xe=Ze(t.centre,Te,Le);return[Xe.x*u,Je,Xe.y*u]},J=y(S,I),Z=y(v,I),$=K(S,m[S][I]),te=K(v,m[v][I]);e.triN(J,Z,te,z,E,E,f),e.triN(J,te,$,z,E,z,f);let Ue=y(v,I+1),je=y(S,I+1),Re=K(S,m[S][I+1]),Ie=K(v,m[v][I+1]);e.triN(Re,Ie,Ue,G,L,L,f),e.triN(Re,Ue,je,G,L,G,f);let Ee=te[0]-$[0],xe=te[2]-$[2],ve=Math.hypot(Ee,xe);if(ve>1e-12){let ie=[-xe/ve,0,Ee/ve];e.tri($,te,Ie,ie,p),e.tri($,Ie,Re,ie,p)}continue}let X=y(S,I),V=y(v,I),k=y(v,I+1),Y=y(S,I+1);e.triN(X,V,k,z,E,L,f),e.triN(X,k,Y,z,L,G,f)}let R=y(S,0),C=y(v,0),T=y(v,l),P=y(S,l),F=I=>[I[0],i,I[2]];e.tri(F(R),F(T),F(C),[0,-1,0],h),e.tri(F(R),F(P),F(T),[0,-1,0],h),B(R,C),B(P,T)}if(!n.closed)for(let S of[0,c-1])for(let v=0;v<l;v++)B(y(S,v),y(S,v+1))}function dr(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let d of u.arcs){let m=new Float64Array(d.binCount),f=new Float64Array(d.binCount);for(let p=0;p<d.binCount;p++){let b=(d.startBin+p)%t.binCount,y=Math.max(0,d.innerR[p]-ye);m[p]=Math.max(y,a[b]+.001),f[p]=Math.max(m[p]+.001,d.outerR[p]+ye)}let h=0;for(let p=0;p<d.binCount;p++){let b=d.topLevelM[p]-r;b>h&&(h=b)}h>=Qa&&is(e,t,d,m,f,r,o,i);for(let p=0;p<d.binCount;p++){let b=(d.startBin+p)%t.binCount;f[p]>a[b]&&(a[b]=f[p])}}if(os(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Ja*Be,l=es*Be;for(let u of s.arcs){let d=[],m=[];for(let p=0;p<u.binCount;p++){let b=(u.startBin+p+.5)*t.binStepDeg,y=u.outerR[p]+ye+c;d.push(Ze(t.centre,y,b)),m.push(Ze(t.centre,y+l,b))}let f=-1/0;for(let p=0;p<u.binCount;p++)u.topLevelM[p]>f&&(f=u.topLevelM[p]);let h=()=>f+ts;u.closed?se(e,m,[d.slice().reverse()],h,r,o.shellTop,o.shellWall,i):se(e,[...m,...d.slice().reverse()],void 0,h,r,o.shellTop,o.shellWall,i)}}function mr(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Fe(r,s.tierTop);if(!o)return;let u=b=>o.deckAt(b.x,b.y),d=Yo(t,a),m=d[0]??t.outline;if(o.rowLevels.length>=2){let b=Ut(o.rowLevels),y=Wo(zo(o.rowLevels,n.focal,b),d),g=()=>[0,1,0];for(let w of y){let A=Math.max(c,w.topY-.02);for(let M of i.subtract(w.outline,A))se(e,M,w.holes,()=>A,c,l,s.tierWall,ae,void 0,g)}y.length||se(e,m,t.holes,()=>o.landingY,c,l,s.tierWall,ae);let x={tread:[l[0]*ae.top,l[1]*ae.top,l[2]*ae.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let w of d.length?d:[m])Ho(e,o.rowLevels,n.focal,o.landingY,x,w,b);return}let f=o.flat?1/0:Ko,h=b=>o.normalAt(b.x,b.y),p=o.flat?o.landingY:void 0;for(let b of i.subtract(m,p))se(e,b,t.holes,u,c,l,s.tierWall,ae,f,h)}function as(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a],u=o.get(s);u||(u=new Map,o.set(s,u));let d=l.rowId||`__seat-${a}`,m=u.get(d);m||(m={pts:[],levelM:0,n:0},u.set(d,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function fr(e,t,n,r,o){let i=as(t,n,r);if(!i.length)return;let a=lr(i,t.focal);a&&(e.setMaterial(0),dr(e,a,{bottomY:t.baseHeightM,colors:{bandTop:be(o.tierTop,.8),bandWall:o.tierWall,shellTop:be(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:t.objects.filter(s=>s.type==="shape")}))}function hr(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function pr(e,t){let n=[...e].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var ss=1.15,cs=3.25,ls=4.5,us=.85,ds=.5,ms=.26;function br(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=ss&&a.add("zone"),o<=(i?cs:ls)&&(a.add("section"),a.add("ga")),o<=us&&(a.add("annotation"),a.add("booth")),o<=ds&&a.add("row"),o<=ms&&a.add("seat"),a}function Ve(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],u=o[2]*i+o[6]*a+o[10]*s+o[14],d=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(d>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/d,f=l/d,h=u/d,p=m>=-1.05&&m<=1.05&&f>=-1.05&&f<=1.05&&h<=1;return{x:(m*.5+.5)*n,y:(1-(f*.5+.5))*r,depth:h,visible:p}}function yr(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(Bn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var fs=6;function Bn(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+fs):n;return o<a&&i<r}function gr(e,t,n){return e.length*t*.58+(n?14:0)}var Nn={row:8,seat:14};function xr(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function Vn(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(Bn(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(Bn(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var hs=6,ps=2.2,vr=.1,bs=.3,ys=1.8,gs=.9,xs=.55,vs=6e3;function Mr(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let d of u.objects)d.type==="section"&&d.zone&&c.set(d.id,d.zone);let l=new Map;for(let u=0;u<r.length;u++){let d=r[u],m=o.seatOwner[u],f=d.zoneId??(m?c.get(m):void 0);if(!f)continue;let h=l.get(f);h||(h={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(f,h)),h.n++,d.x<h.minX&&(h.minX=d.x),d.y<h.minY&&(h.minY=d.y),d.x>h.maxX&&(h.maxX=d.x),d.y>h.maxY&&(h.maxY=d.y),h.sumY+=o.seatDeckY(u)}for(let u of a){let d=l.get(u.id),m=[];for(let[f,h]of c)h===u.id&&m.push(f);if(!d||d.n===0){s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]});continue}s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:d.n,center:[(d.minX+d.maxX)/2*_,d.sumY/d.n,(d.minY+d.maxY)/2*_],radius:.5*Math.hypot((d.maxX-d.minX)*_,(d.maxY-d.minY)*_)||1,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]})}}return s}function Sr(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],d=[];for(let m of s)m.seatCount!==0&&l.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+hs,m.center[2]],color:t.zones?.find(f=>f.id===m.id)?.color});{let m=new Map,f=new Map;for(let h=0;h<r.length;h++){let p=o.seatOwner[h];if(!p)continue;let b=m.get(p);b||(b={n:0,x:0,y:0,deck:0},m.set(p,b)),b.n++,b.x+=r[h].x,b.y+=r[h].y,b.deck+=o.seatDeckY(h);let y=f.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(p,y)),r[h].x<y.minX&&(y.minX=r[h].x),r[h].x>y.maxX&&(y.maxX=r[h].x),r[h].y<y.minY&&(y.minY=r[h].y),r[h].y>y.maxY&&(y.maxY=r[h].y)}for(let h of n)for(let p of h.objects){if(p.type!=="section")continue;let b=m.get(p.id);if(!b||b.n===0)continue;let y=f.get(p.id),g=[b.x/b.n*_,b.deck/b.n,b.y/b.n*_],x=p.displayLabel||p.label||p.id;u.push({id:p.id,floorIndex:h.index,label:x,seatCount:b.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*_),focalWorld:[h.focal.x*_,h.baseHeightM+1.5,h.focal.y*_]});let w=t.floors?.[h.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===x.trim().toLocaleLowerCase()||l.push({id:`section:${p.id}`,kind:"section",text:x,anchor:[g[0],g[1]+ps,g[2]],floorIndex:h.index})}}{for(let h of n)for(let p of h.objects){if(p.type!=="gaArea")continue;let b=yt(p.points);if(!b)continue;let y=p.displayLabel||p.label||p.id;l.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${y} \xB7 ${p.capacity.toLocaleString()}`:y,anchor:[b.x*_,h.baseHeightM+ys,b.y*_],floorIndex:h.index})}let m=new Map;for(let h=0;h<r.length;h++){let p=r[h],b=Math.hypot(p.x-c.x,p.y-c.y),y=m.get(p.rowId);(!y||b>y.far)&&m.set(p.rowId,{seat:p,index:h,far:b})}for(let[h,p]of m){let b=p.seat.label?p.seat.label.lastIndexOf("-"):-1,y=b>0?p.seat.label.slice(0,b):h;y&&l.push({id:`row:${h}`,kind:"row",text:y,anchor:[p.seat.x*_,o.seatDeckY(p.index)+gs,p.seat.y*_],floorIndex:a[p.index]})}let f=new Map;for(let h=0;h<r.length;h++){let p=r[h],b=p.label?p.label.lastIndexOf("-"):-1,y=f.get(p.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?p.label.slice(0,b):p.rowId,sectionId:p.sectionId},f.set(p.rowId,y));let g=h*3,x=i.iPosition[g],w=i.iPosition[g+1],A=i.iPosition[g+2];y.n++,y.x+=x,y.y+=w,y.z+=A,y.minX=Math.min(y.minX,x),y.maxX=Math.max(y.maxX,x),y.minZ=Math.min(y.minZ,A),y.maxZ=Math.max(y.maxZ,A)}for(let[h,p]of f)d.push({id:h,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=vs)for(let h=0;h<r.length;h++){let p=r[h],b=p.displayLabel||p.label;b&&l.push({id:`seat:${p.id}`,kind:"seat",text:b,anchor:[p.x*_,o.seatDeckY(h)+xs,p.y*_],floorIndex:a[h]})}}for(let m of n)for(let f of m.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let h=St(f),p=h?yt(h):null;if(!p||!f.label)continue;l.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[p.x*_,m.baseHeightM+wt(f).heightM+vr,p.y*_],color:f.fill,floorIndex:m.index})}else if(f.type==="text"){if(!f.text)continue;l.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*_,m.baseHeightM+vr,f.position.y*_],color:f.color,rotation:f.rotation,floorIndex:m.index})}else if(f.type==="booth"){let h=Ct(f);if(!h)continue;let p=yt(h);if(!p)continue;l.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[p.x*_,m.baseHeightM+Ln+bs,p.y*_],floorIndex:m.index})}return{labels:l,sections:u,rows:d}}function wr(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function Pr(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),h=m*3,p=l[f];p.minX=Math.min(p.minX,i.position[h]),p.minY=Math.min(p.minY,i.position[h+1]),p.minZ=Math.min(p.minZ,i.position[h+2]),p.maxX=Math.max(p.maxX,i.position[h]),p.maxY=Math.max(p.maxY,i.position[h+1]),p.maxZ=Math.max(p.maxZ,i.position[h+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let f of n[m].objects)f.type==="section"&&u.set(f.id,m);let d=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let f=o.seatOwner[m],h=(f!==null?u.get(f):void 0)??a[m];if(h===void 0)continue;let p=d[h],b=r[m];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let y=o.seatDeckY(m);p.sumX+=b.x*_,p.sumDeck+=y,p.sumZ+=b.y*_,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[m]=h}for(let m=0;m<n.length;m++){let f=d[m],h=t.floors?.[m],p=l[m],b=Math.min(f.n?f.minX*_:n[m].focal.x*_-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(f.n?f.maxX*_:n[m].focal.x*_+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(f.n?f.minY*_:n[m].focal.y*_-1,Number.isFinite(p.minZ)?p.minZ:1/0),x=Math.max(f.n?f.maxY*_:n[m].focal.y*_+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(f.n?Math.min(n[m].baseHeightM,f.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),A=Math.max(f.n?Math.max(f.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[f.n?f.sumX/f.n:(b+y)/2,f.n?f.sumDeck/f.n:(w+A)/2,f.n?f.sumZ/f.n:(g+x)/2],D=Math.max(1,.5*Math.hypot(y-b,A-w,x-g));c.push({index:m,id:h?.id??`floor-${m}`,label:h?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:f.n,center:M,radius:D,box:{min:[b,w,g],max:[y,A,x]},focalWorld:[n[m].focal.x*_,n[m].baseHeightM+1.5,n[m].focal.y*_]})}}return c}function zn(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=Ct(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=_n(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=On(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Cr(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Mt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);se(e,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=t.reduce((f,h)=>h.baseHeightM<f.baseHeightM?h:f);e.setFloor(a.index);let s=n.filter((f,h)=>r[h]===a.index),c=zn([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),d=Mt(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),m=a.baseHeightM-.03;se(e,d,void 0,()=>m,m-.22,i.ground,i.ground,ae)}}function Ar(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,d=-1/0,m=(p,b,y)=>{a=Math.min(a,p),l=Math.max(l,p),s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),d=Math.max(d,y)};for(let p=0;p<e.position.length;p+=3)m(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let b=p*3,y=t.iPosition[b],g=t.iPosition[b+1],x=t.iPosition[b+2],w=Math.max(.35,t.iMaxRadius[p]??.35);m(y-w,g,x-w),m(y+w,g+1.6,x+w)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,d=o+i);let f=[(a+l)/2,(s+u)/2,(c+d)/2],h=Math.max(1,.5*Math.hypot(l-a,u-s,d-c));return{center:f,radius:h,minY:s,maxY:u}}function Rr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let w=0;w<e.count;w++){let A=w*3,M=e.iPosition[A],D=e.iPosition[A+2];M<a&&(a=M),M>c&&(c=M),D<s&&(s=D),D>l&&(l=D)}for(let w of t)a=Math.min(a,w.cx-w.halfX),c=Math.max(c,w.cx+w.halfX),s=Math.min(s,w.cz-w.halfZ),l=Math.max(l,w.cz+w.halfZ);let u=n.minX*_,d=n.maxX*_,m=n.minY*_,f=n.maxY*_,h=u,p=d,b=m,y=f;if(Number.isFinite(a)){let w=Math.max(2,.06*Math.hypot(c-a,l-s));h=Math.max(u,a-w),p=Math.min(d,c+w),b=Math.max(m,s-w),y=Math.min(f,l+w)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[h,g,b],max:[p,x,y]}}function ct(e){let{doc:t}=e,n=wo(t.theme),r=n.structure,o=Xo(t,e.eventConfigurationId??t.eventConfigurationId),i=e.seats,a=new Nt,s=new Map;for(let S of o)for(let v of S.objects)s.set(v.id,S.index),v.type==="section"&&s.set(v.logicalSectionId??v.id,S.index);let c=i.map(S=>s.get(S.sectionId??"")??s.get(S.rowId??"")??0),l=zn(o,i);Cr(a,o,i,c,l,r);let u=$o(t,i),d=new Map;for(let S of t.categories??[])d.set(S.key,S.color);let m=[],f=qo(o,i,c),h=new Float32Array(i.length);for(let S=0;S<o.length;S++){let v=o[S];a.setFloor(S);let R=new Xt,C=[],T=v.objects.filter(P=>P.type==="section"&&!!P.outline&&P.outline.length>=3);for(let P of v.objects)P.type==="section"?mr(a,P,v,Zo(P,u),f.bySection.get(P.id),R,T,r):P.type==="shape"?(a.setMaterial(P.role==="screen"?1:0),ir(a,P,v.baseHeightM,er(P,C),r,v.focal,m),a.setMaterial(0)):P.type==="gaArea"?sr(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="booth"?or(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="table"?rr(a,P,v.baseHeightM,ee(d.get(P.categoryKey)),r):P.type==="decorImage"&&ar(a,P,v.baseHeightM,r);fr(a,v,i,f,r)}let p=o.length>1?{x:o.reduce((S,v)=>S+v.focal.x,0)/o.length,y:o.reduce((S,v)=>S+v.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},b=yo([a.build()]),y=So(i,e.initialState,f,h,d),g=Mr({doc:t,units:o,seats:i,surfaces:f,focal:p}),{labels:x,sections:w,rows:A}=Sr({doc:t,units:o,seats:i,surfaces:f,seatData:y,hintedSeatFloor:c,zones:g,focal:p}),M=Pr({doc:t,units:o,seats:i,surfaces:f,solids:b,hintedSeatFloor:c,seatFloor:h});wr(x,M),y.iYaw=vo(y.iPosition,i.length,S=>i[S].rowId,S=>{let v=o[h[S]]?.focal??p;return[v.x*_,v.y*_]});let D=(l.minX+l.maxX)/2*_,B=(l.minY+l.maxY)/2*_,N=.5*Math.hypot((l.maxX-l.minX)*_,(l.maxY-l.minY)*_)||10,H=Ar(b,y,{cx:D,cz:B,radius:N}),O=Rr(y,m,l,H.minY,H.maxY,N);return{solids:b,seats:y,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:N,groundY:0,box:O},renderBounds:{center:H.center,radius:H.radius},stateColorLUT:Po(n,ge),theme:n,seatCount:i.length,focalWorld:[p.x*_,1.5,p.y*_],zones:g,stages:m,sections:w,rows:A,labels:x,floors:M}}var Ms=88,Ss=20,Ir={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}},Kt=new Set(["row","seat"]),Er={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},qt={row:{x:62,y:16},seat:{x:46,y:18}},kr=ee,Gn=e=>Zn(e);function Fr(e,t){let n=Gn(e),r=Gn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Tr(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function ws(e,t=[.04,.06,.1]){let n=Gn(t)<.42,r=n?"#f4f7fb":"#0b1220",o=kr(e),i=o&&Fr(o,t)>=4.5?e:r;return n?{ink:i,backing:"rgba(8,12,22,.78)",border:"rgba(210,222,245,.24)"}:{ink:i,backing:"rgba(255,255,255,.84)",border:"rgba(11,18,32,.22)"}}var $t=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=br(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Ve(t,g.anchor,n,r);if(!x.visible)continue;let w=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:xr(x,w,n,r),halfWidth:gr(g.text,Ir[g.kind].size,!Kt.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let l=pr(c.filter(g=>g.label.kind==="floor"),n),u=[...c.filter(g=>!Kt.has(g.label.kind)&&g.label.kind!=="floor"),...l],d=yr(u,Ms,Ss),m=Vn(c.filter(g=>g.label.kind==="row"),qt.row.x,qt.row.y,Nn.row,d),f=Vn(c.filter(g=>g.label.kind==="seat"),qt.seat.x,qt.seat.y,Nn.seat,[...d,...m]),h=[...d,...m,...f],p=new Set(h.map(g=>g.label.id));for(let{label:g,screen:x}of h){let A=this.nodeFor(g).style;A.display="",A.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let b=h.filter(({label:g})=>!Kt.has(g.kind)).sort((g,x)=>Er[x.label.kind]-Er[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),y=[];for(let{label:g}of b){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let w=x.getBoundingClientRect();y.some(M=>w.left<M.right+3&&w.right+3>M.left&&w.top<M.bottom+3&&w.bottom+3>M.top)?x.style.display="none":y.push(w)}for(let[g,x]of this.nodes)p.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let d=n.style;d.position="absolute",d.left="0",d.top="0",d.whiteSpace="nowrap",d.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",d.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=Ir[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=ws(t.color??this.opts.ink,this.opts.backgroundRgb),s=!Kt.has(t.kind);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=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=kr(r?"#ecf8ff":a.ink)??[1,1,1],u=r?Tr("rgba(10,28,45,.9)",c):s?Tr(a.backing,c):c;return n.dataset.qualityContrast=Fr(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Lr=1;var Ps=new Set(["floor","zone","section","ga","booth","annotation"]);function Cs(e){return e.every(t=>Number.isFinite(t))}function As(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Dr(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Qe(e){return Math.round(e*1e4)/1e4}function Rs(e){if(e)return{box:{x:Qe(e.box.x),y:Qe(e.box.y),width:Qe(e.box.width),height:Qe(e.box.height)},horizontalFillRatio:Qe(e.horizontalFillRatio),verticalFillRatio:Qe(e.verticalFillRatio),visibleAreaRatio:Qe(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Pe(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Zt(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Ps.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)As(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Pe("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Pe("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Pe("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Pe("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Pe("camera-invalid","The capture camera must have a finite physical pose",Cs(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Pe("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Pe("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Pe("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Pe("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Pe("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.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:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Rs(e.framing)},metrics:{minimumHierarchyFontPx:Dr(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Dr(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var pe=require("ogl");var ze=require("ogl");var Qt=`
1
+ "use strict";var Ri=Object.create;var Tt=Object.defineProperty;var Ii=Object.getOwnPropertyDescriptor;var Ei=Object.getOwnPropertyNames;var Ti=Object.getPrototypeOf,ki=Object.prototype.hasOwnProperty;var Li=(e,t)=>{for(var n in t)Tt(e,n,{get:t[n],enumerable:!0})},qn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ei(t))!ki.call(e,o)&&o!==n&&Tt(e,o,{get:()=>t[o],enumerable:!(r=Ii(t,o))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?Ri(Ti(e)):{},qn(t||!e||!e.__esModule?Tt(n,"default",{value:e,enumerable:!0}):n,e)),Fi=e=>qn(Tt({},"__esModule",{value:!0}),e);var xc={};Li(xc,{VENUE3D_QUALITY_REPORT_VERSION:()=>Nr,buildSceneModel:()=>ct,inspectVenue3DQualityEvidence:()=>Zt,mountVenue3D:()=>gc,prepareVenue3D:()=>wi});module.exports=Fi(xc);var eo=require("ogl");var Di=/^#?([\da-f]{3}|[\da-f]{6})$/i;function _i(e){let t=Di.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ee(e){let t=_i(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function fn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Oi(e){return .2126*fn(e[0])+.7152*fn(e[1])+.0722*fn(e[2])}function Zn(e){return Oi([e[0]*255,e[1]*255,e[2]*255])}function Bi(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function fe(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function ft(e,t){let n=Bi(e);return fe(e,[n,n,n],t)}var ge=["available","held","sold","selected","dimmed"];function pt(e){let t=ge.indexOf(e);return t<0?0:t}var $n={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Jn(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var pn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Ke={top:[.05,.06,.08],bottom:[.1,.12,.15]};function be(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Ni(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var kt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,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 eo.Renderer({canvas:this.canvas,dpr:Ni(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ke.top[0],Ke.top[1],Ke.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var nt=require("ogl"),de=Math.PI/180,bn=15*de,yn=80*de,tt=.12,to=35,no=1.25,Lt=class{constructor(t,n,r,o){this.fovY=to;this.target=new nt.Vec3;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;this.distT=10;this.minDist=1;this.maxDist=100;this.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 nt.Vec3;this.panAnchor=new nt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new nt.Camera(t,{fov:to,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,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 a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,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 a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.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 c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(bn,Math.min(yn,this.polT-s*.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 a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*de;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"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(bn,Math.min(yn,this.polT+(i.key==="ArrowUp"?-a:a)));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()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*de/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),d=-i*l,m=-a*l;this.targetT.x+=(-t*s+n*d)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*de/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??no)),this.minDist=Math.max(2,a*.12),this.maxDist=u*4,n?(this.azimuth=this.azT,this.polar=12*de,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*de/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??no))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let l=Math.sin(i),u=-l*Math.sin(o),d=-Math.cos(i),m=-l*Math.cos(o);if(Math.abs(d)>.999)return s;let h=-m,f=u,p=Math.hypot(h,f);h/=p,f/=p;let b=-f*d,y=f*u-h*m,g=h*d,x=Math.tan(r),S=Math.tan(n),C=1;for(let M=0;M<8;M++){let k=(M&1?c.max[0]:c.min[0])-t.center[0],O=(M&2?c.max[1]:c.min[1])-t.center[1],V=(M&4?c.max[2]:c.min[2])-t.center[2],H=k*u+O*d+V*m,N=Math.abs(k*h+V*f),A=Math.abs(k*b+O*y+V*g);C=Math.max(C,N/x-H,A/S-H)}return Math.min(s,Math.max(C,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*tt,this.polar+=n*tt,this.distance+=r*tt,this.target.x+=o*tt,this.target.y+=i*tt,this.target.z+=a*tt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(bn,Math.min(yn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),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 Ft=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}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 ot=2.5,Gi=1.15,bt=6,rt=10,oo=6,ro=9.5,io=.9,ao=2.2,gn=30,xn=4,Dt=8192;var Ic=rt+xn;function so(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ot};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ot+o*(Gi-ot)}}function co(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function lo(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var Vi=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],Tc=new Map(Vi.map(e=>[e.key,e]));var zi={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function uo(e){let t=e?.[0];return t&&zi[t]||"#3b82f6"}var Hi=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],kc=new Map(Hi.map(e=>[e.key,e]));var Ui=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Lc=new Set(Ui);var ho=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],fo=ho.map(e=>e.key),ji=new Map(ho.map(e=>[e.key,e]));function mo(e){return typeof e=="string"&&ji.has(e)}function po(e,t){return mo(e)?e:mo(t?.seatGlyph)?t.seatGlyph:"circle"}var we=.02291666666666667,Be=1/we,Yi=58,Xi=Yi*we;var Wi=3,bo=0,vn=120,Ki=0,Qi=45,qi=7,_t=1.2;function Mn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Zi(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=qi?e:Wi}function yo(e,t={}){let n=Mn(t.floorBaseHeightM,bo,vn,0),r=Math.min(vn,n+Zi(e.elevation)*Xi),o=e.height===void 0?r:Mn(e.height,bo,vn,r),i=Mn(e.rake,Ki,Qi,0);return{height:o,rake:i}}var xo=et(require("earcut"),1),vo=et(require("polygon-clipping"),1);var Nc=Math.PI/180;function Sn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function yt(e){return e.length?Sn(e):null}function Qe(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function gt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var _=we,$i=.002;function Ji(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<$i}var qe=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Nt=class{constructor(){this.pos=new qe;this.nor=new qe;this.col=new qe;this.flr=new qe;this.mat=new qe;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){Ji(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,l=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function ea(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=o*c-i*s,u=i*a-r*c,d=r*s-o*a,m=Math.hypot(l,u,d)||1;return l/=m,u/=m,d/=m,[l,u,d]}function ta(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,xo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function wn(e){return Qe(e)<0?[...e].reverse():e}var na=3;function oa(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(h,f,p,b)=>Math.abs(r({x:(h.x+f.x)/2,y:(h.y+f.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,d=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-u)),m=(h,f,p)=>{let b=Math.abs(r({x:(h+c)/2,y:(f+l)/2})-(p+u)/2);b>d&&(d=b)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),d}function xt(e,t,n,r,o){if(o<=0)return oa(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(xt(e,i,s,r,o-1),xt(i,t,a,r,o-1),xt(s,a,n,r,o-1),xt(i,a,s,r,o-1))}function vt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},h={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+t.x)/2,y:(r.y+t.y)/2};vt(e,t,m,f,o,i,a-1,s),vt(e,m,n,h,o,i,a-1,s),vt(e,f,h,r,o,i,a-1,s),vt(e,m,h,f,o,i,a-1,s);return}let c=[t.x*_,o(t),t.y*_],l=[n.x*_,o(n),n.y*_],u=[r.x*_,o(r),r.y*_];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let d=ea(c,l,u);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(c,l,u,d,i)}var ra=8;function go(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},d=t(u);if(Math.abs(d-(s+c)/2)>n){o(i,u,s,d,l-1),o(u,a,d,c,l-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),ra)}return r}function Ot(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l);u>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var Bt=.001*Be*.1;function ce(e,t,n,r,o,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Qe(t))<1e-4))return;let u=Ot(go(Ot(wn(t),Bt),r,c),Bt),d=n?.map(M=>Ot(go(Ot(wn(M),Bt),r,c),Bt)).filter(M=>M.length>=3&&Math.abs(Qe(M))>=1e-4),{pts:m,tris:h}=ta(u,d),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<na;g++){let M=0;for(let k=0;k<h.length;k+=3){let O=xt(m[h[k]],m[h[k+1]],m[h[k+2]],r,g);O>M&&(M=O)}if(M<=c)break}for(let M=0;M<h.length;M+=3){let k=m[h[M]],O=m[h[M+1]],V=m[h[M+2]];vt(e,k,O,V,r,f,g,l);let H=[k.x*_,o,k.y*_],N=[O.x*_,o,O.y*_],A=[V.x*_,o,V.y*_];e.tri(H,A,N,[0,-1,0],p)}let x=M=>{if(g<=0)return M;let k=1<<g,O=[];for(let V=0;V<M.length;V++){let H=M[V],N=M[(V+1)%M.length];for(let A=0;A<k;A++){let v=A/k;O.push({x:H.x+(N.x-H.x)*v,y:H.y+(N.y-H.y)*v})}}return O},S=Sn(u),C=[{ring:x(u),flip:!1}];if(d)for(let M of d)M.length>=3&&C.push({ring:x(M),flip:!0});for(let{ring:M,flip:k}of C)for(let O=0;O<M.length;O++){let V=M[O],H=M[(O+1)%M.length],N=(H.x-V.x)*_,v=(H.y-V.y)*_,w=-N,P=Math.hypot(v,w)||1;v/=P,w/=P;let T=(V.x+H.x)/2-S.x,L=(V.y+H.y)/2-S.y,E=v*T+w*L;k&&(E=-E),E<0&&(v=-v,w=-w);let R=[v,0,w],z=[V.x*_,r(V),V.y*_],I=[H.x*_,r(H),H.y*_],D=[V.x*_,o,V.y*_],B=[H.x*_,o,H.y*_];e.tri(z,I,B,R,b,b,y),e.tri(z,B,D,R,b,y,y)}}function Mo(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function Gt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=wn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,d=l.y-c.y,m=Math.hypot(u,d)||1;i.push({x:d/m,y:-u/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],d=l.x+u.x,m=l.y+u.y,h=Math.hypot(d,m),f=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(h<1e-9){f();continue}d/=h,m/=h;let p=d*l.x+m*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){f();continue}a.push([c.x+d*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=vo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let d of s){let m=Math.abs(Qe(d[0].map(([h,f])=>({x:h,y:f}))));m>l&&(l=m,c=d[0])}if(!c)return e;let u=c.map(([d,m])=>({x:d,y:m}));if(u.length>1){let d=u[0],m=u[u.length-1];Math.abs(d.x-m.x)<1e-9&&Math.abs(d.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function Vt(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function Mt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var re={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ia=.44,aa=.15,sa=.3,ca=.24;function So(e){return e===void 0||!Number.isFinite(e)||e<=0?ca:Math.min(sa,Math.max(aa,e*ia))}var Pn=.21,la=.05,Cn=.45,zt=Cn+la,ua=[{part:re.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:re.pad,min:[-1,.36,-.95],max:[1,Cn,1]},{part:re.back,min:[-1,zt,-1],max:[1,.92,-.72]},{part:re.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:re.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:re.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:re.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:re.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:re.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:re.leg,min:[.62,0,.48],max:[.82,.37,.7]}],da=[{part:re.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:re.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:re.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:re.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:re.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],ma=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function wo(){let e=[],t=[],n=[],r=[],o=(P,T,L)=>{let E=n.length,[R,z,I]=P,D=[z[0]-R[0],z[1]-R[1],z[2]-R[2]],B=[I[0]-R[0],I[1]-R[1],I[2]-R[2]],U=D[1]*B[2]-D[2]*B[1],G=D[2]*B[0]-D[0]*B[2],F=D[0]*B[1]-D[1]*B[0],X=Math.hypot(U,G,F);X>1e-9?(U/=X,G/=X,F/=X):[U,G,F]=T,U*T[0]+G*T[1]+F*T[2]<0&&(U=-U,G=-G,F=-F);for(let K of P)e.push(...K),t.push(U,G,F),n.push(L);r.push(E,E+1,E+2,E,E+2,E+3)},i=P=>{for(let T of ma){let L=T.c.map(E=>E.map((R,z)=>R?P.max[z]:P.min[z]));o(L,T.n,P.part)}};for(let P of ua)i(P);for(let P of da)i(P);let a=Cn,s=1.08,c=.47,l=.69,u=-.55,d=.08,m=-.48,h=.01,f=[-c,a,u],p=[c,a,u],b=[-c,a,d],y=[c,a,d],g=[-l,s,m],x=[l,s,m],S=[-l,s,h],C=[l,s,h];o([p,x,C,y],[1,0,0],re.body),o([b,S,g,f],[-1,0,0],re.body),o([S,C,x,g],[0,1,0],re.body),o([f,p,y,b],[0,-1,0],re.body),o([y,C,S,b],[0,0,1],re.body),o([f,g,x,p],[0,0,-1],re.body);let M=10,k=8,O=[0,1.205,-.23],V=[.42,.115,.38],H=n.length;for(let P=0;P<=k;P++){let T=Math.PI*P/k,L=Math.cos(T),E=Math.sin(T);for(let R=0;R<=M;R++){let z=Math.PI*2*R/M,I=E*Math.cos(z),D=E*Math.sin(z);e.push(O[0]+V[0]*I,O[1]+V[1]*L,O[2]+V[2]*D);let B=I/V[0],U=L/V[1],G=D/V[2],F=Math.hypot(B,U,G)||1;B/=F,U/=F,G/=F,t.push(B,U,G),n.push(re.head)}}for(let P=0;P<k;P++)for(let T=0;T<M;T++){let L=H+P*(M+1)+T,E=L+M+1;r.push(L,E,L+1,L+1,E,E+1)}let N=new Float32Array(e),A=new Float32Array(t),v=new Float32Array(n),w=new Uint16Array(r);return{position:N,normal:A,part:v,index:w,vertexCount:n.length,indexCount:r.length}}function Po(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let d=u-l;for(let m=l;m<u;m++){let[h,f]=r(m),p=h-i(m),b=f-a(m);if(d>=2){let y=Math.max(l,m-1),g=Math.min(u-1,m+1),x=i(g)-i(y),S=a(g)-a(y),C=Math.hypot(x,S);if(C>1e-6){let M=-S/C,k=x/C;M*p+k*b<0&&(M=-M,k=-k),p=M,b=k}}o[m]=p===0&&b===0?0:Math.atan2(p,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var ke=.22;function Co(e,t){let n=ge[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var ha=.42;function fa(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of e)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),d=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(f,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((f-r)/l)));return Math.min(d-1,Math.max(0,Math.floor((p-o)/l)))*u+b};for(let f=0;f<t;f++){let p=h(e[f].x,e[f].y),b=m.get(p);b?b.push(f):m.set(p,[f])}for(let f=0;f<t;f++){let p=e[f],b=Math.min(u-1,Math.max(0,Math.floor((p.x-r)/l))),y=Math.min(d-1,Math.max(0,Math.floor((p.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let S=y-x;S<=y+x;S++)if(!(S<0||S>=d))for(let C=b-x;C<=b+x;C++){if(C<0||C>=u||x>1&&Math.abs(S-y)<x&&Math.abs(C-b)<x)continue;let M=m.get(S*u+C);if(M)for(let k of M){if(k===f)continue;let O=Math.hypot(e[k].x-p.x,e[k].y-p.y);O<g&&(g=O)}}if(Number.isFinite(g)&&g<=x*l)break}n[f]=g}return n}function pa(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-_t):0}function Ao(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),u=new Float32Array(a),d=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),f=new Float32Array(a*3),p=new Map,b=fa(e);for(let y=0;y<a;y++){let g=e[y],S=(n?.seatPitchU(y)??b[y])*_;u[y]=Number.isFinite(S)?Math.max(.06,Math.min(ke,S*ha)):ke,d[y]=So(Number.isFinite(S)?S:void 0);let C=po(g.glyph,{seatGlyph:i?.get(g.categoryKey)});m[y]=fo.indexOf(C),h[y]=g.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=g.x*_,s[y*3+1]=n?n.seatDeckY(y):pa(g),s[y*3+2]=g.y*_,c[y]=pt(t?t(g):"available");let M=ee(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[y*3]=M[0],l[y*3+1]=M[1],l[y*3+2]=M[2],g.accessibility?.length){let k=ee(uo(g.accessibility));k&&(f[y*3]=k[0],f[y*3+1]=k[1],f[y*3+2]=k[2])}p.set(g.id,y)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:f,idToIndex:p,iChairWidth:d,iGlyph:m,iPhysicalSeat:h,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var ba=64;function An(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=pt(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+ba){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var ya=.15,ga=.9,xa=1.76,va=.7,Ma=1.6;function Sa(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:pn,seatStates:{...$n},seatScale:1}}function Ro(e){let t=Sa();if(!e)return t;let n=ee(e.background);if(n){t.background={top:be(n,ga),bottom:be(n,xa)};let i={};for(let[a,s]of Object.entries(pn))i[a]=fe(s,n,ya);t.structure=i}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(Ma,Math.max(va,o))),t}function Io(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Eo(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function it(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function wa(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function To(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Rn(e,t){let n=1/0;for(let r of Eo(e)){let o=it(t,r.x,r.y);o<n&&(n=o)}for(let r of Eo(t)){let o=it(e,r.x,r.y);o<n&&(n=o)}return n}function Pa(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let d=Math.hypot(u.x-n,u.y-r);d>o&&(o=d,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,d)=>({p:u,i:d,t:(u.x-n)*a+(u.y-r)*s})).sort((u,d)=>u.t-d.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function In(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let x=g.x-n,S=g.y-r;o+=x*x,a+=S*S,i+=x*S,s+=x*x*x,c+=S*S*S,l+=x*S*S,u+=S*x*x}let d=o*a-i*i;if(Math.abs(d)<1e-9)return null;let m=(s+l)/2,h=(c+u)/2,f=(m*a-h*i)/d,p=(h*o-m*i)/d,b=f+n,y=p+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var Ca=.15;function Aa(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,S=0;for(let C of g.pts)x+=C.x,S+=C.y;return{x:x/g.pts.length,y:S/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,S=g.y-r;o+=x*x,i+=x*S,a+=S*S}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,d;Math.abs(i)>1e-12?(u=l-a,d=i):o>=a?(u=1,d=0):(u=0,d=1);let m=Math.hypot(u,d);if(!(m>1e-12))return null;u/=m,d/=m;let h=1/0,f=-1/0,p=[];for(let g of e){let x=1/0,S=-1/0;for(let C of g.pts){let M=C.x*u+C.y*d;M<x&&(x=M),M>S&&(S=M),M<h&&(h=M),M>f&&(f=M)}p.push(S-x)}let b=f-h;return b>1e-9?(p.sort((g,x)=>g-x),p[Math.min(p.length-1,Math.floor(p.length*.9))]/b<=Ra?{x:u,y:d}:null):null}var Ra=.35;function ko(e,t,n,r){let o=new Map;for(let b of n){let y=t[b],g=y.rowId||`__seat-${b}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:y.x,y:y.y}),x.idx.push(b)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,y]of o){let g=Pa(y.pts,y.idx),x=0;for(let S of g.pts)x+=Math.hypot(S.x-r.x,S.y-r.y);i.push({id:b,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(b=>wa(b.pts)),s=[];for(let b=0;b<i.length;b++){let y=1/0;for(let g=0;g<i.length;g++){if(b===g||To(a[b],a[g])>=y)continue;let x=Rn(i[b].pts,i[g].pts);x<y&&(y=x)}Number.isFinite(y)&&s.push(y)}s.sort((b,y)=>b-y);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let y=b+1;y<i.length;y++)To(a[b],a[y])>l||Rn(i[b].pts,i[y].pts)<=l&&(u[b].push(y),u[y].push(b));let d=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let y=d++,g=[b];for(i[b].blockId=y;g.length;){let x=g.pop();for(let S of u[x])i[S].blockId===-1&&(i[S].blockId=y,g.push(S))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let h=[];for(let b of i){if(b.pts.length<4)continue;let y=In(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||h.push({x:y.cx,y:y.cy}))}let f=h.length>=2?(()=>{let b=h.map(x=>x.x).sort((x,S)=>x-S),y=h.map(x=>x.y).sort((x,S)=>x-S),g=Math.floor(h.length/2);return{cx:b[g],cy:y[g]}})():null;if(f){let b=M=>Math.hypot(M.x-f.cx,M.y-f.cy),y=1/0,g=-1/0,x=[];for(let M of i){let k=1/0,O=-1/0;for(let V of M.pts){let H=b(V);H<k&&(k=H),H>O&&(O=H)}x.push(O-k),k<y&&(y=k),O>g&&(g=O)}let S=g-y;x.sort((M,k)=>M-k);let C=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(S>1e-9&&C/S<=Ca){let M=i.map(T=>{let L=0;for(let E of T.pts)L+=b(E);return{row:T,radius:L/T.pts.length}}),k=0,O=0;for(let T of M)k+=T.radius,O+=T.row.focalDistance;k/=M.length,O/=M.length;let V=0;for(let T of M)V+=(T.radius-k)*(T.row.focalDistance-O);if(V<0)for(let T of M)T.radius=-T.radius;let N=1/0;for(let T of M)T.radius<N&&(N=T.radius);M.sort((T,L)=>T.radius-L.radius);let A=-1,v=-1/0,w=S/Math.max(1,M.length)*.5,P=[];for(let T of M)T.radius-v>w&&(A++,v=T.radius),T.row.ordinal=A,T.row.blockDepth=T.radius-N,P.push(T.row);return{sectionId:e,rows:P,blockCount:d}}}let p=[];for(let[,b]of m){let y=Aa(b);if(y){let g=S=>{let C=0;for(let M of S.pts)C+=M.x*y.x+M.y*y.y;return C/S.pts.length};b.sort((S,C)=>g(S)-g(C)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let x=0;for(let S=0;S<b.length;S++)S>0&&(x+=Rn(b[S-1].pts,b[S].pts)),b[S].ordinal=S,b[S].blockDepth=x,p.push(b[S])}else{let g=1/0;for(let x of b)x.focalDistance<g&&(g=x.focalDistance);b.sort((x,S)=>x.focalDistance-S.focalDistance);for(let x=0;x<b.length;x++)b[x].ordinal=x,b[x].blockDepth=Math.max(0,b[x].focalDistance-g),p.push(b[x])}}return{sectionId:e,rows:p,blockCount:d}}var ol=Math.PI/180;function Lo(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Ia(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function Fo(e,t,n){return Lo(e,t)&&!(n??[]).some(r=>Lo(e,r)||Ia(e,r))}function Ea(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function Ta(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let h of e)n+=h.x,r+=h.y,o+=Math.hypot(h.x-t.x,h.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let h of e){let f=Math.hypot(h.x-n,h.y-r);f>s&&(s=f,a=h)}let c=a.x-n,l=a.y-r,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let d=[...e].sort((h,f)=>(h.x-n)*c+(h.y-r)*l-((f.x-n)*c+(f.y-r)*l)),m=0;for(let h of d){let f=Math.hypot(h.x-n,h.y-r);f>m&&(m=f)}return{pts:d,cx:n,cy:r,radius:m,depth:o}}function Do(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,d=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;d<0?d=0:d>1&&(d=1);let m=Math.hypot(t-(a.x+d*c),n-(a.y+d*l));m<o&&(o=m)}return o}var Ht=8;function ka(e,t,n){let r=new Array(Ht).fill(1/0),o=new Array(Ht).fill(-1);for(let u=0;u<e.length;u++){let d=e[u],m=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let h=0;h<Ht;h++)if(m<r[h]){for(let f=Ht-1;f>h;f--)r[f]=r[f-1],o[f]=o[f-1];r[h]=m,o[h]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let d=Do(e[u],t,n);for(let m=0;m<3;m++)if(d<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],a[h]=a[h-1];i[m]=d,a[m]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let d=a[u];if(d<0||i[u]>s)continue;let m=1/(i[u]*i[u]);c+=m*e[d].depth,l+=m}return l>0?c/l:e[a[0]].depth}function La(e){let t=(r,o)=>ka(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let l=Do(c,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function _o(e,t){let n=[];for(let r of e){let o=Ta(r.points,t);o&&n.push(o)}return n.length<2?Ea(t):(n.sort((r,o)=>r.depth-o.depth),La(n))}var kn=et(require("polygon-clipping"),1);var Go=et(require("earcut"),1);var Fa=.58,Oo=.01,ye=ke*1.5*Be,Da=.5,_a=.6;function Oa(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,u=c.y-s.y,d=Math.hypot(l,u);if(d<1e-9){r.push([0,0]);continue}l/=d,u/=d,r.push([-u,l])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Ba(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Bo=Math.PI/12;function Na(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Vo(e,t){if(!e.length||!(t>0))return[];let n=Na(e),r=(s,c,l,u)=>{let d=l-c;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let m=Math.max(1,Math.ceil(d/Bo)),h=t/Math.cos(d/m/2);for(let f=0;f<=m;f++){let p=c+d*f/m;u.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(n.length<3){let s=0,c=0;for(let h of n)s+=h.x,c+=h.y;s/=n.length||1,c/=n.length||1;let l=0;for(let h of n)l=Math.max(l,Math.hypot(h.x-s,h.y-c));let u=[],d=Math.max(3,Math.ceil(Math.PI*2/Bo)),m=(l+t)/Math.cos(Math.PI/d);for(let h=0;h<d;h++){let f=h/d*Math.PI*2;u.push({x:s+Math.cos(f)*m,y:c+Math.sin(f)*m})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return Yo(a)}function Ga(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));d<r&&(r=d)}return r}function Ut(e){let t=e.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let l of o.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let d=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let h=t[m],f=Math.hypot(u.x-h.cx,u.y-h.cy)-h.rad;if(f>=d&&f>=s)continue;let p=Ga(e[m].pts,u.x,u.y);p<d&&(d=p),e[m].depth<e[o].depth&&p<s&&(s=p,c=e[m].y)}Number.isFinite(d)&&d>0&&a.push(d)}a.sort((u,d)=>u-d);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function zo(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],d=u.x-r.x,m=u.y-r.y,h=Math.hypot(d,m)||1;d/=h,m/=h;let f=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*f,y:u.y-d*f},{x:u.x-m*f,y:u.y+d*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let d=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);d>1e-6&&(a+=d,s++)}let c=s>0?a/s:0,l=Ba(i,Math.max(c*_a,ye));return{pts:l,nrm:Oa(l,r),front:Math.max(n[t].pitch*Fa,ye),back:Math.max(n[t].pitch*Da,ye)}}var at=1.5,Ho=.3;function En(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let d=1;d<e.length-1;d++){let m=e[d],h=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);h>s&&(s=h,c=d)}if(s<=t||c<0)return[n,r];let l=En(e.slice(0,c+1),t),u=En(e.slice(c),t);return[...l.slice(0,-1),...u]}function Uo(e,t){if(e.length<4)return e;let n=En([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function jo(e,t,n){if(e.length<2)return[];let r=n??Ut(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let l=s.map(g=>zo(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+at),y:g.pts[x].y-g.nrm[x][1]*(g.front+at)}),d=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+at),y:g.pts[x].y+g.nrm[x][1]*(g.back+at)}),m=l[0],h=l[l.length-1],f=[];for(let g=0;g<m.pts.length;g++)f.push(u(m,g));for(let g of l)f.push(d(g,g.pts.length-1));for(let g=h.pts.length-1;g>=0;g--)f.push(d(h,g));for(let g=l.length-1;g>=0;g--)f.push(u(l[g],0));let p=Yo(f),b=1/0;for(let g of s)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(Qe(p))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return gt(p,x.x,x.y)})){i.push({outline:Uo(p,Ho),holes:[],topY:b});continue}for(let g of Va(l))i.push({outline:g,holes:[],topY:b})}return i}function Va(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+at,a=n.back+at;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];r.push([l.x-u[0]*i,l.y-u[1]*i]),o.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=kn.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(Uo(i,Ho))}return r}catch{return[]}}function Yo(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Tn=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!gt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function No(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],u=r[0];for(let d=1;d+1<r.length;d++){let m=r[d],h=r[d+1];e.tri([u.x*_,o,u.y*_],[m.x*_,o,m.y*_],[h.x*_,o,h.y*_],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=kn.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],d=[],m=[];for(let f=0;f<u.length-1;f++)d.push(u[f][0],u[f][1]),m.push([u[f][0],u[f][1]]);if(m.length<3)continue;let h=(0,Go.default)(d,void 0,2);for(let f=0;f<h.length;f+=3){let p=m[h[f]],b=m[h[f+1]],y=m[h[f+2]];e.tri([p[0]*_,o,p[1]*_],[b[0]*_,o,b[1]*_],[y[0]*_,o,y[1]*_],c,i)}}}function Xo(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Ut(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Tn([[...i]]):null,d=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let f=t[h];if(f.patch&&f.patch.length>=3){let C=[...f.patch],M=s[h].belowY??r;if(m(()=>{if(l&&u)No(e,l,u,C,f.y,o.tread);else{let k=C[0];for(let O=1;O+1<C.length;O++){let V=C[O],H=C[O+1];e.tri([k.x*_,f.y,k.y*_],[V.x*_,f.y,V.y*_],[H.x*_,f.y,H.y*_],c,o.tread)}}}),f.y>M+Oo){let k=0,O=0;for(let V of C)k+=V.x,O+=V.y;k/=C.length,O/=C.length,d(()=>{for(let V=0;V<C.length;V++){let H=C[V],N=C[(V+1)%C.length],A=N.x-H.x,v=N.y-H.y,w=Math.hypot(A,v);if(w<1e-6)continue;let P=v/w,T=-A/w;(H.x-k)*P+(H.y-O)*T<0&&(P=-P,T=-T);let L=[P,0,T],E=[H.x*_,f.y,H.y*_],R=[N.x*_,f.y,N.y*_],z=[H.x*_,M,H.y*_],I=[N.x*_,M,N.y*_];e.tri(E,R,I,L,o.riser),e.tri(E,I,z,L,o.riser)}})}continue}let p=zo(t,h,s,n);if(!p)continue;let{pts:b,nrm:y,front:g,back:x}=p,S=s[h].belowY??r;for(let C=0;C+1<b.length;C++){let M=b[C],k=b[C+1],O=y[C],V=y[C+1];if(Math.hypot(k.x-M.x,k.y-M.y)<1e-6||O[0]===0&&O[1]===0||V[0]===0&&V[1]===0)continue;let H=[(M.x-O[0]*g)*_,f.y,(M.y-O[1]*g)*_],N=[(k.x-V[0]*g)*_,f.y,(k.y-V[1]*g)*_],A=[(M.x+O[0]*x)*_,f.y,(M.y+O[1]*x)*_],v=[(k.x+V[0]*x)*_,f.y,(k.y+V[1]*x)*_];if(m(()=>{l&&u?No(e,l,u,[{x:M.x-O[0]*g,y:M.y-O[1]*g},{x:k.x-V[0]*g,y:k.y-V[1]*g},{x:k.x+V[0]*x,y:k.y+V[1]*x},{x:M.x+O[0]*x,y:M.y+O[1]*x}],f.y,o.tread):(e.tri(H,N,v,c,o.tread),e.tri(H,v,A,c,o.tread))}),f.y>S+Oo){let w=[H[0],S,H[2]],P=[N[0],S,N[2]],T=[-O[0],0,-O[1]];d(()=>{e.tri(H,N,P,T,o.riser),e.tri(H,P,w,T,o.riser)})}}}}function Wo(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function jt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Ln=et(require("polygon-clipping"),1);function za(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Ko(e,t){return e.filter(n=>n.type!=="shape"||za(n,t))}function Qo(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Ko(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Ko(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Ha={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function st(e){return Wo(e)??Ha}function qo(e,t){let n=Gt(e.outline,ye),r=st(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&jt(r,st(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=Ln.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function Zo(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=Ln.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Ua=.05,$o=.05,ja=.15,Fn=25;function Jo(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],u=new Set;for(let d=0;d<e.length;d+=1){let m=e[d];for(let h of m.objects){if(h.type==="table"&&u.add(h.id),h.type!=="section"||!h.outline||h.outline.length<3)continue;let f=Gt(h.outline,ye);c.set(h.id,{section:h,unit:m,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:h.id,floorIndex:d,box:st(f),section:h,unit:m,outline:f})}}for(let d=0;d<t.length;d++){let m=t[d];for(let h of l){if(n&&h.floorIndex!==n[d]||m.x<h.box.minX||m.x>h.box.maxX||m.y<h.box.minY||m.y>h.box.maxY||!Fo({x:m.x,y:m.y},h.outline,h.section.holes))continue;o[d]=h.id;let f=c.get(h.id);f.hasSeats=!0;let p=m.focalPoint??h.unit.focal,b=Math.hypot(m.x-p.x,m.y-p.y);b<f.frontU&&(f.frontU=b),f.seatIndices.push(d);let y=m.rowId||`__seat-${d}`,g=f.rows.get(y);g?g.push({x:m.x,y:m.y}):f.rows.set(y,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let h=yo(m.section,{floorBaseHeightM:m.unit.baseHeightM}),f=m.unit.baseHeightM,p=h.rake>0?Math.tan(h.rake*Math.PI/180):0,b=h.rake<=.01&&h.height<=f+.001,y=m.section.surfaceKind,g=y==="flat"?!0:y==="rakedRows"&&h.rake>.01?!1:b,x=m.hasSeats?ko(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},C=x.rows.length<2?_o([...m.rows.values()].map(L=>({points:L})),m.unit.focal):null,M=1/0;if(C){if(m.hasSeats)for(let L of m.rows.values())for(let E of L){let R=C.depthAt(E.x,E.y);R<M&&(M=R)}if(!m.hasSeats||!Number.isFinite(M)){M=1/0;for(let L of m.section.outline){let E=C.depthAt(L.x,L.y);E<M&&(M=E)}}}let k=f+Ua,O=Math.max(k,h.height),V=L=>{let E=Math.max(0,L-M)*we,R=Math.min(E*p,Fn);return Math.max(k,h.height+R)},H=L=>{let E=Math.max(0,L)*we,R=Math.min(E*p,Fn);return Math.max(k,h.height+R)},N=g?[]:x.rows.map(L=>({pts:L.pts,y:H(L.blockDepth),depth:L.blockDepth,blockId:L.blockId,...u.has(L.id)?{patch:Vo(L.pts,ye)}:{}})),A=N.length?N[0].y:O,v=N.map(L=>{let E=L.patch&&L.patch.length>=3?L.patch:L.pts,R=0,z=0;for(let B of E)R+=B.x,z+=B.y;let I=E.length||1;R/=I,z/=I;let D=0;for(let B of E){let U=Math.hypot(B.x-R,B.y-z);U>D&&(D=U)}return{cx:R,cy:z,rad:D}}),w=g?()=>O:N.length>=2?(L,E)=>{let R=1/0,z=A;for(let I=0;I<N.length;I++){let D=v[I];if(Math.hypot(L-D.cx,E-D.cy)-D.rad>=R)continue;let B=N[I].patch,U=B&&B.length>=3?gt(B,L,E)?0:it(B,L,E):it(N[I].pts,L,E);U<R&&(R=U,z=N[I].y)}return z}:(L,E)=>C?V(C.depthAt(L,E)):O,P=[0,1,0],T=N.length>=2||g?()=>P:(L,E)=>{if(!C)return P;let R=C.depthAt(L,E);if(R<=M)return P;let z=(R-M)*we;if(z*p>=Fn||h.height+z*p<=k)return P;let[I,D]=C.gradientAt(L,E);if(I===0&&D===0)return P;let B=1/Math.hypot(p,1);return[-I*p*B,B,-D*p*B]};if(!g)for(let L of x.rows){let E=H(L.blockDepth);for(let R of L.seatIndices)a[R]=E}for(let L of x.rows){let E=[];for(let B=1;B<L.pts.length;B++){let U=Math.hypot(L.pts[B].x-L.pts[B-1].x,L.pts[B].y-L.pts[B-1].y);U>1e-6&&E.push(U)}E.sort((B,U)=>B-U);let R=E.length?E[Math.floor(E.length/2)]:1/0,z=1/0,I=L.pts[Math.floor(L.pts.length/2)];if(I)for(let B of x.rows){if(B===L||B.blockId!==L.blockId)continue;let U=it(B.pts,I.x,I.y);U>1e-6&&U<z&&(z=U)}let D=Math.min(R,Math.max(z,R*.5));if(Number.isFinite(D)&&D>0)for(let B of L.seatIndices)s[B]=D}r.set(d,{sectionId:d,deckAt:w,normalAt:T,flat:g,bottomY:f,rowLevels:N,landingY:A})}for(let d=0;d<t.length;d++){let m=o[d],h=t[d];if(m){let p=a[d];i[d]=(p??r.get(m).deckAt(h.x,h.y))+ja;continue}let f=h.eyeHeightM;i[d]=Number.isFinite(f)?Math.max(0,f-_t):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var se={top:1,wallBottom:.5,bottomCap:.4};function Le(e,t){if(!e)return t;let n=be(ft(e,.4),.62);return fe(t,n,.72)}function er(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,l=0,u=0;for(let[d,m]of a){let h=ee(n.get(d));h&&(s+=h[0]*m,c+=h[1]*m,l+=h[2]*m,u+=m)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function tr(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var Il=Math.PI*2;function nr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var or=et(require("polygon-clipping"),1);function Ya(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Yt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=st(t),i=this.rings.filter((c,l)=>jt(o,this.boxes[l])&&Ya(n,this.levels[l])),a=[[r]];if(i.length)try{a=or.default.difference([r],...i).map(l=>l.map(u=>u.map(([d,m])=>[d,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,d])=>({x:u,y:d}));if(l.length>1){let u=l[0],d=l[l.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Xa(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)n=Math.min(n,d.x),r=Math.max(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(d=>{let m=d.x-a,h=d.y-s;return{x:a+m*l-h*u,y:s+m*u+h*l}})}function St(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Mt(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=Vt(n,r,e.width/2,e.height/2)}return t?Xa(t,e.rotation):null}function wt(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&nr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Wa=.08;function rr(e,t){let n=St(e),r=wt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let l=o;for(let u of t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&l<=u.topOffsetM+1e-6&&(l=u.topOffsetM+Wa);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Ne(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function ir(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Pt(e,t,n){return[Ne(e[0],e[1],t),Ne(e[0],e[1],n),Ne(e[3],e[2],n),Ne(e[3],e[2],t)]}function ar(e,t,n){return[Ne(e[0],e[3],t),Ne(e[1],e[2],t),Ne(e[1],e[2],n),Ne(e[0],e[3],n)]}function Fe(e,t,n,r,o,i){ce(e,t,void 0,()=>n,r,o,i,se)}var Dn=2.4,Ka=.75,Qa=.15;function Ct(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,d])=>({x:t.x+u*a-d*s,y:t.y+u*s+d*a}))}function sr(e,t,n,r,o){let i=Ct(t);i&&ce(e,i,void 0,()=>n+Dn,n,Le(r,o.boothTop),o.boothWall,se)}function _n(e){if(e.shape==="round"){let u=e.radius;return u?Vt(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,d])=>({x:o.x+u*a-d*s,y:o.y+u*s+d*a}))}function cr(e,t,n,r,o){let i=_n(t);i&&ce(e,i,void 0,()=>n+Ka,n,Le(r,o.tableTop),o.tableWall,se)}function lr(e,t,n,r,o,i,a){let s=St(t);if(!s)return;let c=t.role==="stage",l=wt(t),u=n+r;if(c&&a){let p=1/0,b=-1/0,y=1/0,g=-1/0;for(let x of s)x.x<p&&(p=x.x),x.x>b&&(b=x.x),x.y<y&&(y=x.y),x.y>g&&(g=x.y);a.push({cx:(p+b)/2*_,cz:(y+g)/2*_,y:u,halfX:Math.max((b-p)/2*_,.5),halfZ:Math.max((g-y)/2*_,.5)})}let d=ee(t.fill),m=c&&d?fe(o.stageTop,be(ft(d,.18),.9),.9):Le(d,c?o.stageTop:o.decorTop),h=t.role==="screen"?d:null,f=c?d?fe(o.stageWall,be(d,.58),.82):o.stageWall:t.role==="screen"?h?fe(be(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Le(ee(t.fill),o.decorWall);if(l.kind==="portal"&&s.length===4){let p=ir(s);Fe(e,Pt(p,0,.16),u,n,m,f),Fe(e,Pt(p,.84,1),u,n,m,f),Fe(e,p,u,Math.max(n,u-.35),m,f);return}if(l.kind==="suite"&&s.length===4){let p=s.map((g,x)=>{let S=s[(x+1)%4],C=(g.x+S.x)/2,M=(g.y+S.y)/2;return Math.hypot(C-i.x,M-i.y)}),b=p.indexOf(Math.min(...p)),y=[0,1,2,3].map(g=>s[(b+g)%4]);Fe(e,Pt(y,0,.08),u,n,m,f),Fe(e,Pt(y,.92,1),u,n,m,f),Fe(e,ar(y,.88,1),u,n,m,f),Fe(e,y,u,Math.max(n,u-.18),m,f);return}Fe(e,s,u,n,m,f)}function On(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=r/2,d=o/2;return[[-u,-d],[u,-d],[u,d],[-u,d]].map(([m,h])=>({x:i+m*c-h*l,y:a+m*l+h*c}))}function qa(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ee(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=ee(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>fe(s,c,1/(l+1)),a[0]):null}function ur(e,t,n,r){if(t.layer==="foreground")return;let o=On(t);if(!o)return;let i=n+Qa,a=Le(qa(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=fe(r.ground,a,s)),ce(e,o,void 0,()=>i,n,a,fe(a,r.decorWall,.5),se)}function dr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Le(r,o.gaTop);ce(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,se)}var Za=Math.PI/180,$=96,$a=6,Ja=60,es=150,mr=.2,ts=.35;function ns(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Za;return n<0?n+360:n}function Xt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function Wt(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=e[l],s++}o[i]=a/s}return o}function hr(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let h of m.rows){for(let f of h.pts)o+=f.x,i+=f.y,a++;if(h.pts.length>=4){let f=In(h.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=Xt(r.map(y=>y.x)),h=Xt(r.map(y=>y.y)),f=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let S=Math.hypot(x.x-s.x,x.y-s.y);S>f&&(f=S)}let p=0,b=f*.2;for(let y of n)for(let g of y.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-h)<b&&p++;Math.hypot(m-s.x,h-s.y)<=f&&p/a<.01&&(c={x:m,y:h})}let l=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of m.rows)for(let p of f.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),y=Math.min($-1,Math.floor(ns(c,p)/(360/$)));h.samples.push({r:b,bin:y,levelM:f.levelM}),b<h.rMin&&(h.rMin=b),b>h.rMax&&(h.rMax=b)}h.samples.length&&l.push(h)}if(!l.length)return null;l.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let u=[];for(let m of l){let h=!1;for(let f of u){let p=Math.min(m.rMax,f.rMax)-Math.max(m.rMin,f.rMin),b=Math.min(m.rMax-m.rMin,f.rMax-f.rMin);if(b>1e-9&&p>=ts*b){f.members.push(m),f.rMin=Math.min(f.rMin,m.rMin),f.rMax=Math.max(f.rMax,m.rMax),h=!0;break}}h||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let d=[];for(let m of u){let h=new Array($).fill(null);for(let v of m.members)for(let w of v.samples){let P=h[w.bin];P||(P={samples:[]},h[w.bin]=P),P.samples.push({r:w.r,levelM:w.levelM})}let f=h.map(v=>!!v);if(!f.filter(Boolean).length)continue;let b=[],y=[];for(let v of h){if(!v)continue;let w=1/0,P=-1/0;for(let T of v.samples)T.r<w&&(w=T.r),T.r>P&&(P=T.r);b.push(w),y.push(P)}let g=Xt(b),x=Xt(y);if(!(g>=mr*x)||!(x>0))continue;let S=[...b].sort((v,w)=>v-w);if(!(S[Math.floor(S.length*.1)]>=mr*x))continue;let M=h.map(v=>{if(!v)return null;let w=[...v.samples].sort((D,B)=>D.r-B.r),P=w[0].r,T=w[w.length-1].r,L=w[0].levelM,E=-1/0;for(let D of w)D.levelM>E&&(E=D.levelM);let R=[];for(let D of w){let B={r:D.r,l:D.levelM};for(;R.length&&Math.abs(R[R.length-1].r-B.r)<1e-9;){if(R[R.length-1].l<=B.l){B.skip=!0;break}R.pop()}if(!B.skip){for(;R.length>=2;){let U=R[R.length-2],G=R[R.length-1];if((G.r-U.r)*(B.l-U.l)-(G.l-U.l)*(B.r-U.r)<=0)R.pop();else break}R.push(B)}}let z=R.map(D=>D.r),I=R.map(D=>D.l);return{inner:P,outer:T,front:L,top:E,profile:{rs:z,ls:I}}}),k=f.slice();for(let v=0;v<$;v++){if(k[v])continue;let w=-1,P=-1,T=0;for(let F=1;F<=$;F++){let X=(v-F+$*2)%$;if(k[X]){w=X;break}}for(let F=1;F<=$;F++){let X=(v+F)%$;if(k[X]){P=X,T=F;break}}if(w<0||P<0)continue;let L=0;for(let F=1;F<=$;F++){let X=(v-F+$*2)%$;if(f[X]){L=F;break}}if(L-1+T>$a)continue;let R=M[w],z=M[P],I=L/(L+T),D=R.inner+(z.inner-R.inner)*I,B=R.outer+(z.outer-R.outer)*I,U=R.front+(z.front-R.front)*I,G=R.top+(z.top-R.top)*I;M[v]={inner:D,outer:B,front:U,top:G,profile:{rs:[D,B],ls:[U,G]}}}for(let v=0;v<$;v++)M[v]&&(k[v]=!0);let O=360/$,V=[],H=k.filter(Boolean).length,N=[];if(H===$)N.push({start:0,len:$});else{let v=0;for(;k[v];)v=(v+1)%$;let w=-1;for(let P=0;P<=$;P++){let T=(v+P)%$,L=P<$&&k[T];if(L&&w<0)w=T;else if(!L&&w>=0){let E=(T-w+$)%$||$;N.push({start:w,len:E}),w=-1}}}for(let v of N){if(v.len*O<Ja&&v.len<$)continue;let w=v.len===$,P=new Float64Array(v.len),T=new Float64Array(v.len),L=new Float64Array(v.len),E=new Float64Array(v.len),R=[];for(let F=0;F<v.len;F++){let X=M[(v.start+F)%$];P[F]=X.inner,T[F]=X.outer,L[F]=X.front,E[F]=X.top,R.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let z=Wt(P,w),I=Wt(T,w),D=Wt(L,w),B=Wt(E,w);for(let F=0;F<v.len;F++)z[F]>P[F]&&(z[F]=P[F]),I[F]<T[F]&&(I[F]=T[F]),z[F]>I[F]-1e-6&&(z[F]=Math.max(0,I[F]-1e-6)),B[F]<D[F]&&(B[F]=D[F]);let U={startBin:v.start,binCount:v.len,closed:w,innerR:z,outerR:I,frontLevelM:D,topLevelM:B,profiles:R},G=(F,X,K)=>{let J=R[F],Z=J.rs,q=J.ls;if(X<=Z[0]){q[0]>K&&(q[0]=K);return}if(X>=Z[Z.length-1]){q[q.length-1]>K&&(q[q.length-1]=K);return}for(let te=0;te+1<Z.length;te++)if(X<=Z[te+1]){q[te]>K&&(q[te]=K),q[te+1]>K&&(q[te+1]=K);return}};for(let F=0;F<v.len;F++){let X=h[(v.start+F)%$];if(X)for(let K of X.samples){G(F,K.r,K.levelM);let J=w?(F-1+v.len)%v.len:F-1,Z=w?(F+1)%v.len:F+1;J>=0&&G(J,K.r,K.levelM),Z<v.len&&G(Z,K.r,K.levelM)}}V.push(U)}V.reduce((v,w)=>v+w.binCount*O,0)<es||d.push({arcs:V,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:g,outerRMedian:x})}if(!d.length)return null;if(d.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=d[d.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:$,binStepDeg:360/$,rings:d}}function fr(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=u=>{let d=t.profiles[u],m=d.rs,h=d.ls;if(r<=m[0])return h[0];if(r>=m[m.length-1])return h[h.length-1];for(let f=0;f+1<m.length;f++)if(r<=m[f+1]){let p=m[f+1]-m[f],b=p>1e-9?(r-m[f])/p:0;return h[f]+(h[f+1]-h[f])*b}return h[h.length-1]};return l(a)*(1-c)+l(s)*c}var os=.25,rs=1.2,is=.6,as=.45,ss=2.3,cs=Math.PI/180;function Ze(e,t,n){let r=n*cs;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function ls(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var us=24;function ds(e,t,n,r,o,i,a,s){let c=n.binCount,l=us,u=we,d=i+.02,m=[];for(let A=0;A<c;A++){let v=(n.startBin+A+.5)*t.binStepDeg,w=new Float64Array(l+1);for(let P=0;P<=l;P++){let T=r[A]+(o[A]-r[A])*P/l;w[P]=Math.max(d,fr(t,n,v,T)-os)}m.push(w)}let h=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],p=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],b=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(A,v)=>{let w=(n.startBin+A+.5)*t.binStepDeg,P=r[A]+(o[A]-r[A])*v/l,T=Ze(t.centre,P,w);return[T.x*u,m[A][v],T.y*u]};{let A=Math.tan(12*Math.PI/180);for(let v=0;v<6;v++){let w=!1;for(let T=0;T<c;T++)for(let L=l-1;L>=0;L--)m[T][L]>m[T][L+1]&&(m[T][L]=m[T][L+1],w=!0);let P=n.closed?c:c-1;for(let T=0;T<P;T++){let L=(T+1)%c;for(let E=0;E<=l;E++){let R=m[L][E]-m[T][E];if(Math.abs(R)>1)continue;let z=r[T]+(o[T]-r[T])*E/l,I=r[L]+(o[L]-r[L])*E/l,D=Ze(t.centre,z,(n.startBin+T+.5)*t.binStepDeg),B=Ze(t.centre,I,(n.startBin+L+.5)*t.binStepDeg),U=A*Math.hypot(B.x-D.x,B.y-D.y)*u;R>U?(m[L][E]=m[T][E]+U,w=!0):-R>U&&(m[T][E]=m[L][E]+U,w=!0)}}if(!w)break}}let g=1,x=(A,v)=>{for(let w=0;w<=l;w+=4)if(Math.abs(m[A][w]-m[v][w])>g)return!0;return Math.abs(m[A][l]-m[v][l])>g},S=Math.tan(38*Math.PI/180),C=A=>(o[A]-r[A])/l*u,M=(A,v)=>m[A][v+1]-m[A][v]>S*Math.max(1e-6,C(A)),k=(A,v)=>{let w=n.closed?(A-1+c)%c:Math.max(0,A-1),P=n.closed?(A+1)%c:Math.min(c-1,A+1);Math.abs(m[w][v]-m[A][v])>g&&(w=A),Math.abs(m[P][v]-m[A][v])>g&&(P=A);let T=Math.max(0,v-1),L=Math.min(l,v+1);T<v&&M(A,T)&&(T=v),L>v&&M(A,v)&&(L=v);let E=y(w,v),R=y(P,v),z=y(A,T),I=y(A,L),D=R[0]-E[0],B=R[1]-E[1],U=R[2]-E[2],G=I[0]-z[0],F=I[1]-z[1],X=I[2]-z[2],K=B*X-U*F,J=U*G-D*X,Z=D*F-B*G,q=Math.hypot(K,J,Z);return q>1e-12?(K/=q,J/=q,Z/=q,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},O=(A,v)=>{let w=[A[0],i,A[2]],P=[v[0],i,v[2]],T=v[0]-A[0],L=v[2]-A[2],E=Math.hypot(T,L);if(!(E>1e-12))return;let R=[L/E,0,-T/E];e.tri(A,v,P,R,p,p,b),e.tri(A,P,w,R,p,b,b)},V=.05*Be,H=A=>o[A]-r[A]<V,N=n.closed?c:c-1;for(let A=0;A<N;A++){let v=(A+1)%c;if(H(A)||H(v))continue;if(x(A,v)){let R=(n.startBin+A+1)*t.binStepDeg,z=(F,X)=>{let K=(r[A]+r[v])/2,J=(o[A]+o[v])/2,Z=K+(J-K)*X/l,q=Ze(t.centre,Z,R);return[q.x*u,m[F][X],q.y*u]};for(let F=0;F<l;F++){let X=y(A,F),K=y(A,F+1),J=z(A,F),Z=z(A,F+1),q=k(A,F),te=k(A,F+1);e.triN(X,J,Z,q,q,te,h),e.triN(X,Z,K,q,te,te,h);let Ue=y(v,F),je=y(v,F+1),Re=z(v,F),Ie=z(v,F+1),Ee=k(v,F),xe=k(v,F+1);e.triN(Re,Ue,je,Ee,Ee,xe,h),e.triN(Re,je,Ie,Ee,xe,xe,h);let ve=z(A,F),ae=z(A,F+1),Je=z(v,F+1),De=z(v,F),Te=ae[0]-ve[0],Ye=ae[2]-ve[2],dt=Math.hypot(Te,Ye);if(dt>1e-12){let me=[Ye/dt,0,-Te/dt];e.tri(ve,ae,Je,me,p),e.tri(ve,Je,De,me,p)}}let I=y(A,0),D=y(v,0),B=y(v,l),U=y(A,l),G=F=>[F[0],i,F[2]];e.tri(G(I),G(B),G(D),[0,-1,0],f),e.tri(G(I),G(U),G(B),[0,-1,0],f),O(I,D),O(U,B);continue}for(let R=0;R<l;R++){let z=k(A,R),I=k(v,R),D=k(v,R+1),B=k(A,R+1);if(M(A,R)||M(v,R)){let K=(ae,Je)=>{let De=(n.startBin+ae+.5)*t.binStepDeg,Te=r[ae]+(o[ae]-r[ae])*(R+.5)/l,Ye=Ze(t.centre,Te,De);return[Ye.x*u,Je,Ye.y*u]},J=y(A,R),Z=y(v,R),q=K(A,m[A][R]),te=K(v,m[v][R]);e.triN(J,Z,te,z,I,I,h),e.triN(J,te,q,z,I,z,h);let Ue=y(v,R+1),je=y(A,R+1),Re=K(A,m[A][R+1]),Ie=K(v,m[v][R+1]);e.triN(Re,Ie,Ue,B,D,D,h),e.triN(Re,Ue,je,B,D,B,h);let Ee=te[0]-q[0],xe=te[2]-q[2],ve=Math.hypot(Ee,xe);if(ve>1e-12){let ae=[-xe/ve,0,Ee/ve];e.tri(q,te,Ie,ae,p),e.tri(q,Ie,Re,ae,p)}continue}let U=y(A,R),G=y(v,R),F=y(v,R+1),X=y(A,R+1);e.triN(U,G,F,z,I,D,h),e.triN(U,F,X,z,D,B,h)}let w=y(A,0),P=y(v,0),T=y(v,l),L=y(A,l),E=R=>[R[0],i,R[2]];e.tri(E(w),E(T),E(P),[0,-1,0],f),e.tri(E(w),E(L),E(T),[0,-1,0],f),O(w,P),O(L,T)}if(!n.closed)for(let A of[0,c-1])for(let v=0;v<l;v++)O(y(A,v),y(A,v+1))}function pr(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let d of u.arcs){let m=new Float64Array(d.binCount),h=new Float64Array(d.binCount);for(let p=0;p<d.binCount;p++){let b=(d.startBin+p)%t.binCount,y=Math.max(0,d.innerR[p]-ye);m[p]=Math.max(y,a[b]+.001),h[p]=Math.max(m[p]+.001,d.outerR[p]+ye)}let f=0;for(let p=0;p<d.binCount;p++){let b=d.topLevelM[p]-r;b>f&&(f=b)}f>=rs&&ds(e,t,d,m,h,r,o,i);for(let p=0;p<d.binCount;p++){let b=(d.startBin+p)%t.binCount;h[p]>a[b]&&(a[b]=h[p])}}if(ls(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=is*Be,l=as*Be;for(let u of s.arcs){let d=[],m=[];for(let p=0;p<u.binCount;p++){let b=(u.startBin+p+.5)*t.binStepDeg,y=u.outerR[p]+ye+c;d.push(Ze(t.centre,y,b)),m.push(Ze(t.centre,y+l,b))}let h=-1/0;for(let p=0;p<u.binCount;p++)u.topLevelM[p]>h&&(h=u.topLevelM[p]);let f=()=>h+ss;u.closed?ce(e,m,[d.slice().reverse()],f,r,o.shellTop,o.shellWall,i):ce(e,[...m,...d.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function br(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Le(r,s.tierTop);if(!o)return;let u=b=>o.deckAt(b.x,b.y),d=qo(t,a),m=d[0]??t.outline;if(o.rowLevels.length>=2){let b=Ut(o.rowLevels),y=Zo(jo(o.rowLevels,n.focal,b),d),g=()=>[0,1,0];for(let S of y){let C=Math.max(c,S.topY-.02);for(let M of i.subtract(S.outline,C))ce(e,M,S.holes,()=>C,c,l,s.tierWall,se,void 0,g)}y.length||ce(e,m,t.holes,()=>o.landingY,c,l,s.tierWall,se);let x={tread:[l[0]*se.top,l[1]*se.top,l[2]*se.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let S of d.length?d:[m])Xo(e,o.rowLevels,n.focal,o.landingY,x,S,b);return}let h=o.flat?1/0:$o,f=b=>o.normalAt(b.x,b.y),p=o.flat?o.landingY:void 0;for(let b of i.subtract(m,p))ce(e,b,t.holes,u,c,l,s.tierWall,se,h,f)}function ms(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a],u=o.get(s);u||(u=new Map,o.set(s,u));let d=l.rowId||`__seat-${a}`,m=u.get(d);m||(m={pts:[],levelM:0,n:0},u.set(d,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function yr(e,t,n,r,o){let i=ms(t,n,r);if(!i.length)return;let a=hr(i,t.focal);a&&(e.setMaterial(0),pr(e,a,{bottomY:t.baseHeightM,colors:{bandTop:be(o.tierTop,.8),bandWall:o.tierWall,shellTop:be(o.tierWall,1.15),shellWall:o.tierWall},ao:se,shapes:t.objects.filter(s=>s.type==="shape")}))}function gr(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function xr(e,t){let n=[...e].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var hs=1.15,fs=3.25,ps=4.5,bs=.85,ys=.5,gs=.26;function vr(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=hs&&a.add("zone"),o<=(i?fs:ps)&&(a.add("section"),a.add("ga")),o<=bs&&(a.add("annotation"),a.add("booth")),o<=ys&&a.add("row"),o<=gs&&a.add("seat"),a}function Ge(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],u=o[2]*i+o[6]*a+o[10]*s+o[14],d=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(d>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/d,h=l/d,f=u/d,p=m>=-1.05&&m<=1.05&&h>=-1.05&&h<=1.05&&f<=1;return{x:(m*.5+.5)*n,y:(1-(h*.5+.5))*r,depth:f,visible:p}}function Mr(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(Bn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var xs=6;function Bn(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+xs):n;return o<a&&i<r}function Sr(e,t,n){return e.length*t*.58+(n?14:0)}var Nn={row:8,seat:14};function wr(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function Gn(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(Bn(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(Bn(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var vs=6,Ms=2.2,Pr=.1,Ss=.3,ws=1.8,Ps=.9,Cs=.55,As=6e3;function Cr(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let d of u.objects)d.type==="section"&&d.zone&&c.set(d.id,d.zone);let l=new Map;for(let u=0;u<r.length;u++){let d=r[u],m=o.seatOwner[u],h=d.zoneId??(m?c.get(m):void 0);if(!h)continue;let f=l.get(h);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(h,f)),f.n++,d.x<f.minX&&(f.minX=d.x),d.y<f.minY&&(f.minY=d.y),d.x>f.maxX&&(f.maxX=d.x),d.y>f.maxY&&(f.maxY=d.y),f.sumY+=o.seatDeckY(u)}for(let u of a){let d=l.get(u.id),m=[];for(let[h,f]of c)f===u.id&&m.push(h);if(!d||d.n===0){s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]});continue}s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:m,seatCount:d.n,center:[(d.minX+d.maxX)/2*_,d.sumY/d.n,(d.minY+d.maxY)/2*_],radius:.5*Math.hypot((d.maxX-d.minX)*_,(d.maxY-d.minY)*_)||1,focalWorld:[(u.focalPoint??i).x*_,1.5,(u.focalPoint??i).y*_]})}}return s}function Ar(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],d=[];for(let m of s)m.seatCount!==0&&l.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+vs,m.center[2]],color:t.zones?.find(h=>h.id===m.id)?.color});{let m=new Map,h=new Map;for(let f=0;f<r.length;f++){let p=o.seatOwner[f];if(!p)continue;let b=m.get(p);b||(b={n:0,x:0,y:0,deck:0},m.set(p,b)),b.n++,b.x+=r[f].x,b.y+=r[f].y,b.deck+=o.seatDeckY(f);let y=h.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,y)),r[f].x<y.minX&&(y.minX=r[f].x),r[f].x>y.maxX&&(y.maxX=r[f].x),r[f].y<y.minY&&(y.minY=r[f].y),r[f].y>y.maxY&&(y.maxY=r[f].y)}for(let f of n)for(let p of f.objects){if(p.type!=="section")continue;let b=m.get(p.id);if(!b||b.n===0)continue;let y=h.get(p.id),g=[b.x/b.n*_,b.deck/b.n,b.y/b.n*_],x=p.displayLabel||p.label||p.id;u.push({id:p.id,floorIndex:f.index,label:x,seatCount:b.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*_),focalWorld:[f.focal.x*_,f.baseHeightM+1.5,f.focal.y*_]});let S=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&S===x.trim().toLocaleLowerCase()||l.push({id:`section:${p.id}`,kind:"section",text:x,anchor:[g[0],g[1]+Ms,g[2]],floorIndex:f.index})}}{for(let f of n)for(let p of f.objects){if(p.type!=="gaArea")continue;let b=yt(p.points);if(!b)continue;let y=p.displayLabel||p.label||p.id;l.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${y} \xB7 ${p.capacity.toLocaleString()}`:y,anchor:[b.x*_,f.baseHeightM+ws,b.y*_],floorIndex:f.index})}let m=new Map;for(let f=0;f<r.length;f++){let p=r[f],b=Math.hypot(p.x-c.x,p.y-c.y),y=m.get(p.rowId);(!y||b>y.far)&&m.set(p.rowId,{seat:p,index:f,far:b})}for(let[f,p]of m){let b=p.seat.label?p.seat.label.lastIndexOf("-"):-1,y=b>0?p.seat.label.slice(0,b):f;y&&l.push({id:`row:${f}`,kind:"row",text:y,anchor:[p.seat.x*_,o.seatDeckY(p.index)+Ps,p.seat.y*_],floorIndex:a[p.index]})}let h=new Map;for(let f=0;f<r.length;f++){let p=r[f],b=p.label?p.label.lastIndexOf("-"):-1,y=h.get(p.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:b>0?p.label.slice(0,b):p.rowId,sectionId:p.sectionId},h.set(p.rowId,y));let g=f*3,x=i.iPosition[g],S=i.iPosition[g+1],C=i.iPosition[g+2];y.n++,y.x+=x,y.y+=S,y.z+=C,y.minX=Math.min(y.minX,x),y.maxX=Math.max(y.maxX,x),y.minZ=Math.min(y.minZ,C),y.maxZ=Math.max(y.maxZ,C)}for(let[f,p]of h)d.push({id:f,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=As)for(let f=0;f<r.length;f++){let p=r[f],b=p.displayLabel||p.label;b&&l.push({id:`seat:${p.id}`,kind:"seat",text:b,anchor:[p.x*_,o.seatDeckY(f)+Cs,p.y*_],floorIndex:a[f]})}}for(let m of n)for(let h of m.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let f=St(h),p=f?yt(f):null;if(!p||!h.label)continue;l.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*_,m.baseHeightM+wt(h).heightM+Pr,p.y*_],color:h.fill,floorIndex:m.index})}else if(h.type==="text"){if(!h.text)continue;l.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*_,m.baseHeightM+Pr,h.position.y*_],color:h.color,rotation:h.rotation,floorIndex:m.index})}else if(h.type==="booth"){let f=Ct(h);if(!f)continue;let p=yt(f);if(!p)continue;l.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*_,m.baseHeightM+Dn+Ss,p.y*_],floorIndex:m.index})}return{labels:l,sections:u,rows:d}}function Rr(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function Ir(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),f=m*3,p=l[h];p.minX=Math.min(p.minX,i.position[f]),p.minY=Math.min(p.minY,i.position[f+1]),p.minZ=Math.min(p.minZ,i.position[f+2]),p.maxX=Math.max(p.maxX,i.position[f]),p.maxY=Math.max(p.maxY,i.position[f+1]),p.maxZ=Math.max(p.maxZ,i.position[f+2])}let u=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&u.set(h.id,m);let d=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let h=o.seatOwner[m],f=(h!==null?u.get(h):void 0)??a[m];if(f===void 0)continue;let p=d[f],b=r[m];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let y=o.seatDeckY(m);p.sumX+=b.x*_,p.sumDeck+=y,p.sumZ+=b.y*_,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[m]=f}for(let m=0;m<n.length;m++){let h=d[m],f=t.floors?.[m],p=l[m],b=Math.min(h.n?h.minX*_:n[m].focal.x*_-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(h.n?h.maxX*_:n[m].focal.x*_+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(h.n?h.minY*_:n[m].focal.y*_-1,Number.isFinite(p.minZ)?p.minZ:1/0),x=Math.max(h.n?h.maxY*_:n[m].focal.y*_+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),S=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),C=Math.max(h.n?Math.max(h.maxDeck,S+.5):S+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[h.n?h.sumX/h.n:(b+y)/2,h.n?h.sumDeck/h.n:(S+C)/2,h.n?h.sumZ/h.n:(g+x)/2],k=Math.max(1,.5*Math.hypot(y-b,C-S,x-g));c.push({index:m,id:f?.id??`floor-${m}`,label:f?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:M,radius:k,box:{min:[b,S,g],max:[y,C,x]},focalWorld:[n[m].focal.x*_,n[m].baseHeightM+1.5,n[m].focal.y*_]})}}return c}function Vn(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=Ct(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=_n(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=On(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Er(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Mt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ce(e,s,void 0,()=>0,-.4,i.ground,i.ground,se)}else{let a=t.reduce((h,f)=>f.baseHeightM<h.baseHeightM?f:h);e.setFloor(a.index);let s=n.filter((h,f)=>r[f]===a.index),c=Vn([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),d=Mt(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),m=a.baseHeightM-.03;ce(e,d,void 0,()=>m,m-.22,i.ground,i.ground,se)}}function Tr(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,d=-1/0,m=(p,b,y)=>{a=Math.min(a,p),l=Math.max(l,p),s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),d=Math.max(d,y)};for(let p=0;p<e.position.length;p+=3)m(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let b=p*3,y=t.iPosition[b],g=t.iPosition[b+1],x=t.iPosition[b+2],S=Math.max(.35,t.iMaxRadius[p]??.35);m(y-S,g,x-S),m(y+S,g+1.6,x+S)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,d=o+i);let h=[(a+l)/2,(s+u)/2,(c+d)/2],f=Math.max(1,.5*Math.hypot(l-a,u-s,d-c));return{center:h,radius:f,minY:s,maxY:u}}function kr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let S=0;S<e.count;S++){let C=S*3,M=e.iPosition[C],k=e.iPosition[C+2];M<a&&(a=M),M>c&&(c=M),k<s&&(s=k),k>l&&(l=k)}for(let S of t)a=Math.min(a,S.cx-S.halfX),c=Math.max(c,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),l=Math.max(l,S.cz+S.halfZ);let u=n.minX*_,d=n.maxX*_,m=n.minY*_,h=n.maxY*_,f=u,p=d,b=m,y=h;if(Number.isFinite(a)){let S=Math.max(2,.06*Math.hypot(c-a,l-s));f=Math.max(u,a-S),p=Math.min(d,c+S),b=Math.max(m,s-S),y=Math.min(h,l+S)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,g,b],max:[p,x,y]}}function ct(e){let{doc:t}=e,n=Ro(t.theme),r=n.structure,o=Qo(t,e.eventConfigurationId??t.eventConfigurationId),i=e.seats,a=new Nt,s=new Map;for(let v of o)for(let w of v.objects)s.set(w.id,v.index),w.type==="section"&&s.set(w.logicalSectionId??w.id,v.index);let c=i.map(v=>s.get(v.sectionId??"")??s.get(v.rowId??"")??0),l=Vn(o,i);Er(a,o,i,c,l,r);let u=er(t,i),d=new Map,m=new Map;for(let v of t.categories??[])d.set(v.key,v.color),v.seatGlyph&&m.set(v.key,v.seatGlyph);let h=[],f=Jo(o,i,c),p=new Float32Array(i.length);for(let v=0;v<o.length;v++){let w=o[v];a.setFloor(v);let P=new Yt,T=[],L=w.objects.filter(E=>E.type==="section"&&!!E.outline&&E.outline.length>=3);for(let E of w.objects)E.type==="section"?br(a,E,w,tr(E,u),f.bySection.get(E.id),P,L,r):E.type==="shape"?(a.setMaterial(E.role==="screen"?1:0),lr(a,E,w.baseHeightM,rr(E,T),r,w.focal,h),a.setMaterial(0)):E.type==="gaArea"?dr(a,E,w.baseHeightM,ee(d.get(E.categoryKey)),r):E.type==="booth"?sr(a,E,w.baseHeightM,ee(d.get(E.categoryKey)),r):E.type==="table"?cr(a,E,w.baseHeightM,ee(d.get(E.categoryKey)),r):E.type==="decorImage"&&ur(a,E,w.baseHeightM,r);yr(a,w,i,f,r)}let b=o.length>1?{x:o.reduce((v,w)=>v+w.focal.x,0)/o.length,y:o.reduce((v,w)=>v+w.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},y=Mo([a.build()]),g=Ao(i,e.initialState,f,p,d,m),x=Cr({doc:t,units:o,seats:i,surfaces:f,focal:b}),{labels:S,sections:C,rows:M}=Ar({doc:t,units:o,seats:i,surfaces:f,seatData:g,hintedSeatFloor:c,zones:x,focal:b}),k=Ir({doc:t,units:o,seats:i,surfaces:f,solids:y,hintedSeatFloor:c,seatFloor:p});Rr(S,k),g.iYaw=Po(g.iPosition,i.length,v=>i[v].rowId,v=>{let w=o[p[v]]?.focal??b;return[w.x*_,w.y*_]});let O=(l.minX+l.maxX)/2*_,V=(l.minY+l.maxY)/2*_,H=.5*Math.hypot((l.maxX-l.minX)*_,(l.maxY-l.minY)*_)||10,N=Tr(y,g,{cx:O,cz:V,radius:H}),A=kr(g,h,l,N.minY,N.maxY,H);return{solids:y,seats:g,bounds:{center:[(A.min[0]+A.max[0])/2,(A.min[1]+A.max[1])/2,(A.min[2]+A.max[2])/2],radius:H,groundY:0,box:A},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:Io(n,ge),theme:n,seatCount:i.length,focalWorld:[b.x*_,1.5,b.y*_],zones:x,stages:h,sections:C,rows:M,labels:S,floors:k}}var Rs=88,Is=20,Lr={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}},Kt=new Set(["row","seat"]),Fr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Qt={row:{x:62,y:16},seat:{x:46,y:18}},_r=ee,zn=e=>Zn(e);function Or(e,t){let n=zn(e),r=zn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Dr(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Es(e,t=[.04,.06,.1]){let n=zn(t)<.42,r=n?"#f4f7fb":"#0b1220",o=_r(e),i=o&&Or(o,t)>=4.5?e:r;return n?{ink:i,backing:"rgba(8,12,22,.78)",border:"rgba(210,222,245,.24)"}:{ink:i,backing:"rgba(255,255,255,.84)",border:"rgba(11,18,32,.22)"}}var qt=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=vr(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Ge(t,g.anchor,n,r);if(!x.visible)continue;let S=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:wr(x,S,n,r),halfWidth:Sr(g.text,Lr[g.kind].size,!Kt.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let l=xr(c.filter(g=>g.label.kind==="floor"),n),u=[...c.filter(g=>!Kt.has(g.label.kind)&&g.label.kind!=="floor"),...l],d=Mr(u,Rs,Is),m=Gn(c.filter(g=>g.label.kind==="row"),Qt.row.x,Qt.row.y,Nn.row,d),h=Gn(c.filter(g=>g.label.kind==="seat"),Qt.seat.x,Qt.seat.y,Nn.seat,[...d,...m]),f=[...d,...m,...h],p=new Set(f.map(g=>g.label.id));for(let{label:g,screen:x}of f){let C=this.nodeFor(g).style;C.display="",C.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let b=f.filter(({label:g})=>!Kt.has(g.kind)).sort((g,x)=>Fr[x.label.kind]-Fr[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),y=[];for(let{label:g}of b){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let S=x.getBoundingClientRect();y.some(M=>S.left<M.right+3&&S.right+3>M.left&&S.top<M.bottom+3&&S.bottom+3>M.top)?x.style.display="none":y.push(S)}for(let[g,x]of this.nodes)p.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let d=n.style;d.position="absolute",d.left="0",d.top="0",d.whiteSpace="nowrap",d.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",d.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=Lr[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=Es(t.color??this.opts.ink,this.opts.backgroundRgb),s=!Kt.has(t.kind);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=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=_r(r?"#ecf8ff":a.ink)??[1,1,1],u=r?Dr("rgba(10,28,45,.9)",c):s?Dr(a.backing,c):c;return n.dataset.qualityContrast=Or(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Nr=1;var Ts=new Set(["floor","zone","section","ga","booth","annotation"]);function ks(e){return e.every(t=>Number.isFinite(t))}function Ls(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Br(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function $e(e){return Math.round(e*1e4)/1e4}function Fs(e){if(e)return{box:{x:$e(e.box.x),y:$e(e.box.y),width:$e(e.box.width),height:$e(e.box.height)},horizontalFillRatio:$e(e.horizontalFillRatio),verticalFillRatio:$e(e.verticalFillRatio),visibleAreaRatio:$e(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Pe(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Zt(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Ts.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)Ls(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Pe("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Pe("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Pe("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Pe("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Pe("camera-invalid","The capture camera must have a finite physical pose",ks(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Pe("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Pe("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Pe("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Pe("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Pe("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.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:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Fs(e.framing)},metrics:{minimumHierarchyFontPx:Br(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Br(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var pe=require("ogl");var Ve=require("ogl");var $t=`
2
2
  float chairWeight(float depth) {
3
3
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
4
- }`,_r=`
4
+ }`,Gr=`
5
5
  float occupantWeight(float depth) {
6
6
  float nearWeight = smoothstep(${io.toFixed(1)}, ${ao.toFixed(1)}, depth);
7
7
  float farWeight = 1.0 - smoothstep(${oo.toFixed(1)}, ${ro.toFixed(1)}, depth);
8
8
  return nearWeight * farWeight;
9
- }`,Is=`#version 300 es
9
+ }`,Vr=`
10
+ float glyphEq(float glyph, float expected) {
11
+ return 1.0 - step(0.25, abs(glyph - expected));
12
+ }
13
+
14
+ float glyphBackRake(float glyph) {
15
+ if (glyphEq(glyph, 5.0) > 0.5) return 1.55;
16
+ if (glyphEq(glyph, 3.0) > 0.5) return 0.55;
17
+ if (glyphEq(glyph, 2.0) > 0.5) return 0.72;
18
+ return 1.0;
19
+ }
20
+
21
+ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
22
+ float generic = max(glyphEq(glyph, 0.0), glyphEq(glyph, 1.0));
23
+ float dining = glyphEq(glyph, 2.0);
24
+ float folding = glyphEq(glyph, 3.0);
25
+ float armchair = glyphEq(glyph, 4.0);
26
+ float recliner = glyphEq(glyph, 5.0);
27
+ float stool = glyphEq(glyph, 6.0);
28
+ float bench = glyphEq(glyph, 7.0);
29
+
30
+ if (partId < 0.5) {
31
+ if (max(max(generic, armchair), max(recliner, stool)) < 0.5) return vec3(0.0);
32
+ if (stool > 0.5) p.y *= 1.46;
33
+ } else if (partId < 1.5) {
34
+ if (dining > 0.5) { p.x *= 0.86; p.z *= 0.78; }
35
+ else if (folding > 0.5) { p.x *= 0.92; p.z *= 0.72; p.y = 0.405 + (p.y - 0.405) * 0.55; }
36
+ else if (armchair > 0.5) { p.z *= 1.08; }
37
+ else if (recliner > 0.5) { p.z *= 1.15; }
38
+ else if (stool > 0.5) { p.xz *= 0.76; p.y += 0.16; }
39
+ else if (bench > 0.5) { p.x *= 1.10; p.z *= 0.82; }
40
+ } else if (partId < 2.5) {
41
+ if (stool > 0.5) return vec3(0.0);
42
+ if (dining > 0.5) { p.x *= 0.78; p.y = 0.45 + (p.y - 0.45) * 0.82; }
43
+ else if (folding > 0.5) { p.x *= 0.90; p.y = 0.45 + (p.y - 0.45) * 0.72; }
44
+ else if (bench > 0.5) { p.x *= 1.10; p.y = 0.45 + (p.y - 0.45) * 0.62; }
45
+ } else if (partId < 3.5) {
46
+ if (max(armchair, recliner) < 0.5) return vec3(0.0);
47
+ if (recliner > 0.5) p.z *= 1.12;
48
+ } else if (partId < 4.5) {
49
+ if (recliner < 0.5) return vec3(0.0);
50
+ } else if (partId < 5.5) {
51
+ if (max(max(dining, folding), bench) < 0.5) return vec3(0.0);
52
+ if (folding > 0.5) p.x *= 0.88;
53
+ if (bench > 0.5) p.x *= 1.10;
54
+ } else if (partId > 9.5 && stool > 0.5) {
55
+ p.y += 0.16;
56
+ }
57
+ return p;
58
+ }`,Ds=`#version 300 es
10
59
  precision highp float;
11
60
  in vec3 position;
12
61
  in vec3 normal;
@@ -42,7 +91,7 @@ void main() {
42
91
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
43
92
  vColor = color;
44
93
  gl_Position = projectionMatrix * mv;
45
- }`,Es=`#version 300 es
94
+ }`,_s=`#version 300 es
46
95
  precision highp float;
47
96
  in vec3 vColor;
48
97
  in vec3 vNormalWorld;
@@ -109,7 +158,7 @@ void main() {
109
158
  + vec3(0.20, 0.10, 0.34) * focalHalo;
110
159
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
111
160
  fragColor = vec4(base, 1.0);
112
- }`,Ts=`#version 300 es
161
+ }`,Os=`#version 300 es
113
162
  precision highp float;
114
163
  in vec2 position; // quad corner in [-1,1]
115
164
  in vec3 iOffset; // per-instance world position
@@ -135,7 +184,7 @@ out float vDim;
135
184
  out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
136
185
  out float vPhysicalSeat;
137
186
  out float vPixelRadius;
138
- ${Qt}
187
+ ${$t}
139
188
  void main() {
140
189
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
141
190
  float depth = max(-mv.z, 0.001);
@@ -168,7 +217,7 @@ void main() {
168
217
  vPhysicalSeat = iPhysicalSeat;
169
218
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
170
219
  gl_Position = projectionMatrix * mv;
171
- }`,ks=`#version 300 es
220
+ }`,Bs=`#version 300 es
172
221
  precision highp float;
173
222
  in vec2 vUv;
174
223
  in vec3 vColor;
@@ -226,11 +275,11 @@ void main() {
226
275
  alpha *= vDotWeight;
227
276
  if (alpha <= 0.0) discard;
228
277
  fragColor = vec4(c, alpha);
229
- }`,Fs=`#version 300 es
278
+ }`,Ns=`#version 300 es
230
279
  precision highp float;
231
280
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
232
281
  in vec3 normal;
233
- in float part; // 0 = pedestal, 1 = pad, 2 = back, 3 = body, 4 = head
282
+ in float part; // 0..5 furniture modules, 10 body, 11 head
234
283
  in vec3 iOffset; // per-instance world deck point (identical to the dot's)
235
284
  in vec3 iColor; // per-instance state colour
236
285
  in float iRadius; // per-instance horizontal half-width, world metres
@@ -239,6 +288,7 @@ in vec3 iRing; // accommodation ring colour; (0,0,0) = not accessible
239
288
  in float iFloor;
240
289
  in float iSeed; // <0 = seat is empty; else per-person hash in [0,1)
241
290
  in float iPhysicalSeat;// 1 = chair; 0 = empty wheelchair bay
291
+ in float iGlyph; // stable SEAT_GLYPH_ORDER index
242
292
  uniform mat4 modelViewMatrix;
243
293
  uniform mat4 projectionMatrix;
244
294
  uniform float uChairFull;
@@ -256,8 +306,9 @@ out vec3 vRing;
256
306
  out float vDim;
257
307
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
258
308
  out vec3 vOccupantTint;
259
- ${Qt}
260
- ${_r}
309
+ ${$t}
310
+ ${Gr}
311
+ ${Vr}
261
312
  void main() {
262
313
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
263
314
  float viewDepth = -anchor.z;
@@ -270,16 +321,17 @@ void main() {
270
321
  // chairs, but nobody gets a short one (people are the same height at every
271
322
  // seat pitch).
272
323
  vec3 p = position;
273
- // The occupant. Parts 3 and 4 are a person; everything below is furniture.
324
+ // The occupant. Parts 10 and 11 are a person; lower ids are furniture modules.
274
325
  //
275
326
  // One instanced mesh draws both an empty seat and a taken one, because the
276
327
  // alternative \u2014 a second geometry and a second draw call gathered per frame \u2014
277
328
  // would double the near-field cost to show what is already known per instance.
278
329
  // An unoccupied seat collapses its person to a point at the seat, which the
279
330
  // rasteriser discards, exactly as the chair itself collapses at w=0.
280
- float occupant = step(2.5, part);
331
+ float occupant = step(9.5, part);
281
332
  float taken = step(0.0, iSeed);
282
333
  vOccupant = occupant;
334
+ p = glyphChairPosition(p, part, iGlyph);
283
335
  if (iPhysicalSeat < 0.5) {
284
336
  p = vec3(0.0); // sellable space, but no physical chair/person
285
337
  } else if (occupant > 0.5) {
@@ -296,6 +348,7 @@ void main() {
296
348
  p *= occupantWeight(depth);
297
349
  }
298
350
  }
351
+ float localHeight = p.y;
299
352
  p.xz *= iRadius;
300
353
  // 2. Lean the back. Done here rather than in the base mesh so the lean is a
301
354
  // real angle in METRES \u2014 baked into the mesh it would scale with the seat's
@@ -304,7 +357,8 @@ void main() {
304
357
  // Only the BACK panel rakes. The old test (part > 1.5) meant "the back", and
305
358
  // now also catches the occupant \u2014 leaning a person by the panel's rule would
306
359
  // translate their head backwards by a rake measured from the panel's base.
307
- float rake = (part > 1.5 && part < 2.5) ? max(p.y - uBackBase, 0.0) * uBackRake : 0.0;
360
+ float resolvedRake = uBackRake * glyphBackRake(iGlyph);
361
+ float rake = (part > 1.5 && part < 2.5) ? max(p.y - uBackBase, 0.0) * resolvedRake : 0.0;
308
362
  p.z -= rake;
309
363
  // 3. Scale-in. At w=0 the chair is a point at the seat, under a dot at full
310
364
  // opacity \u2014 which is what makes the handover invisible. sqrt front-loads
@@ -318,7 +372,7 @@ void main() {
318
372
  // unchanged; and the rake is a shear, whose normal transform adds a y term.
319
373
  // Skipping either lights the raked back as though it were still vertical.
320
374
  vec3 n = vec3(normal.x / iRadius, normal.y, normal.z / iRadius);
321
- if (part > 1.5 && part < 2.5) n.y += uBackRake * n.z;
375
+ if (part > 1.5 && part < 2.5) n.y += resolvedRake * n.z;
322
376
  n = normalize(n);
323
377
  vec3 rn = vec3(n.x * c + n.z * s, n.y, -n.x * s + n.z * c);
324
378
  vec4 mv = modelViewMatrix * vec4(iOffset + rp, 1.0);
@@ -334,13 +388,13 @@ void main() {
334
388
  float t = fract(iSeed * 3.71);
335
389
  vec3 clothes = mix(vec3(0.18, 0.22, 0.30), vec3(0.42, 0.29, 0.34), t);
336
390
  vec3 skin = mix(vec3(0.52, 0.38, 0.29), vec3(0.86, 0.70, 0.58), fract(iSeed * 11.3));
337
- vOccupantTint = (part > 3.5) ? skin : clothes;
391
+ vOccupantTint = (part > 10.5) ? skin : clothes;
338
392
  vPart = part;
339
- vHeight = position.y;
393
+ vHeight = localHeight;
340
394
  vRing = iRing;
341
395
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
342
396
  gl_Position = projectionMatrix * mv;
343
- }`,Ds=`#version 300 es
397
+ }`,Gs=`#version 300 es
344
398
  precision highp float;
345
399
  in vec3 vColor;
346
400
  in vec3 vNormalWorld;
@@ -367,16 +421,21 @@ void main() {
367
421
  vec3 tint = vColor;
368
422
  if (vOccupant > 0.5) tint = vOccupantTint;
369
423
  // The accommodation ring, kept legible once the dot (which drew it) is gone:
370
- // an accessible seat's PEDESTAL is painted in the ring colour, so the marker
424
+ // an accessible seat's support is painted in the ring colour, so the marker
371
425
  // survives to close range instead of vanishing exactly when the buyer arrives.
372
426
  float ringMask = step(0.001, dot(vRing, vRing));
373
- if (vPart < 0.5 && ringMask > 0.5) tint = vRing;
374
- // Pad brightest, back a step below it, pedestal darkest. Three untextured
375
- // boxes only read as one object if they are separated tonally \u2014 with a single
376
- // flat colour the chair silhouettes as a crate.
427
+ float supportPart = max(1.0 - step(0.5, vPart),
428
+ step(4.5, vPart) * (1.0 - step(5.5, vPart)));
429
+ if (supportPart > 0.5 && ringMask > 0.5) tint = vRing;
430
+ // Tonal separation keeps the modular silhouettes readable without textures.
377
431
  // A person is lit as a person, not as upholstery: no part shading, and less
378
432
  // of the pad's sheen, so a head does not read as a polished box.
379
- float partShade = vOccupant > 0.5 ? 0.95 : (vPart < 0.5 ? 0.50 : (vPart < 1.5 ? 1.10 : 0.80));
433
+ float furnitureShade = vPart < 0.5 ? 0.50
434
+ : (vPart < 1.5 ? 1.10
435
+ : (vPart < 2.5 ? 0.80
436
+ : (vPart < 3.5 ? 0.72
437
+ : (vPart < 4.5 ? 0.90 : 0.55))));
438
+ float partShade = vOccupant > 0.5 ? 0.95 : furnitureShade;
380
439
  // Cheap vertical occlusion: a chair is in a dense row, so the closer a surface
381
440
  // sits to the deck the less sky it can actually see. This is the depth cue \u2014
382
441
  // without it the pad top, the back and the deck all resolve to the same flat
@@ -390,14 +449,14 @@ void main() {
390
449
  // which is what stops a block of them merging into one mass up close.
391
450
  base += vec3(0.26, 0.31, 0.38) * fres * 0.55;
392
451
  fragColor = vec4(base, 1.0);
393
- }`,Ls=`#version 300 es
452
+ }`,Vs=`#version 300 es
394
453
  precision highp float;
395
454
  in vec2 position;
396
455
  out vec2 vUv;
397
456
  void main() {
398
457
  vUv = position * 0.5 + 0.5;
399
458
  gl_Position = vec4(position, 0.999, 1.0);
400
- }`,_s=`#version 300 es
459
+ }`,zs=`#version 300 es
401
460
  precision highp float;
402
461
  in vec2 vUv;
403
462
  uniform vec3 uTop;
@@ -408,7 +467,7 @@ void main() {
408
467
  vec2 c = vUv - 0.5;
409
468
  float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
410
469
  fragColor = vec4(col * vig, 1.0);
411
- }`,Os=`#version 300 es
470
+ }`,Hs=`#version 300 es
412
471
  precision highp float;
413
472
  in vec2 position;
414
473
  in vec3 iOffset;
@@ -429,7 +488,7 @@ out float vPhysicalSeat;
429
488
  out float vDotWeight;
430
489
  out float vHidden;
431
490
  flat out vec3 vPick;
432
- ${Qt}
491
+ ${$t}
433
492
  void main() {
434
493
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
435
494
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -445,7 +504,7 @@ void main() {
445
504
  vPhysicalSeat = iPhysicalSeat;
446
505
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
447
506
  gl_Position = projectionMatrix * mv;
448
- }`,Bs=`#version 300 es
507
+ }`,Us=`#version 300 es
449
508
  precision highp float;
450
509
  in vec2 vUv;
451
510
  in float vPhysicalSeat;
@@ -459,7 +518,7 @@ void main() {
459
518
  float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
460
519
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
461
520
  fragColor = vec4(vPick, 1.0);
462
- }`,Ns=`#version 300 es
521
+ }`,js=`#version 300 es
463
522
  precision highp float;
464
523
  in vec3 position;
465
524
  in float part;
@@ -468,6 +527,7 @@ in float iRadius;
468
527
  in float iYaw;
469
528
  in float iSeed;
470
529
  in float iPhysicalSeat;
530
+ in float iGlyph;
471
531
  in float iPickIndex;
472
532
  in float iFloor;
473
533
  uniform mat4 modelViewMatrix;
@@ -479,8 +539,9 @@ uniform float uBackBase;
479
539
  uniform float uFocusFloor;
480
540
  flat out vec3 vPick;
481
541
  out float vHidden;
482
- ${Qt}
483
- ${_r}
542
+ ${$t}
543
+ ${Gr}
544
+ ${Vr}
484
545
  void main() {
485
546
  int id = int(iPickIndex + 0.5); // already global index + 1
486
547
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -490,8 +551,9 @@ void main() {
490
551
  float depth = max(viewDepth, 0.001);
491
552
  float w = viewDepth > 0.05 ? chairWeight(depth) : 0.0;
492
553
  vec3 p = position;
493
- float occupant = step(2.5, part);
554
+ float occupant = step(9.5, part);
494
555
  float taken = step(0.0, iSeed);
556
+ p = glyphChairPosition(p, part, iGlyph);
495
557
  if (iPhysicalSeat < 0.5) {
496
558
  p = vec3(0.0);
497
559
  } else if (occupant > 0.5) {
@@ -504,13 +566,15 @@ void main() {
504
566
  }
505
567
  }
506
568
  p.xz *= iRadius;
507
- float rake = (part > 1.5 && part < 2.5) ? max(p.y - uBackBase, 0.0) * uBackRake : 0.0;
569
+ float rake = (part > 1.5 && part < 2.5)
570
+ ? max(p.y - uBackBase, 0.0) * uBackRake * glyphBackRake(iGlyph)
571
+ : 0.0;
508
572
  p.z -= rake;
509
573
  p *= sqrt(w);
510
574
  float c = cos(iYaw), s = sin(iYaw);
511
575
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
512
576
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
513
- }`,Vs=`#version 300 es
577
+ }`,Ys=`#version 300 es
514
578
  precision highp float;
515
579
  flat in vec3 vPick;
516
580
  in float vHidden;
@@ -518,7 +582,7 @@ out vec4 fragColor;
518
582
  void main() {
519
583
  if (vHidden > 0.5) discard;
520
584
  fragColor = vec4(vPick, 1.0);
521
- }`,zs=`#version 300 es
585
+ }`,Xs=`#version 300 es
522
586
  precision highp float;
523
587
  in vec3 position;
524
588
  in float floorIndex;
@@ -529,14 +593,14 @@ out float vHidden;
529
593
  void main() {
530
594
  vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
531
595
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
532
- }`,Gs=`#version 300 es
596
+ }`,Ws=`#version 300 es
533
597
  precision highp float;
534
598
  in float vHidden;
535
599
  out vec4 fragColor;
536
600
  void main() {
537
601
  if (vHidden > 0.5) discard;
538
602
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
539
- }`;function Or(e){return new ze.Program(e,{vertex:Os,fragment:Bs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uChairFull:{value:bt},uChairNone:{value:rt},uFocusFloor:{value:-1}}})}function Br(e){return new ze.Program(e,{vertex:Ns,fragment:Vs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:bt},uChairNone:{value:rt},uBackRake:{value:Pn},uBackBase:{value:Gt},uFocusFloor:{value:-1}}})}function Nr(e){return new ze.Program(e,{vertex:zs,fragment:Gs,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Vr(e){return new ze.Program(e,{vertex:Is,fragment:Es,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function zr(e){return new ze.Program(e,{vertex:Ts,fragment:ks,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:bt},uChairNone:{value:rt}}})}function Gr(e){return new ze.Program(e,{vertex:Fs,fragment:Ds,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:bt},uChairNone:{value:rt},uBackRake:{value:Pn},uBackBase:{value:Gt},uFocusFloor:{value:-1}}})}function Hr(e,t,n){return new ze.Program(e,{vertex:Ls,fragment:_s,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function Ur(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var Hs=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Us=new Float32Array([-1,-1,3,-1,-1,3]);function jr(e,t){let n=new pe.Transform,r=new pe.Transform,o=new pe.Geometry(e,{position:{size:2,data:Us}}),i=Hr(e,t.theme.background.top,t.theme.background.bottom),a=new pe.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new pe.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=Vr(e),l=new pe.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=zr(e),d=new Float32Array(t.seats.count*3),m=ge.map(F=>t.theme.seatStates[F]);Ur(d,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let f=new pe.Geometry(e,{position:{size:2,data:Hs},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:d,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),h=new pe.Mesh(e,{geometry:f,program:u});h.frustumCulled=!1,t.seats.count>0&&h.setParent(n);let p=f.attributes.iColor,b=xo(),y=Gr(e),g=Lt,x=new Float32Array(g*3),w=new Float32Array(g*3),A=new Float32Array(g),M=new Float32Array(g),D=new Float32Array(g*3),B=new Float32Array(g),N=new Float32Array(g),H=new Float32Array(g),O=new Float32Array(g),S=new pe.Geometry(e,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},part:{size:1,data:b.part},index:{data:b.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:w,instanced:1},iRadius:{size:1,data:A,instanced:1},iYaw:{size:1,data:M,instanced:1},iRing:{size:3,data:D,instanced:1},iFloor:{size:1,data:B,instanced:1},iPhysicalSeat:{size:1,data:N,instanced:1},iSeed:{size:1,data:O,instanced:1},iPickIndex:{size:1,data:H,instanced:1}}),v=new pe.Mesh(e,{geometry:S,program:y});v.frustumCulled=!1;let R=0,C=new Int32Array(0),T=()=>{let F=t.seats;for(let I=0;I<R;I++){let z=C[I];O[I]=Mo(F.iState[z],z);let L=F.iCategory&&F.iState[z]===0?null:m[F.iState[z]]??m[0];if(L)w[I*3]=L[0],w[I*3+1]=L[1],w[I*3+2]=L[2];else{let G=Jn([F.iCategory[z*3],F.iCategory[z*3+1],F.iCategory[z*3+2]]);w[I*3]=G[0],w[I*3+1]=G[1],w[I*3+2]=G[2]}}S.attributes.iColor.needsUpdate=!0,S.attributes.iSeed.needsUpdate=!0},P={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:f,chairGeometry:S,solidGeometry:s,drawCalls:3,setNearSeats(F,I){let z=Math.min(I,g);if(C=F,R=z,z===0){v.parent&&v.setParent(null),S.instancedCount=0,P.drawCalls=3;return}let E=t.seats;for(let L=0;L<z;L++){let G=F[L];x[L*3]=E.iPosition[G*3],x[L*3+1]=E.iPosition[G*3+1],x[L*3+2]=E.iPosition[G*3+2],A[L]=E.iChairWidth[G],M[L]=E.iYaw[G],D[L*3]=E.iRing[G*3],D[L*3+1]=E.iRing[G*3+1],D[L*3+2]=E.iRing[G*3+2],B[L]=E.iFloor[G],N[L]=E.iPhysicalSeat[G],H[L]=G+1}T(),S.attributes.iOffset.needsUpdate=!0,S.attributes.iRadius.needsUpdate=!0,S.attributes.iYaw.needsUpdate=!0,S.attributes.iRing.needsUpdate=!0,S.attributes.iFloor.needsUpdate=!0,S.attributes.iPhysicalSeat.needsUpdate=!0,S.attributes.iSeed.needsUpdate=!0,S.attributes.iPickIndex.needsUpdate=!0,S.instancedCount=z,v.parent||v.setParent(n),P.drawCalls=4},nearSeatCount(){return R},uploadSeatStateRuns(F){if(!F.length)return;R&&T();for(let z of F)Ur(d,t.seats.iState,z.start,z.length,m,t.seats.iCategory);let I=p.buffer;if(!I){p.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,I);for(let z of F){let E=d.subarray(z.start*3,(z.start+z.length)*3);e.bufferSubData(e.ARRAY_BUFFER,z.start*3*Float32Array.BYTES_PER_ELEMENT,E)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),f.remove(),u.remove(),S.remove(),y.remove()}};return P}var Ce=require("ogl");function js(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Xr(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=(c*t+l)*4,d=js(e[u],e[u+1],e[u+2]);if(d<0||d>=i)continue;let m=l-r,f=c-o,h=m*m+f*f;h<s&&(s=h,a=d)}return a}function Yr(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var Xs=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Jt=class{constructor(t,n,r,o,i){this.seatScene=new Ce.Transform;this.chairScene=new Ce.Transform;this.solidScene=new Ce.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=Or(this.gl),this.chairProg=Br(this.gl),this.depthProg=Nr(this.gl);let a=new Ce.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ce.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ce.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of Xs)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new Ce.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),u=Math.max(0,r-o),d=Math.max(1,Math.min(s,n+o+1)-l),m=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,d,m);let[f,h,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(f,h,p,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(d*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,d,m,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),Xr(b,d,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Wr(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,pt(r.state)):n.push(r);return n}function Kr(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:ge[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var Ge=require("ogl");function Ys(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function qr(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Ws(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function $r(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function Hn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Un(e,t){return Math.max(0,Math.min(1,e+t))}function Zr(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],d=a*a,m=d*a,f=[0,0,0];for(let h=0;h<3;h++)f[h]=.5*(2*c[h]+(-s[h]+l[h])*a+(2*s[h]-5*c[h]+4*l[h]-u[h])*d+(-s[h]+3*c[h]-3*l[h]+u[h])*m);return f}function jn(e,t,n,r,o){let i=$r(Ys(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=qr(qr(t,Ws(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=$r(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),u=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function Xn(e,t,n=35,r=28){let o=Hn(t),i=Zr(e,o),a=Hn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function ei(e,t,n){let r=e.position.clone(),o=new Ge.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new Ge.Vec3(n[0],n[1],n[2]));let i=new Ge.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var en=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Ge.Quat;this.endQuat=new Ge.Quat;this.outQuat=new Ge.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Xn(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Un(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let t=this.resolveFn;this.resolveFn=null,t&&t()}};var Ks=1.02,qs=1.5;function ti(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+Ks;return{eye:[e[0],o,e[2]],focal:[t.x*_,n+qs,t.y*_]}}function $s(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Zs(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function tn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Zs(t?.deviceMemory)}}function nn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};return t.saveData?{...r,reason:"save-data"}:t.maxTextureSize!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&Math.max(e.sourceWidth,e.sourceHeight)>t.maxTextureSize?{...r,reason:"texture-limit"}:t.maxDecodedBytes!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&$s(e.sourceWidth,e.sourceHeight)>t.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:e.url,reason:"progressive"}}function ni(){return new DOMException("Panorama image load aborted","AbortError")}function At(e,t){return new Promise((n,r)=>{if(t?.aborted){r(ni());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},c=()=>{o.src="",s(ni())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function on(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}function ri(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}var an=70,Qs=35,Js=90;function Yn(e){return Math.max(Qs,Math.min(Js,e))}var Ae=35;function ec(e,t,n){let r=(.5+e/360)*n;return t/2-r}function tc(e,t=an){return e*(180/t)}function oi(e,t,n){return(e-t)/2+rn(n,t)}function rn(e,t){let n=Ae/180*t;return Math.max(-n,Math.min(n,e))}function ii(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=nn(t,tn()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);let d=document.createElement("button");if(d.type="button",d.setAttribute("aria-label","Close"),d.textContent="\u2715",Object.assign(d.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(d),n.disclosure){let V=document.createElement("div");V.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(V.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(V)}let m=document.createElement("div");m.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),d.focus({preventScroll:!0});let f=0,h=0,p=0,b=0,y=an,g=()=>{let V=c.clientHeight||1,k=c.clientWidth||1,Y=A.naturalWidth||k*2,K=A.naturalHeight||V,J=f>0?(k/2-p)/f:0,Z=h>0?b/h:0;h=tc(V,y),f=h*(Y/K),u.style.backgroundSize=`${f}px ${h}px`,x?p=k/2-J*f:(p=ec(o,k,f),b=rn((t.initialPitchDeg??0)/180*h,h),x=!0),b=rn(Z*h,h),u.style.backgroundPosition=`${p}px ${oi(V,h,b)}px`},x=!1,w=()=>{let V=c.clientHeight||1;b=rn(b,h),u.style.backgroundPosition=`${p}px ${oi(V,h,b)}px`},A=new Image;A.onload=g,A.src=i.initialUrl;let M=()=>{};i.upgradeUrl&&(M=on(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(k=>!k||a.signal.aborted?null:At(k,a.signal).then(Y=>({full:Y,url:k}))).then(k=>{k&&(I||a.signal.aborted||(A=k.full,u.style.backgroundImage=`url("${k.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let D=!1,B=0,N=0,H=0,O=new Map,S=()=>{let[V,k]=[...O.values()];return V&&k?Math.hypot(V.x-k.x,V.y-k.y):0},v=V=>{let k=Yn(V);k!==y&&(y=k,g())},R=V=>{O.set(V.pointerId,{x:V.clientX,y:V.clientY}),D=O.size===1,B=V.clientX,N=V.clientY,O.size===2&&(H=S()),u.style.cursor="grabbing";try{u.setPointerCapture?.(V.pointerId)}catch{}},C=V=>{if(O.has(V.pointerId)){if(O.set(V.pointerId,{x:V.clientX,y:V.clientY}),O.size>=2){let k=S();H>0&&k>0&&v(y*(H/k)),H=k,D=!1;return}D&&(p+=V.clientX-B,b+=V.clientY-N,B=V.clientX,N=V.clientY,w())}},T=V=>{O.delete(V.pointerId),H=O.size===2?S():0;let k=O.values().next().value;D=O.size===1,k?(B=k.x,N=k.y):u.style.cursor="grab";try{u.releasePointerCapture?.(V.pointerId)}catch{}},P=V=>{V.preventDefault(),v(y+V.deltaY*.04)};u.addEventListener("pointerdown",R),u.addEventListener("pointermove",C),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T),u.addEventListener("wheel",P,{passive:!1});let F=!1,I=!1,z=0,E=()=>{u.removeEventListener("pointerdown",R),u.removeEventListener("pointermove",C),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T),u.removeEventListener("wheel",P),window.removeEventListener("keydown",X)},L=()=>{M(),a.abort(),n.signal?.removeEventListener("abort",s),z&&(window.clearTimeout(z),z=0),E(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},G=()=>{if(F)return;F=!0,c.style.opacity="0";let V=()=>{z=0,!I&&(L(),n.onClose?.())};z=window.setTimeout(V,r)},X=V=>{if(V.key==="Tab"){V.preventDefault(),d.focus({preventScroll:!0});return}if(V.key==="Escape"){V.stopPropagation(),G();return}if(V.key==="ArrowLeft"||V.key==="ArrowRight")p+=V.key==="ArrowLeft"?-32:32;else if(V.key==="ArrowUp"||V.key==="ArrowDown")b+=(V.key==="ArrowUp"?4:-4)*(h/180);else if(V.key==="+"||V.key==="="){v(y-5),V.preventDefault();return}else if(V.key==="-"){v(y+5),V.preventDefault();return}else return;V.preventDefault(),w()};return window.addEventListener("keydown",X),d.addEventListener("click",G),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:G,dispose(){F=!0,I=!0,L()}}}var He=require("ogl"),nc=64,oc=32,rc=500;function ic(e=nc,t=oc,n=rc){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let d=u/t,m=d*Math.PI,f=Math.sin(m),h=Math.cos(m);for(let p=0;p<r;p++){let b=p/e,y=(b-.5)*Math.PI*2,g=u*r+p;a[g*3]=n*f*Math.sin(y),a[g*3+1]=n*h,a[g*3+2]=-n*f*Math.cos(y),s[g*2]=b,s[g*2+1]=d}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let d=0;d<e;d++){let m=u*r+d,f=m+r;c[l++]=m,c[l++]=f,c[l++]=m+1,c[l++]=m+1,c[l++]=f,c[l++]=f+1}return{position:a,uv:s,index:c}}function ai(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}var ac=`#version 300 es
603
+ }`;function zr(e){return new Ve.Program(e,{vertex:Hs,fragment:Us,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uChairFull:{value:bt},uChairNone:{value:rt},uFocusFloor:{value:-1}}})}function Hr(e){return new Ve.Program(e,{vertex:js,fragment:Ys,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:bt},uChairNone:{value:rt},uBackRake:{value:Pn},uBackBase:{value:zt},uFocusFloor:{value:-1}}})}function Ur(e){return new Ve.Program(e,{vertex:Xs,fragment:Ws,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function jr(e){return new Ve.Program(e,{vertex:Ds,fragment:_s,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function Yr(e){return new Ve.Program(e,{vertex:Os,fragment:Bs,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:ke},uSeatScale:{value:1},uMinPixels:{value:ot},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:bt},uChairNone:{value:rt}}})}function Xr(e){return new Ve.Program(e,{vertex:Ns,fragment:Gs,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:bt},uChairNone:{value:rt},uBackRake:{value:Pn},uBackBase:{value:zt},uFocusFloor:{value:-1}}})}function Wr(e,t,n){return new Ve.Program(e,{vertex:Vs,fragment:zs,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function Kr(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var Ks=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Qs=new Float32Array([-1,-1,3,-1,-1,3]);function Qr(e,t){let n=new pe.Transform,r=new pe.Transform,o=new pe.Geometry(e,{position:{size:2,data:Qs}}),i=Wr(e,t.theme.background.top,t.theme.background.bottom),a=new pe.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new pe.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=jr(e),l=new pe.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=Yr(e),d=new Float32Array(t.seats.count*3),m=ge.map(R=>t.theme.seatStates[R]);Kr(d,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let h=new pe.Geometry(e,{position:{size:2,data:Ks},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:d,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),f=new pe.Mesh(e,{geometry:h,program:u});f.frustumCulled=!1,t.seats.count>0&&f.setParent(n);let p=h.attributes.iColor,b=wo(),y=Xr(e),g=Dt,x=new Float32Array(g*3),S=new Float32Array(g*3),C=new Float32Array(g),M=new Float32Array(g),k=new Float32Array(g),O=new Float32Array(g*3),V=new Float32Array(g),H=new Float32Array(g),N=new Float32Array(g),A=new Float32Array(g),v=new pe.Geometry(e,{position:{size:3,data:b.position},normal:{size:3,data:b.normal},part:{size:1,data:b.part},index:{data:b.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:S,instanced:1},iRadius:{size:1,data:C,instanced:1},iYaw:{size:1,data:M,instanced:1},iGlyph:{size:1,data:k,instanced:1},iRing:{size:3,data:O,instanced:1},iFloor:{size:1,data:V,instanced:1},iPhysicalSeat:{size:1,data:H,instanced:1},iSeed:{size:1,data:A,instanced:1},iPickIndex:{size:1,data:N,instanced:1}}),w=new pe.Mesh(e,{geometry:v,program:y});w.frustumCulled=!1;let P=0,T=new Int32Array(0),L=()=>{let R=t.seats;for(let z=0;z<P;z++){let I=T[z];A[z]=Co(R.iState[I],I);let B=R.iCategory&&R.iState[I]===0?null:m[R.iState[I]]??m[0];if(B)S[z*3]=B[0],S[z*3+1]=B[1],S[z*3+2]=B[2];else{let U=Jn([R.iCategory[I*3],R.iCategory[I*3+1],R.iCategory[I*3+2]]);S[z*3]=U[0],S[z*3+1]=U[1],S[z*3+2]=U[2]}}v.attributes.iColor.needsUpdate=!0,v.attributes.iSeed.needsUpdate=!0},E={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:y,seatGeometry:h,chairGeometry:v,solidGeometry:s,drawCalls:3,setNearSeats(R,z){let I=Math.min(z,g);if(T=R,P=I,I===0){w.parent&&w.setParent(null),v.instancedCount=0,E.drawCalls=3;return}let D=t.seats;for(let B=0;B<I;B++){let U=R[B];x[B*3]=D.iPosition[U*3],x[B*3+1]=D.iPosition[U*3+1],x[B*3+2]=D.iPosition[U*3+2],C[B]=D.iChairWidth[U],M[B]=D.iYaw[U],k[B]=D.iGlyph[U],O[B*3]=D.iRing[U*3],O[B*3+1]=D.iRing[U*3+1],O[B*3+2]=D.iRing[U*3+2],V[B]=D.iFloor[U],H[B]=D.iPhysicalSeat[U],N[B]=U+1}L(),v.attributes.iOffset.needsUpdate=!0,v.attributes.iRadius.needsUpdate=!0,v.attributes.iYaw.needsUpdate=!0,v.attributes.iGlyph.needsUpdate=!0,v.attributes.iRing.needsUpdate=!0,v.attributes.iFloor.needsUpdate=!0,v.attributes.iPhysicalSeat.needsUpdate=!0,v.attributes.iSeed.needsUpdate=!0,v.attributes.iPickIndex.needsUpdate=!0,v.instancedCount=I,w.parent||w.setParent(n),E.drawCalls=4},nearSeatCount(){return P},uploadSeatStateRuns(R){if(!R.length)return;P&&L();for(let I of R)Kr(d,t.seats.iState,I.start,I.length,m,t.seats.iCategory);let z=p.buffer;if(!z){p.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,z);for(let I of R){let D=d.subarray(I.start*3,(I.start+I.length)*3);e.bufferSubData(e.ARRAY_BUFFER,I.start*3*Float32Array.BYTES_PER_ELEMENT,D)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),h.remove(),u.remove(),v.remove(),y.remove()}};return E}var Ce=require("ogl");function qs(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function qr(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=(c*t+l)*4,d=qs(e[u],e[u+1],e[u+2]);if(d<0||d>=i)continue;let m=l-r,h=c-o,f=m*m+h*h;f<s&&(s=f,a=d)}return a}function Zr(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var Zs=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Jt=class{constructor(t,n,r,o,i){this.seatScene=new Ce.Transform;this.chairScene=new Ce.Transform;this.solidScene=new Ce.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=zr(this.gl),this.chairProg=Hr(this.gl),this.depthProg=Ur(this.gl);let a=new Ce.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ce.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ce.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of Zs)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new Ce.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),u=Math.max(0,r-o),d=Math.max(1,Math.min(s,n+o+1)-l),m=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,d,m);let[h,f,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(h,f,p,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(d*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,d,m,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),qr(b,d,m,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function $r(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,pt(r.state)):n.push(r);return n}function Jr(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:ge[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var ze=require("ogl");function $s(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function ei(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Js(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function ti(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function Hn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Un(e,t){return Math.max(0,Math.min(1,e+t))}function ni(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],d=a*a,m=d*a,h=[0,0,0];for(let f=0;f<3;f++)h[f]=.5*(2*c[f]+(-s[f]+l[f])*a+(2*s[f]-5*c[f]+4*l[f]-u[f])*d+(-s[f]+3*c[f]-3*l[f]+u[f])*m);return h}function jn(e,t,n,r,o){let i=ti($s(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=ei(ei(t,Js(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=ti(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),u=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function Yn(e,t,n=35,r=28){let o=Hn(t),i=ni(e,o),a=Hn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function ii(e,t,n){let r=e.position.clone(),o=new ze.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new ze.Vec3(n[0],n[1],n[2]));let i=new ze.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var en=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new ze.Quat;this.endQuat=new ze.Quat;this.outQuat=new ze.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Yn(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Un(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let t=this.resolveFn;this.resolveFn=null,t&&t()}};var ec=1.02,tc=1.5;function ai(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+ec;return{eye:[e[0],o,e[2]],focal:[t.x*_,n+tc,t.y*_]}}function nc(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function oc(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function tn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:oc(t?.deviceMemory)}}function nn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};return t.saveData?{...r,reason:"save-data"}:t.maxTextureSize!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&Math.max(e.sourceWidth,e.sourceHeight)>t.maxTextureSize?{...r,reason:"texture-limit"}:t.maxDecodedBytes!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&nc(e.sourceWidth,e.sourceHeight)>t.maxDecodedBytes?{...r,reason:"memory-limit"}:{...r,upgradeUrl:e.url,reason:"progressive"}}function si(){return new DOMException("Panorama image load aborted","AbortError")}function At(e,t){return new Promise((n,r)=>{if(t?.aborted){r(si());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},c=()=>{o.src="",s(si())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function on(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}function li(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}var an=70,rc=35,ic=90;function Xn(e){return Math.max(rc,Math.min(ic,e))}var Ae=35;function ac(e,t,n){let r=(.5+e/360)*n;return t/2-r}function sc(e,t=an){return e*(180/t)}function ci(e,t,n){return(e-t)/2+rn(n,t)}function rn(e,t){let n=Ae/180*t;return Math.max(-n,Math.min(n,e))}function ui(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=nn(t,tn()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);let d=document.createElement("button");if(d.type="button",d.setAttribute("aria-label","Close"),d.textContent="\u2715",Object.assign(d.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(d),n.disclosure){let G=document.createElement("div");G.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(G.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(G)}let m=document.createElement("div");m.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),d.focus({preventScroll:!0});let h=0,f=0,p=0,b=0,y=an,g=()=>{let G=c.clientHeight||1,F=c.clientWidth||1,X=C.naturalWidth||F*2,K=C.naturalHeight||G,J=h>0?(F/2-p)/h:0,Z=f>0?b/f:0;f=sc(G,y),h=f*(X/K),u.style.backgroundSize=`${h}px ${f}px`,x?p=F/2-J*h:(p=ac(o,F,h),b=rn((t.initialPitchDeg??0)/180*f,f),x=!0),b=rn(Z*f,f),u.style.backgroundPosition=`${p}px ${ci(G,f,b)}px`},x=!1,S=()=>{let G=c.clientHeight||1;b=rn(b,f),u.style.backgroundPosition=`${p}px ${ci(G,f,b)}px`},C=new Image;C.onload=g,C.src=i.initialUrl;let M=()=>{};i.upgradeUrl&&(M=on(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:At(F,a.signal).then(X=>({full:X,url:F}))).then(F=>{F&&(R||a.signal.aborted||(C=F.full,u.style.backgroundImage=`url("${F.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let k=!1,O=0,V=0,H=0,N=new Map,A=()=>{let[G,F]=[...N.values()];return G&&F?Math.hypot(G.x-F.x,G.y-F.y):0},v=G=>{let F=Xn(G);F!==y&&(y=F,g())},w=G=>{N.set(G.pointerId,{x:G.clientX,y:G.clientY}),k=N.size===1,O=G.clientX,V=G.clientY,N.size===2&&(H=A()),u.style.cursor="grabbing";try{u.setPointerCapture?.(G.pointerId)}catch{}},P=G=>{if(N.has(G.pointerId)){if(N.set(G.pointerId,{x:G.clientX,y:G.clientY}),N.size>=2){let F=A();H>0&&F>0&&v(y*(H/F)),H=F,k=!1;return}k&&(p+=G.clientX-O,b+=G.clientY-V,O=G.clientX,V=G.clientY,S())}},T=G=>{N.delete(G.pointerId),H=N.size===2?A():0;let F=N.values().next().value;k=N.size===1,F?(O=F.x,V=F.y):u.style.cursor="grab";try{u.releasePointerCapture?.(G.pointerId)}catch{}},L=G=>{G.preventDefault(),v(y+G.deltaY*.04)};u.addEventListener("pointerdown",w),u.addEventListener("pointermove",P),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T),u.addEventListener("wheel",L,{passive:!1});let E=!1,R=!1,z=0,I=()=>{u.removeEventListener("pointerdown",w),u.removeEventListener("pointermove",P),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T),u.removeEventListener("wheel",L),window.removeEventListener("keydown",U)},D=()=>{M(),a.abort(),n.signal?.removeEventListener("abort",s),z&&(window.clearTimeout(z),z=0),I(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},B=()=>{if(E)return;E=!0,c.style.opacity="0";let G=()=>{z=0,!R&&(D(),n.onClose?.())};z=window.setTimeout(G,r)},U=G=>{if(G.key==="Tab"){G.preventDefault(),d.focus({preventScroll:!0});return}if(G.key==="Escape"){G.stopPropagation(),B();return}if(G.key==="ArrowLeft"||G.key==="ArrowRight")p+=G.key==="ArrowLeft"?-32:32;else if(G.key==="ArrowUp"||G.key==="ArrowDown")b+=(G.key==="ArrowUp"?4:-4)*(f/180);else if(G.key==="+"||G.key==="="){v(y-5),G.preventDefault();return}else if(G.key==="-"){v(y+5),G.preventDefault();return}else return;G.preventDefault(),S()};return window.addEventListener("keydown",U),d.addEventListener("click",B),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:B,dispose(){E=!0,R=!0,D()}}}var He=require("ogl"),cc=64,lc=32,uc=500;function dc(e=cc,t=lc,n=uc){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let d=u/t,m=d*Math.PI,h=Math.sin(m),f=Math.cos(m);for(let p=0;p<r;p++){let b=p/e,y=(b-.5)*Math.PI*2,g=u*r+p;a[g*3]=n*h*Math.sin(y),a[g*3+1]=n*f,a[g*3+2]=-n*h*Math.cos(y),s[g*2]=b,s[g*2+1]=d}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let d=0;d<e;d++){let m=u*r+d,h=m+r;c[l++]=m,c[l++]=h,c[l++]=m+1,c[l++]=m+1,c[l++]=h,c[l++]=h+1}return{position:a,uv:s,index:c}}function di(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}var mc=`#version 300 es
540
604
  precision highp float;
541
605
  in vec3 position;
542
606
  in vec2 uv;
@@ -546,7 +610,7 @@ out vec2 vUv;
546
610
  void main() {
547
611
  vUv = uv;
548
612
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
549
- }`,sc=`#version 300 es
613
+ }`,hc=`#version 300 es
550
614
  precision highp float;
551
615
  in vec2 vUv;
552
616
  uniform sampler2D uPano;
@@ -555,4 +619,4 @@ out vec4 fragColor;
555
619
  void main() {
556
620
  vec3 rgb = texture(uPano, vUv).rgb;
557
621
  fragColor = vec4(rgb, uOpacity);
558
- }`;function si(e,t){let{position:n,uv:r,index:o}=ic(),i=new He.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new He.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new He.Program(e,{vertex:ac,fragment:sc,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new He.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var ci=.15;async function li(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Ae,Math.min(Ae,t?.initialPitchDeg??0)),s=an,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let d=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let E=n.camera.position,L=n.focalWorld[0]-E.x,G=n.focalWorld[1]-E.y,X=n.focalWorld[2]-E.z,V=Math.hypot(L,X);V>.001&&(i=Math.atan2(L,-X)*180/Math.PI,a=Math.max(-Ae,Math.min(Ae,Math.atan2(G,V)*180/Math.PI)))}let f=null;if(t){let E=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),L=nn(t,tn(E)),G;try{let X=t.resolveUrl?await t.resolveUrl(L.initialUrl):L.initialUrl;if(!X)throw new Error("panorama_asset_unavailable");G=await At(X,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{f=si(n.gl,G)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),L.upgradeUrl&&(d=on(()=>{(t.resolveUrl?t.resolveUrl(L.upgradeUrl):Promise.resolve(L.upgradeUrl)).then(V=>!V||l.signal.aborted?null:At(V,l.signal)).then(V=>{V&&(c||l.signal.aborted||(f?.setImage(V),n.requestRender()))}).catch(()=>{})}))}let h=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let E=n.camera.position;f?.mesh.position.set(E.x,E.y,E.z);let[L,G,X]=ai(i,a);n.camera.lookAt([E.x+L,E.y+G,E.z+X]),n.requestRender()};b();let y=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(x),r.disclosure){let E=document.createElement("div");E.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(E.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(E)}let w=document.createElement("div");w.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(w.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(w),e.appendChild(y),x.focus({preventScroll:!0});let A=!1,M=0,D=0,B=0,N=new Map,H=()=>{let[E,L]=[...N.values()];return E&&L?Math.hypot(E.x-L.x,E.y-L.y):0},O=E=>{let L=Yn(E);L!==s&&(s=L,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},S=E=>{E.target!==x&&(N.set(E.pointerId,{x:E.clientX,y:E.clientY}),A=N.size===1,M=E.clientX,D=E.clientY,N.size===2&&(B=H()),y.setPointerCapture?.(E.pointerId),y.style.cursor="grabbing")},v=E=>{if(N.has(E.pointerId)){if(N.set(E.pointerId,{x:E.clientX,y:E.clientY}),N.size>=2){let L=H();B>0&&L>0&&O(s*(B/L)),B=L,A=!1;return}A&&(i+=(E.clientX-M)*ci,a=Math.max(-Ae,Math.min(Ae,a+(E.clientY-D)*ci)),M=E.clientX,D=E.clientY,b())}},R=E=>{N.delete(E.pointerId),B=N.size===2?H():0;let L=N.values().next().value;A=N.size===1,L?(M=L.x,D=L.y):y.style.cursor="grab";try{y.releasePointerCapture?.(E.pointerId)}catch{}},C=E=>{E.preventDefault(),O(s+E.deltaY*.04)};y.addEventListener("pointerdown",S),y.addEventListener("pointermove",v),y.addEventListener("pointerup",R),y.addEventListener("pointercancel",R),y.addEventListener("wheel",C,{passive:!1});let T=E=>{if(!c){if(E.key==="Tab"){E.preventDefault(),x.focus({preventScroll:!0});return}if(E.key==="Escape"){E.stopPropagation(),z.close();return}if(E.key==="ArrowLeft"||E.key==="ArrowRight")i+=E.key==="ArrowLeft"?-4:4;else if(E.key==="ArrowUp"||E.key==="ArrowDown")a=Math.max(-Ae,Math.min(Ae,a+(E.key==="ArrowUp"?4:-4)));else if(E.key==="+"||E.key==="="){O(s-5),E.preventDefault();return}else if(E.key==="-"){O(s+5),E.preventDefault();return}else return;E.preventDefault(),b()}};window.addEventListener("keydown",T);let P=0,F=(E,L)=>{if(!f){L?.();return}let G=E===1?0:1,X=performance.now(),V=()=>{if(c)return;let k=o<=0?1:Math.min(1,(performance.now()-X)/o);f?.setOpacity(G+(E-G)*k),n.requestRender(),k<1?P=requestAnimationFrame(V):L?.()};P=requestAnimationFrame(V)};F(1);let I=()=>{c||(c=!0,d(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(P),y.removeEventListener("pointerdown",S),y.removeEventListener("pointermove",v),y.removeEventListener("pointerup",R),y.removeEventListener("pointercancel",R),y.removeEventListener("wheel",C),window.removeEventListener("keydown",T),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:h,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},z={close(){if(c)return;let E=()=>{I(),r.onClose?.()};cancelAnimationFrame(P),F(0,E)},dispose:I};return x.addEventListener("click",()=>z.close()),z}function ui(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:d,isContextLost:m,isDisposed:f,flightGen:h,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:w,restorePanoramaLayer:A,getOverviewChip:M,labelOverlay:D,reducedMotion:B,removeArriveChip:N,showArriveChip:H}=e;return async(O,S,v)=>{b()?.abort();let R=new AbortController;y(R);let C=n.seats.idToIndex.get(O);if(C===void 0){i.syncFromCamera();return}let T=s.get(O)?.label??O,P=l(O,C),F=c(O);if(!F){R.abort(),b()===R&&y(null),i.syncFromCamera();return}x(!0),a.stop();let I;try{I=await F}catch{if(b()===R&&y(null),o.panoramaFailed(O,"source"),!f()&&v===h()){x(!1),i.resumeAfterFlight(P.focal),a.requestRender();let Y=H(O,v,!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||v!==h()){R.abort(),b()===R&&y(null);return}N();let z=M(),E=()=>{R.abort(),b()===R&&y(null),p(null),g(!1),A(),z.style.display="",D.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(P.focal),a.requestRender();let Y=H(O,h());requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())},L=I.generated===!0,G=ri(I);w(),g(!L),z.style.display="none";let X=B()?0:S,V=u(),k=V&&!m()?await li(t,L?null:I,{gl:d,scene:V.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:L?P.eye:void 0,focalWorld:P.focal},{fadeMs:X,seatLabel:T,disclosure:G,disclosurePrefix:L?"Live seat-eye view":"360\xB0 panorama",onClose:E,signal:R.signal}):null;if(f()||v!==h()){R.abort(),g(!1),b()===R&&y(null),k?.dispose(),z.style.display="",A();return}if(k)i.syncFromCamera(),D.setVisible(!1),x(!1),a.requestRender(),p(k);else if(L){A(),z.style.display="",x(!1),i.resumeAfterFlight(P.focal),a.requestRender(),p(null),g(!1),o.panoramaFailed(O,"mount");let Y=H(O,h(),!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus()),b()===R&&y(null);return}else g(!1),o.panoramaFallback(O),p(ii(t,I,{fadeMs:X,seatLabel:T,disclosure:G,onClose:E,signal:R.signal}));o.panoramaOpened()}}var di=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),sn=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=di(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(di()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:t})}panoramaFailed(t,n){this.emit("3d_panorama_failed",{seatId:t,phase:n})}panoramaFallback(t){this.emit("3d_panorama_fallback",{seatId:t})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function mi(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function fi(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let d=a();Object.assign(s.style,d?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(d,m,f=!1)=>{if(l(),e.isDisposed())return null;let h=document.createElement("div");h.setAttribute("role","group"),Object.assign(h.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.get(d),b=p?.sectionId?n.sections.find(B=>B.id===p.sectionId):void 0,y=p?.label??d;h.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${y}`);let g=document.createElement("span");g.textContent=["Live 3D seat view",b?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(g.style,{maxWidth:"min(320px, calc(100vw - 32px))",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)"}),h.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),h.appendChild(x);let w=p?.rowId?i.get(p.rowId):void 0,A=w?.indexOf(d)??-1,M=A>=0?[w?.[A-1],w?.[A+1]]:[void 0,void 0],D=(B,N,H,O=!1)=>{let S=document.createElement("button");S.type="button",S.textContent=B,S.setAttribute("aria-label",N),Object.assign(S.style,{minHeight:"44px",padding:O?"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"}),O||(S.style.minWidth="44px"),O&&(S.dataset.panoramaTrigger=""),S.addEventListener("click",H),x.appendChild(S)};if(M[0]){let B=o.get(M[0])?.label??M[0];D("\u2039",`View previous seat ${B}`,()=>{e.flyToSeat(M[0])})}if(r.getSeatView){let B=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";D(f?`\u21BB Retry ${B}`:`\u25C9 ${B}`,`${f?"Retry":B} from seat ${y}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(d,400,m)},!0)}if(M[1]){let B=o.get(M[1])?.label??M[1];D("\u203A",`View next seat ${B}`,()=>{e.flyToSeat(M[1])})}return x.childElementCount?(t.appendChild(h),s=h,c(),h):null},remove:l,layout:c}}function hi(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let u=document.createElement("button");u.type="button",u.textContent="\u2212",u.setAttribute("aria-label","Zoom out of the 3D venue"),u.dataset.tooltip="Zoom out";let d=document.createElement("button");d.type="button",d.textContent="+",d.setAttribute("aria-label","Zoom into the 3D venue"),d.dataset.tooltip="Zoom in";for(let p of[c,l,u,d])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"});a.append(c,l),s.append(d,u);let m=p=>{n.setPrimaryDragMode(p);let b=p==="orbit";c.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),c.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>m("orbit")),l.addEventListener("click",()=>m("pan")),u.addEventListener("click",()=>n.zoomBy(1.22)),d.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let f=()=>{let p=r();o.style.display=i?"none":"flex",o.style.right=p?"12px":"14px",o.style.bottom=p?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=p?"none":"flex",d.style.display=p?"none":"",u.style.display=p?"none":""};return f(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:p=>{i=p,n.setInteractionEnabled(!p),f()},seatViewLocked:()=>i,layout:f}}function pi(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:d,cancelFlight:m,focusSectionCamera:f,setSelection:h,ensureSeatView:p}=e,b=0,y=0,g=0,x=-1,w=!1,A=!1,M=O=>{e.seatViewLocked()||x===-1&&(x=O.pointerId,b=O.clientX,y=O.clientY,g=performance.now(),w=!1,A=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},D=O=>{O.pointerId===x&&Math.hypot(O.clientX-b,O.clientY-y)>u&&(w=!0)},B=(O,S,v,R,C)=>{let T=t.canvas.getBoundingClientRect(),P=t.canvas.clientWidth||T.width||1,F=t.canvas.clientHeight||T.height||1,I=O-T.left,z=S-T.top,E=R*R,L=-1,G=E,X=1/0;for(let V of o){if(v&&V.sectionId!==v)continue;let k=r.seats.idToIndex.get(V.id);if(k===void 0)continue;if(C){let te=Math.round(r.seats.iState[k]??0);if(te!==0&&te!==3)continue}let Y=k*3,K=Ve(n.camera.projectionViewMatrix,[r.seats.iPosition[Y],r.seats.iPosition[Y+1]+.55,r.seats.iPosition[Y+2]],P,F);if(!K.visible)continue;let J=K.x-I,Z=K.y-z,$=J*J+Z*Z;($<G||Math.abs($-G)<1&&K.depth<X)&&(L=k,G=$,X=K.depth)}return L},N=(O,S)=>{let v=e.gpu(),R=e.pick();if(!v||!R)return-1;R.syncFromSeatProgram(v.seatProgram);let C=t.canvas.getBoundingClientRect(),T=t.renderer.dpr,{x:P,y:F}=Yr(O,S,C,T,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),I=Math.max(2,Math.round(8*T));return R.pick(n.camera,P,F,I)};return{onDown:M,onMove:D,onUp:O=>{if(O.pointerId!==x)return;let S=!w&&performance.now()-g<d;if(x=-1,A){A=!1;return}let v=e.gpu(),R=e.pick();if(!S||!v||!R)return;let C=N(O.clientX,O.clientY);if(e.focusedSectionId()&&C>=0){let F=c[C],I=F?l.get(F):void 0;if(I&&I!==e.focusedSectionId()&&f(I))return}if(e.focusedSectionId()&&C<0&&(C=B(O.clientX,O.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&C<0){let F=B(O.clientX,O.clientY,null,72,!1),I=F>=0?c[F]:void 0,z=I?l.get(I):void 0;if(z&&z!==e.focusedSectionId()&&f(z))return}if(!e.focusedSectionId()){C<0&&(C=B(O.clientX,O.clientY,null,42,!1));let F=C>=0?c[C]:void 0,I=F?l.get(F):void 0;if(I&&f(I))return}if(C<0||C>=c.length){e.selection().size&&(h([]),i.onViewTargetChange?.(null));return}let T=c[C],P=ge[Math.round(r.seats.iState[C]??0)]??"available";if(P!=="available"&&P!=="selected"){i.onSeatInspect?.(T,P);return}if(e.selection().has(T)&&e.selection().size===1){h([]),i.onViewTargetChange?.(null);return}h([T]),p(T),s.seatPicked(T,l.get(T)),i.onSeatPick?.(T)}}}var cn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let f=0;f<this.count;f++){let h=t[f*3],p=t[f*3+2];h<n&&(n=h),h>o&&(o=h),p<r&&(r=p),p>i&&(i=p)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),u=f=>{let h=Math.min(this.cols-1,Math.max(0,Math.floor((t[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[f*3+2]-r)/this.cell)))*this.cols+h};for(let f=0;f<this.count;f++)l[u(f)+1]++;for(let f=0;f<c;f++)l[f+1]+=l[f];let d=new Int32Array(this.count),m=l.slice(0,c);for(let f=0;f<this.count;f++)d[m[u(f)]++]=f;this.cellStart=l,this.cellItems=d}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),d=Math.ceil(r/this.cell)+1,m=this.iPosition,f=0;for(let h=0;h<=d&&f<s;h++){let p=u-h,b=u+h,y=l-h,g=l+h;for(let x=p;x<=b&&f<s;x++){if(x<0||x>=this.rows)continue;let w=x===p||x===b;for(let A=y;A<=g&&f<s;A++){if(!w&&A!==y&&A!==g){A=g-1;continue}if(A<0||A>=this.cols)continue;let M=x*this.cols+A;for(let D=i[M],B=i[M+1];D<B&&f<s;D++){let N=a[D],H=m[N*3]-t,O=m[N*3+2]-n;H*H+O*O<=c&&(o[f++]=N)}}}}return f}};var ln=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Lt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new cn(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<xn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>gn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,gn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var un=require("ogl");function bi(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,d=0,m=-1,f=(A,M,D=28)=>{o.camera.position.set(A[0],A[1],A[2]),o.camera.lookAt(new un.Vec3(M[0],M[1],M[2])),o.camera.fov=D,o.camera.updateProjectionMatrix()},h=document.createElement("button");h.className="sl-3d-overview-control sl-3d-icon-control",h.type="button",h.textContent="\u2302",h.setAttribute("aria-label","Fit the active level or whole venue in view"),h.dataset.tooltip="Fit view",Object.assign(h.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 p=()=>{h.textContent="\u2302"};p();let b=A=>{m=A;let M=e.gpu();M&&(M.seatProgram.uniforms.uFocusFloor.value=A,M.solidProgram.uniforms.uFocusFloor.value=A,M.chairProgram.uniforms.uFocusFloor.value=A),e.showSectionSeatLabels(null)},y=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),h.style.display="",c.setVisible(!0),e.setFrozen(!1);let A=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!A),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),A){let M=A.focalWorld[0]-A.center[0],D=A.focalWorld[2]-A.center[2],B=Math.hypot(M,D)>A.radius*.12?Math.atan2(M,D):l,N={center:A.center,radius:A.radius,box:A.box},H={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(N,!1,B,!1,H):o.frameSoft(N,B,!1,H)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{d++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=A=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let M=n.seats.idToIndex.get(A);if(M===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(A),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),h.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let D=++d;e.removeArriveChip();let{eye:B,focal:N}=e.resolvedSeatViewPose(A,M),H=[o.camera.position.x,o.camera.position.y,o.camera.position.z],O=jn(H,B,N,n.bounds.center,n.bounds.radius),S=r.arriveAtSeatEye?B:O.finalPos,v=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,R=[O.waypoints[0],O.waypoints[1],S];if(c.setVisible(!1),e.reducedMotion())return f(S,N,v),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(A,D),Promise.resolve();let C=new un.Quat().copy(o.camera.quaternion),T=ei(o.camera,S,N);return s.requestRender(),i.start(R,C,T,2500,v).then(()=>{e.isDisposed()||D!==d||(a.cinematicPlayed(2500),o.resumeAfterFlight(N),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(A,D))})},w=A=>{let M=n.sections.find(H=>H.id===A);if(!M||M.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==M.floorIndex&&b(M.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(A);let D=M.focalWorld[0]-M.center[0],B=M.focalWorld[2]-M.center[2],N=Math.hypot(D,B)>M.radius*.12?Math.atan2(D,B):void 0;return o.frame({center:M.center,radius:Math.max(5,M.radius*.5)},!1,N),r.onSectionFocusChange?.(A),s.requestRender(),!0};return h.addEventListener("click",y),{overviewChip:h,layoutOverviewChip:p,flightGen:()=>d,focusedFloor:()=>m,applyFloorFocus:b,placeCameraFinal:f,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:w}}var cc={};function yi(e){let t=performance.now();return{model:ct(e),buildMs:performance.now()-t,source:"main"}}function gi(e){return typeof Worker>"u"?Promise.resolve(yi(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",cc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(yi(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var lc=Math.PI/180,uc=6,dc=500;function mc(e,t,n={}){let r=performance.now(),o=t.prepared?.model??ct(t),i=new sn(n.onAnalytics),a=new Array(o.seats.count);for(let[U,j]of o.seats.idToIndex)a[j]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let j=c.get(U.rowId);j?j.push(U.id):c.set(U.rowId,[U.id])}let l=new Map;for(let U of t.seats)l.set(U.id,U.sectionId);let u=t.doc.floors?.some(j=>(j.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&((j.height??0)>0||(j.rake??0)>0)),d=null,m=null,f=!1,h=!1,p=!1,b=new Map,y=null,g=null,x=null,w=new Map,A=null,M=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},D=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},B=!1,N=()=>B?me.focusedFloor():-1,H=()=>{d=jr(R.gl,o),m=new Jt(R.renderer,d.seatGeometry,d.chairGeometry,d.solidGeometry,o.seats.count),R.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),d.seatProgram.uniforms.uSeatRadius.value=ke*o.theme.seatScale,d.seatProgram.uniforms.uFocusFloor.value=N(),d.solidProgram.uniforms.uFocusFloor.value=N(),d.chairProgram.uniforms.uFocusFloor.value=N(),S.forceRegather()},O=!1,S=new ln({model:o,orbit:()=>C,gpu:()=>d}),v=U=>S.setDetailEnabled(U),R=new kt(e,{onContextLost:()=>{p||i.contextLost(),f=!0,Y.stop(),d=null,m=null},onContextRestored:()=>{H(),f=!1,p||i.contextRestored(),Y.requestRender()}}),C=new Ft(R.gl,R.canvas,()=>Y.requestRender(),()=>i.orbitEngaged());C.setAspect(R.aspect);let T=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),P=(()=>{if(T&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],j=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,j)>o.bounds.radius*.12?Math.atan2(U,j):void 0})(),F=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,P,n.portraitOverviewCrop===!0,F);let z=new en(C.camera),E=mi(e),L=new $t(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),G=o.labels,X=()=>hr(G,o.floors.length,N());L.setLabels(X());let V=null,k=U=>{if(V=U,L.setForcedDense(!!U),!U){L.setLabels(X());return}let j=t.seats.filter(q=>q.sectionId===U),W=new Set(j.map(q=>q.id)),ne=new Set(j.map(q=>q.rowId)),re=new Set(b.keys()),oe=new Set(j.filter(q=>re.has(q.id)).map(q=>q.id)),ce=X().filter(q=>q.kind!=="row"&&q.kind!=="seat"||(q.kind==="row"?ne.has(q.id.slice(4)):W.has(q.id.slice(5))&&(oe.size===0||oe.has(q.id.slice(5)))));if(o.seatCount<=6e3&&oe.size===0){L.setLabels(ce);return}let ue=oe.size?j.filter(q=>oe.has(q.id)):j,Ye=new Set(ue.map(q=>`seat:${q.id}`)),Oe=ue.flatMap(q=>{let fe=o.seats.idToIndex.get(q.id);if(fe===void 0)return[];let Me=fe*3;return[{id:`seat:${q.id}`,kind:"seat",text:q.displayLabel||q.label,anchor:[o.seats.iPosition[Me],o.seats.iPosition[Me+1]+(re.has(q.id)?1.05:.55),o.seats.iPosition[Me+2]]}]});L.setLabels([...ce.filter(q=>!Ye.has(q.id)),...Oe])};H();let Y=new Dt(U=>{if(f||!d||h)return!1;let W=z.active?z.update(performance.now()):C.update(),ne=N()>=0?o.floors[N()]:null,re=ne?.radius??o.bounds.radius,oe=so(C.currentDistance,re),ce=O?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.renderBounds;C.updateClipping(ce);let ue=ne?.center??o.renderBounds.center,Ye=ne?.radius??o.renderBounds.radius,Oe=(Se,ft)=>Math.hypot(C.camera.position.x-Se[0],C.camera.position.y-Se[1],C.camera.position.z-Se[2])<=ft*(S.detailVisible?1.8:1.55),q=Oe(ue,Ye);if(!q&&V){let Se=o.sections.find(ft=>ft.id===V);Se&&(q=Oe(Se.center,Math.max(12,Se.radius*2)))}S.detailVisible=q;let fe=d.seatProgram.uniforms;fe.uSeatScale.value=oe.scale,fe.uSeatFade.value=oe.fade;let Me=!!ne&&co(ne.seatCount,R.canvas.clientWidth||1,R.canvas.clientHeight||1),Rt=lo(o.seats.count,re,C.currentDistance,C.camera.fov,R.canvas.clientHeight||1),mt=S.detailVisible||Me||Rt?1:0,It=S.detailVisible||N()>=0||o.floors.length>1?1:0;return S.ease(U,mt,It),fe.uSeatDetail.value=S.seatDetailMix,d.solidProgram.uniforms.uStructureDetail.value=S.structureDetailMix,fe.uMinPixels.value=oe.minPixels,fe.uPixelToWorld.value=2*Math.tan(C.camera.fov*lc/2)/Math.max(1,R.pixelHeight),S.update(S.detailVisible),R.renderer.render({scene:d.background,clear:!0}),R.renderer.render({scene:d.main,camera:C.camera,clear:!1}),L.update(C.camera.projectionViewMatrix,R.canvas.clientWidth||1,R.canvas.clientHeight||1,C.currentDistance,re,[C.camera.position.x,C.camera.position.y,C.camera.position.z]),W||S.seatDetailMix!==mt||S.structureDetailMix!==It}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>mn.resize()):null;K?.observe(e);let J=U=>{let j=re=>{let oe=o.seats.idToIndex.get(re);return oe===void 0?void 0:o.seats.iState[oe]},{updates:W,next:ne}=Kr(b,U,j);if(b=ne,L.setSelectedSeatIds(b.keys()),V&&k(V),W.length){let re=An(o.seats,W);d&&d.uploadSeatStateRuns(re),Y.requestRender()}},Z=()=>A!==null?A:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=8,te=U=>{if(!n.getSeatView)return null;let j=w.get(U);if(!j)for(j=Promise.resolve(n.getSeatView(U)),w.set(U,j),j.catch(()=>{w.get(U)===j&&w.delete(U)});w.size>$;){let W=w.keys().next().value;if(W===void 0)break;w.delete(W)}return j},Ue=(U,j)=>{let W=s.get(U),ne=Math.max(0,Math.round(o.seats.iFloor[j]??0)),re=t.doc.floors?.[ne],oe=o.floors[ne],ce=re?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/_,y:oe.focalWorld[2]/_}:ce,Ye=W?.focalPoint?{x:W.focalPoint.x+ue.x-ce.x,y:W.focalPoint.y+ue.y-ce.y}:ue,Oe=[o.seats.iPosition[j*3],o.seats.iPosition[j*3+1],o.seats.iPosition[j*3+2]];return ti(Oe,Ye,re?.baseHeightM??0,W?.eyeHeightM)},je=()=>(e.clientWidth||R.canvas.clientWidth)<=520,Re,Ie=fi({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:je,isDisposed:()=>p,flightGen:()=>me.flightGen(),flyToSeat:U=>Kn(U),openPanorama:(U,j,W)=>Re(U,j,W)}),Ee=Ie.show,xe=Ie.remove,ve=Ie.layout,ie=hi({container:e,orbit:C,isNarrow:je}),Je=ie.element,Le=ie.setNavigationMode,Te=ie.setSeatViewLocked,Xe=ie.layout,dt=ie.utilityControls,me=bi({container:e,model:o,opts:n,orbit:C,cinematic:z,analytics:i,loop:Y,labelOverlay:L,stageAzimuth:P,overviewFraming:F,gpu:()=>d,isDisposed:()=>p,panorama:()=>y,setPanorama:U=>{y=U},setPanoramaSphereVisible:U=>{O=U},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:U=>{g=U},setFrozen:U=>{h=U},restorePanoramaLayer:D,reducedMotion:Z,resolvedSeatViewPose:Ue,showSectionSeatLabels:k,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:Le,showArriveChip:Ee,removeArriveChip:xe});B=!0;let dn=me.overviewChip,xi=me.layoutOverviewChip,vi=me.applyFloorFocus,Mi=me.focusOverview,Wn=me.cancelFlight,Kn=me.flyToSeat,qn=me.focusSectionCamera;dt.appendChild(dn),Re=ui({container:e,model:o,opts:n,analytics:i,orbit:C,loop:Y,seatsById:s,ensureSeatView:te,resolvedSeatViewPose:Ue,gpu:()=>d,gl:R.gl,isContextLost:()=>f,isDisposed:()=>p,flightGen:()=>me.flightGen(),setPanorama:U=>{y=U},getLoadAbort:()=>g,setLoadAbort:U=>{g=U},setPanoramaSphereVisible:U=>{O=U},setFrozen:U=>{h=U},raisePanoramaLayer:M,restorePanoramaLayer:D,getOverviewChip:()=>dn,labelOverlay:L,reducedMotion:Z,removeArriveChip:xe,showArriveChip:Ee});let _e=pi({glctx:R,orbit:C,model:o,seats:t.seats,opts:n,cinematic:z,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:uc,tapMs:dc,gpu:()=>d,pick:()=>m,seatViewLocked:()=>ie.seatViewLocked(),focusedSectionId:()=>V,selection:()=>b,cancelFlight:Wn,focusSectionCamera:qn,setSelection:J,ensureSeatView:te});R.canvas.addEventListener("pointerdown",_e.onDown),R.canvas.addEventListener("pointermove",_e.onMove),R.canvas.addEventListener("pointerup",_e.onUp),R.canvas.addEventListener("pointercancel",_e.onUp),Y.requestRender();let mn={setAvailability(U){let j=Wr(b,U),W=An(o.seats,j);W.length&&d&&d.uploadSeatStateRuns(W),Y.requestRender()},setSelection:J,flyToSeat:Kn,focusOverview:Mi,resize(){let{width:U,height:j}=R.resize();C.setAspect(U/Math.max(1,j)),ve(),Xe(),xi(),Y.requestRender()},stats(){return{...Y.stats(),drawCalls:d?d.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=Y.stats(),j=R.canvas.clientWidth||1,W=R.canvas.clientHeight||1,ne=o.bounds.center,re=Ve(C.camera.projectionViewMatrix,[ne[0],o.bounds.box.min[1],ne[2]],j,W),oe=Ve(C.camera.projectionViewMatrix,[ne[0],o.bounds.box.max[1],ne[2]],j,W),ce=o.bounds.box,ue=[ce.min[0],ce.max[0]].flatMap(q=>[ce.min[1],ce.max[1]].flatMap(fe=>[ce.min[2],ce.max[2]].map(Me=>Ve(C.camera.projectionViewMatrix,[q,fe,Me],j,W)))).filter(q=>Number.isFinite(q.x)&&Number.isFinite(q.y)&&Number.isFinite(q.depth)),Ye=ue.length?(()=>{let q=Math.min(...ue.map(We=>We.x)),fe=Math.max(...ue.map(We=>We.x)),Me=Math.min(...ue.map(We=>We.y)),Rt=Math.max(...ue.map(We=>We.y)),mt=Math.max(0,q),It=Math.min(j,fe),Se=Math.max(0,Me),ft=Math.min(W,Rt),Et=Math.max(0,It-mt),fn=Math.max(0,ft-Se);return{box:{x:mt,y:Se,width:Et,height:fn},horizontalFillRatio:Et/j,verticalFillRatio:fn/W,visibleAreaRatio:Et*fn/(j*W),clippedEdges:[...Me<0?["top"]:[],...fe>j?["right"]:[],...Rt>W?["bottom"]:[],...q<0?["left"]:[]]}})():void 0,Oe=String(R.gl.getParameter(R.gl.VERSION)??"");return{viewport:{width:j,height:W},context:{webgl2:/webgl\s*2/i.test(Oe),lost:f},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[C.camera.position.x,C.camera.position.y,C.camera.position.z],distance:C.currentDistance,verticalFovDeg:C.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:u,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&oe.visible?Math.abs(re.y-oe.y):0},labels:L.qualityEvidence(),framing:Ye}},getQualityReport(){return Zt(mn.getQualityEvidence())},loseContextForTest(){R.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some(W=>W.index===U))return!1;let j=U??-1;if(v(U!==null),Te(!1),vi(j),Le("orbit"),U===null)z.cancel(),Z()?C.frame(o.bounds,!1,P,n.portraitOverviewCrop===!0,F):C.frameSoft(o.bounds,P,n.portraitOverviewCrop===!0,F);else{let W=o.floors[U];if(W.seatCount>0){z.cancel();let ne=W.focalWorld[0]-W.center[0],re=W.focalWorld[2]-W.center[2],oe=Math.hypot(ne,re)>W.radius*.12?Math.atan2(ne,re):P;C.frame({center:W.center,radius:W.radius,box:W.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return Y.requestRender(),!0},zones(){return o.zones},focusZone(U){let j=o.zones.find(oe=>oe.id===U);if(!j||j.seatCount===0)return!1;v(!1),Te(!1),z.cancel(),Le("orbit"),k(null),n.onSectionFocusChange?.(null);let W=j.focalWorld[0]-j.center[0],ne=j.focalWorld[2]-j.center[2],re=Math.hypot(W,ne)>j.radius*.12?Math.atan2(W,ne):void 0;return C.frame({center:j.center,radius:j.radius*1.25},!1,re),Y.requestRender(),!0},sections(){return o.sections},focusSection(U){return qn(U)},rows(U){return U?o.rows.filter(j=>j.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(j=>j.rowId===U).map(j=>({id:j.id,label:j.displayLabel||j.label}))},focusRow(U){let j=o.rows.find(W=>W.id===U);return!j||j.seatCount===0?!1:(v(!0),Te(!1),z.cancel(),Le("pan"),j.sectionId&&(k(j.sectionId),n.onSectionFocusChange?.(j.sectionId)),C.frame({center:j.center,radius:Math.max(2.5,j.radius*.65)}),Y.requestRender(),!0)},setReducedMotionForTest(U){A=U},dispose(){p=!0,xe(),dn.remove(),Je.remove(),Wn(),Y.stop(),L.dispose(),K?.disconnect(),y&&(y.dispose(),y=null),D(),E(),R.canvas.removeEventListener("pointerdown",_e.onDown),R.canvas.removeEventListener("pointermove",_e.onMove),R.canvas.removeEventListener("pointerup",_e.onUp),R.canvas.removeEventListener("pointercancel",_e.onUp),C.dispose(),m&&m.dispose(),d&&d.dispose(),d=null,m=null,R.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),mn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
622
+ }`;function mi(e,t){let{position:n,uv:r,index:o}=dc(),i=new He.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new He.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new He.Program(e,{vertex:mc,fragment:hc,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new He.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var hi=.15;async function fi(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Ae,Math.min(Ae,t?.initialPitchDeg??0)),s=an,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let d=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let I=n.camera.position,D=n.focalWorld[0]-I.x,B=n.focalWorld[1]-I.y,U=n.focalWorld[2]-I.z,G=Math.hypot(D,U);G>.001&&(i=Math.atan2(D,-U)*180/Math.PI,a=Math.max(-Ae,Math.min(Ae,Math.atan2(B,G)*180/Math.PI)))}let h=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),D=nn(t,tn(I)),B;try{let U=t.resolveUrl?await t.resolveUrl(D.initialUrl):D.initialUrl;if(!U)throw new Error("panorama_asset_unavailable");B=await At(U,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{h=mi(n.gl,B)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}h.mesh.renderOrder=999,h.mesh.setParent(n.scene),D.upgradeUrl&&(d=on(()=>{(t.resolveUrl?t.resolveUrl(D.upgradeUrl):Promise.resolve(D.upgradeUrl)).then(G=>!G||l.signal.aborted?null:At(G,l.signal)).then(G=>{G&&(c||l.signal.aborted||(h?.setImage(G),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let I=n.camera.position;h?.mesh.position.set(I.x,I.y,I.z);let[D,B,U]=di(i,a);n.camera.lookAt([I.x+D,I.y+B,I.z+U]),n.requestRender()};b();let y=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(x),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(I)}let S=document.createElement("div");S.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(S.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(S),e.appendChild(y),x.focus({preventScroll:!0});let C=!1,M=0,k=0,O=0,V=new Map,H=()=>{let[I,D]=[...V.values()];return I&&D?Math.hypot(I.x-D.x,I.y-D.y):0},N=I=>{let D=Xn(I);D!==s&&(s=D,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},A=I=>{I.target!==x&&(V.set(I.pointerId,{x:I.clientX,y:I.clientY}),C=V.size===1,M=I.clientX,k=I.clientY,V.size===2&&(O=H()),y.setPointerCapture?.(I.pointerId),y.style.cursor="grabbing")},v=I=>{if(V.has(I.pointerId)){if(V.set(I.pointerId,{x:I.clientX,y:I.clientY}),V.size>=2){let D=H();O>0&&D>0&&N(s*(O/D)),O=D,C=!1;return}C&&(i+=(I.clientX-M)*hi,a=Math.max(-Ae,Math.min(Ae,a+(I.clientY-k)*hi)),M=I.clientX,k=I.clientY,b())}},w=I=>{V.delete(I.pointerId),O=V.size===2?H():0;let D=V.values().next().value;C=V.size===1,D?(M=D.x,k=D.y):y.style.cursor="grab";try{y.releasePointerCapture?.(I.pointerId)}catch{}},P=I=>{I.preventDefault(),N(s+I.deltaY*.04)};y.addEventListener("pointerdown",A),y.addEventListener("pointermove",v),y.addEventListener("pointerup",w),y.addEventListener("pointercancel",w),y.addEventListener("wheel",P,{passive:!1});let T=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),x.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),z.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-Ae,Math.min(Ae,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){N(s-5),I.preventDefault();return}else if(I.key==="-"){N(s+5),I.preventDefault();return}else return;I.preventDefault(),b()}};window.addEventListener("keydown",T);let L=0,E=(I,D)=>{if(!h){D?.();return}let B=I===1?0:1,U=performance.now(),G=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-U)/o);h?.setOpacity(B+(I-B)*F),n.requestRender(),F<1?L=requestAnimationFrame(G):D?.()};L=requestAnimationFrame(G)};E(1);let R=()=>{c||(c=!0,d(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(L),y.removeEventListener("pointerdown",A),y.removeEventListener("pointermove",v),y.removeEventListener("pointerup",w),y.removeEventListener("pointercancel",w),y.removeEventListener("wheel",P),window.removeEventListener("keydown",T),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),h?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},z={close(){if(c)return;let I=()=>{R(),r.onClose?.()};cancelAnimationFrame(L),E(0,I)},dispose:R};return x.addEventListener("click",()=>z.close()),z}function pi(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:d,isContextLost:m,isDisposed:h,flightGen:f,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:S,restorePanoramaLayer:C,getOverviewChip:M,labelOverlay:k,reducedMotion:O,removeArriveChip:V,showArriveChip:H}=e;return async(N,A,v)=>{b()?.abort();let w=new AbortController;y(w);let P=n.seats.idToIndex.get(N);if(P===void 0){i.syncFromCamera();return}let T=s.get(N)?.label??N,L=l(N,P),E=c(N);if(!E){w.abort(),b()===w&&y(null),i.syncFromCamera();return}x(!0),a.stop();let R;try{R=await E}catch{if(b()===w&&y(null),o.panoramaFailed(N,"source"),!h()&&v===f()){x(!1),i.resumeAfterFlight(L.focal),a.requestRender();let X=H(N,v,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(h()||v!==f()){w.abort(),b()===w&&y(null);return}V();let z=M(),I=()=>{w.abort(),b()===w&&y(null),p(null),g(!1),C(),z.style.display="",k.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(L.focal),a.requestRender();let X=H(N,f());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},D=R.generated===!0,B=li(R);S(),g(!D),z.style.display="none";let U=O()?0:A,G=u(),F=G&&!m()?await fi(t,D?null:R,{gl:d,scene:G.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:D?L.eye:void 0,focalWorld:L.focal},{fadeMs:U,seatLabel:T,disclosure:B,disclosurePrefix:D?"Live seat-eye view":"360\xB0 panorama",onClose:I,signal:w.signal}):null;if(h()||v!==f()){w.abort(),g(!1),b()===w&&y(null),F?.dispose(),z.style.display="",C();return}if(F)i.syncFromCamera(),k.setVisible(!1),x(!1),a.requestRender(),p(F);else if(D){C(),z.style.display="",x(!1),i.resumeAfterFlight(L.focal),a.requestRender(),p(null),g(!1),o.panoramaFailed(N,"mount");let X=H(N,f(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),b()===w&&y(null);return}else g(!1),o.panoramaFallback(N),p(ui(t,R,{fadeMs:U,seatLabel:T,disclosure:B,onClose:I,signal:w.signal}));o.panoramaOpened()}}var bi=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),sn=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=bi(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(bi()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:t})}panoramaFailed(t,n){this.emit("3d_panorama_failed",{seatId:t,phase:n})}panoramaFallback(t){this.emit("3d_panorama_fallback",{seatId:t})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function yi(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function gi(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let d=a();Object.assign(s.style,d?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(d,m,h=!1)=>{if(l(),e.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.get(d),b=p?.sectionId?n.sections.find(O=>O.id===p.sectionId):void 0,y=p?.label??d;f.setAttribute("aria-label",`Explore views near ${b?.label?`${b.label}, `:""}seat ${y}`);let g=document.createElement("span");g.textContent=["Live 3D seat view",b?.label,y].filter(Boolean).join(" \xB7 "),Object.assign(g.style,{maxWidth:"min(320px, calc(100vw - 32px))",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)"}),f.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let S=p?.rowId?i.get(p.rowId):void 0,C=S?.indexOf(d)??-1,M=C>=0?[S?.[C-1],S?.[C+1]]:[void 0,void 0],k=(O,V,H,N=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=O,A.setAttribute("aria-label",V),Object.assign(A.style,{minHeight:"44px",padding:N?"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"}),N||(A.style.minWidth="44px"),N&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",H),x.appendChild(A)};if(M[0]){let O=o.get(M[0])?.label??M[0];k("\u2039",`View previous seat ${O}`,()=>{e.flyToSeat(M[0])})}if(r.getSeatView){let O=r.seatViewActionLabel?.(d)??"Open 360\xB0 panorama";k(h?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${h?"Retry":O} from seat ${y}`,()=>{if(e.isDisposed()||m!==e.flightGen()){l();return}l(),e.openPanorama(d,400,m)},!0)}if(M[1]){let O=o.get(M[1])?.label??M[1];k("\u203A",`View next seat ${O}`,()=>{e.flyToSeat(M[1])})}return x.childElementCount?(t.appendChild(f),s=f,c(),f):null},remove:l,layout:c}}function xi(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let u=document.createElement("button");u.type="button",u.textContent="\u2212",u.setAttribute("aria-label","Zoom out of the 3D venue"),u.dataset.tooltip="Zoom out";let d=document.createElement("button");d.type="button",d.textContent="+",d.setAttribute("aria-label","Zoom into the 3D venue"),d.dataset.tooltip="Zoom in";for(let p of[c,l,u,d])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"});a.append(c,l),s.append(d,u);let m=p=>{n.setPrimaryDragMode(p);let b=p==="orbit";c.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),c.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>m("orbit")),l.addEventListener("click",()=>m("pan")),u.addEventListener("click",()=>n.zoomBy(1.22)),d.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let h=()=>{let p=r();o.style.display=i?"none":"flex",o.style.right=p?"12px":"14px",o.style.bottom=p?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=p?"none":"flex",d.style.display=p?"none":"",u.style.display=p?"none":""};return h(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:p=>{i=p,n.setInteractionEnabled(!p),h()},seatViewLocked:()=>i,layout:h}}function vi(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:d,cancelFlight:m,focusSectionCamera:h,setSelection:f,ensureSeatView:p}=e,b=0,y=0,g=0,x=-1,S=!1,C=!1,M=N=>{e.seatViewLocked()||x===-1&&(x=N.pointerId,b=N.clientX,y=N.clientY,g=performance.now(),S=!1,C=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},k=N=>{N.pointerId===x&&Math.hypot(N.clientX-b,N.clientY-y)>u&&(S=!0)},O=(N,A,v,w,P)=>{let T=t.canvas.getBoundingClientRect(),L=t.canvas.clientWidth||T.width||1,E=t.canvas.clientHeight||T.height||1,R=N-T.left,z=A-T.top,I=w*w,D=-1,B=I,U=1/0;for(let G of o){if(v&&G.sectionId!==v)continue;let F=r.seats.idToIndex.get(G.id);if(F===void 0)continue;if(P){let te=Math.round(r.seats.iState[F]??0);if(te!==0&&te!==3)continue}let X=F*3,K=Ge(n.camera.projectionViewMatrix,[r.seats.iPosition[X],r.seats.iPosition[X+1]+.55,r.seats.iPosition[X+2]],L,E);if(!K.visible)continue;let J=K.x-R,Z=K.y-z,q=J*J+Z*Z;(q<B||Math.abs(q-B)<1&&K.depth<U)&&(D=F,B=q,U=K.depth)}return D},V=(N,A)=>{let v=e.gpu(),w=e.pick();if(!v||!w)return-1;w.syncFromSeatProgram(v.seatProgram);let P=t.canvas.getBoundingClientRect(),T=t.renderer.dpr,{x:L,y:E}=Zr(N,A,P,T,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),R=Math.max(2,Math.round(8*T));return w.pick(n.camera,L,E,R)};return{onDown:M,onMove:k,onUp:N=>{if(N.pointerId!==x)return;let A=!S&&performance.now()-g<d;if(x=-1,C){C=!1;return}let v=e.gpu(),w=e.pick();if(!A||!v||!w)return;let P=V(N.clientX,N.clientY);if(e.focusedSectionId()&&P>=0){let E=c[P],R=E?l.get(E):void 0;if(R&&R!==e.focusedSectionId()&&h(R))return}if(e.focusedSectionId()&&P<0&&(P=O(N.clientX,N.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&P<0){let E=O(N.clientX,N.clientY,null,72,!1),R=E>=0?c[E]:void 0,z=R?l.get(R):void 0;if(z&&z!==e.focusedSectionId()&&h(z))return}if(!e.focusedSectionId()){P<0&&(P=O(N.clientX,N.clientY,null,42,!1));let E=P>=0?c[P]:void 0,R=E?l.get(E):void 0;if(R&&h(R))return}if(P<0||P>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let T=c[P],L=ge[Math.round(r.seats.iState[P]??0)]??"available";if(L!=="available"&&L!=="selected"){i.onSeatInspect?.(T,L);return}if(e.selection().has(T)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null);return}f([T]),p(T),s.seatPicked(T,l.get(T)),i.onSeatPick?.(T)}}}var cn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let h=0;h<this.count;h++){let f=t[h*3],p=t[h*3+2];f<n&&(n=f),f>o&&(o=f),p<r&&(r=p),p>i&&(i=p)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),u=h=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[h*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[h*3+2]-r)/this.cell)))*this.cols+f};for(let h=0;h<this.count;h++)l[u(h)+1]++;for(let h=0;h<c;h++)l[h+1]+=l[h];let d=new Int32Array(this.count),m=l.slice(0,c);for(let h=0;h<this.count;h++)d[m[u(h)]++]=h;this.cellStart=l,this.cellItems=d}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),d=Math.ceil(r/this.cell)+1,m=this.iPosition,h=0;for(let f=0;f<=d&&h<s;f++){let p=u-f,b=u+f,y=l-f,g=l+f;for(let x=p;x<=b&&h<s;x++){if(x<0||x>=this.rows)continue;let S=x===p||x===b;for(let C=y;C<=g&&h<s;C++){if(!S&&C!==y&&C!==g){C=g-1;continue}if(C<0||C>=this.cols)continue;let M=x*this.cols+C;for(let k=i[M],O=i[M+1];k<O&&h<s;k++){let V=a[k],H=m[V*3]-t,N=m[V*3+2]-n;H*H+N*N<=c&&(o[h++]=V)}}}}return h}};var ln=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Dt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new cn(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<xn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>gn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,gn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var un=require("ogl");function Mi(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,d=0,m=-1,h=(C,M,k=28)=>{o.camera.position.set(C[0],C[1],C[2]),o.camera.lookAt(new un.Vec3(M[0],M[1],M[2])),o.camera.fov=k,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.textContent="\u2302",f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.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 p=()=>{f.textContent="\u2302"};p();let b=C=>{m=C;let M=e.gpu();M&&(M.seatProgram.uniforms.uFocusFloor.value=C,M.solidProgram.uniforms.uFocusFloor.value=C,M.chairProgram.uniforms.uFocusFloor.value=C),e.showSectionSeatLabels(null)},y=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let C=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!C),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),C){let M=C.focalWorld[0]-C.center[0],k=C.focalWorld[2]-C.center[2],O=Math.hypot(M,k)>C.radius*.12?Math.atan2(M,k):l,V={center:C.center,radius:C.radius,box:C.box},H={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,O,!1,H):o.frameSoft(V,O,!1,H)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{d++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=C=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let M=n.seats.idToIndex.get(C);if(M===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(C),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let k=++d;e.removeArriveChip();let{eye:O,focal:V}=e.resolvedSeatViewPose(C,M),H=[o.camera.position.x,o.camera.position.y,o.camera.position.z],N=jn(H,O,V,n.bounds.center,n.bounds.radius),A=r.arriveAtSeatEye?O:N.finalPos,v=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,w=[N.waypoints[0],N.waypoints[1],A];if(c.setVisible(!1),e.reducedMotion())return h(A,V,v),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(C,k),Promise.resolve();let P=new un.Quat().copy(o.camera.quaternion),T=ii(o.camera,A,V);return s.requestRender(),i.start(w,P,T,2500,v).then(()=>{e.isDisposed()||k!==d||(a.cinematicPlayed(2500),o.resumeAfterFlight(V),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(C,k))})},S=C=>{let M=n.sections.find(H=>H.id===C);if(!M||M.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==M.floorIndex&&b(M.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(C);let k=M.focalWorld[0]-M.center[0],O=M.focalWorld[2]-M.center[2],V=Math.hypot(k,O)>M.radius*.12?Math.atan2(k,O):void 0;return o.frame({center:M.center,radius:Math.max(5,M.radius*.5)},!1,V),r.onSectionFocusChange?.(C),s.requestRender(),!0};return f.addEventListener("click",y),{overviewChip:f,layoutOverviewChip:p,flightGen:()=>d,focusedFloor:()=>m,applyFloorFocus:b,placeCameraFinal:h,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:S}}var fc={};function Si(e){let t=performance.now();return{model:ct(e),buildMs:performance.now()-t,source:"main"}}function wi(e){return typeof Worker>"u"?Promise.resolve(Si(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",fc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(Si(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var pc=Math.PI/180,bc=6,yc=500;function gc(e,t,n={}){let r=performance.now(),o=t.prepared?.model??ct(t),i=new sn(n.onAnalytics),a=new Array(o.seats.count);for(let[j,Y]of o.seats.idToIndex)a[Y]=j;let s=new Map(t.seats.map(j=>[j.id,j])),c=new Map;for(let j of t.seats){if(!j.rowId)continue;let Y=c.get(j.rowId);Y?Y.push(j.id):c.set(j.rowId,[j.id])}let l=new Map;for(let j of t.seats)l.set(j.id,j.sectionId);let u=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),d=null,m=null,h=!1,f=!1,p=!1,b=new Map,y=null,g=null,x=null,S=new Map,C=null,M=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},k=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},O=!1,V=()=>O?me.focusedFloor():-1,H=()=>{d=Qr(w.gl,o),m=new Jt(w.renderer,d.seatGeometry,d.chairGeometry,d.solidGeometry,o.seats.count),w.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),d.seatProgram.uniforms.uSeatRadius.value=ke*o.theme.seatScale,d.seatProgram.uniforms.uFocusFloor.value=V(),d.solidProgram.uniforms.uFocusFloor.value=V(),d.chairProgram.uniforms.uFocusFloor.value=V(),A.forceRegather()},N=!1,A=new ln({model:o,orbit:()=>P,gpu:()=>d}),v=j=>A.setDetailEnabled(j),w=new kt(e,{onContextLost:()=>{p||i.contextLost(),h=!0,X.stop(),d=null,m=null},onContextRestored:()=>{H(),h=!1,p||i.contextRestored(),X.requestRender()}}),P=new Lt(w.gl,w.canvas,()=>X.requestRender(),()=>i.orbitEngaged());P.setAspect(w.aspect);let T=(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&j.physical3dProvenance?.surfaceKind?.status==="inferred"),L=(()=>{if(T&&o.stages.length===0)return;let j=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(j,Y)>o.bounds.radius*.12?Math.atan2(j,Y):void 0})(),E=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,R=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;P.frame(o.bounds,!R&&n.skipInitialOverviewAnimation!==!0,L,n.portraitOverviewCrop===!0,E);let z=new en(P.camera),I=yi(e),D=new qt(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),B=o.labels,U=()=>gr(B,o.floors.length,V());D.setLabels(U());let G=null,F=j=>{if(G=j,D.setForcedDense(!!j),!j){D.setLabels(U());return}let Y=t.seats.filter(Q=>Q.sectionId===j),W=new Set(Y.map(Q=>Q.id)),ne=new Set(Y.map(Q=>Q.rowId)),ie=new Set(b.keys()),oe=new Set(Y.filter(Q=>ie.has(Q.id)).map(Q=>Q.id)),le=U().filter(Q=>Q.kind!=="row"&&Q.kind!=="seat"||(Q.kind==="row"?ne.has(Q.id.slice(4)):W.has(Q.id.slice(5))&&(oe.size===0||oe.has(Q.id.slice(5)))));if(o.seatCount<=6e3&&oe.size===0){D.setLabels(le);return}let ue=oe.size?Y.filter(Q=>oe.has(Q.id)):Y,Xe=new Set(ue.map(Q=>`seat:${Q.id}`)),Oe=ue.flatMap(Q=>{let he=o.seats.idToIndex.get(Q.id);if(he===void 0)return[];let Me=he*3;return[{id:`seat:${Q.id}`,kind:"seat",text:Q.displayLabel||Q.label,anchor:[o.seats.iPosition[Me],o.seats.iPosition[Me+1]+(ie.has(Q.id)?1.05:.55),o.seats.iPosition[Me+2]]}]});D.setLabels([...le.filter(Q=>!Xe.has(Q.id)),...Oe])};H();let X=new Ft(j=>{if(h||!d||f)return!1;let W=z.active?z.update(performance.now()):P.update(),ne=V()>=0?o.floors[V()]:null,ie=ne?.radius??o.bounds.radius,oe=so(P.currentDistance,ie),le=N?{center:[P.camera.position.x,P.camera.position.y,P.camera.position.z],radius:520}:o.renderBounds;P.updateClipping(le);let ue=ne?.center??o.renderBounds.center,Xe=ne?.radius??o.renderBounds.radius,Oe=(Se,ht)=>Math.hypot(P.camera.position.x-Se[0],P.camera.position.y-Se[1],P.camera.position.z-Se[2])<=ht*(A.detailVisible?1.8:1.55),Q=Oe(ue,Xe);if(!Q&&G){let Se=o.sections.find(ht=>ht.id===G);Se&&(Q=Oe(Se.center,Math.max(12,Se.radius*2)))}A.detailVisible=Q;let he=d.seatProgram.uniforms;he.uSeatScale.value=oe.scale,he.uSeatFade.value=oe.fade;let Me=!!ne&&co(ne.seatCount,w.canvas.clientWidth||1,w.canvas.clientHeight||1),Rt=lo(o.seats.count,ie,P.currentDistance,P.camera.fov,w.canvas.clientHeight||1),mt=A.detailVisible||Me||Rt?1:0,It=A.detailVisible||V()>=0||o.floors.length>1?1:0;return A.ease(j,mt,It),he.uSeatDetail.value=A.seatDetailMix,d.solidProgram.uniforms.uStructureDetail.value=A.structureDetailMix,he.uMinPixels.value=oe.minPixels,he.uPixelToWorld.value=2*Math.tan(P.camera.fov*pc/2)/Math.max(1,w.pixelHeight),A.update(A.detailVisible),w.renderer.render({scene:d.background,clear:!0}),w.renderer.render({scene:d.main,camera:P.camera,clear:!1}),D.update(P.camera.projectionViewMatrix,w.canvas.clientWidth||1,w.canvas.clientHeight||1,P.currentDistance,ie,[P.camera.position.x,P.camera.position.y,P.camera.position.z]),W||A.seatDetailMix!==mt||A.structureDetailMix!==It}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>mn.resize()):null;K?.observe(e);let J=j=>{let Y=ie=>{let oe=o.seats.idToIndex.get(ie);return oe===void 0?void 0:o.seats.iState[oe]},{updates:W,next:ne}=Jr(b,j,Y);if(b=ne,D.setSelectedSeatIds(b.keys()),G&&F(G),W.length){let ie=An(o.seats,W);d&&d.uploadSeatStateRuns(ie),X.requestRender()}},Z=()=>C!==null?C:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=8,te=j=>{if(!n.getSeatView)return null;let Y=S.get(j);if(!Y)for(Y=Promise.resolve(n.getSeatView(j)),S.set(j,Y),Y.catch(()=>{S.get(j)===Y&&S.delete(j)});S.size>q;){let W=S.keys().next().value;if(W===void 0)break;S.delete(W)}return Y},Ue=(j,Y)=>{let W=s.get(j),ne=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),ie=t.doc.floors?.[ne],oe=o.floors[ne],le=ie?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/_,y:oe.focalWorld[2]/_}:le,Xe=W?.focalPoint?{x:W.focalPoint.x+ue.x-le.x,y:W.focalPoint.y+ue.y-le.y}:ue,Oe=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return ai(Oe,Xe,ie?.baseHeightM??0,W?.eyeHeightM)},je=()=>(e.clientWidth||w.canvas.clientWidth)<=520,Re,Ie=gi({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:je,isDisposed:()=>p,flightGen:()=>me.flightGen(),flyToSeat:j=>Kn(j),openPanorama:(j,Y,W)=>Re(j,Y,W)}),Ee=Ie.show,xe=Ie.remove,ve=Ie.layout,ae=xi({container:e,orbit:P,isNarrow:je}),Je=ae.element,De=ae.setNavigationMode,Te=ae.setSeatViewLocked,Ye=ae.layout,dt=ae.utilityControls,me=Mi({container:e,model:o,opts:n,orbit:P,cinematic:z,analytics:i,loop:X,labelOverlay:D,stageAzimuth:L,overviewFraming:E,gpu:()=>d,isDisposed:()=>p,panorama:()=>y,setPanorama:j=>{y=j},setPanoramaSphereVisible:j=>{N=j},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:j=>{g=j},setFrozen:j=>{f=j},restorePanoramaLayer:k,reducedMotion:Z,resolvedSeatViewPose:Ue,showSectionSeatLabels:F,setNearFieldDetailEnabled:v,setSeatViewLocked:Te,setNavigationMode:De,showArriveChip:Ee,removeArriveChip:xe});O=!0;let dn=me.overviewChip,Pi=me.layoutOverviewChip,Ci=me.applyFloorFocus,Ai=me.focusOverview,Wn=me.cancelFlight,Kn=me.flyToSeat,Qn=me.focusSectionCamera;dt.appendChild(dn),Re=pi({container:e,model:o,opts:n,analytics:i,orbit:P,loop:X,seatsById:s,ensureSeatView:te,resolvedSeatViewPose:Ue,gpu:()=>d,gl:w.gl,isContextLost:()=>h,isDisposed:()=>p,flightGen:()=>me.flightGen(),setPanorama:j=>{y=j},getLoadAbort:()=>g,setLoadAbort:j=>{g=j},setPanoramaSphereVisible:j=>{N=j},setFrozen:j=>{f=j},raisePanoramaLayer:M,restorePanoramaLayer:k,getOverviewChip:()=>dn,labelOverlay:D,reducedMotion:Z,removeArriveChip:xe,showArriveChip:Ee});let _e=vi({glctx:w,orbit:P,model:o,seats:t.seats,opts:n,cinematic:z,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:bc,tapMs:yc,gpu:()=>d,pick:()=>m,seatViewLocked:()=>ae.seatViewLocked(),focusedSectionId:()=>G,selection:()=>b,cancelFlight:Wn,focusSectionCamera:Qn,setSelection:J,ensureSeatView:te});w.canvas.addEventListener("pointerdown",_e.onDown),w.canvas.addEventListener("pointermove",_e.onMove),w.canvas.addEventListener("pointerup",_e.onUp),w.canvas.addEventListener("pointercancel",_e.onUp),X.requestRender();let mn={setAvailability(j){let Y=$r(b,j),W=An(o.seats,Y);W.length&&d&&d.uploadSeatStateRuns(W),X.requestRender()},setSelection:J,flyToSeat:Kn,focusOverview:Ai,resize(){let{width:j,height:Y}=w.resize();P.setAspect(j/Math.max(1,Y)),ve(),Ye(),Pi(),X.requestRender()},stats(){return{...X.stats(),drawCalls:d?d.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let j=X.stats(),Y=w.canvas.clientWidth||1,W=w.canvas.clientHeight||1,ne=o.bounds.center,ie=Ge(P.camera.projectionViewMatrix,[ne[0],o.bounds.box.min[1],ne[2]],Y,W),oe=Ge(P.camera.projectionViewMatrix,[ne[0],o.bounds.box.max[1],ne[2]],Y,W),le=o.bounds.box,ue=[le.min[0],le.max[0]].flatMap(Q=>[le.min[1],le.max[1]].flatMap(he=>[le.min[2],le.max[2]].map(Me=>Ge(P.camera.projectionViewMatrix,[Q,he,Me],Y,W)))).filter(Q=>Number.isFinite(Q.x)&&Number.isFinite(Q.y)&&Number.isFinite(Q.depth)),Xe=ue.length?(()=>{let Q=Math.min(...ue.map(We=>We.x)),he=Math.max(...ue.map(We=>We.x)),Me=Math.min(...ue.map(We=>We.y)),Rt=Math.max(...ue.map(We=>We.y)),mt=Math.max(0,Q),It=Math.min(Y,he),Se=Math.max(0,Me),ht=Math.min(W,Rt),Et=Math.max(0,It-mt),hn=Math.max(0,ht-Se);return{box:{x:mt,y:Se,width:Et,height:hn},horizontalFillRatio:Et/Y,verticalFillRatio:hn/W,visibleAreaRatio:Et*hn/(Y*W),clippedEdges:[...Me<0?["top"]:[],...he>Y?["right"]:[],...Rt>W?["bottom"]:[],...Q<0?["left"]:[]]}})():void 0,Oe=String(w.gl.getParameter(w.gl.VERSION)??"");return{viewport:{width:Y,height:W},context:{webgl2:/webgl\s*2/i.test(Oe),lost:h},frame:{rendered:j.rendered,idle:j.idle},camera:{position:[P.camera.position.x,P.camera.position.y,P.camera.position.z],distance:P.currentDistance,verticalFovDeg:P.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:u,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:ie.visible&&oe.visible?Math.abs(ie.y-oe.y):0},labels:D.qualityEvidence(),framing:Xe}},getQualityReport(){return Zt(mn.getQualityEvidence())},loseContextForTest(){w.simulateContextLossCycle()},floors(){return o.floors},focusFloor(j){if(j!==null&&!o.floors.some(W=>W.index===j))return!1;let Y=j??-1;if(v(j!==null),Te(!1),Ci(Y),De("orbit"),j===null)z.cancel(),Z()?P.frame(o.bounds,!1,L,n.portraitOverviewCrop===!0,E):P.frameSoft(o.bounds,L,n.portraitOverviewCrop===!0,E);else{let W=o.floors[j];if(W.seatCount>0){z.cancel();let ne=W.focalWorld[0]-W.center[0],ie=W.focalWorld[2]-W.center[2],oe=Math.hypot(ne,ie)>W.radius*.12?Math.atan2(ne,ie):L;P.frame({center:W.center,radius:W.radius,box:W.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return X.requestRender(),!0},zones(){return o.zones},focusZone(j){let Y=o.zones.find(oe=>oe.id===j);if(!Y||Y.seatCount===0)return!1;v(!1),Te(!1),z.cancel(),De("orbit"),F(null),n.onSectionFocusChange?.(null);let W=Y.focalWorld[0]-Y.center[0],ne=Y.focalWorld[2]-Y.center[2],ie=Math.hypot(W,ne)>Y.radius*.12?Math.atan2(W,ne):void 0;return P.frame({center:Y.center,radius:Y.radius*1.25},!1,ie),X.requestRender(),!0},sections(){return o.sections},focusSection(j){return Qn(j)},rows(j){return j?o.rows.filter(Y=>Y.sectionId===j):o.rows},seatsInRow(j){return t.seats.filter(Y=>Y.rowId===j).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(j){let Y=o.rows.find(W=>W.id===j);return!Y||Y.seatCount===0?!1:(v(!0),Te(!1),z.cancel(),De("pan"),Y.sectionId&&(F(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),P.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),X.requestRender(),!0)},setReducedMotionForTest(j){C=j},dispose(){p=!0,xe(),dn.remove(),Je.remove(),Wn(),X.stop(),D.dispose(),K?.disconnect(),y&&(y.dispose(),y=null),k(),I(),w.canvas.removeEventListener("pointerdown",_e.onDown),w.canvas.removeEventListener("pointermove",_e.onMove),w.canvas.removeEventListener("pointerup",_e.onUp),w.canvas.removeEventListener("pointercancel",_e.onUp),P.dispose(),m&&m.dispose(),d&&d.dispose(),d=null,m=null,w.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),mn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});