@seatlayer/core 0.98.0 → 0.99.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 (80) hide show
  1. package/dist/{categoryInventory-4XH7dMDH.d.ts → categoryInventory-DdJdJ4Og.d.ts} +1 -1
  2. package/dist/{categoryInventory-C-bfH2av.d.cts → categoryInventory-DuOez0-4.d.cts} +1 -1
  3. package/dist/{chunk-M5VINTGE.js → chunk-23OTKCJU.js} +1 -1
  4. package/dist/{chunk-CUACREZL.js → chunk-CTIGUXXK.js} +1 -1
  5. package/dist/{chunk-P4C24CIZ.js → chunk-D723OZEY.js} +1 -1
  6. package/dist/chunk-FYJJSWEM.js +1 -0
  7. package/dist/chunk-GLGXP5I7.js +1 -0
  8. package/dist/{chunk-FLMKHAUT.js → chunk-HO4MFTVX.js} +1 -1
  9. package/dist/chunk-HYEZPOZU.js +1 -0
  10. package/dist/chunk-K22SISYC.js +1 -0
  11. package/dist/{chunk-YPESNMTC.js → chunk-KFVUBZMK.js} +1 -1
  12. package/dist/{chunk-OLGPAFXW.js → chunk-L34T3APU.js} +1 -1
  13. package/dist/{chunk-IW7QZIMF.js → chunk-N4J4CT6P.js} +1 -1
  14. package/dist/{chunk-2P72QUJR.js → chunk-UIMDB6GZ.js} +1 -1
  15. package/dist/chunk-UISTXRO5.js +1 -0
  16. package/dist/{chunk-ASIIXY5M.js → chunk-VWT44HBR.js} +1 -1
  17. package/dist/core/chart-ops/index.cjs +1 -1
  18. package/dist/core/chart-ops/index.d.cts +6 -4
  19. package/dist/core/chart-ops/index.d.ts +6 -4
  20. package/dist/core/chart-ops/index.js +1 -1
  21. package/dist/core/inventory/index.cjs +1 -1
  22. package/dist/core/inventory/index.d.cts +4 -4
  23. package/dist/core/inventory/index.d.ts +4 -4
  24. package/dist/core/inventory/index.js +1 -1
  25. package/dist/core/layout/index.cjs +1 -1
  26. package/dist/core/layout/index.d.cts +5 -5
  27. package/dist/core/layout/index.d.ts +5 -5
  28. package/dist/core/layout/index.js +1 -1
  29. package/dist/core/quality/index.d.cts +3 -3
  30. package/dist/core/quality/index.d.ts +3 -3
  31. package/dist/core/quality/index.js +1 -1
  32. package/dist/core/render-assets/index.d.cts +2 -2
  33. package/dist/core/render-assets/index.d.ts +2 -2
  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-BEyHDxBT.d.ts → eventConfigurations-BISNREZL.d.ts} +1 -1
  41. package/dist/{eventConfigurations-BE0rFmbQ.d.cts → eventConfigurations-DYn5XP3J.d.cts} +1 -1
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.d.cts +13 -13
  44. package/dist/index.d.ts +13 -13
  45. package/dist/index.js +1 -1
  46. package/dist/{labeling-HWSKKrX8.d.ts → labeling-CzuSxAkr.d.ts} +1 -1
  47. package/dist/{labeling-SURRJh5u.d.cts → labeling-owTTG6e0.d.cts} +1 -1
  48. package/dist/{openPanorama-6FMXAJ6O.js → openPanorama-VD6PE3YZ.js} +2 -2
  49. package/dist/{renderedQuality-CZNfpB1H.d.ts → renderedQuality-BMSbVkwu.d.ts} +1 -1
  50. package/dist/{renderedQuality-QWHMvOej.d.cts → renderedQuality-Bl1Kq_XO.d.cts} +1 -1
  51. package/dist/{renderer-DEnthjgs.d.cts → renderer-Ccv8ZDZS.d.cts} +1 -1
  52. package/dist/{renderer-CuXYGgR3.d.ts → renderer-njHDbIqI.d.ts} +1 -1
  53. package/dist/{seatTypeIcons-BAyWebjw.d.cts → seatTypeIcons-QwEebl3k.d.cts} +1 -1
  54. package/dist/{seatTypeIcons-CqLiEH9C.d.ts → seatTypeIcons-dy3XQVWN.d.ts} +1 -1
  55. package/dist/{sections-DOk8zxm5.d.ts → sections-C8VTe6BN.d.ts} +1 -1
  56. package/dist/{sections-BlCiPWJJ.d.cts → sections-DSIfnBJY.d.cts} +1 -1
  57. package/dist/{segmentedRowModel-BbHdWqJy.d.cts → segmentedRowModel-CDvvJJ4-.d.cts} +1 -1
  58. package/dist/{segmentedRowModel-oVUtwW87.d.ts → segmentedRowModel-I8eYUQft.d.ts} +1 -1
  59. package/dist/{tableSizing-ExOrUwtX.d.ts → tableSizing-BLtQ-KV0.d.ts} +20 -13
  60. package/dist/{tableSizing-DaEXRHYs.d.cts → tableSizing-CB8g2Fs0.d.cts} +20 -13
  61. package/dist/{ticketRestrictions-BvG_INSV.d.cts → ticketRestrictions-BvlWLw10.d.cts} +2 -2
  62. package/dist/{ticketRestrictions-BHUMet7N.d.ts → ticketRestrictions-DUjN2bZn.d.ts} +2 -2
  63. package/dist/{types-BbqhOJ5L.d.ts → types-DWx32xXH.d.cts} +10 -1
  64. package/dist/{types-BbqhOJ5L.d.cts → types-DWx32xXH.d.ts} +10 -1
  65. package/dist/view3d/crossfade/panorama.cjs +1 -1
  66. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  67. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  68. package/dist/view3d/crossfade/panorama.js +1 -1
  69. package/dist/view3d/index.cjs +103 -47
  70. package/dist/view3d/index.d.cts +21 -4
  71. package/dist/view3d/index.d.ts +21 -4
  72. package/dist/view3d/index.js +101 -45
  73. package/dist/view3d/scene/scene.worker.cjs +1 -1
  74. package/dist/view3d/scene/scene.worker.js +1 -1
  75. package/package.json +1 -1
  76. package/dist/chunk-2MXDWZQ4.js +0 -1
  77. package/dist/chunk-QEPYNCBJ.js +0 -1
  78. package/dist/chunk-SPM2LMKI.js +0 -1
  79. package/dist/chunk-VAI2VDQR.js +0 -1
  80. package/dist/chunk-Z43H6AWN.js +0 -1
@@ -1 +1 @@
1
- import{C as f,F as d}from"../../chunk-2MXDWZQ4.js";import"../../chunk-2P72QUJR.js";import"../../chunk-OLGPAFXW.js";import"../../chunk-QJXSZT3H.js";import"../../chunk-ASIIXY5M.js";import"../../chunk-M5VINTGE.js";import"../../chunk-P4C24CIZ.js";import"../../chunk-IW7QZIMF.js";import"../../chunk-Z43H6AWN.js";import"../../chunk-4N5CHKHD.js";import"../../chunk-TQN2VWQO.js";import"../../chunk-5BMXWOE7.js";import"../../chunk-FLMKHAUT.js";import{Va as i}from"../../chunk-VAI2VDQR.js";import"../../chunk-5ITK5236.js";import"../../chunk-JBOTRSMY.js";import"../../chunk-CRCGO52K.js";function p(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(t=>t.buffer)}var c=self;c.onmessage=e=>{let s=performance.now(),t=!e.data.seats,r=e.data.seats??i(e.data.doc),{input:u,estimate:a}=d({doc:e.data.doc,seats:r,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate}),o=f(u),n=p(o);a&&n.push(a.eyeHeightM.buffer,a.focal.buffer),c.postMessage({model:o,buildMs:performance.now()-s,...t?{seats:r}:{},...a?{estimate:a}:{}},n)};
1
+ import{C as f,F as d}from"../../chunk-K22SISYC.js";import"../../chunk-UIMDB6GZ.js";import"../../chunk-L34T3APU.js";import"../../chunk-QJXSZT3H.js";import"../../chunk-VWT44HBR.js";import"../../chunk-23OTKCJU.js";import"../../chunk-D723OZEY.js";import"../../chunk-N4J4CT6P.js";import"../../chunk-HYEZPOZU.js";import"../../chunk-4N5CHKHD.js";import"../../chunk-TQN2VWQO.js";import"../../chunk-5BMXWOE7.js";import"../../chunk-HO4MFTVX.js";import{Va as i}from"../../chunk-UISTXRO5.js";import"../../chunk-5ITK5236.js";import"../../chunk-JBOTRSMY.js";import"../../chunk-CRCGO52K.js";function p(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(t=>t.buffer)}var c=self;c.onmessage=e=>{let s=performance.now(),t=!e.data.seats,r=e.data.seats??i(e.data.doc),{input:u,estimate:a}=d({doc:e.data.doc,seats:r,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate}),o=f(u),n=p(o);a&&n.push(a.eyeHeightM.buffer,a.focal.buffer),c.postMessage({model:o,buildMs:performance.now()-s,...t?{seats:r}:{},...a?{estimate:a}:{}},n)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seatlayer/core",
3
- "version": "0.98.0",
3
+ "version": "0.99.0",
4
4
  "description": "SeatLayer's seat map rendering engine — the seating chart runtime behind @seatlayer/js and the React, Vue, and Angular SDKs.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
@@ -1 +0,0 @@
1
- import{a as Pe,c as Se,d as Ie}from"./chunk-OLGPAFXW.js";import{a as be}from"./chunk-QJXSZT3H.js";import{v as Re}from"./chunk-ASIIXY5M.js";import{a as ge,c as jt,d as mt,f as ht,i as Me}from"./chunk-P4C24CIZ.js";import{f as se}from"./chunk-Z43H6AWN.js";import{e as de,l as xe}from"./chunk-4N5CHKHD.js";import{B as ce,C as qt,Ma as At,Va as fn,ba as et,ca as xt,j as ae,la as ln,na as Xt,oa as un,qa as le,sa as Ht,ta as ue,ua as fe,wa as Fn,xa as me,ya as he}from"./chunk-VAI2VDQR.js";import{A as _t,D as pe,b as ye,d as ot,y as rt}from"./chunk-JBOTRSMY.js";import xr from"earcut";import _e from"polygon-clipping";var P=et,br=.002;function gr(t,n,e){let r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.max(r,o,a);if(i<1e-9)return!0;let s=(r+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-a)))/i<br}var Lt=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=r}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let r=new Float32Array(e);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},yn=class{constructor(){this.pos=new Lt;this.nor=new Lt;this.col=new Lt;this.flr=new Lt;this.mat=new Lt;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,r,o,a,i=a,s=a){gr(n,e,r)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[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(a[0],a[1],a[2]),this.col.push3(i[0],i[1],i[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(n,e,r,o,a,i,s,c=s,u=s){[...n,...e,...r].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(u[0],u[1],u[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 Mr(t,n,e){let r=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],i=e[0]-t[0],s=e[1]-t[1],c=e[2]-t[2],u=o*c-a*s,l=a*i-r*c,f=r*s-o*i,m=Math.hypot(u,l,f)||1;return u/=m,l/=m,f/=m,[u,l,f]}function Pr(t,n){let e=[...t],r=[];for(let i of t)r.push(i.x,i.y);let o=[];if(n){for(let i of n)if(!(i.length<3)){o.push(e.length);for(let s of i)e.push(s),r.push(s.x,s.y)}}let a=xr(r,o.length?o:void 0,2);return{pts:e,tris:a}}function wt(t){return mt(t)<0?[...t].reverse():t}var Sr=3;function Ir(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(h,y,p,x)=>Math.abs(r({x:(h.x+y.x)/2,y:(h.y+y.y)/2})-(p+x)/2),c=(t.x+n.x+e.x)/3,u=(t.y+n.y+e.y)/3,l=(o+a+i)/3,f=Math.max(s(t,n,o,a),s(n,e,a,i),s(e,t,i,o),Math.abs(r({x:c,y:u})-l)),m=(h,y,p)=>{let x=Math.abs(r({x:(h+c)/2,y:(y+u)/2})-(p+l)/2);x>f&&(f=x)};return m((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+i)/2),m((e.x+t.x)/2,(e.y+t.y)/2,(i+o)/2),f}function $t(t,n,e,r,o){if(o<=0)return Ir(t,n,e,r);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},i={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max($t(t,a,s,r,o-1),$t(a,n,i,r,o-1),$t(s,i,e,r,o-1),$t(a,i,s,r,o-1))}function Qt(t,n,e,r,o,a,i,s){if(i>0){let m={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+r.x)/2,y:(e.y+r.y)/2},y={x:(r.x+n.x)/2,y:(r.y+n.y)/2};Qt(t,n,m,y,o,a,i-1,s),Qt(t,m,e,h,o,a,i-1,s),Qt(t,y,h,r,o,a,i-1,s),Qt(t,m,h,y,o,a,i-1,s);return}let c=[n.x*P,o(n),n.y*P],u=[e.x*P,o(e),e.y*P],l=[r.x*P,o(r),r.y*P];if(s){t.triN(c,u,l,s(n),s(e),s(r),a);return}let f=Mr(c,u,l);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),t.tri(c,u,l,f,a)}var Rr=8;function Ae(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,c,u)=>{if(u>0){let l={x:(a.x+i.x)/2,y:(a.y+i.y)/2},f=n(l);if(Math.abs(f-(s+c)/2)>e){o(a,l,s,f,u-1),o(l,i,f,c,u-1);return}}r.push(a)};for(let a=0;a<t.length;a++){let i=t[a],s=t[(a+1)%t.length];o(i,s,n(i),n(s),Rr)}return r}function mn(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let r=[];for(let o=0;o<e.length;o++){let a=r.length?r[r.length-1]:e[(o-1+e.length)%e.length],i=e[o],s=e[(o+1)%e.length],c=s.x-a.x,u=s.y-a.y,l=Math.hypot(c,u);l>n&&Math.abs((i.x-a.x)*u-(i.y-a.y)*c)/l<n||r.push(i)}return r.length>=3?r:e}var hn=.001*xt*.1;function V(t,n,e,r,o,a,i,s,c=1/0,u){if(!n||n.length<3||(c===void 0&&(c=1/0),Math.abs(mt(n))<1e-4))return;let l=mn(Ae(mn(wt(n),hn),r,c),hn),f=e?.map(R=>mn(Ae(mn(wt(R),hn),r,c),hn)).filter(R=>R.length>=3&&Math.abs(mt(R))>=1e-4),{pts:m,tris:h}=Pr(l,f),y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],x=[i[0]*s.top,i[1]*s.top,i[2]*s.top],b=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],d=0;if(Number.isFinite(c))for(;d<Sr;d++){let R=0;for(let A=0;A<h.length;A+=3){let S=$t(m[h[A]],m[h[A+1]],m[h[A+2]],r,d);S>R&&(R=S)}if(R<=c)break}for(let R=0;R<h.length;R+=3){let A=m[h[R]],S=m[h[R+1]],I=m[h[R+2]];Qt(t,A,S,I,r,y,d,u);let w=[A.x*P,o,A.y*P],T=[S.x*P,o,S.y*P],k=[I.x*P,o,I.y*P];t.tri(w,k,T,[0,-1,0],p)}let M=R=>{if(d<=0)return R;let A=1<<d,S=[];for(let I=0;I<R.length;I++){let w=R[I],T=R[(I+1)%R.length];for(let k=0;k<A;k++){let N=k/A;S.push({x:w.x+(T.x-w.x)*N,y:w.y+(T.y-w.y)*N})}}return S},g=ce(l),_=[{ring:M(l),flip:!1}];if(f)for(let R of f)R.length>=3&&_.push({ring:M(R),flip:!0});for(let{ring:R,flip:A}of _)for(let S=0;S<R.length;S++){let I=R[S],w=R[(S+1)%R.length],T=(w.x-I.x)*P,N=(w.y-I.y)*P,B=-T,E=Math.hypot(N,B)||1;N/=E,B/=E;let O=(I.x+w.x)/2-g.x,L=(I.y+w.y)/2-g.y,C=N*O+B*L;A&&(C=-C),C<0&&(N=-N,B=-B);let F=[N,0,B],v=[I.x*P,r(I),I.y*P],G=[w.x*P,r(w),w.y*P],j=[I.x*P,o,I.y*P],U=[w.x*P,o,w.y*P];t.tri(v,G,U,F,x,x,b),t.tri(v,U,j,F,x,b,b)}}function we(t){let n=0;for(let c of t)n+=c.count;let e=new Float32Array(n*3),r=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),i=new Float32Array(n),s=0;for(let c of t)e.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),a.set(c.floor,s),i.set(c.material,s),s+=c.count;return{position:e,normal:r,color:o,floor:a,material:i,count:n}}function Mt(t,n,e=2.5){if(n<=0||t.length<3)return t;let r=wt(t),o=r.length,a=[];for(let s=0;s<o;s++){let c=r[s],u=r[(s+1)%o],l=u.x-c.x,f=u.y-c.y,m=Math.hypot(l,f)||1;a.push({x:f/m,y:-l/m})}let i=[];for(let s=0;s<o;s++){let c=r[s],u=a[(s-1+o)%o],l=a[s],f=u.x+l.x,m=u.y+l.y,h=Math.hypot(f,m),y=()=>{i.push([c.x+u.x*n,c.y+u.y*n]),i.push([c.x+l.x*n,c.y+l.y*n])};if(h<1e-9){y();continue}f/=h,m/=h;let p=f*u.x+m*u.y,x=1/Math.max(p,1e-6);if(!Number.isFinite(x)||x>e){y();continue}i.push([c.x+f*n*x,c.y+m*n*x])}if(i.length<3)return t;try{let s=_e.union([[...i,i[0]]]),c=null,u=-1/0;for(let f of s){let m=Math.abs(mt(f[0].map(([h,y])=>({x:h,y}))));m>u&&(u=m,c=f[0])}if(!c)return t;let l=c.map(([f,m])=>({x:f,y:m}));if(l.length>1){let f=l[0],m=l[l.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&l.pop()}return l.length>=3?l:t}catch{return t}}function Dt(t,n,e=2.5){if(t.length<3)return[];if(n<=0)return t;let r=wt(t),o=r.length,a=[];for(let c=0;c<o;c++){let u=r[c],l=r[(c+1)%o],f=Math.hypot(l.x-u.x,l.y-u.y)||1;a.push({x:-(l.y-u.y)/f,y:(l.x-u.x)/f})}let i=[],s=[];for(let c=0;c<o;c++){let u=r[c],l=a[(c-1+o)%o],f=a[c],m=l.x+f.x,h=l.y+f.y,y=Math.hypot(m,h),p=y<1e-9?1/0:1/Math.max(m/y*l.x+h/y*l.y,1e-6);if(!Number.isFinite(p)||p>e){i.push({x:u.x+l.x*n,y:u.y+l.y*n},{x:u.x+f.x*n,y:u.y+f.y*n}),s.push(c,c);continue}m/=y,h/=y,i.push({x:u.x+m*n*p,y:u.y+h*n*p}),s.push(c)}for(let c=0;c<i.length;c++){let u=(c+1)%i.length,l=s[c],f=s[u];if(f!==(l+1)%o)continue;let m=r[l],h=r[f];if((i[u].x-i[c].x)*(h.x-m.x)+(i[u].y-i[c].y)*(h.y-m.y)<=0)return[]}try{let c=_e.intersection([[...i.map(y=>[y.x,y.y]),[i[0].x,i[0].y]]],[[...r.map(y=>[y.x,y.y]),[r[0].x,r[0].y]]]),u=null,l=0;for(let y of c){let p=Math.abs(mt(y[0].map(([x,b])=>({x,y:b}))));p>l&&(l=p,u=y[0])}if(!u)return[];let f=u.map(([y,p])=>({x:y,y:p})),m=f[0],h=f[f.length-1];return f.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&f.pop(),f.length>=3?wt(f):[]}catch{return[]}}function pn(t,n,e,r,o=28){let a=[];for(let i=0;i<o;i++){let s=i/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+r*Math.sin(s)})}return a}function Jt(t,n,e,r){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+r},{x:t,y:n+r}]}var tn=["available","held","sold","selected","dimmed"];function vn(t){let n=tn.indexOf(t);return n<0?0:n}var Ee={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Ua(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.78,r=.86;return[(n+(t[0]-n)*e)*r,(n+(t[1]-n)*e)*r,(n+(t[2]-n)*e)*r]}var Ln={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]},Dn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function K(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var at={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ar=.44,_r=.15,wr=.3,Er=.24;function Te(t){return t===void 0||!Number.isFinite(t)||t<=0?Er:Math.min(wr,Math.max(_r,t*Ar))}var Wa=.21,Br=.05,Nn=.45,Tr=Nn+Br,Cr=.92,Be=.66,Or=1.205,kr=-.23,Fr=.38,vr=[{part:at.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:at.pad,min:[-1,.36,-.95],max:[1,Nn,1]},{part:at.back,min:[-1,Tr,-1],max:[1,Cr,-.72]},{part:at.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:at.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:at.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:at.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:at.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:at.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:at.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Lr=[{part:at.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:at.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:at.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:at.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:at.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Dr=[{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 za(){let t=[],n=[],e=[],r=[],o=(O,L,C)=>{let F=e.length,[v,G,j]=O,U=[G[0]-v[0],G[1]-v[1],G[2]-v[2]],H=[j[0]-v[0],j[1]-v[1],j[2]-v[2]],W=U[1]*H[2]-U[2]*H[1],nt=U[2]*H[0]-U[0]*H[2],$=U[0]*H[1]-U[1]*H[0],Q=Math.hypot(W,nt,$);Q>1e-9?(W/=Q,nt/=Q,$/=Q):[W,nt,$]=L,W*L[0]+nt*L[1]+$*L[2]<0&&(W=-W,nt=-nt,$=-$);for(let X of O)t.push(...X),n.push(W,nt,$),e.push(C);r.push(F,F+1,F+2,F,F+2,F+3)},a=O=>{for(let L of Dr){let C=L.c.map(F=>F.map((v,G)=>v?O.max[G]:O.min[G]));o(C,L.n,O.part)}},i=(O,L)=>{let[C,F,v]=L?[0,1,2]:[0,2,1],G=O.min[C],j=O.max[C],U=O.min[F],H=O.max[F],W=(j-G)*.1,nt=(H-U)*.1,$=L?[[G+W,U],[j-W,U],[j,U+nt],[j*.94,H-(H-U)*.23],[j*Be,H],[G*Be,H],[G*.94,H-(H-U)*.23],[G,U+nt]]:[[G+W,U],[j-W,U],[j,U+nt],[j,H-nt],[j-W,H],[G+W,H],[G,H-nt],[G,U+nt]],Q=(D,Z,J)=>{let q=[0,0,0];return q[C]=D,q[F]=Z,q[v]=J,q},X=[O.min[v],O.max[v]].map(D=>$.map(([Z,J])=>Q(Z,J,D)));for(let D=0;D<$.length;D++){let Z=(D+1)%$.length,J=[0,0,0];J[C]=($[D][0]+$[Z][0])/2-(G+j)/2,J[F]=($[D][1]+$[Z][1])/2-(U+H)/2,o([X[0][D],X[0][Z],X[1][Z],X[1][D]],J,O.part)}for(let D=0;D<2;D++){let Z=[0,0,0];Z[v]=D?1:-1;let J=X[D];for(let q=1;q<J.length-1;q++){let ct=e.length;for(let it of[J[0],J[q],J[q+1]])t.push(...it),n.push(...Z),e.push(O.part);r.push(ct,ct+1,ct+2)}}};for(let O of vr)O.part===at.pad||O.part===at.back?i(O,O.part===at.back):a(O);for(let O of Lr)a(O);let s=Nn,c=1.08,u=.47,l=.69,f=-.55,m=.08,h=-.48,y=.01,p=[-u,s,f],x=[u,s,f],b=[-u,s,m],d=[u,s,m],M=[-l,c,h],g=[l,c,h],_=[-l,c,y],R=[l,c,y];o([x,g,R,d],[1,0,0],at.body),o([b,_,M,p],[-1,0,0],at.body),o([_,R,g,M],[0,1,0],at.body),o([p,x,d,b],[0,-1,0],at.body),o([d,R,_,b],[0,0,1],at.body),o([p,M,g,x],[0,0,-1],at.body);let A=10,S=8,I=[0,Or,kr],w=[.42,.115,Fr],T=e.length;for(let O=0;O<=S;O++){let L=Math.PI*O/S,C=Math.cos(L),F=Math.sin(L);for(let v=0;v<=A;v++){let G=Math.PI*2*v/A,j=F*Math.cos(G),U=F*Math.sin(G);t.push(I[0]+w[0]*j,I[1]+w[1]*C,I[2]+w[2]*U);let H=j/w[0],W=C/w[1],nt=U/w[2],$=Math.hypot(H,W,nt)||1;H/=$,W/=$,nt/=$,n.push(H,W,nt),e.push(at.head)}}for(let O=0;O<S;O++)for(let L=0;L<A;L++){let C=T+O*(A+1)+L,F=C+A+1;r.push(C,F,C+1,C+1,F,F+1)}let k=new Float32Array(t),N=new Float32Array(n),B=new Float32Array(e),E=new Uint16Array(r);return{position:k,normal:N,part:B,index:E,vertexCount:e.length,indexCount:r.length}}function Ce(t,n,e,r){let o=new Float32Array(n),a=u=>t[u*3],i=u=>t[u*3+2],s=0,c=(u,l)=>{let f=l-u;for(let m=u;m<l;m++){let[h,y]=r(m),p=h-a(m),x=y-i(m);if(f>=2){let b=Math.max(u,m-1),d=Math.min(l-1,m+1),M=a(d)-a(b),g=i(d)-i(b),_=Math.hypot(M,g);if(_>1e-6){let R=-g/_,A=M/_;R*p+A*x<0&&(R=-R,A=-A),p=R,x=A}}o[m]=p===0&&x===0?0:Math.atan2(p,x)}};for(let u=1;u<=n;u++)(u===n||e(u)!==e(s))&&(c(s,u),s=u);return o}var dn=.22;function nc(t,n){let e=tn[t];if(e!=="sold"&&e!=="held")return-1;let r=(n+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Nr=.42;function Gr(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let r=1/0,o=1/0,a=-1/0,i=-1/0;for(let y of t)y.x<r&&(r=y.x),y.y<o&&(o=y.y),y.x>a&&(a=y.x),y.y>i&&(i=y.y);let s=Math.max(a-r,1e-6),c=Math.max(i-o,1e-6),u=Math.max(Math.sqrt(s*c/n),1e-6),l=Math.max(1,Math.ceil(s/u)+1),f=Math.max(1,Math.ceil(c/u)+1),m=new Map,h=(y,p)=>{let x=Math.min(l-1,Math.max(0,Math.floor((y-r)/u)));return Math.min(f-1,Math.max(0,Math.floor((p-o)/u)))*l+x};for(let y=0;y<n;y++){let p=h(t[y].x,t[y].y),x=m.get(p);x?x.push(y):m.set(p,[y])}for(let y=0;y<n;y++){let p=t[y],x=Math.min(l-1,Math.max(0,Math.floor((p.x-r)/u))),b=Math.min(f-1,Math.max(0,Math.floor((p.y-o)/u))),d=1/0;for(let M=1;M<=4;M++){for(let g=b-M;g<=b+M;g++)if(!(g<0||g>=f))for(let _=x-M;_<=x+M;_++){if(_<0||_>=l||M>1&&Math.abs(g-b)<M&&Math.abs(_-x)<M)continue;let R=m.get(g*l+_);if(R)for(let A of R){if(A===y)continue;let S=Math.hypot(t[A].x-p.x,t[A].y-p.y);S<d&&(d=S)}}if(Number.isFinite(d)&&d<=M*u)break}e[y]=d}return e}function Xr(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-ln):0}function Oe(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),c=new Float32Array(i),u=new Float32Array(i*3),l=new Float32Array(i),f=new Float32Array(i),m=new Float32Array(i),h=new Float32Array(i),y=new Float32Array(i*3),p=new Map,x=Gr(t);for(let b=0;b<i;b++){let d=t[b],g=(e?.seatPitchU(b)??x[b])*P;l[b]=Number.isFinite(g)?Math.max(.06,Math.min(dn,g*Nr)):dn,f[b]=Te(Number.isFinite(g)?g:void 0);let _=xe(d.glyph,{seatGlyph:a?.get(d.categoryKey)});m[b]=de.indexOf(_),h[b]=d.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=d.x*P,s[b*3+1]=e?e.seatDeckY(b):Xr(d),s[b*3+2]=d.y*P,c[b]=vn(n?n(d):"available");let R=ot(o?.get(d.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[b*3]=R[0],u[b*3+1]=R[1],u[b*3+2]=R[2],d.accessibility?.length){let A=ot(se(d.accessibility));A&&(y[b*3]=A[0],y[b*3+1]=A[1],y[b*3+2]=A[2])}p.set(d.id,b)}return{count:i,iPosition:s,iState:c,iCategory:u,iMaxRadius:l,iRing:y,idToIndex:p,iChairWidth:f,iGlyph:m,iPhysicalSeat:h,iFloor:r??new Float32Array(i),iSection:new Float32Array(i).fill(-1),iYaw:new Float32Array(i)}}var Hr=64;function ec(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let c=vn(i.state);t.iState[s]!==c&&(t.iState[s]=c,e.push(s))}if(!e.length)return[];e.sort((i,s)=>i-s);let r=[],o=e[0],a=e[0];for(let i=1;i<e.length;i++){let s=e[i];if(s!==a){if(s<=a+Hr){a=s;continue}r.push({start:o,length:a-o+1}),o=s,a=s}}return r.push({start:o,length:a-o+1}),r}import ti from"polygon-clipping";var z={top:1,wallBottom:.58,bottomCap:.4};function kt(t,n){if(!t)return n;let e=K(_t(t,.4),.62);return rt(n,e,.22)}function ke(t,n){return t?rt(n,K(_t(t,.08),.9),.82):n}function Fe(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let r=new Map;for(let a of n){if(!a.sectionId)continue;let i=r.get(a.sectionId);i||(i=new Map,r.set(a.sectionId,i)),i.set(a.categoryKey,(i.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,i]of r){let s=0,c=0,u=0,l=0;for(let[f,m]of i){let h=ot(e.get(f));h&&(s+=h[0]*m,c+=h[1]*m,u+=h[2]*m,l+=m)}l>0&&o.set(a,[s/l,c/l,u/l])}return o}function ve(t,n){return ot(t.color)??n.get(t.logicalSectionId??t.id)??null}import Ke from"polygon-clipping";import Ge from"polygon-clipping";import jr from"earcut";var Ur=.58,Le=.01,bt=dn*1.5*xt,Yr=.5,Wr=.6;function zr(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],c=t[Math.min(e-1,i+1)],u=c.x-s.x,l=c.y-s.y,f=Math.hypot(u,l);if(f<1e-9){r.push([0,0]);continue}u/=f,l/=f,r.push([-l,u])}let o=0;for(let i=0;i<e;i++)o+=(t[i].x-n.x)*r[i][0]+(t[i].y-n.y)*r[i][1];return o<0?r.map(([i,s])=>[-i,-s]):r}function Vr(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let c=s.x-i.x,u=s.y-i.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},o=r(e[1],e[0]),a=r(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var De=Math.PI/12;function Kr(t){if(t.length<3)return[...t];let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o:[...t]}function Xe(t,n){if(!t.length||!(n>0))return[];let e=Kr(t),r=(s,c,u,l)=>{let f=u-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/De)),h=n/Math.cos(f/m/2);for(let y=0;y<=m;y++){let p=c+f*y/m;l.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,c=0;for(let h of e)s+=h.x,c+=h.y;s/=e.length||1,c/=e.length||1;let u=0;for(let h of e)u=Math.max(u,Math.hypot(h.x-s,h.y-c));let l=[],f=Math.max(3,Math.ceil(Math.PI*2/De)),m=(u+n)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let y=h/f*Math.PI*2;l.push({x:s+Math.cos(y)*m,y:c+Math.sin(y)*m})}return l}let o=e.length,a=[];for(let s=0;s<o;s++){let c=e[s],u=e[(s+1)%o];a.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return We(i)}function Zr(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,c=i.y-a.y,u=s*s+c*c,l=u>1e-12?((n-a.x)*s+(e-a.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=Math.hypot(n-(a.x+l*s),e-(a.y+l*c));f<r&&(r=f)}return r}function xn(t){let n=t.map(o=>{let a=0,i=0;for(let u of o.pts)a+=u.x,i+=u.y;let s=o.pts.length||1;a/=s,i/=s;let c=0;for(let u of o.pts){let l=Math.hypot(u.x-a,u.y-i);l>c&&(c=l)}return{cx:a,cy:i,rad:c}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},r=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),i=[],s=1/0,c=null;for(let l of a){let f=1/0;for(let m=0;m<t.length;m++){if(m===o||Math.abs(t[m].y-t[o].y)<.001)continue;let h=n[m],y=Math.hypot(l.x-h.cx,l.y-h.cy)-h.rad;if(y>=f&&y>=s)continue;let p=Zr(t[m].pts,l.x,l.y);p<f&&(f=p),t[m].depth<t[o].depth&&p<s&&(s=p,c=t[m].y)}Number.isFinite(f)&&f>0&&i.push(f)}i.sort((l,f)=>l-f);let u=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:u,belowY:c})}return r}function He(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let l=o.pts[0],f=l.x-r.x,m=l.y-r.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let y=Math.max(e[n].pitch,.001)*.5;return[{x:l.x+m*y,y:l.y-f*y},{x:l.x-m*y,y:l.y+f*y}]})():[];if(a.length<2)return null;let i=0,s=0;for(let l=1;l<a.length;l++){let f=Math.hypot(a[l].x-a[l-1].x,a[l].y-a[l-1].y);f>1e-6&&(i+=f,s++)}let c=s>0?i/s:0,u=Vr(a,Math.max(c*Wr,bt));return{pts:u,nrm:zr(u,r),front:Math.max(e[n].pitch*Ur,bt),back:Math.max(e[n].pitch*Yr,bt)}}var Ut=1.5,je=.3;function Gn(t,n){if(t.length<3)return t;let e=t[0],r=t[t.length-1],o=r.x-e.x,a=r.y-e.y,i=Math.hypot(o,a),s=-1,c=-1;for(let f=1;f<t.length-1;f++){let m=t[f],h=i>1e-12?Math.abs((m.x-e.x)*a-(m.y-e.y)*o)/i:Math.hypot(m.x-e.x,m.y-e.y);h>s&&(s=h,c=f)}if(s<=n||c<0)return[e,r];let u=Gn(t.slice(0,c+1),n),l=Gn(t.slice(c),n);return[...u.slice(0,-1),...l]}function Ue(t,n){if(t.length<4)return t;let e=Gn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function qr(t){let n=t.map((r,o)=>{let a=t[(o+1)%t.length];return{a:r,b:a,i:o,minX:Math.min(r.x,a.x),maxX:Math.max(r.x,a.x),minY:Math.min(r.y,a.y),maxY:Math.max(r.y,a.y)}}).sort((r,o)=>r.minX-o.minX),e=(r,o,a)=>(o.x-r.x)*(a.y-r.y)-(o.y-r.y)*(a.x-r.x);for(let r=0;r<n.length;r++){let o=n[r];for(let a=r+1;a<n.length&&n[a].minX<=o.maxX;a++){let i=n[a];if(!(Math.abs(o.i-i.i)===1||Math.abs(o.i-i.i)===t.length-1||o.maxY<i.minY||i.maxY<o.minY)&&e(o.a,o.b,i.a)*e(o.a,o.b,i.b)<=0&&e(i.a,i.b,o.a)*e(i.a,i.b,o.b)<=0)return!0}}return!1}function Ye(t,n,e){if(t.length<2)return[];let r=e??xn(t),o=new Map;for(let i=0;i<t.length;i++){let s=o.get(t[i].blockId);s?s.push(i):o.set(t[i].blockId,[i])}let a=[];for(let[,i]of o){let s=[];for(let d of i){let M=t[d].patch;M&&M.length>=3?a.push({outline:[...M],holes:[],topY:t[d].y}):s.push(d)}if(!s.length)continue;s.sort((d,M)=>t[d].depth-t[M].depth);let u=s.map(d=>He(t,d,r,n)).filter(d=>d!==null);if(!u.length)continue;let l=(d,M)=>({x:d.pts[M].x-d.nrm[M][0]*(d.front+Ut),y:d.pts[M].y-d.nrm[M][1]*(d.front+Ut)}),f=(d,M)=>({x:d.pts[M].x+d.nrm[M][0]*(d.back+Ut),y:d.pts[M].y+d.nrm[M][1]*(d.back+Ut)}),m=u[0],h=u[u.length-1],y=[];for(let d=0;d<m.pts.length;d++)y.push(l(m,d));for(let d of u)y.push(f(d,d.pts.length-1));for(let d=h.pts.length-1;d>=0;d--)y.push(f(h,d));for(let d=u.length-1;d>=0;d--)y.push(l(u[d],0));let p=We(y),x=1/0;for(let d of s)t[d].y<x&&(x=t[d].y);if(!Number.isFinite(x))continue;if(p.length>=3&&Math.abs(mt(p))>1e-6&&u.every(d=>{let M=d.pts[Math.floor(d.pts.length/2)];return ht(p,M.x,M.y)})&&!qr(p)){a.push({outline:Ue(p,je),holes:[],topY:x});continue}for(let d of $r(u))a.push({outline:d,holes:[],topY:x})}return a}function $r(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+Ut,i=e.back+Ut;for(let c=0;c<e.pts.length;c++){let u=e.pts[c],l=e.nrm[c];r.push([u.x-l[0]*a,u.y-l[1]*a]),o.push([u.x+l[0]*i,u.y+l[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Ge.union(n[0],...n.slice(1)),r=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([c,u])=>({x:c,y:u})),i=a[0],s=a[a.length-1];a.length>1&&Math.abs(i.x-s.x)<1e-9&&Math.abs(i.y-s.y)<1e-9&&a.pop(),a.length>=3&&r.push(Ue(a,je))}return r}catch{return[]}}function We(t){let n=[];for(let e of t){let r=n[n.length-1];r&&Math.hypot(e.x-r.x,e.y-r.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var Xn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let r of e)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(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let r=!0;for(let o of n)if(!ht(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Ne(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let u=[0,1,0],l=r[0];for(let f=1;f+1<r.length;f++){let m=r[f],h=r[f+1];t.tri([l.x*P,o,l.y*P],[m.x*P,o,m.y*P],[h.x*P,o,h.y*P],u,a)}return}let i=r.map(u=>[u.x,u.y]);i.push(i[0]);let s;try{s=Ge.intersection([i],n)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let l=u[0],f=[],m=[];for(let y=0;y<l.length-1;y++)f.push(l[y][0],l[y][1]),m.push([l[y][0],l[y][1]]);if(m.length<3)continue;let h=jr(f,void 0,2);for(let y=0;y<h.length;y+=3){let p=m[h[y]],x=m[h[y+1]],b=m[h[y+2]];t.tri([p[0]*P,o,p[1]*P],[x[0]*P,o,x[1]*P],[b[0]*P,o,b[1]*P],c,a)}}}function ze(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??xn(n),c=[0,1,0],u=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,l=a&&a.length>=3?new Xn([[...a]]):null,f=h=>{t.setMaterial(2),h(),t.setMaterial(0)},m=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let y=n[h];if(y.patch&&y.patch.length>=3){let _=[...y.patch],R=s[h].belowY??r;if(m(()=>{if(u&&l)Ne(t,u,l,_,y.y,o.tread);else{let A=_[0];for(let S=1;S+1<_.length;S++){let I=_[S],w=_[S+1];t.tri([A.x*P,y.y,A.y*P],[I.x*P,y.y,I.y*P],[w.x*P,y.y,w.y*P],c,o.tread)}}}),y.y>R+Le){let A=0,S=0;for(let I of _)A+=I.x,S+=I.y;A/=_.length,S/=_.length,f(()=>{for(let I=0;I<_.length;I++){let w=_[I],T=_[(I+1)%_.length],k=T.x-w.x,N=T.y-w.y,B=Math.hypot(k,N);if(B<1e-6)continue;let E=N/B,O=-k/B;(w.x-A)*E+(w.y-S)*O<0&&(E=-E,O=-O);let L=[E,0,O],C=[w.x*P,y.y,w.y*P],F=[T.x*P,y.y,T.y*P],v=[w.x*P,R,w.y*P],G=[T.x*P,R,T.y*P];t.tri(C,F,G,L,o.riser),t.tri(C,G,v,L,o.riser)}})}continue}let p=He(n,h,s,e);if(!p)continue;let{pts:x,nrm:b,front:d,back:M}=p,g=s[h].belowY??r;for(let _=0;_+1<x.length;_++){let R=x[_],A=x[_+1],S=b[_],I=b[_+1];if(Math.hypot(A.x-R.x,A.y-R.y)<1e-6||S[0]===0&&S[1]===0||I[0]===0&&I[1]===0)continue;let w=[(R.x-S[0]*d)*P,y.y,(R.y-S[1]*d)*P],T=[(A.x-I[0]*d)*P,y.y,(A.y-I[1]*d)*P],k=[(R.x+S[0]*M)*P,y.y,(R.y+S[1]*M)*P],N=[(A.x+I[0]*M)*P,y.y,(A.y+I[1]*M)*P];if(m(()=>{u&&l?Ne(t,u,l,[{x:R.x-S[0]*d,y:R.y-S[1]*d},{x:A.x-I[0]*d,y:A.y-I[1]*d},{x:A.x+I[0]*M,y:A.y+I[1]*M},{x:R.x+S[0]*M,y:R.y+S[1]*M}],y.y,o.tread):(t.tri(w,T,N,c,o.tread),t.tri(w,N,k,c,o.tread))}),y.y>g+Le){let B=[w[0],g,w[2]],E=[T[0],g,T[2]],O=[-S[0],0,-S[1]];f(()=>{t.tri(w,T,E,O,o.riser),t.tri(w,E,B,O,o.riser)})}}}}function Qr(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Ve(t,n){return t.filter(e=>e.type!=="shape"||Qr(e,n))}function Ze(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Ve(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Ve(t.objects,n),focal:e,baseHeightM:0,index:0}]}var Jr={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Tt(t){return ge(t)??Jr}function qe(t,n){let e=Mt(t.outline,bt),r=Tt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&jt(r,Tt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let i=Ke.difference([a(e)],...o.map(c=>[a(c.outline)])),s=[];for(let c of i){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[e]}catch{return[e]}}function $e(t,n){if(!n.length)return t;let e=a=>{let i=a.map(s=>[s.x,s.y]);return i.push(i[0]),i},r=n.map(a=>[e(a)]),o=[];for(let a of t){let i;try{i=Ke.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let c=s[0].map(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:a.topY})}}return o.length?o:t}function ni(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var bn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let r=n.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=Tt(n),a=this.rings.filter((c,u)=>jt(o,this.boxes[u])&&ni(e,this.levels[u])),i=[[r]];if(a.length)try{i=ti.difference([r],...a).map(u=>u.map(l=>l.map(([f,m])=>[f,m])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let c of i){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function gn(t,n){if(!n)return t;let e=1/0,r=-1/0,o=1/0,a=-1/0;for(let f of t)e=Math.min(e,f.x),r=Math.max(r,f.x),o=Math.min(o,f.y),a=Math.max(a,f.y);let i=(e+r)/2,s=(o+a)/2,c=n*Math.PI/180,u=Math.cos(c),l=Math.sin(c);return t.map(f=>{let m=f.x-i,h=f.y-s;return{x:i+m*u-h*l,y:s+m*l+h*u}})}function st(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=Jt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;n=pn(e,r,t.width/2,t.height/2)}return n?gn(n,t.rotation):null}function Pt(t){let n=t.role??"",e={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=n==="stage"&&me(t.stageKind)?{kind:"stage",heightM:t.stageKind==="ring-boxing"?fe:.06}:e[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var ei=.08,oi=30,ri=.015;function ii(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}function Qe(t,n){let e=st(t)??(t.points?.length?gn(t.points,t.rotation):null),r=Pt(t),a=!t.role&&r.kind==="plate"&&t.heightM===void 0&&!!e&&Math.abs(mt(e))*et**2>=oi?ri:r.heightM;if(!e)return{topOffsetM:a,supportOffsetM:0};if(r.kind!=="plate"&&r.kind!=="stage")return{topOffsetM:a,supportOffsetM:0};let i=1/0,s=1/0,c=-1/0,u=-1/0;for(let h of e)i=Math.min(i,h.x),s=Math.min(s,h.y),c=Math.max(c,h.x),u=Math.max(u,h.y);let l=a,f=0,m=1e-6*Math.max(1,c-i,u-s);for(let h of n)c>h.minX&&i<h.maxX&&u>h.minY&&s<h.maxY&&l<=h.topOffsetM+1e-6&&(l=h.topOffsetM+ei),i>=h.minX-m&&c<=h.maxX+m&&s>=h.minY-m&&u<=h.maxY+m&&(!h.poly||e.every(x=>ii(x,h.poly)||si(x,h.poly,m)))&&(f=Math.max(f,h.topOffsetM));return t.fill&&t.fill!=="none"&&t.fill!=="transparent"&&n.push({minX:i,minY:s,maxX:c,maxY:u,topOffsetM:l,poly:e}),{topOffsetM:l,supportOffsetM:Math.min(f,l)}}function si(t,n,e){for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[o],i=n[r],s=i.x-a.x,c=i.y-a.y,u=s*s+c*c,l=u?Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/u)):0;if(Math.hypot(t.x-(a.x+l*s),t.y-(a.y+l*c))<=e)return!0}return!1}function Ft(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function yt(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function ut(t,n,e){return[Ft(t[0],t[1],n),Ft(t[0],t[1],e),Ft(t[3],t[2],e),Ft(t[3],t[2],n)]}function nn(t,n,e){return[Ft(t[0],t[3],n),Ft(t[1],t[2],n),Ft(t[1],t[2],e),Ft(t[0],t[3],e)]}function tt(t,n,e,r,o,a){V(t,n,void 0,()=>e,r,o,a,z)}function en(t){if(t.length<3)return t.map(a=>({...a}));let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o.map(a=>({...a})):n.map(a=>({...a}))}var ai=.8,ci=.6,li=2;function Mn(t,n){if(!n.length)return null;let e=[],r=0;for(let i of t.objects){if(i.type!=="shape"||i.role!=="wall")continue;let s=st(i)??[],c=Je(s)/2;!(c>0)||ui(s)/c*P>li||(e.push(...s),r+=c)}if(e.length<3)return null;let o=en(e);if(o.length<3||r<Je(o)*ci)return null;let a=0;for(let i of n)fi(i,o)&&(a+=1);return a>=n.length*ai?o:null}function ui(t){let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=r.x*o.y-o.x*r.y}return Math.abs(n)/2}function Je(t){let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=Math.hypot(o.x-r.x,o.y-r.y)}return n}function fi(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}var mi=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],hi=1.2,yi=12;function to(t){if(t.heightM!==void 0)return!1;let n=st(t);if(!n||n.length<3)return!1;let e=0;for(let o=0;o<n.length;o++){let a=n[o],i=n[(o+1)%n.length];e+=Math.hypot(i.x-a.x,i.y-a.y)}return e*et<yi*2?!1:2*Pn(n)/e*et<=hi}function Hn(t){if(!t)return null;for(let[n,e]of mi)if(n.test(t))return e;return null}var oo="auto-rows-";function ro(t){return t.id.startsWith(oo)&&!t.label}var pi=1.15,di=.09,io=6,xi=34,bi=.35,gi=6,Mi=.35,Pi=.75,Si=12,Ii=2.5,Ri=40,Ai=[18,24],_i=[12,16],no=14,wi=.8,Ei=.6,Bi=5,Ti=.3,so=.4,Ci=2,Oi=400,ki=2.6,Fi=1.6,vi=6e3,Li=.6,Di="#c3c7cd",eo=300,Ni=240;function Gi(t,n,e,r){if(!t.fill||!/^#[0-9a-f]{6}$/i.test(t.fill))return null;let o=Un([...n]),a=new Set;for(let l of r)a.add(Math.floor(Math.atan2(l.y-o.y,l.x-o.x)*180/Math.PI/10));if(a.size*10<Ni)return null;let{h:i,s,l:c}=pe(ye(t.fill));return i<70/360||i>170/360||s<.2||c<.08||c>.75||e.some(l=>l!==t&&l.type==="shape"&&st(l)?.some(f=>Wn(f,n)))?null:t.kind==="ellipse"?"oval-cricket":t.kind==="rect"?"pitch-football":null}var Xi="Estimated from the drawing; confirm with the venue.",ao=t=>{if(!t.length)return null;let n=[...t].sort((r,o)=>r-o),e=Math.floor(n.length/2);return n.length%2?n[e]:(n[e-1]+n[e])/2},Un=t=>({x:t.reduce((n,e)=>n+e.x,0)/t.length,y:t.reduce((n,e)=>n+e.y,0)/t.length}),Pn=t=>{let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=r.x*o.y-o.x*r.y}return Math.abs(n)/2};function Hi(t){return t.height!==void 0||t.rake!==void 0||t.elevation!==void 0||t.surfaceKind!==void 0}function Yn(t){let n=new Map;for(let e of t){let r=n.get(e.rowId);r?r.push(e):n.set(e.rowId,[e])}return n}function Wn(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}function zn(t,n){let e=n[0],r=1/0;for(let o=0;o<n.length;o++){let a=n[o],i=n[(o+1)%n.length],s=i.x-a.x,c=i.y-a.y,u=s*s+c*c,l=u>0?Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/u)):0,f={x:a.x+s*l,y:a.y+c*l},m=Math.hypot(t.x-f.x,t.y-f.y);m<r&&(r=m,e=f)}return e}function co(t,n){let e=0,r=0;for(let o of t.values()){if(o.length<3)continue;let a=o[0],i=o[o.length-1],s=i.x-a.x,c=i.y-a.y,u=Math.hypot(s,c);if(u<1e-6)continue;let l={x:(a.x+i.x)/2,y:(a.y+i.y)/2},f=zn(l,n),m=f.x-l.x,h=f.y-l.y,y=Math.hypot(m,h);y<1e-6||(r+=Math.abs((-c*m+s*h)/(u*y))*o.length,e+=o.length)}return e?r/e:0}function ji(t,n,e){let r=t.filter(p=>p.type==="shape"),o=r.find(p=>p.role==="stage");if(o){let p=st(o);return p?{shape:o,centre:Un(p),outline:p,inferred:!1}:null}if(!e.length)return null;let a=1/0,i=-1/0,s=1/0,c=-1/0;for(let p of e)a=Math.min(a,p.x),i=Math.max(i,p.x),s=Math.min(s,p.y),c=Math.max(c,p.y);let u=(i-a)*(c-s),l=[];for(let p of r){if(p.role)continue;let x=st(p);if(!x)continue;let b=Pn(x);if(b*et*et<6||b>u)continue;let d=Math.min(...x.map(I=>I.x)),M=Math.max(...x.map(I=>I.x)),g=Math.min(...x.map(I=>I.y)),_=Math.max(...x.map(I=>I.y)),R=0;for(let I of e)I.x>d&&I.x<M&&I.y>g&&I.y<_&&Wn(I,x)&&R++;if(R>e.length*.05)continue;let A=Un(x),S=co(n,x);S>=wi&&l.push({shape:p,centre:A,outline:x,score:S,area:b,box:[d,g,M,_]})}let f=(p,x)=>x!==p&&x.area>p.area&&p.box[0]>=x.box[0]-1e-6&&p.box[1]>=x.box[1]-1e-6&&p.box[2]<=x.box[2]+1e-6&&p.box[3]<=x.box[3]+1e-6,m=l.filter(p=>!l.some(x=>f(p,x))),h=Math.max(0,...m.map(p=>p.score)),y=m.filter(p=>p.score>=h-.03).sort((p,x)=>x.area-p.area)[0]??null;return y?{shape:y.shape,centre:y.centre,outline:y.outline,inferred:!0}:null}function Ui(t,n,e){if(!e||e.length<3)return Math.hypot(t.x-n.x,t.y-n.y);let r=zn(t,e);return Math.hypot(t.x-r.x,t.y-r.y)}function lo(t){let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y);if(n.length<3)return n;let e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=[];for(let a of n){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}let o=[];for(let a=n.length-1;a>=0;a--){let i=n[a];for(;o.length>=2&&e(o[o.length-2],o[o.length-1],i)<=0;)o.pop();o.push(i)}return[...r.slice(0,-1),...o.slice(0,-1)]}function Yi(t){if(!t.length||t.length>vi)return[];let n=[...Yn(t).values()],e=n.map((s,c)=>c),r=s=>e[s]===s?s:e[s]=r(e[s]),o=Fi/et,a=n.map(s=>({minX:Math.min(...s.map(c=>c.x))-o,maxX:Math.max(...s.map(c=>c.x))+o,minY:Math.min(...s.map(c=>c.y))-o,maxY:Math.max(...s.map(c=>c.y))+o}));for(let s=0;s<n.length;s++)for(let c=s+1;c<n.length;c++){let u=a[s],l=a[c];if(u.maxX<l.minX||l.maxX<u.minX||u.maxY<l.minY||l.maxY<u.minY)continue;n[s].some(m=>n[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=o))&&(e[r(s)]=r(c))}let i=new Map;return n.forEach((s,c)=>{let u=r(c),l=i.get(u);l?l.push(...s):i.set(u,[...s])}),[...i.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function Wi(t,n,e){if(!n.length)return null;let r=n.filter(S=>e.tableIds.has(S.rowId)||S.kind==="booth").length>n.length/2,o=Yn(n),a=!e.outline||co(o,e.outline)>=Ei,i=0,s=0;for(let S of o.values()){if(S.length<2)continue;let I=S[0],w=S[S.length-1],T=w.x-I.x,k=w.y-I.y,N=Math.hypot(T,k);if(N<1e-6)continue;let B={x:(I.x+w.x)/2,y:(I.y+w.y)/2},E=a?e.outline?zn(B,e.outline):e.focal:e.middle,O=-k/N,L=T/N;O*(E.x-B.x)+L*(E.y-B.y)<0&&(O=-O,L=-L),i+=O*S.length,s+=L*S.length}let c={x:n.reduce((S,I)=>S+I.x,0)/n.length,y:n.reduce((S,I)=>S+I.y,0)/n.length};if(Math.hypot(i,s)<1e-9){let S=a?e.focal:e.middle;i=S.x-c.x,s=S.y-c.y}let u=Math.hypot(i,s)||1,l={x:i/u,y:s/u},f=S=>-(S.x*l.x+S.y*l.y),m=S=>-S.x*l.y+S.y*l.x,h=1/0,y=-1/0,p=1/0,x=-1/0,b=1/0,d=new Map;for(let S of n){let I=f(S),w=m(S);h=Math.min(h,I),y=Math.max(y,I),p=Math.min(p,w),x=Math.max(x,w),a&&(b=Math.min(b,Ui(S,e.focal,e.outline)));let T=S.logicalRowId??S.rowId,k=d.get(T);k?k.push(I):d.set(T,[I])}a||(b=Math.max(0,h-f(e.middle)));let M=[...d.values()].map(S=>ao(S)).sort((S,I)=>S-I),g=[];if(!r)for(let S of M)g.length&&S-g[g.length-1]<Mi/et||g.push(S);let _=Hi(t),R=Xt(t,{floorBaseHeightM:e.baseHeightM}),A={id:t.id,section:t,authored:_,plane:e,facing:l,facesAction:a,hull:lo(n),sample:n.filter((S,I)=>I%Math.ceil(n.length/Oi)===0),frontD:h,backD:y,latMin:p,latMax:x,frontDistance:b,rowDepths:g,rowCount:g.length,level:0,height:R.height,rake:_?R.rake:0,backHeight:0};return A.backHeight=A.height+(y-h)*et*Math.tan(A.rake*Math.PI/180),A}function zi(t,n,e,r){if(t.length<2)return 0;let o=Math.max(1,n*et),a=e+pi-r,i=0,s=0;for(let u=1;u<t.length;u++){let l=Math.max(Pi,(t[u]-t[u-1])*et),f=(a+di)*(o+l)/o;i+=f-a,s+=l,a=f,o+=l}let c=Math.atan(i/s)*180/Math.PI;return Math.round(Math.max(io,Math.min(xi,c))*10)/10}function Vi(t,n){if(t.facing.x*n.facing.x+t.facing.y*n.facing.y<Ti)return null;let e=-1/0,r=1/0,o=-1/0;for(let f of n.hull){e=Math.max(e,-(f.x*t.facing.x+f.y*t.facing.y));let m=-f.x*t.facing.y+f.y*t.facing.x;r=Math.min(r,m),o=Math.max(o,m)}if(Math.min(t.latMax,o)-Math.max(t.latMin,r)<so*(t.latMax-t.latMin))return null;let i=Ci/et,s=new Map,c=new Map;for(let f of t.sample){let m=Math.floor((-f.x*t.facing.y+f.y*t.facing.x)/i),h=-(f.x*t.facing.x+f.y*t.facing.y);s.set(m,Math.min(s.get(m)??1/0,h))}for(let f of n.sample){let m=Math.floor((-f.x*t.facing.y+f.y*t.facing.x)/i),h=-(f.x*t.facing.x+f.y*t.facing.y);c.set(m,Math.max(c.get(m)??-1/0,h))}let u=[];for(let[f,m]of s){let h=c.get(f);h!==void 0&&u.push(m-h)}let l=u.length?ao(u):t.frontD-e;return l<-1/et?null:l}function Ki(t,n){if(n.plane.floorIndex>=t.plane.floorIndex)return!1;let e=-1/0,r=1/0,o=1/0,a=-1/0;for(let c of n.hull){let u=-(c.x*t.facing.x+c.y*t.facing.y);e=Math.max(e,u),r=Math.min(r,u);let l=-c.x*t.facing.y+c.y*t.facing.x;o=Math.min(o,l),a=Math.max(a,l)}let i=Math.min(t.latMax,a)-Math.max(t.latMin,o),s=Math.min(t.backD,e)-Math.max(t.frontD,r);return i>so*(t.latMax-t.latMin)&&s>1/et}function Zi(t,n=!1){let e=n?_i:Ai,r=new Map,o=[...t].sort((c,u)=>c.plane.floorIndex-u.plane.floorIndex||c.frontDistance-u.frontDistance),a=[],i=new Map,s=c=>{if(c.plane.floorIndex===0||c.plane.baseHeightM>0)return c.plane.baseHeightM;let u=i.get(c.plane.floorIndex-1);return u===void 0?c.plane.baseHeightM:u+Re};for(let c of o){if(!c.authored){let l=s(c),f;for(let y of a){if(y.plane.floorIndex>c.plane.floorIndex)continue;if(Ki(c,y)){let b=y.backHeight+ki;b>l&&(l=b,f=y);continue}let p=Vi(c,y);if(p==null)continue;let x=y.backHeight+bi+Math.min(gi,Math.max(0,p)*et)*Math.tan(y.rake*Math.PI/180);x>l&&(l=x,f=y)}c.height=Math.round(Math.min(l,c.plane.baseHeightM+Ri)*100)/100;let m=!f&&c.height>c.plane.baseHeightM;if(c.level=f?f.level+1:m?1:0,c.rake=zi(c.rowDepths,c.frontDistance,c.height,c.plane.focalHeightM),!c.facesAction&&c.rowCount<Bi)c.rake=0;else if(!f&&!m){let y=Math.max(1e-6,(c.backD-c.frontD)*et);c.rake=Math.min(c.rake,Si,Math.round(Math.atan(Ii/y)*1800/Math.PI)/10)}else c.rowCount>=2&&(c.rake=Math.max(c.rake,e[Math.min(c.level,e.length)-1]));let h=(c.backD-c.frontD)*et;if(n&&h>0&&c.height+h*Math.tan(c.rake*Math.PI/180)>c.plane.baseHeightM+no){let y=Math.max(0,c.plane.baseHeightM+no-c.height);c.rake=Math.max(io,Math.round(Math.atan(y/h)*1800/Math.PI)/10)}c.backHeight=c.height+h*Math.tan(c.rake*Math.PI/180),r.set(c.id,f?.id)}let u=c.plane.floorIndex;i.set(u,Math.min(i.get(u)??1/0,c.height)),a.push(c)}return r}var jn=(t,n)=>!!t&&t.x===n.x&&t.y===n.y;function uo(t,n={x:0,y:-40}){let e=fn(t),r=new Map;for(let x of e){if(!x.sectionId)continue;let b=r.get(x.sectionId);b?b.push(x):r.set(x.sectionId,[x])}let o={focalInferred:!1,confident:!1,sections:[]},a=t.floors?.length?t.floors.map((x,b)=>({objects:x.objects,floorIndex:b,floorId:x.id,baseHeightM:x.baseHeightM??0,focal:x.focalPoint??t.focalPoint})):[{objects:t.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:t.focalPoint}],i=new Set(a.flatMap(x=>x.objects.filter(b=>b.type==="table").map(b=>b.id))),s=[],c,u=new Set,l=a.map(x=>{let b=k=>!t.floors?.length||k.floorId===x.floorId,d=Yi(e.filter(k=>!k.sectionId&&k.kind!=="booth"&&!i.has(k.rowId)&&b(k))),M=[];for(let k of d){let N=Mt(wt(lo(k)),Li/et);if(e.some(E=>!b(E)&&Wn(E,N)))continue;let B=`${oo}${x.floorIndex}-${M.length}`;u.add(B),r.set(B,k),M.push({type:"section",id:B,label:"",color:Di,outline:N})}let g=M.length?{...x,objects:[...x.objects,...M]}:x,_=new Set(g.objects.filter(k=>k.type==="section").map(k=>k.logicalSectionId??k.id)),R=[...r.entries()].filter(([k])=>_.has(k)).flatMap(([,k])=>k),A=ji(g.objects,Yn(R),R),S=g.focal;(A||g.focal&&!jn(g.focal,n))&&(o.confident=!0),A&&(o.stage??={id:A.shape.id,inferred:A.inferred,...g.floorId?{floorId:g.floorId}:{}},(A.inferred||jn(g.focal,n))&&(S=A.centre,o.focalInferred=!0));let I=A&&(!A.inferred||Pn(A.outline)*et*et<=eo),w=A?void 0:c,T={tableIds:i,floorIndex:g.floorIndex,floorId:g.floorId,baseHeightM:g.baseHeightM,focal:w?.focal??S,outline:A?.outline??w?.outline,focalHeightM:w?.focalHeightM??g.baseHeightM+(A&&I?Pt({...A.shape,role:"stage"}).heightM:0),middle:R.length?{x:R.reduce((k,N)=>k+N.x,0)/R.length,y:R.reduce((k,N)=>k+N.y,0)/R.length}:S};for(let k of g.objects){if(k.type!=="section")continue;let N=Wi(k,r.get(k.logicalSectionId??k.id)??[],T);N&&s.push(N)}return T.outline&&(c=T),jn(g.focal,T.focal)||(o.focal??=[]).push({...g.floorId?{floorId:g.floorId}:{},point:{...T.focal}}),{unit:g,plane:T,stage:A,planeSeats:R}}),f=a.flatMap(x=>x.objects).map(x=>x.type==="shape"&&!x.role&&(Hn(x.label)==="wall"||!Hn(x.label)&&to(x))?{...x,role:"wall"}:x),m=Mn({objects:f},e)!==null;m&&(o.indoor=!0);let h=Zi(s,m),y=new Map(s.filter(x=>!x.authored).map(x=>[x.id,x])),p=l.map(({unit:x,plane:b,stage:d,planeSeats:M})=>x.objects.map(g=>{let _=g.type==="shape"&&!g.role&&g.id!==d?.shape.id?Hn(g.label):null;if(g.type==="shape"&&!g.role&&g.id!==d?.shape.id&&(_==="wall"||!_&&to(g))&&g.type==="shape"){(o.roles??=[]).push({id:g.id,...b.floorId?{floorId:b.floorId}:{},role:"wall"});let{fill:T,...k}=g;return{...k,role:"wall"}}if(_&&g.type==="shape")return(o.roles??=[]).push({id:g.id,...b.floorId?{floorId:b.floorId}:{},role:_}),{...g,role:_};let A=d?.inferred&&g.id===d.shape.id&&g.type==="shape"?Gi(g,d.outline,x.objects,M):null;if(A&&g.type==="shape")return o.stage?.id===g.id&&(o.stage.field=A),{...g,role:"stage",stageKind:A};if(d?.inferred&&g.id===d.shape.id&&g.type==="shape"&&Pn(d.outline)*et*et<=eo)return o.stage?.id===g.id&&(o.stage.deck=!0),{...g,role:"stage"};let S=g.type==="section"?y.get(g.id):void 0;if(!S||g.type!=="section")return g;let I=S.rowCount>=2&&S.rake>0;u.has(S.id)?o.looseRowBlocks=(o.looseRowBlocks??0)+1:o.sections.push({id:S.id,floorId:b.floorId,surfaceKind:I?"rakedRows":"flat",height:S.height,rake:S.rake,stackedOn:h.get(S.id)});let w={status:"inferred",source:"public-2d-topology",note:Xi};return{...g,height:S.height,rake:S.rake,surfaceKind:I?"rakedRows":"flat",physical3dProvenance:{height:w,rake:w,surfaceKind:w}}}));if(t.floors?.length){let x=t.floors.map((b,d)=>({...b,objects:p[d],focalPoint:l[d].plane.focal}));return{doc:{...t,floors:x,objects:x[0].objects,focalPoint:x[0].focalPoint},report:o}}return{doc:{...t,objects:p[0],focalPoint:l[0].plane.focal},report:o}}function jc(t,n,e){return e<0?n>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===e)}function Uc(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),r=[];for(let o of e){let a=r.find(i=>i.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((a,i)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(i-(o.length-1)/2)*104))}})))}var qi=1.15,$i=2.75,Qi=4.5,Ji=.85,ts=.5,ns=.26;function Yc(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set;return o>=.75&&i.add("floor"),o>=qi&&i.add("zone"),o<=(a?$i:Qi)&&(i.add("section"),i.add("ga")),o<=Ji&&(i.add("annotation"),i.add("booth")),o<=ts&&i.add("row"),o<=ns&&i.add("seat"),i}function Wc(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,c=a+e,u=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:c>u?o/2:Math.max(c,Math.min(u,t.y))}}function zc(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],c=o[0]*a+o[4]*i+o[8]*s+o[12],u=o[1]*a+o[5]*i+o[9]*s+o[13],l=o[2]*a+o[6]*i+o[10]*s+o[14],f=o[3]*a+o[7]*i+o[11]*s+o[15];if(!(f>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/f,h=u/f,y=l/f,p=m>=-1.05&&m<=1.05&&h>=-1.05&&h<=1.05&&y<=1;return{x:(m*.5+.5)*e,y:(1-(h*.5+.5))*r,depth:y,visible:p}}function Vc(t,n,e=n){let r=[],o=[...t].sort((a,i)=>a.screen.depth-i.screen.depth);for(let a of o){let i=!1;for(let s of r)if(Vn(a,s,n,e)){i=!0;break}i||r.push(a)}return r}var es=6;function Vn(t,n,e,r){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),i=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+es):e;return o<i&&a<r}function Kc(t,n,e){return t.length*n*.58+(e?14:0)}var os={row:8,seat:14};function Zc(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:os}function qc(t,n,e,r){let o=Math.max(1,Math.min(e,r)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-r/2)/o);return n*(1+1.5*a)}function $c(t,n,e,r,o=[]){let a=[...t].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),i=[];for(let s of a){if(i.length>=r)break;let c=!1;for(let u of o)if(Vn(s,u,n,e)){c=!0;break}if(!c){for(let u of i)if(Vn(s,u,n,e)){c=!0;break}}c||i.push(s)}return i}function Qc(t,n,e,r){let o=t[3]*n[0]+t[7]*n[1]+t[11]*n[2]+t[15];return o<=0||!(e>0)?0:e*Math.hypot(t[0],t[4],t[8])*r/(2*o)}function Yt(t,n,e){if(t.length!==4||e<=n)return null;let r=yt(t),o=Math.hypot(r[1].x-r[0].x,r[1].y-r[0].y)*P,a=Math.hypot(r[3].x-r[0].x,r[3].y-r[0].y)*P;if(o<1e-6||a<1e-6)return null;let i=Math.min(.22/o,.16),s=Math.min(.28,(e-n)*.13),c=Math.min(.065/a,.2);return{quad:r,side:i,face:c,opening:ut(r,i,1-i),openingTop:e-s}}function Kn(t,n,e){if(t.length!==4||e-n<=.2)return null;let r=yt(t),o=Math.hypot(r[1].x-r[0].x,r[1].y-r[0].y)*P;if(o<=1e-6)return null;let a=Math.min(.14,(e-n)*.08,o*.08),i=a/o,s=ut(r,i,1-i);return{quad:r,side:i,trim:a,inner:s,panel:nn(s,.15,.85),bottom:n+a,top:e-a}}function fo(t,n,e,r){let o=Kn(t,n,e);if(!o)return;let{panel:a}=o,i=(d,M)=>({x:(d.x+M.x)/2,y:(d.y+M.y)/2}),s=i(a[0],a[1]),c=i(a[3],a[2]),u=Math.hypot(s.x-r.x,s.y-r.y)<=Math.hypot(c.x-r.x,c.y-r.y),[l,f]=u?[a[0],a[1]]:[a[3],a[2]],m=u?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(f.y-l.y)*m.x+(f.x-l.x)*m.y<0&&([l,f]=[f,l]);let y=Math.min(.006,h*P*.05),p=m.x/h*y,x=m.y/h*y,b=(d,M)=>[d.x*P+p,M,d.y*P+x];return[b(l,o.bottom),b(f,o.bottom),b(l,o.top),b(f,o.top)]}import rs from"polygon-clipping";function Ct(t,n,e,r,o,a,i,s={}){let c=Tt(n),u=s.ao??z,l=o.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let x=st(p);if(!x||x.length!==4||!jt(c,Tt(x)))return[];let b=s.portalBase??e,d=Yt(x,b,b+Pt(p).heightM);if(!d)return[];let M=Math.min(r,d.openingTop);return M<=e?[]:[{poly:d.opening,height:M}]});if(!l.length)return!1;let f=p=>p.map(x=>[x.x,x.y]),m=[f(n),...(s.holes??[]).map(f)],h=[e,...new Set(l.map(p=>p.height)),r].sort((p,x)=>p-x),y=[];try{for(let p=1;p<h.length;p++){let x=h[p-1],b=h[p];if(b-x<1e-6)continue;let d=l.filter(g=>g.height>x+1e-6).map(g=>[f(g.poly)]),M=d.length?rs.difference(m,...d):[m];y.push({low:x,high:b,polys:M})}}catch{return!1}for(let p of y)for(let x of p.polys){let[b,...d]=x.map(g=>g.map(([_,R])=>({x:_,y:R}))),M=g=>u.wallBottom+(u.top-u.wallBottom)*(g-e)/(r-e);V(t,b,d,()=>p.high,p.low,a,i,{...u,top:M(p.high),wallBottom:M(p.low)})}return!0}function mo(t,n,e,r,o,a,i){let s=r-e;if(s<=0)return;let c=s<1.5?[[e,r,1]]:[[e,e+Math.min(.9,s*.18),.82],[e+Math.min(.9,s*.18),r-.1,1],[r-.1,r,1.1]],u=l=>z.wallBottom+(z.top-z.wallBottom)*(l-e)/s;for(let[l,f,m]of c){let h={...z,top:u(f),wallBottom:u(l)},y=K(a,m),p=K(i,m);Ct(t,n,l,f,o,y,p,{portalBase:e,ao:h})||V(t,n,void 0,()=>f,l,y,p,h)}}function on(t,n,e){let r=ot(n.stroke?.color),o=n.stroke?.width??0;if(!r||!Number.isFinite(o)||o<=0)return;let a=n.kind==="line"||n.kind==="polyline",i=a?gn(n.points??[],n.rotation):st(n);if(!i||i.length<2)return;let s=a?i.length-1:i.length,c=o*.5;for(let u=0;u<s;u++){let l=i[u],f=i[(u+1)%i.length],m=Math.hypot(f.x-l.x,f.y-l.y);if(m<1e-6)continue;let h=-(f.y-l.y)/m*c,y=(f.x-l.x)/m*c,p=[(l.x+h)*P,e,(l.y+y)*P],x=[(f.x+h)*P,e,(f.y+y)*P],b=[(f.x-h)*P,e,(f.y-y)*P],d=[(l.x-h)*P,e,(l.y-y)*P];t.tri(p,x,b,[0,1,0],r),t.tri(p,b,d,[0,1,0],r)}}function ho(t){return t==="bar"||t==="concession"||t==="coat"||t==="restroom"}var Wt=(t,n,e)=>({x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e});function Sn(t,n,e,r){let[o,a,i,s]=n?t:[t[3],t[2],t[1],t[0]];return[Wt(o,s,e),Wt(a,i,e),Wt(a,i,r),Wt(o,s,r)]}function yo(t,n,e,r,o,a,i,s,c=!1){if(e.length!==4||o-r<.4)return!1;let u=S=>c?Math.min(S,o):S,l=yt(e),f=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*P;if(f<.4)return!1;let m=Wt(l[0],l[1],.5),h=Wt(l[3],l[2],.5),y=Math.hypot(m.x-s.x,m.y-s.y)<=Math.hypot(h.x-s.x,h.y-s.y),p=rt(i,[.92,.9,.86],.35),x=K(a,.72),b=o-r;if(n==="restroom"){let S=Math.min(.18,b*.08);return tt(t,l,o-S,r,i,a),tt(t,l,o,o-S,p,p),!0}let d=r+Math.min(1.1,b),M=n==="coat"?1:Math.min(.5,.75/f),g=Sn(l,y,0,M);if(tt(t,g,d-.05,r,x,a),tt(t,g,d,d-.05,p,p),n==="coat"||f<1.2)return!0;if(n==="bar"){let S=Sn(l,y,Math.max(M+.2,1-.45/f),1),I=u(r+Math.max(Math.min(2.2,b*2),d-r+.6));return tt(t,S,I,r,i,x),!0}let _=Sn(l,y,Math.max(M+.25,.55),1),R=u(r+Math.max(2.6,d-r+1.4));if(R-.14<=d)return!0;tt(t,_,R-.14,r,i,a),tt(t,l,R,R-.14,p,x);let A=Math.min(.08,.1/Math.max(.1,Math.hypot(l[1].x-l[0].x,l[1].y-l[0].y)*P));for(let[S,I]of[[0,A],[1-A,1]])tt(t,Sn(ut(l,S,I),y,0,Math.min(.08,.1/f)),R-.14,d,x,x);return!0}var vt=.06,is=.05,xo=.05,po=.15,Zn=25;function bo(t,n,e){let r=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),i=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),c=new Map,u=[],l=new Set;for(let m=0;m<t.length;m+=1){let h=t[m];for(let y of h.objects){if(y.type==="table"&&l.add(y.id),y.type!=="section"||!y.outline||y.outline.length<3)continue;let p=Mt(y.outline,bt);c.set(y.id,{section:y,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:y.id,floorIndex:m,box:Tt(p),section:y,unit:h,outline:p})}}let f=new Map;for(let m of u){let h=f.get(m.floorIndex);h?h.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<n.length;m++){let h=n[m],y=e?f.get(e[m])??[]:u,p=h.sectionId?y.find(b=>b.id===h.sectionId)??y.find(b=>b.section.logicalSectionId===h.sectionId&&At({x:h.x,y:h.y},b.outline,b.section.holes)):void 0,x=p?[p]:y;for(let b of x){if(e&&b.floorIndex!==e[m]||!p&&(h.x<b.box.minX||h.x>b.box.maxX||h.y<b.box.minY||h.y>b.box.maxY||!At({x:h.x,y:h.y},b.outline,b.section.holes)))continue;o[m]=b.id;let d=c.get(b.id);d.hasSeats=!0;let M=h.focalPoint??b.unit.focal,g=Math.hypot(h.x-M.x,h.y-M.y);g<d.frontU&&(d.frontU=g),d.seatIndices.push(m);let _=h.rowId||`__seat-${m}`,R=d.rows.get(_);R?R.push({x:h.x,y:h.y}):d.rows.set(_,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let y=Xt(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,x=y.rake>0?Math.tan(y.rake*Math.PI/180):0,b=y.rake<=.01&&y.height<=p+.001,d=h.section.surfaceKind,M=d==="flat"?!0:d==="rakedRows"&&y.rake>.01?!1:b,g=h.hasSeats?le(m,n,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},R=g.rows.length<2?Pe([...h.rows.values()].map(C=>({points:C})),h.unit.focal):null,A=1/0;if(R){if(h.hasSeats)for(let C of h.rows.values())for(let F of C){let v=R.depthAt(F.x,F.y);v<A&&(A=v)}if(!h.hasSeats||!Number.isFinite(A)){A=1/0;for(let C of h.section.outline){let F=R.depthAt(C.x,C.y);F<A&&(A=F)}}}let S=p+is,I=Math.max(S,y.height),w=C=>{let F=Math.max(0,C-A)*et,v=Math.min(F*x,Zn);return Math.max(S,y.height+v)},T=C=>{let F=Math.max(0,C)*et,v=Math.min(F*x,Zn);return Math.max(S,y.height+v)},k=M?[]:g.rows.map(C=>({pts:C.pts,y:T(C.blockDepth),depth:C.blockDepth,blockId:C.blockId,...l.has(C.id)?{patch:Xe(C.pts,bt)}:{}})),N=k.length?k[0].y:I,B=k.map(C=>{let F=C.patch&&C.patch.length>=3?C.patch:C.pts,v=0,G=0;for(let H of F)v+=H.x,G+=H.y;let j=F.length||1;v/=j,G/=j;let U=0;for(let H of F){let W=Math.hypot(H.x-v,H.y-G);W>U&&(U=W)}return{cx:v,cy:G,rad:U}}),E=M?()=>I:k.length>=2?(C,F)=>{let v=1/0,G=N;for(let j=0;j<k.length;j++){let U=B[j];if(Math.hypot(C-U.cx,F-U.cy)-U.rad>=v)continue;let H=k[j].patch,W=H&&H.length>=3?ht(H,C,F)?0:un(H,C,F):un(k[j].pts,C,F);W<v&&(v=W,G=k[j].y)}return G}:(C,F)=>R?w(R.depthAt(C,F)):I,O=[0,1,0],L=k.length>=2||M?()=>O:(C,F)=>{if(!R)return O;let v=R.depthAt(C,F);if(v<=A)return O;let G=(v-A)*et;if(G*x>=Zn||y.height+G*x<=S)return O;let[j,U]=R.gradientAt(C,F);if(j===0&&U===0)return O;let H=1/Math.hypot(x,1);return[-j*x*H,H,-U*x*H]};if(!M)for(let C of g.rows){let F=T(C.blockDepth);for(let v of C.seatIndices)i[v]=F}for(let C of g.rows){let F=[];for(let H=1;H<C.pts.length;H++){let W=Math.hypot(C.pts[H].x-C.pts[H-1].x,C.pts[H].y-C.pts[H-1].y);W>1e-6&&F.push(W)}F.sort((H,W)=>H-W);let v=F.length?F[Math.floor(F.length/2)]:1/0,G=1/0,j=C.pts[Math.floor(C.pts.length/2)];if(j)for(let H of g.rows){if(H===C||H.blockId!==C.blockId)continue;let W=un(H.pts,j.x,j.y);W>1e-6&&W<G&&(G=W)}let U=Math.min(v,Math.max(G,v*.5));if(Number.isFinite(U)&&U>0)for(let H of C.seatIndices)s[H]=U}r.set(m,{sectionId:m,deckAt:E,normalAt:L,flat:M,bottomY:p,rowLevels:k,landingY:N})}for(let m=0;m<n.length;m++){let h=o[m],y=n[m];if(h){let b=i[m];a[m]=(b??r.get(h).deckAt(y.x,y.y))+po;continue}let p=y.eyeHeightM,x=Number.isFinite(p)?Math.max(0,p-ln):0;a[m]=y.kind==="booth"?x+vt+po:x}return{bySection:r,seatOwner:o,seatDeckY:m=>a[m],seatPitchU:m=>s[m]}}var ss=[.12,.38,.16],as=[.72,.62,.45],cs=[.88,.93,.96],go=[.95,.95,.94],ls=[.66,.29,.22],qn={length:20.12,width:3.05},us=.14,fs=9.76,Ot=[.93,.94,.95],In=[.1,.11,.13],ms=[.45,.85,1.25],hs=1.45,Mo=.012,Po=.004,ys=1.07,ps=.15;function Vt(t,n,e,r,o,a){t.setMaterial(a),V(t,n,e?[e.slice().reverse()]:void 0,()=>r,r-.004,o,o,z)}var So=(t,n)=>Dt(t,n/P);function Io(t,n,e){let r=n.x-t.x,o=n.y-t.y,a=Math.hypot(r,o);if(a<1e-9)return null;let i=-o/a*e,s=r/a*e;return[{x:t.x+i,y:t.y+s},{x:n.x+i,y:n.y+s},{x:n.x-i,y:n.y-s},{x:t.x-i,y:t.y-s}]}function ds(t,n,e,r){let o=n.map(a=>[a.x*P,e,a.y*P]);t.tri(o[0],o[1],o[2],[0,1,0],r),t.tri(o[0],o[2],o[3],[0,1,0],r)}function Rn(t,n,e,r,o,a){let i=e/P,s=[{x:n.x-i,y:n.y-i},{x:n.x+i,y:n.y-i},{x:n.x+i,y:n.y+i},{x:n.x-i,y:n.y+i}];V(t,s,void 0,()=>o,r,a,K(a,.85),z)}function zt(t,n,e,r,o,a,i){let s=Io(n,e,r/P);s&&V(t,s,void 0,()=>a,o,i,K(i,.85),z)}function An(t){let n=yt(t),e={x:(n[0].x+n[2].x)/2,y:(n[0].y+n[2].y)/2},r=Math.hypot(n[1].x-n[0].x,n[1].y-n[0].y)||1,o=Math.hypot(n[3].x-n[0].x,n[3].y-n[0].y)||1,a={x:(n[1].x-n[0].x)/r,y:(n[1].y-n[0].y)/r},i={x:(n[3].x-n[0].x)/o,y:(n[3].y-n[0].y)/o};return{at:(c,u)=>({x:e.x+(a.x*c+i.x*u)/P,y:e.y+(a.y*c+i.y*u)/P}),lengthM:r*P,widthM:o*P}}function Ro(t,n,e){let r=he(n);if(!r.length)return;let o=1/0,a=-1/0,i=1/0,s=-1/0;for(let M of n.points??[])o=Math.min(o,M.x),a=Math.max(a,M.x),i=Math.min(i,M.y),s=Math.max(s,M.y);let c=(n.rotation??0)*Math.PI/180,u=Math.cos(c),l=Math.sin(c),f=(o+a)/2,m=(i+s)/2,h=M=>c?{x:f+(M.x-f)*u-(M.y-m)*l,y:m+(M.x-f)*l+(M.y-m)*u}:M,y=Math.min(a-o,s-i)*P,p=Math.max(.04,Math.min(.3,y*.004))/P,x=0;t.setMaterial(0);for(let M of r){if(!M.fill)continue;let g=M.points.map(h);Vt(t,g,null,e+Mo+x*Po,ot(M.fill)??Ot,0),x++}let b=r.filter(M=>!(M.fill&&M.ink===M.fill)),d=[...new Set(b.map(M=>M.ink??Fn))];for(let M of d){let g=e+Mo+x++*Po,_=ot(M)??Ot;for(let R of b){if((R.ink??Fn)!==M)continue;let A=R.points.map(h),S=R.closed?A.length:A.length-1;for(let I=0;I<S;I++){let w=Io(A[I],A[(I+1)%A.length],p);w&&ds(t,w,g,_)}}}}function Ao(t,n,e,r,o){if(n.length<3)return!1;let a=r+.006,i=o??ss;if(e==="oval-cricket"){let s=n.reduce((_,R)=>_+R.x,0)/n.length,c=n.reduce((_,R)=>_+R.y,0)/n.length,u=_=>n.map(R=>({x:s+(R.x-s)*_,y:c+(R.y-c)*_})),l=8;for(let _=0;_<l;_++){let R=u(1-_/l),A=_===l-1?null:u(1-(_+1)/l);Vt(t,R,A,a,K(i,_%2?1.04:.96),4)}let f=n[0];for(let _ of n)Math.hypot(_.x-s,_.y-c)>Math.hypot(f.x-s,f.y-c)&&(f=_);let m=Math.hypot(f.x-s,f.y-c)||1,h=(f.x-s)/m,y=(f.y-c)/m,p=-y,x=h,b=Math.min(1,2*m*P*us/qn.length),d=qn.length*b/2/P,M=qn.width*b/2/P,g=[[-d,-M],[d,-M],[d,M],[-d,M]].map(([_,R])=>({x:s+h*_+p*R,y:c+y*_+x*R}));return Vt(t,g,null,a+.004,as,0),t.setMaterial(0),!0}if(e==="rink-hockey"){let s=So(n,ps);return Vt(t,s,null,a,cs,0),t.setMaterial(0),V(t,n,[s.slice().reverse()],()=>r+ys,r,go,K(go,.9),z),!0}if(e==="ring-boxing"&&n.length===4){let{at:s}=An(n),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],u=[[.77,.19,.19],Ot,[.17,.42,.69],Ot];t.setMaterial(0),c.forEach((l,f)=>Rn(t,l,.07,r,r+hs,u[f]));for(let l of ms)for(let f=0;f<4;f++)zt(t,c[f],c[(f+1)%4],.025,r+l-.025,r+l+.025,Ot);return!0}if(e==="court-tennis"&&n.length===4){let{at:s}=An(n);t.setMaterial(0),zt(t,s(0,-6.4),s(0,6.4),.015,r,r+.95,In),zt(t,s(0,-6.4),s(0,6.4),.03,r+.95,r+1,Ot);for(let c of[-1,1])Rn(t,s(0,c*6.4),.05,r,r+1.07,In);return!0}if(e==="court-basketball"&&n.length===4){let{at:s,lengthM:c}=An(n),u=Math.min(14,c/2-.5);t.setMaterial(0);for(let l of[-1,1]){let f=s(l*(u+1.2),0),m=s(l*(u-1.2),0);Rn(t,f,.12,r,r+3.4,In),zt(t,f,m,.06,r+3.25,r+3.4,In),zt(t,s(l*(u-1.2),-.9),s(l*(u-1.2),.9),.03,r+2.9,r+3.95,Ot)}return!0}if(e==="pitch-rugby"&&n.length===4){let{at:s,lengthM:c}=An(n),u=c*(50/120);t.setMaterial(0);for(let l of[-1,1]){for(let f of[-2.8,2.8])Rn(t,s(l*u,f),.07,r,r+12,Ot);zt(t,s(l*u,-2.8),s(l*u,2.8),.06,r+2.94,r+3.06,Ot)}return!0}if(e==="track-athletics"){let s=So(n,fs);return s.length<3?!1:(Vt(t,n,s,a,ls,0),Vt(t,s,null,a,i,4),t.setMaterial(0),!0)}return!1}var xs=.012,En=2.4,bs=1,gs=.75,Ms=.15;function Et(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:r,rotation:o}=t;if(!e||!r)return null;let a=(o??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),c=e/2,u=r/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:n.x+l*i-f*s,y:n.y+l*s+f*i}))}function Co(t,n,e,r,o,a,i=!1){let s=Et(n);if(s){if(i){let c=kt(r,o.boothTop),u=wt([...s]);V(t,Mt(u,Ps/P),[u.slice().reverse()],()=>e+.03,e,c,K(c,.8),z);return}if(!(!n.points&&a&&Is(t,s,e,r,a))){if(!n.points&&a&&s.length===4){Ss(t,s,e,r,a);return}V(t,s,void 0,()=>e+En,e,kt(r,o.boothTop),o.boothWall,z)}}}var $n=1.1,_o=[.9,.9,.88],Ps=.1,_n=[.87,.87,.85],wo=.08;function Oo(t,n){let e=c=>({x:(t[c].x+t[(c+1)%4].x)/2,y:(t[c].y+t[(c+1)%4].y)/2}),r=0,o=1/0;for(let c=0;c<4;c++){let u=e(c),l=Math.hypot(u.x-n.x,u.y-n.y);l<o&&(o=l,r=c)}let a=[0,1,2,3].map(c=>t[(r+c)%4]),i=(c,u,l)=>({x:c.x+(u.x-c.x)*l,y:c.y+(u.y-c.y)*l});return{q:a,part:(c,u,l,f)=>{let m=i(a[0],a[1],c),h=i(a[0],a[1],u),y=i(a[3],a[2],c),p=i(a[3],a[2],u);return[i(m,y,l),i(h,p,l),i(h,p,f),i(m,y,f)]},depthM:Math.hypot(a[3].x-a[0].x,a[3].y-a[0].y)*P,widthM:Math.hypot(a[1].x-a[0].x,a[1].y-a[0].y)*P}}function Ss(t,n,e,r,o){let{q:a,part:i}=Oo(n,o),s=r??[.35,.42,.55],c=rt(s,[.78,.78,.77],.62),u=rt(s,[.95,.95,.94],.45);tt(t,a,e+vt,e,c,K(c,.8)),tt(t,i(.05,.95,.72,.98),e+$n-.05,e+vt,u,K(u,.8)),tt(t,i(.03,.97,.7,1),e+$n,e+$n-.05,_o,K(_o,.9))}function Is(t,n,e,r,o){if(n.length!==4)return!1;let{q:a,part:i,depthM:s,widthM:c}=Oo(n,o);if(s<1||c<1)return!1;let u=r??[.35,.42,.55],l=rt(u,[.78,.78,.77],.62),f=e+En,m=wo/c,h=wo/s;tt(t,a,e+vt,e,l,K(l,.8)),tt(t,i(0,1,1-h,1),f,e+vt,_n,K(_n,.9));for(let[x,b]of[[0,m],[1-m,1]])tt(t,i(x,b,0,1-h),f,e+vt,_n,K(_n,.9));tt(t,i(m,1-m,0,Math.min(.5,.06/s)),f,f-.3,u,K(u,.85));let y=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return tt(t,i(.5-y,.5+y,.72-p,.72+p),e+bs,e+vt,rt(u,[.95,.95,.94],.7),K(u,.75)),!0}function Bn(t){if(t.shape==="round"){let l=t.radius;return l?pn(t.center.x,t.center.y,l,l,24):null}let{width:n,height:e,rotation:r,center:o}=t;if(!n||!e)return null;let a=(r??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),c=n/2,u=e/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:o.x+l*i-f*s,y:o.y+l*s+f*i}))}function ko(t,n,e,r,o,a=!0){let i=Bn(n);if(!i)return;let s=i.reduce((m,h)=>m+h.x,0)/i.length,c=i.reduce((m,h)=>m+h.y,0)/i.length,u=m=>i.map(h=>({x:s+(h.x-s)*m,y:c+(h.y-c)*m})),l=a&&r?kt(r,o.tableTop):Rs,f=e+gs;V(t,i,void 0,()=>f,e+As,l,K(l,.86),z),V(t,u(.12),void 0,()=>f+.12,f,Eo,K(Eo,.8),z)}var Rs=[.93,.92,.89],Eo=[.78,.66,.42],As=.25;function Fo(t,n,e,r,o,a,i,s,c=[]){let u=st(n);if(!n.role&&(!n.fill||n.fill==="none"||n.fill==="transparent")||!u){on(t,n,e+r+xs);return}let f=s?s.kind==="stage":n.role==="stage",m=s?s.kind==="screen":n.role==="screen",h=s?{kind:f?"stage":"solid",heightM:s.topY-s.baseY}:Pt(n),y=s?.baseY??e,p=s?.topY??e+r;if(f&&i){let S=1/0,I=-1/0,w=1/0,T=-1/0;for(let k of u)k.x<S&&(S=k.x),k.x>I&&(I=k.x),k.y<w&&(w=k.y),k.y>T&&(T=k.y);i.push({cx:(S+I)/2*P,cz:(w+T)/2*P,y:p,halfX:Math.max((I-S)/2*P,.5),halfZ:Math.max((T-w)/2*P,.5)})}let x=ot(n.fill),b=n.role==="wall"||n.role==="entrance"||n.role==="exit",d=b?x?K(_t(x,.12),.95):o.tierTop:f&&x?rt(o.stageTop,K(_t(x,.18),.9),.9):!n.role&&x?x:kt(x,f?o.stageTop:o.decorTop),M=m?x:null,g=b?x?K(_t(x,.12),.85):o.tierWall:f?x?rt(o.stageWall,K(x,.58),.82):o.stageWall:m?M?rt(K(M,1.42),[.24,.46,.82],.08):[.24,.46,.82]:kt(ot(n.fill),o.decorWall);if(n.role==="wall"&&!s){mo(t,u,y,p,c,d,g),on(t,n,p+.012);return}if(m&&u.length===4&&p-y>.2){let S=Kn(u,y,p);if(!S)return;let{quad:I,side:w,trim:T,inner:k,panel:N}=S,B=[.12,.15,.18];for(let[E,O]of[[0,w],[1-w,1]])tt(t,ut(I,E,O),p,y,B,B);tt(t,k,y+T,y,B,B),tt(t,k,p,p-T,B,B),tt(t,N,p-T,y+T,g,g),on(t,n,p+.012);return}let _=x?K(_t(x,.15),.82):g,R=x?K(_t(x,.1),1.02):d;if(ho(n.role)&&!s&&yo(t,n.role,u,y,p,_,R,a,n.heightM!==void 0))return;if((n.role==="sound"||s?.kind==="sound_desk")&&u.length===4&&p-y>.3){let S=yt(u),I=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*P,w=Math.min(.12,.09/Math.max(I,.001)),T=[.18,.21,.24],k=p-Math.min(.12,(p-y)*.15);for(let[N,B]of[[0,w],[1-w,1]])tt(t,ut(S,N,B),k,y,T,T);tt(t,S,p,k,d,T);return}if(n.role==="rail"&&u.length===4&&p>y){let S=yt(u),I=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*P,w=Math.max(1,Math.min(128,Math.ceil(I/1.4))),T=Math.min(.08,.055/Math.max(.055,I)),k=[.58,.64,.66];for(let N=0;N<=w;N++){let B=N/w,E=Math.min(1-T,Math.max(0,B-T/2));tt(t,ut(S,E,E+T),p,y,k,K(k,.8))}for(let N of[.52,1]){let B=y+(p-y)*N;tt(t,S,B,Math.max(y,B-.055),k,K(k,.8))}return}if(n.role==="goal"&&u.length===4){let S=yt(u),I=Math.hypot(S[1].x-S[0].x,S[1].y-S[0].y)*P,w=Math.min(.12,.1/Math.max(.1,I)),T=[.9,.94,.94];for(let[k,N]of[[0,w],[1-w,1]])tt(t,ut(S,k,N),Math.max(y,p-.1),y,T,T);tt(t,S,p,Math.max(y,p-.1),T,T);return}if(h.kind==="portal"&&u.length===4){let S=Yt(u,y,p);if(!S)return;let{quad:I,side:w,face:T,openingTop:k}=S;for(let[N,B,E]of[[0,T,1],[T,1-T,.67],[1-T,1,1]]){let O=nn(I,N,B),L=K(d,E),C=K(g,E);for(let[F,v]of[[0,w],[1-w,1]])tt(t,ut(O,F,v),k,y,L,C);tt(t,O,p,k,L,C)}return}if(h.kind==="suite"&&u.length===4){let S=u.map((T,k)=>{let N=u[(k+1)%4],B=(T.x+N.x)/2,E=(T.y+N.y)/2;return Math.hypot(B-a.x,E-a.y)}),I=S.indexOf(Math.min(...S)),w=[0,1,2,3].map(T=>u[(I+T)%4]);tt(t,ut(w,0,.08),p,y,d,g),tt(t,ut(w,.92,1),p,y,d,g),tt(t,nn(w,.88,1),p,y,d,g),tt(t,w,p,Math.max(y,p-.18),d,g);return}if(f&&!n.stageKind?.startsWith("pitch-")&&p-y>.12){let S=p-Math.min(.06,(p-y)*.15);tt(t,u,S,y,d,g),tt(t,u,p,S,d,rt(d,g,.2))}else tt(t,u,p,y,d,g);if((n.stageKind==="pitch-football"||n.stageKind==="pitch-rugby")&&u.length===4){t.setMaterial(4);let S=yt(u);for(let I=0;I<12;I++){let w=ut(S,I/12,(I+1)/12),T=K(x??[.12,.38,.16],I%2?1.035:.965),k=w.map(N=>[N.x*P,p+.006,N.y*P]);t.tri(k[0],k[1],k[2],[0,1,0],T),t.tri(k[0],k[2],k[3],[0,1,0],T)}}n.stageKind&&n.stageKind!=="pitch-football"&&Ao(t,u,n.stageKind,p,x),f&&Ht(n.stageKind)&&Ro(t,n,p),t.setMaterial(m?1:0),on(t,n,p+.012)}function Tn(t){let{x:n,y:e,width:r,height:o}=t;if(!r||!o)return null;let a=n+r/2,i=e+o/2,s=(t.rotation??0)*Math.PI/180,c=Math.cos(s),u=Math.sin(s),l=r/2,f=o/2;return[[-l,-f],[l,-f],[l,f],[-l,f]].map(([m,h])=>({x:a+m*c-h*u,y:i+m*u+h*c}))}function _s(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let r=e[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ot(r);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let i=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let c=ot(s[1].trim());c&&i.push(c)}return i.length?i.reduce((s,c,u)=>rt(s,c,1/(u+1)),i[0]):null}function vo(t,n,e,r){if(n.layer==="foreground")return;let o=Tn(n);if(!o)return;let a=e+Ms,i=kt(_s(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=rt(r.ground,i,s)),V(t,o,void 0,()=>a,e,i,rt(i,r.decorWall,.5),z)}function Lo(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=kt(r,o.gaTop);V(t,n.points,n.holes,()=>e+Bo,e,a,o.gaWall,z),Bs(t,n.points,e+Bo)}var Bo=.15,wn=[.72,.74,.76],Qn=1.1,To=.12,Jn=.05,ws=.06,Es=2.4;function Bs(t,n,e){let r=wt([...n]),o=Dt(r,To/P),a=Dt(r,(To+Jn)/P);if(o.length<3||a.length<3)return;for(let s of[e+Qn,e+Qn*.5])V(t,o,[a.slice().reverse()],()=>s,s-Jn,wn,K(wn,.85),z);let i=ws/2/P;for(let s=0;s<o.length;s++){let c=o[s],u=o[(s+1)%o.length],l=Math.hypot(u.x-c.x,u.y-c.y)*P,f=Math.max(1,Math.round(l/Es));for(let m=0;m<f;m++){let h=m/f,y=c.x+(u.x-c.x)*h,p=c.y+(u.y-c.y)*h,x=[{x:y-i,y:p-i},{x:y+i,y:p-i},{x:y+i,y:p+i},{x:y-i,y:p+i}];V(t,x,void 0,()=>e+Qn-Jn,e,wn,K(wn,.8),z)}}}var Ts=6,Cs=2.2,Do=.1,Os=.3,ks=1.8,Fs=.9,vs=.55,Ls=6e3;function Go(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let c=new Map;for(let l of e)for(let f of l.objects)f.type==="section"&&f.zone&&c.set(f.id,f.zone);let u=new Map;for(let l=0;l<r.length;l++){let f=r[l],m=o.seatOwner[l],h=f.zoneId??(m?c.get(m):void 0);if(!h)continue;let y=u.get(h);y||(y={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(h,y)),y.n++,f.x<y.minX&&(y.minX=f.x),f.y<y.minY&&(y.minY=f.y),f.x>y.maxX&&(y.maxX=f.x),f.y>y.maxY&&(y.maxY=f.y),y.sumY+=o.seatDeckY(l)}for(let l of i){let f=u.get(l.id),m=[];for(let[h,y]of c)y===l.id&&m.push(h);if(!f||f.n===0){s.push({id:l.id,label:l.label,color:ot(l.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??a).x*P,1.5,(l.focalPoint??a).y*P]});continue}s.push({id:l.id,label:l.label,color:ot(l.color),sectionIds:m,seatCount:f.n,center:[(f.minX+f.maxX)/2*P,f.sumY/f.n,(f.minY+f.maxY)/2*P],radius:.5*Math.hypot((f.maxX-f.minX)*P,(f.maxY-f.minY)*P)||1,focalWorld:[(l.focalPoint??a).x*P,1.5,(l.focalPoint??a).y*P]})}}return s}function Xo(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,zones:s,focal:c}=t,u=[],l=[],f=[],m=new Map;for(let h of e)for(let y of h.objects){if(y.type!=="section"||!y.zone)continue;let p=(y.displayLabel||y.label||"").trim().toLocaleLowerCase();if(!p)continue;let x=n.floors?.[h.index]?.name?.trim().toLocaleLowerCase();if(e.length>1&&x===p)continue;let b=m.get(y.zone);b||m.set(y.zone,b=new Set),b.add(p)}for(let h of s)h.seatCount!==0&&(m.get(h.id)?.has(h.label.trim().toLocaleLowerCase())||u.push({id:`zone:${h.id}`,kind:"zone",text:h.label,anchor:[h.center[0],h.center[1]+Ts,h.center[2]],color:n.zones?.find(y=>y.id===h.id)?.color}));{let h=new Map,y=new Map;for(let p=0;p<r.length;p++){let x=o.seatOwner[p];if(!x)continue;let b=h.get(x);b||(b={n:0,x:0,y:0,deck:0},h.set(x,b)),b.n++,b.x+=r[p].x,b.y+=r[p].y,b.deck+=o.seatDeckY(p);let d=y.get(x);d||(d={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},y.set(x,d)),d.minDeck=Math.min(d.minDeck,o.seatDeckY(p)),d.maxDeck=Math.max(d.maxDeck,o.seatDeckY(p)),r[p].x<d.minX&&(d.minX=r[p].x),r[p].x>d.maxX&&(d.maxX=r[p].x),r[p].y<d.minY&&(d.minY=r[p].y),r[p].y>d.maxY&&(d.maxY=r[p].y)}for(let p of e)for(let x of p.objects){if(x.type!=="section"||ro(x))continue;let b=h.get(x.id);if(!b||b.n===0)continue;let d=y.get(x.id),M=[b.x/b.n*P,b.deck/b.n,b.y/b.n*P],g=x.displayLabel||x.label||x.id;l.push({id:x.id,floorIndex:p.index,label:g,seatCount:b.n,center:M,radius:Math.max(1,Math.hypot(d.maxX-d.minX,d.maxY-d.minY)*.5*P),box:{min:[d.minX*P-.4,d.minDeck,d.minY*P-.4],max:[d.maxX*P+.4,d.maxDeck+1,d.maxY*P+.4]},focalWorld:[p.focal.x*P,p.baseHeightM+1.5,p.focal.y*P]});let _=n.floors?.[p.index]?.name?.trim().toLocaleLowerCase();e.length>1&&_===g.trim().toLocaleLowerCase()||u.push({id:`section:${x.id}`,kind:"section",text:g,anchor:[M[0],M[1]+Cs,M[2]],floorIndex:p.index})}}{for(let b of e)for(let d of b.objects){if(d.type!=="gaArea")continue;let M=qt(d.points);if(!M)continue;let g=d.displayLabel||d.label||d.id;u.push({id:`ga:${d.id}`,kind:"ga",text:d.capacity>0?`${g} \xB7 ${d.capacity.toLocaleString()}`:g,anchor:[M.x*P,b.baseHeightM+ks,M.y*P],floorIndex:b.index})}let h=new Map,y=new Map;for(let b of e)for(let d of b.objects)if(d.type==="section"&&h.set(d.id,d.displayLabel||d.label||d.id),d.type==="row"){let M=d.displayLabel?.trim()||d.segmentedRow?.displayLabel?.trim();M&&y.set(d.id,M)}let p=new Map;for(let b=0;b<r.length;b++){let d=r[b],M=Math.hypot(d.x-c.x,d.y-c.y),g=p.get(d.rowId);(!g||M>g.far)&&p.set(d.rowId,{seat:d,index:b,far:M})}for(let[b,d]of p){let M=o.seatOwner[d.index]??d.seat.sectionId,g=No(d.seat.label,b,h.get(M??""),y.get(b));g&&u.push({id:`row:${b}`,kind:"row",text:g,anchor:[d.seat.x*P,o.seatDeckY(d.index)+Fs,d.seat.y*P],floorIndex:i[d.index]})}let x=new Map;for(let b=0;b<r.length;b++){let d=r[b],M=x.get(d.rowId);M||(M={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:No(d.label,d.rowId,h.get(o.seatOwner[b]??d.sectionId??""),y.get(d.rowId)),sectionId:o.seatOwner[b]??d.sectionId},x.set(d.rowId,M));let g=b*3,_=a.iPosition[g],R=a.iPosition[g+1],A=a.iPosition[g+2];M.n++,M.x+=_,M.y+=R,M.z+=A,M.minX=Math.min(M.minX,_),M.maxX=Math.max(M.maxX,_),M.minZ=Math.min(M.minZ,A),M.maxZ=Math.max(M.maxZ,A)}for(let[b,d]of x)f.push({id:b,label:d.label,sectionId:d.sectionId,seatCount:d.n,center:[d.x/d.n,d.y/d.n,d.z/d.n],radius:Math.max(.8,Math.hypot(d.maxX-d.minX,d.maxZ-d.minZ)*.5)});if(r.length<=Ls)for(let b=0;b<r.length;b++){let d=r[b],M=Ds(d.displayLabel||d.label);M&&u.push({id:`seat:${d.id}`,kind:"seat",seatWidthM:a.iChairWidth[b]*2,text:M,anchor:[d.x*P,o.seatDeckY(b)+vs,d.y*P],floorIndex:i[b],rowId:d.rowId})}}for(let h of e)for(let y of h.objects)if(y.type==="shape"&&y.role&&["entrance","exit","screen","suite","obstruction"].includes(y.role)){let p=st(y),x=p?qt(p):null;if(!x||!y.label)continue;u.push({id:`architecture:${y.id}`,kind:"annotation",text:y.label,anchor:[x.x*P,h.baseHeightM+Pt(y).heightM+Do,x.y*P],color:y.fill,floorIndex:h.index})}else if(y.type==="text"){if(!y.text)continue;u.push({id:`text:${y.id}`,kind:"annotation",text:y.text,anchor:[y.position.x*P,h.baseHeightM+Do,y.position.y*P],color:y.color,rotation:y.rotation,floorIndex:h.index})}else if(y.type==="booth"){let p=Et(y);if(!p)continue;let x=qt(p);if(!x)continue;u.push({id:`booth:${y.id}`,kind:"booth",text:y.displayLabel||y.label||y.id,anchor:[x.x*P,h.baseHeightM+En+Os,x.y*P],floorIndex:h.index})}return{labels:u,sections:l,rows:f}}function Ho(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function Ds(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function No(t,n,e,r){if(r?.trim())return r.trim();let o=t?t.lastIndexOf("-"):-1,a=o>0?t.slice(0,o):n;return a&&be(a,e)}var rn=3,Nt=.38,sn=.24;function Ns(t){if(t.length<3)return null;let n=t[0],e=t[Math.floor(t.length/2)],r=t[t.length-1],o=(e.x-n.x)*P,a=(e.y-n.y)*P,i=(r.x-n.x)*P,s=(r.y-n.y)*P,c=2*(o*s-a*i);if(Math.abs(c)<1e-7)return null;let u=o*o+a*a,l=i*i+s*s,f=(u*s-l*a)/c+n.x*P,m=(o*l-i*u)/c+n.y*P,h=Math.hypot(n.x*P-f,n.y*P-m);return h<1||h>200||!Number.isFinite(h)||t.some(y=>Math.abs(Math.hypot(y.x*P-f,y.y*P-m)-h)>.03)?null:{x:f,z:m,radius:h}}function jo(t){let n=[],e=new Map,r=(c,u)=>`${Math.floor(c/rn)},${Math.floor(u/rn)}`;for(let c of t)for(let u of c.rows){for(let f of u.pts){let m=f.x*P,h=f.y*P,y=r(m,h),p=e.get(y)??[];p.push({x:m,z:h,y:u.y,floor:c.floorIndex}),e.set(y,p)}if(u.patch||u.pts.length<2)continue;let l=Ns(u.pts);for(let f of[0,u.pts.length-1]){let m=u.pts[f],h=u.pts[f===0?1:f-1],y=m.x-h.x,p=m.y-h.y,x=Math.hypot(y,p);x<1e-6||n.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:l,row:u,point:m,x:m.x*P,z:m.y*P,dx:y/x,dz:p/x})}}let o=new Map;n.forEach((c,u)=>{let l=r(c.x,c.z),f=o.get(l)??[];f.push(u),o.set(l,f)});let a=(c,u)=>{let l=Math.floor(c/rn),f=Math.floor(u/rn);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${l+m},${f+h}`))},i=new Map;n.forEach((c,u)=>{let l=-1,f=1/0,m=!1;for(let h of a(c.x,c.z))for(let y of o.get(h)??[]){let p=n[y];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let x=p.x-c.x,b=p.z-c.z,d=Math.hypot(x,b);if(d<Nt*2+.45||d>rn)continue;let M=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,g=Math.min((x*c.dx+b*c.dz)/d,(-x*p.dx-b*p.dz)/d);(M?g<.8:g<.98)||!M&&(Math.abs(x*c.dz-b*c.dx)>.15||Math.abs(x*p.dz-b*p.dx)>.15)||(d<f-.02?(l=y,f=d,m=!1):Math.abs(d-f)<=.02&&(m=!0))}l>=0&&!m&&i.set(u,l)});let s=[];for(let[c,u]of i){if(c>=u||i.get(u)!==c)continue;let l=n[c],f=n[u],m=Math.hypot(f.x-l.x,f.z-l.z),h=(f.x-l.x)/m,y=(f.z-l.z)/m,p=!1;for(let b of a((l.x+f.x)/2,(l.z+f.z)/2))for(let d of e.get(b)??[]){if(d.floor!==l.floorIndex||Math.abs(d.y-l.row.y)>.75)continue;let M=(d.x-l.x)*h+(d.z-l.z)*y,g=Math.abs((d.x-l.x)*y-(d.z-l.z)*h);M>.01&&M<m-.01&&g<sn+Nt&&(p=!0)}if(p)continue;let x=(b,d)=>({x:(l.x+h*b-y*d)/P,y:(l.z+y*b+h*d)/P});s.push({sections:[l.sectionId,f.sectionId],blocks:[l.row.blockId,f.row.blockId],floorIndex:l.floorIndex,ends:[l.point,f.point],clearWidthM:m-2*Nt,heightM:(l.row.y+f.row.y)/2,outline:[x(Nt,-sn),x(m-Nt,-sn),x(m-Nt,sn),x(Nt,sn)]})}return s}var Gs=.15,Xs=.9,Hs=1.76;function js(){return{background:{top:[...Dn.top],bottom:[...Dn.bottom]},structure:Ln,seatStates:{...Ee},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Us(t){return!!t&&t[0]*.2126+t[1]*.7152+t[2]*.0722>.55?{deck:"#a8ada9",fascia:"#69777c",shell:"#8d9ca0",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Uo(t){let n=js();t??={};let e=ot(t.background);if(e){n.background={top:K(e,Xs),bottom:K(e,Hs)};let s={};for(let[u,l]of Object.entries(Ln))s[u]=rt(l,e,Gs);e[0]*.2126+e[1]*.7152+e[2]*.0722>.55&&(s.ground=K(e,.86)),n.structure=s}let r=ot(t.selectionColor)??ot(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Me(o));let a=Object.fromEntries(Object.entries(t.venue3d??{}).filter(([,s])=>s!=null)),i={...Us(e),...a};if(i){let s=ot(i.deck),c=ot(i.fascia);s&&(n.structure={...n.structure,tierTop:s,gaTop:s}),c&&(n.structure={...n.structure,tierWall:c,gaWall:c}),n.materials.seat=ot(i.seat),n.materials.shell=ot(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return n}function Yo(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var te=.6,Wo=3,Ys=.25;function Ws(t,n){if(ht(n,t.x,t.y))return 0;let e=1/0;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[o],i=n[r],s=i.x-a.x,c=i.y-a.y,u=s*s+c*c||1,l=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/u));e=Math.min(e,Math.hypot(t.x-(a.x+l*s),t.y-(a.y+l*c)))}return e}function zo(t,n){let e=t.map(i=>({booth:i,ring:Et(i)})).filter(i=>!!i.ring&&i.ring.length===4&&!i.booth.points),r=e.map(({ring:i})=>({minX:Math.min(...i.map(s=>s.x)),maxX:Math.max(...i.map(s=>s.x)),minY:Math.min(...i.map(s=>s.y)),maxY:Math.max(...i.map(s=>s.y))})),o=(Wo+te)/P,a=new Map;return e.forEach(({booth:i,ring:s},c)=>{let u={x:s.reduce((h,y)=>h+y.x,0)/4,y:s.reduce((h,y)=>h+y.y,0)/4},l=[0,1,2,3].map(h=>{let y=s[h],p=s[(h+1)%4],x={x:(y.x+p.x)/2,y:(y.y+p.y)/2},b=x.x-u.x,d=x.y-u.y,M=Math.hypot(b,d)||1,g={x:x.x+b/M*te/P,y:x.y+d/M*te/P},_=Wo/P;return r.forEach((R,A)=>{A===c||g.x<R.minX-o||g.x>R.maxX+o||g.y<R.minY-o||g.y>R.maxY+o||(_=Math.min(_,Ws(g,e[A].ring)))}),{open:_*P,toward:{x:x.x+b/M*10/P,y:x.y+d/M*10/P},focal:Math.hypot(x.x-n.x,x.y-n.y)}}),f=Math.max(...l.map(h=>h.open)),m=l.filter(h=>h.open>=f-Ys).sort((h,y)=>h.focal-y.focal)[0];a.set(i.id,m.toward)}),a}import zs from"polygon-clipping";var Vs=.45,Ks=1500,Zs=200;function Vo(t,n){if(t.role!=="stage"||Ht(t.stageKind))return t;let e=st(t);if(!e||e.length<3||Math.abs(mt(e))*P*P>Ks)return t;let r=n.filter(i=>ht(e,i.x,i.y));if(!r.length||r.length>Zs)return t;let o=Vs/P,a=r.map(i=>[[[i.x-o,i.y-o],[i.x+o,i.y-o],[i.x+o,i.y+o],[i.x-o,i.y+o],[i.x-o,i.y-o]]]);try{let i=zs.difference([[...e.map(u=>[u.x,u.y]),[e[0].x,e[0].y]]],...a),s=null,c=0;for(let u of i){let l=u[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(mt(l));f>c&&(c=f,s=l)}return!s||s.length<3?t:{...t,kind:"polygon",points:s,rotation:0}}catch{return t}}function ne(t,n,e,r,o,a,i,s,c,u=[],l=o){if(n.length!==e.length||n.length<2||a-o<1.5)return;let f=(p,x,b)=>{Ct(t,p,x,b,u,i,s,{portalBase:l,ao:c})||V(t,p,void 0,()=>b,x,i,s,c)},m=(p,x,b)=>({x:p.x+(x.x-p.x)*b,y:p.y+(x.y-p.y)*b}),h=r?n.length:n.length-1,y=0;for(let p=0;p<h;p++){let x=(p+1)%n.length,b=Math.hypot(e[x].x-e[p].x,e[x].y-e[p].y)*et;if(b<1e-5)continue;let d=(R,A)=>[m(n[p],n[x],R),m(n[p],n[x],A),m(e[p],e[x],A),m(e[p],e[x],R)];f(d(0,1),o,o+.95),f(d(0,1),a-.22,a);let M=Math.ceil((y-.32)/6)*6,g=!1,_=!1;for(let R=M;R<y+b;R+=6){let A=Math.max(0,(R-y)/b),S=Math.min(1,(R+.32-y)/b);S<=A||(f(d(A,S),o+.95,a-.22),g||=A<1e-6,_||=S>1-1e-6)}if(!r&&(p===0&&!g||p===h-1&&!_)){let R=Math.min(1,.32/b);f(d(p===0?0:1-R,p===0?R:1),o+.95,a-.22)}y+=b}}var an=.65;function Ko(t,n){let e=1/0;for(let r of n)for(let o=0;o<r.length;o++){let a=r[o],i=r[(o+1)%r.length],s=i.x-a.x,c=i.y-a.y,u=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/(s*s+c*c||1)));e=Math.min(e,Math.hypot(t.x-a.x-u*s,t.y-a.y-u*c))}return e}var Zo=.01;function qo(t,n,e,r,o,a,i,s=[],c=!0){if(r-o<=1e-5)return;let u=r-o>=3,l=u?r-an:o;t.setMaterial(5);let f=u?[]:s.filter(g=>{if(g.role!=="entrance"&&g.role!=="exit")return!1;let _=st(g);if(!_)return!1;let R=Yt(_,o,o+Pt(g).heightM);return R!==null&&R.openingTop<=r-.12});if((!f.length||!Ct(t,n,l,r,f,a,i,{holes:e,portalBase:o}))&&V(t,n,e,()=>r,l,a,i,z,void 0,()=>[0,1,0]),!u){t.setMaterial(0);return}let m=6/P,h=.22/P,y=s.flatMap(g=>{if(g.role!=="entrance"&&g.role!=="exit")return[];let _=st(g);return _?.length?[{minX:Math.min(..._.map(R=>R.x)),maxX:Math.max(..._.map(R=>R.x)),minY:Math.min(..._.map(R=>R.y)),maxY:Math.max(..._.map(R=>R.y))}]:[]}),p=Math.min(...n.map(g=>g.x)),x=Math.max(...n.map(g=>g.x)),b=Math.min(...n.map(g=>g.y)),d=Math.max(...n.map(g=>g.y));for(let g=p+m/2;g<x;g+=m)for(let _=b+m/2;_<d;_+=m){if(y.some(A=>g+h>=A.minX&&g-h<=A.maxX&&_+h>=A.minY&&_-h<=A.maxY))continue;let R=[{x:g-h,y:_-h},{x:g+h,y:_-h},{x:g+h,y:_+h},{x:g-h,y:_+h}];!At({x:g,y:_},n,e)||Ko({x:g,y:_},[n,...e??[]])<h*Math.SQRT2+(c?ee/P:0)||V(t,R,void 0,()=>l,o,a,i,z)}let M=Dt(n,ee/P);if(c&&M.length>=3){let g=s.filter(A=>{if(A.role!=="entrance"&&A.role!=="exit")return!1;let S=st(A);return!!S&&S.some(I=>!At(I,n,void 0)||Ko(I,[n])<=ee/P)}),_=[M.slice().reverse()],R=o-Zo;(!g.length||!Ct(t,n,R,l,g,a,i,{holes:_,portalBase:o+Zo}))&&V(t,n,_,()=>l,R,a,i,z)}t.setMaterial(0)}var ee=.25;var qs=.02,$s=.25,Qs=1.2,Js=.6,ta=.45,na=2.3,ea=Math.PI/180,$o=.005;function Bt(t,n,e){let r=e*ea;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function oa(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let r=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=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(a.length<2)continue;let i=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=r&&i++;if(i>=a.length/2)return!0}return!1}var ra=24,ia=.01;function sa(t,n,e,r,o,a,i,s,c){let u=e.binCount,l=ra,f=et,m=a+.02,h=a-ia,y=[];for(let B=0;B<u;B++){let E=(e.startBin+B+.5)*n.binStepDeg,O=new Float64Array(l+1);for(let L=0;L<=l;L++){let C=r[B]+(o[B]-r[B])*L/l;O[L]=Math.max(m,Ie(n,e,E,C)-$s)}y.push(O)}if(c){let B=0;for(let E=0;E+1<u;E++)for(let O=0;O<l;O++){let L=Bt(n.centre,r[E]+(o[E]-r[E])*O/l,(e.startBin+E+.5)*n.binStepDeg),C=Bt(n.centre,r[E+1]+(o[E+1]-r[E+1])*(O+1)/l,(e.startBin+E+1.5)*n.binStepDeg);B=Math.max(B,Math.hypot(C.x-L.x,C.y-L.y))}for(let E=0;E<u;E++){let O=(e.startBin+E+.5)*n.binStepDeg;for(let L=0;L<=l;L++){let C=Bt(n.centre,r[E]+(o[E]-r[E])*L/l,O),F=c(C.x,C.y,B*1.01);F!==null&&(y[E][L]=Math.min(y[E][L],Math.max(h+$o,F-$o)))}}}let p=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],x=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],b=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],d=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],M=(B,E)=>{let O=(e.startBin+B+.5)*n.binStepDeg,L=r[B]+(o[B]-r[B])*E/l,C=Bt(n.centre,L,O);return[C.x*f,y[B][E],C.y*f]};{let B=Math.tan(12*Math.PI/180);for(let E=0;E<6;E++){let O=!1;for(let C=0;C<u;C++)for(let F=l-1;F>=0;F--)y[C][F]>y[C][F+1]&&(y[C][F]=y[C][F+1],O=!0);let L=e.closed?u:u-1;for(let C=0;C<L;C++){let F=(C+1)%u;for(let v=0;v<=l;v++){let G=y[F][v]-y[C][v];if(Math.abs(G)>1)continue;let j=r[C]+(o[C]-r[C])*v/l,U=r[F]+(o[F]-r[F])*v/l,H=Bt(n.centre,j,(e.startBin+C+.5)*n.binStepDeg),W=Bt(n.centre,U,(e.startBin+F+.5)*n.binStepDeg),nt=B*Math.hypot(W.x-H.x,W.y-H.y)*f;G>nt?(y[F][v]=y[C][v]+nt,O=!0):-G>nt&&(y[C][v]=y[F][v]+nt,O=!0)}}if(!O)break}}let g=1,_=(B,E)=>{for(let O=0;O<=l;O+=4)if(Math.abs(y[B][O]-y[E][O])>g)return!0;return Math.abs(y[B][l]-y[E][l])>g},R=Math.tan(38*Math.PI/180),A=B=>(o[B]-r[B])/l*f,S=(B,E)=>y[B][E+1]-y[B][E]>R*Math.max(1e-6,A(B)),I=(B,E)=>{let O=e.closed?(B-1+u)%u:Math.max(0,B-1),L=e.closed?(B+1)%u:Math.min(u-1,B+1);Math.abs(y[O][E]-y[B][E])>g&&(O=B),Math.abs(y[L][E]-y[B][E])>g&&(L=B);let C=Math.max(0,E-1),F=Math.min(l,E+1);C<E&&S(B,C)&&(C=E),F>E&&S(B,E)&&(F=E);let v=M(O,E),G=M(L,E),j=M(B,C),U=M(B,F),H=G[0]-v[0],W=G[1]-v[1],nt=G[2]-v[2],$=U[0]-j[0],Q=U[1]-j[1],X=U[2]-j[2],D=W*X-nt*Q,Z=nt*$-H*X,J=H*Q-W*$,q=Math.hypot(D,Z,J);return q>1e-12?(D/=q,Z/=q,J/=q,Z<0&&(D=-D,Z=-Z,J=-J),[D,Z,J]):[0,1,0]},w=(B,E,O=!1)=>{let L=O&&Math.min(B[1],E[1])-a>=3,C=[B[0],L?B[1]-an:h,B[2]],F=[E[0],L?E[1]-an:h,E[2]],v=E[0]-B[0],G=E[2]-B[2],j=Math.hypot(v,G);if(!(j>1e-12))return;let U=[G/j,0,-v/j];t.tri(B,E,F,U,b,b,d),t.tri(B,F,C,U,b,d,d)},T=.05*xt,k=B=>o[B]-r[B]<T,N=e.closed?u:u-1;for(let B=0;B<N;B++){let E=(B+1)%u;if(k(B)||k(E))continue;if(_(B,E)){let G=(e.startBin+B+1)*n.binStepDeg,j=(Q,X)=>{let D=(r[B]+r[E])/2,Z=(o[B]+o[E])/2,J=D+(Z-D)*X/l,q=Bt(n.centre,J,G);return[q.x*f,y[Q][X],q.y*f]};for(let Q=0;Q<l;Q++){let X=M(B,Q),D=M(B,Q+1),Z=j(B,Q),J=j(B,Q+1),q=I(B,Q),ct=I(B,Q+1);t.triN(X,Z,J,q,q,ct,p),t.triN(X,J,D,q,ct,ct,p);let it=M(E,Q),Y=M(E,Q+1),lt=j(E,Q),St=j(E,Q+1),It=I(E,Q),Rt=I(E,Q+1);t.triN(lt,it,Y,It,It,Rt,p),t.triN(lt,Y,St,It,Rt,Rt,p);let gt=j(B,Q),ft=j(B,Q+1),Gt=j(E,Q+1),On=j(E,Q),cn=ft[0]-gt[0],Zt=ft[2]-gt[2],kn=Math.hypot(cn,Zt);if(kn>1e-12){let ie=[Zt/kn,0,-cn/kn];t.tri(gt,ft,Gt,ie,b),t.tri(gt,Gt,On,ie,b)}}let U=M(B,0),H=M(E,0),W=M(E,l),nt=M(B,l),$=Q=>[Q[0],h,Q[2]];Math.min(U[1],H[1])-a<3&&(t.tri($(U),$(W),$(H),[0,-1,0],x),t.tri($(U),$(nt),$(W),[0,-1,0],x)),w(U,H,!0),w(nt,W,!0);continue}for(let G=0;G<l;G++){let j=I(B,G),U=I(E,G),H=I(E,G+1),W=I(B,G+1);if(S(B,G)||S(E,G)){let D=(ft,Gt)=>{let On=(e.startBin+ft+.5)*n.binStepDeg,cn=r[ft]+(o[ft]-r[ft])*(G+.5)/l,Zt=Bt(n.centre,cn,On);return[Zt.x*f,Gt,Zt.y*f]},Z=M(B,G),J=M(E,G),q=D(B,y[B][G]),ct=D(E,y[E][G]);t.triN(Z,J,ct,j,U,U,p),t.triN(Z,ct,q,j,U,j,p);let it=M(E,G+1),Y=M(B,G+1),lt=D(B,y[B][G+1]),St=D(E,y[E][G+1]);t.triN(lt,St,it,W,H,H,p),t.triN(lt,it,Y,W,H,W,p);let It=ct[0]-q[0],Rt=ct[2]-q[2],gt=Math.hypot(It,Rt);if(gt>1e-12){let ft=[-Rt/gt,0,It/gt];t.tri(q,ct,St,ft,b),t.tri(q,St,lt,ft,b)}continue}let nt=M(B,G),$=M(E,G),Q=M(E,G+1),X=M(B,G+1);t.triN(nt,$,Q,j,U,H,p),t.triN(nt,Q,X,j,H,W,p)}let O=M(B,0),L=M(E,0),C=M(E,l),F=M(B,l),v=G=>[G[0],h,G[2]];Math.min(O[1],L[1])-a<3&&(t.tri(v(O),v(C),v(L),[0,-1,0],x),t.tri(v(O),v(F),v(C),[0,-1,0],x)),w(O,L,!0),w(F,C,!0)}if(!e.closed)for(let B of[0,u-1])for(let E=0;E<l;E++)w(M(B,E),M(B,E+1))}function Qo(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=new Float64Array(n.binCount).fill(-1/0);for(let l of n.rings)for(let f of l.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let p=0;p<f.binCount;p++){let x=(f.startBin+p)%n.binCount,b=Math.max(0,f.innerR[p]-bt);m[p]=Math.max(b,i[x]+.001),h[p]=Math.max(m[p]+.001,f.outerR[p]+bt)}let y=0;for(let p=0;p<f.binCount;p++){let x=f.topLevelM[p]-r;x>y&&(y=x)}y>=Qs&&sa(t,n,f,m,h,r,o,a,e.standTopNear);for(let p=0;p<f.binCount;p++){let x=(f.startBin+p)%n.binCount;h[p]>i[x]&&(i[x]=h[p])}}if(e.deriveShell===!1||oa(e.shapes,n))return;let s=n.rings[n.rings.length-1],c=Js*xt,u=ta*xt;for(let l of s.arcs){let f=[],m=[];for(let I=0;I<l.binCount;I++){let w=(l.startBin+I+.5)*n.binStepDeg,T=l.outerR[I]+bt+c;f.push(Bt(n.centre,T,w)),m.push(Bt(n.centre,T+u,w))}let h=-1/0;for(let I=0;I<l.binCount;I++)l.topLevelM[I]>h&&(h=l.topLevelM[I]);let y=h+na,p=l.closed?m:[...m,...f.slice().reverse()],x=l.closed?[f.slice().reverse()]:void 0,b=rt(o.shellWall,[.66,.71,.72],.62),d=(I,w,T,k,N)=>{let B=Math.abs(k-h)<1e-6?k-qs:k;Ct(t,I,T,B,e.shapes,o.shellTop,N,{holes:w,portalBase:r,ao:a})||V(t,I,w,()=>B,T,o.shellTop,N,a)},M=Math.max(1,Math.ceil((h-r)/4.5)),g=(h-r)/M,_=new Set,R=e.tierFrontLevels??n.rings.map(I=>{let w=I.arcs.flatMap(T=>Array.from(T.frontLevelM)).filter(Number.isFinite).sort((T,k)=>T-k);return w[Math.floor(w.length/2)]});for(let I of R)Number.isFinite(I)&&I-r>=3&&I<h&&_.add(Math.max(0,Math.min(M-1,Math.floor((I-r)/g))));let A=Math.min(...R.filter(I=>Number.isFinite(I)&&I-r>=3&&I<h));for(let I=0;I<M;I++)r+(I+1)*g<=A-an&&Number.isFinite(A)&&_.add(I);for(let I=0;I<M;I++){let w=r+(h-r)*I/M,T=r+(h-r)*(I+1)/M;_.has(I)&&T-w>=3.2?(d(p,x,w,w+.45,b),ne(t,f,m,l.closed,w+.45,T-.16,o.shellTop,b,a,e.shapes,r)):d(p,x,w,T-.16,b),d(p,x,T-.16,T,K(b,.62))}ne(t,f,m,l.closed,h,y,o.shellTop,b,a,e.shapes,r);let S=8;for(let I=1;I<m.length;I++){if(S+=Math.hypot(m[I].x-m[I-1].x,m[I].y-m[I-1].y)*et,S<8)continue;S=0;let w=m[I],T=m[I-1],k=w.x-T.x,N=w.y-T.y,B=Math.max(1,Math.hypot(k,N)),E=k/B*.16*xt,O=N/B*.16*xt,L=Math.max(1,Math.hypot(w.x-n.centre.x,w.y-n.centre.y)),C=(w.x-n.centre.x)/L*.24*xt,F=(w.y-n.centre.y)/L*.24*xt,v=[{x:w.x-E,y:w.y-O},{x:w.x+E,y:w.y+O},{x:w.x+E+C,y:w.y+O+F},{x:w.x-E+C,y:w.y-O+F}];d(v,void 0,r,h,K(b,1.12))}}}function Jo(t,n,e,r){let o=new Map;for(let s of n){let c=o.get(s.blockId);(!c||s.depth<c.depth)&&o.set(s.blockId,s)}let a=[.68,.72,.72],i=[.48,.55,.57];for(let s of o.values()){if(s.y-r<2.5||s.pts.length<2)continue;let c=s.pts.map(l=>{let f=l.x-e.x,m=l.y-e.y,h=Math.max(1,Math.hypot(f,m));return{x:l.x-f/h*.65/P,y:l.y-m/h*.65/P}}),u=2;for(let l=1;l<c.length;l++){let f=c[l-1],m=c[l],h=m.x-f.x,y=m.y-f.y,p=Math.hypot(h,y);if(p<1e-5||p*P>2)continue;let x=b=>{let d=-y/p*b/P/2,M=h/p*b/P/2;return[{x:f.x+d,y:f.y+M},{x:m.x+d,y:m.y+M},{x:m.x-d,y:m.y-M},{x:f.x-d,y:f.y-M}]};V(t,x(.22),void 0,()=>s.y-.06,s.y-.56,a,a,z);for(let b of[.5,.95])V(t,x(.045),void 0,()=>s.y+b,s.y+b-.045,i,i,z);if(u+=p*P,u>=1.8||l===c.length-1){u=0;let b=.028/P,d=[{x:f.x-b,y:f.y-b},{x:f.x+b,y:f.y-b},{x:f.x+b,y:f.y+b},{x:f.x-b,y:f.y+b}];V(t,d,void 0,()=>s.y+.95-.045,s.y-.06,i,i,z)}}}}function tr(t,n,e,r,o){let a=[.67,.71,.68];for(let i=0;i<n.length;i++){let s=n[i];if(!(s.pts.length<2))for(let c of[0,s.pts.length-1]){let u=s.pts[c],l=s.pts[c===0?1:c-1],f=u.x-l.x,m=u.y-l.y,h=Math.hypot(f,m);if(h<1e-5)continue;f/=h,m/=h;let y=1/0;for(let S=0;S<e.length;S++){let I=e[S],w=e[(S+1)%e.length],T=w.x-I.x,k=w.y-I.y,N=f*k-m*T;if(Math.abs(N)<1e-8)continue;let B=I.x-u.x,E=I.y-u.y,O=(B*k-E*T)/N,L=(B*m-E*f)/N;O>0&&L>=0&&L<=1&&(y=Math.min(y,O))}let p=.3/P,x=y-.04/P;if(!Number.isFinite(y)||y*P>2||x-p<.12/P)continue;let b=.27/P,d=[{x:u.x+f*p-m*b,y:u.y+m*p+f*b},{x:u.x+f*x-m*b,y:u.y+m*x+f*b},{x:u.x+f*x+m*b,y:u.y+m*x-f*b},{x:u.x+f*p+m*b,y:u.y+m*p-f*b}];if(!d.every(S=>ht(e,S.x,S.y)))continue;let M=o?.[i]?.belowY,g=M==null?0:s.y-M,_=!!r&&g>.03&&g<=.65;if(_&&r){let S=(I,w)=>Math.hypot((I.x+w.x)/2-r.x,(I.y+w.y)/2-r.y);S(d[0],d[1])>S(d[3],d[2])&&(d=[d[3],d[2],d[1],d[0]])}let R=_?Math.ceil((g-1e-8)/.2):1,A=(S,I,w)=>({x:S.x+(I.x-S.x)*w,y:S.y+(I.y-S.y)*w});for(let S=0;S<R;S++){let I=S/R,w=(S+1)/R,T=[A(d[0],d[3],I),A(d[1],d[2],I),A(d[1],d[2],w),A(d[0],d[3],w)],k=s.y+.008-(_?g*(1-w):0);if(V(t,T,void 0,()=>k,k-(_?g/R+.1:.16),a,[.43,.47,.46],z),!_)continue;let N=Math.hypot(T[3].x-T[0].x,T[3].y-T[0].y)*P,B=Math.min(.04/N,.25),E=A(T[0],T[3],B),O=A(T[1],T[2],B),L=F=>[F.x*P,k+.004,F.y*P],C=[.66,.59,.39];t.tri(L(T[0]),L(T[1]),L(O),[0,1,0],C),t.tri(L(T[0]),L(O),L(E),[0,1,0],C)}}}}function nr(t,n,e,r,o,a,i,s,c=!1){if(!n.outline||n.outline.length<3)return;let u=e.baseHeightM,l=e.objects.filter(d=>d.type==="shape"&&(d.role==="entrance"||d.role==="exit")),f=ke(r,s.tierTop);if(!o)return;let m=d=>o.deckAt(d.x,d.y),h=qe(n,i),y=h[0]??n.outline;if(o.rowLevels.length>=2){let d=xn(o.rowLevels),M=$e(Ye(o.rowLevels,e.focal,d),h);for(let _ of M){let R=Math.max(u,_.topY-er);for(let A of a.subtract(_.outline,R))qo(t,A,_.holes,R,u,s.tierTop,s.tierWall,l,!c)}M.length||V(t,y,n.holes,()=>o.landingY,u,f,s.tierWall,z);let g={tread:[f[0]*z.top,f[1]*z.top,f[2]*z.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let _ of h.length?h:[y])ze(t,o.rowLevels,e.focal,o.landingY,g,_,d);Jo(t,o.rowLevels,e.focal,u),tr(t,o.rowLevels,n.outline,e.focal,d);return}let p=o.flat?1/0:xo,x=d=>o.normalAt(d.x,d.y),b=o.flat?o.landingY:void 0;for(let d of a.subtract(y,b))V(t,d,n.holes,m,u,f,s.tierWall,z,p,x)}function aa(t,n,e){let r=new Set;for(let i of t.objects)i.type==="section"&&r.add(i.id);let o=new Map;for(let i=0;i<n.length;i++){let s=e.seatOwner[i];if(!s||!r.has(s))continue;let c=e.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let u=n[i];if(u.kind==="booth")continue;let l=o.get(s);l||(l=new Map,o.set(s,l));let f=u.rowId||`__seat-${i}`,m=l.get(f);m||(m={pts:[],levelM:0,n:0},l.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=e.seatDeckY(i),m.n++}let a=[];for(let i of t.objects){if(i.type!=="section")continue;let s=e.bySection.get(i.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&a.push({sectionId:i.id,rows:u});continue}let c=o.get(i.id);c&&a.push({sectionId:i.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return a}function ca(t,n){let e=1/0;for(let r=0;r<n.length;r++){let o=n[r],a=n[(r+1)%n.length],i=a.x-o.x,s=a.y-o.y,c=Math.max(0,Math.min(1,((t.x-o.x)*i+(t.y-o.y)*s)/(i*i+s*s||1)));e=Math.min(e,Math.hypot(t.x-o.x-c*i,t.y-o.y-c*s))}return e}var er=.02;function la(t,n){let e=t.objects.filter(r=>r.type==="section"&&!!r.outline&&r.outline.length>=3).flatMap(r=>{let o=n.bySection.get(r.id);if(!o)return[];let a=1/0,i=-1/0,s=1/0,c=-1/0;for(let l of r.outline)l.x<a&&(a=l.x),l.x>i&&(i=l.x),l.y<s&&(s=l.y),l.y>c&&(c=l.y);let u=o.landingY;for(let l of o.rowLevels)u=Math.min(u,l.y-er);return[{outline:r.outline,holes:r.holes,surface:o,floorTop:u,minX:a,maxX:i,minY:s,maxY:c}]});return(r,o,a)=>{let i=null;for(let s of e){if(r<s.minX-a||r>s.maxX+a||o<s.minY-a||o>s.maxY+a)continue;let c={x:r,y:o};if(!At(c,s.outline,s.holes)&&ca(c,s.outline)>a)continue;let u=Math.min(s.surface.deckAt(r,o),s.floorTop);(i===null||u<i)&&(i=u)}return i}}var ua=3,fa=.4;function or(t,n,e,r,o,a,i=!0){let s=aa(n,e,r);if(s.length<ua)return;let c=Se(s,n.focal);if(!c)return;let u=Math.max(0,...c.rings.map(l=>l.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;t.setMaterial(5),Qo(t,c,{bottomY:n.baseHeightM,tierFrontLevels:s.map(l=>Math.min(...l.rows.map(f=>f.levelM))),colors:{bandTop:K(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??K(o.tierWall,1.15),shellWall:a??o.tierWall},ao:z,shapes:n.objects.filter(l=>l.type==="shape"),deriveShell:i&&u>=fa,standTopNear:la(n,r)}),t.setMaterial(0)}function rr(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,seatFloor:s}=t,c=[];{let u=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<a.floor.length;m+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[m]))),y=m*3,p=u[h];p.minX=Math.min(p.minX,a.position[y]),p.minY=Math.min(p.minY,a.position[y+1]),p.minZ=Math.min(p.minZ,a.position[y+2]),p.maxX=Math.max(p.maxX,a.position[y]),p.maxY=Math.max(p.maxY,a.position[y+1]),p.maxZ=Math.max(p.maxZ,a.position[y+2])}let l=new Map;for(let m=0;m<e.length;m++)for(let h of e[m].objects)h.type==="section"&&l.set(h.id,m);let f=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let h=o.seatOwner[m],y=(h!==null?l.get(h):void 0)??i[m];if(y===void 0)continue;let p=f[y],x=r[m];p.n++,x.x<p.minX&&(p.minX=x.x),x.y<p.minY&&(p.minY=x.y),x.x>p.maxX&&(p.maxX=x.x),x.y>p.maxY&&(p.maxY=x.y);let b=o.seatDeckY(m);p.sumX+=x.x*P,p.sumDeck+=b,p.sumZ+=x.y*P,p.minDeck=Math.min(p.minDeck,b),p.maxDeck=Math.max(p.maxDeck,b+1.6),s[m]=y}for(let m=0;m<e.length;m++){let h=f[m],y=n.floors?.[m],p=u[m],x=Math.min(h.n?h.minX*P:e[m].focal.x*P-1,Number.isFinite(p.minX)?p.minX:1/0),b=Math.max(h.n?h.maxX*P:e[m].focal.x*P+1,Number.isFinite(p.maxX)?p.maxX:-1/0),d=Math.min(h.n?h.minY*P:e[m].focal.y*P-1,Number.isFinite(p.minZ)?p.minZ:1/0),M=Math.max(h.n?h.maxY*P:e[m].focal.y*P+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),g=Math.min(h.n?Math.min(e[m].baseHeightM,h.minDeck):e[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),_=Math.max(h.n?Math.max(h.maxDeck,g+.5):g+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),R=[h.n?h.sumX/h.n:(x+b)/2,h.n?h.sumDeck/h.n:(g+_)/2,h.n?h.sumZ/h.n:(d+M)/2],A=Math.max(1,.5*Math.hypot(b-x,_-g,M-d));c.push({index:m,id:y?.id??`floor-${m}`,label:y?.name??(e.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:R,radius:A,box:{min:[x,g,d],max:[b,_,M]},focalWorld:[e[m].focal.x*P,e[m].baseHeightM+1.5,e[m].focal.y*P]})}}return c}function oe(t,n){let e=1/0,r=1/0,o=-1/0,a=-1/0,i=(s,c)=>{s<e&&(e=s),c<r&&(r=c),s>o&&(o=s),c>a&&(a=c)};for(let s of n)i(s.x,s.y);for(let s of t)for(let c of s.objects)if(c.type==="section")for(let u of c.outline)i(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)i(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)i(u.x,u.y);else if(c.type==="booth"){let u=Et(c);if(u)for(let l of u)i(l.x,l.y)}else if(c.type==="table"){let u=Bn(c);if(u)for(let l of u)i(l.x,l.y)}else if(c.type==="decorImage"){let u=Tn(c);if(u)for(let l of u)i(l.x,l.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function ur(t,n,e,r,o,a,i){if(n.length===1){let s=e.map(m=>({x:m.x,y:m.y}));for(let m of n[0].objects)m.type==="section"?s.push(...m.outline):m.type==="shape"?s.push(...st(m)??m.points??[]):m.type==="gaArea"?s.push(...m.points):m.type==="booth"?s.push(...Et(m)??[]):m.type==="table"?s.push(...Bn(m)??[]):m.type==="decorImage"&&s.push(...Tn(m)??[]);if(ar(t,n[0],e,a)||lr(t,n[0],e,s,a))return!1;if(i&&sr(t,n[0].baseHeightM,s,a,i))return!0;let c=en(s),u=(o.minX+o.maxX)/2,l=(o.minY+o.maxY)/2,f=c.length>=3?c.map(m=>{let h=m.x-u,y=m.y-l,p=Math.max(1,Math.hypot(h,y));return{x:m.x+h/p*80,y:m.y+y/p*80}}):Jt(o.minX-28,o.minY-28,o.maxX-o.minX+56,o.maxY-o.minY+56);return V(t,f,void 0,()=>-.04,-.22,a.ground,a.ground,z),!1}else{let s=n.reduce((x,b)=>b.baseHeightM<x.baseHeightM?b:x);t.setFloor(s.index);let c={...s,objects:n.flatMap(x=>x.objects)},u=e.map(x=>({x:x.x,y:x.y}));for(let x of c.objects)x.type==="section"&&u.push(...x.outline);if(ar(t,c,e,a)||lr(t,c,e,u,a))return!1;if(i&&sr(t,s.baseHeightM,u,a,i))return!0;let l=e.filter((x,b)=>r[b]===s.index),f=oe([s],l),m=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),h=Math.max(28,Math.min(80,m*.04)),y=Jt(f.minX-h,f.minY-h,f.maxX-f.minX+h*2,f.maxY-f.minY+h*2),p=s.baseHeightM-.03;return V(t,y,void 0,()=>p,p-.22,a.ground,a.ground,z),!1}}function re(t,n,e,r){let{cx:o,cz:a,radius:i}=e,s=1/0,c=1/0,u=1/0,l=-1/0,f=-1/0,m=-1/0,h=(x,b,d)=>{s=Math.min(s,x),l=Math.max(l,x),c=Math.min(c,b),f=Math.max(f,b),u=Math.min(u,d),m=Math.max(m,d)};for(let x=0;x<t.position.length;x+=3){let b=x/3;r&&b>=r[0]&&b<r[1]||h(t.position[x],t.position[x+1],t.position[x+2])}for(let x=0;x<n.count;x++){let b=x*3,d=n.iPosition[b],M=n.iPosition[b+1],g=n.iPosition[b+2],_=Math.max(.35,n.iMaxRadius[x]??.35);h(d-_,M,g-_),h(d+_,M+1.6,g+_)}Number.isFinite(s)||(s=o-i,l=o+i,c=0,f=i*.16,u=a-i,m=a+i);let y=[(s+l)/2,(c+f)/2,(u+m)/2],p=Math.max(1,.5*Math.hypot(l-s,f-c,m-u));return{center:y,radius:p,minY:c,maxY:f}}function fr(t,n,e,r,o,a){let i=1/0,s=1/0,c=-1/0,u=-1/0;for(let g=0;g<t.count;g++){let _=g*3,R=t.iPosition[_],A=t.iPosition[_+2];R<i&&(i=R),R>c&&(c=R),A<s&&(s=A),A>u&&(u=A)}for(let g of n)i=Math.min(i,g.cx-g.halfX),c=Math.max(c,g.cx+g.halfX),s=Math.min(s,g.cz-g.halfZ),u=Math.max(u,g.cz+g.halfZ);let l=e.minX*P,f=e.maxX*P,m=e.minY*P,h=e.maxY*P,y=l,p=f,x=m,b=h;if(Number.isFinite(i)){let g=Math.max(2,.06*Math.hypot(c-i,u-s));y=Math.max(l,i-g),p=Math.min(f,c+g),x=Math.max(m,s-g),b=Math.min(h,u+g)}let d=Math.min(0,r),M=Math.max(o,a*.05);return{min:[y,d,x],max:[p,M,b]}}var ir=12,ma=.6,ha=40;function sr(t,n,e,r,o){let a=en([...e]);if(a.length<3)return!1;let i=1/0,s=1/0,c=-1/0,u=-1/0;for(let g of a)i=Math.min(i,g.x),c=Math.max(c,g.x),s=Math.min(s,g.y),u=Math.max(u,g.y);let l=Math.hypot(c-i,u-s)*P,f=Mt(a,ir/P,1.2),m=Math.max(ha,l*ma),h=Mt(a,(ir+m)/P,1.2);if(f.length!==h.length)return!1;let y=rt(r.ground,[.78,.76,.72],.35),p=rt(r.ground,[.56,.62,.52],.3);V(t,f,void 0,()=>n-.04,n-.22,y,y,z);let x=n-.05,b=f.map(g=>[g.x*P,x,g.y*P]),d=h.map(g=>[g.x*P,x,g.y*P]),M=[0,1,0];for(let g=0;g<b.length;g++){let _=(g+1)%b.length;t.tri(b[g],d[_],d[g],M,p,o,o),t.tri(b[g],b[_],d[_],M,p,p,o)}return!0}function ar(t,n,e,r){let o=Mn(n,e);if(!o)return!1;let a=n.baseHeightM,i=rt(r.ground,[.62,.55,.47],.4);return V(t,o,void 0,()=>a-.04,a-.22,i,i,z),!0}var ya=3e3,pa=20,cr=1.5,da=1.2,xa=.25;function lr(t,n,e,r,o){if(!e.length||e.length>ya||r.length<3)return!1;for(let I of n.objects){if(I.type==="shape"&&ue(I.stageKind))return!1;if(I.type==="section"){let{height:w}=Xt(I,{floorBaseHeightM:n.baseHeightM});if(w-n.baseHeightM>pa)return!1}}let a=0,i=0;for(let I of r)a+=I.x,i+=I.y;a/=r.length,i/=r.length;let s=0,c=0,u=0;for(let I of r){let w=I.x-a,T=I.y-i;s+=w*w,c+=T*T,u+=w*T}let l=.5*Math.atan2(2*u,s-c),f=Math.cos(l),m=Math.sin(l),h=-m,y=f,p=1/0,x=-1/0,b=1/0,d=-1/0;for(let I of r){let w=(I.x-a)*f+(I.y-i)*m,T=(I.x-a)*h+(I.y-i)*y;p=Math.min(p,w),x=Math.max(x,w),b=Math.min(b,T),d=Math.max(d,T)}let M=I=>[[p-I,b-I],[x+I,b-I],[x+I,d+I],[p-I,d+I]].map(([w,T])=>({x:a+f*w+h*T,y:i+m*w+y*T})),g=M(cr/P),_=M((cr+xa)/P),R=n.baseHeightM,A=rt(o.ground,[.62,.55,.47],.4),S=rt(o.ground,[.86,.86,.84],.55);return V(t,_,void 0,()=>R-.04,R-.22,A,A,z),V(t,_,[g.slice().reverse()],()=>R+da,R-.04,rt(S,[1,1,1],.2),S,z),!0}function mr(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=ae(n);if(!o.ok||o.value.id!==t)return r();let a=new Map;for(let f of e)for(let m of f.objects)m.type==="shape"&&a.set(m.id,{shape:m,unit:f});let i=new Set,s=new Set,c=new Map((n.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of o.value.overlay.productionElements??[]){let m=a.get(f.objectId),h=m?st(m.shape):null,y=f.baseElevationM??0;if(!m||!h||h.length<3||!f.id||i.has(f.id)||s.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(y)||y<-10||y>100)return r();i.add(f.id),s.add(f.objectId);let p=h.map(S=>S.x*P),x=h.map(S=>S.y*P),b=m.unit.baseHeightM+y,d=Math.min(...p),M=Math.max(...p),g=Math.min(...x),_=Math.max(...x),R,A=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&A&&(R=fo(h,b,b+f.heightM,m.unit.focal),!R))if(M-d>=_-g){let S=Math.abs(g-m.unit.focal.y*P)<=Math.abs(_-m.unit.focal.y*P)?g-.006:_+.006;R=[[d,b,S],[M,b,S],[d,b+f.heightM,S],[M,b+f.heightM,S]]}else{let S=Math.abs(d-m.unit.focal.x*P)<=Math.abs(M-m.unit.focal.x*P)?d-.006:M+.006;R=[[S,b,g],[S,b,_],[S,b+f.heightM,g],[S,b+f.heightM,_]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:b,topY:b+f.heightM,bounds:{min:[d,b,g],max:[M,b+f.heightM,_]},occlusion:f.occlusion,...A?{contentImageUrl:A}:{},...R?{contentPlane:R}:{}})}let l=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(l.map(f=>[f.objectId,f])),elements:l}}var hr=[.13,.14,.17],Kt=[.4,.43,.47],ba=.18,ga=.02,Ma=2.4,Pa=1500,Sa=240;function yr(t,n,e,r){let o=n.stageKind??"";if(Ht(o)||o==="round"||!r.length)return;let a=st(n);if(!a||a.length<3)return;let i={x:a.reduce((E,O)=>E+O.x,0)/a.length,y:a.reduce((E,O)=>E+O.y,0)/a.length},s=0,c=0,u=new Set;for(let E of r)s+=E.x,c+=E.y,u.add(Math.floor(Math.atan2(E.y-i.y,E.x-i.x)*180/Math.PI/10));if(u.size*10>Sa)return;let l=i.x-s/r.length,f=i.y-c/r.length,m=Math.hypot(l,f);if(m<1e-6)return;let h=l/m,y=f/m,p=-y,x=h,b=-1/0,d=1/0,M=1/0,g=-1/0;for(let E of a){let O=(E.x-i.x)*h+(E.y-i.y)*y,L=(E.x-i.x)*p+(E.y-i.y)*x;b=Math.max(b,O),d=Math.min(d,O),M=Math.min(M,L),g=Math.max(g,L)}let _=(g-M)*P,R=(b-d)*P;if(_<3||R<1.5||_*R>Pa)return;let A=ba/P,S=(E,O)=>({x:i.x+h*E+p*O,y:i.y+y*E+x*O}),I=(E,O,L,C)=>[S(E,L),S(E,C),S(O,C),S(O,L)],w=e+Math.max(3.5,Math.min(8,_*.35)),T=e+Math.min(Ma,w-e-1),k=.2/P,N=d+Math.min(R*.25,1.5)/P,B=ga/P;V(t,I(b-2*A+B,b-A-B,M+A+k,g-A-k),void 0,()=>T,e,hr,hr,z);for(let[E,O]of[[M+A,M+A+k],[g-A-k,g-A]])V(t,I(b-2*A,b-A,E,O),void 0,()=>w+.3,e,Kt,Kt,z),V(t,I(N+k,b-2*A,E,O),void 0,()=>w+.3,w,Kt,Kt,z);V(t,I(N,N+k,M+A,g-A),void 0,()=>w+.3,w,Kt,Kt,z)}function dt(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function pt(t){return Array.isArray(t)?t:[]}function Ia(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!dt(e))continue;let r=dt(e.extensions)?e.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Cn(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Ra(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Aa(t,n){let e=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[r*4+o]+=t[a*4+o]*n[r*4+a];return e}function _a(t){let n=Cn(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Cn(t.translation,3),r=t.rotation===void 0?[0,0,0,1]:Cn(t.rotation,4),o=t.scale===void 0?[1,1,1]:Cn(t.scale,3);if(!e||!r||!o)return null;let[a,i,s,c]=r,u=Math.hypot(a,i,s,c);if(!(u>1e-8))return null;let l=a/u,f=i/u,m=s/u,h=c/u,y=l+l,p=f+f,x=m+m,b=l*y,d=l*p,M=l*x,g=f*p,_=f*x,R=m*x,A=h*y,S=h*p,I=h*x;return[(1-(g+R))*o[0],(d+I)*o[0],(M-S)*o[0],0,(d-I)*o[1],(1-(b+R))*o[1],(_+A)*o[1],0,(M+S)*o[2],(_-A)*o[2],(1-(b+g))*o[2],0,e[0],e[1],e[2],1]}function wa(t,n,e,r){return[t[0]*n+t[4]*e+t[8]*r+t[12],t[1]*n+t[5]*e+t[9]*r+t[13],t[2]*n+t[6]*e+t[10]*r+t[14]]}function Ea(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],c=t[6],u=t[10],l=a*u-i*c,f=i*s-o*u,m=o*c-a*s,h=n*l+e*f+r*m;if(Math.abs(h)<1e-12)return null;let y=1/h;return[l*y,f*y,m*y,(r*c-e*u)*y,(n*u-r*s)*y,(e*s-n*c)*y,(e*i-r*a)*y,(r*o-n*i)*y,(n*a-e*o)*y]}function pr(t,n,e,r){let o=t[0]*n+t[1]*e+t[2]*r,a=t[3]*n+t[4]*e+t[5]*r,i=t[6]*n+t[7]*e+t[8]*r,s=Math.hypot(o,a,i)||1;return o/=s,a/=s,i/=s,[o,a,i]}function Ba(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,r=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),i=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(i===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!dt(c))return null;r=c}catch{return null}else if(i===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&r&&o?{json:r,bin:o}:null}function Ta(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Ca(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Oa(t,n,e){return e===5120?t.getInt8(n):e===5121?t.getUint8(n):e===5122?t.getInt16(n,!0):e===5123?t.getUint16(n,!0):e===5125?t.getUint32(n,!0):t.getFloat32(n,!0)}function ka(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Ba(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!dt(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=pt(r.extensionsUsed).filter(g=>typeof g=="string");if(a.includes("KHR_draco_mesh_compression")||Ia(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||pt(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(pt(r.images).length||pt(r.textures).length)return{ok:!1,issue:"external_resource"};let i=pt(r.buffers);if(i.length!==1||!dt(i[0])||i[0].uri!==void 0||typeof i[0].byteLength!="number"||!Number.isInteger(i[0].byteLength)||i[0].byteLength<0||i[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=pt(r.accessors),c=pt(r.bufferViews),u=pt(r.meshes),l=pt(r.nodes),f=pt(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!dt(f[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),y=(g,_,R)=>{if(typeof g!="number"||!Number.isInteger(g)||!dt(s[g]))return null;let A=s[g];if(A.type!==_||A.sparse!==void 0||A.normalized===!0||typeof A.count!="number"||!Number.isInteger(A.count)||A.count<1||typeof A.componentType!="number"||!R.includes(A.componentType)||typeof A.bufferView!="number")return null;let S=c[A.bufferView];if(!dt(S)||S.buffer!==0||typeof S.byteLength!="number"||!Number.isInteger(S.byteLength)||S.byteLength<0)return null;let I=Ca(A.type),w=Ta(A.componentType),T=typeof S.byteStride=="number"?S.byteStride:I*w,k=typeof S.byteOffset=="number"?S.byteOffset:0,N=typeof A.byteOffset=="number"?A.byteOffset:0,B=k+N,E=N+(A.count-1)*T+I*w;if(!Number.isInteger(T)||!Number.isInteger(k)||!Number.isInteger(N)||T<I*w||k<0||N<0||k+S.byteLength>o.byteLength||E>S.byteLength)return null;let O=[];for(let L=0;L<A.count;L++){let C=[];for(let F=0;F<I;F++){let v=Oa(h,B+L*T+F*w,A.componentType);if(!Number.isFinite(v))return null;C.push(v)}O.push(C)}return O},p=[],x=[],b=0,d=new Set,M=(g,_)=>{if(typeof g!="number"||!Number.isInteger(g)||!dt(l[g])||d.has(g))return!1;d.add(g);let R=l[g],A=_a(R);if(!A)return!1;let S=Aa(_,A),I=Ea(S);if(!I)return!1;if(R.mesh!==void 0){if(typeof R.mesh!="number")return!1;let w=u[R.mesh];if(!dt(w))return!1;for(let T of pt(w.primitives)){if(!dt(T)||T.mode!==void 0&&T.mode!==4||!dt(T.attributes))return!1;let k=y(T.attributes.POSITION,"VEC3",[5126]),N=T.attributes.NORMAL===void 0?null:y(T.attributes.NORMAL,"VEC3",[5126]);if(!k||T.attributes.NORMAL!==void 0&&!N)return!1;let B=k.length;if(T.indices!==void 0){let O=typeof T.indices=="number"?s[T.indices]:null;B=dt(O)?O.count:void 0}if(typeof B!="number"||!Number.isInteger(B)||B%3!==0||(b+=B/3,b>1e5))return!1;let E=T.indices===void 0?k.map((O,L)=>[L]):y(T.indices,"SCALAR",[5121,5123,5125]);if(!E||E.length%3!==0||E.length!==B)return!1;for(let O=0;O<E.length;O+=3){let L=[E[O][0],E[O+1][0],E[O+2][0]];if(L.some(v=>!Number.isInteger(v)||v<0||v>=k.length))return!1;let C=L.map(v=>wa(S,...k[v])),F=null;if(!N){let v=C[1][0]-C[0][0],G=C[1][1]-C[0][1],j=C[1][2]-C[0][2],U=C[2][0]-C[0][0],H=C[2][1]-C[0][1],W=C[2][2]-C[0][2];F=pr([1,0,0,0,1,0,0,0,1],G*W-j*H,j*U-v*W,v*H-G*U)}for(let v=0;v<3;v++)p.push(...C[v]),x.push(...N?pr(I,...N[L[v]]):F)}}}for(let w of pt(R.children))if(!M(w,S))return!1;return d.delete(g),!0};for(let g of pt(f[m].nodes))if(!M(g,Ra()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||p.length!==b*9||x.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(p),normal:new Float32Array(x)}}function dr(t){try{return ka(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function lm(t){let{doc:n}=t,e=Uo(n.theme),r=e.structure,o=Ze(n,t.eventConfigurationId??n.eventConfigurationId),a=mr(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new yn,c=null;if(t.registeredShellGlb){let X=dr(t.registeredShellGlb);if(X.ok){let D=X.position.length/3,Z=new Float32Array(X.position.length),J=e.materials.shell??r.tierWall;for(let q=0;q<D;q++){let ct=X.normal[q*3+1],it=ct<-.25?.4:.62+.38*Math.max(0,ct);Z[q*3]=J[0]*it,Z[q*3+1]=J[1]*it,Z[q*3+2]=J[2]*it}c={position:X.position,normal:X.normal,color:Z,floor:new Float32Array(D).fill(-2),material:new Float32Array(D),count:D}}}let u=new Map;for(let X of o)for(let D of X.objects)u.set(D.id,X.index),D.type==="section"&&u.set(D.logicalSectionId??D.id,X.index);let l=i.map(X=>u.get(X.sectionId??"")??u.get(X.rowId??"")??0),f=oe(o,i),m=s.vertexCount,y=ur(s,o,i,l,f,r,rt(e.background.top,e.background.bottom,.5))?s.vertexCount:m,p=Fe(n,i),x=new Map,b=new Map;for(let X of n.categories??[])x.set(X.key,X.color),X.seatGlyph&&b.set(X.key,X.seatGlyph);let d=[],M=bo(o,i,l),g=new Map;i.forEach((X,D)=>{let Z=M.seatDeckY(D);Number.isFinite(Z)&&g.set(X.rowId,Math.min(g.get(X.rowId)??1/0,Z))});let _=new Float32Array(i.length),R=[],A=new Map((n.floors??[]).map((X,D)=>[X.id,D])),S=o.map(()=>[]);for(let X of i){let D=X.floorId?A.get(X.floorId)??0:0;S[Math.min(D,S.length-1)]?.push(X)}let I=(X,D)=>{if(!D||D.length<3)return!1;let Z=Math.min(...D.map(it=>it.x)),J=Math.max(...D.map(it=>it.x)),q=Math.min(...D.map(it=>it.y)),ct=Math.max(...D.map(it=>it.y));for(let it=0;it<X;it++)for(let Y of S[it])if(!(Y.x<Z||Y.x>J||Y.y<q||Y.y>ct)&&At(Y,D,void 0))return!0;return!1},w=null,T=X=>o.length===1?i:i.filter((D,Z)=>l[Z]===X),k=(X,D)=>{let Z=Et(X);if(!Z)return!1;let J=1/0,q=1/0,ct=-1/0,it=-1/0;for(let Y of Z)J=Math.min(J,Y.x),ct=Math.max(ct,Y.x),q=Math.min(q,Y.y),it=Math.max(it,Y.y);return i.some((Y,lt)=>Y.kind!=="booth"&&(o.length===1||l[lt]===D)&&Y.x>J&&Y.x<ct&&Y.y>q&&Y.y<it&&ht(Z,Y.x,Y.y))};for(let X=0;X<o.length;X++){let D=o[X];s.setFloor(X);let Z=new bn,J=[],q=D.objects.filter(Y=>Y.type==="shape"&&(Y.role==="entrance"||Y.role==="exit")),ct=D.objects.filter(Y=>Y.type==="section"&&!!Y.outline&&Y.outline.length>=3),it=zo(D.objects.filter(Y=>Y.type==="booth"),D.focal);for(let Y of D.objects)if(Y.type==="section"){let lt=s.vertexCount;nr(s,Y,D,ve(Y,p),M.bySection.get(Y.id),Z,ct,r,X>0&&I(X,Y.outline));let St=s.vertexCount-lt;St>0&&R.push({sectionId:Y.id,start:lt,count:St})}else if(Y.type==="shape"){let lt=a.byObjectId.get(Y.id),St=d.length;s.setMaterial((lt?.kind??Y.role)==="screen"?1:0);let It=Y.role==="stage"&&!lt?Vo(Y,T(X)):Y,Rt=Qe(It,J);if(Fo(s,It,D.baseHeightM+Rt.supportOffsetM,Rt.topOffsetM-Rt.supportOffsetM,r,D.focal,d,lt,q),s.setMaterial(0),Y.role==="stage"&&!lt&&d.length>St&&(w??X)===X){w=X;let gt=n.floors?.[X]?.id,ft=o.length>1&&gt?i.filter(Gt=>Gt.floorId===gt):i;yr(s,It,d[d.length-1].y,ft)}}else Y.type==="gaArea"?Lo(s,Y,D.baseHeightM,ot(x.get(Y.categoryKey)),r):Y.type==="booth"?Co(s,Y,D.baseHeightM,ot(x.get(Y.categoryKey)),r,it.get(Y.id)??D.focal,k(Y,X)):Y.type==="table"?ko(s,Y,Math.max(D.baseHeightM,g.get(Y.id)??D.baseHeightM),ot(Y.fill??n.theme?.decorFill??"#232c40"),r,!!(Y.fill??n.theme?.decorFill)):Y.type==="decorImage"&&vo(s,Y,D.baseHeightM,r);or(s,D,i,M,r,e.materials.shell,!c)}let N=o.length>1?{x:o.reduce((X,D)=>X+D.focal.x,0)/o.length,y:o.reduce((X,D)=>X+D.focal.y,0)/o.length}:n.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},B=we(c?[s.build(),c]:[s.build()]),E=Oe(i,t.initialState,M,_,x,b),O=Go({doc:n,units:o,seats:i,surfaces:M,focal:N}),{labels:L,sections:C,rows:F}=Xo({doc:n,units:o,seats:i,surfaces:M,seatData:E,hintedSeatFloor:l,zones:O,focal:N}),v=new Map(C.map((X,D)=>[X.id,D]));M.seatOwner.forEach((X,D)=>{E.iSection[D]=X?v.get(X)??-1:-1});let G=rr({doc:n,units:o,seats:i,surfaces:M,solids:B,hintedSeatFloor:l,seatFloor:_});Ho(L,G),E.iYaw=Ce(E.iPosition,i.length,X=>i[X].rowId,X=>{let D=o[_[X]]?.focal??N;return[D.x*P,D.y*P]});let j=(f.minX+f.maxX)/2*P,U=(f.minY+f.maxY)/2*P,H=.5*Math.hypot((f.maxX-f.minX)*P,(f.maxY-f.minY)*P)||10,W=re(B,E,{cx:j,cz:U,radius:H},[m,y]),nt=re(B,E,{cx:j,cz:U,radius:H}),$=fr(E,d,f,W.minY,W.maxY,H);return{sharedAisles:jo(o.flatMap(X=>X.objects.flatMap(D=>{if(D.type!=="section")return[];let Z=M.bySection.get(D.id);return Z?[{sectionId:D.id,floorIndex:X.index,rows:Z.rowLevels}]:[]}))),solids:B,sectionSolidRanges:R,seats:E,seatSectionIds:M.seatOwner,bounds:{center:[($.min[0]+$.max[0])/2,($.min[1]+$.max[1])/2,($.min[2]+$.max[2])/2],radius:H,groundY:0,box:$},renderBounds:{center:W.center,radius:W.radius},clipBounds:{center:nt.center,radius:nt.radius},stateColorLUT:Yo(e,tn),theme:e,seatCount:i.length,focalWorld:[N.x*P,1.5,N.y*P],zones:O,stages:d,productionElements:a.elements,sections:C,rows:F,labels:L,floors:G}}function Fa(t,n){let{doc:e,report:r}=uo(t),o=r.confident&&(r.sections.length>0||!!r.looseRowBlocks);if(!o&&!r.roles?.length)return null;if(!o){let c=new Map(r.roles.map(h=>[h.id,h.role])),u=h=>h.map(y=>y.type==="shape"&&c.has(y.id)?{...y,role:c.get(y.id)}:y),l=t.floors?.map(h=>({...h,objects:u(h.objects)})),f=new Float64Array(n.length).fill(Number.NaN),m=new Float64Array(n.length*2).fill(Number.NaN);return n.forEach((h,y)=>{h.eyeHeightM!==void 0&&(f[y]=h.eyeHeightM),h.focalPoint&&(m[y*2]=h.focalPoint.x,m[y*2+1]=h.focalPoint.y)}),{doc:{...t,objects:l?.[0]?.objects??u(t.objects),...l?{floors:l}:{}},report:r,eyeHeightM:f,focal:m}}let a=new Map(fn(e).map(c=>[c.id,c])),i=new Float64Array(n.length).fill(Number.NaN),s=new Float64Array(n.length*2).fill(Number.NaN);return n.forEach((c,u)=>{let l=a.get(c.id)??c;l.eyeHeightM!==void 0&&(i[u]=l.eyeHeightM),l.focalPoint&&(s[u*2]=l.focalPoint.x,s[u*2+1]=l.focalPoint.y)}),{doc:e,report:r,eyeHeightM:i,focal:s}}function va(t,n){return t.map((e,r)=>{let o=n.eyeHeightM[r],a=n.focal[r*2],i=n.focal[r*2+1],s={...e};return Number.isNaN(o)?delete s.eyeHeightM:s.eyeHeightM=o,Number.isNaN(a)?delete s.focalPoint:s.focalPoint={x:a,y:i},s})}function hm(t){let n=t.estimate===!1?null:Fa(t.doc,t.seats);return n?{input:{...t,doc:n.doc,seats:va(t.seats,n)},estimate:n}:{input:t}}export{Wa as a,Tr as b,Cr as c,Be as d,Or as e,za as f,tn as g,vn as h,Ua as i,Dn as j,P as k,dn as l,nc as m,ec as n,uo as o,jc as p,Uc as q,Yc as r,Wc as s,zc as t,Vc as u,Vn as v,Kc as w,Zc as x,qc as y,$c as z,Qc as A,Ds as B,lm as C,Fa as D,va as E,hm as F};
@@ -1 +0,0 @@
1
- import{l as E}from"./chunk-5BMXWOE7.js";import{N as v,Ta as _,Wa as R}from"./chunk-VAI2VDQR.js";var T=.08,Y=.045;function L(t){return`__floor__:${encodeURIComponent(t)}`}function X(t,e,o){return{...t,objects:e,floors:void 0,...o?{focalPoint:o}:{},referenceImage:void 0,backgroundImage:void 0}}function j(t,e,o){let s=t.focalPoint??e.focalPoint;return s?s.x:o.x+o.width/2}function Q(t){let e=t.floors??[];if(!e.length)return[];let o=e.map(n=>R(X(t,n.objects,n.focalPoint),{freeText:"exclude"})),a=Math.max(1,...o.map(n=>n.width))*T,r=0;return e.map((n,c)=>{let h=o[c],u=r-(h.y+h.height);return r-=h.height+a,{floorId:n.id,label:n.name??n.id,level:c,levelBadge:c===0?"G":String(c),translation:{x:-j(n,t,h),y:u},bounds:h}})}function z(t,e,o,s){let a=e==="name"?t.label:t.levelBadge;if(!a)return[];let r=Math.max(1,o*Y),n=t.bounds.x+t.translation.x,c=t.bounds.y+t.translation.y+r*.4,h=`floor-level-${t.floorId}`,u={type:"text",id:`${h}-text`,text:a,position:{x:n,y:c},fontSize:r,rotation:0,color:s,bold:!0};if(e==="name")return[u];let x=r*.95;return[{type:"shape",id:`${h}-badge`,kind:"ellipse",x:n-x*.35,y:c-x*.3,width:x*2,height:x*2,fill:"transparent",stroke:{color:s,width:Math.max(1,r*.09)},opacity:.8},u]}function V(t,e={}){let o=t.floors;if(!o||o.length<2)return t;let s=Q(t),a=[];o.forEach((u,x)=>{let{x:y,y:S}=s[x].translation;for(let I of u.objects)x>0&&I.type==="shape"&&I.role==="stage"||a.push(_(I,y,S))});let r={...t,objects:a,floors:void 0},n=R(r,{freeText:"exclude"}),c=Math.max(1,n.width,n.height),h=t.theme?.textColor??"#94a3b8";for(let u of s)a.push(...z(u,e.labelStyle??"number",c,h));return{...r,objects:a,referenceImage:void 0,backgroundImage:void 0}}function W(t){if(!t.floors||t.floors.length<2)return t;let e=!t.zones?.length,o=new Set,s=t.floors.flatMap(r=>r.objects.flatMap(n=>{if(n.type==="shape"&&n.role==="stage"){let c=JSON.stringify([n.kind,n.x,n.y,n.width,n.height,n.points,n.rotation??0,n.label,n.heightM,n.eventConfigurationIds]);if(o.has(c))return[];o.add(c)}return e&&n.type==="section"?[{...n,zone:L(r.id)}]:[n]})),a=e?t.floors.map(r=>({id:L(r.id),label:r.name,focalPoint:{...r.focalPoint}})):t.zones;return{...t,objects:s,zones:a,floors:void 0,referenceImage:void 0,backgroundImage:E(t)}}function N(t){let e=t.floors;if(!e?.length)return null;let o=e.find(r=>r.objects.some(n=>n.type==="shape"&&n.role==="stage"));if(o)return o.id;let s=e[0],a=-1;for(let r of e){let n=R(X(t,r.objects,r.focalPoint),{freeText:"exclude"}),c=n.width*n.height;c>a&&(a=c,s=r)}return s.id}var U=640;function tt(t,e){return(t.floors?.length??0)<2?null:t.floorOverview==="combined"||!Number.isFinite(e)||e<=0||e>=U?"all":N(t)}var Z=9;function $(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,o=t.height/2,s=t.rotation??0;if(!s)return{hx:e,hy:o};let a=s*Math.PI/180,r=Math.abs(Math.cos(a)),n=Math.abs(Math.sin(a));return{hx:e*r+o*n,hy:e*n+o*r}}function q(t,e,o){let s=e-t.seat.x,a=o-t.seat.y;if(t.shape.kind==="circle")return s*s+a*a<=t.shape.r*t.shape.r;let r=t.shape.rotation??0,n=s,c=a;if(r){let h=-r*Math.PI/180,u=Math.cos(h),x=Math.sin(h);n=s*u-a*x,c=s*x+a*u}return Math.abs(n)<=t.shape.width/2&&Math.abs(c)<=t.shape.height/2}function G(t,e,o,s,a){if(t.shape.kind==="circle"){let f=Math.min(Math.max(t.seat.x,e),s),m=Math.min(Math.max(t.seat.y,o),a),d=t.seat.x-f,p=t.seat.y-m;return d*d+p*p<=t.shape.r*t.shape.r}let r=t.shape.rotation??0;if(!r)return t.seat.x-t.hx<=s&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=a&&t.seat.y+t.hy>=o;let n=r*Math.PI/180,c=Math.cos(n),h=Math.sin(n),u=t.shape.width/2,x=t.shape.height/2,y=[[-u,-x],[u,-x],[u,x],[-u,x]].map(([f,m])=>[t.seat.x+f*c-m*h,t.seat.y+f*h+m*c]),S=[[e,o],[s,o],[s,a],[e,a]],I=[[1,0],[0,1],[c,h],[-h,c]];for(let[f,m]of I){let d=1/0,p=-1/0;for(let[P,O]of y){let i=P*f+O*m;i<d&&(d=i),i>p&&(p=i)}let M=1/0,w=-1/0;for(let[P,O]of S){let i=P*f+O*m;i<M&&(M=i),i>w&&(w=i)}if(p<M||w<d)return!1}return!0}function ot(t,e={}){let o=e.seatRadius??Z,s=t.length,a=new Array(s),r=1/0,n=1/0,c=-1/0,h=-1/0,u=0;for(let i=0;i<s;i++){let l=t[i],D=e.shapeOf?.(l)??{kind:"circle",r:o},{hx:g,hy:b}=$(D);a[i]={seat:l,shape:D,hx:g,hy:b},l.x-g<r&&(r=l.x-g),l.y-b<n&&(n=l.y-b),l.x+g>c&&(c=l.x+g),l.y+b>h&&(h=l.y+b),g>u&&(u=g),b>u&&(u=b)}s===0&&(r=0,n=0,c=0,h=0);let x=u>0?u*4:1,y=Math.max(c-r,0),S=Math.max(h-n,0),I=Math.max(64,e.maxCells??s*4),f=x,m=Math.max(1,Math.ceil(y/f)||1),d=Math.max(1,Math.ceil(S/f)||1);for(;m*d>I&&(m>1||d>1);)f*=2,m=Math.max(1,Math.ceil(y/f)||1),d=Math.max(1,Math.ceil(S/f)||1);let p=m*d,M=new Int32Array(p+1),w=0;for(let i=0;i<s;i++){let l=a[i],D=v(Math.floor((l.seat.x-l.hx-r)/f),0,m-1),g=v(Math.floor((l.seat.x+l.hx-r)/f),0,m-1),b=v(Math.floor((l.seat.y-l.hy-n)/f),0,d-1),F=v(Math.floor((l.seat.y+l.hy-n)/f),0,d-1);for(let A=b;A<=F;A++)for(let C=D;C<=g;C++)M[A*m+C+1]++,w++}for(let i=0;i<p;i++)M[i+1]+=M[i];let P=new Int32Array(w),O=M.slice(0,p);for(let i=0;i<s;i++){let l=a[i],D=v(Math.floor((l.seat.x-l.hx-r)/f),0,m-1),g=v(Math.floor((l.seat.x+l.hx-r)/f),0,m-1),b=v(Math.floor((l.seat.y-l.hy-n)/f),0,d-1),F=v(Math.floor((l.seat.y+l.hy-n)/f),0,d-1);for(let A=b;A<=F;A++)for(let C=D;C<=g;C++){let k=A*m+C;P[O[k]++]=i}}return{seats:t,entries:a,minX:r,minY:n,cell:f,cols:m,rows:d,cellStart:M,items:P,stamp:new Int32Array(s),epoch:0}}function rt(t,e,o={}){let{cols:s,rows:a,cell:r,minX:n,minY:c,cellStart:h,items:u,entries:x}=t,y=Math.floor((e.x-n)/r),S=Math.floor((e.y-c)/r);if(y<0||S<0||y>=s||S>=a)return null;let I=S*s+y,f=h[I+1],m=-1,d=1/0;for(let p=h[I];p<f;p++){let M=u[p],w=x[M];if(o.filter&&!o.filter(w.seat.id,w.seat)||!q(w,e.x,e.y))continue;let P=e.x-w.seat.x,O=e.y-w.seat.y,i=P*P+O*O;(i<d||i===d&&M<m)&&(d=i,m=M)}return m<0?null:x[m].seat.id}function st(t,e,o,s={}){if(!(o>0))return null;let{cols:a,rows:r,cell:n,minX:c,minY:h,cellStart:u,items:x,entries:y}=t,S=Math.max(0,Math.floor((e.x-o-c)/n)),I=Math.min(a-1,Math.floor((e.x+o-c)/n)),f=Math.max(0,Math.floor((e.y-o-h)/n)),m=Math.min(r-1,Math.floor((e.y+o-h)/n));if(S>I||f>m)return null;let d=-1,p=o*o,M=t.stamp,w=++t.epoch;for(let P=f;P<=m;P++){let O=P*a;for(let i=S;i<=I;i++){let l=O+i,D=u[l+1];for(let g=u[l];g<D;g++){let b=x[g];if(M[b]===w)continue;M[b]=w;let F=y[b];if(s.filter&&!s.filter(F.seat.id,F.seat))continue;let A=e.x-F.seat.x,C=e.y-F.seat.y,k=A*A+C*C;(k<p||k===p&&b<d)&&(p=k,d=b)}}}return d<0?null:y[d].seat.id}function at(t,e,o={}){let s=Math.min(e.x,e.x+e.width),a=Math.max(e.x,e.x+e.width),r=Math.min(e.y,e.y+e.height),n=Math.max(e.y,e.y+e.height),c=o.mode??"center",{cols:h,rows:u,cell:x,minX:y,minY:S,cellStart:I,items:f,entries:m}=t,d=Math.max(0,Math.floor((s-y)/x)),p=Math.min(h-1,Math.floor((a-y)/x)),M=Math.max(0,Math.floor((r-S)/x)),w=Math.min(u-1,Math.floor((n-S)/x));if(d>p||M>w)return[];let P=[],O=t.stamp,i=++t.epoch;for(let l=M;l<=w;l++){let D=l*h;for(let g=d;g<=p;g++){let b=D+g,F=I[b+1];for(let A=I[b];A<F;A++){let C=f[A];if(O[C]===i)continue;O[C]=i;let k=m[C];if(o.filter&&!o.filter(k.seat.id,k.seat))continue;(c==="center"?k.seat.x>=s&&k.seat.x<=a&&k.seat.y>=r&&k.seat.y<=n:G(k,s,r,a,n))&&P.push(C)}}}return P.sort((l,D)=>l-D),P.map(l=>m[l].seat.id)}function ct(t){let e=t.cols*t.rows,o=0,s=0;for(let r=0;r<e;r++){let n=t.cellStart[r+1]-t.cellStart[r];n>0&&o++,n>s&&(s=n)}let a=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:o,refs:a,maxPerCell:s,meanPerOccupiedCell:o?a/o:0}}function lt(t,e=0){let o=Math.max(1,t.width,t.height),s={x:t.x+t.width/2,y:t.y+t.height/2},a=o*1.55,r=Math.max(o*.82,Math.max(0,e)+o*.45);return{target:s,distance:a,height:r,focalLength:Math.hypot(a,r),yawRad:-8*Math.PI/180}}function B(t,e,o=0){let s=e.x-t.target.x,a=e.y-t.target.y,r=Math.cos(t.yawRad),n=Math.sin(t.yawRad),c=s*r-a*n,u=s*n+a*r-t.distance,x=o-t.height,y=Math.hypot(t.distance,t.height),S=(-t.distance*u-t.height*x)/y,I=(-t.height*u+t.distance*x)/y,f=Math.max(y*.08,S),m=t.focalLength/f;return{x:t.target.x+c*m,y:t.target.y-I*m,depth:f,scale:m}}function ht(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function ut(t){let e=t.a*t.d-t.b*t.c;if(!Number.isFinite(e)||Math.abs(e)<1e-9)throw new Error("perspective projection produced a singular affine");let o=t.d/e,s=-t.b/e,a=-t.c/e,r=t.a/e;return{a:o,b:s,c:a,d:r,e:-(o*t.e+a*t.f),f:-(s*t.e+r*t.f)}}function mt(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function xt(t,e,o=()=>0){let s=B(t,e,o(e)),a={x:e.x+1,y:e.y},r={x:e.x,y:e.y+1},n=B(t,a,o(a)),c=B(t,r,o(r)),h=n.x-s.x,u=n.y-s.y,x=c.x-s.x,y=c.y-s.y;return{a:h,b:u,c:x,d:y,e:s.x-h*e.x-x*e.y,f:s.y-u*e.x-y*e.y}}function ft(t){let e=Math.hypot(t.a,t.b),o=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:o/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(o,1e-9)}}export{T as a,L as b,Q as c,V as d,W as e,N as f,U as g,tt as h,Z as i,ot as j,rt as k,st as l,at as m,ct as n,lt as o,B as p,ht as q,ut as r,mt as s,xt as t,ft as u};
@@ -1 +0,0 @@
1
- import{c as K,d as Y,e as _,f as j}from"./chunk-5BGP7S3Q.js";function ce(t){let o=t.mediaKind==="demo-render",i=t.generated||t.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":o?t.coverage==="exact-seat"?"AI-generated exact-seat demo":t.coverage==="row-representative"?"AI-generated representative row demo":t.coverage==="section-representative"?"AI-generated representative section demo":t.coverage==="floor-representative"?"AI-generated representative floor demo":"AI-generated illustrative venue demo":t.coverage==="exact-seat"?"Exact seat photo":t.coverage==="row-representative"?"Representative row view":t.coverage==="section-representative"?"Representative section view":t.coverage==="floor-representative"?"Representative floor view":t.coverage==="venue-representative"?"Representative venue view":"Venue photo",u=t.capturedAt&&/^\d{4}/.test(t.capturedAt)?t.capturedAt.slice(0,4):"";return[i,u?`${o?"created":"captured"} ${u}`:"",t.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function de(t){if(t.generated||t.mediaKind==="model"||t.mediaKind==="demo-render")return!1;let o=t.sourceLabel?.trim()??"";return!/^(?:AI[- ]generated|generated\s+(?:demo|preview))/i.test(o)}var G=70,ee=35,te=90;function ne(t){return Math.max(ee,Math.min(te,t))}var re=35;function oe(t,o,i){let u=(.5+t/360)*i;return o/2-u}function ie(t,o=G){return t*(180/o)}function B(t,o,i){return(t-o)/2+S(i,o)}function S(t,o){let i=re/180*o;return Math.max(-i,Math.min(i,t))}function ae(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function se(t){return t||(ae()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function ue(t,o,i={}){let u=i.fadeMs??400,N=o.initialBearingDeg??0,v=Y(o,K()),b=new AbortController,H=()=>b.abort();i.signal?.addEventListener("abort",H,{once:!0});let a=document.createElement("div"),U=document.activeElement instanceof HTMLElement?document.activeElement:null;a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-label",i.seatLabel?`View from ${i.seatLabel}`:"View from seat"),a.tabIndex=-1,Object.assign(a.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${u}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let r=document.createElement("div");Object.assign(r.style,{position:"absolute",inset:"0",backgroundImage:`url("${v.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),a.appendChild(r);let d=document.createElement("button");if(d.type="button",d.setAttribute("aria-label","Close"),d.textContent="\u2715",Object.assign(d.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),a.appendChild(d),i.disclosure){let e=document.createElement("div");e.textContent=`${i.disclosurePrefix??"360\xB0 panorama"} \xB7 ${i.disclosure}`,Object.assign(e.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",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)"}),a.appendChild(e)}let D=document.createElement("div");D.textContent=se(i.lookAroundHint),Object.assign(D.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"}),a.appendChild(D),t.appendChild(a),d.focus({preventScroll:!0});let g=0,s=0,p=0,c=0,m=G,y=()=>{let e=a.clientHeight||1,n=a.clientWidth||1,M=f.naturalWidth||n*2,J=f.naturalHeight||e,Q=g>0?(n/2-p)/g:0,Z=s>0?c/s:0;s=ie(e,m),g=s*(M/J),r.style.backgroundSize=`${g}px ${s}px`,$?p=n/2-Q*g:(p=oe(N,n,g),c=S((o.initialPitchDeg??0)/180*s,s),$=!0),c=S(Z*s,s),r.style.backgroundPosition=`${p}px ${B(e,s,c)}px`},$=!1,z=()=>{let e=a.clientHeight||1;c=S(c,s),r.style.backgroundPosition=`${p}px ${B(e,s,c)}px`},f=new Image;f.onload=y,f.src=v.initialUrl;let O=()=>{};v.upgradeUrl&&(O=j(()=>{(o.resolveUrl?o.resolveUrl(v.upgradeUrl):Promise.resolve(v.upgradeUrl)).then(n=>!n||b.signal.aborted?null:_(n,b.signal).then(M=>({full:M,url:n}))).then(n=>{n&&(I||b.signal.aborted||(f=n.full,r.style.backgroundImage=`url("${n.url}")`,y()))}).catch(()=>{})})),requestAnimationFrame(y);let w=!1,E=0,A=0,h=0,l=new Map,L=()=>{let[e,n]=[...l.values()];return e&&n?Math.hypot(e.x-n.x,e.y-n.y):0},P=e=>{let n=ne(e);n!==m&&(m=n,y())},F=e=>{l.set(e.pointerId,{x:e.clientX,y:e.clientY}),w=l.size===1,E=e.clientX,A=e.clientY,l.size===2&&(h=L()),r.style.cursor="grabbing";try{r.setPointerCapture?.(e.pointerId)}catch{}},R=e=>{if(l.has(e.pointerId)){if(l.set(e.pointerId,{x:e.clientX,y:e.clientY}),l.size>=2){let n=L();h>0&&n>0&&P(m*(h/n)),h=n,w=!1;return}w&&(p+=e.clientX-E,c+=e.clientY-A,E=e.clientX,A=e.clientY,z())}},k=e=>{l.delete(e.pointerId),h=l.size===2?L():0;let n=l.values().next().value;w=l.size===1,n?(E=n.x,A=n.y):r.style.cursor="grab";try{r.releasePointerCapture?.(e.pointerId)}catch{}},T=e=>{e.preventDefault(),P(m+e.deltaY*.04)};r.addEventListener("pointerdown",F),r.addEventListener("pointermove",R),r.addEventListener("pointerup",k),r.addEventListener("pointercancel",k),r.addEventListener("wheel",T,{passive:!1});let C=!1,I=!1,x=0,q=()=>{r.removeEventListener("pointerdown",F),r.removeEventListener("pointermove",R),r.removeEventListener("pointerup",k),r.removeEventListener("pointercancel",k),r.removeEventListener("wheel",T),window.removeEventListener("keydown",X)},W=()=>{O(),b.abort(),i.signal?.removeEventListener("abort",H),x&&(window.clearTimeout(x),x=0),q(),a.parentNode&&a.parentNode.removeChild(a),U?.isConnected&&U.focus({preventScroll:!0})},V=()=>{if(C)return;C=!0,a.style.opacity="0";let e=()=>{x=0,!I&&(W(),i.onClose?.())};x=window.setTimeout(e,u)},X=e=>{if(e.key==="Tab"){e.preventDefault(),d.focus({preventScroll:!0});return}if(e.key==="Escape"){e.stopPropagation(),V();return}if(e.key==="ArrowLeft"||e.key==="ArrowRight")p+=e.key==="ArrowLeft"?-32:32;else if(e.key==="ArrowUp"||e.key==="ArrowDown")c+=(e.key==="ArrowUp"?4:-4)*(s/180);else if(e.key==="+"||e.key==="="){P(m-5),e.preventDefault();return}else if(e.key==="-"){P(m+5),e.preventDefault();return}else return;e.preventDefault(),z()};return window.addEventListener("keydown",X),d.addEventListener("click",V),requestAnimationFrame(()=>{a.style.opacity="1"}),{close:V,dispose(){C=!0,I=!0,W()}}}export{ce as a,de as b,G as c,ne as d,re as e,oe as f,ie as g,B as h,S as i,se as j,ue as k};
@@ -1 +0,0 @@
1
- import{h as Ie,i as ce}from"./chunk-5ITK5236.js";import{c as Pe}from"./chunk-CRCGO52K.js";var Yn=2e6,Mt=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,St=/[\s"'<>`\\]/;function vt(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Mt.test(e);if(St.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Ce(e){let t=e.trim();return vt(t)?t:null}var wt=2e5,Wn=1e5,Et="large_venue_inventory";function $n(e){return e?.includes(Et)?2e5:1e5}var Z="seatlayer.event-configuration/1",le="seatlayer.event-configuration-export/1",K=100,It=120,Pt=2e5,Ct=1e4,ke=/^[a-f0-9]{64}$/,_t=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Y(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function H(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Re(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function _e(e){return!Array.isArray(e)||e.length>Pt||!e.every(t=>H(t,K))?null:[...new Set(e)].sort()}function Te(e){return!Y(e)||!H(e.chartId,K)||!H(e.version,K)||e.sha256!==void 0&&(typeof e.sha256!="string"||!ke.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function ue(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function kt(e){return Y(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&ue(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Rt(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Ct)return null;let n=new Set(t),i=new Set,o=new Set,r=0,s=[];for(let l of e){if(!Y(l)||!H(l.id,K)||!H(l.objectId,K)||!n.has(l.objectId)||!_t.has(String(l.kind))||!ue(l.heightM,.05,50)||l.baseElevationM!==void 0&&!ue(l.baseElevationM,-10,100))return null;let m=kt(l.occlusion);if(!m||i.has(l.id)||o.has(l.objectId))return null;let a=l.contentImageUrl===void 0?void 0:typeof l.contentImageUrl=="string"?Ce(l.contentImageUrl):null;if(l.contentImageUrl!==void 0&&(!a||l.kind!=="screen"||++r>1))return null;i.add(l.id),o.add(l.objectId),s.push({id:l.id,objectId:l.objectId,kind:l.kind,heightM:l.heightM,...l.baseElevationM!==void 0?{baseElevationM:l.baseElevationM}:{},occlusion:m,...a?{contentImageUrl:a}:{}})}return s.sort((l,m)=>l.id.localeCompare(m.id))}function Oe(e){let t=[];if(!Y(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Z&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Z}`}),H(e.id,K)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),H(e.label,It)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Re(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Te(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 i=Y(e.overlay)?e.overlay:null,o=_e(i?.objectIds),r=_e(i?.productionKillSeatIds),s=o?Rt(i?.productionElements,o):null;return(!i||!o||!r)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===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||!r||s===null?{issues:t}:{issues:t,value:{schema:Z,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:r,...s!==void 0?{productionElements:s}:{}}}}}function Jn(e){let t=Oe(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Zn(e){if(!Y(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let t=[];e.schema!==le&&t.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${le}`}),(typeof e.contentSha256!="string"||!ke.test(e.contentSha256))&&t.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let n=Oe(e.configuration);return t.push(...n.issues),t.length||!n.value||typeof e.contentSha256!="string"?{ok:!1,issues:t}:{ok:!0,value:{schema:le,configuration:n.value,contentSha256:e.contentSha256}}}function eo(e){return JSON.stringify({schema:Z,id:e.id,label:e.label,version:e.version,baseVenue:{chartId:e.baseVenue.chartId,version:e.baseVenue.version,...e.baseVenue.sha256?{sha256:e.baseVenue.sha256}:{}},overlay:{objectIds:[...new Set(e.overlay.objectIds)].sort(),productionKillSeatIds:[...new Set(e.overlay.productionKillSeatIds)].sort(),...e.overlay.productionElements!==void 0?{productionElements:[...e.overlay.productionElements].sort((t,n)=>t.id.localeCompare(n.id)).map(t=>({id:t.id,objectId:t.objectId,kind:t.kind,heightM:t.heightM,...t.baseElevationM!==void 0?{baseElevationM:t.baseElevationM}:{},occlusion:t.occlusion,...t.contentImageUrl?{contentImageUrl:t.contentImageUrl}:{}}))}:{}}})}function to(e,t){let n=[];e.baseVenue.chartId!==t.chartId&&n.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==t.version&&n.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!t.sha256?n.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==t.sha256&&n.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let i=new Set(t.objectIds);for(let r of e.overlay.objectIds)i.has(r)||n.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(t.objectTypes)for(let r of e.overlay.productionElements??[])t.objectTypes.get(r.objectId)!=="shape"&&n.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let o=new Set(t.seatIds);for(let r of e.overlay.productionKillSeatIds)o.has(r)||n.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:n.length===0,issues:n}}var Tt={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function no(e,t){return e===t||Tt[e].has(t)}function oo(e,t,n){return!Re(n)||n>=t.version?null:e.find(i=>i.id===t.id&&i.version===n&&i.status==="published")??null}function Ot(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function de(e,t,n){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let i of e)de(i,t,n);return}for(let[i,o]of Object.entries(e)){if(i==="eventConfigurationId"){H(o,K)?t.add(o):o!==void 0&&n.add(String(o));continue}if(i==="eventConfigurationIds"){if(!Array.isArray(o))n.add(String(o));else for(let r of o)H(r,K)?t.add(r):n.add(String(r));continue}de(o,t,n)}}}function io(e,t){let n=Te(t);if(!n)return{ok:!1,invalidIds:["baseVenue"]};let i=new Set,o=new Set;if(de(e,i,o),o.size)return{ok:!1,invalidIds:[...o].sort()};let r=Ot(e);return{ok:!0,configurations:[...i].sort().map(s=>({schema:Z,id:s,label:s,version:1,baseVenue:n,overlay:{objectIds:r.filter(l=>l.type==="shape"&&l.eventConfigurationIds?.includes(s)).map(l=>l.id).sort(),productionKillSeatIds:[]}}))}}var so=40,ao=1200,co=.8,lo=3,uo=-2,fo=20,ho=.1,mo=40,po=40,Ae=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function At(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let i=Math.max(1,Math.floor(t/Ae(e))),o=0;for(let r of n){if(!r.length){o+=1;continue}let s=0;for(let l of r.split(/\s+/)){let m=l.length;s&&s+1+m<=i?s+=1+m:(o+=Math.max(1,Math.ceil(m/i)),s=m%i)}}return Math.max(1,o)}function Ne(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),i=Math.max(1,...n.map(l=>l.length))*Ae(e),o=e.width??i+t*2,r=Math.max(1,o-t*2),s=At(e,r);return{width:o,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var Nt=Math.PI/180;function k(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function jt(e,t,n){let i=Math.cos(n),o=Math.sin(n),r=e.x-t.x,s=e.y-t.y;return{x:t.x+r*i-s*o,y:t.y+r*o+s*i}}function yo(e,t){return jt(e,{x:0,y:0},t*Nt)}function L(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Lt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let i=e.length||1;return{x:t/i,y:n/i}}function go(e){return e.length?Lt(e):null}function fe(e,t){let n=1-t,i=n*n*n,o=3*n*n*t,r=3*n*t*t,s=t*t*t;return{x:i*e.start.x+o*e.control1.x+r*e.control2.x+s*e.end.x,y:i*e.start.y+o*e.control1.y+r*e.control2.y+s*e.end.y}}function So(e,t,n){let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},o={x:(n.x-i.x)*4/3,y:(n.y-i.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+o.x,y:e.y+(t.y-e.y)/3+o.y},control2:{x:e.x+(t.x-e.x)*2/3+o.x,y:e.y+(t.y-e.y)*2/3+o.y},end:{...t}}}function Fe(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[fe(e,.5)];let i=Array.from({length:n+1},(m,a)=>fe(e,a/n)),o=new Float64Array(i.length);for(let m=1;m<i.length;m+=1){let a=i[m].x-i[m-1].x,c=i[m].y-i[m-1].y;o[m]=o[m-1]+Math.hypot(a,c)}let r=o[o.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],l=1;for(let m=0;m<t;m+=1){let a=r*m/(t-1);for(;l<o.length-1&&o[l]<a;)l+=1;let c=o[l-1],u=o[l],h=u===c?0:(a-c)/(u-c);s.push({x:i[l-1].x+(i[l].x-i[l-1].x)*h,y:i[l-1].y+(i[l].y-i[l-1].y)*h})}return s}function F(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ee(e,t){return{x:e.x-t.x,y:e.y-t.y}}function D(e,t){return{x:e.x*t,y:e.y*t}}function oe(e,t=13){return Array.from({length:t},(n,i)=>fe(e,i/(t-1)))}function je(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return L(e[i],e[i+1],n-i)}function Le(e,t,n){let i=Math.max(0,Math.min(1,t)),o=Math.max(i,Math.min(1,n)),r=[je(e,i)];for(let s=1;s<e.length-1;s+=1){let l=s/(e.length-1);l>i+1e-9&&l<o-1e-9&&r.push(e[s])}return r.push(je(e,o)),r}function De(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],i=0,o=Number.POSITIVE_INFINITY;n.forEach(([h,d],p)=>{let f=k(L(e[h],e[d],.5),t);f<o&&(o=f,i=p)});let r=e[i],s=e[(i+1)%4],l=e[(i+2)%4],m=e[(i+3)%4],a=L(r,s,.5),c=ee(t,a),u=Math.max(1e-9,Math.hypot(c.x,c.y));return{p0:r,p1:s,p2:l,p3:m,normal:D(c,1/u),depth:(k(r,m)+k(s,l))/2}}function Ve(e){let{p0:t,p1:n,p2:i,p3:o,normal:r,depth:s}=e,l=ee(n,t),m=ee(i,o),a=s*.22,c=s*.12;return{nearPath:{start:t,control1:F(F(t,D(l,1/3)),D(r,a)),control2:F(F(t,D(l,2/3)),D(r,a)),end:n},farPath:{start:i,control1:F(F(o,D(m,2/3)),D(r,c)),control2:F(F(o,D(m,1/3)),D(r,c)),end:o}}}function vo(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let i=e.reduce((p,f)=>F(p,f),{x:0,y:0});i.x/=4,i.y/=4;let o=k(e[0],e[1]),r=k(e[0],e[3]),s=n==="auto"?o>r*1.25&&k(i,t)>r?"bezier":"tapered":n;if(s==="rectangle")return{mode:s,outline:e.map(p=>({...p}))};let l=De(e,t),{p0:m,p1:a,p2:c,p3:u}=l;if(s==="tapered")return{mode:s,outline:[F(m,D(ee(a,m),.14)),F(m,D(ee(a,m),1-.14)),c,u]};let{nearPath:h,farPath:d}=Ve(l);return{mode:s,outline:[...oe(h),...oe(d).slice(1)]}}function wo(e,t,n,i){if(e.length!==4)throw new Error("Aisle generation requires four mapped bounds corners");if(!Number.isInteger(n)||n<0||n>3)throw new Error("Aisle count must be an integer from 0 to 3");if(n===0)return[];let o=De(e,t),{p0:r,p1:s,p2:l,p3:m}=o,a=i==="bezier"?Ve(o):null,c=a?oe(a.nearPath):null,u=a?oe(a.farPath).reverse():null,h=Math.min(.055,.18/(n+1));return Array.from({length:n},(d,p)=>{let f=(p+1)/(n+1),y=f-h/2,S=f+h/2;return c&&u?[...Le(c,y,S),...Le(u,y,S).reverse()]:[L(r,s,y),L(r,s,S),L(m,l,S),L(m,l,y)]})}function Ft(e,t,n){let i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,s=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return Math.hypot(e.x-(t.x+s*i),e.y-(t.y+s*o))}function Dt(e,t){let n=1/0;for(let i of t)if(!(i.length<2))for(let o=0,r=i.length-1;o<i.length;r=o++){let s=Ft(e,i[r],i[o]);s<n&&(n=s)}return n}function He(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,m=t[o].y;s>e.y!=m>e.y&&e.x<(l-r)*(e.y-s)/(m-s)+r&&(n=!n)}return n}function Ke(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Vt(e,t,n){let i=He(e,t)&&!n.some(r=>He(e,r)),o=Dt(e,[t,...n]);return i?o:-o}function z(e,t,n,i,o){let r=Vt({x:e,y:t},i,o);return{x:e,y:t,h:n,d:r,max:r+n*Math.SQRT2}}var he=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let i=n.length-1;for(;i>0;){let o=i-1>>1;if(n[o].max>=n[i].max)break;[n[o],n[i]]=[n[i],n[o]],i=o}}pop(){let t=this.items,n=t[0],i=t.pop();if(t.length&&i){t[0]=i;let o=0;for(;;){let r=o*2+1,s=r+1,l=o;if(r<t.length&&t[r].max>t[l].max&&(l=r),s<t.length&&t[s].max>t[l].max&&(l=s),l===o)break;[t[l],t[o]]=[t[o],t[l]],o=l}}return n}};function Ue(e){if(e.length<3)return 0;let t=0;for(let n=0,i=e.length-1;n<e.length;i=n++)t+=(e[i].x+e[n].x)*(e[i].y-e[n].y);return Math.abs(t)/2}function Io(e,t){return Math.max(0,Ue(e)-Ke(t).reduce((n,i)=>n+Ue(i),0))}function Ge(e,t){let n=Ke(t);if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let f=e.reduce((S,E)=>S+E.x,0)/e.length,y=e.reduce((S,E)=>S+E.y,0)/e.length;return{point:{x:f,y},radius:0}}let i=1/0,o=1/0,r=-1/0,s=-1/0;for(let f of e)f.x<i&&(i=f.x),f.y<o&&(o=f.y),f.x>r&&(r=f.x),f.y>s&&(s=f.y);let l=r-i,m=s-o,a=Math.min(l,m);if(!(a>0))return{point:{x:(i+r)/2,y:(o+s)/2},radius:0};let c=Math.max(l,m)/150,u=new he,h=a/2;for(let f=i;f<r;f+=a)for(let y=o;y<s;y+=a)u.push(z(f+h,y+h,h,e,n));let d=z(i+l/2,o+m/2,0,e,n),p=0;for(;u.size;){let f=u.pop();if(!f)break;f.d>d.d&&(d=f),!(f.max-d.d<=c)&&(p>=4e3||(p+=1,h=f.h/2,u.push(z(f.x-h,f.y-h,h,e,n)),u.push(z(f.x+h,f.y-h,h,e,n)),u.push(z(f.x-h,f.y+h,h,e,n)),u.push(z(f.x+h,f.y+h,h,e,n))))}return{point:{x:d.x,y:d.y},radius:Math.max(0,d.d)}}function Ht(e,t,n){return Math.max(t,Math.min(n,e))}function Co(e,t,n){return e<t?t:e>n?n:e}function Ut(e){return Ht(e,0,1)}function Xe(e){let t=Ut(e);return t*t*(3-2*t)}var W=Math.PI*2;function $(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Kt(e,t,n){let i=t-e;if(n){for(;i<0;)i+=W;for(;i>=W;)i-=W}else{for(;i>0;)i-=W;for(;i<=-W;)i+=W}return i}function To(e){return e.end}function ze(e){if(e.version!==1||e.closed!==!0||!$(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!$(n.end))return!1;if(n.kind==="line"){if(k(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!$(n.control1)||!$(n.control2)||k(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!$(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(k(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(k(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||k(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return k(t,e.start)<=1e-4}function Gt(e,t,n){let i=1-n;return{x:i**3*e.x+3*i**2*n*t.control1.x+3*i*n**2*t.control2.x+n**3*t.end.x,y:i**3*e.y+3*i**2*n*t.control1.y+3*i*n**2*t.control2.y+n**3*t.end.y}}function Oo(e,t=2){if(!ze(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),i=[{...e.start}],o=e.start;for(let r of e.segments){if(r.kind==="line")i.push({...r.end});else if(r.kind==="arc"){let s=Math.atan2(o.y-r.center.y,o.x-r.center.x),l=Math.atan2(r.end.y-r.center.y,r.end.x-r.center.x),m=Kt(s,l,r.clockwise),a=Math.max(2,Math.ceil(Math.abs(m)*r.radius/n));for(let c=1;c<=a;c+=1){let u=s+m*c/a;i.push({x:r.center.x+Math.cos(u)*r.radius,y:r.center.y+Math.sin(u)*r.radius})}}else{let s=k(o,r.control1)+k(r.control1,r.control2)+k(r.control2,r.end),l=Math.max(2,Math.ceil(s/n));for(let m=1;m<=l;m+=1)i.push(Gt(o,r,m/l))}o=r.end}return k(i[i.length-1],i[0])<=1e-4&&i.pop(),i}function We(e,t,n){return Xt(e,o=>({x:o.x+t,y:o.y+n}))}function Xt(e,t,n=1,i=!1){return{...e,start:t(e.start),segments:e.segments.map(o=>o.kind==="line"?{...o,end:t(o.end)}:o.kind==="arc"?{...o,center:t(o.center),radius:o.radius*Math.abs(n),clockwise:i?!o.clockwise:o.clockwise,end:t(o.end)}:{...o,control1:t(o.control1),control2:t(o.control2),end:t(o.end)})}}var Bt=45,me=150,Yt=60;function zt(e){let t=Bt/100;if(e<=t)return me;let n=Math.min(1,(e-t)/(1-t));return me-n*(me-Yt)}var Be=.5523;function Ye(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function Wt(e){let t=[],n=[];for(e.forEach((i,o)=>{$(i)&&(t.length&&Ye(t[t.length-1],i)||(t.push({x:i.x,y:i.y}),n.push(o)))});t.length>1&&Ye(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function Ao(e,t,n){return Jt(e,{cornerSmoothing:t,...n})}var $t=.5,qt=4/3;function Qt(e,t,n){let i=t.x-e.x,o=t.y-e.y,r=Math.hypot(i,o);if(r<=1e-9)return{kind:"line",end:{...t}};let s=-o/r,l=i/r,m=n*qt;return{kind:"bezier",control1:{x:e.x+i/3+s*m,y:e.y+o/3+l*m},control2:{x:e.x+i*2/3+s*m,y:e.y+o*2/3+l*m},end:{...t}}}function Jt(e,t){let{points:n,sourceIndex:i}=Wt(e),o=n.length;if(o<3)return null;let r=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,l=new Array(o).fill(0);if(s?.length)for(let g=0;g<o;g+=1){let M=s[i[g]];l[g]=Number.isFinite(M)?Math.min(100,Math.max(-100,M))/100:0}let m=l.some(g=>Math.abs(g)>1e-6);if(r<=0&&!m)return null;let a=t.wideAngleThresholdDeg??zt(r),c=[];for(let g=0;g<o;g+=1)c[g]=k(n[g],n[(g+1)%o]);let u=new Array(o).fill(0);for(let g=0;g<o;g+=1){let M=n[(g-1+o)%o],b=n[g],x=n[(g+1)%o],w={x:M.x-b.x,y:M.y-b.y},v={x:x.x-b.x,y:x.y-b.y},P=Math.hypot(w.x,w.y),A=Math.hypot(v.x,v.y);if(P<=1e-9||A<=1e-9)continue;let C=Math.min(1,Math.max(-1,(w.x*v.x+w.y*v.y)/(P*A))),R=Math.acos(C)*180/Math.PI;if(R<a)continue;let T=Xe((R-a)/(180-a));u[g]=r*T*.5*Math.min(P,A)}for(let g=0;g<o;g+=1){let M=(g+1)%o,b=u[g]+u[M];if(b>c[g]&&b>1e-9){let x=c[g]/b;u[g]*=x,u[M]*=x}}let h=new Array(o),d=new Array(o);for(let g=0;g<o;g+=1){let M=n[(g-1+o)%o],b=n[g],x=n[(g+1)%o];if(u[g]<=1e-6){h[g]={...b},d[g]={...b};continue}let w=k(b,M)||1,v=k(b,x)||1;h[g]={x:b.x+(M.x-b.x)/w*u[g],y:b.y+(M.y-b.y)/w*u[g]},d[g]={x:b.x+(x.x-b.x)/v*u[g],y:b.y+(x.y-b.y)/v*u[g]}}if(u.every(g=>g<=1e-6)&&!m)return null;let p=[],f={...d[0]},y=f,S=(g,M)=>{if(k(y,g)<=1e-9)return;let b=l[M];Math.abs(b)>1e-6?p.push(Qt(y,g,b*$t*c[M])):p.push({kind:"line",end:{...g}}),y=g};for(let g=1;g<=o;g+=1){let M=g%o,b=n[M];S(h[M],(g-1)%o),u[M]>1e-6&&k(h[M],d[M])>1e-9&&(p.push({kind:"bezier",control1:L(h[M],b,Be),control2:L(d[M],b,Be),end:{...d[M]}}),y=d[M])}if(!p.length)return null;let E=p[p.length-1];k(E.end,f)>1e-9&&(E.kind==="line"?E.end={...f}:p.push({kind:"line",end:{...f}}));let I={version:1,closed:!0,start:f,segments:p};return ze(I)?I:null}function No(e){let t=[],n=e.start;for(let o of e.segments)t.push(n),n=o.end;let i=[];for(let o=e.segments.length-1;o>=0;o-=1){let r=e.segments[o],s=t[o];r.kind==="line"?i.push({kind:"line",end:{...s}}):r.kind==="arc"?i.push({kind:"arc",center:{...r.center},radius:r.radius,clockwise:!r.clockwise,end:{...s}}):i.push({kind:"bezier",control1:{...r.control2},control2:{...r.control1},end:{...s}})}return{version:1,closed:!0,start:{...e.start},segments:i}}function Lo(e,t,n){let i=[];for(let o=0;o<e.length-1;o+=1){let r=e[o],s=e[o+1],l=Math.hypot(s.x-r.x,s.y-r.y);if(l<=0)continue;let m=Math.max(1,Math.round(l/n)),a=l/m,c=Math.atan2(s.y-r.y,s.x-r.x),u=o===0,d=(o>0?t[o-1]:void 0)==="break"?2:1,p=u?{...r}:{x:r.x+Math.cos(c)*a*d,y:r.y+Math.sin(c)*a*d},f=u?m+1:Math.max(1,m-(d-1));i.push({origin:p,rotation:c*180/Math.PI,seatCount:f,seatSpacing:a})}return i}function Fo(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(i,o)=>({x:e.origin.x+n.x*o*e.seatSpacing,y:e.origin.y+n.y*o*e.seatSpacing}))}function Do(e){return e.reduce((t,n)=>t+n.seatCount,0)}function $e(e){let t=new Map,n=new Map;for(let i of e){if(i.type!=="row"||!i.segmentedRow)continue;let o=n.get(i.segmentedRow.groupId)??[];o.push(i),n.set(i.segmentedRow.groupId,o)}for(let[i,o]of n){let r=o.slice().sort((h,d)=>h.segmentedRow.componentIndex-d.segmentedRow.componentIndex),s=r[0]?.segmentedRow?.componentCount??0,l=r[0]?.segmentedRow;if(!l||!(s>=2&&r.length===s&&l?.boundaryBefore==="start"&&r.every((h,d)=>h.segmentedRow?.kind==="segmented-row-v1"&&h.segmentedRow.groupId===i&&h.segmentedRow.componentCount===s&&h.segmentedRow.componentIndex===d&&h.segmentedRow.repeatLabelOnComponents===l.repeatLabelOnComponents&&(d===0?h.segmentedRow.boundaryBefore==="start":h.segmentedRow.boundaryBefore!=="start")&&h.segmentedRow.displayLabel===l.displayLabel)))continue;let a=r.reduce((h,d)=>h+d.seatCount,0),c=0,u=0;for(let h of r)h.segmentedRow.boundaryBefore==="break"&&(c+=1),t.set(h.id,{groupId:i,adjacencyOffset:c,displayOffset:u,displayLabel:l.displayLabel,totalSeats:a,canonical:r[0],viewFromSeatUrl:l.viewFromSeatUrl,viewFromSeatMeta:l.viewFromSeatMeta,confidenceEvidence:l.confidenceEvidence}),c+=h.seatCount,u+=h.seatCount}return t}var q=.02291666666666667,Ho=1/q,Zt=58,en=Zt*q,qe=0,Je=3,Qe=0,pe=120,tn=0,nn=45,on=7,Q=1.2;function be(e,t,n,i){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):i}function Uo(e){return Number.isFinite(e)?Math.max(qe,Math.min(Je,Math.round(e))):qe}function rn(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=on?e:Je}function Ze(e,t={}){let n=be(t.floorBaseHeightM,Qe,pe,0),i=Math.min(pe,n+rn(e.elevation)*en),o=e.height===void 0?i:be(e.height,Qe,pe,i),r=be(e.rake,tn,nn,0);return{height:o,rake:r}}function et(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 tt(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 i=1/0;for(let o=0;o+1<e.length;o++){let r=e[o],s=e[o+1],l=s.x-r.x,m=s.y-r.y,a=l*l+m*m,c=a>1e-12?((t-r.x)*l+(n-r.y)*m)/a:0;c<0?c=0:c>1&&(c=1);let u=t-(r.x+c*l),h=n-(r.y+c*m);if(Math.abs(u)>=i||Math.abs(h)>=i)continue;let d=Math.hypot(u,h);d<i&&(i=d)}return i}function sn(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let i=e.length||1;t/=i,n/=i;let o=0;for(let r of e){let s=Math.hypot(r.x-t,r.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function nt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function ye(e,t){let n=1/0;for(let i of et(e)){let o=tt(t,i.x,i.y);o<n&&(n=o)}for(let i of et(t)){let o=tt(e,i.x,i.y);o<n&&(n=o)}return n}function an(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,i=0;for(let c of e)n+=c.x,i+=c.y;n/=e.length,i/=e.length;let o=-1,r=e[0];for(let c of e){let u=Math.hypot(c.x-n,c.y-i);u>o&&(o=u,r=c)}let s=r.x-n,l=r.y-i,m=Math.hypot(s,l);m>1e-9?(s/=m,l/=m):(s=1,l=0);let a=e.map((c,u)=>({p:c,i:u,t:(c.x-n)*s+(c.y-i)*l})).sort((c,u)=>c.t-u.t);return{pts:a.map(c=>c.p),seatIndices:a.map(c=>t[c.i])}}function cn(e){let t=e.length;if(t<3)return null;let n=0,i=0;for(let E of e)n+=E.x,i+=E.y;n/=t,i/=t;let o=0,r=0,s=0,l=0,m=0,a=0,c=0;for(let E of e){let I=E.x-n,g=E.y-i;o+=I*I,s+=g*g,r+=I*g,l+=I*I*I,m+=g*g*g,a+=I*g*g,c+=g*I*I}let u=o*s-r*r;if(Math.abs(u)<1e-9)return null;let h=(l+a)/2,d=(m+c)/2,p=(h*s-d*r)/u,f=(d*o-h*r)/u,y=p+n,S=f+i;return!Number.isFinite(y)||!Number.isFinite(S)?null:{cx:y,cy:S}}var ln=.15;function un(e){if(e.length<2)return null;let t=e.map(E=>{let I=0,g=0;for(let M of E.pts)I+=M.x,g+=M.y;return{x:I/E.pts.length,y:g/E.pts.length}}),n=0,i=0;for(let E of t)n+=E.x,i+=E.y;n/=t.length,i/=t.length;let o=0,r=0,s=0;for(let E of t){let I=E.x-n,g=E.y-i;o+=I*I,r+=I*g,s+=g*g}let l=o+s,m=o*s-r*r,a=l/2+Math.sqrt(Math.max(0,l*l/4-m)),c,u;Math.abs(r)>1e-12?(c=a-s,u=r):o>=s?(c=1,u=0):(c=0,u=1);let h=Math.hypot(c,u);if(!(h>1e-12))return null;c/=h,u/=h;let d=1/0,p=-1/0,f=[];for(let E of e){let I=1/0,g=-1/0;for(let M of E.pts){let b=M.x*c+M.y*u;b<I&&(I=b),b>g&&(g=b),b<d&&(d=b),b>p&&(p=b)}f.push(g-I)}let y=p-d;return y>1e-9?(f.sort((E,I)=>E-I),f[Math.min(f.length-1,Math.floor(f.length*.9))]/y<=dn?{x:c,y:u}:null):null}var dn=.35;function ot(e,t,n,i){let o=new Map;for(let b of n){let x=t[b],w=x.rowId||`__seat-${b}`,v=o.get(w);v||(v={pts:[],idx:[]},o.set(w,v)),v.pts.push({x:x.x,y:x.y}),v.idx.push(b)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[b,x]of o){let w=an(x.pts,x.idx),v=0;for(let P of w.pts)v+=Math.hypot(P.x-i.x,P.y-i.y);r.push({id:b,pts:w.pts,seatIndices:w.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:v/w.pts.length})}let s=r.map(b=>sn(b.pts)),l=r.length<=256?r.length*(r.length-1)/2:0,m=l?new Float64Array(l):null;m?.fill(Number.NaN);let a=m?new Map(r.map((b,x)=>[b,x])):null,c=(b,x)=>(b>x&&([b,x]=[x,b]),b*(2*r.length-b-1)/2+(x-b-1)),u=(b,x)=>{if(!m)return ye(r[b].pts,r[x].pts);let w=c(b,x),v=m[w];if(!Number.isNaN(v))return v;let P=ye(r[b].pts,r[x].pts);return m[w]=P,P},h=(b,x)=>a?u(a.get(b),a.get(x)):ye(b.pts,x.pts),d=[];for(let b=0;b<r.length;b++){let x=1/0;for(let w=0;w<r.length;w++){if(b===w||nt(s[b],s[w])>=x)continue;let v=u(b,w);v<x&&(x=v)}Number.isFinite(x)&&d.push(x)}d.sort((b,x)=>b-x);let p=d.length?d[Math.floor(d.length/2)]:1,f=Math.max(p*1.8,1e-6),y=r.map(()=>[]);for(let b=0;b<r.length;b++)for(let x=b+1;x<r.length;x++)nt(s[b],s[x])>f||u(b,x)<=f&&(y[b].push(x),y[x].push(b));let S=0;for(let b=0;b<r.length;b++){if(r[b].blockId!==-1)continue;let x=S++,w=[b];for(r[b].blockId=x;w.length;){let v=w.pop();for(let P of y[v])r[P].blockId===-1&&(r[P].blockId=x,w.push(P))}}let E=new Map;for(let b of r){let x=E.get(b.blockId)??[];x.push(b),E.set(b.blockId,x)}let I=[];for(let b of r){if(b.pts.length<4)continue;let x=cn(b.pts);x&&(!Number.isFinite(x.cx)||!Number.isFinite(x.cy)||I.push({x:x.cx,y:x.cy}))}let g=I.length>=2?(()=>{let b=I.map(v=>v.x).sort((v,P)=>v-P),x=I.map(v=>v.y).sort((v,P)=>v-P),w=Math.floor(I.length/2);return{cx:b[w],cy:x[w]}})():null;if(g){let b=C=>Math.hypot(C.x-g.cx,C.y-g.cy),x=1/0,w=-1/0,v=[];for(let C of r){let R=1/0,T=-1/0;for(let N of C.pts){let O=b(N);O<R&&(R=O),O>T&&(T=O)}v.push(T-R),R<x&&(x=R),T>w&&(w=T)}let P=w-x;v.sort((C,R)=>C-R);let A=v[Math.min(v.length-1,Math.floor(v.length*.9))];if(P>1e-9&&A/P<=ln){let C=r.map(_=>{let ne=0;for(let xt of _.pts)ne+=b(xt);return{row:_,radius:ne/_.pts.length}}),R=0,T=0;for(let _ of C)R+=_.radius,T+=_.row.focalDistance;R/=C.length,T/=C.length;let N=0;for(let _ of C)N+=(_.radius-R)*(_.row.focalDistance-T);if(N<0)for(let _ of C)_.radius=-_.radius;let j=1/0;for(let _ of C)_.radius<j&&(j=_.radius);C.sort((_,ne)=>_.radius-ne.radius);let V=-1,B=-1/0,gt=P/Math.max(1,C.length)*.5,Ee=[];for(let _ of C)_.radius-B>gt&&(V++,B=_.radius),_.row.ordinal=V,_.row.blockDepth=_.radius-j,Ee.push(_.row);return{sectionId:e,rows:Ee,blockCount:S}}}let M=[];for(let[,b]of E){let x=un(b);if(x){let w=P=>{let A=0;for(let C of P.pts)A+=C.x*x.x+C.y*x.y;return A/P.pts.length};b.sort((P,A)=>w(P)-w(A)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let v=0;for(let P=0;P<b.length;P++)P>0&&(v+=h(b[P-1],b[P])),b[P].ordinal=P,b[P].blockDepth=v,M.push(b[P])}else{let w=1/0;for(let v of b)v.focalDistance<w&&(w=v.focalDistance);b.sort((v,P)=>v.focalDistance-P.focalDistance);for(let v=0;v<b.length;v++)b[v].ordinal=v,b[v].blockDepth=Math.max(0,b[v].focalDistance-w),M.push(b[v])}}return{sectionId:e,rows:M,blockCount:S}}var Xo=[{key:"rect",label:"Flat stage",blurb:"Classic proscenium box."},{key:"rounded",label:"Rounded",blurb:"Softened corners."},{key:"arc",label:"Curved front",blurb:"Front edge bows toward the audience."},{key:"thrust",label:"Thrust (T)",blurb:"Central tongue projects into the crowd."},{key:"runway",label:"Runway",blurb:"Long catwalk into the audience."},{key:"round",label:"In the round",blurb:"Central platform, audience all around."},{key:"pitch-football",label:"Football pitch",blurb:"105 \xD7 68 m pitch with centre circle and penalty boxes."},{key:"rink-hockey",label:"Hockey rink",blurb:"60 \xD7 30 m ice rink with blue lines and faceoff circles."},{key:"track-athletics",label:"Athletics track",blurb:"400 m track: two straights, two semicircles, eight lanes."},{key:"oval-cricket",label:"Cricket oval",blurb:"~150 \xD7 140 m oval with boundary rope and pitch strip."},{key:"pitch-rugby",label:"Rugby pitch",blurb:"100 \xD7 70 m field of play with in-goal areas, 22 m and 10 m lines."},{key:"diamond-baseball",label:"Baseball field",blurb:"Diamond, infield, mound and foul lines out to 99 m poles."},{key:"court-basketball",label:"Basketball court",blurb:"28 \xD7 15 m court with keys and three-point lines."},{key:"court-tennis",label:"Tennis court",blurb:"23.77 \xD7 10.97 m doubles court with run-off and net."},{key:"ring-boxing",label:"Boxing ring",blurb:"Raised ring, 6.1 m inside the ropes, coloured corners."}],fn=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),hn=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function mn(e){return!!e&&fn.has(e)}function Bo(e){return!!e&&hn.has(e)}var it=1.1,pn={"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},bn={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};var rt=Math.PI*2;function st(e,t,n,i,o,r){return{x:o+e*n-t*i,y:r+e*i+t*n}}function Yo(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),m=Math.sin(s),a=o/2,c=r/2,u=[],h=(d,p)=>{u.push({x:d,y:p})};switch(t){case"rect":{h(-a,-c),h(a,-c),h(a,c),h(-a,c);break}case"rounded":{let d=Math.min(o,r)*.18,p=5,f=(y,S,E)=>{for(let I=0;I<=p;I++){let g=E+I/p*(Math.PI/2);h(y+d*Math.cos(g),S+d*Math.sin(g))}};f(a-d,-c+d,-Math.PI/2),f(a-d,c-d,0),f(-a+d,c-d,Math.PI/2),f(-a+d,-c+d,Math.PI);break}case"arc":{let d=r*.45;h(-a,-c),h(a,-c);let p=24;for(let f=0;f<=p;f++){let y=f/p,S=a-y*o,E=c+d*(1-Math.pow(2*S/o,2));h(S,E)}break}case"thrust":{let d=o*.18,p=r*1.1;h(-a,-c),h(a,-c),h(a,c),h(d,c),h(d,c+p),h(-d,c+p),h(-d,c),h(-a,c);break}case"runway":{let d=o*.1,p=r*3;h(-a,-c),h(a,-c),h(a,c),h(d,c),h(d,c+p),h(-d,c+p),h(-d,c),h(-a,c);break}case"round":case"oval-cricket":{for(let p=0;p<40;p++){let f=p/40*rt;h(a*Math.cos(f),c*Math.sin(f))}break}case"pitch-football":case"pitch-rugby":case"court-basketball":case"court-tennis":case"ring-boxing":{h(-a,-c),h(a,-c),h(a,c),h(-a,c);break}case"diamond-baseball":{for(let d of gn(a,c))h(d.x,d.y);break}case"rink-hockey":{for(let d of yn(a,c,a*(8.5/60),c*(8.5/30)))h(d.x,d.y);break}case"track-athletics":{for(let d of ge(a,c))h(d.x,d.y);break}}return u.map(d=>st(d.x,d.y,l,m,n,i))}function yn(e,t,n,i){let o=[],s=(l,m,a)=>{for(let c=0;c<=8;c++){let u=a+c/8*(Math.PI/2);o.push({x:l+n*Math.cos(u),y:m+i*Math.sin(u)})}};return s(e-n,-t+i,-Math.PI/2),s(e-n,t-i,0),s(-e+n,t-i,Math.PI/2),s(-e+n,-t+i,Math.PI),o}function ge(e,t){let n=Math.max(0,e-t),i=[],o=20;for(let r=0;r<=o;r++){let s=-Math.PI/2+r/o*Math.PI;i.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let r=0;r<=o;r++){let s=Math.PI/2+r/o*Math.PI;i.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return i}var X=(()=>{let t={x:0,y:52},n=25,i={x:70,y:t.y-70},o=(i.x*i.x+i.y*i.y-4900)/(2*(i.y+70)),r=o+70,s=[],l=Math.atan2(i.y-o,i.x),m=Math.atan2(i.y-o,-i.x);for(let a=0;a<=24;a++){let c=l+(m-l)*a/24;s.push({x:r*Math.cos(c),y:o+r*Math.sin(c)})}return{half:70,home:t,backstop:n,fence:s}})();function gn(e,t){let n=e/X.half,i=t/X.half;return[{x:-X.backstop*n,y:t},{x:X.backstop*n,y:t},...X.fence.map(o=>({x:o.x*n,y:o.y*i}))]}var xn="#f1f5f9";function xe(e){return mn(e)}function G(e,t,n,i,o=32){let r=[];for(let s=0;s<o;s++){let l=s/o*rt;r.push({x:e+n*Math.cos(l),y:t+i*Math.sin(l)})}return r}function U(e,t,n,i){return[{x:e-n,y:t-i},{x:e+n,y:t-i},{x:e+n,y:t+i},{x:e-n,y:t+i}]}function Mn(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),m=Math.sin(s),a=o/2,c=r/2,u=[],h=pn[t],d=f=>h?f/h.width*o:0,p=f=>h?f/h.height*r:0;switch(t){case"pitch-football":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1}),u.push({points:G(0,0,d(9.15),p(9.15)),closed:!0});for(let f of[-1,1])u.push({points:U(f*(a-d(16.5)/2),0,d(16.5)/2,p(40.32)/2),closed:!0}),u.push({points:U(f*(a-d(5.5)/2),0,d(5.5)/2,p(18.32)/2),closed:!0});break}case"rink-hockey":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1,ink:"#d63b3b"});for(let f of[-1,1]){u.push({points:[{x:f*d(7.5),y:-c},{x:f*d(7.5),y:c}],closed:!1,ink:"#2f6ecb"}),u.push({points:[{x:f*(a-d(4)),y:-p(11)},{x:f*(a-d(4)),y:p(11)}],closed:!1,ink:"#d63b3b"});for(let y of[-1,1])u.push({points:G(f*d(20.5),y*p(7),d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"})}u.push({points:G(0,0,d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let y=c-p(1.22)*8;y>0&&u.push({points:ge(a-d(1.22)*8,y),closed:!0,fill:"#2f7d4f"});for(let S=1;S<8;S++){let E=p(1.22)*S,I=c-E;if(I<=0)break;u.push({points:ge(a-d(1.22)*S,I),closed:!0})}break}case"oval-cricket":{u.push({points:G(0,0,d(27.4),p(27.4+20.12/2),40),closed:!0}),u.push({points:U(0,0,d(3.05)/2,p(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let f=y=>({points:[{x:d(y),y:-c},{x:d(y),y:c}],closed:!1});u.push(f(0));for(let y of[-1,1]){u.push(f(y*50),f(y*28));for(let S=-35;S<35;S+=4)u.push({points:[{x:d(y*10),y:p(S)},{x:d(y*10),y:p(Math.min(35,S+2))}],closed:!1})}break}case"diamond-baseball":{let f=(O,j)=>({x:d(O),y:p(j)}),{home:y}=X,S=27.43,E=S/Math.SQRT2,I={x:y.x+E,y:y.y-E},g={x:y.x,y:y.y-2*E},M={x:y.x-E,y:y.y-E},b={x:y.x,y:y.y-18.44},x="#b98a59",w=bn["diamond-baseball"],v=38.94,P=[f(y.x,y.y)],A=Math.atan2(y.y-v/Math.SQRT2-b.y,v/Math.SQRT2),C=Math.PI-A;for(let O=0;O<=16;O++){let j=A-(A+Math.PI*2-C)%(Math.PI*2)*(O/16);P.push(f(b.x+29*Math.cos(j),b.y+29*Math.sin(j)))}u.push({points:P,closed:!0,fill:x,ink:x});let R={x:y.x,y:y.y-E},T=[{x:y.x,y:y.y},I,g,M].map(O=>f(R.x+(O.x-R.x)*.84,R.y+(O.y-R.y)*.84));u.push({points:T,closed:!0,fill:w,ink:w}),u.push({points:G(d(b.x),p(b.y),d(2.74),p(2.74),20),closed:!0,fill:x,ink:x}),u.push({points:G(d(y.x),p(y.y),d(3.96),p(3.96),20),closed:!0,fill:x,ink:x});let N=X.fence;u.push({points:[f(y.x,y.y),f(N[0].x,N[0].y)],closed:!1}),u.push({points:[f(y.x,y.y),f(N[N.length-1].x,N[N.length-1].y)],closed:!1});for(let O of[I,g,M])u.push({points:U(d(O.x),p(O.y),d(.3),p(.3)),closed:!0,fill:xn});break}case"court-basketball":{u.push({points:U(0,0,d(14),p(7.5)),closed:!0}),u.push({points:[{x:0,y:-p(7.5)},{x:0,y:p(7.5)}],closed:!1}),u.push({points:G(0,0,d(1.8),p(1.8),24),closed:!0});for(let f of[-1,1]){let y=f*14,S=f*(14-5.8),E=f*(14-1.575);u.push({points:U(d((y+S)/2),0,d(2.9),p(2.45)),closed:!0,fill:"#2f5d8a"}),u.push({points:G(d(S),0,d(1.8),p(1.8),24),closed:!0});let I=Math.sqrt(6.75*6.75-6.6*6.6),g=[{x:d(y),y:-p(6.6)}],M=Math.atan2(-6.6,-f*I),b=2*Math.atan2(6.6,I);for(let x=0;x<=16;x++){let w=M-f*b*(x/16);g.push({x:d(E+6.75*Math.cos(w)),y:p(6.75*Math.sin(w))})}g.push({x:d(y),y:p(6.6)}),u.push({points:g,closed:!1})}break}case"court-tennis":{u.push({points:U(0,0,d(11.885),p(5.485)),closed:!0,fill:"#2b5f99"});for(let f of[-1,1])u.push({points:[{x:-d(11.885),y:f*p(4.115)},{x:d(11.885),y:f*p(4.115)}],closed:!1}),u.push({points:[{x:f*d(6.4),y:-p(4.115)},{x:f*d(6.4),y:p(4.115)}],closed:!1});u.push({points:[{x:-d(6.4),y:0},{x:d(6.4),y:0}],closed:!1}),u.push({points:[{x:0,y:-p(6.4)},{x:0,y:p(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{u.push({points:U(0,0,d(3.05),p(3.05)),closed:!0});let S=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[E,I,g]of S)u.push({points:U(E*d(3.05),I*p(3.05),d(.3),p(.3)),closed:!0,fill:g,ink:g});break}default:return[]}return u.map(f=>({...f,points:f.points.map(y=>st(y.x,y.y,l,m,n,i))}))}function zo(e){if(e.role!=="stage"||!xe(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(c=>c.x),i=e.points.map(c=>c.y),o=Math.min(...n),r=Math.max(...n),s=Math.min(...i),l=Math.max(...i),m=Math.max(1,r-o),a=Math.max(1,l-s);t={cx:o+m/2,cy:s+a/2,width:m,height:a}}return t?Mn({kind:e.stageKind,...t}):[]}function Sn(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,i=e.width,o=e.height;return[{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+o},{x:t,y:n+o}]}function vn(e,t,n){let i=n*Math.PI/180,o=Math.cos(i),r=Math.sin(i),s=e.x-t.x,l=e.y-t.y;return{x:t.x+s*o-l*r,y:t.y+s*r+l*o}}function at(e){let t=Sn(e);if(!t||t.length<2)return null;let n=e.rotation??0,i=Math.abs(n)<1e-6?t:t.map(m=>vn(m,{x:t.reduce((a,c)=>a+c.x,0)/t.length,y:t.reduce((a,c)=>a+c.y,0)/t.length},n)),o=1/0,r=1/0,s=-1/0,l=-1/0;for(let m of i)o=Math.min(o,m.x),r=Math.min(r,m.y),s=Math.max(s,m.x),l=Math.max(l,m.y);return!Number.isFinite(o)||s-o<1e-6||l-r<1e-6?null:{minX:o,minY:r,maxX:s,maxY:l}}var wn=5,En=3,In=.92,Pn=1.9,Cn=2,_n=.6,kn=1,Rn=.06;function Tn(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?it:xe(e.stageKind)?Rn:kn}function ct(e){let t=1/0,n=1/0,i=-1/0,o=-1/0,r=-1/0;for(let s of Me(e)){let l=s.baseHeightM??0;for(let m of s.objects){if(m.type!=="shape"||m.role!=="stage")continue;let a=at(m);a&&(t=Math.min(t,a.minX),n=Math.min(n,a.minY),i=Math.max(i,a.maxX),o=Math.max(o,a.maxY),r=Math.max(r,l+Tn(m)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:i,maxY:o,deckTopM:r}}function On(e,t,n,i){let o=1/0,r=1/0,s=-1/0,l=-1/0;for(let d of e)Number.isFinite(d.eyeHeightM)&&(o=Math.min(o,d.x),s=Math.max(s,d.x),r=Math.min(r,d.y),l=Math.max(l,d.y));if(!Number.isFinite(o))return null;let m=o*t,a=r*t,c=Math.max(1,Math.ceil((s-o)*t/n)+1),u=Math.max(1,Math.ceil((l-r)*t/n)+1),h=new Float64Array(c*u).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let p=d.eyeHeightM-Q,f=Math.min(c-1,Math.max(0,Math.floor((d.x*t-m)/n))),S=Math.min(u-1,Math.max(0,Math.floor((d.y*t-a)/n)))*c+f,E=p+i;E>h[S]&&(h[S]=E)}return{cellM:n,minX:m,minY:a,cols:c,rows:u,top:h}}function An(e,t,n){let i=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return i<0||o<0||i>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+i]}function lt(e,t,n={}){let i=new Map;if(!t||!e.length)return i;let o=n.metresPerChartUnit??q,r=n.cellM??_n,s=n.chairBackM??In,l=n.selfRowSkipM??Cn,m=n.clearThreshold??.9,a=n.partialThreshold??.25,c=Math.max(1,n.columns??wn),u=Math.max(1,n.rows??En),h=On(e,o,r,s);if(!h)return i;let d=(t.maxX-t.minX)*o,p=(t.maxY-t.minY)*o,f=d>=p,y=(t.minX+t.maxX)/2*o,S=(t.minY+t.maxY)/2*o,E=[];for(let g=0;g<c;g++){let M=(g+.5)/c-.5,b=f?y+M*d:y,x=f?S:S+M*p;for(let w=0;w<u;w++){let v=t.deckTopM+(u===1?0:w/(u-1)*Pn);E.push({x:b,y:x,z:v})}}let I=r/2;for(let g of e){if(!Number.isFinite(g.eyeHeightM))continue;let M=g.x*o,b=g.y*o,x=g.eyeHeightM,w=0,v=1/0;for(let A of E){let C=A.x-M,R=A.y-b,T=Math.hypot(C,R);if(!(T>l)){w++;continue}let N=C/T,O=R/T,j=0;for(let V=l;V<T;V+=I){let B=An(h,M+N*V,b+O*V);if(!(!Number.isFinite(B)||B>=x)&&B>x+(A.z-x)*V/T){j=V;break}}j?v=Math.min(v,j):w++}let P=w/E.length;P>=m||i.set(g.id,{seatId:g.id,mark:P<a?"obstructedView":"restrictedView",visibleFraction:P,totalRays:E.length,atDistanceM:Number.isFinite(v)?v:0})}return i}function ut(e,t){if(!t.size)return 0;let n=0;for(let i of e){let o=t.get(i.id);if(!o)continue;let r=i.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(i.commercial={...r,[o.mark]:!0},n++)}return n}function Se(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var se=Math.PI/180,Nn=9,J=16;function ve(e,t,n,i){let o=n*se,r=Math.cos(o),s=Math.sin(o);return{x:i.x+e*r-t*s,y:i.y+e*s+t*r}}function we(e){let{seatCount:t,seatSpacing:n,curve:i,rotation:o,origin:r}=e,s=[];if(e.path)return Fe(e.path,t);if(t<=1)return t===1&&s.push({x:r.x,y:r.y}),s;if(i===0){for(let a=0;a<t;a++)s.push(ve(a*n,0,o,r));return s}let l=i/(t-1)*se,m=n/(2*Math.sin(Math.abs(l)/2));for(let a=0;a<t;a++){let c=a*l,u=m*Math.sin(c),h=-m+m*Math.cos(c);s.push(ve(u,h,o,r))}return s}function pt(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function pi(e){let t=new Set((e.overrides??[]).filter(n=>n.skip&&Number.isInteger(n.index)&&n.index>=0&&n.index<e.seatCount).map(n=>n.index));return Math.max(0,e.seatCount-t.size)}function jn(e,t){let n=pt(e);return we(e).map((i,o)=>{let r=n.get(o),s=Se(r),l=Ie(e,o,r),m={...e.commercial,...r?.commercial};return{index:o,x:i.x+(r?.dx??0),y:i.y+(r?.dy??0),label:l,displayLabel:ce(e,o,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(m).some(a=>a!==void 0&&a!==!1&&a!=="")?m:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function Ln(e){let t=[];for(let n of jn(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 Fn(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),i={top:0,bottom:0,left:0,right:0};if(!n.length)return i;let o=Math.max(0,Math.round(e.seatCount));for(let r=0;r<o;r++)i[n[r%n.length]]+=1;return i}function bt(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let i=new Map((e.overrides??[]).map(c=>[c.index,c])),o=(c,u,h,d)=>{let p=i.get(c),f=Se(p),y=p?.label??`${e.label}-${c+1}`,S=e.displayLabel??e.label;return{index:c,label:y,displayLabel:p?.displayLabel??`${S}-${c+1}`,x:u+(p?.dx??0),y:h+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:f.length>0,accessibility:f,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...d?{side:d}:{}}};if(e.shape==="round"){let c=(e.radius??40)+J,u=e.rotation*se,h=Math.max(0,Math.min(360,e.seatArc??360));if(h>=360||n===1){for(let y=0;y<n;y++){let S=u+y/n*2*Math.PI;t.push(o(y,e.center.x+c*Math.cos(S),e.center.y+c*Math.sin(S)))}return t}let d=h*se,p=(2*Math.PI-d)/2,f=u+p;for(let y=0;y<n;y++){let S=f+y/(n-1)*d;t.push(o(y,e.center.x+c*Math.cos(S),e.center.y+c*Math.sin(S)))}return t}let r=e.width??80,s=e.height??50,l=Fn(e),m=["top","bottom","left","right"],a=0;for(let c of m){let u=l[c];for(let h=0;h<u;h++){let d,p;c==="top"?(d=-r/2+(h+.5)*r/u,p=-s/2-J):c==="bottom"?(d=-r/2+(h+.5)*r/u,p=s/2+J):c==="left"?(d=-r/2-J,p=-s/2+(h+.5)*s/u):(d=r/2+J,p=-s/2+(h+.5)*s/u);let f=ve(d,p,e.rotation,e.center);t.push(o(a++,f.x,f.y,c))}}return t}function bi(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):bt(e).filter(t=>!t.skipped).length}function Dn(e){return bt(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 Vn(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 dt(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,m=t[o].y;s>e.y!=m>e.y&&e.x<(l-r)*(e.y-s)/(m-s)+r&&(n=!n)}return n}function Hn(e,t){return t.some((n,i)=>{let o=t[(i+1)%t.length],r=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(r)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),l=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=l+1e-7})}function te(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function ae(e,t,n){return dt(e,t)&&!te(n).some(i=>dt(e,i)||Hn(e,i))}function yi(e,t){return Ge(e,t).point}function re(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;return{x:t/e.length,y:n/e.length}}function yt(e){switch(e.type){case"row":{let t=we(e),n=pt(e),i=0,o=0,r=0;for(let s=0;s<t.length;s++){let l=n.get(s);l?.skip||(i+=t[s].x+(l?.dx??0),o+=t[s].y+(l?.dy??0),r++)}return r?{x:i/r,y:o/r}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return re(e.points);case"section":return re(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?re(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 ft(e,t){return e.length===t.length&&e.every((n,i)=>n.x===t[i].x&&n.y===t[i].y)}function Un(e,t){if(e.type!=="gaArea"||!ft(e.points,t.outline))return!1;let n=te(e.holes),i=te(t.holes);return n.length===i.length&&n.every((o,r)=>ft(o,i[r]))}function Kn(e,t,n=e.filter(o=>o.type==="section"),i=yt(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(Un(t,s)||ae(i,s.outline,s.holes))):void 0)??n.find(s=>ae(i,s.outline,s.holes))}function Me(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function gi(e,t){let n=Me(e);return(t?n.find(i=>i.id===t):n[0])?.objects??[]}function Gn(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function Xn(e,t,n){let i=r=>({x:r.x+t,y:r.y+n}),o=r=>r.map(i);switch(e.type){case"row":return{...e,origin:i(e.origin)};case"table":case"booth":return{...e,center:i(e.center)};case"gaArea":return{...e,points:o(e.points),...e.holes?{holes:te(e.holes).map(o)}:{}};case"section":return{...e,outline:o(e.outline),...e.outlinePath?{outlinePath:We(e.outlinePath,t,n)}:{},...e.holes?{holes:te(e.holes).map(o)}:{}};case"text":return{...e,position:i(e.position)};case"shape":return{...e,...e.points?{points:o(e.points)}:{},...e.x!=null?{x:e.x+t}:{},...e.y!=null?{y:e.y+n}:{}};case"decorImage":return{...e,x:e.x+t,y:e.y+n}}}function xi(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((i,o)=>{let r=-o*t;for(let s of i.objects)n.push(r===0?s:Xn(s,0,r))}),{...e,objects:n,floors:void 0}}function ht(e,t,n,i,o,r,s,l,m){let a=[],c=e.filter(f=>f.type==="section"),u=$e(e),h=f=>!f?.eventConfigurationId||f.eventConfigurationId===i&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===m),d=f=>Pe(f,{activeConfigurationId:i,activeConfigurationVersion:m,activeBasisSha256:o,now:l}),p=(f,y)=>d(f)?{...f,coverage:y}:void 0;for(let f of e){let y=[];if(f.type==="row"?y=Ln(f):f.type==="table"?y=Dn(f):f.type==="booth"&&(y=Vn(f)),!y.length)continue;for(let M of y)M.viewUrl&&!h(M.viewMeta)&&(M.viewUrl=void 0,M.viewMeta=void 0);if(f.type==="row"){let M=u.get(f.id);if(M){let b=new Map((f.overrides??[]).map(x=>[x.index,x]));for(let x of y){let w=Number(x.id.slice(x.id.lastIndexOf(":")+1));if(!Number.isInteger(w))continue;x.logicalRowId=M.groupId,x.logicalSeatIndex=M.adjacencyOffset+w,b.get(w)?.displayLabel||(x.displayLabel=ce(f,w,M)),!x.viewUrl&&M.viewFromSeatUrl&&h(M.viewFromSeatMeta)&&(x.viewUrl=M.viewFromSeatUrl,x.viewMeta=M.viewFromSeatMeta);let v=b.get(w)?.confidenceEvidence;x.confidenceEvidence=p(v,"exact-seat")??p(f.confidenceEvidence,"row-representative")??p(M.confidenceEvidence,"row-representative")}}}let S=Kn(e,f,c,f.type==="row"?re(y):yt(f)),E=S?.viewFromSeatUrl,g=(S?.zone?t?.find(M=>M.id===S.zone):void 0)?.focalPoint??n;for(let M of y){if(!M.confidenceEvidence){let b=Number(M.id.slice(M.id.lastIndexOf(":")+1)),x=(f.type==="row"||f.type==="table")&&Number.isInteger(b)?f.overrides?.find(w=>w.index===b)?.confidenceEvidence:void 0;M.confidenceEvidence=p(x,"exact-seat")??(f.type==="row"?p(f.confidenceEvidence,"row-representative"):void 0)}M.confidenceEvidence??=p(S?.confidenceEvidence,"section-representative")??(s?p(s.evidence,s.coverage):void 0),!M.viewUrl&&E&&h(S?.viewFromSeatMeta)&&(M.viewUrl=E,M.viewMeta=S?.viewFromSeatMeta),!M.viewUrl&&r&&h(r.meta)&&(M.viewUrl=r.url,M.viewMeta=r.meta),S&&(M.sectionId=S.logicalSectionId??S.id),S?.zone&&(M.zoneId=S.zone),g&&(M.focalPoint={...g})}a.push(...y)}return a}function Mi(e,t={}){if(e.floors?.length){let i=[];for(let o of e.floors){let r=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,l=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,m=ht(o.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,s,l,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&mt(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,m);for(let a of m)a.floorId=o.id;for(let a of m)i.push(a)}return i}let n=ht(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&&mt(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Bn(e,n,t)}function Bn(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||ut(t,lt(t,ct(e))),t}function mt(e,t,n,i){let o=e.filter(u=>u.type==="section"),r=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!r||!t){for(let u of i)u.eyeHeightM=n+Q;return}let s=new Array(i.length),l=new Map;for(let u of o)l.has(u.id)||l.set(u.id,u);let m=new Map,a=new Map;for(let u=0;u<i.length;u++){let h=i[u],p=(h.sectionId?l.get(h.sectionId)??o.find(y=>y.logicalSectionId===h.sectionId&&ae({x:h.x,y:h.y},y.outline,y.holes)):void 0)??o.find(y=>ae({x:h.x,y:h.y},y.outline,y.holes))??null;if(s[u]=p,!p)continue;m.has(p.id)||m.set(p.id,Ze(p,{floorBaseHeightM:n}));let f=a.get(p.id);f?f.push(u):a.set(p.id,[u])}let c=new Array(i.length).fill(void 0);for(let[u,h]of a){let d=m.get(u);if(!d)continue;let p=d.rake>0?Math.tan(d.rake*Math.PI/180):0,f=ot(u,i,h,t);for(let y of f.rows){let S=y.blockDepth*q*p,E=d.height+S;for(let I of y.seatIndices)c[I]=E}}for(let u=0;u<i.length;u++){let h=i[u],d=s[u];if(!d){h.eyeHeightM=n+Q;continue}let p=m.get(d.id);h.eyeHeightM=(c[u]??p.height)+Q}}var ie=40;function Si(e,t){let n=t?.freeText==="exclude",i=1/0,o=1/0,r=-1/0,s=-1/0,l=(a,c)=>{a<i&&(i=a),c<o&&(o=c),a>r&&(r=a),c>s&&(s=c)},m=a=>{if(Array.isArray(a))for(let c of a)!c||typeof c!="object"||l(c.x,c.y)};for(let a of Gn(e))if(a.type==="row"){let c=new Map((a.overrides??[]).map(u=>[u.index,u]));we(a).forEach((u,h)=>{let d=c.get(h);d?.skip||l(u.x+(d?.dx??0),u.y+(d?.dy??0))})}else if(a.type==="gaArea")m(a.points);else if(a.type==="section")m(a.outline);else if(a.type==="decorImage")l(a.x,a.y),l(a.x+a.width,a.y+a.height);else if(a.type==="shape")a.points&&a.points.length?m(a.points):a.x!=null&&a.y!=null&&a.width!=null&&a.height!=null&&(l(a.x,a.y),l(a.x+a.width,a.y+a.height));else if(a.type==="table"){let c=J+Nn,u=a.shape==="round"?(a.radius??40)+c:Math.max((a.width??80)/2,(a.height??50)/2)+c;l(a.center.x-u,a.center.y-u),l(a.center.x+u,a.center.y+u)}else if(a.type==="booth"){let c=Math.max(a.width,a.height)/2;l(a.center.x-c,a.center.y-c),l(a.center.x+c,a.center.y+c)}else if(a.type==="text"){if(n)continue;let c=Ne(a);l(a.position.x,a.position.y),l(a.position.x+c.width,a.position.y+c.height)}for(let a of[e.referenceImage,e.backgroundImage]){if(!a)continue;let{center:c,width:u}=a;if(!c||!Number.isFinite(c.x)||!Number.isFinite(c.y)||!Number.isFinite(u))continue;let h=u*3/4;l(c.x-u/2,c.y-h/2),l(c.x+u/2,c.y+h/2)}if(!isFinite(i)){let a=e.focalPoint??{x:0,y:0};return{x:a.x-200,y:a.y-200,width:400,height:400}}return{x:i-ie,y:o-ie,width:r-i+ie*2,height:s-o+ie*2}}export{Yn as a,vt as b,Ce as c,wt as d,Wn as e,Et as f,$n as g,Z as h,le as i,Jn as j,Zn as k,eo as l,to as m,no as n,oo as o,io as p,so as q,ao as r,co as s,lo as t,uo as u,fo as v,ho as w,mo as x,po as y,Ne as z,yo as A,Lt as B,go as C,fe as D,So as E,Fe as F,vo as G,wo as H,Dt as I,Ue as J,Io as K,Ge as L,Ht as M,Co as N,To as O,ze as P,Oo as Q,We as R,Xt as S,Bt as T,zt as U,Ao as V,$t as W,Jt as X,No as Y,Lo as Z,Fo as _,Do as $,$e as aa,q as ba,Ho as ca,en as da,qe as ea,Je as fa,Qe as ga,pe as ha,tn as ia,nn as ja,on as ka,Q as la,Uo as ma,Ze as na,tt as oa,cn as pa,ot as qa,Xo as ra,mn as sa,Bo as ta,it as ua,Yo as va,xn as wa,xe as xa,zo as ya,Se as za,J as Aa,we as Ba,pi as Ca,jn as Da,Ln as Ea,Fn as Fa,bt as Ga,bi as Ha,Dn as Ia,Vn as Ja,dt as Ka,te as La,ae as Ma,yi as Na,yt as Oa,Kn as Pa,Me as Qa,gi as Ra,Gn as Sa,Xn as Ta,xi as Ua,Mi as Va,Si as Wa};
@@ -1 +0,0 @@
1
- import{c as b,k as y,n as f,t as g}from"./chunk-JBOTRSMY.js";var A=72;var N="seatmap.chart";var I=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],R=new Map(I.map(e=>[e.key,e]));function W(e){return R.get(e)}var w={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 v(e){let t=e?.[0];return t&&w[t]||"#3b82f6"}var k=[{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"}],M=new Map(k.map(e=>[e.key,e]));function Y(e){return M.get(e)}var X=8,q=24,E=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],T=new Set(E);function Q(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&T.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}var ie=7,oe=10,L=10,P=.39,O=.8,_=.62;function ae(e){let t=Math.min(Math.abs(e.width),Math.abs(e.height));if(!(t>0))return L;let n=Math.max(1,e.text.length),r=Math.abs(e.width)*O/(n*_);return Math.max(L,Math.min(t*P,r))}var se=15,ce=11,le=.85,B=12,d=4.5,de=3,F=3,o="#000000",a="#ffffff",D=24,z=18.67;function ue(e,t=400){return e>=D||t>=700&&e>=z?F:d}function be(e,t){return e*t>=B}var ge=24,x={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},me=x.wheelchair;function pe(e){if(!e?.length)return null;let t=e.includes("wheelchair")?"wheelchair":e[0];return x[t]??null}function Se(e,t){return t.colorblind?G(t.canvasBackground):v(e)}function ye(e){return/-(\d{1,5})$/.exec(e)?.[1]??e}var s=f;function fe(e,t,n){let r=b(e),c=b(t);if(!r||!c)return t;let i=Math.max(0,Math.min(1,n));return`#${r.map((l,m)=>Math.round(l*i+c[m]*(1-i))).map(l=>l.toString(16).padStart(2,"0")).join("")}`}var ve=3;function Le(e){let t=s(a,e)??0,n=s(o,e)??0;return t>=d?a:n>=d&&g(e)||g(e)?o:a}function G(e){return g(e)?o:a}function C(e,t,n=d){let r=s(t,e);if(r!=null&&r>=n)return t;let c=s(o,e)??0,i=s(a,e)??0;return c===0&&i===0?t:c>=i?o:a}function he(e,t,n,r=d){return t??C(e,n,r)}var V=3;function xe(e){let t=s("#ffffff",e);if(t!=null&&t>=V)return"#ffffff";let n=s(o,e)??0,r=s(a,e)??0;return n===0&&r===0?"#ffffff":n>=r?o:a}var h=/^#[0-9a-f]{6}$/i;function H(e){let t=b(e);return t!=null&&y(t)>.5}var Z="#e5e7eb",K="#273142";function Ce(e){return H(e)?Z:K}function Ae(e,t,n=d){let r=h.test(e.trim()),c=e.trim().toLowerCase(),i=0,u=0,l=null;for(let p of t){if(!r||!h.test(p.trim()))continue;i+=1;let S=C(p,e,n);S.toLowerCase()!==c&&(u+=1,l=S)}return{total:i,overridden:u,status:i===0?"none":u===0?"applies":u===i?"overridden":"mixed",overrideInk:l}}export{A as a,N as b,I as c,W as d,w as e,v as f,k as g,Y as h,X as i,q as j,E as k,Q as l,ie as m,oe as n,L as o,P as p,ae as q,se as r,ce as s,le as t,B as u,d as v,de as w,F as x,o as y,a as z,ue as A,be as B,ge as C,x as D,me as E,pe as F,Se as G,ye as H,s as I,fe as J,ve as K,Le as L,G as M,C as N,he as O,xe as P,H as Q,Z as R,K as S,Ce as T,Ae as U};