@seatlayer/js 0.105.1 → 0.106.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/manager.cjs CHANGED
@@ -1,33 +1,61 @@
1
- "use strict";var os=Object.defineProperty;var co=Object.getOwnPropertyDescriptor;var ho=Object.getOwnPropertyNames;var uo=Object.prototype.hasOwnProperty;var Y=(i,e,t)=>()=>{if(t)throw t[0];try{return i&&(e=i(i=0)),e}catch(s){throw t=[s],s}};var rs=(i,e)=>{for(var t in e)os(i,t,{get:e[t],enumerable:!0})},mo=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ho(e))!uo.call(i,n)&&n!==t&&os(i,n,{get:()=>e[n],enumerable:!(s=co(e,n))||s.enumerable});return i};var po=i=>mo(os({},"__esModule",{value:!0}),i);function Ke(i){i.querySelectorAll("select:not([data-themed])").forEach(e=>{e.dataset.themed="true";let t=document.createElement("details");t.className="slm-themed-picker";let s=document.createElement("summary"),n=document.createElement("div");n.className="slm-themed-options";let a=e.getAttribute("aria-label")||Array.from(e.labels??[]).map(r=>r.textContent).join(" ")||"Choose option";s.setAttribute("aria-label",a.trim()),t.append(s,n),e.after(t),e.hidden=!0;let o=()=>{s.textContent=e.selectedOptions[0]?.textContent??"Choose\u2026",s.setAttribute("aria-disabled",String(e.disabled)),n.replaceChildren(...Array.from(e.options).map(r=>{let l=document.createElement("button");return l.type="button",l.textContent=r.textContent,l.setAttribute("aria-label",r.textContent??""),l.disabled=e.disabled||r.disabled,l.setAttribute("aria-pressed",String(r.selected)),l.onclick=()=>{e.value=r.value,t.open=!1,o(),s.focus(),e.dispatchEvent(new Event("change",{bubbles:!0})),o()},l}))};o(),e.addEventListener("change",o),s.onclick=r=>{if(e.disabled){r.preventDefault();return}o(),i.querySelectorAll(".slm-themed-picker").forEach(l=>{l!==t&&(l.open=!1)})},t.addEventListener("focusout",r=>{t.contains(r.relatedTarget)||(t.open=!1)}),t.addEventListener("keydown",r=>{if(r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),t.open=!1,s.focus()),r.key==="ArrowDown"||r.key==="ArrowUp"){if(e.disabled)return;r.preventDefault(),t.open=!0;let l=Array.from(n.querySelectorAll("button:not(:disabled)")),c=l.indexOf(document.activeElement);l[(c+(r.key==="ArrowDown"?1:l.length-1)+l.length)%l.length]?.focus()}})})}function Zs(i){i.querySelectorAll('input[type="date"],input[type="datetime-local"],input[type="time"]').forEach(e=>{e.dataset.slmPicker!=="1"&&(e.dataset.slmPicker="1",e.addEventListener("click",()=>{if(!(e.disabled||e.readOnly))try{e.showPicker?.()}catch{}}))})}var wt=Y(()=>{"use strict"});function Qs(i){if(We=void 0,!!i)try{new Intl.DateTimeFormat(void 0,{timeZone:i}),We=i}catch{}}function W(i,e,t){let s=e;if(s.hour==="2-digit"){let n=String(t??""),a=Js.get(n);if(a===void 0){let o=new Intl.DateTimeFormat(t,{hour:"numeric"}).resolvedOptions().hourCycle;Js.set(n,a=o==="h12"||o==="h11")}a&&(s={...s,hour:"numeric"})}return new Date(i).toLocaleString(t,We?{...s,timeZone:We}:s)}function ye(i){let e={};for(let a of new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",hourCycle:"h23",minute:"numeric",...We?{timeZone:We}:{}}).formatToParts(i))e[a.type]=a.value;let t=Number(e.year),s=Number(e.month),n=Number(e.day);return{year:t,month:s,date:n,minute:Number(e.minute),day:Math.round(Date.UTC(t,s-1,n)/864e5)}}var We,Js,me=Y(()=>{"use strict";Js=new Map});function bo(){try{return window.matchMedia?.("(prefers-color-scheme: dark)").matches===!0}catch{return!1}}function cs(i){if(i)return i==="auto"?bo()?"dark":"light":i}function tn(i){let e;try{e=window.matchMedia?.("(prefers-color-scheme: dark)")}catch{return()=>{}}if(!e)return()=>{};let t=s=>i(s.matches);return typeof e.addEventListener=="function"?e.addEventListener("change",t):e.addListener?.(t),()=>{typeof e.removeEventListener=="function"?e.removeEventListener("change",t):e.removeListener?.(t)}}var en,ls,ds=Y(()=>{"use strict";en=require("@seatlayer/core/core/color"),ls={light:{background:"#ffffff",surface:"#f6f7fb",text:"#172033",muted:"#667085",line:"rgba(23,32,51,.16)",map:"#e9edf4"},dark:{background:"#0f1522",surface:"#1a2234",text:"#eef1f8",muted:"#a5aec2",line:"rgba(165,174,194,.24)",map:"#0f1522"}}});function hs(i){return i?i.mode:"open"}function nn(i,e,t){switch(i){case"open":return null;case"hidden":return{mode:"hidden",labels:e};case"closed":return{mode:"closed",labels:e};case"timed":return{mode:"timed",revealAt:t?.revealAt??Date.now()+36e5,labels:e};case"threshold":return{mode:"threshold",thresholdPct:t?.thresholdPct??80,labels:e}}}function an(i){if(typeof i=="string"){let e=document.querySelector(i);if(!e)throw new Error(`seatmanager: container "${i}" not found`);return e}if(!(i instanceof HTMLElement))throw new Error("seatmanager: container must be a CSS selector or an HTMLElement");return i}function us(i){if(!i.startsWith("mse_"))throw new Error("seatmanager: token must be a short-lived event-scoped mse_ grant minted by your backend; tenant secret keys are unsupported in browsers")}function Ne(i){return i==="blocked"?"not_for_sale":i}function on(i,e){let t=i??{},s=e?ls[e]:null,n=e==="light";return{"--slm-bg":t.background??s?.background??"#0e1017","--slm-surface":s?.surface??"#181b24","--slm-text":s?.text??"#eef1f7","--slm-muted":s?.muted??"#8b93a7","--slm-line":s?.line??"rgba(255,255,255,.09)","--slm-tint":n?"rgba(23,32,51,.05)":"rgba(255,255,255,.035)","--slm-tint-strong":n?"rgba(23,32,51,.09)":"rgba(255,255,255,.07)","--slm-accent":t.accent??(n?"#4654c8":"#6e7bff"),"--slm-accent-ink":t.accentInk??"#ffffff","--slm-font":"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif","--slm-radius":"14px"}}function rn(i){return i?ls[i].map:null}function ln(i,e){let t=Math.max(0,Math.round((e-i)/1e3));if(t<5)return"just now";if(t<60)return`${t}s ago`;let s=Math.round(t/60);return s<60?`${s}m ago`:`${Math.round(s/60)}h ago`}function Ie(i,e){return(0,sn.formatMoney)(i,e,{maximumFractionDigits:0,fallback:(t,s)=>`${s} ${Math.round(t).toLocaleString()}`})}function w(i){return String(i??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var sn,Ce,pe=Y(()=>{"use strict";sn=require("@seatlayer/core");ds();Ce={free:"#6e7bff",booked:"#9ca3af",held:"#f4b740",blocked:"#475569"}});function J(i,e,t=30){let s=Math.round(t*.58);return`<span class="slm-plate" style="width:${t}px;height:${t}px;background:color-mix(in srgb,${e} 15%,transparent)"><svg width="${s}" height="${s}" viewBox="0 0 24 24" fill="none" stroke="${e}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${cn[i]??""}</svg></span>`}function Se(i,e="currentColor",t=16){return`<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${e}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${cn[i]??""}</svg>`}function Be(i){return`<div class="slm-railhead slm-taskhead">${J(i.glyph,i.hue)}<p class="slm-eyebrow">${w(i.title)}</p>${i.badge?`<span class="slm-scope event">${w(i.badge)}</span>`:""}</div><p class="slm-hint">${i.purpose}${i.how?` <button type="button" class="slm-howlink" data-how="${i.how}">How it works \u203A</button>`:""}</p>`}function Lt(){return'<div class="slm-selcard" data-ref="selcard" aria-live="polite"></div>'}function $t(){return typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318K":"Ctrl K"}function Ge(){return typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches}function lt(i,e){if(i.classList.toggle("empty",e.count===0),!e.count){i.innerHTML=`<div class="slm-selcount"><b>0</b> seats selected<button type="button" class="slm-linkbtn" data-sel-all>Select all</button></div><div class="slm-ways">${(Ge()?yo:vo).map(([s,n,a,o])=>`<span>${J(s,n,26)}<span><b>${a}</b>${o}${s==="search"&&!Ge()?$t():""}</span></span>`).join("")}${e.saved?`<button type="button" class="slm-savedrow" data-saved-list>${J("star","#d99a0b",26)}<span><b>Saved selections</b>${e.saved.toLocaleString()} on this event</span>${fo}</button>`:""}</div>`;return}let t=e.count===1?"seat":"seats";i.innerHTML=`<div class="slm-selcount"><b>${e.count.toLocaleString()}</b> ${t} selected<button type="button" class="slm-linkbtn" data-sel-clear>Clear</button></div><p class="slm-selwhere">${w(e.where)}</p><div class="slm-selparts">${e.parts.map(s=>`<span class="tone-${s.tone}">${w(s.label)}</span>`).join("")}${e.types.map(s=>`<span class="type"><i style="background:${w(s.color)}"></i>${w(s.label)} ${s.count.toLocaleString()}</span>`).join("")}</div>`+(e.stale?`<p class="slm-selstale">${J("alert","#b45309",20)}${w(e.stale)}</p>`:"")+`<div class="slm-selbtns">${e.canSimilar?`<span class="slm-simwrap"><button type="button" class="slm-btn ghost" data-sel-similar aria-haspopup="menu" aria-expanded="false">${Se("spark","#d99a0b")}Select similar</button></span>`:""}<button type="button" class="slm-btn ghost" data-sel-undo title="Undo the last change to the selection (${go})"${e.canUndo?"":" disabled"}>${Se("undo","#64748b")}Undo</button>${e.canSave?`<button type="button" class="slm-btn ghost slm-selsave" data-sel-save>${Se("star","#d99a0b")}Save</button>`:""}</div>`}function xo(i){return i.length?i.length===1?`row ${i[0]}`:i.length<=4?`rows ${i[0]}\u2013${i[i.length-1]}`:`${i.length} rows`:""}function dn(i){if(!i.length)return"";if(i.length===1){let t=xo(i[0].rows);return t?`${i[0].label} \xB7 ${t}`:i[0].label}let e=i.slice(0,2).map(t=>t.label).join(", ");return`${i.length} sections: ${e}${i.length>2?"\u2026":""}`}function X(i,e,t,s){return`<div class="slm-panelalert ${i}" role="${i==="error"?"alert":"status"}">${J(s??(i==="ok"?"check":"alert"),i==="error"?"#d64545":i==="warn"?"#b45309":i==="ok"?"#22a06b":"#3b82f6",24)}<span><b>${w(e)}</b>${w(t)}</span></div>`}function Tt(i){return`<div class="slm-railfoot" data-ref="${i}"><button type="button" class="slm-btn" data-foot-action></button><button type="button" class="slm-linkbtn" data-foot-secondary hidden></button><p class="slm-note" data-foot-note></p></div>`}function Ye(i,e){let t=i.querySelector("[data-foot-action]"),s=i.querySelector("[data-foot-note]");t&&(t.textContent=e.label,t.disabled=!!e.disabled||!!e.busy,t.classList.toggle("danger",!!e.danger),t.classList.toggle("busy",!!e.busy),t.setAttribute("aria-busy",String(!!e.busy)));let n=i.querySelector("[data-foot-secondary]");n&&(n.hidden=!e.secondary,n.textContent=e.secondary??"",n.disabled=!!e.busy),s&&(s.textContent=e.note??"",s.hidden=!e.note)}var cn,St,go,fo,vo,yo,Fe=Y(()=>{"use strict";pe();cn={tag:'<path d="M3.5 12.2V4.5a1 1 0 0 1 1-1h7.7l8.3 8.3a1.4 1.4 0 0 1 0 2l-6.3 6.3a1.4 1.4 0 0 1-2 0z"/><circle cx="8" cy="8" r="1.6"/>',ban:'<circle cx="12" cy="12" r="8.5"/><path d="M6 6l12 12"/>',cursor:'<path d="M5 3.5l13 7-5.6 1.6L10 18z"/>',box:'<rect x="4" y="4" width="16" height="16" rx="2" stroke-dasharray="3 2.4"/>',search:'<circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/>',alert:'<path d="M12 3.8l9.3 16.2H2.7z"/><path d="M12 10v4.5M12 17.3v.2"/>',check:'<path d="M5 12.5l4.5 4.5L19 7.5"/>',eye:'<path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z"/><circle cx="12" cy="12" r="3"/>',bookmark:'<path d="M6.5 3.5h11v17l-5.5-4-5.5 4z"/>',layers:'<path d="M12 3.5l8.5 4.5L12 12.5 3.5 8z"/><path d="M3.5 12L12 16.5 20.5 12"/><path d="M3.5 16L12 20.5 20.5 16"/>',table:'<circle cx="12" cy="12" r="5"/><circle cx="12" cy="3.5" r="1.6"/><circle cx="12" cy="20.5" r="1.6"/><circle cx="3.5" cy="12" r="1.6"/><circle cx="20.5" cy="12" r="1.6"/>',clock:'<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 2"/>',lock:'<rect x="5" y="10.5" width="14" height="10" rx="2"/><path d="M8 10.5V7.5a4 4 0 0 1 8 0v3"/>',info:'<circle cx="12" cy="12" r="8.5"/><path d="M12 11v5.5M12 7.6v.2"/>',user:'<circle cx="12" cy="8" r="3.8"/><path d="M4.5 20.5a7.5 7.5 0 0 1 15 0"/>',bolt:'<path d="M13 3L5 13.5h6l-1 7.5 8-10.5h-6z"/>',star:'<path d="M12 3.8l2.5 5.2 5.7.8-4.1 4 1 5.6L12 16.8l-5.1 2.6 1-5.6-4.1-4 5.7-.8z"/>',seat:'<path d="M7 11V6.5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2V11"/><path d="M5 11h14v4H5z"/><path d="M7 15v4.5M17 15v4.5"/>',gauge:'<path d="M4 16a8 8 0 1 1 16 0"/><path d="M12 16l4-5"/>',bell:'<path d="M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z"/><path d="M10 20.5a2 2 0 0 0 4 0"/>',undo:'<path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/>',plus:'<path d="M12 5v14M5 12h14"/>',palette:'<path d="M12 3.5a8.5 8.5 0 1 0 0 17c1.2 0 1.8-.8 1.8-1.7 0-1.3-1-1.6-1-2.8 0-1 .8-1.7 1.8-1.7h2.2a3.7 3.7 0 0 0 3.7-3.7C20.5 6.4 16.7 3.5 12 3.5z"/><circle cx="7.8" cy="11" r="1.2"/><circle cx="10.5" cy="7.3" r="1.2"/><circle cx="15" cy="7.6" r="1.2"/>',x:'<path d="M6 6l12 12M18 6L6 18"/>',ticket:'<path d="M3.5 8.5V6a1 1 0 0 1 1-1h15a1 1 0 0 1 1 1v2.5a2.5 2.5 0 0 0 0 5V16a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-2.5a2.5 2.5 0 0 0 0-5z"/><path d="M14 5.5v11" stroke-dasharray="1.6 2"/>',history:'<path d="M4 12a8 8 0 1 0 2.3-5.6"/><path d="M4 4.5v3.5h3.5"/><path d="M12 8v4.2l2.8 1.8"/>',spark:'<path d="M12 3.5l1.8 5 5 1.8-5 1.8-1.8 5-1.8-5-5-1.8 5-1.8z"/><path d="M18.5 15.5l.7 1.8 1.8.7-1.8.7-.7 1.8-.7-1.8-1.8-.7 1.8-.7z"/>',lasso:'<ellipse cx="12" cy="9.5" rx="8" ry="5.5" stroke-dasharray="3 2.4"/><path d="M8.5 14.5c-1.5 1.2-1.6 3.4.2 4.2 1.4.6 2.8-.3 2.8-1.7"/>',hand:'<path d="M8 13V6a2 2 0 0 1 4 0v6-8a2 2 0 0 1 4 0v8-6a2 2 0 0 1 4 0v10c0 4-3 6-7 6-3 0-5-2-7-5l-3-4a2 2 0 0 1 3-2l2 2Z"/>',fit:'<path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5"/>',route:'<circle cx="6" cy="6" r="2.2"/><circle cx="18" cy="18" r="2.2"/><path d="M8.2 6H15a3 3 0 0 1 0 6H9a3 3 0 0 0 0 6h6.8"/>'};St={booked:["seat","#8a94a6"],free:["seat","#22a06b"],held:["clock","#d99a0b"],blocked:["ban","#d64545"],reserved:["bookmark","#c026d3"]};go=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318Z":"Ctrl Z",fo='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>',vo=[["cursor","#d99a0b","Click a seat","or anywhere near it"],["box","#d99a0b","Drag on the map","to draw a box"],["search","#4c6fff","Find","a seat, row or section with "]],yo=[["cursor","#d99a0b","Tap a seat","or anywhere near it"],["box","#d99a0b","Press and hold, then drag","to draw a box"],["search","#4c6fff","Find","a seat, row or section"]]});async function gn(i){let t=(i.headers.get("content-type")??"").includes("application/json")?await i.json().catch(()=>null):null;if(!i.ok){let s=t;throw new G(i.status,s?.error??`request_failed_${i.status}`,s?.code,s?.conflicts,s?.details,typeof s?.message=="string"?s.message:void 0)}return t}function ie(i){return i&&typeof i=="object"?i:{}}function Et(i,e,t=0){return typeof i=="number"&&Number.isFinite(i)?i:typeof e=="number"&&Number.isFinite(e)?e:t}function fn(i,e){return i===null?null:typeof i=="number"&&Number.isFinite(i)?i:i!==void 0?null:typeof e=="number"&&Number.isFinite(e)?e:null}function vn(i){let e=ie(i),t=Et(e.bookedValue,e.bookedRevenue);return{...e,bookedValue:t,bookedRevenue:t}}function Lo(i){let e=ie(i),t=ie(e.report),s=Array.isArray(t.byCategory)?t.byCategory.map(a=>{let o=ie(a),r=Et(o.bookedValue,o.bookedRevenue);return{...o,bookedValue:r,bookedRevenue:r}}):[],n=Array.isArray(t.bySection)?t.bySection.map(vn):void 0;return{...e,report:{...t,byCategory:s,...n?{bySection:n}:{}}}}function $o(i){let e=ie(i),t=ie(e.bookedValue),s=ie(e.revenue),n=Object.keys(t).length?t:s,a=Array.isArray(t.bySection)?t.bySection:Array.isArray(s.bySection)?s.bySection:[],o={...n,gross:Et(t.gross,s.gross),bySection:a.map(vn)},r=ie(e.velocity),l=Array.isArray(r.bySection)?r.bySection.map(c=>{let d=ie(c),b=Et(d.bookedValue,d.grossRevenue);return{...d,bookedValue:b,grossRevenue:b}}):[];return{...e,bookedValue:o,revenue:o,velocity:{...r,bySection:l}}}function To(i){let e=ie(i),t=ie(e.report),s=typeof t.includesBookedValue=="boolean"?t.includesBookedValue:t.includesRevenue===!0,n=Array.isArray(t.rows)?t.rows.map(r=>{let l=ie(r),c=ie(l.attribution),d=fn(c.bookedValue,c.revenue);return{...l,attribution:{...c,bookedValue:d,revenue:d}}}):[],a=ie(t.totals),o=fn(a.bookedValue,a.revenue);return{...e,report:{...t,includesBookedValue:s,includesRevenue:s,rows:n,totals:{...a,bookedValue:o,revenue:o}}}}function ps(i){let e=ie(i),t=typeof e.includesBookedValue=="boolean"?e.includesBookedValue:e.includesRevenue===!0;return{...e,includesBookedValue:t,includesRevenue:t}}var bn,G,Xe,Rt=Y(()=>{"use strict";bn=Symbol.for("seatlayer.ManageApiError"),G=class extends Error{static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&e[bn]===!0}constructor(e,t,s,n,a,o){super(t),Object.defineProperty(this,bn,{value:!0}),this.name="ManageApiError",this.status=e,this.code=s,this.conflicts=n,this.details=a,this.serverMessage=o}};Xe=class{constructor(e,t){this.base=e.replace(/\/+$/,""),this.token=t}setToken(e){this.token=e}auth(e,t={}){let s=t.method??"GET",n={Authorization:`Bearer ${this.token}`},a;return t.body!==void 0&&(n["Content-Type"]="application/json",a=JSON.stringify(t.body)),fetch(`${this.base}${e}`,{method:s,headers:n,body:a,credentials:"omit"}).then(o=>gn(o))}async authBlob(e){let t=await fetch(`${this.base}${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});return t.ok||await gn(t),t.blob()}chart(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/chart`)}asset(e,t){return/^[a-zA-Z0-9._-]+$/.test(t)?this.authBlob(`/v1/events/${encodeURIComponent(e)}/assets/${encodeURIComponent(t)}`):Promise.reject(new G(404,"not_found","not_found"))}objects(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/objects`)}subscribeTicket(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/subscribe-tickets`,{method:"POST"})}socketUrl(e){return`${this.base.replace(/^http/,"ws")}/pub/events/${encodeURIComponent(e)}/subscribe?surface=manager`}block(e,t,s={}){let n={labels:t};return typeof s.releaseAt=="number"&&(n.releaseAt=s.releaseAt),s.reason&&(n.reason=s.reason),this.auth(`/v1/events/${encodeURIComponent(e)}/block`,{method:"POST",body:n})}unblock(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/unblock`,{method:"POST",body:{labels:t}})}unblockAll(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/unblock-all`,{method:"POST"})}eventRequest(e,t,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/${t}`,s)}unbook(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/unbook`,{method:"POST",body:{labels:t,bookingRef:s}})}setHoldTtl(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/hold-ttl`,{method:"POST",body:{holdTtlMs:t}})}setCategory(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`,{method:"POST",body:{labels:t,categoryKey:s}})}lookupOrders(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/orders/lookup?q=${encodeURIComponent(t)}`)}categoryDifferences(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`)}resetCategoriesToChart(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`,{method:"POST",body:{mode:"chart",...t?{labels:t}:{}}})}setTableBooking(e,t,s,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/table-booking`,{method:"POST",body:{tableIds:t,mode:s,...n}})}bookings(e,t={}){let s=new URLSearchParams;t.q&&s.set("q",t.q),t.state&&s.set("state",t.state),t.cursor&&s.set("cursor",t.cursor),t.limit!=null&&s.set("limit",String(t.limit));let n=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings${n?`?${n}`:""}`)}booking(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings/${encodeURIComponent(t)}`)}listBookings(e,t={}){return this.bookings(e,t)}retrieveBooking(e,t){return this.booking(e,t)}availability(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/availability`)}setAvailability(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/availability`,{method:"POST",body:{rules:t}})}channels(e,t={}){let s=t.includeArchived?"?includeArchived=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels${s}`)}channelAllocation(e,t={}){let s=new URLSearchParams;t.afterLabel&&s.set("afterLabel",t.afterLabel),t.limit!=null&&s.set("limit",String(t.limit));let n=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/allocation${n?`?${n}`:""}`)}channelAudit(e,t={}){let s=new URLSearchParams;t.limit!=null&&s.set("limit",String(t.limit)),t.before!=null&&s.set("before",String(t.before));let n=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/audit${n?`?${n}`:""}`)}createChannel(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels`,{method:"POST",body:t})}renameChannel(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{name:s}})}updateChannelPricing(e,t,s,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{priceOverrides:s,expectedPricingVersion:n}})}setChannelPaused(e,t,s){let n=s?"pause":"unpause";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/${n}`,{method:"POST",body:{}})}archiveChannel(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/archive`,{method:"POST",body:{destination:s}})}applyChannelAssignment(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/assignments`,{method:"POST",body:{targetChannelId:t.targetChannelId||null,labels:t.labels,assignmentVersion:t.assignmentVersion}})}channelPreview(e,t,s={}){let n=new URLSearchParams;t.length&&n.set("channelIds",t.join(",")),s.includePublic!=null&&n.set("includePublic",s.includePublic?"1":"0");let a=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/preview${a?`?${a}`:""}`)}setChannelAccessIntent(e,t,s,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{accessIntent:s,...n.acknowledgeLiveAccess?{acknowledgeLiveAccess:!0}:{},...n.reason?{reason:n.reason}:{}}})}createAccessLink(e,t,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`,{method:"POST",body:s})}accessLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`)}rotateAccessLink(e,t,s,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(s)}/rotate`,{method:"POST",body:{endActiveSessions:n}})}revokeAccessLink(e,t,s,n=!1){let a=n?"?endActiveSessions=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(s)}${a}`,{method:"DELETE"})}report(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/report`).then(Lo)}seatHistory(e,t,s,n){let a=new URLSearchParams({label:t});return s&&a.set("before",String(s)),n&&a.set("action",n),this.auth(`/v1/events/${encodeURIComponent(e)}/seat-history?${a}`)}seatStory(e,t,s,n){let a=new URLSearchParams({label:t,v:"2"});return s&&a.set("before",String(s)),n&&a.set("action",n),this.auth(`/v1/events/${encodeURIComponent(e)}/seat-history?${a}`)}controlRoom(e,t=15){return this.auth(`/v1/events/${encodeURIComponent(e)}/control-room?window=${t}&activity=2`).then($o)}channelReport(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/report`).then(To)}createChannelReportLink(e,t,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`,{method:"POST",body:s}).then(n=>{let a=ie(n);return{...a,link:ps(a.link)}})}channelReportLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`).then(s=>{let n=ie(s);return{links:Array.isArray(n.links)?n.links.map(ps):[]}})}revokeChannelReportLink(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links/${encodeURIComponent(s)}`,{method:"DELETE"}).then(n=>{let a=ie(n);return{...a,link:ps(a.link)}})}log(e,t={}){let s=new URLSearchParams;t.limit!=null&&s.set("limit",String(t.limit)),t.before!=null&&s.set("before",String(t.before));let n=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/log${n?`?${n}`:""}`)}async reportCsv(e){let t=await fetch(`${this.base}/v1/events/${encodeURIComponent(e)}/report.csv`,{headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});if(!t.ok)throw new G(t.status,`request_failed_${t.status}`);return t.blob()}}});function Io(i,e){if(!i.labels.length)return"Nothing found";let t=[];i.sections&&t.push(`${i.sections.toLocaleString()} section${i.sections===1?"":"s"}`),i.rows&&t.push(`${i.rows.toLocaleString()} row${i.rows===1?"":"s"}`);let s=`${i.labels.length.toLocaleString()} seat${i.labels.length===1?"":"s"} found`,n=t.length?`${t.join(" \xB7 ")} \xB7 ${s}`:s;return e?`${n} \xB7 Enter to ${e==="frame"?"show":"select"}`:n}function Bo(i={}){return`
1
+ "use strict";var us=Object.defineProperty;var zo=Object.getOwnPropertyDescriptor;var Fo=Object.getOwnPropertyNames;var No=Object.prototype.hasOwnProperty;var Y=(i,e,t)=>()=>{if(t)throw t[0];try{return i&&(e=i(i=0)),e}catch(s){throw t=[s],s}};var ps=(i,e)=>{for(var t in e)us(i,t,{get:e[t],enumerable:!0})},qo=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fo(e))!No.call(i,n)&&n!==t&&us(i,n,{get:()=>e[n],enumerable:!(s=zo(e,n))||s.enumerable});return i};var _o=i=>qo(us({},"__esModule",{value:!0}),i);function Xe(i){i.querySelectorAll("select:not([data-themed])").forEach(e=>{e.dataset.themed="true";let t=document.createElement("details");t.className="slm-themed-picker";let s=document.createElement("summary"),n=document.createElement("div");n.className="slm-themed-options";let a=e.getAttribute("aria-label")||Array.from(e.labels??[]).map(r=>r.textContent).join(" ")||"Choose option";s.setAttribute("aria-label",a.trim()),t.append(s,n),e.after(t),e.hidden=!0;let o=()=>{s.textContent=e.selectedOptions[0]?.textContent??"Choose\u2026",s.setAttribute("aria-disabled",String(e.disabled)),n.replaceChildren(...Array.from(e.options).map(r=>{let l=document.createElement("button");return l.type="button",l.textContent=r.textContent,l.setAttribute("aria-label",r.textContent??""),l.disabled=e.disabled||r.disabled,l.setAttribute("aria-pressed",String(r.selected)),l.onclick=()=>{e.value=r.value,t.open=!1,o(),s.focus(),e.dispatchEvent(new Event("change",{bubbles:!0})),o()},l}))};o(),e.addEventListener("change",o),s.onclick=r=>{if(e.disabled){r.preventDefault();return}o(),i.querySelectorAll(".slm-themed-picker").forEach(l=>{l!==t&&(l.open=!1)})},t.addEventListener("focusout",r=>{t.contains(r.relatedTarget)||(t.open=!1)}),t.addEventListener("keydown",r=>{if(r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),t.open=!1,s.focus()),r.key==="ArrowDown"||r.key==="ArrowUp"){if(e.disabled)return;r.preventDefault(),t.open=!0;let l=Array.from(n.querySelectorAll("button:not(:disabled)")),c=l.indexOf(document.activeElement);l[(c+(r.key==="ArrowDown"?1:l.length-1)+l.length)%l.length]?.focus()}})})}function pn(i){i.querySelectorAll('input[type="date"],input[type="datetime-local"],input[type="time"]').forEach(e=>{e.dataset.slmPicker!=="1"&&(e.dataset.slmPicker="1",e.addEventListener("click",()=>{if(!(e.disabled||e.readOnly))try{e.showPicker?.()}catch{}}))})}var Mt=Y(()=>{"use strict"});function gn(i){if(Ze=void 0,!!i)try{new Intl.DateTimeFormat(void 0,{timeZone:i}),Ze=i}catch{}}function K(i,e,t){let s=e;if(s.hour==="2-digit"){let n=String(t??""),a=mn.get(n);if(a===void 0){let o=new Intl.DateTimeFormat(t,{hour:"numeric"}).resolvedOptions().hourCycle;mn.set(n,a=o==="h12"||o==="h11")}a&&(s={...s,hour:"numeric"})}return new Date(i).toLocaleString(t,Ze?{...s,timeZone:Ze}:s)}function ke(i){let e={};for(let a of new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",hourCycle:"h23",minute:"numeric",...Ze?{timeZone:Ze}:{}}).formatToParts(i))e[a.type]=a.value;let t=Number(e.year),s=Number(e.month),n=Number(e.day);return{year:t,month:s,date:n,minute:Number(e.minute),day:Math.round(Date.UTC(t,s-1,n)/864e5)}}var Ze,mn,me=Y(()=>{"use strict";mn=new Map});function jo(){try{return window.matchMedia?.("(prefers-color-scheme: dark)").matches===!0}catch{return!1}}function gs(i){if(i)return i==="auto"?jo()?"dark":"light":i}function fn(i){let e;try{e=window.matchMedia?.("(prefers-color-scheme: dark)")}catch{return()=>{}}if(!e)return()=>{};let t=s=>i(s.matches);return typeof e.addEventListener=="function"?e.addEventListener("change",t):e.addListener?.(t),()=>{typeof e.removeEventListener=="function"?e.removeEventListener("change",t):e.removeListener?.(t)}}var bn,ms,bs=Y(()=>{"use strict";bn=require("@seatlayer/core/core/color"),ms={light:{background:"#ffffff",surface:"#f6f7fb",text:"#172033",muted:"#667085",line:"rgba(23,32,51,.16)",map:"#e9edf4"},dark:{background:"#0f1522",surface:"#1a2234",text:"#eef1f8",muted:"#a5aec2",line:"rgba(165,174,194,.24)",map:"#0f1522"}}});function fs(i){return i?i.mode:"open"}function yn(i,e,t){switch(i){case"open":return null;case"hidden":return{mode:"hidden",labels:e};case"closed":return{mode:"closed",labels:e};case"timed":return{mode:"timed",revealAt:t?.revealAt??Date.now()+36e5,labels:e};case"threshold":return{mode:"threshold",thresholdPct:t?.thresholdPct??80,labels:e}}}function xn(i){if(typeof i=="string"){let e=document.querySelector(i);if(!e)throw new Error(`seatmanager: container "${i}" not found`);return e}if(!(i instanceof HTMLElement))throw new Error("seatmanager: container must be a CSS selector or an HTMLElement");return i}function vs(i){if(!i.startsWith("mse_"))throw new Error("seatmanager: token must be a short-lived event-scoped mse_ grant minted by your backend; tenant secret keys are unsupported in browsers")}function je(i){return i==="blocked"?"not_for_sale":i}function kn(i,e){let t=i??{},s=e?ms[e]:null,n=e==="light";return{"--slm-bg":t.background??s?.background??"#0e1017","--slm-surface":s?.surface??"#181b24","--slm-text":s?.text??"#eef1f7","--slm-muted":s?.muted??"#8b93a7","--slm-line":s?.line??"rgba(255,255,255,.09)","--slm-tint":n?"rgba(23,32,51,.05)":"rgba(255,255,255,.035)","--slm-tint-strong":n?"rgba(23,32,51,.09)":"rgba(255,255,255,.07)","--slm-accent":t.accent??(n?"#4654c8":"#6e7bff"),"--slm-accent-ink":t.accentInk??"#ffffff","--slm-font":"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif","--slm-radius":"14px"}}function wn(i){return i?ms[i].map:null}function Sn(i,e){let t=Math.max(0,Math.round((e-i)/1e3));if(t<5)return"just now";if(t<60)return`${t}s ago`;let s=Math.round(t/60);return s<60?`${s}m ago`:`${Math.round(s/60)}h ago`}function we(i,e){return(0,vn.formatMoney)(i,e,{maximumFractionDigits:0,fallback:(t,s)=>`${s} ${Math.round(t).toLocaleString()}`})}function S(i){return String(i??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var vn,Re,ge=Y(()=>{"use strict";vn=require("@seatlayer/core");bs();Re={free:"#6e7bff",booked:"#9ca3af",held:"#f4b740",blocked:"#475569"}});function Z(i,e,t=30){let s=Math.round(t*.58);return`<span class="slm-plate" style="width:${t}px;height:${t}px;background:color-mix(in srgb,${e} 15%,transparent)"><svg width="${s}" height="${s}" viewBox="0 0 24 24" fill="none" stroke="${e}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Ln[i]??""}</svg></span>`}function be(i,e="currentColor",t=16){return`<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${e}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Ln[i]??""}</svg>`}function De(i){return`<div class="slm-railhead slm-taskhead">${Z(i.glyph,i.hue)}<p class="slm-eyebrow">${S(i.title)}</p>${i.badge?`<span class="slm-scope event">${S(i.badge)}</span>`:""}</div><p class="slm-hint">${i.purpose}${i.how?` <button type="button" class="slm-howlink" data-how="${i.how}">How it works \u203A</button>`:""}</p>`}function Et(){return'<div class="slm-selcard" data-ref="selcard" aria-live="polite"></div>'}function Rt(){return typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318K":"Ctrl K"}function ys(){return Rt().replace("\u2318","\u2318 ").split(" ").map(i=>`<kbd>${i}</kbd>`).join("")}function Oe(){return typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches}function pt(i,e){if(i.classList.toggle("empty",e.count===0),!e.count){i.innerHTML=`<div class="slm-selcount"><b>0</b> seats selected</div><div class="slm-ways">${(Oe()?Wo:Ko).map(([s,n,a,o])=>`<span>${Z(s,n,26)}<span><b>${a}</b>${s==="search"&&!Oe()?Rt():""}${o}</span></span>`).join("")}${e.saved?`<button type="button" class="slm-savedrow" data-saved-list>${Z("star","#d99a0b",26)}<span><b>Saved selections</b>${e.saved.toLocaleString()} on this event</span>${Uo}</button>`:""}</div>`;return}let t=e.count===1?"seat":"seats";i.innerHTML=`<div class="slm-selcount"><b>${e.count.toLocaleString()}</b> ${t} selected<button type="button" class="slm-linkbtn" data-sel-clear>Clear</button></div><p class="slm-selwhere">${S(e.where)}</p><div class="slm-selparts">${e.parts.map(s=>`<span class="tone-${s.tone}">${S(s.label)}</span>`).join("")}${e.types.map(s=>`<span class="type"><i style="background:${S(s.color)}"></i>${S(s.label)}${s.count==null?"":` ${s.count.toLocaleString()}`}</span>`).join("")}</div>`+(e.stale?`<p class="slm-selstale">${Z("alert","#b45309",20)}${S(e.stale)}</p>`:"")+`<div class="slm-selbtns">${e.canSimilar?`<span class="slm-simwrap"><button type="button" class="slm-btn ghost" data-sel-similar aria-haspopup="menu" aria-expanded="false">${be("spark","#d99a0b")}Select similar</button></span>`:""}<button type="button" class="slm-btn ghost" data-sel-undo title="Undo the last change to the selection (${Vo})"${e.canUndo?"":" disabled"}>${be("undo","#64748b")}Undo</button>${e.canSave?`<button type="button" class="slm-btn ghost slm-selsave" data-sel-save>${be("star","#d99a0b")}Save</button>`:""}</div>`}function Go(i){return i.length?i.length===1?`row ${i[0]}`:i.length<=4?`rows ${i[0]}\u2013${i[i.length-1]}`:`${i.length} rows`:""}function $n(i){if(!i.length)return"";if(i.length===1){let t=Go(i[0].rows);return t?`${i[0].label} \xB7 ${t}`:i[0].label}let e=i.slice(0,2).map(t=>t.label).join(", ");return`${i.length} sections: ${e}${i.length>2?"\u2026":""}`}function Q(i,e,t,s){return`<div class="slm-panelalert ${i}" role="${i==="error"?"alert":"status"}">${be(s??(i==="ok"?"check":"alert"),"currentColor",18)}<span><b>${S(e)}</b>${S(t)}</span></div>`}function At(i){return`<div class="slm-railfoot" data-ref="${i}"><button type="button" class="slm-btn" data-foot-action></button><button type="button" class="slm-linkbtn" data-foot-secondary hidden></button><p class="slm-note" data-foot-note></p></div>`}function Qe(i,e){let t=i.querySelector("[data-foot-action]"),s=i.querySelector("[data-foot-note]");t&&(t.textContent=e.label,t.disabled=!!e.disabled||!!e.busy,t.classList.toggle("danger",!!e.danger),t.classList.toggle("busy",!!e.busy),t.setAttribute("aria-busy",String(!!e.busy)));let n=i.querySelector("[data-foot-secondary]");n&&(n.hidden=!e.secondary,n.innerHTML=e.secondary?`${e.look?be("undo","currentColor",14):""}${S(e.secondary)}`:"",n.disabled=!!e.busy),s&&(s.textContent=e.note??"",s.hidden=!e.note),i.classList.toggle("done",e.look==="done"),i.classList.toggle("settle",e.look==="settle")}var Ln,Je,Vo,Uo,Ko,Wo,Ve=Y(()=>{"use strict";ge();Ln={tag:'<path d="M3.5 12.2V4.5a1 1 0 0 1 1-1h7.7l8.3 8.3a1.4 1.4 0 0 1 0 2l-6.3 6.3a1.4 1.4 0 0 1-2 0z"/><circle cx="8" cy="8" r="1.6"/>',ban:'<circle cx="12" cy="12" r="8.5"/><path d="M6 6l12 12"/>',cursor:'<path d="M5 3.5l13 7-5.6 1.6L10 18z"/>',box:'<rect x="4" y="4" width="16" height="16" rx="2" stroke-dasharray="3 2.4"/>',search:'<circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/>',alert:'<path d="M12 3.8l9.3 16.2H2.7z"/><path d="M12 10v4.5M12 17.3v.2"/>',check:'<path d="M5 12.5l4.5 4.5L19 7.5"/>',eye:'<path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z"/><circle cx="12" cy="12" r="3"/>',bookmark:'<path d="M6.5 3.5h11v17l-5.5-4-5.5 4z"/>',layers:'<path d="M12 3.5l8.5 4.5L12 12.5 3.5 8z"/><path d="M3.5 12L12 16.5 20.5 12"/><path d="M3.5 16L12 20.5 20.5 16"/>',table:'<circle cx="12" cy="12" r="5"/><circle cx="12" cy="3.5" r="1.6"/><circle cx="12" cy="20.5" r="1.6"/><circle cx="3.5" cy="12" r="1.6"/><circle cx="20.5" cy="12" r="1.6"/>',clock:'<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 2"/>',lock:'<rect x="5" y="10.5" width="14" height="10" rx="2"/><path d="M8 10.5V7.5a4 4 0 0 1 8 0v3"/>',info:'<circle cx="12" cy="12" r="8.5"/><path d="M12 11v5.5M12 7.6v.2"/>',user:'<circle cx="12" cy="8" r="3.8"/><path d="M4.5 20.5a7.5 7.5 0 0 1 15 0"/>',bolt:'<path d="M13 3L5 13.5h6l-1 7.5 8-10.5h-6z"/>',star:'<path d="M12 3.8l2.5 5.2 5.7.8-4.1 4 1 5.6L12 16.8l-5.1 2.6 1-5.6-4.1-4 5.7-.8z"/>',seat:'<path d="M7 11V6.5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2V11"/><path d="M5 11h14v4H5z"/><path d="M7 15v4.5M17 15v4.5"/>',gauge:'<path d="M4 16a8 8 0 1 1 16 0"/><path d="M12 16l4-5"/>',bell:'<path d="M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z"/><path d="M10 20.5a2 2 0 0 0 4 0"/>',undo:'<path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/>',plus:'<path d="M12 5v14M5 12h14"/>',palette:'<path d="M12 3.5a8.5 8.5 0 1 0 0 17c1.2 0 1.8-.8 1.8-1.7 0-1.3-1-1.6-1-2.8 0-1 .8-1.7 1.8-1.7h2.2a3.7 3.7 0 0 0 3.7-3.7C20.5 6.4 16.7 3.5 12 3.5z"/><circle cx="7.8" cy="11" r="1.2"/><circle cx="10.5" cy="7.3" r="1.2"/><circle cx="15" cy="7.6" r="1.2"/>',x:'<path d="M6 6l12 12M18 6L6 18"/>',ticket:'<path d="M3.5 8.5V6a1 1 0 0 1 1-1h15a1 1 0 0 1 1 1v2.5a2.5 2.5 0 0 0 0 5V16a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-2.5a2.5 2.5 0 0 0 0-5z"/><path d="M14 5.5v11" stroke-dasharray="1.6 2"/>',history:'<path d="M4 12a8 8 0 1 0 2.3-5.6"/><path d="M4 4.5v3.5h3.5"/><path d="M12 8v4.2l2.8 1.8"/>',spark:'<path d="M12 3.5l1.8 5 5 1.8-5 1.8-1.8 5-1.8-5-5-1.8 5-1.8z"/><path d="M18.5 15.5l.7 1.8 1.8.7-1.8.7-.7 1.8-.7-1.8-1.8-.7 1.8-.7z"/>',lasso:'<ellipse cx="12" cy="9.5" rx="8" ry="5.5" stroke-dasharray="3 2.4"/><path d="M8.5 14.5c-1.5 1.2-1.6 3.4.2 4.2 1.4.6 2.8-.3 2.8-1.7"/>',hand:'<path d="M8 13V6a2 2 0 0 1 4 0v6-8a2 2 0 0 1 4 0v8-6a2 2 0 0 1 4 0v10c0 4-3 6-7 6-3 0-5-2-7-5l-3-4a2 2 0 0 1 3-2l2 2Z"/>',fit:'<path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5"/>',route:'<circle cx="6" cy="6" r="2.2"/><circle cx="18" cy="18" r="2.2"/><path d="M8.2 6H15a3 3 0 0 1 0 6H9a3 3 0 0 0 0 6h6.8"/>'};Je={booked:["seat","#8a94a6"],free:["seat","#22a06b"],held:["clock","#d99a0b"],blocked:["ban","#d64545"],reserved:["bookmark","#c026d3"]};Vo=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318Z":"Ctrl Z",Uo='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>',Ko=[["cursor","#d99a0b","Click a seat","or anywhere near it"],["box","#d99a0b","Drag on the map","to draw a box"],["search","#4c6fff","Search",", then Enter"]],Wo=[["cursor","#d99a0b","Tap a seat","or anywhere near it"],["box","#d99a0b","Press and hold, then drag","to draw a box"],["search","#4c6fff","Find","a seat, row or section"]]});async function An(i){let t=(i.headers.get("content-type")??"").includes("application/json")?await i.json().catch(()=>null):null;if(!i.ok){let s=t;throw new W(i.status,s?.error??`request_failed_${i.status}`,s?.code,s?.conflicts,s?.details,typeof s?.message=="string"?s.message:void 0)}return t}function oe(i){return i&&typeof i=="object"?i:{}}function Pt(i,e,t=0){return typeof i=="number"&&Number.isFinite(i)?i:typeof e=="number"&&Number.isFinite(e)?e:t}function Hn(i,e){return i===null?null:typeof i=="number"&&Number.isFinite(i)?i:i!==void 0?null:typeof e=="number"&&Number.isFinite(e)?e:null}function In(i){let e=oe(i),t=Pt(e.bookedValue,e.bookedRevenue);return{...e,bookedValue:t,bookedRevenue:t}}function Jo(i){let e=oe(i),t=oe(e.report),s=Array.isArray(t.byCategory)?t.byCategory.map(a=>{let o=oe(a),r=Pt(o.bookedValue,o.bookedRevenue);return{...o,bookedValue:r,bookedRevenue:r}}):[],n=Array.isArray(t.bySection)?t.bySection.map(In):void 0;return{...e,report:{...t,byCategory:s,...n?{bySection:n}:{}}}}function Qo(i){let e=oe(i),t=oe(e.bookedValue),s=oe(e.revenue),n=Object.keys(t).length?t:s,a=Array.isArray(t.bySection)?t.bySection:Array.isArray(s.bySection)?s.bySection:[],o={...n,gross:Pt(t.gross,s.gross),bySection:a.map(In)},r=oe(e.velocity),l=Array.isArray(r.bySection)?r.bySection.map(c=>{let d=oe(c),g=Pt(d.bookedValue,d.grossRevenue);return{...d,bookedValue:g,grossRevenue:g}}):[];return{...e,bookedValue:o,revenue:o,velocity:{...r,bySection:l}}}function er(i){let e=oe(i),t=oe(e.report),s=typeof t.includesBookedValue=="boolean"?t.includesBookedValue:t.includesRevenue===!0,n=Array.isArray(t.rows)?t.rows.map(r=>{let l=oe(r),c=oe(l.attribution),d=Hn(c.bookedValue,c.revenue);return{...l,attribution:{...c,bookedValue:d,revenue:d}}}):[],a=oe(t.totals),o=Hn(a.bookedValue,a.revenue);return{...e,report:{...t,includesBookedValue:s,includesRevenue:s,rows:n,totals:{...a,bookedValue:o,revenue:o}}}}function ks(i){let e=oe(i),t=typeof e.includesBookedValue=="boolean"?e.includesBookedValue:e.includesRevenue===!0;return{...e,includesBookedValue:t,includesRevenue:t}}var Rn,W,et,Bt=Y(()=>{"use strict";Rn=Symbol.for("seatlayer.ManageApiError"),W=class extends Error{static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&e[Rn]===!0}constructor(e,t,s,n,a,o){super(t),Object.defineProperty(this,Rn,{value:!0}),this.name="ManageApiError",this.status=e,this.code=s,this.conflicts=n,this.details=a,this.serverMessage=o}};et=class{constructor(e,t){this.base=e.replace(/\/+$/,""),this.token=t}setToken(e){this.token=e}auth(e,t={}){let s=t.method??"GET",n={Authorization:`Bearer ${this.token}`},a;return t.body!==void 0&&(n["Content-Type"]="application/json",a=JSON.stringify(t.body)),fetch(`${this.base}${e}`,{method:s,headers:n,body:a,credentials:"omit"}).then(o=>An(o))}async authBlob(e){let t=await fetch(`${this.base}${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});return t.ok||await An(t),t.blob()}chart(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/chart`)}asset(e,t){return/^[a-zA-Z0-9._-]+$/.test(t)?this.authBlob(`/v1/events/${encodeURIComponent(e)}/assets/${encodeURIComponent(t)}`):Promise.reject(new W(404,"not_found","not_found"))}objects(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/objects`)}subscribeTicket(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/subscribe-tickets`,{method:"POST"})}socketUrl(e){return`${this.base.replace(/^http/,"ws")}/pub/events/${encodeURIComponent(e)}/subscribe?surface=manager`}block(e,t,s={}){let n={labels:t};return typeof s.releaseAt=="number"&&(n.releaseAt=s.releaseAt),s.reason&&(n.reason=s.reason),this.auth(`/v1/events/${encodeURIComponent(e)}/block`,{method:"POST",body:n})}unblock(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/unblock`,{method:"POST",body:{labels:t}})}unblockAll(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/unblock-all`,{method:"POST"})}eventRequest(e,t,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/${t}`,s)}unbook(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/unbook`,{method:"POST",body:{labels:t,bookingRef:s}})}setHoldTtl(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/hold-ttl`,{method:"POST",body:{holdTtlMs:t}})}setCategory(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`,{method:"POST",body:{labels:t,categoryKey:s}})}lookupOrders(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/orders/lookup?q=${encodeURIComponent(t)}`)}categoryDifferences(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`)}resetCategoriesToChart(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`,{method:"POST",body:{mode:"chart",...t?{labels:t}:{}}})}setTableBooking(e,t,s,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/table-booking`,{method:"POST",body:{tableIds:t,mode:s,...n}})}bookings(e,t={}){let s=new URLSearchParams;t.q&&s.set("q",t.q),t.state&&s.set("state",t.state),t.cursor&&s.set("cursor",t.cursor),t.limit!=null&&s.set("limit",String(t.limit));let n=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings${n?`?${n}`:""}`)}booking(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings/${encodeURIComponent(t)}`)}listBookings(e,t={}){return this.bookings(e,t)}retrieveBooking(e,t){return this.booking(e,t)}availability(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/availability`)}setAvailability(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/availability`,{method:"POST",body:{rules:t}})}channels(e,t={}){let s=t.includeArchived?"?includeArchived=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels${s}`)}channelAllocation(e,t={}){let s=new URLSearchParams;t.afterLabel&&s.set("afterLabel",t.afterLabel),t.limit!=null&&s.set("limit",String(t.limit));let n=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/allocation${n?`?${n}`:""}`)}channelAudit(e,t={}){let s=new URLSearchParams;t.limit!=null&&s.set("limit",String(t.limit)),t.before!=null&&s.set("before",String(t.before));let n=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/audit${n?`?${n}`:""}`)}createChannel(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels`,{method:"POST",body:t})}renameChannel(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{name:s}})}updateChannelPricing(e,t,s,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{priceOverrides:s,expectedPricingVersion:n}})}setChannelPaused(e,t,s){let n=s?"pause":"unpause";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/${n}`,{method:"POST",body:{}})}archiveChannel(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/archive`,{method:"POST",body:{destination:s}})}applyChannelAssignment(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/assignments`,{method:"POST",body:{targetChannelId:t.targetChannelId||null,labels:t.labels,assignmentVersion:t.assignmentVersion}})}channelPreview(e,t,s={}){let n=new URLSearchParams;t.length&&n.set("channelIds",t.join(",")),s.includePublic!=null&&n.set("includePublic",s.includePublic?"1":"0");let a=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/preview${a?`?${a}`:""}`)}setChannelAccessIntent(e,t,s,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{accessIntent:s,...n.acknowledgeLiveAccess?{acknowledgeLiveAccess:!0}:{},...n.reason?{reason:n.reason}:{}}})}createAccessLink(e,t,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`,{method:"POST",body:s})}accessLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`)}rotateAccessLink(e,t,s,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(s)}/rotate`,{method:"POST",body:{endActiveSessions:n}})}revokeAccessLink(e,t,s,n=!1){let a=n?"?endActiveSessions=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(s)}${a}`,{method:"DELETE"})}report(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/report`).then(Jo)}seatHistory(e,t,s,n){let a=new URLSearchParams({label:t});return s&&a.set("before",String(s)),n&&a.set("action",n),this.auth(`/v1/events/${encodeURIComponent(e)}/seat-history?${a}`)}seatStory(e,t,s,n){let a=new URLSearchParams({label:t,v:"2"});return s&&a.set("before",String(s)),n&&a.set("action",n),this.auth(`/v1/events/${encodeURIComponent(e)}/seat-history?${a}`)}controlRoom(e,t=15){return this.auth(`/v1/events/${encodeURIComponent(e)}/control-room?window=${t}&activity=2`).then(Qo)}channelReport(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/report`).then(er)}createChannelReportLink(e,t,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`,{method:"POST",body:s}).then(n=>{let a=oe(n);return{...a,link:ks(a.link)}})}channelReportLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`).then(s=>{let n=oe(s);return{links:Array.isArray(n.links)?n.links.map(ks):[]}})}revokeChannelReportLink(e,t,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links/${encodeURIComponent(s)}`,{method:"DELETE"}).then(n=>{let a=oe(n);return{...a,link:ks(a.link)}})}log(e,t={}){let s=new URLSearchParams;t.limit!=null&&s.set("limit",String(t.limit)),t.before!=null&&s.set("before",String(t.before));let n=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/log${n?`?${n}`:""}`)}async reportCsv(e){let t=await fetch(`${this.base}/v1/events/${encodeURIComponent(e)}/report.csv`,{headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});if(!t.ok)throw new W(t.status,`request_failed_${t.status}`);return t.blob()}}});function Pn(i,e,t,s={}){let n=s.previous?null:document.activeElement??null;s.previous?.scrim.remove();let a=document.createElement("div");a.className="slm-ch-scrim",a.innerHTML=`<div class="slm-ch-dialog" role="dialog" aria-modal="true"
2
+ aria-labelledby="slm-ch-dlg-title" tabindex="-1">${e}</div>`,i.appendChild(a);let o=a.firstElementChild,r=!1,l={scrim:a,dialog:o,close:({restoreFocus:d=!0}={})=>{r||(r=!0,a.remove(),d&&(n?.isConnected&&i.contains(n)?n:i).focus?.({preventScroll:!0}),s.onClose?.())}};return o.querySelectorAll("[data-ch-close]").forEach(d=>{d.addEventListener("click",()=>l.close())}),a.addEventListener("keydown",d=>{if(d.key==="Escape"){d.stopPropagation(),l.close();return}if(d.key!=="Tab")return;let g=[...o.querySelectorAll('summary,button:not([disabled]),select:not([hidden]),input,textarea,a[href],[tabindex]:not([tabindex="-1"])')];if(!g.length)return;let b=g[0],m=g[g.length-1];d.shiftKey&&document.activeElement===b?(d.preventDefault(),m.focus()):!d.shiftKey&&document.activeElement===m&&(d.preventDefault(),b.focus())}),t(o),Xe(o),(o.querySelector("input,summary,button")??o).focus(),l}var Bn,ws=Y(()=>{"use strict";Mt();Bn=`
3
+ .slm{--slm-ch-scrim:rgba(0,0,0,.58)}
4
+ .slm[data-theme=light]{--slm-ch-scrim:rgba(23,32,51,.42)}
5
+ .slm-ch-scrim{position:absolute;inset:0;z-index:12;background:var(--slm-ch-scrim);display:grid;place-items:center;
6
+ padding:18px;animation:slm-ch-fade var(--slm-mo-quick) var(--slm-mo-out)}
7
+ .slm-ch-dialog{width:min(460px,100%);max-height:100%;overflow:auto;overscroll-behavior:contain;background:var(--slm-surface);color:var(--slm-text);border:1px solid var(--slm-line);
8
+ border-radius:14px;padding:20px;box-shadow:0 24px 70px rgba(0,0,0,.6);
9
+ animation:slm-ch-rise var(--slm-mo-base) var(--slm-mo-out)}
10
+ .slm-ch-dialog h3{margin:0 0 4px;font-size:16px;font-weight:800;letter-spacing:-.01em}
11
+ .slm-ch-dialog .sub{font-size:12.5px;color:var(--slm-muted);line-height:1.5;margin-bottom:14px}
12
+ .slm-ch-dialog .foot{display:flex;gap:8px;margin-top:16px}
13
+ .slm-ch-dialog .foot .slm-btn{flex:1;min-width:0}
14
+ .slm-ch-dialog .foot .quiet{flex:none;padding:10px 14px;min-height:44px;color:var(--slm-muted);font-weight:700;font-size:13px}
15
+ @keyframes slm-ch-fade{from{opacity:0}to{opacity:1}}
16
+ @keyframes slm-ch-rise{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}
17
+ .slm-ch-err{color:var(--slm-text);font-size:11.5px;margin-top:6px}
18
+ .slm-ch-secmenu{position:absolute;left:0;top:calc(100% + 6px);z-index:40;width:280px;max-height:360px;overflow:auto;padding:6px;border-radius:14px;
19
+ border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 12px 32px rgba(12,18,32,.18)}
20
+ .slm-ch-menuhead{margin:0;padding:6px 10px;font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted)}
21
+ .slm .slm-ch-secmenu button{display:flex;align-items:flex-start;gap:9px;width:100%;padding:8px 10px;border-radius:9px;text-align:left}
22
+ .slm .slm-ch-secmenu button:hover,.slm .slm-ch-secmenu button:focus-visible{background:var(--slm-tint);outline:none}
23
+ .slm-ch-secmenu button:disabled{opacity:.5;cursor:not-allowed}
24
+ .slm-ch-secmenu .dot,.slm-sl-section .dot{width:9px;height:9px;border-radius:50%;margin-top:4px;flex:none}
25
+ .slm-ch-secmenu b,.slm-sl-section b{display:block;font-size:13px;font-weight:600}
26
+ .slm-ch-secmenu small,.slm-sl-section small{display:block;font-size:11.5px;color:var(--slm-muted)}
27
+ .slm-ch-menuerr{margin:4px 10px;font-size:11.5px;color:color-mix(in srgb,#b45309 75%,var(--slm-text))}
28
+ @media (prefers-reduced-motion:reduce){.slm-ch-scrim,.slm-ch-dialog{animation:none!important}}
29
+ `});function rr(i,e){if(!i.labels.length)return"Nothing found";let t=[];i.sections&&t.push(`${i.sections.toLocaleString()} section${i.sections===1?"":"s"}`),i.rows&&t.push(`${i.rows.toLocaleString()} row${i.rows===1?"":"s"}`);let s=`${i.labels.length.toLocaleString()} seat${i.labels.length===1?"":"s"} found`,n=t.length?`${t.join(" \xB7 ")} \xB7 ${s}`:s;return e?`${n} \xB7 Enter to ${e==="frame"?"show":"select"}`:n}function lr(i={}){return`
2
30
  <div class="slm-find${i.compact?" slm-find-bar":""}" data-ch-find>
3
31
  <input type="search" class="slm-input" data-ch-find-input placeholder="Find seat, row or section" aria-label="Find seat, row or section" autocomplete="off"${i.compact?' aria-keyshortcuts="/"':""}>
4
32
  <span class="slm-find-count" data-ch-find-count role="status"></span>
5
- </div>`}function Bn(i,e){return i.toLocaleLowerCase().split(/\s+/).some(t=>e.length>=2?t.startsWith(e):t===e)}function Po(i,e){let t=i.trim().toLocaleLowerCase();if(!t)return{labels:[],seats:0,rows:0,sections:0};let s=new Set,n=0,a=0;for(let d of e.sections)if(Bn(d.label,t)){n+=1;for(let b of d.labels)s.add(b)}let o=t.split(/\s+/),r=o[o.length-1],l=o.slice(0,-1).join(" ");for(let d of e.rows)if(d.label.toLocaleLowerCase()===r&&!(l&&!Bn(d.sectionLabel,l))){a+=1;for(let b of d.labels)s.add(b)}let c=0;for(let d of e.seatLabels){let b=d.toLocaleLowerCase();(b===t||b.startsWith(`${t}-`))&&(s.has(d)||(c+=1),s.add(d))}return{labels:[...s],seats:c,rows:a,sections:n}}function Pn(i){let e=i.clearAttr?`<button type="button" class="slm-linkbtn slm-selclear" ${i.clearAttr}${i.count?"":" disabled"}>Clear</button>`:"";return`<div class="slm-selbar" aria-live="polite">
33
+ </div>`}function Yn(i,e){return i.toLocaleLowerCase().split(/\s+/).some(t=>e.length>=2?t.startsWith(e):t===e)}function cr(i,e){let t=i.trim().toLocaleLowerCase();if(!t)return{labels:[],seats:0,rows:0,sections:0};let s=new Set,n=0,a=0;for(let d of e.sections)if(Yn(d.label,t)){n+=1;for(let g of d.labels)s.add(g)}let o=t.split(/\s+/),r=o[o.length-1],l=o.slice(0,-1).join(" ");for(let d of e.rows)if(d.label.toLocaleLowerCase()===r&&!(l&&!Yn(d.sectionLabel,l))){a+=1;for(let g of d.labels)s.add(g)}let c=0;for(let d of e.seatLabels){let g=d.toLocaleLowerCase();(g===t||g.startsWith(`${t}-`))&&(s.has(d)||(c+=1),s.add(d))}return{labels:[...s],seats:c,rows:a,sections:n}}function Xn(i){let e=i.clearAttr?`<button type="button" class="slm-linkbtn slm-selclear" ${i.clearAttr}${i.count?"":" disabled"}>Clear</button>`:"";return`<div class="slm-selbar" aria-live="polite">
6
34
  <span class="slm-selnum${i.bump?" bump":""}">${i.count.toLocaleString()}</span>
7
- <span class="slm-sellabel">${w(i.noun??"selected")}</span>
35
+ <span class="slm-sellabel">${S(i.noun??"selected")}</span>
8
36
  ${i.breakdown??""}${e}
9
- </div>`}var Oo,Do,Ze,fs=Y(()=>{"use strict";pe();Oo=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,Do=(i,e)=>`${i.toLocaleString()} free of ${e.toLocaleString()}`,Ze=class{constructor(e){this.host=e;this.rowsCache=null;this.seatListSection=null;this.seatListCap=null;this.menu=null;this.opening=!1}rows(){return this.rowsCache||(this.rowsCache=this.host.rows()),this.rowsCache}reset(){this.rowsCache=null,this.seatListSection=null,this.menu?.remove(),this.menu=null}chipsHtml(e={}){let t=this.host.sections().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-sections">Section</button>':"",s=this.rows().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-rows">Rows\u2026</button>':"",n=this.host.categories().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-category">Category</button>':"",a=e.find===!1?"":Bo();return`
37
+ </div>`}var dr,hr,tt,$s=Y(()=>{"use strict";ge();dr=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,hr=(i,e)=>`${i.toLocaleString()} free of ${e.toLocaleString()}`,tt=class{constructor(e){this.host=e;this.rowsCache=null;this.seatListSection=null;this.seatListCap=null;this.menu=null;this.opening=!1}rows(){return this.rowsCache||(this.rowsCache=this.host.rows()),this.rowsCache}reset(){this.rowsCache=null,this.seatListSection=null,this.menu?.remove(),this.menu=null}chipsHtml(e={}){let t=this.host.sections().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-sections">Section</button>':"",s=this.rows().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-rows">Rows\u2026</button>':"",n=this.host.categories().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-category">Category</button>':"",a=e.find===!1?"":lr();return`
10
38
  <div class="slm-chooser" data-ch-chooser>
11
39
  <div class="slm-ch-row2">${e.intents??""}${t}${s}</div>
12
40
  <div class="slm-ch-row2">${n}<button type="button" class="slm-btn ghost" data-ch-act="seatlist">Seat list</button>${e.saved?'<button type="button" class="slm-btn ghost" data-saved-open>Saved\u2026</button>':""}</div>
13
41
  ${a}
14
- </div>`}wire(e,t={}){this.wireChips(e),this.wireFind(e,t)}wireChips(e){e.querySelectorAll("[data-ch-act]").forEach(t=>{let s=t.dataset.chAct;s==="pick-sections"?t.addEventListener("click",()=>this.openSections(t)):s==="pick-rows"?t.addEventListener("click",()=>this.openRows()):s==="pick-category"?t.addEventListener("click",()=>this.openCategory()):s==="seatlist"&&t.addEventListener("click",()=>this.openSeatList())})}handleAction(e){if(e==="pick-sections")this.openSections();else if(e==="pick-rows")this.openRows();else if(e==="pick-category")this.openCategory();else if(e==="seatlist")this.openSeatList();else return!1;return!0}wireFind(e,t={}){let s=e.querySelector("[data-ch-find-input]"),n=e.querySelector("[data-ch-find-count]");if(!s||!n)return;let a={labels:[],seats:0,rows:0,sections:0},o=l=>{n.textContent=l,n.title=l},r=()=>{let l=s.value.trim();a=this.find(s.value),o(l?Io(a,t.enter??"select"):""),this.host.highlight?.(l?a.labels:null),t.onFind?.(a)};s.addEventListener("input",r),s.addEventListener("keydown",l=>{if(l.key==="Escape"&&s.value){l.preventDefault(),l.stopPropagation(),s.value="",r();return}if(l.key!=="Enter"||(l.preventDefault(),!a.labels.length))return;if(t.enter==="frame"){this.host.frame?.(a.labels),o(`${a.labels.length.toLocaleString()} on the map`);return}let c=new Set([...this.host.selectionLabels(),...a.labels]);if(this.host.cap!=null&&c.size>this.host.cap){o(`That would make ${c.size.toLocaleString()} selected seats \u2014 the limit is ${this.host.cap.toLocaleString()}.`);return}this.host.selectByLabels(a.labels),o(`${a.labels.length.toLocaleString()} selected`)}),s.addEventListener("search",r)}find(e){return Po(e,{sections:this.host.sections().map(t=>({...t,labels:this.host.labelsInSection(t.id)})),rows:this.rows(),seatLabels:this.host.seats().map(t=>t.label)})}openCategory(){this.openPicker("pick-category",e=>e.openCategory(this))}openRows(){this.openPicker("pick-rows",e=>e.openRows(this))}openSeatList(e=""){this.openPicker("seatlist",t=>t.openSeatList(this,e))}openPicker(e,t){if(this.opening||!this.host.pickers)return;let s=this.host.pickers();if(!(s instanceof Promise)){t(s);return}this.opening=!0;let n=[...document.querySelectorAll(`[data-ch-act="${e}"]`)];n.forEach(a=>a.setAttribute("aria-busy","true")),s.then(t,()=>this.host.pickerFailed?.(()=>this.openPicker(e,t))).finally(()=>{this.opening=!1,n.forEach(a=>a.removeAttribute("aria-busy"))})}openSections(e){let t=e??document.querySelector('[data-ch-act="pick-sections"]');this.menu?.remove(),this.menu=null;let s=this.host.cap??1/0,n=this.host.sections().map(c=>{let d=this.host.labelsInSection(c.id),b=this.host.sectionInfo?.(c.id);return{...c,labels:d,total:b?.total??d.length,color:b?.color}}).filter(c=>c.total>0),a=document.createElement("div");a.className="slm-ch-secmenu",a.setAttribute("role","menu"),a.innerHTML=`<p class="slm-ch-menuhead">Add a whole section</p>${n.map(c=>`
15
- <button type="button" role="menuitem" data-ch-scope-id="${w(c.id)}"${c.labels.length?"":" disabled"}>
16
- <span class="dot" style="background:${w(c.color??"#6e7bff")}" aria-hidden="true"></span>
17
- <span><b>${w(c.label)}</b><small>${Do(c.labels.length,c.total)}</small></span>
18
- </button>`).join("")||'<p class="slm-ch-menuhead">This chart has no sections with free seats.</p>'}<p class="slm-ch-menuerr" data-ch-error hidden></p>`;let o=t?.parentElement??document.body;o.style.position=o===document.body?o.style.position:"relative",o.appendChild(a),this.menu=a;let r=()=>{a.remove(),this.menu===a&&(this.menu=null),document.removeEventListener("pointerdown",l,!0)},l=c=>{!a.contains(c.target)&&c.target!==t&&r()};document.addEventListener("pointerdown",l,!0),a.addEventListener("keydown",c=>{let d=[...a.querySelectorAll("button:not([disabled])")],b=d.indexOf(document.activeElement);c.key==="Escape"?(r(),t?.focus(),c.preventDefault()):(c.key==="ArrowDown"||c.key==="ArrowUp")&&(d[(b+(c.key==="ArrowDown"?1:-1)+d.length)%d.length]?.focus(),c.preventDefault())}),a.querySelectorAll("[data-ch-scope-id]").forEach(c=>c.addEventListener("click",()=>{let d=n.find(f=>f.id===c.dataset.chScopeId);if(!d)return;let b=new Set([...this.host.selectionLabels(),...d.labels]);if(b.size>s){let f=a.querySelector("[data-ch-error]");f.hidden=!1,f.textContent=`That would make ${Oo(b.size)}. One change can take up to ${s.toLocaleString()}.`;return}r(),this.host.selectByLabels([...b])})),a.querySelector("button:not([disabled])")?.focus()}}});function et(i){let e=i.map(a=>{let o=a.lastIndexOf(" ");return o>0?[a.slice(0,o),a.slice(o+1)]:["",a]}),t=a=>a.length>1?`${a.slice(0,-1).join(", ")} and ${a[a.length-1]}`:a[0]??"",s=e[0]?.[0]??"";if(i.length<=6&&s&&e.every(([a])=>a===s))return`${s} ${t(e.map(([,a])=>a))}`;let n=i.slice(0,3);return i.length>3?`${n.join(", ")} and ${i.length-3} more`:t(n)}function ei(i){return`Ask an admin${i?.trim()?` of ${i.trim()}`:""}`}var dt=Y(()=>{"use strict"});function re(i){return i==null||i===""||i===ee}function Ee(i,e){let t=(i??"").trim();return((/\p{L}/u.exec(t)?.[0]??t[0]??"")||e).toUpperCase().slice(0,1)}function ht(i,e){let t=new Set([...e].map(a=>Ee(a,"")).filter(Boolean)),s=Ee(i,"");return{letter:pi.includes(s)&&!t.has(s)?s:[...pi].find(a=>!t.has(a))??(s||"X"),color:zt[t.size%zt.length]}}function Nt(i,e=0){return re(i.id)?{letter:Ee(i.marker,"P"),color:i.color||Wo}:{letter:Ee(i.marker||i.name,"?"),color:i.color||zt[e%zt.length]}}function Ft(i,e,t){let s=new Map;for(let o of i){let r=Ls(e.get(o));s.set(r,(s.get(r)??0)+1)}let n=[{id:ee,name:t?.publicSale?.name??oe},...(t?.channels??[]).map(o=>({id:o.id,name:o.name}))],a=[];for(let o of n){let r=s.get(o.id);r&&a.push({channelId:o.id,name:o.name,count:r}),s.delete(o.id)}for(let[o,r]of s)a.push({channelId:o,name:re(o)?oe:"Another channel",count:r});return a}function Ls(i){return re(i)?ee:i}function Ss(i){return{count:i.length,labels:i.slice(0,bi),truncated:i.length>bi}}function qt(i){let{labels:e,allocation:t,statusOf:s,nameOf:n}=i,a=Ls(i.targetChannelId),o=new Set,r=0,l=0,c=new Map,d=[],b=[],f=[];for(let m of e){if(o.has(m))continue;o.add(m);let v=s(m);if(!v){f.push(m);continue}let $=Ls(t.get(m));if($===a){l+=1;continue}if(v==="held"){d.push(m);continue}if(v==="booked"){b.push(m);continue}$===ee?r+=1:c.set($,(c.get($)??0)+1)}let u=[...c.entries()].map(([m,v])=>({channelId:m,name:n(m),count:v}));return{changedFromPublic:{count:r},movedFromOtherChannel:{count:u.reduce((m,v)=>m+v.count,0),channels:u},alreadyInTarget:{count:l},skippedHeld:Ss(d),skippedBooked:Ss(b),notFound:Ss(f)}}function tt(i){return i.changedFromPublic.count+i.movedFromOtherChannel.count}function gi(i){return i.movedFromOtherChannel.count>0}function _t(i,e){let t=[];i.changedFromPublic.count&&t.push({kind:"add",icon:"+",count:i.changedFromPublic.count,text:`${i.changedFromPublic.count.toLocaleString()} from ${oe}`});for(let s of i.movedFromOtherChannel.channels)t.push({kind:"move",icon:"\u21C4",count:s.count,text:`${s.count.toLocaleString()} moved out of ${s.name??"another channel"}`,why:"this needs your OK"});return i.alreadyInTarget.count&&t.push({kind:"same",icon:"=",count:i.alreadyInTarget.count,text:`${i.alreadyInTarget.count.toLocaleString()} already in ${e}`,why:"unchanged"}),i.skippedHeld.count&&t.push({kind:"skip",icon:"\u23F8",count:i.skippedHeld.count,text:`${i.skippedHeld.count.toLocaleString()} in a buyer's cart`,why:"can't move while held",peek:Dt(i.skippedHeld)}),i.skippedBooked.count&&t.push({kind:"skip",icon:"\u{1F512}",count:i.skippedBooked.count,text:`${i.skippedBooked.count.toLocaleString()} already sold`,why:"sales are never rewritten",peek:Dt(i.skippedBooked)}),i.notFound.count&&t.push({kind:"skip",icon:"?",count:i.notFound.count,text:`${i.notFound.count.toLocaleString()} not on this map`,why:"these seats are no longer part of the event",peek:Dt(i.notFound)}),t}function Dt(i){if(!i.labels.length)return;let e=i.labels.slice(0,4).join(", ");return i.truncated||i.labels.length>4?`${e}\u2026`:e}function jt(i){let e=i?.retryAfterMs??(i?.latestHoldExpiresAt?Math.max(0,i.latestHoldExpiresAt-Date.now()):0);if(!e)return"in a moment";let t=Math.ceil(e/6e4);return t<=1?"in about a minute":`in about ${t} minutes`}function Vt(i){if(!i||!i.intent)return"\u2014";let e=i.intent==="server"?"Your website or app":i.intent==="hosted_link"?"Buyer links":i.intent==="internal"?"Your own staff sell these":"Protected reserve",t=i.hasActiveGrants?"in use now":i.lastMintAt?`last used ${new Date(i.lastMintAt).toLocaleDateString()}`:null,s=i.detail??t;return s?`${e} \xB7 ${s}`:e}function Pe(i){return i==="internal"?"Sell through your own staff":i==="server"?"Integrate a website or app":i==="hosted_link"?"Sell with a buyer link":"Keep as protected reserve"}function fi(i){switch(i){case"internal":return"Only your own box office can sell these seats, through your secret key. Buyer links and website integrations are refused.";case"server":return"Your website's backend mints each buyer a short-lived session for these seats. Buyer links are refused; the code lives on the Embed page.";case"hosted_link":return"SeatLayer makes a link you send to a named group. They open it and buy only these seats. No other route can sell them.";default:return"Nobody can buy these seats. Every way of letting a buyer in \u2014 a buyer link, your website, even your own staff \u2014 is refused while this is the route. The seats stay out of public sale."}}function Go(i){return i==="hosted_link"?"hosted_link":i==="server"?"server":i==="staff"?"internal":null}function st(i){let e=$s(i?.accessIntent),t=Go(i?.route),s=`This channel is set to "${Pe(e)}"`;return t?`${s}, so it cannot do that. Switch it to "${Pe(t)}" first.`:`${s}, so it cannot do that. Choose a different route for this channel first.`}function $s(i){return i==="internal"||i==="server"||i==="hosted_link"||i==="none"?i:"none"}function Ot(i,e,t){return`${i.toLocaleString()} ${i===1?e:t}`}function Ut(i){let e=Math.max(0,i?.liveAccessLinks??0),t=Math.max(0,i?.activeSessions??0),s=$s(i?.from),n=$s(i?.to),o=`${[e?Ot(e,"buyer link is live","buyer links are live"):null,t?Ot(t,"buyer is in a checkout","buyers are in a checkout"):null].filter(Boolean).join(", and ")||"Buyers are inside this channel"} on "${Pe(s)}". Moving it to "${Pe(n)}" changes what happens to them.`,r=[];return e&&r.push(`${Ot(e,"buyer link closes","buyer links close")} immediately. Anyone who has not opened it yet never will \u2014 send a new link if you still need one.`),t&&r.push(`${Ot(t,"buyer who is already in a checkout keeps","buyers who are already in a checkout keep")} their seats and can finish paying. Nobody is thrown out. No new buyers come in this way, so the old route empties on its own within 12 hours.`),{headline:o,consequences:r}}function Kt(i){switch(i.status??i.state){case"active":return{text:"Active",kind:"active"};case"expired":return{text:"Expired",kind:"archived"};case"exhausted":return{text:"All used",kind:"paused"};case"rotated":return{text:"Replaced",kind:"archived"};default:return{text:"Revoked",kind:"archived"}}}function Wt(i){return i.state==="active"&&i.status==="active"}function Ts(i){return Number.isFinite(i)?new Date(i).toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}):"\u2014"}function vi(i){return[{k:"Expires",v:Ts(i.expiresAt)},{k:"Redemptions",v:`${i.redemptions.toLocaleString()} of ${i.maxRedemptions.toLocaleString()} used`},{k:"Seats per buyer",v:`${i.maxQuantity.toLocaleString()} seat${i.maxQuantity===1?"":"s"} maximum`},{k:"Covers",v:i.includePublic?"This channel's allocation and Public sale seats":"This channel's allocation only"}]}function yi(i){return[`${i.redemptions.toLocaleString()} of ${i.maxRedemptions.toLocaleString()} used`,`${i.maxQuantity.toLocaleString()} ${i.maxQuantity===1?"seat":"seats"} per buyer`,`ends ${Ts(i.expiresAt)}`,i.includePublic?"with Public sale seats":"",i.activeSessions?`${i.activeSessions.toLocaleString()} ${i.activeSessions===1?"buyer":"buyers"} inside now`:""].filter(Boolean).join(" \xB7 ")}function xi(i){let e=`${i.maxQuantity.toLocaleString()} ${i.maxQuantity===1?"seat":"seats"} each`,t=`${i.maxRedemptions.toLocaleString()} ${i.maxRedemptions===1?"person":"people"} in all`;return`Anyone with this link can buy up to ${e}, ${t}, until ${Ts(i.expiresAt)}.`+(i.includePublic?" It also opens Public sale seats.":"")}function _e(i){let e=i?.serverMessage?.trim();switch(i?.code){case"invalid_expiry":case"invalid_max_redemptions":case"invalid_max_quantity":case"invalid_session_ttl":case"invalid_label":return e||"That setting is outside what a hosted link allows. Adjust it and try again.";case"too_many_access_links":return e||"This channel already has as many live links as it can hold. Revoke one before creating another.";case"access_link_not_active":return"That link is no longer active, so it cannot be rotated or revoked.";case"channel_unavailable":return"This channel is paused or archived, so it cannot let new buyers in. Resume it first.";case"channel_access_intent_forbids":return st(i?.details);case"end_active_sessions_required":return"Choose what happens to the buyers who already came in through this link.";case"not_found":return"That link is no longer here. Refresh and try again.";default:return i?.status===403?"Hosted access links need channel-management permission.":e||"That did not go through. Try again."}}function ki(i){return(i?.channels??[]).map(e=>({kind:"skip",icon:"\u26A0",count:e.count,text:`${e.count.toLocaleString()} would leave ${e.name??"a channel"}`,why:"the new chart no longer has these seats",peek:e.labels?.length?Dt({count:e.count,labels:e.labels,truncated:e.truncated??!1}):void 0}))}function Gt(i){return i==="builtin"?"Built-in":i==="active"?"Active":i==="paused"?"Paused":"Archived"}var ee,oe,zt,Wo,pi,bi,ut,Yt=Y(()=>{"use strict";ee="public",oe="Public sale";zt=["#a78bfa","#2dd4bf","#fb923c","#60a5fa","#f472b6","#a3e635","#f87171","#38bdf8","#c084fc","#facc15"],Wo="#f4b740",pi="ABCDEFGHJKLMNPQRSTUVWXYZ";bi=12;ut={maxRedemptions:100,maxQuantity:4}});function nt(i){return i.map((e,t)=>`
42
+ </div>`}wire(e,t={}){this.wireChips(e),this.wireFind(e,t)}wireChips(e){e.querySelectorAll("[data-ch-act]").forEach(t=>{let s=t.dataset.chAct;s==="pick-sections"?t.addEventListener("click",()=>this.openSections(t)):s==="pick-rows"?t.addEventListener("click",()=>this.openRows()):s==="pick-category"?t.addEventListener("click",()=>this.openCategory()):s==="seatlist"&&t.addEventListener("click",()=>this.openSeatList())})}handleAction(e){if(e==="pick-sections")this.openSections();else if(e==="pick-rows")this.openRows();else if(e==="pick-category")this.openCategory();else if(e==="seatlist")this.openSeatList();else return!1;return!0}wireFind(e,t={}){let s=e.querySelector("[data-ch-find-input]"),n=e.querySelector("[data-ch-find-count]");if(!s||!n)return;let a={labels:[],seats:0,rows:0,sections:0},o=l=>{n.textContent=l,n.title=l},r=()=>{let l=s.value.trim();a=this.find(s.value),o(l?rr(a,t.enter??"select"):""),this.host.highlight?.(l?a.labels:null),t.onFind?.(a)};s.addEventListener("input",r),s.addEventListener("keydown",l=>{if(l.key==="Escape"&&s.value){l.preventDefault(),l.stopPropagation(),s.value="",r();return}if(l.key!=="Enter"||(l.preventDefault(),!a.labels.length))return;if(t.enter==="frame"){this.host.frame?.(a.labels),o(`${a.labels.length.toLocaleString()} on the map`);return}let c=new Set([...this.host.selectionLabels(),...a.labels]);if(this.host.cap!=null&&c.size>this.host.cap){o(`That would make ${c.size.toLocaleString()} selected seats \u2014 the limit is ${this.host.cap.toLocaleString()}.`);return}this.host.selectByLabels(a.labels),o(`${a.labels.length.toLocaleString()} selected`)}),s.addEventListener("search",r)}find(e){return cr(e,{sections:this.host.sections().map(t=>({...t,labels:this.host.labelsInSection(t.id)})),rows:this.rows(),seatLabels:this.host.seats().map(t=>t.label)})}openCategory(){this.openPicker("pick-category",e=>e.openCategory(this))}openRows(){this.openPicker("pick-rows",e=>e.openRows(this))}openSeatList(e=""){this.openPicker("seatlist",t=>t.openSeatList(this,e))}openPicker(e,t){if(this.opening||!this.host.pickers)return;let s=this.host.pickers();if(!(s instanceof Promise)){t(s);return}this.opening=!0;let n=[...document.querySelectorAll(`[data-ch-act="${e}"]`)];n.forEach(a=>a.setAttribute("aria-busy","true")),s.then(t,()=>this.host.pickerFailed?.(()=>this.openPicker(e,t))).finally(()=>{this.opening=!1,n.forEach(a=>a.removeAttribute("aria-busy"))})}openSections(e){let t=e??document.querySelector('[data-ch-act="pick-sections"]');this.menu?.remove(),this.menu=null;let s=this.host.cap??1/0,n=this.host.sections().map(c=>{let d=this.host.labelsInSection(c.id),g=this.host.sectionInfo?.(c.id);return{...c,labels:d,total:g?.total??d.length,color:g?.color}}).filter(c=>c.total>0),a=document.createElement("div");a.className="slm-ch-secmenu",a.setAttribute("role","menu"),a.innerHTML=`<p class="slm-ch-menuhead">Add a whole section</p>${n.map(c=>`
43
+ <button type="button" role="menuitem" data-ch-scope-id="${S(c.id)}"${c.labels.length?"":" disabled"}>
44
+ <span class="dot" style="background:${S(c.color??"#6e7bff")}" aria-hidden="true"></span>
45
+ <span><b>${S(c.label)}</b><small>${hr(c.labels.length,c.total)}</small></span>
46
+ </button>`).join("")||'<p class="slm-ch-menuhead">This chart has no sections with free seats.</p>'}<p class="slm-ch-menuerr" data-ch-error hidden></p>`;let o=t?.parentElement??document.body;o.style.position=o===document.body?o.style.position:"relative",o.appendChild(a),this.menu=a;let r=()=>{a.remove(),this.menu===a&&(this.menu=null),document.removeEventListener("pointerdown",l,!0)},l=c=>{!a.contains(c.target)&&c.target!==t&&r()};document.addEventListener("pointerdown",l,!0),a.addEventListener("keydown",c=>{let d=[...a.querySelectorAll("button:not([disabled])")],g=d.indexOf(document.activeElement);c.key==="Escape"?(r(),t?.focus(),c.preventDefault()):(c.key==="ArrowDown"||c.key==="ArrowUp")&&(d[(g+(c.key==="ArrowDown"?1:-1)+d.length)%d.length]?.focus(),c.preventDefault())}),a.querySelectorAll("[data-ch-scope-id]").forEach(c=>c.addEventListener("click",()=>{let d=n.find(b=>b.id===c.dataset.chScopeId);if(!d)return;let g=new Set([...this.host.selectionLabels(),...d.labels]);if(g.size>s){let b=a.querySelector("[data-ch-error]");b.hidden=!1,b.textContent=`That would make ${dr(g.size)}. One change can take up to ${s.toLocaleString()}.`;return}r(),this.host.selectByLabels([...g])})),a.querySelector("button:not([disabled])")?.focus()}}});function He(i){let e=i.map(a=>{let o=a.lastIndexOf(" ");return o>0?[a.slice(0,o),a.slice(o+1)]:["",a]}),t=a=>a.length>1?`${a.slice(0,-1).join(", ")} and ${a[a.length-1]}`:a[0]??"",s=e[0]?.[0]??"";if(s&&e.every(([a])=>a===s)){let a=e.map(([,o])=>o);return`${s} ${i.length<=6?t(a):`${a.slice(0,3).join(", ")} and ${i.length-3} more`}`}let n=i.slice(0,3);return i.length>3?`${n.join(", ")} and ${i.length-3} more`:t(n)}function gt(i){return`Ask an admin${i?.trim()?` of ${i.trim()}`:""}`}var nt=Y(()=>{"use strict"});function ce(i){return i==null||i===""||i===se}function Ie(i,e){let t=(i??"").trim();return((/\p{L}/u.exec(t)?.[0]??t[0]??"")||e).toUpperCase().slice(0,1)}function bt(i,e){let t=new Set([...e].map(a=>Ie(a,"")).filter(Boolean)),s=Ie(i,"");return{letter:Ri.includes(s)&&!t.has(s)?s:[...Ri].find(a=>!t.has(a))??(s||"X"),color:jt[t.size%jt.length]}}function Vt(i,e=0){return ce(i.id)?{letter:Ie(i.marker,"P"),color:i.color||yr}:{letter:Ie(i.marker||i.name,"?"),color:i.color||jt[e%jt.length]}}function Ut(i,e,t){let s=new Map;for(let o of i){let r=Is(e.get(o));s.set(r,(s.get(r)??0)+1)}let n=[{id:se,name:t?.publicSale?.name??le},...(t?.channels??[]).map(o=>({id:o.id,name:o.name}))],a=[];for(let o of n){let r=s.get(o.id);r&&a.push({channelId:o.id,name:o.name,count:r}),s.delete(o.id)}for(let[o,r]of s)a.push({channelId:o,name:ce(o)?le:"Another channel",count:r});return a}function Is(i){return ce(i)?se:i}function Hs(i){return{count:i.length,labels:i.slice(0,Ai),truncated:i.length>Ai}}function Kt(i){let{labels:e,allocation:t,statusOf:s,nameOf:n}=i,a=Is(i.targetChannelId),o=new Set,r=0,l=0,c=new Map,d=[],g=[],b=[];for(let p of e){if(o.has(p))continue;o.add(p);let f=s(p);if(!f){b.push(p);continue}let k=Is(t.get(p));if(k===a){l+=1;continue}if(f==="held"){d.push(p);continue}if(f==="booked"){g.push(p);continue}k===se?r+=1:c.set(k,(c.get(k)??0)+1)}let m=[...c.entries()].map(([p,f])=>({channelId:p,name:n(p),count:f}));return{changedFromPublic:{count:r},movedFromOtherChannel:{count:m.reduce((p,f)=>p+f.count,0),channels:m},alreadyInTarget:{count:l},skippedHeld:Hs(d),skippedBooked:Hs(g),notFound:Hs(b)}}function it(i){return i.changedFromPublic.count+i.movedFromOtherChannel.count}function Hi(i){return i.movedFromOtherChannel.count>0}function Wt(i,e){let t=[];i.changedFromPublic.count&&t.push({kind:"add",icon:"+",count:i.changedFromPublic.count,text:`${i.changedFromPublic.count.toLocaleString()} from ${le}`});for(let s of i.movedFromOtherChannel.channels)t.push({kind:"move",icon:"\u21C4",count:s.count,text:`${s.count.toLocaleString()} moved out of ${s.name??"another channel"}`,why:"this needs your OK"});return i.alreadyInTarget.count&&t.push({kind:"same",icon:"=",count:i.alreadyInTarget.count,text:`${i.alreadyInTarget.count.toLocaleString()} already in ${e}`,why:"unchanged"}),i.skippedHeld.count&&t.push({kind:"skip",icon:"\u23F8",count:i.skippedHeld.count,text:`${i.skippedHeld.count.toLocaleString()} in a buyer's cart`,why:"can't move while held",peek:_t(i.skippedHeld)}),i.skippedBooked.count&&t.push({kind:"skip",icon:"\u{1F512}",count:i.skippedBooked.count,text:`${i.skippedBooked.count.toLocaleString()} already sold`,why:"sales are never rewritten",peek:_t(i.skippedBooked)}),i.notFound.count&&t.push({kind:"skip",icon:"?",count:i.notFound.count,text:`${i.notFound.count.toLocaleString()} not on this map`,why:"these seats are no longer part of the event",peek:_t(i.notFound)}),t}function _t(i){if(!i.labels.length)return;let e=i.labels.slice(0,4).join(", ");return i.truncated||i.labels.length>4?`${e}\u2026`:e}function Gt(i){let e=i?.retryAfterMs??(i?.latestHoldExpiresAt?Math.max(0,i.latestHoldExpiresAt-Date.now()):0);if(!e)return"in a moment";let t=Math.ceil(e/6e4);return t<=1?"in about a minute":`in about ${t} minutes`}function Yt(i){if(!i||!i.intent)return"\u2014";let e=i.intent==="server"?"Your website or app":i.intent==="hosted_link"?"Buyer links":i.intent==="internal"?"Your own staff sell these":"Protected reserve",t=i.hasActiveGrants?"in use now":i.lastMintAt?`last used ${new Date(i.lastMintAt).toLocaleDateString()}`:null,s=i.detail??t;return s?`${e} \xB7 ${s}`:e}function Fe(i){return i==="internal"?"Sell through your own staff":i==="server"?"Integrate a website or app":i==="hosted_link"?"Sell with a buyer link":"Keep as protected reserve"}function Ii(i){switch(i){case"internal":return"Only your own box office can sell these seats, through your secret key. Buyer links and website integrations are refused.";case"server":return"Your website's backend mints each buyer a short-lived session for these seats. Buyer links are refused; the code lives on the Embed page.";case"hosted_link":return"SeatLayer makes a link you send to a named group. They open it and buy only these seats. No other route can sell them.";default:return"Nobody can buy these seats. Every way of letting a buyer in \u2014 a buyer link, your website, even your own staff \u2014 is refused while this is the route. The seats stay out of public sale."}}function xr(i){return i==="hosted_link"?"hosted_link":i==="server"?"server":i==="staff"?"internal":null}function at(i){let e=Ps(i?.accessIntent),t=xr(i?.route),s=`This channel is set to "${Fe(e)}"`;return t?`${s}, so it cannot do that. Switch it to "${Fe(t)}" first.`:`${s}, so it cannot do that. Choose a different route for this channel first.`}function Ps(i){return i==="internal"||i==="server"||i==="hosted_link"||i==="none"?i:"none"}function qt(i,e,t){return`${i.toLocaleString()} ${i===1?e:t}`}function Xt(i){let e=Math.max(0,i?.liveAccessLinks??0),t=Math.max(0,i?.activeSessions??0),s=Ps(i?.from),n=Ps(i?.to),o=`${[e?qt(e,"buyer link is live","buyer links are live"):null,t?qt(t,"buyer is in a checkout","buyers are in a checkout"):null].filter(Boolean).join(", and ")||"Buyers are inside this channel"} on "${Fe(s)}". Moving it to "${Fe(n)}" changes what happens to them.`,r=[];return e&&r.push(`${qt(e,"buyer link closes","buyer links close")} immediately. Anyone who has not opened it yet never will \u2014 send a new link if you still need one.`),t&&r.push(`${qt(t,"buyer who is already in a checkout keeps","buyers who are already in a checkout keep")} their seats and can finish paying. Nobody is thrown out. No new buyers come in this way, so the old route empties on its own within 12 hours.`),{headline:o,consequences:r}}function Zt(i){switch(i.status??i.state){case"active":return{text:"Active",kind:"active"};case"expired":return{text:"Expired",kind:"archived"};case"exhausted":return{text:"All used",kind:"paused"};case"rotated":return{text:"Replaced",kind:"archived"};default:return{text:"Revoked",kind:"archived"}}}function Jt(i){return i.state==="active"&&i.status==="active"}function Bs(i){return Number.isFinite(i)?new Date(i).toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}):"\u2014"}function Pi(i){return[{k:"Expires",v:Bs(i.expiresAt)},{k:"Redemptions",v:`${i.redemptions.toLocaleString()} of ${i.maxRedemptions.toLocaleString()} used`},{k:"Seats per buyer",v:`${i.maxQuantity.toLocaleString()} seat${i.maxQuantity===1?"":"s"} maximum`},{k:"Covers",v:i.includePublic?"This channel's allocation and Public sale seats":"This channel's allocation only"}]}function Bi(i){return[`${i.redemptions.toLocaleString()} of ${i.maxRedemptions.toLocaleString()} used`,`${i.maxQuantity.toLocaleString()} ${i.maxQuantity===1?"seat":"seats"} per buyer`,`ends ${Bs(i.expiresAt)}`,i.includePublic?"with Public sale seats":"",i.activeSessions?`${i.activeSessions.toLocaleString()} ${i.activeSessions===1?"buyer":"buyers"} inside now`:""].filter(Boolean).join(" \xB7 ")}function Oi(i){let e=`${i.maxQuantity.toLocaleString()} ${i.maxQuantity===1?"seat":"seats"} each`,t=`${i.maxRedemptions.toLocaleString()} ${i.maxRedemptions===1?"person":"people"} in all`;return`Anyone with this link can buy up to ${e}, ${t}, until ${Bs(i.expiresAt)}.`+(i.includePublic?" It also opens Public sale seats.":"")}function Ue(i){let e=i?.serverMessage?.trim();switch(i?.code){case"invalid_expiry":case"invalid_max_redemptions":case"invalid_max_quantity":case"invalid_session_ttl":case"invalid_label":return e||"That setting is outside what a hosted link allows. Adjust it and try again.";case"too_many_access_links":return e||"This channel already has as many live links as it can hold. Revoke one before creating another.";case"access_link_not_active":return"That link is no longer active, so it cannot be rotated or revoked.";case"channel_unavailable":return"This channel is paused or archived, so it cannot let new buyers in. Resume it first.";case"channel_access_intent_forbids":return at(i?.details);case"end_active_sessions_required":return"Choose what happens to the buyers who already came in through this link.";case"not_found":return"That link is no longer here. Refresh and try again.";default:return i?.status===403?"Hosted access links need channel-management permission.":e||"That did not go through. Try again."}}function Di(i){return(i?.channels??[]).map(e=>({kind:"skip",icon:"\u26A0",count:e.count,text:`${e.count.toLocaleString()} would leave ${e.name??"a channel"}`,why:"the new chart no longer has these seats",peek:e.labels?.length?_t({count:e.count,labels:e.labels,truncated:e.truncated??!1}):void 0}))}function Qt(i){return i==="builtin"?"Built-in":i==="active"?"Active":i==="paused"?"Paused":"Archived"}var se,le,jt,yr,Ri,Ai,ft,es=Y(()=>{"use strict";se="public",le="Public sale";jt=["#a78bfa","#2dd4bf","#fb923c","#60a5fa","#f472b6","#a3e635","#f87171","#38bdf8","#c084fc","#facc15"],yr="#f4b740",Ri="ABCDEFGHJKLMNPQRSTUVWXYZ";Ai=12;ft={maxRedemptions:100,maxQuantity:4}});function ot(i){return i.map((e,t)=>`
19
47
  <div class="slm-ch-bucket" style="animation-delay:${Math.min(t,4)*30}ms">
20
- <span class="ico ${e.kind}" aria-hidden="true">${I(e.icon)}</span>
21
- <span><b>${e.count.toLocaleString()}</b> ${I(e.text.replace(/^[\d,.\s]+/,""))}
22
- ${e.why?`<span class="why">\u2014 ${I(e.why)}</span>`:""}</span>
23
- ${e.peek?`<span class="peek">${I(e.peek)}</span>`:"<span></span>"}
24
- </div>`).join("")}function I(i){return String(i??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Li(i){return new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16)}function Cs(i,e){let t=i.querySelector(e)?.value.trim()??"",s=Number(t);return t!==""&&Number.isInteger(s)?s:null}function $i(i,e){let t=typeof navigator>"u"?null:navigator.clipboard;return t?.writeText?t.writeText(e).then(()=>!0,()=>wi(i,e)):Promise.resolve(wi(i,e))}function wi(i,e){let t=i.querySelector("[data-ch-lk-sink]");if(t&&typeof document.execCommand=="function")try{t.value=e,t.select(),t.setSelectionRange(0,e.length);let s=document.execCommand("copy");if(t.value="",s)return!0}catch{t.value=""}return Yo(i),!1}function Yo(i){let e=i.querySelector("[data-ch-lk-url]");if(e)try{let t=document.createRange();t.selectNodeContents(e);let s=window.getSelection();s?.removeAllRanges(),s?.addRange(t)}catch{}}var Si,Xt=Y(()=>{"use strict";Si=`
48
+ <span class="ico ${e.kind}" aria-hidden="true">${P(e.icon)}</span>
49
+ <span><b>${e.count.toLocaleString()}</b> ${P(e.text.replace(/^[\d,.\s]+/,""))}
50
+ ${e.why?`<span class="why">\u2014 ${P(e.why)}</span>`:""}</span>
51
+ ${e.peek?`<span class="peek">${P(e.peek)}</span>`:"<span></span>"}
52
+ </div>`).join("")}function P(i){return String(i??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ni(i){return new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16)}function Os(i,e){let t=i.querySelector(e)?.value.trim()??"",s=Number(t);return t!==""&&Number.isInteger(s)?s:null}function qi(i,e){let t=typeof navigator>"u"?null:navigator.clipboard;return t?.writeText?t.writeText(e).then(()=>!0,()=>zi(i,e)):Promise.resolve(zi(i,e))}function zi(i,e){let t=i.querySelector("[data-ch-lk-sink]");if(t&&typeof document.execCommand=="function")try{t.value=e,t.select(),t.setSelectionRange(0,e.length);let s=document.execCommand("copy");if(t.value="",s)return!0}catch{t.value=""}return kr(i),!1}function kr(i){let e=i.querySelector("[data-ch-lk-url]");if(e)try{let t=document.createRange();t.selectNodeContents(e);let s=window.getSelection();s?.removeAllRanges(),s?.addRange(t)}catch{}}var Fi,ts=Y(()=>{"use strict";Fi=`
25
53
  <p class="slm-eyebrow" style="margin-top:18px">On your website</p>
26
54
  <p class="slm-hint">There is nothing more to set up on this screen. Your own server mints a short-lived buyer
27
55
  access session for this channel with the SeatLayer server SDK and hands it to the widget. A channel name
28
56
  on its own never grants access.</p>
29
57
  <p class="slm-note"><a class="slm-linkbtn" href="https://docs.seatlayer.io/server-api/channels"
30
- target="_blank" rel="noreferrer noopener">Read the website integration guide \u2192</a></p>`});function tr(i){return i?.dataset?.theme==="light"?er:Qo}function Mi(i){let e=i.canvas,t=i.layer;if(!e||!t)return;let s=i.host.mapLayer.getBoundingClientRect(),n=Math.max(1,Math.round(s.width)),a=Math.max(1,Math.round(s.height)),o=typeof devicePixelRatio=="number"?Math.min(3,Math.max(1,devicePixelRatio)):1;(e.width!==n*o||e.height!==a*o)&&(e.width=n*o,e.height=a*o);let r=i.resolveCtx();if(!r)return;r.setTransform(o,0,0,o,0,0),r.clearRect(0,0,n,a);let l=tr(i.host.root),c=i.host.isSeatDetail(),d=Math.max(3,i.host.seatPixelSize()),b=d/2,f=i.view==="preview"?i.previewProjection:null,u=f?new Set(f.available===!1?[]:f.eligible??[]):null,m=new Map,v=!c&&i.host.sections().length>1?new Map:null,$=i.view==="preview"&&c&&d<=15?new Map:null;for(let A of i.host.seats()){let O=i.host.statusOf(A.label)??"free",B=i.allocation.get(A.label)??ee;if(B!==ee){let g=m.get(B)??{x:0,y:0,n:0};g.x+=A.x,g.y+=A.y,g.n+=1,m.set(B,g)}if(!c){let g=i.host.sectionOfLabel(A.label),y=g?i.host.worldToScreen({x:A.x,y:A.y}):null;if(v&&g&&y){let L=v.get(g.id)??{label:g.label,minX:y.x,minY:y.y,maxX:y.x,maxY:y.y};L.minX=Math.min(L.minX,y.x),L.minY=Math.min(L.minY,y.y),L.maxX=Math.max(L.maxX,y.x),L.maxY=Math.max(L.maxY,y.y),v.set(g.id,L)}continue}if(O!=="free")continue;let k=null,h=null;if(i.view==="preview"?u?.has(A.label)?(k=Zo,h=Jo):(k=l.unavailableFill,h=l.unavailableStroke):B!==ee&&(k=i.markerFor(B).color,h=l.allocationStroke),!k)continue;let p=i.host.worldToScreen({x:A.x,y:A.y});if(p&&!(p.x<-d||p.y<-d||p.x>n+d||p.y>a+d)){if($){let g=i.host.sectionOfLabel(A.label);if(g){let y=$.get(g.id)??{label:g.label,minX:p.x,minY:p.y,maxX:p.x,maxY:p.y};y.minX=Math.min(y.minX,p.x),y.minY=Math.min(y.minY,p.y),y.maxX=Math.max(y.maxX,p.x),y.maxY=Math.max(y.maxY,p.y),$.set(g.id,y)}}if(r.fillStyle=k,i.view==="preview"||B!==ee){let g=Math.max(2,b+Math.min(1.5,b*.06));r.globalAlpha=1,r.beginPath(),r.arc(p.x,p.y,g,0,Math.PI*2),r.fill(),r.strokeStyle=h??k,r.lineWidth=i.view==="preview"?Math.max(1,Math.min(1.75,d*.13)):Math.max(1,Math.min(1.5,d*.1)),r.stroke(),i.view==="preview"&&u?.has(A.label)&&d>=22&&sr(r,A.label,p.x,p.y,g)}else r.globalAlpha=.85,r.fillRect(p.x-b,p.y-b,d,d)}}r.globalAlpha=1,$&&or(r,$,l),nr(v,i),rr(m,i,r)}function sr(i,e,t,s,n){let a=n*1.55,o=Math.min(13,Math.max(7,n*.55)),r=6;for(;o>=r&&(i.font=`800 ${o}px var(--slm-font, system-ui, sans-serif)`,!(i.measureText(e).width<=a));)o-=.5;o<r||(i.fillStyle="#ffffff",i.textAlign="center",i.textBaseline="middle",i.fillText(e,t,s))}function nr(i,e){let t=e.layer;if(t&&(t.querySelectorAll(".slm-ch-section-target").forEach(s=>s.remove()),!!i))for(let[s,n]of i){let a=n.maxX-n.minX,o=n.maxY-n.minY;if(a<20||o<20)continue;let r=document.createElement("button");r.type="button",r.className="slm-ch-section-target",r.style.left=`${n.minX-8}px`,r.style.top=`${n.minY-8}px`,r.style.width=`${a+16}px`,r.style.height=`${o+16}px`,r.setAttribute("aria-label",`Open ${n.label} seats`),ar(r,e,()=>e.onSectionTargetClick(s)),t.appendChild(r)}}function ir(i,e){let t={button:0,buttons:1,clientX:e.x,clientY:e.y,bubbles:!0,cancelable:!0,composed:!0};return typeof PointerEvent=="function"?new PointerEvent("pointerdown",{...t,pointerId:i.pointerId,pointerType:i.pointerType,isPrimary:!0}):new MouseEvent("pointerdown",t)}function Ci(i){return i.host.mapLayer.querySelector(".slm-map-host")??i.host.mapLayer}function ar(i,e,t){i.addEventListener("wheel",l=>{let c=Ci(e);c!==i&&(l.preventDefault(),c.dispatchEvent(new WheelEvent("wheel",{deltaX:l.deltaX,deltaY:l.deltaY,deltaZ:l.deltaZ,deltaMode:l.deltaMode,clientX:l.clientX,clientY:l.clientY,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,altKey:l.altKey,metaKey:l.metaKey,bubbles:!0,cancelable:!0,composed:!0})))},{passive:!1});let s=null,n=!1,a=()=>{s=null,e.layer?.classList.remove("panning"),window.removeEventListener("pointermove",o,!0),window.removeEventListener("pointerup",r,!0),window.removeEventListener("pointercancel",r,!0)};function o(l){if(!s||n||Math.abs(l.clientX-s.x)<Ti&&Math.abs(l.clientY-s.y)<Ti)return;n=!0;let c=s;e.layer?.classList.add("panning");let d=document.elementFromPoint?.(c.x,c.y)??null;(d&&d!==i?d:Ci(e)).dispatchEvent(ir(l,c))}function r(){a()}i.addEventListener("pointerdown",l=>{n=!1,s={x:l.clientX,y:l.clientY},window.addEventListener("pointermove",o,!0),window.addEventListener("pointerup",r,!0),window.addEventListener("pointercancel",r,!0)}),i.addEventListener("click",l=>{if(n){n=!1,l.preventDefault(),l.stopPropagation();return}t()})}function or(i,e,t){for(let s of e.values()){let n=s.maxX-s.minX,a=s.maxY-s.minY;if(n<52||a<26)continue;let o=(s.minX+s.maxX)/2,r=(s.minY+s.maxY)/2,l=Math.max(11,Math.min(15,a*.16));i.font=`800 ${l}px var(--slm-font, system-ui, sans-serif)`;let c=Math.min(n-8,i.measureText(s.label).width+18),d=l+10;i.fillStyle=t.sectionPlate,i.fillRect(o-c/2,r-d/2,c,d),i.fillStyle=t.sectionPlateInk,i.textAlign="center",i.textBaseline="middle",i.fillText(s.label,o,r)}}function rr(i,e,t){let s=e.layer;if(!s||(s.querySelectorAll(".slm-ch-flag").forEach(a=>a.remove()),e.view==="preview"))return;let n=[...i.entries()].sort((a,o)=>o[1].n-a[1].n).slice(0,Xo);for(let[a,o]of n){let r=e.list?.channels.find(b=>b.id===a);if(!r)continue;let l=e.host.worldToScreen({x:o.x/o.n,y:o.y/o.n});if(!l)continue;let c=e.markerFor(a),d=document.createElement("span");d.className="slm-ch-flag",d.style.left=`${l.x}px`,d.style.top=`${l.y}px`,d.innerHTML=`<span class="mk" style="background:${I(c.color)}">${I(c.letter)}</span>${I(r.name)}${r.state==="paused"?" \xB7 Paused":""}`,s.appendChild(d)}}var Xo,Zo,Jo,Qo,er,Ti,Ei=Y(()=>{"use strict";Yt();Xt();Xo=8,Zo="#6e7bff",Jo="#b9c0ff",Qo={unavailableFill:"#303846",unavailableStroke:"#4b5669",allocationStroke:"#101723",sectionPlate:"rgba(11,16,28,.88)",sectionPlateInk:"#f8fafc"},er={unavailableFill:"rgba(156,163,175,.55)",unavailableStroke:"rgba(107,114,128,.65)",allocationStroke:"#ffffff",sectionPlate:"rgba(255,255,255,.9)",sectionPlateInk:"#172033"};Ti=4});var Ri,Ai=Y(()=>{"use strict";Ri=`
58
+ target="_blank" rel="noreferrer noopener">Read the website integration guide \u2192</a></p>`});function Tr(i){return i?.dataset?.theme==="light"?Cr:$r}function Vi(i){let e=i.canvas,t=i.layer;if(!e||!t)return;let s=i.host.mapLayer.getBoundingClientRect(),n=Math.max(1,Math.round(s.width)),a=Math.max(1,Math.round(s.height)),o=typeof devicePixelRatio=="number"?Math.min(3,Math.max(1,devicePixelRatio)):1;(e.width!==n*o||e.height!==a*o)&&(e.width=n*o,e.height=a*o);let r=i.resolveCtx();if(!r)return;r.setTransform(o,0,0,o,0,0),r.clearRect(0,0,n,a);let l=Tr(i.host.root),c=i.host.isSeatDetail(),d=Math.max(3,i.host.seatPixelSize()),g=d/2,b=i.view==="preview"?i.previewProjection:null,m=b?new Set(b.available===!1?[]:b.eligible??[]):null,p=new Map,f=!c&&i.host.sections().length>1?new Map:null,k=i.view==="preview"&&c&&d<=15?new Map:null;for(let A of i.host.seats()){let B=i.host.statusOf(A.label)??"free",O=i.allocation.get(A.label)??se;if(O!==se){let y=p.get(O)??{x:0,y:0,n:0};y.x+=A.x,y.y+=A.y,y.n+=1,p.set(O,y)}if(!c){let y=i.host.sectionOfLabel(A.label),h=y?i.host.worldToScreen({x:A.x,y:A.y}):null;if(f&&y&&h){let v=f.get(y.id)??{label:y.label,minX:h.x,minY:h.y,maxX:h.x,maxY:h.y};v.minX=Math.min(v.minX,h.x),v.minY=Math.min(v.minY,h.y),v.maxX=Math.max(v.maxX,h.x),v.maxY=Math.max(v.maxY,h.y),f.set(y.id,v)}continue}if(B!=="free")continue;let I=null,u=null;if(i.view==="preview"?m?.has(A.label)?(I=Sr,u=Lr):(I=l.unavailableFill,u=l.unavailableStroke):(I=O===se?"#c9d0dc":i.markerFor(O).color,u=l.allocationStroke),!I)continue;let x=i.host.worldToScreen({x:A.x,y:A.y});if(x&&!(x.x<-d||x.y<-d||x.x>n+d||x.y>a+d)){if(k){let y=i.host.sectionOfLabel(A.label);if(y){let h=k.get(y.id)??{label:y.label,minX:x.x,minY:x.y,maxX:x.x,maxY:x.y};h.minX=Math.min(h.minX,x.x),h.minY=Math.min(h.minY,x.y),h.maxX=Math.max(h.maxX,x.x),h.maxY=Math.max(h.maxY,x.y),k.set(y.id,h)}}r.fillStyle=I;{let y=Math.max(2,g+Math.min(1.5,g*.06));r.globalAlpha=1,r.beginPath(),r.arc(x.x,x.y,y,0,Math.PI*2),r.fill(),r.strokeStyle=u??I,r.lineWidth=i.view==="preview"?Math.max(1,Math.min(1.75,d*.13)):Math.max(1,Math.min(1.5,d*.1)),r.stroke(),i.view==="preview"&&m?.has(A.label)&&d>=22&&Mr(r,A.label,x.x,x.y,y)}}}r.globalAlpha=1,k&&Hr(r,k,l),Er(f,i),Ir(p,i,r)}function Mr(i,e,t,s,n){let a=n*1.55,o=Math.min(13,Math.max(7,n*.55)),r=6;for(;o>=r&&(i.font=`800 ${o}px var(--slm-font, system-ui, sans-serif)`,!(i.measureText(e).width<=a));)o-=.5;o<r||(i.fillStyle="#ffffff",i.textAlign="center",i.textBaseline="middle",i.fillText(e,t,s))}function Er(i,e){let t=e.layer;if(t&&(t.querySelectorAll(".slm-ch-section-target").forEach(s=>s.remove()),!!i))for(let[s,n]of i){let a=n.maxX-n.minX,o=n.maxY-n.minY;if(a<20||o<20)continue;let r=document.createElement("button");r.type="button",r.className="slm-ch-section-target",r.style.left=`${n.minX-8}px`,r.style.top=`${n.minY-8}px`,r.style.width=`${a+16}px`,r.style.height=`${o+16}px`,r.setAttribute("aria-label",`Open ${n.label} seats`),Ar(r,e,()=>e.onSectionTargetClick(s)),t.appendChild(r)}}function Rr(i,e){let t={button:0,buttons:1,clientX:e.x,clientY:e.y,bubbles:!0,cancelable:!0,composed:!0};return typeof PointerEvent=="function"?new PointerEvent("pointerdown",{...t,pointerId:i.pointerId,pointerType:i.pointerType,isPrimary:!0}):new MouseEvent("pointerdown",t)}function ji(i){return i.host.mapLayer.querySelector(".slm-map-host")??i.host.mapLayer}function Ar(i,e,t){i.addEventListener("wheel",l=>{let c=ji(e);c!==i&&(l.preventDefault(),c.dispatchEvent(new WheelEvent("wheel",{deltaX:l.deltaX,deltaY:l.deltaY,deltaZ:l.deltaZ,deltaMode:l.deltaMode,clientX:l.clientX,clientY:l.clientY,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,altKey:l.altKey,metaKey:l.metaKey,bubbles:!0,cancelable:!0,composed:!0})))},{passive:!1});let s=null,n=!1,a=()=>{s=null,e.layer?.classList.remove("panning"),window.removeEventListener("pointermove",o,!0),window.removeEventListener("pointerup",r,!0),window.removeEventListener("pointercancel",r,!0)};function o(l){if(!s||n||Math.abs(l.clientX-s.x)<_i&&Math.abs(l.clientY-s.y)<_i)return;n=!0;let c=s;e.layer?.classList.add("panning");let d=document.elementFromPoint?.(c.x,c.y)??null;(d&&d!==i?d:ji(e)).dispatchEvent(Rr(l,c))}function r(){a()}i.addEventListener("pointerdown",l=>{n=!1,s={x:l.clientX,y:l.clientY},window.addEventListener("pointermove",o,!0),window.addEventListener("pointerup",r,!0),window.addEventListener("pointercancel",r,!0)}),i.addEventListener("click",l=>{if(n){n=!1,l.preventDefault(),l.stopPropagation();return}t()})}function Hr(i,e,t){for(let s of e.values()){let n=s.maxX-s.minX,a=s.maxY-s.minY;if(n<52||a<26)continue;let o=(s.minX+s.maxX)/2,r=(s.minY+s.maxY)/2,l=Math.max(11,Math.min(15,a*.16));i.font=`800 ${l}px var(--slm-font, system-ui, sans-serif)`;let c=Math.min(n-8,i.measureText(s.label).width+18),d=l+10;i.fillStyle=t.sectionPlate,i.fillRect(o-c/2,r-d/2,c,d),i.fillStyle=t.sectionPlateInk,i.textAlign="center",i.textBaseline="middle",i.fillText(s.label,o,r)}}function Ir(i,e,t){let s=e.layer;if(!s||(s.querySelectorAll(".slm-ch-flag").forEach(a=>a.remove()),e.view==="preview"))return;let n=[...i.entries()].sort((a,o)=>o[1].n-a[1].n).slice(0,wr);for(let[a,o]of n){let r=e.list?.channels.find(g=>g.id===a);if(!r)continue;let l=e.host.worldToScreen({x:o.x/o.n,y:o.y/o.n});if(!l)continue;let c=e.markerFor(a),d=document.createElement("span");d.className="slm-ch-flag",d.style.left=`${l.x}px`,d.style.top=`${l.y}px`,d.innerHTML=`<span class="mk" style="background:${P(c.color)}">${P(c.letter)}</span>${P(r.name)}${r.state==="paused"?" \xB7 Paused":""}`,s.appendChild(d)}}var wr,Sr,Lr,$r,Cr,_i,Ui=Y(()=>{"use strict";es();ts();wr=8,Sr="#6e7bff",Lr="#b9c0ff",$r={unavailableFill:"#303846",unavailableStroke:"#4b5669",allocationStroke:"#101723",sectionPlate:"rgba(11,16,28,.88)",sectionPlateInk:"#f8fafc"},Cr={unavailableFill:"rgba(156,163,175,.55)",unavailableStroke:"rgba(107,114,128,.65)",allocationStroke:"#ffffff",sectionPlate:"rgba(255,255,255,.9)",sectionPlateInk:"#172033"};_i=4});var Ki,Wi=Y(()=>{"use strict";Ki=`
31
59
  .slm{--slm-ch-marker-ink:#0e1017;
32
60
  --slm-mo-instant:80ms;--slm-mo-quick:140ms;--slm-mo-base:200ms;--slm-mo-slow:320ms;--slm-mo-ambient:2000ms;
33
61
  --slm-mo-out:cubic-bezier(.2,.8,.2,1);--slm-mo-in-out:cubic-bezier(.4,0,.2,1);--slm-mo-exit:cubic-bezier(.4,0,1,1);
@@ -117,6 +145,7 @@
117
145
  .slm-ch-assigncard .slm-note{margin:8px 0 0}
118
146
  .slm-ch-giveto{display:flex;align-items:center;gap:8px}.slm-ch-giveto label{flex:none;margin:0;font-size:12px;font-weight:600;color:var(--slm-text)}
119
147
  .slm-ch-giveto>:last-child{flex:1;min-width:0}
148
+ .slm-ch-pick{position:relative}.slm-ch-pick .slm-ch-mk{position:absolute;left:7px;top:6px;width:22px;height:22px;pointer-events:none}.slm-ch-pick summary{padding-left:36px!important}
120
149
  .slm-ch-staged2{margin-top:12px;padding:12px 14px;border-radius:14px;border:1px solid color-mix(in srgb,var(--slm-accent) 55%,transparent);
121
150
  background:color-mix(in srgb,var(--slm-accent) 10%,var(--slm-surface));font-size:12px;font-weight:500}
122
151
  .slm-ch-stagedtop{display:flex;align-items:baseline;gap:8px;margin-bottom:6px}
@@ -287,42 +316,42 @@
287
316
  .slm-ch-staged.shake{outline:2px solid #e5484d;outline-offset:2px}
288
317
  .slm-ch-staged.done{outline:2px solid #5bd39b;outline-offset:2px}
289
318
  }
290
- `});var Ii={};rs(Ii,{CHANNELS_CSS:()=>Ri,ChannelsMode:()=>mt,bucketRowsHtml:()=>nt});var lr,Le,Zt,Hi,cr,dr,hr,ur,mr,mt,Ms=Y(()=>{"use strict";wt();Fe();fs();Yt();Rt();Ei();Xt();Ai();Xt();lr=3e4,Le=5e3,Zt=Be({glyph:"route",hue:"#ea7a1e",title:"Channels",purpose:"Give seats to a sales channel, such as the box office or a partner, and decide how buyers reach them.",how:"channels"}),Hi=3e4,cr='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#8b5cf6" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 12.2V4.5a1 1 0 0 1 1-1h7.7l8.3 8.3a1.4 1.4 0 0 1 0 2l-6.3 6.3a1.4 1.4 0 0 1-2 0z"/><circle cx="8" cy="8" r="1.6"/></svg>',dr={hosted_link:["Buyer links","Only people with a link can buy these seats."],server:["Your website or app","Your integration lets buyers in."],internal:["Your own staff","Sold at the box office or by phone."],none:["Protected reserve","Nobody can buy them until you change this."]},hr='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/></svg>',ur='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#ea7a1e" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>',mr='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#d99a0b" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="M5 3.5l13 7-5.6 1.6L10 18z"/></svg>',mt=class{constructor(e,t){this.active=!1;this.list=null;this.allocation=new Map;this.assignmentVersion=0;this.loadError=null;this.loading=!0;this.view="inspect";this.mapIntent="pan";this.focusedSectionId=null;this.showArchived=!1;this.detailChannelId=null;this.assignOpen=!1;this.targetChannelId="";this.conflict=!1;this.applied=null;this.railNote=null;this.appliedTimer=null;this.dialog=null;this.detent="medium";this.links=[];this.linksChannelId=null;this.linksState="idle";this.listSeq=0;this.linksSeq=0;this.previewAudience=[];this.previewIncludePublic=!1;this.previewProjection=null;this.previewState="idle";this.pollTimer=null;this.layer=null;this.canvas=null;this.overlayVisible=!0;this.ctx=void 0;this.bannerEl=null;this.stagedEl=null;this.liveEl=null;this.scrimEl=null;this.lastFocus=null;this.stagedDoneTimer=null;this.lastSelectionCount=0;this.lastCounts=new Map;this.railHtml=null;this.allocationVersion=null;this.onVisibility=null;this.host=e,this.caps=t;let s={selectionLabels:()=>e.selectionLabels(),selectByLabels:n=>e.selectByLabels(n),clearSelection:()=>e.clearSelection(),selectSection:n=>e.selectSection(n),sections:()=>e.sections(),labelsInSection:n=>e.labelsInSection(n),rows:()=>e.rows(),categories:()=>e.categories(),labelsInCategory:n=>e.labelsInCategory(n),seats:()=>e.seats(),statusOf:n=>e.statusOf(n),sectionOfLabel:n=>e.sectionOfLabel(n),seatMeta:n=>{let a=this.allocation.get(n)??ee;return`${this.nameOf(a)??oe} \xB7 ${e.statusOf(n)??"free"}`},openDialog:(n,a)=>this.renderScrim(n,a),closeDialog:()=>this.closeDialog(),pickers:e.pickers,pickerFailed:e.pickerFailed,enhanceDialog:e.enhanceDialog,cap:Le};this.chooser=new Ze(s)}enter(){this.active||(this.active=!0,this.mapIntent="pan",this.assignOpen=!1,this.focusedSectionId=null,this.chooser.reset(),this.railHtml=null,this.ensureLayer(),this.host.root.classList.add("ch-mode"),this.applySheetClasses(),this.host.sections().length>1&&this.host.showSectionOverview(),this.paintRail(),this.onInteractionChange?.(),this.refresh(),this.pollTimer=setInterval(()=>{typeof document<"u"&&document.hidden||this.refresh({quiet:!0})},lr),typeof document<"u"&&typeof document.addEventListener=="function"&&(this.onVisibility=()=>{this.active&&!document.hidden&&this.refresh({quiet:!0})},document.addEventListener("visibilitychange",this.onVisibility)))}leave(){this.active&&(this.active=!1,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.onVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",this.onVisibility),this.onVisibility=null,this.railHtml=null,this.closeDialog({restoreFocus:!1}),this.links=[],this.linksChannelId=null,this.linksState="idle",this.layer?.classList.remove("on"),this.host.root.classList.remove("ch-mode","ch-preview","ch-sheet","detent-collapsed","detent-medium","detent-full"),this.setBanner(!1),this.setStaged(null))}destroy(){this.leave(),this.stagedDoneTimer&&clearTimeout(this.stagedDoneTimer),this.layer?.remove(),this.layer=null,this.bannerEl?.remove(),this.bannerEl=null}setCapabilities(e){this.caps=e,this.active&&this.paintRail()}isActive(){return this.active}canSelect(){return this.caps.manage&&this.view==="inspect"}usesMarqueeSelection(){return this.canSelect()&&this.mapIntent==="assign"}handleSectionFocus(e){this.active&&(this.focusedSectionId=e,this.paintRail())}applyRealtimeHint(){this.active&&this.refresh({quiet:!0})}handleSelectionChange(){this.active&&(this.paintSelection(),this.paintStagedBar())}handleViewChange(){this.active&&this.paintOverlay()}handleLayoutChange(){this.active&&(this.applySheetClasses(),this.paintOverlay())}async refresh(e={}){if(!this.caps.view)return;let t=++this.listSeq,s=()=>t!==this.listSeq;try{let n=await this.host.api.channels(this.host.eventKey,{includeArchived:this.showArchived});if(s())return;if(this.list=n,this.assignmentVersion=n.assignmentVersion,this.loadError=null,this.targetChannelId||(this.targetChannelId=n.channels.find(a=>a.state==="active")?.id??ee),this.allocationVersion!==n.assignmentVersion){if(await this.loadAllocation(t),s())return;this.allocationVersion=n.assignmentVersion}if(this.detailChannelId&&await this.loadLinks(this.detailChannelId),s())return;this.loading=!1,this.active&&(this.paintRail(),this.paintOverlay()),this.host.channelsChanged?.()}catch(n){if(s())return;this.loading=!1,n instanceof G&&n.status===403&&(this.caps={view:!1,manage:!1}),this.loadError=n,e.quiet||this.host.onError(n),this.active&&this.paintRail()}}async loadAllocation(e){let t=new Map,s;for(let n=0;n<200;n+=1){if(e!==void 0&&e!==this.listSeq)return;let a=await this.host.api.channelAllocation(this.host.eventKey,{afterLabel:s,limit:1e3});for(let o of a.allocations)re(o.channelId)||t.set(o.label,o.channelId);if(this.assignmentVersion=a.assignmentVersion,!a.nextAfterLabel)break;s=a.nextAfterLabel}e!==void 0&&e!==this.listSeq||(this.allocation=t)}legendChannels(){return this.list?[{label:this.list.publicSale.name||oe,color:"#c9d0dc",free:this.list.publicSale.counts.free},...this.list.channels.filter(e=>e.archivedAt==null).map(e=>({label:e.name,color:this.markerFor(e.id).color,free:e.counts.free}))]:[]}channelById(e){if(re(e))return{id:ee,name:this.list?.publicSale?.name??oe,marker:"P",color:null};let t=this.list?.channels.find(s=>s.id===e);return t?{id:e,name:t.name,marker:t.marker,color:t.color}:null}nameOf(e){return this.channelById(e)?.name??null}channelNameForLabel(e){return this.list?this.nameOf(this.allocation.get(e)??ee):null}markerFor(e){let t=Math.max(0,this.list?.channels.findIndex(n=>n.id===e)??0),s=this.channelById(e);return Nt(s??{id:e,name:"?",marker:null,color:null},t)}assignableChannels(){return[{id:ee,name:this.list?.publicSale.name??oe},...(this.list?.channels??[]).filter(e=>e.state!=="archived").map(e=>({id:e.id,name:e.name}))]}currentPlan(){let e=this.host.selectionLabels(),t=qt({labels:e,targetChannelId:this.targetChannelId,allocation:this.allocation,statusOf:s=>this.host.statusOf(s),nameOf:s=>this.nameOf(s)});return{labels:e,buckets:t,target:this.targetChannelId}}ensureLayer(){if(this.layer)return;let e=document.createElement("div");e.className="slm-ch-layer",e.innerHTML=`
319
+ `});var Yi={};ps(Yi,{CHANNELS_CSS:()=>Ki,ChannelsMode:()=>vt,bucketRowsHtml:()=>ot});var Pr,Te,ss,Gi,Br,Or,Dr,zr,Fr,vt,Ds=Y(()=>{"use strict";Mt();Ve();$s();es();Bt();Ui();ts();Wi();ts();Pr=3e4,Te=5e3,ss=De({glyph:"route",hue:"#ea7a1e",title:"Channels",purpose:"Give seats to a sales channel, such as the box office or a partner, and decide how buyers reach them.",how:"channels"}),Gi=3e4,Br='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#8b5cf6" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 12.2V4.5a1 1 0 0 1 1-1h7.7l8.3 8.3a1.4 1.4 0 0 1 0 2l-6.3 6.3a1.4 1.4 0 0 1-2 0z"/><circle cx="8" cy="8" r="1.6"/></svg>',Or={hosted_link:["Buyer links","Only people with a link can buy these seats."],server:["Your website or app","Your integration lets buyers in."],internal:["Your own staff","Sold at the box office or by phone."],none:["Protected reserve","Nobody can buy them until you change this."]},Dr='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/></svg>',zr='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#ea7a1e" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>',Fr='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#d99a0b" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="M5 3.5l13 7-5.6 1.6L10 18z"/></svg>',vt=class{constructor(e,t){this.active=!1;this.list=null;this.allocation=new Map;this.assignmentVersion=0;this.loadError=null;this.loading=!0;this.view="inspect";this.mapIntent="pan";this.focusedSectionId=null;this.showArchived=!1;this.detailChannelId=null;this.assignOpen=!1;this.targetChannelId="";this.conflict=!1;this.applied=null;this.railNote=null;this.appliedTimer=null;this.dialog=null;this.detent="medium";this.links=[];this.linksChannelId=null;this.linksState="idle";this.listSeq=0;this.linksSeq=0;this.previewAudience=[];this.previewIncludePublic=!1;this.previewProjection=null;this.previewState="idle";this.pollTimer=null;this.layer=null;this.canvas=null;this.overlayVisible=!0;this.ctx=void 0;this.bannerEl=null;this.stagedEl=null;this.liveEl=null;this.scrimEl=null;this.lastFocus=null;this.stagedDoneTimer=null;this.lastSelectionCount=0;this.lastCounts=new Map;this.railHtml=null;this.allocationVersion=null;this.onVisibility=null;this.host=e,this.caps=t;let s={selectionLabels:()=>e.selectionLabels(),selectByLabels:n=>e.selectByLabels(n),clearSelection:()=>e.clearSelection(),selectSection:n=>e.selectSection(n),sections:()=>e.sections(),labelsInSection:n=>e.labelsInSection(n),rows:()=>e.rows(),categories:()=>e.categories(),labelsInCategory:n=>e.labelsInCategory(n),seats:()=>e.seats(),statusOf:n=>e.statusOf(n),sectionOfLabel:n=>e.sectionOfLabel(n),seatMeta:n=>{let a=this.allocation.get(n)??se;return`${this.nameOf(a)??le} \xB7 ${e.statusOf(n)??"free"}`},openDialog:(n,a)=>this.renderScrim(n,a),closeDialog:()=>this.closeDialog(),pickers:e.pickers,pickerFailed:e.pickerFailed,enhanceDialog:e.enhanceDialog,cap:Te};this.chooser=new tt(s)}enter(){this.active||(this.active=!0,this.mapIntent="pan",this.assignOpen=!1,this.focusedSectionId=null,this.chooser.reset(),this.railHtml=null,this.ensureLayer(),this.host.root.classList.add("ch-mode"),this.applySheetClasses(),this.host.sections().length>1&&this.host.showSectionOverview(),this.paintRail(),this.onInteractionChange?.(),this.refresh(),this.pollTimer=setInterval(()=>{typeof document<"u"&&document.hidden||this.refresh({quiet:!0})},Pr),typeof document<"u"&&typeof document.addEventListener=="function"&&(this.onVisibility=()=>{this.active&&!document.hidden&&this.refresh({quiet:!0})},document.addEventListener("visibilitychange",this.onVisibility)))}leave(){this.active&&(this.active=!1,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.onVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",this.onVisibility),this.onVisibility=null,this.railHtml=null,this.closeDialog({restoreFocus:!1}),this.links=[],this.linksChannelId=null,this.linksState="idle",this.layer?.classList.remove("on"),this.host.root.classList.remove("ch-mode","ch-preview","ch-sheet","detent-collapsed","detent-medium","detent-full"),this.host.setMapInert(!1),this.setBanner(!1),this.setStaged(null))}destroy(){this.leave(),this.stagedDoneTimer&&clearTimeout(this.stagedDoneTimer),this.layer?.remove(),this.layer=null,this.bannerEl?.remove(),this.bannerEl=null}setCapabilities(e){this.caps=e,this.active&&this.paintRail()}isActive(){return this.active}canSelect(){return this.caps.manage&&this.view==="inspect"}usesMarqueeSelection(){return this.canSelect()&&this.mapIntent==="assign"}handleSectionFocus(e){this.active&&(this.focusedSectionId=e,this.paintRail())}applyRealtimeHint(){this.active&&this.refresh({quiet:!0})}handleSelectionChange(){this.active&&(this.paintSelection(),this.paintStagedBar())}handleViewChange(){this.active&&this.paintOverlay()}handleLayoutChange(){this.active&&(this.applySheetClasses(),this.paintOverlay())}async refresh(e={}){if(!this.caps.view)return;let t=++this.listSeq,s=()=>t!==this.listSeq;try{let n=await this.host.api.channels(this.host.eventKey,{includeArchived:this.showArchived});if(s())return;if(this.list=n,this.assignmentVersion=n.assignmentVersion,this.loadError=null,this.targetChannelId||(this.targetChannelId=n.channels.find(a=>a.state==="active")?.id??se),this.allocationVersion!==n.assignmentVersion){if(await this.loadAllocation(t),s())return;this.allocationVersion=n.assignmentVersion}if(this.detailChannelId&&await this.loadLinks(this.detailChannelId),s())return;this.loading=!1,this.active&&(this.paintRail(),this.paintOverlay()),this.host.channelsChanged?.()}catch(n){if(s())return;this.loading=!1,n instanceof W&&n.status===403&&(this.caps={view:!1,manage:!1}),this.loadError=n,e.quiet||this.host.onError(n),this.active&&this.paintRail()}}async loadAllocation(e){let t=new Map,s;for(let n=0;n<200;n+=1){if(e!==void 0&&e!==this.listSeq)return;let a=await this.host.api.channelAllocation(this.host.eventKey,{afterLabel:s,limit:1e3});for(let o of a.allocations)ce(o.channelId)||t.set(o.label,o.channelId);if(this.assignmentVersion=a.assignmentVersion,!a.nextAfterLabel)break;s=a.nextAfterLabel}e!==void 0&&e!==this.listSeq||(this.allocation=t)}legendChannels(){return this.list?[{label:this.list.publicSale.name||le,color:"#c9d0dc",free:this.list.publicSale.counts.free},...this.list.channels.filter(e=>e.archivedAt==null).map(e=>({label:e.name,color:this.markerFor(e.id).color,free:e.counts.allocated?e.counts.free:-1}))]:[]}channelById(e){if(ce(e))return{id:se,name:this.list?.publicSale?.name??le,marker:"P",color:null};let t=this.list?.channels.find(s=>s.id===e);return t?{id:e,name:t.name,marker:t.marker,color:t.color}:null}nameOf(e){return this.channelById(e)?.name??null}channelNameForLabel(e){return this.list?this.nameOf(this.allocation.get(e)??se):null}plateHtml(e=""){let t=this.markerFor(e);return`<span class="slm-ch-mk" style="background:${P(t.color)}" aria-hidden="true">${P(t.letter)}</span>`}markerFor(e){let t=Math.max(0,this.list?.channels.findIndex(n=>n.id===e)??0),s=this.channelById(e);return Vt(s??{id:e,name:"?",marker:null,color:null},t)}assignableChannels(){return[{id:se,name:this.list?.publicSale.name??le},...(this.list?.channels??[]).filter(e=>e.state!=="archived").map(e=>({id:e.id,name:e.name}))]}currentPlan(){let e=this.host.selectionLabels(),t=Kt({labels:e,targetChannelId:this.targetChannelId,allocation:this.allocation,statusOf:s=>this.host.statusOf(s),nameOf:s=>this.nameOf(s)});return{labels:e,buckets:t,target:this.targetChannelId}}ensureLayer(){if(this.layer)return;let e=document.createElement("div");e.className="slm-ch-layer",e.innerHTML=`
291
320
  <canvas class="slm-ch-canvas" data-ch="canvas" aria-hidden="true"></canvas>
292
321
  <div class="slm-ch-banner" data-ch="banner" role="status"></div>
293
322
  <div class="slm-ch-staged" data-ch="staged" role="group" aria-label="Staged channel changes"></div>
294
- <div class="slm-ch-live" data-ch="live" role="status" aria-live="polite"></div>`,this.host.mapLayer.appendChild(e),this.layer=e,this.canvas=e.querySelector('[data-ch="canvas"]'),this.bannerEl=e.querySelector('[data-ch="banner"]'),this.bannerEl&&this.host.pillLane&&this.host.pillLane.appendChild(this.bannerEl),this.stagedEl=e.querySelector('[data-ch="staged"]'),this.liveEl=e.querySelector('[data-ch="live"]'),requestAnimationFrame(()=>e.classList.add("on"))}announce(e){this.liveEl&&(this.liveEl.textContent=e)}setOverlayVisible(e){if(this.overlayVisible===e)return;if(this.overlayVisible=e,e){this.active&&this.paintOverlay();return}let t=this.canvas;t&&(this.ctx??null)?.clearRect(0,0,t.width,t.height),this.layer?.querySelectorAll(".slm-ch-flag").forEach(s=>s.remove())}paintOverlay(){let e=this.canvas,t=this.layer;!e||!t||!this.overlayVisible||Mi({layer:t,canvas:e,resolveCtx:()=>{if(this.ctx===void 0)try{this.ctx=e.getContext("2d")}catch{this.ctx=null}return this.ctx},host:this.host,view:this.view,previewProjection:this.previewProjection,allocation:this.allocation,focusedSectionId:this.focusedSectionId,list:this.list,markerFor:s=>this.markerFor(s),onSectionTargetClick:s=>{this.focusedSectionId=s,this.host.focusSection(s),this.paintRail()}})}setStaged(e,t=""){let s=this.stagedEl;if(s){if(!e){s.classList.remove("on","done","shake"),s.innerHTML="";return}s.innerHTML=e,s.className=`slm-ch-staged on${t?` ${t}`:""}`}}paintStagedBar(){if(!this.active||this.view==="preview"||!this.caps.manage){this.setStaged(null);return}let{labels:e,buckets:t}=this.currentPlan();if(this.host.onStagedChange?.(tt(t)),!e.length){this.setStaged(null);return}let s=this.nameOf(this.targetChannelId)??oe,n=tt(t),a=e.length>Le,o=t.skippedHeld.count+t.skippedBooked.count,r=[`<b>${e.length.toLocaleString()}</b> selected`,`<b>+${n.toLocaleString()}</b> to ${I(s)}`];t.alreadyInTarget.count&&r.push(`<b>${t.alreadyInTarget.count.toLocaleString()}</b> already in`),o&&r.push(`<b>${o.toLocaleString()}</b> can't move now`),this.setStaged(`
323
+ <div class="slm-ch-live" data-ch="live" role="status" aria-live="polite"></div>`,this.host.mapLayer.appendChild(e),this.layer=e,this.canvas=e.querySelector('[data-ch="canvas"]'),this.bannerEl=e.querySelector('[data-ch="banner"]'),this.bannerEl&&this.host.pillLane&&this.host.pillLane.appendChild(this.bannerEl),this.stagedEl=e.querySelector('[data-ch="staged"]'),this.liveEl=e.querySelector('[data-ch="live"]'),requestAnimationFrame(()=>e.classList.add("on"))}announce(e){this.liveEl&&(this.liveEl.textContent=e)}setOverlayVisible(e){if(this.overlayVisible===e)return;if(this.overlayVisible=e,e){this.active&&this.paintOverlay();return}let t=this.canvas;t&&(this.ctx??null)?.clearRect(0,0,t.width,t.height),this.layer?.querySelectorAll(".slm-ch-flag").forEach(s=>s.remove())}paintOverlay(){let e=this.canvas,t=this.layer;!e||!t||!this.overlayVisible||Vi({layer:t,canvas:e,resolveCtx:()=>{if(this.ctx===void 0)try{this.ctx=e.getContext("2d")}catch{this.ctx=null}return this.ctx},host:this.host,view:this.view,previewProjection:this.previewProjection,allocation:this.allocation,focusedSectionId:this.focusedSectionId,list:this.list,markerFor:s=>this.markerFor(s),onSectionTargetClick:s=>{this.focusedSectionId=s,this.host.focusSection(s),this.paintRail()}})}setStaged(e,t=""){let s=this.stagedEl;if(s){if(!e){s.classList.remove("on","done","shake"),s.innerHTML="";return}s.innerHTML=e,s.className=`slm-ch-staged on${t?` ${t}`:""}`}}paintStagedBar(){if(!this.active||this.view==="preview"||!this.caps.manage){this.setStaged(null);return}let{labels:e,buckets:t}=this.currentPlan();if(this.host.onStagedChange?.(it(t)),!e.length){this.setStaged(null);return}let s=this.nameOf(this.targetChannelId)??le,n=it(t),a=e.length>Te,o=t.skippedHeld.count+t.skippedBooked.count,r=[`<b>${e.length.toLocaleString()}</b> selected`,`<b>+${n.toLocaleString()}</b> to ${P(s)}`];t.alreadyInTarget.count&&r.push(`<b>${t.alreadyInTarget.count.toLocaleString()}</b> already in`),o&&r.push(`<b>${o.toLocaleString()}</b> can't move now`),this.setStaged(`
295
324
  <span>${r.join(" \xB7 ")}</span>
296
325
  <span class="grow"></span>
297
326
  <button type="button" class="drop" data-ch-act="discard">Discard</button>
298
327
  <button type="button" class="go" data-ch-act="review"${a?" disabled":""}>
299
- ${a?`Maximum ${Le.toLocaleString()} seats`:"Review changes"}
300
- </button>`),this.stagedEl?.querySelectorAll("[data-ch-act]").forEach(l=>{l.addEventListener("click",()=>{l.dataset.chAct==="discard"?this.host.clearSelection():this.openDialog({kind:"review"})})})}setBanner(e,t="",s){let n=this.bannerEl;if(!n)return;if(this.host.root.classList.toggle("ch-preview",e),!e){n.classList.remove("on"),n.innerHTML="";return}let a=this.previewAudience.length===1?this.markerFor(this.previewAudience[0]):{color:"var(--slm-accent)",letter:""},o=s==null?"":` \xB7 ${s.toLocaleString()} ${s===1?"seat":"seats"} available now`;n.innerHTML=`<span class="dot" style="background:${I(a.color)}"></span>
301
- Previewing buyer access \xB7 ${I(t)}${o} \xB7 read-only
302
- <button type="button" data-ch-act="exit-preview">Exit preview</button>`,n.classList.add("on"),n.querySelector('[data-ch-act="exit-preview"]')?.addEventListener("click",()=>this.setView("inspect"))}setView(e){if(this.view=e,e==="inspect")this.previewProjection=null,this.previewState="idle",this.setBanner(!1);else{if(!this.previewAudience.length){let t=this.list?.channels.find(s=>s.state==="active");this.previewAudience=[t?t.id:ee]}this.loadPreview()}this.paintRail(),this.paintOverlay(),this.paintStagedBar(),this.onInteractionChange?.()}async loadPreview(){let e=[...this.previewAudience],t=e.map(s=>this.nameOf(s)??oe).join(" + ");this.setBanner(!0,t),this.previewProjection=null,this.previewState="loading",this.active&&this.paintRail();try{this.previewProjection=await this.host.api.channelPreview(this.host.eventKey,e,{includePublic:this.previewIncludePublic||e.some(re)}),this.previewState="ready";let s=this.previewProjection.available===!1?void 0:this.previewProjection.counts?.eligible??this.previewProjection.eligible?.length;this.setBanner(!0,t,s)}catch(s){let n=s instanceof G?s.status:0;this.previewState=n===404||n===405||n===501?"unsupported":"error",this.previewProjection=null,this.previewState==="error"&&this.host.onError(s)}this.active&&(this.paintRail(),this.paintOverlay())}setRailHtml(e){if(e===this.railHtml)return!1;let t=this.host.rail,s=t.scrollTop;return t.innerHTML=e,this.railHtml=e,s&&(t.scrollTop=s),!0}paintRail(){if(!this.active)return;let e=this.host.rail;if(!this.caps.view){this.setRailHtml(`${Zt}${X("info","Channels are not shared with your role"," Seeing how seats are shared out needs channel-management permission on this event.","lock")}`);return}if(this.loading&&!this.list){this.setRailHtml(`${Zt}${this.viewSegmentHtml()}
328
+ ${a?`Maximum ${Te.toLocaleString()} seats`:"Review changes"}
329
+ </button>`),this.stagedEl?.querySelectorAll("[data-ch-act]").forEach(l=>{l.addEventListener("click",()=>{l.dataset.chAct==="discard"?this.host.clearSelection():this.openDialog({kind:"review"})})})}setBanner(e,t="",s){let n=this.bannerEl;if(!n)return;if(this.host.root.classList.toggle("ch-preview",e),!e){n.classList.remove("on"),n.innerHTML="";return}let a=this.previewAudience.length===1?this.markerFor(this.previewAudience[0]):{color:"var(--slm-accent)",letter:""},o=s==null?"":` \xB7 ${s.toLocaleString()} ${s===1?"seat":"seats"} available now`;n.innerHTML=`<span class="dot" style="background:${P(a.color)}"></span>
330
+ Previewing buyer access \xB7 ${P(t)}${o} \xB7 read-only
331
+ <button type="button" data-ch-act="exit-preview">Exit preview</button>`,n.classList.add("on"),n.querySelector('[data-ch-act="exit-preview"]')?.addEventListener("click",()=>this.setView("inspect"))}setView(e){if(this.view=e,e==="inspect")this.previewProjection=null,this.previewState="idle",this.setBanner(!1);else{if(!this.previewAudience.length){let t=this.list?.channels.find(s=>s.state==="active");this.previewAudience=[t?t.id:se]}this.loadPreview()}this.paintRail(),this.paintOverlay(),this.paintStagedBar(),this.onInteractionChange?.()}async loadPreview(){let e=[...this.previewAudience],t=e.map(s=>this.nameOf(s)??le).join(" + ");this.setBanner(!0,t),this.previewProjection=null,this.previewState="loading",this.active&&this.paintRail();try{this.previewProjection=await this.host.api.channelPreview(this.host.eventKey,e,{includePublic:this.previewIncludePublic||e.some(ce)}),this.previewState="ready";let s=this.previewProjection.available===!1?void 0:this.previewProjection.counts?.eligible??this.previewProjection.eligible?.length;this.setBanner(!0,t,s)}catch(s){let n=s instanceof W?s.status:0;this.previewState=n===404||n===405||n===501?"unsupported":"error",this.previewProjection=null,this.previewState==="error"&&this.host.onError(s)}this.active&&(this.paintRail(),this.paintOverlay())}setRailHtml(e){if(e===this.railHtml)return!1;let t=this.host.rail,s=t.scrollTop;return t.innerHTML=e,this.railHtml=e,s&&(t.scrollTop=s),!0}paintRail(){if(!this.active)return;let e=this.host.rail;if(!this.caps.view){this.setRailHtml(`${ss}${Q("info","Channels are not shared with your role"," Seeing how seats are shared out needs channel-management permission on this event.","lock")}`);return}if(this.loading&&!this.list){this.setRailHtml(`${ss}${this.viewSegmentHtml()}
303
332
  <div class="slm-ch-busy" role="status" data-ch-state="list-loading">Loading channels and who holds which seats\u2026</div>
304
- <div class="slm-ch-skel"></div><div class="slm-ch-skel"></div><div class="slm-ch-skel"></div>`);return}if(!this.list&&this.loadError){this.setRailHtml(`${Zt}${this.viewSegmentHtml()}
305
- <div data-ch-state="list-error" role="alert">${X("error","Couldn't load sales channels"," This event may well have channels; we could not read them. Everything else on this event still works.").replace(' role="alert"',"")}</div>
306
- <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="retry">Try again</button>`)&&e.querySelector('[data-ch-act="retry"]')?.addEventListener("click",()=>{this.refresh()});return}let t=this.host.selectionLabels(),s=this.host.isCompact()?'<div class="slm-ch-grab"><span class="slm-ch-grabbar"></span></div>':"",n=this.viewSegmentHtml(),a=this.view==="preview"?this.previewRailHtml():this.detailChannelId?this.detailRailHtml(this.detailChannelId):t.length&&this.caps.manage?this.selectionRailHtml(t):this.listRailHtml();this.setRailHtml(`${s}${Zt}${n}${a}`)&&this.wireRail(),this.paintStagedBar()}viewSegmentHtml(){let e=this.view==="inspect"?" on":"",t=this.view==="preview"?" on":"";return`<div class="slm-ch-viewseg" role="group" aria-label="Channels view">
333
+ <div class="slm-ch-skel"></div><div class="slm-ch-skel"></div><div class="slm-ch-skel"></div>`);return}if(!this.list&&this.loadError){this.setRailHtml(`${ss}${this.viewSegmentHtml()}
334
+ <div data-ch-state="list-error" role="alert">${Q("error","Couldn't load sales channels"," This event may well have channels; we could not read them. Everything else on this event still works.").replace(' role="alert"',"")}</div>
335
+ <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="retry">Try again</button>`)&&e.querySelector('[data-ch-act="retry"]')?.addEventListener("click",()=>{this.refresh()});return}let t=this.host.selectionLabels(),s=this.host.isCompact()?'<div class="slm-ch-grab"><span class="slm-ch-grabbar"></span></div>':"",n=this.viewSegmentHtml(),a=this.view==="preview"?this.previewRailHtml():this.detailChannelId?this.detailRailHtml(this.detailChannelId):t.length&&this.caps.manage?this.selectionRailHtml(t):this.listRailHtml();this.setRailHtml(`${s}${ss}${n}${a}`)&&this.wireRail(),this.paintStagedBar()}viewSegmentHtml(){let e=this.view==="inspect"?" on":"",t=this.view==="preview"?" on":"";return`<div class="slm-ch-viewseg" role="group" aria-label="Channels view">
307
336
  <button type="button" class="${e.trim()}" data-ch-view="inspect"
308
337
  aria-pressed="${this.view==="inspect"}">Allocation</button>
309
338
  <button type="button" class="${t.trim()}" data-ch-view="preview"
310
339
  aria-pressed="${this.view==="preview"}">Buyer preview</button>
311
- </div>${this.mapNavigationHtml()}`}mapNavigationHtml(){if(this.host.sections().length<2)return"";let e=this.focusedSectionId?this.host.sections().find(t=>t.id===this.focusedSectionId)?.label??"section":null;return e?`<div class="slm-ch-mapnav-head"><span>${I(e)}</span>
312
- <button type="button" data-ch-act="sections">All sections</button></div>`:""}countsHtml(e,t){let s=(n,a,o,r="")=>{let l=this.lastCounts.get(`${t}:${n}`),c=l!=null&&l!==a?" bump":"";return this.lastCounts.set(`${t}:${n}`,a),`<span class="${r}"><b class="${c.trim()}">${a.toLocaleString()}</b> ${o}</span>`};return`<span class="slm-ch-counts">${[s("allocated",e.allocated,"allocated"),s("free",e.free,"free","free"),s("booked",e.booked,"sold"),e.held?s("held",e.held,"in a cart"):""].filter(Boolean).join('<i aria-hidden="true">\xB7</i>')}</span>`}channelRowHtml(e,t={}){let s=this.markerFor(e.id),n=t.builtin?"builtin":e.state,a=e.state==="paused"||e.state==="archived"?" dim":"",o=!t.builtin&&this.caps.manage&&this.detailChannelId!==e.id,r=`slm-ch-row${t.builtin?" public":""}${e.state==="archived"?" archived":""}${this.detailChannelId===e.id||this.applied&&this.applied.result.targetChannelId===e.id?" on":""}${o?" open":""}`,l=!t.builtin&&this.caps.manage?`<button type="button" class="slm-ch-more" data-ch-menu="${I(e.id)}"
313
- aria-label="More actions for ${I(e.name)}" aria-haspopup="dialog">\u22EF</button>`:"",c=o?` role="button" tabindex="0" data-ch-open="${I(e.id)}"
314
- aria-label="Open ${I(e.name)}"`:"";return`<div class="${r}"${c}>
340
+ </div>${this.mapNavigationHtml()}`}mapNavigationHtml(){if(this.host.sections().length<2)return"";let e=this.focusedSectionId?this.host.sections().find(t=>t.id===this.focusedSectionId)?.label??"section":null;return e?`<div class="slm-ch-mapnav-head"><span>${P(e)}</span>
341
+ <button type="button" data-ch-act="sections">All sections</button></div>`:""}countsHtml(e,t){let s=(n,a,o,r="")=>{let l=this.lastCounts.get(`${t}:${n}`),c=l!=null&&l!==a?" bump":"";return this.lastCounts.set(`${t}:${n}`,a),`<span class="${r}"><b class="${c.trim()}">${a.toLocaleString()}</b> ${o}</span>`};return`<span class="slm-ch-counts">${[s("allocated",e.allocated,"allocated"),s("free",e.free,"free","free"),s("booked",e.booked,"sold"),e.held?s("held",e.held,"in a cart"):""].filter(Boolean).join('<i aria-hidden="true">\xB7</i>')}</span>`}channelRowHtml(e,t={}){let s=this.markerFor(e.id),n=t.builtin?"builtin":e.state,a=e.state==="paused"||e.state==="archived"?" dim":"",o=!t.builtin&&this.caps.manage&&this.detailChannelId!==e.id,r=`slm-ch-row${t.builtin?" public":""}${e.state==="archived"?" archived":""}${this.detailChannelId===e.id||this.applied&&this.applied.result.targetChannelId===e.id?" on":""}${o?" open":""}`,l=!t.builtin&&this.caps.manage?`<button type="button" class="slm-ch-more" data-ch-menu="${P(e.id)}"
342
+ aria-label="More actions for ${P(e.name)}" aria-haspopup="dialog">\u22EF</button>`:"",c=o?` role="button" tabindex="0" data-ch-open="${P(e.id)}"
343
+ aria-label="Open ${P(e.name)}"`:"";return`<div class="${r}"${c}>
315
344
  <span class="slm-ch-head">
316
- <span class="slm-ch-mk${a}" style="background:${I(s.color)}" aria-hidden="true">${I(s.letter)}</span>
317
- <span class="slm-ch-name">${I(e.name)}</span>
318
- <span class="slm-ch-badge ${n}">${I(Gt(t.builtin?"builtin":e.state))}</span>
345
+ <span class="slm-ch-mk${a}" style="background:${P(s.color)}" aria-hidden="true">${P(s.letter)}</span>
346
+ <span class="slm-ch-name">${P(e.name)}</span>
347
+ <span class="slm-ch-badge ${n}">${P(Qt(t.builtin?"builtin":e.state))}</span>
319
348
  ${l}
320
349
  </span>
321
350
  ${this.countsHtml(e.counts,e.id||"public")}
322
- <span class="slm-ch-access">${t.builtin?"Everyone on your event page":I(Vt(e.access))}</span>
323
- </div>`}listRailHtml(){let e=this.list,t=e.channels.filter(l=>l.state==="archived").length,s=e.channels.filter(l=>this.showArchived||l.state!=="archived"),n=[this.channelRowHtml(e.publicSale,{builtin:!0}),...s.map((l,c)=>this.channelRowHtml(l,{index:c}))].join(""),a=s.length?"":`<div class="slm-ch-empty" data-ch-state="list-empty">${J("route","#ea7a1e",40)}
351
+ <span class="slm-ch-access">${t.builtin?"Everyone on your event page":P(Yt(e.access))}</span>
352
+ </div>`}listRailHtml(){let e=this.list,t=e.channels.filter(l=>l.state==="archived").length,s=e.channels.filter(l=>this.showArchived||l.state!=="archived"),n=[this.channelRowHtml(e.publicSale,{builtin:!0}),...s.map((l,c)=>this.channelRowHtml(l,{index:c}))].join(""),a=s.length?"":`<div class="slm-ch-empty" data-ch-state="list-empty">${Z("route","#ea7a1e",40)}
324
353
  <b>Every seat is on public sale</b><p>${t&&!this.showArchived?`No open channels. ${t.toLocaleString()} archived channel${t===1?" is":"s are"} hidden below.`:"Make a channel to keep seats for your box office, a partner or a members sale."}</p>
325
- ${this.caps.manage?'<button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="create">New channel</button>':""}</div>`,o=this.caps.manage?`<button type="button" class="slm-btn ghost slm-ch-new" data-ch-act="create">${ur}New channel</button>`:"";return`${this.caps.manage?"":X("info","You can see, not change"," You can see how seats are shared out. Changing it needs channel-management permission.","lock")}${this.appliedHtml()}
354
+ ${this.caps.manage?'<button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="create">New channel</button>':""}</div>`,o=this.caps.manage?`<button type="button" class="slm-btn ghost slm-ch-new" data-ch-act="create">${zr}New channel</button>`:"";return`${this.caps.manage?"":Q("info","You can see, not change",' You can see how seats are shared out. Changing it needs the "Manage channels" permission.',"lock")}${this.appliedHtml()}
326
355
  <div class="slm-ch-listhead"><p class="slm-eyebrow">Sales channels</p>${o}</div>
327
356
  <div class="slm-ch-list">${n}</div>
328
357
  ${a}
@@ -331,19 +360,19 @@
331
360
  <button type="button" class="slm-linkbtn" data-ch-act="toggle-archived" aria-pressed="${this.showArchived}"
332
361
  style="text-align:left">${this.showArchived?"Hide":"Show"} archived${t?` (${t})`:""}</button>
333
362
  </p>${this.undoBarHtml()}`}assignEntryHtml(){return this.caps.manage?this.assignOpen?`<div style="margin-top:8px">${this.assignmentToolsHtml({collapsible:!0})}</div>`:`
334
- <button type="button" class="slm-btn ghost slm-ch-give" data-ch-act="assign-open" aria-expanded="false">${mr}Give seats to a channel</button>`:""}assignmentToolsHtml(e={}){let t=this.assignableChannels().map(a=>`<option value="${I(a.id)}"${a.id===this.targetChannelId?" selected":""}>${I(a.name)}</option>`).join(""),s=this.mapIntent==="assign"?"slm-btn":"slm-btn ghost";return`
363
+ <button type="button" class="slm-btn ghost slm-ch-give" data-ch-act="assign-open" aria-expanded="false">${Fr}Give seats to a channel</button>`:""}assignmentToolsHtml(e={}){let t=this.assignableChannels(),s=t.map(o=>`<option value="${P(o.id)}"${o.id===this.targetChannelId?" selected":""}>${P(o.name)}</option>`).join(""),n=this.mapIntent==="assign"?"slm-btn":"slm-btn ghost",a=e.collapsible?`<button type="button" class="slm-linkbtn" data-ch-act="assign-close"
364
+ aria-expanded="true" style="float:right;font-weight:800">Done</button>`:"";return`
335
365
  <div class="slm-ch-assigncard">
336
- <p class="slm-eyebrow">${e.collapsible?`<button type="button" class="slm-linkbtn" data-ch-act="assign-close"
337
- aria-expanded="true" style="float:right;font-weight:800">Done</button>`:""}Give seats to a channel</p>
366
+ ${a?`<p class="slm-eyebrow">${a}Give seats to a channel</p>`:""}
338
367
  <div class="slm-field slm-ch-giveto">
339
368
  <label for="slm-ch-target">Give seats to</label>
340
- <select class="slm-select" id="slm-ch-target" data-ch-target>${t}</select>
369
+ <span class="slm-ch-pick">${this.plateHtml((t.find(o=>o.id===this.targetChannelId)??t[0])?.id)}<select class="slm-select" id="slm-ch-target" data-ch-target>${s}</select></span>
341
370
  </div>
342
- ${this.chooser.chipsHtml({intents:`<button type="button" class="${s}" data-ch-act="drag-select">Drag box</button>`})}
371
+ ${this.chooser.chipsHtml({intents:`<button type="button" class="${n}" data-ch-act="drag-select">Drag box</button>`})}
343
372
  <p class="slm-note">Pick seats on the map, then review. Nothing moves until
344
373
  you apply; seats in a cart or sold never move.</p>
345
- </div>`}selectionRailHtml(e){let t=Ft(e,this.allocation,this.list),s=this.targetChannelId,n=s&&this.nameOf(s)||"this channel",a=this.conflict?`<div role="alert">${X("warn","Someone changed these seats while you were choosing",` Nothing was applied. Your ${e.length.toLocaleString()}-seat selection is kept.`).replace(' role="status"',"")}</div>
346
- <button type="button" class="slm-btn ghost slm-ch-small slm-ch-wide" data-ch-act="refresh-review">Refresh and review again</button>`:"",o=e.length!==this.lastSelectionCount?" bump":"";this.lastSelectionCount=e.length;let r=e.length>Le,l=0,c=t.map(f=>{let u=f.count.toLocaleString();return f.channelId===s?(l+=f.count,`<div class="same">= ${u} already in ${I(n)}</div>`):re(f.channelId)?`<div class="add">+ ${u} from ${I(f.name)}</div>`:`<div class="move">\u21C4 ${u} from ${I(f.name)}</div>`}).join(""),d=e.length-l,b=r?`Choose at most ${Le.toLocaleString()} seats`:d?`Review ${d.toLocaleString()} ${d===1?"change":"changes"}`:"Review the selection";return`
374
+ </div>`}selectionRailHtml(e){let t=Ut(e,this.allocation,this.list),s=this.targetChannelId,n=s&&this.nameOf(s)||"this channel",a=this.conflict?`<div role="alert">${Q("warn","Someone changed these seats while you were choosing",` Nothing was applied. Your ${e.length.toLocaleString()}-seat selection is kept.`).replace(' role="status"',"")}</div>
375
+ <button type="button" class="slm-btn ghost slm-ch-small slm-ch-wide" data-ch-act="refresh-review">Refresh and review again</button>`:"",o=e.length!==this.lastSelectionCount?" bump":"";this.lastSelectionCount=e.length;let r=e.length>Te,l=0,c=t.map(b=>{let m=b.count.toLocaleString();return b.channelId===s?(l+=b.count,`<div class="same">= ${m} already in ${P(n)}</div>`):ce(b.channelId)?`<div class="add">+ ${m} from ${P(b.name)}</div>`:`<div class="move">\u21C4 ${m} from ${P(b.name)}</div>`}).join(""),d=e.length-l,g=r?`Choose at most ${Te.toLocaleString()} seats`:d?`Review ${d.toLocaleString()} ${d===1?"change":"changes"}`:"Review the selection";return`
347
376
  ${a}
348
377
  ${this.assignmentToolsHtml()}
349
378
  <div class="slm-ch-staged2" aria-live="polite" aria-label="Selection sources">
@@ -351,22 +380,22 @@
351
380
  <button type="button" class="slm-linkbtn" data-ch-act="discard">Clear</button></div>
352
381
  ${c}
353
382
  </div>
354
- ${r?X("warn","Too many seats for one change",` One change can move up to ${Le.toLocaleString()} seats. Split it, for example by row groups.`).replace(' role="status"',' role="alert"'):""}
355
- <div class="slm-railfoot"><button type="button" class="slm-btn" data-ch-act="review"${r?" disabled":""}>${b}</button>
356
- <p class="slm-note">Nothing moves until you apply.</p></div>`}detailRailHtml(e){let t=`<p class="slm-eyebrow">
383
+ ${r?Q("warn","Too many seats for one change",` One change can move up to ${Te.toLocaleString()} seats. Split it, for example by row groups.`).replace(' role="status"',' role="alert"'):""}
384
+ <div class="slm-railfoot"><button type="button" class="slm-btn" data-ch-act="review"${r?" disabled":""}>${g}</button>
385
+ <p class="slm-note">Nothing moves until you apply.</p><button type="button" class="slm-linkbtn" data-ch-act="discard">Clear selection</button></div>`}detailRailHtml(e){let t=`<p class="slm-eyebrow">
357
386
  <button type="button" class="slm-linkbtn" data-ch-act="back" style="text-align:left">\u2039 All channels</button>
358
387
  </p>`,s=this.list?.channels.find(l=>l.id===e);if(!s)return`${t}
359
388
  <div class="slm-ch-alert warn" role="status" data-ch-state="detail-gone"><span>\u2139</span>
360
389
  <span><b>This channel is no longer on this event.</b> It was archived or removed while you had it open.
361
- ${this.showArchived?"":"Archived channels are hidden \u2014 use \u201CShow archived\u201D on the list to see it."}</span></div>`;let n=this.caps.manage?this.distributeHtml(s):"",a=s.priceOverrides?.length??0,o=this.caps.manage&&this.host.api.updateChannelPricing?`<button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="pricing" title="${a?`${a.toLocaleString()} custom price${a===1?"":"s"} for this channel`:"Uses the event prices"}">${cr}Prices${a?` \xB7 ${a.toLocaleString()} custom`:""}</button>`:"",r=this.caps.manage?`<div class="slm-ch-acts">${o}
390
+ ${this.showArchived?"":"Archived channels are hidden \u2014 use \u201CShow archived\u201D on the list to see it."}</span></div>`;let n=this.caps.manage?this.distributeHtml(s):"",a=s.priceOverrides?.length??0,o=this.caps.manage&&this.host.api.updateChannelPricing?`<button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="pricing" title="${a?`${a.toLocaleString()} custom price${a===1?"":"s"} for this channel`:"Uses the event prices"}">${Br}Prices${a?` \xB7 ${a.toLocaleString()} custom`:""}</button>`:"",r=this.caps.manage?`<div class="slm-ch-acts">${o}
362
391
  <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="rename">Rename</button>
363
392
  <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="pause">${s.state==="paused"?"Resume":"Pause"}</button>
364
393
  <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="archive">Archive\u2026</button></div>`:"";return`
365
394
  ${t}
366
395
  <div class="slm-ch-list">${this.channelRowHtml(s)}</div>
367
396
  ${n}
368
- ${r}`}distributeHtml(e){let t=e.access?.intent??"none",s=this.linksState!=="unsupported",n=(a,o)=>{let r=a===t,[l,c]=dr[a];return`<div class="slm-ch-dist${r?" on":""}" data-ch-route="${I(a)}">
369
- <span class="top"><b>${l}</b>${r?`<span class="cur">Current</span>${a==="server"?'<button type="button" class="slm-linkbtn" data-ch-act="embed-code">Get embed code</button>':""}`:`<button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="${I(o)}">Switch</button>`}</span>
397
+ ${r}`}distributeHtml(e){let t=e.access?.intent??"none",s=this.linksState!=="unsupported",n=(a,o)=>{let r=a===t,[l,c]=Or[a];return`<div class="slm-ch-dist${r?" on":""}" data-ch-route="${P(a)}">
398
+ <span class="top"><b>${l}</b>${r?`<span class="cur">Current</span>${a==="server"?'<button type="button" class="slm-linkbtn" data-ch-act="embed-code">Get embed code</button>':""}`:`<button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="${P(o)}">Switch</button>`}</span>
370
399
  <span class="why">${c}</span>
371
400
  </div>`};return`
372
401
  <p class="slm-eyebrow" style="margin-top:14px">How buyers reach it</p>
@@ -375,42 +404,42 @@
375
404
  ${n("internal","route-internal")}
376
405
  ${n("none","route-none")}
377
406
  ${this.hostedLinksHtml(t==="hosted_link")}
378
- ${t==="server"?Si:""}`}async loadLinks(e){if(!this.caps.view)return;let t=++this.linksSeq,s=()=>t!==this.linksSeq||this.linksChannelId!==e;this.linksChannelId!==e&&(this.links=[],this.linksChannelId=e,this.linksState="loading");try{let n=await this.host.api.accessLinks(this.host.eventKey,e);if(s())return;this.links=n.links??[],this.linksState="ready"}catch(n){if(s())return;let a=n instanceof G?n.status:0;this.links=[],this.linksState=a===404||a===405||a===501?"unsupported":"error",this.linksState==="error"&&this.host.onError(n)}}hostedLinksHtml(e=!1){let t='<p class="slm-eyebrow" style="margin-top:14px">Buyer links</p>';return this.linksState==="unsupported"?`${t}<div data-ch-state="links-unsupported">${X("info","Buyer links need a newer server"," Everything else on this channel works normally.")}</div>`:this.linksState==="error"?`${t}<div data-ch-state="links-error" role="alert">${X("error","Couldn't load this channel's links"," This is a failed read, not an empty list; any live link is still working.").replace(' role="alert"',"")}</div>
407
+ ${t==="server"?Fi:""}`}async loadLinks(e){if(!this.caps.view)return;let t=++this.linksSeq,s=()=>t!==this.linksSeq||this.linksChannelId!==e;this.linksChannelId!==e&&(this.links=[],this.linksChannelId=e,this.linksState="loading");try{let n=await this.host.api.accessLinks(this.host.eventKey,e);if(s())return;this.links=n.links??[],this.linksState="ready"}catch(n){if(s())return;let a=n instanceof W?n.status:0;this.links=[],this.linksState=a===404||a===405||a===501?"unsupported":"error",this.linksState==="error"&&this.host.onError(n)}}hostedLinksHtml(e=!1){let t='<p class="slm-eyebrow" style="margin-top:14px">Buyer links</p>';return this.linksState==="unsupported"?`${t}<div data-ch-state="links-unsupported">${Q("info","Buyer links need a newer server"," Everything else on this channel works normally.")}</div>`:this.linksState==="error"?`${t}<div data-ch-state="links-error" role="alert">${Q("error","Couldn't load this channel's links"," This is a failed read, not an empty list; any live link is still working.").replace(' role="alert"',"")}</div>
379
408
  <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="link-reload">Try again</button>`:this.linksState==="idle"||this.linksState==="loading"&&!this.links.length?`${t}<div class="slm-ch-busy" role="status" data-ch-state="links-loading">Loading buyer links\u2026</div>`:this.links.length?`${t}
380
409
  ${this.links.map((s,n)=>this.linkCardHtml(s,n===0&&e)).join("")}
381
410
  <p class="slm-note">A link is shown once, when you make it. SeatLayer keeps only a fingerprint, so a lost link can be replaced but not shown again.</p>`:e&&this.caps.manage?`${t}<p class="slm-note">No links yet. Make one and send it to the buyers who should get these seats.</p>
382
- <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="link-create">New link</button>`:""}linkCardHtml(e,t=!1){let s=Kt(e),n=this.caps.manage&&Wt(e),a=this.caps.manage&&(n||t)?`<div class="slm-ch-acts">${t?'<button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="link-create">New link</button>':""}${n?`<button type="button" class="slm-btn ghost slm-ch-small" data-ch-rotate="${I(e.id)}">Rotate</button>
383
- <button type="button" class="slm-btn ghost slm-ch-small" data-ch-revoke="${I(e.id)}">Revoke</button>`:""}</div>`:"";return`<div class="slm-ch-link">
411
+ <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="link-create">New link</button>`:""}linkCardHtml(e,t=!1){let s=Zt(e),n=this.caps.manage&&Jt(e),a=this.caps.manage&&(n||t)?`<div class="slm-ch-acts">${t?'<button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="link-create">New link</button>':""}${n?`<button type="button" class="slm-btn ghost slm-ch-small" data-ch-rotate="${P(e.id)}">Rotate</button>
412
+ <button type="button" class="slm-btn ghost slm-ch-small" data-ch-revoke="${P(e.id)}">Revoke</button>`:""}</div>`:"";return`<div class="slm-ch-link">
384
413
  <span class="lk-head">
385
- <span class="lk-name">${I(e.label||"Buyer link")}</span>
386
- <span class="slm-ch-badge ${s.kind}">${I(s.text)}</span>
414
+ <span class="lk-name">${P(e.label||"Buyer link")}</span>
415
+ <span class="slm-ch-badge ${s.kind}">${P(s.text)}</span>
387
416
  </span>
388
- <span class="lk-facts">${I(yi(e))}</span>
417
+ <span class="lk-facts">${P(Bi(e))}</span>
389
418
  ${a}
390
- </div>`}previewRailHtml(){let e=[{id:ee,name:this.list?.publicSale.name??oe},...(this.list?.channels??[]).filter(u=>u.state!=="archived").map(u=>({id:u.id,name:u.name}))],t=this.previewAudience[0]??ee,s=e.map(u=>`<option value="${I(u.id)}"${u.id===t?" selected":""}>${I(u.name)}</option>`).join(""),n=re(t)?"a buyer on your event page":`a ${this.nameOf(t)??"channel"} buyer`,a=this.previewState==="unsupported"?`<div data-ch-state="preview-unsupported">${X("info","Preview needs a newer server"," Giving seats to channels works normally; the preview appears once this event's API is updated.")}</div>`:"",o=this.previewState==="loading"?`<div class="slm-ch-busy" role="status" data-ch-state="preview-loading">Asking the server what ${I(n)} sees\u2026</div>`:"",r=this.previewState==="error"?`<div data-ch-state="preview-error" role="alert">${X("error","Couldn't load the buyer preview"," Nothing is wrong with these seats; only the preview failed.").replace(' role="alert"',"")}</div>
391
- <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="preview-retry">Try again</button>`:"",l=this.previewProjection?.unavailable??[],c=this.previewProjection?.available===!1?X("warn",l.length===1?`${this.nameOf(l[0].channelId)??"This channel"} is ${l[0].state}`:"This private sale is not available",` A buyer arriving with ${l.length===1?"its access":"this access"} sees this message, not these seats.`):"",d=this.previewProjection?.counts?.eligible??this.previewProjection?.eligible?.length,b=d!=null&&this.previewProjection?.available!==!1?X("ok",`${d.toLocaleString()} ${d===1?"seat is":"seats are"} available to them now`,` Exactly what ${n} sees. Read-only: nothing is held.${this.previewProjection?.includePublic===!1?" Public sale seats are not part of this access.":""}`,"eye"):"",f=re(t)?"":`
419
+ </div>`}previewRailHtml(){let e=[{id:se,name:this.list?.publicSale.name??le},...(this.list?.channels??[]).filter(p=>p.state!=="archived").map(p=>({id:p.id,name:p.name}))],t=this.previewAudience[0]??se,s=e.map(p=>`<option value="${P(p.id)}"${p.id===t?" selected":""}>${P(p.name)}</option>`).join(""),n=ce(t)?"a buyer on your event page":`a ${this.nameOf(t)??"channel"} buyer`,a=this.previewState==="unsupported"?`<div data-ch-state="preview-unsupported">${Q("info","Preview needs a newer server"," Giving seats to channels works normally; the preview appears once this event's API is updated.")}</div>`:"",o=this.previewState==="loading"?`<div class="slm-ch-busy" role="status" data-ch-state="preview-loading">Asking the server what ${P(n)} sees\u2026</div>`:"",r=this.previewState==="error"?`<div data-ch-state="preview-error" role="alert">${Q("error","Couldn't load the buyer preview"," Nothing is wrong with these seats; only the preview failed.").replace(' role="alert"',"")}</div>
420
+ <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="preview-retry">Try again</button>`:"",l=this.previewProjection?.unavailable??[],c=l.length===1&&this.list?.channels.find(p=>p.id===l[0].channelId&&p.access?.intent==="hosted_link"),d=this.previewProjection?.available===!1?Q("warn",l.length===1?`${this.nameOf(l[0].channelId)??"This channel"} is ${l[0].state}`:"This private sale is not available",` A buyer arriving with ${c?`a ${c.name} link`:l.length===1?"its access":"this access"} sees this message, not these seats.`):"",g=this.previewProjection?.counts?.eligible??this.previewProjection?.eligible?.length,b=g!=null&&this.previewProjection?.available!==!1?Q("ok",`${g.toLocaleString()} ${g===1?"seat is":"seats are"} available to them now`,` Exactly what ${n} sees. Read-only: nothing is held.${this.previewProjection?.includePublic===!1?" Public sale seats are not part of this access.":""}`,"eye"):"",m=ce(t)?"":`
392
421
  <label class="slm-ch-check"><input type="checkbox" data-ch-includepublic ${this.previewIncludePublic?"checked":""} />
393
422
  Also include Public sale seats</label>`;return`
394
423
  <div class="slm-field slm-ch-seeas">
395
424
  <label for="slm-ch-audience">See it as</label>
396
425
  <select class="slm-select" id="slm-ch-audience" data-ch-audience>${s}</select>
397
426
  </div>
398
- ${f}
399
- ${o}${r}${a}${c}${b}`}paintSelection(){this.caps.manage&&this.host.selectionLabels().length&&(this.assignOpen=!0),this.view==="inspect"&&!this.detailChannelId&&this.paintRail()}wireRail(){let e=this.host.rail;e.querySelectorAll("[data-ch-view]").forEach(o=>{o.addEventListener("click",()=>this.setView(o.dataset.chView))}),e.querySelectorAll("[data-ch-map]").forEach(o=>{o.addEventListener("click",()=>{this.mapIntent=o.dataset.chMap==="assign"?"assign":"pan",this.mapIntent==="assign"&&(this.assignOpen=!0),this.paintRail(),this.onInteractionChange?.()})}),e.querySelectorAll("[data-ch-open]").forEach(o=>{let r=()=>this.openChannel(o.dataset.chOpen);o.addEventListener("click",r),o.addEventListener("keydown",l=>{l.key!=="Enter"&&l.key!==" "&&l.key!=="Spacebar"||(l.preventDefault(),r())})}),e.querySelectorAll("[data-ch-menu]").forEach(o=>{o.addEventListener("click",r=>{r.stopPropagation(),this.openDialog({kind:"menu",channelId:o.dataset.chMenu})}),o.addEventListener("keydown",r=>{r.stopPropagation()})}),e.querySelectorAll("[data-ch-rotate]").forEach(o=>{o.addEventListener("click",()=>this.openDialog({kind:"linkRotate",channelId:this.detailChannelId,linkId:o.dataset.chRotate}))}),e.querySelectorAll("[data-ch-revoke]").forEach(o=>{o.addEventListener("click",()=>this.openDialog({kind:"linkRevoke",channelId:this.detailChannelId,linkId:o.dataset.chRevoke}))});let t=e.querySelector("[data-ch-target]");t?.addEventListener("change",()=>{this.targetChannelId=t.value,this.conflict=!1,this.paintRail()});let s=e.querySelector("[data-ch-audience]");s?.addEventListener("change",()=>{this.previewAudience=[s.value],this.loadPreview()});let n=e.querySelector("[data-ch-includepublic]");n?.addEventListener("change",()=>{this.previewIncludePublic=n.checked,this.loadPreview()}),e.querySelector(".slm-ch-grab")?.addEventListener("click",()=>this.cycleDetent()),e.querySelectorAll("[data-ch-act]").forEach(o=>{o.addEventListener("click",()=>this.railAction(o.dataset.chAct))}),this.chooser.wireFind(e)}openChannel(e){this.detailChannelId=e,this.paintRail(),this.loadLinks(e).then(()=>this.paintRail())}railAction(e){switch(e){case"sections":this.focusedSectionId=null,this.host.showSectionOverview(),this.paintRail();break;case"create":this.openDialog({kind:"create"});break;case"review":this.openDialog({kind:"review"});break;case"rename":this.openDialog({kind:"rename",channelId:this.detailChannelId});break;case"pricing":this.openDialog({kind:"pricing",channelId:this.detailChannelId});break;case"archive":this.openDialog({kind:"archive",channelId:this.detailChannelId});break;case"seatlist":this.openDialog({kind:"seatlist"});break;case"pause":this.togglePause();break;case"discard":this.host.clearSelection();break;case"applied-details":this.applied&&this.openDialog({kind:"review",applied:this.applied.result});break;case"undo-applied":this.undoApplied();break;case"back":this.detailChannelId=null,this.linksChannelId=null,this.links=[],this.linksState="idle",this.paintRail();break;case"link-create":this.openDialog({kind:"linkCreate",channelId:this.detailChannelId});break;case"embed-code":this.chooseWebsiteIntegration();break;case"route-internal":this.setAccessIntent("internal");break;case"route-none":this.setAccessIntent("none");break;case"link-reload":this.detailChannelId&&this.reloadLinks();break;case"retry":this.refresh();break;case"toggle-archived":this.showArchived=!this.showArchived,this.refresh();break;case"refresh-review":this.conflict=!1,this.refresh().then(()=>this.openDialog({kind:"review"}));break;case"pick-sections":this.openDialog({kind:"scope",scope:"sections"});break;case"pick-rows":this.openDialog({kind:"scope",scope:"rows"});break;case"drag-select":this.mapIntent="assign",this.paintRail(),this.onInteractionChange?.();break;case"pick-category":this.pickCategory();break;case"assign-open":this.assignOpen=!0,this.mapIntent="assign",this.paintRail(),this.onInteractionChange?.();break;case"assign-close":this.assignOpen=!1,this.mapIntent="pan",this.paintRail(),this.onInteractionChange?.();break;case"preview-retry":this.loadPreview();break;default:break}}pickCategory(){this.chooser.openCategory()}renderScopeDialog(e){e.scope==="rows"?this.chooser.openRows():this.chooser.openSections()}openDialog(e){this.dialog=e,this.renderDialog()}renderDialog(){let e=this.dialog;e&&(e.kind==="create"?this.renderCreateDialog(e):e.kind==="review"?this.renderReviewDialog(e):e.kind==="scope"?this.renderScopeDialog(e):e.kind==="archive"?this.renderArchiveDialog(e):e.kind==="rename"?this.renderRenameDialog(e):e.kind==="pricing"?this.renderPricingDialog(e):e.kind==="seatlist"?this.renderSeatListDialog():e.kind==="menu"?this.renderMenuDialog(e):e.kind==="linkCreate"?this.renderLinkCreateDialog(e):e.kind==="linkRotate"?this.renderLinkRotateDialog(e):e.kind==="linkRevoke"?this.renderLinkRevokeDialog(e):e.kind==="intentSwitch"&&this.renderIntentSwitchDialog(e))}renderIntentSwitchDialog(e){let t=this.list?.channels.find(o=>o.id===e.channelId),s=e.intentTo;if(!t||!s||!this.caps.manage){this.closeDialog();return}let{headline:n,consequences:a}=Ut(e.switchBlocked);this.renderScrim(`
400
- <h3 id="slm-ch-dlg-title">Change how ${I(t.name)} reaches buyers?</h3>
401
- <p class="sub">${I(n)}</p>
427
+ ${m}
428
+ ${o}${r}${a}${d}${b}`}paintSelection(){this.caps.manage&&this.host.selectionLabels().length&&(this.assignOpen=!0),this.view==="inspect"&&!this.detailChannelId&&this.paintRail()}wireRail(){let e=this.host.rail;e.querySelectorAll("[data-ch-view]").forEach(o=>{o.addEventListener("click",()=>this.setView(o.dataset.chView))}),e.querySelectorAll("[data-ch-map]").forEach(o=>{o.addEventListener("click",()=>{this.mapIntent=o.dataset.chMap==="assign"?"assign":"pan",this.mapIntent==="assign"&&(this.assignOpen=!0),this.paintRail(),this.onInteractionChange?.()})}),e.querySelectorAll("[data-ch-open]").forEach(o=>{let r=()=>this.openChannel(o.dataset.chOpen);o.addEventListener("click",r),o.addEventListener("keydown",l=>{l.key!=="Enter"&&l.key!==" "&&l.key!=="Spacebar"||(l.preventDefault(),r())})}),e.querySelectorAll("[data-ch-menu]").forEach(o=>{o.addEventListener("click",r=>{r.stopPropagation(),this.openDialog({kind:"menu",channelId:o.dataset.chMenu})}),o.addEventListener("keydown",r=>{r.stopPropagation()})}),e.querySelectorAll("[data-ch-rotate]").forEach(o=>{o.addEventListener("click",()=>this.openDialog({kind:"linkRotate",channelId:this.detailChannelId,linkId:o.dataset.chRotate}))}),e.querySelectorAll("[data-ch-revoke]").forEach(o=>{o.addEventListener("click",()=>this.openDialog({kind:"linkRevoke",channelId:this.detailChannelId,linkId:o.dataset.chRevoke}))});let t=e.querySelector("[data-ch-target]");t?.addEventListener("change",()=>{this.targetChannelId=t.value,this.conflict=!1,this.paintRail()});let s=e.querySelector("[data-ch-audience]");s?.addEventListener("change",()=>{this.previewAudience=[s.value],this.loadPreview()});let n=e.querySelector("[data-ch-includepublic]");n?.addEventListener("change",()=>{this.previewIncludePublic=n.checked,this.loadPreview()}),e.querySelector(".slm-ch-grab")?.addEventListener("click",()=>this.cycleDetent()),e.querySelectorAll("[data-ch-act]").forEach(o=>{o.addEventListener("click",()=>this.railAction(o.dataset.chAct))}),this.chooser.wireFind(e)}openChannel(e){this.detailChannelId=e,this.paintRail(),this.loadLinks(e).then(()=>this.paintRail())}railAction(e){switch(e){case"sections":this.focusedSectionId=null,this.host.showSectionOverview(),this.paintRail();break;case"create":this.openDialog({kind:"create"});break;case"review":this.openDialog({kind:"review"});break;case"rename":this.openDialog({kind:"rename",channelId:this.detailChannelId});break;case"pricing":this.openDialog({kind:"pricing",channelId:this.detailChannelId});break;case"archive":this.openDialog({kind:"archive",channelId:this.detailChannelId});break;case"seatlist":this.openDialog({kind:"seatlist"});break;case"pause":this.togglePause();break;case"discard":this.host.clearSelection();break;case"applied-details":this.applied&&this.openDialog({kind:"review",applied:this.applied.result});break;case"undo-applied":this.undoApplied();break;case"back":this.detailChannelId=null,this.linksChannelId=null,this.links=[],this.linksState="idle",this.paintRail();break;case"link-create":this.openDialog({kind:"linkCreate",channelId:this.detailChannelId});break;case"embed-code":this.chooseWebsiteIntegration();break;case"route-internal":this.setAccessIntent("internal");break;case"route-none":this.setAccessIntent("none");break;case"link-reload":this.detailChannelId&&this.reloadLinks();break;case"retry":this.refresh();break;case"toggle-archived":this.showArchived=!this.showArchived,this.refresh();break;case"refresh-review":this.conflict=!1,this.refresh().then(()=>this.openDialog({kind:"review"}));break;case"pick-sections":this.openDialog({kind:"scope",scope:"sections"});break;case"pick-rows":this.openDialog({kind:"scope",scope:"rows"});break;case"drag-select":this.mapIntent="assign",this.paintRail(),this.onInteractionChange?.();break;case"pick-category":this.pickCategory();break;case"assign-open":this.assignOpen=!0,this.mapIntent="assign",this.paintRail(),this.onInteractionChange?.();break;case"assign-close":this.assignOpen=!1,this.mapIntent="pan",this.paintRail(),this.onInteractionChange?.();break;case"preview-retry":this.loadPreview();break;default:break}}pickCategory(){this.chooser.openCategory()}renderScopeDialog(e){e.scope==="rows"?this.chooser.openRows():this.chooser.openSections()}openDialog(e){this.dialog=e,this.renderDialog()}renderDialog(){let e=this.dialog;e&&(e.kind==="create"?this.renderCreateDialog(e):e.kind==="review"?this.renderReviewDialog(e):e.kind==="scope"?this.renderScopeDialog(e):e.kind==="archive"?this.renderArchiveDialog(e):e.kind==="rename"?this.renderRenameDialog(e):e.kind==="pricing"?this.renderPricingDialog(e):e.kind==="seatlist"?this.renderSeatListDialog():e.kind==="menu"?this.renderMenuDialog(e):e.kind==="linkCreate"?this.renderLinkCreateDialog(e):e.kind==="linkRotate"?this.renderLinkRotateDialog(e):e.kind==="linkRevoke"?this.renderLinkRevokeDialog(e):e.kind==="intentSwitch"&&this.renderIntentSwitchDialog(e))}renderIntentSwitchDialog(e){let t=this.list?.channels.find(o=>o.id===e.channelId),s=e.intentTo;if(!t||!s||!this.caps.manage){this.closeDialog();return}let{headline:n,consequences:a}=Xt(e.switchBlocked);this.renderScrim(`
429
+ <h3 id="slm-ch-dlg-title">Change how ${P(t.name)} reaches buyers?</h3>
430
+ <p class="sub">${P(n)}</p>
402
431
  <div class="slm-ch-alert warn" role="alert"><span>\u26A0</span><span>
403
- ${a.map(o=>`<span style="display:block;margin-bottom:6px">${I(o)}</span>`).join("")}
432
+ ${a.map(o=>`<span style="display:block;margin-bottom:6px">${P(o)}</span>`).join("")}
404
433
  </span></div>
405
434
  ${e.pendingLink?`<p class="slm-note">Your new buyer link is created as soon as
406
435
  the route changes \u2014 you will not have to fill the form in again.</p>`:""}
407
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
436
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
408
437
  <div class="foot">
409
438
  <button type="button" class="quiet" data-ch-close>Leave it as it is</button>
410
439
  <button type="button" class="slm-btn" data-ch-intent-ack${e.busy?" disabled":""}>
411
- ${e.busy?"Changing\u2026":`Change to "${I(Pe(s))}"`}</button>
440
+ ${e.busy?"Changing\u2026":`Change to "${P(Fe(s))}"`}</button>
412
441
  </div>`,o=>{o.querySelector("[data-ch-intent-ack]")?.addEventListener("click",()=>{this.acknowledgeIntentSwitch(s,e.pendingLink??null)})})}async acknowledgeIntentSwitch(e,t){let s=this.detailChannelId;if(!s){this.closeDialog();return}if(this.dialog&&(this.dialog.busy=!0,this.renderDialog()),!await this.setAccessIntent(e,{acknowledgeLiveAccess:!0})){this.dialog?.kind==="intentSwitch"&&(this.dialog.busy=!1,this.renderDialog());return}if(!t){this.closeDialog();return}this.dialog?.kind==="intentSwitch"&&(this.dialog.busy=!1,this.renderDialog()),await this.mintLink(s,t)}renderScrim(e,t){let s=this.scrimEl;s||(this.lastFocus=document.activeElement??null),s?.remove();let n=document.createElement("div");n.className="slm-ch-scrim",n.innerHTML=`<div class="slm-ch-dialog" role="dialog" aria-modal="true"
413
- aria-labelledby="slm-ch-dlg-title" tabindex="-1">${e}</div>`,this.host.root.appendChild(n),this.scrimEl=n;let a=n.firstElementChild;a.querySelectorAll("[data-ch-close]").forEach(r=>{r.addEventListener("click",()=>this.closeDialog())}),n.addEventListener("keydown",r=>{if(r.key==="Escape"){r.stopPropagation(),this.closeDialog();return}if(r.key!=="Tab")return;let l=[...a.querySelectorAll('summary,button:not([disabled]),select:not([hidden]),input,textarea,a[href],[tabindex]:not([tabindex="-1"])')];if(!l.length)return;let c=l[0],d=l[l.length-1];r.shiftKey&&document.activeElement===c?(r.preventDefault(),d.focus()):!r.shiftKey&&document.activeElement===d&&(r.preventDefault(),c.focus())}),t(a),Ke(a),(a.querySelector("input,summary,button")??a).focus()}closeDialog(e={}){this.dialog=null,this.scrimEl?.remove(),this.scrimEl=null,e.restoreFocus!==!1&&this.lastFocus?.focus?.(),this.lastFocus=null}renderCreateDialog(e){let t=(this.list?.channels??[]).map(n=>Ee(n.marker||n.name,"")),s=ht("",t);this.renderScrim(`
442
+ aria-labelledby="slm-ch-dlg-title" tabindex="-1">${e}</div>`,this.host.root.appendChild(n),this.scrimEl=n;let a=n.firstElementChild;a.querySelectorAll("[data-ch-close]").forEach(r=>{r.addEventListener("click",()=>this.closeDialog())}),n.addEventListener("keydown",r=>{if(r.key==="Escape"){r.stopPropagation(),this.closeDialog();return}if(r.key!=="Tab")return;let l=[...a.querySelectorAll('summary,button:not([disabled]),select:not([hidden]),input,textarea,a[href],[tabindex]:not([tabindex="-1"])')];if(!l.length)return;let c=l[0],d=l[l.length-1];r.shiftKey&&document.activeElement===c?(r.preventDefault(),d.focus()):!r.shiftKey&&document.activeElement===d&&(r.preventDefault(),c.focus())}),t(a),Xe(a),(a.querySelector("input,summary,button")??a).focus()}closeDialog(e={}){this.dialog=null,this.scrimEl?.remove(),this.scrimEl=null,e.restoreFocus!==!1&&this.lastFocus?.focus?.(),this.lastFocus=null}renderCreateDialog(e){let t=(this.list?.channels??[]).map(n=>Ie(n.marker||n.name,"")),s=bt("",t);this.renderScrim(`
414
443
  <h3 id="slm-ch-dlg-title">New sales channel</h3>
415
444
  <p class="sub">A named share of seats only the right buyers can reach. You pick the seats next.</p>
416
445
  <div class="slm-field">
@@ -421,7 +450,7 @@
421
450
  <div class="slm-field">
422
451
  <label>Marker</label>
423
452
  <div style="display:flex;gap:8px;align-items:center">
424
- <span class="slm-ch-mk" data-ch-marker style="background:${I(s.color)};width:28px;height:28px;font-size:13px">${I(s.letter)}</span>
453
+ <span class="slm-ch-mk" data-ch-marker style="background:${P(s.color)};width:28px;height:28px;font-size:13px">${P(s.letter)}</span>
425
454
  <span class="slm-note" style="margin:0">The letter comes from the name; the colour is picked for you.</span>
426
455
  </div>
427
456
  </div>
@@ -430,25 +459,25 @@
430
459
  <input class="slm-input" id="slm-ch-ref" maxlength="120" placeholder="e.g. travel-agency-a" />
431
460
  <p class="slm-note">For your own system and webhooks.</p>
432
461
  </div>
433
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
462
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
434
463
  <div class="foot">
435
464
  <button type="button" class="quiet" data-ch-close>Cancel</button>
436
465
  <button type="button" class="slm-btn ghost" data-ch-create="plain">Create without seats</button>
437
466
  <button type="button" class="slm-btn" data-ch-create="allocate">Create and pick seats</button>
438
- </div>`,n=>{let a=n.querySelector("#slm-ch-name"),o=n.querySelector("[data-ch-marker]");a.addEventListener("input",()=>{let r=ht(a.value,t);o.textContent=r.letter,o.style.background=r.color}),n.querySelectorAll("[data-ch-create]").forEach(r=>{r.addEventListener("click",()=>{let l=r.dataset.chCreate==="allocate";this.createChannel(a.value,o.textContent??"",o.style.background,n.querySelector("#slm-ch-ref")?.value??"",l)})})})}async createChannel(e,t,s,n,a){let o=e.trim();if(!o){this.showDialogError("Give the channel a name your team will recognise.");return}try{let r=await this.host.api.createChannel(this.host.eventKey,{name:o,marker:Ee(t,"")||null,color:s||null,externalRef:n.trim()||null});this.closeDialog(),await this.refresh(),this.targetChannelId=r.channel.id,this.detailChannelId=a?null:r.channel.id,this.announce(`Channel ${o} created with 0 seats allocated.`),this.host.toast(a?`${o} created. Select seats on the map to allocate them.`:`${o} created.`,"ok"),this.paintRail()}catch(r){let l=r instanceof G?r.code:void 0;this.showDialogError(l==="channel_name_taken"?"That name is already used on this event. Pick another.":"Couldn't create the channel. Try again."),this.host.onError(r)}}showDialogError(e){let t=this.scrimEl?.querySelector("[data-ch-error]");t&&(t.textContent=e,t.hidden=!1)}renderReviewDialog(e){let{labels:t,buckets:s}=this.currentPlan(),n=e.applied,a=n?n.buckets:s,o=this.nameOf(n?.targetChannelId??this.targetChannelId)??oe,r=_t(a,o),l=n?n.applied:tt(s),c=!n&&t.length>0&&l===0,d=!n&&t.length>Le,b=nt(r),f=n?'<div class="foot"><button type="button" class="slm-btn" data-ch-close>Done</button></div>':`<div class="foot">
467
+ </div>`,n=>{let a=n.querySelector("#slm-ch-name"),o=n.querySelector("[data-ch-marker]");a.addEventListener("input",()=>{let r=bt(a.value,t);o.textContent=r.letter,o.style.background=r.color}),n.querySelectorAll("[data-ch-create]").forEach(r=>{r.addEventListener("click",()=>{let l=r.dataset.chCreate==="allocate";this.createChannel(a.value,o.textContent??"",o.style.background,n.querySelector("#slm-ch-ref")?.value??"",l)})})})}async createChannel(e,t,s,n,a){let o=e.trim();if(!o){this.showDialogError("Give the channel a name your team will recognise.");return}try{let r=await this.host.api.createChannel(this.host.eventKey,{name:o,marker:Ie(t,"")||null,color:s||null,externalRef:n.trim()||null});this.closeDialog(),await this.refresh(),this.targetChannelId=r.channel.id,this.detailChannelId=a?null:r.channel.id,this.announce(`Channel ${o} created with 0 seats allocated.`),this.host.toast(a?`${o} created. Select seats on the map to allocate them.`:`${o} created.`,"ok"),this.paintRail()}catch(r){let l=r instanceof W?r.code:void 0;this.showDialogError(l==="channel_name_taken"?"That name is already used on this event. Pick another.":"Couldn't create the channel. Try again."),this.host.onError(r)}}showDialogError(e){let t=this.scrimEl?.querySelector("[data-ch-error]");t&&(t.textContent=e,t.hidden=!1)}renderReviewDialog(e){let{labels:t,buckets:s}=this.currentPlan(),n=e.applied,a=n?n.buckets:s,o=this.nameOf(n?.targetChannelId??this.targetChannelId)??le,r=Wt(a,o),l=n?n.applied:it(s),c=!n&&t.length>0&&l===0,d=!n&&t.length>Te,g=ot(r),b=n?'<div class="foot"><button type="button" class="slm-btn" data-ch-close>Done</button></div>':`<div class="foot">
439
468
  <button type="button" class="quiet" data-ch-close>Back</button>
440
469
  <button type="button" class="slm-btn" data-ch-apply ${c||d||e.busy?"disabled":""}>
441
470
  ${e.busy?"Applying\u2026":`Apply ${l.toLocaleString()} change${l===1?"":"s"}`}
442
471
  </button>
443
- </div>`,u=c?X("warn","Nothing here can move right now",` Every seat is in a buyer's cart, already sold, or already in ${o}.`):"",m=d?X("warn","Too many seats for one change",` One change can move up to ${Le.toLocaleString()} seats. Split it, for example by row groups.`).replace(' role="status"',' role="alert"'):"";this.renderScrim(`
444
- <h3 id="slm-ch-dlg-title">${n?`Moved ${n.applied.toLocaleString()} seat${n.applied===1?"":"s"} to ${I(o)}`:`Move ${t.length.toLocaleString()} seat${t.length===1?"":"s"} to ${I(o)}`}</h3>
472
+ </div>`,m=c?Q("warn","Nothing here can move right now",` Every seat is in a buyer's cart, already sold, or already in ${o}.`):"",p=d?Q("warn","Too many seats for one change",` One change can move up to ${Te.toLocaleString()} seats. Split it, for example by row groups.`).replace(' role="status"',' role="alert"'):"";this.renderScrim(`
473
+ <h3 id="slm-ch-dlg-title">${n?`Moved ${n.applied.toLocaleString()} seat${n.applied===1?"":"s"} to ${P(o)}`:`Move ${t.length.toLocaleString()} seat${t.length===1?"":"s"} to ${P(o)}`}</h3>
445
474
  <p class="sub">${n?"These are the exact counts the server applied.":"Every selected seat is in exactly one line below."}</p>
446
- ${u}
447
475
  ${m}
448
- ${b||'<div class="slm-empty">Nothing selected.</div>'}
449
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
450
- ${f}`,v=>{v.querySelector("[data-ch-apply]")?.addEventListener("click",()=>{this.apply()})}),n&&this.announce(`Applied ${n.applied} change${n.applied===1?"":"s"} to ${o}.`)}async apply(){if(!this.dialog||!this.caps.manage)return;let{labels:e}=this.currentPlan();if(!e.length)return;if(e.length>Le){this.showDialogError(`Choose at most ${Le.toLocaleString()} seats for one Apply.`);return}this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();let t=n=>{let a=this.allocation.get(n);return re(a)?ee:a},s=new Map(e.map(n=>[n,t(n)]));try{let n=await this.host.api.applyChannelAssignment(this.host.eventKey,{targetChannelId:re(this.targetChannelId)?null:this.targetChannelId,labels:e,assignmentVersion:this.assignmentVersion});this.assignmentVersion=n.assignmentVersion,this.conflict=!1,await this.refresh({quiet:!0}),this.closeDialog({restoreFocus:!1});let a=re(n.targetChannelId)?ee:n.targetChannelId,o=new Map;for(let[r,l]of s)l===a||t(r)!==a||o.set(l,[...o.get(l)??[],r]);this.host.clearSelection(),this.showApplied(n,o),this.host.moved?.({target:this.nameOf(n.targetChannelId)??oe,labels:[...o.values()].flat(),back:[...o]})}catch(n){if(n instanceof G&&n.status===409&&n.code==="channel_assignment_conflict"){this.conflict=!0,this.closeDialog(),this.shakeStaged(),this.paintRail(),this.announce("Assignments changed while you were editing. Nothing was applied and your selection is kept.");return}if(n instanceof G&&n.status===403){this.caps={view:this.caps.view,manage:!1},this.closeDialog(),this.paintRail(),this.host.toast("Changing channels needs channel-management permission.","err");return}this.dialog={kind:"review",busy:!1,error:"Couldn't apply those changes. Try again."},this.renderDialog(),this.host.onError(n)}}showApplied(e,t=new Map){let s=this.nameOf(e.targetChannelId)??oe,n=e.buckets.skippedHeld.count+e.buckets.skippedBooked.count+e.buckets.notFound.count;this.railNote=null,this.applied={result:e,back:t,until:Date.now()+Hi},this.setStaged(null),this.paintRail(),this.announce(`Assigned ${e.applied} seat${e.applied===1?"":"s"} to ${s}${n?`; ${n} skipped`:""}.`),this.appliedTimer&&clearTimeout(this.appliedTimer),this.appliedTimer=setTimeout(()=>{this.appliedTimer=null,this.paintRail()},Hi+100)}appliedHtml(){let e=this.applied;if(!e)return this.railNote??"";let{result:t}=e,s=this.nameOf(t.targetChannelId)??oe,n=t.applied,a=t.buckets.alreadyInTarget.count,o=t.buckets.skippedHeld.count+t.buckets.skippedBooked.count+t.buckets.notFound.count,r=re(t.targetChannelId)?"Buyers on your event page":`Buyers coming through ${s}`,l=[a?`${a.toLocaleString()} ${a===1?"was":"were"} already there.`:"",o?`${o.toLocaleString()} could not move (in a cart, sold or no longer on the map).`:"",n?`${r} see them now.`:""].filter(Boolean).join(" ");return X("ok",`${n.toLocaleString()} ${n===1?"seat":"seats"} now in ${s}`,` ${l}`)+'<button type="button" class="slm-linkbtn slm-ch-details" data-ch-act="applied-details">Details</button>'}undoBarHtml(){let e=this.applied;return!e||!e.back.size||e.until<=Date.now()?"":`<div class="slm-undobar"><span>Moved just now</span><button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="undo-applied">${hr}Undo</button></div>`}async undoApplied(){let e=this.applied;if(!e?.back.size||!this.caps.manage)return;this.applied=null,this.railNote='<div class="slm-ch-busy" role="status">Putting the seats back\u2026</div>',this.paintRail();let{moved:t,failed:s}=await this.sendBack(e.back);t&&this.host.moved?.({target:"",labels:[...e.back.values()].flat(),back:[],restores:!0}),this.railNote=s?X("warn",t?`${t.toLocaleString()} seats went back; the rest could not`:"Couldn't undo"," Someone may have changed these seats meanwhile. Nothing else moved.").replace(' role="status"',' role="alert"'):X("ok","Undone",` ${t.toLocaleString()} ${t===1?"seat is":"seats are"} back where ${t===1?"it was":"they were"}.`),this.paintRail()}async sendBack(e){let t=0,s=!1;await this.refresh({quiet:!0});for(let[n,a]of e)try{let o=await this.host.api.applyChannelAssignment(this.host.eventKey,{targetChannelId:re(n)?null:n,labels:a,assignmentVersion:this.assignmentVersion});this.assignmentVersion=o.assignmentVersion,t+=o.applied}catch(o){s=!0,this.host.onError(o);break}return await this.refresh({quiet:!0}),{moved:t,failed:s}}shakeStaged(){let e=this.stagedEl;!e||!e.classList.contains("on")||(e.classList.remove("shake"),e.offsetWidth,e.classList.add("shake"))}renderMenuDialog(e){let t=this.list?.channels.find(n=>n.id===e.channelId);if(!t||!this.caps.manage){this.closeDialog();return}let s=t.state==="paused";this.renderScrim(`
451
- <h3 id="slm-ch-dlg-title">${I(t.name)}</h3>
476
+ ${p}
477
+ ${g||'<div class="slm-empty">Nothing selected.</div>'}
478
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
479
+ ${b}`,f=>{f.querySelector("[data-ch-apply]")?.addEventListener("click",()=>{this.apply()})}),n&&this.announce(`Applied ${n.applied} change${n.applied===1?"":"s"} to ${o}.`)}async apply(){if(!this.dialog||!this.caps.manage)return;let{labels:e}=this.currentPlan();if(!e.length)return;if(e.length>Te){this.showDialogError(`Choose at most ${Te.toLocaleString()} seats for one Apply.`);return}this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();let t=n=>{let a=this.allocation.get(n);return ce(a)?se:a},s=new Map(e.map(n=>[n,t(n)]));try{let n=await this.host.api.applyChannelAssignment(this.host.eventKey,{targetChannelId:ce(this.targetChannelId)?null:this.targetChannelId,labels:e,assignmentVersion:this.assignmentVersion});this.assignmentVersion=n.assignmentVersion,this.conflict=!1,await this.refresh({quiet:!0}),this.closeDialog({restoreFocus:!1});let a=ce(n.targetChannelId)?se:n.targetChannelId,o=new Map;for(let[r,l]of s)l===a||t(r)!==a||o.set(l,[...o.get(l)??[],r]);this.host.clearSelection(),this.showApplied(n,o),this.host.moved?.({target:this.nameOf(n.targetChannelId)??le,labels:[...o.values()].flat(),back:[...o]})}catch(n){if(n instanceof W&&n.status===409&&n.code==="channel_assignment_conflict"){this.conflict=!0,this.closeDialog(),this.shakeStaged(),this.paintRail(),this.announce("Assignments changed while you were editing. Nothing was applied and your selection is kept.");return}if(n instanceof W&&n.status===403){this.caps={view:this.caps.view,manage:!1},this.closeDialog(),this.paintRail(),this.host.toast('Changing channels needs the "Manage channels" permission.',"err");return}this.dialog={kind:"review",busy:!1,error:"Couldn't apply those changes. Try again."},this.renderDialog(),this.host.onError(n)}}showApplied(e,t=new Map){let s=this.nameOf(e.targetChannelId)??le,n=e.buckets.skippedHeld.count+e.buckets.skippedBooked.count+e.buckets.notFound.count;this.railNote=null,this.applied={result:e,back:t,until:Date.now()+Gi},this.setStaged(null),this.paintRail(),this.announce(`Assigned ${e.applied} seat${e.applied===1?"":"s"} to ${s}${n?`; ${n} skipped`:""}.`),this.appliedTimer&&clearTimeout(this.appliedTimer),this.appliedTimer=setTimeout(()=>{this.appliedTimer=null,this.paintRail()},Gi+100)}appliedHtml(){let e=this.applied;if(!e)return this.railNote??"";let{result:t}=e,s=this.nameOf(t.targetChannelId)??le,n=t.applied,a=t.buckets.alreadyInTarget.count,o=t.buckets.skippedHeld.count+t.buckets.skippedBooked.count+t.buckets.notFound.count,r=ce(t.targetChannelId)?"Buyers on your event page":`Buyers coming through ${s}`,l=[a?`${a.toLocaleString()} ${a===1?"was":"were"} already there.`:"",o?`${o.toLocaleString()} could not move (in a cart, sold or no longer on the map).`:"",n?`${r} see them now.`:""].filter(Boolean).join(" ");return Q("ok",`${n.toLocaleString()} ${n===1?"seat":"seats"} now in ${s}`,` ${l}`)+(o?'<button type="button" class="slm-linkbtn slm-ch-details" data-ch-act="applied-details">Details</button>':"")}undoBarHtml(){let e=this.applied;return!e||!e.back.size||e.until<=Date.now()?"":`<div class="slm-undobar"><span>Moved just now</span><button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="undo-applied">${Dr}Undo</button></div>`}async undoApplied(){let e=this.applied;if(!e?.back.size||!this.caps.manage)return;this.applied=null,this.railNote='<div class="slm-ch-busy" role="status">Putting the seats back\u2026</div>',this.paintRail();let{moved:t,failed:s}=await this.sendBack(e.back);t&&this.host.moved?.({target:"",labels:[...e.back.values()].flat(),back:[],restores:!0}),this.railNote=s?Q("warn",t?`${t.toLocaleString()} seats went back; the rest could not`:"Couldn't undo"," Someone may have changed these seats meanwhile. Nothing else moved.").replace(' role="status"',' role="alert"'):Q("ok","Undone",` ${t.toLocaleString()} ${t===1?"seat is":"seats are"} back where ${t===1?"it was":"they were"}.`),this.paintRail()}async sendBack(e){let t=0,s=!1;await this.refresh({quiet:!0});for(let[n,a]of e)try{let o=await this.host.api.applyChannelAssignment(this.host.eventKey,{targetChannelId:ce(n)?null:n,labels:a,assignmentVersion:this.assignmentVersion});this.assignmentVersion=o.assignmentVersion,t+=o.applied}catch(o){s=!0,this.host.onError(o);break}return await this.refresh({quiet:!0}),{moved:t,failed:s}}shakeStaged(){let e=this.stagedEl;!e||!e.classList.contains("on")||(e.classList.remove("shake"),e.offsetWidth,e.classList.add("shake"))}renderMenuDialog(e){let t=this.list?.channels.find(n=>n.id===e.channelId);if(!t||!this.caps.manage){this.closeDialog();return}let s=t.state==="paused";this.renderScrim(`
480
+ <h3 id="slm-ch-dlg-title">${P(t.name)}</h3>
452
481
  <p class="sub">Open the channel to allocate seats and hand out buyer access.
453
482
  These are the rest of its actions.</p>
454
483
  <div class="slm-ch-menu">
@@ -461,49 +490,49 @@
461
490
  Archiving closes the channel for good and returns its free seats to a destination you choose.
462
491
  Nothing is ever deleted silently.</p>
463
492
  <div class="foot"><button type="button" class="quiet" data-ch-close>Cancel</button></div>`,n=>{n.querySelectorAll("[data-ch-menu-act]").forEach(a=>{a.addEventListener("click",()=>{let o=a.dataset.chMenuAct;if(o==="open"){this.closeDialog(),this.openChannel(t.id);return}if(o==="rename"){this.openDialog({kind:"rename",channelId:t.id});return}if(o==="archive"){this.openDialog({kind:"archive",channelId:t.id});return}this.closeDialog(),this.togglePause(t.id)})})})}renderRenameDialog(e){let t=this.list?.channels.find(s=>s.id===e.channelId);if(!t){this.closeDialog();return}this.renderScrim(`
464
- <h3 id="slm-ch-dlg-title">Rename ${I(t.name)}</h3>
493
+ <h3 id="slm-ch-dlg-title">Rename ${P(t.name)}</h3>
465
494
  <p class="sub">Only your team and your reports see this name.</p>
466
495
  <div class="slm-field">
467
496
  <label for="slm-ch-newname">Name</label>
468
- <input class="slm-input" id="slm-ch-newname" maxlength="80" value="${I(t.name)}" />
497
+ <input class="slm-input" id="slm-ch-newname" maxlength="80" value="${P(t.name)}" />
469
498
  </div>
470
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
499
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
471
500
  <div class="foot">
472
501
  <button type="button" class="quiet" data-ch-close>Cancel</button>
473
502
  <button type="button" class="slm-btn" data-ch-rename>Save name</button>
474
- </div>`,s=>{s.querySelector("[data-ch-rename]")?.addEventListener("click",()=>{let n=s.querySelector("#slm-ch-newname")?.value??"";if(!n.trim()){this.showDialogError("A channel needs a name.");return}this.host.api.renameChannel(this.host.eventKey,t.id,n.trim()).then(()=>(this.closeDialog(),this.refresh())).catch(a=>{this.showDialogError(a instanceof G&&a.code==="channel_name_taken"?"That name is already used on this event.":"Couldn't rename the channel."),this.host.onError(a)})})})}renderPricingDialog(e){let t=this.list?.channels.find(o=>o.id===e.channelId),s=this.host.api.updateChannelPricing;if(!t||!s||!this.caps.manage){this.closeDialog();return}let n=new Map((t.priceOverrides??[]).map(o=>[`${o.categoryKey}\0${o.tierId??""}`,o.price])),a=this.host.categories().flatMap(o=>(o.tiers?.length?o.tiers:[null]).map(l=>{let c=l?.id??null,d=`${o.key}\0${c??""}`,b=l?.price??o.price??0,f=n.get(d),u=l?`${o.label} \xB7 ${l.name}`:o.label;return`<label class="slm-ch-price-row">
475
- <span><b>${I(u)}</b><small>Event price ${I(String(b))}</small></span>
503
+ </div>`,s=>{s.querySelector("[data-ch-rename]")?.addEventListener("click",()=>{let n=s.querySelector("#slm-ch-newname")?.value??"";if(!n.trim()){this.showDialogError("A channel needs a name.");return}this.host.api.renameChannel(this.host.eventKey,t.id,n.trim()).then(()=>(this.closeDialog(),this.refresh())).catch(a=>{this.showDialogError(a instanceof W&&a.code==="channel_name_taken"?"That name is already used on this event.":"Couldn't rename the channel."),this.host.onError(a)})})})}renderPricingDialog(e){let t=this.list?.channels.find(o=>o.id===e.channelId),s=this.host.api.updateChannelPricing;if(!t||!s||!this.caps.manage){this.closeDialog();return}let n=new Map((t.priceOverrides??[]).map(o=>[`${o.categoryKey}\0${o.tierId??""}`,o.price])),a=this.host.categories().flatMap(o=>(o.tiers?.length?o.tiers:[null]).map(l=>{let c=l?.id??null,d=`${o.key}\0${c??""}`,g=l?.price??o.price??0,b=n.get(d),m=l?`${o.label} \xB7 ${l.name}`:o.label;return`<label class="slm-ch-price-row">
504
+ <span><b>${P(m)}</b><small>Event price ${P(String(g))}</small></span>
476
505
  <input class="slm-input" type="number" min="0" max="1000000" step="0.01"
477
- inputmode="decimal" aria-label="Custom price for ${I(u)}"
478
- data-ch-price-category="${I(o.key)}" data-ch-price-tier="${I(c??"")}"
479
- placeholder="${I(String(b))}" value="${f===void 0?"":I(String(f))}"
506
+ inputmode="decimal" aria-label="Custom price for ${P(m)}"
507
+ data-ch-price-category="${P(o.key)}" data-ch-price-tier="${P(c??"")}"
508
+ placeholder="${P(String(g))}" value="${b===void 0?"":P(String(b))}"
480
509
  ${e.busy?"disabled":""} />
481
510
  </label>`})).join("");this.renderScrim(`
482
- <h3 id="slm-ch-dlg-title">Prices for ${I(t.name)}</h3>
511
+ <h3 id="slm-ch-dlg-title">Prices for ${P(t.name)}</h3>
483
512
  <p class="sub">Set only the prices that differ for these buyers. Leave a field empty to use the event price.</p>
484
513
  <div class="slm-ch-price-list">${a||'<p class="slm-empty">This event has no priced categories.</p>'}</div>
485
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
514
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
486
515
  <div class="foot">
487
516
  <button type="button" class="quiet" data-ch-close ${e.busy?"disabled":""}>Cancel</button>
488
517
  <button type="button" class="slm-btn" data-ch-price-save ${e.busy||!a?"disabled":""}>
489
518
  ${e.busy?"Saving\u2026":"Save prices"}
490
519
  </button>
491
- </div>`,o=>{o.querySelector("[data-ch-price-save]")?.addEventListener("click",()=>{let r=[];for(let l of o.querySelectorAll("[data-ch-price-category]")){let c=l.value.trim();if(!c)continue;let d=Number(c);if(!Number.isFinite(d)||d<0||d>1e6){l.focus(),this.showDialogError("Enter a price from 0 to 1,000,000, or leave the field blank.");return}r.push({categoryKey:l.dataset.chPriceCategory,tierId:l.dataset.chPriceTier||null,price:d})}this.saveChannelPricing(t,r)})})}async saveChannelPricing(e,t){let s=this.host.api.updateChannelPricing;if(!(!s||!this.dialog||this.dialog.kind!=="pricing")){this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();try{await s.call(this.host.api,this.host.eventKey,e.id,t,e.pricingVersion??0),this.closeDialog(),await this.refresh(),this.host.toast(t.length?`Custom prices saved for ${e.name}.`:`${e.name} now uses event prices.`,"ok")}catch(n){if(n instanceof G&&n.code==="channel_pricing_conflict"){await this.refresh({quiet:!0}),this.dialog={kind:"pricing",channelId:e.id,error:"Prices changed in another window. Latest values are shown \u2014 review and save again."},this.renderDialog();return}this.dialog={kind:"pricing",channelId:e.id,error:n instanceof G&&n.serverMessage?n.serverMessage:"Couldn't save these prices. Try again."},this.renderDialog(),this.host.onError(n)}}}async chooseWebsiteIntegration(){this.detailChannelId&&await this.setAccessIntent("server")}async setAccessIntent(e,t={}){let s=this.detailChannelId;if(!s||!this.caps.manage)return!1;try{let n=await this.host.api.setChannelAccessIntent(this.host.eventKey,s,e,t);return await this.refresh(),this.host.toast(this.intentSavedCopy(e,n?.intentSwitch),"ok"),!0}catch(n){return n instanceof G&&n.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:s,intentTo:e,switchBlocked:n.details}),!1):n instanceof G&&n.code==="channel_access_intent_forbids"?(this.host.toast(st(n.details),"err"),!1):(this.host.toast("Couldn't change how this channel reaches buyers.","err"),this.host.onError(n),!1)}}intentSavedCopy(e,t){let s=e==="server"?"Set to your website or app. The embed code is on the Embed page.":e==="internal"?"Only your own staff can sell this channel now.":e==="hosted_link"?"Set to buyer links. Create one to let buyers in.":"Kept as a protected reserve. No route can sell these seats.";if(!t)return s;let n=t.closedLinks?` ${t.closedLinks.toLocaleString()} buyer link${t.closedLinks===1?"":"s"} closed.`:"",a=t.keptSessions?` ${t.keptSessions.toLocaleString()} buyer${t.keptSessions===1?"":"s"} already in a checkout can still finish.`:"";return`${s}${n}${a}`}async togglePause(e=this.detailChannelId){let t=this.list?.channels.find(n=>n.id===e);if(!t||!this.caps.manage)return;let s=t.state!=="paused";try{await this.host.api.setChannelPaused(this.host.eventKey,t.id,s),await this.refresh(),this.host.toast(s?`${t.name} paused. Existing checkouts can finish; no new buyer access is issued.`:`${t.name} resumed.`,"ok")}catch(n){this.host.toast("Couldn't change that channel.","err"),this.host.onError(n)}}renderArchiveDialog(e){let t=this.list?.channels.find(l=>l.id===e.channelId);if(!t){this.closeDialog();return}let s=e.archiveBlocked??null,n=!s&&t.counts.held>0,a=this.assignableChannels().filter(l=>l.id!==t.id),o=s?s.heldUnits??s.activeHolds??0:n?t.counts.held:0,r=o?X("warn",`${o.toLocaleString()} ${o===1?"seat is":"seats are"} in a buyer's cart right now`,s?` Archive waits until they finish or their time runs out, ${jt(s)}.`:" Archive waits until they finish or their time runs out; you can try, and we will say when to come back.").replace(' role="status"',s?' role="alert"':' role="status"'):"";this.renderScrim(`
492
- <h3 id="slm-ch-dlg-title">Archive ${I(t.name)}</h3>
520
+ </div>`,o=>{o.querySelector("[data-ch-price-save]")?.addEventListener("click",()=>{let r=[];for(let l of o.querySelectorAll("[data-ch-price-category]")){let c=l.value.trim();if(!c)continue;let d=Number(c);if(!Number.isFinite(d)||d<0||d>1e6){l.focus(),this.showDialogError("Enter a price from 0 to 1,000,000, or leave the field blank.");return}r.push({categoryKey:l.dataset.chPriceCategory,tierId:l.dataset.chPriceTier||null,price:d})}this.saveChannelPricing(t,r)})})}async saveChannelPricing(e,t){let s=this.host.api.updateChannelPricing;if(!(!s||!this.dialog||this.dialog.kind!=="pricing")){this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();try{await s.call(this.host.api,this.host.eventKey,e.id,t,e.pricingVersion??0),this.closeDialog(),await this.refresh(),this.host.toast(t.length?`Custom prices saved for ${e.name}.`:`${e.name} now uses event prices.`,"ok")}catch(n){if(n instanceof W&&n.code==="channel_pricing_conflict"){await this.refresh({quiet:!0}),this.dialog={kind:"pricing",channelId:e.id,error:"Prices changed in another window. Latest values are shown \u2014 review and save again."},this.renderDialog();return}this.dialog={kind:"pricing",channelId:e.id,error:n instanceof W&&n.serverMessage?n.serverMessage:"Couldn't save these prices. Try again."},this.renderDialog(),this.host.onError(n)}}}async chooseWebsiteIntegration(){this.detailChannelId&&await this.setAccessIntent("server")}async setAccessIntent(e,t={}){let s=this.detailChannelId;if(!s||!this.caps.manage)return!1;try{let n=await this.host.api.setChannelAccessIntent(this.host.eventKey,s,e,t);return await this.refresh(),this.host.toast(this.intentSavedCopy(e,n?.intentSwitch),"ok"),!0}catch(n){return n instanceof W&&n.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:s,intentTo:e,switchBlocked:n.details}),!1):n instanceof W&&n.code==="channel_access_intent_forbids"?(this.host.toast(at(n.details),"err"),!1):(this.host.toast("Couldn't change how this channel reaches buyers.","err"),this.host.onError(n),!1)}}intentSavedCopy(e,t){let s=e==="server"?"Set to your website or app. The embed code is on the Embed page.":e==="internal"?"Only your own staff can sell this channel now.":e==="hosted_link"?"Set to buyer links. Create one to let buyers in.":"Kept as a protected reserve. No route can sell these seats.";if(!t)return s;let n=t.closedLinks?` ${t.closedLinks.toLocaleString()} buyer link${t.closedLinks===1?"":"s"} closed.`:"",a=t.keptSessions?` ${t.keptSessions.toLocaleString()} buyer${t.keptSessions===1?"":"s"} already in a checkout can still finish.`:"";return`${s}${n}${a}`}async togglePause(e=this.detailChannelId){let t=this.list?.channels.find(n=>n.id===e);if(!t||!this.caps.manage)return;let s=t.state!=="paused";try{await this.host.api.setChannelPaused(this.host.eventKey,t.id,s),await this.refresh(),this.host.toast(s?`${t.name} paused. Existing checkouts can finish; no new buyer access is issued.`:`${t.name} resumed.`,"ok")}catch(n){this.host.toast("Couldn't change that channel.","err"),this.host.onError(n)}}renderArchiveDialog(e){let t=this.list?.channels.find(l=>l.id===e.channelId);if(!t){this.closeDialog();return}let s=e.archiveBlocked??null,n=!s&&t.counts.held>0,a=this.assignableChannels().filter(l=>l.id!==t.id),o=s?s.heldUnits??s.activeHolds??0:n?t.counts.held:0,r=o?Q("warn",`${o.toLocaleString()} ${o===1?"seat is":"seats are"} in a buyer's cart right now`,s?` Archive waits until they finish or their time runs out, ${Gt(s)}.`:" Archive waits until they finish or their time runs out; you can try, and we will say when to come back.").replace(' role="status"',s?' role="alert"':' role="status"'):"";this.renderScrim(`
521
+ <h3 id="slm-ch-dlg-title">Archive ${P(t.name)}</h3>
493
522
  <p class="sub">The channel closes for good. Its free seats move where you choose; sales keep their record.</p>
494
523
  <div class="slm-field">
495
524
  <label for="slm-ch-dest">Move the ${t.counts.free.toLocaleString()} free ${t.counts.free===1?"seat":"seats"} to</label>
496
- <select class="slm-select" id="slm-ch-dest">
497
- ${a.map(l=>`<option value="${I(l.id)}">${I(l.name)}</option>`).join("")}
498
- </select>
525
+ <span class="slm-ch-pick">${this.plateHtml(a[0]?.id)}<select class="slm-select" id="slm-ch-dest">
526
+ ${a.map(l=>`<option value="${P(l.id)}">${P(l.name)}</option>`).join("")}
527
+ </select></span>
499
528
  </div>
500
529
  ${r}
501
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
530
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
502
531
  <div class="foot">
503
532
  <button type="button" class="quiet" data-ch-close>Cancel</button>
504
533
  <button type="button" class="slm-btn danger" data-ch-archive ${s?"disabled":""}>Archive channel</button>
505
- </div>`,l=>{l.querySelector("[data-ch-archive]")?.addEventListener("click",()=>{let c=l.querySelector("#slm-ch-dest")?.value??"";this.archive(t.id,c||null)})})}async archive(e,t){try{await this.host.api.archiveChannel(this.host.eventKey,e,t),this.closeDialog(),this.detailChannelId=null,await this.refresh(),this.host.toast("Channel archived. Its remaining seats moved to the destination you chose.","ok")}catch(s){if(s instanceof G&&s.status===409&&s.code==="channel_archive_blocked_by_holds"){this.dialog={kind:"archive",channelId:e,archiveBlocked:s.details??{}},this.renderDialog();return}this.showDialogError("Couldn't archive that channel. Try again."),this.host.onError(s)}}renderSeatListDialog(){this.chooser.openSeatList()}async reloadLinks(){let e=this.detailChannelId;e&&(this.linksState=this.links.length?this.linksState:"loading",await this.loadLinks(e),this.paintRail())}async reloadAfterLinkChange(e){if(this.detailChannelId===e){await this.refresh({quiet:!0});return}await this.loadLinks(e),this.active&&this.paintRail()}linkById(e){return this.links.find(t=>t.id===e)??null}renderLinkCreateDialog(e){let t=this.list?.channels.find(s=>s.id===e.channelId);if(!t||!this.caps.manage){this.closeDialog();return}this.renderScrim(`
506
- <h3 id="slm-ch-dlg-title">Create a buyer link for ${I(t.name)}</h3>
534
+ </div>`,l=>{let c=l.querySelector("#slm-ch-dest");c.onchange=()=>{l.querySelector(".slm-ch-mk").outerHTML=this.plateHtml(c.value)},l.querySelector("[data-ch-archive]")?.addEventListener("click",()=>{this.archive(t.id,c.value||null)})})}async archive(e,t){try{await this.host.api.archiveChannel(this.host.eventKey,e,t),this.closeDialog(),this.detailChannelId=null,await this.refresh(),this.host.toast("Channel archived. Its remaining seats moved to the destination you chose.","ok")}catch(s){if(s instanceof W&&s.status===409&&s.code==="channel_archive_blocked_by_holds"){this.dialog={kind:"archive",channelId:e,archiveBlocked:s.details??{}},this.renderDialog();return}this.showDialogError("Couldn't archive that channel. Try again."),this.host.onError(s)}}renderSeatListDialog(){this.chooser.openSeatList()}async reloadLinks(){let e=this.detailChannelId;e&&(this.linksState=this.links.length?this.linksState:"loading",await this.loadLinks(e),this.paintRail())}async reloadAfterLinkChange(e){if(this.detailChannelId===e){await this.refresh({quiet:!0});return}await this.loadLinks(e),this.active&&this.paintRail()}linkById(e){return this.links.find(t=>t.id===e)??null}renderLinkCreateDialog(e){let t=this.list?.channels.find(s=>s.id===e.channelId);if(!t||!this.caps.manage){this.closeDialog();return}this.renderScrim(`
535
+ <h3 id="slm-ch-dlg-title">Create a buyer link for ${P(t.name)}</h3>
507
536
  <p class="sub">Anyone who opens the link can buy from this channel's allocation \u2014 and only from it.
508
537
  You'll see the link once, right after you create it.</p>
509
538
  <div class="slm-field">
@@ -525,52 +554,52 @@
525
554
  <div class="slm-field">
526
555
  <label for="slm-ch-lk-redemptions">How many people can use it</label>
527
556
  <input class="slm-input" type="number" id="slm-ch-lk-redemptions" inputmode="numeric"
528
- value="${ut.maxRedemptions}" />
557
+ value="${ft.maxRedemptions}" />
529
558
  <p class="slm-note">Each buyer who opens the link uses one.</p>
530
559
  </div>
531
560
  <div class="slm-field">
532
561
  <label for="slm-ch-lk-quantity">Seats per buyer</label>
533
562
  <input class="slm-input" type="number" id="slm-ch-lk-quantity" inputmode="numeric"
534
- value="${ut.maxQuantity}" />
563
+ value="${ft.maxQuantity}" />
535
564
  </div>
536
565
  <label class="slm-note" style="display:flex;gap:8px;align-items:center;margin:2px 0 6px">
537
566
  <input type="checkbox" id="slm-ch-lk-public" />
538
567
  Also let this link buy Public sale seats
539
568
  </label>
540
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
569
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
541
570
  <div class="foot">
542
571
  <button type="button" class="quiet" data-ch-close>Cancel</button>
543
572
  <button type="button" class="slm-btn" data-ch-lk-create>Create link</button>
544
- </div>`,s=>{let n=s.querySelector("[data-ch-lk-expiry]"),a=s.querySelector("[data-ch-lk-when-field]"),o=s.querySelector("#slm-ch-lk-when");n.addEventListener("change",()=>{let r=n.value==="custom";a.hidden=!r,r&&!o.value&&(o.value=Li(Date.now()+7*864e5))}),s.querySelector("[data-ch-lk-create]")?.addEventListener("click",()=>{let r=Cs(s,"#slm-ch-lk-redemptions"),l=Cs(s,"#slm-ch-lk-quantity");if(r==null||l==null){this.showDialogError("Those two settings need to be whole numbers.");return}let c;if(n.value==="custom"&&(c=Date.parse(o.value),!Number.isFinite(c))){this.showDialogError("Pick the date and time the link should stop working.");return}this.createLink(t.id,{label:s.querySelector("#slm-ch-lk-label")?.value.trim()||null,includePublic:s.querySelector("#slm-ch-lk-public")?.checked??!1,...c===void 0?{}:{expiresAt:c},maxRedemptions:r,maxQuantity:l})})})}async createLink(e,t){await this.ensureHostedLinkRoute(e,t)&&await this.mintLink(e,t)}async mintLink(e,t){try{let s=await this.host.api.createAccessLink(this.host.eventKey,e,t);this.revealLink(s,{channelId:e}),await this.reloadAfterLinkChange(e)}catch(s){this.showDialogError(_e(s instanceof G?s:void 0)),s instanceof G||this.host.onError(s)}}async ensureHostedLinkRoute(e,t){if((this.list?.channels.find(n=>n.id===e)?.access?.intent??"none")==="hosted_link")return!0;try{return await this.host.api.setChannelAccessIntent(this.host.eventKey,e,"hosted_link"),await this.refresh(),!0}catch(n){return n instanceof G&&n.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:e,intentTo:"hosted_link",switchBlocked:n.details,pendingLink:t}),!1):(this.showDialogError(n instanceof G&&n.code==="channel_access_intent_forbids"?st(n.details):"Couldn't set this channel up for buyer links. Try again."),n instanceof G||this.host.onError(n),!1)}}revealLink(e,t){let s=e.url;this.dialog=null;let n=t.rotated?X("warn","The old link has stopped working",` ${e.endedSessions?`${e.endedSessions.toLocaleString()} ${e.endedSessions===1?"buyer":"buyers"} lost access now.`:"Buyers who already came in can finish; every new visit needs this link."}`):"";this.renderScrim(`
573
+ </div>`,s=>{let n=s.querySelector("[data-ch-lk-expiry]"),a=s.querySelector("[data-ch-lk-when-field]"),o=s.querySelector("#slm-ch-lk-when");n.addEventListener("change",()=>{let r=n.value==="custom";a.hidden=!r,r&&!o.value&&(o.value=Ni(Date.now()+7*864e5))}),s.querySelector("[data-ch-lk-create]")?.addEventListener("click",()=>{let r=Os(s,"#slm-ch-lk-redemptions"),l=Os(s,"#slm-ch-lk-quantity");if(r==null||l==null){this.showDialogError("Those two settings need to be whole numbers.");return}let c;if(n.value==="custom"&&(c=Date.parse(o.value),!Number.isFinite(c))){this.showDialogError("Pick the date and time the link should stop working.");return}this.createLink(t.id,{label:s.querySelector("#slm-ch-lk-label")?.value.trim()||null,includePublic:s.querySelector("#slm-ch-lk-public")?.checked??!1,...c===void 0?{}:{expiresAt:c},maxRedemptions:r,maxQuantity:l})})})}async createLink(e,t){await this.ensureHostedLinkRoute(e,t)&&await this.mintLink(e,t)}async mintLink(e,t){try{let s=await this.host.api.createAccessLink(this.host.eventKey,e,t);this.revealLink(s,{channelId:e}),await this.reloadAfterLinkChange(e)}catch(s){this.showDialogError(Ue(s instanceof W?s:void 0)),s instanceof W||this.host.onError(s)}}async ensureHostedLinkRoute(e,t){if((this.list?.channels.find(n=>n.id===e)?.access?.intent??"none")==="hosted_link")return!0;try{return await this.host.api.setChannelAccessIntent(this.host.eventKey,e,"hosted_link"),await this.refresh(),!0}catch(n){return n instanceof W&&n.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:e,intentTo:"hosted_link",switchBlocked:n.details,pendingLink:t}),!1):(this.showDialogError(n instanceof W&&n.code==="channel_access_intent_forbids"?at(n.details):"Couldn't set this channel up for buyer links. Try again."),n instanceof W||this.host.onError(n),!1)}}revealLink(e,t){let s=e.url;this.dialog=null;let n=t.rotated?Q("warn","The old link has stopped working",` ${e.endedSessions?`${e.endedSessions.toLocaleString()} ${e.endedSessions===1?"buyer":"buyers"} lost access now.`:"Buyers who already came in can finish; every new visit needs this link."}`):"";this.renderScrim(`
545
574
  <h3 id="slm-ch-dlg-title">Copy this link now</h3>
546
575
  <p class="sub">It is shown once. SeatLayer keeps only a fingerprint, so a lost link can be replaced but not shown again.</p>
547
576
  ${n}
548
577
  <div class="slm-ch-copyrow">
549
- <div class="slm-ch-secret" data-ch-lk-url title="${I(s)}">${I(s)}</div>
578
+ <div class="slm-ch-secret" data-ch-lk-url title="${P(s)}">${P(s)}</div>
550
579
  <button type="button" class="slm-btn" data-ch-lk-copy aria-live="polite">Copy</button>
551
580
  </div>
552
581
  <input class="slm-ch-copysink" data-ch-lk-sink tabindex="-1" aria-hidden="true" readonly />
553
- <p class="slm-note" style="margin-top:10px">${I(xi(e.link))}</p>
582
+ <p class="slm-note" style="margin-top:10px">${P(Oi(e.link))}</p>
554
583
  <div class="foot">
555
584
  <button type="button" class="slm-btn" data-ch-close data-ch-lk-done>I've copied it</button>
556
- </div>`,a=>{let o=a.querySelector("[data-ch-lk-copy]"),r=null;o?.addEventListener("click",()=>{$i(a,s).then(l=>{if(!l){o.textContent="Copy",o.classList.remove("copied"),this.announce("Copying was blocked. The link is selected \u2014 copy it by hand.");return}o.textContent="Copied",o.classList.add("copied"),this.announce("Buyer link copied."),r&&clearTimeout(r),r=setTimeout(()=>{o.textContent="Copy",o.classList.remove("copied")},1500)})})}),this.announce("Your buyer link is ready and is shown once.")}renderLinkRotateDialog(e){let t=this.linkById(e.linkId);if(!t||!this.caps.manage){this.closeDialog();return}let s=t.activeSessions??0,n=s?`${s.toLocaleString()} ${s===1?"buyer is":"buyers are"} inside with the current link. Choose what happens to them.`:"Nobody is inside with the current link right now. Choose what happens to anyone who arrives before you send the new one.";this.renderScrim(`
557
- <h3 id="slm-ch-dlg-title">Replace the ${I(t.label||"buyer")} link?</h3>
585
+ </div>`,a=>{let o=a.querySelector("[data-ch-lk-copy]"),r=null;o?.addEventListener("click",()=>{qi(a,s).then(l=>{if(!l){o.textContent="Copy",o.classList.remove("copied"),this.announce("Copying was blocked. The link is selected \u2014 copy it by hand.");return}o.textContent="Copied",o.classList.add("copied"),this.announce("Buyer link copied."),r&&clearTimeout(r),r=setTimeout(()=>{o.textContent="Copy",o.classList.remove("copied")},1500)})})}),this.announce("Your buyer link is ready and is shown once.")}renderLinkRotateDialog(e){let t=this.linkById(e.linkId);if(!t||!this.caps.manage){this.closeDialog();return}let s=t.activeSessions??0,n=s?`${s.toLocaleString()} ${s===1?"buyer is":"buyers are"} inside with the current link. Choose what happens to them.`:"Nobody is inside with the current link right now. Choose what happens to anyone who arrives before you send the new one.";this.renderScrim(`
586
+ <h3 id="slm-ch-dlg-title">Replace the ${P(t.label||"buyer")} link?</h3>
558
587
  <p class="sub">${n}</p>
559
588
  <label class="slm-ch-radio">
560
589
  <input type="radio" name="slm-ch-rot" value="keep" data-ch-rot />
561
- <span><b>Let them finish their order</b><span class="why">Every new visit needs the new link.</span></span>
590
+ <span><b>Let them finish their order</b></span>
562
591
  </label>
563
592
  <label class="slm-ch-radio">
564
593
  <input type="radio" name="slm-ch-rot" value="end" data-ch-rot />
565
- <span><b>End their access now</b><span class="why">Buyers part-way through choosing seats lose access.</span></span>
594
+ <span><b>End their access now</b></span>
566
595
  </label>
567
596
  <p class="slm-note">Choose one. SeatLayer will not decide this for you.</p>
568
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
597
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
569
598
  <div class="foot">
570
599
  <button type="button" class="quiet" data-ch-close>Cancel</button>
571
600
  <button type="button" class="slm-btn" data-ch-lk-rotate disabled>Replace and copy the new link</button>
572
- </div>`,a=>{let o=a.querySelector("[data-ch-lk-rotate]");a.querySelectorAll("[data-ch-rot]").forEach(r=>{r.addEventListener("change",()=>{o.disabled=!1})}),o.addEventListener("click",()=>{let r=[...a.querySelectorAll("[data-ch-rot]")].find(l=>l.checked);if(!r){this.showDialogError(_e({code:"end_active_sessions_required"}));return}this.rotateLink(e.channelId,t.id,r.value==="end")})})}async rotateLink(e,t,s){try{let n=await this.host.api.rotateAccessLink(this.host.eventKey,e,t,s);this.revealLink(n,{channelId:e,rotated:!0}),await this.reloadAfterLinkChange(e)}catch(n){this.showDialogError(_e(n instanceof G?n:void 0)),n instanceof G||this.host.onError(n)}}renderLinkRevokeDialog(e){let t=this.linkById(e.linkId);if(!t||!this.caps.manage){this.closeDialog();return}let s=t.activeSessions??0;this.renderScrim(`
573
- <h3 id="slm-ch-dlg-title">Revoke the ${I(t.label||"buyer")} link?</h3>
601
+ </div>`,a=>{let o=a.querySelector("[data-ch-lk-rotate]");a.querySelectorAll("[data-ch-rot]").forEach(r=>{r.addEventListener("change",()=>{o.disabled=!1})}),o.addEventListener("click",()=>{let r=[...a.querySelectorAll("[data-ch-rot]")].find(l=>l.checked);if(!r){this.showDialogError(Ue({code:"end_active_sessions_required"}));return}this.rotateLink(e.channelId,t.id,r.value==="end")})})}async rotateLink(e,t,s){try{let n=await this.host.api.rotateAccessLink(this.host.eventKey,e,t,s);this.revealLink(n,{channelId:e,rotated:!0}),await this.reloadAfterLinkChange(e)}catch(n){this.showDialogError(Ue(n instanceof W?n:void 0)),n instanceof W||this.host.onError(n)}}renderLinkRevokeDialog(e){let t=this.linkById(e.linkId);if(!t||!this.caps.manage){this.closeDialog();return}let s=t.activeSessions??0;this.renderScrim(`
602
+ <h3 id="slm-ch-dlg-title">Revoke the ${P(t.label||"buyer")} link?</h3>
574
603
  <p class="sub">It stops opening immediately and cannot be restored \u2014 there is no undo, and no way to
575
604
  bring the same URL back. Seats already bought through it keep their sale.</p>
576
605
  ${s?`<label class="slm-ch-radio">
@@ -579,41 +608,45 @@
579
608
  buyer${s===1?"":"s"} already inside</b><span class="why">Leave this off and they can
580
609
  finish what they started; new visits are refused either way.</span></span>
581
610
  </label>`:""}
582
- <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${I(e.error??"")}</p>
611
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${P(e.error??"")}</p>
583
612
  <div class="foot">
584
613
  <button type="button" class="quiet" data-ch-close>Cancel</button>
585
614
  <button type="button" class="slm-btn danger" data-ch-lk-revoke>Revoke link</button>
586
- </div>`,n=>{n.querySelector("[data-ch-lk-revoke]")?.addEventListener("click",()=>{let a=n.querySelector("[data-ch-lk-endsessions]")?.checked??!1;this.revokeLink(e.channelId,t.id,a)})})}async revokeLink(e,t,s){try{let n=await this.host.api.revokeAccessLink(this.host.eventKey,e,t,s);this.closeDialog(),await this.reloadAfterLinkChange(e),this.host.toast(n.endedSessions?`Link revoked. ${n.endedSessions.toLocaleString()} buyer${n.endedSessions===1?"":"s"} lost access.`:"Link revoked. It no longer opens for anyone.","ok")}catch(n){this.showDialogError(_e(n instanceof G?n:void 0)),n instanceof G||this.host.onError(n)}}applySheetClasses(){let e=this.host.root,t=this.host.isCompact();e.classList.toggle("ch-sheet",t&&this.active);for(let s of["collapsed","medium","full"])e.classList.toggle(`detent-${s}`,t&&this.active&&this.detent===s);this.host.setMapInert(t&&this.active&&this.detent==="full")}cycleDetent(){let e=["collapsed","medium","full"];this.detent=e[(e.indexOf(this.detent)+1)%e.length],this.applySheetClasses()}handleBack(){return this.scrimEl?(this.closeDialog(),!0):this.host.isCompact()&&this.detent==="full"?(this.detent="medium",this.applySheetClasses(),!0):!1}}});function Bi(i){let e=new Map,t=new Map;for(let s of i){let n=e.get(s.sectionId)??{id:s.sectionId,label:s.sectionLabel,words:Pi(s.sectionLabel),labels:[]};n.labels.push(s.label),e.set(s.sectionId,n);let a=t.get(s.rowKey)??{key:s.rowKey,row:s.row,sectionId:s.sectionId,sectionLabel:s.sectionLabel,labels:[]};a.labels.push(s.label),t.set(s.rowKey,a)}return{seats:i,sections:[...e.values()],rows:[...t.values()]}}function br(i,e){let t=/[a-z0-9]+/g,s=0;for(let n=0;n<e;n+=1){let a=t.exec(i);if(!a)break;s=a.index+a[0].length}return i.slice(s).replace(/^[^a-z0-9]+/,"")}function Oi(i,e,t){let s=e.trim().toLowerCase(),n={seats:[],rows:[],sections:[],state:null};if(!s)return n;let a=pr[s];if(a)return n.state={status:a,labels:i.seats.filter(u=>t(u.label)===a).map(u=>u.label)},n;let o=Pi(s),r=null;for(let u of i.sections){let m=0;for(;m<o.length&&m<u.words.length&&u.words[m].startsWith(o[m]);)m+=1;if(m===o.length)n.sections.push(u);else if(m===u.words.length&&m>0&&o.slice(0,m).every((v,$)=>v===u.words[$])){let v=br(s,m);r=r&&r.rest===v?r:{ids:new Set,rest:v},r.ids.add(u.id)}}let l=r?r.rest:s,c=u=>!r||r.ids.has(u),d=gr.exec(l);if(d){let[,u,m,v]=d,$=Number(m),A=v?Number(v):$;n.seats=i.seats.filter(O=>c(O.sectionId)&&it(O.row)===u&&Number(O.number)>=Math.min($,A)&&Number(O.number)<=Math.max($,A))}let b=fr.exec(l),f=b?.[1]??b?.[2];if(f&&(n.rows=i.rows.filter(u=>c(u.sectionId)&&it(u.row)===f)),!n.seats.length&&!n.rows.length&&!n.sections.length&&it(s).length>=2){let u=it(s);n.seats=i.seats.filter(m=>it(m.label).includes(u)||it(`${m.sectionLabel}${m.row}${m.number}`).includes(u))}return n}function Di(i,e,t){let s=i.lastIndexOf("-"),n=s>0?i.slice(0,s):i,a=s>0?i.slice(s+1):"";return{row:t?.trim()||(n.toLowerCase().startsWith(`${e.toLowerCase()} `)?n.slice(e.length+1):n),number:a}}var pr,it,Pi,gr,fr,zi=Y(()=>{"use strict";pr={free:"free",available:"free",held:"held",hold:"held",sold:"booked",booked:"booked",blocked:"blocked"};it=i=>i.toLowerCase().replace(/[^a-z0-9]/g,""),Pi=i=>i.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean),gr=/^(?:row\s*)?([a-z]{1,3}|\d{1,3})\s*[-\s]?\s*(\d{1,4})(?:\s*(?:-|to)\s*(?:[a-z]{1,3}\s*-?\s*)?(\d{1,4}))?$/,fr=/^(?:row\s*)([a-z]{1,3}|\d{1,3})$|^([a-z]{1,2})$/});function wr(i){let e=[...new Set(i)],t=(n,a)=>n.localeCompare(a,void 0,{numeric:!0});if(e.length<2||!(e.every(n=>/^[A-Z]{1,2}$/i.test(n))||e.every(n=>/^\d+$/.test(n))))return"";let s=e.sort(t);return`This chart has rows ${s[0]} to ${s[s.length-1]}. `}function Sr(i){return Es?.from!==i&&(Es={from:i,index:Bi(i.map(e=>({...e,...Di(e.label,e.sectionLabel,e.rowDisplay)})))}),Es.index}function _i(i,e=""){let t=()=>Sr(i.seats()),s=document.createElement("div");s.className="slm-search-scrim",s.innerHTML=`<div class="slm-search" role="dialog" aria-modal="true" aria-label="Search the event">
587
- <label class="slm-search-field">${Re("search","#4c6fff")}<input type="search" aria-label="Search the event" placeholder="Seat, row, section, booking or buyer" autocomplete="off"><kbd>esc</kbd></label>
615
+ </div>`,n=>{n.querySelector("[data-ch-lk-revoke]")?.addEventListener("click",()=>{let a=n.querySelector("[data-ch-lk-endsessions]")?.checked??!1;this.revokeLink(e.channelId,t.id,a)})})}async revokeLink(e,t,s){try{let n=await this.host.api.revokeAccessLink(this.host.eventKey,e,t,s);this.closeDialog(),await this.reloadAfterLinkChange(e),this.host.toast(n.endedSessions?`Link revoked. ${n.endedSessions.toLocaleString()} buyer${n.endedSessions===1?"":"s"} lost access.`:"Link revoked. It no longer opens for anyone.","ok")}catch(n){this.showDialogError(Ue(n instanceof W?n:void 0)),n instanceof W||this.host.onError(n)}}applySheetClasses(){let e=this.host.root,t=this.host.isCompact();e.classList.toggle("ch-sheet",t&&this.active);for(let s of["collapsed","medium","full"])e.classList.toggle(`detent-${s}`,t&&this.active&&this.detent===s);this.host.setMapInert(t&&this.active&&this.detent==="full")}cycleDetent(){let e=["collapsed","medium","full"];this.detent=e[(e.indexOf(this.detent)+1)%e.length],this.applySheetClasses()}handleBack(){return this.scrimEl?(this.closeDialog(),!0):this.host.isCompact()&&this.detent==="full"?(this.detent="medium",this.applySheetClasses(),!0):!1}}});function Xi(i){let e=new Map,t=new Map;for(let s of i){let n=e.get(s.sectionId)??{id:s.sectionId,label:s.sectionLabel,words:Zi(s.sectionLabel),labels:[]};n.labels.push(s.label),e.set(s.sectionId,n);let a=t.get(s.rowKey)??{key:s.rowKey,row:s.row,sectionId:s.sectionId,sectionLabel:s.sectionLabel,labels:[]};a.labels.push(s.label),t.set(s.rowKey,a)}return{seats:i,sections:[...e.values()],rows:[...t.values()]}}function qr(i,e){let t=/[a-z0-9]+/g,s=0;for(let n=0;n<e;n+=1){let a=t.exec(i);if(!a)break;s=a.index+a[0].length}return i.slice(s).replace(/^[^a-z0-9]+/,"")}function zs(i,e,t){let s=e.trim().toLowerCase(),n={seats:[],rows:[],sections:[],state:null};if(!s)return n;let a=Nr[s];if(a)return n.state={status:a,labels:i.seats.filter(m=>t(m.label)===a).map(m=>m.label)},n;let o=Zi(s),r=null;for(let m of i.sections){let p=0;for(;p<o.length&&p<m.words.length&&m.words[p].startsWith(o[p]);)p+=1;if(p===o.length)n.sections.push(m);else if(p===m.words.length&&p>0&&o.slice(0,p).every((f,k)=>f===m.words[k])){let f=qr(s,p);r=r&&r.rest===f?r:{ids:new Set,rest:f},r.ids.add(m.id)}}let l=r?r.rest:s,c=m=>!r||r.ids.has(m),d=_r.exec(l);if(d){let[,m,p,f]=d,k=Number(p),A=f?Number(f):k;n.seats=i.seats.filter(B=>c(B.sectionId)&&rt(B.row)===m&&Number(B.number)>=Math.min(k,A)&&Number(B.number)<=Math.max(k,A))}let g=jr.exec(l),b=g?.[1]??g?.[2];if(b&&(n.rows=i.rows.filter(m=>c(m.sectionId)&&rt(m.row)===b)),!n.seats.length&&!n.rows.length&&!n.sections.length&&rt(s).length>=2){let m=rt(s);n.seats=i.seats.filter(p=>rt(p.label).includes(m)||rt(`${p.sectionLabel}${p.row}${p.number}`).includes(m))}return n}function Ji(i,e,t){let s=i.lastIndexOf("-"),n=s>0?i.slice(0,s):i,a=s>0?i.slice(s+1):"";return{row:t?.trim()||(n.toLowerCase().startsWith(`${e.toLowerCase()} `)?n.slice(e.length+1):n),number:a}}var Nr,rt,Zi,_r,jr,Qi=Y(()=>{"use strict";Nr={free:"free",available:"free",held:"held",hold:"held",sold:"booked",booked:"booked",blocked:"blocked"};rt=i=>i.toLowerCase().replace(/[^a-z0-9]/g,""),Zi=i=>i.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean),_r=/^(?:row\s*)?([a-z]{1,3}|\d{1,3})\s*[-\s]?\s*(\d{1,4})(?:\s*(?:-|to)\s*(?:[a-z]{1,3}\s*-?\s*)?(\d{1,4}))?$/,jr=/^(?:row\s*)([a-z]{1,3}|\d{1,3})$|^([a-z]{1,2})$/});function Gr(i){let e=[...new Set(i)],t=(n,a)=>n.localeCompare(a,void 0,{numeric:!0});if(e.length<2||!(e.every(n=>/^[A-Z]{1,2}$/i.test(n))||e.every(n=>/^\d+$/.test(n))))return"";let s=e.sort(t);return`This chart has rows ${s[0]} to ${s[s.length-1]}. `}function Yr(i){return Ns?.from!==i&&(Ns={from:i,index:Xi(i.map(e=>({...e,...Ji(e.label,e.sectionLabel,e.rowDisplay)})))}),Ns.index}function sa(i,e=""){let t=()=>Yr(i.seats()),s=document.createElement("div");s.className="slm-search-scrim",s.innerHTML=`<div class="slm-search${i.touch?" touch":""}" role="dialog" aria-modal="true" aria-label="Search the event">
616
+ <label class="slm-search-field">${Ke("search","#4c6fff",17)}<input type="search" aria-label="Search the event" placeholder="Seat, row, section, booking or buyer" autocomplete="off">${i.touch?'<button type="button" class="slm-search-cancel" data-search-cancel>Cancel</button>':`<button type="button" class="slm-search-clear" data-search-clear aria-label="Clear the search" hidden>${Ke("x","var(--slm-muted)")}</button><kbd>esc</kbd>`}</label>
588
617
  <div class="slm-search-body" role="listbox" aria-label="Results"></div>
589
- <div class="slm-search-foot"><span><kbd>\u2191</kbd> <kbd>\u2193</kbd> move</span><span><kbd>\u21B5</kbd> show / select</span><span><kbd>\u21E7</kbd><kbd>\u21B5</kbd> add to selection</span><span><kbd>esc</kbd> close</span></div>
590
- </div>`,i.root.append(s);let n=s.querySelector("input"),a=s.querySelector(".slm-search-body"),o=[],r=0,l={query:"",list:null},c,d=document.activeElement,b=()=>{(d?.isConnected&&i.root.contains(d)?d:i.root).focus?.({preventScroll:!0})},f=(h=!0)=>{clearTimeout(c),s.remove(),h&&b()},u=()=>i.recents.read().flatMap(h=>{try{let p=JSON.parse(h);return p&&typeof p.q=="string"?[p]:[]}catch{return h?[{q:h,t:h,d:"",at:0,g:"search",h:"#4c6fff"}]:[]}}),m=(h,p)=>{if(!h)return;let g=h.query??n.value.trim();if(g){let y={q:g,t:h.title,d:h.detail,at:Date.now(),g:h.glyph,h:h.hue};i.recents.write([JSON.stringify(y),...u().filter(L=>L.q!==g).map(L=>JSON.stringify(L))].slice(0,6))}f(!1),h.savedId?i.useSaved?.(h.savedId,p):((p||i.canSelect())&&i.select(h.labels),i.show(h.labels)),b()},v=(h,p)=>`<button type="button" class="slm-search-row" role="option" data-i="${p}" aria-selected="${p===r}">${Re(h.glyph,h.hue)}<span class="t"><b>${ce(h.title)}</b><small>${ce(h.detail)}</small></span>${h.right?`<em>${ce(h.right)}</em>`:p===r?"<em>Show</em>":""}${p===r?"<kbd>\u21B5</kbd>":""}</button>`+(h.order&&i.openOrder&&!$?`<div class="slm-search-order"><button type="button" data-open-order="${ce(h.order.id)}" data-ref="${ce(h.order.displayRef)}">Open order</button></div>`:""),$=!1,A=h=>yr[h.status]??((h.totalMinor??1)>0?"Paid":"Booked"),O=h=>{let p=x=>{let M=x.lastIndexOf(" ");return M>0?[x.slice(0,M),x.slice(M+1)]:["",x]},g=p(h.seatLabels[0]??"")[0],y=!!g&&h.seatLabels.every(x=>p(x)[0]===g),L=h.seatLabels.slice(0,4).map((x,M)=>`<span>${ce(y?M?p(x)[1]:`${g} \xB7 ${p(x)[1]}`:x)}</span>`).join("")+(h.seatLabels.length>4?`<span>+${h.seatLabels.length-4}</span>`:""),C=[h.buyerName,h.buyerEmail,h.createdAt?`booked ${kr(h.createdAt)}`:null].filter(Boolean).join(" \xB7 ");return`<div class="slm-search-card"><header>${Re("ticket","#8b5cf6")}<span class="t"><b>${ce(h.displayRef)}</b><small>${ce(C)}</small></span><span class="pill">${ce(A(h))}</span></header><div class="slm-search-seats">${L}</div><div class="slm-search-acts"><button type="button" data-card="show">${Re("map","#3b82f6")}Show on map</button><button type="button" data-card="select">${Re("cursor","#d99a0b")}Select these seats</button>`+(i.openOrder?`<button type="button" data-open-order="${ce(h.id)}" data-ref="${ce(h.displayRef)}">${Re("ticket","#8b5cf6")}Open order</button>`:"")+"</div></div>"},B=()=>{let h=n.value.trim();if($=!1,!h){let R=t(),_=R.seats[Math.floor(R.seats.length/2)],ne=[_?`${_.row}-${_.number}`:null,R.sections[0]?.label,R.rows[0]?`Row ${R.rows[0].row}`:null,"blocked",i.lookupOrders?"@gmail.com":null].filter((P,j,Q)=>P&&Q.indexOf(P)===j),E=u();o=E.map(P=>({title:P.t,detail:P.d,right:P.at?xr(P.at):"",glyph:P.g,hue:P.h,labels:[],query:P.q})),r=Math.min(r,Math.max(0,o.length-1)),a.innerHTML=(E.length?`<h3>Recent</h3>${o.map((P,j)=>v(P,j).replace("data-i=",`data-recent="${ce(P.query)}" data-i=`)).join("")}`:"")+`<h3>Try</h3><div class="slm-search-tries">${ne.map(P=>`<button type="button" data-try="${ce(P)}">${ce(P)}</button>`).join("")}</div>`;return}let p=Oi(t(),h,i.statusOf),g=[],y=h.toLowerCase(),L=(i.saved?.()??[]).filter(R=>R.name.toLowerCase().includes(y)).slice(0,at);L.length&&g.push(["Saved selections",L.map(R=>({title:R.name,detail:[`${R.count.toLocaleString()} ${R.count===1?"seat":"seats"}`,R.where,R.byYou?"by you":R.byName?`by ${R.byName}`:""].filter(Boolean).join(" \xB7 "),right:i.canSelect()?"Select":"Show",glyph:"star",hue:"#d99a0b",labels:[],savedId:R.id}))]);let C=i.blockedBy?.(h)??[];C.length&&g.push(["Blocked",C.slice(0,at).map(R=>({title:R.reason,detail:`${R.labels.length.toLocaleString()} blocked ${R.labels.length===1?"seat":"seats"} \xB7 the block reason`,right:"Show",glyph:"ban",hue:"#d64545",labels:R.labels}))]);let x=i.reserved?.(),M=x?.labels.length?{title:"Reserved seats",glyph:"bookmark",hue:"#c026d3",labels:x.labels,detail:`${x.labels.length.toLocaleString()} in ${x.count} ${x.count===1?"reservation":"reservations"}`}:null;if(M&&/^reserv(ed|ations?)$/.test(h.trim().toLowerCase())&&g.push(["Seats",[M]]),p.state){let R=p.state.status==="blocked"&&M?p.state.labels.filter(ne=>!M.labels.includes(ne)):p.state.labels,_=p.state.status==="blocked"?i.blockReasons?.()??null:null;g.push(["Seats",[{title:`${Ni[p.state.status]} seats`,detail:`${R.length.toLocaleString()} on the map${_?` \xB7 ${_} ${_===1?"reason":"reasons"}`:""}`,glyph:p.state.status==="blocked"?"ban":"seat",hue:Fi[p.state.status],labels:R},...p.state.status==="blocked"&&M?[M]:[]]])}if(p.seats.length&&(g.push(["Seats",p.seats.slice(0,p.seats.length>3?3:at).map(R=>{let _=i.statusOf(R.label),ne=i.describe?.(R.label);return{title:`${R.sectionLabel} \xB7 ${R.row}-${R.number}`,detail:[`Row ${R.row}, seat ${R.number}`,Ni[_],ne].filter(Boolean).join(" \xB7 "),glyph:"seat",hue:Fi[_],labels:[R.label]}})]),p.seats.length>1)){let R=p.seats.every(_=>_.row===p.seats[0].row&&_.number===p.seats[0].number);g[g.length-1][1].push({title:R?`All ${p.seats.length.toLocaleString()} seats ${p.seats[0].row}-${p.seats[0].number}`:`All ${p.seats.length.toLocaleString()} matching seats`,detail:"Show or select them together",right:"Select all",glyph:"section",hue:"#0ea5a5",labels:p.seats.map(_=>_.label)})}if(p.rows.length){let R=p.rows.flatMap(_=>_.labels);g.push(["Rows",[...p.rows.length>1?[{title:`Row ${p.rows[0].row} in ${p.rows.length} sections`,detail:`${R.length.toLocaleString()} seats \xB7 ${R.filter(_=>i.statusOf(_)==="free").length.toLocaleString()} free`,right:"Select all",glyph:"row",hue:"#3b82f6",labels:R}]:[],...p.rows.slice(0,at).map(_=>({title:`${_.sectionLabel} \xB7 row ${_.row}`,detail:`${_.labels.length.toLocaleString()} seats`,glyph:"row",hue:"#3b82f6",labels:_.labels}))]])}p.sections.length&&g.push(["Sections",p.sections.slice(0,at).map(R=>({title:R.label,detail:`${R.labels.length.toLocaleString()} seats`,glyph:"section",hue:"#0ea5a5",labels:R.labels}))]);let H=l.query===h?l.list??[]:[],F=H.slice(0,at).map(R=>({title:R.displayRef,detail:[R.buyerName,R.buyerEmail].filter(Boolean).join(" \xB7 ")||"No buyer details",right:`${R.seatLabels.length} ${R.seatLabels.length===1?"seat":"seats"}`,glyph:"ticket",hue:"#8b5cf6",labels:R.seatLabels,order:R}));o=g.flatMap(([,R])=>R).concat(F),r=Math.min(r,Math.max(0,o.length-1));let N=i.lookupOrders&&h.length>=3&&l.query!==h,K=l.query===h&&l.failed,se=0,ae=g.map(([R,_])=>`<h3>${R}</h3>${_.map(ne=>v(ne,se++)).join("")}`).join("");if(H.length===1){$=!0;let R=H[0],_=H.filter(ne=>ne.buyerEmail&&ne.buyerEmail===R.buyerEmail);if(ae+=`<h3>Booking</h3>${O(R)}`,R.buyerName||R.buyerEmail){let ne=_.reduce((E,P)=>E+P.seatLabels.length,0);ae+=`<h3>Buyer</h3><div class="slm-search-row" style="cursor:default">${Re("user","#0ea5a5")}<span class="t"><b>${ce(R.buyerName??R.buyerEmail)}</b><small>${_.length} ${_.length===1?"booking":"bookings"} for this event \xB7 ${ne} ${ne===1?"seat":"seats"}</small></span></div>`}se++}else F.length&&(ae+=`<h3>Bookings</h3>${F.map(R=>v(R,se++)).join("")}`);let xe=wr(t().rows.map(R=>R.row));a.innerHTML=ae+(N?'<h3>Bookings and buyers \xB7 searching\u2026</h3><div class="slm-search-skel" style="width:60%"></div><div class="slm-search-skel" style="width:45%"></div>':"")+(K?`<h3>Bookings and buyers</h3><div class="slm-search-fail">${Re("alert","#d64545")}<span>Bookings couldn\u2019t load. ${o.length?"Seats above are still right.":""}</span><button type="button" data-retry>Try again</button></div>`:"")+(!o.length&&!N&&!K?`<div class="slm-search-empty">${Re("search","#4c6fff")}<b>Nothing matches \u201C${ce(h)}\u201D</b>${i.lookupOrders?`${xe}Try a seat like G-5, a section, a booking number, or a buyer\u2019s name or email.`:"This search covers seats, rows and sections. Bookings and buyers need order access for this event."}</div>`:"")},k=()=>{clearTimeout(c);let h=n.value.trim();!i.lookupOrders||h.length<3||(c=setTimeout(()=>{i.lookupOrders(h).then(p=>{n.value.trim()===h&&(l={query:h,list:p.orders},B())}).catch(()=>{n.value.trim()===h&&(l={query:h,list:[],failed:!0},B())})},250))};return n.addEventListener("input",()=>{r=0,B(),k()}),n.addEventListener("keydown",h=>{if(h.key==="ArrowDown"||h.key==="ArrowUp"){if(h.preventDefault(),!o.length)return;r=(r+(h.key==="ArrowDown"?1:o.length-1))%o.length,B(),a.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})}else if(h.key==="Enter"){h.preventDefault();let p=o[r];if(p&&!n.value.trim()&&p.query){n.value=p.query,n.dispatchEvent(new Event("input"));return}m(p,h.shiftKey)}}),s.addEventListener("keydown",h=>{h.key==="Escape"&&(h.stopPropagation(),f())}),s.addEventListener("click",h=>{let p=h.target;if(p===s){f();return}let g=p.closest("[data-try]");if(g){n.value=g.dataset.try,n.dispatchEvent(new Event("input")),n.focus();return}let y=p.closest("[data-recent]");if(y){n.value=y.dataset.recent,n.dispatchEvent(new Event("input")),n.focus();return}if(p.closest("[data-retry]")){l={query:"",list:null},B(),k();return}let L=p.closest("[data-open-order]");if(L){f(),i.openOrder?.({id:L.dataset.openOrder,displayRef:L.dataset.ref});return}let C=p.closest("[data-card]");if(C){let M=(l.list??[])[0];M&&m({title:M.displayRef,detail:M.buyerName??"",glyph:"ticket",hue:"#8b5cf6",labels:M.seatLabels},C.dataset.card==="select");return}let x=p.closest("[data-i]");x&&m(o[Number(x.dataset.i)],h.shiftKey)}),n.value=e,B(),k(),n.focus(),{close:f}}var vr,Re,ce,Ni,Fi,yr,xr,kr,at,qi,Es,Rs=Y(()=>{"use strict";zi();me();vr={seat:'<path d="M7 11V6.5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2V11"/><path d="M5 11h14v4H5z"/><path d="M7 15v4.5M17 15v4.5"/>',row:'<circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/>',section:'<path d="M12 3.5l8.5 4.5L12 12.5 3.5 8z"/><path d="M3.5 12L12 16.5 20.5 12"/><path d="M3.5 16L12 20.5 20.5 16"/>',ticket:'<path d="M3.5 7.5h17v3a2 2 0 0 0 0 4v3h-17v-3a2 2 0 0 0 0-4z"/>',search:'<circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 20c1.5-4 4.5-6 8-6s6.5 2 8 6"/>',bookmark:'<path d="M6.5 3.5h11v17l-5.5-4-5.5 4z"/>',map:'<path d="M3.5 6.5l5-2 7 2.5 5-2v13l-5 2-7-2.5-5 2z"/><path d="M8.5 4.5v13M15.5 7v13"/>',cursor:'<path d="M5 3.5l13 7-5.6 1.6L10 18z"/>',alert:'<path d="M12 3.8l9.3 16.2H2.7z"/><path d="M12 10v4.5M12 17.3v.2"/>',ban:'<circle cx="12" cy="12" r="8.5"/><path d="M6 18L18 6"/>',star:'<path d="M12 3.8l2.5 5.2 5.7.8-4.1 4 1 5.6L12 16.8l-5.1 2.6 1-5.6-4.1-4 5.7-.8z"/>'},Re=(i,e)=>`<span class="plate" style="background:color-mix(in srgb,${e} 15%,transparent)"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="${e}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${vr[i]}</svg></span>`,ce=i=>String(i??"").replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),Ni={free:"Free",held:"In a cart",booked:"Sold",blocked:"Blocked"},Fi={free:"#22a06b",held:"#d99a0b",booked:"#8a94a6",blocked:"#d64545"},yr={refunded:"Refunded",cancelled:"Cancelled",pending:"Pending",partially_refunded:"Part refunded"},xr=i=>{let e=Math.round((Date.now()-i)/6e4);return e<1?"just now":e<60?`${e} min ago`:e<1440?`${Math.round(e/60)} h ago`:"earlier"},kr=i=>W(i,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});at=8,qi=`
618
+ ${i.touch?"":'<div class="slm-search-foot"><span><kbd>\u2191</kbd> <kbd>\u2193</kbd> move</span><span><kbd>\u21B5</kbd> show / select</span><span><kbd>\u21E7</kbd><kbd>\u21B5</kbd> add to selection</span><span><kbd>esc</kbd> close</span></div>'}
619
+ </div>`,i.root.append(s);let n=s.querySelector("input"),a=s.querySelector(".slm-search-body"),o=[],r=0,l={query:"",list:null},c=new Map,d,g,b=document.activeElement,m=()=>{(b?.isConnected&&i.root.contains(b)?b:i.root).focus?.({preventScroll:!0})},p=(h=!0)=>{clearTimeout(g),s.remove(),h&&m()},f=()=>i.recents.read().flatMap(h=>{try{let v=JSON.parse(h);return v&&typeof v.q=="string"?[v]:[]}catch{return h?[{q:h,t:h,d:"",at:0,g:"search",h:"#4c6fff"}]:[]}}),k=(h,v)=>{if(!h)return;let C=h.query??n.value.trim();if(C){let E=h.labels.length,L=h.order?[h.order.buyerName??h.order.buyerEmail,`${E} ${E===1?"seat":"seats"}`].filter(Boolean).join(" \xB7 "):h.glyph==="seat"&&E===1?[Fs[i.statusOf(h.labels[0])],c.get(h.labels[0])].filter(Boolean).join(" \xB7 "):h.detail,M={q:C,t:h.title,d:L,at:Date.now(),g:h.glyph,h:h.hue};i.recents.write([JSON.stringify(M),...f().filter(R=>R.q!==C).map(R=>JSON.stringify(R))].slice(0,6))}p(!1),h.savedId?i.useSaved?.(h.savedId,v):((v||i.canSelect())&&i.select(h.labels),i.show(h.labels)),m()},A=(h,v)=>`<button type="button" class="slm-search-row" role="option" data-i="${v}" aria-selected="${v===r}">${ns(h.glyph,h.hue)}<span class="t"><b>${de(h.title)}</b><small>${de(h.detail)}</small></span>${h.right?`<em>${de(h.right)}</em>`:v===r?"<em>Show</em>":""}${v===r?"<kbd>\u21B5</kbd>":""}</button>`+(h.order&&i.openOrder&&!B?`<div class="slm-search-order"><button type="button" data-open-order="${de(h.order.id)}" data-ref="${de(h.order.displayRef)}">Open order</button></div>`:""),B=!1,O=h=>Ur[h.status]??((h.totalMinor??1)>0?"Paid":"Booked"),I=h=>{let v=R=>{let N=R.lastIndexOf(" ");return N>0?[R.slice(0,N),R.slice(N+1)]:["",R]},C=v(h.seatLabels[0]??"")[0],E=!!C&&h.seatLabels.every(R=>v(R)[0]===C),L=h.seatLabels.slice(0,4).map((R,N)=>`<span>${de(E?N?v(R)[1]:`${C} \xB7 ${v(R)[1]}`:R)}</span>`).join("")+(h.seatLabels.length>4?`<span>+${h.seatLabels.length-4}</span>`:""),M=[h.buyerName,h.buyerEmail,h.createdAt?`booked ${Wr(h.createdAt)}`:null].filter(Boolean).join(" \xB7 ");return`<div class="slm-search-card"><header>${ns("ticket","#8b5cf6",17)}<span class="t"><b>${de(h.displayRef)}</b><small>${de(M)}</small></span><span class="pill">${de(O(h))}</span></header><div class="slm-search-seats">${L}</div><div class="slm-search-acts"><button type="button" data-card="show">${Ke("map","#3b82f6",16)}Show on map</button><button type="button" data-card="select">${Ke("cursor","#d99a0b",16)}Select these seats</button>`+(i.openOrder?`<button type="button" data-open-order="${de(h.id)}" data-ref="${de(h.displayRef)}">${Ke("ticket","#8b5cf6",16)}Open order</button>`:"")+"</div></div>"},u=()=>{let h=n.value.trim();if(B=!1,!h){let w=t(),H=w.seats[Math.floor(w.seats.length/2)],D=[H?`${H.row}-${H.number}`:null,w.sections[0]?.label,w.rows[0]?`Row ${w.rows[0].row}`:null,"blocked",i.lookupOrders?"@gmail.com":null].filter((q,te,ie)=>q&&ie.indexOf(q)===te),U=f();o=U.map(q=>({title:q.t,detail:q.d,right:q.at?Kr(q.at):"",glyph:q.g,hue:q.h,labels:[],query:q.q})),r=Math.min(r,Math.max(0,o.length-1)),a.innerHTML=(U.length?`<h3>Recent</h3>${o.map((q,te)=>A(q,te).replace("data-i=",`data-recent="${de(q.query)}" data-i=`)).join("")}`:"")+`<h3>Try</h3><div class="slm-search-tries">${D.map(q=>`<button type="button" data-try="${de(q)}">${de(q)}</button>`).join("")}</div>`;return}let v=zs(t(),h,i.statusOf),C=[],E=h.toLowerCase(),L=(i.saved?.()??[]).filter(w=>w.name.toLowerCase().includes(E)).slice(0,lt);L.length&&C.push(["Saved selections",L.map(w=>({title:w.name,detail:[`${w.count.toLocaleString()} ${w.count===1?"seat":"seats"}`,w.where,w.byYou?"by you":w.byName?`by ${w.byName}`:""].filter(Boolean).join(" \xB7 "),right:i.canSelect()?"Select":"Show",glyph:"star",hue:"#d99a0b",labels:[],savedId:w.id}))]);let M=i.blockedBy?.(h)??[];M.length&&C.push(["Blocked",M.slice(0,lt).map(w=>({title:w.reason,detail:`${w.labels.length.toLocaleString()} blocked ${w.labels.length===1?"seat":"seats"} \xB7 the block reason`,right:"Show",glyph:"ban",hue:"#d64545",labels:w.labels}))]);let R=i.reserved?.(),N=R?.labels.length?{title:"Reserved seats",glyph:"bookmark",hue:"#c026d3",labels:R.labels,detail:`${R.labels.length.toLocaleString()} in ${R.count} ${R.count===1?"reservation":"reservations"}`}:null;if(N&&/^reserv(ed|ations?)$/.test(h.trim().toLowerCase())&&C.push(["Seats",[N]]),v.state){let w=v.state.status==="blocked"&&N?v.state.labels.filter(D=>!N.labels.includes(D)):v.state.labels,H=v.state.status==="blocked"?i.blockReasons?.()??null:null;C.push(["Seats",[{title:`${Fs[v.state.status]} seats`,detail:`${w.length.toLocaleString()} on the map${H?` \xB7 ${H} ${H===1?"reason":"reasons"}`:""}`,glyph:v.state.status==="blocked"?"ban":"seat",hue:ea[v.state.status],labels:w},...v.state.status==="blocked"&&N?[N]:[]]])}if(v.seats.length&&(C.push(["Seats",v.seats.slice(0,v.seats.length>3?3:lt).map(w=>{let H=i.statusOf(w.label),D=i.describe?.(w.label);return{title:`${w.sectionLabel} \xB7 ${w.row}-${w.number}`,detail:[`Row ${w.row}, seat ${w.number}`,Fs[H],D].filter(Boolean).join(" \xB7 "),glyph:"seat",hue:ea[H],labels:[w.label]}})]),v.seats.length>1)){let w=v.seats.every(H=>H.row===v.seats[0].row&&H.number===v.seats[0].number);C[C.length-1][1].push({title:w?`All ${v.seats.length.toLocaleString()} seats ${v.seats[0].row}-${v.seats[0].number}`:`All ${v.seats.length.toLocaleString()} matching seats`,detail:"Show or select them together",right:"Select all",glyph:"section",hue:"#0ea5a5",labels:v.seats.map(H=>H.label)})}if(v.rows.length){let w=v.rows.flatMap(H=>H.labels);C.push(["Rows",[...v.rows.length>1?[{title:`Row ${v.rows[0].row} in ${v.rows.length} sections`,detail:`${w.length.toLocaleString()} seats \xB7 ${w.filter(H=>i.statusOf(H)==="free").length.toLocaleString()} free`,right:"Select all",glyph:"row",hue:"#3b82f6",labels:w}]:[],...v.rows.slice(0,lt).map(H=>({title:`${H.sectionLabel} \xB7 row ${H.row}`,detail:`${H.labels.length.toLocaleString()} seats`,glyph:"row",hue:"#3b82f6",labels:H.labels}))]])}v.sections.length&&C.push(["Sections",v.sections.slice(0,lt).map(w=>({title:w.label,detail:`${w.labels.length.toLocaleString()} seats`,glyph:"section",hue:"#0ea5a5",labels:w.labels}))]);let j=l.query===h?l.list??[]:[],ee=j.slice(0,lt).map(w=>{let H=new Set(w.seatLabels.map(D=>D.slice(0,Math.max(0,D.lastIndexOf(" ")))));return{title:w.displayRef,glyph:"ticket",hue:"#8b5cf6",labels:w.seatLabels,order:w,detail:[w.buyerName??w.buyerEmail??"No buyer details",`${w.seatLabels.length} ${w.seatLabels.length===1?"seat":"seats"}`,H.size===1?[...H][0]:""].filter(Boolean).join(" \xB7 ")}});o=C.flatMap(([,w])=>w).concat(ee),r=Math.min(r,Math.max(0,o.length-1));let J=i.lookupOrders&&h.length>=2&&l.query!==h,X=l.query===h&&l.failed,ne=0,ye=C.map(([w,H])=>`<h3>${w}</h3>${H.map(D=>A(D,ne++)).join("")}`).join("");if(j.length===1&&!C.length){B=!0;let w=j[0],H=w.buyerEmail?.toLowerCase();if(H&&h.toLowerCase()===H)d={email:H,list:j};else if(H&&i.lookupOrders&&d?.email!==H){let U=d={email:H,list:null};i.lookupOrders(H).then(q=>{U.list=q.orders},()=>{U.list=[]}).then(()=>{d===U&&u()})}let D=H?d?.list?.length?d.list.filter(U=>U.buyerEmail?.toLowerCase()===H):null:[w];if(D&&!D.some(U=>U.id===w.id)&&D.push(w),ye+=`<h3>Booking</h3>${I(w)}`,w.buyerName||w.buyerEmail){let U=D?.reduce((q,te)=>q+te.seatLabels.length,0)??0;ye+=`<h3>Buyer</h3><div class="slm-search-row" style="cursor:default">${ns("user","#0ea5a5")}<span class="t"><b>${de(w.buyerName??w.buyerEmail)}</b><small>${D?`${D.length} ${D.length===1?"booking":"bookings"} for this event \xB7 ${U} ${U===1?"seat":"seats"}`:de(w.buyerEmail)}</small></span></div>`}ne++}else ee.length&&(ye+=`<h3>Bookings</h3>${ee.map(w=>A(w,ne++)).join("")}`);let he=Gr(t().rows.map(w=>w.row));a.innerHTML=ye+(J?`<h3>Bookings and buyers \xB7 searching\u2026</h3>${'<div class="slm-search-skelrow"><i></i><span><b></b><b></b></span></div>'.repeat(2)}`:"")+(X?`<h3>Bookings and buyers</h3><div class="slm-search-fail">${Ke("alert","#d64545",16)}<span>Bookings couldn\u2019t load. ${o.length?"Seats above are still right.":""}</span><button type="button" data-retry>Try again</button></div>`:"")+(!o.length&&!J&&!X?`<div class="slm-search-empty">${ns("search","#4c6fff",22)}<b>Nothing matches \u201C${de(h)}\u201D</b>${i.lookupOrders?`${he}Try a seat like G-5, a section, a booking number, or a buyer\u2019s name or email.`:"This search covers seats, rows and sections. Bookings and buyers need order access for this event."}</div>`:"")},x=()=>{clearTimeout(g);let h=n.value.trim();!i.lookupOrders||h.length<2||(g=setTimeout(()=>{let v=i.lookupSeats&&zs(t(),h,i.statusOf).seats.length?i.lookupSeats(h).then(async C=>{let E=new Map;for(let M of C.seats)M.order&&(c.set(M.label,M.order.displayRef),E.set(M.order.id,M.order.displayRef));return(await Promise.all([...E.keys()].slice(0,3).map(M=>i.lookupOrders(M).then(R=>R.orders.find(N=>N.id===M),()=>{})))).filter(M=>!!M)},()=>[]):Promise.resolve([]);Promise.all([i.lookupOrders(h),v]).then(([C,E])=>{n.value.trim()===h&&(l={query:h,list:[...C.orders,...E.filter(L=>!C.orders.some(M=>M.id===L.id))]},u())}).catch(()=>{n.value.trim()===h&&(l={query:h,list:[],failed:!0},u())})},250))},y=s.querySelector("[data-search-clear]");return n.addEventListener("input",()=>{r=n.value.trim()?0:-1,y&&(y.hidden=!n.value),u(),x()}),n.addEventListener("keydown",h=>{if(h.key==="ArrowDown"||h.key==="ArrowUp"){if(h.preventDefault(),!o.length)return;r=r<0?h.key==="ArrowDown"?0:o.length-1:(r+(h.key==="ArrowDown"?1:o.length-1))%o.length,u(),a.querySelector('[aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})}else if(h.key==="Enter"){h.preventDefault();let v=o[r];if(v&&!n.value.trim()&&v.query){n.value=v.query,n.dispatchEvent(new Event("input"));return}k(v,h.shiftKey)}}),s.addEventListener("keydown",h=>{h.key==="Escape"&&(h.stopPropagation(),p())}),s.addEventListener("click",h=>{if(h.target.closest("[data-search-cancel]")){h.preventDefault(),p();return}if(h.target.closest("[data-search-clear]")){h.preventDefault(),n.value="",n.dispatchEvent(new Event("input")),n.focus();return}let v=h.target;if(v===s){p();return}let C=v.closest("[data-try]");if(C){n.value=C.dataset.try,n.dispatchEvent(new Event("input")),n.focus();return}let E=v.closest("[data-recent]");if(E){n.value=E.dataset.recent,n.dispatchEvent(new Event("input")),n.focus();return}if(v.closest("[data-retry]")){l={query:"",list:null},u(),x();return}let L=v.closest("[data-open-order]");if(L){p(),i.openOrder?.({id:L.dataset.openOrder,displayRef:L.dataset.ref});return}let M=v.closest("[data-card]");if(M){let N=(l.list??[])[0];N&&k({title:N.displayRef,detail:"",glyph:"ticket",hue:"#8b5cf6",labels:N.seatLabels,order:N},M.dataset.card==="select");return}let R=v.closest("[data-i]");R&&k(o[Number(R.dataset.i)],h.shiftKey)}),n.value=e,y&&(y.hidden=!e),r=e.trim()?0:-1,u(),x(),n.focus(),{close:p}}var Vr,Ke,ns,de,Fs,ea,Ur,Kr,Wr,lt,ta,Ns,qs=Y(()=>{"use strict";Qi();me();Vr={seat:'<path d="M7 11V6.5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2V11"/><path d="M5 11h14v4H5z"/><path d="M7 15v4.5M17 15v4.5"/>',row:'<circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/>',section:'<path d="M12 3.5l8.5 4.5L12 12.5 3.5 8z"/><path d="M3.5 12L12 16.5 20.5 12"/><path d="M3.5 16L12 20.5 20.5 16"/>',ticket:'<path d="M3.5 7.5h17v3a2 2 0 0 0 0 4v3h-17v-3a2 2 0 0 0 0-4z"/>',search:'<circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 20c1.5-4 4.5-6 8-6s6.5 2 8 6"/>',bookmark:'<path d="M6.5 3.5h11v17l-5.5-4-5.5 4z"/>',map:'<path d="M3.5 6.5l5-2 7 2.5 5-2v13l-5 2-7-2.5-5 2z"/><path d="M8.5 4.5v13M15.5 7v13"/>',cursor:'<path d="M5 3.5l13 7-5.6 1.6L10 18z"/>',alert:'<path d="M12 3.8l9.3 16.2H2.7z"/><path d="M12 10v4.5M12 17.3v.2"/>',ban:'<circle cx="12" cy="12" r="8.5"/><path d="M6 18L18 6"/>',x:'<path d="M6.5 6.5l11 11M17.5 6.5l-11 11"/>',star:'<path d="M12 3.8l2.5 5.2 5.7.8-4.1 4 1 5.6L12 16.8l-5.1 2.6 1-5.6-4.1-4 5.7-.8z"/>'},Ke=(i,e,t=15)=>`<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${e}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Vr[i]}</svg>`,ns=(i,e,t)=>`<span class="plate" style="background:color-mix(in srgb,${e} 15%,transparent)">${Ke(i,e,t)}</span>`,de=i=>String(i??"").replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),Fs={free:"Free",held:"In a cart",booked:"Sold",blocked:"Blocked"},ea={free:"#22a06b",held:"#d99a0b",booked:"#8a94a6",blocked:"#d64545"},Ur={refunded:"Refunded",cancelled:"Cancelled",pending:"Pending",partially_refunded:"Part refunded"},Kr=i=>{let e=Math.round((Date.now()-i)/6e4);return e<1?"just now":e<60?`${e} min ago`:e<1440?`${Math.round(e/60)} h ago`:"earlier"},Wr=i=>K(i,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});lt=8,ta=`
591
620
  .slm-search-scrim{position:absolute;inset:0;z-index:40;display:flex;justify-content:center;align-items:flex-start;padding-top:72px;background:rgba(12,18,32,.32)}
592
- .slm-search{width:min(620px,calc(100% - 32px));max-height:calc(100% - 110px);display:flex;flex-direction:column;border-radius:16px;background:var(--slm-surface);color:var(--slm-text);border:1px solid var(--slm-line);box-shadow:0 30px 80px rgba(0,0,0,.28);overflow:hidden}
621
+ .slm-search{--sw:var(--slm-surface);--sc:color-mix(in srgb,var(--slm-text) 4%,var(--slm-surface));width:min(620px,calc(100% - 32px));max-height:calc(100% - 110px);display:flex;flex-direction:column;border-radius:16px;background:var(--sw);color:var(--slm-text);border:1px solid var(--slm-line);box-shadow:0 30px 80px rgba(0,0,0,.28);overflow:hidden}
593
622
  .slm-search-field{display:flex;align-items:center;gap:9px;margin:12px 14px;padding:0 10px;height:38px;border-radius:10px;border:1px solid var(--slm-accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--slm-accent) 30%,transparent)}
594
623
  .slm-search-field input{flex:1;border:0;outline:0;background:transparent;color:var(--slm-text);font:inherit;font-size:14px}
595
- .slm .slm-search-field input:focus-visible{outline:0}
596
- .slm-search kbd{display:inline-flex;align-items:center;min-width:18px;height:18px;padding:0 5px;border-radius:5px;border:1px solid var(--slm-line);border-bottom-width:2px;font:600 10.5px/1 inherit;color:var(--slm-muted)}
624
+ .slm .slm-search-field input:focus-visible{outline:0}.slm-search-field input::-webkit-search-cancel-button{display:none}
625
+ .slm[data-theme="light"] .slm-search{--sw:var(--slm-bg);--sc:var(--slm-surface)}
626
+ .slm .slm-search-clear{display:inline-flex;padding:2px;border:0;background:none;cursor:pointer}.slm .slm-search-clear[hidden]{display:none}
627
+ .slm-search kbd{display:inline-flex;align-items:center;box-sizing:content-box;min-width:18px;height:18px;padding:0 5px;border-radius:5px;border:1px solid var(--slm-line);border-bottom-width:2px;justify-content:center;background:var(--sw);font-family:inherit;font-weight:600;font-size:10.5px;line-height:1;color:var(--slm-muted)}
597
628
  .slm-search-body{overflow:auto;padding:0 8px 8px;border-top:1px solid var(--slm-line)}
598
629
  .slm-search h3{margin:10px 10px 4px;font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted)}
599
630
  .slm .slm-search-row{display:flex;align-items:center;gap:11px;width:100%;padding:8px 10px;border:0;border-radius:10px;background:transparent;color:var(--slm-text);text-align:left;font:inherit;cursor:pointer}
600
631
  .slm .slm-search-row[aria-selected=true]{background:color-mix(in srgb,var(--slm-accent) 16%,transparent)}
601
- .slm-search-row .plate,.slm-search-fail .plate,.slm-search-card header .plate{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;flex:none}
632
+ .slm-search-row .plate,.slm-search-card header .plate{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;flex:none}.slm-search-card header .plate{width:32px;height:32px;border-radius:10px}
602
633
  .slm-search-row span.t{flex:1;min-width:0}.slm-search-row b{display:block;font-size:13px}.slm-search-row small{font-size:12px;color:var(--slm-muted)}
603
634
  .slm-search-row em{font-style:normal;font-size:12px;color:var(--slm-muted);white-space:nowrap}
604
635
  .slm-search-tries{display:flex;flex-wrap:wrap;gap:6px;padding:4px 10px 8px}.slm .slm-search-tries button{padding:4px 10px;border-radius:999px;border:0;background:var(--slm-tint);color:var(--slm-text);font:inherit;font-size:12px;cursor:pointer}
605
- .slm-search-empty{padding:26px 22px;text-align:center;color:var(--slm-muted);font-size:13px}.slm-search-empty .plate{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:12px;margin-bottom:10px}.slm-search-empty b{display:block;margin-bottom:6px;color:var(--slm-text);font-size:15px}
636
+ .slm-search-empty{padding:26px 22px;text-align:center;color:var(--slm-muted);font-size:13px}.slm-search-empty .plate{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:13px;margin-bottom:10px}.slm-search-empty b{display:block;margin-bottom:6px;color:var(--slm-text);font-size:15px}
606
637
  .slm-search-skel{height:10px;margin:12px 10px;border-radius:5px;background:color-mix(in srgb,var(--slm-text) 12%,transparent)}
607
- .slm-search-order{display:flex;gap:6px;padding:0 10px 8px 49px}.slm .slm-search-order button{padding:3px 9px;border-radius:8px;border:1px solid var(--slm-line);background:var(--slm-surface);color:var(--slm-text);font:inherit;font-size:12px;cursor:pointer}
608
- .slm-search-foot{display:flex;flex-wrap:wrap;gap:14px;padding:9px 16px;border-top:1px solid var(--slm-line);font-size:11.5px;color:var(--slm-muted)}
609
- .slm-search-card{margin:6px 2px 8px;padding:14px;border-radius:12px;border:1px solid var(--slm-line);background:var(--slm-bg,var(--slm-surface))}
638
+ .slm-search-skelrow{display:flex;gap:12px;align-items:center;padding:8px 10px}.slm-search-skelrow i{width:28px;height:28px;border-radius:8px;flex:none}.slm-search-skelrow span{flex:1;display:grid;gap:7px}.slm-search-skelrow b{height:8px;border-radius:4px;width:60%}.slm-search-skelrow b:last-child{width:40%}.slm-search-skelrow :is(i,b){background:color-mix(in srgb,var(--slm-text) 9%,transparent)}.slm-search-skelrow:last-child span b:first-child{width:72%}
639
+ .slm-search.touch{width:calc(100% - 24px);max-height:calc(100% - 24px)}.slm .slm-search-cancel{flex:none;padding:4px 2px;border:0;background:none;color:var(--slm-accent);font:inherit;font-size:13px;font-weight:700;cursor:pointer}
640
+ .slm-search-order{display:flex;gap:6px;padding:0 10px 8px 49px}.slm .slm-search-order button{padding:4px 9px;border-radius:8px;border:1px solid var(--slm-line);background:var(--sw);color:var(--slm-text);font:inherit;font-size:12px;font-weight:500;cursor:pointer}
641
+ .slm-search-foot{display:flex;flex-wrap:wrap;gap:16px;padding:10px 16px;border-top:1px solid var(--slm-line);background:var(--sc);font-size:11.5px;color:var(--slm-muted)}
642
+ .slm-search-card{margin:6px 2px 8px;padding:14px;border-radius:12px;border:1px solid var(--slm-line);background:var(--sc)}
610
643
  .slm-search-card header{display:flex;align-items:center;gap:10px}.slm-search-card header span.t{flex:1;min-width:0}.slm-search-card b{display:block;font-size:15px}.slm-search-card small{font-size:12px;color:var(--slm-muted)}
611
- .slm-search-card .pill{padding:3px 9px;border-radius:999px;font-size:11px;font-weight:700;background:color-mix(in srgb,#22a06b 14%,transparent);color:#1a7f52}
612
- .slm-search-seats{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}.slm-search-seats span{padding:3px 9px;border-radius:999px;border:1px solid var(--slm-line);font-size:12px}
613
- .slm-search-acts{display:flex;flex-wrap:wrap;gap:8px}.slm .slm-search-acts button{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:8px;border:1px solid var(--slm-line);background:var(--slm-surface);color:var(--slm-text);font:inherit;font-size:12.5px;font-weight:600;cursor:pointer}
614
- .slm-search-fail{display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:12.5px;color:#c0392b}.slm-search-fail>span:not(.plate){flex:1}
615
- .slm .slm-search-fail button{padding:4px 10px;border-radius:8px;border:1px solid var(--slm-line);background:var(--slm-surface);color:var(--slm-text);font:inherit;font-size:12px;cursor:pointer}
616
- `,Es=null});function $r(i,e=Date.now()){if(i==null)return"no end";let t=i-e;if(t<=0)return"ending now";if(t<je)return`ends in ${Math.max(1,Math.round(t/6e4))} min`;if(t<168*je){let s=Math.floor(t/(24*je)),n=Math.floor(t%(24*je)/je);return s?`ends in ${s} d ${n} h`:`ends in ${n} h`}return`ends ${pt(i)}`}function ot(i,e,t,s=Date.now()){if(i==="never")return null;if(i==="pick")return t!=null&&t>s?t:void 0;if(e==null)return;let n=i==="start"?e:e-48*je;return n>s?n:void 0}function Tr(i){return{list:()=>i.request("reservations").then(e=>e.reservations),create:(e,t,s)=>i.request("reservations",{method:"POST",body:{labels:e,name:t,releaseAt:s}}).then(n=>n.reservation),update:(e,t)=>i.request(`reservations/${encodeURIComponent(e)}`,{method:"PATCH",body:{releaseAt:t}}).then(s=>s.reservation),release:e=>i.request(e?`reservations/${encodeURIComponent(e)}/release`:"reservations/release-all",{method:"POST"}).then(t=>t.released)}}function Ui(i,e,t,s){let n=o=>o?"":'disabled title="Set the event date to use this"',a=(o,r,l="")=>`<button type="button" data-${i}="${o}" aria-pressed="${e===o}" ${l}>${r}</button>`;return`<div class="slm-chips" role="group" aria-label="When it goes back on sale">${a("never","Never")}${a("before48","48 h before the start",n(t))}${a("start","At the start",n(s))}${a("pick","Pick a time\u2026")}</div>`}function Wi(i){let e=Tr(i),t=E=>i.toast(Mr(E),"err"),s=[],n="loading",a="new",o=!1,r=!1,l=null,c=null,d=null,b=!1,f="never",u=null,m="",v=!1,$=null,A=ot("before48",i.startsAt,null)!==void 0,O=ot("start",i.startsAt,null)!==void 0;i.mount.classList.add("slm-reserve"),i.mount.innerHTML=`
644
+ .slm-search-card .pill{padding:3px 9px;border-radius:999px;font-size:11px;font-weight:700;background:color-mix(in srgb,#22a06b 14%,transparent);color:#11704c}
645
+ .slm-search-seats{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}.slm-search-seats span{display:inline-flex;align-items:center;height:22px;padding:0 9px;border-radius:999px;background:var(--sw);font-size:12px}
646
+ .slm-search-acts{display:flex;flex-wrap:wrap;gap:8px}.slm .slm-search-acts button{display:inline-flex;align-items:center;gap:7px;height:28px;padding:0 10px;border-radius:9px;border:1px solid var(--slm-line);background:var(--sw);color:var(--slm-text);font:inherit;font-size:12px;font-weight:600;cursor:pointer}
647
+ .slm-search-fail{display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:12.5px;color:#b4232a}.slm[data-theme="dark"] .slm-search-fail{color:#ff8a8f}.slm[data-theme="dark"] .slm-search-card .pill{color:#5fd3a1}.slm-search-fail>span{flex:1}
648
+ .slm .slm-search-fail button{padding:4px 10px;border-radius:8px;border:1px solid var(--slm-line);background:var(--sw);color:var(--slm-text);font:inherit;font-size:12px;cursor:pointer}
649
+ `,Ns=null});function xt(i,e){return`<span class="slm-rsvic" style="background:color-mix(in srgb,${e} 14%,transparent)"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="${e}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${oa[i]}</svg></span>`}function dt(i,e,t,s,n=!1){return`<button type="button" ${i}${n?' class="on"':""}><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="${t}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${oa[e]}</svg>${s}</button>`}function Zr(i,e=Date.now()){if(i==null)return"no end";let t=i-e;if(t<=0)return"ending now";if(t<We)return`ends in ${Math.max(1,Math.round(t/6e4))} min`;if(t<168*We){let s=Math.floor(t/(24*We)),n=Math.floor(t%(24*We)/We);return s?`ends in ${s} d ${n} h`:`ends in ${n} h`}return`ends ${yt(i)}`}function ct(i,e,t,s=Date.now()){if(i==="never")return null;if(i==="pick")return t!=null&&t>s?t:void 0;if(e==null)return;let n=i==="start"?e:e-48*We;return n>s?n:void 0}function Jr(i){return{list:()=>i.request("reservations").then(e=>e.reservations),create:(e,t,s)=>i.request("reservations",{method:"POST",body:{labels:e,name:t,releaseAt:s}}).then(n=>n.reservation),update:(e,t)=>i.request(`reservations/${encodeURIComponent(e)}`,{method:"PATCH",body:{releaseAt:t}}).then(s=>s.reservation),release:e=>i.request(e?`reservations/${encodeURIComponent(e)}/release`:"reservations/release-all",{method:"POST"}).then(t=>t.released)}}function aa(i,e,t,s){let n=o=>o?"":'disabled title="Set the event date to use this"',a=(o,r,l="")=>`<button type="button" data-${i}="${o}" aria-pressed="${e===o}" ${l}>${r}</button>`;return`<div class="slm-chips" role="group" aria-label="When it goes back on sale">${a("never","Never")}${a("before48","48 h before the start",n(t))}${a("start","At the start",n(s))}${a("pick","Pick a time\u2026")}</div>`}function la(i){let e=Jr(i),t=w=>i.toast(el(w),"err"),s=[],n="loading",a="new",o=!1,r=!1,l=null,c=null,d=null,g=!1,b=null,m="",p=!1,f=null,k=ct("before48",i.startsAt,null)!==void 0,A=k?"before48":"never",B=ct("start",i.startsAt,null)!==void 0;i.mount.classList.add("slm-reserve"),i.mount.innerHTML=`
617
650
  <div data-rsv="new">
618
651
  <p class="slm-eyebrow slm-step" style="margin-top:14px"><span class="slm-stepnum">2</span>Reserve them for</p>
619
652
  <div class="slm-field">
@@ -622,39 +655,45 @@
622
655
  </div>
623
656
  <div class="slm-field">
624
657
  <label>Goes back on sale</label>
625
- ${Ui("end",f,A,O)}
658
+ ${aa("end",A,k,B)}
626
659
  <input type="datetime-local" class="slm-input" data-rsv="pick" hidden style="margin-top:8px" aria-label="When the reservation ends" />
627
660
  <p class="slm-note" data-rsv="endnote"></p>
628
661
  </div>
629
662
  </div>
630
- <section class="slm-rsvlist" data-rsv="list" hidden aria-label="Reservations on this event" aria-live="polite"></section>`;let B=E=>i.mount.querySelector(`[data-rsv="${E}"]`),k=B("name"),h=B("pick"),p=()=>ot(f,i.startsAt,u),g=()=>s.filter(E=>E.releaseAt==null||E.releaseAt>Date.now());function y(E,P,j){return P===null?i.startsAt==null&&j?"Set the event date to end it before the start. Until then: never, or pick a time.":"Stays off sale until you release it.":P===void 0?E==="pick"?"Pick a time in the future.":"That time has passed. Choose another.":j?`Back on sale ${pt(P)}, unless you release it first.`:`New end: ${pt(P)}.`}function L(){let E=n==="ready"?g().length:null;i.tabs.innerHTML=`<div class="slm-monitor-tabs" role="tablist" aria-label="Reserve"><button role="tab" type="button" data-rsv-tab="new" aria-selected="${a==="new"}">New reservation</button><button role="tab" type="button" data-rsv-tab="list" aria-selected="${a==="list"}">On this event${E?` \xB7 ${E}`:""}</button></div>`,i.rail.classList.toggle("slm-rsv-listing",a==="list"),B("new").hidden=a!=="new",B("list").hidden=a!=="list"}function C(){i.mount.querySelectorAll("[data-end]").forEach(E=>{E.setAttribute("aria-pressed",String(E.dataset.end===f))}),h.hidden=f!=="pick",B("endnote").textContent=y(f,p(),!0)}function x(){if(a==="list"){let Q=d&&d.until>Date.now();i.foot.hidden=!Q,Q&&i.paintFoot(i.foot,{label:"New reservation",note:"Reserved just now",secondary:"Undo"});return}i.foot.hidden=!1;let E=i.selectedFree(),P=p(),j=E.length>0&&m.trim().length>0&&P!==void 0;i.paintFoot(i.foot,o?{label:`Reserving ${be(E.length)}\u2026`,busy:!0,note:"Buyers can no longer pick these seats."}:E.length?m.trim()?r?{label:"Try again",disabled:!j,note:"Your selection and the name are kept."}:{label:`Reserve ${be(E.length)} for ${m.trim()}`,disabled:!j,note:"Reserved seats leave sale now. Release any time from On this event."}:{label:`Reserve ${be(E.length)}`,disabled:!0,note:"Give the reservation a name first."}:{label:"Select seats first",disabled:!0,note:"Pick free seats on the map, then name them."})}function M(E){let P=E.releaseAt!=null&&E.releaseAt<=Date.now(),j=!P&&E.releaseAt!=null&&E.releaseAt-Date.now()<je,Q=E.labels.length,Z=c?.id===E.id?c:null,te=l===E.id?`<div class="slm-rsvconfirm" role="alertdialog" aria-label="Release ${ke(E.name)}">
631
- <p><b>Release ${ke(E.name)}?</b> ${Vi(Q)}</p>
632
- <div><button type="button" class="slm-btn ghost" data-rsv-cancel>Keep them</button><button type="button" class="slm-btn danger" data-rsv-release-go>Release ${be(Q)}</button></div>
633
- </div>`:"",he=Z?`<div class="slm-rsvedit">
634
- <label class="slm-note">Goes back on sale</label>${Ui("edit",Z.choice,A,O)}
635
- <input type="datetime-local" class="slm-input" data-rsv-editpick ${Z.choice==="pick"?"":"hidden"} style="margin-top:8px" aria-label="New end" ${Z.picked?`value="${Lr(Z.picked)}"`:""} />
636
- <p class="slm-note">${ke(y(Z.choice,ot(Z.choice,i.startsAt,Z.picked),!1))}</p>
663
+ <section class="slm-rsvlist" data-rsv="list" hidden aria-label="Reservations on this event" aria-live="polite"></section>`;let O=w=>i.mount.querySelector(`[data-rsv="${w}"]`),I=O("name"),u=O("pick"),x=()=>ct(A,i.startsAt,b),y=()=>s.filter(w=>w.releaseAt==null||w.releaseAt>Date.now());function h(w,H,D){return H===null?i.startsAt==null&&D?"Set the event date to end it before the start. Until then: never, or pick a time.":"Stays off sale until you release it.":H===void 0?w==="pick"?"Pick a time in the future.":"That time has passed. Choose another.":D?`Back on sale ${yt(H)}, unless you release it first.`:`New end: ${yt(H)}.`}function v(){let w=n==="ready"?y().length:null;i.tabs.innerHTML=`<div class="slm-monitor-tabs seg" role="tablist" aria-label="Reserve"><button role="tab" type="button" data-rsv-tab="new" aria-selected="${a==="new"}">New reservation</button><button role="tab" type="button" data-rsv-tab="list" aria-selected="${a==="list"}">On this event${w?` \xB7 ${w}`:""}</button></div>`,i.rail.classList.toggle("slm-rsv-listing",a==="list"),O("new").hidden=a!=="new",O("list").hidden=a!=="list"}function C(){i.mount.querySelectorAll("[data-end]").forEach(w=>{w.setAttribute("aria-pressed",String(w.dataset.end===A))}),u.hidden=A!=="pick",O("endnote").textContent=h(A,x(),!0)}function E(){if(a==="list"){let U=d&&d.until>Date.now();i.foot.hidden=!U,U&&i.paintFoot(i.foot,{label:"New reservation",note:"Reserved just now",secondary:"Undo",look:"done"});return}i.foot.hidden=!1;let w=i.selectedFree(),H=x(),D=w.length>0&&m.trim().length>0&&H!==void 0;i.paintFoot(i.foot,o?{label:`Reserving ${fe(w.length)}\u2026`,busy:!0,note:"Buyers can no longer pick these seats."}:w.length?m.trim()?r?{label:"Try again",disabled:!D,note:"Your selection and the name are kept."}:{label:`Reserve ${fe(w.length)} for ${m.trim().split(" \xB7 ")[0]}`,disabled:!D,note:"Reserved seats leave sale now. Release any time from On this event."}:{label:`Reserve ${fe(w.length)}`,disabled:!0,note:"Give the reservation a name first."}:{label:"Select seats first",disabled:!0,note:"Pick free seats on the map, then name them."})}function L(w){let H=w.releaseAt!=null&&w.releaseAt<=Date.now(),D=!H&&w.releaseAt!=null&&w.releaseAt-Date.now()<We,U=w.labels.length,q=c?.id===w.id?c:null,te=l===w.id?`<div class="slm-rsvconfirm" role="alertdialog" aria-label="Release ${Se(w.name)}">
664
+ <p><b>Release ${Se(w.name)}?</b> ${ia(U)}</p>
665
+ <div><button type="button" class="slm-btn ghost" data-rsv-cancel>Keep them</button><button type="button" class="slm-btn danger" data-rsv-release-go>Release ${fe(U)}</button></div>
666
+ </div>`:"",ie=q?`<div class="slm-rsvedit">
667
+ <label class="slm-note">Goes back on sale</label>${aa("edit",q.choice,k,B)}
668
+ <input type="datetime-local" class="slm-input" data-rsv-editpick ${q.choice==="pick"?"":"hidden"} style="margin-top:8px" aria-label="New end" ${q.picked?`value="${Xr(q.picked)}"`:""} />
669
+ <p class="slm-note">${Se(h(q.choice,ct(q.choice,i.startsAt,q.picked),!1))}</p>
637
670
  <div class="slm-rsvbtns"><button type="button" class="slm-btn ghost" data-rsv-editcancel>Cancel</button>
638
- <button type="button" class="slm-btn" data-rsv-editsave ${Z.busy||ot(Z.choice,i.startsAt,Z.picked)===void 0?"disabled":""}>${Z.busy?"Saving\u2026":"Save end"}</button></div>
639
- </div>`:"";return`<div class="slm-rsv" data-id="${ke(E.id)}"${P?' style="opacity:.6"':""}>
640
- <b>${ke(E.name)}</b>
641
- <small>${be(Q)} \xB7 ${ke(i.whereOf(E.labels))}${E.createdByYou?" \xB7 by you":E.createdByName?` \xB7 by ${ke(E.createdByName)}`:""}</small>
642
- <small class="slm-rsvends${j?" soon":""}">${P?"ended":ke($r(E.releaseAt))}</small>
643
- ${P?"":'<div class="slm-rsvacts"><button type="button" class="slm-linkbtn" data-rsv-show>Show</button><button type="button" class="slm-linkbtn" data-rsv-release>Release</button><button type="button" class="slm-linkbtn" data-rsv-edit>Change end</button></div>'}
644
- ${te}${he}
645
- </div>`}function H(){L();let E=B("list");if(n==="loading"){E.innerHTML='<div class="slm-rsvskel"></div><div class="slm-rsvskel"></div><div class="slm-rsvskel"></div>';return}if(n==="failed"){E.innerHTML=`${i.alertHtml("error","Reservations could not load"," The seats are still reserved; only this list failed.")}<button type="button" class="slm-btn ghost" data-rsv-retry>Try again</button>`;return}let P=g(),j=d?`<div class="slm-rsvdone" role="status"><b>Reserved ${be(d.reservation.labels.length)} for ${ke(d.reservation.name)}</b>${ke(i.whereOf(d.reservation.labels))} \xB7 ${d.reservation.releaseAt==null?"no end":`back on sale ${ke(pt(d.reservation.releaseAt))}`}.</div>`:"";if(!s.length){E.innerHTML=j+(b?'<div class="slm-rsvempty"><b>No active reservations</b>Every seat you kept aside is back on sale. What you released is in Watch \u2192 You.</div>':'<div class="slm-rsvempty"><b>No reservations yet</b>Keep seats aside for guests, press or a sponsor. They leave sale until you release them or their time runs out.</div>');return}let Q=P.reduce((he,ve)=>he+ve.labels.length,0),Z=`<div class="slm-rsvhead"><span>${P.length?`${P.length} ${P.length===1?"reservation":"reservations"} \xB7 ${be(Q)}`:"No active reservations"}</span>${P.length>1&&l!=="*"?'<button type="button" class="slm-linkbtn" data-rsv="all">Release all</button>':""}</div>`,te=l==="*"?`<div class="slm-rsvconfirm" role="alertdialog" aria-label="Release all reservations">
646
- <p><b>Release all ${P.length} reservations?</b> ${Vi(Q)} Seats you blocked stay blocked.</p>
647
- <div><button type="button" class="slm-btn ghost" data-rsv-cancel>Cancel</button><button type="button" class="slm-btn danger" data-rsv-all-go>Release ${be(Q)}</button></div>
648
- </div>`:"";E.innerHTML=j+Z+te+s.map(M).join("")}async function F(){try{let E=await e.list();if(v)return;s=E,n="ready"}catch{if(v)return;n="failed"}H()}function N(E){a=E,E==="new"&&(l=null,c=null),H(),x()}async function K(E){let P=E?s.find(j=>j.id===E):null;try{let j=await e.release(E);i.toast(P?`${P.name}: ${be(j.length)} back on sale.`:`${be(j.length)} back on sale. Blocked seats stay blocked.`,"ok"),d&&(E===null||d.reservation.id===E)&&(d=null),b=!0,i.changed?.()}catch(j){t(j)}l=null,await F(),x()}async function se(){if(!c)return;let E=ot(c.choice,i.startsAt,c.picked);if(E===void 0||c.busy)return;c.busy=!0,H();let P=s.find(j=>j.id===c.id);try{await e.update(c.id,E),i.changed?.(),i.toast(`${P?.name??"The reservation"} ${E===null?"now has no end":`now goes back on sale ${pt(E)}`}.`,"ok"),c=null}catch(j){c&&(c.busy=!1),t(j)}await F()}async function ae(){if(!d)return;let E=d.reservation;d=null,$&&clearTimeout($);try{await e.release(E.id),i.changed?.(),i.toast(`Undone. ${be(E.labels.length)} back on sale.`,"ok"),m=E.name,k.value=E.name,N("new"),i.select(E.labels)}catch(P){t(P)}await F(),x()}i.tabs.addEventListener("click",E=>{let P=E.target.closest("[data-rsv-tab]");P&&N(P.dataset.rsvTab)}),i.mount.addEventListener("input",E=>{E.target===k&&(m=k.value,r=!1,x())}),i.mount.addEventListener("change",E=>{let P=E.target,j=P.value?new Date(P.value).getTime():NaN;P===h?(u=Number.isFinite(j)?j:null,C(),x()):P.matches("[data-rsv-editpick]")&&c&&(c.picked=Number.isFinite(j)?j:null,H())}),i.mount.addEventListener("click",E=>{let P=E.target,j=P.closest("[data-end]");if(j&&!j.disabled){f=j.dataset.end,C(),x(),f==="pick"&&h.focus();return}let Q=P.closest("[data-edit]");if(Q&&!Q.disabled&&c){c.choice=Q.dataset.edit,H();return}if(P.closest("[data-rsv-retry]")){n="loading",H(),F();return}let Z=P.closest("[data-id]"),te=Z?s.find(he=>he.id===Z.dataset.id):void 0;if(te&&P.closest("[data-rsv-show]")){i.show(te.labels);return}if(te&&P.closest("[data-rsv-release]")){l=te.id,c=null,H();return}if(te&&P.closest("[data-rsv-release-go]")){K(te.id);return}if(te&&P.closest("[data-rsv-edit]")){let he=te.releaseAt;c={id:te.id,choice:he==null?"never":"pick",picked:he,busy:!1},l=null,H();return}if(P.closest("[data-rsv-editcancel]")){c=null,H();return}if(P.closest("[data-rsv-editsave]")){se();return}if(P.closest('[data-rsv="all"]')){l="*",c=null,H();return}if(P.closest("[data-rsv-cancel]")){l=null,H();return}P.closest("[data-rsv-all-go]")&&K(null)});let xe=i.foot.querySelector("[data-foot-action]"),R=i.foot.querySelector("[data-foot-secondary]"),_=async()=>{if(a==="list"){d=null,N("new");return}let E=i.selectedFree(),P=p();if(!(o||!E.length||!m.trim()||P===void 0)){o=!0,r=!1,i.alert(null),x();try{d={reservation:await e.create(E,m.trim(),P),until:Date.now()+ji},i.changed?.(),$&&clearTimeout($),$=setTimeout(()=>{d=null,v||(H(),x())},ji),i.clearSelection(),m="",k.value="",o=!1,await F(),N("list");return}catch(j){let Q=Cr(j);if(Q.length){let Z=Q.map(ve=>ve.label),te=Q.every(ve=>ve.reason==="booked"||ve.reason==="sold"),he=E.length-Z.length;i.alert(i.alertHtml("warn",`${be(Z.length)} ${Z.length===1?"was":"were"} ${te?"sold":"taken"} while you chose`,` Nothing was reserved. ${et(Z)} ${Z.length===1?"is":"are"} ${te?"sold":"no longer free"} now; the other ${he.toLocaleString()} ${he===1?"is":"are"} still free and selected.`)),i.deselect(Z)}else r=!0,i.alert(i.alertHtml("error","Couldn\u2019t reserve the seats"," The connection dropped before the change was saved. Nothing changed for buyers."))}o=!1,x()}};xe?.addEventListener("click",()=>{_()}),R?.addEventListener("click",()=>{a==="list"&&d&&ae()});let ne=setInterval(()=>{!v&&!c&&!l&&F()},3e4);return L(),C(),x(),H(),F(),{paint:x,refresh:F,destroy(){v=!0,clearInterval(ne),$&&clearTimeout($),i.rail.classList.remove("slm-rsv-listing"),i.foot.hidden=!1}}}var je,ji,ke,be,Vi,pt,Lr,Ki,Cr,Mr,As=Y(()=>{"use strict";dt();me();je=3600*1e3,ji=3e4,ke=i=>i.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),be=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,Vi=i=>`${be(i)} ${i===1?"goes":"go"} back on sale now and buyers can pick ${i===1?"it":"them"}.`,pt=i=>W(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),Lr=i=>new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16);Ki=`
671
+ <button type="button" class="slm-btn" data-rsv-editsave ${q.busy||ct(q.choice,i.startsAt,q.picked)===void 0?"disabled":""}>${q.busy?"Saving\u2026":"Save end"}</button></div>
672
+ </div>`:"";return`<div class="slm-rsv ic" data-id="${Se(w.id)}"${H?' style="opacity:.6"':""}>${xt("bookmark","#c026d3")}
673
+ <b>${Se(w.name)}</b>
674
+ <small>${fe(U)} \xB7 ${Se(i.whereOf(w.labels))}${w.createdByYou?" \xB7 by you":w.createdByName?` \xB7 by ${Se(w.createdByName)}`:""}</small>
675
+ <small class="slm-rsvends${D?" soon":""}">${H?"ended":w.releaseAt!=null&&w.releaseAt===i.startsAt?"ends at the start":Se(Zr(w.releaseAt))}</small>
676
+ ${H?"":`<div class="slm-rsvacts">${dt("data-rsv-show","map","#3b82f6","Show")}${dt("data-rsv-release","undo","#22a06b","Release")}${dt("data-rsv-edit","clock","#d99a0b","Change end")}</div>`}
677
+ ${te}${ie}
678
+ </div>`}function M(){v();let w=O("list");if(n==="loading"){w.innerHTML='<div class="slm-rsvskel"></div><div class="slm-rsvskel"></div><div class="slm-rsvskel"></div>';return}if(n==="failed"){w.innerHTML=`${i.alertHtml("error","Reservations could not load"," The seats are still reserved; only this list failed.")}<button type="button" class="slm-btn ghost" data-rsv-retry>Try again</button>`;return}let H=y(),D=d?`<div class="slm-rsvdone" role="status"><b>Reserved ${fe(d.reservation.labels.length)} for ${Se(d.reservation.name)}</b>${Se(i.whereOf(d.reservation.labels))} \xB7 ${d.reservation.releaseAt==null?"no end":`back on sale ${Se(yt(d.reservation.releaseAt))}`}.</div>`:"";if(!s.length){w.innerHTML=D+(g?'<div class="slm-rsvempty"><b>No active reservations</b>Every seat you kept aside is back on sale. What you released is in Watch \u2192 You.</div>':`<div class="slm-rsvempty">${xt("bookmark","#c026d3")}<b>No reservations yet</b>Keep seats aside for guests, press or a sponsor. They leave sale until you release them or their time runs out.<button type="button" data-rsv-new>New reservation</button></div>`);return}let U=H.reduce((Le,$e)=>Le+$e.labels.length,0),q=`<div class="slm-rsvhead"><span>${H.length?`${H.length} ${H.length===1?"reservation":"reservations"} \xB7 ${fe(U)}`:"No active reservations"}</span>${H.length>1&&l!=="*"?'<button type="button" class="slm-linkbtn" data-rsv="all">Release all</button>':""}</div>`,te=l==="*"?`<div class="slm-rsvconfirm" role="alertdialog" aria-label="Release all reservations">
679
+ <p><b>Release all ${H.length} reservations?</b> ${ia(U)} Seats you blocked stay blocked.</p>
680
+ <div><button type="button" class="slm-btn ghost" data-rsv-cancel>Cancel</button><button type="button" class="slm-btn danger" data-rsv-all-go>Release ${fe(U)}</button></div>
681
+ </div>`:"",ie=d?.reservation.id,xe=Le=>+(Le.releaseAt!=null&&Le.releaseAt<=Date.now());w.innerHTML=D+q+te+[...s].sort((Le,$e)=>xe(Le)-xe($e)||+($e.id===ie)-+(Le.id===ie)).map(L).join("")}async function R(){try{let w=await e.list();if(p)return;let H=Date.now();s=[...w,...s.filter(D=>D.releaseAt!=null&&D.releaseAt<=H&&!w.some(U=>U.id===D.id))],n="ready"}catch{if(p)return;n="failed"}M()}function N(w){a=w,w==="new"&&(l=null,c=null),M(),E()}async function j(w){let H=w?s.find(D=>D.id===w):null;try{let D=await e.release(w);i.toast(H?`${H.name}: ${fe(D.length)} back on sale.`:`${fe(D.length)} back on sale. Blocked seats stay blocked.`,"ok"),d&&(w===null||d.reservation.id===w)&&(d=null),g=!0,i.changed?.()}catch(D){t(D)}l=null,await R(),E()}async function ee(){if(!c)return;let w=ct(c.choice,i.startsAt,c.picked);if(w===void 0||c.busy)return;c.busy=!0,M();let H=s.find(D=>D.id===c.id);try{await e.update(c.id,w),i.changed?.(),i.toast(`${H?.name??"The reservation"} ${w===null?"now has no end":`now goes back on sale ${yt(w)}`}.`,"ok"),c=null}catch(D){c&&(c.busy=!1),t(D)}await R()}async function J(){if(!d)return;let w=d.reservation;d=null,f&&clearTimeout(f);try{await e.release(w.id),i.changed?.(),i.toast(`Undone. ${fe(w.labels.length)} back on sale.`,"ok"),m=w.name,I.value=w.name,N("new"),i.select(w.labels)}catch(H){t(H)}await R(),E()}i.tabs.addEventListener("click",w=>{let H=w.target.closest("[data-rsv-tab]");H&&N(H.dataset.rsvTab)}),i.mount.addEventListener("input",w=>{w.target===I&&(m=I.value,r=!1,E())}),i.mount.addEventListener("change",w=>{let H=w.target,D=H.value?new Date(H.value).getTime():NaN;H===u?(b=Number.isFinite(D)?D:null,C(),E()):H.matches("[data-rsv-editpick]")&&c&&(c.picked=Number.isFinite(D)?D:null,M())}),i.mount.addEventListener("click",w=>{if(w.target.closest("[data-rsv-new]")){N("new");return}let H=w.target,D=H.closest("[data-end]");if(D&&!D.disabled){A=D.dataset.end,C(),E(),A==="pick"&&u.focus();return}let U=H.closest("[data-edit]");if(U&&!U.disabled&&c){c.choice=U.dataset.edit,M();return}if(H.closest("[data-rsv-retry]")){n="loading",M(),R();return}let q=H.closest("[data-id]"),te=q?s.find(ie=>ie.id===q.dataset.id):void 0;if(te&&H.closest("[data-rsv-show]")){i.show(te.labels);return}if(te&&H.closest("[data-rsv-release]")){l=te.id,c=null,M();return}if(te&&H.closest("[data-rsv-release-go]")){j(te.id);return}if(te&&H.closest("[data-rsv-edit]")){let ie=te.releaseAt;c={id:te.id,choice:ie==null?"never":"pick",picked:ie,busy:!1},l=null,M();return}if(H.closest("[data-rsv-editcancel]")){c=null,M();return}if(H.closest("[data-rsv-editsave]")){ee();return}if(H.closest('[data-rsv="all"]')){l="*",c=null,M();return}if(H.closest("[data-rsv-cancel]")){l=null,M();return}H.closest("[data-rsv-all-go]")&&j(null)});let X=i.foot.querySelector("[data-foot-action]"),ne=i.foot.querySelector("[data-foot-secondary]"),ye=async()=>{if(a==="list"){d=null,N("new");return}let w=i.selectedFree(),H=x();if(!(o||!w.length||!m.trim()||H===void 0)){o=!0,r=!1,i.alert(null),E();try{d={reservation:await e.create(w,m.trim(),H),until:Date.now()+na},i.changed?.(),f&&clearTimeout(f),f=setTimeout(()=>{d=null,p||(M(),E())},na),i.clearSelection(),m="",I.value="",o=!1,await R(),N("list");return}catch(D){let U=Qr(D);if(U.length){let q=U.map(xe=>xe.label),te=U.every(xe=>xe.reason==="booked"||xe.reason==="sold"),ie=w.length-q.length;i.alert(i.alertHtml("warn",`${fe(q.length)} ${q.length===1?"was":"were"} ${te?"sold":"taken"} while you chose`,` Nothing was reserved. ${He(q)} ${q.length===1?"is":"are"} ${te?"sold":"no longer free"} now`+(ie?`; the other ${ie.toLocaleString()} ${ie===1?"is":"are"} still free and selected.`:"."))),i.deselect(q)}else r=!0,i.alert(i.alertHtml("error","Couldn\u2019t reserve the seats"," The connection dropped before the change was saved. Nothing changed for buyers."))}o=!1,E()}};X?.addEventListener("click",()=>{ye()}),ne?.addEventListener("click",()=>{a==="list"&&d&&J()});let he=setInterval(()=>{!p&&!c&&!l&&R()},3e4);return v(),C(),E(),M(),R(),{paint:E,refresh:R,destroy(){p=!0,clearInterval(he),f&&clearTimeout(f),i.rail.classList.remove("slm-rsv-listing"),i.foot.hidden=!1}}}var We,na,Se,oa,fe,ia,yt,Xr,ra,Qr,el,is=Y(()=>{"use strict";nt();me();We=3600*1e3,na=3e4,Se=i=>i.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),oa={map:'<path d="M3.5 6.5l5.5-2.5 6 2.5 5.5-2.5v13.5L15 20l-6-2.5-5.5 2.5z"/><path d="M9 4v13.5M15 6.5V20"/>',undo:'<path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/>',clock:'<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 2"/>',cursor:'<path d="M5 3.5l13 7-5.6 1.6L10 18z"/>',bookmark:'<path d="M6.5 3.5h11v17l-5.5-4-5.5 4z"/>',ban:'<circle cx="12" cy="12" r="8.5"/><path d="M6 18L18 6"/>'};fe=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,ia=i=>`${fe(i)} ${i===1?"goes":"go"} back on sale now and buyers can pick ${i===1?"it":"them"}.`,yt=i=>K(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),Xr=i=>new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16);ra=`
649
682
  .slm-rsv-listing [data-ref="selcard"],.slm-rsv-listing [data-ref="addby"]{display:none}
650
683
  .slm-rsvlist{display:grid;gap:8px}
651
- .slm-rsvhead{display:flex;align-items:center;justify-content:space-between;font-size:12px;color:var(--slm-muted);font-weight:600}
684
+ .slm-rsvhead{display:flex;align-items:center;justify-content:space-between;font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted);font-weight:700}
685
+ .slm-rsvhead .slm-linkbtn{text-transform:none;letter-spacing:0;font-size:12px!important}.slm[data-theme="light"] .slm-rsvhead .slm-linkbtn{color:color-mix(in srgb,var(--slm-accent) 45%,#3d2a00)!important}
652
686
  .slm-rsv{border:1px solid var(--slm-line);border-radius:10px;padding:10px 12px;background:var(--slm-surface)}
687
+ .slm[data-theme="light"] .slm-rsv{background:var(--slm-bg)}
688
+ .slm-rsv.ic{display:grid;grid-template-columns:28px minmax(0,1fr);column-gap:10px;align-items:start}.slm-rsv.ic>.slm-rsvic{grid-row:span 3}.slm-rsv.ic>:not(.slm-rsvic,b,small){grid-column:1/-1}
689
+ .slm-rsvic{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px}
653
690
  .slm-rsv b{display:block;font-size:13.5px}
654
691
  .slm-rsv small{display:block;color:var(--slm-muted);font-size:12px;margin-top:2px}
655
692
  .slm-rsv .slm-rsvends{color:var(--slm-text)}
656
693
  .slm-rsv .slm-rsvends.soon{color:#b45309;font-weight:600}
657
- .slm-rsvacts{display:flex;gap:12px;margin-top:8px}
694
+ .slm-rsvacts{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
695
+ .slm .slm-rsvacts button{display:inline-flex;align-items:center;gap:7px;height:28px;padding:0 10px;border-radius:9px;border:1px solid var(--slm-line);background:var(--slm-bg);color:var(--slm-text);font:inherit;font-size:12px;font-weight:600;cursor:pointer}
696
+ .slm .slm-rsvacts button:hover{background:var(--slm-tint)}.slm .slm-rsvacts button.on{background:var(--slm-tint-strong)}
658
697
  .slm-rsvconfirm{margin-top:8px;border:1px solid color-mix(in srgb,#d64545 40%,var(--slm-line));border-radius:10px;padding:10px 12px;background:color-mix(in srgb,#d64545 7%,var(--slm-surface))}
659
698
  .slm-rsvconfirm p{margin:0 0 8px;font-size:12.5px}
660
699
  .slm-rsvconfirm div,.slm-rsvedit .slm-rsvbtns{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
@@ -662,24 +701,30 @@
662
701
  .slm-rsvedit{margin-top:8px;border-top:1px solid var(--slm-line);padding-top:8px}
663
702
  .slm-rsvdone{border-radius:10px;padding:10px 12px;background:rgba(34,160,107,.12);font-size:12.5px}
664
703
  .slm-rsvdone b{display:block}
665
- .slm-rsvempty{border:1px dashed var(--slm-line);border-radius:12px;padding:14px;text-align:center;color:var(--slm-muted);font-size:12.5px}
666
- .slm-rsvempty b{display:block;color:var(--slm-text);margin-bottom:4px}
704
+ .slm-rsvempty{border:1px dashed var(--slm-line);border-radius:12px;padding:20px 18px;text-align:center;color:var(--slm-muted);font-size:12.5px;line-height:1.5;background:var(--slm-tint)}
705
+ .slm-rsvempty b{display:block;color:var(--slm-text);margin-bottom:4px;font-size:14px}
706
+ .slm-rsvempty>.slm-rsvic{width:40px;height:40px;border-radius:12px;margin-bottom:10px}.slm-rsvempty>.slm-rsvic svg{width:20px;height:20px}
707
+ .slm .slm-rsvempty>button{display:block;margin:12px auto 0;padding:6px 11px;border-radius:8px;border:1px solid var(--slm-line);background:var(--slm-bg);color:var(--slm-text);font:inherit;font-size:12px;font-weight:600;cursor:pointer}
667
708
  .slm-rsvskel{height:62px;border-radius:10px;background:var(--slm-line);opacity:.45}
668
- `;Cr=i=>{let e=i;return e?.status===409&&Array.isArray(e.conflicts)?e.conflicts:[]},Mr=i=>i?.status===409?"Some of those seats were just taken or blocked. Check the map and try again.":"That did not save. Check the connection and try again."});function Rr(i){return i==null?"":ye(i).day===ye(Date.now()).day?W(i,{hour:"2-digit",minute:"2-digit"}):W(i,{month:"short",day:"numeric"})}function Xi(i){let e=[],t=0,s="loading",n="",a="",o=!1,r=!1,l=null,c=!1;i.mount.classList.add("slm-fb"),i.mount.innerHTML=`
709
+ `;Qr=i=>{let e=i;return e?.status===409&&Array.isArray(e.conflicts)?e.conflicts:[]},el=i=>i?.status===409?"Some of those seats were just taken or blocked. Check the map and try again.":"That did not save. Check the connection and try again."});function sl(i){return i==null?"":ke(i).day===ke(Date.now()).day?K(i,{hour:"2-digit",minute:"2-digit"}):K(i,{month:"short",day:"numeric"})}function ha(i){let e=[],t=0,s="loading",n="",a="",o=!1,r=!1,l=null,c=!1;i.mount.classList.add("slm-fb"),i.mount.innerHTML=`
669
710
  <div class="slm-fb-tools">
670
711
  <input type="search" class="slm-input" data-fb="q" placeholder="Reason, seat, row or section" aria-label="Search blocked seats" />
671
- <select class="slm-select" data-fb="section" aria-label="Filter by section"><option value="">All sections</option>${i.sections.map(h=>`<option value="${Oe(h.id)}">${Oe(h.label)}</option>`).join("")}</select>
712
+ <select class="slm-select" data-fb="section" aria-label="Filter by section"><option value="">All sections</option>${i.sections.map(u=>`<option value="${Ne(u.id)}">${Ne(u.label)}</option>`).join("")}</select>
672
713
  </div>
673
- <div data-fb="list" aria-live="polite"></div>`;let d=i.mount.querySelector('[data-fb="list"]'),b=()=>e.reduce((h,p)=>h+p.labels.length,0);function f(){let h=n.trim().toLowerCase();return e.flatMap(p=>{let g=a?p.labels.filter(y=>i.sectionOf(y)===a):p.labels;return g.length?h&&!(p.reason??"no reason given").toLowerCase().includes(h)&&!g.some(y=>y.toLowerCase().includes(h))&&!i.whereOf(g).toLowerCase().includes(h)?[]:[{...p,labels:g}]:[]})}function u(){if(s==="loading"){d.innerHTML='<div class="slm-rsvskel"></div><div class="slm-rsvskel"></div>';return}if(s==="failed"){d.innerHTML=i.alertHtml("error","Blocked seats could not load"," The seats are still blocked; only this list failed.")+'<button type="button" class="slm-btn ghost" data-fb-retry>Try again</button>';return}let h=t?`<p class="slm-fb-note">${t.toLocaleString()} reserved ${t===1?"seat is":"seats are"} in <b>Reserve</b>, not here. <button type="button" class="slm-linkbtn" data-fb-reserve>Open \u203A</button></p>`:"",p=b(),g=o?`<div class="slm-rsvconfirm" role="alertdialog" aria-label="Put all back on sale">
674
- <p><b>Put all ${p.toLocaleString()} blocked seats back on sale?</b> Buyers can pick them right away. Reserved seats stay reserved.</p>
675
- <div><button type="button" class="slm-btn ghost" data-fb-cancel>Cancel</button><button type="button" class="slm-btn" data-fb-all-go>Put ${p.toLocaleString()} back on sale</button></div>
676
- </div>`:"";if(!e.length){d.innerHTML=h+'<div class="slm-rsvempty"><b>Nothing is blocked</b>Every seat you have not reserved is on sale.</div>';return}let y=f(),L=n.trim();if(!y.length){d.innerHTML=h+`<div class="slm-rsvempty"><b>No blocked seats match${L?` \u201C${Oe(L)}\u201D`:" this section"}</b>Search by reason, seat, row or section.</div>`;return}let C=y.reduce((M,H)=>M+H.labels.length,0),x=L?`<p class="slm-fb-note">${y.length} ${y.length===1?"group":"groups"} \xB7 ${bt(C)} match \u201C${Oe(L)}\u201D</p>`:"";d.innerHTML=g+h+x+y.map((M,H)=>{let F=M.labels.length,N=M.byYou?"by you":M.byName?`by ${Oe(M.byName)}`:"",K=[Oe(i.whereOf(M.labels)),N,Rr(M.at)].filter(Boolean).join(" \xB7 "),se=M.releaseAt?`back on sale ${Oe(Er(M.releaseAt))}`:`off sale until you put ${F===1?"it":"them"} back`;return`<div class="slm-rsv" data-g="${H}"><b>${Oe(M.reason??"No reason given")} \xB7 ${bt(F)}</b><small>${K}</small><small>${se}</small>
677
- <div class="slm-rsvacts"><button type="button" class="slm-linkbtn" data-fb-show>Show</button><button type="button" class="slm-linkbtn" data-fb-select>Select</button></div></div>`}).join("")}function m(){let h=b(),p=i.selectedBlocked(),g=l&&l.until>Date.now();i.paintFoot(i.foot,r?{label:"Putting back on sale\u2026",busy:!0}:p.length?{label:`Put ${bt(p.length)} back on sale`,note:"Buyers can pick them again right away.",secondary:h>p.length?`Put all ${h.toLocaleString()} back on sale\u2026`:null}:{label:"Select a group or seats",disabled:!0,note:g?"Put back just now":"Select a group or seats, then put them back on sale.",secondary:g?"Undo":h?`Put all ${h.toLocaleString()} back on sale\u2026`:null})}async function v(){try{let h=await i.request("blocks");if(c)return;e=h.groups??[],t=h.reservedSeats??0,s="ready"}catch{if(c)return;s="failed"}u(),m()}let $=h=>{let p=h.closest("[data-g]");return p?f()[Number(p.dataset.g)]:void 0};i.mount.addEventListener("input",h=>{let p=h.target;p.matches('[data-fb="q"]')&&(n=p.value,u())}),i.mount.addEventListener("change",h=>{let p=h.target;p.matches('[data-fb="section"]')&&(a=p.value,u())}),i.mount.addEventListener("click",h=>{let p=h.target,g=$(p);if(g&&p.closest("[data-fb-show]")){i.show(g.labels);return}if(g&&p.closest("[data-fb-select]")){i.select(g.labels),m();return}if(p.closest("[data-fb-reserve]")){i.openReserve();return}if(p.closest("[data-fb-retry]")){s="loading",u(),v();return}if(p.closest("[data-fb-cancel]")){o=!1,u();return}p.closest("[data-fb-all-go]")&&(o=!1,r=!0,m(),i.unblockAll().finally(()=>{r=!1,v()}))});let A=i.foot.querySelector("[data-foot-action]"),O=i.foot.querySelector("[data-foot-secondary]"),B=async()=>{let h=i.selectedBlocked();if(!h.length||r)return;let p=e.find(y=>h.every(L=>y.labels.includes(L)));r=!0,m();let g=await i.unblock(h);r=!1,g&&(l={labels:h,reason:p?.reason??null,releaseAt:p?.releaseAt??null,until:Date.now()+Gi},i.alert(i.alertHtml("ok",`${bt(h.length)} back on sale`,` ${p?.reason?`${p.reason}, `:""}${i.whereOf(h)}. Buyers can pick them now.`)),setTimeout(()=>{c||m()},Gi+100)),await v()},k=async()=>{if(!r){if(l&&l.until>Date.now()&&!i.selectedBlocked().length){let h=l;l=null,r=!0,m();let p=await i.block(h.labels,h.reason,h.releaseAt);r=!1,p&&i.alert(i.alertHtml("ok",`${bt(h.labels.length)} blocked again`,` ${h.reason??"No reason given"}, ${i.whereOf(h.labels)}.`)),await v();return}o=!0,u()}};return A?.addEventListener("click",()=>{c||B()}),O?.addEventListener("click",()=>{c||k()}),u(),m(),v(),{paint:m,refresh:v,destroy(){c=!0}}}var Oe,bt,Gi,Er,Yi,Hs=Y(()=>{"use strict";me();Oe=i=>i.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),bt=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,Gi=3e4,Er=i=>W(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});Yi=`
714
+ <div data-fb="list" aria-live="polite"></div>`;let d=i.mount.querySelector('[data-fb="list"]'),g=()=>e.reduce((u,x)=>u+x.labels.length,0);function b(){let u=n.trim().toLowerCase();return e.flatMap(x=>{let y=a?x.labels.filter(h=>i.sectionOf(h)===a):x.labels;return y.length?u&&!(x.reason??"no reason given").toLowerCase().includes(u)&&!y.some(h=>h.toLowerCase().includes(u))&&!i.whereOf(y).toLowerCase().includes(u)?[]:[{...x,labels:y}]:[]})}function m(){if(s==="loading"){d.innerHTML='<div class="slm-rsvskel"></div><div class="slm-rsvskel"></div>';return}if(s==="failed"){d.innerHTML=i.alertHtml("error","Blocked seats could not load"," The seats are still blocked; only this list failed.")+'<button type="button" class="slm-btn ghost" data-fb-retry>Try again</button>';return}let u=t?`<p class="slm-fb-res"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#c026d3" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="M6.5 3.5h11v17l-5.5-4-5.5 4z"/></svg><span>${t.toLocaleString()} reserved ${t===1?"seat is":"seats are"} in <b>Reserve</b>, not here.</span><button type="button" class="slm-linkbtn" data-fb-reserve>Open \u203A</button></p>`:"",x=g(),y=o?`<div class="slm-rsvconfirm" role="alertdialog" aria-label="Put all back on sale">
715
+ <p><b>Put all ${x.toLocaleString()} blocked seats back on sale?</b> Buyers can pick them right away. Reserved seats stay reserved.</p>
716
+ <div><button type="button" class="slm-btn ghost" data-fb-cancel>Cancel</button><button type="button" class="slm-btn danger" data-fb-all-go>Put ${x.toLocaleString()} back on sale</button></div>
717
+ </div>`:"";if(!e.length){d.innerHTML=`<div class="slm-rsvempty">${xt("ban","#d64545")}<b>Nothing is blocked</b>Every seat you have not reserved is on sale.</div>`+u;return}let h=b(),v=n.trim();if(!h.length){d.innerHTML=u+`<div class="slm-rsvempty"><b>No blocked seats match${v?` \u201C${Ne(v)}\u201D`:" this section"}</b>Search by reason, seat, row or section.</div>`;return}let C=h.reduce((R,N)=>R+N.labels.length,0),E=new Set(i.selectedBlocked()),L=R=>R.length>0&&R.every(N=>E.has(N)),M=v?`<p class="slm-fb-note">${h.length} ${h.length===1?"group":"groups"} \xB7 ${kt(C)} match \u201C${Ne(v)}\u201D</p>`:"";d.innerHTML=y+u+M+h.map((R,N)=>{let j=R.labels.length,ee=R.byYou?"by you":R.byName?`by ${Ne(R.byName)}`:"",J=[Ne(i.whereOf(R.labels)),ee,sl(R.at)].filter(Boolean).join(" \xB7 "),X=R.releaseAt?`back on sale ${Ne(tl(R.releaseAt))}`:`off sale until you put ${j===1?"it":"them"} back`;return`<div class="slm-rsv ic" data-g="${N}">${xt("ban","#d64545")}<b>${Ne(R.reason??"No reason given")} \xB7 ${kt(j)}</b><small>${J}</small><small>${X}</small>
718
+ <div class="slm-rsvacts">${dt("data-fb-show","map","#3b82f6","Show")}${dt("data-fb-select","cursor","#d99a0b",L(R.labels)?"Selected":"Select",L(R.labels))}</div></div>`}).join("")}function p(){let u=g(),x=i.selectedBlocked(),y=new Set(x),h=b();d.querySelectorAll(".slm-rsv[data-g]").forEach(C=>{let E=h[Number(C.dataset.g)]?.labels??[],L=E.length>0&&E.every(R=>y.has(R)),M=C.querySelector("[data-fb-select]");M&&(M.classList.toggle("on",L),M.lastChild.textContent=L?"Selected":"Select")});let v=l&&l.until>Date.now();i.paintFoot(i.foot,r?{label:"Putting back on sale\u2026",busy:!0}:x.length?{label:`Put ${kt(x.length)} back on sale`,note:"Buyers can pick them again right away.",secondary:u>x.length?`Put all ${u.toLocaleString()} back on sale\u2026`:null}:{label:"Select seats first",disabled:!0,note:v?"Put back just now":"Select a group or seats, then put them back on sale.",secondary:v?"Undo":u?`Put all ${u.toLocaleString()} back on sale\u2026`:null,look:v?"done":void 0})}async function f(){try{let u=await i.request("blocks");if(c)return;e=u.groups??[],t=u.reservedSeats??0,s="ready"}catch{if(c)return;s="failed"}m(),p()}let k=u=>{let x=u.closest("[data-g]");return x?b()[Number(x.dataset.g)]:void 0};i.mount.addEventListener("input",u=>{let x=u.target;x.matches('[data-fb="q"]')&&(n=x.value,m())}),i.mount.addEventListener("change",u=>{let x=u.target;x.matches('[data-fb="section"]')&&(a=x.value,m())}),i.mount.addEventListener("click",u=>{let x=u.target,y=k(x);if(y&&x.closest("[data-fb-show]")){i.show(y.labels);return}if(y&&x.closest("[data-fb-select]")){i.select(y.labels),p();return}if(x.closest("[data-fb-reserve]")){i.openReserve();return}if(x.closest("[data-fb-retry]")){s="loading",m(),f();return}if(x.closest("[data-fb-cancel]")){o=!1,m();return}x.closest("[data-fb-all-go]")&&(o=!1,r=!0,p(),i.unblockAll().finally(()=>{r=!1,f()}))});let A=i.foot.querySelector("[data-foot-action]"),B=i.foot.querySelector("[data-foot-secondary]"),O=async()=>{let u=i.selectedBlocked();if(!u.length||r)return;let x=e.find(h=>u.every(v=>h.labels.includes(v)));r=!0,p();let y=await i.unblock(u);r=!1,y&&(l={labels:u,reason:x?.reason??null,releaseAt:x?.releaseAt??null,until:Date.now()+ca},i.alert(i.alertHtml("ok",`${kt(u.length)} back on sale`,` ${x?.reason?`${x.reason}, `:""}${i.whereOf(u)}. Buyers can pick them now.`)),setTimeout(()=>{c||p()},ca+100)),await f()},I=async()=>{if(!r){if(l&&l.until>Date.now()&&!i.selectedBlocked().length){let u=l;l=null,r=!0,p();let x=await i.block(u.labels,u.reason,u.releaseAt);r=!1,x&&i.alert(i.alertHtml("ok",`${kt(u.labels.length)} blocked again`,` ${u.reason??"No reason given"}, ${i.whereOf(u.labels)}.`)),await f();return}o=!0,m()}};return A?.addEventListener("click",()=>{c||O()}),B?.addEventListener("click",()=>{c||I()}),m(),p(),f(),{paint:p,refresh:f,destroy(){c=!0}}}var Ne,kt,ca,tl,da,_s=Y(()=>{"use strict";me();is();Ne=i=>i.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),kt=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,ca=3e4,tl=i=>K(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});da=`
678
719
  .slm-blk-listing [data-ref="selcard"],.slm-blk-listing [data-ref="addby"]{display:none}
679
720
  .slm-fb{display:grid;gap:8px}
680
- .slm-fb-tools{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,40%);gap:6px}
721
+ .slm-fb-tools{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px}
681
722
  .slm-fb-note{font-size:12px;color:var(--slm-muted);margin:0}
682
- `});function ta(i){return`<div class="slm-undobar"><span>${de(i)}</span><button type="button" class="slm-btn ghost s" data-undo><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/></svg>Undo</button></div>`}function sa(i){let e=null,t=null,s=null,n=null,a=null,o=Promise.resolve(),r=!1,l=null,c=!1;i.mount.classList.add("slm-sx");let d=k=>[...i.mount.querySelectorAll("[data-sx]")].find(h=>h.dataset.sx===k),b=k=>k.rule?.mode??"open",f=(k,h)=>{if(k.followsZone)return`<span class="slm-sx-chip">Follows ${de(h??"its zone")}</span>`;let p=b(k);return p==="timed"&&k.rule?.revealAt?`<span class="slm-sx-chip info">Opens ${de(Ji(k.rule.revealAt))}</span>`:p==="threshold"?`<span class="slm-sx-chip info">Opens at ${k.rule?.thresholdPct??80}% sold \xB7 now ${i.soldNow()}%</span>`:p==="closed"||k.closed?'<span class="slm-sx-chip">Closed</span>':p==="hidden"||k.hidden?'<span class="slm-sx-chip hidden">Hidden</span>':'<span class="slm-sx-chip ok">On sale</span>'};function u(k){let h=0,p=0,g=0,y=0,L=new Map;for(let x of k){let M=b(x);x.kind==="zone"&&L.set(x.id,M),M==="timed"?g++:M==="threshold"&&y++,x.kind==="section"&&(x.closed?p++:(M==="hidden"||x.followsZone&&L.get(x.zoneId??"")==="hidden")&&h++)}let C=[h&&`${h} hidden`,p&&`${p} closed`,g&&`${g} ${g===1?"opens":"open"} at a time`,y&&`${y} ${y===1?"opens":"open"} when the rest sells`].filter(Boolean);return`<p class="slm-sx-sum"><span class="slm-sx-dot${C.length?" warn":""}"></span>${C.length?C.join(" \xB7 "):"Every section is on sale"}</p>`}function m(k,h,p){let g=b(k),y=n===k.id?`<span class="slm-sx-saving">${Ir}Saving\u2026</span>`:k.followsZone?"":`<button type="button" class="slm-btn ghost s slm-sx-change" data-sx-change aria-haspopup="menu" aria-expanded="${t===k.id}"${i.readOnly?" disabled":""}>Change</button>`,L="";if(t===k.id)L=`<div class="slm-sx-menu" role="menu" aria-label="State of ${de(k.label)}">${Br.map(([x,M,H])=>`<button type="button" role="menuitemradio" aria-checked="${x===g}" data-sx-mode="${x}"><span><b>${M}</b><small>${H}</small></span>${x===g?"\u2713":""}</button>`).join("")}</div>`;else if(s?.id===k.id&&s.mode==="timed"){let x=k.rule?.mode==="timed"&&k.rule.revealAt?k.rule.revealAt:Date.now()+36e5;L=`<div class="slm-sx-edit">Opens at<div><input type="datetime-local" class="slm-input" data-sx-at value="${de(Hr(x))}" aria-label="When ${de(k.label)} opens" /><button type="button" class="slm-btn s" data-sx-save>Save</button></div><small>Hidden until then; buyers see it the moment it opens.</small></div>`}else if(s?.id===k.id){let x=k.rule?.mode==="threshold"?k.rule.thresholdPct??80:80;L=`<div class="slm-sx-edit">Opens when the rest of the venue is<div><input type="number" min="1" max="100" class="slm-input" data-sx-pct value="${de(x)}" aria-label="Share sold that opens ${de(k.label)}" /><span>% sold</span><span style="flex:1"></span><button type="button" class="slm-btn s" data-sx-save>Save</button></div><small>Now ${i.soldNow()}% sold. Nobody has to watch: it opens by itself.</small></div>`}return`<div class="${`slm-sx-row${k.kind==="zone"?" zone":""}${p?" in":""}${e===k.id?" on":""}`}" data-sx="${de(k.id)}"><div class="slm-sx-head"><div class="slm-sx-name"><b>${de(k.label)}${k.kind==="zone"?" \xB7 zone":""}</b><span>${k.seatCount.toLocaleString()} seats ${f(k,h)}</span></div>${y}</div>${L}</div>`}function v(){if(r)return;let k=i.rows();if(!k.length){i.mount.innerHTML=`<div class="slm-sx-none">${i.plate("layers",Qi,40)}<b>This chart has no sections</b><p>Draw sections or zones in the designer, and you can open, close or schedule each one here.</p>${i.openDesigner?'<button type="button" class="slm-btn ghost s" data-sx-designer>Open the designer</button>':""}</div>`;return}let h=null,p=k.map(y=>{if(y.kind==="zone")return h={id:y.id,label:y.label},m(y,null,!1);let L=!!h&&y.zoneId===h.id;return m(y,L?h.label:null,L)}).join(""),g=a&&a.until>Date.now()?ta("Changed just now"):"";i.mount.innerHTML=u(k)+`<div class="${i.readOnly?"slm-sx-ro":""}">${p}</div>`+g,c&&i.mount.querySelector('.slm-sx-menu [aria-checked="true"]')?.focus(),c=!1}function $(k){return i.rows().find(h=>h.id===k)}function A(k,h){let p=i.heldIn(k.seatLabels),g=p?` ${p.toLocaleString()} ${p===1?"seat":"seats"} already in a cart can still be bought.`:"";switch(h.mode){case"open":return[`${k.label} is on sale`,"Buyers can pick its seats now."];case"closed":return[`${k.label} is closed`,`On the map, greyed.${g}`];case"hidden":return[`${k.label} is hidden`,`Buyers no longer see it.${g}`];case"timed":return[`${k.label} opens ${Ji(h.revealAt??Date.now())}`,"Hidden until then; buyers see it the moment it opens."];default:return[`${k.label} opens at ${h.thresholdPct??80}% sold`,`Now ${i.soldNow()}% sold. Nobody has to watch: it opens by itself.`]}}let O={open:"open",closed:"close",hidden:"hide",timed:"schedule",threshold:"schedule"};function B(k,h){let p=$(k);!p||i.readOnly||(t=null,s=null,o=o.then(async()=>{if(r)return;n=k,v();let g=await i.change(k,h).catch(()=>null);if(n=null,!r){if(g){let[y,L]=A(p,h);i.alert(i.alertHtml("ok",y,` ${L}`)),a={token:g,until:Date.now()+Jt},l&&clearTimeout(l),l=setTimeout(()=>{r||v()},Jt+100)}else e=k,i.alert(i.alertHtml("error",`Couldn't ${O[h.mode]} ${p.label}`," Nothing changed for buyers. Check the connection and try again."));v()}}))}return i.mount.addEventListener("click",k=>{let h=k.target;if(h.closest("[data-sx-designer]")){i.openDesigner?.();return}if(h.closest("[data-undo]")&&a){let L=a.token;a=null,v(),o=o.then(async()=>{let C=await i.restore(L).catch(()=>!1);i.alert(C?i.alertHtml("ok","Undone"," The section is back as it was."):i.alertHtml("error","Couldn't undo"," Nothing changed for buyers. Try again.")),v()});return}let p=h.closest("[data-sx]"),g=p?.dataset.sx;if(!g)return;let y=h.closest("[data-sx-mode]")?.dataset.sxMode;if(y){if(y==="timed"||y==="threshold"){t=null,s={id:g,mode:y},v();return}B(g,{mode:y});return}if(h.closest("[data-sx-save]")){let L=p.querySelector("[data-sx-at]"),C=p.querySelector("[data-sx-pct]");if(L){let x=new Date(L.value).getTime();Number.isFinite(x)&&B(g,{mode:"timed",revealAt:x})}else C&&B(g,{mode:"threshold",thresholdPct:Math.max(1,Math.min(100,Math.round(Number(C.value)||0)))});return}if(h.closest("[data-sx-change]")){t=t===g?null:g,c=!!t,s=null,e=g,v(),i.frame(g);return}h.closest(".slm-sx-menu,.slm-sx-edit")||(e=g,t=null,s=null,v(),i.frame(g))}),i.mount.addEventListener("keydown",k=>{let h=k.target.closest(".slm-sx-menu");if(h){if(k.key==="Escape"){let p=t;t=null,v(),d(p)?.querySelector("[data-sx-change]")?.focus(),k.preventDefault()}else if(k.key==="ArrowDown"||k.key==="ArrowUp"){let p=[...h.querySelectorAll("button")],g=p.indexOf(document.activeElement);p[(g+(k.key==="ArrowDown"?1:-1)+p.length)%p.length]?.focus(),k.preventDefault()}}}),i.readOnly&&i.alert(i.alertHtml("info","You can look, not change",` Your role can see section states. ${ei(i.organizationName)} for "Block seats" to change them.`,"lock")),v(),{update:()=>{n||v()},pick(k){e=k,t=null,s=null,v(),d(k)?.scrollIntoView?.({block:"nearest"})},fired(k,h,p){let g=$(k);g&&(i.alert(i.alertHtml("info",`${g.label} opened at ${Ar(p)} by itself`,h==="timed"?" Its time came; buyers can pick its seats now.":" The rest of the venue sold past its share; buyers can pick its seats now.","clock")),v())},destroy(){r=!0,l&&clearTimeout(l)}}}function na(i){let e=[],t=null,s=null,n=null,a=!1,o=null;i.mount.classList.add("slm-tx");let r=(u,m)=>["individual","whole"].map(v=>`<button type="button" data-tx-mode="${v}" aria-pressed="${u.mode===v}"${m?" disabled":""}>${v==="individual"?"Per chair":"Whole table"}</button>`).join("");function l(u){let m=e.length>0,v=u.mode==="variable"?'<span class="slm-sx-chip">Flexible group \xB7 set by your app</span>':`<span class="slm-tx-switch" role="group" aria-label="How ${de(u.label)} sells">${r(u,m||!!u.locked||i.oldModel)}</span>`,$=u.locked?`<span class="slm-tx-lock"><b>Locked: ${de(u.locked)}.</b> Change it after those chairs are released. <button type="button" class="slm-linkbtn" data-tx-show>Show</button></span>`:"";return`<div class="slm-tx-row${e.includes(u.id)||s===u.id?" on":""}${u.locked?" locked":""}" data-tx="${de(u.id)}"><div class="slm-tx-top">${i.plate("table",Zi,26)}<div class="slm-sx-name"><b>${de(u.label)}</b><span>${u.chairs.toLocaleString()} chairs</span></div>${v}</div>${$}</div>`}let c=(u,m)=>u.filter(v=>v.mode!=="variable"&&!v.locked&&v.mode!==m);function d(u,m){let v=c(u,m).length,$=u.filter(k=>k.locked&&k.mode!==m&&k.mode!=="variable"),A=u.filter(k=>k.mode==="variable"),O=m==="whole"?"as whole tables":"per chair",B=[...$.map(k=>`${k.label} is locked (${k.locked}) and keeps selling ${k.mode==="whole"?"as a whole table":"per chair"}.`),A.length?`${A.map(k=>k.label).join(", ")} ${A.length===1?"stays a flexible group":"stay flexible groups"}.`:""].filter(Boolean).join(" ");return`<div class="slm-tx-ask" role="alertdialog" aria-label="Change ${De(v)}"><b>Sell ${De(v)} ${O}?</b>${de(B)}<div><button type="button" class="slm-btn ghost s" data-tx-cancel>Cancel</button><button type="button" class="slm-btn s" data-tx-go>Change ${De(v)}</button></div></div>`}function b(){if(a)return;let u=i.tables();if(!u.length){i.mount.innerHTML=`<div class="slm-sx-none">${i.plate("table",Zi,40)}<b>This chart has no tables</b><p>Add tables in the designer and they appear here. The tool hides itself on charts without tables.</p></div>`;return}let m=u.filter(p=>p.mode==="individual").length,v=u.filter(p=>p.mode==="whole").length,$=u.length-m-v,A=[`${m} per chair`,`${v} whole table`,$?`${$} flexible group`:""].filter(Boolean).join(" \xB7 "),O=e.length>0||i.oldModel,B=(p,g)=>`<button type="button" class="slm-btn ghost" data-tx-all="${p}"${O||!c(u,p).length?" disabled":""}>${g}</button>`,k=u.map(l).join(""),h=n&&n.until>Date.now()?ta("Changed just now"):"";i.mount.innerHTML=`<p class="slm-tx-sum">${De(u.length)} <span>\xB7 ${de(A)}</span></p>`+(i.oldModel?"":`<div class="slm-tx-all">${B("individual","All per chair")}${B("whole","All whole table")}</div>`)+(t?d(u,t):"")+`<div class="${i.oldModel?"slm-tx-old":""}">${k}</div>`+h}async function f(u,m,v=!1){let $=i.tables().filter(k=>u.includes(k.id)),A=$[0]?.mode==="whole"?"whole":"individual";e=u,t=null,b();let O=await i.save(u,m).catch(()=>"failed");if(e=[],a)return;let B=$.length===1?$[0].label:null;if(O==="ok"){let k=v?`${B??De(u.length)} ${B?"is":"are"} back as ${B?"it was":"they were"}`:m==="individual"?`${B??De(u.length)} now ${B?"sells":"sell"} per chair`:`${B??De(u.length)} now ${B?"sells as a whole table":"sell as whole tables"}`;i.alert(i.alertHtml("ok",k,m==="individual"?" Buyers pick single chairs from now on. The map was redrawn.":" Buyers book the whole table from now on. The map was redrawn.")),n=v?null:{ids:u,back:A,until:Date.now()+Jt},o&&clearTimeout(o),n&&(o=setTimeout(()=>{a||b()},Jt+100)),s=null}else if(O==="conflict"){let h=i.tables().filter(p=>u.includes(p.id)).reduce((p,g)=>p+g.held,0);s=u[0],i.alert(i.alertHtml("warn",`${B??De(u.length)} couldn't change`,` ${h?`A buyer put ${h.toLocaleString()} of ${B?"its":"their"} chairs in their cart a moment ago.`:"Some of its chairs were taken a moment ago."} Nothing was changed; try again once they finish.`))}else i.alert(i.alertHtml("error",`Couldn't change the ${u.length===1?"table":"tables"}`," Nothing changed for buyers. Check the connection and try again."));b()}return i.mount.addEventListener("click",u=>{let m=u.target;if(e.length)return;if(m.closest("[data-undo]")&&n){let k=n;n=null,f(k.ids,k.back,!0);return}let v=m.closest("[data-tx-all]")?.dataset.txAll;if(v){t=v,b();return}if(m.closest("[data-tx-cancel]")){t=null,b();return}if(m.closest("[data-tx-go]")&&t){let k=c(i.tables(),t).map(h=>h.id);k.length&&f(k,t);return}let $=m.closest("[data-tx]");if(!$)return;let A=$.dataset.tx;if(m.closest("[data-tx-show]")){i.show(A);return}let O=m.closest("[data-tx-mode]")?.dataset.txMode,B=i.tables().find(k=>k.id===A);O&&B&&B.mode!==O&&!B.locked&&f([A],O)}),i.oldModel&&i.alert(i.alertHtml("info","This event uses the older seat model"," Tables here can only sell the way the chart set them. Ask SeatLayer support to upgrade this event; nothing else changes.","info")),b(),{update:()=>{e.length||b()},destroy(){a=!0,o&&clearTimeout(o)}}}var de,Jt,Qi,Zi,Ji,Ar,Hr,Ir,ea,Br,De,Is=Y(()=>{"use strict";me();dt();de=i=>String(i).replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),Jt=3e4,Qi="#0ea5a5",Zi="#65a30d",Ji=i=>W(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),Ar=i=>W(i,{hour:"2-digit",minute:"2-digit"}),Hr=i=>new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16),Ir='<span class="slm-sx-spin" aria-hidden="true"></span>',ea=`
723
+ .slm-fb [data-fb="list"]{display:grid;gap:10px}
724
+ .slm .slm-fb-tools select{font-size:13px}.slm .slm-fb-tools input{-webkit-appearance:none;appearance:none}.slm .slm-fb-tools input::-webkit-search-cancel-button,.slm .slm-fb-tools input::-webkit-search-decoration{-webkit-appearance:none;display:none}.slm .slm-fb-tools input{font-size:13px;padding-left:28px;padding-right:4px;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%234c6fff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E") no-repeat 10px center}
725
+ .slm-fb-res{display:flex;align-items:center;gap:8px;margin:0;padding:10px 12px;border-radius:10px;background:color-mix(in srgb,#c026d3 10%,transparent);font-size:12.5px;line-height:1.4}
726
+ .slm-fb-res span{flex:1}.slm .slm-fb-res .slm-linkbtn{color:#c026d3!important;font-size:12.5px!important;font-weight:700!important}
727
+ `});function fa(i){return`<div class="slm-undobar"><span>${ue(i)}</span><button type="button" class="slm-btn ghost s" data-undo><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/></svg>Undo</button></div>`}function va(i){let e=null,t=new Map,s=null,n=null,a=null,o=null,r=Promise.resolve(),l=!1,c=null,d=!1;i.mount.classList.add("slm-sx");let g=u=>[...i.mount.querySelectorAll("[data-sx]")].find(x=>x.dataset.sx===u),b=u=>u.rule?.mode??"open",m=(u,x)=>{if(u.followsZone)return`<span class="slm-sx-chip">Follows ${ue(x??"its zone")}</span>`;let y=b(u);if(y==="timed"&&u.rule?.revealAt)return`<span class="slm-sx-chip info">Opens ${ue(pa(u.rule.revealAt))}</span>`;if(y==="threshold")return`<span class="slm-sx-chip info">Opens at ${u.rule?.thresholdPct??80}% sold \xB7 now ${i.soldNow()}%</span>`;if(y==="closed"||u.closed)return'<span class="slm-sx-chip">Closed</span>';if(y==="hidden"||u.hidden)return'<span class="slm-sx-chip hidden">Hidden</span>';let h=t.get(u.id);return`<span class="slm-sx-chip ok">${h?`Opened ${ma(h)} by itself`:"On sale"}</span>`};function p(u){let x=0,y=0,h=0,v=0,C=new Map;for(let L of u){let M=b(L);L.kind==="zone"&&C.set(L.id,M),M==="timed"?h++:M==="threshold"&&v++,L.kind==="section"&&(L.closed?y++:(M==="hidden"||L.followsZone&&C.get(L.zoneId??"")==="hidden")&&x++)}let E=[x&&`${x} hidden`,y&&`${y} closed`,h&&`${h} ${h===1?"opens":"open"} at a time`,v&&`${v} ${v===1?"opens":"open"} when the rest sells`].filter(Boolean);return`<p class="slm-sx-sum"><span class="slm-sx-dot${E.length?" warn":""}"></span>${E.length?E.join(" \xB7 "):"Every section is on sale"}</p>`}function f(u,x,y){let h=b(u),v=a===u.id?`<span class="slm-sx-saving">${il}Saving\u2026</span>`:u.followsZone?"":`<button type="button" class="slm-btn ghost s slm-sx-change" data-sx-change aria-haspopup="menu" aria-expanded="${s===u.id}"${i.readOnly?" disabled":""}>Change</button>`,C="";if(s===u.id)C=`<div class="slm-sx-menu" role="menu" aria-label="State of ${ue(u.label)}">${al.map(([L,M,R])=>`<button type="button" role="menuitemradio" aria-checked="${L===h}" data-sx-mode="${L}"><span><b>${M}</b><small>${R}</small></span>${L===h?"\u2713":""}</button>`).join("")}</div>`;else if(n?.id===u.id&&n.mode==="timed"){let L=u.rule?.mode==="timed"&&u.rule.revealAt?u.rule.revealAt:Date.now()+36e5;C=`<div class="slm-sx-edit">Opens at<div><input type="datetime-local" class="slm-input" data-sx-at value="${ue(nl(L))}" aria-label="When ${ue(u.label)} opens" /><button type="button" class="slm-btn s" data-sx-save>Save</button></div><small>Hidden until then; buyers see it the moment it opens.</small></div>`}else if(n?.id===u.id){let L=u.rule?.mode==="threshold"?u.rule.thresholdPct??80:80;C=`<div class="slm-sx-edit">Opens when the rest of the venue is<div><input type="number" min="1" max="100" class="slm-input" data-sx-pct value="${ue(L)}" aria-label="Share sold that opens ${ue(u.label)}" /><span>% sold</span><span style="flex:1"></span><button type="button" class="slm-btn s" data-sx-save>Save</button></div><small>Now ${i.soldNow()}% sold. Nobody has to watch: it opens by itself.</small></div>`}return`<div class="${`slm-sx-row${u.kind==="zone"?" zone":""}${y?" in":""}${e===u.id?" on":""}`}" data-sx="${ue(u.id)}"><div class="slm-sx-head"><div class="slm-sx-name"><b>${ue(u.label)}${u.kind==="zone"?" \xB7 zone":""}</b><span>${u.seatCount.toLocaleString()} seats ${m(u,x)}</span></div>${v}</div>${C}</div>`}function k(){if(l)return;let u=i.rows();if(!u.some(v=>v.id!=="__ungrouped__")){i.mount.innerHTML=`<div class="slm-sx-none">${i.plate("layers",ga,40)}<b>This chart has no sections</b><p>Draw sections or zones in the designer, and you can open, close or schedule each one here.</p>${i.openDesigner?'<button type="button" class="slm-btn ghost s" data-sx-designer>Open the designer</button>':""}</div>`;return}let x=null,y=u.map(v=>{if(v.kind==="zone")return x={id:v.id,label:v.label},f(v,null,!1);let C=!!x&&v.zoneId===x.id;return f(v,C?x.label:null,C)}).join(""),h=o&&o.until>Date.now()?fa("Changed just now"):"";i.mount.innerHTML=p(u)+`<div class="${i.readOnly?"slm-sx-ro":""}">${y}</div>`+h,d&&i.mount.querySelector('.slm-sx-menu [aria-checked="true"]')?.focus(),d=!1}function A(u){return i.rows().find(x=>x.id===u)}function B(u,x){let y=i.heldIn(u.seatLabels),h=y?` ${y.toLocaleString()} ${y===1?"seat":"seats"} already in a cart can still be bought.`:"";switch(x.mode){case"open":return[`${u.label} is on sale`,"Buyers can pick its seats now."];case"closed":return[`${u.label} is closed`,`On the map, greyed.${h}`];case"hidden":return[`${u.label} is hidden`,`Buyers no longer see it.${h}`];case"timed":return[`${u.label} opens ${pa(x.revealAt??Date.now())}`,"Hidden until then; buyers see it the moment it opens."];default:return[`${u.label} opens at ${x.thresholdPct??80}% sold`,`Now ${i.soldNow()}% sold. Nobody has to watch: it opens by itself.`]}}let O={open:"open",closed:"close",hidden:"hide",timed:"schedule",threshold:"schedule"};function I(u,x){let y=A(u);!y||i.readOnly||(s=null,n=null,r=r.then(async()=>{if(l)return;a=u,k();let h=await i.change(u,x).catch(()=>null);if(a=null,!l){if(h){let[v,C]=B(y,x);i.alert(i.alertHtml("ok",v,` ${C}`)),o={token:h,until:Date.now()+as},c&&clearTimeout(c),c=setTimeout(()=>{l||k()},as+100)}else e=u,i.alert(i.alertHtml("error",`Couldn't ${O[x.mode]} ${y.label}`," Nothing changed for buyers. Check the connection and try again."));k()}}))}return i.mount.addEventListener("click",u=>{let x=u.target;if(x.closest("[data-sx-designer]")){i.openDesigner?.();return}if(x.closest("[data-undo]")&&o){let C=o.token;o=null,k(),r=r.then(async()=>{let E=await i.restore(C).catch(()=>!1);i.alert(E?i.alertHtml("ok","Undone"," The section is back as it was."):i.alertHtml("error","Couldn't undo"," Nothing changed for buyers. Try again.")),k()});return}let y=x.closest("[data-sx]"),h=y?.dataset.sx;if(!h)return;let v=x.closest("[data-sx-mode]")?.dataset.sxMode;if(v){if(v==="timed"||v==="threshold"){s=null,n={id:h,mode:v},k();return}I(h,{mode:v});return}if(x.closest("[data-sx-save]")){let C=y.querySelector("[data-sx-at]"),E=y.querySelector("[data-sx-pct]");if(C){let L=new Date(C.value).getTime();Number.isFinite(L)&&I(h,{mode:"timed",revealAt:L})}else E&&I(h,{mode:"threshold",thresholdPct:Math.max(1,Math.min(100,Math.round(Number(E.value)||0)))});return}if(x.closest("[data-sx-change]")){s=s===h?null:h,d=!!s,n=null,e=h,k(),i.frame(h);return}x.closest(".slm-sx-menu,.slm-sx-edit")||(e=h,s=null,n=null,k(),i.frame(h))}),i.mount.addEventListener("keydown",u=>{let x=u.target.closest(".slm-sx-menu");if(x){if(u.key==="Escape"){let y=s;s=null,k(),g(y)?.querySelector("[data-sx-change]")?.focus(),u.preventDefault()}else if(u.key==="ArrowDown"||u.key==="ArrowUp"){let y=[...x.querySelectorAll("button")],h=y.indexOf(document.activeElement);y[(h+(u.key==="ArrowDown"?1:-1)+y.length)%y.length]?.focus(),u.preventDefault()}}}),i.readOnly&&i.alert(i.alertHtml("info","You can look, not change",` Your role can see section states. ${gt(i.organizationName)} for "Block seats" to change them.`,"lock")),k(),{update:()=>{a||k()},pick(u){e=u,s=null,n=null,k(),g(u)?.scrollIntoView?.({block:"nearest"})},fired(u,x,y){let h=A(u);h&&(t.set(u,y),i.alert(i.alertHtml("info",`${h.label} opened at ${ma(y)} by itself`,x==="timed"?" Its time came; buyers can pick its seats now.":" The rest of the venue sold past its share; buyers can pick its seats now.","clock")),k())},destroy(){l=!0,c&&clearTimeout(c)}}}function ya(i){let e=[],t=null,s=null,n=null,a=!1,o=null;i.mount.classList.add("slm-tx");let r=(m,p)=>["individual","whole"].map(f=>`<button type="button" data-tx-mode="${f}" aria-pressed="${m.mode===f}"${p?" disabled":""}>${f==="individual"?"Per chair":"Whole table"}</button>`).join("");function l(m){let p=e.length>0,f=m.mode==="variable"?'<span class="slm-sx-chip">Flexible group \xB7 set by your app</span>':`<span class="slm-tx-switch" role="group" aria-label="How ${ue(m.label)} sells">${r(m,p||!!m.locked||i.oldModel)}</span>`,k=m.locked?`<span class="slm-tx-lock"><b>Locked: ${ue(m.locked)}.</b> Change it after those chairs are released. <button type="button" class="slm-linkbtn" data-tx-show>Show</button></span>`:"";return`<div class="slm-tx-row${e.includes(m.id)||s===m.id?" on":""}${m.locked?" locked":""}" data-tx="${ue(m.id)}"><div class="slm-tx-top">${i.plate("table",ua,26)}<div class="slm-sx-name"><b>${ue(m.label)}</b><span>${m.chairs.toLocaleString()} chairs</span></div>${f}</div>${k}</div>`}let c=(m,p)=>m.filter(f=>f.mode!=="variable"&&!f.locked&&!f.held&&f.mode!==p);function d(m,p){let f=c(m,p).length,k=m.filter(I=>(I.locked||I.held)&&I.mode!==p&&I.mode!=="variable"),A=m.filter(I=>I.mode==="variable"),B=p==="whole"?"as whole tables":"per chair",O=[...k.map(I=>`${I.label} ${I.locked?`is locked (${I.locked})`:`has ${I.held} in a cart`} and keeps selling ${I.mode==="whole"?"as a whole table":"per chair"}.`),A.length?`${A.map(I=>I.label).join(", ")} ${A.length===1?"stays a flexible group":"stay flexible groups"}.`:""].filter(Boolean).join(" ");return`<div class="slm-tx-ask" role="alertdialog" aria-label="Change ${qe(f)}"><b>Sell ${qe(f)} ${B}?</b>${ue(O)}<div><button type="button" class="slm-btn ghost s" data-tx-cancel>Cancel</button><button type="button" class="slm-btn s" data-tx-go>Change ${qe(f)}</button></div></div>`}function g(){if(a)return;let m=i.tables();if(!m.length){i.mount.innerHTML=`<div class="slm-sx-none">${i.plate("table",ua,40)}<b>This chart has no tables</b><p>Add tables in the designer and they appear here. The tool hides itself on charts without tables.</p></div>`;return}let p=m.filter(x=>x.mode==="individual").length,f=m.filter(x=>x.mode==="whole").length,k=m.length-p-f,A=[`${p} per chair`,`${f} whole table`,k?`${k} flexible group`:""].filter(Boolean).join(" \xB7 "),B=e.length>0||i.oldModel,O=(x,y)=>`<button type="button" class="slm-btn ghost" data-tx-all="${x}"${B||!c(m,x).length?" disabled":""}>${y}</button>`,I=m.map(l).join(""),u=n&&n.until>Date.now()?fa("Changed just now"):"";i.mount.innerHTML=`<p class="slm-tx-sum">${qe(m.length)} <span>\xB7 ${ue(A)}</span></p>`+(i.oldModel?"":`<div class="slm-tx-all">${O("individual","All per chair")}${O("whole","All whole table")}</div>`)+(t?d(m,t):"")+`<div class="${i.oldModel?"slm-tx-old":""}">${I}</div>`+u}async function b(m,p,f=!1){let k=i.tables().filter(I=>m.includes(I.id)),A=k[0]?.mode==="whole"?"whole":"individual";e=m,t=null,g();let B=await i.save(m,p).catch(()=>"failed");if(e=[],a)return;let O=k.length===1?k[0].label:null;if(B==="ok"){let I=f?`${O??qe(m.length)} ${O?"is":"are"} back as ${O?"it was":"they were"}`:p==="individual"?`${O??qe(m.length)} now ${O?"sells":"sell"} per chair`:`${O??qe(m.length)} now ${O?"sells as a whole table":"sell as whole tables"}`;i.alert(i.alertHtml("ok",I,p==="individual"?" Buyers pick single chairs from now on. The map was redrawn.":" Buyers book the whole table from now on. The map was redrawn.")),n=f?null:{ids:m,back:A,until:Date.now()+as},o&&clearTimeout(o),n&&(o=setTimeout(()=>{a||g()},as+100)),s=null}else if(B==="conflict"){let u=i.tables().filter(x=>m.includes(x.id)).reduce((x,y)=>x+y.held,0);s=m[0],i.alert(i.alertHtml("warn",`${O??qe(m.length)} couldn't change`,` ${u?`A buyer put ${u.toLocaleString()} of ${O?"its":"their"} chairs in their cart a moment ago.`:"Some of its chairs were taken a moment ago."} Nothing was changed; try again once they finish.`))}else i.alert(i.alertHtml("error",`Couldn't change the ${m.length===1?"table":"tables"}`," Nothing changed for buyers. Check the connection and try again."));g()}return i.mount.addEventListener("click",m=>{let p=m.target;if(e.length)return;if(p.closest("[data-undo]")&&n){let I=n;n=null,b(I.ids,I.back,!0);return}let f=p.closest("[data-tx-all]")?.dataset.txAll;if(f){t=f,g();return}if(p.closest("[data-tx-cancel]")){t=null,g();return}if(p.closest("[data-tx-go]")&&t){let I=c(i.tables(),t).map(u=>u.id);I.length&&b(I,t);return}let k=p.closest("[data-tx]");if(!k)return;let A=k.dataset.tx;if(p.closest("[data-tx-show]")){i.show(A);return}let B=p.closest("[data-tx-mode]")?.dataset.txMode,O=i.tables().find(I=>I.id===A);B&&O&&O.mode!==B&&!O.locked&&b([A],B)}),i.oldModel&&i.alert(i.alertHtml("info","This event uses the older seat model"," Tables here can only sell the way the chart set them. Ask SeatLayer support to upgrade this event; nothing else changes.","info")),g(),{update:()=>{e.length||g()},destroy(){a=!0,o&&clearTimeout(o)}}}var ue,as,ga,ua,pa,ma,nl,il,ba,al,qe,js=Y(()=>{"use strict";me();nt();ue=i=>String(i).replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),as=3e4,ga="#0ea5a5",ua="#65a30d",pa=i=>K(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),ma=i=>K(i,{hour:"2-digit",minute:"2-digit"}),nl=i=>new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16),il='<span class="slm-sx-spin" aria-hidden="true"></span>',ba=`
683
728
  .slm-sx{display:grid;gap:4px}
684
729
  .slm-sx-sum{display:flex;align-items:center;gap:8px;margin:2px 0 6px;font-size:12.5px;font-weight:600}
685
730
  .slm-sx-dot{width:8px;height:8px;border-radius:50%;background:#22a06b;flex:none}.slm-sx-dot.warn{background:#d99a0b}
@@ -697,7 +742,7 @@
697
742
  .slm-sx-chip.ok{color:color-mix(in srgb,#22a06b 72%,var(--slm-text));background:color-mix(in srgb,#22a06b 14%,transparent)}
698
743
  .slm-sx-chip.info{color:color-mix(in srgb,#3b82f6 72%,var(--slm-text));background:color-mix(in srgb,#3b82f6 13%,transparent)}
699
744
  .slm-sx-saving{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;font-weight:500;color:var(--slm-muted)}
700
- .slm-sx-spin{width:12px;height:12px;border-radius:50%;border:2px solid var(--slm-line);border-top-color:${Qi};animation:slm-sx-spin .8s linear infinite}
745
+ .slm-sx-spin{width:12px;height:12px;border-radius:50%;border:2px solid var(--slm-line);border-top-color:${ga};animation:slm-sx-spin .8s linear infinite}
701
746
  @keyframes slm-sx-spin{to{transform:rotate(360deg)}}
702
747
  @media (prefers-reduced-motion:reduce){.slm-sx-spin{animation:none}}
703
748
  .slm-sx-menu{margin:4px 12px 8px;padding:5px;border-radius:12px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 8px 24px rgba(12,18,32,.14)}
@@ -732,9 +777,9 @@
732
777
  .slm-tx-old{opacity:.6}
733
778
  .slm-tx-ask{margin-top:10px;padding:12px;border-radius:12px;background:color-mix(in srgb,#d99a0b 12%,var(--slm-surface));font-size:12.5px;line-height:1.45}
734
779
  .slm-tx-ask b{display:block}.slm-tx-ask div{display:flex;gap:8px;justify-content:flex-end;margin-top:10px}
735
- `,Br=[["open","On sale","Buyers can pick these seats"],["closed","Closed","On the map, greyed; nobody can buy"],["hidden","Hidden","Not on the buyer map at all"],["timed","Opens at a time","Hidden until the moment you pick"],["threshold","Opens when the rest sells","Hidden until the other sections pass a share sold"]];De=i=>`${i.toLocaleString()} ${i===1?"table":"tables"}`});function la(){let i=globalThis.AudioContext;return i?new i:null}function da(i){let e=Qt,t=!1,s=null,n=[],a=0,o=null,r=null,l=!1,c=null,d=!1,b=null,f=0,u=new Map,m=new Map,v=new Map,$=new Map,A=new Map,O=new Map,B=new Set,k=null,h=document.createElement("div");h.className="slm-alertstack",i.mapLayer.appendChild(h);let p=document.createElement("div");p.className="slm-alertpop",p.hidden=!0,i.mapLayer.closest(".slm")?.appendChild(p);let g=S=>S.soldout||S.passes.on||S.fast.on||S.back||S.ending.on,y=S=>[S.soldout,S.passes.on,S.fast.on,S.back,S.ending.on].filter(Boolean).length;async function L(S){e=S,He();try{await i.store.save(S),s=null}catch{s=Date.now()}He()}i.store.load().then(S=>{l||(e=S??Qt,t=!0,C(),j())}).catch(()=>{t=!0,C(),j()});function C(){for(let S of i.sections())A.set(S.id,i.sectionCounts(S.id));for(let S of i.reservations())S.releaseAt!=null&&S.releaseAt<=Date.now()&&O.set(S.id,"ended")}function x(){if(k=null,!t||l)return;let S=new Map(i.sections().map(T=>[T.id,T.label]));for(let T of B){let D=A.get(T),z=i.sectionCounts(T);if(A.set(T,z),!D||!z.total)continue;let V=S.get(T)??"A section";if(e.soldout&&D.free>0&&z.free===0&&z.booked>0){F("soldout",`${V} sold out`,`${z.total.toLocaleString()} of ${z.total.toLocaleString()} seats.`,{sectionId:T},`${V} \xB7 sold out`),v.set(T,Date.now());continue}e.back&&D.free===0&&z.free>0&&F("back",`${V} has ${ft(z.free)} again`,"They are on sale again.",{sectionId:T},`${V} \xB7 ${ft(z.free)} back on sale`);let ue=e.passes.pct;if(e.passes.on&&D.booked*100<ue*D.total&&z.booked*100>=ue*z.total&&F("passes",`${V} passed ${ue}% sold`,`${ft(z.free)} left.`,{sectionId:T},`${V} \xB7 ${ue}% sold \xB7 ${z.free.toLocaleString()} left`),e.fast.on){let le=e.fast.minutes*6e4,kt=($.get(T)??[]).filter(lo=>lo>Date.now()-le);$.set(T,kt);let oo=(m.get(T)??0)>Date.now(),ro=(v.get(T)??0)>Date.now()-oa;kt.length>=e.fast.seats&&!oo&&!ro&&(v.set(T,Date.now()),F("fast",`${V} is selling fast`,`${kt.length.toLocaleString()} seats in the last ${e.fast.minutes} minutes. ${z.free.toLocaleString()} left.`,{sectionId:T},`${V} \xB7 ${kt.length} sold in the last ${e.fast.minutes} minutes \xB7 ${z.free} left`))}}B.clear()}function M(){if(!t||l)return;let S=Date.now();for(let T of i.reservations()){if(T.releaseAt==null)continue;let D=O.get(T.id),z=i.where(T.labels);T.releaseAt<=S&&D!=="ended"?(O.set(T.id,"ended"),e.ending.on&&F("ended",`${T.name} ended`,`${ft(T.labels.length)} in ${z} are on sale again.`,{labels:T.labels},`${T.name} \xB7 ended`,{labels:T.labels})):e.ending.on&&!D&&T.releaseAt-S<=e.ending.minutes*6e4&&T.releaseAt>S&&(O.set(T.id,"ending"),F("ending",`${T.name} ends in ${Math.max(1,Math.round((T.releaseAt-S)/6e4))} minutes`,`${ft(T.labels.length)} in ${z} go back on sale at ${rt(T.releaseAt)}.`,{labels:T.labels},`${T.name} \xB7 ends at ${rt(T.releaseAt)}`,{reservationId:T.id,labels:T.labels}))}}let H=setInterval(M,3e4);function F(S,T,D,z,V,we={}){let ue={id:++a,kind:S,title:T,body:D,at:Date.now(),read:!1,target:z,why:V,...we};n.unshift(ue),typeof document<"u"&&document.hidden?(f+=1,b??=ue.at):xe(ue),z.sectionId&&i.ring?.(z.sectionId,gt[S].hue),i.feedSlot()&&E(),j(),o==="new"&&He(),e.sound&&N()}function N(){try{if(c??=la(),!c)return;if(c.state==="suspended"){d=!0,c.resume().then(()=>{d=!1}),o==="rules"&&He();return}let S=c.createOscillator(),T=c.createGain();S.frequency.value=880,T.gain.setValueAtTime(.08,c.currentTime),T.gain.exponentialRampToValueAtTime(1e-4,c.currentTime+.25),S.connect(T).connect(c.destination),S.start(),S.stop(c.currentTime+.25)}catch{}}function K(S){return S.kind==="ending"&&i.canManage?[["extend","Extend 1 h"],["release","Release now"],["dismiss","Let it end"]]:S.kind==="ended"&&i.canManage?[["show","Show"],["again","Reserve again"]]:S.kind==="fast"?[["show","Show"],["mute","Mute for 1 h"]]:[["show","Show"]]}function se(S){let T=gt[S.kind];return`<div class="slm-alertmsg" role="status" aria-live="polite" data-alert="${S.id}"><i style="background:${T.hue}"></i>${i.plate(T.glyph,T.hue,30)}<span><span class="slm-alertmsg-top"><b>${Ve(S.title)}</b><small>${rt(S.at)}</small><button type="button" aria-label="Close" data-alert-close>${Bs}</button></span><p>${Ve(S.body)}</p><span class="slm-alertacts">${K(S).map(([D,z])=>`<button type="button" data-alert-act="${D}">${z}</button>`).join("")}</span></span></div>`}function ae(){let S=n.filter(z=>u.has(z.id)),T=S.slice(0,3),D=S.length-T.length;h.innerHTML=(D>0?`<div class="slm-alertmore">+${D} more \xB7 <button type="button" class="slm-linkbtn" data-alert-list>Open the list</button></div>`:"")+T.slice().reverse().map(se).join("")}function xe(S){let T=setTimeout(()=>R(S.id),aa);u.set(S.id,T),ae()}function R(S){let T=u.get(S);T&&clearTimeout(T),u.delete(S),l||ae()}async function _(S,T){S.read=!0,T==="show"?i.show(S.target,S.why):T==="mute"&&S.target.sectionId?m.set(S.target.sectionId,Date.now()+oa):T==="extend"&&S.reservationId?await i.extend(S.reservationId,36e5):T==="release"&&S.reservationId?await i.release(S.reservationId):T==="again"&&S.labels&&i.reserveAgain(S.labels),R(S.id),j(),o&&He()}h.addEventListener("mouseover",S=>{let T=Number(S.target.closest("[data-alert]")?.dataset.alert),D=u.get(T);D&&(clearTimeout(D),u.set(T,setTimeout(()=>R(T),aa)))}),h.addEventListener("click",S=>{let T=S.target;if(T.closest("[data-alert-list]")){Q("new");return}let D=Number(T.closest("[data-alert]")?.dataset.alert),z=n.find(we=>we.id===D);if(!z)return;if(T.closest("[data-alert-close]")){R(D);return}let V=T.closest("[data-alert-act]")?.dataset.alertAct;V==="dismiss"?(z.read=!0,R(D),j()):V&&_(z,V)});let ne=S=>{if(S.key!=="Escape"||!u.size)return;let T=n.find(D=>u.has(D.id));T&&R(T.id)};document.addEventListener("keydown",ne);function E(){let S=i.feedSlot();if(!S)return;let T=n.filter(D=>D.at>Date.now()-15*6e4).slice(0,2);S.innerHTML=T.map(D=>{let z=gt[D.kind],[V]=K(D);return`<div class="slm-alertfeed" data-alert-feed="${D.id}" style="background:color-mix(in srgb,${z.hue} 12%,transparent)">${i.plate(z.glyph,z.hue,24)}<span><b>${Ve(D.title)}</b><small> \xB7 ${rt(D.at)}</small></span><button type="button" data-alert-act="${V[0]==="dismiss"?"show":V[0]}">${V[0]==="extend"?"Extend":V[1]}</button></div>`}).join(""),S.querySelectorAll("[data-alert-feed]").forEach(D=>D.addEventListener("click",z=>{let V=z.target.closest("[data-alert-act]")?.dataset.alertAct,we=n.find(ue=>ue.id===Number(D.dataset.alertFeed));V&&we&&_(we,V)}))}let P=()=>n.filter(S=>!S.read).length;function j(){let S=P();i.bellMount.innerHTML=`<button type="button" class="slm-bell" data-bell aria-haspopup="dialog" aria-expanded="${o!==null}" aria-label="Alerts${S?`, ${S} new`:""}">${ia}${S?`<b>${S}</b>`:""}</button>`}i.bellMount.addEventListener("click",S=>{S.target.closest("[data-bell]")&&(o?Z():Q(g(e)||n.length?"new":"rules"))});function Q(S="new"){o=S,p.hidden=!1,He(),j(),p.querySelector('[role="tab"][aria-selected="true"]')?.focus()}function Z(){o=null,r=null,p.hidden=!0,j(),i.bellMount.querySelector("[data-bell]")?.focus()}let te=(S,T,D,z)=>`<select data-rule-value="${S}" aria-label="${S}">${T.map(V=>`<option value="${V}"${V===D?" selected":""}>${V}${z}</option>`).join("")}</select>`,he=(S,T,D)=>`<button type="button" class="slm-switch" role="switch" aria-checked="${T}" aria-label="${Ve(D)}" data-rule="${S}"><i></i></button>`;function ve(S,T,D,z){let V=gt[S];return`<div class="slm-alertrule${D?"":" off"}">${i.plate(V.glyph,V.hue,26)}<span>${z}</span>${he(T,D,T)}</div>`}function io(){let S=e,D=!g(S)?'<div class="slm-alertintro"><b>Nothing alerts you yet</b>Pick what should find you while the room is open. An alert is a message over the map, a line in the feed and a ring on the section.</div><div class="slm-alertusual"><button type="button" class="slm-btn" data-rule-usual>Turn on the usual three</button><small>Sells out, passes 90%, a reservation about to end.</small></div>':"",z=s?i.alertHtml("error","Couldn't save your alerts"," They work in this tab until you close it. Try again when the connection is back."):"",V=d?'<small style="color:color-mix(in srgb,#b45309 75%,var(--slm-text))">The browser blocked sound. Click anywhere in the room once, then it plays.</small>':"<small>Plays for alerts only, never for every sale.</small>";return z+D+ve("soldout","soldout",S.soldout,"A section sells out")+ve("passes","passes",S.passes.on,`A section passes ${te("pct",[50,75,90,95],S.passes.pct,"%")}<span>sold</span>`)+ve("fast","fast",S.fast.on,`Selling fast: ${te("seats",[5,10,15,25,50],S.fast.seats," seats")}<span>in</span>${te("minutes",[5,10,15,30],S.fast.minutes," min")}`)+ve("back","back",S.back,"A sold-out section gets seats back")+ve("ending","ending",S.ending.on,`A reservation is about to end ${te("endMinutes",[15,30,60],S.ending.minutes," min")}<span>before</span>`)+`<div class="slm-alertrule${S.sound?"":" off"}">${i.plate("bell","#64748b",26)}<span>Play a sound${V}</span>${he("sound",S.sound,"Play a sound")}</div>`}function ao(){return n.length?'<div class="slm-alertlisthead"><span>Today</span><button type="button" class="slm-linkbtn" data-alert-readall>Mark all read</button></div>'+n.map(S=>{let T=gt[S.kind],[D]=K(S),z=D[0]==="extend"?"Extend":D[1];return`<div class="slm-alertrow${S.read?"":" unread"}" data-alert-row="${S.id}">${i.plate(T.glyph,T.hue,26)}<span><b>${Ve(S.title)}</b><small>${Ve(S.body)} \xB7 ${rt(S.at)}</small></span><button type="button" class="slm-linkbtn" data-alert-act="${D[0]}">${z}</button><i aria-hidden="true"></i></div>`}).join(""):`<div class="slm-alertempty">${i.plate("bell",es,38)}<b>Nothing yet today</b><p>Alerts you turn on land here, newest first. ${y(e)===1?"1 is":`${y(e)} are`} on.</p></div>`}function He(){if(!o)return;let S=P(),T=o==="rules"?s?`<button type="button" class="slm-btn ghost" data-rule-retry>Try again</button><span>Saving failed at ${rt(s)}.</span>`:ra[i.store.where]:n.length?"Alerts stay here until you close the room.":ra[i.store.where];p.innerHTML=`<div class="slm-alertpop-head" role="dialog" aria-label="Alerts">${ia}<b>Alerts</b><button type="button" class="slm-linkbtn" aria-label="Close alerts" data-alert-close>${Bs}</button></div><div class="slm-alertpop-body"><div class="slm-alerttabs" role="tablist"><button type="button" role="tab" aria-selected="${o==="new"}" data-alert-tab="new">${S?`Alerts \xB7 ${S} new`:"Alerts"}</button><button type="button" role="tab" aria-selected="${o==="rules"}" data-alert-tab="rules">What alerts me</button></div>${o==="rules"?io():ao()}</div><div class="slm-alertpop-foot">${T}</div>`}p.addEventListener("click",S=>{let T=S.target;if(T.closest("[data-alert-close]")){Z();return}let D=T.closest("[data-alert-tab]")?.dataset.alertTab;if(D){o=D,He();return}if(T.closest("[data-rule-usual]")){L({...Pr,sound:e.sound});return}if(T.closest("[data-rule-retry]")){L(e);return}if(T.closest("[data-alert-readall]")){for(let le of n)le.read=!0;He(),j();return}let z=T.closest("[data-rule]")?.dataset.rule;if(z){let le=JSON.parse(JSON.stringify(e));z==="soldout"?le.soldout=!le.soldout:z==="back"?le.back=!le.back:z==="sound"?(le.sound=!le.sound,le.sound&&(c??=la(),c?.resume().catch(()=>{}))):(z==="passes"||z==="fast"||z==="ending")&&(le[z].on=!le[z].on),L(le);return}let V=T.closest("[data-alert-row]"),we=T.closest("[data-alert-act]")?.dataset.alertAct,ue=V?n.find(le=>le.id===Number(V.dataset.alertRow)):null;ue&&we&&_(ue,we)}),p.addEventListener("change",S=>{let T=S.target,D=T.dataset.ruleValue;if(!D)return;let z=JSON.parse(JSON.stringify(e)),V=Number(T.value);D==="pct"?z.passes.pct=V:D==="seats"?z.fast.seats=V:D==="minutes"?z.fast.minutes=V:D==="endMinutes"&&(z.ending.minutes=V),L(z)}),p.addEventListener("keydown",S=>{S.key==="Escape"&&(Z(),S.stopPropagation())});let Xs=()=>{if(document.hidden||!f)return;let S=n.find(D=>D.at>=(b??0)),T=f;f=0,b=null,i.bannerMount.innerHTML=`<div class="slm-connbanner info" role="status"><span>${T.toLocaleString()} ${T===1?"alert":"alerts"} came in while this tab was in the background. ${Ve(S?.title??"")}${T>1?`, and ${(T-1).toLocaleString()} more`:""}.</span><button type="button" data-away-see>See them</button><button type="button" aria-label="Close" data-away-close>${Bs}</button></div>`};return i.bannerMount.addEventListener("click",S=>{let T=S.target;T.closest("[data-away-see]")?(i.bannerMount.innerHTML="",Q("new")):T.closest("[data-away-close]")&&(i.bannerMount.innerHTML="")}),document.addEventListener("visibilitychange",Xs),j(),{seatChanged(S,T,D){!S||T===D||(D==="booked"&&$.set(S,[...$.get(S)??[],Date.now()]),B.add(S),k??=setTimeout(x,400))},paintFeed:E,openBell:Q,destroy(){l=!0,k&&clearTimeout(k),clearInterval(H);for(let S of u.values())clearTimeout(S);document.removeEventListener("keydown",ne),document.removeEventListener("visibilitychange",Xs),h.remove(),p.remove(),c?.close().catch(()=>{})}}}function ha(i,e){let t=Ps(i),s={where:"event",async load(){try{let n=await e("alert-rules");return n.rules?{...Qt,...n.rules}:null}catch(n){let a=n.status;if(a===409||a===404||a===405)return s.where="browser",t.load();throw n}},async save(n){if(s.where==="browser")return t.save(n);await e("alert-rules",{method:"PUT",body:{rules:n}})}};return s}function Ps(i){let e=`slm-alerts:${i}`;return{where:"browser",async load(){try{let t=localStorage.getItem(e);return t?{...Qt,...JSON.parse(t)}:null}catch{return null}},async save(t){localStorage.setItem(e,JSON.stringify(t))}}}var Pr,Qt,Ve,gt,es,ia,Bs,aa,oa,rt,ft,ra,ca,Os=Y(()=>{"use strict";me();Pr={soldout:!0,passes:{on:!0,pct:90},fast:{on:!1,seats:15,minutes:10},back:!1,ending:{on:!0,minutes:30},sound:!1},Qt={soldout:!1,passes:{on:!1,pct:90},fast:{on:!1,seats:15,minutes:10},back:!1,ending:{on:!1,minutes:30},sound:!1},Ve=i=>String(i).replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),gt={soldout:{glyph:"star",hue:"#8b5cf6"},passes:{glyph:"gauge",hue:"#0ea5a5"},fast:{glyph:"bolt",hue:"#e8782a"},back:{glyph:"seat",hue:"#22a06b"},ending:{glyph:"clock",hue:"#c026d3"},ended:{glyph:"clock",hue:"#c026d3"}},es="#d99a0b",ia=`<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="${es}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z"/><path d="M10 20.5a2 2 0 0 0 4 0"/></svg>`,Bs='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',aa=8e3,oa=36e5,rt=i=>W(i,{hour:"2-digit",minute:"2-digit"}),ft=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,ra={event:"Kept for you on this event. Everyone sets their own.",browser:"Kept in this browser, for this event."},ca=`
780
+ `,al=[["open","On sale","Buyers can pick these seats"],["closed","Closed","On the map, greyed; nobody can buy"],["hidden","Hidden","Not on the buyer map at all"],["timed","Opens at a time","Hidden until the moment you pick"],["threshold","Opens when the rest sells","Hidden until the other sections pass a share sold"]];qe=i=>`${i.toLocaleString()} ${i===1?"table":"tables"}`});function Sa(){let i=globalThis.AudioContext;return i?new i:null}function $a(i){let e=os,t=!1,s=null,n=[],a=0,o=null,r=null,l=!1,c=null,d=!1,g=null,b=0,m=new Map,p=new Map,f=new Map,k=new Map,A=new Map,B=new Map,O=new Map,I=new Set,u=new Set,x=null,y=document.createElement("div");y.className="slm-alertstack",i.mapLayer.appendChild(y);let h=document.createElement("div");h.className="slm-alertpop",h.hidden=!0,i.mapLayer.closest(".slm")?.appendChild(h);let v=$=>$.soldout||$.passes.on||$.fast.on||$.back||$.ending.on,C=$=>[$.soldout,$.passes.on,$.fast.on,$.back,$.ending.on].filter(Boolean).length;async function E($){e=$,Be();try{await i.store.save($),s=null}catch{s=Date.now()}Be()}i.store.load().then($=>{l||(e=$??os,t=!0,L(),q())}).catch(()=>{t=!0,L(),q()});function L(){for(let $ of i.sections()){let T=i.sectionCounts($.id);B.set($.id,T),T.total&&T.booked===T.total&&u.add($.id)}for(let $ of i.reservations())$.releaseAt!=null&&$.releaseAt<=Date.now()&&O.set($.id,"ended")}function M(){if(x=null,!t||l)return;let $=new Map(i.sections().map(T=>[T.id,T.label]));for(let T of I){let z=B.get(T),F=i.sectionCounts(T);if(B.set(T,F),!z||!F.total)continue;let V=$.get(T)??"A section";if(F.free===0&&F.booked>z.booked&&!A.get(T)&&!u.has(T)&&(u.add(T),e.soldout)){j("soldout",`${V} sold out`,`${F.booked.toLocaleString()} of ${F.total.toLocaleString()} seats.`,{sectionId:T},`${V} \xB7 sold out`),f.set(T,Date.now());continue}F.free>0&&u.delete(T)&&e.back&&z.free===0&&j("back",`${V} has ${Lt(F.free)} again`,"They are on sale again.",{sectionId:T},`${V} \xB7 ${Lt(F.free)} back on sale`);let re=e.passes.pct;if(e.passes.on&&z.booked*100<re*z.total&&F.booked*100>=re*F.total&&j("passes",`${V} passed ${re}% sold`,`${Lt(F.free)} left.`,{sectionId:T},`${V} \xB7 ${re}% sold \xB7 ${F.free.toLocaleString()} left`),e.fast.on){let Ce=e.fast.minutes*6e4,ae=(k.get(T)??[]).filter(Do=>Do>Date.now()-Ce);k.set(T,ae);let Bo=(p.get(T)??0)>Date.now(),Oo=(f.get(T)??0)>Date.now()-ka;ae.length>=e.fast.seats&&!Bo&&!Oo&&(f.set(T,Date.now()),j("fast",`${V} is selling fast`,`${ae.length.toLocaleString()} seats in the last ${e.fast.minutes} minutes. ${F.free.toLocaleString()} left.`,{sectionId:T},`${V} \xB7 ${ae.length} sold in the last ${e.fast.minutes} minutes \xB7 ${F.free} left`))}}I.clear()}function R(){if(!t||l)return;let $=Date.now();for(let T of i.reservations()){if(T.releaseAt==null)continue;let z=O.get(T.id),F=i.where(T.labels);if(T.releaseAt<=$&&z!=="ended")O.set(T.id,"ended"),e.ending.on&&j("ended",`${T.name} ended`,`${Lt(T.labels.length)} in ${F} are on sale again.`,{labels:T.labels},`${T.name} \xB7 ended`,{labels:T.labels});else if(e.ending.on&&!z&&T.releaseAt-$<=e.ending.minutes*6e4&&T.releaseAt>$){O.set(T.id,"ending");let V=Math.max(1,Math.round((T.releaseAt-$)/6e4));j("ending",`${T.name} ends in ${V} ${V===1?"minute":"minutes"}`,`${Lt(T.labels.length)} in ${F} go back on sale at ${St(T.releaseAt)}.`,{labels:T.labels},`${T.name} \xB7 ends at ${St(T.releaseAt)}`,{reservationId:T.id,labels:T.labels})}}}let N=setInterval(R,3e4);function j($,T,z,F,V,re={}){let Ce={id:++a,kind:$,title:T,body:z,at:Date.now(),read:!1,target:F,why:V,...re};n.unshift(Ce),typeof document<"u"&&document.hidden?(b+=1,g??=Ce.at):ye(Ce),F.sectionId&&i.ring?.(F.sectionId,wt[$].hue),i.feedSlot()&&D(),q(),o==="new"&&Be(),e.sound&&ee()}function ee(){try{if(c??=Sa(),!c)return;if(c.state==="suspended"){d=!0,c.resume().then(()=>{d=!1}),o==="rules"&&Be();return}let $=c.createOscillator(),T=c.createGain();$.frequency.value=880,T.gain.setValueAtTime(.08,c.currentTime),T.gain.exponentialRampToValueAtTime(1e-4,c.currentTime+.25),$.connect(T).connect(c.destination),$.start(),$.stop(c.currentTime+.25)}catch{}}function J($){return $.kind==="ending"&&i.canManage?[["extend","Extend 1 h"],["release","Release now"],["dismiss","Let it end"]]:$.kind==="ended"&&i.canManage?[["show","Show"],["again","Reserve again"]]:$.kind==="fast"?[["show","Show"],["mute","Mute for 1 h"]]:[["show","Show"]]}function X($){let T=wt[$.kind];return`<div class="slm-alertmsg" role="status" aria-live="polite" data-alert="${$.id}"><i style="background:${T.hue}"></i>${i.plate(T.glyph,T.hue,30)}<span><span class="slm-alertmsg-top"><b>${Ge($.title)}</b><small>${St($.at)}</small><button type="button" aria-label="Close" data-alert-close>${Us}</button></span><p>${Ge($.body)}</p><span class="slm-alertacts">${J($).map(([z,F])=>`<button type="button" data-alert-act="${z}">${F}</button>`).join("")}</span></span></div>`}function ne(){let $=n.filter(F=>m.has(F.id)),T=$.slice(0,3),z=$.length-T.length;y.innerHTML=(z>0?`<div class="slm-alertmore">+${z} more \xB7 <button type="button" class="slm-linkbtn" data-alert-list>Open the list</button></div>`:"")+T.slice().reverse().map(X).join("")}function ye($){let T=setTimeout(()=>he($.id),xa);m.set($.id,T),ne()}function he($){let T=m.get($);T&&clearTimeout(T),m.delete($),l||ne()}async function w($,T){$.read=!0,T==="show"?i.show($.target,$.why):T==="mute"&&$.target.sectionId?p.set($.target.sectionId,Date.now()+ka):T==="extend"&&$.reservationId?await i.extend($.reservationId,36e5):T==="release"&&$.reservationId?await i.release($.reservationId):T==="again"&&$.labels&&i.reserveAgain($.labels),he($.id),q(),o&&Be()}y.addEventListener("mouseover",$=>{let T=Number($.target.closest("[data-alert]")?.dataset.alert),z=m.get(T);z&&(clearTimeout(z),m.set(T,setTimeout(()=>he(T),xa)))}),y.addEventListener("click",$=>{let T=$.target;if(T.closest("[data-alert-list]")){te("new");return}let z=Number(T.closest("[data-alert]")?.dataset.alert),F=n.find(re=>re.id===z);if(!F)return;if(T.closest("[data-alert-close]")){he(z);return}let V=T.closest("[data-alert-act]")?.dataset.alertAct;V==="dismiss"?(F.read=!0,he(z),q()):V&&w(F,V)});let H=$=>{if($.key!=="Escape"||!m.size)return;let T=n.find(z=>m.has(z.id));T&&he(T.id)};document.addEventListener("keydown",H);function D(){let $=i.feedSlot();if(!$)return;let T=n.filter(z=>z.at>Date.now()-15*6e4).slice(0,2);$.innerHTML=T.map(z=>{let F=wt[z.kind],[V]=J(z),re=Math.floor((Date.now()-z.at)/6e4);return`<div class="slm-alertfeed${z.kind==="soldout"?' urgent"':`" style="--al:${F.hue}"`} data-alert-feed="${z.id}">${Vs.replace($t,"currentColor")}<span><b>${Ge(z.title)}</b> \xB7 ${re<1?"just now":`${re} min ago`}</span><button type="button" data-alert-act="${V[0]==="dismiss"?"show":V[0]}">${V[0]==="extend"?"Extend":V[1]}</button></div>`}).join(""),$.querySelectorAll("[data-alert-feed]").forEach(z=>z.addEventListener("click",F=>{let V=F.target.closest("[data-alert-act]")?.dataset.alertAct,re=n.find(Ce=>Ce.id===Number(z.dataset.alertFeed));V&&re&&w(re,V)}))}let U=()=>n.filter($=>!$.read).length;function q(){let $=U();i.bellMount.innerHTML=`<button type="button" class="slm-bell" data-bell aria-haspopup="dialog" aria-expanded="${o!==null}" aria-label="Alerts${$?`, ${$} new`:""}">${Vs}${$?`<b>${$}</b>`:""}</button>`}i.bellMount.addEventListener("click",$=>{$.target.closest("[data-bell]")&&(o?ie():te(v(e)||n.length?"new":"rules"))});function te($="new"){o=$,h.hidden=!1,Be(),q(),h.querySelector('[role="tab"][aria-selected="true"]')?.focus()}function ie(){o=null,r=null,h.hidden=!0,q(),i.bellMount.querySelector("[data-bell]")?.focus()}let xe=($,T,z,F)=>`<select data-rule-value="${$}" aria-label="${$}">${T.map(V=>`<option value="${V}"${V===z?" selected":""}>${V}${F}</option>`).join("")}</select>`,Le=($,T,z)=>`<button type="button" class="slm-switch" role="switch" aria-checked="${T}" aria-label="${Ge(z)}" data-rule="${$}"><i></i></button>`;function $e($,T,z,F){let V=wt[$];return`<div class="slm-alertrule${z?"":" off"}">${i.plate(V.glyph,V.hue,26)}<span>${F}</span>${Le(T,z,T)}</div>`}function Io(){let $=e,z=!v($)?'<div class="slm-alertintro"><b>Nothing alerts you yet</b>Pick what should find you while the room is open. An alert is a message over the map, a line in the feed and a ring on the section.</div><div class="slm-alertusual"><button type="button" class="slm-btn" data-rule-usual>Turn on the usual three</button><small>Sells out, passes 90%, a reservation about to end.</small></div>':"",F=s?i.alertHtml("error","Couldn't save your alerts"," They work in this tab until you close it. Try again when the connection is back."):"",V=d?'<small style="color:color-mix(in srgb,#b45309 75%,var(--slm-text))">The browser blocked sound. Click anywhere in the room once, then it plays.</small>':"<small>Plays for alerts only, never for every sale.</small>";return F+z+$e("soldout","soldout",$.soldout,"A section sells out")+$e("passes","passes",$.passes.on,`A section passes ${xe("pct",[50,75,90,95],$.passes.pct,"%")}<span>sold</span>`)+$e("fast","fast",$.fast.on,`Selling fast: ${xe("seats",[5,10,15,25,50],$.fast.seats," seats")}<span>in</span>${xe("minutes",[5,10,15,30],$.fast.minutes," min")}`)+$e("back","back",$.back,"A sold-out section gets seats back")+$e("ending","ending",$.ending.on,`A reservation is about to end ${xe("endMinutes",[15,30,60],$.ending.minutes," min")}<span>before</span>`)+`<div class="slm-alertrule${$.sound?"":" off"}">${i.plate("bell","#64748b",26)}<span>Play a sound${V}</span>${Le("sound",$.sound,"Play a sound")}</div>`}function Po(){return n.length?'<div class="slm-alertlisthead"><span>Today</span><button type="button" class="slm-linkbtn" data-alert-readall>Mark all read</button></div>'+n.map($=>{let T=wt[$.kind],[z]=J($),F=z[0]==="extend"?"Extend":z[1];return`<div class="slm-alertrow${$.read?"":" unread"}" data-alert-row="${$.id}">${i.plate(T.glyph,T.hue,26)}<span><b>${Ge($.title)}</b><small>${Ge($.body)} \xB7 ${St($.at)}</small></span><button type="button" class="slm-linkbtn" data-alert-act="${z[0]}">${F}</button><i aria-hidden="true"></i></div>`}).join(""):`<div class="slm-alertempty">${i.plate("bell",$t,38)}<b>Nothing yet today</b><p>Alerts you turn on land here, newest first. ${C(e)===1?"1 is":`${C(e)} are`} on.</p></div>`}function Be(){if(!o)return;let $=U(),T=o==="rules"?s?`<button type="button" class="slm-btn ghost" data-rule-retry>Try again</button><span>Saving failed at ${St(s)}.</span>`:wa[i.store.where]:n.length?"Alerts stay here until you close the room.":wa[i.store.where];h.innerHTML=`<div class="slm-alertpop-head" role="dialog" aria-label="Alerts">${Vs}<b>Alerts</b><button type="button" class="slm-linkbtn" aria-label="Close alerts" data-alert-close>${Us}</button></div><div class="slm-alertpop-body"><div class="slm-alerttabs" role="tablist"><button type="button" role="tab" aria-selected="${o==="new"}" data-alert-tab="new">${$?`Alerts \xB7 ${$} new`:"Alerts"}</button><button type="button" role="tab" aria-selected="${o==="rules"}" data-alert-tab="rules">What alerts me</button></div>${o==="rules"?Io():Po()}</div><div class="slm-alertpop-foot">${T}</div>`}h.addEventListener("click",$=>{let T=$.target;if(T.closest("[data-alert-close]")){ie();return}let z=T.closest("[data-alert-tab]")?.dataset.alertTab;if(z){o=z,Be();return}if(T.closest("[data-rule-usual]")){E({...ol,sound:e.sound});return}if(T.closest("[data-rule-retry]")){E(e);return}if(T.closest("[data-alert-readall]")){for(let ae of n)ae.read=!0;Be(),q();return}let F=T.closest("[data-rule]")?.dataset.rule;if(F){let ae=JSON.parse(JSON.stringify(e));F==="soldout"?ae.soldout=!ae.soldout:F==="back"?ae.back=!ae.back:F==="sound"?(ae.sound=!ae.sound,ae.sound&&(c??=Sa(),c?.resume().catch(()=>{}))):(F==="passes"||F==="fast"||F==="ending")&&(ae[F].on=!ae[F].on),E(ae);return}let V=T.closest("[data-alert-row]"),re=T.closest("[data-alert-act]")?.dataset.alertAct,Ce=V?n.find(ae=>ae.id===Number(V.dataset.alertRow)):null;Ce&&re&&w(Ce,re)}),h.addEventListener("change",$=>{let T=$.target,z=T.dataset.ruleValue;if(!z)return;let F=JSON.parse(JSON.stringify(e)),V=Number(T.value);z==="pct"?F.passes.pct=V:z==="seats"?F.fast.seats=V:z==="minutes"?F.fast.minutes=V:z==="endMinutes"&&(F.ending.minutes=V),E(F)}),h.addEventListener("keydown",$=>{$.key==="Escape"&&(ie(),$.stopPropagation())});let un=()=>{if(document.hidden||!b)return;let $=n.find(z=>z.at>=(g??0)),T=b;b=0,g=null,i.bannerMount.innerHTML=`<div class="slm-connbanner info" role="status"><span>${T.toLocaleString()} ${T===1?"alert":"alerts"} came in while this tab was in the background. ${Ge($?.title??"")}${T>1?`, and ${(T-1).toLocaleString()} more`:""}.</span><button type="button" data-away-see>See them</button><button type="button" aria-label="Close" data-away-close>${Us}</button></div>`};return i.bannerMount.addEventListener("click",$=>{let T=$.target;T.closest("[data-away-see]")?(i.bannerMount.innerHTML="",te("new")):T.closest("[data-away-close]")&&(i.bannerMount.innerHTML="")}),document.addEventListener("visibilitychange",un),q(),{seatChanged($,T,z){!$||T===z||(z==="booked"&&k.set($,[...k.get($)??[],Date.now()]),A.set($,Math.max(0,(A.get($)??0)+(z==="held"?1:0)-(T==="held"?1:0))),I.add($),x??=setTimeout(M,400))},paintFeed:D,openBell:te,destroy(){l=!0,x&&clearTimeout(x),clearInterval(N);for(let $ of m.values())clearTimeout($);document.removeEventListener("keydown",H),document.removeEventListener("visibilitychange",un),y.remove(),h.remove(),c?.close().catch(()=>{})}}}function Ca(i,e){let t=Ks(i),s={where:"event",async load(){try{let n=await e("alert-rules");return n.rules?{...os,...n.rules}:null}catch(n){let a=n.status;if(a===409||a===404||a===405)return s.where="browser",t.load();throw n}},async save(n){if(s.where==="browser")return t.save(n);await e("alert-rules",{method:"PUT",body:{rules:n}})}};return s}function Ks(i){let e=`slm-alerts:${i}`;return{where:"browser",async load(){try{let t=localStorage.getItem(e);return t?{...os,...JSON.parse(t)}:null}catch{return null}},async save(t){localStorage.setItem(e,JSON.stringify(t))}}}var ol,os,Ge,wt,$t,Vs,Us,xa,ka,St,Lt,wa,La,Ws=Y(()=>{"use strict";me();ol={soldout:!0,passes:{on:!0,pct:90},fast:{on:!1,seats:15,minutes:10},back:!1,ending:{on:!0,minutes:30},sound:!1},os={soldout:!1,passes:{on:!1,pct:90},fast:{on:!1,seats:15,minutes:10},back:!1,ending:{on:!1,minutes:30},sound:!1},Ge=i=>String(i).replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),wt={soldout:{glyph:"star",hue:"#8b5cf6"},passes:{glyph:"gauge",hue:"#0ea5a5"},fast:{glyph:"bolt",hue:"#e8782a"},back:{glyph:"seat",hue:"#22a06b"},ending:{glyph:"clock",hue:"#c026d3"},ended:{glyph:"clock",hue:"#c026d3"}},$t="#d99a0b",Vs=`<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="${$t}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z"/><path d="M10 20.5a2 2 0 0 0 4 0"/></svg>`,Us='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',xa=8e3,ka=36e5,St=i=>K(i,{hour:"2-digit",minute:"2-digit"}),Lt=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,wa={event:"Kept for you on this event. Everyone sets their own.",browser:"Kept in this browser, for this event."},La=`
736
781
  .slm .slm-bell{position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:34px;border-radius:9px;border:1px solid var(--slm-line);background:var(--slm-surface)}
737
- .slm .slm-bell[aria-expanded="true"]{border-color:${es};box-shadow:0 0 0 3px color-mix(in srgb,${es} 30%,transparent)}
782
+ .slm .slm-bell[aria-expanded="true"]{border-color:${$t};box-shadow:0 0 0 3px color-mix(in srgb,${$t} 30%,transparent)}
738
783
  .slm-bell b{position:absolute;top:-5px;right:-5px;min-width:17px;height:17px;padding:0 4px;box-sizing:border-box;border-radius:9px;background:#d64545;color:#fff;font-size:10.5px;line-height:13px;text-align:center;border:2px solid var(--slm-surface)}
739
784
  .slm-alertpop{position:absolute;right:76px;top:60px;z-index:40;width:380px;max-width:calc(100% - 24px);border-radius:16px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 24px 60px rgba(12,18,32,.26);overflow:hidden}
740
785
  .slm-alertpop-head{display:flex;align-items:center;gap:8px;padding:14px 16px 10px}.slm-alertpop-head b{flex:1;font-size:15px;font-weight:700}
@@ -778,13 +823,20 @@
778
823
  .slm-alertmsg p{margin:2px 0 0;font-size:12.5px;line-height:1.4;color:var(--slm-muted)}
779
824
  .slm-alertacts{display:flex;flex-wrap:wrap;gap:16px;margin-top:8px}
780
825
  .slm .slm-alertacts button{font-size:12.5px;font-weight:700;color:var(--slm-muted)}.slm .slm-alertacts button:first-child{color:var(--slm-accent)}
781
- .slm-alertfeed{margin:0 0 8px;padding:9px 12px;border-radius:12px;display:flex;gap:10px;align-items:center;font-size:12.5px;line-height:1.4}
782
- .slm-alertfeed>span:nth-child(2){flex:1;min-width:0}.slm-alertfeed small{color:var(--slm-muted)}
783
- .slm .slm-alertfeed button{font-weight:700;color:var(--slm-accent)}
826
+ .slm-alertfeed{margin:12px 0 0;padding:10px 12px;border-radius:12px;display:flex;gap:10px;align-items:center;font-size:12.5px;font-weight:500;line-height:1.4;color:var(--al);background:color-mix(in srgb,var(--al) 13%,var(--slm-surface))}
827
+ .slm-alertfeed svg{flex:none}.slm-alertfeed>span{flex:1;min-width:0}
828
+ .slm-alertfeed.urgent{--al:#ff8a8f;background:#3d1a1e}.slm[data-theme="light"] .slm-alertfeed.urgent{--al:#b4232a;background:#fdecec}
829
+ .slm .slm-alertfeed button{font-weight:700;color:inherit}
784
830
  .slm.compact .slm-alertstack{left:12px;right:12px;bottom:auto;top:8px;max-width:none}
785
831
  .slm.compact .slm-alertmsg{width:auto}.slm.compact .slm-alertmsg p,.slm.compact .slm-alertacts{display:none}
786
- `});function Dr(i,e=Date.now()){let t=ye(i),s=ye(e),n=W(i,{hour:"2-digit",minute:"2-digit"},[]),a=s.day-t.day;return a===0?`Today, ${n}`:a===1?`Yesterday, ${n}`:a>1&&a<7?`${W(i,{weekday:"short"},[])}, ${n}`:`${W(i,{day:"numeric",month:"short",...t.year===s.year?{}:{year:"numeric"}},[])}, ${n}`}function zr(i){let e=i.byYou?"You":i.by??null;switch(i.action){case"hold":{let t=i.origin;return t?.kind==="buyer"?["A buyer",ua[t.label??""]??t.label].filter(Boolean).join(" \xB7 "):t?.kind==="staff"?"Box office":t?.kind==="api_key"?"Your server":""}case"release":return"The buyer took it out";case"expire":return"Nobody paid in time";case"reservation.end":return"At its end time";case"book":case"unbook":{let t=i.origin;return t?.kind==="buyer"?[i.buyer??"A buyer",ua[t.label??""]??t.label].filter(Boolean).join(" \xB7 "):t?.kind==="api_key"?"Your server":t?.kind==="staff"?[e??"Box office",i.buyer?`for ${i.buyer}`:null].filter(Boolean).join(" \xB7 "):i.buyer??""}default:return[e,i.via?Or[i.via]:null].filter(Boolean).join(" \xB7 ")}}function Nr(i,e,t,s){let[n,a]=ma[i.action]??[i.action,"#94a3b8"],o=zr(i),r=!!i.ref&&e?.ref===i.ref,l=r?e?.displayRef??e?.order?.displayRef??i.ref:i.ref,c=i.ref?t&&r?`<button type="button" class="slm-ss-ref" data-ss-ref="${w(i.ref)}">${w(l)}</button>`:`<span class="slm-ss-mono">${w(l)}</span>`:"",d=[o?w(o):"",i.note?w(i.note):"",c].filter(Boolean).join(" \xB7 "),b=new Date(i.at);return`<div class="slm-ss-row" data-action="${w(i.action)}"><i style="background:${a}"></i><span><span class="slm-ss-top"><b>${w(n)}</b><time datetime="${b.toISOString()}" title="${w(b.toString())}">${w(Dr(i.at,s))}</time></span>`+(d?`<small>${d}</small>`:"")+"</span></div>"}function pa(i){let e=!1,t=!1,s=0,n,a=null,o=[],r=null,l=!1,c=!1,d=i.mount;d.classList.add("slm-ss");let b=!1,f=()=>{if(e)return;let m=Date.now(),v=b?0:d.querySelector(".slm-ss-list")?.scrollTop??0;b=!1;let $='<p class="slm-ss-title">Seat history</p>';if(l&&!o.length){d.innerHTML=$+`<div class="slm-ss-fail" role="alert"><span><b>History couldn't load.</b> The seat itself is fine.</span><button type="button" data-ss-retry>Try again</button></div>`;return}if(!a){d.innerHTML=$+Fr();return}if(!a.total){d.innerHTML=$+`<div class="slm-ss-empty"><b>Nothing has happened to this seat yet</b>${i.free?"It has been free since the event went on sale.":""}</div>`;return}let A=[{action:"",count:a.total},...a.counts].map(({action:k,count:h})=>`<button type="button" data-ss-kind="${w(k)}" aria-pressed="${(n??"")===k}">${k?`${w(ma[k]?.[0]??k)} ${h}`:`${h} ${h===1?"change":"changes"}`}</button>`).join(""),O=!!i.openOrder&&!!a.booking?.order;d.innerHTML=$+`<div class="slm-ss-chips">${A}</div>`+(c?'<div class="slm-ss-newwrap"><button type="button" class="slm-ss-new" data-ss-latest>\u2191 New activity \xB7 Show latest</button></div>':"")+`<div class="slm-ss-list" role="region" aria-label="Seat history" tabindex="0">${o.map(k=>Nr(k,a.booking,O,m)).join("")}</div>`+(l?`<div class="slm-ss-fail" role="alert"><span><b>Older history couldn't load.</b></span><button type="button" data-ss-retry>Try again</button></div>`:"")+(r!==null?'<button type="button" class="slm-btn ghost s slm-ss-older" data-ss-older>Load older</button>':"");let B=d.querySelector(".slm-ss-list");B&&(B.scrollTop=v)},u=async(m=!1,v=!1)=>{if(e||t||m&&r===null)return;t=!0;let $=s;try{let A=!m&&!v&&i.first&&!n?i.first:await i.fetchPage(m?r:void 0,n);if(i.first=null,e||$!==s)return;if(l=!1,v&&o.length&&A.entries[0]?.id!==o[0]?.id){let O=d.querySelector(".slm-ss-list");if(O&&O.scrollTop>24){a={...A,entries:a?.entries??[]},c=!0,f();return}}a=A,m?o=[...o,...A.entries.filter(O=>!o.some(B=>B.id===O.id))]:o=A.entries,r=A.nextBefore,f()}catch{if(e||$!==s)return;v||(l=!0,f())}finally{t=!1}};return d.addEventListener("click",m=>{let v=m.target,$=v.closest("[data-ss-kind]");if($&&!t){n=$.dataset.ssKind||void 0,b=!0,s++,o=[],r=null,c=!1,a=a&&{...a},u();return}if(v.closest("[data-ss-older]")){u(!0);return}if(v.closest("[data-ss-retry]")){l=!1,f(),u(o.length>0&&r!==null);return}if(v.closest("[data-ss-latest]")){c=!1,b=!0,s++,u();return}v.closest("[data-ss-ref]")&&a?.booking?.order&&i.openOrder?.({id:a.booking.order.id,displayRef:a.booking.order.displayRef})}),f(),u(),{refresh(){!t&&!l&&u(!1,!0)},destroy(){e=!0,s++,d.innerHTML="",d.classList.remove("slm-ss")}}}var ma,Or,ua,Fr,ba,Ds=Y(()=>{"use strict";pe();me();ma={hold:["In a cart","#d99a0b"],release:["Left the cart","#94a3b8"],expire:["Cart expired","#94a3b8"],book:["Booked","#22a06b"],unbook:["Booking cancelled","#d64545"],block:["Blocked","#d64545"],unblock:["Unblocked","#64748b"],reserve:["Reserved","#c026d3"],unreserve:["Reservation released","#64748b"],"reservation.end":["Reservation ended","#64748b"]},Or={control_room:"Control room",dashboard:"Dashboard",api:"Your server"},ua={"public picker":"public sale","promoter link":"promoter link","partner link":"partner link","private access link":"private link"};Fr=()=>'<div class="slm-ss-note" role="status">Loading history\u2026</div>'+[90,70,110,80].map(i=>`<div class="slm-ss-row slm-ss-skel"><i></i><span><em style="width:${i}px"></em><em style="width:${i+60}px"></em></span></div>`).join("");ba=`
832
+ `});function ll(i,e=Date.now()){let t=ke(i),s=ke(e),n=K(i,{hour:"2-digit",minute:"2-digit"},[]),a=s.day-t.day;return a===0?`Today, ${n}`:a===1?`Yesterday, ${n}`:a>1&&a<7?`${K(i,{weekday:"short"},[])}, ${n}`:`${K(i,{day:"numeric",month:"short",...t.year===s.year?{}:{year:"numeric"}},[])}, ${n}`}function cl(i){let e=i.byYou?"You":i.by??null;switch(i.action){case"hold":{let t=i.origin,s=(i.holdMinutes??0)>=1?`for ${i.holdMinutes} min`:null;return t?.kind==="buyer"?["A buyer",Ta[t.label??""]??t.label,s].filter(Boolean).join(" \xB7 "):t?.kind==="staff"?"Box office":t?.kind==="api_key"?"Your server":s??""}case"release":return"The buyer took it out";case"expire":return"Nobody paid in time";case"reservation.end":return"At its end time";case"book":case"unbook":{let t=i.origin;return t?.kind==="buyer"?[i.buyer??"A buyer",Ta[t.label??""]??t.label].filter(Boolean).join(" \xB7 "):t?.kind==="api_key"?"Your server":t?.kind==="staff"?[e??"Box office",i.buyer?`for ${i.buyer}`:null].filter(Boolean).join(" \xB7 "):i.buyer??""}default:return[e,i.via?rl[i.via]:null].filter(Boolean).join(" \xB7 ")}}function dl(i,e,t,s){let[n,a]=Ma[i.action]??[i.action,"#94a3b8"],o=cl(i),r=!!i.ref&&e?.ref===i.ref,l=r?e?.displayRef??e?.order?.displayRef??i.ref:i.ref,c=i.ref?t&&r?`<button type="button" class="slm-ss-ref" data-ss-ref="${S(i.ref)}">${S(l)}</button>`:`<span class="slm-ss-mono">${S(l)}</span>`:"",d=[o?S(o):"",i.note?S(i.note):"",c].filter(Boolean).join(" \xB7 "),g=new Date(i.at);return`<div class="slm-ss-row" data-action="${S(i.action)}"><i style="background:${a}"></i><span><span class="slm-ss-top"><b>${S(n)}</b><time datetime="${g.toISOString()}" title="${S(g.toString())}">${S(ll(i.at,s))}</time></span>`+(d?`<small>${d}</small>`:"")+"</span></div>"}function Ea(i){let e=!1,t=!1,s=0,n,a=null,o=[],r=null,l=!1,c=!1,d=i.mount;d.classList.add("slm-ss");let g=!1,b=()=>{let f=d.closest(".slm-watchcard");if(!f)return"";let k=B=>[...f.querySelectorAll("dl > div")].find(O=>O.querySelector("dt")?.textContent===B)?.querySelector("dd")?.textContent??"",A=[k("Status").split(" \xB7 ")[0],k("Ticket type").replace(" \xB7 "," ")].filter(Boolean).join(" \xB7 ");return`<div class="slm-ss-seat">${f.querySelector(".slm-seat-heading > :first-child")?.outerHTML??""}<span><b>${S(f.querySelector("h2")?.textContent??"")}</b><small>${S(A)}</small></span><button type="button" class="slm-linkbtn" data-ss-back>\u2039 Seat</button></div>`},m=()=>{if(e)return;let f=Date.now(),k=g?0:d.querySelector(".slm-ss-list")?.scrollTop??0;g=!1;let A=b()+'<p class="slm-ss-title">Seat history</p>';if(l&&!o.length){d.innerHTML=A+`<div class="slm-ss-fail" role="alert"><span><b>History couldn't load.</b> The seat itself is fine.</span><button type="button" data-ss-retry>Try again</button></div>`;return}if(!a){d.innerHTML=A+hl();return}if(!a.total){d.innerHTML=A+`<div class="slm-ss-empty"><b>Nothing has happened to this seat yet</b>${i.free?"It has been free since the event went on sale.":""}</div>`;return}let B=[{action:"",count:a.total},...a.counts].map(({action:u,count:x})=>`<button type="button" data-ss-kind="${S(u)}" aria-pressed="${(n??"")===u}">${u?`${S(Ma[u]?.[0]??u)} ${x}`:`${x} ${x===1?"change":"changes"}`}</button>`).join(""),O=!!i.openOrder&&!!a.booking?.order;d.innerHTML=A+`<div class="slm-ss-chips">${B}</div>`+(c?'<div class="slm-ss-newwrap"><button type="button" class="slm-ss-new" data-ss-latest>\u2191 New activity \xB7 Show latest</button></div>':"")+`<div class="slm-ss-list" role="region" aria-label="Seat history" tabindex="0">${o.map(u=>dl(u,a.booking,O,f)).join("")}</div>`+(l?`<div class="slm-ss-fail" role="alert"><span><b>Older history couldn't load.</b></span><button type="button" data-ss-retry>Try again</button></div>`:"")+(r!==null?'<button type="button" class="slm-btn ghost s slm-ss-older" data-ss-older>Load older</button>':"");let I=d.querySelector(".slm-ss-list");I&&(I.scrollTop=k)},p=async(f=!1,k=!1)=>{if(e||t||f&&r===null)return;t=!0;let A=s;try{let B=await(!f&&!k&&i.first&&!n?Promise.resolve(i.first).catch(()=>i.fetchPage()):i.fetchPage(f?r:void 0,n));if(i.first=null,e||A!==s)return;if(l=!1,k&&o.length&&B.entries[0]?.id!==o[0]?.id){let O=d.querySelector(".slm-ss-list");if(O&&O.scrollTop>24){a={...B,entries:a?.entries??[]},c=!0,m();return}}a=B,f?o=[...o,...B.entries.filter(O=>!o.some(I=>I.id===O.id))]:o=B.entries,r=B.nextBefore,m()}catch{if(e||A!==s)return;k||(l=!0,m())}finally{t=!1}};return d.addEventListener("click",f=>{let k=f.target,A=k.closest("[data-ss-kind]");if(A&&!t){n=A.dataset.ssKind||void 0,g=!0,s++,o=[],r=null,c=!1,a=a&&{...a},p();return}if(k.closest("[data-ss-back]")){d.hidden=!0,d.closest(".slm-watchcard")?.querySelector('[data-watch="history"]')?.setAttribute("aria-expanded","false");return}if(k.closest("[data-ss-older]")){p(!0);return}if(k.closest("[data-ss-retry]")){l=!1,m(),p(o.length>0&&r!==null);return}if(k.closest("[data-ss-latest]")){c=!1,g=!0,s++,p();return}k.closest("[data-ss-ref]")&&a?.booking?.order&&i.openOrder?.({id:a.booking.order.id,displayRef:a.booking.order.displayRef})}),m(),p(),{refresh(){!t&&!l&&p(!1,!0)},destroy(){e=!0,s++,d.innerHTML="",d.classList.remove("slm-ss")}}}var Ma,rl,Ta,hl,Ra,Gs=Y(()=>{"use strict";ge();me();Ma={hold:["In a cart","#d99a0b"],release:["Left the cart","#94a3b8"],expire:["Cart expired","#94a3b8"],book:["Booked","#22a06b"],unbook:["Booking cancelled","#d64545"],block:["Blocked","#d64545"],unblock:["Unblocked","#64748b"],reserve:["Reserved","#c026d3"],unreserve:["Reservation released","#64748b"],"reservation.end":["Reservation ended","#64748b"]},rl={control_room:"Control room",dashboard:"Dashboard",api:"Your server"},Ta={"public picker":"public sale","promoter link":"promoter link","partner link":"partner link","private access link":"private link"};hl=()=>'<div class="slm-ss-note" role="status">Loading history\u2026</div>'+[90,70,110,80].map(i=>`<div class="slm-ss-row slm-ss-skel"><i></i><span><em style="width:${i}px"></em><em style="width:${i+60}px"></em></span></div>`).join("");Ra=`
787
833
  .slm-ss{margin-top:14px}
834
+ .slm-railscroll:has(.slm-ss:not([hidden]))>:not(.slm-taskhead,.slm-taskhead+.slm-hint,[data-ref="watchseat"]),.slm-watchcard:has(>.slm-ss:not([hidden]))>:not(.slm-ss){display:none}
835
+ .slm .slm-watchcard:has(>.slm-ss:not([hidden])){padding:0;border:0;background:none;box-shadow:none}
836
+ .slm-watchcard>.slm-ss{margin-top:0}
837
+ .slm-ss-seat{display:flex;align-items:center;gap:10px;padding-bottom:14px;margin-bottom:14px;border-bottom:1px solid var(--slm-line)}
838
+ .slm-ss-seat>span:nth-child(2){flex:1;min-width:0}.slm-ss-seat b{display:block;font-size:14px;font-weight:700}.slm-ss-seat small{font-size:12px;color:var(--slm-muted)}
839
+ .slm .slm-ss-seat .slm-linkbtn{flex:none;font-size:12.5px;font-weight:700}
788
840
  .slm-ss-title{margin:0;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted)}
789
841
  .slm-ss-chips{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 6px}
790
842
  .slm .slm-ss-chips button{height:26px;padding:0 9px;border-radius:8px;border:1px solid var(--slm-line);background:var(--slm-surface);color:var(--slm-text);font-size:11.5px;font-weight:500}
@@ -812,7 +864,7 @@
812
864
  .slm-ss-newwrap{display:flex;justify-content:center;margin:2px 0 6px}
813
865
  .slm .slm-ss-new{height:26px;padding:0 10px;border-radius:999px;background:var(--slm-accent);color:var(--slm-accent-ink);font-size:11.5px;font-weight:700}
814
866
  .slm .slm-ss .slm-btn.s{flex:none;min-width:0;display:inline-flex;align-items:center;padding:6px 11px;font-size:12px;font-weight:600;border-radius:8px;margin-top:10px}
815
- `});function Vr(i){let e=ze(i.labels.length);switch(i.kind){case"block":return`Blocked ${e}${i.reason?` \xB7 ${i.reason}`:""}`;case"unblock":return`Put ${e} back on sale`;case"reserve":return`Reserved ${e} \xB7 ${i.name??"Reservation"}`;case"release":return`Released ${i.name??"a reservation"}`;case"section":return`${i.verb??"Changed"} ${i.sectionLabel??"a section"}`;case"channel":return`Moved ${e} to ${i.target??"a channel"}`;default:return i.title??`Changed ${e}`}}function xa(i,e){switch(i.kind){case"block":return[`Undone. ${ze(e)} ${e===1?"is":"are"} back on sale.`,"back on sale"];case"unblock":return[`Undone. ${ze(e)} ${e===1?"is":"are"} blocked again.`,"blocked again"];case"reserve":return[`Undone. ${i.name}'s ${ze(e)} ${e===1?"is":"are"} back on sale.`,"back on sale"];case"release":return[`Undone. ${ze(e)} reserved for ${i.name} again.`,"reserved again"];case"section":return[`Undone. ${i.sectionLabel} is ${i.again??"as it was"}.`,i.again??"as it was"];default:return[`Undone. ${ze(e)} ${e===1?"is":"are"} back where ${e===1?"it was":"they were"}.`,"back where they were"]}}function Ur(i,e){return i.find(t=>t.state==="open"&&(e.kind==="unblock"&&t.kind==="block"&&va(t.labels,e.labels)||e.kind==="block"&&t.kind==="unblock"&&va(t.labels,e.labels)||e.kind==="section"&&!!e.restores&&t.kind==="section"&&t.sectionId===e.sectionId||e.kind==="channel"&&!!e.restores&&t.kind==="channel"))}function ka(i){let e=`seatlayer.controlRoom.changes.${i.eventKey}`,t=[],s=null,n=!1,a=new Set,o=new Set,r=new Map,l=null,c=null;try{let h=JSON.parse(localStorage.getItem(e)??"null");h?.day===fa()&&Array.isArray(h.list)&&(t=h.list)}catch{}let d=()=>{try{localStorage.setItem(e,JSON.stringify({day:fa(),list:t.slice(0,ga)}))}catch{}},b=()=>i.startsAt!==null&&Date.now()>=i.startsAt,f=(h,p,g)=>{l?.remove(),c&&clearTimeout(c);let y=document.createElement("div");y.className=`slm-undomsg ${p}`,y.setAttribute("role",p==="err"?"alert":"status"),y.innerHTML=`<i></i><span>${w(h)}</span>${g?`<button type="button">${w(g.label)}</button>`:""}`,y.querySelector("button")?.addEventListener("click",()=>{y.remove(),g.run()}),i.mapLayer.append(y),l=y,c=setTimeout(()=>{y.remove(),l===y&&(l=null)},6e3)},u=()=>{d(),s?.isConnected&&B(),i.changed?.()},m=(h,p,g=[],y=!1)=>{let[L,C]=xa(h,p);if(h.state="undone",h.undoneAt=Date.now(),h.note=C,g.length){let x=h.kind==="release"?"Reserved":"Blocked";f(`${x} ${p.toLocaleString()} of ${h.labels.length.toLocaleString()} again. ${ya(g)} ${g.length===1?"was":"were"} ${y?"sold":"taken"}.`,"warn",{label:"Show",run:()=>i.show(h.labels)})}else f(L,"ok",{label:"Show",run:()=>i.show(h.labels)})},v=(h,p)=>{h.state="cant",h.note=p},$=async(h,p)=>{let g=await i.seats(),y=h.labels.filter(H=>g.get(H)==="free"),L=h.labels.filter(H=>g.get(H)!=="free"),C=L.length>0&&L.every(H=>g.get(H)==="booked");if(!y.length){v(h,C?`can't undo: ${L.length===1?"it was":`all ${L.length.toLocaleString()} were`} sold since`:"can't undo: these seats changed since");return}if(L.length&&!p){r.set(h.id,{free:y,lost:L,sold:C});return}let x=h.releaseAt&&h.releaseAt>Date.now()?h.releaseAt:null;if(!(h.kind==="release"?await i.reserve(y,h.name??"Reservation",x):await i.block(y,h.reason??null,x)))throw new Error("undo failed");m(h,y.length,L,C)},A=async(h,p=!1)=>{if(!a.has(h.id)){a.add(h.id),o.delete(h.id),r.delete(h.id),B(),n=!0;try{if(h.kind==="block"){let[g,y]=await Promise.all([i.seats(),i.reservations()]),L=new Set(y.flatMap(x=>x.labels)),C=h.labels.filter(x=>g.get(x)==="blocked"&&!L.has(x));if(!C.length)v(h,"can't undo: already back on sale");else if(await i.unblock(C))m(h,C.length);else throw new Error("undo failed")}else if(h.kind==="unblock"||h.kind==="release")await $(h,p);else if(h.kind==="reserve"){let g=(await i.reservations()).find(y=>y.id===h.reservationId);if(!g?.labels.length)v(h,"can't undo: released since");else if(await i.release(g.id))m(h,g.labels.length);else throw new Error("undo failed")}else if(h.kind==="section"){let g=await i.rules();if(JSON.stringify(g[h.sectionId]??null)!==JSON.stringify(h.after??null))v(h,"can't undo: changed again since");else if(await i.restoreRules(h.before??{}))m(h,h.labels.length);else throw new Error("undo failed")}else if(h.kind==="channel"){let g=await i.channelBack(h.back??[]);if(g.failed&&!g.moved)throw new Error("undo failed");g.moved?m(h,g.moved):v(h,"can't undo: these seats changed since")}}catch{o.add(h.id),f("Couldn't undo. Nothing changed.","err",{label:"Try again",run:()=>{A(h,p)}})}finally{n=!1,a.delete(h.id),u()}}},O=h=>{let[p,g]=qr[h.kind],y=h.state==="open"&&h.kind!=="types"&&h.kind!=="tables"&&b()?"can't undo: the event has started":null,L=a.has(h.id)?"busy":y?"cant":h.state,C=h.kind==="types"||h.kind==="tables",x=L==="busy"?'<span class="slm-yc-busy" role="status">Undoing\u2026</span>':L==="undone"?'<span class="slm-yc-pill">Undone</span>':L==="open"&&!C&&!r.has(h.id)?`<button type="button" class="slm-btn ghost s" data-yc-undo="${w(h.id)}">${_r}Undo</button>`:"",M=C?`${w(h.where)} \xB7 <button type="button" class="slm-yc-link" data-yc-task="${h.kind}">Change back in ${h.kind==="types"?"Ticket types":"Tables"}</button>`:L==="undone"?`${w(h.where)} \xB7 undone ${ts(h.undoneAt??h.at)}, ${w(h.note??"")}`:L==="cant"?`${w(h.where)} \xB7 ${w(y??h.note??"can't undo")}`:w(h.where),H=r.get(h.id),F=H?(()=>{let K=h.kind==="release"?"Reserve":"Block",se=h.kind==="release"?` for ${h.name}`:"";return`<div class="slm-yc-ask" role="alertdialog" aria-label="Some seats changed since"><b>${H.lost.length.toLocaleString()} of the ${h.labels.length.toLocaleString()} seats ${H.lost.length===1?"was":"were"} ${H.sold?"sold":"taken"} since</b>${w(ya(H.lost))} ${H.sold?H.lost.length===1?"belongs to a booking now":"belong to a booking now":H.lost.length===1?"is not free now":"are not free now"}. ${K} the other ${H.free.length.toLocaleString()}${w(se)} again?<span><button type="button" class="slm-btn s" data-yc-rest="${w(h.id)}">${K} ${H.free.length.toLocaleString()} again</button><button type="button" class="slm-btn ghost s" data-yc-keep="${w(h.id)}">Keep as is</button></span></div>`})():"",N=o.has(h.id)?`<div class="slm-yc-fail" role="alert"><span><b>Couldn't undo.</b> Nothing changed; the connection dropped.</span><button type="button" data-yc-undo="${w(h.id)}">Try again</button></div>`:"";return`<div class="slm-yc-row${L==="undone"||L==="cant"?" faded":""}" data-yc="${w(h.id)}"><div class="slm-yc-main">${i.plate(p,g,26)}<span><b>${w(h.title)}</b><small>${M} \xB7 <time>${ts(h.at)}</time></small></span>${x}</div>${F}${N}</div>`},B=()=>{if(!s)return;let h='<p class="slm-yc-foot">Listed on this device only, for today.</p>';s.innerHTML=t.length?`<p class="slm-yc-day">Today</p>${t.map(O).join("")}${h}`:`<div class="slm-yc-empty">${i.plate("undo","#64748b",38)}<b>No changes from you today</b><p>Blocks, reservations and section changes you make show here, each with Undo.</p></div>${h}`},k=h=>{let p=h.target,g=M=>{let H=p.closest(`[${M}]`)?.getAttribute(M);return H?t.find(F=>F.id===H):void 0},y=g("data-yc-undo");if(y){A(y);return}let L=g("data-yc-rest");if(L){A(L,!0);return}let C=g("data-yc-keep");if(C){r.delete(C.id),B();return}let x=p.closest("[data-yc-task]")?.dataset.ycTask;(x==="types"||x==="tables")&&i.openTask(x)};return{record(h){if(n||!h.labels.length&&h.kind!=="section")return;let p=Ur(t,h);if(p){p.state="undone",p.undoneAt=Date.now(),p.note=xa(p,h.labels.length)[1],u();return}if(h.restores)return;for(let y of t)y.state!=="open"||y.kind==="types"||y.kind==="tables"||(h.kind==="section"&&y.kind==="section"&&y.sectionId===h.sectionId||h.kind!=="section"&&y.kind!=="section"&&jr(y.labels,h.labels))&&v(y,h.kind==="release"&&y.kind==="reserve"?`can't undo: released at ${ts(Date.now())}`:`can't undo: changed again at ${ts(Date.now())}`);let g=h.kind==="section"?`${ze(h.labels.length)}${h.verb==="Closed"?" \xB7 off sale until you open it":""}`:h.kind==="release"?`${ze(h.labels.length)} \xB7 ${i.whereOf(h.labels)}`:i.whereOf(h.labels);t.unshift({...h,id:`c${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:Date.now(),title:Vr(h),where:g,state:"open"}),t=t.slice(0,ga),u()},paintList(h){s&&s!==h&&s.removeEventListener("click",k),s!==h&&h.addEventListener("click",k),s=h,B()},count:()=>t.length,destroy(){s?.removeEventListener("click",k),s=null,l?.remove(),c&&clearTimeout(c)}}}var qr,_r,ga,ze,ts,fa,va,jr,ya,wa,zs=Y(()=>{"use strict";pe();me();qr={block:["ban","#d64545"],unblock:["ban","#d64545"],reserve:["bookmark","#c026d3"],release:["bookmark","#c026d3"],section:["layers","#0ea5a5"],channel:["route","#ea7a1e"],types:["tag","#8b5cf6"],tables:["table","#65a30d"]},_r='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/></svg>',ga=60,ze=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,ts=i=>W(i,{hour:"2-digit",minute:"2-digit"},[]),fa=(i=Date.now())=>{let e=ye(i);return`${e.year}-${e.month}-${e.date}`},va=(i,e)=>i.length===e.length&&new Set([...i,...e]).size===i.length,jr=(i,e)=>{let t=new Set(i);return e.some(s=>t.has(s))},ya=i=>i.length<=3?i.join(", ").replace(/, ([^,]*)$/," and $1"):`${i.slice(0,2).join(", ")} and ${i.length-2} more`;wa=`
867
+ `});function gl(i){let e=_e(i.labels.length);switch(i.kind){case"block":return`Blocked ${e}${i.reason?` \xB7 ${i.reason}`:""}`;case"unblock":return`Put ${e} back on sale`;case"reserve":return`Reserved ${e} \xB7 ${i.name??"Reservation"}`;case"release":return`Released ${i.name??"a reservation"}`;case"section":return`${i.verb??"Changed"} ${i.sectionLabel??"a section"}`;case"channel":return`Moved ${e} to ${i.target??"a channel"}`;default:return i.title??`Changed ${e}`}}function Ba(i,e){switch(i.kind){case"block":return[`Undone. ${_e(e)} ${e===1?"is":"are"} back on sale.`,"back on sale"];case"unblock":return[`Undone. ${_e(e)} ${e===1?"is":"are"} blocked again.`,"blocked again"];case"reserve":return[`Undone. ${i.name}'s ${_e(e)} ${e===1?"is":"are"} back on sale.`,"back on sale"];case"release":return[`Undone. ${_e(e)} reserved for ${i.name} again.`,"reserved again"];case"section":return[`Undone. ${i.sectionLabel} is ${i.again??"as it was"}.`,i.again??"as it was"];default:return[`Undone. ${_e(e)} ${e===1?"is":"are"} back where ${e===1?"it was":"they were"}.`,"back where they were"]}}function bl(i,e){return i.find(t=>t.state==="open"&&(e.kind==="unblock"&&t.kind==="block"&&Ia(t.labels,e.labels)||e.kind==="block"&&t.kind==="unblock"&&Ia(t.labels,e.labels)||e.kind==="section"&&!!e.restores&&t.kind==="section"&&t.sectionId===e.sectionId||e.kind==="channel"&&!!e.restores&&t.kind==="channel"))}function Oa(i){let e=`seatlayer.controlRoom.changes.${i.eventKey}`,t=[],s=null,n=!1,a=new Set,o=new Set,r=new Map,l=null,c=null;try{let u=JSON.parse(localStorage.getItem(e)??"null");u?.day===Ha()&&Array.isArray(u.list)&&(t=u.list)}catch{}let d=()=>{try{localStorage.setItem(e,JSON.stringify({day:Ha(),list:t.slice(0,Aa)}))}catch{}},g=()=>i.startsAt!==null&&Date.now()>=i.startsAt,b=(u,x,y)=>{l?.remove(),c&&clearTimeout(c);let h=document.createElement("div");h.className=`slm-undomsg ${x}`,h.setAttribute("role",x==="err"?"alert":"status"),h.innerHTML=`<i></i><span>${S(u)}</span>${y?`<button type="button">${S(y.label)}</button>`:""}`,h.querySelector("button")?.addEventListener("click",()=>{h.remove(),y.run()}),i.mapLayer.append(h),l=h,c=setTimeout(()=>{h.remove(),l===h&&(l=null)},6e3)},m=()=>{d(),s?.isConnected&&O(),i.changed?.()},p=(u,x,y=[],h=!1)=>{let[v,C]=Ba(u,x);if(u.state="undone",u.undoneAt=Date.now(),u.note=C,y.length){let E=u.kind==="release"?"Reserved":"Blocked";b(`${E} ${x.toLocaleString()} of ${u.labels.length.toLocaleString()} again. ${Pa(y)} ${y.length===1?"was":"were"} ${h?"sold":"taken"}.`,"warn",{label:"Show",run:()=>i.show(u.labels)})}else b(v,"ok",{label:"Show",run:()=>i.show(u.labels)})},f=(u,x)=>{u.state="cant",u.note=x},k=async(u,x)=>{let y=await i.seats(),h=u.labels.filter(M=>y.get(M)==="free"),v=u.labels.filter(M=>y.get(M)!=="free"),C=v.length>0&&v.every(M=>y.get(M)==="booked");if(!h.length){f(u,C?`can't undo: ${v.length===1?"it was":`all ${v.length.toLocaleString()} were`} sold since`:"can't undo: these seats changed since");return}if(v.length&&!x){r.set(u.id,{free:h,lost:v,sold:C});return}let E=u.releaseAt&&u.releaseAt>Date.now()?u.releaseAt:null;if(!(u.kind==="release"?await i.reserve(h,u.name??"Reservation",E):await i.block(h,u.reason??null,E)))throw new Error("undo failed");p(u,h.length,v,C)},A=async(u,x=!1)=>{if(!a.has(u.id)){a.add(u.id),o.delete(u.id),r.delete(u.id),O(),n=!0;try{if(u.kind==="block"){let[y,h]=await Promise.all([i.seats(),i.reservations()]),v=new Set(h.flatMap(E=>E.labels)),C=u.labels.filter(E=>y.get(E)==="blocked"&&!v.has(E));if(!C.length)f(u,"can't undo: already back on sale");else if(await i.unblock(C))p(u,C.length);else throw new Error("undo failed")}else if(u.kind==="unblock"||u.kind==="release")await k(u,x);else if(u.kind==="reserve"){let y=(await i.reservations()).find(h=>h.id===u.reservationId);if(!y?.labels.length)f(u,"can't undo: released since");else if(await i.release(y.id))p(u,y.labels.length);else throw new Error("undo failed")}else if(u.kind==="section"){let y=await i.rules();if(JSON.stringify(y[u.sectionId]??null)!==JSON.stringify(u.after??null))f(u,"can't undo: changed again since");else if(await i.restoreRules(u.before??{}))p(u,u.labels.length);else throw new Error("undo failed")}else if(u.kind==="channel"){let y=await i.channelBack(u.back??[]);if(y.failed&&!y.moved)throw new Error("undo failed");y.moved?p(u,y.moved):f(u,"can't undo: these seats changed since")}}catch{o.add(u.id),b("Couldn't undo. Nothing changed.","err",{label:"Try again",run:()=>{A(u,x)}})}finally{n=!1,a.delete(u.id),m()}}},B=u=>{let[x,y]=ul[u.kind],h=u.state==="open"&&u.kind!=="types"&&u.kind!=="tables"&&g()?"can't undo: the event has started":null,v=a.has(u.id)?"busy":h?"cant":u.state,C=u.kind==="types"||u.kind==="tables",E=v==="busy"?'<span class="slm-yc-busy" role="status">Undoing\u2026</span>':v==="undone"?'<span class="slm-yc-pill">Undone</span>':v==="open"&&!C&&!r.has(u.id)?`<button type="button" class="slm-btn ghost s" data-yc-undo="${S(u.id)}">${pl}Undo</button>`:"",L=C?`${S(u.where)} \xB7 <button type="button" class="slm-yc-link" data-yc-task="${u.kind}">Change back in ${u.kind==="types"?"Ticket types":"Tables"}</button>`:v==="undone"?`${S(u.where)} \xB7 undone ${rs(u.undoneAt??u.at)}, ${S(u.note??"")}`:v==="cant"?`${S(u.where)} \xB7 ${S(h??u.note??"can't undo")}`:S(u.where),M=r.get(u.id),R=M?(()=>{let j=u.kind==="release"?"Reserve":"Block",ee=u.kind==="release"?` for ${u.name}`:"";return`<div class="slm-yc-ask" role="alertdialog" aria-label="Some seats changed since"><b>${M.lost.length.toLocaleString()} of the ${u.labels.length.toLocaleString()} seats ${M.lost.length===1?"was":"were"} ${M.sold?"sold":"taken"} since</b>${S(Pa(M.lost))} ${M.sold?M.lost.length===1?"belongs to a booking now":"belong to a booking now":M.lost.length===1?"is not free now":"are not free now"}. ${j} the other ${M.free.length.toLocaleString()}${S(ee)} again?<span><button type="button" class="slm-btn s" data-yc-rest="${S(u.id)}">${j} ${M.free.length.toLocaleString()} again</button><button type="button" class="slm-btn ghost s" data-yc-keep="${S(u.id)}">Keep as is</button></span></div>`})():"",N=o.has(u.id)?`<div class="slm-yc-fail" role="alert"><span><b>Couldn't undo.</b> Nothing changed; the connection dropped.</span><button type="button" data-yc-undo="${S(u.id)}">Try again</button></div>`:"";return`<div class="slm-yc-row${v==="undone"||v==="cant"?" faded":""}" data-yc="${S(u.id)}"><div class="slm-yc-main">${i.plate(x,y,26)}<span><b>${S(u.title)}</b><small>${L} \xB7 <time>${rs(u.at)}</time></small></span>${E}</div>${R}${N}</div>`},O=()=>{if(!s)return;let u='<p class="slm-yc-foot">Listed on this device only, for today.</p>';s.innerHTML=t.length?`<p class="slm-yc-day">Today</p>${t.map(B).join("")}${u}`:`<div class="slm-yc-empty">${i.plate("undo","#64748b",38)}<b>No changes from you today</b><p>Blocks, reservations and section changes you make show here, each with Undo.</p></div>${u}`},I=u=>{let x=u.target,y=L=>{let M=x.closest(`[${L}]`)?.getAttribute(L);return M?t.find(R=>R.id===M):void 0},h=y("data-yc-undo");if(h){A(h);return}let v=y("data-yc-rest");if(v){A(v,!0);return}let C=y("data-yc-keep");if(C){r.delete(C.id),O();return}let E=x.closest("[data-yc-task]")?.dataset.ycTask;(E==="types"||E==="tables")&&i.openTask(E)};return{record(u){if(n||!u.labels.length&&u.kind!=="section")return;let x=bl(t,u);if(x){x.state="undone",x.undoneAt=Date.now(),x.note=Ba(x,u.labels.length)[1],m();return}if(u.restores)return;for(let h of t)h.state!=="open"||h.kind==="types"||h.kind==="tables"||(u.kind==="section"&&h.kind==="section"&&h.sectionId===u.sectionId||u.kind!=="section"&&h.kind!=="section"&&ml(h.labels,u.labels))&&f(h,u.kind==="release"&&h.kind==="reserve"?`can't undo: released at ${rs(Date.now())}`:`can't undo: changed again at ${rs(Date.now())}`);let y=u.kind==="section"?`${_e(u.labels.length)}${u.verb==="Closed"?" \xB7 off sale until you open it":""}`:u.kind==="release"?`${_e(u.labels.length)} \xB7 ${i.whereOf(u.labels)}`:i.whereOf(u.labels);t.unshift({...u,id:`c${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:Date.now(),title:gl(u),where:y,state:"open"}),t=t.slice(0,Aa),m()},paintList(u){s&&s!==u&&s.removeEventListener("click",I),s!==u&&u.addEventListener("click",I),s=u,O()},count:()=>t.length,destroy(){s?.removeEventListener("click",I),s=null,l?.remove(),c&&clearTimeout(c)}}}var ul,pl,Aa,_e,rs,Ha,Ia,ml,Pa,Da,Ys=Y(()=>{"use strict";ge();me();ul={block:["ban","#d64545"],unblock:["ban","#d64545"],reserve:["bookmark","#c026d3"],release:["bookmark","#c026d3"],section:["layers","#0ea5a5"],channel:["route","#ea7a1e"],types:["tag","#8b5cf6"],tables:["table","#65a30d"]},pl='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8.5 5L4 9.5 8.5 14"/><path d="M4 9.5h10a6 6 0 0 1 0 12h-3"/></svg>',Aa=60,_e=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,rs=i=>K(i,{hour:"2-digit",minute:"2-digit"},[]),Ha=(i=Date.now())=>{let e=ke(i);return`${e.year}-${e.month}-${e.date}`},Ia=(i,e)=>i.length===e.length&&new Set([...i,...e]).size===i.length,ml=(i,e)=>{let t=new Set(i);return e.some(s=>t.has(s))},Pa=i=>i.length<=3?i.join(", ").replace(/, ([^,]*)$/," and $1"):`${i.slice(0,2).join(", ")} and ${i.length-2} more`;Da=`
816
868
  .slm-yc-day{margin:4px 0 0;padding:6px 0;font-size:11.5px;font-weight:600;color:var(--slm-muted);opacity:.8}
817
869
  .slm-yc-row{padding:9px 0;border-top:1px solid var(--slm-line)}
818
870
  .slm-yc-main{display:flex;align-items:center;gap:10px}
@@ -847,7 +899,7 @@
847
899
  .slm .slm-undomsg button{flex:none;font-size:13px;font-weight:700;color:var(--slm-accent)}
848
900
  .slm.compact .slm-undomsg{bottom:auto;top:8px}
849
901
  .slm-map:has(.slm-undomsg) .slm-zoomhint{visibility:hidden}
850
- `});function Sa(i){let e=null,t=null,s=null,n=null,a=null,o=null,r=null,l=null,c={kind:"loading"},d=()=>t??=i.request("saved-selections").then(g=>{e=g.selections??[],i.changed(e.length)}).finally(()=>{t=null}),b=()=>{s?.remove(),s=null,n=a=o=null,l=null,document.removeEventListener("keydown",f,!0)},f=g=>{g.key==="Escape"&&s&&(g.stopPropagation(),b())},u=(g,y)=>(b(),s=document.createElement("div"),s.className="slm-saved",s.setAttribute("role","dialog"),s.setAttribute("aria-label",g),s.innerHTML=y,i.mapLayer.append(s),document.addEventListener("keydown",f,!0),s),m=g=>`<div class="slm-saved-head">${i.plate("star",Ns,26)}<b>${w(g)}</b><button type="button" class="slm-saved-x" data-sv-close aria-label="Close">${Kr}</button></div>`,v=(g,y,L)=>`<div class="slm-saved-note ${g}" role="${g==="err"?"alert":"status"}"><b>${w(y)}</b>${w(L)}</div>`,$=()=>{let g=i.selection();if(!g.length||!i.canSave)return;let y=i.describe(g),L="",C={kind:"name"},x=u("Save this selection",""),M=()=>{let F=g.length,N=F>ss,K=`<input class="slm-saved-input" data-sv-name maxlength="60" placeholder="Name" value="${w(L)}" ${C.kind==="saving"?"disabled":""} aria-label="Name">`,se=C.kind==="name"&&!N&&y.suggestions.length?`<div class="slm-saved-chips">${y.suggestions.slice(0,3).map(_=>`<button type="button" data-sv-suggest="${w(_)}">${w(_)}</button>`).join("")}</div>`:"",ae="",xe=`<button type="button" class="slm-btn s" data-sv-save ${N||C.kind==="saving"?"disabled":""}>${C.kind==="saving"?"Saving\u2026":`Save ${vt(F)}`}</button><span>Everyone on this event can use it.</span>`;if(N)ae=v("warn",`That is more than ${ss.toLocaleString()} seats`,`A saved selection holds up to ${ss.toLocaleString()}. Save it as two, for example by level.`);else if(C.kind==="failed")ae=v("err","Couldn't save","The connection dropped. Your selection and the name are kept."),xe='<button type="button" class="slm-btn s" data-sv-save>Try again</button>';else if(C.kind==="refused")ae=v("warn","Couldn't save",C.message);else if(C.kind==="taken"){let _=C.byYou?"by you":C.byName?`by ${C.byName}`:"";ae=v("warn",`\u201C${L}\u201D is already saved`,C.canReplace?`${vt(C.count)}${_?`, ${_}`:""}. Replace it with these ${F.toLocaleString()}, or pick another name.`:`${vt(C.count)}${_?`, ${_}`:""}. Only ${C.byName??"who saved it"} or an admin can replace it; pick another name.`),xe=(C.canReplace?`<button type="button" class="slm-btn s" data-sv-replace>Replace with these ${F.toLocaleString()}</button>`:"")+'<button type="button" class="slm-btn ghost s" data-sv-another>Another name</button>'}x.innerHTML=m("Save this selection")+`<div class="slm-saved-body"><p class="slm-saved-what">${w(y.line)}</p>${K}${se}${ae}</div><div class="slm-saved-foot">${xe}</div>`;let R=x.querySelector("[data-sv-name]");R.addEventListener("input",()=>{L=R.value,C.kind!=="name"&&(C={kind:"name"},M())}),R.addEventListener("keydown",_=>{_.key==="Enter"&&(_.preventDefault(),H(!1))}),(C.kind==="name"||C.kind==="taken")&&(R.focus(),R.setSelectionRange(L.length,L.length))},H=async F=>{if(L=L.trim().replace(/\s+/g," "),!L||g.length>ss||C.kind==="saving"){x.querySelector("[data-sv-name]")?.focus();return}C={kind:"saving"},M();try{let N=await i.request("saved-selections",{method:"POST",body:{name:L,labels:g,where:y.where,...F?{replace:!0}:{}}});e=[N.selection,...(e??[]).filter(K=>K.id!==N.selection.id)],i.changed(e.length),b(),i.toast(`Saved \u201C${N.selection.name}\u201D \xB7 ${vt(N.selection.count)}. Everyone on this event can use it.`,"ok")}catch(N){let K=Gr(N)?.existing;Ue(N)===409&&K?C={kind:"taken",...K}:Ue(N)===403?C={kind:"refused",message:"Only who saved it, or an admin, can replace it. Pick another name."}:Ue(N)===422||Ue(N)===413?C={kind:"refused",message:Yr(N)??"That is more than this event can hold."}:C={kind:"failed"},s===x&&M()}};x.addEventListener("click",F=>{let N=F.target;if(N.closest("[data-sv-close]")){b();return}let K=N.closest("[data-sv-suggest]");if(K){L=K.dataset.svSuggest,M();return}if(N.closest("[data-sv-save]")){H(!1);return}if(N.closest("[data-sv-replace]")){H(!0);return}N.closest("[data-sv-another]")&&(L="",C={kind:"name"},M())}),M()},A=async(g,y)=>{let L=e?.find(C=>C.id===g);r=g,k();try{let C=await i.request(`saved-selections/${encodeURIComponent(g)}`);r=null,b(),i.apply(C.labels,{add:y,name:C.selection?.name??L?.name??"",saved:C.labels.length})}catch(C){r=null,Ue(C)===404?(e=(e??[]).filter(x=>x.id!==g),i.changed(e.length),l=null,i.toast("That saved selection was deleted meanwhile.","err")):l={id:g,text:"Couldn't pick these seats. Try again."},k()}},O=async(g,y)=>{r=g.id,l=null,k();try{if(y==="delete")await i.request(`saved-selections/${encodeURIComponent(g.id)}`,{method:"DELETE"}),e=(e??[]).filter(L=>L.id!==g.id);else{let L=await i.request(`saved-selections/${encodeURIComponent(g.id)}`,{method:"PATCH",body:{...y,...y.labels?{where:i.describe(y.labels).where}:{}}});e=(e??[]).map(C=>C.id===g.id?L.selection:C)}i.changed(e.length),a=o=null}catch(L){let C=g.byName??"who saved it";l={id:g.id,text:Ue(L)===403?`Only ${C} or an admin can change it.`:Ue(L)===409?"That name is already saved on this event.":"Couldn't save the change. Try again."}}finally{r=null,k()}},B=g=>{let y=i.selection().length,L=g.byYou?"by you":g.byName?`by ${g.byName}`:"",C=[vt(g.count),g.where,L].filter(Boolean).join(" \xB7 "),x=r===g.id?`<span class="slm-saved-busy" role="status">${i.picks()?"Selecting\u2026":"Working\u2026"}</span>`:`<button type="button" class="slm-btn ghost s" data-sv-use="${w(g.id)}">${i.picks()?"Select":"Show"}</button>`+(i.canSave?`<button type="button" class="slm-saved-dots" data-sv-menu="${w(g.id)}" aria-haspopup="menu" aria-expanded="${n===g.id}" aria-label="More for ${w(g.name)}">${Wr}</button>`:""),M=[...y?[["add","plus","#22a06b","Add to what you picked"]]:[],...y?[["update","undo","#3b82f6",`Update to the ${y.toLocaleString()} selected`]]:[],["rename","tag","#8b5cf6","Rename"],["delete","x","#d64545","Delete"]],H=n===g.id?`<div class="slm-saved-menu" role="menu">${M.map(([se,ae,xe,R])=>`<button type="button" role="menuitem" data-sv-act="${se}" data-id="${w(g.id)}" class="${se==="delete"?"danger":""}">${i.plate(ae,xe,22)}${w(R)}</button>`).join("")}</div>`:"",F=o===g.id?`<input class="slm-saved-input s" data-sv-rename="${w(g.id)}" maxlength="60" value="${w(g.name)}" aria-label="New name">`:`<b>${w(g.name)}</b>`,N=a===g.id?`<div class="slm-saved-confirm" role="alertdialog"><b>Delete \u201C${w(g.name)}\u201D?</b>Only the saved name goes; the seats and anything done to them stay as they are.<span><button type="button" class="slm-btn danger s" data-sv-delete="${w(g.id)}">Delete</button><button type="button" class="slm-btn ghost s" data-sv-keep>Keep it</button></span></div>`:"",K=l?.id===g.id?`<p class="slm-saved-rowerr" role="alert">${w(l.text)}</p>`:"";return`<div class="slm-saved-row" data-sv-row="${w(g.id)}"><div class="slm-saved-main">${i.plate("star",Ns,28)}<span>${F}<small>${w(C)}</small></span>${x}</div>${H}${N}${K}</div>`},k=()=>{if(!s||s.getAttribute("aria-label")!=="Saved selections")return;let g=s.querySelector(".slm-saved-body")?.scrollTop??0,y="",L=`<span>${i.picks()?Xr()?"Select replaces what you picked.":"Select replaces what you picked. \u21E7 Select adds to it.":"Show frames the seats on the map."}</span>`;c.kind==="loading"&&!e?(y=[110,90,130].map(M=>`<div class="slm-saved-row slm-saved-skel"><i></i><span><em style="width:${M}px"></em><em style="width:${M+70}px"></em></span></div>`).join(""),L=""):c.kind==="failed"&&!e?(y=v("err","Saved selections couldn't load","The map and your selection are fine.")+'<button type="button" class="slm-btn ghost s" data-sv-retry>Try again</button>',L=""):e?.length?y=e.map(B).join(""):(y=`<div class="slm-saved-empty">${i.plate("star",Ns,38)}<b>Nothing saved on this event</b><p>Pick seats you come back to, like a camera platform or the press rows, then press Save on the selection card.</p></div>`,L=""),s.innerHTML=m("Saved selections")+`<div class="slm-saved-body">${y}</div>`+(L?`<div class="slm-saved-foot">${L}</div>`:"");let C=s.querySelector(".slm-saved-body");C&&(C.scrollTop=g);let x=s.querySelector("[data-sv-rename]");x&&(x.focus(),x.select(),x.addEventListener("keydown",M=>{if(M.key==="Enter"){M.preventDefault();let H=e?.find(N=>N.id===o),F=x.value.trim().replace(/\s+/g," ");H&&F&&F!==H.name?O(H,{name:F}):(o=null,k())}M.key==="Escape"&&(M.stopPropagation(),o=null,k())}))},h=()=>{let g=u("Saved selections","");c=e?{kind:"list"}:{kind:"loading"},k(),g.addEventListener("click",y=>{let L=y.target,C=N=>{let K=L.closest(`[${N}]`)?.getAttribute(N);return K?e?.find(se=>se.id===K):void 0};if(L.closest("[data-sv-close]")){b();return}if(L.closest("[data-sv-retry]")){c={kind:"loading"},k(),p();return}let x=C("data-sv-use");if(x){A(x.id,y.shiftKey);return}let M=C("data-sv-menu");if(M){n=n===M.id?null:M.id,a=null,k();return}let H=L.closest("[data-sv-act]");if(H){let N=e?.find(K=>K.id===H.dataset.id);if(n=null,!N)return;if(H.dataset.svAct==="add"){A(N.id,!0);return}if(H.dataset.svAct==="update"){O(N,{labels:i.selection()});return}if(H.dataset.svAct==="rename"){o=N.id,k();return}a=N.id,k();return}let F=C("data-sv-delete");if(F){O(F,"delete");return}if(L.closest("[data-sv-keep]")){a=null,k();return}n&&!L.closest(".slm-saved-menu")&&(n=null,k())}),p()},p=async()=>{try{await d(),c={kind:"list"}}catch{c={kind:"failed"}}k()};return{openSave:$,openList:h,rows:()=>e,use:A,refresh:async()=>{try{await d()}catch{}},close:b,destroy:b}}var ss,Ns,Kr,Wr,vt,Ue,Gr,Yr,Xr,La,Fs=Y(()=>{"use strict";pe();ss=5e3,Ns="#d99a0b",Kr='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',Wr='<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="5" cy="12" r="1.8"/><circle cx="12" cy="12" r="1.8"/><circle cx="19" cy="12" r="1.8"/></svg>',vt=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,Ue=i=>i.status??0,Gr=i=>i.details??null,Yr=i=>i.serverMessage,Xr=()=>typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches;La=`
902
+ `});function fl(i,e){let t=e?.doc;if(!t||!i.length)return null;let s=new Set(i.map(f=>e.rowOf(f)).filter(f=>!!f)),n=new Set([...s].map(f=>e.sectionOfRow(f)));if(!s.size||n.has(void 0))return null;let a=t.objects.filter(f=>f.type==="section"),o=new Set([...n].map(f=>a.find(k=>k.id===f)?.zone)),l=(o.size===1?t.zones?.find(f=>f.id===[...o][0])?.label:null)??(n.size===1?a.find(f=>f.id===[...n][0])?.label:null);if(!l)return null;let c=t.focalPoint??{x:0,y:0},d=f=>Math.hypot(f.origin.x-c.x,f.origin.y-c.y),g=t.objects.filter(f=>f.type==="row"&&f.origin),b=0,m=0;for(let f of n){let k=g.filter(A=>e.sectionOfRow(A.id)===f).sort((A,B)=>d(A)-d(B));k.length<3||k.forEach((A,B)=>{s.has(A.id)&&(b+=B/(k.length-1),m++)})}if(!m)return null;let p=b/m;return`${p<1/3?"Front":p<2/3?"Middle":"Back"} of ${l}`}function za(i){let e=null,t=null,s=null,n=null,a=null,o=null,r=null,l=null,c={kind:"loading"},d=()=>t??=i.request("saved-selections").then(h=>{e=h.selections??[],i.changed(e.length)}).finally(()=>{t=null}),g=()=>{s?.remove(),s=null,n=a=o=null,l=null,document.removeEventListener("keydown",b,!0)},b=h=>{h.key==="Escape"&&s&&(h.stopPropagation(),g())},m=(h,v)=>(g(),s=document.createElement("div"),s.className="slm-saved",s.setAttribute("role","dialog"),s.setAttribute("aria-label",h),s.innerHTML=v,i.mapLayer.append(s),document.addEventListener("keydown",b,!0),p(),s),p=()=>{if(!s)return;let h=i.mapLayer.closest(".slm"),v=h?.querySelector('[data-ref="selcard"]'),C=i.mapLayer.getBoundingClientRect();if(!v?.offsetParent||h.classList.contains("compact")||!C.height){s.style.top=s.style.maxHeight="";return}let E=Math.round(Math.max(12,Math.min(v.getBoundingClientRect().top-C.top-10,C.height-s.offsetHeight-12)));s.style.top=`${E}px`,s.style.maxHeight=`${Math.round(C.height-E-12)}px`},f=h=>`<div class="slm-saved-head">${i.plate("star",Xs,26)}<b>${S(h)}</b><button type="button" class="slm-saved-x" data-sv-close aria-label="Close">${vl}</button></div>`,k=(h,v,C)=>`<div class="slm-saved-note ${h}" role="${h==="err"?"alert":"status"}"><b>${S(v)}</b>${S(C)}</div>`,A=()=>{let h=i.selection();if(!h.length||!i.canSave)return;let v=i.describe(h),E=[i.mapLayer.closest(".slm")?.querySelector('[data-ref="blockreason"]')?.value.trim(),...v.suggestions.filter(J=>J!==v.where)],L=[...new Set([v.where,E.find(Boolean),fl(h,i.chart?.()),...E])].filter(J=>!!J).slice(0,3),M="",R={kind:"name"},N=m("Save this selection",""),j=()=>{let J=h.length,X=J>ls,ne=`<input class="slm-saved-input" data-sv-name maxlength="60" placeholder="Name" value="${S(M)}" ${R.kind==="saving"?"disabled":""} aria-label="Name">`,ye=R.kind==="name"&&!X&&L.length?`<div class="slm-saved-chips">${L.map(D=>`<button type="button" data-sv-suggest="${S(D)}">${S(D)}</button>`).join("")}</div>`:"",he="",w=`<button type="button" class="slm-btn s" data-sv-save ${X||R.kind==="saving"?"disabled":""}>${R.kind==="saving"?"Saving\u2026":`Save ${Ct(J)}`}</button><span>Everyone on this event can use it.</span>`;if(X)he=k("warn",`That is more than ${ls.toLocaleString()} seats`,`A saved selection holds up to ${ls.toLocaleString()}. Save it as two, for example by level.`);else if(R.kind==="failed")he=k("err","Couldn't save","The connection dropped. Your selection and the name are kept."),w='<button type="button" class="slm-btn s" data-sv-save>Try again</button>';else if(R.kind==="refused")he=k("warn","Couldn't save",R.message);else if(R.kind==="taken"){let D=R.byYou?"by you":R.byName?`by ${R.byName}`:"";he=k("warn",`\u201C${M}\u201D is already saved`,R.canReplace?`${Ct(R.count)}${D?`, ${D}`:""}. Replace it with these ${J.toLocaleString()}, or pick another name.`:`${Ct(R.count)}${D?`, ${D}`:""}. Only ${R.byName??"who saved it"} or an admin can replace it; pick another name.`),w=(R.canReplace?`<button type="button" class="slm-btn s" data-sv-replace>Replace with these ${J.toLocaleString()}</button>`:"")+'<button type="button" class="slm-btn ghost s" data-sv-another>Another name</button>'}N.innerHTML=f("Save this selection")+`<div class="slm-saved-body"><p class="slm-saved-what">${S(v.line)}</p>${ne}${ye}${he}</div><div class="slm-saved-foot">${w}</div>`,p();let H=N.querySelector("[data-sv-name]");H.addEventListener("input",()=>{M=H.value,R.kind!=="name"&&(R={kind:"name"},j())}),H.addEventListener("keydown",D=>{D.key==="Enter"&&(D.preventDefault(),ee(!1))}),(R.kind==="name"||R.kind==="taken")&&(H.focus(),H.setSelectionRange(M.length,M.length))},ee=async J=>{if(M=M.trim().replace(/\s+/g," "),!M||h.length>ls||R.kind==="saving"){N.querySelector("[data-sv-name]")?.focus();return}R={kind:"saving"},j();try{let X=await i.request("saved-selections",{method:"POST",body:{name:M,labels:h,where:v.where,...J?{replace:!0}:{}}});e=[X.selection,...(e??[]).filter(ne=>ne.id!==X.selection.id)],i.changed(e.length),g(),i.toast(`Saved \u201C${X.selection.name}\u201D \xB7 ${Ct(X.selection.count)}. Everyone on this event can use it.`,"ok")}catch(X){let ne=xl(X)?.existing;Ye(X)===409&&ne?R={kind:"taken",...ne}:Ye(X)===403?R={kind:"refused",message:"Only who saved it, or an admin, can replace it. Pick another name."}:Ye(X)===422||Ye(X)===413?R={kind:"refused",message:kl(X)??"That is more than this event can hold."}:R={kind:"failed"},s===N&&j()}};N.addEventListener("click",J=>{let X=J.target;if(X.closest("[data-sv-close]")){g();return}let ne=X.closest("[data-sv-suggest]");if(ne){M=ne.dataset.svSuggest,j();return}if(X.closest("[data-sv-save]")){ee(!1);return}if(X.closest("[data-sv-replace]")){ee(!0);return}X.closest("[data-sv-another]")&&(M="",R={kind:"name"},j())}),j()},B=async(h,v)=>{let C=e?.find(E=>E.id===h);r=h,u();try{let E=await i.request(`saved-selections/${encodeURIComponent(h)}`);r=null,g();let L=E.chartVersionAt?Date.parse(E.chartVersionAt):NaN;i.apply(E.labels,{add:v,name:E.selection?.name??C?.name??"",saved:E.labels.length,...L?{changed:K(L,{day:"numeric",month:"short"}).replace("Sept","Sep")}:{}})}catch(E){r=null,Ye(E)===404?(e=(e??[]).filter(L=>L.id!==h),i.changed(e.length),l=null,i.toast("That saved selection was deleted meanwhile.","err")):l={id:h,text:"Couldn't pick these seats. Try again."},u()}},O=async(h,v)=>{r=h.id,l=null,u();try{if(v==="delete")await i.request(`saved-selections/${encodeURIComponent(h.id)}`,{method:"DELETE"}),e=(e??[]).filter(C=>C.id!==h.id);else{let C=await i.request(`saved-selections/${encodeURIComponent(h.id)}`,{method:"PATCH",body:{...v,...v.labels?{where:i.describe(v.labels).where}:{}}});e=(e??[]).map(E=>E.id===h.id?C.selection:E)}i.changed(e.length),a=o=null}catch(C){let E=h.byName??"who saved it";l={id:h.id,text:Ye(C)===403?`Only ${E} or an admin can change it.`:Ye(C)===409?"That name is already saved on this event.":"Couldn't save the change. Try again."}}finally{r=null,u()}},I=h=>{let v=i.selection().length,C=h.byYou?"by you":h.byName?`by ${h.byName}`:"",E=[Ct(h.count),h.where,C].filter(Boolean).join(" \xB7 "),L=r===h.id?`<span class="slm-saved-busy" role="status">${i.picks()?"Selecting\u2026":"Working\u2026"}</span>`:`<button type="button" class="slm-btn ghost s" data-sv-use="${S(h.id)}">${i.picks()?"Select":"Show"}</button>`+(i.canSave?`<button type="button" class="slm-saved-dots" data-sv-menu="${S(h.id)}" aria-haspopup="menu" aria-expanded="${n===h.id}" aria-label="More for ${S(h.name)}">${yl}</button>`:""),M=[...v?[["add","plus","#22a06b","Add to what you picked"]]:[],...v?[["update","undo","#3b82f6",`Update to the ${v.toLocaleString()} selected`]]:[],["rename","tag","#8b5cf6","Rename"],["delete","x","#d64545","Delete"]],R=n===h.id?`<div class="slm-saved-menu" role="menu">${M.map(([J,X,ne,ye])=>`<button type="button" role="menuitem" data-sv-act="${J}" data-id="${S(h.id)}" class="${J==="delete"?"danger":""}">${i.plate(X,ne,22)}${S(ye)}</button>`).join("")}</div>`:"",N=o===h.id?`<input class="slm-saved-input s" data-sv-rename="${S(h.id)}" maxlength="60" value="${S(h.name)}" aria-label="New name">`:`<b>${S(h.name)}</b>`,j=a===h.id?`<div class="slm-saved-confirm" role="alertdialog"><b>Delete \u201C${S(h.name)}\u201D?</b>Only the saved name goes; the seats and anything done to them stay as they are.<span><button type="button" class="slm-btn danger s" data-sv-delete="${S(h.id)}">Delete</button><button type="button" class="slm-btn ghost s" data-sv-keep>Keep it</button></span></div>`:"",ee=l?.id===h.id?`<p class="slm-saved-rowerr" role="alert">${S(l.text)}</p>`:"";return`<div class="slm-saved-row" data-sv-row="${S(h.id)}"><div class="slm-saved-main">${i.plate("star",Xs,28)}<span>${N}<small>${S(E)}</small></span>${L}</div>${R}${j}${ee}</div>`},u=()=>{if(!s||s.getAttribute("aria-label")!=="Saved selections")return;let h=s.querySelector(".slm-saved-body")?.scrollTop??0,v="",C=`<span>${i.picks()?wl()?"Select replaces what you picked.":"Select replaces what you picked. \u21E7 Select adds to it.":"Show frames the seats on the map."}</span>`;c.kind==="loading"&&!e?(v=[110,90,130].map(M=>`<div class="slm-saved-row slm-saved-skel"><i></i><span><em style="width:${M}px"></em><em style="width:${M+70}px"></em></span></div>`).join(""),C=""):c.kind==="failed"&&!e?(v=k("err","Saved selections couldn't load","The map and your selection are fine.")+'<button type="button" class="slm-btn ghost s" data-sv-retry>Try again</button>',C=""):e?.length?v=e.map(I).join(""):(v=`<div class="slm-saved-empty">${i.plate("star",Xs,38)}<b>Nothing saved on this event</b><p>Pick seats you come back to, like a camera platform or the press rows, then press Save on the selection card.</p></div>`,C=""),s.innerHTML=f("Saved selections")+`<div class="slm-saved-body">${v}</div>`+(C?`<div class="slm-saved-foot">${C}</div>`:""),p();let E=s.querySelector(".slm-saved-body");E&&(E.scrollTop=h);let L=s.querySelector("[data-sv-rename]");L&&(L.focus(),L.select(),L.addEventListener("keydown",M=>{if(M.key==="Enter"){M.preventDefault();let R=e?.find(j=>j.id===o),N=L.value.trim().replace(/\s+/g," ");R&&N&&N!==R.name?O(R,{name:N}):(o=null,u())}M.key==="Escape"&&(M.stopPropagation(),o=null,u())}))},x=()=>{let h=m("Saved selections","");c=e?{kind:"list"}:{kind:"loading"},u(),h.addEventListener("click",v=>{let C=v.target,E=j=>{let ee=C.closest(`[${j}]`)?.getAttribute(j);return ee?e?.find(J=>J.id===ee):void 0};if(C.closest("[data-sv-close]")){g();return}if(C.closest("[data-sv-retry]")){c={kind:"loading"},u(),y();return}let L=E("data-sv-use");if(L){B(L.id,v.shiftKey);return}let M=E("data-sv-menu");if(M){n=n===M.id?null:M.id,a=null,u();return}let R=C.closest("[data-sv-act]");if(R){let j=e?.find(ee=>ee.id===R.dataset.id);if(n=null,!j)return;if(R.dataset.svAct==="add"){B(j.id,!0);return}if(R.dataset.svAct==="update"){O(j,{labels:i.selection()});return}if(R.dataset.svAct==="rename"){o=j.id,u();return}a=j.id,u();return}let N=E("data-sv-delete");if(N){O(N,"delete");return}if(C.closest("[data-sv-keep]")){a=null,u();return}n&&!C.closest(".slm-saved-menu")&&(n=null,u())}),y()},y=async()=>{try{await d(),c={kind:"list"}}catch{c={kind:"failed"}}u()};return{openSave:A,openList:x,rows:()=>e,use:B,refresh:async()=>{try{await d()}catch{}},close:g,destroy:g}}var ls,Xs,vl,yl,Ct,Ye,xl,kl,wl,Fa,Zs=Y(()=>{"use strict";ge();me();ls=5e3,Xs="#d99a0b",vl='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',yl='<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="5" cy="12" r="1.8"/><circle cx="12" cy="12" r="1.8"/><circle cx="19" cy="12" r="1.8"/></svg>',Ct=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,Ye=i=>i.status??0,xl=i=>i.details??null,kl=i=>i.serverMessage,wl=()=>typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches;Fa=`
851
903
  .slm-saved{position:absolute;right:12px;top:12px;z-index:30;width:360px;max-width:calc(100% - 24px);max-height:calc(100% - 24px);display:flex;flex-direction:column;border-radius:16px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 24px 60px rgba(12,18,32,.26);overflow:hidden;animation:slm-alert-in var(--slm-mo-base) var(--slm-mo-out)}
852
904
  .slm-saved-head{display:flex;align-items:center;gap:8px;padding:12px 12px 8px 16px}.slm-saved-head b{flex:1;font-size:15px;font-weight:700}
853
905
  .slm .slm-saved-x{display:inline-flex;padding:4px;border-radius:7px;color:var(--slm-muted)}
@@ -888,7 +940,7 @@
888
940
  .slm-savedpill{position:absolute;right:14px;top:14px;z-index:8;display:inline-flex;align-items:center;gap:7px;padding:6px 12px 6px 8px;border-radius:999px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 6px 16px rgba(12,18,32,.14);font-size:12px;color:var(--slm-muted)}
889
941
  .slm-savedpill b{color:var(--slm-text)}
890
942
  .slm.compact .slm-saved{left:12px;right:12px;width:auto;top:8px}
891
- `});function $a(i,e){let t=[],s=f=>{i.mapLayer.insertAdjacentHTML("beforeend",f);let u=i.mapLayer.lastElementChild;return t.push(u),u},n=(e.seats??[]).map(f=>f.trim()).filter(Boolean),a=n.length?n.length===1?n[0]:`${n.length} seats`:void 0,o=n.length?i.focusSeats(n):[],r=o.length>0,l=!a&&e.category?.trim()?i.focusCategory(e.category.trim()):null,c=a||e.category?void 0:e.section?.trim(),d=c?i.sections().find(f=>f.id===c||f.label.localeCompare(c,void 0,{sensitivity:"accent"})===0):void 0;if(d&&i.frame(d.id),e.from){let f=a?r?et(o):"the whole venue":e.category?l??"the whole venue":d?.label??(c&&!d?"the whole venue":e.where??""),u=s(`<div class="slm-arrival" role="status">${i.plate("gauge",Zr,22)}<span><span class="slm-arrival-from">From ${w(e.from)}${f?" \xB7":""}</span>${f?` <b>${w(f)}</b>`:""}${e.why&&(d||r||l||!c&&!a&&!e.category&&e.where)?` <span class="slm-arrival-why">\xB7 ${w(e.why)}</span>`:""}</span>${e.back?`<button type="button" data-arrival-back>\u2039 ${w(e.back.label)}</button>`:""}<button type="button" class="slm-arrival-x" data-arrival-close aria-label="Dismiss">\xD7</button></div>`);u.addEventListener("click",m=>{let v=m.target;v.closest("[data-arrival-back]")?e.back?.go():v.closest("[data-arrival-close]")&&u.remove()})}let b=(f,u,m,v)=>{let $=s(`<div class="slm-arrival-note ${f}" role="${f==="warn"?"alert":"status"}"><b>${w(u)}</b>${w(m)}<span>${v?`<button type="button" class="slm-btn ghost s" data-note-act>${w(v.label)}</button>`:""}<button type="button" class="slm-linkbtn" data-note-close>Dismiss</button></span></div>`);$.addEventListener("click",A=>{let O=A.target;O.closest("[data-note-act]")?(v?.run(),$.remove()):O.closest("[data-note-close]")&&$.remove()})};if(e.category&&!l)b("warn",`\u201C${e.category}\u201D is not a ticket type on this event`," The room opened at the whole venue instead.");else if(a&&!r)b("warn",n.length===1?`\u201C${a}\u201D is not a seat on this chart`:`None of these ${a} are on this chart`," The room opened at the whole venue instead.");else if(c&&!d)b("warn",`\u201C${c}\u201D is no longer on this chart`," The room opened at the whole venue instead.");else if(d){let f=i.stateOf(d.id),u=i.openSections?{label:"Open Sections",run:i.openSections}:void 0;f.kind==="hidden"?b("info",`${d.label} is hidden from buyers`," It is shown greyed here; Sections can show it.",u):f.kind==="closed"?b("info",`${d.label} is closed`," Buyers can see it but can't pick seats in it. Sections can open it.",u):f.kind==="timed"?b("info",`${d.label} is closed${f.until?` until ${Jr(f.until)}`:""}`," Buyers can't see it yet. It is shown greyed; Sections can open it now.",u):f.kind==="threshold"&&b("info",`${d.label} opens when the rest is${f.pct?` ${f.pct}%`:""} sold`," It is shown greyed until then; Sections can open it now.",u)}return{destroy(){for(let f of t)f.remove()}}}function Ta(i){let e=null,t=null,s=null,n=()=>{e?.remove(),e=null,t=null},a=c=>{let d=c.dataset.kpi;if(t===d&&e)return;let b=i.card(d);if(n(),!b)return;t=d,e=document.createElement("div"),e.className="slm-trendcard",e.setAttribute("role","tooltip"),e.innerHTML=`<b>${w(b.title)}</b><span>${w(b.line)}</span><button type="button" data-trend-open>See the trend in Performance \u203A</button>`;let f=i.kpis.parentElement??i.kpis,u=c.getBoundingClientRect(),m=f.getBoundingClientRect();e.style.left=`${Math.max(0,Math.min(u.left-m.left,m.width-280))}px`,e.style.top=`${u.bottom-m.top+6}px`,e.addEventListener("pointerenter",()=>{s&&clearTimeout(s)}),e.addEventListener("pointerleave",()=>{s=setTimeout(n,250)}),e.querySelector("[data-trend-open]").addEventListener("click",()=>{n(),i.open(d,b.sectionId)}),f.append(e)},o=c=>{let d=c.target.closest("[data-kpi]");d&&(s&&clearTimeout(s),a(d))},r=c=>{e&&c.relatedTarget instanceof Node&&e.contains(c.relatedTarget)||(s=setTimeout(n,250))},l=c=>{c.key==="Escape"&&n()};return i.kpis.addEventListener("pointerover",o),i.kpis.addEventListener("pointerleave",r),i.kpis.addEventListener("focusin",o),i.kpis.addEventListener("focusout",()=>{s=setTimeout(n,250)}),i.kpis.addEventListener("keydown",l),{destroy(){n(),i.kpis.removeEventListener("pointerover",o),i.kpis.removeEventListener("pointerleave",r),i.kpis.removeEventListener("focusin",o),i.kpis.removeEventListener("keydown",l)}}}var Zr,Jr,Ca,qs=Y(()=>{"use strict";pe();me();dt();Zr="#3b82f6",Jr=i=>W(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});Ca=`
943
+ `});function Na(i,e){let t=[],s=b=>{i.mapLayer.insertAdjacentHTML("beforeend",b);let m=i.mapLayer.lastElementChild;return t.push(m),m},n=(e.seats??[]).map(b=>b.trim()).filter(Boolean),a=n.length?n.length===1?n[0]:`${n.length} seats`:void 0,o=n.length?i.focusSeats(n):[],r=o.length>0,l=!a&&e.category?.trim()?i.focusCategory(e.category.trim()):null,c=a||e.category?void 0:e.section?.trim(),d=c?i.sections().find(b=>b.id===c||b.label.localeCompare(c,void 0,{sensitivity:"accent"})===0):void 0;if(d&&i.frame(d.id),e.from){let b=a?r?He(o):"the whole venue":e.category?l??"the whole venue":d?.label??(c&&!d?"the whole venue":e.where??""),m=s(`<div class="slm-arrival" role="status">${i.plate("gauge",Sl,22)}<span><span class="slm-arrival-from">From ${S(e.from)}${b?" \xB7":""}</span>${b?` <b>${S(b)}</b>`:""}${e.why&&(d||r||l||!c&&!a&&!e.category&&e.where)?` <span class="slm-arrival-why">\xB7 ${S(e.why)}</span>`:""}</span>${e.back?`<button type="button" data-arrival-back>\u2039 ${S(e.back.label)}</button>`:""}<button type="button" class="slm-arrival-x" data-arrival-close aria-label="Dismiss">\xD7</button></div>`);m.addEventListener("click",p=>{let f=p.target;f.closest("[data-arrival-back]")?e.back?.go():f.closest("[data-arrival-close]")&&m.remove()})}let g=(b,m,p,f)=>{let k=s(`<div class="slm-arrival-note ${b}" role="${b==="warn"?"alert":"status"}"><b>${S(m)}</b>${S(p)}<span>${f?`<button type="button" class="slm-btn ghost s" data-note-act>${S(f.label)}</button>`:""}<button type="button" class="slm-linkbtn" data-note-close>Dismiss</button></span></div>`);k.addEventListener("click",A=>{let B=A.target;B.closest("[data-note-act]")?(f?.run(),k.remove()):B.closest("[data-note-close]")&&k.remove()})};if(e.category&&!l)g("warn",`\u201C${e.category}\u201D is not a ticket type on this event`," The room opened at the whole venue instead.");else if(a&&!r)g("warn",n.length===1?`\u201C${a}\u201D is not a seat on this chart`:`None of these ${a} are on this chart`," The room opened at the whole venue instead.");else if(c&&!d)g("warn",`\u201C${c}\u201D is no longer on this chart`," The room opened at the whole venue instead.");else if(d){let b=i.stateOf(d.id),m=i.openSections?{label:"Open Sections",run:i.openSections}:void 0;b.kind==="hidden"?g("info",`${d.label} is hidden from buyers`," It is shown greyed here; Sections can show it.",m):b.kind==="closed"?g("info",`${d.label} is closed`," Buyers can see it but can't pick seats in it. Sections can open it.",m):b.kind==="timed"?g("info",`${d.label} is closed${b.until?` until ${Ll(b.until)}`:""}`," Buyers can't see it yet. It is shown greyed; Sections can open it now.",m):b.kind==="threshold"&&g("info",`${d.label} opens when the rest is${b.pct?` ${b.pct}%`:""} sold`," It is shown greyed until then; Sections can open it now.",m)}return{destroy(){for(let b of t)b.remove()}}}function qa(i){let e=null,t=null,s=null,n=()=>{e?.remove(),e=null,t=null},a=c=>{let d=c.dataset.kpi;if(t===d&&e)return;let g=i.card(d);if(n(),!g)return;t=d,e=document.createElement("div"),e.className="slm-trendcard",e.setAttribute("role","tooltip"),e.innerHTML=`<b>${S(g.title)}</b><span>${S(g.line)}</span><button type="button" data-trend-open>See the trend in Performance \u203A</button>`;let b=i.kpis.parentElement??i.kpis,m=c.getBoundingClientRect(),p=b.getBoundingClientRect();e.style.left=`${Math.max(0,Math.min(m.left-p.left,p.width-280))}px`,e.style.top=`${m.bottom-p.top+6}px`,e.addEventListener("pointerenter",()=>{s&&clearTimeout(s)}),e.addEventListener("pointerleave",()=>{s=setTimeout(n,250)}),e.querySelector("[data-trend-open]").addEventListener("click",()=>{n(),i.open(d,g.sectionId)}),b.append(e)},o=c=>{let d=c.target.closest("[data-kpi]");d&&(s&&clearTimeout(s),a(d))},r=c=>{e&&c.relatedTarget instanceof Node&&e.contains(c.relatedTarget)||(s=setTimeout(n,250))},l=c=>{c.key==="Escape"&&n()};return i.kpis.addEventListener("pointerover",o),i.kpis.addEventListener("pointerleave",r),i.kpis.addEventListener("focusin",o),i.kpis.addEventListener("focusout",()=>{s=setTimeout(n,250)}),i.kpis.addEventListener("keydown",l),{destroy(){n(),i.kpis.removeEventListener("pointerover",o),i.kpis.removeEventListener("pointerleave",r),i.kpis.removeEventListener("focusin",o),i.kpis.removeEventListener("keydown",l)}}}var Sl,Ll,_a,Js=Y(()=>{"use strict";ge();me();nt();Sl="#3b82f6",Ll=i=>K(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});_a=`
892
944
  .slm-arrival{position:absolute;left:50%;top:64px;z-index:9;transform:translateX(-50%);display:inline-flex;align-items:center;gap:10px;max-width:calc(100% - 24px);height:36px;padding:0 6px 0 8px;box-sizing:border-box;border-radius:999px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 10px 26px rgba(12,18,32,.18);font-size:12.5px;white-space:nowrap}
893
945
  .slm-arrival>span:nth-child(2){overflow:hidden;text-overflow:ellipsis}
894
946
  .slm-arrival-from,.slm-arrival-why{color:var(--slm-muted)}
@@ -908,11 +960,11 @@
908
960
  .slm .slm-trendcard button{display:inline-flex;margin-top:10px;height:26px;align-items:center;padding:0 9px;border-radius:8px;border:1px solid var(--slm-accent);background:color-mix(in srgb,var(--slm-accent) 14%,var(--slm-surface));font-size:12px;font-weight:600;color:var(--slm-text)}
909
961
  .slm.compact .slm-arrival-why{display:none}
910
962
  .slm.compact .slm-arrival{top:56px}.slm.compact .slm-arrival-note{top:100px}
911
- `});function ge(i,e=""){let t="";for(let s=0;s<6;s++)for(let n=0;n<12;n++){let a=22+n*18.5,o=24+s*17+Math.pow(n-5.5,2)*.22,r=i(s,n);r&&(t+=`<circle cx="${a.toFixed(1)}" cy="${o.toFixed(1)}" r="6" fill="${r.fill}"${r.fill==="#ffffff"?' stroke="#9ca3af" stroke-width="1"':""}/>`,r.ring&&(t+=`<circle cx="${a.toFixed(1)}" cy="${o.toFixed(1)}" r="8.4" fill="none" stroke="${r.ring}" stroke-width="1.6"/>`),r.cross&&(t+=`<path d="M${(a-3).toFixed(1)} ${(o-3).toFixed(1)}l6 6" stroke="${q.blocked}" stroke-width="1.6" stroke-linecap="round"/>`))}return`<svg viewBox="0 0 250 130" aria-hidden="true"><rect width="250" height="130" class="slm-ex-ground"/>${t}${e}</svg>`}function Ea(i){let e=(t,s,n)=>`<path d="M${t} 104 q34 -64 68 0 z" fill="${s}"${n?' opacity=".55"':""}/>`+(n?`<path d="M${t+14} 100l20 -30M${t+26} 102l20 -30M${t+38} 102l14 -20" stroke="#64748b" stroke-width="1.4"/>`:"");return'<svg viewBox="0 0 250 130" aria-hidden="true"><rect width="250" height="130" class="slm-ex-ground"/><rect x="85" y="14" width="80" height="14" rx="4" fill="#64748b" opacity=".45"/>'+e(12,q.free,!1)+e(91,i?q.sold:q.free,i)+e(170,q.free,!1)+"</svg>"}function Ra(i){let e="";for(let s=0;s<8;s++){let n=s/8*Math.PI*2,a=i?q.free:s===1||s===2?q.sold:q.free;e+=`<circle cx="${(125+Math.cos(n)*44).toFixed(1)}" cy="${(65+Math.sin(n)*44).toFixed(1)}" r="8" fill="${a}"/>`}let t=i?`<circle cx="125" cy="65" r="56" fill="none" stroke="${q.ring}" stroke-width="2" stroke-dasharray="5 4"/>`:"";return`<svg viewBox="0 0 250 130" aria-hidden="true"><rect width="250" height="130" class="slm-ex-ground"/><circle cx="125" cy="65" r="28" fill="#94a3b8" opacity=".35"/>${e}${t}</svg>`}function Qr(i){let e=i?"Tap":"Click",t=(s,n)=>s===3&&n===6;return{watch:{title:"How Watch works",glyph:"eye",hue:"#3b82f6",before:ge(Ma),after:ge((s,n)=>({fill:Ae(s,n)||t(s,n)?q.sold:q.free,ring:t(s,n)?q.ring:void 0}),'<rect x="150" y="6" width="92" height="30" rx="7" fill="#0f172a" opacity=".85"/><text x="158" y="19" fill="#fff" font-size="9" font-weight="700">Sold \xB7 Stalls C D-7</text><text x="158" y="30" fill="#cbd5e1" font-size="8">Booking #9845</text>'),name:"Answer any question about a seat",purpose:`${e} a seat, or search it, to see its status, booking and buyer, and its history.`,steps:[i?"Tap the search icon and type a seat, booking or buyer.":"Press \u2318K and type a seat, booking or buyer.","Read the seat card and its history.","Open the order if it needs changing."],not:"changing seats; pick a task first."},reserve:{title:"How Reserve works",glyph:"bookmark",hue:"#c026d3",before:ge((s,n)=>({fill:Ae(s,n)?q.sold:q.free,ring:$e(s,n)?q.ring:void 0})),after:ge((s,n)=>({fill:Ae(s,n)?q.sold:$e(s,n)?"#ffffff":q.free,ring:$e(s,n)?q.reserved:void 0})),name:"Keep seats aside under a name",purpose:"Reserved seats leave sale for guests, press or comps, and come back when you release them or their time runs out.",steps:["Pick free seats.","Name it and choose when it goes back on sale.","Press Reserve. Release any time from On this event."],not:"seats that should never be sold; Block them."},block:{title:"How Block works",glyph:"ban",hue:"#d64545",before:ge((s,n)=>({fill:Ae(s,n)?q.sold:q.free,ring:$e(s,n)?q.ring:void 0})),after:ge((s,n)=>({fill:Ae(s,n)?q.sold:$e(s,n)?"#ffffff":q.free,cross:$e(s,n)})),name:"Take seats off sale",purpose:"Buyers cannot pick blocked seats. Give a reason so the team knows why.",steps:["Pick seats (sold seats and seats in a cart are skipped).","Add a reason and, if you like, when they go back on sale.","Press Block."],not:"keeping seats for named guests; Reserve them."},types:{title:"How Ticket types works",glyph:"tag",hue:"#8b5cf6",before:ge((s,n)=>({fill:q.typeA,ring:$e(s,n)?q.ring:void 0})),after:ge((s,n)=>({fill:$e(s,n)?q.typeB:q.typeA})),name:"Move seats to another ticket type",purpose:"For this event only. The chart keeps its design, and sold seats keep what the buyer paid.",steps:["Pick seats on the map.",'Choose the ticket type under "Move them to".',"Press Move. Undo from the footer."],not:"changing the price of a ticket type; that is Pricing and availability."},sections:{title:"How Sections works",glyph:"layers",hue:"#0ea5a5",before:Ea(!1),after:Ea(!0),name:"Open, close or hide whole sections",purpose:"For this event: now, at a set time, or when the rest of the venue sells.",steps:["Pick a section in the list.","Choose Open, Close or Hide, now or at a time.","It saves at once. Buyers with seats in their cart can still finish."],not:"single seats; Block them."},tables:{title:"How Tables works",glyph:"table",hue:"#65a30d",before:Ra(!1),after:Ra(!0),name:"Sell a table whole, or chair by chair",purpose:"For this event. A whole table goes to one buyer; chairs already sold keep their buyer.",steps:["Pick tables in the list or on the map.","Switch Per chair or Whole table.","Save."],not:"moving chairs or changing the room; that is the chart designer."},channels:{title:"How Channels works",glyph:"route",hue:"#ea7a1e",before:ge((s,n)=>({fill:q.pub,ring:$e(s,n)?q.ring:void 0})),after:ge((s,n)=>({fill:$e(s,n)?q.box:q.pub})),name:"Give seats to a sales channel",purpose:"Box office, a partner or members sell these seats; public sale stops seeing them.",steps:["Choose the channel.","Pick seats on the map.","Review the counts and save."],not:"changing prices; channels can have their own in Pricing."},search:{title:"How search works",glyph:"search",hue:"#4c6fff",before:ge(Ma),after:ge((s,n)=>({fill:Ae(s,n)?q.sold:q.free,ring:t(s,n)?q.ring:void 0}),'<rect x="40" y="4" width="170" height="16" rx="8" fill="#0f172a" opacity=".85"/><text x="52" y="15.5" fill="#fff" font-size="8.5">\u2315 D-7</text>'),name:"Find a seat, row, section, booking or buyer",purpose:i?"Tap the search icon anywhere in the room. Results show status and price; bookings show their buyer.":"Press \u2318K anywhere in the room. Results show status and price; bookings show their buyer.",steps:["Type what you know: G-5, \u201CStalls C\u201D, #9845, a name or an email.",i?"Tap a result to show it; in a seat task it selects it.":"\u21B5 shows it; in a seat task it selects it; \u21E7\u21B5 adds it.","Open order goes to the booking."],not:"changing seats; that is a task."}}}function Aa(i,e){i.root.querySelector(".slm-ex-scrim")?.remove();let t=i.touch&&i.root.clientWidth<820,s=document.activeElement,n=document.createElement("div");n.className=`slm-ex-scrim${t?" sheet":""}`;let a,o,r,l,c=!1;if(e==="colours")a="How colours work",o="palette",r="#8b5cf6",c=!0,l=`<p class="slm-ex-lead">The map can colour seats three ways. Pick the one that answers your question; nothing about the seats changes.</p><div class="slm-ex-modes">${el.map(u=>`<div class="slm-ex-card">${ge(u.paint)}<b>${w(u.label)}</b><span>${w(u.hint)}.</span></div>`).join("")}</div><ol class="slm-ex-steps3"><li><span>Open <b>Colour by</b> at the top-left of the map.</span></li><li><span>Choose a mode. The legend counts the seats of each colour, live.</span></li><li><span>${i.touch?"Tap":"Click"} a legend item to light those seats up.</span></li></ol>`;else{let u=Qr(i.touch)[e];a=u.title,o=u.glyph,r=u.hue,l=`<div class="slm-ex-card"><div class="slm-ex-pics"><div>${u.before}</div><i>${sl}</i><div>${u.after}</div></div><b>${w(u.name)}</b><p>${w(u.purpose)}</p><ol>${u.steps.map(m=>`<li>${w(m)}</li>`).join("")}</ol><p class="slm-ex-not"><b>Not for:</b> ${w(u.not)}</p></div>`}let d=e==="search"?i.touch?"Try search now":"Try \u2318K now":e==="colours"?"Try it on this map":"Try it here";n.innerHTML=`<div class="slm-ex${c?" wide":""}" role="dialog" aria-modal="true" aria-labelledby="slm-ex-title">`+(t?'<span class="slm-ex-grab" aria-hidden="true"></span>':"")+`<div class="slm-ex-head">${i.plate(o,r,34)}<b id="slm-ex-title">${w(a)}</b><button type="button" class="slm-ex-x" data-ex-close aria-label="Close">${tl}</button></div><div class="slm-ex-body">${l}</div><div class="slm-ex-foot">${i.guideUrl?`<a href="${w(i.guideUrl)}" target="_blank" rel="noopener">Full guide in docs \u2197</a>`:""}<span></span><button type="button" class="slm-btn ghost s" data-ex-try>${w(d)}</button><button type="button" class="slm-btn s" data-ex-close>Got it</button></div></div>`;let b=()=>{n.remove(),document.removeEventListener("keydown",f,!0),s?.focus?.({preventScroll:!0})},f=u=>{if(u.key==="Escape"){u.stopPropagation(),b();return}if(u.key!=="Tab")return;let m=[...n.querySelectorAll("button, a[href]")],v=m[0],$=m[m.length-1];u.shiftKey&&document.activeElement===v?(u.preventDefault(),$.focus()):!u.shiftKey&&document.activeElement===$&&(u.preventDefault(),v.focus())};return n.addEventListener("click",u=>{let m=u.target;if(m===n||m.closest("[data-ex-close]")){b();return}m.closest("[data-ex-try]")&&(b(),i.tryIt(e))}),document.addEventListener("keydown",f,!0),i.root.append(n),n.querySelector("[data-ex-close].slm-btn")?.focus({preventScroll:!0}),{close:b}}var q,Ae,$e,Ma,el,tl,sl,Ha,_s=Y(()=>{"use strict";pe();q={free:"#1f9d6b",sold:"#9ca3af",held:"#f4b740",ring:"#d99a0b",reserved:"#c026d3",blocked:"#d64545",typeA:"#2f9d46",typeB:"#5b7bff",typeC:"#e8456b",typeD:"#bc800b",pub:"#c9d0dc",box:"#e8782a",member:"#7c5cff"};Ae=(i,e)=>(i*7+e*3)%5===0,$e=(i,e)=>(i===2||i===3)&&e>=3&&e<=8&&!Ae(i,e),Ma=(i,e)=>({fill:Ae(i,e)?q.sold:q.free});el=[{key:"status",label:"Status",hint:"What a buyer can buy right now",paint:(i,e)=>({fill:Ae(i,e)?q.sold:(i+e)%9===0?q.held:q.free})},{key:"type",label:"Ticket type",hint:"Which ticket type each seat sells as",paint:i=>({fill:[q.typeD,q.typeD,q.typeC,q.typeA,q.typeA,q.typeB][i]})},{key:"channel",label:"Channel",hint:"Who can sell each seat",paint:(i,e)=>({fill:e<3?q.box:i===0?q.member:q.pub})}],tl='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',sl='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>';Ha=`
963
+ `});function ve(i,e=""){let t="";for(let s=0;s<6;s++)for(let n=0;n<12;n++){let a=22+n*18.5,o=24+s*17+Math.pow(n-5.5,2)*.22,r=i(s,n);r&&(t+=`<circle cx="${a.toFixed(1)}" cy="${o.toFixed(1)}" r="6" fill="${r.fill}"${r.fill==="#ffffff"?' stroke="#9ca3af" stroke-width="1"':""}/>`,r.ring&&(t+=`<circle cx="${a.toFixed(1)}" cy="${o.toFixed(1)}" r="8.4" fill="none" stroke="${r.ring}" stroke-width="1.6"/>`),r.cross&&(t+=`<path d="M${(a-3).toFixed(1)} ${(o-3).toFixed(1)}l6 6" stroke="${_.blocked}" stroke-width="1.6" stroke-linecap="round"/>`))}return`<svg viewBox="0 0 250 130" aria-hidden="true"><rect width="250" height="130" class="slm-ex-ground"/>${t}${e}</svg>`}function Va(i){let e=(t,s,n)=>`<path d="M${t} 104 q34 -64 68 0 z" fill="${s}"${n?' opacity=".55"':""}/>`+(n?`<path d="M${t+14} 100l20 -30M${t+26} 102l20 -30M${t+38} 102l14 -20" stroke="#64748b" stroke-width="1.4"/>`:"");return'<svg viewBox="0 0 250 130" aria-hidden="true"><rect width="250" height="130" class="slm-ex-ground"/><rect x="85" y="14" width="80" height="14" rx="4" fill="#64748b" opacity=".45"/>'+e(12,_.free,!1)+e(91,i?_.sold:_.free,i)+e(170,_.free,!1)+"</svg>"}function Ua(i){let e="";for(let s=0;s<8;s++){let n=s/8*Math.PI*2,a=i?_.free:s===1||s===2?_.sold:_.free;e+=`<circle cx="${(125+Math.cos(n)*44).toFixed(1)}" cy="${(65+Math.sin(n)*44).toFixed(1)}" r="8" fill="${a}"/>`}let t=i?`<circle cx="125" cy="65" r="56" fill="none" stroke="${_.ring}" stroke-width="2" stroke-dasharray="5 4"/>`:"";return`<svg viewBox="0 0 250 130" aria-hidden="true"><rect width="250" height="130" class="slm-ex-ground"/><circle cx="125" cy="65" r="28" fill="#94a3b8" opacity=".35"/>${e}${t}</svg>`}function $l(i){let e=i?"Tap":"Click",t=(s,n)=>s===3&&n===6;return{watch:{title:"How Watch works",glyph:"eye",hue:"#3b82f6",before:ve(ja),after:ve((s,n)=>({fill:Pe(s,n)||t(s,n)?_.sold:_.free,ring:t(s,n)?_.ring:void 0}),'<rect x="150" y="6" width="92" height="30" rx="7" fill="#0f172a" opacity=".85"/><text x="158" y="19" fill="#fff" font-size="9" font-weight="700">Sold \xB7 Stalls C D-7</text><text x="158" y="30" fill="#cbd5e1" font-size="8">Booking #9845</text>'),name:"Answer any question about a seat",purpose:`${e} a seat, or search it, to see its status, booking and buyer, and its history.`,steps:[i?"Tap the search icon and type a seat, booking or buyer.":"Press \u2318K and type a seat, booking or buyer.","Read the seat card and its history.","Open the order if it needs changing."],not:"changing seats; pick a task first."},reserve:{title:"How Reserve works",glyph:"bookmark",hue:"#c026d3",before:ve((s,n)=>({fill:Pe(s,n)?_.sold:_.free,ring:Me(s,n)?_.ring:void 0})),after:ve((s,n)=>({fill:Pe(s,n)?_.sold:Me(s,n)?"#ffffff":_.free,ring:Me(s,n)?_.reserved:void 0})),name:"Keep seats aside under a name",purpose:"Reserved seats leave sale for guests, press or comps, and come back when you release them or their time runs out.",steps:["Pick free seats.","Name it and choose when it goes back on sale.","Press Reserve. Release any time from On this event."],not:"seats that should never be sold; Block them."},block:{title:"How Block works",glyph:"ban",hue:"#d64545",before:ve((s,n)=>({fill:Pe(s,n)?_.sold:_.free,ring:Me(s,n)?_.ring:void 0})),after:ve((s,n)=>({fill:Pe(s,n)?_.sold:Me(s,n)?"#ffffff":_.free,cross:Me(s,n)})),name:"Take seats off sale",purpose:"Buyers cannot pick blocked seats. Give a reason so the team knows why.",steps:["Pick seats (sold seats and seats in a cart are skipped).","Add a reason and, if you like, when they go back on sale.","Press Block."],not:"keeping seats for named guests; Reserve them."},types:{title:"How Ticket types works",glyph:"tag",hue:"#8b5cf6",before:ve((s,n)=>({fill:_.typeA,ring:Me(s,n)?_.ring:void 0})),after:ve((s,n)=>({fill:Me(s,n)?_.typeB:_.typeA})),name:"Move seats to another ticket type",purpose:"For this event only. The chart keeps its design, and sold seats keep what the buyer paid.",steps:["Pick seats on the map.",'Choose the ticket type under "Move them to".',"Press Move. Undo from the footer."],not:"changing the price of a ticket type; that is Pricing and availability."},sections:{title:"How Sections works",glyph:"layers",hue:"#0ea5a5",before:Va(!1),after:Va(!0),name:"Open, close or hide whole sections",purpose:"For this event: now, at a set time, or when the rest of the venue sells.",steps:["Pick a section in the list.","Choose Open, Close or Hide, now or at a time.","It saves at once. Buyers with seats in their cart can still finish."],not:"single seats; Block them."},tables:{title:"How Tables works",glyph:"table",hue:"#65a30d",before:Ua(!1),after:Ua(!0),name:"Sell a table whole, or chair by chair",purpose:"For this event. A whole table goes to one buyer; chairs already sold keep their buyer.",steps:["Pick tables in the list or on the map.","Switch Per chair or Whole table.","Save."],not:"moving chairs or changing the room; that is the chart designer."},channels:{title:"How Channels works",glyph:"route",hue:"#ea7a1e",before:ve((s,n)=>({fill:_.pub,ring:Me(s,n)?_.ring:void 0})),after:ve((s,n)=>({fill:Me(s,n)?_.box:_.pub})),name:"Give seats to a sales channel",purpose:"Box office, a partner or members sell these seats; public sale stops seeing them.",steps:["Choose the channel.","Pick seats on the map.","Review the counts and save."],not:"changing prices; channels can have their own in Pricing."},search:{title:"How search works",glyph:"search",hue:"#4c6fff",before:ve(ja),after:ve((s,n)=>({fill:Pe(s,n)?_.sold:_.free,ring:t(s,n)?_.ring:void 0}),'<rect x="40" y="4" width="170" height="16" rx="8" fill="#0f172a" opacity=".85"/><text x="52" y="15.5" fill="#fff" font-size="8.5">\u2315 D-7</text>'),name:"Find a seat, row, section, booking or buyer",purpose:i?"Tap the search icon anywhere in the room. Results show status and price; bookings show their buyer.":"Press \u2318K anywhere in the room. Results show status and price; bookings show their buyer.",steps:["Type what you know: G-5, \u201CStalls C\u201D, #9845, a name or an email.",i?"Tap a result to show it; in a seat task it selects it.":"\u21B5 shows it; in a seat task it selects it; \u21E7\u21B5 adds it.","Open order goes to the booking."],not:"changing seats; that is a task."}}}function Ka(i,e){i.root.querySelector(".slm-ex-scrim")?.remove();let t=i.touch&&i.root.clientWidth<820,s=document.activeElement,n=document.createElement("div");n.className=`slm-ex-scrim${t?" sheet":""}`;let a,o,r,l,c=!1;if(e==="colours")a="How colours work",o="palette",r="#8b5cf6",c=!0,l=`<p class="slm-ex-lead">The map can colour seats four ways. Pick the one that answers your question; nothing about the seats changes.</p><div class="slm-ex-modes">${Cl.map(m=>`<div class="slm-ex-card">${ve(m.paint)}<b>${S(m.label)}</b><span>${S(m.hint)}.</span></div>`).join("")}</div><ol class="slm-ex-steps3"><li><span>Open <b>Colour by</b> at the top-left of the map.</span></li><li><span>Choose a mode. The legend counts free seats of each colour, live.</span></li><li><span>${i.touch?"Tap a legend item to light up those seats.":"Click a legend item to light those seats up; \u21E7 click selects them."}</span></li></ol>`;else{let m=$l(i.touch)[e];a=m.title,o=m.glyph,r=m.hue,l=`<div class="slm-ex-card"><div class="slm-ex-pics"><div>${m.before}</div><i>${Ml}</i><div>${m.after}</div></div><b>${S(m.name)}</b><p>${S(m.purpose)}</p><ol>${m.steps.map(p=>`<li>${S(p)}</li>`).join("")}</ol><p class="slm-ex-not"><b>Not for:</b> ${S(m.not)}</p></div>`}let d=e==="search"?i.touch?"Try search now":"Try \u2318K now":e==="colours"?"Try it on this map":"Try it here";n.innerHTML=`<div class="slm-ex${c?" wide":""}" role="dialog" aria-modal="true" aria-labelledby="slm-ex-title">`+(t?'<span class="slm-ex-grab" aria-hidden="true"></span>':"")+`<div class="slm-ex-head">${i.plate(o,r,34)}<b id="slm-ex-title">${S(a)}</b><button type="button" class="slm-ex-x" data-ex-close aria-label="Close">${Tl}</button></div><div class="slm-ex-body">${l}</div><div class="slm-ex-foot">${i.guideUrl?`<a href="${S(i.guideUrl)}" target="_blank" rel="noopener">Full guide in docs \u2197</a>`:""}<span></span><button type="button" class="slm-btn ghost s" data-ex-try>${S(d)}</button><button type="button" class="slm-btn s" data-ex-close>Got it</button></div></div>`;let g=()=>{n.remove(),document.removeEventListener("keydown",b,!0),s?.focus?.({preventScroll:!0})},b=m=>{if(m.key==="Escape"){m.stopPropagation(),g();return}if(m.key!=="Tab")return;let p=[...n.querySelectorAll("button, a[href]")],f=p[0],k=p[p.length-1];m.shiftKey&&document.activeElement===f?(m.preventDefault(),k.focus()):!m.shiftKey&&document.activeElement===k&&(m.preventDefault(),f.focus())};return n.addEventListener("click",m=>{let p=m.target;if(p===n||p.closest("[data-ex-close]")){g();return}p.closest("[data-ex-try]")&&(g(),i.tryIt(e))}),document.addEventListener("keydown",b,!0),i.root.append(n),n.querySelector("[data-ex-close].slm-btn")?.focus({preventScroll:!0}),{close:g}}var _,Pe,Me,ja,Cl,Tl,Ml,Wa,Qs=Y(()=>{"use strict";ge();_={free:"#1f9d6b",sold:"#9ca3af",held:"#f4b740",ring:"#d99a0b",reserved:"#c026d3",blocked:"#d64545",typeA:"#2f9d46",typeB:"#5b7bff",typeC:"#e8456b",typeD:"#bc800b",pub:"#c9d0dc",box:"#e8782a",member:"#7c5cff"};Pe=(i,e)=>(i*7+e*3)%5===0,Me=(i,e)=>(i===2||i===3)&&e>=3&&e<=8&&!Pe(i,e),ja=(i,e)=>({fill:Pe(i,e)?_.sold:_.free});Cl=[{key:"status",label:"Status",hint:"What a buyer can buy right now",paint:(i,e)=>({fill:Pe(i,e)?_.sold:(i+e)%9===0?_.held:_.free})},{key:"type",label:"Ticket type",hint:"Which ticket type each seat sells as",paint:i=>({fill:[_.typeD,_.typeD,_.typeC,_.typeA,_.typeA,_.typeB][i]})},{key:"price",label:"Price",hint:"What each seat costs, darker costs more",paint:i=>({fill:["#1f43a8","#3a62d2","#5f88ee","#5f88ee","#8db0fa","#bfd3ff"][i]})},{key:"channel",label:"Channel",hint:"Who can sell each seat",paint:(i,e)=>({fill:e<3?_.box:i===0?_.member:_.pub})}],Tl='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',Ml='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>';Wa=`
912
964
  .slm-ex-scrim{position:absolute;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;background:color-mix(in srgb,var(--slm-bg) 62%,transparent);animation:slm-ex-fade var(--slm-mo-base) var(--slm-mo-out)}
913
965
  @keyframes slm-ex-fade{from{opacity:0}to{opacity:1}}
914
966
  .slm-ex{width:620px;max-width:100%;max-height:100%;display:flex;flex-direction:column;border-radius:18px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 30px 80px rgba(0,0,0,.28);overflow:hidden;animation:slm-alert-in var(--slm-mo-base) var(--slm-mo-out)}
915
- .slm-ex.wide{width:900px}
967
+ .slm-ex.wide{width:1040px}
916
968
  .slm-ex-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--slm-line)}
917
969
  .slm-ex-head b{flex:1;font-size:18px;font-weight:700}
918
970
  .slm .slm-ex-x{display:inline-flex;padding:4px;border-radius:8px;color:var(--slm-muted)}
@@ -929,7 +981,7 @@
929
981
  .slm-ex-card>.slm-ex-not{margin:8px 0 0;padding:8px 10px;border-radius:8px;background:var(--slm-surface);font-size:12px}
930
982
  .slm-ex-not b{color:var(--slm-text)}
931
983
  .slm-ex-lead{margin:0 0 12px;font-size:14px;line-height:1.5;color:var(--slm-muted)}
932
- .slm-ex-modes{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
984
+ .slm-ex-modes{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
933
985
  .slm-ex-modes .slm-ex-card>b{margin-top:8px;font-size:13.5px}.slm-ex-modes .slm-ex-card>span{font-size:12px;line-height:1.45;color:var(--slm-muted)}
934
986
  .slm-ex-steps3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin:16px 0 0;padding:0;list-style:none;counter-reset:ex;font-size:13px;line-height:1.5}
935
987
  .slm-ex-steps3 li{counter-increment:ex;display:flex;gap:10px}
@@ -945,28 +997,28 @@
945
997
  .slm-ex-scrim.sheet .slm-ex{width:100%;max-height:calc(100% - 40px);border-radius:20px 20px 0 0;border-width:0;box-shadow:none;animation:slm-ex-rise var(--slm-mo-base) var(--slm-mo-out)}
946
998
  @keyframes slm-ex-rise{from{transform:translateY(40px);opacity:.6}to{transform:none;opacity:1}}
947
999
  .slm-ex-grab{align-self:center;width:40px;height:5px;margin-top:8px;border-radius:9px;background:var(--slm-line)}
948
- `});function js(i){let e=i.seats(),t=i.selected(),s=e.filter(u=>t.has(u.label));if(!s.length)return[];let n=u=>e.filter(m=>!t.has(m.label)&&i.pickable(m)&&u(m)).map(m=>m.label),a=u=>new Set(u).size===1?u[0]:null,o=new Set(s.map(u=>u.row)),r=new Set(s.map(u=>u.section)),l=a(s.map(u=>u.type)),c=a(s.map(u=>u.status)),d=new Set(s.map(u=>u.number)),b=[{key:"rows",glyph:"row",hue:"#3b82f6",text:o.size===1?`The rest of row ${s[0].rowLabel}`:"The rest of these rows",labels:n(u=>o.has(u.row))},{key:"section",glyph:"layers",hue:"#0ea5a5",text:r.size===1?`The rest of ${s[0].sectionLabel}`:"The rest of these sections",labels:n(u=>r.has(u.section))}];if(l){let u=s[0].typeLabel;b.push({key:"type",glyph:"tag",hue:"#8b5cf6",text:`All free ${u} seats`,labels:n(m=>m.type===l&&m.status==="free")})}let f=i.view();if(c&&f){let u=m=>m.x>=f.x&&m.x<=f.x+f.width&&m.y>=f.y&&m.y<=f.y+f.height;b.push({key:"status",glyph:"filter",hue:"#64748b",text:`Same status in view (${nl[c]})`,labels:n(m=>m.status===c&&u(m))})}return(o.size===1||d.size<=12)&&b.push({key:"numbers",glyph:"seat",hue:"#2f9d46",text:"Same seat numbers, every row",labels:n(u=>r.has(u.section)&&d.has(u.number))}),b.filter(u=>u.labels.length>0)}function Ba(i){document.querySelector(".slm-similar")?.remove();let e=js(i),t=document.createElement("div");t.className="slm-similar",t.setAttribute("role","menu"),t.setAttribute("aria-label","Select similar");let s=(r,l)=>Ia[r]?`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="${l}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Ia[r]}</svg>`:i.plate(r,l,22);t.innerHTML=e.length?e.map((r,l)=>`<button type="button" role="menuitem" data-similar="${l}">${s(r.glyph,r.hue)}<span class="slm-sim-text">${w(r.text)}</span><em>+${r.labels.length.toLocaleString()}</em></button>`).join(""):"<p>Nothing more like these on the map for this tool.</p>";let n=()=>{t.remove(),i.anchor.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",o,!0)},a=r=>{!r.composedPath().includes(t)&&!r.composedPath().includes(i.anchor)&&n()},o=r=>{if(r.key==="Escape"){r.stopPropagation(),n(),i.anchor.focus();return}if(r.key!=="ArrowDown"&&r.key!=="ArrowUp")return;r.preventDefault();let l=[...t.querySelectorAll("[data-similar]")],c=l.indexOf(document.activeElement);l[(c+(r.key==="ArrowDown"?1:l.length-1))%l.length]?.focus()};return t.addEventListener("click",r=>{let l=r.target.closest("[data-similar]");if(!l)return;let c=e[Number(l.dataset.similar)];n(),i.add(c.labels)}),i.anchor.insertAdjacentElement("afterend",t),i.anchor.setAttribute("aria-expanded","true"),document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",o,!0),t.querySelector("[data-similar]")?.focus(),{close:n}}var nl,Ia,Pa,Vs=Y(()=>{"use strict";pe();nl={free:"free",held:"in a cart",booked:"sold",blocked:"blocked"};Ia={row:'<circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/>',filter:'<path d="M4 5h16l-6 7.5V19l-4-2v-4.5z"/>'};Pa=`
1000
+ `});function en(i){let e=i.seats(),t=i.selected(),s=e.filter(m=>t.has(m.label));if(!s.length)return[];let n=m=>e.filter(p=>!t.has(p.label)&&i.pickable(p)&&m(p)).map(p=>p.label),a=m=>new Set(m).size===1?m[0]:null,o=new Set(s.map(m=>m.row)),r=new Set(s.map(m=>m.section)),l=a(s.map(m=>m.type)),c=a(s.map(m=>m.status)),d=new Set(s.map(m=>m.number)),g=[{key:"rows",glyph:"row",hue:"#3b82f6",text:o.size===1?`The rest of row ${s[0].rowLabel}`:"The rest of these rows",labels:n(m=>o.has(m.row))},{key:"section",glyph:"layers",hue:"#0ea5a5",text:r.size===1?`The rest of ${s[0].sectionLabel}`:"The rest of these sections",labels:n(m=>r.has(m.section))}];if(l){let m=s[0].typeLabel;g.push({key:"type",glyph:"tag",hue:"#8b5cf6",text:`All free ${m} seats`,labels:n(p=>p.type===l&&p.status==="free")})}let b=i.view();if(c&&b){let m=p=>p.x>=b.x&&p.x<=b.x+b.width&&p.y>=b.y&&p.y<=b.y+b.height;g.push({key:"status",glyph:"filter",hue:"#64748b",text:`Same status in view (${El[c]})`,labels:n(p=>p.status===c&&m(p))})}return(o.size===1||d.size<=12)&&g.push({key:"numbers",glyph:"seat",hue:"#2f9d46",text:"Same seat numbers, every row",labels:n(m=>r.has(m.section)&&d.has(m.number))}),g.filter(m=>m.labels.length>0)}function Ya(i){document.querySelector(".slm-similar")?.remove();let e=en(i),t=document.createElement("div");t.className="slm-similar",t.setAttribute("role","menu"),t.setAttribute("aria-label","Select similar");let s=(r,l)=>Ga[r]?`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="${l}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Ga[r]}</svg>`:i.plate(r,l,22);t.innerHTML=e.length?e.map((r,l)=>`<button type="button" role="menuitem" data-similar="${l}">${s(r.glyph,r.hue)}<span class="slm-sim-text">${S(r.text)}</span><em>+${r.labels.length.toLocaleString()}</em></button>`).join(""):"<p>Nothing more like these on the map for this tool.</p>";let n=()=>{t.remove(),i.anchor.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",o,!0)},a=r=>{!r.composedPath().includes(t)&&!r.composedPath().includes(i.anchor)&&n()},o=r=>{if(r.key==="Escape"){r.stopPropagation(),n(),i.anchor.focus();return}if(r.key!=="ArrowDown"&&r.key!=="ArrowUp")return;r.preventDefault();let l=[...t.querySelectorAll("[data-similar]")],c=l.indexOf(document.activeElement);l[(c+(r.key==="ArrowDown"?1:l.length-1))%l.length]?.focus()};return t.addEventListener("click",r=>{let l=r.target.closest("[data-similar]");if(!l)return;let c=e[Number(l.dataset.similar)];n(),i.add(c.labels)}),i.anchor.insertAdjacentElement("afterend",t),i.anchor.setAttribute("aria-expanded","true"),document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",o,!0),t.querySelector("[data-similar]")?.focus(),{close:n}}var El,Ga,Xa,tn=Y(()=>{"use strict";ge();El={free:"free",held:"in a cart",booked:"sold",blocked:"blocked"};Ga={row:'<circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/>',filter:'<path d="M4 5h16l-6 7.5V19l-4-2v-4.5z"/>'};Xa=`
949
1001
  .slm-similar{position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:30;padding:6px;border-radius:14px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 18px 44px rgba(12,18,32,.22)}
950
1002
  .slm .slm-similar button{display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;border-radius:9px;text-align:left;color:var(--slm-text)}
951
1003
  .slm .slm-similar button:hover,.slm .slm-similar button:focus-visible{background:color-mix(in srgb,var(--slm-accent) 14%,transparent);outline:none}
952
1004
  .slm-similar .slm-sim-text{flex:1;font-size:13px;font-weight:500}
953
1005
  .slm-similar em{font-style:normal;font-size:12px;font-weight:600;color:var(--slm-muted);font-variant-numeric:tabular-nums}
954
1006
  .slm-similar p{margin:6px 8px;font-size:12.5px;color:var(--slm-muted)}
955
- `});function il(i,e){let t=Math.floor(Math.max(0,e-i)/6e4),s=Math.floor(t/60);return`Sales went live ${t<1?"just now":t<60?`${t} ${t===1?"minute":"minutes"} ago`:s<24?`${s} ${s===1?"hour":"hours"} ago`:`on ${W(i,{day:"numeric",month:"short"})}`}.`}function Oa(i,e){i.querySelector(".slm-fsline-pill")?.remove();let t=i.querySelector("b");if(!e?.status||!t)return;let s=document.createElement("span");s.className=`slm-fsline-pill ${e.tone??"ok"}`,s.textContent=e.status,t.after(s)}function Da(i,e,t=Date.now()){let s=i.querySelector("p");if(!s||!e||(s.textContent=`${e.openedAt?`${il(e.openedAt,t)} `:""}The first booking shows here the moment it happens.`,i.querySelector(".slm-nosales-page")?.remove(),!e.pageUrl))return;let n=document.createElement("a");n.className="slm-btn ghost slm-nosales-page",n.href=e.pageUrl,n.target="_blank",n.rel="noopener",n.innerHTML='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#3b82f6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z"/><circle cx="12" cy="12" r="3"/></svg>',n.append("Open the event page"),s.after(n)}var za,Us=Y(()=>{"use strict";me();za=`
1007
+ `});function Rl(i,e){let t=Math.floor(Math.max(0,e-i)/6e4),s=Math.floor(t/60);return`Sales went live ${t<1?"just now":t<60?`${t} ${t===1?"minute":"minutes"} ago`:s<24?`${s} ${s===1?"hour":"hours"} ago`:`on ${K(i,{day:"numeric",month:"short"})}`}.`}function Za(i,e){i.querySelector(".slm-fsline-pill")?.remove();let t=i.querySelector("b");if(!e?.status||!t)return;let s=document.createElement("span");s.className=`slm-fsline-pill ${e.tone??"ok"}`,s.textContent=e.status,t.after(s)}function Ja(i,e,t=Date.now()){let s=i.querySelector("p");if(!s||!e||(s.textContent=`${e.openedAt?`${Rl(e.openedAt,t)} `:""}The first booking shows here the moment it happens.`,i.querySelector(".slm-nosales-page")?.remove(),!e.pageUrl))return;let n=document.createElement("a");n.className="slm-btn ghost slm-nosales-page",n.href=e.pageUrl,n.target="_blank",n.rel="noopener",n.innerHTML='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#3b82f6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z"/><circle cx="12" cy="12" r="3"/></svg>',n.append("Open the event page"),s.after(n)}var Qa,sn=Y(()=>{"use strict";me();Qa=`
956
1008
  .slm-fsline-pill{padding:3px 9px;border-radius:999px;font-size:11.5px;font-weight:600;color:#5fd3a1;background:color-mix(in srgb,#22a06b 16%,var(--slm-surface))}
957
1009
  .slm[data-theme="light"] .slm-fsline-pill{color:#11704c}
958
1010
  .slm .slm-fsline-pill.warn{color:color-mix(in srgb,#d99a0b 70%,var(--slm-text));background:color-mix(in srgb,#f4b740 18%,var(--slm-surface))}
959
1011
  .slm .slm-fsline-pill.muted{color:var(--slm-muted);background:color-mix(in srgb,var(--slm-text) 7%,var(--slm-surface))}
960
1012
  .slm .slm-nosales-page{display:inline-flex;align-items:center;gap:6px;flex:none;min-width:0;margin-top:10px;padding:6px 11px;font-size:12px;font-weight:600;text-decoration:none}
961
- `});function Fa(i){i.addEventListener("keydown",e=>{let t=e.target.closest?.(Na);if(!t||!i.contains(t)||e.altKey||e.metaKey||e.ctrlKey||e.shiftKey)return;if(e.key==="Enter"){let n=i.querySelector("[data-ch-add-scope]")??i.querySelector(".slm-ch-seatfoot [data-ch-close]");if(n?.disabled){e.preventDefault();return}n&&(e.preventDefault(),n.click());return}let s=al(i,t,e.key);s&&(e.preventDefault(),s.focus(),s.scrollIntoView?.({block:"nearest"}))})}function al(i,e,t){let s=(f,u,m,v)=>t===v?f[u+1]??null:t===m?f[u-1]??null:t==="Home"?f[0]??null:t==="End"?f[f.length-1]??null:null,n=e.closest(".slm-sl-row");if(!n){if(e.matches(".slm-sl-section")&&t==="ArrowRight")return[...i.querySelectorAll(".slm-sl-rows .slm-ch-rowcheck, .slm-sl-rows .slm-ch-seatchip")].find(ns)??null;let f=[...(e.parentElement?.closest(".slm-sl-sections, .slm-ch-seatlist")??e.parentElement).querySelectorAll(Na)].filter(ns);return s(f,f.indexOf(e),"ArrowUp","ArrowDown")}let a=f=>[...f.querySelectorAll(".slm-ch-seatchip")].filter(ns),o=f=>{let u=f.querySelector(".slm-ch-rowcheck");return ns(u)?u:null},r=f=>[o(f),...a(f)].filter(u=>!!u),l=r(n),c=l.indexOf(e);if(t==="ArrowLeft"&&c===0)return i.querySelector(".slm-sl-section.on");if(t!=="ArrowUp"&&t!=="ArrowDown")return s(l,c,"ArrowLeft","ArrowRight");let d=[...n.parentElement.querySelectorAll(".slm-sl-row")],b=t==="ArrowDown"?1:-1;for(let f=d.indexOf(n)+b;f>=0&&f<d.length;f+=b){let u=r(d[f]),m=a(d[f]);if(!u.length)continue;if(e.matches(".slm-ch-rowcheck")||!m.length)return o(d[f])??u[0];let v=e.getBoundingClientRect().left;return v?m.reduce(($,A)=>Math.abs(A.getBoundingClientRect().left-v)<Math.abs($.getBoundingClientRect().left-v)?A:$):m[Math.min(Math.max(0,a(n).indexOf(e)),m.length-1)]}return null}var Na,ns,qa=Y(()=>{"use strict";Na=".slm-ch-seatchip, .slm-ch-rowcheck, .slm-ch-seatitem, .slm-ch-groupcheck, .slm-sl-section",ns=i=>!!i&&!i.disabled});function Va(i){let e=i.host.categories();if(!e.length)return;let t=i.host.cap??1/0,s=e.map(c=>{let d=i.host.labelsInCategory(c.key);return{key:c.key,label:c.label,color:c.color,labels:d,total:c.total??d.length}}),n=new Map(s.map(c=>[c.key,c])),a=new Set,o=new Set(i.host.selectionLabels()),r=()=>{let c=new Set(o);for(let d of a)for(let b of n.get(d)?.labels??[])c.add(b);return c};if(s.every(c=>c.labels.length===0)){i.host.openDialog(`
1013
+ `});function io(i){let e=i.host.categories();if(!e.length)return;let t=i.host.cap??1/0,s=e.map(c=>{let d=i.host.labelsInCategory(c.key);return{key:c.key,label:c.label,color:c.color,labels:an(i,d),total:c.total??d.length}}),n=new Map(s.map(c=>[c.key,c])),a=new Set,o=new Set(i.host.selectionLabels()),r=()=>{let c=new Set(o);for(let d of a)for(let g of n.get(d)?.labels??[])c.add(g);return c};if(s.every(c=>c.labels.length===0)){i.host.openDialog(`
962
1014
  <h3 id="slm-ch-dlg-title">Choose ticket types</h3>
963
1015
  <div class="slm-ch-scope-empty" data-ch-state="scope-empty"><b>No free seats in any ticket type</b>Every seat is sold, in a cart or blocked. Pick seats on the map to change them.</div>
964
- <div class="foot"><button type="button" class="slm-btn" data-ch-close>Close</button></div>`,()=>{});return}let l=s.map(c=>{let b=c.total===0?"not on this map":yt(c.labels.length,c.total);return`<button type="button" class="slm-ch-seatitem" role="checkbox" aria-checked="false"
965
- data-ch-category="${w(c.key)}"${c.labels.length?"":" disabled"}>
1016
+ <div class="foot"><button type="button" class="slm-btn s slm-ch-close" data-ch-close>Close</button></div>`,()=>{});return}let l=s.map(c=>{let g=c.total===0?"not on this map":Tt(ht(i,c.labels),c.total);return`<button type="button" class="slm-ch-seatitem" role="checkbox" aria-checked="false"
1017
+ data-ch-category="${S(c.key)}"${c.labels.length?"":" disabled"}>
966
1018
  <span class="box" aria-hidden="true">\u2713</span>
967
- <span class="dot" style="background:${w(c.color??"#6e7bff")}" aria-hidden="true"></span>
968
- <span class="name">${w(c.label)}</span>
969
- <span class="meta">${w(b)}</span>
1019
+ <span class="dot" style="background:${S(c.color??"#6e7bff")}" aria-hidden="true"></span>
1020
+ <span class="name">${S(c.label)}</span>
1021
+ <span class="meta">${S(g)}</span>
970
1022
  </button>`}).join("");i.host.openDialog(`
971
1023
  <h3 id="slm-ch-dlg-title">Choose ticket types</h3>
972
1024
  <p class="sub">Every free seat of a ticked type is added to what is already selected on the map.</p>
@@ -975,7 +1027,7 @@
975
1027
  <span class="slm-ch-footsum" data-ch-scope-summary aria-live="polite"></span>
976
1028
  <button type="button" class="quiet" data-ch-close>Cancel</button>
977
1029
  <button type="button" class="slm-btn" data-ch-add-scope disabled>Add seats</button>
978
- </div>`,c=>{i.host.enhanceDialog?.(c);let d=c.querySelector("[data-ch-add-scope]"),b=c.querySelector("[data-ch-scope-summary]"),f=()=>{let u=r(),m=u.size-o.size,v=s.filter($=>a.has($.key)).map($=>$.label);Ua(d,b,u.size,m,t,v.length?`${v.length>2?`${v.length} ticket types`:v.join(" and ")} \xB7 ${m.toLocaleString()} free ${m===1?"seat":"seats"}`:"")};c.querySelectorAll("[data-ch-category]").forEach(u=>{u.addEventListener("click",()=>{let m=u.dataset.chCategory;a.has(m)?a.delete(m):a.add(m),u.setAttribute("aria-checked",String(a.has(m))),f()})}),d.addEventListener("click",()=>{let u=[...r()];!a.size||u.length>t||(i.host.closeDialog(),i.host.selectByLabels(u))}),f()})}function Ua(i,e,t,s,n,a,o=""){let r=t>n;i.disabled=s===0||r,i.textContent=s?`Add ${Ws(s)}`:"Add seats",e.classList.toggle("warn",r),e.textContent=r?`That would make ${Ws(t)}. One change can take up to ${n.toLocaleString()}; choose fewer.`:s?a:o}function Ka(i){let e=i.host.cap??1/0,t=i.rows().filter(d=>d.labels.length>0),s=new Map;for(let d of t){let b=s.get(d.sectionId)??{id:d.sectionId,label:d.sectionLabel,rows:[]};b.rows.push(d),s.set(d.sectionId,b)}let n=[...s.values()],a=new Set,o=new Set(i.host.selectionLabels()),r=new Map(t.map(d=>[d.id,d])),l=()=>{let d=new Set(o);for(let b of a)for(let f of r.get(b)?.labels??[])d.add(f);return d},c=d=>d.all?.length??d.labels.length;i.host.openDialog(`
1030
+ </div>`,c=>{i.host.enhanceDialog?.(c);let d=c.querySelector("[data-ch-add-scope]"),g=c.querySelector("[data-ch-scope-summary]"),b=()=>{let m=r(),p=m.size-o.size,f=s.filter(k=>a.has(k.key)).map(k=>k.label);oo(d,g,m.size,p,t,f.length?`${f.length>2?`${f.length} ticket types`:f.join(" and ")} \xB7 ${no(p)}`:"")};c.querySelectorAll("[data-ch-category]").forEach(m=>{m.addEventListener("click",()=>{let p=m.dataset.chCategory;a.has(p)?a.delete(p):a.add(p),m.setAttribute("aria-checked",String(a.has(p))),b()})}),d.addEventListener("click",()=>{let m=[...r()];!a.size||m.length>t||(i.host.closeDialog(),i.host.selectByLabels(m))}),b()})}function oo(i,e,t,s,n,a,o=""){let r=t>n;i.disabled=s===0||r,i.textContent=s?`Add ${so(s)}`:"Add seats",e.classList.toggle("warn",r),e.innerHTML=r?ao(t,n):S(s?a:o)}function ro(i){let e=i.host.cap??1/0,t=i.rows().map(d=>({...d,all:d.all??d.labels,labels:an(i,d.labels)})).filter(d=>d.labels.length>0),s=new Map;for(let d of t){let g=s.get(d.sectionId)??{id:d.sectionId,label:d.sectionLabel,rows:[]};g.rows.push(d),s.set(d.sectionId,g)}let n=[...s.values()],a=new Set,o=new Set(i.host.selectionLabels()),r=new Map(t.map(d=>[d.id,d])),l=()=>{let d=new Set(o);for(let g of a)for(let b of r.get(g)?.labels??[])d.add(b);return d},c=d=>d.all?.length??d.labels.length;i.host.openDialog(`
979
1031
  <h3 id="slm-ch-dlg-title">Choose rows</h3>
980
1032
  <p class="sub">Open a section to see every row in it. Only free seats are added, to what is already selected on the map.</p>
981
1033
  <div class="slm-ch-findbox"><input type="search" class="slm-input" data-ch-scope-search placeholder="Find a section or row" aria-label="Find a section or row" autocomplete="off"></div>
@@ -984,16 +1036,16 @@
984
1036
  <span class="slm-ch-footsum" data-ch-scope-summary aria-live="polite"></span>
985
1037
  <button type="button" class="quiet" data-ch-close>Cancel</button>
986
1038
  <button type="button" class="slm-btn" data-ch-add-scope disabled>Add seats</button>
987
- </div>`,d=>{i.host.enhanceDialog?.(d);let b=new Set,f=d.querySelector("[data-ch-add-scope]"),u=d.querySelector("[data-ch-scope-list]"),m=d.querySelector("[data-ch-scope-search]"),v=d.querySelector("[data-ch-scope-summary]"),$="",A=()=>{let h=l(),p=h.size-o.size,g=a.size===1?r.get([...a][0]):null,y=g?`Row ${Te(g)} of ${g.sectionLabel} \xB7 ${p.toLocaleString()} free ${p===1?"seat":"seats"}`:`${a.size.toLocaleString()} rows \xB7 ${p.toLocaleString()} free ${p===1?"seat":"seats"}`;Ua(f,v,h.size,p,e,y,"Tick rows or whole sections.")},O=h=>`<span class="box ${h}" aria-hidden="true">${h==="mixed"?"\u2013":"\u2713"}</span>`,B=(h,p)=>`<button type="button" class="slm-ch-seatitem row" role="checkbox" aria-checked="${a.has(h.id)}" data-ch-scope-id="${w(h.id)}">
988
- ${O(a.has(h.id)?"true":"false")}<span class="name">${w(p)}</span><span class="meta">${yt(h.labels.length,c(h))}</span></button>`,k=()=>{let h=/^row\s+(\S+)$/i.exec($)?.[1]?.toLocaleLowerCase();if($){let p=t.filter(g=>h?Te(g).toLocaleLowerCase()===h:`${g.sectionLabel} ${Te(g)}`.toLocaleLowerCase().includes($)).slice(0,ol);u.innerHTML=p.map(g=>B(g,`${g.sectionLabel} \xB7 row ${Te(g)}`)).join("")||`<div class="slm-ch-scope-empty" data-ch-state="scope-nomatch"><b>Nothing matches \u201C${w($)}\u201D</b>Search by section, or a row like \u201Crow G\u201D.</div>`}else u.innerHTML=n.map((p,g)=>{let y=p.rows.every(M=>a.has(M.id)),L=!y&&p.rows.some(M=>a.has(M.id)),C=p.rows.reduce((M,H)=>M+H.labels.length,0),x=b.has(g);return`<div class="slm-ch-scopegroup">
989
- <button type="button" class="slm-ch-groupcheck" role="checkbox" aria-checked="${y?"true":L?"mixed":"false"}"
990
- aria-label="Every row in ${w(p.label)}" data-ch-scope-group="${g}">${O(y?"true":L?"mixed":"false")}<span class="name">${w(p.label)}</span>
1039
+ </div>`,d=>{i.host.enhanceDialog?.(d);let g=new Set,b=d.querySelector("[data-ch-add-scope]"),m=d.querySelector("[data-ch-scope-list]"),p=d.querySelector("[data-ch-scope-search]"),f=d.querySelector("[data-ch-scope-summary]"),k="",A=()=>{let u=l(),x=u.size-o.size,y=a.size===1?r.get([...a][0]):null,h=`${y?`Row ${Ee(y)} of ${y.sectionLabel}`:`${a.size.toLocaleString()} rows`} \xB7 ${no(x)}`;oo(b,f,u.size,x,e,h,"Tick rows or whole sections.")},B=u=>`<span class="box ${u}" aria-hidden="true">${u==="mixed"?"\u2013":"\u2713"}</span>`,O=(u,x)=>`<button type="button" class="slm-ch-seatitem row" role="checkbox" aria-checked="${a.has(u.id)}" data-ch-scope-id="${S(u.id)}">
1040
+ ${B(a.has(u.id)?"true":"false")}<span class="name">${S(x)}</span><span class="meta">${Tt(ht(i,u.labels),c(u))}</span></button>`,I=()=>{let u=/^row\s+(\S+)$/i.exec(k)?.[1]?.toLocaleLowerCase();if(k){let x=t.filter(y=>u?Ee(y).toLocaleLowerCase()===u:`${y.sectionLabel} ${Ee(y)}`.toLocaleLowerCase().includes(k)).slice(0,Al);m.innerHTML=x.map(y=>O(y,`${y.sectionLabel} \xB7 row ${Ee(y)}`)).join("")||`<div class="slm-ch-scope-empty" data-ch-state="scope-nomatch"><b>Nothing matches \u201C${S(k)}\u201D</b>Search by section, or a row like \u201Crow G\u201D.</div>`}else m.innerHTML=n.map((x,y)=>{let h=x.rows.every(L=>a.has(L.id)),v=!h&&x.rows.some(L=>a.has(L.id)),C=x.rows.reduce((L,M)=>L+ht(i,M.labels),0),E=g.has(y);return`<div class="slm-ch-scopegroup">
1041
+ <button type="button" class="slm-ch-groupcheck" role="checkbox" aria-checked="${h?"true":v?"mixed":"false"}"
1042
+ aria-label="Every row in ${S(x.label)}" data-ch-scope-group="${y}">${B(h?"true":v?"mixed":"false")}<span class="name">${S(x.label)}</span>
991
1043
  <span class="meta">${C.toLocaleString()} free</span></button>
992
- <button type="button" class="slm-ch-grouptoggle${x?" open":""}" aria-expanded="${x}" aria-label="${x?"Hide":"Show"} rows in ${w(p.label)}" data-ch-scope-toggle="${g}">${ja}</button>
993
- </div>${x?`<div class="slm-ch-scoperows">${p.rows.map(M=>B(M,`Row ${Te(M)}`)).join("")}</div>`:""}`}).join("")||'<div class="slm-ch-scope-empty" data-ch-state="scope-empty"><b>No rows with free seats</b>Use Drag box or the seat list instead.</div>';u.querySelectorAll("[data-ch-scope-group]").forEach(p=>p.addEventListener("click",()=>{let g=n[Number(p.dataset.chScopeGroup)],y=g.rows.every(L=>a.has(L.id));for(let L of g.rows)y?a.delete(L.id):a.add(L.id);k(),A()})),u.querySelectorAll("[data-ch-scope-toggle]").forEach(p=>p.addEventListener("click",()=>{let g=Number(p.dataset.chScopeToggle);b.has(g)?b.delete(g):b.add(g),k()})),u.querySelectorAll("[data-ch-scope-id]").forEach(p=>p.addEventListener("click",()=>{let g=p.dataset.chScopeId;a.has(g)?a.delete(g):a.add(g),k(),A()}))};m.addEventListener("input",()=>{$=m.value.trim().toLocaleLowerCase(),k()}),f.addEventListener("click",()=>{let h=[...l()];!a.size||h.length>e||(i.host.closeDialog(),i.host.selectByLabels(h))}),k(),A()})}function Wa(i,e=""){let t=e,s=Ks(i,t);i.host.openDialog(`
1044
+ <button type="button" class="slm-ch-grouptoggle${E?" open":""}" aria-expanded="${E}" aria-label="${E?"Hide":"Show"} rows in ${S(x.label)}" data-ch-scope-toggle="${y}">${to}</button>
1045
+ </div>${E?`<div class="slm-ch-scoperows">${x.rows.map(L=>O(L,`Row ${Ee(L)}`)).join("")}</div>`:""}`}).join("")||'<div class="slm-ch-scope-empty" data-ch-state="scope-empty"><b>No rows with free seats</b>Use Drag box or the seat list instead.</div>';m.querySelectorAll("[data-ch-scope-group]").forEach(x=>x.addEventListener("click",()=>{let y=n[Number(x.dataset.chScopeGroup)],h=y.rows.every(v=>a.has(v.id));for(let v of y.rows)h?a.delete(v.id):a.add(v.id);I(),A()})),m.querySelectorAll("[data-ch-scope-toggle]").forEach(x=>x.addEventListener("click",()=>{let y=Number(x.dataset.chScopeToggle);g.has(y)?g.delete(y):g.add(y),I()})),m.querySelectorAll("[data-ch-scope-id]").forEach(x=>x.addEventListener("click",()=>{let y=x.dataset.chScopeId;a.has(y)?a.delete(y):a.add(y),I(),A()}))};p.addEventListener("input",()=>{k=p.value.trim().toLocaleLowerCase(),I()}),b.addEventListener("click",()=>{let u=[...l()];!a.size||u.length>e||(i.host.closeDialog(),i.host.selectByLabels(u))}),I(),A()})}function lo(i,e=""){let t=e,s=nn(i,t);i.host.openDialog(`
994
1046
  <h3 id="slm-ch-dlg-title">Seat list</h3>
995
1047
  <p class="sub">The same selection as the map, as checkboxes. A row takes its free seats; a seat toggles itself.</p>
996
- <div class="slm-ch-findbox" data-ch-seatfilter><input type="search" class="slm-input" data-ch-seatfilter-input placeholder="Find a section, row or seat" aria-label="Find a section, row or seat" autocomplete="off" value="${w(e)}"></div>
1048
+ <div class="slm-ch-findbox" data-ch-seatfilter><input type="search" class="slm-input" data-ch-seatfilter-input placeholder="Find a section, row or seat" aria-label="Find a section, row or seat" autocomplete="off" value="${S(e)}"></div>
997
1049
  <div class="slm-sl-grid">
998
1050
  <div class="slm-sl-sections" data-sl-left>${s.left}</div>
999
1051
  <div class="slm-sl-rows" data-sl-right>${s.right}</div>
@@ -1001,40 +1053,18 @@
1001
1053
  <div class="foot slm-ch-seatfoot">
1002
1054
  <span data-sl-foot>${s.foot}</span>
1003
1055
  <button type="button" class="slm-btn" data-ch-close>Done</button>
1004
- </div>`,n=>{i.host.enhanceDialog?.(n);let a=()=>{let d=n.querySelector(".slm-ch-seatlist")?.scrollTop??0,b=document.activeElement,f=b&&n.contains(b)?["chSeat","chRow","slSection","chSection","chClearAll"].map(v=>[v,b.dataset[v]]).find(([,v])=>v!==void 0)??null:null,u=Ks(i,t);n.querySelector("[data-sl-left]").innerHTML=u.left,n.querySelector("[data-sl-right]").innerHTML=u.right,n.querySelector("[data-sl-foot]").innerHTML=u.foot;let m=n.querySelector(".slm-ch-seatlist");if(m&&(m.scrollTop=d),f){let v=f[0].replace(/[A-Z]/g,$=>`-${$.toLowerCase()}`);n.querySelector(`[data-${v}${f[1]?`="${f[1].replace(/["\\]/g,"\\$&")}"`:""}]`)?.focus()}},o=()=>{let c=new Set(i.host.selectionLabels());n.querySelectorAll("[data-ch-seat]").forEach(b=>b.setAttribute("aria-checked",String(c.has(b.dataset.chSeat))));let d=i.rows();n.querySelectorAll("[data-ch-row]").forEach(b=>{let f=d.find($=>$.id===b.dataset.chRow),u=f?f.labels.filter($=>c.has($)).length:0,m=!f||u===0?"false":u===f.labels.length?"true":"mixed";b.setAttribute("aria-checked",m);let v=b.querySelector(".box");v&&(v.className=`box ${m}`,v.textContent=m==="mixed"?"\u2013":"\u2713")}),n.querySelector("[data-sl-foot]").innerHTML=Ks(i,t).foot},r=c=>{if(c.size>(i.host.cap??1/0)){i.seatListCap=c.size,o();return}i.host.clearSelection(),c.size&&i.host.selectByLabels([...c]),o()};n.addEventListener("click",c=>{let d=c.target,b=d.closest("[data-ch-seat]"),f=d.closest("[data-ch-row]"),u=d.closest("[data-sl-section]"),m=d.closest("[data-ch-section]"),v=new Set(i.host.selectionLabels());if(b&&!b.disabled){let $=b.dataset.chSeat;v.has($)?v.delete($):v.add($),r(v)}else if(f){let $=i.rows().find(O=>O.id===f.dataset.chRow);if(!$)return;let A=$.labels.every(O=>v.has(O));for(let O of $.labels)A?v.delete(O):v.add(O);r(v)}else if(u)i.seatListSection=u.dataset.slSection,a();else if(m){for(let $ of i.rows())if($.sectionId===m.dataset.chSection)for(let A of $.labels)v.add(A);r(v)}else d.closest("[data-ch-clear-all]")&&r(new Set)});let l=n.querySelector("[data-ch-seatfilter-input]");if(l){let c=null;l.addEventListener("input",()=>{c&&clearTimeout(c),c=setTimeout(()=>{t=l.value,a()},120)}),e&&(l.focus(),l.setSelectionRange(l.value.length,l.value.length))}})}function Ks(i,e){let t=new Set(i.host.selectionLabels()),s=i.host.cap??1/0,n=e.trim().toLocaleLowerCase(),a=/^row\s+(\S+)$/i.exec(n)?.[1],o=i.rows(),r=new Set(i.host.seats().map(x=>x.label)),l=new Map;for(let x of o)l.set(x.sectionId,[...l.get(x.sectionId)??[],x]);let c=x=>!n||(a?Te(x).toLocaleLowerCase()===a:`${x.sectionLabel} ${Te(x)}`.toLocaleLowerCase().includes(n)||(x.all??x.labels).some(M=>M.toLocaleLowerCase().includes(n))),d=i.host.sections().map(x=>{let M=i.host.sectionInfo?.(x.id),H=l.get(x.id)??[],F=H.reduce((N,K)=>N+K.labels.length,0);return{...x,rows:H,free:F,total:M?.total??H.reduce((N,K)=>N+(K.all?.length??K.labels.length),0),color:M?.color}}).filter(x=>x.rows.length),b=d.filter(x=>!n||x.label.toLocaleLowerCase().includes(n)||x.rows.some(c)),f=d.find(x=>x.id===_a(i,d))??null,u=_a(i,b),m=b.find(x=>x.id===u)??null,v=m?n&&!m.label.toLocaleLowerCase().includes(n)?m.rows.filter(c):m.rows:[],$=x=>i.host.statusOf(x)??"free",A=x=>i.host.seatMeta?.(x)??$(x),O=(x,M)=>{let H=x.startsWith(`${M}-`)?x.slice(M.length+1):x.split("-").pop()??x,F=r.has(x);return`<button type="button" class="slm-ch-seatchip is-${w($(x))}" role="checkbox" aria-checked="${t.has(x)}"${F?"":" disabled"}
1005
- aria-label="${w(x)} \xB7 ${w(A(x))}" title="${w(x)} \xB7 ${w(A(x))}" data-ch-seat="${w(x)}">${w(H)}</button>`},B=x=>{let M=x.labels.filter(H=>t.has(H)).length;return M===0?"false":M===x.labels.length?"true":"mixed"},k=b.map(x=>`<button type="button" class="slm-sl-section${x.id===u?" on":""}" data-sl-section="${w(x.id)}" aria-current="${x.id===u}">
1006
- <span class="dot" style="background:${w(x.color??"#6e7bff")}" aria-hidden="true"></span><span><b>${w(x.label)}</b><small>${yt(x.free,x.total)}</small></span>${x.id===u?ja:""}</button>`).join(""),h=m&&m.total>rl?`<p class="slm-sl-note">${w(m.label)} \xB7 ${m.total.toLocaleString()} seats in ${m.rows.length.toLocaleString()} rows. The list scrolls; nothing to page through.</p>`:"",p=(m??f)?.rows.map(Te)??[],g=m??f,y=!m||!v.length?`<div class="slm-ch-scope-empty" data-ch-state="seatlist-nomatch"><b>Nothing matches \u201C${w(e.trim())}\u201D</b>${g&&p.length?`${w(g.label)} has rows ${w(p[0])} to ${w(p[p.length-1])}. Try a row like ${w(p[p.length-1])}, or a seat like ${w(`${p[p.length-1]}-5`)}.`:"Search by section, row or seat."}</div>`:`${h}${v.map(x=>`<div class="slm-sl-row">
1007
- <button type="button" class="slm-ch-rowcheck" role="checkbox" aria-checked="${B(x)}" data-ch-row="${w(x.id)}"${x.labels.length?"":" disabled"}
1008
- aria-label="Row ${w(Te(x))} \xB7 ${yt(x.labels.length,x.all?.length??x.labels.length)}">
1009
- <span class="box ${B(x)}" aria-hidden="true">${B(x)==="mixed"?"\u2013":"\u2713"}</span><span class="name">Row ${w(Te(x))}</span>
1010
- <span class="meta">${yt(x.labels.length,x.all?.length??x.labels.length)}</span>
1056
+ </div>`,n=>{i.host.enhanceDialog?.(n);let a=()=>{let d=n.querySelector(".slm-ch-seatlist")?.scrollTop??0,g=document.activeElement,b=g&&n.contains(g)?["chSeat","chRow","slSection","chSection","chClearAll"].map(f=>[f,g.dataset[f]]).find(([,f])=>f!==void 0)??null:null,m=nn(i,t);n.querySelector("[data-sl-left]").innerHTML=m.left,n.querySelector("[data-sl-right]").innerHTML=m.right,n.querySelector("[data-sl-foot]").innerHTML=m.foot;let p=n.querySelector(".slm-ch-seatlist");if(p&&(p.scrollTop=d),b){let f=b[0].replace(/[A-Z]/g,k=>`-${k.toLowerCase()}`);n.querySelector(`[data-${f}${b[1]?`="${b[1].replace(/["\\]/g,"\\$&")}"`:""}]`)?.focus()}},o=()=>{let c=new Set(i.host.selectionLabels());n.querySelectorAll("[data-ch-seat]").forEach(g=>g.setAttribute("aria-checked",String(c.has(g.dataset.chSeat))));let d=i.rows();n.querySelectorAll("[data-ch-row]").forEach(g=>{let b=d.find(k=>k.id===g.dataset.chRow),m=b?b.labels.filter(k=>c.has(k)).length:0,p=!b||m===0?"false":m===b.labels.length?"true":"mixed";g.setAttribute("aria-checked",p);let f=g.querySelector(".box");f&&(f.className=`box ${p}`,f.textContent=p==="mixed"?"\u2013":"\u2713")}),n.querySelector("[data-sl-foot]").innerHTML=nn(i,t).foot},r=c=>{if(c.size>(i.host.cap??1/0)){i.seatListCap=c.size,o();return}i.host.clearSelection(),c.size&&i.host.selectByLabels([...c]),o()};n.addEventListener("click",c=>{let d=c.target,g=d.closest("[data-ch-seat]"),b=d.closest("[data-ch-row]"),m=d.closest("[data-sl-section]"),p=d.closest("[data-ch-section]"),f=new Set(i.host.selectionLabels());if(g&&!g.disabled){let k=g.dataset.chSeat;f.has(k)?f.delete(k):f.add(k),r(f)}else if(b){let k=i.rows().find(B=>B.id===b.dataset.chRow);if(!k)return;let A=k.labels.every(B=>f.has(B));for(let B of k.labels)A?f.delete(B):f.add(B);r(f)}else if(m)i.seatListSection=m.dataset.slSection,a();else if(p){for(let k of i.rows())if(k.sectionId===p.dataset.chSection)for(let A of k.labels)f.add(A);r(f)}else d.closest("[data-ch-clear-all]")&&r(new Set)});let l=n.querySelector("[data-ch-seatfilter-input]");if(l){let c=null;l.addEventListener("input",()=>{c&&clearTimeout(c),c=setTimeout(()=>{t=l.value,a()},120)}),e&&(l.focus(),l.setSelectionRange(l.value.length,l.value.length))}})}function nn(i,e){let t=new Set(i.host.selectionLabels()),s=i.host.cap??1/0,n=e.trim().toLocaleLowerCase(),a=/^row\s+(\S+)$/i.exec(n)?.[1],o=i.rows(),r=new Set(i.host.seats().map(L=>L.label)),l=new Map;for(let L of o)l.set(L.sectionId,[...l.get(L.sectionId)??[],L]);let c=L=>!n||(a?Ee(L).toLocaleLowerCase()===a:`${L.sectionLabel} ${Ee(L)}`.toLocaleLowerCase().includes(n)||(L.all??L.labels).some(M=>M.toLocaleLowerCase().includes(n))),d=i.host.sections().map(L=>{let M=i.host.sectionInfo?.(L.id),R=l.get(L.id)??[],N=R.reduce((j,ee)=>j+ht(i,ee.labels),0);return{...L,rows:R,free:N,total:M?.total??R.reduce((j,ee)=>j+(ee.all?.length??ee.labels.length),0),color:M?.color}}).filter(L=>L.rows.length),g=d.filter(L=>!n||L.label.toLocaleLowerCase().includes(n)||L.rows.some(c)),b=d.find(L=>L.id===eo(i,d))??null,m=eo(i,g),p=g.find(L=>L.id===m)??null,f=p?n&&!p.label.toLocaleLowerCase().includes(n)?p.rows.filter(c):p.rows:[],k=L=>i.host.statusOf(L)??"free",A=L=>i.host.seatMeta?.(L)??k(L),B=(L,M)=>{let R=L.startsWith(`${M}-`)?L.slice(M.length+1):L.split("-").pop()??L,N=r.has(L);return`<button type="button" class="slm-ch-seatchip is-${S(k(L))}" role="checkbox" aria-checked="${t.has(L)}"${N?"":" disabled"}
1057
+ aria-label="${S(L)} \xB7 ${S(A(L))}" title="${S(L)} \xB7 ${S(A(L))}" data-ch-seat="${S(L)}">${S(R)}</button>`},O=L=>{let M=L.labels.filter(R=>t.has(R)).length;return M===0?"false":M===L.labels.length?"true":"mixed"},I=g.length?m:b?.id,u=(g.length?g:d).map(L=>`<button type="button" class="slm-sl-section${L.id===I?" on":""}" data-sl-section="${S(L.id)}" aria-current="${L.id===I}">
1058
+ <span class="dot" style="background:${S(L.color??"#6e7bff")}" aria-hidden="true"></span><span><b>${S(L.label)}</b><small>${Tt(L.free,L.total)}</small></span>${L.id===I?to:""}</button>`).join(""),x=p&&p.total>Hl?`<p class="slm-sl-note">${S(p.label)} \xB7 ${p.total.toLocaleString()} seats in ${p.rows.length.toLocaleString()} rows. The list scrolls; nothing to page through.</p>`:"",y=(p??b)?.rows.map(Ee)??[],h=p??b,v=!p||!f.length?`<div class="slm-ch-scope-empty" data-ch-state="seatlist-nomatch"><b>Nothing matches \u201C${S(e.trim())}\u201D</b>${h&&y.length?`${S(h.label)} has rows ${S(y[0])} to ${S(y[y.length-1])}. Try a row like ${S(y[y.length-1])}, or a seat like ${S(`${y[y.length-1]}-5`)}.`:"Search by section, row or seat."}</div>`:`${x}${f.map(L=>`<div class="slm-sl-row">
1059
+ <button type="button" class="slm-ch-rowcheck" role="checkbox" aria-checked="${O(L)}" data-ch-row="${S(L.id)}"${L.labels.length?"":" disabled"}
1060
+ aria-label="Row ${S(Ee(L))} \xB7 ${Tt(ht(i,L.labels),L.all?.length??L.labels.length)}">
1061
+ <span class="box ${O(L)}" aria-hidden="true">${O(L)==="mixed"?"\u2013":"\u2713"}</span><span class="name">Row ${S(Ee(L))}</span>
1062
+ <span class="meta">${Tt(ht(i,L.labels),L.all?.length??L.labels.length)}</span>
1011
1063
  </button>
1012
- <div class="slm-ch-seatchips">${(x.all??x.labels).map(M=>O(M,x.label)).join("")}</div>
1013
- </div>`).join("")}`,L=!!i.seatListCap,C=i.seatListCap?`<span class="slm-ch-footsum warn" role="alert"><b>That would make ${Ws(i.seatListCap)}</b> One change can take up to ${s.toLocaleString()}. Choose fewer rows or sections.</span>`:`<span class="slm-ch-seatcount slm-ch-footsum" data-ch-seatcount role="status">${t.size?`${t.size.toLocaleString()} selected`:"Nothing selected yet"}</span>`;return i.seatListCap=null,{left:k||'<div class="slm-ch-scope-empty">No seats on this chart.</div>',right:`${m?`<div class="slm-sl-head"><b>${w(m.label)}</b><button type="button" class="slm-btn ghost" data-ch-section="${w(m.id)}">Select every free seat</button></div>
1064
+ <div class="slm-ch-seatchips">${(L.all??L.labels).map(M=>B(M,L.label)).join("")}</div>
1065
+ </div>`).join("")}`,C=!!i.seatListCap,E=i.seatListCap?`<span class="slm-ch-footsum warn" role="alert">${ao(i.seatListCap,s)}</span>`:`<span class="slm-ch-seatcount slm-ch-footsum" data-ch-seatcount role="status">${t.size?`${t.size.toLocaleString()} selected`:"Nothing selected yet"}</span>`;return i.seatListCap=null,{left:u||'<div class="slm-ch-scope-empty">No seats on this chart.</div>',right:`${p?`<div class="slm-sl-head"><b>${S(p.label)}</b><button type="button" class="slm-btn ghost" data-ch-section="${S(p.id)}">Select every free seat</button></div>
1014
1066
  <div class="slm-ch-seatlegend" aria-hidden="true"><span><i class="is-free"></i>free</span><span><i class="is-held"></i>in a cart</span><span><i class="is-booked"></i>sold</span><span><i class="is-blocked"></i>blocked</span></div>`:""}
1015
- <div class="slm-ch-seatlist grid" data-ch-seatlist>${y}</div>`,foot:L?C:`${C}<button type="button" class="slm-btn ghost" data-ch-clear-all ${t.size?"":"disabled"}>Clear</button>`}}function _a(i,e){if(i.seatListSection&&e.some(n=>n.id===i.seatListSection))return i.seatListSection;let t=i.host.selectionLabels()[0],s=t?i.host.sectionOfLabel(t)?.id:null;return s&&e.some(n=>n.id===s)?s:e[0]?.id??null}var ol,rl,ja,Ws,yt,Te,Ga=Y(()=>{"use strict";pe();ol=400,rl=600,ja='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>',Ws=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,yt=(i,e)=>`${i.toLocaleString()} free of ${e.toLocaleString()}`,Te=i=>i.label.startsWith(`${i.sectionLabel} `)?i.label.slice(i.sectionLabel.length+1):i.label});function Ya(i,e,t,s){let n=[];e&&n.push(e),t&&n.push(`${t.toLocaleString()} ${t===1?"seat":"seats"} picked`);let a=[...s?.querySelectorAll('input.slm-input:not([type]), input.slm-input[type="text"], textarea')??[]].find(o=>o.value.trim());a&&n.push(a.dataset.rsv==="name"?"the name you typed":a.dataset.ref==="blockreason"?"the reason you typed":"what you typed"),n.length&&(i.textContent=(i.textContent??"").replace(/ as it was\.$/,` as it was: ${n.join(", ")}.`))}var Xa=Y(()=>{"use strict"});var Za={};rs(Za,{EXTRAS_CSS:()=>ll,addSalePill:()=>Oa,browserAlertStore:()=>Ps,enrichNoSales:()=>Da,eventAlertStore:()=>ha,mountAlerts:()=>da,mountArrival:()=>$a,mountChanges:()=>ka,mountFindBlocked:()=>Xi,mountReserve:()=>Wi,mountSaved:()=>Sa,mountSeatHistory:()=>pa,mountSections:()=>sa,mountTables:()=>na,mountTrendCards:()=>Ta,nameWorkInHand:()=>Ya,openCategory:()=>Va,openEventSearch:()=>_i,openExplainer:()=>Aa,openRows:()=>Ka,openSeatList:()=>Wa,openSimilar:()=>Ba,pickerKeys:()=>Fa,similarLines:()=>js});var ll,Ja=Y(()=>{"use strict";Rs();As();Hs();Is();Os();Ds();zs();Fs();qs();_s();Vs();Us();Rs();As();Hs();Is();Os();Ds();zs();Fs();qs();_s();Vs();qa();Ga();Us();Xa();ll=qi+Ki+Yi+ea+ca+ba+wa+La+Ca+Ha+Pa+za});var ml={};rs(ml,{ACCESS_LINK_DEFAULTS:()=>ut,ChannelsMode:()=>mt,ManageApi:()=>Xe,ManageApiError:()=>G,PUBLIC_CHANNEL_ID:()=>ee,PUBLIC_CHANNEL_NAME:()=>oe,SeatManager:()=>as,accessIntentDescription:()=>fi,accessIntentLabel:()=>Pe,accessLine:()=>Vt,accessLinkBadge:()=>Kt,accessLinkErrorCopy:()=>_e,accessLinkIsLive:()=>Wt,accessLinkPolicyLines:()=>vi,bucketRows:()=>_t,bucketRowsHtml:()=>nt,dropReviewRows:()=>ki,intentForbidsCopy:()=>st,intentSwitchBlockedCopy:()=>Ut,isPublicChannelId:()=>re,markerLetter:()=>Ee,markerOf:()=>Nt,mutationCount:()=>tt,needsMoveConfirmation:()=>gi,planAssignment:()=>qt,retryAfterCopy:()=>jt,selectionSources:()=>Ft,stateBadge:()=>Gt,suggestMarker:()=>ht});module.exports=po(ml);wt();me();Fe();var un={held:["clock","#d99a0b","in a cart"],booked:["bolt","#22a06b","booked"],expired:["x","#94a3b8","cart expired"],released:["x","#94a3b8","left a cart"],cancelled:["undo","#d64545","booking cancelled"],blocked:["ban","#d64545","blocked"],unblocked:["check","#64748b","back on sale"],available:["check","#22a06b","free again"],reserved:["bookmark","#c026d3","reserved"],unreserved:["check","#64748b","back on sale"]};function mn(i){return un[i]?.[2]??i}function hn(i,e=[],t){let s=new Map,n=[];for(let m of i){let v=t?.(m);v?s.set(v,(s.get(v)??0)+1):n.push(m)}let a=[...s].map(([m,v])=>v>1?`${m} \xD7 ${v.toLocaleString()}`:m),o=e.length===1&&!s.has(e[0])?e[0]:"",r=n.map(m=>o&&(m.startsWith(`${o} `)||m.startsWith(`${o}-`))?m.slice(o.length+1):m),l=m=>{let v=m.lastIndexOf("-");return v>0?[m.slice(0,v),m.slice(v+1)]:[m,""]},[c]=l(r[0]??""),d=r.map(m=>l(m)).filter(([m,v])=>m===c&&/^\d+$/.test(v)).map(([,m])=>Number(m)),f=r.length>2&&d.length===r.length&&d.every((m,v)=>v===0||m===d[v-1]+1)?`${r[0]} to ${r[r.length-1]}`:r.length>3?`${r.slice(0,2).join(", ")} and ${r.length-2} more`:r.join(", ");return[o||(e.length>1?`${e.length} sections`:""),[f,...a].filter(Boolean).join(", ")].filter(Boolean).join(" \xB7 ")}var ko={held:"In a cart",booked:"Booked",expired:"Hold expired",released:"Hold released",cancelled:"Booking cancelled",blocked:"Blocked",unblocked:"Back on sale",available:"Available again",reserved:"Reserved",unreserved:"Back on sale"},Ct=class{constructor(e,t,s,n=()=>{}){this.host=e;this.locate=s;this.name=n;this.items=[];this.shown=new Set;this.paused=!1;this.limit=100;this.signature="unrendered";this.abort=new AbortController;this.verbs=null;e.innerHTML='<button class="slm-new-activity" hidden></button><div class="slm-activity-list" role="region" aria-label="Recent activity" tabindex="0"></div><button class="slm-more-activity" hidden>Show more activity</button>',this.list=e.querySelector(".slm-activity-list"),this.newer=e.querySelector(".slm-new-activity"),this.more=e.querySelector(".slm-more-activity");let a={signal:this.abort.signal},o=()=>{this.paused=!1,this.signature="unrendered",this.list.scrollTop=0,this.render()};this.list.addEventListener("scroll",()=>{this.list.scrollTop>24&&(this.paused=!0)},a),this.list.addEventListener("focusin",()=>{this.paused=!0},a),this.list.addEventListener("toggle",r=>{r.target.open&&(this.paused=!0)},{...a,capture:!0}),this.newer.addEventListener("click",o,a),this.more.addEventListener("click",()=>{this.limit=200,this.signature="unrendered",this.render(!0)},a)}update(e){this.items=e,this.render()}setFilter(e){String(e)!==String(this.verbs)&&(this.verbs=e,this.signature="unrendered",this.render(!0))}render(e=!1){let t=this.verbs?this.items.filter(o=>this.verbs.includes(o.verb)):this.items,s=t.filter(o=>!this.shown.has(o.id)).length;if(this.newer.hidden=!this.paused,this.newer.textContent=s?`${s} new activit${s===1?"y":"ies"} \xB7 Back to live`:"Reading earlier activity \xB7 Back to live",this.paused&&!e)return;let n=t.slice(0,this.limit),a=n.map(o=>`${o.id}:${o.verb}`).join("|");if(a!==this.signature){if(this.signature=a,this.shown=new Set(t.map(o=>o.id)),this.list.replaceChildren(),!n.length){let o=document.createElement("p");o.className="slm-activity-empty",this.items.length?o.textContent=this.verbs?.includes("booked")?"No sales in the feed yet.":this.verbs?"No carts in the feed yet.":"No activity matches these filters.":o.innerHTML=`${J("bolt","#22a06b",36)}<b>Quiet so far</b>Bookings, carts and changes appear here as they happen.`,this.list.append(o)}for(let o of n){let r=document.createElement("article");r.className="slm-activity-entry",r.dataset.status=o.status;let l=document.createElement("button");l.type="button",l.className="slm-activity-row";let c=`${ko[o.verb]??o.verb} \xB7 ${o.count} seat${o.count===1?"":"s"} \xB7 ${o.sectionLabels?.join(", ")||"Event inventory"} \xB7 ${hn(o.labels,[],this.name)} \xB7 ${W(o.at,{dateStyle:"medium",timeStyle:"short"})}`;l.title=`${c} \u2014 click to show seats on the map`,l.setAttribute("aria-label",`Show seats on map: ${c}`),l.addEventListener("click",()=>this.locate(o.id));let d=document.createElement("time");d.dateTime=new Date(o.at).toISOString(),d.textContent=W(o.at,{hour:"2-digit",minute:"2-digit"},[]);let[b,f,u]=un[o.verb]??["info","#64748b",o.verb],m=document.createElement("span");m.className="slm-activity-text";let v=document.createElement("b");v.textContent=`${o.count.toLocaleString()} ${o.count===1?"seat":"seats"} ${u}`;let $=document.createElement("span");$.className="slm-activity-seats",$.textContent=hn(o.labels,o.sectionLabels,this.name),m.append(v,$),l.insertAdjacentHTML("afterbegin",J(b,f,24)),l.append(m,d),r.append(l),this.list.append(r)}this.more.hidden=t.length<=this.limit}}destroy(){this.abort.abort()}};Fe();var wo=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318Z":"Ctrl Z",Mt=class{constructor(e){this.host=e;this.moving=!1;this.tool="select";this.space=!1;this.abort=new AbortController;let t=document.createElement("div");t.className="slm-navigation";let s=(o,r,l,c,d)=>`<button type="button" data-nav="${o}" aria-label="${l}" aria-pressed="${o==="select"}" title="${c}" aria-keyshortcuts="${d}">${Se(r,"currentColor",18)}</button>`;t.innerHTML=`<div class="slm-navigation-tools" role="group" aria-label="Map tools">
1016
- ${s("select","cursor","Select","Select \xB7 click a seat or drag a box (V)","V")}
1017
- ${s("lasso","lasso","Lasso","Lasso \xB7 draw a loop around seats (L)","L")}
1018
- ${s("move","hand","Move the map","Move the map \xB7 or hold Space","Space")}
1019
- <span class="slm-navigation-rule" aria-hidden="true"></span>
1020
- <button type="button" data-nav="undo" aria-label="Undo selection" title="Undo the last change to the selection (${wo}) \xB7 redo with Shift" aria-keyshortcuts="Meta+Z Control+Z" disabled>${Se("undo","currentColor",18)}</button>
1021
- </div>`,e.map.after(t),this.bar=t,this.undo=t.querySelector('[data-nav="undo"]'),this.location=document.createElement("div"),this.location.className="slm-location",this.location.hidden=!0,this.location.setAttribute("role","status"),e.map.after(this.location);let n={signal:this.abort.signal};t.addEventListener("click",o=>{let r=o.target.closest("[data-nav]")?.dataset.nav;r==="undo"?e.stepSelection(-1):r&&this.choose(r)},n),e.map.addEventListener("pointerdown",()=>{this.location.hidden=!0,e.pauseFollow(),e.root.focus({preventScroll:!0})},{...n,capture:!0}),e.root.querySelector(".slm-rail")?.addEventListener("pointerdown",()=>e.pauseFollow(),{...n,capture:!0}),e.map.addEventListener("wheel",()=>{this.location.hidden=!0,e.pauseFollow()},{...n,passive:!0,capture:!0}),e.root.addEventListener("keydown",o=>{o.target?.closest('input,textarea,select,button,[contenteditable="true"]')||o.code!=="Space"||o.ctrlKey||o.metaKey||o.altKey||(o.preventDefault(),this.space||(this.space=!0,e.pauseFollow(),e.setMoving(!0)))},n);let a=()=>{this.space&&(this.space=!1,e.setMoving(this.moving))};window.addEventListener("keyup",o=>{o.code==="Space"&&a()},n),window.addEventListener("blur",a,n),window.addEventListener("resize",()=>{this.location.hidden=!0},n),e.root.querySelector(".slm-mapchrome")?.addEventListener("click",()=>{this.location.hidden=!0},n),e.root.addEventListener("focusout",o=>{e.root.contains(o.relatedTarget)||a()},n)}choose(e){this.tool=e,this.moving=e==="move",this.host.pauseFollow(),e!=="move"&&this.host.setShape(e==="lasso"?"lasso":"box"),this.host.setMoving(this.moving||this.space),this.bar.querySelectorAll("[aria-pressed]").forEach(t=>t.setAttribute("aria-pressed",String(t.dataset.nav===e)))}resetTool(){this.tool==="move"&&(this.tool="select",this.moving=!1,this.host.setShape("box"),this.host.setMoving(this.space),this.bar.querySelectorAll("[aria-pressed]").forEach(e=>e.setAttribute("aria-pressed",String(e.dataset.nav==="select"))))}update(e){this.bar.querySelector(".slm-navigation-tools").hidden=!e,!e&&this.tool==="move"&&this.choose("select")}historyChanged(e,t){this.undo.disabled=!e}destroy(){this.abort.abort(),this.bar.remove(),this.location.remove()}};function ms(i,e,t){let s=i.findIndex(a=>a.label===e),n=i.findIndex(a=>a.label===t);return s<0||n<0?[]:i.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.label)}function So(i,e){let t=1/0;for(let s=0;s<e.length;s++){let n=e[s],a=e[(s+1)%e.length],o=a.x-n.x,r=a.y-n.y,l=o||r?Math.max(0,Math.min(1,((i.x-n.x)*o+(i.y-n.y)*r)/(o*o+r*r))):0;t=Math.min(t,Math.hypot(i.x-(n.x+l*o),i.y-(n.y+l*r)))}return t}function pn(i,e,t,s=6){let n=null;for(let a of e){if(a.state==="inactive"||a.outline.length<3)continue;let o=So(i,a.outline.map(t));o<=s&&(!n||o<n.d)&&(n={id:a.id,d:o})}return n?.id??null}var U=require("@seatlayer/core");Rt();var Co=/^[a-zA-Z0-9._-]+$/;function Mo(i){let e;try{e=new URL(i,"https://seatlayer.invalid")}catch{return null}if(e.search||e.hash)return null;let t=/^\/v1\/events\/([^/]+)\/assets\/([^/]+)$/.exec(e.pathname);if(!t)return null;try{let s=decodeURIComponent(t[1]),n=decodeURIComponent(t[2]);return!s||!Co.test(n)?null:{eventKey:s,asset:n}}catch{return null}}function Eo(i){try{return/^\/v1\/events\/[^/]+\/assets(?:\/|$)/.test(new URL(i,"https://seatlayer.invalid").pathname)}catch{return!1}}var At=class{constructor(e,t){this.eventKey=e;this.load=t;this.pending=new Map;this.created=new Set;this.disposed=!1}resolve(e){let t=Mo(e);if(!t)return Promise.resolve(Eo(e)?null:e);if(t.eventKey!==this.eventKey||this.disposed)return Promise.resolve(null);let s=`${t.eventKey}/${t.asset}`,n=this.pending.get(s);if(n)return n;let a=this.load(t.eventKey,t.asset).then(o=>{let r=URL.createObjectURL(o);return this.disposed?(URL.revokeObjectURL(r),null):(this.created.add(r),r)}).catch(o=>{throw this.pending.delete(s),o});return this.pending.set(s,a),a}async prepareRendererChart(e){let t=async a=>{if(!a?.url)return;let o=await this.resolve(a.url);if(!o)throw new Error("organizer_event_asset_scope_mismatch");a.url=o},s=async a=>{for(let o of a){if(o.type!=="decorImage")continue;let r=o,l=await this.resolve(r.href);if(!l)throw new Error("organizer_event_asset_scope_mismatch");r.href=l}},n=async a=>{await t(a.backgroundImage),await s(a.objects)};await n(e);for(let a of e.floors??[])await n(a);return e}dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.created)URL.revokeObjectURL(e);this.created.clear(),this.pending.clear()}}};wt();function yn(i,e,t,s={}){let n=s.previous?null:document.activeElement??null;s.previous?.scrim.remove();let a=document.createElement("div");a.className="slm-ch-scrim",a.innerHTML=`<div class="slm-ch-dialog" role="dialog" aria-modal="true"
1022
- aria-labelledby="slm-ch-dlg-title" tabindex="-1">${e}</div>`,i.appendChild(a);let o=a.firstElementChild,r=!1,l={scrim:a,dialog:o,close:({restoreFocus:d=!0}={})=>{r||(r=!0,a.remove(),d&&(n?.isConnected&&i.contains(n)?n:i).focus?.({preventScroll:!0}),s.onClose?.())}};return o.querySelectorAll("[data-ch-close]").forEach(d=>{d.addEventListener("click",()=>l.close())}),a.addEventListener("keydown",d=>{if(d.key==="Escape"){d.stopPropagation(),l.close();return}if(d.key!=="Tab")return;let b=[...o.querySelectorAll('summary,button:not([disabled]),select:not([hidden]),input,textarea,a[href],[tabindex]:not([tabindex="-1"])')];if(!b.length)return;let f=b[0],u=b[b.length-1];d.shiftKey&&document.activeElement===f?(d.preventDefault(),u.focus()):!d.shiftKey&&document.activeElement===u&&(d.preventDefault(),f.focus())}),t(o),Ke(o),(o.querySelector("input,summary,button")??o).focus(),l}var xn=`
1023
- .slm{--slm-ch-scrim:rgba(0,0,0,.58)}
1024
- .slm[data-theme=light]{--slm-ch-scrim:rgba(23,32,51,.42)}
1025
- .slm-ch-scrim{position:absolute;inset:0;z-index:12;background:var(--slm-ch-scrim);display:grid;place-items:center;
1026
- padding:18px;animation:slm-ch-fade var(--slm-mo-quick) var(--slm-mo-out)}
1027
- .slm-ch-dialog{width:min(460px,100%);max-height:100%;overflow:auto;overscroll-behavior:contain;background:var(--slm-surface);color:var(--slm-text);border:1px solid var(--slm-line);
1028
- border-radius:14px;padding:20px;box-shadow:0 24px 70px rgba(0,0,0,.6);
1029
- animation:slm-ch-rise var(--slm-mo-base) var(--slm-mo-out)}
1030
- .slm-ch-dialog h3{margin:0 0 4px;font-size:16px;font-weight:800;letter-spacing:-.01em}
1031
- .slm-ch-dialog .sub{font-size:12.5px;color:var(--slm-muted);line-height:1.5;margin-bottom:14px}
1032
- .slm-ch-dialog .foot{display:flex;gap:8px;margin-top:16px}
1033
- .slm-ch-dialog .foot .slm-btn{flex:1;min-width:0}
1034
- .slm-ch-dialog .foot .quiet{flex:none;padding:10px 14px;min-height:44px;color:var(--slm-muted);font-weight:700;font-size:13px}
1035
- @keyframes slm-ch-fade{from{opacity:0}to{opacity:1}}
1036
- @keyframes slm-ch-rise{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}
1037
- .slm-ch-err{color:var(--slm-text);font-size:11.5px;margin-top:6px}
1067
+ <div class="slm-ch-seatlist grid" data-ch-seatlist>${v}</div>`,foot:C?E:`${E}<button type="button" class="slm-btn ghost" data-ch-clear-all ${t.size?"":"disabled"}>Clear</button>`}}function eo(i,e){if(i.seatListSection&&e.some(n=>n.id===i.seatListSection))return i.seatListSection;let t=i.host.selectionLabels()[0],s=t?i.host.sectionOfLabel(t)?.id:null;return s&&e.some(n=>n.id===s)?s:e[0]?.id??null}var Al,Hl,to,Il,so,Tt,an,ht,no,Ee,ao,co,on=Y(()=>{"use strict";ge();Al=400,Hl=600,to='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>',Il='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3 2 21h20L12 3z"/><path d="M12 10v5M12 18h.01"/></svg>',so=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,Tt=(i,e)=>`${i.toLocaleString()} free of ${e.toLocaleString()}`,an=(i,e)=>e.filter(t=>(i.host.statusOf(t)??"free")==="free"),ht=(i,e)=>an(i,e).length,no=i=>`${i.toLocaleString()} free ${i===1?"seat":"seats"}`,Ee=i=>i.label.startsWith(`${i.sectionLabel} `)?i.label.slice(i.sectionLabel.length+1):i.label;ao=(i,e)=>`${Il}<span><b>That would make ${so(i)}</b> One change can take up to ${e.toLocaleString()}. Choose fewer rows or sections.</span>`;co=`
1038
1068
  .slm-ch-seatlist{max-height:44vh;overflow:auto;overscroll-behavior:contain;border:1px solid var(--slm-line);
1039
1069
  border-radius:10px;background:var(--slm-surface);margin-top:10px}
1040
1070
  .slm-ch-seatgroup{padding:8px 10px;border-bottom:1px solid var(--slm-line);display:flex;align-items:center;
@@ -1094,7 +1124,9 @@
1094
1124
  .slm-ch-groupcheck .meta{min-width:0;margin-left:auto;color:var(--slm-muted);font-size:10.5px;font-weight:600;white-space:nowrap}
1095
1125
  /* Board CR20: pickers whose footer says what will be added; names wrap, never cut. */
1096
1126
  .slm-ch-dialog .foot .slm-ch-footsum{flex:1;min-width:0;align-self:center;font-size:12.5px;font-weight:600;color:var(--slm-text)}
1097
- .slm-ch-dialog .foot .slm-ch-footsum.warn{color:color-mix(in srgb,#b45309 75%,var(--slm-text))}
1127
+ .slm-ch-dialog .foot .slm-ch-footsum.warn{display:flex;gap:8px;align-items:flex-start;padding:8px 10px;border-radius:8px;font-weight:500;color:color-mix(in srgb,#b45309 75%,var(--slm-text));background:color-mix(in srgb,#f59e0b 12%,transparent);border:1px solid color-mix(in srgb,#f59e0b 40%,transparent)}
1128
+ .slm-ch-footsum.warn svg{flex:none;margin-top:1px}.slm-ch-footsum.warn b{display:block;font-weight:700}
1129
+ .slm-ch-dialog .foot .slm-btn.slm-ch-close{flex:none;margin-left:auto;min-width:0;min-height:0;padding:7px 14px;font-size:12.5px;border-radius:8px}
1098
1130
  .slm-ch-dialog:has(.slm-ch-footsum) .foot .slm-btn{flex:none;min-width:110px}
1099
1131
  .slm-ch-findbox{margin:0 0 10px}.slm-ch-findbox .slm-input{width:100%;min-height:38px}
1100
1132
  .slm-ch-seatitem .name{flex:1;min-width:0}.slm-ch-seatitem .meta{white-space:nowrap}
@@ -1105,16 +1137,6 @@
1105
1137
  .slm-ch-scoperows .slm-ch-seatitem{padding-left:34px}
1106
1138
  .slm-ch-scope-empty{padding:18px 12px;color:var(--slm-muted);font-size:12.5px;line-height:1.5;text-align:center}
1107
1139
  .slm-ch-scope-empty b{display:block;margin-bottom:4px;color:var(--slm-text);font-size:14px}
1108
- .slm-ch-secmenu{position:absolute;left:0;top:calc(100% + 6px);z-index:40;width:280px;max-height:360px;overflow:auto;padding:6px;border-radius:14px;
1109
- border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 12px 32px rgba(12,18,32,.18)}
1110
- .slm-ch-menuhead{margin:0;padding:6px 10px;font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted)}
1111
- .slm .slm-ch-secmenu button{display:flex;align-items:flex-start;gap:9px;width:100%;padding:8px 10px;border-radius:9px;text-align:left}
1112
- .slm .slm-ch-secmenu button:hover,.slm .slm-ch-secmenu button:focus-visible{background:var(--slm-tint);outline:none}
1113
- .slm-ch-secmenu button:disabled{opacity:.5;cursor:not-allowed}
1114
- .slm-ch-secmenu .dot,.slm-sl-section .dot{width:9px;height:9px;border-radius:50%;margin-top:4px;flex:none}
1115
- .slm-ch-secmenu b,.slm-sl-section b{display:block;font-size:13px;font-weight:600}
1116
- .slm-ch-secmenu small,.slm-sl-section small{display:block;font-size:11.5px;color:var(--slm-muted)}
1117
- .slm-ch-menuerr{margin:4px 10px;font-size:11.5px;color:color-mix(in srgb,#b45309 75%,var(--slm-text))}
1118
1140
  /* A column whose list gives way, so in a short room the count, Clear and Done
1119
1141
  stay in view and the list scrolls, rather than the whole dialog. */
1120
1142
  .slm-ch-dialog:has(.slm-sl-grid){width:min(640px,100%);display:flex;flex-direction:column}
@@ -1126,7 +1148,7 @@
1126
1148
  .slm .slm-sl-section.on{background:color-mix(in srgb,var(--slm-accent) 14%,transparent)}
1127
1149
  .slm-sl-section svg{margin-left:auto;align-self:center;color:var(--slm-muted);flex:none}
1128
1150
  .slm-sl-rows{display:flex;flex-direction:column;min-height:0;padding:12px 18px 0}
1129
- .slm-sl-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}.slm-sl-head b{flex:1;min-width:0;font-size:14px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1151
+ .slm-sl-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}.slm-sl-head b{flex:1;min-width:0;font-size:14px;font-weight:700;overflow-wrap:anywhere}
1130
1152
  .slm .slm-sl-head .slm-btn{flex:none;min-width:0;padding:6px 11px;font-size:12px}
1131
1153
  .slm-sl-rows .slm-ch-seatlegend{margin-bottom:6px}
1132
1154
  .slm-sl-rows .slm-ch-seatlist.grid{flex:1;max-height:none;border:0;border-radius:0;margin:0;overflow:auto}
@@ -1135,8 +1157,13 @@
1135
1157
  .slm-sl-note{margin:0 0 6px;font-size:12px;color:var(--slm-muted)}
1136
1158
  .slm .slm-ch-seatchip:disabled{opacity:.55;cursor:not-allowed}
1137
1159
  @media(max-width:620px){.slm-sl-grid{grid-template-columns:1fr;grid-template-rows:minmax(0,2fr) minmax(0,3fr);height:auto}.slm-sl-sections{border-right:0;border-bottom:1px solid var(--slm-line)}}
1138
- @media (prefers-reduced-motion:reduce){.slm-ch-scrim,.slm-ch-dialog{animation:none!important}}
1139
- `;Fe();pe();function bs(){return'<div class="slm-opening" data-ref="opening" role="status"><span class="slm-opening-spin" aria-hidden="true"></span><b>Opening the Control room\u2026</b><span>Loading the seats and their live state</span></div>'}function gs(){let i=(e,t=12)=>`<span class="slm-skel" style="width:${e}px;height:${t}px"></span>`;return`<div class="slm-railskel" aria-hidden="true">${i(140,16)}${i(280)}${i(240)}<span class="slm-skel" style="width:100%;height:120px;border-radius:14px"></span>${i(200)}${i(280)}${i(260)}</div>`}var Ro={offline:{glyph:"alert",hue:"#d64545",title:"The Control room couldn't open",body:"We could not reach SeatLayer. Check the connection; nothing about the event has changed.",action:"Try again"},access:{glyph:"lock",hue:"#3b82f6",title:"You don't have access to this room",body:'Your role can see the event but not its Control room. Ask an admin for "View the Control room".',action:null},missing:{glyph:"alert",hue:"#d64545",title:"This event is not here",body:"It may have been removed, or the link points at another event. Nothing was changed.",action:null},signedout:{glyph:"user",hue:"#0ea5a5",title:"You were signed out",body:"For your security the session ended. Sign in again and the room comes back as it was.",action:"Sign in again"}};function kn(i,e){let t=Ro[i],s=i==="access"&&e?.trim()?t.body.replace("Your role can",`Your role in ${e.trim()} can`):t.body;return`<div class="slm-roomcard" data-ref="roomcard" data-kind="${i}"><div role="alertdialog" aria-labelledby="slm-roomcard-title">${J(t.glyph,t.hue,44)}<b id="slm-roomcard-title">${t.title}</b><p>${w(s)}</p>${t.action?`<button type="button" class="slm-btn" data-roomcard-act>${t.action}</button>`:""}</div></div>`}function wn(i){return i==="live"?"":i==="paused"?'<div class="slm-connbanner warn" role="status"><span>Live updates paused. Reconnecting\u2026 The map and numbers may be up to 30 s old. Anything you change is kept.</span></div>':`<div class="slm-connbanner err" role="alert"><span>Couldn't reconnect for 2 minutes. The map may be out of date; changes can't be saved until it's back.</span><button type="button" data-conn-retry>Try now</button></div>`}function Sn(i,e,t){return`<b>${w(i)}${e?` \xB7 ${w(e)}`:""}</b>`+(t?`<span class="slm-fsline-counts">${t.booked.toLocaleString()} sold \xB7 ${t.held.toLocaleString()} in carts \xB7 ${t.free.toLocaleString()} free</span>`:"")+'<span class="slm-fsline-gap"></span><button type="button" class="slm-btn ghost" data-fs-exit>Exit full screen</button><kbd>esc</kbd>'}function Ln(i){return`<div class="slm-nosales">${J("bolt","#22a06b",40)}<b>No sales yet</b><p>The first booking shows here the moment it happens.</p></div>`+(i?`<p class="slm-nosales-viewers">${i.toLocaleString()} ${i===1?"person is":"people are"} looking at the seat map right now.</p>`:"")}var $n=`
1160
+ `});function Pl(){if(rn!==void 0)return rn;let i=document.createElement("canvas");i.width=i.height=8;let e=null;try{e=i.getContext("2d")}catch{}return e&&(e.strokeStyle="rgba(138,148,166,.45)",e.lineWidth=1.5,e.beginPath(),e.moveTo(-2,10),e.lineTo(10,-2),e.moveTo(-2,2),e.lineTo(2,-2),e.moveTo(6,10),e.lineTo(10,6),e.stroke()),rn=e&&i}function ho(i,e,t){let s=i;s.bgLayer?.on("beforeDraw",()=>{for(let n of s.sections??[]){let a=e.get(n.logicalId),o=n.blockPoly,r=a?.hatch?Pl():null;if(o.fillPriority(r?"pattern":"color"),!a)continue;if(a.solid&&o.fill(t()?"#4b5563":"#9ca3af"),r){let d=1/(o.getAbsoluteScale().x||1);o.fillPatternImage(r),o.fillPatternScale({x:d,y:d})}let l=n.nameLabel,c=n.subLabel;n.nameLabelFits&&(c.text()!==a.caption&&c.text(a.caption),c.fontSize(l.fontSize()*.72),c.offsetX(c.width()/2),c.position({x:l.x(),y:l.y()+l.height()*.6}),c.fill(l.fill()),c.opacity(l.opacity()))}}),s.bgLayer?.batchDraw()}var rn,uo=Y(()=>{"use strict"});function ln(i,e){let t=[...new Set(i.values())].sort((n,a)=>n-a),s=e?Bl:Ol;return Object.fromEntries([...i].map(([n,a])=>[n,s[t.length<2?2:Math.round(t.indexOf(a)*4/(t.length-1))]]))}function po(i,e,t,s){let n=ln(i,t),a=new Map;for(let o of e){let r=i.get(o.key);if(r===void 0)continue;let l=a.get(r)??{label:s(r),color:n[o.key],free:0,key:`price:${r}`};l.free+=o.free,a.set(r,l)}return[...a].sort((o,r)=>o[0]-r[0]).map(([,o])=>o)}var Bl,Ol,mo=Y(()=>{"use strict";Bl=["#bfd3ff","#8db0fa","#5f88ee","#3a62d2","#1f43a8"],Ol=["#23355c","#2e4f95","#3f6bdb","#6f98f5","#b5ccff"]});function bo(i){i.addEventListener("keydown",e=>{let t=e.target.closest?.(go);if(!t||!i.contains(t)||e.altKey||e.metaKey||e.ctrlKey||e.shiftKey)return;if(e.key==="Enter"){let n=i.querySelector("[data-ch-add-scope]")??i.querySelector(".slm-ch-seatfoot [data-ch-close]");if(n?.disabled){e.preventDefault();return}n&&(e.preventDefault(),n.click());return}let s=Dl(i,t,e.key);s&&(e.preventDefault(),s.focus(),s.scrollIntoView?.({block:"nearest"}))})}function Dl(i,e,t){let s=(b,m,p,f)=>t===f?b[m+1]??null:t===p?b[m-1]??null:t==="Home"?b[0]??null:t==="End"?b[b.length-1]??null:null,n=e.closest(".slm-sl-row");if(!n){if(e.matches(".slm-sl-section")&&t==="ArrowRight")return[...i.querySelectorAll(".slm-sl-rows .slm-ch-rowcheck, .slm-sl-rows .slm-ch-seatchip")].find(cs)??null;let b=[...(e.parentElement?.closest(".slm-sl-sections, .slm-ch-seatlist")??e.parentElement).querySelectorAll(go)].filter(cs);return s(b,b.indexOf(e),"ArrowUp","ArrowDown")}let a=b=>[...b.querySelectorAll(".slm-ch-seatchip")].filter(cs),o=b=>{let m=b.querySelector(".slm-ch-rowcheck");return cs(m)?m:null},r=b=>[o(b),...a(b)].filter(m=>!!m),l=r(n),c=l.indexOf(e);if(t==="ArrowLeft"&&c===0)return i.querySelector(".slm-sl-section.on");if(t!=="ArrowUp"&&t!=="ArrowDown")return s(l,c,"ArrowLeft","ArrowRight");let d=[...n.parentElement.querySelectorAll(".slm-sl-row")],g=t==="ArrowDown"?1:-1;for(let b=d.indexOf(n)+g;b>=0&&b<d.length;b+=g){let m=r(d[b]),p=a(d[b]);if(!m.length)continue;if(e.matches(".slm-ch-rowcheck")||!p.length)return o(d[b])??m[0];let f=e.getBoundingClientRect().left;return f?p.reduce((k,A)=>Math.abs(A.getBoundingClientRect().left-f)<Math.abs(k.getBoundingClientRect().left-f)?A:k):p[Math.min(Math.max(0,a(n).indexOf(e)),p.length-1)]}return null}var go,cs,fo=Y(()=>{"use strict";go=".slm-ch-seatchip, .slm-ch-rowcheck, .slm-ch-seatitem, .slm-ch-groupcheck, .slm-sl-section",cs=i=>!!i&&!i.disabled});function vo(i,e,t,s){let n=[];e&&n.push(e),t&&n.push(`${t.toLocaleString()} ${t===1?"seat":"seats"} picked`);let a=[...s?.querySelectorAll('input.slm-input:not([type]), input.slm-input[type="text"], textarea')??[]].find(o=>o.value.trim());a&&n.push(a.dataset.rsv==="name"?"the name you typed":a.dataset.ref==="blockreason"?"the reason you typed":"what you typed"),n.length&&(i.textContent=(i.textContent??"").replace(/ as it was\.$/,` as it was: ${n.join(", ")}.`))}var yo=Y(()=>{"use strict"});function xo(i,e,t,s){return s?["warn",`${cn(i.length)} ${i.length===1?"was":"were"} sold while you chose`,` ${cn(e)} moved to ${t}. ${He(i)} keep${i.length===1?"s its":" their"} price.`]:["warn",`${cn(i.length)} could not move`,` They changed while you chose. The other ${e.toLocaleString()} now sell as ${t}.`]}function wo(i){return["info","You can look, not change",` Your role can view ticket types. ${gt(i)} for "Manage ticket types".`,"lock"]}function So(i){return["You can look, not change",` Your role can see blocked seats. ${gt(i)} for "Block seats".`]}async function Lo(i,e,t){let s=new Map;for(let n of i){let a=e.get(n);a&&s.set(a,[...s.get(a)??[],n])}for(let[n,a]of s)await t(a,n)}var cn,ko,$o=Y(()=>{"use strict";nt();cn=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`;ko=["error","Couldn\u2019t move the seats"," The connection dropped before the change was saved. Nothing changed for buyers."]});var Co={};ps(Co,{EXTRAS_CSS:()=>zl,TYPES_FAILED:()=>ko,addSalePill:()=>Za,blockRefused:()=>So,browserAlertStore:()=>Ks,enrichNoSales:()=>Ja,eventAlertStore:()=>Ca,mountAlerts:()=>$a,mountArrival:()=>Na,mountChanges:()=>Oa,mountFindBlocked:()=>ha,mountReserve:()=>la,mountSaved:()=>za,mountSeatHistory:()=>Ea,mountSections:()=>va,mountTables:()=>ya,mountTrendCards:()=>qa,nameWorkInHand:()=>vo,openCategory:()=>io,openEventSearch:()=>sa,openExplainer:()=>Ka,openManagerDialog:()=>Pn,openRows:()=>ro,openSeatList:()=>lo,openSimilar:()=>Ya,paintBlockCaptions:()=>ho,pickerKeys:()=>bo,priceChips:()=>po,priceShades:()=>ln,similarLines:()=>en,typesLocked:()=>wo,typesPartly:()=>xo,undoTypes:()=>Lo});var zl,To=Y(()=>{"use strict";qs();is();_s();js();Ws();Gs();Ys();Zs();Js();Qs();tn();sn();on();qs();is();_s();js();Ws();Gs();uo();Ys();Zs();Js();Qs();tn();mo();ws();fo();on();sn();yo();$o();zl=ta+ra+da+ba+La+Ra+Da+Fa+_a+Wa+Xa+Qa+co});var Vl={};ps(Vl,{ACCESS_LINK_DEFAULTS:()=>ft,ChannelsMode:()=>vt,ManageApi:()=>et,ManageApiError:()=>W,PUBLIC_CHANNEL_ID:()=>se,PUBLIC_CHANNEL_NAME:()=>le,SeatManager:()=>hs,accessIntentDescription:()=>Ii,accessIntentLabel:()=>Fe,accessLine:()=>Yt,accessLinkBadge:()=>Zt,accessLinkErrorCopy:()=>Ue,accessLinkIsLive:()=>Jt,accessLinkPolicyLines:()=>Pi,bucketRows:()=>Wt,bucketRowsHtml:()=>ot,dropReviewRows:()=>Di,intentForbidsCopy:()=>at,intentSwitchBlockedCopy:()=>Xt,isPublicChannelId:()=>ce,markerLetter:()=>Ie,markerOf:()=>Vt,mutationCount:()=>it,needsMoveConfirmation:()=>Hi,planAssignment:()=>Kt,retryAfterCopy:()=>Gt,selectionSources:()=>Ut,stateBadge:()=>Qt,suggestMarker:()=>bt});module.exports=_o(Vl);Mt();me();Ve();var Tn={held:["clock","#d99a0b","in a cart"],booked:["bolt","#22a06b","booked"],expired:["x","#94a3b8","expired"],released:["x","#94a3b8","left a cart"],cancelled:["undo","#d64545","booking cancelled"],blocked:["ban","#d64545","blocked"],unblocked:["check","#64748b","back on sale"],available:["check","#22a06b","free again"],reserved:["bookmark","#c026d3","reserved"],unreserved:["check","#64748b","back on sale"]};function Mn(i){return Tn[i]?.[2]??i}function Cn(i,e=[],t){let s=new Map,n=[];for(let p of i){let f=t?.(p);f?s.set(f,(s.get(f)??0)+1):n.push(p)}let a=[...s].map(([p,f])=>f>1?`${p} \xD7 ${f.toLocaleString()}`:p),o=e.length===1&&!s.has(e[0])?e[0]:"",r=n.map(p=>o&&(p.startsWith(`${o} `)||p.startsWith(`${o}-`))?p.slice(o.length+1):p),l=p=>{let f=p.lastIndexOf("-");return f>0?[p.slice(0,f),p.slice(f+1)]:[p,""]},[c]=l(r[0]??""),d=r.map(p=>l(p)).filter(([p,f])=>p===c&&/^\d+$/.test(f)).map(([,p])=>Number(p)),b=r.length>2&&d.length===r.length&&d.every((p,f)=>f===0||p===d[f-1]+1)?`${r[0]} to ${r[r.length-1]}`:r.length>3?`${r.slice(0,2).join(", ")} and ${r.length-2} more`:r.join(", ");return[o||(e.length>1?`${e.length} sections`:""),[b,...a].filter(Boolean).join(", ")].filter(Boolean).join(" \xB7 ")}var Yo={held:"In a cart",booked:"Booked",expired:"Hold expired",released:"Hold released",cancelled:"Booking cancelled",blocked:"Blocked",unblocked:"Back on sale",available:"Available again",reserved:"Reserved",unreserved:"Back on sale"},Ht=class{constructor(e,t,s,n=()=>{}){this.host=e;this.locate=s;this.name=n;this.items=[];this.shown=new Set;this.paused=!1;this.limit=100;this.signature="unrendered";this.abort=new AbortController;this.verbs=null;e.innerHTML='<button class="slm-new-activity" hidden></button><div class="slm-activity-list" role="region" aria-label="Recent activity" tabindex="0"></div><button class="slm-more-activity" hidden>Show more activity</button>',this.list=e.querySelector(".slm-activity-list"),this.newer=e.querySelector(".slm-new-activity"),this.more=e.querySelector(".slm-more-activity");let a={signal:this.abort.signal},o=()=>{this.paused=!1,this.signature="unrendered",this.list.scrollTop=0,this.render()};this.list.addEventListener("scroll",()=>{this.list.scrollTop>24&&(this.paused=!0)},a),this.list.addEventListener("focusin",()=>{this.paused=!0},a),this.list.addEventListener("toggle",r=>{r.target.open&&(this.paused=!0)},{...a,capture:!0}),this.newer.addEventListener("click",o,a),this.more.addEventListener("click",()=>{this.limit=200,this.signature="unrendered",this.render(!0)},a)}update(e){this.items=e,this.render()}setFilter(e){String(e)!==String(this.verbs)&&(this.verbs=e,this.signature="unrendered",this.render(!0))}render(e=!1){let t=this.verbs?this.items.filter(o=>this.verbs.includes(o.verb)):this.items,s=t.filter(o=>!this.shown.has(o.id)).length;if(this.newer.hidden=!this.paused,this.newer.textContent=s?`${s} new activit${s===1?"y":"ies"} \xB7 Back to live`:"Reading earlier activity \xB7 Back to live",this.paused&&!e)return;let n=t.slice(0,this.limit),a=n.map(o=>`${o.id}:${o.verb}`).join("|");if(a!==this.signature){if(this.signature=a,this.shown=new Set(t.map(o=>o.id)),this.list.replaceChildren(),!n.length){let o=document.createElement("p");o.className="slm-activity-empty",this.items.length?o.textContent=this.verbs?.includes("booked")?"No sales in the feed yet.":this.verbs?"No carts in the feed yet.":"No activity matches these filters.":o.innerHTML=`${Z("bolt","#22a06b",36)}<b>Quiet so far</b>Bookings, carts and changes appear here as they happen.`,this.list.append(o)}for(let o of n){let r=document.createElement("article");r.className="slm-activity-entry",r.dataset.status=o.status;let l=document.createElement("button");l.type="button",l.className="slm-activity-row";let c=`${Yo[o.verb]??o.verb} \xB7 ${o.count} seat${o.count===1?"":"s"} \xB7 ${o.sectionLabels?.join(", ")||"Event inventory"} \xB7 ${Cn(o.labels,[],this.name)} \xB7 ${K(o.at,{dateStyle:"medium",timeStyle:"short"})}`;l.title=`${c} \u2014 click to show seats on the map`,l.setAttribute("aria-label",`Show seats on map: ${c}`),l.addEventListener("click",()=>this.locate(o.id));let d=document.createElement("time");d.dateTime=new Date(o.at).toISOString(),d.textContent=K(o.at,{hour:"2-digit",minute:"2-digit"},[]);let[g,b,m]=Tn[o.verb]??["info","#64748b",o.verb],p=document.createElement("span");p.className="slm-activity-text";let f=document.createElement("b");f.textContent=`${o.count.toLocaleString()} ${o.count===1?"seat":"seats"} ${m}`;let k=document.createElement("span");k.className="slm-activity-seats",k.textContent=Cn(o.labels,o.sectionLabels,this.name),p.append(f,k),l.insertAdjacentHTML("afterbegin",Z(g,b,24)),l.append(p,d),r.append(l),this.list.append(r)}this.more.hidden=t.length<=this.limit}}destroy(){this.abort.abort()}};Ve();var Xo=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318Z":"Ctrl Z",It=class{constructor(e){this.host=e;this.moving=!1;this.tool="select";this.space=!1;this.abort=new AbortController;let t=document.createElement("div");t.className="slm-navigation";let s=(o,r,l,c,d)=>`<button type="button" data-nav="${o}" aria-label="${l}" aria-pressed="${o==="select"}" title="${c}" aria-keyshortcuts="${d}">${be(r,"currentColor",18)}</button>`;t.innerHTML=`<div class="slm-navigation-tools" role="group" aria-label="Map tools">
1161
+ ${s("select","cursor","Select","Select \xB7 click a seat or drag a box (V)","V")}
1162
+ ${s("lasso","lasso","Lasso","Lasso \xB7 draw a loop around seats (L)","L")}
1163
+ ${s("move","hand","Move the map","Move the map \xB7 or hold Space","Space")}
1164
+ <span class="slm-navigation-rule" aria-hidden="true"></span>
1165
+ <button type="button" data-nav="undo" aria-label="Undo selection" title="Undo the last change to the selection (${Xo}) \xB7 redo with Shift" aria-keyshortcuts="Meta+Z Control+Z" disabled>${be("undo","currentColor",18)}</button>
1166
+ </div>`,e.map.after(t),this.bar=t,this.undo=t.querySelector('[data-nav="undo"]'),this.location=document.createElement("div"),this.location.className="slm-location",this.location.hidden=!0,this.location.setAttribute("role","status"),e.map.after(this.location);let n={signal:this.abort.signal};t.addEventListener("click",o=>{let r=o.target.closest("[data-nav]")?.dataset.nav;r==="undo"?e.stepSelection(-1):r&&this.choose(r)},n),e.map.addEventListener("pointerdown",()=>{this.location.hidden=!0,e.pauseFollow(),e.root.focus({preventScroll:!0})},{...n,capture:!0}),e.root.querySelector(".slm-rail")?.addEventListener("pointerdown",()=>e.pauseFollow(),{...n,capture:!0}),e.map.addEventListener("wheel",()=>{this.location.hidden=!0,e.pauseFollow()},{...n,passive:!0,capture:!0}),e.root.addEventListener("keydown",o=>{o.target?.closest('input,textarea,select,button,[contenteditable="true"]')||o.code!=="Space"||o.ctrlKey||o.metaKey||o.altKey||(o.preventDefault(),this.space||(this.space=!0,e.pauseFollow(),e.setMoving(!0)))},n);let a=()=>{this.space&&(this.space=!1,e.setMoving(this.moving))};window.addEventListener("keyup",o=>{o.code==="Space"&&a()},n),window.addEventListener("blur",a,n),window.addEventListener("resize",()=>{this.location.hidden=!0},n),e.root.querySelector(".slm-mapchrome")?.addEventListener("click",()=>{this.location.hidden=!0},n),e.root.addEventListener("focusout",o=>{e.root.contains(o.relatedTarget)||a()},n)}choose(e){this.tool=e,this.moving=e==="move",this.host.pauseFollow(),e!=="move"&&this.host.setShape(e==="lasso"?"lasso":"box"),this.host.setMoving(this.moving||this.space),this.bar.querySelectorAll("[aria-pressed]").forEach(t=>t.setAttribute("aria-pressed",String(t.dataset.nav===e)))}resetTool(){this.tool==="move"&&(this.tool="select",this.moving=!1,this.host.setShape("box"),this.host.setMoving(this.space),this.bar.querySelectorAll("[aria-pressed]").forEach(e=>e.setAttribute("aria-pressed",String(e.dataset.nav==="select"))))}update(e){this.bar.querySelector(".slm-navigation-tools").hidden=!e,!e&&this.tool==="move"&&this.choose("select")}historyChanged(e,t){this.undo.disabled=!e}destroy(){this.abort.abort(),this.bar.remove(),this.location.remove()}};function xs(i,e,t){let s=i.findIndex(a=>a.label===e),n=i.findIndex(a=>a.label===t);return s<0||n<0?[]:i.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.label)}function Zo(i,e){let t=1/0;for(let s=0;s<e.length;s++){let n=e[s],a=e[(s+1)%e.length],o=a.x-n.x,r=a.y-n.y,l=o||r?Math.max(0,Math.min(1,((i.x-n.x)*o+(i.y-n.y)*r)/(o*o+r*r))):0;t=Math.min(t,Math.hypot(i.x-(n.x+l*o),i.y-(n.y+l*r)))}return t}function En(i,e,t,s=6){let n=null;for(let a of e){if(a.state==="inactive"||a.outline.length<3)continue;let o=Zo(i,a.outline.map(t));o<=s&&(!n||o<n.d)&&(n={id:a.id,d:o})}return n?.id??null}var G=require("@seatlayer/core");Bt();var tr=/^[a-zA-Z0-9._-]+$/;function sr(i){let e;try{e=new URL(i,"https://seatlayer.invalid")}catch{return null}if(e.search||e.hash)return null;let t=/^\/v1\/events\/([^/]+)\/assets\/([^/]+)$/.exec(e.pathname);if(!t)return null;try{let s=decodeURIComponent(t[1]),n=decodeURIComponent(t[2]);return!s||!tr.test(n)?null:{eventKey:s,asset:n}}catch{return null}}function nr(i){try{return/^\/v1\/events\/[^/]+\/assets(?:\/|$)/.test(new URL(i,"https://seatlayer.invalid").pathname)}catch{return!1}}var Ot=class{constructor(e,t){this.eventKey=e;this.load=t;this.pending=new Map;this.created=new Set;this.disposed=!1}resolve(e){let t=sr(e);if(!t)return Promise.resolve(nr(e)?null:e);if(t.eventKey!==this.eventKey||this.disposed)return Promise.resolve(null);let s=`${t.eventKey}/${t.asset}`,n=this.pending.get(s);if(n)return n;let a=this.load(t.eventKey,t.asset).then(o=>{let r=URL.createObjectURL(o);return this.disposed?(URL.revokeObjectURL(r),null):(this.created.add(r),r)}).catch(o=>{throw this.pending.delete(s),o});return this.pending.set(s,a),a}async prepareRendererChart(e){let t=async a=>{if(!a?.url)return;let o=await this.resolve(a.url);if(!o)throw new Error("organizer_event_asset_scope_mismatch");a.url=o},s=async a=>{for(let o of a){if(o.type!=="decorImage")continue;let r=o,l=await this.resolve(r.href);if(!l)throw new Error("organizer_event_asset_scope_mismatch");r.href=l}},n=async a=>{await t(a.backgroundImage),await s(a.objects)};await n(e);for(let a of e.floors??[])await n(a);return e}dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.created)URL.revokeObjectURL(e);this.created.clear(),this.pending.clear()}}};ws();Ve();ge();function Ss(){return'<div class="slm-opening" data-ref="opening" role="status"><span class="slm-opening-spin" aria-hidden="true"></span><b>Opening the Control room\u2026</b><span>Loading the seats and their live state</span></div>'}function Ls(){let i=(e,t=12)=>`<span class="slm-skel" style="width:${e}px;height:${t}px"></span>`;return`<div class="slm-railskel" aria-hidden="true">${i(140,16)}${i(280)}${i(240)}<span class="slm-skel" style="width:100%;height:120px;border-radius:14px"></span>${i(200)}${i(280)}${i(260)}</div>`}var ir={offline:{glyph:"alert",hue:"#d64545",title:"The Control room couldn't open",body:"We could not reach SeatLayer. Check the connection; nothing about the event has changed.",action:"Try again"},access:{glyph:"lock",hue:"#3b82f6",title:"You don't have access to this room",body:'Your role can see the event but not its Control room. Ask an admin for "View the Control room".',action:null},missing:{glyph:"alert",hue:"#d64545",title:"This event is not here",body:"It may have been removed, or the link points at another event. Nothing was changed.",action:null},signedout:{glyph:"user",hue:"#0ea5a5",title:"You were signed out",body:"For your security the session ended. Sign in again and the room comes back as it was.",action:"Sign in again"}};function On(i,e){let t=ir[i],s=i==="access"&&e?.trim()?t.body.replace("Your role can",`Your role in ${e.trim()} can`):t.body;return`<div class="slm-roomcard" data-ref="roomcard" data-kind="${i}"><div role="alertdialog" aria-labelledby="slm-roomcard-title">${Z(t.glyph,t.hue,44)}<b id="slm-roomcard-title">${t.title}</b><p>${S(s)}</p>${t.action?`<button type="button" class="slm-btn" data-roomcard-act>${t.action}</button>`:""}</div></div>`}function Dn(i){return i==="live"?"":i==="paused"?'<div class="slm-connbanner warn" role="status"><span>Live updates paused. Reconnecting\u2026 The map and numbers may be up to 30 s old. Anything you change is kept.</span></div>':`<div class="slm-connbanner err" role="alert"><span>Couldn't reconnect for 2 minutes. The map may be out of date; changes can't be saved until it's back.</span><button type="button" data-conn-retry>Try now</button></div>`}function zn(i,e,t){return`<b>${S(i)}${e?` \xB7 ${S(e)}`:""}</b>`+(t?`<span class="slm-fsline-counts">${t.booked.toLocaleString()} sold \xB7 ${t.held.toLocaleString()} in carts \xB7 ${t.free.toLocaleString()} free</span>`:"")+'<span class="slm-fsline-gap"></span><button type="button" class="slm-btn ghost" data-fs-exit>Exit full screen</button><kbd>esc</kbd>'}function Fn(i){return`<div class="slm-nosales">${Z("bolt","#22a06b",40)}<b>No sales yet</b><p>The first booking shows here the moment it happens.</p></div>`+(i?`<p class="slm-nosales-viewers">${i.toLocaleString()} ${i===1?"person is":"people are"} looking at the seat map right now.</p>`:"")}var Nn=`
1140
1167
  .slm-opening{position:absolute;inset:0;z-index:6;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;background:var(--slm-bg);text-align:center}
1141
1168
  .slm-opening b{margin-top:10px;font-size:14px;font-weight:600;color:var(--slm-text)}.slm-opening span:last-child{font-size:12.5px;color:var(--slm-muted)}
1142
1169
  .slm-opening-spin{width:32px;height:32px;border-radius:50%;border:3px solid var(--slm-line);border-top-color:var(--slm-accent);animation:slm-open-spin calc(var(--slm-mo-slow) * 3) linear infinite}
@@ -1166,11 +1193,11 @@
1166
1193
  .slm-viewonly{flex:none;align-self:center;height:22px;display:inline-flex;align-items:center;padding:0 9px;border-radius:999px;font-size:11px;font-weight:600;
1167
1194
  color:color-mix(in srgb,#3b82f6 75%,var(--slm-text));background:color-mix(in srgb,#3b82f6 14%,transparent)}
1168
1195
  .slm-nosales{margin-top:4px;padding:14px;border-radius:14px;border:1px dashed var(--slm-line);background:color-mix(in srgb,var(--slm-text) 3%,var(--slm-surface));text-align:center}
1169
- .slm-nosales .slm-plate{margin:0 auto}
1196
+ .slm-nosales .slm-plate{margin:0 auto}[data-ref=nosales]:has(.slm-nosales)+* .slm-activity-empty{display:none}
1170
1197
  .slm-nosales b{display:block;margin-top:10px;font-size:14px}
1171
1198
  .slm-nosales p{margin:6px 0 0;font-size:12.5px;line-height:1.5;color:var(--slm-muted)}
1172
1199
  .slm-nosales-viewers{margin:14px 0 0;font-size:12.5px;line-height:1.5;color:var(--slm-muted)}
1173
- `;Fe();pe();var ct={view:{glyph:"eye",hue:"#3b82f6"},inspect:{glyph:"eye",hue:"#3b82f6"},block:{glyph:"ban",hue:"#d64545"},reserve:{glyph:"bookmark",hue:"#c026d3"},sections:{glyph:"layers",hue:"#0ea5a5"},categories:{glyph:"tag",hue:"#8b5cf6"},tables:{glyph:"table",hue:"#65a30d"},channels:{glyph:"route",hue:"#ea7a1e"},select:{glyph:"cursor",hue:"#d99a0b"},filterSections:{glyph:"search",hue:"#4c6fff"}},Ao='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>',Ht=i=>ct[i]??ct.view;function Tn(i,e,t){let s=`<button type="button" class="slm-taskpick-btn" data-taskpick aria-haspopup="menu" aria-expanded="${t}">${J(Ht(i.mode).glyph,Ht(i.mode).hue,26)}<span>${w(i.label)}</span>${Ao}</button>`;if(!t)return s;let n=e.map(a=>a.tools.map(o=>`<button type="button" role="menuitemradio" aria-checked="${o.mode===i.mode}" data-taskpick-mode="${w(o.mode)}">${J(Ht(o.mode).glyph,Ht(o.mode).hue,26)}<span>${w(o.label)}</span></button>`).join("")).join("<hr>");return`${s}<div class="slm-taskmenu" role="menu" aria-label="Tasks">${n}</div>`}var Cn=`
1200
+ `;Ve();ge();var mt={view:{glyph:"eye",hue:"#3b82f6"},inspect:{glyph:"eye",hue:"#3b82f6"},block:{glyph:"ban",hue:"#d64545"},reserve:{glyph:"bookmark",hue:"#c026d3"},sections:{glyph:"layers",hue:"#0ea5a5"},categories:{glyph:"tag",hue:"#8b5cf6"},tables:{glyph:"table",hue:"#65a30d"},channels:{glyph:"route",hue:"#ea7a1e"},select:{glyph:"cursor",hue:"#d99a0b"},filterSections:{glyph:"search",hue:"#4c6fff"}},ar='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>',Dt=i=>mt[i]??mt.view;function qn(i,e,t){let s=`<button type="button" class="slm-taskpick-btn" data-taskpick aria-haspopup="menu" aria-expanded="${t}">${Z(Dt(i.mode).glyph,Dt(i.mode).hue,26)}<span>${S(i.label)}</span>${ar}</button>`;if(!t)return s;let n=e.map(a=>a.tools.map(o=>`<button type="button" role="menuitemradio" aria-checked="${o.mode===i.mode}" data-taskpick-mode="${S(o.mode)}">${Z(Dt(o.mode).glyph,Dt(o.mode).hue,26)}<span>${S(o.label)}</span></button>`).join("")).join("<hr>");return`${s}<div class="slm-taskmenu" role="menu" aria-label="Tasks">${n}</div>`}var _n=`
1174
1201
  .slm-taskpick{display:none;position:relative}
1175
1202
  .slm .slm-taskpick-btn{display:inline-flex;align-items:center;gap:8px;height:44px;padding:0 12px 0 8px;border-radius:10px;border:1px solid var(--slm-line);
1176
1203
  background:var(--slm-surface);color:var(--slm-text);font:inherit;font-size:13.5px;font-weight:600;white-space:nowrap;cursor:pointer}
@@ -1207,7 +1234,7 @@
1207
1234
  .slm.compact .slm-railscroll{flex:1;min-height:0}
1208
1235
  .slm.compact .slm-view-item,.slm.compact .slm-rail .slm-btn,.slm.compact .slm-chips button,.slm.compact .slm-monitor-tabs button,.slm.compact .slm-rail .slm-linkbtn{min-height:44px}
1209
1236
  .slm.compact .slm-rail{font-size:max(12px,1em)}
1210
- `;var Mn="seatlayer-manager-style",En="seatlayer-manager-channels-style",Ho=`
1237
+ `;var jn="seatlayer-manager-style",Vn="seatlayer-manager-channels-style",or=`
1211
1238
  /* The floor was 480px, which trapped the cockpit in any host shorter than that:
1212
1239
  every ancestor here is overflow:hidden, so the bottom of the rail (Create
1213
1240
  channel, Show archived) was rendered but clipped away by the host and could
@@ -1228,7 +1255,7 @@
1228
1255
  .slm input{font:inherit}
1229
1256
  /* The dialogs come AFTER the reset: their one-class rules tie with .slm *,
1230
1257
  and ahead of it they lost every padding and margin they set (audit m23). */
1231
- ${xn}
1258
+ ${Bn}
1232
1259
 
1233
1260
  .slm .slm-btn:not(.ghost):not(.danger){background:var(--slm-accent);color:var(--slm-accent-ink);border:1px solid var(--slm-accent)}
1234
1261
  /* Navigation remains available without changing the inventory tool. */
@@ -1264,6 +1291,8 @@ ${xn}
1264
1291
  .slm-monitor-tabs{display:flex;border-bottom:1px solid var(--slm-line);margin-bottom:6px;gap:16px}
1265
1292
  .slm .slm-monitor-tabs button{padding:0 0 7px;font-size:12px;color:var(--slm-muted);border-bottom:2px solid transparent}
1266
1293
  .slm .slm-monitor-tabs button[aria-selected="true"]{color:var(--slm-text);border-color:var(--slm-accent);font-weight:700}
1294
+ /* CR14/CR15: a task's two views are a segmented switch. */
1295
+ .slm-monitor-tabs.seg{gap:0;padding:3px;border:0;border-radius:10px;background:var(--slm-tint-strong)}.slm-monitor-tabs.seg button{flex:1;padding:7px 0;border:0;border-radius:8px;font-size:13px;text-align:center}.slm-monitor-tabs.seg button[aria-selected="true"]{background:var(--slm-surface);box-shadow:0 1px 2px rgba(12,18,32,.14);font-weight:600}.slm[data-theme=light] .slm-monitor-tabs.seg button[aria-selected="true"]{background:var(--slm-bg)}
1267
1296
  .slm-activity-filters{display:flex;gap:6px;margin-bottom:6px}
1268
1297
  .slm-activity-filters label{flex:1;min-width:0;font-size:11px;color:var(--slm-muted)}
1269
1298
  .slm-activity-filters select{width:100%;margin-top:0;padding:5px 7px;border-radius:5px;border:1px solid var(--slm-line);background:var(--slm-surface);color:var(--slm-text);font:inherit;font-size:12px}
@@ -1331,9 +1360,10 @@ ${xn}
1331
1360
  .slm-barbtn{padding:7px 13px;border-radius:9px;border:1px solid var(--slm-line);color:var(--slm-text);font-weight:700;font-size:12.5px}
1332
1361
  .slm .slm-helpbtn{width:34px;height:34px;padding:0;text-align:center;font-size:14px}
1333
1362
  .slm.tighterbar .slm-findbar{flex:none;min-width:0}.slm.tighterbar .slm-findtrigger{width:34px;min-width:0;padding:0;justify-content:center}.slm.tighterbar .slm-findtrigger span,.slm.tighterbar .slm-findtrigger kbd{display:none}
1363
+ .slm.tightsearch .slm-findbar{flex:1 1 100px;min-width:100px}.slm.tightsearch .slm-bar{column-gap:10px}
1334
1364
  .slm.tightbar .slm-barbtn.follow span,.slm.tightbar .slm-view-text,.slm.tightbar .slm-view-caret{display:none}
1335
1365
  .slm.tighterbar .slm-bar{column-gap:8px}.slm.tighterbar .slm-bar-actions{gap:6px}
1336
- .slm .slm-howlink{margin-left:2px;padding:0;font:inherit;font-weight:600;color:var(--slm-accent);white-space:nowrap}
1366
+ .slm .slm-howlink{margin-left:2px;padding:0;font:inherit;font-weight:600;color:var(--slm-accent);white-space:nowrap}.slm[data-theme="light"] .slm-howlink{color:color-mix(in srgb,var(--slm-accent) 45%,#3d2a00)}
1337
1367
  .slm-barbtn:hover{border-color:var(--slm-muted)}
1338
1368
  .slm .slm-barbtn.follow,.slm .slm-barbtn.heat{display:inline-flex;align-items:center;gap:8px;flex:none;white-space:nowrap;border:0;border-radius:6px;padding:5px 7px;min-height:30px;font-size:12px;background:transparent;color:var(--slm-text)}
1339
1369
  .slm .slm-barbtn.follow{height:34px;padding:0 10px;border:1px solid var(--slm-line);border-radius:9px;background:var(--slm-surface);font-size:12.5px;font-weight:500}
@@ -1363,7 +1393,7 @@ ${xn}
1363
1393
  .slm-blocklegend{position:relative;display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;max-width:100%;padding:4px 12px 4px 4px;border-radius:12px;font-size:12px;font-weight:500;color:var(--slm-text);
1364
1394
  background:color-mix(in srgb,var(--slm-surface) 92%,transparent);border:1px solid var(--slm-line);backdrop-filter:blur(8px);box-shadow:0 1px 2px rgba(12,18,32,.06),0 6px 18px rgba(12,18,32,.08);pointer-events:auto;z-index:2}
1365
1395
  .slm-blocklegend span{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
1366
- .slm .slm-legendchip{display:inline-flex;align-items:center;gap:6px;margin:-3px -6px;padding:3px 6px;border-radius:7px;white-space:nowrap;color:var(--slm-text);font-weight:500}.slm .slm-legendchip:hover{background:var(--slm-tint)}.slm .slm-legendchip[aria-pressed=true]{background:color-mix(in srgb,var(--slm-accent) 16%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--slm-accent) 55%,transparent)}.slm-legendchip em{font-style:normal;color:var(--slm-muted);margin-left:2px}.slm-blocklegend .slm-litnote{padding:3px 9px;border-radius:999px;background:var(--slm-text);color:var(--slm-bg);font-size:11.5px;font-weight:600}
1396
+ .slm .slm-legendchip{display:inline-flex;align-items:center;gap:6px;margin:-3px -6px;padding:3px 6px;border-radius:7px;white-space:nowrap;color:var(--slm-text);font-weight:500;position:relative}.slm .slm-legendchip>.tip{display:block;position:absolute;left:0;top:calc(100% + 10px);z-index:9;width:250px;padding:9px 11px;border-radius:9px;background:#0c1220;color:#fff;font-size:12px;font-weight:500;line-height:1.45;white-space:pre-line;text-align:left;box-shadow:0 10px 30px rgba(12,18,32,.3);opacity:0;visibility:hidden;pointer-events:none;transition:opacity var(--slm-mo-quick) var(--slm-mo-out) var(--slm-mo-base)}.slm .slm-legendchip>.tip b{color:inherit;font-weight:700}.slm .slm-legendchip:is(:hover,:focus-visible)>.tip{opacity:1;visibility:visible}.slm .slm-legendchip:hover{background:var(--slm-tint)}.slm .slm-legendchip[aria-pressed=true]{background:color-mix(in srgb,var(--slm-accent) 16%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--slm-accent) 55%,transparent)}.slm-legendchip em{font-style:normal;color:var(--slm-muted);margin-left:2px}.slm-blocklegend .slm-litnote{padding:3px 9px;border-radius:999px;background:var(--slm-text);color:var(--slm-bg);font-size:11.5px;font-weight:600}
1367
1397
  .slm-blocklegend i{width:9px;height:9px;border-radius:3px;display:inline-block}
1368
1398
  .slm-blocklegend i.seat{border-radius:50%}
1369
1399
  .slm-blocklegend i.blocked{box-shadow:inset 0 0 0 1.4px #98a2b5;background:linear-gradient(45deg,transparent 44%,#98a2b5 44% 56%,transparent 56%) !important}
@@ -1373,13 +1403,13 @@ ${xn}
1373
1403
  .slm .slm-chips button:disabled{opacity:.5;cursor:not-allowed;text-decoration:line-through}
1374
1404
  .slm-blocklegend i.reserved{box-shadow:inset 0 0 0 1.6px #c026d3;background:radial-gradient(#c026d3 28%,transparent 32%) !important}
1375
1405
  .slm-blocklegend b{font-weight:600;color:var(--slm-muted);font-variant-numeric:tabular-nums}
1376
- .slm-legend-items{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
1406
+ .slm-legend-items{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px 14px}.slm-legend-items>small{font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted)}
1377
1407
  .slm .slm-colourby{display:inline-flex;align-items:center;gap:7px;min-height:32px;padding:0 10px 0 7px;border:1px solid var(--slm-line);border-radius:9px;background:var(--slm-surface);color:var(--slm-text);font:inherit;font-weight:600;cursor:pointer}
1378
1408
  .slm .slm-colourby span{color:var(--slm-muted);font-weight:500}
1379
1409
  .slm .slm-colourby b{color:var(--slm-text)}
1380
1410
  .slm .slm-colourby i{font-style:normal;color:var(--slm-muted);font-size:10px}
1381
1411
  .slm .slm-colourby:focus-visible,.slm .slm-colourmenu button:focus-visible{outline:2px solid var(--slm-accent);outline-offset:1px}
1382
- .slm-colourmenu{position:absolute;left:0;top:calc(100% + 6px);z-index:8;width:300px;padding:6px;border-radius:14px;background:var(--slm-surface);border:1px solid var(--slm-line);box-shadow:0 12px 32px rgba(12,18,32,.18)}
1412
+ .slm-colourmenu{position:absolute;left:0;top:calc(100% + 6px);z-index:8;width:354px;max-width:calc(100vw - 32px);box-sizing:border-box;padding:6px;border-radius:14px;background:var(--slm-surface);border:1px solid var(--slm-line);box-shadow:0 12px 32px rgba(12,18,32,.18)}
1383
1413
  .slm-colourmenu[hidden]{display:none}
1384
1414
  .slm .slm-colourmenu button{display:grid;grid-template-columns:44px 1fr 14px;align-items:center;column-gap:10px;width:100%;padding:9px 11px;border:0;border-radius:10px;background:transparent;color:var(--slm-text);font:inherit;text-align:left;cursor:pointer}
1385
1415
  .slm .slm-colourmenu button:hover{background:var(--slm-tint)}
@@ -1390,7 +1420,7 @@ ${xn}
1390
1420
  .slm-colourmenu button span{display:flex;flex-direction:column;align-items:flex-start;gap:2px;font-size:12px;color:var(--slm-muted)}
1391
1421
  .slm-colourmenu button b{font-size:13px;font-weight:600;color:var(--slm-text)}
1392
1422
  .slm-colourmenu button.on::after{content:'\u2713';color:var(--slm-text);font-weight:700}
1393
- .slm-colourmenu p{margin:6px 4px 2px;padding:8px 8px 2px;border-top:1px solid var(--slm-line);font-size:12px;color:var(--slm-muted)}
1423
+ .slm .slm-colourmenu p .slm-howlink{display:inline;width:auto;flex:none;padding:0}.slm[data-theme="light"] .slm-colourmenu{background:var(--slm-bg)}.slm-colourmenu p{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:6px 4px 2px;padding:8px 8px 2px;border-top:1px solid var(--slm-line);font-size:12px;color:var(--slm-muted)}
1394
1424
  .slm.compact .slm-legend-items{display:none}
1395
1425
  .slm.compact .slm-blocklegend{padding:4px}
1396
1426
  .slm-blocklegend[hidden]{display:none}
@@ -1433,7 +1463,7 @@ ${xn}
1433
1463
  rather than display:none'd, so the fade in and out still runs. */
1434
1464
  .slm-lane>:not(.on):not(.slm-crumb){position:absolute;bottom:0;left:50%;translate:-50% 0;width:max-content;max-width:520px;pointer-events:none}
1435
1465
  /* The session-ended card: the map stays painted under it; one way back. */
1436
- .slm-zoomhint{padding:6px 13px;border-radius:999px;
1466
+ .slm-zoomhint{display:inline-flex;align-items:center;gap:7px;padding:6px 13px;border-radius:999px;
1437
1467
  background:color-mix(in srgb,var(--slm-surface) 92%,transparent);color:var(--slm-text);
1438
1468
  border:1px solid var(--slm-line);font-size:12px;font-weight:700;pointer-events:none;opacity:0;
1439
1469
  transition:opacity var(--slm-mo-base) var(--slm-mo-out)}
@@ -1446,19 +1476,20 @@ ${xn}
1446
1476
  .slm-liveevent.on{opacity:1;transform:none}
1447
1477
  .slm-liveeventdot{width:8px;height:8px;border-radius:50%;flex:none}.slm-liveeventcopy{min-width:0;overflow:hidden;text-overflow:ellipsis;
1448
1478
  white-space:nowrap;font-size:12px;font-weight:800}.slm-liveeventhint{color:var(--slm-muted);font-size:10px;white-space:nowrap}
1449
- .slm-rail{width:320px;flex:none;border-left:1px solid var(--slm-line);display:flex;flex-direction:column;min-height:0}
1479
+ .slm-rail{width:360px;flex:none;border-left:1px solid var(--slm-line);display:flex;flex-direction:column;min-height:0}
1450
1480
  .slm-railscroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px}
1451
1481
  .slm-eyebrow{font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--slm-muted);font-weight:800;margin-bottom:6px}
1452
1482
  .slm-hint{font-size:12.5px;color:var(--slm-muted);line-height:1.5;margin-bottom:8px}
1453
1483
  /* rail header: title + scope badge, then one plain sentence \u2014 every tool opens the same way */
1454
1484
  .slm-railhead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
1455
1485
  .slm-railhead .slm-eyebrow{margin-bottom:0;font-size:11px;color:var(--slm-text)}
1456
- .slm-scope{flex:none;padding:2px 8px;border-radius:999px;font-size:9.5px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;white-space:nowrap}
1486
+ .slm-scope{flex:none;padding:2px 8px;border-radius:999px;font-size:10.5px;font-weight:700;white-space:nowrap}
1457
1487
  .slm-scope.read{background:rgba(139,148,172,.16);color:var(--slm-text)}
1458
1488
  .slm-scope.event{background:rgba(244,183,64,.16);color:var(--slm-text)}
1459
1489
  .slm-scope.host{background:color-mix(in srgb,var(--slm-accent) 18%,transparent);color:var(--slm-accent)}
1460
1490
  .slm-step{display:flex;align-items:center;gap:7px}
1461
- .slm-stepnum{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:var(--slm-accent);color:var(--slm-accent-ink);font-size:9.5px;letter-spacing:0}
1491
+ .slm-stepnum{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--slm-text);color:var(--slm-surface);font-size:11px;font-weight:700;letter-spacing:0}
1492
+ .slm-eyebrow.slm-step{color:var(--slm-text)}
1462
1493
 
1463
1494
  /* legend rows */
1464
1495
  /* The status key inside a note line: a swatch, and blocked's light disc with
@@ -1575,7 +1606,7 @@ ${xn}
1575
1606
  .slm-input,.slm-select{width:100%;padding:8px 10px;border-radius:9px;border:1px solid var(--slm-line);
1576
1607
  background:var(--slm-surface);color:var(--slm-text)}
1577
1608
  .slm-note{font-size:11.5px;color:var(--slm-muted);margin-top:5px}
1578
- .slm-linkbtn{font-size:11px!important;font-weight:800!important;color:var(--slm-accent)!important;text-align:right}
1609
+ .slm-linkbtn{font-size:11px!important;font-weight:800!important;color:var(--slm-accent)!important;text-align:right}.slm .slm-railfoot [data-foot-secondary]{color:var(--slm-text)!important;font-size:12.5px!important;font-weight:600!important}
1579
1610
  .slm-linkbtn:disabled{opacity:.45;cursor:not-allowed}
1580
1611
 
1581
1612
  /* toast */
@@ -1594,17 +1625,13 @@ ${xn}
1594
1625
  /* control-room actions + insights */
1595
1626
  .slm-bar-actions{display:flex;flex:1;min-width:0;align-items:center;gap:10px}
1596
1627
  .slm-barbtn.on{background:rgba(244,183,64,.13);border-color:#f4b740;color:var(--slm-text)}
1597
- .slm-sectionlist{display:flex;flex-direction:column;gap:8px;margin-top:4px}
1628
+ .slm-sectionlist{display:flex;flex-direction:column;margin-top:6px}
1629
+ .slm .slm-sectionrow{display:grid;grid-template-columns:minmax(0,1fr) 90px 70px;gap:10px;align-items:center;padding:8px 0;border:0;border-top:1px solid var(--slm-line);border-radius:0;background:none;color:var(--slm-text);font:inherit;font-size:12.5px;font-weight:500;text-align:left;cursor:pointer}
1630
+ .slm-sectionrow>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.slm-sectionrow>i{height:6px;border-radius:9px;background:var(--slm-tint-strong);overflow:hidden}.slm-sectionrow>i>i{display:block;height:100%;background:#22a06b}
1631
+ .slm-sectionrow>b{text-align:right;font-weight:600}.slm-sectionrow>b.soldout{color:var(--slm-muted)}.slm-sectionrow>b.blocked{color:#d64545}
1598
1632
  .slm-sectionlist + .slm-eyebrow{margin-top:18px}
1599
- .slm-sectionrow{width:100%;padding:10px!important;border:1px solid var(--slm-line)!important;border-radius:10px;
1600
- background:var(--slm-surface)!important;text-align:left!important;
1601
- transition:border-color var(--slm-mo-quick) var(--slm-mo-out),transform var(--slm-mo-quick) var(--slm-mo-out)}
1602
- .slm-sectionrow:hover{border-color:var(--slm-muted)!important;transform:translateY(-1px)}
1603
- .slm-sectiontop,.slm-sectionmeta{display:flex;align-items:center;justify-content:space-between;gap:10px}
1604
- .slm-sectiontop{font-size:12.5px;font-weight:800}.slm-sectionmeta{margin-top:5px;color:var(--slm-muted);font-size:11px}
1605
- .slm-sectionmeta>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1633
+ .slm .slm-sectionrow:hover{background:var(--slm-tint)}
1606
1634
  .slm-trend{font-size:10px;text-transform:uppercase;letter-spacing:.08em}.slm-trend.rising{color:#22a06b}.slm-trend.cooling{color:#f4b740}
1607
- .slm-sectionlocate{color:var(--slm-accent);font-size:9.5px;font-weight:800}
1608
1635
  .slm-health{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:16px}
1609
1636
  .slm-healthitem{padding:10px;border:1px solid var(--slm-line);border-radius:10px;background:var(--slm-surface)}
1610
1637
  .slm-healthitem b{display:block;font-size:17px;font-variant-numeric:tabular-nums}.slm-healthitem span{display:block;margin-top:2px;color:var(--slm-muted);font-size:10px;text-transform:uppercase;letter-spacing:.08em}
@@ -1616,14 +1643,16 @@ ${xn}
1616
1643
  .slm-watchcard.reserved{border-color:color-mix(in srgb,#c026d3 45%,var(--slm-line))}
1617
1644
  .slm-watchcard dl{margin:10px 0 0;display:grid;gap:0}.slm-watchcard dl div{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-top:1px solid var(--slm-line);font-size:12.5px}
1618
1645
  .slm-watchcard dt{color:var(--slm-muted)}.slm-watchcard dd{margin:0;font-weight:600;text-align:right}
1646
+ .slm .sl-hover-card.room{z-index:7!important;min-width:270px;max-width:360px;padding:12px 14px;border-radius:12px;background:var(--slm-surface);border:1px solid var(--slm-line);box-shadow:0 1px 2px rgba(12,18,32,.06),0 8px 24px rgba(12,18,32,.08);color:var(--slm-text);font:500 12px/1.3 var(--slm-font)}
1647
+ .slm[data-theme="dark"] .sl-hover-card.room{box-shadow:0 1px 2px rgba(0,0,0,.4),0 10px 28px rgba(0,0,0,.45)}
1648
+ .slhc-head{display:flex;align-items:center;gap:9px;margin-bottom:6px}.slhc-plate{display:inline-flex}.slhc-title{display:block;font-size:13.5px;line-height:1.2}.slhc-sub{font-size:11.5px;font-weight:600;color:var(--slm-muted)}
1649
+ .slhc-row{display:flex;justify-content:space-between;gap:10px;padding:5px 0;border-top:1px solid var(--slm-line)}.slhc-row span{color:var(--slm-muted)}.slhc-row b{font-weight:600;text-align:right;white-space:nowrap}
1619
1650
  .slm-watchacts{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}.slm .slm-watchacts .slm-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:none;min-width:0;min-height:32px;padding:0 10px;border-radius:9px;font-size:12.5px;font-weight:600;white-space:nowrap}.slm .slm-watchacts .slm-btn:first-child:not(:last-child){flex:1}
1620
1651
  .slm-feedfilter{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:12px 0 6px}
1621
1652
  .slm-feedfilter>b{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted);white-space:nowrap}
1622
1653
  .slm-feedfilter>span{display:inline-flex;gap:4px}
1623
1654
  .slm .slm-feedfilter button{height:24px;padding:0 9px;border-radius:999px;font-size:11px;font-weight:500;color:var(--slm-muted)}
1624
1655
  .slm .slm-feedfilter button[aria-pressed="true"]{background:color-mix(in srgb,var(--slm-text) 8%,transparent);color:var(--slm-text);font-weight:700}
1625
- .slm-sectionstate{font-size:11px;font-weight:700;padding:2px 8px;border-radius:999px;background:rgba(34,160,107,.14);color:#1a7f52}
1626
- .slm-sectionstate.soldout{background:rgba(138,148,166,.18);color:var(--slm-muted)}.slm-sectionstate.blocked{background:rgba(214,69,69,.12);color:#b42318}
1627
1656
  .slm-activity-empty b{display:block;margin-top:2px;color:var(--slm-text);font-weight:600}
1628
1657
  .slm-seat-heading h2{font-size:15px;font-weight:700;margin:0}
1629
1658
  .slm-seat-heading [data-seat-status]{font-size:12px;text-transform:capitalize}
@@ -1661,40 +1690,45 @@ ${xn}
1661
1690
  .slm-selparts .tone-ok{color:#11704c;background:rgba(34,160,107,.14)}.slm-selparts .tone-warn{color:#8a5206;background:rgba(244,183,64,.2)}.slm-selparts .tone-danger{color:#b4232a;background:rgba(214,69,69,.13)}
1662
1691
  .slm[data-theme="dark"] .slm-selparts .tone-ok{color:#5fd3a1}.slm[data-theme="dark"] .slm-selparts .tone-warn{color:#f5c267}.slm[data-theme="dark"] .slm-selparts .tone-danger{color:#ff8a8f}
1663
1692
  .slm-selparts .type{background:transparent;padding:3px 2px;font-weight:500}.slm-selparts i{width:8px;height:8px;border-radius:50%}
1664
- .slm-selstale,.slm-panelalert{display:flex;gap:9px;align-items:flex-start;margin:10px 0 0;padding:9px 10px;border-radius:10px;font-size:12px;line-height:1.45;background:rgba(244,183,64,.16)}
1665
- .slm-panelalert{margin:10px 0}.slm-panelalert.error{background:rgba(214,69,69,.12)}.slm-panelalert.ok{background:rgba(34,160,107,.12)}.slm-panelalert.info{background:rgba(59,130,246,.12)}.slm-panelalert b{display:block}
1693
+ .slm-selstale{display:flex;gap:9px;align-items:flex-start;margin:10px 0 0;padding:9px 10px;border-radius:10px;font-size:12px;line-height:1.45;background:rgba(244,183,64,.16)}
1694
+ .slm-panelalert{display:flex;gap:10px;align-items:flex-start;margin:12px 0;padding:12px;border-radius:12px;font-size:12.5px;font-weight:500;line-height:1.45;background:#3A2A12;color:#F5C267}.slm-panelalert svg{flex:none}.slm-panelalert b{display:block}
1695
+ .slm-panelalert.error{background:#3D1A1E;color:#FF8A8F}.slm-panelalert.ok{background:#12321F;color:#6FD3A0}.slm-panelalert.info{background:#172544;color:#8FB2FF}
1696
+ .slm[data-theme=light] .slm-panelalert{background:#FFF1DC;color:#8A5206}.slm[data-theme=light] .slm-panelalert.error{background:#FDECEC;color:#B4232A}.slm[data-theme=light] .slm-panelalert.ok{background:#E6F6EE;color:#17694A}.slm[data-theme=light] .slm-panelalert.info{background:#E7EEFD;color:#1F4FB8}
1666
1697
  .slm-ways{display:flex;flex-direction:column;gap:9px;margin-top:10px}.slm-ways>span{display:flex;align-items:center;gap:10px;font-size:11.5px;color:var(--slm-muted)}
1667
1698
  .slm-ways b{display:block;font-size:12.5px;color:var(--slm-text)}
1668
1699
  .slm-selbtns{position:relative;display:flex;gap:6px;margin-top:10px}.slm-simwrap{display:flex;flex:1;min-width:0}
1669
1700
  .slm .slm-selbtns .slm-btn{display:inline-flex;align-items:center;justify-content:center;gap:5px;flex:none;min-width:0;min-height:32px;padding:0 9px;white-space:nowrap;overflow:hidden;border-radius:9px;font-size:12.5px;font-weight:600}
1670
- .slm .slm-selbtns .slm-simwrap .slm-btn{flex:1}.slm .slm-selbtns .slm-btn:disabled{opacity:.45;cursor:default}
1701
+ .slm .slm-selbtns .slm-simwrap .slm-btn{flex:1}.slm-selbtns .slm-btn svg{flex:none}.slm .slm-selbtns .slm-btn:disabled{opacity:.45;cursor:default}
1671
1702
  .slm .slm-savedrow{display:flex;align-items:center;gap:10px;width:100%;padding:9px 0 0;border-top:1px dashed var(--slm-line);text-align:left;font-size:11.5px;color:var(--slm-muted)}
1672
1703
  .slm-savedrow>span:nth-child(2){flex:1}.slm-savedrow b{display:block;font-size:12.5px;color:var(--slm-text)}
1673
1704
  /* A panel's Undo, pinned under its list (Sections, Tables, Channels). */
1674
1705
  .slm-undobar{position:sticky;bottom:0;display:flex;align-items:center;justify-content:space-between;gap:8px;margin:12px -16px -16px;padding:10px 16px;border-top:1px solid var(--slm-line);background:var(--slm-surface);font-size:12px;color:var(--slm-muted)}
1675
1706
  .slm-railfoot{position:sticky;bottom:-16px;z-index:3;margin:16px -16px -16px;padding:12px 16px 14px;background:var(--slm-surface);border-top:1px solid var(--slm-line);box-shadow:0 -8px 18px -10px rgba(12,18,32,.25)}
1676
1707
  .slm .slm-railfoot .slm-btn{width:100%;min-height:42px;border-radius:11px;font-size:14px;font-weight:700}
1677
- .slm .slm-railfoot .slm-btn.danger{background:#d64545;border-color:#d64545;color:#fff}.slm .slm-railfoot .slm-btn:disabled{opacity:.55;cursor:default}
1708
+ .slm .slm-railfoot .slm-btn.danger{background:#d64545;border-color:#d64545;color:#fff}.slm .slm-railfoot .slm-btn:disabled{cursor:default}.slm .slm-railfoot .slm-btn:disabled:not(.busy){opacity:1;background:#202839;border-color:transparent;color:#8792A8}.slm[data-theme=light] .slm-railfoot .slm-btn:disabled:not(.busy){background:#EDF1F7;color:#6E7890}.slm .slm-railfoot .slm-btn.busy{opacity:.85}.slm-categoryrow:disabled{opacity:.5}.slm-settled :is(.slm-addby,.slm-step,.slm-categoryassign,.slm-catreset,[data-block-editor]){display:none}
1678
1709
  .slm .slm-railfoot .slm-btn.busy::before{content:'';display:inline-block;width:13px;height:13px;margin-right:8px;vertical-align:-2px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:slm-spin calc(var(--slm-mo-slow) * 2.5) linear infinite}
1679
1710
  @keyframes slm-spin{to{transform:rotate(360deg)}}
1680
1711
  .slm-railfoot .slm-linkbtn{display:block;margin:8px auto 0;text-align:center}.slm-railfoot .slm-note{margin:7px 2px 0}
1712
+ .slm-railfoot.done{display:grid;grid-template-columns:1fr auto;align-items:center}.slm-railfoot.done .slm-btn{grid-column:1/-1}.slm .slm-railfoot.done .slm-btn:disabled{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1713
+ .slm-railfoot.done .slm-note{grid-row:2;grid-column:1;margin:8px 2px 0}.slm .slm-railfoot:is(.done,.settle) .slm-linkbtn{display:inline-flex;align-items:center;justify-content:center;gap:6px;margin:8px 0 0;padding:5px 12px;border:1px solid var(--slm-line);border-radius:9px;color:var(--slm-text)!important;font-size:13px!important;font-weight:600!important}.slm-railfoot.done .slm-linkbtn{grid-row:2;grid-column:2}.slm-categoryrow.locked{opacity:.55}.slm-railfoot.settle .slm-linkbtn{width:100%}
1681
1714
  .slm-muted{color:var(--slm-muted);font-weight:500}
1682
1715
  .slm .slm-findtrigger{display:flex;align-items:center;gap:9px;width:100%;min-width:0;height:36px;padding:0 8px 0 10px;border:1px solid var(--slm-line);border-radius:9px;background:var(--slm-surface);color:var(--slm-muted);font:inherit;font-size:12.5px;cursor:pointer;text-align:left}
1683
- .slm .slm-findtrigger span{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.slm .slm-findtrigger kbd{padding:1px 5px;border:1px solid var(--slm-line);border-bottom-width:2px;border-radius:5px;font-size:10.5px}
1716
+ .slm .slm-findtrigger span{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.slm .slm-findtrigger kbd{padding:1px 5px;border:1px solid var(--slm-line);border-bottom-width:2px;border-radius:5px;font-size:10.5px}.slm-findtrigger kbd+kbd{margin-left:-6px}
1684
1717
  .slm .slm-findtrigger:hover{border-color:var(--slm-muted)}.slm .slm-findtrigger:focus-visible{outline:2px solid var(--slm-accent);outline-offset:1px}
1685
1718
  .slm-addby>summary{cursor:pointer;list-style:none}.slm-addby>summary::after{content:' \u25B8'}.slm-addby[open]>summary::after{content:' \u25BE'}.slm-addby>summary::-webkit-details-marker{display:none}
1686
1719
  .slm-categoryrow.on{border-color:var(--slm-accent)!important;background:color-mix(in srgb,var(--slm-accent) 14%,var(--slm-surface))!important;box-shadow:inset 0 0 0 1px var(--slm-accent)}
1687
1720
  .slm-categoryassign{display:flex;flex-direction:column;gap:6px}
1688
- .slm-categoryrow{display:grid!important;width:100%;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;
1721
+ .slm-categoryrow{display:grid!important;width:100%;grid-template-columns:auto auto minmax(0,1fr) auto;align-items:center;gap:10px;
1689
1722
  padding:9px 10px!important;border:1px solid var(--slm-line)!important;border-radius:10px;background:var(--slm-surface)!important;
1690
1723
  text-align:left!important;transition:border-color var(--slm-mo-quick) var(--slm-mo-out),background var(--slm-mo-quick) var(--slm-mo-out)}
1691
1724
  .slm-categoryrow:not(:disabled):hover{border-color:var(--slm-accent)!important;background:color-mix(in srgb,var(--slm-accent) 10%,var(--slm-surface))!important}
1692
1725
  .slm-categoryrow:disabled{cursor:not-allowed}
1693
1726
  .slm-categoryrow>.dot{width:10px;height:10px;border-radius:50%;flex:none}
1694
- .slm-categorycopy{display:flex;min-width:0;flex-direction:column;gap:2px}
1695
- .slm-categorycopy b{font-size:12.5px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1696
- .slm-categorycopy small{font-size:10px;color:var(--slm-muted);font-variant-numeric:tabular-nums}
1697
- .slm-categoryact{flex:none;font-size:11px;font-weight:800;color:var(--slm-accent);white-space:nowrap}
1727
+ .slm-categorycopy{display:flex;min-width:0;align-items:baseline;gap:0}
1728
+ .slm-radio{width:16px;height:16px;border-radius:50%;flex:none;box-shadow:inset 0 0 0 1.5px var(--slm-line)}.slm-categoryrow.on .slm-radio{box-shadow:inset 0 0 0 5px var(--slm-accent)}
1729
+ .slm-categorycopy b{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1730
+ .slm-categorycopy small{flex:none;font-size:11.5px;font-weight:400;color:var(--slm-muted);font-variant-numeric:tabular-nums;white-space:pre}
1731
+ .slm-categoryact{flex:none;font-size:12.5px;font-weight:600;color:var(--slm-muted);white-space:nowrap}
1698
1732
  .slm-categoryrow:disabled .slm-categoryact{color:var(--slm-muted)}
1699
1733
  .slm-categoryrow.current .slm-categoryact{color:var(--slm-muted)}
1700
1734
  .slm-select:disabled{opacity:.55;cursor:not-allowed}
@@ -1718,7 +1752,7 @@ ${xn}
1718
1752
  transition:none!important;
1719
1753
  scroll-behavior:auto!important}
1720
1754
  }
1721
- ${$n}${Cn}`;function An(){if(typeof document>"u"||document.getElementById(Mn))return;let i=document.createElement("style");i.id=Mn,i.textContent=Ho,document.head.appendChild(i)}function Hn(i){if(typeof document>"u"||document.getElementById(En))return;let e=document.createElement("style");e.id=En,e.textContent=i,document.head.appendChild(e)}var Rn="seatlayer-manager-extras-style";function In(i){if(typeof document>"u"||document.getElementById(Rn))return;let e=document.createElement("style");e.id=Rn,e.textContent=i,document.head.appendChild(e)}var so=require("@seatlayer/core/core/cdnAsset");fs();var zn=require("@seatlayer/core"),Je=require("@seatlayer/core/picker/minimapGeometry");var On=require("@seatlayer/core"),Dn=require("@seatlayer/core/core/cdnAsset");var zo=require("@seatlayer/core/core/cdnAsset");function Me(i,e){let t=(0,On.t)(i);return t===i?e:t}function No(i){let e={inactive:0,available:1,selected:2},t=new Map;for(let n of i){let a=t.get(n.id);(!a||e[n.state]>e[a])&&t.set(n.id,n.state)}let s={selected:0,available:0,inactive:0};for(let n of t.values())s[n]+=1;return s}function Fo(i,e){return i.x<=e.x&&i.y<=e.y&&i.x+i.width>=e.x+e.width&&i.y+i.height>=e.y+e.height}function Nn(i,e){let t=new vs(i);return t.build(e),t}var vs=class{constructor(e){this.host=e;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(e){if(!this.host.controller.getViewport())return;let s=document.createElement("button");s.type="button",s.className="sl-minimap-toggle",s.setAttribute("aria-label",Me("picker.openVenueMap","Open venue overview map")),s.setAttribute("aria-expanded","false"),s.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',e.appendChild(s),this.miniToggle=s;let n=document.createElement("div");n.className="sl-minimap",n.setAttribute("role","group");let a=document.createElement("div");a.className="sl-minimap-bar";let o=document.createElement("span");o.className="sl-minimap-label";let r=document.createElement("span");r.className="sl-minimap-key",r.setAttribute("aria-label",Me("picker.minimapStateKey","Focused, selected, available, and inactive sections")),r.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let l=document.createElement("button");l.type="button",l.className="sl-minimap-close",l.setAttribute("aria-label",Me("picker.closeVenueMap","Close venue overview map")),l.textContent="\xD7",a.append(o,r,l);let c=document.createElement("canvas");c.tabIndex=0,c.setAttribute("role","application"),c.setAttribute("aria-label",Me("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),n.append(a,c),e.appendChild(n),this.miniWrap=n,this.miniLabel=o,this.miniCanvas=c;let d=document.createElement("canvas");this.miniBase=d,s.addEventListener("click",()=>{let b=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=b,this.setMinimapOpen(!b)}),l.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),c.addEventListener("click",b=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(b)}),c.addEventListener("pointerdown",b=>this.minimapPointerDown(b)),c.addEventListener("pointermove",b=>this.minimapPointerMove(b)),c.addEventListener("pointerup",b=>this.minimapPointerUp(b)),c.addEventListener("pointercancel",b=>this.minimapPointerUp(b)),c.addEventListener("keydown",b=>this.minimapKeydown(b)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(e){if(this.miniWrap){if(!e){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(e,t=!0){this.host.root()?.setAttribute("data-minimap-open",String(e)),this.miniToggle?.setAttribute("aria-expanded",String(e)),t&&(e?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let e=this.miniCanvas,t=this.miniBase,s=this.host.controller.getViewport()?.bounds;if(!e||!t||!s||!(s.width>0&&s.height>0))return;let n=196,a=146,o=6,r=s.width/Math.max(1,s.height),l=n,c=Math.round(n/r);c>a&&(c=a,l=Math.round(a*r)),l=Math.max(64,l),c=Math.max(48,c);let d=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(l*d),e.height=Math.round(c*d),e.style.width=`${l}px`,e.style.height=`${c}px`,t.width=e.width,t.height=e.height,this.miniTf=(0,Je.createMinimapTransform)(s,e.width,e.height,d,o)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let e=this.host.controller.getFloors(),t=this.host.controller.isFloorOverview()?Me("picker.allFloors","All floors"):e.find(d=>d.id===this.host.controller.getActiveFloorId())?.name??Me("picker.venueOverview","Venue overview"),s=this.host.controller.getMinimapSnapshot().sections,a=s.find(d=>d.active)?.label??this.host.focusedSectionLabel(),o=a?`${t} \xB7 ${a}`:t;this.miniLabel.textContent=o;let{selected:r,available:l,inactive:c}=No(s);this.miniWrap.setAttribute("aria-label",s.length?`${o}. ${r} selected, ${l} available, ${c} inactive sections.`:o),this.miniCanvas?.setAttribute("aria-label",s.length?`${o}. ${r} selected, ${l} available, ${c} inactive sections. ${Me("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${o}. ${Me("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let e=this.miniBase,t=this.miniTf;if(!e||!t)return;let s=e.getContext("2d");if(!s)return;s.clearRect(0,0,e.width,e.height);let n=b=>b*t.scale+t.offX,a=b=>b*t.scale+t.offY,o=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",r=this.host.cssVar("--sl-muted")||"#8b93a7",l=this.host.cssVar("--sl-accent")||"#6e7bff",c=this.host.cssVar("--sl-success")||"#22a06b",d=this.host.controller.getMinimapSnapshot();for(let b of d.sections){if(b.outline.length<3)continue;s.beginPath(),b.outline.forEach((u,m)=>m===0?s.moveTo(n(u.x),a(u.y)):s.lineTo(n(u.x),a(u.y))),s.closePath();let f=b.paint;if(s.globalAlpha=b.state==="inactive"?.5:.92,f?s.fillStyle=f.fill:(s.globalAlpha=b.state==="inactive"?.18:b.state==="selected"?.72:.34,s.fillStyle=b.state==="inactive"?r:b.state==="selected"?l:c),s.fill(),s.globalAlpha=.82,s.lineWidth=Math.max(1,t.dpr),s.strokeStyle=f?.stroke||o,s.stroke(),b.owned){s.globalAlpha=1,s.lineWidth=Math.max(2,t.dpr*1.5),s.strokeStyle=l,s.stroke();let u=b.outline.reduce((m,v)=>({x:m.x+v.x,y:m.y+v.y}),{x:0,y:0});s.beginPath(),s.arc(n(u.x/b.outline.length),a(u.y/b.outline.length),Math.max(1.5,t.dpr*1.6),0,Math.PI*2),s.fillStyle=l,s.fill(),s.beginPath(),b.outline.forEach((m,v)=>v===0?s.moveTo(n(m.x),a(m.y)):s.lineTo(n(m.x),a(m.y))),s.closePath()}b.active&&(s.globalAlpha=1,s.lineJoin="round",s.lineWidth=Math.max(4,t.dpr*3.5),s.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",s.stroke(),s.lineWidth=Math.max(2,t.dpr*1.75),s.strokeStyle=l,s.stroke())}if(s.globalAlpha=1,!d.sections.length){let b=Math.max(1,t.dpr),f=new Map,u=m=>{let v=f.get(m);if(v)return v;let $=this.host.tint?.(m)||c;return f.set(m,$),$};for(let m of d.seats)s.globalAlpha=m.state==="inactive"?.22:.78,s.fillStyle=m.state==="inactive"?r:m.state==="selected"?l:u(m.categoryKey),s.beginPath(),s.arc(n(m.x),a(m.y),b,0,Math.PI*2),s.fill();s.globalAlpha=1}}drawMinimapRect(){let e=this.miniCanvas,t=this.miniBase,s=this.miniTf;if(!e||!t||!s)return;let n=e.getContext("2d");if(!n)return;n.clearRect(0,0,e.width,e.height),n.drawImage(t,0,0);let a=this.host.controller.getViewport();if(!a)return;let o=Fo(a.visible,a.bounds);if(this.host.root()?.toggleAttribute("data-minimap-idle",o),o)return;let r=(0,Je.minimapViewportPlan)(a.visible,s,e.width,e.height,Math.max(2,s.dpr*2)),l=this.host.cssVar("--sl-text")||"#12151c",c=this.host.cssVar("--sl-surface")||"#fff";n.save(),n.globalAlpha=.1,n.fillStyle=l,n.fillRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),n.globalAlpha=.9,n.lineJoin="round",n.lineWidth=Math.max(4,s.dpr*3.25),n.strokeStyle=c,n.strokeRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),n.globalAlpha=1,n.lineWidth=Math.max(2,s.dpr*1.75),n.strokeStyle=l,n.strokeRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),r.clipped&&Object.values(r.clippedEdges).some(Boolean)&&(n.setLineDash([Math.max(3,s.dpr*3),Math.max(2,s.dpr*2)]),n.strokeRect(r.clipped.x,r.clipped.y,r.clipped.width,r.clipped.height)),n.restore()}minimapWorldPoint(e){let t=this.miniCanvas,s=this.miniTf;if(!t||!s)return null;let n=t.getBoundingClientRect(),a=(e.clientX-n.left)*(t.width/Math.max(1,n.width)),o=(e.clientY-n.top)*(t.height/Math.max(1,n.height));return{...(0,Je.minimapPointToWorld)({x:a,y:o},s),px:a,py:o}}minimapPointerDown(e){let t=this.minimapWorldPoint(e),s=this.host.controller.getViewport()?.visible;!t||!s||!(t.x>=s.x&&t.x<=s.x+s.width&&t.y>=s.y&&t.y<=s.y+s.height)||(this.miniDrag={pointerId:e.pointerId,offsetX:t.x-(s.x+s.width/2),offsetY:t.y-(s.y+s.height/2),startX:e.clientX,startY:e.clientY,moved:!1},this.miniCanvas?.setPointerCapture(e.pointerId),this.miniCanvas?.classList.add("sl-dragging"),e.preventDefault())}minimapPointerMove(e){let t=this.miniDrag;if(!t||t.pointerId!==e.pointerId)return;let s=this.minimapWorldPoint(e);s&&(!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>2&&(t.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:s.x-t.offsetX,y:s.y-t.offsetY}),e.preventDefault())}minimapPointerUp(e){let t=this.miniDrag;!t||t.pointerId!==e.pointerId||(this.miniSuppressClick=t.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(e.pointerId)&&this.miniCanvas.releasePointerCapture(e.pointerId))}minimapKeydown(e){let t=this.host.controller.getViewport()?.visible;if(!t)return;if(e.key==="Home"){this.host.controller.overview(),e.preventDefault();return}let s=e.key==="ArrowLeft"?-t.width*.2:e.key==="ArrowRight"?t.width*.2:0,n=e.key==="ArrowUp"?-t.height*.2:e.key==="ArrowDown"?t.height*.2:0;!s&&!n||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:t.x+t.width/2+s,y:t.y+t.height/2+n}),e.preventDefault())}minimapJump(e){let t=this.minimapWorldPoint(e);if(t){for(let s of this.host.controller.getMinimapSnapshot().sections)if(!(s.state==="inactive"||s.outline.length<3)&&(0,zn.pointInPolygon)(t,s.outline)){this.host.controller.focusSection(s.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(t)}}};function Fn(i){return i.focusedSection!==null?i.deeperThanSectionFrame===!1?"venue":"section":i.atVenueFit!==void 0?i.atVenueFit?"none":"venue":i.seatsRevealed?"venue":"none"}var qo={blocked:"all blocked",reserved:"all reserved",both:"all blocked or reserved"};function qn(i){return i.total==null||i.free==null?i.label:i.free<=0?`${i.label} \xB7 ${i.allBlocked?qo[i.allBlocked===!0?"blocked":i.allBlocked]:"sold out"}`:`${i.label} \xB7 ${i.free.toLocaleString()} of ${i.total.toLocaleString()} free`}function _n(i){let t=Fn({focusedSection:i.focused?i.focused.label:null,seatsRevealed:i.seatsRevealed,atVenueFit:i.atVenueFit})==="none";return{crumb:i.focused?i.floor?`${i.floor} \xB7 ${qn(i.focused)}`:qn(i.focused):i.floor??"Venue",crumbShown:!!i.focused||!!i.floor,zoomInEnabled:!i.atCeiling,zoomOutEnabled:!t,venueEnabled:!t}}function jn(i={}){return`
1755
+ ${Nn}${_n}`;function Kn(){if(typeof document>"u"||document.getElementById(jn))return;let i=document.createElement("style");i.id=jn,i.textContent=or,document.head.appendChild(i)}function Wn(i){if(typeof document>"u"||document.getElementById(Vn))return;let e=document.createElement("style");e.id=Vn,e.textContent=i,document.head.appendChild(e)}var Un="seatlayer-manager-extras-style";function Gn(i){if(typeof document>"u"||document.getElementById(Un))return;let e=document.createElement("style");e.id=Un,e.textContent=i,document.head.appendChild(e)}var Ao=require("@seatlayer/core/core/cdnAsset");$s();var Qn=require("@seatlayer/core"),st=require("@seatlayer/core/picker/minimapGeometry");var Zn=require("@seatlayer/core"),Jn=require("@seatlayer/core/core/cdnAsset");var ur=require("@seatlayer/core/core/cdnAsset");function Ae(i,e){let t=(0,Zn.t)(i);return t===i?e:t}function pr(i){let e={inactive:0,available:1,selected:2},t=new Map;for(let n of i){let a=t.get(n.id);(!a||e[n.state]>e[a])&&t.set(n.id,n.state)}let s={selected:0,available:0,inactive:0};for(let n of t.values())s[n]+=1;return s}function mr(i,e){return i.x<=e.x&&i.y<=e.y&&i.x+i.width>=e.x+e.width&&i.y+i.height>=e.y+e.height}function ei(i,e){let t=new Cs(i);return t.build(e),t}var Cs=class{constructor(e){this.host=e;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(e){if(!this.host.controller.getViewport())return;let s=document.createElement("button");s.type="button",s.className="sl-minimap-toggle",s.setAttribute("aria-label",Ae("picker.openVenueMap","Open venue overview map")),s.setAttribute("aria-expanded","false"),s.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',e.appendChild(s),this.miniToggle=s;let n=document.createElement("div");n.className="sl-minimap",n.setAttribute("role","group");let a=document.createElement("div");a.className="sl-minimap-bar";let o=document.createElement("span");o.className="sl-minimap-label";let r=document.createElement("span");r.className="sl-minimap-key",r.setAttribute("aria-label",Ae("picker.minimapStateKey","Focused, selected, available, and inactive sections")),r.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let l=document.createElement("button");l.type="button",l.className="sl-minimap-close",l.setAttribute("aria-label",Ae("picker.closeVenueMap","Close venue overview map")),l.textContent="\xD7",a.append(o,r,l);let c=document.createElement("canvas");c.tabIndex=0,c.setAttribute("role","application"),c.setAttribute("aria-label",Ae("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),n.append(a,c),e.appendChild(n),this.miniWrap=n,this.miniLabel=o,this.miniCanvas=c;let d=document.createElement("canvas");this.miniBase=d,s.addEventListener("click",()=>{let g=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=g,this.setMinimapOpen(!g)}),l.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),c.addEventListener("click",g=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(g)}),c.addEventListener("pointerdown",g=>this.minimapPointerDown(g)),c.addEventListener("pointermove",g=>this.minimapPointerMove(g)),c.addEventListener("pointerup",g=>this.minimapPointerUp(g)),c.addEventListener("pointercancel",g=>this.minimapPointerUp(g)),c.addEventListener("keydown",g=>this.minimapKeydown(g)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(e){if(this.miniWrap){if(!e){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(e,t=!0){this.host.root()?.setAttribute("data-minimap-open",String(e)),this.miniToggle?.setAttribute("aria-expanded",String(e)),t&&(e?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let e=this.miniCanvas,t=this.miniBase,s=this.host.controller.getViewport()?.bounds;if(!e||!t||!s||!(s.width>0&&s.height>0))return;let n=196,a=146,o=6,r=s.width/Math.max(1,s.height),l=n,c=Math.round(n/r);c>a&&(c=a,l=Math.round(a*r)),l=Math.max(64,l),c=Math.max(48,c);let d=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(l*d),e.height=Math.round(c*d),e.style.width=`${l}px`,e.style.height=`${c}px`,t.width=e.width,t.height=e.height,this.miniTf=(0,st.createMinimapTransform)(s,e.width,e.height,d,o)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let e=this.host.controller.getFloors(),t=this.host.controller.isFloorOverview()?Ae("picker.allFloors","All floors"):e.find(d=>d.id===this.host.controller.getActiveFloorId())?.name??Ae("picker.venueOverview","Venue overview"),s=this.host.controller.getMinimapSnapshot().sections,a=s.find(d=>d.active)?.label??this.host.focusedSectionLabel(),o=a?`${t} \xB7 ${a}`:t;this.miniLabel.textContent=o;let{selected:r,available:l,inactive:c}=pr(s);this.miniWrap.setAttribute("aria-label",s.length?`${o}. ${r} selected, ${l} available, ${c} inactive sections.`:o),this.miniCanvas?.setAttribute("aria-label",s.length?`${o}. ${r} selected, ${l} available, ${c} inactive sections. ${Ae("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${o}. ${Ae("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let e=this.miniBase,t=this.miniTf;if(!e||!t)return;let s=e.getContext("2d");if(!s)return;s.clearRect(0,0,e.width,e.height);let n=g=>g*t.scale+t.offX,a=g=>g*t.scale+t.offY,o=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",r=this.host.cssVar("--sl-muted")||"#8b93a7",l=this.host.cssVar("--sl-accent")||"#6e7bff",c=this.host.cssVar("--sl-success")||"#22a06b",d=this.host.controller.getMinimapSnapshot();for(let g of d.sections){if(g.outline.length<3)continue;s.beginPath(),g.outline.forEach((m,p)=>p===0?s.moveTo(n(m.x),a(m.y)):s.lineTo(n(m.x),a(m.y))),s.closePath();let b=g.paint;if(s.globalAlpha=g.state==="inactive"?.5:.92,b?s.fillStyle=b.fill:(s.globalAlpha=g.state==="inactive"?.18:g.state==="selected"?.72:.34,s.fillStyle=g.state==="inactive"?r:g.state==="selected"?l:c),s.fill(),s.globalAlpha=.82,s.lineWidth=Math.max(1,t.dpr),s.strokeStyle=b?.stroke||o,s.stroke(),g.owned){s.globalAlpha=1,s.lineWidth=Math.max(2,t.dpr*1.5),s.strokeStyle=l,s.stroke();let m=g.outline.reduce((p,f)=>({x:p.x+f.x,y:p.y+f.y}),{x:0,y:0});s.beginPath(),s.arc(n(m.x/g.outline.length),a(m.y/g.outline.length),Math.max(1.5,t.dpr*1.6),0,Math.PI*2),s.fillStyle=l,s.fill(),s.beginPath(),g.outline.forEach((p,f)=>f===0?s.moveTo(n(p.x),a(p.y)):s.lineTo(n(p.x),a(p.y))),s.closePath()}g.active&&(s.globalAlpha=1,s.lineJoin="round",s.lineWidth=Math.max(4,t.dpr*3.5),s.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",s.stroke(),s.lineWidth=Math.max(2,t.dpr*1.75),s.strokeStyle=l,s.stroke())}if(s.globalAlpha=1,!d.sections.length){let g=Math.max(1,t.dpr),b=new Map,m=p=>{let f=b.get(p);if(f)return f;let k=this.host.tint?.(p)||c;return b.set(p,k),k};for(let p of d.seats)s.globalAlpha=p.state==="inactive"?.22:.78,s.fillStyle=p.state==="inactive"?r:p.state==="selected"?l:m(p.categoryKey),s.beginPath(),s.arc(n(p.x),a(p.y),g,0,Math.PI*2),s.fill();s.globalAlpha=1}}drawMinimapRect(){let e=this.miniCanvas,t=this.miniBase,s=this.miniTf;if(!e||!t||!s)return;let n=e.getContext("2d");if(!n)return;n.clearRect(0,0,e.width,e.height),n.drawImage(t,0,0);let a=this.host.controller.getViewport();if(!a)return;let o=mr(a.visible,a.bounds);if(this.host.root()?.toggleAttribute("data-minimap-idle",o),o)return;let r=(0,st.minimapViewportPlan)(a.visible,s,e.width,e.height,Math.max(2,s.dpr*2)),l=this.host.cssVar("--sl-text")||"#12151c",c=this.host.cssVar("--sl-surface")||"#fff";n.save(),n.globalAlpha=.1,n.fillStyle=l,n.fillRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),n.globalAlpha=.9,n.lineJoin="round",n.lineWidth=Math.max(4,s.dpr*3.25),n.strokeStyle=c,n.strokeRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),n.globalAlpha=1,n.lineWidth=Math.max(2,s.dpr*1.75),n.strokeStyle=l,n.strokeRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),r.clipped&&Object.values(r.clippedEdges).some(Boolean)&&(n.setLineDash([Math.max(3,s.dpr*3),Math.max(2,s.dpr*2)]),n.strokeRect(r.clipped.x,r.clipped.y,r.clipped.width,r.clipped.height)),n.restore()}minimapWorldPoint(e){let t=this.miniCanvas,s=this.miniTf;if(!t||!s)return null;let n=t.getBoundingClientRect(),a=(e.clientX-n.left)*(t.width/Math.max(1,n.width)),o=(e.clientY-n.top)*(t.height/Math.max(1,n.height));return{...(0,st.minimapPointToWorld)({x:a,y:o},s),px:a,py:o}}minimapPointerDown(e){let t=this.minimapWorldPoint(e),s=this.host.controller.getViewport()?.visible;!t||!s||!(t.x>=s.x&&t.x<=s.x+s.width&&t.y>=s.y&&t.y<=s.y+s.height)||(this.miniDrag={pointerId:e.pointerId,offsetX:t.x-(s.x+s.width/2),offsetY:t.y-(s.y+s.height/2),startX:e.clientX,startY:e.clientY,moved:!1},this.miniCanvas?.setPointerCapture(e.pointerId),this.miniCanvas?.classList.add("sl-dragging"),e.preventDefault())}minimapPointerMove(e){let t=this.miniDrag;if(!t||t.pointerId!==e.pointerId)return;let s=this.minimapWorldPoint(e);s&&(!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>2&&(t.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:s.x-t.offsetX,y:s.y-t.offsetY}),e.preventDefault())}minimapPointerUp(e){let t=this.miniDrag;!t||t.pointerId!==e.pointerId||(this.miniSuppressClick=t.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(e.pointerId)&&this.miniCanvas.releasePointerCapture(e.pointerId))}minimapKeydown(e){let t=this.host.controller.getViewport()?.visible;if(!t)return;if(e.key==="Home"){this.host.controller.overview(),e.preventDefault();return}let s=e.key==="ArrowLeft"?-t.width*.2:e.key==="ArrowRight"?t.width*.2:0,n=e.key==="ArrowUp"?-t.height*.2:e.key==="ArrowDown"?t.height*.2:0;!s&&!n||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:t.x+t.width/2+s,y:t.y+t.height/2+n}),e.preventDefault())}minimapJump(e){let t=this.minimapWorldPoint(e);if(t){for(let s of this.host.controller.getMinimapSnapshot().sections)if(!(s.state==="inactive"||s.outline.length<3)&&(0,Qn.pointInPolygon)(t,s.outline)){this.host.controller.focusSection(s.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(t)}}};function ti(i){return i.focusedSection!==null?i.deeperThanSectionFrame===!1?"venue":"section":i.atVenueFit!==void 0?i.atVenueFit?"none":"venue":i.seatsRevealed?"venue":"none"}var gr={blocked:"all blocked",reserved:"all reserved",both:"all blocked or reserved"};function si(i){return i.total==null||i.free==null?i.label:i.free<=0?`${i.label} \xB7 ${i.allBlocked?gr[i.allBlocked===!0?"blocked":i.allBlocked]:"sold out"}`:`${i.label} \xB7 ${i.free.toLocaleString()} of ${i.total.toLocaleString()} free`}function ni(i){let t=ti({focusedSection:i.focused?i.focused.label:null,seatsRevealed:i.seatsRevealed,atVenueFit:i.atVenueFit})==="none";return{crumb:i.focused?i.floor?`${i.floor} \xB7 ${si(i.focused)}`:si(i.focused):i.floor??"Venue",crumbShown:!!i.focused||!!i.floor,zoomInEnabled:!i.atCeiling,zoomOutEnabled:!t,venueEnabled:!t}}function ii(i={}){return`
1722
1756
  <div class="slm-mapchrome" data-ref="mapchrome">
1723
1757
  ${i.legend??""}
1724
1758
  <div class="slm-zoom" role="group" aria-label="Zoom">
@@ -1727,11 +1761,11 @@ ${$n}${Cn}`;function An(){if(typeof document>"u"||document.getElementById(Mn))re
1727
1761
  <button type="button" class="slm-zoombtn slm-zoombtn-venue" data-ref="zfit" aria-label="Show the whole venue" title="Show the whole venue"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5"/></svg></button>
1728
1762
  </div>
1729
1763
  <div class="slm-minimap-mount" data-ref="minimap"></div>
1730
- </div>`}function Vn(i,e){i.crumb&&(i.crumb.textContent=e.crumb,i.crumb.hidden=!e.crumbShown);let t=(s,n)=>{s&&(s.disabled=!n,s.setAttribute("aria-disabled",String(!n)))};t(i.zin,e.zoomInEnabled),t(i.zout,e.zoomOutEnabled),t(i.zfit,e.venueEnabled)}me();var qe={plenty:{min:.5,color:"#1f9d6b",label:"Plenty left",detail:"over half"},tight:{min:.15,color:"#6cc39c",label:"Filling up",detail:"under half"},gone:{min:0,color:"#b9e2cf",label:"Nearly gone",detail:"under 15%"}},ys=[{key:"status",label:"Status",hint:"What a buyer can buy right now",dots:["#1f9d6b","#f4b740","#9ca3af"]},{key:"type",label:"Ticket type",hint:"Which ticket type each seat sells as",dots:["#bc800b","#e8456b","#2f9d46","#5b7bff"]},{key:"channel",label:"Channel",hint:"Who can sell each seat",dots:["#c9d0dc","#e8782a","#7c5cff"]}],Qe={free:"#1f9d6b",held:"#f4b740",sold:"#9ca3af",blocked:"#ffffff"};function _o(i,e){let t=e>0?i/e:0;return t>=qe.plenty.min?"plenty":t>=qe.tight.min?"tight":"gone"}function jo(i,e,t,s=Date.now()){return i?.mode==="closed"||t?"Closed":i?.mode==="timed"&&i.revealAt&&i.revealAt>s?`Hidden until ${Vo(i.revealAt,s)}`:i?.mode==="threshold"&&e?`Hidden until ${i.thresholdPct??0}% sold`:i?.mode==="hidden"||e?"Hidden":null}function Vo(i,e){let t=W(i,{hour:"numeric",minute:ye(i).minute?"2-digit":void 0}),s=(i-e)/864e5;return s<1&&ye(i).day===ye(e).day?t:s<6?`${W(i,{weekday:"short"})} ${t}`:W(i,{day:"numeric",month:"short"})}function Wn(i,e){let t=i.state==="sold-out"?e.allBlocked==="reserved"?"All reserved":e.allBlocked?"All blocked":"Sold out":jo(e.rule,e.hiddenNow,e.closedNow);return{tint:t==="All blocked"||t==="All reserved"?Qe.blocked:t==="Closed"||t==="Sold out"||e.colourBy==="channel"?null:e.colourBy==="type"?e.typeTint??null:qe[_o(i.free,i.total)].color,stateWord:t}}var Uo='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#8b5cf6" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="8.5"/><circle cx="8.5" cy="11" r="1"/><circle cx="12" cy="7.5" r="1"/><circle cx="15.5" cy="11" r="1"/></svg>';function Gn(){let i=ys.map(e=>`<button type="button" role="option" data-colour-by="${e.key}" aria-selected="false"><em>${e.dots.map(t=>`<i style="background:${t}"></i>`).join("")}</em><span><b>${e.label}</b>${e.hint}</span></button>`).join("");return`<div class="slm-blocklegend" data-ref="blocklegend" role="group" aria-label="Map colours"><button type="button" class="slm-colourby" data-ref="colourby" aria-haspopup="listbox" aria-expanded="false">${Uo}<span>Colour by</span> <b data-ref="colourname">Status</b><i aria-hidden="true">\u25BE</i></button><span class="slm-legend-items" data-ref="legenditems"></span><div class="slm-colourmenu" role="listbox" aria-label="Colour by" hidden>${i}<p>Each tool remembers its own choice. <button type="button" class="slm-howlink" data-how="colours">How colours work \u203A</button></p></div></div>`}var Ko={free:"Free: buyers can pick them now.",held:"In a cart: in buyers\u2019 carts right now.",booked:"Sold: booked by buyers.",reserved:"Reserved: kept aside under a name.",blocked:"Blocked: off sale for this event.",shown:"Shown from the page around the room."};function Un(i){let e=i.shown;return e?[...Kn(i),{label:e.name,color:"transparent",seat:!0,reserved:!0,count:e.count,key:"shown"}]:Kn(i)}function Kn(i){let e=i.seats,t=i.counts,s={label:e?"Sold":"Sold out",color:Qe.sold,seat:e,count:e?t?.booked:void 0,...e?{key:"booked"}:{}},n=t?.reserved??0,a=n?[{label:"Reserved",color:"transparent",seat:!0,reserved:!0,count:n,key:"reserved"}]:[],o={label:"Blocked",color:Qe.blocked,seat:!0,blocked:!0,count:t?t.blocked-n:void 0,key:"blocked"};if(i.colourBy==="status"&&!e)return[...Object.keys(qe).map(c=>({label:`${qe[c].label} \xB7 ${qe[c].detail}`,color:qe[c].color,seat:!1})),s];if(i.colourBy==="status")return[{label:"Free",color:Qe.free,seat:!0,count:t?.free,key:"free"},{label:"In a cart",color:Qe.held,seat:!0,count:t?.held,key:"held"},s,...a,...!t||(o.count??0)>0||i.lit==="blocked"?[o]:[]];let r=e?[{label:"In a cart",color:Qe.held,seat:!0,count:t?.held,key:"held"}]:[];return[...(i.colourBy==="channel"?i.channels??[]:i.types).map(c=>({label:c.label,color:c.color,seat:e,count:c.free,soldOut:c.free===0,...e&&"key"in c&&c.key?{key:`type:${c.key}`}:{}})),...r,s,...e?a:[]]}function Yn(i,e){let t=ys.find(o=>o.key===e.colourBy)??ys[0],s=i.querySelector('[data-ref="colourname"]');s&&(s.textContent=t.label),i.querySelectorAll("[data-colour-by]").forEach(o=>{let r=o.dataset.colourBy===e.colourBy;o.setAttribute("aria-selected",String(r)),o.classList.toggle("on",r),o.dataset.colourBy==="channel"&&(o.disabled=!e.channelAvailable,o.title=e.channelAvailable?"":"Open the Channels tool to colour by channel")});let n=i.querySelector('[data-ref="legenditems"]');if(!n)return;n.replaceChildren(...Un(e).map(o=>{let r=document.createElement(o.key?"button":"span");if(o.key){let c=e.lit===o.key;Object.assign(r,{type:"button",className:"slm-legendchip",title:`${Ko[o.key]??`${o.label}: seats that sell as ${o.label}.`}
1731
- Click to light them up \xB7 \u21E7 click to select them.`}),r.dataset.legend=o.key,r.setAttribute("aria-pressed",String(c))}let l=document.createElement("i");if(l.style.background=o.color,o.seat&&l.classList.add("seat"),o.blocked&&l.classList.add("blocked"),o.reserved&&l.classList.add("reserved"),r.append(l,document.createTextNode(o.label)),o.count!==void 0){let c=document.createElement("b");c.textContent=o.soldOut?"sold out":o.count.toLocaleString(),r.append(c)}return o.key&&e.lit===o.key&&r.insertAdjacentHTML("beforeend",'<em aria-hidden="true">\xD7</em>'),r}));let a=Un(e).find(o=>o.key&&o.key===e.lit);if(a){let o=document.createElement("span");o.className="slm-litnote",o.setAttribute("role","status"),o.textContent=`Lighting up ${a.label}${a.count!==void 0?` \xB7 ${a.count.toLocaleString()}`:""} \xB7 Esc or \xD7 to clear`,n.append(o)}}var Xn="#c026d3";function Zn(i){let e=this;e._sceneFunc(i);let t=e.attrs.reservedRadius||1,s=e.getStage(),n=Math.abs((s?s.scaleX():1)*(e.scaleX()||1))||1;if(t*1.2*n<6)return;let a=t*.34,o=-t*.44,r=t*.44;i.save(),i.setAttr("strokeStyle",Xn),i.setAttr("lineWidth",Math.max(t*.16,.75)),i.beginPath(),i.arc(0,0,t*.9,0,Math.PI*2,!1),i.stroke(),i.setAttr("fillStyle",Xn),i.beginPath(),i.moveTo(-a,o),i.lineTo(a,o),i.lineTo(a,r),i.lineTo(0,r-a*.9),i.lineTo(-a,r),i.closePath(),i.fill(),i.restore()}function It(i){return i.attrs.sceneFunc===Zn}function xs(i){It(i)&&i.setAttr("sceneFunc",void 0)}function Jn(i,e){i.attrs.reservedRadius=e>0?e:1,It(i)||i.setAttr("sceneFunc",Zn)}var Qn=i=>i.attrs?.seatId;dt();Fe();var ti=[{key:"seatLabels",label:"Seat labels",letter:"S",hint:"Seat numbers where the zoom can carry them"},{key:"rowLabels",label:"Row labels",letter:"R",hint:"Row letters beside each row"},{key:"momentum",label:"Booking momentum",letter:"M",hint:"Warm the sections booking fastest in the selected window"}],si="seatlayer.controlRoom.mapView",ni="seatlayer.controlRoom.colourBy";function ii(i){return i==="categories"?"type":i==="channels"?"channel":"status"}function ai(i=Pt()){try{let e=JSON.parse(i?.getItem(ni)??"{}"),t={};for(let[s,n]of Object.entries(e??{}))(n==="status"||n==="type"||n==="channel")&&(t[s]=n);return t}catch{return{}}}function oi(i,e=Pt()){try{e?.setItem(ni,JSON.stringify(i))}catch{}}function Bt(){return{seatLabels:!0,rowLabels:!0,categoryColours:!1,channelColours:!0,momentum:!1}}function ri(i){return i==="g"?"categoryColours":i==="h"?"channelColours":ti.find(t=>t.letter.toLowerCase()===i)?.key??null}function li(i=Pt()){let e=Bt();if(!i)return e;try{let t=i.getItem(si);if(!t)return e;let s=JSON.parse(t),n={...e};for(let a of Object.keys(e))typeof s[a]=="boolean"&&(n[a]=s[a]);return n}catch{return e}}function ci(i,e=Pt()){if(e)try{e.setItem(si,JSON.stringify(i))}catch{}}function Pt(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function di(i,e){e.renderer?.setLabelLayers?.({seatLabels:i.seatLabels,rowLabels:i.rowLabels}),e.renderer?.setCategoryColours?.(i.categoryColours),e.channelsOverlay(i.channelColours)}function hi(){return`
1764
+ </div>`}function ai(i,e){i.crumb&&(i.crumb.textContent=e.crumb,i.crumb.hidden=!e.crumbShown);let t=(s,n)=>{s&&(s.disabled=!n,s.setAttribute("aria-disabled",String(!n)))};t(i.zin,e.zoomInEnabled),t(i.zout,e.zoomOutEnabled),t(i.zfit,e.venueEnabled)}me();var Ts={plenty:{min:.5,color:"#1f9d6b",label:"Plenty left",detail:"over half"},tight:{min:.15,color:"#6cc39c",label:"Filling up",detail:"under half"},gone:{min:0,color:"#b9e2cf",label:"Nearly gone",detail:"under 15%"}},Ms=[{key:"status",label:"Status",hint:"What a buyer can buy right now",dots:["#1f9d6b","#f4b740","#9ca3af"]},{key:"type",label:"Ticket type",hint:"Which ticket type each seat sells as",dots:["#bc800b","#e8456b","#2f9d46","#5b7bff"]},{key:"price",label:"Price",hint:"What each seat costs, darker costs more",dots:["#bfd3ff","#5f88ee","#1f43a8"]},{key:"channel",label:"Channel",hint:"Who can sell each seat",dots:["#c9d0dc","#e8782a","#7c5cff"]}],ze={free:"#1f9d6b",held:"#f4b740",sold:"#9ca3af",blocked:"#ffffff"};function br(i,e){let t=e>0?i/e:0;return t>=Ts.plenty.min?"plenty":t>=Ts.tight.min?"tight":"gone"}function fr(i,e,t,s=Date.now()){return i?.mode==="closed"||t?"Closed":i?.mode==="timed"&&i.revealAt&&i.revealAt>s?`Hidden until ${ci(i.revealAt,s)}`:i?.mode==="threshold"&&e?`Hidden until ${i.thresholdPct??0}% sold`:i?.mode==="hidden"||e?"Hidden":null}function ci(i,e){let t=K(i,{hour:"numeric",minute:ke(i).minute?"2-digit":void 0}),s=(i-e)/864e5;return s<1&&ke(i).day===ke(e).day?t:s<6?`${K(i,{weekday:"short"})} ${t}`:K(i,{day:"numeric",month:"short"})}function di(i,e){let t=i.state==="sold-out"?e.allBlocked==="reserved"?"All reserved":e.allBlocked?"All blocked":"Sold out":fr(e.rule,e.hiddenNow,e.closedNow),s=t==="All blocked"||t==="All reserved"?ze.blocked:t==="Closed"||t==="Sold out"||e.colourBy==="channel"?null:e.colourBy==="type"||e.colourBy==="price"?e.typeTint??null:Ts[br(i.free,i.total)].color,n=e.rule,a=Date.now(),o=n?.mode==="timed"&&n.revealAt&&n.revealAt>a?` \xB7 opens ${ci(n.revealAt,a)}`:"",r=t==="Sold out"?"SOLD OUT":t==="All blocked"?"BLOCKED":t==="All reserved"?"RESERVED":t==="Closed"||o?`CLOSED${o}`:"";return r?{tint:s,stateWord:t,caption:r,solid:t==="Sold out",hatch:s===ze.blocked}:{tint:s,stateWord:t}}var vr='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#8b5cf6" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="8.5"/><circle cx="8.5" cy="11" r="1"/><circle cx="12" cy="7.5" r="1"/><circle cx="15.5" cy="11" r="1"/></svg>';function hi(){let i=Ms.map(e=>`<button type="button" role="option" data-colour-by="${e.key}" aria-selected="false"><em>${e.dots.map(t=>`<i style="background:${t}"></i>`).join("")}</em><span><b>${e.label}</b>${e.hint}</span></button>`).join("");return`<div class="slm-blocklegend" data-ref="blocklegend" role="group" aria-label="Map colours"><button type="button" class="slm-colourby" data-ref="colourby" aria-haspopup="listbox" aria-expanded="false">${vr}<span>Colour by</span> <b data-ref="colourname">Status</b><i aria-hidden="true">\u25BE</i></button><span class="slm-legend-items" data-ref="legenditems"></span><div class="slm-colourmenu" role="listbox" aria-label="Colour by" hidden>${i}<p>Each task remembers its own choice. <button type="button" class="slm-howlink" data-how="colours">How colours work \u203A</button></p></div></div>`}var oi={free:"buyers can pick them now",held:"in buyers\u2019 carts right now",booked:"booked by buyers",reserved:"kept aside under a name",blocked:"off sale for this event",shown:"shown from the page around the room"};function ri(i){let e=i.shown;return e?[...li(i),{label:e.name,color:"transparent",seat:!0,reserved:!0,count:e.count,key:"shown"}]:li(i)}function li(i){let e=i.seats,t=i.counts,s={label:e?"Sold":"Sold out",color:ze.sold,seat:e,count:e?t?.booked:void 0,...e?{key:"booked"}:{}},n=t?.reserved??0,a=n?[{label:"Reserved",color:"transparent",seat:!0,reserved:!0,count:n,key:"reserved"}]:[],o={label:"Blocked",color:ze.blocked,seat:!0,blocked:!0,count:t?t.blocked-n:void 0,key:"blocked"};if(i.colourBy==="status")return[{label:"Free",color:ze.free,seat:!0,count:t?.free,key:"free"},{label:"In a cart",color:ze.held,seat:!0,count:t?.held,key:"held"},{label:"Sold",color:ze.sold,seat:!0,count:t?.booked,key:"booked"},...a,...!t||(o.count??0)>0||i.lit==="blocked"?[o]:[]];let r=e?[{label:"In a cart",color:ze.held,seat:!0,count:t?.held,key:"held"}]:[];return[...(i.colourBy==="channel"?i.channels??[]:i.types).map(c=>{let d=c.key;return{label:c.label,color:c.color,seat:e,count:c.free,soldOut:c.free===0,...e&&d?{key:d.startsWith("price:")?d:`type:${d}`}:{}}}),...r,s,...e?a:[]]}function ui(i,e){let t=Ms.find(o=>o.key===e.colourBy)??Ms[0],s=i.querySelector('[data-ref="colourname"]');s&&(s.textContent=t.label),i.querySelectorAll("[data-colour-by]").forEach(o=>{let r=o.dataset.colourBy===e.colourBy;o.setAttribute("aria-selected",String(r)),o.classList.toggle("on",r),o.dataset.colourBy==="channel"&&(o.disabled=!e.channelAvailable,o.title=e.channelAvailable?"":"Open the Channels tool to colour by channel")});let n=i.querySelector('[data-ref="legenditems"]');if(!n)return;n.replaceChildren(...ri(e).map(o=>{let r=document.createElement(o.key?"button":"span"),l=null;if(o.key){let d=e.lit===o.key,g=oi[o.key],b=o.count===void 0?"":`${o.count.toLocaleString()} ${g?o.label.toLowerCase():"free"}`,m=`${b?" \xB7 ":""}${g??`seats that ${o.key.startsWith("price:")?"cost":"sell as"} ${o.label}`}.
1765
+ Click to light them up \xB7 \u21E7 click to select them.`;Object.assign(r,{type:"button",className:"slm-legendchip"}),r.dataset.legend=o.key,r.setAttribute("aria-description",b+m),l=document.createElement("span"),l.className="tip",l.setAttribute("aria-hidden","true"),l.append(Object.assign(document.createElement("b"),{textContent:b}),m),r.setAttribute("aria-pressed",String(d))}let c=document.createElement("i");if(c.style.background=o.color,o.seat&&c.classList.add("seat"),o.blocked&&c.classList.add("blocked"),o.reserved&&c.classList.add("reserved"),r.append(c,document.createTextNode(o.label)),o.count!==void 0){let d=document.createElement("b");d.textContent=o.count<0?"no seats yet":o.soldOut?"sold out":o.count.toLocaleString(),r.append(d)}return o.key&&e.lit===o.key&&r.insertAdjacentHTML("beforeend",'<em aria-hidden="true">\xD7</em>'),l&&r.append(l),r})),(e.colourBy==="type"||e.colourBy==="price")&&n.insertAdjacentHTML("afterbegin","<small>Free</small>");let a=ri(e).find(o=>o.key&&o.key===e.lit);if(a){let o=document.createElement("span");o.className="slm-litnote",o.setAttribute("role","status"),o.textContent=e.picked!=null?`\u21E7 click selected all ${e.picked.toLocaleString()} ${oi[a.key]?a.label.toLowerCase():a.label} seats`:`Lighting up ${a.label}${a.count!==void 0?` \xB7 ${a.count.toLocaleString()}`:""} \xB7 Esc or \xD7 to clear`,n.append(o)}}var pi="#c026d3";function mi(i){let e=this;e._sceneFunc(i);let t=e.attrs.reservedRadius||1,s=e.getStage(),n=Math.abs((s?s.scaleX():1)*(e.scaleX()||1))||1;if(t*1.2*n<6)return;let a=t*.34,o=-t*.44,r=t*.44;i.save(),i.setAttr("strokeStyle",pi),i.setAttr("lineWidth",Math.max(t*.16,.75)),i.beginPath(),i.arc(0,0,t*.9,0,Math.PI*2,!1),i.stroke(),i.setAttr("fillStyle",pi),i.beginPath(),i.moveTo(-a,o),i.lineTo(a,o),i.lineTo(a,r),i.lineTo(0,r-a*.9),i.lineTo(-a,r),i.closePath(),i.fill(),i.restore()}function zt(i){return i.attrs.sceneFunc===mi}function Es(i){zt(i)&&i.setAttr("sceneFunc",void 0)}function gi(i,e){i.attrs.reservedRadius=e>0?e:1,zt(i)||i.setAttr("sceneFunc",mi)}var bi=i=>i.attrs?.seatId;nt();Ve();var fi=[{key:"seatLabels",label:"Seat labels",letter:"S",hint:"Seat numbers where the zoom can carry them"},{key:"rowLabels",label:"Row labels",letter:"R",hint:"Row letters beside each row"},{key:"momentum",label:"Booking momentum",letter:"M",hint:"Warm the sections booking fastest in the selected window"}],vi="seatlayer.controlRoom.mapView",yi="seatlayer.controlRoom.colourBy";function xi(i){return i==="categories"?"type":i==="channels"?"channel":"status"}function ki(i=Nt()){try{let e=JSON.parse(i?.getItem(yi)??"{}"),t={};for(let[s,n]of Object.entries(e??{}))(n==="status"||n==="type"||n==="price"||n==="channel")&&(t[s]=n);return t}catch{return{}}}function wi(i,e=Nt()){try{e?.setItem(yi,JSON.stringify(i))}catch{}}function Ft(){return{seatLabels:!0,rowLabels:!0,categoryColours:!1,channelColours:!0,momentum:!1}}function Si(i){return i==="g"?"categoryColours":i==="h"?"channelColours":fi.find(t=>t.letter.toLowerCase()===i)?.key??null}function Li(i=Nt()){let e=Ft();if(!i)return e;try{let t=i.getItem(vi);if(!t)return e;let s=JSON.parse(t),n={...e};for(let a of Object.keys(e))typeof s[a]=="boolean"&&(n[a]=s[a]);return n}catch{return e}}function $i(i,e=Nt()){if(e)try{e.setItem(vi,JSON.stringify(i))}catch{}}function Nt(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Ci(i,e){e.renderer?.setLabelLayers?.({seatLabels:i.seatLabels,rowLabels:i.rowLabels}),e.renderer?.setCategoryColours?.(i.categoryColours),e.channelsOverlay(i.channelColours)}function Ti(){return`
1732
1766
  <details class="slm-view" data-ref="view">
1733
1767
  <summary class="slm-barbtn slm-view-summary" aria-haspopup="menu" aria-label="View" title="How the map reads: labels, colours, momentum"><span class="slm-view-eye" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#3b82f6" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z"/><circle cx="12" cy="12" r="3"/></svg></span><span class="slm-view-text">View</span> <span class="slm-view-caret" aria-hidden="true">\u25BE</span></summary>
1734
- <div class="slm-view-menu" role="menu" aria-label="Map view">${ti.map(e=>`
1768
+ <div class="slm-view-menu" role="menu" aria-label="Map view">${fi.map(e=>`
1735
1769
  <button type="button" class="slm-view-item" role="menuitemcheckbox" data-view="${e.key}" aria-checked="false" title="${e.hint}">
1736
1770
  <span class="slm-view-check" aria-hidden="true"></span>
1737
1771
  <span class="slm-view-label">${e.label}</span>
@@ -1743,16 +1777,16 @@ Click to light them up \xB7 \u21E7 click to select them.`}),r.dataset.legend=o.k
1743
1777
  </button>
1744
1778
  <div class="slm-view-note" data-ref="viewnote" hidden></div>
1745
1779
  </div>
1746
- </details>`}function ui(i,e,t){let s=Bt(),n=!1;i.querySelectorAll("[data-view]").forEach(o=>{let r=o.dataset.view,l=e[r];o.setAttribute("aria-checked",String(l)),o.classList.toggle("on",l),l!==s[r]&&(n=!0)}),i.querySelector("summary")?.classList.toggle("away",n);let a=i.querySelector('[data-ref="viewnote"]');a&&(a.hidden=!t.momentumLoading,a.textContent=t.momentumLoading?"Booking momentum: loading the first snapshot\u2026":"")}pe();ds();var mi=require("@seatlayer/core");function ks(i){return Object.entries(i).filter(([,e])=>e.mode==="closed").map(([e])=>e)}function ws(i){let e=i.sectionsBase;if(!e)return{rows:[],hiddenSections:0,closedSections:0};let t=i.doc?.zones??[],s=new Map,n=[];for(let c of e.sections)if(c.zone&&t.some(d=>d.id===c.zone)){let d=s.get(c.zone)??[];d.push(c),s.set(c.zone,d)}else n.push(c);let a=[],o=0,r=0,l=(c,d,b,f=!1,u)=>{let m=i.availabilityRules[d.id]??null,v=i.effectiveClosed.has(d.id)||f,$=i.effectiveHidden.has(d.id)||b&&!v;c==="section"&&$&&(o+=1),c==="section"&&v&&(r+=1),a.push({kind:c,id:d.id,label:d.label,seatCount:d.seatCount,seatLabels:d.seatLabels,rule:m,hidden:$,closed:v,followsZone:c==="section"&&b,...u?{zoneId:u}:{}})};for(let c of t){let d=s.get(c.id);if(!d||!d.length)continue;let b={id:c.id,label:c.label||"Zone",seatCount:d.reduce((m,v)=>m+v.seatCount,0),seatLabels:d.flatMap(m=>m.seatLabels)},f=!!i.availabilityRules[c.id],u=i.availabilityRules[c.id]?.mode==="closed";l("zone",b,!1);for(let m of d)l("section",m,f,u,c.id)}for(let c of n)l("section",c,!1);if(e.ungrouped){let c=e.ungrouped;l("section",{id:mi.UNGROUPED_ID,label:c.label,seatCount:c.seatCount,seatLabels:c.seatLabels},!1)}return{rows:a,hiddenSections:o,closedSections:r}}me();var cl="https://api.seatlayer.io",is=200,Qa=16,eo=4,no=[{key:"watch",label:"Watch",tools:[{mode:"view",label:"Watch",shortcut:"M",title:"See what is selling, where buyers are, and answer questions about any seat."}]},{key:"manage",label:"Manage",tools:[{mode:"reserve",label:"Reserve",shortcut:"R",title:"Keep seats aside under a name (guests, press, comps) until you release them or the time runs out."},{mode:"block",label:"Block",shortcut:"B",title:"Take seats off sale for this event, or put them back."},{mode:"categories",label:"Ticket types",shortcut:"G",title:"Change which ticket type seats sell as, for this event only."},{mode:"sections",label:"Sections",shortcut:"S",title:"Open, close or hide sections for this event, on a schedule or on demand."},{mode:"tables",label:"Tables",shortcut:"T",title:"Sell each table per chair or as one whole-table booking."},{mode:"channels",label:"Channels",shortcut:"C",title:"Allocate inventory to sales channels and share their links."}]},{key:"host",label:"Host tools",tools:[{mode:"select",label:"Select",shortcut:"X",title:"Select seats for your own back-office operation. The selection is handed to your app; nothing changes here."},{mode:"filterSections",label:"Filter",shortcut:"L",title:"Filter the map to one section for your own reporting."}]}],dl=3;function Gs(i){return i==="resale"?"booked":i==="held"||i==="booked"||i==="blocked"?i:"free"}function hl(i){let e=i?.status;return e===401||e===403}var to=i=>`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${i}</svg>`,Ys={enter:to('<path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5"/>'),exit:to('<path d="M9 4v5H4M20 9h-5V4M15 20v-5h5M4 15h5v5"/>')},ul=Object.fromEntries(no.flatMap(i=>i.tools.map(e=>[e.shortcut.toLowerCase(),e.mode]))),fe=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,xt=i=>W(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),as=class{constructor(e){this.els={};this.renderer=null;this.doc=null;this.selectObserver=null;this.seatHistoryPanel=null;this.changes=null;this.changesLoading=null;this.feedFilter="all";this.saved=null;this.savedCount=null;this.savedApplied=null;this.arrival=[];this.activityPanel=null;this.navigation=null;this.movingMap=!1;this.marqueeShape="box";this.socketSnapshotSeen=!1;this.monitorRefreshTimer=null;this.themeMode=null;this.colorSchemeStop=null;this.inventoryModelVersion=1;this.selectableObjectLabels=new Set;this.unavailableLabels=new Set;this.lastSelectionLabels=new Set;this.selBack=[];this.selAhead=[];this.selRestoring=!1;this.selectionWasValid=null;this.initialSelectionApplied=!1;this.labelToId=new Map;this.labelToSeat=new Map;this.allIds=[];this.gaUnitLabelSet=new Set;this.tableChairIds=new Map;this.labelNames=new Map;this.status=new Map;this.counts={held:0,booked:0,blocked:0};this.modelSynced=!1;this.controlRoomSettled=!1;this.currency="USD";this.authoritativeCurrency=null;this.authoritativeGrossRevenue=0;this.revenueStatus="loading";this.revenueRequest=0;this.controlRoomSnapshot=null;this.serverBaseline=null;this.reservationsLoaded=!1;this.livePresence=null;this.liveGross=null;this.paintHandle=null;this.trendWindowMinutes=15;this.heatEnabled=!1;this.mapView=Bt();this.categoryChoice=null;this.lastSectionTap=null;this.press=null;this.lastPick=null;this.categoryBusy=!1;this.blockBusy=!1;this.panelAlert=null;this.categoryTotalsCache=null;this.rowLabelCache=null;this.colourChoices={};this.extras=null;this.reserve=null;this.alerts=null;this.sectionsPanel=null;this.tablesPanel=null;this.findBlocked=null;this.reservedBy=new Map;this.reserving=new Set;this.reservedIds=new Set;this.reservationsTimer=null;this.blockGroups=null;this.eventStartsAt=null;this.search=null;this.searchSeatList=null;this.minimap=null;this.lastKpiValues=new Map;this.activeKpiDeltas=new Map;this.ws=null;this.reconnectTimer=null;this.pingTimer=null;this.pongTimer=null;this.attempt=0;this.closed=!1;this.connectionStatus="reconnecting";this.lastMessageAt=null;this.ready=!1;this.feed=[];this.feedTimer=null;this.toastTimer=null;this.liveEventTimer=null;this.kpiCleanupTimer=null;this.followLiveTimer=null;this.followSeatTimer=null;this.releaseAt=null;this.blockEnd="never";this.blockDone=null;this.blockFailedNow=!1;this.layoutObserver=null;this.chromeClearance=-1;this.chromeClearanceWidth=-1;this.legendInset="";this.tokenExpiresAt=null;this.tokenRefreshTimer=null;this.tokenRefreshInFlight=!1;this.tokenRefreshFailures=0;this.sessionEnded=!1;this.taskGroups=[];this.taskMenuOpen=!1;this.detents=new Map;this.linkState="live";this.linkTimers=null;this.everLive=!1;this.announcedRoomState=null;this.sectionByObject=new Map;this.sectionLabelById=new Map;this.sectionsBase=null;this.filteredSectionLabel=null;this.availabilityRules={};this.effectiveHidden=new Set;this.effectiveClosed=new Set;this.lastSyncedAt=null;this.blockBrowse=!1;this.channels=null;this.chooser=null;this.chooserDialog=null;this.extrasReady=null;this.categoryDifferences=null;this.channelCaps={view:!1,manage:!1};this.categoryCanManage=!1;this.tableCanManage=!1;this.tableBookingSaving=!1;this.channelCapabilityResolution=0;this.channelsLoading=null;this.onFullscreenChange=()=>{this.paintFullscreenButton(),this.paintFullscreenLine(),this.updateContainerLayout(),this.renderer?.forceDraw()};this.onKeyDown=e=>{if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),this.openSearch();return}let s=!!e.target?.closest('input,select,textarea,[contenteditable="true"]');if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="z"){!s&&this.stepSelection(e.shiftKey?1:-1)&&e.preventDefault();return}if(e.metaKey||e.ctrlKey||e.altKey||s)return;let n=e.key.toLowerCase();if(/^[1-9]$/.test(n)){let r=this.taskGroups.flatMap(l=>l.tools)[Number(n)-1];r&&(this.setMode(r.mode),e.preventDefault());return}if((n==="l"||n==="v")&&!e.shiftKey&&this.isBulkSelectMode()){this.navigation?.choose(n==="l"?"lasso":"select"),e.preventDefault();return}let a=e.shiftKey?ri(n):null;if(a){this.toggleMapView(a),e.preventDefault();return}if(n==="/"){e.preventDefault(),this.openSearch();return}let o=ul[n];if(o){if(!this.toolAvailable(o))return;this.setMode(o)}else if(n==="f")this.toggleFullscreen();else if(n==="escape"){let r=this.els.view;if(r?.open)r.open=!1,r.querySelector("summary")?.focus();else if(this.litChip)this.onLegendChip(this.litChip,!1);else if(this.taskMenuOpen)this.taskMenuOpen=!1,this.paintTaskPicker(),this.els.taskpick?.querySelector("[data-taskpick]")?.focus();else if(!this.channels?.handleBack())if(this.isSheet()&&this.sheetDetent()==="full")this.setDetent("half");else if(this.getSelection().length)this.clearSelection();else return}else return;e.preventDefault()};this.onSelectAllKey=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey||e.key.toLowerCase()!=="a"||e.target?.closest('input,select,textarea,[contenteditable="true"]')||(e.preventDefault(),e.stopPropagation(),this.isBulkSelectMode()?this.selectInView():this.mode==="select"&&this.selectAll())};this.onHowClick=e=>{let t=e.target?.closest("[data-how]")?.dataset.how;if(!t)return;let n=t==="current"?{view:"watch",reserve:"reserve",block:"block",categories:"types",sections:"sections",tables:"tables",channels:"channels"}[this.mode]??"watch":t;this.loadExtras().then(a=>{this.closed||!this.root||a.openExplainer({root:this.root,plate:J,touch:Ge(),guideUrl:"https://docs.seatlayer.io/platform/embedded-control-room/#operator-modes",tryIt:o=>{let r={watch:"view",reserve:"reserve",block:"block",types:"categories",sections:"sections",tables:"tables",channels:"channels"};o==="search"?this.openSearch():o==="colours"?this.root?.querySelector('[data-ref="colourby"]')?.click():r[o]&&r[o]!==this.mode&&this.toolAvailable(r[o])&&this.setMode(r[o])}},n)}).catch(a=>this.opts.onError?.(a))};this.onRailClick=e=>{let t=e.target,s=t?.closest("[data-section-focus]");if(s?.dataset.sectionFocus){this.locateSection(s.dataset.sectionFocus);return}let n=t?.closest("[data-feed-id]");n?.dataset.feedId&&this.locateActivity(n.dataset.feedId),t?.closest("[data-sel-clear]")&&this.clearSelection(),t?.closest("[data-sel-all]")&&this.selectAll(),t?.closest("[data-sel-undo]")&&this.stepSelection(-1),t?.closest("[data-sel-save]")&&this.ensureSaved().then(o=>o?.openSave());let a=t?.closest("[data-sel-similar]");a&&this.openSimilar(a),t?.closest("[data-saved-list], [data-saved-open]")&&this.ensureSaved().then(o=>o?.openList())};this.bandIndex=null;this.typeKeyBySection=null;this.typeKeyBase=null;this.legendSeats=null;this.litChip=null;this.shownObjects=null;this.barNeed=[0,0,0];this.sectionOptions=[];this.addByPinned=!1;us(e.token),this.assertSelectionOptions(e.maxSelectedObjects,e.numberOfPlacesToSelect),this.opts=e,this.key=e.eventKey,this.mode=e.mode??"view",this.selectableObjectLabels=new Set(e.selectableObjects??[]),this.unavailableLabels=new Set(e.unavailableObjects??[]),this.categoryCanManage=new Set(e.capabilities??[]).has("event:categories:manage"),this.tableCanManage=new Set(e.capabilities??[]).has("event:tables:manage"),this.keepLive=e.keepLiveWhileHidden??!0,Qs(e.timeZone),this.themeMode=e.themeMode??null,this.followLive=e.followLive??!1,this.currency=e.currency??"USD",this.tokenExpiresAt=e.tokenExpiresAt??null,this.api=new Xe(e.apiBase??cl,e.token),this.organizerAssetUrls=new At(this.key,(t,s)=>this.withAuthRetry(()=>this.api.asset(t,s))),this.host=an(e.container)}selectInView(){let e=this.renderer?.getVisibleWorldRect?.();if(!e)return;let t=[...this.labelToSeat.values()].filter(s=>s.x>=e.x&&s.x<=e.x+e.width&&s.y>=e.y&&s.y<=e.y+e.height);this.renderer?.selectByLabels(t.map(s=>s.label)),this.syncSelection()}assertSelectionOptions(e,t){let s=n=>n===void 0||Number.isInteger(n)&&n>0;if(!s(e))throw new TypeError("maxSelectedObjects must be a positive integer");if(!s(t))throw new TypeError("numberOfPlacesToSelect must be a positive integer");if(e!==void 0&&t!==void 0&&e<t)throw new TypeError("maxSelectedObjects cannot be lower than numberOfPlacesToSelect")}async render(){return An(),this.buildChrome(),await this.load(),this}async load(){try{let e=await this.withAuthRetry(()=>this.api.chart(this.key));this.inventoryModelVersion=e.event.inventoryModelVersion===2?2:1,this.eventStartsAt=e.event.startsAt??null,this.doc=await this.organizerAssetUrls.prepareRendererChart(e.doc),this.authoritativeCurrency=e.event.currency??null,this.currency=this.authoritativeCurrency??this.opts.currency??this.currency,this.buildUnitUniverse(this.doc),this.buildRenderer(),this.buildSectionOptions(),this.settleMode();let[,t]=await Promise.all([this.resnapshot(),this.refreshControlRoom().catch(s=>this.opts.onError?.(s)),this.refreshAvailability()]);t?.activity?this.seedFeed(t.activity):this.api.log(this.key,{limit:24}).then(s=>{this.adoptLabelNames(s.displayLabels),this.seedFeed(s.entries)}).catch(()=>{}),this.connect(),this.startFeedClock(),this.ready=!0,await this.resolveChannelCapabilities(),this.setMode(this.mode),this.root?.querySelector('[data-ref="opening"]')?.remove(),this.applyInitialSelection(),this.scheduleTokenRefresh(),this.opts.onReady?.(),this.mountAlerts(),this.ensureSaved().then(s=>s?.refresh()),this.withExtras(()=>{}),(this.opts.focusSection||this.opts.focusSeat||this.opts.focusSeats?.length||this.opts.focusCategory||this.opts.arrivedFrom||this.opts.onOpenTrend&&this.opts.kpis!==!1)&&this.mountArrival()}catch(e){this.fail(e)}}setMode(e){e==="inspect"&&(e="view"),this.toolAvailable(e)||(e="view"),e==="channels"&&!this.channels&&this.ensureChannels();let t=e!==this.mode,s=this.mode==="channels",n=this.mode==="filterSections";this.mode=e,t&&e!=="view"&&this.setFollowLive(!1),t&&this.navigation?.resetTool(),!this.renderer&&this.doc?this.buildRenderer():this.updateRendererInteraction(),t&&(this.renderer?.clearSelection(),this.syncSelection(),this.selBack=[],this.selAhead=[],this.navigation?.historyChanged(!1,!1)),s&&e!=="channels"&&this.channels?.leave(),t&&(this.litChip=null,this.highlightLabels(null),this.wireBarFind()),this.paintModeTabs();let a=!t&&(e==="tables"?this.tablesPanel:e==="sections"?this.sectionsPanel:null);a?a.update():this.paintRail(),this.applyDetent(),t&&this.setColourBy(this.colourChoices[e]??this.startingColourBy(e),!1),this.paintMapViewMenu(),this.applyMapView(),this.applySectionCanvasTreatment(),n&&e!=="filterSections"&&this.renderer?.zoomToFit(),e==="channels"&&this.channels?.enter(),e==="select"&&this.applyInitialSelection(),t&&this.opts.onModeChange?.(e)}async resolveChannelCapabilities(){let e=++this.channelCapabilityResolution,t=this.opts.capabilities,s;if(t){let n=new Set(t);s={view:n.has("event:channels:view"),manage:n.has("event:channels:view")&&n.has("event:channels:manage")}}else s={view:!1,manage:!1};if(!s.view&&!t)try{await this.api.channels(this.key),s={view:!0,manage:!1}}catch{s={view:!1,manage:!1}}if(e===this.channelCapabilityResolution){if(this.channelCaps=s,!this.channelCaps.view){this.channels?.destroy(),this.channels=null,this.mode==="channels"?this.setMode("view"):this.paintModeTabs();return}this.channels?.setCapabilities(this.channelCaps),this.paintModeTabs()}}ensureChannels(){if(this.channelsLoading)return this.channelsLoading;if(this.channels)return Promise.resolve();let e=(async()=>{try{let t=await Promise.resolve().then(()=>(Ms(),Ii));if(this.closed||!this.channelCaps.view||(this.channels||(Hn(t.CHANNELS_CSS),this.channels=new t.ChannelsMode(this.buildChannelsHost(),this.channelCaps),this.channels.onInteractionChange=()=>this.updateRendererInteraction()),this.mode!=="channels"))return;this.updateRendererInteraction(),this.paintRail(),this.channels.enter(),this.setColourBy(this.colourChoices.channels??this.startingColourBy("channels"),!1)}catch(t){if(this.closed)return;this.channelsLoading=null,this.mode==="channels"&&this.paintRail(),this.opts.onError?.(t)}})();return this.channelsLoading=e,e}buildChooserHost(){let e=s=>{let n=this.labelToSeat.get(s);return n?this.mode==="block"?this.isBlockSelectable(s):this.mode==="reserve"?this.isReserveSelectable(s):this.mode==="select"?this.canSelectObject(n):!0:!1};return{selectionLabels:()=>this.selectionLabels(),selectByLabels:s=>{this.selectByLabels(s)},clearSelection:()=>this.clearSelection(),selectSection:s=>{this.selectSection(s)},sections:()=>this.sectionOptions,sectionInfo:s=>{let n=this.filterableSections().find(o=>o.id===s),a=this.sectionTypeKeys().get(s);return{total:n?.seatCount??0,color:this.doc?.categories.find(o=>o.key===a)?.color}},labelsInSection:s=>(this.renderer?.getSelectableInSection(s)??[]).map(n=>n.label).filter(e),rows:()=>{let s=new Map((this.doc?.objects??[]).map(a=>[a.id,a])),n=new Map;for(let a of this.labelToSeat.values()){let o=s.get(a.rowId);if(!o||o.type!=="row"&&o.type!=="table")continue;let r=a.logicalRowId??a.rowId,l=this.sectionByObject.get(a.rowId)??U.UNGROUPED_ID,c=n.get(r)??{id:r,label:o.type==="row"?o.segmentedRow?.displayLabel??o.displayLabel??o.label:o.displayLabel??o.label,sectionId:l,sectionLabel:this.sectionLabelById.get(l)??"Other seats",labels:[],all:[]};c.all.push(a.label),e(a.label)&&c.labels.push(a.label),n.set(r,c)}return[...n.values()].sort((a,o)=>a.sectionLabel.localeCompare(o.sectionLabel,void 0,{numeric:!0,sensitivity:"base"})||a.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"}))},categories:()=>(this.doc?.categories??[]).map(s=>({key:s.key,label:s.label??s.key,color:s.color,total:this.categoryTotals().get(s.key)??0})),labelsInCategory:s=>[...this.labelToSeat.values()].filter(n=>n.categoryKey===s&&e(n.label)).map(n=>n.label),seats:()=>[...this.labelToSeat.values()].filter(s=>e(s.label)).map(s=>({label:s.label})),statusOf:s=>this.status.get(s)??(this.labelToSeat.has(s)?"free":void 0),sectionOfLabel:s=>{let n=this.labelToSeat.get(s);if(!n)return null;let a=this.sectionByObject.get(n.rowId)??U.UNGROUPED_ID;return{id:a,label:this.sectionLabelById.get(a)??"Other seats"}},openDialog:(s,n)=>{this.chooserDialog=yn(this.root,s,n,{previous:this.chooserDialog,onClose:()=>{this.chooserDialog=null}})},closeDialog:()=>this.chooserDialog?.close(),enhanceDialog:s=>this.withExtras(n=>n.pickerKeys(s)),pickers:()=>this.extrasReady??this.loadExtras().then(s=>this.extrasReady=s),pickerFailed:s=>this.pickerFailed(s),highlight:s=>this.highlightLabels(s),...this.mode==="select"?{cap:this.selectionCap()}:{}}}wireBarFind(){let e=this.els.findbar;!e||e.dataset.wired||(e.dataset.wired="1",e.innerHTML=`<button type="button" class="slm-findtrigger" aria-keyshortcuts="Meta+K Control+K"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#4c6fff" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg><span>Seat, row, section or booking</span><kbd>${$t()}</kbd></button>`,e.querySelector("button").addEventListener("click",()=>{this.openSearch()}))}async loadExtras(){if(!this.extras){let t=typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?(0,so.importCdnAsset)("seatlayer-manager-extras.mjs"):Promise.resolve().then(()=>(Ja(),Za));this.extras=t.catch(s=>{throw this.extras=null,s})}let e=await this.extras;return In(e.EXTRAS_CSS),e}withExtras(e){this.loadExtras().then(t=>{this.extrasReady=t,this.closed||e(t)},()=>{})}pickerFailed(e){this.toast("Couldn't open that list. Check the connection.","err",{label:"Try again",run:e})}async openSearch(e=""){try{let t=await this.loadExtras();if(this.closed||!this.root)return;this.search?.close(),this.search=t.openEventSearch({root:this.root,seats:()=>this.searchSeats(),statusOf:s=>this.status.get(s)??"free",describe:s=>{let n=this.doc?.categories.find(a=>a.key===this.labelToSeat.get(s)?.categoryKey);return n?`${n.label}${typeof n.price=="number"?` ${Ie(n.price,this.currency)}`:""}`:""},canSelect:()=>this.isChoosingTool(),show:s=>this.showLabels(s),select:s=>{this.selectByLabels(s)},lookupOrders:this.canReadOrders()?s=>this.api.lookupOrders(this.key,s):void 0,openOrder:this.opts.onOpenOrder?s=>this.opts.onOpenOrder(s):void 0,blockReasons:()=>this.blockGroups?new Set(this.blockGroups.groups.map(s=>s.reason??"")).size:null,blockedBy:s=>{let n=s.trim().toLowerCase();return n.length<3?[]:(this.blockGroups?.groups??[]).filter(a=>a.reason&&a.reason.toLowerCase().includes(n)).map(a=>({reason:a.reason,labels:a.labels}))},saved:()=>this.saved?.rows()??null,useSaved:(s,n)=>{this.saved?.use(s,n)},reserved:()=>{!this.blockGroups&&this.toolAvailable("block")&&this.loadBlockGroups().catch(()=>{});let s=[...this.reservedBy.keys()].filter(n=>this.status.get(n)==="blocked");return{labels:s,count:new Set(s.map(n=>this.reservedBy.get(n).id)).size}},recents:{read:()=>{try{return JSON.parse(localStorage.getItem(`seatlayer.controlRoom.search.${this.key}`)??"[]")}catch{return[]}},write:s=>{try{localStorage.setItem(`seatlayer.controlRoom.search.${this.key}`,JSON.stringify(s))}catch{}}}},e)}catch(t){this.toastErr("Search could not load. Check the connection and try again."),this.opts.onError?.(t)}}canReadOrders(){return this.opts.capabilities?.includes("event:orders:read")===!0}searchSeats(){if(this.searchSeatList?.base===this.sectionsBase)return this.searchSeatList.seats;let e=new Map;for(let s of this.doc?.objects??[])s.type==="row"?e.set(s.id,s.segmentedRow?.displayLabel??s.displayLabel):s.type==="table"&&e.set(s.id,s.displayLabel);let t=[];for(let s of this.labelToSeat.values()){let n=this.sectionByObject.get(s.rowId)??U.UNGROUPED_ID;t.push({label:s.label,sectionId:n,sectionLabel:this.sectionLabelById.get(n)??"Other seats",rowKey:s.logicalRowId??s.rowId,rowDisplay:e.get(s.rowId)})}return this.searchSeatList={base:this.sectionsBase,seats:t},t}isChoosingTool(){return this.isBulkSelectMode()||this.mode==="select"}frameLabels(e){let t=e.map(s=>this.labelToSeat.get(s)?.id).filter(s=>!!s);t.length&&(this.setFollowLive(!1),this.renderer?.focusSeats?.(t,{animate:!0}))}highlightLabels(e){if(!e){this.renderer?.setSeatHighlight?.(null);return}this.renderer?.setSeatHighlight?.(e.map(t=>this.labelToSeat.get(t)?.id).filter(t=>!!t))}toolChooser(){return this.chooserDialog?.close({restoreFocus:!1}),this.chooser=new Ze(this.buildChooserHost()),this.chooser}toolSelectionBar(e,t,s,n){return Pn({count:0,noun:"selected",breakdown:`<span class="slm-selactions"><button type="button" class="slm-linkbtn" data-ref="${n}">Select all</button></span>`,clearAttr:`data-ref="${s}"`}).replace('class="slm-selnum"',`class="slm-selnum" data-ref="${e}"`).replace('class="slm-sellabel"',`class="slm-sellabel" data-ref="${t}"`)}buildChannelsHost(){return{moved:e=>this.recordChange({kind:"channel",...e}),channelsChanged:()=>{this.getColourBy()==="channel"&&this.paintColourLegend()},eventKey:this.key,api:this.api,rail:this.els.rail,pickers:()=>this.extrasReady??this.loadExtras().then(e=>this.extrasReady=e),pickerFailed:e=>this.pickerFailed(e),enhanceDialog:e=>this.withExtras(t=>t.pickerKeys(e)),mapLayer:this.root.querySelector(".slm-map"),pillLane:this.els.lane,root:this.root,seats:()=>[...this.labelToSeat.values()].map(e=>({id:e.id,label:e.label,x:e.x,y:e.y})),statusOf:e=>this.status.get(e)??(this.labelToSeat.has(e)?"free":void 0),selectionLabels:()=>this.selectionLabels(),selectByLabels:e=>{this.selectByLabels(e)},clearSelection:()=>this.clearSelection(),selectSection:e=>{this.selectSection(e)},sections:()=>this.sectionOptions,labelsInSection:e=>this.renderer?.getSelectableInSection(e).map(t=>t.label)??[],rows:()=>{let e=new Map((this.doc?.objects??[]).map(s=>[s.id,s])),t=new Map;for(let s of this.labelToSeat.values()){let n=e.get(s.rowId);if(!n||n.type!=="row"&&n.type!=="table")continue;let a=s.logicalRowId??s.rowId,o=this.sectionByObject.get(s.rowId)??U.UNGROUPED_ID,r=t.get(a)??{id:a,label:n.type==="row"?n.segmentedRow?.displayLabel??n.displayLabel??n.label:n.displayLabel??n.label,sectionId:o,sectionLabel:this.sectionLabelById.get(o)??"Other seats",labels:[]};r.labels.push(s.label),t.set(a,r)}return[...t.values()].sort((s,n)=>s.sectionLabel.localeCompare(n.sectionLabel,void 0,{numeric:!0,sensitivity:"base"})||s.label.localeCompare(n.label,void 0,{numeric:!0,sensitivity:"base"}))},categories:()=>(this.doc?.categories??[]).map(e=>({key:e.key,label:e.label??e.key,color:e.color,price:e.price,tiers:e.tiers?.map(t=>({id:t.id,name:t.name,price:t.price}))})),labelsInCategory:e=>[...this.labelToSeat.entries()].filter(([,t])=>t.categoryKey===e).map(([t])=>t),sectionOfLabel:e=>{let t=this.labelToSeat.get(e);if(!t)return null;let s=this.sectionByObject.get(t.rowId)??U.UNGROUPED_ID;return{id:s,label:this.sectionLabelById.get(s)??"Other seats"}},worldToScreen:e=>this.renderer?.worldToScreen(e)??null,seatPixelSize:()=>this.seatPixelSize(),isSeatDetail:()=>this.renderer?.getRung?.()==="seats",showSectionOverview:()=>{this.renderer?.clearSectionFocus(),this.renderer?.setRung?.("sections")},focusSection:e=>this.renderer?.focusSection(e),isCompact:()=>!!this.root?.classList.contains("compact"),setMapInert:e=>{this.mapHost.toggleAttribute("inert",e),this.mapHost.setAttribute("aria-hidden",String(e))},toast:(e,t)=>this.toast(e,t),onError:e=>this.opts.onError?.(e)}}seatPixelSize(){let e=this.renderer?.getVisibleWorldRect?.(),t=this.mapHost?.clientWidth??0;return!e?.width||!t?6:Math.max(3,t/e.width*18)}setHeatOverlay(e){this.heatEnabled=e,this.mapView.momentum!==e&&this.setMapView({momentum:e}),this.applyHeatOverlay(),this.paintHeatButton()}setMapView(e){let t={...this.mapView,...e};if(!Object.keys(t).some(a=>t[a]!==this.mapView[a]))return;let n=t.categoryColours!==this.mapView.categoryColours||t.channelColours!==this.mapView.channelColours;this.mapView=t,ci(t),t.momentum!==this.heatEnabled&&this.setHeatOverlay(t.momentum),this.applyMapView(),this.paintMapViewMenu(),n&&(this.refreshBlockPaint(),this.paintMapChrome())}getColourBy(){return this.mapView.channelColours&&this.channelColoursAvailable()?"channel":this.mapView.categoryColours?"type":"status"}setColourBy(e,t=!0){let s=e==="full"||e==="channel"&&!this.channelColoursAvailable()?"status":e;t&&(this.colourChoices={...this.colourChoices,[this.mode]:s},oi(this.colourChoices)),this.litChip&&s!==this.getColourBy()&&(this.litChip=null,this.highlightLabels(null)),this.setMapView({categoryColours:s==="type",channelColours:s==="channel"}),this.paintColourLegend()}startingColourBy(e){let t=this.opts.colourBy;return t&&e!=="channels"?t==="full"?"status":t:ii(e)}getMapView(){return{...this.mapView}}toggleMapView(e){if(e==="categoryColours"||e==="channelColours"){let t=e==="categoryColours"?"type":"channel";this.setColourBy(this.getColourBy()===t?"status":t);return}this.setMapView({[e]:!this.mapView[e]})}channelColoursAvailable(){return this.mode==="channels"&&this.channels!=null}applyMapView(){di(this.mapView,{renderer:this.renderer,channelsOverlay:e=>this.channels?.setOverlayVisible(e)})}paintMapViewMenu(){let e=this.els.view;e&&ui(e,this.mapView,{momentumLoading:this.mapView.momentum&&!this.controlRoomSnapshot})}setFollowLive(e){let t=this.followLive!==e;this.followLive=e,e||(this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.followLiveTimer=null,this.followSeatTimer=null),this.paintFollowLiveButton(),t&&this.opts.onFollowLiveChange?.(e)}setKeepLiveWhileHidden(e){this.keepLive=e??!0,this.opts.keepLiveWhileHidden=e}setCurrency(e){this.opts.currency=e,!this.authoritativeCurrency&&(this.currency=e??"USD",this.ready&&this.recomputeTallies())}setSale(e){this.opts.sale=e,this.paintFullscreenLine(),this.paintMonitorInsights()}setTheme(e){this.opts.theme=e,this.applyThemeVars()}applyThemeVars(){if(!this.root)return;let e=cs(this.themeMode);for(let[t,s]of Object.entries(on(this.opts.theme,e)))this.root.style.setProperty(t,s);e?this.root.dataset.theme=e:delete this.root.dataset.theme}watchThemeMode(){this.colorSchemeStop?.(),this.colorSchemeStop=null,this.themeMode==="auto"&&(this.colorSchemeStop=tn(()=>{this.closed||this.repaintForThemeMode()}))}repaintForThemeMode(){this.applyThemeVars();let e=this.renderer;if(!e||!this.doc)return;let t=e.getSelection().map(a=>a.id),s=e.getCameraPose(),n=e.getFocusedSection();e.setChart(this.themedDoc()),this.repaintAll(),this.applyHeatOverlay(),t.length&&e.select(t),n&&e.focusSection(n),e.setCameraPose(s),this.updateZoomHint()}setThemeMode(e){let t=e??null;this.closed||t===this.themeMode||(this.themeMode=t,this.opts.themeMode=t??void 0,this.watchThemeMode(),this.repaintForThemeMode())}getThemeMode(){return this.themeMode}themedDoc(){let e=this.doc,t=rn(cs(this.themeMode));return t?{...e,theme:{...e.theme??{},background:t}}:e}setCapabilities(e){this.opts.capabilities=e,this.categoryCanManage=new Set(e??[]).has("event:categories:manage"),this.tableCanManage=new Set(e??[]).has("event:tables:manage"),!this.categoryCanManage&&this.mode==="categories"||!this.tableCanManage&&this.mode==="tables"?this.setMode("view"):this.paintModeTabs(),this.ready&&this.resolveChannelCapabilities()}setTokenRefresh(e){this.opts.onTokenRefresh=e,this.scheduleTokenRefresh()}setTrendWindow(e){let t=Number.isFinite(e)?Math.floor(e):15;return this.trendWindowMinutes=Math.max(5,Math.min(60,t)),this.paintTrendWindow(),this.refreshControlRoom()}async enterFullscreen(){!this.root?.requestFullscreen||this.isFullscreen()||(await this.root.requestFullscreen(),this.root.focus({preventScroll:!0}))}async exitFullscreen(){typeof document>"u"||!this.isFullscreen()||await document.exitFullscreen()}isFullscreen(){return typeof document<"u"&&document.fullscreenElement===this.root}toggleFullscreen(){(this.isFullscreen()?this.exitFullscreen():this.enterFullscreen()).catch(t=>this.opts.onError?.(t))}setToken(e,t){us(e),this.api.setToken(e),this.opts.token=e,this.opts.tokenExpiresAt=t,this.tokenExpiresAt=t??null,this.scheduleTokenRefresh(),this.ready&&this.resolveChannelCapabilities()}scheduleTokenRefresh(){this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null;let e=this.opts.onTokenRefresh,t=this.tokenExpiresAt;if(this.closed||!e||!t||!Number.isFinite(t))return;let s=t-Date.now(),n=Math.min(12e4,Math.max(3e4,s*.2)),a=Math.max(0,s-n);this.tokenRefreshTimer=setTimeout(()=>{this.tokenRefreshTimer=null,this.rotateToken()},a)}async rotateToken(){if(!(this.closed||this.sessionEnded||this.tokenRefreshInFlight||!this.opts.onTokenRefresh)){this.tokenRefreshInFlight=!0;try{let e=await this.opts.onTokenRefresh();if(!e?.token||!Number.isFinite(e.expiresAt))throw new Error("invalid_token_refresh_result");this.tokenRefreshFailures=0,this.setToken(e.token,e.expiresAt)}catch(e){this.opts.onError?.(e),this.tokenRefreshFailures+=1,!this.closed&&(this.tokenRefreshFailures>=dl||hl(e))?this.endSession():this.closed||(this.tokenRefreshTimer=setTimeout(()=>{this.tokenRefreshTimer=null,this.rotateToken()},3e4))}finally{this.tokenRefreshInFlight=!1}}}endSession(){if(this.sessionEnded)return;this.sessionEnded=!0,this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.monitorRefreshTimer&&clearTimeout(this.monitorRefreshTimer),this.monitorRefreshTimer=null;let e=this.ws;if(this.ws=null,e){e.onclose=null;try{e.close()}catch{}}this.stopKeepalive(),this.setLive(!1),this.paintSessionEnded()}async retrySession(){if(this.closed||!this.sessionEnded)return!this.sessionEnded;if(!this.opts.onTokenRefresh)return!1;this.sessionEnded=!1,this.tokenRefreshFailures=0;let e=this.root?.querySelector('[data-ref="roomcard"]');return e?.setAttribute("data-busy","true"),await this.rotateToken(),this.sessionEnded?(e?.removeAttribute("data-busy"),!1):(e?.remove(),this.attempt=0,this.connect(),!0)}paintSessionEnded(){if(this.root?.querySelector('[data-ref="roomcard"][data-kind="signedout"]'))return;this.showRoomCard("signedout");let e=this.root?.querySelector('[data-ref="roomcard"] p'),t=this.mode==="view"?null:this.taskGroups.flatMap(n=>n.tools).find(n=>n.mode===this.mode)?.label??null,s=this.getSelection().length;e&&this.withExtras(n=>n.nameWorkInHand(e,t,s,this.els.rail??null))}async block(e,t={}){let s=(e??this.selectionLabels()).filter(l=>this.status.get(l)==="free");if(!s.length||this.blockBusy)return;let n=t.releaseAt??this.releaseAt??void 0,a=`${fe(s.length)}`;this.setSeatsLocal(s,"blocked"),this.blockBusy=!0,this.panelAlert=null,this.paintSelBar(this.getSelection());let o=this.selectionSummary(s.flatMap(l=>this.labelToSeat.get(l)??[])).where,r=n?`They go back on sale ${xt(n)}.`:"They stay off sale until you put them back.";try{await this.api.block(this.key,s,{...t,releaseAt:n}),this.blockBusy=!1,this.blockFailedNow=!1,this.clearSelection(),this.blockDone={labels:s,until:Date.now()+3e4},setTimeout(()=>{!this.closed&&this.mode==="block"&&this.paintSelBar(this.getSelection())},30100),this.panelAlert=X("ok",`${a} blocked${t.reason?` \xB7 ${t.reason}`:""}`,` ${o}. ${r}`),this.paintSelBar(this.getSelection()),this.doneQuietly("block",s,`${a} blocked${t.reason?` \xB7 ${t.reason}`:""}.`),this.recordChange({kind:"block",labels:s,reason:t.reason??null,releaseAt:n??null})}catch(l){this.blockBusy=!1,this.setSeatsLocal(s,"free");let c=l instanceof G&&l.status===409?(l.conflicts??[]).map(b=>b.label).filter(b=>s.includes(b)):[],d=s.filter(b=>!c.includes(b));if(c.length&&d.length){this.renderer?.deselect(c.map(b=>this.labelToId.get(b)).filter(b=>!!b)),this.syncSelection();try{this.setSeatsLocal(d,"blocked"),await this.api.block(this.key,d,{...t,releaseAt:n}),this.clearSelection(),this.blockDone={labels:d,until:Date.now()+3e4,partial:!0},this.panelAlert=X("warn",`${c.length.toLocaleString()} ${c.length===1?"seat was":"seats were"} sold while you chose`,` ${fe(d.length)} blocked. ${et(c)} ${c.length===1?"is":"are"} sold and stay${c.length===1?"s":""} with ${c.length===1?"its buyer":"their buyers"}.`),this.paintSelBar(this.getSelection()),this.paintSelBar(this.getSelection()),this.doneQuietly("block",d,`${d.length.toLocaleString()} blocked.`),this.recordChange({kind:"block",labels:d,reason:t.reason??null,releaseAt:n??null});return}catch(b){this.setSeatsLocal(d,"free"),l=b}}this.blockFailedNow=!c.length,this.blockFailed(c.length?["Those seats were just taken"," Nothing was blocked. They are sold or in a cart now."]:["Couldn\u2019t block the seats"," The connection dropped before the change was saved. Buyers can still pick them."]),this.opts.onError?.(l)}}async unblock(e){let t=(e??this.selectionLabels()).filter(n=>this.status.get(n)==="blocked");if(!t.length||this.blockBusy)return;let s=this.blockGroups?.groups.find(n=>n.labels.includes(t[0]));this.setSeatsLocal(t,"free"),this.blockBusy=!0,this.panelAlert=null,this.paintSelBar(this.getSelection());try{await this.api.unblock(this.key,t),this.blockBusy=!1,this.clearSelection(),this.doneQuietly("unblock",t,`${t.length.toLocaleString()} ${t.length===1?"seat is":"seats are"} back on sale.`),this.recordChange({kind:"unblock",labels:t,reason:s?.reason??null,releaseAt:s?.releaseAt??null})}catch(n){this.blockBusy=!1,this.setSeatsLocal(t,"blocked"),this.blockFailed(["Couldn\u2019t put the seats back on sale"," They are still blocked. Your selection is kept; try again."]),this.opts.onError?.(n)}}blockFailed([e,t]){this.mode==="block"&&this.els.rail?.querySelector('[data-ref="blockfoot"]')?(this.panelAlert=X("error",e,t),this.paintSelBar(this.getSelection())):this.toastErr(`${e}.${t}`)}async unblockAll(){let e=[...this.status.entries()].filter(([t,s])=>s==="blocked"&&!this.reservedBy.has(t)).map(([t])=>t);if(e.length){this.setSeatsLocal(e,"free");try{let t=await this.api.unblockAll(this.key);this.clearSelection(),this.doneQuietly("unblockAll",e,`Unblocked ${t.freed} seat${t.freed===1?"":"s"}.`),this.recordChange({kind:"unblock",labels:e})}catch(t){await this.resnapshot(),this.toastErr("Couldn't mark everything for sale."),this.opts.onError?.(t)}}}async cancelBooking(e,t){let s=e.filter(n=>this.status.get(n)==="booked");if(!(!s.length||!t)){this.setSeatsLocal(s,"free");try{await this.api.unbook(this.key,s,t),this.clearSelection(),this.doneQuietly("cancelBooking",s,`Released ${s.length} booked unit${s.length===1?"":"s"}.`)}catch(n){this.setSeatsLocal(s,"booked"),this.toastErr("Couldn't release that booked inventory. Check the booking reference."),this.opts.onError?.(n)}}}async setCategory(e,t){let s=this.doc?.categories.find(o=>o.key===e),n=[...new Set(t??this.selectionLabels())].filter(o=>this.labelToSeat.has(o));if(!s||!n.length||this.categoryBusy)return;let a=s.label??s.key;this.categoryBusy=!0,this.panelAlert=null,this.paintCategorySelection(this.getSelection());try{let o=await this.withAuthRetry(()=>this.api.setCategory(this.key,n,e)),r={};for(let c of o.labels){let d=this.labelToSeat.get(c),b=this.labelToId.get(c);d&&(d.categoryKey=e),b&&(r[b]=e)}this.categoryTotalsCache=null,this.renderer?.setSeatCategories?.(r);let l=n.length-o.labels.length;l>0&&(this.panelAlert=X("warn",`${fe(l)} could not move`,` They changed while you chose. The other ${o.labels.length.toLocaleString()} now sell as ${a}.`)),this.categoryBusy=!1,this.clearSelection(),this.mode==="categories"&&this.loadCategoryDifferences(),this.done("setCategory",o.labels,`${o.labels.length.toLocaleString()} ${o.labels.length===1?"seat now sells":"seats now sell"} as ${a}.`),this.recordChange({kind:"types",labels:o.labels,title:`Changed ${fe(o.labels.length)} to ${a}`})}catch(o){this.categoryBusy=!1,this.mode==="categories"?(this.panelAlert=X("error","Couldn\u2019t move the seats"," Nothing changed for buyers. Your selection is kept; try again."),this.paintCategorySelection(this.getSelection())):this.toastErr("Couldn\u2019t move the seats. Nothing changed for buyers."),this.opts.onError?.(o)}}async setTableBooking(e,t,s={}){if(this.inventoryModelVersion!==2){this.toastErr("Table booking controls require inventory model 2 for this event.");return}let n=await this.saveTableBooking(e,t,s);n==="conflict"?this.toastErr("Release table seats that are in a cart, booked or blocked before changing its booking mode."):n==="failed"&&this.toastErr("Couldn't update table booking. No table mode was changed.")}async saveTableBooking(e,t,s={}){let n=[...new Set(e)].filter(Boolean);if(!n.length||this.tableBookingSaving||this.inventoryModelVersion!==2)return"skipped";this.tableBookingSaving=!0;try{let a=await this.withAuthRetry(()=>this.api.setTableBooking(this.key,n,t,s));return await this.reloadEventChart(),this.doneQuietly("setTableBooking",a.tableIds,`Updated ${a.tableIds.length.toLocaleString()} table${a.tableIds.length===1?"":"s"} to ${t==="individual"?"per-chair":t==="whole"?"whole-table":"flexible-group"} booking.`),this.recordChange({kind:"tables",labels:a.tableIds.map(o=>this.tableInfos().find(r=>r.id===o)?.label??o),title:`${a.tableIds.length===1?"A table now books":`${a.tableIds.length.toLocaleString()} tables now book`} ${t==="individual"?"by the chair":t==="whole"?"as a whole":"as a group"}`}),"ok"}catch(a){return this.opts.onError?.(a),a instanceof G&&a.code==="table_inventory_in_use"?"conflict":"failed"}finally{this.tableBookingSaving=!1}}async reloadEventChart(){let e=await this.withAuthRetry(()=>this.api.chart(this.key));this.inventoryModelVersion=e.event.inventoryModelVersion===2?2:1;let t=await this.organizerAssetUrls.prepareRendererChart(e.doc);this.renderer?.destroy(),this.renderer=null,this.doc=t,this.labelToId.clear(),this.labelToSeat.clear(),this.allIds=[],this.gaUnitLabelSet.clear(),this.tableChairIds.clear(),this.labelNames.clear(),this.status.clear(),this.counts={held:0,booked:0,blocked:0},this.serverBaseline=null,this.modelSynced=!1,this.controlRoomSettled=!1,this.lastSelectionLabels.clear(),this.selBack=[],this.selAhead=[],this.buildUnitUniverse(t),this.buildRenderer(),this.buildSectionOptions(),this.settleMode(),await Promise.all([this.resnapshot(),this.refreshControlRoom().catch(s=>this.opts.onError?.(s)),this.refreshAvailability()]),this.mode==="tables"&&this.tablesPanel?this.tablesPanel.update():this.paintRail()}selectAll(){if(this.mode==="select")return this.selectByLabels([...this.labelToSeat.values()].filter(t=>this.canSelectObject(t)).map(t=>t.label));let e=this.renderer?.selectAllSelectable()??[];return this.syncSelection(),e}applyBand(e,t,s){let n=this.renderer;if(!n?.getSelectableInSection||n.getRung?.()==="seats")return!1;if(this.bandIndex?.base!==this.sectionsBase){let r=new Map,l=new Map;for(let[d,b]of this.labelToSeat){let f=this.sectionByObject.get(b.rowId),u=this.labelToId.get(d);if(!f||!u)continue;r.set(u,f);let m=l.get(f)??{x:0,y:0,n:0};m.x+=b.x,m.y+=b.y,m.n+=1,l.set(f,m)}let c=new Map([...l].map(([d,b])=>[d,{x:b.x/b.n,y:b.y/b.n}]));this.bandIndex={base:this.sectionsBase,sectionOf:r,centre:c}}let a=new Set;for(let r of e){let l=this.bandIndex.sectionOf.get(r);l&&a.add(l)}for(let[r,l]of this.bandIndex.centre)t(l)&&a.add(r);let o=[...a].flatMap(r=>n.getSelectableInSection(r));return s?n.deselect(o.map(r=>r.id)):n.selectByLabels?.(o.map(r=>r.label)),!0}handleSeatDeselect(e){let t=this.press;t&&(t.answered=!0);let s=this.lastPick;t?.shift&&s&&s.rowId===e.rowId&&s.label!==e.label&&this.isBulkSelectMode()?(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()},this.renderer?.selectByLabels(ms(this.rowSeats(e.rowId),s.label,e.label))):t&&(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()}),this.syncSelection()}rowSeats(e){return[...this.labelToSeat.values()].filter(t=>t.rowId===e)}wireGestures(e){e.addEventListener("pointerdown",t=>{this.press={shift:t.shiftKey,x:t.clientX,y:t.clientY,answered:!1}},!0),e.addEventListener("click",t=>{let s=this.press;if(!s||s.answered||!this.isBulkSelectMode()||this.renderer?.getRung?.()==="seats"||Math.hypot(t.clientX-s.x,t.clientY-s.y)>5)return;let n=this.renderer,a=e.getBoundingClientRect(),o={x:t.clientX-a.left,y:t.clientY-a.top};if(!n||n.sectionAt?.(o))return;let r=pn(o,n.getMinimapSnapshot?.().sections??[],l=>n.worldToScreen(l));r&&this.handleSectionTap(r)}),e.addEventListener("dblclick",()=>{let t=this.lastPick;!t||Date.now()-t.at>700||(this.isBulkSelectMode()?(this.renderer?.selectByLabels(this.rowSeats(t.rowId).map(s=>s.label)),this.syncSelection()):this.mode==="view"&&this.showLabels([t.label]))})}handleSectionTap(e){if(this.press&&(this.press.answered=!0),this.mode==="filterSections"){let t=this.filterableSections().find(s=>s.id===e);t&&this.setFilteredSection(t.label);return}if(this.isBulkSelectMode()&&this.renderer?.getRung?.()!=="seats"){let t=Date.now(),s=this.lastSectionTap?.id===e&&t-this.lastSectionTap.at<450;this.lastSectionTap=s?null:{id:e,at:t},s||this.selectSection(e);return}this.renderer?.focusSection(e),this.channels?.handleSectionFocus(e),this.sectionsPanel?.pick(e)}selectSection(e){if(!this.renderer)return[];let t=this.renderer.getSelectableInSection(e);return this.renderer.selectByLabels(t.map(s=>s.label)),this.syncSelection(),this.renderer.getSelection()}setFilteredSection(e){let t=e.trim(),s=this.filterableSections().filter(o=>o.label===t);if(!s.length)throw new Error(`Unknown event section: ${e}`);let n=t!==this.filteredSectionLabel;this.filteredSectionLabel=t,this.mode==="filterSections"&&(this.applyFilteredSectionCanvas(s),this.renderFilterSectionsRail());let a=s.map(({id:o,label:r,seatCount:l,zone:c})=>({id:o,label:r,seatCount:l,...c?{zone:c}:{}}));return n&&this.opts.onFilteredSectionChange?.(a),a}focusSection(e){let t=e.trim(),s=this.filterableSections().filter(n=>n.label===t);return!this.renderer||!s.length?[]:(this.frameSections(s),s.map(({id:n,label:a,seatCount:o,zone:r})=>({id:n,label:a,seatCount:o,...r?{zone:r}:{}})))}clearFilteredSection(){let e=this.filteredSectionLabel!==null;this.filteredSectionLabel=null,this.renderer?.setDimmedSections(null),this.renderer?.clearSectionFocus(),this.renderer?.zoomToFit(),this.mode==="filterSections"&&this.renderFilterSectionsRail(),e&&this.opts.onFilteredSectionChange?.([])}getFilteredSections(){return this.filteredSectionLabel?this.filterableSections().filter(e=>e.label===this.filteredSectionLabel).map(({id:e,label:t,seatCount:s,zone:n})=>({id:e,label:t,seatCount:s,...n?{zone:n}:{}})):[]}selectByLabels(e){let t=e;if(this.mode==="select"){let s=new Set(this.selectionLabels()),n=this.selectionCap(),a=[...new Set(e)].filter(r=>!s.has(r)).map(r=>this.labelToSeat.get(r)).filter(r=>!!r&&this.canSelectObject(r)),o=Math.max(0,n-s.size);a.length>o&&this.opts.onSelectionLimit?.(n),t=a.slice(0,o).map(r=>r.label)}return this.renderer?.selectByLabels(t),this.syncSelection(),this.getSelection()}selectObjects(e){return this.selectByLabels(e)}deselectObjects(e){let t=e.map(s=>this.labelToId.get(s)).filter(s=>!!s);return this.renderer?.deselect(t),this.syncSelection(),this.getSelection()}selectCategories(e){let t=new Set(e);return this.selectByLabels([...this.labelToSeat.values()].filter(s=>t.has(s.categoryKey)).map(s=>s.label))}deselectCategories(e){let t=new Set(e);return this.deselectObjects(this.getSelection().filter(s=>t.has(s.categoryKey)).map(s=>s.label))}setSelectableObjects(e){this.opts.selectableObjects=[...e],this.selectableObjectLabels=new Set(e),this.reconcileSelectPolicy()}setUnavailableObjects(e,t){this.opts.unavailableObjectsReason=t;let s=new Set(e),n=[...s].filter(o=>!this.unavailableLabels.has(o)).concat([...this.unavailableLabels].filter(o=>!s.has(o)));if(!n.length)return;if(this.opts.unavailableObjects=[...s],this.unavailableLabels=s,this.renderer){let o=new Map;for(let r of n){let l=this.paintIds(r);if(!l.length)continue;let c=this.renderStatusOf(r,this.status.get(r)??"free");o.set(c,[...o.get(c)??[],...l])}for(let[r,l]of o)this.renderer.setStatus(l,r);this.afterPaint()}let a=this.getSelection().filter(o=>this.isHostUnavailable(o.label));a.length&&(this.renderer?.deselect(a.map(o=>o.id)),this.syncSelection())}setCategoryPrices(e){this.opts.categoryPrices=e,this.renderer?.setCategoryPriceRanges(this.hoverPriceRanges())}hoverPriceRanges(){let e=this.opts.categoryPrices;return e==null?e:Object.fromEntries(Object.entries(e).map(([t,s])=>[t,typeof s=="number"?{min:s,max:s}:{min:s.min,max:s.max}]))}setUnavailableObjectsSelectable(e){this.opts.unavailableObjectsSelectable=e,this.reconcileSelectPolicy()}setObjectSelectable(e){this.opts.isObjectSelectable=e,this.reconcileSelectPolicy()}setMaxSelectedObjects(e){this.assertSelectionOptions(e,this.opts.numberOfPlacesToSelect),this.opts.maxSelectedObjects=e,this.trimSelectionToCap(),this.updateRendererInteraction(),this.syncSelection()}setNumberOfPlacesToSelect(e){this.assertSelectionOptions(this.opts.maxSelectedObjects,e),this.opts.numberOfPlacesToSelect=e,this.selectionWasValid=null,this.trimSelectionToCap(),this.updateRendererInteraction(),this.syncSelection()}getSelectionValidity(){let e=this.opts.numberOfPlacesToSelect;if(e===void 0)return null;let t=this.getSelection(),s=t.length;return{isValid:s===e,count:s,required:e,remaining:Math.max(0,e-s),objects:t}}clearSelection(){this.renderer?.clearSelection(),this.syncSelection()}stepSelection(e){let s=(e<0?this.selBack:this.selAhead).pop();if(!s||!this.renderer)return!1;(e<0?this.selAhead:this.selBack).push([...this.lastSelectionLabels]),this.selRestoring=!0;try{this.renderer.clearSelection();let n=s.filter(a=>this.labelToSeat.has(a));n.length&&this.renderer.selectByLabels(n),this.syncSelection()}finally{this.selRestoring=!1}return!0}getSelection(){return this.renderer?.getSelection?.()??[]}getReport(){return this.api.report(this.key).then(e=>(this.applyReportRevenue(e),e))}getControlRoomSnapshot(e=this.trendWindowMinutes){return this.setTrendWindow(e)}getConnection(){return{status:this.connectionStatus,lastMessageAt:this.lastMessageAt,room:this.roomState()}}getLog(e={}){return this.api.log(this.key,e)}async setHoldTtl(e){try{await this.api.setHoldTtl(this.key,e),this.done("setHoldTtl",[],e?`Hold window set to ${Math.round(e/6e4)} min.`:"Hold window reset.")}catch(t){this.toastErr("Couldn't update the hold window."),this.opts.onError?.(t)}}zoomToFit(){if(this.mode==="filterSections"&&this.filteredSectionLabel){this.clearFilteredSection();return}this.renderer?.clearSectionFocus(),this.renderer?.zoomToFit()}zoomOutStep(){let e=this.renderer;if(!e)return;if(!e.zoomOutLevel)return void e.zoomOut();let t=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&t&&e.clearSectionFocus()}paintMapChrome(){let e=this.renderer;if(!e||!this.els.crumb)return;let t=e.getFocusedSection?.()??null,s=t?e.getMinimapSnapshot?.().sections.find(r=>r.id===t)??null:null,n=e.getFloors?.()??[],a=n.length>1?e.isFloorOverview?.()?"All floors":n.find(r=>r.id===e.getActiveFloorId?.())?.name??null:null,o=e.getRung?.()==="seats";o!==this.legendSeats&&(this.legendSeats=o,this.paintColourLegend()),Vn(this.els,_n({focused:s?{label:s.label,free:s.free,total:s.total,allBlocked:s.free?void 0:this.sectionKeptAside(s.id)}:null,floor:a,seatsRevealed:e.seatsRevealed?.()??!0,atVenueFit:e.atVenueFit?.(),atCeiling:e.canZoomIn?.()===!1||e.seatsPickable?.()===!0}))}sectionKeptAside(e){let t=this.filterableSections().find(a=>a.id===e);if(!t)return;let s=0,n=0;for(let a of t.seatLabels){let o=this.status.get(a)??"free";if(o==="free"||o==="held")return;o==="blocked"&&(this.reservedBy.has(a)?n++:s++)}return s&&n?"both":n?"reserved":s?"blocked":void 0}sectionTypeKeys(){if(this.typeKeyBySection&&this.typeKeyBase===this.sectionsBase)return this.typeKeyBySection;let e=new Map;for(let t of this.filterableSections()){let s=new Map;for(let a of t.seatLabels){let o=this.labelToSeat.get(a)?.categoryKey;o&&s.set(o,(s.get(o)??0)+1)}let n=null;for(let[a,o]of s)(!n||o>s.get(n))&&(n=a);n&&e.set(t.id,n)}return this.typeKeyBySection=e,this.typeKeyBase=this.sectionsBase,e}sectionTypeTint(e){let t=this.sectionTypeKeys().get(e);return t?this.renderer?.categoryDisplayColor?.(t)??null:null}scheduleReservations(e=400){this.closed||this.reservationsTimer||(this.reservationsTimer=setTimeout(()=>{this.reservationsTimer=null,this.refreshReservations()},e))}async refreshReservations(){if(!(this.closed||!this.toolAvailable("reserve")))try{let e=await this.withAuthRetry(()=>this.api.eventRequest(this.key,"reservations"));this.closed||this.setReservations(e.reservations??[]),this.blockGroups=null,this.findBlocked?.refresh()}catch{}}setReservations(e){let t=new Map;for(let o of e){let r=o.createdByYou?"you":o.createdByName??"",l=o.createdAt?W(o.createdAt,{day:"numeric",month:"short"}):"",c=[r,l].filter(Boolean).join(" \xB7 ")||void 0;for(let d of o.labels)t.set(d,{id:o.id,name:o.name,releaseAt:o.releaseAt,count:o.labels.length,by:c})}let s=new Set;for(let o of t.keys())this.reservedBy.has(o)||s.add(o);for(let o of this.reservedBy.keys())t.has(o)||s.add(o);this.reservedBy=t,this.reservationsLoaded=!0;let n=this.serverBaseline?.client;n&&n.reserved===null&&(n.reserved=this.reservedBlockedCount());for(let o of t.keys())this.reserving.delete(o);this.reservedIds=new Set([...t.keys()].flatMap(o=>this.paintIds(o)));let a=[...s].filter(o=>this.status.get(o)==="blocked").flatMap(o=>this.paintIds(o));a.length&&this.renderer&&(this.renderer.setStatus(a,Ne("booked")),this.renderer.setStatus(a,Ne("blocked"))),this.paintColourLegend(),this.paintMapChrome()}async loadBlockGroups(){if(this.blockGroups&&Date.now()-this.blockGroups.at<3e4)return this.blockGroups.groups;let e=await this.withAuthRetry(()=>this.api.eventRequest(this.key,"blocks"));return this.blockGroups={at:Date.now(),groups:e.groups??[]},this.blockGroups.groups}reservedBlockedCount(){let e=0;for(let t of this.reservedBy.keys())this.status.get(t)==="blocked"&&(e+=this.seatWeight(t));return e}reservedTally(e){let t=this.reservedBlockedCount(),s=this.serverBaseline,n=s?.server.reserved,a=s?.client?.reserved,o=n===void 0?t:n+(a==null?0:t-a);return Math.min(e,Math.max(0,o))}paintColourLegend(){let e=this.els.blocklegend;if(!e||!this.renderer)return;let t=this.getColourBy(),s=this.buildTallies();Yn(e,{colourBy:t,seats:this.legendSeats??this.renderer.getRung?.()==="seats",types:t==="type"?this.legendTypes():[],counts:{free:s.free,held:s.held,booked:s.booked,blocked:s.blocked,reserved:this.reservedTally(s.blocked)},lit:this.litChip,shown:this.litChip==="shown"&&this.shownObjects?{name:this.shownObjects.name,count:this.shownObjects.labels.length}:null,channels:t==="channel"?this.channels?.legendChannels()??[]:[],channelAvailable:this.channelColoursAvailable()})}showObjects(e,t="Seats"){let s=(e??[]).filter(n=>this.labelToSeat.has(n));this.shownObjects=s.length?{name:t,labels:s}:null,this.litChip=this.shownObjects?"shown":this.litChip==="shown"?null:this.litChip,this.highlightLabels(this.litChip?this.chipLabels(this.litChip):null),this.shownObjects&&this.frameLabels(s),this.paintColourLegend()}chipLabels(e){if(e==="shown")return this.shownObjects?.labels??[];let t=[...this.labelToSeat.keys()];if(e.startsWith("type:")){let s=e.slice(5);return t.filter(n=>this.labelToSeat.get(n).categoryKey===s)}return e==="reserved"?t.filter(s=>this.reservedBy.has(s)):t.filter(s=>(this.status.get(s)??"free")===e&&(e!=="blocked"||!this.reservedBy.has(s)))}onLegendChip(e,t){let s=this.chipLabels(e);if(t&&(this.isBulkSelectMode()||this.mode==="select")){let n=this.getSelection().length;this.selectByLabels(s);let a=this.getSelection().length-n,o=s.length-a-n;o>0&&this.toast(`${a.toLocaleString()} picked. ${o.toLocaleString()} skipped: this task can\u2019t change them.`,"ok");return}this.litChip=this.litChip===e?null:e,this.highlightLabels(this.litChip?s:null),this.paintColourLegend()}legendTypes(){let e=new Map;for(let t of this.labelToSeat.values())e.set(t.categoryKey,(e.get(t.categoryKey)??0)+1);for(let[t,s]of this.status){if(s==="free")continue;let n=this.labelToSeat.get(t)?.categoryKey;n&&e.has(n)&&e.set(n,e.get(n)-1)}return(this.doc?.categories??[]).filter(t=>e.has(t.key)).map(t=>({key:t.key,label:t.label,color:this.renderer?.categoryDisplayColor?.(t.key)??t.color,free:Math.max(0,e.get(t.key))}))}refreshBlockPaint(){this.renderer?.refreshBlockPaint?.(),this.minimap?.refreshMinimap()}mapCamera(){return{getViewport:()=>{let e=this.renderer;return!e?.getVisibleWorldRect||!e.getWorldBounds?null:{visible:e.getVisibleWorldRect(),bounds:e.getWorldBounds()}},getMinimapSnapshot:()=>this.renderer?.getMinimapSnapshot?.()??{sections:[],seats:[]},panToWorld:e=>{this.setFollowLive(!1),this.renderer?.panToWorld?.(e)},clearSectionFocus:()=>this.renderer?.clearSectionFocus?.(),focusSection:e=>{this.setFollowLive(!1),this.renderer?.focusSection(e),this.channels?.handleSectionFocus(e)},overview:()=>{this.setFollowLive(!1),this.zoomToFit()},getFloors:()=>this.renderer?.getFloors?.()??[],getActiveFloorId:()=>this.renderer?.getActiveFloorId?.()??"",isFloorOverview:()=>this.renderer?.isFloorOverview?.()??!1,getRenderer:()=>this.renderer}}syncMinimap(){let e=this.els.minimapMount,t=!!this.root?.classList.contains("compact");if(!e||!this.renderer||t){this.minimap?.dispose(),this.minimap=null;return}if(this.minimap){this.minimap.refreshMinimap();return}this.minimap=Nn({controller:this.mapCamera(),root:()=>this.root,cssVar:s=>this.cssVar(s.replace(/^--sl-/,"--slm-")),focusedSectionLabel:()=>{},tint:s=>this.renderer?.categoryDisplayColor?.(s)||void 0},e),this.minimap.refreshMinimap()}cssVar(e){return this.root?getComputedStyle(this.root).getPropertyValue(e).trim():""}destroy(){if(this.selectObserver?.disconnect(),this.closed=!0,this.minimap?.dispose(),this.minimap=null,this.monitorRefreshTimer&&clearTimeout(this.monitorRefreshTimer),this.monitorRefreshTimer=null,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.stopKeepalive(),this.alerts?.destroy(),this.alerts=null,this.linkTimers&&this.linkTimers.forEach(e=>clearTimeout(e)),this.feedTimer&&clearInterval(this.feedTimer),this.toastTimer&&clearTimeout(this.toastTimer),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.reservationsTimer&&clearTimeout(this.reservationsTimer),this.kpiCleanupTimer&&clearTimeout(this.kpiCleanupTimer),this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.paintHandle!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.paintHandle),this.paintHandle=null,this.channels?.destroy(),this.channels=null,this.channelsLoading=null,this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.layoutObserver?.disconnect(),this.layoutObserver=null,this.colorSchemeStop?.(),this.colorSchemeStop=null,this.root?.removeEventListener("keydown",this.onKeyDown),this.els.rail?.removeEventListener("click",this.onRailClick),this.root?.removeEventListener("click",this.onHowClick),typeof document<"u"&&document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.ws){try{this.ws.close()}catch{}this.ws=null}this.reserve?.destroy(),this.reserve=null,this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,this.changes?.destroy(),this.changes=null,this.saved?.destroy(),this.saved=null;for(let e of this.arrival)e.destroy();this.arrival=[],this.activityPanel?.destroy(),this.activityPanel=null,this.navigation?.destroy(),this.navigation=null,this.renderer?.destroy(),this.renderer=null,this.organizerAssetUrls.dispose(),this.root&&this.root.parentNode===this.host&&this.host.removeChild(this.root)}buildRenderer(){if(!this.doc)return;let e=this.isBulkSelectMode();this.renderer=new U.SeatmapRenderer(this.mapHost,{manageMode:!0,organizerGlyph:{apply:(t,s,n,a)=>{let o=s==="cross"?Qn(t):void 0;if(o&&this.reservedIds.has(o)){(0,U.clearOrganizerSeatGlyph)(t),Jn(t,a);return}xs(t),(0,U.applyOrganizerSeatGlyph)(t,s,n,a)},clear:t=>{xs(t),(0,U.clearOrganizerSeatGlyph)(t)},isPainted:t=>(0,U.isOrganizerGlyphPainted)(t)||It(t)},marqueeSelect:e&&!this.movingMap,marqueeShape:this.marqueeShape,rowLabelSelect:this.rowLabelSelectable(),maxSelection:this.selectionCap(),selectableStatuses:this.selectableStatuses(),currency:this.currency,onSelect:t=>this.handleSeatSelect(t),onDeselect:t=>this.handleSeatDeselect(t),onSelectionLimit:t=>this.opts.onSelectionLimit?.(t),onMarquee:()=>this.mode==="select"?this.reconcileSelectPolicy():this.syncSelection(),onBand:(t,s,n)=>this.applyBand(t,s,n),onGAClick:t=>{if(this.mode!=="select"||!this.opts.onAreaClick||!this.doc)return;let s=(0,U.gaAreasOf)(this.doc).find(n=>n.id===t);s&&this.opts.onAreaClick({id:s.id,label:s.label,name:s.displayLabel?.trim()||s.label})},onSectionTap:t=>this.handleSectionTap(t),onViewChange:()=>{this.updateZoomHint(),this.paintMapChrome(),this.minimap?.drawMinimapRect(),this.channels?.handleViewChange()},onFocusedSectionChange:()=>{this.paintMapChrome(),this.minimap?.refreshMinimap()},hoverFacts:t=>this.hoverFactsFor(t),blockPaint:t=>Wn(t,{rule:this.availabilityRules[t.id],hiddenNow:this.effectiveHidden.has(t.id),closedNow:this.effectiveClosed.has(t.id),colourBy:this.getColourBy(),typeTint:this.sectionTypeTint(t.id),allBlocked:t.state==="sold-out"?this.sectionKeptAside(t.id):void 0}),openAtSectionsWhenDense:!0}),this.renderer.setCategoryPriceRanges(this.hoverPriceRanges()),this.renderer.setChart(this.themedDoc()),this.chromeClearance=-1,this.applyChromeClearance(),this.legendInset="",this.applyLegendInset(),this.repaintAll(),this.applyHeatOverlay(),this.applyMapView(),this.updateZoomHint(),this.minimap?.dispose(),this.minimap=null,this.syncMinimap(),this.paintMapChrome()}hoverFactsFor(e){let t=[...this.labelToSeat.values()].find(u=>u.id===e);if(!t)return null;let s=this.status.get(t.label)??"free",n={free:"Free",held:"In a cart",booked:"Booked",blocked:"Blocked"},a=s==="free"&&this.isHostUnavailable(t.label),o=a?this.opts.unavailableObjectsReason?.trim()||"Unavailable":n[s],r=s==="blocked"?this.reservedBy.get(t.label):void 0;if(r){let u=r.releaseAt==null?"No end":W(r.releaseAt,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});return[{caption:"Reserved for",value:r.name},{caption:"Until",value:u},{caption:"Reservation",value:`${fe(r.count)}`}]}let l=[{caption:"Status",value:o}],c=this.channels?.channelNameForLabel(t.label)??null;c&&l.push({caption:"Channel",value:c});let d=this.sectionByObject.get(t.rowId)??U.UNGROUPED_ID,b=this.doc?.categories.find(u=>u.key===t.categoryKey),f=s==="free"&&!a&&!this.effectiveHidden.has(d)&&!this.effectiveClosed.has(d)&&b?.notForSale!==!0;return l.push({caption:"For sale",value:f?"Yes":s==="free"&&!a?"No":"\u2014"}),l}rowLabelSelectable(){return this.isBulkSelectMode()||this.mode==="select"}isBulkSelectMode(){return this.mode==="block"||this.mode==="reserve"||this.mode==="categories"||this.mode==="channels"&&this.channels?.usesMarqueeSelection()===!0}selectableStatuses(){return this.mode==="block"?["free","not_for_sale"]:this.mode==="reserve"?["free"]:this.mode==="select"||this.mode==="categories"||this.mode==="inspect"||this.mode==="view"||this.isBulkSelectMode()||this.mode==="channels"&&this.channels?.canSelect()===!0?["free","held","booked","not_for_sale"]:[]}updateRendererInteraction(){let e=this.isBulkSelectMode();this.renderer?.setManageInteraction({manageMode:!0,organizerStatus:this.mode!=="channels",marqueeSelect:e&&!this.movingMap,marqueeShape:this.marqueeShape,rowLabelSelect:this.rowLabelSelectable(),maxSelection:this.selectionCap(),selectableStatuses:this.selectableStatuses()}),this.navigation?.update(e),this.updateZoomHint()}handleSeatSelect(e){let t=this.press;t&&(t.answered=!0);let s=this.lastPick;if(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()},t?.shift&&s&&s.rowId===e.rowId&&s.label!==e.label&&this.isBulkSelectMode()&&this.renderer?.selectByLabels(ms(this.rowSeats(e.rowId),s.label,e.label)),this.mode==="select"&&!this.canSelectObject(e)){this.renderer?.deselect([e.id]),this.syncSelection();return}if(this.mode==="inspect"||this.mode==="view"){let n=this.getSelection().filter(a=>a.id!==e.id).map(a=>a.id);n.length&&this.renderer?.deselect(n)}this.syncSelection()}buildUnitUniverse(e){this.categoryTotalsCache=null;let t=new Map;for(let n of(0,U.allObjects)(e))n.type==="table"&&t.set(n.id,n.label);let s=new Map;for(let n of(0,U.expandChart)(e))if(this.labelToId.set(n.label,n.id),this.labelToSeat.set(n.label,n),this.allIds.push(n.id),t.has(n.rowId)){let a=s.get(n.rowId)??[];a.push(n.id),s.set(n.rowId,a)}for(let[n,a]of s){let o=t.get(n);this.labelToId.has(o)||this.tableChairIds.set(o,a)}for(let n of(0,U.gaAreasOf)(e)){let a=n.displayLabel||n.label;for(let o of(0,U.gaUnitLabels)(n))this.labelToId.has(o)||(this.gaUnitLabelSet.add(o),this.labelNames.set(o,a))}}unitTotal(){return this.allIds.length+this.gaUnitLabelSet.size}paintIds(e){let t=this.labelToId.get(e);return t?[t]:this.tableChairIds.get(e)??[]}knownLabels(){return[...this.labelToId.keys(),...this.gaUnitLabelSet]}repaintAll(){let e=this.renderer;if(!e)return;this.allIds.length&&e.setStatus(this.allIds,"free");let t={free:[],held:[],booked:[],not_for_sale:[]};for(let[s,n]of this.status.entries())t[this.renderStatusOf(s,n)].push(...this.paintIds(s));for(let s of this.unavailableLabels)this.status.has(s)||t.held.push(...this.paintIds(s));["held","booked","not_for_sale"].forEach(s=>{t[s].length&&e.setStatus(t[s],s)})}async connect(){if(this.closed||this.sessionEnded)return;let e;try{if(e=(await this.withAuthRetry(()=>this.api.subscribeTicket(this.key))).protocols,!e.length)throw new Error("manage_subscribe_ticket_missing")}catch(s){this.setLive(!1),this.opts.onError?.(s),this.scheduleReconnect();return}if(this.closed)return;let t;try{t=new WebSocket(this.api.socketUrl(this.key),e)}catch(s){this.opts.onError?.(s),this.scheduleReconnect();return}this.ws=t,this.socketSnapshotSeen=!1,t.onopen=()=>{this.attempt=0,this.setLive(!0),this.startKeepalive(t),this.resnapshot().then(()=>this.refreshControlRoom()).catch(s=>this.opts.onError?.(s)),this.refreshAvailability()},t.onmessage=s=>this.onMessage(s),t.onclose=()=>{this.ws===t&&(this.ws=null),this.stopKeepalive(),this.setLive(!1),this.scheduleReconnect()},t.onerror=()=>{try{t.close()}catch{}}}startKeepalive(e){this.stopKeepalive(),this.pingTimer=setInterval(()=>{if(this.ws===e){try{e.send(JSON.stringify({type:"ping"}))}catch{return}this.pongTimer||(this.pongTimer=setTimeout(()=>{if(this.pongTimer=null,this.ws===e){e.onclose=null,e.onmessage=null;try{e.close()}catch{}this.ws=null,this.stopKeepalive(),this.setLive(!1),this.paintLink("paused"),this.scheduleReconnect()}},5e3))}},1e4)}stopKeepalive(){this.pingTimer&&clearInterval(this.pingTimer),this.pongTimer&&clearTimeout(this.pongTimer),this.pingTimer=null,this.pongTimer=null}scheduleReconnect(){if(this.closed||this.sessionEnded||this.reconnectTimer)return;let e=Math.min(1e3*2**Math.min(this.attempt++,5),15e3);this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}onMessage(e){let t;try{t=JSON.parse(typeof e.data=="string"?e.data:"")}catch{return}if(!t||typeof t!="object"||(this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null),t.type==="pong"))return;this.lastMessageAt=Date.now();let s=t;if((Array.isArray(s.hidden)||Array.isArray(s.closed))&&this.updateEffectiveAvailability(s.hidden,s.closed),s.type==="presence"){typeof s.shoppingSessions=="number"&&typeof s.activeHolds=="number"&&(this.livePresence={at:Date.now(),value:{shoppingSessions:s.shoppingSessions,activeHolds:s.activeHolds}},this.controlRoomSnapshot&&(this.controlRoomSnapshot={...this.controlRoomSnapshot,presence:this.livePresence.value},this.opts.onControlRoom?.(this.controlRoomSnapshot)),this.lastSyncedAt=Date.now(),this.recomputeTallies(),this.paintMonitorInsights());return}if(s.type!=="hidden"){if(s.seats&&typeof s.seats=="object")this.applySocketSnapshot(s.seats,typeof s.default=="string"?s.default:void 0);else if(Array.isArray(s.changes)){let n=[],a=new Map;for(let r of s.changes){let l=Gs(r.status),c=this.status.get(r.label)??"free";if(c===l)continue;(c==="blocked"||l==="blocked")&&this.scheduleReservations(),this.setStatusLabel(r.label,l,c);let d=this.paintIds(r.label);d.length&&(this.renderer?.setStatus(d,this.renderStatusOf(r.label,l)),n.push(...d));let b=this.verbFor(c,l,r.label),f=`${b}:${l}`,u=a.get(f)??{labels:[],verb:b,status:l};u.labels.push(r.label),a.set(f,u)}for(let r of a.values()){let l=this.pushActivity(r.labels,r.verb,r.status);l&&this.paintSpatialActivity(l)}a.size&&this.scheduleMonitorRefresh(),n.length&&(this.lastSyncedAt=Date.now(),this.afterPaint()),this.reconcileSelectionWithStatus([...a.values()].flatMap(r=>r.labels));let o=typeof s.bookedValue?.gross=="number"?s.bookedValue.gross:s.revenue?.gross;typeof o=="number"&&Number.isFinite(o)&&this.applyLiveGross(o),this.recomputeTallies()}}}applyLiveGross(e){if(this.liveGross={at:Date.now(),value:e},this.authoritativeGrossRevenue=e,this.revenueStatus="current",this.controlRoomSnapshot){let s={...this.controlRoomSnapshot.bookedValue??this.controlRoomSnapshot.revenue,gross:e};this.controlRoomSnapshot={...this.controlRoomSnapshot,bookedValue:s,revenue:s},this.opts.onControlRoom?.(this.controlRoomSnapshot)}}setStatusLabel(e,t,s=this.status.get(e)??"free"){if(this.status.set(e,t),s===t)return;let n=this.seatWeight(e);if(s!=="free"&&(this.counts[s]-=n),t!=="free"&&(this.counts[t]+=n),this.alerts){let a=this.labelToSeat.get(e);this.alerts.seatChanged(a?this.sectionByObject.get(a.rowId)??null:null,s,t)}}applySocketSnapshot(e,t){let s=this.socketSnapshotSeen?this.status:null;if(this.applySnapshot(e,t),this.socketSnapshotSeen=!0,!s)return;let n=new Map;for(let a of new Set([...s.keys(),...this.status.keys()])){let o=s.get(a)??"free",r=this.status.get(a)??"free";if(o===r)continue;let l=this.verbFor(o,r,a),c=`${l}:${r}`,d=n.get(c)??{labels:[],verb:l,status:r};d.labels.push(a),n.set(c,d)}for(let a of n.values()){let o=this.pushActivity(a.labels,a.verb,a.status);o&&this.paintSpatialActivity(o)}n.size&&this.scheduleMonitorRefresh()}scheduleMonitorRefresh(){this.monitorRefreshTimer||(this.monitorRefreshTimer=setTimeout(()=>{this.monitorRefreshTimer=null,!this.closed&&(this.refreshControlRoom().catch(e=>this.opts.onError?.(e)),this.paintFullscreenLine(),this.tablesPanel?.update(),this.sectionsPanel?.update())},150))}async resnapshot(){try{let e=await this.api.objects(this.key);this.applySnapshot(e.seats),this.updateEffectiveAvailability(e.hidden,e.closed),this.lastMessageAt=Date.now()}catch{}}applySnapshot(e,t){let s=new Map;if(t!==void 0){let n=Gs(t);for(let a of this.knownLabels())s.set(a,n)}for(let[n,a]of Object.entries(e))s.set(n,Gs(a));this.status=s,this.recountAll(),this.serverBaseline&&!this.serverBaseline.client&&(this.serverBaseline.client=this.pairedClient()),this.modelSynced=!0,this.scheduleReservations(),this.lastSyncedAt=Date.now(),this.repaintAll(),this.afterPaint(),this.recomputeTallies(),this.reconcileSelectionWithStatus(null)}reconcileSelectionWithStatus(e){if(!this.renderer)return;let t=this.getSelection();if(!t.length)return;if(e){let a=new Set(e);if(!t.some(o=>a.has(o.label)))return}if(this.mode==="select"){this.reconcileSelectPolicy();return}let s=new Set(this.selectableStatuses()),n=t.filter(a=>!s.has(this.renderStatusOf(a.label,this.status.get(a.label)??"free")));n.length&&this.renderer.deselect(n.map(a=>a.id)),this.syncSelection()}recountAll(){let e={held:0,booked:0,blocked:0};for(let[t,s]of this.status)s!=="free"&&(e[s]+=this.seatWeight(t));this.counts=e}seatWeight(e){return this.tableChairIds.get(e)?.length??1}setSeatsLocal(e,t){let s=[],n=[];for(let a of e)this.setStatusLabel(a,t),(this.renderStatusOf(a,t)===Ne(t)?s:n).push(...this.paintIds(a));s.length&&this.renderer?.setStatus(s,Ne(t)),n.length&&this.renderer?.setStatus(n,"held"),this.afterPaint(),this.recomputeTallies()}afterPaint(){this.keepLive&&typeof document<"u"&&document.hidden&&this.renderer?.forceDraw()}activityColor(e){return e==="held"?Ce.held:e==="booked"?Ce.booked:e==="blocked"?Ce.blocked:Ce.free}sectionsForLabels(e){let t=new Set;for(let n of e){let a=this.labelToSeat.get(n);if(!a)continue;let o=this.sectionByObject.get(a.rowId);o&&o!==U.UNGROUPED_ID&&t.add(o)}let s=[...t];return{ids:s,labels:s.map(n=>this.sectionLabelById.get(n)??n)}}pulseSeatLabels(e,t){let s=this.activityColor(t);for(let n of e.slice(0,Qa)){let a=this.labelToId.get(n);a&&this.renderer?.flashSeat(a,s)}}paintSpatialActivity(e){let t=e.sectionIds??this.sectionsForLabels(e.labels).ids,s=this.renderer?.getFocusedSection()??null;if(this.followLive&&t.length===1&&(e.status==="held"||e.status==="booked")){let a=this.root?.querySelector('[data-ref="followstatus"]');a&&(a.textContent=`Following ${e.labels.length===1?this.labelNames.get(e.labels[0])??e.labels[0]:`${e.labels.length} seats`} \xB7 ${e.status}`),this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.followLiveTimer=setTimeout(()=>{this.followLiveTimer=null,this.focusActivitySeats(e.labels,t[0]),this.followSeatTimer=setTimeout(()=>{this.followSeatTimer=null,this.pulseSeatLabels(e.labels,e.status)},520)},220);return}if(!s&&t.length){let a=this.activityColor(e.status);for(let o of t.slice(0,eo))this.renderer?.flashSection(o,a);return}(!t.length||s&&t.includes(s))&&this.pulseSeatLabels(e.labels,e.status)}locateSection(e){this.renderer?.focusSection(e)}focusActivitySeats(e,t){this.renderer?.focusSection(t);let s=e.slice(0,Qa).map(l=>this.labelToSeat.get(l)).filter(l=>!!l);if(!s.length)return;let n=s.map(l=>l.x),a=s.map(l=>l.y),o=Math.min(...n),r=Math.min(...a);this.renderer?.focusRegion({x:o-150,y:r-100,width:Math.max(...n)-o+300,height:Math.max(...a)-r+200})}locateActivity(e){let t=this.feed.find(n=>n.id===e);if(!t)return;let s=t.sectionIds??this.sectionsForLabels(t.labels).ids;if(this.followSeatTimer&&clearTimeout(this.followSeatTimer),s.length===1){this.focusActivitySeats(t.labels,s[0]),this.followSeatTimer=setTimeout(()=>{this.followSeatTimer=null,this.pulseSeatLabels(t.labels,t.status)},520);return}this.zoomToFit(),this.followSeatTimer=setTimeout(()=>{if(this.followSeatTimer=null,s.length){let n=this.activityColor(t.status);for(let a of s.slice(0,eo))this.renderer?.flashSection(a,n)}else this.pulseSeatLabels(t.labels,t.status)},280)}showLiveEvent(e){let t=this.els.liveevent;if(!t)return;let s=e.sectionLabels??[],n=s.length===1?s[0]:s.length>1?`${s.length} sections`:this.labelNames.get(e.label)??e.label,a=e.count===1?"seat":"seats";t.innerHTML=`<span class="slm-liveeventdot" style="background:${this.activityColor(e.status)}"></span>
1747
- <span class="slm-liveeventcopy">${w(n)} \xB7 ${e.count.toLocaleString()} ${a} ${w(mn(e.verb))}</span>
1748
- <span class="slm-liveeventhint">Live</span>`,t.classList.add("on"),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.liveEventTimer=setTimeout(()=>{this.liveEventTimer=null,t.classList.remove("on"),t.innerHTML=""},2800)}applyReportRevenue(e){this.authoritativeGrossRevenue=e.report.byCategory.reduce((t,s)=>{let n=Number.isFinite(s.bookedValue)?s.bookedValue:s.bookedRevenue;return t+(Number.isFinite(n)?n:0)},0),this.revenueStatus="current",this.recomputeTallies()}async refreshControlRoom(){let e=++this.revenueRequest,t=Date.now();try{let s=await this.api.controlRoom(this.key,this.trendWindowMinutes),n=s.bookedValue??s.revenue??{gross:0,bySection:[]},a=(n.bySection??[]).map(l=>{let c=Number.isFinite(l.bookedValue)?l.bookedValue:l.bookedRevenue;return{...l,bookedValue:c??0,bookedRevenue:c??0}}),o={...n,bySection:a},r={...s,bookedValue:o,revenue:o};if(e===this.revenueRequest){if(this.livePresence&&this.livePresence.at>=t?r={...r,presence:this.livePresence.value}:this.livePresence=null,this.liveGross&&this.liveGross.at>=t){let d={...r.bookedValue,gross:this.liveGross.value};r={...r,bookedValue:d,revenue:d}}else this.liveGross=null;this.controlRoomSnapshot=r,this.adoptLabelNames(r.displayLabels),r.activity&&this.seedFeed(r.activity),this.rebaseServerTotals(r),this.controlRoomSettled=!0,this.lastSyncedAt=Date.now(),this.authoritativeGrossRevenue=r.bookedValue.gross,this.authoritativeCurrency=r.currency,this.currency=r.currency,this.revenueStatus="current",this.recomputeTallies(),this.applyHeatOverlay(),this.paintMonitorInsights(),this.seatHistoryPanel?.refresh();let l=this.getSelection().slice(-1)[0],c=this.els.rail?.querySelector("[data-seat-status]");l&&c&&(c.textContent=this.status.get(l.label)??"free"),this.opts.onControlRoom?.(r)}return r}catch(s){throw e===this.revenueRequest&&(this.revenueStatus="stale",this.controlRoomSettled=!0,this.recomputeTallies()),s}}rebaseServerTotals(e){let t=o=>!!o&&["free","held","booked","blocked"].every(r=>Number.isFinite(o[r])),s=t(e.seatTotals)?e.seatTotals:null,n=s??e.totals;if(!t(n)){this.serverBaseline=null;return}let a=s?.reserved;this.serverBaseline={server:{free:n.free,held:n.held,booked:n.booked,blocked:n.blocked,...Number.isFinite(a)?{reserved:a}:{}},client:this.modelSynced?this.pairedClient():null}}pairedClient(){return{...this.clientTallies(),reserved:this.reservationsLoaded?this.reservedBlockedCount():null}}clientTallies(){let{held:e,booked:t,blocked:s}=this.counts;return{held:e,booked:t,blocked:s,free:Math.max(0,this.unitTotal()-e-t-s)}}buildTallies(){let e=this.clientTallies(),t=this.serverBaseline,s=r=>t?Math.max(0,t.server[r]+(t.client?e[r]-t.client[r]:0)):e[r],n=this.controlRoomSnapshot?.event?.seatTotal,a={free:s("free"),held:s("held"),booked:s("booked"),blocked:s("blocked"),total:Number.isFinite(n)?n:this.unitTotal(),capacityPct:0,sellThroughPct:0,bookedValue:this.authoritativeGrossRevenue,grossRevenue:this.authoritativeGrossRevenue,bookedValueStatus:this.revenueStatus,revenueStatus:this.revenueStatus,currency:this.currency};a.capacityPct=a.total?Math.round(a.booked/a.total*100):0;let o=a.total-a.blocked;return a.sellThroughPct=o>0?Math.round(a.booked/o*100):0,a}recomputeTallies(){if(!this.closed){if(typeof requestAnimationFrame!="function"){this.flushTallies();return}this.paintHandle===null&&(this.paintHandle=requestAnimationFrame(()=>{this.paintHandle=null,this.flushTallies()}))}}talliesReady(){return this.serverBaseline!==null||this.controlRoomSettled&&this.modelSynced}flushTallies(){if(this.closed)return;let e=this.buildTallies(),t=this.talliesReady();this.paintKpis(e,t),this.paintColourLegend(),this.minimap?.refreshMinimap(),this.paintMapChrome(),this.mode==="view"?(this.paintMonitorInsights(),this.paintWatchSeat(this.getSelection())):this.mode==="block"?this.paintSelBar(this.getSelection()):this.mode==="reserve"?this.paintReserveSelection(this.getSelection()):this.mode==="channels"&&this.channels?.handleSelectionChange(),t&&this.opts.onTallies?.(e)}verbFor(e,t,s){return t==="held"?"held":t==="booked"?"booked":t==="blocked"?s&&(this.reserving.has(s)||this.reservedBy.has(s))?"reserved":"blocked":t==="free"?e==="blocked"?s&&this.reservedBy.has(s)?"unreserved":"unblocked":e==="booked"?"cancelled":"available":t}pushActivity(e,t,s,n=Date.now()){let a=e[0];if(!a)return null;let o=this.sectionsForLabels(e),r={id:`${a}:${n}:${Math.random().toString(36).slice(2,6)}`,at:n,label:a,labels:[...e],count:e.length,verb:t,status:s,sectionIds:o.ids,sectionLabels:o.labels};return this.controlRoomSnapshot?.activity||this.feed.unshift(r),this.feed.length>is&&(this.feed.length=is),this.mode==="view"&&this.paintFeed(),this.showLiveEvent(r),this.opts.onActivity?.(r),r}adoptLabelNames(e){for(let[t,s]of Object.entries(e??{}))typeof s=="string"&&s&&this.labelNames.set(t,s)}seedFeed(e){this.controlRoomSnapshot?.activity&&(this.feed=this.feed.filter(n=>n.id.startsWith("log:")));let t={hold:"held",book:"booked",release:"released",expire:"expired",block:"blocked",unblock:"unblocked",unbook:"cancelled",reserve:"reserved",unreserve:"unreserved","reservation.end":"unreserved"},s={hold:"held",book:"booked",release:"free",expire:"free",block:"blocked",unblock:"free",unbook:"free",reserve:"blocked",unreserve:"free","reservation.end":"free"};for(let n of e){if(this.feed.some(l=>l.id===`log:${n.id}`))continue;let a=n.labels[0];if(!a)continue;let o=this.sectionsForLabels(n.labels),r={id:`log:${n.id}`,at:n.at,label:a,labels:[...n.labels],count:n.labels.length,verb:t[n.action]??n.action,status:s[n.action]??"free",sectionIds:o.ids,sectionLabels:o.labels};this.feed.push(r),this.opts.onActivity?.(r)}this.feed.sort((n,a)=>a.at-n.at),this.feed.length>is&&(this.feed.length=is),this.mode==="view"&&this.paintFeed()}startFeedClock(){this.feedTimer=setInterval(()=>{this.mode==="view"&&(this.paintFeed(),this.paintMonitorInsights())},1e4)}selectionCap(){return this.mode!=="select"?1e6:this.opts.numberOfPlacesToSelect??this.opts.maxSelectedObjects??1e6}isHostUnavailable(e){return this.unavailableLabels.has(e)}renderStatusOf(e,t){return t==="free"&&this.unavailableLabels.has(e)?"held":Ne(t)}canSelectObject(e){if(this.isHostUnavailable(e.label))return!1;let t=this.status.get(e.label)??"free",s=this.opts.unavailableObjectsSelectable??!0,n=t==="free"||s||this.selectableObjectLabels.has(e.label);if(!this.opts.isObjectSelectable)return n;try{return this.opts.isObjectSelectable(e,n)===!0}catch(a){return this.opts.onError?.(a),!1}}applyInitialSelection(){this.initialSelectionApplied||this.mode!=="select"||!this.renderer||(this.initialSelectionApplied=!0,this.selectByLabels(this.opts.selectedObjects??[]))}trimSelectionToCap(){if(this.mode!=="select")return;let e=this.getSelection(),t=this.selectionCap();e.length<=t||this.renderer?.deselect(e.slice(t).map(s=>s.id))}reconcileSelectPolicy(){if(this.mode!=="select")return;let e=this.getSelection().filter(t=>!this.canSelectObject(t));e.length&&this.renderer?.deselect(e.map(t=>t.id)),this.trimSelectionToCap(),this.syncSelection()}selectionLabels(){return this.getSelection().map(e=>e.label)}paintTaskPicker(){let e=this.els.taskpick;if(!e)return;let t=this.taskGroups.flatMap(s=>s.tools).find(s=>s.mode===this.mode)??{mode:this.mode,label:this.mode==="view"?"Watch":this.mode};e.innerHTML=Tn(t,this.taskGroups,this.taskMenuOpen),this.taskMenuOpen&&e.querySelector('[aria-checked="true"]')?.focus()}isSheet(){return!!this.root?.classList.contains("compact")&&this.mode!=="channels"}sheetDetent(){return this.detents.get(this.mode)??"half"}setDetent(e){this.detents.set(this.mode,e),this.applyDetent()}applyDetent(){let e=this.root;e&&(this.isSheet()?e.dataset.detent=this.sheetDetent():delete e.dataset.detent,this.paintPeek())}paintPeek(){let e=this.els.peek;if(!e)return;let t=this.taskGroups.flatMap(n=>n.tools).find(n=>n.mode===this.mode)?.label??"",s=this.renderer?this.getSelection().length:0;e.textContent=s?`${fe(s)} selected \xB7 ${t}`:t}wireSheet(){let e=this.els.grab;if(!e)return;let t=["peek","half","full"],s=null,n=!1;e.addEventListener("pointerdown",o=>{s=o.clientY,n=!1}),e.addEventListener("pointerup",o=>{if(s==null)return;let r=o.clientY-s;if(s=null,Math.abs(r)<40)return;n=!0;let l=t.indexOf(this.sheetDetent());this.setDetent(t[Math.max(0,Math.min(2,l+(r>0?-1:1)))])}),e.addEventListener("click",()=>{if(n){n=!1;return}let o=this.sheetDetent();this.setDetent(o==="peek"?"half":o==="half"?"full":"half")});let a=this.els.taskpick;a?.addEventListener("click",o=>{let r=o.target,l=r.closest("[data-taskpick-mode]")?.dataset.taskpickMode;if(l){this.taskMenuOpen=!1,this.setMode(l);return}r.closest("[data-taskpick]")&&(this.taskMenuOpen=!this.taskMenuOpen,this.paintTaskPicker())}),this.root?.addEventListener("click",o=>{this.taskMenuOpen&&a&&!o.composedPath().includes(a)&&(this.taskMenuOpen=!1,this.paintTaskPicker())})}syncSelection(){let e=this.getSelection(),t=this.lastSelectionLabels;!this.selRestoring&&(e.length!==t.size||e.some(n=>!t.has(n.label)))&&(this.selBack.push([...t]),this.selBack.length>50&&this.selBack.shift(),this.selAhead=[]),this.savedApplied&&(e.length!==this.savedApplied.labels.size||e.some(n=>!this.savedApplied.labels.has(n.label)))&&(this.savedApplied=null,this.root?.querySelector(".slm-savedpill")?.remove()),e.length&&!this.categoryBusy&&!this.blockBusy&&(this.panelAlert=null),this.mode==="block"?this.paintSelBar(e):this.mode==="reserve"?this.paintReserveSelection(e):this.mode==="view"?this.paintWatchSeat(e):this.mode==="select"?this.paintSelectSelection(e):this.mode==="categories"?this.paintCategorySelection(e):this.mode==="channels"&&this.channels?.handleSelectionChange(),this.paintPeek();let s=new Map(e.map(n=>[n.label,n]));if(this.mode==="select"){for(let[a,o]of s)this.lastSelectionLabels.has(a)||this.opts.onObjectSelected?.(o);for(let a of this.lastSelectionLabels)if(!s.has(a)){let o=this.labelToSeat.get(a);o&&this.opts.onObjectDeselected?.(o)}let n=this.getSelectionValidity();n&&(this.opts.onSelectionValidityChange?.(n),this.selectionWasValid!==n.isValid&&(n.isValid?this.opts.onSelectionValid?.(n):this.opts.onSelectionInvalid?.(n)),this.selectionWasValid=n.isValid)}this.lastSelectionLabels=new Set(s.keys()),this.navigation?.historyChanged(this.selBack.length>0,this.selAhead.length>0),this.opts.onSelectionChange?.(e)}buildChrome(){let e=document.createElement("div"),t=this.opts.chrome==="minimal";e.className=`${t?"slm slm-minimal":"slm"}${this.opts.kpis===!1?" no-kpis":""}`,e.tabIndex=0,e.setAttribute("role","region"),e.setAttribute("aria-label",t?"Seat map":"SeatLayer live control room"),e.innerHTML=`
1780
+ </details>`}function Mi(i,e,t){let s=Ft(),n=!1;i.querySelectorAll("[data-view]").forEach(o=>{let r=o.dataset.view,l=e[r];o.setAttribute("aria-checked",String(l)),o.classList.toggle("on",l),l!==s[r]&&(n=!0)}),i.querySelector("summary")?.classList.toggle("away",n);let a=i.querySelector('[data-ref="viewnote"]');a&&(a.hidden=!t.momentumLoading,a.textContent=t.momentumLoading?"Booking momentum: loading the first snapshot\u2026":"")}ge();bs();var Ei=require("@seatlayer/core");function Rs(i){return Object.entries(i).filter(([,e])=>e.mode==="closed").map(([e])=>e)}function As(i){let e=i.sectionsBase;if(!e)return{rows:[],hiddenSections:0,closedSections:0};let t=i.doc?.zones??[],s=new Map,n=[];for(let c of e.sections)if(c.zone&&t.some(d=>d.id===c.zone)){let d=s.get(c.zone)??[];d.push(c),s.set(c.zone,d)}else n.push(c);let a=[],o=0,r=0,l=(c,d,g,b=!1,m)=>{let p=i.availabilityRules[d.id]??null,f=i.effectiveClosed.has(d.id)||b,k=i.effectiveHidden.has(d.id)||g&&!f;c==="section"&&k&&(o+=1),c==="section"&&f&&(r+=1),a.push({kind:c,id:d.id,label:d.label,seatCount:d.seatCount,seatLabels:d.seatLabels,rule:p,hidden:k,closed:f,followsZone:c==="section"&&g,...m?{zoneId:m}:{}})};for(let c of t){let d=s.get(c.id);if(!d||!d.length)continue;let g={id:c.id,label:c.label||"Zone",seatCount:d.reduce((p,f)=>p+f.seatCount,0),seatLabels:d.flatMap(p=>p.seatLabels)},b=!!i.availabilityRules[c.id],m=i.availabilityRules[c.id]?.mode==="closed";l("zone",g,!1);for(let p of d)l("section",p,b,m,c.id)}for(let c of n)l("section",c,!1);if(e.ungrouped){let c=e.ungrouped;l("section",{id:Ei.UNGROUPED_ID,label:c.label,seatCount:c.seatCount,seatLabels:c.seatLabels},!1)}return{rows:a,hiddenSections:o,closedSections:r}}me();var Fl="https://api.seatlayer.io",ds=200,Mo=16,Eo=4,Ho=[{key:"watch",label:"Watch",tools:[{mode:"view",label:"Watch",shortcut:"M",title:"See what is selling, where buyers are, and answer questions about any seat."}]},{key:"manage",label:"Manage",tools:[{mode:"reserve",label:"Reserve",shortcut:"R",title:"Keep seats aside under a name (guests, press, comps) until you release them or the time runs out."},{mode:"block",label:"Block",shortcut:"B",title:"Take seats off sale for this event, or put them back."},{mode:"categories",label:"Ticket types",shortcut:"G",title:"Change which ticket type seats sell as, for this event only."},{mode:"sections",label:"Sections",shortcut:"S",title:"Open, close or hide sections for this event, on a schedule or on demand."},{mode:"tables",label:"Tables",shortcut:"T",title:"Sell each table per chair or as one whole-table booking."},{mode:"channels",label:"Channels",shortcut:"C",title:"Allocate inventory to sales channels and share their links."}]},{key:"host",label:"Host tools",tools:[{mode:"select",label:"Select",shortcut:"X",title:"Select seats for your own back-office operation. The selection is handed to your app; nothing changes here."},{mode:"filterSections",label:"Filter",shortcut:"L",title:"Filter the map to one section for your own reporting."}]}],Nl=new Set(["select","block","reserve","categories","channels"]),ql=3;function dn(i){return i==="resale"?"booked":i==="held"||i==="booked"||i==="blocked"?i:"free"}function _l(i){let e=i?.status;return e===401||e===403}var Ro=i=>`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${i}</svg>`,hn={enter:Ro('<path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5"/>'),exit:Ro('<path d="M9 4v5H4M20 9h-5V4M15 20v-5h5M4 15h5v5"/>')},jl=Object.fromEntries(Ho.flatMap(i=>i.tools.map(e=>[e.shortcut.toLowerCase(),e.mode]))),pe=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,ut=i=>K(i,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),hs=class{constructor(e){this.els={};this.renderer=null;this.doc=null;this.selectObserver=null;this.seatHistoryPanel=null;this.changes=null;this.changesLoading=null;this.feedFilter="all";this.saved=null;this.savedCount=null;this.savedApplied=null;this.arrival=[];this.activityPanel=null;this.navigation=null;this.movingMap=!1;this.marqueeShape="box";this.hintUntil=0;this.socketSnapshotSeen=!1;this.monitorRefreshTimer=null;this.themeMode=null;this.colorSchemeStop=null;this.inventoryModelVersion=1;this.selectableObjectLabels=new Set;this.unavailableLabels=new Set;this.lastSelectionLabels=new Set;this.selBack=[];this.selAhead=[];this.channelsReturn=null;this.selRestoring=!1;this.selectionWasValid=null;this.initialSelectionApplied=!1;this.labelToId=new Map;this.idToLabel=new Map;this.labelToSeat=new Map;this.allIds=[];this.gaUnitLabelSet=new Set;this.tableChairIds=new Map;this.labelNames=new Map;this.status=new Map;this.counts={held:0,booked:0,blocked:0};this.modelSynced=!1;this.controlRoomSettled=!1;this.currency="USD";this.authoritativeCurrency=null;this.authoritativeGrossRevenue=0;this.revenueStatus="loading";this.revenueRequest=0;this.controlRoomSnapshot=null;this.serverBaseline=null;this.reservationsLoaded=!1;this.livePresence=null;this.liveGross=null;this.paintHandle=null;this.trendWindowMinutes=15;this.heatEnabled=!1;this.mapView=Ft();this.categoryChoice=null;this.lastSectionTap=null;this.press=null;this.lastPick=null;this.categoryBusy=!1;this.categoryDone=null;this.categoryFailed=!1;this.categoryUndoing=!1;this.lockedTypes=null;this.selJustSold=new Set;this.selLeft=null;this.reconcilingSel=!1;this.selWhole=!1;this.blockBusy=!1;this.panelAlert=null;this.categoryTotalsCache=null;this.rowLabelCache=null;this.colourChoices={};this.extras=null;this.reserve=null;this.alerts=null;this.sectionsPanel=null;this.tablesPanel=null;this.findBlocked=null;this.reservedBy=new Map;this.reserving=new Set;this.reservationWheres=new Map;this.reservedIds=new Set;this.reservationsTimer=null;this.blockGroups=null;this.eventStartsAt=null;this.search=null;this.searchSeatList=null;this.minimap=null;this.lastKpiValues=new Map;this.activeKpiDeltas=new Map;this.ws=null;this.reconnectTimer=null;this.pingTimer=null;this.pongTimer=null;this.attempt=0;this.closed=!1;this.connectionStatus="reconnecting";this.lastMessageAt=null;this.ready=!1;this.feed=[];this.feedTimer=null;this.toastTimer=null;this.liveEventTimer=null;this.kpiCleanupTimer=null;this.followLiveTimer=null;this.followSeatTimer=null;this.releaseAt=null;this.blockEnd="never";this.blockDone=null;this.blockFailedNow=!1;this.blockDenied=!1;this.layoutObserver=null;this.chromeClearance=-1;this.chromeClearanceWidth=-1;this.legendInset="";this.tokenExpiresAt=null;this.tokenRefreshTimer=null;this.tokenRefreshInFlight=!1;this.tokenRefreshFailures=0;this.sessionEnded=!1;this.taskGroups=[];this.taskMenuOpen=!1;this.detents=new Map;this.linkState="live";this.linkTimers=null;this.everLive=!1;this.announcedRoomState=null;this.sectionByObject=new Map;this.sectionLabelById=new Map;this.sectionsBase=null;this.filteredSectionLabel=null;this.availabilityRules={};this.effectiveHidden=new Set;this.effectiveClosed=new Set;this.blockCaptions=new Map;this.captionsOn=!1;this.lastSyncedAt=null;this.blockBrowse=!1;this.channels=null;this.chooser=null;this.chooserDialog=null;this.extrasReady=null;this.categoryDifferences=null;this.channelCaps={view:!1,manage:!1};this.categoryCanManage=!1;this.tableCanManage=!1;this.tableBookingSaving=!1;this.channelCapabilityResolution=0;this.channelsLoading=null;this.onFullscreenChange=()=>{this.paintFullscreenButton(),this.paintFullscreenLine(),this.updateContainerLayout(),this.renderer?.forceDraw()};this.onKeyDown=e=>{if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),this.openSearch();return}let s=!!e.target?.closest('input,select,textarea,[contenteditable="true"]');if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="z"){!s&&this.stepSelection(e.shiftKey?1:-1)&&e.preventDefault();return}if(e.metaKey||e.ctrlKey||e.altKey||s)return;let n=e.key.toLowerCase();if(/^[1-9]$/.test(n)){let r=this.taskGroups.flatMap(l=>l.tools)[Number(n)-1];r&&(this.setMode(r.mode),e.preventDefault());return}if((n==="l"||n==="v")&&!e.shiftKey&&this.isBulkSelectMode()){this.navigation?.choose(n==="l"?"lasso":"select"),e.preventDefault();return}let a=e.shiftKey?Si(n):null;if(a){this.toggleMapView(a),e.preventDefault();return}if(n==="/"){e.preventDefault(),this.openSearch();return}let o=jl[n];if(o){if(!this.toolAvailable(o))return;this.setMode(o)}else if(n==="f")this.toggleFullscreen();else if(n==="escape"){let r=this.els.view;if(r?.open)r.open=!1,r.querySelector("summary")?.focus();else if(this.litChip)this.onLegendChip(this.litChip,!1);else if(this.taskMenuOpen)this.taskMenuOpen=!1,this.paintTaskPicker(),this.els.taskpick?.querySelector("[data-taskpick]")?.focus();else if(!this.channels?.handleBack())if(this.isSheet()&&this.sheetDetent()==="full")this.setDetent("half");else if(this.getSelection().length)this.clearSelection();else return}else return;e.preventDefault()};this.onSelectAllKey=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey||e.key.toLowerCase()!=="a"||e.target?.closest('input,select,textarea,[contenteditable="true"]')||(e.preventDefault(),e.stopPropagation(),this.isBulkSelectMode()?this.selectInView():this.mode==="select"&&this.selectAll())};this.onHowClick=e=>{let t=e.target?.closest("[data-how]")?.dataset.how;if(!t)return;let n=t==="current"?{view:"watch",reserve:"reserve",block:"block",categories:"types",sections:"sections",tables:"tables",channels:"channels"}[this.mode]??"watch":t;this.loadExtras().then(a=>{this.closed||!this.root||a.openExplainer({root:this.root,plate:Z,touch:Oe(),guideUrl:"https://docs.seatlayer.io/platform/embedded-control-room/#operator-modes",tryIt:o=>{let r={watch:"view",reserve:"reserve",block:"block",types:"categories",sections:"sections",tables:"tables",channels:"channels"};o==="search"?this.openSearch():o==="colours"?this.root?.querySelector('[data-ref="colourby"]')?.click():r[o]&&r[o]!==this.mode&&this.toolAvailable(r[o])&&this.setMode(r[o])}},n)}).catch(a=>this.opts.onError?.(a))};this.onRailClick=e=>{let t=e.target,s=t?.closest("[data-section-focus]");if(s?.dataset.sectionFocus){this.locateSection(s.dataset.sectionFocus);return}let n=t?.closest("[data-feed-id]");n?.dataset.feedId&&this.locateActivity(n.dataset.feedId),t?.closest("[data-sel-clear]")&&this.clearSelection(),t?.closest("[data-sel-undo]")&&this.stepSelection(-1),t?.closest("[data-sel-save]")&&this.ensureSaved().then(o=>o?.openSave());let a=t?.closest("[data-sel-similar]");a&&this.openSimilar(a),t?.closest("[data-saved-list], [data-saved-open]")&&this.ensureSaved().then(o=>o?.openList())};this.priceMode=!1;this.priceShadesOn="";this.bandIndex=null;this.typeKeyBySection=null;this.typeKeyBase=null;this.legendSeats=null;this.litChip=null;this.chipPicked=null;this.shownObjects=null;this.barNeed=[0,0,0];this.sectionOptions=[];this.addByPinned=!1;vs(e.token),this.assertSelectionOptions(e.maxSelectedObjects,e.numberOfPlacesToSelect),this.opts=e,this.key=e.eventKey,this.mode=e.mode??"view",this.selectableObjectLabels=new Set(e.selectableObjects??[]),this.unavailableLabels=new Set(e.unavailableObjects??[]),this.categoryCanManage=new Set(e.capabilities??[]).has("event:categories:manage"),this.tableCanManage=new Set(e.capabilities??[]).has("event:tables:manage"),this.keepLive=e.keepLiveWhileHidden??!0,gn(e.timeZone),this.themeMode=e.themeMode??null,this.followLive=e.followLive??!1,this.currency=e.currency??"USD",this.tokenExpiresAt=e.tokenExpiresAt??null,this.api=new et(e.apiBase??Fl,e.token),this.organizerAssetUrls=new Ot(this.key,(t,s)=>this.withAuthRetry(()=>this.api.asset(t,s))),this.host=xn(e.container)}selectInView(){let e=this.renderer?.getVisibleWorldRect?.();if(!e)return;let t=[...this.labelToSeat.values()].filter(s=>s.x>=e.x&&s.x<=e.x+e.width&&s.y>=e.y&&s.y<=e.y+e.height);this.renderer?.selectByLabels(t.map(s=>s.label)),this.syncSelection(),this.selWhole=t.length===this.labelToSeat.size&&this.getSelection().length>0,this.selWhole&&this.syncSelection()}assertSelectionOptions(e,t){let s=n=>n===void 0||Number.isInteger(n)&&n>0;if(!s(e))throw new TypeError("maxSelectedObjects must be a positive integer");if(!s(t))throw new TypeError("numberOfPlacesToSelect must be a positive integer");if(e!==void 0&&t!==void 0&&e<t)throw new TypeError("maxSelectedObjects cannot be lower than numberOfPlacesToSelect")}async render(){return Kn(),this.buildChrome(),await this.load(),this}async load(){try{let e=await this.withAuthRetry(()=>this.api.chart(this.key));this.inventoryModelVersion=e.event.inventoryModelVersion===2?2:1,this.eventStartsAt=e.event.startsAt??null,this.doc=await this.organizerAssetUrls.prepareRendererChart(e.doc),this.authoritativeCurrency=e.event.currency??null,this.currency=this.authoritativeCurrency??this.opts.currency??this.currency,this.buildUnitUniverse(this.doc),this.buildRenderer(),this.buildSectionOptions(),this.settleMode();let[,t]=await Promise.all([this.resnapshot(),this.refreshControlRoom().catch(s=>this.opts.onError?.(s)),this.refreshAvailability()]);t?.activity?this.seedFeed(t.activity):this.api.log(this.key,{limit:24}).then(s=>{this.adoptLabelNames(s.displayLabels),this.seedFeed(s.entries)}).catch(()=>{}),this.connect(),this.startFeedClock(),this.ready=!0,await this.resolveChannelCapabilities(),this.setMode(this.mode),this.root?.querySelector('[data-ref="opening"]')?.remove(),this.applyInitialSelection(),this.scheduleTokenRefresh(),this.opts.onReady?.(),this.mountAlerts(),this.ensureSaved().then(s=>s?.refresh()),this.withExtras(()=>{}),(this.opts.focusSection||this.opts.focusSeat||this.opts.focusSeats?.length||this.opts.focusCategory||this.opts.arrivedFrom||this.opts.onOpenTrend&&this.opts.kpis!==!1)&&this.mountArrival()}catch(e){this.fail(e)}}setMode(e){e==="inspect"&&(e="view"),this.toolAvailable(e)||(e="view"),e==="channels"&&!this.channels&&this.ensureChannels();let t=e!==this.mode,s=this.mode==="channels",n=this.mode==="filterSections";this.mode=e,t&&e!=="view"&&this.setFollowLive(!1),t&&this.navigation?.resetTool(),!this.renderer&&this.doc?this.buildRenderer():this.updateRendererInteraction(),t&&(this.renderer?.clearSelection(),this.syncSelection(),this.selBack=[],this.selAhead=[],this.navigation?.historyChanged(!1,!1)),t&&e==="channels"&&(this.channelsReturn=this.mapReturnPoint()),s&&e!=="channels"&&(this.channels?.leave(),this.restoreMapReturn()),t&&(this.litChip=null,this.highlightLabels(null),this.wireBarFind()),this.paintModeTabs(),t&&this.setColourBy(this.colourChoices[e]??this.startingColourBy(e),!1);let a=!t&&(e==="tables"?this.tablesPanel:e==="sections"?this.sectionsPanel:null);a?a.update():this.paintRail(),this.applyDetent(),this.paintMapViewMenu(),this.applyMapView(),this.applySectionCanvasTreatment(),n&&e!=="filterSections"&&this.renderer?.zoomToFit(),e==="channels"&&this.channels?.enter(),e==="select"&&this.applyInitialSelection(),t&&this.opts.onModeChange?.(e)}async resolveChannelCapabilities(){let e=++this.channelCapabilityResolution,t=this.opts.capabilities,s;if(t){let n=new Set(t);s={view:n.has("event:channels:view"),manage:n.has("event:channels:view")&&n.has("event:channels:manage")}}else s={view:!1,manage:!1};if(!s.view&&!t)try{await this.api.channels(this.key),s={view:!0,manage:!1}}catch{s={view:!1,manage:!1}}if(e===this.channelCapabilityResolution){if(this.channelCaps=s,!this.channelCaps.view){this.channels?.destroy(),this.channels=null,this.mode==="channels"?this.setMode("view"):this.paintModeTabs();return}this.channels?.setCapabilities(this.channelCaps),this.paintModeTabs()}}ensureChannels(){if(this.channelsLoading)return this.channelsLoading;if(this.channels)return Promise.resolve();let e=(async()=>{try{let t=await Promise.resolve().then(()=>(Ds(),Yi));if(this.closed||!this.channelCaps.view||(this.channels||(Wn(t.CHANNELS_CSS),this.channels=new t.ChannelsMode(this.buildChannelsHost(),this.channelCaps),this.channels.onInteractionChange=()=>this.updateRendererInteraction()),this.mode!=="channels"))return;this.updateRendererInteraction(),this.paintRail(),this.channels.enter(),this.setColourBy(this.colourChoices.channels??this.startingColourBy("channels"),!1)}catch(t){if(this.closed)return;this.channelsLoading=null,this.mode==="channels"&&this.paintRail(),this.opts.onError?.(t)}})();return this.channelsLoading=e,e}buildChooserHost(){let e=s=>{let n=this.labelToSeat.get(s);return n?this.mode==="block"?this.isBlockSelectable(s):this.mode==="reserve"?this.isReserveSelectable(s):this.mode==="select"?this.canSelectObject(n):!0:!1};return{selectionLabels:()=>this.selectionLabels(),selectByLabels:s=>{this.selectByLabels(s)},clearSelection:()=>this.clearSelection(),selectSection:s=>{this.selectSection(s)},sections:()=>this.sectionOptions,sectionInfo:s=>{let n=this.filterableSections().find(o=>o.id===s),a=this.sectionTypeKeys().get(s);return{total:n?.seatCount??0,color:this.doc?.categories.find(o=>o.key===a)?.color}},labelsInSection:s=>(this.renderer?.getSelectableInSection(s)??[]).map(n=>n.label).filter(e),rows:()=>{let s=new Map((this.doc?.objects??[]).map(a=>[a.id,a])),n=new Map;for(let a of this.labelToSeat.values()){let o=s.get(a.rowId);if(!o||o.type!=="row"&&o.type!=="table")continue;let r=a.logicalRowId??a.rowId,l=this.sectionByObject.get(a.rowId)??G.UNGROUPED_ID,c=n.get(r)??{id:r,label:o.type==="row"?o.segmentedRow?.displayLabel??o.displayLabel??o.label:o.displayLabel??o.label,sectionId:l,sectionLabel:this.sectionLabelById.get(l)??"Other seats",labels:[],all:[]};c.all.push(a.label),e(a.label)&&c.labels.push(a.label),n.set(r,c)}return[...n.values()].sort((a,o)=>a.sectionLabel.localeCompare(o.sectionLabel,void 0,{numeric:!0,sensitivity:"base"})||a.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"}))},categories:()=>(this.doc?.categories??[]).map(s=>({key:s.key,label:s.label??s.key,color:s.color,total:this.categoryTotals().get(s.key)??0})),labelsInCategory:s=>[...this.labelToSeat.values()].filter(n=>n.categoryKey===s&&e(n.label)).map(n=>n.label),seats:()=>[...this.labelToSeat.values()].filter(s=>e(s.label)).map(s=>({label:s.label})),statusOf:s=>this.status.get(s)??(this.labelToSeat.has(s)?"free":void 0),sectionOfLabel:s=>{let n=this.labelToSeat.get(s);if(!n)return null;let a=this.sectionByObject.get(n.rowId)??G.UNGROUPED_ID;return{id:a,label:this.sectionLabelById.get(a)??"Other seats"}},openDialog:(s,n)=>{let a=o=>{this.chooserDialog=o.openManagerDialog(this.root,s,n,{previous:this.chooserDialog,onClose:()=>{this.chooserDialog=null}})};this.extrasReady?a(this.extrasReady):this.withExtras(a)},closeDialog:()=>this.chooserDialog?.close(),enhanceDialog:s=>this.withExtras(n=>n.pickerKeys(s)),pickers:()=>this.extrasReady??this.loadExtras().then(s=>this.extrasReady=s),pickerFailed:s=>this.pickerFailed(s),highlight:s=>this.highlightLabels(s),...this.mode==="select"?{cap:this.selectionCap()}:{}}}wireBarFind(){let e=this.els.findbar;!e||e.dataset.wired||(e.dataset.wired="1",e.innerHTML=`<button type="button" class="slm-findtrigger" aria-keyshortcuts="Meta+K Control+K"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#4c6fff" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg><span>Seat, row or booking</span>${ys()}</button>`,e.querySelector("button").addEventListener("click",()=>{this.openSearch()}))}async loadExtras(){if(!this.extras){let t=typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?(0,Ao.importCdnAsset)("seatlayer-manager-extras.mjs"):Promise.resolve().then(()=>(To(),Co));this.extras=t.catch(s=>{throw this.extras=null,s})}let e=await this.extras;return Gn(e.EXTRAS_CSS),e}withExtras(e){this.loadExtras().then(t=>{this.extrasReady=t,this.closed||e(t)},()=>{})}pickerFailed(e){this.toast("Couldn't open that list. Check the connection.","err",{label:"Try again",run:e})}async openSearch(e=""){try{let t=await this.loadExtras();if(this.closed||!this.root)return;this.search?.close(),this.search=t.openEventSearch({root:this.root,touch:Oe(),seats:()=>this.searchSeats(),statusOf:s=>this.status.get(s)??"free",describe:s=>{let n=this.doc?.categories.find(a=>a.key===this.labelToSeat.get(s)?.categoryKey);return n?`${n.label}${typeof n.price=="number"?` ${we(n.price,this.currency)}`:""}`:""},canSelect:()=>this.isChoosingTool(),show:s=>this.showLabels(s),select:s=>{this.selectByLabels(s)},lookupOrders:this.canReadOrders()?s=>this.api.lookupOrders(this.key,s):void 0,lookupSeats:this.canReadOrders()?s=>this.api.eventRequest(this.key,`seats/lookup?q=${encodeURIComponent(s)}`):void 0,openOrder:this.opts.onOpenOrder?s=>this.opts.onOpenOrder(s):void 0,blockReasons:()=>this.blockGroups?new Set(this.blockGroups.groups.map(s=>s.reason??"")).size:null,blockedBy:s=>{let n=s.trim().toLowerCase();return n.length<3?[]:(this.blockGroups?.groups??[]).filter(a=>a.reason&&a.reason.toLowerCase().includes(n)).map(a=>({reason:a.reason,labels:a.labels}))},saved:()=>this.saved?.rows()??null,useSaved:(s,n)=>{this.saved?.use(s,n)},reserved:()=>{!this.blockGroups&&this.toolAvailable("block")&&this.loadBlockGroups().catch(()=>{});let s=[...this.reservedBy.keys()].filter(n=>this.status.get(n)==="blocked");return{labels:s,count:new Set(s.map(n=>this.reservedBy.get(n).id)).size}},recents:{read:()=>{try{return JSON.parse(localStorage.getItem(`seatlayer.controlRoom.search.${this.key}`)??"[]")}catch{return[]}},write:s=>{try{localStorage.setItem(`seatlayer.controlRoom.search.${this.key}`,JSON.stringify(s))}catch{}}}},e)}catch(t){this.toastErr("Search could not load. Check the connection and try again."),this.opts.onError?.(t)}}canReadOrders(){return this.opts.capabilities?.includes("event:orders:read")===!0}searchSeats(){if(this.searchSeatList?.base===this.sectionsBase)return this.searchSeatList.seats;let e=new Map;for(let s of this.doc?.objects??[])s.type==="row"?e.set(s.id,s.segmentedRow?.displayLabel??s.displayLabel):s.type==="table"&&e.set(s.id,s.displayLabel);let t=[];for(let s of this.labelToSeat.values()){let n=this.sectionByObject.get(s.rowId)??G.UNGROUPED_ID;t.push({label:s.label,sectionId:n,sectionLabel:this.sectionLabelById.get(n)??"Other seats",rowKey:s.logicalRowId??s.rowId,rowDisplay:e.get(s.rowId)})}return this.searchSeatList={base:this.sectionsBase,seats:t},t}isChoosingTool(){return this.isBulkSelectMode()||this.mode==="select"}frameLabels(e){let t=e.map(s=>this.labelToSeat.get(s)?.id).filter(s=>!!s);t.length&&(this.setFollowLive(!1),this.renderer?.focusSeats?.(t,{animate:!0}))}highlightLabels(e){if(!e){this.renderer?.setSeatHighlight?.(null);return}this.renderer?.setSeatHighlight?.(e.map(t=>this.labelToSeat.get(t)?.id).filter(t=>!!t))}toolChooser(){return this.chooserDialog?.close({restoreFocus:!1}),this.chooser=new tt(this.buildChooserHost()),this.chooser}toolSelectionBar(e,t,s,n){return Xn({count:0,noun:"selected",breakdown:`<span class="slm-selactions"><button type="button" class="slm-linkbtn" data-ref="${n}">Select all</button></span>`,clearAttr:`data-ref="${s}"`}).replace('class="slm-selnum"',`class="slm-selnum" data-ref="${e}"`).replace('class="slm-sellabel"',`class="slm-sellabel" data-ref="${t}"`)}buildChannelsHost(){return{moved:e=>this.recordChange({kind:"channel",...e}),channelsChanged:()=>{this.getColourBy()==="channel"&&this.paintColourLegend()},eventKey:this.key,api:this.api,rail:this.els.rail,pickers:()=>this.extrasReady??this.loadExtras().then(e=>this.extrasReady=e),pickerFailed:e=>this.pickerFailed(e),enhanceDialog:e=>this.withExtras(t=>t.pickerKeys(e)),mapLayer:this.root.querySelector(".slm-map"),pillLane:this.els.lane,root:this.root,seats:()=>[...this.labelToSeat.values()].map(e=>({id:e.id,label:e.label,x:e.x,y:e.y})),statusOf:e=>this.status.get(e)??(this.labelToSeat.has(e)?"free":void 0),selectionLabels:()=>this.selectionLabels(),selectByLabels:e=>{this.selectByLabels(e)},clearSelection:()=>this.clearSelection(),selectSection:e=>{this.selectSection(e)},sections:()=>this.sectionOptions,labelsInSection:e=>this.renderer?.getSelectableInSection(e).map(t=>t.label)??[],rows:()=>{let e=new Map((this.doc?.objects??[]).map(s=>[s.id,s])),t=new Map;for(let s of this.labelToSeat.values()){let n=e.get(s.rowId);if(!n||n.type!=="row"&&n.type!=="table")continue;let a=s.logicalRowId??s.rowId,o=this.sectionByObject.get(s.rowId)??G.UNGROUPED_ID,r=t.get(a)??{id:a,label:n.type==="row"?n.segmentedRow?.displayLabel??n.displayLabel??n.label:n.displayLabel??n.label,sectionId:o,sectionLabel:this.sectionLabelById.get(o)??"Other seats",labels:[]};r.labels.push(s.label),t.set(a,r)}return[...t.values()].sort((s,n)=>s.sectionLabel.localeCompare(n.sectionLabel,void 0,{numeric:!0,sensitivity:"base"})||s.label.localeCompare(n.label,void 0,{numeric:!0,sensitivity:"base"}))},categories:()=>(this.doc?.categories??[]).map(e=>({key:e.key,label:e.label??e.key,color:e.color,price:e.price,tiers:e.tiers?.map(t=>({id:t.id,name:t.name,price:t.price}))})),labelsInCategory:e=>[...this.labelToSeat.entries()].filter(([,t])=>t.categoryKey===e).map(([t])=>t),sectionOfLabel:e=>{let t=this.labelToSeat.get(e);if(!t)return null;let s=this.sectionByObject.get(t.rowId)??G.UNGROUPED_ID;return{id:s,label:this.sectionLabelById.get(s)??"Other seats"}},worldToScreen:e=>this.renderer?.worldToScreen(e)??null,seatPixelSize:()=>this.seatPixelSize(),isSeatDetail:()=>this.renderer?.getRung?.()==="seats",showSectionOverview:()=>{this.renderer?.clearSectionFocus(),this.renderer?.setRung?.("sections")},focusSection:e=>this.renderer?.focusSection(e),isCompact:()=>!!this.root?.classList.contains("compact"),setMapInert:e=>{this.mapHost.toggleAttribute("inert",e),this.mapHost.setAttribute("aria-hidden",String(e))},toast:(e,t)=>this.toast(e,t),onError:e=>this.opts.onError?.(e)}}seatPixelSize(){let e=this.renderer?.getVisibleWorldRect?.(),t=this.mapHost?.clientWidth??0;return!e?.width||!t?6:Math.max(3,t/e.width*18)}setHeatOverlay(e){this.heatEnabled=e,this.mapView.momentum!==e&&this.setMapView({momentum:e}),this.applyHeatOverlay(),this.paintHeatButton()}setMapView(e){let t={...this.mapView,...e};if(!Object.keys(t).some(a=>t[a]!==this.mapView[a]))return;let n=t.categoryColours!==this.mapView.categoryColours||t.channelColours!==this.mapView.channelColours;this.mapView=t,$i(t),t.momentum!==this.heatEnabled&&this.setHeatOverlay(t.momentum),this.applyMapView(),this.paintMapViewMenu(),n&&(this.refreshBlockPaint(),this.paintMapChrome())}getColourBy(){return this.mapView.channelColours&&this.channelColoursAvailable()?"channel":this.mapView.categoryColours?this.priceMode?"price":"type":"status"}setColourBy(e,t=!0){let s=e==="full"||e==="channel"&&!this.channelColoursAvailable()?"status":e;t&&(this.colourChoices={...this.colourChoices,[this.mode]:s},wi(this.colourChoices)),this.litChip&&s!==this.getColourBy()&&(this.litChip=null,this.highlightLabels(null)),this.priceMode=s==="price",this.setMapView({categoryColours:s==="type"||s==="price",channelColours:s==="channel"}),this.applyPriceColours(),this.paintColourLegend()}startingColourBy(e){let t=this.opts.colourBy;return t&&e!=="channels"?t==="full"?"status":t:xi(e)}getMapView(){return{...this.mapView}}toggleMapView(e){if(e==="categoryColours"||e==="channelColours"){let t=e==="categoryColours"?"type":"channel";this.setColourBy(this.getColourBy()===t?"status":t);return}this.setMapView({[e]:!this.mapView[e]})}channelColoursAvailable(){return this.mode==="channels"&&this.channels!=null}applyMapView(){Ci(this.mapView,{renderer:this.renderer,channelsOverlay:e=>this.channels?.setOverlayVisible(e)}),this.applyPriceColours()}applyPriceColours(){let e=this.extrasReady;if(this.priceMode&&!e){this.withExtras(()=>{this.applyPriceColours(),this.paintColourLegend()});return}let t=this.priceMode?e.priceShades(this.typePrices(),this.root?.dataset.theme==="light"):null,s=JSON.stringify(t);!this.renderer||s===this.priceShadesOn||(this.priceShadesOn=s,this.renderer.setCategoryColourOverride?.(t),this.refreshBlockPaint())}typePrices(){let e=this.hoverPriceRanges(),t=new Map;for(let s of this.doc?.categories??[]){let n=e===null?void 0:e?.[s.key]?.min??s.price;typeof n=="number"&&t.set(s.key,n)}return t}paintMapViewMenu(){let e=this.els.view;e&&Mi(e,this.mapView,{momentumLoading:this.mapView.momentum&&!this.controlRoomSnapshot})}setFollowLive(e){let t=this.followLive!==e;this.followLive=e,e||(this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.followLiveTimer=null,this.followSeatTimer=null),this.paintFollowLiveButton(),t&&this.opts.onFollowLiveChange?.(e)}setKeepLiveWhileHidden(e){this.keepLive=e??!0,this.opts.keepLiveWhileHidden=e}setCurrency(e){this.opts.currency=e,!this.authoritativeCurrency&&(this.currency=e??"USD",this.ready&&this.recomputeTallies())}setSale(e){this.opts.sale=e,this.paintFullscreenLine(),this.paintMonitorInsights()}setTheme(e){this.opts.theme=e,this.applyThemeVars()}applyThemeVars(){if(!this.root)return;let e=gs(this.themeMode);for(let[t,s]of Object.entries(kn(this.opts.theme,e)))this.root.style.setProperty(t,s);e?this.root.dataset.theme=e:delete this.root.dataset.theme,this.applyPriceColours()}watchThemeMode(){this.colorSchemeStop?.(),this.colorSchemeStop=null,this.themeMode==="auto"&&(this.colorSchemeStop=fn(()=>{this.closed||this.repaintForThemeMode()}))}repaintForThemeMode(){this.applyThemeVars();let e=this.renderer;if(!e||!this.doc)return;let t=e.getSelection().map(a=>a.id),s=e.getCameraPose(),n=e.getFocusedSection();e.setChart(this.themedDoc()),this.repaintAll(),this.applyHeatOverlay(),t.length&&e.select(t),n&&e.focusSection(n),e.setCameraPose(s),this.updateZoomHint()}setThemeMode(e){let t=e??null;this.closed||t===this.themeMode||(this.themeMode=t,this.opts.themeMode=t??void 0,this.watchThemeMode(),this.repaintForThemeMode())}getThemeMode(){return this.themeMode}themedDoc(){let e=this.doc,t=wn(gs(this.themeMode));return t?{...e,theme:{...e.theme??{},background:t}}:e}setCapabilities(e){this.opts.capabilities=e,this.categoryCanManage=new Set(e??[]).has("event:categories:manage"),this.tableCanManage=new Set(e??[]).has("event:tables:manage"),this.mode==="categories"&&!this.toolAvailable("categories")||!this.tableCanManage&&this.mode==="tables"?this.setMode("view"):this.mode==="categories"?this.paintRail():this.paintModeTabs(),this.ready&&this.resolveChannelCapabilities()}setTokenRefresh(e){this.opts.onTokenRefresh=e,this.scheduleTokenRefresh()}setTrendWindow(e){let t=Number.isFinite(e)?Math.floor(e):15;return this.trendWindowMinutes=Math.max(5,Math.min(60,t)),this.paintTrendWindow(),this.refreshControlRoom()}async enterFullscreen(){!this.root?.requestFullscreen||this.isFullscreen()||(await this.root.requestFullscreen(),this.root.focus({preventScroll:!0}))}async exitFullscreen(){typeof document>"u"||!this.isFullscreen()||await document.exitFullscreen()}isFullscreen(){return typeof document<"u"&&document.fullscreenElement===this.root}toggleFullscreen(){(this.isFullscreen()?this.exitFullscreen():this.enterFullscreen()).catch(t=>this.opts.onError?.(t))}setToken(e,t){vs(e),this.api.setToken(e),this.opts.token=e,this.opts.tokenExpiresAt=t,this.tokenExpiresAt=t??null,this.scheduleTokenRefresh(),this.ready&&this.resolveChannelCapabilities()}scheduleTokenRefresh(){this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null;let e=this.opts.onTokenRefresh,t=this.tokenExpiresAt;if(this.closed||!e||!t||!Number.isFinite(t))return;let s=t-Date.now(),n=Math.min(12e4,Math.max(3e4,s*.2)),a=Math.max(0,s-n);this.tokenRefreshTimer=setTimeout(()=>{this.tokenRefreshTimer=null,this.rotateToken()},a)}async rotateToken(){if(!(this.closed||this.sessionEnded||this.tokenRefreshInFlight||!this.opts.onTokenRefresh)){this.tokenRefreshInFlight=!0;try{let e=await this.opts.onTokenRefresh();if(!e?.token||!Number.isFinite(e.expiresAt))throw new Error("invalid_token_refresh_result");this.tokenRefreshFailures=0,this.setToken(e.token,e.expiresAt)}catch(e){this.opts.onError?.(e),this.tokenRefreshFailures+=1,!this.closed&&(this.tokenRefreshFailures>=ql||_l(e))?this.endSession():this.closed||(this.tokenRefreshTimer=setTimeout(()=>{this.tokenRefreshTimer=null,this.rotateToken()},3e4))}finally{this.tokenRefreshInFlight=!1}}}endSession(){if(this.sessionEnded)return;this.sessionEnded=!0,this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.monitorRefreshTimer&&clearTimeout(this.monitorRefreshTimer),this.monitorRefreshTimer=null;let e=this.ws;if(this.ws=null,e){e.onclose=null;try{e.close()}catch{}}this.stopKeepalive(),this.setLive(!1),this.paintSessionEnded()}async retrySession(){if(this.closed||!this.sessionEnded)return!this.sessionEnded;if(!this.opts.onTokenRefresh)return!1;this.sessionEnded=!1,this.tokenRefreshFailures=0;let e=this.root?.querySelector('[data-ref="roomcard"]');return e?.setAttribute("data-busy","true"),await this.rotateToken(),this.sessionEnded?(e?.removeAttribute("data-busy"),!1):(e?.remove(),this.attempt=0,this.connect(),!0)}paintSessionEnded(){if(this.root?.querySelector('[data-ref="roomcard"][data-kind="signedout"]'))return;this.showRoomCard("signedout");let e=this.root?.querySelector('[data-ref="roomcard"] p'),t=this.mode==="view"?null:this.taskGroups.flatMap(n=>n.tools).find(n=>n.mode===this.mode)?.label??null,s=this.getSelection().length;e&&this.withExtras(n=>n.nameWorkInHand(e,t,s,this.els.rail??null))}async block(e,t={}){let s=(e??this.selectionLabels()).filter(l=>this.status.get(l)==="free");if(!s.length||this.blockBusy)return;let n=t.releaseAt??this.releaseAt??void 0,a=`${pe(s.length)}`;this.setSeatsLocal(s,"blocked"),this.blockBusy=!0,this.panelAlert=null,this.paintSelBar(this.getSelection());let o=this.selectionSummary(s.flatMap(l=>this.labelToSeat.get(l)??[])).where,r=n?`They go back on sale ${ut(n)}.`:"They stay off sale until you put them back.";try{await this.api.block(this.key,s,{...t,releaseAt:n}),this.blockBusy=!1,this.blockFailedNow=!1,this.clearSelection(),this.blockDone={labels:s,until:Date.now()+3e4},setTimeout(()=>{!this.closed&&this.mode==="block"&&this.paintSelBar(this.getSelection())},30100),this.panelAlert=Q("ok",`${a} blocked${t.reason?` \xB7 ${t.reason}`:""}`,` ${o}. ${r}`),this.paintSelBar(this.getSelection()),this.doneQuietly("block",s,`${a} blocked${t.reason?` \xB7 ${t.reason}`:""}.`),this.recordChange({kind:"block",labels:s,reason:t.reason??null,releaseAt:n??null})}catch(l){this.blockBusy=!1,this.setSeatsLocal(s,"free");let c=l instanceof W&&l.status===409?(l.conflicts??[]).map(g=>g.label).filter(g=>s.includes(g)):[],d=s.filter(g=>!c.includes(g));if(c.length&&d.length){this.renderer?.deselect(c.map(g=>this.labelToId.get(g)).filter(g=>!!g)),this.syncSelection();try{this.setSeatsLocal(d,"blocked"),await this.api.block(this.key,d,{...t,releaseAt:n}),this.blockDone={labels:d,until:Date.now()+3e4,partial:!0},this.panelAlert=Q("warn",`${c.length.toLocaleString()} ${c.length===1?"seat was":"seats were"} sold while you chose`,` ${pe(d.length)} blocked. ${He(c)} ${c.length===1?"is":"are"} sold and stay${c.length===1?"s":""} with ${c.length===1?"its buyer":"their buyers"}.`),this.paintSelBar(this.getSelection()),this.paintSelBar(this.getSelection()),this.doneQuietly("block",d,`${d.length.toLocaleString()} blocked.`),this.recordChange({kind:"block",labels:d,reason:t.reason??null,releaseAt:n??null});return}catch(g){this.setSeatsLocal(d,"free"),l=g}}if(this.blockFailedNow=!c.length,l instanceof W&&l.status===403){this.blockFailedNow=!1,this.blockDenied=!0,this.withExtras(g=>this.blockFailed(g.blockRefused(this.opts.organizationName),"info")),this.opts.onError?.(l);return}this.blockFailed(c.length?["Those seats were just taken"," Nothing was blocked. They are sold or in a cart now."]:["Couldn\u2019t block the seats"," The connection dropped before the change was saved. Buyers can still pick them."]),this.opts.onError?.(l)}}async unblock(e){let t=(e??this.selectionLabels()).filter(n=>this.status.get(n)==="blocked");if(!t.length||this.blockBusy)return;let s=this.blockGroups?.groups.find(n=>n.labels.includes(t[0]));this.setSeatsLocal(t,"free"),this.blockBusy=!0,this.panelAlert=null,this.paintSelBar(this.getSelection());try{await this.api.unblock(this.key,t),this.blockBusy=!1,this.clearSelection(),this.doneQuietly("unblock",t,`${t.length.toLocaleString()} ${t.length===1?"seat is":"seats are"} back on sale.`),this.recordChange({kind:"unblock",labels:t,reason:s?.reason??null,releaseAt:s?.releaseAt??null})}catch(n){this.blockBusy=!1,this.setSeatsLocal(t,"blocked"),this.blockFailed(["Couldn\u2019t put the seats back on sale"," They are still blocked. Your selection is kept; try again."]),this.opts.onError?.(n)}}blockFailed([e,t],s="error"){this.mode==="block"&&this.els.rail?.querySelector('[data-ref="blockfoot"]')?(this.panelAlert=Q(s,e,t,s==="info"?"lock":void 0),this.paintSelBar(this.getSelection())):this.toastErr(`${e}.${t}`)}async unblockAll(){let e=[...this.status.entries()].filter(([t,s])=>s==="blocked"&&!this.reservedBy.has(t)).map(([t])=>t);if(e.length){this.setSeatsLocal(e,"free");try{let t=await this.api.unblockAll(this.key);this.clearSelection(),this.doneQuietly("unblockAll",e,`Unblocked ${t.freed} seat${t.freed===1?"":"s"}.`),this.recordChange({kind:"unblock",labels:e})}catch(t){await this.resnapshot(),this.toastErr("Couldn't mark everything for sale."),this.opts.onError?.(t)}}}async cancelBooking(e,t){let s=e.filter(n=>this.status.get(n)==="booked");if(!(!s.length||!t)){this.setSeatsLocal(s,"free");try{await this.api.unbook(this.key,s,t),this.clearSelection(),this.doneQuietly("cancelBooking",s,`Released ${s.length} booked unit${s.length===1?"":"s"}.`)}catch(n){this.setSeatsLocal(s,"booked"),this.toastErr("Couldn't release that booked inventory. Check the booking reference."),this.opts.onError?.(n)}}}async setCategory(e,t){let s=this.doc?.categories.find(r=>r.key===e),n=[...new Set(t??this.selectionLabels())].filter(r=>this.labelToSeat.has(r));if(!s||!n.length||this.categoryBusy||!this.categoryCanManage)return;let a=s.label??s.key,o=new Map(n.map(r=>[r,this.labelToSeat.get(r).categoryKey]));this.categoryBusy=!0,this.categoryFailed=!1,this.categoryDone=null,this.panelAlert=null,this.paintCategorySelection(this.getSelection());try{let r=await this.withAuthRetry(()=>this.api.setCategory(this.key,n,e));this.applyCategory(r.labels,e);let l=new Set(r.labels),c=n.filter(d=>!l.has(d));if(this.categoryBusy=!1,c.length){let d=c.every(g=>this.status.get(g)==="booked"||this.status.get(g)==="held");this.panelAlert=this.alertOf((await this.loadExtras()).typesPartly(c,r.labels.length,a,d)),this.reconcilingSel=!0;try{this.renderer?.deselect(c.map(g=>this.labelToId.get(g)).filter(g=>!!g)),this.syncSelection()}finally{this.reconcilingSel=!1}}this.categoryDone={labels:r.labels,name:a,prev:o,until:Date.now()+3e4,partial:c.length>0},setTimeout(()=>{!this.closed&&this.mode==="categories"&&this.paintCategorySelection(this.getSelection())},30100),this.categoryTotalsCache=null,this.paintCategorySelection(this.getSelection()),this.mode==="categories"&&this.loadCategoryDifferences(),this.done("setCategory",r.labels,`${r.labels.length.toLocaleString()} ${r.labels.length===1?"seat now sells":"seats now sell"} as ${a}.`),this.recordChange({kind:"types",labels:r.labels,title:`Changed ${pe(r.labels.length)} to ${a}`})}catch(r){this.categoryBusy=!1;let l=await this.loadExtras().catch(()=>null);r instanceof W&&r.status===403?this.categoryCanManage=!1:this.categoryFailed=!0,l&&(this.panelAlert=this.alertOf(this.categoryCanManage?l.TYPES_FAILED:l.typesLocked(this.opts.organizationName))),this.mode==="categories"?this.paintCategorySelection(this.getSelection()):this.toastErr("Couldn\u2019t move the seats. Nothing changed for buyers."),this.opts.onError?.(r)}}applyCategory(e,t){let s={};for(let n of e){let a=this.labelToSeat.get(n),o=this.labelToId.get(n);a&&(a.categoryKey=t),o&&(s[o]=t)}this.categoryTotalsCache=null,this.renderer?.setSeatCategories?.(s)}async undoCategory(){let e=this.categoryDone;if(!(!e||this.categoryBusy)){this.categoryBusy=this.categoryUndoing=!0,this.categoryDone=this.panelAlert=null,this.paintCategorySelection(this.getSelection());try{await(await this.loadExtras()).undoTypes(e.labels,e.prev,async(t,s)=>{this.applyCategory((await this.withAuthRetry(()=>this.api.setCategory(this.key,t,s))).labels,s)}),this.categoryBusy=this.categoryUndoing=!1,this.clearSelection(),this.mode==="categories"&&this.loadCategoryDifferences(),this.done("setCategory",e.labels,`${pe(e.labels.length)} back as they were.`),this.recordChange({kind:"types",labels:e.labels,title:`Undid the move of ${pe(e.labels.length)} to ${e.name}`})}catch(t){this.categoryBusy=this.categoryUndoing=!1,this.categoryDone={...e,until:Date.now()+3e4},this.paintCategorySelection(this.getSelection()),this.opts.onError?.(t)}}}alertOf(e){return Q(e[0],e[1],e[2],e[3])}async setTableBooking(e,t,s={}){if(this.inventoryModelVersion!==2){this.toastErr("Table booking controls require inventory model 2 for this event.");return}let n=await this.saveTableBooking(e,t,s);n==="conflict"?this.toastErr("Release table seats that are in a cart, booked or blocked before changing its booking mode."):n==="failed"&&this.toastErr("Couldn't update table booking. No table mode was changed.")}async saveTableBooking(e,t,s={}){let n=[...new Set(e)].filter(Boolean);if(!n.length||this.tableBookingSaving||this.inventoryModelVersion!==2)return"skipped";this.tableBookingSaving=!0;try{let a=await this.withAuthRetry(()=>this.api.setTableBooking(this.key,n,t,s));return await this.reloadEventChart(),this.doneQuietly("setTableBooking",a.tableIds,`Updated ${a.tableIds.length.toLocaleString()} table${a.tableIds.length===1?"":"s"} to ${t==="individual"?"per-chair":t==="whole"?"whole-table":"flexible-group"} booking.`),this.recordChange({kind:"tables",labels:a.tableIds.map(o=>this.tableInfos().find(r=>r.id===o)?.label??o),title:`${a.tableIds.length===1?"A table now books":`${a.tableIds.length.toLocaleString()} tables now book`} ${t==="individual"?"by the chair":t==="whole"?"as a whole":"as a group"}`}),"ok"}catch(a){return this.opts.onError?.(a),a instanceof W&&a.code==="table_inventory_in_use"?"conflict":"failed"}finally{this.tableBookingSaving=!1}}async reloadEventChart(){let e=await this.withAuthRetry(()=>this.api.chart(this.key));this.inventoryModelVersion=e.event.inventoryModelVersion===2?2:1;let t=await this.organizerAssetUrls.prepareRendererChart(e.doc);this.renderer?.destroy(),this.renderer=null,this.doc=t,this.labelToId.clear(),this.labelToSeat.clear(),this.allIds=[],this.gaUnitLabelSet.clear(),this.tableChairIds.clear(),this.labelNames.clear(),this.status.clear(),this.counts={held:0,booked:0,blocked:0},this.serverBaseline=null,this.modelSynced=!1,this.controlRoomSettled=!1,this.lastSelectionLabels.clear(),this.selBack=[],this.selAhead=[],this.buildUnitUniverse(t),this.buildRenderer(),this.buildSectionOptions(),this.settleMode(),await Promise.all([this.resnapshot(),this.refreshControlRoom().catch(s=>this.opts.onError?.(s)),this.refreshAvailability()]),this.mode==="tables"&&this.tablesPanel?this.tablesPanel.update():this.paintRail()}selectAll(){if(this.mode==="select")return this.selectByLabels([...this.labelToSeat.values()].filter(t=>this.canSelectObject(t)).map(t=>t.label));let e=this.renderer?.selectAllSelectable()??[];return this.syncSelection(),this.selWhole=e.length>0,this.selWhole&&this.syncSelection(),e}applyBand(e,t,s){let n=this.renderer;if(!n?.getSelectableInSection||n.getRung?.()==="seats")return!1;if(this.bandIndex?.base!==this.sectionsBase){let r=new Map,l=new Map;for(let[d,g]of this.labelToSeat){let b=this.sectionByObject.get(g.rowId),m=this.labelToId.get(d);if(!b||!m)continue;r.set(m,b);let p=l.get(b)??{x:0,y:0,n:0};p.x+=g.x,p.y+=g.y,p.n+=1,l.set(b,p)}let c=new Map([...l].map(([d,g])=>[d,{x:g.x/g.n,y:g.y/g.n}]));this.bandIndex={base:this.sectionsBase,sectionOf:r,centre:c}}let a=new Set;for(let r of e){let l=this.bandIndex.sectionOf.get(r);l&&a.add(l)}for(let[r,l]of this.bandIndex.centre)t(l)&&a.add(r);let o=[...a].flatMap(r=>n.getSelectableInSection(r));return s?n.deselect(o.map(r=>r.id)):n.selectByLabels?.(o.map(r=>r.label)),!0}handleSeatDeselect(e){let t=this.press;t&&(t.answered=!0);let s=this.lastPick;t?.shift&&s&&s.rowId===e.rowId&&s.label!==e.label&&this.isBulkSelectMode()?(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()},this.renderer?.selectByLabels(xs(this.rowSeats(e.rowId),s.label,e.label))):t&&(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()}),this.syncSelection()}rowSeats(e){return[...this.labelToSeat.values()].filter(t=>t.rowId===e)}wireGestures(e){e.addEventListener("pointerdown",t=>{this.press={shift:t.shiftKey,x:t.clientX,y:t.clientY,answered:!1}},!0),e.addEventListener("click",t=>{let s=this.press;if(!s||s.answered||!this.isBulkSelectMode()||this.renderer?.getRung?.()==="seats"||Math.hypot(t.clientX-s.x,t.clientY-s.y)>5)return;let n=this.renderer,a=e.getBoundingClientRect(),o={x:t.clientX-a.left,y:t.clientY-a.top};if(!n||n.sectionAt?.(o))return;let r=En(o,n.getMinimapSnapshot?.().sections??[],l=>n.worldToScreen(l));r&&this.handleSectionTap(r)}),e.addEventListener("dblclick",()=>{let t=this.lastPick;!t||Date.now()-t.at>700||(this.isBulkSelectMode()?(this.renderer?.selectByLabels(this.rowSeats(t.rowId).map(s=>s.label)),this.syncSelection()):this.mode==="view"&&this.showLabels([t.label]))})}handleSectionTap(e){if(this.press&&(this.press.answered=!0),this.mode==="filterSections"){let t=this.filterableSections().find(s=>s.id===e);t&&this.setFilteredSection(t.label);return}if(this.isBulkSelectMode()&&this.renderer?.getRung?.()!=="seats"){let t=Date.now(),s=this.lastSectionTap?.id===e&&t-this.lastSectionTap.at<450;this.lastSectionTap=s?null:{id:e,at:t},s||this.selectSection(e);return}this.renderer?.focusSection(e),this.channels?.handleSectionFocus(e),this.sectionsPanel?.pick(e)}selectSection(e){if(!this.renderer)return[];let t=this.renderer.getSelectableInSection(e);return this.renderer.selectByLabels(t.map(s=>s.label)),this.syncSelection(),this.renderer.getSelection()}setFilteredSection(e){let t=e.trim(),s=this.filterableSections().filter(o=>o.label===t);if(!s.length)throw new Error(`Unknown event section: ${e}`);let n=t!==this.filteredSectionLabel;this.filteredSectionLabel=t,this.mode==="filterSections"&&(this.applyFilteredSectionCanvas(s),this.renderFilterSectionsRail());let a=s.map(({id:o,label:r,seatCount:l,zone:c})=>({id:o,label:r,seatCount:l,...c?{zone:c}:{}}));return n&&this.opts.onFilteredSectionChange?.(a),a}focusSection(e){let t=e.trim(),s=this.filterableSections().filter(n=>n.label===t);return!this.renderer||!s.length?[]:(this.frameSections(s),s.map(({id:n,label:a,seatCount:o,zone:r})=>({id:n,label:a,seatCount:o,...r?{zone:r}:{}})))}clearFilteredSection(){let e=this.filteredSectionLabel!==null;this.filteredSectionLabel=null,this.renderer?.setDimmedSections(null),this.renderer?.clearSectionFocus(),this.renderer?.zoomToFit(),this.mode==="filterSections"&&this.renderFilterSectionsRail(),e&&this.opts.onFilteredSectionChange?.([])}getFilteredSections(){return this.filteredSectionLabel?this.filterableSections().filter(e=>e.label===this.filteredSectionLabel).map(({id:e,label:t,seatCount:s,zone:n})=>({id:e,label:t,seatCount:s,...n?{zone:n}:{}})):[]}selectByLabels(e){let t=e;if(this.mode==="select"){let s=new Set(this.selectionLabels()),n=this.selectionCap(),a=[...new Set(e)].filter(r=>!s.has(r)).map(r=>this.labelToSeat.get(r)).filter(r=>!!r&&this.canSelectObject(r)),o=Math.max(0,n-s.size);a.length>o&&this.opts.onSelectionLimit?.(n),t=a.slice(0,o).map(r=>r.label)}return this.renderer?.selectByLabels(t),this.syncSelection(),this.getSelection()}selectObjects(e){return this.selectByLabels(e)}deselectObjects(e){let t=e.map(s=>this.labelToId.get(s)).filter(s=>!!s);return this.renderer?.deselect(t),this.syncSelection(),this.getSelection()}selectCategories(e){let t=new Set(e);return this.selectByLabels([...this.labelToSeat.values()].filter(s=>t.has(s.categoryKey)).map(s=>s.label))}deselectCategories(e){let t=new Set(e);return this.deselectObjects(this.getSelection().filter(s=>t.has(s.categoryKey)).map(s=>s.label))}setSelectableObjects(e){this.opts.selectableObjects=[...e],this.selectableObjectLabels=new Set(e),this.reconcileSelectPolicy()}setUnavailableObjects(e,t){this.opts.unavailableObjectsReason=t;let s=new Set(e),n=[...s].filter(o=>!this.unavailableLabels.has(o)).concat([...this.unavailableLabels].filter(o=>!s.has(o)));if(!n.length)return;if(this.opts.unavailableObjects=[...s],this.unavailableLabels=s,this.renderer){let o=new Map;for(let r of n){let l=this.paintIds(r);if(!l.length)continue;let c=this.renderStatusOf(r,this.status.get(r)??"free");o.set(c,[...o.get(c)??[],...l])}for(let[r,l]of o)this.renderer.setStatus(l,r);this.afterPaint()}let a=this.getSelection().filter(o=>this.isHostUnavailable(o.label));a.length&&(this.renderer?.deselect(a.map(o=>o.id)),this.syncSelection())}setCategoryPrices(e){this.opts.categoryPrices=e,this.renderer?.setCategoryPriceRanges(this.hoverPriceRanges()),this.applyPriceColours(),this.paintColourLegend()}hoverPriceRanges(){let e=this.opts.categoryPrices;return e==null?e:Object.fromEntries(Object.entries(e).map(([t,s])=>[t,typeof s=="number"?{min:s,max:s}:{min:s.min,max:s.max}]))}setUnavailableObjectsSelectable(e){this.opts.unavailableObjectsSelectable=e,this.reconcileSelectPolicy()}setObjectSelectable(e){this.opts.isObjectSelectable=e,this.reconcileSelectPolicy()}setMaxSelectedObjects(e){this.assertSelectionOptions(e,this.opts.numberOfPlacesToSelect),this.opts.maxSelectedObjects=e,this.trimSelectionToCap(),this.updateRendererInteraction(),this.syncSelection()}setNumberOfPlacesToSelect(e){this.assertSelectionOptions(this.opts.maxSelectedObjects,e),this.opts.numberOfPlacesToSelect=e,this.selectionWasValid=null,this.trimSelectionToCap(),this.updateRendererInteraction(),this.syncSelection()}getSelectionValidity(){let e=this.opts.numberOfPlacesToSelect;if(e===void 0)return null;let t=this.getSelection(),s=t.length;return{isValid:s===e,count:s,required:e,remaining:Math.max(0,e-s),objects:t}}clearSelection(){this.renderer?.clearSelection(),this.syncSelection()}stepSelection(e){let s=(e<0?this.selBack:this.selAhead).pop();if(!s||!this.renderer)return!1;(e<0?this.selAhead:this.selBack).push([...this.lastSelectionLabels]),this.selRestoring=!0;try{this.renderer.clearSelection();let n=s.filter(a=>this.labelToSeat.has(a));n.length&&this.renderer.selectByLabels(n),this.syncSelection()}finally{this.selRestoring=!1}return!0}getSelection(){return this.renderer?.getSelection?.()??[]}getReport(){return this.api.report(this.key).then(e=>(this.applyReportRevenue(e),e))}getControlRoomSnapshot(e=this.trendWindowMinutes){return this.setTrendWindow(e)}getConnection(){return{status:this.connectionStatus,lastMessageAt:this.lastMessageAt,room:this.roomState()}}getLog(e={}){return this.api.log(this.key,e)}async setHoldTtl(e){try{await this.api.setHoldTtl(this.key,e),this.done("setHoldTtl",[],e?`Hold window set to ${Math.round(e/6e4)} min.`:"Hold window reset.")}catch(t){this.toastErr("Couldn't update the hold window."),this.opts.onError?.(t)}}zoomToFit(){if(this.mode==="filterSections"&&this.filteredSectionLabel){this.clearFilteredSection();return}this.renderer?.clearSectionFocus(),this.renderer?.zoomToFit()}mapReturnPoint(){let e=this.renderer;return e?.getVisibleWorldRect?{rect:e.getVisibleWorldRect(),focused:e.getFocusedSection?.()??null,floor:e.getActiveFloorId?.()??"",overview:e.isFloorOverview?.()??!1}:null}restoreMapReturn(){let e=this.channelsReturn;this.channelsReturn=null;let t=this.renderer;if(!t)return;if(t.clearSectionFocus(),!e)return void t.zoomToFit();if(e.overview&&!t.isFloorOverview?.()?t.setFloorOverview?.(!0):!e.overview&&e.floor&&e.floor!==t.getActiveFloorId?.()&&t.setActiveFloor?.(e.floor),e.focused)return void t.focusSection(e.focused);let{x:s,y:n,width:a,height:o}=e.rect,r=a/1.12,l=o/1.12;t.focusRegion({x:s+(a-r)/2,y:n+(o-l)/2,width:r,height:l})}zoomOutStep(){let e=this.renderer;if(!e)return;if(!e.zoomOutLevel)return void e.zoomOut();let t=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&t&&e.clearSectionFocus()}paintMapChrome(){let e=this.renderer;if(!e||!this.els.crumb)return;let t=e.getFocusedSection?.()??null,s=t?e.getMinimapSnapshot?.().sections.find(r=>r.id===t)??null:null,n=e.getFloors?.()??[],a=n.length>1?e.isFloorOverview?.()?"All floors":n.find(r=>r.id===e.getActiveFloorId?.())?.name??null:null,o=e.getRung?.()==="seats";o!==this.legendSeats&&(this.legendSeats=o,this.paintColourLegend()),ai(this.els,ni({focused:s?{label:s.label,free:s.free,total:s.total,allBlocked:s.free?void 0:this.sectionKeptAside(s.id)}:null,floor:a,seatsRevealed:e.seatsRevealed?.()??!0,atVenueFit:e.atVenueFit?.(),atCeiling:e.canZoomIn?.()===!1||e.seatsPickable?.()===!0}))}sectionKeptAside(e){let t=this.filterableSections().find(a=>a.id===e);if(!t)return;let s=0,n=0;for(let a of t.seatLabels){let o=this.status.get(a)??"free";if(o==="free"||o==="held")return;o==="blocked"&&(this.reservedBy.has(a)?n++:s++)}return s&&n?"both":n?"reserved":s?"blocked":void 0}sectionTypeKeys(){if(this.typeKeyBySection&&this.typeKeyBase===this.sectionsBase)return this.typeKeyBySection;let e=new Map;for(let t of this.filterableSections()){let s=new Map;for(let a of t.seatLabels){let o=this.labelToSeat.get(a)?.categoryKey;o&&s.set(o,(s.get(o)??0)+1)}let n=null;for(let[a,o]of s)(!n||o>s.get(n))&&(n=a);n&&e.set(t.id,n)}return this.typeKeyBySection=e,this.typeKeyBase=this.sectionsBase,e}typeColour(e,t){return this.renderer?.getCategoryColours?.()!==!1&&this.renderer?.categoryDisplayColor?.(e)||t||"#6e7bff"}sectionTypeTint(e){let t=this.sectionTypeKeys().get(e);return t?this.renderer?.categoryDisplayColor?.(t)??null:null}scheduleReservations(e=400){this.closed||this.reservationsTimer||(this.reservationsTimer=setTimeout(()=>{this.reservationsTimer=null,this.refreshReservations()},e))}async refreshReservations(){if(!(this.closed||!this.toolAvailable("reserve")))try{let e=await this.withAuthRetry(()=>this.api.eventRequest(this.key,"reservations"));this.closed||this.setReservations(e.reservations??[]),this.blockGroups=null,this.findBlocked?.refresh()}catch{}}setReservations(e){let t=new Map;for(let o of e){let r=o.createdByYou?"you":o.createdByName??"",l=o.createdAt?K(o.createdAt,{day:"numeric",month:"short"}):"",c=[r,l].filter(Boolean).join(" \xB7 ")||void 0;for(let d of o.labels)t.set(d,{id:o.id,name:o.name,releaseAt:o.releaseAt,count:o.labels.length,by:c})}let s=new Set;for(let o of t.keys())this.reservedBy.has(o)||s.add(o);for(let o of this.reservedBy.keys())t.has(o)||s.add(o);this.reservedBy=t,this.reservationWheres.clear(),this.reservationsLoaded=!0;let n=this.serverBaseline?.client;n&&n.reserved===null&&(n.reserved=this.reservedBlockedCount());for(let o of t.keys())this.reserving.delete(o);this.reservedIds=new Set([...t.keys()].flatMap(o=>this.paintIds(o)));let a=[...s].filter(o=>this.status.get(o)==="blocked").flatMap(o=>this.paintIds(o));a.length&&this.renderer&&(this.renderer.setStatus(a,je("booked")),this.renderer.setStatus(a,je("blocked"))),this.paintColourLegend(),this.paintMapChrome()}async loadBlockGroups(){if(this.blockGroups&&Date.now()-this.blockGroups.at<3e4)return this.blockGroups.groups;let e=await this.withAuthRetry(()=>this.api.eventRequest(this.key,"blocks"));return this.blockGroups={at:Date.now(),groups:e.groups??[]},this.blockGroups.groups}reservedBlockedCount(){let e=0;for(let t of this.reservedBy.keys())this.status.get(t)==="blocked"&&(e+=this.seatWeight(t));return e}reservedTally(e){let t=this.reservedBlockedCount(),s=this.serverBaseline,n=s?.server.reserved,a=s?.client?.reserved,o=n===void 0?t:n+(a==null?0:t-a);return Math.min(e,Math.max(0,o))}paintColourLegend(){let e=this.els.blocklegend;if(!e||!this.renderer)return;let t=this.getColourBy(),s=this.buildTallies();ui(e,{colourBy:t,seats:this.legendSeats??this.renderer.getRung?.()==="seats",types:t==="type"?this.legendTypes():t==="price"?this.extrasReady?.priceChips(this.typePrices(),this.legendTypes(),this.root?.dataset.theme==="light",n=>we(n,this.currency))??[]:[],counts:{free:s.free,held:s.held,booked:s.booked,blocked:s.blocked,reserved:this.reservedTally(s.blocked)},lit:this.litChip,picked:this.chipPicked,shown:this.litChip==="shown"&&this.shownObjects?{name:this.shownObjects.name,count:this.shownObjects.labels.length}:null,channels:t==="channel"?this.channels?.legendChannels()??[]:[],channelAvailable:this.channelColoursAvailable()})}showObjects(e,t="Seats"){let s=(e??[]).filter(n=>this.labelToSeat.has(n));this.shownObjects=s.length?{name:t,labels:s}:null,this.chipPicked=null,this.litChip=this.shownObjects?"shown":this.litChip==="shown"?null:this.litChip,this.highlightLabels(this.litChip?this.chipLabels(this.litChip):null),this.shownObjects&&this.frameLabels(s),this.paintColourLegend()}chipLabels(e){if(e==="shown")return this.shownObjects?.labels??[];let t=[...this.labelToSeat.keys()];if(e.startsWith("type:")){let s=e.slice(5);return t.filter(n=>this.labelToSeat.get(n).categoryKey===s)}if(e.startsWith("price:")){let s=this.typePrices();return t.filter(n=>s.get(this.labelToSeat.get(n).categoryKey)===+e.slice(6))}return e==="reserved"?t.filter(s=>this.reservedBy.has(s)):t.filter(s=>(this.status.get(s)??"free")===e&&(e!=="blocked"||!this.reservedBy.has(s)))}onLegendChip(e,t){let s=this.chipLabels(e);if(t&&(this.isBulkSelectMode()||this.mode==="select")){let n=this.getSelection().length;this.selectByLabels(s);let a=this.getSelection().length-n,o=s.length-a-n;o>0&&this.toast(`${a.toLocaleString()} picked. ${o.toLocaleString()} skipped: this task can\u2019t change them.`,"ok"),this.litChip=e,this.chipPicked=a,this.highlightLabels(null),this.paintColourLegend();return}this.chipPicked=null,this.litChip=this.litChip===e?null:e,this.highlightLabels(this.litChip?s:null),this.paintColourLegend()}legendTypes(){let e=new Map;for(let t of this.labelToSeat.values())e.set(t.categoryKey,(e.get(t.categoryKey)??0)+1);for(let[t,s]of this.status){if(s==="free")continue;let n=this.labelToSeat.get(t)?.categoryKey;n&&e.has(n)&&e.set(n,e.get(n)-1)}return(this.doc?.categories??[]).filter(t=>e.has(t.key)).map(t=>({key:t.key,label:t.label,color:this.renderer?.categoryDisplayColor?.(t.key)??t.color,free:Math.max(0,e.get(t.key))}))}refreshBlockPaint(){this.renderer?.refreshBlockPaint?.(),this.minimap?.refreshMinimap()}mapCamera(){return{getViewport:()=>{let e=this.renderer;return!e?.getVisibleWorldRect||!e.getWorldBounds?null:{visible:e.getVisibleWorldRect(),bounds:e.getWorldBounds()}},getMinimapSnapshot:()=>this.renderer?.getMinimapSnapshot?.()??{sections:[],seats:[]},panToWorld:e=>{this.setFollowLive(!1),this.renderer?.panToWorld?.(e)},clearSectionFocus:()=>this.renderer?.clearSectionFocus?.(),focusSection:e=>{this.setFollowLive(!1),this.renderer?.focusSection(e),this.channels?.handleSectionFocus(e)},overview:()=>{this.setFollowLive(!1),this.zoomToFit()},getFloors:()=>this.renderer?.getFloors?.()??[],getActiveFloorId:()=>this.renderer?.getActiveFloorId?.()??"",isFloorOverview:()=>this.renderer?.isFloorOverview?.()??!1,getRenderer:()=>this.renderer}}syncMinimap(){let e=this.els.minimapMount,t=!!this.root?.classList.contains("compact");if(!e||!this.renderer||t){this.minimap?.dispose(),this.minimap=null;return}if(this.minimap){this.minimap.refreshMinimap();return}this.minimap=ei({controller:this.mapCamera(),root:()=>this.root,cssVar:s=>this.cssVar(s.replace(/^--sl-/,"--slm-")),focusedSectionLabel:()=>{},tint:s=>this.renderer?.categoryDisplayColor?.(s)||void 0},e),this.minimap.refreshMinimap()}cssVar(e){return this.root?getComputedStyle(this.root).getPropertyValue(e).trim():""}destroy(){if(this.selectObserver?.disconnect(),this.closed=!0,this.minimap?.dispose(),this.minimap=null,this.monitorRefreshTimer&&clearTimeout(this.monitorRefreshTimer),this.monitorRefreshTimer=null,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.stopKeepalive(),this.alerts?.destroy(),this.alerts=null,this.linkTimers&&this.linkTimers.forEach(e=>clearTimeout(e)),this.feedTimer&&clearInterval(this.feedTimer),this.toastTimer&&clearTimeout(this.toastTimer),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.reservationsTimer&&clearTimeout(this.reservationsTimer),this.kpiCleanupTimer&&clearTimeout(this.kpiCleanupTimer),this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.paintHandle!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.paintHandle),this.paintHandle=null,this.channels?.destroy(),this.channels=null,this.channelsLoading=null,this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.layoutObserver?.disconnect(),this.layoutObserver=null,this.colorSchemeStop?.(),this.colorSchemeStop=null,this.root?.removeEventListener("keydown",this.onKeyDown),this.els.rail?.removeEventListener("click",this.onRailClick),this.root?.removeEventListener("click",this.onHowClick),typeof document<"u"&&document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.ws){try{this.ws.close()}catch{}this.ws=null}this.reserve?.destroy(),this.reserve=null,this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,this.changes?.destroy(),this.changes=null,this.saved?.destroy(),this.saved=null;for(let e of this.arrival)e.destroy();this.arrival=[],this.activityPanel?.destroy(),this.activityPanel=null,this.navigation?.destroy(),this.navigation=null,this.renderer?.destroy(),this.renderer=null,this.organizerAssetUrls.dispose(),this.root&&this.root.parentNode===this.host&&this.host.removeChild(this.root)}buildRenderer(){if(!this.doc)return;let e=this.isBulkSelectMode();this.renderer=new G.SeatmapRenderer(this.mapHost,{manageMode:!0,organizerGlyph:{apply:(s,n,a,o)=>{let r=n==="cross"?bi(s):void 0;if(r&&this.reservedIds.has(r)){(0,G.clearOrganizerSeatGlyph)(s),gi(s,o);return}Es(s),(0,G.applyOrganizerSeatGlyph)(s,n,a,o)},clear:s=>{Es(s),(0,G.clearOrganizerSeatGlyph)(s)},isPainted:s=>(0,G.isOrganizerGlyphPainted)(s)||zt(s)},marqueeSelect:e&&!this.movingMap,marqueeShape:this.marqueeShape,rowLabelSelect:this.rowLabelSelectable(),maxSelection:this.selectionCap(),selectableStatuses:this.selectableStatuses(),currency:this.currency,onSelect:s=>this.handleSeatSelect(s),onDeselect:s=>this.handleSeatDeselect(s),onSelectionLimit:s=>this.opts.onSelectionLimit?.(s),onMarquee:()=>(this.isBulkSelectMode()&&(this.hintUntil=Date.now()+4e3,this.updateZoomHint(),setTimeout(()=>this.updateZoomHint(),4050)),this.mode==="select"?this.reconcileSelectPolicy():this.syncSelection()),onBand:(s,n,a)=>this.applyBand(s,n,a),onGAClick:s=>{if(this.mode!=="select"||!this.opts.onAreaClick||!this.doc)return;let n=(0,G.gaAreasOf)(this.doc).find(a=>a.id===s);n&&this.opts.onAreaClick({id:n.id,label:n.label,name:n.displayLabel?.trim()||n.label})},onSectionTap:s=>this.handleSectionTap(s),onViewChange:()=>{this.updateZoomHint(),this.paintMapChrome(),this.minimap?.drawMinimapRect(),this.channels?.handleViewChange()},onFocusedSectionChange:()=>{this.paintMapChrome(),this.minimap?.refreshMinimap()},hoverFacts:s=>this.hoverFactsFor(s),hoverCardHead:s=>this.hoverHeadFor(s),hoverSectionHead:(s,n)=>this.sectionHeadFor(s,n),blockPaint:s=>this.captioned(s.id,di(s,{rule:this.availabilityRules[s.id],hiddenNow:this.effectiveHidden.has(s.id),closedNow:this.effectiveClosed.has(s.id),colourBy:this.getColourBy(),typeTint:this.sectionTypeTint(s.id),allBlocked:s.state==="sold-out"?this.sectionKeptAside(s.id):void 0})),openAtSectionsWhenDense:!0});let t=this.renderer;this.loadExtras().then(s=>{this.renderer===t&&(s.paintBlockCaptions(t,this.blockCaptions,()=>this.root?.dataset.theme==="dark"),this.captionsOn=!0,this.refreshBlockPaint())}).catch(()=>{}),this.renderer.setCategoryPriceRanges(this.hoverPriceRanges()),this.priceShadesOn="",this.renderer.setChart(this.themedDoc()),this.chromeClearance=-1,this.applyChromeClearance(),this.legendInset="",this.applyLegendInset(),this.repaintAll(),this.applyHeatOverlay(),this.applyMapView(),this.updateZoomHint(),this.minimap?.dispose(),this.minimap=null,this.syncMinimap(),this.paintMapChrome()}hoverFactsFor(e){let t=this.seatOfId(e);if(!t)return null;let s=this.status.get(t.label)??"free",n={free:"Free",held:"In a cart",booked:"Sold",blocked:"Blocked"},o=s==="free"&&this.isHostUnavailable(t.label)?this.opts.unavailableObjectsReason?.trim()||"Unavailable":n[s],r=s==="blocked"?this.reservedBy.get(t.label):void 0;if(r){let g=r.releaseAt==null?"No end":`${ut(r.releaseAt)}${r.releaseAt===this.eventStartsAt?" (the start)":""}`,b=this.reservationWhere(r.id);return[{caption:"Until",value:g},...r.by?[{caption:"Reserved by",value:r.by}]:[],{caption:"Reservation",value:`${pe(r.count)}${b?` \xB7 ${b}`:""}`}]}let l=[{caption:"Status",value:o}],c=this.doc?.categories.find(g=>g.key===t.categoryKey);c&&l.push({caption:"Ticket type",value:`${c.label??c.key}${typeof c.price=="number"?` \xB7 ${we(c.price,this.currency)}`:""}`});let d=this.channels?.channelNameForLabel(t.label)??null;return d&&l.push({caption:"Channel",value:d}),l}hoverHeadFor(e){let t=this.seatOfId(e);if(!t)return null;let s=this.status.get(t.label)??"free",n=s==="blocked"?this.reservedBy.get(t.label):void 0,a=this.sectionLabelById.get(this.sectionByObject.get(t.rowId)??G.UNGROUPED_ID)??"Other seats",o=t.label.startsWith(`${a} `)?t.label.slice(a.length+1):t.label,r=o.lastIndexOf("-"),[l,c]=Je[n?"reserved":s]??Je.free,d=this.root?.dataset.theme==="dark"?"#e879f9":c;return{title:`${a} \xB7 ${o}`,...n?{sub:`Reserved for ${n.name}`,tone:d}:r>0?{sub:`Row ${o.slice(0,r)}, seat ${o.slice(r+1)}`}:{},plate:Z(l,n?d:c,26)}}sectionHeadFor(e,t){this.idToLabel.size!==this.labelToId.size&&(this.idToLabel=new Map([...this.labelToId].map(([n,a])=>[a,n])));let s=0;for(let n of t)(this.status.get(this.idToLabel.get(n)??"")??"free")==="free"&&(s+=1);return{title:this.sectionLabelById.get(e)??e,sub:`${s.toLocaleString()} of ${t.length.toLocaleString()} free`,plate:Z("layers","#0ea5a5",26)}}seatOfId(e){for(let t of this.labelToSeat.values())if(t.id===e)return t}reservationWhere(e){let t=this.reservationWheres.get(e);if(t==null){let s=[...this.reservedBy].filter(([,o])=>o.id===e).flatMap(([o])=>this.labelToSeat.get(o)??[]),n=this.rowLabels(),a=new Set(s.map(o=>n.get(o.rowId)??o.rowId)).size===2;t=this.selectionSummary(s).where.replace(/ · (rows? )([^\s–]+)(?:–([^\s–]+))?$/,(o,r,l,c)=>` ${r}${l}${c?`${a?" and ":"\u2013"}${c}`:""}`),this.reservationWheres.set(e,t)}return t}rowLabelSelectable(){return this.isBulkSelectMode()||this.mode==="select"}isBulkSelectMode(){return this.mode==="block"||this.mode==="reserve"||this.mode==="categories"||this.mode==="channels"&&this.channels?.usesMarqueeSelection()===!0}selectableStatuses(){return this.mode==="block"?["free","not_for_sale"]:this.mode==="reserve"?["free"]:this.mode==="select"||this.mode==="categories"||this.mode==="inspect"||this.mode==="view"||this.isBulkSelectMode()||this.mode==="channels"&&this.channels?.canSelect()===!0?["free","held","booked","not_for_sale"]:[]}updateRendererInteraction(){let e=this.isBulkSelectMode();this.renderer?.setManageInteraction({manageMode:!0,organizerStatus:this.channels?.view!=="preview"||this.mode!=="channels",marqueeSelect:e&&!this.movingMap,marqueeShape:this.marqueeShape,rowLabelSelect:this.rowLabelSelectable(),maxSelection:this.selectionCap(),selectableStatuses:this.selectableStatuses()}),this.navigation?.update(e),this.updateZoomHint()}handleSeatSelect(e){let t=this.press;t&&(t.answered=!0);let s=this.lastPick;if(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()},t?.shift&&s&&s.rowId===e.rowId&&s.label!==e.label&&this.isBulkSelectMode()&&this.renderer?.selectByLabels(xs(this.rowSeats(e.rowId),s.label,e.label)),this.mode==="select"&&!this.canSelectObject(e)){this.renderer?.deselect([e.id]),this.syncSelection();return}if(this.mode==="inspect"||this.mode==="view"){let n=this.getSelection().filter(a=>a.id!==e.id).map(a=>a.id);n.length&&this.renderer?.deselect(n)}this.syncSelection()}buildUnitUniverse(e){this.categoryTotalsCache=null;let t=new Map;for(let n of(0,G.allObjects)(e))n.type==="table"&&t.set(n.id,n.label);let s=new Map;for(let n of(0,G.expandChart)(e))if(this.labelToId.set(n.label,n.id),this.labelToSeat.set(n.label,n),this.allIds.push(n.id),t.has(n.rowId)){let a=s.get(n.rowId)??[];a.push(n.id),s.set(n.rowId,a)}for(let[n,a]of s){let o=t.get(n);this.labelToId.has(o)||this.tableChairIds.set(o,a)}for(let n of(0,G.gaAreasOf)(e)){let a=n.displayLabel||n.label;for(let o of(0,G.gaUnitLabels)(n))this.labelToId.has(o)||(this.gaUnitLabelSet.add(o),this.labelNames.set(o,a))}}unitTotal(){return this.allIds.length+this.gaUnitLabelSet.size}paintIds(e){let t=this.labelToId.get(e);return t?[t]:this.tableChairIds.get(e)??[]}knownLabels(){return[...this.labelToId.keys(),...this.gaUnitLabelSet]}repaintAll(){let e=this.renderer;if(!e)return;this.allIds.length&&e.setStatus(this.allIds,"free");let t={free:[],held:[],booked:[],not_for_sale:[]};for(let[s,n]of this.status.entries())t[this.renderStatusOf(s,n)].push(...this.paintIds(s));for(let s of this.unavailableLabels)this.status.has(s)||t.held.push(...this.paintIds(s));["held","booked","not_for_sale"].forEach(s=>{t[s].length&&e.setStatus(t[s],s)})}async connect(){if(this.closed||this.sessionEnded)return;let e;try{if(e=(await this.withAuthRetry(()=>this.api.subscribeTicket(this.key))).protocols,!e.length)throw new Error("manage_subscribe_ticket_missing")}catch(s){this.setLive(!1),this.opts.onError?.(s),this.scheduleReconnect();return}if(this.closed)return;let t;try{t=new WebSocket(this.api.socketUrl(this.key),e)}catch(s){this.opts.onError?.(s),this.scheduleReconnect();return}this.ws=t,this.socketSnapshotSeen=!1,t.onopen=()=>{this.attempt=0,this.setLive(!0),this.startKeepalive(t),this.resnapshot().then(()=>this.refreshControlRoom()).catch(s=>this.opts.onError?.(s)),this.refreshAvailability()},t.onmessage=s=>this.onMessage(s),t.onclose=()=>{this.ws===t&&(this.ws=null),this.stopKeepalive(),this.setLive(!1),this.scheduleReconnect()},t.onerror=()=>{try{t.close()}catch{}}}startKeepalive(e){this.stopKeepalive(),this.pingTimer=setInterval(()=>{if(this.ws===e){try{e.send(JSON.stringify({type:"ping"}))}catch{return}this.pongTimer||(this.pongTimer=setTimeout(()=>{if(this.pongTimer=null,this.ws===e){e.onclose=null,e.onmessage=null;try{e.close()}catch{}this.ws=null,this.stopKeepalive(),this.setLive(!1),this.paintLink("paused"),this.scheduleReconnect()}},5e3))}},1e4)}stopKeepalive(){this.pingTimer&&clearInterval(this.pingTimer),this.pongTimer&&clearTimeout(this.pongTimer),this.pingTimer=null,this.pongTimer=null}scheduleReconnect(){if(this.closed||this.sessionEnded||this.reconnectTimer)return;let e=Math.min(1e3*2**Math.min(this.attempt++,5),15e3);this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}onMessage(e){let t;try{t=JSON.parse(typeof e.data=="string"?e.data:"")}catch{return}if(!t||typeof t!="object"||(this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null),t.type==="pong"))return;this.lastMessageAt=Date.now();let s=t;if((Array.isArray(s.hidden)||Array.isArray(s.closed))&&this.updateEffectiveAvailability(s.hidden,s.closed),s.type==="presence"){typeof s.shoppingSessions=="number"&&typeof s.activeHolds=="number"&&(this.livePresence={at:Date.now(),value:{shoppingSessions:s.shoppingSessions,activeHolds:s.activeHolds}},this.controlRoomSnapshot&&(this.controlRoomSnapshot={...this.controlRoomSnapshot,presence:this.livePresence.value},this.opts.onControlRoom?.(this.controlRoomSnapshot)),this.lastSyncedAt=Date.now(),this.recomputeTallies(),this.paintMonitorInsights());return}if(s.type!=="hidden"){if(s.seats&&typeof s.seats=="object")this.applySocketSnapshot(s.seats,typeof s.default=="string"?s.default:void 0);else if(Array.isArray(s.changes)){let n=[],a=new Map;for(let r of s.changes){let l=dn(r.status),c=this.status.get(r.label)??"free";if(c===l)continue;(c==="blocked"||l==="blocked")&&this.scheduleReservations(),this.setStatusLabel(r.label,l,c);let d=this.paintIds(r.label);d.length&&(this.renderer?.setStatus(d,this.renderStatusOf(r.label,l)),n.push(...d));let g=this.verbFor(c,l,r.label),b=`${g}:${l}`,m=a.get(b)??{labels:[],verb:g,status:l};m.labels.push(r.label),a.set(b,m)}for(let r of a.values()){let l=this.pushActivity(r.labels,r.verb,r.status);l&&this.paintSpatialActivity(l)}a.size&&this.scheduleMonitorRefresh(),n.length&&(this.lastSyncedAt=Date.now(),this.afterPaint()),this.reconcileSelectionWithStatus([...a.values()].flatMap(r=>r.labels));let o=typeof s.bookedValue?.gross=="number"?s.bookedValue.gross:s.revenue?.gross;typeof o=="number"&&Number.isFinite(o)&&this.applyLiveGross(o),this.recomputeTallies()}}}applyLiveGross(e){if(this.liveGross={at:Date.now(),value:e},this.authoritativeGrossRevenue=e,this.revenueStatus="current",this.controlRoomSnapshot){let s={...this.controlRoomSnapshot.bookedValue??this.controlRoomSnapshot.revenue,gross:e};this.controlRoomSnapshot={...this.controlRoomSnapshot,bookedValue:s,revenue:s},this.opts.onControlRoom?.(this.controlRoomSnapshot)}}setStatusLabel(e,t,s=this.status.get(e)??"free"){if(this.status.set(e,t),s===t)return;let n=this.seatWeight(e);if(s!=="free"&&(this.counts[s]-=n),t!=="free"&&(this.counts[t]+=n),this.alerts){let a=this.labelToSeat.get(e);this.alerts.seatChanged(a?this.sectionByObject.get(a.rowId)??null:null,s,t)}}applySocketSnapshot(e,t){let s=this.socketSnapshotSeen?this.status:null;if(this.applySnapshot(e,t),this.socketSnapshotSeen=!0,!s)return;let n=new Map;for(let a of new Set([...s.keys(),...this.status.keys()])){let o=s.get(a)??"free",r=this.status.get(a)??"free";if(o===r)continue;let l=this.verbFor(o,r,a),c=`${l}:${r}`,d=n.get(c)??{labels:[],verb:l,status:r};d.labels.push(a),n.set(c,d)}for(let a of n.values()){let o=this.pushActivity(a.labels,a.verb,a.status);o&&this.paintSpatialActivity(o)}n.size&&this.scheduleMonitorRefresh()}scheduleMonitorRefresh(){this.monitorRefreshTimer||(this.monitorRefreshTimer=setTimeout(()=>{this.monitorRefreshTimer=null,!this.closed&&(this.refreshControlRoom().catch(e=>this.opts.onError?.(e)),this.paintFullscreenLine(),this.tablesPanel?.update(),this.sectionsPanel?.update())},150))}async resnapshot(){try{let e=await this.api.objects(this.key);this.applySnapshot(e.seats),this.updateEffectiveAvailability(e.hidden,e.closed),this.lastMessageAt=Date.now()}catch{}}applySnapshot(e,t){let s=new Map;if(t!==void 0){let n=dn(t);for(let a of this.knownLabels())s.set(a,n)}for(let[n,a]of Object.entries(e))s.set(n,dn(a));this.status=s,this.recountAll(),this.serverBaseline&&!this.serverBaseline.client&&(this.serverBaseline.client=this.pairedClient()),this.modelSynced=!0,this.scheduleReservations(),this.lastSyncedAt=Date.now(),this.repaintAll(),this.afterPaint(),this.recomputeTallies(),this.reconcileSelectionWithStatus(null)}reconcileSelectionWithStatus(e){if(!this.renderer)return;let t=this.getSelection();if(!t.length)return;if(e){let a=new Set(e);if(!t.some(o=>a.has(o.label)))return}if(this.mode==="select"){this.reconcileSelectPolicy();return}if(e)for(let a of t)this.status.get(a.label)==="booked"&&e.includes(a.label)&&this.selJustSold.add(a.label);let s=new Set(this.selectableStatuses()),n=t.filter(a=>!s.has(this.renderStatusOf(a.label,this.status.get(a.label)??"free")));this.reconcilingSel=!0;try{n.length&&this.renderer.deselect(n.map(a=>a.id)),this.syncSelection()}finally{this.reconcilingSel=!1}}recountAll(){let e={held:0,booked:0,blocked:0};for(let[t,s]of this.status)s!=="free"&&(e[s]+=this.seatWeight(t));this.counts=e}seatWeight(e){return this.tableChairIds.get(e)?.length??1}setSeatsLocal(e,t){let s=[],n=[];for(let a of e)this.setStatusLabel(a,t),(this.renderStatusOf(a,t)===je(t)?s:n).push(...this.paintIds(a));s.length&&this.renderer?.setStatus(s,je(t)),n.length&&this.renderer?.setStatus(n,"held"),this.afterPaint(),this.recomputeTallies()}afterPaint(){this.keepLive&&typeof document<"u"&&document.hidden&&this.renderer?.forceDraw()}activityColor(e){return e==="held"?Re.held:e==="booked"?Re.booked:e==="blocked"?Re.blocked:Re.free}sectionsForLabels(e){let t=new Set;for(let n of e){let a=this.labelToSeat.get(n);if(!a)continue;let o=this.sectionByObject.get(a.rowId);o&&o!==G.UNGROUPED_ID&&t.add(o)}let s=[...t];return{ids:s,labels:s.map(n=>this.sectionLabelById.get(n)??n)}}pulseSeatLabels(e,t){let s=this.activityColor(t);for(let n of e.slice(0,Mo)){let a=this.labelToId.get(n);a&&this.renderer?.flashSeat(a,s)}}paintSpatialActivity(e){let t=e.sectionIds??this.sectionsForLabels(e.labels).ids,s=this.renderer?.getFocusedSection()??null;if(this.followLive&&t.length===1&&(e.status==="held"||e.status==="booked")){let a=this.root?.querySelector('[data-ref="followstatus"]');a&&(a.textContent=`Following ${e.labels.length===1?this.labelNames.get(e.labels[0])??e.labels[0]:`${e.labels.length} seats`} \xB7 ${e.status}`),this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.followLiveTimer=setTimeout(()=>{this.followLiveTimer=null,this.focusActivitySeats(e.labels,t[0]),this.followSeatTimer=setTimeout(()=>{this.followSeatTimer=null,this.pulseSeatLabels(e.labels,e.status)},520)},220);return}if(!s&&t.length){let a=this.activityColor(e.status);for(let o of t.slice(0,Eo))this.renderer?.flashSection(o,a);return}(!t.length||s&&t.includes(s))&&this.pulseSeatLabels(e.labels,e.status)}locateSection(e){this.renderer?.focusSection(e)}focusActivitySeats(e,t){this.renderer?.focusSection(t);let s=e.slice(0,Mo).map(l=>this.labelToSeat.get(l)).filter(l=>!!l);if(!s.length)return;let n=s.map(l=>l.x),a=s.map(l=>l.y),o=Math.min(...n),r=Math.min(...a);this.renderer?.focusRegion({x:o-150,y:r-100,width:Math.max(...n)-o+300,height:Math.max(...a)-r+200})}locateActivity(e){let t=this.feed.find(n=>n.id===e);if(!t)return;let s=t.sectionIds??this.sectionsForLabels(t.labels).ids;if(this.followSeatTimer&&clearTimeout(this.followSeatTimer),s.length===1){this.focusActivitySeats(t.labels,s[0]),this.followSeatTimer=setTimeout(()=>{this.followSeatTimer=null,this.pulseSeatLabels(t.labels,t.status)},520);return}this.zoomToFit(),this.followSeatTimer=setTimeout(()=>{if(this.followSeatTimer=null,s.length){let n=this.activityColor(t.status);for(let a of s.slice(0,Eo))this.renderer?.flashSection(a,n)}else this.pulseSeatLabels(t.labels,t.status)},280)}showLiveEvent(e){let t=this.els.liveevent;if(!t)return;let s=e.sectionLabels??[],n=s.length===1?s[0]:s.length>1?`${s.length} sections`:this.labelNames.get(e.label)??e.label,a=e.count===1?"seat":"seats";t.innerHTML=`<span class="slm-liveeventdot" style="background:${this.activityColor(e.status)}"></span>
1781
+ <span class="slm-liveeventcopy">${S(n)} \xB7 ${e.count.toLocaleString()} ${a} ${S(Mn(e.verb))}</span>
1782
+ <span class="slm-liveeventhint">Live</span>`,t.classList.add("on"),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.liveEventTimer=setTimeout(()=>{this.liveEventTimer=null,t.classList.remove("on"),t.innerHTML=""},2800)}applyReportRevenue(e){this.authoritativeGrossRevenue=e.report.byCategory.reduce((t,s)=>{let n=Number.isFinite(s.bookedValue)?s.bookedValue:s.bookedRevenue;return t+(Number.isFinite(n)?n:0)},0),this.revenueStatus="current",this.recomputeTallies()}async refreshControlRoom(){let e=++this.revenueRequest,t=Date.now();try{let s=await this.api.controlRoom(this.key,this.trendWindowMinutes),n=s.bookedValue??s.revenue??{gross:0,bySection:[]},a=(n.bySection??[]).map(l=>{let c=Number.isFinite(l.bookedValue)?l.bookedValue:l.bookedRevenue;return{...l,bookedValue:c??0,bookedRevenue:c??0}}),o={...n,bySection:a},r={...s,bookedValue:o,revenue:o};if(e===this.revenueRequest){if(this.livePresence&&this.livePresence.at>=t?r={...r,presence:this.livePresence.value}:this.livePresence=null,this.liveGross&&this.liveGross.at>=t){let d={...r.bookedValue,gross:this.liveGross.value};r={...r,bookedValue:d,revenue:d}}else this.liveGross=null;this.controlRoomSnapshot=r,this.adoptLabelNames(r.displayLabels),r.activity&&this.seedFeed(r.activity),this.rebaseServerTotals(r),this.controlRoomSettled=!0,this.lastSyncedAt=Date.now(),this.authoritativeGrossRevenue=r.bookedValue.gross,this.authoritativeCurrency=r.currency,this.currency=r.currency,this.revenueStatus="current",this.recomputeTallies(),this.applyHeatOverlay(),this.paintMonitorInsights(),this.seatHistoryPanel?.refresh();let l=this.getSelection().slice(-1)[0],c=this.els.rail?.querySelector("[data-seat-status]");l&&c&&(c.textContent=this.status.get(l.label)??"free"),this.opts.onControlRoom?.(r)}return r}catch(s){throw e===this.revenueRequest&&(this.revenueStatus="stale",this.controlRoomSettled=!0,this.recomputeTallies()),s}}rebaseServerTotals(e){let t=o=>!!o&&["free","held","booked","blocked"].every(r=>Number.isFinite(o[r])),s=t(e.seatTotals)?e.seatTotals:null,n=s??e.totals;if(!t(n)){this.serverBaseline=null;return}let a=s?.reserved;this.serverBaseline={server:{free:n.free,held:n.held,booked:n.booked,blocked:n.blocked,...Number.isFinite(a)?{reserved:a}:{}},client:this.modelSynced?this.pairedClient():null}}pairedClient(){return{...this.clientTallies(),reserved:this.reservationsLoaded?this.reservedBlockedCount():null}}clientTallies(){let{held:e,booked:t,blocked:s}=this.counts;return{held:e,booked:t,blocked:s,free:Math.max(0,this.unitTotal()-e-t-s)}}buildTallies(){let e=this.clientTallies(),t=this.serverBaseline,s=r=>t?Math.max(0,t.server[r]+(t.client?e[r]-t.client[r]:0)):e[r],n=this.controlRoomSnapshot?.event?.seatTotal,a={free:s("free"),held:s("held"),booked:s("booked"),blocked:s("blocked"),total:Number.isFinite(n)?n:this.unitTotal(),capacityPct:0,sellThroughPct:0,bookedValue:this.authoritativeGrossRevenue,grossRevenue:this.authoritativeGrossRevenue,bookedValueStatus:this.revenueStatus,revenueStatus:this.revenueStatus,currency:this.currency};a.capacityPct=a.total?Math.round(a.booked/a.total*100):0;let o=a.total-a.blocked;return a.sellThroughPct=o>0?Math.round(a.booked/o*100):0,a}recomputeTallies(){if(!this.closed){if(typeof requestAnimationFrame!="function"){this.flushTallies();return}this.paintHandle===null&&(this.paintHandle=requestAnimationFrame(()=>{this.paintHandle=null,this.flushTallies()}))}}talliesReady(){return this.serverBaseline!==null||this.controlRoomSettled&&this.modelSynced}flushTallies(){if(this.closed)return;let e=this.buildTallies(),t=this.talliesReady();this.paintKpis(e,t),this.paintColourLegend(),this.minimap?.refreshMinimap(),this.paintMapChrome(),this.mode==="view"?(this.paintMonitorInsights(),this.paintWatchSeat(this.getSelection())):this.mode==="block"?this.paintSelBar(this.getSelection()):this.mode==="reserve"?this.paintReserveSelection(this.getSelection()):this.mode==="channels"&&this.channels?.handleSelectionChange(),t&&this.opts.onTallies?.(e)}verbFor(e,t,s){return t==="held"?"held":t==="booked"?"booked":t==="blocked"?s&&(this.reserving.has(s)||this.reservedBy.has(s))?"reserved":"blocked":t==="free"?e==="blocked"?s&&this.reservedBy.has(s)?"unreserved":"unblocked":e==="booked"?"cancelled":"available":t}pushActivity(e,t,s,n=Date.now()){let a=e[0];if(!a)return null;let o=this.sectionsForLabels(e),r={id:`${a}:${n}:${Math.random().toString(36).slice(2,6)}`,at:n,label:a,labels:[...e],count:e.length,verb:t,status:s,sectionIds:o.ids,sectionLabels:o.labels};return this.controlRoomSnapshot?.activity||this.feed.unshift(r),this.feed.length>ds&&(this.feed.length=ds),this.mode==="view"&&this.paintFeed(),this.showLiveEvent(r),this.opts.onActivity?.(r),r}adoptLabelNames(e){for(let[t,s]of Object.entries(e??{}))typeof s=="string"&&s&&this.labelNames.set(t,s)}seedFeed(e){this.controlRoomSnapshot?.activity&&(this.feed=this.feed.filter(n=>n.id.startsWith("log:")));let t={hold:"held",book:"booked",release:"released",expire:"expired",block:"blocked",unblock:"unblocked",unbook:"cancelled",reserve:"reserved",unreserve:"unreserved","reservation.end":"unreserved"},s={hold:"held",book:"booked",release:"free",expire:"free",block:"blocked",unblock:"free",unbook:"free",reserve:"blocked",unreserve:"free","reservation.end":"free"};for(let n of e){if(this.feed.some(l=>l.id===`log:${n.id}`))continue;let a=n.labels[0];if(!a)continue;let o=this.sectionsForLabels(n.labels),r={id:`log:${n.id}`,at:n.at,label:a,labels:[...n.labels],count:n.labels.length,verb:t[n.action]??n.action,status:s[n.action]??"free",sectionIds:o.ids,sectionLabels:o.labels};this.feed.push(r),this.opts.onActivity?.(r)}this.feed.sort((n,a)=>a.at-n.at),this.feed.length>ds&&(this.feed.length=ds),this.mode==="view"&&this.paintFeed()}startFeedClock(){this.feedTimer=setInterval(()=>{this.mode==="view"&&(this.paintFeed(),this.paintMonitorInsights())},1e4)}selectionCap(){return this.mode!=="select"?1e6:this.opts.numberOfPlacesToSelect??this.opts.maxSelectedObjects??1e6}isHostUnavailable(e){return this.unavailableLabels.has(e)}renderStatusOf(e,t){return t==="free"&&this.unavailableLabels.has(e)?"held":je(t)}canSelectObject(e){if(this.isHostUnavailable(e.label))return!1;let t=this.status.get(e.label)??"free",s=this.opts.unavailableObjectsSelectable??!0,n=t==="free"||s||this.selectableObjectLabels.has(e.label);if(!this.opts.isObjectSelectable)return n;try{return this.opts.isObjectSelectable(e,n)===!0}catch(a){return this.opts.onError?.(a),!1}}applyInitialSelection(){this.initialSelectionApplied||this.mode!=="select"||!this.renderer||(this.initialSelectionApplied=!0,this.selectByLabels(this.opts.selectedObjects??[]))}trimSelectionToCap(){if(this.mode!=="select")return;let e=this.getSelection(),t=this.selectionCap();e.length<=t||this.renderer?.deselect(e.slice(t).map(s=>s.id))}reconcileSelectPolicy(){if(this.mode!=="select")return;let e=this.getSelection().filter(t=>!this.canSelectObject(t));e.length&&this.renderer?.deselect(e.map(t=>t.id)),this.trimSelectionToCap(),this.syncSelection()}selectionLabels(){return this.getSelection().map(e=>e.label)}paintTaskPicker(){let e=this.els.taskpick;if(!e)return;let t=this.taskGroups.flatMap(s=>s.tools).find(s=>s.mode===this.mode)??{mode:this.mode,label:this.mode==="view"?"Watch":this.mode};e.innerHTML=qn(t,this.taskGroups,this.taskMenuOpen),this.taskMenuOpen&&e.querySelector('[aria-checked="true"]')?.focus()}isSheet(){return!!this.root?.classList.contains("compact")&&this.mode!=="channels"}sheetDetent(){return this.detents.get(this.mode)??"half"}setDetent(e){this.detents.set(this.mode,e),this.applyDetent()}applyDetent(){let e=this.root;e&&(this.isSheet()?e.dataset.detent=this.sheetDetent():delete e.dataset.detent,this.paintPeek())}paintPeek(){let e=this.els.peek;if(!e)return;let t=this.taskGroups.flatMap(n=>n.tools).find(n=>n.mode===this.mode)?.label??"",s=this.renderer?this.getSelection().length:0;e.textContent=s?`${pe(s)} selected \xB7 ${t}`:t}wireSheet(){let e=this.els.grab;if(!e)return;let t=["peek","half","full"],s=null,n=!1;e.addEventListener("pointerdown",o=>{s=o.clientY,n=!1}),e.addEventListener("pointerup",o=>{if(s==null)return;let r=o.clientY-s;if(s=null,Math.abs(r)<40)return;n=!0;let l=t.indexOf(this.sheetDetent());this.setDetent(t[Math.max(0,Math.min(2,l+(r>0?-1:1)))])}),e.addEventListener("click",()=>{if(n){n=!1;return}let o=this.sheetDetent();this.setDetent(o==="peek"?"half":o==="half"?"full":"half")});let a=this.els.taskpick;a?.addEventListener("click",o=>{let r=o.target,l=r.closest("[data-taskpick-mode]")?.dataset.taskpickMode;if(l){this.taskMenuOpen=!1,this.setMode(l);return}r.closest("[data-taskpick]")&&(this.taskMenuOpen=!this.taskMenuOpen,this.paintTaskPicker())}),this.root?.addEventListener("click",o=>{this.taskMenuOpen&&a&&!o.composedPath().includes(a)&&(this.taskMenuOpen=!1,this.paintTaskPicker())})}syncSelection(){let e=this.getSelection(),t=this.lastSelectionLabels,s=e.length!==t.size||e.some(a=>!t.has(a.label));s&&!this.reconcilingSel&&(this.selWhole=!1,this.selJustSold.clear(),this.selLeft=null,this.blockDone?.partial&&(this.blockDone=null),this.categoryFailed=!1,this.categoryBusy||(this.categoryDone=null)),!this.selRestoring&&s&&(this.selBack.push([...t]),this.selBack.length>50&&this.selBack.shift(),this.selAhead=[]),this.savedApplied&&(e.length!==this.savedApplied.labels.size||e.some(a=>!this.savedApplied.labels.has(a.label)))&&(this.savedApplied=null,this.root?.querySelector(".slm-savedpill")?.remove()),s&&!this.reconcilingSel&&e.length&&!this.categoryBusy&&!this.blockBusy&&(this.panelAlert=this.mode==="categories"&&!this.categoryCanManage?this.lockedTypes:null),this.mode==="block"?this.paintSelBar(e):this.mode==="reserve"?this.paintReserveSelection(e):this.mode==="view"?this.paintWatchSeat(e):this.mode==="select"?this.paintSelectSelection(e):this.mode==="categories"?this.paintCategorySelection(e):this.mode==="channels"&&this.channels?.handleSelectionChange(),this.paintPeek();let n=new Map(e.map(a=>[a.label,a]));if(this.mode==="select"){for(let[o,r]of n)this.lastSelectionLabels.has(o)||this.opts.onObjectSelected?.(r);for(let o of this.lastSelectionLabels)if(!n.has(o)){let r=this.labelToSeat.get(o);r&&this.opts.onObjectDeselected?.(r)}let a=this.getSelectionValidity();a&&(this.opts.onSelectionValidityChange?.(a),this.selectionWasValid!==a.isValid&&(a.isValid?this.opts.onSelectionValid?.(a):this.opts.onSelectionInvalid?.(a)),this.selectionWasValid=a.isValid)}this.lastSelectionLabels=new Set(n.keys()),this.navigation?.historyChanged(this.selBack.length>0,this.selAhead.length>0),this.opts.onSelectionChange?.(e)}buildChrome(){let e=document.createElement("div"),t=this.opts.chrome==="minimal";e.className=`${t?"slm slm-minimal":"slm"}${this.opts.kpis===!1?" no-kpis":""}`,e.tabIndex=0,e.setAttribute("role","region"),e.setAttribute("aria-label",t?"Seat map":"SeatLayer live control room"),e.innerHTML=`
1749
1783
  <div class="slm-fsline" data-ref="fsline"></div>
1750
1784
  <div class="slm-bar">
1751
1785
  <div class="slm-modes" data-ref="modes" role="tablist" aria-label="Control room tools">
1752
- ${no.map(o=>`<div class="slm-modegroup" data-group="${o.key}" role="presentation" hidden>
1753
- <span class="slm-modegroup-label" aria-hidden="true">${w(o.label)}</span>
1786
+ ${Ho.map(o=>`<div class="slm-modegroup" data-group="${o.key}" role="presentation" hidden>
1787
+ <span class="slm-modegroup-label" aria-hidden="true">${S(o.label)}</span>
1754
1788
  ${o.tools.map(r=>`<button class="slm-mode" role="tab" data-mode="${r.mode}"
1755
- title="${w(r.title)} (${r.shortcut})" aria-keyshortcuts="${r.shortcut}" hidden>${J(ct[r.mode].glyph,ct[r.mode].hue,22)}<span>${w(r.label)}</span></button>`).join("")}
1789
+ title="${S(r.title)} (${r.shortcut})" aria-keyshortcuts="${r.shortcut}" hidden>${Z(mt[r.mode].glyph,mt[r.mode].hue,22)}<span>${S(r.label)}</span></button>`).join("")}
1756
1790
  </div>`).join("")}
1757
1791
  </div>
1758
1792
  <div class="slm-taskpick" data-ref="taskpick"></div>
@@ -1765,9 +1799,9 @@ Click to light them up \xB7 \u21E7 click to select them.`}),r.dataset.legend=o.k
1765
1799
  title="Stay on the current map view unless enabled"><span>Follow live</span></button>
1766
1800
  <span data-ref="bell"></span>
1767
1801
  <button type="button" class="slm-barbtn slm-helpbtn" data-how="current" aria-label="How this task works" title="How it works">?</button>
1768
- ${hi()}
1802
+ ${Ti()}
1769
1803
  <button type="button" class="slm-barbtn slm-fullscreen" data-ref="fullscreen" title="Full screen (F)" aria-label="Full screen"
1770
- aria-keyshortcuts="F"><span class="slm-fullscreen-icon" aria-hidden="true">${Ys.enter}</span></button>
1804
+ aria-keyshortcuts="F"><span class="slm-fullscreen-icon" aria-hidden="true">${hn.enter}</span></button>
1771
1805
  </div>
1772
1806
  <div class="slm-kpis" data-ref="kpis"></div>
1773
1807
  </div>
@@ -1776,33 +1810,33 @@ Click to light them up \xB7 \u21E7 click to select them.`}),r.dataset.legend=o.k
1776
1810
  <div class="slm-body">
1777
1811
  <div class="slm-map">
1778
1812
  <div class="slm-map-host" data-ref="maphost"></div>
1779
- ${bs()}
1813
+ ${Ss()}
1780
1814
  <div class="slm-lane" data-ref="lane">
1781
- <div class="slm-zoomhint" data-ref="zoomhint">${Ge()?"Tap a section to take it \xB7 press and hold, then drag, to draw a box":"Click a section to take it \xB7 drag anywhere to add seats \xB7 Alt removes"}</div>
1815
+ <div class="slm-zoomhint" data-ref="zoomhint" hidden>${be("box","#d99a0b",15)}${Oe()?"Press and hold, then drag, to draw a box":"Drag anywhere to add seats \xB7 hold Alt to remove"}</div>
1782
1816
  <div class="slm-liveevent" data-ref="liveevent" role="status" aria-live="polite"></div>
1783
1817
  <div class="slm-crumb" data-ref="crumb" role="status" hidden></div>
1784
1818
  </div>
1785
1819
  <div class="slm-heat-status" data-ref="heatstatus" role="status" hidden></div>
1786
1820
  <div class="slm-follow-status" data-ref="followstatus" role="status" hidden></div>
1787
- ${jn()}
1788
- ${Gn()}
1821
+ ${ii()}
1822
+ ${hi()}
1789
1823
  </div>
1790
- <aside class="slm-rail"><button type="button" class="slm-grab" data-ref="grab" aria-label="Panel height"><span class="slm-grab-bar" aria-hidden="true"></span><span data-ref="peek"></span></button><div class="slm-railscroll" data-ref="rail">${gs()}</div></aside>
1824
+ <aside class="slm-rail"><button type="button" class="slm-grab" data-ref="grab" aria-label="Panel height"><span class="slm-grab-bar" aria-hidden="true"></span><span data-ref="peek"></span></button><div class="slm-railscroll" data-ref="rail">${Ls()}</div></aside>
1791
1825
  </div>
1792
1826
  <div class="slm-toast" data-ref="toast"></div>
1793
- `,this.host.appendChild(e),this.root=e,this.selectObserver=new MutationObserver(()=>{let o=e.querySelector(".slm-rail");o&&(Ke(o),Zs(o))});let s=e.querySelector(".slm-rail");if(s&&this.selectObserver.observe(s,{childList:!0,subtree:!0}),this.applyThemeVars(),this.watchThemeMode(),this.updateContainerLayout(),typeof ResizeObserver<"u"){this.layoutObserver=new ResizeObserver(()=>this.updateContainerLayout()),this.layoutObserver.observe(e);let o=e.querySelector(".slm-bar-actions");o&&this.layoutObserver.observe(o)}let n=o=>e.querySelector(`[data-ref="${o}"]`);this.mapHost=n("maphost"),this.els={modes:n("modes"),tools:n("tools"),livetext:n("livetext"),kpis:n("kpis"),follow:n("follow"),view:n("view"),findbar:n("findbar"),fullscreen:n("fullscreen"),lane:n("lane"),zoomhint:n("zoomhint"),liveevent:n("liveevent"),rail:n("rail"),toast:n("toast"),mapchrome:n("mapchrome"),crumb:n("crumb"),zin:n("zin"),zout:n("zout"),zfit:n("zfit"),minimapMount:n("minimap"),blocklegend:n("blocklegend"),connbanner:n("connbanner"),fsline:n("fsline"),viewonly:n("viewonly"),taskpick:n("taskpick"),grab:n("grab"),peek:n("peek"),bell:n("bell"),awaybanner:n("awaybanner")},this.wireSheet(),this.els.modes.querySelectorAll("[data-mode]").forEach(o=>o.addEventListener("click",()=>this.setMode(o.dataset.mode))),this.els.tools.addEventListener("change",()=>this.setMode(this.els.tools.value)),this.els.zfit.addEventListener("click",()=>{this.setFollowLive(!1),this.zoomToFit()}),this.els.zin.addEventListener("click",()=>{this.setFollowLive(!1),this.renderer?.zoomIn()}),this.els.zout.addEventListener("click",()=>{this.setFollowLive(!1),this.zoomOutStep()}),this.els.mapchrome&&this.layoutObserver?.observe(this.els.mapchrome),this.applyLaneRoom(),this.els.follow.addEventListener("click",()=>this.setFollowLive(!this.followLive)),this.wireColourMenu(e),this.els.view.addEventListener("click",o=>{let r=o.target?.closest("[data-view], [data-panel-toggle]");if(r?.dataset.view)this.toggleMapView(r.dataset.view);else if(r){let l=!e.classList.toggle("details-hidden");r.setAttribute("aria-checked",String(l)),r.classList.toggle("on",l)}}),e.addEventListener("pointerdown",o=>{let r=this.els.view;r.open&&!r.contains(o.target)&&(r.open=!1)}),this.mapView=li(),this.colourChoices=ai();let a=this.colourChoices[this.mode]??this.startingColourBy(this.mode);this.mapView={...this.mapView,categoryColours:a==="type",channelColours:a==="channel"},this.heatEnabled=this.mapView.momentum,this.applyMapView(),this.wireBarFind(),this.els.fullscreen.addEventListener("click",()=>this.toggleFullscreen()),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("keydown",this.onSelectAllKey,!0),this.els.rail.addEventListener("click",this.onRailClick),this.root.addEventListener("click",this.onHowClick),document.addEventListener("fullscreenchange",this.onFullscreenChange),this.paintModeTabs(),this.paintFollowLiveButton(),this.paintHeatButton(),this.paintMapViewMenu(),this.paintFullscreenButton(),this.navigation=new Mt({root:e,map:this.mapHost,setMoving:o=>{this.movingMap=o,this.updateRendererInteraction()},setShape:o=>{this.marqueeShape=o,this.updateRendererInteraction()},pauseFollow:()=>{this.followLive&&this.setFollowLive(!1)},stepSelection:o=>{this.stepSelection(o)}}),this.navigation.update(this.isBulkSelectMode()),this.wireGestures(this.mapHost),this.els.blocklegend&&e.querySelector(".slm-navigation")?.prepend(this.els.blocklegend)}wireColourMenu(e){let t=this.els.blocklegend,s=t?.querySelector('[data-ref="colourby"]'),n=t?.querySelector('[role="listbox"]');if(!t||!s||!n)return;this.paintColourLegend();let a=o=>{n.hidden=!o,s.setAttribute("aria-expanded",String(o))};t.querySelector('[data-ref="legenditems"]')?.addEventListener("click",o=>{let r=o.target.closest("[data-legend]");r?.dataset.legend&&this.onLegendChip(r.dataset.legend,o.shiftKey)}),s.addEventListener("click",()=>{n.hidden&&this.paintColourLegend(),a(n.hidden),n.hidden||n.querySelector('[aria-selected="true"]')?.focus()}),n.addEventListener("click",o=>{let r=o.target?.closest("[data-colour-by]");!r||r.disabled||(this.setColourBy(r.dataset.colourBy),a(!1),s.focus())}),n.addEventListener("keydown",o=>{o.key==="Escape"&&(a(!1),s.focus(),o.stopPropagation())}),e.addEventListener("pointerdown",o=>{!n.hidden&&!t.contains(o.target)&&a(!1)})}showLabels(e){this.setFollowLive(!1);let t=e.length===1?this.labelToSeat.get(e[0]):null;if(!t){this.frameLabels(e);return}let s=this.sectionByObject.get(t.rowId);s&&this.renderer?.focusSection(s),this.renderer?.focusRegion({x:t.x-180,y:t.y-120,width:360,height:240},{animate:!1,minScale:1.5}),this.renderer?.flashSeat(t.id,this.activityColor(this.status.get(t.label)??"free"))}applyChromeClearance(){if(this.opts.chrome!=="minimal"||!this.renderer)return;let e=this.els.mapchrome,t=e?.parentElement;if(!e||!t)return;let s=e.getBoundingClientRect(),n=t.getBoundingClientRect(),a=e.offsetHeight>0&&n.bottom>s.top,o=a?Math.ceil(n.bottom-s.top)+8:0,r=a?Math.ceil(n.right-s.left)+8:0;o===this.chromeClearance&&r===this.chromeClearanceWidth||(this.chromeClearance=o,this.chromeClearanceWidth=r,this.renderer.setFitClearance(o,r))}applyLaneRoom(){let e=this.els.mapchrome,t=e?.parentElement;if(!e||!t)return;let s=e.offsetWidth;t.style.setProperty("--slm-chrome-w",`${s}px`),t.style.setProperty("--slm-chrome-h",`${e.offsetHeight}px`),t.classList.toggle("slm-lane-above",t.clientWidth-s-42<240)}applyLegendInset(){let e=this.opts.mapInsets;if(this.opts.chrome==="minimal"&&!e||!this.renderer?.setViewportInsets)return;let t=this.opts.chrome==="minimal"?null:this.els.blocklegend,s=t&&t.offsetHeight?Math.max(0,Math.ceil(t.getBoundingClientRect().bottom-this.mapHost.getBoundingClientRect().top)+8):0,n=l=>Number.isFinite(l)&&l>0?Math.ceil(l):0,a={top:Math.max(s,n(e?.top)),right:n(e?.right),bottom:n(e?.bottom),left:n(e?.left)},o=`${a.top},${a.right},${a.bottom},${a.left}`;if(o===this.legendInset)return;this.legendInset=o;let r=Object.fromEntries(Object.entries(a).filter(([,l])=>l>0));this.renderer.setViewportInsets(Object.keys(r).length?r:null)}setMapInsets(e){this.opts.mapInsets=e??void 0,this.applyLegendInset()}fitBar(e,t){let s=this.root;if(!s)return;let n=["tightbar","tighterbar"];if(t){s.classList.remove(...n);return}let a=n.filter(l=>s.classList.contains(l)).length;for(;a>0&&e>=this.barNeed[a];)s.classList.remove(n[--a]);let o=()=>{let l=s.querySelector(".slm-bar")?.getBoundingClientRect(),c=s.querySelector(".slm-bar-actions > :last-child")?.getBoundingClientRect(),d=parseFloat(getComputedStyle(s.querySelector(".slm-bar")).paddingRight)||0;return l&&c&&l.width?Math.ceil(c.right-(l.right-d)):0},r=o();for(;r>0&&a<n.length;)this.barNeed[a+1]=e+r+12,s.classList.add(n[a++]),r=o()}updateContainerLayout(){let e=this.root?.getBoundingClientRect().width||this.host.clientWidth,t=e>0&&e<1e3;t!==this.root?.classList.contains("compact")&&(this.root?.classList.toggle("compact",t),this.applyDetent()),this.fitBar(e,t),this.applyChromeClearance(),this.applyLaneRoom(),this.applyLegendInset(),this.channels?.handleLayoutChange(),this.syncMinimap()}filterableSections(){return this.sectionsBase?[...this.sectionsBase.sections,...this.sectionsBase.ungrouped?[this.sectionsBase.ungrouped]:[]]:[]}applyFilteredSectionCanvas(e=this.filterableSections().filter(t=>t.label===this.filteredSectionLabel)){if(!this.renderer||this.mode!=="filterSections"||!e.length)return;let t=new Set(e.map(n=>n.id)),s=this.filterableSections().filter(n=>!t.has(n.id)).map(n=>n.id);this.renderer.clearSectionFocus(),this.renderer.setClosedSections(null),this.renderer.setDimmedSections(s),this.frameSections(e)}frameSections(e){if(!this.renderer||!e.length)return;let t=e.flatMap(l=>l.seatLabels).map(l=>this.labelToSeat.get(l)).filter(l=>!!l&&Number.isFinite(l.x)&&Number.isFinite(l.y));if(!t.length){this.renderer.focusRegion(e[0].id);return}let s=Math.min(...t.map(l=>l.x)),n=Math.min(...t.map(l=>l.y)),a=Math.max(...t.map(l=>l.x)),o=Math.max(...t.map(l=>l.y)),r=Math.max(40,Math.max(a-s,o-n)*.08);this.renderer.focusRegion({x:s-r,y:n-r,width:Math.max(1,a-s)+r*2,height:Math.max(1,o-n)+r*2})}buildSectionOptions(){if(this.doc)try{let e=(0,U.computeSections)(this.doc);this.sectionsBase=e,this.sectionOptions=[],this.sectionByObject=new Map(e.objectToSection),this.sectionLabelById.clear();for(let t of e.sections)this.sectionOptions.push({id:t.id,label:t.label}),this.sectionLabelById.set(t.id,t.label);e.ungrouped&&(this.sectionOptions.push({id:U.UNGROUPED_ID,label:e.ungrouped.label}),this.sectionLabelById.set(U.UNGROUPED_ID,e.ungrouped.label))}catch{}}toolAvailable(e){return e==="view"?!0:e==="channels"&&!this.channelCaps.view||e==="categories"&&!this.categoryCanManage||(e==="block"||e==="reserve"||e==="sections")&&!this.canBlock()||e==="tables"&&(!this.tableCanManage||!this.tables().length)?!1:!this.opts.tools||this.opts.tools.includes(e)}settleMode(){this.toolAvailable(this.mode)?this.paintModeTabs():this.setMode("view")}tables(){return(this.doc?(0,U.floorsOf)(this.doc):[]).flatMap(e=>e.objects).filter(e=>e.type==="table")}paintModeTabs(){let e=[];this.els.modes?.querySelectorAll(".slm-modegroup").forEach(n=>{let a=[];n.querySelectorAll("[data-mode]").forEach(o=>{let r=o.dataset.mode,l=this.toolAvailable(r);if(o.hidden=!l,!l)return;a.push({mode:r,label:o.textContent??r});let c=r===this.mode;o.classList.toggle("on",c),o.setAttribute("aria-selected",String(c)),o.tabIndex=c?0:-1}),n.hidden=a.length===0,a.length&&e.push({label:n.querySelector(".slm-modegroup-label")?.textContent??"",tools:a})});let t=this.els.tools;t&&(t.innerHTML=e.map(n=>`<optgroup label="${w(n.label)}">${n.tools.map(a=>`<option value="${a.mode}"${a.mode===this.mode?" selected":""}>${w(a.label)}</option>`).join("")}</optgroup>`).join(""),t.value=this.mode),this.root?.classList.toggle("block-mode",this.mode==="block"),this.taskGroups=e,this.paintTaskPicker();let s=n=>n!=="view"&&n!=="inspect"&&n!=="select"&&n!=="filterSections";this.els.viewonly&&(this.els.viewonly.hidden=e.some(n=>n.tools.some(a=>s(a.mode))))}canBlock(){let e=this.opts.capabilities;return!e||e.includes("event:block")}railHeader(e,t,s){let n=t==="read"?"Read-only":t==="event"?"This event only":"Your app";return`<div class="slm-railhead"><p class="slm-eyebrow">${w(e)}</p><span class="slm-scope ${t}">${n}</span></div>
1794
- <p class="slm-hint">${s}</p>`}paintFollowLiveButton(){let e=this.els.follow;if(!e)return;e.classList.toggle("on",this.followLive),e.setAttribute("aria-pressed",String(this.followLive));let t=this.root?.querySelector('[data-ref="followstatus"]');t&&(t.hidden=!this.followLive,t.textContent="Waiting for new holds or bookings"),e.setAttribute("title",this.followLive?"Following new holds and bookings. Turn off to keep the current view.":"Stay on the current map view. Enable to follow new holds and bookings.")}paintHeatButton(){this.paintMapViewMenu(),this.paintMomentumHelp()}paintMomentumHelp(){let e=this.root?.querySelector('[data-ref="heatstatus"]');if(e){e.hidden=!this.heatEnabled;let a=this.controlRoomSnapshot?.velocity.bySection.some(o=>o.netBooked>0);e.textContent=this.controlRoomSnapshot?a?`Booking heatmap \xB7 last ${this.trendWindowMinutes}m \xB7 warmer = higher net booking rate`:`No positive net bookings in the last ${this.trendWindowMinutes}m`:"Loading booking heatmap\u2026"}let t=this.els.rail?.querySelector('[data-ref="momentumhelp"]');if(!t)return;t.hidden=!this.heatEnabled;let s=t.querySelector('[data-ref="momentumcopy"]');if(!s)return;let n=this.controlRoomSnapshot?.velocity.bySection.some(a=>a.netBooked>0);s.textContent=n?"Warmer sections have more completed bookings, adjusted for section size. Holds and viewers are not counted.":`No completed bookings in the last ${this.trendWindowMinutes} minutes.`}paintFullscreenButton(){let e=this.els.fullscreen;if(!e)return;let t=this.isFullscreen(),s=t?"Exit full screen":"Full screen";e.setAttribute("aria-label",s),e.title=`${s} (F)`;let n=e.querySelector(".slm-fullscreen-icon");n&&(n.innerHTML=t?Ys.exit:Ys.enter)}paintTrendWindow(){this.els.rail?.querySelectorAll("[data-window]").forEach(e=>{let t=Number(e.dataset.window);e.classList.toggle("on",t===this.trendWindowMinutes)})}setLive(e){this.root?.classList.toggle("live",e),this.trackLink(e),this.paintMonitorInsights();let t=e?"live":this.sessionEnded?"ended":"reconnecting";if(t!==this.connectionStatus){this.connectionStatus=t;try{this.opts.onConnectionChange?.(this.getConnection())}catch(s){this.opts.onError?.(s)}}}trackLink(e){let t=()=>{this.linkTimers&&this.linkTimers.forEach(s=>clearTimeout(s)),this.linkTimers=null};if(e){t(),this.everLive=!0,this.paintLink("live");return}if(this.sessionEnded){t(),this.paintLink("live"),this.els.livetext&&(this.els.livetext.textContent="ENDED"),this.announceRoomState();return}this.linkTimers||(!this.everLive&&this.els.livetext&&(this.els.livetext.textContent="CONNECTING"),this.linkTimers=[...this.everLive?[setTimeout(()=>{this.closed||this.paintLink("paused")},5e3)]:[],setTimeout(()=>{this.closed||this.paintLink("offline")},12e4)])}roomState(){return this.sessionEnded?"ended":this.everLive?this.linkState:this.linkState==="offline"?"offline":"connecting"}announceRoomState(){let e=this.roomState();if(e!==this.announcedRoomState){this.announcedRoomState=e;try{this.opts.onRoomStateChange?.(e)}catch(t){this.opts.onError?.(t)}}}paintLink(e){this.linkState=e,this.announceRoomState(),this.root?.classList.toggle("paused",e==="paused"),this.root?.classList.toggle("offline",e==="offline"),this.els.livetext&&(this.els.livetext.textContent=e==="paused"?"PAUSED":e==="offline"?"OFFLINE":"LIVE");let t=this.els.connbanner;t&&(t.innerHTML=wn(e),t.querySelector("[data-conn-retry]")?.addEventListener("click",()=>{this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.attempt=0,this.connect()}))}paintFullscreenLine(){let e=this.els.fsline;if(!e||!this.isFullscreen())return;let t=this.controlRoomSnapshot?.event?.name??"",s=this.eventStartsAt?W(this.eventStartsAt,{month:"short",day:"numeric"}):null;e.innerHTML=Sn(t,s,this.talliesReady()?this.buildTallies():null),this.opts.sale?.status&&this.withExtras(n=>n.addSalePill(e,this.opts.sale)),e.querySelector("[data-fs-exit]")?.addEventListener("click",()=>{this.exitFullscreen()})}updateZoomHint(){let e=this.els.zoomhint;if(!e)return;let t=this.isBulkSelectMode()&&!this.movingMap&&this.renderer?.getRung?.()!=="seats";e.classList.toggle("on",!!t)}formatKpiDelta(e,t,s){let n=t>0?"+":"\u2212",a=Math.abs(t);return e==="booked-value"?`${n}${Ie(a,s)}`:e==="booked-pct"?`${n}${a.toLocaleString()}pt`:`${n}${a.toLocaleString()}`}paintKpis(e,t=!0){if(!this.els.kpis)return;let s=l=>t?{raw:l,n:l.toLocaleString()}:{raw:null,n:"\u2014"},n=e.bookedValueStatus==="current"?Ie(e.bookedValue,e.currency):"\u2014",a=this.presenceCounts(),o=[{key:"booked-inventory",...s(e.booked),l:"Booked inventory",dot:Ce.booked,title:"Inventory units booked"},{key:"held-seats",...s(e.held),l:"In a cart",dot:Ce.held,title:"Inventory in buyers\u2019 carts now"},{key:"free-seats",...s(e.free),l:"Available",dot:Ce.free,title:"Inventory available to book"},{key:"blocked",...s(e.blocked),l:"Blocked",dot:Ce.blocked,title:"Inventory withheld from booking"},{key:"viewing-map",raw:a?.shoppingSessions??null,n:a?a.shoppingSessions.toLocaleString():"\u2014",l:"Viewing map",title:"Active map sessions right now"},{key:"active-holds",raw:a?.activeHolds??null,n:a?a.activeHolds.toLocaleString():"\u2014",l:"Active holds",title:"Sessions currently holding inventory"},{key:"booked-pct",...t?{raw:e.capacityPct,n:`${e.capacityPct}%`}:{raw:null,n:"\u2014"},l:"Booked",title:"Booked inventory as a share of the whole event"},{key:"booked-value",raw:e.bookedValueStatus==="current"?e.bookedValue:null,n,l:"Booked value",title:"Configured value attached to booked inventory"}],r=!1;this.els.kpis.innerHTML=o.map(l=>{let c=this.lastKpiValues.get(l.key),d=l.raw!=null&&c!=null&&l.raw!==c,b=d?l.raw-c:0;d&&(r=!0,this.activeKpiDeltas.set(l.key,{text:this.formatKpiDelta(l.key,b,e.currency),down:b<0})),l.raw!=null&&this.lastKpiValues.set(l.key,l.raw);let f=this.activeKpiDeltas.get(l.key),u=this.opts.onOpenTrend&&(l.key==="booked-inventory"||l.key==="booked-pct"||l.key==="booked-value");return`<div class="slm-kpi${f?" changed":""}" data-kpi="${l.key}"${u?' tabindex="0"':` title="${w(l.title)}"`}>
1827
+ `,this.host.appendChild(e),this.root=e,this.selectObserver=new MutationObserver(()=>{let o=e.querySelector(".slm-rail");o&&(Xe(o),pn(o))});let s=e.querySelector(".slm-rail");if(s&&this.selectObserver.observe(s,{childList:!0,subtree:!0}),this.applyThemeVars(),this.watchThemeMode(),this.updateContainerLayout(),typeof ResizeObserver<"u"){this.layoutObserver=new ResizeObserver(()=>this.updateContainerLayout()),this.layoutObserver.observe(e);let o=e.querySelector(".slm-bar-actions");o&&this.layoutObserver.observe(o)}typeof document<"u"&&document.fonts?.ready.then(()=>{this.closed||this.updateContainerLayout()});let n=o=>e.querySelector(`[data-ref="${o}"]`);this.mapHost=n("maphost"),this.els={modes:n("modes"),tools:n("tools"),livetext:n("livetext"),kpis:n("kpis"),follow:n("follow"),view:n("view"),findbar:n("findbar"),fullscreen:n("fullscreen"),lane:n("lane"),zoomhint:n("zoomhint"),liveevent:n("liveevent"),rail:n("rail"),toast:n("toast"),mapchrome:n("mapchrome"),crumb:n("crumb"),zin:n("zin"),zout:n("zout"),zfit:n("zfit"),minimapMount:n("minimap"),blocklegend:n("blocklegend"),connbanner:n("connbanner"),fsline:n("fsline"),viewonly:n("viewonly"),taskpick:n("taskpick"),grab:n("grab"),peek:n("peek"),bell:n("bell"),awaybanner:n("awaybanner")},this.wireSheet(),this.els.modes.querySelectorAll("[data-mode]").forEach(o=>o.addEventListener("click",()=>this.setMode(o.dataset.mode))),this.els.tools.addEventListener("change",()=>this.setMode(this.els.tools.value)),this.els.zfit.addEventListener("click",()=>{this.setFollowLive(!1),this.zoomToFit()}),this.els.zin.addEventListener("click",()=>{this.setFollowLive(!1),this.renderer?.zoomIn()}),this.els.zout.addEventListener("click",()=>{this.setFollowLive(!1),this.zoomOutStep()}),this.els.mapchrome&&this.layoutObserver?.observe(this.els.mapchrome),this.applyLaneRoom(),this.els.follow.addEventListener("click",()=>this.setFollowLive(!this.followLive)),this.wireColourMenu(e),this.els.view.addEventListener("click",o=>{let r=o.target?.closest("[data-view], [data-panel-toggle]");if(r?.dataset.view)this.toggleMapView(r.dataset.view);else if(r){let l=!e.classList.toggle("details-hidden");r.setAttribute("aria-checked",String(l)),r.classList.toggle("on",l)}}),e.addEventListener("pointerdown",o=>{let r=this.els.view;r.open&&!r.contains(o.target)&&(r.open=!1)}),this.mapView=Li(),this.colourChoices=ki();let a=this.colourChoices[this.mode]??this.startingColourBy(this.mode);this.priceMode=a==="price",this.mapView={...this.mapView,categoryColours:a==="type"||a==="price",channelColours:a==="channel"},this.heatEnabled=this.mapView.momentum,this.applyMapView(),this.wireBarFind(),this.els.fullscreen.addEventListener("click",()=>this.toggleFullscreen()),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("keydown",this.onSelectAllKey,!0),this.els.rail.addEventListener("click",this.onRailClick),this.root.addEventListener("click",this.onHowClick),document.addEventListener("fullscreenchange",this.onFullscreenChange),this.paintModeTabs(),this.paintFollowLiveButton(),this.paintHeatButton(),this.paintMapViewMenu(),this.paintFullscreenButton(),this.navigation=new It({root:e,map:this.mapHost,setMoving:o=>{this.movingMap=o,this.updateRendererInteraction()},setShape:o=>{this.marqueeShape=o,this.updateRendererInteraction()},pauseFollow:()=>{this.followLive&&this.setFollowLive(!1)},stepSelection:o=>{this.stepSelection(o)}}),this.navigation.update(this.isBulkSelectMode()),this.wireGestures(this.mapHost),this.els.blocklegend&&e.querySelector(".slm-navigation")?.prepend(this.els.blocklegend)}wireColourMenu(e){let t=this.els.blocklegend,s=t?.querySelector('[data-ref="colourby"]'),n=t?.querySelector('[role="listbox"]');if(!t||!s||!n)return;this.paintColourLegend();let a=o=>{n.hidden=!o,s.setAttribute("aria-expanded",String(o))};t.querySelector('[data-ref="legenditems"]')?.addEventListener("click",o=>{let r=o.target.closest("[data-legend]");r?.dataset.legend&&this.onLegendChip(r.dataset.legend,o.shiftKey)}),s.addEventListener("click",()=>{n.hidden&&this.paintColourLegend(),a(n.hidden),n.hidden||n.querySelector('[aria-selected="true"]')?.focus()}),n.addEventListener("click",o=>{let r=o.target?.closest("[data-colour-by]");!r||r.disabled||(this.setColourBy(r.dataset.colourBy),a(!1),s.focus())}),n.addEventListener("keydown",o=>{o.key==="Escape"&&(a(!1),s.focus(),o.stopPropagation())}),e.addEventListener("pointerdown",o=>{!n.hidden&&!t.contains(o.target)&&a(!1)})}showLabels(e){this.setFollowLive(!1);let t=e.length===1?this.labelToSeat.get(e[0]):null;if(!t){this.frameLabels(e);return}let s=this.sectionByObject.get(t.rowId);s&&this.renderer?.focusSection(s),this.renderer?.focusRegion({x:t.x-180,y:t.y-120,width:360,height:240},{animate:!1,minScale:1.5}),this.renderer?.flashSeat(t.id,this.activityColor(this.status.get(t.label)??"free"))}applyChromeClearance(){if(this.opts.chrome!=="minimal"||!this.renderer)return;let e=this.els.mapchrome,t=e?.parentElement;if(!e||!t)return;let s=e.getBoundingClientRect(),n=t.getBoundingClientRect(),a=e.offsetHeight>0&&n.bottom>s.top,o=a?Math.ceil(n.bottom-s.top)+8:0,r=a?Math.ceil(n.right-s.left)+8:0;o===this.chromeClearance&&r===this.chromeClearanceWidth||(this.chromeClearance=o,this.chromeClearanceWidth=r,this.renderer.setFitClearance(o,r))}applyLaneRoom(){let e=this.els.mapchrome,t=e?.parentElement;if(!e||!t)return;let s=e.offsetWidth;t.style.setProperty("--slm-chrome-w",`${s}px`),t.style.setProperty("--slm-chrome-h",`${e.offsetHeight}px`),t.classList.toggle("slm-lane-above",t.clientWidth-s-42<240)}applyLegendInset(){let e=this.opts.mapInsets;if(this.opts.chrome==="minimal"&&!e||!this.renderer?.setViewportInsets)return;let t=this.opts.chrome==="minimal"?null:this.els.blocklegend,s=t&&t.offsetHeight?Math.max(0,Math.ceil(t.getBoundingClientRect().bottom-this.mapHost.getBoundingClientRect().top)+8):0,n=l=>Number.isFinite(l)&&l>0?Math.ceil(l):0,a={top:Math.max(s,n(e?.top)),right:n(e?.right),bottom:n(e?.bottom),left:n(e?.left)},o=`${a.top},${a.right},${a.bottom},${a.left}`;if(o===this.legendInset)return;this.legendInset=o;let r=Object.fromEntries(Object.entries(a).filter(([,l])=>l>0));this.renderer.setViewportInsets(Object.keys(r).length?r:null)}setMapInsets(e){this.opts.mapInsets=e??void 0,this.applyLegendInset()}fitBar(e,t){let s=this.root;if(!s)return;let n=["tightsearch","tightbar","tighterbar"];if(t){s.classList.remove(...n);return}let a=n.filter(l=>s.classList.contains(l)).length;for(;a>0&&e>=this.barNeed[a];)s.classList.remove(n[--a]);let o=()=>{let l=s.querySelector(".slm-bar")?.getBoundingClientRect(),c=s.querySelector(".slm-bar-actions > :last-child")?.getBoundingClientRect(),d=parseFloat(getComputedStyle(s.querySelector(".slm-bar")).paddingRight)||0;return l&&c&&l.width?Math.ceil(c.right-(l.right-d)):0},r=o();for(;r>0&&a<n.length;)this.barNeed[a+1]=e+r+12,s.classList.add(n[a++]),r=o()}updateContainerLayout(){let e=this.root?.getBoundingClientRect().width||this.host.clientWidth,t=e>0&&e<1e3&&this.opts.chrome!=="minimal";t!==this.root?.classList.contains("compact")&&(this.root?.classList.toggle("compact",t),this.applyDetent()),this.fitBar(e,t),this.applyChromeClearance(),this.applyLaneRoom(),this.applyLegendInset(),this.channels?.handleLayoutChange(),this.syncMinimap()}filterableSections(){return this.sectionsBase?[...this.sectionsBase.sections,...this.sectionsBase.ungrouped?[this.sectionsBase.ungrouped]:[]]:[]}applyFilteredSectionCanvas(e=this.filterableSections().filter(t=>t.label===this.filteredSectionLabel)){if(!this.renderer||this.mode!=="filterSections"||!e.length)return;let t=new Set(e.map(n=>n.id)),s=this.filterableSections().filter(n=>!t.has(n.id)).map(n=>n.id);this.renderer.clearSectionFocus(),this.renderer.setClosedSections(null),this.renderer.setDimmedSections(s),this.frameSections(e)}frameSections(e){if(!this.renderer||!e.length)return;let t=e.flatMap(l=>l.seatLabels).map(l=>this.labelToSeat.get(l)).filter(l=>!!l&&Number.isFinite(l.x)&&Number.isFinite(l.y));if(!t.length){this.renderer.focusRegion(e[0].id);return}let s=Math.min(...t.map(l=>l.x)),n=Math.min(...t.map(l=>l.y)),a=Math.max(...t.map(l=>l.x)),o=Math.max(...t.map(l=>l.y)),r=Math.max(40,Math.max(a-s,o-n)*.08);this.renderer.focusRegion({x:s-r,y:n-r,width:Math.max(1,a-s)+r*2,height:Math.max(1,o-n)+r*2})}buildSectionOptions(){if(this.doc)try{let e=(0,G.computeSections)(this.doc);this.sectionsBase=e,this.sectionOptions=[],this.sectionByObject=new Map(e.objectToSection),this.sectionLabelById.clear();for(let t of e.sections)this.sectionOptions.push({id:t.id,label:t.label}),this.sectionLabelById.set(t.id,t.label);e.ungrouped&&(this.sectionOptions.push({id:G.UNGROUPED_ID,label:e.ungrouped.label}),this.sectionLabelById.set(G.UNGROUPED_ID,e.ungrouped.label))}catch{}}toolAvailable(e){return e==="view"?!0:e==="channels"&&!this.channelCaps.view||e==="categories"&&!this.categoryCanManage&&!this.typesLocked()||(e==="block"||e==="reserve"||e==="sections")&&!this.canBlock()||e==="tables"&&(!this.tableCanManage||!this.tables().length)?!1:!this.opts.tools||this.opts.tools.includes(e)}settleMode(){this.toolAvailable(this.mode)?this.paintModeTabs():this.setMode("view")}tables(){return(this.doc?(0,G.floorsOf)(this.doc):[]).flatMap(e=>e.objects).filter(e=>e.type==="table")}paintModeTabs(){let e=[];this.els.modes?.querySelectorAll(".slm-modegroup").forEach(n=>{let a=[];n.querySelectorAll("[data-mode]").forEach(o=>{let r=o.dataset.mode,l=this.toolAvailable(r);if(o.hidden=!l,!l)return;a.push({mode:r,label:o.textContent??r});let c=r===this.mode;o.classList.toggle("on",c),o.setAttribute("aria-selected",String(c)),o.tabIndex=c?0:-1}),n.hidden=a.length===0,a.length&&e.push({label:n.querySelector(".slm-modegroup-label")?.textContent??"",tools:a})});let t=this.els.tools;t&&(t.innerHTML=e.map(n=>`<optgroup label="${S(n.label)}">${n.tools.map(a=>`<option value="${a.mode}"${a.mode===this.mode?" selected":""}>${S(a.label)}</option>`).join("")}</optgroup>`).join(""),t.value=this.mode),this.root?.classList.toggle("block-mode",this.mode==="block"),this.taskGroups=e,this.paintTaskPicker();let s=n=>n!=="view"&&n!=="inspect"&&n!=="select"&&n!=="filterSections";this.els.viewonly&&(this.els.viewonly.hidden=e.some(n=>n.tools.some(a=>s(a.mode)))),this.els.zoomhint&&(this.els.zoomhint.hidden=!e.some(n=>n.tools.some(a=>Nl.has(a.mode))))}typesLocked(){let e=this.opts.capabilities;return!e||this.categoryCanManage?!1:e.some(t=>t==="event:block"||t==="event:tables:manage"||t==="event:channels:manage")}canBlock(){let e=this.opts.capabilities;return!e||e.includes("event:block")}railHeader(e,t,s){let n=t==="read"?"Read-only":t==="event"?"This event only":"Your app";return`<div class="slm-railhead"><p class="slm-eyebrow">${S(e)}</p><span class="slm-scope ${t}">${n}</span></div>
1828
+ <p class="slm-hint">${s}</p>`}paintFollowLiveButton(){let e=this.els.follow;if(!e)return;e.classList.toggle("on",this.followLive),e.setAttribute("aria-pressed",String(this.followLive));let t=this.root?.querySelector('[data-ref="followstatus"]');t&&(t.hidden=!this.followLive,t.textContent="Waiting for new holds or bookings"),e.setAttribute("title",this.followLive?"Following new holds and bookings. Turn off to keep the current view.":"Stay on the current map view. Enable to follow new holds and bookings.")}paintHeatButton(){this.paintMapViewMenu(),this.paintMomentumHelp()}paintMomentumHelp(){let e=this.root?.querySelector('[data-ref="heatstatus"]');if(e){e.hidden=!this.heatEnabled;let o=this.controlRoomSnapshot?.velocity.bySection.some(r=>r.netBooked>0);e.textContent=this.controlRoomSnapshot?o?`Booking heatmap \xB7 last ${this.trendWindowMinutes}m \xB7 warmer = higher net booking rate`:`No positive net bookings in the last ${this.trendWindowMinutes}m`:"Loading booking heatmap\u2026"}let t=this.els.rail?.querySelector('[data-ref="momentumhelp"]');if(!t)return;t.hidden=!this.heatEnabled;let s=this.els.rail?.querySelector(".slm-sectionhead");s&&(s.hidden=!this.heatEnabled);let n=t.querySelector('[data-ref="momentumcopy"]');if(!n)return;let a=this.controlRoomSnapshot?.velocity.bySection.some(o=>o.netBooked>0);n.textContent=a?"Warmer sections have more completed bookings, adjusted for section size. Holds and viewers are not counted.":`No completed bookings in the last ${this.trendWindowMinutes} minutes.`}paintFullscreenButton(){let e=this.els.fullscreen;if(!e)return;let t=this.isFullscreen(),s=t?"Exit full screen":"Full screen";e.setAttribute("aria-label",s),e.title=`${s} (F)`;let n=e.querySelector(".slm-fullscreen-icon");n&&(n.innerHTML=t?hn.exit:hn.enter)}paintTrendWindow(){this.els.rail?.querySelectorAll("[data-window]").forEach(e=>{let t=Number(e.dataset.window);e.classList.toggle("on",t===this.trendWindowMinutes)})}setLive(e){this.root?.classList.toggle("live",e),this.trackLink(e),this.paintMonitorInsights();let t=e?"live":this.sessionEnded?"ended":"reconnecting";if(t!==this.connectionStatus){this.connectionStatus=t;try{this.opts.onConnectionChange?.(this.getConnection())}catch(s){this.opts.onError?.(s)}}}trackLink(e){let t=()=>{this.linkTimers&&this.linkTimers.forEach(s=>clearTimeout(s)),this.linkTimers=null};if(e){t(),this.everLive=!0,this.paintLink("live");return}if(this.sessionEnded){t(),this.paintLink("live"),this.els.livetext&&(this.els.livetext.textContent="ENDED"),this.announceRoomState();return}this.linkTimers||(!this.everLive&&this.els.livetext&&(this.els.livetext.textContent="CONNECTING"),this.linkTimers=[...this.everLive?[setTimeout(()=>{this.closed||this.paintLink("paused")},5e3)]:[],setTimeout(()=>{this.closed||this.paintLink("offline")},12e4)])}roomState(){return this.sessionEnded?"ended":this.everLive?this.linkState:this.linkState==="offline"?"offline":"connecting"}announceRoomState(){let e=this.roomState();if(e!==this.announcedRoomState){this.announcedRoomState=e;try{this.opts.onRoomStateChange?.(e)}catch(t){this.opts.onError?.(t)}}}paintLink(e){this.linkState=e,this.announceRoomState(),this.root?.classList.toggle("paused",e==="paused"),this.root?.classList.toggle("offline",e==="offline"),this.els.livetext&&(this.els.livetext.textContent=e==="paused"?"PAUSED":e==="offline"?"OFFLINE":"LIVE");let t=this.els.connbanner;t&&(t.innerHTML=Dn(e),t.querySelector("[data-conn-retry]")?.addEventListener("click",()=>{this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.attempt=0,this.connect()}))}paintFullscreenLine(){let e=this.els.fsline;if(!e||!this.isFullscreen())return;let t=this.controlRoomSnapshot?.event?.name??"",s=this.eventStartsAt?K(this.eventStartsAt,{month:"short",day:"numeric"}):null;e.innerHTML=zn(t,s,this.talliesReady()?this.buildTallies():null),this.opts.sale?.status&&this.withExtras(n=>n.addSalePill(e,this.opts.sale)),e.querySelector("[data-fs-exit]")?.addEventListener("click",()=>{this.exitFullscreen()})}updateZoomHint(){let e=this.els.zoomhint;if(!e)return;let t=this.isBulkSelectMode()&&!this.movingMap&&(Date.now()<this.hintUntil||this.mode==="block"&&Oe());e.classList.toggle("on",!!t)}formatKpiDelta(e,t,s){let n=t>0?"+":"\u2212",a=Math.abs(t);return e==="booked-value"?`${n}${we(a,s)}`:e==="booked-pct"?`${n}${a.toLocaleString()}pt`:`${n}${a.toLocaleString()}`}paintKpis(e,t=!0){if(!this.els.kpis)return;let s=l=>t?{raw:l,n:l.toLocaleString()}:{raw:null,n:"\u2014"},n=e.bookedValueStatus==="current"?we(e.bookedValue,e.currency):"\u2014",a=this.presenceCounts(),o=[{key:"booked-inventory",...s(e.booked),l:"Booked inventory",dot:Re.booked,title:"Inventory units booked"},{key:"held-seats",...s(e.held),l:"In a cart",dot:Re.held,title:"Inventory in buyers\u2019 carts now"},{key:"free-seats",...s(e.free),l:"Available",dot:Re.free,title:"Inventory available to book"},{key:"blocked",...s(e.blocked),l:"Blocked",dot:Re.blocked,title:"Inventory withheld from booking"},{key:"viewing-map",raw:a?.shoppingSessions??null,n:a?a.shoppingSessions.toLocaleString():"\u2014",l:"Viewing map",title:"Active map sessions right now"},{key:"active-holds",raw:a?.activeHolds??null,n:a?a.activeHolds.toLocaleString():"\u2014",l:"Active holds",title:"Sessions currently holding inventory"},{key:"booked-pct",...t?{raw:e.capacityPct,n:`${e.capacityPct}%`}:{raw:null,n:"\u2014"},l:"Booked",title:"Booked inventory as a share of the whole event"},{key:"booked-value",raw:e.bookedValueStatus==="current"?e.bookedValue:null,n,l:"Booked value",title:"Configured value attached to booked inventory"}],r=!1;this.els.kpis.innerHTML=o.map(l=>{let c=this.lastKpiValues.get(l.key),d=l.raw!=null&&c!=null&&l.raw!==c,g=d?l.raw-c:0;d&&(r=!0,this.activeKpiDeltas.set(l.key,{text:this.formatKpiDelta(l.key,g,e.currency),down:g<0})),l.raw!=null&&this.lastKpiValues.set(l.key,l.raw);let b=this.activeKpiDeltas.get(l.key),m=this.opts.onOpenTrend&&(l.key==="booked-inventory"||l.key==="booked-pct"||l.key==="booked-value");return`<div class="slm-kpi${b?" changed":""}" data-kpi="${l.key}"${m?' tabindex="0"':` title="${S(l.title)}"`}>
1795
1829
  <b>${l.dot?`<span class="dot" style="background:${l.dot}"></span>`:""}${l.n}</b><span>${l.l}</span>
1796
- ${f?`<span class="slm-kpidelta${f.down?" down":""}">${f.text}</span>`:""}
1830
+ ${b?`<span class="slm-kpidelta${b.down?" down":""}">${b.text}</span>`:""}
1797
1831
  </div>`}).join(""),r&&(this.kpiCleanupTimer&&clearTimeout(this.kpiCleanupTimer),this.kpiCleanupTimer=setTimeout(()=>{this.kpiCleanupTimer=null,this.activeKpiDeltas.clear(),this.els.kpis?.querySelectorAll(".slm-kpidelta").forEach(l=>l.remove()),this.els.kpis?.querySelectorAll(".slm-kpi.changed").forEach(l=>l.classList.remove("changed"))},1500))}paintRail(){this.root?.classList.toggle("monitor-view",this.mode==="view"||this.mode==="inspect"),this.reserve?.destroy(),this.reserve=null,this.findBlocked?.destroy(),this.findBlocked=null,this.sectionsPanel?.destroy(),this.sectionsPanel=null,this.tablesPanel?.destroy(),this.tablesPanel=null,this.els.rail?.classList.remove("slm-blk-listing"),this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,this.activityPanel?.destroy(),this.activityPanel=null,this.mode==="view"?this.renderViewRail():this.mode==="select"?this.renderSelectRail():this.mode==="filterSections"?this.renderFilterSectionsRail():this.mode==="sections"?this.renderSectionsRail():this.mode==="categories"?this.renderCategoriesRail():this.mode==="reserve"?this.renderReserveRail():this.mode==="tables"?this.renderTablesRail():this.mode==="channels"?this.channels?this.channels.paintRail():this.channelsLoading?this.els.rail.innerHTML='<div class="slm-empty" role="status">Loading sales channels\u2026</div>':this.els.rail.innerHTML='<div class="slm-empty" role="alert">Sales channels could not be loaded. Switch away and back to try again.</div>':this.renderBlockRail(),this.updateZoomHint()}renderViewRail(){this.els.rail.innerHTML=`
1798
- ${Be({glyph:"eye",hue:"#3b82f6",title:"Watch",purpose:"See what is selling, where buyers are, and answer questions about any seat.",how:"watch"})}
1799
- <div data-ref="watchseat"></div>
1832
+ ${De({glyph:"eye",hue:"#3b82f6",title:"Watch",purpose:"See what is selling, where buyers are, and answer questions about any seat.",how:"watch"})}
1833
+ <div data-ref="watchseat"></div><div data-ref="alertfeed"></div>
1800
1834
  <div class="slm-monitor-head"><span data-ref="presence" class="slm-monitor-connection"></span></div>
1801
1835
  <div class="slm-monitor-tabs" role="tablist" aria-label="Watch details">
1802
1836
  <button role="tab" aria-selected="true" data-monitor-tab="activity">Live activity</button>
1803
1837
  <button role="tab" aria-selected="false" data-monitor-tab="sections">Sections</button>
1804
1838
  </div>
1805
- <div data-monitor-panel="activity" class="slm-monitor-activity"><div class="slm-feedfilter" data-ref="feedfilter"></div><div data-ref="alertfeed"></div><div data-ref="nosales"></div><div data-ref="feed"></div><div data-ref="yours" hidden></div></div>
1839
+ <div data-monitor-panel="activity" class="slm-monitor-activity"><div class="slm-feedfilter" data-ref="feedfilter"></div><div data-ref="nosales"></div><div data-ref="feed"></div><div data-ref="yours" hidden></div></div>
1806
1840
  <div data-monitor-panel="sections" hidden>
1807
1841
  <div class="slm-sectionhead">
1808
1842
  <div class="slm-windows" aria-label="Booking momentum window">
@@ -1815,9 +1849,8 @@ Click to light them up \xB7 \u21E7 click to select them.`}),r.dataset.legend=o.k
1815
1849
  </div>
1816
1850
  <div class="slm-sectionlist" data-ref="sections"></div>
1817
1851
  </div>
1818
- `,this.els.presence=this.els.rail.querySelector('[data-ref="presence"]'),this.els.sections=this.els.rail.querySelector('[data-ref="sections"]'),this.els.feed=this.els.rail.querySelector('[data-ref="feed"]'),this.activityPanel=new Ct(this.els.feed,this.sectionOptions,e=>{this.setFollowLive(!1),this.locateActivity(e)},e=>this.labelNames.get(e)),this.alerts?.paintFeed(),this.paintFeedFilter(),this.els.rail.querySelector('[data-ref="feedfilter"]').addEventListener("click",e=>{let t=e.target.closest("[data-feed-filter]")?.dataset.feedFilter;t&&t!==this.feedFilter&&(this.feedFilter=t,this.paintFeedFilter())}),this.els.rail.querySelectorAll("[data-monitor-tab]").forEach(e=>e.addEventListener("click",()=>{let t=e.dataset.monitorTab;this.els.rail.querySelectorAll("[data-monitor-tab]").forEach(s=>s.setAttribute("aria-selected",String(s.dataset.monitorTab===t))),this.els.rail.querySelectorAll("[data-monitor-panel]").forEach(s=>{s.hidden=s.dataset.monitorPanel!==t})})),this.els.rail.querySelectorAll("[data-window]").forEach(e=>e.addEventListener("click",()=>{let t=Number(e.dataset.window);this.setTrendWindow(t).catch(s=>this.opts.onError?.(s))})),this.recomputeTallies(),this.paintMonitorInsights(),this.paintTrendWindow(),this.paintMomentumHelp(),this.paintFeed(),this.paintWatchSeat(this.getSelection())}presenceCounts(){return this.livePresence?.value??this.controlRoomSnapshot?.presence??null}paintMonitorInsights(){if(this.mode!=="view")return;let e=this.controlRoomSnapshot,t=this.els.rail?.querySelector('[data-ref="nosales"]');t&&(t.innerHTML=this.counts.booked===0&&this.labelToSeat.size?Ln(e?.presence?.shoppingSessions??null):"");let s=t?.querySelector(".slm-nosales");if(s&&(this.opts.sale?.openedAt||this.opts.sale?.pageUrl)&&this.withExtras(r=>r.enrichNoSales(s,this.opts.sale)),this.els.presence){let r=this.root?.classList.contains("live"),l=this.lastSyncedAt?ln(this.lastSyncedAt,Date.now()):"waiting";this.els.presence.textContent=r?"\u25CF Live":this.linkState==="offline"?"Offline":"Paused",this.els.presence.title=`Last data received: ${l}`}if(!this.els.sections)return;if(!e){this.els.sections.innerHTML='<div class="slm-empty">Loading authoritative section metrics\u2026</div>';return}let n=new Map(e.velocity.bySection.map(r=>[r.sectionId,r])),a=[...e.bookedValue.bySection].sort((r,l)=>{let c=n.get(r.sectionId)?.netBooked??0;return(n.get(l.sectionId)?.netBooked??0)-c||l.bookedValue-r.bookedValue}),o=new Map;for(let[r,l]of this.labelToSeat){let c=this.sectionByObject.get(l.rowId)??U.UNGROUPED_ID,d=o.get(c)??{free:0,blocked:0},b=this.status.get(r)??"free";b==="free"?d.free+=1:b==="blocked"&&(d.blocked+=1),o.set(c,d)}this.els.sections.innerHTML=a.length?a.map(r=>{let c=n.get(r.sectionId)?.netBooked??0,d=`${c>0?"+":""}${c}`,b=o.get(r.sectionId)??{free:0,blocked:0},f=b.free?`${b.free.toLocaleString()} free`:b.blocked>=r.total-r.booked&&b.blocked?"All blocked":"Sold out",u=b.free?"free":f==="All blocked"?"blocked":"soldout";return`<button type="button" class="slm-sectionrow" data-section-focus="${w(r.sectionId)}" title="Focus ${w(r.sectionLabel)} on the map">
1819
- <span class="slm-sectiontop"><span>${w(r.sectionLabel)}</span><span class="slm-sectionstate ${u}">${f}</span></span>
1820
- <span class="slm-sectionmeta"><span>${r.booked.toLocaleString()} of ${r.total.toLocaleString()} sold \xB7 ${d} in ${e.velocity.windowMinutes} min \xB7 ${Ie(r.bookedValue,e.currency)}</span><span class="slm-sectionlocate">Locate</span></span>
1852
+ `,this.els.presence=this.els.rail.querySelector('[data-ref="presence"]'),this.els.sections=this.els.rail.querySelector('[data-ref="sections"]'),this.els.feed=this.els.rail.querySelector('[data-ref="feed"]'),this.activityPanel=new Ht(this.els.feed,this.sectionOptions,e=>{this.setFollowLive(!1),this.locateActivity(e)},e=>this.labelNames.get(e)),this.alerts?.paintFeed(),this.paintFeedFilter(),this.els.rail.querySelector('[data-ref="feedfilter"]').addEventListener("click",e=>{let t=e.target.closest("[data-feed-filter]")?.dataset.feedFilter;t&&t!==this.feedFilter&&(this.feedFilter=t,this.paintFeedFilter())}),this.els.rail.querySelectorAll("[data-monitor-tab]").forEach(e=>e.addEventListener("click",()=>{let t=e.dataset.monitorTab;this.els.rail.querySelectorAll("[data-monitor-tab]").forEach(s=>s.setAttribute("aria-selected",String(s.dataset.monitorTab===t))),this.els.rail.querySelectorAll("[data-monitor-panel]").forEach(s=>{s.hidden=s.dataset.monitorPanel!==t})})),this.els.rail.querySelectorAll("[data-window]").forEach(e=>e.addEventListener("click",()=>{let t=Number(e.dataset.window);this.setTrendWindow(t).catch(s=>this.opts.onError?.(s))})),this.recomputeTallies(),this.paintMonitorInsights(),this.paintTrendWindow(),this.paintMomentumHelp(),this.paintFeed(),this.paintWatchSeat(this.getSelection())}presenceCounts(){return this.livePresence?.value??this.controlRoomSnapshot?.presence??null}paintMonitorInsights(){if(this.mode!=="view")return;let e=this.controlRoomSnapshot,t=this.els.rail?.querySelector('[data-ref="nosales"]');t&&(t.innerHTML=this.counts.booked===0&&this.labelToSeat.size?Fn(e?.presence?.shoppingSessions??null):"");let s=t?.querySelector(".slm-nosales");if(s&&(this.opts.sale?.openedAt||this.opts.sale?.pageUrl)&&this.withExtras(r=>r.enrichNoSales(s,this.opts.sale)),this.els.presence){let r=this.root?.classList.contains("live"),l=this.lastSyncedAt?Sn(this.lastSyncedAt,Date.now()):"waiting";this.els.presence.textContent=r?"\u25CF Live":this.linkState==="offline"?"Offline":"Paused",this.els.presence.title=`Last data received: ${l}`}if(!this.els.sections)return;if(!e){this.els.sections.innerHTML='<div class="slm-empty">Loading authoritative section metrics\u2026</div>';return}let n=new Map(e.velocity.bySection.map(r=>[r.sectionId,r])),a=[...e.bookedValue.bySection].sort((r,l)=>{let c=n.get(r.sectionId)?.netBooked??0;return(n.get(l.sectionId)?.netBooked??0)-c||l.bookedValue-r.bookedValue}),o=new Map;for(let[r,l]of this.labelToSeat){let c=this.sectionByObject.get(l.rowId)??G.UNGROUPED_ID,d=o.get(c)??{free:0,blocked:0},g=this.status.get(r)??"free";g==="free"?d.free+=1:g==="blocked"&&(d.blocked+=1),o.set(c,d)}this.els.sections.innerHTML=a.length?a.map(r=>{let c=n.get(r.sectionId)?.netBooked??0,d=`${c>0?"+":""}${c}`,g=o.get(r.sectionId)??{free:0,blocked:0},b=g.free?`${g.free.toLocaleString()} free`:g.blocked>=r.total-r.booked&&g.blocked?"All blocked":"Sold out",m=g.free?"free":b==="All blocked"?"blocked":"soldout";return`<button type="button" class="slm-sectionrow" data-section-focus="${S(r.sectionId)}" title="${r.booked.toLocaleString()} of ${r.total.toLocaleString()} sold \xB7 ${d} in ${e.velocity.windowMinutes} min \xB7 ${we(r.bookedValue,e.currency)}">
1853
+ <span>${S(r.sectionLabel)}</span><i><i style="width:${Math.round(100*(r.total-g.free)/Math.max(1,r.total))}%"></i></i><b class="${m}">${b}</b>
1821
1854
  </button>`}).join(""):'<div class="slm-empty">No section metrics are available for this chart.</div>',this.paintTrendWindow(),this.paintMomentumHelp()}applyHeatOverlay(){let e=this.controlRoomSnapshot;if(!this.heatEnabled||!e){this.renderer?.setSectionHeat(null);return}let t=new Map(e.bookedValue.bySection.map(o=>[o.sectionId,Math.max(1,o.total)])),s=e.velocity.bySection.map(o=>({sectionId:o.sectionId,rate:Math.max(0,o.netBooked)/(t.get(o.sectionId)??1)/e.velocity.windowMinutes})),n=Math.max(0,...s.map(o=>o.rate)),a={};for(let o of s)a[o.sectionId]=n>0?Math.sqrt(o.rate/n):0;this.renderer?.setSectionHeat(a)}renderSelectRail(){let e=this.opts.numberOfPlacesToSelect,t=this.selectionCap(),s=this.toolChooser();this.els.rail.innerHTML=`
1822
1855
  ${this.railHeader("Select","host","Pick seats for your own back-office operation \u2014 the selection is handed to your app. This tool is read-only inside the control room: it never books, releases or blocks seats by itself.")}
1823
1856
  <p class="slm-eyebrow slm-step"><span class="slm-stepnum">1</span>Choose seats</p>
@@ -1826,37 +1859,37 @@ Click to light them up \xB7 \u21E7 click to select them.`}),r.dataset.legend=o.k
1826
1859
  ${this.toolSelectionBar("selectnum","selectmeta","selectclear","selectall")}
1827
1860
  <p class="slm-note" data-ref="selectvalidity">${e?`Select exactly ${e.toLocaleString()} object${e===1?"":"s"}.`:`Up to ${t.toLocaleString()} objects may be selected.`}</p>`,this.els.selectnum=this.els.rail.querySelector('[data-ref="selectnum"]'),this.els.selectmeta=this.els.rail.querySelector('[data-ref="selectmeta"]'),this.els.selectvalidity=this.els.rail.querySelector('[data-ref="selectvalidity"]'),this.els.selectclear=this.els.rail.querySelector('[data-ref="selectclear"]'),this.els.rail.querySelector('[data-ref="selectall"]')?.addEventListener("click",()=>this.selectAll()),this.els.selectclear.addEventListener("click",()=>this.clearSelection()),s.wire(this.els.rail),this.paintSelectSelection(this.getSelection())}paintSelectSelection(e){if(!this.els.selectnum||!this.els.selectmeta)return;let t=e.length;this.els.selectnum.textContent=t.toLocaleString(),this.els.selectmeta.textContent=t===1?"object selected":"objects selected",this.els.selectclear.disabled=t===0;let s=this.getSelectionValidity();this.els.selectvalidity&&(this.els.selectvalidity.textContent=s?s.isValid?`Ready \u2014 exactly ${s.required.toLocaleString()} selected.`:`Select ${s.remaining.toLocaleString()} more to continue.`:`${Math.max(0,this.selectionCap()-t).toLocaleString()} selections remaining.`)}renderFilterSectionsRail(){let e=new Map;for(let t of this.filterableSections())e.set(t.label,[...e.get(t.label)??[],t]);this.els.rail.innerHTML=`
1828
1861
  ${this.railHeader("Filter sections","host","Narrow the map to one section for your own reporting. Sections sharing a label stay together and the map frames their combined inventory. Nothing changes for buyers.")}
1829
- ${e.size?`<div class="slm-sectionlist">${[...e].map(([t,s])=>{let n=t===this.filteredSectionLabel,a=s.reduce((o,r)=>o+r.seatCount,0);return`<button type="button" class="slm-sectionrow${n?" on":""}" data-filter-section="${w(t)}" aria-pressed="${n}">
1830
- <span class="slm-sectiontop"><span>${w(t)}</span><span>${a.toLocaleString()}</span></span>
1862
+ ${e.size?`<div class="slm-sectionlist">${[...e].map(([t,s])=>{let n=t===this.filteredSectionLabel,a=s.reduce((o,r)=>o+r.seatCount,0);return`<button type="button" class="slm-sectionrow${n?" on":""}" data-filter-section="${S(t)}" aria-pressed="${n}">
1863
+ <span class="slm-sectiontop"><span>${S(t)}</span><span>${a.toLocaleString()}</span></span>
1831
1864
  <span class="slm-sectionmeta"><span>${s.length===1?"One section":`${s.length.toLocaleString()} matching sections`}</span><span class="slm-sectionlocate">${n?"Filtered":"Filter"}</span></span>
1832
1865
  </button>`}).join("")}</div>
1833
1866
  <button type="button" class="slm-btn ghost" data-clear-filter ${this.filteredSectionLabel?"":"disabled"}>Clear filter</button>`:'<div class="slm-empty">This chart has no filterable sections.</div>'}`,this.els.rail.querySelectorAll("[data-filter-section]").forEach(t=>{t.addEventListener("click",()=>this.setFilteredSection(t.dataset.filterSection))}),this.els.rail.querySelector("[data-clear-filter]")?.addEventListener("click",()=>this.clearFilteredSection())}categorySeats(e){return[...this.labelToSeat.values()].filter(t=>t.categoryKey===e&&this.canSelectObject(t))}renderCategoriesRail(){let e=this.doc?.categories??[],t=this.toolChooser(),s=this.hoverPriceRanges();this.els.rail.innerHTML=`
1834
- ${Be({glyph:"tag",hue:"#8b5cf6",title:"Ticket types",badge:"This event only",purpose:"Change which ticket type a seat sells as, for this event only. The chart keeps its design.",how:"types"})}
1867
+ ${De({glyph:"tag",hue:"#8b5cf6",title:"Ticket types",badge:"This event only",purpose:"Change which ticket type a seat sells as, for this event only. The chart keeps its design.",how:"types"})}
1835
1868
  <div data-ref="panelalert"></div>
1836
- ${Lt()}
1869
+ ${Et()}
1837
1870
  ${this.addByHtml(t.chipsHtml({saved:!0}))}
1838
1871
  <p class="slm-eyebrow slm-step" style="margin-top:14px"><span class="slm-stepnum">2</span>Move them to</p>
1839
- <div class="slm-categoryassign" role="radiogroup" aria-label="Ticket type">${e.length?e.map(a=>{let o=s?.[a.key];return`<button type="button" class="slm-categoryrow" role="radio" aria-checked="false" data-assign-category="${w(a.key)}">
1840
- <span class="dot" style="background:${w(this.renderer?.categoryDisplayColor?.(a.key)??a.color??"#6e7bff")}"></span>
1841
- <span class="slm-categorycopy"><b>${w(a.label??a.key)}</b><small data-cat-current></small></span>
1842
- <span class="slm-categoryact">${o?w(Ie(o.min,this.currency)):""}</span>
1872
+ <div class="slm-categoryassign" role="radiogroup" aria-label="Ticket type">${e.length?e.map(a=>{let o=s?.[a.key];return`<button type="button" class="slm-categoryrow" role="radio" aria-checked="false" data-assign-category="${S(a.key)}">
1873
+ <span class="slm-radio" aria-hidden="true"></span><span class="dot" style="background:${S(this.typeColour(a.key,a.color))}"></span>
1874
+ <span class="slm-categorycopy"><b>${S(a.label??a.key)}</b><small data-cat-current></small></span>
1875
+ <span class="slm-categoryact">${o?S(we(o.min,this.currency)):typeof a.price=="number"?S(we(a.price,this.currency)):""}</span>
1843
1876
  </button>`}).join(""):'<span class="slm-empty">This chart has no ticket types.</span>'}</div>
1844
1877
  <div class="slm-catreset">
1845
1878
  <button type="button" class="slm-btn ghost" data-ref="categoryreset" disabled>Reset to chart defaults</button>
1846
1879
  <p class="slm-note" data-ref="categoryresetnote">Checking what differs from the chart\u2026</p>
1847
1880
  </div>
1848
- ${Tt("catfoot")}`;let n=a=>this.els.rail.querySelector(`[data-ref="${a}"]`);this.els.rail.querySelectorAll("[data-assign-category]").forEach(a=>{a.addEventListener("click",()=>{this.categoryChoice=a.dataset.assignCategory,this.paintCategorySelection(this.getSelection())})}),n("catfoot").querySelector("[data-foot-action]").addEventListener("click",()=>{this.categoryChoice&&this.setCategory(this.categoryChoice)}),n("categoryreset").addEventListener("click",()=>{this.resetCategoriesToChart()}),t.wire(this.els.rail),this.paintCategorySelection(this.getSelection()),this.loadCategoryDifferences()}async loadCategoryDifferences(){let e=this.els.rail;if(!e||this.closed)return;let t=e.querySelector('[data-ref="categoryreset"]'),s=e.querySelector('[data-ref="categoryresetnote"]');if(!(!t||!s))try{let n=await this.withAuthRetry(()=>this.api.categoryDifferences(this.key));if(!t.isConnected)return;this.categoryDifferences=n.differing,this.paintCategoryReset()}catch(n){if(!t.isConnected)return;s.textContent="Could not check the chart\u2019s defaults. Reset is unavailable until it can.",this.opts.onError?.(n)}}paintCategoryReset(){let e=this.els.rail;if(!e)return;let t=e.querySelector('[data-ref="categoryreset"]'),s=e.querySelector('[data-ref="categoryresetnote"]');if(!t||!s)return;let n=this.categoryDifferences;n!=null&&(t.disabled=n===0,t.textContent=n?`Reset to chart defaults \xB7 ${n.toLocaleString()} seat${n===1?"":"s"}`:"Reset to chart defaults",s.textContent=n?"Puts every seat this event moved back in its chart category. Held and booked seats keep the price they were sold at.":"Every seat sells under its chart category.")}async resetCategoriesToChart(){let e=this.els.rail.querySelector('[data-ref="categoryreset"]');e&&(e.disabled=!0,e.textContent="Resetting\u2026");try{let t=await this.withAuthRetry(()=>this.api.resetCategoriesToChart(this.key));t.changed&&await this.reloadEventChart(),this.categoryDifferences=0,this.clearSelection(),this.mode==="categories"&&this.paintRail(),this.paintCategoryReset(),this.done("resetCategories",t.labels,t.changed?`Put ${t.labels.length.toLocaleString()} seat${t.labels.length===1?"":"s"} back on the chart\u2019s categories.`:"Every seat already sells under its chart category.")}catch(t){this.paintCategoryReset(),this.toastErr("Couldn\u2019t reset those categories. Nothing changed."),this.opts.onError?.(t)}}paintCategorySelection(e){let t=this.els.rail,s=t?.querySelector('[data-ref="selcard"]'),n=t?.querySelector('[data-ref="catfoot"]');if(!s||!n)return;let a=this.selectionSummary(e,!0);lt(s,a),this.paintAddBy(e.length);let o=t.querySelector('[data-ref="panelalert"]');o&&(o.innerHTML=this.panelAlert??"");let r=e.length,l=this.categoryTotals(),c=e.filter(u=>u.categoryKey===this.categoryChoice).length;t.querySelectorAll("[data-assign-category]").forEach(u=>{let m=u.dataset.assignCategory,v=m===this.categoryChoice;u.setAttribute("aria-checked",String(v)),u.classList.toggle("on",v),u.disabled=this.categoryBusy;let $=r>0&&a.types.length===1&&e[0].categoryKey===m,A=u.querySelector("[data-cat-current]");if(A){let O=l.get(m)??0;A.textContent=$?"All selected seats are here now":`${fe(O)}`}});let d=this.doc?.categories.find(u=>u.key===this.categoryChoice)?.label??this.categoryChoice??"",b=r-c,f=a.parts.filter(u=>u.tone==="muted"||u.tone==="warn").map(u=>u.label);Ye(n,this.categoryBusy?{label:`Moving ${fe(b)}\u2026`,busy:!0,note:"Buyers see the new ticket type as soon as this finishes."}:r?this.categoryChoice?b?{label:`Move ${fe(b)} to ${d}`,note:f.length?`The ${f.join(" and ")} seats keep the price they were sold at.`:void 0}:{label:`Already ${d}`,disabled:!0,note:"Every selected seat already sells as this ticket type."}:{label:"Pick a ticket type",disabled:!0,note:`Choose where the ${r===1?"seat":`${r.toLocaleString()} seats`} should sell.`}:{label:"Select seats first",disabled:!0,note:"Pick seats on the map, then a ticket type."})}addByHtml(e){return`<details class="slm-addby" data-ref="addby" open><summary class="slm-eyebrow">Add seats by</summary>${e}</details>`}paintAddBy(e){let t=this.els.rail?.querySelector('[data-ref="addby"]');if(!t)return;e||(this.addByPinned=!1),t.dataset.wired||(t.dataset.wired="1",t.addEventListener("toggle",()=>{this.getSelection().length&&(this.addByPinned=t.open)}));let s=!e||this.addByPinned;t.open!==s&&(t.open=s)}categoryTotals(){if(this.categoryTotalsCache)return this.categoryTotalsCache;let e=new Map;for(let t of this.labelToSeat.values())e.set(t.categoryKey,(e.get(t.categoryKey)??0)+1);return this.categoryTotalsCache=e,e}selectionSummary(e,t=!1){let s={free:0,booked:0,held:0,blocked:0},n=new Map,a=new Map,o=this.rowLabels();for(let f of e){s[this.status.get(f.label)??"free"]+=1,a.set(f.categoryKey,(a.get(f.categoryKey)??0)+1);let u=this.sectionByObject.get(f.rowId)??U.UNGROUPED_ID,m=n.get(u)??{label:this.sectionLabelById.get(u)??"Other seats",rows:new Map},v=o.get(f.rowId);v&&m.rows.set(v.startsWith(`${m.label} `)?v.slice(m.label.length+1):v,!0),n.set(u,m)}let r=(f,u)=>f.localeCompare(u,void 0,{numeric:!0,sensitivity:"base"}),l=[];s.free&&l.push({label:`${s.free.toLocaleString()} free`,tone:"ok"}),s.booked&&l.push({label:`${s.booked.toLocaleString()} sold`,tone:"muted"}),s.held&&l.push({label:`${s.held.toLocaleString()} in a cart`,tone:"warn"}),s.blocked&&l.push({label:`${s.blocked.toLocaleString()} blocked`,tone:"danger"});let c=t&&this.savedApplied&&this.savedApplied.labels.size===e.length&&e.every(f=>this.savedApplied.labels.has(f.label))?this.savedApplied:null,d=c?c.sold+c.taken:0,b=c&&[d?`${d.toLocaleString()} of the ${(e.length+d+c.missing).toLocaleString()} ${c.taken?`${c.sold?"were sold or are":"are"} in a cart or blocked`:`${d===1?"was":"were"} sold`} since it was saved, so ${e.length.toLocaleString()} ${e.length===1?"is":"are"} picked.`:"",c.missing?`${c.missing.toLocaleString()} saved ${c.missing===1?"seat is":"seats are"} no longer on this chart.${d?"":` The other ${e.length.toLocaleString()} are picked.`}`:""].filter(Boolean).join(" ")||null;return{count:e.length,where:c?`${c.name} \xB7 saved selection`:dn([...n.values()].map(f=>({label:f.label,rows:[...f.rows.keys()].sort(r)}))),stale:b,canSave:t&&this.canBlock(),canSimilar:t&&e.length>0&&this.isChoosingTool(),canUndo:this.selBack.length>0,saved:t?this.savedCount:null,parts:l,types:[...a].map(([f,u])=>{let m=this.doc?.categories.find(v=>v.key===f);return{label:m?.label??f,color:this.renderer?.categoryDisplayColor?.(f)??m?.color??"#6e7bff",count:u}})}}rowLabels(){if(this.rowLabelCache?.doc===this.doc)return this.rowLabelCache.labels;let e=new Map;for(let t of this.doc?.objects??[])t.type==="row"?e.set(t.id,t.segmentedRow?.displayLabel??t.displayLabel??t.label):t.type==="table"&&e.set(t.id,t.displayLabel??t.label);return this.rowLabelCache={doc:this.doc,labels:e},e}renderTablesRail(){let e=this.mountTask("table","#65a30d","Tables","Sell each table per chair, or as one whole-table booking.");this.loadExtras().then(t=>{this.closed||this.mode!=="tables"||!e.isConnected||(this.tablesPanel=t.mountTables({mount:e,...this.panelKit(),oldModel:this.inventoryModelVersion!==2,tables:()=>this.tableInfos(),save:async(s,n)=>{let a=await this.saveTableBooking(s,n);return a==="skipped"?"failed":a},show:s=>this.frameLabels([...this.labelToSeat.values()].filter(n=>n.rowId===s).map(n=>n.label))}))}).catch(t=>this.extrasFailed(e,t))}mountTask(e,t,s,n){let a=s==="Sections"?"sections":s==="Tables"?"tables":void 0;return this.els.rail.innerHTML=`${Be({glyph:e,hue:t,title:s,badge:"This event only",purpose:n,how:a})}
1849
- <div data-ref="panelalert"></div><div data-ref="taskmount"><div class="slm-empty" role="status">Loading\u2026</div></div>`,this.els.rail.querySelector('[data-ref="taskmount"]')}panelKit(){let e=this.els.rail;return{alert:t=>{let s=e.querySelector('[data-ref="panelalert"]');s&&(s.innerHTML=t??"")},alertHtml:X,plate:J}}extrasFailed(e,t){e.isConnected&&(e.innerHTML='<div class="slm-empty" role="alert">This tool could not load. Switch tools and back to try again.</div>'),this.opts.onError?.(t)}tableInfos(){return this.tables().map(e=>{let t=0,s=0,n=0;for(let[o,r]of this.labelToSeat){if(r.rowId!==e.id)continue;let l=this.status.get(o);l==="held"?t++:l==="booked"?s++:l==="blocked"&&n++}let a=[s&&`${s} booked`,t&&`${t} in a cart`,n&&`${n} blocked`].filter(Boolean).join(" \xB7 ");return{id:e.id,label:e.displayLabel??e.label,chairs:e.seatCount,mode:e.variableOccupancy?"variable":e.bookAsWhole?"whole":"individual",locked:a||null,held:t}})}paintWatchSeat(e){let t=this.els.rail?.querySelector('[data-ref="watchseat"]');if(!t)return;let s=e[e.length-1];if(this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,e.length>1){t.innerHTML='<div class="slm-selcard" aria-live="polite"></div>',lt(t.firstElementChild,this.selectionSummary(e,!0));return}if(!s){t.innerHTML=`<div class="slm-watchhint">${J("cursor","#3b82f6",28)}<span>${Ge()?"Tap any seat to read it, or search a seat or booking.":`Click any seat to read it, or press <kbd>${$t()}</kbd> and type a seat or booking.`}</span></div>`;return}let n=this.status.get(s.label)??"free",a=this.sectionByObject.get(s.rowId)??U.UNGROUPED_ID,o=this.sectionLabelById.get(a)??"Other seats",r=s.label.startsWith(`${o} `)?s.label.slice(o.length+1):s.label,[l,c]=r.includes("-")?[r.slice(0,r.lastIndexOf("-")),r.slice(r.lastIndexOf("-")+1)]:["",r],d=this.doc?.categories.find(p=>p.key===s.categoryKey),b=d?`${d.label}${typeof d.price=="number"?` \xB7 ${Ie(d.price,this.currency)}`:""}`:s.categoryKey,f=n==="blocked"?this.reservedBy.get(s.label):void 0,u=this.channels?.channelNameForLabel(s.label)??"Public sale",m=f?[["Status","Reserved"],["For",f.name],...f.by?[["Reserved by",f.by]]:[],["Until",f.releaseAt==null?"No end":xt(f.releaseAt)]]:n==="booked"?[["Status","Sold"],["Ticket type",b],["Booking","\u2026"],["Buyer","\u2026"],["Channel",u]]:n==="held"?[["Status","In a cart"],["Ticket type",b],["Where","\u2026"],["Cart","\u2026"]]:n==="blocked"?[["Status","Blocked"],["Reason","\u2026"],["Blocked by","\u2026"],["Back on sale","\u2026"]]:[["Status","Free"],["Ticket type",b],["Channel",u]],v=(p,g,y,L)=>`<button type="button" class="slm-btn ghost" data-watch="${p}">${Se(y,L,15)}${g}</button>`,$=f?v("reserve","Open in Reserve","bookmark","#c026d3"):n==="blocked"?v("unblock","Put back on sale","undo",St.free[1]):n==="free"?`${this.toolAvailable("block")?v("block","Block","ban","#d64545"):""}${this.toolAvailable("reserve")?v("reserve-seat","Reserve","bookmark","#c026d3"):""}`:"",[A,O]=St[f?"reserved":n]??St.free;t.innerHTML=`<div class="slm-watchcard${f?" reserved":""}">
1850
- <div class="slm-seat-heading">${J(A,O,30)}<span><h2>${w(o)} \xB7 ${w(r)}</h2>${l?`<small>Row ${w(l)}, seat ${w(c)}</small>`:""}</span>
1851
- <button type="button" class="slm-watchclose" data-watch="close" aria-label="Close the seat card">${Se("x","currentColor",15)}</button></div>
1852
- <dl>${m.map(([p,g])=>`<div><dt>${w(p)}</dt><dd>${w(g)}</dd></div>`).join("")}</dl>
1853
- <div class="slm-watchacts">${$}${v("history","Seat history","history","#64748b")}</div>
1881
+ ${At("catfoot")}`,this.categoryCanManage||this.withExtras(a=>{this.lockedTypes=this.alertOf(a.typesLocked(this.opts.organizationName)),this.mode==="categories"&&!this.categoryCanManage&&(this.panelAlert=this.lockedTypes,this.paintCategorySelection(this.getSelection()))});let n=a=>this.els.rail.querySelector(`[data-ref="${a}"]`);this.els.rail.querySelectorAll("[data-assign-category]").forEach(a=>{a.addEventListener("click",()=>{this.categoryChoice=a.dataset.assignCategory,this.paintCategorySelection(this.getSelection())})}),n("catfoot").querySelector("[data-foot-action]").addEventListener("click",()=>{if(this.categoryDone?.partial){this.categoryDone=null,this.panelAlert=null,this.clearSelection();return}this.categoryChoice&&this.setCategory(this.categoryChoice)}),n("catfoot").querySelector("[data-foot-secondary]").addEventListener("click",()=>{this.undoCategory()}),n("categoryreset").addEventListener("click",()=>{this.resetCategoriesToChart()}),t.wire(this.els.rail),this.paintCategorySelection(this.getSelection()),this.loadCategoryDifferences()}async loadCategoryDifferences(){let e=this.els.rail;if(!e||this.closed)return;let t=e.querySelector('[data-ref="categoryreset"]'),s=e.querySelector('[data-ref="categoryresetnote"]');if(!(!t||!s))try{let n=await this.withAuthRetry(()=>this.api.categoryDifferences(this.key));if(!t.isConnected)return;this.categoryDifferences=n.differing,this.paintCategoryReset()}catch(n){if(!t.isConnected)return;s.textContent="Could not check the chart\u2019s defaults. Reset is unavailable until it can.",this.opts.onError?.(n)}}paintCategoryReset(){let e=this.els.rail;if(!e)return;let t=e.querySelector('[data-ref="categoryreset"]'),s=e.querySelector('[data-ref="categoryresetnote"]');if(!t||!s)return;let n=this.categoryDifferences;n!=null&&(t.disabled=n===0,t.textContent=n?`Reset to chart defaults \xB7 ${n.toLocaleString()} seat${n===1?"":"s"}`:"Reset to chart defaults",s.textContent=n?"Puts every seat this event moved back in its chart category. Held and booked seats keep the price they were sold at.":"Every seat sells under its chart category.")}async resetCategoriesToChart(){let e=this.els.rail.querySelector('[data-ref="categoryreset"]');e&&(e.disabled=!0,e.textContent="Resetting\u2026");try{let t=await this.withAuthRetry(()=>this.api.resetCategoriesToChart(this.key));t.changed&&await this.reloadEventChart(),this.categoryDifferences=0,this.clearSelection(),this.mode==="categories"&&this.paintRail(),this.paintCategoryReset(),this.done("resetCategories",t.labels,t.changed?`Put ${t.labels.length.toLocaleString()} seat${t.labels.length===1?"":"s"} back on the chart\u2019s categories.`:"Every seat already sells under its chart category.")}catch(t){this.paintCategoryReset(),this.toastErr("Couldn\u2019t reset those categories. Nothing changed."),this.opts.onError?.(t)}}paintCategorySelection(e){let t=this.els.rail,s=t?.querySelector('[data-ref="selcard"]'),n=t?.querySelector('[data-ref="catfoot"]');if(!s||!n)return;let a=this.categoryDone?.partial&&this.categoryDone.labels.length===e.length?this.categoryDone:null,o=this.selectionSummary(e,!0);pt(s,a?{...o,parts:[{label:`${a.labels.length.toLocaleString()} moved`,tone:"ok"}]}:o),this.paintAddBy(e.length);let r=t.querySelector('[data-ref="panelalert"]');r&&(r.innerHTML=this.panelAlert??"");let l=e.length,c=this.categoryTotals(),d=e.filter(k=>k.categoryKey===this.categoryChoice).length;t.querySelectorAll("[data-assign-category]").forEach(k=>{let A=k.dataset.assignCategory,B=A===this.categoryChoice;k.setAttribute("aria-checked",String(B)),k.classList.toggle("on",B),k.disabled=this.categoryBusy,k.classList.toggle("locked",!this.categoryCanManage);let O=l>0&&o.types.length===1&&o.types[0].count!=null&&e[0].categoryKey===A,I=k.querySelector("[data-cat-current]");if(I){let u=c.get(A)??0;I.textContent=O?" \xB7 now":` \xB7 ${u.toLocaleString()}`,I.setAttribute("aria-label",O?"all selected seats are here now":pe(u))}});let g=this.doc?.categories.find(k=>k.key===this.categoryChoice)?.label??this.categoryChoice??"",b=l-d,m=o.parts.filter(k=>k.tone==="muted"||k.tone==="warn").map(k=>k.label),p=this.categoryDone&&(this.categoryDone.partial||this.categoryDone.until>Date.now())?this.categoryDone:null;t.classList.toggle("slm-settled",!!p?.partial);let f=t.querySelector('[data-ref="categoryreset"]');f&&!this.categoryCanManage&&(f.disabled=!0),Qe(n,this.categoryBusy?{label:this.categoryUndoing?"Undoing\u2026":`Moving ${pe(b)}\u2026`,busy:!0,note:"Buyers see the new price as soon as this finishes."}:p?.partial?{label:"Done",secondary:`Undo the ${p.labels.length.toLocaleString()}`,look:"settle"}:p?{label:`Done: ${pe(p.labels.length)} now ${p.labels.length===1?"sells":"sell"} as ${p.name}`,disabled:!0,note:"Changed just now",secondary:"Undo",look:"done"}:this.categoryCanManage?this.categoryFailed&&l?{label:"Try again",note:"Your selection is kept."}:l?this.categoryChoice?b?{label:`Move ${pe(b)} to ${g}`,note:this.selWhole?`${m.length?"Sold seats and seats in a cart keep their price. ":""}Blocked seats move too and stay blocked.`:m.length?`The ${m.join(" and ")} seats keep the price they were sold at.`:void 0}:{label:`Already ${g}`,disabled:!0,note:"Every selected seat already sells as this ticket type."}:{label:"Pick a ticket type",disabled:!0,note:`Choose where the ${l===1?"seat":`${l.toLocaleString()} seats`} should sell.`}:{label:"Select seats first",disabled:!0,note:"Pick seats on the map, then a ticket type."}:{label:l&&this.categoryChoice&&b?`Move ${pe(b)} to ${g}`:l?"Pick a ticket type":"Select seats first",disabled:!0,note:'Needs the "Manage ticket types" permission.'})}addByHtml(e){return`<details class="slm-addby" data-ref="addby" open><summary class="slm-eyebrow">Add seats by</summary>${e}</details>`}paintAddBy(e){let t=this.els.rail?.querySelector('[data-ref="addby"]');if(!t)return;e||(this.addByPinned=!1),t.dataset.wired||(t.dataset.wired="1",t.addEventListener("toggle",()=>{this.getSelection().length&&(this.addByPinned=t.open)}));let s=!e||this.addByPinned;t.open!==s&&(t.open=s)}categoryTotals(){if(this.categoryTotalsCache)return this.categoryTotalsCache;let e=new Map;for(let t of this.labelToSeat.values())e.set(t.categoryKey,(e.get(t.categoryKey)??0)+1);return this.categoryTotalsCache=e,e}selectionSummary(e,t=!1){let s={free:0,booked:0,held:0,blocked:0},n=new Map,a=new Map,o=this.rowLabels();for(let p of e){s[this.status.get(p.label)??"free"]+=1,a.set(p.categoryKey,(a.get(p.categoryKey)??0)+1);let f=this.sectionByObject.get(p.rowId)??G.UNGROUPED_ID,k=n.get(f)??{label:this.sectionLabelById.get(f)??"Other seats",rows:new Map},A=o.get(p.rowId);A&&k.rows.set(A.startsWith(`${k.label} `)?A.slice(k.label.length+1):A,!0),n.set(f,k)}let r=(p,f)=>p.localeCompare(f,void 0,{numeric:!0,sensitivity:"base"}),l=[];s.free&&l.push({label:`${s.free.toLocaleString()} free`,tone:"ok"}),s.booked&&l.push({label:`${s.booked.toLocaleString()} sold`,tone:"muted"}),s.held&&l.push({label:`${s.held.toLocaleString()} in a cart`,tone:"warn"}),s.blocked&&l.push({label:`${s.blocked.toLocaleString()} blocked`,tone:"danger"});let c=t&&this.savedApplied&&this.savedApplied.labels.size===e.length&&e.every(p=>this.savedApplied.labels.has(p.label))?this.savedApplied:null,d=c?c.sold+c.taken:0,g=c&&[s.booked?`${s.booked.toLocaleString()} of these ${s.booked===1?"was":"were"} sold since it was saved. They stay picked so you can see them; Block and Reserve skip them.`:"",d?`${d.toLocaleString()} of the ${(e.length+d+c.missing).toLocaleString()} ${c.taken?`${c.sold?"were sold or are":"are"} in a cart or blocked`:`${d===1?"was":"were"} sold`} since it was saved, so ${e.length.toLocaleString()} ${e.length===1?"is":"are"} picked.`:"",c.missing?`${c.missing.toLocaleString()} saved ${c.missing===1?"seat is":"seats are"} no longer on this chart${c.changed?` (it changed on ${c.changed})`:""}.${d?"":` The other ${e.length.toLocaleString()} are picked.`}`:""].filter(Boolean).join(" ")||null,b=t&&this.selJustSold.size?e.filter(p=>this.selJustSold.has(p.label)).length:0,m=b?`${b.toLocaleString()} ${b===1?"seat in your selection was":"seats in your selection were"} just sold.${this.mode==="categories"?` ${b===1?"It":"They"} will keep ${b===1?"its":"their"} price.`:""}`:null;return{count:e.length,where:c?`${c.name} \xB7 saved selection`:this.selWhole&&t&&n.size>1?`Whole venue \xB7 ${n.size.toLocaleString()} sections (${Rt().replace(/K$/,"A")})`:$n([...n.values()].map(p=>({label:p.label,rows:[...p.rows.keys()].sort(r)}))),stale:[m,g,t&&this.selLeft].filter(Boolean).join(" ")||null,canSave:t&&this.canBlock(),canSimilar:t&&e.length>0&&this.isChoosingTool(),canUndo:this.selBack.length>0,saved:t?this.savedCount:null,parts:l,types:a.size>3?[{label:`${a.size} ticket types`,color:"#8b5cf6",count:null}]:[...a].map(([p,f])=>{let k=this.doc?.categories.find(A=>A.key===p);return{label:k?.label??p,color:this.typeColour(p,k?.color),count:f}})}}rowLabels(){if(this.rowLabelCache?.doc===this.doc)return this.rowLabelCache.labels;let e=new Map;for(let t of this.doc?.objects??[])t.type==="row"?e.set(t.id,t.segmentedRow?.displayLabel??t.displayLabel??t.label):t.type==="table"&&e.set(t.id,t.displayLabel??t.label);return this.rowLabelCache={doc:this.doc,labels:e},e}renderTablesRail(){let e=this.mountTask("table","#65a30d","Tables","Sell each table per chair, or as one whole-table booking.");this.loadExtras().then(t=>{this.closed||this.mode!=="tables"||!e.isConnected||(this.tablesPanel=t.mountTables({mount:e,...this.panelKit(),oldModel:this.inventoryModelVersion!==2,tables:()=>this.tableInfos(),save:async(s,n)=>{let a=await this.saveTableBooking(s,n);return a==="skipped"?"failed":a},show:s=>this.frameLabels([...this.labelToSeat.values()].filter(n=>n.rowId===s).map(n=>n.label))}))}).catch(t=>this.extrasFailed(e,t))}mountTask(e,t,s,n){let a=s==="Sections"?"sections":s==="Tables"?"tables":void 0;return this.els.rail.innerHTML=`${De({glyph:e,hue:t,title:s,badge:"This event only",purpose:n,how:a})}
1882
+ <div data-ref="panelalert"></div><div data-ref="taskmount"><div class="slm-empty" role="status">Loading\u2026</div></div>`,this.els.rail.querySelector('[data-ref="taskmount"]')}panelKit(){let e=this.els.rail;return{alert:t=>{let s=e.querySelector('[data-ref="panelalert"]');s&&(s.innerHTML=t??"")},alertHtml:Q,plate:Z}}extrasFailed(e,t){e.isConnected&&(e.innerHTML='<div class="slm-empty" role="alert">This tool could not load. Switch tools and back to try again.</div>'),this.opts.onError?.(t)}tableInfos(){return this.tables().map(e=>{let t=0,s=0,n=0;for(let[o,r]of this.labelToSeat){if(r.rowId!==e.id)continue;let l=this.status.get(o);l==="held"?t++:l==="booked"?s++:l==="blocked"&&n++}let a=[s&&`${s} booked`,n&&`${n} blocked`].filter(Boolean).join(" \xB7 ");return{id:e.id,label:e.displayLabel??e.label,chairs:e.seatCount,mode:e.variableOccupancy?"variable":e.bookAsWhole?"whole":"individual",locked:a||null,held:t}})}captioned(e,t){return t.caption?this.blockCaptions.set(e,t):this.blockCaptions.delete(e),t.caption&&this.captionsOn?{...t,stateWord:null}:t}paintWatchSeat(e){let t=this.els.rail?.querySelector('[data-ref="watchseat"]');if(!t)return;let s=e[e.length-1];if(this.seatHistoryPanel&&e.length<2&&s===this.historySeat&&!t.querySelector('[data-ref="seat-history"][hidden]'))return;if(this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,e.length>1){t.innerHTML='<div class="slm-selcard" aria-live="polite"></div>',pt(t.firstElementChild,this.selectionSummary(e,!0));return}if(!s){t.innerHTML=`<div class="slm-watchhint">${Z("cursor","#3b82f6",28)}<span>${Oe()?"Tap any seat to read it, or search a seat or booking.":`Click any seat to read it, or press ${ys()} and type a seat or booking.`}</span></div>`;return}let n=this.status.get(s.label)??"free",a=this.sectionByObject.get(s.rowId)??G.UNGROUPED_ID,o=this.sectionLabelById.get(a)??"Other seats",r=s.label.startsWith(`${o} `)?s.label.slice(o.length+1):s.label,[l,c]=r.includes("-")?[r.slice(0,r.lastIndexOf("-")),r.slice(r.lastIndexOf("-")+1)]:["",r],d=this.doc?.categories.find(y=>y.key===s.categoryKey),g=d?`${d.label}${typeof d.price=="number"?` \xB7 ${we(d.price,this.currency)}`:""}`:s.categoryKey,b=n==="blocked"?this.reservedBy.get(s.label):void 0,m=this.channels?.channelNameForLabel(s.label)??"Public sale",p=b?[["Status","Reserved"],["For",b.name],...b.by?[["Reserved by",b.by]]:[],["Until",b.releaseAt==null?"No end":ut(b.releaseAt)]]:n==="booked"?[["Status","Sold"],["Ticket type",g],["Booking","\u2026"],["Buyer","\u2026"],["Channel",m]]:n==="held"?[["Status","In a cart"],["Ticket type",g],["Where","\u2026"],["Cart","\u2026"]]:n==="blocked"?[["Status","Blocked"],["Reason","\u2026"],["Blocked by","\u2026"],["Back on sale","\u2026"]]:[["Status","Free"],["Ticket type",g],["Channel",m]],f=(y,h,v,C)=>`<button type="button" class="slm-btn ghost" data-watch="${y}">${be(v,C,15)}${h}</button>`,k=b?f("reserve","Open in Reserve","bookmark","#c026d3"):n==="blocked"?f("unblock","Put back on sale","undo",Je.free[1]):n==="free"?`${this.toolAvailable("block")?f("block","Block","ban","#d64545"):""}${this.toolAvailable("reserve")?f("reserve-seat","Reserve","bookmark","#c026d3"):""}`:"",[A,B]=Je[b?"reserved":n]??Je.free;t.innerHTML=`<div class="slm-watchcard${b?" reserved":""}">
1883
+ <div class="slm-seat-heading">${Z(A,B,30)}<span><h2>${S(o)} \xB7 ${S(r)}</h2>${l?`<small>Row ${S(l)}, seat ${S(c)}</small>`:""}</span>
1884
+ <button type="button" class="slm-watchclose" data-watch="close" aria-label="Close the seat card">${be("x","currentColor",15)}</button></div>
1885
+ <dl>${p.map(([y,h])=>`<div><dt>${S(y)}</dt><dd>${S(h)}</dd></div>`).join("")}</dl>
1886
+ <div class="slm-watchacts">${k}${f("history","Seat history","history","#64748b")}</div>
1854
1887
  <div data-ref="seat-history" hidden></div>
1855
- </div>`,n==="blocked"&&!f&&this.toolAvailable("block")&&this.loadBlockGroups().then(p=>{let g=p.find(L=>L.labels.includes(s.label)),y=t.querySelectorAll(".slm-watchcard dd");!y.length||!t.isConnected||(y[1].textContent=g?.reason??"No reason given",y[2].textContent=g&&[g.byYou?"you":g.byName,g.at?W(g.at,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):null].filter(Boolean).join(" \xB7 ")||"\u2014",y[3].textContent=g?.releaseAt?xt(g.releaseAt):"When you put it back")}).catch(()=>{});let B=(p,g)=>this.withAuthRetry(()=>this.api.seatStory(this.key,s.label,p,g)),k=null,h=p=>[...t.querySelectorAll(".slm-watchcard dl > div")].find(g=>g.querySelector("dt")?.textContent===p);n==="held"&&(k=B(),k.then(p=>{if(!t.isConnected||t.querySelector(".slm-watchcard h2")?.textContent!==`${o} \xB7 ${r}`)return;let g=p.cart;if(!g){h("Where")?.remove(),h("Cart")?.remove();return}let y=Math.max(0,Math.ceil((g.expiresAt-Date.now())/6e4));h("Status").querySelector("dd").textContent=`In a cart \xB7 ${y<=1?"under a minute":`${y} min`} left`,g.where?h("Where").querySelector("dd").textContent=g.where:h("Where")?.remove(),h("Cart").querySelector("dd").textContent=`${fe(g.seats)}`}).catch(()=>{h("Where")?.remove(),h("Cart")?.remove()})),n==="booked"&&(k=B(),k.then(p=>{if(!t.isConnected||t.querySelector(".slm-watchcard h2")?.textContent!==`${o} \xB7 ${r}`)return;let g=[...t.querySelectorAll(".slm-watchcard dl > div")],y=H=>g.find(F=>F.querySelector("dt")?.textContent===H),L=p.booking;if(L===void 0){y("Booking")?.remove(),y("Buyer")?.remove();return}let C=L?.order??null,x=y("Booking")?.querySelector("dd");x&&(x.textContent=L?.displayRef??C?.displayRef??L?.ref??"\u2014");let M=C?[C.buyerName,C.buyerEmailDomain].filter(Boolean).join(" \xB7 "):"";M?y("Buyer").querySelector("dd").textContent=M:y("Buyer")?.remove(),C&&this.opts.onOpenOrder&&!t.querySelector('[data-watch="order"]')&&(t.querySelector(".slm-watchacts")?.insertAdjacentHTML("afterbegin",`<button type="button" class="slm-btn ghost" data-watch="order">${Se("ticket","#8b5cf6",15)}Open order</button>`),t.querySelector('[data-watch="order"]').addEventListener("click",()=>this.opts.onOpenOrder({id:C.id,displayRef:C.displayRef})))}).catch(()=>{for(let p of t.querySelectorAll(".slm-watchcard dl > div")){let g=p.querySelector("dt")?.textContent;(g==="Booking"||g==="Buyer")&&(p.querySelector("dd").textContent="\u2014")}})),t.querySelectorAll("[data-watch]").forEach(p=>p.addEventListener("click",()=>{let g=p.dataset.watch;if(g==="history"){let y=t.querySelector('[data-ref="seat-history"]');y.hidden=!y.hidden,p.setAttribute("aria-expanded",String(!y.hidden)),!y.hidden&&!this.seatHistoryPanel&&this.loadExtras().then(async L=>{if(y.hidden||!y.isConnected||this.seatHistoryPanel)return;let C=k?await k.catch(()=>null):null;y.hidden||!y.isConnected||this.seatHistoryPanel||(this.seatHistoryPanel=L.mountSeatHistory({mount:y,free:n==="free",fetchPage:B,first:C,openOrder:this.opts.onOpenOrder?x=>this.opts.onOpenOrder(x):null}))}).catch(L=>this.extrasFailed(y,L))}else g==="close"?this.clearSelection():g==="unblock"?this.unblock([s.label]):g==="reserve"?this.setMode("reserve"):(this.setMode(g==="block"?"block":"reserve"),this.selectByLabels([s.label]))}))}async refreshAvailability(){try{let e=await this.withAuthRetry(()=>this.api.availability(this.key));this.availabilityRules=e.rules??{},this.effectiveClosed=new Set(ks(this.availabilityRules)),this.sectionsPanel?.update(),this.applySectionCanvasTreatment()}catch(e){this.opts.onError?.(e)}}async withAuthRetry(e){try{return await e()}catch(t){if(t instanceof G&&t.status===401&&this.opts.onTokenRefresh&&!this.tokenRefreshInFlight){if(await this.rotateToken(),this.sessionEnded)throw t;return e()}throw t instanceof G&&t.status===401&&!this.opts.onTokenRefresh&&this.endSession(),t}}updateEffectiveAvailability(e,t){let s=!1;if(Array.isArray(e)){let n=new Set(e.filter(a=>typeof a=="string"));for(let a of this.effectiveHidden){let o=this.availabilityRules[a];n.has(a)||o?.mode!=="timed"&&o?.mode!=="threshold"||(delete this.availabilityRules[a],this.sectionsPanel?.fired(a,o.mode,Date.now()))}this.effectiveHidden=n,s=!0}Array.isArray(t)&&(this.effectiveClosed=new Set(t.filter(n=>typeof n=="string")),s=!0),s&&(this.sectionsPanel?.update(),this.applySectionCanvasTreatment())}applySectionCanvasTreatment(){this.renderer&&(this.refreshBlockPaint(),this.mode==="sections"?(this.renderer.setDimmedSections([...this.effectiveHidden]),this.renderer.setClosedSections([...this.effectiveClosed])):this.mode==="filterSections"&&this.filteredSectionLabel?this.applyFilteredSectionCanvas():(this.renderer.setDimmedSections(null),this.renderer.setClosedSections(null)))}sectionRowsInput(){return{sectionsBase:this.sectionsBase,doc:this.doc,availabilityRules:this.availabilityRules,effectiveHidden:this.effectiveHidden,effectiveClosed:this.effectiveClosed}}renderSectionsRail(){let e=this.mountTask("layers","#0ea5a5","Sections","Decide which sections buyers can see and buy, now or at a set time.");this.applySectionCanvasTreatment(),this.loadExtras().then(t=>{if(this.closed||this.mode!=="sections"||!e.isConnected)return;let s=this.opts.capabilities;this.sectionsPanel=t.mountSections({mount:e,...this.panelKit(),readOnly:!!s&&!s.includes("event:block"),organizationName:this.opts.organizationName,rows:()=>ws(this.sectionRowsInput()).rows,soldNow:()=>this.soldShareRest(),heldIn:n=>n.reduce((a,o)=>a+(this.status.get(o)==="held"?1:0),0),change:(n,a)=>this.changeSection(n,a),restore:async n=>{let a=n,o=await this.persistAvailability({...this.availabilityRules,...a});return o&&this.recordChange({kind:"section",restores:!0,sectionId:Object.keys(a)[0],labels:[]}),o},frame:n=>{let a=this.filterableSections().find(r=>r.id===n),o=a?[a]:this.filterableSections().filter(r=>r.zone===n);this.frameSections(o)}})}).catch(t=>this.extrasFailed(e,t))}async changeSection(e,t){let s=ws(this.sectionRowsInput()).rows.find(b=>b.id===e),n=s?.seatLabels??this.availabilityRules[e]?.labels??[],a={[e]:this.availabilityRules[e]??null},o={...this.availabilityRules},r=nn(t.mode,n,this.availabilityRules[e]);if(r&&t.revealAt!=null&&(r.revealAt=t.revealAt),r&&t.thresholdPct!=null&&(r.thresholdPct=t.thresholdPct),r?o[e]=r:delete o[e],s?.kind==="zone"&&this.sectionsBase)for(let b of this.sectionsBase.sections)b.zone===e&&o[b.id]&&(a[b.id]=o[b.id],delete o[b.id]);if(!await this.persistAvailability(o))return null;let l=hs(a[e]),c={open:"Opened",closed:"Closed",hidden:"Hid",timed:"Scheduled",threshold:"Set a threshold on"}[t.mode],d={open:"open again",closed:"closed again",hidden:"hidden again",timed:"on its schedule again",threshold:"waiting on its threshold again"}[l];return this.recordChange({kind:"section",sectionId:e,sectionLabel:s?.label??e,labels:n,before:a,after:this.availabilityRules[e]??null,verb:c,again:d}),a}soldShareRest(){let e=new Set;for(let n of Object.values(this.availabilityRules))for(let a of n.labels??[])e.add(a);let t=0,s=0;for(let n of this.labelToSeat.keys())e.has(n)||(t++,this.status.get(n)==="booked"&&s++);return t?Math.floor(s*100/t):0}async persistAvailability(e){let t=Object.fromEntries(Object.entries(e).filter(n=>!!n[1])),s=this.availabilityRules;this.availabilityRules=t;try{let n=await this.withAuthRetry(()=>this.api.setAvailability(this.key,t));return this.availabilityRules=n.rules,this.effectiveHidden=new Set(n.hidden),this.effectiveClosed=new Set(ks(n.rules)),this.applySectionCanvasTreatment(),!0}catch(n){return this.availabilityRules=s,this.opts.onError?.(n),!1}finally{this.sectionsPanel?.update()}}paintFeed(){this.activityPanel?.update(this.feed)}renderBlockRail(){let e=this.toolChooser();this.els.rail.innerHTML=`
1856
- ${Be({glyph:"ban",hue:"#d64545",title:"Block",purpose:"Take seats off sale, for a camera, a broken seat or a sight-line. Sold seats and seats in a cart are never touched.",how:"block"})}
1857
- <div class="slm-monitor-tabs" role="tablist" aria-label="Blocking tools"><button role="tab" data-block-tab="edit" aria-selected="${!this.blockBrowse}">Block seats</button><button role="tab" data-block-tab="browse" aria-selected="${this.blockBrowse}" data-ref="blockedtab">Find blocked</button></div>
1888
+ </div>`,n==="blocked"&&!b&&this.toolAvailable("block")&&this.loadBlockGroups().then(y=>{let h=y.find(C=>C.labels.includes(s.label)),v=t.querySelectorAll(".slm-watchcard dd");!v.length||!t.isConnected||(v[1].textContent=h?.reason??"No reason given",v[2].textContent=h&&[h.byYou?"you":h.byName,h.at?K(h.at,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):null].filter(Boolean).join(" \xB7 ")||"\u2014",v[3].textContent=h?.releaseAt?ut(h.releaseAt):"When you put it back")}).catch(()=>{});let O=(y,h)=>this.withAuthRetry(()=>this.api.seatStory(this.key,s.label,y,h)),I=null,u=()=>{let y=s.label+n,h=this.cardRead;if(h?.[0]===y&&Date.now()-h[1]<5e3)return h[2];let v=O();return v.catch(()=>{this.cardRead?.[2]===v&&(this.cardRead=void 0)}),(this.cardRead=[y,Date.now(),v])[2]},x=y=>[...t.querySelectorAll(".slm-watchcard dl > div")].find(h=>h.querySelector("dt")?.textContent===y);n==="held"&&(I=u(),I.then(y=>{if(!t.isConnected||t.querySelector(".slm-watchcard h2")?.textContent!==`${o} \xB7 ${r}`)return;let h=y.cart;if(!h){x("Where")?.remove(),x("Cart")?.remove();return}let v=Math.max(0,Math.ceil((h.expiresAt-Date.now())/6e4));x("Status").querySelector("dd").textContent=`In a cart \xB7 ${v<=1?"under a minute":`${v} min`} left`,h.where?x("Where").querySelector("dd").textContent=h.where:x("Where")?.remove(),x("Cart").querySelector("dd").textContent=`${pe(h.seats)}`}).catch(()=>{x("Where")?.remove(),x("Cart")?.remove()})),n==="booked"&&(I=u(),I.then(y=>{if(!t.isConnected||t.querySelector(".slm-watchcard h2")?.textContent!==`${o} \xB7 ${r}`)return;let h=[...t.querySelectorAll(".slm-watchcard dl > div")],v=R=>h.find(N=>N.querySelector("dt")?.textContent===R),C=y.booking;if(C===void 0){v("Booking")?.remove(),v("Buyer")?.remove();return}let E=C?.order??null,L=v("Booking")?.querySelector("dd");L&&(L.textContent=C?.displayRef??E?.displayRef??C?.ref??"\u2014");let M=E?[E.buyerName,E.buyerEmailDomain].filter(Boolean).join(" \xB7 "):"";M?v("Buyer").querySelector("dd").textContent=M:v("Buyer")?.remove(),E&&this.opts.onOpenOrder&&!t.querySelector('[data-watch="order"]')&&(t.querySelector(".slm-watchacts")?.insertAdjacentHTML("afterbegin",`<button type="button" class="slm-btn ghost" data-watch="order">${be("ticket","#8b5cf6",15)}Open order</button>`),t.querySelector('[data-watch="order"]').addEventListener("click",()=>this.opts.onOpenOrder({id:E.id,displayRef:E.displayRef})))}).catch(()=>{for(let y of t.querySelectorAll(".slm-watchcard dl > div")){let h=y.querySelector("dt")?.textContent;(h==="Booking"||h==="Buyer")&&(y.querySelector("dd").textContent="\u2014")}})),t.querySelectorAll("[data-watch]").forEach(y=>y.addEventListener("click",()=>{let h=y.dataset.watch;if(h==="history"){let v=t.querySelector('[data-ref="seat-history"]');v.hidden=!v.hidden,y.setAttribute("aria-expanded",String(!v.hidden)),!v.hidden&&!this.seatHistoryPanel&&this.loadExtras().then(C=>{v.hidden||!v.isConnected||this.seatHistoryPanel||(this.historySeat=s,this.seatHistoryPanel=C.mountSeatHistory({mount:v,free:n==="free",fetchPage:O,first:I,openOrder:this.opts.onOpenOrder?E=>this.opts.onOpenOrder(E):null}))}).catch(C=>this.extrasFailed(v,C))}else h==="close"?this.clearSelection():h==="unblock"?this.unblock([s.label]):h==="reserve"?this.setMode("reserve"):(this.setMode(h==="block"?"block":"reserve"),this.selectByLabels([s.label]))}))}async refreshAvailability(){try{let e=await this.withAuthRetry(()=>this.api.availability(this.key));this.availabilityRules=e.rules??{},this.effectiveClosed=new Set(Rs(this.availabilityRules)),this.sectionsPanel?.update(),this.applySectionCanvasTreatment()}catch(e){this.opts.onError?.(e)}}async withAuthRetry(e){try{return await e()}catch(t){if(t instanceof W&&t.status===401&&this.opts.onTokenRefresh&&!this.tokenRefreshInFlight){if(await this.rotateToken(),this.sessionEnded)throw t;return e()}throw t instanceof W&&t.status===401&&!this.opts.onTokenRefresh&&this.endSession(),t}}updateEffectiveAvailability(e,t){let s=!1;if(Array.isArray(e)){let n=new Set(e.filter(a=>typeof a=="string"));for(let a of this.effectiveHidden){let o=this.availabilityRules[a];n.has(a)||o?.mode!=="timed"&&o?.mode!=="threshold"||(delete this.availabilityRules[a],this.sectionsPanel?.fired(a,o.mode,Date.now()))}this.effectiveHidden=n,s=!0}Array.isArray(t)&&(this.effectiveClosed=new Set(t.filter(n=>typeof n=="string")),s=!0),s&&(this.sectionsPanel?.update(),this.applySectionCanvasTreatment())}applySectionCanvasTreatment(){this.renderer&&(this.refreshBlockPaint(),this.mode==="sections"?(this.renderer.setDimmedSections([...this.effectiveHidden]),this.renderer.setClosedSections([...this.effectiveClosed])):this.mode==="filterSections"&&this.filteredSectionLabel?this.applyFilteredSectionCanvas():(this.renderer.setDimmedSections(null),this.renderer.setClosedSections(null)))}sectionRowsInput(){return{sectionsBase:this.sectionsBase,doc:this.doc,availabilityRules:this.availabilityRules,effectiveHidden:this.effectiveHidden,effectiveClosed:this.effectiveClosed}}renderSectionsRail(){let e=this.mountTask("layers","#0ea5a5","Sections","Decide which sections buyers can see and buy, now or at a set time.");this.applySectionCanvasTreatment(),this.loadExtras().then(t=>{if(this.closed||this.mode!=="sections"||!e.isConnected)return;let s=this.opts.capabilities;this.sectionsPanel=t.mountSections({mount:e,...this.panelKit(),readOnly:!!s&&!s.includes("event:block"),organizationName:this.opts.organizationName,openDesigner:this.opts.onOpenDesigner,rows:()=>As(this.sectionRowsInput()).rows,soldNow:()=>this.soldShareRest(),heldIn:n=>n.reduce((a,o)=>a+(this.status.get(o)==="held"?1:0),0),change:(n,a)=>this.changeSection(n,a),restore:async n=>{let a=n,o=await this.persistAvailability({...this.availabilityRules,...a});return o&&this.recordChange({kind:"section",restores:!0,sectionId:Object.keys(a)[0],labels:[]}),o},frame:n=>{let a=this.filterableSections().find(r=>r.id===n),o=a?[a]:this.filterableSections().filter(r=>r.zone===n);this.frameSections(o)}})}).catch(t=>this.extrasFailed(e,t))}async changeSection(e,t){let s=As(this.sectionRowsInput()).rows.find(g=>g.id===e),n=s?.seatLabels??this.availabilityRules[e]?.labels??[],a={[e]:this.availabilityRules[e]??null},o={...this.availabilityRules},r=yn(t.mode,n,this.availabilityRules[e]);if(r&&t.revealAt!=null&&(r.revealAt=t.revealAt),r&&t.thresholdPct!=null&&(r.thresholdPct=t.thresholdPct),r?o[e]=r:delete o[e],s?.kind==="zone"&&this.sectionsBase)for(let g of this.sectionsBase.sections)g.zone===e&&o[g.id]&&(a[g.id]=o[g.id],delete o[g.id]);if(!await this.persistAvailability(o))return null;let l=fs(a[e]),c={open:"Opened",closed:"Closed",hidden:"Hid",timed:"Scheduled",threshold:"Set a threshold on"}[t.mode],d={open:"open again",closed:"closed again",hidden:"hidden again",timed:"on its schedule again",threshold:"waiting on its threshold again"}[l];return this.recordChange({kind:"section",sectionId:e,sectionLabel:s?.label??e,labels:n,before:a,after:this.availabilityRules[e]??null,verb:c,again:d}),a}soldShareRest(){let e=new Set;for(let n of Object.values(this.availabilityRules))for(let a of n.labels??[])e.add(a);let t=0,s=0;for(let n of this.labelToSeat.keys())e.has(n)||(t++,this.status.get(n)==="booked"&&s++);return t?Math.floor(s*100/t):0}async persistAvailability(e){let t=Object.fromEntries(Object.entries(e).filter(n=>!!n[1])),s=this.availabilityRules;this.availabilityRules=t;try{let n=await this.withAuthRetry(()=>this.api.setAvailability(this.key,t));return this.availabilityRules=n.rules,this.effectiveHidden=new Set(n.hidden),this.effectiveClosed=new Set(Rs(n.rules)),this.applySectionCanvasTreatment(),!0}catch(n){return this.availabilityRules=s,this.opts.onError?.(n),!1}finally{this.sectionsPanel?.update()}}paintFeed(){this.activityPanel?.update(this.feed)}renderBlockRail(){let e=this.toolChooser();this.els.rail.innerHTML=`
1889
+ ${De({glyph:"ban",hue:"#d64545",title:"Block",purpose:"Take seats off sale, for a camera, a broken seat or a sight-line. Sold seats and seats in a cart are never touched.",how:"block"})}
1890
+ <div class="slm-monitor-tabs seg" role="tablist" aria-label="Blocking tools"><button role="tab" data-block-tab="edit" aria-selected="${!this.blockBrowse}">Block seats</button><button role="tab" data-block-tab="browse" aria-selected="${this.blockBrowse}" data-ref="blockedtab">Find blocked</button></div>
1858
1891
  <div data-ref="panelalert"></div>
1859
- ${Lt()}
1892
+ ${Et()}
1860
1893
  <div data-block-editor ${this.blockBrowse?"hidden":""}>
1861
1894
  ${this.addByHtml(e.chipsHtml({saved:!0}))}
1862
1895
  <p class="slm-eyebrow slm-step" style="margin-top:14px"><span class="slm-stepnum">2</span>Block them</p>
@@ -1876,12 +1909,12 @@ Click to light them up \xB7 \u21E7 click to select them.`}),r.dataset.legend=o.k
1876
1909
  </div>
1877
1910
  </div>
1878
1911
  <div data-ref="findblocked" ${this.blockBrowse?"":"hidden"}><div class="slm-empty" role="status">Loading\u2026</div></div>
1879
- ${Tt("blockfoot")}
1880
- `,this.els.rail.querySelectorAll("[data-block-tab]").forEach(o=>o.addEventListener("click",()=>{this.blockBrowse=o.dataset.blockTab==="browse",this.renderBlockRail()}));let t=o=>this.els.rail.querySelector(`[data-ref="${o}"]`),s=t("blockfoot");this.findBlocked?.destroy(),this.findBlocked=null,this.els.rail.classList.toggle("slm-blk-listing",this.blockBrowse),this.blockBrowse&&this.mountFindBlocked(t("findblocked"),s),s.querySelector("[data-foot-action]").addEventListener("click",()=>{let o=t("blockreason")?.value.trim();if(!this.blockBrowse){if(this.blockDone?.partial){this.blockDone=null,this.panelAlert=null,this.paintSelBar(this.getSelection());return}this.selectionFree()?this.block(void 0,o?{reason:o}:{}):this.unblock()}}),s.querySelector("[data-foot-secondary]").addEventListener("click",()=>{if(this.blockBrowse)return;let o=this.blockDone&&this.blockDone.until>Date.now()?this.blockDone:null;o?(this.blockDone=null,this.panelAlert=null,this.unblock(o.labels)):this.unblock()}),e.wire(this.els.rail);let n=t("release"),a=()=>{if(this.blockEnd==="never")this.releaseAt=null;else if(this.blockEnd==="start")this.releaseAt=this.eventStartsAt&&this.eventStartsAt>Date.now()?this.eventStartsAt:null;else{let o=n.value?new Date(n.value).getTime():NaN;this.releaseAt=Number.isFinite(o)&&o>Date.now()?o:null}this.els.rail.querySelectorAll("[data-block-end]").forEach(o=>o.setAttribute("aria-pressed",String(o.dataset.blockEnd===this.blockEnd))),n.hidden=this.blockEnd!=="pick",t("releasenote").textContent=this.releaseAt?`Back on sale ${xt(this.releaseAt)}. The seats return by themselves.`:this.blockEnd==="pick"?"Pick a time in the future.":"Stays off sale until you put it back.",this.paintSelBar(this.getSelection())};this.els.rail.querySelectorAll("[data-block-end]").forEach(o=>o.addEventListener("click",()=>{this.blockEnd=o.dataset.blockEnd,a(),this.blockEnd==="pick"&&n.focus()})),n.addEventListener("change",a),a()}toggleLabels(e){if(!this.renderer)return;let t=e.filter(a=>this.labelToSeat.has(a)&&this.isBlockSelectable(a));if(!t.length)return;let s=new Set(this.selectionLabels());if(t.every(a=>s.has(a))){let a=t.map(o=>this.labelToId.get(o)).filter(o=>!!o);this.renderer.deselect(a)}else this.renderer.selectByLabels(t);this.syncSelection()}isReserveSelectable(e){return!this.isHostUnavailable(e)&&(this.status.get(e)??"free")==="free"}renderReserveRail(){let e=this.toolChooser();this.els.rail.innerHTML=`
1881
- ${Be({glyph:"bookmark",hue:"#c026d3",title:"Reserve",purpose:"Keep seats aside for guests, press or comps. Reserved seats leave sale until you release them or their time runs out.",how:"reserve"})}
1912
+ ${At("blockfoot")}
1913
+ `,this.els.rail.querySelectorAll("[data-block-tab]").forEach(o=>o.addEventListener("click",()=>{this.blockBrowse=o.dataset.blockTab==="browse",this.renderBlockRail()}));let t=o=>this.els.rail.querySelector(`[data-ref="${o}"]`),s=t("blockfoot");this.findBlocked?.destroy(),this.findBlocked=null,this.els.rail.classList.toggle("slm-blk-listing",this.blockBrowse),this.blockBrowse&&this.mountFindBlocked(t("findblocked"),s),s.querySelector("[data-foot-action]").addEventListener("click",()=>{let o=t("blockreason")?.value.trim();if(!this.blockBrowse){if(this.blockDone?.partial){this.blockDone=null,this.panelAlert=null,this.paintSelBar(this.getSelection());return}this.selectionFree()?this.block(void 0,o?{reason:o}:{}):this.unblock()}}),s.querySelector("[data-foot-secondary]").addEventListener("click",()=>{if(this.blockBrowse)return;let o=this.blockDone&&this.blockDone.until>Date.now()?this.blockDone:null;o?(this.blockDone=null,this.panelAlert=null,this.unblock(o.labels)):this.unblock()}),e.wire(this.els.rail);let n=t("release"),a=()=>{if(this.blockEnd==="never")this.releaseAt=null;else if(this.blockEnd==="start")this.releaseAt=this.eventStartsAt&&this.eventStartsAt>Date.now()?this.eventStartsAt:null;else{let o=n.value?new Date(n.value).getTime():NaN;this.releaseAt=Number.isFinite(o)&&o>Date.now()?o:null}this.els.rail.querySelectorAll("[data-block-end]").forEach(o=>o.setAttribute("aria-pressed",String(o.dataset.blockEnd===this.blockEnd))),n.hidden=this.blockEnd!=="pick",t("releasenote").textContent=this.releaseAt?`Back on sale ${ut(this.releaseAt)}. The seats return by themselves.`:this.blockEnd==="pick"?"Pick a time in the future.":"Stays off sale until you put it back.",this.paintSelBar(this.getSelection())};this.els.rail.querySelectorAll("[data-block-end]").forEach(o=>o.addEventListener("click",()=>{this.blockEnd=o.dataset.blockEnd,a(),this.blockEnd==="pick"&&n.focus()})),n.addEventListener("change",a),a()}toggleLabels(e){if(!this.renderer)return;let t=e.filter(a=>this.labelToSeat.has(a)&&this.isBlockSelectable(a));if(!t.length)return;let s=new Set(this.selectionLabels());if(t.every(a=>s.has(a))){let a=t.map(o=>this.labelToId.get(o)).filter(o=>!!o);this.renderer.deselect(a)}else this.renderer.selectByLabels(t);this.syncSelection()}isReserveSelectable(e){return!this.isHostUnavailable(e)&&(this.status.get(e)??"free")==="free"}renderReserveRail(){let e=this.toolChooser();this.els.rail.innerHTML=`
1914
+ ${De({glyph:"bookmark",hue:"#c026d3",title:"Reserve",purpose:"Keep seats aside for guests, press or comps. Reserved seats leave sale until you release them or their time runs out.",how:"reserve"})}
1882
1915
  <div data-ref="reservetabs"></div>
1883
1916
  <div data-ref="panelalert"></div>
1884
- ${Lt()}
1917
+ ${Et()}
1885
1918
  ${this.addByHtml(e.chipsHtml({saved:!0}))}
1886
1919
  <div data-ref="reservemount"><div class="slm-empty" role="status">Loading\u2026</div></div>
1887
- ${Tt("reservefoot")}`,e.wire(this.els.rail);let t=this.els.rail.querySelector('[data-ref="reservemount"]'),s=this.els.rail.querySelector('[data-ref="reservefoot"]'),n=this.els.rail;Ye(s,{label:"Select seats first",disabled:!0}),this.paintReserveSelection(this.getSelection()),this.loadExtras().then(a=>{this.closed||this.mode!=="reserve"||!t.isConnected||(this.reserve=a.mountReserve({rail:n,mount:t,foot:s,paintFoot:Ye,tabs:n.querySelector('[data-ref="reservetabs"]'),alert:o=>{let r=n.querySelector('[data-ref="panelalert"]');r&&(r.innerHTML=o??"")},alertHtml:X,selectedFree:()=>this.getSelection().filter(o=>this.isReserveSelectable(o.label)).map(o=>o.label),whereOf:o=>this.selectionSummary(o.flatMap(r=>this.labelToSeat.get(r)??[])).where,startsAt:this.eventStartsAt,request:(o,r)=>this.reserveRequest(o,r),show:o=>this.showLabels(o),select:o=>{this.selectByLabels(o)},deselect:o=>{this.renderer?.deselect(o.map(r=>this.labelToId.get(r)).filter(r=>!!r)),this.syncSelection()},clearSelection:()=>{this.renderer?.clearSelection(),this.syncSelection()},toast:(o,r)=>this.toast(o,r),changed:()=>{this.refreshReservations()}}))}).catch(a=>{t.isConnected&&(t.innerHTML='<div class="slm-empty" role="alert">Reservations could not load. Switch tools and back to try again.</div>'),this.opts.onError?.(a)})}async reserveRequest(e,t){let s=t?.method==="POST"&&(/^reservations\/[^/]+\/release$/.test(e)||e==="reservations/release-all"),n=new Map;if(s)for(let[o,r]of this.reservedBy){let l=n.get(r.id)??{name:r.name,releaseAt:r.releaseAt,labels:[]};l.labels.push(o),n.set(r.id,l)}let a=await this.withAuthRetry(()=>this.api.eventRequest(this.key,e,t));if(t?.method==="POST"&&e==="reservations"){let o=a.reservation;o&&this.recordChange({kind:"reserve",reservationId:o.id,name:o.name,labels:o.labels,releaseAt:o.releaseAt})}else if(s){let o=new Set(a.released??[]),r=e==="reservations/release-all"?null:decodeURIComponent(e.split("/")[1]);for(let[l,c]of n){if(r&&l!==r)continue;let d=c.labels.filter(b=>o.has(b));d.length&&this.recordChange({kind:"release",reservationId:l,name:c.name,releaseAt:c.releaseAt,labels:d})}}return a}async mountArrival(){try{let e=await this.loadExtras();if(this.closed)return;let t=this.opts;(t.focusSection||t.focusSeat||t.focusSeats?.length||t.focusCategory||t.arrivedFrom)&&this.arrival.push(e.mountArrival({mapLayer:this.root.querySelector(".slm-map"),plate:J,focusSeats:s=>{let n=s.flatMap(a=>(this.labelToSeat.has(a)?a:[...this.labelToSeat.keys()].find(o=>o.localeCompare(a,void 0,{sensitivity:"accent"})===0))??[]);return n.length?(this.showLabels(n),(this.mode==="view"||this.isChoosingTool())&&(this.clearSelection(),this.selectByLabels(n)),n):[]},focusCategory:s=>{let n=this.doc?.categories.find(a=>a.key===s||(a.label??"").localeCompare(s,void 0,{sensitivity:"accent"})===0);return n?(this.showLabels([...this.labelToSeat.values()].filter(a=>a.categoryKey===n.key).map(a=>a.label)),n.label??n.key):null},sections:()=>this.sectionOptions,stateOf:s=>{if(this.effectiveHidden.has(s))return{kind:"hidden"};let n=this.availabilityRules[s],a=hs(n);return a==="timed"?{kind:"timed",until:n?.revealAt??null}:a==="threshold"?{kind:"threshold",pct:n?.thresholdPct??null}:a==="closed"?{kind:"closed"}:{kind:"open"}},frame:s=>{let n=this.filterableSections().find(a=>a.id===s);n&&this.frameSections([n]),this.renderer?.flashSection(s,"#3b82f6")},openSections:this.toolAvailable("sections")?()=>this.setMode("sections"):null},{section:t.focusSection,seats:t.focusSeats?.length?t.focusSeats:t.focusSeat?[t.focusSeat]:void 0,category:t.focusCategory,from:t.arrivedFrom?.from,where:t.arrivedFrom?.where,why:t.arrivedFrom?.why,back:t.arrivedFrom?.back})),t.onOpenTrend&&t.kpis!==!1&&this.els.kpis&&this.arrival.push(e.mountTrendCards({kpis:this.els.kpis,card:s=>{if(!["booked-inventory","booked-pct","booked-value"].includes(s))return null;let n=this.buildTallies(),a=this.controlRoomSnapshot?.velocity,o=a?.bySection.reduce((f,u)=>f+u.netBooked,0)??0,r=a?.bySection.slice().sort((f,u)=>u.netBooked-f.netBooked)[0],l=r&&r.netBooked>0?this.sectionLabelById.get(r.sectionId)??null:null,c=a?.windowMinutes??15,d=s==="booked-value"&&n.bookedValueStatus==="current"?`${Ie(n.bookedValue,n.currency)} booked value`:`${n.booked.toLocaleString()} sold \xB7 ${n.capacityPct}%`,b=o>0?`+${o.toLocaleString()} in the last ${c} minutes${l?`, most in ${l}`:""}. The room shows where; Performance shows how it got here.`:`Nothing sold in the last ${c} minutes. Performance shows how it got here.`;return{title:d,line:b,sectionId:l?r.sectionId:void 0}},open:(s,n)=>t.onOpenTrend({kpi:s,...n?{sectionId:n}:{}})}))}catch(e){this.opts.onError?.(e)}}async openSimilar(e){try{let t=await this.loadExtras();if(this.closed||!e.isConnected)return;let s=this.rowLabels(),n=new Set(this.selectableStatuses());t.openSimilar({anchor:e,plate:J,seats:()=>[...this.labelToSeat.values()].map(a=>{let o=this.sectionByObject.get(a.rowId)??U.UNGROUPED_ID,r=this.sectionLabelById.get(o)??"Other seats",l=this.doc?.categories.find(b=>b.key===a.categoryKey),c=s.get(a.rowId)??"",d=a.label.startsWith(`${r} `)?a.label.slice(r.length+1):a.label;return{label:a.label,row:a.logicalRowId??a.rowId,rowLabel:c.startsWith(`${r} `)?c.slice(r.length+1):c,section:o,sectionLabel:r,type:a.categoryKey,typeLabel:l?.label??a.categoryKey,status:this.status.get(a.label)??"free",number:d.includes("-")?d.slice(d.lastIndexOf("-")+1):d,x:a.x,y:a.y}}),selected:()=>new Set(this.selectionLabels()),pickable:a=>n.has(Ne(a.status))&&!this.isHostUnavailable(a.label),view:()=>this.renderer?.getVisibleWorldRect?.()??null,add:a=>{this.selectByLabels(a)}})}catch(t){this.opts.onError?.(t)}}ensureSaved(){return this.saved?Promise.resolve(this.saved):this.loadExtras().then(e=>this.closed?null:(this.saved??=e.mountSaved({mapLayer:this.root.querySelector(".slm-map"),plate:J,request:(t,s)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,t,s)),canSave:this.canBlock(),picks:()=>this.isChoosingTool(),selection:()=>this.selectionLabels(),describe:t=>{let s=t.flatMap(o=>this.labelToSeat.get(o)??[]),n=this.selectionSummary(s),a=[...new Set(t.flatMap(o=>{let r=this.reservedBy.get(o)?.name,l=this.blockGroups?.groups.find(c=>c.labels.includes(o))?.reason;return[r,l].filter(c=>!!c)}))];return{where:n.where,line:[`${fe(s.length)}`,n.where.replace(" \xB7 ",", "),n.parts.map(o=>o.label).join(", ")].filter(Boolean).join(" \xB7 "),suggestions:[n.where,...a].filter((o,r,l)=>o&&l.indexOf(o)===r)}},apply:(t,s)=>this.applySaved(t,s),toast:(t,s)=>this.toast(t,s),changed:t=>{this.savedCount=t,this.getSelection().length||this.syncSelection()}}),this.saved))}applySaved(e,t){let s=e.filter(o=>this.labelToSeat.has(o)),n=s.length;if(this.isChoosingTool()){t.add||this.clearSelection();let o=new Set(this.selectionLabels());this.selectByLabels(s);let r=new Set(this.selectionLabels()),l=s.filter(d=>!r.has(d)&&!o.has(d));n=s.length-l.length;let c=l.filter(d=>this.status.get(d)==="booked").length;this.savedApplied=t.add?null:{name:t.name,labels:r,missing:e.length-s.length,sold:c,taken:l.length-c},this.syncSelection()}else this.showLabels(s);this.root?.querySelector(".slm-savedpill")?.remove();let a=n===e.length?`${fe(n)}`:`${n.toLocaleString()} of ${e.length.toLocaleString()} seats`;this.root?.querySelector(".slm-map")?.insertAdjacentHTML("beforeend",`<div class="slm-savedpill" role="status">${J("star","#d99a0b",20)}<span><b>${w(t.name)}</b> \xB7 saved selection \xB7 ${a}</span></div>`),this.isChoosingTool()||setTimeout(()=>this.root?.querySelector(".slm-savedpill")?.remove(),8e3)}recordChange(e){this.ensureChanges().then(t=>t?.record(e)).catch(t=>this.opts.onError?.(t))}ensureChanges(){return this.changes?Promise.resolve(this.changes):(this.changesLoading??=this.loadExtras().then(e=>{if(this.closed)return null;let t=(n,a)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,n,a)),s=async(n,a)=>{try{return await this.withAuthRetry(n),a?.(),!0}catch(o){return this.opts.onError?.(o),!1}};return this.changes=e.mountChanges({eventKey:this.key,startsAt:this.eventStartsAt,mapLayer:this.root.querySelector(".slm-map"),plate:J,whereOf:n=>this.selectionSummary(n.flatMap(a=>this.labelToSeat.get(a)??[])).where,seats:async()=>{let n=await this.withAuthRetry(()=>this.api.objects(this.key)),a=n.default??"free",o=new Map;for(let r of this.labelToSeat.keys())o.set(r,n.seats[r]??a);return o},reservations:async()=>{let n=await t("reservations");return this.closed||this.setReservations(n.reservations??[]),n.reservations??[]},rules:async()=>{let n=await this.withAuthRetry(()=>this.api.availability(this.key));return this.availabilityRules=n.rules??{},this.availabilityRules},block:(n,a,o)=>s(()=>this.api.block(this.key,n,{...a?{reason:a}:{},...o?{releaseAt:o}:{}}),()=>{this.setSeatsLocal(n,"blocked"),this.blockGroups=null}),unblock:n=>s(()=>this.api.unblock(this.key,n),()=>{this.setSeatsLocal(n,"free"),this.blockGroups=null}),reserve:(n,a,o)=>{for(let r of n)this.reserving.add(r);return s(()=>t("reservations",{method:"POST",body:{labels:n,name:a,releaseAt:o}}),()=>{this.refreshReservations()}).finally(()=>{for(let r of n)(this.reservedBy.has(r)||this.status.get(r)!=="blocked")&&this.reserving.delete(r)})},release:n=>s(()=>t(`reservations/${encodeURIComponent(n)}/release`,{method:"POST"}),()=>{this.refreshReservations()}),restoreRules:n=>this.persistAvailability({...this.availabilityRules,...n}),channelBack:async n=>(await this.ensureChannels(),this.channels?this.channels.sendBack(n):{moved:0,failed:!0}),show:n=>this.showLabels(n),openTask:n=>this.setMode(n==="types"?"categories":"tables"),changed:()=>{this.feedFilter==="you"&&this.paintFeedFilter()}}),this.changes}).finally(()=>{this.changesLoading=null}),this.changesLoading)}paintFeedFilter(){let e=this.els.rail,t=e?.querySelector('[data-ref="feedfilter"]');if(!e||!t||this.mode!=="view")return;let s=this.feedFilter,n={all:"All",sales:"Sales",carts:"Carts",you:"You"};t.innerHTML=`<b>${s==="you"?"Your changes":"Live activity"}</b><span role="group" aria-label="Show in the feed">${Object.keys(n).map(o=>`<button type="button" data-feed-filter="${o}" aria-pressed="${o===s}">${n[o]}</button>`).join("")}</span>`;let a=e.querySelector('[data-ref="yours"]');for(let o of["feed","alertfeed","nosales"]){let r=e.querySelector(`[data-ref="${o}"]`);r&&(r.hidden=s==="you")}a&&(a.hidden=s!=="you"),this.activityPanel?.setFilter(s==="sales"?["booked","cancelled"]:s==="carts"?["held","expired","released"]:null),s==="you"&&a&&(this.changes||(a.innerHTML='<div class="slm-empty" role="status">Loading\u2026</div>'),this.ensureChanges().then(o=>{o&&a.isConnected&&this.feedFilter==="you"&&o.paintList(a)}).catch(o=>{a.isConnected&&this.extrasFailed(a,o)}))}async mountAlerts(){if(!(this.alerts||this.closed||!this.els.bell))try{let e=await this.loadExtras();if(this.closed||this.alerts)return;let t=(s,n)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,s,n));this.alerts=e.mountAlerts({mapLayer:this.root.querySelector(".slm-map"),bellMount:this.els.bell,bannerMount:this.els.awaybanner,alertHtml:X,plate:J,sections:()=>this.sectionOptions,sectionCounts:s=>{let n=this.filterableSections().find(r=>r.id===s)?.seatLabels??[],a=0,o=0;for(let r of n){let l=this.status.get(r)??"free";l==="free"?a++:l==="booked"&&o++}return{total:n.length,free:a,booked:o}},reservations:()=>{let s=new Map;for(let[n,a]of this.reservedBy){let o=s.get(a.id)??{id:a.id,name:a.name,releaseAt:a.releaseAt,labels:[]};o.labels.push(n),s.set(a.id,o)}return[...s.values()]},where:s=>this.selectionSummary(s.flatMap(n=>this.labelToSeat.get(n)??[])).where,canManage:this.canBlock(),show:(s,n)=>{if(s.sectionId){let a=this.filterableSections().find(o=>o.id===s.sectionId);a&&this.frameSections([a]),this.renderer?.flashSection(s.sectionId,"#d99a0b")}else s.labels?.length&&this.showLabels(s.labels);this.showWhy(n)},extend:async(s,n)=>{let a=[...this.reservedBy.values()].find(o=>o.id===s)?.releaseAt;if(a==null)return!1;try{return await t(`reservations/${encodeURIComponent(s)}`,{method:"PATCH",body:{releaseAt:a+n}}),this.refreshReservations(),!0}catch{return!1}},release:async s=>{try{return await this.reserveRequest(`reservations/${encodeURIComponent(s)}/release`,{method:"POST"}),this.refreshReservations(),!0}catch{return!1}},reserveAgain:s=>{this.setMode("reserve"),this.selectByLabels(s)},ring:(s,n)=>this.renderer?.flashSection(s,n),feedSlot:()=>this.mode==="view"?this.els.rail?.querySelector('[data-ref="alertfeed"]')??null:null,store:e.eventAlertStore(this.key,t)})}catch(e){this.opts.onError?.(e)}}showWhy(e){let t=this.els.liveevent;t&&(t.innerHTML=`<span class="slm-liveeventdot" style="background:#e8782a"></span><span class="slm-liveeventcopy">${w(e)}</span>`,t.classList.add("on"),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.liveEventTimer=setTimeout(()=>{this.liveEventTimer=null,t.classList.remove("on"),t.innerHTML=""},4e3))}mountFindBlocked(e,t){let s=this.els.rail;this.loadExtras().then(n=>{this.closed||this.mode!=="block"||!this.blockBrowse||!e.isConnected||(this.findBlocked=n.mountFindBlocked({mount:e,foot:t,paintFoot:Ye,alertHtml:X,alert:a=>{let o=s.querySelector('[data-ref="panelalert"]');o&&(o.innerHTML=a??"")},request:a=>this.withAuthRetry(()=>this.api.eventRequest(this.key,a)),whereOf:a=>this.selectionSummary(a.flatMap(o=>this.labelToSeat.get(o)??[])).where,sections:this.sectionOptions,sectionOf:a=>{let o=this.labelToSeat.get(a);return o?this.sectionByObject.get(o.rowId)??U.UNGROUPED_ID:null},selectedBlocked:()=>this.getSelection().filter(a=>this.status.get(a.label)==="blocked"&&!this.reservedBy.has(a.label)).map(a=>a.label),show:a=>this.showLabels(a),select:a=>{this.renderer?.clearSelection(),this.selectByLabels(a)},unblock:async a=>(await this.unblock(a),a.every(o=>this.status.get(o)!=="blocked")),block:async(a,o,r)=>(await this.block(a,{...o?{reason:o}:{},...r?{releaseAt:r}:{}}),a.every(l=>this.status.get(l)==="blocked")),unblockAll:()=>this.unblockAll(),openReserve:()=>this.setMode("reserve")}))}).catch(n=>{e.isConnected&&(e.innerHTML='<div class="slm-empty" role="alert">Blocked seats could not load. Switch tabs and back to try again.</div>'),this.opts.onError?.(n)})}paintReserveSelection(e){let t=this.els.rail?.querySelector('[data-ref="selcard"]');t&&(lt(t,this.selectionSummary(e,!0)),this.paintAddBy(e.length),this.reserve?.paint())}isBlockSelectable(e){if(this.isHostUnavailable(e))return!1;let t=this.status.get(e)??"free";return t==="free"||t==="blocked"}paintSelBar(e){let t=this.els.rail,s=t?.querySelector('[data-ref="selcard"]'),n=t?.querySelector('[data-ref="blockfoot"]');if(!s||!n)return;lt(s,this.selectionSummary(e,!0)),this.paintAddBy(e.length);let a=t.querySelector('[data-ref="panelalert"]');a&&(!this.blockBrowse||this.panelAlert)&&(a.innerHTML=this.panelAlert??"");let o=e.filter(m=>(this.status.get(m.label)??"free")==="free").length,r=e.filter(m=>this.status.get(m.label)==="blocked").length,l=fe,c=t.querySelector('[data-ref="blockedtab"]'),{blocked:d}=this.buildTallies(),b=d-this.reservedTally(d);if(c&&(c.textContent=b>0?`Find blocked \xB7 ${b.toLocaleString()}`:"Find blocked"),this.blockBrowse){this.findBlocked?.paint();return}let f=this.blockDone&&(this.blockDone.partial||this.blockDone.until>Date.now())?this.blockDone:null,u=this.releaseAt?xt(this.releaseAt):null;Ye(n,this.blockBusy?{label:`Blocking ${l(this.getSelection().length)}\u2026`,busy:!0,note:"Buyers already cannot pick these seats."}:f?.partial&&!o?{label:"Done",secondary:`Undo the ${f.labels.length.toLocaleString()}`}:this.blockBrowse||!o&&r?{label:r?`Put ${l(r)} back on sale`:"Put back on sale",disabled:!r,note:r?"Buyers can pick them again right away.":"Select blocked seats in the list or on the map."}:o?this.blockFailedNow?{label:"Try again",danger:!0,note:"Your selection and reason are kept."}:{label:u?`Block ${l(o)} until ${u}`:`Block ${l(o)}`,danger:!0,secondary:r?`Put the ${r.toLocaleString()} blocked back on sale`:null,note:r?`The ${r.toLocaleString()} already blocked keep their reason.`:u?"Buyers can\u2019t pick them until then.":"Buyers can\u2019t pick them. Sold seats and seats in a cart are never blocked."}:{label:"Select seats first",disabled:!0,note:f?"Blocked just now":"Pick free seats on the map. Sold seats and seats in a cart are never blocked.",secondary:f?"Undo":null})}selectionFree(){return this.getSelection().filter(e=>(this.status.get(e.label)??"free")==="free").length}doneQuietly(e,t,s){try{this.done(e,t,s)}catch(n){this.opts.onError?.(n)}}done(e,t,s){if(!this.tablesPanel&&(this.mode!=="block"||!this.els.rail?.querySelector('[data-ref="blockfoot"]'))&&this.toastOk(s),t.length){let n=e==="block"?this.pushActivity(t,"blocked","blocked"):e==="unblock"||e==="unblockAll"?this.pushActivity(t,"unblocked","free"):e==="cancelBooking"?this.pushActivity(t,"cancelled","free"):null;n&&this.paintSpatialActivity(n)}e!=="setHoldTtl"&&this.refreshControlRoom().catch(n=>this.opts.onError?.(n)),this.opts.onActionComplete?.({action:e,labels:t,count:t.length})}toastOk(e){this.toast(e,"ok")}toastErr(e){this.toast(e,"err")}toast(e,t,s){let n=this.els.toast;if(n){if(n.textContent=e,n.className=`slm-toast on ${t}`,s){let a=document.createElement("button");a.type="button",a.textContent=s.label,a.addEventListener("click",()=>{n.className="slm-toast",s.run()}),n.append(" ",a)}this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{n.className="slm-toast"},s?8e3:3200)}}fail(e){this.opts.onError?.(e);let t=e instanceof G?e.status:0;this.showRoomCard(t===401||t===403?"access":t===404?"missing":"offline"),this.els.rail&&(this.els.rail.innerHTML="")}showRoomCard(e){let t=this.root;if(!t)return;t.querySelector('[data-ref="opening"]')?.remove(),t.querySelector('[data-ref="roomcard"]')?.remove(),t.insertAdjacentHTML("beforeend",kn(e,this.opts.organizationName)),t.querySelector('[data-ref="roomcard"]').querySelector("[data-roomcard-act]")?.addEventListener("click",()=>{e==="signedout"?this.retrySession():this.reopen()})}async reopen(){let e=this.root;!e||this.closed||(e.querySelector('[data-ref="roomcard"]')?.remove(),this.renderer?.destroy(),this.renderer=null,e.querySelector(".slm-map")?.insertAdjacentHTML("beforeend",bs()),this.els.rail&&(this.els.rail.innerHTML=gs()),await this.load())}};Ms();Yt();Rt();0&&(module.exports={ACCESS_LINK_DEFAULTS,ChannelsMode,ManageApi,ManageApiError,PUBLIC_CHANNEL_ID,PUBLIC_CHANNEL_NAME,SeatManager,accessIntentDescription,accessIntentLabel,accessLine,accessLinkBadge,accessLinkErrorCopy,accessLinkIsLive,accessLinkPolicyLines,bucketRows,bucketRowsHtml,dropReviewRows,intentForbidsCopy,intentSwitchBlockedCopy,isPublicChannelId,markerLetter,markerOf,mutationCount,needsMoveConfirmation,planAssignment,retryAfterCopy,selectionSources,stateBadge,suggestMarker});
1920
+ ${At("reservefoot")}`,e.wire(this.els.rail);let t=this.els.rail.querySelector('[data-ref="reservemount"]'),s=this.els.rail.querySelector('[data-ref="reservefoot"]'),n=this.els.rail;Qe(s,{label:"Select seats first",disabled:!0}),this.paintReserveSelection(this.getSelection()),this.loadExtras().then(a=>{this.closed||this.mode!=="reserve"||!t.isConnected||(this.reserve=a.mountReserve({rail:n,mount:t,foot:s,paintFoot:Qe,tabs:n.querySelector('[data-ref="reservetabs"]'),alert:o=>{let r=n.querySelector('[data-ref="panelalert"]');r&&(r.innerHTML=o??"")},alertHtml:Q,selectedFree:()=>this.getSelection().filter(o=>this.isReserveSelectable(o.label)).map(o=>o.label),whereOf:o=>this.selectionSummary(o.flatMap(r=>this.labelToSeat.get(r)??[])).where,startsAt:this.eventStartsAt,request:(o,r)=>this.reserveRequest(o,r),show:o=>this.showLabels(o),select:o=>{this.selectByLabels(o)},deselect:o=>{this.renderer?.deselect(o.map(r=>this.labelToId.get(r)).filter(r=>!!r)),this.syncSelection(),this.selLeft=`${He(o)} left your selection.`,this.syncSelection()},clearSelection:()=>{this.renderer?.clearSelection(),this.syncSelection()},toast:(o,r)=>this.toast(o,r),changed:()=>{this.refreshReservations()}}))}).catch(a=>{t.isConnected&&(t.innerHTML='<div class="slm-empty" role="alert">Reservations could not load. Switch tools and back to try again.</div>'),this.opts.onError?.(a)})}async reserveRequest(e,t){let s=t?.method==="POST"&&(/^reservations\/[^/]+\/release$/.test(e)||e==="reservations/release-all"),n=new Map;if(s)for(let[o,r]of this.reservedBy){let l=n.get(r.id)??{name:r.name,releaseAt:r.releaseAt,labels:[]};l.labels.push(o),n.set(r.id,l)}let a=await this.withAuthRetry(()=>this.api.eventRequest(this.key,e,t));if(t?.method==="POST"&&e==="reservations"){let o=a.reservation;o&&this.recordChange({kind:"reserve",reservationId:o.id,name:o.name,labels:o.labels,releaseAt:o.releaseAt})}else if(s){let o=new Set(a.released??[]),r=e==="reservations/release-all"?null:decodeURIComponent(e.split("/")[1]);for(let[l,c]of n){if(r&&l!==r)continue;let d=c.labels.filter(g=>o.has(g));d.length&&this.recordChange({kind:"release",reservationId:l,name:c.name,releaseAt:c.releaseAt,labels:d})}}return a}async mountArrival(){try{let e=await this.loadExtras();if(this.closed)return;let t=this.opts;(t.focusSection||t.focusSeat||t.focusSeats?.length||t.focusCategory||t.arrivedFrom)&&this.arrival.push(e.mountArrival({mapLayer:this.root.querySelector(".slm-map"),plate:Z,focusSeats:s=>{let n=s.flatMap(a=>(this.labelToSeat.has(a)?a:[...this.labelToSeat.keys()].find(o=>o.localeCompare(a,void 0,{sensitivity:"accent"})===0))??[]);return n.length?(this.showLabels(n),(this.mode==="view"||this.isChoosingTool())&&(this.clearSelection(),this.selectByLabels(n)),n):[]},focusCategory:s=>{let n=this.doc?.categories.find(a=>a.key===s||(a.label??"").localeCompare(s,void 0,{sensitivity:"accent"})===0);return n?(this.showLabels([...this.labelToSeat.values()].filter(a=>a.categoryKey===n.key).map(a=>a.label)),n.label??n.key):null},sections:()=>this.sectionOptions,stateOf:s=>{if(this.effectiveHidden.has(s))return{kind:"hidden"};let n=this.availabilityRules[s],a=fs(n);return a==="timed"?{kind:"timed",until:n?.revealAt??null}:a==="threshold"?{kind:"threshold",pct:n?.thresholdPct??null}:a==="closed"?{kind:"closed"}:{kind:"open"}},frame:s=>{let n=this.filterableSections().find(a=>a.id===s);n&&this.frameSections([n]),this.renderer?.flashSection(s,"#3b82f6")},openSections:this.toolAvailable("sections")?()=>this.setMode("sections"):null},{section:t.focusSection,seats:t.focusSeats?.length?t.focusSeats:t.focusSeat?[t.focusSeat]:void 0,category:t.focusCategory,from:t.arrivedFrom?.from,where:t.arrivedFrom?.where,why:t.arrivedFrom?.why,back:t.arrivedFrom?.back})),t.onOpenTrend&&t.kpis!==!1&&this.els.kpis&&this.arrival.push(e.mountTrendCards({kpis:this.els.kpis,card:s=>{if(!["booked-inventory","booked-pct","booked-value"].includes(s))return null;let n=this.buildTallies(),a=this.controlRoomSnapshot?.velocity,o=a?.bySection.reduce((b,m)=>b+m.netBooked,0)??0,r=a?.bySection.slice().sort((b,m)=>m.netBooked-b.netBooked)[0],l=r&&r.netBooked>0?this.sectionLabelById.get(r.sectionId)??null:null,c=a?.windowMinutes??15,d=s==="booked-value"&&n.bookedValueStatus==="current"?`${we(n.bookedValue,n.currency)} booked value`:`${n.booked.toLocaleString()} sold \xB7 ${n.capacityPct}%`,g=o>0?`+${o.toLocaleString()} in the last ${c} minutes${l?`, most in ${l}`:""}. The room shows where; Performance shows how it got here.`:`Nothing sold in the last ${c} minutes. Performance shows how it got here.`;return{title:d,line:g,sectionId:l?r.sectionId:void 0}},open:(s,n)=>t.onOpenTrend({kpi:s,...n?{sectionId:n}:{}})}))}catch(e){this.opts.onError?.(e)}}async openSimilar(e){try{let t=await this.loadExtras();if(this.closed||!e.isConnected)return;let s=this.rowLabels(),n=new Set(this.selectableStatuses());t.openSimilar({anchor:e,plate:Z,seats:()=>[...this.labelToSeat.values()].map(a=>{let o=this.sectionByObject.get(a.rowId)??G.UNGROUPED_ID,r=this.sectionLabelById.get(o)??"Other seats",l=this.doc?.categories.find(g=>g.key===a.categoryKey),c=s.get(a.rowId)??"",d=a.label.startsWith(`${r} `)?a.label.slice(r.length+1):a.label;return{label:a.label,row:a.logicalRowId??a.rowId,rowLabel:c.startsWith(`${r} `)?c.slice(r.length+1):c,section:o,sectionLabel:r,type:a.categoryKey,typeLabel:l?.label??a.categoryKey,status:this.status.get(a.label)??"free",number:d.includes("-")?d.slice(d.lastIndexOf("-")+1):d,x:a.x,y:a.y}}),selected:()=>new Set(this.selectionLabels()),pickable:a=>n.has(je(a.status))&&!this.isHostUnavailable(a.label),view:()=>this.renderer?.getVisibleWorldRect?.()??null,add:a=>{this.selectByLabels(a)}})}catch(t){this.opts.onError?.(t)}}ensureSaved(){return this.saved?Promise.resolve(this.saved):this.loadExtras().then(e=>this.closed?null:(this.saved??=e.mountSaved({mapLayer:this.root.querySelector(".slm-map"),plate:Z,request:(t,s)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,t,s)),canSave:this.canBlock(),picks:()=>this.isChoosingTool(),selection:()=>this.selectionLabels(),describe:t=>{let s=t.flatMap(r=>this.labelToSeat.get(r)??[]),n=this.selectionSummary(s),a=[...new Set(t.flatMap(r=>{let l=this.reservedBy.get(r)?.name,c=this.blockGroups?.groups.find(d=>d.labels.includes(r))?.reason;return[l,c].filter(d=>!!d)}))],o=/^\d+ sections/.test(n.where)&&n.types[0]?.count!=null?n.types.map(r=>r.label).join(", ").replace(/, ([^,]*)$/," and $1"):n.where;return{where:o,line:[`${pe(s.length)}`,o.replace(" \xB7 ",", "),n.parts.map(r=>r.label).join(", ")].filter(Boolean).join(" \xB7 "),suggestions:[o,...a].filter((r,l,c)=>r&&c.indexOf(r)===l)}},apply:(t,s)=>this.applySaved(t,s),toast:(t,s)=>this.toast(t,s),changed:t=>{this.savedCount=t,this.getSelection().length||this.syncSelection()},chart:()=>({doc:this.doc,rowOf:t=>this.labelToSeat.get(t)?.rowId,sectionOfRow:t=>this.sectionByObject.get(t)})}),this.saved))}applySaved(e,t){let s=e.filter(o=>this.labelToSeat.has(o)),n=s.length;if(this.isChoosingTool()){t.add||this.clearSelection();let o=new Set(this.selectionLabels());this.selectByLabels(s);let r=new Set(this.selectionLabels()),l=s.filter(d=>!r.has(d)&&!o.has(d));n=s.length-l.length;let c=l.filter(d=>this.status.get(d)==="booked").length;this.savedApplied=t.add?null:{name:t.name,labels:r,missing:e.length-s.length,sold:c,taken:l.length-c,changed:t.changed},this.syncSelection()}else this.showLabels(s);this.root?.querySelector(".slm-savedpill")?.remove();let a=n===e.length?`${pe(n)}`:`${n.toLocaleString()} of ${e.length.toLocaleString()} seats`;this.root?.querySelector(".slm-map")?.insertAdjacentHTML("beforeend",`<div class="slm-savedpill" role="status">${Z("star","#d99a0b",20)}<span><b>${S(t.name)}</b> \xB7 saved selection \xB7 ${a}</span></div>`),this.isChoosingTool()||setTimeout(()=>this.root?.querySelector(".slm-savedpill")?.remove(),8e3)}recordChange(e){this.ensureChanges().then(t=>t?.record(e)).catch(t=>this.opts.onError?.(t))}ensureChanges(){return this.changes?Promise.resolve(this.changes):(this.changesLoading??=this.loadExtras().then(e=>{if(this.closed)return null;let t=(n,a)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,n,a)),s=async(n,a)=>{try{return await this.withAuthRetry(n),a?.(),!0}catch(o){return this.opts.onError?.(o),!1}};return this.changes=e.mountChanges({eventKey:this.key,startsAt:this.eventStartsAt,mapLayer:this.root.querySelector(".slm-map"),plate:Z,whereOf:n=>this.selectionSummary(n.flatMap(a=>this.labelToSeat.get(a)??[])).where,seats:async()=>{let n=await this.withAuthRetry(()=>this.api.objects(this.key)),a=n.default??"free",o=new Map;for(let r of this.labelToSeat.keys())o.set(r,n.seats[r]??a);return o},reservations:async()=>{let n=await t("reservations");return this.closed||this.setReservations(n.reservations??[]),n.reservations??[]},rules:async()=>{let n=await this.withAuthRetry(()=>this.api.availability(this.key));return this.availabilityRules=n.rules??{},this.availabilityRules},block:(n,a,o)=>s(()=>this.api.block(this.key,n,{...a?{reason:a}:{},...o?{releaseAt:o}:{}}),()=>{this.setSeatsLocal(n,"blocked"),this.blockGroups=null}),unblock:n=>s(()=>this.api.unblock(this.key,n),()=>{this.setSeatsLocal(n,"free"),this.blockGroups=null}),reserve:(n,a,o)=>{for(let r of n)this.reserving.add(r);return s(()=>t("reservations",{method:"POST",body:{labels:n,name:a,releaseAt:o}}),()=>{this.refreshReservations()}).finally(()=>{for(let r of n)(this.reservedBy.has(r)||this.status.get(r)!=="blocked")&&this.reserving.delete(r)})},release:n=>s(()=>t(`reservations/${encodeURIComponent(n)}/release`,{method:"POST"}),()=>{this.refreshReservations()}),restoreRules:n=>this.persistAvailability({...this.availabilityRules,...n}),channelBack:async n=>(await this.ensureChannels(),this.channels?this.channels.sendBack(n):{moved:0,failed:!0}),show:n=>this.showLabels(n),openTask:n=>this.setMode(n==="types"?"categories":"tables"),changed:()=>{this.feedFilter==="you"&&this.paintFeedFilter()}}),this.changes}).finally(()=>{this.changesLoading=null}),this.changesLoading)}paintFeedFilter(){let e=this.els.rail,t=e?.querySelector('[data-ref="feedfilter"]');if(!e||!t||this.mode!=="view")return;let s=this.feedFilter,n={all:"All",sales:"Sales",carts:"Carts",you:"You"};t.innerHTML=`<b>${s==="you"?"Your changes":"Live activity"}</b><span role="group" aria-label="Show in the feed">${Object.keys(n).map(o=>`<button type="button" data-feed-filter="${o}" aria-pressed="${o===s}">${n[o]}</button>`).join("")}</span>`;let a=e.querySelector('[data-ref="yours"]');for(let o of["feed","alertfeed","nosales"]){let r=e.querySelector(`[data-ref="${o}"]`);r&&(r.hidden=s==="you")}a&&(a.hidden=s!=="you"),this.activityPanel?.setFilter(s==="sales"?["booked","cancelled"]:s==="carts"?["held","expired","released"]:null),s==="you"&&a&&(this.changes||(a.innerHTML='<div class="slm-empty" role="status">Loading\u2026</div>'),this.ensureChanges().then(o=>{o&&a.isConnected&&this.feedFilter==="you"&&o.paintList(a)}).catch(o=>{a.isConnected&&this.extrasFailed(a,o)}))}async mountAlerts(){if(!(this.alerts||this.closed||!this.els.bell))try{let e=await this.loadExtras();if(this.closed||this.alerts)return;let t=(s,n)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,s,n));this.alerts=e.mountAlerts({mapLayer:this.root.querySelector(".slm-map"),bellMount:this.els.bell,bannerMount:this.els.awaybanner,alertHtml:Q,plate:Z,sections:()=>this.sectionOptions,sectionCounts:s=>{let n=this.filterableSections().find(r=>r.id===s)?.seatLabels??[],a=0,o=0;for(let r of n){let l=this.status.get(r)??"free";l==="free"?a++:l==="booked"&&o++}return{total:n.length,free:a,booked:o}},reservations:()=>{let s=new Map;for(let[n,a]of this.reservedBy){let o=s.get(a.id)??{id:a.id,name:a.name,releaseAt:a.releaseAt,labels:[]};o.labels.push(n),s.set(a.id,o)}return[...s.values()]},where:s=>this.selectionSummary(s.flatMap(n=>this.labelToSeat.get(n)??[])).where,canManage:this.canBlock(),show:(s,n)=>{if(s.sectionId){let a=this.filterableSections().find(o=>o.id===s.sectionId);a&&this.frameSections([a]),this.renderer?.flashSection(s.sectionId,"#d99a0b")}else s.labels?.length&&this.showLabels(s.labels);this.showWhy(n)},extend:async(s,n)=>{let a=[...this.reservedBy.values()].find(o=>o.id===s)?.releaseAt;if(a==null)return!1;try{return await t(`reservations/${encodeURIComponent(s)}`,{method:"PATCH",body:{releaseAt:a+n}}),this.refreshReservations(),!0}catch{return!1}},release:async s=>{try{return await this.reserveRequest(`reservations/${encodeURIComponent(s)}/release`,{method:"POST"}),this.refreshReservations(),!0}catch{return!1}},reserveAgain:s=>{this.setMode("reserve"),this.selectByLabels(s)},ring:(s,n)=>this.renderer?.flashSection(s,n),feedSlot:()=>this.mode==="view"?this.els.rail?.querySelector('[data-ref="alertfeed"]')??null:null,store:e.eventAlertStore(this.key,t)})}catch(e){this.opts.onError?.(e)}}showWhy(e){let t=this.els.liveevent;t&&(t.innerHTML=`<span class="slm-liveeventdot" style="background:#e8782a"></span><span class="slm-liveeventcopy">${S(e)}</span>`,t.classList.add("on"),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.liveEventTimer=setTimeout(()=>{this.liveEventTimer=null,t.classList.remove("on"),t.innerHTML=""},4e3))}mountFindBlocked(e,t){let s=this.els.rail;this.loadExtras().then(n=>{this.closed||this.mode!=="block"||!this.blockBrowse||!e.isConnected||(this.findBlocked=n.mountFindBlocked({mount:e,foot:t,paintFoot:Qe,alertHtml:Q,alert:a=>{let o=s.querySelector('[data-ref="panelalert"]');o&&(o.innerHTML=a??"")},request:a=>this.withAuthRetry(()=>this.api.eventRequest(this.key,a)),whereOf:a=>this.selectionSummary(a.flatMap(o=>this.labelToSeat.get(o)??[])).where,sections:this.sectionOptions,sectionOf:a=>{let o=this.labelToSeat.get(a);return o?this.sectionByObject.get(o.rowId)??G.UNGROUPED_ID:null},selectedBlocked:()=>this.getSelection().filter(a=>this.status.get(a.label)==="blocked"&&!this.reservedBy.has(a.label)).map(a=>a.label),show:a=>this.showLabels(a),select:a=>{this.renderer?.clearSelection(),this.selectByLabels(a)},unblock:async a=>(await this.unblock(a),a.every(o=>this.status.get(o)!=="blocked")),block:async(a,o,r)=>(await this.block(a,{...o?{reason:o}:{},...r?{releaseAt:r}:{}}),a.every(l=>this.status.get(l)==="blocked")),unblockAll:()=>this.unblockAll(),openReserve:()=>this.setMode("reserve")}))}).catch(n=>{e.isConnected&&(e.innerHTML='<div class="slm-empty" role="alert">Blocked seats could not load. Switch tabs and back to try again.</div>'),this.opts.onError?.(n)})}paintReserveSelection(e){let t=this.els.rail?.querySelector('[data-ref="selcard"]');t&&(pt(t,this.selectionSummary(e,!0)),this.paintAddBy(e.length),this.reserve?.paint())}isBlockSelectable(e){if(this.isHostUnavailable(e))return!1;let t=this.status.get(e)??"free";return t==="free"||t==="blocked"}paintSelBar(e){let t=this.els.rail,s=t?.querySelector('[data-ref="selcard"]'),n=t?.querySelector('[data-ref="blockfoot"]');if(!s||!n)return;pt(s,this.selectionSummary(e,!0)),this.paintAddBy(e.length);let a=t.querySelector('[data-ref="panelalert"]');a&&(!this.blockBrowse||this.panelAlert)&&(a.innerHTML=this.panelAlert??"");let o=e.filter(p=>(this.status.get(p.label)??"free")==="free").length,r=e.filter(p=>this.status.get(p.label)==="blocked").length,l=pe,c=t.querySelector('[data-ref="blockedtab"]'),{blocked:d}=this.buildTallies(),g=d-this.reservedTally(d);if(c&&(c.textContent=g>0?`Find blocked \xB7 ${g.toLocaleString()}`:"Find blocked"),this.blockBrowse){this.findBlocked?.paint();return}let b=this.blockDone&&(this.blockDone.partial||this.blockDone.until>Date.now())?this.blockDone:null;t.classList.toggle("slm-settled",!!b&&!o);let m=this.releaseAt?ut(this.releaseAt):null;Qe(n,this.blockBusy?{label:`Blocking ${l(this.getSelection().length)}\u2026`,busy:!0,note:"Buyers already cannot pick these seats."}:b?.partial&&!o?{label:"Done",secondary:`Undo the ${b.labels.length.toLocaleString()}`,look:"settle"}:this.blockBrowse||!o&&r?{label:r?`Put ${l(r)} back on sale`:"Put back on sale",disabled:!r,note:r?"Buyers can pick them again right away.":"Select blocked seats in the list or on the map."}:o?this.blockDenied?{label:`Block ${l(o)}`,disabled:!0,note:'Needs the "Block seats" permission.'}:this.blockFailedNow?{label:"Try again",danger:!0,note:"Your selection and reason are kept."}:{label:m?`Block ${l(o)} until ${m}`:`Block ${l(o)}`,danger:!0,secondary:r?`Put the ${r.toLocaleString()} blocked back on sale`:null,note:r?`The ${r.toLocaleString()} already blocked keep their reason.`:m?"Buyers can\u2019t pick them until then.":"Buyers can\u2019t pick them. Sold seats and seats in a cart are never blocked."}:{label:"Select seats first",disabled:!0,note:b?"Blocked just now":"Pick free seats on the map. Sold seats and seats in a cart are never blocked.",secondary:b?"Undo":null,look:b?"done":void 0})}selectionFree(){return this.getSelection().filter(e=>(this.status.get(e.label)??"free")==="free").length}doneQuietly(e,t,s){try{this.done(e,t,s)}catch(n){this.opts.onError?.(n)}}done(e,t,s){let n=this.mode==="block"&&this.els.rail?.querySelector('[data-ref="blockfoot"]')||this.mode==="categories"&&e==="setCategory"&&this.els.rail?.querySelector('[data-ref="catfoot"]');if(!this.tablesPanel&&!n&&this.toastOk(s),t.length){let a=e==="block"?this.pushActivity(t,"blocked","blocked"):e==="unblock"||e==="unblockAll"?this.pushActivity(t,"unblocked","free"):e==="cancelBooking"?this.pushActivity(t,"cancelled","free"):null;a&&this.paintSpatialActivity(a)}e!=="setHoldTtl"&&this.refreshControlRoom().catch(a=>this.opts.onError?.(a)),this.opts.onActionComplete?.({action:e,labels:t,count:t.length})}toastOk(e){this.toast(e,"ok")}toastErr(e){this.toast(e,"err")}toast(e,t,s){let n=this.els.toast;if(n){if(n.textContent=e,n.className=`slm-toast on ${t}`,s){let a=document.createElement("button");a.type="button",a.textContent=s.label,a.addEventListener("click",()=>{n.className="slm-toast",s.run()}),n.append(" ",a)}this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{n.className="slm-toast"},s?8e3:3200)}}fail(e){this.opts.onError?.(e);let t=e instanceof W?e.status:0;this.showRoomCard(t===401||t===403?"access":t===404?"missing":"offline"),this.els.rail&&(this.els.rail.innerHTML="")}showRoomCard(e){let t=this.root;if(!t)return;t.querySelector('[data-ref="opening"]')?.remove(),t.querySelector('[data-ref="roomcard"]')?.remove(),t.insertAdjacentHTML("beforeend",On(e,this.opts.organizationName)),t.querySelector('[data-ref="roomcard"]').querySelector("[data-roomcard-act]")?.addEventListener("click",()=>{e==="signedout"?this.retrySession():this.reopen()})}async reopen(){let e=this.root;!e||this.closed||(e.querySelector('[data-ref="roomcard"]')?.remove(),this.renderer?.destroy(),this.renderer=null,e.querySelector(".slm-map")?.insertAdjacentHTML("beforeend",Ss()),this.els.rail&&(this.els.rail.innerHTML=Ls()),await this.load())}};Ds();es();Bt();0&&(module.exports={ACCESS_LINK_DEFAULTS,ChannelsMode,ManageApi,ManageApiError,PUBLIC_CHANNEL_ID,PUBLIC_CHANNEL_NAME,SeatManager,accessIntentDescription,accessIntentLabel,accessLine,accessLinkBadge,accessLinkErrorCopy,accessLinkIsLive,accessLinkPolicyLines,bucketRows,bucketRowsHtml,dropReviewRows,intentForbidsCopy,intentSwitchBlockedCopy,isPublicChannelId,markerLetter,markerOf,mutationCount,needsMoveConfirmation,planAssignment,retryAfterCopy,selectionSources,stateBadge,suggestMarker});