@seatlayer/core 0.92.5 → 0.93.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.
- package/dist/ar-ALH3NJ5S.js +1 -0
- package/dist/be-L2ARGVAN.js +1 -0
- package/dist/bg-7664YNCK.js +1 -0
- package/dist/ca-FAFWDJLI.js +1 -0
- package/dist/{chunk-6FTHCEJW.js → chunk-A3ZL3R75.js} +1 -1
- package/dist/{chunk-S4H34KCG.js → chunk-CEIVHWRB.js} +1 -1
- package/dist/chunk-F7TP67LK.js +1 -0
- package/dist/{chunk-NKJS7MLW.js → chunk-M5X6G7FD.js} +1 -1
- package/dist/{chunk-K42NW62J.js → chunk-O3DGXAIC.js} +1 -1
- package/dist/{chunk-TXF2XAK4.js → chunk-TKYTTEJ2.js} +1 -1
- package/dist/{chunk-LQKUHEL6.js → chunk-U7CVRE4P.js} +1 -1
- package/dist/chunk-ZDETFCDH.js +1 -0
- package/dist/{chunk-NRZY5UXV.js → chunk-ZFWHAKAI.js} +1 -1
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.d.cts +1 -1
- package/dist/core/layout/index.d.ts +1 -1
- package/dist/core/layout/index.js +1 -1
- package/dist/core/sections/index.cjs +1 -1
- package/dist/core/sections/index.js +1 -1
- package/dist/cs-X2R3ZSIS.js +1 -0
- package/dist/cy-TZAP42PI.js +1 -0
- package/dist/da-TXXYTHRV.js +1 -0
- package/dist/de-QTBBGD7H.js +1 -0
- package/dist/el-D5FP7YYV.js +1 -0
- package/dist/es-WBASDRVC.js +1 -0
- package/dist/et-DI4AFGPJ.js +1 -0
- package/dist/fa-475UAFRJ.js +1 -0
- package/dist/fi-VLWI3PVM.js +1 -0
- package/dist/fr-RIEQP5R4.js +1 -0
- package/dist/he-LMIQFGT5.js +1 -0
- package/dist/hr-HWWXJXMT.js +1 -0
- package/dist/hu-EGRPKEMV.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/it-QU2BONLV.js +1 -0
- package/dist/ja-GTPGN7AW.js +1 -0
- package/dist/ku-Q3XMN7GH.js +1 -0
- package/dist/localeLoaders-X2DDK7KL.js +1 -0
- package/dist/lt-ZGTEWYU4.js +1 -0
- package/dist/lv-3SV4YW2L.js +1 -0
- package/dist/nl-ALCHLVP2.js +1 -0
- package/dist/no-WRBQJCLX.js +1 -0
- package/dist/pl-4G6VEQZ3.js +1 -0
- package/dist/pt-OLA6ELAW.js +1 -0
- package/dist/ro-H5GU4DVI.js +1 -0
- package/dist/ru-BM3TYI5V.js +1 -0
- package/dist/sk-VU45GJYV.js +1 -0
- package/dist/sl-SYNAWIPU.js +1 -0
- package/dist/sr-6ZNE7HDN.js +1 -0
- package/dist/sv-52BO3IXQ.js +1 -0
- package/dist/{tableSizing-DUSD6Ksr.d.cts → tableSizing-Blb9Z_Tt.d.cts} +13 -1
- package/dist/{tableSizing-D7dXthik.d.ts → tableSizing-DmZYe2v2.d.ts} +13 -1
- package/dist/tr-SZJCCTGR.js +1 -0
- package/dist/uk-OSWQK4LA.js +1 -0
- package/dist/view3d/index.cjs +25 -25
- package/dist/view3d/index.js +1 -1
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/dist/zh-Hans-JK2SPHB6.js +1 -0
- package/dist/zh-Hant-BYGBT56E.js +1 -0
- package/package.json +1 -1
- package/dist/ar-KGNNNJUO.js +0 -1
- package/dist/be-LE7QOODV.js +0 -1
- package/dist/bg-CVE3J6PP.js +0 -1
- package/dist/ca-IKKNYKM3.js +0 -1
- package/dist/chunk-D5ZLXZYU.js +0 -1
- package/dist/chunk-F45ZMLCU.js +0 -1
- package/dist/cs-URM2GHWN.js +0 -1
- package/dist/cy-2M2GE2B4.js +0 -1
- package/dist/da-WAXH2D7H.js +0 -1
- package/dist/de-H4PSHII3.js +0 -1
- package/dist/el-U4RQJNUD.js +0 -1
- package/dist/es-ZS7OFHRA.js +0 -1
- package/dist/et-ZZIBRHRO.js +0 -1
- package/dist/fa-7QW4XHTK.js +0 -1
- package/dist/fi-P6C2UJG3.js +0 -1
- package/dist/fr-UNQNIKP7.js +0 -1
- package/dist/he-EBIDVS7Q.js +0 -1
- package/dist/hr-ELYMVVXF.js +0 -1
- package/dist/hu-XWENOXUQ.js +0 -1
- package/dist/it-AAI5NPRW.js +0 -1
- package/dist/ja-6WK4CCNS.js +0 -1
- package/dist/ku-7NHUIS6X.js +0 -1
- package/dist/localeLoaders-THFBL37Y.js +0 -1
- package/dist/lt-LRK6MX3B.js +0 -1
- package/dist/lv-OLYBSH3S.js +0 -1
- package/dist/nl-QWXHNW6I.js +0 -1
- package/dist/no-2KC54QOY.js +0 -1
- package/dist/pl-47XPU4H7.js +0 -1
- package/dist/pt-PTM7NPGE.js +0 -1
- package/dist/ro-MGGJVFMK.js +0 -1
- package/dist/ru-TPAADG2S.js +0 -1
- package/dist/sk-Y3IOBKYW.js +0 -1
- package/dist/sl-UUI7EHW5.js +0 -1
- package/dist/sr-LAJHZ4FT.js +0 -1
- package/dist/sv-SRHCVAW4.js +0 -1
- package/dist/tr-CASRE75P.js +0 -1
- package/dist/uk-6A5ZWUPH.js +0 -1
- package/dist/zh-Hans-QN3XNYBM.js +0 -1
- package/dist/zh-Hant-CMJBSD2M.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Eo=Object.create;var Dt=Object.defineProperty;var Ao=Object.getOwnPropertyDescriptor;var _o=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,To=Object.prototype.hasOwnProperty;var Lo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _o(t))!To.call(e,o)&&o!==n&&Dt(e,o,{get:()=>t[o],enumerable:!(r=Ao(t,o))||r.enumerable});return e};var Ie=(e,t,n)=>(n=e!=null?Eo(ko(e)):{},Lo(t||!e||!e.__esModule?Dt(n,"default",{value:e,enumerable:!0}):n,e));var vs=Math.PI/180;function dt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function _e(e){return e.length?dt(e):null}function Nt(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+s*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+s*e.end.y}}function Gt(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 r=Array.from({length:n+1},(m,u)=>Nt(e,u/n)),o=new Float64Array(r.length);for(let m=1;m<r.length;m+=1){let u=r[m].x-r[m-1].x,l=r[m].y-r[m-1].y;o[m]=o[m-1]+Math.hypot(u,l)}let i=o[o.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 u=i*m/(t-1);for(;a<o.length-1&&o[a]<u;)a+=1;let l=o[a-1],d=o[a],c=d===l?0:(u-l)/(d-l);s.push({x:r[a-1].x+(r[a].x-r[a-1].x)*c,y:r[a-1].y+(r[a].y-r[a-1].y)*c})}return s}function jt(e,t,n){return Math.max(t,Math.min(n,e))}function Ut(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((c,f)=>c.segmentedRow.componentIndex-f.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,f)=>c.segmentedRow?.kind==="segmented-row-v1"&&c.segmentedRow.groupId===r&&c.segmentedRow.componentCount===s&&c.segmentedRow.componentIndex===f&&c.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(f===0?c.segmentedRow.boundaryBefore==="start":c.segmentedRow.boundaryBefore!=="start")&&c.segmentedRow.displayLabel===a.displayLabel)))continue;let u=i.reduce((c,f)=>c+f.seatCount,0),l=0,d=0;for(let c of i)c.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(c.id,{groupId:r,adjacencyOffset:l,displayOffset:d,displayLabel:a.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),l+=c.seatCount,d+=c.seatCount}return t}var Oo="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Bo="abcdefghijklmnopqrstuvwxyz";function Fo(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function bt(e,t=!1){let n=t?Bo:Oo;return Fo(Math.max(0,Math.floor(e)-1),n)}var Do=[[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[r,o]of Do)for(;t>=r;)n+=o,t-=r;return n}function No(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function He(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=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 f=Math.ceil(m/2),b=i==="updown"?t<f?n+2*t:n-1+2*(m-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${s}${b}`}let u=i==="odd"||i==="even"?2:o,l=a!=null&&Number.isFinite(a)?a-(m-1)*u:n,d=r==="center"?No(m)[t]:r==="rtl"?m-1-t:t,c;switch(i){case"odd":{let f=l%2===1?l:l+1;c=String(f+d*2);break}case"even":{let f=l%2===0?l:l+1;c=String(f+d*2);break}case"roman":c=Yt(l+d*o);break;case"letters-upper":c=bt(l+d*o,!1);break;case"letters-lower":c=bt(l+d*o,!0);break;default:c=String(l+d*o);break}return`${s}${c}`}function Go(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Xt(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${He(e,t)}`}function pt(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(e.seatDisplayLabelMode==="number")return He(e,t);if(!n)return`${e.displayLabel||e.label}-${He(e,t)}`;let o=Go(n),i=n.displayOffset+t;return`${n.displayLabel}-${He(o,i)}`}var te=.02291666666666667,me=1/te,jo=58,Uo=jo*te;var Yo=3,Vt=0,ht=120,Xo=0,Vo=45,Ho=7,ce=1.2;function yt(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Ko(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Ho?e:Yo}function Ke(e,t={}){let n=yt(t.floorBaseHeightM,Vt,ht,0),r=Math.min(ht,n+Ko(e.elevation)*Uo),o=e.height===void 0?r:yt(e.height,Vt,ht,r),i=yt(e.rake,Xo,Vo,0);return{height:o,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 r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],s=e[o+1],a=s.x-i.x,m=s.y-i.y,u=a*a+m*m,l=u>1e-12?((t-i.x)*a+(n-i.y)*m)/u:0;l<0?l=0:l>1&&(l=1);let d=t-(i.x+l*a),c=n-(i.y+l*m);if(Math.abs(d)>=r||Math.abs(c)>=r)continue;let f=Math.hypot(d,c);f<r&&(r=f)}return r}function zo(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function Kt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function gt(e,t){let n=1/0;for(let r of Ht(e)){let o=ve(t,r.x,r.y);o<n&&(n=o)}for(let r of Ht(t)){let o=ve(e,r.x,r.y);o<n&&(n=o)}return n}function Wo(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let l of e)n+=l.x,r+=l.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let l of e){let d=Math.hypot(l.x-n,l.y-r);d>o&&(o=d,i=l)}let s=i.x-n,a=i.y-r,m=Math.hypot(s,a);m>1e-9?(s/=m,a/=m):(s=1,a=0);let u=e.map((l,d)=>({p:l,i:d,t:(l.x-n)*s+(l.y-r)*a})).sort((l,d)=>l.t-d.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function xt(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let x of e)n+=x.x,r+=x.y;n/=t,r/=t;let o=0,i=0,s=0,a=0,m=0,u=0,l=0;for(let x of e){let I=x.x-n,w=x.y-r;o+=I*I,s+=w*w,i+=I*w,a+=I*I*I,m+=w*w*w,u+=I*w*w,l+=w*I*I}let d=o*s-i*i;if(Math.abs(d)<1e-9)return null;let c=(a+u)/2,f=(m+l)/2,b=(c*s-f*i)/d,p=(f*o-c*i)/d,h=b+n,y=p+r;return!Number.isFinite(h)||!Number.isFinite(y)?null:{cx:h,cy:y}}var Zo=.15;function $o(e){if(e.length<2)return null;let t=e.map(x=>{let I=0,w=0;for(let C of x.pts)I+=C.x,w+=C.y;return{x:I/x.pts.length,y:w/x.pts.length}}),n=0,r=0;for(let x of t)n+=x.x,r+=x.y;n/=t.length,r/=t.length;let o=0,i=0,s=0;for(let x of t){let I=x.x-n,w=x.y-r;o+=I*I,i+=I*w,s+=w*w}let a=o+s,m=o*s-i*i,u=a/2+Math.sqrt(Math.max(0,a*a/4-m)),l,d;Math.abs(i)>1e-12?(l=u-s,d=i):o>=s?(l=1,d=0):(l=0,d=1);let c=Math.hypot(l,d);if(!(c>1e-12))return null;l/=c,d/=c;let f=1/0,b=-1/0,p=[];for(let x of e){let I=1/0,w=-1/0;for(let C of x.pts){let g=C.x*l+C.y*d;g<I&&(I=g),g>w&&(w=g),g<f&&(f=g),g>b&&(b=g)}p.push(w-I)}let h=b-f;return h>1e-9?(p.sort((x,I)=>x-I),p[Math.min(p.length-1,Math.floor(p.length*.9))]/h<=Qo?{x:l,y:d}:null):null}var Qo=.35;function ze(e,t,n,r){let o=new Map;for(let g of n){let M=t[g],R=M.rowId||`__seat-${g}`,k=o.get(R);k||(k={pts:[],idx:[]},o.set(R,k)),k.pts.push({x:M.x,y:M.y}),k.idx.push(g)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[g,M]of o){let R=Wo(M.pts,M.idx),k=0;for(let L of R.pts)k+=Math.hypot(L.x-r.x,L.y-r.y);i.push({id:g,pts:R.pts,seatIndices:R.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:k/R.pts.length})}let s=i.map(g=>zo(g.pts)),a=i.length<=256?i.length*(i.length-1)/2:0,m=a?new Float64Array(a):null;m?.fill(Number.NaN);let u=m?new Map(i.map((g,M)=>[g,M])):null,l=(g,M)=>(g>M&&([g,M]=[M,g]),g*(2*i.length-g-1)/2+(M-g-1)),d=(g,M)=>{if(!m)return gt(i[g].pts,i[M].pts);let R=l(g,M),k=m[R];if(!Number.isNaN(k))return k;let L=gt(i[g].pts,i[M].pts);return m[R]=L,L},c=(g,M)=>u?d(u.get(g),u.get(M)):gt(g.pts,M.pts),f=[];for(let g=0;g<i.length;g++){let M=1/0;for(let R=0;R<i.length;R++){if(g===R||Kt(s[g],s[R])>=M)continue;let k=d(g,R);k<M&&(M=k)}Number.isFinite(M)&&f.push(M)}f.sort((g,M)=>g-M);let b=f.length?f[Math.floor(f.length/2)]:1,p=Math.max(b*1.8,1e-6),h=i.map(()=>[]);for(let g=0;g<i.length;g++)for(let M=g+1;M<i.length;M++)Kt(s[g],s[M])>p||d(g,M)<=p&&(h[g].push(M),h[M].push(g));let y=0;for(let g=0;g<i.length;g++){if(i[g].blockId!==-1)continue;let M=y++,R=[g];for(i[g].blockId=M;R.length;){let k=R.pop();for(let L of h[k])i[L].blockId===-1&&(i[L].blockId=M,R.push(L))}}let x=new Map;for(let g of i){let M=x.get(g.blockId)??[];M.push(g),x.set(g.blockId,M)}let I=[];for(let g of i){if(g.pts.length<4)continue;let M=xt(g.pts);M&&(!Number.isFinite(M.cx)||!Number.isFinite(M.cy)||I.push({x:M.cx,y:M.cy}))}let w=I.length>=2?(()=>{let g=I.map(k=>k.x).sort((k,L)=>k-L),M=I.map(k=>k.y).sort((k,L)=>k-L),R=Math.floor(I.length/2);return{cx:g[R],cy:M[R]}})():null;if(w){let g=v=>Math.hypot(v.x-w.cx,v.y-w.cy),M=1/0,R=-1/0,k=[];for(let v of i){let S=1/0,T=-1/0;for(let N of v.pts){let E=g(N);E<S&&(S=E),E>T&&(T=E)}k.push(T-S),S<M&&(M=S),T>R&&(R=T)}let L=R-M;k.sort((v,S)=>v-S);let U=k[Math.min(k.length-1,Math.floor(k.length*.9))];if(L>1e-9&&U/L<=Zo){let v=i.map(F=>{let j=0;for(let Y of F.pts)j+=g(Y);return{row:F,radius:j/F.pts.length}}),S=0,T=0;for(let F of v)S+=F.radius,T+=F.row.focalDistance;S/=v.length,T/=v.length;let N=0;for(let F of v)N+=(F.radius-S)*(F.row.focalDistance-T);if(N<0)for(let F of v)F.radius=-F.radius;let O=1/0;for(let F of v)F.radius<O&&(O=F.radius);v.sort((F,j)=>F.radius-j.radius);let A=-1,_=-1/0,B=L/Math.max(1,v.length)*.5,D=[];for(let F of v)F.radius-_>B&&(A++,_=F.radius),F.row.ordinal=A,F.row.blockDepth=F.radius-O,D.push(F.row);return{sectionId:e,rows:D,blockCount:y}}}let C=[];for(let[,g]of x){let M=$o(g);if(M){let R=L=>{let U=0;for(let v of L.pts)U+=v.x*M.x+v.y*M.y;return U/L.pts.length};g.sort((L,U)=>R(L)-R(U)),g.length>=2&&g[0].focalDistance>g[g.length-1].focalDistance&&g.reverse();let k=0;for(let L=0;L<g.length;L++)L>0&&(k+=c(g[L-1],g[L])),g[L].ordinal=L,g[L].blockDepth=k,C.push(g[L])}else{let R=1/0;for(let k of g)k.focalDistance<R&&(R=k.focalDistance);g.sort((k,L)=>k.focalDistance-L.focalDistance);for(let k=0;k<g.length;k++)g[k].ordinal=k,g[k].blockDepth=Math.max(0,g[k].focalDistance-R),C.push(g[k])}}return{sectionId:e,rows:C,blockCount:y}}var qo=/^\d{4}-\d{2}-\d{2}$/;function Jo(e){let t=Date.parse(e);return Number.isFinite(t)?qo.test(e)?t+864e5:t:null}function er(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=Jo(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function tr(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function nr(e){return e.status!=="draft"&&e.status!=="retracted"}function or(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&&nr(e)&&tr(e,t.activeConfigurationId,t.activeConfigurationVersion)&&or(e,t.activeBasisSha256)&&er(e,t.now)}var Bs=Math.PI*2;function We(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var rr=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,ir=/[\s"'<>`\\]/;function sr(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return rr.test(e);if(ir.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 sr(t)?t:null}var Mt="seatlayer.event-configuration/1";var Re=100,ar=120,cr=2e5,ur=1e4,lr=/^[a-f0-9]{64}$/,fr=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 mr(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Zt(e){return!Array.isArray(e)||e.length>cr||!e.every(t=>be(t,Re))?null:[...new Set(e)].sort()}function dr(e){return!ke(e)||!be(e.chartId,Re)||!be(e.version,Re)||e.sha256!==void 0&&(typeof e.sha256!="string"||!lr.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function St(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function br(e){return ke(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&St(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function pr(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>ur)return null;let n=new Set(t),r=new Set,o=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)||!fr.has(String(a.kind))||!St(a.heightM,.05,50)||a.baseElevationM!==void 0&&!St(a.baseElevationM,-10,100))return null;let m=br(a.occlusion);if(!m||r.has(a.id)||o.has(a.objectId))return null;let u=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Wt(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!u||a.kind!=="screen"||++i>1))return null;r.add(a.id),o.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,...u?{contentImageUrl:u}:{}})}return s.sort((a,m)=>a.id.localeCompare(m.id))}function hr(e){let t=[];if(!ke(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Mt&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Mt}`}),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,ar)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),mr(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=dr(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=ke(e.overlay)?e.overlay:null,o=Zt(r?.objectIds),i=Zt(r?.productionKillSeatIds),s=o?pr(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||s===null?{issues:t}:{issues:t,value:{schema:Mt,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function $t(e){let t=hr(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function yr(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,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function gr(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*o-a*i,y:t.y+s*i+a*o}}function Qt(e){let t=yr(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(m=>gr(m,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),o=1/0,i=1/0,s=-1/0,a=-1/0;for(let m of r)o=Math.min(o,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x),a=Math.max(a,m.y);return!Number.isFinite(o)||s-o<1e-6||a-i<1e-6?null:{minX:o,minY:i,maxX:s,maxY:a}}var xr=5,Mr=3,Sr=.92,wr=1.9,Ir=2,vr=.6,Rr=1,Cr=.06;function Pr(e){return e.heightM!==void 0?e.heightM:We(e.stageKind)?Cr:Rr}function qt(e){let t=1/0,n=1/0,r=-1/0,o=-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 u=Qt(m);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),r=Math.max(r,u.maxX),o=Math.max(o,u.maxY),i=Math.max(i,a+Pr(m)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function Er(e,t,n,r){let o=1/0,i=1/0,s=-1/0,a=-1/0;for(let f of e)Number.isFinite(f.eyeHeightM)&&(o=Math.min(o,f.x),s=Math.max(s,f.x),i=Math.min(i,f.y),a=Math.max(a,f.y));if(!Number.isFinite(o))return null;let m=o*t,u=i*t,l=Math.max(1,Math.ceil((s-o)*t/n)+1),d=Math.max(1,Math.ceil((a-i)*t/n)+1),c=new Float64Array(l*d).fill(-1/0);for(let f of e){if(!Number.isFinite(f.eyeHeightM))continue;let b=f.eyeHeightM-ce,p=Math.min(l-1,Math.max(0,Math.floor((f.x*t-m)/n))),y=Math.min(d-1,Math.max(0,Math.floor((f.y*t-u)/n)))*l+p,x=b+r;x>c[y]&&(c[y]=x)}return{cellM:n,minX:m,minY:u,cols:l,rows:d,top:c}}function Ar(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Jt(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??te,i=n.cellM??vr,s=n.chairBackM??Sr,a=n.selfRowSkipM??Ir,m=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??xr),d=Math.max(1,n.rows??Mr),c=Er(e,o,i,s);if(!c)return r;let f=(t.maxX-t.minX)*o,b=(t.maxY-t.minY)*o,p=f>=b,h=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,x=[];for(let w=0;w<l;w++){let C=(w+.5)/l-.5,g=p?h+C*f:h,M=p?y:y+C*b;for(let R=0;R<d;R++){let k=t.deckTopM+(d===1?0:R/(d-1)*wr);x.push({x:g,y:M,z:k})}}let I=i/2;for(let w of e){if(!Number.isFinite(w.eyeHeightM))continue;let C=w.x*o,g=w.y*o,M=w.eyeHeightM,R=0,k=1/0;for(let U of x){let v=U.x-C,S=U.y-g,T=Math.hypot(v,S);if(!(T>a)){R++;continue}let N=v/T,E=S/T,O=0;for(let A=a;A<T;A+=I){let _=Ar(c,C+N*A,g+E*A);if(!(!Number.isFinite(_)||_>=M)&&_>M+(U.z-M)*A/T){O=A;break}}O?k=Math.min(k,O):R++}let L=R/x.length;L>=m||r.set(w.id,{seatId:w.id,mark:L<u?"obstructedView":"restrictedView",visibleFraction:L,totalRays:x.length,atDistanceM:Number.isFinite(k)?k:0})}return r}function en(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function wt(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var $e=Math.PI/180;var Te=16;function It(e,t,n,r){let o=n*$e,i=Math.cos(o),s=Math.sin(o);return{x:r.x+e*i-t*s,y:r.y+e*s+t*i}}function an(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,s=[];if(e.path)return Gt(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(r===0){for(let u=0;u<t;u++)s.push(It(u*n,0,o,i));return s}let a=r/(t-1)*$e,m=n/(2*Math.sin(Math.abs(a)/2));for(let u=0;u<t;u++){let l=u*a,d=m*Math.sin(l),c=-m+m*Math.cos(l);s.push(It(d,c,o,i))}return s}function cn(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function _r(e,t){let n=cn(e);return an(e).map((r,o)=>{let i=n.get(o),s=wt(i),a=Xt(e,o,i),m={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:a,displayLabel:pt(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(m).some(u=>u!==void 0&&u!==!1&&u!=="")?m:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function kr(e){let t=[];for(let n of _r(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 Tr(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function Lr(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(l=>[l.index,l])),o=(l,d,c,f)=>{let b=r.get(l),p=wt(b),h=b?.label??`${e.label}-${l+1}`,y=e.displayLabel??e.label;return{index:l,label:h,displayLabel:b?.displayLabel??`${y}-${l+1}`,x:d+(b?.dx??0),y:c+(b?.dy??0),categoryKey:b?.categoryKey??e.categoryKey,skipped:!!b?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:b?.wheelchairSpaceType,commercial:b?.commercial,glyph:b?.glyph,viewUrl:b?.viewFromSeatUrl,viewMeta:b?.viewFromSeatUrl?b.viewFromSeatMeta:void 0,labelStyle:b?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let l=(e.radius??40)+Te,d=e.rotation*$e,c=Math.max(0,Math.min(360,e.seatArc??360));if(c>=360||n===1){for(let h=0;h<n;h++){let y=d+h/n*2*Math.PI;t.push(o(h,e.center.x+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let f=c*$e,b=(2*Math.PI-f)/2,p=d+b;for(let h=0;h<n;h++){let y=p+h/(n-1)*f;t.push(o(h,e.center.x+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let i=e.width??80,s=e.height??50,a=Tr(e),m=["top","bottom","left","right"],u=0;for(let l of m){let d=a[l];for(let c=0;c<d;c++){let f,b;l==="top"?(f=-i/2+(c+.5)*i/d,b=-s/2-Te):l==="bottom"?(f=-i/2+(c+.5)*i/d,b=s/2+Te):l==="left"?(f=-i/2-Te,b=-s/2+(c+.5)*s/d):(f=i/2+Te,b=-s/2+(c+.5)*s/d);let p=It(f,b,e.rotation,e.center);t.push(o(u++,p.x,p.y,l))}}return t}function Or(e){return Lr(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 Br(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 r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,s=t[r].y,a=t[o].x,m=t[o].y;s>e.y!=m>e.y&&e.x<(a-i)*(e.y-s)/(m-s)+i&&(n=!n)}return n}function Fr(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),a=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function pe(e,t,n){return nn(e,t)&&!(n??[]).some(r=>nn(e,r)||Fr(e,r))}function Ze(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function un(e){switch(e.type){case"row":{let t=an(e),n=cn(e),r=0,o=0,i=0;for(let s=0;s<t.length;s++){let a=n.get(s);a?.skip||(r+=t[s].x+(a?.dx??0),o+=t[s].y+(a?.dy??0),i++)}return i?{x:r/i,y:o/i}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return Ze(e.points);case"section":return Ze(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?Ze(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,r)=>n.x===t[r].x&&n.y===t[r].y)}function Dr(e,t){if(e.type!=="gaArea"||!on(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>on(o,r[i]))}function Nr(e,t,n=e.filter(o=>o.type==="section"),r=un(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(Dr(t,s)||pe(r,s.outline,s.holes))):void 0)??n.find(s=>pe(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,r,o,i,s,a,m){let u=[],l=e.filter(p=>p.type==="section"),d=Ut(e),c=p=>!p?.eventConfigurationId||p.eventConfigurationId===r&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===m),f=p=>zt(p,{activeConfigurationId:r,activeConfigurationVersion:m,activeBasisSha256:o,now:a}),b=(p,h)=>f(p)?{...p,coverage:h}:void 0;for(let p of e){let h=[];if(p.type==="row"?h=kr(p):p.type==="table"?h=Or(p):p.type==="booth"&&(h=Br(p)),!h.length)continue;for(let C of h)C.viewUrl&&!c(C.viewMeta)&&(C.viewUrl=void 0,C.viewMeta=void 0);if(p.type==="row"){let C=d.get(p.id);if(C){let g=new Map((p.overrides??[]).map(M=>[M.index,M]));for(let M of h){let R=Number(M.id.slice(M.id.lastIndexOf(":")+1));if(!Number.isInteger(R))continue;M.logicalRowId=C.groupId,M.logicalSeatIndex=C.adjacencyOffset+R,g.get(R)?.displayLabel||(M.displayLabel=pt(p,R,C)),!M.viewUrl&&C.viewFromSeatUrl&&c(C.viewFromSeatMeta)&&(M.viewUrl=C.viewFromSeatUrl,M.viewMeta=C.viewFromSeatMeta);let k=g.get(R)?.confidenceEvidence;M.confidenceEvidence=b(k,"exact-seat")??b(p.confidenceEvidence,"row-representative")??b(C.confidenceEvidence,"row-representative")}}}let y=Nr(e,p,l,p.type==="row"?Ze(h):un(p)),x=y?.viewFromSeatUrl,w=(y?.zone?t?.find(C=>C.id===y.zone):void 0)?.focalPoint??n;for(let C of h){if(!C.confidenceEvidence){let g=Number(C.id.slice(C.id.lastIndexOf(":")+1)),M=(p.type==="row"||p.type==="table")&&Number.isInteger(g)?p.overrides?.find(R=>R.index===g)?.confidenceEvidence:void 0;C.confidenceEvidence=b(M,"exact-seat")??(p.type==="row"?b(p.confidenceEvidence,"row-representative"):void 0)}C.confidenceEvidence??=b(y?.confidenceEvidence,"section-representative")??(s?b(s.evidence,s.coverage):void 0),!C.viewUrl&&x&&c(y?.viewFromSeatMeta)&&(C.viewUrl=x,C.viewMeta=y?.viewFromSeatMeta),!C.viewUrl&&i&&c(i.meta)&&(C.viewUrl=i.url,C.viewMeta=i.meta),y&&(C.sectionId=y.logicalSectionId??y.id),y?.zone&&(C.zoneId=y.zone),w&&(C.focalPoint={...w})}u.push(...h)}return u}function ln(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,m=rn(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&sn(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,m);for(let u of m)u.floorId=o.id;for(let u of m)r.push(u)}return r}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),Gr(e,n,t)}function Gr(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||en(t,Jt(t,qt(e))),t}function sn(e,t,n,r){let o=e.filter(d=>d.type==="section"),i=n>0||o.some(d=>d.height!==void 0||d.rake!==void 0||(d.elevation??0)>0);if(!o.length||!i||!t){for(let d of r)d.eyeHeightM=n+ce;return}let s=new Array(r.length),a=new Map;for(let d of o)a.has(d.id)||a.set(d.id,d);let m=new Map,u=new Map;for(let d=0;d<r.length;d++){let c=r[d],b=(c.sectionId?a.get(c.sectionId)??o.find(h=>h.logicalSectionId===c.sectionId&&pe({x:c.x,y:c.y},h.outline,h.holes)):void 0)??o.find(h=>pe({x:c.x,y:c.y},h.outline,h.holes))??null;if(s[d]=b,!b)continue;m.has(b.id)||m.set(b.id,Ke(b,{floorBaseHeightM:n}));let p=u.get(b.id);p?p.push(d):u.set(b.id,[d])}let l=new Array(r.length).fill(void 0);for(let[d,c]of u){let f=m.get(d);if(!f)continue;let b=f.rake>0?Math.tan(f.rake*Math.PI/180):0,p=ze(d,r,c,t);for(let h of p.rows){let y=h.blockDepth*te*b,x=f.height+y;for(let I of h.seatIndices)l[I]=x}}for(let d=0;d<r.length;d++){let c=r[d],f=s[d];if(!f){c.eyeHeightM=n+ce;continue}let b=m.get(f.id);c.eyeHeightM=(l[d]??b.height)+ce}}var jr=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ur(e){let t=jr.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function W(e){let t=Ur(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Yr(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=Yr(e);return ne(e,[n,n,n],t)}var Qe=["available","held","sold","selected","dimmed"];function fn(e){let t=Qe.indexOf(e);return t<0?0:t}var mn={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 Xr=.15,Vr=1.6;function dn(e){return jt(e??1,Xr,Vr)}var Hr=.15,Kr=.9,zr=1.76;function Wr(){return{background:{top:[...Rt.top],bottom:[...Rt.bottom]},structure:vt,seatStates:{...mn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function bn(e){let t=Wr();if(!e)return t;let n=W(e.background);if(n){t.background={top:ie(n,Kr),bottom:ie(n,zr)};let s={};for(let[a,m]of Object.entries(vt))s[a]=ne(m,n,Hr);t.structure=s}let r=W(e.selectionColor)??W(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=dn(o));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 pn(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}var yn=Ie(require("earcut"),1),gn=Ie(require("polygon-clipping"),1);function he(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function Oe(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let s=e[o],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}var P=te,Zr=.002;function $r(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),s=Math.max(r,o,i);if(s<1e-9)return!0;let a=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-r)*(a-o)*(a-i)))/s<Zr}var ye=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},et=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,r,o,i,s=i,a=i){$r(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(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,r,o,i,s,a,m=a,u=a){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(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(u[0],u[1],u[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function Qr(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],m=n[2]-e[2],u=o*m-i*a,l=i*s-r*m,d=r*a-o*s,c=Math.hypot(u,l,d)||1;return u/=c,l/=c,d/=c,[u,l,d]}function qr(e,t){let n=[...e],r=[];for(let s of e)r.push(s.x,s.y);let o=[];if(t){for(let s of t)if(!(s.length<3)){o.push(n.length);for(let a of s)n.push(a),r.push(a.x,a.y)}}let i=(0,yn.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Ct(e){return he(e)<0?[...e].reverse():e}var Jr=3;function ei(e,t,n,r){let o=r(e),i=r(t),s=r(n),a=(f,b,p,h)=>Math.abs(r({x:(f.x+b.x)/2,y:(f.y+b.y)/2})-(p+h)/2),m=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(o+i+s)/3,d=Math.max(a(e,t,o,i),a(t,n,i,s),a(n,e,s,o),Math.abs(r({x:m,y:u})-l)),c=(f,b,p)=>{let h=Math.abs(r({x:(f+m)/2,y:(b+u)/2})-(p+l)/2);h>d&&(d=h)};return c((e.x+t.x)/2,(e.y+t.y)/2,(o+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+o)/2),d}function Be(e,t,n,r,o){if(o<=0)return ei(e,t,n,r);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,r,o-1),Be(i,t,s,r,o-1),Be(a,s,n,r,o-1),Be(i,s,a,r,o-1))}function Fe(e,t,n,r,o,i,s,a){if(s>0){let c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},f={x:(n.x+r.x)/2,y:(n.y+r.y)/2},b={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Fe(e,t,c,b,o,i,s-1,a),Fe(e,c,n,f,o,i,s-1,a),Fe(e,b,f,r,o,i,s-1,a),Fe(e,c,f,b,o,i,s-1,a);return}let m=[t.x*P,o(t),t.y*P],u=[n.x*P,o(n),n.y*P],l=[r.x*P,o(r),r.y*P];if(a){e.triN(m,u,l,a(t),a(n),a(r),i);return}let d=Qr(m,u,l);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(m,u,l,d,i)}var ti=8;function hn(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,s,a,m,u)=>{if(u>0){let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},d=t(l);if(Math.abs(d-(a+m)/2)>n){o(i,l,a,d,u-1),o(l,s,d,m,u-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];o(s,a,t(s),t(a),ti)}return r}function qe(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],s=n[o],a=n[(o+1)%n.length],m=a.x-i.x,u=a.y-i.y,l=Math.hypot(m,u);l>t&&Math.abs((s.x-i.x)*u-(s.y-i.y)*m)/l<t||r.push(s)}return r.length>=3?r:n}var Je=.001*me*.1;function J(e,t,n,r,o,i,s,a,m=1/0,u){if(!t||t.length<3||(m===void 0&&(m=1/0),Math.abs(he(t))<1e-4))return;let l=qe(hn(qe(Ct(t),Je),r,m),Je),d=n?.map(g=>qe(hn(qe(Ct(g),Je),r,m),Je)).filter(g=>g.length>=3&&Math.abs(he(g))>=1e-4),{pts:c,tris:f}=qr(l,d),b=[i[0]*a.top,i[1]*a.top,i[2]*a.top],p=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],h=[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],x=0;if(Number.isFinite(m))for(;x<Jr;x++){let g=0;for(let M=0;M<f.length;M+=3){let R=Be(c[f[M]],c[f[M+1]],c[f[M+2]],r,x);R>g&&(g=R)}if(g<=m)break}for(let g=0;g<f.length;g+=3){let M=c[f[g]],R=c[f[g+1]],k=c[f[g+2]];Fe(e,M,R,k,r,b,x,u);let L=[M.x*P,o,M.y*P],U=[R.x*P,o,R.y*P],v=[k.x*P,o,k.y*P];e.tri(L,v,U,[0,-1,0],p)}let I=g=>{if(x<=0)return g;let M=1<<x,R=[];for(let k=0;k<g.length;k++){let L=g[k],U=g[(k+1)%g.length];for(let v=0;v<M;v++){let S=v/M;R.push({x:L.x+(U.x-L.x)*S,y:L.y+(U.y-L.y)*S})}}return R},w=dt(l),C=[{ring:I(l),flip:!1}];if(d)for(let g of d)g.length>=3&&C.push({ring:I(g),flip:!0});for(let{ring:g,flip:M}of C)for(let R=0;R<g.length;R++){let k=g[R],L=g[(R+1)%g.length],U=(L.x-k.x)*P,S=(L.y-k.y)*P,T=-U,N=Math.hypot(S,T)||1;S/=N,T/=N;let E=(k.x+L.x)/2-w.x,O=(k.y+L.y)/2-w.y,A=S*E+T*O;M&&(A=-A),A<0&&(S=-S,T=-T);let _=[S,0,T],B=[k.x*P,r(k),k.y*P],D=[L.x*P,r(L),L.y*P],F=[k.x*P,o,k.y*P],j=[L.x*P,o,L.y*P];e.tri(B,D,j,_,h,h,y),e.tri(B,j,F,_,h,y,y)}}function xn(e){let t=0;for(let m of e)t+=m.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=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),r.set(m.normal,a*3),o.set(m.color,a*3),i.set(m.floor,a),s.set(m.material,a),a+=m.count;return{position:n,normal:r,color:o,floor:i,material:s,count:t}}function tt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Ct(e),o=r.length,i=[];for(let a=0;a<o;a++){let m=r[a],u=r[(a+1)%o],l=u.x-m.x,d=u.y-m.y,c=Math.hypot(l,d)||1;i.push({x:d/c,y:-l/c})}let s=[];for(let a=0;a<o;a++){let m=r[a],u=i[(a-1+o)%o],l=i[a],d=u.x+l.x,c=u.y+l.y,f=Math.hypot(d,c),b=()=>{s.push([m.x+u.x*t,m.y+u.y*t]),s.push([m.x+l.x*t,m.y+l.y*t])};if(f<1e-9){b();continue}d/=f,c/=f;let p=d*u.x+c*u.y,h=1/Math.max(p,1e-6);if(!Number.isFinite(h)||h>n){b();continue}s.push([m.x+d*t*h,m.y+c*t*h])}if(s.length<3)return e;try{let a=gn.default.union([[...s,s[0]]]),m=null,u=-1/0;for(let d of a){let c=Math.abs(he(d[0].map(([f,b])=>({x:f,y:b}))));c>u&&(u=c,m=d[0])}if(!m)return e;let l=m.map(([d,c])=>({x:d,y:c}));if(l.length>1){let d=l[0],c=l[l.length-1];Math.abs(d.x-c.x)<1e-9&&Math.abs(d.y-c.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function nt(e,t,n,r,o=28){let i=[];for(let s=0;s<o;s++){let a=s/o*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+r*Math.sin(a)})}return i}function De(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ni=[{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"}],ga=new Map(ni.map(e=>[e.key,e]));var oi={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function Mn(e){let t=e?.[0];return t&&oi[t]||"#3b82f6"}var ri=[{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"}],xa=new Map(ri.map(e=>[e.key,e]));var ii=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Ma=new Set(ii);var wn=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark: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},mark:{x:12,y:10,radius:6}},{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},mark:{x:12,y:10,radius:4.5}},{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},mark:{x:12,y:5,radius:3}},{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},mark:{x:12,y:7.5,radius:5.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},mark:{x:12,y:8,radius: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},mark:{x:12,y:9.25,radius:6.5}},{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},mark:{x:12,y:12.25,radius:4.75}}],In=wn.map(e=>e.key),si=new Map(wn.map(e=>[e.key,e]));function Sn(e){return typeof e=="string"&&si.has(e)}function vn(e,t){return Sn(e)?e:Sn(t?.seatGlyph)?t.seatGlyph:"circle"}var ee={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ai=.44,ci=.15,ui=.3,li=.24;function Rn(e){return e===void 0||!Number.isFinite(e)||e<=0?li:Math.min(ui,Math.max(ci,e*ai))}var fi=.05,Cn=.45,mi=Cn+fi,di=.92;var Ra=[{part:ee.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ee.pad,min:[-1,.36,-.95],max:[1,Cn,1]},{part:ee.back,min:[-1,mi,-1],max:[1,di,-.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]}],Ca=[{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 Pn(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],s=u=>e[u*3+2],a=0,m=(u,l)=>{let d=l-u;for(let c=u;c<l;c++){let[f,b]=r(c),p=f-i(c),h=b-s(c);if(d>=2){let y=Math.max(u,c-1),x=Math.min(l-1,c+1),I=i(x)-i(y),w=s(x)-s(y),C=Math.hypot(I,w);if(C>1e-6){let g=-w/C,M=I/C;g*p+M*h<0&&(g=-g,M=-M),p=g,h=M}}o[c]=p===0&&h===0?0:Math.atan2(p,h)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(a))&&(m(a,u),a=u);return o}var ot=.22;var bi=.42;function pi(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,s=-1/0;for(let b of e)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>i&&(i=b.x),b.y>s&&(s=b.y);let a=Math.max(i-r,1e-6),m=Math.max(s-o,1e-6),u=Math.max(Math.sqrt(a*m/t),1e-6),l=Math.max(1,Math.ceil(a/u)+1),d=Math.max(1,Math.ceil(m/u)+1),c=new Map,f=(b,p)=>{let h=Math.min(l-1,Math.max(0,Math.floor((b-r)/u)));return Math.min(d-1,Math.max(0,Math.floor((p-o)/u)))*l+h};for(let b=0;b<t;b++){let p=f(e[b].x,e[b].y),h=c.get(p);h?h.push(b):c.set(p,[b])}for(let b=0;b<t;b++){let p=e[b],h=Math.min(l-1,Math.max(0,Math.floor((p.x-r)/u))),y=Math.min(d-1,Math.max(0,Math.floor((p.y-o)/u))),x=1/0;for(let I=1;I<=4;I++){for(let w=y-I;w<=y+I;w++)if(!(w<0||w>=d))for(let C=h-I;C<=h+I;C++){if(C<0||C>=l||I>1&&Math.abs(w-y)<I&&Math.abs(C-h)<I)continue;let g=c.get(w*l+C);if(g)for(let M of g){if(M===b)continue;let R=Math.hypot(e[M].x-p.x,e[M].y-p.y);R<x&&(x=R)}}if(Number.isFinite(x)&&x<=I*u)break}n[b]=x}return n}function hi(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-ce):0}function En(e,t,n,r,o,i){let s=e.length,a=new Float32Array(s*3),m=new Float32Array(s),u=new Float32Array(s*3),l=new Float32Array(s),d=new Float32Array(s),c=new Float32Array(s),f=new Float32Array(s),b=new Float32Array(s*3),p=new Map,h=pi(e);for(let y=0;y<s;y++){let x=e[y],w=(n?.seatPitchU(y)??h[y])*P;l[y]=Number.isFinite(w)?Math.max(.06,Math.min(ot,w*bi)):ot,d[y]=Rn(Number.isFinite(w)?w:void 0);let C=vn(x.glyph,{seatGlyph:i?.get(x.categoryKey)});c[y]=In.indexOf(C),f[y]=x.wheelchairSpaceType==="no-seat"?0:1,a[y*3]=x.x*P,a[y*3+1]=n?n.seatDeckY(y):hi(x),a[y*3+2]=x.y*P,m[y]=fn(t?t(x):"available");let g=W(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=g[0],u[y*3+1]=g[1],u[y*3+2]=g[2],x.accessibility?.length){let M=W(Mn(x.accessibility));M&&(b[y*3]=M[0],b[y*3+1]=M[1],b[y*3+2]=M[2])}p.set(x.id,y)}return{count:s,iPosition:a,iState:m,iCategory:u,iMaxRadius:l,iRing:b,idToIndex:p,iChairWidth:d,iGlyph:c,iPhysicalSeat:f,iFloor:r??new Float32Array(s),iYaw:new Float32Array(s)}}function yi(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function gi(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let f of e)n+=f.x,r+=f.y,o+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let s=e[0],a=-1;for(let f of e){let b=Math.hypot(f.x-n,f.y-r);b>a&&(a=b,s=f)}let m=s.x-n,u=s.y-r,l=Math.hypot(m,u);l>1e-9?(m/=l,u/=l):(m=1,u=0);let d=[...e].sort((f,b)=>(f.x-n)*m+(f.y-r)*u-((b.x-n)*m+(b.y-r)*u)),c=0;for(let f of d){let b=Math.hypot(f.x-n,f.y-r);b>c&&(c=b)}return{pts:d,cx:n,cy:r,radius:c,depth:o}}function An(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let s=r[i],a=r[i+1],m=a.x-s.x,u=a.y-s.y,l=m*m+u*u,d=l>1e-12?((t-s.x)*m+(n-s.y)*u)/l:0;d<0?d=0:d>1&&(d=1);let c=Math.hypot(t-(s.x+d*m),n-(s.y+d*u));c<o&&(o=c)}return o}var rt=8;function xi(e,t,n){let r=new Array(rt).fill(1/0),o=new Array(rt).fill(-1);for(let l=0;l<e.length;l++){let d=e[l],c=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let f=0;f<rt;f++)if(c<r[f]){for(let b=rt-1;b>f;b--)r[b]=r[b-1],o[b]=o[b-1];r[f]=c,o[f]=l;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let l of o){if(l<0)continue;let d=An(e[l],t,n);for(let c=0;c<3;c++)if(d<i[c]){for(let f=2;f>c;f--)i[f]=i[f-1],s[f]=s[f-1];i[c]=d,s[c]=l;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,u=0;for(let l=0;l<3;l++){let d=s[l];if(d<0||i[l]>a)continue;let c=1/(i[l]*i[l]);m+=c*e[d].depth,u+=c}return u>0?m/u:e[s[0]].depth}function Mi(e){let t=(r,o)=>xi(e,r,o),n=(r,o)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let m=e[a];if(Math.hypot(r-m.cx,o-m.cy)-m.radius>=i)continue;let u=An(m,r,o);u<i&&(i=u,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,s=(t(r,o+.5)-t(r,o-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function _n(e,t){let n=[];for(let r of e){let o=gi(r.points,t);o&&n.push(o)}return n.length<2?yi(t):(n.sort((r,o)=>r.depth-o.depth),Mi(n))}var At=Ie(require("polygon-clipping"),1);var On=Ie(require("earcut"),1);var Si=.58,kn=.01,se=ot*1.5*me,wi=.5,Ii=.6;function vi(e,t){let n=e.length,r=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],m=e[Math.min(n-1,s+1)],u=m.x-a.x,l=m.y-a.y,d=Math.hypot(u,l);if(d<1e-9){r.push([0,0]);continue}u/=d,l/=d,r.push([-l,u])}let o=0;for(let s=0;s<n;s++)o+=(e[s].x-t.x)*r[s][0]+(e[s].y-t.y)*r[s][1];return o<0?r.map(([s,a])=>[-s,-a]):r}function Ri(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(s,a)=>{let m=a.x-s.x,u=a.y-s.y,l=Math.hypot(m,u)||1;return{x:m/l,y:u/l}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Tn=Math.PI/12;function Ci(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),r=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},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Bn(e,t){if(!e.length||!(t>0))return[];let n=Ci(e),r=(a,m,u,l)=>{let d=u-m;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let c=Math.max(1,Math.ceil(d/Tn)),f=t/Math.cos(d/c/2);for(let b=0;b<=c;b++){let p=m+d*b/c;l.push({x:a.x+Math.cos(p)*f,y:a.y+Math.sin(p)*f})}};if(n.length<3){let a=0,m=0;for(let f of n)a+=f.x,m+=f.y;a/=n.length||1,m/=n.length||1;let u=0;for(let f of n)u=Math.max(u,Math.hypot(f.x-a,f.y-m));let l=[],d=Math.max(3,Math.ceil(Math.PI*2/Tn)),c=(u+t)/Math.cos(Math.PI/d);for(let f=0;f<d;f++){let b=f/d*Math.PI*2;l.push({x:a+Math.cos(b)*c,y:m+Math.sin(b)*c})}return l}let o=n.length,i=[];for(let a=0;a<o;a++){let m=n[a],u=n[(a+1)%o];i.push(Math.atan2(-(u.x-m.x),u.y-m.y))}let s=[];for(let a=0;a<o;a++)r(n[a],i[(a+o-1)%o],i[a],s);return jn(s)}function Pi(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],s=e[o+1],a=s.x-i.x,m=s.y-i.y,u=a*a+m*m,l=u>1e-12?((t-i.x)*a+(n-i.y)*m)/u:0;l<0?l=0:l>1&&(l=1);let d=Math.hypot(t-(i.x+l*a),n-(i.y+l*m));d<r&&(r=d)}return r}function it(e){let t=e.map(o=>{let i=0,s=0;for(let u of o.pts)i+=u.x,s+=u.y;let a=o.pts.length||1;i/=a,s/=a;let m=0;for(let u of o.pts){let l=Math.hypot(u.x-i,u.y-s);l>m&&(m=l)}return{cx:i,cy:s,rad:m}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),s=[],a=1/0,m=null;for(let l of i){let d=1/0;for(let c=0;c<e.length;c++){if(c===o||Math.abs(e[c].y-e[o].y)<.001)continue;let f=t[c],b=Math.hypot(l.x-f.cx,l.y-f.cy)-f.rad;if(b>=d&&b>=a)continue;let p=Pi(e[c].pts,l.x,l.y);p<d&&(d=p),e[c].depth<e[o].depth&&p<a&&(a=p,m=e[c].y)}Number.isFinite(d)&&d>0&&s.push(d)}s.sort((l,d)=>l-d);let u=s.length?s[Math.floor(s.length/2)]:1;r.push({pitch:u,belowY:m})}return r}function Fn(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let l=o.pts[0],d=l.x-r.x,c=l.y-r.y,f=Math.hypot(d,c)||1;d/=f,c/=f;let b=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+c*b,y:l.y-d*b},{x:l.x-c*b,y:l.y+d*b}]})():[];if(i.length<2)return null;let s=0,a=0;for(let l=1;l<i.length;l++){let d=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);d>1e-6&&(s+=d,a++)}let m=a>0?s/a:0,u=Ri(i,Math.max(m*Ii,se));return{pts:u,nrm:vi(u,r),front:Math.max(n[t].pitch*Si,se),back:Math.max(n[t].pitch*wi,se)}}var Ce=1.5,Dn=.3;function Pt(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,s=Math.hypot(o,i),a=-1,m=-1;for(let d=1;d<e.length-1;d++){let c=e[d],f=s>1e-12?Math.abs((c.x-n.x)*i-(c.y-n.y)*o)/s:Math.hypot(c.x-n.x,c.y-n.y);f>a&&(a=f,m=d)}if(a<=t||m<0)return[n,r];let u=Pt(e.slice(0,m+1),t),l=Pt(e.slice(m),t);return[...u.slice(0,-1),...l]}function Nn(e,t){if(e.length<4)return e;let n=Pt([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Gn(e,t,n){if(e.length<2)return[];let r=n??it(e),o=new Map;for(let s=0;s<e.length;s++){let a=o.get(e[s].blockId);a?a.push(s):o.set(e[s].blockId,[s])}let i=[];for(let[,s]of o){let a=[];for(let x of s){let I=e[x].patch;I&&I.length>=3?i.push({outline:[...I],holes:[],topY:e[x].y}):a.push(x)}if(!a.length)continue;a.sort((x,I)=>e[x].depth-e[I].depth);let u=a.map(x=>Fn(e,x,r,t)).filter(x=>x!==null);if(!u.length)continue;let l=(x,I)=>({x:x.pts[I].x-x.nrm[I][0]*(x.front+Ce),y:x.pts[I].y-x.nrm[I][1]*(x.front+Ce)}),d=(x,I)=>({x:x.pts[I].x+x.nrm[I][0]*(x.back+Ce),y:x.pts[I].y+x.nrm[I][1]*(x.back+Ce)}),c=u[0],f=u[u.length-1],b=[];for(let x=0;x<c.pts.length;x++)b.push(l(c,x));for(let x of u)b.push(d(x,x.pts.length-1));for(let x=f.pts.length-1;x>=0;x--)b.push(d(f,x));for(let x=u.length-1;x>=0;x--)b.push(l(u[x],0));let p=jn(b),h=1/0;for(let x of a)e[x].y<h&&(h=e[x].y);if(!Number.isFinite(h))continue;if(p.length>=3&&Math.abs(he(p))>1e-6&&u.every(x=>{let I=x.pts[Math.floor(x.pts.length/2)];return Oe(p,I.x,I.y)})){i.push({outline:Nn(p,Dn),holes:[],topY:h});continue}for(let x of Ei(u))i.push({outline:x,holes:[],topY:h})}return i}function Ei(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+Ce,s=n.back+Ce;for(let m=0;m<n.pts.length;m++){let u=n.pts[m],l=n.nrm[m];r.push([u.x-l[0]*i,u.y-l[1]*i]),o.push([u.x+l[0]*s,u.y+l[1]*s])}let a=[...r,...o.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)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([m,u])=>({x:m,y:u})),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&&r.push(Nn(i,Dn))}return r}catch{return[]}}function jn(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var 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 r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!Oe(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Ln(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],l=r[0];for(let d=1;d+1<r.length;d++){let c=r[d],f=r[d+1];e.tri([l.x*P,o,l.y*P],[c.x*P,o,c.y*P],[f.x*P,o,f.y*P],u,i)}return}let s=r.map(u=>[u.x,u.y]);s.push(s[0]);let a;try{a=At.default.intersection([s],t)}catch{return}let m=[0,1,0];for(let u of a){if(!u.length||u[0].length<4)continue;let l=u[0],d=[],c=[];for(let b=0;b<l.length-1;b++)d.push(l[b][0],l[b][1]),c.push([l[b][0],l[b][1]]);if(c.length<3)continue;let f=(0,On.default)(d,void 0,2);for(let b=0;b<f.length;b+=3){let p=c[f[b]],h=c[f[b+1]],y=c[f[b+2]];e.tri([p[0]*P,o,p[1]*P],[h[0]*P,o,h[1]*P],[y[0]*P,o,y[1]*P],m,i)}}}function Un(e,t,n,r,o,i,s){if(t.length<2)return;let a=s??it(t),m=[0,1,0],u=i&&i.length>=3?[[...i.map(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new Et([[...i]]):null,d=f=>{e.setMaterial(2),f(),e.setMaterial(0)},c=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let b=t[f];if(b.patch&&b.patch.length>=3){let C=[...b.patch],g=a[f].belowY??r;if(c(()=>{if(u&&l)Ln(e,u,l,C,b.y,o.tread);else{let M=C[0];for(let R=1;R+1<C.length;R++){let k=C[R],L=C[R+1];e.tri([M.x*P,b.y,M.y*P],[k.x*P,b.y,k.y*P],[L.x*P,b.y,L.y*P],m,o.tread)}}}),b.y>g+kn){let M=0,R=0;for(let k of C)M+=k.x,R+=k.y;M/=C.length,R/=C.length,d(()=>{for(let k=0;k<C.length;k++){let L=C[k],U=C[(k+1)%C.length],v=U.x-L.x,S=U.y-L.y,T=Math.hypot(v,S);if(T<1e-6)continue;let N=S/T,E=-v/T;(L.x-M)*N+(L.y-R)*E<0&&(N=-N,E=-E);let O=[N,0,E],A=[L.x*P,b.y,L.y*P],_=[U.x*P,b.y,U.y*P],B=[L.x*P,g,L.y*P],D=[U.x*P,g,U.y*P];e.tri(A,_,D,O,o.riser),e.tri(A,D,B,O,o.riser)}})}continue}let p=Fn(t,f,a,n);if(!p)continue;let{pts:h,nrm:y,front:x,back:I}=p,w=a[f].belowY??r;for(let C=0;C+1<h.length;C++){let g=h[C],M=h[C+1],R=y[C],k=y[C+1];if(Math.hypot(M.x-g.x,M.y-g.y)<1e-6||R[0]===0&&R[1]===0||k[0]===0&&k[1]===0)continue;let L=[(g.x-R[0]*x)*P,b.y,(g.y-R[1]*x)*P],U=[(M.x-k[0]*x)*P,b.y,(M.y-k[1]*x)*P],v=[(g.x+R[0]*I)*P,b.y,(g.y+R[1]*I)*P],S=[(M.x+k[0]*I)*P,b.y,(M.y+k[1]*I)*P];if(c(()=>{u&&l?Ln(e,u,l,[{x:g.x-R[0]*x,y:g.y-R[1]*x},{x:M.x-k[0]*x,y:M.y-k[1]*x},{x:M.x+k[0]*I,y:M.y+k[1]*I},{x:g.x+R[0]*I,y:g.y+R[1]*I}],b.y,o.tread):(e.tri(L,U,S,m,o.tread),e.tri(L,S,v,m,o.tread))}),b.y>w+kn){let T=[L[0],w,L[2]],N=[U[0],w,U[2]],E=[-R[0],0,-R[1]];d(()=>{e.tri(L,U,N,E,o.riser),e.tri(L,N,T,E,o.riser)})}}}}function Yn(e){let t=1/0,n=1/0,r=-1/0,o=-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>r&&(r=s.x),s.y>o&&(o=s.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function st(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 Ai(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Xn(e,t){return e.filter(n=>n.type!=="shape"||Ai(n,t))}function Vn(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Xn(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Xn(e.objects,t),focal:n,baseHeightM:0,index:0}]}var _i={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Pe(e){return Yn(e)??_i}function Hn(e,t){let n=tt(e.outline,se),r=Pe(n),o=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&st(r,Pe(s.outline)));if(!o.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)],...o.map(m=>[i(m.outline)])),a=[];for(let m of s){if(!m.length)continue;let u=m[0].map(([l,d])=>({x:l,y:d}));if(u.length>1){let l=u[0],d=u[u.length-1];Math.abs(l.x-d.x)<1e-9&&Math.abs(l.y-d.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a.length?a:[n]}catch{return[n]}}function Kn(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},r=t.map(i=>[n(i)]),o=[];for(let i of e){let s;try{s=_t.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let a of s){if(!a.length)continue;let m=a[0].map(([u,l])=>({x:u,y:l}));if(m.length>1){let u=m[0],l=m[m.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&m.pop()}m.length>=3&&o.push({outline:m,holes:[],topY:i.topY})}}return o.length?o:e}var ki=.05,zn=.05,Ti=.15,kt=25;function Wn(e,t,n){let r=new Map,o=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,u=[],l=new Set;for(let c=0;c<e.length;c+=1){let f=e[c];for(let b of f.objects){if(b.type==="table"&&l.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=tt(b.outline,se);m.set(b.id,{section:b,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:b.id,floorIndex:c,box:Pe(p),section:b,unit:f,outline:p})}}let d=new Map;for(let c of u){let f=d.get(c.floorIndex);f?f.push(c):d.set(c.floorIndex,[c])}for(let c=0;c<t.length;c++){let f=t[c],b=n?d.get(n[c])??[]:u,p=f.sectionId?b.find(y=>y.id===f.sectionId)??b.find(y=>y.section.logicalSectionId===f.sectionId&&pe({x:f.x,y:f.y},y.outline,y.section.holes)):void 0,h=p?[p]:b;for(let y of h){if(n&&y.floorIndex!==n[c]||!p&&(f.x<y.box.minX||f.x>y.box.maxX||f.y<y.box.minY||f.y>y.box.maxY||!pe({x:f.x,y:f.y},y.outline,y.section.holes)))continue;o[c]=y.id;let x=m.get(y.id);x.hasSeats=!0;let I=f.focalPoint??y.unit.focal,w=Math.hypot(f.x-I.x,f.y-I.y);w<x.frontU&&(x.frontU=w),x.seatIndices.push(c);let C=f.rowId||`__seat-${c}`,g=x.rows.get(C);g?g.push({x:f.x,y:f.y}):x.rows.set(C,[{x:f.x,y:f.y}]);break}}for(let[c,f]of m){let b=Ke(f.section,{floorBaseHeightM:f.unit.baseHeightM}),p=f.unit.baseHeightM,h=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=p+.001,x=f.section.surfaceKind,I=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:y,w=f.hasSeats?ze(c,t,f.seatIndices,f.unit.focal):{sectionId:c,rows:[],blockCount:0},g=w.rows.length<2?_n([...f.rows.values()].map(A=>({points:A})),f.unit.focal):null,M=1/0;if(g){if(f.hasSeats)for(let A of f.rows.values())for(let _ of A){let B=g.depthAt(_.x,_.y);B<M&&(M=B)}if(!f.hasSeats||!Number.isFinite(M)){M=1/0;for(let A of f.section.outline){let _=g.depthAt(A.x,A.y);_<M&&(M=_)}}}let R=p+ki,k=Math.max(R,b.height),L=A=>{let _=Math.max(0,A-M)*te,B=Math.min(_*h,kt);return Math.max(R,b.height+B)},U=A=>{let _=Math.max(0,A)*te,B=Math.min(_*h,kt);return Math.max(R,b.height+B)},v=I?[]:w.rows.map(A=>({pts:A.pts,y:U(A.blockDepth),depth:A.blockDepth,blockId:A.blockId,...l.has(A.id)?{patch:Bn(A.pts,se)}:{}})),S=v.length?v[0].y:k,T=v.map(A=>{let _=A.patch&&A.patch.length>=3?A.patch:A.pts,B=0,D=0;for(let Y of _)B+=Y.x,D+=Y.y;let F=_.length||1;B/=F,D/=F;let j=0;for(let Y of _){let X=Math.hypot(Y.x-B,Y.y-D);X>j&&(j=X)}return{cx:B,cy:D,rad:j}}),N=I?()=>k:v.length>=2?(A,_)=>{let B=1/0,D=S;for(let F=0;F<v.length;F++){let j=T[F];if(Math.hypot(A-j.cx,_-j.cy)-j.rad>=B)continue;let Y=v[F].patch,X=Y&&Y.length>=3?Oe(Y,A,_)?0:ve(Y,A,_):ve(v[F].pts,A,_);X<B&&(B=X,D=v[F].y)}return D}:(A,_)=>g?L(g.depthAt(A,_)):k,E=[0,1,0],O=v.length>=2||I?()=>E:(A,_)=>{if(!g)return E;let B=g.depthAt(A,_);if(B<=M)return E;let D=(B-M)*te;if(D*h>=kt||b.height+D*h<=R)return E;let[F,j]=g.gradientAt(A,_);if(F===0&&j===0)return E;let Y=1/Math.hypot(h,1);return[-F*h*Y,Y,-j*h*Y]};if(!I)for(let A of w.rows){let _=U(A.blockDepth);for(let B of A.seatIndices)s[B]=_}for(let A of w.rows){let _=[];for(let Y=1;Y<A.pts.length;Y++){let X=Math.hypot(A.pts[Y].x-A.pts[Y-1].x,A.pts[Y].y-A.pts[Y-1].y);X>1e-6&&_.push(X)}_.sort((Y,X)=>Y-X);let B=_.length?_[Math.floor(_.length/2)]:1/0,D=1/0,F=A.pts[Math.floor(A.pts.length/2)];if(F)for(let Y of w.rows){if(Y===A||Y.blockId!==A.blockId)continue;let X=ve(Y.pts,F.x,F.y);X>1e-6&&X<D&&(D=X)}let j=Math.min(B,Math.max(D,B*.5));if(Number.isFinite(j)&&j>0)for(let Y of A.seatIndices)a[Y]=j}r.set(c,{sectionId:c,deckAt:N,normalAt:O,flat:I,bottomY:p,rowLevels:v,landingY:S})}for(let c=0;c<t.length;c++){let f=o[c],b=t[c];if(f){let h=s[c];i[c]=(h??r.get(f).deckAt(b.x,b.y))+Ti;continue}let p=b.eyeHeightM;i[c]=Number.isFinite(p)?Math.max(0,p-ce):0}return{bySection:r,seatOwner:o,seatDeckY:c=>i[c],seatPitchU:c=>a[c]}}var Q={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 r=new Map;for(let i of t){if(!i.sectionId)continue;let s=r.get(i.sectionId);s||(s=new Map,r.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,s]of r){let a=0,m=0,u=0,l=0;for(let[d,c]of s){let f=W(n.get(d));f&&(a+=f[0]*c,m+=f[1]*c,u+=f[2]*c,l+=c)}l>0&&o.set(i,[a/l,m/l,u/l])}return o}function $n(e,t){return W(e.color)??t.get(e.logicalSectionId??e.id)??null}var Qn=Ie(require("polygon-clipping"),1);function Li(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var at=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(m=>[m.x,m.y]);if(r.length<3)return[];r.push(r[0]);let o=Pe(t),i=this.rings.filter((m,u)=>st(o,this.boxes[u])&&Li(n,this.levels[u])),s=[[r]];if(i.length)try{s=Qn.default.difference([r],...i).map(u=>u.map(l=>l.map(([d,c])=>[d,c])))}catch{s=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let a=[];for(let m of s){if(!m.length)continue;let u=m[0].map(([l,d])=>({x:l,y:d}));if(u.length>1){let l=u[0],d=u[u.length-1];Math.abs(l.x-d.x)<1e-9&&Math.abs(l.y-d.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a}};function Oi(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)n=Math.min(n,d.x),r=Math.max(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.y);let s=(n+r)/2,a=(o+i)/2,m=t*Math.PI/180,u=Math.cos(m),l=Math.sin(m);return e.map(d=>{let c=d.x-s,f=d.y-a;return{x:s+c*u-f*l,y:a+c*l+f*u}})}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,r=(e.y??0)+e.height/2;t=nt(n,r,e.width/2,e.height/2)}return t?Oi(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}},r=t==="stage"&&We(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Bi=.08;function qn(e,t){let n=ge(e),r=Ne(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,s=1/0,a=-1/0,m=-1/0;for(let l of n)i=Math.min(i,l.x),s=Math.min(s,l.y),a=Math.max(a,l.x),m=Math.max(m,l.y);let u=o;for(let l of t)a>l.minX&&i<l.maxX&&m>l.minY&&s<l.maxY&&u<=l.topOffsetM+1e-6&&(u=l.topOffsetM+Bi);return t.push({minX:i,minY:s,maxX:a,maxY:m,topOffsetM:u}),u}function de(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Jn(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 Ge(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 eo(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,r,o,i){J(e,t,void 0,()=>n,r,o,i,Q)}var Tt=2.4,Fi=.75,Di=.15;function je(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=n/2,u=r/2;return[[-m,-u],[m,-u],[m,u],[-m,u]].map(([l,d])=>({x:t.x+l*s-d*a,y:t.y+l*a+d*s}))}function to(e,t,n,r,o){let i=je(t);i&&J(e,i,void 0,()=>n+Tt,n,ue(r,o.boothTop),o.boothWall,Q)}function Lt(e){if(e.shape==="round"){let l=e.radius;return l?nt(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=t/2,u=n/2;return[[-m,-u],[m,-u],[m,u],[-m,u]].map(([l,d])=>({x:o.x+l*s-d*a,y:o.y+l*a+d*s}))}function no(e,t,n,r,o){let i=Lt(t);i&&J(e,i,void 0,()=>n+Fi,n,ue(r,o.tableTop),o.tableWall,Q)}function oo(e,t,n,r,o,i,s,a){let m=ge(t);if(!m)return;let u=a?a.kind==="stage":t.role==="stage",l=a?a.kind==="screen":t.role==="screen",d=a?{kind:u?"stage":"solid",heightM:a.topY-a.baseY}:Ne(t),c=a?.baseY??n,f=a?.topY??n+r;if(u&&s){let x=1/0,I=-1/0,w=1/0,C=-1/0;for(let g of m)g.x<x&&(x=g.x),g.x>I&&(I=g.x),g.y<w&&(w=g.y),g.y>C&&(C=g.y);s.push({cx:(x+I)/2*P,cz:(w+C)/2*P,y:f,halfX:Math.max((I-x)/2*P,.5),halfZ:Math.max((C-w)/2*P,.5)})}let b=W(t.fill),p=u&&b?ne(o.stageTop,ie(Le(b,.18),.9),.9):ue(b,u?o.stageTop:o.decorTop),h=l?b:null,y=u?b?ne(o.stageWall,ie(b,.58),.82):o.stageWall:l?h?ne(ie(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ue(W(t.fill),o.decorWall);if(d.kind==="portal"&&m.length===4){let x=Jn(m);le(e,Ge(x,0,.16),f,c,p,y),le(e,Ge(x,.84,1),f,c,p,y),le(e,x,f,Math.max(c,f-.35),p,y);return}if(d.kind==="suite"&&m.length===4){let x=m.map((C,g)=>{let M=m[(g+1)%4],R=(C.x+M.x)/2,k=(C.y+M.y)/2;return Math.hypot(R-i.x,k-i.y)}),I=x.indexOf(Math.min(...x)),w=[0,1,2,3].map(C=>m[(I+C)%4]);le(e,Ge(w,0,.08),f,c,p,y),le(e,Ge(w,.92,1),f,c,p,y),le(e,eo(w,.88,1),f,c,p,y),le(e,w,f,Math.max(c,f-.18),p,y);return}le(e,m,f,c,p,y)}function Ot(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,s=n+o/2,a=(e.rotation??0)*Math.PI/180,m=Math.cos(a),u=Math.sin(a),l=r/2,d=o/2;return[[-l,-d],[l,-d],[l,d],[-l,d]].map(([c,f])=>({x:i+c*m-f*u,y:s+c*u+f*m}))}function Ni(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return W(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let 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,u)=>ne(a,m,1/(u+1)),s[0]):null}function ro(e,t,n,r){if(t.layer==="foreground")return;let o=Ot(t);if(!o)return;let i=n+Di,s=ue(Ni(t.href),r.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=ne(r.ground,s,a)),J(e,o,void 0,()=>i,n,s,ne(s,r.decorWall,.5),Q)}function io(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=ue(r,o.gaTop);J(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,Q)}var Gi=Math.PI/180,K=96,ji=6,Ui=60,Yi=150,so=.2,Xi=.35;function Vi(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Gi;return n<0?n+360:n}function ct(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function ut(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let s=0,a=0;for(let m=-n;m<=n;m++){let u=i+m;if(t)u=(u%r+r)%r;else if(u<0||u>=r)continue;s+=e[u],a++}o[i]=s/a}return o}function ao(e,t){let n=e.filter(c=>c.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,s=0;for(let c of n)for(let f of c.rows){for(let b of f.pts)o+=b.x,i+=b.y,s++;if(f.pts.length>=4){let b=xt(f.pts);b&&Number.isFinite(b.cx)&&Number.isFinite(b.cy)&&r.push({x:b.cx,y:b.cy})}}if(!s)return null;let a={x:o/s,y:i/s},m=a;if(r.length>=8){let c=ct(r.map(y=>y.x)),f=ct(r.map(y=>y.y)),b=0;for(let y of n)for(let x of y.rows)for(let I of x.pts){let w=Math.hypot(I.x-a.x,I.y-a.y);w>b&&(b=w)}let p=0,h=b*.2;for(let y of n)for(let x of y.rows)for(let I of x.pts)Math.hypot(I.x-c,I.y-f)<h&&p++;Math.hypot(c-a.x,f-a.y)<=b&&p/s<.01&&(m={x:c,y:f})}let u=[];for(let c of n){let f={sectionId:c.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let b of c.rows)for(let p of b.pts){let h=Math.hypot(p.x-m.x,p.y-m.y),y=Math.min(K-1,Math.floor(Vi(m,p)/(360/K)));f.samples.push({r:h,bin:y,levelM:b.levelM}),h<f.rMin&&(f.rMin=h),h>f.rMax&&(f.rMax=h)}f.samples.length&&u.push(f)}if(!u.length)return null;u.sort((c,f)=>c.rMin+c.rMax-(f.rMin+f.rMax));let l=[];for(let c of u){let f=!1;for(let b of l){let p=Math.min(c.rMax,b.rMax)-Math.max(c.rMin,b.rMin),h=Math.min(c.rMax-c.rMin,b.rMax-b.rMin);if(h>1e-9&&p>=Xi*h){b.members.push(c),b.rMin=Math.min(b.rMin,c.rMin),b.rMax=Math.max(b.rMax,c.rMax),f=!0;break}}f||l.push({members:[c],rMin:c.rMin,rMax:c.rMax})}let d=[];for(let c of l){let f=new Array(K).fill(null);for(let S of c.members)for(let T of S.samples){let N=f[T.bin];N||(N={samples:[]},f[T.bin]=N),N.samples.push({r:T.r,levelM:T.levelM})}let b=f.map(S=>!!S);if(!b.filter(Boolean).length)continue;let h=[],y=[];for(let S of f){if(!S)continue;let T=1/0,N=-1/0;for(let E of S.samples)E.r<T&&(T=E.r),E.r>N&&(N=E.r);h.push(T),y.push(N)}let x=ct(h),I=ct(y);if(!(x>=so*I)||!(I>0))continue;let w=[...h].sort((S,T)=>S-T);if(!(w[Math.floor(w.length*.1)]>=so*I))continue;let g=f.map(S=>{if(!S)return null;let T=[...S.samples].sort((F,j)=>F.r-j.r),N=T[0].r,E=T[T.length-1].r,O=T[0].levelM,A=-1/0;for(let F of T)F.levelM>A&&(A=F.levelM);let _=[];for(let F of T){let j={r:F.r,l:F.levelM};for(;_.length&&Math.abs(_[_.length-1].r-j.r)<1e-9;){if(_[_.length-1].l<=j.l){j.skip=!0;break}_.pop()}if(!j.skip){for(;_.length>=2;){let Y=_[_.length-2],X=_[_.length-1];if((X.r-Y.r)*(j.l-Y.l)-(X.l-Y.l)*(j.r-Y.r)<=0)_.pop();else break}_.push(j)}}let B=_.map(F=>F.r),D=_.map(F=>F.l);return{inner:N,outer:E,front:O,top:A,profile:{rs:B,ls:D}}}),M=b.slice();for(let S=0;S<K;S++){if(M[S])continue;let T=-1,N=-1,E=0;for(let G=1;G<=K;G++){let V=(S-G+K*2)%K;if(M[V]){T=V;break}}for(let G=1;G<=K;G++){let V=(S+G)%K;if(M[V]){N=V,E=G;break}}if(T<0||N<0)continue;let O=0;for(let G=1;G<=K;G++){let V=(S-G+K*2)%K;if(b[V]){O=G;break}}if(O-1+E>ji)continue;let _=g[T],B=g[N],D=O/(O+E),F=_.inner+(B.inner-_.inner)*D,j=_.outer+(B.outer-_.outer)*D,Y=_.front+(B.front-_.front)*D,X=_.top+(B.top-_.top)*D;g[S]={inner:F,outer:j,front:Y,top:X,profile:{rs:[F,j],ls:[Y,X]}}}for(let S=0;S<K;S++)g[S]&&(M[S]=!0);let R=360/K,k=[],L=M.filter(Boolean).length,U=[];if(L===K)U.push({start:0,len:K});else{let S=0;for(;M[S];)S=(S+1)%K;let T=-1;for(let N=0;N<=K;N++){let E=(S+N)%K,O=N<K&&M[E];if(O&&T<0)T=E;else if(!O&&T>=0){let A=(E-T+K)%K||K;U.push({start:T,len:A}),T=-1}}}for(let S of U){if(S.len*R<Ui&&S.len<K)continue;let T=S.len===K,N=new Float64Array(S.len),E=new Float64Array(S.len),O=new Float64Array(S.len),A=new Float64Array(S.len),_=[];for(let G=0;G<S.len;G++){let V=g[(S.start+G)%K];N[G]=V.inner,E[G]=V.outer,O[G]=V.front,A[G]=V.top,_.push(V.profile??{rs:[V.inner,V.outer],ls:[V.front,V.top]})}let B=ut(N,T),D=ut(E,T),F=ut(O,T),j=ut(A,T);for(let G=0;G<S.len;G++)B[G]>N[G]&&(B[G]=N[G]),D[G]<E[G]&&(D[G]=E[G]),B[G]>D[G]-1e-6&&(B[G]=Math.max(0,D[G]-1e-6)),j[G]<F[G]&&(j[G]=F[G]);let Y={startBin:S.start,binCount:S.len,closed:T,innerR:B,outerR:D,frontLevelM:F,topLevelM:j,profiles:_},X=(G,V,H)=>{let $=_[G],Z=$.rs,z=$.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 G=0;G<S.len;G++){let V=f[(S.start+G)%K];if(V)for(let H of V.samples){X(G,H.r,H.levelM);let $=T?(G-1+S.len)%S.len:G-1,Z=T?(G+1)%S.len:G+1;$>=0&&X($,H.r,H.levelM),Z<S.len&&X(Z,H.r,H.levelM)}}k.push(Y)}k.reduce((S,T)=>S+T.binCount*R,0)<Yi||d.push({arcs:k,sectionIds:c.members.map(S=>S.sectionId),innerRMedian:x,outerRMedian:I})}if(!d.length)return null;if(d.sort((c,f)=>c.innerRMedian-f.innerRMedian),t){let c=d[d.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:d}}function co(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),m=i-s,u=l=>{let d=t.profiles[l],c=d.rs,f=d.ls;if(r<=c[0])return f[0];if(r>=c[c.length-1])return f[f.length-1];for(let b=0;b+1<c.length;b++)if(r<=c[b+1]){let p=c[b+1]-c[b],h=p>1e-9?(r-c[b])/p:0;return f[b]+(f[b+1]-f[b])*h}return f[f.length-1]};return u(s)*(1-m)+u(a)*m}var Hi=.25,Ki=1.2,zi=.6,Wi=.45,Zi=2.3,$i=Math.PI/180;function xe(e,t,n){let r=n*$i;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function Qi(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=r&&s++;if(s>=i.length/2)return!0}return!1}var qi=24;function Ji(e,t,n,r,o,i,s,a){let m=n.binCount,u=qi,l=te,d=i+.02,c=[];for(let v=0;v<m;v++){let S=(n.startBin+v+.5)*t.binStepDeg,T=new Float64Array(u+1);for(let N=0;N<=u;N++){let E=r[v]+(o[v]-r[v])*N/u;T[N]=Math.max(d,co(t,n,S,E)-Hi)}c.push(T)}let f=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],b=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],p=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],h=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],y=(v,S)=>{let T=(n.startBin+v+.5)*t.binStepDeg,N=r[v]+(o[v]-r[v])*S/u,E=xe(t.centre,N,T);return[E.x*l,c[v][S],E.y*l]};{let v=Math.tan(12*Math.PI/180);for(let S=0;S<6;S++){let T=!1;for(let E=0;E<m;E++)for(let O=u-1;O>=0;O--)c[E][O]>c[E][O+1]&&(c[E][O]=c[E][O+1],T=!0);let N=n.closed?m:m-1;for(let E=0;E<N;E++){let O=(E+1)%m;for(let A=0;A<=u;A++){let _=c[O][A]-c[E][A];if(Math.abs(_)>1)continue;let B=r[E]+(o[E]-r[E])*A/u,D=r[O]+(o[O]-r[O])*A/u,F=xe(t.centre,B,(n.startBin+E+.5)*t.binStepDeg),j=xe(t.centre,D,(n.startBin+O+.5)*t.binStepDeg),Y=v*Math.hypot(j.x-F.x,j.y-F.y)*l;_>Y?(c[O][A]=c[E][A]+Y,T=!0):-_>Y&&(c[E][A]=c[O][A]+Y,T=!0)}}if(!T)break}}let x=1,I=(v,S)=>{for(let T=0;T<=u;T+=4)if(Math.abs(c[v][T]-c[S][T])>x)return!0;return Math.abs(c[v][u]-c[S][u])>x},w=Math.tan(38*Math.PI/180),C=v=>(o[v]-r[v])/u*l,g=(v,S)=>c[v][S+1]-c[v][S]>w*Math.max(1e-6,C(v)),M=(v,S)=>{let T=n.closed?(v-1+m)%m:Math.max(0,v-1),N=n.closed?(v+1)%m:Math.min(m-1,v+1);Math.abs(c[T][S]-c[v][S])>x&&(T=v),Math.abs(c[N][S]-c[v][S])>x&&(N=v);let E=Math.max(0,S-1),O=Math.min(u,S+1);E<S&&g(v,E)&&(E=S),O>S&&g(v,S)&&(O=S);let A=y(T,S),_=y(N,S),B=y(v,E),D=y(v,O),F=_[0]-A[0],j=_[1]-A[1],Y=_[2]-A[2],X=D[0]-B[0],G=D[1]-B[1],V=D[2]-B[2],H=j*V-Y*G,$=Y*X-F*V,Z=F*G-j*X,z=Math.hypot(H,$,Z);return z>1e-12?(H/=z,$/=z,Z/=z,$<0&&(H=-H,$=-$,Z=-Z),[H,$,Z]):[0,1,0]},R=(v,S)=>{let T=[v[0],i,v[2]],N=[S[0],i,S[2]],E=S[0]-v[0],O=S[2]-v[2],A=Math.hypot(E,O);if(!(A>1e-12))return;let _=[O/A,0,-E/A];e.tri(v,S,N,_,p,p,h),e.tri(v,N,T,_,p,h,h)},k=.05*me,L=v=>o[v]-r[v]<k,U=n.closed?m:m-1;for(let v=0;v<U;v++){let S=(v+1)%m;if(L(v)||L(S))continue;if(I(v,S)){let _=(n.startBin+v+1)*t.binStepDeg,B=(G,V)=>{let H=(r[v]+r[S])/2,$=(o[v]+o[S])/2,Z=H+($-H)*V/u,z=xe(t.centre,Z,_);return[z.x*l,c[G][V],z.y*l]};for(let G=0;G<u;G++){let V=y(v,G),H=y(v,G+1),$=B(v,G),Z=B(v,G+1),z=M(v,G),q=M(v,G+1);e.triN(V,$,Z,z,z,q,f),e.triN(V,Z,H,z,q,q,f);let Ue=y(S,G),Ye=y(S,G+1),Me=B(S,G),Ee=B(S,G+1),Se=M(S,G),we=M(S,G+1);e.triN(Me,Ue,Ye,Se,Se,we,f),e.triN(Me,Ye,Ee,Se,we,we,f);let fe=B(v,G),ae=B(v,G+1),Xe=B(S,G+1),ft=B(S,G),Ve=ae[0]-fe[0],Ae=ae[2]-fe[2],mt=Math.hypot(Ve,Ae);if(mt>1e-12){let Ft=[Ae/mt,0,-Ve/mt];e.tri(fe,ae,Xe,Ft,p),e.tri(fe,Xe,ft,Ft,p)}}let D=y(v,0),F=y(S,0),j=y(S,u),Y=y(v,u),X=G=>[G[0],i,G[2]];e.tri(X(D),X(j),X(F),[0,-1,0],b),e.tri(X(D),X(Y),X(j),[0,-1,0],b),R(D,F),R(Y,j);continue}for(let _=0;_<u;_++){let B=M(v,_),D=M(S,_),F=M(S,_+1),j=M(v,_+1);if(g(v,_)||g(S,_)){let H=(ae,Xe)=>{let ft=(n.startBin+ae+.5)*t.binStepDeg,Ve=r[ae]+(o[ae]-r[ae])*(_+.5)/u,Ae=xe(t.centre,Ve,ft);return[Ae.x*l,Xe,Ae.y*l]},$=y(v,_),Z=y(S,_),z=H(v,c[v][_]),q=H(S,c[S][_]);e.triN($,Z,q,B,D,D,f),e.triN($,q,z,B,D,B,f);let Ue=y(S,_+1),Ye=y(v,_+1),Me=H(v,c[v][_+1]),Ee=H(S,c[S][_+1]);e.triN(Me,Ee,Ue,j,F,F,f),e.triN(Me,Ue,Ye,j,F,j,f);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,p),e.tri(z,Ee,Me,ae,p)}continue}let Y=y(v,_),X=y(S,_),G=y(S,_+1),V=y(v,_+1);e.triN(Y,X,G,B,D,F,f),e.triN(Y,G,V,B,F,j,f)}let T=y(v,0),N=y(S,0),E=y(S,u),O=y(v,u),A=_=>[_[0],i,_[2]];e.tri(A(T),A(E),A(N),[0,-1,0],b),e.tri(A(T),A(O),A(E),[0,-1,0],b),R(T,N),R(O,E)}if(!n.closed)for(let v of[0,m-1])for(let S=0;S<u;S++)R(y(v,S),y(v,S+1))}function uo(e,t,n){let{bottomY:r,colors:o,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let d of l.arcs){let c=new Float64Array(d.binCount),f=new Float64Array(d.binCount);for(let p=0;p<d.binCount;p++){let h=(d.startBin+p)%t.binCount,y=Math.max(0,d.innerR[p]-se);c[p]=Math.max(y,s[h]+.001),f[p]=Math.max(c[p]+.001,d.outerR[p]+se)}let b=0;for(let p=0;p<d.binCount;p++){let h=d.topLevelM[p]-r;h>b&&(b=h)}b>=Ki&&Ji(e,t,d,c,f,r,o,i);for(let p=0;p<d.binCount;p++){let h=(d.startBin+p)%t.binCount;f[p]>s[h]&&(s[h]=f[p])}}if(n.deriveShell===!1||Qi(n.shapes,t))return;let a=t.rings[t.rings.length-1],m=zi*me,u=Wi*me;for(let l of a.arcs){let d=[],c=[];for(let p=0;p<l.binCount;p++){let h=(l.startBin+p+.5)*t.binStepDeg,y=l.outerR[p]+se+m;d.push(xe(t.centre,y,h)),c.push(xe(t.centre,y+u,h))}let f=-1/0;for(let p=0;p<l.binCount;p++)l.topLevelM[p]>f&&(f=l.topLevelM[p]);let b=()=>f+Zi;l.closed?J(e,c,[d.slice().reverse()],b,r,o.shellTop,o.shellWall,i):J(e,[...c,...d.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,i)}}function lo(e,t,n,r,o,i,s,a){if(!t.outline||t.outline.length<3)return;let m=n.baseHeightM,u=ue(r,a.tierTop);if(!o)return;let l=h=>o.deckAt(h.x,h.y),d=Hn(t,s),c=d[0]??t.outline;if(o.rowLevels.length>=2){let h=it(o.rowLevels),y=Kn(Gn(o.rowLevels,n.focal,h),d),x=()=>[0,1,0];for(let w of y){let C=Math.max(m,w.topY-.02);for(let g of i.subtract(w.outline,C))J(e,g,w.holes,()=>C,m,u,a.tierWall,Q,void 0,x)}y.length||J(e,c,t.holes,()=>o.landingY,m,u,a.tierWall,Q);let I={tread:[u[0]*Q.top,u[1]*Q.top,u[2]*Q.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let w of d.length?d:[c])Un(e,o.rowLevels,n.focal,o.landingY,I,w,h);return}let f=o.flat?1/0:zn,b=h=>o.normalAt(h.x,h.y),p=o.flat?o.landingY:void 0;for(let h of i.subtract(c,p))J(e,h,t.holes,l,m,u,a.tierWall,Q,f,b)}function es(e,t,n){let r=new Set;for(let s of e.objects)s.type==="section"&&r.add(s.id);let o=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!r.has(a))continue;let m=n.bySection.get(a);if(m&&m.rowLevels.length>=2)continue;let u=t[s],l=o.get(a);l||(l=new Map,o.set(a,l));let d=u.rowId||`__seat-${s}`,c=l.get(d);c||(c={pts:[],levelM:0,n:0},l.set(d,c)),c.pts.push({x:u.x,y:u.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 u=a.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:s.id,rows:u});continue}let m=o.get(s.id);m&&i.push({sectionId:s.id,rows:[...m.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function fo(e,t,n,r,o,i,s=!0){let a=es(t,n,r);if(!a.length)return;let m=ao(a,t.focal);m&&(e.setMaterial(0),uo(e,m,{bottomY:t.baseHeightM,colors:{bandTop:ie(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ie(o.tierWall,1.15),shellWall:i??o.tierWall},ao:Q,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:s}))}var mo=/^[\p{L}\p{N}]{1,4}$/u,ts=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function bo(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let s=e.slice(n.length).trim();if(mo.test(s))return s}let i=ts.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((o.startsWith(s)||s.startsWith(o))&&mo.test(a))return a}return e}var ns=6,os=2.2,po=.1,rs=.3,is=1.8,ss=.9,as=.55,cs=6e3;function ho(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,s=t.zones??[],a=[];if(s.length){let m=new Map;for(let l of n)for(let d of l.objects)d.type==="section"&&d.zone&&m.set(d.id,d.zone);let u=new Map;for(let l=0;l<r.length;l++){let d=r[l],c=o.seatOwner[l],f=d.zoneId??(c?m.get(c):void 0);if(!f)continue;let b=u.get(f);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(f,b)),b.n++,d.x<b.minX&&(b.minX=d.x),d.y<b.minY&&(b.minY=d.y),d.x>b.maxX&&(b.maxX=d.x),d.y>b.maxY&&(b.maxY=d.y),b.sumY+=o.seatDeckY(l)}for(let l of s){let d=u.get(l.id),c=[];for(let[f,b]of m)b===l.id&&c.push(f);if(!d||d.n===0){a.push({id:l.id,label:l.label,color:W(l.color),sectionIds:c,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??i).x*P,1.5,(l.focalPoint??i).y*P]});continue}a.push({id:l.id,label:l.label,color:W(l.color),sectionIds:c,seatCount:d.n,center:[(d.minX+d.maxX)/2*P,d.sumY/d.n,(d.minY+d.maxY)/2*P],radius:.5*Math.hypot((d.maxX-d.minX)*P,(d.maxY-d.minY)*P)||1,focalWorld:[(l.focalPoint??i).x*P,1.5,(l.focalPoint??i).y*P]})}}return a}function yo(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:s,zones:a,focal:m}=e,u=[],l=[],d=[];for(let c of a)c.seatCount!==0&&u.push({id:`zone:${c.id}`,kind:"zone",text:c.label,anchor:[c.center[0],c.center[1]+ns,c.center[2]],color:t.zones?.find(f=>f.id===c.id)?.color});{let c=new Map,f=new Map;for(let b=0;b<r.length;b++){let p=o.seatOwner[b];if(!p)continue;let h=c.get(p);h||(h={n:0,x:0,y:0,deck:0},c.set(p,h)),h.n++,h.x+=r[b].x,h.y+=r[b].y,h.deck+=o.seatDeckY(b);let y=f.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(p,y)),r[b].x<y.minX&&(y.minX=r[b].x),r[b].x>y.maxX&&(y.maxX=r[b].x),r[b].y<y.minY&&(y.minY=r[b].y),r[b].y>y.maxY&&(y.maxY=r[b].y)}for(let b of n)for(let p of b.objects){if(p.type!=="section")continue;let h=c.get(p.id);if(!h||h.n===0)continue;let y=f.get(p.id),x=[h.x/h.n*P,h.deck/h.n,h.y/h.n*P],I=p.displayLabel||p.label||p.id;l.push({id:p.id,floorIndex:b.index,label:I,seatCount:h.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*P),focalWorld:[b.focal.x*P,b.baseHeightM+1.5,b.focal.y*P]});let w=t.floors?.[b.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===I.trim().toLocaleLowerCase()||u.push({id:`section:${p.id}`,kind:"section",text:I,anchor:[x[0],x[1]+os,x[2]],floorIndex:b.index})}}{for(let p of n)for(let h of p.objects){if(h.type!=="gaArea")continue;let y=_e(h.points);if(!y)continue;let x=h.displayLabel||h.label||h.id;u.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${x} \xB7 ${h.capacity.toLocaleString()}`:x,anchor:[y.x*P,p.baseHeightM+is,y.y*P],floorIndex:p.index})}let c=new Map;for(let p of n)for(let h of p.objects)h.type==="section"&&c.set(h.id,h.displayLabel||h.label||h.id);let f=new Map;for(let p=0;p<r.length;p++){let h=r[p],y=Math.hypot(h.x-m.x,h.y-m.y),x=f.get(h.rowId);(!x||y>x.far)&&f.set(h.rowId,{seat:h,index:p,far:y})}for(let[p,h]of f){let y=ls(h.seat.label,p,c.get(h.seat.sectionId??""));y&&u.push({id:`row:${p}`,kind:"row",text:y,anchor:[h.seat.x*P,o.seatDeckY(h.index)+ss,h.seat.y*P],floorIndex:s[h.index]})}let b=new Map;for(let p=0;p<r.length;p++){let h=r[p],y=h.label?h.label.lastIndexOf("-"):-1,x=b.get(h.rowId);x||(x={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},b.set(h.rowId,x));let I=p*3,w=i.iPosition[I],C=i.iPosition[I+1],g=i.iPosition[I+2];x.n++,x.x+=w,x.y+=C,x.z+=g,x.minX=Math.min(x.minX,w),x.maxX=Math.max(x.maxX,w),x.minZ=Math.min(x.minZ,g),x.maxZ=Math.max(x.maxZ,g)}for(let[p,h]of b)d.push({id:p,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=cs)for(let p=0;p<r.length;p++){let h=r[p],y=us(h.displayLabel||h.label);y&&u.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*P,o.seatDeckY(p)+as,h.y*P],floorIndex:s[p]})}}for(let c of n)for(let f of c.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let b=ge(f),p=b?_e(b):null;if(!p||!f.label)continue;u.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[p.x*P,c.baseHeightM+Ne(f).heightM+po,p.y*P],color:f.fill,floorIndex:c.index})}else if(f.type==="text"){if(!f.text)continue;u.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*P,c.baseHeightM+po,f.position.y*P],color:f.color,rotation:f.rotation,floorIndex:c.index})}else if(f.type==="booth"){let b=je(f);if(!b)continue;let p=_e(b);if(!p)continue;u.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[p.x*P,c.baseHeightM+Tt+rs,p.y*P],floorIndex:c.index})}return{labels:u,sections:l,rows:d}}function go(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 us(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function ls(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&bo(o,n)}function xo(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:s,seatFloor:a}=e,m=[];{let u=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 f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[c]))),b=c*3,p=u[f];p.minX=Math.min(p.minX,i.position[b]),p.minY=Math.min(p.minY,i.position[b+1]),p.minZ=Math.min(p.minZ,i.position[b+2]),p.maxX=Math.max(p.maxX,i.position[b]),p.maxY=Math.max(p.maxY,i.position[b+1]),p.maxZ=Math.max(p.maxZ,i.position[b+2])}let l=new Map;for(let c=0;c<n.length;c++)for(let f of n[c].objects)f.type==="section"&&l.set(f.id,c);let d=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let c=0;c<r.length;c++){let f=o.seatOwner[c],b=(f!==null?l.get(f):void 0)??s[c];if(b===void 0)continue;let p=d[b],h=r[c];p.n++,h.x<p.minX&&(p.minX=h.x),h.y<p.minY&&(p.minY=h.y),h.x>p.maxX&&(p.maxX=h.x),h.y>p.maxY&&(p.maxY=h.y);let y=o.seatDeckY(c);p.sumX+=h.x*P,p.sumDeck+=y,p.sumZ+=h.y*P,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),a[c]=b}for(let c=0;c<n.length;c++){let f=d[c],b=t.floors?.[c],p=u[c],h=Math.min(f.n?f.minX*P:n[c].focal.x*P-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(f.n?f.maxX*P:n[c].focal.x*P+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(f.n?f.minY*P:n[c].focal.y*P-1,Number.isFinite(p.minZ)?p.minZ:1/0),I=Math.max(f.n?f.maxY*P:n[c].focal.y*P+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(f.n?Math.min(n[c].baseHeightM,f.minDeck):n[c].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),C=Math.max(f.n?Math.max(f.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),g=[f.n?f.sumX/f.n:(h+y)/2,f.n?f.sumDeck/f.n:(w+C)/2,f.n?f.sumZ/f.n:(x+I)/2],M=Math.max(1,.5*Math.hypot(y-h,C-w,I-x));m.push({index:c,id:b?.id??`floor-${c}`,label:b?.name??(n.length>1?`Floor ${c+1}`:"Venue"),seatCount:f.n,center:g,radius:M,box:{min:[h,w,x],max:[y,C,I]},focalWorld:[n[c].focal.x*P,n[c].baseHeightM+1.5,n[c].focal.y*P]})}}return m}function Bt(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,s=(a,m)=>{a<n&&(n=a),m<r&&(r=m),a>o&&(o=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 u of m.outline)s(u.x,u.y);else if(m.type==="shape"&&m.points)for(let u of m.points)s(u.x,u.y);else if(m.type==="gaArea")for(let u of m.points)s(u.x,u.y);else if(m.type==="booth"){let u=je(m);if(u)for(let l of u)s(l.x,l.y)}else if(m.type==="table"){let u=Lt(m);if(u)for(let l of u)s(l.x,l.y)}else if(m.type==="decorImage"){let u=Ot(m);if(u)for(let l of u)s(l.x,l.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Mo(e,t,n,r,o,i){if(t.length===1){let s=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),a=De(o.minX-s,o.minY-s,o.maxX-o.minX+s*2,o.maxY-o.minY+s*2);J(e,a,void 0,()=>0,-.4,i.ground,i.ground,Q)}else{let s=t.reduce((f,b)=>b.baseHeightM<f.baseHeightM?b:f);e.setFloor(s.index);let a=n.filter((f,b)=>r[b]===s.index),m=Bt([s],a),u=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),l=Math.max(28,Math.min(80,u*.04)),d=De(m.minX-l,m.minY-l,m.maxX-m.minX+l*2,m.maxY-m.minY+l*2),c=s.baseHeightM-.03;J(e,d,void 0,()=>c,c-.22,i.ground,i.ground,Q)}}function So(e,t,n){let{cx:r,cz:o,radius:i}=n,s=1/0,a=1/0,m=1/0,u=-1/0,l=-1/0,d=-1/0,c=(p,h,y)=>{s=Math.min(s,p),u=Math.max(u,p),a=Math.min(a,h),l=Math.max(l,h),m=Math.min(m,y),d=Math.max(d,y)};for(let p=0;p<e.position.length;p+=3)c(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let h=p*3,y=t.iPosition[h],x=t.iPosition[h+1],I=t.iPosition[h+2],w=Math.max(.35,t.iMaxRadius[p]??.35);c(y-w,x,I-w),c(y+w,x+1.6,I+w)}Number.isFinite(s)||(s=r-i,u=r+i,a=0,l=i*.16,m=o-i,d=o+i);let f=[(s+u)/2,(a+l)/2,(m+d)/2],b=Math.max(1,.5*Math.hypot(u-s,l-a,d-m));return{center:f,radius:b,minY:a,maxY:l}}function wo(e,t,n,r,o,i){let s=1/0,a=1/0,m=-1/0,u=-1/0;for(let w=0;w<e.count;w++){let C=w*3,g=e.iPosition[C],M=e.iPosition[C+2];g<s&&(s=g),g>m&&(m=g),M<a&&(a=M),M>u&&(u=M)}for(let w of t)s=Math.min(s,w.cx-w.halfX),m=Math.max(m,w.cx+w.halfX),a=Math.min(a,w.cz-w.halfZ),u=Math.max(u,w.cz+w.halfZ);let l=n.minX*P,d=n.maxX*P,c=n.minY*P,f=n.maxY*P,b=l,p=d,h=c,y=f;if(Number.isFinite(s)){let w=Math.max(2,.06*Math.hypot(m-s,u-a));b=Math.max(l,s-w),p=Math.min(d,m+w),h=Math.max(c,a-w),y=Math.min(f,u+w)}let x=Math.min(0,r),I=Math.max(o,i*.05);return{min:[b,x,h],max:[p,I,y]}}function Io(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=$t(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let d of n)for(let c of d.objects)c.type==="shape"&&i.set(c.id,{shape:c,unit:d});let s=new Set,a=new Set,m=new Map((t.overlay.productionElements??[]).map(d=>{let c=d.runtimeContentImageUrl;return[d.id,typeof c=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(c)?c:void 0]})),u=[];for(let d of o.value.overlay.productionElements??[]){let c=i.get(d.objectId),f=c?ge(c.shape):null,b=d.baseElevationM??0;if(!c||!f||f.length<3||!d.id||s.has(d.id)||a.has(d.objectId)||!Number.isFinite(d.heightM)||d.heightM<.05||d.heightM>50||!Number.isFinite(b)||b<-10||b>100)return r();s.add(d.id),a.add(d.objectId);let p=f.map(R=>R.x*P),h=f.map(R=>R.y*P),y=c.unit.baseHeightM+b,x=Math.min(...p),I=Math.max(...p),w=Math.min(...h),C=Math.max(...h),g,M=m.get(d.id)??d.contentImageUrl;if(d.kind==="screen"&&M)if(I-x>=C-w){let R=Math.abs(w-c.unit.focal.y*P)<=Math.abs(C-c.unit.focal.y*P)?w-.006:C+.006;g=[[x,y,R],[I,y,R],[x,y+d.heightM,R],[I,y+d.heightM,R]]}else{let R=Math.abs(x-c.unit.focal.x*P)<=Math.abs(I-c.unit.focal.x*P)?x-.006:I+.006;g=[[R,y,w],[R,y,C],[R,y+d.heightM,w],[R,y+d.heightM,C]]}u.push({id:d.id,objectId:d.objectId,kind:d.kind,floorIndex:c.unit.index,baseY:y,topY:y+d.heightM,bounds:{min:[x,y,w],max:[I,y+d.heightM,C]},occlusion:d.occlusion,...M?{contentImageUrl:M}:{},...g?{contentPlane:g}:{}})}let l=u.sort((d,c)=>d.id.localeCompare(c.id));return{byObjectId:new Map(l.map(d=>[d.objectId,d])),elements:l}}function re(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oe(e){return Array.isArray(e)?e:[]}function fs(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!re(n))continue;let r=re(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function lt(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function ms(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ds(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function bs(e){let t=lt(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:lt(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:lt(e.rotation,4),o=e.scale===void 0?[1,1,1]:lt(e.scale,3);if(!n||!r||!o)return null;let[i,s,a,m]=r,u=Math.hypot(i,s,a,m);if(!(u>1e-8))return null;let l=i/u,d=s/u,c=a/u,f=m/u,b=l+l,p=d+d,h=c+c,y=l*b,x=l*p,I=l*h,w=d*p,C=d*h,g=c*h,M=f*b,R=f*p,k=f*h;return[(1-(w+g))*o[0],(x+k)*o[0],(I-R)*o[0],0,(x-k)*o[1],(1-(y+g))*o[1],(C+M)*o[1],0,(I+R)*o[2],(C-M)*o[2],(1-(y+w))*o[2],0,n[0],n[1],n[2],1]}function ps(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function hs(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],s=e[9],a=e[2],m=e[6],u=e[10],l=i*u-s*m,d=s*a-o*u,c=o*m-i*a,f=t*l+n*d+r*c;if(Math.abs(f)<1e-12)return null;let b=1/f;return[l*b,d*b,c*b,(r*m-n*u)*b,(t*u-r*a)*b,(n*a-t*m)*b,(n*s-r*i)*b,(r*o-t*s)*b,(t*i-n*o)*b]}function vo(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,s=e[6]*t+e[7]*n+e[8]*r,a=Math.hypot(o,i,s)||1;return o/=a,i/=a,s/=a,[o,i,s]}function ys(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),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&&!r)try{let m=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!re(m))return null;r=m}catch{return null}else if(s===5130562&&!o)o=a;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function gs(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function xs(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Ms(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 Ss(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=ys(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!re(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=oe(r.extensionsUsed).filter(w=>typeof w=="string");if(i.includes("KHR_draco_mesh_compression")||fs(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||oe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(oe(r.images).length||oe(r.textures).length)return{ok:!1,issue:"external_resource"};let s=oe(r.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>o.byteLength)return{ok:!1,issue:"external_resource"};let a=oe(r.accessors),m=oe(r.bufferViews),u=oe(r.meshes),l=oe(r.nodes),d=oe(r.scenes),c=typeof r.scene=="number"?r.scene:0;if(!re(d[c]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(w,C,g)=>{if(typeof w!="number"||!Number.isInteger(w)||!re(a[w]))return null;let M=a[w];if(M.type!==C||M.sparse!==void 0||M.normalized===!0||typeof M.count!="number"||!Number.isInteger(M.count)||M.count<1||typeof M.componentType!="number"||!g.includes(M.componentType)||typeof M.bufferView!="number")return null;let R=m[M.bufferView];if(!re(R)||R.buffer!==0||typeof R.byteLength!="number"||!Number.isInteger(R.byteLength)||R.byteLength<0)return null;let k=xs(M.type),L=gs(M.componentType),U=typeof R.byteStride=="number"?R.byteStride:k*L,v=typeof R.byteOffset=="number"?R.byteOffset:0,S=typeof M.byteOffset=="number"?M.byteOffset:0,T=v+S,N=S+(M.count-1)*U+k*L;if(!Number.isInteger(U)||!Number.isInteger(v)||!Number.isInteger(S)||U<k*L||v<0||S<0||v+R.byteLength>o.byteLength||N>R.byteLength)return null;let E=[];for(let O=0;O<M.count;O++){let A=[];for(let _=0;_<k;_++){let B=Ms(f,T+O*U+_*L,M.componentType);if(!Number.isFinite(B))return null;A.push(B)}E.push(A)}return E},p=[],h=[],y=0,x=new Set,I=(w,C)=>{if(typeof w!="number"||!Number.isInteger(w)||!re(l[w])||x.has(w))return!1;x.add(w);let g=l[w],M=bs(g);if(!M)return!1;let R=ds(C,M),k=hs(R);if(!k)return!1;if(g.mesh!==void 0){if(typeof g.mesh!="number")return!1;let L=u[g.mesh];if(!re(L))return!1;for(let U of oe(L.primitives)){if(!re(U)||U.mode!==void 0&&U.mode!==4||!re(U.attributes))return!1;let v=b(U.attributes.POSITION,"VEC3",[5126]),S=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!v||U.attributes.NORMAL!==void 0&&!S)return!1;let T=v.length;if(U.indices!==void 0){let E=typeof U.indices=="number"?a[U.indices]:null;T=re(E)?E.count:void 0}if(typeof T!="number"||!Number.isInteger(T)||T%3!==0||(y+=T/3,y>1e5))return!1;let N=U.indices===void 0?v.map((E,O)=>[O]):b(U.indices,"SCALAR",[5121,5123,5125]);if(!N||N.length%3!==0||N.length!==T)return!1;for(let E=0;E<N.length;E+=3){let O=[N[E][0],N[E+1][0],N[E+2][0]];if(O.some(B=>!Number.isInteger(B)||B<0||B>=v.length))return!1;let A=O.map(B=>ps(R,...v[B])),_=null;if(!S){let B=A[1][0]-A[0][0],D=A[1][1]-A[0][1],F=A[1][2]-A[0][2],j=A[2][0]-A[0][0],Y=A[2][1]-A[0][1],X=A[2][2]-A[0][2];_=vo([1,0,0,0,1,0,0,0,1],D*X-F*Y,F*j-B*X,B*Y-D*j)}for(let B=0;B<3;B++)p.push(...A[B]),h.push(...S?vo(k,...S[O[B]]):_)}}}for(let L of oe(g.children))if(!I(L,R))return!1;return x.delete(w),!0};for(let w of oe(d[c].nodes))if(!I(w,ms()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||h.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(h)}}function Ro(e){try{return Ss(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Co(e){let{doc:t}=e,n=bn(t.theme),r=n.structure,o=Vn(t,e.eventConfigurationId??t.eventConfigurationId),i=Io(e.eventConfigurationId,e.eventConfiguration,o),s=e.seats,a=new et,m=null;if(e.registeredShellGlb){let E=Ro(e.registeredShellGlb);if(E.ok){let O=E.position.length/3,A=new Float32Array(E.position.length),_=n.materials.shell??r.tierWall;for(let B=0;B<O;B++){let D=E.normal[B*3+1],F=D<-.25?.4:.62+.38*Math.max(0,D);A[B*3]=_[0]*F,A[B*3+1]=_[1]*F,A[B*3+2]=_[2]*F}m={position:E.position,normal:E.normal,color:A,floor:new Float32Array(O).fill(-2),material:new Float32Array(O),count:O}}}let u=new Map;for(let E of o)for(let O of E.objects)u.set(O.id,E.index),O.type==="section"&&u.set(O.logicalSectionId??O.id,E.index);let l=s.map(E=>u.get(E.sectionId??"")??u.get(E.rowId??"")??0),d=Bt(o,s);Mo(a,o,s,l,d,r);let c=Zn(t,s),f=new Map,b=new Map;for(let E of t.categories??[])f.set(E.key,E.color),E.seatGlyph&&b.set(E.key,E.seatGlyph);let p=[],h=Wn(o,s,l),y=new Float32Array(s.length),x=[];for(let E=0;E<o.length;E++){let O=o[E];a.setFloor(E);let A=new at,_=[],B=O.objects.filter(D=>D.type==="section"&&!!D.outline&&D.outline.length>=3);for(let D of O.objects)if(D.type==="section"){let F=a.vertexCount;lo(a,D,O,$n(D,c),h.bySection.get(D.id),A,B,r);let j=a.vertexCount-F;j>0&&x.push({sectionId:D.id,start:F,count:j})}else if(D.type==="shape"){let F=i.byObjectId.get(D.id);a.setMaterial((F?.kind??D.role)==="screen"?1:0),oo(a,D,O.baseHeightM,qn(D,_),r,O.focal,p,F),a.setMaterial(0)}else D.type==="gaArea"?io(a,D,O.baseHeightM,W(f.get(D.categoryKey)),r):D.type==="booth"?to(a,D,O.baseHeightM,W(f.get(D.categoryKey)),r):D.type==="table"?no(a,D,O.baseHeightM,W(D.fill??t.theme?.decorFill??"#232c40"),r):D.type==="decorImage"&&ro(a,D,O.baseHeightM,r);fo(a,O,s,h,r,n.materials.shell,!m)}let I=o.length>1?{x:o.reduce((E,O)=>E+O.focal.x,0)/o.length,y:o.reduce((E,O)=>E+O.focal.y,0)/o.length}:t.focalPoint??{x:(d.minX+d.maxX)/2,y:(d.minY+d.maxY)/2},w=xn(m?[a.build(),m]:[a.build()]),C=En(s,e.initialState,h,y,f,b),g=ho({doc:t,units:o,seats:s,surfaces:h,focal:I}),{labels:M,sections:R,rows:k}=yo({doc:t,units:o,seats:s,surfaces:h,seatData:C,hintedSeatFloor:l,zones:g,focal:I}),L=xo({doc:t,units:o,seats:s,surfaces:h,solids:w,hintedSeatFloor:l,seatFloor:y});go(M,L),C.iYaw=Pn(C.iPosition,s.length,E=>s[E].rowId,E=>{let O=o[y[E]]?.focal??I;return[O.x*P,O.y*P]});let U=(d.minX+d.maxX)/2*P,v=(d.minY+d.maxY)/2*P,S=.5*Math.hypot((d.maxX-d.minX)*P,(d.maxY-d.minY)*P)||10,T=So(w,C,{cx:U,cz:v,radius:S}),N=wo(C,p,d,T.minY,T.maxY,S);return{solids:w,sectionSolidRanges:x,seats:C,bounds:{center:[(N.min[0]+N.max[0])/2,(N.min[1]+N.max[1])/2,(N.min[2]+N.max[2])/2],radius:S,groundY:0,box:N},renderBounds:{center:T.center,radius:T.radius},stateColorLUT:pn(n,Qe),theme:n,seatCount:s.length,focalWorld:[I.x*P,1.5,I.y*P],zones:g,stages:p,productionElements:i.elements,sections:R,rows:k,labels:M,floors:L}}function ws(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 Po=self;Po.onmessage=e=>{let t=performance.now(),n=!e.data.seats,r=e.data.seats??ln(e.data.doc),o=Co({doc:e.data.doc,seats:r,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});Po.postMessage({model:o,buildMs:performance.now()-t,...n?{seats:r}:{}},ws(o))};
|
|
1
|
+
"use strict";var Ao=Object.create;var Nt=Object.defineProperty;var _o=Object.getOwnPropertyDescriptor;var ko=Object.getOwnPropertyNames;var To=Object.getPrototypeOf,Lo=Object.prototype.hasOwnProperty;var Oo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ko(t))!Lo.call(e,o)&&o!==n&&Nt(e,o,{get:()=>t[o],enumerable:!(r=_o(t,o))||r.enumerable});return e};var Ie=(e,t,n)=>(n=e!=null?Ao(To(e)):{},Oo(t||!e||!e.__esModule?Nt(n,"default",{value:e,enumerable:!0}):n,e));var Rs=Math.PI/180;function dt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function _e(e){return e.length?dt(e):null}function Gt(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+s*e.end.x,y:r*e.start.y+o*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[Gt(e,.5)];let r=Array.from({length:n+1},(m,u)=>Gt(e,u/n)),o=new Float64Array(r.length);for(let m=1;m<r.length;m+=1){let u=r[m].x-r[m-1].x,l=r[m].y-r[m-1].y;o[m]=o[m-1]+Math.hypot(u,l)}let i=o[o.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 u=i*m/(t-1);for(;a<o.length-1&&o[a]<u;)a+=1;let l=o[a-1],d=o[a],c=d===l?0:(u-l)/(d-l);s.push({x:r[a-1].x+(r[a].x-r[a-1].x)*c,y:r[a-1].y+(r[a].y-r[a-1].y)*c})}return s}function Ut(e,t,n){return Math.max(t,Math.min(n,e))}function Yt(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((c,f)=>c.segmentedRow.componentIndex-f.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,f)=>c.segmentedRow?.kind==="segmented-row-v1"&&c.segmentedRow.groupId===r&&c.segmentedRow.componentCount===s&&c.segmentedRow.componentIndex===f&&c.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(f===0?c.segmentedRow.boundaryBefore==="start":c.segmentedRow.boundaryBefore!=="start")&&c.segmentedRow.displayLabel===a.displayLabel)))continue;let u=i.reduce((c,f)=>c+f.seatCount,0),l=0,d=0;for(let c of i)c.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(c.id,{groupId:r,adjacencyOffset:l,displayOffset:d,displayLabel:a.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),l+=c.seatCount,d+=c.seatCount}return t}var Bo="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Fo="abcdefghijklmnopqrstuvwxyz";function Do(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function bt(e,t=!1){let n=t?Fo:Bo;return Do(Math.max(0,Math.floor(e)-1),n)}var No=[[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 Xt(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of No)for(;t>=r;)n+=o,t-=r;return n}function Go(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function He(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=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 f=Math.ceil(m/2),b=i==="updown"?t<f?n+2*t:n-1+2*(m-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${s}${b}`}let u=i==="odd"||i==="even"?2:o,l=a!=null&&Number.isFinite(a)?a-(m-1)*u:n,d=r==="center"?Go(m)[t]:r==="rtl"?m-1-t:t,c;switch(i){case"odd":{let f=l%2===1?l:l+1;c=String(f+d*2);break}case"even":{let f=l%2===0?l:l+1;c=String(f+d*2);break}case"roman":c=Xt(l+d*o);break;case"letters-upper":c=bt(l+d*o,!1);break;case"letters-lower":c=bt(l+d*o,!0);break;default:c=String(l+d*o);break}return`${s}${c}`}function jo(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Vt(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${He(e,t)}`}function pt(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(e.seatDisplayLabelMode==="number")return He(e,t);if(!n)return`${e.displayLabel||e.label}-${He(e,t)}`;let o=jo(n),i=n.displayOffset+t;return`${n.displayLabel}-${He(o,i)}`}var te=.02291666666666667,me=1/te,Uo=58,Yo=Uo*te;var Xo=3,Ht=0,ht=120,Vo=0,Ho=45,Ko=7,ce=1.2;function yt(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function zo(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Ko?e:Xo}function Ke(e,t={}){let n=yt(t.floorBaseHeightM,Ht,ht,0),r=Math.min(ht,n+zo(e.elevation)*Yo),o=e.height===void 0?r:yt(e.height,Ht,ht,r),i=yt(e.rake,Vo,Ho,0);return{height:o,rake:i}}function Kt(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 r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],s=e[o+1],a=s.x-i.x,m=s.y-i.y,u=a*a+m*m,l=u>1e-12?((t-i.x)*a+(n-i.y)*m)/u:0;l<0?l=0:l>1&&(l=1);let d=t-(i.x+l*a),c=n-(i.y+l*m);if(Math.abs(d)>=r||Math.abs(c)>=r)continue;let f=Math.hypot(d,c);f<r&&(r=f)}return r}function Wo(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function zt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function gt(e,t){let n=1/0;for(let r of Kt(e)){let o=ve(t,r.x,r.y);o<n&&(n=o)}for(let r of Kt(t)){let o=ve(e,r.x,r.y);o<n&&(n=o)}return n}function Zo(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let l of e)n+=l.x,r+=l.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let l of e){let d=Math.hypot(l.x-n,l.y-r);d>o&&(o=d,i=l)}let s=i.x-n,a=i.y-r,m=Math.hypot(s,a);m>1e-9?(s/=m,a/=m):(s=1,a=0);let u=e.map((l,d)=>({p:l,i:d,t:(l.x-n)*s+(l.y-r)*a})).sort((l,d)=>l.t-d.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function xt(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let x of e)n+=x.x,r+=x.y;n/=t,r/=t;let o=0,i=0,s=0,a=0,m=0,u=0,l=0;for(let x of e){let I=x.x-n,w=x.y-r;o+=I*I,s+=w*w,i+=I*w,a+=I*I*I,m+=w*w*w,u+=I*w*w,l+=w*I*I}let d=o*s-i*i;if(Math.abs(d)<1e-9)return null;let c=(a+u)/2,f=(m+l)/2,b=(c*s-f*i)/d,p=(f*o-c*i)/d,h=b+n,y=p+r;return!Number.isFinite(h)||!Number.isFinite(y)?null:{cx:h,cy:y}}var $o=.15;function Qo(e){if(e.length<2)return null;let t=e.map(x=>{let I=0,w=0;for(let P of x.pts)I+=P.x,w+=P.y;return{x:I/x.pts.length,y:w/x.pts.length}}),n=0,r=0;for(let x of t)n+=x.x,r+=x.y;n/=t.length,r/=t.length;let o=0,i=0,s=0;for(let x of t){let I=x.x-n,w=x.y-r;o+=I*I,i+=I*w,s+=w*w}let a=o+s,m=o*s-i*i,u=a/2+Math.sqrt(Math.max(0,a*a/4-m)),l,d;Math.abs(i)>1e-12?(l=u-s,d=i):o>=s?(l=1,d=0):(l=0,d=1);let c=Math.hypot(l,d);if(!(c>1e-12))return null;l/=c,d/=c;let f=1/0,b=-1/0,p=[];for(let x of e){let I=1/0,w=-1/0;for(let P of x.pts){let g=P.x*l+P.y*d;g<I&&(I=g),g>w&&(w=g),g<f&&(f=g),g>b&&(b=g)}p.push(w-I)}let h=b-f;return h>1e-9?(p.sort((x,I)=>x-I),p[Math.min(p.length-1,Math.floor(p.length*.9))]/h<=qo?{x:l,y:d}:null):null}var qo=.35;function ze(e,t,n,r){let o=new Map;for(let g of n){let M=t[g],R=M.rowId||`__seat-${g}`,k=o.get(R);k||(k={pts:[],idx:[]},o.set(R,k)),k.pts.push({x:M.x,y:M.y}),k.idx.push(g)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[g,M]of o){let R=Zo(M.pts,M.idx),k=0;for(let L of R.pts)k+=Math.hypot(L.x-r.x,L.y-r.y);i.push({id:g,pts:R.pts,seatIndices:R.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:k/R.pts.length})}let s=i.map(g=>Wo(g.pts)),a=i.length<=256?i.length*(i.length-1)/2:0,m=a?new Float64Array(a):null;m?.fill(Number.NaN);let u=m?new Map(i.map((g,M)=>[g,M])):null,l=(g,M)=>(g>M&&([g,M]=[M,g]),g*(2*i.length-g-1)/2+(M-g-1)),d=(g,M)=>{if(!m)return gt(i[g].pts,i[M].pts);let R=l(g,M),k=m[R];if(!Number.isNaN(k))return k;let L=gt(i[g].pts,i[M].pts);return m[R]=L,L},c=(g,M)=>u?d(u.get(g),u.get(M)):gt(g.pts,M.pts),f=[];for(let g=0;g<i.length;g++){let M=1/0;for(let R=0;R<i.length;R++){if(g===R||zt(s[g],s[R])>=M)continue;let k=d(g,R);k<M&&(M=k)}Number.isFinite(M)&&f.push(M)}f.sort((g,M)=>g-M);let b=f.length?f[Math.floor(f.length/2)]:1,p=Math.max(b*1.8,1e-6),h=i.map(()=>[]);for(let g=0;g<i.length;g++)for(let M=g+1;M<i.length;M++)zt(s[g],s[M])>p||d(g,M)<=p&&(h[g].push(M),h[M].push(g));let y=0;for(let g=0;g<i.length;g++){if(i[g].blockId!==-1)continue;let M=y++,R=[g];for(i[g].blockId=M;R.length;){let k=R.pop();for(let L of h[k])i[L].blockId===-1&&(i[L].blockId=M,R.push(L))}}let x=new Map;for(let g of i){let M=x.get(g.blockId)??[];M.push(g),x.set(g.blockId,M)}let I=[];for(let g of i){if(g.pts.length<4)continue;let M=xt(g.pts);M&&(!Number.isFinite(M.cx)||!Number.isFinite(M.cy)||I.push({x:M.cx,y:M.cy}))}let w=I.length>=2?(()=>{let g=I.map(k=>k.x).sort((k,L)=>k-L),M=I.map(k=>k.y).sort((k,L)=>k-L),R=Math.floor(I.length/2);return{cx:g[R],cy:M[R]}})():null;if(w){let g=v=>Math.hypot(v.x-w.cx,v.y-w.cy),M=1/0,R=-1/0,k=[];for(let v of i){let S=1/0,T=-1/0;for(let N of v.pts){let E=g(N);E<S&&(S=E),E>T&&(T=E)}k.push(T-S),S<M&&(M=S),T>R&&(R=T)}let L=R-M;k.sort((v,S)=>v-S);let U=k[Math.min(k.length-1,Math.floor(k.length*.9))];if(L>1e-9&&U/L<=$o){let v=i.map(F=>{let j=0;for(let Y of F.pts)j+=g(Y);return{row:F,radius:j/F.pts.length}}),S=0,T=0;for(let F of v)S+=F.radius,T+=F.row.focalDistance;S/=v.length,T/=v.length;let N=0;for(let F of v)N+=(F.radius-S)*(F.row.focalDistance-T);if(N<0)for(let F of v)F.radius=-F.radius;let O=1/0;for(let F of v)F.radius<O&&(O=F.radius);v.sort((F,j)=>F.radius-j.radius);let A=-1,_=-1/0,B=L/Math.max(1,v.length)*.5,D=[];for(let F of v)F.radius-_>B&&(A++,_=F.radius),F.row.ordinal=A,F.row.blockDepth=F.radius-O,D.push(F.row);return{sectionId:e,rows:D,blockCount:y}}}let P=[];for(let[,g]of x){let M=Qo(g);if(M){let R=L=>{let U=0;for(let v of L.pts)U+=v.x*M.x+v.y*M.y;return U/L.pts.length};g.sort((L,U)=>R(L)-R(U)),g.length>=2&&g[0].focalDistance>g[g.length-1].focalDistance&&g.reverse();let k=0;for(let L=0;L<g.length;L++)L>0&&(k+=c(g[L-1],g[L])),g[L].ordinal=L,g[L].blockDepth=k,P.push(g[L])}else{let R=1/0;for(let k of g)k.focalDistance<R&&(R=k.focalDistance);g.sort((k,L)=>k.focalDistance-L.focalDistance);for(let k=0;k<g.length;k++)g[k].ordinal=k,g[k].blockDepth=Math.max(0,g[k].focalDistance-R),P.push(g[k])}}return{sectionId:e,rows:P,blockCount:y}}var Jo=/^\d{4}-\d{2}-\d{2}$/;function er(e){let t=Date.parse(e);return Number.isFinite(t)?Jo.test(e)?t+864e5:t:null}function tr(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=er(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function nr(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function or(e){return e.status!=="draft"&&e.status!=="retracted"}function rr(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 Wt(e,t={}){return!!e&&or(e)&&nr(e,t.activeConfigurationId,t.activeConfigurationVersion)&&rr(e,t.activeBasisSha256)&&tr(e,t.now)}var Fs=Math.PI*2;function We(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var ir=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,sr=/[\s"'<>`\\]/;function ar(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return ir.test(e);if(sr.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 ar(t)?t:null}var Mt="seatlayer.event-configuration/1";var Re=100,cr=120,ur=2e5,lr=1e4,fr=/^[a-f0-9]{64}$/,mr=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 dr(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function $t(e){return!Array.isArray(e)||e.length>ur||!e.every(t=>be(t,Re))?null:[...new Set(e)].sort()}function br(e){return!ke(e)||!be(e.chartId,Re)||!be(e.version,Re)||e.sha256!==void 0&&(typeof e.sha256!="string"||!fr.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function St(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function pr(e){return ke(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&St(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function hr(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>lr)return null;let n=new Set(t),r=new Set,o=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)||!mr.has(String(a.kind))||!St(a.heightM,.05,50)||a.baseElevationM!==void 0&&!St(a.baseElevationM,-10,100))return null;let m=pr(a.occlusion);if(!m||r.has(a.id)||o.has(a.objectId))return null;let u=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Zt(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!u||a.kind!=="screen"||++i>1))return null;r.add(a.id),o.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,...u?{contentImageUrl:u}:{}})}return s.sort((a,m)=>a.id.localeCompare(m.id))}function yr(e){let t=[];if(!ke(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Mt&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Mt}`}),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,cr)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),dr(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=br(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=ke(e.overlay)?e.overlay:null,o=$t(r?.objectIds),i=$t(r?.productionKillSeatIds),s=o?hr(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||s===null?{issues:t}:{issues:t,value:{schema:Mt,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function Qt(e){let t=yr(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function gr(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,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function xr(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*o-a*i,y:t.y+s*i+a*o}}function qt(e){let t=gr(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(m=>xr(m,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),o=1/0,i=1/0,s=-1/0,a=-1/0;for(let m of r)o=Math.min(o,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x),a=Math.max(a,m.y);return!Number.isFinite(o)||s-o<1e-6||a-i<1e-6?null:{minX:o,minY:i,maxX:s,maxY:a}}var Mr=5,Sr=3,wr=.92,Ir=1.9,vr=2,Rr=.6,Pr=1,Cr=.06;function Er(e){return e.heightM!==void 0?e.heightM:We(e.stageKind)?Cr:Pr}function Jt(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let s of nn(e)){let a=s.baseHeightM??0;for(let m of s.objects){if(m.type!=="shape"||m.role!=="stage")continue;let u=qt(m);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),r=Math.max(r,u.maxX),o=Math.max(o,u.maxY),i=Math.max(i,a+Er(m)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function Ar(e,t,n,r){let o=1/0,i=1/0,s=-1/0,a=-1/0;for(let f of e)Number.isFinite(f.eyeHeightM)&&(o=Math.min(o,f.x),s=Math.max(s,f.x),i=Math.min(i,f.y),a=Math.max(a,f.y));if(!Number.isFinite(o))return null;let m=o*t,u=i*t,l=Math.max(1,Math.ceil((s-o)*t/n)+1),d=Math.max(1,Math.ceil((a-i)*t/n)+1),c=new Float64Array(l*d).fill(-1/0);for(let f of e){if(!Number.isFinite(f.eyeHeightM))continue;let b=f.eyeHeightM-ce,p=Math.min(l-1,Math.max(0,Math.floor((f.x*t-m)/n))),y=Math.min(d-1,Math.max(0,Math.floor((f.y*t-u)/n)))*l+p,x=b+r;x>c[y]&&(c[y]=x)}return{cellM:n,minX:m,minY:u,cols:l,rows:d,top:c}}function _r(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function en(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??te,i=n.cellM??Rr,s=n.chairBackM??wr,a=n.selfRowSkipM??vr,m=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??Mr),d=Math.max(1,n.rows??Sr),c=Ar(e,o,i,s);if(!c)return r;let f=(t.maxX-t.minX)*o,b=(t.maxY-t.minY)*o,p=f>=b,h=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,x=[];for(let w=0;w<l;w++){let P=(w+.5)/l-.5,g=p?h+P*f:h,M=p?y:y+P*b;for(let R=0;R<d;R++){let k=t.deckTopM+(d===1?0:R/(d-1)*Ir);x.push({x:g,y:M,z:k})}}let I=i/2;for(let w of e){if(!Number.isFinite(w.eyeHeightM))continue;let P=w.x*o,g=w.y*o,M=w.eyeHeightM,R=0,k=1/0;for(let U of x){let v=U.x-P,S=U.y-g,T=Math.hypot(v,S);if(!(T>a)){R++;continue}let N=v/T,E=S/T,O=0;for(let A=a;A<T;A+=I){let _=_r(c,P+N*A,g+E*A);if(!(!Number.isFinite(_)||_>=M)&&_>M+(U.z-M)*A/T){O=A;break}}O?k=Math.min(k,O):R++}let L=R/x.length;L>=m||r.set(w.id,{seatId:w.id,mark:L<u?"obstructedView":"restrictedView",visibleFraction:L,totalRays:x.length,atDistanceM:Number.isFinite(k)?k:0})}return r}function tn(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function wt(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var $e=Math.PI/180;var Te=16;function It(e,t,n,r){let o=n*$e,i=Math.cos(o),s=Math.sin(o);return{x:r.x+e*i-t*s,y:r.y+e*s+t*i}}function cn(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,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(r===0){for(let u=0;u<t;u++)s.push(It(u*n,0,o,i));return s}let a=r/(t-1)*$e,m=n/(2*Math.sin(Math.abs(a)/2));for(let u=0;u<t;u++){let l=u*a,d=m*Math.sin(l),c=-m+m*Math.cos(l);s.push(It(d,c,o,i))}return s}function un(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function kr(e,t){let n=un(e);return cn(e).map((r,o)=>{let i=n.get(o),s=wt(i),a=Vt(e,o,i),m={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:a,displayLabel:pt(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(m).some(u=>u!==void 0&&u!==!1&&u!=="")?m:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function Tr(e){let t=[];for(let n of kr(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 Lr(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function Or(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(l=>[l.index,l])),o=(l,d,c,f)=>{let b=r.get(l),p=wt(b),h=b?.label??`${e.label}-${l+1}`,y=e.displayLabel??e.label;return{index:l,label:h,displayLabel:b?.displayLabel??`${y}-${l+1}`,x:d+(b?.dx??0),y:c+(b?.dy??0),categoryKey:b?.categoryKey??e.categoryKey,skipped:!!b?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:b?.wheelchairSpaceType,commercial:b?.commercial,glyph:b?.glyph,viewUrl:b?.viewFromSeatUrl,viewMeta:b?.viewFromSeatUrl?b.viewFromSeatMeta:void 0,labelStyle:b?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let l=(e.radius??40)+Te,d=e.rotation*$e,c=Math.max(0,Math.min(360,e.seatArc??360));if(c>=360||n===1){for(let h=0;h<n;h++){let y=d+h/n*2*Math.PI;t.push(o(h,e.center.x+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let f=c*$e,b=(2*Math.PI-f)/2,p=d+b;for(let h=0;h<n;h++){let y=p+h/(n-1)*f;t.push(o(h,e.center.x+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let i=e.width??80,s=e.height??50,a=Lr(e),m=["top","bottom","left","right"],u=0;for(let l of m){let d=a[l];for(let c=0;c<d;c++){let f,b;l==="top"?(f=-i/2+(c+.5)*i/d,b=-s/2-Te):l==="bottom"?(f=-i/2+(c+.5)*i/d,b=s/2+Te):l==="left"?(f=-i/2-Te,b=-s/2+(c+.5)*s/d):(f=i/2+Te,b=-s/2+(c+.5)*s/d);let p=It(f,b,e.rotation,e.center);t.push(o(u++,p.x,p.y,l))}}return t}function Br(e){return Or(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 Fr(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 on(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,s=t[r].y,a=t[o].x,m=t[o].y;s>e.y!=m>e.y&&e.x<(a-i)*(e.y-s)/(m-s)+i&&(n=!n)}return n}function Dr(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),a=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function vt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function pe(e,t,n){return on(e,t)&&!vt(n).some(r=>on(e,r)||Dr(e,r))}function Ze(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function ln(e){switch(e.type){case"row":{let t=cn(e),n=un(e),r=0,o=0,i=0;for(let s=0;s<t.length;s++){let a=n.get(s);a?.skip||(r+=t[s].x+(a?.dx??0),o+=t[s].y+(a?.dy??0),i++)}return i?{x:r/i,y:o/i}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return Ze(e.points);case"section":return Ze(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?Ze(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 rn(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function Nr(e,t){if(e.type!=="gaArea"||!rn(e.points,t.outline))return!1;let n=vt(e.holes),r=vt(t.holes);return n.length===r.length&&n.every((o,i)=>rn(o,r[i]))}function Gr(e,t,n=e.filter(o=>o.type==="section"),r=ln(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(Nr(t,s)||pe(r,s.outline,s.holes))):void 0)??n.find(s=>pe(r,s.outline,s.holes))}function nn(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 sn(e,t,n,r,o,i,s,a,m){let u=[],l=e.filter(p=>p.type==="section"),d=Yt(e),c=p=>!p?.eventConfigurationId||p.eventConfigurationId===r&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===m),f=p=>Wt(p,{activeConfigurationId:r,activeConfigurationVersion:m,activeBasisSha256:o,now:a}),b=(p,h)=>f(p)?{...p,coverage:h}:void 0;for(let p of e){let h=[];if(p.type==="row"?h=Tr(p):p.type==="table"?h=Br(p):p.type==="booth"&&(h=Fr(p)),!h.length)continue;for(let P of h)P.viewUrl&&!c(P.viewMeta)&&(P.viewUrl=void 0,P.viewMeta=void 0);if(p.type==="row"){let P=d.get(p.id);if(P){let g=new Map((p.overrides??[]).map(M=>[M.index,M]));for(let M of h){let R=Number(M.id.slice(M.id.lastIndexOf(":")+1));if(!Number.isInteger(R))continue;M.logicalRowId=P.groupId,M.logicalSeatIndex=P.adjacencyOffset+R,g.get(R)?.displayLabel||(M.displayLabel=pt(p,R,P)),!M.viewUrl&&P.viewFromSeatUrl&&c(P.viewFromSeatMeta)&&(M.viewUrl=P.viewFromSeatUrl,M.viewMeta=P.viewFromSeatMeta);let k=g.get(R)?.confidenceEvidence;M.confidenceEvidence=b(k,"exact-seat")??b(p.confidenceEvidence,"row-representative")??b(P.confidenceEvidence,"row-representative")}}}let y=Gr(e,p,l,p.type==="row"?Ze(h):ln(p)),x=y?.viewFromSeatUrl,w=(y?.zone?t?.find(P=>P.id===y.zone):void 0)?.focalPoint??n;for(let P of h){if(!P.confidenceEvidence){let g=Number(P.id.slice(P.id.lastIndexOf(":")+1)),M=(p.type==="row"||p.type==="table")&&Number.isInteger(g)?p.overrides?.find(R=>R.index===g)?.confidenceEvidence:void 0;P.confidenceEvidence=b(M,"exact-seat")??(p.type==="row"?b(p.confidenceEvidence,"row-representative"):void 0)}P.confidenceEvidence??=b(y?.confidenceEvidence,"section-representative")??(s?b(s.evidence,s.coverage):void 0),!P.viewUrl&&x&&c(y?.viewFromSeatMeta)&&(P.viewUrl=x,P.viewMeta=y?.viewFromSeatMeta),!P.viewUrl&&i&&c(i.meta)&&(P.viewUrl=i.url,P.viewMeta=i.meta),y&&(P.sectionId=y.logicalSectionId??y.id),y?.zone&&(P.zoneId=y.zone),w&&(P.focalPoint={...w})}u.push(...h)}return u}function fn(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,m=sn(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&an(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,m);for(let u of m)u.floorId=o.id;for(let u of m)r.push(u)}return r}let n=sn(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&&an(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),jr(e,n,t)}function jr(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||tn(t,en(t,Jt(e))),t}function an(e,t,n,r){let o=e.filter(d=>d.type==="section"),i=n>0||o.some(d=>d.height!==void 0||d.rake!==void 0||(d.elevation??0)>0);if(!o.length||!i||!t){for(let d of r)d.eyeHeightM=n+ce;return}let s=new Array(r.length),a=new Map;for(let d of o)a.has(d.id)||a.set(d.id,d);let m=new Map,u=new Map;for(let d=0;d<r.length;d++){let c=r[d],b=(c.sectionId?a.get(c.sectionId)??o.find(h=>h.logicalSectionId===c.sectionId&&pe({x:c.x,y:c.y},h.outline,h.holes)):void 0)??o.find(h=>pe({x:c.x,y:c.y},h.outline,h.holes))??null;if(s[d]=b,!b)continue;m.has(b.id)||m.set(b.id,Ke(b,{floorBaseHeightM:n}));let p=u.get(b.id);p?p.push(d):u.set(b.id,[d])}let l=new Array(r.length).fill(void 0);for(let[d,c]of u){let f=m.get(d);if(!f)continue;let b=f.rake>0?Math.tan(f.rake*Math.PI/180):0,p=ze(d,r,c,t);for(let h of p.rows){let y=h.blockDepth*te*b,x=f.height+y;for(let I of h.seatIndices)l[I]=x}}for(let d=0;d<r.length;d++){let c=r[d],f=s[d];if(!f){c.eyeHeightM=n+ce;continue}let b=m.get(f.id);c.eyeHeightM=(l[d]??b.height)+ce}}var Ur=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Yr(e){let t=Ur.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function W(e){let t=Yr(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Xr(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=Xr(e);return ne(e,[n,n,n],t)}var Qe=["available","held","sold","selected","dimmed"];function mn(e){let t=Qe.indexOf(e);return t<0?0:t}var dn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var Rt={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]},Pt={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 Vr=.15,Hr=1.6;function bn(e){return Ut(e??1,Vr,Hr)}var Kr=.15,zr=.9,Wr=1.76;function Zr(){return{background:{top:[...Pt.top],bottom:[...Pt.bottom]},structure:Rt,seatStates:{...dn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function pn(e){let t=Zr();if(!e)return t;let n=W(e.background);if(n){t.background={top:ie(n,zr),bottom:ie(n,Wr)};let s={};for(let[a,m]of Object.entries(Rt))s[a]=ne(m,n,Kr);t.structure=s}let r=W(e.selectionColor)??W(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=bn(o));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 hn(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}var gn=Ie(require("earcut"),1),xn=Ie(require("polygon-clipping"),1);function he(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function Oe(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let s=e[o],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}var C=te,$r=.002;function Qr(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),s=Math.max(r,o,i);if(s<1e-9)return!0;let a=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-r)*(a-o)*(a-i)))/s<$r}var ye=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},et=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,r,o,i,s=i,a=i){Qr(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(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,r,o,i,s,a,m=a,u=a){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(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(u[0],u[1],u[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function qr(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],m=n[2]-e[2],u=o*m-i*a,l=i*s-r*m,d=r*a-o*s,c=Math.hypot(u,l,d)||1;return u/=c,l/=c,d/=c,[u,l,d]}function Jr(e,t){let n=[...e],r=[];for(let s of e)r.push(s.x,s.y);let o=[];if(t){for(let s of t)if(!(s.length<3)){o.push(n.length);for(let a of s)n.push(a),r.push(a.x,a.y)}}let i=(0,gn.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Ct(e){return he(e)<0?[...e].reverse():e}var ei=3;function ti(e,t,n,r){let o=r(e),i=r(t),s=r(n),a=(f,b,p,h)=>Math.abs(r({x:(f.x+b.x)/2,y:(f.y+b.y)/2})-(p+h)/2),m=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(o+i+s)/3,d=Math.max(a(e,t,o,i),a(t,n,i,s),a(n,e,s,o),Math.abs(r({x:m,y:u})-l)),c=(f,b,p)=>{let h=Math.abs(r({x:(f+m)/2,y:(b+u)/2})-(p+l)/2);h>d&&(d=h)};return c((e.x+t.x)/2,(e.y+t.y)/2,(o+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+o)/2),d}function Be(e,t,n,r,o){if(o<=0)return ti(e,t,n,r);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,r,o-1),Be(i,t,s,r,o-1),Be(a,s,n,r,o-1),Be(i,s,a,r,o-1))}function Fe(e,t,n,r,o,i,s,a){if(s>0){let c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},f={x:(n.x+r.x)/2,y:(n.y+r.y)/2},b={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Fe(e,t,c,b,o,i,s-1,a),Fe(e,c,n,f,o,i,s-1,a),Fe(e,b,f,r,o,i,s-1,a),Fe(e,c,f,b,o,i,s-1,a);return}let m=[t.x*C,o(t),t.y*C],u=[n.x*C,o(n),n.y*C],l=[r.x*C,o(r),r.y*C];if(a){e.triN(m,u,l,a(t),a(n),a(r),i);return}let d=qr(m,u,l);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(m,u,l,d,i)}var ni=8;function yn(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,s,a,m,u)=>{if(u>0){let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},d=t(l);if(Math.abs(d-(a+m)/2)>n){o(i,l,a,d,u-1),o(l,s,d,m,u-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];o(s,a,t(s),t(a),ni)}return r}function qe(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],s=n[o],a=n[(o+1)%n.length],m=a.x-i.x,u=a.y-i.y,l=Math.hypot(m,u);l>t&&Math.abs((s.x-i.x)*u-(s.y-i.y)*m)/l<t||r.push(s)}return r.length>=3?r:n}var Je=.001*me*.1;function J(e,t,n,r,o,i,s,a,m=1/0,u){if(!t||t.length<3||(m===void 0&&(m=1/0),Math.abs(he(t))<1e-4))return;let l=qe(yn(qe(Ct(t),Je),r,m),Je),d=n?.map(g=>qe(yn(qe(Ct(g),Je),r,m),Je)).filter(g=>g.length>=3&&Math.abs(he(g))>=1e-4),{pts:c,tris:f}=Jr(l,d),b=[i[0]*a.top,i[1]*a.top,i[2]*a.top],p=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],h=[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],x=0;if(Number.isFinite(m))for(;x<ei;x++){let g=0;for(let M=0;M<f.length;M+=3){let R=Be(c[f[M]],c[f[M+1]],c[f[M+2]],r,x);R>g&&(g=R)}if(g<=m)break}for(let g=0;g<f.length;g+=3){let M=c[f[g]],R=c[f[g+1]],k=c[f[g+2]];Fe(e,M,R,k,r,b,x,u);let L=[M.x*C,o,M.y*C],U=[R.x*C,o,R.y*C],v=[k.x*C,o,k.y*C];e.tri(L,v,U,[0,-1,0],p)}let I=g=>{if(x<=0)return g;let M=1<<x,R=[];for(let k=0;k<g.length;k++){let L=g[k],U=g[(k+1)%g.length];for(let v=0;v<M;v++){let S=v/M;R.push({x:L.x+(U.x-L.x)*S,y:L.y+(U.y-L.y)*S})}}return R},w=dt(l),P=[{ring:I(l),flip:!1}];if(d)for(let g of d)g.length>=3&&P.push({ring:I(g),flip:!0});for(let{ring:g,flip:M}of P)for(let R=0;R<g.length;R++){let k=g[R],L=g[(R+1)%g.length],U=(L.x-k.x)*C,S=(L.y-k.y)*C,T=-U,N=Math.hypot(S,T)||1;S/=N,T/=N;let E=(k.x+L.x)/2-w.x,O=(k.y+L.y)/2-w.y,A=S*E+T*O;M&&(A=-A),A<0&&(S=-S,T=-T);let _=[S,0,T],B=[k.x*C,r(k),k.y*C],D=[L.x*C,r(L),L.y*C],F=[k.x*C,o,k.y*C],j=[L.x*C,o,L.y*C];e.tri(B,D,j,_,h,h,y),e.tri(B,j,F,_,h,y,y)}}function Mn(e){let t=0;for(let m of e)t+=m.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=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),r.set(m.normal,a*3),o.set(m.color,a*3),i.set(m.floor,a),s.set(m.material,a),a+=m.count;return{position:n,normal:r,color:o,floor:i,material:s,count:t}}function tt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Ct(e),o=r.length,i=[];for(let a=0;a<o;a++){let m=r[a],u=r[(a+1)%o],l=u.x-m.x,d=u.y-m.y,c=Math.hypot(l,d)||1;i.push({x:d/c,y:-l/c})}let s=[];for(let a=0;a<o;a++){let m=r[a],u=i[(a-1+o)%o],l=i[a],d=u.x+l.x,c=u.y+l.y,f=Math.hypot(d,c),b=()=>{s.push([m.x+u.x*t,m.y+u.y*t]),s.push([m.x+l.x*t,m.y+l.y*t])};if(f<1e-9){b();continue}d/=f,c/=f;let p=d*u.x+c*u.y,h=1/Math.max(p,1e-6);if(!Number.isFinite(h)||h>n){b();continue}s.push([m.x+d*t*h,m.y+c*t*h])}if(s.length<3)return e;try{let a=xn.default.union([[...s,s[0]]]),m=null,u=-1/0;for(let d of a){let c=Math.abs(he(d[0].map(([f,b])=>({x:f,y:b}))));c>u&&(u=c,m=d[0])}if(!m)return e;let l=m.map(([d,c])=>({x:d,y:c}));if(l.length>1){let d=l[0],c=l[l.length-1];Math.abs(d.x-c.x)<1e-9&&Math.abs(d.y-c.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function nt(e,t,n,r,o=28){let i=[];for(let s=0;s<o;s++){let a=s/o*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+r*Math.sin(a)})}return i}function De(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var oi=[{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"}],xa=new Map(oi.map(e=>[e.key,e]));var ri={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 Sn(e){let t=e?.[0];return t&&ri[t]||"#3b82f6"}var ii=[{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"}],Ma=new Map(ii.map(e=>[e.key,e]));var si=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Sa=new Set(si);var In=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark: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},mark:{x:12,y:10,radius:6}},{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},mark:{x:12,y:10,radius:4.5}},{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},mark:{x:12,y:5,radius:3}},{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},mark:{x:12,y:7.5,radius:5.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},mark:{x:12,y:8,radius: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},mark:{x:12,y:9.25,radius:6.5}},{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},mark:{x:12,y:12.25,radius:4.75}}],vn=In.map(e=>e.key),ai=new Map(In.map(e=>[e.key,e]));function wn(e){return typeof e=="string"&&ai.has(e)}function Rn(e,t){return wn(e)?e:wn(t?.seatGlyph)?t.seatGlyph:"circle"}var ee={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ci=.44,ui=.15,li=.3,fi=.24;function Pn(e){return e===void 0||!Number.isFinite(e)||e<=0?fi:Math.min(li,Math.max(ui,e*ci))}var mi=.05,Cn=.45,di=Cn+mi,bi=.92;var Pa=[{part:ee.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ee.pad,min:[-1,.36,-.95],max:[1,Cn,1]},{part:ee.back,min:[-1,di,-1],max:[1,bi,-.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]}],Ca=[{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 En(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],s=u=>e[u*3+2],a=0,m=(u,l)=>{let d=l-u;for(let c=u;c<l;c++){let[f,b]=r(c),p=f-i(c),h=b-s(c);if(d>=2){let y=Math.max(u,c-1),x=Math.min(l-1,c+1),I=i(x)-i(y),w=s(x)-s(y),P=Math.hypot(I,w);if(P>1e-6){let g=-w/P,M=I/P;g*p+M*h<0&&(g=-g,M=-M),p=g,h=M}}o[c]=p===0&&h===0?0:Math.atan2(p,h)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(a))&&(m(a,u),a=u);return o}var ot=.22;var pi=.42;function hi(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,s=-1/0;for(let b of e)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>i&&(i=b.x),b.y>s&&(s=b.y);let a=Math.max(i-r,1e-6),m=Math.max(s-o,1e-6),u=Math.max(Math.sqrt(a*m/t),1e-6),l=Math.max(1,Math.ceil(a/u)+1),d=Math.max(1,Math.ceil(m/u)+1),c=new Map,f=(b,p)=>{let h=Math.min(l-1,Math.max(0,Math.floor((b-r)/u)));return Math.min(d-1,Math.max(0,Math.floor((p-o)/u)))*l+h};for(let b=0;b<t;b++){let p=f(e[b].x,e[b].y),h=c.get(p);h?h.push(b):c.set(p,[b])}for(let b=0;b<t;b++){let p=e[b],h=Math.min(l-1,Math.max(0,Math.floor((p.x-r)/u))),y=Math.min(d-1,Math.max(0,Math.floor((p.y-o)/u))),x=1/0;for(let I=1;I<=4;I++){for(let w=y-I;w<=y+I;w++)if(!(w<0||w>=d))for(let P=h-I;P<=h+I;P++){if(P<0||P>=l||I>1&&Math.abs(w-y)<I&&Math.abs(P-h)<I)continue;let g=c.get(w*l+P);if(g)for(let M of g){if(M===b)continue;let R=Math.hypot(e[M].x-p.x,e[M].y-p.y);R<x&&(x=R)}}if(Number.isFinite(x)&&x<=I*u)break}n[b]=x}return n}function yi(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-ce):0}function An(e,t,n,r,o,i){let s=e.length,a=new Float32Array(s*3),m=new Float32Array(s),u=new Float32Array(s*3),l=new Float32Array(s),d=new Float32Array(s),c=new Float32Array(s),f=new Float32Array(s),b=new Float32Array(s*3),p=new Map,h=hi(e);for(let y=0;y<s;y++){let x=e[y],w=(n?.seatPitchU(y)??h[y])*C;l[y]=Number.isFinite(w)?Math.max(.06,Math.min(ot,w*pi)):ot,d[y]=Pn(Number.isFinite(w)?w:void 0);let P=Rn(x.glyph,{seatGlyph:i?.get(x.categoryKey)});c[y]=vn.indexOf(P),f[y]=x.wheelchairSpaceType==="no-seat"?0:1,a[y*3]=x.x*C,a[y*3+1]=n?n.seatDeckY(y):yi(x),a[y*3+2]=x.y*C,m[y]=mn(t?t(x):"available");let g=W(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=g[0],u[y*3+1]=g[1],u[y*3+2]=g[2],x.accessibility?.length){let M=W(Sn(x.accessibility));M&&(b[y*3]=M[0],b[y*3+1]=M[1],b[y*3+2]=M[2])}p.set(x.id,y)}return{count:s,iPosition:a,iState:m,iCategory:u,iMaxRadius:l,iRing:b,idToIndex:p,iChairWidth:d,iGlyph:c,iPhysicalSeat:f,iFloor:r??new Float32Array(s),iYaw:new Float32Array(s)}}function gi(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function xi(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let f of e)n+=f.x,r+=f.y,o+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let s=e[0],a=-1;for(let f of e){let b=Math.hypot(f.x-n,f.y-r);b>a&&(a=b,s=f)}let m=s.x-n,u=s.y-r,l=Math.hypot(m,u);l>1e-9?(m/=l,u/=l):(m=1,u=0);let d=[...e].sort((f,b)=>(f.x-n)*m+(f.y-r)*u-((b.x-n)*m+(b.y-r)*u)),c=0;for(let f of d){let b=Math.hypot(f.x-n,f.y-r);b>c&&(c=b)}return{pts:d,cx:n,cy:r,radius:c,depth:o}}function _n(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let s=r[i],a=r[i+1],m=a.x-s.x,u=a.y-s.y,l=m*m+u*u,d=l>1e-12?((t-s.x)*m+(n-s.y)*u)/l:0;d<0?d=0:d>1&&(d=1);let c=Math.hypot(t-(s.x+d*m),n-(s.y+d*u));c<o&&(o=c)}return o}var rt=8;function Mi(e,t,n){let r=new Array(rt).fill(1/0),o=new Array(rt).fill(-1);for(let l=0;l<e.length;l++){let d=e[l],c=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let f=0;f<rt;f++)if(c<r[f]){for(let b=rt-1;b>f;b--)r[b]=r[b-1],o[b]=o[b-1];r[f]=c,o[f]=l;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let l of o){if(l<0)continue;let d=_n(e[l],t,n);for(let c=0;c<3;c++)if(d<i[c]){for(let f=2;f>c;f--)i[f]=i[f-1],s[f]=s[f-1];i[c]=d,s[c]=l;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,u=0;for(let l=0;l<3;l++){let d=s[l];if(d<0||i[l]>a)continue;let c=1/(i[l]*i[l]);m+=c*e[d].depth,u+=c}return u>0?m/u:e[s[0]].depth}function Si(e){let t=(r,o)=>Mi(e,r,o),n=(r,o)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let m=e[a];if(Math.hypot(r-m.cx,o-m.cy)-m.radius>=i)continue;let u=_n(m,r,o);u<i&&(i=u,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,s=(t(r,o+.5)-t(r,o-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function kn(e,t){let n=[];for(let r of e){let o=xi(r.points,t);o&&n.push(o)}return n.length<2?gi(t):(n.sort((r,o)=>r.depth-o.depth),Si(n))}var _t=Ie(require("polygon-clipping"),1);var Bn=Ie(require("earcut"),1);var wi=.58,Tn=.01,se=ot*1.5*me,Ii=.5,vi=.6;function Ri(e,t){let n=e.length,r=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],m=e[Math.min(n-1,s+1)],u=m.x-a.x,l=m.y-a.y,d=Math.hypot(u,l);if(d<1e-9){r.push([0,0]);continue}u/=d,l/=d,r.push([-l,u])}let o=0;for(let s=0;s<n;s++)o+=(e[s].x-t.x)*r[s][0]+(e[s].y-t.y)*r[s][1];return o<0?r.map(([s,a])=>[-s,-a]):r}function Pi(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(s,a)=>{let m=a.x-s.x,u=a.y-s.y,l=Math.hypot(m,u)||1;return{x:m/l,y:u/l}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Ln=Math.PI/12;function Ci(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),r=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},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Fn(e,t){if(!e.length||!(t>0))return[];let n=Ci(e),r=(a,m,u,l)=>{let d=u-m;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let c=Math.max(1,Math.ceil(d/Ln)),f=t/Math.cos(d/c/2);for(let b=0;b<=c;b++){let p=m+d*b/c;l.push({x:a.x+Math.cos(p)*f,y:a.y+Math.sin(p)*f})}};if(n.length<3){let a=0,m=0;for(let f of n)a+=f.x,m+=f.y;a/=n.length||1,m/=n.length||1;let u=0;for(let f of n)u=Math.max(u,Math.hypot(f.x-a,f.y-m));let l=[],d=Math.max(3,Math.ceil(Math.PI*2/Ln)),c=(u+t)/Math.cos(Math.PI/d);for(let f=0;f<d;f++){let b=f/d*Math.PI*2;l.push({x:a+Math.cos(b)*c,y:m+Math.sin(b)*c})}return l}let o=n.length,i=[];for(let a=0;a<o;a++){let m=n[a],u=n[(a+1)%o];i.push(Math.atan2(-(u.x-m.x),u.y-m.y))}let s=[];for(let a=0;a<o;a++)r(n[a],i[(a+o-1)%o],i[a],s);return Un(s)}function Ei(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],s=e[o+1],a=s.x-i.x,m=s.y-i.y,u=a*a+m*m,l=u>1e-12?((t-i.x)*a+(n-i.y)*m)/u:0;l<0?l=0:l>1&&(l=1);let d=Math.hypot(t-(i.x+l*a),n-(i.y+l*m));d<r&&(r=d)}return r}function it(e){let t=e.map(o=>{let i=0,s=0;for(let u of o.pts)i+=u.x,s+=u.y;let a=o.pts.length||1;i/=a,s/=a;let m=0;for(let u of o.pts){let l=Math.hypot(u.x-i,u.y-s);l>m&&(m=l)}return{cx:i,cy:s,rad:m}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),s=[],a=1/0,m=null;for(let l of i){let d=1/0;for(let c=0;c<e.length;c++){if(c===o||Math.abs(e[c].y-e[o].y)<.001)continue;let f=t[c],b=Math.hypot(l.x-f.cx,l.y-f.cy)-f.rad;if(b>=d&&b>=a)continue;let p=Ei(e[c].pts,l.x,l.y);p<d&&(d=p),e[c].depth<e[o].depth&&p<a&&(a=p,m=e[c].y)}Number.isFinite(d)&&d>0&&s.push(d)}s.sort((l,d)=>l-d);let u=s.length?s[Math.floor(s.length/2)]:1;r.push({pitch:u,belowY:m})}return r}function Dn(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let l=o.pts[0],d=l.x-r.x,c=l.y-r.y,f=Math.hypot(d,c)||1;d/=f,c/=f;let b=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+c*b,y:l.y-d*b},{x:l.x-c*b,y:l.y+d*b}]})():[];if(i.length<2)return null;let s=0,a=0;for(let l=1;l<i.length;l++){let d=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);d>1e-6&&(s+=d,a++)}let m=a>0?s/a:0,u=Pi(i,Math.max(m*vi,se));return{pts:u,nrm:Ri(u,r),front:Math.max(n[t].pitch*wi,se),back:Math.max(n[t].pitch*Ii,se)}}var Pe=1.5,Nn=.3;function Et(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,s=Math.hypot(o,i),a=-1,m=-1;for(let d=1;d<e.length-1;d++){let c=e[d],f=s>1e-12?Math.abs((c.x-n.x)*i-(c.y-n.y)*o)/s:Math.hypot(c.x-n.x,c.y-n.y);f>a&&(a=f,m=d)}if(a<=t||m<0)return[n,r];let u=Et(e.slice(0,m+1),t),l=Et(e.slice(m),t);return[...u.slice(0,-1),...l]}function Gn(e,t){if(e.length<4)return e;let n=Et([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function jn(e,t,n){if(e.length<2)return[];let r=n??it(e),o=new Map;for(let s=0;s<e.length;s++){let a=o.get(e[s].blockId);a?a.push(s):o.set(e[s].blockId,[s])}let i=[];for(let[,s]of o){let a=[];for(let x of s){let I=e[x].patch;I&&I.length>=3?i.push({outline:[...I],holes:[],topY:e[x].y}):a.push(x)}if(!a.length)continue;a.sort((x,I)=>e[x].depth-e[I].depth);let u=a.map(x=>Dn(e,x,r,t)).filter(x=>x!==null);if(!u.length)continue;let l=(x,I)=>({x:x.pts[I].x-x.nrm[I][0]*(x.front+Pe),y:x.pts[I].y-x.nrm[I][1]*(x.front+Pe)}),d=(x,I)=>({x:x.pts[I].x+x.nrm[I][0]*(x.back+Pe),y:x.pts[I].y+x.nrm[I][1]*(x.back+Pe)}),c=u[0],f=u[u.length-1],b=[];for(let x=0;x<c.pts.length;x++)b.push(l(c,x));for(let x of u)b.push(d(x,x.pts.length-1));for(let x=f.pts.length-1;x>=0;x--)b.push(d(f,x));for(let x=u.length-1;x>=0;x--)b.push(l(u[x],0));let p=Un(b),h=1/0;for(let x of a)e[x].y<h&&(h=e[x].y);if(!Number.isFinite(h))continue;if(p.length>=3&&Math.abs(he(p))>1e-6&&u.every(x=>{let I=x.pts[Math.floor(x.pts.length/2)];return Oe(p,I.x,I.y)})){i.push({outline:Gn(p,Nn),holes:[],topY:h});continue}for(let x of Ai(u))i.push({outline:x,holes:[],topY:h})}return i}function Ai(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+Pe,s=n.back+Pe;for(let m=0;m<n.pts.length;m++){let u=n.pts[m],l=n.nrm[m];r.push([u.x-l[0]*i,u.y-l[1]*i]),o.push([u.x+l[0]*s,u.y+l[1]*s])}let a=[...r,...o.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=_t.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([m,u])=>({x:m,y:u})),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&&r.push(Gn(i,Nn))}return r}catch{return[]}}function Un(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var At=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!Oe(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function On(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],l=r[0];for(let d=1;d+1<r.length;d++){let c=r[d],f=r[d+1];e.tri([l.x*C,o,l.y*C],[c.x*C,o,c.y*C],[f.x*C,o,f.y*C],u,i)}return}let s=r.map(u=>[u.x,u.y]);s.push(s[0]);let a;try{a=_t.default.intersection([s],t)}catch{return}let m=[0,1,0];for(let u of a){if(!u.length||u[0].length<4)continue;let l=u[0],d=[],c=[];for(let b=0;b<l.length-1;b++)d.push(l[b][0],l[b][1]),c.push([l[b][0],l[b][1]]);if(c.length<3)continue;let f=(0,Bn.default)(d,void 0,2);for(let b=0;b<f.length;b+=3){let p=c[f[b]],h=c[f[b+1]],y=c[f[b+2]];e.tri([p[0]*C,o,p[1]*C],[h[0]*C,o,h[1]*C],[y[0]*C,o,y[1]*C],m,i)}}}function Yn(e,t,n,r,o,i,s){if(t.length<2)return;let a=s??it(t),m=[0,1,0],u=i&&i.length>=3?[[...i.map(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new At([[...i]]):null,d=f=>{e.setMaterial(2),f(),e.setMaterial(0)},c=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let b=t[f];if(b.patch&&b.patch.length>=3){let P=[...b.patch],g=a[f].belowY??r;if(c(()=>{if(u&&l)On(e,u,l,P,b.y,o.tread);else{let M=P[0];for(let R=1;R+1<P.length;R++){let k=P[R],L=P[R+1];e.tri([M.x*C,b.y,M.y*C],[k.x*C,b.y,k.y*C],[L.x*C,b.y,L.y*C],m,o.tread)}}}),b.y>g+Tn){let M=0,R=0;for(let k of P)M+=k.x,R+=k.y;M/=P.length,R/=P.length,d(()=>{for(let k=0;k<P.length;k++){let L=P[k],U=P[(k+1)%P.length],v=U.x-L.x,S=U.y-L.y,T=Math.hypot(v,S);if(T<1e-6)continue;let N=S/T,E=-v/T;(L.x-M)*N+(L.y-R)*E<0&&(N=-N,E=-E);let O=[N,0,E],A=[L.x*C,b.y,L.y*C],_=[U.x*C,b.y,U.y*C],B=[L.x*C,g,L.y*C],D=[U.x*C,g,U.y*C];e.tri(A,_,D,O,o.riser),e.tri(A,D,B,O,o.riser)}})}continue}let p=Dn(t,f,a,n);if(!p)continue;let{pts:h,nrm:y,front:x,back:I}=p,w=a[f].belowY??r;for(let P=0;P+1<h.length;P++){let g=h[P],M=h[P+1],R=y[P],k=y[P+1];if(Math.hypot(M.x-g.x,M.y-g.y)<1e-6||R[0]===0&&R[1]===0||k[0]===0&&k[1]===0)continue;let L=[(g.x-R[0]*x)*C,b.y,(g.y-R[1]*x)*C],U=[(M.x-k[0]*x)*C,b.y,(M.y-k[1]*x)*C],v=[(g.x+R[0]*I)*C,b.y,(g.y+R[1]*I)*C],S=[(M.x+k[0]*I)*C,b.y,(M.y+k[1]*I)*C];if(c(()=>{u&&l?On(e,u,l,[{x:g.x-R[0]*x,y:g.y-R[1]*x},{x:M.x-k[0]*x,y:M.y-k[1]*x},{x:M.x+k[0]*I,y:M.y+k[1]*I},{x:g.x+R[0]*I,y:g.y+R[1]*I}],b.y,o.tread):(e.tri(L,U,S,m,o.tread),e.tri(L,S,v,m,o.tread))}),b.y>w+Tn){let T=[L[0],w,L[2]],N=[U[0],w,U[2]],E=[-R[0],0,-R[1]];d(()=>{e.tri(L,U,N,E,o.riser),e.tri(L,N,T,E,o.riser)})}}}}function Xn(e){let t=1/0,n=1/0,r=-1/0,o=-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>r&&(r=s.x),s.y>o&&(o=s.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function st(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var kt=Ie(require("polygon-clipping"),1);function _i(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Vn(e,t){return e.filter(n=>n.type!=="shape"||_i(n,t))}function Hn(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Vn(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Vn(e.objects,t),focal:n,baseHeightM:0,index:0}]}var ki={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Ce(e){return Xn(e)??ki}function Kn(e,t){let n=tt(e.outline,se),r=Ce(n),o=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&st(r,Ce(s.outline)));if(!o.length)return[n];let i=s=>{let a=s.map(m=>[m.x,m.y]);return a.push(a[0]),a};try{let s=kt.default.difference([i(n)],...o.map(m=>[i(m.outline)])),a=[];for(let m of s){if(!m.length)continue;let u=m[0].map(([l,d])=>({x:l,y:d}));if(u.length>1){let l=u[0],d=u[u.length-1];Math.abs(l.x-d.x)<1e-9&&Math.abs(l.y-d.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a.length?a:[n]}catch{return[n]}}function zn(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},r=t.map(i=>[n(i)]),o=[];for(let i of e){let s;try{s=kt.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let a of s){if(!a.length)continue;let m=a[0].map(([u,l])=>({x:u,y:l}));if(m.length>1){let u=m[0],l=m[m.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&m.pop()}m.length>=3&&o.push({outline:m,holes:[],topY:i.topY})}}return o.length?o:e}var Ti=.05,Wn=.05,Li=.15,Tt=25;function Zn(e,t,n){let r=new Map,o=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,u=[],l=new Set;for(let c=0;c<e.length;c+=1){let f=e[c];for(let b of f.objects){if(b.type==="table"&&l.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=tt(b.outline,se);m.set(b.id,{section:b,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:b.id,floorIndex:c,box:Ce(p),section:b,unit:f,outline:p})}}let d=new Map;for(let c of u){let f=d.get(c.floorIndex);f?f.push(c):d.set(c.floorIndex,[c])}for(let c=0;c<t.length;c++){let f=t[c],b=n?d.get(n[c])??[]:u,p=f.sectionId?b.find(y=>y.id===f.sectionId)??b.find(y=>y.section.logicalSectionId===f.sectionId&&pe({x:f.x,y:f.y},y.outline,y.section.holes)):void 0,h=p?[p]:b;for(let y of h){if(n&&y.floorIndex!==n[c]||!p&&(f.x<y.box.minX||f.x>y.box.maxX||f.y<y.box.minY||f.y>y.box.maxY||!pe({x:f.x,y:f.y},y.outline,y.section.holes)))continue;o[c]=y.id;let x=m.get(y.id);x.hasSeats=!0;let I=f.focalPoint??y.unit.focal,w=Math.hypot(f.x-I.x,f.y-I.y);w<x.frontU&&(x.frontU=w),x.seatIndices.push(c);let P=f.rowId||`__seat-${c}`,g=x.rows.get(P);g?g.push({x:f.x,y:f.y}):x.rows.set(P,[{x:f.x,y:f.y}]);break}}for(let[c,f]of m){let b=Ke(f.section,{floorBaseHeightM:f.unit.baseHeightM}),p=f.unit.baseHeightM,h=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=p+.001,x=f.section.surfaceKind,I=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:y,w=f.hasSeats?ze(c,t,f.seatIndices,f.unit.focal):{sectionId:c,rows:[],blockCount:0},g=w.rows.length<2?kn([...f.rows.values()].map(A=>({points:A})),f.unit.focal):null,M=1/0;if(g){if(f.hasSeats)for(let A of f.rows.values())for(let _ of A){let B=g.depthAt(_.x,_.y);B<M&&(M=B)}if(!f.hasSeats||!Number.isFinite(M)){M=1/0;for(let A of f.section.outline){let _=g.depthAt(A.x,A.y);_<M&&(M=_)}}}let R=p+Ti,k=Math.max(R,b.height),L=A=>{let _=Math.max(0,A-M)*te,B=Math.min(_*h,Tt);return Math.max(R,b.height+B)},U=A=>{let _=Math.max(0,A)*te,B=Math.min(_*h,Tt);return Math.max(R,b.height+B)},v=I?[]:w.rows.map(A=>({pts:A.pts,y:U(A.blockDepth),depth:A.blockDepth,blockId:A.blockId,...l.has(A.id)?{patch:Fn(A.pts,se)}:{}})),S=v.length?v[0].y:k,T=v.map(A=>{let _=A.patch&&A.patch.length>=3?A.patch:A.pts,B=0,D=0;for(let Y of _)B+=Y.x,D+=Y.y;let F=_.length||1;B/=F,D/=F;let j=0;for(let Y of _){let X=Math.hypot(Y.x-B,Y.y-D);X>j&&(j=X)}return{cx:B,cy:D,rad:j}}),N=I?()=>k:v.length>=2?(A,_)=>{let B=1/0,D=S;for(let F=0;F<v.length;F++){let j=T[F];if(Math.hypot(A-j.cx,_-j.cy)-j.rad>=B)continue;let Y=v[F].patch,X=Y&&Y.length>=3?Oe(Y,A,_)?0:ve(Y,A,_):ve(v[F].pts,A,_);X<B&&(B=X,D=v[F].y)}return D}:(A,_)=>g?L(g.depthAt(A,_)):k,E=[0,1,0],O=v.length>=2||I?()=>E:(A,_)=>{if(!g)return E;let B=g.depthAt(A,_);if(B<=M)return E;let D=(B-M)*te;if(D*h>=Tt||b.height+D*h<=R)return E;let[F,j]=g.gradientAt(A,_);if(F===0&&j===0)return E;let Y=1/Math.hypot(h,1);return[-F*h*Y,Y,-j*h*Y]};if(!I)for(let A of w.rows){let _=U(A.blockDepth);for(let B of A.seatIndices)s[B]=_}for(let A of w.rows){let _=[];for(let Y=1;Y<A.pts.length;Y++){let X=Math.hypot(A.pts[Y].x-A.pts[Y-1].x,A.pts[Y].y-A.pts[Y-1].y);X>1e-6&&_.push(X)}_.sort((Y,X)=>Y-X);let B=_.length?_[Math.floor(_.length/2)]:1/0,D=1/0,F=A.pts[Math.floor(A.pts.length/2)];if(F)for(let Y of w.rows){if(Y===A||Y.blockId!==A.blockId)continue;let X=ve(Y.pts,F.x,F.y);X>1e-6&&X<D&&(D=X)}let j=Math.min(B,Math.max(D,B*.5));if(Number.isFinite(j)&&j>0)for(let Y of A.seatIndices)a[Y]=j}r.set(c,{sectionId:c,deckAt:N,normalAt:O,flat:I,bottomY:p,rowLevels:v,landingY:S})}for(let c=0;c<t.length;c++){let f=o[c],b=t[c];if(f){let h=s[c];i[c]=(h??r.get(f).deckAt(b.x,b.y))+Li;continue}let p=b.eyeHeightM;i[c]=Number.isFinite(p)?Math.max(0,p-ce):0}return{bySection:r,seatOwner:o,seatDeckY:c=>i[c],seatPitchU:c=>a[c]}}var Q={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 $n(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let s=r.get(i.sectionId);s||(s=new Map,r.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,s]of r){let a=0,m=0,u=0,l=0;for(let[d,c]of s){let f=W(n.get(d));f&&(a+=f[0]*c,m+=f[1]*c,u+=f[2]*c,l+=c)}l>0&&o.set(i,[a/l,m/l,u/l])}return o}function Qn(e,t){return W(e.color)??t.get(e.logicalSectionId??e.id)??null}var qn=Ie(require("polygon-clipping"),1);function Oi(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var at=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(m=>[m.x,m.y]);if(r.length<3)return[];r.push(r[0]);let o=Ce(t),i=this.rings.filter((m,u)=>st(o,this.boxes[u])&&Oi(n,this.levels[u])),s=[[r]];if(i.length)try{s=qn.default.difference([r],...i).map(u=>u.map(l=>l.map(([d,c])=>[d,c])))}catch{s=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let a=[];for(let m of s){if(!m.length)continue;let u=m[0].map(([l,d])=>({x:l,y:d}));if(u.length>1){let l=u[0],d=u[u.length-1];Math.abs(l.x-d.x)<1e-9&&Math.abs(l.y-d.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a}};function Bi(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)n=Math.min(n,d.x),r=Math.max(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.y);let s=(n+r)/2,a=(o+i)/2,m=t*Math.PI/180,u=Math.cos(m),l=Math.sin(m);return e.map(d=>{let c=d.x-s,f=d.y-a;return{x:s+c*u-f*l,y:a+c*l+f*u}})}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,r=(e.y??0)+e.height/2;t=nt(n,r,e.width/2,e.height/2)}return t?Bi(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}},r=t==="stage"&&We(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Fi=.08;function Jn(e,t){let n=ge(e),r=Ne(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,s=1/0,a=-1/0,m=-1/0;for(let l of n)i=Math.min(i,l.x),s=Math.min(s,l.y),a=Math.max(a,l.x),m=Math.max(m,l.y);let u=o;for(let l of t)a>l.minX&&i<l.maxX&&m>l.minY&&s<l.maxY&&u<=l.topOffsetM+1e-6&&(u=l.topOffsetM+Fi);return t.push({minX:i,minY:s,maxX:a,maxY:m,topOffsetM:u}),u}function de(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function eo(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 Ge(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 to(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,r,o,i){J(e,t,void 0,()=>n,r,o,i,Q)}var Lt=2.4,Di=.75,Ni=.15;function je(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=n/2,u=r/2;return[[-m,-u],[m,-u],[m,u],[-m,u]].map(([l,d])=>({x:t.x+l*s-d*a,y:t.y+l*a+d*s}))}function no(e,t,n,r,o){let i=je(t);i&&J(e,i,void 0,()=>n+Lt,n,ue(r,o.boothTop),o.boothWall,Q)}function Ot(e){if(e.shape==="round"){let l=e.radius;return l?nt(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=t/2,u=n/2;return[[-m,-u],[m,-u],[m,u],[-m,u]].map(([l,d])=>({x:o.x+l*s-d*a,y:o.y+l*a+d*s}))}function oo(e,t,n,r,o){let i=Ot(t);i&&J(e,i,void 0,()=>n+Di,n,ue(r,o.tableTop),o.tableWall,Q)}function ro(e,t,n,r,o,i,s,a){let m=ge(t);if(!m)return;let u=a?a.kind==="stage":t.role==="stage",l=a?a.kind==="screen":t.role==="screen",d=a?{kind:u?"stage":"solid",heightM:a.topY-a.baseY}:Ne(t),c=a?.baseY??n,f=a?.topY??n+r;if(u&&s){let x=1/0,I=-1/0,w=1/0,P=-1/0;for(let g of m)g.x<x&&(x=g.x),g.x>I&&(I=g.x),g.y<w&&(w=g.y),g.y>P&&(P=g.y);s.push({cx:(x+I)/2*C,cz:(w+P)/2*C,y:f,halfX:Math.max((I-x)/2*C,.5),halfZ:Math.max((P-w)/2*C,.5)})}let b=W(t.fill),p=u&&b?ne(o.stageTop,ie(Le(b,.18),.9),.9):ue(b,u?o.stageTop:o.decorTop),h=l?b:null,y=u?b?ne(o.stageWall,ie(b,.58),.82):o.stageWall:l?h?ne(ie(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ue(W(t.fill),o.decorWall);if(d.kind==="portal"&&m.length===4){let x=eo(m);le(e,Ge(x,0,.16),f,c,p,y),le(e,Ge(x,.84,1),f,c,p,y),le(e,x,f,Math.max(c,f-.35),p,y);return}if(d.kind==="suite"&&m.length===4){let x=m.map((P,g)=>{let M=m[(g+1)%4],R=(P.x+M.x)/2,k=(P.y+M.y)/2;return Math.hypot(R-i.x,k-i.y)}),I=x.indexOf(Math.min(...x)),w=[0,1,2,3].map(P=>m[(I+P)%4]);le(e,Ge(w,0,.08),f,c,p,y),le(e,Ge(w,.92,1),f,c,p,y),le(e,to(w,.88,1),f,c,p,y),le(e,w,f,Math.max(c,f-.18),p,y);return}le(e,m,f,c,p,y)}function Bt(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,s=n+o/2,a=(e.rotation??0)*Math.PI/180,m=Math.cos(a),u=Math.sin(a),l=r/2,d=o/2;return[[-l,-d],[l,-d],[l,d],[-l,d]].map(([c,f])=>({x:i+c*m-f*u,y:s+c*u+f*m}))}function Gi(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return W(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let 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,u)=>ne(a,m,1/(u+1)),s[0]):null}function io(e,t,n,r){if(t.layer==="foreground")return;let o=Bt(t);if(!o)return;let i=n+Ni,s=ue(Gi(t.href),r.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=ne(r.ground,s,a)),J(e,o,void 0,()=>i,n,s,ne(s,r.decorWall,.5),Q)}function so(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=ue(r,o.gaTop);J(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,Q)}var ji=Math.PI/180,K=96,Ui=6,Yi=60,Xi=150,ao=.2,Vi=.35;function Hi(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/ji;return n<0?n+360:n}function ct(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function ut(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let s=0,a=0;for(let m=-n;m<=n;m++){let u=i+m;if(t)u=(u%r+r)%r;else if(u<0||u>=r)continue;s+=e[u],a++}o[i]=s/a}return o}function co(e,t){let n=e.filter(c=>c.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,s=0;for(let c of n)for(let f of c.rows){for(let b of f.pts)o+=b.x,i+=b.y,s++;if(f.pts.length>=4){let b=xt(f.pts);b&&Number.isFinite(b.cx)&&Number.isFinite(b.cy)&&r.push({x:b.cx,y:b.cy})}}if(!s)return null;let a={x:o/s,y:i/s},m=a;if(r.length>=8){let c=ct(r.map(y=>y.x)),f=ct(r.map(y=>y.y)),b=0;for(let y of n)for(let x of y.rows)for(let I of x.pts){let w=Math.hypot(I.x-a.x,I.y-a.y);w>b&&(b=w)}let p=0,h=b*.2;for(let y of n)for(let x of y.rows)for(let I of x.pts)Math.hypot(I.x-c,I.y-f)<h&&p++;Math.hypot(c-a.x,f-a.y)<=b&&p/s<.01&&(m={x:c,y:f})}let u=[];for(let c of n){let f={sectionId:c.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let b of c.rows)for(let p of b.pts){let h=Math.hypot(p.x-m.x,p.y-m.y),y=Math.min(K-1,Math.floor(Hi(m,p)/(360/K)));f.samples.push({r:h,bin:y,levelM:b.levelM}),h<f.rMin&&(f.rMin=h),h>f.rMax&&(f.rMax=h)}f.samples.length&&u.push(f)}if(!u.length)return null;u.sort((c,f)=>c.rMin+c.rMax-(f.rMin+f.rMax));let l=[];for(let c of u){let f=!1;for(let b of l){let p=Math.min(c.rMax,b.rMax)-Math.max(c.rMin,b.rMin),h=Math.min(c.rMax-c.rMin,b.rMax-b.rMin);if(h>1e-9&&p>=Vi*h){b.members.push(c),b.rMin=Math.min(b.rMin,c.rMin),b.rMax=Math.max(b.rMax,c.rMax),f=!0;break}}f||l.push({members:[c],rMin:c.rMin,rMax:c.rMax})}let d=[];for(let c of l){let f=new Array(K).fill(null);for(let S of c.members)for(let T of S.samples){let N=f[T.bin];N||(N={samples:[]},f[T.bin]=N),N.samples.push({r:T.r,levelM:T.levelM})}let b=f.map(S=>!!S);if(!b.filter(Boolean).length)continue;let h=[],y=[];for(let S of f){if(!S)continue;let T=1/0,N=-1/0;for(let E of S.samples)E.r<T&&(T=E.r),E.r>N&&(N=E.r);h.push(T),y.push(N)}let x=ct(h),I=ct(y);if(!(x>=ao*I)||!(I>0))continue;let w=[...h].sort((S,T)=>S-T);if(!(w[Math.floor(w.length*.1)]>=ao*I))continue;let g=f.map(S=>{if(!S)return null;let T=[...S.samples].sort((F,j)=>F.r-j.r),N=T[0].r,E=T[T.length-1].r,O=T[0].levelM,A=-1/0;for(let F of T)F.levelM>A&&(A=F.levelM);let _=[];for(let F of T){let j={r:F.r,l:F.levelM};for(;_.length&&Math.abs(_[_.length-1].r-j.r)<1e-9;){if(_[_.length-1].l<=j.l){j.skip=!0;break}_.pop()}if(!j.skip){for(;_.length>=2;){let Y=_[_.length-2],X=_[_.length-1];if((X.r-Y.r)*(j.l-Y.l)-(X.l-Y.l)*(j.r-Y.r)<=0)_.pop();else break}_.push(j)}}let B=_.map(F=>F.r),D=_.map(F=>F.l);return{inner:N,outer:E,front:O,top:A,profile:{rs:B,ls:D}}}),M=b.slice();for(let S=0;S<K;S++){if(M[S])continue;let T=-1,N=-1,E=0;for(let G=1;G<=K;G++){let V=(S-G+K*2)%K;if(M[V]){T=V;break}}for(let G=1;G<=K;G++){let V=(S+G)%K;if(M[V]){N=V,E=G;break}}if(T<0||N<0)continue;let O=0;for(let G=1;G<=K;G++){let V=(S-G+K*2)%K;if(b[V]){O=G;break}}if(O-1+E>Ui)continue;let _=g[T],B=g[N],D=O/(O+E),F=_.inner+(B.inner-_.inner)*D,j=_.outer+(B.outer-_.outer)*D,Y=_.front+(B.front-_.front)*D,X=_.top+(B.top-_.top)*D;g[S]={inner:F,outer:j,front:Y,top:X,profile:{rs:[F,j],ls:[Y,X]}}}for(let S=0;S<K;S++)g[S]&&(M[S]=!0);let R=360/K,k=[],L=M.filter(Boolean).length,U=[];if(L===K)U.push({start:0,len:K});else{let S=0;for(;M[S];)S=(S+1)%K;let T=-1;for(let N=0;N<=K;N++){let E=(S+N)%K,O=N<K&&M[E];if(O&&T<0)T=E;else if(!O&&T>=0){let A=(E-T+K)%K||K;U.push({start:T,len:A}),T=-1}}}for(let S of U){if(S.len*R<Yi&&S.len<K)continue;let T=S.len===K,N=new Float64Array(S.len),E=new Float64Array(S.len),O=new Float64Array(S.len),A=new Float64Array(S.len),_=[];for(let G=0;G<S.len;G++){let V=g[(S.start+G)%K];N[G]=V.inner,E[G]=V.outer,O[G]=V.front,A[G]=V.top,_.push(V.profile??{rs:[V.inner,V.outer],ls:[V.front,V.top]})}let B=ut(N,T),D=ut(E,T),F=ut(O,T),j=ut(A,T);for(let G=0;G<S.len;G++)B[G]>N[G]&&(B[G]=N[G]),D[G]<E[G]&&(D[G]=E[G]),B[G]>D[G]-1e-6&&(B[G]=Math.max(0,D[G]-1e-6)),j[G]<F[G]&&(j[G]=F[G]);let Y={startBin:S.start,binCount:S.len,closed:T,innerR:B,outerR:D,frontLevelM:F,topLevelM:j,profiles:_},X=(G,V,H)=>{let $=_[G],Z=$.rs,z=$.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 G=0;G<S.len;G++){let V=f[(S.start+G)%K];if(V)for(let H of V.samples){X(G,H.r,H.levelM);let $=T?(G-1+S.len)%S.len:G-1,Z=T?(G+1)%S.len:G+1;$>=0&&X($,H.r,H.levelM),Z<S.len&&X(Z,H.r,H.levelM)}}k.push(Y)}k.reduce((S,T)=>S+T.binCount*R,0)<Xi||d.push({arcs:k,sectionIds:c.members.map(S=>S.sectionId),innerRMedian:x,outerRMedian:I})}if(!d.length)return null;if(d.sort((c,f)=>c.innerRMedian-f.innerRMedian),t){let c=d[d.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:d}}function uo(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),m=i-s,u=l=>{let d=t.profiles[l],c=d.rs,f=d.ls;if(r<=c[0])return f[0];if(r>=c[c.length-1])return f[f.length-1];for(let b=0;b+1<c.length;b++)if(r<=c[b+1]){let p=c[b+1]-c[b],h=p>1e-9?(r-c[b])/p:0;return f[b]+(f[b+1]-f[b])*h}return f[f.length-1]};return u(s)*(1-m)+u(a)*m}var Ki=.25,zi=1.2,Wi=.6,Zi=.45,$i=2.3,Qi=Math.PI/180;function xe(e,t,n){let r=n*Qi;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function qi(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=r&&s++;if(s>=i.length/2)return!0}return!1}var Ji=24;function es(e,t,n,r,o,i,s,a){let m=n.binCount,u=Ji,l=te,d=i+.02,c=[];for(let v=0;v<m;v++){let S=(n.startBin+v+.5)*t.binStepDeg,T=new Float64Array(u+1);for(let N=0;N<=u;N++){let E=r[v]+(o[v]-r[v])*N/u;T[N]=Math.max(d,uo(t,n,S,E)-Ki)}c.push(T)}let f=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],b=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],p=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],h=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],y=(v,S)=>{let T=(n.startBin+v+.5)*t.binStepDeg,N=r[v]+(o[v]-r[v])*S/u,E=xe(t.centre,N,T);return[E.x*l,c[v][S],E.y*l]};{let v=Math.tan(12*Math.PI/180);for(let S=0;S<6;S++){let T=!1;for(let E=0;E<m;E++)for(let O=u-1;O>=0;O--)c[E][O]>c[E][O+1]&&(c[E][O]=c[E][O+1],T=!0);let N=n.closed?m:m-1;for(let E=0;E<N;E++){let O=(E+1)%m;for(let A=0;A<=u;A++){let _=c[O][A]-c[E][A];if(Math.abs(_)>1)continue;let B=r[E]+(o[E]-r[E])*A/u,D=r[O]+(o[O]-r[O])*A/u,F=xe(t.centre,B,(n.startBin+E+.5)*t.binStepDeg),j=xe(t.centre,D,(n.startBin+O+.5)*t.binStepDeg),Y=v*Math.hypot(j.x-F.x,j.y-F.y)*l;_>Y?(c[O][A]=c[E][A]+Y,T=!0):-_>Y&&(c[E][A]=c[O][A]+Y,T=!0)}}if(!T)break}}let x=1,I=(v,S)=>{for(let T=0;T<=u;T+=4)if(Math.abs(c[v][T]-c[S][T])>x)return!0;return Math.abs(c[v][u]-c[S][u])>x},w=Math.tan(38*Math.PI/180),P=v=>(o[v]-r[v])/u*l,g=(v,S)=>c[v][S+1]-c[v][S]>w*Math.max(1e-6,P(v)),M=(v,S)=>{let T=n.closed?(v-1+m)%m:Math.max(0,v-1),N=n.closed?(v+1)%m:Math.min(m-1,v+1);Math.abs(c[T][S]-c[v][S])>x&&(T=v),Math.abs(c[N][S]-c[v][S])>x&&(N=v);let E=Math.max(0,S-1),O=Math.min(u,S+1);E<S&&g(v,E)&&(E=S),O>S&&g(v,S)&&(O=S);let A=y(T,S),_=y(N,S),B=y(v,E),D=y(v,O),F=_[0]-A[0],j=_[1]-A[1],Y=_[2]-A[2],X=D[0]-B[0],G=D[1]-B[1],V=D[2]-B[2],H=j*V-Y*G,$=Y*X-F*V,Z=F*G-j*X,z=Math.hypot(H,$,Z);return z>1e-12?(H/=z,$/=z,Z/=z,$<0&&(H=-H,$=-$,Z=-Z),[H,$,Z]):[0,1,0]},R=(v,S)=>{let T=[v[0],i,v[2]],N=[S[0],i,S[2]],E=S[0]-v[0],O=S[2]-v[2],A=Math.hypot(E,O);if(!(A>1e-12))return;let _=[O/A,0,-E/A];e.tri(v,S,N,_,p,p,h),e.tri(v,N,T,_,p,h,h)},k=.05*me,L=v=>o[v]-r[v]<k,U=n.closed?m:m-1;for(let v=0;v<U;v++){let S=(v+1)%m;if(L(v)||L(S))continue;if(I(v,S)){let _=(n.startBin+v+1)*t.binStepDeg,B=(G,V)=>{let H=(r[v]+r[S])/2,$=(o[v]+o[S])/2,Z=H+($-H)*V/u,z=xe(t.centre,Z,_);return[z.x*l,c[G][V],z.y*l]};for(let G=0;G<u;G++){let V=y(v,G),H=y(v,G+1),$=B(v,G),Z=B(v,G+1),z=M(v,G),q=M(v,G+1);e.triN(V,$,Z,z,z,q,f),e.triN(V,Z,H,z,q,q,f);let Ue=y(S,G),Ye=y(S,G+1),Me=B(S,G),Ee=B(S,G+1),Se=M(S,G),we=M(S,G+1);e.triN(Me,Ue,Ye,Se,Se,we,f),e.triN(Me,Ye,Ee,Se,we,we,f);let fe=B(v,G),ae=B(v,G+1),Xe=B(S,G+1),ft=B(S,G),Ve=ae[0]-fe[0],Ae=ae[2]-fe[2],mt=Math.hypot(Ve,Ae);if(mt>1e-12){let Dt=[Ae/mt,0,-Ve/mt];e.tri(fe,ae,Xe,Dt,p),e.tri(fe,Xe,ft,Dt,p)}}let D=y(v,0),F=y(S,0),j=y(S,u),Y=y(v,u),X=G=>[G[0],i,G[2]];e.tri(X(D),X(j),X(F),[0,-1,0],b),e.tri(X(D),X(Y),X(j),[0,-1,0],b),R(D,F),R(Y,j);continue}for(let _=0;_<u;_++){let B=M(v,_),D=M(S,_),F=M(S,_+1),j=M(v,_+1);if(g(v,_)||g(S,_)){let H=(ae,Xe)=>{let ft=(n.startBin+ae+.5)*t.binStepDeg,Ve=r[ae]+(o[ae]-r[ae])*(_+.5)/u,Ae=xe(t.centre,Ve,ft);return[Ae.x*l,Xe,Ae.y*l]},$=y(v,_),Z=y(S,_),z=H(v,c[v][_]),q=H(S,c[S][_]);e.triN($,Z,q,B,D,D,f),e.triN($,q,z,B,D,B,f);let Ue=y(S,_+1),Ye=y(v,_+1),Me=H(v,c[v][_+1]),Ee=H(S,c[S][_+1]);e.triN(Me,Ee,Ue,j,F,F,f),e.triN(Me,Ue,Ye,j,F,j,f);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,p),e.tri(z,Ee,Me,ae,p)}continue}let Y=y(v,_),X=y(S,_),G=y(S,_+1),V=y(v,_+1);e.triN(Y,X,G,B,D,F,f),e.triN(Y,G,V,B,F,j,f)}let T=y(v,0),N=y(S,0),E=y(S,u),O=y(v,u),A=_=>[_[0],i,_[2]];e.tri(A(T),A(E),A(N),[0,-1,0],b),e.tri(A(T),A(O),A(E),[0,-1,0],b),R(T,N),R(O,E)}if(!n.closed)for(let v of[0,m-1])for(let S=0;S<u;S++)R(y(v,S),y(v,S+1))}function lo(e,t,n){let{bottomY:r,colors:o,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let d of l.arcs){let c=new Float64Array(d.binCount),f=new Float64Array(d.binCount);for(let p=0;p<d.binCount;p++){let h=(d.startBin+p)%t.binCount,y=Math.max(0,d.innerR[p]-se);c[p]=Math.max(y,s[h]+.001),f[p]=Math.max(c[p]+.001,d.outerR[p]+se)}let b=0;for(let p=0;p<d.binCount;p++){let h=d.topLevelM[p]-r;h>b&&(b=h)}b>=zi&&es(e,t,d,c,f,r,o,i);for(let p=0;p<d.binCount;p++){let h=(d.startBin+p)%t.binCount;f[p]>s[h]&&(s[h]=f[p])}}if(n.deriveShell===!1||qi(n.shapes,t))return;let a=t.rings[t.rings.length-1],m=Wi*me,u=Zi*me;for(let l of a.arcs){let d=[],c=[];for(let p=0;p<l.binCount;p++){let h=(l.startBin+p+.5)*t.binStepDeg,y=l.outerR[p]+se+m;d.push(xe(t.centre,y,h)),c.push(xe(t.centre,y+u,h))}let f=-1/0;for(let p=0;p<l.binCount;p++)l.topLevelM[p]>f&&(f=l.topLevelM[p]);let b=()=>f+$i;l.closed?J(e,c,[d.slice().reverse()],b,r,o.shellTop,o.shellWall,i):J(e,[...c,...d.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,i)}}function fo(e,t,n,r,o,i,s,a){if(!t.outline||t.outline.length<3)return;let m=n.baseHeightM,u=ue(r,a.tierTop);if(!o)return;let l=h=>o.deckAt(h.x,h.y),d=Kn(t,s),c=d[0]??t.outline;if(o.rowLevels.length>=2){let h=it(o.rowLevels),y=zn(jn(o.rowLevels,n.focal,h),d),x=()=>[0,1,0];for(let w of y){let P=Math.max(m,w.topY-.02);for(let g of i.subtract(w.outline,P))J(e,g,w.holes,()=>P,m,u,a.tierWall,Q,void 0,x)}y.length||J(e,c,t.holes,()=>o.landingY,m,u,a.tierWall,Q);let I={tread:[u[0]*Q.top,u[1]*Q.top,u[2]*Q.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let w of d.length?d:[c])Yn(e,o.rowLevels,n.focal,o.landingY,I,w,h);return}let f=o.flat?1/0:Wn,b=h=>o.normalAt(h.x,h.y),p=o.flat?o.landingY:void 0;for(let h of i.subtract(c,p))J(e,h,t.holes,l,m,u,a.tierWall,Q,f,b)}function ts(e,t,n){let r=new Set;for(let s of e.objects)s.type==="section"&&r.add(s.id);let o=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!r.has(a))continue;let m=n.bySection.get(a);if(m&&m.rowLevels.length>=2)continue;let u=t[s],l=o.get(a);l||(l=new Map,o.set(a,l));let d=u.rowId||`__seat-${s}`,c=l.get(d);c||(c={pts:[],levelM:0,n:0},l.set(d,c)),c.pts.push({x:u.x,y:u.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 u=a.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:s.id,rows:u});continue}let m=o.get(s.id);m&&i.push({sectionId:s.id,rows:[...m.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function mo(e,t,n,r,o,i,s=!0){let a=ts(t,n,r);if(!a.length)return;let m=co(a,t.focal);m&&(e.setMaterial(0),lo(e,m,{bottomY:t.baseHeightM,colors:{bandTop:ie(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ie(o.tierWall,1.15),shellWall:i??o.tierWall},ao:Q,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:s}))}var bo=/^[\p{L}\p{N}]{1,4}$/u,ns=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function po(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let s=e.slice(n.length).trim();if(bo.test(s))return s}let i=ns.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((o.startsWith(s)||s.startsWith(o))&&bo.test(a))return a}return e}var os=6,rs=2.2,ho=.1,is=.3,ss=1.8,as=.9,cs=.55,us=6e3;function yo(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,s=t.zones??[],a=[];if(s.length){let m=new Map;for(let l of n)for(let d of l.objects)d.type==="section"&&d.zone&&m.set(d.id,d.zone);let u=new Map;for(let l=0;l<r.length;l++){let d=r[l],c=o.seatOwner[l],f=d.zoneId??(c?m.get(c):void 0);if(!f)continue;let b=u.get(f);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(f,b)),b.n++,d.x<b.minX&&(b.minX=d.x),d.y<b.minY&&(b.minY=d.y),d.x>b.maxX&&(b.maxX=d.x),d.y>b.maxY&&(b.maxY=d.y),b.sumY+=o.seatDeckY(l)}for(let l of s){let d=u.get(l.id),c=[];for(let[f,b]of m)b===l.id&&c.push(f);if(!d||d.n===0){a.push({id:l.id,label:l.label,color:W(l.color),sectionIds:c,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??i).x*C,1.5,(l.focalPoint??i).y*C]});continue}a.push({id:l.id,label:l.label,color:W(l.color),sectionIds:c,seatCount:d.n,center:[(d.minX+d.maxX)/2*C,d.sumY/d.n,(d.minY+d.maxY)/2*C],radius:.5*Math.hypot((d.maxX-d.minX)*C,(d.maxY-d.minY)*C)||1,focalWorld:[(l.focalPoint??i).x*C,1.5,(l.focalPoint??i).y*C]})}}return a}function go(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:s,zones:a,focal:m}=e,u=[],l=[],d=[];for(let c of a)c.seatCount!==0&&u.push({id:`zone:${c.id}`,kind:"zone",text:c.label,anchor:[c.center[0],c.center[1]+os,c.center[2]],color:t.zones?.find(f=>f.id===c.id)?.color});{let c=new Map,f=new Map;for(let b=0;b<r.length;b++){let p=o.seatOwner[b];if(!p)continue;let h=c.get(p);h||(h={n:0,x:0,y:0,deck:0},c.set(p,h)),h.n++,h.x+=r[b].x,h.y+=r[b].y,h.deck+=o.seatDeckY(b);let y=f.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(p,y)),r[b].x<y.minX&&(y.minX=r[b].x),r[b].x>y.maxX&&(y.maxX=r[b].x),r[b].y<y.minY&&(y.minY=r[b].y),r[b].y>y.maxY&&(y.maxY=r[b].y)}for(let b of n)for(let p of b.objects){if(p.type!=="section")continue;let h=c.get(p.id);if(!h||h.n===0)continue;let y=f.get(p.id),x=[h.x/h.n*C,h.deck/h.n,h.y/h.n*C],I=p.displayLabel||p.label||p.id;l.push({id:p.id,floorIndex:b.index,label:I,seatCount:h.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*C),focalWorld:[b.focal.x*C,b.baseHeightM+1.5,b.focal.y*C]});let w=t.floors?.[b.index]?.name?.trim().toLocaleLowerCase();n.length>1&&w===I.trim().toLocaleLowerCase()||u.push({id:`section:${p.id}`,kind:"section",text:I,anchor:[x[0],x[1]+rs,x[2]],floorIndex:b.index})}}{for(let p of n)for(let h of p.objects){if(h.type!=="gaArea")continue;let y=_e(h.points);if(!y)continue;let x=h.displayLabel||h.label||h.id;u.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${x} \xB7 ${h.capacity.toLocaleString()}`:x,anchor:[y.x*C,p.baseHeightM+ss,y.y*C],floorIndex:p.index})}let c=new Map;for(let p of n)for(let h of p.objects)h.type==="section"&&c.set(h.id,h.displayLabel||h.label||h.id);let f=new Map;for(let p=0;p<r.length;p++){let h=r[p],y=Math.hypot(h.x-m.x,h.y-m.y),x=f.get(h.rowId);(!x||y>x.far)&&f.set(h.rowId,{seat:h,index:p,far:y})}for(let[p,h]of f){let y=fs(h.seat.label,p,c.get(h.seat.sectionId??""));y&&u.push({id:`row:${p}`,kind:"row",text:y,anchor:[h.seat.x*C,o.seatDeckY(h.index)+as,h.seat.y*C],floorIndex:s[h.index]})}let b=new Map;for(let p=0;p<r.length;p++){let h=r[p],y=h.label?h.label.lastIndexOf("-"):-1,x=b.get(h.rowId);x||(x={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},b.set(h.rowId,x));let I=p*3,w=i.iPosition[I],P=i.iPosition[I+1],g=i.iPosition[I+2];x.n++,x.x+=w,x.y+=P,x.z+=g,x.minX=Math.min(x.minX,w),x.maxX=Math.max(x.maxX,w),x.minZ=Math.min(x.minZ,g),x.maxZ=Math.max(x.maxZ,g)}for(let[p,h]of b)d.push({id:p,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=us)for(let p=0;p<r.length;p++){let h=r[p],y=ls(h.displayLabel||h.label);y&&u.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*C,o.seatDeckY(p)+cs,h.y*C],floorIndex:s[p]})}}for(let c of n)for(let f of c.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let b=ge(f),p=b?_e(b):null;if(!p||!f.label)continue;u.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[p.x*C,c.baseHeightM+Ne(f).heightM+ho,p.y*C],color:f.fill,floorIndex:c.index})}else if(f.type==="text"){if(!f.text)continue;u.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*C,c.baseHeightM+ho,f.position.y*C],color:f.color,rotation:f.rotation,floorIndex:c.index})}else if(f.type==="booth"){let b=je(f);if(!b)continue;let p=_e(b);if(!p)continue;u.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[p.x*C,c.baseHeightM+Lt+is,p.y*C],floorIndex:c.index})}return{labels:u,sections:l,rows:d}}function xo(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 ls(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function fs(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&po(o,n)}function Mo(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:s,seatFloor:a}=e,m=[];{let u=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 f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[c]))),b=c*3,p=u[f];p.minX=Math.min(p.minX,i.position[b]),p.minY=Math.min(p.minY,i.position[b+1]),p.minZ=Math.min(p.minZ,i.position[b+2]),p.maxX=Math.max(p.maxX,i.position[b]),p.maxY=Math.max(p.maxY,i.position[b+1]),p.maxZ=Math.max(p.maxZ,i.position[b+2])}let l=new Map;for(let c=0;c<n.length;c++)for(let f of n[c].objects)f.type==="section"&&l.set(f.id,c);let d=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let c=0;c<r.length;c++){let f=o.seatOwner[c],b=(f!==null?l.get(f):void 0)??s[c];if(b===void 0)continue;let p=d[b],h=r[c];p.n++,h.x<p.minX&&(p.minX=h.x),h.y<p.minY&&(p.minY=h.y),h.x>p.maxX&&(p.maxX=h.x),h.y>p.maxY&&(p.maxY=h.y);let y=o.seatDeckY(c);p.sumX+=h.x*C,p.sumDeck+=y,p.sumZ+=h.y*C,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),a[c]=b}for(let c=0;c<n.length;c++){let f=d[c],b=t.floors?.[c],p=u[c],h=Math.min(f.n?f.minX*C:n[c].focal.x*C-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(f.n?f.maxX*C:n[c].focal.x*C+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(f.n?f.minY*C:n[c].focal.y*C-1,Number.isFinite(p.minZ)?p.minZ:1/0),I=Math.max(f.n?f.maxY*C:n[c].focal.y*C+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(f.n?Math.min(n[c].baseHeightM,f.minDeck):n[c].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),P=Math.max(f.n?Math.max(f.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),g=[f.n?f.sumX/f.n:(h+y)/2,f.n?f.sumDeck/f.n:(w+P)/2,f.n?f.sumZ/f.n:(x+I)/2],M=Math.max(1,.5*Math.hypot(y-h,P-w,I-x));m.push({index:c,id:b?.id??`floor-${c}`,label:b?.name??(n.length>1?`Floor ${c+1}`:"Venue"),seatCount:f.n,center:g,radius:M,box:{min:[h,w,x],max:[y,P,I]},focalWorld:[n[c].focal.x*C,n[c].baseHeightM+1.5,n[c].focal.y*C]})}}return m}function Ft(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,s=(a,m)=>{a<n&&(n=a),m<r&&(r=m),a>o&&(o=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 u of m.outline)s(u.x,u.y);else if(m.type==="shape"&&m.points)for(let u of m.points)s(u.x,u.y);else if(m.type==="gaArea")for(let u of m.points)s(u.x,u.y);else if(m.type==="booth"){let u=je(m);if(u)for(let l of u)s(l.x,l.y)}else if(m.type==="table"){let u=Ot(m);if(u)for(let l of u)s(l.x,l.y)}else if(m.type==="decorImage"){let u=Bt(m);if(u)for(let l of u)s(l.x,l.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function So(e,t,n,r,o,i){if(t.length===1){let s=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),a=De(o.minX-s,o.minY-s,o.maxX-o.minX+s*2,o.maxY-o.minY+s*2);J(e,a,void 0,()=>0,-.4,i.ground,i.ground,Q)}else{let s=t.reduce((f,b)=>b.baseHeightM<f.baseHeightM?b:f);e.setFloor(s.index);let a=n.filter((f,b)=>r[b]===s.index),m=Ft([s],a),u=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),l=Math.max(28,Math.min(80,u*.04)),d=De(m.minX-l,m.minY-l,m.maxX-m.minX+l*2,m.maxY-m.minY+l*2),c=s.baseHeightM-.03;J(e,d,void 0,()=>c,c-.22,i.ground,i.ground,Q)}}function wo(e,t,n){let{cx:r,cz:o,radius:i}=n,s=1/0,a=1/0,m=1/0,u=-1/0,l=-1/0,d=-1/0,c=(p,h,y)=>{s=Math.min(s,p),u=Math.max(u,p),a=Math.min(a,h),l=Math.max(l,h),m=Math.min(m,y),d=Math.max(d,y)};for(let p=0;p<e.position.length;p+=3)c(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let h=p*3,y=t.iPosition[h],x=t.iPosition[h+1],I=t.iPosition[h+2],w=Math.max(.35,t.iMaxRadius[p]??.35);c(y-w,x,I-w),c(y+w,x+1.6,I+w)}Number.isFinite(s)||(s=r-i,u=r+i,a=0,l=i*.16,m=o-i,d=o+i);let f=[(s+u)/2,(a+l)/2,(m+d)/2],b=Math.max(1,.5*Math.hypot(u-s,l-a,d-m));return{center:f,radius:b,minY:a,maxY:l}}function Io(e,t,n,r,o,i){let s=1/0,a=1/0,m=-1/0,u=-1/0;for(let w=0;w<e.count;w++){let P=w*3,g=e.iPosition[P],M=e.iPosition[P+2];g<s&&(s=g),g>m&&(m=g),M<a&&(a=M),M>u&&(u=M)}for(let w of t)s=Math.min(s,w.cx-w.halfX),m=Math.max(m,w.cx+w.halfX),a=Math.min(a,w.cz-w.halfZ),u=Math.max(u,w.cz+w.halfZ);let l=n.minX*C,d=n.maxX*C,c=n.minY*C,f=n.maxY*C,b=l,p=d,h=c,y=f;if(Number.isFinite(s)){let w=Math.max(2,.06*Math.hypot(m-s,u-a));b=Math.max(l,s-w),p=Math.min(d,m+w),h=Math.max(c,a-w),y=Math.min(f,u+w)}let x=Math.min(0,r),I=Math.max(o,i*.05);return{min:[b,x,h],max:[p,I,y]}}function vo(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Qt(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let d of n)for(let c of d.objects)c.type==="shape"&&i.set(c.id,{shape:c,unit:d});let s=new Set,a=new Set,m=new Map((t.overlay.productionElements??[]).map(d=>{let c=d.runtimeContentImageUrl;return[d.id,typeof c=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(c)?c:void 0]})),u=[];for(let d of o.value.overlay.productionElements??[]){let c=i.get(d.objectId),f=c?ge(c.shape):null,b=d.baseElevationM??0;if(!c||!f||f.length<3||!d.id||s.has(d.id)||a.has(d.objectId)||!Number.isFinite(d.heightM)||d.heightM<.05||d.heightM>50||!Number.isFinite(b)||b<-10||b>100)return r();s.add(d.id),a.add(d.objectId);let p=f.map(R=>R.x*C),h=f.map(R=>R.y*C),y=c.unit.baseHeightM+b,x=Math.min(...p),I=Math.max(...p),w=Math.min(...h),P=Math.max(...h),g,M=m.get(d.id)??d.contentImageUrl;if(d.kind==="screen"&&M)if(I-x>=P-w){let R=Math.abs(w-c.unit.focal.y*C)<=Math.abs(P-c.unit.focal.y*C)?w-.006:P+.006;g=[[x,y,R],[I,y,R],[x,y+d.heightM,R],[I,y+d.heightM,R]]}else{let R=Math.abs(x-c.unit.focal.x*C)<=Math.abs(I-c.unit.focal.x*C)?x-.006:I+.006;g=[[R,y,w],[R,y,P],[R,y+d.heightM,w],[R,y+d.heightM,P]]}u.push({id:d.id,objectId:d.objectId,kind:d.kind,floorIndex:c.unit.index,baseY:y,topY:y+d.heightM,bounds:{min:[x,y,w],max:[I,y+d.heightM,P]},occlusion:d.occlusion,...M?{contentImageUrl:M}:{},...g?{contentPlane:g}:{}})}let l=u.sort((d,c)=>d.id.localeCompare(c.id));return{byObjectId:new Map(l.map(d=>[d.objectId,d])),elements:l}}function re(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oe(e){return Array.isArray(e)?e:[]}function ms(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!re(n))continue;let r=re(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function lt(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function ds(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function bs(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function ps(e){let t=lt(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:lt(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:lt(e.rotation,4),o=e.scale===void 0?[1,1,1]:lt(e.scale,3);if(!n||!r||!o)return null;let[i,s,a,m]=r,u=Math.hypot(i,s,a,m);if(!(u>1e-8))return null;let l=i/u,d=s/u,c=a/u,f=m/u,b=l+l,p=d+d,h=c+c,y=l*b,x=l*p,I=l*h,w=d*p,P=d*h,g=c*h,M=f*b,R=f*p,k=f*h;return[(1-(w+g))*o[0],(x+k)*o[0],(I-R)*o[0],0,(x-k)*o[1],(1-(y+g))*o[1],(P+M)*o[1],0,(I+R)*o[2],(P-M)*o[2],(1-(y+w))*o[2],0,n[0],n[1],n[2],1]}function hs(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function ys(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],s=e[9],a=e[2],m=e[6],u=e[10],l=i*u-s*m,d=s*a-o*u,c=o*m-i*a,f=t*l+n*d+r*c;if(Math.abs(f)<1e-12)return null;let b=1/f;return[l*b,d*b,c*b,(r*m-n*u)*b,(t*u-r*a)*b,(n*a-t*m)*b,(n*s-r*i)*b,(r*o-t*s)*b,(t*i-n*o)*b]}function Ro(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,s=e[6]*t+e[7]*n+e[8]*r,a=Math.hypot(o,i,s)||1;return o/=a,i/=a,s/=a,[o,i,s]}function gs(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),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&&!r)try{let m=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!re(m))return null;r=m}catch{return null}else if(s===5130562&&!o)o=a;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function xs(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Ms(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Ss(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 ws(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=gs(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!re(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=oe(r.extensionsUsed).filter(w=>typeof w=="string");if(i.includes("KHR_draco_mesh_compression")||ms(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||oe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(oe(r.images).length||oe(r.textures).length)return{ok:!1,issue:"external_resource"};let s=oe(r.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>o.byteLength)return{ok:!1,issue:"external_resource"};let a=oe(r.accessors),m=oe(r.bufferViews),u=oe(r.meshes),l=oe(r.nodes),d=oe(r.scenes),c=typeof r.scene=="number"?r.scene:0;if(!re(d[c]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(w,P,g)=>{if(typeof w!="number"||!Number.isInteger(w)||!re(a[w]))return null;let M=a[w];if(M.type!==P||M.sparse!==void 0||M.normalized===!0||typeof M.count!="number"||!Number.isInteger(M.count)||M.count<1||typeof M.componentType!="number"||!g.includes(M.componentType)||typeof M.bufferView!="number")return null;let R=m[M.bufferView];if(!re(R)||R.buffer!==0||typeof R.byteLength!="number"||!Number.isInteger(R.byteLength)||R.byteLength<0)return null;let k=Ms(M.type),L=xs(M.componentType),U=typeof R.byteStride=="number"?R.byteStride:k*L,v=typeof R.byteOffset=="number"?R.byteOffset:0,S=typeof M.byteOffset=="number"?M.byteOffset:0,T=v+S,N=S+(M.count-1)*U+k*L;if(!Number.isInteger(U)||!Number.isInteger(v)||!Number.isInteger(S)||U<k*L||v<0||S<0||v+R.byteLength>o.byteLength||N>R.byteLength)return null;let E=[];for(let O=0;O<M.count;O++){let A=[];for(let _=0;_<k;_++){let B=Ss(f,T+O*U+_*L,M.componentType);if(!Number.isFinite(B))return null;A.push(B)}E.push(A)}return E},p=[],h=[],y=0,x=new Set,I=(w,P)=>{if(typeof w!="number"||!Number.isInteger(w)||!re(l[w])||x.has(w))return!1;x.add(w);let g=l[w],M=ps(g);if(!M)return!1;let R=bs(P,M),k=ys(R);if(!k)return!1;if(g.mesh!==void 0){if(typeof g.mesh!="number")return!1;let L=u[g.mesh];if(!re(L))return!1;for(let U of oe(L.primitives)){if(!re(U)||U.mode!==void 0&&U.mode!==4||!re(U.attributes))return!1;let v=b(U.attributes.POSITION,"VEC3",[5126]),S=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!v||U.attributes.NORMAL!==void 0&&!S)return!1;let T=v.length;if(U.indices!==void 0){let E=typeof U.indices=="number"?a[U.indices]:null;T=re(E)?E.count:void 0}if(typeof T!="number"||!Number.isInteger(T)||T%3!==0||(y+=T/3,y>1e5))return!1;let N=U.indices===void 0?v.map((E,O)=>[O]):b(U.indices,"SCALAR",[5121,5123,5125]);if(!N||N.length%3!==0||N.length!==T)return!1;for(let E=0;E<N.length;E+=3){let O=[N[E][0],N[E+1][0],N[E+2][0]];if(O.some(B=>!Number.isInteger(B)||B<0||B>=v.length))return!1;let A=O.map(B=>hs(R,...v[B])),_=null;if(!S){let B=A[1][0]-A[0][0],D=A[1][1]-A[0][1],F=A[1][2]-A[0][2],j=A[2][0]-A[0][0],Y=A[2][1]-A[0][1],X=A[2][2]-A[0][2];_=Ro([1,0,0,0,1,0,0,0,1],D*X-F*Y,F*j-B*X,B*Y-D*j)}for(let B=0;B<3;B++)p.push(...A[B]),h.push(...S?Ro(k,...S[O[B]]):_)}}}for(let L of oe(g.children))if(!I(L,R))return!1;return x.delete(w),!0};for(let w of oe(d[c].nodes))if(!I(w,ds()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||h.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(h)}}function Po(e){try{return ws(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Co(e){let{doc:t}=e,n=pn(t.theme),r=n.structure,o=Hn(t,e.eventConfigurationId??t.eventConfigurationId),i=vo(e.eventConfigurationId,e.eventConfiguration,o),s=e.seats,a=new et,m=null;if(e.registeredShellGlb){let E=Po(e.registeredShellGlb);if(E.ok){let O=E.position.length/3,A=new Float32Array(E.position.length),_=n.materials.shell??r.tierWall;for(let B=0;B<O;B++){let D=E.normal[B*3+1],F=D<-.25?.4:.62+.38*Math.max(0,D);A[B*3]=_[0]*F,A[B*3+1]=_[1]*F,A[B*3+2]=_[2]*F}m={position:E.position,normal:E.normal,color:A,floor:new Float32Array(O).fill(-2),material:new Float32Array(O),count:O}}}let u=new Map;for(let E of o)for(let O of E.objects)u.set(O.id,E.index),O.type==="section"&&u.set(O.logicalSectionId??O.id,E.index);let l=s.map(E=>u.get(E.sectionId??"")??u.get(E.rowId??"")??0),d=Ft(o,s);So(a,o,s,l,d,r);let c=$n(t,s),f=new Map,b=new Map;for(let E of t.categories??[])f.set(E.key,E.color),E.seatGlyph&&b.set(E.key,E.seatGlyph);let p=[],h=Zn(o,s,l),y=new Float32Array(s.length),x=[];for(let E=0;E<o.length;E++){let O=o[E];a.setFloor(E);let A=new at,_=[],B=O.objects.filter(D=>D.type==="section"&&!!D.outline&&D.outline.length>=3);for(let D of O.objects)if(D.type==="section"){let F=a.vertexCount;fo(a,D,O,Qn(D,c),h.bySection.get(D.id),A,B,r);let j=a.vertexCount-F;j>0&&x.push({sectionId:D.id,start:F,count:j})}else if(D.type==="shape"){let F=i.byObjectId.get(D.id);a.setMaterial((F?.kind??D.role)==="screen"?1:0),ro(a,D,O.baseHeightM,Jn(D,_),r,O.focal,p,F),a.setMaterial(0)}else D.type==="gaArea"?so(a,D,O.baseHeightM,W(f.get(D.categoryKey)),r):D.type==="booth"?no(a,D,O.baseHeightM,W(f.get(D.categoryKey)),r):D.type==="table"?oo(a,D,O.baseHeightM,W(D.fill??t.theme?.decorFill??"#232c40"),r):D.type==="decorImage"&&io(a,D,O.baseHeightM,r);mo(a,O,s,h,r,n.materials.shell,!m)}let I=o.length>1?{x:o.reduce((E,O)=>E+O.focal.x,0)/o.length,y:o.reduce((E,O)=>E+O.focal.y,0)/o.length}:t.focalPoint??{x:(d.minX+d.maxX)/2,y:(d.minY+d.maxY)/2},w=Mn(m?[a.build(),m]:[a.build()]),P=An(s,e.initialState,h,y,f,b),g=yo({doc:t,units:o,seats:s,surfaces:h,focal:I}),{labels:M,sections:R,rows:k}=go({doc:t,units:o,seats:s,surfaces:h,seatData:P,hintedSeatFloor:l,zones:g,focal:I}),L=Mo({doc:t,units:o,seats:s,surfaces:h,solids:w,hintedSeatFloor:l,seatFloor:y});xo(M,L),P.iYaw=En(P.iPosition,s.length,E=>s[E].rowId,E=>{let O=o[y[E]]?.focal??I;return[O.x*C,O.y*C]});let U=(d.minX+d.maxX)/2*C,v=(d.minY+d.maxY)/2*C,S=.5*Math.hypot((d.maxX-d.minX)*C,(d.maxY-d.minY)*C)||10,T=wo(w,P,{cx:U,cz:v,radius:S}),N=Io(P,p,d,T.minY,T.maxY,S);return{solids:w,sectionSolidRanges:x,seats:P,bounds:{center:[(N.min[0]+N.max[0])/2,(N.min[1]+N.max[1])/2,(N.min[2]+N.max[2])/2],radius:S,groundY:0,box:N},renderBounds:{center:T.center,radius:T.radius},stateColorLUT:hn(n,Qe),theme:n,seatCount:s.length,focalWorld:[I.x*C,1.5,I.y*C],zones:g,stages:p,productionElements:i.elements,sections:R,rows:k,labels:M,floors:L}}function Is(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 Eo=self;Eo.onmessage=e=>{let t=performance.now(),n=!e.data.seats,r=e.data.seats??fn(e.data.doc),o=Co({doc:e.data.doc,seats:r,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});Eo.postMessage({model:o,buildMs:performance.now()-t,...n?{seats:r}:{}},Is(o))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as n}from"../../chunk-
|
|
1
|
+
import{x as n}from"../../chunk-ZFWHAKAI.js";import"../../chunk-U7CVRE4P.js";import"../../chunk-QJXSZT3H.js";import"../../chunk-M5X6G7FD.js";import"../../chunk-4I2VWFJY.js";import"../../chunk-4N5CHKHD.js";import{Sa as o}from"../../chunk-F7TP67LK.js";import"../../chunk-5ITK5236.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))};
|