@seatlayer/js 0.55.0 → 0.57.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.
@@ -1,16 +1,16 @@
1
- var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X=["#a78bfa","#2dd4bf","#fb923c","#60a5fa","#f472b6","#a3e635","#f87171","#38bdf8","#c084fc","#facc15"],He="#f4b740",ce="ABCDEFGHJKLMNPQRSTUVWXYZ";function _(i,e){let t=(i??"").trim();return((/\p{L}/u.exec(t)?.[0]??t[0]??"")||e).toUpperCase().slice(0,1)}function ee(i,e){let t=new Set([...e].map(r=>_(r,"")).filter(Boolean)),n=_(i,"");return{letter:ce.includes(n)&&!t.has(n)?n:[...ce].find(r=>!t.has(r))??(n||"X"),color:X[t.size%X.length]}}function de(i,e=0){return M(i.id)?{letter:_(i.marker,"P"),color:i.color||He}:{letter:_(i.marker||i.name,"?"),color:i.color||X[e%X.length]}}function ue(i,e,t){let n=new Map;for(let o of i){let a=J(e.get(o));n.set(a,(n.get(a)??0)+1)}let s=[{id:C,name:t?.publicSale?.name??E},...(t?.channels??[]).map(o=>({id:o.id,name:o.name}))],r=[];for(let o of s){let a=n.get(o.id);a&&r.push({channelId:o.id,name:o.name,count:a}),n.delete(o.id)}for(let[o,a]of n)r.push({channelId:o,name:M(o)?E:"Another channel",count:a});return r}function J(i){return M(i)?C:i}var he=12;function Q(i){return{count:i.length,labels:i.slice(0,he),truncated:i.length>he}}function pe(i){let{labels:e,allocation:t,statusOf:n,nameOf:s}=i,r=J(i.targetChannelId),o=new Set,a=0,l=0,h=new Map,d=[],p=[],w=[];for(let b of e){if(o.has(b))continue;o.add(b);let u=n(b);if(!u){w.push(b);continue}let m=J(t.get(b));if(m===r){l+=1;continue}if(u==="held"){d.push(b);continue}if(u==="booked"){p.push(b);continue}m===C?a+=1:h.set(m,(h.get(m)??0)+1)}let L=[...h.entries()].map(([b,u])=>({channelId:b,name:s(b),count:u}));return{changedFromPublic:{count:a},movedFromOtherChannel:{count:L.reduce((b,u)=>b+u.count,0),channels:L},alreadyInTarget:{count:l},skippedHeld:Q(d),skippedBooked:Q(p),notFound:Q(w)}}function K(i){return i.changedFromPublic.count+i.movedFromOtherChannel.count}function me(i){return i.movedFromOtherChannel.count>0}function ge(i,e){let t=[];i.changedFromPublic.count&&t.push({kind:"add",icon:"+",count:i.changedFromPublic.count,text:`${i.changedFromPublic.count.toLocaleString()} from ${E}`});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:"needs this confirmation"});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 checkout`,why:"can't move while held",peek:Y(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:Y(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:Y(i.notFound)}),t}function Y(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 be(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 ve(i){if(!i||!i.intent)return"\u2014";let e=i.intent==="server"?"Website integration":i.intent==="hosted_link"?"Buyer link":i.intent==="internal"?"Your 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 q(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 fe(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 Be(i){return i==="hosted_link"?"hosted_link":i==="server"?"server":i==="staff"?"internal":null}function G(i){let e=Z(i?.accessIntent),t=Be(i?.route),n=`This channel is set to "${q(e)}"`;return t?`${n}, so it cannot do that. Switch it to "${q(t)}" first.`:`${n}, so it cannot do that. Choose a different route for this channel first.`}function Z(i){return i==="internal"||i==="server"||i==="hosted_link"||i==="none"?i:"none"}function F(i,e,t){return`${i.toLocaleString()} ${i===1?e:t}`}function ye(i){let e=Math.max(0,i?.liveAccessLinks??0),t=Math.max(0,i?.activeSessions??0),n=Z(i?.from),s=Z(i?.to),o=`${[e?F(e,"buyer link is live","buyer links are live"):null,t?F(t,"buyer is in a checkout","buyers are in a checkout"):null].filter(Boolean).join(", and ")||"Buyers are inside this channel"} on "${q(n)}". Moving it to "${q(s)}" changes what happens to them.`,a=[];return e&&a.push(`${F(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&&a.push(`${F(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:a}}var te={maxRedemptions:100,maxQuantity:4};function ke(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 ne(i){return i.state==="active"&&i.status==="active"}function _e(i){return Number.isFinite(i)?new Date(i).toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}):"\u2014"}function se(i){return[{k:"Expires",v:_e(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 j(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 G(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 Ze(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?Y({count:e.count,labels:e.labels,truncated:e.truncated??!1}):void 0}))}function we(i){return i==="builtin"?"Built-in":i==="active"?"Active":i==="paused"?"Paused":"Archived"}var f=class extends Error{constructor(e,t,n,s,r,o){super(t),this.name="ManageApiError",this.status=e,this.code=n,this.conflicts=s,this.details=r,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 f(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 S(i){return i&&typeof i=="object"?i:{}}function W(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 Le(i){let e=S(i),t=W(e.bookedValue,e.bookedRevenue);return{...e,bookedValue:t,bookedRevenue:t}}function qe(i){let e=S(i),t=S(e.report),n=Array.isArray(t.byCategory)?t.byCategory.map(r=>{let o=S(r),a=W(o.bookedValue,o.bookedRevenue);return{...o,bookedValue:a,bookedRevenue:a}}):[],s=Array.isArray(t.bySection)?t.bySection.map(Le):void 0;return{...e,report:{...t,byCategory:n,...s?{bySection:s}:{}}}}function Oe(i){let e=S(i),t=S(e.bookedValue),n=S(e.revenue),s=Object.keys(t).length?t:n,r=Array.isArray(t.bySection)?t.bySection:Array.isArray(n.bySection)?n.bySection:[],o={...s,gross:W(t.gross,n.gross),bySection:r.map(Le)},a=S(e.velocity),l=Array.isArray(a.bySection)?a.bySection.map(h=>{let d=S(h),p=W(d.bookedValue,d.grossRevenue);return{...d,bookedValue:p,grossRevenue:p}}):[];return{...e,bookedValue:o,revenue:o,velocity:{...a,bySection:l}}}function ze(i){let e=S(i),t=S(e.report),n=typeof t.includesBookedValue=="boolean"?t.includesBookedValue:t.includesRevenue===!0,s=Array.isArray(t.rows)?t.rows.map(a=>{let l=S(a),h=S(l.attribution),d=Se(h.bookedValue,h.revenue);return{...l,attribution:{...h,bookedValue:d,revenue:d}}}):[],r=S(t.totals),o=Se(r.bookedValue,r.revenue);return{...e,report:{...t,includesBookedValue:n,includesRevenue:n,rows:s,totals:{...r,bookedValue:o,revenue:o}}}}function ie(i){let e=S(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}`},r;return t.body!==void 0&&(s["Content-Type"]="application/json",r=JSON.stringify(t.body)),fetch(`${this.base}${e}`,{method:n,headers:s,body:r,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 f(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"})}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}})}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}})}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 r=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/preview${r?`?${r}`:""}`)}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 r=s?"?endActiveSessions=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(n)}${r}`,{method:"DELETE"})}report(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/report`).then(qe)}controlRoom(e,t=15){return this.auth(`/v1/events/${encodeURIComponent(e)}/control-room?window=${t}`).then(Oe)}channelReport(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/report`).then(ze)}createChannelReportLink(e,t,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`,{method:"POST",body:n}).then(s=>{let r=S(s);return{...r,link:ie(r.link)}})}channelReportLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`).then(n=>{let s=S(n);return{links:Array.isArray(s.links)?s.links.map(ie):[]}})}revokeChannelReportLink(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links/${encodeURIComponent(n)}`,{method:"DELETE"}).then(s=>{let r=S(s);return{...r,link:ie(r.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 f(t.status,`request_failed_${t.status}`);return t.blob()}};function ae(i){return i.map((e,t)=>`
1
+ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K=["#a78bfa","#2dd4bf","#fb923c","#60a5fa","#f472b6","#a3e635","#f87171","#38bdf8","#c084fc","#facc15"],He="#f4b740",ce="ABCDEFGHJKLMNPQRSTUVWXYZ";function _(i,e){let t=(i??"").trim();return((/\p{L}/u.exec(t)?.[0]??t[0]??"")||e).toUpperCase().slice(0,1)}function ee(i,e){let t=new Set([...e].map(r=>_(r,"")).filter(Boolean)),n=_(i,"");return{letter:ce.includes(n)&&!t.has(n)?n:[...ce].find(r=>!t.has(r))??(n||"X"),color:K[t.size%K.length]}}function de(i,e=0){return M(i.id)?{letter:_(i.marker,"P"),color:i.color||He}:{letter:_(i.marker||i.name,"?"),color:i.color||K[e%K.length]}}function ue(i,e,t){let n=new Map;for(let o of i){let a=J(e.get(o));n.set(a,(n.get(a)??0)+1)}let s=[{id:$,name:t?.publicSale?.name??E},...(t?.channels??[]).map(o=>({id:o.id,name:o.name}))],r=[];for(let o of s){let a=n.get(o.id);a&&r.push({channelId:o.id,name:o.name,count:a}),n.delete(o.id)}for(let[o,a]of n)r.push({channelId:o,name:M(o)?E:"Another channel",count:a});return r}function J(i){return M(i)?$:i}var he=12;function Q(i){return{count:i.length,labels:i.slice(0,he),truncated:i.length>he}}function pe(i){let{labels:e,allocation:t,statusOf:n,nameOf:s}=i,r=J(i.targetChannelId),o=new Set,a=0,l=0,h=new Map,d=[],u=[],w=[];for(let v of e){if(o.has(v))continue;o.add(v);let p=n(v);if(!p){w.push(v);continue}let m=J(t.get(v));if(m===r){l+=1;continue}if(p==="held"){d.push(v);continue}if(p==="booked"){u.push(v);continue}m===$?a+=1:h.set(m,(h.get(m)??0)+1)}let x=[...h.entries()].map(([v,p])=>({channelId:v,name:s(v),count:p}));return{changedFromPublic:{count:a},movedFromOtherChannel:{count:x.reduce((v,p)=>v+p.count,0),channels:x},alreadyInTarget:{count:l},skippedHeld:Q(d),skippedBooked:Q(u),notFound:Q(w)}}function X(i){return i.changedFromPublic.count+i.movedFromOtherChannel.count}function me(i){return i.movedFromOtherChannel.count>0}function ge(i,e){let t=[];i.changedFromPublic.count&&t.push({kind:"add",icon:"+",count:i.changedFromPublic.count,text:`${i.changedFromPublic.count.toLocaleString()} from ${E}`});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:"needs this confirmation"});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 checkout`,why:"can't move while held",peek:Y(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:Y(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:Y(i.notFound)}),t}function Y(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 be(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 ve(i){if(!i||!i.intent)return"\u2014";let e=i.intent==="server"?"Website integration":i.intent==="hosted_link"?"Buyer link":i.intent==="internal"?"Your 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 q(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 fe(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 Be(i){return i==="hosted_link"?"hosted_link":i==="server"?"server":i==="staff"?"internal":null}function G(i){let e=Z(i?.accessIntent),t=Be(i?.route),n=`This channel is set to "${q(e)}"`;return t?`${n}, so it cannot do that. Switch it to "${q(t)}" first.`:`${n}, so it cannot do that. Choose a different route for this channel first.`}function Z(i){return i==="internal"||i==="server"||i==="hosted_link"||i==="none"?i:"none"}function F(i,e,t){return`${i.toLocaleString()} ${i===1?e:t}`}function ye(i){let e=Math.max(0,i?.liveAccessLinks??0),t=Math.max(0,i?.activeSessions??0),n=Z(i?.from),s=Z(i?.to),o=`${[e?F(e,"buyer link is live","buyer links are live"):null,t?F(t,"buyer is in a checkout","buyers are in a checkout"):null].filter(Boolean).join(", and ")||"Buyers are inside this channel"} on "${q(n)}". Moving it to "${q(s)}" changes what happens to them.`,a=[];return e&&a.push(`${F(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&&a.push(`${F(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:a}}var te={maxRedemptions:100,maxQuantity:4};function ke(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 ne(i){return i.state==="active"&&i.status==="active"}function _e(i){return Number.isFinite(i)?new Date(i).toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}):"\u2014"}function se(i){return[{k:"Expires",v:_e(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 j(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 G(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 Ze(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?Y({count:e.count,labels:e.labels,truncated:e.truncated??!1}):void 0}))}function we(i){return i==="builtin"?"Built-in":i==="active"?"Active":i==="paused"?"Paused":"Archived"}var b=class extends Error{constructor(e,t,n,s,r,o){super(t),this.name="ManageApiError",this.status=e,this.code=n,this.conflicts=s,this.details=r,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 b(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 C(i){return i&&typeof i=="object"?i:{}}function W(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=C(i),t=W(e.bookedValue,e.bookedRevenue);return{...e,bookedValue:t,bookedRevenue:t}}function qe(i){let e=C(i),t=C(e.report),n=Array.isArray(t.byCategory)?t.byCategory.map(r=>{let o=C(r),a=W(o.bookedValue,o.bookedRevenue);return{...o,bookedValue:a,bookedRevenue:a}}):[],s=Array.isArray(t.bySection)?t.bySection.map($e):void 0;return{...e,report:{...t,byCategory:n,...s?{bySection:s}:{}}}}function Oe(i){let e=C(i),t=C(e.bookedValue),n=C(e.revenue),s=Object.keys(t).length?t:n,r=Array.isArray(t.bySection)?t.bySection:Array.isArray(n.bySection)?n.bySection:[],o={...s,gross:W(t.gross,n.gross),bySection:r.map($e)},a=C(e.velocity),l=Array.isArray(a.bySection)?a.bySection.map(h=>{let d=C(h),u=W(d.bookedValue,d.grossRevenue);return{...d,bookedValue:u,grossRevenue:u}}):[];return{...e,bookedValue:o,revenue:o,velocity:{...a,bySection:l}}}function ze(i){let e=C(i),t=C(e.report),n=typeof t.includesBookedValue=="boolean"?t.includesBookedValue:t.includesRevenue===!0,s=Array.isArray(t.rows)?t.rows.map(a=>{let l=C(a),h=C(l.attribution),d=Se(h.bookedValue,h.revenue);return{...l,attribution:{...h,bookedValue:d,revenue:d}}}):[],r=C(t.totals),o=Se(r.bookedValue,r.revenue);return{...e,report:{...t,includesBookedValue:n,includesRevenue:n,rows:s,totals:{...r,bookedValue:o,revenue:o}}}}function ie(i){let e=C(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}`},r;return t.body!==void 0&&(s["Content-Type"]="application/json",r=JSON.stringify(t.body)),fetch(`${this.base}${e}`,{method:n,headers:s,body:r,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 b(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"})}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}})}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 r=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/preview${r?`?${r}`:""}`)}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 r=s?"?endActiveSessions=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(n)}${r}`,{method:"DELETE"})}report(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/report`).then(qe)}controlRoom(e,t=15){return this.auth(`/v1/events/${encodeURIComponent(e)}/control-room?window=${t}`).then(Oe)}channelReport(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/report`).then(ze)}createChannelReportLink(e,t,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`,{method:"POST",body:n}).then(s=>{let r=C(s);return{...r,link:ie(r.link)}})}channelReportLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`).then(n=>{let s=C(n);return{links:Array.isArray(s.links)?s.links.map(ie):[]}})}revokeChannelReportLink(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links/${encodeURIComponent(n)}`,{method:"DELETE"}).then(s=>{let r=C(s);return{...r,link:ie(r.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 b(t.status,`request_failed_${t.status}`);return t.blob()}};function ae(i){return i.map((e,t)=>`
2
2
  <div class="slm-ch-bucket" style="animation-delay:${Math.min(t,4)*30}ms">
3
3
  <span class="ico ${e.kind}" aria-hidden="true">${c(e.icon)}</span>
4
4
  <span><b>${e.count.toLocaleString()}</b> ${c(e.text.replace(/^[\d,.\s]+/,""))}
5
5
  ${e.why?`<span class="why">\u2014 ${c(e.why)}</span>`:""}</span>
6
6
  ${e.peek?`<span class="peek">${c(e.peek)}</span>`:"<span></span>"}
7
- </div>`).join("")}var $e=`
7
+ </div>`).join("")}var Le=`
8
8
  <p class="slm-eyebrow" style="margin-top:18px">On your website</p>
9
9
  <p class="slm-hint">There is nothing more to set up on this screen. Your own server mints a short-lived buyer
10
10
  access session for this channel with the SeatLayer server SDK and hands it to the widget. A channel name
11
11
  on its own never grants access.</p>
12
12
  <p class="slm-note"><a class="slm-linkbtn" href="https://docs.seatlayer.io/server-api/channels"
13
- target="_blank" rel="noreferrer noopener">Read the website integration guide \u2192</a></p>`;function c(i){return String(i??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Re(i){return new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16)}function oe(i,e){let t=i.querySelector(e)?.value.trim()??"",n=Number(t);return t!==""&&Number.isInteger(n)?n:null}function re(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 Ue=8,Ve="#6e7bff",Ne="#b9c0ff",je="#303846",Fe="#4b5669",Ye="#101723";function Ae(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)),r=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!==r*o)&&(e.width=s*o,e.height=r*o);let a=i.resolveCtx();if(!a)return;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,s,r);let l=i.host.isSeatDetail(),h=Math.max(3,i.host.seatPixelSize()),d=h/2,p=i.view==="preview"?i.previewProjection:null,w=p?new Set(p.available===!1?[]:p.eligible??[]):null,L=new Map,b=!l&&i.host.sections().length>1?new Map:null,u=i.view==="preview"&&l&&h<=15?new Map:null;for(let m of i.host.seats()){let T=i.host.statusOf(m.label)??"free",H=i.allocation.get(m.label)??C;if(H!==C){let y=L.get(H)??{x:0,y:0,n:0};y.x+=m.x,y.y+=m.y,y.n+=1,L.set(H,y)}if(!l){let y=i.host.sectionOfLabel(m.label),v=y?i.host.worldToScreen({x:m.x,y:m.y}):null;if(b&&y&&v){let g=b.get(y.id)??{label:y.label,minX:v.x,minY:v.y,maxX:v.x,maxY:v.y};g.minX=Math.min(g.minX,v.x),g.minY=Math.min(g.minY,v.y),g.maxX=Math.max(g.maxX,v.x),g.maxY=Math.max(g.maxY,v.y),b.set(y.id,g)}continue}if(T!=="free")continue;let B=null,R=null;if(i.view==="preview"?w?.has(m.label)?(B=Ve,R=Ne):(B=je,R=Fe):H!==C&&(B=i.markerFor(H).color,R=Ye),!B)continue;let k=i.host.worldToScreen({x:m.x,y:m.y});if(k&&!(k.x<-h||k.y<-h||k.x>s+h||k.y>r+h)){if(u){let y=i.host.sectionOfLabel(m.label);if(y){let v=u.get(y.id)??{label:y.label,minX:k.x,minY:k.y,maxX:k.x,maxY:k.y};v.minX=Math.min(v.minX,k.x),v.minY=Math.min(v.minY,k.y),v.maxX=Math.max(v.maxX,k.x),v.maxY=Math.max(v.maxY,k.y),u.set(y.id,v)}}if(a.fillStyle=B,i.view==="preview"||H!==C){let y=Math.max(2,d+Math.min(1.5,d*.06));a.globalAlpha=1,a.beginPath(),a.arc(k.x,k.y,y,0,Math.PI*2),a.fill(),a.strokeStyle=R??B,a.lineWidth=i.view==="preview"?Math.max(1,Math.min(1.75,h*.13)):Math.max(1,Math.min(1.5,h*.1)),a.stroke(),i.view==="preview"&&w?.has(m.label)&&h>=22&&Xe(a,m.label,k.x,k.y,y)}else a.globalAlpha=.85,a.fillRect(k.x-d,k.y-d,h,h)}}a.globalAlpha=1,u&&Ge(a,u),Ke(b,i),We(L,i,a)}function Xe(i,e,t,n,s){let r=s*1.55,o=Math.min(13,Math.max(7,s*.55)),a=6;for(;o>=a&&(i.font=`800 ${o}px var(--slm-font, system-ui, sans-serif)`,!(i.measureText(e).width<=r));)o-=.5;o<a||(i.fillStyle="#ffffff",i.textAlign="center",i.textBaseline="middle",i.fillText(e,t,n))}function Ke(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 r=s.maxX-s.minX,o=s.maxY-s.minY;if(r<20||o<20)continue;let a=document.createElement("button");a.type="button",a.className="slm-ch-section-target",a.style.left=`${s.minX-8}px`,a.style.top=`${s.minY-8}px`,a.style.width=`${r+16}px`,a.style.height=`${o+16}px`,a.setAttribute("aria-label",`Open ${s.label} seats`),a.addEventListener("click",()=>e.onSectionTargetClick(n)),t.appendChild(a)}}function Ge(i,e){for(let t of e.values()){let n=t.maxX-t.minX,s=t.maxY-t.minY;if(n<52||s<26)continue;let r=(t.minX+t.maxX)/2,o=(t.minY+t.maxY)/2,a=Math.max(11,Math.min(15,s*.16));i.font=`800 ${a}px var(--slm-font, system-ui, sans-serif)`;let l=Math.min(n-8,i.measureText(t.label).width+18),h=a+10;i.fillStyle="rgba(11, 16, 28, .88)",i.fillRect(r-l/2,o-h/2,l,h),i.fillStyle="#f8fafc",i.textAlign="center",i.textBaseline="middle",i.fillText(t.label,r,o)}}function We(i,e,t){let n=e.layer;if(!n||(n.querySelectorAll(".slm-ch-flag").forEach(r=>r.remove()),e.view==="preview"))return;let s=[...i.entries()].sort((r,o)=>o[1].n-r[1].n).slice(0,Ue);for(let[r,o]of s){let a=e.list?.channels.find(p=>p.id===r);if(!a)continue;let l=e.host.worldToScreen({x:o.x/o.n,y:o.y/o.n});if(!l)continue;let h=e.markerFor(r),d=document.createElement("span");d.className="slm-ch-flag",d.style.left=`${l.x}px`,d.style.top=`${l.y}px`,d.innerHTML=`<span class="mk" style="background:${c(h.color)}">${c(h.letter)}</span>${c(a.name)}${a.state==="paused"?" \xB7 Paused":""}`,n.appendChild(d)}}var Qe=`
13
+ target="_blank" rel="noreferrer noopener">Read the website integration guide \u2192</a></p>`;function c(i){return String(i??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Re(i){return new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16)}function oe(i,e){let t=i.querySelector(e)?.value.trim()??"",n=Number(t);return t!==""&&Number.isInteger(n)?n:null}function re(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 Ue=8,Ve="#6e7bff",Ne="#b9c0ff",je="#303846",Fe="#4b5669",Ye="#101723";function Ae(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)),r=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!==r*o)&&(e.width=s*o,e.height=r*o);let a=i.resolveCtx();if(!a)return;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,s,r);let l=i.host.isSeatDetail(),h=Math.max(3,i.host.seatPixelSize()),d=h/2,u=i.view==="preview"?i.previewProjection:null,w=u?new Set(u.available===!1?[]:u.eligible??[]):null,x=new Map,v=!l&&i.host.sections().length>1?new Map:null,p=i.view==="preview"&&l&&h<=15?new Map:null;for(let m of i.host.seats()){let P=i.host.statusOf(m.label)??"free",H=i.allocation.get(m.label)??$;if(H!==$){let y=x.get(H)??{x:0,y:0,n:0};y.x+=m.x,y.y+=m.y,y.n+=1,x.set(H,y)}if(!l){let y=i.host.sectionOfLabel(m.label),f=y?i.host.worldToScreen({x:m.x,y:m.y}):null;if(v&&y&&f){let g=v.get(y.id)??{label:y.label,minX:f.x,minY:f.y,maxX:f.x,maxY:f.y};g.minX=Math.min(g.minX,f.x),g.minY=Math.min(g.minY,f.y),g.maxX=Math.max(g.maxX,f.x),g.maxY=Math.max(g.maxY,f.y),v.set(y.id,g)}continue}if(P!=="free")continue;let B=null,R=null;if(i.view==="preview"?w?.has(m.label)?(B=Ve,R=Ne):(B=je,R=Fe):H!==$&&(B=i.markerFor(H).color,R=Ye),!B)continue;let k=i.host.worldToScreen({x:m.x,y:m.y});if(k&&!(k.x<-h||k.y<-h||k.x>s+h||k.y>r+h)){if(p){let y=i.host.sectionOfLabel(m.label);if(y){let f=p.get(y.id)??{label:y.label,minX:k.x,minY:k.y,maxX:k.x,maxY:k.y};f.minX=Math.min(f.minX,k.x),f.minY=Math.min(f.minY,k.y),f.maxX=Math.max(f.maxX,k.x),f.maxY=Math.max(f.maxY,k.y),p.set(y.id,f)}}if(a.fillStyle=B,i.view==="preview"||H!==$){let y=Math.max(2,d+Math.min(1.5,d*.06));a.globalAlpha=1,a.beginPath(),a.arc(k.x,k.y,y,0,Math.PI*2),a.fill(),a.strokeStyle=R??B,a.lineWidth=i.view==="preview"?Math.max(1,Math.min(1.75,h*.13)):Math.max(1,Math.min(1.5,h*.1)),a.stroke(),i.view==="preview"&&w?.has(m.label)&&h>=22&&Ke(a,m.label,k.x,k.y,y)}else a.globalAlpha=.85,a.fillRect(k.x-d,k.y-d,h,h)}}a.globalAlpha=1,p&&Ge(a,p),Xe(v,i),We(x,i,a)}function Ke(i,e,t,n,s){let r=s*1.55,o=Math.min(13,Math.max(7,s*.55)),a=6;for(;o>=a&&(i.font=`800 ${o}px var(--slm-font, system-ui, sans-serif)`,!(i.measureText(e).width<=r));)o-=.5;o<a||(i.fillStyle="#ffffff",i.textAlign="center",i.textBaseline="middle",i.fillText(e,t,n))}function Xe(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 r=s.maxX-s.minX,o=s.maxY-s.minY;if(r<20||o<20)continue;let a=document.createElement("button");a.type="button",a.className="slm-ch-section-target",a.style.left=`${s.minX-8}px`,a.style.top=`${s.minY-8}px`,a.style.width=`${r+16}px`,a.style.height=`${o+16}px`,a.setAttribute("aria-label",`Open ${s.label} seats`),a.addEventListener("click",()=>e.onSectionTargetClick(n)),t.appendChild(a)}}function Ge(i,e){for(let t of e.values()){let n=t.maxX-t.minX,s=t.maxY-t.minY;if(n<52||s<26)continue;let r=(t.minX+t.maxX)/2,o=(t.minY+t.maxY)/2,a=Math.max(11,Math.min(15,s*.16));i.font=`800 ${a}px var(--slm-font, system-ui, sans-serif)`;let l=Math.min(n-8,i.measureText(t.label).width+18),h=a+10;i.fillStyle="rgba(11, 16, 28, .88)",i.fillRect(r-l/2,o-h/2,l,h),i.fillStyle="#f8fafc",i.textAlign="center",i.textBaseline="middle",i.fillText(t.label,r,o)}}function We(i,e,t){let n=e.layer;if(!n||(n.querySelectorAll(".slm-ch-flag").forEach(r=>r.remove()),e.view==="preview"))return;let s=[...i.entries()].sort((r,o)=>o[1].n-r[1].n).slice(0,Ue);for(let[r,o]of s){let a=e.list?.channels.find(u=>u.id===r);if(!a)continue;let l=e.host.worldToScreen({x:o.x/o.n,y:o.y/o.n});if(!l)continue;let h=e.markerFor(r),d=document.createElement("span");d.className="slm-ch-flag",d.style.left=`${l.x}px`,d.style.top=`${l.y}px`,d.innerHTML=`<span class="mk" style="background:${c(h.color)}">${c(h.letter)}</span>${c(a.name)}${a.state==="paused"?" \xB7 Paused":""}`,n.appendChild(d)}}var Qe=`
14
14
  .slm{--slm-mo-instant:80ms;--slm-mo-quick:140ms;--slm-mo-base:200ms;--slm-mo-slow:320ms;--slm-mo-ambient:2000ms;
15
15
  --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);
16
16
  --slm-mo-spring:cubic-bezier(.34,1.3,.64,1)}
@@ -116,6 +116,10 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
116
116
  .slm-ch-selnum.bump{animation:slm-ch-bump var(--slm-mo-base) var(--slm-mo-spring)}
117
117
  .slm-ch-row2{display:flex;gap:8px;margin-top:8px}
118
118
  .slm-ch-row2 .slm-btn{flex:1;min-width:0}
119
+ .slm-ch-price-summary{display:flex;align-items:center;gap:10px;padding:11px;border:1px solid var(--slm-line);
120
+ border-radius:10px;background:var(--slm-surface);font-size:11.5px;line-height:1.45;color:var(--slm-muted)}
121
+ .slm-ch-price-summary span{flex:1;min-width:0}
122
+ .slm-ch-price-summary .slm-btn{flex:none;min-height:36px;padding:7px 10px}
119
123
  /* distribute routes \u2014 four choices, each with the one sentence that explains it.
120
124
  The current one is NAMED in its own card, never signalled by colour alone. */
121
125
  .slm-ch-dist{display:flex;flex-direction:column;gap:6px;padding:12px;margin-bottom:8px;border:1px solid var(--slm-line);
@@ -167,6 +171,14 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
167
171
  border-radius:10px;background:rgba(244,183,64,.06);font-family:ui-monospace,Menlo,monospace;font-size:11px;
168
172
  overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
169
173
  .slm-ch-err{color:#f1a4a6;font-size:11.5px;margin-top:6px}
174
+ .slm-ch-price-list{display:flex;flex-direction:column;gap:7px}
175
+ .slm-ch-price-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(100px,132px);align-items:center;gap:12px;
176
+ padding:9px 0;border-bottom:1px solid var(--slm-line)}
177
+ .slm-ch-price-row:last-child{border-bottom:0}
178
+ .slm-ch-price-row>span{min-width:0;display:flex;flex-direction:column;gap:3px}
179
+ .slm-ch-price-row b{font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
180
+ .slm-ch-price-row small{font-size:10.5px;color:var(--slm-muted);font-weight:500}
181
+ .slm-ch-price-row .slm-input{margin:0;text-align:right;font-variant-numeric:tabular-nums}
170
182
 
171
183
  /* buyer links \u2014 STATUS only; there is no Copy control on this card */
172
184
  .slm-ch-link{padding:10px 11px;border:1px solid var(--slm-line);border-radius:10px;background:var(--slm-surface);
@@ -241,19 +253,19 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
241
253
  .slm-ch-staged.shake{outline:2px solid #e5484d;outline-offset:2px}
242
254
  .slm-ch-staged.done{outline:2px solid #5bd39b;outline-offset:2px}
243
255
  }
244
- `;var Je=3e4,Ie=300,$=5e3,Ee=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.dialog=null;this.detent="medium";this.seatListLimit=Ie;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.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.assignmentRowsCache=null;this.railHtml=null;this.allocationVersion=null;this.onVisibility=null;this.host=e,this.caps=t}enter(){this.active||(this.active=!0,this.mapIntent="pan",this.assignOpen=!1,this.focusedSectionId=null,this.assignmentRowsCache=null,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})},Je),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}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(r=>r.state==="active")?.id??C),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())}catch(s){if(n())return;this.loading=!1,s instanceof f&&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 r=await this.host.api.channelAllocation(this.host.eventKey,{afterLabel:n,limit:1e3});for(let o of r.allocations)M(o.channelId)||t.set(o.label,o.channelId);if(this.assignmentVersion=r.assignmentVersion,!r.nextAfterLabel)break;n=r.nextAfterLabel}e!==void 0&&e!==this.listSeq||(this.allocation=t)}channelById(e){if(M(e))return{id:C,name:this.list?.publicSale?.name??E,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}markerFor(e){let t=Math.max(0,this.list?.channels.findIndex(s=>s.id===e)??0),n=this.channelById(e);return de(n??{id:e,name:"?",marker:null,color:null},t)}assignableChannels(){return[{id:C,name:this.list?.publicSale.name??E},...(this.list?.channels??[]).filter(e=>e.state!=="archived").map(e=>({id:e.id,name:e.name}))]}currentPlan(){let e=this.host.selectionLabels(),t=pe({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=`
256
+ `;var Je=3e4,Ie=300,L=5e3,Ee=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.dialog=null;this.detent="medium";this.seatListLimit=Ie;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.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.assignmentRowsCache=null;this.railHtml=null;this.allocationVersion=null;this.onVisibility=null;this.host=e,this.caps=t}enter(){this.active||(this.active=!0,this.mapIntent="pan",this.assignOpen=!1,this.focusedSectionId=null,this.assignmentRowsCache=null,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})},Je),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}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(r=>r.state==="active")?.id??$),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())}catch(s){if(n())return;this.loading=!1,s instanceof b&&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 r=await this.host.api.channelAllocation(this.host.eventKey,{afterLabel:n,limit:1e3});for(let o of r.allocations)M(o.channelId)||t.set(o.label,o.channelId);if(this.assignmentVersion=r.assignmentVersion,!r.nextAfterLabel)break;n=r.nextAfterLabel}e!==void 0&&e!==this.listSeq||(this.allocation=t)}channelById(e){if(M(e))return{id:$,name:this.list?.publicSale?.name??E,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}markerFor(e){let t=Math.max(0,this.list?.channels.findIndex(s=>s.id===e)??0),n=this.channelById(e);return de(n??{id:e,name:"?",marker:null,color:null},t)}assignableChannels(){return[{id:$,name:this.list?.publicSale.name??E},...(this.list?.channels??[]).filter(e=>e.state!=="archived").map(e=>({id:e.id,name:e.name}))]}currentPlan(){let e=this.host.selectionLabels(),t=pe({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=`
245
257
  <canvas class="slm-ch-canvas" data-ch="canvas" aria-hidden="true"></canvas>
246
258
  <div class="slm-ch-banner" data-ch="banner" role="status"></div>
247
259
  <div class="slm-ch-staged" data-ch="staged" role="group" aria-label="Staged channel changes"></div>
248
- <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.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)}paintOverlay(){let e=this.canvas,t=this.layer;!e||!t||Ae({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?.(K(t)),!e.length){this.setStaged(null);return}let n=this.nameOf(this.targetChannelId)??E,s=K(t),r=e.length>$,o=t.skippedHeld.count+t.skippedBooked.count,a=[`<b>${e.length.toLocaleString()}</b> selected`,`<b>+${s.toLocaleString()}</b> to ${c(n)}`];t.alreadyInTarget.count&&a.push(`<b>${t.alreadyInTarget.count.toLocaleString()}</b> already in`),o&&a.push(`<b>${o.toLocaleString()}</b> can't move now`),this.setStaged(`
260
+ <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.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)}paintOverlay(){let e=this.canvas,t=this.layer;!e||!t||Ae({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?.(X(t)),!e.length){this.setStaged(null);return}let n=this.nameOf(this.targetChannelId)??E,s=X(t),r=e.length>L,o=t.skippedHeld.count+t.skippedBooked.count,a=[`<b>${e.length.toLocaleString()}</b> selected`,`<b>+${s.toLocaleString()}</b> to ${c(n)}`];t.alreadyInTarget.count&&a.push(`<b>${t.alreadyInTarget.count.toLocaleString()}</b> already in`),o&&a.push(`<b>${o.toLocaleString()}</b> can't move now`),this.setStaged(`
249
261
  <span>${a.join(" \xB7 ")}</span>
250
262
  <span class="grow"></span>
251
263
  <button type="button" class="drop" data-ch-act="discard">Discard</button>
252
264
  <button type="button" class="go" data-ch-act="review"${r?" disabled":""}>
253
- ${r?`Maximum ${$.toLocaleString()} seats`:"Review changes"}
265
+ ${r?`Maximum ${L.toLocaleString()} seats`:"Review changes"}
254
266
  </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 r=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:${c(r.color)}"></span>
255
267
  Previewing buyer access \xB7 ${c(t)}${o} \xB7 read-only
256
- <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:C]}this.loadPreview()}this.paintRail(),this.paintOverlay(),this.paintStagedBar(),this.onInteractionChange?.()}async loadPreview(){let e=[...this.previewAudience],t=e.map(n=>this.nameOf(n)??E).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(M)}),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 f?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(`<p class="slm-eyebrow">Sales channels</p>
268
+ <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:$]}this.loadPreview()}this.paintRail(),this.paintOverlay(),this.paintStagedBar(),this.onInteractionChange?.()}async loadPreview(){let e=[...this.previewAudience],t=e.map(n=>this.nameOf(n)??E).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(M)}),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 b?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(`<p class="slm-eyebrow">Sales channels</p>
257
269
  <p class="slm-hint">You need channel-management permission on this event to see allocations.</p>`);return}if(this.loading&&!this.list){this.setRailHtml(`<p class="slm-eyebrow">Sales channels</p>
258
270
  <div class="slm-ch-busy" role="status" data-ch-state="list-loading">Loading channels and allocations\u2026</div>`);return}if(!this.list&&this.loadError){this.setRailHtml(`<p class="slm-eyebrow">Sales channels</p>
259
271
  <div class="slm-ch-alert err" role="alert" data-ch-state="list-error"><span>\u26A0</span>
@@ -323,7 +335,7 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
323
335
  multiple rows, a dragged area, or individual seats.</p>`}selectionRailHtml(e){let t=ue(e,this.allocation,this.list),n=this.conflict?`<div class="slm-ch-alert err" role="alert"><span>\u26A0</span>
324
336
  <span><b>Assignments changed while you were editing.</b> Nothing was applied.
325
337
  Your ${e.length.toLocaleString()}-seat selection is kept.
326
- <button type="button" data-ch-act="refresh-review">Refresh and review \u2192</button></span></div>`:"",s=e.length!==this.lastSelectionCount?" bump":"";this.lastSelectionCount=e.length;let r=e.length>$,o=t.map(a=>{let l=this.markerFor(a.channelId);return`<div class="slm-ch-selsrc-row">
338
+ <button type="button" data-ch-act="refresh-review">Refresh and review \u2192</button></span></div>`:"",s=e.length!==this.lastSelectionCount?" bump":"";this.lastSelectionCount=e.length;let r=e.length>L,o=t.map(a=>{let l=this.markerFor(a.channelId);return`<div class="slm-ch-selsrc-row">
327
339
  <span class="mk" style="background:${c(l.color)}" aria-hidden="true">${c(l.letter)}</span>
328
340
  <b>${a.count.toLocaleString()}</b><span>${c(a.name)}</span></div>`}).join("");return`
329
341
  ${n}
@@ -332,7 +344,7 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
332
344
  <span class="slm-sellabel">selected</span></div>
333
345
  <div class="slm-ch-selsrc" aria-live="polite" aria-label="Selection sources">${o}</div>
334
346
  ${r?`<div class="slm-ch-alert warn" role="alert"><span>\u2139</span><span>
335
- <b>This selection is too large to apply at once.</b> Choose at most ${$.toLocaleString()}
347
+ <b>This selection is too large to apply at once.</b> Choose at most ${L.toLocaleString()}
336
348
  seats, for example by splitting the venue into row groups.</span></div>`:""}
337
349
  <p class="slm-note">Changes are staged \u2014 nothing moves until you review and apply.
338
350
  Seats in checkout or already sold are never moved.</p>
@@ -342,7 +354,7 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
342
354
  </div>
343
355
  <p class="slm-note">The seat list offers the same selection with checkboxes for keyboard and screen-reader use.</p>`}detailRailHtml(e){let t=`<p class="slm-eyebrow">
344
356
  <button type="button" class="slm-linkbtn" data-ch-act="back" style="text-align:left">\u2039 All channels</button>
345
- </p>`,n=this.list?.channels.find(o=>o.id===e);if(!n)return`${t}
357
+ </p>`,n=this.list?.channels.find(l=>l.id===e);if(!n)return`${t}
346
358
  <div class="slm-ch-alert warn" role="status" data-ch-state="detail-gone"><span>\u2139</span>
347
359
  <span><b>This channel is no longer on this event.</b> It was archived or removed while you had it open.
348
360
  ${this.showArchived?"":"Archived channels are hidden \u2014 use \u201CShow archived\u201D on the list to see it."}</span></div>`;let s=this.caps.manage?`
@@ -352,15 +364,22 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
352
364
  <button type="button" class="slm-btn ghost" data-ch-act="pause">${n.state==="paused"?"Resume":"Pause"}</button>
353
365
  <button type="button" class="slm-btn ghost" data-ch-act="archive">Archive\u2026</button>
354
366
  </div>
355
- <p class="slm-note">Archive returns the allocation to a destination you choose. Nothing is ever deleted silently.</p>`:"",r=this.caps.manage?this.distributeHtml(n):"";return`
367
+ <p class="slm-note">Archive returns the allocation to a destination you choose. Nothing is ever deleted silently.</p>`:"",r=this.caps.manage?this.distributeHtml(n):"",o=n.priceOverrides?.length??0,a=this.caps.manage&&this.host.api.updateChannelPricing?`
368
+ <p class="slm-eyebrow" style="margin-top:14px">Prices</p>
369
+ <div class="slm-ch-price-summary">
370
+ <span>${o?`${o.toLocaleString()} custom price${o===1?"":"s"} override the event price for this channel.`:"This channel uses the event prices."}</span>
371
+ <button type="button" class="slm-btn ghost" data-ch-act="pricing">Edit prices</button>
372
+ </div>
373
+ <p class="slm-note">Only buyers admitted to this channel see and pay these prices. Existing holds keep the price already promised.</p>`:"";return`
356
374
  ${t}
357
375
  <p class="slm-eyebrow">Channel \xB7 ${c(n.name)}</p>
358
376
  <div class="slm-ch-list">${this.channelRowHtml(n)}</div>
377
+ ${a}
359
378
  ${r}
360
- ${s}`}distributeHtml(e){let t=e.access?.intent??"none",n=e.access?.hasActiveGrants===!0,s=this.linksState!=="unsupported",r=this.links.some(ne),o=t==="none"?"Protected reserve \u2014 no route can sell these seats. Every buyer path is refused.":t==="internal"?"Your staff sell these seats. No buyer-facing route is open.":n?t==="server"?"Your website is letting buyers in. Only they can buy these seats.":"A buyer link is live. Only people with that link can buy these seats.":t==="server"?"Set up for your website \u2014 no buyer has come through yet. Seats stay reserved.":"Set up for buyer links \u2014 no buyer has come through yet. Seats stay reserved.",a=(l,h,d,p)=>{let w=l===t;return`<div class="slm-ch-dist${w?" on":""}" data-ch-route="${c(l)}">
379
+ ${s}`}distributeHtml(e){let t=e.access?.intent??"none",n=e.access?.hasActiveGrants===!0,s=this.linksState!=="unsupported",r=this.links.some(ne),o=t==="none"?"Protected reserve \u2014 no route can sell these seats. Every buyer path is refused.":t==="internal"?"Your staff sell these seats. No buyer-facing route is open.":n?t==="server"?"Your website is letting buyers in. Only they can buy these seats.":"A buyer link is live. Only people with that link can buy these seats.":t==="server"?"Set up for your website \u2014 no buyer has come through yet. Seats stay reserved.":"Set up for buyer links \u2014 no buyer has come through yet. Seats stay reserved.",a=(l,h,d,u)=>{let w=l===t;return`<div class="slm-ch-dist${w?" on":""}" data-ch-route="${c(l)}">
361
380
  <b>${c(q(l))}${w?'<span class="cur">Current route</span>':""}</b>
362
381
  <span class="why">${c(fe(l))}</span>
363
- ${w&&!d?"":`<button type="button" class="slm-btn${p&&!w?"":" ghost"}"
382
+ ${w&&!d?"":`<button type="button" class="slm-btn${u&&!w?"":" ghost"}"
364
383
  data-ch-act="${c(h)}">${c(d)}</button>`}
365
384
  </div>`};return`
366
385
  <p class="slm-eyebrow" style="margin-top:14px">Distribute</p>
@@ -370,7 +389,7 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
370
389
  ${a("internal","route-internal",t==="internal"?"":"Hand to your staff",!1)}
371
390
  ${a("none","route-none",t==="none"?"":"Keep as reserve",!1)}
372
391
  ${this.hostedLinksHtml()}
373
- ${t==="server"?$e:""}`}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 r=s instanceof f?s.status:0;this.links=[],this.linksState=r===404||r===405||r===501?"unsupported":"error",this.linksState==="error"&&this.host.onError(s)}}hostedLinksHtml(){let e='<p class="slm-eyebrow" style="margin-top:18px">Buyer links</p>';return this.linksState==="unsupported"?`${e}<div class="slm-ch-alert warn" data-ch-state="links-unsupported"><span>\u2139</span>
392
+ ${t==="server"?Le:""}`}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 r=s instanceof b?s.status:0;this.links=[],this.linksState=r===404||r===405||r===501?"unsupported":"error",this.linksState==="error"&&this.host.onError(s)}}hostedLinksHtml(){let e='<p class="slm-eyebrow" style="margin-top:18px">Buyer links</p>';return this.linksState==="unsupported"?`${e}<div class="slm-ch-alert warn" data-ch-state="links-unsupported"><span>\u2139</span>
374
393
  <span><b>Buyer links need a newer server.</b> Everything else on this channel works normally.</span></div>`:this.linksState==="error"?`${e}<div class="slm-ch-alert err" role="alert" data-ch-state="links-error"><span>\u26A0</span>
375
394
  <span><b>Couldn't load this channel's links.</b> This is a failed read, not an empty list \u2014
376
395
  any live link is still working.
@@ -395,13 +414,13 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
395
414
  <div class="slm-ch-lkrow"><span class="k">The URL</span>
396
415
  <span class="v">Revealed once at creation \u2014 not recoverable</span></div>
397
416
  ${a}
398
- </div>`}previewRailHtml(){let e=[{id:C,name:this.list?.publicSale.name??E},...(this.list?.channels??[]).filter(p=>p.state!=="archived").map(p=>({id:p.id,name:p.name}))],t=this.previewAudience[0]??C,n=e.map(p=>`<option value="${c(p.id)}"${p.id===t?" selected":""}>${c(p.name)}</option>`).join(""),s=this.previewState==="unsupported"?`<div class="slm-ch-alert warn" data-ch-state="preview-unsupported"><span>\u2139</span>
417
+ </div>`}previewRailHtml(){let e=[{id:$,name:this.list?.publicSale.name??E},...(this.list?.channels??[]).filter(u=>u.state!=="archived").map(u=>({id:u.id,name:u.name}))],t=this.previewAudience[0]??$,n=e.map(u=>`<option value="${c(u.id)}"${u.id===t?" selected":""}>${c(u.name)}</option>`).join(""),s=this.previewState==="unsupported"?`<div class="slm-ch-alert warn" data-ch-state="preview-unsupported"><span>\u2139</span>
399
418
  <span><b>Preview needs a newer server.</b> Allocation management works normally;
400
419
  the buyer-view simulation will appear once this event's API is updated.</span></div>`:"",r=this.previewState==="loading"?'<div class="slm-ch-busy" role="status" data-ch-state="preview-loading">Asking the server what this audience sees\u2026</div>':"",o=this.previewState==="error"?`<div class="slm-ch-alert err" role="alert" data-ch-state="preview-error"><span>\u26A0</span>
401
420
  <span><b>Couldn't load the buyer preview.</b> Nothing is wrong with this audience's seats \u2014
402
421
  the simulation itself failed to load.
403
422
  <button type="button" data-ch-act="preview-retry">Try again</button></span></div>`:"",a=this.previewProjection?.available===!1?`<div class="slm-ch-alert warn" role="status"><span>\u23F8</span>
404
- <span><b>This private sale is not available.</b> ${c((this.previewProjection.unavailable??[]).map(p=>`${this.nameOf(p.channelId)??"This channel"} is ${p.state}`).join("; ")||"The audience cannot buy right now")}.
423
+ <span><b>This private sale is not available.</b> ${c((this.previewProjection.unavailable??[]).map(u=>`${this.nameOf(u.channelId)??"This channel"} is ${u.state}`).join("; ")||"The audience cannot buy right now")}.
405
424
  A buyer arriving with this access sees this message, not these seats.</span></div>`:"",l=this.previewProjection?.counts?.eligible??this.previewProjection?.eligible?.length,h=l!=null&&this.previewProjection?.available!==!1?`<div class="slm-ch-alert info"><span>\u2713</span><span><b>${l.toLocaleString()} ${l===1?"seat is":"seats are"} available now.</b>
406
425
  This is the exact buyer-visible allocation.${this.previewProjection?.includePublic===!1?" Public sale seats are <b>not</b> included in this access.":""}</span></div>`:"",d=M(t)?"":`
407
426
  <label class="slm-note" style="display:flex;gap:8px;align-items:center;margin:10px 0">
@@ -422,7 +441,7 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
422
441
  <div class="r"><span class="sw" style="background:#3a4051"></span> Unavailable to this audience (one neutral state)</div>
423
442
  <div class="r"><span class="sw" style="background:#22a06b"></span> Sold \u2014 same as any buyer sees</div>
424
443
  </div>
425
- ${h}`}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 a=()=>this.openChannel(o.dataset.chOpen);o.addEventListener("click",a),o.addEventListener("keydown",l=>{l.key!=="Enter"&&l.key!==" "&&l.key!=="Spacebar"||(l.preventDefault(),a())})}),e.querySelectorAll("[data-ch-menu]").forEach(o=>{o.addEventListener("click",a=>{a.stopPropagation(),this.openDialog({kind:"menu",channelId:o.dataset.chMenu})}),o.addEventListener("keydown",a=>{a.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))})}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"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"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.paintRail();break;case"assign-close":this.assignOpen=!1,this.mapIntent="pan",this.paintRail(),this.onInteractionChange?.();break;case"preview-retry":this.loadPreview();break;default:break}}assignmentRows(){return this.assignmentRowsCache||(this.assignmentRowsCache=this.host.rows()),this.assignmentRowsCache}pickCategory(){let e=this.host.categories();e.length&&this.promptChoice("Select a whole category",e.map(t=>({value:t.key,label:t.label})),t=>{this.host.selectByLabels(this.host.labelsInCategory(t))})}promptChoice(e,t,n){this.renderScrim(`
444
+ ${h}`}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 a=()=>this.openChannel(o.dataset.chOpen);o.addEventListener("click",a),o.addEventListener("keydown",l=>{l.key!=="Enter"&&l.key!==" "&&l.key!=="Spacebar"||(l.preventDefault(),a())})}),e.querySelectorAll("[data-ch-menu]").forEach(o=>{o.addEventListener("click",a=>{a.stopPropagation(),this.openDialog({kind:"menu",channelId:o.dataset.chMenu})}),o.addEventListener("keydown",a=>{a.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))})}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"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.paintRail();break;case"assign-close":this.assignOpen=!1,this.mapIntent="pan",this.paintRail(),this.onInteractionChange?.();break;case"preview-retry":this.loadPreview();break;default:break}}assignmentRows(){return this.assignmentRowsCache||(this.assignmentRowsCache=this.host.rows()),this.assignmentRowsCache}pickCategory(){let e=this.host.categories();e.length&&this.promptChoice("Select a whole category",e.map(t=>({value:t.key,label:t.label})),t=>{this.host.selectByLabels(this.host.labelsInCategory(t))})}promptChoice(e,t,n){this.renderScrim(`
426
445
  <h3 id="slm-ch-dlg-title">${c(e)}</h3>
427
446
  <div class="slm-field">
428
447
  <label for="slm-ch-choice">Choose one</label>
@@ -446,11 +465,11 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
446
465
  <div class="foot">
447
466
  <button type="button" class="quiet" data-ch-close>Cancel</button>
448
467
  <button type="button" class="slm-btn" data-ch-add-scope disabled>Add seats</button>
449
- </div>`,l=>{let h=new Map(s.map(g=>[g.id,g])),d=new Set,p=new Set,w=new Set(this.host.selectionLabels()),L=l.querySelector("[data-ch-add-scope]"),b=l.querySelector("[data-ch-error]"),u=l.querySelector("[data-ch-scope-list]"),m=l.querySelector("[data-ch-scope-search]"),T=l.querySelector("[data-ch-scope-summary]"),H=l.querySelector("[data-ch-scope-filter]"),B=200,R="",k=()=>{let g=new Set(w);for(let P of d)for(let D of h.get(P)?.labels??[])g.add(D);return g},y=()=>{let g=k(),P=g.size-w.size,D=g.size>$;L.disabled=P===0||D,L.textContent=D?`Maximum ${$.toLocaleString()} seats`:`Add ${P.toLocaleString()} seat${P===1?"":"s"}`,b.hidden=!D,b.textContent=D?`That would make ${g.size.toLocaleString()} selected seats. Choose fewer rows or sections.`:"",T.textContent=`${d.size.toLocaleString()} row${d.size===1?"":"s"} \xB7 ${P.toLocaleString()} seat${P===1?"":"s"} added`},v=()=>{let g=[],P=0,D=0;a.forEach(([A,x],U)=>{let O=A.toLocaleLowerCase(),z=R?x.filter(I=>`${O} ${I.label.toLocaleLowerCase()}`.includes(R)):x;if(R&&!z.length)return;P+=z.length;let le=x.every(I=>d.has(I.id)),Te=!le&&x.some(I=>d.has(I.id)),V=!!R||p.has(U),Pe=Math.max(0,B-D),N=V?z.slice(0,Pe):[];D+=N.length;let De=x.reduce((I,Me)=>I+Me.labels.length,0);g.push(`<div class="slm-ch-scopegroup">
450
- <button type="button" class="slm-ch-groupcheck" role="checkbox" aria-checked="${le?"true":Te?"mixed":"false"}"
451
- aria-label="Select all ${x.length.toLocaleString()} rows in ${c(A)}" data-ch-scope-group="${U}">
468
+ </div>`,l=>{let h=new Map(s.map(g=>[g.id,g])),d=new Set,u=new Set,w=new Set(this.host.selectionLabels()),x=l.querySelector("[data-ch-add-scope]"),v=l.querySelector("[data-ch-error]"),p=l.querySelector("[data-ch-scope-list]"),m=l.querySelector("[data-ch-scope-search]"),P=l.querySelector("[data-ch-scope-summary]"),H=l.querySelector("[data-ch-scope-filter]"),B=200,R="",k=()=>{let g=new Set(w);for(let T of d)for(let D of h.get(T)?.labels??[])g.add(D);return g},y=()=>{let g=k(),T=g.size-w.size,D=g.size>L;x.disabled=T===0||D,x.textContent=D?`Maximum ${L.toLocaleString()} seats`:`Add ${T.toLocaleString()} seat${T===1?"":"s"}`,v.hidden=!D,v.textContent=D?`That would make ${g.size.toLocaleString()} selected seats. Choose fewer rows or sections.`:"",P.textContent=`${d.size.toLocaleString()} row${d.size===1?"":"s"} \xB7 ${T.toLocaleString()} seat${T===1?"":"s"} added`},f=()=>{let g=[],T=0,D=0;a.forEach(([A,S],U)=>{let O=A.toLocaleLowerCase(),z=R?S.filter(I=>`${O} ${I.label.toLocaleLowerCase()}`.includes(R)):S;if(R&&!z.length)return;T+=z.length;let le=S.every(I=>d.has(I.id)),Pe=!le&&S.some(I=>d.has(I.id)),V=!!R||u.has(U),Te=Math.max(0,B-D),N=V?z.slice(0,Te):[];D+=N.length;let De=S.reduce((I,Me)=>I+Me.labels.length,0);g.push(`<div class="slm-ch-scopegroup">
469
+ <button type="button" class="slm-ch-groupcheck" role="checkbox" aria-checked="${le?"true":Pe?"mixed":"false"}"
470
+ aria-label="Select all ${S.length.toLocaleString()} rows in ${c(A)}" data-ch-scope-group="${U}">
452
471
  <span class="box" aria-hidden="true">\u2713</span><span>${c(A)}</span>
453
- <span class="meta">${x.length.toLocaleString()} rows \xB7 ${De.toLocaleString()} seats</span>
472
+ <span class="meta">${S.length.toLocaleString()} rows \xB7 ${De.toLocaleString()} seats</span>
454
473
  </button>
455
474
  <button type="button" class="slm-ch-grouptoggle" aria-expanded="${V}" aria-label="${V?"Hide":"Show"} rows in ${c(A)}"
456
475
  data-ch-scope-toggle="${U}">${V?"Hide":"Show"}</button>
@@ -458,8 +477,8 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
458
477
  aria-checked="${d.has(I.id)}" data-ch-scope-id="${c(I.id)}">
459
478
  <span class="box" aria-hidden="true">\u2713</span><span>${c(I.label)}</span>
460
479
  <span class="meta">${I.labels.length.toLocaleString()} seat${I.labels.length===1?"":"s"}</span>
461
- </button>`)),V&&z.length>N.length&&g.push(`<p class="slm-ch-scopehint">${(z.length-N.length).toLocaleString()} more row${z.length-N.length===1?"":"s"}. Search to narrow the list.</p>`)}),u.innerHTML=g.join("")||(R?`<div class="slm-ch-scope-empty" data-ch-state="scope-nomatch">No sections or rows match \u201C${c(R)}\u201D.</div>`:`<div class="slm-ch-scope-empty" data-ch-state="scope-empty">This chart has no rows with selectable seats.
462
- Use Drag box or the seat list instead.</div>`),H.textContent=R?`Showing ${D.toLocaleString()} of ${P.toLocaleString()} matching rows. Section checkboxes still select every row in that section.`:"Showing section groups. Expand one or search to see rows.",u.querySelectorAll("[data-ch-scope-group]").forEach(A=>A.addEventListener("click",()=>{let x=a[Number(A.dataset.chScopeGroup)]?.[1]??[],U=x.every(O=>d.has(O.id));for(let O of x)U?d.delete(O.id):d.add(O.id);v(),y()})),u.querySelectorAll("[data-ch-scope-toggle]").forEach(A=>A.addEventListener("click",()=>{let x=Number(A.dataset.chScopeToggle);p.has(x)?p.delete(x):p.add(x),v()})),u.querySelectorAll("[data-ch-scope-id]").forEach(A=>A.addEventListener("click",()=>{let x=A.dataset.chScopeId;d.has(x)?d.delete(x):d.add(x),v(),y()}))};m.addEventListener("input",()=>{R=m.value.trim().toLocaleLowerCase(),v(),y()}),L.addEventListener("click",()=>{let g=[...k()];!d.size||g.length>$||(this.closeDialog(),this.host.selectByLabels(g))}),v(),y()});return}let o=[...r.entries()].map(([a,l])=>`
480
+ </button>`)),V&&z.length>N.length&&g.push(`<p class="slm-ch-scopehint">${(z.length-N.length).toLocaleString()} more row${z.length-N.length===1?"":"s"}. Search to narrow the list.</p>`)}),p.innerHTML=g.join("")||(R?`<div class="slm-ch-scope-empty" data-ch-state="scope-nomatch">No sections or rows match \u201C${c(R)}\u201D.</div>`:`<div class="slm-ch-scope-empty" data-ch-state="scope-empty">This chart has no rows with selectable seats.
481
+ Use Drag box or the seat list instead.</div>`),H.textContent=R?`Showing ${D.toLocaleString()} of ${T.toLocaleString()} matching rows. Section checkboxes still select every row in that section.`:"Showing section groups. Expand one or search to see rows.",p.querySelectorAll("[data-ch-scope-group]").forEach(A=>A.addEventListener("click",()=>{let S=a[Number(A.dataset.chScopeGroup)]?.[1]??[],U=S.every(O=>d.has(O.id));for(let O of S)U?d.delete(O.id):d.add(O.id);f(),y()})),p.querySelectorAll("[data-ch-scope-toggle]").forEach(A=>A.addEventListener("click",()=>{let S=Number(A.dataset.chScopeToggle);u.has(S)?u.delete(S):u.add(S),f()})),p.querySelectorAll("[data-ch-scope-id]").forEach(A=>A.addEventListener("click",()=>{let S=A.dataset.chScopeId;d.has(S)?d.delete(S):d.add(S),f(),y()}))};m.addEventListener("input",()=>{R=m.value.trim().toLocaleLowerCase(),f(),y()}),x.addEventListener("click",()=>{let g=[...k()];!d.size||g.length>L||(this.closeDialog(),this.host.selectByLabels(g))}),f(),y()});return}let o=[...r.entries()].map(([a,l])=>`
463
482
  <div class="slm-ch-seatgroup"><span>${c(a)}</span></div>
464
483
  ${l.map(h=>`<button type="button" class="slm-ch-seatitem" role="checkbox"
465
484
  aria-checked="false" data-ch-scope-id="${c(h.id)}">
@@ -475,7 +494,7 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
475
494
  <div class="foot">
476
495
  <button type="button" class="quiet" data-ch-close>Cancel</button>
477
496
  <button type="button" class="slm-btn" data-ch-add-scope disabled>Add seats</button>
478
- </div>`,a=>{let l=new Map(s.map(u=>[u.id,u])),h=new Set,d=new Set(this.host.selectionLabels()),p=a.querySelector("[data-ch-add-scope]"),w=a.querySelector("[data-ch-error]"),L=()=>{let u=new Set(d);for(let m of h)for(let T of l.get(m)?.labels??[])u.add(T);return u},b=()=>{let u=L(),m=u.size-d.size,T=u.size>$;p.disabled=m===0||T,p.textContent=T?`Maximum ${$.toLocaleString()} seats`:`Add ${m.toLocaleString()} seat${m===1?"":"s"}`,w.hidden=!T,w.textContent=T?`That would make ${u.size.toLocaleString()} selected seats. Choose fewer rows or sections.`:""};a.querySelectorAll("[data-ch-scope-id]").forEach(u=>{u.addEventListener("click",()=>{let m=u.dataset.chScopeId;h.has(m)?h.delete(m):h.add(m),u.setAttribute("aria-checked",String(h.has(m))),b()})}),p.addEventListener("click",()=>{let u=[...L()];!h.size||u.length>$||(this.closeDialog(),this.host.selectByLabels(u))}),b()})}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==="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:r}=ye(e.switchBlocked);this.renderScrim(`
497
+ </div>`,a=>{let l=new Map(s.map(p=>[p.id,p])),h=new Set,d=new Set(this.host.selectionLabels()),u=a.querySelector("[data-ch-add-scope]"),w=a.querySelector("[data-ch-error]"),x=()=>{let p=new Set(d);for(let m of h)for(let P of l.get(m)?.labels??[])p.add(P);return p},v=()=>{let p=x(),m=p.size-d.size,P=p.size>L;u.disabled=m===0||P,u.textContent=P?`Maximum ${L.toLocaleString()} seats`:`Add ${m.toLocaleString()} seat${m===1?"":"s"}`,w.hidden=!P,w.textContent=P?`That would make ${p.size.toLocaleString()} selected seats. Choose fewer rows or sections.`:""};a.querySelectorAll("[data-ch-scope-id]").forEach(p=>{p.addEventListener("click",()=>{let m=p.dataset.chScopeId;h.has(m)?h.delete(m):h.add(m),p.setAttribute("aria-checked",String(h.has(m))),v()})}),u.addEventListener("click",()=>{let p=[...x()];!h.size||p.length>L||(this.closeDialog(),this.host.selectByLabels(p))}),v()})}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:r}=ye(e.switchBlocked);this.renderScrim(`
479
498
  <h3 id="slm-ch-dlg-title">Change how ${c(t.name)} reaches buyers?</h3>
480
499
  <p class="sub">${c(s)}</p>
481
500
  <div class="slm-ch-alert warn" role="alert"><span>\u26A0</span><span>
@@ -514,22 +533,22 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
514
533
  <button type="button" class="quiet" data-ch-close>Cancel</button>
515
534
  <button type="button" class="slm-btn ghost" data-ch-create="plain">Create without allocating</button>
516
535
  <button type="button" class="slm-btn" data-ch-create="allocate">Create and allocate seats</button>
517
- </div>`,s=>{let r=s.querySelector("#slm-ch-name"),o=s.querySelector("[data-ch-marker]");r.addEventListener("input",()=>{let a=ee(r.value,t);o.textContent=a.letter,o.style.background=a.color}),s.querySelectorAll("[data-ch-create]").forEach(a=>{a.addEventListener("click",()=>{let l=a.dataset.chCreate==="allocate";this.createChannel(r.value,o.textContent??"",o.style.background,s.querySelector("#slm-ch-ref")?.value??"",l)})})})}async createChannel(e,t,n,s,r){let o=e.trim();if(!o){this.showDialogError("Give the channel a name your team will recognise.");return}try{let a=await this.host.api.createChannel(this.host.eventKey,{name:o,marker:_(t,"")||null,color:n||null,externalRef:s.trim()||null});this.closeDialog(),await this.refresh(),this.targetChannelId=a.channel.id,this.detailChannelId=r?null:a.channel.id,this.announce(`Channel ${o} created with 0 seats allocated.`),this.host.toast(r?`${o} created. Select seats on the map to allocate them.`:`${o} created.`,"ok"),this.paintRail()}catch(a){let l=a instanceof f?a.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(a)}}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,r=s?s.buckets:n,o=this.nameOf(s?.targetChannelId??this.targetChannelId)??E,a=ge(r,o),l=s?s.applied:K(n),h=!s&&t.length>0&&l===0,d=!s&&t.length>$,p=ae(a),w=s?'<div class="foot"><button type="button" class="slm-btn" data-ch-close>Done</button></div>':`<div class="foot">
536
+ </div>`,s=>{let r=s.querySelector("#slm-ch-name"),o=s.querySelector("[data-ch-marker]");r.addEventListener("input",()=>{let a=ee(r.value,t);o.textContent=a.letter,o.style.background=a.color}),s.querySelectorAll("[data-ch-create]").forEach(a=>{a.addEventListener("click",()=>{let l=a.dataset.chCreate==="allocate";this.createChannel(r.value,o.textContent??"",o.style.background,s.querySelector("#slm-ch-ref")?.value??"",l)})})})}async createChannel(e,t,n,s,r){let o=e.trim();if(!o){this.showDialogError("Give the channel a name your team will recognise.");return}try{let a=await this.host.api.createChannel(this.host.eventKey,{name:o,marker:_(t,"")||null,color:n||null,externalRef:s.trim()||null});this.closeDialog(),await this.refresh(),this.targetChannelId=a.channel.id,this.detailChannelId=r?null:a.channel.id,this.announce(`Channel ${o} created with 0 seats allocated.`),this.host.toast(r?`${o} created. Select seats on the map to allocate them.`:`${o} created.`,"ok"),this.paintRail()}catch(a){let l=a instanceof b?a.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(a)}}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,r=s?s.buckets:n,o=this.nameOf(s?.targetChannelId??this.targetChannelId)??E,a=ge(r,o),l=s?s.applied:X(n),h=!s&&t.length>0&&l===0,d=!s&&t.length>L,u=ae(a),w=s?'<div class="foot"><button type="button" class="slm-btn" data-ch-close>Done</button></div>':`<div class="foot">
518
537
  <button type="button" class="quiet" data-ch-close>Back</button>
519
538
  <button type="button" class="slm-btn" data-ch-apply ${h||d||e.busy?"disabled":""}>
520
539
  ${e.busy?"Applying\u2026":`Apply ${l.toLocaleString()} change${l===1?"":"s"}`}
521
540
  </button>
522
- </div>`,L=!s&&me(n)?'<p class="slm-note">Applying moves inventory out of another private channel. That is the line marked above.</p>':"",b=h?`<div class="slm-ch-alert warn"><span>\u2139</span><span>Nothing in this selection can move right now \u2014
523
- every seat is in a buyer's checkout, already sold, or already in ${c(o)}.</span></div>`:"",u=d?`<div class="slm-ch-alert warn" role="alert"><span>\u2139</span><span><b>Choose fewer seats.</b>
524
- One Apply can cover at most ${$.toLocaleString()} seats.</span></div>`:"";this.renderScrim(`
541
+ </div>`,x=!s&&me(n)?'<p class="slm-note">Applying moves inventory out of another private channel. That is the line marked above.</p>':"",v=h?`<div class="slm-ch-alert warn"><span>\u2139</span><span>Nothing in this selection can move right now \u2014
542
+ every seat is in a buyer's checkout, already sold, or already in ${c(o)}.</span></div>`:"",p=d?`<div class="slm-ch-alert warn" role="alert"><span>\u2139</span><span><b>Choose fewer seats.</b>
543
+ One Apply can cover at most ${L.toLocaleString()} seats.</span></div>`:"";this.renderScrim(`
525
544
  <h3 id="slm-ch-dlg-title">${s?`Moved ${s.applied.toLocaleString()} seat${s.applied===1?"":"s"} to ${c(o)}`:`Move ${t.length.toLocaleString()} selected seat${t.length===1?"":"s"} to ${c(o)}`}</h3>
526
545
  <p class="sub">${s?"These are the exact counts the server applied.":"Every selected seat is in exactly one line below."}</p>
527
- ${b}
528
- ${u}
529
- ${p||'<div class="slm-empty">Nothing selected.</div>'}
530
- ${L}
546
+ ${v}
547
+ ${p}
548
+ ${u||'<div class="slm-empty">Nothing selected.</div>'}
549
+ ${x}
531
550
  <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${c(e.error??"")}</p>
532
- ${w}`,m=>{m.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){if(e.length>$){this.showDialogError(`Choose at most ${$.toLocaleString()} seats for one Apply.`);return}this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();try{let t=await this.host.api.applyChannelAssignment(this.host.eventKey,{targetChannelId:M(this.targetChannelId)?null:this.targetChannelId,labels:e,assignmentVersion:this.assignmentVersion});this.assignmentVersion=t.assignmentVersion,this.conflict=!1,await this.refresh({quiet:!0}),this.closeDialog({restoreFocus:!1}),this.host.clearSelection(),this.showApplied(t)}catch(t){if(t instanceof f&&t.status===409&&t.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(t instanceof f&&t.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(t)}}}showApplied(e){let t=this.nameOf(e.targetChannelId)??E,n=e.buckets.skippedHeld.count+e.buckets.skippedBooked.count+e.buckets.notFound.count;this.setStaged(`<span class="slm-ch-tick" aria-hidden="true">\u2713</span>
551
+ ${w}`,m=>{m.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){if(e.length>L){this.showDialogError(`Choose at most ${L.toLocaleString()} seats for one Apply.`);return}this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();try{let t=await this.host.api.applyChannelAssignment(this.host.eventKey,{targetChannelId:M(this.targetChannelId)?null:this.targetChannelId,labels:e,assignmentVersion:this.assignmentVersion});this.assignmentVersion=t.assignmentVersion,this.conflict=!1,await this.refresh({quiet:!0}),this.closeDialog({restoreFocus:!1}),this.host.clearSelection(),this.showApplied(t)}catch(t){if(t instanceof b&&t.status===409&&t.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(t instanceof b&&t.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(t)}}}showApplied(e){let t=this.nameOf(e.targetChannelId)??E,n=e.buckets.skippedHeld.count+e.buckets.skippedBooked.count+e.buckets.notFound.count;this.setStaged(`<span class="slm-ch-tick" aria-hidden="true">\u2713</span>
533
552
  <span>Assigned <b>${e.applied.toLocaleString()}</b> seat${e.applied===1?"":"s"} to ${c(t)}
534
553
  ${n?` \xB7 ${n.toLocaleString()} skipped`:""}</span>
535
554
  <span class="grow"></span>
@@ -557,7 +576,24 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
557
576
  <div class="foot">
558
577
  <button type="button" class="quiet" data-ch-close>Cancel</button>
559
578
  <button type="button" class="slm-btn" data-ch-rename>Save name</button>
560
- </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(r=>{this.showDialogError(r instanceof f&&r.code==="channel_name_taken"?"That name is already used on this event.":"Couldn't rename the channel."),this.host.onError(r)})})})}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 f&&s.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:n,intentTo:e,switchBlocked:s.details}),!1):s instanceof f&&s.code==="channel_access_intent_forbids"?(this.host.toast(G(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.`:"",r=t.keptSessions?` ${t.keptSessions.toLocaleString()} buyer${t.keptSessions===1?"":"s"} already in a checkout can still finish.`:"";return`${n}${s}${r}`}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(a=>a.id===e.channelId);if(!t){this.closeDialog();return}let n=e.archiveBlocked??null,s=!n&&t.counts.held>0,r=this.assignableChannels().filter(a=>a.id!==t.id),o=n?`<div class="slm-ch-alert warn" role="alert"><span>\u23F3</span>
579
+ </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(r=>{this.showDialogError(r instanceof b&&r.code==="channel_name_taken"?"That name is already used on this event.":"Couldn't rename the channel."),this.host.onError(r)})})})}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])),r=this.host.categories().flatMap(o=>(o.tiers?.length?o.tiers:[null]).map(l=>{let h=l?.id??null,d=`${o.key}\0${h??""}`,u=l?.price??o.price??0,w=s.get(d),x=l?`${o.label} \xB7 ${l.name}`:o.label;return`<label class="slm-ch-price-row">
580
+ <span><b>${c(x)}</b><small>Event price ${c(String(u))}</small></span>
581
+ <input class="slm-input" type="number" min="0" max="1000000" step="0.01"
582
+ inputmode="decimal" aria-label="Custom price for ${c(x)}"
583
+ data-ch-price-category="${c(o.key)}" data-ch-price-tier="${c(h??"")}"
584
+ placeholder="${c(String(u))}" value="${w===void 0?"":c(String(w))}"
585
+ ${e.busy?"disabled":""} />
586
+ </label>`})).join("");this.renderScrim(`
587
+ <h3 id="slm-ch-dlg-title">Prices for ${c(t.name)}</h3>
588
+ <p class="sub">Set only the prices that differ for this audience. Leave a field blank to use the event price.</p>
589
+ <div class="slm-ch-price-list">${r||'<p class="slm-empty">This event has no priced categories.</p>'}</div>
590
+ <p class="slm-ch-err" data-ch-error ${e.error?"":"hidden"}>${c(e.error??"")}</p>
591
+ <div class="foot">
592
+ <button type="button" class="quiet" data-ch-close ${e.busy?"disabled":""}>Cancel</button>
593
+ <button type="button" class="slm-btn" data-ch-price-save ${e.busy||!r?"disabled":""}>
594
+ ${e.busy?"Saving\u2026":"Save prices"}
595
+ </button>
596
+ </div>`,o=>{o.querySelector("[data-ch-price-save]")?.addEventListener("click",()=>{let a=[];for(let l of o.querySelectorAll("[data-ch-price-category]")){let h=l.value.trim();if(!h)continue;let d=Number(h);if(!Number.isFinite(d)||d<0||d>1e6){l.focus(),this.showDialogError("Enter a price from 0 to 1,000,000, or leave the field blank.");return}a.push({categoryKey:l.dataset.chPriceCategory,tierId:l.dataset.chPriceTier||null,price:d})}this.saveChannelPricing(t,a)})})}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 b&&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 b&&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 b&&s.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:n,intentTo:e,switchBlocked:s.details}),!1):s instanceof b&&s.code==="channel_access_intent_forbids"?(this.host.toast(G(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.`:"",r=t.keptSessions?` ${t.keptSessions.toLocaleString()} buyer${t.keptSessions===1?"":"s"} already in a checkout can still finish.`:"";return`${n}${s}${r}`}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(a=>a.id===e.channelId);if(!t){this.closeDialog();return}let n=e.archiveBlocked??null,s=!n&&t.counts.held>0,r=this.assignableChannels().filter(a=>a.id!==t.id),o=n?`<div class="slm-ch-alert warn" role="alert"><span>\u23F3</span>
561
597
  <span><b>${(n.heldUnits??n.activeHolds??0).toLocaleString()} seats are in a buyer's checkout right now.</b>
562
598
  Archive is unavailable while seats are held \u2014 try again ${c(be(n))}.</span></div>`:s?`<div class="slm-ch-alert warn"><span>\u23F3</span>
563
599
  <span>${t.counts.held.toLocaleString()} seats are in a buyer's checkout right now.
@@ -579,12 +615,12 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
579
615
  <div class="foot">
580
616
  <button type="button" class="quiet" data-ch-close>Cancel</button>
581
617
  <button type="button" class="slm-btn danger" data-ch-archive ${n?"disabled":""}>Archive channel</button>
582
- </div>`,a=>{a.querySelector("[data-ch-archive]")?.addEventListener("click",()=>{let l=a.querySelector("#slm-ch-dest")?.value??"";this.archive(t.id,l||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 f&&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(){let e=new Set(this.host.selectionLabels()),t=new Map,n=0;for(let r of this.host.seats()){if(n+=1,n>this.seatListLimit)break;let o=this.host.sectionOfLabel(r.label),a=o?.id??"",l=t.get(a)??{label:o?.label??"Other seats",seats:[]};l.seats.push({label:r.label,status:this.host.statusOf(r.label)??"free"}),t.set(a,l)}let s=[...t.entries()].map(([r,o])=>`
618
+ </div>`,a=>{a.querySelector("[data-ch-archive]")?.addEventListener("click",()=>{let l=a.querySelector("#slm-ch-dest")?.value??"";this.archive(t.id,l||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 b&&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(){let e=new Set(this.host.selectionLabels()),t=new Map,n=0;for(let r of this.host.seats()){if(n+=1,n>this.seatListLimit)break;let o=this.host.sectionOfLabel(r.label),a=o?.id??"",l=t.get(a)??{label:o?.label??"Other seats",seats:[]};l.seats.push({label:r.label,status:this.host.statusOf(r.label)??"free"}),t.set(a,l)}let s=[...t.entries()].map(([r,o])=>`
583
619
  <div class="slm-ch-seatgroup">
584
620
  <span>${c(o.label)}</span>
585
621
  ${r?`<button type="button" data-ch-section="${c(r)}">Select section</button>`:""}
586
622
  </div>
587
- ${o.seats.map(a=>{let l=this.allocation.get(a.label)??C,h=this.nameOf(l)??E;return`<button type="button" class="slm-ch-seatitem" role="checkbox"
623
+ ${o.seats.map(a=>{let l=this.allocation.get(a.label)??$,h=this.nameOf(l)??E;return`<button type="button" class="slm-ch-seatitem" role="checkbox"
588
624
  aria-checked="${e.has(a.label)}" data-ch-seat="${c(a.label)}">
589
625
  <span class="box" aria-hidden="true">\u2713</span>
590
626
  <span>${c(a.label)}</span>
@@ -633,7 +669,7 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
633
669
  <div class="foot">
634
670
  <button type="button" class="quiet" data-ch-close>Cancel</button>
635
671
  <button type="button" class="slm-btn" data-ch-lk-create>Create link</button>
636
- </div>`,n=>{let s=n.querySelector("[data-ch-lk-expiry]"),r=n.querySelector("[data-ch-lk-when-field]"),o=n.querySelector("#slm-ch-lk-when");s.addEventListener("change",()=>{let a=s.value==="custom";r.hidden=!a,a&&!o.value&&(o.value=Re(Date.now()+7*864e5))}),n.querySelector("[data-ch-lk-create]")?.addEventListener("click",()=>{let a=oe(n,"#slm-ch-lk-redemptions"),l=oe(n,"#slm-ch-lk-quantity");if(a==null||l==null){this.showDialogError("Those two settings need to be whole numbers.");return}let h;if(s.value==="custom"&&(h=Date.parse(o.value),!Number.isFinite(h))){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,...h===void 0?{}:{expiresAt:h},maxRedemptions:a,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(j(n instanceof f?n:void 0)),n instanceof f||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 f&&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 f&&s.code==="channel_access_intent_forbids"?G(s.details):"Couldn't set this channel up for buyer links. Try again."),s instanceof f||this.host.onError(s),!1)}}revealLink(e,t){let n=e.url;this.dialog=null;let s=t.rotated?`<div class="slm-ch-alert warn" role="status"><span>\u26A0</span><span>
672
+ </div>`,n=>{let s=n.querySelector("[data-ch-lk-expiry]"),r=n.querySelector("[data-ch-lk-when-field]"),o=n.querySelector("#slm-ch-lk-when");s.addEventListener("change",()=>{let a=s.value==="custom";r.hidden=!a,a&&!o.value&&(o.value=Re(Date.now()+7*864e5))}),n.querySelector("[data-ch-lk-create]")?.addEventListener("click",()=>{let a=oe(n,"#slm-ch-lk-redemptions"),l=oe(n,"#slm-ch-lk-quantity");if(a==null||l==null){this.showDialogError("Those two settings need to be whole numbers.");return}let h;if(s.value==="custom"&&(h=Date.parse(o.value),!Number.isFinite(h))){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,...h===void 0?{}:{expiresAt:h},maxRedemptions:a,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(j(n instanceof b?n:void 0)),n instanceof b||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 b&&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 b&&s.code==="channel_access_intent_forbids"?G(s.details):"Couldn't set this channel up for buyer links. Try again."),s instanceof b||this.host.onError(s),!1)}}revealLink(e,t){let n=e.url;this.dialog=null;let s=t.rotated?`<div class="slm-ch-alert warn" role="status"><span>\u26A0</span><span>
637
673
  <b>The old link has stopped working.</b> ${e.endedSessions?`${e.endedSessions.toLocaleString()} buyer${e.endedSessions===1?"":"s"} lost access immediately.`:"Buyers who already came in can finish; every new visit needs this link."}</span></div>`:"",r=se(e.link).map(o=>`<div class="slm-ch-lkrow"><span class="k">${c(o.k)}</span>
638
674
  <span class="v">${c(o.v)}</span></div>`).join("");this.renderScrim(`
639
675
  <h3 id="slm-ch-dlg-title">Copy this link now</h3>
@@ -673,7 +709,7 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
673
709
  <div class="foot">
674
710
  <button type="button" class="quiet" data-ch-close>Cancel</button>
675
711
  <button type="button" class="slm-btn" data-ch-lk-rotate disabled>Rotate and copy new link</button>
676
- </div>`,r=>{let o=r.querySelector("[data-ch-lk-rotate]");r.querySelectorAll("[data-ch-rot]").forEach(a=>{a.addEventListener("change",()=>{o.disabled=!1})}),o.addEventListener("click",()=>{let a=[...r.querySelectorAll("[data-ch-rot]")].find(l=>l.checked);if(!a){this.showDialogError(j({code:"end_active_sessions_required"}));return}this.rotateLink(e.channelId,t.id,a.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(j(s instanceof f?s:void 0)),s instanceof f||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(`
712
+ </div>`,r=>{let o=r.querySelector("[data-ch-lk-rotate]");r.querySelectorAll("[data-ch-rot]").forEach(a=>{a.addEventListener("change",()=>{o.disabled=!1})}),o.addEventListener("click",()=>{let a=[...r.querySelectorAll("[data-ch-rot]")].find(l=>l.checked);if(!a){this.showDialogError(j({code:"end_active_sessions_required"}));return}this.rotateLink(e.channelId,t.id,a.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(j(s instanceof b?s:void 0)),s instanceof b||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(`
677
713
  <h3 id="slm-ch-dlg-title">Revoke the ${c(t.label||"buyer")} link?</h3>
678
714
  <p class="sub">It stops opening immediately and cannot be restored \u2014 there is no undo, and no way to
679
715
  bring the same URL back. Seats already bought through it keep their sale.</p>
@@ -687,4 +723,4 @@ var C="public",E="Public sale";function M(i){return i==null||i===""||i===C}var X
687
723
  <div class="foot">
688
724
  <button type="button" class="quiet" data-ch-close>Cancel</button>
689
725
  <button type="button" class="slm-btn danger" data-ch-lk-revoke>Revoke link</button>
690
- </div>`,s=>{s.querySelector("[data-ch-lk-revoke]")?.addEventListener("click",()=>{let r=s.querySelector("[data-ch-lk-endsessions]")?.checked??!1;this.revokeLink(e.channelId,t.id,r)})})}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(j(s instanceof f?s:void 0)),s instanceof f||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{f as a,Ce as b,C as c,E as d,M as e,_ as f,ee as g,de as h,ue as i,pe as j,K as k,me as l,ge as m,be as n,ve as o,q as p,fe as q,G as r,ye as s,te as t,ke as u,ne as v,se as w,j as x,Ze as y,we as z,ae as A,Qe as B,Ee as C};
726
+ </div>`,s=>{s.querySelector("[data-ch-lk-revoke]")?.addEventListener("click",()=>{let r=s.querySelector("[data-ch-lk-endsessions]")?.checked??!1;this.revokeLink(e.channelId,t.id,r)})})}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(j(s instanceof b?s:void 0)),s instanceof b||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{b as a,Ce as b,$ as c,E as d,M as e,_ as f,ee as g,de as h,ue as i,pe as j,X as k,me as l,ge as m,be as n,ve as o,q as p,fe as q,G as r,ye as s,te as t,ke as u,ne as v,se as w,j as x,Ze as y,we as z,ae as A,Qe as B,Ee as C};