@seatlayer/core 0.72.1 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{categoryInventory-Bt-0psga.d.ts → categoryInventory-Bcmnr6ZH.d.ts} +1 -1
  2. package/dist/{categoryInventory-BU1j8Q70.d.cts → categoryInventory-DueSAIBX.d.cts} +1 -1
  3. package/dist/{chunk-O5UWBFUT.js → chunk-3L4M7L5I.js} +1 -1
  4. package/dist/chunk-5JB4VW6B.js +1 -0
  5. package/dist/{chunk-YW2WGLRM.js → chunk-BAWUBGWY.js} +1 -1
  6. package/dist/{chunk-5U25QLSS.js → chunk-HDY2MYYH.js} +1 -1
  7. package/dist/chunk-JLYR66MT.js +1 -0
  8. package/dist/{chunk-KCFEFP6H.js → chunk-KN7GLEAI.js} +1 -1
  9. package/dist/{chunk-KPSJDH3N.js → chunk-N5NRM4NW.js} +1 -1
  10. package/dist/chunk-QLDV5ZGA.js +1 -0
  11. package/dist/{chunk-AM2LRFAY.js → chunk-UX67GDLV.js} +1 -1
  12. package/dist/{chunk-ALE2T36W.js → chunk-YFV4DSSX.js} +1 -1
  13. package/dist/{chunk-NKYPEBW3.js → chunk-ZMYRXJOA.js} +1 -1
  14. package/dist/core/chart-ops/index.cjs +1 -1
  15. package/dist/core/chart-ops/index.d.cts +11 -4
  16. package/dist/core/chart-ops/index.d.ts +11 -4
  17. package/dist/core/chart-ops/index.js +1 -1
  18. package/dist/core/inventory/index.cjs +1 -1
  19. package/dist/core/inventory/index.d.cts +11 -4
  20. package/dist/core/inventory/index.d.ts +11 -4
  21. package/dist/core/inventory/index.js +1 -1
  22. package/dist/core/layout/index.cjs +1 -1
  23. package/dist/core/layout/index.d.cts +5 -5
  24. package/dist/core/layout/index.d.ts +5 -5
  25. package/dist/core/layout/index.js +1 -1
  26. package/dist/core/quality/index.cjs +1 -1
  27. package/dist/core/quality/index.d.cts +3 -3
  28. package/dist/core/quality/index.d.ts +3 -3
  29. package/dist/core/quality/index.js +1 -1
  30. package/dist/core/render-assets/index.cjs +1 -1
  31. package/dist/core/render-assets/index.d.cts +1 -1
  32. package/dist/core/render-assets/index.d.ts +1 -1
  33. package/dist/core/render-assets/index.js +1 -1
  34. package/dist/core/seatConfidence.d.cts +1 -1
  35. package/dist/core/seatConfidence.d.ts +1 -1
  36. package/dist/core/sections/index.cjs +1 -1
  37. package/dist/core/sections/index.d.cts +5 -5
  38. package/dist/core/sections/index.d.ts +5 -5
  39. package/dist/core/sections/index.js +1 -1
  40. package/dist/{eventConfigurations-DfVUGyCg.d.ts → eventConfigurations-C7YAqkFR.d.ts} +1 -1
  41. package/dist/{eventConfigurations-3uSorYVC.d.cts → eventConfigurations-DwXdrjqj.d.cts} +1 -1
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.d.cts +102 -13
  44. package/dist/index.d.ts +102 -13
  45. package/dist/index.js +1 -1
  46. package/dist/{labeling-BiWB-8aq.d.ts → labeling-BUCj-kHU.d.ts} +1 -1
  47. package/dist/{labeling-9RWWmJhZ.d.cts → labeling-iugoy25P.d.cts} +1 -1
  48. package/dist/{layout-B6iOoPOv.d.cts → layout-DPJX6D9k.d.cts} +3 -3
  49. package/dist/{layout-B7URbtDR.d.ts → layout-Dv3R0Mpw.d.ts} +3 -3
  50. package/dist/{renderedQuality-C5dQiq97.d.ts → renderedQuality-CSHrmnHf.d.cts} +10 -2
  51. package/dist/{renderedQuality-BZsq3wDe.d.cts → renderedQuality-CfonzUpl.d.ts} +10 -2
  52. package/dist/{renderer-6sFRupj0.d.ts → renderer-C5avrVLy.d.ts} +11 -2
  53. package/dist/{renderer-CBOo1OZk.d.cts → renderer-Dn4Plcv9.d.cts} +11 -2
  54. package/dist/{sections-DU6YDYoZ.d.cts → sections-DhJ7TukF.d.cts} +1 -1
  55. package/dist/{sections-Cn_sk1Sx.d.ts → sections-uV7vqDHj.d.ts} +1 -1
  56. package/dist/{segmentedRowModel-CKmyHvKv.d.cts → segmentedRowModel-DWOjcPrU.d.cts} +1 -1
  57. package/dist/{segmentedRowModel-DbP7pWUk.d.ts → segmentedRowModel-DgSEzAYd.d.ts} +1 -1
  58. package/dist/{ticketRestrictions-CvS2oQ8v.d.ts → ticketRestrictions-DIh61MqE.d.ts} +2 -2
  59. package/dist/{ticketRestrictions-DkenahW2.d.cts → ticketRestrictions-JT87K45q.d.cts} +2 -2
  60. package/dist/{types-D6-wLa-m.d.cts → types-Dx4jA8aI.d.cts} +22 -4
  61. package/dist/{types-D6-wLa-m.d.ts → types-Dx4jA8aI.d.ts} +22 -4
  62. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  63. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  64. package/dist/view3d/index.cjs +1 -1
  65. package/dist/view3d/index.d.cts +3 -3
  66. package/dist/view3d/index.d.ts +3 -3
  67. package/dist/view3d/index.js +1 -1
  68. package/dist/view3d/scene/scene.worker.cjs +1 -1
  69. package/dist/view3d/scene/scene.worker.js +1 -1
  70. package/package.json +1 -1
  71. package/dist/chunk-4F7VBQCF.js +0 -1
  72. package/dist/chunk-HXYWP6NX.js +0 -1
  73. package/dist/chunk-XLGYWT5G.js +0 -1
@@ -17,7 +17,7 @@ out vec4 fragColor;
17
17
  void main() {
18
18
  vec3 rgb = texture(uPano, vUv).rgb;
19
19
  fragColor = vec4(rgb, uOpacity);
20
- }`});async function Ta(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=Cn,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let p=()=>{},d=[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 D=n.camera.position,V=n.focalWorld[0]-D.x,H=n.focalWorld[1]-D.y,j=n.focalWorld[2]-D.z,_=Math.hypot(V,j);_>.001&&(i=Math.atan2(V,-j)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(H,_)*180/Math.PI)))}let f=null;if(t){let D=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),V=Mn(t,Sn(D)),H;try{let j=t.resolveUrl?await t.resolveUrl(V.initialUrl):V.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");H=await Gt(j,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{f=Ia(n.gl,H)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),V.upgradeUrl&&(p=wn(()=>{(t.resolveUrl?t.resolveUrl(V.upgradeUrl):Promise.resolve(V.upgradeUrl)).then(_=>!_||l.signal.aborted?null:Gt(_,l.signal)).then(_=>{_&&(c||l.signal.aborted||(f?.setImage(_),n.requestRender()))}).catch(()=>{})}))}let m=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),y=()=>{let D=n.camera.position;f?.mesh.position.set(D.x,D.y,D.z);let[V,H,j]=Aa(i,a);n.camera.lookAt([D.x+V,D.y+H,D.z+j]),n.requestRender()};y();let b=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.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"}),b.appendChild(x),r.disclosure){let D=document.createElement("div");D.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(D.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)"}),b.appendChild(D)}let v=document.createElement("div");v.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(v.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"}),b.appendChild(v),e.appendChild(b),x.focus({preventScroll:!0});let C=!1,S=0,A=0,L=0,O=new Map,z=()=>{let[D,V]=[...O.values()];return D&&V?Math.hypot(D.x-V.x,D.y-V.y):0},B=D=>{let V=Mo(D);V!==s&&(s=V,n.camera.perspective({fov:s,aspect:n.camera.aspect}),y())},T=D=>{D.target!==x&&(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),C=O.size===1,S=D.clientX,A=D.clientY,O.size===2&&(L=z()),b.setPointerCapture?.(D.pointerId),b.style.cursor="grabbing")},w=D=>{if(O.has(D.pointerId)){if(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),O.size>=2){let V=z();L>0&&V>0&&B(s*(L/V)),L=V,C=!1;return}C&&(i+=(D.clientX-S)*Ea,a=Math.max(-Le,Math.min(Le,a+(D.clientY-A)*Ea)),S=D.clientX,A=D.clientY,y())}},R=D=>{O.delete(D.pointerId),L=O.size===2?z():0;let V=O.values().next().value;C=O.size===1,V?(S=V.x,A=V.y):b.style.cursor="grab";try{b.releasePointerCapture?.(D.pointerId)}catch{}},P=D=>{D.preventDefault(),B(s+D.deltaY*.04)};b.addEventListener("pointerdown",T),b.addEventListener("pointermove",w),b.addEventListener("pointerup",R),b.addEventListener("pointercancel",R),b.addEventListener("wheel",P,{passive:!1});let I=D=>{if(!c){if(D.key==="Tab"){D.preventDefault(),x.focus({preventScroll:!0});return}if(D.key==="Escape"){D.stopPropagation(),E.close();return}if(D.key==="ArrowLeft"||D.key==="ArrowRight")i+=D.key==="ArrowLeft"?-4:4;else if(D.key==="ArrowUp"||D.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(D.key==="ArrowUp"?4:-4)));else if(D.key==="+"||D.key==="="){B(s-5),D.preventDefault();return}else if(D.key==="-"){B(s+5),D.preventDefault();return}else return;D.preventDefault(),y()}};window.addEventListener("keydown",I);let G=0,k=(D,V)=>{if(!f){V?.();return}let H=D===1?0:1,j=performance.now(),_=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-j)/o);f?.setOpacity(H+(D-H)*F),n.requestRender(),F<1?G=requestAnimationFrame(_):V?.()};G=requestAnimationFrame(_)};k(1);let M=()=>{c||(c=!0,p(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(G),b.removeEventListener("pointerdown",T),b.removeEventListener("pointermove",w),b.removeEventListener("pointerup",R),b.removeEventListener("pointercancel",R),b.removeEventListener("wheel",P),window.removeEventListener("keydown",I),b.remove(),g?.isConnected&&g.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(d[0],d[1],d[2]),n.camera.perspective({fov:m,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},E={close(){if(c)return;let D=()=>{M(),r.onClose?.()};cancelAnimationFrame(G),k(0,D)},dispose:M};return x.addEventListener("click",()=>E.close()),E}var Ea,ka=wt(()=>{"use strict";Ra();wo();So();Ea=.15});var La={};Eo(La,{createOpenPanorama:()=>$u});function $u(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:p,isContextLost:d,isDisposed:f,flightGen:m,setPanorama:h,getLoadAbort:y,setLoadAbort:b,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:v,restorePanoramaLayer:C,getOverviewChip:S,labelOverlay:A,reducedMotion:L,removeArriveChip:O,showArriveChip:z}=e;return async(B,T,w)=>{y()?.abort();let R=new AbortController;b(R);let P=n.seats.idToIndex.get(B);if(P===void 0){i.syncFromCamera();return}let I=s.get(B)?.label??B,G=l(B,P),k=c(B);if(!k){R.abort(),y()===R&&b(null),i.syncFromCamera();return}x(!0),a.stop();let M;try{M=await k}catch{if(y()===R&&b(null),o.panoramaFailed(B,"source"),!f()&&w===m()){x(!1),i.resumeAfterFlight(G.focal),a.requestRender();let X=z(B,w,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||w!==m()){R.abort(),y()===R&&b(null);return}O();let E=S(),D=()=>{R.abort(),y()===R&&b(null),h(null),g(!1),C(),E.style.display="",A.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(G.focal),a.requestRender();let X=z(B,m());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},V=M.generated===!0,H=Pa(M);v(),g(!V),E.style.display="none";let j=L()?0:T,_=u(),F=_&&!d()?await Ta(t,V?null:M,{gl:p,scene:_.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:V?G.eye:void 0,focalWorld:G.focal},{fadeMs:j,seatLabel:I,disclosure:H,disclosurePrefix:V?"Live seat-eye view":"360\xB0 panorama",onClose:D,signal:R.signal}):null;if(f()||w!==m()){R.abort(),g(!1),y()===R&&b(null),F?.dispose(),E.style.display="",C();return}if(F)i.syncFromCamera(),A.setVisible(!1),x(!1),a.requestRender(),h(F);else if(V){C(),E.style.display="",x(!1),i.resumeAfterFlight(G.focal),a.requestRender(),h(null),g(!1),o.panoramaFailed(B,"mount");let X=z(B,m(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),y()===R&&b(null);return}else g(!1),o.panoramaFallback(B),h(Ca(t,M,{fadeMs:j,seatLabel:I,disclosure:H,onClose:D,signal:R.signal}));o.panoramaOpened()}}var _a=wt(()=>{"use strict";wo();ka()});var rd={};Eo(rd,{VENUE3D_QUALITY_REPORT_VERSION:()=>Fi,buildSceneModel:()=>bt,inspectVenue3DQualityEvidence:()=>bn,mountVenue3D:()=>od,prepareVenue3D:()=>Ha,prepareVenue3DFromChart:()=>ja});module.exports=ns(rd);var Fo=require("ogl");var os=/^#?([\da-f]{3}|[\da-f]{6})$/i;function rs(e){let t=os.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=rs(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function _n(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function is(e){return .2126*_n(e[0])+.7152*_n(e[1])+.0722*_n(e[2])}function ko(e){return is([e[0]*255,e[1]*255,e[2]*255])}function as(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 Pt(e,t){let n=as(e);return he(e,[n,n,n],t)}var Ae=["available","held","sold","selected","dimmed"];function Ct(e){let t=Ae.indexOf(e);return t<0?0:t}var Lo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function _o(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 Fn={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]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ve(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function ss(){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 Wt=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 Fo.Renderer({canvas:this.canvas,dpr:ss(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.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 lt=require("ogl"),me=Math.PI/180,Dn=15*me,On=80*me,ct=.12,Do=35,Oo=1.25,Kt=class{constructor(t,n,r,o){this.fovY=Do;this.target=new lt.Vec3;this.azimuth=-30*me;this.polar=55*me;this.distance=10;this.azT=-30*me;this.polT=55*me;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 lt.Vec3;this.panAnchor=new lt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new lt.Camera(t,{fov:Do,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(Dn,Math.min(On,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*me;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(Dn,Math.min(On,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*me/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),p=-i*l,d=-a*l;this.targetT.x+=(-t*s+n*p)*o,this.targetT.z+=(-t*c+n*d)*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*me/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*me,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*me;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??Oo)),this.minDist=Math.max(2,a*.12),this.maxDist=u*4,n?(this.azimuth=this.azT,this.polar=12*me,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*me/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))*me;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Oo))}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),p=-Math.cos(i),d=-l*Math.cos(o);if(Math.abs(p)>.999)return s;let f=-d,m=u,h=Math.hypot(f,m);f/=h,m/=h;let y=-m*p,b=m*u-f*d,g=f*p,x=Math.tan(r),v=Math.tan(n),C=1;for(let S=0;S<8;S++){let A=(S&1?c.max[0]:c.min[0])-t.center[0],L=(S&2?c.max[1]:c.min[1])-t.center[1],O=(S&4?c.max[2]:c.min[2])-t.center[2],z=A*u+L*p+O*d,B=Math.abs(A*f+O*m),T=Math.abs(A*y+L*b+O*g);C=Math.max(C,B/x-z,T/v-z)}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*ct,this.polar+=n*ct,this.distance+=r*ct,this.target.x+=o*ct,this.target.y+=i*ct,this.target.z+=a*ct,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(Dn,Math.min(On,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 qt=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}};function Vo(e,t,n){return Math.max(t,Math.min(n,e))}var ut=2.5,cs=1.15,At=6,dt=10,Bo=6,No=9.5,Go=.9,zo=2.2,Vn=30,Bn=4,Qt=8192;var pd=dt+Bn;function Uo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ut};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ut+o*(cs-ut)}}function Ho(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function jo(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 ls=[{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"}],bd=new Map(ls.map(e=>[e.key,e]));var us={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 Xo(e){let t=e?.[0];return t&&us[t]||"#3b82f6"}var ds=[{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"}],yd=new Map(ds.map(e=>[e.key,e]));var ms=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],gd=new Set(ms);var Wo=[{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}}],Ko=Wo.map(e=>e.key),fs=new Map(Wo.map(e=>[e.key,e]));function Yo(e){return typeof e=="string"&&fs.has(e)}function qo(e,t){return Yo(e)?e:Yo(t?.seatGlyph)?t.seatGlyph:"circle"}var Se=.02291666666666667,He=1/Se,ps=58,hs=ps*Se;var bs=3,Qo=0,Nn=120,ys=0,gs=45,xs=7,je=1.2;function Gn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function vs(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=xs?e:bs}function $t(e,t={}){let n=Gn(t.floorBaseHeightM,Qo,Nn,0),r=Math.min(Nn,n+vs(e.elevation)*hs),o=e.height===void 0?r:Gn(e.height,Qo,Nn,r),i=Gn(e.rake,ys,gs,0);return{height:o,rake:i}}var Zo=st(require("earcut"),1),Jo=st(require("polygon-clipping"),1);var Pd=Math.PI/180;function zn(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 It(e){return e.length?zn(e):null}function et(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 Rt(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 N=Se,Ss=.002;function Ms(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<Ss}var tt=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)}},en=class{constructor(){this.pos=new tt;this.nor=new tt;this.col=new tt;this.flr=new tt;this.mat=new tt;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){Ms(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 ws(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,p=r*s-o*a,d=Math.hypot(l,u,p)||1;return l/=d,u/=d,p/=d,[l,u,p]}function Ps(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,Zo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Un(e){return et(e)<0?[...e].reverse():e}var Cs=3;function As(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(f,m,h,y)=>Math.abs(r({x:(f.x+m.x)/2,y:(f.y+m.y)/2})-(h+y)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,p=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)),d=(f,m,h)=>{let y=Math.abs(r({x:(f+c)/2,y:(m+l)/2})-(h+u)/2);y>p&&(p=y)};return d((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),d((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),d((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),p}function Et(e,t,n,r,o){if(o<=0)return As(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(Et(e,i,s,r,o-1),Et(i,t,a,r,o-1),Et(s,a,n,r,o-1),Et(i,a,s,r,o-1))}function Tt(e,t,n,r,o,i,a,s){if(a>0){let d={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},m={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Tt(e,t,d,m,o,i,a-1,s),Tt(e,d,n,f,o,i,a-1,s),Tt(e,m,f,r,o,i,a-1,s),Tt(e,d,f,m,o,i,a-1,s);return}let c=[t.x*N,o(t),t.y*N],l=[n.x*N,o(n),n.y*N],u=[r.x*N,o(r),r.y*N];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let p=ws(c,l,u);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),e.tri(c,l,u,p,i)}var Is=8;function $o(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},p=t(u);if(Math.abs(p-(s+c)/2)>n){o(i,u,s,p,l-1),o(u,a,p,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),Is)}return r}function Zt(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 Jt=.001*He*.1;function le(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(et(t))<1e-4))return;let u=Zt($o(Zt(Un(t),Jt),r,c),Jt),p=n?.map(S=>Zt($o(Zt(Un(S),Jt),r,c),Jt)).filter(S=>S.length>=3&&Math.abs(et(S))>=1e-4),{pts:d,tris:f}=Ps(u,p),m=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<Cs;g++){let S=0;for(let A=0;A<f.length;A+=3){let L=Et(d[f[A]],d[f[A+1]],d[f[A+2]],r,g);L>S&&(S=L)}if(S<=c)break}for(let S=0;S<f.length;S+=3){let A=d[f[S]],L=d[f[S+1]],O=d[f[S+2]];Tt(e,A,L,O,r,m,g,l);let z=[A.x*N,o,A.y*N],B=[L.x*N,o,L.y*N],T=[O.x*N,o,O.y*N];e.tri(z,T,B,[0,-1,0],h)}let x=S=>{if(g<=0)return S;let A=1<<g,L=[];for(let O=0;O<S.length;O++){let z=S[O],B=S[(O+1)%S.length];for(let T=0;T<A;T++){let w=T/A;L.push({x:z.x+(B.x-z.x)*w,y:z.y+(B.y-z.y)*w})}}return L},v=zn(u),C=[{ring:x(u),flip:!1}];if(p)for(let S of p)S.length>=3&&C.push({ring:x(S),flip:!0});for(let{ring:S,flip:A}of C)for(let L=0;L<S.length;L++){let O=S[L],z=S[(L+1)%S.length],B=(z.x-O.x)*N,w=(z.y-O.y)*N,R=-B,P=Math.hypot(w,R)||1;w/=P,R/=P;let I=(O.x+z.x)/2-v.x,G=(O.y+z.y)/2-v.y,k=w*I+R*G;A&&(k=-k),k<0&&(w=-w,R=-R);let M=[w,0,R],E=[O.x*N,r(O),O.y*N],D=[z.x*N,r(z),z.y*N],V=[O.x*N,o,O.y*N],H=[z.x*N,o,z.y*N];e.tri(E,D,H,M,y,y,b),e.tri(E,H,V,M,y,b,b)}}function er(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 tn(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Un(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,p=l.y-c.y,d=Math.hypot(u,p)||1;i.push({x:p/d,y:-u/d})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],p=l.x+u.x,d=l.y+u.y,f=Math.hypot(p,d),m=()=>{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){m();continue}p/=f,d/=f;let h=p*l.x+d*l.y,y=1/Math.max(h,1e-6);if(!Number.isFinite(y)||y>n){m();continue}a.push([c.x+p*t*y,c.y+d*t*y])}if(a.length<3)return e;try{let s=Jo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let p of s){let d=Math.abs(et(p[0].map(([f,m])=>({x:f,y:m}))));d>l&&(l=d,c=p[0])}if(!c)return e;let u=c.map(([p,d])=>({x:p,y:d}));if(u.length>1){let p=u[0],d=u[u.length-1];Math.abs(p.x-d.x)<1e-9&&Math.abs(p.y-d.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function nn(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 kt(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 ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Rs=.44,Es=.15,Ts=.3,ks=.24;function tr(e){return e===void 0||!Number.isFinite(e)||e<=0?ks:Math.min(Ts,Math.max(Es,e*Rs))}var Hn=.21,Ls=.05,jn=.45,on=jn+Ls,_s=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,jn,1]},{part:ie.back,min:[-1,on,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Fs=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Ds=[{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 nr(){let e=[],t=[],n=[],r=[],o=(P,I,G)=>{let k=n.length,[M,E,D]=P,V=[E[0]-M[0],E[1]-M[1],E[2]-M[2]],H=[D[0]-M[0],D[1]-M[1],D[2]-M[2]],j=V[1]*H[2]-V[2]*H[1],_=V[2]*H[0]-V[0]*H[2],F=V[0]*H[1]-V[1]*H[0],X=Math.hypot(j,_,F);X>1e-9?(j/=X,_/=X,F/=X):[j,_,F]=I,j*I[0]+_*I[1]+F*I[2]<0&&(j=-j,_=-_,F=-F);for(let W of P)e.push(...W),t.push(j,_,F),n.push(G);r.push(k,k+1,k+2,k,k+2,k+3)},i=P=>{for(let I of Ds){let G=I.c.map(k=>k.map((M,E)=>M?P.max[E]:P.min[E]));o(G,I.n,P.part)}};for(let P of _s)i(P);for(let P of Fs)i(P);let a=jn,s=1.08,c=.47,l=.69,u=-.55,p=.08,d=-.48,f=.01,m=[-c,a,u],h=[c,a,u],y=[-c,a,p],b=[c,a,p],g=[-l,s,d],x=[l,s,d],v=[-l,s,f],C=[l,s,f];o([h,x,C,b],[1,0,0],ie.body),o([y,v,g,m],[-1,0,0],ie.body),o([v,C,x,g],[0,1,0],ie.body),o([m,h,b,y],[0,-1,0],ie.body),o([b,C,v,y],[0,0,1],ie.body),o([m,g,x,h],[0,0,-1],ie.body);let S=10,A=8,L=[0,1.205,-.23],O=[.42,.115,.38],z=n.length;for(let P=0;P<=A;P++){let I=Math.PI*P/A,G=Math.cos(I),k=Math.sin(I);for(let M=0;M<=S;M++){let E=Math.PI*2*M/S,D=k*Math.cos(E),V=k*Math.sin(E);e.push(L[0]+O[0]*D,L[1]+O[1]*G,L[2]+O[2]*V);let H=D/O[0],j=G/O[1],_=V/O[2],F=Math.hypot(H,j,_)||1;H/=F,j/=F,_/=F,t.push(H,j,_),n.push(ie.head)}}for(let P=0;P<A;P++)for(let I=0;I<S;I++){let G=z+P*(S+1)+I,k=G+S+1;r.push(G,k,G+1,G+1,k,k+1)}let B=new Float32Array(e),T=new Float32Array(t),w=new Float32Array(n),R=new Uint16Array(r);return{position:B,normal:T,part:w,index:R,vertexCount:n.length,indexCount:r.length}}function or(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 p=u-l;for(let d=l;d<u;d++){let[f,m]=r(d),h=f-i(d),y=m-a(d);if(p>=2){let b=Math.max(l,d-1),g=Math.min(u-1,d+1),x=i(g)-i(b),v=a(g)-a(b),C=Math.hypot(x,v);if(C>1e-6){let S=-v/C,A=x/C;S*h+A*y<0&&(S=-S,A=-A),h=S,y=A}}o[d]=h===0&&y===0?0:Math.atan2(h,y)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Oe=.22;function rr(e,t){let n=Ae[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 Os=.42;function Vs(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 m of e)m.x<r&&(r=m.x),m.y<o&&(o=m.y),m.x>i&&(i=m.x),m.y>a&&(a=m.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),p=Math.max(1,Math.ceil(c/l)+1),d=new Map,f=(m,h)=>{let y=Math.min(u-1,Math.max(0,Math.floor((m-r)/l)));return Math.min(p-1,Math.max(0,Math.floor((h-o)/l)))*u+y};for(let m=0;m<t;m++){let h=f(e[m].x,e[m].y),y=d.get(h);y?y.push(m):d.set(h,[m])}for(let m=0;m<t;m++){let h=e[m],y=Math.min(u-1,Math.max(0,Math.floor((h.x-r)/l))),b=Math.min(p-1,Math.max(0,Math.floor((h.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let v=b-x;v<=b+x;v++)if(!(v<0||v>=p))for(let C=y-x;C<=y+x;C++){if(C<0||C>=u||x>1&&Math.abs(v-b)<x&&Math.abs(C-y)<x)continue;let S=d.get(v*u+C);if(S)for(let A of S){if(A===m)continue;let L=Math.hypot(e[A].x-h.x,e[A].y-h.y);L<g&&(g=L)}}if(Number.isFinite(g)&&g<=x*l)break}n[m]=g}return n}function Bs(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-je):0}function ir(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),p=new Float32Array(a),d=new Float32Array(a),f=new Float32Array(a),m=new Float32Array(a*3),h=new Map,y=Vs(e);for(let b=0;b<a;b++){let g=e[b],v=(n?.seatPitchU(b)??y[b])*N;u[b]=Number.isFinite(v)?Math.max(.06,Math.min(Oe,v*Os)):Oe,p[b]=tr(Number.isFinite(v)?v:void 0);let C=qo(g.glyph,{seatGlyph:i?.get(g.categoryKey)});d[b]=Ko.indexOf(C),f[b]=g.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=g.x*N,s[b*3+1]=n?n.seatDeckY(b):Bs(g),s[b*3+2]=g.y*N,c[b]=Ct(t?t(g):"available");let S=ee(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[b*3]=S[0],l[b*3+1]=S[1],l[b*3+2]=S[2],g.accessibility?.length){let A=ee(Xo(g.accessibility));A&&(m[b*3]=A[0],m[b*3+1]=A[1],m[b*3+2]=A[2])}h.set(g.id,b)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:m,idToIndex:h,iChairWidth:p,iGlyph:d,iPhysicalSeat:f,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Ns=64;function Xn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=Ct(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+Ns){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 Gs=.15,zs=1.6;function ar(e){return Vo(e??1,Gs,zs)}var Us=.15,Hs=.9,js=1.76;function Xs(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:Fn,seatStates:{...Lo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function sr(e){let t=Xs();if(!e)return t;let n=ee(e.background);if(n){t.background={top:ve(n,Hs),bottom:ve(n,js)};let a={};for(let[s,c]of Object.entries(Fn))a[s]=he(c,n,Us);t.structure=a}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=ar(o));let i=e.venue3d;if(i){let a=ee(i.deck),s=ee(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ee(i.seat),t.materials.shell=ee(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function cr(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function lr(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+a*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+a*e.end.y}}function ur(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[lr(e,.5)];let r=Array.from({length:n+1},(c,l)=>lr(e,l/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let l=r[c].x-r[c-1].x,u=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(l,u)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let l=i*c/(t-1);for(;s<o.length-1&&o[s]<l;)s+=1;let u=o[s-1],p=o[s],d=p===u?0:(l-u)/(p-u);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*d,y:r[s-1].y+(r[s].y-r[s-1].y)*d})}return a}function dr(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((d,f)=>d.segmentedRow.componentIndex-f.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((d,f)=>d.segmentedRow?.kind==="segmented-row-v1"&&d.segmentedRow.groupId===r&&d.segmentedRow.componentCount===a&&d.segmentedRow.componentIndex===f&&d.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(f===0?d.segmentedRow.boundaryBefore==="start":d.segmentedRow.boundaryBefore!=="start")&&d.segmentedRow.displayLabel===s.displayLabel)))continue;let l=i.reduce((d,f)=>d+f.seatCount,0),u=0,p=0;for(let d of i)d.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(d.id,{groupId:r,adjacencyOffset:u,displayOffset:p,displayLabel:s.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=d.seatCount,p+=d.seatCount}return t}var Ys="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Ws="abcdefghijklmnopqrstuvwxyz";function Ks(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function Yn(e,t=!1){let n=t?Ws:Ys;return Ks(Math.max(0,Math.floor(e)-1),n)}var qs=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function mr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of qs)for(;t>=r;)n+=o,t-=r;return n}function Qs(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function Wn(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let f=Math.ceil(c/2),m=i==="updown"?t<f?n+2*t:n-1+2*(c-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${a}${m}`}let l=i==="odd"||i==="even"?2:o,u=s!=null&&Number.isFinite(s)?s-(c-1)*l:n,p=r==="center"?Qs(c)[t]:r==="rtl"?c-1-t:t,d;switch(i){case"odd":{let f=u%2===1?u:u+1;d=String(f+p*2);break}case"even":{let f=u%2===0?u:u+1;d=String(f+p*2);break}case"roman":d=mr(u+p*o);break;case"letters-upper":d=Yn(u+p*o,!1);break;case"letters-lower":d=Yn(u+p*o,!0);break;default:d=String(u+p*o);break}return`${a}${d}`}function $s(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function fr(e,t,n){return n?.label??`${e.label}-${Wn(e,t)}`}function Kn(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(!n)return`${e.displayLabel??e.label}-${Wn(e,t)}`;let o=$s(n),i=n.displayOffset+t;return`${n.displayLabel}-${Wn(o,i)}`}function pr(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 mt(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 p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function Zs(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 hr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function qn(e,t){let n=1/0;for(let r of pr(e)){let o=mt(t,r.x,r.y);o<n&&(n=o)}for(let r of pr(t)){let o=mt(e,r.x,r.y);o<n&&(n=o)}return n}function Js(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 p=Math.hypot(u.x-n,u.y-r);p>o&&(o=p,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,p)=>({p:u,i:p,t:(u.x-n)*a+(u.y-r)*s})).sort((u,p)=>u.t-p.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function Qn(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,v=g.y-r;o+=x*x,a+=v*v,i+=x*v,s+=x*x*x,c+=v*v*v,l+=x*v*v,u+=v*x*x}let p=o*a-i*i;if(Math.abs(p)<1e-9)return null;let d=(s+l)/2,f=(c+u)/2,m=(d*a-f*i)/p,h=(f*o-d*i)/p,y=m+n,b=h+r;return!Number.isFinite(y)||!Number.isFinite(b)?null:{cx:y,cy:b}}var ec=.15;function tc(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,v=0;for(let C of g.pts)x+=C.x,v+=C.y;return{x:x/g.pts.length,y:v/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,v=g.y-r;o+=x*x,i+=x*v,a+=v*v}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,p;Math.abs(i)>1e-12?(u=l-a,p=i):o>=a?(u=1,p=0):(u=0,p=1);let d=Math.hypot(u,p);if(!(d>1e-12))return null;u/=d,p/=d;let f=1/0,m=-1/0,h=[];for(let g of e){let x=1/0,v=-1/0;for(let C of g.pts){let S=C.x*u+C.y*p;S<x&&(x=S),S>v&&(v=S),S<f&&(f=S),S>m&&(m=S)}h.push(v-x)}let y=m-f;return y>1e-9?(h.sort((g,x)=>g-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/y<=nc?{x:u,y:p}:null):null}var nc=.35;function rn(e,t,n,r){let o=new Map;for(let y of n){let b=t[y],g=b.rowId||`__seat-${y}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:b.x,y:b.y}),x.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,b]of o){let g=Js(b.pts,b.idx),x=0;for(let v of g.pts)x+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:y,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(y=>Zs(y.pts)),s=[];for(let y=0;y<i.length;y++){let b=1/0;for(let g=0;g<i.length;g++){if(y===g||hr(a[y],a[g])>=b)continue;let x=qn(i[y].pts,i[g].pts);x<b&&(b=x)}Number.isFinite(b)&&s.push(b)}s.sort((y,b)=>y-b);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let b=y+1;b<i.length;b++)hr(a[y],a[b])>l||qn(i[y].pts,i[b].pts)<=l&&(u[y].push(b),u[b].push(y));let p=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let b=p++,g=[y];for(i[y].blockId=b;g.length;){let x=g.pop();for(let v of u[x])i[v].blockId===-1&&(i[v].blockId=b,g.push(v))}}let d=new Map;for(let y of i){let b=d.get(y.blockId)??[];b.push(y),d.set(y.blockId,b)}let f=[];for(let y of i){if(y.pts.length<4)continue;let b=Qn(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||f.push({x:b.cx,y:b.cy}))}let m=f.length>=2?(()=>{let y=f.map(x=>x.x).sort((x,v)=>x-v),b=f.map(x=>x.y).sort((x,v)=>x-v),g=Math.floor(f.length/2);return{cx:y[g],cy:b[g]}})():null;if(m){let y=S=>Math.hypot(S.x-m.cx,S.y-m.cy),b=1/0,g=-1/0,x=[];for(let S of i){let A=1/0,L=-1/0;for(let O of S.pts){let z=y(O);z<A&&(A=z),z>L&&(L=z)}x.push(L-A),A<b&&(b=A),L>g&&(g=L)}let v=g-b;x.sort((S,A)=>S-A);let C=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(v>1e-9&&C/v<=ec){let S=i.map(I=>{let G=0;for(let k of I.pts)G+=y(k);return{row:I,radius:G/I.pts.length}}),A=0,L=0;for(let I of S)A+=I.radius,L+=I.row.focalDistance;A/=S.length,L/=S.length;let O=0;for(let I of S)O+=(I.radius-A)*(I.row.focalDistance-L);if(O<0)for(let I of S)I.radius=-I.radius;let B=1/0;for(let I of S)I.radius<B&&(B=I.radius);S.sort((I,G)=>I.radius-G.radius);let T=-1,w=-1/0,R=v/Math.max(1,S.length)*.5,P=[];for(let I of S)I.radius-w>R&&(T++,w=I.radius),I.row.ordinal=T,I.row.blockDepth=I.radius-B,P.push(I.row);return{sectionId:e,rows:P,blockCount:p}}}let h=[];for(let[,y]of d){let b=tc(y);if(b){let g=v=>{let C=0;for(let S of v.pts)C+=S.x*b.x+S.y*b.y;return C/v.pts.length};y.sort((v,C)=>g(v)-g(C)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let x=0;for(let v=0;v<y.length;v++)v>0&&(x+=qn(y[v-1].pts,y[v].pts)),y[v].ordinal=v,y[v].blockDepth=x,h.push(y[v])}else{let g=1/0;for(let x of y)x.focalDistance<g&&(g=x.focalDistance);y.sort((x,v)=>x.focalDistance-v.focalDistance);for(let x=0;x<y.length;x++)y[x].ordinal=x,y[x].blockDepth=Math.max(0,y[x].focalDistance-g),h.push(y[x])}}return{sectionId:e,rows:h,blockCount:p}}var oc=/^\d{4}-\d{2}-\d{2}$/;function rc(e){let t=Date.parse(e);return Number.isFinite(t)?oc.test(e)?t+864e5:t:null}function ic(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=rc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function ac(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function sc(e){return e.status!=="draft"&&e.status!=="retracted"}function cc(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function br(e,t={}){return!!e&&sc(e)&&ac(e,t.activeConfigurationId,t.activeConfigurationVersion)&&cc(e,t.activeBasisSha256)&&ic(e,t.now)}function Sr(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var an=Math.PI/180;var Lt=16;function Zn(e,t,n,r){let o=n*an,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function lc(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return ur(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let l=0;l<t;l++)a.push(Zn(l*n,0,o,i));return a}let s=r/(t-1)*an,c=n/(2*Math.sin(Math.abs(s)/2));for(let l=0;l<t;l++){let u=l*s,p=c*Math.sin(u),d=-c+c*Math.cos(u);a.push(Zn(p,d,o,i))}return a}function uc(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function dc(e,t){let n=uc(e);return lc(e).map((r,o)=>{let i=n.get(o),a=Sr(i),s=fr(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:Kn(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(l=>l!==void 0&&l!==!1&&l!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function Mr(e){let t=[];for(let n of dc(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function mc(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function fc(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(u=>[u.index,u])),o=(u,p,d,f)=>{let m=r.get(u),h=Sr(m),y=m?.label??`${e.label}-${u+1}`,b=e.displayLabel??e.label;return{index:u,label:y,displayLabel:m?.displayLabel??`${b}-${u+1}`,x:p+(m?.dx??0),y:d+(m?.dy??0),categoryKey:m?.categoryKey??e.categoryKey,skipped:!!m?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:m?.wheelchairSpaceType,commercial:m?.commercial,glyph:m?.glyph,viewUrl:m?.viewFromSeatUrl,viewMeta:m?.viewFromSeatUrl?m.viewFromSeatMeta:void 0,labelStyle:m?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Lt,p=e.rotation*an,d=Math.max(0,Math.min(360,e.seatArc??360));if(d>=360||n===1){for(let y=0;y<n;y++){let b=p+y/n*2*Math.PI;t.push(o(y,e.center.x+u*Math.cos(b),e.center.y+u*Math.sin(b)))}return t}let f=d*an,m=(2*Math.PI-f)/2,h=p+m;for(let y=0;y<n;y++){let b=h+y/(n-1)*f;t.push(o(y,e.center.x+u*Math.cos(b),e.center.y+u*Math.sin(b)))}return t}let i=e.width??80,a=e.height??50,s=mc(e),c=["top","bottom","left","right"],l=0;for(let u of c){let p=s[u];for(let d=0;d<p;d++){let f,m;u==="top"?(f=-i/2+(d+.5)*i/p,m=-a/2-Lt):u==="bottom"?(f=-i/2+(d+.5)*i/p,m=a/2+Lt):u==="left"?(f=-i/2-Lt,m=-a/2+(d+.5)*a/p):(f=i/2+Lt,m=-a/2+(d+.5)*a/p);let h=Zn(f,m,e.rotation,e.center);t.push(o(l++,h.x,h.y,u))}}return t}function pc(e){return fc(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function hc(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function yr(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 bc(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 nt(e,t,n){return yr(e,t)&&!(n??[]).some(r=>yr(e,r)||bc(e,r))}function $n(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function yc(e){switch(e.type){case"row":{let t=Mr(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};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}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return $n(e.points);case"section":return $n(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?$n(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function gr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function gc(e,t){if(e.type!=="gaArea"||!gr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>gr(o,r[i]))}function xc(e,t){let n=e.filter(a=>a.type==="section"),r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=yc(t);return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(gc(t,a)||nt(o,a.outline,a.holes))):void 0)??n.find(a=>nt(o,a.outline,a.holes))}function xr(e,t,n,r,o,i,a,s,c){let l=[],u=dr(e),p=m=>!m?.eventConfigurationId||m.eventConfigurationId===r&&(m.eventConfigurationVersion===void 0||m.eventConfigurationVersion===c),d=m=>br(m,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),f=(m,h)=>d(m)?{...m,coverage:h}:void 0;for(let m of e){let h=[];if(m.type==="row"?h=Mr(m):m.type==="table"?h=pc(m):m.type==="booth"&&(h=hc(m)),!h.length)continue;for(let v of h)v.viewUrl&&!p(v.viewMeta)&&(v.viewUrl=void 0,v.viewMeta=void 0);if(m.type==="row"){let v=u.get(m.id);if(v){let C=new Map((m.overrides??[]).map(S=>[S.index,S]));for(let S of h){let A=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(A))continue;S.logicalRowId=v.groupId,S.logicalSeatIndex=v.adjacencyOffset+A,C.get(A)?.displayLabel||(S.displayLabel=Kn(m,A,v)),!S.viewUrl&&v.viewFromSeatUrl&&p(v.viewFromSeatMeta)&&(S.viewUrl=v.viewFromSeatUrl,S.viewMeta=v.viewFromSeatMeta);let L=C.get(A)?.confidenceEvidence;S.confidenceEvidence=f(L,"exact-seat")??f(m.confidenceEvidence,"row-representative")??f(v.confidenceEvidence,"row-representative")}}}let y=xc(e,m),b=y?.viewFromSeatUrl,x=(y?.zone?t?.find(v=>v.id===y.zone):void 0)?.focalPoint??n;for(let v of h){if(!v.confidenceEvidence){let C=Number(v.id.slice(v.id.lastIndexOf(":")+1)),S=(m.type==="row"||m.type==="table")&&Number.isInteger(C)?m.overrides?.find(A=>A.index===C)?.confidenceEvidence:void 0;v.confidenceEvidence=f(S,"exact-seat")??(m.type==="row"?f(m.confidenceEvidence,"row-representative"):void 0)}v.confidenceEvidence??=f(y?.confidenceEvidence,"section-representative")??(a?f(a.evidence,a.coverage):void 0),!v.viewUrl&&b&&p(y?.viewFromSeatMeta)&&(v.viewUrl=b,v.viewMeta=y?.viewFromSeatMeta),!v.viewUrl&&i&&p(i.meta)&&(v.viewUrl=i.url,v.viewMeta=i.meta),y&&(v.sectionId=y.logicalSectionId??y.id),y?.zone&&(v.zoneId=y.zone),x&&(v.focalPoint={...x})}l.push(...h)}return l}function wr(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=xr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&vr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let l of c)l.floorId=o.id;r.push(...c)}return r}let n=xr(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&vr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),n}function vr(e,t,n,r){let o=e.filter(u=>u.type==="section"),i=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!i||!t){for(let u of r)u.eyeHeightM=n+je;return}let a=new Array(r.length),s=new Map,c=new Map;for(let u=0;u<r.length;u++){let p=r[u],f=(p.sectionId?o.find(h=>h.id===p.sectionId)??o.find(h=>h.logicalSectionId===p.sectionId&&nt({x:p.x,y:p.y},h.outline,h.holes)):void 0)??o.find(h=>nt({x:p.x,y:p.y},h.outline,h.holes))??null;if(a[u]=f,!f)continue;s.has(f.id)||s.set(f.id,$t(f,{floorBaseHeightM:n}));let m=c.get(f.id);m?m.push(u):c.set(f.id,[u])}let l=new Array(r.length).fill(void 0);for(let[u,p]of c){let d=s.get(u);if(!d)continue;let f=d.rake>0?Math.tan(d.rake*Math.PI/180):0,m=rn(u,r,p,t);for(let h of m.rows){let y=h.blockDepth*Se*f,b=d.height+y;for(let g of h.seatIndices)l[g]=b}}for(let u=0;u<r.length;u++){let p=r[u],d=a[u];if(!d){p.eyeHeightM=n+je;continue}let f=s.get(d.id);p.eyeHeightM=(l[u]??f.height)+je}}function vc(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 Sc(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 m=Math.hypot(f.x-n,f.y-r);m>s&&(s=m,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 p=[...e].sort((f,m)=>(f.x-n)*c+(f.y-r)*l-((m.x-n)*c+(m.y-r)*l)),d=0;for(let f of p){let m=Math.hypot(f.x-n,f.y-r);m>d&&(d=m)}return{pts:p,cx:n,cy:r,radius:d,depth:o}}function Pr(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,p=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;p<0?p=0:p>1&&(p=1);let d=Math.hypot(t-(a.x+p*c),n-(a.y+p*l));d<o&&(o=d)}return o}var sn=8;function Mc(e,t,n){let r=new Array(sn).fill(1/0),o=new Array(sn).fill(-1);for(let u=0;u<e.length;u++){let p=e[u],d=Math.hypot(t-p.cx,n-p.cy)-p.radius;for(let f=0;f<sn;f++)if(d<r[f]){for(let m=sn-1;m>f;m--)r[m]=r[m-1],o[m]=o[m-1];r[f]=d,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 p=Pr(e[u],t,n);for(let d=0;d<3;d++)if(p<i[d]){for(let f=2;f>d;f--)i[f]=i[f-1],a[f]=a[f-1];i[d]=p,a[d]=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 p=a[u];if(p<0||i[u]>s)continue;let d=1/(i[u]*i[u]);c+=d*e[p].depth,l+=d}return l>0?c/l:e[a[0]].depth}function wc(e){let t=(r,o)=>Mc(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=Pr(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 Cr(e,t){let n=[];for(let r of e){let o=Sc(r.points,t);o&&n.push(o)}return n.length<2?vc(t):(n.sort((r,o)=>r.depth-o.depth),wc(n))}var to=st(require("polygon-clipping"),1);var Er=st(require("earcut"),1);var Pc=.58,Ar=.01,Me=Oe*1.5*He,Cc=.5,Ac=.6;function Ic(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,p=Math.hypot(l,u);if(p<1e-9){r.push([0,0]);continue}l/=p,u/=p,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 Rc(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 Ir=Math.PI/12;function Ec(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 Tr(e,t){if(!e.length||!(t>0))return[];let n=Ec(e),r=(s,c,l,u)=>{let p=l-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let d=Math.max(1,Math.ceil(p/Ir)),f=t/Math.cos(p/d/2);for(let m=0;m<=d;m++){let h=c+p*m/d;u.push({x:s.x+Math.cos(h)*f,y:s.y+Math.sin(h)*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=[],p=Math.max(3,Math.ceil(Math.PI*2/Ir)),d=(l+t)/Math.cos(Math.PI/p);for(let f=0;f<p;f++){let m=f/p*Math.PI*2;u.push({x:s+Math.cos(m)*d,y:c+Math.sin(m)*d})}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 Dr(a)}function Tc(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 p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function cn(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 p=1/0;for(let d=0;d<e.length;d++){if(d===o||Math.abs(e[d].y-e[o].y)<.001)continue;let f=t[d],m=Math.hypot(u.x-f.cx,u.y-f.cy)-f.rad;if(m>=p&&m>=s)continue;let h=Tc(e[d].pts,u.x,u.y);h<p&&(p=h),e[d].depth<e[o].depth&&h<s&&(s=h,c=e[d].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((u,p)=>u-p);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function kr(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],p=u.x-r.x,d=u.y-r.y,f=Math.hypot(p,d)||1;p/=f,d/=f;let m=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+d*m,y:u.y-p*m},{x:u.x-d*m,y:u.y+p*m}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let p=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,l=Rc(i,Math.max(c*Ac,Me));return{pts:l,nrm:Ic(l,r),front:Math.max(n[t].pitch*Pc,Me),back:Math.max(n[t].pitch*Cc,Me)}}var ft=1.5,Lr=.3;function Jn(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 p=1;p<e.length-1;p++){let d=e[p],f=a>1e-12?Math.abs((d.x-n.x)*i-(d.y-n.y)*o)/a:Math.hypot(d.x-n.x,d.y-n.y);f>s&&(s=f,c=p)}if(s<=t||c<0)return[n,r];let l=Jn(e.slice(0,c+1),t),u=Jn(e.slice(c),t);return[...l.slice(0,-1),...u]}function _r(e,t){if(e.length<4)return e;let n=Jn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Fr(e,t,n){if(e.length<2)return[];let r=n??cn(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=>kr(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+ft),y:g.pts[x].y-g.nrm[x][1]*(g.front+ft)}),p=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+ft),y:g.pts[x].y+g.nrm[x][1]*(g.back+ft)}),d=l[0],f=l[l.length-1],m=[];for(let g=0;g<d.pts.length;g++)m.push(u(d,g));for(let g of l)m.push(p(g,g.pts.length-1));for(let g=f.pts.length-1;g>=0;g--)m.push(p(f,g));for(let g=l.length-1;g>=0;g--)m.push(u(l[g],0));let h=Dr(m),y=1/0;for(let g of s)e[g].y<y&&(y=e[g].y);if(!Number.isFinite(y))continue;if(h.length>=3&&Math.abs(et(h))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return Rt(h,x.x,x.y)})){i.push({outline:_r(h,Lr),holes:[],topY:y});continue}for(let g of kc(l))i.push({outline:g,holes:[],topY:y})}return i}function kc(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+ft,a=n.back+ft;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=to.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(_r(i,Lr))}return r}catch{return[]}}function Dr(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 eo=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(!Rt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Rr(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 p=1;p+1<r.length;p++){let d=r[p],f=r[p+1];e.tri([u.x*N,o,u.y*N],[d.x*N,o,d.y*N],[f.x*N,o,f.y*N],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=to.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],p=[],d=[];for(let m=0;m<u.length-1;m++)p.push(u[m][0],u[m][1]),d.push([u[m][0],u[m][1]]);if(d.length<3)continue;let f=(0,Er.default)(p,void 0,2);for(let m=0;m<f.length;m+=3){let h=d[f[m]],y=d[f[m+1]],b=d[f[m+2]];e.tri([h[0]*N,o,h[1]*N],[y[0]*N,o,y[1]*N],[b[0]*N,o,b[1]*N],c,i)}}}function Or(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??cn(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 eo([[...i]]):null,p=f=>{e.setMaterial(2),f(),e.setMaterial(0)},d=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let m=t[f];if(m.patch&&m.patch.length>=3){let C=[...m.patch],S=s[f].belowY??r;if(d(()=>{if(l&&u)Rr(e,l,u,C,m.y,o.tread);else{let A=C[0];for(let L=1;L+1<C.length;L++){let O=C[L],z=C[L+1];e.tri([A.x*N,m.y,A.y*N],[O.x*N,m.y,O.y*N],[z.x*N,m.y,z.y*N],c,o.tread)}}}),m.y>S+Ar){let A=0,L=0;for(let O of C)A+=O.x,L+=O.y;A/=C.length,L/=C.length,p(()=>{for(let O=0;O<C.length;O++){let z=C[O],B=C[(O+1)%C.length],T=B.x-z.x,w=B.y-z.y,R=Math.hypot(T,w);if(R<1e-6)continue;let P=w/R,I=-T/R;(z.x-A)*P+(z.y-L)*I<0&&(P=-P,I=-I);let G=[P,0,I],k=[z.x*N,m.y,z.y*N],M=[B.x*N,m.y,B.y*N],E=[z.x*N,S,z.y*N],D=[B.x*N,S,B.y*N];e.tri(k,M,D,G,o.riser),e.tri(k,D,E,G,o.riser)}})}continue}let h=kr(t,f,s,n);if(!h)continue;let{pts:y,nrm:b,front:g,back:x}=h,v=s[f].belowY??r;for(let C=0;C+1<y.length;C++){let S=y[C],A=y[C+1],L=b[C],O=b[C+1];if(Math.hypot(A.x-S.x,A.y-S.y)<1e-6||L[0]===0&&L[1]===0||O[0]===0&&O[1]===0)continue;let z=[(S.x-L[0]*g)*N,m.y,(S.y-L[1]*g)*N],B=[(A.x-O[0]*g)*N,m.y,(A.y-O[1]*g)*N],T=[(S.x+L[0]*x)*N,m.y,(S.y+L[1]*x)*N],w=[(A.x+O[0]*x)*N,m.y,(A.y+O[1]*x)*N];if(d(()=>{l&&u?Rr(e,l,u,[{x:S.x-L[0]*g,y:S.y-L[1]*g},{x:A.x-O[0]*g,y:A.y-O[1]*g},{x:A.x+O[0]*x,y:A.y+O[1]*x},{x:S.x+L[0]*x,y:S.y+L[1]*x}],m.y,o.tread):(e.tri(z,B,w,c,o.tread),e.tri(z,w,T,c,o.tread))}),m.y>v+Ar){let R=[z[0],v,z[2]],P=[B[0],v,B[2]],I=[-L[0],0,-L[1]];p(()=>{e.tri(z,B,P,I,o.riser),e.tri(z,P,R,I,o.riser)})}}}}function Vr(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 ln(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var no=st(require("polygon-clipping"),1);function Lc(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Br(e,t){return e.filter(n=>n.type!=="shape"||Lc(n,t))}function Nr(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Br(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Br(e.objects,t),focal:n,baseHeightM:0,index:0}]}var _c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function pt(e){return Vr(e)??_c}function Gr(e,t){let n=tn(e.outline,Me),r=pt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&ln(r,pt(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=no.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,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function zr(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=no.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 Fc=.05,Ur=.05,Dc=.15,oo=25;function Hr(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 f=e[d];for(let m of f.objects){if(m.type==="table"&&u.add(m.id),m.type!=="section"||!m.outline||m.outline.length<3)continue;let h=tn(m.outline,Me);c.set(m.id,{section:m,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:m.id,floorIndex:d,box:pt(h),section:m,unit:f,outline:h})}}let p=new Map;for(let d of l){let f=p.get(d.floorIndex);f?f.push(d):p.set(d.floorIndex,[d])}for(let d=0;d<t.length;d++){let f=t[d],m=n?p.get(n[d])??[]:l,h=f.sectionId?m.find(b=>b.id===f.sectionId)??m.find(b=>b.section.logicalSectionId===f.sectionId&&nt({x:f.x,y:f.y},b.outline,b.section.holes)):void 0,y=h?[h]:m;for(let b of y){if(n&&b.floorIndex!==n[d]||!h&&(f.x<b.box.minX||f.x>b.box.maxX||f.y<b.box.minY||f.y>b.box.maxY||!nt({x:f.x,y:f.y},b.outline,b.section.holes)))continue;o[d]=b.id;let g=c.get(b.id);g.hasSeats=!0;let x=f.focalPoint??b.unit.focal,v=Math.hypot(f.x-x.x,f.y-x.y);v<g.frontU&&(g.frontU=v),g.seatIndices.push(d);let C=f.rowId||`__seat-${d}`,S=g.rows.get(C);S?S.push({x:f.x,y:f.y}):g.rows.set(C,[{x:f.x,y:f.y}]);break}}for(let[d,f]of c){let m=$t(f.section,{floorBaseHeightM:f.unit.baseHeightM}),h=f.unit.baseHeightM,y=m.rake>0?Math.tan(m.rake*Math.PI/180):0,b=m.rake<=.01&&m.height<=h+.001,g=f.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&m.rake>.01?!1:b,v=f.hasSeats?rn(d,t,f.seatIndices,f.unit.focal):{sectionId:d,rows:[],blockCount:0},S=v.rows.length<2?Cr([...f.rows.values()].map(k=>({points:k})),f.unit.focal):null,A=1/0;if(S){if(f.hasSeats)for(let k of f.rows.values())for(let M of k){let E=S.depthAt(M.x,M.y);E<A&&(A=E)}if(!f.hasSeats||!Number.isFinite(A)){A=1/0;for(let k of f.section.outline){let M=S.depthAt(k.x,k.y);M<A&&(A=M)}}}let L=h+Fc,O=Math.max(L,m.height),z=k=>{let M=Math.max(0,k-A)*Se,E=Math.min(M*y,oo);return Math.max(L,m.height+E)},B=k=>{let M=Math.max(0,k)*Se,E=Math.min(M*y,oo);return Math.max(L,m.height+E)},T=x?[]:v.rows.map(k=>({pts:k.pts,y:B(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...u.has(k.id)?{patch:Tr(k.pts,Me)}:{}})),w=T.length?T[0].y:O,R=T.map(k=>{let M=k.patch&&k.patch.length>=3?k.patch:k.pts,E=0,D=0;for(let j of M)E+=j.x,D+=j.y;let V=M.length||1;E/=V,D/=V;let H=0;for(let j of M){let _=Math.hypot(j.x-E,j.y-D);_>H&&(H=_)}return{cx:E,cy:D,rad:H}}),P=x?()=>O:T.length>=2?(k,M)=>{let E=1/0,D=w;for(let V=0;V<T.length;V++){let H=R[V];if(Math.hypot(k-H.cx,M-H.cy)-H.rad>=E)continue;let j=T[V].patch,_=j&&j.length>=3?Rt(j,k,M)?0:mt(j,k,M):mt(T[V].pts,k,M);_<E&&(E=_,D=T[V].y)}return D}:(k,M)=>S?z(S.depthAt(k,M)):O,I=[0,1,0],G=T.length>=2||x?()=>I:(k,M)=>{if(!S)return I;let E=S.depthAt(k,M);if(E<=A)return I;let D=(E-A)*Se;if(D*y>=oo||m.height+D*y<=L)return I;let[V,H]=S.gradientAt(k,M);if(V===0&&H===0)return I;let j=1/Math.hypot(y,1);return[-V*y*j,j,-H*y*j]};if(!x)for(let k of v.rows){let M=B(k.blockDepth);for(let E of k.seatIndices)a[E]=M}for(let k of v.rows){let M=[];for(let j=1;j<k.pts.length;j++){let _=Math.hypot(k.pts[j].x-k.pts[j-1].x,k.pts[j].y-k.pts[j-1].y);_>1e-6&&M.push(_)}M.sort((j,_)=>j-_);let E=M.length?M[Math.floor(M.length/2)]:1/0,D=1/0,V=k.pts[Math.floor(k.pts.length/2)];if(V)for(let j of v.rows){if(j===k||j.blockId!==k.blockId)continue;let _=mt(j.pts,V.x,V.y);_>1e-6&&_<D&&(D=_)}let H=Math.min(E,Math.max(D,E*.5));if(Number.isFinite(H)&&H>0)for(let j of k.seatIndices)s[j]=H}r.set(d,{sectionId:d,deckAt:P,normalAt:G,flat:x,bottomY:h,rowLevels:T,landingY:w})}for(let d=0;d<t.length;d++){let f=o[d],m=t[d];if(f){let y=a[d];i[d]=(y??r.get(f).deckAt(m.x,m.y))+Dc;continue}let h=m.eyeHeightM;i[d]=Number.isFinite(h)?Math.max(0,h-je):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ce={top:1,wallBottom:.5,bottomCap:.4};function Ve(e,t){if(!e)return t;let n=ve(Pt(e,.4),.62);return he(t,n,.72)}function jr(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[p,d]of a){let f=ee(n.get(p));f&&(s+=f[0]*d,c+=f[1]*d,l+=f[2]*d,u+=d)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function Xr(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var Rm=Math.PI*2;function Yr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Wr=st(require("polygon-clipping"),1);function Oc(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var un=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=pt(t),i=this.rings.filter((c,l)=>ln(o,this.boxes[l])&&Oc(n,this.levels[l])),a=[[r]];if(i.length)try{a=Wr.default.difference([r],...i).map(l=>l.map(u=>u.map(([p,d])=>[p,d])))}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,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Vc(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of e)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.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(p=>{let d=p.x-a,f=p.y-s;return{x:a+d*l-f*u,y:s+d*u+f*l}})}function ot(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=kt(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=nn(n,r,e.width/2,e.height/2)}return t?Vc(t,e.rotation):null}function _t(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"&&Yr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Bc=.08;function Kr(e,t){let n=ot(e),r=_t(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+Bc);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Xe(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function qr(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 Ft(e,t,n){return[Xe(e[0],e[1],t),Xe(e[0],e[1],n),Xe(e[3],e[2],n),Xe(e[3],e[2],t)]}function Qr(e,t,n){return[Xe(e[0],e[3],t),Xe(e[1],e[2],t),Xe(e[1],e[2],n),Xe(e[0],e[3],n)]}function Be(e,t,n,r,o,i){le(e,t,void 0,()=>n,r,o,i,ce)}var ro=2.4,Nc=.75,Gc=.15;function Dt(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,p])=>({x:t.x+u*a-p*s,y:t.y+u*s+p*a}))}function $r(e,t,n,r,o){let i=Dt(t);i&&le(e,i,void 0,()=>n+ro,n,Ve(r,o.boothTop),o.boothWall,ce)}function io(e){if(e.shape==="round"){let u=e.radius;return u?nn(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,p])=>({x:o.x+u*a-p*s,y:o.y+u*s+p*a}))}function Zr(e,t,n,r,o){let i=io(t);i&&le(e,i,void 0,()=>n+Nc,n,Ve(r,o.tableTop),o.tableWall,ce)}function Jr(e,t,n,r,o,i,a,s){let c=ot(t);if(!c)return;let l=s?s.kind==="stage":t.role==="stage",u=s?s.kind==="screen":t.role==="screen",p=s?{kind:l?"stage":"solid",heightM:s.topY-s.baseY}:_t(t),d=s?.baseY??n,f=s?.topY??n+r;if(l&&a){let g=1/0,x=-1/0,v=1/0,C=-1/0;for(let S of c)S.x<g&&(g=S.x),S.x>x&&(x=S.x),S.y<v&&(v=S.y),S.y>C&&(C=S.y);a.push({cx:(g+x)/2*N,cz:(v+C)/2*N,y:f,halfX:Math.max((x-g)/2*N,.5),halfZ:Math.max((C-v)/2*N,.5)})}let m=ee(t.fill),h=l&&m?he(o.stageTop,ve(Pt(m,.18),.9),.9):Ve(m,l?o.stageTop:o.decorTop),y=u?m:null,b=l?m?he(o.stageWall,ve(m,.58),.82):o.stageWall:u?y?he(ve(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Ve(ee(t.fill),o.decorWall);if(p.kind==="portal"&&c.length===4){let g=qr(c);Be(e,Ft(g,0,.16),f,d,h,b),Be(e,Ft(g,.84,1),f,d,h,b),Be(e,g,f,Math.max(d,f-.35),h,b);return}if(p.kind==="suite"&&c.length===4){let g=c.map((C,S)=>{let A=c[(S+1)%4],L=(C.x+A.x)/2,O=(C.y+A.y)/2;return Math.hypot(L-i.x,O-i.y)}),x=g.indexOf(Math.min(...g)),v=[0,1,2,3].map(C=>c[(x+C)%4]);Be(e,Ft(v,0,.08),f,d,h,b),Be(e,Ft(v,.92,1),f,d,h,b),Be(e,Qr(v,.88,1),f,d,h,b),Be(e,v,f,Math.max(d,f-.18),h,b);return}Be(e,c,f,d,h,b)}function ao(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,p=o/2;return[[-u,-p],[u,-p],[u,p],[-u,p]].map(([d,f])=>({x:i+d*c-f*l,y:a+d*l+f*c}))}function zc(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 ei(e,t,n,r){if(t.layer==="foreground")return;let o=ao(t);if(!o)return;let i=n+Gc,a=Ve(zc(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),le(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ce)}function ti(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Ve(r,o.gaTop);le(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ce)}var Uc=Math.PI/180,te=96,Hc=6,jc=60,Xc=150,ni=.2,Yc=.35;function Wc(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Uc;return n<0?n+360:n}function dn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function mn(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 oi(e,t){let n=e.filter(d=>d.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let d of n)for(let f of d.rows){for(let m of f.pts)o+=m.x,i+=m.y,a++;if(f.pts.length>=4){let m=Qn(f.pts);m&&Number.isFinite(m.cx)&&Number.isFinite(m.cy)&&r.push({x:m.cx,y:m.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let d=dn(r.map(b=>b.x)),f=dn(r.map(b=>b.y)),m=0;for(let b of n)for(let g of b.rows)for(let x of g.pts){let v=Math.hypot(x.x-s.x,x.y-s.y);v>m&&(m=v)}let h=0,y=m*.2;for(let b of n)for(let g of b.rows)for(let x of g.pts)Math.hypot(x.x-d,x.y-f)<y&&h++;Math.hypot(d-s.x,f-s.y)<=m&&h/a<.01&&(c={x:d,y:f})}let l=[];for(let d of n){let f={sectionId:d.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let m of d.rows)for(let h of m.pts){let y=Math.hypot(h.x-c.x,h.y-c.y),b=Math.min(te-1,Math.floor(Wc(c,h)/(360/te)));f.samples.push({r:y,bin:b,levelM:m.levelM}),y<f.rMin&&(f.rMin=y),y>f.rMax&&(f.rMax=y)}f.samples.length&&l.push(f)}if(!l.length)return null;l.sort((d,f)=>d.rMin+d.rMax-(f.rMin+f.rMax));let u=[];for(let d of l){let f=!1;for(let m of u){let h=Math.min(d.rMax,m.rMax)-Math.max(d.rMin,m.rMin),y=Math.min(d.rMax-d.rMin,m.rMax-m.rMin);if(y>1e-9&&h>=Yc*y){m.members.push(d),m.rMin=Math.min(m.rMin,d.rMin),m.rMax=Math.max(m.rMax,d.rMax),f=!0;break}}f||u.push({members:[d],rMin:d.rMin,rMax:d.rMax})}let p=[];for(let d of u){let f=new Array(te).fill(null);for(let w of d.members)for(let R of w.samples){let P=f[R.bin];P||(P={samples:[]},f[R.bin]=P),P.samples.push({r:R.r,levelM:R.levelM})}let m=f.map(w=>!!w);if(!m.filter(Boolean).length)continue;let y=[],b=[];for(let w of f){if(!w)continue;let R=1/0,P=-1/0;for(let I of w.samples)I.r<R&&(R=I.r),I.r>P&&(P=I.r);y.push(R),b.push(P)}let g=dn(y),x=dn(b);if(!(g>=ni*x)||!(x>0))continue;let v=[...y].sort((w,R)=>w-R);if(!(v[Math.floor(v.length*.1)]>=ni*x))continue;let S=f.map(w=>{if(!w)return null;let R=[...w.samples].sort((V,H)=>V.r-H.r),P=R[0].r,I=R[R.length-1].r,G=R[0].levelM,k=-1/0;for(let V of R)V.levelM>k&&(k=V.levelM);let M=[];for(let V of R){let H={r:V.r,l:V.levelM};for(;M.length&&Math.abs(M[M.length-1].r-H.r)<1e-9;){if(M[M.length-1].l<=H.l){H.skip=!0;break}M.pop()}if(!H.skip){for(;M.length>=2;){let j=M[M.length-2],_=M[M.length-1];if((_.r-j.r)*(H.l-j.l)-(_.l-j.l)*(H.r-j.r)<=0)M.pop();else break}M.push(H)}}let E=M.map(V=>V.r),D=M.map(V=>V.l);return{inner:P,outer:I,front:G,top:k,profile:{rs:E,ls:D}}}),A=m.slice();for(let w=0;w<te;w++){if(A[w])continue;let R=-1,P=-1,I=0;for(let F=1;F<=te;F++){let X=(w-F+te*2)%te;if(A[X]){R=X;break}}for(let F=1;F<=te;F++){let X=(w+F)%te;if(A[X]){P=X,I=F;break}}if(R<0||P<0)continue;let G=0;for(let F=1;F<=te;F++){let X=(w-F+te*2)%te;if(m[X]){G=F;break}}if(G-1+I>Hc)continue;let M=S[R],E=S[P],D=G/(G+I),V=M.inner+(E.inner-M.inner)*D,H=M.outer+(E.outer-M.outer)*D,j=M.front+(E.front-M.front)*D,_=M.top+(E.top-M.top)*D;S[w]={inner:V,outer:H,front:j,top:_,profile:{rs:[V,H],ls:[j,_]}}}for(let w=0;w<te;w++)S[w]&&(A[w]=!0);let L=360/te,O=[],z=A.filter(Boolean).length,B=[];if(z===te)B.push({start:0,len:te});else{let w=0;for(;A[w];)w=(w+1)%te;let R=-1;for(let P=0;P<=te;P++){let I=(w+P)%te,G=P<te&&A[I];if(G&&R<0)R=I;else if(!G&&R>=0){let k=(I-R+te)%te||te;B.push({start:R,len:k}),R=-1}}}for(let w of B){if(w.len*L<jc&&w.len<te)continue;let R=w.len===te,P=new Float64Array(w.len),I=new Float64Array(w.len),G=new Float64Array(w.len),k=new Float64Array(w.len),M=[];for(let F=0;F<w.len;F++){let X=S[(w.start+F)%te];P[F]=X.inner,I[F]=X.outer,G[F]=X.front,k[F]=X.top,M.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let E=mn(P,R),D=mn(I,R),V=mn(G,R),H=mn(k,R);for(let F=0;F<w.len;F++)E[F]>P[F]&&(E[F]=P[F]),D[F]<I[F]&&(D[F]=I[F]),E[F]>D[F]-1e-6&&(E[F]=Math.max(0,D[F]-1e-6)),H[F]<V[F]&&(H[F]=V[F]);let j={startBin:w.start,binCount:w.len,closed:R,innerR:E,outerR:D,frontLevelM:V,topLevelM:H,profiles:M},_=(F,X,W)=>{let q=M[F],Q=q.rs,Z=q.ls;if(X<=Q[0]){Z[0]>W&&(Z[0]=W);return}if(X>=Q[Q.length-1]){Z[Z.length-1]>W&&(Z[Z.length-1]=W);return}for(let re=0;re+1<Q.length;re++)if(X<=Q[re+1]){Z[re]>W&&(Z[re]=W),Z[re+1]>W&&(Z[re+1]=W);return}};for(let F=0;F<w.len;F++){let X=f[(w.start+F)%te];if(X)for(let W of X.samples){_(F,W.r,W.levelM);let q=R?(F-1+w.len)%w.len:F-1,Q=R?(F+1)%w.len:F+1;q>=0&&_(q,W.r,W.levelM),Q<w.len&&_(Q,W.r,W.levelM)}}O.push(j)}O.reduce((w,R)=>w+R.binCount*L,0)<Xc||p.push({arcs:O,sectionIds:d.members.map(w=>w.sectionId),innerRMedian:g,outerRMedian:x})}if(!p.length)return null;if(p.sort((d,f)=>d.innerRMedian-f.innerRMedian),t){let d=p[p.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*d)return null}return{centre:c,binCount:te,binStepDeg:360/te,rings:p}}function ri(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 p=t.profiles[u],d=p.rs,f=p.ls;if(r<=d[0])return f[0];if(r>=d[d.length-1])return f[f.length-1];for(let m=0;m+1<d.length;m++)if(r<=d[m+1]){let h=d[m+1]-d[m],y=h>1e-9?(r-d[m])/h:0;return f[m]+(f[m+1]-f[m])*y}return f[f.length-1]};return l(a)*(1-c)+l(s)*c}var Kc=.25,qc=1.2,Qc=.6,$c=.45,Zc=2.3,Jc=Math.PI/180;function rt(e,t,n){let r=n*Jc;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function el(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 tl=24;function nl(e,t,n,r,o,i,a,s){let c=n.binCount,l=tl,u=Se,p=i+.02,d=[];for(let T=0;T<c;T++){let w=(n.startBin+T+.5)*t.binStepDeg,R=new Float64Array(l+1);for(let P=0;P<=l;P++){let I=r[T]+(o[T]-r[T])*P/l;R[P]=Math.max(p,ri(t,n,w,I)-Kc)}d.push(R)}let f=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],m=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],h=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],y=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(T,w)=>{let R=(n.startBin+T+.5)*t.binStepDeg,P=r[T]+(o[T]-r[T])*w/l,I=rt(t.centre,P,R);return[I.x*u,d[T][w],I.y*u]};{let T=Math.tan(12*Math.PI/180);for(let w=0;w<6;w++){let R=!1;for(let I=0;I<c;I++)for(let G=l-1;G>=0;G--)d[I][G]>d[I][G+1]&&(d[I][G]=d[I][G+1],R=!0);let P=n.closed?c:c-1;for(let I=0;I<P;I++){let G=(I+1)%c;for(let k=0;k<=l;k++){let M=d[G][k]-d[I][k];if(Math.abs(M)>1)continue;let E=r[I]+(o[I]-r[I])*k/l,D=r[G]+(o[G]-r[G])*k/l,V=rt(t.centre,E,(n.startBin+I+.5)*t.binStepDeg),H=rt(t.centre,D,(n.startBin+G+.5)*t.binStepDeg),j=T*Math.hypot(H.x-V.x,H.y-V.y)*u;M>j?(d[G][k]=d[I][k]+j,R=!0):-M>j&&(d[I][k]=d[G][k]+j,R=!0)}}if(!R)break}}let g=1,x=(T,w)=>{for(let R=0;R<=l;R+=4)if(Math.abs(d[T][R]-d[w][R])>g)return!0;return Math.abs(d[T][l]-d[w][l])>g},v=Math.tan(38*Math.PI/180),C=T=>(o[T]-r[T])/l*u,S=(T,w)=>d[T][w+1]-d[T][w]>v*Math.max(1e-6,C(T)),A=(T,w)=>{let R=n.closed?(T-1+c)%c:Math.max(0,T-1),P=n.closed?(T+1)%c:Math.min(c-1,T+1);Math.abs(d[R][w]-d[T][w])>g&&(R=T),Math.abs(d[P][w]-d[T][w])>g&&(P=T);let I=Math.max(0,w-1),G=Math.min(l,w+1);I<w&&S(T,I)&&(I=w),G>w&&S(T,w)&&(G=w);let k=b(R,w),M=b(P,w),E=b(T,I),D=b(T,G),V=M[0]-k[0],H=M[1]-k[1],j=M[2]-k[2],_=D[0]-E[0],F=D[1]-E[1],X=D[2]-E[2],W=H*X-j*F,q=j*_-V*X,Q=V*F-H*_,Z=Math.hypot(W,q,Q);return Z>1e-12?(W/=Z,q/=Z,Q/=Z,q<0&&(W=-W,q=-q,Q=-Q),[W,q,Q]):[0,1,0]},L=(T,w)=>{let R=[T[0],i,T[2]],P=[w[0],i,w[2]],I=w[0]-T[0],G=w[2]-T[2],k=Math.hypot(I,G);if(!(k>1e-12))return;let M=[G/k,0,-I/k];e.tri(T,w,P,M,h,h,y),e.tri(T,P,R,M,h,y,y)},O=.05*He,z=T=>o[T]-r[T]<O,B=n.closed?c:c-1;for(let T=0;T<B;T++){let w=(T+1)%c;if(z(T)||z(w))continue;if(x(T,w)){let M=(n.startBin+T+1)*t.binStepDeg,E=(F,X)=>{let W=(r[T]+r[w])/2,q=(o[T]+o[w])/2,Q=W+(q-W)*X/l,Z=rt(t.centre,Q,M);return[Z.x*u,d[F][X],Z.y*u]};for(let F=0;F<l;F++){let X=b(T,F),W=b(T,F+1),q=E(T,F),Q=E(T,F+1),Z=A(T,F),re=A(T,F+1);e.triN(X,q,Q,Z,Z,re,f),e.triN(X,Q,W,Z,re,re,f);let Ie=b(w,F),we=b(w,F+1),Pe=E(w,F),_e=E(w,F+1),Fe=A(w,F),Ne=A(w,F+1);e.triN(Pe,Ie,we,Fe,Fe,Ne,f),e.triN(Pe,we,_e,Fe,Ne,Ne,f);let xe=E(T,F),de=E(T,F+1),Ge=E(w,F+1),xt=E(w,F),Ce=de[0]-xe[0],Qe=de[2]-xe[2],De=Math.hypot(Ce,Qe);if(De>1e-12){let zt=[Qe/De,0,-Ce/De];e.tri(xe,de,Ge,zt,h),e.tri(xe,Ge,xt,zt,h)}}let D=b(T,0),V=b(w,0),H=b(w,l),j=b(T,l),_=F=>[F[0],i,F[2]];e.tri(_(D),_(H),_(V),[0,-1,0],m),e.tri(_(D),_(j),_(H),[0,-1,0],m),L(D,V),L(j,H);continue}for(let M=0;M<l;M++){let E=A(T,M),D=A(w,M),V=A(w,M+1),H=A(T,M+1);if(S(T,M)||S(w,M)){let W=(de,Ge)=>{let xt=(n.startBin+de+.5)*t.binStepDeg,Ce=r[de]+(o[de]-r[de])*(M+.5)/l,Qe=rt(t.centre,Ce,xt);return[Qe.x*u,Ge,Qe.y*u]},q=b(T,M),Q=b(w,M),Z=W(T,d[T][M]),re=W(w,d[w][M]);e.triN(q,Q,re,E,D,D,f),e.triN(q,re,Z,E,D,E,f);let Ie=b(w,M+1),we=b(T,M+1),Pe=W(T,d[T][M+1]),_e=W(w,d[w][M+1]);e.triN(Pe,_e,Ie,H,V,V,f),e.triN(Pe,Ie,we,H,V,H,f);let Fe=re[0]-Z[0],Ne=re[2]-Z[2],xe=Math.hypot(Fe,Ne);if(xe>1e-12){let de=[-Ne/xe,0,Fe/xe];e.tri(Z,re,_e,de,h),e.tri(Z,_e,Pe,de,h)}continue}let j=b(T,M),_=b(w,M),F=b(w,M+1),X=b(T,M+1);e.triN(j,_,F,E,D,V,f),e.triN(j,F,X,E,V,H,f)}let R=b(T,0),P=b(w,0),I=b(w,l),G=b(T,l),k=M=>[M[0],i,M[2]];e.tri(k(R),k(I),k(P),[0,-1,0],m),e.tri(k(R),k(G),k(I),[0,-1,0],m),L(R,P),L(G,I)}if(!n.closed)for(let T of[0,c-1])for(let w=0;w<l;w++)L(b(T,w),b(T,w+1))}function ii(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 p of u.arcs){let d=new Float64Array(p.binCount),f=new Float64Array(p.binCount);for(let h=0;h<p.binCount;h++){let y=(p.startBin+h)%t.binCount,b=Math.max(0,p.innerR[h]-Me);d[h]=Math.max(b,a[y]+.001),f[h]=Math.max(d[h]+.001,p.outerR[h]+Me)}let m=0;for(let h=0;h<p.binCount;h++){let y=p.topLevelM[h]-r;y>m&&(m=y)}m>=qc&&nl(e,t,p,d,f,r,o,i);for(let h=0;h<p.binCount;h++){let y=(p.startBin+h)%t.binCount;f[h]>a[y]&&(a[y]=f[h])}}if(n.deriveShell===!1||el(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Qc*He,l=$c*He;for(let u of s.arcs){let p=[],d=[];for(let h=0;h<u.binCount;h++){let y=(u.startBin+h+.5)*t.binStepDeg,b=u.outerR[h]+Me+c;p.push(rt(t.centre,b,y)),d.push(rt(t.centre,b+l,y))}let f=-1/0;for(let h=0;h<u.binCount;h++)u.topLevelM[h]>f&&(f=u.topLevelM[h]);let m=()=>f+Zc;u.closed?le(e,d,[p.slice().reverse()],m,r,o.shellTop,o.shellWall,i):le(e,[...d,...p.slice().reverse()],void 0,m,r,o.shellTop,o.shellWall,i)}}function ai(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Ve(r,s.tierTop);if(!o)return;let u=y=>o.deckAt(y.x,y.y),p=Gr(t,a),d=p[0]??t.outline;if(o.rowLevels.length>=2){let y=cn(o.rowLevels),b=zr(Fr(o.rowLevels,n.focal,y),p),g=()=>[0,1,0];for(let v of b){let C=Math.max(c,v.topY-.02);for(let S of i.subtract(v.outline,C))le(e,S,v.holes,()=>C,c,l,s.tierWall,ce,void 0,g)}b.length||le(e,d,t.holes,()=>o.landingY,c,l,s.tierWall,ce);let x={tread:[l[0]*ce.top,l[1]*ce.top,l[2]*ce.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let v of p.length?p:[d])Or(e,o.rowLevels,n.focal,o.landingY,x,v,y);return}let f=o.flat?1/0:Ur,m=y=>o.normalAt(y.x,y.y),h=o.flat?o.landingY:void 0;for(let y of i.subtract(d,h))le(e,y,t.holes,u,c,l,s.tierWall,ce,f,m)}function ol(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 p=l.rowId||`__seat-${a}`,d=u.get(p);d||(d={pts:[],levelM:0,n:0},u.set(p,d)),d.pts.push({x:l.x,y:l.y}),d.levelM+=n.seatDeckY(a),d.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 si(e,t,n,r,o,i,a=!0){let s=ol(t,n,r);if(!s.length)return;let c=oi(s,t.focal);c&&(e.setMaterial(0),ii(e,c,{bottomY:t.baseHeightM,colors:{bandTop:ve(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ve(o.tierWall,1.15),shellWall:i??o.tierWall},ao:ce,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a}))}function ci(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 li(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 rl=1.15,il=2.75,al=4.5,sl=.85,cl=.5,ll=.26;function ui(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>=rl&&a.add("zone"),o<=(i?il:al)&&(a.add("section"),a.add("ga")),o<=sl&&(a.add("annotation"),a.add("booth")),o<=cl&&a.add("row"),o<=ll&&a.add("seat"),a}function di(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,l=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>l?o/2:Math.max(c,Math.min(l,e.y))}}function Ye(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],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let d=c/p,f=l/p,m=u/p,h=d>=-1.05&&d<=1.05&&f>=-1.05&&f<=1.05&&m<=1;return{x:(d*.5+.5)*n,y:(1-(f*.5+.5))*r,depth:m,visible:h}}function mi(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(so(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var ul=6;function so(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+ul):n;return o<a&&i<r}function fi(e,t,n){return e.length*t*.58+(n?14:0)}var dl={row:8,seat:14};function pi(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:dl}function hi(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 co(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(so(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(so(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var ml=6,fl=2.2,bi=.1,pl=.3,hl=1.8,bl=.9,yl=.55,gl=6e3;function yi(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 p of u.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let l=new Map;for(let u=0;u<r.length;u++){let p=r[u],d=o.seatOwner[u],f=p.zoneId??(d?c.get(d):void 0);if(!f)continue;let m=l.get(f);m||(m={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(f,m)),m.n++,p.x<m.minX&&(m.minX=p.x),p.y<m.minY&&(m.minY=p.y),p.x>m.maxX&&(m.maxX=p.x),p.y>m.maxY&&(m.maxY=p.y),m.sumY+=o.seatDeckY(u)}for(let u of a){let p=l.get(u.id),d=[];for(let[f,m]of c)m===u.id&&d.push(f);if(!p||p.n===0){s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*N,1.5,(u.focalPoint??i).y*N]});continue}s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:d,seatCount:p.n,center:[(p.minX+p.maxX)/2*N,p.sumY/p.n,(p.minY+p.maxY)/2*N],radius:.5*Math.hypot((p.maxX-p.minX)*N,(p.maxY-p.minY)*N)||1,focalWorld:[(u.focalPoint??i).x*N,1.5,(u.focalPoint??i).y*N]})}}return s}function gi(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],p=[];for(let d of s)d.seatCount!==0&&l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+ml,d.center[2]],color:t.zones?.find(f=>f.id===d.id)?.color});{let d=new Map,f=new Map;for(let m=0;m<r.length;m++){let h=o.seatOwner[m];if(!h)continue;let y=d.get(h);y||(y={n:0,x:0,y:0,deck:0},d.set(h,y)),y.n++,y.x+=r[m].x,y.y+=r[m].y,y.deck+=o.seatDeckY(m);let b=f.get(h);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(h,b)),r[m].x<b.minX&&(b.minX=r[m].x),r[m].x>b.maxX&&(b.maxX=r[m].x),r[m].y<b.minY&&(b.minY=r[m].y),r[m].y>b.maxY&&(b.maxY=r[m].y)}for(let m of n)for(let h of m.objects){if(h.type!=="section")continue;let y=d.get(h.id);if(!y||y.n===0)continue;let b=f.get(h.id),g=[y.x/y.n*N,y.deck/y.n,y.y/y.n*N],x=h.displayLabel||h.label||h.id;u.push({id:h.id,floorIndex:m.index,label:x,seatCount:y.n,center:g,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*N),focalWorld:[m.focal.x*N,m.baseHeightM+1.5,m.focal.y*N]});let v=t.floors?.[m.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[g[0],g[1]+fl,g[2]],floorIndex:m.index})}}{for(let m of n)for(let h of m.objects){if(h.type!=="gaArea")continue;let y=It(h.points);if(!y)continue;let b=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${b} \xB7 ${h.capacity.toLocaleString()}`:b,anchor:[y.x*N,m.baseHeightM+hl,y.y*N],floorIndex:m.index})}let d=new Map;for(let m=0;m<r.length;m++){let h=r[m],y=Math.hypot(h.x-c.x,h.y-c.y),b=d.get(h.rowId);(!b||y>b.far)&&d.set(h.rowId,{seat:h,index:m,far:y})}for(let[m,h]of d){let y=h.seat.label?h.seat.label.lastIndexOf("-"):-1,b=y>0?h.seat.label.slice(0,y):m;b&&l.push({id:`row:${m}`,kind:"row",text:b,anchor:[h.seat.x*N,o.seatDeckY(h.index)+bl,h.seat.y*N],floorIndex:a[h.index]})}let f=new Map;for(let m=0;m<r.length;m++){let h=r[m],y=h.label?h.label.lastIndexOf("-"):-1,b=f.get(h.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},f.set(h.rowId,b));let g=m*3,x=i.iPosition[g],v=i.iPosition[g+1],C=i.iPosition[g+2];b.n++,b.x+=x,b.y+=v,b.z+=C,b.minX=Math.min(b.minX,x),b.maxX=Math.max(b.maxX,x),b.minZ=Math.min(b.minZ,C),b.maxZ=Math.max(b.maxZ,C)}for(let[m,h]of f)p.push({id:m,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=gl)for(let m=0;m<r.length;m++){let h=r[m],y=h.displayLabel||h.label;y&&l.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*N,o.seatDeckY(m)+yl,h.y*N],floorIndex:a[m]})}}for(let d of n)for(let f of d.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let m=ot(f),h=m?It(m):null;if(!h||!f.label)continue;l.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[h.x*N,d.baseHeightM+_t(f).heightM+bi,h.y*N],color:f.fill,floorIndex:d.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*N,d.baseHeightM+bi,f.position.y*N],color:f.color,rotation:f.rotation,floorIndex:d.index})}else if(f.type==="booth"){let m=Dt(f);if(!m)continue;let h=It(m);if(!h)continue;l.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[h.x*N,d.baseHeightM+ro+pl,h.y*N],floorIndex:d.index})}return{labels:l,sections:u,rows:p}}function xi(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 vi(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 d=0;d<i.floor.length;d+=1){let f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[d]))),m=d*3,h=l[f];h.minX=Math.min(h.minX,i.position[m]),h.minY=Math.min(h.minY,i.position[m+1]),h.minZ=Math.min(h.minZ,i.position[m+2]),h.maxX=Math.max(h.maxX,i.position[m]),h.maxY=Math.max(h.maxY,i.position[m+1]),h.maxZ=Math.max(h.maxZ,i.position[m+2])}let u=new Map;for(let d=0;d<n.length;d++)for(let f of n[d].objects)f.type==="section"&&u.set(f.id,d);let p=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 d=0;d<r.length;d++){let f=o.seatOwner[d],m=(f!==null?u.get(f):void 0)??a[d];if(m===void 0)continue;let h=p[m],y=r[d];h.n++,y.x<h.minX&&(h.minX=y.x),y.y<h.minY&&(h.minY=y.y),y.x>h.maxX&&(h.maxX=y.x),y.y>h.maxY&&(h.maxY=y.y);let b=o.seatDeckY(d);h.sumX+=y.x*N,h.sumDeck+=b,h.sumZ+=y.y*N,h.minDeck=Math.min(h.minDeck,b),h.maxDeck=Math.max(h.maxDeck,b+1.6),s[d]=m}for(let d=0;d<n.length;d++){let f=p[d],m=t.floors?.[d],h=l[d],y=Math.min(f.n?f.minX*N:n[d].focal.x*N-1,Number.isFinite(h.minX)?h.minX:1/0),b=Math.max(f.n?f.maxX*N:n[d].focal.x*N+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(f.n?f.minY*N:n[d].focal.y*N-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(f.n?f.maxY*N:n[d].focal.y*N+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),v=Math.min(f.n?Math.min(n[d].baseHeightM,f.minDeck):n[d].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),C=Math.max(f.n?Math.max(f.maxDeck,v+.5):v+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[f.n?f.sumX/f.n:(y+b)/2,f.n?f.sumDeck/f.n:(v+C)/2,f.n?f.sumZ/f.n:(g+x)/2],A=Math.max(1,.5*Math.hypot(b-y,C-v,x-g));c.push({index:d,id:m?.id??`floor-${d}`,label:m?.name??(n.length>1?`Floor ${d+1}`:"Venue"),seatCount:f.n,center:S,radius:A,box:{min:[y,v,g],max:[b,C,x]},focalWorld:[n[d].focal.x*N,n[d].baseHeightM+1.5,n[d].focal.y*N]})}}return c}function lo(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=Dt(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=io(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=ao(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 Si(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=kt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);le(e,s,void 0,()=>0,-.4,i.ground,i.ground,ce)}else{let a=t.reduce((f,m)=>m.baseHeightM<f.baseHeightM?m:f);e.setFloor(a.index);let s=n.filter((f,m)=>r[m]===a.index),c=lo([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),p=kt(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),d=a.baseHeightM-.03;le(e,p,void 0,()=>d,d-.22,i.ground,i.ground,ce)}}function Mi(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,p=-1/0,d=(h,y,b)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,y),u=Math.max(u,y),c=Math.min(c,b),p=Math.max(p,b)};for(let h=0;h<e.position.length;h+=3)d(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let y=h*3,b=t.iPosition[y],g=t.iPosition[y+1],x=t.iPosition[y+2],v=Math.max(.35,t.iMaxRadius[h]??.35);d(b-v,g,x-v),d(b+v,g+1.6,x+v)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,p=o+i);let f=[(a+l)/2,(s+u)/2,(c+p)/2],m=Math.max(1,.5*Math.hypot(l-a,u-s,p-c));return{center:f,radius:m,minY:s,maxY:u}}function wi(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let v=0;v<e.count;v++){let C=v*3,S=e.iPosition[C],A=e.iPosition[C+2];S<a&&(a=S),S>c&&(c=S),A<s&&(s=A),A>l&&(l=A)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),l=Math.max(l,v.cz+v.halfZ);let u=n.minX*N,p=n.maxX*N,d=n.minY*N,f=n.maxY*N,m=u,h=p,y=d,b=f;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,l-s));m=Math.max(u,a-v),h=Math.min(p,c+v),y=Math.max(d,s-v),b=Math.min(f,l+v)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[m,g,y],max:[h,x,b]}}var xl=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,vl=/[\s"'<>`\\]/;function Sl(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return xl.test(e);if(vl.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Pi(e){let t=e.trim();return Sl(t)?t:null}var uo="seatlayer.event-configuration/1";var ht=100,Ml=120,wl=1e5,Pl=1e4,Cl=/^[a-f0-9]{64}$/,Al=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ot(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function it(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Il(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ci(e){return!Array.isArray(e)||e.length>wl||!e.every(t=>it(t,ht))?null:[...new Set(e)].sort()}function Rl(e){return!Ot(e)||!it(e.chartId,ht)||!it(e.version,ht)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Cl.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function mo(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function El(e){return Ot(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&mo(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Tl(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Pl)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Ot(s)||!it(s.id,ht)||!it(s.objectId,ht)||!n.has(s.objectId)||!Al.has(String(s.kind))||!mo(s.heightM,.05,50)||s.baseElevationM!==void 0&&!mo(s.baseElevationM,-10,100))return null;let c=El(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Pi(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function kl(e){let t=[];if(!Ot(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==uo&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${uo}`}),it(e.id,ht)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),it(e.label,Ml)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Il(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Rl(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=Ot(e.overlay)?e.overlay:null,o=Ci(r?.objectIds),i=Ci(r?.productionKillSeatIds),a=o?Tl(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:uo,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Ai(e){let t=kl(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Ii(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Ai(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let p of n)for(let d of p.objects)d.type==="shape"&&i.set(d.id,{shape:d,unit:p});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(p=>{let d=p.runtimeContentImageUrl;return[p.id,typeof d=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(d)?d:void 0]})),l=[];for(let p of o.value.overlay.productionElements??[]){let d=i.get(p.objectId),f=d?ot(d.shape):null,m=p.baseElevationM??0;if(!d||!f||f.length<3||!p.id||a.has(p.id)||s.has(p.objectId)||!Number.isFinite(p.heightM)||p.heightM<.05||p.heightM>50||!Number.isFinite(m)||m<-10||m>100)return r();a.add(p.id),s.add(p.objectId);let h=f.map(L=>L.x*N),y=f.map(L=>L.y*N),b=d.unit.baseHeightM+m,g=Math.min(...h),x=Math.max(...h),v=Math.min(...y),C=Math.max(...y),S,A=c.get(p.id)??p.contentImageUrl;if(p.kind==="screen"&&A)if(x-g>=C-v){let L=Math.abs(v-d.unit.focal.y*N)<=Math.abs(C-d.unit.focal.y*N)?v-.006:C+.006;S=[[g,b,L],[x,b,L],[g,b+p.heightM,L],[x,b+p.heightM,L]]}else{let L=Math.abs(g-d.unit.focal.x*N)<=Math.abs(x-d.unit.focal.x*N)?g-.006:x+.006;S=[[L,b,v],[L,b,C],[L,b+p.heightM,v],[L,b+p.heightM,C]]}l.push({id:p.id,objectId:p.objectId,kind:p.kind,floorIndex:d.unit.index,baseY:b,topY:b+p.heightM,bounds:{min:[g,b,v],max:[x,b+p.heightM,C]},occlusion:p.occlusion,...A?{contentImageUrl:A}:{},...S?{contentPlane:S}:{}})}let u=l.sort((p,d)=>p.id.localeCompare(d.id));return{byObjectId:new Map(u.map(p=>[p.objectId,p])),elements:u}}function ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e){return Array.isArray(e)?e:[]}function Ll(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ye(n))continue;let r=ye(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function fn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function _l(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Fl(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function Dl(e){let t=fn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:fn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:fn(e.rotation,4),o=e.scale===void 0?[1,1,1]:fn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let u=i/l,p=a/l,d=s/l,f=c/l,m=u+u,h=p+p,y=d+d,b=u*m,g=u*h,x=u*y,v=p*h,C=p*y,S=d*y,A=f*m,L=f*h,O=f*y;return[(1-(v+S))*o[0],(g+O)*o[0],(x-L)*o[0],0,(g-O)*o[1],(1-(b+S))*o[1],(C+A)*o[1],0,(x+L)*o[2],(C-A)*o[2],(1-(b+v))*o[2],0,n[0],n[1],n[2],1]}function Ol(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function Vl(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],u=i*l-a*c,p=a*s-o*l,d=o*c-i*s,f=t*u+n*p+r*d;if(Math.abs(f)<1e-12)return null;let m=1/f;return[u*m,p*m,d*m,(r*c-n*l)*m,(t*l-r*s)*m,(n*s-t*c)*m,(n*a-r*i)*m,(r*o-t*a)*m,(t*i-n*o)*m]}function Ri(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,a=e[6]*t+e[7]*n+e[8]*r,s=Math.hypot(o,i,a)||1;return o/=s,i/=s,a/=s,[o,i,a]}function Bl(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!ye(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Nl(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Gl(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function zl(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function Ul(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Bl(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ye(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=be(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||Ll(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||be(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(be(r.images).length||be(r.textures).length)return{ok:!1,issue:"external_resource"};let a=be(r.buffers);if(a.length!==1||!ye(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=be(r.accessors),c=be(r.bufferViews),l=be(r.meshes),u=be(r.nodes),p=be(r.scenes),d=typeof r.scene=="number"?r.scene:0;if(!ye(p[d]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(o.buffer,o.byteOffset,o.byteLength),m=(v,C,S)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(s[v]))return null;let A=s[v];if(A.type!==C||A.sparse!==void 0||A.normalized===!0||typeof A.count!="number"||!Number.isInteger(A.count)||A.count<1||typeof A.componentType!="number"||!S.includes(A.componentType)||typeof A.bufferView!="number")return null;let L=c[A.bufferView];if(!ye(L)||L.buffer!==0||typeof L.byteLength!="number"||!Number.isInteger(L.byteLength)||L.byteLength<0)return null;let O=Gl(A.type),z=Nl(A.componentType),B=typeof L.byteStride=="number"?L.byteStride:O*z,T=typeof L.byteOffset=="number"?L.byteOffset:0,w=typeof A.byteOffset=="number"?A.byteOffset:0,R=T+w,P=w+(A.count-1)*B+O*z;if(!Number.isInteger(B)||!Number.isInteger(T)||!Number.isInteger(w)||B<O*z||T<0||w<0||T+L.byteLength>o.byteLength||P>L.byteLength)return null;let I=[];for(let G=0;G<A.count;G++){let k=[];for(let M=0;M<O;M++){let E=zl(f,R+G*B+M*z,A.componentType);if(!Number.isFinite(E))return null;k.push(E)}I.push(k)}return I},h=[],y=[],b=0,g=new Set,x=(v,C)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(u[v])||g.has(v))return!1;g.add(v);let S=u[v],A=Dl(S);if(!A)return!1;let L=Fl(C,A),O=Vl(L);if(!O)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let z=l[S.mesh];if(!ye(z))return!1;for(let B of be(z.primitives)){if(!ye(B)||B.mode!==void 0&&B.mode!==4||!ye(B.attributes))return!1;let T=m(B.attributes.POSITION,"VEC3",[5126]),w=B.attributes.NORMAL===void 0?null:m(B.attributes.NORMAL,"VEC3",[5126]);if(!T||B.attributes.NORMAL!==void 0&&!w)return!1;let R=T.length;if(B.indices!==void 0){let I=typeof B.indices=="number"?s[B.indices]:null;R=ye(I)?I.count:void 0}if(typeof R!="number"||!Number.isInteger(R)||R%3!==0||(b+=R/3,b>1e5))return!1;let P=B.indices===void 0?T.map((I,G)=>[G]):m(B.indices,"SCALAR",[5121,5123,5125]);if(!P||P.length%3!==0||P.length!==R)return!1;for(let I=0;I<P.length;I+=3){let G=[P[I][0],P[I+1][0],P[I+2][0]];if(G.some(E=>!Number.isInteger(E)||E<0||E>=T.length))return!1;let k=G.map(E=>Ol(L,...T[E])),M=null;if(!w){let E=k[1][0]-k[0][0],D=k[1][1]-k[0][1],V=k[1][2]-k[0][2],H=k[2][0]-k[0][0],j=k[2][1]-k[0][1],_=k[2][2]-k[0][2];M=Ri([1,0,0,0,1,0,0,0,1],D*_-V*j,V*H-E*_,E*j-D*H)}for(let E=0;E<3;E++)h.push(...k[E]),y.push(...w?Ri(O,...w[G[E]]):M)}}}for(let z of be(S.children))if(!x(z,L))return!1;return g.delete(v),!0};for(let v of be(p[d].nodes))if(!x(v,_l()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||h.length!==b*9||y.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(h),normal:new Float32Array(y)}}function Ei(e){try{return Ul(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function bt(e){let{doc:t}=e,n=sr(t.theme),r=n.structure,o=Nr(t,e.eventConfigurationId??t.eventConfigurationId),i=Ii(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new en,c=null;if(e.registeredShellGlb){let P=Ei(e.registeredShellGlb);if(P.ok){let I=P.position.length/3,G=new Float32Array(P.position.length),k=n.materials.shell??r.tierWall;for(let M=0;M<I;M++){let E=P.normal[M*3+1],D=E<-.25?.4:.62+.38*Math.max(0,E);G[M*3]=k[0]*D,G[M*3+1]=k[1]*D,G[M*3+2]=k[2]*D}c={position:P.position,normal:P.normal,color:G,floor:new Float32Array(I).fill(-2),material:new Float32Array(I),count:I}}}let l=new Map;for(let P of o)for(let I of P.objects)l.set(I.id,P.index),I.type==="section"&&l.set(I.logicalSectionId??I.id,P.index);let u=a.map(P=>l.get(P.sectionId??"")??l.get(P.rowId??"")??0),p=lo(o,a);Si(s,o,a,u,p,r);let d=jr(t,a),f=new Map,m=new Map;for(let P of t.categories??[])f.set(P.key,P.color),P.seatGlyph&&m.set(P.key,P.seatGlyph);let h=[],y=Hr(o,a,u),b=new Float32Array(a.length);for(let P=0;P<o.length;P++){let I=o[P];s.setFloor(P);let G=new un,k=[],M=I.objects.filter(E=>E.type==="section"&&!!E.outline&&E.outline.length>=3);for(let E of I.objects)if(E.type==="section")ai(s,E,I,Xr(E,d),y.bySection.get(E.id),G,M,r);else if(E.type==="shape"){let D=i.byObjectId.get(E.id);s.setMaterial((D?.kind??E.role)==="screen"?1:0),Jr(s,E,I.baseHeightM,Kr(E,k),r,I.focal,h,D),s.setMaterial(0)}else E.type==="gaArea"?ti(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="booth"?$r(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="table"?Zr(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="decorImage"&&ei(s,E,I.baseHeightM,r);si(s,I,a,y,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((P,I)=>P+I.focal.x,0)/o.length,y:o.reduce((P,I)=>P+I.focal.y,0)/o.length}:t.focalPoint??{x:(p.minX+p.maxX)/2,y:(p.minY+p.maxY)/2},x=er(c?[s.build(),c]:[s.build()]),v=ir(a,e.initialState,y,b,f,m),C=yi({doc:t,units:o,seats:a,surfaces:y,focal:g}),{labels:S,sections:A,rows:L}=gi({doc:t,units:o,seats:a,surfaces:y,seatData:v,hintedSeatFloor:u,zones:C,focal:g}),O=vi({doc:t,units:o,seats:a,surfaces:y,solids:x,hintedSeatFloor:u,seatFloor:b});xi(S,O),v.iYaw=or(v.iPosition,a.length,P=>a[P].rowId,P=>{let I=o[b[P]]?.focal??g;return[I.x*N,I.y*N]});let z=(p.minX+p.maxX)/2*N,B=(p.minY+p.maxY)/2*N,T=.5*Math.hypot((p.maxX-p.minX)*N,(p.maxY-p.minY)*N)||10,w=Mi(x,v,{cx:z,cz:B,radius:T}),R=wi(v,h,p,w.minY,w.maxY,T);return{solids:x,seats:v,bounds:{center:[(R.min[0]+R.max[0])/2,(R.min[1]+R.max[1])/2,(R.min[2]+R.max[2])/2],radius:T,groundY:0,box:R},renderBounds:{center:w.center,radius:w.radius},stateColorLUT:cr(n,Ae),theme:n,seatCount:a.length,focalWorld:[g.x*N,1.5,g.y*N],zones:C,stages:h,productionElements:i.elements,sections:A,rows:L,labels:S,floors:O}}var Hl=88,jl=20,fo={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}},Vt=new Set(["row","seat"]),Ti={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},pn={row:{x:62,y:16},seat:{x:46,y:18}},ki=ee,po=e=>ko(e);function Li(e,t){let n=po(e),r=po(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ho(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 Xl(e,t=[.04,.06,.1],n=!0){let r=po(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?ho(i,t):t,s=ki(e),c=n?7:4.5,l=s&&Li(s,a)>=c?e:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var hn=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=ui(o,i,{hasZoneLabels:this.labels.some(x=>x.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let x of this.labels){if(!s.has(x.kind))continue;let v=Ye(t,x.anchor,n,r);if(!v.visible)continue;let C=fi(x.text,fo[x.kind].size,!Vt.has(x.kind)),S=!Vt.has(x.kind),A=di(v,C/2,fo[x.kind].size/2+(S?4:1),n,r),L=a?Math.hypot(x.anchor[0]-a[0],x.anchor[1]-a[1],x.anchor[2]-a[2]):1;c.push({label:x,screen:A,focus:hi(A,L,n,r),halfWidth:C/2,...this.selectedSeatLabelIds.has(x.id)?{priority:1}:{}})}let l=li(c.filter(x=>x.label.kind==="floor"),n),u=[...c.filter(x=>!Vt.has(x.label.kind)&&x.label.kind!=="floor"),...l],p=mi(u,Hl,jl),d=pi(n),f=co(c.filter(x=>x.label.kind==="row"),pn.row.x,pn.row.y,d.row,p),m=co(c.filter(x=>x.label.kind==="seat"),pn.seat.x,pn.seat.y,d.seat,[...p,...f]),h=[...p,...f,...m],y=new Set(h.map(x=>x.label.id));for(let{label:x,screen:v}of h){let S=this.nodeFor(x).style;S.display="",S.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let b=h.filter(({label:x})=>!Vt.has(x.kind)).sort((x,v)=>Ti[v.label.kind]-Ti[x.label.kind]||x.screen.depth-v.screen.depth||x.focus-v.focus),g=[];for(let{label:x}of b){let v=this.nodes.get(x.id);if(!v||v.style.display==="none")continue;let C=v.getBoundingClientRect();g.some(A=>C.left<A.right+3&&C.right+3>A.left&&C.top<A.bottom+3&&C.bottom+3>A.top)?v.style.display="none":g.push(C)}for(let[x,v]of this.nodes)y.has(x)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(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=fo[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=!Vt.has(t.kind),s=Xl(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=ki(r?"#ecf8ff":s.ink)??[1,1,1],u=r?ho("rgba(10,28,45,.9)",c):a?ho(s.backing,c):c;return n.dataset.qualityContrast=Li(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Fi=1;var Yl=new Set(["floor","zone","section","ga","booth","annotation"]);function Wl(e){return e.every(t=>Number.isFinite(t))}function Kl(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 _i(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function ql(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function bn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Yl.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)Kl(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=[Te("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Te("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Te("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Te("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}`}]),Te("camera-invalid","The capture camera must have a finite physical pose",Wl(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Te("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}]),Te("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`}]),Te("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}))),Te("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}))),Te("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:ql(e.framing)},metrics:{minimumHierarchyFontPx:_i(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:_i(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var se=require("ogl");var We=require("ogl");var yn=`
20
+ }`});async function Ta(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=Cn,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let p=()=>{},d=[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 D=n.camera.position,V=n.focalWorld[0]-D.x,H=n.focalWorld[1]-D.y,j=n.focalWorld[2]-D.z,_=Math.hypot(V,j);_>.001&&(i=Math.atan2(V,-j)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(H,_)*180/Math.PI)))}let f=null;if(t){let D=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),V=Mn(t,Sn(D)),H;try{let j=t.resolveUrl?await t.resolveUrl(V.initialUrl):V.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");H=await Gt(j,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{f=Ia(n.gl,H)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),V.upgradeUrl&&(p=wn(()=>{(t.resolveUrl?t.resolveUrl(V.upgradeUrl):Promise.resolve(V.upgradeUrl)).then(_=>!_||l.signal.aborted?null:Gt(_,l.signal)).then(_=>{_&&(c||l.signal.aborted||(f?.setImage(_),n.requestRender()))}).catch(()=>{})}))}let m=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),y=()=>{let D=n.camera.position;f?.mesh.position.set(D.x,D.y,D.z);let[V,H,j]=Aa(i,a);n.camera.lookAt([D.x+V,D.y+H,D.z+j]),n.requestRender()};y();let b=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.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"}),b.appendChild(x),r.disclosure){let D=document.createElement("div");D.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(D.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)"}),b.appendChild(D)}let v=document.createElement("div");v.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(v.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"}),b.appendChild(v),e.appendChild(b),x.focus({preventScroll:!0});let C=!1,S=0,A=0,L=0,O=new Map,z=()=>{let[D,V]=[...O.values()];return D&&V?Math.hypot(D.x-V.x,D.y-V.y):0},B=D=>{let V=Mo(D);V!==s&&(s=V,n.camera.perspective({fov:s,aspect:n.camera.aspect}),y())},T=D=>{D.target!==x&&(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),C=O.size===1,S=D.clientX,A=D.clientY,O.size===2&&(L=z()),b.setPointerCapture?.(D.pointerId),b.style.cursor="grabbing")},w=D=>{if(O.has(D.pointerId)){if(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),O.size>=2){let V=z();L>0&&V>0&&B(s*(L/V)),L=V,C=!1;return}C&&(i+=(D.clientX-S)*Ea,a=Math.max(-Le,Math.min(Le,a+(D.clientY-A)*Ea)),S=D.clientX,A=D.clientY,y())}},R=D=>{O.delete(D.pointerId),L=O.size===2?z():0;let V=O.values().next().value;C=O.size===1,V?(S=V.x,A=V.y):b.style.cursor="grab";try{b.releasePointerCapture?.(D.pointerId)}catch{}},P=D=>{D.preventDefault(),B(s+D.deltaY*.04)};b.addEventListener("pointerdown",T),b.addEventListener("pointermove",w),b.addEventListener("pointerup",R),b.addEventListener("pointercancel",R),b.addEventListener("wheel",P,{passive:!1});let I=D=>{if(!c){if(D.key==="Tab"){D.preventDefault(),x.focus({preventScroll:!0});return}if(D.key==="Escape"){D.stopPropagation(),E.close();return}if(D.key==="ArrowLeft"||D.key==="ArrowRight")i+=D.key==="ArrowLeft"?-4:4;else if(D.key==="ArrowUp"||D.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(D.key==="ArrowUp"?4:-4)));else if(D.key==="+"||D.key==="="){B(s-5),D.preventDefault();return}else if(D.key==="-"){B(s+5),D.preventDefault();return}else return;D.preventDefault(),y()}};window.addEventListener("keydown",I);let G=0,k=(D,V)=>{if(!f){V?.();return}let H=D===1?0:1,j=performance.now(),_=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-j)/o);f?.setOpacity(H+(D-H)*F),n.requestRender(),F<1?G=requestAnimationFrame(_):V?.()};G=requestAnimationFrame(_)};k(1);let M=()=>{c||(c=!0,p(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(G),b.removeEventListener("pointerdown",T),b.removeEventListener("pointermove",w),b.removeEventListener("pointerup",R),b.removeEventListener("pointercancel",R),b.removeEventListener("wheel",P),window.removeEventListener("keydown",I),b.remove(),g?.isConnected&&g.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(d[0],d[1],d[2]),n.camera.perspective({fov:m,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},E={close(){if(c)return;let D=()=>{M(),r.onClose?.()};cancelAnimationFrame(G),k(0,D)},dispose:M};return x.addEventListener("click",()=>E.close()),E}var Ea,ka=wt(()=>{"use strict";Ra();wo();So();Ea=.15});var La={};Eo(La,{createOpenPanorama:()=>$u});function $u(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:p,isContextLost:d,isDisposed:f,flightGen:m,setPanorama:h,getLoadAbort:y,setLoadAbort:b,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:v,restorePanoramaLayer:C,getOverviewChip:S,labelOverlay:A,reducedMotion:L,removeArriveChip:O,showArriveChip:z}=e;return async(B,T,w)=>{y()?.abort();let R=new AbortController;b(R);let P=n.seats.idToIndex.get(B);if(P===void 0){i.syncFromCamera();return}let I=s.get(B)?.label??B,G=l(B,P),k=c(B);if(!k){R.abort(),y()===R&&b(null),i.syncFromCamera();return}x(!0),a.stop();let M;try{M=await k}catch{if(y()===R&&b(null),o.panoramaFailed(B,"source"),!f()&&w===m()){x(!1),i.resumeAfterFlight(G.focal),a.requestRender();let X=z(B,w,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||w!==m()){R.abort(),y()===R&&b(null);return}O();let E=S(),D=()=>{R.abort(),y()===R&&b(null),h(null),g(!1),C(),E.style.display="",A.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(G.focal),a.requestRender();let X=z(B,m());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},V=M.generated===!0,H=Pa(M);v(),g(!V),E.style.display="none";let j=L()?0:T,_=u(),F=_&&!d()?await Ta(t,V?null:M,{gl:p,scene:_.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:V?G.eye:void 0,focalWorld:G.focal},{fadeMs:j,seatLabel:I,disclosure:H,disclosurePrefix:V?"Live seat-eye view":"360\xB0 panorama",onClose:D,signal:R.signal}):null;if(f()||w!==m()){R.abort(),g(!1),y()===R&&b(null),F?.dispose(),E.style.display="",C();return}if(F)i.syncFromCamera(),A.setVisible(!1),x(!1),a.requestRender(),h(F);else if(V){C(),E.style.display="",x(!1),i.resumeAfterFlight(G.focal),a.requestRender(),h(null),g(!1),o.panoramaFailed(B,"mount");let X=z(B,m(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),y()===R&&b(null);return}else g(!1),o.panoramaFallback(B),h(Ca(t,M,{fadeMs:j,seatLabel:I,disclosure:H,onClose:D,signal:R.signal}));o.panoramaOpened()}}var _a=wt(()=>{"use strict";wo();ka()});var rd={};Eo(rd,{VENUE3D_QUALITY_REPORT_VERSION:()=>Fi,buildSceneModel:()=>bt,inspectVenue3DQualityEvidence:()=>bn,mountVenue3D:()=>od,prepareVenue3D:()=>Ha,prepareVenue3DFromChart:()=>ja});module.exports=ns(rd);var Fo=require("ogl");var os=/^#?([\da-f]{3}|[\da-f]{6})$/i;function rs(e){let t=os.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=rs(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function _n(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function is(e){return .2126*_n(e[0])+.7152*_n(e[1])+.0722*_n(e[2])}function ko(e){return is([e[0]*255,e[1]*255,e[2]*255])}function as(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 Pt(e,t){let n=as(e);return he(e,[n,n,n],t)}var Ae=["available","held","sold","selected","dimmed"];function Ct(e){let t=Ae.indexOf(e);return t<0?0:t}var Lo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function _o(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 Fn={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]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ve(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function ss(){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 Wt=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 Fo.Renderer({canvas:this.canvas,dpr:ss(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.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 lt=require("ogl"),me=Math.PI/180,Dn=15*me,On=80*me,ct=.12,Do=35,Oo=1.25,Kt=class{constructor(t,n,r,o){this.fovY=Do;this.target=new lt.Vec3;this.azimuth=-30*me;this.polar=55*me;this.distance=10;this.azT=-30*me;this.polT=55*me;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 lt.Vec3;this.panAnchor=new lt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new lt.Camera(t,{fov:Do,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(Dn,Math.min(On,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*me;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(Dn,Math.min(On,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*me/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),p=-i*l,d=-a*l;this.targetT.x+=(-t*s+n*p)*o,this.targetT.z+=(-t*c+n*d)*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*me/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*me,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*me;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??Oo)),this.minDist=Math.max(2,a*.12),this.maxDist=u*4,n?(this.azimuth=this.azT,this.polar=12*me,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*me/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))*me;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Oo))}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),p=-Math.cos(i),d=-l*Math.cos(o);if(Math.abs(p)>.999)return s;let f=-d,m=u,h=Math.hypot(f,m);f/=h,m/=h;let y=-m*p,b=m*u-f*d,g=f*p,x=Math.tan(r),v=Math.tan(n),C=1;for(let S=0;S<8;S++){let A=(S&1?c.max[0]:c.min[0])-t.center[0],L=(S&2?c.max[1]:c.min[1])-t.center[1],O=(S&4?c.max[2]:c.min[2])-t.center[2],z=A*u+L*p+O*d,B=Math.abs(A*f+O*m),T=Math.abs(A*y+L*b+O*g);C=Math.max(C,B/x-z,T/v-z)}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*ct,this.polar+=n*ct,this.distance+=r*ct,this.target.x+=o*ct,this.target.y+=i*ct,this.target.z+=a*ct,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(Dn,Math.min(On,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 qt=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}};function Vo(e,t,n){return Math.max(t,Math.min(n,e))}var ut=2.5,cs=1.15,At=6,dt=10,Bo=6,No=9.5,Go=.9,zo=2.2,Vn=30,Bn=4,Qt=8192;var pd=dt+Bn;function Uo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ut};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ut+o*(cs-ut)}}function Ho(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function jo(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 ls=[{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"}],bd=new Map(ls.map(e=>[e.key,e]));var us={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 Xo(e){let t=e?.[0];return t&&us[t]||"#3b82f6"}var ds=[{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"}],yd=new Map(ds.map(e=>[e.key,e]));var ms=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],gd=new Set(ms);var Wo=[{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}}],Ko=Wo.map(e=>e.key),fs=new Map(Wo.map(e=>[e.key,e]));function Yo(e){return typeof e=="string"&&fs.has(e)}function qo(e,t){return Yo(e)?e:Yo(t?.seatGlyph)?t.seatGlyph:"circle"}var Se=.02291666666666667,He=1/Se,ps=58,hs=ps*Se;var bs=3,Qo=0,Nn=120,ys=0,gs=45,xs=7,je=1.2;function Gn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function vs(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=xs?e:bs}function $t(e,t={}){let n=Gn(t.floorBaseHeightM,Qo,Nn,0),r=Math.min(Nn,n+vs(e.elevation)*hs),o=e.height===void 0?r:Gn(e.height,Qo,Nn,r),i=Gn(e.rake,ys,gs,0);return{height:o,rake:i}}var Zo=st(require("earcut"),1),Jo=st(require("polygon-clipping"),1);var Pd=Math.PI/180;function zn(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 It(e){return e.length?zn(e):null}function et(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 Rt(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 N=Se,Ss=.002;function Ms(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<Ss}var tt=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)}},en=class{constructor(){this.pos=new tt;this.nor=new tt;this.col=new tt;this.flr=new tt;this.mat=new tt;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){Ms(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 ws(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,p=r*s-o*a,d=Math.hypot(l,u,p)||1;return l/=d,u/=d,p/=d,[l,u,p]}function Ps(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,Zo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Un(e){return et(e)<0?[...e].reverse():e}var Cs=3;function As(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(f,m,h,y)=>Math.abs(r({x:(f.x+m.x)/2,y:(f.y+m.y)/2})-(h+y)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,p=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)),d=(f,m,h)=>{let y=Math.abs(r({x:(f+c)/2,y:(m+l)/2})-(h+u)/2);y>p&&(p=y)};return d((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),d((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),d((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),p}function Et(e,t,n,r,o){if(o<=0)return As(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(Et(e,i,s,r,o-1),Et(i,t,a,r,o-1),Et(s,a,n,r,o-1),Et(i,a,s,r,o-1))}function Tt(e,t,n,r,o,i,a,s){if(a>0){let d={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},m={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Tt(e,t,d,m,o,i,a-1,s),Tt(e,d,n,f,o,i,a-1,s),Tt(e,m,f,r,o,i,a-1,s),Tt(e,d,f,m,o,i,a-1,s);return}let c=[t.x*N,o(t),t.y*N],l=[n.x*N,o(n),n.y*N],u=[r.x*N,o(r),r.y*N];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let p=ws(c,l,u);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),e.tri(c,l,u,p,i)}var Is=8;function $o(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},p=t(u);if(Math.abs(p-(s+c)/2)>n){o(i,u,s,p,l-1),o(u,a,p,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),Is)}return r}function Zt(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 Jt=.001*He*.1;function le(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(et(t))<1e-4))return;let u=Zt($o(Zt(Un(t),Jt),r,c),Jt),p=n?.map(S=>Zt($o(Zt(Un(S),Jt),r,c),Jt)).filter(S=>S.length>=3&&Math.abs(et(S))>=1e-4),{pts:d,tris:f}=Ps(u,p),m=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<Cs;g++){let S=0;for(let A=0;A<f.length;A+=3){let L=Et(d[f[A]],d[f[A+1]],d[f[A+2]],r,g);L>S&&(S=L)}if(S<=c)break}for(let S=0;S<f.length;S+=3){let A=d[f[S]],L=d[f[S+1]],O=d[f[S+2]];Tt(e,A,L,O,r,m,g,l);let z=[A.x*N,o,A.y*N],B=[L.x*N,o,L.y*N],T=[O.x*N,o,O.y*N];e.tri(z,T,B,[0,-1,0],h)}let x=S=>{if(g<=0)return S;let A=1<<g,L=[];for(let O=0;O<S.length;O++){let z=S[O],B=S[(O+1)%S.length];for(let T=0;T<A;T++){let w=T/A;L.push({x:z.x+(B.x-z.x)*w,y:z.y+(B.y-z.y)*w})}}return L},v=zn(u),C=[{ring:x(u),flip:!1}];if(p)for(let S of p)S.length>=3&&C.push({ring:x(S),flip:!0});for(let{ring:S,flip:A}of C)for(let L=0;L<S.length;L++){let O=S[L],z=S[(L+1)%S.length],B=(z.x-O.x)*N,w=(z.y-O.y)*N,R=-B,P=Math.hypot(w,R)||1;w/=P,R/=P;let I=(O.x+z.x)/2-v.x,G=(O.y+z.y)/2-v.y,k=w*I+R*G;A&&(k=-k),k<0&&(w=-w,R=-R);let M=[w,0,R],E=[O.x*N,r(O),O.y*N],D=[z.x*N,r(z),z.y*N],V=[O.x*N,o,O.y*N],H=[z.x*N,o,z.y*N];e.tri(E,D,H,M,y,y,b),e.tri(E,H,V,M,y,b,b)}}function er(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 tn(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Un(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,p=l.y-c.y,d=Math.hypot(u,p)||1;i.push({x:p/d,y:-u/d})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],p=l.x+u.x,d=l.y+u.y,f=Math.hypot(p,d),m=()=>{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){m();continue}p/=f,d/=f;let h=p*l.x+d*l.y,y=1/Math.max(h,1e-6);if(!Number.isFinite(y)||y>n){m();continue}a.push([c.x+p*t*y,c.y+d*t*y])}if(a.length<3)return e;try{let s=Jo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let p of s){let d=Math.abs(et(p[0].map(([f,m])=>({x:f,y:m}))));d>l&&(l=d,c=p[0])}if(!c)return e;let u=c.map(([p,d])=>({x:p,y:d}));if(u.length>1){let p=u[0],d=u[u.length-1];Math.abs(p.x-d.x)<1e-9&&Math.abs(p.y-d.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function nn(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 kt(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 ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Rs=.44,Es=.15,Ts=.3,ks=.24;function tr(e){return e===void 0||!Number.isFinite(e)||e<=0?ks:Math.min(Ts,Math.max(Es,e*Rs))}var Hn=.21,Ls=.05,jn=.45,on=jn+Ls,_s=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,jn,1]},{part:ie.back,min:[-1,on,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Fs=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Ds=[{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 nr(){let e=[],t=[],n=[],r=[],o=(P,I,G)=>{let k=n.length,[M,E,D]=P,V=[E[0]-M[0],E[1]-M[1],E[2]-M[2]],H=[D[0]-M[0],D[1]-M[1],D[2]-M[2]],j=V[1]*H[2]-V[2]*H[1],_=V[2]*H[0]-V[0]*H[2],F=V[0]*H[1]-V[1]*H[0],X=Math.hypot(j,_,F);X>1e-9?(j/=X,_/=X,F/=X):[j,_,F]=I,j*I[0]+_*I[1]+F*I[2]<0&&(j=-j,_=-_,F=-F);for(let W of P)e.push(...W),t.push(j,_,F),n.push(G);r.push(k,k+1,k+2,k,k+2,k+3)},i=P=>{for(let I of Ds){let G=I.c.map(k=>k.map((M,E)=>M?P.max[E]:P.min[E]));o(G,I.n,P.part)}};for(let P of _s)i(P);for(let P of Fs)i(P);let a=jn,s=1.08,c=.47,l=.69,u=-.55,p=.08,d=-.48,f=.01,m=[-c,a,u],h=[c,a,u],y=[-c,a,p],b=[c,a,p],g=[-l,s,d],x=[l,s,d],v=[-l,s,f],C=[l,s,f];o([h,x,C,b],[1,0,0],ie.body),o([y,v,g,m],[-1,0,0],ie.body),o([v,C,x,g],[0,1,0],ie.body),o([m,h,b,y],[0,-1,0],ie.body),o([b,C,v,y],[0,0,1],ie.body),o([m,g,x,h],[0,0,-1],ie.body);let S=10,A=8,L=[0,1.205,-.23],O=[.42,.115,.38],z=n.length;for(let P=0;P<=A;P++){let I=Math.PI*P/A,G=Math.cos(I),k=Math.sin(I);for(let M=0;M<=S;M++){let E=Math.PI*2*M/S,D=k*Math.cos(E),V=k*Math.sin(E);e.push(L[0]+O[0]*D,L[1]+O[1]*G,L[2]+O[2]*V);let H=D/O[0],j=G/O[1],_=V/O[2],F=Math.hypot(H,j,_)||1;H/=F,j/=F,_/=F,t.push(H,j,_),n.push(ie.head)}}for(let P=0;P<A;P++)for(let I=0;I<S;I++){let G=z+P*(S+1)+I,k=G+S+1;r.push(G,k,G+1,G+1,k,k+1)}let B=new Float32Array(e),T=new Float32Array(t),w=new Float32Array(n),R=new Uint16Array(r);return{position:B,normal:T,part:w,index:R,vertexCount:n.length,indexCount:r.length}}function or(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 p=u-l;for(let d=l;d<u;d++){let[f,m]=r(d),h=f-i(d),y=m-a(d);if(p>=2){let b=Math.max(l,d-1),g=Math.min(u-1,d+1),x=i(g)-i(b),v=a(g)-a(b),C=Math.hypot(x,v);if(C>1e-6){let S=-v/C,A=x/C;S*h+A*y<0&&(S=-S,A=-A),h=S,y=A}}o[d]=h===0&&y===0?0:Math.atan2(h,y)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Oe=.22;function rr(e,t){let n=Ae[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 Os=.42;function Vs(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 m of e)m.x<r&&(r=m.x),m.y<o&&(o=m.y),m.x>i&&(i=m.x),m.y>a&&(a=m.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),p=Math.max(1,Math.ceil(c/l)+1),d=new Map,f=(m,h)=>{let y=Math.min(u-1,Math.max(0,Math.floor((m-r)/l)));return Math.min(p-1,Math.max(0,Math.floor((h-o)/l)))*u+y};for(let m=0;m<t;m++){let h=f(e[m].x,e[m].y),y=d.get(h);y?y.push(m):d.set(h,[m])}for(let m=0;m<t;m++){let h=e[m],y=Math.min(u-1,Math.max(0,Math.floor((h.x-r)/l))),b=Math.min(p-1,Math.max(0,Math.floor((h.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let v=b-x;v<=b+x;v++)if(!(v<0||v>=p))for(let C=y-x;C<=y+x;C++){if(C<0||C>=u||x>1&&Math.abs(v-b)<x&&Math.abs(C-y)<x)continue;let S=d.get(v*u+C);if(S)for(let A of S){if(A===m)continue;let L=Math.hypot(e[A].x-h.x,e[A].y-h.y);L<g&&(g=L)}}if(Number.isFinite(g)&&g<=x*l)break}n[m]=g}return n}function Bs(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-je):0}function ir(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),p=new Float32Array(a),d=new Float32Array(a),f=new Float32Array(a),m=new Float32Array(a*3),h=new Map,y=Vs(e);for(let b=0;b<a;b++){let g=e[b],v=(n?.seatPitchU(b)??y[b])*N;u[b]=Number.isFinite(v)?Math.max(.06,Math.min(Oe,v*Os)):Oe,p[b]=tr(Number.isFinite(v)?v:void 0);let C=qo(g.glyph,{seatGlyph:i?.get(g.categoryKey)});d[b]=Ko.indexOf(C),f[b]=g.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=g.x*N,s[b*3+1]=n?n.seatDeckY(b):Bs(g),s[b*3+2]=g.y*N,c[b]=Ct(t?t(g):"available");let S=ee(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[b*3]=S[0],l[b*3+1]=S[1],l[b*3+2]=S[2],g.accessibility?.length){let A=ee(Xo(g.accessibility));A&&(m[b*3]=A[0],m[b*3+1]=A[1],m[b*3+2]=A[2])}h.set(g.id,b)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:m,idToIndex:h,iChairWidth:p,iGlyph:d,iPhysicalSeat:f,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Ns=64;function Xn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=Ct(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+Ns){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 Gs=.15,zs=1.6;function ar(e){return Vo(e??1,Gs,zs)}var Us=.15,Hs=.9,js=1.76;function Xs(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:Fn,seatStates:{...Lo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function sr(e){let t=Xs();if(!e)return t;let n=ee(e.background);if(n){t.background={top:ve(n,Hs),bottom:ve(n,js)};let a={};for(let[s,c]of Object.entries(Fn))a[s]=he(c,n,Us);t.structure=a}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=ar(o));let i=e.venue3d;if(i){let a=ee(i.deck),s=ee(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ee(i.seat),t.materials.shell=ee(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function cr(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function lr(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+a*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+a*e.end.y}}function ur(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[lr(e,.5)];let r=Array.from({length:n+1},(c,l)=>lr(e,l/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let l=r[c].x-r[c-1].x,u=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(l,u)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let l=i*c/(t-1);for(;s<o.length-1&&o[s]<l;)s+=1;let u=o[s-1],p=o[s],d=p===u?0:(l-u)/(p-u);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*d,y:r[s-1].y+(r[s].y-r[s-1].y)*d})}return a}function dr(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((d,f)=>d.segmentedRow.componentIndex-f.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((d,f)=>d.segmentedRow?.kind==="segmented-row-v1"&&d.segmentedRow.groupId===r&&d.segmentedRow.componentCount===a&&d.segmentedRow.componentIndex===f&&d.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(f===0?d.segmentedRow.boundaryBefore==="start":d.segmentedRow.boundaryBefore!=="start")&&d.segmentedRow.displayLabel===s.displayLabel)))continue;let l=i.reduce((d,f)=>d+f.seatCount,0),u=0,p=0;for(let d of i)d.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(d.id,{groupId:r,adjacencyOffset:u,displayOffset:p,displayLabel:s.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=d.seatCount,p+=d.seatCount}return t}var Ys="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Ws="abcdefghijklmnopqrstuvwxyz";function Ks(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function Yn(e,t=!1){let n=t?Ws:Ys;return Ks(Math.max(0,Math.floor(e)-1),n)}var qs=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function mr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of qs)for(;t>=r;)n+=o,t-=r;return n}function Qs(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function Wn(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let f=Math.ceil(c/2),m=i==="updown"?t<f?n+2*t:n-1+2*(c-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${a}${m}`}let l=i==="odd"||i==="even"?2:o,u=s!=null&&Number.isFinite(s)?s-(c-1)*l:n,p=r==="center"?Qs(c)[t]:r==="rtl"?c-1-t:t,d;switch(i){case"odd":{let f=u%2===1?u:u+1;d=String(f+p*2);break}case"even":{let f=u%2===0?u:u+1;d=String(f+p*2);break}case"roman":d=mr(u+p*o);break;case"letters-upper":d=Yn(u+p*o,!1);break;case"letters-lower":d=Yn(u+p*o,!0);break;default:d=String(u+p*o);break}return`${a}${d}`}function $s(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function fr(e,t,n){return n?.label??`${e.label}-${Wn(e,t)}`}function Kn(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(!n)return`${e.displayLabel||e.label}-${Wn(e,t)}`;let o=$s(n),i=n.displayOffset+t;return`${n.displayLabel}-${Wn(o,i)}`}function pr(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 mt(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 p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function Zs(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 hr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function qn(e,t){let n=1/0;for(let r of pr(e)){let o=mt(t,r.x,r.y);o<n&&(n=o)}for(let r of pr(t)){let o=mt(e,r.x,r.y);o<n&&(n=o)}return n}function Js(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 p=Math.hypot(u.x-n,u.y-r);p>o&&(o=p,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,p)=>({p:u,i:p,t:(u.x-n)*a+(u.y-r)*s})).sort((u,p)=>u.t-p.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function Qn(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,v=g.y-r;o+=x*x,a+=v*v,i+=x*v,s+=x*x*x,c+=v*v*v,l+=x*v*v,u+=v*x*x}let p=o*a-i*i;if(Math.abs(p)<1e-9)return null;let d=(s+l)/2,f=(c+u)/2,m=(d*a-f*i)/p,h=(f*o-d*i)/p,y=m+n,b=h+r;return!Number.isFinite(y)||!Number.isFinite(b)?null:{cx:y,cy:b}}var ec=.15;function tc(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,v=0;for(let C of g.pts)x+=C.x,v+=C.y;return{x:x/g.pts.length,y:v/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,v=g.y-r;o+=x*x,i+=x*v,a+=v*v}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,p;Math.abs(i)>1e-12?(u=l-a,p=i):o>=a?(u=1,p=0):(u=0,p=1);let d=Math.hypot(u,p);if(!(d>1e-12))return null;u/=d,p/=d;let f=1/0,m=-1/0,h=[];for(let g of e){let x=1/0,v=-1/0;for(let C of g.pts){let S=C.x*u+C.y*p;S<x&&(x=S),S>v&&(v=S),S<f&&(f=S),S>m&&(m=S)}h.push(v-x)}let y=m-f;return y>1e-9?(h.sort((g,x)=>g-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/y<=nc?{x:u,y:p}:null):null}var nc=.35;function rn(e,t,n,r){let o=new Map;for(let y of n){let b=t[y],g=b.rowId||`__seat-${y}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:b.x,y:b.y}),x.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,b]of o){let g=Js(b.pts,b.idx),x=0;for(let v of g.pts)x+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:y,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(y=>Zs(y.pts)),s=[];for(let y=0;y<i.length;y++){let b=1/0;for(let g=0;g<i.length;g++){if(y===g||hr(a[y],a[g])>=b)continue;let x=qn(i[y].pts,i[g].pts);x<b&&(b=x)}Number.isFinite(b)&&s.push(b)}s.sort((y,b)=>y-b);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let b=y+1;b<i.length;b++)hr(a[y],a[b])>l||qn(i[y].pts,i[b].pts)<=l&&(u[y].push(b),u[b].push(y));let p=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let b=p++,g=[y];for(i[y].blockId=b;g.length;){let x=g.pop();for(let v of u[x])i[v].blockId===-1&&(i[v].blockId=b,g.push(v))}}let d=new Map;for(let y of i){let b=d.get(y.blockId)??[];b.push(y),d.set(y.blockId,b)}let f=[];for(let y of i){if(y.pts.length<4)continue;let b=Qn(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||f.push({x:b.cx,y:b.cy}))}let m=f.length>=2?(()=>{let y=f.map(x=>x.x).sort((x,v)=>x-v),b=f.map(x=>x.y).sort((x,v)=>x-v),g=Math.floor(f.length/2);return{cx:y[g],cy:b[g]}})():null;if(m){let y=S=>Math.hypot(S.x-m.cx,S.y-m.cy),b=1/0,g=-1/0,x=[];for(let S of i){let A=1/0,L=-1/0;for(let O of S.pts){let z=y(O);z<A&&(A=z),z>L&&(L=z)}x.push(L-A),A<b&&(b=A),L>g&&(g=L)}let v=g-b;x.sort((S,A)=>S-A);let C=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(v>1e-9&&C/v<=ec){let S=i.map(I=>{let G=0;for(let k of I.pts)G+=y(k);return{row:I,radius:G/I.pts.length}}),A=0,L=0;for(let I of S)A+=I.radius,L+=I.row.focalDistance;A/=S.length,L/=S.length;let O=0;for(let I of S)O+=(I.radius-A)*(I.row.focalDistance-L);if(O<0)for(let I of S)I.radius=-I.radius;let B=1/0;for(let I of S)I.radius<B&&(B=I.radius);S.sort((I,G)=>I.radius-G.radius);let T=-1,w=-1/0,R=v/Math.max(1,S.length)*.5,P=[];for(let I of S)I.radius-w>R&&(T++,w=I.radius),I.row.ordinal=T,I.row.blockDepth=I.radius-B,P.push(I.row);return{sectionId:e,rows:P,blockCount:p}}}let h=[];for(let[,y]of d){let b=tc(y);if(b){let g=v=>{let C=0;for(let S of v.pts)C+=S.x*b.x+S.y*b.y;return C/v.pts.length};y.sort((v,C)=>g(v)-g(C)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let x=0;for(let v=0;v<y.length;v++)v>0&&(x+=qn(y[v-1].pts,y[v].pts)),y[v].ordinal=v,y[v].blockDepth=x,h.push(y[v])}else{let g=1/0;for(let x of y)x.focalDistance<g&&(g=x.focalDistance);y.sort((x,v)=>x.focalDistance-v.focalDistance);for(let x=0;x<y.length;x++)y[x].ordinal=x,y[x].blockDepth=Math.max(0,y[x].focalDistance-g),h.push(y[x])}}return{sectionId:e,rows:h,blockCount:p}}var oc=/^\d{4}-\d{2}-\d{2}$/;function rc(e){let t=Date.parse(e);return Number.isFinite(t)?oc.test(e)?t+864e5:t:null}function ic(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=rc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function ac(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function sc(e){return e.status!=="draft"&&e.status!=="retracted"}function cc(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function br(e,t={}){return!!e&&sc(e)&&ac(e,t.activeConfigurationId,t.activeConfigurationVersion)&&cc(e,t.activeBasisSha256)&&ic(e,t.now)}function Sr(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var an=Math.PI/180;var Lt=16;function Zn(e,t,n,r){let o=n*an,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function lc(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return ur(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let l=0;l<t;l++)a.push(Zn(l*n,0,o,i));return a}let s=r/(t-1)*an,c=n/(2*Math.sin(Math.abs(s)/2));for(let l=0;l<t;l++){let u=l*s,p=c*Math.sin(u),d=-c+c*Math.cos(u);a.push(Zn(p,d,o,i))}return a}function uc(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function dc(e,t){let n=uc(e);return lc(e).map((r,o)=>{let i=n.get(o),a=Sr(i),s=fr(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:Kn(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(l=>l!==void 0&&l!==!1&&l!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function Mr(e){let t=[];for(let n of dc(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function mc(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function fc(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(u=>[u.index,u])),o=(u,p,d,f)=>{let m=r.get(u),h=Sr(m),y=m?.label??`${e.label}-${u+1}`,b=e.displayLabel??e.label;return{index:u,label:y,displayLabel:m?.displayLabel??`${b}-${u+1}`,x:p+(m?.dx??0),y:d+(m?.dy??0),categoryKey:m?.categoryKey??e.categoryKey,skipped:!!m?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:m?.wheelchairSpaceType,commercial:m?.commercial,glyph:m?.glyph,viewUrl:m?.viewFromSeatUrl,viewMeta:m?.viewFromSeatUrl?m.viewFromSeatMeta:void 0,labelStyle:m?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Lt,p=e.rotation*an,d=Math.max(0,Math.min(360,e.seatArc??360));if(d>=360||n===1){for(let y=0;y<n;y++){let b=p+y/n*2*Math.PI;t.push(o(y,e.center.x+u*Math.cos(b),e.center.y+u*Math.sin(b)))}return t}let f=d*an,m=(2*Math.PI-f)/2,h=p+m;for(let y=0;y<n;y++){let b=h+y/(n-1)*f;t.push(o(y,e.center.x+u*Math.cos(b),e.center.y+u*Math.sin(b)))}return t}let i=e.width??80,a=e.height??50,s=mc(e),c=["top","bottom","left","right"],l=0;for(let u of c){let p=s[u];for(let d=0;d<p;d++){let f,m;u==="top"?(f=-i/2+(d+.5)*i/p,m=-a/2-Lt):u==="bottom"?(f=-i/2+(d+.5)*i/p,m=a/2+Lt):u==="left"?(f=-i/2-Lt,m=-a/2+(d+.5)*a/p):(f=i/2+Lt,m=-a/2+(d+.5)*a/p);let h=Zn(f,m,e.rotation,e.center);t.push(o(l++,h.x,h.y,u))}}return t}function pc(e){return fc(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function hc(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function yr(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 bc(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 nt(e,t,n){return yr(e,t)&&!(n??[]).some(r=>yr(e,r)||bc(e,r))}function $n(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function yc(e){switch(e.type){case"row":{let t=Mr(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};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}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return $n(e.points);case"section":return $n(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?$n(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function gr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function gc(e,t){if(e.type!=="gaArea"||!gr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>gr(o,r[i]))}function xc(e,t){let n=e.filter(a=>a.type==="section"),r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=yc(t);return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(gc(t,a)||nt(o,a.outline,a.holes))):void 0)??n.find(a=>nt(o,a.outline,a.holes))}function xr(e,t,n,r,o,i,a,s,c){let l=[],u=dr(e),p=m=>!m?.eventConfigurationId||m.eventConfigurationId===r&&(m.eventConfigurationVersion===void 0||m.eventConfigurationVersion===c),d=m=>br(m,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),f=(m,h)=>d(m)?{...m,coverage:h}:void 0;for(let m of e){let h=[];if(m.type==="row"?h=Mr(m):m.type==="table"?h=pc(m):m.type==="booth"&&(h=hc(m)),!h.length)continue;for(let v of h)v.viewUrl&&!p(v.viewMeta)&&(v.viewUrl=void 0,v.viewMeta=void 0);if(m.type==="row"){let v=u.get(m.id);if(v){let C=new Map((m.overrides??[]).map(S=>[S.index,S]));for(let S of h){let A=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(A))continue;S.logicalRowId=v.groupId,S.logicalSeatIndex=v.adjacencyOffset+A,C.get(A)?.displayLabel||(S.displayLabel=Kn(m,A,v)),!S.viewUrl&&v.viewFromSeatUrl&&p(v.viewFromSeatMeta)&&(S.viewUrl=v.viewFromSeatUrl,S.viewMeta=v.viewFromSeatMeta);let L=C.get(A)?.confidenceEvidence;S.confidenceEvidence=f(L,"exact-seat")??f(m.confidenceEvidence,"row-representative")??f(v.confidenceEvidence,"row-representative")}}}let y=xc(e,m),b=y?.viewFromSeatUrl,x=(y?.zone?t?.find(v=>v.id===y.zone):void 0)?.focalPoint??n;for(let v of h){if(!v.confidenceEvidence){let C=Number(v.id.slice(v.id.lastIndexOf(":")+1)),S=(m.type==="row"||m.type==="table")&&Number.isInteger(C)?m.overrides?.find(A=>A.index===C)?.confidenceEvidence:void 0;v.confidenceEvidence=f(S,"exact-seat")??(m.type==="row"?f(m.confidenceEvidence,"row-representative"):void 0)}v.confidenceEvidence??=f(y?.confidenceEvidence,"section-representative")??(a?f(a.evidence,a.coverage):void 0),!v.viewUrl&&b&&p(y?.viewFromSeatMeta)&&(v.viewUrl=b,v.viewMeta=y?.viewFromSeatMeta),!v.viewUrl&&i&&p(i.meta)&&(v.viewUrl=i.url,v.viewMeta=i.meta),y&&(v.sectionId=y.logicalSectionId??y.id),y?.zone&&(v.zoneId=y.zone),x&&(v.focalPoint={...x})}l.push(...h)}return l}function wr(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=xr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&vr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let l of c)l.floorId=o.id;r.push(...c)}return r}let n=xr(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&vr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),n}function vr(e,t,n,r){let o=e.filter(u=>u.type==="section"),i=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!i||!t){for(let u of r)u.eyeHeightM=n+je;return}let a=new Array(r.length),s=new Map,c=new Map;for(let u=0;u<r.length;u++){let p=r[u],f=(p.sectionId?o.find(h=>h.id===p.sectionId)??o.find(h=>h.logicalSectionId===p.sectionId&&nt({x:p.x,y:p.y},h.outline,h.holes)):void 0)??o.find(h=>nt({x:p.x,y:p.y},h.outline,h.holes))??null;if(a[u]=f,!f)continue;s.has(f.id)||s.set(f.id,$t(f,{floorBaseHeightM:n}));let m=c.get(f.id);m?m.push(u):c.set(f.id,[u])}let l=new Array(r.length).fill(void 0);for(let[u,p]of c){let d=s.get(u);if(!d)continue;let f=d.rake>0?Math.tan(d.rake*Math.PI/180):0,m=rn(u,r,p,t);for(let h of m.rows){let y=h.blockDepth*Se*f,b=d.height+y;for(let g of h.seatIndices)l[g]=b}}for(let u=0;u<r.length;u++){let p=r[u],d=a[u];if(!d){p.eyeHeightM=n+je;continue}let f=s.get(d.id);p.eyeHeightM=(l[u]??f.height)+je}}function vc(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 Sc(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 m=Math.hypot(f.x-n,f.y-r);m>s&&(s=m,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 p=[...e].sort((f,m)=>(f.x-n)*c+(f.y-r)*l-((m.x-n)*c+(m.y-r)*l)),d=0;for(let f of p){let m=Math.hypot(f.x-n,f.y-r);m>d&&(d=m)}return{pts:p,cx:n,cy:r,radius:d,depth:o}}function Pr(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,p=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;p<0?p=0:p>1&&(p=1);let d=Math.hypot(t-(a.x+p*c),n-(a.y+p*l));d<o&&(o=d)}return o}var sn=8;function Mc(e,t,n){let r=new Array(sn).fill(1/0),o=new Array(sn).fill(-1);for(let u=0;u<e.length;u++){let p=e[u],d=Math.hypot(t-p.cx,n-p.cy)-p.radius;for(let f=0;f<sn;f++)if(d<r[f]){for(let m=sn-1;m>f;m--)r[m]=r[m-1],o[m]=o[m-1];r[f]=d,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 p=Pr(e[u],t,n);for(let d=0;d<3;d++)if(p<i[d]){for(let f=2;f>d;f--)i[f]=i[f-1],a[f]=a[f-1];i[d]=p,a[d]=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 p=a[u];if(p<0||i[u]>s)continue;let d=1/(i[u]*i[u]);c+=d*e[p].depth,l+=d}return l>0?c/l:e[a[0]].depth}function wc(e){let t=(r,o)=>Mc(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=Pr(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 Cr(e,t){let n=[];for(let r of e){let o=Sc(r.points,t);o&&n.push(o)}return n.length<2?vc(t):(n.sort((r,o)=>r.depth-o.depth),wc(n))}var to=st(require("polygon-clipping"),1);var Er=st(require("earcut"),1);var Pc=.58,Ar=.01,Me=Oe*1.5*He,Cc=.5,Ac=.6;function Ic(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,p=Math.hypot(l,u);if(p<1e-9){r.push([0,0]);continue}l/=p,u/=p,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 Rc(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 Ir=Math.PI/12;function Ec(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 Tr(e,t){if(!e.length||!(t>0))return[];let n=Ec(e),r=(s,c,l,u)=>{let p=l-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let d=Math.max(1,Math.ceil(p/Ir)),f=t/Math.cos(p/d/2);for(let m=0;m<=d;m++){let h=c+p*m/d;u.push({x:s.x+Math.cos(h)*f,y:s.y+Math.sin(h)*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=[],p=Math.max(3,Math.ceil(Math.PI*2/Ir)),d=(l+t)/Math.cos(Math.PI/p);for(let f=0;f<p;f++){let m=f/p*Math.PI*2;u.push({x:s+Math.cos(m)*d,y:c+Math.sin(m)*d})}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 Dr(a)}function Tc(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 p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function cn(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 p=1/0;for(let d=0;d<e.length;d++){if(d===o||Math.abs(e[d].y-e[o].y)<.001)continue;let f=t[d],m=Math.hypot(u.x-f.cx,u.y-f.cy)-f.rad;if(m>=p&&m>=s)continue;let h=Tc(e[d].pts,u.x,u.y);h<p&&(p=h),e[d].depth<e[o].depth&&h<s&&(s=h,c=e[d].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((u,p)=>u-p);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function kr(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],p=u.x-r.x,d=u.y-r.y,f=Math.hypot(p,d)||1;p/=f,d/=f;let m=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+d*m,y:u.y-p*m},{x:u.x-d*m,y:u.y+p*m}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let p=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,l=Rc(i,Math.max(c*Ac,Me));return{pts:l,nrm:Ic(l,r),front:Math.max(n[t].pitch*Pc,Me),back:Math.max(n[t].pitch*Cc,Me)}}var ft=1.5,Lr=.3;function Jn(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 p=1;p<e.length-1;p++){let d=e[p],f=a>1e-12?Math.abs((d.x-n.x)*i-(d.y-n.y)*o)/a:Math.hypot(d.x-n.x,d.y-n.y);f>s&&(s=f,c=p)}if(s<=t||c<0)return[n,r];let l=Jn(e.slice(0,c+1),t),u=Jn(e.slice(c),t);return[...l.slice(0,-1),...u]}function _r(e,t){if(e.length<4)return e;let n=Jn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Fr(e,t,n){if(e.length<2)return[];let r=n??cn(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=>kr(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+ft),y:g.pts[x].y-g.nrm[x][1]*(g.front+ft)}),p=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+ft),y:g.pts[x].y+g.nrm[x][1]*(g.back+ft)}),d=l[0],f=l[l.length-1],m=[];for(let g=0;g<d.pts.length;g++)m.push(u(d,g));for(let g of l)m.push(p(g,g.pts.length-1));for(let g=f.pts.length-1;g>=0;g--)m.push(p(f,g));for(let g=l.length-1;g>=0;g--)m.push(u(l[g],0));let h=Dr(m),y=1/0;for(let g of s)e[g].y<y&&(y=e[g].y);if(!Number.isFinite(y))continue;if(h.length>=3&&Math.abs(et(h))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return Rt(h,x.x,x.y)})){i.push({outline:_r(h,Lr),holes:[],topY:y});continue}for(let g of kc(l))i.push({outline:g,holes:[],topY:y})}return i}function kc(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+ft,a=n.back+ft;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=to.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(_r(i,Lr))}return r}catch{return[]}}function Dr(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 eo=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(!Rt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Rr(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 p=1;p+1<r.length;p++){let d=r[p],f=r[p+1];e.tri([u.x*N,o,u.y*N],[d.x*N,o,d.y*N],[f.x*N,o,f.y*N],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=to.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],p=[],d=[];for(let m=0;m<u.length-1;m++)p.push(u[m][0],u[m][1]),d.push([u[m][0],u[m][1]]);if(d.length<3)continue;let f=(0,Er.default)(p,void 0,2);for(let m=0;m<f.length;m+=3){let h=d[f[m]],y=d[f[m+1]],b=d[f[m+2]];e.tri([h[0]*N,o,h[1]*N],[y[0]*N,o,y[1]*N],[b[0]*N,o,b[1]*N],c,i)}}}function Or(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??cn(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 eo([[...i]]):null,p=f=>{e.setMaterial(2),f(),e.setMaterial(0)},d=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let m=t[f];if(m.patch&&m.patch.length>=3){let C=[...m.patch],S=s[f].belowY??r;if(d(()=>{if(l&&u)Rr(e,l,u,C,m.y,o.tread);else{let A=C[0];for(let L=1;L+1<C.length;L++){let O=C[L],z=C[L+1];e.tri([A.x*N,m.y,A.y*N],[O.x*N,m.y,O.y*N],[z.x*N,m.y,z.y*N],c,o.tread)}}}),m.y>S+Ar){let A=0,L=0;for(let O of C)A+=O.x,L+=O.y;A/=C.length,L/=C.length,p(()=>{for(let O=0;O<C.length;O++){let z=C[O],B=C[(O+1)%C.length],T=B.x-z.x,w=B.y-z.y,R=Math.hypot(T,w);if(R<1e-6)continue;let P=w/R,I=-T/R;(z.x-A)*P+(z.y-L)*I<0&&(P=-P,I=-I);let G=[P,0,I],k=[z.x*N,m.y,z.y*N],M=[B.x*N,m.y,B.y*N],E=[z.x*N,S,z.y*N],D=[B.x*N,S,B.y*N];e.tri(k,M,D,G,o.riser),e.tri(k,D,E,G,o.riser)}})}continue}let h=kr(t,f,s,n);if(!h)continue;let{pts:y,nrm:b,front:g,back:x}=h,v=s[f].belowY??r;for(let C=0;C+1<y.length;C++){let S=y[C],A=y[C+1],L=b[C],O=b[C+1];if(Math.hypot(A.x-S.x,A.y-S.y)<1e-6||L[0]===0&&L[1]===0||O[0]===0&&O[1]===0)continue;let z=[(S.x-L[0]*g)*N,m.y,(S.y-L[1]*g)*N],B=[(A.x-O[0]*g)*N,m.y,(A.y-O[1]*g)*N],T=[(S.x+L[0]*x)*N,m.y,(S.y+L[1]*x)*N],w=[(A.x+O[0]*x)*N,m.y,(A.y+O[1]*x)*N];if(d(()=>{l&&u?Rr(e,l,u,[{x:S.x-L[0]*g,y:S.y-L[1]*g},{x:A.x-O[0]*g,y:A.y-O[1]*g},{x:A.x+O[0]*x,y:A.y+O[1]*x},{x:S.x+L[0]*x,y:S.y+L[1]*x}],m.y,o.tread):(e.tri(z,B,w,c,o.tread),e.tri(z,w,T,c,o.tread))}),m.y>v+Ar){let R=[z[0],v,z[2]],P=[B[0],v,B[2]],I=[-L[0],0,-L[1]];p(()=>{e.tri(z,B,P,I,o.riser),e.tri(z,P,R,I,o.riser)})}}}}function Vr(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 ln(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var no=st(require("polygon-clipping"),1);function Lc(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Br(e,t){return e.filter(n=>n.type!=="shape"||Lc(n,t))}function Nr(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Br(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Br(e.objects,t),focal:n,baseHeightM:0,index:0}]}var _c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function pt(e){return Vr(e)??_c}function Gr(e,t){let n=tn(e.outline,Me),r=pt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&ln(r,pt(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=no.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,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function zr(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=no.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 Fc=.05,Ur=.05,Dc=.15,oo=25;function Hr(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 f=e[d];for(let m of f.objects){if(m.type==="table"&&u.add(m.id),m.type!=="section"||!m.outline||m.outline.length<3)continue;let h=tn(m.outline,Me);c.set(m.id,{section:m,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:m.id,floorIndex:d,box:pt(h),section:m,unit:f,outline:h})}}let p=new Map;for(let d of l){let f=p.get(d.floorIndex);f?f.push(d):p.set(d.floorIndex,[d])}for(let d=0;d<t.length;d++){let f=t[d],m=n?p.get(n[d])??[]:l,h=f.sectionId?m.find(b=>b.id===f.sectionId)??m.find(b=>b.section.logicalSectionId===f.sectionId&&nt({x:f.x,y:f.y},b.outline,b.section.holes)):void 0,y=h?[h]:m;for(let b of y){if(n&&b.floorIndex!==n[d]||!h&&(f.x<b.box.minX||f.x>b.box.maxX||f.y<b.box.minY||f.y>b.box.maxY||!nt({x:f.x,y:f.y},b.outline,b.section.holes)))continue;o[d]=b.id;let g=c.get(b.id);g.hasSeats=!0;let x=f.focalPoint??b.unit.focal,v=Math.hypot(f.x-x.x,f.y-x.y);v<g.frontU&&(g.frontU=v),g.seatIndices.push(d);let C=f.rowId||`__seat-${d}`,S=g.rows.get(C);S?S.push({x:f.x,y:f.y}):g.rows.set(C,[{x:f.x,y:f.y}]);break}}for(let[d,f]of c){let m=$t(f.section,{floorBaseHeightM:f.unit.baseHeightM}),h=f.unit.baseHeightM,y=m.rake>0?Math.tan(m.rake*Math.PI/180):0,b=m.rake<=.01&&m.height<=h+.001,g=f.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&m.rake>.01?!1:b,v=f.hasSeats?rn(d,t,f.seatIndices,f.unit.focal):{sectionId:d,rows:[],blockCount:0},S=v.rows.length<2?Cr([...f.rows.values()].map(k=>({points:k})),f.unit.focal):null,A=1/0;if(S){if(f.hasSeats)for(let k of f.rows.values())for(let M of k){let E=S.depthAt(M.x,M.y);E<A&&(A=E)}if(!f.hasSeats||!Number.isFinite(A)){A=1/0;for(let k of f.section.outline){let M=S.depthAt(k.x,k.y);M<A&&(A=M)}}}let L=h+Fc,O=Math.max(L,m.height),z=k=>{let M=Math.max(0,k-A)*Se,E=Math.min(M*y,oo);return Math.max(L,m.height+E)},B=k=>{let M=Math.max(0,k)*Se,E=Math.min(M*y,oo);return Math.max(L,m.height+E)},T=x?[]:v.rows.map(k=>({pts:k.pts,y:B(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...u.has(k.id)?{patch:Tr(k.pts,Me)}:{}})),w=T.length?T[0].y:O,R=T.map(k=>{let M=k.patch&&k.patch.length>=3?k.patch:k.pts,E=0,D=0;for(let j of M)E+=j.x,D+=j.y;let V=M.length||1;E/=V,D/=V;let H=0;for(let j of M){let _=Math.hypot(j.x-E,j.y-D);_>H&&(H=_)}return{cx:E,cy:D,rad:H}}),P=x?()=>O:T.length>=2?(k,M)=>{let E=1/0,D=w;for(let V=0;V<T.length;V++){let H=R[V];if(Math.hypot(k-H.cx,M-H.cy)-H.rad>=E)continue;let j=T[V].patch,_=j&&j.length>=3?Rt(j,k,M)?0:mt(j,k,M):mt(T[V].pts,k,M);_<E&&(E=_,D=T[V].y)}return D}:(k,M)=>S?z(S.depthAt(k,M)):O,I=[0,1,0],G=T.length>=2||x?()=>I:(k,M)=>{if(!S)return I;let E=S.depthAt(k,M);if(E<=A)return I;let D=(E-A)*Se;if(D*y>=oo||m.height+D*y<=L)return I;let[V,H]=S.gradientAt(k,M);if(V===0&&H===0)return I;let j=1/Math.hypot(y,1);return[-V*y*j,j,-H*y*j]};if(!x)for(let k of v.rows){let M=B(k.blockDepth);for(let E of k.seatIndices)a[E]=M}for(let k of v.rows){let M=[];for(let j=1;j<k.pts.length;j++){let _=Math.hypot(k.pts[j].x-k.pts[j-1].x,k.pts[j].y-k.pts[j-1].y);_>1e-6&&M.push(_)}M.sort((j,_)=>j-_);let E=M.length?M[Math.floor(M.length/2)]:1/0,D=1/0,V=k.pts[Math.floor(k.pts.length/2)];if(V)for(let j of v.rows){if(j===k||j.blockId!==k.blockId)continue;let _=mt(j.pts,V.x,V.y);_>1e-6&&_<D&&(D=_)}let H=Math.min(E,Math.max(D,E*.5));if(Number.isFinite(H)&&H>0)for(let j of k.seatIndices)s[j]=H}r.set(d,{sectionId:d,deckAt:P,normalAt:G,flat:x,bottomY:h,rowLevels:T,landingY:w})}for(let d=0;d<t.length;d++){let f=o[d],m=t[d];if(f){let y=a[d];i[d]=(y??r.get(f).deckAt(m.x,m.y))+Dc;continue}let h=m.eyeHeightM;i[d]=Number.isFinite(h)?Math.max(0,h-je):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ce={top:1,wallBottom:.5,bottomCap:.4};function Ve(e,t){if(!e)return t;let n=ve(Pt(e,.4),.62);return he(t,n,.72)}function jr(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[p,d]of a){let f=ee(n.get(p));f&&(s+=f[0]*d,c+=f[1]*d,l+=f[2]*d,u+=d)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function Xr(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var Rm=Math.PI*2;function Yr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Wr=st(require("polygon-clipping"),1);function Oc(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var un=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=pt(t),i=this.rings.filter((c,l)=>ln(o,this.boxes[l])&&Oc(n,this.levels[l])),a=[[r]];if(i.length)try{a=Wr.default.difference([r],...i).map(l=>l.map(u=>u.map(([p,d])=>[p,d])))}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,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Vc(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of e)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.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(p=>{let d=p.x-a,f=p.y-s;return{x:a+d*l-f*u,y:s+d*u+f*l}})}function ot(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=kt(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=nn(n,r,e.width/2,e.height/2)}return t?Vc(t,e.rotation):null}function _t(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"&&Yr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Bc=.08;function Kr(e,t){let n=ot(e),r=_t(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+Bc);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Xe(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function qr(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 Ft(e,t,n){return[Xe(e[0],e[1],t),Xe(e[0],e[1],n),Xe(e[3],e[2],n),Xe(e[3],e[2],t)]}function Qr(e,t,n){return[Xe(e[0],e[3],t),Xe(e[1],e[2],t),Xe(e[1],e[2],n),Xe(e[0],e[3],n)]}function Be(e,t,n,r,o,i){le(e,t,void 0,()=>n,r,o,i,ce)}var ro=2.4,Nc=.75,Gc=.15;function Dt(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,p])=>({x:t.x+u*a-p*s,y:t.y+u*s+p*a}))}function $r(e,t,n,r,o){let i=Dt(t);i&&le(e,i,void 0,()=>n+ro,n,Ve(r,o.boothTop),o.boothWall,ce)}function io(e){if(e.shape==="round"){let u=e.radius;return u?nn(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,p])=>({x:o.x+u*a-p*s,y:o.y+u*s+p*a}))}function Zr(e,t,n,r,o){let i=io(t);i&&le(e,i,void 0,()=>n+Nc,n,Ve(r,o.tableTop),o.tableWall,ce)}function Jr(e,t,n,r,o,i,a,s){let c=ot(t);if(!c)return;let l=s?s.kind==="stage":t.role==="stage",u=s?s.kind==="screen":t.role==="screen",p=s?{kind:l?"stage":"solid",heightM:s.topY-s.baseY}:_t(t),d=s?.baseY??n,f=s?.topY??n+r;if(l&&a){let g=1/0,x=-1/0,v=1/0,C=-1/0;for(let S of c)S.x<g&&(g=S.x),S.x>x&&(x=S.x),S.y<v&&(v=S.y),S.y>C&&(C=S.y);a.push({cx:(g+x)/2*N,cz:(v+C)/2*N,y:f,halfX:Math.max((x-g)/2*N,.5),halfZ:Math.max((C-v)/2*N,.5)})}let m=ee(t.fill),h=l&&m?he(o.stageTop,ve(Pt(m,.18),.9),.9):Ve(m,l?o.stageTop:o.decorTop),y=u?m:null,b=l?m?he(o.stageWall,ve(m,.58),.82):o.stageWall:u?y?he(ve(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Ve(ee(t.fill),o.decorWall);if(p.kind==="portal"&&c.length===4){let g=qr(c);Be(e,Ft(g,0,.16),f,d,h,b),Be(e,Ft(g,.84,1),f,d,h,b),Be(e,g,f,Math.max(d,f-.35),h,b);return}if(p.kind==="suite"&&c.length===4){let g=c.map((C,S)=>{let A=c[(S+1)%4],L=(C.x+A.x)/2,O=(C.y+A.y)/2;return Math.hypot(L-i.x,O-i.y)}),x=g.indexOf(Math.min(...g)),v=[0,1,2,3].map(C=>c[(x+C)%4]);Be(e,Ft(v,0,.08),f,d,h,b),Be(e,Ft(v,.92,1),f,d,h,b),Be(e,Qr(v,.88,1),f,d,h,b),Be(e,v,f,Math.max(d,f-.18),h,b);return}Be(e,c,f,d,h,b)}function ao(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,p=o/2;return[[-u,-p],[u,-p],[u,p],[-u,p]].map(([d,f])=>({x:i+d*c-f*l,y:a+d*l+f*c}))}function zc(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 ei(e,t,n,r){if(t.layer==="foreground")return;let o=ao(t);if(!o)return;let i=n+Gc,a=Ve(zc(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),le(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ce)}function ti(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Ve(r,o.gaTop);le(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ce)}var Uc=Math.PI/180,te=96,Hc=6,jc=60,Xc=150,ni=.2,Yc=.35;function Wc(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Uc;return n<0?n+360:n}function dn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function mn(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 oi(e,t){let n=e.filter(d=>d.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let d of n)for(let f of d.rows){for(let m of f.pts)o+=m.x,i+=m.y,a++;if(f.pts.length>=4){let m=Qn(f.pts);m&&Number.isFinite(m.cx)&&Number.isFinite(m.cy)&&r.push({x:m.cx,y:m.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let d=dn(r.map(b=>b.x)),f=dn(r.map(b=>b.y)),m=0;for(let b of n)for(let g of b.rows)for(let x of g.pts){let v=Math.hypot(x.x-s.x,x.y-s.y);v>m&&(m=v)}let h=0,y=m*.2;for(let b of n)for(let g of b.rows)for(let x of g.pts)Math.hypot(x.x-d,x.y-f)<y&&h++;Math.hypot(d-s.x,f-s.y)<=m&&h/a<.01&&(c={x:d,y:f})}let l=[];for(let d of n){let f={sectionId:d.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let m of d.rows)for(let h of m.pts){let y=Math.hypot(h.x-c.x,h.y-c.y),b=Math.min(te-1,Math.floor(Wc(c,h)/(360/te)));f.samples.push({r:y,bin:b,levelM:m.levelM}),y<f.rMin&&(f.rMin=y),y>f.rMax&&(f.rMax=y)}f.samples.length&&l.push(f)}if(!l.length)return null;l.sort((d,f)=>d.rMin+d.rMax-(f.rMin+f.rMax));let u=[];for(let d of l){let f=!1;for(let m of u){let h=Math.min(d.rMax,m.rMax)-Math.max(d.rMin,m.rMin),y=Math.min(d.rMax-d.rMin,m.rMax-m.rMin);if(y>1e-9&&h>=Yc*y){m.members.push(d),m.rMin=Math.min(m.rMin,d.rMin),m.rMax=Math.max(m.rMax,d.rMax),f=!0;break}}f||u.push({members:[d],rMin:d.rMin,rMax:d.rMax})}let p=[];for(let d of u){let f=new Array(te).fill(null);for(let w of d.members)for(let R of w.samples){let P=f[R.bin];P||(P={samples:[]},f[R.bin]=P),P.samples.push({r:R.r,levelM:R.levelM})}let m=f.map(w=>!!w);if(!m.filter(Boolean).length)continue;let y=[],b=[];for(let w of f){if(!w)continue;let R=1/0,P=-1/0;for(let I of w.samples)I.r<R&&(R=I.r),I.r>P&&(P=I.r);y.push(R),b.push(P)}let g=dn(y),x=dn(b);if(!(g>=ni*x)||!(x>0))continue;let v=[...y].sort((w,R)=>w-R);if(!(v[Math.floor(v.length*.1)]>=ni*x))continue;let S=f.map(w=>{if(!w)return null;let R=[...w.samples].sort((V,H)=>V.r-H.r),P=R[0].r,I=R[R.length-1].r,G=R[0].levelM,k=-1/0;for(let V of R)V.levelM>k&&(k=V.levelM);let M=[];for(let V of R){let H={r:V.r,l:V.levelM};for(;M.length&&Math.abs(M[M.length-1].r-H.r)<1e-9;){if(M[M.length-1].l<=H.l){H.skip=!0;break}M.pop()}if(!H.skip){for(;M.length>=2;){let j=M[M.length-2],_=M[M.length-1];if((_.r-j.r)*(H.l-j.l)-(_.l-j.l)*(H.r-j.r)<=0)M.pop();else break}M.push(H)}}let E=M.map(V=>V.r),D=M.map(V=>V.l);return{inner:P,outer:I,front:G,top:k,profile:{rs:E,ls:D}}}),A=m.slice();for(let w=0;w<te;w++){if(A[w])continue;let R=-1,P=-1,I=0;for(let F=1;F<=te;F++){let X=(w-F+te*2)%te;if(A[X]){R=X;break}}for(let F=1;F<=te;F++){let X=(w+F)%te;if(A[X]){P=X,I=F;break}}if(R<0||P<0)continue;let G=0;for(let F=1;F<=te;F++){let X=(w-F+te*2)%te;if(m[X]){G=F;break}}if(G-1+I>Hc)continue;let M=S[R],E=S[P],D=G/(G+I),V=M.inner+(E.inner-M.inner)*D,H=M.outer+(E.outer-M.outer)*D,j=M.front+(E.front-M.front)*D,_=M.top+(E.top-M.top)*D;S[w]={inner:V,outer:H,front:j,top:_,profile:{rs:[V,H],ls:[j,_]}}}for(let w=0;w<te;w++)S[w]&&(A[w]=!0);let L=360/te,O=[],z=A.filter(Boolean).length,B=[];if(z===te)B.push({start:0,len:te});else{let w=0;for(;A[w];)w=(w+1)%te;let R=-1;for(let P=0;P<=te;P++){let I=(w+P)%te,G=P<te&&A[I];if(G&&R<0)R=I;else if(!G&&R>=0){let k=(I-R+te)%te||te;B.push({start:R,len:k}),R=-1}}}for(let w of B){if(w.len*L<jc&&w.len<te)continue;let R=w.len===te,P=new Float64Array(w.len),I=new Float64Array(w.len),G=new Float64Array(w.len),k=new Float64Array(w.len),M=[];for(let F=0;F<w.len;F++){let X=S[(w.start+F)%te];P[F]=X.inner,I[F]=X.outer,G[F]=X.front,k[F]=X.top,M.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let E=mn(P,R),D=mn(I,R),V=mn(G,R),H=mn(k,R);for(let F=0;F<w.len;F++)E[F]>P[F]&&(E[F]=P[F]),D[F]<I[F]&&(D[F]=I[F]),E[F]>D[F]-1e-6&&(E[F]=Math.max(0,D[F]-1e-6)),H[F]<V[F]&&(H[F]=V[F]);let j={startBin:w.start,binCount:w.len,closed:R,innerR:E,outerR:D,frontLevelM:V,topLevelM:H,profiles:M},_=(F,X,W)=>{let q=M[F],Q=q.rs,Z=q.ls;if(X<=Q[0]){Z[0]>W&&(Z[0]=W);return}if(X>=Q[Q.length-1]){Z[Z.length-1]>W&&(Z[Z.length-1]=W);return}for(let re=0;re+1<Q.length;re++)if(X<=Q[re+1]){Z[re]>W&&(Z[re]=W),Z[re+1]>W&&(Z[re+1]=W);return}};for(let F=0;F<w.len;F++){let X=f[(w.start+F)%te];if(X)for(let W of X.samples){_(F,W.r,W.levelM);let q=R?(F-1+w.len)%w.len:F-1,Q=R?(F+1)%w.len:F+1;q>=0&&_(q,W.r,W.levelM),Q<w.len&&_(Q,W.r,W.levelM)}}O.push(j)}O.reduce((w,R)=>w+R.binCount*L,0)<Xc||p.push({arcs:O,sectionIds:d.members.map(w=>w.sectionId),innerRMedian:g,outerRMedian:x})}if(!p.length)return null;if(p.sort((d,f)=>d.innerRMedian-f.innerRMedian),t){let d=p[p.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*d)return null}return{centre:c,binCount:te,binStepDeg:360/te,rings:p}}function ri(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 p=t.profiles[u],d=p.rs,f=p.ls;if(r<=d[0])return f[0];if(r>=d[d.length-1])return f[f.length-1];for(let m=0;m+1<d.length;m++)if(r<=d[m+1]){let h=d[m+1]-d[m],y=h>1e-9?(r-d[m])/h:0;return f[m]+(f[m+1]-f[m])*y}return f[f.length-1]};return l(a)*(1-c)+l(s)*c}var Kc=.25,qc=1.2,Qc=.6,$c=.45,Zc=2.3,Jc=Math.PI/180;function rt(e,t,n){let r=n*Jc;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function el(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 tl=24;function nl(e,t,n,r,o,i,a,s){let c=n.binCount,l=tl,u=Se,p=i+.02,d=[];for(let T=0;T<c;T++){let w=(n.startBin+T+.5)*t.binStepDeg,R=new Float64Array(l+1);for(let P=0;P<=l;P++){let I=r[T]+(o[T]-r[T])*P/l;R[P]=Math.max(p,ri(t,n,w,I)-Kc)}d.push(R)}let f=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],m=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],h=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],y=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(T,w)=>{let R=(n.startBin+T+.5)*t.binStepDeg,P=r[T]+(o[T]-r[T])*w/l,I=rt(t.centre,P,R);return[I.x*u,d[T][w],I.y*u]};{let T=Math.tan(12*Math.PI/180);for(let w=0;w<6;w++){let R=!1;for(let I=0;I<c;I++)for(let G=l-1;G>=0;G--)d[I][G]>d[I][G+1]&&(d[I][G]=d[I][G+1],R=!0);let P=n.closed?c:c-1;for(let I=0;I<P;I++){let G=(I+1)%c;for(let k=0;k<=l;k++){let M=d[G][k]-d[I][k];if(Math.abs(M)>1)continue;let E=r[I]+(o[I]-r[I])*k/l,D=r[G]+(o[G]-r[G])*k/l,V=rt(t.centre,E,(n.startBin+I+.5)*t.binStepDeg),H=rt(t.centre,D,(n.startBin+G+.5)*t.binStepDeg),j=T*Math.hypot(H.x-V.x,H.y-V.y)*u;M>j?(d[G][k]=d[I][k]+j,R=!0):-M>j&&(d[I][k]=d[G][k]+j,R=!0)}}if(!R)break}}let g=1,x=(T,w)=>{for(let R=0;R<=l;R+=4)if(Math.abs(d[T][R]-d[w][R])>g)return!0;return Math.abs(d[T][l]-d[w][l])>g},v=Math.tan(38*Math.PI/180),C=T=>(o[T]-r[T])/l*u,S=(T,w)=>d[T][w+1]-d[T][w]>v*Math.max(1e-6,C(T)),A=(T,w)=>{let R=n.closed?(T-1+c)%c:Math.max(0,T-1),P=n.closed?(T+1)%c:Math.min(c-1,T+1);Math.abs(d[R][w]-d[T][w])>g&&(R=T),Math.abs(d[P][w]-d[T][w])>g&&(P=T);let I=Math.max(0,w-1),G=Math.min(l,w+1);I<w&&S(T,I)&&(I=w),G>w&&S(T,w)&&(G=w);let k=b(R,w),M=b(P,w),E=b(T,I),D=b(T,G),V=M[0]-k[0],H=M[1]-k[1],j=M[2]-k[2],_=D[0]-E[0],F=D[1]-E[1],X=D[2]-E[2],W=H*X-j*F,q=j*_-V*X,Q=V*F-H*_,Z=Math.hypot(W,q,Q);return Z>1e-12?(W/=Z,q/=Z,Q/=Z,q<0&&(W=-W,q=-q,Q=-Q),[W,q,Q]):[0,1,0]},L=(T,w)=>{let R=[T[0],i,T[2]],P=[w[0],i,w[2]],I=w[0]-T[0],G=w[2]-T[2],k=Math.hypot(I,G);if(!(k>1e-12))return;let M=[G/k,0,-I/k];e.tri(T,w,P,M,h,h,y),e.tri(T,P,R,M,h,y,y)},O=.05*He,z=T=>o[T]-r[T]<O,B=n.closed?c:c-1;for(let T=0;T<B;T++){let w=(T+1)%c;if(z(T)||z(w))continue;if(x(T,w)){let M=(n.startBin+T+1)*t.binStepDeg,E=(F,X)=>{let W=(r[T]+r[w])/2,q=(o[T]+o[w])/2,Q=W+(q-W)*X/l,Z=rt(t.centre,Q,M);return[Z.x*u,d[F][X],Z.y*u]};for(let F=0;F<l;F++){let X=b(T,F),W=b(T,F+1),q=E(T,F),Q=E(T,F+1),Z=A(T,F),re=A(T,F+1);e.triN(X,q,Q,Z,Z,re,f),e.triN(X,Q,W,Z,re,re,f);let Ie=b(w,F),we=b(w,F+1),Pe=E(w,F),_e=E(w,F+1),Fe=A(w,F),Ne=A(w,F+1);e.triN(Pe,Ie,we,Fe,Fe,Ne,f),e.triN(Pe,we,_e,Fe,Ne,Ne,f);let xe=E(T,F),de=E(T,F+1),Ge=E(w,F+1),xt=E(w,F),Ce=de[0]-xe[0],Qe=de[2]-xe[2],De=Math.hypot(Ce,Qe);if(De>1e-12){let zt=[Qe/De,0,-Ce/De];e.tri(xe,de,Ge,zt,h),e.tri(xe,Ge,xt,zt,h)}}let D=b(T,0),V=b(w,0),H=b(w,l),j=b(T,l),_=F=>[F[0],i,F[2]];e.tri(_(D),_(H),_(V),[0,-1,0],m),e.tri(_(D),_(j),_(H),[0,-1,0],m),L(D,V),L(j,H);continue}for(let M=0;M<l;M++){let E=A(T,M),D=A(w,M),V=A(w,M+1),H=A(T,M+1);if(S(T,M)||S(w,M)){let W=(de,Ge)=>{let xt=(n.startBin+de+.5)*t.binStepDeg,Ce=r[de]+(o[de]-r[de])*(M+.5)/l,Qe=rt(t.centre,Ce,xt);return[Qe.x*u,Ge,Qe.y*u]},q=b(T,M),Q=b(w,M),Z=W(T,d[T][M]),re=W(w,d[w][M]);e.triN(q,Q,re,E,D,D,f),e.triN(q,re,Z,E,D,E,f);let Ie=b(w,M+1),we=b(T,M+1),Pe=W(T,d[T][M+1]),_e=W(w,d[w][M+1]);e.triN(Pe,_e,Ie,H,V,V,f),e.triN(Pe,Ie,we,H,V,H,f);let Fe=re[0]-Z[0],Ne=re[2]-Z[2],xe=Math.hypot(Fe,Ne);if(xe>1e-12){let de=[-Ne/xe,0,Fe/xe];e.tri(Z,re,_e,de,h),e.tri(Z,_e,Pe,de,h)}continue}let j=b(T,M),_=b(w,M),F=b(w,M+1),X=b(T,M+1);e.triN(j,_,F,E,D,V,f),e.triN(j,F,X,E,V,H,f)}let R=b(T,0),P=b(w,0),I=b(w,l),G=b(T,l),k=M=>[M[0],i,M[2]];e.tri(k(R),k(I),k(P),[0,-1,0],m),e.tri(k(R),k(G),k(I),[0,-1,0],m),L(R,P),L(G,I)}if(!n.closed)for(let T of[0,c-1])for(let w=0;w<l;w++)L(b(T,w),b(T,w+1))}function ii(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 p of u.arcs){let d=new Float64Array(p.binCount),f=new Float64Array(p.binCount);for(let h=0;h<p.binCount;h++){let y=(p.startBin+h)%t.binCount,b=Math.max(0,p.innerR[h]-Me);d[h]=Math.max(b,a[y]+.001),f[h]=Math.max(d[h]+.001,p.outerR[h]+Me)}let m=0;for(let h=0;h<p.binCount;h++){let y=p.topLevelM[h]-r;y>m&&(m=y)}m>=qc&&nl(e,t,p,d,f,r,o,i);for(let h=0;h<p.binCount;h++){let y=(p.startBin+h)%t.binCount;f[h]>a[y]&&(a[y]=f[h])}}if(n.deriveShell===!1||el(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Qc*He,l=$c*He;for(let u of s.arcs){let p=[],d=[];for(let h=0;h<u.binCount;h++){let y=(u.startBin+h+.5)*t.binStepDeg,b=u.outerR[h]+Me+c;p.push(rt(t.centre,b,y)),d.push(rt(t.centre,b+l,y))}let f=-1/0;for(let h=0;h<u.binCount;h++)u.topLevelM[h]>f&&(f=u.topLevelM[h]);let m=()=>f+Zc;u.closed?le(e,d,[p.slice().reverse()],m,r,o.shellTop,o.shellWall,i):le(e,[...d,...p.slice().reverse()],void 0,m,r,o.shellTop,o.shellWall,i)}}function ai(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Ve(r,s.tierTop);if(!o)return;let u=y=>o.deckAt(y.x,y.y),p=Gr(t,a),d=p[0]??t.outline;if(o.rowLevels.length>=2){let y=cn(o.rowLevels),b=zr(Fr(o.rowLevels,n.focal,y),p),g=()=>[0,1,0];for(let v of b){let C=Math.max(c,v.topY-.02);for(let S of i.subtract(v.outline,C))le(e,S,v.holes,()=>C,c,l,s.tierWall,ce,void 0,g)}b.length||le(e,d,t.holes,()=>o.landingY,c,l,s.tierWall,ce);let x={tread:[l[0]*ce.top,l[1]*ce.top,l[2]*ce.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let v of p.length?p:[d])Or(e,o.rowLevels,n.focal,o.landingY,x,v,y);return}let f=o.flat?1/0:Ur,m=y=>o.normalAt(y.x,y.y),h=o.flat?o.landingY:void 0;for(let y of i.subtract(d,h))le(e,y,t.holes,u,c,l,s.tierWall,ce,f,m)}function ol(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 p=l.rowId||`__seat-${a}`,d=u.get(p);d||(d={pts:[],levelM:0,n:0},u.set(p,d)),d.pts.push({x:l.x,y:l.y}),d.levelM+=n.seatDeckY(a),d.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 si(e,t,n,r,o,i,a=!0){let s=ol(t,n,r);if(!s.length)return;let c=oi(s,t.focal);c&&(e.setMaterial(0),ii(e,c,{bottomY:t.baseHeightM,colors:{bandTop:ve(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ve(o.tierWall,1.15),shellWall:i??o.tierWall},ao:ce,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a}))}function ci(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 li(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 rl=1.15,il=2.75,al=4.5,sl=.85,cl=.5,ll=.26;function ui(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>=rl&&a.add("zone"),o<=(i?il:al)&&(a.add("section"),a.add("ga")),o<=sl&&(a.add("annotation"),a.add("booth")),o<=cl&&a.add("row"),o<=ll&&a.add("seat"),a}function di(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,l=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>l?o/2:Math.max(c,Math.min(l,e.y))}}function Ye(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],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let d=c/p,f=l/p,m=u/p,h=d>=-1.05&&d<=1.05&&f>=-1.05&&f<=1.05&&m<=1;return{x:(d*.5+.5)*n,y:(1-(f*.5+.5))*r,depth:m,visible:h}}function mi(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(so(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var ul=6;function so(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+ul):n;return o<a&&i<r}function fi(e,t,n){return e.length*t*.58+(n?14:0)}var dl={row:8,seat:14};function pi(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:dl}function hi(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 co(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(so(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(so(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var ml=6,fl=2.2,bi=.1,pl=.3,hl=1.8,bl=.9,yl=.55,gl=6e3;function yi(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 p of u.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let l=new Map;for(let u=0;u<r.length;u++){let p=r[u],d=o.seatOwner[u],f=p.zoneId??(d?c.get(d):void 0);if(!f)continue;let m=l.get(f);m||(m={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(f,m)),m.n++,p.x<m.minX&&(m.minX=p.x),p.y<m.minY&&(m.minY=p.y),p.x>m.maxX&&(m.maxX=p.x),p.y>m.maxY&&(m.maxY=p.y),m.sumY+=o.seatDeckY(u)}for(let u of a){let p=l.get(u.id),d=[];for(let[f,m]of c)m===u.id&&d.push(f);if(!p||p.n===0){s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*N,1.5,(u.focalPoint??i).y*N]});continue}s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:d,seatCount:p.n,center:[(p.minX+p.maxX)/2*N,p.sumY/p.n,(p.minY+p.maxY)/2*N],radius:.5*Math.hypot((p.maxX-p.minX)*N,(p.maxY-p.minY)*N)||1,focalWorld:[(u.focalPoint??i).x*N,1.5,(u.focalPoint??i).y*N]})}}return s}function gi(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],p=[];for(let d of s)d.seatCount!==0&&l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+ml,d.center[2]],color:t.zones?.find(f=>f.id===d.id)?.color});{let d=new Map,f=new Map;for(let m=0;m<r.length;m++){let h=o.seatOwner[m];if(!h)continue;let y=d.get(h);y||(y={n:0,x:0,y:0,deck:0},d.set(h,y)),y.n++,y.x+=r[m].x,y.y+=r[m].y,y.deck+=o.seatDeckY(m);let b=f.get(h);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(h,b)),r[m].x<b.minX&&(b.minX=r[m].x),r[m].x>b.maxX&&(b.maxX=r[m].x),r[m].y<b.minY&&(b.minY=r[m].y),r[m].y>b.maxY&&(b.maxY=r[m].y)}for(let m of n)for(let h of m.objects){if(h.type!=="section")continue;let y=d.get(h.id);if(!y||y.n===0)continue;let b=f.get(h.id),g=[y.x/y.n*N,y.deck/y.n,y.y/y.n*N],x=h.displayLabel||h.label||h.id;u.push({id:h.id,floorIndex:m.index,label:x,seatCount:y.n,center:g,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*N),focalWorld:[m.focal.x*N,m.baseHeightM+1.5,m.focal.y*N]});let v=t.floors?.[m.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[g[0],g[1]+fl,g[2]],floorIndex:m.index})}}{for(let m of n)for(let h of m.objects){if(h.type!=="gaArea")continue;let y=It(h.points);if(!y)continue;let b=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${b} \xB7 ${h.capacity.toLocaleString()}`:b,anchor:[y.x*N,m.baseHeightM+hl,y.y*N],floorIndex:m.index})}let d=new Map;for(let m=0;m<r.length;m++){let h=r[m],y=Math.hypot(h.x-c.x,h.y-c.y),b=d.get(h.rowId);(!b||y>b.far)&&d.set(h.rowId,{seat:h,index:m,far:y})}for(let[m,h]of d){let y=h.seat.label?h.seat.label.lastIndexOf("-"):-1,b=y>0?h.seat.label.slice(0,y):m;b&&l.push({id:`row:${m}`,kind:"row",text:b,anchor:[h.seat.x*N,o.seatDeckY(h.index)+bl,h.seat.y*N],floorIndex:a[h.index]})}let f=new Map;for(let m=0;m<r.length;m++){let h=r[m],y=h.label?h.label.lastIndexOf("-"):-1,b=f.get(h.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},f.set(h.rowId,b));let g=m*3,x=i.iPosition[g],v=i.iPosition[g+1],C=i.iPosition[g+2];b.n++,b.x+=x,b.y+=v,b.z+=C,b.minX=Math.min(b.minX,x),b.maxX=Math.max(b.maxX,x),b.minZ=Math.min(b.minZ,C),b.maxZ=Math.max(b.maxZ,C)}for(let[m,h]of f)p.push({id:m,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=gl)for(let m=0;m<r.length;m++){let h=r[m],y=h.displayLabel||h.label;y&&l.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*N,o.seatDeckY(m)+yl,h.y*N],floorIndex:a[m]})}}for(let d of n)for(let f of d.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let m=ot(f),h=m?It(m):null;if(!h||!f.label)continue;l.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[h.x*N,d.baseHeightM+_t(f).heightM+bi,h.y*N],color:f.fill,floorIndex:d.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*N,d.baseHeightM+bi,f.position.y*N],color:f.color,rotation:f.rotation,floorIndex:d.index})}else if(f.type==="booth"){let m=Dt(f);if(!m)continue;let h=It(m);if(!h)continue;l.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[h.x*N,d.baseHeightM+ro+pl,h.y*N],floorIndex:d.index})}return{labels:l,sections:u,rows:p}}function xi(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 vi(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 d=0;d<i.floor.length;d+=1){let f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[d]))),m=d*3,h=l[f];h.minX=Math.min(h.minX,i.position[m]),h.minY=Math.min(h.minY,i.position[m+1]),h.minZ=Math.min(h.minZ,i.position[m+2]),h.maxX=Math.max(h.maxX,i.position[m]),h.maxY=Math.max(h.maxY,i.position[m+1]),h.maxZ=Math.max(h.maxZ,i.position[m+2])}let u=new Map;for(let d=0;d<n.length;d++)for(let f of n[d].objects)f.type==="section"&&u.set(f.id,d);let p=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 d=0;d<r.length;d++){let f=o.seatOwner[d],m=(f!==null?u.get(f):void 0)??a[d];if(m===void 0)continue;let h=p[m],y=r[d];h.n++,y.x<h.minX&&(h.minX=y.x),y.y<h.minY&&(h.minY=y.y),y.x>h.maxX&&(h.maxX=y.x),y.y>h.maxY&&(h.maxY=y.y);let b=o.seatDeckY(d);h.sumX+=y.x*N,h.sumDeck+=b,h.sumZ+=y.y*N,h.minDeck=Math.min(h.minDeck,b),h.maxDeck=Math.max(h.maxDeck,b+1.6),s[d]=m}for(let d=0;d<n.length;d++){let f=p[d],m=t.floors?.[d],h=l[d],y=Math.min(f.n?f.minX*N:n[d].focal.x*N-1,Number.isFinite(h.minX)?h.minX:1/0),b=Math.max(f.n?f.maxX*N:n[d].focal.x*N+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(f.n?f.minY*N:n[d].focal.y*N-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(f.n?f.maxY*N:n[d].focal.y*N+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),v=Math.min(f.n?Math.min(n[d].baseHeightM,f.minDeck):n[d].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),C=Math.max(f.n?Math.max(f.maxDeck,v+.5):v+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[f.n?f.sumX/f.n:(y+b)/2,f.n?f.sumDeck/f.n:(v+C)/2,f.n?f.sumZ/f.n:(g+x)/2],A=Math.max(1,.5*Math.hypot(b-y,C-v,x-g));c.push({index:d,id:m?.id??`floor-${d}`,label:m?.name??(n.length>1?`Floor ${d+1}`:"Venue"),seatCount:f.n,center:S,radius:A,box:{min:[y,v,g],max:[b,C,x]},focalWorld:[n[d].focal.x*N,n[d].baseHeightM+1.5,n[d].focal.y*N]})}}return c}function lo(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=Dt(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=io(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=ao(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 Si(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=kt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);le(e,s,void 0,()=>0,-.4,i.ground,i.ground,ce)}else{let a=t.reduce((f,m)=>m.baseHeightM<f.baseHeightM?m:f);e.setFloor(a.index);let s=n.filter((f,m)=>r[m]===a.index),c=lo([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),p=kt(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),d=a.baseHeightM-.03;le(e,p,void 0,()=>d,d-.22,i.ground,i.ground,ce)}}function Mi(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,p=-1/0,d=(h,y,b)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,y),u=Math.max(u,y),c=Math.min(c,b),p=Math.max(p,b)};for(let h=0;h<e.position.length;h+=3)d(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let y=h*3,b=t.iPosition[y],g=t.iPosition[y+1],x=t.iPosition[y+2],v=Math.max(.35,t.iMaxRadius[h]??.35);d(b-v,g,x-v),d(b+v,g+1.6,x+v)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,p=o+i);let f=[(a+l)/2,(s+u)/2,(c+p)/2],m=Math.max(1,.5*Math.hypot(l-a,u-s,p-c));return{center:f,radius:m,minY:s,maxY:u}}function wi(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let v=0;v<e.count;v++){let C=v*3,S=e.iPosition[C],A=e.iPosition[C+2];S<a&&(a=S),S>c&&(c=S),A<s&&(s=A),A>l&&(l=A)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),l=Math.max(l,v.cz+v.halfZ);let u=n.minX*N,p=n.maxX*N,d=n.minY*N,f=n.maxY*N,m=u,h=p,y=d,b=f;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,l-s));m=Math.max(u,a-v),h=Math.min(p,c+v),y=Math.max(d,s-v),b=Math.min(f,l+v)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[m,g,y],max:[h,x,b]}}var xl=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,vl=/[\s"'<>`\\]/;function Sl(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return xl.test(e);if(vl.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Pi(e){let t=e.trim();return Sl(t)?t:null}var uo="seatlayer.event-configuration/1";var ht=100,Ml=120,wl=1e5,Pl=1e4,Cl=/^[a-f0-9]{64}$/,Al=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ot(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function it(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Il(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ci(e){return!Array.isArray(e)||e.length>wl||!e.every(t=>it(t,ht))?null:[...new Set(e)].sort()}function Rl(e){return!Ot(e)||!it(e.chartId,ht)||!it(e.version,ht)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Cl.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function mo(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function El(e){return Ot(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&mo(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Tl(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Pl)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Ot(s)||!it(s.id,ht)||!it(s.objectId,ht)||!n.has(s.objectId)||!Al.has(String(s.kind))||!mo(s.heightM,.05,50)||s.baseElevationM!==void 0&&!mo(s.baseElevationM,-10,100))return null;let c=El(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Pi(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function kl(e){let t=[];if(!Ot(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==uo&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${uo}`}),it(e.id,ht)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),it(e.label,Ml)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Il(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Rl(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=Ot(e.overlay)?e.overlay:null,o=Ci(r?.objectIds),i=Ci(r?.productionKillSeatIds),a=o?Tl(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:uo,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Ai(e){let t=kl(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Ii(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Ai(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let p of n)for(let d of p.objects)d.type==="shape"&&i.set(d.id,{shape:d,unit:p});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(p=>{let d=p.runtimeContentImageUrl;return[p.id,typeof d=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(d)?d:void 0]})),l=[];for(let p of o.value.overlay.productionElements??[]){let d=i.get(p.objectId),f=d?ot(d.shape):null,m=p.baseElevationM??0;if(!d||!f||f.length<3||!p.id||a.has(p.id)||s.has(p.objectId)||!Number.isFinite(p.heightM)||p.heightM<.05||p.heightM>50||!Number.isFinite(m)||m<-10||m>100)return r();a.add(p.id),s.add(p.objectId);let h=f.map(L=>L.x*N),y=f.map(L=>L.y*N),b=d.unit.baseHeightM+m,g=Math.min(...h),x=Math.max(...h),v=Math.min(...y),C=Math.max(...y),S,A=c.get(p.id)??p.contentImageUrl;if(p.kind==="screen"&&A)if(x-g>=C-v){let L=Math.abs(v-d.unit.focal.y*N)<=Math.abs(C-d.unit.focal.y*N)?v-.006:C+.006;S=[[g,b,L],[x,b,L],[g,b+p.heightM,L],[x,b+p.heightM,L]]}else{let L=Math.abs(g-d.unit.focal.x*N)<=Math.abs(x-d.unit.focal.x*N)?g-.006:x+.006;S=[[L,b,v],[L,b,C],[L,b+p.heightM,v],[L,b+p.heightM,C]]}l.push({id:p.id,objectId:p.objectId,kind:p.kind,floorIndex:d.unit.index,baseY:b,topY:b+p.heightM,bounds:{min:[g,b,v],max:[x,b+p.heightM,C]},occlusion:p.occlusion,...A?{contentImageUrl:A}:{},...S?{contentPlane:S}:{}})}let u=l.sort((p,d)=>p.id.localeCompare(d.id));return{byObjectId:new Map(u.map(p=>[p.objectId,p])),elements:u}}function ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e){return Array.isArray(e)?e:[]}function Ll(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ye(n))continue;let r=ye(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function fn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function _l(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Fl(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function Dl(e){let t=fn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:fn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:fn(e.rotation,4),o=e.scale===void 0?[1,1,1]:fn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let u=i/l,p=a/l,d=s/l,f=c/l,m=u+u,h=p+p,y=d+d,b=u*m,g=u*h,x=u*y,v=p*h,C=p*y,S=d*y,A=f*m,L=f*h,O=f*y;return[(1-(v+S))*o[0],(g+O)*o[0],(x-L)*o[0],0,(g-O)*o[1],(1-(b+S))*o[1],(C+A)*o[1],0,(x+L)*o[2],(C-A)*o[2],(1-(b+v))*o[2],0,n[0],n[1],n[2],1]}function Ol(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function Vl(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],u=i*l-a*c,p=a*s-o*l,d=o*c-i*s,f=t*u+n*p+r*d;if(Math.abs(f)<1e-12)return null;let m=1/f;return[u*m,p*m,d*m,(r*c-n*l)*m,(t*l-r*s)*m,(n*s-t*c)*m,(n*a-r*i)*m,(r*o-t*a)*m,(t*i-n*o)*m]}function Ri(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,a=e[6]*t+e[7]*n+e[8]*r,s=Math.hypot(o,i,a)||1;return o/=s,i/=s,a/=s,[o,i,a]}function Bl(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!ye(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Nl(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Gl(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function zl(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function Ul(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Bl(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ye(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=be(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||Ll(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||be(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(be(r.images).length||be(r.textures).length)return{ok:!1,issue:"external_resource"};let a=be(r.buffers);if(a.length!==1||!ye(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=be(r.accessors),c=be(r.bufferViews),l=be(r.meshes),u=be(r.nodes),p=be(r.scenes),d=typeof r.scene=="number"?r.scene:0;if(!ye(p[d]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(o.buffer,o.byteOffset,o.byteLength),m=(v,C,S)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(s[v]))return null;let A=s[v];if(A.type!==C||A.sparse!==void 0||A.normalized===!0||typeof A.count!="number"||!Number.isInteger(A.count)||A.count<1||typeof A.componentType!="number"||!S.includes(A.componentType)||typeof A.bufferView!="number")return null;let L=c[A.bufferView];if(!ye(L)||L.buffer!==0||typeof L.byteLength!="number"||!Number.isInteger(L.byteLength)||L.byteLength<0)return null;let O=Gl(A.type),z=Nl(A.componentType),B=typeof L.byteStride=="number"?L.byteStride:O*z,T=typeof L.byteOffset=="number"?L.byteOffset:0,w=typeof A.byteOffset=="number"?A.byteOffset:0,R=T+w,P=w+(A.count-1)*B+O*z;if(!Number.isInteger(B)||!Number.isInteger(T)||!Number.isInteger(w)||B<O*z||T<0||w<0||T+L.byteLength>o.byteLength||P>L.byteLength)return null;let I=[];for(let G=0;G<A.count;G++){let k=[];for(let M=0;M<O;M++){let E=zl(f,R+G*B+M*z,A.componentType);if(!Number.isFinite(E))return null;k.push(E)}I.push(k)}return I},h=[],y=[],b=0,g=new Set,x=(v,C)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(u[v])||g.has(v))return!1;g.add(v);let S=u[v],A=Dl(S);if(!A)return!1;let L=Fl(C,A),O=Vl(L);if(!O)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let z=l[S.mesh];if(!ye(z))return!1;for(let B of be(z.primitives)){if(!ye(B)||B.mode!==void 0&&B.mode!==4||!ye(B.attributes))return!1;let T=m(B.attributes.POSITION,"VEC3",[5126]),w=B.attributes.NORMAL===void 0?null:m(B.attributes.NORMAL,"VEC3",[5126]);if(!T||B.attributes.NORMAL!==void 0&&!w)return!1;let R=T.length;if(B.indices!==void 0){let I=typeof B.indices=="number"?s[B.indices]:null;R=ye(I)?I.count:void 0}if(typeof R!="number"||!Number.isInteger(R)||R%3!==0||(b+=R/3,b>1e5))return!1;let P=B.indices===void 0?T.map((I,G)=>[G]):m(B.indices,"SCALAR",[5121,5123,5125]);if(!P||P.length%3!==0||P.length!==R)return!1;for(let I=0;I<P.length;I+=3){let G=[P[I][0],P[I+1][0],P[I+2][0]];if(G.some(E=>!Number.isInteger(E)||E<0||E>=T.length))return!1;let k=G.map(E=>Ol(L,...T[E])),M=null;if(!w){let E=k[1][0]-k[0][0],D=k[1][1]-k[0][1],V=k[1][2]-k[0][2],H=k[2][0]-k[0][0],j=k[2][1]-k[0][1],_=k[2][2]-k[0][2];M=Ri([1,0,0,0,1,0,0,0,1],D*_-V*j,V*H-E*_,E*j-D*H)}for(let E=0;E<3;E++)h.push(...k[E]),y.push(...w?Ri(O,...w[G[E]]):M)}}}for(let z of be(S.children))if(!x(z,L))return!1;return g.delete(v),!0};for(let v of be(p[d].nodes))if(!x(v,_l()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||h.length!==b*9||y.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(h),normal:new Float32Array(y)}}function Ei(e){try{return Ul(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function bt(e){let{doc:t}=e,n=sr(t.theme),r=n.structure,o=Nr(t,e.eventConfigurationId??t.eventConfigurationId),i=Ii(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new en,c=null;if(e.registeredShellGlb){let P=Ei(e.registeredShellGlb);if(P.ok){let I=P.position.length/3,G=new Float32Array(P.position.length),k=n.materials.shell??r.tierWall;for(let M=0;M<I;M++){let E=P.normal[M*3+1],D=E<-.25?.4:.62+.38*Math.max(0,E);G[M*3]=k[0]*D,G[M*3+1]=k[1]*D,G[M*3+2]=k[2]*D}c={position:P.position,normal:P.normal,color:G,floor:new Float32Array(I).fill(-2),material:new Float32Array(I),count:I}}}let l=new Map;for(let P of o)for(let I of P.objects)l.set(I.id,P.index),I.type==="section"&&l.set(I.logicalSectionId??I.id,P.index);let u=a.map(P=>l.get(P.sectionId??"")??l.get(P.rowId??"")??0),p=lo(o,a);Si(s,o,a,u,p,r);let d=jr(t,a),f=new Map,m=new Map;for(let P of t.categories??[])f.set(P.key,P.color),P.seatGlyph&&m.set(P.key,P.seatGlyph);let h=[],y=Hr(o,a,u),b=new Float32Array(a.length);for(let P=0;P<o.length;P++){let I=o[P];s.setFloor(P);let G=new un,k=[],M=I.objects.filter(E=>E.type==="section"&&!!E.outline&&E.outline.length>=3);for(let E of I.objects)if(E.type==="section")ai(s,E,I,Xr(E,d),y.bySection.get(E.id),G,M,r);else if(E.type==="shape"){let D=i.byObjectId.get(E.id);s.setMaterial((D?.kind??E.role)==="screen"?1:0),Jr(s,E,I.baseHeightM,Kr(E,k),r,I.focal,h,D),s.setMaterial(0)}else E.type==="gaArea"?ti(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="booth"?$r(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="table"?Zr(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="decorImage"&&ei(s,E,I.baseHeightM,r);si(s,I,a,y,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((P,I)=>P+I.focal.x,0)/o.length,y:o.reduce((P,I)=>P+I.focal.y,0)/o.length}:t.focalPoint??{x:(p.minX+p.maxX)/2,y:(p.minY+p.maxY)/2},x=er(c?[s.build(),c]:[s.build()]),v=ir(a,e.initialState,y,b,f,m),C=yi({doc:t,units:o,seats:a,surfaces:y,focal:g}),{labels:S,sections:A,rows:L}=gi({doc:t,units:o,seats:a,surfaces:y,seatData:v,hintedSeatFloor:u,zones:C,focal:g}),O=vi({doc:t,units:o,seats:a,surfaces:y,solids:x,hintedSeatFloor:u,seatFloor:b});xi(S,O),v.iYaw=or(v.iPosition,a.length,P=>a[P].rowId,P=>{let I=o[b[P]]?.focal??g;return[I.x*N,I.y*N]});let z=(p.minX+p.maxX)/2*N,B=(p.minY+p.maxY)/2*N,T=.5*Math.hypot((p.maxX-p.minX)*N,(p.maxY-p.minY)*N)||10,w=Mi(x,v,{cx:z,cz:B,radius:T}),R=wi(v,h,p,w.minY,w.maxY,T);return{solids:x,seats:v,bounds:{center:[(R.min[0]+R.max[0])/2,(R.min[1]+R.max[1])/2,(R.min[2]+R.max[2])/2],radius:T,groundY:0,box:R},renderBounds:{center:w.center,radius:w.radius},stateColorLUT:cr(n,Ae),theme:n,seatCount:a.length,focalWorld:[g.x*N,1.5,g.y*N],zones:C,stages:h,productionElements:i.elements,sections:A,rows:L,labels:S,floors:O}}var Hl=88,jl=20,fo={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}},Vt=new Set(["row","seat"]),Ti={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},pn={row:{x:62,y:16},seat:{x:46,y:18}},ki=ee,po=e=>ko(e);function Li(e,t){let n=po(e),r=po(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ho(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 Xl(e,t=[.04,.06,.1],n=!0){let r=po(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?ho(i,t):t,s=ki(e),c=n?7:4.5,l=s&&Li(s,a)>=c?e:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var hn=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=ui(o,i,{hasZoneLabels:this.labels.some(x=>x.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let x of this.labels){if(!s.has(x.kind))continue;let v=Ye(t,x.anchor,n,r);if(!v.visible)continue;let C=fi(x.text,fo[x.kind].size,!Vt.has(x.kind)),S=!Vt.has(x.kind),A=di(v,C/2,fo[x.kind].size/2+(S?4:1),n,r),L=a?Math.hypot(x.anchor[0]-a[0],x.anchor[1]-a[1],x.anchor[2]-a[2]):1;c.push({label:x,screen:A,focus:hi(A,L,n,r),halfWidth:C/2,...this.selectedSeatLabelIds.has(x.id)?{priority:1}:{}})}let l=li(c.filter(x=>x.label.kind==="floor"),n),u=[...c.filter(x=>!Vt.has(x.label.kind)&&x.label.kind!=="floor"),...l],p=mi(u,Hl,jl),d=pi(n),f=co(c.filter(x=>x.label.kind==="row"),pn.row.x,pn.row.y,d.row,p),m=co(c.filter(x=>x.label.kind==="seat"),pn.seat.x,pn.seat.y,d.seat,[...p,...f]),h=[...p,...f,...m],y=new Set(h.map(x=>x.label.id));for(let{label:x,screen:v}of h){let S=this.nodeFor(x).style;S.display="",S.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let b=h.filter(({label:x})=>!Vt.has(x.kind)).sort((x,v)=>Ti[v.label.kind]-Ti[x.label.kind]||x.screen.depth-v.screen.depth||x.focus-v.focus),g=[];for(let{label:x}of b){let v=this.nodes.get(x.id);if(!v||v.style.display==="none")continue;let C=v.getBoundingClientRect();g.some(A=>C.left<A.right+3&&C.right+3>A.left&&C.top<A.bottom+3&&C.bottom+3>A.top)?v.style.display="none":g.push(C)}for(let[x,v]of this.nodes)y.has(x)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(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=fo[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=!Vt.has(t.kind),s=Xl(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=ki(r?"#ecf8ff":s.ink)??[1,1,1],u=r?ho("rgba(10,28,45,.9)",c):a?ho(s.backing,c):c;return n.dataset.qualityContrast=Li(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Fi=1;var Yl=new Set(["floor","zone","section","ga","booth","annotation"]);function Wl(e){return e.every(t=>Number.isFinite(t))}function Kl(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 _i(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function ql(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function bn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Yl.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)Kl(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=[Te("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Te("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Te("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Te("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}`}]),Te("camera-invalid","The capture camera must have a finite physical pose",Wl(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Te("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}]),Te("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`}]),Te("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}))),Te("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}))),Te("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:ql(e.framing)},metrics:{minimumHierarchyFontPx:_i(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:_i(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var se=require("ogl");var We=require("ogl");var yn=`
21
21
  float chairWeight(float depth) {
22
22
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
23
23
  }`,Di=`