@seatlayer/js 0.104.0 → 0.105.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,586 @@
1
+ import{k as S}from"./chunk-QB6PA3C6.js";function ne(i){i.querySelectorAll("select:not([data-themed])").forEach(e=>{e.dataset.themed="true";let t=document.createElement("details");t.className="slm-themed-picker";let n=document.createElement("summary"),s=document.createElement("div");s.className="slm-themed-options";let a=e.getAttribute("aria-label")||Array.from(e.labels??[]).map(r=>r.textContent).join(" ")||"Choose option";n.setAttribute("aria-label",a.trim()),t.append(n,s),e.after(t),e.hidden=!0;let o=()=>{n.textContent=e.selectedOptions[0]?.textContent??"Choose\u2026",n.setAttribute("aria-disabled",String(e.disabled)),s.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(),n.focus(),e.dispatchEvent(new Event("change",{bubbles:!0})),o()},l}))};o(),e.addEventListener("change",o),n.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,n.focus()),r.key==="ArrowDown"||r.key==="ArrowUp"){if(e.disabled)return;r.preventDefault(),t.open=!0;let l=Array.from(s.querySelectorAll("button:not(:disabled)")),c=l.indexOf(document.activeElement);l[(c+(r.key==="ArrowDown"?1:l.length-1)+l.length)%l.length]?.focus()}})})}function ft(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 ie={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"/>'};function P(i,e,t=30){let n=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="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="${e}" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${ie[i]??""}</svg></span>`}var wt={booked:["seat","#8a94a6"],free:["seat","#22a06b"],held:["clock","#d99a0b"],blocked:["ban","#d64545"],reserved:["bookmark","#c026d3"]};function Y(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">${ie[i]??""}</svg>`}function ae(i){return`<div class="slm-railhead slm-taskhead">${P(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 xt(){return'<div class="slm-selcard" data-ref="selcard" aria-live="polite"></div>'}function Be(){return typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318K":"Ctrl K"}function se(){return typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches}var Oe=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318Z":"Ctrl Z",_e='<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>',qe=[["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 "]],Ne=[["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"]];function St(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">${(se()?Ne:qe).map(([n,s,a,o])=>`<span>${P(n,s,26)}<span><b>${a}</b>${o}${n==="search"&&!se()?Be():""}</span></span>`).join("")}${e.saved?`<button type="button" class="slm-savedrow" data-saved-list>${P("star","#d99a0b",26)}<span><b>Saved selections</b>${e.saved.toLocaleString()} on this event</span>${_e}</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(n=>`<span class="tone-${n.tone}">${S(n.label)}</span>`).join("")}${e.types.map(n=>`<span class="type"><i style="background:${S(n.color)}"></i>${S(n.label)} ${n.count.toLocaleString()}</span>`).join("")}</div>`+(e.stale?`<p class="slm-selstale">${P("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">${Y("spark","#d99a0b")}Select similar</button></span>`:""}<button type="button" class="slm-btn ghost" data-sel-undo title="Undo the last change to the selection (${Oe})"${e.canUndo?"":" disabled"}>${Y("undo","#64748b")}Undo</button>${e.canSave?`<button type="button" class="slm-btn ghost slm-selsave" data-sel-save>${Y("star","#d99a0b")}Save</button>`:""}</div>`}function Ue(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 Ct(i){if(!i.length)return"";if(i.length===1){let t=Ue(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 y(i,e,t,n){return`<div class="slm-panelalert ${i}" role="${i==="error"?"alert":"status"}">${P(n??(i==="ok"?"check":"alert"),i==="error"?"#d64545":i==="warn"?"#b45309":i==="ok"?"#22a06b":"#3b82f6",24)}<span><b>${S(e)}</b>${S(t)}</span></div>`}function $t(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 Lt(i,e){let t=i.querySelector("[data-foot-action]"),n=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 s=i.querySelector("[data-foot-secondary]");s&&(s.hidden=!e.secondary,s.textContent=e.secondary??"",s.disabled=!!e.busy),n&&(n.textContent=e.note??"",n.hidden=!e.note)}function Ve(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 n=`${i.labels.length.toLocaleString()} seat${i.labels.length===1?"":"s"} found`,s=t.length?`${t.join(" \xB7 ")} \xB7 ${n}`:n;return e?`${s} \xB7 Enter to ${e==="frame"?"show":"select"}`:s}function Fe(i={}){return`
2
+ <div class="slm-find${i.compact?" slm-find-bar":""}" data-ch-find>
3
+ <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
+ <span class="slm-find-count" data-ch-find-count role="status"></span>
5
+ </div>`}function oe(i,e){return i.toLocaleLowerCase().split(/\s+/).some(t=>e.length>=2?t.startsWith(e):t===e)}function ze(i,e){let t=i.trim().toLocaleLowerCase();if(!t)return{labels:[],seats:0,rows:0,sections:0};let n=new Set,s=0,a=0;for(let h of e.sections)if(oe(h.label,t)){s+=1;for(let u of h.labels)n.add(u)}let o=t.split(/\s+/),r=o[o.length-1],l=o.slice(0,-1).join(" ");for(let h of e.rows)if(h.label.toLocaleLowerCase()===r&&!(l&&!oe(h.sectionLabel,l))){a+=1;for(let u of h.labels)n.add(u)}let c=0;for(let h of e.seatLabels){let u=h.toLocaleLowerCase();(u===t||u.startsWith(`${t}-`))&&(n.has(h)||(c+=1),n.add(h))}return{labels:[...n],seats:c,rows:a,sections:s}}function It(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
+ <span class="slm-selnum${i.bump?" bump":""}">${i.count.toLocaleString()}</span>
7
+ <span class="slm-sellabel">${S(i.noun??"selected")}</span>
8
+ ${i.breakdown??""}${e}
9
+ </div>`}var je=i=>`${i.toLocaleString()} ${i===1?"seat":"seats"}`,Ye=(i,e)=>`${i.toLocaleString()} free of ${e.toLocaleString()}`,_=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>':"",n=this.rows().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-rows">Rows\u2026</button>':"",s=this.host.categories().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-category">Category</button>':"",a=e.find===!1?"":Fe();return`
10
+ <div class="slm-chooser" data-ch-chooser>
11
+ <div class="slm-ch-row2">${e.intents??""}${t}${n}</div>
12
+ <div class="slm-ch-row2">${s}<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
+ ${a}
14
+ </div>`}wire(e,t={}){this.wireChips(e),this.wireFind(e,t)}wireChips(e){e.querySelectorAll("[data-ch-act]").forEach(t=>{let n=t.dataset.chAct;n==="pick-sections"?t.addEventListener("click",()=>this.openSections(t)):n==="pick-rows"?t.addEventListener("click",()=>this.openRows()):n==="pick-category"?t.addEventListener("click",()=>this.openCategory()):n==="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 n=e.querySelector("[data-ch-find-input]"),s=e.querySelector("[data-ch-find-count]");if(!n||!s)return;let a={labels:[],seats:0,rows:0,sections:0},o=l=>{s.textContent=l,s.title=l},r=()=>{let l=n.value.trim();a=this.find(n.value),o(l?Ve(a,t.enter??"select"):""),this.host.highlight?.(l?a.labels:null),t.onFind?.(a)};n.addEventListener("input",r),n.addEventListener("keydown",l=>{if(l.key==="Escape"&&n.value){l.preventDefault(),l.stopPropagation(),n.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`)}),n.addEventListener("search",r)}find(e){return ze(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 n=this.host.pickers();if(!(n instanceof Promise)){t(n);return}this.opening=!0;let s=[...document.querySelectorAll(`[data-ch-act="${e}"]`)];s.forEach(a=>a.setAttribute("aria-busy","true")),n.then(t,()=>this.host.pickerFailed?.(()=>this.openPicker(e,t))).finally(()=>{this.opening=!1,s.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 n=this.host.cap??1/0,s=this.host.sections().map(c=>{let h=this.host.labelsInSection(c.id),u=this.host.sectionInfo?.(c.id);return{...c,labels:h,total:u?.total??h.length,color:u?.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>${s.map(c=>`
15
+ <button type="button" role="menuitem" data-ch-scope-id="${S(c.id)}"${c.labels.length?"":" disabled"}>
16
+ <span class="dot" style="background:${S(c.color??"#6e7bff")}" aria-hidden="true"></span>
17
+ <span><b>${S(c.label)}</b><small>${Ye(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 h=[...a.querySelectorAll("button:not([disabled])")],u=h.indexOf(document.activeElement);c.key==="Escape"?(r(),t?.focus(),c.preventDefault()):(c.key==="ArrowDown"||c.key==="ArrowUp")&&(h[(u+(c.key==="ArrowDown"?1:-1)+h.length)%h.length]?.focus(),c.preventDefault())}),a.querySelectorAll("[data-ch-scope-id]").forEach(c=>c.addEventListener("click",()=>{let h=s.find(m=>m.id===c.dataset.chScopeId);if(!h)return;let u=new Set([...this.host.selectionLabels(),...h.labels]);if(u.size>n){let m=a.querySelector("[data-ch-error]");m.hidden=!1,m.textContent=`That would make ${je(u.size)}. One change can take up to ${n.toLocaleString()}.`;return}r(),this.host.selectByLabels([...u])})),a.querySelector("button:not([disabled])")?.focus()}};var b="public",C="Public sale";function $(i){return i==null||i===""||i===b}var U=["#a78bfa","#2dd4bf","#fb923c","#60a5fa","#f472b6","#a3e635","#f87171","#38bdf8","#c084fc","#facc15"],Ke="#f4b740",re="ABCDEFGHJKLMNPQRSTUVWXYZ";function T(i,e){let t=(i??"").trim();return((/\p{L}/u.exec(t)?.[0]??t[0]??"")||e).toUpperCase().slice(0,1)}function W(i,e){let t=new Set([...e].map(a=>T(a,"")).filter(Boolean)),n=T(i,"");return{letter:re.includes(n)&&!t.has(n)?n:[...re].find(a=>!t.has(a))??(n||"X"),color:U[t.size%U.length]}}function ce(i,e=0){return $(i.id)?{letter:T(i.marker,"P"),color:i.color||Ke}:{letter:T(i.marker||i.name,"?"),color:i.color||U[e%U.length]}}function he(i,e,t){let n=new Map;for(let o of i){let r=X(e.get(o));n.set(r,(n.get(r)??0)+1)}let s=[{id:b,name:t?.publicSale?.name??C},...(t?.channels??[]).map(o=>({id:o.id,name:o.name}))],a=[];for(let o of s){let r=n.get(o.id);r&&a.push({channelId:o.id,name:o.name,count:r}),n.delete(o.id)}for(let[o,r]of n)a.push({channelId:o,name:$(o)?C:"Another channel",count:r});return a}function X(i){return $(i)?b:i}var le=12;function K(i){return{count:i.length,labels:i.slice(0,le),truncated:i.length>le}}function de(i){let{labels:e,allocation:t,statusOf:n,nameOf:s}=i,a=X(i.targetChannelId),o=new Set,r=0,l=0,c=new Map,h=[],u=[],m=[];for(let k of e){if(o.has(k))continue;o.add(k);let L=n(k);if(!L){m.push(k);continue}let A=X(t.get(k));if(A===a){l+=1;continue}if(L==="held"){h.push(k);continue}if(L==="booked"){u.push(k);continue}A===b?r+=1:c.set(A,(c.get(A)??0)+1)}let g=[...c.entries()].map(([k,L])=>({channelId:k,name:s(k),count:L}));return{changedFromPublic:{count:r},movedFromOtherChannel:{count:g.reduce((k,L)=>k+L.count,0),channels:g},alreadyInTarget:{count:l},skippedHeld:K(h),skippedBooked:K(u),notFound:K(m)}}function V(i){return i.changedFromPublic.count+i.movedFromOtherChannel.count}function Pt(i){return i.movedFromOtherChannel.count>0}function ue(i,e){let t=[];i.changedFromPublic.count&&t.push({kind:"add",icon:"+",count:i.changedFromPublic.count,text:`${i.changedFromPublic.count.toLocaleString()} from ${C}`});for(let n of i.movedFromOtherChannel.channels)t.push({kind:"move",icon:"\u21C4",count:n.count,text:`${n.count.toLocaleString()} moved out of ${n.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:N(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:N(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:N(i.notFound)}),t}function N(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 pe(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 me(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,n=i.detail??t;return n?`${e} \xB7 ${n}`:e}function H(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 Tt(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 Xe(i){return i==="hosted_link"?"hosted_link":i==="server"?"server":i==="staff"?"internal":null}function F(i){let e=G(i?.accessIntent),t=Xe(i?.route),n=`This channel is set to "${H(e)}"`;return t?`${n}, so it cannot do that. Switch it to "${H(t)}" first.`:`${n}, so it cannot do that. Choose a different route for this channel first.`}function G(i){return i==="internal"||i==="server"||i==="hosted_link"||i==="none"?i:"none"}function q(i,e,t){return`${i.toLocaleString()} ${i===1?e:t}`}function ge(i){let e=Math.max(0,i?.liveAccessLinks??0),t=Math.max(0,i?.activeSessions??0),n=G(i?.from),s=G(i?.to),o=`${[e?q(e,"buyer link is live","buyer links are live"):null,t?q(t,"buyer is in a checkout","buyers are in a checkout"):null].filter(Boolean).join(", and ")||"Buyers are inside this channel"} on "${H(n)}". Moving it to "${H(s)}" changes what happens to them.`,r=[];return e&&r.push(`${q(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(`${q(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}}var Q={maxRedemptions:100,maxQuantity:4};function be(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 ve(i){return i.state==="active"&&i.status==="active"}function Z(i){return Number.isFinite(i)?new Date(i).toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}):"\u2014"}function Mt(i){return[{k:"Expires",v:Z(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 fe(i){return[`${i.redemptions.toLocaleString()} of ${i.maxRedemptions.toLocaleString()} used`,`${i.maxQuantity.toLocaleString()} ${i.maxQuantity===1?"seat":"seats"} per buyer`,`ends ${Z(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 ye(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 ${Z(i.expiresAt)}.`+(i.includePublic?" It also opens Public sale seats.":"")}function B(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 F(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 Dt(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?N({count:e.count,labels:e.labels,truncated:e.truncated??!1}):void 0}))}function ke(i){return i==="builtin"?"Built-in":i==="active"?"Active":i==="paused"?"Paused":"Archived"}var we=Symbol.for("seatlayer.ManageApiError"),p=class extends Error{static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&e[we]===!0}constructor(e,t,n,s,a,o){super(t),Object.defineProperty(this,we,{value:!0}),this.name="ManageApiError",this.status=e,this.code=n,this.conflicts=s,this.details=a,this.serverMessage=o}};async function xe(i){let t=(i.headers.get("content-type")??"").includes("application/json")?await i.json().catch(()=>null):null;if(!i.ok){let n=t;throw new p(i.status,n?.error??`request_failed_${i.status}`,n?.code,n?.conflicts,n?.details,typeof n?.message=="string"?n.message:void 0)}return t}function x(i){return i&&typeof i=="object"?i:{}}function z(i,e,t=0){return typeof i=="number"&&Number.isFinite(i)?i:typeof e=="number"&&Number.isFinite(e)?e:t}function Se(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 $e(i){let e=x(i),t=z(e.bookedValue,e.bookedRevenue);return{...e,bookedValue:t,bookedRevenue:t}}function Ge(i){let e=x(i),t=x(e.report),n=Array.isArray(t.byCategory)?t.byCategory.map(a=>{let o=x(a),r=z(o.bookedValue,o.bookedRevenue);return{...o,bookedValue:r,bookedRevenue:r}}):[],s=Array.isArray(t.bySection)?t.bySection.map($e):void 0;return{...e,report:{...t,byCategory:n,...s?{bySection:s}:{}}}}function We(i){let e=x(i),t=x(e.bookedValue),n=x(e.revenue),s=Object.keys(t).length?t:n,a=Array.isArray(t.bySection)?t.bySection:Array.isArray(n.bySection)?n.bySection:[],o={...s,gross:z(t.gross,n.gross),bySection:a.map($e)},r=x(e.velocity),l=Array.isArray(r.bySection)?r.bySection.map(c=>{let h=x(c),u=z(h.bookedValue,h.grossRevenue);return{...h,bookedValue:u,grossRevenue:u}}):[];return{...e,bookedValue:o,revenue:o,velocity:{...r,bySection:l}}}function Qe(i){let e=x(i),t=x(e.report),n=typeof t.includesBookedValue=="boolean"?t.includesBookedValue:t.includesRevenue===!0,s=Array.isArray(t.rows)?t.rows.map(r=>{let l=x(r),c=x(l.attribution),h=Se(c.bookedValue,c.revenue);return{...l,attribution:{...c,bookedValue:h,revenue:h}}}):[],a=x(t.totals),o=Se(a.bookedValue,a.revenue);return{...e,report:{...t,includesBookedValue:n,includesRevenue:n,rows:s,totals:{...a,bookedValue:o,revenue:o}}}}function J(i){let e=x(i),t=typeof e.includesBookedValue=="boolean"?e.includesBookedValue:e.includesRevenue===!0;return{...e,includesBookedValue:t,includesRevenue:t}}var Ce=class{constructor(e,t){this.base=e.replace(/\/+$/,""),this.token=t}setToken(e){this.token=e}auth(e,t={}){let n=t.method??"GET",s={Authorization:`Bearer ${this.token}`},a;return t.body!==void 0&&(s["Content-Type"]="application/json",a=JSON.stringify(t.body)),fetch(`${this.base}${e}`,{method:n,headers:s,body:a,credentials:"omit"}).then(o=>xe(o))}async authBlob(e){let t=await fetch(`${this.base}${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});return t.ok||await xe(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 p(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,n={}){let s={labels:t};return typeof n.releaseAt=="number"&&(s.releaseAt=n.releaseAt),n.reason&&(s.reason=n.reason),this.auth(`/v1/events/${encodeURIComponent(e)}/block`,{method:"POST",body:s})}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,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/${t}`,n)}unbook(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/unbook`,{method:"POST",body:{labels:t,bookingRef:n}})}setHoldTtl(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/hold-ttl`,{method:"POST",body:{holdTtlMs:t}})}setCategory(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`,{method:"POST",body:{labels:t,categoryKey:n}})}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,n,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/table-booking`,{method:"POST",body:{tableIds:t,mode:n,...s}})}bookings(e,t={}){let n=new URLSearchParams;t.q&&n.set("q",t.q),t.state&&n.set("state",t.state),t.cursor&&n.set("cursor",t.cursor),t.limit!=null&&n.set("limit",String(t.limit));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings${s?`?${s}`:""}`)}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 n=t.includeArchived?"?includeArchived=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels${n}`)}channelAllocation(e,t={}){let n=new URLSearchParams;t.afterLabel&&n.set("afterLabel",t.afterLabel),t.limit!=null&&n.set("limit",String(t.limit));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/allocation${s?`?${s}`:""}`)}channelAudit(e,t={}){let n=new URLSearchParams;t.limit!=null&&n.set("limit",String(t.limit)),t.before!=null&&n.set("before",String(t.before));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/audit${s?`?${s}`:""}`)}createChannel(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels`,{method:"POST",body:t})}renameChannel(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{name:n}})}updateChannelPricing(e,t,n,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{priceOverrides:n,expectedPricingVersion:s}})}setChannelPaused(e,t,n){let s=n?"pause":"unpause";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/${s}`,{method:"POST",body:{}})}archiveChannel(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/archive`,{method:"POST",body:{destination:n}})}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,n={}){let s=new URLSearchParams;t.length&&s.set("channelIds",t.join(",")),n.includePublic!=null&&s.set("includePublic",n.includePublic?"1":"0");let a=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/preview${a?`?${a}`:""}`)}setChannelAccessIntent(e,t,n,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{accessIntent:n,...s.acknowledgeLiveAccess?{acknowledgeLiveAccess:!0}:{},...s.reason?{reason:s.reason}:{}}})}createAccessLink(e,t,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`,{method:"POST",body:n})}accessLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`)}rotateAccessLink(e,t,n,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(n)}/rotate`,{method:"POST",body:{endActiveSessions:s}})}revokeAccessLink(e,t,n,s=!1){let a=s?"?endActiveSessions=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(n)}${a}`,{method:"DELETE"})}report(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/report`).then(Ge)}seatHistory(e,t,n,s){let a=new URLSearchParams({label:t});return n&&a.set("before",String(n)),s&&a.set("action",s),this.auth(`/v1/events/${encodeURIComponent(e)}/seat-history?${a}`)}seatStory(e,t,n,s){let a=new URLSearchParams({label:t,v:"2"});return n&&a.set("before",String(n)),s&&a.set("action",s),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(We)}channelReport(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/report`).then(Qe)}createChannelReportLink(e,t,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`,{method:"POST",body:n}).then(s=>{let a=x(s);return{...a,link:J(a.link)}})}channelReportLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`).then(n=>{let s=x(n);return{links:Array.isArray(s.links)?s.links.map(J):[]}})}revokeChannelReportLink(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links/${encodeURIComponent(n)}`,{method:"DELETE"}).then(s=>{let a=x(s);return{...a,link:J(a.link)}})}log(e,t={}){let n=new URLSearchParams;t.limit!=null&&n.set("limit",String(t.limit)),t.before!=null&&n.set("before",String(t.before));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/log${s?`?${s}`:""}`)}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 p(t.status,`request_failed_${t.status}`);return t.blob()}};function ee(i){return i.map((e,t)=>`
19
+ <div class="slm-ch-bucket" style="animation-delay:${Math.min(t,4)*30}ms">
20
+ <span class="ico ${e.kind}" aria-hidden="true">${d(e.icon)}</span>
21
+ <span><b>${e.count.toLocaleString()}</b> ${d(e.text.replace(/^[\d,.\s]+/,""))}
22
+ ${e.why?`<span class="why">\u2014 ${d(e.why)}</span>`:""}</span>
23
+ ${e.peek?`<span class="peek">${d(e.peek)}</span>`:"<span></span>"}
24
+ </div>`).join("")}var Re=`
25
+ <p class="slm-eyebrow" style="margin-top:18px">On your website</p>
26
+ <p class="slm-hint">There is nothing more to set up on this screen. Your own server mints a short-lived buyer
27
+ access session for this channel with the SeatLayer server SDK and hands it to the widget. A channel name
28
+ on its own never grants access.</p>
29
+ <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 d(i){return String(i??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ae(i){return new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16)}function te(i,e){let t=i.querySelector(e)?.value.trim()??"",n=Number(t);return t!==""&&Number.isInteger(n)?n:null}function Ie(i,e){let t=typeof navigator>"u"?null:navigator.clipboard;return t?.writeText?t.writeText(e).then(()=>!0,()=>Le(i,e)):Promise.resolve(Le(i,e))}function Le(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 n=document.execCommand("copy");if(t.value="",n)return!0}catch{t.value=""}return Ze(i),!1}function Ze(i){let e=i.querySelector("[data-ch-lk-url]");if(e)try{let t=document.createRange();t.selectNodeContents(e);let n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)}catch{}}var Je=8,et="#6e7bff",tt="#b9c0ff",nt={unavailableFill:"#303846",unavailableStroke:"#4b5669",allocationStroke:"#101723",sectionPlate:"rgba(11,16,28,.88)",sectionPlateInk:"#f8fafc"},st={unavailableFill:"rgba(156,163,175,.55)",unavailableStroke:"rgba(107,114,128,.65)",allocationStroke:"#ffffff",sectionPlate:"rgba(255,255,255,.9)",sectionPlateInk:"#172033"};function it(i){return i?.dataset?.theme==="light"?st:nt}function Te(i){let e=i.canvas,t=i.layer;if(!e||!t)return;let n=i.host.mapLayer.getBoundingClientRect(),s=Math.max(1,Math.round(n.width)),a=Math.max(1,Math.round(n.height)),o=typeof devicePixelRatio=="number"?Math.min(3,Math.max(1,devicePixelRatio)):1;(e.width!==s*o||e.height!==a*o)&&(e.width=s*o,e.height=a*o);let r=i.resolveCtx();if(!r)return;r.setTransform(o,0,0,o,0,0),r.clearRect(0,0,s,a);let l=it(i.host.root),c=i.host.isSeatDetail(),h=Math.max(3,i.host.seatPixelSize()),u=h/2,m=i.view==="preview"?i.previewProjection:null,g=m?new Set(m.available===!1?[]:m.eligible??[]):null,k=new Map,L=!c&&i.host.sections().length>1?new Map:null,A=i.view==="preview"&&c&&h<=15?new Map:null;for(let R of i.host.seats()){let He=i.host.statusOf(R.label)??"free",M=i.allocation.get(R.label)??b;if(M!==b){let w=k.get(M)??{x:0,y:0,n:0};w.x+=R.x,w.y+=R.y,w.n+=1,k.set(M,w)}if(!c){let w=i.host.sectionOfLabel(R.label),f=w?i.host.worldToScreen({x:R.x,y:R.y}):null;if(L&&w&&f){let E=L.get(w.id)??{label:w.label,minX:f.x,minY:f.y,maxX:f.x,maxY:f.y};E.minX=Math.min(E.minX,f.x),E.minY=Math.min(E.minY,f.y),E.maxX=Math.max(E.maxX,f.x),E.maxY=Math.max(E.maxY,f.y),L.set(w.id,E)}continue}if(He!=="free")continue;let D=null,O=null;if(i.view==="preview"?g?.has(R.label)?(D=et,O=tt):(D=l.unavailableFill,O=l.unavailableStroke):M!==b&&(D=i.markerFor(M).color,O=l.allocationStroke),!D)continue;let v=i.host.worldToScreen({x:R.x,y:R.y});if(v&&!(v.x<-h||v.y<-h||v.x>s+h||v.y>a+h)){if(A){let w=i.host.sectionOfLabel(R.label);if(w){let f=A.get(w.id)??{label:w.label,minX:v.x,minY:v.y,maxX:v.x,maxY:v.y};f.minX=Math.min(f.minX,v.x),f.minY=Math.min(f.minY,v.y),f.maxX=Math.max(f.maxX,v.x),f.maxY=Math.max(f.maxY,v.y),A.set(w.id,f)}}if(r.fillStyle=D,i.view==="preview"||M!==b){let w=Math.max(2,u+Math.min(1.5,u*.06));r.globalAlpha=1,r.beginPath(),r.arc(v.x,v.y,w,0,Math.PI*2),r.fill(),r.strokeStyle=O??D,r.lineWidth=i.view==="preview"?Math.max(1,Math.min(1.75,h*.13)):Math.max(1,Math.min(1.5,h*.1)),r.stroke(),i.view==="preview"&&g?.has(R.label)&&h>=22&&at(r,R.label,v.x,v.y,w)}else r.globalAlpha=.85,r.fillRect(v.x-u,v.y-u,h,h)}}r.globalAlpha=1,A&&ct(r,A,l),ot(L,i),ht(k,i,r)}function at(i,e,t,n,s){let a=s*1.55,o=Math.min(13,Math.max(7,s*.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,n))}function ot(i,e){let t=e.layer;if(t&&(t.querySelectorAll(".slm-ch-section-target").forEach(n=>n.remove()),!!i))for(let[n,s]of i){let a=s.maxX-s.minX,o=s.maxY-s.minY;if(a<20||o<20)continue;let r=document.createElement("button");r.type="button",r.className="slm-ch-section-target",r.style.left=`${s.minX-8}px`,r.style.top=`${s.minY-8}px`,r.style.width=`${a+16}px`,r.style.height=`${o+16}px`,r.setAttribute("aria-label",`Open ${s.label} seats`),lt(r,e,()=>e.onSectionTargetClick(n)),t.appendChild(r)}}var Ee=4;function rt(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 Pe(i){return i.host.mapLayer.querySelector(".slm-map-host")??i.host.mapLayer}function lt(i,e,t){i.addEventListener("wheel",l=>{let c=Pe(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 n=null,s=!1,a=()=>{n=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(!n||s||Math.abs(l.clientX-n.x)<Ee&&Math.abs(l.clientY-n.y)<Ee)return;s=!0;let c=n;e.layer?.classList.add("panning");let h=document.elementFromPoint?.(c.x,c.y)??null;(h&&h!==i?h:Pe(e)).dispatchEvent(rt(l,c))}function r(){a()}i.addEventListener("pointerdown",l=>{s=!1,n={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(s){s=!1,l.preventDefault(),l.stopPropagation();return}t()})}function ct(i,e,t){for(let n of e.values()){let s=n.maxX-n.minX,a=n.maxY-n.minY;if(s<52||a<26)continue;let o=(n.minX+n.maxX)/2,r=(n.minY+n.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(s-8,i.measureText(n.label).width+18),h=l+10;i.fillStyle=t.sectionPlate,i.fillRect(o-c/2,r-h/2,c,h),i.fillStyle=t.sectionPlateInk,i.textAlign="center",i.textBaseline="middle",i.fillText(n.label,o,r)}}function ht(i,e,t){let n=e.layer;if(!n||(n.querySelectorAll(".slm-ch-flag").forEach(a=>a.remove()),e.view==="preview"))return;let s=[...i.entries()].sort((a,o)=>o[1].n-a[1].n).slice(0,Je);for(let[a,o]of s){let r=e.list?.channels.find(u=>u.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),h=document.createElement("span");h.className="slm-ch-flag",h.style.left=`${l.x}px`,h.style.top=`${l.y}px`,h.innerHTML=`<span class="mk" style="background:${d(c.color)}">${d(c.letter)}</span>${d(r.name)}${r.state==="paused"?" \xB7 Paused":""}`,n.appendChild(h)}}var dt=`
31
+ .slm{--slm-ch-marker-ink:#0e1017;
32
+ --slm-mo-instant:80ms;--slm-mo-quick:140ms;--slm-mo-base:200ms;--slm-mo-slow:320ms;--slm-mo-ambient:2000ms;
33
+ --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);
34
+ --slm-mo-spring:cubic-bezier(.34,1.3,.64,1)}
35
+ /* A channel's marker chip is painted in the CHANNEL's own colour, which is the
36
+ same in both themes, so its ink is a constant rather than a ground token \u2014
37
+ declared once here so a host can still override it. The scrim and dialog
38
+ rules live in managerDialog.ts (MANAGER_DIALOG_CSS), always injected. */
39
+
40
+ /* map overlay: ONE layer, faded in as a whole (never per seat) */
41
+ .slm-ch-layer{position:absolute;inset:0;overflow:hidden;pointer-events:none;opacity:0;transition:opacity var(--slm-mo-base) var(--slm-mo-out)}
42
+ .slm-ch-layer.on{opacity:1}
43
+ .slm-ch-canvas{position:absolute;inset:0;width:100%;height:100%}
44
+ .slm-ch-flag{position:absolute;display:flex;align-items:center;gap:5px;padding:3px 8px;border-radius:999px;
45
+ background:color-mix(in srgb,var(--slm-surface) 92%,transparent);color:var(--slm-text);
46
+ border:1px solid var(--slm-line);font-size:10px;font-weight:800;letter-spacing:.04em;
47
+ transform:translate(-50%,-50%);white-space:nowrap}
48
+ .slm-ch-flag .mk{width:14px;height:14px;border-radius:4px;display:grid;place-items:center;font-size:8.5px;font-weight:800;color:var(--slm-ch-marker-ink)}
49
+ .slm-ch-section-target{position:absolute;pointer-events:auto;padding:0;border:0;border-radius:8px;background:transparent;cursor:zoom-in}
50
+ /* Set while a pointer gesture that started on a section target has turned into
51
+ a map pan: every target goes inert so the drag reaches the renderer host. */
52
+ .slm-ch-layer.panning .slm-ch-section-target{pointer-events:none}
53
+ .slm-ch-section-target:focus-visible{outline:2px solid var(--slm-accent);outline-offset:-3px;background:color-mix(in srgb,var(--slm-accent) 12%,transparent)}
54
+
55
+ /* preview banner \u2014 raised with the organizer chrome dim, as one transition */
56
+ .slm-ch-banner{display:flex;align-items:center;gap:9px;padding:8px 14px;max-width:100%;
57
+ border-radius:999px;background:color-mix(in srgb,var(--slm-surface) 94%,transparent);color:var(--slm-text);
58
+ border:1px solid var(--slm-line);font-size:12px;font-weight:700;
59
+ transform:translateY(-8px);opacity:0;pointer-events:none;
60
+ transition:opacity var(--slm-mo-base) var(--slm-mo-out),transform var(--slm-mo-base) var(--slm-mo-out)}
61
+ .slm-ch-banner.on{opacity:1;transform:none;pointer-events:auto}
62
+ .slm-ch-banner .dot{width:8px;height:8px;border-radius:50%}
63
+ .slm-ch-banner button{color:var(--slm-accent);font-weight:800;font-size:11.5px;min-height:32px}
64
+ .slm.ch-preview .slm-ch-flag{opacity:0;transition:opacity var(--slm-mo-base) var(--slm-mo-out)}
65
+
66
+ /* sticky staged bar */
67
+ .slm-ch-staged{position:absolute;left:12px;right:12px;bottom:12px;z-index:6;display:flex;align-items:center;gap:12px;
68
+ padding:10px 14px;min-height:44px;border-radius:12px;color:var(--slm-text);
69
+ background:color-mix(in srgb,var(--slm-surface) 96%,transparent);border:1px solid var(--slm-line);
70
+ box-shadow:0 12px 34px rgba(0,0,0,.45);font-size:12.5px;pointer-events:auto;
71
+ transform:translateY(calc(100% + 18px));opacity:0;
72
+ transition:transform var(--slm-mo-slow) var(--slm-mo-out),opacity var(--slm-mo-base) var(--slm-mo-out)}
73
+ .slm-ch-staged.on{transform:none;opacity:1}
74
+ /* Success keeps its own green \u2014 a semantic state, not a ground \u2014 so it states
75
+ its ink rather than inheriting a token that flips with the theme. */
76
+ .slm-ch-staged.done{background:rgba(31,122,77,.96);border-color:#1f7a4d;color:#fff}
77
+ .slm-ch-staged.shake{animation:slm-ch-shake var(--slm-mo-slow) var(--slm-mo-in-out) 2}
78
+ .slm-ch-staged b{font-variant-numeric:tabular-nums}
79
+ .slm-ch-staged .grow{flex:1}
80
+ .slm-ch-staged .go{padding:9px 16px;min-height:44px;display:inline-flex;align-items:center;border-radius:9px;
81
+ background:#f4b740;color:#1a1200;font-weight:800;font-size:12.5px}
82
+ .slm-ch-staged .go:disabled{opacity:.48;cursor:not-allowed}
83
+ .slm-ch-staged .drop{color:var(--slm-muted);font-weight:700;font-size:11.5px;min-height:44px;padding-inline:8px}
84
+ .slm-ch-tick{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:50%;
85
+ background:#fff;color:#1f7a4d;font-weight:900;font-size:11px;animation:slm-ch-tick var(--slm-mo-base) var(--slm-mo-spring)}
86
+ @keyframes slm-ch-shake{0%,100%{transform:none}25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}
87
+ @keyframes slm-ch-tick{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}
88
+
89
+ /* rail */
90
+ .slm-ch-viewseg{display:flex;gap:2px;padding:3px;border-radius:10px;
91
+ background:color-mix(in srgb,var(--slm-text) 8%,transparent);margin:4px 0 12px}
92
+ .slm-ch-viewseg button{flex:1;padding:6px 8px;min-height:32px;border-radius:8px;font-size:12.5px;font-weight:500;color:var(--slm-muted)}
93
+ .slm-ch-viewseg button.on{background:var(--slm-surface);color:var(--slm-text);font-weight:600;
94
+ box-shadow:0 1px 2px rgba(0,0,0,.12),inset 0 0 0 1px var(--slm-line)}
95
+ .slm-ch-viewseg button:disabled{opacity:.5;cursor:not-allowed}
96
+ .slm-ch-mapnav{margin:-2px 0 12px;padding:10px;border:1px solid var(--slm-line);border-radius:10px;background:var(--slm-surface)}
97
+ .slm-ch-mapnav-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--slm-muted)}
98
+ .slm-ch-mapnav-head button{color:var(--slm-accent);font-size:11px;font-weight:800;letter-spacing:0;text-transform:none;min-height:30px}
99
+ .slm-ch-mapnav .slm-ch-viewseg{margin:8px 0 5px}
100
+ .slm-ch-mapnav p{margin:0;font-size:11px;line-height:1.45;color:var(--slm-muted)}
101
+ .slm-ch-list{display:flex;flex-direction:column;gap:8px;margin-bottom:12px}
102
+ /* The list header is PINNED: it carries the only route to a new channel, and a
103
+ long channel list used to push that button past the fold. Sticky offsets are
104
+ measured from the scrollport's PADDING box, so the top offset is the negative
105
+ of the rail's own padding, and the header's matching padding covers that
106
+ strip \u2014 the list scrolls under an opaque header rather than through a gap
107
+ above it. The side bleed makes the rule reach both edges. */
108
+ .slm-ch-listhead{position:sticky;top:-16px;z-index:4;display:flex;align-items:center;justify-content:space-between;
109
+ gap:8px;margin:0 -16px 6px;padding:12px 16px 8px;background:var(--slm-bg)}
110
+ .slm-ch-listhead .slm-eyebrow{margin:0}
111
+ .slm-ch-listhead h2{margin:0;font-size:14px}
112
+ .slm .slm-ch-listhead .slm-linkbtn{font-size:11px;color:var(--slm-text)}
113
+ /* Compact primary: the rail's own button, sized to sit on one header line. */
114
+ .slm .slm-ch-new,.slm .slm-ch-small{flex:none;min-width:0;display:inline-flex;align-items:center;gap:6px;padding:6px 11px;min-height:30px;font-size:12px;border-radius:8px}
115
+ .slm .slm-ch-give{width:100%;margin-top:12px;display:flex;align-items:center;justify-content:center;gap:8px}
116
+ .slm-ch-assigncard{margin-top:6px;padding:12px;border-radius:12px;border:1px solid var(--slm-line);background:color-mix(in srgb,var(--slm-text) 3%,var(--slm-surface))}
117
+ .slm-ch-assigncard .slm-note{margin:8px 0 0}
118
+ .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
+ .slm-ch-giveto>:last-child{flex:1;min-width:0}
120
+ .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
+ background:color-mix(in srgb,var(--slm-accent) 10%,var(--slm-surface));font-size:12px;font-weight:500}
122
+ .slm-ch-stagedtop{display:flex;align-items:baseline;gap:8px;margin-bottom:6px}
123
+ .slm-ch-stagedtop b{font-size:26px;line-height:1;font-weight:700}.slm-ch-stagedtop span{flex:1;font-size:13px;font-weight:600}
124
+ .slm-ch-staged2>div:not(.slm-ch-stagedtop){padding:6px 0;border-top:1px solid var(--slm-line)}
125
+ .slm-ch-staged2 .add{color:color-mix(in srgb,#22a06b 75%,var(--slm-text))}.slm-ch-staged2 .move{color:color-mix(in srgb,#d99a0b 75%,var(--slm-text))}
126
+ .slm-ch-staged2 .same{color:var(--slm-muted)}
127
+ .slm .slm-ch-wide{width:100%;justify-content:center;margin-top:8px}
128
+ .slm-ch-seeas label{font-size:12px;font-weight:600;color:var(--slm-text)}
129
+ .slm-ch-check{display:flex;gap:8px;align-items:center;margin:10px 0;font-size:12px;font-weight:500;color:var(--slm-text)}
130
+ .slm-ch-skel{height:64px;margin-top:8px;border-radius:12px;background:color-mix(in srgb,var(--slm-text) 8%,transparent)}
131
+ .slm-ch-empty{margin-top:14px;padding:18px 16px;border-radius:14px;border:1px dashed var(--slm-line);text-align:center;
132
+ background:color-mix(in srgb,var(--slm-text) 3%,var(--slm-surface))}
133
+ .slm-ch-empty b{display:block;margin-top:10px;font-size:14px}
134
+ .slm-ch-empty p{margin:6px 0 12px;font-size:12.5px;line-height:1.5;color:var(--slm-muted)}
135
+ .slm[data-theme=light] .slm-ch-badge.active,.slm[data-theme=light] .slm-ch-counts .free b{color:#137047}
136
+ .slm[data-theme=light] .slm-ch-badge.paused{color:#815705}
137
+ .slm[data-theme=light] .slm-ch-badge.archived{color:var(--slm-muted)}
138
+ .slm-ch-row{padding:10px 12px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface);
139
+ text-align:left;width:100%;display:block;transition:border-color var(--slm-mo-quick) var(--slm-mo-out)}
140
+ .slm-ch-row:hover{border-color:var(--slm-muted)}
141
+ .slm-ch-row.on{border-color:var(--slm-accent);box-shadow:0 0 0 1px color-mix(in srgb,var(--slm-accent) 40%,transparent)}
142
+ .slm-ch-row.archived{opacity:.68}
143
+ .slm-ch-head{display:flex;align-items:center;gap:10px}
144
+ .slm-ch-mk{width:24px;height:24px;border-radius:7px;display:grid;place-items:center;font-size:12px;font-weight:700;
145
+ color:var(--slm-ch-marker-ink);flex:none}
146
+ .slm-ch-mk.dim{opacity:.55}
147
+ .slm-ch-name{flex:1;min-width:0;font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
148
+ .slm-ch-badge{flex:none;font-size:10.5px;font-weight:600;padding:2px 8px;border-radius:999px}
149
+ .slm-ch-badge.active{background:rgba(34,160,107,.16);color:#5bd39b}
150
+ .slm-ch-badge.paused{background:rgba(244,183,64,.15);color:#f7ca6b}
151
+ .slm-ch-badge.builtin{background:color-mix(in srgb,var(--slm-text) 8%,transparent);color:var(--slm-muted)}
152
+ .slm-ch-badge.archived{background:rgba(139,148,172,.18);color:#c2c9d8}
153
+ .slm-ch-counts{display:block;margin-top:5px;font-size:11.5px;font-weight:500;color:var(--slm-text);
154
+ font-variant-numeric:tabular-nums}
155
+ .slm-ch-counts i{font-style:normal;margin:0 5px;color:var(--slm-muted)}
156
+ .slm-ch-counts b{color:var(--slm-text);font-weight:600}
157
+ .slm-ch-counts .free b{color:#5bd39b}
158
+ .slm-ch-counts b.bump{animation:slm-ch-bump var(--slm-mo-base) var(--slm-mo-spring)}
159
+ @keyframes slm-ch-bump{0%,100%{transform:none}35%{transform:translateY(-2px) scale(1.08)}}
160
+ .slm-ch-access{display:block;margin-top:2px;font-size:11.5px;color:var(--slm-muted)}
161
+ /* A row that opens its channel must READ as pressable, and be one for a keyboard
162
+ too. It is a role="button" div rather than a <button> because the \u22EF control
163
+ lives inside it, and a button inside a button is not valid HTML. */
164
+ .slm-ch-row.open{cursor:pointer}
165
+ .slm-ch-row.open:hover{border-color:var(--slm-accent);background:color-mix(in srgb,var(--slm-accent) 6%,var(--slm-surface))}
166
+ .slm-ch-row.open:focus-visible{outline:2px solid var(--slm-accent);outline-offset:2px}
167
+ .slm-ch-row.open:active{border-color:var(--slm-accent)}
168
+ .slm-ch-more{flex:none;color:var(--slm-muted);font-weight:800;padding:0 4px;min-height:28px;border-radius:6px}
169
+ .slm-ch-more:hover{color:var(--slm-text)}
170
+ .slm-ch-more:focus-visible{outline:2px solid var(--slm-accent);outline-offset:1px;color:var(--slm-text)}
171
+ .slm-ch-menu{display:flex;flex-direction:column;gap:8px}
172
+ .slm-ch-menu .slm-btn{width:100%}
173
+ /* loading is a state, never a flash of empty: same slot, visibly working */
174
+ .slm-ch-busy{display:flex;align-items:center;gap:9px;font-size:12.5px;color:var(--slm-muted);padding:12px 0}
175
+ .slm-ch-busy::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--slm-accent);flex:none;
176
+ animation:slm-ch-pulse var(--slm-mo-ambient) var(--slm-mo-in-out) infinite}
177
+ @keyframes slm-ch-pulse{0%,100%{opacity:.25;transform:scale(.7)}50%{opacity:1;transform:scale(1)}}
178
+ .slm-ch-selnum.bump{animation:slm-ch-bump var(--slm-mo-base) var(--slm-mo-spring)}
179
+ .slm-ch-row2{display:flex;gap:8px;margin-top:8px}
180
+ .slm-ch-row2 .slm-btn{flex:1;min-width:0}
181
+ /* distribute routes \u2014 four choices, each with the one sentence that explains it.
182
+ The current one is NAMED in its own card, never signalled by colour alone. */
183
+ .slm-ch-dist{display:block;padding:10px 12px;margin-top:6px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface)}
184
+ .slm-ch-dist.on{border-color:var(--slm-accent);background:color-mix(in srgb,var(--slm-accent) 12%,var(--slm-surface))}
185
+ .slm-ch-dist .top{display:flex;align-items:center;gap:8px}
186
+ .slm-ch-dist .top b{flex:1;font-size:12.5px;font-weight:600}
187
+ .slm-ch-dist .cur{font-size:10px;font-weight:600;padding:2px 8px;border-radius:999px;color:color-mix(in srgb,var(--slm-accent) 60%,var(--slm-text));
188
+ background:color-mix(in srgb,var(--slm-accent) 18%,transparent);white-space:nowrap}
189
+ .slm-ch-dist .why{display:block;margin-top:3px;color:var(--slm-muted);font-size:11.5px;line-height:1.4}
190
+ .slm-ch-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:14px}
191
+ .slm-ch-link .slm-ch-acts{margin-top:8px}
192
+ .slm-ch-link .lk-facts{display:block;margin-top:4px;font-size:11.5px;line-height:1.45;color:var(--slm-muted)}
193
+ .slm-ch-alert{display:flex;align-items:flex-start;gap:9px;padding:11px 13px;border-radius:10px;font-size:12.5px;
194
+ line-height:1.5;margin-bottom:12px}
195
+ .slm-ch-alert.warn{background:rgba(244,183,64,.1);border:1px solid rgba(244,183,64,.4);color:var(--slm-text)}
196
+ .slm-ch-alert.info{background:rgba(110,123,255,.12);border:1px solid rgba(110,123,255,.44);color:var(--slm-text)}
197
+ .slm-ch-alert.err{background:rgba(229,72,77,.1);border:1px solid rgba(229,72,77,.45);color:var(--slm-text)}
198
+ .slm-ch-alert b{color:inherit}
199
+ .slm-ch-alert button{display:block;margin-top:6px;color:var(--slm-text);font-weight:800;min-height:36px}
200
+ .slm-ch-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
201
+
202
+ /* dialogs */
203
+ .slm-ch-bucket{display:grid;grid-template-columns:24px 1fr auto;align-items:center;gap:10px;padding:9px 4px;
204
+ border-top:1px solid var(--slm-line);font-size:12.5px;animation:slm-ch-bucket var(--slm-mo-base) var(--slm-mo-out) both}
205
+ .slm-ch-bucket:first-of-type{border-top:0}
206
+ .slm-ch-bucket .ico{width:20px;height:20px;border-radius:6px;display:grid;place-items:center;font-size:10px;font-weight:800}
207
+ .slm-ch-bucket .ico.add{background:rgba(34,160,107,.18);color:#5bd39b}
208
+ .slm-ch-bucket .ico.move{background:rgba(167,139,250,.18);color:#c4b5fd}
209
+ .slm-ch-bucket .ico.same{background:var(--slm-tint-strong);color:var(--slm-muted)}
210
+ .slm-ch-bucket .ico.skip{background:rgba(244,183,64,.16);color:#f7ca6b}
211
+ /* The three remaining icon inks are semantic (added / moved / skipped) and are
212
+ tuned for a dark ground; a light ground needs the darker end of the same hue
213
+ to stay readable, exactly as the status badges above already do. */
214
+ .slm[data-theme=light] .slm-ch-bucket .ico.add{color:#137047}
215
+ .slm[data-theme=light] .slm-ch-bucket .ico.move{color:#6d28d9}
216
+ .slm[data-theme=light] .slm-ch-bucket .ico.skip{color:#815705}
217
+ .slm-ch-bucket b{font-variant-numeric:tabular-nums;font-weight:800}
218
+ .slm-ch-bucket .why{color:var(--slm-muted);font-size:11px}
219
+ .slm-ch-bucket .peek{color:var(--slm-muted);font-size:11px;font-variant-numeric:tabular-nums}
220
+ @keyframes slm-ch-bucket{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
221
+ .slm-ch-secret{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px dashed rgba(244,183,64,.55);
222
+ border-radius:10px;background:rgba(244,183,64,.06);color:var(--slm-text);
223
+ font-family:ui-monospace,Menlo,monospace;font-size:11px;
224
+ overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
225
+ .slm-ch-price-list{display:flex;flex-direction:column;gap:7px}
226
+ .slm-ch-price-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(100px,132px);align-items:center;gap:12px;
227
+ padding:9px 0;border-bottom:1px solid var(--slm-line)}
228
+ .slm-ch-price-row:last-child{border-bottom:0}
229
+ .slm-ch-price-row>span{min-width:0;display:flex;flex-direction:column;gap:3px}
230
+ .slm-ch-price-row b{font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
231
+ .slm-ch-price-row small{font-size:10.5px;color:var(--slm-muted);font-weight:500}
232
+ .slm-ch-price-row .slm-input{margin:0;text-align:right;font-variant-numeric:tabular-nums}
233
+
234
+ /* buyer links \u2014 STATUS only on the listing card: the URL is revealed once, at
235
+ creation, and the server keeps only a fingerprint, so there is nothing for a
236
+ listing-card Copy to write. Copy lives on the reveal sheet, where the string
237
+ actually exists. */
238
+ .slm-ch-link{padding:10px 12px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface);
239
+ margin:6px 0 8px}
240
+ .slm-ch-link .lk-head{display:flex;align-items:center;gap:8px}
241
+ .slm-ch-link .lk-name{flex:1;min-width:0;font-size:12.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;
242
+ white-space:nowrap}
243
+ /* The revealed URL: one mono line that truncates rather than wrapping the sheet
244
+ out of shape. The full string stays in the title attribute and in the copy. */
245
+ .slm-ch-copyrow{display:flex;align-items:center;gap:8px;margin-top:8px}
246
+ .slm-ch-copyrow .slm-ch-secret{flex:1;min-width:0;margin:0}
247
+ .slm-ch-copyrow .slm-btn{flex:none;min-width:0;padding:8px 12px;min-height:40px;font-size:12px;
248
+ transition:opacity var(--slm-mo-quick) var(--slm-mo-out)}
249
+ /* "Copied" is a moment on the same control, never a second control: the label
250
+ changes and the button dims for the length of the confirmation. */
251
+ .slm-ch-copyrow .slm-btn.copied{opacity:.72}
252
+ .slm-ch-copysink{position:absolute;left:-9999px;top:0;width:1px;height:1px;opacity:0}
253
+ .slm-ch-lkrow{display:flex;gap:8px;margin-top:5px;font-size:11px;color:var(--slm-muted)}
254
+ .slm-ch-lkrow .k{flex:none;min-width:104px}
255
+ .slm-ch-lkrow .v{color:var(--slm-text);font-variant-numeric:tabular-nums}
256
+ .slm-ch-radio{display:flex;gap:9px;align-items:flex-start;padding:11px 12px;border:1px solid var(--slm-line);
257
+ border-radius:10px;margin-top:8px;font-size:12.5px;cursor:pointer;
258
+ transition:border-color var(--slm-mo-quick) var(--slm-mo-out)}
259
+ .slm-ch-radio:hover{border-color:var(--slm-muted)}
260
+ .slm-ch-radio input{flex:none;margin-top:2px}
261
+ .slm-ch-radio b{display:block;font-weight:800;margin-bottom:2px}
262
+ .slm-ch-radio .why{display:block;color:var(--slm-muted);font-size:11.5px;line-height:1.45}
263
+
264
+ /* compact: bottom sheet with three detents (\xA713) */
265
+ .slm.compact.ch-sheet .slm-rail{position:absolute;left:0;right:0;bottom:0;z-index:8;border-top:1px solid var(--slm-line);
266
+ border-radius:18px 18px 0 0;background:var(--slm-surface);color:var(--slm-text);
267
+ transition:height var(--slm-mo-slow) var(--slm-mo-in-out)}
268
+ .slm.compact.ch-sheet.detent-collapsed .slm-rail{height:132px}
269
+ .slm.compact.ch-sheet.detent-medium .slm-rail{height:46%}
270
+ .slm.compact.ch-sheet.detent-full .slm-rail{height:92%}
271
+ .slm.compact.ch-sheet .slm-railscroll{padding:8px 14px calc(12px + env(safe-area-inset-bottom,0px))}
272
+ /* Same pinned header in the sheet, bled against the sheet's own padding so the
273
+ create action is in reach at every detent. */
274
+ .slm.compact.ch-sheet .slm-ch-listhead{top:-8px;margin:0 -14px 10px;padding:8px 14px 8px}
275
+ .slm.compact .slm-ch-new{min-height:40px}
276
+ .slm-ch-grab{display:none}
277
+ .slm.compact.ch-sheet .slm-ch-grab{display:flex;align-items:center;gap:10px;width:100%;padding:6px 0 10px}
278
+ .slm-ch-grabbar{width:42px;height:4px;border-radius:2px;background:var(--slm-muted);margin:0 auto}
279
+ .slm.compact .slm-ch-staged{bottom:auto;top:8px}
280
+ .slm.compact .slm-btn,.slm.compact .slm-ch-row,.slm.compact .slm-ch-viewseg button{min-height:44px}
281
+ @media (prefers-reduced-motion:reduce){
282
+ .slm-ch-layer,.slm-ch-banner,.slm-ch-staged,.slm-ch-row,.slm.compact.ch-sheet .slm-rail,
283
+ .slm-ch-radio,.slm-ch-copyrow .slm-btn{transition:none!important}
284
+ .slm-ch-staged.shake,.slm-ch-tick,.slm-ch-bucket,.slm-ch-scrim,.slm-ch-dialog,
285
+ .slm-ch-counts b.bump,.slm-ch-selnum.bump{animation:none!important}
286
+ .slm-ch-busy::before{animation:none!important;opacity:1}
287
+ .slm-ch-staged.shake{outline:2px solid #e5484d;outline-offset:2px}
288
+ .slm-ch-staged.done{outline:2px solid #5bd39b;outline-offset:2px}
289
+ }
290
+ `;var ut=3e4,I=5e3,j=ae({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"}),Me=3e4,pt='<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>',mt={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."]},gt='<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>',bt='<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>',vt='<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>',De=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 n={selectionLabels:()=>e.selectionLabels(),selectByLabels:s=>e.selectByLabels(s),clearSelection:()=>e.clearSelection(),selectSection:s=>e.selectSection(s),sections:()=>e.sections(),labelsInSection:s=>e.labelsInSection(s),rows:()=>e.rows(),categories:()=>e.categories(),labelsInCategory:s=>e.labelsInCategory(s),seats:()=>e.seats(),statusOf:s=>e.statusOf(s),sectionOfLabel:s=>e.sectionOfLabel(s),seatMeta:s=>{let a=this.allocation.get(s)??b;return`${this.nameOf(a)??C} \xB7 ${e.statusOf(s)??"free"}`},openDialog:(s,a)=>this.renderScrim(s,a),closeDialog:()=>this.closeDialog(),pickers:e.pickers,pickerFailed:e.pickerFailed,enhanceDialog:e.enhanceDialog,cap:I};this.chooser=new _(n)}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})},ut),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,n=()=>t!==this.listSeq;try{let s=await this.host.api.channels(this.host.eventKey,{includeArchived:this.showArchived});if(n())return;if(this.list=s,this.assignmentVersion=s.assignmentVersion,this.loadError=null,this.targetChannelId||(this.targetChannelId=s.channels.find(a=>a.state==="active")?.id??b),this.allocationVersion!==s.assignmentVersion){if(await this.loadAllocation(t),n())return;this.allocationVersion=s.assignmentVersion}if(this.detailChannelId&&await this.loadLinks(this.detailChannelId),n())return;this.loading=!1,this.active&&(this.paintRail(),this.paintOverlay()),this.host.channelsChanged?.()}catch(s){if(n())return;this.loading=!1,s instanceof p&&s.status===403&&(this.caps={view:!1,manage:!1}),this.loadError=s,e.quiet||this.host.onError(s),this.active&&this.paintRail()}}async loadAllocation(e){let t=new Map,n;for(let s=0;s<200;s+=1){if(e!==void 0&&e!==this.listSeq)return;let a=await this.host.api.channelAllocation(this.host.eventKey,{afterLabel:n,limit:1e3});for(let o of a.allocations)$(o.channelId)||t.set(o.label,o.channelId);if(this.assignmentVersion=a.assignmentVersion,!a.nextAfterLabel)break;n=a.nextAfterLabel}e!==void 0&&e!==this.listSeq||(this.allocation=t)}legendChannels(){return this.list?[{label:this.list.publicSale.name||C,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($(e))return{id:b,name:this.list?.publicSale?.name??C,marker:"P",color:null};let t=this.list?.channels.find(n=>n.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)??b):null}markerFor(e){let t=Math.max(0,this.list?.channels.findIndex(s=>s.id===e)??0),n=this.channelById(e);return ce(n??{id:e,name:"?",marker:null,color:null},t)}assignableChannels(){return[{id:b,name:this.list?.publicSale.name??C},...(this.list?.channels??[]).filter(e=>e.state!=="archived").map(e=>({id:e.id,name:e.name}))]}currentPlan(){let e=this.host.selectionLabels(),t=de({labels:e,targetChannelId:this.targetChannelId,allocation:this.allocation,statusOf:n=>this.host.statusOf(n),nameOf:n=>this.nameOf(n)});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
+ <canvas class="slm-ch-canvas" data-ch="canvas" aria-hidden="true"></canvas>
292
+ <div class="slm-ch-banner" data-ch="banner" role="status"></div>
293
+ <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(n=>n.remove())}paintOverlay(){let e=this.canvas,t=this.layer;!e||!t||!this.overlayVisible||Te({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:n=>this.markerFor(n),onSectionTargetClick:n=>{this.focusedSectionId=n,this.host.focusSection(n),this.paintRail()}})}setStaged(e,t=""){let n=this.stagedEl;if(n){if(!e){n.classList.remove("on","done","shake"),n.innerHTML="";return}n.innerHTML=e,n.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?.(V(t)),!e.length){this.setStaged(null);return}let n=this.nameOf(this.targetChannelId)??C,s=V(t),a=e.length>I,o=t.skippedHeld.count+t.skippedBooked.count,r=[`<b>${e.length.toLocaleString()}</b> selected`,`<b>+${s.toLocaleString()}</b> to ${d(n)}`];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
+ <span>${r.join(" \xB7 ")}</span>
296
+ <span class="grow"></span>
297
+ <button type="button" class="drop" data-ch-act="discard">Discard</button>
298
+ <button type="button" class="go" data-ch-act="review"${a?" disabled":""}>
299
+ ${a?`Maximum ${I.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="",n){let s=this.bannerEl;if(!s)return;if(this.host.root.classList.toggle("ch-preview",e),!e){s.classList.remove("on"),s.innerHTML="";return}let a=this.previewAudience.length===1?this.markerFor(this.previewAudience[0]):{color:"var(--slm-accent)",letter:""},o=n==null?"":` \xB7 ${n.toLocaleString()} ${n===1?"seat":"seats"} available now`;s.innerHTML=`<span class="dot" style="background:${d(a.color)}"></span>
301
+ Previewing buyer access \xB7 ${d(t)}${o} \xB7 read-only
302
+ <button type="button" data-ch-act="exit-preview">Exit preview</button>`,s.classList.add("on"),s.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(n=>n.state==="active");this.previewAudience=[t?t.id:b]}this.loadPreview()}this.paintRail(),this.paintOverlay(),this.paintStagedBar(),this.onInteractionChange?.()}async loadPreview(){let e=[...this.previewAudience],t=e.map(n=>this.nameOf(n)??C).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($)}),this.previewState="ready";let n=this.previewProjection.available===!1?void 0:this.previewProjection.counts?.eligible??this.previewProjection.eligible?.length;this.setBanner(!0,t,n)}catch(n){let s=n instanceof p?n.status:0;this.previewState=s===404||s===405||s===501?"unsupported":"error",this.previewProjection=null,this.previewState==="error"&&this.host.onError(n)}this.active&&(this.paintRail(),this.paintOverlay())}setRailHtml(e){if(e===this.railHtml)return!1;let t=this.host.rail,n=t.scrollTop;return t.innerHTML=e,this.railHtml=e,n&&(t.scrollTop=n),!0}paintRail(){if(!this.active)return;let e=this.host.rail;if(!this.caps.view){this.setRailHtml(`${j}${y("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(`${j}${this.viewSegmentHtml()}
303
+ <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(`${j}${this.viewSegmentHtml()}
305
+ <div data-ch-state="list-error" role="alert">${y("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(),n=this.host.isCompact()?'<div class="slm-ch-grab"><span class="slm-ch-grabbar"></span></div>':"",s=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(`${n}${j}${s}${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
+ <button type="button" class="${e.trim()}" data-ch-view="inspect"
308
+ aria-pressed="${this.view==="inspect"}">Allocation</button>
309
+ <button type="button" class="${t.trim()}" data-ch-view="preview"
310
+ 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>${d(e)}</span>
312
+ <button type="button" data-ch-act="sections">All sections</button></div>`:""}countsHtml(e,t){let n=(s,a,o,r="")=>{let l=this.lastCounts.get(`${t}:${s}`),c=l!=null&&l!==a?" bump":"";return this.lastCounts.set(`${t}:${s}`,a),`<span class="${r}"><b class="${c.trim()}">${a.toLocaleString()}</b> ${o}</span>`};return`<span class="slm-ch-counts">${[n("allocated",e.allocated,"allocated"),n("free",e.free,"free","free"),n("booked",e.booked,"sold"),e.held?n("held",e.held,"in a cart"):""].filter(Boolean).join('<i aria-hidden="true">\xB7</i>')}</span>`}channelRowHtml(e,t={}){let n=this.markerFor(e.id),s=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="${d(e.id)}"
313
+ aria-label="More actions for ${d(e.name)}" aria-haspopup="dialog">\u22EF</button>`:"",c=o?` role="button" tabindex="0" data-ch-open="${d(e.id)}"
314
+ aria-label="Open ${d(e.name)}"`:"";return`<div class="${r}"${c}>
315
+ <span class="slm-ch-head">
316
+ <span class="slm-ch-mk${a}" style="background:${d(n.color)}" aria-hidden="true">${d(n.letter)}</span>
317
+ <span class="slm-ch-name">${d(e.name)}</span>
318
+ <span class="slm-ch-badge ${s}">${d(ke(t.builtin?"builtin":e.state))}</span>
319
+ ${l}
320
+ </span>
321
+ ${this.countsHtml(e.counts,e.id||"public")}
322
+ <span class="slm-ch-access">${t.builtin?"Everyone on your event page":d(me(e.access))}</span>
323
+ </div>`}listRailHtml(){let e=this.list,t=e.channels.filter(l=>l.state==="archived").length,n=e.channels.filter(l=>this.showArchived||l.state!=="archived"),s=[this.channelRowHtml(e.publicSale,{builtin:!0}),...n.map((l,c)=>this.channelRowHtml(l,{index:c}))].join(""),a=n.length?"":`<div class="slm-ch-empty" data-ch-state="list-empty">${P("route","#ea7a1e",40)}
324
+ <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">${bt}New channel</button>`:"";return`${this.caps.manage?"":y("info","You can see, not change"," You can see how seats are shared out. Changing it needs channel-management permission.","lock")}${this.appliedHtml()}
326
+ <div class="slm-ch-listhead"><p class="slm-eyebrow">Sales channels</p>${o}</div>
327
+ <div class="slm-ch-list">${s}</div>
328
+ ${a}
329
+ ${this.assignEntryHtml()}
330
+ <p class="slm-note" style="margin-top:10px" ${t||this.showArchived?"":"hidden"}>
331
+ <button type="button" class="slm-linkbtn" data-ch-act="toggle-archived" aria-pressed="${this.showArchived}"
332
+ style="text-align:left">${this.showArchived?"Hide":"Show"} archived${t?` (${t})`:""}</button>
333
+ </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">${vt}Give seats to a channel</button>`:""}assignmentToolsHtml(e={}){let t=this.assignableChannels().map(a=>`<option value="${d(a.id)}"${a.id===this.targetChannelId?" selected":""}>${d(a.name)}</option>`).join(""),n=this.mapIntent==="assign"?"slm-btn":"slm-btn ghost";return`
335
+ <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>
338
+ <div class="slm-field slm-ch-giveto">
339
+ <label for="slm-ch-target">Give seats to</label>
340
+ <select class="slm-select" id="slm-ch-target" data-ch-target>${t}</select>
341
+ </div>
342
+ ${this.chooser.chipsHtml({intents:`<button type="button" class="${n}" data-ch-act="drag-select">Drag box</button>`})}
343
+ <p class="slm-note">Pick seats on the map, then review. Nothing moves until
344
+ you apply; seats in a cart or sold never move.</p>
345
+ </div>`}selectionRailHtml(e){let t=he(e,this.allocation,this.list),n=this.targetChannelId,s=n&&this.nameOf(n)||"this channel",a=this.conflict?`<div role="alert">${y("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>I,l=0,c=t.map(m=>{let g=m.count.toLocaleString();return m.channelId===n?(l+=m.count,`<div class="same">= ${g} already in ${d(s)}</div>`):$(m.channelId)?`<div class="add">+ ${g} from ${d(m.name)}</div>`:`<div class="move">\u21C4 ${g} from ${d(m.name)}</div>`}).join(""),h=e.length-l,u=r?`Choose at most ${I.toLocaleString()} seats`:h?`Review ${h.toLocaleString()} ${h===1?"change":"changes"}`:"Review the selection";return`
347
+ ${a}
348
+ ${this.assignmentToolsHtml()}
349
+ <div class="slm-ch-staged2" aria-live="polite" aria-label="Selection sources">
350
+ <div class="slm-ch-stagedtop"><b class="slm-ch-selnum${o}">${e.length.toLocaleString()}</b><span>${e.length===1?"seat":"seats"} selected</span>
351
+ <button type="button" class="slm-linkbtn" data-ch-act="discard">Clear</button></div>
352
+ ${c}
353
+ </div>
354
+ ${r?y("warn","Too many seats for one change",` One change can move up to ${I.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":""}>${u}</button>
356
+ <p class="slm-note">Nothing moves until you apply.</p></div>`}detailRailHtml(e){let t=`<p class="slm-eyebrow">
357
+ <button type="button" class="slm-linkbtn" data-ch-act="back" style="text-align:left">\u2039 All channels</button>
358
+ </p>`,n=this.list?.channels.find(l=>l.id===e);if(!n)return`${t}
359
+ <div class="slm-ch-alert warn" role="status" data-ch-state="detail-gone"><span>\u2139</span>
360
+ <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 s=this.caps.manage?this.distributeHtml(n):"",a=n.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"}">${pt}Prices${a?` \xB7 ${a.toLocaleString()} custom`:""}</button>`:"",r=this.caps.manage?`<div class="slm-ch-acts">${o}
362
+ <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="rename">Rename</button>
363
+ <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="pause">${n.state==="paused"?"Resume":"Pause"}</button>
364
+ <button type="button" class="slm-btn ghost slm-ch-small" data-ch-act="archive">Archive\u2026</button></div>`:"";return`
365
+ ${t}
366
+ <div class="slm-ch-list">${this.channelRowHtml(n)}</div>
367
+ ${s}
368
+ ${r}`}distributeHtml(e){let t=e.access?.intent??"none",n=this.linksState!=="unsupported",s=(a,o)=>{let r=a===t,[l,c]=mt[a];return`<div class="slm-ch-dist${r?" on":""}" data-ch-route="${d(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="${d(o)}">Switch</button>`}</span>
370
+ <span class="why">${c}</span>
371
+ </div>`};return`
372
+ <p class="slm-eyebrow" style="margin-top:14px">How buyers reach it</p>
373
+ ${n||t==="hosted_link"?s("hosted_link","link-create"):""}
374
+ ${s("server","embed-code")}
375
+ ${s("internal","route-internal")}
376
+ ${s("none","route-none")}
377
+ ${this.hostedLinksHtml(t==="hosted_link")}
378
+ ${t==="server"?Re:""}`}async loadLinks(e){if(!this.caps.view)return;let t=++this.linksSeq,n=()=>t!==this.linksSeq||this.linksChannelId!==e;this.linksChannelId!==e&&(this.links=[],this.linksChannelId=e,this.linksState="loading");try{let s=await this.host.api.accessLinks(this.host.eventKey,e);if(n())return;this.links=s.links??[],this.linksState="ready"}catch(s){if(n())return;let a=s instanceof p?s.status:0;this.links=[],this.linksState=a===404||a===405||a===501?"unsupported":"error",this.linksState==="error"&&this.host.onError(s)}}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">${y("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">${y("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
+ <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
+ ${this.links.map((n,s)=>this.linkCardHtml(n,s===0&&e)).join("")}
381
+ <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 n=be(e),s=this.caps.manage&&ve(e),a=this.caps.manage&&(s||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>':""}${s?`<button type="button" class="slm-btn ghost slm-ch-small" data-ch-rotate="${d(e.id)}">Rotate</button>
383
+ <button type="button" class="slm-btn ghost slm-ch-small" data-ch-revoke="${d(e.id)}">Revoke</button>`:""}</div>`:"";return`<div class="slm-ch-link">
384
+ <span class="lk-head">
385
+ <span class="lk-name">${d(e.label||"Buyer link")}</span>
386
+ <span class="slm-ch-badge ${n.kind}">${d(n.text)}</span>
387
+ </span>
388
+ <span class="lk-facts">${d(fe(e))}</span>
389
+ ${a}
390
+ </div>`}previewRailHtml(){let e=[{id:b,name:this.list?.publicSale.name??C},...(this.list?.channels??[]).filter(g=>g.state!=="archived").map(g=>({id:g.id,name:g.name}))],t=this.previewAudience[0]??b,n=e.map(g=>`<option value="${d(g.id)}"${g.id===t?" selected":""}>${d(g.name)}</option>`).join(""),s=$(t)?"a buyer on your event page":`a ${this.nameOf(t)??"channel"} buyer`,a=this.previewState==="unsupported"?`<div data-ch-state="preview-unsupported">${y("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 ${d(s)} sees\u2026</div>`:"",r=this.previewState==="error"?`<div data-ch-state="preview-error" role="alert">${y("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?y("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.`):"",h=this.previewProjection?.counts?.eligible??this.previewProjection?.eligible?.length,u=h!=null&&this.previewProjection?.available!==!1?y("ok",`${h.toLocaleString()} ${h===1?"seat is":"seats are"} available to them now`,` Exactly what ${s} sees. Read-only: nothing is held.${this.previewProjection?.includePublic===!1?" Public sale seats are not part of this access.":""}`,"eye"):"",m=$(t)?"":`
392
+ <label class="slm-ch-check"><input type="checkbox" data-ch-includepublic ${this.previewIncludePublic?"checked":""} />
393
+ Also include Public sale seats</label>`;return`
394
+ <div class="slm-field slm-ch-seeas">
395
+ <label for="slm-ch-audience">See it as</label>
396
+ <select class="slm-select" id="slm-ch-audience" data-ch-audience>${n}</select>
397
+ </div>
398
+ ${m}
399
+ ${o}${r}${a}${c}${u}`}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 n=e.querySelector("[data-ch-audience]");n?.addEventListener("change",()=>{this.previewAudience=[n.value],this.loadPreview()});let s=e.querySelector("[data-ch-includepublic]");s?.addEventListener("change",()=>{this.previewIncludePublic=s.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),n=e.intentTo;if(!t||!n||!this.caps.manage){this.closeDialog();return}let{headline:s,consequences:a}=ge(e.switchBlocked);this.renderScrim(`
400
+ <h3 id="slm-ch-dlg-title">Change how ${d(t.name)} reaches buyers?</h3>
401
+ <p class="sub">${d(s)}</p>
402
+ <div class="slm-ch-alert warn" role="alert"><span>\u26A0</span><span>
403
+ ${a.map(o=>`<span style="display:block;margin-bottom:6px">${d(o)}</span>`).join("")}
404
+ </span></div>
405
+ ${e.pendingLink?`<p class="slm-note">Your new buyer link is created as soon as
406
+ 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"}>${d(e.error??"")}</p>
408
+ <div class="foot">
409
+ <button type="button" class="quiet" data-ch-close>Leave it as it is</button>
410
+ <button type="button" class="slm-btn" data-ch-intent-ack${e.busy?" disabled":""}>
411
+ ${e.busy?"Changing\u2026":`Change to "${d(H(n))}"`}</button>
412
+ </div>`,o=>{o.querySelector("[data-ch-intent-ack]")?.addEventListener("click",()=>{this.acknowledgeIntentSwitch(n,e.pendingLink??null)})})}async acknowledgeIntentSwitch(e,t){let n=this.detailChannelId;if(!n){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(n,t)}renderScrim(e,t){let n=this.scrimEl;n||(this.lastFocus=document.activeElement??null),n?.remove();let s=document.createElement("div");s.className="slm-ch-scrim",s.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(s),this.scrimEl=s;let a=s.firstElementChild;a.querySelectorAll("[data-ch-close]").forEach(r=>{r.addEventListener("click",()=>this.closeDialog())}),s.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],h=l[l.length-1];r.shiftKey&&document.activeElement===c?(r.preventDefault(),h.focus()):!r.shiftKey&&document.activeElement===h&&(r.preventDefault(),c.focus())}),t(a),ne(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(s=>T(s.marker||s.name,"")),n=W("",t);this.renderScrim(`
414
+ <h3 id="slm-ch-dlg-title">New sales channel</h3>
415
+ <p class="sub">A named share of seats only the right buyers can reach. You pick the seats next.</p>
416
+ <div class="slm-field">
417
+ <label for="slm-ch-name">Name</label>
418
+ <input class="slm-input" id="slm-ch-name" maxlength="80" />
419
+ <p class="slm-note">Shown to your team and in reports, never to buyers.</p>
420
+ </div>
421
+ <div class="slm-field">
422
+ <label>Marker</label>
423
+ <div style="display:flex;gap:8px;align-items:center">
424
+ <span class="slm-ch-mk" data-ch-marker style="background:${d(n.color)};width:28px;height:28px;font-size:13px">${d(n.letter)}</span>
425
+ <span class="slm-note" style="margin:0">The letter comes from the name; the colour is picked for you.</span>
426
+ </div>
427
+ </div>
428
+ <div class="slm-field">
429
+ <label for="slm-ch-ref">Your reference <span style="text-transform:none;font-weight:500">(optional)</span></label>
430
+ <input class="slm-input" id="slm-ch-ref" maxlength="120" placeholder="e.g. travel-agency-a" />
431
+ <p class="slm-note">For your own system and webhooks.</p>
432
+ </div>
433
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${d(e.error??"")}</p>
434
+ <div class="foot">
435
+ <button type="button" class="quiet" data-ch-close>Cancel</button>
436
+ <button type="button" class="slm-btn ghost" data-ch-create="plain">Create without seats</button>
437
+ <button type="button" class="slm-btn" data-ch-create="allocate">Create and pick seats</button>
438
+ </div>`,s=>{let a=s.querySelector("#slm-ch-name"),o=s.querySelector("[data-ch-marker]");a.addEventListener("input",()=>{let r=W(a.value,t);o.textContent=r.letter,o.style.background=r.color}),s.querySelectorAll("[data-ch-create]").forEach(r=>{r.addEventListener("click",()=>{let l=r.dataset.chCreate==="allocate";this.createChannel(a.value,o.textContent??"",o.style.background,s.querySelector("#slm-ch-ref")?.value??"",l)})})})}async createChannel(e,t,n,s,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:T(t,"")||null,color:n||null,externalRef:s.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 p?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:n}=this.currentPlan(),s=e.applied,a=s?s.buckets:n,o=this.nameOf(s?.targetChannelId??this.targetChannelId)??C,r=ue(a,o),l=s?s.applied:V(n),c=!s&&t.length>0&&l===0,h=!s&&t.length>I,u=ee(r),m=s?'<div class="foot"><button type="button" class="slm-btn" data-ch-close>Done</button></div>':`<div class="foot">
439
+ <button type="button" class="quiet" data-ch-close>Back</button>
440
+ <button type="button" class="slm-btn" data-ch-apply ${c||h||e.busy?"disabled":""}>
441
+ ${e.busy?"Applying\u2026":`Apply ${l.toLocaleString()} change${l===1?"":"s"}`}
442
+ </button>
443
+ </div>`,g=c?y("warn","Nothing here can move right now",` Every seat is in a buyer's cart, already sold, or already in ${o}.`):"",k=h?y("warn","Too many seats for one change",` One change can move up to ${I.toLocaleString()} seats. Split it, for example by row groups.`).replace(' role="status"',' role="alert"'):"";this.renderScrim(`
444
+ <h3 id="slm-ch-dlg-title">${s?`Moved ${s.applied.toLocaleString()} seat${s.applied===1?"":"s"} to ${d(o)}`:`Move ${t.length.toLocaleString()} seat${t.length===1?"":"s"} to ${d(o)}`}</h3>
445
+ <p class="sub">${s?"These are the exact counts the server applied.":"Every selected seat is in exactly one line below."}</p>
446
+ ${g}
447
+ ${k}
448
+ ${u||'<div class="slm-empty">Nothing selected.</div>'}
449
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${d(e.error??"")}</p>
450
+ ${m}`,L=>{L.querySelector("[data-ch-apply]")?.addEventListener("click",()=>{this.apply()})}),s&&this.announce(`Applied ${s.applied} change${s.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>I){this.showDialogError(`Choose at most ${I.toLocaleString()} seats for one Apply.`);return}this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();let t=s=>{let a=this.allocation.get(s);return $(a)?b:a},n=new Map(e.map(s=>[s,t(s)]));try{let s=await this.host.api.applyChannelAssignment(this.host.eventKey,{targetChannelId:$(this.targetChannelId)?null:this.targetChannelId,labels:e,assignmentVersion:this.assignmentVersion});this.assignmentVersion=s.assignmentVersion,this.conflict=!1,await this.refresh({quiet:!0}),this.closeDialog({restoreFocus:!1});let a=$(s.targetChannelId)?b:s.targetChannelId,o=new Map;for(let[r,l]of n)l===a||t(r)!==a||o.set(l,[...o.get(l)??[],r]);this.host.clearSelection(),this.showApplied(s,o),this.host.moved?.({target:this.nameOf(s.targetChannelId)??C,labels:[...o.values()].flat(),back:[...o]})}catch(s){if(s instanceof p&&s.status===409&&s.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(s instanceof p&&s.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(s)}}showApplied(e,t=new Map){let n=this.nameOf(e.targetChannelId)??C,s=e.buckets.skippedHeld.count+e.buckets.skippedBooked.count+e.buckets.notFound.count;this.railNote=null,this.applied={result:e,back:t,until:Date.now()+Me},this.setStaged(null),this.paintRail(),this.announce(`Assigned ${e.applied} seat${e.applied===1?"":"s"} to ${n}${s?`; ${s} skipped`:""}.`),this.appliedTimer&&clearTimeout(this.appliedTimer),this.appliedTimer=setTimeout(()=>{this.appliedTimer=null,this.paintRail()},Me+100)}appliedHtml(){let e=this.applied;if(!e)return this.railNote??"";let{result:t}=e,n=this.nameOf(t.targetChannelId)??C,s=t.applied,a=t.buckets.alreadyInTarget.count,o=t.buckets.skippedHeld.count+t.buckets.skippedBooked.count+t.buckets.notFound.count,r=$(t.targetChannelId)?"Buyers on your event page":`Buyers coming through ${n}`,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).`:"",s?`${r} see them now.`:""].filter(Boolean).join(" ");return y("ok",`${s.toLocaleString()} ${s===1?"seat":"seats"} now in ${n}`,` ${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">${gt}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:n}=await this.sendBack(e.back);t&&this.host.moved?.({target:"",labels:[...e.back.values()].flat(),back:[],restores:!0}),this.railNote=n?y("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"'):y("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,n=!1;await this.refresh({quiet:!0});for(let[s,a]of e)try{let o=await this.host.api.applyChannelAssignment(this.host.eventKey,{targetChannelId:$(s)?null:s,labels:a,assignmentVersion:this.assignmentVersion});this.assignmentVersion=o.assignmentVersion,t+=o.applied}catch(o){n=!0,this.host.onError(o);break}return await this.refresh({quiet:!0}),{moved:t,failed:n}}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(s=>s.id===e.channelId);if(!t||!this.caps.manage){this.closeDialog();return}let n=t.state==="paused";this.renderScrim(`
451
+ <h3 id="slm-ch-dlg-title">${d(t.name)}</h3>
452
+ <p class="sub">Open the channel to allocate seats and hand out buyer access.
453
+ These are the rest of its actions.</p>
454
+ <div class="slm-ch-menu">
455
+ <button type="button" class="slm-btn" data-ch-menu-act="open">Open channel</button>
456
+ <button type="button" class="slm-btn ghost" data-ch-menu-act="rename">Rename</button>
457
+ <button type="button" class="slm-btn ghost" data-ch-menu-act="pause">${n?"Resume selling":"Pause selling"}</button>
458
+ <button type="button" class="slm-btn ghost" data-ch-menu-act="archive">Archive\u2026</button>
459
+ </div>
460
+ <p class="slm-note">Pausing stops new buyer access; checkouts already running can finish.
461
+ Archiving closes the channel for good and returns its free seats to a destination you choose.
462
+ Nothing is ever deleted silently.</p>
463
+ <div class="foot"><button type="button" class="quiet" data-ch-close>Cancel</button></div>`,s=>{s.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(n=>n.id===e.channelId);if(!t){this.closeDialog();return}this.renderScrim(`
464
+ <h3 id="slm-ch-dlg-title">Rename ${d(t.name)}</h3>
465
+ <p class="sub">Only your team and your reports see this name.</p>
466
+ <div class="slm-field">
467
+ <label for="slm-ch-newname">Name</label>
468
+ <input class="slm-input" id="slm-ch-newname" maxlength="80" value="${d(t.name)}" />
469
+ </div>
470
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${d(e.error??"")}</p>
471
+ <div class="foot">
472
+ <button type="button" class="quiet" data-ch-close>Cancel</button>
473
+ <button type="button" class="slm-btn" data-ch-rename>Save name</button>
474
+ </div>`,n=>{n.querySelector("[data-ch-rename]")?.addEventListener("click",()=>{let s=n.querySelector("#slm-ch-newname")?.value??"";if(!s.trim()){this.showDialogError("A channel needs a name.");return}this.host.api.renameChannel(this.host.eventKey,t.id,s.trim()).then(()=>(this.closeDialog(),this.refresh())).catch(a=>{this.showDialogError(a instanceof p&&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),n=this.host.api.updateChannelPricing;if(!t||!n||!this.caps.manage){this.closeDialog();return}let s=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,h=`${o.key}\0${c??""}`,u=l?.price??o.price??0,m=s.get(h),g=l?`${o.label} \xB7 ${l.name}`:o.label;return`<label class="slm-ch-price-row">
475
+ <span><b>${d(g)}</b><small>Event price ${d(String(u))}</small></span>
476
+ <input class="slm-input" type="number" min="0" max="1000000" step="0.01"
477
+ inputmode="decimal" aria-label="Custom price for ${d(g)}"
478
+ data-ch-price-category="${d(o.key)}" data-ch-price-tier="${d(c??"")}"
479
+ placeholder="${d(String(u))}" value="${m===void 0?"":d(String(m))}"
480
+ ${e.busy?"disabled":""} />
481
+ </label>`})).join("");this.renderScrim(`
482
+ <h3 id="slm-ch-dlg-title">Prices for ${d(t.name)}</h3>
483
+ <p class="sub">Set only the prices that differ for these buyers. Leave a field empty to use the event price.</p>
484
+ <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"}>${d(e.error??"")}</p>
486
+ <div class="foot">
487
+ <button type="button" class="quiet" data-ch-close ${e.busy?"disabled":""}>Cancel</button>
488
+ <button type="button" class="slm-btn" data-ch-price-save ${e.busy||!a?"disabled":""}>
489
+ ${e.busy?"Saving\u2026":"Save prices"}
490
+ </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 h=Number(c);if(!Number.isFinite(h)||h<0||h>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:h})}this.saveChannelPricing(t,r)})})}async saveChannelPricing(e,t){let n=this.host.api.updateChannelPricing;if(!(!n||!this.dialog||this.dialog.kind!=="pricing")){this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();try{await n.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(s){if(s instanceof p&&s.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:s instanceof p&&s.serverMessage?s.serverMessage:"Couldn't save these prices. Try again."},this.renderDialog(),this.host.onError(s)}}}async chooseWebsiteIntegration(){this.detailChannelId&&await this.setAccessIntent("server")}async setAccessIntent(e,t={}){let n=this.detailChannelId;if(!n||!this.caps.manage)return!1;try{let s=await this.host.api.setChannelAccessIntent(this.host.eventKey,n,e,t);return await this.refresh(),this.host.toast(this.intentSavedCopy(e,s?.intentSwitch),"ok"),!0}catch(s){return s instanceof p&&s.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:n,intentTo:e,switchBlocked:s.details}),!1):s instanceof p&&s.code==="channel_access_intent_forbids"?(this.host.toast(F(s.details),"err"),!1):(this.host.toast("Couldn't change how this channel reaches buyers.","err"),this.host.onError(s),!1)}}intentSavedCopy(e,t){let n=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 n;let s=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`${n}${s}${a}`}async togglePause(e=this.detailChannelId){let t=this.list?.channels.find(s=>s.id===e);if(!t||!this.caps.manage)return;let n=t.state!=="paused";try{await this.host.api.setChannelPaused(this.host.eventKey,t.id,n),await this.refresh(),this.host.toast(n?`${t.name} paused. Existing checkouts can finish; no new buyer access is issued.`:`${t.name} resumed.`,"ok")}catch(s){this.host.toast("Couldn't change that channel.","err"),this.host.onError(s)}}renderArchiveDialog(e){let t=this.list?.channels.find(l=>l.id===e.channelId);if(!t){this.closeDialog();return}let n=e.archiveBlocked??null,s=!n&&t.counts.held>0,a=this.assignableChannels().filter(l=>l.id!==t.id),o=n?n.heldUnits??n.activeHolds??0:s?t.counts.held:0,r=o?y("warn",`${o.toLocaleString()} ${o===1?"seat is":"seats are"} in a buyer's cart right now`,n?` Archive waits until they finish or their time runs out, ${pe(n)}.`:" Archive waits until they finish or their time runs out; you can try, and we will say when to come back.").replace(' role="status"',n?' role="alert"':' role="status"'):"";this.renderScrim(`
492
+ <h3 id="slm-ch-dlg-title">Archive ${d(t.name)}</h3>
493
+ <p class="sub">The channel closes for good. Its free seats move where you choose; sales keep their record.</p>
494
+ <div class="slm-field">
495
+ <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="${d(l.id)}">${d(l.name)}</option>`).join("")}
498
+ </select>
499
+ </div>
500
+ ${r}
501
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${d(e.error??"")}</p>
502
+ <div class="foot">
503
+ <button type="button" class="quiet" data-ch-close>Cancel</button>
504
+ <button type="button" class="slm-btn danger" data-ch-archive ${n?"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(n){if(n instanceof p&&n.status===409&&n.code==="channel_archive_blocked_by_holds"){this.dialog={kind:"archive",channelId:e,archiveBlocked:n.details??{}},this.renderDialog();return}this.showDialogError("Couldn't archive that channel. Try again."),this.host.onError(n)}}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(n=>n.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 ${d(t.name)}</h3>
507
+ <p class="sub">Anyone who opens the link can buy from this channel's allocation \u2014 and only from it.
508
+ You'll see the link once, right after you create it.</p>
509
+ <div class="slm-field">
510
+ <label for="slm-ch-lk-label">Label <span style="text-transform:none;font-weight:500">(optional)</span></label>
511
+ <input class="slm-input" id="slm-ch-lk-label" maxlength="80" placeholder="e.g. VIP list Nov 14" />
512
+ <p class="slm-note">So you can tell your links apart later. Buyers never see it.</p>
513
+ </div>
514
+ <div class="slm-field">
515
+ <label for="slm-ch-lk-expiry">Stops working</label>
516
+ <select class="slm-select" id="slm-ch-lk-expiry" data-ch-lk-expiry>
517
+ <option value="event" selected>When the event starts</option>
518
+ <option value="custom">On a date I choose</option>
519
+ </select>
520
+ </div>
521
+ <div class="slm-field" data-ch-lk-when-field hidden>
522
+ <label for="slm-ch-lk-when">Date and time</label>
523
+ <input class="slm-input" type="datetime-local" id="slm-ch-lk-when" />
524
+ </div>
525
+ <div class="slm-field">
526
+ <label for="slm-ch-lk-redemptions">How many people can use it</label>
527
+ <input class="slm-input" type="number" id="slm-ch-lk-redemptions" inputmode="numeric"
528
+ value="${Q.maxRedemptions}" />
529
+ <p class="slm-note">Each buyer who opens the link uses one.</p>
530
+ </div>
531
+ <div class="slm-field">
532
+ <label for="slm-ch-lk-quantity">Seats per buyer</label>
533
+ <input class="slm-input" type="number" id="slm-ch-lk-quantity" inputmode="numeric"
534
+ value="${Q.maxQuantity}" />
535
+ </div>
536
+ <label class="slm-note" style="display:flex;gap:8px;align-items:center;margin:2px 0 6px">
537
+ <input type="checkbox" id="slm-ch-lk-public" />
538
+ Also let this link buy Public sale seats
539
+ </label>
540
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${d(e.error??"")}</p>
541
+ <div class="foot">
542
+ <button type="button" class="quiet" data-ch-close>Cancel</button>
543
+ <button type="button" class="slm-btn" data-ch-lk-create>Create link</button>
544
+ </div>`,n=>{let s=n.querySelector("[data-ch-lk-expiry]"),a=n.querySelector("[data-ch-lk-when-field]"),o=n.querySelector("#slm-ch-lk-when");s.addEventListener("change",()=>{let r=s.value==="custom";a.hidden=!r,r&&!o.value&&(o.value=Ae(Date.now()+7*864e5))}),n.querySelector("[data-ch-lk-create]")?.addEventListener("click",()=>{let r=te(n,"#slm-ch-lk-redemptions"),l=te(n,"#slm-ch-lk-quantity");if(r==null||l==null){this.showDialogError("Those two settings need to be whole numbers.");return}let c;if(s.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:n.querySelector("#slm-ch-lk-label")?.value.trim()||null,includePublic:n.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 n=await this.host.api.createAccessLink(this.host.eventKey,e,t);this.revealLink(n,{channelId:e}),await this.reloadAfterLinkChange(e)}catch(n){this.showDialogError(B(n instanceof p?n:void 0)),n instanceof p||this.host.onError(n)}}async ensureHostedLinkRoute(e,t){if((this.list?.channels.find(s=>s.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(s){return s instanceof p&&s.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:e,intentTo:"hosted_link",switchBlocked:s.details,pendingLink:t}),!1):(this.showDialogError(s instanceof p&&s.code==="channel_access_intent_forbids"?F(s.details):"Couldn't set this channel up for buyer links. Try again."),s instanceof p||this.host.onError(s),!1)}}revealLink(e,t){let n=e.url;this.dialog=null;let s=t.rotated?y("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
+ <h3 id="slm-ch-dlg-title">Copy this link now</h3>
546
+ <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
+ ${s}
548
+ <div class="slm-ch-copyrow">
549
+ <div class="slm-ch-secret" data-ch-lk-url title="${d(n)}">${d(n)}</div>
550
+ <button type="button" class="slm-btn" data-ch-lk-copy aria-live="polite">Copy</button>
551
+ </div>
552
+ <input class="slm-ch-copysink" data-ch-lk-sink tabindex="-1" aria-hidden="true" readonly />
553
+ <p class="slm-note" style="margin-top:10px">${d(ye(e.link))}</p>
554
+ <div class="foot">
555
+ <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",()=>{Ie(a,n).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 n=t.activeSessions??0,s=n?`${n.toLocaleString()} ${n===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 ${d(t.label||"buyer")} link?</h3>
558
+ <p class="sub">${s}</p>
559
+ <label class="slm-ch-radio">
560
+ <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>
562
+ </label>
563
+ <label class="slm-ch-radio">
564
+ <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>
566
+ </label>
567
+ <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"}>${d(e.error??"")}</p>
569
+ <div class="foot">
570
+ <button type="button" class="quiet" data-ch-close>Cancel</button>
571
+ <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(B({code:"end_active_sessions_required"}));return}this.rotateLink(e.channelId,t.id,r.value==="end")})})}async rotateLink(e,t,n){try{let s=await this.host.api.rotateAccessLink(this.host.eventKey,e,t,n);this.revealLink(s,{channelId:e,rotated:!0}),await this.reloadAfterLinkChange(e)}catch(s){this.showDialogError(B(s instanceof p?s:void 0)),s instanceof p||this.host.onError(s)}}renderLinkRevokeDialog(e){let t=this.linkById(e.linkId);if(!t||!this.caps.manage){this.closeDialog();return}let n=t.activeSessions??0;this.renderScrim(`
573
+ <h3 id="slm-ch-dlg-title">Revoke the ${d(t.label||"buyer")} link?</h3>
574
+ <p class="sub">It stops opening immediately and cannot be restored \u2014 there is no undo, and no way to
575
+ bring the same URL back. Seats already bought through it keep their sale.</p>
576
+ ${n?`<label class="slm-ch-radio">
577
+ <input type="checkbox" data-ch-lk-endsessions />
578
+ <span><b>Also end access for the ${n.toLocaleString()}
579
+ buyer${n===1?"":"s"} already inside</b><span class="why">Leave this off and they can
580
+ finish what they started; new visits are refused either way.</span></span>
581
+ </label>`:""}
582
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${d(e.error??"")}</p>
583
+ <div class="foot">
584
+ <button type="button" class="quiet" data-ch-close>Cancel</button>
585
+ <button type="button" class="slm-btn danger" data-ch-lk-revoke>Revoke link</button>
586
+ </div>`,s=>{s.querySelector("[data-ch-lk-revoke]")?.addEventListener("click",()=>{let a=s.querySelector("[data-ch-lk-endsessions]")?.checked??!1;this.revokeLink(e.channelId,t.id,a)})})}async revokeLink(e,t,n){try{let s=await this.host.api.revokeAccessLink(this.host.eventKey,e,t,n);this.closeDialog(),await this.reloadAfterLinkChange(e),this.host.toast(s.endedSessions?`Link revoked. ${s.endedSessions.toLocaleString()} buyer${s.endedSessions===1?"":"s"} lost access.`:"Link revoked. It no longer opens for anyone.","ok")}catch(s){this.showDialogError(B(s instanceof p?s:void 0)),s instanceof p||this.host.onError(s)}}applySheetClasses(){let e=this.host.root,t=this.host.isCompact();e.classList.toggle("ch-sheet",t&&this.active);for(let n of["collapsed","medium","full"])e.classList.toggle(`detent-${n}`,t&&this.active&&this.detent===n);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}};export{ne as a,ft as b,P as c,wt as d,Y as e,ae as f,xt as g,Be as h,se as i,St as j,Ct as k,y as l,$t as m,Lt as n,p as o,Ce as p,It as q,_ as r,b as s,C as t,$ as u,T as v,W as w,ce as x,he as y,de as z,V as A,Pt as B,ue as C,pe as D,me as E,H as F,Tt as G,F as H,ge as I,Q as J,be as K,ve as L,Mt as M,B as N,Dt as O,ke as P,ee as Q,dt as R,De as S};