@seatlayer/core 0.74.0 → 0.75.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +3 -2
  2. package/dist/ar-JOSU54ZZ.js +1 -0
  3. package/dist/be-UDIVAZGH.js +1 -0
  4. package/dist/bg-AJX2SNK4.js +1 -0
  5. package/dist/ca-MC23KMQH.js +1 -0
  6. package/dist/{categoryInventory-DueSAIBX.d.cts → categoryInventory-CBuJy9KM.d.cts} +1 -1
  7. package/dist/{categoryInventory-Bcmnr6ZH.d.ts → categoryInventory-Cy5pQ0KW.d.ts} +1 -1
  8. package/dist/chunk-24O23MNB.js +1 -0
  9. package/dist/chunk-BT2KJXQC.js +1 -0
  10. package/dist/{chunk-3L4M7L5I.js → chunk-BXU5D2Q5.js} +1 -1
  11. package/dist/chunk-FGMGDTMR.js +1 -0
  12. package/dist/chunk-JQL77POQ.js +1 -0
  13. package/dist/{chunk-ZMYRXJOA.js → chunk-NQZAZFAC.js} +1 -1
  14. package/dist/{chunk-JLYR66MT.js → chunk-O5UH442K.js} +1 -1
  15. package/dist/{chunk-N5NRM4NW.js → chunk-PRED5KHO.js} +1 -1
  16. package/dist/{chunk-UX67GDLV.js → chunk-Q3U3F4YJ.js} +1 -1
  17. package/dist/chunk-SPM2LMKI.js +1 -0
  18. package/dist/{chunk-BAWUBGWY.js → chunk-WXGW2SYC.js} +1 -1
  19. package/dist/{chunk-FMZ6HLDH.js → chunk-XD2P4ZS4.js} +1 -1
  20. package/dist/core/chart-ops/index.cjs +1 -1
  21. package/dist/core/chart-ops/index.d.cts +7 -5
  22. package/dist/core/chart-ops/index.d.ts +7 -5
  23. package/dist/core/chart-ops/index.js +1 -1
  24. package/dist/core/inventory/index.cjs +1 -1
  25. package/dist/core/inventory/index.d.cts +4 -4
  26. package/dist/core/inventory/index.d.ts +4 -4
  27. package/dist/core/inventory/index.js +1 -1
  28. package/dist/core/layout/index.cjs +1 -1
  29. package/dist/core/layout/index.d.cts +5 -5
  30. package/dist/core/layout/index.d.ts +5 -5
  31. package/dist/core/layout/index.js +1 -1
  32. package/dist/core/quality/index.cjs +1 -1
  33. package/dist/core/quality/index.d.cts +18 -14
  34. package/dist/core/quality/index.d.ts +18 -14
  35. package/dist/core/quality/index.js +1 -1
  36. package/dist/core/render-assets/index.d.cts +1 -1
  37. package/dist/core/render-assets/index.d.ts +1 -1
  38. package/dist/core/seatConfidence.d.cts +1 -1
  39. package/dist/core/seatConfidence.d.ts +1 -1
  40. package/dist/core/sections/index.cjs +1 -1
  41. package/dist/core/sections/index.d.cts +5 -5
  42. package/dist/core/sections/index.d.ts +5 -5
  43. package/dist/core/sections/index.js +1 -1
  44. package/dist/cs-Q4OEV3NE.js +1 -0
  45. package/dist/cy-TPDRMPTK.js +1 -0
  46. package/dist/da-U6XXTCII.js +1 -0
  47. package/dist/de-ZV54ZWHR.js +1 -0
  48. package/dist/el-5VQKNNQV.js +1 -0
  49. package/dist/es-Y3BNIAEW.js +1 -0
  50. package/dist/et-HCCA6TE3.js +1 -0
  51. package/dist/{eventConfigurations-DwXdrjqj.d.cts → eventConfigurations-CqfrYWAb.d.cts} +1 -1
  52. package/dist/{eventConfigurations-C7YAqkFR.d.ts → eventConfigurations-Dhauc9V3.d.ts} +1 -1
  53. package/dist/fa-SZ3EAODM.js +1 -0
  54. package/dist/fi-S34TMT35.js +1 -0
  55. package/dist/fr-RQIXNHQ5.js +1 -0
  56. package/dist/he-PPNABESI.js +1 -0
  57. package/dist/hr-IZOGRWC5.js +1 -0
  58. package/dist/hu-K7EOGFAB.js +1 -0
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.d.cts +152 -18
  61. package/dist/index.d.ts +152 -18
  62. package/dist/index.js +1 -1
  63. package/dist/it-PD5WJDNR.js +1 -0
  64. package/dist/ja-3CFZ2KK6.js +1 -0
  65. package/dist/ku-MQJTRLDV.js +1 -0
  66. package/dist/{labeling-iugoy25P.d.cts → labeling-B1xsmowB.d.cts} +1 -1
  67. package/dist/{labeling-BUCj-kHU.d.ts → labeling-BwPEI5JN.d.ts} +1 -1
  68. package/dist/localeLoaders-ETY2H7H3.js +1 -0
  69. package/dist/lt-6Q5DJHXR.js +1 -0
  70. package/dist/lv-BQ3LWGW6.js +1 -0
  71. package/dist/nl-ZPVH2YGT.js +1 -0
  72. package/dist/no-R7I6YW7N.js +1 -0
  73. package/dist/openPanorama-6FMXAJ6O.js +20 -0
  74. package/dist/pl-EU2O5DYI.js +1 -0
  75. package/dist/pt-UMSFOY5P.js +1 -0
  76. package/dist/{renderedQuality-CSHrmnHf.d.cts → renderedQuality-1E9KuJvY.d.cts} +1 -1
  77. package/dist/{renderedQuality-CfonzUpl.d.ts → renderedQuality-ChAZNV2N.d.ts} +1 -1
  78. package/dist/{renderer-Dn4Plcv9.d.cts → renderer-BRmVrITG.d.cts} +17 -1
  79. package/dist/{renderer-C5avrVLy.d.ts → renderer-q7viZLGZ.d.ts} +17 -1
  80. package/dist/ro-GR35LU2L.js +1 -0
  81. package/dist/ru-CXYAZQEV.js +1 -0
  82. package/dist/{sections-uV7vqDHj.d.ts → sections-ByTMouG8.d.ts} +1 -1
  83. package/dist/{sections-DhJ7TukF.d.cts → sections-CA-bBex5.d.cts} +1 -1
  84. package/dist/{segmentedRowModel-DWOjcPrU.d.cts → segmentedRowModel-C7XOEjHk.d.cts} +1 -1
  85. package/dist/{segmentedRowModel-DgSEzAYd.d.ts → segmentedRowModel-DcvJVKLD.d.ts} +1 -1
  86. package/dist/sk-GUB52YMC.js +1 -0
  87. package/dist/sl-J7N6LDON.js +1 -0
  88. package/dist/sr-A7GQEH7K.js +1 -0
  89. package/dist/sv-ARLHHSPZ.js +1 -0
  90. package/dist/{layout-DPJX6D9k.d.cts → tableSizing-BdCyNeqX.d.cts} +23 -4
  91. package/dist/{layout-Dv3R0Mpw.d.ts → tableSizing-D8e8QAJ-.d.ts} +23 -4
  92. package/dist/{ticketRestrictions-JT87K45q.d.cts → ticketRestrictions-CPZglNvw.d.cts} +2 -2
  93. package/dist/{ticketRestrictions-DIh61MqE.d.ts → ticketRestrictions-CorjMY49.d.ts} +2 -2
  94. package/dist/tr-6TE3U7WM.js +1 -0
  95. package/dist/{types-Dx4jA8aI.d.cts → types-CqaNLbU6.d.cts} +25 -4
  96. package/dist/{types-Dx4jA8aI.d.ts → types-CqaNLbU6.d.ts} +25 -4
  97. package/dist/uk-RMVPSRMH.js +1 -0
  98. package/dist/view3d/crossfade/panorama.cjs +1 -1
  99. package/dist/view3d/crossfade/panorama.d.cts +20 -2
  100. package/dist/view3d/crossfade/panorama.d.ts +20 -2
  101. package/dist/view3d/crossfade/panorama.js +1 -1
  102. package/dist/view3d/index.cjs +31 -31
  103. package/dist/view3d/index.d.cts +30 -3
  104. package/dist/view3d/index.d.ts +30 -3
  105. package/dist/view3d/index.js +25 -25
  106. package/dist/view3d/scene/scene.worker.cjs +1 -1
  107. package/dist/view3d/scene/scene.worker.js +1 -1
  108. package/dist/zh-Hans-SNO4DA32.js +1 -0
  109. package/dist/zh-Hant-TVIKBD5S.js +1 -0
  110. package/package.json +2 -2
  111. package/dist/ar-JP4VPYJ2.js +0 -1
  112. package/dist/be-ROTFZNMH.js +0 -1
  113. package/dist/bg-YMQ3B5NS.js +0 -1
  114. package/dist/ca-L2OMCHWL.js +0 -1
  115. package/dist/chunk-52MZJZMW.js +0 -1
  116. package/dist/chunk-5JB4VW6B.js +0 -1
  117. package/dist/chunk-6TIKEDC4.js +0 -1
  118. package/dist/chunk-BLPBTW6I.js +0 -1
  119. package/dist/chunk-KN7GLEAI.js +0 -1
  120. package/dist/chunk-YFV4DSSX.js +0 -1
  121. package/dist/cs-CHBOZAYY.js +0 -1
  122. package/dist/cy-ZIVBYZBX.js +0 -1
  123. package/dist/da-PUY5IIER.js +0 -1
  124. package/dist/de-ILFIEU77.js +0 -1
  125. package/dist/el-5EG3QS5T.js +0 -1
  126. package/dist/es-YXZQB5VZ.js +0 -1
  127. package/dist/et-FZIUC4FC.js +0 -1
  128. package/dist/fa-KKBNUDRE.js +0 -1
  129. package/dist/fi-B6JSP5Z5.js +0 -1
  130. package/dist/fr-T5LHFRKG.js +0 -1
  131. package/dist/he-JF4HU75D.js +0 -1
  132. package/dist/hr-S5OXZ3NI.js +0 -1
  133. package/dist/hu-ZZDYG6ZF.js +0 -1
  134. package/dist/it-A5VCFTQP.js +0 -1
  135. package/dist/ja-PAJD5HFJ.js +0 -1
  136. package/dist/ku-KV2AIB6I.js +0 -1
  137. package/dist/localeLoaders-VULFUGJH.js +0 -1
  138. package/dist/lt-OSFNYQ2L.js +0 -1
  139. package/dist/lv-5INNWEN5.js +0 -1
  140. package/dist/nl-YOLY3DXM.js +0 -1
  141. package/dist/no-C5MG5NPH.js +0 -1
  142. package/dist/openPanorama-HGRYMWKC.js +0 -20
  143. package/dist/pl-ERGM2HA3.js +0 -1
  144. package/dist/pt-S6SBTHES.js +0 -1
  145. package/dist/ro-NQ4LIATX.js +0 -1
  146. package/dist/ru-ICFP6U3S.js +0 -1
  147. package/dist/sk-VYH6WIZ2.js +0 -1
  148. package/dist/sl-AA54VE5P.js +0 -1
  149. package/dist/sr-Z27ZL5ZE.js +0 -1
  150. package/dist/sv-BT4MNMB5.js +0 -1
  151. package/dist/tr-3TSE3BBR.js +0 -1
  152. package/dist/uk-YD2PBENU.js +0 -1
  153. package/dist/zh-Hans-VPQE6LWU.js +0 -1
  154. package/dist/zh-Hant-PUKPX45I.js +0 -1
@@ -0,0 +1 @@
1
+ import{c as Fe}from"./chunk-BT2KJXQC.js";import{a as Ke,c as Be,f as be,g as ze,l as Ue,t as pe,v as Ge}from"./chunk-XD2P4ZS4.js";import{h as Qe,q as He,s as Xe,t as Ye,u as he,y as ve}from"./chunk-QLDV5ZGA.js";import{a as ge,b as me,d as Pe,f as Ne,i as ne}from"./chunk-Q3U3F4YJ.js";import{c as Q,n as Ve,q as z,u as qe}from"./chunk-WXGW2SYC.js";import{Ea as Le,Ga as D,Ha as Me,I as te,Ka as Y,L as Oe,M as Ae,Na as W,Pa as oe,Ra as ye,b as ce,ea as Ee,ja as de,ka as q,la as H,m as jt,ma as X,n as $t,na as ue,o as kt,oa as fe,p as Ot,pa as Te,q as At,r as Et,s as je,sa as Re,t as Tt,u as Rt,v as $e,w as ke,x as le}from"./chunk-24O23MNB.js";import{a as _e,i as De,n as F}from"./chunk-JBOTRSMY.js";var Ie=[{key:"row-seats",label:"row seats",suffix:"rows",labelSuffix:"Rows",creationWord:"Seats",objectType:"row"},{key:"table-chairs",label:"table chairs",suffix:"tables",labelSuffix:"Tables",creationWord:"Tables",objectType:"table"},{key:"booth-units",label:"booth units",suffix:"booths",labelSuffix:"Booths",creationWord:"Booths",objectType:"booth"},{key:"ga-capacity",label:"GA capacity",suffix:"ga",labelSuffix:"GA",creationWord:"Standing",objectType:"gaArea"}];function We(o){return o.floors?.length?o.floors:[{id:"floor-0",objects:o.objects}]}function Lt(o){return Ie.find(e=>e.key===o)}function re(o){let e=new Map,n=Math.max(0,Math.floor(o.seatCount)),i=new Map((o.overrides??[]).filter(s=>Number.isInteger(s.index)&&s.index>=0&&s.index<o.seatCount).map(s=>[s.index,s])),r=(s,y=1)=>{s&&y>0&&e.set(s,(e.get(s)??0)+y)};r(o.categoryKey,n-i.size);for(let s of i.values())s.skip||r(s.categoryKey??o.categoryKey);return e}function Mt(o){return o.type==="row"||o.type==="table"?[...re(o).keys()]:o.type==="booth"?o.categoryKey?[o.categoryKey]:[]:o.type==="gaArea"?o.capacity>0&&o.categoryKey?[o.categoryKey]:[]:[]}function Ze(o){return Ie.find(e=>e.objectType===o.type)??null}function Je(o){return o.type==="row"||o.type==="table"||o.type==="booth"||o.type==="gaArea"}function ie(o){let e=new Map;for(let r of We(o))for(let s of r.objects){if(!Je(s))continue;let y=Ze(s);for(let f of Mt(s)){let m=e.get(f)??new Map,a=m.get(y.key)??[];if(!a.some(u=>u.id===s.id)){let u=s.displayLabel||s.label||s.id;a.push({id:s.id,label:u,type:y.objectType,floorId:r.id})}m.set(y.key,a),e.set(f,m)}}let n=new Map(o.categories.map(r=>[r.key,r.label]));return[...o.categories.map(r=>r.key),...[...e.keys()].filter(r=>!n.has(r)).sort()].flatMap(r=>{let s=e.get(r);if(!s||s.size<2)return[];let y=Ie.flatMap(f=>{let m=s.get(f.key);return m?.length?[{family:f.key,label:f.label,objectType:f.objectType,targets:m}]:[]});return[{categoryKey:r,categoryLabel:n.get(r)??r,families:y,objectIds:[...new Set(y.flatMap(f=>f.targets.map(m=>m.id)))]}]})}function et(o){let e=o.families.map(n=>`${n.label} (${n.targets.map(i=>i.label).join(", ")})`).join(" and ");return`Category \u201C${o.categoryLabel}\u201D is used by more than one kind of inventory \u2014 ${e}. Each category can belong to only one kind \u2014 use the safe split to separate them (prices, ticket tiers, accessibility, and provenance are preserved).`}function tt(o){return o.normalize("NFKC").trim().toLocaleLowerCase("en")}function Ft(o,e,n){for(let i=1;i<=1e4;i+=1){let r=i===1?`--${e}`:`--${e}-${i}`,y=`${o.slice(0,Math.max(1,160-r.length))}${r}`;if(!n.has(y))return n.add(y),y}throw new Error(`Unable to allocate a category key for ${o} (${e})`)}function Pt(o,e,n){for(let i=1;i<=1e4;i+=1){let r=i===1?` (${e})`:` (${e} ${i})`,y=`${o.normalize("NFKC").trim().slice(0,Math.max(1,80-r.length)).trimEnd()}${r}`,f=tt(y);if(!n.has(f))return n.add(f),y}throw new Error(`Unable to allocate a category label for ${o} (${e})`)}function Nt(o,e,n,i){let r=Lt(e);return{...structuredClone(o),key:Ft(o.key,r.suffix,n),label:Pt(o.label,r.labelSuffix,i)}}function _t(o,e,n){let i=[];for(let r of We(o))for(let s of r.objects){if(!Je(s))continue;let y=Ze(s),f=n.get(y.key);if(!(!f||f===e))if(s.type==="row"||s.type==="table"){let m=[];s.categoryKey===e&&(s.categoryKey=f);for(let a of s.overrides??[])a.categoryKey===e&&(a.categoryKey=f,m.push(a.index));(s.categoryKey===f||m.length)&&i.push({family:y.key,floorId:r.id,objectId:s.id,objectType:y.objectType,fromCategoryKey:e,toCategoryKey:f,...m.length?{seatOverrideIndices:m.sort((a,u)=>a-u)}:{}})}else s.categoryKey===e&&(s.categoryKey=f,i.push({family:y.key,floorId:r.id,objectId:s.id,objectType:y.objectType,fromCategoryKey:e,toCategoryKey:f}))}return i}function ot(o){let e=structuredClone(o),n=ie(e);if(!n.length)return{doc:e,changed:!1,changes:[],before:n,after:n};let i=new Set(e.categories.map(f=>f.key)),r=new Set(e.categories.map(f=>tt(f.label))),s=[];for(let f of n){let m=e.categories.findIndex(I=>I.key===f.categoryKey);if(m<0)continue;let a=e.categories[m],u=f.families[0].family,g=new Map([[u,a.key]]),p=f.families.slice(1).map(I=>{let k=Nt(a,I.family,i,r);return g.set(I.family,k.key),{family:I.family,key:k.key,label:k.label,category:k}});e.categories.splice(m+1,0,...p.map(I=>I.category));let b=_t(e,a.key,g);s.push({categoryKey:a.key,categoryLabel:a.label,retainedFamily:u,clones:p.map(({family:I,key:k,label:w})=>({family:I,key:k,label:w})),reassignments:b})}e.floors?.length&&(e.objects=e.floors[0].objects);let y=ie(e);return{doc:e,changed:s.length>0,changes:s,before:n,after:y}}function vo(o){let e=(o%360+360)%360,n=e>=180?e-360:e;return Object.is(n,-0)||Math.abs(n)<1e-9?0:n}function Dt(o,e){return Math.abs(o.x-e.x)<=1e-7&&Math.abs(o.y-e.y)<=1e-7}function Z(o,e,n){return(e.x-o.x)*(n.y-o.y)-(e.y-o.y)*(n.x-o.x)}function ae(o,e,n){let i=Z(e,n,o);return Math.abs(i)>1e-7?!1:o.x>=Math.min(e.x,n.x)-1e-7&&o.x<=Math.max(e.x,n.x)+1e-7&&o.y>=Math.min(e.y,n.y)-1e-7&&o.y<=Math.max(e.y,n.y)+1e-7}function Kt(o,e,n,i){let r=Z(o,e,n),s=Z(o,e,i),y=Z(n,i,o),f=Z(n,i,e);return(r>1e-7&&s<-1e-7||r<-1e-7&&s>1e-7)&&(y>1e-7&&f<-1e-7||y<-1e-7&&f>1e-7)?!0:Math.abs(r)<=1e-7&&ae(n,o,e)||Math.abs(s)<=1e-7&&ae(i,o,e)||Math.abs(y)<=1e-7&&ae(o,n,i)||Math.abs(f)<=1e-7&&ae(e,n,i)}function Bt(o){return o.reduce((e,n,i)=>{let r=o[(i+1)%o.length];return e+n.x*r.y-r.x*n.y},0)}function zt(o){for(let e=0;e<o.length;e+=1){let n=(e+1)%o.length;for(let i=e+1;i<o.length;i+=1){let r=(i+1)%o.length;if(!(e===i||n===i||r===e)&&Kt(o[e],o[n],o[i],o[r]))return!0}}return!1}function nt(o){return o.length<3?{ok:!1,code:"too_few_vertices",message:"Add at least three vertices to create a polygon."}:o.length>256?{ok:!1,code:"too_many_vertices",message:"A polygon can contain at most 256 vertices."}:o.some(e=>!Number.isFinite(e.x)||!Number.isFinite(e.y)||Math.abs(e.x)>1e7||Math.abs(e.y)>1e7)?{ok:!1,code:"invalid_coordinate",message:"Every polygon vertex must use a finite coordinate inside the safe chart range."}:o.some((e,n)=>Dt(e,o[(n+1)%o.length]))?{ok:!1,code:"duplicate_vertex",message:"Move or remove duplicate neighbouring vertices."}:Math.abs(Bt(o))<2?{ok:!1,code:"degenerate_polygon",message:"The polygon needs a visible enclosed area."}:zt(o)?{ok:!1,code:"self_intersection",message:"Polygon edges cannot cross or touch each other."}:{ok:!0}}function B(o){return o.length>=3&&o.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}function U(o,e,n){let i=(o.y-e.y)*(n.x-e.x)-(o.x-e.x)*(n.y-e.y);if(Math.abs(i)>1e-7)return!1;let r=(o.x-e.x)*(n.x-e.x)+(o.y-e.y)*(n.y-e.y);if(r<-1e-7)return!1;let s=(n.x-e.x)**2+(n.y-e.y)**2;return r<=s+1e-7}function G(o,e){let n=!1;for(let i=0,r=e.length-1;i<e.length;r=i++){let s=e[r],y=e[i];if(U(o,s,y))return!0;s.y>o.y!=y.y>o.y&&o.x<(y.x-s.x)*(o.y-s.y)/(y.y-s.y)+s.x&&(n=!n)}return n}function K(o,e,n){return(e.x-o.x)*(n.y-o.y)-(e.y-o.y)*(n.x-o.x)}function rt(o,e,n,i){let r=K(o,e,n),s=K(o,e,i),y=K(n,i,o),f=K(n,i,e);return(r>1e-7&&s<-1e-7||r<-1e-7&&s>1e-7)&&(y>1e-7&&f<-1e-7||y<-1e-7&&f>1e-7)?!0:Math.abs(r)<=1e-7&&U(n,o,e)||Math.abs(s)<=1e-7&&U(i,o,e)||Math.abs(y)<=1e-7&&U(o,n,i)||Math.abs(f)<=1e-7&&U(e,n,i)}function V(o){for(let e=0;e<o.length;e+=1){let n=(e+1)%o.length;for(let i=e+1;i<o.length;i+=1){let r=(i+1)%o.length;if(!(e===i||n===i||r===e)&&rt(o[e],o[n],o[i],o[r]))return!0}}return!1}function J(o,e){for(let n=0;n<o.length;n+=1)for(let i=0;i<e.length;i+=1)if(rt(o[n],o[(n+1)%o.length],e[i],e[(i+1)%e.length]))return!0;return G(o[0],e)||G(e[0],o)}function it(o,e){return!e.some((n,i)=>U(o,n,e[(i+1)%e.length]))&&G(o,e)}function at(o){let e=o.outlinePath;if(!e?.segments.length)return;let n=s=>Number.isFinite(s.x)&&Number.isFinite(s.y),i=(s,y)=>Math.hypot(s.x-y.x,s.y-y.y);if(!n(e.start))return 0;let r=e.start;for(let s=0;s<e.segments.length;s++){let y=e.segments[s];if(!y||!n(y.end)||i(r,y.end)<=1e-9||y.kind==="bezier"&&(!n(y.control1)||!n(y.control2)))return s;if(y.kind==="arc"){if(!n(y.center)||!Number.isFinite(y.radius)||y.radius<=1e-6)return s;let f=Math.max(1e-4,y.radius*1e-4);if(Math.abs(i(r,y.center)-y.radius)>f||Math.abs(i(y.end,y.center)-y.radius)>f)return s}r=y.end}return i(r,e.start)>1e-4,e.segments.length-1}function Ut(o,e,n,i){let r=K(o,e,n),s=K(o,e,i),y=K(n,i,o),f=K(n,i,e);return(r>1e-7&&s<-1e-7||r<-1e-7&&s>1e-7)&&(y>1e-7&&f<-1e-7||y<-1e-7&&f>1e-7)}function st(o,e){for(let n=0;n<o.length;n+=1)for(let i=0;i<e.length;i+=1)if(Ut(o[n],o[(n+1)%o.length],e[i],e[(i+1)%e.length]))return!0;return o.some(n=>it(n,e))||e.some(n=>it(n,o))}function ct(o){return o.role!=="reference-focal"||!o.points||!B(o.points)?null:o.points}function dt(o,e){if(o.displayLabel!==void 0){let n=o.displayLabel.normalize("NFKC").trim();!(o.type==="row"&&o.displayLabel==="")&&(!n||n!==o.displayLabel||n.length>80)&&e.push({severity:"error",code:"invalid-display-label",message:`${o.type==="gaArea"?"GA area":o.type} "${o.label}" must use a normalized buyer label of 1 to 80 characters`,objectId:o.id})}if(o.displayType!==void 0){let n=o.displayType.normalize("NFKC").trim();(!n||n!==o.displayType||n.length>24)&&e.push({severity:"error",code:"invalid-display-type",message:`${o.type==="gaArea"?"GA area":o.type} "${o.label}" must use a normalized buyer type of 1 to 24 characters`,objectId:o.id})}}function lt(o,e,n,i){let r=o.crop,s=r&&(!Number.isFinite(r.x)||!Number.isFinite(r.y)||!Number.isFinite(r.width)||!Number.isFinite(r.height)||r.x<0||r.y<0||r.width<=0||r.height<=0||r.x+r.width>1.000001||r.y+r.height>1.000001);(!Number.isFinite(o.center?.x)||!Number.isFinite(o.center?.y)||!Number.isFinite(o.width)||o.width<=0||!Number.isFinite(o.opacity)||o.opacity<0||o.opacity>1||o.rotation!==void 0&&!Number.isFinite(o.rotation)||s)&&n.push({severity:"error",code:"invalid-background-placement",message:`The ${e} image has an invalid position, size, opacity, rotation, or crop`,...i?{floorId:i}:{}})}function we(o,e,n,i){let r=o.referenceImage,s=o.backgroundImage;r&&(lt(r,"reference",e,i),!r.assetId&&!r.url&&e.push({severity:"error",code:"invalid-reference-image",message:"A trace reference must identify a private asset or self-contained image",...i?{floorId:i}:{}})),s&&(lt(s,s.assetId?"legacy reference":"buyer background",e,i),!s.assetId&&!s.url&&e.push({severity:"error",code:"invalid-buyer-background",message:"A buyer background must contain a renderable image URL",...i?{floorId:i}:{}}),s.assetId&&n.push({severity:"warning",code:"legacy-reference-background",message:"This legacy asset-backed background is trace-only and will migrate to the private reference layer when edited",...i?{floorId:i}:{}})),Qe(o)&&e.push({severity:"error",code:"conflicting-reference-images",message:"The canonical reference and legacy asset-backed background identify different private sources",...i?{floorId:i}:{}})}function ee(o){let e=new Set(Q.map(n=>n.key));return!o||/^ref_[0-9a-f-]{36}$/.test(o.assetId)&&!!o.logicalSectionId.trim()&&["user-confirmed","authoritative-source"].includes(o.evidence)&&!!o.sourceDescription.trim()&&(o.derivation===void 0||["explicit-inventory","server-synthesized-from-aggregate"].includes(o.derivation))&&(o.aggregateEvidence===void 0||["user-confirmed","authoritative-source"].includes(o.aggregateEvidence))&&(o.derivation!=="server-synthesized-from-aggregate"||o.evidence==="user-confirmed")&&(o.sectionAssignmentEvidence===void 0||["user-confirmed","authoritative-source"].includes(o.sectionAssignmentEvidence))&&o.sectionAssignmentEvidence===void 0==!o.sectionAssignmentSourceDescription?.trim()&&(o.sectionAssignmentSourceDescription?.trim().length??0)<=240&&(o.numberingEvidence===void 0||o.numberingEvidence==="user-confirmed")&&o.numberingEvidence===void 0==!o.numberingSourceDescription?.trim()&&(o.numberingSourceDescription?.trim().length??0)<=240&&(!o.accessibility||o.accessibility.placementDerivation==="server-synthesized-row-edges"&&o.accessibility.groupLogicalSectionIds.length>0&&o.accessibility.groupLogicalSectionIds.length<=100&&new Set(o.accessibility.groupLogicalSectionIds).size===o.accessibility.groupLogicalSectionIds.length&&o.accessibility.groupLogicalSectionIds.includes(o.logicalSectionId)&&o.accessibility.groupLogicalSectionIds.every(n=>!!n.trim()&&n.length<=160)&&["user-confirmed","authoritative-source"].includes(o.accessibility.assignmentEvidence)&&!!o.accessibility.assignmentSourceDescription.trim()&&o.accessibility.assignmentSourceDescription.trim().length<=240&&o.accessibility.counts.length>0&&o.accessibility.counts.length<=Q.length&&new Set(o.accessibility.counts.map(n=>n.type)).size===o.accessibility.counts.length&&o.accessibility.counts.every(n=>e.has(n.type)&&Number.isInteger(n.count)&&n.count>0&&["user-confirmed","authoritative-source"].includes(n.evidence)&&!!n.sourceDescription.trim()&&n.sourceDescription.trim().length<=240))}function ut(o){let e=o.referenceInventoryExclusion;return!e||typeof e.assetId=="string"&&/^ref_[0-9a-f-]{36}$/.test(e.assetId)&&e.assetId===o.referenceSource?.assetId&&typeof e.logicalSectionId=="string"&&e.logicalSectionId===(o.logicalSectionId??o.id)&&typeof e.reason=="string"&&!!e.reason.trim()&&e.reason.trim().length<=80&&["user-confirmed","authoritative-source"].includes(e.evidence)&&typeof e.sourceDescription=="string"&&!!e.sourceDescription.trim()&&e.sourceDescription.trim().length<=240}function ft(o){let e=o.referenceCategorySource;return!e||/^ref_[0-9a-f-]{36}$/.test(e.assetId)&&/^#[0-9a-f]{6}$/i.test(e.sourceColor)&&(e.sourceColors===void 0||e.sourceColors.length>0&&e.sourceColors.includes(e.sourceColor)&&new Set(e.sourceColors).size===e.sourceColors.length&&e.sourceColors.every(n=>/^#[0-9a-f]{6}$/i.test(n)&&`${n[1]}${n[3]}${n[5]}`.toLowerCase()===`${e.sourceColor[1]}${e.sourceColor[3]}${e.sourceColor[5]}`.toLowerCase()))&&(e.logicalSectionIds===void 0||e.logicalSectionIds.length>0&&new Set(e.logicalSectionIds).size===e.logicalSectionIds.length&&e.logicalSectionIds.every(n=>!!n.trim()&&n.length<=160))&&(e.assignmentDerivation===void 0||["source-color-class","confirmed-logical-sections"].includes(e.assignmentDerivation))&&e.assignmentEvidence===void 0==!e.assignmentSourceDescription?.trim()&&(e.assignmentEvidence===void 0||["user-confirmed","authoritative-source"].includes(e.assignmentEvidence))&&(e.assignmentSourceDescription?.trim().length??0)<=240&&(e.assignmentDerivation!=="confirmed-logical-sections"||e.assignmentEvidence!==void 0&&!!e.assignmentSourceDescription?.trim())&&e.sourcePaletteColor===void 0==(e.sourcePaletteColorEvidence===void 0)&&e.sourcePaletteColorEvidence===void 0==!e.sourcePaletteColorSourceDescription?.trim()&&(e.sourcePaletteColor===void 0||/^#[0-9a-f]{6}$/i.test(e.sourcePaletteColor))&&(e.sourcePaletteColorEvidence===void 0||["user-confirmed","authoritative-source"].includes(e.sourcePaletteColorEvidence))&&(e.sourcePaletteColorSourceDescription?.trim().length??0)<=240&&["user-confirmed","authoritative-source"].includes(e.labelEvidence)&&!!e.labelSourceDescription.trim()&&e.labelSourceDescription.trim().length<=240&&o.price!==void 0&&["user-confirmed","authoritative-source"].includes(e.priceEvidence)&&!!e.priceSourceDescription.trim()&&e.priceSourceDescription.trim().length<=240&&e.outputColorEvidence===void 0==!e.outputColorSourceDescription?.trim()&&(e.outputColorEvidence===void 0||["user-confirmed","authoritative-source"].includes(e.outputColorEvidence))&&(e.outputColorSourceDescription?.trim().length??0)<=240&&(o.color.toLowerCase()===(e.sourcePaletteColor??e.sourceColor).toLowerCase()&&new Set((e.sourceColors??[e.sourceColor]).map(n=>`${n[1]}${n[3]}${n[5]}`.toLowerCase())).size===1||e.outputColorEvidence!==void 0&&["user-confirmed","authoritative-source"].includes(e.outputColorEvidence))}function yt(o){let e=o.referenceDirectSeatImport;return!e||/^ref_[0-9a-f-]{36}$/.test(e.assetId)&&/^source-color:(?:#[0-9a-f]{6}(?:\+#[0-9a-f]{6})*|unclassified)$/i.test(e.familyId)}function gt(o,e){let n=o.floors?.length?o.floors.map(s=>({id:s.id,objects:s.objects})):[{id:"floor-0",objects:o.objects}],i=new Map,r=new Map;for(let s of n){let y=s.objects.filter(a=>a.type==="row"),f=new Map,m=new Map;for(let a of y){if(a.segmentedRow){let u=f.get(a.segmentedRow.groupId)??[];u.push(a),f.set(a.segmentedRow.groupId,u)}if(a.rowBlockGeneration){let u=m.get(a.rowBlockGeneration.groupId)??[];u.push(a),m.set(a.rowBlockGeneration.groupId,u)}a.segmentedRow&&a.rowBlockGeneration&&e.push({severity:"error",code:"invalid-row-group-membership",message:`Row "${a.label}" cannot be both a segmented-row component and a generated row-block member`,objectId:a.id,floorId:s.id})}for(let[a,u]of f){let g=i.get(a);g&&g!==s.id&&e.push({severity:"error",code:"invalid-segmented-row",message:`Segmented row "${a}" cannot span multiple floors`,objectId:u[0].id,floorId:s.id}),i.set(a,s.id);let p=u.slice().sort((C,O)=>C.segmentedRow.componentIndex-O.segmentedRow.componentIndex),b=p[0]?.segmentedRow,I=b?.componentCount??0,k=b?JSON.stringify({displayLabel:b.displayLabel,repeatLabelOnComponents:b.repeatLabelOnComponents,displayType:b.displayType,labelPresentation:b.labelPresentation,viewFromSeatUrl:b.viewFromSeatUrl,viewFromSeatMeta:b.viewFromSeatMeta,confidenceEvidence:b.confidenceEvidence,smoothing:b.smoothing}):"";b&&I>=2&&I<=64&&p.length===I&&b.boundaryBefore==="start"&&p.every((C,O)=>{let j=C.segmentedRow;return j.kind==="segmented-row-v1"&&j.groupId===a&&j.componentCount===I&&j.componentIndex===O&&(O===0?j.boundaryBefore==="start":j.boundaryBefore!=="start")&&j.displayLabel.normalize("NFKC").trim()===j.displayLabel&&j.displayLabel.length>0&&j.displayLabel.length<=80&&JSON.stringify({displayLabel:j.displayLabel,repeatLabelOnComponents:j.repeatLabelOnComponents,displayType:j.displayType,labelPresentation:j.labelPresentation,viewFromSeatUrl:j.viewFromSeatUrl,viewFromSeatMeta:j.viewFromSeatMeta,confidenceEvidence:j.confidenceEvidence,smoothing:j.smoothing})===k})||e.push({severity:"error",code:"invalid-segmented-row",message:`Segmented row "${a}" has missing, duplicated, cyclic, or inconsistent component metadata`,objectId:u[0]?.id,floorId:s.id})}for(let[a,u]of m){let g=r.get(a);g&&g!==s.id&&e.push({severity:"error",code:"invalid-row-block-generation",message:"A generated row block cannot span multiple floors",objectId:u[0].id,floorId:s.id}),r.set(a,s.id)}}}function Gt(o){return o.type==="row"||o.type==="table"||o.type==="booth"}function Vt(o){let e=[],n=new Map((o.overrides??[]).map(i=>[i.index,i]));for(let i=0;i<o.seatCount;i++){let r=n.get(i);r?.skip||e.push({label:Ee(o,i,r),index:i})}return e}function mt(o){let e=[],n=new Map((o.overrides??[]).map(i=>[i.index,i]));for(let i=0;i<o.seatCount;i++){let r=n.get(i);r?.skip||e.push({label:r?.label??`${o.label}-${i+1}`,index:i})}return e}function bt(o){let e=[];o.eventConfigurationId!==void 0&&(typeof o.eventConfigurationId!="string"||o.eventConfigurationId.normalize("NFKC").trim()!==o.eventConfigurationId||o.eventConfigurationId.length<1||o.eventConfigurationId.length>100)&&e.push({severity:"error",code:"invalid-event-configuration",message:"Active event configuration must contain 1 to 100 normalized characters"});let n=[],i=new Set(o.categories.map(t=>t.key)),r=new Set(Q.map(t=>t.key)),s=new Map(o.categories.map(t=>[t.key,t.price!=null||t.notForSale===!0])),y=new Set;we(o,e,n),o.theme?.logoUrl!==void 0&&!ce(o.theme.logoUrl)&&e.push({severity:"error",code:"invalid-theme-logo-url",message:"The buyer-facing theme logo URL is invalid"});let f=ce,m=(t,S,c,d={})=>{if(S===void 0)return;if(!S||typeof S!="object"||Array.isArray(S)){e.push({severity:"error",code:"invalid-seat-view-metadata",message:`${c} view metadata is invalid`,...d});return}let l=S;t||n.push({severity:"warning",code:"orphaned-seat-view-metadata",message:`${c} view metadata has no image`,...d});let v=new Set(["exact-seat","row-representative","section-representative","floor-representative","venue-representative"]);l.projection!==void 0&&l.projection!=="equirectangular"&&e.push({severity:"error",code:"invalid-seat-view-projection",message:`${c} view projection must be equirectangular`,...d}),l.coverage!==void 0&&!v.has(l.coverage)&&e.push({severity:"error",code:"invalid-seat-view-coverage",message:`${c} view coverage is invalid`,...d});let h=(x,$,A)=>typeof x=="number"&&Number.isFinite(x)&&x>=$&&x<=A;if(l.initialBearingDeg!==void 0&&!h(l.initialBearingDeg,-360,360)&&e.push({severity:"error",code:"invalid-seat-view-bearing",message:`${c} view bearing must be between -360\xB0 and 360\xB0`,...d}),l.initialPitchDeg!==void 0&&!h(l.initialPitchDeg,-90,90)&&e.push({severity:"error",code:"invalid-seat-view-pitch",message:`${c} view pitch must be between -90\xB0 and 90\xB0`,...d}),l.capturedAt!==void 0&&(typeof l.capturedAt!="string"||l.capturedAt.length>40||!Number.isFinite(Date.parse(l.capturedAt)))&&e.push({severity:"error",code:"invalid-seat-view-capture-date",message:`${c} view capture date is invalid`,...d}),l.sourceLabel!==void 0&&(typeof l.sourceLabel!="string"||l.sourceLabel.trim().length>100)&&e.push({severity:"error",code:"invalid-seat-view-source",message:`${c} view source label is invalid`,...d}),l.previewUrl!==void 0&&!f(l.previewUrl)&&e.push({severity:"error",code:"invalid-seat-view-preview-url",message:`${c} view preview URL is invalid`,...d}),l.variants!==void 0){let x=Array.isArray(l.variants)?l.variants:[];if(!Array.isArray(l.variants)||x.length<1||x.length>4)e.push({severity:"error",code:"invalid-seat-view-variants",message:`${c} view variants must contain between 1 and 4 tiers`,...d});else{let $=new Set;for(let A of x){if(!A||typeof A!="object"||!f(A.url)||!Number.isInteger(A.width)||A.width<1||A.width>12e3||!Number.isInteger(A.height)||A.height<1||A.height>12e3||A.width!==A.height*2||typeof A.sha256!="string"||!/^[a-f0-9]{64}$/.test(A.sha256)||$.has(A.width)){e.push({severity:"error",code:"invalid-seat-view-variant",message:`${c} view variant is not a unique immutable 2:1 equirectangular tier`,...d});break}$.add(A.width)}}}for(let[x,$]of[["width",l.sourceWidth],["height",l.sourceHeight],["preview width",l.previewWidth],["preview height",l.previewHeight]])$!==void 0&&(!Number.isInteger($)||$<1||$>32768)&&e.push({severity:"error",code:"invalid-seat-view-dimensions",message:`${c} view source ${x} is invalid`,...d});l.captureEyeHeightM!==void 0&&!h(l.captureEyeHeightM,.5,3)&&e.push({severity:"error",code:"invalid-seat-view-eye-height",message:`${c} capture eye height must be between 0.5 m and 3 m`,...d}),l.eventConfigurationId!==void 0&&(typeof l.eventConfigurationId!="string"||!l.eventConfigurationId.trim()||l.eventConfigurationId.length>100)&&e.push({severity:"error",code:"invalid-seat-view-configuration",message:`${c} event configuration id is invalid`,...d}),l.eventConfigurationVersion!==void 0&&(!Number.isInteger(l.eventConfigurationVersion)||l.eventConfigurationVersion<1)&&e.push({severity:"error",code:"invalid-seat-view-configuration-version",message:`${c} event configuration version is invalid`,...d}),l.eventConfigurationVersion!==void 0&&!l.eventConfigurationId&&e.push({severity:"error",code:"invalid-seat-view-configuration-pin",message:`${c} event configuration version requires an id`,...d})},a=(t,S,c={})=>{if(t===void 0)return;let d=$=>{e.push({severity:"error",code:"invalid-seat-confidence-evidence",message:`${S} confidence evidence ${$}`,...c})};if(!t||typeof t!="object"||Array.isArray(t)){d("is invalid");return}let l=t;l.schema!=="seatlayer.seat-confidence/1"&&d("has an unsupported schema");let v=($,A)=>typeof $=="string"&&$.normalize("NFKC").trim()===$&&$.length>0&&$.length<=A;v(l.evidenceId,120)||d("has an invalid evidence id"),v(l.modelVersion,120)||d("has an invalid model version"),new Set(["synthetic-model","organizer-approved","calibrated-provider"]).has(l.evidenceKind)||d("has an invalid evidence kind"),new Set(["generated","geometry-verified","configuration-verified"]).has(l.modelLevel)||d("has an invalid model level");let h=l.realityLevel??"none";new Set(["none","comparable-build-reference","actual-build-checked"]).has(h)||d("has an invalid reality level"),l.eventConfigurationId!==void 0&&!v(l.eventConfigurationId,100)&&d("has an invalid event configuration id"),l.eventConfigurationVersion!==void 0&&(!Number.isInteger(l.eventConfigurationVersion)||l.eventConfigurationVersion<1)&&d("has an invalid event configuration version"),l.status!==void 0&&!new Set(["draft","approved","retracted"]).has(l.status)&&d("has an invalid publication status"),l.basisSha256!==void 0&&!/^[a-f0-9]{64}$/.test(l.basisSha256)&&d("has an invalid venue basis SHA-256"),l.basisSha256!==void 0&&l.status!=="approved"&&d("can carry a venue basis SHA-256 only after approval");for(let[$,A]of[["assessment",l.assessedAt],["expiry",l.validUntil]])A!==void 0&&(!v(A,40)||!Number.isFinite(Date.parse(A)))&&d(`has an invalid ${$} date`);l.approvedByRole!==void 0&&!v(l.approvedByRole,100)&&d("has an invalid approving organization or role"),l.sourceLabel!==void 0&&!v(l.sourceLabel,120)&&d("has an invalid source label"),l.limitations!==void 0&&(!Array.isArray(l.limitations)||l.limitations.length>6||l.limitations.some($=>!v($,160)))&&d("has invalid limitations"),l.evidenceKind==="synthetic-model"&&(l.modelLevel!=="generated"||h!=="none")&&d("cannot describe synthetic data as verified or reality checked"),l.modelLevel!=="generated"&&(!l.assessedAt||!l.approvedByRole)&&d("requires an assessment date and approving organization or role for verified model levels"),l.modelLevel==="configuration-verified"&&!l.eventConfigurationId&&d("requires an event configuration id for configuration verification"),h!=="none"&&(!l.assessedAt||!l.sourceLabel)&&d("requires an assessment date and source for reality evidence"),h==="actual-build-checked"&&(l.modelLevel!=="configuration-verified"||!l.eventConfigurationId)&&d("requires a configuration-verified model and event configuration for an actual-build check");let x=l.modeledTarget;x!==void 0&&(!x||typeof x!="object"||Array.isArray(x)?d("has an invalid modeled target"):((!v(x.label,80)||!v(x.methodLabel,100))&&d("has invalid modeled-target labels"),(!Number.isInteger(x.totalRayCount)||x.totalRayCount<1||x.totalRayCount>1e3||!Number.isInteger(x.clearRayCount)||x.clearRayCount<0||x.clearRayCount>x.totalRayCount)&&d("has invalid modeled-target ray counts"),new Set(["clear","partial","obstructed"]).has(x.classification)||d("has an invalid modeled-target classification"),x.occluderLabels!==void 0&&(!Array.isArray(x.occluderLabels)||x.occluderLabels.length>10||x.occluderLabels.some($=>!v($,100)))&&d("has invalid modeled-target occluders")))};m(o.viewFromSeatUrl,o.viewFromSeatMeta,"Venue"),a(o.confidenceEvidence,"Venue"),o.viewFromSeatUrl!==void 0&&!f(o.viewFromSeatUrl)&&e.push({severity:"error",code:"invalid-venue-view-url",message:"The whole-venue view-from-seat image URL is invalid"});for(let t of o.floors??[])t.viewFromSeatUrl!==void 0&&!f(t.viewFromSeatUrl)&&e.push({severity:"error",code:"invalid-floor-view-url",message:`Floor "${t.name}" has an invalid view-from-seat image URL`}),m(t.viewFromSeatUrl,t.viewFromSeatMeta,`Floor "${t.name}"`,{floorId:t.id}),a(t.confidenceEvidence,`Floor "${t.name}"`,{floorId:t.id});let u=o.floors?.length?o.floors.flatMap(t=>t.objects):o.objects;for(let t of u)if((t.type==="row"||t.type==="section")&&(t.viewFromSeatUrl!==void 0&&!f(t.viewFromSeatUrl)&&e.push({severity:"error",code:t.type==="row"?"invalid-row-view-url":"invalid-section-view-url",message:`${t.type==="row"?"Row":"Section"} "${t.label}" has an invalid view-from-seat image URL`,objectId:t.id}),m(t.viewFromSeatUrl,t.viewFromSeatMeta,`${t.type==="row"?"Row":"Section"} "${t.label}"`,{objectId:t.id}),a(t.confidenceEvidence,`${t.type==="row"?"Row":"Section"} "${t.label}"`,{objectId:t.id})),t.type==="row"&&t.segmentedRow&&(t.segmentedRow.viewFromSeatUrl!==void 0&&!f(t.segmentedRow.viewFromSeatUrl)&&e.push({severity:"error",code:"invalid-segmented-row-view-url",message:`Segmented row "${t.segmentedRow.displayLabel}" has an invalid view-from-seat image URL`,objectId:t.id}),m(t.segmentedRow.viewFromSeatUrl,t.segmentedRow.viewFromSeatMeta,`Segmented row "${t.segmentedRow.displayLabel}"`,{objectId:t.id}),a(t.segmentedRow.confidenceEvidence,`Segmented row "${t.segmentedRow.displayLabel}"`,{objectId:t.id})),t.type==="row"||t.type==="table")for(let S of t.overrides??[])S.viewFromSeatUrl!==void 0&&!f(S.viewFromSeatUrl)&&e.push({severity:"error",code:"invalid-seat-view-url",message:`Seat ${S.index+1} has an invalid view-from-seat image URL`,objectId:t.id,seatIndices:[S.index]}),m(S.viewFromSeatUrl,S.viewFromSeatMeta,`Seat ${S.index+1}`,{objectId:t.id,seatIndices:[S.index]}),a(S.confidenceEvidence,`Seat ${S.index+1}`,{objectId:t.id,seatIndices:[S.index]});let g=new Set;for(let t of o.categories){g.has(t.key)&&e.push({severity:"error",code:"duplicate-category-key",message:`Category key "${t.key}" is used more than once`,categoryKey:t.key}),g.add(t.key);let S=new Set;for(let c of t.tiers??[]){if(S.has(c.id)&&e.push({severity:"error",code:"duplicate-category-tier-id",message:`Ticket tier id "${c.id}" is used more than once in category "${t.key}"`,categoryKey:t.key}),c.restriction!=null&&!["companion","child","senior","student","membership","custom"].includes(c.restriction)&&e.push({severity:"error",code:"invalid-category-tier-restriction",message:`Ticket tier "${c.name}" has an unknown restriction`,categoryKey:t.key}),c.buyerMessage!=null&&(!c.buyerMessage.trim()||c.buyerMessage.length>240)&&e.push({severity:"error",code:"invalid-category-tier-buyer-message",message:`Ticket tier "${c.name}" buyer guidance must contain 1 to 240 characters`,categoryKey:t.key}),c.currency!=null&&!/^[A-Z]{3}$/.test(c.currency)&&e.push({severity:"error",code:"invalid-category-tier-currency",message:`Ticket tier "${c.name}" must use a three-letter ISO currency`,categoryKey:t.key}),c.applicability!=null){let d=c.applicability.seatLabels,l=c.applicability.accessibility;(d!==void 0&&(!Array.isArray(d)||!d.length||d.length>1e4||d.some(v=>typeof v!="string"||!v.trim()||v.length>160)||new Set(d).size!==d.length)||l!==void 0&&(!Array.isArray(l)||!l.length||l.some(v=>!r.has(v))||new Set(l).size!==l.length))&&e.push({severity:"error",code:"invalid-category-tier-applicability",message:`Ticket tier "${c.name}" has invalid seat applicability`,categoryKey:t.key})}c.evidence!=null&&(!["public-host","public-event","user-confirmed"].includes(c.evidence.provenance)||!c.evidence.sourceDescription.trim()||c.evidence.sourceDescription.length>240||c.evidence.capturedAt!==void 0&&(c.evidence.capturedAt.length>40||!Number.isFinite(Date.parse(c.evidence.capturedAt))))&&e.push({severity:"error",code:"invalid-category-tier-evidence",message:`Ticket tier "${c.name}" has invalid evidence provenance`,categoryKey:t.key}),S.add(c.id)}ft(t)||e.push({severity:"error",code:"invalid-reference-category-source",message:`Category ${t.label||t.key} has incomplete or invalid reference evidence`,categoryKey:t.key}),yt(t)||e.push({severity:"error",code:"invalid-reference-direct-seat-import",message:`Category ${t.label||t.key} has invalid direct-seat import provenance`,categoryKey:t.key})}let p=new Map,b=new Map,I=[],k=new Map,w=0,C=0,O=new Set;for(let t of o.floors??[])we(t,e,n,t.id),O.has(t.id)&&e.push({severity:"error",code:"duplicate-floor-id",message:`Floor id "${t.id}" is used more than once`,floorId:t.id}),O.add(t.id),t.baseHeightM!==void 0&&(!Number.isFinite(t.baseHeightM)||t.baseHeightM<H||t.baseHeightM>X)&&e.push({severity:"error",code:"invalid-floor-base-height",message:`Floor "${t.name}" base height must be between ${H} and ${X} metres`,floorId:t.id});let j=o.floors&&o.floors.length?o.floors.flatMap(t=>t.objects):o.objects;gt(o,e);let P=new Set;for(let t of j)P.has(t.id)&&e.push({severity:"error",code:"duplicate-object-id",message:`Object id "${t.id}" is used more than once`,objectId:t.id}),P.add(t.id);let M=new Set;for(let t of o.zones??[])M.has(t.id)&&e.push({severity:"error",code:"duplicate-zone-id",message:`Zone id "${t.id}" is used more than once`}),M.add(t.id),t.focalPoint!==void 0&&(!Number.isFinite(t.focalPoint.x)||!Number.isFinite(t.focalPoint.y))&&e.push({severity:"error",code:"invalid-zone-focal-point",message:`Zone "${t.label}" must use a finite focal point`});let T=new Map;for(let t of j)if(!(t.type!=="section"||!t.zone)){if(o.zones?.length&&!M.has(t.zone)){e.push({severity:"error",code:"unknown-section-zone",message:`Section "${t.displayLabel??t.label}" references unknown zone "${t.zone}"`,objectId:t.id});continue}T.has(t.zone)||T.set(t.zone,t)}for(let[t,S]of T){let c=o.zones?.find(d=>d.id===t);c&&(c?.focalPoint||n.push({severity:"warning",code:"missing-zone-focal-point",message:`Zone "${c?.label??t}" uses the legacy floor focal; set its own focal point before publishing`,objectId:S.id}))}for(let t of j)if((t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea")&&dt(t,e),Gt(t)){if(w++,C+=t.type==="booth"?1:t.type==="row"?Le(t):t.bookAsWhole||t.variableOccupancy?t.seatCount:mt(t).length,p.get(t.label)!==void 0?t.type!=="row"&&e.push({severity:"error",code:"duplicate-object-label",message:`Label "${t.label}" is used by more than one object`,objectId:t.id}):p.set(t.label,t.id),i.has(t.categoryKey)?y.add(t.categoryKey):e.push({severity:"error",code:"unknown-category",message:`"${t.label}" references unknown category "${t.categoryKey}"`,objectId:t.id,categoryKey:t.categoryKey}),t.type==="row"){ee(t.referenceInventorySource)||e.push({severity:"error",code:"invalid-reference-inventory-source",message:`Row "${t.label}" has invalid reference-inventory provenance`,objectId:t.id}),t.seatCount<1&&e.push({severity:"error",code:"empty-row",message:`Row "${t.label}" has no seats`,objectId:t.id});let c=new Set;for(let d of t.overrides??[]){(d.accessibility??[]).filter(x=>!r.has(x)).length&&e.push({severity:"error",code:"invalid-accessibility-type",message:`Row "${t.label}" seat ${d.index+1} uses an unknown accessibility type`,objectId:t.id,seatIndices:[d.index]}),(!Number.isInteger(d.index)||d.index<0||d.index>=t.seatCount||c.has(d.index))&&e.push({severity:"error",code:"invalid-seat-override",message:`Row "${t.label}" has a duplicated or out-of-range seat override`,objectId:t.id,...Number.isInteger(d.index)?{seatIndices:[d.index]}:{}}),c.add(d.index);let v=d.wheelchairSpaceType,h=d.accessible===!0||d.accessibility?.includes("wheelchair");v!==void 0&&v!=="seat-present"&&v!=="no-seat"?e.push({severity:"error",code:"invalid-wheelchair-space",message:`Row "${t.label}" seat ${d.index+1} has an invalid wheelchair-space type`,objectId:t.id,seatIndices:[d.index]}):v&&(!h||d.skip)&&e.push({severity:"error",code:"invalid-wheelchair-space",message:d.skip?`Row "${t.label}" seat ${d.index+1} cannot have a wheelchair-space physical type while skipped from inventory`:`Row "${t.label}" seat ${d.index+1} must include wheelchair accessibility for its physical-space type`,objectId:t.id,seatIndices:[d.index]})}for(let d of Vt(t))ne(d.label)&&e.push({severity:"error",code:"reserved-seat-label",message:`Seat label "${d.label}" uses SeatLayer's reserved GA namespace`,objectId:t.id,seatIndices:[d.index]}),b.get(d.label)!==void 0?I.push({severity:"error",code:"duplicate-seat-label",message:`Seat label "${d.label}" is used more than once`,objectId:t.id,seatIndices:[d.index]}):b.set(d.label,t.id)}else if(t.type==="table"){let c=t.bookAsWhole===!0||t.variableOccupancy===!0;if(t.fill!==void 0&&!_e(t.fill)&&e.push({severity:"error",code:"invalid-table-fill",message:`Table "${t.label}" has an invalid surface color`,objectId:t.id}),t.automaticRadius!==void 0&&typeof t.automaticRadius!="boolean"?e.push({severity:"error",code:"invalid-table-automatic-radius",message:`Table "${t.label}" has an invalid automatic-radius setting`,objectId:t.id}):t.automaticRadius===!0&&(t.shape!=="round"||t.radius!==Fe(t.seatCount,t.seatArc))&&e.push({severity:"error",code:"invalid-table-automatic-radius",message:`Table "${t.label}" needs a radius that matches its automatic chair spacing`,objectId:t.id}),t.seatCountsBySide){let h=["top","bottom","left","right"],x=Object.keys(t.seatCountsBySide),$=h.every(_=>Number.isInteger(t.seatCountsBySide[_])&&t.seatCountsBySide[_]>=0&&t.seatCountsBySide[_]<=40),A=$?h.reduce((_,Ct)=>_+t.seatCountsBySide[Ct],0):Number.NaN;(t.shape!=="rect"||x.length!==h.length||x.some(_=>!h.includes(_))||!$||A!==t.seatCount||A<1||A>40)&&e.push({severity:"error",code:"invalid-table-side-counts",message:`Table "${t.label}" needs top, bottom, left, and right whole-number chair counts totaling its ${t.seatCount}-chair capacity`,objectId:t.id})}c&&t.overrides?.length&&e.push({severity:"error",code:"grouped-table-chair-overrides",message:`Grouped table "${t.label}" cannot carry individual-chair overrides`,objectId:t.id,seatIndices:t.overrides.map(h=>h.index)});let d=new Set;for(let h of t.overrides??[]){(h.accessibility??[]).filter(_=>!r.has(_)).length&&e.push({severity:"error",code:"invalid-accessibility-type",message:`Table "${t.label}" chair ${h.index+1} uses an unknown accessibility type`,objectId:t.id,seatIndices:[h.index]}),(!Number.isInteger(h.index)||h.index<0||h.index>=t.seatCount||d.has(h.index))&&e.push({severity:"error",code:"invalid-seat-override",message:`Table "${t.label}" has a duplicated or out-of-range chair override`,objectId:t.id,...Number.isInteger(h.index)?{seatIndices:[h.index]}:{}}),d.add(h.index),h.categoryKey&&!i.has(h.categoryKey)?e.push({severity:"error",code:"unknown-category",message:`Table "${t.label}" chair ${h.index+1} references unknown category "${h.categoryKey}"`,objectId:t.id,seatIndices:[h.index],categoryKey:h.categoryKey}):h.categoryKey&&y.add(h.categoryKey);let $=h.wheelchairSpaceType,A=h.accessible===!0||h.accessibility?.includes("wheelchair");$!==void 0&&$!=="seat-present"&&$!=="no-seat"?e.push({severity:"error",code:"invalid-wheelchair-space",message:`Table "${t.label}" chair ${h.index+1} has an invalid wheelchair-space type`,objectId:t.id,seatIndices:[h.index]}):$&&(!A||h.skip)&&e.push({severity:"error",code:"invalid-wheelchair-space",message:h.skip?`Table "${t.label}" chair ${h.index+1} cannot have a wheelchair-space physical type while skipped from inventory`:`Table "${t.label}" chair ${h.index+1} must include wheelchair accessibility for its physical-space type`,objectId:t.id,seatIndices:[h.index]})}t.bookAsWhole&&t.variableOccupancy?e.push({severity:"error",code:"invalid-table-booking-mode",message:`Table "${t.label}" cannot be sold both as a whole table and with variable occupancy`,objectId:t.id}):t.variableOccupancy?(!Number.isInteger(t.minOccupancy)||!Number.isInteger(t.maxOccupancy)||t.minOccupancy<1||t.maxOccupancy<t.minOccupancy||t.maxOccupancy>t.seatCount)&&e.push({severity:"error",code:"invalid-table-occupancy",message:`Table "${t.label}" needs whole-number minimum and maximum guests from 1 to its ${t.seatCount}-chair capacity`,objectId:t.id}):(t.minOccupancy!=null||t.maxOccupancy!=null)&&e.push({severity:"error",code:"invalid-table-occupancy",message:`Table "${t.label}" has guest bounds without variable-occupancy selling`,objectId:t.id}),ee(t.referenceInventorySource)||e.push({severity:"error",code:"invalid-reference-inventory-source",message:`Table "${t.label}" has invalid reference-inventory provenance`,objectId:t.id}),(t.shape==="round"&&t.radius==null||t.shape==="rect"&&(t.width==null||t.height==null)||t.seatCount<1)&&e.push({severity:"error",code:"bad-table",message:`Table "${t.label}" is missing required dimensions or seats`,objectId:t.id});let v=c?[{label:t.label,index:void 0}]:mt(t);for(let h of v)ne(h.label)&&e.push({severity:"error",code:"reserved-seat-label",message:`Inventory label "${h.label}" uses SeatLayer's reserved GA namespace`,objectId:t.id}),b.get(h.label)!==void 0?I.push({severity:"error",code:"duplicate-seat-label",message:`Inventory label "${h.label}" is used more than once; grouped table labels must be unique`,objectId:t.id,...h.index===void 0?{}:{seatIndices:[h.index]}}):b.set(h.label,t.id)}else if(t.type==="booth"){ee(t.referenceInventorySource)||e.push({severity:"error",code:"invalid-reference-inventory-source",message:`Booth "${t.label}" has invalid reference-inventory provenance`,objectId:t.id});let c=t.label;ne(c)&&e.push({severity:"error",code:"reserved-seat-label",message:`Seat label "${c}" uses SeatLayer's reserved GA namespace`,objectId:t.id}),b.get(c)!==void 0?I.push({severity:"error",code:"duplicate-seat-label",message:`Seat label "${c}" is used more than once`,objectId:t.id}):b.set(c,t.id)}}else if(t.type==="gaArea"){if(!Pe(t))e.push({severity:"error",code:"invalid-ga-inventory-segments",message:`GA area "${t.label}" has invalid joined-area inventory provenance`,objectId:t.id});else for(let l of Ne(t))b.get(l)!==void 0?I.push({severity:"error",code:"duplicate-seat-label",message:`GA inventory label "${l}" is used more than once`,objectId:t.id}):b.set(l,t.id);ee(t.referenceInventorySource)||e.push({severity:"error",code:"invalid-reference-inventory-source",message:`GA area "${t.label}" has invalid reference-inventory provenance`,objectId:t.id}),(!B(t.points)||Math.abs(z(t.points))<=1e-7||V(t.points))&&e.push({severity:"error",code:"invalid-ga-outline",message:`GA area "${t.label}" must have a finite, non-self-intersecting polygon outline`,objectId:t.id});let c=t.holes??[],d=Array.isArray(c)&&c.length<=64?c.findIndex(l=>!Array.isArray(l)||l.length>512||!B(l)||Math.abs(z(l))<=1e-7||V(l)?!0:!l.flatMap((h,x)=>{let $=l[(x+1)%l.length];return[h,{x:(h.x+$.x)/2,y:(h.y+$.y)/2}]}).every(h=>G(h,t.points))):0;if(d>=0)e.push({severity:"error",code:"invalid-ga-hole",message:`GA area "${t.label}" has a cutout outside its outline or with invalid geometry`,objectId:t.id,holeIndex:d});else if(c.some((l,v)=>c.slice(v+1).some(h=>J(l,h)))){let l=c.findIndex((v,h)=>c.slice(h+1).some(x=>J(v,x)));e.push({severity:"error",code:"overlapping-ga-holes",message:`GA area "${t.label}" has overlapping cutout polygons`,objectId:t.id,holeIndex:l})}i.has(t.categoryKey)?y.add(t.categoryKey):e.push({severity:"error",code:"unknown-category",message:`"${t.label}" references unknown category "${t.categoryKey}"`,objectId:t.id,categoryKey:t.categoryKey}),t.capacity<1&&e.push({severity:"error",code:"empty-ga",message:`GA area "${t.label}" has zero capacity`,objectId:t.id}),(!Number.isInteger(t.capacity)||t.capacity>ge)&&e.push({severity:"error",code:"invalid-ga-capacity",message:`GA area "${t.label}" capacity must be a whole number from 1 to ${ge}`,objectId:t.id}),w++,C+=Math.max(0,Math.floor(t.capacity))}else if(t.type==="section"){if(t.displayLabel!==void 0){let d=t.displayLabel.normalize("NFKC").trim();d?(d!==t.displayLabel||d.length>80)&&e.push({severity:"error",code:"invalid-display-label",message:`Section "${t.label}" must use a normalized buyer label of 1 to 80 characters`,objectId:t.id}):e.push({severity:"error",code:"unnamed-section",message:`Section "${t.label}" needs a buyer-facing name before seats are added`,objectId:t.id})}if(t.editor?.defaultCategoryKey&&!i.has(t.editor.defaultCategoryKey)&&e.push({severity:"error",code:"unknown-category",message:`Section "${t.label}" references unknown future-seat category "${t.editor.defaultCategoryKey}"`,objectId:t.id}),t.elevation!==void 0&&(!Number.isInteger(t.elevation)||t.elevation<de||t.elevation>q)){let d=Number.isInteger(t.elevation)&&t.elevation>q&&t.elevation<=Te;n.push({severity:"warning",code:d?"legacy-section-elevation":"invalid-section-elevation",message:d?`Section "${t.label}" uses legacy tier ${t.elevation}; set an exact height before normalizing it to tier ${q}`:`Section "${t.label}" elevation must be a whole-number tier from ${de} to ${q}`,objectId:t.id})}if(t.height!==void 0&&(!Number.isFinite(t.height)||t.height<H||t.height>X)&&e.push({severity:"error",code:"invalid-section-height",message:`Section "${t.label}" exact height must be between ${H} and ${X} metres`,objectId:t.id}),t.rake!==void 0&&(!Number.isFinite(t.rake)||t.rake<ue||t.rake>fe)&&e.push({severity:"error",code:"invalid-section-rake",message:`Section "${t.label}" rake must be between ${ue}\xB0 and ${fe}\xB0`,objectId:t.id}),t.surfaceKind!==void 0&&t.surfaceKind!=="flat"&&t.surfaceKind!=="rakedRows"&&e.push({severity:"error",code:"invalid-section-surface-kind",message:`Section "${t.label}" surfaceKind must be 'flat' or 'rakedRows'`,objectId:t.id}),!B(t.outline)||Math.abs(z(t.outline))<=1e-7||V(t.outline)){e.push({severity:"error",code:"invalid-section-outline",message:`Section "${t.label}" must have a finite, non-self-intersecting polygon outline`,objectId:t.id});continue}if(t.outlinePath){let d=[];try{d=Ae(t.outlinePath)}catch{}(!Oe(t.outlinePath)||!d.length||Math.hypot(t.outlinePath.start.x-t.outline[0].x,t.outlinePath.start.y-t.outline[0].y)>1e-4||!B(d)||Math.abs(z(d))<=1e-7||V(d))&&e.push({severity:"error",code:"invalid-section-outline-path",message:`Section "${t.label}" has an invalid or inconsistent curved outline path`,objectId:t.id,edgeIndex:at(t)})}if(t.referenceSource&&(!/^ref_[0-9a-f-]{36}$/.test(t.referenceSource.assetId)||!/^(?:reg|ai)_[0-9a-f]{16}$/.test(t.referenceSource.regionId))&&e.push({severity:"error",code:"invalid-section-reference-source",message:`Section "${t.label}" has invalid opaque reference provenance`,objectId:t.id}),ut(t)||e.push({severity:"error",code:"invalid-section-inventory-exclusion",message:`Section "${t.label}" has incomplete or mismatched non-sellable evidence`,objectId:t.id}),t.logicalSectionId!==void 0&&!t.logicalSectionId.trim())e.push({severity:"error",code:"invalid-logical-section-id",message:`Section "${t.label}" has an empty logical section id`,objectId:t.id});else if(t.logicalSectionId){let d=JSON.stringify({displayLabel:t.displayLabel??null,entrance:t.entrance??null,viewFromSeatUrl:t.viewFromSeatUrl??null,viewFromSeatMeta:t.viewFromSeatMeta??null,confidenceEvidence:t.confidenceEvidence??null,zone:t.zone??null,labelStyle:t.labelPresentation?.labelStyle??null,labelVisible:t.labelPresentation?.visible!==!1}),l=k.get(t.logicalSectionId);l&&(l.label!==t.label||l.semanticSignature!==d)?e.push({severity:"error",code:"inconsistent-logical-section",message:`Logical section "${t.logicalSectionId}" must use one technical label and buyer-facing presentation across every component`,objectId:t.id}):l||k.set(t.logicalSectionId,{label:t.label,semanticSignature:d})}let S=t.holes??[];if(!Array.isArray(S)||S.length>64){e.push({severity:"error",code:"invalid-section-hole",message:`Section "${t.label}" has an invalid opening collection`,objectId:t.id});continue}let c=-1;for(let d=0;d<S.length;d++){let l=S[d];if(!Array.isArray(l)||l.length>512||!B(l)||Math.abs(z(l))<=1e-7||V(l)){c=d;break}if(!l.flatMap((h,x)=>{let $=l[(x+1)%l.length];return[h,{x:(h.x+$.x)/2,y:(h.y+$.y)/2}]}).every(h=>G(h,t.outline))){c=d;break}}if(c>=0)e.push({severity:"error",code:"invalid-section-hole",message:`Section "${t.label}" has an opening outside its outline or with an invalid shape`,objectId:t.id,holeIndex:c});else if(S.some((d,l)=>S.slice(l+1).some(v=>J(d,v)))){let d=S.findIndex((l,v)=>S.slice(v+1).some(h=>J(l,h)));e.push({severity:"error",code:"overlapping-section-holes",message:`Section "${t.label}" has overlapping openings`,objectId:t.id,holeIndex:d})}}let N=o.floors?.length?o.floors.map(t=>t.objects):[o.objects];for(let t of N){let S=t.filter(c=>c.type==="section");for(let c of t.filter(d=>d.type==="text")){let d=c.iconKey;d!==void 0&&!He(d)&&e.push({severity:"error",code:"invalid-icon-key",message:`Venue icon "${c.text||c.id}" references an unknown symbol`,objectId:c.id});let l=c.fontFamily;l!==void 0&&(typeof l!="string"||l.normalize("NFKC").trim()!==l||l.length<1||l.length>120)&&e.push({severity:"error",code:"invalid-text-font-family",message:`Text "${c.text||c.id}" font family must contain 1 to 120 normalized characters`,objectId:c.id});let v=c.background;(c.width!==void 0&&(!Number.isFinite(c.width)||c.width<40||c.width>1200)||c.align!==void 0&&!["left","center","right"].includes(c.align)||c.lineHeight!==void 0&&(!Number.isFinite(c.lineHeight)||c.lineHeight<.8||c.lineHeight>3)||c.letterSpacing!==void 0&&(!Number.isFinite(c.letterSpacing)||c.letterSpacing<-2||c.letterSpacing>20)||c.opacity!==void 0&&(!Number.isFinite(c.opacity)||c.opacity<.1||c.opacity>1)||v!==void 0&&(!/^#[0-9a-f]{6}$/i.test(v.color)||v.padding!==void 0&&(!Number.isFinite(v.padding)||v.padding<0||v.padding>40)||v.cornerRadius!==void 0&&(!Number.isFinite(v.cornerRadius)||v.cornerRadius<0||v.cornerRadius>40)||v.opacity!==void 0&&(!Number.isFinite(v.opacity)||v.opacity<.1||v.opacity>1)))&&e.push({severity:"error",code:"invalid-text-layout",message:`Text "${c.text||c.id}" has invalid width, spacing, opacity, alignment, or background layout`,objectId:c.id})}for(let c of t.filter(d=>d.type==="shape")){if(c.eventConfigurationIds!==void 0){let v=c.eventConfigurationIds;Array.isArray(v)&&v.length>0&&v.length<=20&&v.every(x=>typeof x=="string"&&x.normalize("NFKC").trim()===x&&x.length>=1&&x.length<=100)&&new Set(v).size===v.length||e.push({severity:"error",code:"invalid-shape-configurations",message:`Shape "${c.label||c.id}" must reference 1 to 20 unique event configuration ids`,objectId:c.id})}if(c.heightM!==void 0&&(!Number.isFinite(c.heightM)||c.heightM<.05||c.heightM>50)&&e.push({severity:"error",code:"invalid-shape-height",message:`Shape "${c.label||c.id}" height must be between 0.05 m and 50 m`,objectId:c.id}),c.stroke!==void 0&&(!c.stroke||typeof c.stroke.color!="string"||!/^#[0-9a-f]{6}$/i.test(c.stroke.color)||!Number.isFinite(c.stroke.width)||c.stroke.width<.5||c.stroke.width>40)&&e.push({severity:"error",code:"invalid-shape-stroke",message:`Shape "${c.label||c.id}" stroke must use a six-digit color and width from 0.5 to 40 chart units`,objectId:c.id}),(c.lineCap!==void 0||c.lineJoin!==void 0||c.startEnding!==void 0||c.endEnding!==void 0)&&!ve(c.kind)?e.push({severity:"error",code:"invalid-shape-line-style-applicability",message:`Shape "${c.label||c.id}" may use line caps, joins, and end decorations only when it is an open line or polyline`,objectId:c.id}):ve(c.kind)&&(c.lineCap!==void 0&&!Xe.includes(c.lineCap)||c.lineJoin!==void 0&&!Ye.includes(c.lineJoin)||c.startEnding!==void 0&&!he.includes(c.startEnding)||c.endEnding!==void 0&&!he.includes(c.endEnding))&&e.push({severity:"error",code:"invalid-shape-line-style",message:`Shape "${c.label||c.id}" has an unsupported line cap, join, or ending`,objectId:c.id}),c.kind==="polygon"){let v=nt(c.points??[]);v.ok||e.push({severity:"error",code:"invalid-shape-polygon",message:`Shape "${c.label||c.id}" has invalid polygon geometry: ${v.message}`,objectId:c.id})}let l=ct(c);if(l){for(let v of S)if(st(l,v.outline)){e.push({severity:"error",code:"reference-focal-overlaps-section",message:`Reference focal area "${c.label??c.id}" overlaps section "${v.label}"`,objectId:c.id});break}}}}C>me&&e.push({severity:"error",code:"inventory-capacity-exceeded",message:`Chart has ${C} bookable units; the maximum is ${me}`}),e.push(...I.slice(0,5)),I.length>5&&e.push({severity:"error",code:"duplicate-seat-label",message:`${I.length} seats share a label with another seat; the first 5 are listed above. Seat labels must be unique across the whole chart.`});for(let t of ie(o)){let S=t.families[0]?.targets[0];n.push({severity:"warning",code:"category-inventory-family-conflict",message:et(t),categoryKey:t.categoryKey,...S?{objectId:S.id,floorId:S.floorId}:{},relatedObjectIds:t.objectIds,categoryInventoryFamilies:t.families})}o.focalPoint||n.push({severity:"warning",code:"missing-focal-point",message:"Chart has no focal point set"}),w===0&&n.push({severity:"warning",code:"no-bookables",message:"Chart has no rows, tables, booths, or GA areas"});for(let t of y)if(s.get(t)===!1){let S=o.categories.find(c=>c.key===t);n.push({severity:"warning",code:"unpriced-category",message:`Category "${S?.label??t}" is used but has no price`,categoryKey:t})}return[...e,...n]}var Qt=9,It="#f7f8fb",qt="#f5f6f8",wt="#8b93a7",Ht="#0b1220",Xt="#0b1220",Yt="#ffffff",Wt=100;function E(o,e=2){let n=10**e;return Math.round(o*n)/n}function R(o){return{source:"quality",...o}}function Zt(o){return o.code==="missing-focal-point"||o.code==="missing-zone-focal-point"?"navigation":"structure"}function Ce(o){return Qt*qe(o.theme?.seatScale)}function St(o){let e=[];for(let n of o.objects)n.type==="row"?e.push(...D(n)):n.type==="table"&&e.push(...Y(n));return e}function Jt(o){let e={rowSeats:0,tableSeats:0,booths:0,gaCapacity:0};for(let n of o)for(let i of n.objects)i.type==="row"?e.rowSeats+=D(i).length:i.type==="table"?e.tableSeats+=Y(i).length:i.type==="booth"?e.booths+=1:i.type==="gaArea"&&(e.gaCapacity+=Math.max(0,Math.floor(i.capacity)));return{inventoryByKind:e,bookableUnits:e.rowSeats+e.tableSeats+e.booths+e.gaCapacity}}function L(o,e){o.filter(n=>n.code===e.code).length<Wt&&o.push(e)}function eo(o,e,n){let i=Ce(o),r=2*i,s=2.3*i,y=0,f=0,m=1/0;for(let a of e){let u=new Map(a.objects.filter(w=>w.type==="row").map(w=>[w.id,w])),g=w=>{let C=a.objects.find(T=>T.id===w);if(!C||C.type!=="row"&&C.type!=="table")return"another seating object";let O=C.type==="row"?D(C):Y(C),j=O.length?{x:O.reduce((T,N)=>T+N.x,0)/O.length,y:O.reduce((T,N)=>T+N.y,0)/O.length}:C.type==="row"?C.origin:C.center,P=a.objects.find(T=>T.type==="section"&&W(j,T.outline,T.holes)),M=C.type==="row"?`Row \u201C${C.label}\u201D`:`Table \u201C${C.label}\u201D`;return P?.type==="section"?`${M} in \u201C${P.label}\u201D`:M},p=St(a);y+=p.length;let b=s,I=new Map,k=new Map;for(let w of p){let C=Math.floor(w.x/b),O=Math.floor(w.y/b);for(let M=-1;M<=1;M++)for(let T=-1;T<=1;T++){let N=I.get(`${C+M}:${O+T}`)??[];for(let t of N){f++;let S=Math.hypot(w.x-t.x,w.y-t.y);if(m=Math.min(m,S),S>=s)continue;let d=(w.rowId<t.rowId?[w.rowId,t.rowId]:[t.rowId,w.rowId]).join("|"),l=k.get(d);(!l||S<l.distance)&&k.set(d,{a:w,b:t,distance:S})}}let j=`${C}:${O}`,P=I.get(j)??[];P.push(w),I.set(j,P)}for(let w of k.values()){let C=w.a.rowId===w.b.rowId,O=u.get(w.a.rowId),j=u.get(w.b.rowId),P=!C&&O?.segmentedRow?.repeatLabelOnComponents===!0&&j?.segmentedRow?.repeatLabelOnComponents===!0&&O.segmentedRow.groupId===j.segmentedRow.groupId,M=!!O?.referenceScan&&!!j?.referenceScan&&O.referenceScan.assetId===j.referenceScan.assetId&&O.referenceScan.sectionId===j.referenceScan.sectionId,T=w.distance<r?"error":"warning";if((P||M)&&T==="warning")continue;let N=T==="error"?"seat-overlap":"seat-cramped",t=g(w.a.rowId),S=g(w.b.rowId),c=E(T==="error"?r:s);L(n,R({severity:T,code:N,dimension:"geometry",title:C?`${t} has seats too close together`:`${t} and ${S} are too close together`,message:`The closest seats are ${E(w.distance)} chart units apart; at least ${c} are required.`,action:C?`Increase the seat spacing for ${t}, or use Review safe fixes.`:`Move ${t} or ${S} until they no longer overlap.`,objectId:w.a.rowId,relatedObjectIds:C?[w.a.rowId]:[w.a.rowId,w.b.rowId],floorId:a.id,measured:E(w.distance),minimum:E(T==="error"?r:s),autoFixable:C}))}}return{seats:y,checkedSeatPairs:f,minimumSeatDistance:Number.isFinite(m)?E(m):null}}function se(o){let{width:e,height:n}=$e(o);if(!o.rotation)return{x:o.position.x,y:o.position.y,width:e,height:n};let i=[{x:0,y:0},{x:e,y:0},{x:e,y:n},{x:0,y:n}].map(r=>{let s=ke(r,o.rotation);return{x:o.position.x+s.x,y:o.position.y+s.y}});return Ve(i)}function xt(o,e,n=0){return o.x<e.x+e.width+n&&o.x+o.width+n>e.x&&o.y<e.y+e.height+n&&o.y+o.height+n>e.y}function xe(o,e,n){let i=te(e.x,o.x,o.x+o.width),r=te(e.y,o.y,o.y+o.height);return(e.x-i)**2+(e.y-r)**2<n**2}function to(o,e,n){let i=Ce(o),r=0;for(let s of e){let y=s.objects.filter(m=>m.type==="text"),f=St(s);r+=y.length;for(let m=0;m<y.length;m++){let a=y[m],u=se(a),g=f.find(p=>xe(u,p,i));g&&L(n,R({severity:"warning",code:"label-collision",dimension:"labels",message:`Text \u201C${a.text}\u201D overlaps seat ${g.label}`,objectId:a.id,relatedObjectIds:[a.id,g.rowId],floorId:s.id,autoFixable:!0}));for(let p=0;p<m;p++){let b=y[p];xt(u,se(b),2)&&L(n,R({severity:"warning",code:"label-collision",dimension:"labels",message:`Text \u201C${a.text}\u201D overlaps text \u201C${b.text}\u201D`,objectId:a.id,relatedObjectIds:[a.id,b.id],floorId:s.id,autoFixable:!0}))}}}return r}function Se(o){return o.normalize("NFKC").trim().toLowerCase().replace(/\s+/g," ")}function oo(o,e,n){let i=new Map;for(let f of e)for(let m of f.objects){let a=m.type,u=a==="row"||a==="table"||a==="booth"||a==="gaArea",g=u||a==="section";if(u&&!m.categoryKey.trim()){let p=a==="gaArea"?"GA area":a==="row"?"Row":a==="table"?"Table":"Booth";L(n,R({severity:"warning",code:"object-uncategorized",dimension:"structure",title:`${p} \u201C${m.label||m.id}\u201D has no category`,message:`${p} \u201C${m.label||m.id}\u201D is not assigned to any category, so buyers see no price or colour for it.`,action:"Assign a category to this object in the inspector, or create one in the Categories tab first.",objectId:m.id,floorId:f.id,autoFixable:!1}))}if(g){let p=(m.type==="section"?m.displayLabel??m.label:m.label)??"";if(p.trim()){if(a==="table"||a==="booth"||a==="gaArea"){let b=Se(p),I=i.get(b);I&&I.raw!==p?L(n,R({severity:"warning",code:"duplicate-object-label-normalized",dimension:"labels",title:`\u201C${p}\u201D and \u201C${I.raw}\u201D read as the same label`,message:`Labels \u201C${p}\u201D and \u201C${I.raw}\u201D differ only by case, spacing, or accents, so buyers cannot tell them apart.`,action:"Make the two labels visibly distinct.",objectId:m.id,relatedObjectIds:[m.id,I.id],floorId:f.id,autoFixable:!1})):I||i.set(b,{id:m.id,raw:p})}}else{let b=a==="gaArea"?"A GA area":a==="section"?"A section":a==="row"?"A row":a==="table"?"A table":"A booth";L(n,R({severity:"warning",code:"object-unlabeled",dimension:"labels",title:`${b} has no label`,message:`${b} has an empty label; buyers rely on labels to identify what they are booking.`,action:"Give this object a short, unique label in the inspector.",objectId:m.id,floorId:f.id,autoFixable:!1}))}}}let r=[];for(let f of e){let m=f.objects.filter(a=>a.type==="row"||a.type==="table"||a.type==="booth"||a.type==="gaArea");for(let a of f.objects)if(!(a.type!=="section"||a.referenceInventoryExclusion||m.some(g=>W(oe(g),a.outline,a.holes)))){if(a.referenceSource){r.push({id:a.id,floorId:f.id});continue}L(n,R({severity:"warning",code:"empty-section",dimension:"structure",title:`Section \u201C${a.displayLabel??a.label}\u201D is empty`,message:`Section \u201C${a.displayLabel??a.label}\u201D contains no rows, tables, booths, or GA areas.`,action:"Add seating inside this section (Fill with rows), or remove the empty section.",objectId:a.id,floorId:f.id,autoFixable:!1}))}}r.length&&L(n,R({severity:"warning",code:"empty-section",dimension:"structure",title:r.length===1?"1 traced section has no seating yet":`${r.length} traced sections have no seating yet`,message:`${r.length} section${r.length===1?"":"s"} traced from the reference image contain${r.length===1?"s":""} no rows, tables, booths, or GA areas.`,action:"Fill them with rows, or remove the ones the venue does not sell.",objectId:r[0].id,relatedObjectIds:r.map(f=>f.id),floorId:r[0].floorId,autoFixable:!1}));let s=new Map,y=new Map;for(let f of e){let m=[];for(let a of f.objects)a.type!=="section"||a.outline.length<3||m.push({id:a.logicalSectionId??a.id,outline:a.outline,...a.holes?{holes:a.holes}:{},bounds:so(a.outline)});for(let a of f.objects){if(a.type!=="row")continue;let u=(a.segmentedRow?.displayLabel??a.displayLabel??a.label??"").trim(),g=(a.displayType??"").trim(),p=u&&g&&Se(g)!=="row"?`${g} ${u}`:u,b="";if(m.length){let C=oe(a),O=m.find(j=>C.x>=j.bounds.minX&&C.x<=j.bounds.maxX&&C.y>=j.bounds.minY&&C.y<=j.bounds.maxY&&W(C,j.outline,j.holes));O&&(b=O.id)}let I=`${f.id}\0${b}\0${Se(p)}`,k=a.segmentedRow?.groupId??a.id;if(!p){let C=`${f.id}\0${b}`,O=y.get(C);O?(O.ids.push(a.id),O.logical.set(k,[...O.logical.get(k)??[],a])):y.set(C,{ids:[a.id],logical:new Map([[k,[a]]]),floorId:f.id});continue}let w=s.get(I);w?(w.ids.push(a.id),w.logical.set(k,[...w.logical.get(k)??[],a])):s.set(I,{ids:[a.id],logical:new Map([[k,[a]]]),floorId:f.id,raw:p})}}for(let{ids:f,logical:m,floorId:a,raw:u}of s.values()){let g=m.size;g<2||pt([...m.values()])&&L(n,R({severity:"warning",code:"duplicate-row-label",dimension:"labels",title:`${g} rows share the name \u201C${u}\u201D`,message:`${g} rows share the label \u201C${u}\u201D, so buyers cannot tell which row a seat belongs to.`,action:"Rename them so each row reads differently \u2014 for example the section or box each belongs to.",objectId:f[0],relatedObjectIds:f,floorId:a,autoFixable:!1}))}for(let{ids:f,logical:m,floorId:a}of y.values()){let u=m.size;u<2||pt([...m.values()])&&L(n,R({severity:"warning",code:"unnamed-row-collision",dimension:"labels",title:`${u} rows have no name`,message:`${u} rows in the same area have no name and repeat each other\u2019s seat numbers, so buyers cannot tell which row a seat belongs to.`,action:"Give each of these rows a name \u2014 for example the box each belongs to \u2014 so a ticket can say which row a seat is in.",objectId:f[0],relatedObjectIds:f,floorId:a,autoFixable:!1}))}if(o.floors&&o.floors.length>1)for(let f of o.floors)f.objects.length===0&&L(n,R({severity:"warning",code:"unused-floor",dimension:"structure",title:`Floor \u201C${f.name}\u201D is empty`,message:`Floor \u201C${f.name}\u201D has no objects on it.`,action:"Add seating to this floor, or delete it from the floor list below the canvas.",floorId:f.id,autoFixable:!1}))}var no=5,io=16;function ro(o,e,n){for(let i of e){let r=i.focalPoint??o.focalPoint;if(r)for(let s of i.objects){if(s.type!=="section"||s.outline.length<3)continue;let{rake:y}=Re(s);if(y<no)continue;let f=s.outline.map(p=>Math.hypot(p.x-r.x,p.y-r.y)),m=Math.max(...f);if(m<=0)continue;let a=(m-Math.min(...f))/m;if(y*a<=io)continue;let g=s.displayLabel??s.label;L(n,R({severity:"warning",code:"section-rake-inconsistent",dimension:"geometry",title:`Section \u201C${g}\u201D is too deep for a single rake`,message:`Section \u201C${g}\u201D spans ${Math.round(a*100)}% of its distance to the stage at a ${Math.round(y)}\xB0 rake, so one rake can't represent its sightlines faithfully \u2014 a real tier this deep changes slope at a cross-aisle.`,action:"Split this section at the cross-aisle into two sections, each with its own rake.",objectId:s.id,floorId:i.id,autoFixable:!1}))}}}function ao(o,e,n){let i=o.theme?.background??It,r=qt,s=new Map;for(let a of e)for(let u of a.objects){if(u.type!=="gaArea")continue;let g=s.get(u.categoryKey)??[];g.push({id:u.id,floorId:a.id}),s.set(u.categoryKey,g)}for(let a of o.categories){let u=F(a.color,i),g=F(a.color,r);if(u==null||g==null){L(n,R({severity:"error",code:"invalid-category-color",dimension:"contrast",message:`Category \u201C${a.label}\u201D does not use a supported hex color`,categoryKey:a.key}));continue}let p=Math.min(u,g);p<3&&L(n,R({severity:"warning",code:"category-contrast-low",dimension:"contrast",title:`Category \u201C${a.label}\u201D is hard to see`,message:`Category \u201C${a.label}\u201D reaches only ${E(p)}:1 across dark and light chart backgrounds; 3:1 is required`,action:`Choose a lighter or darker color for \u201C${a.label}\u201D until this warning clears.`,categoryKey:a.key,measured:E(p),minimum:3,autoFixable:!1}));let b=s.get(a.key)??[];if(b.length){let I=pe(a.color,i,be),k=pe(a.color,r,be),w=Math.min(F(I,i)??0,F(k,r)??0);w<3&&L(n,R({severity:"warning",code:"ga-contrast-low",dimension:"contrast",message:`GA category \u201C${a.label}\u201D reaches only ${E(w)}:1 after its rendered opacity is composited; 3:1 is required`,objectId:b[0].id,categoryKey:a.key,floorId:b[0].floorId,relatedObjectIds:b.map(C=>C.id),measured:E(w),minimum:3,autoFixable:!1}))}}for(let a=0;a<o.categories.length;a++)for(let u=0;u<a;u++){let g=o.categories[a],p=o.categories[u],b=De(g.color,p.color);b!=null&&b<25&&L(n,R({severity:"warning",code:"category-colors-too-similar",dimension:"contrast",title:`\u201C${g.label}\u201D and \u201C${p.label}\u201D look too similar`,message:`Categories \u201C${g.label}\u201D and \u201C${p.label}\u201D are only \u0394E ${E(b)} apart; 25 is required`,action:"Pick a visibly different color for either category so buyers can tell them apart.",categoryKey:g.key,measured:E(b),minimum:25,autoFixable:!1}))}for(let a of e){let u=a.objects.filter(g=>g.type==="text");for(let g of u){let p=g.color??o.theme?.textColor??wt,b=F(p,i),I=g.fontSize>=18?3:4.5;(b==null||b<I)&&L(n,R({severity:"warning",code:"text-contrast-low",dimension:"contrast",message:`Text \u201C${g.text}\u201D has ${E(b??0)}:1 contrast against the chart background; ${I}:1 is required`,objectId:g.id,floorId:a.id,measured:E(b??0),minimum:I,autoFixable:!0}))}}if(o.theme?.selectionColor){let a=F(o.theme.selectionColor,i);(a==null||a<3)&&L(n,R({severity:"warning",code:"selection-contrast-low",dimension:"contrast",title:"The selection color is hard to see",message:`Selection rings have ${E(a??0)}:1 contrast against the chart background; 3:1 is required.`,action:"In Theme, choose a Selection color that stands out clearly from the Background color.",measured:E(a??0),minimum:3,autoFixable:!1}))}if(o.theme?.textColor){let a=F(o.theme.textColor,i);(a==null||a<3)&&L(n,R({severity:"warning",code:"theme-text-contrast-low",dimension:"contrast",title:"The theme text color is hard to read",message:`Theme text has ${E(a??0)}:1 contrast against the chart background; 3:1 is required.`,action:"In Theme, choose a Text color with stronger contrast against the Background color.",measured:E(a??0),minimum:3,autoFixable:!1}))}let y=o.theme?.seatLabelColor??Ht,f=new Map,m=(a,u,g)=>{let p=f.get(a)??new Map,b=p.get(u)??[];b.push(g),p.set(u,b),f.set(a,p)};for(let a of e)for(let u of a.objects)if(u.type==="row")for(let g of re(u).keys())m(g,"seat",u.id);else if(u.type==="table")for(let g of re(u).keys())m(g,"table seat",u.id);else u.type==="booth"&&m(u.categoryKey,"booth",u.id);for(let a of o.categories){let u=f.get(a.key);if(u)for(let[g,p]of u){let b=g==="booth"?Be:Ke,I=Ue(ze,600),k=Ge(a.color,y),w=F(k,a.color);(w==null||w<I)&&L(n,R({severity:"warning",code:"bookable-label-contrast-low",dimension:"contrast",message:`${g==="booth"?"Booth":g==="seat"?"Seat":"Table-seat"} labels use ${b}u type and have ${E(w??0)}:1 contrast on category \u201C${a.label}\u201D; ${I}:1 is required for small text`,objectId:p[0],relatedObjectIds:p,measured:E(w??0),minimum:I,autoFixable:!0}))}}}function pt(o){if(o.length>24)return!0;let e=new Set;for(let n of o){let i=new Set;for(let r of n)for(let s of D(r)){let y=s.label,f=y.lastIndexOf("-");i.add(f>=0?y.slice(f+1):y)}if(!i.size)return!0;for(let r of i)if(e.has(r))return!0;for(let r of i)e.add(r)}return!1}function so(o){let e=1/0,n=1/0,i=-1/0,r=-1/0;for(let s of o)s.x<e&&(e=s.x),s.y<n&&(n=s.y),s.x>i&&(i=s.x),s.y>r&&(r=s.y);return{minX:e,minY:n,maxX:i,maxY:r}}function co(o,e){for(let n of o){let i=n.objects.filter(r=>r.type==="section");if(!(i.length<2))for(let r of n.objects){if(!(r.type==="row"||r.type==="table"||r.type==="booth"||r.type==="gaArea"))continue;let y=oe(r),f=i.filter(b=>W(y,b.outline,b.holes)),m=new Map;for(let b of f){let I=b.logicalSectionId??b.id,k=m.get(I)??[];k.push(b),m.set(I,k)}if(m.size<2)continue;let a=[...m.values()],u=a.map(b=>`Section \u201C${b[0].displayLabel??b[0].label}\u201D`),g=u.length===2?u.join(" and "):`${u.slice(0,-1).join(", ")}, and ${u[u.length-1]}`,p=r.type==="gaArea"?"GA area":r.type==="row"?"Row":r.type==="table"?"Table":"Booth";L(e,R({severity:"warning",code:"ambiguous-section-ownership",dimension:"structure",title:`${p} \u201C${r.label}\u201D belongs to more than one section`,message:`${p} \u201C${r.label}\u201D has its center inside ${g}, so its buyer section is unclear.`,action:"Adjust the boundaries until this object sits in one Section. If the overlapping shapes are meant to form one Section, combine them first.",objectId:r.id,relatedObjectIds:[r.id,...a.flatMap(b=>b.map(I=>I.id))],floorId:n.id,autoFixable:!1}))}}}var lo={structure:20,geometry:30,contrast:25,labels:15,navigation:10},uo={"seat-overlap":15,"seat-cramped":4,"label-collision":4,"category-contrast-low":3,"ga-contrast-low":3,"category-colors-too-similar":3,"invalid-category-color":10,"text-contrast-low":4,"bookable-label-contrast-low":3,"selection-contrast-low":3,"theme-text-contrast-low":3,"missing-focal-point":10,"object-uncategorized":3,"object-unlabeled":3,"duplicate-object-label-normalized":2,"empty-section":2,"unused-floor":2,"ambiguous-section-ownership":4,"category-inventory-family-conflict":10};function fo(o){let e={...lo};for(let r of o){let s=r.severity==="error"?10:2;e[r.dimension]=Math.max(0,e[r.dimension]-(uo[r.code]??s))}let n=Object.values(e).reduce((r,s)=>r+s,0),i=n>=95?"A":n>=85?"B":n>=70?"C":n>=55?"D":"F";return{overall:n,dimensions:e,errorFree:o.every(r=>r.severity!=="error"),grade:i}}var yo=new Set(["unpriced-category","object-uncategorized"]);function ht(o,e={}){let n=ye(o),i=bt(o).filter(u=>u.code!=="missing-zone-focal-point"||e.requireExplicitZoneFocals).map(u=>{let g=u.objectId?n.find(I=>I.objects.some(k=>k.id===u.objectId))?.id:void 0,p=u.code==="category-inventory-family-conflict",b=p?o.categories.find(I=>I.key===u.categoryKey):void 0;return R({...u,...p?{severity:"error",title:`Category \u201C${b?.label??u.categoryKey??"Unknown"}\u201D spans incompatible inventory types`,action:"Show the affected objects, then review the safe category split. The repair preserves price, ticket tiers, accessibility assignments, and source provenance."}:{},...e.requireExplicitZoneFocals&&u.code==="missing-zone-focal-point"?{severity:"error"}:{},...g?{floorId:g}:{},source:"structural",dimension:Zt(u),autoFixable:p})}),r=eo(o,n,i),s=Jt(n),y=to(o,n,i);if(oo(o,n,i),co(n,i),ro(o,n,i),ao(o,n,i),n.reduce((u,g)=>u+g.objects.filter(p=>p.type==="row"||p.type==="table"||p.type==="booth"||p.type==="gaArea").length,0)===0){let u=new Set(["missing-focal-point","no-bookables"]);for(let g=i.length-1;g>=0;g--)u.has(i[g].code)&&i.splice(g,1)}if(e.requirePricedInventory)for(let u=0;u<i.length;u++)yo.has(i[u].code)&&(i[u]={...i[u],severity:"error"});let m=i.filter(u=>u.severity==="error"),a=i.filter(u=>u.severity==="warning");return{issues:i,errors:m,warnings:a,metrics:{floors:n.length,objects:n.reduce((u,g)=>u+g.objects.length,0),seats:r.seats,bookableUnits:s.bookableUnits,inventoryByKind:s.inventoryByKind,categories:o.categories.length,freeTextLabels:y,checkedSeatPairs:r.checkedSeatPairs,minimumSeatDistance:r.minimumSeatDistance},score:fo(i),deferredRules:["rendered-row-label-decollision","rendered-bookable-state-contrast","section-focus-opacity-and-backdrop","24px-pointer-hit-target","reference-image-diff","sightline-blocked","ga-density-high"]}}function go(o,e){if(o.seatCount<2||o.seatSpacing>=e)return!1;let n=le(D(o));o.seatSpacing=E(e,3);let i=le(D(o));return o.origin.x=E(o.origin.x+n.x-i.x,3),o.origin.y=E(o.origin.y+n.y-i.y,3),!0}function mo(o,e){if(o.seatCount<2)return!1;let n=!1;if(o.shape==="round"){let i=te(o.seatArc??360,0,360),r=(i>=360?360/o.seatCount:i/(o.seatCount-1))*Math.PI/180;if(r>0){let s=e/(2*Math.sin(r/2)),y=Math.max(1,s-16);(o.radius??40)<y&&(o.radius=E(y,3),n=!0)}}else{let i=Me(o),r=Math.max(i.top,i.bottom),s=Math.max(i.left,i.right);r>1&&(o.width??80)/r<e&&(o.width=E(r*e,3),n=!0),s>1&&(o.height??50)/s<e&&(o.height=E(s*e,3),n=!0)}return n}function bo(o){return[Xt,Yt].map(n=>({color:n,minimum:Math.min(...o.map(i=>F(n,i)??0))})).sort((n,i)=>i.minimum-n.minimum)[0].color}function vt(o,e,n){let i=se(o),r=0;for(let s of e)s.type==="row"?r+=D(s).filter(y=>xe(i,y,n)).length:s.type==="table"?r+=Y(s).filter(y=>xe(i,y,n)).length:s.type==="text"&&s.id!==o.id&&xt(i,se(s),2)&&r++;return r}function po(o,e,n){if(vt(o,e,n)===0)return!1;let r={...o.position},s=Math.max(12,o.fontSize*1.25),y=[[0,-1],[1,0],[0,1],[-1,0],[1,-1],[1,1],[-1,1],[-1,-1]];for(let f=1;f<=12;f++)for(let[m,a]of y)if(o.position={x:E(r.x+m*s*f,3),y:E(r.y+a*s*f,3)},vt(o,e,n)===0)return!0;return o.position=r,!1}function on(o){let e=JSON.parse(JSON.stringify(o)),n=ht(e),i=[],r=ot(e);if(r.changed){e=r.doc;for(let u of r.changes){let g=r.before.find(b=>b.categoryKey===u.categoryKey),p=g?.families.map(b=>b.label).join(", ")??"inventory families";i.push({code:"category-inventory-family-conflict",objectId:g?.objectIds[0],message:`Split category \u201C${u.categoryLabel}\u201D across ${p}; preserved its commercial metadata and reassigned ${u.reassignments.length} affected object${u.reassignments.length===1?"":"s"}`})}}let s=Ce(e),y=2.5*s,f=ye(e);for(let u of f)for(let g of u.objects)if(g.type==="row"){let p=g.seatSpacing;go(g,y)&&i.push({code:p<2*s?"seat-overlap":"seat-cramped",objectId:g.id,message:`Expanded ${g.id} to the ${E(y)}u target pitch while preserving its centre`})}else g.type==="table"&&mo(g,y)&&i.push({code:"seat-cramped",objectId:g.id,message:`Expanded ${g.id} so its perimeter seats meet the ${E(y)}u target pitch`});let m=e.theme?.background??It;for(let u of f)for(let g of u.objects){if(g.type!=="text")continue;let p=g.color??e.theme?.textColor??wt,b=g.fontSize>=18?3:4.5;(F(p,m)??0)<b&&(g.color=bo([m]),i.push({code:"text-contrast-low",objectId:g.id,message:`Changed ${g.id} to the highest-contrast black/white ink`}))}for(let u of f){let g=u.objects.filter(p=>p.type==="text");for(let p of g)po(p,u.objects,s)&&i.push({code:"label-collision",objectId:p.id,message:`Moved ${p.id} to the nearest collision-free deterministic label position`})}e.floors?.length&&(e.objects=e.floors[0].objects);let a=ht(e);return{doc:e,changed:i.length>0,fixes:i,before:n,after:a}}export{Ie as a,re as b,ie as c,et as d,ot as e,vo as f,nt as g,on as h};
@@ -0,0 +1 @@
1
+ import{a as An,c as Pn,d as In}from"./chunk-PRED5KHO.js";import{f as hn,m as gn,o as Nt,p as ft,r as It,u as Rn}from"./chunk-WXGW2SYC.js";import{e as Mn,k as Sn}from"./chunk-UL5OIGIF.js";import{Na as qt,f as bn,ga as ut,ha as lt,qa as Gt,sa as dn,ta as Dt,va as yn,x as pn,y as At,za as xn}from"./chunk-24O23MNB.js";import{A as Pt,d as H,y as nt}from"./chunk-JBOTRSMY.js";import Re from"earcut";import Ae from"polygon-clipping";var g=ut,Pe=.002;function Ie(t,n,e){let i=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=Math.max(i,o,a);if(r<1e-9)return!0;let s=(i+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-i)*(s-o)*(s-a)))/r<Pe}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,i){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=i}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let i=new Float32Array(e);i.set(this.buf.subarray(0,this.len)),this.buf=i}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,i,o,a,r=a,s=a){Ie(n,e,i)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,i,o,a,r,s,l=s,c=s){[...n,...e,...i].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[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 we(t,n,e){let i=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],r=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*r-i*l,m=i*s-o*r,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function _e(t,n){let e=[...t],i=[];for(let r of t)i.push(r.x,r.y);let o=[];if(n){for(let r of n)if(!(r.length<3)){o.push(e.length);for(let s of r)e.push(s),i.push(s.x,s.y)}}let a=Re(i,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Te=3;function Be(t,n,e,i){let o=i(t),a=i(n),r=i(e),s=(h,b,p,y)=>Math.abs(i({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+y)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+r)/3,m=Math.max(s(t,n,o,a),s(n,e,a,r),s(e,t,r,o),Math.abs(i({x:l,y:c})-f)),u=(h,b,p)=>{let y=Math.abs(i({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);y>m&&(m=y)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(r+o)/2),m}function wt(t,n,e,i,o){if(o<=0)return Be(t,n,e,i);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},r={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,i,o-1),wt(a,n,r,i,o-1),wt(s,r,e,i,o-1),wt(a,r,s,i,o-1))}function _t(t,n,e,i,o,a,r,s){if(r>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+i.x)/2,y:(e.y+i.y)/2},b={x:(i.x+n.x)/2,y:(i.y+n.y)/2};_t(t,n,u,b,o,a,r-1,s),_t(t,u,e,h,o,a,r-1,s),_t(t,b,h,i,o,a,r-1,s),_t(t,u,h,b,o,a,r-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[i.x*g,o(i),i.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(i),a);return}let m=we(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Ee=8;function wn(t,n,e){if(!Number.isFinite(e))return t;let i=[],o=(a,r,s,l,c)=>{if(c>0){let f={x:(a.x+r.x)/2,y:(a.y+r.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,r,m,l,c-1);return}}i.push(a)};for(let a=0;a<t.length;a++){let r=t[a],s=t[(a+1)%t.length];o(r,s,n(r),n(s),Ee)}return i}function Xt(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let i=[];for(let o=0;o<e.length;o++){let a=i.length?i[i.length-1]:e[(o-1+e.length)%e.length],r=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((r.x-a.x)*c-(r.y-a.y)*l)/f<n||i.push(r)}return i.length>=3?i:e}var Ut=.001*lt*.1;function K(t,n,e,i,o,a,r,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Xt(wn(Xt(Jt(n),Ut),i,l),Ut),m=e?.map(R=>Xt(wn(Xt(Jt(R),Ut),i,l),Ut)).filter(R=>R.length>=3&&Math.abs(ft(R))>=1e-4),{pts:u,tris:h}=_e(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],y=[r[0]*s.top,r[1]*s.top,r[2]*s.top],d=[r[0]*s.wallBottom,r[1]*s.wallBottom,r[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Te;x++){let R=0;for(let I=0;I<h.length;I+=3){let B=wt(u[h[I]],u[h[I+1]],u[h[I+2]],i,x);B>R&&(R=B)}if(R<=l)break}for(let R=0;R<h.length;R+=3){let I=u[h[R]],B=u[h[R+1]],k=u[h[R+2]];_t(t,I,B,k,i,b,x,c);let D=[I.x*g,o,I.y*g],U=[B.x*g,o,B.y*g],M=[k.x*g,o,k.y*g];t.tri(D,M,U,[0,-1,0],p)}let w=R=>{if(x<=0)return R;let I=1<<x,B=[];for(let k=0;k<R.length;k++){let D=R[k],U=R[(k+1)%R.length];for(let M=0;M<I;M++){let _=M/I;B.push({x:D.x+(U.x-D.x)*_,y:D.y+(U.y-D.y)*_})}}return B},A=pn(f),E=[{ring:w(f),flip:!1}];if(m)for(let R of m)R.length>=3&&E.push({ring:w(R),flip:!0});for(let{ring:R,flip:I}of E)for(let B=0;B<R.length;B++){let k=R[B],D=R[(B+1)%R.length],U=(D.x-k.x)*g,_=(D.y-k.y)*g,N=-U,O=Math.hypot(_,N)||1;_/=O,N/=O;let P=(k.x+D.x)/2-A.x,F=(k.y+D.y)/2-A.y,S=_*P+N*F;I&&(S=-S),S<0&&(_=-_,N=-N);let T=[_,0,N],C=[k.x*g,i(k),k.y*g],v=[D.x*g,i(D),D.y*g],G=[k.x*g,o,k.y*g],X=[D.x*g,o,D.y*g];t.tri(C,v,X,T,y,y,d),t.tri(C,X,G,T,y,d,d)}}function _n(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),i=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),r=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),i.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),r.set(l.material,s),s+=l.count;return{position:e,normal:i,color:o,floor:a,material:r,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let i=Jt(t),o=i.length,a=[];for(let s=0;s<o;s++){let l=i[s],c=i[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let r=[];for(let s=0;s<o;s++){let l=i[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{r.push([l.x+c.x*n,l.y+c.y*n]),r.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>e){b();continue}r.push([l.x+m*n*y,l.y+u*n*y])}if(r.length<3)return t;try{let s=Ae.union([[...r,r[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,i,o=28){let a=[];for(let r=0;r<o;r++){let s=r/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+i*Math.sin(s)})}return a}function Tt(t,n,e,i){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+i},{x:t,y:n+i}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Tn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function cr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,i=.62;return[(n+(t[0]-n)*e)*i,(n+(t[1]-n)*e)*i,(n+(t[2]-n)*e)*i]}var tn={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]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ce=.44,Fe=.15,ve=.3,ke=.24;function Bn(t){return t===void 0||!Number.isFinite(t)||t<=0?ke:Math.min(ve,Math.max(Fe,t*Ce))}var lr=.21,Oe=.05,en=.45,Le=en+Oe,Ge=.92,De=1.205,Ne=-.23,Xe=.38,Ue=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Le,-1],max:[1,Ge,-.72]},{part:V.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:V.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:V.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:V.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:V.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:V.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:V.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ye=[{part:V.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:V.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:V.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:V.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:V.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],je=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function mr(){let t=[],n=[],e=[],i=[],o=(O,P,F)=>{let S=e.length,[T,C,v]=O,G=[C[0]-T[0],C[1]-T[1],C[2]-T[2]],X=[v[0]-T[0],v[1]-T[1],v[2]-T[2]],L=G[1]*X[2]-G[2]*X[1],Y=G[2]*X[0]-G[0]*X[2],j=G[0]*X[1]-G[1]*X[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=P,L*P[0]+Y*P[1]+j*P[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of O)t.push(...z),n.push(L,Y,j),e.push(F);i.push(S,S+1,S+2,S,S+2,S+3)},a=O=>{for(let P of je){let F=P.c.map(S=>S.map((T,C)=>T?O.max[C]:O.min[C]));o(F,P.n,O.part)}};for(let O of Ue)a(O);for(let O of Ye)a(O);let r=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,r,f],p=[l,r,f],y=[-l,r,m],d=[l,r,m],x=[-c,s,u],w=[c,s,u],A=[-c,s,h],E=[c,s,h];o([p,w,E,d],[1,0,0],V.body),o([y,A,x,b],[-1,0,0],V.body),o([A,E,w,x],[0,1,0],V.body),o([b,p,d,y],[0,-1,0],V.body),o([d,E,A,y],[0,0,1],V.body),o([b,x,w,p],[0,0,-1],V.body);let R=10,I=8,B=[0,De,Ne],k=[.42,.115,Xe],D=e.length;for(let O=0;O<=I;O++){let P=Math.PI*O/I,F=Math.cos(P),S=Math.sin(P);for(let T=0;T<=R;T++){let C=Math.PI*2*T/R,v=S*Math.cos(C),G=S*Math.sin(C);t.push(B[0]+k[0]*v,B[1]+k[1]*F,B[2]+k[2]*G);let X=v/k[0],L=F/k[1],Y=G/k[2],j=Math.hypot(X,L,Y)||1;X/=j,L/=j,Y/=j,n.push(X,L,Y),e.push(V.head)}}for(let O=0;O<I;O++)for(let P=0;P<R;P++){let F=D+O*(R+1)+P,S=F+R+1;i.push(F,S,F+1,F+1,S,S+1)}let U=new Float32Array(t),M=new Float32Array(n),_=new Float32Array(e),N=new Uint16Array(i);return{position:U,normal:M,part:_,index:N,vertexCount:e.length,indexCount:i.length}}function En(t,n,e,i){let o=new Float32Array(n),a=c=>t[c*3],r=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=i(u),p=h-a(u),y=b-r(u);if(m>=2){let d=Math.max(c,u-1),x=Math.min(f-1,u+1),w=a(x)-a(d),A=r(x)-r(d),E=Math.hypot(w,A);if(E>1e-6){let R=-A/E,I=w/E;R*p+I*y<0&&(R=-R,I=-I),p=R,y=I}}o[u]=p===0&&y===0?0:Math.atan2(p,y)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function Mr(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let i=(n+1)*2654435761;return i^=i>>>15,i=Math.imul(i,2246822519),i^=i>>>13,(i>>>0)%1e5/1e5}var He=.42;function Ve(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let i=1/0,o=1/0,a=-1/0,r=-1/0;for(let b of t)b.x<i&&(i=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>r&&(r=b.y);let s=Math.max(a-i,1e-6),l=Math.max(r-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let y=Math.min(f-1,Math.max(0,Math.floor((b-i)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+y};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),y=u.get(p);y?y.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],y=Math.min(f-1,Math.max(0,Math.floor((p.x-i)/c))),d=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let w=1;w<=4;w++){for(let A=d-w;A<=d+w;A++)if(!(A<0||A>=m))for(let E=y-w;E<=y+w;E++){if(E<0||E>=f||w>1&&Math.abs(A-d)<w&&Math.abs(E-y)<w)continue;let R=u.get(A*f+E);if(R)for(let I of R){if(I===b)continue;let B=Math.hypot(t[I].x-p.x,t[I].y-p.y);B<x&&(x=B)}}if(Number.isFinite(x)&&x<=w*c)break}e[b]=x}return e}function We(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function Cn(t,n,e,i,o,a){let r=t.length,s=new Float32Array(r*3),l=new Float32Array(r),c=new Float32Array(r*3),f=new Float32Array(r),m=new Float32Array(r),u=new Float32Array(r),h=new Float32Array(r),b=new Float32Array(r*3),p=new Map,y=Ve(t);for(let d=0;d<r;d++){let x=t[d],A=(e?.seatPitchU(d)??y[d])*g;f[d]=Number.isFinite(A)?Math.max(.06,Math.min(Vt,A*He)):Vt,m[d]=Bn(Number.isFinite(A)?A:void 0);let E=Sn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[d]=Mn.indexOf(E),h[d]=x.wheelchairSpaceType==="no-seat"?0:1,s[d*3]=x.x*g,s[d*3+1]=e?e.seatDeckY(d):We(x),s[d*3+2]=x.y*g,l[d]=Qt(n?n(x):"available");let R=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[d*3]=R[0],c[d*3+1]=R[1],c[d*3+2]=R[2],x.accessibility?.length){let I=H(hn(x.accessibility));I&&(b[d*3]=I[0],b[d*3+1]=I[1],b[d*3+2]=I[2])}p.set(x.id,d)}return{count:r,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:i??new Float32Array(r),iYaw:new Float32Array(r)}}var ze=64;function Sr(t,n){let e=[];for(let r of n){let s=t.idToIndex.get(r.seatId);if(s===void 0)continue;let l=Qt(r.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((r,s)=>r-s);let i=[],o=e[0],a=e[0];for(let r=1;r<e.length;r++){let s=e[r];if(s!==a){if(s<=a+ze){a=s;continue}i.push({start:o,length:a-o+1}),o=s,a=s}}return i.push({start:o,length:a-o+1}),i}function Pr(t,n,e){return e<0?n>1?t.filter(i=>i.kind==="floor"):[...t]:t.filter(i=>i.floorIndex===void 0||i.floorIndex===e)}function Ir(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),i=[];for(let o of e){let a=i.find(r=>r.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):i.push([o])}return i.flatMap(o=>o.length<2?o:o.map((a,r)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(r-(o.length-1)/2)*104))}})))}var Ze=1.15,Ke=2.75,$e=4.5,qe=.85,Je=.5,Qe=.26;function wr(t,n,e){let i=Math.max(1e-6,n),o=t/i,a=e?.hasZoneLabels??!0,r=new Set;return o>=.75&&r.add("floor"),o>=Ze&&r.add("zone"),o<=(a?Ke:$e)&&(r.add("section"),r.add("ga")),o<=qe&&(r.add("annotation"),r.add("booth")),o<=Je&&r.add("row"),o<=Qe&&r.add("seat"),r}function _r(t,n,e,i,o,a=6){let r=a+n,s=i-a-n,l=a+e,c=o-a-e;return{...t,x:r>s?i/2:Math.max(r,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Tr(t,n,e,i){let o=t,a=n[0],r=n[1],s=n[2],l=o[0]*a+o[4]*r+o[8]*s+o[12],c=o[1]*a+o[5]*r+o[9]*s+o[13],f=o[2]*a+o[6]*r+o[10]*s+o[14],m=o[3]*a+o[7]*r+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*i,depth:b,visible:p}}function Br(t,n,e=n){let i=[],o=[...t].sort((a,r)=>a.screen.depth-r.screen.depth);for(let a of o){let r=!1;for(let s of i)if(on(a,s,n,e)){r=!0;break}r||i.push(a)}return i}var to=6;function on(t,n,e,i){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),r=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+to):e;return o<r&&a<i}function Er(t,n,e){return t.length*n*.58+(e?14:0)}var no={row:8,seat:14};function Cr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:no}function Fr(t,n,e,i){let o=Math.max(1,Math.min(e,i)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-i/2)/o);return n*(1+1.5*a)}function vr(t,n,e,i,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),r=[];for(let s of a){if(r.length>=i)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of r)if(on(s,c,n,e)){l=!0;break}}l||r.push(s)}return r}var eo=.15,oo=.9,ro=1.76;function io(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Tn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Fn(t){let n=io();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,oo),bottom:et(e,ro)};let r={};for(let[s,l]of Object.entries(tn))r[s]=nt(l,e,eo);n.structure=r}let i=H(t.selectionColor)??H(t.accent);i&&(n.seatStates={...n.seatStates,selected:i});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Rn(o));let a=t.venue3d;if(a){let r=H(a.deck),s=H(a.fascia);r&&(n.structure={...n.structure,tierTop:r,gaTop:r}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function vn(t,n){let e=[];for(let i of n)e.push(...t.seatStates[i]);return e}import Gn from"polygon-clipping";import so from"earcut";var ao=.58,kn=.01,ot=Vt*1.5*lt,co=.5,uo=.6;function lo(t,n){let e=t.length,i=[];for(let r=0;r<e;r++){let s=t[Math.max(0,r-1)],l=t[Math.min(e-1,r+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){i.push([0,0]);continue}c/=m,f/=m,i.push([-f,c])}let o=0;for(let r=0;r<e;r++)o+=(t[r].x-n.x)*i[r][0]+(t[r].y-n.y)*i[r][1];return o<0?i.map(([r,s])=>[-r,-s]):i}function mo(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],i=(r,s)=>{let l=s.x-r.x,c=s.y-r.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=i(e[1],e[0]),a=i(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var On=Math.PI/12;function fo(t){if(t.length<3)return[...t];let n=[...t].sort((a,r)=>a.x-r.x||a.y-r.y),e=(a,r,s)=>(r.x-a.x)*(s.y-a.y)-(r.y-a.y)*(s.x-a.x),i=a=>{let r=[];for(let s of a){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return r.pop(),r},o=[...i(n),...i([...n].reverse())];return o.length>=3?o:[...t]}function Dn(t,n){if(!t.length||!(n>0))return[];let e=fo(t),i=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/On)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/On)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let r=[];for(let s=0;s<o;s++)i(e[s],a[(s+o-1)%o],a[s],r);return jn(r)}function ho(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let i=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],r=t[o+1],s=r.x-a.x,l=r.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<i&&(i=m)}return i}function Wt(t){let n=t.map(o=>{let a=0,r=0;for(let c of o.pts)a+=c.x,r+=c.y;let s=o.pts.length||1;a/=s,r/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-r);f>l&&(l=f)}return{cx:a,cy:r,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},i=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),r=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=ho(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&r.push(m)}r.sort((f,m)=>f-m);let c=r.length?r[Math.floor(r.length/2)]:1;i.push({pitch:c,belowY:l})}return i}function Nn(t,n,e,i){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-i.x,u=f.y-i.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let r=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(r+=m,s++)}let l=s>0?r/s:0,c=mo(a,Math.max(l*uo,ot));return{pts:c,nrm:lo(c,i),front:Math.max(e[n].pitch*ao,ot),back:Math.max(e[n].pitch*co,ot)}}var gt=1.5,Xn=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],i=t[t.length-1],o=i.x-e.x,a=i.y-e.y,r=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=r>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/r:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,i];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Un(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function Yn(t,n,e){if(t.length<2)return[];let i=e??Wt(t),o=new Map;for(let r=0;r<t.length;r++){let s=o.get(t[r].blockId);s?s.push(r):o.set(t[r].blockId,[r])}let a=[];for(let[,r]of o){let s=[];for(let x of r){let w=t[x].patch;w&&w.length>=3?a.push({outline:[...w],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,w)=>t[x].depth-t[w].depth);let c=s.map(x=>Nn(t,x,i,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,w)=>({x:x.pts[w].x-x.nrm[w][0]*(x.front+gt),y:x.pts[w].y-x.nrm[w][1]*(x.front+gt)}),m=(x,w)=>({x:x.pts[w].x+x.nrm[w][0]*(x.back+gt),y:x.pts[w].y+x.nrm[w][1]*(x.back+gt)}),u=c[0],h=c[c.length-1],b=[];for(let x=0;x<u.pts.length;x++)b.push(f(u,x));for(let x of c)b.push(m(x,x.pts.length-1));for(let x=h.pts.length-1;x>=0;x--)b.push(m(h,x));for(let x=c.length-1;x>=0;x--)b.push(f(c[x],0));let p=jn(b),y=1/0;for(let x of s)t[x].y<y&&(y=t[x].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let w=x.pts[Math.floor(x.pts.length/2)];return It(p,w.x,w.y)})){a.push({outline:Un(p,Xn),holes:[],topY:y});continue}for(let x of bo(c))a.push({outline:x,holes:[],topY:y})}return a}function bo(t){let n=[];for(let e of t){let i=[],o=[],a=e.front+gt,r=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];i.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*r,c.y+f[1]*r])}let s=[...i,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Gn.union(n[0],...n.slice(1)),i=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),r=a[0],s=a[a.length-1];a.length>1&&Math.abs(r.x-s.x)<1e-9&&Math.abs(r.y-s.y)<1e-9&&a.pop(),a.length>=3&&i.push(Un(a,Xn))}return i}catch{return[]}}function jn(t){let n=[];for(let e of t){let i=n[n.length-1];i&&Math.hypot(e.x-i.x,e.y-i.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var sn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let i of e)i.x<this.minX&&(this.minX=i.x),i.y<this.minY&&(this.minY=i.y),i.x>this.maxX&&(this.maxX=i.x),i.y>this.maxY&&(this.maxY=i.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let i=!0;for(let o of n)if(!It(e,o.x,o.y)){i=!1;break}if(i)return!0}return!1}};function Ln(t,n,e,i,o,a){if(i.length<3)return;if(e.containsAll(i)){let c=[0,1,0],f=i[0];for(let m=1;m+1<i.length;m++){let u=i[m],h=i[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let r=i.map(c=>[c.x,c.y]);r.push(r[0]);let s;try{s=Gn.intersection([r],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=so(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],y=u[h[b+1]],d=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[y[0]*g,o,y[1]*g],[d[0]*g,o,d[1]*g],l,a)}}}function Hn(t,n,e,i,o,a,r){if(n.length<2)return;let s=r??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let E=[...b.patch],R=s[h].belowY??i;if(u(()=>{if(c&&f)Ln(t,c,f,E,b.y,o.tread);else{let I=E[0];for(let B=1;B+1<E.length;B++){let k=E[B],D=E[B+1];t.tri([I.x*g,b.y,I.y*g],[k.x*g,b.y,k.y*g],[D.x*g,b.y,D.y*g],l,o.tread)}}}),b.y>R+kn){let I=0,B=0;for(let k of E)I+=k.x,B+=k.y;I/=E.length,B/=E.length,m(()=>{for(let k=0;k<E.length;k++){let D=E[k],U=E[(k+1)%E.length],M=U.x-D.x,_=U.y-D.y,N=Math.hypot(M,_);if(N<1e-6)continue;let O=_/N,P=-M/N;(D.x-I)*O+(D.y-B)*P<0&&(O=-O,P=-P);let F=[O,0,P],S=[D.x*g,b.y,D.y*g],T=[U.x*g,b.y,U.y*g],C=[D.x*g,R,D.y*g],v=[U.x*g,R,U.y*g];t.tri(S,T,v,F,o.riser),t.tri(S,v,C,F,o.riser)}})}continue}let p=Nn(n,h,s,e);if(!p)continue;let{pts:y,nrm:d,front:x,back:w}=p,A=s[h].belowY??i;for(let E=0;E+1<y.length;E++){let R=y[E],I=y[E+1],B=d[E],k=d[E+1];if(Math.hypot(I.x-R.x,I.y-R.y)<1e-6||B[0]===0&&B[1]===0||k[0]===0&&k[1]===0)continue;let D=[(R.x-B[0]*x)*g,b.y,(R.y-B[1]*x)*g],U=[(I.x-k[0]*x)*g,b.y,(I.y-k[1]*x)*g],M=[(R.x+B[0]*w)*g,b.y,(R.y+B[1]*w)*g],_=[(I.x+k[0]*w)*g,b.y,(I.y+k[1]*w)*g];if(u(()=>{c&&f?Ln(t,c,f,[{x:R.x-B[0]*x,y:R.y-B[1]*x},{x:I.x-k[0]*x,y:I.y-k[1]*x},{x:I.x+k[0]*w,y:I.y+k[1]*w},{x:R.x+B[0]*w,y:R.y+B[1]*w}],b.y,o.tread):(t.tri(D,U,_,l,o.tread),t.tri(D,_,M,l,o.tread))}),b.y>A+kn){let N=[D[0],A,D[2]],O=[U[0],A,U[2]],P=[-B[0],0,-B[1]];m(()=>{t.tri(D,U,O,P,o.riser),t.tri(D,O,N,P,o.riser)})}}}}import Wn from"polygon-clipping";function po(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Vn(t,n){return t.filter(e=>e.type!=="shape"||po(e,n))}function zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((i,o)=>({objects:Vn(i.objects,n),focal:{x:(i.focalPoint??e).x,y:(i.focalPoint??e).y},baseHeightM:i.baseHeightM??0,index:o})):[{objects:Vn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var yo={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return gn(t)??yo}function Zn(t,n){let e=jt(t.outline,ot),i=Mt(e),o=n.filter(r=>r!==t&&r.outline&&r.outline.length>=3&&Nt(i,Mt(r.outline)));if(!o.length)return[e];let a=r=>{let s=r.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let r=Wn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function Kn(t,n){if(!n.length)return t;let e=a=>{let r=a.map(s=>[s.x,s.y]);return r.push(r[0]),r},i=n.map(a=>[e(a)]),o=[];for(let a of t){let r;try{r=Wn.intersection([e(a.outline)],i.flat())}catch{o.push(a);continue}for(let s of r){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}var xo=.05,$n=.05,go=.15,an=25;function qn(t,n,e){let i=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),r=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(d=>d.id===h.sectionId)??b.find(d=>d.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},d.outline,d.section.holes)):void 0,y=p?[p]:b;for(let d of y){if(e&&d.floorIndex!==e[u]||!p&&(h.x<d.box.minX||h.x>d.box.maxX||h.y<d.box.minY||h.y>d.box.maxY||!qt({x:h.x,y:h.y},d.outline,d.section.holes)))continue;o[u]=d.id;let x=l.get(d.id);x.hasSeats=!0;let w=h.focalPoint??d.unit.focal,A=Math.hypot(h.x-w.x,h.y-w.y);A<x.frontU&&(x.frontU=A),x.seatIndices.push(u);let E=h.rowId||`__seat-${u}`,R=x.rows.get(E);R?R.push({x:h.x,y:h.y}):x.rows.set(E,[{x:h.x,y:h.y}]);break}}for(let[u,h]of l){let b=dn(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=b.rake>0?Math.tan(b.rake*Math.PI/180):0,d=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,w=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:d,A=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},R=A.rows.length<2?An([...h.rows.values()].map(S=>({points:S})),h.unit.focal):null,I=1/0;if(R){if(h.hasSeats)for(let S of h.rows.values())for(let T of S){let C=R.depthAt(T.x,T.y);C<I&&(I=C)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let S of h.section.outline){let T=R.depthAt(S.x,S.y);T<I&&(I=T)}}}let B=p+xo,k=Math.max(B,b.height),D=S=>{let T=Math.max(0,S-I)*ut,C=Math.min(T*y,an);return Math.max(B,b.height+C)},U=S=>{let T=Math.max(0,S)*ut,C=Math.min(T*y,an);return Math.max(B,b.height+C)},M=w?[]:A.rows.map(S=>({pts:S.pts,y:U(S.blockDepth),depth:S.blockDepth,blockId:S.blockId,...f.has(S.id)?{patch:Dn(S.pts,ot)}:{}})),_=M.length?M[0].y:k,N=M.map(S=>{let T=S.patch&&S.patch.length>=3?S.patch:S.pts,C=0,v=0;for(let L of T)C+=L.x,v+=L.y;let G=T.length||1;C/=G,v/=G;let X=0;for(let L of T){let Y=Math.hypot(L.x-C,L.y-v);Y>X&&(X=Y)}return{cx:C,cy:v,rad:X}}),O=w?()=>k:M.length>=2?(S,T)=>{let C=1/0,v=_;for(let G=0;G<M.length;G++){let X=N[G];if(Math.hypot(S-X.cx,T-X.cy)-X.rad>=C)continue;let L=M[G].patch,Y=L&&L.length>=3?It(L,S,T)?0:Dt(L,S,T):Dt(M[G].pts,S,T);Y<C&&(C=Y,v=M[G].y)}return v}:(S,T)=>R?D(R.depthAt(S,T)):k,P=[0,1,0],F=M.length>=2||w?()=>P:(S,T)=>{if(!R)return P;let C=R.depthAt(S,T);if(C<=I)return P;let v=(C-I)*ut;if(v*y>=an||b.height+v*y<=B)return P;let[G,X]=R.gradientAt(S,T);if(G===0&&X===0)return P;let L=1/Math.hypot(y,1);return[-G*y*L,L,-X*y*L]};if(!w)for(let S of A.rows){let T=U(S.blockDepth);for(let C of S.seatIndices)r[C]=T}for(let S of A.rows){let T=[];for(let L=1;L<S.pts.length;L++){let Y=Math.hypot(S.pts[L].x-S.pts[L-1].x,S.pts[L].y-S.pts[L-1].y);Y>1e-6&&T.push(Y)}T.sort((L,Y)=>L-Y);let C=T.length?T[Math.floor(T.length/2)]:1/0,v=1/0,G=S.pts[Math.floor(S.pts.length/2)];if(G)for(let L of A.rows){if(L===S||L.blockId!==S.blockId)continue;let Y=Dt(L.pts,G.x,G.y);Y>1e-6&&Y<v&&(v=Y)}let X=Math.min(C,Math.max(v,C*.5));if(Number.isFinite(X)&&X>0)for(let L of S.seatIndices)s[L]=X}i.set(u,{sectionId:u,deckAt:O,normalAt:F,flat:w,bottomY:p,rowLevels:M,landingY:_})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let y=r[u];a[u]=(y??i.get(h).deckAt(b.x,b.y))+go;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:i,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function Jn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let i=new Map;for(let a of n){if(!a.sectionId)continue;let r=i.get(a.sectionId);r||(r=new Map,i.set(a.sectionId,r)),r.set(a.categoryKey,(r.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,r]of i){let s=0,l=0,c=0,f=0;for(let[m,u]of r){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function Qn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import Mo from"polygon-clipping";function So(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let i=n.map(l=>[l.x,l.y]);if(i.length<3)return[];i.push(i[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&So(e,this.levels[c])),r=[[i]];if(a.length)try{r=Mo.difference([i],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{r=[[i]]}this.rings.push([i]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function Ro(t,n){if(!n)return t;let e=1/0,i=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),i=Math.max(i,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let r=(e+i)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-r,h=m.y-s;return{x:r+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=Tt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,i=(t.y??0)+t.height/2;n=Ht(e,i,t.width/2,t.height/2)}return n?Ro(n,t.rotation):null}function Et(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},i=n==="stage"&&xn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...i,heightM:t.heightM??i.heightM}}var Ao=.08;function te(t,n){let e=bt(t),i=Et(t),o=i.heightM;if(!e||i.kind!=="plate"&&i.kind!=="stage")return o;let a=1/0,r=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),r=Math.min(r,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&r<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+Ao);return n.push({minX:a,minY:r,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function ne(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function Ct(t,n,e){return[mt(t[0],t[1],n),mt(t[0],t[1],e),mt(t[3],t[2],e),mt(t[3],t[2],n)]}function ee(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,i,o,a){K(t,n,void 0,()=>e,i,o,a,W)}var cn=2.4,Po=.75,Io=.15;function Ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:i,rotation:o}=t;if(!e||!i)return null;let a=(o??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=e/2,c=i/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*r-m*s,y:n.y+f*s+m*r}))}function oe(t,n,e,i,o){let a=Ft(n);a&&K(t,a,void 0,()=>e+cn,e,st(i,o.boothTop),o.boothWall,W)}function un(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:i,center:o}=t;if(!n||!e)return null;let a=(i??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*r-m*s,y:o.y+f*s+m*r}))}function re(t,n,e,i,o){let a=un(n);a&&K(t,a,void 0,()=>e+Po,e,st(i,o.tableTop),o.tableWall,W)}function ie(t,n,e,i,o,a,r,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Et(n),u=s?.baseY??e,h=s?.topY??e+i;if(c&&r){let x=1/0,w=-1/0,A=1/0,E=-1/0;for(let R of l)R.x<x&&(x=R.x),R.x>w&&(w=R.x),R.y<A&&(A=R.y),R.y>E&&(E=R.y);r.push({cx:(x+w)/2*g,cz:(A+E)/2*g,y:h,halfX:Math.max((w-x)/2*g,.5),halfZ:Math.max((E-A)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(Pt(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),y=f?b:null,d=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?y?nt(et(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=ne(l);at(t,Ct(x,0,.16),h,u,p,d),at(t,Ct(x,.84,1),h,u,p,d),at(t,x,h,Math.max(u,h-.35),p,d);return}if(m.kind==="suite"&&l.length===4){let x=l.map((E,R)=>{let I=l[(R+1)%4],B=(E.x+I.x)/2,k=(E.y+I.y)/2;return Math.hypot(B-a.x,k-a.y)}),w=x.indexOf(Math.min(...x)),A=[0,1,2,3].map(E=>l[(w+E)%4]);at(t,Ct(A,0,.08),h,u,p,d),at(t,Ct(A,.92,1),h,u,p,d),at(t,ee(A,.88,1),h,u,p,d),at(t,A,h,Math.max(u,h-.18),p,d);return}at(t,l,h,u,p,d)}function ln(t){let{x:n,y:e,width:i,height:o}=t;if(!i||!o)return null;let a=n+i/2,r=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=i/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:r+u*c+h*l}))}function wo(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let i=e[1].trim();if(i==="none"||i==="transparent")return null;let o=i.match(/^url\(#([^)]+)\)$/);if(!o)return H(i);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let r=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&r.push(l)}return r.length?r.reduce((s,l,c)=>nt(s,l,1/(c+1)),r[0]):null}function se(t,n,e,i){if(n.layer==="foreground")return;let o=ln(n);if(!o)return;let a=e+Io,r=st(wo(n.href),i.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(r=nt(i.ground,r,s)),K(t,o,void 0,()=>a,e,r,nt(r,i.decorWall,.5),W)}function ae(t,n,e,i,o){if(!n.points||n.points.length<3)return;let a=st(i,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var _o=.25,To=1.2,Bo=.6,Eo=.45,Co=2.3,Fo=Math.PI/180;function pt(t,n,e){let i=e*Fo;return{x:t.x+n*Math.sin(i),y:t.y+n*Math.cos(i)}}function vo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let i=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let r=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=i&&r++;if(r>=a.length/2)return!0}return!1}var ko=24;function Oo(t,n,e,i,o,a,r,s){let l=e.binCount,c=ko,f=ut,m=a+.02,u=[];for(let M=0;M<l;M++){let _=(e.startBin+M+.5)*n.binStepDeg,N=new Float64Array(c+1);for(let O=0;O<=c;O++){let P=i[M]+(o[M]-i[M])*O/c;N[O]=Math.max(m,In(n,e,_,P)-_o)}u.push(N)}let h=[r.bandTop[0]*s.top,r.bandTop[1]*s.top,r.bandTop[2]*s.top],b=[r.bandTop[0]*s.bottomCap,r.bandTop[1]*s.bottomCap,r.bandTop[2]*s.bottomCap],p=[r.bandWall[0]*s.top,r.bandWall[1]*s.top,r.bandWall[2]*s.top],y=[r.bandWall[0]*s.wallBottom,r.bandWall[1]*s.wallBottom,r.bandWall[2]*s.wallBottom],d=(M,_)=>{let N=(e.startBin+M+.5)*n.binStepDeg,O=i[M]+(o[M]-i[M])*_/c,P=pt(n.centre,O,N);return[P.x*f,u[M][_],P.y*f]};{let M=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let N=!1;for(let P=0;P<l;P++)for(let F=c-1;F>=0;F--)u[P][F]>u[P][F+1]&&(u[P][F]=u[P][F+1],N=!0);let O=e.closed?l:l-1;for(let P=0;P<O;P++){let F=(P+1)%l;for(let S=0;S<=c;S++){let T=u[F][S]-u[P][S];if(Math.abs(T)>1)continue;let C=i[P]+(o[P]-i[P])*S/c,v=i[F]+(o[F]-i[F])*S/c,G=pt(n.centre,C,(e.startBin+P+.5)*n.binStepDeg),X=pt(n.centre,v,(e.startBin+F+.5)*n.binStepDeg),L=M*Math.hypot(X.x-G.x,X.y-G.y)*f;T>L?(u[F][S]=u[P][S]+L,N=!0):-T>L&&(u[P][S]=u[F][S]+L,N=!0)}}if(!N)break}}let x=1,w=(M,_)=>{for(let N=0;N<=c;N+=4)if(Math.abs(u[M][N]-u[_][N])>x)return!0;return Math.abs(u[M][c]-u[_][c])>x},A=Math.tan(38*Math.PI/180),E=M=>(o[M]-i[M])/c*f,R=(M,_)=>u[M][_+1]-u[M][_]>A*Math.max(1e-6,E(M)),I=(M,_)=>{let N=e.closed?(M-1+l)%l:Math.max(0,M-1),O=e.closed?(M+1)%l:Math.min(l-1,M+1);Math.abs(u[N][_]-u[M][_])>x&&(N=M),Math.abs(u[O][_]-u[M][_])>x&&(O=M);let P=Math.max(0,_-1),F=Math.min(c,_+1);P<_&&R(M,P)&&(P=_),F>_&&R(M,_)&&(F=_);let S=d(N,_),T=d(O,_),C=d(M,P),v=d(M,F),G=T[0]-S[0],X=T[1]-S[1],L=T[2]-S[2],Y=v[0]-C[0],j=v[1]-C[1],$=v[2]-C[2],z=X*$-L*j,q=L*Y-G*$,tt=G*j-X*Y,Z=Math.hypot(z,q,tt);return Z>1e-12?(z/=Z,q/=Z,tt/=Z,q<0&&(z=-z,q=-q,tt=-tt),[z,q,tt]):[0,1,0]},B=(M,_)=>{let N=[M[0],a,M[2]],O=[_[0],a,_[2]],P=_[0]-M[0],F=_[2]-M[2],S=Math.hypot(P,F);if(!(S>1e-12))return;let T=[F/S,0,-P/S];t.tri(M,_,O,T,p,p,y),t.tri(M,O,N,T,p,y,y)},k=.05*lt,D=M=>o[M]-i[M]<k,U=e.closed?l:l-1;for(let M=0;M<U;M++){let _=(M+1)%l;if(D(M)||D(_))continue;if(w(M,_)){let T=(e.startBin+M+1)*n.binStepDeg,C=(j,$)=>{let z=(i[M]+i[_])/2,q=(o[M]+o[_])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,T);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=d(M,j),z=d(M,j+1),q=C(M,j),tt=C(M,j+1),Z=I(M,j),it=I(M,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=d(_,j),kt=d(_,j+1),dt=C(_,j),St=C(_,j+1),yt=I(_,j),xt=I(_,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=C(M,j),rt=C(M,j+1),Ot=C(_,j+1),Kt=C(_,j),Lt=rt[0]-ct[0],Rt=rt[2]-ct[2],$t=Math.hypot(Lt,Rt);if($t>1e-12){let fn=[Rt/$t,0,-Lt/$t];t.tri(ct,rt,Ot,fn,p),t.tri(ct,Ot,Kt,fn,p)}}let v=d(M,0),G=d(_,0),X=d(_,c),L=d(M,c),Y=j=>[j[0],a,j[2]];t.tri(Y(v),Y(X),Y(G),[0,-1,0],b),t.tri(Y(v),Y(L),Y(X),[0,-1,0],b),B(v,G),B(L,X);continue}for(let T=0;T<c;T++){let C=I(M,T),v=I(_,T),G=I(_,T+1),X=I(M,T+1);if(R(M,T)||R(_,T)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=i[rt]+(o[rt]-i[rt])*(T+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=d(M,T),tt=d(_,T),Z=z(M,u[M][T]),it=z(_,u[_][T]);t.triN(q,tt,it,C,v,v,h),t.triN(q,it,Z,C,v,C,h);let vt=d(_,T+1),kt=d(M,T+1),dt=z(M,u[M][T+1]),St=z(_,u[_][T+1]);t.triN(dt,St,vt,X,G,G,h),t.triN(dt,vt,kt,X,G,X,h);let yt=it[0]-Z[0],xt=it[2]-Z[2],ct=Math.hypot(yt,xt);if(ct>1e-12){let rt=[-xt/ct,0,yt/ct];t.tri(Z,it,St,rt,p),t.tri(Z,St,dt,rt,p)}continue}let L=d(M,T),Y=d(_,T),j=d(_,T+1),$=d(M,T+1);t.triN(L,Y,j,C,v,G,h),t.triN(L,j,$,C,G,X,h)}let N=d(M,0),O=d(_,0),P=d(_,c),F=d(M,c),S=T=>[T[0],a,T[2]];t.tri(S(N),S(P),S(O),[0,-1,0],b),t.tri(S(N),S(F),S(P),[0,-1,0],b),B(N,O),B(F,P)}if(!e.closed)for(let M of[0,l-1])for(let _=0;_<c;_++)B(d(M,_),d(M,_+1))}function ce(t,n,e){let{bottomY:i,colors:o,ao:a}=e,r=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount,d=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(d,r[y]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let y=m.topLevelM[p]-i;y>b&&(b=y)}b>=To&&Oo(t,n,m,u,h,i,o,a);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount;h[p]>r[y]&&(r[y]=h[p])}}if(e.deriveShell===!1||vo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=Bo*lt,c=Eo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let y=(f.startBin+p+.5)*n.binStepDeg,d=f.outerR[p]+ot+l;m.push(pt(n.centre,d,y)),u.push(pt(n.centre,d+c,y))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+Co;f.closed?K(t,u,[m.slice().reverse()],b,i,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,i,o.shellTop,o.shellWall,a)}}function ue(t,n,e,i,o,a,r,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(i,s.tierTop);if(!o)return;let f=y=>o.deckAt(y.x,y.y),m=Zn(n,r),u=m[0]??n.outline;if(o.rowLevels.length>=2){let y=Wt(o.rowLevels),d=Kn(Yn(o.rowLevels,e.focal,y),m),x=()=>[0,1,0];for(let A of d){let E=Math.max(l,A.topY-.02);for(let R of a.subtract(A.outline,E))K(t,R,A.holes,()=>E,l,c,s.tierWall,W,void 0,x)}d.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let w={tread:[c[0]*W.top,c[1]*W.top,c[2]*W.top],riser:[c[0]*.72,c[1]*.72,c[2]*.72]};for(let A of m.length?m:[u])Hn(t,o.rowLevels,e.focal,o.landingY,w,A,y);return}let h=o.flat?1/0:$n,b=y=>o.normalAt(y.x,y.y),p=o.flat?o.landingY:void 0;for(let y of a.subtract(u,p))K(t,y,n.holes,f,l,c,s.tierWall,W,h,b)}function Lo(t,n,e){let i=new Set;for(let r of t.objects)r.type==="section"&&i.add(r.id);let o=new Map;for(let r=0;r<n.length;r++){let s=e.seatOwner[r];if(!s||!i.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[r],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${r}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(r),u.n++}let a=[];for(let r of t.objects){if(r.type!=="section")continue;let s=e.bySection.get(r.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:r.id,rows:c});continue}let l=o.get(r.id);l&&a.push({sectionId:r.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function le(t,n,e,i,o,a,r=!0){let s=Lo(n,e,i);if(!s.length)return;let l=Pn(s,n.focal);l&&(t.setMaterial(0),ce(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:r}))}var Go=6,Do=2.2,me=.1,No=.3,Xo=1.8,Uo=.9,Yo=.55,jo=6e3;function fe(t){let{doc:n,units:e,seats:i,surfaces:o,focal:a}=t,r=n.zones??[],s=[];if(r.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<i.length;f++){let m=i[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of r){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function he(t){let{doc:n,units:e,seats:i,surfaces:o,seatData:a,hintedSeatFloor:r,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+Go,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<i.length;b++){let p=o.seatOwner[b];if(!p)continue;let y=u.get(p);y||(y={n:0,x:0,y:0,deck:0},u.set(p,y)),y.n++,y.x+=i[b].x,y.y+=i[b].y,y.deck+=o.seatDeckY(b);let d=h.get(p);d||(d={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,d)),i[b].x<d.minX&&(d.minX=i[b].x),i[b].x>d.maxX&&(d.maxX=i[b].x),i[b].y<d.minY&&(d.minY=i[b].y),i[b].y>d.maxY&&(d.maxY=i[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let y=u.get(p.id);if(!y||y.n===0)continue;let d=h.get(p.id),x=[y.x/y.n*g,y.deck/y.n,y.y/y.n*g],w=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:w,seatCount:y.n,center:x,radius:Math.max(1,Math.hypot(d.maxX-d.minX,d.maxY-d.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let A=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&A===w.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:w,anchor:[x[0],x[1]+Do,x[2]],floorIndex:b.index})}}{for(let b of e)for(let p of b.objects){if(p.type!=="gaArea")continue;let y=At(p.points);if(!y)continue;let d=p.displayLabel||p.label||p.id;c.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${d} \xB7 ${p.capacity.toLocaleString()}`:d,anchor:[y.x*g,b.baseHeightM+Xo,y.y*g],floorIndex:b.index})}let u=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=Math.hypot(p.x-l.x,p.y-l.y),d=u.get(p.rowId);(!d||y>d.far)&&u.set(p.rowId,{seat:p,index:b,far:y})}for(let[b,p]of u){let y=p.seat.label?p.seat.label.lastIndexOf("-"):-1,d=y>0?p.seat.label.slice(0,y):b;d&&c.push({id:`row:${b}`,kind:"row",text:d,anchor:[p.seat.x*g,o.seatDeckY(p.index)+Uo,p.seat.y*g],floorIndex:r[p.index]})}let h=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=p.label?p.label.lastIndexOf("-"):-1,d=h.get(p.rowId);d||(d={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},h.set(p.rowId,d));let x=b*3,w=a.iPosition[x],A=a.iPosition[x+1],E=a.iPosition[x+2];d.n++,d.x+=w,d.y+=A,d.z+=E,d.minX=Math.min(d.minX,w),d.maxX=Math.max(d.maxX,w),d.minZ=Math.min(d.minZ,E),d.maxZ=Math.max(d.maxZ,E)}for(let[b,p]of h)m.push({id:b,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(i.length<=jo)for(let b=0;b<i.length;b++){let p=i[b],y=p.displayLabel||p.label;y&&c.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*g,o.seatDeckY(b)+Yo,p.y*g],floorIndex:r[b]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?At(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Et(h).heightM+me,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+me,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ft(h);if(!b)continue;let p=At(b);if(!p)continue;c.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*g,u.baseHeightM+cn+No,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function be(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function pe(t){let{doc:n,units:e,seats:i,surfaces:o,solids:a,hintedSeatFloor:r,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let u=0;u<i.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??r[u];if(b===void 0)continue;let p=m[b],y=i[u];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let d=o.seatDeckY(u);p.sumX+=y.x*g,p.sumDeck+=d,p.sumZ+=y.y*g,p.minDeck=Math.min(p.minDeck,d),p.maxDeck=Math.max(p.maxDeck,d+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],y=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),d=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),w=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),A=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),E=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),R=[h.n?h.sumX/h.n:(y+d)/2,h.n?h.sumDeck/h.n:(A+E)/2,h.n?h.sumZ/h.n:(x+w)/2],I=Math.max(1,.5*Math.hypot(d-y,E-A,w-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:R,radius:I,box:{min:[y,A,x],max:[d,E,w]},focalWorld:[e[u].focal.x*g,e[u].baseHeightM+1.5,e[u].focal.y*g]})}}return l}function mn(t,n){let e=1/0,i=1/0,o=-1/0,a=-1/0,r=(s,l)=>{s<e&&(e=s),l<i&&(i=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)r(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)r(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)r(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)r(c.x,c.y);else if(l.type==="booth"){let c=Ft(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="table"){let c=un(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="decorImage"){let c=ln(l);if(c)for(let f of c)r(f.x,f.y)}return Number.isFinite(e)||(e=-100,i=-100,o=100,a=100),{minX:e,minY:i,maxX:o,maxY:a}}function de(t,n,e,i,o,a){if(n.length===1){let r=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Tt(o.minX-r,o.minY-r,o.maxX-o.minX+r*2,o.maxY-o.minY+r*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let r=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(r.index);let s=e.filter((h,b)=>i[b]===r.index),l=mn([r],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=Tt(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=r.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function ye(t,n,e){let{cx:i,cz:o,radius:a}=e,r=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,y,d)=>{r=Math.min(r,p),c=Math.max(c,p),s=Math.min(s,y),f=Math.max(f,y),l=Math.min(l,d),m=Math.max(m,d)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let y=p*3,d=n.iPosition[y],x=n.iPosition[y+1],w=n.iPosition[y+2],A=Math.max(.35,n.iMaxRadius[p]??.35);u(d-A,x,w-A),u(d+A,x+1.6,w+A)}Number.isFinite(r)||(r=i-a,c=i+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(r+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-r,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function xe(t,n,e,i,o,a){let r=1/0,s=1/0,l=-1/0,c=-1/0;for(let A=0;A<t.count;A++){let E=A*3,R=t.iPosition[E],I=t.iPosition[E+2];R<r&&(r=R),R>l&&(l=R),I<s&&(s=I),I>c&&(c=I)}for(let A of n)r=Math.min(r,A.cx-A.halfX),l=Math.max(l,A.cx+A.halfX),s=Math.min(s,A.cz-A.halfZ),c=Math.max(c,A.cz+A.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,y=u,d=h;if(Number.isFinite(r)){let A=Math.max(2,.06*Math.hypot(l-r,c-s));b=Math.max(f,r-A),p=Math.min(m,l+A),y=Math.max(u,s-A),d=Math.min(h,c+A)}let x=Math.min(0,i),w=Math.max(o,a*.05);return{min:[b,x,y],max:[p,w,d]}}function ge(t,n,e){let i=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return i();let o=bn(n);if(!o.ok||o.value.id!==t)return i();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let r=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||r.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return i();r.add(m.id),s.add(m.objectId);let p=h.map(B=>B.x*g),y=h.map(B=>B.y*g),d=u.unit.baseHeightM+b,x=Math.min(...p),w=Math.max(...p),A=Math.min(...y),E=Math.max(...y),R,I=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&I)if(w-x>=E-A){let B=Math.abs(A-u.unit.focal.y*g)<=Math.abs(E-u.unit.focal.y*g)?A-.006:E+.006;R=[[x,d,B],[w,d,B],[x,d+m.heightM,B],[w,d+m.heightM,B]]}else{let B=Math.abs(x-u.unit.focal.x*g)<=Math.abs(w-u.unit.focal.x*g)?x-.006:w+.006;R=[[B,d,A],[B,d,E],[B,d+m.heightM,A],[B,d+m.heightM,E]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:d,topY:d+m.heightM,bounds:{min:[x,d,A],max:[w,d+m.heightM,E]},occlusion:m.occlusion,...I?{contentImageUrl:I}:{},...R?{contentPlane:R}:{}})}let f=c.sort((m,u)=>m.id.localeCompare(u.id));return{byObjectId:new Map(f.map(m=>[m.objectId,m])),elements:f}}function Q(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function J(t){return Array.isArray(t)?t:[]}function Ho(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let i=Q(e.extensions)?e.extensions:null;if(i&&Object.prototype.hasOwnProperty.call(i,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Vo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Wo(t,n){let e=new Array(16).fill(0);for(let i=0;i<4;i++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[i*4+o]+=t[a*4+o]*n[i*4+a];return e}function zo(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),i=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!i||!o)return null;let[a,r,s,l]=i,c=Math.hypot(a,r,s,l);if(!(c>1e-8))return null;let f=a/c,m=r/c,u=s/c,h=l/c,b=f+f,p=m+m,y=u+u,d=f*b,x=f*p,w=f*y,A=m*p,E=m*y,R=u*y,I=h*b,B=h*p,k=h*y;return[(1-(A+R))*o[0],(x+k)*o[0],(w-B)*o[0],0,(x-k)*o[1],(1-(d+R))*o[1],(E+I)*o[1],0,(w+B)*o[2],(E-I)*o[2],(1-(d+A))*o[2],0,e[0],e[1],e[2],1]}function Zo(t,n,e,i){return[t[0]*n+t[4]*e+t[8]*i+t[12],t[1]*n+t[5]*e+t[9]*i+t[13],t[2]*n+t[6]*e+t[10]*i+t[14]]}function Ko(t){let n=t[0],e=t[4],i=t[8],o=t[1],a=t[5],r=t[9],s=t[2],l=t[6],c=t[10],f=a*c-r*l,m=r*s-o*c,u=o*l-a*s,h=n*f+e*m+i*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(i*l-e*c)*b,(n*c-i*s)*b,(e*s-n*l)*b,(e*r-i*a)*b,(i*o-n*r)*b,(n*a-e*o)*b]}function Me(t,n,e,i){let o=t[0]*n+t[1]*e+t[2]*i,a=t[3]*n+t[4]*e+t[5]*i,r=t[6]*n+t[7]*e+t[8]*i,s=Math.hypot(o,a,r)||1;return o/=s,a/=s,r/=s,[o,a,r]}function $o(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,i=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),r=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(r===1313821514&&!i)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;i=l}catch{return null}else if(r===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&i&&o?{json:i,bin:o}:null}function qo(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Jo(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Qo(t,n,e){return e===5120?t.getInt8(n):e===5121?t.getUint8(n):e===5122?t.getInt16(n,!0):e===5123?t.getUint16(n,!0):e===5125?t.getUint32(n,!0):t.getFloat32(n,!0)}function tr(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=$o(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:i,bin:o}=e;if(!Q(i.asset)||i.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(i.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||Ho(i))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(i.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(i.images).length||J(i.textures).length)return{ok:!1,issue:"external_resource"};let r=J(i.buffers);if(r.length!==1||!Q(r[0])||r[0].uri!==void 0||typeof r[0].byteLength!="number"||!Number.isInteger(r[0].byteLength)||r[0].byteLength<0||r[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(i.accessors),l=J(i.bufferViews),c=J(i.meshes),f=J(i.nodes),m=J(i.scenes),u=typeof i.scene=="number"?i.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(A,E,R)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(s[A]))return null;let I=s[A];if(I.type!==E||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!R.includes(I.componentType)||typeof I.bufferView!="number")return null;let B=l[I.bufferView];if(!Q(B)||B.buffer!==0||typeof B.byteLength!="number"||!Number.isInteger(B.byteLength)||B.byteLength<0)return null;let k=Jo(I.type),D=qo(I.componentType),U=typeof B.byteStride=="number"?B.byteStride:k*D,M=typeof B.byteOffset=="number"?B.byteOffset:0,_=typeof I.byteOffset=="number"?I.byteOffset:0,N=M+_,O=_+(I.count-1)*U+k*D;if(!Number.isInteger(U)||!Number.isInteger(M)||!Number.isInteger(_)||U<k*D||M<0||_<0||M+B.byteLength>o.byteLength||O>B.byteLength)return null;let P=[];for(let F=0;F<I.count;F++){let S=[];for(let T=0;T<k;T++){let C=Qo(h,N+F*U+T*D,I.componentType);if(!Number.isFinite(C))return null;S.push(C)}P.push(S)}return P},p=[],y=[],d=0,x=new Set,w=(A,E)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(f[A])||x.has(A))return!1;x.add(A);let R=f[A],I=zo(R);if(!I)return!1;let B=Wo(E,I),k=Ko(B);if(!k)return!1;if(R.mesh!==void 0){if(typeof R.mesh!="number")return!1;let D=c[R.mesh];if(!Q(D))return!1;for(let U of J(D.primitives)){if(!Q(U)||U.mode!==void 0&&U.mode!==4||!Q(U.attributes))return!1;let M=b(U.attributes.POSITION,"VEC3",[5126]),_=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!M||U.attributes.NORMAL!==void 0&&!_)return!1;let N=M.length;if(U.indices!==void 0){let P=typeof U.indices=="number"?s[U.indices]:null;N=Q(P)?P.count:void 0}if(typeof N!="number"||!Number.isInteger(N)||N%3!==0||(d+=N/3,d>1e5))return!1;let O=U.indices===void 0?M.map((P,F)=>[F]):b(U.indices,"SCALAR",[5121,5123,5125]);if(!O||O.length%3!==0||O.length!==N)return!1;for(let P=0;P<O.length;P+=3){let F=[O[P][0],O[P+1][0],O[P+2][0]];if(F.some(C=>!Number.isInteger(C)||C<0||C>=M.length))return!1;let S=F.map(C=>Zo(B,...M[C])),T=null;if(!_){let C=S[1][0]-S[0][0],v=S[1][1]-S[0][1],G=S[1][2]-S[0][2],X=S[2][0]-S[0][0],L=S[2][1]-S[0][1],Y=S[2][2]-S[0][2];T=Me([1,0,0,0,1,0,0,0,1],v*Y-G*L,G*X-C*Y,C*L-v*X)}for(let C=0;C<3;C++)p.push(...S[C]),y.push(..._?Me(k,..._[F[C]]):T)}}}for(let D of J(R.children))if(!w(D,B))return!1;return x.delete(A),!0};for(let A of J(m[u].nodes))if(!w(A,Vo()))return{ok:!1,issue:d>1e5?"triangle_limit":"unsupported_glb"};return!d||p.length!==d*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:d,position:new Float32Array(p),normal:new Float32Array(y)}}function Se(t){try{return tr(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function gs(t){let{doc:n}=t,e=Fn(n.theme),i=e.structure,o=zn(n,t.eventConfigurationId??n.eventConfigurationId),a=ge(t.eventConfigurationId,t.eventConfiguration,o),r=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let P=Se(t.registeredShellGlb);if(P.ok){let F=P.position.length/3,S=new Float32Array(P.position.length),T=e.materials.shell??i.tierWall;for(let C=0;C<F;C++){let v=P.normal[C*3+1],G=v<-.25?.4:.62+.38*Math.max(0,v);S[C*3]=T[0]*G,S[C*3+1]=T[1]*G,S[C*3+2]=T[2]*G}l={position:P.position,normal:P.normal,color:S,floor:new Float32Array(F).fill(-2),material:new Float32Array(F),count:F}}}let c=new Map;for(let P of o)for(let F of P.objects)c.set(F.id,P.index),F.type==="section"&&c.set(F.logicalSectionId??F.id,P.index);let f=r.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),m=mn(o,r);de(s,o,r,f,m,i);let u=Jn(n,r),h=new Map,b=new Map;for(let P of n.categories??[])h.set(P.key,P.color),P.seatGlyph&&b.set(P.key,P.seatGlyph);let p=[],y=qn(o,r,f),d=new Float32Array(r.length),x=[];for(let P=0;P<o.length;P++){let F=o[P];s.setFloor(P);let S=new zt,T=[],C=F.objects.filter(v=>v.type==="section"&&!!v.outline&&v.outline.length>=3);for(let v of F.objects)if(v.type==="section"){let G=s.vertexCount;ue(s,v,F,Qn(v,u),y.bySection.get(v.id),S,C,i);let X=s.vertexCount-G;X>0&&x.push({sectionId:v.id,start:G,count:X})}else if(v.type==="shape"){let G=a.byObjectId.get(v.id);s.setMaterial((G?.kind??v.role)==="screen"?1:0),ie(s,v,F.baseHeightM,te(v,T),i,F.focal,p,G),s.setMaterial(0)}else v.type==="gaArea"?ae(s,v,F.baseHeightM,H(h.get(v.categoryKey)),i):v.type==="booth"?oe(s,v,F.baseHeightM,H(h.get(v.categoryKey)),i):v.type==="table"?re(s,v,F.baseHeightM,H(v.fill??n.theme?.decorFill??"#232c40"),i):v.type==="decorImage"&&se(s,v,F.baseHeightM,i);le(s,F,r,y,i,e.materials.shell,!l)}let w=o.length>1?{x:o.reduce((P,F)=>P+F.focal.x,0)/o.length,y:o.reduce((P,F)=>P+F.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},A=_n(l?[s.build(),l]:[s.build()]),E=Cn(r,t.initialState,y,d,h,b),R=fe({doc:n,units:o,seats:r,surfaces:y,focal:w}),{labels:I,sections:B,rows:k}=he({doc:n,units:o,seats:r,surfaces:y,seatData:E,hintedSeatFloor:f,zones:R,focal:w}),D=pe({doc:n,units:o,seats:r,surfaces:y,solids:A,hintedSeatFloor:f,seatFloor:d});be(I,D),E.iYaw=En(E.iPosition,r.length,P=>r[P].rowId,P=>{let F=o[d[P]]?.focal??w;return[F.x*g,F.y*g]});let U=(m.minX+m.maxX)/2*g,M=(m.minY+m.maxY)/2*g,_=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,N=ye(A,E,{cx:U,cz:M,radius:_}),O=xe(E,p,m,N.minY,N.maxY,_);return{solids:A,sectionSolidRanges:x,seats:E,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:_,groundY:0,box:O},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:vn(e,Bt),theme:e,seatCount:r.length,focalWorld:[w.x*g,1.5,w.y*g],zones:R,stages:p,productionElements:a.elements,sections:B,rows:k,labels:I,floors:D}}export{Bt as a,Qt as b,cr as c,nn as d,g as e,lr as f,Le as g,De as h,mr as i,Vt as j,Mr as k,Sr as l,Pr as m,Ir as n,wr as o,_r as p,Tr as q,Br as r,Er as s,Cr as t,Fr as u,vr as v,gs as w};
@@ -1 +1 @@
1
- import{Ca as B,Fa as F,x as j}from"./chunk-KN7GLEAI.js";var L=.08,X=.045;function E(t,e,n){return{...t,objects:e,floors:void 0,...n?{focalPoint:n}:{},referenceImage:void 0,backgroundImage:void 0}}function T(t,e,n){let o=t.focalPoint??e.focalPoint;return o?o.x:n.x+n.width/2}function Y(t){let e=t.floors??[];if(!e.length)return[];let n=e.map(s=>F(E(t,s.objects,s.focalPoint),{freeText:"exclude"})),a=Math.max(1,...n.map(s=>s.width))*L,r=0;return e.map((s,l)=>{let h=n[l],u=r-(h.y+h.height);return r-=h.height+a,{floorId:s.id,label:s.name??s.id,level:l,levelBadge:l===0?"G":String(l),translation:{x:-T(s,t,h),y:u},bounds:h}})}function _(t,e,n,o){let a=e==="name"?t.label:t.levelBadge;if(!a)return[];let r=Math.max(1,n*X),s=t.bounds.x+t.translation.x,l=t.bounds.y+t.translation.y+r*.4,h=`floor-level-${t.floorId}`,u={type:"text",id:`${h}-text`,text:a,position:{x:s,y:l},fontSize:r,rotation:0,color:o,bold:!0};if(e==="name")return[u];let m=r*.95;return[{type:"shape",id:`${h}-badge`,kind:"ellipse",x:s-m*.35,y:l-m*.3,width:m*2,height:m*2,fill:"transparent",stroke:{color:o,width:Math.max(1,r*.09)},opacity:.8},u]}function z(t,e={}){let n=t.floors;if(!n||n.length<2)return t;let o=Y(t),a=[];n.forEach((u,m)=>{let{x:y,y:S}=o[m].translation;for(let w of u.objects)m>0&&w.type==="shape"&&w.role==="stage"||a.push(B(w,y,S))});let r={...t,objects:a,floors:void 0},s=F(r,{freeText:"exclude"}),l=Math.max(1,s.width,s.height),h=t.theme?.textColor??"#94a3b8";for(let u of o)a.push(..._(u,e.labelStyle??"number",l,h));return{...r,objects:a,referenceImage:void 0,backgroundImage:void 0}}function Q(t){let e=t.floors;if(!e?.length)return null;let n=e.find(r=>r.objects.some(s=>s.type==="shape"&&s.role==="stage"));if(n)return n.id;let o=e[0],a=-1;for(let r of e){let s=F(E(t,r.objects,r.focalPoint),{freeText:"exclude"}),l=s.width*s.height;l>a&&(a=l,o=r)}return o.id}var N=640;function H(t,e){return(t.floors?.length??0)<2?null:!Number.isFinite(e)||e<=0||e>=N?"all":Q(t)}var U=9;function $(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,n=t.height/2,o=t.rotation??0;if(!o)return{hx:e,hy:n};let a=o*Math.PI/180,r=Math.abs(Math.cos(a)),s=Math.abs(Math.sin(a));return{hx:e*r+n*s,hy:e*s+n*r}}function q(t,e,n){let o=e-t.seat.x,a=n-t.seat.y;if(t.shape.kind==="circle")return o*o+a*a<=t.shape.r*t.shape.r;let r=t.shape.rotation??0,s=o,l=a;if(r){let h=-r*Math.PI/180,u=Math.cos(h),m=Math.sin(h);s=o*u-a*m,l=o*m+a*u}return Math.abs(s)<=t.shape.width/2&&Math.abs(l)<=t.shape.height/2}function G(t,e,n,o,a){if(t.shape.kind==="circle"){let d=Math.min(Math.max(t.seat.x,e),o),x=Math.min(Math.max(t.seat.y,n),a),f=t.seat.x-d,b=t.seat.y-x;return f*f+b*b<=t.shape.r*t.shape.r}let r=t.shape.rotation??0;if(!r)return t.seat.x-t.hx<=o&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=a&&t.seat.y+t.hy>=n;let s=r*Math.PI/180,l=Math.cos(s),h=Math.sin(s),u=t.shape.width/2,m=t.shape.height/2,y=[[-u,-m],[u,-m],[u,m],[-u,m]].map(([d,x])=>[t.seat.x+d*l-x*h,t.seat.y+d*h+x*l]),S=[[e,n],[o,n],[o,a],[e,a]],w=[[1,0],[0,1],[l,h],[-h,l]];for(let[d,x]of w){let f=1/0,b=-1/0;for(let[P,O]of y){let c=P*d+O*x;c<f&&(f=c),c>b&&(b=c)}let M=1/0,I=-1/0;for(let[P,O]of S){let c=P*d+O*x;c<M&&(M=c),c>I&&(I=c)}if(b<M||I<f)return!1}return!0}function W(t,e={}){let n=e.seatRadius??U,o=t.length,a=new Array(o),r=1/0,s=1/0,l=-1/0,h=-1/0,u=0;for(let c=0;c<o;c++){let i=t[c],D=e.shapeOf?.(i)??{kind:"circle",r:n},{hx:g,hy:p}=$(D);a[c]={seat:i,shape:D,hx:g,hy:p},i.x-g<r&&(r=i.x-g),i.y-p<s&&(s=i.y-p),i.x+g>l&&(l=i.x+g),i.y+p>h&&(h=i.y+p),g>u&&(u=g),p>u&&(u=p)}o===0&&(r=0,s=0,l=0,h=0);let m=u>0?u*4:1,y=Math.max(l-r,0),S=Math.max(h-s,0),w=Math.max(64,e.maxCells??o*4),d=m,x=Math.max(1,Math.ceil(y/d)||1),f=Math.max(1,Math.ceil(S/d)||1);for(;x*f>w&&(x>1||f>1);)d*=2,x=Math.max(1,Math.ceil(y/d)||1),f=Math.max(1,Math.ceil(S/d)||1);let b=x*f,M=new Int32Array(b+1),I=0;for(let c=0;c<o;c++){let i=a[c],D=j(Math.floor((i.seat.x-i.hx-r)/d),0,x-1),g=j(Math.floor((i.seat.x+i.hx-r)/d),0,x-1),p=j(Math.floor((i.seat.y-i.hy-s)/d),0,f-1),R=j(Math.floor((i.seat.y+i.hy-s)/d),0,f-1);for(let C=p;C<=R;C++)for(let A=D;A<=g;A++)M[C*x+A+1]++,I++}for(let c=0;c<b;c++)M[c+1]+=M[c];let P=new Int32Array(I),O=M.slice(0,b);for(let c=0;c<o;c++){let i=a[c],D=j(Math.floor((i.seat.x-i.hx-r)/d),0,x-1),g=j(Math.floor((i.seat.x+i.hx-r)/d),0,x-1),p=j(Math.floor((i.seat.y-i.hy-s)/d),0,f-1),R=j(Math.floor((i.seat.y+i.hy-s)/d),0,f-1);for(let C=p;C<=R;C++)for(let A=D;A<=g;A++){let k=C*x+A;P[O[k]++]=c}}return{seats:t,entries:a,minX:r,minY:s,cell:d,cols:x,rows:f,cellStart:M,items:P,stamp:new Int32Array(o),epoch:0}}function tt(t,e,n={}){let{cols:o,rows:a,cell:r,minX:s,minY:l,cellStart:h,items:u,entries:m}=t,y=Math.floor((e.x-s)/r),S=Math.floor((e.y-l)/r);if(y<0||S<0||y>=o||S>=a)return null;let w=S*o+y,d=h[w+1],x=-1,f=1/0;for(let b=h[w];b<d;b++){let M=u[b],I=m[M];if(n.filter&&!n.filter(I.seat.id,I.seat)||!q(I,e.x,e.y))continue;let P=e.x-I.seat.x,O=e.y-I.seat.y,c=P*P+O*O;(c<f||c===f&&M<x)&&(f=c,x=M)}return x<0?null:m[x].seat.id}function et(t,e,n,o={}){if(!(n>0))return null;let{cols:a,rows:r,cell:s,minX:l,minY:h,cellStart:u,items:m,entries:y}=t,S=Math.max(0,Math.floor((e.x-n-l)/s)),w=Math.min(a-1,Math.floor((e.x+n-l)/s)),d=Math.max(0,Math.floor((e.y-n-h)/s)),x=Math.min(r-1,Math.floor((e.y+n-h)/s));if(S>w||d>x)return null;let f=-1,b=n*n,M=t.stamp,I=++t.epoch;for(let P=d;P<=x;P++){let O=P*a;for(let c=S;c<=w;c++){let i=O+c,D=u[i+1];for(let g=u[i];g<D;g++){let p=m[g];if(M[p]===I)continue;M[p]=I;let R=y[p];if(o.filter&&!o.filter(R.seat.id,R.seat))continue;let C=e.x-R.seat.x,A=e.y-R.seat.y,k=C*C+A*A;(k<b||k===b&&p<f)&&(b=k,f=p)}}}return f<0?null:y[f].seat.id}function nt(t,e,n={}){let o=Math.min(e.x,e.x+e.width),a=Math.max(e.x,e.x+e.width),r=Math.min(e.y,e.y+e.height),s=Math.max(e.y,e.y+e.height),l=n.mode??"center",{cols:h,rows:u,cell:m,minX:y,minY:S,cellStart:w,items:d,entries:x}=t,f=Math.max(0,Math.floor((o-y)/m)),b=Math.min(h-1,Math.floor((a-y)/m)),M=Math.max(0,Math.floor((r-S)/m)),I=Math.min(u-1,Math.floor((s-S)/m));if(f>b||M>I)return[];let P=[],O=t.stamp,c=++t.epoch;for(let i=M;i<=I;i++){let D=i*h;for(let g=f;g<=b;g++){let p=D+g,R=w[p+1];for(let C=w[p];C<R;C++){let A=d[C];if(O[A]===c)continue;O[A]=c;let k=x[A];if(n.filter&&!n.filter(k.seat.id,k.seat))continue;(l==="center"?k.seat.x>=o&&k.seat.x<=a&&k.seat.y>=r&&k.seat.y<=s:G(k,o,r,a,s))&&P.push(A)}}}return P.sort((i,D)=>i-D),P.map(i=>x[i].seat.id)}function ot(t){let e=t.cols*t.rows,n=0,o=0;for(let r=0;r<e;r++){let s=t.cellStart[r+1]-t.cellStart[r];s>0&&n++,s>o&&(o=s)}let a=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:n,refs:a,maxPerCell:o,meanPerOccupiedCell:n?a/n:0}}function st(t,e=0){let n=Math.max(1,t.width,t.height),o={x:t.x+t.width/2,y:t.y+t.height/2},a=n*1.55,r=Math.max(n*.82,Math.max(0,e)+n*.45);return{target:o,distance:a,height:r,focalLength:Math.hypot(a,r),yawRad:-8*Math.PI/180}}function v(t,e,n=0){let o=e.x-t.target.x,a=e.y-t.target.y,r=Math.cos(t.yawRad),s=Math.sin(t.yawRad),l=o*r-a*s,u=o*s+a*r-t.distance,m=n-t.height,y=Math.hypot(t.distance,t.height),S=(-t.distance*u-t.height*m)/y,w=(-t.height*u+t.distance*m)/y,d=Math.max(y*.08,S),x=t.focalLength/d;return{x:t.target.x+l*x,y:t.target.y-w*x,depth:d,scale:x}}function at(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function ct(t){let e=t.a*t.d-t.b*t.c;if(!Number.isFinite(e)||Math.abs(e)<1e-9)throw new Error("perspective projection produced a singular affine");let n=t.d/e,o=-t.b/e,a=-t.c/e,r=t.a/e;return{a:n,b:o,c:a,d:r,e:-(n*t.e+a*t.f),f:-(o*t.e+r*t.f)}}function it(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function lt(t,e,n=()=>0){let o=v(t,e,n(e)),a={x:e.x+1,y:e.y},r={x:e.x,y:e.y+1},s=v(t,a,n(a)),l=v(t,r,n(r)),h=s.x-o.x,u=s.y-o.y,m=l.x-o.x,y=l.y-o.y;return{a:h,b:u,c:m,d:y,e:o.x-h*e.x-m*e.y,f:o.y-u*e.x-y*e.y}}function ht(t){let e=Math.hypot(t.a,t.b),n=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:n/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(n,1e-9)}}export{L as a,Y as b,z as c,Q as d,N as e,H as f,U as g,W as h,tt as i,et as j,nt as k,ot as l,st as m,v as n,at as o,ct as p,it as q,lt as r,ht as s};
1
+ import{J as j,Ua as B,Xa as F}from"./chunk-24O23MNB.js";var L=.08,X=.045;function E(t,e,n){return{...t,objects:e,floors:void 0,...n?{focalPoint:n}:{},referenceImage:void 0,backgroundImage:void 0}}function T(t,e,n){let o=t.focalPoint??e.focalPoint;return o?o.x:n.x+n.width/2}function Y(t){let e=t.floors??[];if(!e.length)return[];let n=e.map(s=>F(E(t,s.objects,s.focalPoint),{freeText:"exclude"})),a=Math.max(1,...n.map(s=>s.width))*L,r=0;return e.map((s,l)=>{let h=n[l],u=r-(h.y+h.height);return r-=h.height+a,{floorId:s.id,label:s.name??s.id,level:l,levelBadge:l===0?"G":String(l),translation:{x:-T(s,t,h),y:u},bounds:h}})}function _(t,e,n,o){let a=e==="name"?t.label:t.levelBadge;if(!a)return[];let r=Math.max(1,n*X),s=t.bounds.x+t.translation.x,l=t.bounds.y+t.translation.y+r*.4,h=`floor-level-${t.floorId}`,u={type:"text",id:`${h}-text`,text:a,position:{x:s,y:l},fontSize:r,rotation:0,color:o,bold:!0};if(e==="name")return[u];let m=r*.95;return[{type:"shape",id:`${h}-badge`,kind:"ellipse",x:s-m*.35,y:l-m*.3,width:m*2,height:m*2,fill:"transparent",stroke:{color:o,width:Math.max(1,r*.09)},opacity:.8},u]}function z(t,e={}){let n=t.floors;if(!n||n.length<2)return t;let o=Y(t),a=[];n.forEach((u,m)=>{let{x:y,y:S}=o[m].translation;for(let w of u.objects)m>0&&w.type==="shape"&&w.role==="stage"||a.push(B(w,y,S))});let r={...t,objects:a,floors:void 0},s=F(r,{freeText:"exclude"}),l=Math.max(1,s.width,s.height),h=t.theme?.textColor??"#94a3b8";for(let u of o)a.push(..._(u,e.labelStyle??"number",l,h));return{...r,objects:a,referenceImage:void 0,backgroundImage:void 0}}function Q(t){let e=t.floors;if(!e?.length)return null;let n=e.find(r=>r.objects.some(s=>s.type==="shape"&&s.role==="stage"));if(n)return n.id;let o=e[0],a=-1;for(let r of e){let s=F(E(t,r.objects,r.focalPoint),{freeText:"exclude"}),l=s.width*s.height;l>a&&(a=l,o=r)}return o.id}var N=640;function H(t,e){return(t.floors?.length??0)<2?null:!Number.isFinite(e)||e<=0||e>=N?"all":Q(t)}var U=9;function $(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,n=t.height/2,o=t.rotation??0;if(!o)return{hx:e,hy:n};let a=o*Math.PI/180,r=Math.abs(Math.cos(a)),s=Math.abs(Math.sin(a));return{hx:e*r+n*s,hy:e*s+n*r}}function q(t,e,n){let o=e-t.seat.x,a=n-t.seat.y;if(t.shape.kind==="circle")return o*o+a*a<=t.shape.r*t.shape.r;let r=t.shape.rotation??0,s=o,l=a;if(r){let h=-r*Math.PI/180,u=Math.cos(h),m=Math.sin(h);s=o*u-a*m,l=o*m+a*u}return Math.abs(s)<=t.shape.width/2&&Math.abs(l)<=t.shape.height/2}function G(t,e,n,o,a){if(t.shape.kind==="circle"){let d=Math.min(Math.max(t.seat.x,e),o),x=Math.min(Math.max(t.seat.y,n),a),f=t.seat.x-d,b=t.seat.y-x;return f*f+b*b<=t.shape.r*t.shape.r}let r=t.shape.rotation??0;if(!r)return t.seat.x-t.hx<=o&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=a&&t.seat.y+t.hy>=n;let s=r*Math.PI/180,l=Math.cos(s),h=Math.sin(s),u=t.shape.width/2,m=t.shape.height/2,y=[[-u,-m],[u,-m],[u,m],[-u,m]].map(([d,x])=>[t.seat.x+d*l-x*h,t.seat.y+d*h+x*l]),S=[[e,n],[o,n],[o,a],[e,a]],w=[[1,0],[0,1],[l,h],[-h,l]];for(let[d,x]of w){let f=1/0,b=-1/0;for(let[P,O]of y){let c=P*d+O*x;c<f&&(f=c),c>b&&(b=c)}let M=1/0,I=-1/0;for(let[P,O]of S){let c=P*d+O*x;c<M&&(M=c),c>I&&(I=c)}if(b<M||I<f)return!1}return!0}function W(t,e={}){let n=e.seatRadius??U,o=t.length,a=new Array(o),r=1/0,s=1/0,l=-1/0,h=-1/0,u=0;for(let c=0;c<o;c++){let i=t[c],D=e.shapeOf?.(i)??{kind:"circle",r:n},{hx:g,hy:p}=$(D);a[c]={seat:i,shape:D,hx:g,hy:p},i.x-g<r&&(r=i.x-g),i.y-p<s&&(s=i.y-p),i.x+g>l&&(l=i.x+g),i.y+p>h&&(h=i.y+p),g>u&&(u=g),p>u&&(u=p)}o===0&&(r=0,s=0,l=0,h=0);let m=u>0?u*4:1,y=Math.max(l-r,0),S=Math.max(h-s,0),w=Math.max(64,e.maxCells??o*4),d=m,x=Math.max(1,Math.ceil(y/d)||1),f=Math.max(1,Math.ceil(S/d)||1);for(;x*f>w&&(x>1||f>1);)d*=2,x=Math.max(1,Math.ceil(y/d)||1),f=Math.max(1,Math.ceil(S/d)||1);let b=x*f,M=new Int32Array(b+1),I=0;for(let c=0;c<o;c++){let i=a[c],D=j(Math.floor((i.seat.x-i.hx-r)/d),0,x-1),g=j(Math.floor((i.seat.x+i.hx-r)/d),0,x-1),p=j(Math.floor((i.seat.y-i.hy-s)/d),0,f-1),R=j(Math.floor((i.seat.y+i.hy-s)/d),0,f-1);for(let C=p;C<=R;C++)for(let A=D;A<=g;A++)M[C*x+A+1]++,I++}for(let c=0;c<b;c++)M[c+1]+=M[c];let P=new Int32Array(I),O=M.slice(0,b);for(let c=0;c<o;c++){let i=a[c],D=j(Math.floor((i.seat.x-i.hx-r)/d),0,x-1),g=j(Math.floor((i.seat.x+i.hx-r)/d),0,x-1),p=j(Math.floor((i.seat.y-i.hy-s)/d),0,f-1),R=j(Math.floor((i.seat.y+i.hy-s)/d),0,f-1);for(let C=p;C<=R;C++)for(let A=D;A<=g;A++){let k=C*x+A;P[O[k]++]=c}}return{seats:t,entries:a,minX:r,minY:s,cell:d,cols:x,rows:f,cellStart:M,items:P,stamp:new Int32Array(o),epoch:0}}function tt(t,e,n={}){let{cols:o,rows:a,cell:r,minX:s,minY:l,cellStart:h,items:u,entries:m}=t,y=Math.floor((e.x-s)/r),S=Math.floor((e.y-l)/r);if(y<0||S<0||y>=o||S>=a)return null;let w=S*o+y,d=h[w+1],x=-1,f=1/0;for(let b=h[w];b<d;b++){let M=u[b],I=m[M];if(n.filter&&!n.filter(I.seat.id,I.seat)||!q(I,e.x,e.y))continue;let P=e.x-I.seat.x,O=e.y-I.seat.y,c=P*P+O*O;(c<f||c===f&&M<x)&&(f=c,x=M)}return x<0?null:m[x].seat.id}function et(t,e,n,o={}){if(!(n>0))return null;let{cols:a,rows:r,cell:s,minX:l,minY:h,cellStart:u,items:m,entries:y}=t,S=Math.max(0,Math.floor((e.x-n-l)/s)),w=Math.min(a-1,Math.floor((e.x+n-l)/s)),d=Math.max(0,Math.floor((e.y-n-h)/s)),x=Math.min(r-1,Math.floor((e.y+n-h)/s));if(S>w||d>x)return null;let f=-1,b=n*n,M=t.stamp,I=++t.epoch;for(let P=d;P<=x;P++){let O=P*a;for(let c=S;c<=w;c++){let i=O+c,D=u[i+1];for(let g=u[i];g<D;g++){let p=m[g];if(M[p]===I)continue;M[p]=I;let R=y[p];if(o.filter&&!o.filter(R.seat.id,R.seat))continue;let C=e.x-R.seat.x,A=e.y-R.seat.y,k=C*C+A*A;(k<b||k===b&&p<f)&&(b=k,f=p)}}}return f<0?null:y[f].seat.id}function nt(t,e,n={}){let o=Math.min(e.x,e.x+e.width),a=Math.max(e.x,e.x+e.width),r=Math.min(e.y,e.y+e.height),s=Math.max(e.y,e.y+e.height),l=n.mode??"center",{cols:h,rows:u,cell:m,minX:y,minY:S,cellStart:w,items:d,entries:x}=t,f=Math.max(0,Math.floor((o-y)/m)),b=Math.min(h-1,Math.floor((a-y)/m)),M=Math.max(0,Math.floor((r-S)/m)),I=Math.min(u-1,Math.floor((s-S)/m));if(f>b||M>I)return[];let P=[],O=t.stamp,c=++t.epoch;for(let i=M;i<=I;i++){let D=i*h;for(let g=f;g<=b;g++){let p=D+g,R=w[p+1];for(let C=w[p];C<R;C++){let A=d[C];if(O[A]===c)continue;O[A]=c;let k=x[A];if(n.filter&&!n.filter(k.seat.id,k.seat))continue;(l==="center"?k.seat.x>=o&&k.seat.x<=a&&k.seat.y>=r&&k.seat.y<=s:G(k,o,r,a,s))&&P.push(A)}}}return P.sort((i,D)=>i-D),P.map(i=>x[i].seat.id)}function ot(t){let e=t.cols*t.rows,n=0,o=0;for(let r=0;r<e;r++){let s=t.cellStart[r+1]-t.cellStart[r];s>0&&n++,s>o&&(o=s)}let a=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:n,refs:a,maxPerCell:o,meanPerOccupiedCell:n?a/n:0}}function st(t,e=0){let n=Math.max(1,t.width,t.height),o={x:t.x+t.width/2,y:t.y+t.height/2},a=n*1.55,r=Math.max(n*.82,Math.max(0,e)+n*.45);return{target:o,distance:a,height:r,focalLength:Math.hypot(a,r),yawRad:-8*Math.PI/180}}function v(t,e,n=0){let o=e.x-t.target.x,a=e.y-t.target.y,r=Math.cos(t.yawRad),s=Math.sin(t.yawRad),l=o*r-a*s,u=o*s+a*r-t.distance,m=n-t.height,y=Math.hypot(t.distance,t.height),S=(-t.distance*u-t.height*m)/y,w=(-t.height*u+t.distance*m)/y,d=Math.max(y*.08,S),x=t.focalLength/d;return{x:t.target.x+l*x,y:t.target.y-w*x,depth:d,scale:x}}function at(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function ct(t){let e=t.a*t.d-t.b*t.c;if(!Number.isFinite(e)||Math.abs(e)<1e-9)throw new Error("perspective projection produced a singular affine");let n=t.d/e,o=-t.b/e,a=-t.c/e,r=t.a/e;return{a:n,b:o,c:a,d:r,e:-(n*t.e+a*t.f),f:-(o*t.e+r*t.f)}}function it(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function lt(t,e,n=()=>0){let o=v(t,e,n(e)),a={x:e.x+1,y:e.y},r={x:e.x,y:e.y+1},s=v(t,a,n(a)),l=v(t,r,n(r)),h=s.x-o.x,u=s.y-o.y,m=l.x-o.x,y=l.y-o.y;return{a:h,b:u,c:m,d:y,e:o.x-h*e.x-m*e.y,f:o.y-u*e.x-y*e.y}}function ht(t){let e=Math.hypot(t.a,t.b),n=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:n/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(n,1e-9)}}export{L as a,Y as b,z as c,Q as d,N as e,H as f,U as g,W as h,tt as i,et as j,nt as k,ot as l,st as m,v as n,at as o,ct as p,it as q,lt as r,ht as s};
@@ -1 +1 @@
1
- import{Ba as O,Ea as v,sa as A}from"./chunk-KN7GLEAI.js";function I(t){let n=Number(t.slice(t.lastIndexOf(":")+1));return Number.isFinite(n)?n:-1}function $(t,n,i){let e=new Map;for(let o of t){if(o.kind==="booth")continue;let a=e.get(o.rowId);a?a.push(o):e.set(o.rowId,[o])}let c=o=>i.has(o.id)||n(o.id)!=="free",l=[];for(let o of e.values())if(!(o.length<3)){o.sort((a,b)=>I(a.id)-I(b.id));for(let a=1;a<o.length-1;a++){let b=o[a];if(c(b))continue;let y=o[a-1],m=o[a+1];I(b.id)-I(y.id)!==1||I(m.id)-I(b.id)!==1||!c(y)||!c(m)||!i.has(y.id)&&!i.has(m.id)||l.push(b)}}return l}function D(t){return{code:"ticket_option_not_applicable",labels:t,message:"That ticket choice is not available for the selected seat."}}function C(t,n){let i=t.applicability;return i?!(i.seatLabels?.length&&!i.seatLabels.includes(n.label)||i.accessibility?.length&&!i.accessibility.some(e=>n.accessibility?.includes(e))):!0}function Q(t,n){return(t.categories.find(i=>i.key===n.categoryKey)?.tiers??[]).filter(i=>C(i,n))}function M(t,n,i){let e=t.categories.find(l=>l.key===n.categoryKey)?.tiers;if(!e?.length)return{kind:"none"};let c=i==null?e.find(l=>C(l,n)):e.find(l=>l.id===i&&C(l,n));return c?{kind:"resolved",tier:c}:{kind:"invalid"}}function z(t,n){return(t.logicalRowId??t.rowId)===(n.logicalRowId??n.rowId)}function N(t){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let n=t.id.slice(t.id.lastIndexOf(":")+1),i=Number(n);return Number.isInteger(i)?i:void 0}function G(t,n){if(!z(t,n))return!1;let i=N(t),e=N(n);return i!=null&&e!=null&&Math.abs(i-e)===1}function U(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=n.flatMap(o=>{let a=i.get(o.label);return a?[{selection:o,seat:a}]:[]}),c=e.map(({seat:o})=>o).filter(o=>o.accessibility?.includes("wheelchair")),l=[];for(let{selection:o,seat:a}of e){let b=M(t,a,o.tierId),y=b.kind==="resolved"?b.tier:void 0;(a.accessibility?.includes("companion")||y?.restriction==="companion")&&!c.some(s=>s.id!==a.id&&G(a,s))&&l.push(a.label)}return l.length?{code:"companion_pair_required",labels:l,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function X(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=new Set(t.categories.filter(o=>o.notForSale).map(o=>o.key)),c=[],l=[];for(let o of n){let a=i.get(o.label);if(!a)continue;if(e.has(a.categoryKey)){c.push(a.label);continue}M(t,a,o.tierId).kind==="invalid"&&l.push(a.label)}return c.length?{code:"not_for_sale",labels:c,message:"These seats are not for sale."}:l.length?D(l):U(t,n)}function E(t,n){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let i=t.id.lastIndexOf(":");if(i<0)return n;let e=Number(t.id.slice(i+1));return Number.isFinite(e)?e:n}function w(t,n){let i=t.x-n.x,e=t.y-n.y;return i*i+e*e}function R(t){let n=0,i=0;for(let e of t)n+=e.x,i+=e.y;return{x:n/t.length,y:i/t.length}}function K(t,n){return t.find(i=>i.focalPoint)?.focalPoint??n}function P(t){return t.commercial?.premium===!0}function V(t,n,i){let e=Math.floor(i.qty);if(!Number.isFinite(e)||e<=0)return{labels:[],reason:"sold_out"};let{categoryKey:c,zoneId:l,focal:o,preferPremium:a,accessibility:b,requireContiguous:y}=i,m=new Map,s=[];if(t.forEach((r,u)=>{let g=n.has(r.label)&&(!c||r.categoryKey===c)&&(!l||r.zoneId===l)&&(!b||b.some(h=>r.accessibility?.includes(h))),p=r.logicalRowId??r.rowId,d=m.get(p);d||(d=[],m.set(p,d)),d.push({seat:r,index:E(r,u),elig:g}),g&&s.push(r)}),s.length===0)return{labels:[],reason:"sold_out"};let f=null,B=r=>{if(!f)return!0;if(a&&r.nonPremium!==f.nonPremium)return r.nonPremium<f.nonPremium;if(r.orphan!==f.orphan)return r.orphan<f.orphan;if(r.d2!==f.d2)return r.d2<f.d2;let u=r.rowId.localeCompare(f.rowId);return u!==0?u<0:r.startIndex<f.startIndex};for(let[r,u]of m){let g=[...u].sort((d,h)=>d.index-h.index),p=0;for(;p<g.length;){if(!g[p].elig){p++;continue}let d=p;for(;d<g.length&&g[d].elig&&(d===p||g[d].index===g[d-1].index+1);)d++;let h=d-p;for(let x=0;x+e<=h;x++){let j=x,F=h-(x+e),L=j===1||F===1?1:0,S=g.slice(p+x,p+x+e).map(T=>T.seat),_={labels:S.map(T=>T.label),seats:S,rowId:r,startIndex:g[p+x].index,orphan:L,nonPremium:a?S.reduce((T,q)=>T+(P(q)?0:1),0):0,d2:w(R(S),K(S,o))};B(_)&&(f=_)}p=d}}return f?{labels:f.labels}:y?{labels:[],reason:s.length?"not_enough_together":"sold_out"}:s.length<e?{labels:[],reason:"not_enough_together"}:{labels:s.map((r,u)=>({seat:r,i:u,d2:w(r,r.focalPoint??o)})).sort((r,u)=>{if(a){let p=P(r.seat)?0:1,d=P(u.seat)?0:1;if(p!==d)return p-d}if(r.d2!==u.d2)return r.d2-u.d2;let g=(r.seat.logicalRowId??r.seat.rowId).localeCompare(u.seat.logicalRowId??u.seat.rowId);return g!==0?g:E(r.seat,r.i)-E(u.seat,u.i)}).slice(0,e).map(r=>r.seat.label)}}function ee(t,n,i,e){let c=Math.floor(e.qty),l=V(t,i,e),a=n.filter(s=>s.bookingMode==="whole"&&s.capacity===c&&i.has(s.label)&&(!e.categoryKey||s.categoryKey===e.categoryKey)&&(!e.zoneId||s.zoneId===e.zoneId)&&!e.accessibility).map(s=>({table:s,d2:w(s.center,s.focalPoint??e.focal)})).sort((s,f)=>s.d2-f.d2||s.table.label.localeCompare(f.table.label))[0];if(!a)return l;if(!l.labels.length)return{labels:[a.table.label]};let b=new Map(t.map(s=>[s.label,s])),y=l.labels.map(s=>b.get(s)).filter(s=>!!s),m=y.length?w(R(y),K(y,e.focal)):Number.POSITIVE_INFINITY;return a.d2<m?{labels:[a.table.label]}:l}var k=class extends Error{constructor(i,e){super(e);this.objectId=i;this.name="GroupedTableProjectionError"}};function H(t){let n=t.minOccupancy,i=t.maxOccupancy;if(!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<n||i>t.seatCount)throw new k(t.id,`Table "${t.label}" has invalid variable-occupancy bounds`);return{min:n,max:i}}function ie(t,n){if(n!==2)return[];let i=[];for(let e of O(t)){if(e.type!=="table"||!e.bookAsWhole&&!e.variableOccupancy)continue;if(e.bookAsWhole&&e.variableOccupancy)throw new k(e.id,`Table "${e.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(e.seatCount)||e.seatCount<1||!e.label.trim())throw new k(e.id,"Grouped tables require a label and at least one chair");let c=e.variableOccupancy?"variable":"whole",l=c==="variable"?H(e):{min:e.seatCount,max:e.seatCount};i.push({objectId:e.id,label:e.label,...e.displayLabel?{displayLabel:e.displayLabel}:{},...e.displayType?{displayType:e.displayType}:{},categoryKey:e.categoryKey,mode:c,capacity:e.seatCount,minOccupancy:l.min,maxOccupancy:l.max,chairs:A(e)})}return i}export{$ as a,D as b,C as c,Q as d,M as e,U as f,X as g,V as h,ee as i,k as j,ie as k};
1
+ import{Ka as A,Ta as O,Wa as v}from"./chunk-24O23MNB.js";function I(t){let n=Number(t.slice(t.lastIndexOf(":")+1));return Number.isFinite(n)?n:-1}function $(t,n,i){let e=new Map;for(let o of t){if(o.kind==="booth")continue;let a=e.get(o.rowId);a?a.push(o):e.set(o.rowId,[o])}let c=o=>i.has(o.id)||n(o.id)!=="free",l=[];for(let o of e.values())if(!(o.length<3)){o.sort((a,b)=>I(a.id)-I(b.id));for(let a=1;a<o.length-1;a++){let b=o[a];if(c(b))continue;let y=o[a-1],m=o[a+1];I(b.id)-I(y.id)!==1||I(m.id)-I(b.id)!==1||!c(y)||!c(m)||!i.has(y.id)&&!i.has(m.id)||l.push(b)}}return l}function D(t){return{code:"ticket_option_not_applicable",labels:t,message:"That ticket choice is not available for the selected seat."}}function C(t,n){let i=t.applicability;return i?!(i.seatLabels?.length&&!i.seatLabels.includes(n.label)||i.accessibility?.length&&!i.accessibility.some(e=>n.accessibility?.includes(e))):!0}function Q(t,n){return(t.categories.find(i=>i.key===n.categoryKey)?.tiers??[]).filter(i=>C(i,n))}function M(t,n,i){let e=t.categories.find(l=>l.key===n.categoryKey)?.tiers;if(!e?.length)return{kind:"none"};let c=i==null?e.find(l=>C(l,n)):e.find(l=>l.id===i&&C(l,n));return c?{kind:"resolved",tier:c}:{kind:"invalid"}}function z(t,n){return(t.logicalRowId??t.rowId)===(n.logicalRowId??n.rowId)}function N(t){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let n=t.id.slice(t.id.lastIndexOf(":")+1),i=Number(n);return Number.isInteger(i)?i:void 0}function G(t,n){if(!z(t,n))return!1;let i=N(t),e=N(n);return i!=null&&e!=null&&Math.abs(i-e)===1}function U(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=n.flatMap(o=>{let a=i.get(o.label);return a?[{selection:o,seat:a}]:[]}),c=e.map(({seat:o})=>o).filter(o=>o.accessibility?.includes("wheelchair")),l=[];for(let{selection:o,seat:a}of e){let b=M(t,a,o.tierId),y=b.kind==="resolved"?b.tier:void 0;(a.accessibility?.includes("companion")||y?.restriction==="companion")&&!c.some(s=>s.id!==a.id&&G(a,s))&&l.push(a.label)}return l.length?{code:"companion_pair_required",labels:l,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function X(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=new Set(t.categories.filter(o=>o.notForSale).map(o=>o.key)),c=[],l=[];for(let o of n){let a=i.get(o.label);if(!a)continue;if(e.has(a.categoryKey)){c.push(a.label);continue}M(t,a,o.tierId).kind==="invalid"&&l.push(a.label)}return c.length?{code:"not_for_sale",labels:c,message:"These seats are not for sale."}:l.length?D(l):U(t,n)}function E(t,n){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let i=t.id.lastIndexOf(":");if(i<0)return n;let e=Number(t.id.slice(i+1));return Number.isFinite(e)?e:n}function w(t,n){let i=t.x-n.x,e=t.y-n.y;return i*i+e*e}function R(t){let n=0,i=0;for(let e of t)n+=e.x,i+=e.y;return{x:n/t.length,y:i/t.length}}function K(t,n){return t.find(i=>i.focalPoint)?.focalPoint??n}function P(t){return t.commercial?.premium===!0}function V(t,n,i){let e=Math.floor(i.qty);if(!Number.isFinite(e)||e<=0)return{labels:[],reason:"sold_out"};let{categoryKey:c,zoneId:l,focal:o,preferPremium:a,accessibility:b,requireContiguous:y}=i,m=new Map,s=[];if(t.forEach((r,u)=>{let g=n.has(r.label)&&(!c||r.categoryKey===c)&&(!l||r.zoneId===l)&&(!b||b.some(h=>r.accessibility?.includes(h))),p=r.logicalRowId??r.rowId,d=m.get(p);d||(d=[],m.set(p,d)),d.push({seat:r,index:E(r,u),elig:g}),g&&s.push(r)}),s.length===0)return{labels:[],reason:"sold_out"};let f=null,B=r=>{if(!f)return!0;if(a&&r.nonPremium!==f.nonPremium)return r.nonPremium<f.nonPremium;if(r.orphan!==f.orphan)return r.orphan<f.orphan;if(r.d2!==f.d2)return r.d2<f.d2;let u=r.rowId.localeCompare(f.rowId);return u!==0?u<0:r.startIndex<f.startIndex};for(let[r,u]of m){let g=[...u].sort((d,h)=>d.index-h.index),p=0;for(;p<g.length;){if(!g[p].elig){p++;continue}let d=p;for(;d<g.length&&g[d].elig&&(d===p||g[d].index===g[d-1].index+1);)d++;let h=d-p;for(let x=0;x+e<=h;x++){let j=x,F=h-(x+e),L=j===1||F===1?1:0,S=g.slice(p+x,p+x+e).map(T=>T.seat),_={labels:S.map(T=>T.label),seats:S,rowId:r,startIndex:g[p+x].index,orphan:L,nonPremium:a?S.reduce((T,q)=>T+(P(q)?0:1),0):0,d2:w(R(S),K(S,o))};B(_)&&(f=_)}p=d}}return f?{labels:f.labels}:y?{labels:[],reason:s.length?"not_enough_together":"sold_out"}:s.length<e?{labels:[],reason:"not_enough_together"}:{labels:s.map((r,u)=>({seat:r,i:u,d2:w(r,r.focalPoint??o)})).sort((r,u)=>{if(a){let p=P(r.seat)?0:1,d=P(u.seat)?0:1;if(p!==d)return p-d}if(r.d2!==u.d2)return r.d2-u.d2;let g=(r.seat.logicalRowId??r.seat.rowId).localeCompare(u.seat.logicalRowId??u.seat.rowId);return g!==0?g:E(r.seat,r.i)-E(u.seat,u.i)}).slice(0,e).map(r=>r.seat.label)}}function ee(t,n,i,e){let c=Math.floor(e.qty),l=V(t,i,e),a=n.filter(s=>s.bookingMode==="whole"&&s.capacity===c&&i.has(s.label)&&(!e.categoryKey||s.categoryKey===e.categoryKey)&&(!e.zoneId||s.zoneId===e.zoneId)&&!e.accessibility).map(s=>({table:s,d2:w(s.center,s.focalPoint??e.focal)})).sort((s,f)=>s.d2-f.d2||s.table.label.localeCompare(f.table.label))[0];if(!a)return l;if(!l.labels.length)return{labels:[a.table.label]};let b=new Map(t.map(s=>[s.label,s])),y=l.labels.map(s=>b.get(s)).filter(s=>!!s),m=y.length?w(R(y),K(y,e.focal)):Number.POSITIVE_INFINITY;return a.d2<m?{labels:[a.table.label]}:l}var k=class extends Error{constructor(i,e){super(e);this.objectId=i;this.name="GroupedTableProjectionError"}};function H(t){let n=t.minOccupancy,i=t.maxOccupancy;if(!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<n||i>t.seatCount)throw new k(t.id,`Table "${t.label}" has invalid variable-occupancy bounds`);return{min:n,max:i}}function ie(t,n){if(n!==2)return[];let i=[];for(let e of O(t)){if(e.type!=="table"||!e.bookAsWhole&&!e.variableOccupancy)continue;if(e.bookAsWhole&&e.variableOccupancy)throw new k(e.id,`Table "${e.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(e.seatCount)||e.seatCount<1||!e.label.trim())throw new k(e.id,"Grouped tables require a label and at least one chair");let c=e.variableOccupancy?"variable":"whole",l=c==="variable"?H(e):{min:e.seatCount,max:e.seatCount};i.push({objectId:e.id,label:e.label,...e.displayLabel?{displayLabel:e.displayLabel}:{},...e.displayType?{displayType:e.displayType}:{},categoryKey:e.categoryKey,mode:c,capacity:e.seatCount,minOccupancy:l.min,maxOccupancy:l.max,chairs:A(e)})}return i}export{$ as a,D as b,C as c,Q as d,M as e,U as f,X as g,V as h,ee as i,k as j,ie as k};
@@ -1 +1 @@
1
- import{ia as Y}from"./chunk-KN7GLEAI.js";function nn(c){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(l,a)=>Math.hypot(l-c.x,a-c.y),gradientAt:(l,a)=>{let e=l-c.x,f=a-c.y,i=Math.hypot(e,f);return i<1e-9?[0,0]:[e/i,f/i]}}}function tn(c,l){if(!c.length)return null;let a=0,e=0,f=0;for(let n of c)a+=n.x,e+=n.y,f+=Math.hypot(n.x-l.x,n.y-l.y);let i=c.length;a/=i,e/=i,f/=i;let u=c[0],R=-1;for(let n of c){let o=Math.hypot(n.x-a,n.y-e);o>R&&(R=o,u=n)}let b=u.x-a,m=u.y-e,d=Math.hypot(b,m);d>1e-9?(b/=d,m/=d):(b=1,m=0);let y=[...c].sort((n,o)=>(n.x-a)*b+(n.y-e)*m-((o.x-a)*b+(o.y-e)*m)),t=0;for(let n of y){let o=Math.hypot(n.x-a,n.y-e);o>t&&(t=o)}return{pts:y,cx:a,cy:e,radius:t,depth:f}}function Z(c,l,a){let e=c.pts;if(e.length===1)return Math.hypot(l-e[0].x,a-e[0].y);let f=1/0;for(let i=0;i+1<e.length;i++){let u=e[i],R=e[i+1],b=R.x-u.x,m=R.y-u.y,d=b*b+m*m,y=d>1e-12?((l-u.x)*b+(a-u.y)*m)/d:0;y<0?y=0:y>1&&(y=1);let t=Math.hypot(l-(u.x+y*b),a-(u.y+y*m));t<f&&(f=t)}return f}var U=8;function en(c,l,a){let e=new Array(U).fill(1/0),f=new Array(U).fill(-1);for(let d=0;d<c.length;d++){let y=c[d],t=Math.hypot(l-y.cx,a-y.cy)-y.radius;for(let n=0;n<U;n++)if(t<e[n]){for(let o=U-1;o>n;o--)e[o]=e[o-1],f[o]=f[o-1];e[n]=t,f[n]=d;break}}let i=new Array(3).fill(1/0),u=new Array(3).fill(-1);for(let d of f){if(d<0)continue;let y=Z(c[d],l,a);for(let t=0;t<3;t++)if(y<i[t]){for(let n=2;n>t;n--)i[n]=i[n-1],u[n]=u[n-1];i[t]=y,u[t]=d;break}}if(u[0]<0)return 0;if(i[0]<1e-6)return c[u[0]].depth;let R=i[0]*2.2,b=0,m=0;for(let d=0;d<3;d++){let y=u[d];if(y<0||i[d]>R)continue;let t=1/(i[d]*i[d]);b+=t*c[y].depth,m+=t}return m>0?b/m:c[u[0]].depth}function on(c){let l=(e,f)=>en(c,e,f),a=(e,f)=>{let i=1/0,u=-1;for(let R=0;R<c.length;R++){let b=c[R];if(Math.hypot(e-b.cx,f-b.cy)-b.radius>=i)continue;let m=Z(b,e,f);m<i&&(i=m,u=R)}return u};return{kind:"rows",rowCount:c.length,rows:c,nearestRow:a,depthAt:l,gradientAt:(e,f)=>{let i=(l(e+.5,f)-l(e-.5,f))/1,u=(l(e,f+.5)-l(e,f-.5))/(2*.5),R=Math.hypot(i,u);return R<1e-9?[0,0]:[i/R,u/R]}}}function bn(c,l){let a=[];for(let e of c){let f=tn(e.points,l);f&&a.push(f)}return a.length<2?nn(l):(a.sort((e,f)=>e.depth-f.depth),on(a))}var rn=Math.PI/180,h=96,sn=6,ln=60,cn=150,$=.2,an=.35;function fn(c,l){let a=Math.atan2(l.x-c.x,l.y-c.y)/rn;return a<0?a+360:a}function z(c){if(!c.length)return NaN;let l=[...c].sort((a,e)=>a-e);return l[Math.floor(l.length/2)]}function J(c,l,a=2){let e=c.length,f=new Float64Array(e);for(let i=0;i<e;i++){let u=0,R=0;for(let b=-a;b<=a;b++){let m=i+b;if(l)m=(m%e+e)%e;else if(m<0||m>=e)continue;u+=c[m],R++}f[i]=u/R}return f}function hn(c,l){let a=c.filter(t=>t.rows.length>=1);if(a.length<1)return null;let e=[],f=0,i=0,u=0;for(let t of a)for(let n of t.rows){for(let o of n.pts)f+=o.x,i+=o.y,u++;if(n.pts.length>=4){let o=Y(n.pts);o&&Number.isFinite(o.cx)&&Number.isFinite(o.cy)&&e.push({x:o.cx,y:o.cy})}}if(!u)return null;let R={x:f/u,y:i/u},b=R;if(e.length>=8){let t=z(e.map(D=>D.x)),n=z(e.map(D=>D.y)),o=0;for(let D of a)for(let j of D.rows)for(let F of j.pts){let W=Math.hypot(F.x-R.x,F.y-R.y);W>o&&(o=W)}let B=0,S=o*.2;for(let D of a)for(let j of D.rows)for(let F of j.pts)Math.hypot(F.x-t,F.y-n)<S&&B++;Math.hypot(t-R.x,n-R.y)<=o&&B/u<.01&&(b={x:t,y:n})}let m=[];for(let t of a){let n={sectionId:t.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let o of t.rows)for(let B of o.pts){let S=Math.hypot(B.x-b.x,B.y-b.y),D=Math.min(h-1,Math.floor(fn(b,B)/(360/h)));n.samples.push({r:S,bin:D,levelM:o.levelM}),S<n.rMin&&(n.rMin=S),S>n.rMax&&(n.rMax=S)}n.samples.length&&m.push(n)}if(!m.length)return null;m.sort((t,n)=>t.rMin+t.rMax-(n.rMin+n.rMax));let d=[];for(let t of m){let n=!1;for(let o of d){let B=Math.min(t.rMax,o.rMax)-Math.max(t.rMin,o.rMin),S=Math.min(t.rMax-t.rMin,o.rMax-o.rMin);if(S>1e-9&&B>=an*S){o.members.push(t),o.rMin=Math.min(o.rMin,t.rMin),o.rMax=Math.max(o.rMax,t.rMax),n=!0;break}}n||d.push({members:[t],rMin:t.rMin,rMax:t.rMax})}let y=[];for(let t of d){let n=new Array(h).fill(null);for(let r of t.members)for(let p of r.samples){let x=n[p.bin];x||(x={samples:[]},n[p.bin]=x),x.samples.push({r:p.r,levelM:p.levelM})}let o=n.map(r=>!!r);if(!o.filter(Boolean).length)continue;let S=[],D=[];for(let r of n){if(!r)continue;let p=1/0,x=-1/0;for(let A of r.samples)A.r<p&&(p=A.r),A.r>x&&(x=A.r);S.push(p),D.push(x)}let j=z(S),F=z(D);if(!(j>=$*F)||!(F>0))continue;let W=[...S].sort((r,p)=>r-p);if(!(W[Math.floor(W.length*.1)]>=$*F))continue;let V=n.map(r=>{if(!r)return null;let p=[...r.samples].sort((w,k)=>w.r-k.r),x=p[0].r,A=p[p.length-1].r,P=p[0].levelM,N=-1/0;for(let w of p)w.levelM>N&&(N=w.levelM);let M=[];for(let w of p){let k={r:w.r,l:w.levelM};for(;M.length&&Math.abs(M[M.length-1].r-k.r)<1e-9;){if(M[M.length-1].l<=k.l){k.skip=!0;break}M.pop()}if(!k.skip){for(;M.length>=2;){let L=M[M.length-2],v=M[M.length-1];if((v.r-L.r)*(k.l-L.l)-(v.l-L.l)*(k.r-L.r)<=0)M.pop();else break}M.push(k)}}let C=M.map(w=>w.r),_=M.map(w=>w.l);return{inner:x,outer:A,front:P,top:N,profile:{rs:C,ls:_}}}),O=o.slice();for(let r=0;r<h;r++){if(O[r])continue;let p=-1,x=-1,A=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(O[g]){p=g;break}}for(let s=1;s<=h;s++){let g=(r+s)%h;if(O[g]){x=g,A=s;break}}if(p<0||x<0)continue;let P=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(o[g]){P=s;break}}if(P-1+A>sn)continue;let M=V[p],C=V[x],_=P/(P+A),w=M.inner+(C.inner-M.inner)*_,k=M.outer+(C.outer-M.outer)*_,L=M.front+(C.front-M.front)*_,v=M.top+(C.top-M.top)*_;V[r]={inner:w,outer:k,front:L,top:v,profile:{rs:[w,k],ls:[L,v]}}}for(let r=0;r<h;r++)V[r]&&(O[r]=!0);let X=360/h,K=[],q=O.filter(Boolean).length,Q=[];if(q===h)Q.push({start:0,len:h});else{let r=0;for(;O[r];)r=(r+1)%h;let p=-1;for(let x=0;x<=h;x++){let A=(r+x)%h,P=x<h&&O[A];if(P&&p<0)p=A;else if(!P&&p>=0){let N=(A-p+h)%h||h;Q.push({start:p,len:N}),p=-1}}}for(let r of Q){if(r.len*X<ln&&r.len<h)continue;let p=r.len===h,x=new Float64Array(r.len),A=new Float64Array(r.len),P=new Float64Array(r.len),N=new Float64Array(r.len),M=[];for(let s=0;s<r.len;s++){let g=V[(r.start+s)%h];x[s]=g.inner,A[s]=g.outer,P[s]=g.front,N[s]=g.top,M.push(g.profile??{rs:[g.inner,g.outer],ls:[g.front,g.top]})}let C=J(x,p),_=J(A,p),w=J(P,p),k=J(N,p);for(let s=0;s<r.len;s++)C[s]>x[s]&&(C[s]=x[s]),_[s]<A[s]&&(_[s]=A[s]),C[s]>_[s]-1e-6&&(C[s]=Math.max(0,_[s]-1e-6)),k[s]<w[s]&&(k[s]=w[s]);let L={startBin:r.start,binCount:r.len,closed:p,innerR:C,outerR:_,frontLevelM:w,topLevelM:k,profiles:M},v=(s,g,I)=>{let H=M[s],T=H.rs,E=H.ls;if(g<=T[0]){E[0]>I&&(E[0]=I);return}if(g>=T[T.length-1]){E[E.length-1]>I&&(E[E.length-1]=I);return}for(let G=0;G+1<T.length;G++)if(g<=T[G+1]){E[G]>I&&(E[G]=I),E[G+1]>I&&(E[G+1]=I);return}};for(let s=0;s<r.len;s++){let g=n[(r.start+s)%h];if(g)for(let I of g.samples){v(s,I.r,I.levelM);let H=p?(s-1+r.len)%r.len:s-1,T=p?(s+1)%r.len:s+1;H>=0&&v(H,I.r,I.levelM),T<r.len&&v(T,I.r,I.levelM)}}K.push(L)}K.reduce((r,p)=>r+p.binCount*X,0)<cn||y.push({arcs:K,sectionIds:t.members.map(r=>r.sectionId),innerRMedian:j,outerRMedian:F})}if(!y.length)return null;if(y.sort((t,n)=>t.innerRMedian-n.innerRMedian),l){let t=y[y.length-1].outerRMedian;if(Math.hypot(l.x-b.x,l.y-b.y)>.9*t)return null}return{centre:b,binCount:h,binStepDeg:360/h,rings:y}}function dn(c,l,a,e){let f=c.binStepDeg,i=a/f-.5-l.startBin;i=(i%c.binCount+c.binCount)%c.binCount,i>l.binCount-1&&(l.closed?i=i-l.binCount<l.binCount-i?0:l.binCount-1:i=i-(l.binCount-1)<c.binCount-i?l.binCount-1:0);let u=Math.floor(i),R=l.closed?(u+1)%l.binCount:Math.min(l.binCount-1,u+1),b=i-u,m=d=>{let y=l.profiles[d],t=y.rs,n=y.ls;if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];for(let o=0;o+1<t.length;o++)if(e<=t[o+1]){let B=t[o+1]-t[o],S=B>1e-9?(e-t[o])/B:0;return n[o]+(n[o+1]-n[o])*S}return n[n.length-1]};return m(u)*(1-b)+m(R)*b}export{bn as a,fn as b,hn as c,dn as d};
1
+ import{ua as Y}from"./chunk-24O23MNB.js";function nn(c){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(l,a)=>Math.hypot(l-c.x,a-c.y),gradientAt:(l,a)=>{let e=l-c.x,f=a-c.y,i=Math.hypot(e,f);return i<1e-9?[0,0]:[e/i,f/i]}}}function tn(c,l){if(!c.length)return null;let a=0,e=0,f=0;for(let n of c)a+=n.x,e+=n.y,f+=Math.hypot(n.x-l.x,n.y-l.y);let i=c.length;a/=i,e/=i,f/=i;let u=c[0],R=-1;for(let n of c){let o=Math.hypot(n.x-a,n.y-e);o>R&&(R=o,u=n)}let b=u.x-a,m=u.y-e,d=Math.hypot(b,m);d>1e-9?(b/=d,m/=d):(b=1,m=0);let y=[...c].sort((n,o)=>(n.x-a)*b+(n.y-e)*m-((o.x-a)*b+(o.y-e)*m)),t=0;for(let n of y){let o=Math.hypot(n.x-a,n.y-e);o>t&&(t=o)}return{pts:y,cx:a,cy:e,radius:t,depth:f}}function Z(c,l,a){let e=c.pts;if(e.length===1)return Math.hypot(l-e[0].x,a-e[0].y);let f=1/0;for(let i=0;i+1<e.length;i++){let u=e[i],R=e[i+1],b=R.x-u.x,m=R.y-u.y,d=b*b+m*m,y=d>1e-12?((l-u.x)*b+(a-u.y)*m)/d:0;y<0?y=0:y>1&&(y=1);let t=Math.hypot(l-(u.x+y*b),a-(u.y+y*m));t<f&&(f=t)}return f}var U=8;function en(c,l,a){let e=new Array(U).fill(1/0),f=new Array(U).fill(-1);for(let d=0;d<c.length;d++){let y=c[d],t=Math.hypot(l-y.cx,a-y.cy)-y.radius;for(let n=0;n<U;n++)if(t<e[n]){for(let o=U-1;o>n;o--)e[o]=e[o-1],f[o]=f[o-1];e[n]=t,f[n]=d;break}}let i=new Array(3).fill(1/0),u=new Array(3).fill(-1);for(let d of f){if(d<0)continue;let y=Z(c[d],l,a);for(let t=0;t<3;t++)if(y<i[t]){for(let n=2;n>t;n--)i[n]=i[n-1],u[n]=u[n-1];i[t]=y,u[t]=d;break}}if(u[0]<0)return 0;if(i[0]<1e-6)return c[u[0]].depth;let R=i[0]*2.2,b=0,m=0;for(let d=0;d<3;d++){let y=u[d];if(y<0||i[d]>R)continue;let t=1/(i[d]*i[d]);b+=t*c[y].depth,m+=t}return m>0?b/m:c[u[0]].depth}function on(c){let l=(e,f)=>en(c,e,f),a=(e,f)=>{let i=1/0,u=-1;for(let R=0;R<c.length;R++){let b=c[R];if(Math.hypot(e-b.cx,f-b.cy)-b.radius>=i)continue;let m=Z(b,e,f);m<i&&(i=m,u=R)}return u};return{kind:"rows",rowCount:c.length,rows:c,nearestRow:a,depthAt:l,gradientAt:(e,f)=>{let i=(l(e+.5,f)-l(e-.5,f))/1,u=(l(e,f+.5)-l(e,f-.5))/(2*.5),R=Math.hypot(i,u);return R<1e-9?[0,0]:[i/R,u/R]}}}function bn(c,l){let a=[];for(let e of c){let f=tn(e.points,l);f&&a.push(f)}return a.length<2?nn(l):(a.sort((e,f)=>e.depth-f.depth),on(a))}var rn=Math.PI/180,h=96,sn=6,ln=60,cn=150,$=.2,an=.35;function fn(c,l){let a=Math.atan2(l.x-c.x,l.y-c.y)/rn;return a<0?a+360:a}function z(c){if(!c.length)return NaN;let l=[...c].sort((a,e)=>a-e);return l[Math.floor(l.length/2)]}function J(c,l,a=2){let e=c.length,f=new Float64Array(e);for(let i=0;i<e;i++){let u=0,R=0;for(let b=-a;b<=a;b++){let m=i+b;if(l)m=(m%e+e)%e;else if(m<0||m>=e)continue;u+=c[m],R++}f[i]=u/R}return f}function hn(c,l){let a=c.filter(t=>t.rows.length>=1);if(a.length<1)return null;let e=[],f=0,i=0,u=0;for(let t of a)for(let n of t.rows){for(let o of n.pts)f+=o.x,i+=o.y,u++;if(n.pts.length>=4){let o=Y(n.pts);o&&Number.isFinite(o.cx)&&Number.isFinite(o.cy)&&e.push({x:o.cx,y:o.cy})}}if(!u)return null;let R={x:f/u,y:i/u},b=R;if(e.length>=8){let t=z(e.map(D=>D.x)),n=z(e.map(D=>D.y)),o=0;for(let D of a)for(let j of D.rows)for(let F of j.pts){let W=Math.hypot(F.x-R.x,F.y-R.y);W>o&&(o=W)}let B=0,S=o*.2;for(let D of a)for(let j of D.rows)for(let F of j.pts)Math.hypot(F.x-t,F.y-n)<S&&B++;Math.hypot(t-R.x,n-R.y)<=o&&B/u<.01&&(b={x:t,y:n})}let m=[];for(let t of a){let n={sectionId:t.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let o of t.rows)for(let B of o.pts){let S=Math.hypot(B.x-b.x,B.y-b.y),D=Math.min(h-1,Math.floor(fn(b,B)/(360/h)));n.samples.push({r:S,bin:D,levelM:o.levelM}),S<n.rMin&&(n.rMin=S),S>n.rMax&&(n.rMax=S)}n.samples.length&&m.push(n)}if(!m.length)return null;m.sort((t,n)=>t.rMin+t.rMax-(n.rMin+n.rMax));let d=[];for(let t of m){let n=!1;for(let o of d){let B=Math.min(t.rMax,o.rMax)-Math.max(t.rMin,o.rMin),S=Math.min(t.rMax-t.rMin,o.rMax-o.rMin);if(S>1e-9&&B>=an*S){o.members.push(t),o.rMin=Math.min(o.rMin,t.rMin),o.rMax=Math.max(o.rMax,t.rMax),n=!0;break}}n||d.push({members:[t],rMin:t.rMin,rMax:t.rMax})}let y=[];for(let t of d){let n=new Array(h).fill(null);for(let r of t.members)for(let p of r.samples){let x=n[p.bin];x||(x={samples:[]},n[p.bin]=x),x.samples.push({r:p.r,levelM:p.levelM})}let o=n.map(r=>!!r);if(!o.filter(Boolean).length)continue;let S=[],D=[];for(let r of n){if(!r)continue;let p=1/0,x=-1/0;for(let A of r.samples)A.r<p&&(p=A.r),A.r>x&&(x=A.r);S.push(p),D.push(x)}let j=z(S),F=z(D);if(!(j>=$*F)||!(F>0))continue;let W=[...S].sort((r,p)=>r-p);if(!(W[Math.floor(W.length*.1)]>=$*F))continue;let V=n.map(r=>{if(!r)return null;let p=[...r.samples].sort((w,k)=>w.r-k.r),x=p[0].r,A=p[p.length-1].r,P=p[0].levelM,N=-1/0;for(let w of p)w.levelM>N&&(N=w.levelM);let M=[];for(let w of p){let k={r:w.r,l:w.levelM};for(;M.length&&Math.abs(M[M.length-1].r-k.r)<1e-9;){if(M[M.length-1].l<=k.l){k.skip=!0;break}M.pop()}if(!k.skip){for(;M.length>=2;){let L=M[M.length-2],v=M[M.length-1];if((v.r-L.r)*(k.l-L.l)-(v.l-L.l)*(k.r-L.r)<=0)M.pop();else break}M.push(k)}}let C=M.map(w=>w.r),_=M.map(w=>w.l);return{inner:x,outer:A,front:P,top:N,profile:{rs:C,ls:_}}}),O=o.slice();for(let r=0;r<h;r++){if(O[r])continue;let p=-1,x=-1,A=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(O[g]){p=g;break}}for(let s=1;s<=h;s++){let g=(r+s)%h;if(O[g]){x=g,A=s;break}}if(p<0||x<0)continue;let P=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(o[g]){P=s;break}}if(P-1+A>sn)continue;let M=V[p],C=V[x],_=P/(P+A),w=M.inner+(C.inner-M.inner)*_,k=M.outer+(C.outer-M.outer)*_,L=M.front+(C.front-M.front)*_,v=M.top+(C.top-M.top)*_;V[r]={inner:w,outer:k,front:L,top:v,profile:{rs:[w,k],ls:[L,v]}}}for(let r=0;r<h;r++)V[r]&&(O[r]=!0);let X=360/h,K=[],q=O.filter(Boolean).length,Q=[];if(q===h)Q.push({start:0,len:h});else{let r=0;for(;O[r];)r=(r+1)%h;let p=-1;for(let x=0;x<=h;x++){let A=(r+x)%h,P=x<h&&O[A];if(P&&p<0)p=A;else if(!P&&p>=0){let N=(A-p+h)%h||h;Q.push({start:p,len:N}),p=-1}}}for(let r of Q){if(r.len*X<ln&&r.len<h)continue;let p=r.len===h,x=new Float64Array(r.len),A=new Float64Array(r.len),P=new Float64Array(r.len),N=new Float64Array(r.len),M=[];for(let s=0;s<r.len;s++){let g=V[(r.start+s)%h];x[s]=g.inner,A[s]=g.outer,P[s]=g.front,N[s]=g.top,M.push(g.profile??{rs:[g.inner,g.outer],ls:[g.front,g.top]})}let C=J(x,p),_=J(A,p),w=J(P,p),k=J(N,p);for(let s=0;s<r.len;s++)C[s]>x[s]&&(C[s]=x[s]),_[s]<A[s]&&(_[s]=A[s]),C[s]>_[s]-1e-6&&(C[s]=Math.max(0,_[s]-1e-6)),k[s]<w[s]&&(k[s]=w[s]);let L={startBin:r.start,binCount:r.len,closed:p,innerR:C,outerR:_,frontLevelM:w,topLevelM:k,profiles:M},v=(s,g,I)=>{let H=M[s],T=H.rs,E=H.ls;if(g<=T[0]){E[0]>I&&(E[0]=I);return}if(g>=T[T.length-1]){E[E.length-1]>I&&(E[E.length-1]=I);return}for(let G=0;G+1<T.length;G++)if(g<=T[G+1]){E[G]>I&&(E[G]=I),E[G+1]>I&&(E[G+1]=I);return}};for(let s=0;s<r.len;s++){let g=n[(r.start+s)%h];if(g)for(let I of g.samples){v(s,I.r,I.levelM);let H=p?(s-1+r.len)%r.len:s-1,T=p?(s+1)%r.len:s+1;H>=0&&v(H,I.r,I.levelM),T<r.len&&v(T,I.r,I.levelM)}}K.push(L)}K.reduce((r,p)=>r+p.binCount*X,0)<cn||y.push({arcs:K,sectionIds:t.members.map(r=>r.sectionId),innerRMedian:j,outerRMedian:F})}if(!y.length)return null;if(y.sort((t,n)=>t.innerRMedian-n.innerRMedian),l){let t=y[y.length-1].outerRMedian;if(Math.hypot(l.x-b.x,l.y-b.y)>.9*t)return null}return{centre:b,binCount:h,binStepDeg:360/h,rings:y}}function dn(c,l,a,e){let f=c.binStepDeg,i=a/f-.5-l.startBin;i=(i%c.binCount+c.binCount)%c.binCount,i>l.binCount-1&&(l.closed?i=i-l.binCount<l.binCount-i?0:l.binCount-1:i=i-(l.binCount-1)<c.binCount-i?l.binCount-1:0);let u=Math.floor(i),R=l.closed?(u+1)%l.binCount:Math.min(l.binCount-1,u+1),b=i-u,m=d=>{let y=l.profiles[d],t=y.rs,n=y.ls;if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];for(let o=0;o+1<t.length;o++)if(e<=t[o+1]){let B=t[o+1]-t[o],S=B>1e-9?(e-t[o])/B:0;return n[o]+(n[o+1]-n[o])*S}return n[n.length-1]};return m(u)*(1-b)+m(R)*b}export{bn as a,fn as b,hn as c,dn as d};
@@ -1 +1 @@
1
- import{Ba as d,oa as b,sa as p,ta as h,ya as I}from"./chunk-KN7GLEAI.js";var m="__sl_ga__",f=1e5,v=1e5;function j(t,e){return`${m}${encodeURIComponent(t)}__${e+1}`}function S(t){let e=t.inventorySegments;if(e===void 0)return!0;if(!Array.isArray(e)||e.length<1||e.length>256)return!1;let r=0,i=new Map;for(let o of e){if(!o||typeof o.sourceAreaId!="string"||!o.sourceAreaId.trim()||o.sourceAreaId.length>160||!Number.isInteger(o.startIndex)||o.startIndex<0||!Number.isInteger(o.count)||o.count<1||o.startIndex+o.count>f||(r+=o.count,r>f))return!1;let u=i.get(o.sourceAreaId)??[],n=o.startIndex+o.count;if(u.some(s=>o.startIndex<s.end&&n>s.start))return!1;u.push({start:o.startIndex,end:n}),i.set(o.sourceAreaId,u)}return r===t.capacity}function A(t){let e=Math.min(f,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:S(t)?t.inventorySegments.map(r=>({...r})):[]}function y(t){return A(t).flatMap(e=>Array.from({length:e.count},(r,i)=>j(e.sourceAreaId,e.startIndex+i)))}function M(t,e){if(t.inventorySegments===void 0||e===t.capacity)return t.inventorySegments;if(e<t.capacity)return;let r=A(t);if(!r.length)return;let i=e-t.capacity;if(!i)return r;let u=r.filter(s=>s.sourceAreaId===t.id).reduce((s,a)=>Math.max(s,a.startIndex+a.count),0),n=r[r.length-1];if(n?.sourceAreaId===t.id&&n.startIndex+n.count===u)n.count+=i;else{if(r.length>=256)return;r.push({sourceAreaId:t.id,startIndex:u,count:i})}return r}function R(t){return d(t).filter(e=>e.type==="gaArea")}function N(t){return t.startsWith(m)}var g="__ungrouped__";function x(t){return t.type==="row"?b(t).map(e=>e.label):t.type==="table"?p(t).map(e=>e.label):t.type==="booth"?h(t).map(e=>e.label):t.type==="gaArea"?y(t):[]}function O(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function _(t){let e=d(t),r=e.filter(n=>n.type==="section"),i=new Map;for(let n of r){let s=n.logicalSectionId??n.id;i.get(s)||i.set(s,{id:s,label:n.displayLabel||n.label||"Section",zone:n.zone,seatCount:0,objectIds:[],seatLabels:[]})}let o={id:g,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},u=new Map;for(let n of e){if(!O(n))continue;let s=x(n);if(s.length===0)continue;let a=I(e,n),c=a?i.get(a.logicalSectionId??a.id):o;c.seatCount+=s.length,c.objectIds.push(n.id),c.seatLabels.push(...s),u.set(n.id,c.id)}return{sections:[...i.values()],ungrouped:o.objectIds.length?o:null,objectToSection:u}}function C(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function G(t,e){let r=new Set;if(!e.size)return r;let{sections:i,ungrouped:o,objectToSection:u}=_(t),n=new Set,s=new Map(i.map(c=>[c.id,c.zone]));for(let c of i){let l=s.get(c.id);(e.has(c.id)||l&&e.has(l))&&n.add(c.id)}let a=!!o&&e.has(g);for(let[c,l]of u)(n.has(l)||a&&l===g)&&r.add(c);return r}function U(t,e){if(!e.size)return t;let r=G(t,e),i=e instanceof Set?e:new Set(e),o=n=>!(r.has(n.id)||n.type==="section"&&C(n,i));if(t.floors&&t.floors.length){let n=!1,s=t.floors.map(a=>{let c=a.objects.filter(o);return c.length!==a.objects.length&&(n=!0),c.length===a.objects.length?a:{...a,objects:c}});return n?{...t,floors:s,objects:s[0].objects}:t}let u=t.objects.filter(o);return u.length===t.objects.length?t:{...t,objects:u}}export{f as a,v as b,j as c,S as d,A as e,y as f,M as g,R as h,N as i,g as j,_ as k,C as l,G as m,U as n};
1
+ import{Ga as b,Ka as p,La as h,Qa as I,Ta as d}from"./chunk-24O23MNB.js";var m="__sl_ga__",f=1e5,v=1e5;function j(t,e){return`${m}${encodeURIComponent(t)}__${e+1}`}function S(t){let e=t.inventorySegments;if(e===void 0)return!0;if(!Array.isArray(e)||e.length<1||e.length>256)return!1;let r=0,i=new Map;for(let o of e){if(!o||typeof o.sourceAreaId!="string"||!o.sourceAreaId.trim()||o.sourceAreaId.length>160||!Number.isInteger(o.startIndex)||o.startIndex<0||!Number.isInteger(o.count)||o.count<1||o.startIndex+o.count>f||(r+=o.count,r>f))return!1;let u=i.get(o.sourceAreaId)??[],n=o.startIndex+o.count;if(u.some(s=>o.startIndex<s.end&&n>s.start))return!1;u.push({start:o.startIndex,end:n}),i.set(o.sourceAreaId,u)}return r===t.capacity}function A(t){let e=Math.min(f,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:S(t)?t.inventorySegments.map(r=>({...r})):[]}function y(t){return A(t).flatMap(e=>Array.from({length:e.count},(r,i)=>j(e.sourceAreaId,e.startIndex+i)))}function M(t,e){if(t.inventorySegments===void 0||e===t.capacity)return t.inventorySegments;if(e<t.capacity)return;let r=A(t);if(!r.length)return;let i=e-t.capacity;if(!i)return r;let u=r.filter(s=>s.sourceAreaId===t.id).reduce((s,a)=>Math.max(s,a.startIndex+a.count),0),n=r[r.length-1];if(n?.sourceAreaId===t.id&&n.startIndex+n.count===u)n.count+=i;else{if(r.length>=256)return;r.push({sourceAreaId:t.id,startIndex:u,count:i})}return r}function R(t){return d(t).filter(e=>e.type==="gaArea")}function N(t){return t.startsWith(m)}var g="__ungrouped__";function x(t){return t.type==="row"?b(t).map(e=>e.label):t.type==="table"?p(t).map(e=>e.label):t.type==="booth"?h(t).map(e=>e.label):t.type==="gaArea"?y(t):[]}function O(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function _(t){let e=d(t),r=e.filter(n=>n.type==="section"),i=new Map;for(let n of r){let s=n.logicalSectionId??n.id;i.get(s)||i.set(s,{id:s,label:n.displayLabel||n.label||"Section",zone:n.zone,seatCount:0,objectIds:[],seatLabels:[]})}let o={id:g,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},u=new Map;for(let n of e){if(!O(n))continue;let s=x(n);if(s.length===0)continue;let a=I(e,n),c=a?i.get(a.logicalSectionId??a.id):o;c.seatCount+=s.length,c.objectIds.push(n.id),c.seatLabels.push(...s),u.set(n.id,c.id)}return{sections:[...i.values()],ungrouped:o.objectIds.length?o:null,objectToSection:u}}function C(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function G(t,e){let r=new Set;if(!e.size)return r;let{sections:i,ungrouped:o,objectToSection:u}=_(t),n=new Set,s=new Map(i.map(c=>[c.id,c.zone]));for(let c of i){let l=s.get(c.id);(e.has(c.id)||l&&e.has(l))&&n.add(c.id)}let a=!!o&&e.has(g);for(let[c,l]of u)(n.has(l)||a&&l===g)&&r.add(c);return r}function U(t,e){if(!e.size)return t;let r=G(t,e),i=e instanceof Set?e:new Set(e),o=n=>!(r.has(n.id)||n.type==="section"&&C(n,i));if(t.floors&&t.floors.length){let n=!1,s=t.floors.map(a=>{let c=a.objects.filter(o);return c.length!==a.objects.length&&(n=!0),c.length===a.objects.length?a:{...a,objects:c}});return n?{...t,floors:s,objects:s[0].objects}:t}let u=t.objects.filter(o);return u.length===t.objects.length?t:{...t,objects:u}}export{f as a,v as b,j as c,S as d,A as e,y as f,M as g,R as h,N as i,g as j,_ as k,C as l,G as m,U as n};
@@ -0,0 +1 @@
1
+ import{c as K,d as Y,e as _,f as j}from"./chunk-5BGP7S3Q.js";function ce(t){let o=t.mediaKind==="demo-render",i=t.generated||t.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":o?t.coverage==="exact-seat"?"AI-generated exact-seat demo":t.coverage==="row-representative"?"AI-generated representative row demo":t.coverage==="section-representative"?"AI-generated representative section demo":t.coverage==="floor-representative"?"AI-generated representative floor demo":"AI-generated illustrative venue demo":t.coverage==="exact-seat"?"Exact seat photo":t.coverage==="row-representative"?"Representative row view":t.coverage==="section-representative"?"Representative section view":t.coverage==="floor-representative"?"Representative floor view":t.coverage==="venue-representative"?"Representative venue view":"Venue photo",u=t.capturedAt&&/^\d{4}/.test(t.capturedAt)?t.capturedAt.slice(0,4):"";return[i,u?`${o?"created":"captured"} ${u}`:"",t.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function de(t){if(t.generated||t.mediaKind==="model"||t.mediaKind==="demo-render")return!1;let o=t.sourceLabel?.trim()??"";return!/^(?:AI[- ]generated|generated\s+(?:demo|preview))/i.test(o)}var G=70,ee=35,te=90;function ne(t){return Math.max(ee,Math.min(te,t))}var re=35;function oe(t,o,i){let u=(.5+t/360)*i;return o/2-u}function ie(t,o=G){return t*(180/o)}function B(t,o,i){return(t-o)/2+S(i,o)}function S(t,o){let i=re/180*o;return Math.max(-i,Math.min(i,t))}function ae(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function se(t){return t||(ae()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function ue(t,o,i={}){let u=i.fadeMs??400,N=o.initialBearingDeg??0,v=Y(o,K()),b=new AbortController,H=()=>b.abort();i.signal?.addEventListener("abort",H,{once:!0});let a=document.createElement("div"),U=document.activeElement instanceof HTMLElement?document.activeElement:null;a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-label",i.seatLabel?`View from ${i.seatLabel}`:"View from seat"),a.tabIndex=-1,Object.assign(a.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${u}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let r=document.createElement("div");Object.assign(r.style,{position:"absolute",inset:"0",backgroundImage:`url("${v.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),a.appendChild(r);let d=document.createElement("button");if(d.type="button",d.setAttribute("aria-label","Close"),d.textContent="\u2715",Object.assign(d.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),a.appendChild(d),i.disclosure){let e=document.createElement("div");e.textContent=`${i.disclosurePrefix??"360\xB0 panorama"} \xB7 ${i.disclosure}`,Object.assign(e.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),a.appendChild(e)}let D=document.createElement("div");D.textContent=se(i.lookAroundHint),Object.assign(D.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),a.appendChild(D),t.appendChild(a),d.focus({preventScroll:!0});let g=0,s=0,p=0,c=0,m=G,y=()=>{let e=a.clientHeight||1,n=a.clientWidth||1,M=f.naturalWidth||n*2,J=f.naturalHeight||e,Q=g>0?(n/2-p)/g:0,Z=s>0?c/s:0;s=ie(e,m),g=s*(M/J),r.style.backgroundSize=`${g}px ${s}px`,$?p=n/2-Q*g:(p=oe(N,n,g),c=S((o.initialPitchDeg??0)/180*s,s),$=!0),c=S(Z*s,s),r.style.backgroundPosition=`${p}px ${B(e,s,c)}px`},$=!1,z=()=>{let e=a.clientHeight||1;c=S(c,s),r.style.backgroundPosition=`${p}px ${B(e,s,c)}px`},f=new Image;f.onload=y,f.src=v.initialUrl;let O=()=>{};v.upgradeUrl&&(O=j(()=>{(o.resolveUrl?o.resolveUrl(v.upgradeUrl):Promise.resolve(v.upgradeUrl)).then(n=>!n||b.signal.aborted?null:_(n,b.signal).then(M=>({full:M,url:n}))).then(n=>{n&&(I||b.signal.aborted||(f=n.full,r.style.backgroundImage=`url("${n.url}")`,y()))}).catch(()=>{})})),requestAnimationFrame(y);let w=!1,E=0,A=0,h=0,l=new Map,L=()=>{let[e,n]=[...l.values()];return e&&n?Math.hypot(e.x-n.x,e.y-n.y):0},P=e=>{let n=ne(e);n!==m&&(m=n,y())},F=e=>{l.set(e.pointerId,{x:e.clientX,y:e.clientY}),w=l.size===1,E=e.clientX,A=e.clientY,l.size===2&&(h=L()),r.style.cursor="grabbing";try{r.setPointerCapture?.(e.pointerId)}catch{}},R=e=>{if(l.has(e.pointerId)){if(l.set(e.pointerId,{x:e.clientX,y:e.clientY}),l.size>=2){let n=L();h>0&&n>0&&P(m*(h/n)),h=n,w=!1;return}w&&(p+=e.clientX-E,c+=e.clientY-A,E=e.clientX,A=e.clientY,z())}},k=e=>{l.delete(e.pointerId),h=l.size===2?L():0;let n=l.values().next().value;w=l.size===1,n?(E=n.x,A=n.y):r.style.cursor="grab";try{r.releasePointerCapture?.(e.pointerId)}catch{}},T=e=>{e.preventDefault(),P(m+e.deltaY*.04)};r.addEventListener("pointerdown",F),r.addEventListener("pointermove",R),r.addEventListener("pointerup",k),r.addEventListener("pointercancel",k),r.addEventListener("wheel",T,{passive:!1});let C=!1,I=!1,x=0,q=()=>{r.removeEventListener("pointerdown",F),r.removeEventListener("pointermove",R),r.removeEventListener("pointerup",k),r.removeEventListener("pointercancel",k),r.removeEventListener("wheel",T),window.removeEventListener("keydown",X)},W=()=>{O(),b.abort(),i.signal?.removeEventListener("abort",H),x&&(window.clearTimeout(x),x=0),q(),a.parentNode&&a.parentNode.removeChild(a),U?.isConnected&&U.focus({preventScroll:!0})},V=()=>{if(C)return;C=!0,a.style.opacity="0";let e=()=>{x=0,!I&&(W(),i.onClose?.())};x=window.setTimeout(e,u)},X=e=>{if(e.key==="Tab"){e.preventDefault(),d.focus({preventScroll:!0});return}if(e.key==="Escape"){e.stopPropagation(),V();return}if(e.key==="ArrowLeft"||e.key==="ArrowRight")p+=e.key==="ArrowLeft"?-32:32;else if(e.key==="ArrowUp"||e.key==="ArrowDown")c+=(e.key==="ArrowUp"?4:-4)*(s/180);else if(e.key==="+"||e.key==="="){P(m-5),e.preventDefault();return}else if(e.key==="-"){P(m+5),e.preventDefault();return}else return;e.preventDefault(),z()};return window.addEventListener("keydown",X),d.addEventListener("click",V),requestAnimationFrame(()=>{a.style.opacity="1"}),{close:V,dispose(){C=!0,I=!0,W()}}}export{ce as a,de as b,G as c,ne as d,re as e,oe as f,ie as g,B as h,S as i,se as j,ue as k};
@@ -1 +1 @@
1
- import{w as c}from"./chunk-KN7GLEAI.js";var l=72;var A="seatmap.chart";var d=[{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"}],u=new Map(d.map(e=>[e.key,e]));function E(e){return u.get(e)}var b={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 k(e){let t=e?.[0];return t&&b[t]||"#3b82f6"}var g=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],m=new Map(g.map(e=>[e.key,e]));function P(e){return m.get(e)}var M=8,T=24,p=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],y=new Set(p);function O(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&y.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}var V=2e6,S=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,f=/[\s"'<>`\\]/;function v(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return S.test(e);if(f.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function G(e){let t=e.trim();return v(t)?t:null}function h(e){let t=0;for(let r=0,i=e.length;r<i;r+=1){let o=e[r],a=e[(r+1)%i];t+=o.x*a.y-a.x*o.y}return t/2}function z(e){return h(e)*2}function U(e,t,r){let i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let n=e[o],s=e[a];n.y>r!=s.y>r&&t<(s.x-n.x)*(r-n.y)/(s.y-n.y)+n.x&&(i=!i)}return i}var x=.15,R=1.6;function W(e){return c(e??1,x,R)}function C(e){let t=1/0,r=1/0,i=-1/0,o=-1/0,a=!1;for(let n of e)!Number.isFinite(n.x)||!Number.isFinite(n.y)||(a=!0,n.x<t&&(t=n.x),n.y<r&&(r=n.y),n.x>i&&(i=n.x),n.y>o&&(o=n.y));return a?{minX:t,minY:r,maxX:i,maxY:o}:null}function Z(e){let t=C(e);return t?w(t):null}function w(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}function Q(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}export{l as a,A as b,d as c,E as d,b as e,k as f,g,P as h,M as i,T as j,p as k,O as l,V as m,v as n,G as o,C as p,Z as q,Q as r,h as s,z as t,U as u,x as v,R as w,W as x};
1
+ import{I as c}from"./chunk-24O23MNB.js";var l=72;var w="seatmap.chart";var d=[{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"}],u=new Map(d.map(e=>[e.key,e]));function I(e){return u.get(e)}var b={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 A(e){let t=e?.[0];return t&&b[t]||"#3b82f6"}var g=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],m=new Map(g.map(e=>[e.key,e]));function k(e){return m.get(e)}var L=8,E=24,p=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],y=new Set(p);function P(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&y.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}function S(e){let t=0;for(let r=0,i=e.length;r<i;r+=1){let o=e[r],a=e[(r+1)%i];t+=o.x*a.y-a.x*o.y}return t/2}function V(e){return S(e)*2}function Y(e,t,r){let i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let n=e[o],s=e[a];n.y>r!=s.y>r&&t<(s.x-n.x)*(r-n.y)/(s.y-n.y)+n.x&&(i=!i)}return i}var f=.15,v=1.6;function X(e){return c(e??1,f,v)}function h(e){let t=1/0,r=1/0,i=-1/0,o=-1/0,a=!1;for(let n of e)!Number.isFinite(n.x)||!Number.isFinite(n.y)||(a=!0,n.x<t&&(t=n.x),n.y<r&&(r=n.y),n.x>i&&(i=n.x),n.y>o&&(o=n.y));return a?{minX:t,minY:r,maxX:i,maxY:o}:null}function K(e){let t=h(e);return t?x(t):null}function x(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}function H(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}export{l as a,w as b,d as c,I as d,b as e,A as f,g,k as h,L as i,E as j,p as k,P as l,h as m,K as n,H as o,S as p,V as q,Y as r,f as s,v as t,X as u};
@@ -1 +1 @@
1
- import{c,k as A,n as T}from"./chunk-JBOTRSMY.js";var d=7,B=10,N=10,R=15,k=11,y=.85,E=12,M=4.5,x=3,l="#000000",u="#ffffff",Z=24,g=18.67;function G(t,L=400){return t>=Z||L>=700&&t>=g?x:M}function H(t,L){return t*L>=E}var P=24,m={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},v=m.wheelchair;function w(t){if(!t?.length)return null;let L=t.includes("wheelchair")?"wheelchair":t[0];return m[L]??null}function F(t){return/-(\d{1,5})$/.exec(t)?.[1]??t}var a=T;function X(t,L,r){let n=c(t),o=c(L);if(!n||!o)return L;let e=Math.max(0,Math.min(1,r));return`#${n.map((s,_)=>Math.round(s*e+o[_]*(1-e))).map(s=>s.toString(16).padStart(2,"0")).join("")}`}var K=3;function I(t,L,r=M){let n=a(L,t);if(n!=null&&n>=r)return L;let o=a(l,t)??0,e=a(u,t)??0;return o===0&&e===0?L:o>=e?l:u}var S=3;function Y(t){let L=a("#ffffff",t);if(L!=null&&L>=S)return"#ffffff";let r=a(l,t)??0,n=a(u,t)??0;return r===0&&n===0?"#ffffff":r>=n?l:u}var C=/^#[0-9a-f]{6}$/i;function O(t){let L=c(t);return L!=null&&A(L)>.5}var b="#e5e7eb",h="#273142";function D(t){return O(t)?b:h}function U(t,L,r=M){let n=C.test(t.trim()),o=t.trim().toLowerCase(),e=0,i=0,s=null;for(let p of L){if(!n||!C.test(p.trim()))continue;e+=1;let f=I(p,t,r);f.toLowerCase()!==o&&(i+=1,s=f)}return{total:e,overridden:i,status:e===0?"none":i===0?"applies":i===e?"overridden":"mixed",overrideInk:s}}export{d as a,B as b,N as c,R as d,k as e,y as f,E as g,M as h,x as i,l as j,u as k,G as l,H as m,P as n,m as o,v as p,w as q,F as r,a as s,X as t,K as u,I as v,Y as w,O as x,b as y,h as z,D as A,U as B};
1
+ import{c,k as A,n as T}from"./chunk-JBOTRSMY.js";var z=7,B=10,N=10,R=15,k=11,y=.85,E=12,M=4.5,g=3,l="#000000",u="#ffffff",Z=24,I=18.67;function G(t,L=400){return t>=Z||L>=700&&t>=I?g:M}function H(t,L){return t*L>=E}var P=24,x={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},w=x.wheelchair;function v(t){if(!t?.length)return null;let L=t.includes("wheelchair")?"wheelchair":t[0];return x[L]??null}function F(t){return/-(\d{1,5})$/.exec(t)?.[1]??t}var a=T;function X(t,L,r){let n=c(t),o=c(L);if(!n||!o)return L;let e=Math.max(0,Math.min(1,r));return`#${n.map((s,_)=>Math.round(s*e+o[_]*(1-e))).map(s=>s.toString(16).padStart(2,"0")).join("")}`}var K=3;function C(t,L,r=M){let n=a(L,t);if(n!=null&&n>=r)return L;let o=a(l,t)??0,e=a(u,t)??0;return o===0&&e===0?L:o>=e?l:u}function Y(t,L,r,n=M){return L??C(t,r,n)}var S=3;function D(t){let L=a("#ffffff",t);if(L!=null&&L>=S)return"#ffffff";let r=a(l,t)??0,n=a(u,t)??0;return r===0&&n===0?"#ffffff":r>=n?l:u}var m=/^#[0-9a-f]{6}$/i;function O(t){let L=c(t);return L!=null&&A(L)>.5}var b="#e5e7eb",h="#273142";function U(t){return O(t)?b:h}function V(t,L,r=M){let n=m.test(t.trim()),o=t.trim().toLowerCase(),e=0,i=0,s=null;for(let p of L){if(!n||!m.test(p.trim()))continue;e+=1;let f=C(p,t,r);f.toLowerCase()!==o&&(i+=1,s=f)}return{total:e,overridden:i,status:e===0?"none":i===0?"applies":i===e?"overridden":"mixed",overrideInk:s}}export{z as a,B as b,N as c,R as d,k as e,y as f,E as g,M as h,g as i,l as j,u as k,G as l,H as m,P as n,x as o,w as p,v as q,F as r,a as s,X as t,K as u,C as v,Y as w,D as x,O as y,b as z,h as A,U as B,V as C};