@seatlayer/core 0.75.1 → 0.76.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 (70) hide show
  1. package/dist/{categoryInventory-DFp26meo.d.cts → categoryInventory-CBuJy9KM.d.cts} +1 -1
  2. package/dist/{categoryInventory-C5I2U-EM.d.ts → categoryInventory-Cy5pQ0KW.d.ts} +1 -1
  3. package/dist/chunk-24O23MNB.js +1 -0
  4. package/dist/chunk-BT2KJXQC.js +1 -0
  5. package/dist/{chunk-3L4M7L5I.js → chunk-BXU5D2Q5.js} +1 -1
  6. package/dist/chunk-FGMGDTMR.js +1 -0
  7. package/dist/{chunk-KHFCTR3V.js → chunk-JQL77POQ.js} +1 -1
  8. package/dist/{chunk-UVAV3E7K.js → chunk-NQZAZFAC.js} +1 -1
  9. package/dist/{chunk-OGIAQX62.js → chunk-O5UH442K.js} +1 -1
  10. package/dist/{chunk-TN6DFYEV.js → chunk-PRED5KHO.js} +1 -1
  11. package/dist/{chunk-N3DPHRJ3.js → chunk-Q3U3F4YJ.js} +1 -1
  12. package/dist/{chunk-YACNGDTE.js → chunk-WXGW2SYC.js} +1 -1
  13. package/dist/{chunk-FMZ6HLDH.js → chunk-XD2P4ZS4.js} +1 -1
  14. package/dist/core/chart-ops/index.cjs +1 -1
  15. package/dist/core/chart-ops/index.d.cts +7 -5
  16. package/dist/core/chart-ops/index.d.ts +7 -5
  17. package/dist/core/chart-ops/index.js +1 -1
  18. package/dist/core/inventory/index.cjs +1 -1
  19. package/dist/core/inventory/index.d.cts +4 -4
  20. package/dist/core/inventory/index.d.ts +4 -4
  21. package/dist/core/inventory/index.js +1 -1
  22. package/dist/core/layout/index.cjs +1 -1
  23. package/dist/core/layout/index.d.cts +5 -5
  24. package/dist/core/layout/index.d.ts +5 -5
  25. package/dist/core/layout/index.js +1 -1
  26. package/dist/core/quality/index.cjs +1 -1
  27. package/dist/core/quality/index.d.cts +18 -14
  28. package/dist/core/quality/index.d.ts +18 -14
  29. package/dist/core/quality/index.js +1 -1
  30. package/dist/core/render-assets/index.d.cts +1 -1
  31. package/dist/core/render-assets/index.d.ts +1 -1
  32. package/dist/core/seatConfidence.d.cts +1 -1
  33. package/dist/core/seatConfidence.d.ts +1 -1
  34. package/dist/core/sections/index.cjs +1 -1
  35. package/dist/core/sections/index.d.cts +5 -5
  36. package/dist/core/sections/index.d.ts +5 -5
  37. package/dist/core/sections/index.js +1 -1
  38. package/dist/{eventConfigurations-DAaOaKJK.d.cts → eventConfigurations-CqfrYWAb.d.cts} +1 -1
  39. package/dist/{eventConfigurations-BQGuLLv0.d.ts → eventConfigurations-Dhauc9V3.d.ts} +1 -1
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.cts +61 -18
  42. package/dist/index.d.ts +61 -18
  43. package/dist/index.js +1 -1
  44. package/dist/{labeling-BZp91HiS.d.cts → labeling-B1xsmowB.d.cts} +1 -1
  45. package/dist/{labeling-Duul2sao.d.ts → labeling-BwPEI5JN.d.ts} +1 -1
  46. package/dist/{renderedQuality-CEPse8ir.d.cts → renderedQuality-1E9KuJvY.d.cts} +1 -1
  47. package/dist/{renderedQuality-BYhJ3Cer.d.ts → renderedQuality-ChAZNV2N.d.ts} +1 -1
  48. package/dist/{renderer-Cv_gzYvT.d.cts → renderer-BRmVrITG.d.cts} +1 -1
  49. package/dist/{renderer-BlLKrW-U.d.ts → renderer-q7viZLGZ.d.ts} +1 -1
  50. package/dist/{sections-DIVvr8QN.d.ts → sections-ByTMouG8.d.ts} +1 -1
  51. package/dist/{sections-CRSGPI3T.d.cts → sections-CA-bBex5.d.cts} +1 -1
  52. package/dist/{segmentedRowModel-CvyOS6Bx.d.cts → segmentedRowModel-C7XOEjHk.d.cts} +1 -1
  53. package/dist/{segmentedRowModel-CD-YT9bT.d.ts → segmentedRowModel-DcvJVKLD.d.ts} +1 -1
  54. package/dist/{layout-Gkx3fo5_.d.cts → tableSizing-BdCyNeqX.d.cts} +14 -4
  55. package/dist/{layout-DGbWo5fV.d.ts → tableSizing-D8e8QAJ-.d.ts} +14 -4
  56. package/dist/{ticketRestrictions-C31mrE97.d.cts → ticketRestrictions-CPZglNvw.d.cts} +2 -2
  57. package/dist/{ticketRestrictions-DXO2eckD.d.ts → ticketRestrictions-CorjMY49.d.ts} +2 -2
  58. package/dist/{types-BVRza86Q.d.ts → types-CqaNLbU6.d.cts} +10 -4
  59. package/dist/{types-BVRza86Q.d.cts → types-CqaNLbU6.d.ts} +10 -4
  60. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  61. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  62. package/dist/view3d/index.cjs +6 -6
  63. package/dist/view3d/index.d.cts +3 -3
  64. package/dist/view3d/index.d.ts +3 -3
  65. package/dist/view3d/index.js +1 -1
  66. package/dist/view3d/scene/scene.worker.cjs +1 -1
  67. package/dist/view3d/scene/scene.worker.js +1 -1
  68. package/package.json +1 -1
  69. package/dist/chunk-QUOAQQMP.js +0 -1
  70. package/dist/chunk-X2GZ5O7C.js +0 -1
@@ -1 +1 @@
1
- "use strict";var vo=Object.create;var Ft=Object.defineProperty;var Ro=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var Po=Object.getPrototypeOf,Eo=Object.prototype.hasOwnProperty;var Ao=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Co(t))!Eo.call(e,r)&&r!==n&&Ft(e,r,{get:()=>t[r],enumerable:!(o=Ro(t,r))||o.enumerable});return e};var Ie=(e,t,n)=>(n=e!=null?vo(Po(e)):{},Ao(t||!e||!e.__esModule?Ft(n,"default",{value:e,enumerable:!0}):n,e));var xs=Math.PI/180;function ft(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function _e(e){return e.length?ft(e):null}function Dt(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+s*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+s*e.end.y}}function Nt(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[Dt(e,.5)];let o=Array.from({length:n+1},(m,f)=>Dt(e,f/n)),r=new Float64Array(o.length);for(let m=1;m<o.length;m+=1){let f=o[m].x-o[m-1].x,u=o[m].y-o[m-1].y;r[m]=r[m-1]+Math.hypot(f,u)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let m=0;m<t;m+=1){let f=i*m/(t-1);for(;a<r.length-1&&r[a]<f;)a+=1;let u=r[a-1],b=r[a],c=b===u?0:(f-u)/(b-u);s.push({x:o[a-1].x+(o[a].x-o[a-1].x)*c,y:o[a-1].y+(o[a].y-o[a-1].y)*c})}return s}function jt(e,t,n){return Math.max(t,Math.min(n,e))}function Gt(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((c,l)=>c.segmentedRow.componentIndex-l.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((c,l)=>c.segmentedRow?.kind==="segmented-row-v1"&&c.segmentedRow.groupId===o&&c.segmentedRow.componentCount===s&&c.segmentedRow.componentIndex===l&&c.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(l===0?c.segmentedRow.boundaryBefore==="start":c.segmentedRow.boundaryBefore!=="start")&&c.segmentedRow.displayLabel===a.displayLabel)))continue;let f=i.reduce((c,l)=>c+l.seatCount,0),u=0,b=0;for(let c of i)c.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(c.id,{groupId:o,adjacencyOffset:u,displayOffset:b,displayLabel:a.displayLabel,totalSeats:f,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),u+=c.seatCount,b+=c.seatCount}return t}var _o="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var ko="abcdefghijklmnopqrstuvwxyz";function To(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function mt(e,t=!1){let n=t?ko:_o;return To(Math.max(0,Math.floor(e)-1),n)}var Lo=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Ut(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of Lo)for(;t>=o;)n+=r,t-=o;return n}function Oo(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function dt(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=e.seatNumbering?.endAt,m=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(m/2),d=i==="updown"?t<l?n+2*t:n-1+2*(m-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${s}${d}`}let f=i==="odd"||i==="even"?2:r,u=a!=null&&Number.isFinite(a)?a-(m-1)*f:n,b=o==="center"?Oo(m)[t]:o==="rtl"?m-1-t:t,c;switch(i){case"odd":{let l=u%2===1?u:u+1;c=String(l+b*2);break}case"even":{let l=u%2===0?u:u+1;c=String(l+b*2);break}case"roman":c=Ut(u+b*r);break;case"letters-upper":c=mt(u+b*r,!1);break;case"letters-lower":c=mt(u+b*r,!0);break;default:c=String(u+b*r);break}return`${s}${c}`}function Bo(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Yt(e,t,n){return n?.label??`${e.label}-${dt(e,t)}`}function bt(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(!n)return`${e.displayLabel||e.label}-${dt(e,t)}`;let r=Bo(n),i=n.displayOffset+t;return`${n.displayLabel}-${dt(r,i)}`}var te=.02291666666666667,me=1/te,Fo=58,Do=Fo*te;var No=3,Xt=0,ht=120,jo=0,Go=45,Uo=7,ce=1.2;function pt(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Yo(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Uo?e:No}function He(e,t={}){let n=pt(t.floorBaseHeightM,Xt,ht,0),o=Math.min(ht,n+Yo(e.elevation)*Do),r=e.height===void 0?o:pt(e.height,Xt,ht,o),i=pt(e.rake,jo,Go,0);return{height:r,rake:i}}function Vt(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 ve(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 o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,m=s.y-i.y,f=a*a+m*m,u=f>1e-12?((t-i.x)*a+(n-i.y)*m)/f:0;u<0?u=0:u>1&&(u=1);let b=Math.hypot(t-(i.x+u*a),n-(i.y+u*m));b<o&&(o=b)}return o}function Xo(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>r&&(r=s)}return{cx:t,cy:n,r}}function Ht(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function yt(e,t){let n=1/0;for(let o of Vt(e)){let r=ve(t,o.x,o.y);r<n&&(n=r)}for(let o of Vt(t)){let r=ve(e,o.x,o.y);r<n&&(n=r)}return n}function Vo(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let u of e)n+=u.x,o+=u.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let u of e){let b=Math.hypot(u.x-n,u.y-o);b>r&&(r=b,i=u)}let s=i.x-n,a=i.y-o,m=Math.hypot(s,a);m>1e-9?(s/=m,a/=m):(s=1,a=0);let f=e.map((u,b)=>({p:u,i:b,t:(u.x-n)*s+(u.y-o)*a})).sort((u,b)=>u.t-b.t);return{pts:f.map(u=>u.p),seatIndices:f.map(u=>t[u.i])}}function gt(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let g of e)n+=g.x,o+=g.y;n/=t,o/=t;let r=0,i=0,s=0,a=0,m=0,f=0,u=0;for(let g of e){let M=g.x-n,x=g.y-o;r+=M*M,s+=x*x,i+=M*x,a+=M*M*M,m+=x*x*x,f+=M*x*x,u+=x*M*M}let b=r*s-i*i;if(Math.abs(b)<1e-9)return null;let c=(a+f)/2,l=(m+u)/2,d=(c*s-l*i)/b,h=(l*r-c*i)/b,p=d+n,y=h+o;return!Number.isFinite(p)||!Number.isFinite(y)?null:{cx:p,cy:y}}var Ho=.15;function Ko(e){if(e.length<2)return null;let t=e.map(g=>{let M=0,x=0;for(let A of g.pts)M+=A.x,x+=A.y;return{x:M/g.pts.length,y:x/g.pts.length}}),n=0,o=0;for(let g of t)n+=g.x,o+=g.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let g of t){let M=g.x-n,x=g.y-o;r+=M*M,i+=M*x,s+=x*x}let a=r+s,m=r*s-i*i,f=a/2+Math.sqrt(Math.max(0,a*a/4-m)),u,b;Math.abs(i)>1e-12?(u=f-s,b=i):r>=s?(u=1,b=0):(u=0,b=1);let c=Math.hypot(u,b);if(!(c>1e-12))return null;u/=c,b/=c;let l=1/0,d=-1/0,h=[];for(let g of e){let M=1/0,x=-1/0;for(let A of g.pts){let S=A.x*u+A.y*b;S<M&&(M=S),S>x&&(x=S),S<l&&(l=S),S>d&&(d=S)}h.push(x-M)}let p=d-l;return p>1e-9?(h.sort((g,M)=>g-M),h[Math.min(h.length-1,Math.floor(h.length*.9))]/p<=zo?{x:u,y:b}:null):null}var zo=.35;function Ke(e,t,n,o){let r=new Map;for(let p of n){let y=t[p],g=y.rowId||`__seat-${p}`,M=r.get(g);M||(M={pts:[],idx:[]},r.set(g,M)),M.pts.push({x:y.x,y:y.y}),M.idx.push(p)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[p,y]of r){let g=Vo(y.pts,y.idx),M=0;for(let x of g.pts)M+=Math.hypot(x.x-o.x,x.y-o.y);i.push({id:p,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/g.pts.length})}let s=i.map(p=>Xo(p.pts)),a=[];for(let p=0;p<i.length;p++){let y=1/0;for(let g=0;g<i.length;g++){if(p===g||Ht(s[p],s[g])>=y)continue;let M=yt(i[p].pts,i[g].pts);M<y&&(y=M)}Number.isFinite(y)&&a.push(y)}a.sort((p,y)=>p-y);let m=a.length?a[Math.floor(a.length/2)]:1,f=Math.max(m*1.8,1e-6),u=i.map(()=>[]);for(let p=0;p<i.length;p++)for(let y=p+1;y<i.length;y++)Ht(s[p],s[y])>f||yt(i[p].pts,i[y].pts)<=f&&(u[p].push(y),u[y].push(p));let b=0;for(let p=0;p<i.length;p++){if(i[p].blockId!==-1)continue;let y=b++,g=[p];for(i[p].blockId=y;g.length;){let M=g.pop();for(let x of u[M])i[x].blockId===-1&&(i[x].blockId=y,g.push(x))}}let c=new Map;for(let p of i){let y=c.get(p.blockId)??[];y.push(p),c.set(p.blockId,y)}let l=[];for(let p of i){if(p.pts.length<4)continue;let y=gt(p.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||l.push({x:y.cx,y:y.cy}))}let d=l.length>=2?(()=>{let p=l.map(M=>M.x).sort((M,x)=>M-x),y=l.map(M=>M.y).sort((M,x)=>M-x),g=Math.floor(l.length/2);return{cx:p[g],cy:y[g]}})():null;if(d){let p=S=>Math.hypot(S.x-d.cx,S.y-d.cy),y=1/0,g=-1/0,M=[];for(let S of i){let v=1/0,_=-1/0;for(let D of S.pts){let N=p(D);N<v&&(v=N),N>_&&(_=N)}M.push(_-v),v<y&&(y=v),_>g&&(g=_)}let x=g-y;M.sort((S,v)=>S-v);let A=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(x>1e-9&&A/x<=Ho){let S=i.map(I=>{let T=0;for(let P of I.pts)T+=p(P);return{row:I,radius:T/I.pts.length}}),v=0,_=0;for(let I of S)v+=I.radius,_+=I.row.focalDistance;v/=S.length,_/=S.length;let D=0;for(let I of S)D+=(I.radius-v)*(I.row.focalDistance-_);if(D<0)for(let I of S)I.radius=-I.radius;let G=1/0;for(let I of S)I.radius<G&&(G=I.radius);S.sort((I,T)=>I.radius-T.radius);let C=-1,w=-1/0,k=x/Math.max(1,S.length)*.5,B=[];for(let I of S)I.radius-w>k&&(C++,w=I.radius),I.row.ordinal=C,I.row.blockDepth=I.radius-G,B.push(I.row);return{sectionId:e,rows:B,blockCount:b}}}let h=[];for(let[,p]of c){let y=Ko(p);if(y){let g=x=>{let A=0;for(let S of x.pts)A+=S.x*y.x+S.y*y.y;return A/x.pts.length};p.sort((x,A)=>g(x)-g(A)),p.length>=2&&p[0].focalDistance>p[p.length-1].focalDistance&&p.reverse();let M=0;for(let x=0;x<p.length;x++)x>0&&(M+=yt(p[x-1].pts,p[x].pts)),p[x].ordinal=x,p[x].blockDepth=M,h.push(p[x])}else{let g=1/0;for(let M of p)M.focalDistance<g&&(g=M.focalDistance);p.sort((M,x)=>M.focalDistance-x.focalDistance);for(let M=0;M<p.length;M++)p[M].ordinal=M,p[M].blockDepth=Math.max(0,p[M].focalDistance-g),h.push(p[M])}}return{sectionId:e,rows:h,blockCount:b}}var Wo=/^\d{4}-\d{2}-\d{2}$/;function Zo(e){let t=Date.parse(e);return Number.isFinite(t)?Wo.test(e)?t+864e5:t:null}function Qo(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=Zo(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function $o(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function qo(e){return e.status!=="draft"&&e.status!=="retracted"}function Jo(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function Kt(e,t={}){return!!e&&qo(e)&&$o(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Jo(e,t.activeBasisSha256)&&Qo(e,t.now)}var _s=Math.PI*2;function ze(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var er=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,tr=/[\s"'<>`\\]/;function nr(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return er.test(e);if(tr.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function zt(e){let t=e.trim();return nr(t)?t:null}var xt="seatlayer.event-configuration/1";var Re=100,or=120,rr=1e5,ir=1e4,sr=/^[a-f0-9]{64}$/,ar=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function cr(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Wt(e){return!Array.isArray(e)||e.length>rr||!e.every(t=>be(t,Re))?null:[...new Set(e)].sort()}function ur(e){return!ke(e)||!be(e.chartId,Re)||!be(e.version,Re)||e.sha256!==void 0&&(typeof e.sha256!="string"||!sr.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Mt(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function lr(e){return ke(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Mt(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function fr(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>ir)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!ke(a)||!be(a.id,Re)||!be(a.objectId,Re)||!n.has(a.objectId)||!ar.has(String(a.kind))||!Mt(a.heightM,.05,50)||a.baseElevationM!==void 0&&!Mt(a.baseElevationM,-10,100))return null;let m=lr(a.occlusion);if(!m||o.has(a.id)||r.has(a.objectId))return null;let f=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?zt(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!f||a.kind!=="screen"||++i>1))return null;o.add(a.id),r.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:m,...f?{contentImageUrl:f}:{}})}return s.sort((a,m)=>a.id.localeCompare(m.id))}function mr(e){let t=[];if(!ke(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==xt&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${xt}`}),be(e.id,Re)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),be(e.label,or)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),cr(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=ur(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 o=ke(e.overlay)?e.overlay:null,r=Wt(o?.objectIds),i=Wt(o?.productionKillSeatIds),s=r?fr(o?.productionElements,r):null;return(!o||!r||!i)&&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||!r||!i||s===null?{issues:t}:{issues:t,value:{schema:xt,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function Zt(e){let t=mr(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function dr(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,o=e.width,r=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r},{x:t,y:n+r}]}function br(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*r-a*i,y:t.y+s*i+a*r}}function Qt(e){let t=dr(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(m=>br(m,{x:t.reduce((f,u)=>f+u.x,0)/t.length,y:t.reduce((f,u)=>f+u.y,0)/t.length},n)),r=1/0,i=1/0,s=-1/0,a=-1/0;for(let m of o)r=Math.min(r,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x),a=Math.max(a,m.y);return!Number.isFinite(r)||s-r<1e-6||a-i<1e-6?null:{minX:r,minY:i,maxX:s,maxY:a}}var hr=5,pr=3,yr=.92,gr=1.9,xr=2,Mr=.6,Sr=1,wr=.06;function Ir(e){return e.heightM!==void 0?e.heightM:ze(e.stageKind)?wr:Sr}function $t(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of en(e)){let a=s.baseHeightM??0;for(let m of s.objects){if(m.type!=="shape"||m.role!=="stage")continue;let f=Qt(m);f&&(t=Math.min(t,f.minX),n=Math.min(n,f.minY),o=Math.max(o,f.maxX),r=Math.max(r,f.maxY),i=Math.max(i,a+Ir(m)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function vr(e,t,n,o){let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(r=Math.min(r,l.x),s=Math.max(s,l.x),i=Math.min(i,l.y),a=Math.max(a,l.y));if(!Number.isFinite(r))return null;let m=r*t,f=i*t,u=Math.max(1,Math.ceil((s-r)*t/n)+1),b=Math.max(1,Math.ceil((a-i)*t/n)+1),c=new Float64Array(u*b).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let d=l.eyeHeightM-ce,h=Math.min(u-1,Math.max(0,Math.floor((l.x*t-m)/n))),y=Math.min(b-1,Math.max(0,Math.floor((l.y*t-f)/n)))*u+h,g=d+o;g>c[y]&&(c[y]=g)}return{cellM:n,minX:m,minY:f,cols:u,rows:b,top:c}}function Rr(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),r=Math.floor((n-e.minY)/e.cellM);return o<0||r<0||o>=e.cols||r>=e.rows?-1/0:e.top[r*e.cols+o]}function qt(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??te,i=n.cellM??Mr,s=n.chairBackM??yr,a=n.selfRowSkipM??xr,m=n.clearThreshold??.9,f=n.partialThreshold??.25,u=Math.max(1,n.columns??hr),b=Math.max(1,n.rows??pr),c=vr(e,r,i,s);if(!c)return o;let l=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,h=l>=d,p=(t.minX+t.maxX)/2*r,y=(t.minY+t.maxY)/2*r,g=[];for(let x=0;x<u;x++){let A=(x+.5)/u-.5,S=h?p+A*l:p,v=h?y:y+A*d;for(let _=0;_<b;_++){let D=t.deckTopM+(b===1?0:_/(b-1)*gr);g.push({x:S,y:v,z:D})}}let M=i/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let A=x.x*r,S=x.y*r,v=x.eyeHeightM,_=0,D=1/0;for(let G of g){let C=G.x-A,w=G.y-S,k=Math.hypot(C,w);if(!(k>a)){_++;continue}let B=C/k,I=w/k,T=0;for(let P=a;P<k;P+=M){let E=Rr(c,A+B*P,S+I*P);if(!(!Number.isFinite(E)||E>=v)&&E>v+(G.z-v)*P/k){T=P;break}}T?D=Math.min(D,T):_++}let N=_/g.length;N>=m||o.set(x.id,{seatId:x.id,mark:N<f?"obstructedView":"restrictedView",visibleFraction:N,totalRays:g.length,atDistanceM:Number.isFinite(D)?D:0})}return o}function Jt(e,t){if(!t.size)return 0;let n=0;for(let o of e){let r=t.get(o.id);if(!r)continue;let i=o.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(o.commercial={...i,[r.mark]:!0},n++)}return n}function sn(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var We=Math.PI/180;var Te=16;function wt(e,t,n,o){let r=n*We,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function Cr(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return Nt(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let f=0;f<t;f++)s.push(wt(f*n,0,r,i));return s}let a=o/(t-1)*We,m=n/(2*Math.sin(Math.abs(a)/2));for(let f=0;f<t;f++){let u=f*a,b=m*Math.sin(u),c=-m+m*Math.cos(u);s.push(wt(b,c,r,i))}return s}function Pr(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Er(e,t){let n=Pr(e);return Cr(e).map((o,r)=>{let i=n.get(r),s=sn(i),a=Yt(e,r,i),m={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:a,displayLabel:bt(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(m).some(f=>f!==void 0&&f!==!1&&f!=="")?m:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function an(e){let t=[];for(let n of Er(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 Ar(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function _r(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(u=>[u.index,u])),r=(u,b,c,l)=>{let d=o.get(u),h=sn(d),p=d?.label??`${e.label}-${u+1}`,y=e.displayLabel??e.label;return{index:u,label:p,displayLabel:d?.displayLabel??`${y}-${u+1}`,x:b+(d?.dx??0),y:c+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Te,b=e.rotation*We,c=Math.max(0,Math.min(360,e.seatArc??360));if(c>=360||n===1){for(let p=0;p<n;p++){let y=b+p/n*2*Math.PI;t.push(r(p,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let l=c*We,d=(2*Math.PI-l)/2,h=b+d;for(let p=0;p<n;p++){let y=h+p/(n-1)*l;t.push(r(p,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let i=e.width??80,s=e.height??50,a=Ar(e),m=["top","bottom","left","right"],f=0;for(let u of m){let b=a[u];for(let c=0;c<b;c++){let l,d;u==="top"?(l=-i/2+(c+.5)*i/b,d=-s/2-Te):u==="bottom"?(l=-i/2+(c+.5)*i/b,d=s/2+Te):u==="left"?(l=-i/2-Te,d=-s/2+(c+.5)*s/b):(l=i/2+Te,d=-s/2+(c+.5)*s/b);let h=wt(l,d,e.rotation,e.center);t.push(r(f++,h.x,h.y,u))}}return t}function kr(e){return _r(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 Tr(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 tn(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,s=t[o].y,a=t[r].x,m=t[r].y;s>e.y!=m>e.y&&e.x<(a-i)*(e.y-s)/(m-s)+i&&(n=!n)}return n}function Lr(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),a=(r.x-n.x)**2+(r.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function he(e,t,n){return tn(e,t)&&!(n??[]).some(o=>tn(e,o)||Lr(e,o))}function St(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function Or(e){switch(e.type){case"row":{let t=an(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return St(e.points);case"section":return St(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?St(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 nn(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Br(e,t){if(e.type!=="gaArea"||!nn(e.points,t.outline))return!1;let n=e.holes??[],o=t.holes??[];return n.length===o.length&&n.every((r,i)=>nn(r,o[i]))}function Fr(e,t){let n=e.filter(s=>s.type==="section"),o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,r=Or(t);return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(Br(t,s)||he(r,s.outline,s.holes))):void 0)??n.find(s=>he(r,s.outline,s.holes))}function en(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 on(e,t,n,o,r,i,s,a,m){let f=[],u=Gt(e),b=d=>!d?.eventConfigurationId||d.eventConfigurationId===o&&(d.eventConfigurationVersion===void 0||d.eventConfigurationVersion===m),c=d=>Kt(d,{activeConfigurationId:o,activeConfigurationVersion:m,activeBasisSha256:r,now:a}),l=(d,h)=>c(d)?{...d,coverage:h}:void 0;for(let d of e){let h=[];if(d.type==="row"?h=an(d):d.type==="table"?h=kr(d):d.type==="booth"&&(h=Tr(d)),!h.length)continue;for(let x of h)x.viewUrl&&!b(x.viewMeta)&&(x.viewUrl=void 0,x.viewMeta=void 0);if(d.type==="row"){let x=u.get(d.id);if(x){let A=new Map((d.overrides??[]).map(S=>[S.index,S]));for(let S of h){let v=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(v))continue;S.logicalRowId=x.groupId,S.logicalSeatIndex=x.adjacencyOffset+v,A.get(v)?.displayLabel||(S.displayLabel=bt(d,v,x)),!S.viewUrl&&x.viewFromSeatUrl&&b(x.viewFromSeatMeta)&&(S.viewUrl=x.viewFromSeatUrl,S.viewMeta=x.viewFromSeatMeta);let _=A.get(v)?.confidenceEvidence;S.confidenceEvidence=l(_,"exact-seat")??l(d.confidenceEvidence,"row-representative")??l(x.confidenceEvidence,"row-representative")}}}let p=Fr(e,d),y=p?.viewFromSeatUrl,M=(p?.zone?t?.find(x=>x.id===p.zone):void 0)?.focalPoint??n;for(let x of h){if(!x.confidenceEvidence){let A=Number(x.id.slice(x.id.lastIndexOf(":")+1)),S=(d.type==="row"||d.type==="table")&&Number.isInteger(A)?d.overrides?.find(v=>v.index===A)?.confidenceEvidence:void 0;x.confidenceEvidence=l(S,"exact-seat")??(d.type==="row"?l(d.confidenceEvidence,"row-representative"):void 0)}x.confidenceEvidence??=l(p?.confidenceEvidence,"section-representative")??(s?l(s.evidence,s.coverage):void 0),!x.viewUrl&&y&&b(p?.viewFromSeatMeta)&&(x.viewUrl=y,x.viewMeta=p?.viewFromSeatMeta),!x.viewUrl&&i&&b(i.meta)&&(x.viewUrl=i.url,x.viewMeta=i.meta),p&&(x.sectionId=p.logicalSectionId??p.id),p?.zone&&(x.zoneId=p.zone),M&&(x.focalPoint={...M})}f.push(...h)}return f}function cn(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,m=on(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&rn(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,m);for(let f of m)f.floorId=r.id;o.push(...m)}return o}let n=on(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&&rn(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Dr(e,n,t)}function Dr(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Jt(t,qt(t,$t(e))),t}function rn(e,t,n,o){let r=e.filter(u=>u.type==="section"),i=n>0||r.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!r.length||!i||!t){for(let u of o)u.eyeHeightM=n+ce;return}let s=new Array(o.length),a=new Map,m=new Map;for(let u=0;u<o.length;u++){let b=o[u],l=(b.sectionId?r.find(h=>h.id===b.sectionId)??r.find(h=>h.logicalSectionId===b.sectionId&&he({x:b.x,y:b.y},h.outline,h.holes)):void 0)??r.find(h=>he({x:b.x,y:b.y},h.outline,h.holes))??null;if(s[u]=l,!l)continue;a.has(l.id)||a.set(l.id,He(l,{floorBaseHeightM:n}));let d=m.get(l.id);d?d.push(u):m.set(l.id,[u])}let f=new Array(o.length).fill(void 0);for(let[u,b]of m){let c=a.get(u);if(!c)continue;let l=c.rake>0?Math.tan(c.rake*Math.PI/180):0,d=Ke(u,o,b,t);for(let h of d.rows){let p=h.blockDepth*te*l,y=c.height+p;for(let g of h.seatIndices)f[g]=y}}for(let u=0;u<o.length;u++){let b=o[u],c=s[u];if(!c){b.eyeHeightM=n+ce;continue}let l=a.get(c.id);b.eyeHeightM=(f[u]??l.height)+ce}}var Nr=/^#?([\da-f]{3}|[\da-f]{6})$/i;function jr(e){let t=Nr.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function W(e){let t=jr(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Gr(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ne(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Le(e,t){let n=Gr(e);return ne(e,[n,n,n],t)}var Ze=["available","held","sold","selected","dimmed"];function un(e){let t=Ze.indexOf(e);return t<0?0:t}var ln={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var It={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]},vt={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ie(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var Ur=.15,Yr=1.6;function fn(e){return jt(e??1,Ur,Yr)}var Xr=.15,Vr=.9,Hr=1.76;function Kr(){return{background:{top:[...vt.top],bottom:[...vt.bottom]},structure:It,seatStates:{...ln},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function mn(e){let t=Kr();if(!e)return t;let n=W(e.background);if(n){t.background={top:ie(n,Vr),bottom:ie(n,Hr)};let s={};for(let[a,m]of Object.entries(It))s[a]=ne(m,n,Xr);t.structure=s}let o=W(e.selectionColor)??W(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=fn(r));let i=e.venue3d;if(i){let s=W(i.deck),a=W(i.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),a&&(t.structure={...t.structure,tierWall:a,gaWall:a}),t.materials.seat=W(i.seat),t.materials.shell=W(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function dn(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}var hn=Ie(require("earcut"),1),pn=Ie(require("polygon-clipping"),1);function pe(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function Oe(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}var R=te,zr=.002;function Wr(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),s=Math.max(o,r,i);if(s<1e-9)return!0;let a=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-o)*(a-r)*(a-i)))/s<zr}var ye=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=o}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},qe=class{constructor(){this.pos=new ye;this.nor=new ye;this.col=new ye;this.flr=new ye;this.mat=new ye;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,s=i,a=i){Wr(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,o,r,i,s,a,m=a,f=a){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(m[0],m[1],m[2]),this.col.push3(f[0],f[1],f[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 Zr(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],m=n[2]-e[2],f=r*m-i*a,u=i*s-o*m,b=o*a-r*s,c=Math.hypot(f,u,b)||1;return f/=c,u/=c,b/=c,[f,u,b]}function Qr(e,t){let n=[...e],o=[];for(let s of e)o.push(s.x,s.y);let r=[];if(t){for(let s of t)if(!(s.length<3)){r.push(n.length);for(let a of s)n.push(a),o.push(a.x,a.y)}}let i=(0,hn.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function Rt(e){return pe(e)<0?[...e].reverse():e}var $r=3;function qr(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(l,d,h,p)=>Math.abs(o({x:(l.x+d.x)/2,y:(l.y+d.y)/2})-(h+p)/2),m=(e.x+t.x+n.x)/3,f=(e.y+t.y+n.y)/3,u=(r+i+s)/3,b=Math.max(a(e,t,r,i),a(t,n,i,s),a(n,e,s,r),Math.abs(o({x:m,y:f})-u)),c=(l,d,h)=>{let p=Math.abs(o({x:(l+m)/2,y:(d+f)/2})-(h+u)/2);p>b&&(b=p)};return c((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),c((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),c((n.x+e.x)/2,(n.y+e.y)/2,(s+r)/2),b}function Be(e,t,n,o,r){if(r<=0)return qr(e,t,n,o);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Be(e,i,a,o,r-1),Be(i,t,s,o,r-1),Be(a,s,n,o,r-1),Be(i,s,a,o,r-1))}function Fe(e,t,n,o,r,i,s,a){if(s>0){let c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+o.x)/2,y:(n.y+o.y)/2},d={x:(o.x+t.x)/2,y:(o.y+t.y)/2};Fe(e,t,c,d,r,i,s-1,a),Fe(e,c,n,l,r,i,s-1,a),Fe(e,d,l,o,r,i,s-1,a),Fe(e,c,l,d,r,i,s-1,a);return}let m=[t.x*R,r(t),t.y*R],f=[n.x*R,r(n),n.y*R],u=[o.x*R,r(o),o.y*R];if(a){e.triN(m,f,u,a(t),a(n),a(o),i);return}let b=Zr(m,f,u);b[1]<0&&(b=[-b[0],-b[1],-b[2]]),e.tri(m,f,u,b,i)}var Jr=8;function bn(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,m,f)=>{if(f>0){let u={x:(i.x+s.x)/2,y:(i.y+s.y)/2},b=t(u);if(Math.abs(b-(a+m)/2)>n){r(i,u,a,b,f-1),r(u,s,b,m,f-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];r(s,a,t(s),t(a),Jr)}return o}function Qe(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],s=n[r],a=n[(r+1)%n.length],m=a.x-i.x,f=a.y-i.y,u=Math.hypot(m,f);u>t&&Math.abs((s.x-i.x)*f-(s.y-i.y)*m)/u<t||o.push(s)}return o.length>=3?o:n}var $e=.001*me*.1;function J(e,t,n,o,r,i,s,a,m=1/0,f){if(!t||t.length<3||(m===void 0&&(m=1/0),Math.abs(pe(t))<1e-4))return;let u=Qe(bn(Qe(Rt(t),$e),o,m),$e),b=n?.map(S=>Qe(bn(Qe(Rt(S),$e),o,m),$e)).filter(S=>S.length>=3&&Math.abs(pe(S))>=1e-4),{pts:c,tris:l}=Qr(u,b),d=[i[0]*a.top,i[1]*a.top,i[2]*a.top],h=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],p=[s[0]*a.top,s[1]*a.top,s[2]*a.top],y=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],g=0;if(Number.isFinite(m))for(;g<$r;g++){let S=0;for(let v=0;v<l.length;v+=3){let _=Be(c[l[v]],c[l[v+1]],c[l[v+2]],o,g);_>S&&(S=_)}if(S<=m)break}for(let S=0;S<l.length;S+=3){let v=c[l[S]],_=c[l[S+1]],D=c[l[S+2]];Fe(e,v,_,D,o,d,g,f);let N=[v.x*R,r,v.y*R],G=[_.x*R,r,_.y*R],C=[D.x*R,r,D.y*R];e.tri(N,C,G,[0,-1,0],h)}let M=S=>{if(g<=0)return S;let v=1<<g,_=[];for(let D=0;D<S.length;D++){let N=S[D],G=S[(D+1)%S.length];for(let C=0;C<v;C++){let w=C/v;_.push({x:N.x+(G.x-N.x)*w,y:N.y+(G.y-N.y)*w})}}return _},x=ft(u),A=[{ring:M(u),flip:!1}];if(b)for(let S of b)S.length>=3&&A.push({ring:M(S),flip:!0});for(let{ring:S,flip:v}of A)for(let _=0;_<S.length;_++){let D=S[_],N=S[(_+1)%S.length],G=(N.x-D.x)*R,w=(N.y-D.y)*R,k=-G,B=Math.hypot(w,k)||1;w/=B,k/=B;let I=(D.x+N.x)/2-x.x,T=(D.y+N.y)/2-x.y,P=w*I+k*T;v&&(P=-P),P<0&&(w=-w,k=-k);let E=[w,0,k],L=[D.x*R,o(D),D.y*R],F=[N.x*R,o(N),N.y*R],j=[D.x*R,r,D.y*R],Y=[N.x*R,r,N.y*R];e.tri(L,F,Y,E,p,p,y),e.tri(L,Y,j,E,p,y,y)}}function yn(e){let t=0;for(let m of e)t+=m.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=0;for(let m of e)n.set(m.position,a*3),o.set(m.normal,a*3),r.set(m.color,a*3),i.set(m.floor,a),s.set(m.material,a),a+=m.count;return{position:n,normal:o,color:r,floor:i,material:s,count:t}}function Je(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=Rt(e),r=o.length,i=[];for(let a=0;a<r;a++){let m=o[a],f=o[(a+1)%r],u=f.x-m.x,b=f.y-m.y,c=Math.hypot(u,b)||1;i.push({x:b/c,y:-u/c})}let s=[];for(let a=0;a<r;a++){let m=o[a],f=i[(a-1+r)%r],u=i[a],b=f.x+u.x,c=f.y+u.y,l=Math.hypot(b,c),d=()=>{s.push([m.x+f.x*t,m.y+f.y*t]),s.push([m.x+u.x*t,m.y+u.y*t])};if(l<1e-9){d();continue}b/=l,c/=l;let h=b*f.x+c*f.y,p=1/Math.max(h,1e-6);if(!Number.isFinite(p)||p>n){d();continue}s.push([m.x+b*t*p,m.y+c*t*p])}if(s.length<3)return e;try{let a=pn.default.union([[...s,s[0]]]),m=null,f=-1/0;for(let b of a){let c=Math.abs(pe(b[0].map(([l,d])=>({x:l,y:d}))));c>f&&(f=c,m=b[0])}if(!m)return e;let u=m.map(([b,c])=>({x:b,y:c}));if(u.length>1){let b=u[0],c=u[u.length-1];Math.abs(b.x-c.x)<1e-9&&Math.abs(b.y-c.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function et(e,t,n,o,r=28){let i=[];for(let s=0;s<r;s++){let a=s/r*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function De(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var ei=[{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"}],la=new Map(ei.map(e=>[e.key,e]));var ti={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 gn(e){let t=e?.[0];return t&&ti[t]||"#3b82f6"}var ni=[{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"}],fa=new Map(ni.map(e=>[e.key,e]));var oi=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],ma=new Set(oi);var Mn=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],Sn=Mn.map(e=>e.key),ri=new Map(Mn.map(e=>[e.key,e]));function xn(e){return typeof e=="string"&&ri.has(e)}function wn(e,t){return xn(e)?e:xn(t?.seatGlyph)?t.seatGlyph:"circle"}var ee={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ii=.44,si=.15,ai=.3,ci=.24;function In(e){return e===void 0||!Number.isFinite(e)||e<=0?ci:Math.min(ai,Math.max(si,e*ii))}var ui=.05,vn=.45,li=vn+ui,fi=.92;var ya=[{part:ee.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ee.pad,min:[-1,.36,-.95],max:[1,vn,1]},{part:ee.back,min:[-1,li,-1],max:[1,fi,-.72]},{part:ee.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ee.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ee.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ee.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ee.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ee.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ee.leg,min:[.62,0,.48],max:[.82,.37,.7]}],ga=[{part:ee.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ee.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ee.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ee.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ee.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}];function Rn(e,t,n,o){let r=new Float32Array(t),i=f=>e[f*3],s=f=>e[f*3+2],a=0,m=(f,u)=>{let b=u-f;for(let c=f;c<u;c++){let[l,d]=o(c),h=l-i(c),p=d-s(c);if(b>=2){let y=Math.max(f,c-1),g=Math.min(u-1,c+1),M=i(g)-i(y),x=s(g)-s(y),A=Math.hypot(M,x);if(A>1e-6){let S=-x/A,v=M/A;S*h+v*p<0&&(S=-S,v=-v),h=S,p=v}}r[c]=h===0&&p===0?0:Math.atan2(h,p)}};for(let f=1;f<=t;f++)(f===t||n(f)!==n(a))&&(m(a,f),a=f);return r}var tt=.22;var mi=.42;function di(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,s=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>s&&(s=d.y);let a=Math.max(i-o,1e-6),m=Math.max(s-r,1e-6),f=Math.max(Math.sqrt(a*m/t),1e-6),u=Math.max(1,Math.ceil(a/f)+1),b=Math.max(1,Math.ceil(m/f)+1),c=new Map,l=(d,h)=>{let p=Math.min(u-1,Math.max(0,Math.floor((d-o)/f)));return Math.min(b-1,Math.max(0,Math.floor((h-r)/f)))*u+p};for(let d=0;d<t;d++){let h=l(e[d].x,e[d].y),p=c.get(h);p?p.push(d):c.set(h,[d])}for(let d=0;d<t;d++){let h=e[d],p=Math.min(u-1,Math.max(0,Math.floor((h.x-o)/f))),y=Math.min(b-1,Math.max(0,Math.floor((h.y-r)/f))),g=1/0;for(let M=1;M<=4;M++){for(let x=y-M;x<=y+M;x++)if(!(x<0||x>=b))for(let A=p-M;A<=p+M;A++){if(A<0||A>=u||M>1&&Math.abs(x-y)<M&&Math.abs(A-p)<M)continue;let S=c.get(x*u+A);if(S)for(let v of S){if(v===d)continue;let _=Math.hypot(e[v].x-h.x,e[v].y-h.y);_<g&&(g=_)}}if(Number.isFinite(g)&&g<=M*f)break}n[d]=g}return n}function bi(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-ce):0}function Cn(e,t,n,o,r,i){let s=e.length,a=new Float32Array(s*3),m=new Float32Array(s),f=new Float32Array(s*3),u=new Float32Array(s),b=new Float32Array(s),c=new Float32Array(s),l=new Float32Array(s),d=new Float32Array(s*3),h=new Map,p=di(e);for(let y=0;y<s;y++){let g=e[y],x=(n?.seatPitchU(y)??p[y])*R;u[y]=Number.isFinite(x)?Math.max(.06,Math.min(tt,x*mi)):tt,b[y]=In(Number.isFinite(x)?x:void 0);let A=wn(g.glyph,{seatGlyph:i?.get(g.categoryKey)});c[y]=Sn.indexOf(A),l[y]=g.wheelchairSpaceType==="no-seat"?0:1,a[y*3]=g.x*R,a[y*3+1]=n?n.seatDeckY(y):bi(g),a[y*3+2]=g.y*R,m[y]=un(t?t(g):"available");let S=W(r?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(f[y*3]=S[0],f[y*3+1]=S[1],f[y*3+2]=S[2],g.accessibility?.length){let v=W(gn(g.accessibility));v&&(d[y*3]=v[0],d[y*3+1]=v[1],d[y*3+2]=v[2])}h.set(g.id,y)}return{count:s,iPosition:a,iState:m,iCategory:f,iMaxRadius:u,iRing:d,idToIndex:h,iChairWidth:b,iGlyph:c,iPhysicalSeat:l,iFloor:o??new Float32Array(s),iYaw:new Float32Array(s)}}function hi(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,r=n-e.y,i=Math.hypot(o,r);return i<1e-9?[0,0]:[o/i,r/i]}}}function pi(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let l of e)n+=l.x,o+=l.y,r+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let s=e[0],a=-1;for(let l of e){let d=Math.hypot(l.x-n,l.y-o);d>a&&(a=d,s=l)}let m=s.x-n,f=s.y-o,u=Math.hypot(m,f);u>1e-9?(m/=u,f/=u):(m=1,f=0);let b=[...e].sort((l,d)=>(l.x-n)*m+(l.y-o)*f-((d.x-n)*m+(d.y-o)*f)),c=0;for(let l of b){let d=Math.hypot(l.x-n,l.y-o);d>c&&(c=d)}return{pts:b,cx:n,cy:o,radius:c,depth:r}}function Pn(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let s=o[i],a=o[i+1],m=a.x-s.x,f=a.y-s.y,u=m*m+f*f,b=u>1e-12?((t-s.x)*m+(n-s.y)*f)/u:0;b<0?b=0:b>1&&(b=1);let c=Math.hypot(t-(s.x+b*m),n-(s.y+b*f));c<r&&(r=c)}return r}var nt=8;function yi(e,t,n){let o=new Array(nt).fill(1/0),r=new Array(nt).fill(-1);for(let u=0;u<e.length;u++){let b=e[u],c=Math.hypot(t-b.cx,n-b.cy)-b.radius;for(let l=0;l<nt;l++)if(c<o[l]){for(let d=nt-1;d>l;d--)o[d]=o[d-1],r[d]=r[d-1];o[l]=c,r[l]=u;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let u of r){if(u<0)continue;let b=Pn(e[u],t,n);for(let c=0;c<3;c++)if(b<i[c]){for(let l=2;l>c;l--)i[l]=i[l-1],s[l]=s[l-1];i[c]=b,s[c]=u;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,m=0,f=0;for(let u=0;u<3;u++){let b=s[u];if(b<0||i[u]>a)continue;let c=1/(i[u]*i[u]);m+=c*e[b].depth,f+=c}return f>0?m/f:e[s[0]].depth}function gi(e){let t=(o,r)=>yi(e,o,r),n=(o,r)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let m=e[a];if(Math.hypot(o-m.cx,r-m.cy)-m.radius>=i)continue;let f=Pn(m,o,r);f<i&&(i=f,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,s=(t(o,r+.5)-t(o,r-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function En(e,t){let n=[];for(let o of e){let r=pi(o.points,t);r&&n.push(r)}return n.length<2?hi(t):(n.sort((o,r)=>o.depth-r.depth),gi(n))}var Et=Ie(require("polygon-clipping"),1);var Tn=Ie(require("earcut"),1);var xi=.58,An=.01,se=tt*1.5*me,Mi=.5,Si=.6;function wi(e,t){let n=e.length,o=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],m=e[Math.min(n-1,s+1)],f=m.x-a.x,u=m.y-a.y,b=Math.hypot(f,u);if(b<1e-9){o.push([0,0]);continue}f/=b,u/=b,o.push([-u,f])}let r=0;for(let s=0;s<n;s++)r+=(e[s].x-t.x)*o[s][0]+(e[s].y-t.y)*o[s][1];return r<0?o.map(([s,a])=>[-s,-a]):o}function Ii(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(s,a)=>{let m=a.x-s.x,f=a.y-s.y,u=Math.hypot(m,f)||1;return{x:m/u,y:f/u}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var _n=Math.PI/12;function vi(e){if(e.length<3)return[...e];let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},r=[...o(t),...o([...t].reverse())];return r.length>=3?r:[...e]}function Ln(e,t){if(!e.length||!(t>0))return[];let n=vi(e),o=(a,m,f,u)=>{let b=f-m;for(;b<0;)b+=Math.PI*2;for(;b>Math.PI*2;)b-=Math.PI*2;let c=Math.max(1,Math.ceil(b/_n)),l=t/Math.cos(b/c/2);for(let d=0;d<=c;d++){let h=m+b*d/c;u.push({x:a.x+Math.cos(h)*l,y:a.y+Math.sin(h)*l})}};if(n.length<3){let a=0,m=0;for(let l of n)a+=l.x,m+=l.y;a/=n.length||1,m/=n.length||1;let f=0;for(let l of n)f=Math.max(f,Math.hypot(l.x-a,l.y-m));let u=[],b=Math.max(3,Math.ceil(Math.PI*2/_n)),c=(f+t)/Math.cos(Math.PI/b);for(let l=0;l<b;l++){let d=l/b*Math.PI*2;u.push({x:a+Math.cos(d)*c,y:m+Math.sin(d)*c})}return u}let r=n.length,i=[];for(let a=0;a<r;a++){let m=n[a],f=n[(a+1)%r];i.push(Math.atan2(-(f.x-m.x),f.y-m.y))}let s=[];for(let a=0;a<r;a++)o(n[a],i[(a+r-1)%r],i[a],s);return Nn(s)}function Ri(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,m=s.y-i.y,f=a*a+m*m,u=f>1e-12?((t-i.x)*a+(n-i.y)*m)/f:0;u<0?u=0:u>1&&(u=1);let b=Math.hypot(t-(i.x+u*a),n-(i.y+u*m));b<o&&(o=b)}return o}function ot(e){let t=e.map(r=>{let i=0,s=0;for(let f of r.pts)i+=f.x,s+=f.y;let a=r.pts.length||1;i/=a,s/=a;let m=0;for(let f of r.pts){let u=Math.hypot(f.x-i,f.y-s);u>m&&(m=u)}return{cx:i,cy:s,rad:m}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),s=[],a=1/0,m=null;for(let u of i){let b=1/0;for(let c=0;c<e.length;c++){if(c===r||Math.abs(e[c].y-e[r].y)<.001)continue;let l=t[c],d=Math.hypot(u.x-l.cx,u.y-l.cy)-l.rad;if(d>=b&&d>=a)continue;let h=Ri(e[c].pts,u.x,u.y);h<b&&(b=h),e[c].depth<e[r].depth&&h<a&&(a=h,m=e[c].y)}Number.isFinite(b)&&b>0&&s.push(b)}s.sort((u,b)=>u-b);let f=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:f,belowY:m})}return o}function On(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let u=r.pts[0],b=u.x-o.x,c=u.y-o.y,l=Math.hypot(b,c)||1;b/=l,c/=l;let d=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+c*d,y:u.y-b*d},{x:u.x-c*d,y:u.y+b*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let u=1;u<i.length;u++){let b=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);b>1e-6&&(s+=b,a++)}let m=a>0?s/a:0,f=Ii(i,Math.max(m*Si,se));return{pts:f,nrm:wi(f,o),front:Math.max(n[t].pitch*xi,se),back:Math.max(n[t].pitch*Mi,se)}}var Ce=1.5,Bn=.3;function Ct(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,s=Math.hypot(r,i),a=-1,m=-1;for(let b=1;b<e.length-1;b++){let c=e[b],l=s>1e-12?Math.abs((c.x-n.x)*i-(c.y-n.y)*r)/s:Math.hypot(c.x-n.x,c.y-n.y);l>a&&(a=l,m=b)}if(a<=t||m<0)return[n,o];let f=Ct(e.slice(0,m+1),t),u=Ct(e.slice(m),t);return[...f.slice(0,-1),...u]}function Fn(e,t){if(e.length<4)return e;let n=Ct([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Dn(e,t,n){if(e.length<2)return[];let o=n??ot(e),r=new Map;for(let s=0;s<e.length;s++){let a=r.get(e[s].blockId);a?a.push(s):r.set(e[s].blockId,[s])}let i=[];for(let[,s]of r){let a=[];for(let g of s){let M=e[g].patch;M&&M.length>=3?i.push({outline:[...M],holes:[],topY:e[g].y}):a.push(g)}if(!a.length)continue;a.sort((g,M)=>e[g].depth-e[M].depth);let f=a.map(g=>On(e,g,o,t)).filter(g=>g!==null);if(!f.length)continue;let u=(g,M)=>({x:g.pts[M].x-g.nrm[M][0]*(g.front+Ce),y:g.pts[M].y-g.nrm[M][1]*(g.front+Ce)}),b=(g,M)=>({x:g.pts[M].x+g.nrm[M][0]*(g.back+Ce),y:g.pts[M].y+g.nrm[M][1]*(g.back+Ce)}),c=f[0],l=f[f.length-1],d=[];for(let g=0;g<c.pts.length;g++)d.push(u(c,g));for(let g of f)d.push(b(g,g.pts.length-1));for(let g=l.pts.length-1;g>=0;g--)d.push(b(l,g));for(let g=f.length-1;g>=0;g--)d.push(u(f[g],0));let h=Nn(d),p=1/0;for(let g of a)e[g].y<p&&(p=e[g].y);if(!Number.isFinite(p))continue;if(h.length>=3&&Math.abs(pe(h))>1e-6&&f.every(g=>{let M=g.pts[Math.floor(g.pts.length/2)];return Oe(h,M.x,M.y)})){i.push({outline:Fn(h,Bn),holes:[],topY:p});continue}for(let g of Ci(f))i.push({outline:g,holes:[],topY:p})}return i}function Ci(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Ce,s=n.back+Ce;for(let m=0;m<n.pts.length;m++){let f=n.pts[m],u=n.nrm[m];o.push([f.x-u[0]*i,f.y-u[1]*i]),r.push([f.x+u[0]*s,f.y+u[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=Et.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[0].map(([m,f])=>({x:m,y:f})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&o.push(Fn(i,Bn))}return o}catch{return[]}}function Nn(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Pt=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let o=!0;for(let r of t)if(!Oe(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function kn(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let f=[0,1,0],u=o[0];for(let b=1;b+1<o.length;b++){let c=o[b],l=o[b+1];e.tri([u.x*R,r,u.y*R],[c.x*R,r,c.y*R],[l.x*R,r,l.y*R],f,i)}return}let s=o.map(f=>[f.x,f.y]);s.push(s[0]);let a;try{a=Et.default.intersection([s],t)}catch{return}let m=[0,1,0];for(let f of a){if(!f.length||f[0].length<4)continue;let u=f[0],b=[],c=[];for(let d=0;d<u.length-1;d++)b.push(u[d][0],u[d][1]),c.push([u[d][0],u[d][1]]);if(c.length<3)continue;let l=(0,Tn.default)(b,void 0,2);for(let d=0;d<l.length;d+=3){let h=c[l[d]],p=c[l[d+1]],y=c[l[d+2]];e.tri([h[0]*R,r,h[1]*R],[p[0]*R,r,p[1]*R],[y[0]*R,r,y[1]*R],m,i)}}}function jn(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??ot(t),m=[0,1,0],f=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Pt([[...i]]):null,b=l=>{e.setMaterial(2),l(),e.setMaterial(0)},c=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let d=t[l];if(d.patch&&d.patch.length>=3){let A=[...d.patch],S=a[l].belowY??o;if(c(()=>{if(f&&u)kn(e,f,u,A,d.y,r.tread);else{let v=A[0];for(let _=1;_+1<A.length;_++){let D=A[_],N=A[_+1];e.tri([v.x*R,d.y,v.y*R],[D.x*R,d.y,D.y*R],[N.x*R,d.y,N.y*R],m,r.tread)}}}),d.y>S+An){let v=0,_=0;for(let D of A)v+=D.x,_+=D.y;v/=A.length,_/=A.length,b(()=>{for(let D=0;D<A.length;D++){let N=A[D],G=A[(D+1)%A.length],C=G.x-N.x,w=G.y-N.y,k=Math.hypot(C,w);if(k<1e-6)continue;let B=w/k,I=-C/k;(N.x-v)*B+(N.y-_)*I<0&&(B=-B,I=-I);let T=[B,0,I],P=[N.x*R,d.y,N.y*R],E=[G.x*R,d.y,G.y*R],L=[N.x*R,S,N.y*R],F=[G.x*R,S,G.y*R];e.tri(P,E,F,T,r.riser),e.tri(P,F,L,T,r.riser)}})}continue}let h=On(t,l,a,n);if(!h)continue;let{pts:p,nrm:y,front:g,back:M}=h,x=a[l].belowY??o;for(let A=0;A+1<p.length;A++){let S=p[A],v=p[A+1],_=y[A],D=y[A+1];if(Math.hypot(v.x-S.x,v.y-S.y)<1e-6||_[0]===0&&_[1]===0||D[0]===0&&D[1]===0)continue;let N=[(S.x-_[0]*g)*R,d.y,(S.y-_[1]*g)*R],G=[(v.x-D[0]*g)*R,d.y,(v.y-D[1]*g)*R],C=[(S.x+_[0]*M)*R,d.y,(S.y+_[1]*M)*R],w=[(v.x+D[0]*M)*R,d.y,(v.y+D[1]*M)*R];if(c(()=>{f&&u?kn(e,f,u,[{x:S.x-_[0]*g,y:S.y-_[1]*g},{x:v.x-D[0]*g,y:v.y-D[1]*g},{x:v.x+D[0]*M,y:v.y+D[1]*M},{x:S.x+_[0]*M,y:S.y+_[1]*M}],d.y,r.tread):(e.tri(N,G,w,m,r.tread),e.tri(N,w,C,m,r.tread))}),d.y>x+An){let k=[N[0],x,N[2]],B=[G[0],x,G[2]],I=[-_[0],0,-_[1]];b(()=>{e.tri(N,G,B,I,r.riser),e.tri(N,B,k,I,r.riser)})}}}}function Gn(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function rt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var At=Ie(require("polygon-clipping"),1);function Pi(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Un(e,t){return e.filter(n=>n.type!=="shape"||Pi(n,t))}function Yn(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:Un(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:Un(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Ei={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Pe(e){return Gn(e)??Ei}function Xn(e,t){let n=Je(e.outline,se),o=Pe(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&rt(o,Pe(s.outline)));if(!r.length)return[n];let i=s=>{let a=s.map(m=>[m.x,m.y]);return a.push(a[0]),a};try{let s=At.default.difference([i(n)],...r.map(m=>[i(m.outline)])),a=[];for(let m of s){if(!m.length)continue;let f=m[0].map(([u,b])=>({x:u,y:b}));if(f.length>1){let u=f[0],b=f[f.length-1];Math.abs(u.x-b.x)<1e-9&&Math.abs(u.y-b.y)<1e-9&&f.pop()}f.length>=3&&a.push(f)}return a.length?a:[n]}catch{return[n]}}function Vn(e,t){if(!t.length)return e;let n=i=>{let s=i.map(a=>[a.x,a.y]);return s.push(s[0]),s},o=t.map(i=>[n(i)]),r=[];for(let i of e){let s;try{s=At.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let a of s){if(!a.length)continue;let m=a[0].map(([f,u])=>({x:f,y:u}));if(m.length>1){let f=m[0],u=m[m.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&m.pop()}m.length>=3&&r.push({outline:m,holes:[],topY:i.topY})}}return r.length?r:e}var Ai=.05,Hn=.05,_i=.15,_t=25;function Kn(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),m=new Map,f=[],u=new Set;for(let c=0;c<e.length;c+=1){let l=e[c];for(let d of l.objects){if(d.type==="table"&&u.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let h=Je(d.outline,se);m.set(d.id,{section:d,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),f.push({id:d.id,floorIndex:c,box:Pe(h),section:d,unit:l,outline:h})}}let b=new Map;for(let c of f){let l=b.get(c.floorIndex);l?l.push(c):b.set(c.floorIndex,[c])}for(let c=0;c<t.length;c++){let l=t[c],d=n?b.get(n[c])??[]:f,h=l.sectionId?d.find(y=>y.id===l.sectionId)??d.find(y=>y.section.logicalSectionId===l.sectionId&&he({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,p=h?[h]:d;for(let y of p){if(n&&y.floorIndex!==n[c]||!h&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!he({x:l.x,y:l.y},y.outline,y.section.holes)))continue;r[c]=y.id;let g=m.get(y.id);g.hasSeats=!0;let M=l.focalPoint??y.unit.focal,x=Math.hypot(l.x-M.x,l.y-M.y);x<g.frontU&&(g.frontU=x),g.seatIndices.push(c);let A=l.rowId||`__seat-${c}`,S=g.rows.get(A);S?S.push({x:l.x,y:l.y}):g.rows.set(A,[{x:l.x,y:l.y}]);break}}for(let[c,l]of m){let d=He(l.section,{floorBaseHeightM:l.unit.baseHeightM}),h=l.unit.baseHeightM,p=d.rake>0?Math.tan(d.rake*Math.PI/180):0,y=d.rake<=.01&&d.height<=h+.001,g=l.section.surfaceKind,M=g==="flat"?!0:g==="rakedRows"&&d.rake>.01?!1:y,x=l.hasSeats?Ke(c,t,l.seatIndices,l.unit.focal):{sectionId:c,rows:[],blockCount:0},S=x.rows.length<2?En([...l.rows.values()].map(P=>({points:P})),l.unit.focal):null,v=1/0;if(S){if(l.hasSeats)for(let P of l.rows.values())for(let E of P){let L=S.depthAt(E.x,E.y);L<v&&(v=L)}if(!l.hasSeats||!Number.isFinite(v)){v=1/0;for(let P of l.section.outline){let E=S.depthAt(P.x,P.y);E<v&&(v=E)}}}let _=h+Ai,D=Math.max(_,d.height),N=P=>{let E=Math.max(0,P-v)*te,L=Math.min(E*p,_t);return Math.max(_,d.height+L)},G=P=>{let E=Math.max(0,P)*te,L=Math.min(E*p,_t);return Math.max(_,d.height+L)},C=M?[]:x.rows.map(P=>({pts:P.pts,y:G(P.blockDepth),depth:P.blockDepth,blockId:P.blockId,...u.has(P.id)?{patch:Ln(P.pts,se)}:{}})),w=C.length?C[0].y:D,k=C.map(P=>{let E=P.patch&&P.patch.length>=3?P.patch:P.pts,L=0,F=0;for(let U of E)L+=U.x,F+=U.y;let j=E.length||1;L/=j,F/=j;let Y=0;for(let U of E){let X=Math.hypot(U.x-L,U.y-F);X>Y&&(Y=X)}return{cx:L,cy:F,rad:Y}}),B=M?()=>D:C.length>=2?(P,E)=>{let L=1/0,F=w;for(let j=0;j<C.length;j++){let Y=k[j];if(Math.hypot(P-Y.cx,E-Y.cy)-Y.rad>=L)continue;let U=C[j].patch,X=U&&U.length>=3?Oe(U,P,E)?0:ve(U,P,E):ve(C[j].pts,P,E);X<L&&(L=X,F=C[j].y)}return F}:(P,E)=>S?N(S.depthAt(P,E)):D,I=[0,1,0],T=C.length>=2||M?()=>I:(P,E)=>{if(!S)return I;let L=S.depthAt(P,E);if(L<=v)return I;let F=(L-v)*te;if(F*p>=_t||d.height+F*p<=_)return I;let[j,Y]=S.gradientAt(P,E);if(j===0&&Y===0)return I;let U=1/Math.hypot(p,1);return[-j*p*U,U,-Y*p*U]};if(!M)for(let P of x.rows){let E=G(P.blockDepth);for(let L of P.seatIndices)s[L]=E}for(let P of x.rows){let E=[];for(let U=1;U<P.pts.length;U++){let X=Math.hypot(P.pts[U].x-P.pts[U-1].x,P.pts[U].y-P.pts[U-1].y);X>1e-6&&E.push(X)}E.sort((U,X)=>U-X);let L=E.length?E[Math.floor(E.length/2)]:1/0,F=1/0,j=P.pts[Math.floor(P.pts.length/2)];if(j)for(let U of x.rows){if(U===P||U.blockId!==P.blockId)continue;let X=ve(U.pts,j.x,j.y);X>1e-6&&X<F&&(F=X)}let Y=Math.min(L,Math.max(F,L*.5));if(Number.isFinite(Y)&&Y>0)for(let U of P.seatIndices)a[U]=Y}o.set(c,{sectionId:c,deckAt:B,normalAt:T,flat:M,bottomY:h,rowLevels:C,landingY:w})}for(let c=0;c<t.length;c++){let l=r[c],d=t[c];if(l){let p=s[c];i[c]=(p??o.get(l).deckAt(d.x,d.y))+_i;continue}let h=d.eyeHeightM;i[c]=Number.isFinite(h)?Math.max(0,h-ce):0}return{bySection:o,seatOwner:r,seatDeckY:c=>i[c],seatPitchU:c=>a[c]}}var $={top:1,wallBottom:.5,bottomCap:.4};function ue(e,t){if(!e)return t;let n=ie(Le(e,.4),.62);return ne(t,n,.72)}function zn(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let s=o.get(i.sectionId);s||(s=new Map,o.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,s]of o){let a=0,m=0,f=0,u=0;for(let[b,c]of s){let l=W(n.get(b));l&&(a+=l[0]*c,m+=l[1]*c,f+=l[2]*c,u+=c)}u>0&&r.set(i,[a/u,m/u,f/u])}return r}function Wn(e,t){return W(e.color)??t.get(e.logicalSectionId??e.id)??null}var Zn=Ie(require("polygon-clipping"),1);function ki(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var it=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(m=>[m.x,m.y]);if(o.length<3)return[];o.push(o[0]);let r=Pe(t),i=this.rings.filter((m,f)=>rt(r,this.boxes[f])&&ki(n,this.levels[f])),s=[[o]];if(i.length)try{s=Zn.default.difference([o],...i).map(f=>f.map(u=>u.map(([b,c])=>[b,c])))}catch{s=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let a=[];for(let m of s){if(!m.length)continue;let f=m[0].map(([u,b])=>({x:u,y:b}));if(f.length>1){let u=f[0],b=f[f.length-1];Math.abs(u.x-b.x)<1e-9&&Math.abs(u.y-b.y)<1e-9&&f.pop()}f.length>=3&&a.push(f)}return a}};function Ti(e,t){if(!t)return e;let n=1/0,o=-1/0,r=1/0,i=-1/0;for(let b of e)n=Math.min(n,b.x),o=Math.max(o,b.x),r=Math.min(r,b.y),i=Math.max(i,b.y);let s=(n+o)/2,a=(r+i)/2,m=t*Math.PI/180,f=Math.cos(m),u=Math.sin(m);return e.map(b=>{let c=b.x-s,l=b.y-a;return{x:s+c*f-l*u,y:a+c*u+l*f}})}function ge(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=De(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,o=(e.y??0)+e.height/2;t=et(n,o,e.width/2,e.height/2)}return t?Ti(t,e.rotation):null}function Ne(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},o=t==="stage"&&ze(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var Li=.08;function Qn(e,t){let n=ge(e),o=Ne(e),r=o.heightM;if(!n||o.kind!=="plate"&&o.kind!=="stage")return r;let i=1/0,s=1/0,a=-1/0,m=-1/0;for(let u of n)i=Math.min(i,u.x),s=Math.min(s,u.y),a=Math.max(a,u.x),m=Math.max(m,u.y);let f=r;for(let u of t)a>u.minX&&i<u.maxX&&m>u.minY&&s<u.maxY&&f<=u.topOffsetM+1e-6&&(f=u.topOffsetM+Li);return t.push({minX:i,minY:s,maxX:a,maxY:m,topOffsetM:f}),f}function de(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function $n(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function je(e,t,n){return[de(e[0],e[1],t),de(e[0],e[1],n),de(e[3],e[2],n),de(e[3],e[2],t)]}function qn(e,t,n){return[de(e[0],e[3],t),de(e[1],e[2],t),de(e[1],e[2],n),de(e[0],e[3],n)]}function le(e,t,n,o,r,i){J(e,t,void 0,()=>n,o,r,i,$)}var kt=2.4,Oi=.75,Bi=.15;function Ge(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=n/2,f=o/2;return[[-m,-f],[m,-f],[m,f],[-m,f]].map(([u,b])=>({x:t.x+u*s-b*a,y:t.y+u*a+b*s}))}function Jn(e,t,n,o,r){let i=Ge(t);i&&J(e,i,void 0,()=>n+kt,n,ue(o,r.boothTop),r.boothWall,$)}function Tt(e){if(e.shape==="round"){let u=e.radius;return u?et(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=t/2,f=n/2;return[[-m,-f],[m,-f],[m,f],[-m,f]].map(([u,b])=>({x:r.x+u*s-b*a,y:r.y+u*a+b*s}))}function eo(e,t,n,o,r){let i=Tt(t);i&&J(e,i,void 0,()=>n+Oi,n,ue(o,r.tableTop),r.tableWall,$)}function to(e,t,n,o,r,i,s,a){let m=ge(t);if(!m)return;let f=a?a.kind==="stage":t.role==="stage",u=a?a.kind==="screen":t.role==="screen",b=a?{kind:f?"stage":"solid",heightM:a.topY-a.baseY}:Ne(t),c=a?.baseY??n,l=a?.topY??n+o;if(f&&s){let g=1/0,M=-1/0,x=1/0,A=-1/0;for(let S of m)S.x<g&&(g=S.x),S.x>M&&(M=S.x),S.y<x&&(x=S.y),S.y>A&&(A=S.y);s.push({cx:(g+M)/2*R,cz:(x+A)/2*R,y:l,halfX:Math.max((M-g)/2*R,.5),halfZ:Math.max((A-x)/2*R,.5)})}let d=W(t.fill),h=f&&d?ne(r.stageTop,ie(Le(d,.18),.9),.9):ue(d,f?r.stageTop:r.decorTop),p=u?d:null,y=f?d?ne(r.stageWall,ie(d,.58),.82):r.stageWall:u?p?ne(ie(p,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ue(W(t.fill),r.decorWall);if(b.kind==="portal"&&m.length===4){let g=$n(m);le(e,je(g,0,.16),l,c,h,y),le(e,je(g,.84,1),l,c,h,y),le(e,g,l,Math.max(c,l-.35),h,y);return}if(b.kind==="suite"&&m.length===4){let g=m.map((A,S)=>{let v=m[(S+1)%4],_=(A.x+v.x)/2,D=(A.y+v.y)/2;return Math.hypot(_-i.x,D-i.y)}),M=g.indexOf(Math.min(...g)),x=[0,1,2,3].map(A=>m[(M+A)%4]);le(e,je(x,0,.08),l,c,h,y),le(e,je(x,.92,1),l,c,h,y),le(e,qn(x,.88,1),l,c,h,y),le(e,x,l,Math.max(c,l-.18),h,y);return}le(e,m,l,c,h,y)}function Lt(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,s=n+r/2,a=(e.rotation??0)*Math.PI/180,m=Math.cos(a),f=Math.sin(a),u=o/2,b=r/2;return[[-u,-b],[u,-b],[u,b],[-u,b]].map(([c,l])=>({x:i+c*m-l*f,y:s+c*f+l*m}))}function Fi(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return W(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let m=W(a[1].trim());m&&s.push(m)}return s.length?s.reduce((a,m,f)=>ne(a,m,1/(f+1)),s[0]):null}function no(e,t,n,o){if(t.layer==="foreground")return;let r=Lt(t);if(!r)return;let i=n+Bi,s=ue(Fi(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=ne(o.ground,s,a)),J(e,r,void 0,()=>i,n,s,ne(s,o.decorWall,.5),$)}function oo(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=ue(o,r.gaTop);J(e,t.points,t.holes,()=>n+.15,n,i,r.gaWall,$)}var Di=Math.PI/180,K=96,Ni=6,ji=60,Gi=150,ro=.2,Ui=.35;function Yi(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Di;return n<0?n+360:n}function st(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function at(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let s=0,a=0;for(let m=-n;m<=n;m++){let f=i+m;if(t)f=(f%o+o)%o;else if(f<0||f>=o)continue;s+=e[f],a++}r[i]=s/a}return r}function io(e,t){let n=e.filter(c=>c.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,s=0;for(let c of n)for(let l of c.rows){for(let d of l.pts)r+=d.x,i+=d.y,s++;if(l.pts.length>=4){let d=gt(l.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!s)return null;let a={x:r/s,y:i/s},m=a;if(o.length>=8){let c=st(o.map(y=>y.x)),l=st(o.map(y=>y.y)),d=0;for(let y of n)for(let g of y.rows)for(let M of g.pts){let x=Math.hypot(M.x-a.x,M.y-a.y);x>d&&(d=x)}let h=0,p=d*.2;for(let y of n)for(let g of y.rows)for(let M of g.pts)Math.hypot(M.x-c,M.y-l)<p&&h++;Math.hypot(c-a.x,l-a.y)<=d&&h/s<.01&&(m={x:c,y:l})}let f=[];for(let c of n){let l={sectionId:c.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of c.rows)for(let h of d.pts){let p=Math.hypot(h.x-m.x,h.y-m.y),y=Math.min(K-1,Math.floor(Yi(m,h)/(360/K)));l.samples.push({r:p,bin:y,levelM:d.levelM}),p<l.rMin&&(l.rMin=p),p>l.rMax&&(l.rMax=p)}l.samples.length&&f.push(l)}if(!f.length)return null;f.sort((c,l)=>c.rMin+c.rMax-(l.rMin+l.rMax));let u=[];for(let c of f){let l=!1;for(let d of u){let h=Math.min(c.rMax,d.rMax)-Math.max(c.rMin,d.rMin),p=Math.min(c.rMax-c.rMin,d.rMax-d.rMin);if(p>1e-9&&h>=Ui*p){d.members.push(c),d.rMin=Math.min(d.rMin,c.rMin),d.rMax=Math.max(d.rMax,c.rMax),l=!0;break}}l||u.push({members:[c],rMin:c.rMin,rMax:c.rMax})}let b=[];for(let c of u){let l=new Array(K).fill(null);for(let w of c.members)for(let k of w.samples){let B=l[k.bin];B||(B={samples:[]},l[k.bin]=B),B.samples.push({r:k.r,levelM:k.levelM})}let d=l.map(w=>!!w);if(!d.filter(Boolean).length)continue;let p=[],y=[];for(let w of l){if(!w)continue;let k=1/0,B=-1/0;for(let I of w.samples)I.r<k&&(k=I.r),I.r>B&&(B=I.r);p.push(k),y.push(B)}let g=st(p),M=st(y);if(!(g>=ro*M)||!(M>0))continue;let x=[...p].sort((w,k)=>w-k);if(!(x[Math.floor(x.length*.1)]>=ro*M))continue;let S=l.map(w=>{if(!w)return null;let k=[...w.samples].sort((j,Y)=>j.r-Y.r),B=k[0].r,I=k[k.length-1].r,T=k[0].levelM,P=-1/0;for(let j of k)j.levelM>P&&(P=j.levelM);let E=[];for(let j of k){let Y={r:j.r,l:j.levelM};for(;E.length&&Math.abs(E[E.length-1].r-Y.r)<1e-9;){if(E[E.length-1].l<=Y.l){Y.skip=!0;break}E.pop()}if(!Y.skip){for(;E.length>=2;){let U=E[E.length-2],X=E[E.length-1];if((X.r-U.r)*(Y.l-U.l)-(X.l-U.l)*(Y.r-U.r)<=0)E.pop();else break}E.push(Y)}}let L=E.map(j=>j.r),F=E.map(j=>j.l);return{inner:B,outer:I,front:T,top:P,profile:{rs:L,ls:F}}}),v=d.slice();for(let w=0;w<K;w++){if(v[w])continue;let k=-1,B=-1,I=0;for(let O=1;O<=K;O++){let V=(w-O+K*2)%K;if(v[V]){k=V;break}}for(let O=1;O<=K;O++){let V=(w+O)%K;if(v[V]){B=V,I=O;break}}if(k<0||B<0)continue;let T=0;for(let O=1;O<=K;O++){let V=(w-O+K*2)%K;if(d[V]){T=O;break}}if(T-1+I>Ni)continue;let E=S[k],L=S[B],F=T/(T+I),j=E.inner+(L.inner-E.inner)*F,Y=E.outer+(L.outer-E.outer)*F,U=E.front+(L.front-E.front)*F,X=E.top+(L.top-E.top)*F;S[w]={inner:j,outer:Y,front:U,top:X,profile:{rs:[j,Y],ls:[U,X]}}}for(let w=0;w<K;w++)S[w]&&(v[w]=!0);let _=360/K,D=[],N=v.filter(Boolean).length,G=[];if(N===K)G.push({start:0,len:K});else{let w=0;for(;v[w];)w=(w+1)%K;let k=-1;for(let B=0;B<=K;B++){let I=(w+B)%K,T=B<K&&v[I];if(T&&k<0)k=I;else if(!T&&k>=0){let P=(I-k+K)%K||K;G.push({start:k,len:P}),k=-1}}}for(let w of G){if(w.len*_<ji&&w.len<K)continue;let k=w.len===K,B=new Float64Array(w.len),I=new Float64Array(w.len),T=new Float64Array(w.len),P=new Float64Array(w.len),E=[];for(let O=0;O<w.len;O++){let V=S[(w.start+O)%K];B[O]=V.inner,I[O]=V.outer,T[O]=V.front,P[O]=V.top,E.push(V.profile??{rs:[V.inner,V.outer],ls:[V.front,V.top]})}let L=at(B,k),F=at(I,k),j=at(T,k),Y=at(P,k);for(let O=0;O<w.len;O++)L[O]>B[O]&&(L[O]=B[O]),F[O]<I[O]&&(F[O]=I[O]),L[O]>F[O]-1e-6&&(L[O]=Math.max(0,F[O]-1e-6)),Y[O]<j[O]&&(Y[O]=j[O]);let U={startBin:w.start,binCount:w.len,closed:k,innerR:L,outerR:F,frontLevelM:j,topLevelM:Y,profiles:E},X=(O,V,H)=>{let Q=E[O],Z=Q.rs,z=Q.ls;if(V<=Z[0]){z[0]>H&&(z[0]=H);return}if(V>=Z[Z.length-1]){z[z.length-1]>H&&(z[z.length-1]=H);return}for(let q=0;q+1<Z.length;q++)if(V<=Z[q+1]){z[q]>H&&(z[q]=H),z[q+1]>H&&(z[q+1]=H);return}};for(let O=0;O<w.len;O++){let V=l[(w.start+O)%K];if(V)for(let H of V.samples){X(O,H.r,H.levelM);let Q=k?(O-1+w.len)%w.len:O-1,Z=k?(O+1)%w.len:O+1;Q>=0&&X(Q,H.r,H.levelM),Z<w.len&&X(Z,H.r,H.levelM)}}D.push(U)}D.reduce((w,k)=>w+k.binCount*_,0)<Gi||b.push({arcs:D,sectionIds:c.members.map(w=>w.sectionId),innerRMedian:g,outerRMedian:M})}if(!b.length)return null;if(b.sort((c,l)=>c.innerRMedian-l.innerRMedian),t){let c=b[b.length-1].outerRMedian;if(Math.hypot(t.x-m.x,t.y-m.y)>.9*c)return null}return{centre:m,binCount:K,binStepDeg:360/K,rings:b}}function so(e,t,n,o){let r=e.binStepDeg,i=n/r-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),m=i-s,f=u=>{let b=t.profiles[u],c=b.rs,l=b.ls;if(o<=c[0])return l[0];if(o>=c[c.length-1])return l[l.length-1];for(let d=0;d+1<c.length;d++)if(o<=c[d+1]){let h=c[d+1]-c[d],p=h>1e-9?(o-c[d])/h:0;return l[d]+(l[d+1]-l[d])*p}return l[l.length-1]};return f(s)*(1-m)+f(a)*m}var Xi=.25,Vi=1.2,Hi=.6,Ki=.45,zi=2.3,Wi=Math.PI/180;function xe(e,t,n){let o=n*Wi;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function Zi(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let r of e){if(r.role!=="wall")continue;let i=r.points&&r.points.length>=2?r.points:r.x!==void 0&&r.y!==void 0&&r.width!==void 0&&r.height!==void 0?[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.height}]:[];if(i.length<2)continue;let s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=o&&s++;if(s>=i.length/2)return!0}return!1}var Qi=24;function $i(e,t,n,o,r,i,s,a){let m=n.binCount,f=Qi,u=te,b=i+.02,c=[];for(let C=0;C<m;C++){let w=(n.startBin+C+.5)*t.binStepDeg,k=new Float64Array(f+1);for(let B=0;B<=f;B++){let I=o[C]+(r[C]-o[C])*B/f;k[B]=Math.max(b,so(t,n,w,I)-Xi)}c.push(k)}let l=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],d=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],h=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],p=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],y=(C,w)=>{let k=(n.startBin+C+.5)*t.binStepDeg,B=o[C]+(r[C]-o[C])*w/f,I=xe(t.centre,B,k);return[I.x*u,c[C][w],I.y*u]};{let C=Math.tan(12*Math.PI/180);for(let w=0;w<6;w++){let k=!1;for(let I=0;I<m;I++)for(let T=f-1;T>=0;T--)c[I][T]>c[I][T+1]&&(c[I][T]=c[I][T+1],k=!0);let B=n.closed?m:m-1;for(let I=0;I<B;I++){let T=(I+1)%m;for(let P=0;P<=f;P++){let E=c[T][P]-c[I][P];if(Math.abs(E)>1)continue;let L=o[I]+(r[I]-o[I])*P/f,F=o[T]+(r[T]-o[T])*P/f,j=xe(t.centre,L,(n.startBin+I+.5)*t.binStepDeg),Y=xe(t.centre,F,(n.startBin+T+.5)*t.binStepDeg),U=C*Math.hypot(Y.x-j.x,Y.y-j.y)*u;E>U?(c[T][P]=c[I][P]+U,k=!0):-E>U&&(c[I][P]=c[T][P]+U,k=!0)}}if(!k)break}}let g=1,M=(C,w)=>{for(let k=0;k<=f;k+=4)if(Math.abs(c[C][k]-c[w][k])>g)return!0;return Math.abs(c[C][f]-c[w][f])>g},x=Math.tan(38*Math.PI/180),A=C=>(r[C]-o[C])/f*u,S=(C,w)=>c[C][w+1]-c[C][w]>x*Math.max(1e-6,A(C)),v=(C,w)=>{let k=n.closed?(C-1+m)%m:Math.max(0,C-1),B=n.closed?(C+1)%m:Math.min(m-1,C+1);Math.abs(c[k][w]-c[C][w])>g&&(k=C),Math.abs(c[B][w]-c[C][w])>g&&(B=C);let I=Math.max(0,w-1),T=Math.min(f,w+1);I<w&&S(C,I)&&(I=w),T>w&&S(C,w)&&(T=w);let P=y(k,w),E=y(B,w),L=y(C,I),F=y(C,T),j=E[0]-P[0],Y=E[1]-P[1],U=E[2]-P[2],X=F[0]-L[0],O=F[1]-L[1],V=F[2]-L[2],H=Y*V-U*O,Q=U*X-j*V,Z=j*O-Y*X,z=Math.hypot(H,Q,Z);return z>1e-12?(H/=z,Q/=z,Z/=z,Q<0&&(H=-H,Q=-Q,Z=-Z),[H,Q,Z]):[0,1,0]},_=(C,w)=>{let k=[C[0],i,C[2]],B=[w[0],i,w[2]],I=w[0]-C[0],T=w[2]-C[2],P=Math.hypot(I,T);if(!(P>1e-12))return;let E=[T/P,0,-I/P];e.tri(C,w,B,E,h,h,p),e.tri(C,B,k,E,h,p,p)},D=.05*me,N=C=>r[C]-o[C]<D,G=n.closed?m:m-1;for(let C=0;C<G;C++){let w=(C+1)%m;if(N(C)||N(w))continue;if(M(C,w)){let E=(n.startBin+C+1)*t.binStepDeg,L=(O,V)=>{let H=(o[C]+o[w])/2,Q=(r[C]+r[w])/2,Z=H+(Q-H)*V/f,z=xe(t.centre,Z,E);return[z.x*u,c[O][V],z.y*u]};for(let O=0;O<f;O++){let V=y(C,O),H=y(C,O+1),Q=L(C,O),Z=L(C,O+1),z=v(C,O),q=v(C,O+1);e.triN(V,Q,Z,z,z,q,l),e.triN(V,Z,H,z,q,q,l);let Ue=y(w,O),Ye=y(w,O+1),Me=L(w,O),Ee=L(w,O+1),Se=v(w,O),we=v(w,O+1);e.triN(Me,Ue,Ye,Se,Se,we,l),e.triN(Me,Ye,Ee,Se,we,we,l);let fe=L(C,O),ae=L(C,O+1),Xe=L(w,O+1),ut=L(w,O),Ve=ae[0]-fe[0],Ae=ae[2]-fe[2],lt=Math.hypot(Ve,Ae);if(lt>1e-12){let Bt=[Ae/lt,0,-Ve/lt];e.tri(fe,ae,Xe,Bt,h),e.tri(fe,Xe,ut,Bt,h)}}let F=y(C,0),j=y(w,0),Y=y(w,f),U=y(C,f),X=O=>[O[0],i,O[2]];e.tri(X(F),X(Y),X(j),[0,-1,0],d),e.tri(X(F),X(U),X(Y),[0,-1,0],d),_(F,j),_(U,Y);continue}for(let E=0;E<f;E++){let L=v(C,E),F=v(w,E),j=v(w,E+1),Y=v(C,E+1);if(S(C,E)||S(w,E)){let H=(ae,Xe)=>{let ut=(n.startBin+ae+.5)*t.binStepDeg,Ve=o[ae]+(r[ae]-o[ae])*(E+.5)/f,Ae=xe(t.centre,Ve,ut);return[Ae.x*u,Xe,Ae.y*u]},Q=y(C,E),Z=y(w,E),z=H(C,c[C][E]),q=H(w,c[w][E]);e.triN(Q,Z,q,L,F,F,l),e.triN(Q,q,z,L,F,L,l);let Ue=y(w,E+1),Ye=y(C,E+1),Me=H(C,c[C][E+1]),Ee=H(w,c[w][E+1]);e.triN(Me,Ee,Ue,Y,j,j,l),e.triN(Me,Ue,Ye,Y,j,Y,l);let Se=q[0]-z[0],we=q[2]-z[2],fe=Math.hypot(Se,we);if(fe>1e-12){let ae=[-we/fe,0,Se/fe];e.tri(z,q,Ee,ae,h),e.tri(z,Ee,Me,ae,h)}continue}let U=y(C,E),X=y(w,E),O=y(w,E+1),V=y(C,E+1);e.triN(U,X,O,L,F,j,l),e.triN(U,O,V,L,j,Y,l)}let k=y(C,0),B=y(w,0),I=y(w,f),T=y(C,f),P=E=>[E[0],i,E[2]];e.tri(P(k),P(I),P(B),[0,-1,0],d),e.tri(P(k),P(T),P(I),[0,-1,0],d),_(k,B),_(T,I)}if(!n.closed)for(let C of[0,m-1])for(let w=0;w<f;w++)_(y(C,w),y(C,w+1))}function ao(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let b of u.arcs){let c=new Float64Array(b.binCount),l=new Float64Array(b.binCount);for(let h=0;h<b.binCount;h++){let p=(b.startBin+h)%t.binCount,y=Math.max(0,b.innerR[h]-se);c[h]=Math.max(y,s[p]+.001),l[h]=Math.max(c[h]+.001,b.outerR[h]+se)}let d=0;for(let h=0;h<b.binCount;h++){let p=b.topLevelM[h]-o;p>d&&(d=p)}d>=Vi&&$i(e,t,b,c,l,o,r,i);for(let h=0;h<b.binCount;h++){let p=(b.startBin+h)%t.binCount;l[h]>s[p]&&(s[p]=l[h])}}if(n.deriveShell===!1||Zi(n.shapes,t))return;let a=t.rings[t.rings.length-1],m=Hi*me,f=Ki*me;for(let u of a.arcs){let b=[],c=[];for(let h=0;h<u.binCount;h++){let p=(u.startBin+h+.5)*t.binStepDeg,y=u.outerR[h]+se+m;b.push(xe(t.centre,y,p)),c.push(xe(t.centre,y+f,p))}let l=-1/0;for(let h=0;h<u.binCount;h++)u.topLevelM[h]>l&&(l=u.topLevelM[h]);let d=()=>l+zi;u.closed?J(e,c,[b.slice().reverse()],d,o,r.shellTop,r.shellWall,i):J(e,[...c,...b.slice().reverse()],void 0,d,o,r.shellTop,r.shellWall,i)}}function co(e,t,n,o,r,i,s,a){if(!t.outline||t.outline.length<3)return;let m=n.baseHeightM,f=ue(o,a.tierTop);if(!r)return;let u=p=>r.deckAt(p.x,p.y),b=Xn(t,s),c=b[0]??t.outline;if(r.rowLevels.length>=2){let p=ot(r.rowLevels),y=Vn(Dn(r.rowLevels,n.focal,p),b),g=()=>[0,1,0];for(let x of y){let A=Math.max(m,x.topY-.02);for(let S of i.subtract(x.outline,A))J(e,S,x.holes,()=>A,m,f,a.tierWall,$,void 0,g)}y.length||J(e,c,t.holes,()=>r.landingY,m,f,a.tierWall,$);let M={tread:[f[0]*$.top,f[1]*$.top,f[2]*$.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let x of b.length?b:[c])jn(e,r.rowLevels,n.focal,r.landingY,M,x,p);return}let l=r.flat?1/0:Hn,d=p=>r.normalAt(p.x,p.y),h=r.flat?r.landingY:void 0;for(let p of i.subtract(c,h))J(e,p,t.holes,u,m,f,a.tierWall,$,l,d)}function qi(e,t,n){let o=new Set;for(let s of e.objects)s.type==="section"&&o.add(s.id);let r=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!o.has(a))continue;let m=n.bySection.get(a);if(m&&m.rowLevels.length>=2)continue;let f=t[s],u=r.get(a);u||(u=new Map,r.set(a,u));let b=f.rowId||`__seat-${s}`,c=u.get(b);c||(c={pts:[],levelM:0,n:0},u.set(b,c)),c.pts.push({x:f.x,y:f.y}),c.levelM+=n.seatDeckY(s),c.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let f=a.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));f.length>=2&&i.push({sectionId:s.id,rows:f});continue}let m=r.get(s.id);m&&i.push({sectionId:s.id,rows:[...m.values()].map(f=>({pts:f.pts,levelM:f.levelM/f.n}))})}return i}function uo(e,t,n,o,r,i,s=!0){let a=qi(t,n,o);if(!a.length)return;let m=io(a,t.focal);m&&(e.setMaterial(0),ao(e,m,{bottomY:t.baseHeightM,colors:{bandTop:ie(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??ie(r.tierWall,1.15),shellWall:i??r.tierWall},ao:$,shapes:t.objects.filter(f=>f.type==="shape"),deriveShell:s}))}var Ji=6,es=2.2,lo=.1,ts=.3,ns=1.8,os=.9,rs=.55,is=6e3;function fo(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,s=t.zones??[],a=[];if(s.length){let m=new Map;for(let u of n)for(let b of u.objects)b.type==="section"&&b.zone&&m.set(b.id,b.zone);let f=new Map;for(let u=0;u<o.length;u++){let b=o[u],c=r.seatOwner[u],l=b.zoneId??(c?m.get(c):void 0);if(!l)continue;let d=f.get(l);d||(d={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},f.set(l,d)),d.n++,b.x<d.minX&&(d.minX=b.x),b.y<d.minY&&(d.minY=b.y),b.x>d.maxX&&(d.maxX=b.x),b.y>d.maxY&&(d.maxY=b.y),d.sumY+=r.seatDeckY(u)}for(let u of s){let b=f.get(u.id),c=[];for(let[l,d]of m)d===u.id&&c.push(l);if(!b||b.n===0){a.push({id:u.id,label:u.label,color:W(u.color),sectionIds:c,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*R,1.5,(u.focalPoint??i).y*R]});continue}a.push({id:u.id,label:u.label,color:W(u.color),sectionIds:c,seatCount:b.n,center:[(b.minX+b.maxX)/2*R,b.sumY/b.n,(b.minY+b.maxY)/2*R],radius:.5*Math.hypot((b.maxX-b.minX)*R,(b.maxY-b.minY)*R)||1,focalWorld:[(u.focalPoint??i).x*R,1.5,(u.focalPoint??i).y*R]})}}return a}function mo(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:m}=e,f=[],u=[],b=[];for(let c of a)c.seatCount!==0&&f.push({id:`zone:${c.id}`,kind:"zone",text:c.label,anchor:[c.center[0],c.center[1]+Ji,c.center[2]],color:t.zones?.find(l=>l.id===c.id)?.color});{let c=new Map,l=new Map;for(let d=0;d<o.length;d++){let h=r.seatOwner[d];if(!h)continue;let p=c.get(h);p||(p={n:0,x:0,y:0,deck:0},c.set(h,p)),p.n++,p.x+=o[d].x,p.y+=o[d].y,p.deck+=r.seatDeckY(d);let y=l.get(h);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(h,y)),o[d].x<y.minX&&(y.minX=o[d].x),o[d].x>y.maxX&&(y.maxX=o[d].x),o[d].y<y.minY&&(y.minY=o[d].y),o[d].y>y.maxY&&(y.maxY=o[d].y)}for(let d of n)for(let h of d.objects){if(h.type!=="section")continue;let p=c.get(h.id);if(!p||p.n===0)continue;let y=l.get(h.id),g=[p.x/p.n*R,p.deck/p.n,p.y/p.n*R],M=h.displayLabel||h.label||h.id;u.push({id:h.id,floorIndex:d.index,label:M,seatCount:p.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*R),focalWorld:[d.focal.x*R,d.baseHeightM+1.5,d.focal.y*R]});let x=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();n.length>1&&x===M.trim().toLocaleLowerCase()||f.push({id:`section:${h.id}`,kind:"section",text:M,anchor:[g[0],g[1]+es,g[2]],floorIndex:d.index})}}{for(let d of n)for(let h of d.objects){if(h.type!=="gaArea")continue;let p=_e(h.points);if(!p)continue;let y=h.displayLabel||h.label||h.id;f.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${y} \xB7 ${h.capacity.toLocaleString()}`:y,anchor:[p.x*R,d.baseHeightM+ns,p.y*R],floorIndex:d.index})}let c=new Map;for(let d=0;d<o.length;d++){let h=o[d],p=Math.hypot(h.x-m.x,h.y-m.y),y=c.get(h.rowId);(!y||p>y.far)&&c.set(h.rowId,{seat:h,index:d,far:p})}for(let[d,h]of c){let p=h.seat.label?h.seat.label.lastIndexOf("-"):-1,y=p>0?h.seat.label.slice(0,p):d;y&&f.push({id:`row:${d}`,kind:"row",text:y,anchor:[h.seat.x*R,r.seatDeckY(h.index)+os,h.seat.y*R],floorIndex:s[h.index]})}let l=new Map;for(let d=0;d<o.length;d++){let h=o[d],p=h.label?h.label.lastIndexOf("-"):-1,y=l.get(h.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:p>0?h.label.slice(0,p):h.rowId,sectionId:h.sectionId},l.set(h.rowId,y));let g=d*3,M=i.iPosition[g],x=i.iPosition[g+1],A=i.iPosition[g+2];y.n++,y.x+=M,y.y+=x,y.z+=A,y.minX=Math.min(y.minX,M),y.maxX=Math.max(y.maxX,M),y.minZ=Math.min(y.minZ,A),y.maxZ=Math.max(y.maxZ,A)}for(let[d,h]of l)b.push({id:d,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(o.length<=is)for(let d=0;d<o.length;d++){let h=o[d],p=h.displayLabel||h.label;p&&f.push({id:`seat:${h.id}`,kind:"seat",text:p,anchor:[h.x*R,r.seatDeckY(d)+rs,h.y*R],floorIndex:s[d]})}}for(let c of n)for(let l of c.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let d=ge(l),h=d?_e(d):null;if(!h||!l.label)continue;f.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[h.x*R,c.baseHeightM+Ne(l).heightM+lo,h.y*R],color:l.fill,floorIndex:c.index})}else if(l.type==="text"){if(!l.text)continue;f.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*R,c.baseHeightM+lo,l.position.y*R],color:l.color,rotation:l.rotation,floorIndex:c.index})}else if(l.type==="booth"){let d=Ge(l);if(!d)continue;let h=_e(d);if(!h)continue;f.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[h.x*R,c.baseHeightM+kt+ts,h.y*R],floorIndex:c.index})}return{labels:f,sections:u,rows:b}}function bo(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function ho(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:s,seatFloor:a}=e,m=[];{let f=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let c=0;c<i.floor.length;c+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[c]))),d=c*3,h=f[l];h.minX=Math.min(h.minX,i.position[d]),h.minY=Math.min(h.minY,i.position[d+1]),h.minZ=Math.min(h.minZ,i.position[d+2]),h.maxX=Math.max(h.maxX,i.position[d]),h.maxY=Math.max(h.maxY,i.position[d+1]),h.maxZ=Math.max(h.maxZ,i.position[d+2])}let u=new Map;for(let c=0;c<n.length;c++)for(let l of n[c].objects)l.type==="section"&&u.set(l.id,c);let b=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let c=0;c<o.length;c++){let l=r.seatOwner[c],d=(l!==null?u.get(l):void 0)??s[c];if(d===void 0)continue;let h=b[d],p=o[c];h.n++,p.x<h.minX&&(h.minX=p.x),p.y<h.minY&&(h.minY=p.y),p.x>h.maxX&&(h.maxX=p.x),p.y>h.maxY&&(h.maxY=p.y);let y=r.seatDeckY(c);h.sumX+=p.x*R,h.sumDeck+=y,h.sumZ+=p.y*R,h.minDeck=Math.min(h.minDeck,y),h.maxDeck=Math.max(h.maxDeck,y+1.6),a[c]=d}for(let c=0;c<n.length;c++){let l=b[c],d=t.floors?.[c],h=f[c],p=Math.min(l.n?l.minX*R:n[c].focal.x*R-1,Number.isFinite(h.minX)?h.minX:1/0),y=Math.max(l.n?l.maxX*R:n[c].focal.x*R+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(l.n?l.minY*R:n[c].focal.y*R-1,Number.isFinite(h.minZ)?h.minZ:1/0),M=Math.max(l.n?l.maxY*R:n[c].focal.y*R+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),x=Math.min(l.n?Math.min(n[c].baseHeightM,l.minDeck):n[c].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),A=Math.max(l.n?Math.max(l.maxDeck,x+.5):x+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[l.n?l.sumX/l.n:(p+y)/2,l.n?l.sumDeck/l.n:(x+A)/2,l.n?l.sumZ/l.n:(g+M)/2],v=Math.max(1,.5*Math.hypot(y-p,A-x,M-g));m.push({index:c,id:d?.id??`floor-${c}`,label:d?.name??(n.length>1?`Floor ${c+1}`:"Venue"),seatCount:l.n,center:S,radius:v,box:{min:[p,x,g],max:[y,A,M]},focalWorld:[n[c].focal.x*R,n[c].baseHeightM+1.5,n[c].focal.y*R]})}}return m}function Ot(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,s=(a,m)=>{a<n&&(n=a),m<o&&(o=m),a>r&&(r=a),m>i&&(i=m)};for(let a of t)s(a.x,a.y);for(let a of e)for(let m of a.objects)if(m.type==="section")for(let f of m.outline)s(f.x,f.y);else if(m.type==="shape"&&m.points)for(let f of m.points)s(f.x,f.y);else if(m.type==="gaArea")for(let f of m.points)s(f.x,f.y);else if(m.type==="booth"){let f=Ge(m);if(f)for(let u of f)s(u.x,u.y)}else if(m.type==="table"){let f=Tt(m);if(f)for(let u of f)s(u.x,u.y)}else if(m.type==="decorImage"){let f=Lt(m);if(f)for(let u of f)s(u.x,u.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function po(e,t,n,o,r,i){if(t.length===1){let s=Math.max(60,(r.maxX-r.minX+r.maxY-r.minY)*.06),a=De(r.minX-s,r.minY-s,r.maxX-r.minX+s*2,r.maxY-r.minY+s*2);J(e,a,void 0,()=>0,-.4,i.ground,i.ground,$)}else{let s=t.reduce((l,d)=>d.baseHeightM<l.baseHeightM?d:l);e.setFloor(s.index);let a=n.filter((l,d)=>o[d]===s.index),m=Ot([s],a),f=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),u=Math.max(28,Math.min(80,f*.04)),b=De(m.minX-u,m.minY-u,m.maxX-m.minX+u*2,m.maxY-m.minY+u*2),c=s.baseHeightM-.03;J(e,b,void 0,()=>c,c-.22,i.ground,i.ground,$)}}function yo(e,t,n){let{cx:o,cz:r,radius:i}=n,s=1/0,a=1/0,m=1/0,f=-1/0,u=-1/0,b=-1/0,c=(h,p,y)=>{s=Math.min(s,h),f=Math.max(f,h),a=Math.min(a,p),u=Math.max(u,p),m=Math.min(m,y),b=Math.max(b,y)};for(let h=0;h<e.position.length;h+=3)c(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let p=h*3,y=t.iPosition[p],g=t.iPosition[p+1],M=t.iPosition[p+2],x=Math.max(.35,t.iMaxRadius[h]??.35);c(y-x,g,M-x),c(y+x,g+1.6,M+x)}Number.isFinite(s)||(s=o-i,f=o+i,a=0,u=i*.16,m=r-i,b=r+i);let l=[(s+f)/2,(a+u)/2,(m+b)/2],d=Math.max(1,.5*Math.hypot(f-s,u-a,b-m));return{center:l,radius:d,minY:a,maxY:u}}function go(e,t,n,o,r,i){let s=1/0,a=1/0,m=-1/0,f=-1/0;for(let x=0;x<e.count;x++){let A=x*3,S=e.iPosition[A],v=e.iPosition[A+2];S<s&&(s=S),S>m&&(m=S),v<a&&(a=v),v>f&&(f=v)}for(let x of t)s=Math.min(s,x.cx-x.halfX),m=Math.max(m,x.cx+x.halfX),a=Math.min(a,x.cz-x.halfZ),f=Math.max(f,x.cz+x.halfZ);let u=n.minX*R,b=n.maxX*R,c=n.minY*R,l=n.maxY*R,d=u,h=b,p=c,y=l;if(Number.isFinite(s)){let x=Math.max(2,.06*Math.hypot(m-s,f-a));d=Math.max(u,s-x),h=Math.min(b,m+x),p=Math.max(c,a-x),y=Math.min(l,f+x)}let g=Math.min(0,o),M=Math.max(r,i*.05);return{min:[d,g,p],max:[h,M,y]}}function xo(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=Zt(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let b of n)for(let c of b.objects)c.type==="shape"&&i.set(c.id,{shape:c,unit:b});let s=new Set,a=new Set,m=new Map((t.overlay.productionElements??[]).map(b=>{let c=b.runtimeContentImageUrl;return[b.id,typeof c=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(c)?c:void 0]})),f=[];for(let b of r.value.overlay.productionElements??[]){let c=i.get(b.objectId),l=c?ge(c.shape):null,d=b.baseElevationM??0;if(!c||!l||l.length<3||!b.id||s.has(b.id)||a.has(b.objectId)||!Number.isFinite(b.heightM)||b.heightM<.05||b.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();s.add(b.id),a.add(b.objectId);let h=l.map(_=>_.x*R),p=l.map(_=>_.y*R),y=c.unit.baseHeightM+d,g=Math.min(...h),M=Math.max(...h),x=Math.min(...p),A=Math.max(...p),S,v=m.get(b.id)??b.contentImageUrl;if(b.kind==="screen"&&v)if(M-g>=A-x){let _=Math.abs(x-c.unit.focal.y*R)<=Math.abs(A-c.unit.focal.y*R)?x-.006:A+.006;S=[[g,y,_],[M,y,_],[g,y+b.heightM,_],[M,y+b.heightM,_]]}else{let _=Math.abs(g-c.unit.focal.x*R)<=Math.abs(M-c.unit.focal.x*R)?g-.006:M+.006;S=[[_,y,x],[_,y,A],[_,y+b.heightM,x],[_,y+b.heightM,A]]}f.push({id:b.id,objectId:b.objectId,kind:b.kind,floorIndex:c.unit.index,baseY:y,topY:y+b.heightM,bounds:{min:[g,y,x],max:[M,y+b.heightM,A]},occlusion:b.occlusion,...v?{contentImageUrl:v}:{},...S?{contentPlane:S}:{}})}let u=f.sort((b,c)=>b.id.localeCompare(c.id));return{byObjectId:new Map(u.map(b=>[b.objectId,b])),elements:u}}function re(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oe(e){return Array.isArray(e)?e:[]}function ss(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!re(n))continue;let o=re(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function ct(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function as(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function cs(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let r=0;r<4;r++)for(let i=0;i<4;i++)n[o*4+r]+=e[i*4+r]*t[o*4+i];return n}function us(e){let t=ct(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:ct(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:ct(e.rotation,4),r=e.scale===void 0?[1,1,1]:ct(e.scale,3);if(!n||!o||!r)return null;let[i,s,a,m]=o,f=Math.hypot(i,s,a,m);if(!(f>1e-8))return null;let u=i/f,b=s/f,c=a/f,l=m/f,d=u+u,h=b+b,p=c+c,y=u*d,g=u*h,M=u*p,x=b*h,A=b*p,S=c*p,v=l*d,_=l*h,D=l*p;return[(1-(x+S))*r[0],(g+D)*r[0],(M-_)*r[0],0,(g-D)*r[1],(1-(y+S))*r[1],(A+v)*r[1],0,(M+_)*r[2],(A-v)*r[2],(1-(y+x))*r[2],0,n[0],n[1],n[2],1]}function ls(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function fs(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],s=e[9],a=e[2],m=e[6],f=e[10],u=i*f-s*m,b=s*a-r*f,c=r*m-i*a,l=t*u+n*b+o*c;if(Math.abs(l)<1e-12)return null;let d=1/l;return[u*d,b*d,c*d,(o*m-n*f)*d,(t*f-o*a)*d,(n*a-t*m)*d,(n*s-o*i)*d,(o*r-t*s)*d,(t*i-n*r)*d]}function Mo(e,t,n,o){let r=e[0]*t+e[1]*n+e[2]*o,i=e[3]*t+e[4]*n+e[5]*o,s=e[6]*t+e[7]*n+e[8]*o,a=Math.hypot(r,i,s)||1;return r/=a,i/=a,s/=a,[r,i,s]}function ms(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,o=null,r=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),s=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let a=e.subarray(n,n+i);if(s===1313821514&&!o)try{let m=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!re(m))return null;o=m}catch{return null}else if(s===5130562&&!r)r=a;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function ds(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function bs(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function hs(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function ps(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=ms(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!re(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=oe(o.extensionsUsed).filter(x=>typeof x=="string");if(i.includes("KHR_draco_mesh_compression")||ss(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||oe(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(oe(o.images).length||oe(o.textures).length)return{ok:!1,issue:"external_resource"};let s=oe(o.buffers);if(s.length!==1||!re(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let a=oe(o.accessors),m=oe(o.bufferViews),f=oe(o.meshes),u=oe(o.nodes),b=oe(o.scenes),c=typeof o.scene=="number"?o.scene:0;if(!re(b[c]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(x,A,S)=>{if(typeof x!="number"||!Number.isInteger(x)||!re(a[x]))return null;let v=a[x];if(v.type!==A||v.sparse!==void 0||v.normalized===!0||typeof v.count!="number"||!Number.isInteger(v.count)||v.count<1||typeof v.componentType!="number"||!S.includes(v.componentType)||typeof v.bufferView!="number")return null;let _=m[v.bufferView];if(!re(_)||_.buffer!==0||typeof _.byteLength!="number"||!Number.isInteger(_.byteLength)||_.byteLength<0)return null;let D=bs(v.type),N=ds(v.componentType),G=typeof _.byteStride=="number"?_.byteStride:D*N,C=typeof _.byteOffset=="number"?_.byteOffset:0,w=typeof v.byteOffset=="number"?v.byteOffset:0,k=C+w,B=w+(v.count-1)*G+D*N;if(!Number.isInteger(G)||!Number.isInteger(C)||!Number.isInteger(w)||G<D*N||C<0||w<0||C+_.byteLength>r.byteLength||B>_.byteLength)return null;let I=[];for(let T=0;T<v.count;T++){let P=[];for(let E=0;E<D;E++){let L=hs(l,k+T*G+E*N,v.componentType);if(!Number.isFinite(L))return null;P.push(L)}I.push(P)}return I},h=[],p=[],y=0,g=new Set,M=(x,A)=>{if(typeof x!="number"||!Number.isInteger(x)||!re(u[x])||g.has(x))return!1;g.add(x);let S=u[x],v=us(S);if(!v)return!1;let _=cs(A,v),D=fs(_);if(!D)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let N=f[S.mesh];if(!re(N))return!1;for(let G of oe(N.primitives)){if(!re(G)||G.mode!==void 0&&G.mode!==4||!re(G.attributes))return!1;let C=d(G.attributes.POSITION,"VEC3",[5126]),w=G.attributes.NORMAL===void 0?null:d(G.attributes.NORMAL,"VEC3",[5126]);if(!C||G.attributes.NORMAL!==void 0&&!w)return!1;let k=C.length;if(G.indices!==void 0){let I=typeof G.indices=="number"?a[G.indices]:null;k=re(I)?I.count:void 0}if(typeof k!="number"||!Number.isInteger(k)||k%3!==0||(y+=k/3,y>1e5))return!1;let B=G.indices===void 0?C.map((I,T)=>[T]):d(G.indices,"SCALAR",[5121,5123,5125]);if(!B||B.length%3!==0||B.length!==k)return!1;for(let I=0;I<B.length;I+=3){let T=[B[I][0],B[I+1][0],B[I+2][0]];if(T.some(L=>!Number.isInteger(L)||L<0||L>=C.length))return!1;let P=T.map(L=>ls(_,...C[L])),E=null;if(!w){let L=P[1][0]-P[0][0],F=P[1][1]-P[0][1],j=P[1][2]-P[0][2],Y=P[2][0]-P[0][0],U=P[2][1]-P[0][1],X=P[2][2]-P[0][2];E=Mo([1,0,0,0,1,0,0,0,1],F*X-j*U,j*Y-L*X,L*U-F*Y)}for(let L=0;L<3;L++)h.push(...P[L]),p.push(...w?Mo(D,...w[T[L]]):E)}}}for(let N of oe(S.children))if(!M(N,_))return!1;return g.delete(x),!0};for(let x of oe(b[c].nodes))if(!M(x,as()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||h.length!==y*9||p.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(h),normal:new Float32Array(p)}}function So(e){try{return ps(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function wo(e){let{doc:t}=e,n=mn(t.theme),o=n.structure,r=Yn(t,e.eventConfigurationId??t.eventConfigurationId),i=xo(e.eventConfigurationId,e.eventConfiguration,r),s=e.seats,a=new qe,m=null;if(e.registeredShellGlb){let I=So(e.registeredShellGlb);if(I.ok){let T=I.position.length/3,P=new Float32Array(I.position.length),E=n.materials.shell??o.tierWall;for(let L=0;L<T;L++){let F=I.normal[L*3+1],j=F<-.25?.4:.62+.38*Math.max(0,F);P[L*3]=E[0]*j,P[L*3+1]=E[1]*j,P[L*3+2]=E[2]*j}m={position:I.position,normal:I.normal,color:P,floor:new Float32Array(T).fill(-2),material:new Float32Array(T),count:T}}}let f=new Map;for(let I of r)for(let T of I.objects)f.set(T.id,I.index),T.type==="section"&&f.set(T.logicalSectionId??T.id,I.index);let u=s.map(I=>f.get(I.sectionId??"")??f.get(I.rowId??"")??0),b=Ot(r,s);po(a,r,s,u,b,o);let c=zn(t,s),l=new Map,d=new Map;for(let I of t.categories??[])l.set(I.key,I.color),I.seatGlyph&&d.set(I.key,I.seatGlyph);let h=[],p=Kn(r,s,u),y=new Float32Array(s.length),g=[];for(let I=0;I<r.length;I++){let T=r[I];a.setFloor(I);let P=new it,E=[],L=T.objects.filter(F=>F.type==="section"&&!!F.outline&&F.outline.length>=3);for(let F of T.objects)if(F.type==="section"){let j=a.vertexCount;co(a,F,T,Wn(F,c),p.bySection.get(F.id),P,L,o);let Y=a.vertexCount-j;Y>0&&g.push({sectionId:F.id,start:j,count:Y})}else if(F.type==="shape"){let j=i.byObjectId.get(F.id);a.setMaterial((j?.kind??F.role)==="screen"?1:0),to(a,F,T.baseHeightM,Qn(F,E),o,T.focal,h,j),a.setMaterial(0)}else F.type==="gaArea"?oo(a,F,T.baseHeightM,W(l.get(F.categoryKey)),o):F.type==="booth"?Jn(a,F,T.baseHeightM,W(l.get(F.categoryKey)),o):F.type==="table"?eo(a,F,T.baseHeightM,W(l.get(F.categoryKey)),o):F.type==="decorImage"&&no(a,F,T.baseHeightM,o);uo(a,T,s,p,o,n.materials.shell,!m)}let M=r.length>1?{x:r.reduce((I,T)=>I+T.focal.x,0)/r.length,y:r.reduce((I,T)=>I+T.focal.y,0)/r.length}:t.focalPoint??{x:(b.minX+b.maxX)/2,y:(b.minY+b.maxY)/2},x=yn(m?[a.build(),m]:[a.build()]),A=Cn(s,e.initialState,p,y,l,d),S=fo({doc:t,units:r,seats:s,surfaces:p,focal:M}),{labels:v,sections:_,rows:D}=mo({doc:t,units:r,seats:s,surfaces:p,seatData:A,hintedSeatFloor:u,zones:S,focal:M}),N=ho({doc:t,units:r,seats:s,surfaces:p,solids:x,hintedSeatFloor:u,seatFloor:y});bo(v,N),A.iYaw=Rn(A.iPosition,s.length,I=>s[I].rowId,I=>{let T=r[y[I]]?.focal??M;return[T.x*R,T.y*R]});let G=(b.minX+b.maxX)/2*R,C=(b.minY+b.maxY)/2*R,w=.5*Math.hypot((b.maxX-b.minX)*R,(b.maxY-b.minY)*R)||10,k=yo(x,A,{cx:G,cz:C,radius:w}),B=go(A,h,b,k.minY,k.maxY,w);return{solids:x,sectionSolidRanges:g,seats:A,bounds:{center:[(B.min[0]+B.max[0])/2,(B.min[1]+B.max[1])/2,(B.min[2]+B.max[2])/2],radius:w,groundY:0,box:B},renderBounds:{center:k.center,radius:k.radius},stateColorLUT:dn(n,Ze),theme:n,seatCount:s.length,focalWorld:[M.x*R,1.5,M.y*R],zones:S,stages:h,productionElements:i.elements,sections:_,rows:D,labels:v,floors:N}}function ys(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(n=>n.buffer)}var Io=self;Io.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??cn(e.data.doc),r=wo({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});Io.postMessage({model:r,buildMs:performance.now()-t,...n?{seats:o}:{}},ys(r))};
1
+ "use strict";var vo=Object.create;var Dt=Object.defineProperty;var Ro=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var Po=Object.getPrototypeOf,Eo=Object.prototype.hasOwnProperty;var Ao=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Co(t))!Eo.call(e,r)&&r!==n&&Dt(e,r,{get:()=>t[r],enumerable:!(o=Ro(t,r))||o.enumerable});return e};var Ie=(e,t,n)=>(n=e!=null?vo(Po(e)):{},Ao(t||!e||!e.__esModule?Dt(n,"default",{value:e,enumerable:!0}):n,e));var xs=Math.PI/180;function ft(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function _e(e){return e.length?ft(e):null}function Nt(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+s*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+s*e.end.y}}function jt(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[Nt(e,.5)];let o=Array.from({length:n+1},(m,f)=>Nt(e,f/n)),r=new Float64Array(o.length);for(let m=1;m<o.length;m+=1){let f=o[m].x-o[m-1].x,u=o[m].y-o[m-1].y;r[m]=r[m-1]+Math.hypot(f,u)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let m=0;m<t;m+=1){let f=i*m/(t-1);for(;a<r.length-1&&r[a]<f;)a+=1;let u=r[a-1],b=r[a],c=b===u?0:(f-u)/(b-u);s.push({x:o[a-1].x+(o[a].x-o[a-1].x)*c,y:o[a-1].y+(o[a].y-o[a-1].y)*c})}return s}function Gt(e,t,n){return Math.max(t,Math.min(n,e))}function Ut(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((c,l)=>c.segmentedRow.componentIndex-l.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((c,l)=>c.segmentedRow?.kind==="segmented-row-v1"&&c.segmentedRow.groupId===o&&c.segmentedRow.componentCount===s&&c.segmentedRow.componentIndex===l&&c.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(l===0?c.segmentedRow.boundaryBefore==="start":c.segmentedRow.boundaryBefore!=="start")&&c.segmentedRow.displayLabel===a.displayLabel)))continue;let f=i.reduce((c,l)=>c+l.seatCount,0),u=0,b=0;for(let c of i)c.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(c.id,{groupId:o,adjacencyOffset:u,displayOffset:b,displayLabel:a.displayLabel,totalSeats:f,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),u+=c.seatCount,b+=c.seatCount}return t}var _o="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var ko="abcdefghijklmnopqrstuvwxyz";function To(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function mt(e,t=!1){let n=t?ko:_o;return To(Math.max(0,Math.floor(e)-1),n)}var Lo=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Yt(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of Lo)for(;t>=o;)n+=r,t-=o;return n}function Oo(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function dt(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=e.seatNumbering?.endAt,m=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(m/2),d=i==="updown"?t<l?n+2*t:n-1+2*(m-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${s}${d}`}let f=i==="odd"||i==="even"?2:r,u=a!=null&&Number.isFinite(a)?a-(m-1)*f:n,b=o==="center"?Oo(m)[t]:o==="rtl"?m-1-t:t,c;switch(i){case"odd":{let l=u%2===1?u:u+1;c=String(l+b*2);break}case"even":{let l=u%2===0?u:u+1;c=String(l+b*2);break}case"roman":c=Yt(u+b*r);break;case"letters-upper":c=mt(u+b*r,!1);break;case"letters-lower":c=mt(u+b*r,!0);break;default:c=String(u+b*r);break}return`${s}${c}`}function Bo(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Xt(e,t,n){return n?.label??`${e.label}-${dt(e,t)}`}function bt(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(!n)return`${e.displayLabel||e.label}-${dt(e,t)}`;let r=Bo(n),i=n.displayOffset+t;return`${n.displayLabel}-${dt(r,i)}`}var te=.02291666666666667,me=1/te,Fo=58,Do=Fo*te;var No=3,Vt=0,ht=120,jo=0,Go=45,Uo=7,ce=1.2;function pt(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Yo(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Uo?e:No}function He(e,t={}){let n=pt(t.floorBaseHeightM,Vt,ht,0),o=Math.min(ht,n+Yo(e.elevation)*Do),r=e.height===void 0?o:pt(e.height,Vt,ht,o),i=pt(e.rake,jo,Go,0);return{height:r,rake:i}}function Ht(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 ve(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 o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,m=s.y-i.y,f=a*a+m*m,u=f>1e-12?((t-i.x)*a+(n-i.y)*m)/f:0;u<0?u=0:u>1&&(u=1);let b=Math.hypot(t-(i.x+u*a),n-(i.y+u*m));b<o&&(o=b)}return o}function Xo(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>r&&(r=s)}return{cx:t,cy:n,r}}function Kt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function yt(e,t){let n=1/0;for(let o of Ht(e)){let r=ve(t,o.x,o.y);r<n&&(n=r)}for(let o of Ht(t)){let r=ve(e,o.x,o.y);r<n&&(n=r)}return n}function Vo(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let u of e)n+=u.x,o+=u.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let u of e){let b=Math.hypot(u.x-n,u.y-o);b>r&&(r=b,i=u)}let s=i.x-n,a=i.y-o,m=Math.hypot(s,a);m>1e-9?(s/=m,a/=m):(s=1,a=0);let f=e.map((u,b)=>({p:u,i:b,t:(u.x-n)*s+(u.y-o)*a})).sort((u,b)=>u.t-b.t);return{pts:f.map(u=>u.p),seatIndices:f.map(u=>t[u.i])}}function gt(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let g of e)n+=g.x,o+=g.y;n/=t,o/=t;let r=0,i=0,s=0,a=0,m=0,f=0,u=0;for(let g of e){let M=g.x-n,x=g.y-o;r+=M*M,s+=x*x,i+=M*x,a+=M*M*M,m+=x*x*x,f+=M*x*x,u+=x*M*M}let b=r*s-i*i;if(Math.abs(b)<1e-9)return null;let c=(a+f)/2,l=(m+u)/2,d=(c*s-l*i)/b,h=(l*r-c*i)/b,p=d+n,y=h+o;return!Number.isFinite(p)||!Number.isFinite(y)?null:{cx:p,cy:y}}var Ho=.15;function Ko(e){if(e.length<2)return null;let t=e.map(g=>{let M=0,x=0;for(let A of g.pts)M+=A.x,x+=A.y;return{x:M/g.pts.length,y:x/g.pts.length}}),n=0,o=0;for(let g of t)n+=g.x,o+=g.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let g of t){let M=g.x-n,x=g.y-o;r+=M*M,i+=M*x,s+=x*x}let a=r+s,m=r*s-i*i,f=a/2+Math.sqrt(Math.max(0,a*a/4-m)),u,b;Math.abs(i)>1e-12?(u=f-s,b=i):r>=s?(u=1,b=0):(u=0,b=1);let c=Math.hypot(u,b);if(!(c>1e-12))return null;u/=c,b/=c;let l=1/0,d=-1/0,h=[];for(let g of e){let M=1/0,x=-1/0;for(let A of g.pts){let S=A.x*u+A.y*b;S<M&&(M=S),S>x&&(x=S),S<l&&(l=S),S>d&&(d=S)}h.push(x-M)}let p=d-l;return p>1e-9?(h.sort((g,M)=>g-M),h[Math.min(h.length-1,Math.floor(h.length*.9))]/p<=zo?{x:u,y:b}:null):null}var zo=.35;function Ke(e,t,n,o){let r=new Map;for(let p of n){let y=t[p],g=y.rowId||`__seat-${p}`,M=r.get(g);M||(M={pts:[],idx:[]},r.set(g,M)),M.pts.push({x:y.x,y:y.y}),M.idx.push(p)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[p,y]of r){let g=Vo(y.pts,y.idx),M=0;for(let x of g.pts)M+=Math.hypot(x.x-o.x,x.y-o.y);i.push({id:p,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/g.pts.length})}let s=i.map(p=>Xo(p.pts)),a=[];for(let p=0;p<i.length;p++){let y=1/0;for(let g=0;g<i.length;g++){if(p===g||Kt(s[p],s[g])>=y)continue;let M=yt(i[p].pts,i[g].pts);M<y&&(y=M)}Number.isFinite(y)&&a.push(y)}a.sort((p,y)=>p-y);let m=a.length?a[Math.floor(a.length/2)]:1,f=Math.max(m*1.8,1e-6),u=i.map(()=>[]);for(let p=0;p<i.length;p++)for(let y=p+1;y<i.length;y++)Kt(s[p],s[y])>f||yt(i[p].pts,i[y].pts)<=f&&(u[p].push(y),u[y].push(p));let b=0;for(let p=0;p<i.length;p++){if(i[p].blockId!==-1)continue;let y=b++,g=[p];for(i[p].blockId=y;g.length;){let M=g.pop();for(let x of u[M])i[x].blockId===-1&&(i[x].blockId=y,g.push(x))}}let c=new Map;for(let p of i){let y=c.get(p.blockId)??[];y.push(p),c.set(p.blockId,y)}let l=[];for(let p of i){if(p.pts.length<4)continue;let y=gt(p.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||l.push({x:y.cx,y:y.cy}))}let d=l.length>=2?(()=>{let p=l.map(M=>M.x).sort((M,x)=>M-x),y=l.map(M=>M.y).sort((M,x)=>M-x),g=Math.floor(l.length/2);return{cx:p[g],cy:y[g]}})():null;if(d){let p=S=>Math.hypot(S.x-d.cx,S.y-d.cy),y=1/0,g=-1/0,M=[];for(let S of i){let v=1/0,_=-1/0;for(let D of S.pts){let N=p(D);N<v&&(v=N),N>_&&(_=N)}M.push(_-v),v<y&&(y=v),_>g&&(g=_)}let x=g-y;M.sort((S,v)=>S-v);let A=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(x>1e-9&&A/x<=Ho){let S=i.map(I=>{let T=0;for(let P of I.pts)T+=p(P);return{row:I,radius:T/I.pts.length}}),v=0,_=0;for(let I of S)v+=I.radius,_+=I.row.focalDistance;v/=S.length,_/=S.length;let D=0;for(let I of S)D+=(I.radius-v)*(I.row.focalDistance-_);if(D<0)for(let I of S)I.radius=-I.radius;let G=1/0;for(let I of S)I.radius<G&&(G=I.radius);S.sort((I,T)=>I.radius-T.radius);let C=-1,w=-1/0,k=x/Math.max(1,S.length)*.5,B=[];for(let I of S)I.radius-w>k&&(C++,w=I.radius),I.row.ordinal=C,I.row.blockDepth=I.radius-G,B.push(I.row);return{sectionId:e,rows:B,blockCount:b}}}let h=[];for(let[,p]of c){let y=Ko(p);if(y){let g=x=>{let A=0;for(let S of x.pts)A+=S.x*y.x+S.y*y.y;return A/x.pts.length};p.sort((x,A)=>g(x)-g(A)),p.length>=2&&p[0].focalDistance>p[p.length-1].focalDistance&&p.reverse();let M=0;for(let x=0;x<p.length;x++)x>0&&(M+=yt(p[x-1].pts,p[x].pts)),p[x].ordinal=x,p[x].blockDepth=M,h.push(p[x])}else{let g=1/0;for(let M of p)M.focalDistance<g&&(g=M.focalDistance);p.sort((M,x)=>M.focalDistance-x.focalDistance);for(let M=0;M<p.length;M++)p[M].ordinal=M,p[M].blockDepth=Math.max(0,p[M].focalDistance-g),h.push(p[M])}}return{sectionId:e,rows:h,blockCount:b}}var Wo=/^\d{4}-\d{2}-\d{2}$/;function Zo(e){let t=Date.parse(e);return Number.isFinite(t)?Wo.test(e)?t+864e5:t:null}function Qo(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=Zo(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function $o(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function qo(e){return e.status!=="draft"&&e.status!=="retracted"}function Jo(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function zt(e,t={}){return!!e&&qo(e)&&$o(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Jo(e,t.activeBasisSha256)&&Qo(e,t.now)}var _s=Math.PI*2;function ze(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var er=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,tr=/[\s"'<>`\\]/;function nr(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return er.test(e);if(tr.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Wt(e){let t=e.trim();return nr(t)?t:null}var xt="seatlayer.event-configuration/1";var Re=100,or=120,rr=1e5,ir=1e4,sr=/^[a-f0-9]{64}$/,ar=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function cr(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Zt(e){return!Array.isArray(e)||e.length>rr||!e.every(t=>be(t,Re))?null:[...new Set(e)].sort()}function ur(e){return!ke(e)||!be(e.chartId,Re)||!be(e.version,Re)||e.sha256!==void 0&&(typeof e.sha256!="string"||!sr.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Mt(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function lr(e){return ke(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Mt(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function fr(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>ir)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!ke(a)||!be(a.id,Re)||!be(a.objectId,Re)||!n.has(a.objectId)||!ar.has(String(a.kind))||!Mt(a.heightM,.05,50)||a.baseElevationM!==void 0&&!Mt(a.baseElevationM,-10,100))return null;let m=lr(a.occlusion);if(!m||o.has(a.id)||r.has(a.objectId))return null;let f=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Wt(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!f||a.kind!=="screen"||++i>1))return null;o.add(a.id),r.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:m,...f?{contentImageUrl:f}:{}})}return s.sort((a,m)=>a.id.localeCompare(m.id))}function mr(e){let t=[];if(!ke(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==xt&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${xt}`}),be(e.id,Re)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),be(e.label,or)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),cr(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=ur(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 o=ke(e.overlay)?e.overlay:null,r=Zt(o?.objectIds),i=Zt(o?.productionKillSeatIds),s=r?fr(o?.productionElements,r):null;return(!o||!r||!i)&&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||!r||!i||s===null?{issues:t}:{issues:t,value:{schema:xt,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function Qt(e){let t=mr(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function dr(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,o=e.width,r=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r},{x:t,y:n+r}]}function br(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*r-a*i,y:t.y+s*i+a*r}}function $t(e){let t=dr(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(m=>br(m,{x:t.reduce((f,u)=>f+u.x,0)/t.length,y:t.reduce((f,u)=>f+u.y,0)/t.length},n)),r=1/0,i=1/0,s=-1/0,a=-1/0;for(let m of o)r=Math.min(r,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x),a=Math.max(a,m.y);return!Number.isFinite(r)||s-r<1e-6||a-i<1e-6?null:{minX:r,minY:i,maxX:s,maxY:a}}var hr=5,pr=3,yr=.92,gr=1.9,xr=2,Mr=.6,Sr=1,wr=.06;function Ir(e){return e.heightM!==void 0?e.heightM:ze(e.stageKind)?wr:Sr}function qt(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of tn(e)){let a=s.baseHeightM??0;for(let m of s.objects){if(m.type!=="shape"||m.role!=="stage")continue;let f=$t(m);f&&(t=Math.min(t,f.minX),n=Math.min(n,f.minY),o=Math.max(o,f.maxX),r=Math.max(r,f.maxY),i=Math.max(i,a+Ir(m)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function vr(e,t,n,o){let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(r=Math.min(r,l.x),s=Math.max(s,l.x),i=Math.min(i,l.y),a=Math.max(a,l.y));if(!Number.isFinite(r))return null;let m=r*t,f=i*t,u=Math.max(1,Math.ceil((s-r)*t/n)+1),b=Math.max(1,Math.ceil((a-i)*t/n)+1),c=new Float64Array(u*b).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let d=l.eyeHeightM-ce,h=Math.min(u-1,Math.max(0,Math.floor((l.x*t-m)/n))),y=Math.min(b-1,Math.max(0,Math.floor((l.y*t-f)/n)))*u+h,g=d+o;g>c[y]&&(c[y]=g)}return{cellM:n,minX:m,minY:f,cols:u,rows:b,top:c}}function Rr(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),r=Math.floor((n-e.minY)/e.cellM);return o<0||r<0||o>=e.cols||r>=e.rows?-1/0:e.top[r*e.cols+o]}function Jt(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??te,i=n.cellM??Mr,s=n.chairBackM??yr,a=n.selfRowSkipM??xr,m=n.clearThreshold??.9,f=n.partialThreshold??.25,u=Math.max(1,n.columns??hr),b=Math.max(1,n.rows??pr),c=vr(e,r,i,s);if(!c)return o;let l=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,h=l>=d,p=(t.minX+t.maxX)/2*r,y=(t.minY+t.maxY)/2*r,g=[];for(let x=0;x<u;x++){let A=(x+.5)/u-.5,S=h?p+A*l:p,v=h?y:y+A*d;for(let _=0;_<b;_++){let D=t.deckTopM+(b===1?0:_/(b-1)*gr);g.push({x:S,y:v,z:D})}}let M=i/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let A=x.x*r,S=x.y*r,v=x.eyeHeightM,_=0,D=1/0;for(let G of g){let C=G.x-A,w=G.y-S,k=Math.hypot(C,w);if(!(k>a)){_++;continue}let B=C/k,I=w/k,T=0;for(let P=a;P<k;P+=M){let E=Rr(c,A+B*P,S+I*P);if(!(!Number.isFinite(E)||E>=v)&&E>v+(G.z-v)*P/k){T=P;break}}T?D=Math.min(D,T):_++}let N=_/g.length;N>=m||o.set(x.id,{seatId:x.id,mark:N<f?"obstructedView":"restrictedView",visibleFraction:N,totalRays:g.length,atDistanceM:Number.isFinite(D)?D:0})}return o}function en(e,t){if(!t.size)return 0;let n=0;for(let o of e){let r=t.get(o.id);if(!r)continue;let i=o.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(o.commercial={...i,[r.mark]:!0},n++)}return n}function St(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var We=Math.PI/180;var Te=16;function It(e,t,n,o){let r=n*We,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function Cr(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return jt(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let f=0;f<t;f++)s.push(It(f*n,0,r,i));return s}let a=o/(t-1)*We,m=n/(2*Math.sin(Math.abs(a)/2));for(let f=0;f<t;f++){let u=f*a,b=m*Math.sin(u),c=-m+m*Math.cos(u);s.push(It(b,c,r,i))}return s}function Pr(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Er(e,t){let n=Pr(e);return Cr(e).map((o,r)=>{let i=n.get(r),s=St(i),a=Xt(e,r,i),m={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:a,displayLabel:bt(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(m).some(f=>f!==void 0&&f!==!1&&f!=="")?m:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function an(e){let t=[];for(let n of Er(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 Ar(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function _r(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(u=>[u.index,u])),r=(u,b,c,l)=>{let d=o.get(u),h=St(d),p=d?.label??`${e.label}-${u+1}`,y=e.displayLabel??e.label;return{index:u,label:p,displayLabel:d?.displayLabel??`${y}-${u+1}`,x:b+(d?.dx??0),y:c+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Te,b=e.rotation*We,c=Math.max(0,Math.min(360,e.seatArc??360));if(c>=360||n===1){for(let p=0;p<n;p++){let y=b+p/n*2*Math.PI;t.push(r(p,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let l=c*We,d=(2*Math.PI-l)/2,h=b+d;for(let p=0;p<n;p++){let y=h+p/(n-1)*l;t.push(r(p,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let i=e.width??80,s=e.height??50,a=Ar(e),m=["top","bottom","left","right"],f=0;for(let u of m){let b=a[u];for(let c=0;c<b;c++){let l,d;u==="top"?(l=-i/2+(c+.5)*i/b,d=-s/2-Te):u==="bottom"?(l=-i/2+(c+.5)*i/b,d=s/2+Te):u==="left"?(l=-i/2-Te,d=-s/2+(c+.5)*s/b):(l=i/2+Te,d=-s/2+(c+.5)*s/b);let h=It(l,d,e.rotation,e.center);t.push(r(f++,h.x,h.y,u))}}return t}function kr(e){return _r(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 Tr(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 nn(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,s=t[o].y,a=t[r].x,m=t[r].y;s>e.y!=m>e.y&&e.x<(a-i)*(e.y-s)/(m-s)+i&&(n=!n)}return n}function Lr(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),a=(r.x-n.x)**2+(r.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function he(e,t,n){return nn(e,t)&&!(n??[]).some(o=>nn(e,o)||Lr(e,o))}function wt(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function Or(e){switch(e.type){case"row":{let t=an(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return wt(e.points);case"section":return wt(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?wt(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 on(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Br(e,t){if(e.type!=="gaArea"||!on(e.points,t.outline))return!1;let n=e.holes??[],o=t.holes??[];return n.length===o.length&&n.every((r,i)=>on(r,o[i]))}function Fr(e,t){let n=e.filter(s=>s.type==="section"),o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,r=Or(t);return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(Br(t,s)||he(r,s.outline,s.holes))):void 0)??n.find(s=>he(r,s.outline,s.holes))}function tn(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 rn(e,t,n,o,r,i,s,a,m){let f=[],u=Ut(e),b=d=>!d?.eventConfigurationId||d.eventConfigurationId===o&&(d.eventConfigurationVersion===void 0||d.eventConfigurationVersion===m),c=d=>zt(d,{activeConfigurationId:o,activeConfigurationVersion:m,activeBasisSha256:r,now:a}),l=(d,h)=>c(d)?{...d,coverage:h}:void 0;for(let d of e){let h=[];if(d.type==="row"?h=an(d):d.type==="table"?h=kr(d):d.type==="booth"&&(h=Tr(d)),!h.length)continue;for(let x of h)x.viewUrl&&!b(x.viewMeta)&&(x.viewUrl=void 0,x.viewMeta=void 0);if(d.type==="row"){let x=u.get(d.id);if(x){let A=new Map((d.overrides??[]).map(S=>[S.index,S]));for(let S of h){let v=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(v))continue;S.logicalRowId=x.groupId,S.logicalSeatIndex=x.adjacencyOffset+v,A.get(v)?.displayLabel||(S.displayLabel=bt(d,v,x)),!S.viewUrl&&x.viewFromSeatUrl&&b(x.viewFromSeatMeta)&&(S.viewUrl=x.viewFromSeatUrl,S.viewMeta=x.viewFromSeatMeta);let _=A.get(v)?.confidenceEvidence;S.confidenceEvidence=l(_,"exact-seat")??l(d.confidenceEvidence,"row-representative")??l(x.confidenceEvidence,"row-representative")}}}let p=Fr(e,d),y=p?.viewFromSeatUrl,M=(p?.zone?t?.find(x=>x.id===p.zone):void 0)?.focalPoint??n;for(let x of h){if(!x.confidenceEvidence){let A=Number(x.id.slice(x.id.lastIndexOf(":")+1)),S=(d.type==="row"||d.type==="table")&&Number.isInteger(A)?d.overrides?.find(v=>v.index===A)?.confidenceEvidence:void 0;x.confidenceEvidence=l(S,"exact-seat")??(d.type==="row"?l(d.confidenceEvidence,"row-representative"):void 0)}x.confidenceEvidence??=l(p?.confidenceEvidence,"section-representative")??(s?l(s.evidence,s.coverage):void 0),!x.viewUrl&&y&&b(p?.viewFromSeatMeta)&&(x.viewUrl=y,x.viewMeta=p?.viewFromSeatMeta),!x.viewUrl&&i&&b(i.meta)&&(x.viewUrl=i.url,x.viewMeta=i.meta),p&&(x.sectionId=p.logicalSectionId??p.id),p?.zone&&(x.zoneId=p.zone),M&&(x.focalPoint={...M})}f.push(...h)}return f}function cn(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,m=rn(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&sn(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,m);for(let f of m)f.floorId=r.id;o.push(...m)}return o}let n=rn(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&&sn(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Dr(e,n,t)}function Dr(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||en(t,Jt(t,qt(e))),t}function sn(e,t,n,o){let r=e.filter(u=>u.type==="section"),i=n>0||r.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!r.length||!i||!t){for(let u of o)u.eyeHeightM=n+ce;return}let s=new Array(o.length),a=new Map,m=new Map;for(let u=0;u<o.length;u++){let b=o[u],l=(b.sectionId?r.find(h=>h.id===b.sectionId)??r.find(h=>h.logicalSectionId===b.sectionId&&he({x:b.x,y:b.y},h.outline,h.holes)):void 0)??r.find(h=>he({x:b.x,y:b.y},h.outline,h.holes))??null;if(s[u]=l,!l)continue;a.has(l.id)||a.set(l.id,He(l,{floorBaseHeightM:n}));let d=m.get(l.id);d?d.push(u):m.set(l.id,[u])}let f=new Array(o.length).fill(void 0);for(let[u,b]of m){let c=a.get(u);if(!c)continue;let l=c.rake>0?Math.tan(c.rake*Math.PI/180):0,d=Ke(u,o,b,t);for(let h of d.rows){let p=h.blockDepth*te*l,y=c.height+p;for(let g of h.seatIndices)f[g]=y}}for(let u=0;u<o.length;u++){let b=o[u],c=s[u];if(!c){b.eyeHeightM=n+ce;continue}let l=a.get(c.id);b.eyeHeightM=(f[u]??l.height)+ce}}var Nr=/^#?([\da-f]{3}|[\da-f]{6})$/i;function jr(e){let t=Nr.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function W(e){let t=jr(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Gr(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ne(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Le(e,t){let n=Gr(e);return ne(e,[n,n,n],t)}var Ze=["available","held","sold","selected","dimmed"];function un(e){let t=Ze.indexOf(e);return t<0?0:t}var ln={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var vt={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]},Rt={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ie(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var Ur=.15,Yr=1.6;function fn(e){return Gt(e??1,Ur,Yr)}var Xr=.15,Vr=.9,Hr=1.76;function Kr(){return{background:{top:[...Rt.top],bottom:[...Rt.bottom]},structure:vt,seatStates:{...ln},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function mn(e){let t=Kr();if(!e)return t;let n=W(e.background);if(n){t.background={top:ie(n,Vr),bottom:ie(n,Hr)};let s={};for(let[a,m]of Object.entries(vt))s[a]=ne(m,n,Xr);t.structure=s}let o=W(e.selectionColor)??W(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=fn(r));let i=e.venue3d;if(i){let s=W(i.deck),a=W(i.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),a&&(t.structure={...t.structure,tierWall:a,gaWall:a}),t.materials.seat=W(i.seat),t.materials.shell=W(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function dn(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}var hn=Ie(require("earcut"),1),pn=Ie(require("polygon-clipping"),1);function pe(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function Oe(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}var R=te,zr=.002;function Wr(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),s=Math.max(o,r,i);if(s<1e-9)return!0;let a=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-o)*(a-r)*(a-i)))/s<zr}var ye=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=o}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},qe=class{constructor(){this.pos=new ye;this.nor=new ye;this.col=new ye;this.flr=new ye;this.mat=new ye;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,s=i,a=i){Wr(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,o,r,i,s,a,m=a,f=a){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(m[0],m[1],m[2]),this.col.push3(f[0],f[1],f[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 Zr(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],m=n[2]-e[2],f=r*m-i*a,u=i*s-o*m,b=o*a-r*s,c=Math.hypot(f,u,b)||1;return f/=c,u/=c,b/=c,[f,u,b]}function Qr(e,t){let n=[...e],o=[];for(let s of e)o.push(s.x,s.y);let r=[];if(t){for(let s of t)if(!(s.length<3)){r.push(n.length);for(let a of s)n.push(a),o.push(a.x,a.y)}}let i=(0,hn.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function Ct(e){return pe(e)<0?[...e].reverse():e}var $r=3;function qr(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(l,d,h,p)=>Math.abs(o({x:(l.x+d.x)/2,y:(l.y+d.y)/2})-(h+p)/2),m=(e.x+t.x+n.x)/3,f=(e.y+t.y+n.y)/3,u=(r+i+s)/3,b=Math.max(a(e,t,r,i),a(t,n,i,s),a(n,e,s,r),Math.abs(o({x:m,y:f})-u)),c=(l,d,h)=>{let p=Math.abs(o({x:(l+m)/2,y:(d+f)/2})-(h+u)/2);p>b&&(b=p)};return c((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),c((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),c((n.x+e.x)/2,(n.y+e.y)/2,(s+r)/2),b}function Be(e,t,n,o,r){if(r<=0)return qr(e,t,n,o);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Be(e,i,a,o,r-1),Be(i,t,s,o,r-1),Be(a,s,n,o,r-1),Be(i,s,a,o,r-1))}function Fe(e,t,n,o,r,i,s,a){if(s>0){let c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+o.x)/2,y:(n.y+o.y)/2},d={x:(o.x+t.x)/2,y:(o.y+t.y)/2};Fe(e,t,c,d,r,i,s-1,a),Fe(e,c,n,l,r,i,s-1,a),Fe(e,d,l,o,r,i,s-1,a),Fe(e,c,l,d,r,i,s-1,a);return}let m=[t.x*R,r(t),t.y*R],f=[n.x*R,r(n),n.y*R],u=[o.x*R,r(o),o.y*R];if(a){e.triN(m,f,u,a(t),a(n),a(o),i);return}let b=Zr(m,f,u);b[1]<0&&(b=[-b[0],-b[1],-b[2]]),e.tri(m,f,u,b,i)}var Jr=8;function bn(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,m,f)=>{if(f>0){let u={x:(i.x+s.x)/2,y:(i.y+s.y)/2},b=t(u);if(Math.abs(b-(a+m)/2)>n){r(i,u,a,b,f-1),r(u,s,b,m,f-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];r(s,a,t(s),t(a),Jr)}return o}function Qe(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],s=n[r],a=n[(r+1)%n.length],m=a.x-i.x,f=a.y-i.y,u=Math.hypot(m,f);u>t&&Math.abs((s.x-i.x)*f-(s.y-i.y)*m)/u<t||o.push(s)}return o.length>=3?o:n}var $e=.001*me*.1;function J(e,t,n,o,r,i,s,a,m=1/0,f){if(!t||t.length<3||(m===void 0&&(m=1/0),Math.abs(pe(t))<1e-4))return;let u=Qe(bn(Qe(Ct(t),$e),o,m),$e),b=n?.map(S=>Qe(bn(Qe(Ct(S),$e),o,m),$e)).filter(S=>S.length>=3&&Math.abs(pe(S))>=1e-4),{pts:c,tris:l}=Qr(u,b),d=[i[0]*a.top,i[1]*a.top,i[2]*a.top],h=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],p=[s[0]*a.top,s[1]*a.top,s[2]*a.top],y=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],g=0;if(Number.isFinite(m))for(;g<$r;g++){let S=0;for(let v=0;v<l.length;v+=3){let _=Be(c[l[v]],c[l[v+1]],c[l[v+2]],o,g);_>S&&(S=_)}if(S<=m)break}for(let S=0;S<l.length;S+=3){let v=c[l[S]],_=c[l[S+1]],D=c[l[S+2]];Fe(e,v,_,D,o,d,g,f);let N=[v.x*R,r,v.y*R],G=[_.x*R,r,_.y*R],C=[D.x*R,r,D.y*R];e.tri(N,C,G,[0,-1,0],h)}let M=S=>{if(g<=0)return S;let v=1<<g,_=[];for(let D=0;D<S.length;D++){let N=S[D],G=S[(D+1)%S.length];for(let C=0;C<v;C++){let w=C/v;_.push({x:N.x+(G.x-N.x)*w,y:N.y+(G.y-N.y)*w})}}return _},x=ft(u),A=[{ring:M(u),flip:!1}];if(b)for(let S of b)S.length>=3&&A.push({ring:M(S),flip:!0});for(let{ring:S,flip:v}of A)for(let _=0;_<S.length;_++){let D=S[_],N=S[(_+1)%S.length],G=(N.x-D.x)*R,w=(N.y-D.y)*R,k=-G,B=Math.hypot(w,k)||1;w/=B,k/=B;let I=(D.x+N.x)/2-x.x,T=(D.y+N.y)/2-x.y,P=w*I+k*T;v&&(P=-P),P<0&&(w=-w,k=-k);let E=[w,0,k],L=[D.x*R,o(D),D.y*R],F=[N.x*R,o(N),N.y*R],j=[D.x*R,r,D.y*R],Y=[N.x*R,r,N.y*R];e.tri(L,F,Y,E,p,p,y),e.tri(L,Y,j,E,p,y,y)}}function yn(e){let t=0;for(let m of e)t+=m.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=0;for(let m of e)n.set(m.position,a*3),o.set(m.normal,a*3),r.set(m.color,a*3),i.set(m.floor,a),s.set(m.material,a),a+=m.count;return{position:n,normal:o,color:r,floor:i,material:s,count:t}}function Je(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=Ct(e),r=o.length,i=[];for(let a=0;a<r;a++){let m=o[a],f=o[(a+1)%r],u=f.x-m.x,b=f.y-m.y,c=Math.hypot(u,b)||1;i.push({x:b/c,y:-u/c})}let s=[];for(let a=0;a<r;a++){let m=o[a],f=i[(a-1+r)%r],u=i[a],b=f.x+u.x,c=f.y+u.y,l=Math.hypot(b,c),d=()=>{s.push([m.x+f.x*t,m.y+f.y*t]),s.push([m.x+u.x*t,m.y+u.y*t])};if(l<1e-9){d();continue}b/=l,c/=l;let h=b*f.x+c*f.y,p=1/Math.max(h,1e-6);if(!Number.isFinite(p)||p>n){d();continue}s.push([m.x+b*t*p,m.y+c*t*p])}if(s.length<3)return e;try{let a=pn.default.union([[...s,s[0]]]),m=null,f=-1/0;for(let b of a){let c=Math.abs(pe(b[0].map(([l,d])=>({x:l,y:d}))));c>f&&(f=c,m=b[0])}if(!m)return e;let u=m.map(([b,c])=>({x:b,y:c}));if(u.length>1){let b=u[0],c=u[u.length-1];Math.abs(b.x-c.x)<1e-9&&Math.abs(b.y-c.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function et(e,t,n,o,r=28){let i=[];for(let s=0;s<r;s++){let a=s/r*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function De(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var ei=[{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"}],ma=new Map(ei.map(e=>[e.key,e]));var ti={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 gn(e){let t=e?.[0];return t&&ti[t]||"#3b82f6"}var ni=[{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"}],da=new Map(ni.map(e=>[e.key,e]));var oi=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],ba=new Set(oi);var Mn=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],Sn=Mn.map(e=>e.key),ri=new Map(Mn.map(e=>[e.key,e]));function xn(e){return typeof e=="string"&&ri.has(e)}function wn(e,t){return xn(e)?e:xn(t?.seatGlyph)?t.seatGlyph:"circle"}var ee={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ii=.44,si=.15,ai=.3,ci=.24;function In(e){return e===void 0||!Number.isFinite(e)||e<=0?ci:Math.min(ai,Math.max(si,e*ii))}var ui=.05,vn=.45,li=vn+ui,fi=.92;var xa=[{part:ee.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ee.pad,min:[-1,.36,-.95],max:[1,vn,1]},{part:ee.back,min:[-1,li,-1],max:[1,fi,-.72]},{part:ee.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ee.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ee.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ee.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ee.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ee.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ee.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ma=[{part:ee.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ee.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ee.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ee.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ee.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}];function Rn(e,t,n,o){let r=new Float32Array(t),i=f=>e[f*3],s=f=>e[f*3+2],a=0,m=(f,u)=>{let b=u-f;for(let c=f;c<u;c++){let[l,d]=o(c),h=l-i(c),p=d-s(c);if(b>=2){let y=Math.max(f,c-1),g=Math.min(u-1,c+1),M=i(g)-i(y),x=s(g)-s(y),A=Math.hypot(M,x);if(A>1e-6){let S=-x/A,v=M/A;S*h+v*p<0&&(S=-S,v=-v),h=S,p=v}}r[c]=h===0&&p===0?0:Math.atan2(h,p)}};for(let f=1;f<=t;f++)(f===t||n(f)!==n(a))&&(m(a,f),a=f);return r}var tt=.22;var mi=.42;function di(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,s=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>s&&(s=d.y);let a=Math.max(i-o,1e-6),m=Math.max(s-r,1e-6),f=Math.max(Math.sqrt(a*m/t),1e-6),u=Math.max(1,Math.ceil(a/f)+1),b=Math.max(1,Math.ceil(m/f)+1),c=new Map,l=(d,h)=>{let p=Math.min(u-1,Math.max(0,Math.floor((d-o)/f)));return Math.min(b-1,Math.max(0,Math.floor((h-r)/f)))*u+p};for(let d=0;d<t;d++){let h=l(e[d].x,e[d].y),p=c.get(h);p?p.push(d):c.set(h,[d])}for(let d=0;d<t;d++){let h=e[d],p=Math.min(u-1,Math.max(0,Math.floor((h.x-o)/f))),y=Math.min(b-1,Math.max(0,Math.floor((h.y-r)/f))),g=1/0;for(let M=1;M<=4;M++){for(let x=y-M;x<=y+M;x++)if(!(x<0||x>=b))for(let A=p-M;A<=p+M;A++){if(A<0||A>=u||M>1&&Math.abs(x-y)<M&&Math.abs(A-p)<M)continue;let S=c.get(x*u+A);if(S)for(let v of S){if(v===d)continue;let _=Math.hypot(e[v].x-h.x,e[v].y-h.y);_<g&&(g=_)}}if(Number.isFinite(g)&&g<=M*f)break}n[d]=g}return n}function bi(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-ce):0}function Cn(e,t,n,o,r,i){let s=e.length,a=new Float32Array(s*3),m=new Float32Array(s),f=new Float32Array(s*3),u=new Float32Array(s),b=new Float32Array(s),c=new Float32Array(s),l=new Float32Array(s),d=new Float32Array(s*3),h=new Map,p=di(e);for(let y=0;y<s;y++){let g=e[y],x=(n?.seatPitchU(y)??p[y])*R;u[y]=Number.isFinite(x)?Math.max(.06,Math.min(tt,x*mi)):tt,b[y]=In(Number.isFinite(x)?x:void 0);let A=wn(g.glyph,{seatGlyph:i?.get(g.categoryKey)});c[y]=Sn.indexOf(A),l[y]=g.wheelchairSpaceType==="no-seat"?0:1,a[y*3]=g.x*R,a[y*3+1]=n?n.seatDeckY(y):bi(g),a[y*3+2]=g.y*R,m[y]=un(t?t(g):"available");let S=W(r?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(f[y*3]=S[0],f[y*3+1]=S[1],f[y*3+2]=S[2],g.accessibility?.length){let v=W(gn(g.accessibility));v&&(d[y*3]=v[0],d[y*3+1]=v[1],d[y*3+2]=v[2])}h.set(g.id,y)}return{count:s,iPosition:a,iState:m,iCategory:f,iMaxRadius:u,iRing:d,idToIndex:h,iChairWidth:b,iGlyph:c,iPhysicalSeat:l,iFloor:o??new Float32Array(s),iYaw:new Float32Array(s)}}function hi(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,r=n-e.y,i=Math.hypot(o,r);return i<1e-9?[0,0]:[o/i,r/i]}}}function pi(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let l of e)n+=l.x,o+=l.y,r+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let s=e[0],a=-1;for(let l of e){let d=Math.hypot(l.x-n,l.y-o);d>a&&(a=d,s=l)}let m=s.x-n,f=s.y-o,u=Math.hypot(m,f);u>1e-9?(m/=u,f/=u):(m=1,f=0);let b=[...e].sort((l,d)=>(l.x-n)*m+(l.y-o)*f-((d.x-n)*m+(d.y-o)*f)),c=0;for(let l of b){let d=Math.hypot(l.x-n,l.y-o);d>c&&(c=d)}return{pts:b,cx:n,cy:o,radius:c,depth:r}}function Pn(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let s=o[i],a=o[i+1],m=a.x-s.x,f=a.y-s.y,u=m*m+f*f,b=u>1e-12?((t-s.x)*m+(n-s.y)*f)/u:0;b<0?b=0:b>1&&(b=1);let c=Math.hypot(t-(s.x+b*m),n-(s.y+b*f));c<r&&(r=c)}return r}var nt=8;function yi(e,t,n){let o=new Array(nt).fill(1/0),r=new Array(nt).fill(-1);for(let u=0;u<e.length;u++){let b=e[u],c=Math.hypot(t-b.cx,n-b.cy)-b.radius;for(let l=0;l<nt;l++)if(c<o[l]){for(let d=nt-1;d>l;d--)o[d]=o[d-1],r[d]=r[d-1];o[l]=c,r[l]=u;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let u of r){if(u<0)continue;let b=Pn(e[u],t,n);for(let c=0;c<3;c++)if(b<i[c]){for(let l=2;l>c;l--)i[l]=i[l-1],s[l]=s[l-1];i[c]=b,s[c]=u;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,m=0,f=0;for(let u=0;u<3;u++){let b=s[u];if(b<0||i[u]>a)continue;let c=1/(i[u]*i[u]);m+=c*e[b].depth,f+=c}return f>0?m/f:e[s[0]].depth}function gi(e){let t=(o,r)=>yi(e,o,r),n=(o,r)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let m=e[a];if(Math.hypot(o-m.cx,r-m.cy)-m.radius>=i)continue;let f=Pn(m,o,r);f<i&&(i=f,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,s=(t(o,r+.5)-t(o,r-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function En(e,t){let n=[];for(let o of e){let r=pi(o.points,t);r&&n.push(r)}return n.length<2?hi(t):(n.sort((o,r)=>o.depth-r.depth),gi(n))}var At=Ie(require("polygon-clipping"),1);var Tn=Ie(require("earcut"),1);var xi=.58,An=.01,se=tt*1.5*me,Mi=.5,Si=.6;function wi(e,t){let n=e.length,o=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],m=e[Math.min(n-1,s+1)],f=m.x-a.x,u=m.y-a.y,b=Math.hypot(f,u);if(b<1e-9){o.push([0,0]);continue}f/=b,u/=b,o.push([-u,f])}let r=0;for(let s=0;s<n;s++)r+=(e[s].x-t.x)*o[s][0]+(e[s].y-t.y)*o[s][1];return r<0?o.map(([s,a])=>[-s,-a]):o}function Ii(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(s,a)=>{let m=a.x-s.x,f=a.y-s.y,u=Math.hypot(m,f)||1;return{x:m/u,y:f/u}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var _n=Math.PI/12;function vi(e){if(e.length<3)return[...e];let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},r=[...o(t),...o([...t].reverse())];return r.length>=3?r:[...e]}function Ln(e,t){if(!e.length||!(t>0))return[];let n=vi(e),o=(a,m,f,u)=>{let b=f-m;for(;b<0;)b+=Math.PI*2;for(;b>Math.PI*2;)b-=Math.PI*2;let c=Math.max(1,Math.ceil(b/_n)),l=t/Math.cos(b/c/2);for(let d=0;d<=c;d++){let h=m+b*d/c;u.push({x:a.x+Math.cos(h)*l,y:a.y+Math.sin(h)*l})}};if(n.length<3){let a=0,m=0;for(let l of n)a+=l.x,m+=l.y;a/=n.length||1,m/=n.length||1;let f=0;for(let l of n)f=Math.max(f,Math.hypot(l.x-a,l.y-m));let u=[],b=Math.max(3,Math.ceil(Math.PI*2/_n)),c=(f+t)/Math.cos(Math.PI/b);for(let l=0;l<b;l++){let d=l/b*Math.PI*2;u.push({x:a+Math.cos(d)*c,y:m+Math.sin(d)*c})}return u}let r=n.length,i=[];for(let a=0;a<r;a++){let m=n[a],f=n[(a+1)%r];i.push(Math.atan2(-(f.x-m.x),f.y-m.y))}let s=[];for(let a=0;a<r;a++)o(n[a],i[(a+r-1)%r],i[a],s);return Nn(s)}function Ri(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,m=s.y-i.y,f=a*a+m*m,u=f>1e-12?((t-i.x)*a+(n-i.y)*m)/f:0;u<0?u=0:u>1&&(u=1);let b=Math.hypot(t-(i.x+u*a),n-(i.y+u*m));b<o&&(o=b)}return o}function ot(e){let t=e.map(r=>{let i=0,s=0;for(let f of r.pts)i+=f.x,s+=f.y;let a=r.pts.length||1;i/=a,s/=a;let m=0;for(let f of r.pts){let u=Math.hypot(f.x-i,f.y-s);u>m&&(m=u)}return{cx:i,cy:s,rad:m}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),s=[],a=1/0,m=null;for(let u of i){let b=1/0;for(let c=0;c<e.length;c++){if(c===r||Math.abs(e[c].y-e[r].y)<.001)continue;let l=t[c],d=Math.hypot(u.x-l.cx,u.y-l.cy)-l.rad;if(d>=b&&d>=a)continue;let h=Ri(e[c].pts,u.x,u.y);h<b&&(b=h),e[c].depth<e[r].depth&&h<a&&(a=h,m=e[c].y)}Number.isFinite(b)&&b>0&&s.push(b)}s.sort((u,b)=>u-b);let f=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:f,belowY:m})}return o}function On(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let u=r.pts[0],b=u.x-o.x,c=u.y-o.y,l=Math.hypot(b,c)||1;b/=l,c/=l;let d=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+c*d,y:u.y-b*d},{x:u.x-c*d,y:u.y+b*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let u=1;u<i.length;u++){let b=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);b>1e-6&&(s+=b,a++)}let m=a>0?s/a:0,f=Ii(i,Math.max(m*Si,se));return{pts:f,nrm:wi(f,o),front:Math.max(n[t].pitch*xi,se),back:Math.max(n[t].pitch*Mi,se)}}var Ce=1.5,Bn=.3;function Pt(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,s=Math.hypot(r,i),a=-1,m=-1;for(let b=1;b<e.length-1;b++){let c=e[b],l=s>1e-12?Math.abs((c.x-n.x)*i-(c.y-n.y)*r)/s:Math.hypot(c.x-n.x,c.y-n.y);l>a&&(a=l,m=b)}if(a<=t||m<0)return[n,o];let f=Pt(e.slice(0,m+1),t),u=Pt(e.slice(m),t);return[...f.slice(0,-1),...u]}function Fn(e,t){if(e.length<4)return e;let n=Pt([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Dn(e,t,n){if(e.length<2)return[];let o=n??ot(e),r=new Map;for(let s=0;s<e.length;s++){let a=r.get(e[s].blockId);a?a.push(s):r.set(e[s].blockId,[s])}let i=[];for(let[,s]of r){let a=[];for(let g of s){let M=e[g].patch;M&&M.length>=3?i.push({outline:[...M],holes:[],topY:e[g].y}):a.push(g)}if(!a.length)continue;a.sort((g,M)=>e[g].depth-e[M].depth);let f=a.map(g=>On(e,g,o,t)).filter(g=>g!==null);if(!f.length)continue;let u=(g,M)=>({x:g.pts[M].x-g.nrm[M][0]*(g.front+Ce),y:g.pts[M].y-g.nrm[M][1]*(g.front+Ce)}),b=(g,M)=>({x:g.pts[M].x+g.nrm[M][0]*(g.back+Ce),y:g.pts[M].y+g.nrm[M][1]*(g.back+Ce)}),c=f[0],l=f[f.length-1],d=[];for(let g=0;g<c.pts.length;g++)d.push(u(c,g));for(let g of f)d.push(b(g,g.pts.length-1));for(let g=l.pts.length-1;g>=0;g--)d.push(b(l,g));for(let g=f.length-1;g>=0;g--)d.push(u(f[g],0));let h=Nn(d),p=1/0;for(let g of a)e[g].y<p&&(p=e[g].y);if(!Number.isFinite(p))continue;if(h.length>=3&&Math.abs(pe(h))>1e-6&&f.every(g=>{let M=g.pts[Math.floor(g.pts.length/2)];return Oe(h,M.x,M.y)})){i.push({outline:Fn(h,Bn),holes:[],topY:p});continue}for(let g of Ci(f))i.push({outline:g,holes:[],topY:p})}return i}function Ci(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Ce,s=n.back+Ce;for(let m=0;m<n.pts.length;m++){let f=n.pts[m],u=n.nrm[m];o.push([f.x-u[0]*i,f.y-u[1]*i]),r.push([f.x+u[0]*s,f.y+u[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=At.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[0].map(([m,f])=>({x:m,y:f})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&o.push(Fn(i,Bn))}return o}catch{return[]}}function Nn(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Et=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let o=!0;for(let r of t)if(!Oe(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function kn(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let f=[0,1,0],u=o[0];for(let b=1;b+1<o.length;b++){let c=o[b],l=o[b+1];e.tri([u.x*R,r,u.y*R],[c.x*R,r,c.y*R],[l.x*R,r,l.y*R],f,i)}return}let s=o.map(f=>[f.x,f.y]);s.push(s[0]);let a;try{a=At.default.intersection([s],t)}catch{return}let m=[0,1,0];for(let f of a){if(!f.length||f[0].length<4)continue;let u=f[0],b=[],c=[];for(let d=0;d<u.length-1;d++)b.push(u[d][0],u[d][1]),c.push([u[d][0],u[d][1]]);if(c.length<3)continue;let l=(0,Tn.default)(b,void 0,2);for(let d=0;d<l.length;d+=3){let h=c[l[d]],p=c[l[d+1]],y=c[l[d+2]];e.tri([h[0]*R,r,h[1]*R],[p[0]*R,r,p[1]*R],[y[0]*R,r,y[1]*R],m,i)}}}function jn(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??ot(t),m=[0,1,0],f=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Et([[...i]]):null,b=l=>{e.setMaterial(2),l(),e.setMaterial(0)},c=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let d=t[l];if(d.patch&&d.patch.length>=3){let A=[...d.patch],S=a[l].belowY??o;if(c(()=>{if(f&&u)kn(e,f,u,A,d.y,r.tread);else{let v=A[0];for(let _=1;_+1<A.length;_++){let D=A[_],N=A[_+1];e.tri([v.x*R,d.y,v.y*R],[D.x*R,d.y,D.y*R],[N.x*R,d.y,N.y*R],m,r.tread)}}}),d.y>S+An){let v=0,_=0;for(let D of A)v+=D.x,_+=D.y;v/=A.length,_/=A.length,b(()=>{for(let D=0;D<A.length;D++){let N=A[D],G=A[(D+1)%A.length],C=G.x-N.x,w=G.y-N.y,k=Math.hypot(C,w);if(k<1e-6)continue;let B=w/k,I=-C/k;(N.x-v)*B+(N.y-_)*I<0&&(B=-B,I=-I);let T=[B,0,I],P=[N.x*R,d.y,N.y*R],E=[G.x*R,d.y,G.y*R],L=[N.x*R,S,N.y*R],F=[G.x*R,S,G.y*R];e.tri(P,E,F,T,r.riser),e.tri(P,F,L,T,r.riser)}})}continue}let h=On(t,l,a,n);if(!h)continue;let{pts:p,nrm:y,front:g,back:M}=h,x=a[l].belowY??o;for(let A=0;A+1<p.length;A++){let S=p[A],v=p[A+1],_=y[A],D=y[A+1];if(Math.hypot(v.x-S.x,v.y-S.y)<1e-6||_[0]===0&&_[1]===0||D[0]===0&&D[1]===0)continue;let N=[(S.x-_[0]*g)*R,d.y,(S.y-_[1]*g)*R],G=[(v.x-D[0]*g)*R,d.y,(v.y-D[1]*g)*R],C=[(S.x+_[0]*M)*R,d.y,(S.y+_[1]*M)*R],w=[(v.x+D[0]*M)*R,d.y,(v.y+D[1]*M)*R];if(c(()=>{f&&u?kn(e,f,u,[{x:S.x-_[0]*g,y:S.y-_[1]*g},{x:v.x-D[0]*g,y:v.y-D[1]*g},{x:v.x+D[0]*M,y:v.y+D[1]*M},{x:S.x+_[0]*M,y:S.y+_[1]*M}],d.y,r.tread):(e.tri(N,G,w,m,r.tread),e.tri(N,w,C,m,r.tread))}),d.y>x+An){let k=[N[0],x,N[2]],B=[G[0],x,G[2]],I=[-_[0],0,-_[1]];b(()=>{e.tri(N,G,B,I,r.riser),e.tri(N,B,k,I,r.riser)})}}}}function Gn(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function rt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var _t=Ie(require("polygon-clipping"),1);function Pi(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Un(e,t){return e.filter(n=>n.type!=="shape"||Pi(n,t))}function Yn(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:Un(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:Un(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Ei={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Pe(e){return Gn(e)??Ei}function Xn(e,t){let n=Je(e.outline,se),o=Pe(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&rt(o,Pe(s.outline)));if(!r.length)return[n];let i=s=>{let a=s.map(m=>[m.x,m.y]);return a.push(a[0]),a};try{let s=_t.default.difference([i(n)],...r.map(m=>[i(m.outline)])),a=[];for(let m of s){if(!m.length)continue;let f=m[0].map(([u,b])=>({x:u,y:b}));if(f.length>1){let u=f[0],b=f[f.length-1];Math.abs(u.x-b.x)<1e-9&&Math.abs(u.y-b.y)<1e-9&&f.pop()}f.length>=3&&a.push(f)}return a.length?a:[n]}catch{return[n]}}function Vn(e,t){if(!t.length)return e;let n=i=>{let s=i.map(a=>[a.x,a.y]);return s.push(s[0]),s},o=t.map(i=>[n(i)]),r=[];for(let i of e){let s;try{s=_t.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let a of s){if(!a.length)continue;let m=a[0].map(([f,u])=>({x:f,y:u}));if(m.length>1){let f=m[0],u=m[m.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&m.pop()}m.length>=3&&r.push({outline:m,holes:[],topY:i.topY})}}return r.length?r:e}var Ai=.05,Hn=.05,_i=.15,kt=25;function Kn(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),m=new Map,f=[],u=new Set;for(let c=0;c<e.length;c+=1){let l=e[c];for(let d of l.objects){if(d.type==="table"&&u.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let h=Je(d.outline,se);m.set(d.id,{section:d,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),f.push({id:d.id,floorIndex:c,box:Pe(h),section:d,unit:l,outline:h})}}let b=new Map;for(let c of f){let l=b.get(c.floorIndex);l?l.push(c):b.set(c.floorIndex,[c])}for(let c=0;c<t.length;c++){let l=t[c],d=n?b.get(n[c])??[]:f,h=l.sectionId?d.find(y=>y.id===l.sectionId)??d.find(y=>y.section.logicalSectionId===l.sectionId&&he({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,p=h?[h]:d;for(let y of p){if(n&&y.floorIndex!==n[c]||!h&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!he({x:l.x,y:l.y},y.outline,y.section.holes)))continue;r[c]=y.id;let g=m.get(y.id);g.hasSeats=!0;let M=l.focalPoint??y.unit.focal,x=Math.hypot(l.x-M.x,l.y-M.y);x<g.frontU&&(g.frontU=x),g.seatIndices.push(c);let A=l.rowId||`__seat-${c}`,S=g.rows.get(A);S?S.push({x:l.x,y:l.y}):g.rows.set(A,[{x:l.x,y:l.y}]);break}}for(let[c,l]of m){let d=He(l.section,{floorBaseHeightM:l.unit.baseHeightM}),h=l.unit.baseHeightM,p=d.rake>0?Math.tan(d.rake*Math.PI/180):0,y=d.rake<=.01&&d.height<=h+.001,g=l.section.surfaceKind,M=g==="flat"?!0:g==="rakedRows"&&d.rake>.01?!1:y,x=l.hasSeats?Ke(c,t,l.seatIndices,l.unit.focal):{sectionId:c,rows:[],blockCount:0},S=x.rows.length<2?En([...l.rows.values()].map(P=>({points:P})),l.unit.focal):null,v=1/0;if(S){if(l.hasSeats)for(let P of l.rows.values())for(let E of P){let L=S.depthAt(E.x,E.y);L<v&&(v=L)}if(!l.hasSeats||!Number.isFinite(v)){v=1/0;for(let P of l.section.outline){let E=S.depthAt(P.x,P.y);E<v&&(v=E)}}}let _=h+Ai,D=Math.max(_,d.height),N=P=>{let E=Math.max(0,P-v)*te,L=Math.min(E*p,kt);return Math.max(_,d.height+L)},G=P=>{let E=Math.max(0,P)*te,L=Math.min(E*p,kt);return Math.max(_,d.height+L)},C=M?[]:x.rows.map(P=>({pts:P.pts,y:G(P.blockDepth),depth:P.blockDepth,blockId:P.blockId,...u.has(P.id)?{patch:Ln(P.pts,se)}:{}})),w=C.length?C[0].y:D,k=C.map(P=>{let E=P.patch&&P.patch.length>=3?P.patch:P.pts,L=0,F=0;for(let U of E)L+=U.x,F+=U.y;let j=E.length||1;L/=j,F/=j;let Y=0;for(let U of E){let X=Math.hypot(U.x-L,U.y-F);X>Y&&(Y=X)}return{cx:L,cy:F,rad:Y}}),B=M?()=>D:C.length>=2?(P,E)=>{let L=1/0,F=w;for(let j=0;j<C.length;j++){let Y=k[j];if(Math.hypot(P-Y.cx,E-Y.cy)-Y.rad>=L)continue;let U=C[j].patch,X=U&&U.length>=3?Oe(U,P,E)?0:ve(U,P,E):ve(C[j].pts,P,E);X<L&&(L=X,F=C[j].y)}return F}:(P,E)=>S?N(S.depthAt(P,E)):D,I=[0,1,0],T=C.length>=2||M?()=>I:(P,E)=>{if(!S)return I;let L=S.depthAt(P,E);if(L<=v)return I;let F=(L-v)*te;if(F*p>=kt||d.height+F*p<=_)return I;let[j,Y]=S.gradientAt(P,E);if(j===0&&Y===0)return I;let U=1/Math.hypot(p,1);return[-j*p*U,U,-Y*p*U]};if(!M)for(let P of x.rows){let E=G(P.blockDepth);for(let L of P.seatIndices)s[L]=E}for(let P of x.rows){let E=[];for(let U=1;U<P.pts.length;U++){let X=Math.hypot(P.pts[U].x-P.pts[U-1].x,P.pts[U].y-P.pts[U-1].y);X>1e-6&&E.push(X)}E.sort((U,X)=>U-X);let L=E.length?E[Math.floor(E.length/2)]:1/0,F=1/0,j=P.pts[Math.floor(P.pts.length/2)];if(j)for(let U of x.rows){if(U===P||U.blockId!==P.blockId)continue;let X=ve(U.pts,j.x,j.y);X>1e-6&&X<F&&(F=X)}let Y=Math.min(L,Math.max(F,L*.5));if(Number.isFinite(Y)&&Y>0)for(let U of P.seatIndices)a[U]=Y}o.set(c,{sectionId:c,deckAt:B,normalAt:T,flat:M,bottomY:h,rowLevels:C,landingY:w})}for(let c=0;c<t.length;c++){let l=r[c],d=t[c];if(l){let p=s[c];i[c]=(p??o.get(l).deckAt(d.x,d.y))+_i;continue}let h=d.eyeHeightM;i[c]=Number.isFinite(h)?Math.max(0,h-ce):0}return{bySection:o,seatOwner:r,seatDeckY:c=>i[c],seatPitchU:c=>a[c]}}var $={top:1,wallBottom:.5,bottomCap:.4};function ue(e,t){if(!e)return t;let n=ie(Le(e,.4),.62);return ne(t,n,.72)}function zn(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let s=o.get(i.sectionId);s||(s=new Map,o.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,s]of o){let a=0,m=0,f=0,u=0;for(let[b,c]of s){let l=W(n.get(b));l&&(a+=l[0]*c,m+=l[1]*c,f+=l[2]*c,u+=c)}u>0&&r.set(i,[a/u,m/u,f/u])}return r}function Wn(e,t){return W(e.color)??t.get(e.logicalSectionId??e.id)??null}var Zn=Ie(require("polygon-clipping"),1);function ki(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var it=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(m=>[m.x,m.y]);if(o.length<3)return[];o.push(o[0]);let r=Pe(t),i=this.rings.filter((m,f)=>rt(r,this.boxes[f])&&ki(n,this.levels[f])),s=[[o]];if(i.length)try{s=Zn.default.difference([o],...i).map(f=>f.map(u=>u.map(([b,c])=>[b,c])))}catch{s=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let a=[];for(let m of s){if(!m.length)continue;let f=m[0].map(([u,b])=>({x:u,y:b}));if(f.length>1){let u=f[0],b=f[f.length-1];Math.abs(u.x-b.x)<1e-9&&Math.abs(u.y-b.y)<1e-9&&f.pop()}f.length>=3&&a.push(f)}return a}};function Ti(e,t){if(!t)return e;let n=1/0,o=-1/0,r=1/0,i=-1/0;for(let b of e)n=Math.min(n,b.x),o=Math.max(o,b.x),r=Math.min(r,b.y),i=Math.max(i,b.y);let s=(n+o)/2,a=(r+i)/2,m=t*Math.PI/180,f=Math.cos(m),u=Math.sin(m);return e.map(b=>{let c=b.x-s,l=b.y-a;return{x:s+c*f-l*u,y:a+c*u+l*f}})}function ge(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=De(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,o=(e.y??0)+e.height/2;t=et(n,o,e.width/2,e.height/2)}return t?Ti(t,e.rotation):null}function Ne(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},o=t==="stage"&&ze(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var Li=.08;function Qn(e,t){let n=ge(e),o=Ne(e),r=o.heightM;if(!n||o.kind!=="plate"&&o.kind!=="stage")return r;let i=1/0,s=1/0,a=-1/0,m=-1/0;for(let u of n)i=Math.min(i,u.x),s=Math.min(s,u.y),a=Math.max(a,u.x),m=Math.max(m,u.y);let f=r;for(let u of t)a>u.minX&&i<u.maxX&&m>u.minY&&s<u.maxY&&f<=u.topOffsetM+1e-6&&(f=u.topOffsetM+Li);return t.push({minX:i,minY:s,maxX:a,maxY:m,topOffsetM:f}),f}function de(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function $n(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function je(e,t,n){return[de(e[0],e[1],t),de(e[0],e[1],n),de(e[3],e[2],n),de(e[3],e[2],t)]}function qn(e,t,n){return[de(e[0],e[3],t),de(e[1],e[2],t),de(e[1],e[2],n),de(e[0],e[3],n)]}function le(e,t,n,o,r,i){J(e,t,void 0,()=>n,o,r,i,$)}var Tt=2.4,Oi=.75,Bi=.15;function Ge(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=n/2,f=o/2;return[[-m,-f],[m,-f],[m,f],[-m,f]].map(([u,b])=>({x:t.x+u*s-b*a,y:t.y+u*a+b*s}))}function Jn(e,t,n,o,r){let i=Ge(t);i&&J(e,i,void 0,()=>n+Tt,n,ue(o,r.boothTop),r.boothWall,$)}function Lt(e){if(e.shape==="round"){let u=e.radius;return u?et(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=t/2,f=n/2;return[[-m,-f],[m,-f],[m,f],[-m,f]].map(([u,b])=>({x:r.x+u*s-b*a,y:r.y+u*a+b*s}))}function eo(e,t,n,o,r){let i=Lt(t);i&&J(e,i,void 0,()=>n+Oi,n,ue(o,r.tableTop),r.tableWall,$)}function to(e,t,n,o,r,i,s,a){let m=ge(t);if(!m)return;let f=a?a.kind==="stage":t.role==="stage",u=a?a.kind==="screen":t.role==="screen",b=a?{kind:f?"stage":"solid",heightM:a.topY-a.baseY}:Ne(t),c=a?.baseY??n,l=a?.topY??n+o;if(f&&s){let g=1/0,M=-1/0,x=1/0,A=-1/0;for(let S of m)S.x<g&&(g=S.x),S.x>M&&(M=S.x),S.y<x&&(x=S.y),S.y>A&&(A=S.y);s.push({cx:(g+M)/2*R,cz:(x+A)/2*R,y:l,halfX:Math.max((M-g)/2*R,.5),halfZ:Math.max((A-x)/2*R,.5)})}let d=W(t.fill),h=f&&d?ne(r.stageTop,ie(Le(d,.18),.9),.9):ue(d,f?r.stageTop:r.decorTop),p=u?d:null,y=f?d?ne(r.stageWall,ie(d,.58),.82):r.stageWall:u?p?ne(ie(p,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ue(W(t.fill),r.decorWall);if(b.kind==="portal"&&m.length===4){let g=$n(m);le(e,je(g,0,.16),l,c,h,y),le(e,je(g,.84,1),l,c,h,y),le(e,g,l,Math.max(c,l-.35),h,y);return}if(b.kind==="suite"&&m.length===4){let g=m.map((A,S)=>{let v=m[(S+1)%4],_=(A.x+v.x)/2,D=(A.y+v.y)/2;return Math.hypot(_-i.x,D-i.y)}),M=g.indexOf(Math.min(...g)),x=[0,1,2,3].map(A=>m[(M+A)%4]);le(e,je(x,0,.08),l,c,h,y),le(e,je(x,.92,1),l,c,h,y),le(e,qn(x,.88,1),l,c,h,y),le(e,x,l,Math.max(c,l-.18),h,y);return}le(e,m,l,c,h,y)}function Ot(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,s=n+r/2,a=(e.rotation??0)*Math.PI/180,m=Math.cos(a),f=Math.sin(a),u=o/2,b=r/2;return[[-u,-b],[u,-b],[u,b],[-u,b]].map(([c,l])=>({x:i+c*m-l*f,y:s+c*f+l*m}))}function Fi(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return W(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let m=W(a[1].trim());m&&s.push(m)}return s.length?s.reduce((a,m,f)=>ne(a,m,1/(f+1)),s[0]):null}function no(e,t,n,o){if(t.layer==="foreground")return;let r=Ot(t);if(!r)return;let i=n+Bi,s=ue(Fi(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=ne(o.ground,s,a)),J(e,r,void 0,()=>i,n,s,ne(s,o.decorWall,.5),$)}function oo(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=ue(o,r.gaTop);J(e,t.points,t.holes,()=>n+.15,n,i,r.gaWall,$)}var Di=Math.PI/180,K=96,Ni=6,ji=60,Gi=150,ro=.2,Ui=.35;function Yi(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Di;return n<0?n+360:n}function st(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function at(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let s=0,a=0;for(let m=-n;m<=n;m++){let f=i+m;if(t)f=(f%o+o)%o;else if(f<0||f>=o)continue;s+=e[f],a++}r[i]=s/a}return r}function io(e,t){let n=e.filter(c=>c.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,s=0;for(let c of n)for(let l of c.rows){for(let d of l.pts)r+=d.x,i+=d.y,s++;if(l.pts.length>=4){let d=gt(l.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!s)return null;let a={x:r/s,y:i/s},m=a;if(o.length>=8){let c=st(o.map(y=>y.x)),l=st(o.map(y=>y.y)),d=0;for(let y of n)for(let g of y.rows)for(let M of g.pts){let x=Math.hypot(M.x-a.x,M.y-a.y);x>d&&(d=x)}let h=0,p=d*.2;for(let y of n)for(let g of y.rows)for(let M of g.pts)Math.hypot(M.x-c,M.y-l)<p&&h++;Math.hypot(c-a.x,l-a.y)<=d&&h/s<.01&&(m={x:c,y:l})}let f=[];for(let c of n){let l={sectionId:c.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of c.rows)for(let h of d.pts){let p=Math.hypot(h.x-m.x,h.y-m.y),y=Math.min(K-1,Math.floor(Yi(m,h)/(360/K)));l.samples.push({r:p,bin:y,levelM:d.levelM}),p<l.rMin&&(l.rMin=p),p>l.rMax&&(l.rMax=p)}l.samples.length&&f.push(l)}if(!f.length)return null;f.sort((c,l)=>c.rMin+c.rMax-(l.rMin+l.rMax));let u=[];for(let c of f){let l=!1;for(let d of u){let h=Math.min(c.rMax,d.rMax)-Math.max(c.rMin,d.rMin),p=Math.min(c.rMax-c.rMin,d.rMax-d.rMin);if(p>1e-9&&h>=Ui*p){d.members.push(c),d.rMin=Math.min(d.rMin,c.rMin),d.rMax=Math.max(d.rMax,c.rMax),l=!0;break}}l||u.push({members:[c],rMin:c.rMin,rMax:c.rMax})}let b=[];for(let c of u){let l=new Array(K).fill(null);for(let w of c.members)for(let k of w.samples){let B=l[k.bin];B||(B={samples:[]},l[k.bin]=B),B.samples.push({r:k.r,levelM:k.levelM})}let d=l.map(w=>!!w);if(!d.filter(Boolean).length)continue;let p=[],y=[];for(let w of l){if(!w)continue;let k=1/0,B=-1/0;for(let I of w.samples)I.r<k&&(k=I.r),I.r>B&&(B=I.r);p.push(k),y.push(B)}let g=st(p),M=st(y);if(!(g>=ro*M)||!(M>0))continue;let x=[...p].sort((w,k)=>w-k);if(!(x[Math.floor(x.length*.1)]>=ro*M))continue;let S=l.map(w=>{if(!w)return null;let k=[...w.samples].sort((j,Y)=>j.r-Y.r),B=k[0].r,I=k[k.length-1].r,T=k[0].levelM,P=-1/0;for(let j of k)j.levelM>P&&(P=j.levelM);let E=[];for(let j of k){let Y={r:j.r,l:j.levelM};for(;E.length&&Math.abs(E[E.length-1].r-Y.r)<1e-9;){if(E[E.length-1].l<=Y.l){Y.skip=!0;break}E.pop()}if(!Y.skip){for(;E.length>=2;){let U=E[E.length-2],X=E[E.length-1];if((X.r-U.r)*(Y.l-U.l)-(X.l-U.l)*(Y.r-U.r)<=0)E.pop();else break}E.push(Y)}}let L=E.map(j=>j.r),F=E.map(j=>j.l);return{inner:B,outer:I,front:T,top:P,profile:{rs:L,ls:F}}}),v=d.slice();for(let w=0;w<K;w++){if(v[w])continue;let k=-1,B=-1,I=0;for(let O=1;O<=K;O++){let V=(w-O+K*2)%K;if(v[V]){k=V;break}}for(let O=1;O<=K;O++){let V=(w+O)%K;if(v[V]){B=V,I=O;break}}if(k<0||B<0)continue;let T=0;for(let O=1;O<=K;O++){let V=(w-O+K*2)%K;if(d[V]){T=O;break}}if(T-1+I>Ni)continue;let E=S[k],L=S[B],F=T/(T+I),j=E.inner+(L.inner-E.inner)*F,Y=E.outer+(L.outer-E.outer)*F,U=E.front+(L.front-E.front)*F,X=E.top+(L.top-E.top)*F;S[w]={inner:j,outer:Y,front:U,top:X,profile:{rs:[j,Y],ls:[U,X]}}}for(let w=0;w<K;w++)S[w]&&(v[w]=!0);let _=360/K,D=[],N=v.filter(Boolean).length,G=[];if(N===K)G.push({start:0,len:K});else{let w=0;for(;v[w];)w=(w+1)%K;let k=-1;for(let B=0;B<=K;B++){let I=(w+B)%K,T=B<K&&v[I];if(T&&k<0)k=I;else if(!T&&k>=0){let P=(I-k+K)%K||K;G.push({start:k,len:P}),k=-1}}}for(let w of G){if(w.len*_<ji&&w.len<K)continue;let k=w.len===K,B=new Float64Array(w.len),I=new Float64Array(w.len),T=new Float64Array(w.len),P=new Float64Array(w.len),E=[];for(let O=0;O<w.len;O++){let V=S[(w.start+O)%K];B[O]=V.inner,I[O]=V.outer,T[O]=V.front,P[O]=V.top,E.push(V.profile??{rs:[V.inner,V.outer],ls:[V.front,V.top]})}let L=at(B,k),F=at(I,k),j=at(T,k),Y=at(P,k);for(let O=0;O<w.len;O++)L[O]>B[O]&&(L[O]=B[O]),F[O]<I[O]&&(F[O]=I[O]),L[O]>F[O]-1e-6&&(L[O]=Math.max(0,F[O]-1e-6)),Y[O]<j[O]&&(Y[O]=j[O]);let U={startBin:w.start,binCount:w.len,closed:k,innerR:L,outerR:F,frontLevelM:j,topLevelM:Y,profiles:E},X=(O,V,H)=>{let Q=E[O],Z=Q.rs,z=Q.ls;if(V<=Z[0]){z[0]>H&&(z[0]=H);return}if(V>=Z[Z.length-1]){z[z.length-1]>H&&(z[z.length-1]=H);return}for(let q=0;q+1<Z.length;q++)if(V<=Z[q+1]){z[q]>H&&(z[q]=H),z[q+1]>H&&(z[q+1]=H);return}};for(let O=0;O<w.len;O++){let V=l[(w.start+O)%K];if(V)for(let H of V.samples){X(O,H.r,H.levelM);let Q=k?(O-1+w.len)%w.len:O-1,Z=k?(O+1)%w.len:O+1;Q>=0&&X(Q,H.r,H.levelM),Z<w.len&&X(Z,H.r,H.levelM)}}D.push(U)}D.reduce((w,k)=>w+k.binCount*_,0)<Gi||b.push({arcs:D,sectionIds:c.members.map(w=>w.sectionId),innerRMedian:g,outerRMedian:M})}if(!b.length)return null;if(b.sort((c,l)=>c.innerRMedian-l.innerRMedian),t){let c=b[b.length-1].outerRMedian;if(Math.hypot(t.x-m.x,t.y-m.y)>.9*c)return null}return{centre:m,binCount:K,binStepDeg:360/K,rings:b}}function so(e,t,n,o){let r=e.binStepDeg,i=n/r-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),m=i-s,f=u=>{let b=t.profiles[u],c=b.rs,l=b.ls;if(o<=c[0])return l[0];if(o>=c[c.length-1])return l[l.length-1];for(let d=0;d+1<c.length;d++)if(o<=c[d+1]){let h=c[d+1]-c[d],p=h>1e-9?(o-c[d])/h:0;return l[d]+(l[d+1]-l[d])*p}return l[l.length-1]};return f(s)*(1-m)+f(a)*m}var Xi=.25,Vi=1.2,Hi=.6,Ki=.45,zi=2.3,Wi=Math.PI/180;function xe(e,t,n){let o=n*Wi;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function Zi(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let r of e){if(r.role!=="wall")continue;let i=r.points&&r.points.length>=2?r.points:r.x!==void 0&&r.y!==void 0&&r.width!==void 0&&r.height!==void 0?[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.height}]:[];if(i.length<2)continue;let s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=o&&s++;if(s>=i.length/2)return!0}return!1}var Qi=24;function $i(e,t,n,o,r,i,s,a){let m=n.binCount,f=Qi,u=te,b=i+.02,c=[];for(let C=0;C<m;C++){let w=(n.startBin+C+.5)*t.binStepDeg,k=new Float64Array(f+1);for(let B=0;B<=f;B++){let I=o[C]+(r[C]-o[C])*B/f;k[B]=Math.max(b,so(t,n,w,I)-Xi)}c.push(k)}let l=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],d=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],h=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],p=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],y=(C,w)=>{let k=(n.startBin+C+.5)*t.binStepDeg,B=o[C]+(r[C]-o[C])*w/f,I=xe(t.centre,B,k);return[I.x*u,c[C][w],I.y*u]};{let C=Math.tan(12*Math.PI/180);for(let w=0;w<6;w++){let k=!1;for(let I=0;I<m;I++)for(let T=f-1;T>=0;T--)c[I][T]>c[I][T+1]&&(c[I][T]=c[I][T+1],k=!0);let B=n.closed?m:m-1;for(let I=0;I<B;I++){let T=(I+1)%m;for(let P=0;P<=f;P++){let E=c[T][P]-c[I][P];if(Math.abs(E)>1)continue;let L=o[I]+(r[I]-o[I])*P/f,F=o[T]+(r[T]-o[T])*P/f,j=xe(t.centre,L,(n.startBin+I+.5)*t.binStepDeg),Y=xe(t.centre,F,(n.startBin+T+.5)*t.binStepDeg),U=C*Math.hypot(Y.x-j.x,Y.y-j.y)*u;E>U?(c[T][P]=c[I][P]+U,k=!0):-E>U&&(c[I][P]=c[T][P]+U,k=!0)}}if(!k)break}}let g=1,M=(C,w)=>{for(let k=0;k<=f;k+=4)if(Math.abs(c[C][k]-c[w][k])>g)return!0;return Math.abs(c[C][f]-c[w][f])>g},x=Math.tan(38*Math.PI/180),A=C=>(r[C]-o[C])/f*u,S=(C,w)=>c[C][w+1]-c[C][w]>x*Math.max(1e-6,A(C)),v=(C,w)=>{let k=n.closed?(C-1+m)%m:Math.max(0,C-1),B=n.closed?(C+1)%m:Math.min(m-1,C+1);Math.abs(c[k][w]-c[C][w])>g&&(k=C),Math.abs(c[B][w]-c[C][w])>g&&(B=C);let I=Math.max(0,w-1),T=Math.min(f,w+1);I<w&&S(C,I)&&(I=w),T>w&&S(C,w)&&(T=w);let P=y(k,w),E=y(B,w),L=y(C,I),F=y(C,T),j=E[0]-P[0],Y=E[1]-P[1],U=E[2]-P[2],X=F[0]-L[0],O=F[1]-L[1],V=F[2]-L[2],H=Y*V-U*O,Q=U*X-j*V,Z=j*O-Y*X,z=Math.hypot(H,Q,Z);return z>1e-12?(H/=z,Q/=z,Z/=z,Q<0&&(H=-H,Q=-Q,Z=-Z),[H,Q,Z]):[0,1,0]},_=(C,w)=>{let k=[C[0],i,C[2]],B=[w[0],i,w[2]],I=w[0]-C[0],T=w[2]-C[2],P=Math.hypot(I,T);if(!(P>1e-12))return;let E=[T/P,0,-I/P];e.tri(C,w,B,E,h,h,p),e.tri(C,B,k,E,h,p,p)},D=.05*me,N=C=>r[C]-o[C]<D,G=n.closed?m:m-1;for(let C=0;C<G;C++){let w=(C+1)%m;if(N(C)||N(w))continue;if(M(C,w)){let E=(n.startBin+C+1)*t.binStepDeg,L=(O,V)=>{let H=(o[C]+o[w])/2,Q=(r[C]+r[w])/2,Z=H+(Q-H)*V/f,z=xe(t.centre,Z,E);return[z.x*u,c[O][V],z.y*u]};for(let O=0;O<f;O++){let V=y(C,O),H=y(C,O+1),Q=L(C,O),Z=L(C,O+1),z=v(C,O),q=v(C,O+1);e.triN(V,Q,Z,z,z,q,l),e.triN(V,Z,H,z,q,q,l);let Ue=y(w,O),Ye=y(w,O+1),Me=L(w,O),Ee=L(w,O+1),Se=v(w,O),we=v(w,O+1);e.triN(Me,Ue,Ye,Se,Se,we,l),e.triN(Me,Ye,Ee,Se,we,we,l);let fe=L(C,O),ae=L(C,O+1),Xe=L(w,O+1),ut=L(w,O),Ve=ae[0]-fe[0],Ae=ae[2]-fe[2],lt=Math.hypot(Ve,Ae);if(lt>1e-12){let Ft=[Ae/lt,0,-Ve/lt];e.tri(fe,ae,Xe,Ft,h),e.tri(fe,Xe,ut,Ft,h)}}let F=y(C,0),j=y(w,0),Y=y(w,f),U=y(C,f),X=O=>[O[0],i,O[2]];e.tri(X(F),X(Y),X(j),[0,-1,0],d),e.tri(X(F),X(U),X(Y),[0,-1,0],d),_(F,j),_(U,Y);continue}for(let E=0;E<f;E++){let L=v(C,E),F=v(w,E),j=v(w,E+1),Y=v(C,E+1);if(S(C,E)||S(w,E)){let H=(ae,Xe)=>{let ut=(n.startBin+ae+.5)*t.binStepDeg,Ve=o[ae]+(r[ae]-o[ae])*(E+.5)/f,Ae=xe(t.centre,Ve,ut);return[Ae.x*u,Xe,Ae.y*u]},Q=y(C,E),Z=y(w,E),z=H(C,c[C][E]),q=H(w,c[w][E]);e.triN(Q,Z,q,L,F,F,l),e.triN(Q,q,z,L,F,L,l);let Ue=y(w,E+1),Ye=y(C,E+1),Me=H(C,c[C][E+1]),Ee=H(w,c[w][E+1]);e.triN(Me,Ee,Ue,Y,j,j,l),e.triN(Me,Ue,Ye,Y,j,Y,l);let Se=q[0]-z[0],we=q[2]-z[2],fe=Math.hypot(Se,we);if(fe>1e-12){let ae=[-we/fe,0,Se/fe];e.tri(z,q,Ee,ae,h),e.tri(z,Ee,Me,ae,h)}continue}let U=y(C,E),X=y(w,E),O=y(w,E+1),V=y(C,E+1);e.triN(U,X,O,L,F,j,l),e.triN(U,O,V,L,j,Y,l)}let k=y(C,0),B=y(w,0),I=y(w,f),T=y(C,f),P=E=>[E[0],i,E[2]];e.tri(P(k),P(I),P(B),[0,-1,0],d),e.tri(P(k),P(T),P(I),[0,-1,0],d),_(k,B),_(T,I)}if(!n.closed)for(let C of[0,m-1])for(let w=0;w<f;w++)_(y(C,w),y(C,w+1))}function ao(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let b of u.arcs){let c=new Float64Array(b.binCount),l=new Float64Array(b.binCount);for(let h=0;h<b.binCount;h++){let p=(b.startBin+h)%t.binCount,y=Math.max(0,b.innerR[h]-se);c[h]=Math.max(y,s[p]+.001),l[h]=Math.max(c[h]+.001,b.outerR[h]+se)}let d=0;for(let h=0;h<b.binCount;h++){let p=b.topLevelM[h]-o;p>d&&(d=p)}d>=Vi&&$i(e,t,b,c,l,o,r,i);for(let h=0;h<b.binCount;h++){let p=(b.startBin+h)%t.binCount;l[h]>s[p]&&(s[p]=l[h])}}if(n.deriveShell===!1||Zi(n.shapes,t))return;let a=t.rings[t.rings.length-1],m=Hi*me,f=Ki*me;for(let u of a.arcs){let b=[],c=[];for(let h=0;h<u.binCount;h++){let p=(u.startBin+h+.5)*t.binStepDeg,y=u.outerR[h]+se+m;b.push(xe(t.centre,y,p)),c.push(xe(t.centre,y+f,p))}let l=-1/0;for(let h=0;h<u.binCount;h++)u.topLevelM[h]>l&&(l=u.topLevelM[h]);let d=()=>l+zi;u.closed?J(e,c,[b.slice().reverse()],d,o,r.shellTop,r.shellWall,i):J(e,[...c,...b.slice().reverse()],void 0,d,o,r.shellTop,r.shellWall,i)}}function co(e,t,n,o,r,i,s,a){if(!t.outline||t.outline.length<3)return;let m=n.baseHeightM,f=ue(o,a.tierTop);if(!r)return;let u=p=>r.deckAt(p.x,p.y),b=Xn(t,s),c=b[0]??t.outline;if(r.rowLevels.length>=2){let p=ot(r.rowLevels),y=Vn(Dn(r.rowLevels,n.focal,p),b),g=()=>[0,1,0];for(let x of y){let A=Math.max(m,x.topY-.02);for(let S of i.subtract(x.outline,A))J(e,S,x.holes,()=>A,m,f,a.tierWall,$,void 0,g)}y.length||J(e,c,t.holes,()=>r.landingY,m,f,a.tierWall,$);let M={tread:[f[0]*$.top,f[1]*$.top,f[2]*$.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let x of b.length?b:[c])jn(e,r.rowLevels,n.focal,r.landingY,M,x,p);return}let l=r.flat?1/0:Hn,d=p=>r.normalAt(p.x,p.y),h=r.flat?r.landingY:void 0;for(let p of i.subtract(c,h))J(e,p,t.holes,u,m,f,a.tierWall,$,l,d)}function qi(e,t,n){let o=new Set;for(let s of e.objects)s.type==="section"&&o.add(s.id);let r=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!o.has(a))continue;let m=n.bySection.get(a);if(m&&m.rowLevels.length>=2)continue;let f=t[s],u=r.get(a);u||(u=new Map,r.set(a,u));let b=f.rowId||`__seat-${s}`,c=u.get(b);c||(c={pts:[],levelM:0,n:0},u.set(b,c)),c.pts.push({x:f.x,y:f.y}),c.levelM+=n.seatDeckY(s),c.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let f=a.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));f.length>=2&&i.push({sectionId:s.id,rows:f});continue}let m=r.get(s.id);m&&i.push({sectionId:s.id,rows:[...m.values()].map(f=>({pts:f.pts,levelM:f.levelM/f.n}))})}return i}function uo(e,t,n,o,r,i,s=!0){let a=qi(t,n,o);if(!a.length)return;let m=io(a,t.focal);m&&(e.setMaterial(0),ao(e,m,{bottomY:t.baseHeightM,colors:{bandTop:ie(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??ie(r.tierWall,1.15),shellWall:i??r.tierWall},ao:$,shapes:t.objects.filter(f=>f.type==="shape"),deriveShell:s}))}var Ji=6,es=2.2,lo=.1,ts=.3,ns=1.8,os=.9,rs=.55,is=6e3;function fo(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,s=t.zones??[],a=[];if(s.length){let m=new Map;for(let u of n)for(let b of u.objects)b.type==="section"&&b.zone&&m.set(b.id,b.zone);let f=new Map;for(let u=0;u<o.length;u++){let b=o[u],c=r.seatOwner[u],l=b.zoneId??(c?m.get(c):void 0);if(!l)continue;let d=f.get(l);d||(d={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},f.set(l,d)),d.n++,b.x<d.minX&&(d.minX=b.x),b.y<d.minY&&(d.minY=b.y),b.x>d.maxX&&(d.maxX=b.x),b.y>d.maxY&&(d.maxY=b.y),d.sumY+=r.seatDeckY(u)}for(let u of s){let b=f.get(u.id),c=[];for(let[l,d]of m)d===u.id&&c.push(l);if(!b||b.n===0){a.push({id:u.id,label:u.label,color:W(u.color),sectionIds:c,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*R,1.5,(u.focalPoint??i).y*R]});continue}a.push({id:u.id,label:u.label,color:W(u.color),sectionIds:c,seatCount:b.n,center:[(b.minX+b.maxX)/2*R,b.sumY/b.n,(b.minY+b.maxY)/2*R],radius:.5*Math.hypot((b.maxX-b.minX)*R,(b.maxY-b.minY)*R)||1,focalWorld:[(u.focalPoint??i).x*R,1.5,(u.focalPoint??i).y*R]})}}return a}function mo(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:m}=e,f=[],u=[],b=[];for(let c of a)c.seatCount!==0&&f.push({id:`zone:${c.id}`,kind:"zone",text:c.label,anchor:[c.center[0],c.center[1]+Ji,c.center[2]],color:t.zones?.find(l=>l.id===c.id)?.color});{let c=new Map,l=new Map;for(let d=0;d<o.length;d++){let h=r.seatOwner[d];if(!h)continue;let p=c.get(h);p||(p={n:0,x:0,y:0,deck:0},c.set(h,p)),p.n++,p.x+=o[d].x,p.y+=o[d].y,p.deck+=r.seatDeckY(d);let y=l.get(h);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(h,y)),o[d].x<y.minX&&(y.minX=o[d].x),o[d].x>y.maxX&&(y.maxX=o[d].x),o[d].y<y.minY&&(y.minY=o[d].y),o[d].y>y.maxY&&(y.maxY=o[d].y)}for(let d of n)for(let h of d.objects){if(h.type!=="section")continue;let p=c.get(h.id);if(!p||p.n===0)continue;let y=l.get(h.id),g=[p.x/p.n*R,p.deck/p.n,p.y/p.n*R],M=h.displayLabel||h.label||h.id;u.push({id:h.id,floorIndex:d.index,label:M,seatCount:p.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*R),focalWorld:[d.focal.x*R,d.baseHeightM+1.5,d.focal.y*R]});let x=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();n.length>1&&x===M.trim().toLocaleLowerCase()||f.push({id:`section:${h.id}`,kind:"section",text:M,anchor:[g[0],g[1]+es,g[2]],floorIndex:d.index})}}{for(let d of n)for(let h of d.objects){if(h.type!=="gaArea")continue;let p=_e(h.points);if(!p)continue;let y=h.displayLabel||h.label||h.id;f.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${y} \xB7 ${h.capacity.toLocaleString()}`:y,anchor:[p.x*R,d.baseHeightM+ns,p.y*R],floorIndex:d.index})}let c=new Map;for(let d=0;d<o.length;d++){let h=o[d],p=Math.hypot(h.x-m.x,h.y-m.y),y=c.get(h.rowId);(!y||p>y.far)&&c.set(h.rowId,{seat:h,index:d,far:p})}for(let[d,h]of c){let p=h.seat.label?h.seat.label.lastIndexOf("-"):-1,y=p>0?h.seat.label.slice(0,p):d;y&&f.push({id:`row:${d}`,kind:"row",text:y,anchor:[h.seat.x*R,r.seatDeckY(h.index)+os,h.seat.y*R],floorIndex:s[h.index]})}let l=new Map;for(let d=0;d<o.length;d++){let h=o[d],p=h.label?h.label.lastIndexOf("-"):-1,y=l.get(h.rowId);y||(y={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:p>0?h.label.slice(0,p):h.rowId,sectionId:h.sectionId},l.set(h.rowId,y));let g=d*3,M=i.iPosition[g],x=i.iPosition[g+1],A=i.iPosition[g+2];y.n++,y.x+=M,y.y+=x,y.z+=A,y.minX=Math.min(y.minX,M),y.maxX=Math.max(y.maxX,M),y.minZ=Math.min(y.minZ,A),y.maxZ=Math.max(y.maxZ,A)}for(let[d,h]of l)b.push({id:d,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(o.length<=is)for(let d=0;d<o.length;d++){let h=o[d],p=h.displayLabel||h.label;p&&f.push({id:`seat:${h.id}`,kind:"seat",text:p,anchor:[h.x*R,r.seatDeckY(d)+rs,h.y*R],floorIndex:s[d]})}}for(let c of n)for(let l of c.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let d=ge(l),h=d?_e(d):null;if(!h||!l.label)continue;f.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[h.x*R,c.baseHeightM+Ne(l).heightM+lo,h.y*R],color:l.fill,floorIndex:c.index})}else if(l.type==="text"){if(!l.text)continue;f.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*R,c.baseHeightM+lo,l.position.y*R],color:l.color,rotation:l.rotation,floorIndex:c.index})}else if(l.type==="booth"){let d=Ge(l);if(!d)continue;let h=_e(d);if(!h)continue;f.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[h.x*R,c.baseHeightM+Tt+ts,h.y*R],floorIndex:c.index})}return{labels:f,sections:u,rows:b}}function bo(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function ho(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:s,seatFloor:a}=e,m=[];{let f=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let c=0;c<i.floor.length;c+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[c]))),d=c*3,h=f[l];h.minX=Math.min(h.minX,i.position[d]),h.minY=Math.min(h.minY,i.position[d+1]),h.minZ=Math.min(h.minZ,i.position[d+2]),h.maxX=Math.max(h.maxX,i.position[d]),h.maxY=Math.max(h.maxY,i.position[d+1]),h.maxZ=Math.max(h.maxZ,i.position[d+2])}let u=new Map;for(let c=0;c<n.length;c++)for(let l of n[c].objects)l.type==="section"&&u.set(l.id,c);let b=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let c=0;c<o.length;c++){let l=r.seatOwner[c],d=(l!==null?u.get(l):void 0)??s[c];if(d===void 0)continue;let h=b[d],p=o[c];h.n++,p.x<h.minX&&(h.minX=p.x),p.y<h.minY&&(h.minY=p.y),p.x>h.maxX&&(h.maxX=p.x),p.y>h.maxY&&(h.maxY=p.y);let y=r.seatDeckY(c);h.sumX+=p.x*R,h.sumDeck+=y,h.sumZ+=p.y*R,h.minDeck=Math.min(h.minDeck,y),h.maxDeck=Math.max(h.maxDeck,y+1.6),a[c]=d}for(let c=0;c<n.length;c++){let l=b[c],d=t.floors?.[c],h=f[c],p=Math.min(l.n?l.minX*R:n[c].focal.x*R-1,Number.isFinite(h.minX)?h.minX:1/0),y=Math.max(l.n?l.maxX*R:n[c].focal.x*R+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(l.n?l.minY*R:n[c].focal.y*R-1,Number.isFinite(h.minZ)?h.minZ:1/0),M=Math.max(l.n?l.maxY*R:n[c].focal.y*R+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),x=Math.min(l.n?Math.min(n[c].baseHeightM,l.minDeck):n[c].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),A=Math.max(l.n?Math.max(l.maxDeck,x+.5):x+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[l.n?l.sumX/l.n:(p+y)/2,l.n?l.sumDeck/l.n:(x+A)/2,l.n?l.sumZ/l.n:(g+M)/2],v=Math.max(1,.5*Math.hypot(y-p,A-x,M-g));m.push({index:c,id:d?.id??`floor-${c}`,label:d?.name??(n.length>1?`Floor ${c+1}`:"Venue"),seatCount:l.n,center:S,radius:v,box:{min:[p,x,g],max:[y,A,M]},focalWorld:[n[c].focal.x*R,n[c].baseHeightM+1.5,n[c].focal.y*R]})}}return m}function Bt(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,s=(a,m)=>{a<n&&(n=a),m<o&&(o=m),a>r&&(r=a),m>i&&(i=m)};for(let a of t)s(a.x,a.y);for(let a of e)for(let m of a.objects)if(m.type==="section")for(let f of m.outline)s(f.x,f.y);else if(m.type==="shape"&&m.points)for(let f of m.points)s(f.x,f.y);else if(m.type==="gaArea")for(let f of m.points)s(f.x,f.y);else if(m.type==="booth"){let f=Ge(m);if(f)for(let u of f)s(u.x,u.y)}else if(m.type==="table"){let f=Lt(m);if(f)for(let u of f)s(u.x,u.y)}else if(m.type==="decorImage"){let f=Ot(m);if(f)for(let u of f)s(u.x,u.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function po(e,t,n,o,r,i){if(t.length===1){let s=Math.max(60,(r.maxX-r.minX+r.maxY-r.minY)*.06),a=De(r.minX-s,r.minY-s,r.maxX-r.minX+s*2,r.maxY-r.minY+s*2);J(e,a,void 0,()=>0,-.4,i.ground,i.ground,$)}else{let s=t.reduce((l,d)=>d.baseHeightM<l.baseHeightM?d:l);e.setFloor(s.index);let a=n.filter((l,d)=>o[d]===s.index),m=Bt([s],a),f=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),u=Math.max(28,Math.min(80,f*.04)),b=De(m.minX-u,m.minY-u,m.maxX-m.minX+u*2,m.maxY-m.minY+u*2),c=s.baseHeightM-.03;J(e,b,void 0,()=>c,c-.22,i.ground,i.ground,$)}}function yo(e,t,n){let{cx:o,cz:r,radius:i}=n,s=1/0,a=1/0,m=1/0,f=-1/0,u=-1/0,b=-1/0,c=(h,p,y)=>{s=Math.min(s,h),f=Math.max(f,h),a=Math.min(a,p),u=Math.max(u,p),m=Math.min(m,y),b=Math.max(b,y)};for(let h=0;h<e.position.length;h+=3)c(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let p=h*3,y=t.iPosition[p],g=t.iPosition[p+1],M=t.iPosition[p+2],x=Math.max(.35,t.iMaxRadius[h]??.35);c(y-x,g,M-x),c(y+x,g+1.6,M+x)}Number.isFinite(s)||(s=o-i,f=o+i,a=0,u=i*.16,m=r-i,b=r+i);let l=[(s+f)/2,(a+u)/2,(m+b)/2],d=Math.max(1,.5*Math.hypot(f-s,u-a,b-m));return{center:l,radius:d,minY:a,maxY:u}}function go(e,t,n,o,r,i){let s=1/0,a=1/0,m=-1/0,f=-1/0;for(let x=0;x<e.count;x++){let A=x*3,S=e.iPosition[A],v=e.iPosition[A+2];S<s&&(s=S),S>m&&(m=S),v<a&&(a=v),v>f&&(f=v)}for(let x of t)s=Math.min(s,x.cx-x.halfX),m=Math.max(m,x.cx+x.halfX),a=Math.min(a,x.cz-x.halfZ),f=Math.max(f,x.cz+x.halfZ);let u=n.minX*R,b=n.maxX*R,c=n.minY*R,l=n.maxY*R,d=u,h=b,p=c,y=l;if(Number.isFinite(s)){let x=Math.max(2,.06*Math.hypot(m-s,f-a));d=Math.max(u,s-x),h=Math.min(b,m+x),p=Math.max(c,a-x),y=Math.min(l,f+x)}let g=Math.min(0,o),M=Math.max(r,i*.05);return{min:[d,g,p],max:[h,M,y]}}function xo(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=Qt(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let b of n)for(let c of b.objects)c.type==="shape"&&i.set(c.id,{shape:c,unit:b});let s=new Set,a=new Set,m=new Map((t.overlay.productionElements??[]).map(b=>{let c=b.runtimeContentImageUrl;return[b.id,typeof c=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(c)?c:void 0]})),f=[];for(let b of r.value.overlay.productionElements??[]){let c=i.get(b.objectId),l=c?ge(c.shape):null,d=b.baseElevationM??0;if(!c||!l||l.length<3||!b.id||s.has(b.id)||a.has(b.objectId)||!Number.isFinite(b.heightM)||b.heightM<.05||b.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();s.add(b.id),a.add(b.objectId);let h=l.map(_=>_.x*R),p=l.map(_=>_.y*R),y=c.unit.baseHeightM+d,g=Math.min(...h),M=Math.max(...h),x=Math.min(...p),A=Math.max(...p),S,v=m.get(b.id)??b.contentImageUrl;if(b.kind==="screen"&&v)if(M-g>=A-x){let _=Math.abs(x-c.unit.focal.y*R)<=Math.abs(A-c.unit.focal.y*R)?x-.006:A+.006;S=[[g,y,_],[M,y,_],[g,y+b.heightM,_],[M,y+b.heightM,_]]}else{let _=Math.abs(g-c.unit.focal.x*R)<=Math.abs(M-c.unit.focal.x*R)?g-.006:M+.006;S=[[_,y,x],[_,y,A],[_,y+b.heightM,x],[_,y+b.heightM,A]]}f.push({id:b.id,objectId:b.objectId,kind:b.kind,floorIndex:c.unit.index,baseY:y,topY:y+b.heightM,bounds:{min:[g,y,x],max:[M,y+b.heightM,A]},occlusion:b.occlusion,...v?{contentImageUrl:v}:{},...S?{contentPlane:S}:{}})}let u=f.sort((b,c)=>b.id.localeCompare(c.id));return{byObjectId:new Map(u.map(b=>[b.objectId,b])),elements:u}}function re(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oe(e){return Array.isArray(e)?e:[]}function ss(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!re(n))continue;let o=re(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function ct(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function as(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function cs(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let r=0;r<4;r++)for(let i=0;i<4;i++)n[o*4+r]+=e[i*4+r]*t[o*4+i];return n}function us(e){let t=ct(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:ct(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:ct(e.rotation,4),r=e.scale===void 0?[1,1,1]:ct(e.scale,3);if(!n||!o||!r)return null;let[i,s,a,m]=o,f=Math.hypot(i,s,a,m);if(!(f>1e-8))return null;let u=i/f,b=s/f,c=a/f,l=m/f,d=u+u,h=b+b,p=c+c,y=u*d,g=u*h,M=u*p,x=b*h,A=b*p,S=c*p,v=l*d,_=l*h,D=l*p;return[(1-(x+S))*r[0],(g+D)*r[0],(M-_)*r[0],0,(g-D)*r[1],(1-(y+S))*r[1],(A+v)*r[1],0,(M+_)*r[2],(A-v)*r[2],(1-(y+x))*r[2],0,n[0],n[1],n[2],1]}function ls(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function fs(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],s=e[9],a=e[2],m=e[6],f=e[10],u=i*f-s*m,b=s*a-r*f,c=r*m-i*a,l=t*u+n*b+o*c;if(Math.abs(l)<1e-12)return null;let d=1/l;return[u*d,b*d,c*d,(o*m-n*f)*d,(t*f-o*a)*d,(n*a-t*m)*d,(n*s-o*i)*d,(o*r-t*s)*d,(t*i-n*r)*d]}function Mo(e,t,n,o){let r=e[0]*t+e[1]*n+e[2]*o,i=e[3]*t+e[4]*n+e[5]*o,s=e[6]*t+e[7]*n+e[8]*o,a=Math.hypot(r,i,s)||1;return r/=a,i/=a,s/=a,[r,i,s]}function ms(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,o=null,r=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),s=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let a=e.subarray(n,n+i);if(s===1313821514&&!o)try{let m=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!re(m))return null;o=m}catch{return null}else if(s===5130562&&!r)r=a;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function ds(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function bs(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function hs(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function ps(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=ms(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!re(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=oe(o.extensionsUsed).filter(x=>typeof x=="string");if(i.includes("KHR_draco_mesh_compression")||ss(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||oe(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(oe(o.images).length||oe(o.textures).length)return{ok:!1,issue:"external_resource"};let s=oe(o.buffers);if(s.length!==1||!re(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let a=oe(o.accessors),m=oe(o.bufferViews),f=oe(o.meshes),u=oe(o.nodes),b=oe(o.scenes),c=typeof o.scene=="number"?o.scene:0;if(!re(b[c]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(x,A,S)=>{if(typeof x!="number"||!Number.isInteger(x)||!re(a[x]))return null;let v=a[x];if(v.type!==A||v.sparse!==void 0||v.normalized===!0||typeof v.count!="number"||!Number.isInteger(v.count)||v.count<1||typeof v.componentType!="number"||!S.includes(v.componentType)||typeof v.bufferView!="number")return null;let _=m[v.bufferView];if(!re(_)||_.buffer!==0||typeof _.byteLength!="number"||!Number.isInteger(_.byteLength)||_.byteLength<0)return null;let D=bs(v.type),N=ds(v.componentType),G=typeof _.byteStride=="number"?_.byteStride:D*N,C=typeof _.byteOffset=="number"?_.byteOffset:0,w=typeof v.byteOffset=="number"?v.byteOffset:0,k=C+w,B=w+(v.count-1)*G+D*N;if(!Number.isInteger(G)||!Number.isInteger(C)||!Number.isInteger(w)||G<D*N||C<0||w<0||C+_.byteLength>r.byteLength||B>_.byteLength)return null;let I=[];for(let T=0;T<v.count;T++){let P=[];for(let E=0;E<D;E++){let L=hs(l,k+T*G+E*N,v.componentType);if(!Number.isFinite(L))return null;P.push(L)}I.push(P)}return I},h=[],p=[],y=0,g=new Set,M=(x,A)=>{if(typeof x!="number"||!Number.isInteger(x)||!re(u[x])||g.has(x))return!1;g.add(x);let S=u[x],v=us(S);if(!v)return!1;let _=cs(A,v),D=fs(_);if(!D)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let N=f[S.mesh];if(!re(N))return!1;for(let G of oe(N.primitives)){if(!re(G)||G.mode!==void 0&&G.mode!==4||!re(G.attributes))return!1;let C=d(G.attributes.POSITION,"VEC3",[5126]),w=G.attributes.NORMAL===void 0?null:d(G.attributes.NORMAL,"VEC3",[5126]);if(!C||G.attributes.NORMAL!==void 0&&!w)return!1;let k=C.length;if(G.indices!==void 0){let I=typeof G.indices=="number"?a[G.indices]:null;k=re(I)?I.count:void 0}if(typeof k!="number"||!Number.isInteger(k)||k%3!==0||(y+=k/3,y>1e5))return!1;let B=G.indices===void 0?C.map((I,T)=>[T]):d(G.indices,"SCALAR",[5121,5123,5125]);if(!B||B.length%3!==0||B.length!==k)return!1;for(let I=0;I<B.length;I+=3){let T=[B[I][0],B[I+1][0],B[I+2][0]];if(T.some(L=>!Number.isInteger(L)||L<0||L>=C.length))return!1;let P=T.map(L=>ls(_,...C[L])),E=null;if(!w){let L=P[1][0]-P[0][0],F=P[1][1]-P[0][1],j=P[1][2]-P[0][2],Y=P[2][0]-P[0][0],U=P[2][1]-P[0][1],X=P[2][2]-P[0][2];E=Mo([1,0,0,0,1,0,0,0,1],F*X-j*U,j*Y-L*X,L*U-F*Y)}for(let L=0;L<3;L++)h.push(...P[L]),p.push(...w?Mo(D,...w[T[L]]):E)}}}for(let N of oe(S.children))if(!M(N,_))return!1;return g.delete(x),!0};for(let x of oe(b[c].nodes))if(!M(x,as()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||h.length!==y*9||p.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(h),normal:new Float32Array(p)}}function So(e){try{return ps(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function wo(e){let{doc:t}=e,n=mn(t.theme),o=n.structure,r=Yn(t,e.eventConfigurationId??t.eventConfigurationId),i=xo(e.eventConfigurationId,e.eventConfiguration,r),s=e.seats,a=new qe,m=null;if(e.registeredShellGlb){let I=So(e.registeredShellGlb);if(I.ok){let T=I.position.length/3,P=new Float32Array(I.position.length),E=n.materials.shell??o.tierWall;for(let L=0;L<T;L++){let F=I.normal[L*3+1],j=F<-.25?.4:.62+.38*Math.max(0,F);P[L*3]=E[0]*j,P[L*3+1]=E[1]*j,P[L*3+2]=E[2]*j}m={position:I.position,normal:I.normal,color:P,floor:new Float32Array(T).fill(-2),material:new Float32Array(T),count:T}}}let f=new Map;for(let I of r)for(let T of I.objects)f.set(T.id,I.index),T.type==="section"&&f.set(T.logicalSectionId??T.id,I.index);let u=s.map(I=>f.get(I.sectionId??"")??f.get(I.rowId??"")??0),b=Bt(r,s);po(a,r,s,u,b,o);let c=zn(t,s),l=new Map,d=new Map;for(let I of t.categories??[])l.set(I.key,I.color),I.seatGlyph&&d.set(I.key,I.seatGlyph);let h=[],p=Kn(r,s,u),y=new Float32Array(s.length),g=[];for(let I=0;I<r.length;I++){let T=r[I];a.setFloor(I);let P=new it,E=[],L=T.objects.filter(F=>F.type==="section"&&!!F.outline&&F.outline.length>=3);for(let F of T.objects)if(F.type==="section"){let j=a.vertexCount;co(a,F,T,Wn(F,c),p.bySection.get(F.id),P,L,o);let Y=a.vertexCount-j;Y>0&&g.push({sectionId:F.id,start:j,count:Y})}else if(F.type==="shape"){let j=i.byObjectId.get(F.id);a.setMaterial((j?.kind??F.role)==="screen"?1:0),to(a,F,T.baseHeightM,Qn(F,E),o,T.focal,h,j),a.setMaterial(0)}else F.type==="gaArea"?oo(a,F,T.baseHeightM,W(l.get(F.categoryKey)),o):F.type==="booth"?Jn(a,F,T.baseHeightM,W(l.get(F.categoryKey)),o):F.type==="table"?eo(a,F,T.baseHeightM,W(F.fill??t.theme?.decorFill??"#232c40"),o):F.type==="decorImage"&&no(a,F,T.baseHeightM,o);uo(a,T,s,p,o,n.materials.shell,!m)}let M=r.length>1?{x:r.reduce((I,T)=>I+T.focal.x,0)/r.length,y:r.reduce((I,T)=>I+T.focal.y,0)/r.length}:t.focalPoint??{x:(b.minX+b.maxX)/2,y:(b.minY+b.maxY)/2},x=yn(m?[a.build(),m]:[a.build()]),A=Cn(s,e.initialState,p,y,l,d),S=fo({doc:t,units:r,seats:s,surfaces:p,focal:M}),{labels:v,sections:_,rows:D}=mo({doc:t,units:r,seats:s,surfaces:p,seatData:A,hintedSeatFloor:u,zones:S,focal:M}),N=ho({doc:t,units:r,seats:s,surfaces:p,solids:x,hintedSeatFloor:u,seatFloor:y});bo(v,N),A.iYaw=Rn(A.iPosition,s.length,I=>s[I].rowId,I=>{let T=r[y[I]]?.focal??M;return[T.x*R,T.y*R]});let G=(b.minX+b.maxX)/2*R,C=(b.minY+b.maxY)/2*R,w=.5*Math.hypot((b.maxX-b.minX)*R,(b.maxY-b.minY)*R)||10,k=yo(x,A,{cx:G,cz:C,radius:w}),B=go(A,h,b,k.minY,k.maxY,w);return{solids:x,sectionSolidRanges:g,seats:A,bounds:{center:[(B.min[0]+B.max[0])/2,(B.min[1]+B.max[1])/2,(B.min[2]+B.max[2])/2],radius:w,groundY:0,box:B},renderBounds:{center:k.center,radius:k.radius},stateColorLUT:dn(n,Ze),theme:n,seatCount:s.length,focalWorld:[M.x*R,1.5,M.y*R],zones:S,stages:h,productionElements:i.elements,sections:_,rows:D,labels:v,floors:N}}function ys(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(n=>n.buffer)}var Io=self;Io.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??cn(e.data.doc),r=wo({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});Io.postMessage({model:r,buildMs:performance.now()-t,...n?{seats:o}:{}},ys(r))};
@@ -1 +1 @@
1
- import{w as n}from"../../chunk-KHFCTR3V.js";import"../../chunk-TN6DFYEV.js";import"../../chunk-YACNGDTE.js";import"../../chunk-UL5OIGIF.js";import{Va as o}from"../../chunk-QUOAQQMP.js";import"../../chunk-JBOTRSMY.js";import"../../chunk-CRCGO52K.js";function d(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(s=>s.buffer)}var i=self;i.onmessage=e=>{let a=performance.now(),s=!e.data.seats,t=e.data.seats??o(e.data.doc),r=n({doc:e.data.doc,seats:t,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});i.postMessage({model:r,buildMs:performance.now()-a,...s?{seats:t}:{}},d(r))};
1
+ import{w as n}from"../../chunk-JQL77POQ.js";import"../../chunk-PRED5KHO.js";import"../../chunk-WXGW2SYC.js";import"../../chunk-UL5OIGIF.js";import{Wa as o}from"../../chunk-24O23MNB.js";import"../../chunk-JBOTRSMY.js";import"../../chunk-CRCGO52K.js";function d(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(s=>s.buffer)}var i=self;i.onmessage=e=>{let a=performance.now(),s=!e.data.seats,t=e.data.seats??o(e.data.doc),r=n({doc:e.data.doc,seats:t,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});i.postMessage({model:r,buildMs:performance.now()-a,...s?{seats:t}:{}},d(r))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seatlayer/core",
3
- "version": "0.75.1",
3
+ "version": "0.76.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": {