courthive-components 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`tods-competition-factory`)):typeof define==`function`&&define.amd?define([`exports`,`tods-competition-factory`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`courthive-components`]={},e.competitionFactory))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(e&&(t=e(e=0)),t),l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),u=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n},d=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},f=(e,t,i)=>(i=e==null?{}:n(o(e)),d(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),p=f(l(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))());function m({variant:e}){return(0,p.default)(`chc-placeholder`,e===`showAddress`&&`chc-placeholder--show-address`)}var h=e=>`chc-participant`,g=e=>(0,p.default)(`chc-participant-name`,e?.variant&&`chc-participant-name--${e.variant}`),_=e=>(0,p.default)(`chc-participant-type`,e?.variant&&`chc-participant-type--${e.variant}`);function v({drawPosition:e,sideNumber:t}){let n=(0,p.default)(`chc-participant-container`,t===1&&`chc-participant-container--side1`);return e?`${n} chc-has-draw-position`:n}function y({winnerChevron:e,isDoubles:t}){return e?t?`chc-chevron-doubles--winner`:`chc-chevron--winner`:``}var b=()=>`chc-participant-detail`;function x({individualParticipant:e,className:t}){let{city:n,state:r,countryCode:i}=e?.person?.addresses?.[0]||{},a=[n,r,i].filter(Boolean).join(`, `)||` `,o=document.createElement(`div`);return o.className=(0,p.default)(b(),t),o.innerHTML=a,o}var S=()=>`chc-backdrop`,C=()=>`chc-modal`,w=()=>`chc-body-freeze`,T=()=>`chc-modal-container`,E=()=>`chc-modal-dialog`,D=()=>`chc-modal-header`,O=()=>`chc-modal-title`,k=()=>`chc-modal-footer`,A=`Nothing to see here`;function j(e){return typeof e==`function`}function M(e){return typeof e==`string`}function N(e){return Array.isArray(e)}function P(e){if(e)for(;e.firstChild;)e.firstChild.remove()}var F=(()=>{let e=w(),t={},n=[],r,i=[],a=[],o,s=e=>{if(e){let t;a=a.filter(n=>(n.id===e&&(t=n),n.id!==e)),t&&t.remove()}else{let e=a.pop();e&&e.remove()}},c=()=>{o&&(o.style.opacity=`0`,o.style.display=`none`)},l=o=>{let l=a.length;if(o&&t[l]===!1)return;let u=i.pop(),d=n.pop();j(u)&&u({content:d}),document.querySelectorAll(`[data-modal-popover]`).forEach(e=>e.remove()),document.body.classList.remove(e),document.body.style.top=null,window.scrollTo({top:r,behavior:`instant`}),c(),s()},u=()=>{o=document.createElement(`div`),o.className=S(),o.id=`cmdl-backdrop`,o.onclick=()=>l(!0),document.body.appendChild(o)},d=({config:t})=>{r=window.scrollY,document.body.classList.add(e),document.body.style.top=`-${r}px`,o||u(),o.style.display=``,t?.backdrop!==!1&&(o.style.backgroundColor=`var(--chc-bg-overlay)`,o.style.transition=`opacity 0.15s linear`,o.style.opacity=`1`)},f=({config:e,attr:t,attrs:n,unit:r=`em`,value:i})=>{let a;return M(t)?a=I({element:e,attr:t}):N(n)&&(a=n.map(t=>I({element:e,attr:t})).find(Boolean)),a!==void 0&&(i=a),Number.isNaN(i)?i:`${i}${r}`},p=({buttons:e,config:t,modalNumber:r})=>{let i=document.createElement(`div`);i.className=k(),i.style.padding=f({config:t,attrs:[`footer.padding`,`padding`],value:`.5`});let a={label:t?.dictionary?.close||`Close`,onClick:()=>F.close(),intent:`is-info`};for(let t of e){if(t.hide)continue;let e={...a,...t},o=document.createElement(`button`);e.disabled!==void 0&&(o.disabled=e.disabled),e.id&&(o.id=e.id),o.className=e?.footer?.className||`button font-medium`,e.intent&&e.intent!==`none`&&o.classList.add(e.intent);let s=e?.footer?.style||``;o.style.cssText=`margin-right: .5em;`+(s?` `+s:``),o.innerHTML=e.label||e.text||``,o.onclick=t=>{t.stopPropagation(),j(e.onClick)&&e.onClick({e:t,content:n[r]}),e.close!==!1&&(j(e.close)&&e.close(),F.close())},i.appendChild(o)}return i};return{close:l,open:({title:e=``,content:r,buttons:o,footer:s,config:c,onClose:u}={})=>{d({config:c}),i.push(u);let m=a.length+1;t[m]=c?.clickAway;let h=document.createElement(`section`),g=`cmdl-${m}`;h.className=C(),h.role=`dialog`,h.tabIndex=-1,h.id=g;let _=document.createElement(`div`);_.className=T(),_.style.maxWidth=`${c?.maxWidth||450}px`,_.onclick=()=>l(!0);let v=document.createElement(`div`);v.className=E(),v.style.color=`var(--chc-text-primary)`,c?.className&&v.classList.add(c.className),c?.style&&Object.assign(v.style,c.style),v.onclick=e=>e.stopPropagation();let y=document.createElement(`div`),b=document.createElement(`div`);y.appendChild(b);let x=document.createElement(`div`);x.style.cssText=`display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0;`;let S,w;if(c?.info){S=document.createElement(`span`),S.innerHTML=`?`,S.style.cssText=`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`tods-competition-factory`)):typeof define==`function`&&define.amd?define([`exports`,`tods-competition-factory`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`courthive-components`]={},e.competitionFactory))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(e&&(t=e(e=0)),t),l=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),u=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n},d=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},f=(e,t,i)=>(i=e==null?{}:n(o(e)),d(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),p=f(l(((e,t)=>{(function(){"use strict";var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}))());function m({variant:e}){return(0,p.default)(`chc-placeholder`,e===`showAddress`&&`chc-placeholder--show-address`)}var h=e=>`chc-participant`,g=e=>(0,p.default)(`chc-participant-name`,e?.variant&&`chc-participant-name--${e.variant}`),_=e=>(0,p.default)(`chc-participant-type`,e?.variant&&`chc-participant-type--${e.variant}`);function v({drawPosition:e,sideNumber:t}){let n=(0,p.default)(`chc-participant-container`,t===1&&`chc-participant-container--side1`);return e?`${n} chc-has-draw-position`:n}function y({winnerChevron:e,isDoubles:t}){return e?t?`chc-chevron-doubles--winner`:`chc-chevron--winner`:``}var b=()=>`chc-participant-detail`;function x({individualParticipant:e,className:t}){let{city:n,state:r,countryCode:i}=e?.person?.addresses?.[0]||{},a=[n,r,i].filter(Boolean).join(`, `)||` `,o=document.createElement(`div`);return o.className=(0,p.default)(b(),t),o.innerHTML=a,o}var S=()=>`chc-backdrop`,C=()=>`chc-modal`,w=()=>`chc-body-freeze`,T=()=>`chc-modal-container`,E=()=>`chc-modal-dialog`,D=()=>`chc-modal-header`,O=()=>`chc-modal-title`,k=()=>`chc-modal-footer`,A=`Nothing to see here`;function j(e){return typeof e==`function`}function M(e){return typeof e==`string`}function N(e){return Array.isArray(e)}function P(e){if(e)for(;e.firstChild;)e.firstChild.remove()}var F=(()=>{let e=w(),t={},n=[],r,i=[],a=[],o,s=e=>{if(e){let t;a=a.filter(n=>(n.id===e&&(t=n),n.id!==e)),t&&t.remove()}else{let e=a.pop();e&&e.remove()}},c=()=>{o&&(o.style.opacity=`0`,o.style.display=`none`)},l=o=>{let l=a.length;if(o&&t[l]===!1)return;let u=i.pop(),d=n.pop();j(u)&&u({content:d}),document.querySelectorAll(`[data-modal-popover]`).forEach(e=>e.remove()),document.body.classList.remove(e),document.body.style.top=null,window.scrollTo({top:r,behavior:`instant`}),c(),s()},u=()=>{o=document.createElement(`div`),o.className=S(),o.id=`cmdl-backdrop`,o.onclick=()=>l(!0),document.body.appendChild(o)},d=({config:t})=>{r=window.scrollY,document.body.classList.add(e),document.body.style.top=`-${r}px`,o||u(),o.style.display=``,t?.backdrop!==!1&&(o.style.backgroundColor=`var(--chc-bg-overlay)`,o.style.transition=`opacity 0.15s linear`,o.style.opacity=`1`)},f=({config:e,attr:t,attrs:n,unit:r=`em`,value:i})=>{let a;return M(t)?a=I({element:e,attr:t}):N(n)&&(a=n.map(t=>I({element:e,attr:t})).find(Boolean)),a!==void 0&&(i=a),Number.isNaN(i)?i:`${i}${r}`},p=({buttons:e,config:t,modalNumber:r})=>{let i=document.createElement(`div`);i.className=k(),i.style.padding=f({config:t,attrs:[`footer.padding`,`padding`],value:`.5`});let a={label:t?.dictionary?.close||`Close`,onClick:()=>F.close(),intent:`is-info`};for(let t of e){if(t.hide)continue;let e={...a,...t},o=document.createElement(`button`);e.disabled!==void 0&&(o.disabled=e.disabled),e.id&&(o.id=e.id),o.className=e?.footer?.className||`button font-medium`,e.intent&&e.intent!==`none`&&o.classList.add(e.intent);let s=e?.footer?.style||``;o.style.cssText=`margin-right: .5em;`+(s?` `+s:``),o.innerHTML=e.label||e.text||``,o.onclick=t=>{t.stopPropagation(),j(e.onClick)&&e.onClick({e:t,content:n[r]}),e.close!==!1&&(j(e.close)&&e.close(),F.close())},i.appendChild(o)}return i};return{close:l,open:({title:e=``,content:r,buttons:o,footer:s,config:c,onClose:u}={})=>{d({config:c}),i.push(u);let m=a.length+1;t[m]=c?.clickAway;let h=document.createElement(`section`),g=`cmdl-${m}`;h.className=C(),h.role=`dialog`,h.tabIndex=-1,h.id=g;let _=document.createElement(`div`);_.className=T(),_.style.maxWidth=`${c?.maxWidth||450}px`,_.onclick=()=>l(!0);let v=document.createElement(`div`);v.className=E(),v.style.color=`var(--chc-text-primary)`,c?.className&&v.classList.add(c.className),c?.style&&Object.assign(v.style,c.style),v.onclick=e=>e.stopPropagation();let y=document.createElement(`div`),b=document.createElement(`div`);y.appendChild(b);let x=document.createElement(`div`);x.style.cssText=`display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0;`;let S,w;if(c?.info){S=document.createElement(`span`),S.innerHTML=`?`,S.style.cssText=`
2
2
  cursor: pointer;
3
3
  display: inline-flex;
4
4
  align-items: center;
@@ -73,7 +73,7 @@
73
73
  </div>`),pt=ce(`<div class="week-numbers calendar-weeks">
74
74
  <div class="days-of-week"><span class="dow"></span></div>
75
75
  <div class="weeks">${se(`span`,6,{class:`week`})}</div>
76
- </div>`),mt=class{constructor(e,t){Object.assign(this,t,{picker:e,element:Ie(`<div class="datepicker-view"></div>`).firstChild,selected:[],isRangeEnd:!!e.datepicker.rangeSideIndex}),this.init(this.picker.datepicker.config)}init(e){`pickLevel`in e&&(this.isMinView=this.id===e.pickLevel),this.setOptions(e),this.updateFocus(),this.updateSelection()}prepareForRender(e,t,n){this.disabled=[];let r=this.picker;r.setViewSwitchLabel(e),r.setPrevButtonDisabled(t),r.setNextButtonDisabled(n)}setDisabled(e,t){t.add(`disabled`),re(this.disabled,e)}performBeforeHook(e,t){let n=this.beforeShow(new Date(t));switch(typeof n){case`boolean`:n={enabled:n};break;case`string`:n={classes:n}}if(n){let r=e.classList;if(n.enabled===!1&&this.setDisabled(t,r),n.classes){let e=n.classes.split(/\s+/);r.add(...e),e.includes(`disabled`)&&this.setDisabled(t,r)}n.content&&He(e,n.content)}}renderCell(e,t,n,r,{selected:i,range:a},o,s=[]){e.textContent=t,this.isMinView&&(e.dataset.date=r);let c=e.classList;if(e.className=`datepicker-cell ${this.cellClass}`,n<this.first?c.add(`prev`):n>this.last&&c.add(`next`),c.add(...s),(o||this.checkDisabled(r,this.id))&&this.setDisabled(r,c),a){let[e,t]=a;n>e&&n<t&&c.add(`range`),n===e&&c.add(`range-start`),n===t&&c.add(`range-end`)}i.includes(n)&&c.add(`selected`),n===this.focused&&c.add(`focused`),this.beforeShow&&this.performBeforeHook(e,r)}refreshCell(e,t,n,[r,i]){let a=e.classList;a.remove(`range`,`range-start`,`range-end`,`selected`,`focused`),t>r&&t<i&&a.add(`range`),t===r&&a.add(`range-start`),t===i&&a.add(`range-end`),n.includes(t)&&a.add(`selected`),t===this.focused&&a.add(`focused`)}changeFocusedCell(e){this.grid.querySelectorAll(`.focused`).forEach(e=>{e.classList.remove(`focused`)}),this.grid.children[e].classList.add(`focused`)}},ht=class extends mt{constructor(e){super(e,{id:0,name:`days`,cellClass:`day`})}init(e,t=!0){if(t){let e=Ie(ft).firstChild;this.dow=e.firstChild,this.grid=e.lastChild,this.element.appendChild(e)}super.init(e)}setOptions(e){let t;if(`minDate`in e&&(this.minDate=e.minDate),`maxDate`in e&&(this.maxDate=e.maxDate),e.checkDisabled&&(this.checkDisabled=e.checkDisabled),e.daysOfWeekDisabled&&(this.daysOfWeekDisabled=e.daysOfWeekDisabled,t=!0),e.daysOfWeekHighlighted&&(this.daysOfWeekHighlighted=e.daysOfWeekHighlighted),`todayHighlight`in e&&(this.todayHighlight=e.todayHighlight),`weekStart`in e&&(this.weekStart=e.weekStart,this.weekEnd=e.weekEnd,t=!0),e.locale){let n=this.locale=e.locale;this.dayNames=n.daysMin,this.switchLabelFormat=n.titleFormat,t=!0}if(`beforeShowDay`in e&&(this.beforeShow=typeof e.beforeShowDay==`function`?e.beforeShowDay:void 0),`weekNumbers`in e)if(e.weekNumbers&&!this.weekNumbers){let e=Ie(pt).firstChild;this.weekNumbers={element:e,dow:e.firstChild,weeks:e.lastChild},this.element.insertBefore(e,this.element.firstChild)}else this.weekNumbers&&!e.weekNumbers&&(this.element.removeChild(this.weekNumbers.element),this.weekNumbers=null);`getWeekNumber`in e&&(this.getWeekNumber=e.getWeekNumber),`showDaysOfWeek`in e&&(e.showDaysOfWeek?(Be(this.dow),this.weekNumbers&&Be(this.weekNumbers.dow)):(ze(this.dow),this.weekNumbers&&ze(this.weekNumbers.dow))),t&&Array.from(this.dow.children).forEach((e,t)=>{let n=(this.weekStart+t)%7;e.textContent=this.dayNames[n],e.className=this.daysOfWeekDisabled.includes(n)?`dow disabled`:`dow`})}updateFocus(){let e=new Date(this.picker.viewDate),t=e.getFullYear(),n=e.getMonth(),r=de(t,n,1),i=_e(r,this.weekStart,this.weekStart);this.first=r,this.last=de(t,n+1,0),this.start=i,this.focused=this.picker.viewDate}updateSelection(){let{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e,t&&(this.range=t.dates)}render(){if(this.today=this.todayHighlight?ue():void 0,this.prepareForRender(Pe(this.focused,this.switchLabelFormat,this.locale),this.first<=this.minDate,this.last>=this.maxDate),this.weekNumbers){let e=this.weekStart,t=_e(this.first,e,e);Array.from(this.weekNumbers.weeks.children).forEach((n,r)=>{let i=pe(t,r);n.textContent=this.getWeekNumber(i,e),r>3&&n.classList[i>this.last?`add`:`remove`](`next`)})}Array.from(this.grid.children).forEach((e,t)=>{let n=fe(this.start,t),r=new Date(n),i=r.getDay(),a=[];this.today===n&&a.push(`today`),this.daysOfWeekHighlighted.includes(i)&&a.push(`highlighted`),this.renderCell(e,r.getDate(),n,n,this,n<this.minDate||n>this.maxDate||this.daysOfWeekDisabled.includes(i),a)})}refresh(){let e=this.range||[];Array.from(this.grid.children).forEach(t=>{this.refreshCell(t,Number(t.dataset.date),this.selected,e)})}refreshFocus(){this.changeFocusedCell(Math.round((this.focused-this.start)/864e5))}};function gt(e,t){if(!e||!e[0]||!e[1])return;let[[n,r],[i,a]]=e;if(!(n>t||i<t))return[n===t?r:-1,i===t?a:12]}var _t=class extends mt{constructor(e){super(e,{id:1,name:`months`,cellClass:`month`})}init(e,t=!0){t&&(this.grid=this.element,this.element.classList.add(`months`,`datepicker-grid`),this.grid.appendChild(Ie(se(`span`,12,{"data-month":e=>e}))),this.first=0,this.last=11),super.init(e)}setOptions(e){if(e.locale&&(this.monthNames=e.locale.monthsShort),`minDate`in e)if(e.minDate===void 0)this.minYear=this.minMonth=this.minDate=void 0;else{let t=new Date(e.minDate);this.minYear=t.getFullYear(),this.minMonth=t.getMonth(),this.minDate=t.setDate(1)}if(`maxDate`in e)if(e.maxDate===void 0)this.maxYear=this.maxMonth=this.maxDate=void 0;else{let t=new Date(e.maxDate);this.maxYear=t.getFullYear(),this.maxMonth=t.getMonth(),this.maxDate=de(this.maxYear,this.maxMonth+1,0)}e.checkDisabled&&(this.checkDisabled=this.isMinView||e.datesDisabled===null?e.checkDisabled:()=>!1),`beforeShowMonth`in e&&(this.beforeShow=typeof e.beforeShowMonth==`function`?e.beforeShowMonth:void 0)}updateFocus(){let e=new Date(this.picker.viewDate);this.year=e.getFullYear(),this.focused=e.getMonth()}updateSelection(){let{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e.reduce((e,t)=>{let n=new Date(t),r=n.getFullYear(),i=n.getMonth();return e[r]===void 0?e[r]=[i]:re(e[r],i),e},{}),t&&t.dates&&(this.range=t.dates.map(e=>{let t=new Date(e);return isNaN(t)?void 0:[t.getFullYear(),t.getMonth()]}))}render(){this.prepareForRender(this.year,this.year<=this.minYear,this.year>=this.maxYear);let e=this.selected[this.year]||[],t=this.year<this.minYear||this.year>this.maxYear,n=this.year===this.minYear,r=this.year===this.maxYear,i=gt(this.range,this.year);Array.from(this.grid.children).forEach((a,o)=>{let s=we(new Date(this.year,o,1),1,this.isRangeEnd);this.renderCell(a,this.monthNames[o],o,s,{selected:e,range:i},t||n&&o<this.minMonth||r&&o>this.maxMonth)})}refresh(){let e=this.selected[this.year]||[],t=gt(this.range,this.year)||[];Array.from(this.grid.children).forEach((n,r)=>{this.refreshCell(n,r,e,t)})}refreshFocus(){this.changeFocusedCell(this.focused)}};function vt(e){return[...e].reduce((e,t,n)=>e+=n?t:t.toUpperCase(),``)}var yt=class extends mt{constructor(e,t){super(e,t)}init(e,t=!0){t&&(this.navStep=this.step*10,this.beforeShowOption=`beforeShow${vt(this.cellClass)}`,this.grid=this.element,this.element.classList.add(this.name,`datepicker-grid`),this.grid.appendChild(Ie(se(`span`,12)))),super.init(e)}setOptions(e){if(`minDate`in e&&(e.minDate===void 0?this.minYear=this.minDate=void 0:(this.minYear=Ce(e.minDate,this.step),this.minDate=de(this.minYear,0,1))),`maxDate`in e&&(e.maxDate===void 0?this.maxYear=this.maxDate=void 0:(this.maxYear=Ce(e.maxDate,this.step),this.maxDate=de(this.maxYear,11,31))),e.checkDisabled&&(this.checkDisabled=this.isMinView||e.datesDisabled===null?e.checkDisabled:()=>!1),this.beforeShowOption in e){let t=e[this.beforeShowOption];this.beforeShow=typeof t==`function`?t:void 0}}updateFocus(){let e=new Date(this.picker.viewDate),t=Ce(e,this.navStep),n=t+9*this.step;this.first=t,this.last=n,this.start=t-this.step,this.focused=Ce(e,this.step)}updateSelection(){let{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e.reduce((e,t)=>re(e,Ce(t,this.step)),[]),t&&t.dates&&(this.range=t.dates.map(e=>{if(e!==void 0)return Ce(e,this.step)}))}render(){this.prepareForRender(`${this.first}-${this.last}`,this.first<=this.minYear,this.last>=this.maxYear),Array.from(this.grid.children).forEach((e,t)=>{let n=this.start+t*this.step,r=we(new Date(n,0,1),2,this.isRangeEnd);e.dataset.year=n,this.renderCell(e,n,n,r,this,n<this.minYear||n>this.maxYear)})}refresh(){let e=this.range||[];Array.from(this.grid.children).forEach(t=>{this.refreshCell(t,Number(t.textContent),this.selected,e)})}refreshFocus(){this.changeFocusedCell(Math.round((this.focused-this.start)/this.step))}};function bt(e,t){let n={bubbles:!0,cancelable:!0,detail:{date:e.getDate(),viewDate:new Date(e.picker.viewDate),viewId:e.picker.currentView.id,datepicker:e}};e.element.dispatchEvent(new CustomEvent(t,n))}function xt(e,t){let{config:n,picker:r}=e,{currentView:i,viewDate:a}=r,o;switch(i.id){case 0:o=me(a,t);break;case 1:o=he(a,t);break;default:o=he(a,t*i.navStep)}o=oe(o,n.minDate,n.maxDate),r.changeFocus(o).render()}function St(e){let t=e.picker.currentView.id;t!==e.config.maxView&&e.picker.changeView(t+1).render()}function Ct(e){e.setDate({clear:!0})}function wt(e){let t=ue();e.config.todayButtonMode===1?e.setDate(t,{forceRefresh:!0,viewDate:t}):e.setFocusedDate(t,!0)}function Tt(e){let t=()=>{e.config.updateOnBlur?e.update({revert:!0}):e.refresh(`input`),e.hide()},n=e.element;Re(n)?n.addEventListener(`blur`,t,{once:!0}):t()}function Et(e,t){let n=e.picker,r=new Date(n.viewDate),i=n.currentView.id,a=i===1?me(r,t-r.getMonth()):he(r,t-r.getFullYear());n.changeFocus(a).changeView(i-1).render()}function Dt(e){St(e)}function Ot(e){xt(e,-1)}function kt(e){xt(e,1)}function At(e,t){let n=Ye(t,`.datepicker-cell`);if(!n||n.classList.contains(`disabled`))return;let{id:r,isMinView:i}=e.picker.currentView,a=n.dataset;i?e.setDate(Number(a.date)):r===1?Et(e,Number(a.month)):Et(e,Number(a.year))}function jt(e){e.preventDefault()}var Mt=[`left`,`top`,`right`,`bottom`].reduce((e,t)=>(e[t]=`datepicker-orient-${t}`,e),{}),Nt=e=>e&&`${e}px`;function Pt(e,t){if(`title`in t&&(t.title?(e.controls.title.textContent=t.title,Be(e.controls.title)):(e.controls.title.textContent=``,ze(e.controls.title))),t.prevArrow){let n=e.controls.prevButton;Ve(n),t.prevArrow.forEach(e=>{n.appendChild(e.cloneNode(!0))})}if(t.nextArrow){let n=e.controls.nextButton;Ve(n),t.nextArrow.forEach(e=>{n.appendChild(e.cloneNode(!0))})}if(t.locale&&(e.controls.todayButton.textContent=t.locale.today,e.controls.clearButton.textContent=t.locale.clear),`todayButton`in t&&(t.todayButton?Be(e.controls.todayButton):ze(e.controls.todayButton)),`minDate`in t||`maxDate`in t){let{minDate:t,maxDate:n}=e.datepicker.config;e.controls.todayButton.disabled=!ae(ue(),t,n)}`clearButton`in t&&(t.clearButton?Be(e.controls.clearButton):ze(e.controls.clearButton))}function Ft(e){let{dates:t,config:n,rangeSideIndex:r}=e;return oe(t.length>0?V(t):we(n.defaultViewDate,n.pickLevel,r),n.minDate,n.maxDate)}function It(e,t){!(`_oldViewDate`in e)&&t!==e.viewDate&&(e._oldViewDate=e.viewDate),e.viewDate=t;let{id:n,year:r,first:i,last:a}=e.currentView,o=new Date(t).getFullYear();switch(n){case 0:return t<i||t>a;case 1:return o!==r;default:return o<i||o>a}}function Lt(e){return window.getComputedStyle(e).direction}function Rt(e){let t=Le(e);if(!(t===document.body||!t))return window.getComputedStyle(t).overflow===`visible`?Rt(t):t}var zt=class{constructor(e){let{config:t,inputField:n}=this.datepicker=e,r=this.element=Ie(dt.replace(/%buttonClass%/g,t.buttonClass)).firstChild,[i,a,o]=r.firstChild.children,s=i.firstElementChild,[c,l,u]=i.lastElementChild.children,[d,f]=o.firstChild.children,p={title:s,prevButton:c,viewSwitch:l,nextButton:u,todayButton:d,clearButton:f};this.main=a,this.controls=p;let m=n?`dropdown`:`inline`;r.classList.add(`datepicker-${m}`),Pt(this,t),this.viewDate=Ft(e),Ke(e,[[r,`mousedown`,jt],[a,`click`,At.bind(null,e)],[p.viewSwitch,`click`,Dt.bind(null,e)],[p.prevButton,`click`,Ot.bind(null,e)],[p.nextButton,`click`,kt.bind(null,e)],[p.todayButton,`click`,wt.bind(null,e)],[p.clearButton,`click`,Ct.bind(null,e)]]),this.views=[new ht(this),new _t(this),new yt(this,{id:2,name:`years`,cellClass:`year`,step:1}),new yt(this,{id:3,name:`decades`,cellClass:`decade`,step:10})],this.currentView=this.views[t.startView],this.currentView.render(),this.main.appendChild(this.currentView.element),t.container?t.container.appendChild(this.element):n.after(this.element)}setOptions(e){Pt(this,e),this.views.forEach(t=>{t.init(e,!1)}),this.currentView.render()}detach(){this.element.remove()}show(){if(this.active)return;let{datepicker:e,element:t}=this,n=e.inputField;if(n){let r=Lt(n);r===Lt(Le(t))?t.dir&&t.removeAttribute(`dir`):t.dir=r,this.place(),t.classList.add(`active`),e.config.disableTouchKeyboard&&n.blur()}else t.classList.add(`active`);this.active=!0,bt(e,`show`)}hide(){this.active&&(this.datepicker.exitEditMode(),this.element.classList.remove(`active`),this.active=!1,bt(this.datepicker,`hide`))}place(){let{classList:e,style:t}=this.element;t.display=`block`;let{width:n,height:r}=this.element.getBoundingClientRect(),i=this.element.offsetParent;t.display=``;let{config:a,inputField:o}=this.datepicker,{left:s,top:c,right:l,bottom:u,width:d,height:f}=o.getBoundingClientRect(),{x:p,y:m}=a.orientation,h=s,g=c;if(i===document.body||!i)h+=window.scrollX,g+=window.scrollY;else{let e=i.getBoundingClientRect();h-=e.left-i.scrollLeft,g-=e.top-i.scrollTop}let _=Rt(o),v=0,y=0,{clientWidth:b,clientHeight:x}=document.documentElement;if(_){let e=_.getBoundingClientRect();e.top>0&&(y=e.top),e.left>0&&(v=e.left),e.right<b&&(b=e.right),e.bottom<x&&(x=e.bottom)}let S=0;p===`auto`&&(s<v?(p=`left`,S=v-s):s+n>b?(p=`right`,b<l&&(S=b-l)):p=Lt(o)===`rtl`?l-n<v?`left`:`right`:`left`),p===`right`&&(h+=d-n),h+=S,m===`auto`&&(m=c-r>y&&u+r>x?`top`:`bottom`),m===`top`?g-=r:g+=f,e.remove(...Object.values(Mt)),e.add(Mt[p],Mt[m]),t.left=Nt(h),t.top=Nt(g)}setViewSwitchLabel(e){this.controls.viewSwitch.textContent=e}setPrevButtonDisabled(e){this.controls.prevButton.disabled=e}setNextButtonDisabled(e){this.controls.nextButton.disabled=e}changeView(e){let t=this.currentView;return e!==t.id&&(this._oldView||=t,this.currentView=this.views[e],this._renderMethod=`render`),this}changeFocus(e){return this._renderMethod=It(this,e)?`render`:`refreshFocus`,this.views.forEach(e=>{e.updateFocus()}),this}update(e=void 0){let t=e===void 0?Ft(this.datepicker):e;return this._renderMethod=It(this,t)?`render`:`refresh`,this.views.forEach(e=>{e.updateFocus(),e.updateSelection()}),this}render(e=!0){let{currentView:t,datepicker:n,_oldView:r}=this,i=new Date(this._oldViewDate),a=e&&this._renderMethod||`render`;if(delete this._oldView,delete this._oldViewDate,delete this._renderMethod,t[a](),r&&(this.main.replaceChild(t.element,r.element),bt(n,`changeView`)),!isNaN(i)){let e=new Date(this.viewDate);e.getFullYear()!==i.getFullYear()&&bt(n,`changeYear`),e.getMonth()!==i.getMonth()&&bt(n,`changeMonth`)}}};function Bt(e,t,n,r,i,a){if(ae(e,i,a))return r(e)?Bt(t(e,n),t,n,r,i,a):e}function Vt(e,t,n){let r=e.picker,i=r.currentView,a=i.step||1,o=r.viewDate,s;switch(i.id){case 0:o=fe(o,n?t*7:t),s=fe;break;case 1:o=me(o,n?t*4:t),s=me;break;default:o=he(o,t*(n?4:1)*a),s=he}o=Bt(o,s,t<0?-a:a,e=>i.disabled.includes(e),i.minDate,i.maxDate),o!==void 0&&r.changeFocus(o).render()}function Ht(e,t){let{config:n,picker:r,editMode:i}=e,a=r.active,{key:o,altKey:s,shiftKey:c}=t,l=t.ctrlKey||t.metaKey,u=()=>{t.preventDefault(),t.stopPropagation()};if(o===`Tab`){Tt(e);return}if(o===`Enter`){if(!a)e.update();else if(i)e.exitEditMode({update:!0,autohide:n.autohide});else{let t=r.currentView;t.isMinView?e.setDate(r.viewDate):(r.changeView(t.id-1).render(),u())}return}let d=n.shortcutKeys,f={key:o,ctrlOrMetaKey:l,altKey:s,shiftKey:c},p=Object.keys(d).find(e=>{let t=d[e];return!Object.keys(t).find(e=>t[e]!==f[e])});if(p){let t;if(p===`toggle`?t=p:i?p===`exitEditMode`&&(t=p):a?p===`hide`?t=p:p===`prevButton`?t=[xt,[e,-1]]:p===`nextButton`?t=[xt,[e,1]]:p===`viewSwitch`?t=[St,[e]]:n.clearButton&&p===`clearButton`?t=[Ct,[e]]:n.todayButton&&p===`todayButton`&&(t=[wt,[e]]):p===`show`&&(t=p),t){Array.isArray(t)?t[0].apply(null,t[1]):e[t](),u();return}}if(!a||i)return;let m=(n,r)=>{c||l||s?e.enterEditMode():(Vt(e,n,r),t.preventDefault())};o===`ArrowLeft`?m(-1,!1):o===`ArrowRight`?m(1,!1):o===`ArrowUp`?m(-1,!0):o===`ArrowDown`?m(1,!0):(o===`Backspace`||o===`Delete`||o&&o.length===1&&!l)&&e.enterEditMode()}function Ut(e){e.config.showOnFocus&&!e._showing&&e.show()}function Wt(e,t){let n=t.target;(e.picker.active||e.config.showOnClick)&&(n._active=Re(n),n._clicking=setTimeout(()=>{delete n._active,delete n._clicking},2e3))}function Gt(e,t){let n=t.target;n._clicking&&(clearTimeout(n._clicking),delete n._clicking,n._active&&e.enterEditMode(),delete n._active,e.config.showOnClick&&e.show())}function Kt(e,t){t.clipboardData.types.includes(`text/plain`)&&e.enterEditMode()}function qt(e,t){let{element:n,picker:r}=e;if(!r.active&&!Re(n))return;let i=r.element;Ye(t,e=>e===n||e===i)||Tt(e)}function Jt(e,t){return e.map(e=>Pe(e,t.format,t.locale)).join(t.dateDelimiter)}function Yt(e,t,n=!1){if(t.length===0)return n?[]:void 0;let{config:r,dates:i,rangeSideIndex:a}=e,{pickLevel:o,maxNumberOfDates:s}=r,c=t.reduce((e,t)=>{let n=Ne(t,r.format,r.locale);return n===void 0?e:(n=we(n,o,a),ae(n,r.minDate,r.maxDate)&&!e.includes(n)&&!r.checkDisabled(n,o)&&(o>0||!r.daysOfWeekDisabled.includes(new Date(n).getDay()))&&e.push(n),e)},[]);if(c.length!==0)return r.multidate&&!n&&(c=c.reduce((e,t)=>(i.includes(t)||e.push(t),e),i.filter(e=>!c.includes(e)))),s&&c.length>s?c.slice(s*-1):c}function Xt(e,t=3,n=!0,r=void 0){let{config:i,picker:a,inputField:o}=e;if(t&2){let e=a.active?i.pickLevel:i.startView;a.update(r).changeView(e).render(n)}t&1&&o&&(o.value=Jt(e.dates,i))}function Zt(e,t,n){let r=e.config,{clear:i,render:a,autohide:o,revert:s,forceRefresh:c,viewDate:l}=n;a===void 0&&(a=!0),a?o===void 0&&(o=r.autohide):o=c=!1,l=Ne(l,r.format,r.locale);let u=Yt(e,t,i);!u&&!s||(u&&u.toString()!==e.dates.toString()?(e.dates=u,Xt(e,a?3:1,!0,l),bt(e,`changeDate`)):Xt(e,c?3:1,!0,l),o&&e.hide())}function Qt(e,t){return t?n=>Pe(n,t,e.config.locale):e=>new Date(e)}var $t=class{constructor(e,t={},n=void 0){e.datepicker=this,this.element=e,this.dates=[];let r=this.config=Object.assign({buttonClass:t.buttonClass&&String(t.buttonClass)||`button`,container:null,defaultViewDate:ue(),maxDate:void 0,minDate:void 0},st(Ze,this)),i;if(e.tagName===`INPUT`?(i=this.inputField=e,i.classList.add(`datepicker-input`),t.container&&(r.container=t.container instanceof HTMLElement?t.container:document.querySelector(t.container))):r.container=e,n){let e=n.inputs.indexOf(i),t=n.datepickers;if(e<0||e>1||!Array.isArray(t))throw Error(`Invalid rangepicker object.`);t[e]=this,this.rangepicker=n,this.rangeSideIndex=e}this._options=t,Object.assign(r,st(t,this)),r.shortcutKeys=lt(t.shortcutKeys||{});let a=ie(e.value||e.dataset.date,r.dateDelimiter);delete e.dataset.date;let o=Yt(this,a);o&&o.length>0&&(this.dates=o),i&&(i.value=Jt(this.dates,r));let s=this.picker=new zt(this),c=[e,`keydown`,Ht.bind(null,this)];i?Ke(this,[c,[i,`focus`,Ut.bind(null,this)],[i,`mousedown`,Wt.bind(null,this)],[i,`click`,Gt.bind(null,this)],[i,`paste`,Kt.bind(null,this)],[document,`mousedown`,qt.bind(null,this)],[window,`resize`,s.place.bind(s)]]):(Ke(this,[c]),this.show())}static formatDate(e,t,n){return Pe(e,t,n&&Xe[n]||Xe.en)}static parseDate(e,t,n){return Ne(e,t,n&&Xe[n]||Xe.en)}static get locales(){return Xe}get active(){return!!(this.picker&&this.picker.active)}get pickerElement(){return this.picker?this.picker.element:void 0}setOptions(e){let t=st(e,this);Object.assign(this._options,e),Object.assign(this.config,t),this.picker.setOptions(t),Xt(this,3)}show(){if(this.inputField){let{config:e,inputField:t}=this;if(t.disabled||t.readOnly&&!e.enableOnReadonly)return;!Re(t)&&!e.disableTouchKeyboard&&(this._showing=!0,t.focus(),delete this._showing)}this.picker.show()}hide(){this.inputField&&(this.picker.hide(),this.picker.update().changeView(this.config.startView).render())}toggle(){this.picker.active?this.inputField&&this.picker.hide():this.show()}destroy(){this.hide(),qe(this),this.picker.detach();let e=this.element;return e.classList.remove(`datepicker-input`),delete e.datepicker,this}getDate(e=void 0){let t=Qt(this,e);if(this.config.multidate)return this.dates.map(t);if(this.dates.length>0)return t(this.dates[0])}setDate(...e){let t=[...e],n={},r=V(e);r&&typeof r==`object`&&!Array.isArray(r)&&!(r instanceof Date)&&Object.assign(n,t.pop());let i=Array.isArray(t[0])?t[0]:t;Zt(this,i,n)}update(e=void 0){if(!this.inputField)return;let t=Object.assign(e||{},{clear:!0,render:!0,viewDate:void 0}),n=ie(this.inputField.value,this.config.dateDelimiter);Zt(this,n,t)}getFocusedDate(e=void 0){return Qt(this,e)(this.picker.viewDate)}setFocusedDate(e,t=!1){let{config:n,picker:r,active:i,rangeSideIndex:a}=this,o=n.pickLevel,s=Ne(e,n.format,n.locale);s!==void 0&&(r.changeFocus(we(s,o,a)),i&&t&&r.changeView(o),r.render())}refresh(e=void 0,t=!1){e&&typeof e!=`string`&&(t=e,e=void 0);let n;n=e===`picker`?2:e===`input`?1:3,Xt(this,n,!t)}enterEditMode(){let e=this.inputField;!e||e.readOnly||!this.picker.active||this.editMode||(this.editMode=!0,e.classList.add(`in-edit`))}exitEditMode(e=void 0){if(!this.inputField||!this.editMode)return;let t=Object.assign({update:!1},e);delete this.editMode,this.inputField.classList.remove(`in-edit`),t.update&&this.update(t)}};function en(e){let t=Object.assign({},e);return delete t.inputs,delete t.allowOneSidedRange,delete t.maxNumberOfDates,t}function tn(e,t,n,r){Ke(e,[[n,`changeDate`,t]]),new $t(n,r,e)}function nn(e,t){if(e._updating)return;e._updating=!0;let n=t.target;if(n.datepicker===void 0)return;let r=e.datepickers,[i,a]=r,o={render:!1},s=e.inputs.indexOf(n),c=+(s===0),l=r[s].dates[0],u=r[c].dates[0];l!==void 0&&u!==void 0?s===0&&l>u?(i.setDate(u,o),a.setDate(l,o)):s===1&&l<u&&(i.setDate(l,o),a.setDate(u,o)):e.allowOneSidedRange||(l!==void 0||u!==void 0)&&(o.clear=!0,r[c].setDate(r[s].dates,o)),r.forEach(e=>{e.picker.update().render()}),delete e._updating}var rn=class{constructor(e,t={}){let n=Array.isArray(t.inputs)?t.inputs:Array.from(e.querySelectorAll(`input`));if(n.length<2)return;e.rangepicker=this,this.element=e,this.inputs=n=n.slice(0,2),Object.freeze(n),this.allowOneSidedRange=!!t.allowOneSidedRange;let r=nn.bind(null,this),i=en(t),a=this.datepickers=[];n.forEach(e=>{tn(this,r,e,i)}),Object.freeze(a),Object.defineProperty(this,`dates`,{get(){return a.map(e=>e.dates[0])}}),a[0].dates.length>0?nn(this,{target:n[0]}):a[1].dates.length>0&&nn(this,{target:n[1]})}setOptions(e){this.allowOneSidedRange=!!e.allowOneSidedRange;let t=en(e);this.datepickers.forEach(e=>{e.setOptions(t)})}destroy(){this.datepickers.forEach(e=>{e.destroy()}),qe(this),delete this.element.rangepicker}getDates(e=void 0){let t=e?t=>Pe(t,e,this.datepickers[0].config.locale):e=>new Date(e);return this.dates.map(e=>e===void 0?e:t(e))}setDates(e,t){let{datepickers:[n,r],inputs:[i,a],dates:[o,s]}=this;this._updating=!0,n.setDate(e),r.setDate(t),delete this._updating,r.dates[0]===s?n.dates[0]!==o&&nn(this,{target:i}):nn(this,{target:a})}};function an(e,t,n,r,i){if(i){let a=t.target.value;i(a)?(r.innerHTML=``,r.classList.remove(`is-danger`),n.classList.remove(`is-danger`),n.classList.add(`is-success`)):(r.innerHTML=e.error||`Invalid`,n.classList.remove(`is-success`),n.classList.add(`is-danger`),r.classList.add(`is-danger`))}}function on(e){let t=new Set(e.options.filter(e=>e.selected).map(e=>e.value)),n=document.createElement(`div`);n.style.cssText=`position: relative; width: 100%;`;let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 2.5em; padding: 4px 8px; border: 1px solid var(--chc-input-border, #7a7a7a); border-radius: 4px; background: var(--chc-input-bg, #fff); cursor: pointer; box-sizing: border-box`;let i=document.createElement(`div`);i.style.cssText=`display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0;`;let a=document.createElement(`span`);a.textContent=`▾`,a.style.cssText=`margin-left: auto; padding-left: 8px; user-select: none; color: var(--chc-text-secondary, #666);`,r.appendChild(i),r.appendChild(a);let o=document.createElement(`div`);o.style.cssText=[`display: none`,`position: absolute`,`top: 100%`,`left: 0`,`right: 0`,`z-index: 50`,`max-height: 220px`,`overflow-y: auto`,`border: 1px solid var(--chc-border-primary, #dbdbdb)`,`border-top: none`,`border-radius: 0 0 4px 4px`,`background: var(--chc-dropdown-bg, #fff)`,`box-shadow: 0 4px 8px rgba(0,0,0,0.1)`].join(`; `);let s=new Map;for(let t of e.options){let e=document.createElement(`label`);e.style.cssText=[`display: flex`,`align-items: center`,`gap: 8px`,`padding: 6px 10px`,`cursor: pointer`,`color: var(--chc-text-primary, #363636)`].join(`; `),e.addEventListener(`mouseenter`,()=>{e.style.background=`var(--chc-hover-bg, #f5f5f5)`}),e.addEventListener(`mouseleave`,()=>{e.style.background=``});let n=document.createElement(`input`);n.type=`checkbox`,n.value=t.value,n.checked=!!t.selected,t.disabled&&(n.disabled=!0),n.style.cssText=`margin: 0; cursor: pointer;`;let r=document.createElement(`span`);r.textContent=t.label,e.appendChild(n),e.appendChild(r),o.appendChild(e),s.set(t.value,n)}n.appendChild(r),n.appendChild(o);let c=!1;function l(){c=!c,o.style.display=c?`block`:`none`}function u(){c=!1,o.style.display=`none`}function d(){if(i.innerHTML=``,t.size===0){let e=document.createElement(`span`);e.textContent=`Select…`,e.style.cssText=`color: var(--chc-text-muted, #999); user-select: none;`,i.appendChild(e);return}for(let n of t){let r=e.options.find(e=>e.value===n);if(!r)continue;let a=document.createElement(`span`);a.style.cssText=[`display: inline-flex`,`align-items: center`,`gap: 4px`,`padding: 2px 6px`,`border-radius: 3px`,`background: var(--chc-status-info, blue)`,`color: var(--chc-text-inverse, #fff)`,`font-size: 0.85em`,`white-space: nowrap`].join(`; `),a.textContent=r.label;let o=document.createElement(`span`);o.textContent=`×`,o.style.cssText=`cursor: pointer; margin-left: 2px; font-weight: bold;`,o.addEventListener(`click`,e=>{e.stopPropagation(),t.delete(n);let r=s.get(n);r&&(r.checked=!1),d(),f()}),a.appendChild(o),i.appendChild(a)}}function f(){if(B(e.onChange)){let t=new Event(`change`,{bubbles:!0});p.dispatchEvent(t),e.onChange(t,e)}}r.addEventListener(`click`,()=>l()),document.addEventListener(`click`,e=>{c&&!n.contains(e.target)&&u()});for(let[e,n]of s)n.addEventListener(`change`,()=>{n.checked?t.add(e):t.delete(e),d(),f()});d();let p=n;return Object.defineProperty(p,`selectedValues`,{get:()=>[...t],enumerable:!0}),Object.defineProperty(p,`value`,{get:()=>[...t].join(`,`),enumerable:!0}),{container:n,element:p}}var sn=`none`;function cn(e,t){for(let n of t.options){if(n.hide)continue;let r=document.createElement(`option`);r.className=`font-medium`,n.value&&r.setAttribute(`value`,n.value),(n.selected||t.value===n.value)&&r.setAttribute(`selected`,`true`),n.disabled&&r.setAttribute(`disabled`,`true`),r.innerHTML=n.label,e.appendChild(r)}}function ln(e){let t=document.createElement(`div`);if(t.className=`field font-medium`,e.class&&t.classList.add(e.class),e.width?t.style.cssText=`width: ${e.width}`:t.style.cssText=`flex-grow: 1`,e.label&&!e.checkbox){let n=document.createElement(`label`);n.className=`label`,e.labelStyle&&(n.style.cssText=e.labelStyle),n.innerHTML=e.label,t.appendChild(n)}let n,r,i=[],a=document.createElement(`div`);if(a.className=`control font-medium`,e.controlVisible===!1&&(a.style.display=sn),e.controlId&&(a.id=e.controlId),e.text){let t=document.createElement(`div`);e.id&&(t.id=e.id),t.className=`content`,t.innerHTML=e.text,a.appendChild(t)}else if(e.radio){let t=un(e,i);a.appendChild(t),n=t}else if(e.options&&e.multiple){let{container:t,element:r}=on(e);e.id&&(t.id=e.id),a.appendChild(t),n=r}else if(e.options)n=dn(e,a);else if(e.checkbox)n=fn(e,a);else{let t=pn(e,a);n=t.inputElement,r=t.datepicker}return t.appendChild(a),e.visible===!1&&(t.style.display=sn),{field:t,inputElement:n,datepicker:r,subFields:i}}function un(e,t){let n=document.createElement(`div`);n.id=e.id,n.className=`control`;for(let r of e.options??[]){let i=document.createElement(`label`);i.className=`radio`;let a=document.createElement(`input`);r.field&&t.push({input:a,field:r.field}),r.id&&(a.id=r.id),a.name=e.id,a.type=`radio`,a.value=r.text,r.checked&&(a.checked=!0),B(e.onChange)&&a.addEventListener(`change`,t=>e.onChange(t,e)),i.appendChild(a),n.appendChild(i);let o=document.createElement(`span`);o.style.marginLeft=`.25em`,o.style.marginRight=`1em`,o.style.color=`var(--chc-text-primary)`,o.innerHTML=r.text,n.appendChild(o)}return n}function dn(e,t){let n=document.createElement(`div`);n.className=`select font-medium`,n.style.cssText=`width: 100%`,e.zIndex&&(n.style.zIndex=e.zIndex);let r=document.createElement(`select`);if(e.dataPlaceholder&&r.setAttribute(`data-placeholder`,e.dataPlaceholder),e.dataType&&r.setAttribute(`data-type`,e.dataType),e.disabled&&(r.disabled=!0),e.id&&(n.id=e.id),r.style.cssText=`width: 100%`,cn(r,e),n.appendChild(r),t.appendChild(n),e.help){let n=document.createElement(`p`);n.className=`help font-medium is-info`,n.innerHTML=e.help?.text,n.style.display=e.help?.visible?``:sn,t.appendChild(n)}return B(e.onChange)&&r.addEventListener(`change`,t=>e.onChange(t,e)),r}function fn(e,t){let n=document.createElement(`div`);n.className=`flexrow nowrap`,n.style.display=`inline-block`;let r=document.createElement(`input`);B(e.onChange)&&r.addEventListener(`change`,t=>e.onChange(t,e)),r.className=`is-checkradio ${e.intent??`is-success`}`,r.type=`checkbox`,r.id=e.id,e.checked&&(r.checked=!0),n.appendChild(r);let i=document.createElement(`label`);return i.setAttribute(`for`,e.id),e.color&&(i.style.color=e.color),i.innerHTML=e.label,n.appendChild(i),t.appendChild(n),r}function pn(e,t){let n,r=document.createElement(`input`);if(r.className=`input font-medium`,e.class&&r.classList.add(e.class),r.setAttribute(`type`,e.type||`text`),r.setAttribute(`autocomplete`,e.autocomplete||`off`),r.setAttribute(`placeholder`,e.placeholder||``),e.disabled&&r.setAttribute(`disabled`,`true`),e.id&&r.setAttribute(`id`,e.id),t.appendChild(r),e.iconLeft){t.classList.add(`has-icons-left`);let n=document.createElement(`span`);n.className=`icon is-small is-left font-medium`;let r=document.createElement(`i`);r.className=e.iconLeft,n.appendChild(r),t.appendChild(n)}if(e.type===`password`){t.classList.add(`has-icons-right`);let n=document.createElement(`span`);n.className=`icon is-small is-right font-medium`;let r=document.createElement(`i`);r.className=e.iconRight,n.appendChild(r),t.appendChild(n)}let i=document.createElement(`p`);if(i.className=`help font-medium`,t.appendChild(i),e.validator&&r.addEventListener(`input`,t=>an(e,t,r,i,e.validator)),e.date){let t=e.maxNumberOfDates||1,i=!e.maxNumberOfDates||t===1;n=new $t(r,{maxDate:e.maxDate,minDate:e.minDate,format:`yyyy-mm-dd`,language:e.language||`en`,maxNumberOfDates:t,autohide:i})}else e.typeAhead&&ne({...e.typeAhead,element:r});return B(e.onKeyDown)&&r.addEventListener(`keydown`,t=>e.onKeyDown(t,e)),B(e.onChange)&&r.addEventListener(`change`,t=>e.onChange(t,e)),B(e.onInput)&&r.addEventListener(`input`,t=>e.onInput(t,e)),B(e.onKeyUp)&&r.addEventListener(`keyup`,t=>e.onKeyUp(t,e)),e.value!==void 0&&(r.value=e.value),e.selectOnFocus&&r.addEventListener(`focus`,()=>r.select()),{inputElement:r,datepicker:n}}var mn=`__BYE__`,hn=`__QUALIFIER__`;function gn({matchUp:e,side:t,sideNumber:n,eventHandlers:r,composition:i,position:a,currentParticipant:o}){let s=i?.configuration,c=t?.drawPosition,l=()=>{let e=j(s?.participantProvider)?s.participantProvider():[],t=s?.persistInputFields,n=e;t&&o&&(e.some(e=>e.participantId===o.participantId)||(n=[o,...e]));let r=n.map(e=>({label:e.participantName||e.participantId,value:e.participantId})),i=o?.participantId===mn,a=o?.participantId===hn,c=[];return i||c.push({label:`— BYE —`,value:mn}),s?.hasQualifying&&!a&&c.push({label:`— QUALIFIER —`,value:hn}),[...c,...r]},u=l(),d=i=>{if(!t)return;if(!i||i.trim()===``){j(r?.removeAssignment)&&r.removeAssignment({matchUp:e,side:t,sideNumber:n||1});return}if(i===mn){j(r?.assignBye)&&r.assignBye({matchUp:e,side:t,sideNumber:n||1});return}if(i===hn){j(r?.assignQualifier)&&r.assignQualifier({matchUp:e,side:t,sideNumber:n||1});return}let a=(j(s?.participantProvider)?s.participantProvider():[]).find(e=>e.participantId===i);a&&j(r?.assignParticipant)&&r.assignParticipant({matchUp:e,side:t,sideNumber:n||1,participant:a})},f=!1,p=()=>{if(f){f=!1;return}let e=Array.from(document.querySelectorAll(`.participant-assignment-input input`)),t=e.findIndex(e=>e.id===h);if(t!==-1&&t<e.length-1){let n=e[t+1];setTimeout(()=>{n.focus()},100)}},m=a?`-p${a}`:``,h=`assign-${e.matchUpId}-side${n}${m}`,g=o?.participantId,{field:_}=ln({typeAhead:{list:u,callback:d,onSelectComplete:p,listProvider:l,currentValue:g},placeholder:a?`Partner ${a}`:`Type participant name...`,field:h,id:h,class:`participant-assignment-input`});c&&(_.dataset.drawPosition=c.toString());let v=_.querySelector(`input`);v&&v.addEventListener(`keydown`,e=>{e.key===`Tab`&&(f=!0,setTimeout(()=>{f=!1},500))}),_.style.width=`100%`,_.style.margin=`0`;let y=s?.assignmentInputFontSize;return y&&(_.style.fontSize=y),setTimeout(()=>{let e=_.querySelector(`input`);if(e){let t=e.parentElement,n=0;for(;t&&n<15;){let e=window.getComputedStyle(t);(e.overflow!==`visible`||e.overflowX!==`visible`||e.overflowY!==`visible`)&&(t.style.setProperty(`overflow`,`visible`,`important`),t.style.setProperty(`overflow-x`,`visible`,`important`),t.style.setProperty(`overflow-y`,`visible`,`important`)),t=t.parentElement,n++}}},100),_}var _n=()=>`chc-seed`;function vn({className:e,composition:t,side:n}){let r=n?.seedValue===`~`?``:n?.seedValue!==void 0&&n.seedValue||n?.seedNumber;if(!r)return``;let i=t?.configuration||{},{bracketedSeeds:a}=i,o=typeof a==`boolean`&&[`(`,`)`]||a===`square`&&[`[`,`]`]||[``,``],s=`${o[0]}${r}${o[1]}`,c=i.seedingElement===`sup`?`sup`:`span`,l=document.createElement(c);return l.className=e||``,l.innerHTML=s,l}var yn=e=>(0,p.default)(`chc-scale`,e?.color&&`chc-scale--${e.color}`);function bn({individualParticipant:e,composition:t,className:n,matchUp:r,spacer:i}){let a=t?.configuration,o=a?.scaleAttributes?.eventType||r?.matchUpType||`SINGLES`,s=e?.rankings,c=e?.ratings,l=a?.scaleAttributes,u=l?.scaleType,d=l?.scaleName,f=l?.accessor,m=u===`RATING`?c:s,h=m?.SINGLES?.find(e=>e?.scaleName===d)?.scaleValue,g=m?.DOUBLES?.find(e=>e?.scaleName===d)?.scaleValue,_=h&&f?h[f]:h||``,v=g&&f?g[f]:g||``,y=o===`SINGLES`?_:v,b=a?.scaleAttributes?.fallback,x=!i&&(y||b&&(_||v)),S=document.createElement(`span`),C=a?.scaleAttributes?.scaleColor,w=C===`green`||C===`red`?C:void 0;return x&&(S.className=(0,p.default)(n,yn(w?{color:w}:{}))),S.innerHTML=x||``,S}var xn=e=>(0,p.default)(`chc-flag`,e?.variant&&`chc-flag--${e.variant}`);function Sn({matchUp:e,individualParticipant:n,spacer:r}){let i=n?.person?.iso2NationalityCode||``,a=i?t.fixtures.countryToFlag(i)?.slice(0,4):``,o=document.createElement(`span`),s=e?.matchUpType?.toLowerCase();return r||(o.className=xn({variant:s})),o.innerHTML=r?``:a,o}function Cn({individualParticipant:e,composition:t,className:n,matchUp:r,spacer:i,side:a,type:o}){if(o===`scale`)return bn({individualParticipant:e,composition:t,className:n,matchUp:r,spacer:i});let s=t?.configuration||{},c=document.createElement(`div`);if(o===`flag`&&s.flags)return Sn({matchUp:r,individualParticipant:e,spacer:i});if(o===`seeding`){let e=vn({className:n,composition:t,side:a});return typeof e==`string`?c:e}return c}var{FEED_IN:wn}=t.drawDefinitionConstants,{MALE:Tn,FEMALE:En}=t.genderConstants,{LUCKY_LOSER:Dn}=t.entryStatusConstants,On=`Qualifier`,kn=`BYE`,An=`TBD`;function jn(e,t,n,r,i,a){let o;return o=e?.bye?{participantId:`__BYE__`,participantName:`— BYE —`}:e?.qualifier?{participantId:`__QUALIFIER__`,participantName:`— QUALIFIER —`}:t,gn({matchUp:n,side:e,sideNumber:r,eventHandlers:i,composition:a,currentParticipant:o})}function Mn(e,t,n,r,i,a){let o=document.createElement(`span`);if(n&&r?.winnerColor)o.style.color=typeof r.winnerColor==`string`?r.winnerColor:`green`;else if(r?.genderColor){let e=i?.person?.sex,t=e===Tn&&`var(--chc-gender-male, #2E86C1)`||e===En&&`var(--chc-gender-female, #E07BAF)`||``;o.style.color=typeof r.genderColor==`string`?r.genderColor:t}if(o.innerHTML=t,e.appendChild(o),a?.participant?.luckyAdvancement){let t=document.createElement(`span`);t.className=`chc-lucky-advancement-badge`,t.textContent=`LL`,e.appendChild(t)}else if(a?.participant?.entryStatus===Dn){let t=document.createElement(`span`);t.className=`chc-lucky-loser-badge`,t.textContent=`LL`,e.appendChild(t)}}function Nn(e){let{isWinningSide:t,side:n,sideNumber:r,individualParticipant:i,matchUp:a,composition:o}=e||{},s=t?`winner`:void 0,c=e.eventHandlers||{},l=o?.configuration,u={QUALIFIER:l?.placeHolders?.qualifier||On,BYE:l?.placeHolders?.bye||kn,TBD:l?.placeHolders?.tbd||An},d=i?.useOtherName&&i?.participantOtherName||i?.participantName,f=e=>{j(c?.participantClick)&&(e.stopPropagation(),c.participantClick({individualParticipant:i,pointerEvent:e,matchUp:a,side:n}))},p=document.createElement(`div`);p.classList.add(`tmx-i`),p.setAttribute(`sideNumber`,String(r)),p.setAttribute(`id`,i?.participantId),p.onclick=f;let _=document.createElement(`div`);_.className=h({variant:s});let v=l?.flags,y=l?.scaleAttributes,b=v?`left`:l?.scaleAttributes?.scalePosition||`left`,x=v&&Cn({...e,type:`flag`});if(x)_.appendChild(x);else if(b===`left`){let t=Cn({type:`scale`,...e});t&&_.appendChild(t)}let S=document.createElement(`div`);S.className=g({variant:s});let C=a?.roundNumber===1,w=a?.drawType===wn&&a?.roundNumber>1&&n?.drawPosition&&!n?.sourceMatchUp,T=C||w,E=l?.persistInputFields;if(l?.inlineAssignment&&j(c?.assignParticipant)&&j(l?.participantProvider)&&T&&(!n?.bye||E)&&(!n?.qualifier||E)&&a&&(!d||n?.bye||n?.qualifier||E))S.appendChild(jn(n,i,a,r,c,o));else if(d)Mn(S,d,t,l,i,n);else{let e=document.createElement(`abbr`);e.className=m({variant:l?.showAddress?`showAddress`:``}),e.innerHTML=n?.bye&&u.BYE||n?.qualifier&&u.QUALIFIER||u.TBD,S.appendChild(e)}if(y&&(x||b===`right`)){let t=Cn({type:`scale`,...e});t&&(t.style.marginInlineStart=`0.5em`,t.style.marginInlineEnd=`0`,S.appendChild(t))}let D=Cn({...e,className:_n(),type:`seeding`});D&&S.appendChild(D),_.appendChild(S),p.appendChild(_);let O=z(e);return p.appendChild(O),{element:p}}var Pn=e=>(0,p.default)(`chc-pill`,e?.variant&&`chc-pill--${e.variant}`),{WALKOVER:Fn,DEFAULTED:In,DOUBLE_WALKOVER:Ln,DOUBLE_DEFAULT:Rn,ABANDONED:zn,IN_PROGRESS:Bn}=t.matchUpStatusConstants;function Vn({matchUpStatus:e}){let t=e?.toLowerCase(),n=[`defaulted`,`retired`,`walkover`,`defaulted`,`double_walkover`,`double_default`,`cancelled`,`in_progress`,`awaiting_result`,`dead_rubber`,`incomplete`,`suspended`,`abandoned`].includes(t)?t:void 0,r=[Fn,Ln].includes(e||``)?`WO`:[In,Rn].includes(e||``)?`DEF`:e===zn?`ABD`:e===Bn?`LIVE`:e?.split(`_`).join(``).slice(0,3)||``,i=document.createElement(`div`);i.className=Pn(n?{variant:n}:{});let a=document.createElement(`abbr`);return a.setAttribute(`title`,e||``),a.style.textDecoration=`none`,a.style.borderBottom=`none`,a.innerHTML=r,i.appendChild(a),i}function Hn(e){return e instanceof Element||e}var Un=()=>`chc-team-logo`,Wn=[{name:`Altitude`,src:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA8CAYAAACtrX6oAAAAAXNSR0IArs4c6QA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Ag5wDg5y8kgWXBDzIOTDIyStZcEnAg5wDg5y8kgWXBDzIOTDIyStZcEnAg5wDg5y8kgUPcgH/D6j84UwlI6obAAAAAElFTkSuQmCC`}];function Gn(e){return Wn[(e%Wn.length+Wn.length)%Wn.length]}function Kn(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function qn({participantId:e}){let t=document.createElement(`div`);t.className=Un();let n=Gn(e?Kn(e):Math.floor(Math.random()*8)),r=document.createElement(`img`);return r.src=n.src,r.alt=n.name,r.style.cssText=`height: 100%; width: auto; object-fit: contain;`,t.appendChild(r),t}var Jn=()=>`chc-side-container`,Yn=()=>`chc-side-row`,Xn=()=>`chc-tick`;function Zn({dim:e=`20px`}={}){return`
76
+ </div>`),mt=class{constructor(e,t){Object.assign(this,t,{picker:e,element:Ie(`<div class="datepicker-view"></div>`).firstChild,selected:[],isRangeEnd:!!e.datepicker.rangeSideIndex}),this.init(this.picker.datepicker.config)}init(e){`pickLevel`in e&&(this.isMinView=this.id===e.pickLevel),this.setOptions(e),this.updateFocus(),this.updateSelection()}prepareForRender(e,t,n){this.disabled=[];let r=this.picker;r.setViewSwitchLabel(e),r.setPrevButtonDisabled(t),r.setNextButtonDisabled(n)}setDisabled(e,t){t.add(`disabled`),re(this.disabled,e)}performBeforeHook(e,t){let n=this.beforeShow(new Date(t));switch(typeof n){case`boolean`:n={enabled:n};break;case`string`:n={classes:n}}if(n){let r=e.classList;if(n.enabled===!1&&this.setDisabled(t,r),n.classes){let e=n.classes.split(/\s+/);r.add(...e),e.includes(`disabled`)&&this.setDisabled(t,r)}n.content&&He(e,n.content)}}renderCell(e,t,n,r,{selected:i,range:a},o,s=[]){e.textContent=t,this.isMinView&&(e.dataset.date=r);let c=e.classList;if(e.className=`datepicker-cell ${this.cellClass}`,n<this.first?c.add(`prev`):n>this.last&&c.add(`next`),c.add(...s),(o||this.checkDisabled(r,this.id))&&this.setDisabled(r,c),a){let[e,t]=a;n>e&&n<t&&c.add(`range`),n===e&&c.add(`range-start`),n===t&&c.add(`range-end`)}i.includes(n)&&c.add(`selected`),n===this.focused&&c.add(`focused`),this.beforeShow&&this.performBeforeHook(e,r)}refreshCell(e,t,n,[r,i]){let a=e.classList;a.remove(`range`,`range-start`,`range-end`,`selected`,`focused`),t>r&&t<i&&a.add(`range`),t===r&&a.add(`range-start`),t===i&&a.add(`range-end`),n.includes(t)&&a.add(`selected`),t===this.focused&&a.add(`focused`)}changeFocusedCell(e){this.grid.querySelectorAll(`.focused`).forEach(e=>{e.classList.remove(`focused`)}),this.grid.children[e].classList.add(`focused`)}},ht=class extends mt{constructor(e){super(e,{id:0,name:`days`,cellClass:`day`})}init(e,t=!0){if(t){let e=Ie(ft).firstChild;this.dow=e.firstChild,this.grid=e.lastChild,this.element.appendChild(e)}super.init(e)}setOptions(e){let t;if(`minDate`in e&&(this.minDate=e.minDate),`maxDate`in e&&(this.maxDate=e.maxDate),e.checkDisabled&&(this.checkDisabled=e.checkDisabled),e.daysOfWeekDisabled&&(this.daysOfWeekDisabled=e.daysOfWeekDisabled,t=!0),e.daysOfWeekHighlighted&&(this.daysOfWeekHighlighted=e.daysOfWeekHighlighted),`todayHighlight`in e&&(this.todayHighlight=e.todayHighlight),`weekStart`in e&&(this.weekStart=e.weekStart,this.weekEnd=e.weekEnd,t=!0),e.locale){let n=this.locale=e.locale;this.dayNames=n.daysMin,this.switchLabelFormat=n.titleFormat,t=!0}if(`beforeShowDay`in e&&(this.beforeShow=typeof e.beforeShowDay==`function`?e.beforeShowDay:void 0),`weekNumbers`in e)if(e.weekNumbers&&!this.weekNumbers){let e=Ie(pt).firstChild;this.weekNumbers={element:e,dow:e.firstChild,weeks:e.lastChild},this.element.insertBefore(e,this.element.firstChild)}else this.weekNumbers&&!e.weekNumbers&&(this.element.removeChild(this.weekNumbers.element),this.weekNumbers=null);`getWeekNumber`in e&&(this.getWeekNumber=e.getWeekNumber),`showDaysOfWeek`in e&&(e.showDaysOfWeek?(Be(this.dow),this.weekNumbers&&Be(this.weekNumbers.dow)):(ze(this.dow),this.weekNumbers&&ze(this.weekNumbers.dow))),t&&Array.from(this.dow.children).forEach((e,t)=>{let n=(this.weekStart+t)%7;e.textContent=this.dayNames[n],e.className=this.daysOfWeekDisabled.includes(n)?`dow disabled`:`dow`})}updateFocus(){let e=new Date(this.picker.viewDate),t=e.getFullYear(),n=e.getMonth(),r=de(t,n,1),i=_e(r,this.weekStart,this.weekStart);this.first=r,this.last=de(t,n+1,0),this.start=i,this.focused=this.picker.viewDate}updateSelection(){let{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e,t&&(this.range=t.dates)}render(){if(this.today=this.todayHighlight?ue():void 0,this.prepareForRender(Pe(this.focused,this.switchLabelFormat,this.locale),this.first<=this.minDate,this.last>=this.maxDate),this.weekNumbers){let e=this.weekStart,t=_e(this.first,e,e);Array.from(this.weekNumbers.weeks.children).forEach((n,r)=>{let i=pe(t,r);n.textContent=this.getWeekNumber(i,e),r>3&&n.classList[i>this.last?`add`:`remove`](`next`)})}Array.from(this.grid.children).forEach((e,t)=>{let n=fe(this.start,t),r=new Date(n),i=r.getDay(),a=[];this.today===n&&a.push(`today`),this.daysOfWeekHighlighted.includes(i)&&a.push(`highlighted`),this.renderCell(e,r.getDate(),n,n,this,n<this.minDate||n>this.maxDate||this.daysOfWeekDisabled.includes(i),a)})}refresh(){let e=this.range||[];Array.from(this.grid.children).forEach(t=>{this.refreshCell(t,Number(t.dataset.date),this.selected,e)})}refreshFocus(){this.changeFocusedCell(Math.round((this.focused-this.start)/864e5))}};function gt(e,t){if(!e||!e[0]||!e[1])return;let[[n,r],[i,a]]=e;if(!(n>t||i<t))return[n===t?r:-1,i===t?a:12]}var _t=class extends mt{constructor(e){super(e,{id:1,name:`months`,cellClass:`month`})}init(e,t=!0){t&&(this.grid=this.element,this.element.classList.add(`months`,`datepicker-grid`),this.grid.appendChild(Ie(se(`span`,12,{"data-month":e=>e}))),this.first=0,this.last=11),super.init(e)}setOptions(e){if(e.locale&&(this.monthNames=e.locale.monthsShort),`minDate`in e)if(e.minDate===void 0)this.minYear=this.minMonth=this.minDate=void 0;else{let t=new Date(e.minDate);this.minYear=t.getFullYear(),this.minMonth=t.getMonth(),this.minDate=t.setDate(1)}if(`maxDate`in e)if(e.maxDate===void 0)this.maxYear=this.maxMonth=this.maxDate=void 0;else{let t=new Date(e.maxDate);this.maxYear=t.getFullYear(),this.maxMonth=t.getMonth(),this.maxDate=de(this.maxYear,this.maxMonth+1,0)}e.checkDisabled&&(this.checkDisabled=this.isMinView||e.datesDisabled===null?e.checkDisabled:()=>!1),`beforeShowMonth`in e&&(this.beforeShow=typeof e.beforeShowMonth==`function`?e.beforeShowMonth:void 0)}updateFocus(){let e=new Date(this.picker.viewDate);this.year=e.getFullYear(),this.focused=e.getMonth()}updateSelection(){let{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e.reduce((e,t)=>{let n=new Date(t),r=n.getFullYear(),i=n.getMonth();return e[r]===void 0?e[r]=[i]:re(e[r],i),e},{}),t&&t.dates&&(this.range=t.dates.map(e=>{let t=new Date(e);return isNaN(t)?void 0:[t.getFullYear(),t.getMonth()]}))}render(){this.prepareForRender(this.year,this.year<=this.minYear,this.year>=this.maxYear);let e=this.selected[this.year]||[],t=this.year<this.minYear||this.year>this.maxYear,n=this.year===this.minYear,r=this.year===this.maxYear,i=gt(this.range,this.year);Array.from(this.grid.children).forEach((a,o)=>{let s=we(new Date(this.year,o,1),1,this.isRangeEnd);this.renderCell(a,this.monthNames[o],o,s,{selected:e,range:i},t||n&&o<this.minMonth||r&&o>this.maxMonth)})}refresh(){let e=this.selected[this.year]||[],t=gt(this.range,this.year)||[];Array.from(this.grid.children).forEach((n,r)=>{this.refreshCell(n,r,e,t)})}refreshFocus(){this.changeFocusedCell(this.focused)}};function vt(e){return[...e].reduce((e,t,n)=>e+=n?t:t.toUpperCase(),``)}var yt=class extends mt{constructor(e,t){super(e,t)}init(e,t=!0){t&&(this.navStep=this.step*10,this.beforeShowOption=`beforeShow${vt(this.cellClass)}`,this.grid=this.element,this.element.classList.add(this.name,`datepicker-grid`),this.grid.appendChild(Ie(se(`span`,12)))),super.init(e)}setOptions(e){if(`minDate`in e&&(e.minDate===void 0?this.minYear=this.minDate=void 0:(this.minYear=Ce(e.minDate,this.step),this.minDate=de(this.minYear,0,1))),`maxDate`in e&&(e.maxDate===void 0?this.maxYear=this.maxDate=void 0:(this.maxYear=Ce(e.maxDate,this.step),this.maxDate=de(this.maxYear,11,31))),e.checkDisabled&&(this.checkDisabled=this.isMinView||e.datesDisabled===null?e.checkDisabled:()=>!1),this.beforeShowOption in e){let t=e[this.beforeShowOption];this.beforeShow=typeof t==`function`?t:void 0}}updateFocus(){let e=new Date(this.picker.viewDate),t=Ce(e,this.navStep),n=t+9*this.step;this.first=t,this.last=n,this.start=t-this.step,this.focused=Ce(e,this.step)}updateSelection(){let{dates:e,rangepicker:t}=this.picker.datepicker;this.selected=e.reduce((e,t)=>re(e,Ce(t,this.step)),[]),t&&t.dates&&(this.range=t.dates.map(e=>{if(e!==void 0)return Ce(e,this.step)}))}render(){this.prepareForRender(`${this.first}-${this.last}`,this.first<=this.minYear,this.last>=this.maxYear),Array.from(this.grid.children).forEach((e,t)=>{let n=this.start+t*this.step,r=we(new Date(n,0,1),2,this.isRangeEnd);e.dataset.year=n,this.renderCell(e,n,n,r,this,n<this.minYear||n>this.maxYear)})}refresh(){let e=this.range||[];Array.from(this.grid.children).forEach(t=>{this.refreshCell(t,Number(t.textContent),this.selected,e)})}refreshFocus(){this.changeFocusedCell(Math.round((this.focused-this.start)/this.step))}};function bt(e,t){let n={bubbles:!0,cancelable:!0,detail:{date:e.getDate(),viewDate:new Date(e.picker.viewDate),viewId:e.picker.currentView.id,datepicker:e}};e.element.dispatchEvent(new CustomEvent(t,n))}function xt(e,t){let{config:n,picker:r}=e,{currentView:i,viewDate:a}=r,o;switch(i.id){case 0:o=me(a,t);break;case 1:o=he(a,t);break;default:o=he(a,t*i.navStep)}o=oe(o,n.minDate,n.maxDate),r.changeFocus(o).render()}function St(e){let t=e.picker.currentView.id;t!==e.config.maxView&&e.picker.changeView(t+1).render()}function Ct(e){e.setDate({clear:!0})}function wt(e){let t=ue();e.config.todayButtonMode===1?e.setDate(t,{forceRefresh:!0,viewDate:t}):e.setFocusedDate(t,!0)}function Tt(e){let t=()=>{e.config.updateOnBlur?e.update({revert:!0}):e.refresh(`input`),e.hide()},n=e.element;Re(n)?n.addEventListener(`blur`,t,{once:!0}):t()}function Et(e,t){let n=e.picker,r=new Date(n.viewDate),i=n.currentView.id,a=i===1?me(r,t-r.getMonth()):he(r,t-r.getFullYear());n.changeFocus(a).changeView(i-1).render()}function Dt(e){St(e)}function Ot(e){xt(e,-1)}function kt(e){xt(e,1)}function At(e,t){let n=Ye(t,`.datepicker-cell`);if(!n||n.classList.contains(`disabled`))return;let{id:r,isMinView:i}=e.picker.currentView,a=n.dataset;i?e.setDate(Number(a.date)):r===1?Et(e,Number(a.month)):Et(e,Number(a.year))}function jt(e){e.preventDefault()}var Mt=[`left`,`top`,`right`,`bottom`].reduce((e,t)=>(e[t]=`datepicker-orient-${t}`,e),{}),Nt=e=>e&&`${e}px`;function Pt(e,t){if(`title`in t&&(t.title?(e.controls.title.textContent=t.title,Be(e.controls.title)):(e.controls.title.textContent=``,ze(e.controls.title))),t.prevArrow){let n=e.controls.prevButton;Ve(n),t.prevArrow.forEach(e=>{n.appendChild(e.cloneNode(!0))})}if(t.nextArrow){let n=e.controls.nextButton;Ve(n),t.nextArrow.forEach(e=>{n.appendChild(e.cloneNode(!0))})}if(t.locale&&(e.controls.todayButton.textContent=t.locale.today,e.controls.clearButton.textContent=t.locale.clear),`todayButton`in t&&(t.todayButton?Be(e.controls.todayButton):ze(e.controls.todayButton)),`minDate`in t||`maxDate`in t){let{minDate:t,maxDate:n}=e.datepicker.config;e.controls.todayButton.disabled=!ae(ue(),t,n)}`clearButton`in t&&(t.clearButton?Be(e.controls.clearButton):ze(e.controls.clearButton))}function Ft(e){let{dates:t,config:n,rangeSideIndex:r}=e;return oe(t.length>0?V(t):we(n.defaultViewDate,n.pickLevel,r),n.minDate,n.maxDate)}function It(e,t){!(`_oldViewDate`in e)&&t!==e.viewDate&&(e._oldViewDate=e.viewDate),e.viewDate=t;let{id:n,year:r,first:i,last:a}=e.currentView,o=new Date(t).getFullYear();switch(n){case 0:return t<i||t>a;case 1:return o!==r;default:return o<i||o>a}}function Lt(e){return window.getComputedStyle(e).direction}function Rt(e){let t=Le(e);if(!(t===document.body||!t))return window.getComputedStyle(t).overflow===`visible`?Rt(t):t}var zt=class{constructor(e){let{config:t,inputField:n}=this.datepicker=e,r=dt.replace(/%buttonClass%/g,t.buttonClass),i=this.element=Ie(r).firstChild,[a,o,s]=i.firstChild.children,c=a.firstElementChild,[l,u,d]=a.lastElementChild.children,[f,p]=s.firstChild.children,m={title:c,prevButton:l,viewSwitch:u,nextButton:d,todayButton:f,clearButton:p};this.main=o,this.controls=m;let h=n?`dropdown`:`inline`;i.classList.add(`datepicker-${h}`),Pt(this,t),this.viewDate=Ft(e),Ke(e,[[i,`mousedown`,jt],[o,`click`,At.bind(null,e)],[m.viewSwitch,`click`,Dt.bind(null,e)],[m.prevButton,`click`,Ot.bind(null,e)],[m.nextButton,`click`,kt.bind(null,e)],[m.todayButton,`click`,wt.bind(null,e)],[m.clearButton,`click`,Ct.bind(null,e)]]),this.views=[new ht(this),new _t(this),new yt(this,{id:2,name:`years`,cellClass:`year`,step:1}),new yt(this,{id:3,name:`decades`,cellClass:`decade`,step:10})],this.currentView=this.views[t.startView],this.currentView.render(),this.main.appendChild(this.currentView.element),t.container?t.container.appendChild(this.element):n.after(this.element)}setOptions(e){Pt(this,e),this.views.forEach(t=>{t.init(e,!1)}),this.currentView.render()}detach(){this.element.remove()}show(){if(this.active)return;let{datepicker:e,element:t}=this,n=e.inputField;if(n){let r=Lt(n);r===Lt(Le(t))?t.dir&&t.removeAttribute(`dir`):t.dir=r,this.place(),t.classList.add(`active`),e.config.disableTouchKeyboard&&n.blur()}else t.classList.add(`active`);this.active=!0,bt(e,`show`)}hide(){this.active&&(this.datepicker.exitEditMode(),this.element.classList.remove(`active`),this.active=!1,bt(this.datepicker,`hide`))}place(){let{classList:e,style:t}=this.element;t.display=`block`;let{width:n,height:r}=this.element.getBoundingClientRect(),i=this.element.offsetParent;t.display=``;let{config:a,inputField:o}=this.datepicker,{left:s,top:c,right:l,bottom:u,width:d,height:f}=o.getBoundingClientRect(),{x:p,y:m}=a.orientation,h=s,g=c;if(i===document.body||!i)h+=window.scrollX,g+=window.scrollY;else{let e=i.getBoundingClientRect();h-=e.left-i.scrollLeft,g-=e.top-i.scrollTop}let _=Rt(o),v=0,y=0,{clientWidth:b,clientHeight:x}=document.documentElement;if(_){let e=_.getBoundingClientRect();e.top>0&&(y=e.top),e.left>0&&(v=e.left),e.right<b&&(b=e.right),e.bottom<x&&(x=e.bottom)}let S=0;p===`auto`&&(s<v?(p=`left`,S=v-s):s+n>b?(p=`right`,b<l&&(S=b-l)):p=Lt(o)===`rtl`?l-n<v?`left`:`right`:`left`),p===`right`&&(h+=d-n),h+=S,m===`auto`&&(m=c-r>y&&u+r>x?`top`:`bottom`),m===`top`?g-=r:g+=f,e.remove(...Object.values(Mt)),e.add(Mt[p],Mt[m]),t.left=Nt(h),t.top=Nt(g)}setViewSwitchLabel(e){this.controls.viewSwitch.textContent=e}setPrevButtonDisabled(e){this.controls.prevButton.disabled=e}setNextButtonDisabled(e){this.controls.nextButton.disabled=e}changeView(e){let t=this.currentView;return e!==t.id&&(this._oldView||=t,this.currentView=this.views[e],this._renderMethod=`render`),this}changeFocus(e){return this._renderMethod=It(this,e)?`render`:`refreshFocus`,this.views.forEach(e=>{e.updateFocus()}),this}update(e=void 0){let t=e===void 0?Ft(this.datepicker):e;return this._renderMethod=It(this,t)?`render`:`refresh`,this.views.forEach(e=>{e.updateFocus(),e.updateSelection()}),this}render(e=!0){let{currentView:t,datepicker:n,_oldView:r}=this,i=new Date(this._oldViewDate),a=e&&this._renderMethod||`render`;if(delete this._oldView,delete this._oldViewDate,delete this._renderMethod,t[a](),r&&(this.main.replaceChild(t.element,r.element),bt(n,`changeView`)),!isNaN(i)){let e=new Date(this.viewDate);e.getFullYear()!==i.getFullYear()&&bt(n,`changeYear`),e.getMonth()!==i.getMonth()&&bt(n,`changeMonth`)}}};function Bt(e,t,n,r,i,a){if(ae(e,i,a))return r(e)?Bt(t(e,n),t,n,r,i,a):e}function Vt(e,t,n){let r=e.picker,i=r.currentView,a=i.step||1,o=r.viewDate,s;switch(i.id){case 0:o=fe(o,n?t*7:t),s=fe;break;case 1:o=me(o,n?t*4:t),s=me;break;default:o=he(o,t*(n?4:1)*a),s=he}o=Bt(o,s,t<0?-a:a,e=>i.disabled.includes(e),i.minDate,i.maxDate),o!==void 0&&r.changeFocus(o).render()}function Ht(e,t){let{config:n,picker:r,editMode:i}=e,a=r.active,{key:o,altKey:s,shiftKey:c}=t,l=t.ctrlKey||t.metaKey,u=()=>{t.preventDefault(),t.stopPropagation()};if(o===`Tab`){Tt(e);return}if(o===`Enter`){if(!a)e.update();else if(i)e.exitEditMode({update:!0,autohide:n.autohide});else{let t=r.currentView;t.isMinView?e.setDate(r.viewDate):(r.changeView(t.id-1).render(),u())}return}let d=n.shortcutKeys,f={key:o,ctrlOrMetaKey:l,altKey:s,shiftKey:c},p=Object.keys(d).find(e=>{let t=d[e];return!Object.keys(t).find(e=>t[e]!==f[e])});if(p){let t;if(p===`toggle`?t=p:i?p===`exitEditMode`&&(t=p):a?p===`hide`?t=p:p===`prevButton`?t=[xt,[e,-1]]:p===`nextButton`?t=[xt,[e,1]]:p===`viewSwitch`?t=[St,[e]]:n.clearButton&&p===`clearButton`?t=[Ct,[e]]:n.todayButton&&p===`todayButton`&&(t=[wt,[e]]):p===`show`&&(t=p),t){Array.isArray(t)?t[0].apply(null,t[1]):e[t](),u();return}}if(!a||i)return;let m=(n,r)=>{c||l||s?e.enterEditMode():(Vt(e,n,r),t.preventDefault())};o===`ArrowLeft`?m(-1,!1):o===`ArrowRight`?m(1,!1):o===`ArrowUp`?m(-1,!0):o===`ArrowDown`?m(1,!0):(o===`Backspace`||o===`Delete`||o&&o.length===1&&!l)&&e.enterEditMode()}function Ut(e){e.config.showOnFocus&&!e._showing&&e.show()}function Wt(e,t){let n=t.target;(e.picker.active||e.config.showOnClick)&&(n._active=Re(n),n._clicking=setTimeout(()=>{delete n._active,delete n._clicking},2e3))}function Gt(e,t){let n=t.target;n._clicking&&(clearTimeout(n._clicking),delete n._clicking,n._active&&e.enterEditMode(),delete n._active,e.config.showOnClick&&e.show())}function Kt(e,t){t.clipboardData.types.includes(`text/plain`)&&e.enterEditMode()}function qt(e,t){let{element:n,picker:r}=e;if(!r.active&&!Re(n))return;let i=r.element;Ye(t,e=>e===n||e===i)||Tt(e)}function Jt(e,t){return e.map(e=>Pe(e,t.format,t.locale)).join(t.dateDelimiter)}function Yt(e,t,n=!1){if(t.length===0)return n?[]:void 0;let{config:r,dates:i,rangeSideIndex:a}=e,{pickLevel:o,maxNumberOfDates:s}=r,c=t.reduce((e,t)=>{let n=Ne(t,r.format,r.locale);return n===void 0?e:(n=we(n,o,a),ae(n,r.minDate,r.maxDate)&&!e.includes(n)&&!r.checkDisabled(n,o)&&(o>0||!r.daysOfWeekDisabled.includes(new Date(n).getDay()))&&e.push(n),e)},[]);if(c.length!==0)return r.multidate&&!n&&(c=c.reduce((e,t)=>(i.includes(t)||e.push(t),e),i.filter(e=>!c.includes(e)))),s&&c.length>s?c.slice(s*-1):c}function Xt(e,t=3,n=!0,r=void 0){let{config:i,picker:a,inputField:o}=e;if(t&2){let e=a.active?i.pickLevel:i.startView;a.update(r).changeView(e).render(n)}t&1&&o&&(o.value=Jt(e.dates,i))}function Zt(e,t,n){let r=e.config,{clear:i,render:a,autohide:o,revert:s,forceRefresh:c,viewDate:l}=n;a===void 0&&(a=!0),a?o===void 0&&(o=r.autohide):o=c=!1,l=Ne(l,r.format,r.locale);let u=Yt(e,t,i);!u&&!s||(u&&u.toString()!==e.dates.toString()?(e.dates=u,Xt(e,a?3:1,!0,l),bt(e,`changeDate`)):Xt(e,c?3:1,!0,l),o&&e.hide())}function Qt(e,t){return t?n=>Pe(n,t,e.config.locale):e=>new Date(e)}var $t=class{constructor(e,t={},n=void 0){e.datepicker=this,this.element=e,this.dates=[];let r=this.config=Object.assign({buttonClass:t.buttonClass&&String(t.buttonClass)||`button`,container:null,defaultViewDate:ue(),maxDate:void 0,minDate:void 0},st(Ze,this)),i;if(e.tagName===`INPUT`?(i=this.inputField=e,i.classList.add(`datepicker-input`),t.container&&(r.container=t.container instanceof HTMLElement?t.container:document.querySelector(t.container))):r.container=e,n){let e=n.inputs.indexOf(i),t=n.datepickers;if(e<0||e>1||!Array.isArray(t))throw Error(`Invalid rangepicker object.`);t[e]=this,this.rangepicker=n,this.rangeSideIndex=e}this._options=t,Object.assign(r,st(t,this)),r.shortcutKeys=lt(t.shortcutKeys||{});let a=ie(e.value||e.dataset.date,r.dateDelimiter);delete e.dataset.date;let o=Yt(this,a);o&&o.length>0&&(this.dates=o),i&&(i.value=Jt(this.dates,r));let s=this.picker=new zt(this),c=[e,`keydown`,Ht.bind(null,this)];i?Ke(this,[c,[i,`focus`,Ut.bind(null,this)],[i,`mousedown`,Wt.bind(null,this)],[i,`click`,Gt.bind(null,this)],[i,`paste`,Kt.bind(null,this)],[document,`mousedown`,qt.bind(null,this)],[window,`resize`,s.place.bind(s)]]):(Ke(this,[c]),this.show())}static formatDate(e,t,n){return Pe(e,t,n&&Xe[n]||Xe.en)}static parseDate(e,t,n){return Ne(e,t,n&&Xe[n]||Xe.en)}static get locales(){return Xe}get active(){return!!(this.picker&&this.picker.active)}get pickerElement(){return this.picker?this.picker.element:void 0}setOptions(e){let t=st(e,this);Object.assign(this._options,e),Object.assign(this.config,t),this.picker.setOptions(t),Xt(this,3)}show(){if(this.inputField){let{config:e,inputField:t}=this;if(t.disabled||t.readOnly&&!e.enableOnReadonly)return;!Re(t)&&!e.disableTouchKeyboard&&(this._showing=!0,t.focus(),delete this._showing)}this.picker.show()}hide(){this.inputField&&(this.picker.hide(),this.picker.update().changeView(this.config.startView).render())}toggle(){this.picker.active?this.inputField&&this.picker.hide():this.show()}destroy(){this.hide(),qe(this),this.picker.detach();let e=this.element;return e.classList.remove(`datepicker-input`),delete e.datepicker,this}getDate(e=void 0){let t=Qt(this,e);if(this.config.multidate)return this.dates.map(t);if(this.dates.length>0)return t(this.dates[0])}setDate(...e){let t=[...e],n={},r=V(e);r&&typeof r==`object`&&!Array.isArray(r)&&!(r instanceof Date)&&Object.assign(n,t.pop());let i=Array.isArray(t[0])?t[0]:t;Zt(this,i,n)}update(e=void 0){if(!this.inputField)return;let t=Object.assign(e||{},{clear:!0,render:!0,viewDate:void 0}),n=ie(this.inputField.value,this.config.dateDelimiter);Zt(this,n,t)}getFocusedDate(e=void 0){return Qt(this,e)(this.picker.viewDate)}setFocusedDate(e,t=!1){let{config:n,picker:r,active:i,rangeSideIndex:a}=this,o=n.pickLevel,s=Ne(e,n.format,n.locale);s!==void 0&&(r.changeFocus(we(s,o,a)),i&&t&&r.changeView(o),r.render())}refresh(e=void 0,t=!1){e&&typeof e!=`string`&&(t=e,e=void 0);let n;n=e===`picker`?2:e===`input`?1:3,Xt(this,n,!t)}enterEditMode(){let e=this.inputField;!e||e.readOnly||!this.picker.active||this.editMode||(this.editMode=!0,e.classList.add(`in-edit`))}exitEditMode(e=void 0){if(!this.inputField||!this.editMode)return;let t=Object.assign({update:!1},e);delete this.editMode,this.inputField.classList.remove(`in-edit`),t.update&&this.update(t)}};function en(e){let t=Object.assign({},e);return delete t.inputs,delete t.allowOneSidedRange,delete t.maxNumberOfDates,t}function tn(e,t,n,r){Ke(e,[[n,`changeDate`,t]]),new $t(n,r,e)}function nn(e,t){if(e._updating)return;e._updating=!0;let n=t.target;if(n.datepicker===void 0)return;let r=e.datepickers,[i,a]=r,o={render:!1},s=e.inputs.indexOf(n),c=+(s===0),l=r[s].dates[0],u=r[c].dates[0];l!==void 0&&u!==void 0?s===0&&l>u?(i.setDate(u,o),a.setDate(l,o)):s===1&&l<u&&(i.setDate(l,o),a.setDate(u,o)):e.allowOneSidedRange||(l!==void 0||u!==void 0)&&(o.clear=!0,r[c].setDate(r[s].dates,o)),r.forEach(e=>{e.picker.update().render()}),delete e._updating}var rn=class{constructor(e,t={}){let n=Array.isArray(t.inputs)?t.inputs:Array.from(e.querySelectorAll(`input`));if(n.length<2)return;e.rangepicker=this,this.element=e,this.inputs=n=n.slice(0,2),Object.freeze(n),this.allowOneSidedRange=!!t.allowOneSidedRange;let r=nn.bind(null,this),i=en(t),a=this.datepickers=[];n.forEach(e=>{tn(this,r,e,i)}),Object.freeze(a),Object.defineProperty(this,`dates`,{get(){return a.map(e=>e.dates[0])}}),a[0].dates.length>0?nn(this,{target:n[0]}):a[1].dates.length>0&&nn(this,{target:n[1]})}setOptions(e){this.allowOneSidedRange=!!e.allowOneSidedRange;let t=en(e);this.datepickers.forEach(e=>{e.setOptions(t)})}destroy(){this.datepickers.forEach(e=>{e.destroy()}),qe(this),delete this.element.rangepicker}getDates(e=void 0){let t=e?t=>Pe(t,e,this.datepickers[0].config.locale):e=>new Date(e);return this.dates.map(e=>e===void 0?e:t(e))}setDates(e,t){let{datepickers:[n,r],inputs:[i,a],dates:[o,s]}=this;this._updating=!0,n.setDate(e),r.setDate(t),delete this._updating,r.dates[0]===s?n.dates[0]!==o&&nn(this,{target:i}):nn(this,{target:a})}};function an(e,t,n,r,i){if(i){let a=t.target.value;i(a)?(r.innerHTML=``,r.classList.remove(`is-danger`),n.classList.remove(`is-danger`),n.classList.add(`is-success`)):(r.innerHTML=e.error||`Invalid`,n.classList.remove(`is-success`),n.classList.add(`is-danger`),r.classList.add(`is-danger`))}}function on(e){let t=new Set(e.options.filter(e=>e.selected).map(e=>e.value)),n=document.createElement(`div`);n.style.cssText=`position: relative; width: 100%;`;let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 2.5em; padding: 4px 8px; border: 1px solid var(--chc-input-border, #7a7a7a); border-radius: 4px; background: var(--chc-input-bg, #fff); cursor: pointer; box-sizing: border-box`;let i=document.createElement(`div`);i.style.cssText=`display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0;`;let a=document.createElement(`span`);a.textContent=`▾`,a.style.cssText=`margin-left: auto; padding-left: 8px; user-select: none; color: var(--chc-text-secondary, #666);`,r.appendChild(i),r.appendChild(a);let o=document.createElement(`div`);o.style.cssText=[`display: none`,`position: absolute`,`top: 100%`,`left: 0`,`right: 0`,`z-index: 50`,`max-height: 220px`,`overflow-y: auto`,`border: 1px solid var(--chc-border-primary, #dbdbdb)`,`border-top: none`,`border-radius: 0 0 4px 4px`,`background: var(--chc-dropdown-bg, #fff)`,`box-shadow: 0 4px 8px rgba(0,0,0,0.1)`].join(`; `);let s=new Map;for(let t of e.options){let e=document.createElement(`label`);e.style.cssText=[`display: flex`,`align-items: center`,`gap: 8px`,`padding: 6px 10px`,`cursor: pointer`,`color: var(--chc-text-primary, #363636)`].join(`; `),e.addEventListener(`mouseenter`,()=>{e.style.background=`var(--chc-hover-bg, #f5f5f5)`}),e.addEventListener(`mouseleave`,()=>{e.style.background=``});let n=document.createElement(`input`);n.type=`checkbox`,n.value=t.value,n.checked=!!t.selected,t.disabled&&(n.disabled=!0),n.style.cssText=`margin: 0; cursor: pointer;`;let r=document.createElement(`span`);r.textContent=t.label,e.appendChild(n),e.appendChild(r),o.appendChild(e),s.set(t.value,n)}n.appendChild(r),n.appendChild(o);let c=!1;function l(){c=!c,o.style.display=c?`block`:`none`}function u(){c=!1,o.style.display=`none`}function d(){if(i.innerHTML=``,t.size===0){let e=document.createElement(`span`);e.textContent=`Select…`,e.style.cssText=`color: var(--chc-text-muted, #999); user-select: none;`,i.appendChild(e);return}for(let n of t){let r=e.options.find(e=>e.value===n);if(!r)continue;let a=document.createElement(`span`);a.style.cssText=[`display: inline-flex`,`align-items: center`,`gap: 4px`,`padding: 2px 6px`,`border-radius: 3px`,`background: var(--chc-status-info, blue)`,`color: var(--chc-text-inverse, #fff)`,`font-size: 0.85em`,`white-space: nowrap`].join(`; `),a.textContent=r.label;let o=document.createElement(`span`);o.textContent=`×`,o.style.cssText=`cursor: pointer; margin-left: 2px; font-weight: bold;`,o.addEventListener(`click`,e=>{e.stopPropagation(),t.delete(n);let r=s.get(n);r&&(r.checked=!1),d(),f()}),a.appendChild(o),i.appendChild(a)}}function f(){if(B(e.onChange)){let t=new Event(`change`,{bubbles:!0});p.dispatchEvent(t),e.onChange(t,e)}}r.addEventListener(`click`,()=>l()),document.addEventListener(`click`,e=>{c&&!n.contains(e.target)&&u()});for(let[e,n]of s)n.addEventListener(`change`,()=>{n.checked?t.add(e):t.delete(e),d(),f()});d();let p=n;return Object.defineProperty(p,`selectedValues`,{get:()=>[...t],enumerable:!0}),Object.defineProperty(p,`value`,{get:()=>[...t].join(`,`),enumerable:!0}),{container:n,element:p}}var sn=`none`;function cn(e,t){for(let n of t.options){if(n.hide)continue;let r=document.createElement(`option`);r.className=`font-medium`,n.value&&r.setAttribute(`value`,n.value),(n.selected||t.value===n.value)&&r.setAttribute(`selected`,`true`),n.disabled&&r.setAttribute(`disabled`,`true`),r.innerHTML=n.label,e.appendChild(r)}}function ln(e){let t=document.createElement(`div`);if(t.className=`field font-medium`,e.class&&t.classList.add(e.class),e.width?t.style.cssText=`width: ${e.width}`:t.style.cssText=`flex-grow: 1`,e.label&&!e.checkbox){let n=document.createElement(`label`);n.className=`label`,e.labelStyle&&(n.style.cssText=e.labelStyle),n.innerHTML=e.label,t.appendChild(n)}let n,r,i=[],a=document.createElement(`div`);if(a.className=`control font-medium`,e.controlVisible===!1&&(a.style.display=sn),e.controlId&&(a.id=e.controlId),e.text){let t=document.createElement(`div`);e.id&&(t.id=e.id),t.className=`content`,t.innerHTML=e.text,a.appendChild(t)}else if(e.radio){let t=un(e,i);a.appendChild(t),n=t}else if(e.options&&e.multiple){let{container:t,element:r}=on(e);e.id&&(t.id=e.id),a.appendChild(t),n=r}else if(e.options)n=dn(e,a);else if(e.checkbox)n=fn(e,a);else{let t=pn(e,a);n=t.inputElement,r=t.datepicker}return t.appendChild(a),e.visible===!1&&(t.style.display=sn),{field:t,inputElement:n,datepicker:r,subFields:i}}function un(e,t){let n=document.createElement(`div`);n.id=e.id,n.className=`control`;for(let r of e.options??[]){let i=document.createElement(`label`);i.className=`radio`;let a=document.createElement(`input`);r.field&&t.push({input:a,field:r.field}),r.id&&(a.id=r.id),a.name=e.id,a.type=`radio`,a.value=r.text,r.checked&&(a.checked=!0),B(e.onChange)&&a.addEventListener(`change`,t=>e.onChange(t,e)),i.appendChild(a),n.appendChild(i);let o=document.createElement(`span`);o.style.marginLeft=`.25em`,o.style.marginRight=`1em`,o.style.color=`var(--chc-text-primary)`,o.innerHTML=r.text,n.appendChild(o)}return n}function dn(e,t){let n=document.createElement(`div`);n.className=`select font-medium`,n.style.cssText=`width: 100%`,e.zIndex&&(n.style.zIndex=e.zIndex);let r=document.createElement(`select`);if(e.dataPlaceholder&&r.setAttribute(`data-placeholder`,e.dataPlaceholder),e.dataType&&r.setAttribute(`data-type`,e.dataType),e.disabled&&(r.disabled=!0),e.id&&(n.id=e.id),r.style.cssText=`width: 100%`,cn(r,e),n.appendChild(r),t.appendChild(n),e.help){let n=document.createElement(`p`);n.className=`help font-medium is-info`,n.innerHTML=e.help?.text,n.style.display=e.help?.visible?``:sn,t.appendChild(n)}return B(e.onChange)&&r.addEventListener(`change`,t=>e.onChange(t,e)),r}function fn(e,t){let n=document.createElement(`div`);n.className=`flexrow nowrap`,n.style.display=`inline-block`;let r=document.createElement(`input`);B(e.onChange)&&r.addEventListener(`change`,t=>e.onChange(t,e)),r.className=`is-checkradio ${e.intent??`is-success`}`,r.type=`checkbox`,r.id=e.id,e.checked&&(r.checked=!0),n.appendChild(r);let i=document.createElement(`label`);return i.setAttribute(`for`,e.id),e.color&&(i.style.color=e.color),i.innerHTML=e.label,n.appendChild(i),t.appendChild(n),r}function pn(e,t){let n,r=document.createElement(`input`);if(r.className=`input font-medium`,e.class&&r.classList.add(e.class),r.setAttribute(`type`,e.type||`text`),r.setAttribute(`autocomplete`,e.autocomplete||`off`),r.setAttribute(`placeholder`,e.placeholder||``),e.disabled&&r.setAttribute(`disabled`,`true`),e.id&&r.setAttribute(`id`,e.id),t.appendChild(r),e.iconLeft){t.classList.add(`has-icons-left`);let n=document.createElement(`span`);n.className=`icon is-small is-left font-medium`;let r=document.createElement(`i`);r.className=e.iconLeft,n.appendChild(r),t.appendChild(n)}if(e.type===`password`){t.classList.add(`has-icons-right`);let n=document.createElement(`span`);n.className=`icon is-small is-right font-medium`;let r=document.createElement(`i`);r.className=e.iconRight,n.appendChild(r),t.appendChild(n)}let i=document.createElement(`p`);if(i.className=`help font-medium`,t.appendChild(i),e.validator&&r.addEventListener(`input`,t=>an(e,t,r,i,e.validator)),e.date){let t=e.maxNumberOfDates||1,i=!e.maxNumberOfDates||t===1;n=new $t(r,{maxDate:e.maxDate,minDate:e.minDate,format:`yyyy-mm-dd`,language:e.language||`en`,maxNumberOfDates:t,autohide:i})}else e.typeAhead&&ne({...e.typeAhead,element:r});return B(e.onKeyDown)&&r.addEventListener(`keydown`,t=>e.onKeyDown(t,e)),B(e.onChange)&&r.addEventListener(`change`,t=>e.onChange(t,e)),B(e.onInput)&&r.addEventListener(`input`,t=>e.onInput(t,e)),B(e.onKeyUp)&&r.addEventListener(`keyup`,t=>e.onKeyUp(t,e)),e.value!==void 0&&(r.value=e.value),e.selectOnFocus&&r.addEventListener(`focus`,()=>r.select()),{inputElement:r,datepicker:n}}var mn=`__BYE__`,hn=`__QUALIFIER__`;function gn({matchUp:e,side:t,sideNumber:n,eventHandlers:r,composition:i,position:a,currentParticipant:o}){let s=i?.configuration,c=t?.drawPosition,l=()=>{let e=j(s?.participantProvider)?s.participantProvider():[],t=s?.persistInputFields,n=e;t&&o&&(e.some(e=>e.participantId===o.participantId)||(n=[o,...e]));let r=n.map(e=>({label:e.participantName||e.participantId,value:e.participantId})),i=o?.participantId===mn,a=o?.participantId===hn,c=[];return i||c.push({label:`— BYE —`,value:mn}),s?.hasQualifying&&!a&&c.push({label:`— QUALIFIER —`,value:hn}),[...c,...r]},u=l(),d=i=>{if(!t)return;if(!i||i.trim()===``){j(r?.removeAssignment)&&r.removeAssignment({matchUp:e,side:t,sideNumber:n||1});return}if(i===mn){j(r?.assignBye)&&r.assignBye({matchUp:e,side:t,sideNumber:n||1});return}if(i===hn){j(r?.assignQualifier)&&r.assignQualifier({matchUp:e,side:t,sideNumber:n||1});return}let a=(j(s?.participantProvider)?s.participantProvider():[]).find(e=>e.participantId===i);a&&j(r?.assignParticipant)&&r.assignParticipant({matchUp:e,side:t,sideNumber:n||1,participant:a})},f=!1,p=()=>{if(f){f=!1;return}let e=Array.from(document.querySelectorAll(`.participant-assignment-input input`)),t=e.findIndex(e=>e.id===h);if(t!==-1&&t<e.length-1){let n=e[t+1];setTimeout(()=>{n.focus()},100)}},m=a?`-p${a}`:``,h=`assign-${e.matchUpId}-side${n}${m}`,g=o?.participantId,{field:_}=ln({typeAhead:{list:u,callback:d,onSelectComplete:p,listProvider:l,currentValue:g},placeholder:a?`Partner ${a}`:`Type participant name...`,field:h,id:h,class:`participant-assignment-input`});c&&(_.dataset.drawPosition=c.toString());let v=_.querySelector(`input`);v&&v.addEventListener(`keydown`,e=>{e.key===`Tab`&&(f=!0,setTimeout(()=>{f=!1},500))}),_.style.width=`100%`,_.style.margin=`0`;let y=s?.assignmentInputFontSize;return y&&(_.style.fontSize=y),setTimeout(()=>{let e=_.querySelector(`input`);if(e){let t=e.parentElement,n=0;for(;t&&n<15;){let e=window.getComputedStyle(t);(e.overflow!==`visible`||e.overflowX!==`visible`||e.overflowY!==`visible`)&&(t.style.setProperty(`overflow`,`visible`,`important`),t.style.setProperty(`overflow-x`,`visible`,`important`),t.style.setProperty(`overflow-y`,`visible`,`important`)),t=t.parentElement,n++}}},100),_}var _n=()=>`chc-seed`;function vn({className:e,composition:t,side:n}){let r=n?.seedValue===`~`?``:n?.seedValue!==void 0&&n.seedValue||n?.seedNumber;if(!r)return``;let i=t?.configuration||{},{bracketedSeeds:a}=i,o=typeof a==`boolean`&&[`(`,`)`]||a===`square`&&[`[`,`]`]||[``,``],s=`${o[0]}${r}${o[1]}`,c=i.seedingElement===`sup`?`sup`:`span`,l=document.createElement(c);return l.className=e||``,l.innerHTML=s,l}var yn=e=>(0,p.default)(`chc-scale`,e?.color&&`chc-scale--${e.color}`);function bn({individualParticipant:e,composition:t,className:n,matchUp:r,spacer:i}){let a=t?.configuration,o=a?.scaleAttributes?.eventType||r?.matchUpType||`SINGLES`,s=e?.rankings,c=e?.ratings,l=a?.scaleAttributes,u=l?.scaleType,d=l?.scaleName,f=l?.accessor,m=u===`RATING`?c:s,h=m?.SINGLES?.find(e=>e?.scaleName===d)?.scaleValue,g=m?.DOUBLES?.find(e=>e?.scaleName===d)?.scaleValue,_=h&&f?h[f]:h||``,v=g&&f?g[f]:g||``,y=o===`SINGLES`?_:v,b=a?.scaleAttributes?.fallback,x=!i&&(y||b&&(_||v)),S=document.createElement(`span`),C=a?.scaleAttributes?.scaleColor,w=C===`green`||C===`red`?C:void 0;return x&&(S.className=(0,p.default)(n,yn(w?{color:w}:{}))),S.innerHTML=x||``,S}var xn=e=>(0,p.default)(`chc-flag`,e?.variant&&`chc-flag--${e.variant}`);function Sn({matchUp:e,individualParticipant:n,spacer:r}){let i=n?.person?.iso2NationalityCode||``,a=i?t.fixtures.countryToFlag(i)?.slice(0,4):``,o=document.createElement(`span`),s=e?.matchUpType?.toLowerCase();return r||(o.className=xn({variant:s})),o.innerHTML=r?``:a,o}function Cn({individualParticipant:e,composition:t,className:n,matchUp:r,spacer:i,side:a,type:o}){if(o===`scale`)return bn({individualParticipant:e,composition:t,className:n,matchUp:r,spacer:i});let s=t?.configuration||{},c=document.createElement(`div`);if(o===`flag`&&s.flags)return Sn({matchUp:r,individualParticipant:e,spacer:i});if(o===`seeding`){let e=vn({className:n,composition:t,side:a});return typeof e==`string`?c:e}return c}var{FEED_IN:wn}=t.drawDefinitionConstants,{MALE:Tn,FEMALE:En}=t.genderConstants,{LUCKY_LOSER:Dn}=t.entryStatusConstants,On=`Qualifier`,kn=`BYE`,An=`TBD`;function jn(e,t,n,r,i,a){let o;return o=e?.bye?{participantId:`__BYE__`,participantName:`— BYE —`}:e?.qualifier?{participantId:`__QUALIFIER__`,participantName:`— QUALIFIER —`}:t,gn({matchUp:n,side:e,sideNumber:r,eventHandlers:i,composition:a,currentParticipant:o})}function Mn(e,t,n,r,i,a){let o=document.createElement(`span`);if(n&&r?.winnerColor)o.style.color=typeof r.winnerColor==`string`?r.winnerColor:`green`;else if(r?.genderColor){let e=i?.person?.sex,t=e===Tn&&`var(--chc-gender-male, #2E86C1)`||e===En&&`var(--chc-gender-female, #E07BAF)`||``;o.style.color=typeof r.genderColor==`string`?r.genderColor:t}if(o.innerHTML=t,e.appendChild(o),a?.participant?.luckyAdvancement){let t=document.createElement(`span`);t.className=`chc-lucky-advancement-badge`,t.textContent=`LL`,e.appendChild(t)}else if(a?.participant?.entryStatus===Dn){let t=document.createElement(`span`);t.className=`chc-lucky-loser-badge`,t.textContent=`LL`,e.appendChild(t)}}function Nn(e){let{isWinningSide:t,side:n,sideNumber:r,individualParticipant:i,matchUp:a,composition:o}=e||{},s=t?`winner`:void 0,c=e.eventHandlers||{},l=o?.configuration,u={QUALIFIER:l?.placeHolders?.qualifier||On,BYE:l?.placeHolders?.bye||kn,TBD:l?.placeHolders?.tbd||An},d=i?.useOtherName&&i?.participantOtherName||i?.participantName,f=e=>{j(c?.participantClick)&&(e.stopPropagation(),c.participantClick({individualParticipant:i,pointerEvent:e,matchUp:a,side:n}))},p=document.createElement(`div`);p.classList.add(`tmx-i`),p.setAttribute(`sideNumber`,String(r)),p.setAttribute(`id`,i?.participantId),p.onclick=f;let _=document.createElement(`div`);_.className=h({variant:s});let v=l?.flags,y=l?.scaleAttributes,b=v?`left`:l?.scaleAttributes?.scalePosition||`left`,x=v&&Cn({...e,type:`flag`});if(x)_.appendChild(x);else if(b===`left`){let t=Cn({type:`scale`,...e});t&&_.appendChild(t)}let S=document.createElement(`div`);S.className=g({variant:s});let C=a?.roundNumber===1,w=a?.drawType===wn&&a?.roundNumber>1&&n?.drawPosition&&!n?.sourceMatchUp,T=C||w,E=l?.persistInputFields;if(l?.inlineAssignment&&j(c?.assignParticipant)&&j(l?.participantProvider)&&T&&(!n?.bye||E)&&(!n?.qualifier||E)&&a&&(!d||n?.bye||n?.qualifier||E))S.appendChild(jn(n,i,a,r,c,o));else if(d)Mn(S,d,t,l,i,n);else{let e=document.createElement(`abbr`);e.className=m({variant:l?.showAddress?`showAddress`:``}),e.innerHTML=n?.bye&&u.BYE||n?.qualifier&&u.QUALIFIER||u.TBD,S.appendChild(e)}if(y&&(x||b===`right`)){let t=Cn({type:`scale`,...e});t&&(t.style.marginInlineStart=`0.5em`,t.style.marginInlineEnd=`0`,S.appendChild(t))}let D=Cn({...e,className:_n(),type:`seeding`});D&&S.appendChild(D),_.appendChild(S),p.appendChild(_);let O=z(e);return p.appendChild(O),{element:p}}var Pn=e=>(0,p.default)(`chc-pill`,e?.variant&&`chc-pill--${e.variant}`),{WALKOVER:Fn,DEFAULTED:In,DOUBLE_WALKOVER:Ln,DOUBLE_DEFAULT:Rn,ABANDONED:zn,IN_PROGRESS:Bn}=t.matchUpStatusConstants;function Vn({matchUpStatus:e}){let t=e?.toLowerCase(),n=[`defaulted`,`retired`,`walkover`,`defaulted`,`double_walkover`,`double_default`,`cancelled`,`in_progress`,`awaiting_result`,`dead_rubber`,`incomplete`,`suspended`,`abandoned`].includes(t)?t:void 0,r=[Fn,Ln].includes(e||``)?`WO`:[In,Rn].includes(e||``)?`DEF`:e===zn?`ABD`:e===Bn?`LIVE`:e?.split(`_`).join(``).slice(0,3)||``,i=document.createElement(`div`);i.className=Pn(n?{variant:n}:{});let a=document.createElement(`abbr`);return a.setAttribute(`title`,e||``),a.style.textDecoration=`none`,a.style.borderBottom=`none`,a.innerHTML=r,i.appendChild(a),i}function Hn(e){return e instanceof Element||e}var Un=()=>`chc-team-logo`,Wn=[{name:`Altitude`,src:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA8CAYAAACtrX6oAAAAAXNSR0IArs4c6QAAANZlWElmTU0AKgAAAAgABQEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAEyAAIAAAAUAAAAWodpAAQAAAABAAAAbgAAAAAAAACQAAAAAQAAAJAAAAABMjAyNjowMzowNiAwOTo1MDo1NgAABZAEAAIAAAAUAAAAsJKGAAcAAAASAAAAxKABAAMAAAABAAEAAKACAAQAAAABAAAAeKADAAQAAAABAAAAPAAAAAAyMDI2OjAzOjA1IDE1OjU0OjM0AEFTQ0lJAAAAU2NyZWVuc2hvdBJwAzsAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAKIaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA2LjAuMCI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8eG1wOkNyZWF0ZURhdGU+MjAyNi0wMy0wNVQxNTo1NDozNDwveG1wOkNyZWF0ZURhdGU+CiAgICAgICAgIDx4bXA6TW9kaWZ5RGF0ZT4yMDI2LTAzLTA2VDA5OjUw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vdb3/vN+zdyn4J+WGE9ouBu7qWkqDI+9zycQUP2jONIBcREHTf8FxpkHFHi+72WB7u3v4+AB0TWX0XAxRVNn55O8lSujLlaBgAdic3S0OoErA9WgDzGQwRc6y9YgI2H/+WobXHMwXNNsylTCKup2RtELcCu0l+DtlDAf41xS2P+jXAgFDDgpNQGMwdKAh7M0gVtJQGXBDzIOTDIyStZcEnAg5wDg5y8kgWXBDzIOTDIyStZcEnAg5wDg5y8kgWXBDzIOTDIyStZcEnAg5wDg5y8kgUPcgH/D6j84UwlI6obAAAAAElFTkSuQmCC`}];function Gn(e){return Wn[(e%Wn.length+Wn.length)%Wn.length]}function Kn(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function qn({participantId:e}){let t=document.createElement(`div`);t.className=Un();let n=Gn(e?Kn(e):Math.floor(Math.random()*8)),r=document.createElement(`img`);return r.src=n.src,r.alt=n.name,r.style.cssText=`height: 100%; width: auto; object-fit: contain;`,t.appendChild(r),t}var Jn=()=>`chc-side-container`,Yn=()=>`chc-side-row`,Xn=()=>`chc-tick`;function Zn({dim:e=`20px`}={}){return`
77
77
  <div style="line-height: 0;">
78
78
  <svg height="${e}" viewBox="0 0 18 24" width="${e}" xmlns="http://www.w3.org/2000/svg" class="${Xn()}" style="fill: currentcolor;">
79
79
  <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path>
@@ -211,7 +211,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
211
211
  `,`Instead, pass the .innerHTML of the element, or use a function that`,`returns a cloned version of the element instead.`,`
212
212
 
213
213
  `,`1) content: element.innerHTML
214
- `,`2) content: () => element.cloneNode(true)`].join(` `))}var s=i.reduce(function(e,t){var n=t&&pm(t,r);return n&&e.push(n),e},[]);return Cp(e)?s[0]:s}mm.defaultProps=Zp,mm.setDefaultProps=$p,mm.currentInput=Pp,Object.assign({},Dd,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),mm.setDefaultProps({render:lm});var hm=`#000000.#434343.#666666.#999999.#b7b7b7.#cccccc.#d9d9d9.#ffffff.#980000.#ff0000.#ff9900.#ffff00.#00ff00.#00ffff.#4a86e8.#0000ff.#9900ff.#ff00ff.#e6b8af.#f4cccc.#fce5cd.#fff2cc.#d9ead3.#d0e0e3.#c9daf8.#cfe2f3.#d9d2e9.#ead1dc`.split(`.`),gm=`notes-toolbar-recent-colors`,_m=8;function vm(){try{return JSON.parse(localStorage.getItem(gm)||`[]`)}catch{return[]}}function ym(e){let t=vm().filter(t=>t!==e);t.unshift(e),t.length>_m&&(t=t.slice(0,_m)),localStorage.setItem(gm,JSON.stringify(t))}function bm(e={}){let t=document.createElement(`div`);return t.className=`notes-toolbar`,t.appendChild(Tm(e)),t.appendChild(Em(e)),t.appendChild(Dm(e)),t.appendChild(jm(e)),t.appendChild(Pm(e)),t.appendChild(Fm(e)),t.appendChild(Lm(e)),t}function xm(e,t){for(let[n,r]of Object.entries(t)){let t=e.querySelector(`[data-action="${n}"]`);t&&t.classList.toggle(`is-active`,r)}}function Sm(e,t){let n=e.querySelector(`[data-action="heading"]`);n&&(n.value=t===!1?`0`:String(t))}function Cm(){let e=document.createElement(`div`);return e.className=`notes-toolbar-group`,e}function wm(e,t,n,r){let i=document.createElement(`button`);return i.className=`notes-toolbar-btn`,i.dataset.action=e,i.title=n,i.type=`button`,i.innerHTML=t,r&&i.addEventListener(`click`,r),i}function Tm(e){let t=Cm(),n=document.createElement(`select`);n.dataset.action=`heading`,n.title=`Text style`;for(let e of[{value:`0`,label:`Paragraph`},{value:`1`,label:`Heading 1`},{value:`2`,label:`Heading 2`},{value:`3`,label:`Heading 3`},{value:`4`,label:`Heading 4`},{value:`5`,label:`Heading 5`},{value:`6`,label:`Heading 6`}]){let t=document.createElement(`option`);t.value=e.value,t.textContent=e.label,n.appendChild(t)}return n.addEventListener(`change`,()=>{let t=parseInt(n.value,10);e.onHeading?.(t===0?!1:t)}),t.appendChild(n),t}function Em(e){let t=Cm();return t.appendChild(wm(`bold`,`<b>B</b>`,`Bold`,e.onBold)),t.appendChild(wm(`italic`,`<i>I</i>`,`Italic`,e.onItalic)),t.appendChild(wm(`underline`,`<u>U</u>`,`Underline`,e.onUnderline)),t.appendChild(wm(`strike`,`<s>S</s>`,`Strikethrough`,e.onStrike)),t}function Dm(e){let t=Cm();return t.appendChild(Om(`color`,`A`,`Text color`,`#000000`,t=>{ym(t),e.onColor?.(t)})),t.appendChild(Om(`background`,`A`,`Background color`,`#ffff00`,t=>{ym(t),e.onBackground?.(t)})),t}function Om(e,t,n,r,i){let a=document.createElement(`button`);a.className=`notes-toolbar-btn notes-toolbar-color-btn`,a.dataset.action=e,a.title=n,a.type=`button`;let o=document.createElement(`span`);o.className=`notes-toolbar-color-letter`,o.textContent=t,a.appendChild(o);let s=document.createElement(`span`);s.className=`notes-toolbar-color-bar`,s.style.backgroundColor=r,a.appendChild(s);let c;return a.addEventListener(`click`,()=>{if(c){c.destroy(),c=void 0;return}c=mm(a,{content:km(r,e=>{s.style.backgroundColor=e,i(e),c?.destroy(),c=void 0}),theme:`light-border`,trigger:`manual`,interactive:!0,placement:`bottom-start`,onHidden:()=>{c?.destroy(),c=void 0}}),c.show()}),a}function km(e,t){let n=document.createElement(`div`);n.className=`notes-color-panel`;let r=document.createElement(`div`);r.className=`notes-color-swatches`;for(let n of hm)r.appendChild(Am(n,n===e,t));n.appendChild(r);let i=vm();if(i.length){let r=document.createElement(`div`);r.className=`notes-color-section-label`,r.textContent=`Recent`,n.appendChild(r);let a=document.createElement(`div`);a.className=`notes-color-swatches`;for(let n of i)a.appendChild(Am(n,n===e,t));n.appendChild(a)}let a=document.createElement(`div`);a.className=`notes-color-custom-row`;let o=document.createElement(`input`);o.type=`color`,o.value=e,o.className=`notes-color-custom-input`;let s=document.createElement(`label`);return s.className=`notes-color-custom-label`,s.textContent=`Custom...`,s.addEventListener(`click`,()=>o.click()),o.addEventListener(`input`,()=>t(o.value)),a.appendChild(o),a.appendChild(s),n.appendChild(a),n}function Am(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`notes-color-swatch`,t&&r.classList.add(`is-selected`),r.style.backgroundColor=e,(e===`#ffffff`||e===`#fff`)&&(r.style.border=`1px solid var(--chc-border-secondary)`),r.title=e,r.addEventListener(`click`,()=>n(e)),r}function jm(e){let t=Cm();return t.appendChild(wm(`orderedList`,Mm(16,16,`<path d="M3 2h12v2H3zm0 5h12v2H3zm0 5h12v2H3z" fill="currentColor"/><text x="0" y="4" font-size="3.5" fill="currentColor">1</text><text x="0" y="9" font-size="3.5" fill="currentColor">2</text><text x="0" y="14" font-size="3.5" fill="currentColor">3</text>`),`Ordered list`,e.onOrderedList)),t.appendChild(wm(`bulletList`,Mm(16,16,`<circle cx="1.5" cy="3" r="1.5" fill="currentColor"/><circle cx="1.5" cy="8" r="1.5" fill="currentColor"/><circle cx="1.5" cy="13" r="1.5" fill="currentColor"/><path d="M5 2h10v2H5zm0 5h10v2H5zm0 5h10v2H5z" fill="currentColor"/>`),`Bullet list`,e.onBulletList)),t}function Mm(e,t,n){return`<svg width="${e}" height="${t}" viewBox="0 0 ${e} ${t}" xmlns="http://www.w3.org/2000/svg">${n}</svg>`}var Nm={alignLeft:Mm(16,16,`<path d="M1 2h14v2H1zm0 4h9v2H1zm0 4h14v2H1zm0 4h9v2H1z" fill="currentColor"/>`),alignCenter:Mm(16,16,`<path d="M1 2h14v2H1zm3.5 4h7v2h-7zM1 10h14v2H1zm3.5 4h7v2h-7z" fill="currentColor"/>`),alignRight:Mm(16,16,`<path d="M1 2h14v2H1zm6 4h8v2H7zM1 10h14v2H1zm6 4h8v2H7z" fill="currentColor"/>`),alignJustify:Mm(16,16,`<path d="M1 2h14v2H1zm0 4h14v2H1zm0 4h14v2H1zm0 4h14v2H1z" fill="currentColor"/>`)};function Pm(e){let t=Cm();return t.appendChild(wm(`alignLeft`,Nm.alignLeft,`Align left`,()=>e.onAlign?.(`left`))),t.appendChild(wm(`alignCenter`,Nm.alignCenter,`Align center`,()=>e.onAlign?.(`center`))),t.appendChild(wm(`alignRight`,Nm.alignRight,`Align right`,()=>e.onAlign?.(`right`))),t.appendChild(wm(`alignJustify`,Nm.alignJustify,`Justify`,()=>e.onAlign?.(`justify`))),t}function Fm(e){let t=Cm();t.appendChild(wm(`blockquote`,`“`,`Blockquote`,e.onBlockquote)),t.appendChild(wm(`codeBlock`,`</>`,`Code block`,e.onCodeBlock));let n=wm(`link`,`⇗`,`Insert link`);Im(n,`Enter URL`,`https://`,t=>e.onLink?.(t)),t.appendChild(n);let r=wm(`video`,`▷`,`Insert video`);return Im(r,`YouTube URL`,`https://youtube.com/...`,t=>e.onVideo?.(t)),t.appendChild(r),t}function Im(e,t,n,r){let i;e.addEventListener(`click`,()=>{if(i){i.destroy(),i=void 0;return}let a=document.createElement(`div`);a.className=`notes-url-panel`;let o=document.createElement(`div`);o.className=`notes-url-label`,o.textContent=t,a.appendChild(o);let s=document.createElement(`input`);s.type=`url`,s.className=`notes-url-input`,s.placeholder=n,a.appendChild(s);let c=document.createElement(`div`);c.className=`notes-url-actions`;let l=document.createElement(`button`);l.type=`button`,l.className=`button notes-url-cancel`,l.textContent=`Cancel`,l.addEventListener(`click`,()=>{i?.destroy(),i=void 0});let u=document.createElement(`button`);u.type=`button`,u.className=`button is-info notes-url-confirm`,u.textContent=`Insert`,u.addEventListener(`click`,()=>{let e=s.value.trim();e&&r(e),i?.destroy(),i=void 0}),c.appendChild(l),c.appendChild(u),a.appendChild(c),s.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),u.click()):e.key===`Escape`&&l.click()}),i=mm(e,{content:a,theme:`light-border`,trigger:`manual`,interactive:!0,placement:`bottom-start`,onShown:()=>setTimeout(()=>s.focus(),0),onHidden:()=>{i?.destroy(),i=void 0}}),i.show()})}function Lm(e){let t=Cm();return t.appendChild(wm(`clearFormatting`,`⊘`,`Clear formatting`,e.onClearFormatting)),t}function Rm(e,t,n){if(!e)return{};let r=document.createElement(`aside`);r.classList.add(`menu`);let i={},a=e=>n&&e.close!==!1?t=>{t.stopPropagation(),n(),e.onClick()}:t=>{t.stopPropagation(),e.onClick()},o=0,s=()=>(o+=1,o),c=e=>e?.heading||e?.text||e?.label||`Item ${s()}`,l=e=>{let t=document.createElement(`li`);if(t.className=`font-medium`,e.style&&(t.style.cssText=e.style),e.onClick){let n=e.fontSize||`1em`;if(e.divider){let e=document.createElement(`hr`);e.classList.add(`dropdown-divider`),t.appendChild(e)}else{let r=document.createElement(`a`),i=e.disabled?`0.4`:`1`;r.style.cssText=`text-decoration: none; opacity: ${i}; font-size: ${n}`,e.class&&r.classList.add(e.class),e.color&&(r.style.color=e.color),e.heading&&(r.style.fontWeight=`bold`),e.disabled||(r.onclick=a(e)),r.innerHTML=c(e),t.appendChild(r)}}else t.innerHTML=c(e),e.disabled||(t.onclick=e.onClick);return t},u;for(let e of t||[])if(!e.hide){if(e.items){if(e.text){let t=document.createElement(`p`);t.className=`menu-label font-medium`,t.innerHTML=e.text,r.appendChild(t)}let t=document.createElement(`ul`);t.className=`menu-list`;for(let n of e.items)n.hide||t.appendChild(l(n));r.appendChild(t)}else if(e.type===`input`){let{field:t,inputElement:n}=ln(e);e.focus&&(u=n),i[e.field]=n,r.appendChild(t)}else if(e.type===`divider`){let e=document.createElement(`hr`);e.classList.add(`dropdown-divider`),r.appendChild(e)}}return e.appendChild(r),{focusElement:u}}function zm(e){return typeof e==`function`}var Bm;function Vm(e){Bm&&=(Bm?.destroy(!0),void 0),e?.remove&&e.remove()}function Hm(e){let{title:t,options:n,menuItems:r=[],coords:i,callback:a,config:o}=e,{target:s,items:c}=e;if(!n?.length&&!c?.length&&!r)return;Vm();let l=document.createElement(`div`),u;return s||=i?.evt?.target,s&&(Bm=mm(s,{content:()=>(c=c?.filter(e=>!e.hide&&!e.disabled).map(e=>({...e,onClick:()=>{Vm(l),zm(e.onClick)&&e.onClick()}}))||n?.filter(e=>!e.hide&&!e.disabled).map(e=>({text:typeof e==`object`?e.option:e,style:e.style,onClick:()=>{e.subMenu?Bm.setContent(`IMPLEMENT SUB MENU`):zm(e.onClick)?(Vm(l),e.onClick()):zm(a)&&a&&(Vm(l),a(typeof e==`object`?{...e,coords:i}:e))}})),u=Rm(l,[{text:t,items:c},...r]).focusElement,l),theme:`light-border`,trigger:`click`,onShown:()=>{u&&setTimeout(()=>u?.focus(),0)},...o}),Bm.show(),Bm.setProps({interactive:!0})),Bm}var X=`court-line`;function Z(e,t){let n=document.createElementNS(`http://www.w3.org/2000/svg`,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}function Um(e,t){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return n.setAttribute(`viewBox`,e),n.setAttribute(`class`,t),n.setAttribute(`fill`,`none`),n.style.width=`100%`,n.style.height=`auto`,n.style.display=`block`,n}function Wm(e){let t=Um(`0 0 360 780`,e);for(let e of[`M 0 0 L 360 0 L 360 780 L 0 780 Z`,`M 45 0 L 45 780`,`M 315 0 L 315 780`,`M 0 390 L 360 390`,`M 45 210 L 315 210`,`M 45 570 L 315 570`,`M 180 210 L 180 570`,`M 180 0 L 180 20`,`M 180 760 L 180 780`])t.appendChild(Z(`path`,{d:e,class:X}));return t}function Gm(e){let t=Um(`0 0 500 470`,e),n=[Z(`rect`,{x:`0`,y:`0`,width:`500`,height:`470`,class:X}),Z(`circle`,{cx:`250`,cy:`470`,r:`60`,class:X}),Z(`line`,{x1:`0`,y1:`470`,x2:`500`,y2:`470`,class:X}),Z(`rect`,{x:`170`,y:`0`,width:`160`,height:`190`,class:X}),Z(`circle`,{cx:`250`,cy:`190`,r:`60`,class:X}),Z(`line`,{x1:`220`,y1:`40`,x2:`280`,y2:`40`,class:X}),Z(`circle`,{cx:`250`,cy:`52`,r:`12`,class:X}),Z(`path`,{d:`M 30 0 L 30 90 A 220 220 0 0 0 470 90 L 470 0`,class:X})];for(let e of n)t.appendChild(e);return t}function Km(e){let t=Um(`0 0 500 440`,e),n=[Z(`path`,{d:`M 20 170 A 350 400 0 0 1 480 170`,class:X}),Z(`line`,{x1:`250`,y1:`400`,x2:`20`,y2:`170`,class:X}),Z(`line`,{x1:`250`,y1:`400`,x2:`480`,y2:`170`,class:X}),Z(`path`,{d:`M 250 400 L 314 336 L 250 273 L 186 336 Z`,class:X}),Z(`path`,{d:`M 340 355 A 100 100 0 0 1 160 355`,class:X}),Z(`line`,{x1:`340`,y1:`355`,x2:`265`,y2:`405`,class:X}),Z(`line`,{x1:`160`,y1:`355`,x2:`235`,y2:`405`,class:X}),Z(`path`,{d:`M 235 405 A 18 18 0 0 1 265 405`,class:X}),Z(`circle`,{cx:`250`,cy:`340`,r:`9`,class:X}),Z(`line`,{x1:`247`,y1:`339`,x2:`253`,y2:`339`,class:X}),Z(`path`,{d:`M 244 398 L 244 404 L 250 408 L 256 404 L 256 398 Z`,class:X}),Z(`rect`,{x:`310`,y:`332`,width:`8`,height:`8`,transform:`rotate(45 314 336)`,class:X}),Z(`rect`,{x:`246`,y:`269`,width:`8`,height:`8`,transform:`rotate(45 250 273)`,class:X}),Z(`rect`,{x:`182`,y:`332`,width:`8`,height:`8`,transform:`rotate(45 186 336)`,class:X}),Z(`rect`,{x:`230`,y:`393`,width:`8`,height:`18`,class:X}),Z(`rect`,{x:`262`,y:`393`,width:`8`,height:`18`,class:X})];for(let e of n)t.appendChild(e);return t}function qm(e){let t=Um(`0 0 850 2000`,e),n=[Z(`rect`,{x:`0`,y:`0`,width:`850`,height:`2000`,rx:`280`,ry:`280`,class:X}),Z(`line`,{x1:`0`,y1:`1000`,x2:`850`,y2:`1000`,class:X}),Z(`circle`,{cx:`425`,cy:`1000`,r:`60`,class:X}),Z(`line`,{x1:`0`,y1:`650`,x2:`850`,y2:`650`,class:X}),Z(`line`,{x1:`0`,y1:`1350`,x2:`850`,y2:`1350`,class:X}),Z(`line`,{x1:`140`,y1:`300`,x2:`710`,y2:`300`,class:X}),Z(`line`,{x1:`140`,y1:`1700`,x2:`710`,y2:`1700`,class:X}),Z(`path`,{d:`M 395 300 A 40 40 0 0 1 455 300`,class:X}),Z(`path`,{d:`M 395 1700 A 40 40 0 0 0 455 1700`,class:X}),Z(`circle`,{cx:`270`,cy:`650`,r:`50`,class:X}),Z(`circle`,{cx:`580`,cy:`650`,r:`50`,class:X}),Z(`circle`,{cx:`270`,cy:`1350`,r:`50`,class:X}),Z(`circle`,{cx:`580`,cy:`1350`,r:`50`,class:X})];for(let e of n)t.appendChild(e);return t}function Jm(e){let t=Um(`0 0 200 440`,e);for(let e of[`M 0 0 L 200 0 L 200 440 L 0 440 Z`,`M 0 220 L 200 220`,`M 0 150 L 200 150`,`M 0 290 L 200 290`,`M 100 0 L 100 150`,`M 100 290 L 100 440`])t.appendChild(Z(`path`,{d:e,class:X}));return t}function Ym(e){let t=Um(`0 0 200 440`,e);for(let e of[`M 0 0 L 200 0 L 200 440 L 0 440 Z`,`M 18 0 L 18 440`,`M 182 0 L 182 440`,`M 0 220 L 200 220`,`M 0 146 L 200 146`,`M 0 294 L 200 294`,`M 0 30 L 200 30`,`M 0 410 L 200 410`,`M 100 146 L 100 220`,`M 100 220 L 100 294`])t.appendChild(Z(`path`,{d:e,class:X}));return t}function Xm(e){let t=Um(`0 0 100 200`,e);for(let e of[`M 0 0 L 100 0 L 100 200 L 0 200 Z`,`M 0 100 L 100 100`,`M 0 69.5 L 100 69.5`,`M 0 130.5 L 100 130.5`,`M 50 69.5 L 50 67.5`,`M 50 130.5 L 50 132.5`])t.appendChild(Z(`path`,{d:e,class:X}));return t}function Zm(){return`1.0.0`}var Qm={SET3_S6_TB7:`SET3-S:6/TB7`,SET3_S6_TB7_F_TB10:`SET3-S:6/TB7-F:TB10`,SET3_S6_TB10:`SET3-S:6/TB10`,SET3_S6_F_TB10:`SET3-S:6-F:TB10`,SET3_S6_TB7_NOAD:`SET3-S:6/TB7NOAD`,SET3_S8_TB7:`SET3-S:8/TB7`,SET3_S8_TB7_AT7:`SET3-S:8/TB7@7`,SET3_S4_TB7:`SET3-S:4/TB7`,SET3_S4_TB7_F_TB10:`SET3-S:4/TB7-F:TB10`,SET3_S4_TB5_AT3_F_TB10:`SET3-S:4/TB5@3-F:TB10`,SET5_S6_TB7:`SET5-S:6/TB7`,SET5_S6_TB7_F_TB10:`SET5-S:6/TB7-F:TB10`,SET1_S6_TB7:`SET1-S:6/TB7`,SET1_S6_TB10:`SET1-S:6/TB10`,SET1_S6_TB7_AT5:`SET1-S:6/TB7@5`,SET1_S8_TB7:`SET1-S:8/TB7`,SET1_S4_TB7:`SET1-S:4/TB7`,SET1_S5_TB9_AT4:`SET1-S:5/TB9@4`,SET1_S_TB7:`SET1-S:T7`,SET1_S_TB10:`SET1-S:TB10`,SET1_S_TB21:`SET1-S:T21`,SET1_S8:`SET1-S:8`,SET1_S10:`SET1-S:10`,FAST4:`SET5-S:4/NOAD`,SET3X_T10A_TB1:`SET3XA-S:T10-F:TB1`,SET3X_T10A_TB1_NOAD:`SET3XA-S:T10-F:TB1NOAD`,SET4X_T10A_TB1:`SET4XA-S:T10-F:TB1`};function $m(e,t,n){if(!e)return{elements:{}};let r={};for(let i of t||[]){if(!i?.label||i.hide)continue;let t=document.createElement(`button`);i.id&&(r[i.id]=t,t.id=i.id),t.style.marginRight=`.5em`,t.className=`button font-medium`,i.intent&&t.classList.add(i.intent),t.innerHTML=i.label,i.disabled&&(t.disabled=!0),t.onclick=e=>{e.stopPropagation(),!e.target.disabled&&B(i.onClick)&&i.onClick(),n&&B(n)&&n()},e.appendChild(t)}return{elements:r}}var eh=(e,t)=>n=>n?.trim().length>=e&&(!t||n?.trim().length<=t);function th(e){return t.tools.isConvertableInteger(e)&&parseInt(e.toString())>=0}var nh=(e,t)=>n=>th(n)&&Number(n)>=e&&Number(n)<=t,rh=e=>/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?\d)(?=.*?[#?!@$%^&*-]).{8,12}$/.test(e);function ih(e){return t.tools.dateTime.dateValidation.test(e)}var ah=(e,t)=>n=>{let r=(n||``).trim().split(` `).length;return r>=e&&(!t||r<=t)},oh=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,sh=e=>oh.exec(e),ch=u({dateValidator:()=>ih,emailValidator:()=>sh,nameValidator:()=>eh,numericRange:()=>nh,numericValidator:()=>th,passwordValidator:()=>rh,wordValidator:()=>ah}),lh=class{constructor({tournamentRecord:e,drawId:n,structureId:r,eventId:i}){this.tournamentRecord=e,this.drawId=n,this.structureId=r,this.eventId=i||e.events?.[0]?.eventId,t.tournamentEngine.setState(e)}setRenderCallback(e){this.renderCallback=e}getDrawEntryParticipantIds(){let{event:e,drawDefinition:n}=t.tournamentEngine.getEvent({drawId:this.drawId})||{};if(!e)return[];let{flightProfile:r}=t.tournamentEngine.getFlightProfile({eventId:this.eventId})||{};return(r?.flights?.find(e=>e.drawId===this.drawId)?.drawEntries||n?.entries||[]).map(e=>e.participantId).filter(Boolean)}getAllParticipants(){t.tournamentEngine.setState(this.tournamentRecord);let e=this.getDrawEntryParticipantIds();if(!e.length)return[];let{participants:n=[]}=t.tournamentEngine.getParticipants({participantFilters:{participantIds:e}})||{};return n.map(e=>({participantId:e.participantId,participantName:e.participantName,participantType:e.participantType,person:e.person,individualParticipants:e.individualParticipants}))}getAvailableParticipants(){t.tournamentEngine.setState(this.tournamentRecord);let e=this.getAllParticipants(),{assignedParticipantIds:n=[]}=t.tournamentEngine.getAssignedParticipantIds({drawId:this.drawId})||{};return e.filter(e=>!n.includes(e.participantId))}removeAssignment({drawPosition:e}){t.tournamentEngine.setState(this.tournamentRecord);let n=this.getMatchUps().find(t=>t.sides?.some(t=>t.drawPosition===e))?.sides?.find(t=>t.drawPosition===e)?.bye===!0,r=t.tournamentEngine.removeDrawPositionAssignment({drawId:this.drawId,structureId:this.structureId,drawPosition:e});if(r.error)return{success:!1,error:r.error};let{tournamentRecord:i}=t.tournamentEngine.getState()||{};return this.tournamentRecord=i,n&&this.renderCallback&&this.renderCallback(),{success:!0}}assignParticipant({drawPosition:e,participantId:n}){t.tournamentEngine.setState(this.tournamentRecord);let r=t.tournamentEngine.assignDrawPosition({drawId:this.drawId,structureId:this.structureId,drawPosition:e,participantId:n});if(r.error)return{success:!1,error:r.error};let{tournamentRecord:i}=t.tournamentEngine.getState()||{};return this.tournamentRecord=i,this.focusDrawPosition=e+1,this.renderCallback&&this.renderCallback(),{success:!0}}getAndClearFocusDrawPosition(){let e=this.focusDrawPosition;return this.focusDrawPosition=void 0,e}assignBye({drawPosition:e}){t.tournamentEngine.setState(this.tournamentRecord);let n=t.tournamentEngine.assignDrawPositionBye({drawId:this.drawId,structureId:this.structureId,drawPosition:e});if(n.error)return{success:!1,error:n.error};let{tournamentRecord:r}=t.tournamentEngine.getState()||{};return this.tournamentRecord=r,this.focusDrawPosition=e+1,this.renderCallback&&this.renderCallback(),{success:!0}}assignQualifier({drawPosition:e}){t.tournamentEngine.setState(this.tournamentRecord);let n=t.tournamentEngine.assignDrawPosition({drawId:this.drawId,structureId:this.structureId,drawPosition:e,qualifier:!0});if(n.error)return{success:!1,error:n.error};let{tournamentRecord:r}=t.tournamentEngine.getState()||{};return this.tournamentRecord=r,this.focusDrawPosition=e+1,this.renderCallback&&this.renderCallback(),{success:!0}}getMatchUps(){t.tournamentEngine.setState(this.tournamentRecord);let{eventData:e}=t.tournamentEngine.getEventData({eventId:this.eventId})||{},n=(e?.drawsData?.find(e=>e.drawId===this.drawId))?.structures?.find(e=>e.structureId===this.structureId)?.roundMatchUps;return n?Object.values(n).flat():[]}getState(){return this.tournamentRecord}getContext(){return{drawId:this.drawId,structureId:this.structureId}}};function uh(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function dh(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function fh(e){let t,n,r;e.length===2?(t=e===uh||e===dh?e:ph,n=e,r=e):(t=uh,n=(t,n)=>uh(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function ph(){return 0}function mh(e){return e===null?NaN:+e}var hh=fh(uh),gh=hh.right;hh.left,fh(mh).center;var _h=Math.sqrt(50),vh=Math.sqrt(10),yh=Math.sqrt(2);function bh(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=_h?10:a>=vh?5:a>=yh?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?bh(e,t,n*2):[s,c,l]}function xh(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?bh(t,e,n):bh(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function Sh(e,t,n){return t=+t,e=+e,n=+n,bh(e,t,n)[2]}function Ch(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Sh(t,e,n):Sh(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function wh(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}var Th={value:()=>{}};function Eh(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new Dh(n)}function Dh(e){this._=e}function Oh(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Dh.prototype=Eh.prototype={constructor:Dh,on:function(e,t){var n=this._,r=Oh(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=kh(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Ah(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ah(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Dh(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function kh(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Ah(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Th,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var jh={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function Mh(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),jh.hasOwnProperty(t)?{space:jh[t],local:e}:e}function Nh(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Ph(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fh(e){var t=Mh(e);return(t.local?Ph:Nh)(t)}function Ih(){}function Lh(e){return e==null?Ih:function(){return this.querySelector(e)}}function Rh(e){typeof e!=`function`&&(e=Lh(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new E_(r,this._parents)}function zh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Bh(){return[]}function Vh(e){return e==null?Bh:function(){return this.querySelectorAll(e)}}function Hh(e){return function(){return zh(e.apply(this,arguments))}}function Uh(e){e=typeof e==`function`?Hh(e):Vh(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new E_(r,i)}function Wh(e){return function(){return this.matches(e)}}function Gh(e){return function(t){return t.matches(e)}}var Kh=Array.prototype.find;function qh(e){return function(){return Kh.call(this.children,e)}}function Jh(){return this.firstElementChild}function Yh(e){return this.select(e==null?Jh:qh(typeof e==`function`?e:Gh(e)))}var Xh=Array.prototype.filter;function Zh(){return Array.from(this.children)}function Qh(e){return function(){return Xh.call(this.children,e)}}function $h(e){return this.selectAll(e==null?Zh:Qh(typeof e==`function`?e:Gh(e)))}function eg(e){typeof e!=`function`&&(e=Wh(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new E_(r,this._parents)}function tg(e){return Array(e.length)}function ng(){return new E_(this._enter||this._groups.map(tg),this._parents)}function rg(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}rg.prototype={constructor:rg,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ig(e){return function(){return e}}function ag(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new rg(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function og(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new rg(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function sg(e){return e.__data__}function cg(e,t){if(!arguments.length)return Array.from(this,sg);var n=t?og:ag,r=this._parents,i=this._groups;typeof e!=`function`&&(e=ig(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=lg(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new E_(o,r),o._enter=s,o._exit=c,o}function lg(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function ug(){return new E_(this._exit||this._groups.map(tg),this._parents)}function dg(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function fg(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new E_(s,this._parents)}function pg(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function mg(e){e||=hg;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new E_(i,this._parents).order()}function hg(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gg(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _g(){return Array.from(this)}function vg(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function yg(){let e=0;for(let t of this)++e;return e}function bg(){return!this.node()}function xg(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Sg(e){return function(){this.removeAttribute(e)}}function Cg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wg(e,t){return function(){this.setAttribute(e,t)}}function Tg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Eg(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Dg(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Og(e,t){var n=Mh(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Cg:Sg:typeof t==`function`?n.local?Dg:Eg:n.local?Tg:wg)(n,t))}function kg(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ag(e){return function(){this.style.removeProperty(e)}}function jg(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Mg(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Ng(e,t,n){return arguments.length>1?this.each((t==null?Ag:typeof t==`function`?Mg:jg)(e,t,n??``)):Pg(this.node(),e)}function Pg(e,t){return e.style.getPropertyValue(t)||kg(e).getComputedStyle(e,null).getPropertyValue(t)}function Fg(e){return function(){delete this[e]}}function Ig(e,t){return function(){this[e]=t}}function Lg(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Rg(e,t){return arguments.length>1?this.each((t==null?Fg:typeof t==`function`?Lg:Ig)(e,t)):this.node()[e]}function zg(e){return e.trim().split(/^|\s+/)}function Bg(e){return e.classList||new Vg(e)}function Vg(e){this._node=e,this._names=zg(e.getAttribute(`class`)||``)}Vg.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function Hg(e,t){for(var n=Bg(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Ug(e,t){for(var n=Bg(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Wg(e){return function(){Hg(this,e)}}function Gg(e){return function(){Ug(this,e)}}function Kg(e,t){return function(){(t.apply(this,arguments)?Hg:Ug)(this,e)}}function qg(e,t){var n=zg(e+``);if(arguments.length<2){for(var r=Bg(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Kg:t?Wg:Gg)(n,t))}function Jg(){this.textContent=``}function Yg(e){return function(){this.textContent=e}}function Xg(e){return function(){this.textContent=e.apply(this,arguments)??``}}function Zg(e){return arguments.length?this.each(e==null?Jg:(typeof e==`function`?Xg:Yg)(e)):this.node().textContent}function Qg(){this.innerHTML=``}function $g(e){return function(){this.innerHTML=e}}function e_(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function t_(e){return arguments.length?this.each(e==null?Qg:(typeof e==`function`?e_:$g)(e)):this.node().innerHTML}function n_(){this.nextSibling&&this.parentNode.appendChild(this)}function r_(){return this.each(n_)}function i_(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function a_(){return this.each(i_)}function o_(e){var t=typeof e==`function`?e:Fh(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function s_(){return null}function c_(e,t){var n=typeof e==`function`?e:Fh(e),r=t==null?s_:typeof t==`function`?t:Lh(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function l_(){var e=this.parentNode;e&&e.removeChild(this)}function u_(){return this.each(l_)}function d_(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function f_(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function p_(e){return this.select(e?f_:d_)}function m_(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function h_(e){return function(t){e.call(this,t,this.__data__)}}function g_(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function __(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function v_(e,t,n){return function(){var r=this.__on,i,a=h_(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function y_(e,t,n){var r=g_(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?v_:__,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function b_(e,t,n){var r=kg(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function x_(e,t){return function(){return b_(this,e,t)}}function S_(e,t){return function(){return b_(this,e,t.apply(this,arguments))}}function C_(e,t){return this.each((typeof t==`function`?S_:x_)(e,t))}function*w_(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var T_=[null];function E_(e,t){this._groups=e,this._parents=t}function D_(){return new E_([[document.documentElement]],T_)}function O_(){return this}E_.prototype=D_.prototype={constructor:E_,select:Rh,selectAll:Uh,selectChild:Yh,selectChildren:$h,filter:eg,data:cg,enter:ng,exit:ug,join:dg,merge:fg,selection:O_,order:pg,sort:mg,call:gg,nodes:_g,node:vg,size:yg,empty:bg,each:xg,attr:Og,style:Ng,property:Rg,classed:qg,text:Zg,html:t_,raise:r_,lower:a_,append:o_,insert:c_,remove:u_,clone:p_,datum:m_,on:y_,dispatch:C_,[Symbol.iterator]:w_};function k_(e){return typeof e==`string`?new E_([[document.querySelector(e)]],[document.documentElement]):new E_([[e]],T_)}function A_(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function j_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function M_(){}var N_=.7,P_=1/N_,F_=`\\s*([+-]?\\d+)\\s*`,I_=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,L_=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,R_=/^#([0-9a-f]{3,8})$/,z_=RegExp(`^rgb\\(${F_},${F_},${F_}\\)$`),B_=RegExp(`^rgb\\(${L_},${L_},${L_}\\)$`),V_=RegExp(`^rgba\\(${F_},${F_},${F_},${I_}\\)$`),H_=RegExp(`^rgba\\(${L_},${L_},${L_},${I_}\\)$`),U_=RegExp(`^hsl\\(${I_},${L_},${L_}\\)$`),W_=RegExp(`^hsla\\(${I_},${L_},${L_},${I_}\\)$`),G_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};A_(M_,X_,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:K_,formatHex:K_,formatHex8:q_,formatHsl:J_,formatRgb:Y_,toString:Y_});function K_(){return this.rgb().formatHex()}function q_(){return this.rgb().formatHex8()}function J_(){return lv(this).formatHsl()}function Y_(){return this.rgb().formatRgb()}function X_(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=R_.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Z_(t):n===3?new tv(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Q_(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Q_(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=z_.exec(e))?new tv(t[1],t[2],t[3],1):(t=B_.exec(e))?new tv(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=V_.exec(e))?Q_(t[1],t[2],t[3],t[4]):(t=H_.exec(e))?Q_(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=U_.exec(e))?cv(t[1],t[2]/100,t[3]/100,1):(t=W_.exec(e))?cv(t[1],t[2]/100,t[3]/100,t[4]):G_.hasOwnProperty(e)?Z_(G_[e]):e===`transparent`?new tv(NaN,NaN,NaN,0):null}function Z_(e){return new tv(e>>16&255,e>>8&255,e&255,1)}function Q_(e,t,n,r){return r<=0&&(e=t=n=NaN),new tv(e,t,n,r)}function $_(e){return e instanceof M_||(e=X_(e)),e?(e=e.rgb(),new tv(e.r,e.g,e.b,e.opacity)):new tv}function ev(e,t,n,r){return arguments.length===1?$_(e):new tv(e,t,n,r??1)}function tv(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}A_(tv,ev,j_(M_,{brighter(e){return e=e==null?P_:P_**+e,new tv(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?N_:N_**+e,new tv(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tv(ov(this.r),ov(this.g),ov(this.b),av(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nv,formatHex:nv,formatHex8:rv,formatRgb:iv,toString:iv}));function nv(){return`#${sv(this.r)}${sv(this.g)}${sv(this.b)}`}function rv(){return`#${sv(this.r)}${sv(this.g)}${sv(this.b)}${sv((isNaN(this.opacity)?1:this.opacity)*255)}`}function iv(){let e=av(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ov(this.r)}, ${ov(this.g)}, ${ov(this.b)}${e===1?`)`:`, ${e})`}`}function av(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ov(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function sv(e){return e=ov(e),(e<16?`0`:``)+e.toString(16)}function cv(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new dv(e,t,n,r)}function lv(e){if(e instanceof dv)return new dv(e.h,e.s,e.l,e.opacity);if(e instanceof M_||(e=X_(e)),!e)return new dv;if(e instanceof dv)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new dv(o,s,c,e.opacity)}function uv(e,t,n,r){return arguments.length===1?lv(e):new dv(e,t,n,r??1)}function dv(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}A_(dv,uv,j_(M_,{brighter(e){return e=e==null?P_:P_**+e,new dv(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?N_:N_**+e,new dv(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new tv(mv(e>=240?e-240:e+120,i,r),mv(e,i,r),mv(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new dv(fv(this.h),pv(this.s),pv(this.l),av(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=av(this.opacity);return`${e===1?`hsl(`:`hsla(`}${fv(this.h)}, ${pv(this.s)*100}%, ${pv(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function fv(e){return e=(e||0)%360,e<0?e+360:e}function pv(e){return Math.max(0,Math.min(1,e||0))}function mv(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var hv=e=>()=>e;function gv(e,t){return function(n){return e+n*t}}function _v(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function vv(e){return(e=+e)==1?yv:function(t,n){return n-t?_v(t,n,e):hv(isNaN(t)?n:t)}}function yv(e,t){var n=t-e;return n?gv(e,n):hv(isNaN(e)?t:e)}var bv=(function e(t){var n=vv(t);function r(e,t){var r=n((e=ev(e)).r,(t=ev(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=yv(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function xv(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Sv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Cv(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Mv(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function wv(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Tv(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Ev(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Mv(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Dv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ov=new RegExp(Dv.source,`g`);function kv(e){return function(){return e}}function Av(e){return function(t){return e(t)+``}}function jv(e,t){var n=Dv.lastIndex=Ov.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Dv.exec(e))&&(i=Ov.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Tv(r,i)})),n=Ov.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Av(c[0].x):kv(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Mv(e,t){var n=typeof t,r;return t==null||n===`boolean`?hv(t):(n===`number`?Tv:n===`string`?(r=X_(t))?(t=r,bv):jv:t instanceof X_?bv:t instanceof Date?wv:Sv(t)?xv:Array.isArray(t)?Cv:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Ev:Tv)(e,t)}function Nv(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var Pv=180/Math.PI,Fv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Iv(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Pv,skewX:Math.atan(c)*Pv,scaleX:o,scaleY:s}}var Lv;function Rv(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Fv:Iv(t.a,t.b,t.c,t.d,t.e,t.f)}function zv(e){return e==null||(Lv||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Lv.setAttribute(`transform`,e),!(e=Lv.transform.baseVal.consolidate()))?Fv:(e=e.matrix,Iv(e.a,e.b,e.c,e.d,e.e,e.f))}function Bv(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Tv(e,i)},{i:c-2,x:Tv(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Tv(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Tv(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Tv(e,n)},{i:s-2,x:Tv(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Vv=Bv(Rv,`px, `,`px)`,`deg)`),Hv=Bv(zv,`, `,`)`,`)`),Uv=0,Wv=0,Gv=0,Kv=1e3,qv,Jv,Yv=0,Xv=0,Zv=0,Qv=typeof performance==`object`&&performance.now?performance:Date,$v=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ey(){return Xv||=($v(ty),Qv.now()+Zv)}function ty(){Xv=0}function ny(){this._call=this._time=this._next=null}ny.prototype=ry.prototype={constructor:ny,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ey():+n)+(t==null?0:+t),!this._next&&Jv!==this&&(Jv?Jv._next=this:qv=this,Jv=this),this._call=e,this._time=n,cy()},stop:function(){this._call&&(this._call=null,this._time=1/0,cy())}};function ry(e,t,n){var r=new ny;return r.restart(e,t,n),r}function iy(){ey(),++Uv;for(var e=qv,t;e;)(t=Xv-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Uv}function ay(){Xv=(Yv=Qv.now())+Zv,Uv=Wv=0;try{iy()}finally{Uv=0,sy(),Xv=0}}function oy(){var e=Qv.now(),t=e-Yv;t>Kv&&(Zv-=t,Yv=e)}function sy(){for(var e,t=qv,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qv=n);Jv=e,cy(r)}function cy(e){Uv||(Wv&&=clearTimeout(Wv),e-Xv>24?(e<1/0&&(Wv=setTimeout(ay,e-Qv.now()-Zv)),Gv&&=clearInterval(Gv)):(Gv||=(Yv=Qv.now(),setInterval(oy,Kv)),Uv=1,$v(ay)))}function ly(e,t,n){var r=new ny;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var uy=Eh(`start`,`end`,`cancel`,`interrupt`),dy=[];function fy(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;gy(e,n,{name:t,index:r,group:i,on:uy,tween:dy,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function py(e,t){var n=hy(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function my(e,t){var n=hy(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function hy(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function gy(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ry(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return ly(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(ly(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function _y(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function vy(e){return this.each(function(){_y(this,e)})}function yy(e,t){var n,r;return function(){var i=my(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function by(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=my(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function xy(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=hy(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?yy:by)(n,e,t))}function Sy(e,t,n){var r=e._id;return e.each(function(){var e=my(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return hy(e,r).value[t]}}function Cy(e,t){var n;return(typeof t==`number`?Tv:t instanceof X_?bv:(n=X_(t))?(t=n,bv):jv)(e,t)}function wy(e){return function(){this.removeAttribute(e)}}function Ty(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ey(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Dy(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Oy(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function ky(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Ay(e,t){var n=Mh(e),r=n===`transform`?Hv:Cy;return this.attrTween(e,typeof t==`function`?(n.local?ky:Oy)(n,r,Sy(this,`attr.`+e,t)):t==null?(n.local?Ty:wy)(n):(n.local?Dy:Ey)(n,r,t))}function jy(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function My(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ny(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&My(e,i)),n}return i._value=t,i}function Py(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&jy(e,i)),n}return i._value=t,i}function Fy(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=Mh(e);return this.tween(n,(r.local?Ny:Py)(r,t))}function Iy(e,t){return function(){py(this,e).delay=+t.apply(this,arguments)}}function Ly(e,t){return t=+t,function(){py(this,e).delay=t}}function Ry(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Iy:Ly)(t,e)):hy(this.node(),t).delay}function zy(e,t){return function(){my(this,e).duration=+t.apply(this,arguments)}}function By(e,t){return t=+t,function(){my(this,e).duration=t}}function Vy(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?zy:By)(t,e)):hy(this.node(),t).duration}function Hy(e,t){if(typeof t!=`function`)throw Error();return function(){my(this,e).ease=t}}function Uy(e){var t=this._id;return arguments.length?this.each(Hy(t,e)):hy(this.node(),t).ease}function Wy(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();my(this,e).ease=n}}function Gy(e){if(typeof e!=`function`)throw Error();return this.each(Wy(this._id,e))}function Ky(e){typeof e!=`function`&&(e=Wh(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new xb(r,this._parents,this._name,this._id)}function qy(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new xb(o,this._parents,this._name,this._id)}function Jy(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function Yy(e,t,n){var r,i,a=Jy(t)?py:my;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Xy(e,t){var n=this._id;return arguments.length<2?hy(this.node(),n).on.on(e):this.each(Yy(n,e,t))}function Zy(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Qy(){return this.on(`end.remove`,Zy(this._id))}function $y(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Lh(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,fy(l[f],t,n,f,l,hy(u,n)));return new xb(a,this._parents,t,n)}function eb(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Vh(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=hy(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&fy(p,t,n,h,f,m);a.push(f),o.push(u)}return new xb(a,o,t,n)}var tb=D_.prototype.constructor;function nb(){return new tb(this._groups,this._parents)}function rb(e,t){var n,r,i;return function(){var a=Pg(this,e),o=(this.style.removeProperty(e),Pg(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ib(e){return function(){this.style.removeProperty(e)}}function ab(e,t,n){var r,i=n+``,a;return function(){var o=Pg(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function ob(e,t,n){var r,i,a;return function(){var o=Pg(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),Pg(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function sb(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=my(this,e),l=c.on,u=c.value[a]==null?s||=ib(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function cb(e,t,n){var r=(e+=``)==`transform`?Vv:Cy;return t==null?this.styleTween(e,rb(e,r)).on(`end.style.`+e,ib(e)):typeof t==`function`?this.styleTween(e,ob(e,r,Sy(this,`style.`+e,t))).each(sb(this._id,e)):this.styleTween(e,ab(e,r,t),n).on(`end.style.`+e,null)}function lb(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function ub(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&lb(e,a,n)),r}return a._value=t,a}function db(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,ub(e,t,n??``))}function fb(e){return function(){this.textContent=e}}function pb(e){return function(){this.textContent=e(this)??``}}function mb(e){return this.tween(`text`,typeof e==`function`?pb(Sy(this,`text`,e)):fb(e==null?``:e+``))}function hb(e){return function(t){this.textContent=e.call(this,t)}}function gb(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&hb(r)),t}return r._value=e,r}function _b(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,gb(e))}function vb(){for(var e=this._name,t=this._id,n=Cb(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=hy(c,t);fy(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new xb(r,this._parents,e,n)}function yb(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=my(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var bb=0;function xb(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Sb(e){return D_().transition(e)}function Cb(){return++bb}var wb=D_.prototype;xb.prototype=Sb.prototype={constructor:xb,select:$y,selectAll:eb,selectChild:wb.selectChild,selectChildren:wb.selectChildren,filter:Ky,merge:qy,selection:nb,transition:vb,call:wb.call,nodes:wb.nodes,node:wb.node,size:wb.size,empty:wb.empty,each:wb.each,on:Xy,attr:Ay,attrTween:Fy,style:cb,styleTween:db,text:mb,textTween:_b,remove:Qy,tween:xy,delay:Ry,duration:Vy,ease:Uy,easeVarying:Gy,end:yb,[Symbol.iterator]:wb[Symbol.iterator]};function Tb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Eb={time:null,delay:0,duration:250,ease:Tb};function Db(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ob(e){var t,n;e instanceof xb?(t=e._id,e=e._name):(t=Cb(),(n=Eb).time=ey(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&fy(c,e,t,l,o,n||Db(c,t));return new xb(r,this._parents,e,t)}D_.prototype.interrupt=vy,D_.prototype.transition=Ob;var{abs:kb,max:Ab,min:jb}=Math;[`w`,`e`].map(Mb),[`n`,`s`].map(Mb),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(Mb);function Mb(e){return{type:e}}var Nb=Math.PI,Pb=2*Nb,Fb=1e-6,Ib=Pb-Fb;function Lb(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Rb(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return Lb;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var zb=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?Lb:Rb(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>Fb)if(!(Math.abs(u*s-c*l)>Fb)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Nb-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Fb&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Fb||Math.abs(this._y1-l)>Fb)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Pb+Pb),d>Ib?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Fb&&this._append`A${n},${n},0,${+(d>=Nb)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Bb(){return new zb}Bb.prototype=zb.prototype;function Vb(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Hb(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ub(e){return e=Hb(Math.abs(e)),e?e[1]:NaN}function Wb(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Gb(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Kb=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function qb(e){if(!(t=Kb.exec(e)))throw Error(`invalid format: `+e);var t;return new Jb({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}qb.prototype=Jb.prototype;function Jb(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Jb.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function Yb(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Xb;function Zb(e,t){var n=Hb(e,t);if(!n)return Xb=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Xb=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Hb(e,Math.max(0,t+a-1))[0]}function Qb(e,t){var n=Hb(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var $b={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Vb,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Qb(e*100,t),r:Qb,s:Zb,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function ex(e){return e}var tx=Array.prototype.map,nx=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function rx(e){var t=e.grouping===void 0||e.thousands===void 0?ex:Wb(tx.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?ex:Gb(tx.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=qb(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):$b[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=$b[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Yb(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Xb!==void 0?nx[8+Xb/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Ub(t)/3)))*3,r=10**-n,i=l((e=qb(e),e.type=`f`,e),{suffix:nx[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var ix,ax,ox;sx({thousands:`,`,grouping:[3],currency:[`$`,``]});function sx(e){return ix=rx(e),ax=ix.format,ox=ix.formatPrefix,ix}function cx(e){return Math.max(0,-Ub(Math.abs(e)))}function lx(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ub(t)/3)))*3-Ub(Math.abs(e)))}function ux(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ub(t)-Ub(e))+1}function dx(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function fx(){return this.eachAfter(dx)}function px(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function mx(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function hx(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function gx(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function _x(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function vx(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function yx(e){for(var t=this,n=bx(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function bx(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function xx(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Sx(){return Array.from(this)}function Cx(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function wx(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*Tx(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function Ex(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=kx)):t===void 0&&(t=Ox);for(var n=new Mx(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new Mx(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(jx)}function Dx(){return Ex(this).eachBefore(Ax)}function Ox(e){return e.children}function kx(e){return Array.isArray(e)?e[1]:null}function Ax(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function jx(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Mx(e){this.data=e,this.depth=this.height=0,this.parent=null}Mx.prototype=Ex.prototype={constructor:Mx,count:fx,each:px,eachAfter:hx,eachBefore:mx,find:gx,sum:_x,sort:vx,path:yx,ancestors:xx,descendants:Sx,leaves:Cx,links:wx,copy:Dx,[Symbol.iterator]:Tx};function Nx(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Px(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function Fx(){var e=1,t=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/o,i.eachBefore(a(t,o)),r&&i.eachBefore(Nx),i}function a(e,t){return function(r){r.children&&Px(r,r.x0,e*(r.depth+1)/t,r.x1,e*(r.depth+2)/t);var i=r.x0,a=r.y0,o=r.x1-n,s=r.y1-n;o<i&&(i=o=(i+o)/2),s<a&&(a=s=(a+s)/2),r.x0=i,r.y0=a,r.x1=o,r.y1=s}}return i.round=function(e){return arguments.length?(r=!!e,i):r},i.size=function(n){return arguments.length?(e=+n[0],t=+n[1],i):[e,t]},i.padding=function(e){return arguments.length?(n=+e,i):n},i}function Ix(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Lx(e){return function(){return e}}function Rx(e){return+e}var zx=[0,1];function Bx(e){return e}function Vx(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Lx(isNaN(t)?NaN:.5)}function Hx(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Ux(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=Vx(i,r),a=n(o,a)):(r=Vx(r,i),a=n(a,o)),function(e){return a(r(e))}}function Wx(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=Vx(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=gh(e,t,1,r)-1;return a[n](i[n](t))}}function Gx(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Kx(){var e=zx,t=zx,n=Mv,r,i,a,o=Bx,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==Bx&&(o=Hx(e[0],e[n-1])),s=n>2?Wx:Ux,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Tv))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,Rx),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=Nv,u()},d.clamp=function(e){return arguments.length?(o=e?!0:Bx,u()):o!==Bx},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function qx(){return Kx()(Bx,Bx)}function Jx(e,t,n,r){var i=Ch(e,t,n),a;switch(r=qb(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=lx(i,o))&&(r.precision=a),ox(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=ux(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=cx(i))&&(r.precision=a-(r.type===`%`)*2);break}return ax(r)}function Yx(e){var t=e.domain;return e.ticks=function(e){var n=t();return xh(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Jx(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-- >0;){if(l=Sh(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Xx(){var e=qx();return e.copy=function(){return Gx(e,Xx())},Ix.apply(e,arguments),Yx(e)}function Zx(e){return function(){return e}}var Qx=Math.abs,$x=Math.atan2,eS=Math.cos,tS=Math.max,nS=Math.min,rS=Math.sin,iS=Math.sqrt,aS=Math.PI,oS=aS/2,sS=2*aS;function cS(e){return e>1?0:e<-1?aS:Math.acos(e)}function lS(e){return e>=1?oS:e<=-1?-oS:Math.asin(e)}function uS(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new zb(t)}function dS(e){return e.innerRadius}function fS(e){return e.outerRadius}function pS(e){return e.startAngle}function mS(e){return e.endAngle}function hS(e){return e&&e.padAngle}function gS(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function _S(e,t,n,r,i,a,o){var s=e-n,c=t-r,l=(o?a:-a)/iS(s*s+c*c),u=l*c,d=-l*s,f=e+u,p=t+d,m=n+u,h=r+d,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=v*v+y*y,x=i-a,S=f*h-m*p,C=(y<0?-1:1)*iS(tS(0,x*x*b-S*S)),w=(S*y-v*C)/b,T=(-S*v-y*C)/b,E=(S*y+v*C)/b,D=(-S*v+y*C)/b,O=w-g,k=T-_,A=E-g,j=D-_;return O*O+k*k>A*A+j*j&&(w=E,T=D),{cx:w,cy:T,x01:-u,y01:-d,x11:w*(i/x-1),y11:T*(i/x-1)}}function vS(){var e=dS,t=fS,n=Zx(0),r=null,i=pS,a=mS,o=hS,s=null,c=uS(l);function l(){var l,u,d=+e.apply(this,arguments),f=+t.apply(this,arguments),p=i.apply(this,arguments)-oS,m=a.apply(this,arguments)-oS,h=Qx(m-p),g=m>p;if(s||=l=c(),f<d&&(u=f,f=d,d=u),!(f>1e-12))s.moveTo(0,0);else if(h>sS-1e-12)s.moveTo(f*eS(p),f*rS(p)),s.arc(0,0,f,p,m,!g),d>1e-12&&(s.moveTo(d*eS(m),d*rS(m)),s.arc(0,0,d,m,p,g));else{var _=p,v=m,y=p,b=m,x=h,S=h,C=o.apply(this,arguments)/2,w=C>1e-12&&(r?+r.apply(this,arguments):iS(d*d+f*f)),T=nS(Qx(f-d)/2,+n.apply(this,arguments)),E=T,D=T,O,k;if(w>1e-12){var A=lS(w/d*rS(C)),j=lS(w/f*rS(C));(x-=A*2)>1e-12?(A*=g?1:-1,y+=A,b-=A):(x=0,y=b=(p+m)/2),(S-=j*2)>1e-12?(j*=g?1:-1,_+=j,v-=j):(S=0,_=v=(p+m)/2)}var M=f*eS(_),N=f*rS(_),P=d*eS(b),F=d*rS(b);if(T>1e-12){var I=f*eS(v),L=f*rS(v),R=d*eS(y),z=d*rS(y),B;if(h<aS)if(B=gS(M,N,R,z,I,L,P,F)){var ee=M-B[0],te=N-B[1],ne=I-B[0],V=L-B[1],re=1/rS(cS((ee*ne+te*V)/(iS(ee*ee+te*te)*iS(ne*ne+V*V)))/2),ie=iS(B[0]*B[0]+B[1]*B[1]);E=nS(T,(d-ie)/(re-1)),D=nS(T,(f-ie)/(re+1))}else E=D=0}S>1e-12?D>1e-12?(O=_S(R,z,M,N,f,D,g),k=_S(I,L,P,F,f,D,g),s.moveTo(O.cx+O.x01,O.cy+O.y01),D<T?s.arc(O.cx,O.cy,D,$x(O.y01,O.x01),$x(k.y01,k.x01),!g):(s.arc(O.cx,O.cy,D,$x(O.y01,O.x01),$x(O.y11,O.x11),!g),s.arc(0,0,f,$x(O.cy+O.y11,O.cx+O.x11),$x(k.cy+k.y11,k.cx+k.x11),!g),s.arc(k.cx,k.cy,D,$x(k.y11,k.x11),$x(k.y01,k.x01),!g))):(s.moveTo(M,N),s.arc(0,0,f,_,v,!g)):s.moveTo(M,N),!(d>1e-12)||!(x>1e-12)?s.lineTo(P,F):E>1e-12?(O=_S(P,F,I,L,d,-E,g),k=_S(M,N,R,z,d,-E,g),s.lineTo(O.cx+O.x01,O.cy+O.y01),E<T?s.arc(O.cx,O.cy,E,$x(O.y01,O.x01),$x(k.y01,k.x01),!g):(s.arc(O.cx,O.cy,E,$x(O.y01,O.x01),$x(O.y11,O.x11),!g),s.arc(0,0,d,$x(O.cy+O.y11,O.cx+O.x11),$x(k.cy+k.y11,k.cx+k.x11),g),s.arc(k.cx,k.cy,E,$x(k.y11,k.x11),$x(k.y01,k.x01),!g))):s.arc(0,0,d,b,y,g)}if(s.closePath(),l)return s=null,l+``||null}return l.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-aS/2;return[eS(r)*n,rS(r)*n]},l.innerRadius=function(t){return arguments.length?(e=typeof t==`function`?t:Zx(+t),l):e},l.outerRadius=function(e){return arguments.length?(t=typeof e==`function`?e:Zx(+e),l):t},l.cornerRadius=function(e){return arguments.length?(n=typeof e==`function`?e:Zx(+e),l):n},l.padRadius=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Zx(+e),l):r},l.startAngle=function(e){return arguments.length?(i=typeof e==`function`?e:Zx(+e),l):i},l.endAngle=function(e){return arguments.length?(a=typeof e==`function`?e:Zx(+e),l):a},l.padAngle=function(e){return arguments.length?(o=typeof e==`function`?e:Zx(+e),l):o},l.context=function(e){return arguments.length?(s=e??null,l):s},l}function yS(e,t,n){this.k=e,this.x=t,this.y=n}yS.prototype={constructor:yS,scale:function(e){return e===1?this:new yS(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new yS(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var bS=new yS(1,0,0);xS.prototype=yS.prototype;function xS(e){for(;!e.__zoom;)if(!(e=e.parentNode))return bS;return e.__zoom}function SS(e,t=15){let n=e.split(` `),r=[],i=[],a=0;return n.forEach(e=>{a+e.length>t?(i.length&&r.push(i.join(` `)),i=[e],a=e.length):(i.push(e),a+=e.length+ +(i.length>0))}),i.length&&r.push(i.join(` `)),r}var{WILDCARD:CS,QUALIFIER:wS,LUCKY_LOSER:TS}=t.entryStatusConstants,ES=`text-anchor`,DS=`dominant-baseline`,OS=`fill-opacity`,kS=Object.assign({},...t.fixtures.countries.filter(e=>e.ioc).map(e=>({[e.ioc]:e.iso2})),...t.fixtures.countries.filter(e=>e.iso).map(e=>({[e.iso]:e.iso2})));function AS(e){let t=Math.floor(e.length/2),n=e.slice(0,t),r=e.slice(t).reverse();return[...n,...r]}function jS(e){if(e)switch(e){case CS:return`WC`;case wS:return`Q`;case TS:return`LL`;default:return e}}function MS(e,t){let n=[];for(let r of e)for(let e of r.sides){let i=r.matchUpStatus===`BYE`&&!e.participantName;n.push({name:e.participantName||(i?`BYE`:``),participantName:e.participantName||(i?`BYE`:void 0),drawPosition:e.drawPosition,seedNumber:e.seedNumber,entryStatus:jS(e.entryStatus),nationalityCode:e.nationalityCode,matchUp:r,depth:t,value:1})}return n}function NS(e,t){let n=e.winningSide!==void 0&&e.winningSide!==null?e.sides.find(t=>t.sideNumber===e.winningSide):void 0;!n&&e.matchUpStatus===`BYE`&&(n=e.sides.find(e=>e.participantName));let r=n?.participantName,i=r?t.get(r):void 0;return{winnerName:r,winnerSide:n,winnerLookup:i}}function PS(e,t,n,r){return e.map((e,i)=>{let a=i*2,o=[t[a],t[a+1]].filter(Boolean),{winnerName:s,winnerSide:c,winnerLookup:l}=NS(e,r);return{name:s||``,participantName:s,drawPosition:l?.drawPosition??c?.drawPosition,seedNumber:c?.seedNumber??l?.seedNumber,entryStatus:jS(c?.entryStatus)??l?.entryStatus,nationalityCode:c?.nationalityCode??l?.nationalityCode,scoreString:e.scoreString,matchUpStatus:e.matchUpStatus,matchUp:e,depth:n,children:o.length>0?o:void 0}})}function FS(e){let{roundMatchUps:t}=e,n=Object.keys(t).map(Number).sort((e,t)=>e-t);if(n.length===0)throw Error(`No round data found in draw`);let r=t[n[0]],i=AS(MS(r,n.length)),a=new Map;for(let e of i)e.participantName&&e.participantName!==`BYE`&&a.set(e.participantName,e);let o=PS(AS(r),i,n.length-1,a);for(let e=1;e<n.length;e++)o=PS(AS(t[n[e]]),o,n.length-1-e,a);return o.length===1?o[0]:{name:`Tournament`,depth:0,children:o}}function IS(e,t){if(!e)return;let{seedNumber:n,entryStatus:r,drawPosition:i,participantName:a}=e,o;if(a?.trim().toUpperCase()===`BYE`)o=`#B0BEC5`;else if(n){let e=Number(n),t=Xx().domain([1,32]).range([`0`,`1`]);o=Xx().domain(wh(0,1,1/7)).range([`#81D4FA`,`#42A5F5`,`#1E88E5`,`#1565C0`,`#5C6BC0`,`#673AB7`,`#9C27B0`])(Number(t(e)))}else if(r?.toUpperCase()===`WC`)o=`red`;else if(r&&(r===`Q`||r===`LL`))o=Xx().domain(wh(0,1,1/3)).range([`#FFF176`,`#FBC02D`,`#FF9800`])(t(i));else{let e=[`#C8E6C9`,`#81C784`,`#66BB6A`,`#4CAF50`,`#43A047`,`#388E3C`,`#2E7D32`,`#1B5E20`,`#A5D6A7`,`#90CAF9`,`#64B5F6`,`#42A5F5`,`#2196F3`,`#1E88E5`,`#1976D2`,`#1565C0`];o=Xx().domain(wh(0,1,1/e.length)).range(e)(t(i))}e.color=o,e.children&&e.children.forEach(n=>{n.participantName===e.participantName&&(n.color=o),IS(n,t)})}function LS(e,t){let n=[];return e.seedNumber?n.push(`Seed ${e.seedNumber}`):e.entryStatus&&n.push(e.entryStatus),t===7&&e.drawPosition&&n.push(`Draw ${e.drawPosition}`),n.length>0?n.join(` • `):void 0}function RS(e,t){let n=e.find(e=>e.data.participantName&&e.data.participantName!==t);return n?.data.participantName?n.data:void 0}function zS(e,t){let n=[e.participantName],r;if(t.children&&t.children.length>0)e.scoreString&&n.push(e.scoreString),r=RS(t.children,e.participantName),r&&n.push(r.participantName);else{let r=LS(e,t.depth);r&&n.push(r)}return{messageLines:n,opponentData:r}}function BS(e,t){return-(e*t/2)+t/2}function VS(e,t,n){let r=k_(e).append(`svg`).attr(`width`,t).attr(`height`,n).style(`display`,`block`),i=r.append(`g`).attr(`transform`,`translate(${t/2}, ${n/2})`);return{svg:r,g:i,flagsGroup:i.append(`g`).attr(`class`,`flags-group`),winningFlagsGroup:i.append(`g`).attr(`class`,`winning-flags-group`),losingFlagsGroup:i.append(`g`).attr(`class`,`losing-flags-group`)}}function HS(e,t,n,r,i){let a=e.append(`text`).attr(`x`,t/2).attr(`y`,n/2).attr(ES,`middle`).attr(DS,`middle`).attr(`font-size`,`${r}px`).attr(`font-weight`,`bold`).style(`fill`,`var(--chc-text-primary, #333)`).attr(`pointer-events`,`none`),o=r+i*.5;return{centerText:a,centerText2:e.append(`text`).attr(`x`,t/2).attr(`y`,n/2+o).attr(ES,`middle`).attr(DS,`middle`).attr(`font-size`,`${i}px`).style(`fill`,`var(--chc-text-secondary, #666)`).attr(`pointer-events`,`none`)}}function US(e,t,n,r,i,a,o){n&&(i?(t.flagsGroup.selectAll(`text`).remove(),t.winningFlagsGroup.selectAll(`text`).remove(),t.losingFlagsGroup.selectAll(`text`).remove()):e.selectAll(`text`).remove(),e.append(`text`).attr(`font-size`,`${o}px`).attr(ES,`middle`).attr(DS,`middle`).attr(`transform`,`translate(0, ${r*a})`).text(qS(n)))}function WS(e,n,r,i={}){let a=i.width||800,o=i.height||800,s=Math.min(a,o)/800*(i.textScaleFactor??1),c=28*s,l=24*s,u=30*s,d=r||i.title||`Tournament`,f=Object.assign({},...t.fixtures.countries.filter(e=>e.label).map(e=>({[e.ioc]:e.label}))),p=FS(n),m=Ex(p,e=>e.children).sum(e=>e.value||0),h=Math.min(a,o)/2,g=h/2,_=e=>e*h/200;Fx().size([2*Math.PI,h-g])(m),IS(p,Xx().domain([0,n.drawSize||128]).range([0,1]));let v=m.descendants(),y=vS().startAngle(e=>e.x0).endAngle(e=>e.x1).innerRadius(e=>e.y0+g).outerRadius(e=>e.y1+g),{svg:b,g:x,flagsGroup:S,winningFlagsGroup:C,losingFlagsGroup:w}=VS(e,a,o),T=new Set,E=e=>{e.nationalityCode&&T.add(e.nationalityCode),e.children&&e.children.forEach(E)};E(p);let D=Array.from(T),{centerText:O,centerText2:k}=HS(b,a,o,c,l);function A(){let e=SS(d,15);O.text(``),O.selectAll(`tspan`).remove(),k.text(``),k.selectAll(`tspan`).remove(),O.selectAll(`tspan`).data(e).join(`tspan`).attr(`x`,a/2).attr(`dy`,(e,t)=>t===0?0:u).text(e=>e);let t=-(e.length*u/2)+u/2;O.attr(`y`,o/2+t),O.style(`display`,`block`),k.style(`display`,`none`)}function j(){if(S.selectAll(`text`).remove(),C.selectAll(`text`).remove(),w.selectAll(`text`).remove(),D.length===0)return;let e=Xx().domain([0,D.length]).range([0,Math.PI*2]),t=_(20),n=g-t+10;S.selectAll(`text`).data(D).join(`text`).attr(`font-size`,`${t}px`).attr(ES,`middle`).attr(DS,`middle`).attr(`transform`,(t,r)=>{let i=e(r);return`translate(${Math.cos(i)*n}, ${Math.sin(i)*n})`}).text(e=>qS(e)).style(`cursor`,`pointer`).on(`mouseover`,function(e,t){let n=f[t]||t;O.selectAll(`tspan`).remove(),O.attr(`y`,o/2),O.text(n).style(`display`,`block`),k.selectAll(`tspan`).remove(),k.text(``).style(`display`,`none`),N||x.selectAll(`path`).attr(OS,e=>e.data.nationalityCode===t?.9:.3)}).on(`mouseout`,function(){N||x.selectAll(`path`).attr(OS,.8),A()})}j(),A();let M=i.eventHandlers?.clickCenter;M&&x.insert(`circle`,`:first-child`).attr(`r`,g).attr(`fill`,`transparent`).style(`cursor`,`pointer`).on(`click`,M);let N=!1,P;function F(e,t){let n=t.data;if(n.participantName){let{messageLines:e,opponentData:r}=zS(n,t);r&&(n.opponent=r),O.selectAll(`tspan`).remove(),O.text(``),O.selectAll(`tspan`).data(e).join(`tspan`).attr(`x`,a/2).attr(`dy`,(e,t)=>t===0?0:u).text(e=>e);let i=BS(e.length,u);O.attr(`y`,o/2+i),O.style(`display`,`block`),k.style(`display`,`none`)}N?n.participantName?.toLowerCase()!==P?.toLowerCase()&&k_(e.currentTarget).attr(OS,.9):x.selectAll(`path`).attr(OS,e=>e.data.participantName===t.data.participantName?.9:.3);let r=_(30),i=g-r-10,s={flagsGroup:S,winningFlagsGroup:C,losingFlagsGroup:w};US(C,s,n.nationalityCode,-1,!0,i,r),n.opponent&&US(w,s,n.opponent.nationalityCode,1,!1,i,r)}function I(e,t){if(N){let n=t.data.participantName?.toLowerCase()===P?.toLowerCase();k_(e.currentTarget).attr(OS,n?1:.2)}else x.selectAll(`path`).attr(OS,.8);j(),A()}let L=i.eventHandlers?.clickSegment;function R(e,t){if(!L)return;let n=t.data;L({participantName:n.participantName,drawPosition:n.drawPosition,seedNumber:n.seedNumber,entryStatus:n.entryStatus,nationalityCode:n.nationalityCode,scoreString:n.scoreString,matchUpStatus:n.matchUpStatus,roundName:n.roundName,depth:n.depth,matchUp:n.matchUp})}let z=x.selectAll(`path`).data(v).join(`path`).attr(`d`,e=>y(e)).attr(`fill`,e=>e.data.color||`#ccc`).attr(OS,.8).attr(`stroke`,`#fff`).attr(`stroke-width`,1).on(`mouseover`,F).on(`mouseout`,I);L&&z.style(`cursor`,`pointer`).on(`click`,R),z.append(`title`).text(e=>{let t=e.data;return t.participantName?`${t.participantName}\nDraw: ${t.drawPosition||`N/A`}`:`${t.name}\nDepth: ${e.depth}`});function B(e){let t=0;return N=!!e,P=e,x.selectAll(`path`).attr(OS,n=>e?n.data.participantName?.toLowerCase()===e.toLowerCase()?(t+=1,1):.2:.8),t}function ee(e){b.style(`display`,e?`none`:`block`)}return{highlightPlayer:B,hide:ee}}function GS(e={}){return{render:(t,n,r)=>WS(t,n,r,e)}}function KS(e){return e?.length===2?e&&String.fromCodePoint!==void 0?e.toUpperCase().replaceAll(/./g,e=>String.fromCodePoint((e.codePointAt(0)??0)+127397)):e:``}function qS(e){return KS(kS[e]||e)}var{LUCKY_LOSER:JS,WILDCARD:YS,QUALIFIER:XS}=t.entryStatusConstants;function ZS(e){let t={};for(let[n,r]of Object.entries(e.roundMatchUps))t[Number(n)]=r.map(e=>({...e,winningSide:e.winningSide,drawPositions:e.drawPositions||[],scoreString:e.winningSide===1?e.score?.scoreStringSide1:e.winningSide===2?e.score?.scoreStringSide2:void 0,sides:(e.sides||[]).map(e=>({sideNumber:e.sideNumber,drawPosition:e.drawPosition,participantName:e.participant?.participantName,nationalityCode:e.participant?.person?.nationalityCode,seedNumber:e.seedNumber,entryStatus:e.participant?.entryStatus}))}));return{drawSize:(t[1]?.length||0)*2,roundMatchUps:t,seedAssignments:e.seedAssignments}}var QS={LL:JS,WC:YS,Q:XS},$S=[`R128`,`R64`,`R32`,`R16`,`QF`,`SF`,`F`];function eC(e){let t=tC(e);if(t.length===0)return{drawSize:0,roundMatchUps:{}};let n=t[0].data,r=n.length,i=nC(n),a=rC(t,e),o={};o[1]=aC(n,a,t);for(let e=1;e<t.length;e++)o[e+1]=oC(e,t,a,i);return{drawSize:r,roundMatchUps:o}}function tC(e){let t=[],n=!1;for(let r of $S){let i=e[r];i&&i.length>0&&(n=!0),n&&i&&i.length>0&&t.push({key:r,data:i})}return t}function nC(e){let t=new Map;return e.forEach((e,n)=>{let r=sC(e.player);r&&r!==`BYE`&&t.set(r,{drawPosition:e.Draw??n+1,country:e.country,seed:e.seed,entry:e.entry})}),t}function rC(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=r+1<e.length?e[r+1].data:t.W||[],a=new Set;for(let e of i){let t=sC(e.player);t&&a.add(t)}n.set(e[r].key,a)}return n}function iC(e,t,n){if(e===`BYE`||t===`BYE`)return e===`BYE`?2:1;if(n.has(e))return 1;if(n.has(t))return 2}function aC(e,t,n){let r=[],i=t.get(n[0].key)||new Set;for(let t=0;t<e.length;t+=2){let a=e[t],o=e[t+1],s=sC(a?.player),c=sC(o?.player),l=s===`BYE`||c===`BYE`,u=iC(s,c,i),d;if(!l&&n.length>1){let e=n[1].data,t=u===1?s:c;d=e.find(e=>sC(e.player)===t)?.score}let f=l?`BYE`:u?`COMPLETED`:`TO_BE_PLAYED`;r.push({roundNumber:1,matchUpStatus:f,winningSide:u,drawPositions:[a?.Draw??t+1,o?.Draw??t+2],scoreString:d,sides:[lC(1,a,t+1),lC(2,o,t+2)]})}return r}function oC(e,t,n,r){let i=e+1,a=t[e].data,o=n.get(t[e].key)||new Set,s=[];for(let e=0;e<a.length;e+=2){let t=a[e],n=a[e+1],c=sC(t?.player),l=sC(n?.player),u=o.has(c)?1:o.has(l)?2:void 0,d=(u===1?t:u===2?n:void 0)?.score,f=u?`COMPLETED`:`TO_BE_PLAYED`;s.push({roundNumber:i,matchUpStatus:f,winningSide:u,drawPositions:[r.get(c)?.drawPosition??0,r.get(l)?.drawPosition??0],scoreString:d,sides:[uC(1,t,r),uC(2,n,r)]})}return s}function sC(e){if(!e)return``;let t=e.trim();return t.toUpperCase()===`BYE`?`BYE`:t}function cC(e){if(e)return QS[e.toUpperCase()]||e}function lC(e,t,n){if(!t)return{sideNumber:e,drawPosition:n};let r=sC(t.player);return{sideNumber:e,drawPosition:t.Draw??n,participantName:r||void 0,nationalityCode:t.country||void 0,seedNumber:t.seed?Number(t.seed):void 0,entryStatus:cC(t.entry)}}function uC(e,t,n){if(!t)return{sideNumber:e,drawPosition:0};let r=sC(t.player),i=n.get(r);return{sideNumber:e,drawPosition:i?.drawPosition??0,participantName:r||void 0,nationalityCode:t.country||i?.country||void 0,seedNumber:t.seed?Number(t.seed):i?.seed?Number(i.seed):void 0,entryStatus:cC(t.entry||i?.entry)}}var dC=`right`,fC=`font-medium`;function pC({target:e,button:t,stateChange:n}){let r=0,i=()=>(r+=1,`Item${r}`),a=document.createElement(`div`);t.class&&a.classList.add(t.class),a.classList.add(`dropdown`),t.id&&(a.id=t.id),t.align===dC&&a.classList.add(`is-right`);let o=e=>e.classList.contains(`is-active`),s=()=>{o(a)&&a.classList.remove(`is-active`)},c=e=>o(e)?(e.classList.remove(`is-active`),!1):(e.classList.add(`is-active`),!0);a.onmouseleave=s,a.onclick=()=>c(a);let l=document.createElement(`div`);l.classList.add(`dropdown-trigger`);let u=document.createElement(`button`);u.className=`button font-medium`,t.intent&&u.classList.add(t.intent),u.setAttribute(`aria-haspopup`,`true`);let d=document.createElement(`span`);B(t.onClick)&&(d.onclick=t.onClick),d.style.cssText=`margin-right: 1em`,d.innerHTML=t.label,u.appendChild(d);let f=document.createElement(`span`);B(t.onClick)&&(f.onclick=t.onClick),f.innerHTML=`
214
+ `,`2) content: () => element.cloneNode(true)`].join(` `))}var s=i.reduce(function(e,t){var n=t&&pm(t,r);return n&&e.push(n),e},[]);return Cp(e)?s[0]:s}mm.defaultProps=Zp,mm.setDefaultProps=$p,mm.currentInput=Pp,Object.assign({},Dd,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),mm.setDefaultProps({render:lm});var hm=`#000000.#434343.#666666.#999999.#b7b7b7.#cccccc.#d9d9d9.#ffffff.#980000.#ff0000.#ff9900.#ffff00.#00ff00.#00ffff.#4a86e8.#0000ff.#9900ff.#ff00ff.#e6b8af.#f4cccc.#fce5cd.#fff2cc.#d9ead3.#d0e0e3.#c9daf8.#cfe2f3.#d9d2e9.#ead1dc`.split(`.`),gm=`notes-toolbar-recent-colors`,_m=8;function vm(){try{return JSON.parse(localStorage.getItem(gm)||`[]`)}catch{return[]}}function ym(e){let t=vm().filter(t=>t!==e);t.unshift(e),t.length>_m&&(t=t.slice(0,_m)),localStorage.setItem(gm,JSON.stringify(t))}function bm(e={}){let t=document.createElement(`div`);return t.className=`notes-toolbar`,t.appendChild(Tm(e)),t.appendChild(Em(e)),t.appendChild(Dm(e)),t.appendChild(jm(e)),t.appendChild(Pm(e)),t.appendChild(Fm(e)),t.appendChild(Lm(e)),t}function xm(e,t){for(let[n,r]of Object.entries(t)){let t=e.querySelector(`[data-action="${n}"]`);t&&t.classList.toggle(`is-active`,r)}}function Sm(e,t){let n=e.querySelector(`[data-action="heading"]`);n&&(n.value=t===!1?`0`:String(t))}function Cm(){let e=document.createElement(`div`);return e.className=`notes-toolbar-group`,e}function wm(e,t,n,r){let i=document.createElement(`button`);return i.className=`notes-toolbar-btn`,i.dataset.action=e,i.title=n,i.type=`button`,i.innerHTML=t,r&&i.addEventListener(`click`,r),i}function Tm(e){let t=Cm(),n=document.createElement(`select`);n.dataset.action=`heading`,n.title=`Text style`;for(let e of[{value:`0`,label:`Paragraph`},{value:`1`,label:`Heading 1`},{value:`2`,label:`Heading 2`},{value:`3`,label:`Heading 3`},{value:`4`,label:`Heading 4`},{value:`5`,label:`Heading 5`},{value:`6`,label:`Heading 6`}]){let t=document.createElement(`option`);t.value=e.value,t.textContent=e.label,n.appendChild(t)}return n.addEventListener(`change`,()=>{let t=parseInt(n.value,10);e.onHeading?.(t===0?!1:t)}),t.appendChild(n),t}function Em(e){let t=Cm();return t.appendChild(wm(`bold`,`<b>B</b>`,`Bold`,e.onBold)),t.appendChild(wm(`italic`,`<i>I</i>`,`Italic`,e.onItalic)),t.appendChild(wm(`underline`,`<u>U</u>`,`Underline`,e.onUnderline)),t.appendChild(wm(`strike`,`<s>S</s>`,`Strikethrough`,e.onStrike)),t}function Dm(e){let t=Cm();return t.appendChild(Om(`color`,`A`,`Text color`,`#000000`,t=>{ym(t),e.onColor?.(t)})),t.appendChild(Om(`background`,`A`,`Background color`,`#ffff00`,t=>{ym(t),e.onBackground?.(t)})),t}function Om(e,t,n,r,i){let a=document.createElement(`button`);a.className=`notes-toolbar-btn notes-toolbar-color-btn`,a.dataset.action=e,a.title=n,a.type=`button`;let o=document.createElement(`span`);o.className=`notes-toolbar-color-letter`,o.textContent=t,a.appendChild(o);let s=document.createElement(`span`);s.className=`notes-toolbar-color-bar`,s.style.backgroundColor=r,a.appendChild(s);let c;return a.addEventListener(`click`,()=>{if(c){c.destroy(),c=void 0;return}c=mm(a,{content:km(r,e=>{s.style.backgroundColor=e,i(e),c?.destroy(),c=void 0}),theme:`light-border`,trigger:`manual`,interactive:!0,placement:`bottom-start`,onHidden:()=>{c?.destroy(),c=void 0}}),c.show()}),a}function km(e,t){let n=document.createElement(`div`);n.className=`notes-color-panel`;let r=document.createElement(`div`);r.className=`notes-color-swatches`;for(let n of hm)r.appendChild(Am(n,n===e,t));n.appendChild(r);let i=vm();if(i.length){let r=document.createElement(`div`);r.className=`notes-color-section-label`,r.textContent=`Recent`,n.appendChild(r);let a=document.createElement(`div`);a.className=`notes-color-swatches`;for(let n of i)a.appendChild(Am(n,n===e,t));n.appendChild(a)}let a=document.createElement(`div`);a.className=`notes-color-custom-row`;let o=document.createElement(`input`);o.type=`color`,o.value=e,o.className=`notes-color-custom-input`;let s=document.createElement(`label`);return s.className=`notes-color-custom-label`,s.textContent=`Custom...`,s.addEventListener(`click`,()=>o.click()),o.addEventListener(`input`,()=>t(o.value)),a.appendChild(o),a.appendChild(s),n.appendChild(a),n}function Am(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`notes-color-swatch`,t&&r.classList.add(`is-selected`),r.style.backgroundColor=e,(e===`#ffffff`||e===`#fff`)&&(r.style.border=`1px solid var(--chc-border-secondary)`),r.title=e,r.addEventListener(`click`,()=>n(e)),r}function jm(e){let t=Cm();return t.appendChild(wm(`orderedList`,Mm(16,16,`<path d="M3 2h12v2H3zm0 5h12v2H3zm0 5h12v2H3z" fill="currentColor"/><text x="0" y="4" font-size="3.5" fill="currentColor">1</text><text x="0" y="9" font-size="3.5" fill="currentColor">2</text><text x="0" y="14" font-size="3.5" fill="currentColor">3</text>`),`Ordered list`,e.onOrderedList)),t.appendChild(wm(`bulletList`,Mm(16,16,`<circle cx="1.5" cy="3" r="1.5" fill="currentColor"/><circle cx="1.5" cy="8" r="1.5" fill="currentColor"/><circle cx="1.5" cy="13" r="1.5" fill="currentColor"/><path d="M5 2h10v2H5zm0 5h10v2H5zm0 5h10v2H5z" fill="currentColor"/>`),`Bullet list`,e.onBulletList)),t}function Mm(e,t,n){return`<svg width="${e}" height="${t}" viewBox="0 0 ${e} ${t}" xmlns="http://www.w3.org/2000/svg">${n}</svg>`}var Nm={alignLeft:Mm(16,16,`<path d="M1 2h14v2H1zm0 4h9v2H1zm0 4h14v2H1zm0 4h9v2H1z" fill="currentColor"/>`),alignCenter:Mm(16,16,`<path d="M1 2h14v2H1zm3.5 4h7v2h-7zM1 10h14v2H1zm3.5 4h7v2h-7z" fill="currentColor"/>`),alignRight:Mm(16,16,`<path d="M1 2h14v2H1zm6 4h8v2H7zM1 10h14v2H1zm6 4h8v2H7z" fill="currentColor"/>`),alignJustify:Mm(16,16,`<path d="M1 2h14v2H1zm0 4h14v2H1zm0 4h14v2H1zm0 4h14v2H1z" fill="currentColor"/>`)};function Pm(e){let t=Cm();return t.appendChild(wm(`alignLeft`,Nm.alignLeft,`Align left`,()=>e.onAlign?.(`left`))),t.appendChild(wm(`alignCenter`,Nm.alignCenter,`Align center`,()=>e.onAlign?.(`center`))),t.appendChild(wm(`alignRight`,Nm.alignRight,`Align right`,()=>e.onAlign?.(`right`))),t.appendChild(wm(`alignJustify`,Nm.alignJustify,`Justify`,()=>e.onAlign?.(`justify`))),t}function Fm(e){let t=Cm();t.appendChild(wm(`blockquote`,`“`,`Blockquote`,e.onBlockquote)),t.appendChild(wm(`codeBlock`,`</>`,`Code block`,e.onCodeBlock));let n=wm(`link`,`⇗`,`Insert link`);Im(n,`Enter URL`,`https://`,t=>e.onLink?.(t)),t.appendChild(n);let r=wm(`video`,`▷`,`Insert video`);return Im(r,`YouTube URL`,`https://youtube.com/...`,t=>e.onVideo?.(t)),t.appendChild(r),t}function Im(e,t,n,r){let i;e.addEventListener(`click`,()=>{if(i){i.destroy(),i=void 0;return}let a=document.createElement(`div`);a.className=`notes-url-panel`;let o=document.createElement(`div`);o.className=`notes-url-label`,o.textContent=t,a.appendChild(o);let s=document.createElement(`input`);s.type=`url`,s.className=`notes-url-input`,s.placeholder=n,a.appendChild(s);let c=document.createElement(`div`);c.className=`notes-url-actions`;let l=document.createElement(`button`);l.type=`button`,l.className=`button notes-url-cancel`,l.textContent=`Cancel`,l.addEventListener(`click`,()=>{i?.destroy(),i=void 0});let u=document.createElement(`button`);u.type=`button`,u.className=`button is-info notes-url-confirm`,u.textContent=`Insert`,u.addEventListener(`click`,()=>{let e=s.value.trim();e&&r(e),i?.destroy(),i=void 0}),c.appendChild(l),c.appendChild(u),a.appendChild(c),s.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),u.click()):e.key===`Escape`&&l.click()}),i=mm(e,{content:a,theme:`light-border`,trigger:`manual`,interactive:!0,placement:`bottom-start`,onShown:()=>setTimeout(()=>s.focus(),0),onHidden:()=>{i?.destroy(),i=void 0}}),i.show()})}function Lm(e){let t=Cm();return t.appendChild(wm(`clearFormatting`,`⊘`,`Clear formatting`,e.onClearFormatting)),t}function Rm(e,t,n){if(!e)return{};let r=document.createElement(`aside`);r.classList.add(`menu`);let i={},a=e=>n&&e.close!==!1?t=>{t.stopPropagation(),n(),e.onClick()}:t=>{t.stopPropagation(),e.onClick()},o=0,s=()=>(o+=1,o),c=e=>e?.heading||e?.text||e?.label||`Item ${s()}`,l=e=>{let t=document.createElement(`li`);if(t.className=`font-medium`,e.style&&(t.style.cssText=e.style),e.onClick){let n=e.fontSize||`1em`;if(e.divider){let e=document.createElement(`hr`);e.classList.add(`dropdown-divider`),t.appendChild(e)}else{let r=document.createElement(`a`),i=e.disabled?`0.4`:`1`;r.style.cssText=`text-decoration: none; opacity: ${i}; font-size: ${n}`,e.class&&r.classList.add(e.class),e.color&&(r.style.color=e.color),e.heading&&(r.style.fontWeight=`bold`),e.disabled||(r.onclick=a(e)),r.innerHTML=c(e),t.appendChild(r)}}else t.innerHTML=c(e),e.disabled||(t.onclick=e.onClick);return t},u;for(let e of t||[])if(!e.hide){if(e.items){if(e.text){let t=document.createElement(`p`);t.className=`menu-label font-medium`,t.innerHTML=e.text,r.appendChild(t)}let t=document.createElement(`ul`);t.className=`menu-list`;for(let n of e.items)n.hide||t.appendChild(l(n));r.appendChild(t)}else if(e.type===`input`){let{field:t,inputElement:n}=ln(e);e.focus&&(u=n),i[e.field]=n,r.appendChild(t)}else if(e.type===`divider`){let e=document.createElement(`hr`);e.classList.add(`dropdown-divider`),r.appendChild(e)}}return e.appendChild(r),{focusElement:u}}function zm(e){return typeof e==`function`}var Bm;function Vm(e){Bm&&=(Bm?.destroy(!0),void 0),e?.remove&&e.remove()}function Hm(e){let{title:t,options:n,menuItems:r=[],coords:i,callback:a,config:o}=e,{target:s,items:c}=e;if(!n?.length&&!c?.length&&!r)return;Vm();let l=document.createElement(`div`),u;return s||=i?.evt?.target,s&&(Bm=mm(s,{content:()=>(c=c?.filter(e=>!e.hide&&!e.disabled).map(e=>({...e,onClick:()=>{Vm(l),zm(e.onClick)&&e.onClick()}}))||n?.filter(e=>!e.hide&&!e.disabled).map(e=>({text:typeof e==`object`?e.option:e,style:e.style,onClick:()=>{e.subMenu?Bm.setContent(`IMPLEMENT SUB MENU`):zm(e.onClick)?(Vm(l),e.onClick()):zm(a)&&a&&(Vm(l),a(typeof e==`object`?{...e,coords:i}:e))}})),u=Rm(l,[{text:t,items:c},...r]).focusElement,l),theme:`light-border`,trigger:`click`,onShown:()=>{u&&setTimeout(()=>u?.focus(),0)},...o}),Bm.show(),Bm.setProps({interactive:!0})),Bm}var X=`court-line`;function Z(e,t){let n=document.createElementNS(`http://www.w3.org/2000/svg`,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}function Um(e,t){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);return n.setAttribute(`viewBox`,e),n.setAttribute(`class`,t),n.setAttribute(`fill`,`none`),n.style.width=`100%`,n.style.height=`auto`,n.style.display=`block`,n}function Wm(e){let t=Um(`0 0 360 780`,e);for(let e of[`M 0 0 L 360 0 L 360 780 L 0 780 Z`,`M 45 0 L 45 780`,`M 315 0 L 315 780`,`M 0 390 L 360 390`,`M 45 210 L 315 210`,`M 45 570 L 315 570`,`M 180 210 L 180 570`,`M 180 0 L 180 20`,`M 180 760 L 180 780`])t.appendChild(Z(`path`,{d:e,class:X}));return t}function Gm(e){let t=Um(`0 0 500 470`,e),n=[Z(`rect`,{x:`0`,y:`0`,width:`500`,height:`470`,class:X}),Z(`circle`,{cx:`250`,cy:`470`,r:`60`,class:X}),Z(`line`,{x1:`0`,y1:`470`,x2:`500`,y2:`470`,class:X}),Z(`rect`,{x:`170`,y:`0`,width:`160`,height:`190`,class:X}),Z(`circle`,{cx:`250`,cy:`190`,r:`60`,class:X}),Z(`line`,{x1:`220`,y1:`40`,x2:`280`,y2:`40`,class:X}),Z(`circle`,{cx:`250`,cy:`52`,r:`12`,class:X}),Z(`path`,{d:`M 30 0 L 30 90 A 220 220 0 0 0 470 90 L 470 0`,class:X})];for(let e of n)t.appendChild(e);return t}function Km(e){let t=Um(`0 0 500 440`,e),n=[Z(`path`,{d:`M 20 170 A 350 400 0 0 1 480 170`,class:X}),Z(`line`,{x1:`250`,y1:`400`,x2:`20`,y2:`170`,class:X}),Z(`line`,{x1:`250`,y1:`400`,x2:`480`,y2:`170`,class:X}),Z(`path`,{d:`M 250 400 L 314 336 L 250 273 L 186 336 Z`,class:X}),Z(`path`,{d:`M 340 355 A 100 100 0 0 1 160 355`,class:X}),Z(`line`,{x1:`340`,y1:`355`,x2:`265`,y2:`405`,class:X}),Z(`line`,{x1:`160`,y1:`355`,x2:`235`,y2:`405`,class:X}),Z(`path`,{d:`M 235 405 A 18 18 0 0 1 265 405`,class:X}),Z(`circle`,{cx:`250`,cy:`340`,r:`9`,class:X}),Z(`line`,{x1:`247`,y1:`339`,x2:`253`,y2:`339`,class:X}),Z(`path`,{d:`M 244 398 L 244 404 L 250 408 L 256 404 L 256 398 Z`,class:X}),Z(`rect`,{x:`310`,y:`332`,width:`8`,height:`8`,transform:`rotate(45 314 336)`,class:X}),Z(`rect`,{x:`246`,y:`269`,width:`8`,height:`8`,transform:`rotate(45 250 273)`,class:X}),Z(`rect`,{x:`182`,y:`332`,width:`8`,height:`8`,transform:`rotate(45 186 336)`,class:X}),Z(`rect`,{x:`230`,y:`393`,width:`8`,height:`18`,class:X}),Z(`rect`,{x:`262`,y:`393`,width:`8`,height:`18`,class:X})];for(let e of n)t.appendChild(e);return t}function qm(e){let t=Um(`0 0 850 2000`,e),n=[Z(`rect`,{x:`0`,y:`0`,width:`850`,height:`2000`,rx:`280`,ry:`280`,class:X}),Z(`line`,{x1:`0`,y1:`1000`,x2:`850`,y2:`1000`,class:X}),Z(`circle`,{cx:`425`,cy:`1000`,r:`60`,class:X}),Z(`line`,{x1:`0`,y1:`650`,x2:`850`,y2:`650`,class:X}),Z(`line`,{x1:`0`,y1:`1350`,x2:`850`,y2:`1350`,class:X}),Z(`line`,{x1:`140`,y1:`300`,x2:`710`,y2:`300`,class:X}),Z(`line`,{x1:`140`,y1:`1700`,x2:`710`,y2:`1700`,class:X}),Z(`path`,{d:`M 395 300 A 40 40 0 0 1 455 300`,class:X}),Z(`path`,{d:`M 395 1700 A 40 40 0 0 0 455 1700`,class:X}),Z(`circle`,{cx:`270`,cy:`650`,r:`50`,class:X}),Z(`circle`,{cx:`580`,cy:`650`,r:`50`,class:X}),Z(`circle`,{cx:`270`,cy:`1350`,r:`50`,class:X}),Z(`circle`,{cx:`580`,cy:`1350`,r:`50`,class:X})];for(let e of n)t.appendChild(e);return t}function Jm(e){let t=Um(`0 0 200 440`,e);for(let e of[`M 0 0 L 200 0 L 200 440 L 0 440 Z`,`M 0 220 L 200 220`,`M 0 150 L 200 150`,`M 0 290 L 200 290`,`M 100 0 L 100 150`,`M 100 290 L 100 440`])t.appendChild(Z(`path`,{d:e,class:X}));return t}function Ym(e){let t=Um(`0 0 200 440`,e);for(let e of[`M 0 0 L 200 0 L 200 440 L 0 440 Z`,`M 18 0 L 18 440`,`M 182 0 L 182 440`,`M 0 220 L 200 220`,`M 0 146 L 200 146`,`M 0 294 L 200 294`,`M 0 30 L 200 30`,`M 0 410 L 200 410`,`M 100 146 L 100 220`,`M 100 220 L 100 294`])t.appendChild(Z(`path`,{d:e,class:X}));return t}function Xm(e){let t=Um(`0 0 100 200`,e);for(let e of[`M 0 0 L 100 0 L 100 200 L 0 200 Z`,`M 0 100 L 100 100`,`M 0 69.5 L 100 69.5`,`M 0 130.5 L 100 130.5`,`M 50 69.5 L 50 67.5`,`M 50 130.5 L 50 132.5`])t.appendChild(Z(`path`,{d:e,class:X}));return t}function Zm(){return`1.0.2`}var Qm={SET3_S6_TB7:`SET3-S:6/TB7`,SET3_S6_TB7_F_TB10:`SET3-S:6/TB7-F:TB10`,SET3_S6_TB10:`SET3-S:6/TB10`,SET3_S6_F_TB10:`SET3-S:6-F:TB10`,SET3_S6_TB7_NOAD:`SET3-S:6/TB7NOAD`,SET3_S8_TB7:`SET3-S:8/TB7`,SET3_S8_TB7_AT7:`SET3-S:8/TB7@7`,SET3_S4_TB7:`SET3-S:4/TB7`,SET3_S4_TB7_F_TB10:`SET3-S:4/TB7-F:TB10`,SET3_S4_TB5_AT3_F_TB10:`SET3-S:4/TB5@3-F:TB10`,SET5_S6_TB7:`SET5-S:6/TB7`,SET5_S6_TB7_F_TB10:`SET5-S:6/TB7-F:TB10`,SET1_S6_TB7:`SET1-S:6/TB7`,SET1_S6_TB10:`SET1-S:6/TB10`,SET1_S6_TB7_AT5:`SET1-S:6/TB7@5`,SET1_S8_TB7:`SET1-S:8/TB7`,SET1_S4_TB7:`SET1-S:4/TB7`,SET1_S5_TB9_AT4:`SET1-S:5/TB9@4`,SET1_S_TB7:`SET1-S:T7`,SET1_S_TB10:`SET1-S:TB10`,SET1_S_TB21:`SET1-S:T21`,SET1_S8:`SET1-S:8`,SET1_S10:`SET1-S:10`,FAST4:`SET5-S:4/NOAD`,SET3X_T10A_TB1:`SET3XA-S:T10-F:TB1`,SET3X_T10A_TB1_NOAD:`SET3XA-S:T10-F:TB1NOAD`,SET4X_T10A_TB1:`SET4XA-S:T10-F:TB1`};function $m(e,t,n){if(!e)return{elements:{}};let r={};for(let i of t||[]){if(!i?.label||i.hide)continue;let t=document.createElement(`button`);i.id&&(r[i.id]=t,t.id=i.id),t.style.marginRight=`.5em`,t.className=`button font-medium`,i.intent&&t.classList.add(i.intent),t.innerHTML=i.label,i.disabled&&(t.disabled=!0),t.onclick=e=>{e.stopPropagation(),!e.target.disabled&&B(i.onClick)&&i.onClick(),n&&B(n)&&n()},e.appendChild(t)}return{elements:r}}var eh=(e,t)=>n=>n?.trim().length>=e&&(!t||n?.trim().length<=t);function th(e){return t.tools.isConvertableInteger(e)&&parseInt(e.toString())>=0}var nh=(e,t)=>n=>th(n)&&Number(n)>=e&&Number(n)<=t,rh=e=>/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?\d)(?=.*?[#?!@$%^&*-]).{8,12}$/.test(e);function ih(e){return t.tools.dateTime.dateValidation.test(e)}var ah=(e,t)=>n=>{let r=(n||``).trim().split(` `).length;return r>=e&&(!t||r<=t)},oh=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,sh=e=>oh.exec(e),ch=u({dateValidator:()=>ih,emailValidator:()=>sh,nameValidator:()=>eh,numericRange:()=>nh,numericValidator:()=>th,passwordValidator:()=>rh,wordValidator:()=>ah}),lh=class{constructor({tournamentRecord:e,drawId:n,structureId:r,eventId:i}){this.tournamentRecord=e,this.drawId=n,this.structureId=r,this.eventId=i||e.events?.[0]?.eventId,t.tournamentEngine.setState(e)}setRenderCallback(e){this.renderCallback=e}getDrawEntryParticipantIds(){let{event:e,drawDefinition:n}=t.tournamentEngine.getEvent({drawId:this.drawId})||{};if(!e)return[];let{flightProfile:r}=t.tournamentEngine.getFlightProfile({eventId:this.eventId})||{};return(r?.flights?.find(e=>e.drawId===this.drawId)?.drawEntries||n?.entries||[]).map(e=>e.participantId).filter(Boolean)}getAllParticipants(){t.tournamentEngine.setState(this.tournamentRecord);let e=this.getDrawEntryParticipantIds();if(!e.length)return[];let{participants:n=[]}=t.tournamentEngine.getParticipants({participantFilters:{participantIds:e}})||{};return n.map(e=>({participantId:e.participantId,participantName:e.participantName,participantType:e.participantType,person:e.person,individualParticipants:e.individualParticipants}))}getAvailableParticipants(){t.tournamentEngine.setState(this.tournamentRecord);let e=this.getAllParticipants(),{assignedParticipantIds:n=[]}=t.tournamentEngine.getAssignedParticipantIds({drawId:this.drawId})||{};return e.filter(e=>!n.includes(e.participantId))}removeAssignment({drawPosition:e}){t.tournamentEngine.setState(this.tournamentRecord);let n=this.getMatchUps().find(t=>t.sides?.some(t=>t.drawPosition===e))?.sides?.find(t=>t.drawPosition===e)?.bye===!0,r=t.tournamentEngine.removeDrawPositionAssignment({drawId:this.drawId,structureId:this.structureId,drawPosition:e});if(r.error)return{success:!1,error:r.error};let{tournamentRecord:i}=t.tournamentEngine.getState()||{};return this.tournamentRecord=i,n&&this.renderCallback&&this.renderCallback(),{success:!0}}assignParticipant({drawPosition:e,participantId:n}){t.tournamentEngine.setState(this.tournamentRecord);let r=t.tournamentEngine.assignDrawPosition({drawId:this.drawId,structureId:this.structureId,drawPosition:e,participantId:n});if(r.error)return{success:!1,error:r.error};let{tournamentRecord:i}=t.tournamentEngine.getState()||{};return this.tournamentRecord=i,this.focusDrawPosition=e+1,this.renderCallback&&this.renderCallback(),{success:!0}}getAndClearFocusDrawPosition(){let e=this.focusDrawPosition;return this.focusDrawPosition=void 0,e}assignBye({drawPosition:e}){t.tournamentEngine.setState(this.tournamentRecord);let n=t.tournamentEngine.assignDrawPositionBye({drawId:this.drawId,structureId:this.structureId,drawPosition:e});if(n.error)return{success:!1,error:n.error};let{tournamentRecord:r}=t.tournamentEngine.getState()||{};return this.tournamentRecord=r,this.focusDrawPosition=e+1,this.renderCallback&&this.renderCallback(),{success:!0}}assignQualifier({drawPosition:e}){t.tournamentEngine.setState(this.tournamentRecord);let n=t.tournamentEngine.assignDrawPosition({drawId:this.drawId,structureId:this.structureId,drawPosition:e,qualifier:!0});if(n.error)return{success:!1,error:n.error};let{tournamentRecord:r}=t.tournamentEngine.getState()||{};return this.tournamentRecord=r,this.focusDrawPosition=e+1,this.renderCallback&&this.renderCallback(),{success:!0}}getMatchUps(){t.tournamentEngine.setState(this.tournamentRecord);let{eventData:e}=t.tournamentEngine.getEventData({eventId:this.eventId})||{},n=(e?.drawsData?.find(e=>e.drawId===this.drawId))?.structures?.find(e=>e.structureId===this.structureId)?.roundMatchUps;return n?Object.values(n).flat():[]}getState(){return this.tournamentRecord}getContext(){return{drawId:this.drawId,structureId:this.structureId}}};function uh(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function dh(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function fh(e){let t,n,r;e.length===2?(t=e===uh||e===dh?e:ph,n=e,r=e):(t=uh,n=(t,n)=>uh(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function ph(){return 0}function mh(e){return e===null?NaN:+e}var hh=fh(uh),gh=hh.right;hh.left,fh(mh).center;var _h=Math.sqrt(50),vh=Math.sqrt(10),yh=Math.sqrt(2);function bh(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=_h?10:a>=vh?5:a>=yh?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?bh(e,t,n*2):[s,c,l]}function xh(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?bh(t,e,n):bh(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function Sh(e,t,n){return t=+t,e=+e,n=+n,bh(e,t,n)[2]}function Ch(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Sh(t,e,n):Sh(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function wh(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}var Th={value:()=>{}};function Eh(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new Dh(n)}function Dh(e){this._=e}function Oh(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Dh.prototype=Eh.prototype={constructor:Dh,on:function(e,t){var n=this._,r=Oh(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=kh(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Ah(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ah(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Dh(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function kh(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Ah(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Th,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var jh={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function Mh(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),jh.hasOwnProperty(t)?{space:jh[t],local:e}:e}function Nh(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Ph(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fh(e){var t=Mh(e);return(t.local?Ph:Nh)(t)}function Ih(){}function Lh(e){return e==null?Ih:function(){return this.querySelector(e)}}function Rh(e){typeof e!=`function`&&(e=Lh(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new E_(r,this._parents)}function zh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Bh(){return[]}function Vh(e){return e==null?Bh:function(){return this.querySelectorAll(e)}}function Hh(e){return function(){return zh(e.apply(this,arguments))}}function Uh(e){e=typeof e==`function`?Hh(e):Vh(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new E_(r,i)}function Wh(e){return function(){return this.matches(e)}}function Gh(e){return function(t){return t.matches(e)}}var Kh=Array.prototype.find;function qh(e){return function(){return Kh.call(this.children,e)}}function Jh(){return this.firstElementChild}function Yh(e){return this.select(e==null?Jh:qh(typeof e==`function`?e:Gh(e)))}var Xh=Array.prototype.filter;function Zh(){return Array.from(this.children)}function Qh(e){return function(){return Xh.call(this.children,e)}}function $h(e){return this.selectAll(e==null?Zh:Qh(typeof e==`function`?e:Gh(e)))}function eg(e){typeof e!=`function`&&(e=Wh(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new E_(r,this._parents)}function tg(e){return Array(e.length)}function ng(){return new E_(this._enter||this._groups.map(tg),this._parents)}function rg(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}rg.prototype={constructor:rg,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ig(e){return function(){return e}}function ag(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new rg(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function og(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new rg(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function sg(e){return e.__data__}function cg(e,t){if(!arguments.length)return Array.from(this,sg);var n=t?og:ag,r=this._parents,i=this._groups;typeof e!=`function`&&(e=ig(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=lg(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new E_(o,r),o._enter=s,o._exit=c,o}function lg(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function ug(){return new E_(this._exit||this._groups.map(tg),this._parents)}function dg(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function fg(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new E_(s,this._parents)}function pg(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function mg(e){e||=hg;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new E_(i,this._parents).order()}function hg(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gg(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _g(){return Array.from(this)}function vg(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function yg(){let e=0;for(let t of this)++e;return e}function bg(){return!this.node()}function xg(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Sg(e){return function(){this.removeAttribute(e)}}function Cg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wg(e,t){return function(){this.setAttribute(e,t)}}function Tg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Eg(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Dg(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Og(e,t){var n=Mh(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Cg:Sg:typeof t==`function`?n.local?Dg:Eg:n.local?Tg:wg)(n,t))}function kg(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ag(e){return function(){this.style.removeProperty(e)}}function jg(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Mg(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Ng(e,t,n){return arguments.length>1?this.each((t==null?Ag:typeof t==`function`?Mg:jg)(e,t,n??``)):Pg(this.node(),e)}function Pg(e,t){return e.style.getPropertyValue(t)||kg(e).getComputedStyle(e,null).getPropertyValue(t)}function Fg(e){return function(){delete this[e]}}function Ig(e,t){return function(){this[e]=t}}function Lg(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Rg(e,t){return arguments.length>1?this.each((t==null?Fg:typeof t==`function`?Lg:Ig)(e,t)):this.node()[e]}function zg(e){return e.trim().split(/^|\s+/)}function Bg(e){return e.classList||new Vg(e)}function Vg(e){this._node=e,this._names=zg(e.getAttribute(`class`)||``)}Vg.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function Hg(e,t){for(var n=Bg(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Ug(e,t){for(var n=Bg(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Wg(e){return function(){Hg(this,e)}}function Gg(e){return function(){Ug(this,e)}}function Kg(e,t){return function(){(t.apply(this,arguments)?Hg:Ug)(this,e)}}function qg(e,t){var n=zg(e+``);if(arguments.length<2){for(var r=Bg(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Kg:t?Wg:Gg)(n,t))}function Jg(){this.textContent=``}function Yg(e){return function(){this.textContent=e}}function Xg(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Zg(e){return arguments.length?this.each(e==null?Jg:(typeof e==`function`?Xg:Yg)(e)):this.node().textContent}function Qg(){this.innerHTML=``}function $g(e){return function(){this.innerHTML=e}}function e_(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function t_(e){return arguments.length?this.each(e==null?Qg:(typeof e==`function`?e_:$g)(e)):this.node().innerHTML}function n_(){this.nextSibling&&this.parentNode.appendChild(this)}function r_(){return this.each(n_)}function i_(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function a_(){return this.each(i_)}function o_(e){var t=typeof e==`function`?e:Fh(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function s_(){return null}function c_(e,t){var n=typeof e==`function`?e:Fh(e),r=t==null?s_:typeof t==`function`?t:Lh(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function l_(){var e=this.parentNode;e&&e.removeChild(this)}function u_(){return this.each(l_)}function d_(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function f_(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function p_(e){return this.select(e?f_:d_)}function m_(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function h_(e){return function(t){e.call(this,t,this.__data__)}}function g_(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function __(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function v_(e,t,n){return function(){var r=this.__on,i,a=h_(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function y_(e,t,n){var r=g_(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?v_:__,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function b_(e,t,n){var r=kg(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function x_(e,t){return function(){return b_(this,e,t)}}function S_(e,t){return function(){return b_(this,e,t.apply(this,arguments))}}function C_(e,t){return this.each((typeof t==`function`?S_:x_)(e,t))}function*w_(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var T_=[null];function E_(e,t){this._groups=e,this._parents=t}function D_(){return new E_([[document.documentElement]],T_)}function O_(){return this}E_.prototype=D_.prototype={constructor:E_,select:Rh,selectAll:Uh,selectChild:Yh,selectChildren:$h,filter:eg,data:cg,enter:ng,exit:ug,join:dg,merge:fg,selection:O_,order:pg,sort:mg,call:gg,nodes:_g,node:vg,size:yg,empty:bg,each:xg,attr:Og,style:Ng,property:Rg,classed:qg,text:Zg,html:t_,raise:r_,lower:a_,append:o_,insert:c_,remove:u_,clone:p_,datum:m_,on:y_,dispatch:C_,[Symbol.iterator]:w_};function k_(e){return typeof e==`string`?new E_([[document.querySelector(e)]],[document.documentElement]):new E_([[e]],T_)}function A_(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function j_(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function M_(){}var N_=.7,P_=1/N_,F_=`\\s*([+-]?\\d+)\\s*`,I_=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,L_=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,R_=/^#([0-9a-f]{3,8})$/,z_=RegExp(`^rgb\\(${F_},${F_},${F_}\\)$`),B_=RegExp(`^rgb\\(${L_},${L_},${L_}\\)$`),V_=RegExp(`^rgba\\(${F_},${F_},${F_},${I_}\\)$`),H_=RegExp(`^rgba\\(${L_},${L_},${L_},${I_}\\)$`),U_=RegExp(`^hsl\\(${I_},${L_},${L_}\\)$`),W_=RegExp(`^hsla\\(${I_},${L_},${L_},${I_}\\)$`),G_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};A_(M_,X_,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:K_,formatHex:K_,formatHex8:q_,formatHsl:J_,formatRgb:Y_,toString:Y_});function K_(){return this.rgb().formatHex()}function q_(){return this.rgb().formatHex8()}function J_(){return lv(this).formatHsl()}function Y_(){return this.rgb().formatRgb()}function X_(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=R_.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Z_(t):n===3?new tv(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Q_(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Q_(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=z_.exec(e))?new tv(t[1],t[2],t[3],1):(t=B_.exec(e))?new tv(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=V_.exec(e))?Q_(t[1],t[2],t[3],t[4]):(t=H_.exec(e))?Q_(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=U_.exec(e))?cv(t[1],t[2]/100,t[3]/100,1):(t=W_.exec(e))?cv(t[1],t[2]/100,t[3]/100,t[4]):G_.hasOwnProperty(e)?Z_(G_[e]):e===`transparent`?new tv(NaN,NaN,NaN,0):null}function Z_(e){return new tv(e>>16&255,e>>8&255,e&255,1)}function Q_(e,t,n,r){return r<=0&&(e=t=n=NaN),new tv(e,t,n,r)}function $_(e){return e instanceof M_||(e=X_(e)),e?(e=e.rgb(),new tv(e.r,e.g,e.b,e.opacity)):new tv}function ev(e,t,n,r){return arguments.length===1?$_(e):new tv(e,t,n,r??1)}function tv(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}A_(tv,ev,j_(M_,{brighter(e){return e=e==null?P_:P_**+e,new tv(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?N_:N_**+e,new tv(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tv(ov(this.r),ov(this.g),ov(this.b),av(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nv,formatHex:nv,formatHex8:rv,formatRgb:iv,toString:iv}));function nv(){return`#${sv(this.r)}${sv(this.g)}${sv(this.b)}`}function rv(){return`#${sv(this.r)}${sv(this.g)}${sv(this.b)}${sv((isNaN(this.opacity)?1:this.opacity)*255)}`}function iv(){let e=av(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ov(this.r)}, ${ov(this.g)}, ${ov(this.b)}${e===1?`)`:`, ${e})`}`}function av(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ov(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function sv(e){return e=ov(e),(e<16?`0`:``)+e.toString(16)}function cv(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new dv(e,t,n,r)}function lv(e){if(e instanceof dv)return new dv(e.h,e.s,e.l,e.opacity);if(e instanceof M_||(e=X_(e)),!e)return new dv;if(e instanceof dv)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new dv(o,s,c,e.opacity)}function uv(e,t,n,r){return arguments.length===1?lv(e):new dv(e,t,n,r??1)}function dv(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}A_(dv,uv,j_(M_,{brighter(e){return e=e==null?P_:P_**+e,new dv(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?N_:N_**+e,new dv(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new tv(mv(e>=240?e-240:e+120,i,r),mv(e,i,r),mv(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new dv(fv(this.h),pv(this.s),pv(this.l),av(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=av(this.opacity);return`${e===1?`hsl(`:`hsla(`}${fv(this.h)}, ${pv(this.s)*100}%, ${pv(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function fv(e){return e=(e||0)%360,e<0?e+360:e}function pv(e){return Math.max(0,Math.min(1,e||0))}function mv(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var hv=e=>()=>e;function gv(e,t){return function(n){return e+n*t}}function _v(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function vv(e){return(e=+e)==1?yv:function(t,n){return n-t?_v(t,n,e):hv(isNaN(t)?n:t)}}function yv(e,t){var n=t-e;return n?gv(e,n):hv(isNaN(e)?t:e)}var bv=(function e(t){var n=vv(t);function r(e,t){var r=n((e=ev(e)).r,(t=ev(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=yv(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function xv(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Sv(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Cv(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Mv(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function wv(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Tv(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Ev(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Mv(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Dv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ov=new RegExp(Dv.source,`g`);function kv(e){return function(){return e}}function Av(e){return function(t){return e(t)+``}}function jv(e,t){var n=Dv.lastIndex=Ov.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Dv.exec(e))&&(i=Ov.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Tv(r,i)})),n=Ov.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Av(c[0].x):kv(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Mv(e,t){var n=typeof t,r;return t==null||n===`boolean`?hv(t):(n===`number`?Tv:n===`string`?(r=X_(t))?(t=r,bv):jv:t instanceof X_?bv:t instanceof Date?wv:Sv(t)?xv:Array.isArray(t)?Cv:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Ev:Tv)(e,t)}function Nv(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var Pv=180/Math.PI,Fv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Iv(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Pv,skewX:Math.atan(c)*Pv,scaleX:o,scaleY:s}}var Lv;function Rv(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Fv:Iv(t.a,t.b,t.c,t.d,t.e,t.f)}function zv(e){return e==null||(Lv||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Lv.setAttribute(`transform`,e),!(e=Lv.transform.baseVal.consolidate()))?Fv:(e=e.matrix,Iv(e.a,e.b,e.c,e.d,e.e,e.f))}function Bv(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Tv(e,i)},{i:c-2,x:Tv(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Tv(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Tv(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Tv(e,n)},{i:s-2,x:Tv(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Vv=Bv(Rv,`px, `,`px)`,`deg)`),Hv=Bv(zv,`, `,`)`,`)`),Uv=0,Wv=0,Gv=0,Kv=1e3,qv,Jv,Yv=0,Xv=0,Zv=0,Qv=typeof performance==`object`&&performance.now?performance:Date,$v=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ey(){return Xv||=($v(ty),Qv.now()+Zv)}function ty(){Xv=0}function ny(){this._call=this._time=this._next=null}ny.prototype=ry.prototype={constructor:ny,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ey():+n)+(t==null?0:+t),!this._next&&Jv!==this&&(Jv?Jv._next=this:qv=this,Jv=this),this._call=e,this._time=n,cy()},stop:function(){this._call&&(this._call=null,this._time=1/0,cy())}};function ry(e,t,n){var r=new ny;return r.restart(e,t,n),r}function iy(){ey(),++Uv;for(var e=qv,t;e;)(t=Xv-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Uv}function ay(){Xv=(Yv=Qv.now())+Zv,Uv=Wv=0;try{iy()}finally{Uv=0,sy(),Xv=0}}function oy(){var e=Qv.now(),t=e-Yv;t>Kv&&(Zv-=t,Yv=e)}function sy(){for(var e,t=qv,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qv=n);Jv=e,cy(r)}function cy(e){Uv||(Wv&&=clearTimeout(Wv),e-Xv>24?(e<1/0&&(Wv=setTimeout(ay,e-Qv.now()-Zv)),Gv&&=clearInterval(Gv)):(Gv||=(Yv=Qv.now(),setInterval(oy,Kv)),Uv=1,$v(ay)))}function ly(e,t,n){var r=new ny;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var uy=Eh(`start`,`end`,`cancel`,`interrupt`),dy=[];function fy(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;gy(e,n,{name:t,index:r,group:i,on:uy,tween:dy,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function py(e,t){var n=hy(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function my(e,t){var n=hy(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function hy(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function gy(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ry(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return ly(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(ly(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function _y(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function vy(e){return this.each(function(){_y(this,e)})}function yy(e,t){var n,r;return function(){var i=my(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function by(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=my(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function xy(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=hy(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?yy:by)(n,e,t))}function Sy(e,t,n){var r=e._id;return e.each(function(){var e=my(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return hy(e,r).value[t]}}function Cy(e,t){var n;return(typeof t==`number`?Tv:t instanceof X_?bv:(n=X_(t))?(t=n,bv):jv)(e,t)}function wy(e){return function(){this.removeAttribute(e)}}function Ty(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ey(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Dy(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Oy(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function ky(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Ay(e,t){var n=Mh(e),r=n===`transform`?Hv:Cy;return this.attrTween(e,typeof t==`function`?(n.local?ky:Oy)(n,r,Sy(this,`attr.`+e,t)):t==null?(n.local?Ty:wy)(n):(n.local?Dy:Ey)(n,r,t))}function jy(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function My(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ny(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&My(e,i)),n}return i._value=t,i}function Py(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&jy(e,i)),n}return i._value=t,i}function Fy(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=Mh(e);return this.tween(n,(r.local?Ny:Py)(r,t))}function Iy(e,t){return function(){py(this,e).delay=+t.apply(this,arguments)}}function Ly(e,t){return t=+t,function(){py(this,e).delay=t}}function Ry(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Iy:Ly)(t,e)):hy(this.node(),t).delay}function zy(e,t){return function(){my(this,e).duration=+t.apply(this,arguments)}}function By(e,t){return t=+t,function(){my(this,e).duration=t}}function Vy(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?zy:By)(t,e)):hy(this.node(),t).duration}function Hy(e,t){if(typeof t!=`function`)throw Error();return function(){my(this,e).ease=t}}function Uy(e){var t=this._id;return arguments.length?this.each(Hy(t,e)):hy(this.node(),t).ease}function Wy(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();my(this,e).ease=n}}function Gy(e){if(typeof e!=`function`)throw Error();return this.each(Wy(this._id,e))}function Ky(e){typeof e!=`function`&&(e=Wh(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new xb(r,this._parents,this._name,this._id)}function qy(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new xb(o,this._parents,this._name,this._id)}function Jy(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function Yy(e,t,n){var r,i,a=Jy(t)?py:my;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Xy(e,t){var n=this._id;return arguments.length<2?hy(this.node(),n).on.on(e):this.each(Yy(n,e,t))}function Zy(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Qy(){return this.on(`end.remove`,Zy(this._id))}function $y(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Lh(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,fy(l[f],t,n,f,l,hy(u,n)));return new xb(a,this._parents,t,n)}function eb(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Vh(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=hy(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&fy(p,t,n,h,f,m);a.push(f),o.push(u)}return new xb(a,o,t,n)}var tb=D_.prototype.constructor;function nb(){return new tb(this._groups,this._parents)}function rb(e,t){var n,r,i;return function(){var a=Pg(this,e),o=(this.style.removeProperty(e),Pg(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ib(e){return function(){this.style.removeProperty(e)}}function ab(e,t,n){var r,i=n+``,a;return function(){var o=Pg(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function ob(e,t,n){var r,i,a;return function(){var o=Pg(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),Pg(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function sb(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=my(this,e),l=c.on,u=c.value[a]==null?s||=ib(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function cb(e,t,n){var r=(e+=``)==`transform`?Vv:Cy;return t==null?this.styleTween(e,rb(e,r)).on(`end.style.`+e,ib(e)):typeof t==`function`?this.styleTween(e,ob(e,r,Sy(this,`style.`+e,t))).each(sb(this._id,e)):this.styleTween(e,ab(e,r,t),n).on(`end.style.`+e,null)}function lb(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function ub(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&lb(e,a,n)),r}return a._value=t,a}function db(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,ub(e,t,n??``))}function fb(e){return function(){this.textContent=e}}function pb(e){return function(){var t=e(this);this.textContent=t??``}}function mb(e){return this.tween(`text`,typeof e==`function`?pb(Sy(this,`text`,e)):fb(e==null?``:e+``))}function hb(e){return function(t){this.textContent=e.call(this,t)}}function gb(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&hb(r)),t}return r._value=e,r}function _b(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,gb(e))}function vb(){for(var e=this._name,t=this._id,n=Cb(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=hy(c,t);fy(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new xb(r,this._parents,e,n)}function yb(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=my(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var bb=0;function xb(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Sb(e){return D_().transition(e)}function Cb(){return++bb}var wb=D_.prototype;xb.prototype=Sb.prototype={constructor:xb,select:$y,selectAll:eb,selectChild:wb.selectChild,selectChildren:wb.selectChildren,filter:Ky,merge:qy,selection:nb,transition:vb,call:wb.call,nodes:wb.nodes,node:wb.node,size:wb.size,empty:wb.empty,each:wb.each,on:Xy,attr:Ay,attrTween:Fy,style:cb,styleTween:db,text:mb,textTween:_b,remove:Qy,tween:xy,delay:Ry,duration:Vy,ease:Uy,easeVarying:Gy,end:yb,[Symbol.iterator]:wb[Symbol.iterator]};function Tb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Eb={time:null,delay:0,duration:250,ease:Tb};function Db(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ob(e){var t,n;e instanceof xb?(t=e._id,e=e._name):(t=Cb(),(n=Eb).time=ey(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&fy(c,e,t,l,o,n||Db(c,t));return new xb(r,this._parents,e,t)}D_.prototype.interrupt=vy,D_.prototype.transition=Ob;var{abs:kb,max:Ab,min:jb}=Math;[`w`,`e`].map(Mb),[`n`,`s`].map(Mb),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(Mb);function Mb(e){return{type:e}}var Nb=Math.PI,Pb=2*Nb,Fb=1e-6,Ib=Pb-Fb;function Lb(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Rb(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return Lb;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var zb=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?Lb:Rb(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>Fb)if(!(Math.abs(u*s-c*l)>Fb)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Nb-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Fb&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Fb||Math.abs(this._y1-l)>Fb)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Pb+Pb),d>Ib?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Fb&&this._append`A${n},${n},0,${+(d>=Nb)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Bb(){return new zb}Bb.prototype=zb.prototype;function Vb(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Hb(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ub(e){return e=Hb(Math.abs(e)),e?e[1]:NaN}function Wb(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Gb(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Kb=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function qb(e){if(!(t=Kb.exec(e)))throw Error(`invalid format: `+e);var t;return new Jb({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}qb.prototype=Jb.prototype;function Jb(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Jb.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function Yb(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Xb;function Zb(e,t){var n=Hb(e,t);if(!n)return Xb=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Xb=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Hb(e,Math.max(0,t+a-1))[0]}function Qb(e,t){var n=Hb(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var $b={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Vb,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Qb(e*100,t),r:Qb,s:Zb,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function ex(e){return e}var tx=Array.prototype.map,nx=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function rx(e){var t=e.grouping===void 0||e.thousands===void 0?ex:Wb(tx.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?ex:Gb(tx.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=qb(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):$b[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=$b[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Yb(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Xb!==void 0?nx[8+Xb/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Ub(t)/3)))*3,r=10**-n,i=l((e=qb(e),e.type=`f`,e),{suffix:nx[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var ix,ax,ox;sx({thousands:`,`,grouping:[3],currency:[`$`,``]});function sx(e){return ix=rx(e),ax=ix.format,ox=ix.formatPrefix,ix}function cx(e){return Math.max(0,-Ub(Math.abs(e)))}function lx(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ub(t)/3)))*3-Ub(Math.abs(e)))}function ux(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ub(t)-Ub(e))+1}function dx(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function fx(){return this.eachAfter(dx)}function px(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function mx(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function hx(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function gx(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function _x(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function vx(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function yx(e){for(var t=this,n=bx(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function bx(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function xx(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Sx(){return Array.from(this)}function Cx(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function wx(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*Tx(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function Ex(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=kx)):t===void 0&&(t=Ox);for(var n=new Mx(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new Mx(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(jx)}function Dx(){return Ex(this).eachBefore(Ax)}function Ox(e){return e.children}function kx(e){return Array.isArray(e)?e[1]:null}function Ax(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function jx(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Mx(e){this.data=e,this.depth=this.height=0,this.parent=null}Mx.prototype=Ex.prototype={constructor:Mx,count:fx,each:px,eachAfter:hx,eachBefore:mx,find:gx,sum:_x,sort:vx,path:yx,ancestors:xx,descendants:Sx,leaves:Cx,links:wx,copy:Dx,[Symbol.iterator]:Tx};function Nx(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Px(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function Fx(){var e=1,t=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/o,i.eachBefore(a(t,o)),r&&i.eachBefore(Nx),i}function a(e,t){return function(r){r.children&&Px(r,r.x0,e*(r.depth+1)/t,r.x1,e*(r.depth+2)/t);var i=r.x0,a=r.y0,o=r.x1-n,s=r.y1-n;o<i&&(i=o=(i+o)/2),s<a&&(a=s=(a+s)/2),r.x0=i,r.y0=a,r.x1=o,r.y1=s}}return i.round=function(e){return arguments.length?(r=!!e,i):r},i.size=function(n){return arguments.length?(e=+n[0],t=+n[1],i):[e,t]},i.padding=function(e){return arguments.length?(n=+e,i):n},i}function Ix(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Lx(e){return function(){return e}}function Rx(e){return+e}var zx=[0,1];function Bx(e){return e}function Vx(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Lx(isNaN(t)?NaN:.5)}function Hx(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Ux(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=Vx(i,r),a=n(o,a)):(r=Vx(r,i),a=n(a,o)),function(e){return a(r(e))}}function Wx(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=Vx(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=gh(e,t,1,r)-1;return a[n](i[n](t))}}function Gx(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Kx(){var e=zx,t=zx,n=Mv,r,i,a,o=Bx,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==Bx&&(o=Hx(e[0],e[n-1])),s=n>2?Wx:Ux,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Tv))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,Rx),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=Nv,u()},d.clamp=function(e){return arguments.length?(o=e?!0:Bx,u()):o!==Bx},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function qx(){return Kx()(Bx,Bx)}function Jx(e,t,n,r){var i=Ch(e,t,n),a;switch(r=qb(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=lx(i,o))&&(r.precision=a),ox(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=ux(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=cx(i))&&(r.precision=a-(r.type===`%`)*2);break}return ax(r)}function Yx(e){var t=e.domain;return e.ticks=function(e){var n=t();return xh(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Jx(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-- >0;){if(l=Sh(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Xx(){var e=qx();return e.copy=function(){return Gx(e,Xx())},Ix.apply(e,arguments),Yx(e)}function Zx(e){return function(){return e}}var Qx=Math.abs,$x=Math.atan2,eS=Math.cos,tS=Math.max,nS=Math.min,rS=Math.sin,iS=Math.sqrt,aS=Math.PI,oS=aS/2,sS=2*aS;function cS(e){return e>1?0:e<-1?aS:Math.acos(e)}function lS(e){return e>=1?oS:e<=-1?-oS:Math.asin(e)}function uS(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new zb(t)}function dS(e){return e.innerRadius}function fS(e){return e.outerRadius}function pS(e){return e.startAngle}function mS(e){return e.endAngle}function hS(e){return e&&e.padAngle}function gS(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function _S(e,t,n,r,i,a,o){var s=e-n,c=t-r,l=(o?a:-a)/iS(s*s+c*c),u=l*c,d=-l*s,f=e+u,p=t+d,m=n+u,h=r+d,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=v*v+y*y,x=i-a,S=f*h-m*p,C=(y<0?-1:1)*iS(tS(0,x*x*b-S*S)),w=(S*y-v*C)/b,T=(-S*v-y*C)/b,E=(S*y+v*C)/b,D=(-S*v+y*C)/b,O=w-g,k=T-_,A=E-g,j=D-_;return O*O+k*k>A*A+j*j&&(w=E,T=D),{cx:w,cy:T,x01:-u,y01:-d,x11:w*(i/x-1),y11:T*(i/x-1)}}function vS(){var e=dS,t=fS,n=Zx(0),r=null,i=pS,a=mS,o=hS,s=null,c=uS(l);function l(){var l,u,d=+e.apply(this,arguments),f=+t.apply(this,arguments),p=i.apply(this,arguments)-oS,m=a.apply(this,arguments)-oS,h=Qx(m-p),g=m>p;if(s||=l=c(),f<d&&(u=f,f=d,d=u),!(f>1e-12))s.moveTo(0,0);else if(h>sS-1e-12)s.moveTo(f*eS(p),f*rS(p)),s.arc(0,0,f,p,m,!g),d>1e-12&&(s.moveTo(d*eS(m),d*rS(m)),s.arc(0,0,d,m,p,g));else{var _=p,v=m,y=p,b=m,x=h,S=h,C=o.apply(this,arguments)/2,w=C>1e-12&&(r?+r.apply(this,arguments):iS(d*d+f*f)),T=nS(Qx(f-d)/2,+n.apply(this,arguments)),E=T,D=T,O,k;if(w>1e-12){var A=lS(w/d*rS(C)),j=lS(w/f*rS(C));(x-=A*2)>1e-12?(A*=g?1:-1,y+=A,b-=A):(x=0,y=b=(p+m)/2),(S-=j*2)>1e-12?(j*=g?1:-1,_+=j,v-=j):(S=0,_=v=(p+m)/2)}var M=f*eS(_),N=f*rS(_),P=d*eS(b),F=d*rS(b);if(T>1e-12){var I=f*eS(v),L=f*rS(v),R=d*eS(y),z=d*rS(y),B;if(h<aS)if(B=gS(M,N,R,z,I,L,P,F)){var ee=M-B[0],te=N-B[1],ne=I-B[0],V=L-B[1],re=1/rS(cS((ee*ne+te*V)/(iS(ee*ee+te*te)*iS(ne*ne+V*V)))/2),ie=iS(B[0]*B[0]+B[1]*B[1]);E=nS(T,(d-ie)/(re-1)),D=nS(T,(f-ie)/(re+1))}else E=D=0}S>1e-12?D>1e-12?(O=_S(R,z,M,N,f,D,g),k=_S(I,L,P,F,f,D,g),s.moveTo(O.cx+O.x01,O.cy+O.y01),D<T?s.arc(O.cx,O.cy,D,$x(O.y01,O.x01),$x(k.y01,k.x01),!g):(s.arc(O.cx,O.cy,D,$x(O.y01,O.x01),$x(O.y11,O.x11),!g),s.arc(0,0,f,$x(O.cy+O.y11,O.cx+O.x11),$x(k.cy+k.y11,k.cx+k.x11),!g),s.arc(k.cx,k.cy,D,$x(k.y11,k.x11),$x(k.y01,k.x01),!g))):(s.moveTo(M,N),s.arc(0,0,f,_,v,!g)):s.moveTo(M,N),!(d>1e-12)||!(x>1e-12)?s.lineTo(P,F):E>1e-12?(O=_S(P,F,I,L,d,-E,g),k=_S(M,N,R,z,d,-E,g),s.lineTo(O.cx+O.x01,O.cy+O.y01),E<T?s.arc(O.cx,O.cy,E,$x(O.y01,O.x01),$x(k.y01,k.x01),!g):(s.arc(O.cx,O.cy,E,$x(O.y01,O.x01),$x(O.y11,O.x11),!g),s.arc(0,0,d,$x(O.cy+O.y11,O.cx+O.x11),$x(k.cy+k.y11,k.cx+k.x11),g),s.arc(k.cx,k.cy,E,$x(k.y11,k.x11),$x(k.y01,k.x01),!g))):s.arc(0,0,d,b,y,g)}if(s.closePath(),l)return s=null,l+``||null}return l.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-aS/2;return[eS(r)*n,rS(r)*n]},l.innerRadius=function(t){return arguments.length?(e=typeof t==`function`?t:Zx(+t),l):e},l.outerRadius=function(e){return arguments.length?(t=typeof e==`function`?e:Zx(+e),l):t},l.cornerRadius=function(e){return arguments.length?(n=typeof e==`function`?e:Zx(+e),l):n},l.padRadius=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Zx(+e),l):r},l.startAngle=function(e){return arguments.length?(i=typeof e==`function`?e:Zx(+e),l):i},l.endAngle=function(e){return arguments.length?(a=typeof e==`function`?e:Zx(+e),l):a},l.padAngle=function(e){return arguments.length?(o=typeof e==`function`?e:Zx(+e),l):o},l.context=function(e){return arguments.length?(s=e??null,l):s},l}function yS(e,t,n){this.k=e,this.x=t,this.y=n}yS.prototype={constructor:yS,scale:function(e){return e===1?this:new yS(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new yS(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var bS=new yS(1,0,0);xS.prototype=yS.prototype;function xS(e){for(;!e.__zoom;)if(!(e=e.parentNode))return bS;return e.__zoom}function SS(e,t=15){let n=e.split(` `),r=[],i=[],a=0;return n.forEach(e=>{a+e.length>t?(i.length&&r.push(i.join(` `)),i=[e],a=e.length):(i.push(e),a+=e.length+ +(i.length>0))}),i.length&&r.push(i.join(` `)),r}var{WILDCARD:CS,QUALIFIER:wS,LUCKY_LOSER:TS}=t.entryStatusConstants,ES=`text-anchor`,DS=`dominant-baseline`,OS=`fill-opacity`,kS=Object.assign({},...t.fixtures.countries.filter(e=>e.ioc).map(e=>({[e.ioc]:e.iso2})),...t.fixtures.countries.filter(e=>e.iso).map(e=>({[e.iso]:e.iso2})));function AS(e){let t=Math.floor(e.length/2),n=e.slice(0,t),r=e.slice(t).reverse();return[...n,...r]}function jS(e){if(e)switch(e){case CS:return`WC`;case wS:return`Q`;case TS:return`LL`;default:return e}}function MS(e,t){let n=[];for(let r of e)for(let e of r.sides){let i=r.matchUpStatus===`BYE`&&!e.participantName;n.push({name:e.participantName||(i?`BYE`:``),participantName:e.participantName||(i?`BYE`:void 0),drawPosition:e.drawPosition,seedNumber:e.seedNumber,entryStatus:jS(e.entryStatus),nationalityCode:e.nationalityCode,matchUp:r,depth:t,value:1})}return n}function NS(e,t){let n=e.winningSide!==void 0&&e.winningSide!==null?e.sides.find(t=>t.sideNumber===e.winningSide):void 0;!n&&e.matchUpStatus===`BYE`&&(n=e.sides.find(e=>e.participantName));let r=n?.participantName,i=r?t.get(r):void 0;return{winnerName:r,winnerSide:n,winnerLookup:i}}function PS(e,t,n,r){return e.map((e,i)=>{let a=i*2,o=[t[a],t[a+1]].filter(Boolean),{winnerName:s,winnerSide:c,winnerLookup:l}=NS(e,r);return{name:s||``,participantName:s,drawPosition:l?.drawPosition??c?.drawPosition,seedNumber:c?.seedNumber??l?.seedNumber,entryStatus:jS(c?.entryStatus)??l?.entryStatus,nationalityCode:c?.nationalityCode??l?.nationalityCode,scoreString:e.scoreString,matchUpStatus:e.matchUpStatus,matchUp:e,depth:n,children:o.length>0?o:void 0}})}function FS(e){let{roundMatchUps:t}=e,n=Object.keys(t).map(Number).sort((e,t)=>e-t);if(n.length===0)throw Error(`No round data found in draw`);let r=t[n[0]],i=AS(MS(r,n.length)),a=new Map;for(let e of i)e.participantName&&e.participantName!==`BYE`&&a.set(e.participantName,e);let o=PS(AS(r),i,n.length-1,a);for(let e=1;e<n.length;e++)o=PS(AS(t[n[e]]),o,n.length-1-e,a);return o.length===1?o[0]:{name:`Tournament`,depth:0,children:o}}function IS(e,t){if(!e)return;let{seedNumber:n,entryStatus:r,drawPosition:i,participantName:a}=e,o;if(a?.trim().toUpperCase()===`BYE`)o=`#B0BEC5`;else if(n){let e=Number(n),t=Xx().domain([1,32]).range([`0`,`1`]);o=Xx().domain(wh(0,1,1/7)).range([`#81D4FA`,`#42A5F5`,`#1E88E5`,`#1565C0`,`#5C6BC0`,`#673AB7`,`#9C27B0`])(Number(t(e)))}else if(r?.toUpperCase()===`WC`)o=`red`;else if(r&&(r===`Q`||r===`LL`))o=Xx().domain(wh(0,1,1/3)).range([`#FFF176`,`#FBC02D`,`#FF9800`])(t(i));else{let e=[`#C8E6C9`,`#81C784`,`#66BB6A`,`#4CAF50`,`#43A047`,`#388E3C`,`#2E7D32`,`#1B5E20`,`#A5D6A7`,`#90CAF9`,`#64B5F6`,`#42A5F5`,`#2196F3`,`#1E88E5`,`#1976D2`,`#1565C0`];o=Xx().domain(wh(0,1,1/e.length)).range(e)(t(i))}e.color=o,e.children&&e.children.forEach(n=>{n.participantName===e.participantName&&(n.color=o),IS(n,t)})}function LS(e,t){let n=[];return e.seedNumber?n.push(`Seed ${e.seedNumber}`):e.entryStatus&&n.push(e.entryStatus),t===7&&e.drawPosition&&n.push(`Draw ${e.drawPosition}`),n.length>0?n.join(` • `):void 0}function RS(e,t){let n=e.find(e=>e.data.participantName&&e.data.participantName!==t);return n?.data.participantName?n.data:void 0}function zS(e,t){let n=[e.participantName],r;if(t.children&&t.children.length>0)e.scoreString&&n.push(e.scoreString),r=RS(t.children,e.participantName),r&&n.push(r.participantName);else{let r=LS(e,t.depth);r&&n.push(r)}return{messageLines:n,opponentData:r}}function BS(e,t){return-(e*t/2)+t/2}function VS(e,t,n){let r=k_(e).append(`svg`).attr(`width`,t).attr(`height`,n).style(`display`,`block`),i=r.append(`g`).attr(`transform`,`translate(${t/2}, ${n/2})`);return{svg:r,g:i,flagsGroup:i.append(`g`).attr(`class`,`flags-group`),winningFlagsGroup:i.append(`g`).attr(`class`,`winning-flags-group`),losingFlagsGroup:i.append(`g`).attr(`class`,`losing-flags-group`)}}function HS(e,t,n,r,i){let a=e.append(`text`).attr(`x`,t/2).attr(`y`,n/2).attr(ES,`middle`).attr(DS,`middle`).attr(`font-size`,`${r}px`).attr(`font-weight`,`bold`).style(`fill`,`var(--chc-text-primary, #333)`).attr(`pointer-events`,`none`),o=r+i*.5;return{centerText:a,centerText2:e.append(`text`).attr(`x`,t/2).attr(`y`,n/2+o).attr(ES,`middle`).attr(DS,`middle`).attr(`font-size`,`${i}px`).style(`fill`,`var(--chc-text-secondary, #666)`).attr(`pointer-events`,`none`)}}function US(e,t,n,r,i,a,o){n&&(i?(t.flagsGroup.selectAll(`text`).remove(),t.winningFlagsGroup.selectAll(`text`).remove(),t.losingFlagsGroup.selectAll(`text`).remove()):e.selectAll(`text`).remove(),e.append(`text`).attr(`font-size`,`${o}px`).attr(ES,`middle`).attr(DS,`middle`).attr(`transform`,`translate(0, ${r*a})`).text(qS(n)))}function WS(e,n,r,i={}){let a=i.width||800,o=i.height||800,s=Math.min(a,o)/800*(i.textScaleFactor??1),c=28*s,l=24*s,u=30*s,d=r||i.title||`Tournament`,f=Object.assign({},...t.fixtures.countries.filter(e=>e.label).map(e=>({[e.ioc]:e.label}))),p=FS(n),m=Ex(p,e=>e.children).sum(e=>e.value||0),h=Math.min(a,o)/2,g=h/2,_=e=>e*h/200;Fx().size([2*Math.PI,h-g])(m),IS(p,Xx().domain([0,n.drawSize||128]).range([0,1]));let v=m.descendants(),y=vS().startAngle(e=>e.x0).endAngle(e=>e.x1).innerRadius(e=>e.y0+g).outerRadius(e=>e.y1+g),{svg:b,g:x,flagsGroup:S,winningFlagsGroup:C,losingFlagsGroup:w}=VS(e,a,o),T=new Set,E=e=>{e.nationalityCode&&T.add(e.nationalityCode),e.children&&e.children.forEach(E)};E(p);let D=Array.from(T),{centerText:O,centerText2:k}=HS(b,a,o,c,l);function A(){let e=SS(d,15);O.text(``),O.selectAll(`tspan`).remove(),k.text(``),k.selectAll(`tspan`).remove(),O.selectAll(`tspan`).data(e).join(`tspan`).attr(`x`,a/2).attr(`dy`,(e,t)=>t===0?0:u).text(e=>e);let t=-(e.length*u/2)+u/2;O.attr(`y`,o/2+t),O.style(`display`,`block`),k.style(`display`,`none`)}function j(){if(S.selectAll(`text`).remove(),C.selectAll(`text`).remove(),w.selectAll(`text`).remove(),D.length===0)return;let e=Xx().domain([0,D.length]).range([0,Math.PI*2]),t=_(20),n=g-t+10;S.selectAll(`text`).data(D).join(`text`).attr(`font-size`,`${t}px`).attr(ES,`middle`).attr(DS,`middle`).attr(`transform`,(t,r)=>{let i=e(r);return`translate(${Math.cos(i)*n}, ${Math.sin(i)*n})`}).text(e=>qS(e)).style(`cursor`,`pointer`).on(`mouseover`,function(e,t){let n=f[t]||t;O.selectAll(`tspan`).remove(),O.attr(`y`,o/2),O.text(n).style(`display`,`block`),k.selectAll(`tspan`).remove(),k.text(``).style(`display`,`none`),N||x.selectAll(`path`).attr(OS,e=>e.data.nationalityCode===t?.9:.3)}).on(`mouseout`,function(){N||x.selectAll(`path`).attr(OS,.8),A()})}j(),A();let M=i.eventHandlers?.clickCenter;M&&x.insert(`circle`,`:first-child`).attr(`r`,g).attr(`fill`,`transparent`).style(`cursor`,`pointer`).on(`click`,M);let N=!1,P;function F(e,t){let n=t.data;if(n.participantName){let{messageLines:e,opponentData:r}=zS(n,t);r&&(n.opponent=r),O.selectAll(`tspan`).remove(),O.text(``),O.selectAll(`tspan`).data(e).join(`tspan`).attr(`x`,a/2).attr(`dy`,(e,t)=>t===0?0:u).text(e=>e);let i=BS(e.length,u);O.attr(`y`,o/2+i),O.style(`display`,`block`),k.style(`display`,`none`)}N?n.participantName?.toLowerCase()!==P?.toLowerCase()&&k_(e.currentTarget).attr(OS,.9):x.selectAll(`path`).attr(OS,e=>e.data.participantName===t.data.participantName?.9:.3);let r=_(30),i=g-r-10,s={flagsGroup:S,winningFlagsGroup:C,losingFlagsGroup:w};US(C,s,n.nationalityCode,-1,!0,i,r),n.opponent&&US(w,s,n.opponent.nationalityCode,1,!1,i,r)}function I(e,t){if(N){let n=t.data.participantName?.toLowerCase()===P?.toLowerCase();k_(e.currentTarget).attr(OS,n?1:.2)}else x.selectAll(`path`).attr(OS,.8);j(),A()}let L=i.eventHandlers?.clickSegment;function R(e,t){if(!L)return;let n=t.data;L({participantName:n.participantName,drawPosition:n.drawPosition,seedNumber:n.seedNumber,entryStatus:n.entryStatus,nationalityCode:n.nationalityCode,scoreString:n.scoreString,matchUpStatus:n.matchUpStatus,roundName:n.roundName,depth:n.depth,matchUp:n.matchUp})}let z=x.selectAll(`path`).data(v).join(`path`).attr(`d`,e=>y(e)).attr(`fill`,e=>e.data.color||`#ccc`).attr(OS,.8).attr(`stroke`,`#fff`).attr(`stroke-width`,1).on(`mouseover`,F).on(`mouseout`,I);L&&z.style(`cursor`,`pointer`).on(`click`,R),z.append(`title`).text(e=>{let t=e.data;return t.participantName?`${t.participantName}\nDraw: ${t.drawPosition||`N/A`}`:`${t.name}\nDepth: ${e.depth}`});function B(e){let t=0;return N=!!e,P=e,x.selectAll(`path`).attr(OS,n=>e?n.data.participantName?.toLowerCase()===e.toLowerCase()?(t+=1,1):.2:.8),t}function ee(e){b.style(`display`,e?`none`:`block`)}return{highlightPlayer:B,hide:ee}}function GS(e={}){return{render:(t,n,r)=>WS(t,n,r,e)}}function KS(e){return e?.length===2?e&&String.fromCodePoint!==void 0?e.toUpperCase().replaceAll(/./g,e=>String.fromCodePoint((e.codePointAt(0)??0)+127397)):e:``}function qS(e){return KS(kS[e]||e)}var{LUCKY_LOSER:JS,WILDCARD:YS,QUALIFIER:XS}=t.entryStatusConstants;function ZS(e){let t={};for(let[n,r]of Object.entries(e.roundMatchUps))t[Number(n)]=r.map(e=>({...e,winningSide:e.winningSide,drawPositions:e.drawPositions||[],scoreString:e.winningSide===1?e.score?.scoreStringSide1:e.winningSide===2?e.score?.scoreStringSide2:void 0,sides:(e.sides||[]).map(e=>({sideNumber:e.sideNumber,drawPosition:e.drawPosition,participantName:e.participant?.participantName,nationalityCode:e.participant?.person?.nationalityCode,seedNumber:e.seedNumber,entryStatus:e.participant?.entryStatus}))}));return{drawSize:(t[1]?.length||0)*2,roundMatchUps:t,seedAssignments:e.seedAssignments}}var QS={LL:JS,WC:YS,Q:XS},$S=[`R128`,`R64`,`R32`,`R16`,`QF`,`SF`,`F`];function eC(e){let t=tC(e);if(t.length===0)return{drawSize:0,roundMatchUps:{}};let n=t[0].data,r=n.length,i=nC(n),a=rC(t,e),o={};o[1]=aC(n,a,t);for(let e=1;e<t.length;e++)o[e+1]=oC(e,t,a,i);return{drawSize:r,roundMatchUps:o}}function tC(e){let t=[],n=!1;for(let r of $S){let i=e[r];i&&i.length>0&&(n=!0),n&&i&&i.length>0&&t.push({key:r,data:i})}return t}function nC(e){let t=new Map;return e.forEach((e,n)=>{let r=sC(e.player);r&&r!==`BYE`&&t.set(r,{drawPosition:e.Draw??n+1,country:e.country,seed:e.seed,entry:e.entry})}),t}function rC(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=r+1<e.length?e[r+1].data:t.W||[],a=new Set;for(let e of i){let t=sC(e.player);t&&a.add(t)}n.set(e[r].key,a)}return n}function iC(e,t,n){if(e===`BYE`||t===`BYE`)return e===`BYE`?2:1;if(n.has(e))return 1;if(n.has(t))return 2}function aC(e,t,n){let r=[],i=t.get(n[0].key)||new Set;for(let t=0;t<e.length;t+=2){let a=e[t],o=e[t+1],s=sC(a?.player),c=sC(o?.player),l=s===`BYE`||c===`BYE`,u=iC(s,c,i),d;if(!l&&n.length>1){let e=n[1].data,t=u===1?s:c;d=e.find(e=>sC(e.player)===t)?.score}let f=l?`BYE`:u?`COMPLETED`:`TO_BE_PLAYED`;r.push({roundNumber:1,matchUpStatus:f,winningSide:u,drawPositions:[a?.Draw??t+1,o?.Draw??t+2],scoreString:d,sides:[lC(1,a,t+1),lC(2,o,t+2)]})}return r}function oC(e,t,n,r){let i=e+1,a=t[e].data,o=n.get(t[e].key)||new Set,s=[];for(let e=0;e<a.length;e+=2){let t=a[e],n=a[e+1],c=sC(t?.player),l=sC(n?.player),u=o.has(c)?1:o.has(l)?2:void 0,d=(u===1?t:u===2?n:void 0)?.score,f=u?`COMPLETED`:`TO_BE_PLAYED`;s.push({roundNumber:i,matchUpStatus:f,winningSide:u,drawPositions:[r.get(c)?.drawPosition??0,r.get(l)?.drawPosition??0],scoreString:d,sides:[uC(1,t,r),uC(2,n,r)]})}return s}function sC(e){if(!e)return``;let t=e.trim();return t.toUpperCase()===`BYE`?`BYE`:t}function cC(e){if(e)return QS[e.toUpperCase()]||e}function lC(e,t,n){if(!t)return{sideNumber:e,drawPosition:n};let r=sC(t.player);return{sideNumber:e,drawPosition:t.Draw??n,participantName:r||void 0,nationalityCode:t.country||void 0,seedNumber:t.seed?Number(t.seed):void 0,entryStatus:cC(t.entry)}}function uC(e,t,n){if(!t)return{sideNumber:e,drawPosition:0};let r=sC(t.player),i=n.get(r);return{sideNumber:e,drawPosition:i?.drawPosition??0,participantName:r||void 0,nationalityCode:t.country||i?.country||void 0,seedNumber:t.seed?Number(t.seed):i?.seed?Number(i.seed):void 0,entryStatus:cC(t.entry||i?.entry)}}var dC=`right`,fC=`font-medium`;function pC({target:e,button:t,stateChange:n}){let r=0,i=()=>(r+=1,`Item${r}`),a=document.createElement(`div`);t.class&&a.classList.add(t.class),a.classList.add(`dropdown`),t.id&&(a.id=t.id),t.align===dC&&a.classList.add(`is-right`);let o=e=>e.classList.contains(`is-active`),s=()=>{o(a)&&a.classList.remove(`is-active`)},c=e=>o(e)?(e.classList.remove(`is-active`),!1):(e.classList.add(`is-active`),!0);a.onmouseleave=s,a.onclick=()=>c(a);let l=document.createElement(`div`);l.classList.add(`dropdown-trigger`);let u=document.createElement(`button`);u.className=`button font-medium`,t.intent&&u.classList.add(t.intent),u.setAttribute(`aria-haspopup`,`true`);let d=document.createElement(`span`);B(t.onClick)&&(d.onclick=t.onClick),d.style.cssText=`margin-right: 1em`,d.innerHTML=t.label,u.appendChild(d);let f=document.createElement(`span`);B(t.onClick)&&(f.onclick=t.onClick),f.innerHTML=`
215
215
  <span class="icon is-small font-medium">
216
216
  <i class="fas fa-angle-down font-medium" aria-hidden="true"></i>
217
217
  </span>
@@ -220,14 +220,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
220
220
  <div id='${s}'></div>
221
221
  <div id='${c}'></div>
222
222
  </div>
223
- `;F.open({title:t,content:p,buttons:d,onClose:f});let m=e=>{e?.[0]?.onClick&&(e[0].onClick(),F.close())};if(a){let e=a({anchorId:c,data:r,selectionLimit:i,onSelected:m});l=e.table,u=e.destroy;let t=o?o(l):()=>{},d=[{onKeyDown:e=>e.keyCode===8&&e.target.value.length===1&&t(``),onChange:e=>t(e.target.value),onKeyUp:e=>t(e.target.value),clearSearch:()=>t(``),placeholder:n||`Search`,location:mC,search:!0}],f=document.getElementById(s)||void 0;IC({table:l,target:f,items:d})}else{let e=document.getElementById(c);if(e){gC({container:e,options:r,onSelected:m});let t=t=>{let n=e.querySelectorAll(`[data-select-item]`),r=t.toLowerCase();n.forEach(e=>{let n=e.textContent?.toLowerCase()||``;e.style.display=!t||n.includes(r)?``:`none`})},i=[{onKeyUp:e=>t(e.target.value),clearSearch:()=>t(``),placeholder:n||`Search`,location:mC,search:!0}];IC({target:document.getElementById(s)||void 0,items:i})}}}function gC({container:e,options:t,onSelected:n}){let r=document.createElement(`div`);r.style.cssText=`max-height: 380px; overflow-y: auto; padding: 0.5em 0;`;for(let e of t){let t=document.createElement(`a`);t.setAttribute(`data-select-item`,``),t.className=`panel-block font-medium`,t.style.cssText=`cursor: pointer; padding: 0.5em 1em; display: block; text-decoration: none; color: inherit;`,t.innerHTML=e.label,t.onmouseenter=()=>t.style.backgroundColor=`#f5f5f5`,t.onmouseleave=()=>t.style.backgroundColor=``,t.onclick=t=>{t.stopPropagation(),n([e])},r.appendChild(t)}e.appendChild(r)}var _C=`none`;function vC(e){let t=document.createElement(`button`);return t.className=`button font-medium`,e.disabled&&(t.disabled=!0),e.class&&t.classList.add(e.class),e.id&&(t.id=e.id),e.intent&&t.classList.add(e.intent),e.toolTip?.content&&mm(t,e.toolTip),t.innerHTML=e.label,e.visible===!1&&(t.style.display=_C),t}var yC=`center`,bC=``,xC=`flex`,SC=`left`,CC=`none`,wC=`overlay`,TC=`right`,EC=({target:e})=>(t=[])=>{e.style.backgroundColor=t?.length?`var(--chc-hover-bg)`:bC;let n=(n,r,i)=>{let a=e.getElementsByClassName(`options_${n}`)[0];a&&(a.style.display=t?.length?r:i)};n(wC,xC,CC),n(SC,CC,xC),n(yC,CC,xC),n(TC,CC,xC)},DC=`center`,OC=`header`,kC=``,AC=`left`,jC=`none`,MC=`overlay`,NC=`right`,PC=`buttonBar`,FC=`top`;function IC(e){let{table:t,targetClassName:n,items:r=[],onSelection:i,selectItemFn:a}=e,{target:o}=e,s=!!o;if(!o&&n&&(o=document.getElementsByClassName(n)?.[0]),!o)return{elements:{},inputs:{}};let c=0,l=0,u={},d={},f;if(s){P(o);let e=WC();Object.assign(u,e.elements),o.appendChild(e.anchor)}let p=Object.assign({},...[MC,AC,DC,NC,OC].map(e=>{let t=o.getElementsByClassName(`options_${e}`)?.[0];return P(t),{[e]:t}}).filter(Boolean)),m=EC({table:t,target:o}),h=(e,n)=>{B(n.onClick)&&(e.stopPropagation(),n.disabled||n.onClick(e,t),n.stateChange&&m())},g={onClick:()=>{},location:NC};for(let e of r){let t={...g};ee(e)&&Object.assign(t,e);let n=p[t.location];if(!n){console.log(t.location,p);continue}t.location===MC&&(c+=1),t.location===OC&&(LC(t,o),l+=1);let r=RC(e,t,n,m,h,a,u,d);r?.focus&&(f=r.focus)}let _=o.getElementsByClassName(`panelHeader`)[0];_&&(_.style.display=l?kC:jC),t?._controlBarSelectionHandler&&t.off(`rowSelectionChanged`,t._controlBarSelectionHandler);let v=(e,t)=>{B(i)&&i(t),c&&m(t)};return t&&(t._controlBarSelectionHandler=v),t?.on(`rowSelectionChanged`,v),m(t?.getSelectedRows?.()??[]),f&&setTimeout(()=>f.focus(),200),{elements:u,inputs:d}}function LC(e,t){if(B(e.headerClick)){let n=t.getElementsByClassName(`panelHeader`)[0];n&&(n.onclick=e.headerClick)}}function RC(e,t,n,r,i,a,o,s){if(!t.hide&&(t.input||t.placeholder||t.search)){let r=zC(e,t);return t.id&&(s[t.id]=r.input),t.id&&(o[t.id]=r.elem,r.elem.id=t.id),n?.appendChild(r.elem),t.focus?{focus:r.input}:void 0}if(!t.hide&&t.text){let e=document.createElement(`div`);e.className=`font-medium`,t.id&&(o[t.id]=e,e.id=t.id),e.innerHTML=t.text,e.onclick=e=>i(e,t),n?.appendChild(e);return}!t.id&&(!t?.label||t.hide)||(VC(t,n,r,i,a,o),(!(t?.label||t.tabs)||t.hide)&&o[t.id]&&(o[t.id].style.display=jC))}function zC(e,t){let n=document.createElement(`p`);n.className=`control ${t.search?`has-icons-left has-icons-right`:``}`;let r=document.createElement(`input`);if(r.className=`input font-medium`,r.setAttribute(`type`,`text`),r.setAttribute(`autocomplete`,`off`),r.setAttribute(`placeholder`,e.placeholder||kC),t.id&&r.setAttribute(`id`,t.id),t.onKeyDown&&r.addEventListener(`keydown`,e=>t.onKeyDown(e,t)),t.onChange&&r.addEventListener(`change`,e=>t.onChange(e,t)),t.onKeyUp&&r.addEventListener(`keyup`,e=>{t.clearSearch&&e.key===`Escape`&&(e.stopPropagation(),r.value=``,t.clearSearch()),t.onKeyUp(e,t)}),t.class&&r.classList.add(t.class),t.visible===!1&&(n.style.display=jC),t.value&&(r.value=t.value),n.appendChild(r),t.search&&BC(n,r,t),e.validator){let t=document.createElement(`p`);t.className=`help font-medium`,n.appendChild(t),r.addEventListener(`input`,n=>an(e,n,r,t,e.validator))}return{elem:n,input:r}}function BC(e,t,n){let r=document.createElement(`span`);if(r.className=`icon is-small is-left font-medium`,r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16" fill="currentColor"><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>`,e.appendChild(r),B(n.clearSearch)){let r=document.createElement(`span`);r.className=`icon is-small is-right font-medium`,r.style.pointerEvents=`all`,r.style.cursor=`pointer`,r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16" fill="#dddada"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>`,r.onclick=e=>{e.stopPropagation(),t.value=``,n.clearSearch()},e.appendChild(r)}}function VC(e,t,n,r,i,a){if(e.options){let r=pC({target:t,button:e,stateChange:n});e.visible===!1&&(r.style.display=jC),e.id&&(a[e.id]=r)}else if(ee(e.selection))HC(e,t,n,i,a);else if(e.tabs)UC(e,t,a);else{let n=vC(e);n.onclick=t=>r(t,e),e.id&&(a[e.id]=n),t?.appendChild(n)}}function HC(e,t,n,r,i){let{selection:{options:a,actions:o},actionPlacement:s,threshold:c=8,...l}=e;if(a?.length<c){a.length&&(s===FC?a.unshift({divider:!0}):a.push({divider:!0})),o.forEach(e=>{let{label:t,...n}=e,r={...n,label:`<p style="font-weight: bold">${t}</p>`};s===FC?a.unshift(r):a.push(r)});let r={...l,options:a},c=pC({target:t,button:r,stateChange:n});r.visible===!1&&(c.style.display=jC),r.id&&(i[e.id]=c)}else{let n=vC(e),o=r||hC;n.onclick=t=>{t.stopPropagation(),o({title:e.selectionTitle||`Select`,options:a})},e.id&&(i[e.id]=n),t?.appendChild(n)}}function UC(e,t,n){let r=document.createElement(`div`);r.className=`tabs is-toggle is-toggle-rounded`;let i=document.createElement(`ul`);r.appendChild(i),e.tabs.forEach(t=>{let n=document.createElement(`li`);t.active&&n.classList.add(`is-active`);let r=document.createElement(`a`);n.appendChild(r),r.onclick=r=>{i.querySelectorAll(`li`).forEach(e=>e.classList.remove(`is-active`)),n.classList.add(`is-active`),B(t.onClick)&&t.onClick(r,e)};let a=document.createElement(`span`);a.innerHTML=t.label,r.appendChild(a),i.appendChild(n)}),e.id&&(n[e.id]=r),t.appendChild(r)}function WC(){let e=document.createElement(`div`);e.className=`panel_container flexcol flexcenter`;let t=document.createElement(`div`);t.className=`panelHeader options_header`,t.style.display=jC,e.appendChild(t);let n=document.createElement(`div`);n.className=PC;let r={optionsOverlay:document.createElement(`div`),optionsLeft:document.createElement(`div`),optionsCenter:document.createElement(`div`),optionsRight:document.createElement(`div`)};r.optionsOverlay.className=`options_overlay`,r.optionsCenter.className=`options_center`,r.optionsRight.className=`options_right`,r.optionsLeft.className=`options_left`;for(let e of Object.values(r))n.appendChild(e);return e.appendChild(n),{elements:r,anchor:e,header:t}}var GC=()=>`sp-layout`,KC=()=>`sp-column`,qC=()=>`sp-panel`,JC=()=>`sp-panel-header`,YC=()=>`sp-panel-title`,XC=()=>`sp-panel-meta`,ZC=()=>`sp-date-strip`,QC=()=>`sp-date-chip`,$C=()=>`sp-badges`,ew=()=>`sp-badge`,tw=()=>`sp-chips`,nw=()=>`sp-chip`,rw=()=>`sp-board`,iw=()=>`sp-venue`,aw=()=>`sp-venue-header`,ow=()=>`sp-venue-title`,sw=()=>`sp-venue-sub`,cw=()=>`sp-dropzone`,lw=()=>`sp-card`,uw=()=>`sp-card-title`,dw=()=>`sp-card-meta`,fw=()=>`sp-issues`,pw=()=>`sp-issue`,mw=()=>`sp-issue-code`,hw=()=>`sp-issue-msg`,gw=()=>`sp-issue-actions`,_w=()=>`sp-btn sp-btn--sm`,vw=()=>`sp-catalog`,yw=()=>`sp-catalog-toolbar`,bw=()=>`sp-input`,xw=()=>`sp-select`,Sw=()=>`sp-group`,Cw=()=>`sp-group-header`,ww=()=>`sp-group-body`,Tw=()=>`sp-catalog-item`,Ew=()=>`sp-inspector`,Dw=()=>`sp-kv`,Ow=()=>`sp-kv-key`,kw=()=>`sp-kv-value`,Aw=()=>`sp-small`,jw=()=>`sp-popover-item`,Mw=()=>`sp-popover-delete`,Nw=()=>`sp-popover-divider`,Pw=()=>`sp-insertion-line`,Fw=()=>`sp-group-chevron`;function Iw(e,t){let n=!!t?.hideLeft,r=t?.catalogSide===`left`,i=document.createElement(`div`);if(i.className=GC(),n)r?i.classList.add(`sp-catalog-left`):i.classList.add(`sp-no-left`);else{let t=document.createElement(`div`);t.className=KC(),t.appendChild(e.dateStrip.element),e.issuesPanel.element.style.flex=`1`,e.issuesPanel.element.style.minHeight=`0`,t.appendChild(e.issuesPanel.element),i.appendChild(t)}let a=document.createElement(`div`);a.className=KC(),e.venueBoard.element.style.flex=`1`,e.venueBoard.element.style.minHeight=`0`,a.appendChild(e.venueBoard.element);let o=document.createElement(`div`);o.className=KC(),e.roundCatalog.element.style.flex=`1`,e.roundCatalog.element.style.minHeight=`0`,o.appendChild(e.roundCatalog.element),o.appendChild(e.inspectorPanel.element),r&&n?(i.appendChild(o),i.appendChild(a)):(i.appendChild(a),i.appendChild(o));function s(t){n||(e.dateStrip.update(t),e.issuesPanel.update(t)),e.venueBoard.update(t),e.roundCatalog.update(t),e.inspectorPanel.update(t)}return{element:i,update:s}}function Lw(e){let t=null,n=null;function r(e){return`${e.date}|${e.venueId}|${e.index}`}function i(){t&&(t.destroy(),t=null,n=null)}function a(t){let n=document.createElement(`div`);n.style.cssText=`font-family:sans-serif; font-size:13px; min-width:150px;`;let r=document.createElement(`div`);r.className=jw(),r.textContent=`Set Not Before Time`,r.addEventListener(`click`,()=>{i(),e.onSetNotBeforeTime(t)}),n.appendChild(r);let a=document.createElement(`div`);a.className=Nw(),n.appendChild(a);let o=document.createElement(`div`);return o.className=Mw(),o.textContent=`Remove Round`,o.addEventListener(`click`,()=>{i(),e.onDelete(t)}),n.appendChild(o),n}return{show(e,o){let s=r(o);if(n===s){i();return}i();let c=mm(e,{content:a(o),allowHTML:!0,interactive:!0,trigger:`manual`,placement:`bottom`,appendTo:document.body,onHidden:()=>{t=null,n=null}});t=c,n=s,c.show()},destroy(){i()},isActiveFor(e){return n===r(e)}}}function Rw(e){return structuredClone(e)}function zw(e,t,n){return Math.max(t,Math.min(n,e))}function Bw(e){return`${e.tournamentId}|${e.eventId}|${e.drawId}|${e.structureId}|${e.roundNumber}`}function Vw(e){return`${e.eventName?`${e.eventName} \u2013 `:``}${e.roundName??`Round ${e.roundNumber}`}${e.roundSegment?` (seg ${e.roundSegment.segmentNumber}/${e.roundSegment.segmentsCount})`:``}`}function Hw(e,t){return!e||!t?!1:e.date===t.date&&e.venueId===t.venueId&&e.index===t.index}function Uw(e){return{tournamentId:e.tournamentId,eventId:e.eventId,drawId:e.drawId,structureId:e.structureId,roundNumber:e.roundNumber}}function Ww(e,t,n){return e.find(e=>e.scheduleDate===t)?.venues?.find(e=>e.venueId===n)?.rounds??[]}function Gw(e,t){return(e.find(e=>e.scheduleDate===t.date)?.venues?.find(e=>e.venueId===t.venueId))?.rounds?.[t.index]??null}function Kw(e,t){return e.filter(e=>qw(e.context?.locator,t)||qw(e.context?.prerequisite,t))}function qw(e,t){return!!e&&e.date===t.date&&e.venueId===t.venueId&&e.index===t.index}function Jw(e){return e.length?e.some(e=>e.severity===`ERROR`)?`ERROR`:e.some(e=>e.severity===`WARN`)?`WARN`:`INFO`:null}function Yw(e,t){let n=Bw(t);for(let t of e)for(let e of t.venues)for(let r=0;r<e.rounds.length;r++){let i=e.rounds[r];if(Bw(Uw(i))===n)return{date:t.scheduleDate,venueId:e.venueId,index:r,roundKey:Uw(i),roundSegment:i.roundSegment}}return null}function Xw(){let e=document.createElement(`div`);e.className=qC();let t=document.createElement(`div`);t.className=JC();let n=document.createElement(`div`);n.className=YC(),n.textContent=`Inspector`,t.appendChild(n),e.appendChild(t);let r=document.createElement(`div`);r.className=Ew(),e.appendChild(r);function i(e){r.innerHTML=``;let t=e.selectedLocator;if(!t){let e=document.createElement(`div`);e.className=Aw(),e.textContent=`Select a round card on the board to see details and context.`,r.appendChild(e);return}let n=Gw(e.profileDraft,t);if(!n){let e=document.createElement(`div`);e.className=Aw(),e.textContent=`Selection no longer exists.`,r.appendChild(e);return}let i=Kw(e.ruleResults,t),a=Jw(i);if(Zw(r,`Event`,n.eventName??``),Zw(r,`Draw`,n.drawName||``),Zw(r,`Round`,n.roundName&&!/^rn=/.test(n.roundName)?n.roundName:`Round `+n.roundNumber),Zw(r,`Segment`,n.roundSegment?`${n.roundSegment.segmentNumber}/${n.roundSegment.segmentsCount}`:`—`),Zw(r,`Not before`,n.notBeforeTime??`—`),Zw(r,`Status`,a??`OK`),i.length){let e=document.createElement(`div`);e.className=Aw(),e.style.marginTop=`8px`,e.textContent=`Issues for this item:`,r.appendChild(e);for(let e of i){let t=document.createElement(`div`);t.className=Aw(),t.innerHTML=`\u2022 <b>${Qw(e.code)}</b>: ${Qw(e.message)}`,r.appendChild(t)}}else{let e=document.createElement(`div`);e.className=Aw(),e.style.marginTop=`8px`,e.textContent=`No issues associated with this card.`,r.appendChild(e)}}return{element:e,update:i}}function Zw(e,t,n){let r=document.createElement(`div`);r.className=Dw();let i=document.createElement(`div`);i.className=Ow(),i.textContent=t;let a=document.createElement(`div`);a.className=kw(),a.textContent=n,r.appendChild(i),r.appendChild(a),e.appendChild(r)}function Qw(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function $w(e,t,n,r=`dim`){let i=t.toLowerCase().trim();return e.filter(e=>r===`hide`&&n.has(Bw(e))?!1:i?`${e.eventName} ${e.drawName??``} ${e.roundName??``} ${e.drawId}`.toLowerCase().includes(i):!0).map(e=>({...e,isPlanned:n.has(Bw(e))}))}function eT(e,t){let n=new Map,r=e=>t===`draw`?`${e.eventName} \u2014 ${e.drawName??e.drawId}`:t===`round`?e.roundName??`Round ${e.roundNumber}`:e.eventName;for(let t of e){let e=r(t),i=n.get(e);i?i.push(t):n.set(e,[t])}return new Map([...n.entries()].sort((e,t)=>e[0].localeCompare(t[0],void 0,{numeric:!0})))}function tT(e){let t=new Set;for(let n of e)for(let e of n.venues)for(let n of e.rounds)n.roundSegment||t.add(Bw(n));return t}var nT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rT(e){return nT.test(e)}function iT(e){let t=document.createElement(`div`);t.className=qC(),t.style.overflowY=`auto`,t.style.scrollbarWidth=`thin`,t.style.scrollbarColor=`var(--sp-scrollbar) transparent`;let n=new Set,r=null,i=document.createElement(`div`);i.className=JC();let a=document.createElement(`div`);a.className=YC(),a.textContent=`Round Catalog`;let o=document.createElement(`div`);o.className=XC(),i.appendChild(a),i.appendChild(o),t.appendChild(i);let s=document.createElement(`div`);s.className=yw();let c=document.createElement(`input`);c.type=`text`,c.placeholder=`Search rounds...`,c.className=bw(),c.addEventListener(`input`,()=>e.onSearchChange(c.value));let l=document.createElement(`select`);l.className=xw();for(let[e,t]of[[`event`,`By Event`],[`draw`,`By Draw`],[`round`,`By Round`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,l.appendChild(n)}l.addEventListener(`change`,()=>e.onGroupByChange(l.value)),s.appendChild(c),s.appendChild(l),t.appendChild(s);let u=document.createElement(`div`);u.className=vw(),t.appendChild(u),u.addEventListener(`dragover`,e=>{e.preventDefault(),u.classList.add(`over`),e.dataTransfer.dropEffect=`move`}),u.addEventListener(`dragleave`,e=>{u.contains(e.relatedTarget)||u.classList.remove(`over`)}),u.addEventListener(`drop`,t=>{if(u.classList.remove(`over`),t.preventDefault(),!e.onDropRemove)return;let n;try{n=JSON.parse(t.dataTransfer.getData(`application/json`))}catch{return}n.type===`PLANNED_ROUND`&&e.onDropRemove(n.locator)});function d(t,n){let r=document.createElement(`div`);r.className=Tw(),t.isPlanned?(r.classList.add(n===`navigate`?`navigate`:`dimmed`),r.draggable=!1,n===`navigate`&&r.addEventListener(`click`,()=>{e.onNavigateToPlanned?.(t)})):(r.draggable=!0,r.addEventListener(`dragstart`,e=>{e.stopPropagation(),e.dataTransfer.setDragImage(r,r.offsetWidth/2,20),e.dataTransfer.setData(`application/json`,JSON.stringify({type:`CATALOG_ROUND`,roundRef:t})),e.dataTransfer.effectAllowed=`copyMove`}));let i=document.createElement(`div`);i.className=uw();let a=t.roundName&&!t.roundName.startsWith(`rn=`)?t.roundName:`Round `+t.roundNumber;i.textContent=`${t.eventName} \u2014 ${a}`;let o=document.createElement(`div`);o.className=dw();let s=t.matchCountEstimate?` · `+t.matchCountEstimate+` matches`:``,c=t.drawName&&!rT(t.drawName)?t.drawName:``;if(o.textContent=c?`${c}${s}`:s.replace(` · `,``)||``,r.appendChild(i),r.appendChild(o),t.isPlanned&&n!==`navigate`){let e=document.createElement(`span`);e.className=`sp-catalog-check`,e.textContent=`✓`,r.appendChild(e)}return r}function f(e){r=e;let t=e.plannedRoundBehavior,i=tT(e.profileDraft),a=$w(e.roundCatalog,e.catalogSearchQuery,i,t),s=eT(a,e.catalogGroupBy);o.textContent=`${a.length} rounds`,c.value!==e.catalogSearchQuery&&(c.value=e.catalogSearchQuery),l.value!==e.catalogGroupBy&&(l.value=e.catalogGroupBy),u.innerHTML=``;for(let[e,i]of s){let a=document.createElement(`div`);a.className=Sw();let o=n.has(e),s=document.createElement(`div`);s.className=Cw();let c=document.createElement(`span`);c.className=Fw(),c.textContent=o?`▶`:`▼`;let l=document.createElement(`span`);l.textContent=e,s.appendChild(c),s.appendChild(l),s.addEventListener(`click`,()=>{n.has(e)?n.delete(e):n.add(e),r&&f(r)});let p=document.createElement(`div`);p.className=ww(),o&&(p.style.display=`none`);for(let e of i)p.appendChild(d(e,t));a.appendChild(s),a.appendChild(p),u.appendChild(a)}}return{element:t,update:f}}function aT(e){let t=document.createElement(`div`);t.className=qC();let n=document.createElement(`div`);n.className=JC();let r=document.createElement(`div`);r.className=YC(),r.textContent=`Issues`;let i=document.createElement(`div`);i.className=XC(),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=fw(),t.appendChild(a);function o(t){let n=t.issueIndex.all;if(i.textContent=`${n.length} total (${t.issueIndex.bySeverity.ERROR.length} errors)`,a.innerHTML=``,!n.length){let e=document.createElement(`div`);e.className=Aw(),e.textContent=`No issues. Drag rounds into the board to build a profile.`,a.appendChild(e);return}for(let t of n.slice(0,30)){let n=document.createElement(`div`);n.className=pw(),t.severity===`ERROR`?n.classList.add(`error`):t.severity===`WARN`?n.classList.add(`warn`):n.classList.add(`info`);let r=document.createElement(`div`);r.className=mw(),r.textContent=`${t.severity} \u00b7 ${t.code}`;let i=document.createElement(`div`);if(i.className=hw(),i.textContent=t.message,n.appendChild(r),n.appendChild(i),t.fixActions?.length){let r=document.createElement(`div`);r.className=gw();for(let n of t.fixActions){let t=document.createElement(`button`);t.className=_w(),t.textContent=n.label??n.kind,t.addEventListener(`click`,()=>e.onFixAction(n)),r.appendChild(t)}n.appendChild(r)}a.appendChild(n)}}return{element:t,update:o}}var{ROUND_ROBIN:oT,ROUND_ROBIN_WITH_PLAYOFF:sT}=t.drawDefinitionConstants,cT=`Jump to prerequisite`;function lT({profile:e,temporal:t,dependencies:n,venueOrder:r}){let i=[];if(t?.isDateAvailable)for(let n of e){let e=t.isDateAvailable(n.scheduleDate);e.ok||i.push({code:`DATE_UNAVAILABLE`,severity:`ERROR`,message:`Can't schedule on ${n.scheduleDate} \u2014 day is unavailable${e.reason?`: `+e.reason:``}.`,context:{date:n.scheduleDate},fixActions:[{kind:`OPEN_TEMPORAL_GRID`,date:n.scheduleDate,label:`Open Temporal Grid`}]})}let a=_T(e);for(let e of a){let t=e.round.roundSegment;t&&(Number.isInteger(t.segmentNumber)&&Number.isInteger(t.segmentsCount)&&t.segmentsCount>=2&&t.segmentNumber>=1&&t.segmentNumber<=t.segmentsCount||i.push({code:`INVALID_SEGMENT_CONFIG`,severity:`ERROR`,message:`Invalid segment configuration for ${Vw(e.round)}.`,context:{locator:e.locator,date:e.locator.date,venueId:e.locator.venueId}}))}let o=new Map,s=new Map;for(let e of a){let t=e.round,n=Bw(t);if(!t.roundSegment)o.has(n)?i.push({code:`DUPLICATE_ROUND`,severity:`ERROR`,message:`Round is planned more than once: ${Vw(t)}.`,context:{scope:`${t.drawId}|${t.structureId}`,locator:e.locator,date:e.locator.date,venueId:e.locator.venueId},fixActions:[{kind:`JUMP_TO_ITEM`,locator:o.get(n),label:`Jump to existing`}]}):o.set(n,e.locator);else{let r=`${n}|${t.roundSegment.segmentNumber}/${t.roundSegment.segmentsCount}`;s.has(r)?i.push({code:`DUPLICATE_SEGMENT`,severity:`ERROR`,message:`Segment planned more than once: ${Vw(t)}.`,context:{scope:`${t.drawId}|${t.structureId}`,locator:e.locator,date:e.locator.date,venueId:e.locator.venueId},fixActions:[{kind:`JUMP_TO_ITEM`,locator:s.get(r),label:`Jump to existing`}]}):s.set(r,e.locator)}}return i.push(...dT({profile:e,venueOrder:r})),n?.getRoundDependencies&&i.push(...hT(a,n)),i}var uT=new Set([oT,sT]);function dT({profile:e}){let t=_T(e),n=fT(t),r=pT(t);return yT([...n,...r])}function fT(e){let t=[],n=vT(e,e=>`${e.round.structureId}|${e.locator.date}|${e.locator.venueId}`);for(let[e,r]of n.entries()){let n=r[0]?.round.structureType;if(!(n&&uT.has(n))){r.sort((e,t)=>e.locator.index-t.locator.index);for(let n=0;n<r.length;n++){let i=r[n],a=null;for(let e=n-1;e>=0;e--)if(r[e].round.roundNumber>i.round.roundNumber){a=r[e];break}if(!a)continue;let o=gT(r,n,a);t.push({code:`ROUND_ORDER_VIOLATION`,severity:`ERROR`,message:`Cannot place ${Vw(i.round)} before ${Vw(a.round)} in this venue.`,context:{scope:e,drawId:i.round.drawId,structureId:i.round.structureId,date:i.locator.date,venueId:i.locator.venueId,locator:i.locator,prerequisite:a.locator},fixActions:[{kind:`JUMP_TO_ITEM`,locator:a.locator,label:cT},...o.moveOffenderAfter?[{kind:`MOVE_ITEM_AFTER`,locator:i.locator,after:o.moveOffenderAfter,label:`Move offending round after prerequisite set`}]:[],...o.movePrereqBefore?[{kind:`MOVE_ITEM_BEFORE`,locator:a.locator,before:o.movePrereqBefore,label:`Move prerequisite before offending round`}]:[]]})}}}return t}function pT(e){let t=[],n=vT(e,e=>e.round.structureId);for(let[e,r]of n.entries()){let n=r[0]?.round.structureType;if(n&&uT.has(n))continue;let i=new Map;for(let e of r){let t=e.locator.date,n=i.get(t);n?n.push(e):i.set(t,[e])}let a=[...i.keys()].sort();if(a.length<2)continue;let o=-1/0,s=null;for(let n of a){let r=i.get(n);for(let i of r)i.round.roundNumber<o&&s&&t.push({code:`ROUND_ORDER_VIOLATION`,severity:`ERROR`,message:`${Vw(s.round)} is scheduled on ${s.locator.date} but its prerequisite ${Vw(i.round)} is on the later date ${n}.`,context:{scope:`cross-date|${e}`,drawId:s.round.drawId,structureId:e,date:s.locator.date,venueId:s.locator.venueId,locator:s.locator,prerequisite:i.locator,reason:`cross-date`},fixActions:[{kind:`JUMP_TO_ITEM`,locator:i.locator,label:cT}]});for(let e of r)e.round.roundNumber>o&&(o=e.round.roundNumber,s=e)}}return t}function mT(e,t){if(!(e.round.structureId===t.round.structureId&&e.locator.date===t.locator.date&&e.locator.venueId===t.locator.venueId)){if(e.locator.date<t.locator.date)return{code:`DEPENDENCY_VIOLATION`,severity:`ERROR`,message:`${Vw(e.round)} is scheduled on ${e.locator.date} but depends on ${Vw(t.round)} which is on the later date ${t.locator.date}.`,context:{date:e.locator.date,venueId:e.locator.venueId,locator:e.locator,prerequisite:t.locator,reason:`cross-date`},fixActions:[{kind:`JUMP_TO_ITEM`,locator:t.locator,label:cT}]};if(e.locator.date===t.locator.date&&e.locator.venueId===t.locator.venueId&&e.locator.index<t.locator.index)return{code:`DEPENDENCY_VIOLATION`,severity:`ERROR`,message:`${Vw(e.round)} is listed before its prerequisite ${Vw(t.round)} in the same venue on ${e.locator.date}.`,context:{date:e.locator.date,venueId:e.locator.venueId,locator:e.locator,prerequisite:t.locator,reason:`cross-structure-same-day`},fixActions:[{kind:`JUMP_TO_ITEM`,locator:t.locator,label:cT},{kind:`MOVE_ITEM_AFTER`,locator:e.locator,after:t.locator,label:`Move after prerequisite`},{kind:`MOVE_ITEM_BEFORE`,locator:t.locator,before:e.locator,label:`Move prerequisite before`}]}}}function hT(e,t){let n=[],r=vT(e,e=>Bw(e.round));for(let[e,i]of r.entries()){let a=t.getRoundDependencies(e);if(a.length)for(let e of a){let t=r.get(e);if(t)for(let e of i)for(let r of t){let t=mT(e,r);t&&n.push(t)}}}return yT(n)}function gT(e,t,n){let r=e[t],i=e.indexOf(n);for(let t=i+1;t<e.length;t++)e[t].round.roundNumber>=n.round.roundNumber&&(i=t);return{moveOffenderAfter:e[i].locator,movePrereqBefore:r.locator}}function _T(e){let t=[];for(let n of e)for(let e of n.venues)for(let r=0;r<e.rounds.length;r++){let i=e.rounds[r];t.push({round:i,locator:{date:n.scheduleDate,venueId:e.venueId,index:r,roundKey:Uw(i),roundSegment:i.roundSegment}})}return t}function vT(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i?i.push(r):n.set(e,[r])}return n}function yT(e){let t=new Set,n=[];for(let r of e){let e=r.code+`|`+r.message+`|`+(r.context?.scope??``)+`|`+JSON.stringify(r.context?.locator??{});t.has(e)||(t.add(e),n.push(r))}return n}function bT(e){let t={ERROR:[],WARN:[],INFO:[]},n={},r={},i={},a={total:e.length,ERROR:0,WARN:0,INFO:0,byDate:{},byVenue:{},byDraw:{}},o=e=>e===`ERROR`?0:e===`WARN`?1:2,s=(e,t)=>o(e.severity)-o(t.severity)||e.code.localeCompare(t.code)||e.message.localeCompare(t.message);for(let o of e){t[o.severity].push(o),a[o.severity]++;let e=o.context?.date??o.context?.locator?.date,s=o.context?.venueId??o.context?.locator?.venueId,c=o.context?.scope??(o.context?.drawId&&o.context?.structureId?`${o.context.drawId}|${o.context.structureId}`:void 0);e&&(n[e]??=[]).push(o),s&&(r[s]??=[]).push(o),c&&(i[c]??=[]).push(o),xT(a.byDate,e,o.severity),xT(a.byVenue,s,o.severity),xT(a.byDraw,c,o.severity)}for(let e of Object.keys(t))t[e].sort(s);for(let e of[n,r,i])for(let t of Object.keys(e))e[t].sort(s);return{all:e,bySeverity:t,byDate:n,byVenue:r,byDraw:i,counts:a}}function xT(e,t,n){if(!t)return;let r=e[t]??={total:0,ERROR:0,WARN:0,INFO:0};r.total++,r[n]++}function ST(e,t,n){let r=Rw(e),{date:i,venueId:a}=n,o=wT(CT(r,i),a);if(t.type===`CATALOG_ROUND`){let e={tournamentId:t.roundRef.tournamentId,eventId:t.roundRef.eventId,eventName:t.roundRef.eventName,drawId:t.roundRef.drawId,drawName:t.roundRef.drawName,structureId:t.roundRef.structureId,structureType:t.roundRef.structureType,roundNumber:t.roundRef.roundNumber,roundName:t.roundRef.roundName},i=zw(n.index,0,o.rounds.length);return o.rounds.splice(i,0,e),TT(o.rounds),{ok:!0,profile:r}}if(t.type===`PLANNED_ROUND`){let{locator:e}=t,s=wT(CT(r,e.date),e.venueId),[c]=s.rounds.splice(e.index,1);TT(s.rounds);let l=n.index;return e.date===i&&e.venueId===a&&e.index<l&&--l,l=zw(l,0,o.rounds.length),o.rounds.splice(l,0,c),TT(o.rounds),{ok:!0,profile:r}}return{ok:!1,profile:e}}function CT(e,t){let n=e.find(e=>e.scheduleDate===t);return n||(n={scheduleDate:t,venues:[]},e.push(n),e.sort((e,t)=>e.scheduleDate.localeCompare(t.scheduleDate))),n}function wT(e,t){let n=e.venues.find(e=>e.venueId===t);return n||(n={venueId:t,rounds:[]},e.venues.push(n)),n}function TT(e){for(let t=0;t<e.length;t++)e[t].sortOrder=t+1}var ET=class{constructor(e){this.listeners=new Set,this.config=e,this.state={profileDraft:Rw(e.initialProfile??[]),venues:e.venues,roundCatalog:e.roundCatalog,schedulableDates:e.schedulableDates,activeDates:e.activeDates,selectedDate:e.selectedDate??e.schedulableDates[0]??null,selectedLocator:null,ruleResults:[],issueIndex:{all:[],bySeverity:{ERROR:[],WARN:[],INFO:[]},byDate:{},byVenue:{},byDraw:{},counts:{total:0,ERROR:0,WARN:0,INFO:0,byDate:{},byVenue:{},byDraw:{}}},catalogSearchQuery:``,catalogGroupBy:`event`,plannedRoundBehavior:e.plannedRoundBehavior??`dim`},this.revalidate()}getState(){return this.state}getSchedulingProfile(){return Rw(this.state.profileDraft)}selectDate(e){this.state.selectedDate!==e&&this.setState({selectedDate:e,selectedLocator:null})}selectCard(e){this.setState({selectedLocator:e})}setCatalogSearch(e){this.setState({catalogSearchQuery:e})}setCatalogGroupBy(e){this.setState({catalogGroupBy:e})}navigateToRound(e){let t=Yw(this.state.profileDraft,{tournamentId:e.tournamentId,eventId:e.eventId,drawId:e.drawId,structureId:e.structureId,roundNumber:e.roundNumber});t&&this.setState({selectedDate:t.date,selectedLocator:t})}dropRound(e,t){try{let n=ST(this.state.profileDraft,e,t);if(!n.ok)return{ok:!1,errorMessage:`Invalid drop operation`};let r=new Set(this.state.ruleResults.filter(e=>e.severity===`ERROR`).map(DT)),i=lT({profile:n.profile,temporal:this.config.temporalAdapter,dependencies:this.config.dependencyAdapter,venueOrder:this.config.venueOrder}).filter(e=>e.severity===`ERROR`).filter(e=>!r.has(DT(e)));return i.length?(this.addRejectionNotice(i[0].message),{ok:!1,errorMessage:i[0].message}):(this.commitProfile(n.profile),{ok:!0})}catch(e){return{ok:!1,errorMessage:String(e)}}}removeRound(e){let t=Rw(this.state.profileDraft),n=t.find(t=>t.scheduleDate===e.date);if(!n)return;let r=n.venues.find(t=>t.venueId===e.venueId);if(r&&!(e.index<0||e.index>=r.rounds.length)){r.rounds.splice(e.index,1);for(let e=0;e<r.rounds.length;e++)r.rounds[e].sortOrder=e+1;this.commitProfile(t),this.state.selectedLocator?.date===e.date&&this.state.selectedLocator?.venueId===e.venueId&&this.state.selectedLocator?.index===e.index&&this.setState({selectedLocator:null})}}setNotBeforeTime(e,t){let n=Rw(this.state.profileDraft),r=n.find(t=>t.scheduleDate===e.date);if(!r)return;let i=r.venues.find(t=>t.venueId===e.venueId);if(!i)return;let a=i.rounds[e.index];a&&(t?a.notBeforeTime=t:delete a.notBeforeTime,this.commitProfile(n))}applyFixAction(e){if(e.kind===`JUMP_TO_ITEM`&&e.locator){this.setState({selectedDate:e.locator.date,selectedLocator:e.locator});return}if(e.kind===`OPEN_TEMPORAL_GRID`){this.config.onFixAction?.(e);return}if(e.kind===`MOVE_ITEM_AFTER`&&e.locator&&e.after){let t=OT(this.state.profileDraft,e.locator,e.after);this.commitProfile(t);return}if(e.kind===`MOVE_ITEM_BEFORE`&&e.locator&&e.before){let t=kT(this.state.profileDraft,e.locator,e.before);this.commitProfile(t);return}this.config.onFixAction?.(e)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state={...this.state,...e},this.emit()}commitProfile(e){this.state={...this.state,profileDraft:e},this.revalidate(),this.config.onProfileChanged?.(Rw(e))}addRejectionNotice(e){let t={code:`DROP_REJECTED`,severity:`WARN`,message:`Drop rejected: ${e}`,context:{}},n=[...this.state.ruleResults.filter(e=>e.code!==`DROP_REJECTED`),t],r=bT(n);this.state={...this.state,ruleResults:n,issueIndex:r},this.emit()}revalidate(){let e=lT({profile:this.state.profileDraft,temporal:this.config.temporalAdapter,dependencies:this.config.dependencyAdapter,venueOrder:this.config.venueOrder}),t=bT(e);this.state={...this.state,ruleResults:e,issueIndex:t},this.emit()}emit(){for(let e of this.listeners)e(this.state)}};function DT(e){return`${e.code}|${e.context?.scope??``}|${e.context?.structureId??``}|${e.context?.date??``}`}function OT(e,t,n){let r=Rw(e),i=AT(r,t);if(!i)return e;let a=jT(r,n.date,n.venueId),o=Math.min(a.length,n.index+1);return a.splice(o,0,i),r}function kT(e,t,n){let r=Rw(e),i=AT(r,t);if(!i)return e;let a=jT(r,n.date,n.venueId),o=Math.max(0,Math.min(a.length,n.index));return a.splice(o,0,i),r}function AT(e,t){let n=e.find(e=>e.scheduleDate===t.date);if(!n)return null;let r=n.venues.find(e=>e.venueId===t.venueId);return!r||t.index<0||t.index>=r.rounds.length?null:r.rounds.splice(t.index,1)[0]}function jT(e,t,n){let r=e.find(e=>e.scheduleDate===t);r||(r={scheduleDate:t,venues:[]},e.push(r));let i=r.venues.find(e=>e.venueId===n);return i||(i={venueId:n,rounds:[]},r.venues.push(i)),i.rounds}function MT(e,t){let{round:n,locator:r,isSelected:i,severity:a}=e,o=document.createElement(`div`);o.className=lw(),i&&o.classList.add(`selected`),a===`ERROR`?o.classList.add(`error`):a===`WARN`&&o.classList.add(`warn`),o.draggable=!0,o.addEventListener(`dragstart`,e=>{e.stopPropagation(),e.dataTransfer.setDragImage(o,o.offsetWidth/2,20),e.dataTransfer.setData(`application/json`,JSON.stringify({type:`PLANNED_ROUND`,locator:r})),e.dataTransfer.effectAllowed=`copyMove`}),o.addEventListener(`click`,e=>{e.stopPropagation(),t.onClick(r)}),t.onContextMenu&&o.addEventListener(`contextmenu`,e=>{e.preventDefault(),e.stopPropagation(),t.onContextMenu(r,o)});let s=document.createElement(`div`);s.className=uw();let c=n.roundName&&!n.roundName.startsWith(`rn=`)?n.roundName:`Round `+n.roundNumber;s.textContent=(n.eventName?n.eventName+` — `:``)+c,o.appendChild(s);let l=document.createElement(`div`);l.className=dw(),l.textContent=[n.drawName||``,n.matchCountEstimate?`${n.matchCountEstimate} matches`:``].filter(Boolean).join(` · `),o.appendChild(l);let u=document.createElement(`div`);return u.className=tw(),n.roundSegment&&u.appendChild(NT(`Seg ${n.roundSegment.segmentNumber}/${n.roundSegment.segmentsCount}`,`seg`)),n.notBeforeTime&&u.appendChild(NT(`NB ${n.notBeforeTime}`,`nb`)),a===`ERROR`?u.appendChild(NT(`Error`,`err`)):a===`WARN`&&u.appendChild(NT(`Warn`,`warn`)),u.children.length&&o.appendChild(u),o}function NT(e,t){let n=document.createElement(`div`);return n.className=nw()+` `+t,n.textContent=e,n}function PT(e){let t=document.createElement(`div`);t.className=qC();let n=document.createElement(`div`);n.className=JC();let r=document.createElement(`div`);r.className=YC(),r.textContent=`Day Plan`;let i=document.createElement(`div`);i.className=XC(),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=rw(),t.appendChild(a);function o(t){let n=t.selectedDate;i.textContent=n?`Selected: ${n}`:`Select a date`,a.innerHTML=``;let r=Math.max(1,t.venues.length);r>4?(a.classList.add(`sp-board-scroll`),a.style.gridTemplateColumns=``):(a.classList.remove(`sp-board-scroll`),a.style.gridTemplateColumns=`repeat(${r}, 1fr)`);for(let r of t.venues){let i=document.createElement(`div`);i.className=iw();let o=document.createElement(`div`);o.className=aw();let s=document.createElement(`div`),c=document.createElement(`div`);c.className=ow(),c.textContent=r.name;let l=document.createElement(`div`);l.className=sw(),l.textContent=``,s.appendChild(c),s.appendChild(l);let u=t.issueIndex.counts.byVenue[r.venueId],d=document.createElement(`div`);d.className=ew(),u?.ERROR?(d.classList.add(`err`),d.textContent=`${u.ERROR} err`):u?.WARN?(d.classList.add(`warn`),d.textContent=`${u.WARN} warn`):(d.classList.add(`ok`),d.textContent=`OK`),o.appendChild(s),o.appendChild(d);let f=document.createElement(`div`);if(f.className=cw(),f.dataset.venue=r.venueId,n){let i=Ww(t.profileDraft,n,r.venueId);if(!i.length){let e=document.createElement(`div`);e.className=Aw(),e.textContent=`Drop rounds here.`,f.appendChild(e)}i.forEach((i,a)=>{let o={date:n,venueId:r.venueId,index:a,roundKey:Uw(i),roundSegment:i.roundSegment},s=Jw(Kw(t.ruleResults,o)),c=MT({round:i,locator:o,isSelected:Hw(t.selectedLocator,o),severity:s},{onClick:e.onCardClick,onContextMenu:e.onCardContextMenu});f.appendChild(c)})}else{let e=document.createElement(`div`);e.className=Aw(),e.textContent=`Select a date to plan.`,f.appendChild(e)}let p=document.createElement(`div`);p.className=Pw(),p.style.display=`none`,f.addEventListener(`dragover`,e=>{if(!n)return;e.preventDefault(),f.classList.add(`over`),e.dataTransfer.dropEffect=`move`;let t=IT(f,e.clientY,p),r=FT(f,p);p.style.display=``,t<r.length?f.insertBefore(p,r[t]):f.appendChild(p)}),f.addEventListener(`dragleave`,e=>{f.contains(e.relatedTarget)||(f.classList.remove(`over`),p.style.display=`none`)}),f.addEventListener(`drop`,t=>{if(f.classList.remove(`over`),p.style.display=`none`,t.preventDefault(),!n)return;let i;try{i=JSON.parse(t.dataTransfer.getData(`application/json`))}catch{return}let a=IT(f,t.clientY,p),o={date:n,venueId:r.venueId,index:a};e.onDrop(i,o)}),i.appendChild(o),i.appendChild(f),a.appendChild(i)}}return{element:t,update:o}}function FT(e,t){return Array.from(e.querySelectorAll(`[draggable="true"]`)).filter(e=>e!==t)}function IT(e,t,n){let r=FT(e,n);for(let e=0;e<r.length;e++){let n=r[e].getBoundingClientRect();if(t<n.top+n.height/2)return e}return r.length}function LT(e){let t=document.createElement(`div`);t.className=qC();let n=document.createElement(`div`);n.className=JC();let r=document.createElement(`div`);r.className=YC(),r.textContent=`Dates`;let i=document.createElement(`div`);i.className=XC(),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=ZC(),t.appendChild(a);function o(t){i.textContent=`${t.schedulableDates.length} schedulable`,a.innerHTML=``;let n=t.activeDates?new Set(t.activeDates):null;for(let r of t.schedulableDates){let i=!n||n.has(r),o=t.issueIndex.counts.byDate[r],s=document.createElement(`div`);s.className=QC(),r===t.selectedDate&&s.classList.add(`selected`),i||s.classList.add(`inactive`),s.setAttribute(`data-date`,r);let c=document.createElement(`div`),l=document.createElement(`div`);l.style.cssText=`font-weight:800;font-size:12px`,l.textContent=r;let u=document.createElement(`div`);u.style.cssText=`font-size:11px;color:var(--sp-muted)`,u.textContent=i?`Active`:`Inactive`,c.appendChild(l),c.appendChild(u);let d=document.createElement(`div`);d.className=$C(),o?.ERROR&&d.appendChild(RT(`${o.ERROR} err`,`err`)),o?.WARN&&d.appendChild(RT(`${o.WARN} warn`,`warn`)),!o?.ERROR&&!o?.WARN&&d.appendChild(RT(`OK`,`ok`)),s.appendChild(c),s.appendChild(d),s.addEventListener(`click`,()=>e.onDateSelected(r)),a.appendChild(s)}}return{element:t,update:o}}function RT(e,t){let n=document.createElement(`div`);return n.className=ew()+` `+t,n.textContent=e,n}var zT=class{constructor(e){this.container=null,this.store=new ET(e),this.popover=Lw({onDelete:e=>{this.store.removeRound(e)},onSetNotBeforeTime:e=>{let t=prompt(`Enter not-before time (HH:MM):`,`10:00`);t!==null&&this.store.setNotBeforeTime(e,t||void 0)}}),this.layout=Iw({dateStrip:LT({onDateSelected:e=>this.store.selectDate(e)}),issuesPanel:aT({onFixAction:e=>this.store.applyFixAction(e)}),venueBoard:PT({onDrop:(e,t)=>{this.store.dropRound(e,t)},onCardClick:e=>this.store.selectCard(e),onCardContextMenu:(e,t)=>{this.popover.show(t,e)}}),roundCatalog:iT({onSearchChange:e=>this.store.setCatalogSearch(e),onGroupByChange:e=>this.store.setCatalogGroupBy(e),onDropRemove:e=>this.store.removeRound(e),onNavigateToPlanned:e=>this.store.navigateToRound(e)}),inspectorPanel:Xw()},{hideLeft:e.hideLeft,catalogSide:e.catalogSide}),this.unsubscribe=this.store.subscribe(e=>{this.layout.update(e)}),this.layout.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.layout.element)}destroy(){this.unsubscribe(),this.popover.destroy(),this.container&&this.layout.element.parentNode===this.container&&this.layout.element.remove(),this.container=null}getProfile(){return this.store.getSchedulingProfile()}getStore(){return this.store}};function BT(e,t){let n=new zT(e);return n.render(t),n}var VT=class{constructor(){this.selectedDay=null,this.selectedVenue=null,this.selectedCourt=null,this.layerVisibility=new Map,this.listeners=new Set}setSelectedDay(e){this.selectedDay!==e&&(this.selectedDay=e,this.emit({selectedDay:e}))}getSelectedDay(){return this.selectedDay}setSelectedVenue(e){this.selectedVenue!==e&&(this.selectedVenue=e,this.emit({selectedVenue:e}))}getSelectedVenue(){return this.selectedVenue}setSelectedCourt(e){this.selectedCourt!==e&&(this.selectedCourt=e,this.emit({selectedCourt:e}))}getSelectedCourt(){return this.selectedCourt}setLayerVisibility(e,t){this.layerVisibility.set(e,t),this.emit({layerVisibility:new Map(this.layerVisibility)})}getLayerVisibility(){return new Map(this.layerVisibility)}isLayerVisible(e){return this.layerVisibility.get(e)??!0}getSnapshot(){return{selectedDay:this.selectedDay,selectedVenue:this.selectedVenue,selectedCourt:this.selectedCourt,layerVisibility:new Map(this.layerVisibility)}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(e){let t={type:`VIEW_CHANGED`,payload:e};for(let e of this.listeners)e(t)}},HT={AVAILABLE:`rgba(33, 141, 141, 0.15)`,BLOCKED:`#95a5a6`,PRACTICE:`#9b59b6`,MAINTENANCE:`#f39c12`,RESERVED:`#3498db`,CLOSED:`#2c3e50`,SCHEDULED:`#27ae60`,SOFT_BLOCK:`#5dade2`,HARD_BLOCK:`#e74c3c`,LOCKED:`#34495e`,UNSPECIFIED:`#ecf0f1`};function UT(e,t,n={}){let r=[],i=new Map;for(let e of t){let t=qT(e.ref);i.set(t,e)}let a=new Set;for(let t of e)for(let e of t.rails)a.add(qT(e.court));for(let e of a){let t=i.get(e);if(!t)continue;let n={id:e,content:t.name,courtRef:t.ref,surface:t.surface,indoor:t.indoor,hasLights:t.hasLights,tags:t.tags};r.push(n)}return r}function WT(e,t={}){let{layerVisibility:n=new Map,showSegmentLabels:r=!1,colorScheme:i=HT}=t,a=[];for(let t of e)for(let e of t.rails){let t=qT(e.court);for(let o of e.segments){if(!(n.get(o.status)??!0))continue;let e=`${t}-${o.start}-${o.status}`,s=i[o.status];a.push({id:e,group:t,content:r?GT(o):``,start:o.start,end:o.end,type:`background`,className:`temporal-segment segment-${o.status.toLowerCase()}`,style:s===`transparent`?void 0:`background-color: ${s};`,title:`${o.status} segment`,editable:!1,selectable:!1,status:o.status,contributingBlocks:o.contributingBlocks,isSegment:!0})}}return a}function GT(e){let t=Math.round((new Date(e.end).getTime()-new Date(e.start).getTime())/(1e3*60));return`${e.status} (${t}m)`}function KT(e,t={}){let{colorScheme:n=HT}=t,r=[];for(let t of e){let e=qT(t.court),i=n[t.type],a=JT(i,-20);r.push({id:`block-${t.id}`,group:e,content:t.reason||t.type,start:t.start,end:t.end,type:`range`,className:`temporal-block block-${t.type.toLowerCase()}`,style:`background-color: ${i}; border-color: ${a};`,title:t.reason||t.type,editable:{updateTime:!0,updateGroup:!0,remove:!1},blockId:t.id,status:t.type,reason:t.reason,isBlock:!0})}return r}function qT(e){return`${e.tournamentId}|${e.venueId}|${e.courtId}`}function JT(e,t){if(!e||!e.startsWith(`#`))return e;let n=parseInt(e.replace(`#`,``),16),r=Math.round(2.55*t),i=(n>>16)+r,a=(n>>8&255)+r,o=(n&255)+r;return`#`+(16777216+(i<255?i<1?0:i:255)*65536+(a<255?a<1?0:a:255)*256+(o<255?o<1?0:o:255)).toString(16).slice(1)}function YT(e){let t=e.split(`|`);return t.length===3?{tournamentId:t[0],venueId:t[1],courtId:t[2]}:null}function XT(e){let t=String(e);return t.startsWith(`block-`)?t.slice(6):null}function ZT(e){let t=new Date(`${e.day}T${e.dayStartTime}:00`),n=new Date(`${e.day}T${e.dayEndTime}:00`);return{start:t,end:n,min:t,max:n,zoomMin:e.slotMinutes*4*60*1e3,zoomMax:(n.getTime()-t.getTime())*1.5}}var QT=u({EventEmitter:()=>wD,PluginRegistry:()=>bE,TimepickerUI:()=>kD,default:()=>AD});function $T(e){let t=e.target,n=t.hasAttribute(`data-md3-ripple`)?t:t.closest(`[data-md3-ripple]`);if(!n||e.button!==0&&e.pointerType===`mouse`)return;let r=n.getBoundingClientRect(),i=Math.max(r.width,r.height)*2,a=e.clientX-r.left,o=e.clientY-r.top;n.style.setProperty(`--ripple-size`,`${i}px`),n.style.setProperty(`--ripple-x`,`${a}px`),n.style.setProperty(`--ripple-y`,`${o}px`),n.classList.remove(vD,yD),n.offsetWidth,n.classList.add(vD,yD),n._rippleHold=!0,bD=n}function eE(e){let t=e.target,n=(t.hasAttribute(`data-md3-ripple`)?t:t.closest(`[data-md3-ripple]`))||bD;n&&(n._rippleHold=!1,n.classList.remove(yD),setTimeout(()=>{n.classList.remove(vD),bD===n&&(bD=null)},1e3))}function tE(e){let t=e.currentTarget;!t||!t._rippleHold||(t._rippleHold=!1,t.classList.remove(yD),setTimeout(()=>{t.classList.remove(vD),bD===t&&(bD=null)},1e3))}function nE(e){if(aE()===!1)return;let t=e||document;t.addEventListener(`pointerdown`,$T),t.addEventListener(`pointerup`,eE),t.addEventListener(`pointercancel`,eE),t.querySelectorAll(`[data-md3-ripple]`).forEach(e=>{e.addEventListener(`mouseleave`,tE)})}function rE(e={}){let t={clock:{...TD.clock,...e.clock},ui:{...TD.ui,...e.ui},labels:{...TD.labels,...e.labels},behavior:{...TD.behavior,...e.behavior},callbacks:{...TD.callbacks,...e.callbacks},timezone:{...TD.timezone,...e.timezone},range:{...TD.range,...e.range},wheel:{...TD.wheel,...e.wheel},clearBehavior:{...TD.clearBehavior,...e.clearBehavior}},n=t.ui.mode;return(n===`wheel`||n===`compact-wheel`)&&(t.wheel={placement:n===`compact-wheel`?`auto`:void 0,hideFooter:void 0,commitOnScroll:void 0,ignoreOutsideClick:void 0,...t.wheel}),t}var iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,JE,YE,XE,ZE,QE,$E,eD,tD,nD,rD,iD,aD,oD,sD,cD,lD,uD,dD,fD,pD,mD,hD,gD,_D,vD,yD,bD,xD,SD,CD,wD,TD,ED,DD,OD,kD,AD,jD=c((()=>{iE=()=>typeof window>`u`,aE=()=>typeof document<`u`,oE=class{state;constructor(e,t,n,r){this.state={degreesHours:null,degreesMinutes:null,options:t,element:e,instanceId:n,isMobileView:!1,isTouchMouseMove:!1,disabledTime:null,cloned:null,isModalRemove:!0,isOpen:!1,isInitialized:!1,customId:r,eventHandlersRegistered:!1,isDestroyed:!1}}get degreesHours(){return this.state.degreesHours}get degreesMinutes(){return this.state.degreesMinutes}get options(){return this.state.options}get element(){return this.state.element}get instanceId(){return this.state.instanceId}get isMobileView(){return this.state.isMobileView}get isTouchMouseMove(){return this.state.isTouchMouseMove}get disabledTime(){return this.state.disabledTime}get cloned(){return this.state.cloned}get isModalRemove(){return this.state.isModalRemove}get isOpen(){return this.state.isOpen}get isInitialized(){return this.state.isInitialized}get customId(){return this.state.customId}get eventHandlersRegistered(){return this.state.eventHandlersRegistered}get isDestroyed(){return this.state.isDestroyed}setDegreesHours(e){this.state={...this.state,degreesHours:e}}setDegreesMinutes(e){this.state={...this.state,degreesMinutes:e}}setOptions(e){this.state={...this.state,options:e}}setIsMobileView(e){this.state={...this.state,isMobileView:e}}setIsTouchMouseMove(e){this.state={...this.state,isTouchMouseMove:e}}setDisabledTime(e){this.state={...this.state,disabledTime:e}}setCloned(e){this.state={...this.state,cloned:e}}setIsModalRemove(e){this.state={...this.state,isModalRemove:e}}setIsOpen(e){this.state={...this.state,isOpen:e}}setIsInitialized(e){this.state={...this.state,isInitialized:e}}setEventHandlersRegistered(e){this.state={...this.state,eventHandlersRegistered:e}}setIsDestroyed(e){this.state={...this.state,isDestroyed:e}}updateOptions(e){this.state={...this.state,options:{...this.state.options,clock:{...this.state.options.clock,...e.clock||{}},ui:{...this.state.options.ui,...e.ui||{}},labels:{...this.state.options.labels,...e.labels||{}},behavior:{...this.state.options.behavior,...e.behavior||{}},callbacks:{...this.state.options.callbacks,...e.callbacks||{}}}}}reset(){this.state={...this.state,degreesHours:null,degreesMinutes:null,isTouchMouseMove:!1,disabledTime:null,cloned:null,isModalRemove:!0,isOpen:!1,isInitialized:!1,isDestroyed:!0,eventHandlersRegistered:!1}}getModalElement(){return aE()===!1?null:document.querySelector(`[data-owner-id="${this.state.instanceId}"]`)}getInput(){return this.state.element?.querySelector(`input`)}getClockFace(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-clock-face.mobile`):e.querySelector(`.tp-ui-clock-face:not(.mobile)`):null}getClockHand(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-mobile-clock-wrapper .tp-ui-clock-hand`):e.querySelector(`.tp-ui-clock-hand:not(.mobile)`):null}getCircle(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-mobile-clock-wrapper .tp-ui-circle-hand`):e.querySelector(`.tp-ui-circle-hand:not(.mobile)`):null}getTipsWrapper(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper`):e.querySelector(`.tp-ui-tips-wrapper:not(.mobile)`):null}getTipsWrapperFor24h(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper-24h`):e.querySelector(`.tp-ui-tips-wrapper-24h:not(.mobile)`):null}getMinutes(){return this.getModalElement()?.querySelector(`.tp-ui-minutes`)||null}getHour(){return this.getModalElement()?.querySelector(`.tp-ui-hour`)||null}getAM(){return this.getModalElement()?.querySelector(`.tp-ui-am`)||null}getPM(){return this.getModalElement()?.querySelector(`.tp-ui-pm`)||null}getHourText(){return this.getModalElement()?.querySelector(`.tp-ui-hour-text`)||null}getMinutesText(){return this.getModalElement()?.querySelector(`.tp-ui-minute-text`)||null}getHeader(){return this.getModalElement()?.querySelector(`.tp-ui-header`)||null}getInputWrappers(){return this.getModalElement()?.querySelectorAll(`.tp-ui-input-wrapper`)||null}getDots(){return this.getModalElement()?.querySelector(`.tp-ui-dots`)||null}getMinutesTips(){return this.getModalElement()?.querySelector(`.tp-ui-minutes-time`)||null}getHourTips(){return this.getModalElement()?.querySelector(`.tp-ui-hour-time-12`)||null}getAllValueTips(){let e=this.getModalElement();return e?[...e.querySelectorAll(`.tp-ui-value-tips`),...e.querySelectorAll(`.tp-ui-value-tips-24h`)]:[]}getOpenElementData(){let e=this.state.element?.querySelectorAll(`[data-open]`);if(e?.length>0){let t=[];return e.forEach(({dataset:e})=>t.push(e.open??``)),[...new Set(t)]}return null}getOpenElement(){let e=this.getInput(),t=this.getOpenElementData();return t===null?(e?.setAttribute(`data-open`,`tp-ui-input`),[e]):t.map(e=>this.state.element?.querySelectorAll(`[data-open='${e}']`))[0]??``}getCancelButton(){return this.getModalElement()?.querySelector(`.tp-ui-cancel-btn`)||null}getOkButton(){return this.getModalElement()?.querySelector(`.tp-ui-ok-btn`)||null}getActiveTypeMode(){return this.getModalElement()?.querySelector(`.tp-ui-type-mode.active`)||null}getKeyboardClockIcon(){return this.getModalElement()?.querySelector(`.tp-ui-keyboard-icon-wrapper`)||null}getFooter(){return this.getModalElement()?.querySelector(`.tp-ui-footer`)||null}getWrapper(){return this.getModalElement()?.querySelector(`.tp-ui-wrapper`)||null}},sE={DEFAULT_DELAY:300,MODAL_ANIMATION:150,SCROLLBAR_RESTORE:400,MODAL_REMOVE:300,CLOCK_ANIMATION:600,TIPS_ANIMATION:401,MOBILE_TOGGLE:450,CLOCK_SCALE_DELAY:150,WRAPPER_TRANSITION:400,DROPDOWN_CLICK_DELAY:10},cE=class{core;emitter;timeouts=[];constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on(`animation:clock`,()=>{this.handleAnimationSwitchTipsMode()})}runWithAnimation(e,t=sE.MODAL_ANIMATION){if(this.core.options.ui.animation){let n=setTimeout(e,t);this.timeouts.push(n)}else e()}clearAllTimeouts(){this.timeouts.forEach(clearTimeout),this.timeouts=[]}setAnimationToOpen(){this.clearAllTimeouts(),this.core.getModalElement()?.classList.add(`opacity`),this.runWithAnimation(()=>{this.core.getModalElement()?.classList.add(`show`)})}removeAnimationToClose(){this.clearAllTimeouts(),this.core.getModalElement()&&this.runWithAnimation(()=>{let e=this.core.getModalElement();e?.classList.remove(`show`),e?.classList.remove(`opacity`)})}handleAnimationClock(){this.core.options.ui.animation&&this.runWithAnimation(()=>{this.core.getClockFace()?.classList.add(`tp-ui-clock-animation`);let e=setTimeout(()=>{this.core.getClockFace()?.classList.remove(`tp-ui-clock-animation`)},sE.CLOCK_ANIMATION);this.timeouts.push(e)})}handleAnimationSwitchTipsMode(){let e=this.core.getClockHand();if(!e)return;this.emitter.emit(`animation:start`,{}),e.classList.add(`tp-ui-tips-animation`);let t=setTimeout(()=>{this.core.getClockHand()?.classList.remove(`tp-ui-tips-animation`),this.emitter.emit(`animation:end`,{})},sE.TIPS_ANIMATION);this.timeouts.push(t)}destroy(){this.clearAllTimeouts()}},lE=()=>{if(aE()===!1)return 0;let e=document.createElement(`div`);e.className=`tp-ui-measure`,document.body.appendChild(e);let t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t},uE=(e,t)=>e?e.classList.contains(t):!1,dE=(e,t)=>Array.from({length:Number(t)-Number(e)+1},(t,n)=>Number(e)+n),fE=(e,t)=>Array.from({length:Number(t)-Number(e)+1},(e,n)=>Number(t)-n).reverse(),pE=(e=``)=>{let t=e.replace(/(AM|PM|am|pm)/,e=>` ${e}`),n=new Date(`September 20, 2000 ${t}`);return`${n.getHours().toString().padStart(2,`0`)}:${n.getMinutes().toString().padStart(2,`0`)}`},mE=e=>{let[t,n]=e.split(`:`);return`${t.padStart(2,`0`)}:${n.padStart(2,`0`)}`},hE=(e,t)=>{if(e.length<2)return!1;let n=e.map(e=>{let[n,r]=e.trim().split(`-`),i,a;if(t===`12h`){if(!/\s?(AM|PM|am|pm)\s?$/.test(n.trim())||!/\s?(AM|PM|am|pm)\s?$/.test(r.trim()))throw Error(`Invalid 12h format: "${e}"`);i=pE(n.trim()),a=pE(r.trim())}else{if(/\s?(AM|PM|am|pm)\s?/.test(n.trim())||/\s?(AM|PM|am|pm)\s?/.test(r.trim()))throw Error(`Invalid 24h format: "${e}"`);i=mE(n.trim()),a=mE(r.trim())}return{start:i,end:a,original:e}});for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let r=n[e],i=n[t];if(r.start<=i.end&&r.end>=i.start||i.start<=r.end&&i.end>=r.start)throw Error(`Overlapping intervals: "${r.original}" and "${i.original}"`)}return!1},gE=()=>typeof window<`u`&&window.crypto&&typeof window.crypto.randomUUID==`function`?window.crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)}),_E=`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M160-200q-33 0-56.5-23.5T80-280v-400q0-33 23.5-56.5T160-760h640q33 0 56.5 23.5T880-680v400q0 33-23.5 56.5T800-200H160Zm0-80h640v-400H160v400Zm160-40h320v-80H320v80ZM200-440h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80ZM200-560h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80ZM160-280v-400 400Z"/></svg>`,vE=`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z"/></svg>`,yE=class{plugins=new Map;register(e){this.plugins.has(e.name)||this.plugins.set(e.name,e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}get(e){return this.plugins.get(e)}getTemplateProvider(e){return this.plugins.get(e)?.templateProvider}getClearHandler(e){return this.plugins.get(e)?.clearHandler}},bE=new yE,xE=[`00`,`13`,`14`,`15`,`16`,`17`,`18`,`19`,`20`,`21`,`22`,`23`],SE=[`12`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`],CE=[`00`,`05`,`10`,`15`,`20`,`25`,`30`,`35`,`40`,`45`,`50`,`55`],wE=(e,t,n)=>{let{timezone:{enabled:r,label:i}}=e;return!r||!bE.has(`timezone`)?``:`<div class="tp-ui-timezone ${t}">
223
+ `;F.open({title:t,content:p,buttons:d,onClose:f});let m=e=>{e?.[0]?.onClick&&(e[0].onClick(),F.close())};if(a){let e=a({anchorId:c,data:r,selectionLimit:i,onSelected:m});l=e.table,u=e.destroy;let t=o?o(l):()=>{},d=[{onKeyDown:e=>e.keyCode===8&&e.target.value.length===1&&t(``),onChange:e=>t(e.target.value),onKeyUp:e=>t(e.target.value),clearSearch:()=>t(``),placeholder:n||`Search`,location:mC,search:!0}],f=document.getElementById(s)||void 0;IC({table:l,target:f,items:d})}else{let e=document.getElementById(c);if(e){gC({container:e,options:r,onSelected:m});let t=t=>{let n=e.querySelectorAll(`[data-select-item]`),r=t.toLowerCase();n.forEach(e=>{let n=e.textContent?.toLowerCase()||``;e.style.display=!t||n.includes(r)?``:`none`})},i=[{onKeyUp:e=>t(e.target.value),clearSearch:()=>t(``),placeholder:n||`Search`,location:mC,search:!0}];IC({target:document.getElementById(s)||void 0,items:i})}}}function gC({container:e,options:t,onSelected:n}){let r=document.createElement(`div`);r.style.cssText=`max-height: 380px; overflow-y: auto; padding: 0.5em 0;`;for(let e of t){let t=document.createElement(`a`);t.setAttribute(`data-select-item`,``),t.className=`panel-block font-medium`,t.style.cssText=`cursor: pointer; padding: 0.5em 1em; display: block; text-decoration: none; color: inherit;`,t.innerHTML=e.label,t.onmouseenter=()=>t.style.backgroundColor=`#f5f5f5`,t.onmouseleave=()=>t.style.backgroundColor=``,t.onclick=t=>{t.stopPropagation(),n([e])},r.appendChild(t)}e.appendChild(r)}var _C=`none`;function vC(e){let t=document.createElement(`button`);return t.className=`button font-medium`,e.disabled&&(t.disabled=!0),e.class&&t.classList.add(e.class),e.id&&(t.id=e.id),e.intent&&t.classList.add(e.intent),e.toolTip?.content&&mm(t,e.toolTip),t.innerHTML=e.label,e.visible===!1&&(t.style.display=_C),t}var yC=`center`,bC=``,xC=`flex`,SC=`left`,CC=`none`,wC=`overlay`,TC=`right`,EC=({target:e})=>(t=[])=>{e.style.backgroundColor=t?.length?`var(--chc-hover-bg)`:bC;let n=(n,r,i)=>{let a=e.getElementsByClassName(`options_${n}`)[0];a&&(a.style.display=t?.length?r:i)};n(wC,xC,CC),n(SC,CC,xC),n(yC,CC,xC),n(TC,CC,xC)},DC=`center`,OC=`header`,kC=``,AC=`left`,jC=`none`,MC=`overlay`,NC=`right`,PC=`buttonBar`,FC=`top`;function IC(e){let{table:t,targetClassName:n,items:r=[],onSelection:i,selectItemFn:a}=e,{target:o}=e,s=!!o;if(!o&&n&&(o=document.getElementsByClassName(n)?.[0]),!o)return{elements:{},inputs:{}};let c=0,l=0,u={},d={},f;if(s){P(o);let e=WC();Object.assign(u,e.elements),o.appendChild(e.anchor)}let p=Object.assign({},...[MC,AC,DC,NC,OC].map(e=>{let t=o.getElementsByClassName(`options_${e}`)?.[0];return P(t),{[e]:t}}).filter(Boolean)),m=EC({table:t,target:o}),h=(e,n)=>{B(n.onClick)&&(e.stopPropagation(),n.disabled||n.onClick(e,t),n.stateChange&&m())},g={onClick:()=>{},location:NC};for(let e of r){let t={...g};ee(e)&&Object.assign(t,e);let n=p[t.location];if(!n){console.log(t.location,p);continue}t.location===MC&&(c+=1),t.location===OC&&(LC(t,o),l+=1);let r=RC(e,t,n,m,h,a,u,d);r?.focus&&(f=r.focus)}let _=o.getElementsByClassName(`panelHeader`)[0];_&&(_.style.display=l?kC:jC),t?._controlBarSelectionHandler&&t.off(`rowSelectionChanged`,t._controlBarSelectionHandler);let v=(e,t)=>{B(i)&&i(t),c&&m(t)};return t&&(t._controlBarSelectionHandler=v),t?.on(`rowSelectionChanged`,v),m(t?.getSelectedRows?.()??[]),f&&setTimeout(()=>f.focus(),200),{elements:u,inputs:d}}function LC(e,t){if(B(e.headerClick)){let n=t.getElementsByClassName(`panelHeader`)[0];n&&(n.onclick=e.headerClick)}}function RC(e,t,n,r,i,a,o,s){if(!t.hide&&(t.input||t.placeholder||t.search)){let r=zC(e,t);return t.id&&(s[t.id]=r.input),t.id&&(o[t.id]=r.elem,r.elem.id=t.id),n?.appendChild(r.elem),t.focus?{focus:r.input}:void 0}if(!t.hide&&t.text){let e=document.createElement(`div`);e.className=`font-medium`,t.id&&(o[t.id]=e,e.id=t.id),e.innerHTML=t.text,e.onclick=e=>i(e,t),n?.appendChild(e);return}!t.id&&(!t?.label||t.hide)||(VC(t,n,r,i,a,o),(!(t?.label||t.tabs)||t.hide)&&o[t.id]&&(o[t.id].style.display=jC))}function zC(e,t){let n=document.createElement(`p`);n.className=`control ${t.search?`has-icons-left has-icons-right`:``}`;let r=document.createElement(`input`);if(r.className=`input font-medium`,r.setAttribute(`type`,`text`),r.setAttribute(`autocomplete`,`off`),r.setAttribute(`placeholder`,e.placeholder||kC),t.id&&r.setAttribute(`id`,t.id),t.onKeyDown&&r.addEventListener(`keydown`,e=>t.onKeyDown(e,t)),t.onChange&&r.addEventListener(`change`,e=>t.onChange(e,t)),t.onKeyUp&&r.addEventListener(`keyup`,e=>{t.clearSearch&&e.key===`Escape`&&(e.stopPropagation(),r.value=``,t.clearSearch()),t.onKeyUp(e,t)}),t.class&&r.classList.add(t.class),t.visible===!1&&(n.style.display=jC),t.value&&(r.value=t.value),n.appendChild(r),t.search&&BC(n,r,t),e.validator){let t=document.createElement(`p`);t.className=`help font-medium`,n.appendChild(t),r.addEventListener(`input`,n=>an(e,n,r,t,e.validator))}return{elem:n,input:r}}function BC(e,t,n){let r=document.createElement(`span`);if(r.className=`icon is-small is-left font-medium`,r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16" fill="currentColor"><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>`,e.appendChild(r),B(n.clearSearch)){let r=document.createElement(`span`);r.className=`icon is-small is-right font-medium`,r.style.pointerEvents=`all`,r.style.cursor=`pointer`,r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16" fill="#dddada"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>`,r.onclick=e=>{e.stopPropagation(),t.value=``,n.clearSearch()},e.appendChild(r)}}function VC(e,t,n,r,i,a){if(e.options){let r=pC({target:t,button:e,stateChange:n});e.visible===!1&&(r.style.display=jC),e.id&&(a[e.id]=r)}else if(ee(e.selection))HC(e,t,n,i,a);else if(e.tabs)UC(e,t,a);else{let n=vC(e);n.onclick=t=>r(t,e),e.id&&(a[e.id]=n),t?.appendChild(n)}}function HC(e,t,n,r,i){let{selection:{options:a,actions:o},actionPlacement:s,threshold:c=8,...l}=e;if(a?.length<c){a.length&&(s===FC?a.unshift({divider:!0}):a.push({divider:!0})),o.forEach(e=>{let{label:t,...n}=e,r={...n,label:`<p style="font-weight: bold">${t}</p>`};s===FC?a.unshift(r):a.push(r)});let r={...l,options:a},c=pC({target:t,button:r,stateChange:n});r.visible===!1&&(c.style.display=jC),r.id&&(i[e.id]=c)}else{let n=vC(e),o=r||hC;n.onclick=t=>{t.stopPropagation(),o({title:e.selectionTitle||`Select`,options:a})},e.id&&(i[e.id]=n),t?.appendChild(n)}}function UC(e,t,n){let r=document.createElement(`div`);r.className=`tabs is-toggle is-toggle-rounded`;let i=document.createElement(`ul`);r.appendChild(i),e.tabs.forEach(t=>{let n=document.createElement(`li`);t.active&&n.classList.add(`is-active`);let r=document.createElement(`a`);n.appendChild(r),r.onclick=r=>{i.querySelectorAll(`li`).forEach(e=>e.classList.remove(`is-active`)),n.classList.add(`is-active`),B(t.onClick)&&t.onClick(r,e)};let a=document.createElement(`span`);a.innerHTML=t.label,r.appendChild(a),i.appendChild(n)}),e.id&&(n[e.id]=r),t.appendChild(r)}function WC(){let e=document.createElement(`div`);e.className=`panel_container flexcol flexcenter`;let t=document.createElement(`div`);t.className=`panelHeader options_header`,t.style.display=jC,e.appendChild(t);let n=document.createElement(`div`);n.className=PC;let r={optionsOverlay:document.createElement(`div`),optionsLeft:document.createElement(`div`),optionsCenter:document.createElement(`div`),optionsRight:document.createElement(`div`)};r.optionsOverlay.className=`options_overlay`,r.optionsCenter.className=`options_center`,r.optionsRight.className=`options_right`,r.optionsLeft.className=`options_left`;for(let e of Object.values(r))n.appendChild(e);return e.appendChild(n),{elements:r,anchor:e,header:t}}var GC=()=>`sp-layout`,KC=()=>`sp-column`,qC=()=>`sp-panel`,JC=()=>`sp-panel-header`,YC=()=>`sp-panel-title`,XC=()=>`sp-panel-meta`,ZC=()=>`sp-date-strip`,QC=()=>`sp-date-chip`,$C=()=>`sp-badges`,ew=()=>`sp-badge`,tw=()=>`sp-chips`,nw=()=>`sp-chip`,rw=()=>`sp-board`,iw=()=>`sp-venue`,aw=()=>`sp-venue-header`,ow=()=>`sp-venue-title`,sw=()=>`sp-venue-sub`,cw=()=>`sp-dropzone`,lw=()=>`sp-card`,uw=()=>`sp-card-title`,dw=()=>`sp-card-meta`,fw=()=>`sp-issues`,pw=()=>`sp-issue`,mw=()=>`sp-issue-code`,hw=()=>`sp-issue-msg`,gw=()=>`sp-issue-actions`,_w=()=>`sp-btn sp-btn--sm`,vw=()=>`sp-catalog`,yw=()=>`sp-catalog-toolbar`,bw=()=>`sp-input`,xw=()=>`sp-select`,Sw=()=>`sp-group`,Cw=()=>`sp-group-header`,ww=()=>`sp-group-body`,Tw=()=>`sp-catalog-item`,Ew=()=>`sp-inspector`,Dw=()=>`sp-kv`,Ow=()=>`sp-kv-key`,kw=()=>`sp-kv-value`,Aw=()=>`sp-small`,jw=()=>`sp-popover-item`,Mw=()=>`sp-popover-delete`,Nw=()=>`sp-popover-divider`,Pw=()=>`sp-insertion-line`,Fw=()=>`sp-group-chevron`;function Iw(e,t){let n=!!t?.hideLeft,r=t?.catalogSide===`left`,i=document.createElement(`div`);if(i.className=GC(),n)r?i.classList.add(`sp-catalog-left`):i.classList.add(`sp-no-left`);else{let t=document.createElement(`div`);t.className=KC(),t.appendChild(e.dateStrip.element),e.issuesPanel.element.style.flex=`1`,e.issuesPanel.element.style.minHeight=`0`,t.appendChild(e.issuesPanel.element),i.appendChild(t)}let a=document.createElement(`div`);a.className=KC(),e.venueBoard.element.style.flex=`1`,e.venueBoard.element.style.minHeight=`0`,a.appendChild(e.venueBoard.element);let o=document.createElement(`div`);o.className=KC(),e.roundCatalog.element.style.flex=`1`,e.roundCatalog.element.style.minHeight=`0`,o.appendChild(e.roundCatalog.element),o.appendChild(e.inspectorPanel.element),r&&n?(i.appendChild(o),i.appendChild(a)):(i.appendChild(a),i.appendChild(o));function s(t){n||(e.dateStrip.update(t),e.issuesPanel.update(t)),e.venueBoard.update(t),e.roundCatalog.update(t),e.inspectorPanel.update(t)}return{element:i,update:s}}function Lw(e){let t=null,n=null;function r(e){return`${e.date}|${e.venueId}|${e.index}`}function i(){t&&(t.destroy(),t=null,n=null)}function a(t){let n=document.createElement(`div`);n.style.cssText=`font-family:sans-serif; font-size:13px; min-width:150px;`;let r=document.createElement(`div`);r.className=jw(),r.textContent=`Set Not Before Time`,r.addEventListener(`click`,()=>{i(),e.onSetNotBeforeTime(t)}),n.appendChild(r);let a=document.createElement(`div`);a.className=Nw(),n.appendChild(a);let o=document.createElement(`div`);return o.className=Mw(),o.textContent=`Remove Round`,o.addEventListener(`click`,()=>{i(),e.onDelete(t)}),n.appendChild(o),n}return{show(e,o){let s=r(o);if(n===s){i();return}i();let c=mm(e,{content:a(o),allowHTML:!0,interactive:!0,trigger:`manual`,placement:`bottom`,appendTo:document.body,onHidden:()=>{t=null,n=null}});t=c,n=s,c.show()},destroy(){i()},isActiveFor(e){return n===r(e)}}}function Rw(e){return structuredClone(e)}function zw(e,t,n){return Math.max(t,Math.min(n,e))}function Bw(e){return`${e.tournamentId}|${e.eventId}|${e.drawId}|${e.structureId}|${e.roundNumber}`}function Vw(e){return`${e.eventName?`${e.eventName} \u2013 `:``}${e.roundName??`Round ${e.roundNumber}`}${e.roundSegment?` (seg ${e.roundSegment.segmentNumber}/${e.roundSegment.segmentsCount})`:``}`}function Hw(e,t){return!e||!t?!1:e.date===t.date&&e.venueId===t.venueId&&e.index===t.index}function Uw(e){return{tournamentId:e.tournamentId,eventId:e.eventId,drawId:e.drawId,structureId:e.structureId,roundNumber:e.roundNumber}}function Ww(e,t,n){return e.find(e=>e.scheduleDate===t)?.venues?.find(e=>e.venueId===n)?.rounds??[]}function Gw(e,t){return(e.find(e=>e.scheduleDate===t.date)?.venues?.find(e=>e.venueId===t.venueId))?.rounds?.[t.index]??null}function Kw(e,t){return e.filter(e=>qw(e.context?.locator,t)||qw(e.context?.prerequisite,t))}function qw(e,t){return!!e&&e.date===t.date&&e.venueId===t.venueId&&e.index===t.index}function Jw(e){return e.length?e.some(e=>e.severity===`ERROR`)?`ERROR`:e.some(e=>e.severity===`WARN`)?`WARN`:`INFO`:null}function Yw(e,t){let n=Bw(t);for(let t of e)for(let e of t.venues)for(let r=0;r<e.rounds.length;r++){let i=e.rounds[r];if(Bw(Uw(i))===n)return{date:t.scheduleDate,venueId:e.venueId,index:r,roundKey:Uw(i),roundSegment:i.roundSegment}}return null}function Xw(){let e=document.createElement(`div`);e.className=qC();let t=document.createElement(`div`);t.className=JC();let n=document.createElement(`div`);n.className=YC(),n.textContent=`Inspector`,t.appendChild(n),e.appendChild(t);let r=document.createElement(`div`);r.className=Ew(),e.appendChild(r);function i(e){r.innerHTML=``;let t=e.selectedLocator;if(!t){let e=document.createElement(`div`);e.className=Aw(),e.textContent=`Select a round card on the board to see details and context.`,r.appendChild(e);return}let n=Gw(e.profileDraft,t);if(!n){let e=document.createElement(`div`);e.className=Aw(),e.textContent=`Selection no longer exists.`,r.appendChild(e);return}let i=Kw(e.ruleResults,t),a=Jw(i);if(Zw(r,`Event`,n.eventName??``),Zw(r,`Draw`,n.drawName||``),Zw(r,`Round`,n.roundName&&!/^rn=/.test(n.roundName)?n.roundName:`Round `+n.roundNumber),Zw(r,`Segment`,n.roundSegment?`${n.roundSegment.segmentNumber}/${n.roundSegment.segmentsCount}`:`—`),Zw(r,`Not before`,n.notBeforeTime??`—`),Zw(r,`Status`,a??`OK`),i.length){let e=document.createElement(`div`);e.className=Aw(),e.style.marginTop=`8px`,e.textContent=`Issues for this item:`,r.appendChild(e);for(let e of i){let t=document.createElement(`div`);t.className=Aw(),t.innerHTML=`\u2022 <b>${Qw(e.code)}</b>: ${Qw(e.message)}`,r.appendChild(t)}}else{let e=document.createElement(`div`);e.className=Aw(),e.style.marginTop=`8px`,e.textContent=`No issues associated with this card.`,r.appendChild(e)}}return{element:e,update:i}}function Zw(e,t,n){let r=document.createElement(`div`);r.className=Dw();let i=document.createElement(`div`);i.className=Ow(),i.textContent=t;let a=document.createElement(`div`);a.className=kw(),a.textContent=n,r.appendChild(i),r.appendChild(a),e.appendChild(r)}function Qw(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function $w(e,t,n,r=`dim`){let i=t.toLowerCase().trim();return e.filter(e=>r===`hide`&&n.has(Bw(e))?!1:i?`${e.eventName} ${e.drawName??``} ${e.roundName??``} ${e.drawId}`.toLowerCase().includes(i):!0).map(e=>({...e,isPlanned:n.has(Bw(e))}))}function eT(e,t){let n=new Map,r=e=>t===`draw`?`${e.eventName} \u2014 ${e.drawName??e.drawId}`:t===`round`?e.roundName??`Round ${e.roundNumber}`:e.eventName;for(let t of e){let e=r(t),i=n.get(e);i?i.push(t):n.set(e,[t])}return new Map([...n.entries()].sort((e,t)=>e[0].localeCompare(t[0],void 0,{numeric:!0})))}function tT(e){let t=new Set;for(let n of e)for(let e of n.venues)for(let n of e.rounds)n.roundSegment||t.add(Bw(n));return t}var nT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rT(e){return nT.test(e)}function iT(e){let t=document.createElement(`div`);t.className=qC(),t.style.overflowY=`auto`,t.style.scrollbarWidth=`thin`,t.style.scrollbarColor=`var(--sp-scrollbar) transparent`;let n=new Set,r=null,i=document.createElement(`div`);i.className=JC();let a=document.createElement(`div`);a.className=YC(),a.textContent=`Round Catalog`;let o=document.createElement(`div`);o.className=XC(),i.appendChild(a),i.appendChild(o),t.appendChild(i);let s=document.createElement(`div`);s.className=yw();let c=document.createElement(`input`);c.type=`text`,c.placeholder=`Search rounds...`,c.className=bw(),c.addEventListener(`input`,()=>e.onSearchChange(c.value));let l=document.createElement(`select`);l.className=xw();for(let[e,t]of[[`event`,`By Event`],[`draw`,`By Draw`],[`round`,`By Round`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,l.appendChild(n)}l.addEventListener(`change`,()=>e.onGroupByChange(l.value)),s.appendChild(c),s.appendChild(l),t.appendChild(s);let u=document.createElement(`div`);u.className=vw(),t.appendChild(u),u.addEventListener(`dragover`,e=>{e.preventDefault(),u.classList.add(`over`),e.dataTransfer.dropEffect=`move`}),u.addEventListener(`dragleave`,e=>{u.contains(e.relatedTarget)||u.classList.remove(`over`)}),u.addEventListener(`drop`,t=>{if(u.classList.remove(`over`),t.preventDefault(),!e.onDropRemove)return;let n;try{n=JSON.parse(t.dataTransfer.getData(`application/json`))}catch{return}n.type===`PLANNED_ROUND`&&e.onDropRemove(n.locator)});function d(t,n){let r=document.createElement(`div`);r.className=Tw(),t.isPlanned?(r.classList.add(n===`navigate`?`navigate`:`dimmed`),r.draggable=!1,n===`navigate`&&r.addEventListener(`click`,()=>{e.onNavigateToPlanned?.(t)})):(r.draggable=!0,r.addEventListener(`dragstart`,e=>{e.stopPropagation(),e.dataTransfer.setDragImage(r,r.offsetWidth/2,20),e.dataTransfer.setData(`application/json`,JSON.stringify({type:`CATALOG_ROUND`,roundRef:t})),e.dataTransfer.effectAllowed=`copyMove`}));let i=document.createElement(`div`);i.className=uw();let a=t.roundName&&!t.roundName.startsWith(`rn=`)?t.roundName:`Round `+t.roundNumber;i.textContent=`${t.eventName} \u2014 ${a}`;let o=document.createElement(`div`);o.className=dw();let s=t.matchCountEstimate?` · `+t.matchCountEstimate+` matches`:``,c=t.drawName&&!rT(t.drawName)?t.drawName:``;if(o.textContent=c?`${c}${s}`:s.replace(` · `,``)||``,r.appendChild(i),r.appendChild(o),t.isPlanned&&n!==`navigate`){let e=document.createElement(`span`);e.className=`sp-catalog-check`,e.textContent=`✓`,r.appendChild(e)}return r}function f(e){r=e;let t=e.plannedRoundBehavior,i=tT(e.profileDraft),a=$w(e.roundCatalog,e.catalogSearchQuery,i,t),s=eT(a,e.catalogGroupBy);o.textContent=`${a.length} rounds`,c.value!==e.catalogSearchQuery&&(c.value=e.catalogSearchQuery),l.value!==e.catalogGroupBy&&(l.value=e.catalogGroupBy),u.innerHTML=``;for(let[e,i]of s){let a=document.createElement(`div`);a.className=Sw();let o=n.has(e),s=document.createElement(`div`);s.className=Cw();let c=document.createElement(`span`);c.className=Fw(),c.textContent=o?`▶`:`▼`;let l=document.createElement(`span`);l.textContent=e,s.appendChild(c),s.appendChild(l),s.addEventListener(`click`,()=>{n.has(e)?n.delete(e):n.add(e),r&&f(r)});let p=document.createElement(`div`);p.className=ww(),o&&(p.style.display=`none`);for(let e of i)p.appendChild(d(e,t));a.appendChild(s),a.appendChild(p),u.appendChild(a)}}return{element:t,update:f}}function aT(e){let t=document.createElement(`div`);t.className=qC();let n=document.createElement(`div`);n.className=JC();let r=document.createElement(`div`);r.className=YC(),r.textContent=`Issues`;let i=document.createElement(`div`);i.className=XC(),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=fw(),t.appendChild(a);function o(t){let n=t.issueIndex.all;if(i.textContent=`${n.length} total (${t.issueIndex.bySeverity.ERROR.length} errors)`,a.innerHTML=``,!n.length){let e=document.createElement(`div`);e.className=Aw(),e.textContent=`No issues. Drag rounds into the board to build a profile.`,a.appendChild(e);return}for(let t of n.slice(0,30)){let n=document.createElement(`div`);n.className=pw(),t.severity===`ERROR`?n.classList.add(`error`):t.severity===`WARN`?n.classList.add(`warn`):n.classList.add(`info`);let r=document.createElement(`div`);r.className=mw(),r.textContent=`${t.severity} \u00b7 ${t.code}`;let i=document.createElement(`div`);if(i.className=hw(),i.textContent=t.message,n.appendChild(r),n.appendChild(i),t.fixActions?.length){let r=document.createElement(`div`);r.className=gw();for(let n of t.fixActions){let t=document.createElement(`button`);t.className=_w(),t.textContent=n.label??n.kind,t.addEventListener(`click`,()=>e.onFixAction(n)),r.appendChild(t)}n.appendChild(r)}a.appendChild(n)}}return{element:t,update:o}}var{ROUND_ROBIN:oT,ROUND_ROBIN_WITH_PLAYOFF:sT}=t.drawDefinitionConstants,cT=`Jump to prerequisite`;function lT({profile:e,temporal:t,dependencies:n,venueOrder:r}){let i=[];if(t?.isDateAvailable)for(let n of e){let e=t.isDateAvailable(n.scheduleDate);e.ok||i.push({code:`DATE_UNAVAILABLE`,severity:`ERROR`,message:`Can't schedule on ${n.scheduleDate} \u2014 day is unavailable${e.reason?`: `+e.reason:``}.`,context:{date:n.scheduleDate},fixActions:[{kind:`OPEN_TEMPORAL_GRID`,date:n.scheduleDate,label:`Open Temporal Grid`}]})}let a=_T(e);for(let e of a){let t=e.round.roundSegment;t&&(Number.isInteger(t.segmentNumber)&&Number.isInteger(t.segmentsCount)&&t.segmentsCount>=2&&t.segmentNumber>=1&&t.segmentNumber<=t.segmentsCount||i.push({code:`INVALID_SEGMENT_CONFIG`,severity:`ERROR`,message:`Invalid segment configuration for ${Vw(e.round)}.`,context:{locator:e.locator,date:e.locator.date,venueId:e.locator.venueId}}))}let o=new Map,s=new Map;for(let e of a){let t=e.round,n=Bw(t);if(!t.roundSegment)o.has(n)?i.push({code:`DUPLICATE_ROUND`,severity:`ERROR`,message:`Round is planned more than once: ${Vw(t)}.`,context:{scope:`${t.drawId}|${t.structureId}`,locator:e.locator,date:e.locator.date,venueId:e.locator.venueId},fixActions:[{kind:`JUMP_TO_ITEM`,locator:o.get(n),label:`Jump to existing`}]}):o.set(n,e.locator);else{let r=`${n}|${t.roundSegment.segmentNumber}/${t.roundSegment.segmentsCount}`;s.has(r)?i.push({code:`DUPLICATE_SEGMENT`,severity:`ERROR`,message:`Segment planned more than once: ${Vw(t)}.`,context:{scope:`${t.drawId}|${t.structureId}`,locator:e.locator,date:e.locator.date,venueId:e.locator.venueId},fixActions:[{kind:`JUMP_TO_ITEM`,locator:s.get(r),label:`Jump to existing`}]}):s.set(r,e.locator)}}return i.push(...dT({profile:e,venueOrder:r})),n?.getRoundDependencies&&i.push(...hT(a,n)),i}var uT=new Set([oT,sT]);function dT({profile:e}){let t=_T(e),n=fT(t),r=pT(t);return yT([...n,...r])}function fT(e){let t=[],n=vT(e,e=>`${e.round.structureId}|${e.locator.date}|${e.locator.venueId}`);for(let[e,r]of n.entries()){let n=r[0]?.round.structureType;if(!(n&&uT.has(n))){r.sort((e,t)=>e.locator.index-t.locator.index);for(let n=0;n<r.length;n++){let i=r[n],a=null;for(let e=n-1;e>=0;e--)if(r[e].round.roundNumber>i.round.roundNumber){a=r[e];break}if(!a)continue;let o=gT(r,n,a);t.push({code:`ROUND_ORDER_VIOLATION`,severity:`ERROR`,message:`Cannot place ${Vw(i.round)} before ${Vw(a.round)} in this venue.`,context:{scope:e,drawId:i.round.drawId,structureId:i.round.structureId,date:i.locator.date,venueId:i.locator.venueId,locator:i.locator,prerequisite:a.locator},fixActions:[{kind:`JUMP_TO_ITEM`,locator:a.locator,label:cT},...o.moveOffenderAfter?[{kind:`MOVE_ITEM_AFTER`,locator:i.locator,after:o.moveOffenderAfter,label:`Move offending round after prerequisite set`}]:[],...o.movePrereqBefore?[{kind:`MOVE_ITEM_BEFORE`,locator:a.locator,before:o.movePrereqBefore,label:`Move prerequisite before offending round`}]:[]]})}}}return t}function pT(e){let t=[],n=vT(e,e=>e.round.structureId);for(let[e,r]of n.entries()){let n=r[0]?.round.structureType;if(n&&uT.has(n))continue;let i=new Map;for(let e of r){let t=e.locator.date,n=i.get(t);n?n.push(e):i.set(t,[e])}let a=[...i.keys()].sort();if(a.length<2)continue;let o=-1/0,s=null;for(let n of a){let r=i.get(n);for(let i of r)i.round.roundNumber<o&&s&&t.push({code:`ROUND_ORDER_VIOLATION`,severity:`ERROR`,message:`${Vw(s.round)} is scheduled on ${s.locator.date} but its prerequisite ${Vw(i.round)} is on the later date ${n}.`,context:{scope:`cross-date|${e}`,drawId:s.round.drawId,structureId:e,date:s.locator.date,venueId:s.locator.venueId,locator:s.locator,prerequisite:i.locator,reason:`cross-date`},fixActions:[{kind:`JUMP_TO_ITEM`,locator:i.locator,label:cT}]});for(let e of r)e.round.roundNumber>o&&(o=e.round.roundNumber,s=e)}}return t}function mT(e,t){if(!(e.round.structureId===t.round.structureId&&e.locator.date===t.locator.date&&e.locator.venueId===t.locator.venueId)){if(e.locator.date<t.locator.date)return{code:`DEPENDENCY_VIOLATION`,severity:`ERROR`,message:`${Vw(e.round)} is scheduled on ${e.locator.date} but depends on ${Vw(t.round)} which is on the later date ${t.locator.date}.`,context:{date:e.locator.date,venueId:e.locator.venueId,locator:e.locator,prerequisite:t.locator,reason:`cross-date`},fixActions:[{kind:`JUMP_TO_ITEM`,locator:t.locator,label:cT}]};if(e.locator.date===t.locator.date&&e.locator.venueId===t.locator.venueId&&e.locator.index<t.locator.index)return{code:`DEPENDENCY_VIOLATION`,severity:`ERROR`,message:`${Vw(e.round)} is listed before its prerequisite ${Vw(t.round)} in the same venue on ${e.locator.date}.`,context:{date:e.locator.date,venueId:e.locator.venueId,locator:e.locator,prerequisite:t.locator,reason:`cross-structure-same-day`},fixActions:[{kind:`JUMP_TO_ITEM`,locator:t.locator,label:cT},{kind:`MOVE_ITEM_AFTER`,locator:e.locator,after:t.locator,label:`Move after prerequisite`},{kind:`MOVE_ITEM_BEFORE`,locator:t.locator,before:e.locator,label:`Move prerequisite before`}]}}}function hT(e,t){let n=[],r=vT(e,e=>Bw(e.round));for(let[e,i]of r.entries()){let a=t.getRoundDependencies(e);if(a.length)for(let e of a){let t=r.get(e);if(t)for(let e of i)for(let r of t){let t=mT(e,r);t&&n.push(t)}}}return yT(n)}function gT(e,t,n){let r=e[t],i=e.indexOf(n);for(let t=i+1;t<e.length;t++)e[t].round.roundNumber>=n.round.roundNumber&&(i=t);return{moveOffenderAfter:e[i].locator,movePrereqBefore:r.locator}}function _T(e){let t=[];for(let n of e)for(let e of n.venues)for(let r=0;r<e.rounds.length;r++){let i=e.rounds[r];t.push({round:i,locator:{date:n.scheduleDate,venueId:e.venueId,index:r,roundKey:Uw(i),roundSegment:i.roundSegment}})}return t}function vT(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i?i.push(r):n.set(e,[r])}return n}function yT(e){let t=new Set,n=[];for(let r of e){let e=r.code+`|`+r.message+`|`+(r.context?.scope??``)+`|`+JSON.stringify(r.context?.locator??{});t.has(e)||(t.add(e),n.push(r))}return n}function bT(e){let t={ERROR:[],WARN:[],INFO:[]},n={},r={},i={},a={total:e.length,ERROR:0,WARN:0,INFO:0,byDate:{},byVenue:{},byDraw:{}},o=e=>e===`ERROR`?0:e===`WARN`?1:2,s=(e,t)=>o(e.severity)-o(t.severity)||e.code.localeCompare(t.code)||e.message.localeCompare(t.message);for(let o of e){t[o.severity].push(o),a[o.severity]++;let e=o.context?.date??o.context?.locator?.date,s=o.context?.venueId??o.context?.locator?.venueId,c=o.context?.scope??(o.context?.drawId&&o.context?.structureId?`${o.context.drawId}|${o.context.structureId}`:void 0);e&&(n[e]??=[]).push(o),s&&(r[s]??=[]).push(o),c&&(i[c]??=[]).push(o),xT(a.byDate,e,o.severity),xT(a.byVenue,s,o.severity),xT(a.byDraw,c,o.severity)}for(let e of Object.keys(t))t[e].sort(s);for(let e of[n,r,i])for(let t of Object.keys(e))e[t].sort(s);return{all:e,bySeverity:t,byDate:n,byVenue:r,byDraw:i,counts:a}}function xT(e,t,n){if(!t)return;let r=e[t]??={total:0,ERROR:0,WARN:0,INFO:0};r.total++,r[n]++}function ST(e,t,n){let r=Rw(e),{date:i,venueId:a}=n,o=wT(CT(r,i),a);if(t.type===`CATALOG_ROUND`){let e={tournamentId:t.roundRef.tournamentId,eventId:t.roundRef.eventId,eventName:t.roundRef.eventName,drawId:t.roundRef.drawId,drawName:t.roundRef.drawName,structureId:t.roundRef.structureId,structureType:t.roundRef.structureType,roundNumber:t.roundRef.roundNumber,roundName:t.roundRef.roundName},i=zw(n.index,0,o.rounds.length);return o.rounds.splice(i,0,e),TT(o.rounds),{ok:!0,profile:r}}if(t.type===`PLANNED_ROUND`){let{locator:e}=t,s=wT(CT(r,e.date),e.venueId),[c]=s.rounds.splice(e.index,1);TT(s.rounds);let l=n.index;return e.date===i&&e.venueId===a&&e.index<l&&--l,l=zw(l,0,o.rounds.length),o.rounds.splice(l,0,c),TT(o.rounds),{ok:!0,profile:r}}return{ok:!1,profile:e}}function CT(e,t){let n=e.find(e=>e.scheduleDate===t);return n||(n={scheduleDate:t,venues:[]},e.push(n),e.sort((e,t)=>e.scheduleDate.localeCompare(t.scheduleDate))),n}function wT(e,t){let n=e.venues.find(e=>e.venueId===t);return n||(n={venueId:t,rounds:[]},e.venues.push(n)),n}function TT(e){for(let t=0;t<e.length;t++)e[t].sortOrder=t+1}var ET=class{constructor(e){this.listeners=new Set,this.config=e;let t={all:[],bySeverity:{ERROR:[],WARN:[],INFO:[]},byDate:{},byVenue:{},byDraw:{},counts:{total:0,ERROR:0,WARN:0,INFO:0,byDate:{},byVenue:{},byDraw:{}}};this.state={profileDraft:Rw(e.initialProfile??[]),venues:e.venues,roundCatalog:e.roundCatalog,schedulableDates:e.schedulableDates,activeDates:e.activeDates,selectedDate:e.selectedDate??e.schedulableDates[0]??null,selectedLocator:null,ruleResults:[],issueIndex:t,catalogSearchQuery:``,catalogGroupBy:`event`,plannedRoundBehavior:e.plannedRoundBehavior??`dim`},this.revalidate()}getState(){return this.state}getSchedulingProfile(){return Rw(this.state.profileDraft)}selectDate(e){this.state.selectedDate!==e&&this.setState({selectedDate:e,selectedLocator:null})}selectCard(e){this.setState({selectedLocator:e})}setCatalogSearch(e){this.setState({catalogSearchQuery:e})}setCatalogGroupBy(e){this.setState({catalogGroupBy:e})}navigateToRound(e){let t=Yw(this.state.profileDraft,{tournamentId:e.tournamentId,eventId:e.eventId,drawId:e.drawId,structureId:e.structureId,roundNumber:e.roundNumber});t&&this.setState({selectedDate:t.date,selectedLocator:t})}dropRound(e,t){try{let n=ST(this.state.profileDraft,e,t);if(!n.ok)return{ok:!1,errorMessage:`Invalid drop operation`};let r=new Set(this.state.ruleResults.filter(e=>e.severity===`ERROR`).map(DT)),i=lT({profile:n.profile,temporal:this.config.temporalAdapter,dependencies:this.config.dependencyAdapter,venueOrder:this.config.venueOrder}).filter(e=>e.severity===`ERROR`).filter(e=>!r.has(DT(e)));return i.length?(this.addRejectionNotice(i[0].message),{ok:!1,errorMessage:i[0].message}):(this.commitProfile(n.profile),{ok:!0})}catch(e){return{ok:!1,errorMessage:String(e)}}}removeRound(e){let t=Rw(this.state.profileDraft),n=t.find(t=>t.scheduleDate===e.date);if(!n)return;let r=n.venues.find(t=>t.venueId===e.venueId);if(r&&!(e.index<0||e.index>=r.rounds.length)){r.rounds.splice(e.index,1);for(let e=0;e<r.rounds.length;e++)r.rounds[e].sortOrder=e+1;this.commitProfile(t),this.state.selectedLocator?.date===e.date&&this.state.selectedLocator?.venueId===e.venueId&&this.state.selectedLocator?.index===e.index&&this.setState({selectedLocator:null})}}setNotBeforeTime(e,t){let n=Rw(this.state.profileDraft),r=n.find(t=>t.scheduleDate===e.date);if(!r)return;let i=r.venues.find(t=>t.venueId===e.venueId);if(!i)return;let a=i.rounds[e.index];a&&(t?a.notBeforeTime=t:delete a.notBeforeTime,this.commitProfile(n))}applyFixAction(e){if(e.kind===`JUMP_TO_ITEM`&&e.locator){this.setState({selectedDate:e.locator.date,selectedLocator:e.locator});return}if(e.kind===`OPEN_TEMPORAL_GRID`){this.config.onFixAction?.(e);return}if(e.kind===`MOVE_ITEM_AFTER`&&e.locator&&e.after){let t=OT(this.state.profileDraft,e.locator,e.after);this.commitProfile(t);return}if(e.kind===`MOVE_ITEM_BEFORE`&&e.locator&&e.before){let t=kT(this.state.profileDraft,e.locator,e.before);this.commitProfile(t);return}this.config.onFixAction?.(e)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state={...this.state,...e},this.emit()}commitProfile(e){this.state={...this.state,profileDraft:e},this.revalidate(),this.config.onProfileChanged?.(Rw(e))}addRejectionNotice(e){let t={code:`DROP_REJECTED`,severity:`WARN`,message:`Drop rejected: ${e}`,context:{}},n=[...this.state.ruleResults.filter(e=>e.code!==`DROP_REJECTED`),t],r=bT(n);this.state={...this.state,ruleResults:n,issueIndex:r},this.emit()}revalidate(){let e=lT({profile:this.state.profileDraft,temporal:this.config.temporalAdapter,dependencies:this.config.dependencyAdapter,venueOrder:this.config.venueOrder}),t=bT(e);this.state={...this.state,ruleResults:e,issueIndex:t},this.emit()}emit(){for(let e of this.listeners)e(this.state)}};function DT(e){return`${e.code}|${e.context?.scope??``}|${e.context?.structureId??``}|${e.context?.date??``}`}function OT(e,t,n){let r=Rw(e),i=AT(r,t);if(!i)return e;let a=jT(r,n.date,n.venueId),o=Math.min(a.length,n.index+1);return a.splice(o,0,i),r}function kT(e,t,n){let r=Rw(e),i=AT(r,t);if(!i)return e;let a=jT(r,n.date,n.venueId),o=Math.max(0,Math.min(a.length,n.index));return a.splice(o,0,i),r}function AT(e,t){let n=e.find(e=>e.scheduleDate===t.date);if(!n)return null;let r=n.venues.find(e=>e.venueId===t.venueId);return!r||t.index<0||t.index>=r.rounds.length?null:r.rounds.splice(t.index,1)[0]}function jT(e,t,n){let r=e.find(e=>e.scheduleDate===t);r||(r={scheduleDate:t,venues:[]},e.push(r));let i=r.venues.find(e=>e.venueId===n);return i||(i={venueId:n,rounds:[]},r.venues.push(i)),i.rounds}function MT(e,t){let{round:n,locator:r,isSelected:i,severity:a}=e,o=document.createElement(`div`);o.className=lw(),i&&o.classList.add(`selected`),a===`ERROR`?o.classList.add(`error`):a===`WARN`&&o.classList.add(`warn`),o.draggable=!0,o.addEventListener(`dragstart`,e=>{e.stopPropagation(),e.dataTransfer.setDragImage(o,o.offsetWidth/2,20),e.dataTransfer.setData(`application/json`,JSON.stringify({type:`PLANNED_ROUND`,locator:r})),e.dataTransfer.effectAllowed=`copyMove`}),o.addEventListener(`click`,e=>{e.stopPropagation(),t.onClick(r)}),t.onContextMenu&&o.addEventListener(`contextmenu`,e=>{e.preventDefault(),e.stopPropagation(),t.onContextMenu(r,o)});let s=document.createElement(`div`);s.className=uw();let c=n.roundName&&!n.roundName.startsWith(`rn=`)?n.roundName:`Round `+n.roundNumber;s.textContent=(n.eventName?n.eventName+` — `:``)+c,o.appendChild(s);let l=document.createElement(`div`);l.className=dw(),l.textContent=[n.drawName||``,n.matchCountEstimate?`${n.matchCountEstimate} matches`:``].filter(Boolean).join(` · `),o.appendChild(l);let u=document.createElement(`div`);return u.className=tw(),n.roundSegment&&u.appendChild(NT(`Seg ${n.roundSegment.segmentNumber}/${n.roundSegment.segmentsCount}`,`seg`)),n.notBeforeTime&&u.appendChild(NT(`NB ${n.notBeforeTime}`,`nb`)),a===`ERROR`?u.appendChild(NT(`Error`,`err`)):a===`WARN`&&u.appendChild(NT(`Warn`,`warn`)),u.children.length&&o.appendChild(u),o}function NT(e,t){let n=document.createElement(`div`);return n.className=nw()+` `+t,n.textContent=e,n}function PT(e){let t=document.createElement(`div`);t.className=qC();let n=document.createElement(`div`);n.className=JC();let r=document.createElement(`div`);r.className=YC(),r.textContent=`Day Plan`;let i=document.createElement(`div`);i.className=XC(),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=rw(),t.appendChild(a);function o(t){let n=t.selectedDate;i.textContent=n?`Selected: ${n}`:`Select a date`,a.innerHTML=``;let r=Math.max(1,t.venues.length);r>4?(a.classList.add(`sp-board-scroll`),a.style.gridTemplateColumns=``):(a.classList.remove(`sp-board-scroll`),a.style.gridTemplateColumns=`repeat(${r}, 1fr)`);for(let r of t.venues){let i=document.createElement(`div`);i.className=iw();let o=document.createElement(`div`);o.className=aw();let s=document.createElement(`div`),c=document.createElement(`div`);c.className=ow(),c.textContent=r.name;let l=document.createElement(`div`);l.className=sw(),l.textContent=``,s.appendChild(c),s.appendChild(l);let u=t.issueIndex.counts.byVenue[r.venueId],d=document.createElement(`div`);d.className=ew(),u?.ERROR?(d.classList.add(`err`),d.textContent=`${u.ERROR} err`):u?.WARN?(d.classList.add(`warn`),d.textContent=`${u.WARN} warn`):(d.classList.add(`ok`),d.textContent=`OK`),o.appendChild(s),o.appendChild(d);let f=document.createElement(`div`);if(f.className=cw(),f.dataset.venue=r.venueId,n){let i=Ww(t.profileDraft,n,r.venueId);if(!i.length){let e=document.createElement(`div`);e.className=Aw(),e.textContent=`Drop rounds here.`,f.appendChild(e)}i.forEach((i,a)=>{let o={date:n,venueId:r.venueId,index:a,roundKey:Uw(i),roundSegment:i.roundSegment},s=Jw(Kw(t.ruleResults,o)),c=MT({round:i,locator:o,isSelected:Hw(t.selectedLocator,o),severity:s},{onClick:e.onCardClick,onContextMenu:e.onCardContextMenu});f.appendChild(c)})}else{let e=document.createElement(`div`);e.className=Aw(),e.textContent=`Select a date to plan.`,f.appendChild(e)}let p=document.createElement(`div`);p.className=Pw(),p.style.display=`none`,f.addEventListener(`dragover`,e=>{if(!n)return;e.preventDefault(),f.classList.add(`over`),e.dataTransfer.dropEffect=`move`;let t=IT(f,e.clientY,p),r=FT(f,p);p.style.display=``,t<r.length?f.insertBefore(p,r[t]):f.appendChild(p)}),f.addEventListener(`dragleave`,e=>{f.contains(e.relatedTarget)||(f.classList.remove(`over`),p.style.display=`none`)}),f.addEventListener(`drop`,t=>{if(f.classList.remove(`over`),p.style.display=`none`,t.preventDefault(),!n)return;let i;try{i=JSON.parse(t.dataTransfer.getData(`application/json`))}catch{return}let a=IT(f,t.clientY,p),o={date:n,venueId:r.venueId,index:a};e.onDrop(i,o)}),i.appendChild(o),i.appendChild(f),a.appendChild(i)}}return{element:t,update:o}}function FT(e,t){return Array.from(e.querySelectorAll(`[draggable="true"]`)).filter(e=>e!==t)}function IT(e,t,n){let r=FT(e,n);for(let e=0;e<r.length;e++){let n=r[e].getBoundingClientRect();if(t<n.top+n.height/2)return e}return r.length}function LT(e){let t=document.createElement(`div`);t.className=qC();let n=document.createElement(`div`);n.className=JC();let r=document.createElement(`div`);r.className=YC(),r.textContent=`Dates`;let i=document.createElement(`div`);i.className=XC(),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=ZC(),t.appendChild(a);function o(t){i.textContent=`${t.schedulableDates.length} schedulable`,a.innerHTML=``;let n=t.activeDates?new Set(t.activeDates):null;for(let r of t.schedulableDates){let i=!n||n.has(r),o=t.issueIndex.counts.byDate[r],s=document.createElement(`div`);s.className=QC(),r===t.selectedDate&&s.classList.add(`selected`),i||s.classList.add(`inactive`),s.setAttribute(`data-date`,r);let c=document.createElement(`div`),l=document.createElement(`div`);l.style.cssText=`font-weight:800;font-size:12px`,l.textContent=r;let u=document.createElement(`div`);u.style.cssText=`font-size:11px;color:var(--sp-muted)`,u.textContent=i?`Active`:`Inactive`,c.appendChild(l),c.appendChild(u);let d=document.createElement(`div`);d.className=$C(),o?.ERROR&&d.appendChild(RT(`${o.ERROR} err`,`err`)),o?.WARN&&d.appendChild(RT(`${o.WARN} warn`,`warn`)),!o?.ERROR&&!o?.WARN&&d.appendChild(RT(`OK`,`ok`)),s.appendChild(c),s.appendChild(d),s.addEventListener(`click`,()=>e.onDateSelected(r)),a.appendChild(s)}}return{element:t,update:o}}function RT(e,t){let n=document.createElement(`div`);return n.className=ew()+` `+t,n.textContent=e,n}var zT=class{constructor(e){this.container=null,this.store=new ET(e),this.popover=Lw({onDelete:e=>{this.store.removeRound(e)},onSetNotBeforeTime:e=>{let t=prompt(`Enter not-before time (HH:MM):`,`10:00`);t!==null&&this.store.setNotBeforeTime(e,t||void 0)}});let t=LT({onDateSelected:e=>this.store.selectDate(e)}),n=aT({onFixAction:e=>this.store.applyFixAction(e)}),r=PT({onDrop:(e,t)=>{this.store.dropRound(e,t)},onCardClick:e=>this.store.selectCard(e),onCardContextMenu:(e,t)=>{this.popover.show(t,e)}}),i=iT({onSearchChange:e=>this.store.setCatalogSearch(e),onGroupByChange:e=>this.store.setCatalogGroupBy(e),onDropRemove:e=>this.store.removeRound(e),onNavigateToPlanned:e=>this.store.navigateToRound(e)}),a=Xw();this.layout=Iw({dateStrip:t,issuesPanel:n,venueBoard:r,roundCatalog:i,inspectorPanel:a},{hideLeft:e.hideLeft,catalogSide:e.catalogSide}),this.unsubscribe=this.store.subscribe(e=>{this.layout.update(e)}),this.layout.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.layout.element)}destroy(){this.unsubscribe(),this.popover.destroy(),this.container&&this.layout.element.parentNode===this.container&&this.layout.element.remove(),this.container=null}getProfile(){return this.store.getSchedulingProfile()}getStore(){return this.store}};function BT(e,t){let n=new zT(e);return n.render(t),n}var VT=class{constructor(){this.selectedDay=null,this.selectedVenue=null,this.selectedCourt=null,this.layerVisibility=new Map,this.listeners=new Set}setSelectedDay(e){this.selectedDay!==e&&(this.selectedDay=e,this.emit({selectedDay:e}))}getSelectedDay(){return this.selectedDay}setSelectedVenue(e){this.selectedVenue!==e&&(this.selectedVenue=e,this.emit({selectedVenue:e}))}getSelectedVenue(){return this.selectedVenue}setSelectedCourt(e){this.selectedCourt!==e&&(this.selectedCourt=e,this.emit({selectedCourt:e}))}getSelectedCourt(){return this.selectedCourt}setLayerVisibility(e,t){this.layerVisibility.set(e,t),this.emit({layerVisibility:new Map(this.layerVisibility)})}getLayerVisibility(){return new Map(this.layerVisibility)}isLayerVisible(e){return this.layerVisibility.get(e)??!0}getSnapshot(){return{selectedDay:this.selectedDay,selectedVenue:this.selectedVenue,selectedCourt:this.selectedCourt,layerVisibility:new Map(this.layerVisibility)}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(e){let t={type:`VIEW_CHANGED`,payload:e};for(let e of this.listeners)e(t)}},HT={AVAILABLE:`rgba(33, 141, 141, 0.15)`,BLOCKED:`#95a5a6`,PRACTICE:`#9b59b6`,MAINTENANCE:`#f39c12`,RESERVED:`#3498db`,CLOSED:`#2c3e50`,SCHEDULED:`#27ae60`,SOFT_BLOCK:`#5dade2`,HARD_BLOCK:`#e74c3c`,LOCKED:`#34495e`,UNSPECIFIED:`#ecf0f1`};function UT(e,t,n={}){let r=[],i=new Map;for(let e of t){let t=qT(e.ref);i.set(t,e)}let a=new Set;for(let t of e)for(let e of t.rails)a.add(qT(e.court));for(let e of a){let t=i.get(e);if(!t)continue;let n={id:e,content:t.name,courtRef:t.ref,surface:t.surface,indoor:t.indoor,hasLights:t.hasLights,tags:t.tags};r.push(n)}return r}function WT(e,t={}){let{layerVisibility:n=new Map,showSegmentLabels:r=!1,colorScheme:i=HT}=t,a=[];for(let t of e)for(let e of t.rails){let t=qT(e.court);for(let o of e.segments){if(!(n.get(o.status)??!0))continue;let e=`${t}-${o.start}-${o.status}`,s=i[o.status];a.push({id:e,group:t,content:r?GT(o):``,start:o.start,end:o.end,type:`background`,className:`temporal-segment segment-${o.status.toLowerCase()}`,style:s===`transparent`?void 0:`background-color: ${s};`,title:`${o.status} segment`,editable:!1,selectable:!1,status:o.status,contributingBlocks:o.contributingBlocks,isSegment:!0})}}return a}function GT(e){let t=Math.round((new Date(e.end).getTime()-new Date(e.start).getTime())/(1e3*60));return`${e.status} (${t}m)`}function KT(e,t={}){let{colorScheme:n=HT}=t,r=[];for(let t of e){let e=qT(t.court),i=n[t.type],a=JT(i,-20);r.push({id:`block-${t.id}`,group:e,content:t.reason||t.type,start:t.start,end:t.end,type:`range`,className:`temporal-block block-${t.type.toLowerCase()}`,style:`background-color: ${i}; border-color: ${a};`,title:t.reason||t.type,editable:{updateTime:!0,updateGroup:!0,remove:!1},blockId:t.id,status:t.type,reason:t.reason,isBlock:!0})}return r}function qT(e){return`${e.tournamentId}|${e.venueId}|${e.courtId}`}function JT(e,t){if(!e||!e.startsWith(`#`))return e;let n=parseInt(e.replace(`#`,``),16),r=Math.round(2.55*t),i=(n>>16)+r,a=(n>>8&255)+r,o=(n&255)+r;return`#`+(16777216+(i<255?i<1?0:i:255)*65536+(a<255?a<1?0:a:255)*256+(o<255?o<1?0:o:255)).toString(16).slice(1)}function YT(e){let t=e.split(`|`);return t.length===3?{tournamentId:t[0],venueId:t[1],courtId:t[2]}:null}function XT(e){let t=String(e);return t.startsWith(`block-`)?t.slice(6):null}function ZT(e){let t=new Date(`${e.day}T${e.dayStartTime}:00`),n=new Date(`${e.day}T${e.dayEndTime}:00`);return{start:t,end:n,min:t,max:n,zoomMin:e.slotMinutes*4*60*1e3,zoomMax:(n.getTime()-t.getTime())*1.5}}var QT=u({EventEmitter:()=>wD,PluginRegistry:()=>bE,TimepickerUI:()=>kD,default:()=>AD});function $T(e){let t=e.target,n=t.hasAttribute(`data-md3-ripple`)?t:t.closest(`[data-md3-ripple]`);if(!n||e.button!==0&&e.pointerType===`mouse`)return;let r=n.getBoundingClientRect(),i=Math.max(r.width,r.height)*2,a=e.clientX-r.left,o=e.clientY-r.top;n.style.setProperty(`--ripple-size`,`${i}px`),n.style.setProperty(`--ripple-x`,`${a}px`),n.style.setProperty(`--ripple-y`,`${o}px`),n.classList.remove(vD,yD),n.offsetWidth,n.classList.add(vD,yD),n._rippleHold=!0,bD=n}function eE(e){let t=e.target,n=(t.hasAttribute(`data-md3-ripple`)?t:t.closest(`[data-md3-ripple]`))||bD;n&&(n._rippleHold=!1,n.classList.remove(yD),setTimeout(()=>{n.classList.remove(vD),bD===n&&(bD=null)},1e3))}function tE(e){let t=e.currentTarget;!t||!t._rippleHold||(t._rippleHold=!1,t.classList.remove(yD),setTimeout(()=>{t.classList.remove(vD),bD===t&&(bD=null)},1e3))}function nE(e){if(aE()===!1)return;let t=e||document;t.addEventListener(`pointerdown`,$T),t.addEventListener(`pointerup`,eE),t.addEventListener(`pointercancel`,eE),t.querySelectorAll(`[data-md3-ripple]`).forEach(e=>{e.addEventListener(`mouseleave`,tE)})}function rE(e={}){let t={clock:{...TD.clock,...e.clock},ui:{...TD.ui,...e.ui},labels:{...TD.labels,...e.labels},behavior:{...TD.behavior,...e.behavior},callbacks:{...TD.callbacks,...e.callbacks},timezone:{...TD.timezone,...e.timezone},range:{...TD.range,...e.range},wheel:{...TD.wheel,...e.wheel},clearBehavior:{...TD.clearBehavior,...e.clearBehavior}},n=t.ui.mode;return(n===`wheel`||n===`compact-wheel`)&&(t.wheel={placement:n===`compact-wheel`?`auto`:void 0,hideFooter:void 0,commitOnScroll:void 0,ignoreOutsideClick:void 0,...t.wheel}),t}var iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,JE,YE,XE,ZE,QE,$E,eD,tD,nD,rD,iD,aD,oD,sD,cD,lD,uD,dD,fD,pD,mD,hD,gD,_D,vD,yD,bD,xD,SD,CD,wD,TD,ED,DD,OD,kD,AD,jD=c((()=>{iE=()=>typeof window>`u`,aE=()=>typeof document<`u`,oE=class{state;constructor(e,t,n,r){this.state={degreesHours:null,degreesMinutes:null,options:t,element:e,instanceId:n,isMobileView:!1,isTouchMouseMove:!1,disabledTime:null,cloned:null,isModalRemove:!0,isOpen:!1,isInitialized:!1,customId:r,eventHandlersRegistered:!1,isDestroyed:!1}}get degreesHours(){return this.state.degreesHours}get degreesMinutes(){return this.state.degreesMinutes}get options(){return this.state.options}get element(){return this.state.element}get instanceId(){return this.state.instanceId}get isMobileView(){return this.state.isMobileView}get isTouchMouseMove(){return this.state.isTouchMouseMove}get disabledTime(){return this.state.disabledTime}get cloned(){return this.state.cloned}get isModalRemove(){return this.state.isModalRemove}get isOpen(){return this.state.isOpen}get isInitialized(){return this.state.isInitialized}get customId(){return this.state.customId}get eventHandlersRegistered(){return this.state.eventHandlersRegistered}get isDestroyed(){return this.state.isDestroyed}setDegreesHours(e){this.state={...this.state,degreesHours:e}}setDegreesMinutes(e){this.state={...this.state,degreesMinutes:e}}setOptions(e){this.state={...this.state,options:e}}setIsMobileView(e){this.state={...this.state,isMobileView:e}}setIsTouchMouseMove(e){this.state={...this.state,isTouchMouseMove:e}}setDisabledTime(e){this.state={...this.state,disabledTime:e}}setCloned(e){this.state={...this.state,cloned:e}}setIsModalRemove(e){this.state={...this.state,isModalRemove:e}}setIsOpen(e){this.state={...this.state,isOpen:e}}setIsInitialized(e){this.state={...this.state,isInitialized:e}}setEventHandlersRegistered(e){this.state={...this.state,eventHandlersRegistered:e}}setIsDestroyed(e){this.state={...this.state,isDestroyed:e}}updateOptions(e){this.state={...this.state,options:{...this.state.options,clock:{...this.state.options.clock,...e.clock||{}},ui:{...this.state.options.ui,...e.ui||{}},labels:{...this.state.options.labels,...e.labels||{}},behavior:{...this.state.options.behavior,...e.behavior||{}},callbacks:{...this.state.options.callbacks,...e.callbacks||{}}}}}reset(){this.state={...this.state,degreesHours:null,degreesMinutes:null,isTouchMouseMove:!1,disabledTime:null,cloned:null,isModalRemove:!0,isOpen:!1,isInitialized:!1,isDestroyed:!0,eventHandlersRegistered:!1}}getModalElement(){return aE()===!1?null:document.querySelector(`[data-owner-id="${this.state.instanceId}"]`)}getInput(){return this.state.element?.querySelector(`input`)}getClockFace(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-clock-face.mobile`):e.querySelector(`.tp-ui-clock-face:not(.mobile)`):null}getClockHand(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-mobile-clock-wrapper .tp-ui-clock-hand`):e.querySelector(`.tp-ui-clock-hand:not(.mobile)`):null}getCircle(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-mobile-clock-wrapper .tp-ui-circle-hand`):e.querySelector(`.tp-ui-circle-hand:not(.mobile)`):null}getTipsWrapper(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper`):e.querySelector(`.tp-ui-tips-wrapper:not(.mobile)`):null}getTipsWrapperFor24h(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(`.tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper-24h`):e.querySelector(`.tp-ui-tips-wrapper-24h:not(.mobile)`):null}getMinutes(){return this.getModalElement()?.querySelector(`.tp-ui-minutes`)||null}getHour(){return this.getModalElement()?.querySelector(`.tp-ui-hour`)||null}getAM(){return this.getModalElement()?.querySelector(`.tp-ui-am`)||null}getPM(){return this.getModalElement()?.querySelector(`.tp-ui-pm`)||null}getHourText(){return this.getModalElement()?.querySelector(`.tp-ui-hour-text`)||null}getMinutesText(){return this.getModalElement()?.querySelector(`.tp-ui-minute-text`)||null}getHeader(){return this.getModalElement()?.querySelector(`.tp-ui-header`)||null}getInputWrappers(){return this.getModalElement()?.querySelectorAll(`.tp-ui-input-wrapper`)||null}getDots(){return this.getModalElement()?.querySelector(`.tp-ui-dots`)||null}getMinutesTips(){return this.getModalElement()?.querySelector(`.tp-ui-minutes-time`)||null}getHourTips(){return this.getModalElement()?.querySelector(`.tp-ui-hour-time-12`)||null}getAllValueTips(){let e=this.getModalElement();return e?[...e.querySelectorAll(`.tp-ui-value-tips`),...e.querySelectorAll(`.tp-ui-value-tips-24h`)]:[]}getOpenElementData(){let e=this.state.element?.querySelectorAll(`[data-open]`);if(e?.length>0){let t=[];return e.forEach(({dataset:e})=>t.push(e.open??``)),[...new Set(t)]}return null}getOpenElement(){let e=this.getInput(),t=this.getOpenElementData();return t===null?(e?.setAttribute(`data-open`,`tp-ui-input`),[e]):t.map(e=>this.state.element?.querySelectorAll(`[data-open='${e}']`))[0]??``}getCancelButton(){return this.getModalElement()?.querySelector(`.tp-ui-cancel-btn`)||null}getOkButton(){return this.getModalElement()?.querySelector(`.tp-ui-ok-btn`)||null}getActiveTypeMode(){return this.getModalElement()?.querySelector(`.tp-ui-type-mode.active`)||null}getKeyboardClockIcon(){return this.getModalElement()?.querySelector(`.tp-ui-keyboard-icon-wrapper`)||null}getFooter(){return this.getModalElement()?.querySelector(`.tp-ui-footer`)||null}getWrapper(){return this.getModalElement()?.querySelector(`.tp-ui-wrapper`)||null}},sE={DEFAULT_DELAY:300,MODAL_ANIMATION:150,SCROLLBAR_RESTORE:400,MODAL_REMOVE:300,CLOCK_ANIMATION:600,TIPS_ANIMATION:401,MOBILE_TOGGLE:450,CLOCK_SCALE_DELAY:150,WRAPPER_TRANSITION:400,DROPDOWN_CLICK_DELAY:10},cE=class{core;emitter;timeouts=[];constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on(`animation:clock`,()=>{this.handleAnimationSwitchTipsMode()})}runWithAnimation(e,t=sE.MODAL_ANIMATION){if(this.core.options.ui.animation){let n=setTimeout(e,t);this.timeouts.push(n)}else e()}clearAllTimeouts(){this.timeouts.forEach(clearTimeout),this.timeouts=[]}setAnimationToOpen(){this.clearAllTimeouts(),this.core.getModalElement()?.classList.add(`opacity`),this.runWithAnimation(()=>{this.core.getModalElement()?.classList.add(`show`)})}removeAnimationToClose(){this.clearAllTimeouts(),this.core.getModalElement()&&this.runWithAnimation(()=>{let e=this.core.getModalElement();e?.classList.remove(`show`),e?.classList.remove(`opacity`)})}handleAnimationClock(){this.core.options.ui.animation&&this.runWithAnimation(()=>{this.core.getClockFace()?.classList.add(`tp-ui-clock-animation`);let e=setTimeout(()=>{this.core.getClockFace()?.classList.remove(`tp-ui-clock-animation`)},sE.CLOCK_ANIMATION);this.timeouts.push(e)})}handleAnimationSwitchTipsMode(){let e=this.core.getClockHand();if(!e)return;this.emitter.emit(`animation:start`,{}),e.classList.add(`tp-ui-tips-animation`);let t=setTimeout(()=>{this.core.getClockHand()?.classList.remove(`tp-ui-tips-animation`),this.emitter.emit(`animation:end`,{})},sE.TIPS_ANIMATION);this.timeouts.push(t)}destroy(){this.clearAllTimeouts()}},lE=()=>{if(aE()===!1)return 0;let e=document.createElement(`div`);e.className=`tp-ui-measure`,document.body.appendChild(e);let t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t},uE=(e,t)=>e?e.classList.contains(t):!1,dE=(e,t)=>Array.from({length:Number(t)-Number(e)+1},(t,n)=>Number(e)+n),fE=(e,t)=>Array.from({length:Number(t)-Number(e)+1},(e,n)=>Number(t)-n).reverse(),pE=(e=``)=>{let t=e.replace(/(AM|PM|am|pm)/,e=>` ${e}`),n=new Date(`September 20, 2000 ${t}`);return`${n.getHours().toString().padStart(2,`0`)}:${n.getMinutes().toString().padStart(2,`0`)}`},mE=e=>{let[t,n]=e.split(`:`);return`${t.padStart(2,`0`)}:${n.padStart(2,`0`)}`},hE=(e,t)=>{if(e.length<2)return!1;let n=e.map(e=>{let[n,r]=e.trim().split(`-`),i,a;if(t===`12h`){if(!/\s?(AM|PM|am|pm)\s?$/.test(n.trim())||!/\s?(AM|PM|am|pm)\s?$/.test(r.trim()))throw Error(`Invalid 12h format: "${e}"`);i=pE(n.trim()),a=pE(r.trim())}else{if(/\s?(AM|PM|am|pm)\s?/.test(n.trim())||/\s?(AM|PM|am|pm)\s?/.test(r.trim()))throw Error(`Invalid 24h format: "${e}"`);i=mE(n.trim()),a=mE(r.trim())}return{start:i,end:a,original:e}});for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let r=n[e],i=n[t];if(r.start<=i.end&&r.end>=i.start||i.start<=r.end&&i.end>=r.start)throw Error(`Overlapping intervals: "${r.original}" and "${i.original}"`)}return!1},gE=()=>typeof window<`u`&&window.crypto&&typeof window.crypto.randomUUID==`function`?window.crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)}),_E=`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M160-200q-33 0-56.5-23.5T80-280v-400q0-33 23.5-56.5T160-760h640q33 0 56.5 23.5T880-680v400q0 33-23.5 56.5T800-200H160Zm0-80h640v-400H160v400Zm160-40h320v-80H320v80ZM200-440h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80ZM200-560h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80ZM160-280v-400 400Z"/></svg>`,vE=`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z"/></svg>`,yE=class{plugins=new Map;register(e){this.plugins.has(e.name)||this.plugins.set(e.name,e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}get(e){return this.plugins.get(e)}getTemplateProvider(e){return this.plugins.get(e)?.templateProvider}getClearHandler(e){return this.plugins.get(e)?.clearHandler}},bE=new yE,xE=[`00`,`13`,`14`,`15`,`16`,`17`,`18`,`19`,`20`,`21`,`22`,`23`],SE=[`12`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`],CE=[`00`,`05`,`10`,`15`,`20`,`25`,`30`,`35`,`40`,`45`,`50`,`55`],wE=(e,t,n)=>{let{timezone:{enabled:r,label:i}}=e;return!r||!bE.has(`timezone`)?``:`<div class="tp-ui-timezone ${t}">
224
224
  <span class="tp-ui-timezone-label" id="tp-tz-label-${n}">${i}</span>
225
225
  <div class="tp-ui-timezone-dropdown" role="combobox" aria-expanded="false" aria-haspopup="listbox" aria-labelledby="tp-tz-label-${n}" tabindex="0" data-tz-id="${n}">
226
226
  <div class="tp-ui-timezone-selected" data-placeholder="${i}...">${i}...</div>
227
227
  <svg class="tp-ui-timezone-arrow" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>
228
228
  <div class="tp-ui-timezone-menu" role="listbox" aria-labelledby="tp-tz-label-${n}"></div>
229
229
  </div>
230
- </div>`},TE=e=>{let{range:{enabled:t,fromLabel:n,toLabel:r}}=e;return!t||!bE.has(`range`)?``:`<div class="tp-ui-range-header" role="tablist" aria-label="Range selection"><button type="button" class="tp-ui-range-tab tp-ui-range-from active" role="tab" tabindex="0" aria-selected="true"><span class="tp-ui-range-tab-label">${n}</span><span class="tp-ui-range-tab-value tp-ui-range-from-time">--:--</span></button><button type="button" class="tp-ui-range-tab tp-ui-range-to" role="tab" tabindex="-1" aria-selected="false"><span class="tp-ui-range-tab-label">${r}</span><span class="tp-ui-range-tab-value tp-ui-range-to-time">--:--</span></button></div>`},EE=(e,t)=>{let{ui:{clearButton:n},labels:{clear:r}}=e;return n?`<div class="tp-ui-clear-btn ${t} disabled" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${r}" aria-disabled="true">${r}</div>`:``},DE=(e,t,n)=>{if(e.isWheelMode){let t=bE.getTemplateProvider(`wheel`);return t?`<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}">${t(n,e.instanceId)}</div>`:`<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}"></div>`}return`<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}"><div class="tp-ui-body ${e.mobileClass}"><div class="tp-ui-clock-face ${e.mobileClass}" role="group" aria-label="Clock"><div class="tp-ui-dot ${e.mobileClass}" aria-hidden="true"></div><div class="tp-ui-clock-hand ${e.mobileClass}" aria-hidden="true"><div class="tp-ui-circle-hand ${e.mobileClass}"></div></div><div class="tp-ui-tips-wrapper ${e.mobileClass}" role="listbox" aria-label="Time"></div>${e.clockType===`24h`?`<div class="tp-ui-tips-wrapper-24h ${e.mobileClass}" role="listbox" aria-label="24h"></div>`:``}</div></div></div>`},OE=(e,t)=>{let{labels:{time:n,mobileTime:r,am:i,pm:a,mobileMinute:o,mobileHour:s},ui:{editable:c}}=e,{mobileClass:l,clockType:u,instanceId:d}=t,f=l?r:n,p=u===`24h`?``:`<div class="tp-ui-wrapper-type-time ${l}" role="group" aria-label="Period"><div class="tp-ui-type-mode tp-ui-am ${l?`mobile`:`tp-ui-ripple`}" data-md3-ripple tabindex="0" role="button" aria-label="${i}" aria-pressed="false" data-type="AM">${i}</div><div class="tp-ui-type-mode tp-ui-pm ${l?`mobile`:`tp-ui-ripple`}" data-md3-ripple tabindex="0" role="button" aria-label="${a}" aria-pressed="false" data-type="PM">${a}</div></div>`;return`<div class="tp-ui-select-time ${l}" id="tp-ui-label-${d}">${f}</div><div class="tp-ui-header ${l}"><div class="tp-ui-wrapper-time ${l} ${u===`24h`?`tp-ui-wrapper-time-24h`:``}" role="group" aria-label="${f}"><div class="tp-ui-input-wrapper ${l}"><div class="tp-ui-input-ripple-wrapper ${l}" data-md3-ripple><input name="hour" ${!c&&!l?`readonly`:``} class="tp-ui-hour ${l}" tabindex="0" type="number" min="0" max="${u===`12h`?`12`:`23`}" aria-label="${l?s:`Hour`}" role="spinbutton" aria-valuenow="12"></div><div class="tp-ui-hour-text ${l}">${s}</div></div><div class="tp-ui-dots ${l}" aria-hidden="true"><span></span><span></span></div><div class="tp-ui-input-wrapper ${l}"><div class="tp-ui-input-ripple-wrapper ${l}" data-md3-ripple><input name="minutes" ${!c&&!l?`readonly`:``} class="tp-ui-minutes ${l}" tabindex="0" type="number" min="0" max="59" aria-label="${l?o:`Minute`}" role="spinbutton" aria-valuenow="0"></div><div class="tp-ui-minute-text ${l}">${o}</div></div></div>${p}</div>`},kE=(e,t)=>{let{ui:{enableSwitchIcon:n,iconTemplate:r,iconTemplateMobile:i},labels:{cancel:a,ok:o}}=e,s=`<button aria-label="Keyboard" type="button" class="tp-ui-keyboard-icon">${r||_E}</button>`,c=i||`<button aria-label="Clock" type="button" class="tp-ui-keyboard-icon">${i||vE}</button>`,l=n?`<div class="tp-ui-keyboard-icon-wrapper ${t}" tabindex="0" role="button" aria-pressed="false" aria-label="Toggle" data-view="desktop">${t?c:s}</div>`:``,u=EE(e,t);return`<div class="tp-ui-footer ${t}" ${t?`data-view="mobile"`:``}>${l}<div class="tp-ui-wrapper-btn ${t}">${u}<div class="tp-ui-cancel-btn ${t}" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${a}">${a}</div><div class="tp-ui-ok-btn ${t}" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${o}">${o}</div></div></div>`},AE=(e,t)=>{let{ui:{mode:n,animation:r,theme:i,mobile:a},clock:{incrementMinutes:o}}=e,s=a?`mobile`:``,c=n===`compact-wheel`&&bE.has(`wheel`),l=(n===`wheel`||c)&&bE.has(`wheel`),u=!!e.range?.enabled&&bE.has(`range`),d=!!e.timezone?.enabled&&bE.has(`timezone`),f={mobileClass:s,clockType:e.clock.type||`12h`,instanceId:t,isWheelMode:l,isCompactWheel:c,isRangeMode:u},p=TE(e),m=wE(e,s,t),h=c?``:OE(e,f),g=DE(f,o??1,e),_=c&&e.wheel?.hideFooter===!0?``:kE(e,s),v;return v=c?` tp-ui-compact-wheel-mode`:l?` tp-ui-wheel-mode`:``,`<div class="tp-ui-modal normalize ${s}${u?` tp-ui-range-mode`:``}${d?` tp-ui-tz-mode`:``}${v}" data-theme="${i}" role="dialog" aria-modal="true" aria-labelledby="tp-ui-label-${t}" data-owner-id="${t}" style='transition:${r?`opacity 0.15s linear`:`none`}'><div class="tp-ui-wrapper ${s}" tabindex="0">${p}${h}${m}${g}${_}</div><div class="timepicker-announcer sr-only" role="status" aria-live="polite" aria-atomic="true"></div></div>`},jE=class{core;emitter;timeouts=[];originalOverflow;originalPaddingRight;constructor(e,t){this.core=e,this.emitter=t}runWithTimeout(e,t=sE.DEFAULT_DELAY){let n=setTimeout(e,t);this.timeouts.push(n)}clearAllTimeouts(){this.timeouts.forEach(clearTimeout),this.timeouts=[]}isPopoverMode(){return this.core.options.ui.mode===`compact-wheel`&&!!this.core.options.wheel?.placement}clearExistingModal(){if(aE()===!1)return;let e=this.core.getModalElement();e&&e.remove()}setModalTemplate(){if(aE()===!1)return;this.clearExistingModal();let e=AE(this.core.options,this.core.instanceId);if(this.core.options.ui.inline?.enabled){let t=document.getElementById(this.core.options.ui.inline.containerId);if(!t)return;t.innerHTML=``,t.insertAdjacentHTML(`beforeend`,e);let n=t.querySelector(`.tp-ui-modal`);if(n){n.classList.add(`tp-ui--inline`);let{showButtons:e}=this.core.options.ui.inline;(e===!1||e===void 0)&&n.querySelectorAll(`.tp-ui-wrapper-btn, .tp-ui-wrapper-btn.mobile`).forEach(e=>e.style.display=`none`)}return}let{appendModalSelector:t}=this.core.options.ui;t?document.querySelector(t)?.insertAdjacentHTML(`beforeend`,e):document.body.insertAdjacentHTML(`beforeend`,e)}setScrollbarOrNot(){aE()!==!1&&(this.core.options.ui.inline?.enabled||this.isPopoverMode()||(this.core.options.ui.enableScrollbar?this.runWithTimeout(()=>{iE()||this.runWithTimeout(()=>{typeof document<`u`&&(document.body.style.overflowY=this.originalOverflow||``,document.body.style.paddingRight=this.originalPaddingRight||``)},sE.SCROLLBAR_RESTORE)},400):(this.originalOverflow=document.body.style.overflowY,this.originalPaddingRight=document.body.style.paddingRight,document.body.style.paddingRight=`${lE()}px`,document.body.style.overflowY=`hidden`)))}removeBackdrop(){if(this.core.options.ui.inline?.enabled||this.core.options.ui.backdrop)return;let e=this.core.getModalElement(),t=this.core.getOpenElement();e?.classList.add(`removed`),t.forEach(e=>e?.classList.add(`disabled`))}setNormalizeClass(){let e=this.core.getModalElement();e&&(e.classList.add(`tp-ui-normalize`),e.querySelectorAll(`:scope > div`).forEach(e=>e.classList.add(`tp-ui-normalize`)))}setShowClassToBackdrop(){if(this.core.options.ui.inline?.enabled||this.isPopoverMode()){this.core.getModalElement()?.classList.add(`show`),this.setInitialFocus();return}this.core.options.ui.backdrop&&this.runWithTimeout(()=>{this.core.getModalElement()?.classList.add(`show`),this.setInitialFocus()},sE.MODAL_ANIMATION)}setInitialFocus(){if(!this.core.options.behavior.focusTrap)return;let e=this.core.getWrapper();e&&typeof requestAnimationFrame<`u`&&requestAnimationFrame(()=>{e.focus()})}setFlexEndToFooterIfNoKeyboardIcon(){let e=this.core.getFooter();!this.core.options.ui.enableSwitchIcon&&e&&(e.style.justifyContent=`flex-end`)}destroy(){this.clearAllTimeouts(),!iE()&&!this.core.options.ui.inline?.enabled&&(document.body.style.overflowY=this.originalOverflow||``,document.body.style.paddingRight=this.originalPaddingRight||``),this.clearExistingModal()}},ME=(e,t,n,r)=>{let i={hour:`12`,minutes:`00`,type:t===`24h`?void 0:`PM`};if(!e)return i;let a=e.value.trim();if(!n&&!a)return i;if(typeof n==`boolean`&&n){let[e,n]=new Date().toLocaleTimeString().split(`:`),r=e.padStart(2,`0`);if(/[a-z]/i.test(n)&&t===`12h`){let[e,t]=n.split(` `);return{hour:r,minutes:e,type:t}}return{hour:r,minutes:n,type:void 0}}if(typeof n==`object`){let{time:e,locales:i,preventClockType:a}=n,o=e??new Date;if(a&&r){let[e,t]=new Date(o).toLocaleTimeString().split(`:`);if(/[a-z]/i.test(t)){let[n,r]=t.split(` `);return{hour:e,minutes:n,type:r}}return{hour:e.padStart(2,`0`),minutes:t,type:void 0}}let[s,c]=new Date(o).toLocaleTimeString(i||`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:t===`12h`}).split(`:`);if(t===`12h`&&/[a-z]/i.test(c)){let e=c.trim().split(` `);return{hour:s,minutes:e[0],type:e[1]||`AM`}}return{hour:s,minutes:c.replace(/\D/g,``),type:void 0}}let[o,s]=a.split(` `),[c=``,l=``]=o.split(`:`),u=c.replace(/\D/g,``),d=l.replace(/\D/g,``),f={hour:u.padStart(2,`0`),minutes:d.padStart(2,`0`),type:t===`12h`?s:void 0};if(u.length>2||d.length>2)return{...f,error:`Invalid input: too many digits.`,currentHour:c,currentMin:l};if(/[a-z]/i.test(o))return{...f,error:`Input contains invalid letters.`};if(a.includes(` `)&&(!s||a.length>8||s!==`AM`&&s!==`PM`))return{...f,error:`Invalid AM/PM format or length.`,currentLength:a.length,currentType:s};let p=Number(u),m=Number(d);if(t===`12h`){if(p<1||p>12||m<0||m>59||s!==`AM`&&s!==`PM`)return{...f,error:`Invalid 12h time.`,currentHour:p,currentMin:m,currentType:s}}else if(p<0||p>23||m<0||m>59)return{...f,error:`Invalid 24h time.`,currentHour:p,currentMin:m};return f},NE=(e,t,n)=>{let r=Number(e);if(Number.isNaN(r))return!1;switch(t){case`hour`:return n===`24h`?r>=0&&r<=23:r>0&&r<=12;case`minutes`:return r>=0&&r<=59;default:return}},PE=`tp-ui`,FE=`mousedown mouseup mousemove mouseleave mouseover touchstart touchmove touchend`,IE=`active`,LE=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}isCurrentTimeEnabled(e){let t=this.core.options.clock.currentTime;return typeof t==`boolean`?t:!!t?.[e]}preventClockTypeByCurrentTime(){if(!this.isCurrentTimeEnabled(`preventClockType`))return;let e=this.core.getInput();if(!e)return;let{currentTime:t,clockType:n}={currentTime:this.core.options.clock.currentTime,clockType:this.core.options.clock.type},{type:r}=ME(e,n,t,!0);this.core.updateOptions({clock:{type:r?`12h`:`24h`}})}updateInputValueWithCurrentTimeOnStart(){if(!this.isCurrentTimeEnabled(`updateInput`))return;let e=this.core.getInput();if(!e)return;let{hour:t,minutes:n,type:r}=ME(e,this.core.options.clock.type,this.core.options.clock.currentTime);e.value=r?`${t}:${n} ${r}`:`${t}:${n}`}getInputValueOnOpenAndSet(){let e=this.core.getInput();if(!e)return;let t=ME(e,this.core.options.clock.type,this.core.options.clock.currentTime),n=this.core.getHour(),r=this.core.getMinutes(),i=this.core.getActiveTypeMode(),a=this.core.getAM();if(t===void 0){n&&(n.value=`12`),r&&(r.value=`00`);let e={hour:n?.value||`12`,minutes:r?.value||`00`,type:i?.dataset.type,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes};this.emitter.emit(`open`,e);let t=this.core.options.range?.enabled===!0;this.core.options.clock.type!==`24h`&&a&&!t&&a.classList.add(IE);return}let[o,s,c]=e.value.split(`:`).join(` `).split(` `);e.value.length===0&&(o=t.hour,s=t.minutes,c=t.type),this.core.options.clock.type!==`24h`&&!c&&(c=t.type||`AM`),n&&(n.value=o.padStart(2,`0`)),r&&(r.value=s.padStart(2,`0`));let l=this.core.getModalElement()?.querySelector(`[data-type='${c}']`);this.core.options.clock.type!==`24h`&&l&&l.classList.add(IE);let u={...t,type:i?.dataset.type,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes};this.emitter.emit(`open`,u)}getInputValue(e,t,n){return ME(e,t,n)}destroy(){}},RE=class{core;emitter;isAnimating=!1;constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on(`switch:view`,()=>{this.toggleMobileClockFace()})}checkMobileOption(){this.core.setIsMobileView(!!this.core.options.ui.mobile),this.core.options.ui.mobile&&this.core.updateOptions({ui:{editable:!0}})}toggleMobileClockFace(){if(this.isAnimating)return;let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(`.tp-ui-wrapper`),n=this.core.getKeyboardClockIcon(),r=e.querySelector(`.tp-ui-mobile-clock-wrapper`),i=e.querySelectorAll(`*`),a=e.querySelector(`.tp-ui-select-time`),o=this.core.getHour(),s=this.core.getMinutes(),c=this.core.getClockFace();if(!t)return;let l=t.classList.contains(`expanded`),u=this.core.isMobileView;l?this.collapseClockFace(t,r,i,n,a,o,s,c,u):this.expandClockFace(t,r,i,n,a,o,s,c)}collapseClockFace(e,t,n,r,i,a,o,s,c){if(this.isAnimating=!0,typeof requestAnimationFrame<`u`){let l=typeof window<`u`&&window.matchMedia(`(orientation: landscape) and (min-width: 320px) and (max-width: 825px)`).matches;requestAnimationFrame(()=>{l&&e instanceof HTMLElement?this.collapseLandscape(e,t,n,r,i,a,o,s,c):this.collapsePortrait(e,t,n,r,i,a,o,s,c)})}else this.switchView(i,r,a,o,!0),this.isAnimating=!1;r?.setAttribute(`aria-label`,`Show clock face`),r?.setAttribute(`aria-pressed`,`false`)}collapseLandscape(e,t,n,r,i,a,o,s,c){s?.classList.remove(`scale-in`);let l=this.core.getModalElement(),u=this.getMobileLandscapeHeight(l);e.style.width=`328px`,e.style.height=u,t instanceof HTMLElement&&(t.style.height=`0`,t.style.opacity=`0`,t.style.transform=`scale(0)`),setTimeout(()=>{this.applyMobileClasses(e,t,n,i,c),e.classList.add(`mobile`),t&&t.classList.add(`mobile`),this.switchView(i,r,a,o,!0),requestAnimationFrame(()=>{e.style.width=``,e.style.height=``,t instanceof HTMLElement&&(t.style.height=``,t.style.opacity=``,t.style.transform=``),this.isAnimating=!1})},sE.WRAPPER_TRANSITION)}collapsePortrait(e,t,n,r,i,a,o,s,c){c?s?.classList.remove(`scale-in`):s?.classList.add(`scale-in`),t?.classList.remove(`expanded`),c&&t?.classList.add(`mobile`),requestAnimationFrame(()=>{this.applyMobileClasses(e,t,n,i,c),this.switchView(i,r,a,o,!0),setTimeout(()=>{this.isAnimating=!1},sE.MOBILE_TOGGLE)})}applyMobileClasses(e,t,n,r,i){e.classList.remove(`expanded`),t?.classList.remove(`expanded`),i&&(e.classList.add(`mobile`),t?.classList.add(`mobile`)),n.forEach(n=>{n!==t&&n!==e&&n!==r&&(n.classList.remove(`expanded`),i&&n.classList.add(`mobile`))}),r&&(r.classList.remove(`expanded`),i&&r.classList.add(`mobile`))}expandClockFace(e,t,n,r,i,a,o,s){this.isAnimating=!0,o?.classList.contains(`active`)&&o?this.emitter.emit(`select:minute`,{minutes:o.value}):a&&this.emitter.emit(`select:hour`,{hour:a.value}),n.forEach(n=>{n!==t&&n!==e&&n!==i&&(n.classList.remove(`mobile`),n.classList.add(`expanded`))}),i&&(i.classList.remove(`mobile`),i.classList.add(`expanded`)),this.switchView(i,r,a,o,!1),typeof requestAnimationFrame<`u`?requestAnimationFrame(()=>{e.classList.remove(`mobile`),e.classList.add(`expanded`),requestAnimationFrame(()=>{t&&(t.classList.remove(`mobile`),t.classList.add(`expanded`)),s&&s.classList.remove(`scale-in`),setTimeout(()=>{s&&s.classList.add(`scale-in`)},sE.CLOCK_SCALE_DELAY),setTimeout(()=>{this.isAnimating=!1},sE.MOBILE_TOGGLE)})}):this.isAnimating=!1,r?.setAttribute(`aria-label`,`Hide clock face`),r?.setAttribute(`aria-pressed`,`true`)}switchView(e,t,n,r,i){let a=this.core.getModalElement(),o=a?.querySelector(`.tp-ui-hour-text`),s=a?.querySelector(`.tp-ui-minute-text`),c=t?.querySelector(`.tp-ui-keyboard-icon`),l=this.core.getInputWrappers(),u=this.core.getHeader(),d=a?.querySelector(`.tp-ui-wrapper-type-time`),f=a?.querySelector(`.tp-ui-am`),p=a?.querySelector(`.tp-ui-pm`),m=a?.querySelectorAll(`.tp-ui-input-ripple-wrapper`),{iconTemplate:h,iconTemplateMobile:g}=this.core.options.ui,{time:_,mobileTime:v}=this.core.options.labels;i?(e?.classList.add(`mobile`),t?.classList.add(`mobile`),n?.classList.add(`mobile`),n?.removeAttribute(`readonly`),r?.classList.add(`mobile`),r?.removeAttribute(`readonly`),o?.classList.add(`mobile`),s?.classList.add(`mobile`),u?.classList.add(`mobile`),d?.classList.add(`mobile`),f?.classList.add(`mobile`),f?.classList.remove(`tp-ui-ripple`),p?.classList.add(`mobile`),p?.classList.remove(`tp-ui-ripple`),l?.forEach(e=>{e.classList.add(`mobile`)}),m?.forEach(e=>{e.classList.add(`mobile`)}),e&&v&&(e.textContent=v),c&&(c.innerHTML=g||vE),this.updateClockFaceAccessibility(!0)):(e?.classList.remove(`mobile`),t?.classList.remove(`mobile`),n?.classList.remove(`mobile`),r?.classList.remove(`mobile`),this.core.options.ui.editable||(n?.setAttribute(`readonly`,``),r?.setAttribute(`readonly`,``)),o?.classList.remove(`mobile`),s?.classList.remove(`mobile`),u?.classList.remove(`mobile`),d?.classList.remove(`mobile`),f?.classList.remove(`mobile`),f?.classList.add(`tp-ui-ripple`),p?.classList.remove(`mobile`),p?.classList.add(`tp-ui-ripple`),l?.forEach(e=>{e.classList.remove(`mobile`)}),m?.forEach(e=>{e.classList.remove(`mobile`)}),e&&_&&(e.textContent=_),c&&(c.innerHTML=h||_E),this.updateClockFaceAccessibility(!1))}updateClockFaceAccessibility(e){let t=this.core.getClockFace();if(!t)return;let n=t.querySelector(`.tp-ui-tips-wrapper`),r=t.querySelector(`.tp-ui-tips-wrapper-24h`),i=t.querySelectorAll(`.tp-ui-tip`);e?(t.setAttribute(`aria-hidden`,`true`),n?.setAttribute(`aria-hidden`,`true`),r?.setAttribute(`aria-hidden`,`true`),i.forEach(e=>{e.setAttribute(`tabindex`,`-1`),e.setAttribute(`aria-hidden`,`true`)})):(t.removeAttribute(`aria-hidden`),n?.removeAttribute(`aria-hidden`),r?.removeAttribute(`aria-hidden`),i.forEach(e=>{e.setAttribute(`tabindex`,`0`),e.removeAttribute(`aria-hidden`)}))}getMobileLandscapeHeight(e){return e?.classList.contains(`tp-ui-tz-mode`)?`326px`:e?.classList.contains(`tp-ui-range-mode`)?`287px`:`258px`}destroy(){}},zE=e=>{if(!e)return;let{disabledTime:t,type:n}=e.clock;if(!t||!Object.keys(t).length)return;let{hours:r,minutes:i,interval:a}=t;if(a){delete t.hours,delete t.minutes;let e=Array.isArray(a)?a:[a];if(!n)throw Error(`clockType required for interval`);return hE(e,n),{value:e.map(e=>{let[t,r]=e.trim().split(`-`),{hour:i,minutes:a,type:o}=ME({value:t.trim()},n),{hour:s,minutes:c,type:l}=ME({value:r.trim()},n),u=dE(i,s).map(e=>Number(e)===0?`00`:String(Number(e))),d=[],f=Number(a),p=Number(c);if(l===o)return f>0&&p<=0?(d.push(u[0],u[u.length-1]),u=u.slice(1,-1)):p<59&&p>0&&f<=0?(d.push(void 0,u[u.length-1]),u=u.slice(0,-1)):p>0&&f>0?(d.push(u[0],u[u.length-1]),u=u.slice(1,-1)):p===0&&f===0&&(d.push(void 0,u[u.length-1]),u.pop()),{removedStartedHour:d[0]!==void 0&&Number(d[0])<=9?`0${d[0]}`:d[0],removedEndHour:d[1]!==void 0&&Number(d[1])<=9?`0${d[1]}`:d[1],rangeArrHour:u,startMinutes:dE(a,59).map(e=>Number(e)<=9?`0${e}`:`${e}`),endMinutes:fE(0,c).map(e=>Number(e)<=9?`0${e}`:`${e}`),startType:o,endType:l};{let e=dE(i,12).map(String),t=fE(1,s).map(String),n=[],r=[];return f>0&&p<=0?(r.push(t[t.length-1]),n.push(e[0]),t.pop(),e.shift()):p<59&&p>0&&f<=0?(n.push(e[0]),r.push(t[t.length-1]),t.pop()):p>0&&f>0?(r.push(t[t.length-1]),n.push(e[0]),t.pop(),e.shift()):p===0&&f===0&&(r.push(t[t.length-1]),n.push(e[0]),t.pop()),{startType:o,endType:l,amHours:e,pmHours:t,removedAmHour:n[0]&&Number(n[0])<=9?`0${n[0]}`:n[0],removedPmHour:r[0]&&Number(r[0])<=9?`0${r[0]}`:r[0],startMinutes:Number(a)===0?[]:dE(a,59).map(e=>Number(e)<=9?`0${e}`:`${e}`),endMinutes:fE(0,c).map(e=>Number(e)<=9?`0${e}`:`${e}`)}}}).reduce((e,t)=>(Object.entries(t).forEach(([t,n])=>{Array.isArray(n)?e[t]=Array.isArray(e[t])?[...e[t],...n]:[...n]:e[t]=n}),e),{isInterval:!0,clockType:n,intervals:e})}}return r?.forEach(e=>{if(n===`12h`&&Number(e)>12)throw Error(`The disabled hours value has to be less than 13`);if(n===`24h`&&Number(e)>23)throw Error(`The disabled hours value has to be less than 24`)}),i?.forEach(e=>{if(Number(e)>59)throw Error(`The disabled minutes value has to be less than 60`)}),{value:{hours:r?.map(e=>e===`00`||Number(e)===0?`0${Number(e)}`:`${Number(e)}`),minutes:i?.map(e=>Number(e)<=9?`0${e}`:`${e}`)}}},BE=(e,t,n,r)=>{if(e){if(Array.isArray(e)&&e.length>0)return!e.map(e=>NE(e,t,n)).some(e=>e===!1);if(typeof e==`string`||typeof e==`number`){let i=NE(e,t,n),a=r?.map(Number).includes(Number(e));return!!(i&&!a)}}},VE=class{core;constructor(e){this.core=e}getDisableTime(){let e=zE(this.core.options);this.core.setDisabledTime(e||null)}destroy(){}},HE=class{inputValueHandler;mobileViewHandler;disabledTimeHandler;core;constructor(e,t){this.core=e,this.inputValueHandler=new LE(e,t),this.mobileViewHandler=new RE(e,t),this.disabledTimeHandler=new VE(e)}preventClockTypeByCurrentTime(){this.inputValueHandler.preventClockTypeByCurrentTime()}updateInputValueWithCurrentTimeOnStart(){this.inputValueHandler.updateInputValueWithCurrentTimeOnStart()}getInputValueOnOpenAndSet(){this.inputValueHandler.getInputValueOnOpenAndSet()}getInputValue(e,t,n){return this.inputValueHandler.getInputValue(e,t,n)}checkMobileOption(){this.mobileViewHandler.checkMobileOption()}toggleMobileClockFace(){this.mobileViewHandler.toggleMobileClockFace()}updateClockFaceAccessibility(e){this.mobileViewHandler.updateClockFaceAccessibility(e)}getDisableTime(){this.disabledTimeHandler.getDisableTime()}destroy(){this.inputValueHandler.destroy(),this.mobileViewHandler.destroy(),this.disabledTimeHandler.destroy()}},UE=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}setTheme(){let e=this.core.getModalElement();if(!e)return;let{theme:t}=this.core.options.ui;t&&e.setAttribute(`data-theme`,t)}setInputClassToInputElement(){let e=this.core.getInput();e&&(uE(e,`tp-ui-input`)||e.classList.add(`tp-ui-input`))}setDataOpenToInputIfDoesntExistInWrapper(){let e=this.core.getOpenElementData(),t=this.core.getInput();e===null&&t&&t.setAttribute(`data-open`,`tp-ui-input`)}setClassTopOpenElement(){let e=this.core.getOpenElement();for(let t of e)t&&t.classList.add(`tp-ui-open-element`)}setTimepickerClassToElement(){let e=this.core.element;if(!e)return;e.classList.add(PE);let t=this.core.options.ui.cssClass;t&&t!==PE&&e.classList.add(t)}destroy(){let e=this.core.getModalElement();e&&e.removeAttribute(`data-theme`)}},WE=class e extends Error{constructor(t,n){super(`[TimepickerUI] ${t}`),this.code=n,this.name=`TimepickerError`,Object.setPrototypeOf(this,e.prototype)}},GE={ELEMENT_NOT_FOUND:`ELEMENT_NOT_FOUND`,INVALID_PARAMETER:`INVALID_PARAMETER`,NO_INPUT_ELEMENT:`NO_INPUT_ELEMENT`,INSTANCE_DESTROYED:`INSTANCE_DESTROYED`,NOT_INITIALIZED:`NOT_INITIALIZED`,INVALID_TIME_FORMAT:`INVALID_TIME_FORMAT`,INLINE_CONFIG_ERROR:`INLINE_CONFIG_ERROR`,CONTAINER_NOT_FOUND:`CONTAINER_NOT_FOUND`,SSR_ENVIRONMENT:`SSR_ENVIRONMENT`},KE=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}setErrorHandler(){let e=this.core.getInput();if(!e)return!0;let{error:t,currentHour:n,currentMin:r,currentType:i,currentLength:a}=ME(e,this.core.options.clock.type);if(this.removeErrorHandler(),t){if(aE()===!1)return!1;let o=document.createElement(`div`);o.classList.add(`tp-ui-invalid-text`),o.innerHTML=`<b>Invalid Time Format</b>`,e.classList.add(`tp-ui-invalid-format`),e.nextElementSibling?.classList.contains(`tp-ui-invalid-text`)||e.after(o);let s={error:t,rejectedHour:void 0,rejectedMinute:void 0,inputHour:n,inputMinute:r,inputType:i,inputLength:a};return this.emitter.emit(`error`,s),!1}return!0}removeErrorHandler(){let e=this.core.getInput();if(!e)return;e.classList.remove(`tp-ui-invalid-format`);let t=e.nextElementSibling;t?.classList.contains(`tp-ui-invalid-text`)&&t.remove()}checkDisabledValuesOnStart(){if(!this.core.options.clock.disabledTime)return;let{disabledTime:e,type:t}=this.core.options.clock;if(e.interval){if(!t)throw new WE(`clockType is required when using disabledTime.interval`,GE.INVALID_PARAMETER);let n=Array.isArray(e.interval)?e.interval:[e.interval];try{hE(n,t)}catch(e){throw new WE(`Invalid disabledTime.interval: ${e.message}`,GE.INVALID_PARAMETER)}return}let{hours:n,minutes:r}=e,i=n?BE(n,`hour`,t):!0,a=r?BE(r,`minutes`,t):!0;if(!i||!a)throw new WE(`Invalid hours or minutes in disabledTime option`,GE.INVALID_PARAMETER)}destroy(){this.removeErrorHandler()}},qE=(e,t)=>{if(!e)return;let n=e.querySelector(`.timepicker-announcer`);n&&(n.textContent=``,setTimeout(()=>{n.textContent=t},100))},JE=(e,t)=>{e&&e.setAttribute(`aria-pressed`,String(t))},YE=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleOpenOnClick(){let e=this.core.getOpenElement();if(!e)return;let t=e=>{this.core.isDestroyed||e.currentTarget?.classList.contains(`disabled`)||this.emitter.emit(`show`,{})};e.forEach(e=>{e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))})}handleCancelButton(){let e=this.core.getCancelButton();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit(`cancel`,{})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handleOkButton(){let e=this.core.getOkButton();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let e=this.core.getHour(),t=this.core.getMinutes();if(e&&t){let n=this.core.getActiveTypeMode();this.emitter.emit(`confirm`,{hour:e.value,minutes:t.value,type:n?.textContent||void 0});return}let n=this.core.getModalElement();if(n){let e=n.querySelector(`.tp-ui-wheel-hours .tp-ui-wheel-item.is-center`),t=n.querySelector(`.tp-ui-wheel-minutes .tp-ui-wheel-item.is-center`),r=n.querySelector(`.tp-ui-wheel-ampm .tp-ui-wheel-item.is-center`);this.emitter.emit(`confirm`,{hour:e?.getAttribute(`data-value`)??void 0,minutes:t?.getAttribute(`data-value`)??void 0,type:r?.getAttribute(`data-value`)??void 0})}};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handleAmClick(){let e=this.core.getAM();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let t=this.core.getPM();e.classList.add(`active`),t?.classList.remove(`active`),JE(e,!0),JE(t,!1),qE(this.core.getModalElement(),`AM selected`),this.emitter.emit(`select:am`,{});let n=this.core.getHour(),r=this.core.getMinutes();this.emitter.emit(`update`,{hour:n?.value,minutes:r?.value,type:`AM`})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handlePmClick(){let e=this.core.getPM();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let t=this.core.getAM();e.classList.add(`active`),t?.classList.remove(`active`),JE(e,!0),JE(t,!1),qE(this.core.getModalElement(),`PM selected`),this.emitter.emit(`select:pm`,{});let n=this.core.getHour(),r=this.core.getMinutes();this.emitter.emit(`update`,{hour:n?.value,minutes:r?.value,type:`PM`})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handleSwitchViewButton(){let e=this.core.getKeyboardClockIcon();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit(`switch:view`,{})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},XE=(e,t,n)=>Math.max(t,Math.min(n,e)),ZE=(e,t)=>{if(e===``)return``;let n=parseInt(e,10);return Number.isNaN(n)?``:XE(n,+!!t,t?12:23).toString().padStart(2,`0`)},QE=e=>{if(e===``)return``;let t=parseInt(e,10);return Number.isNaN(t)?``:XE(t,0,59).toString().padStart(2,`0`)},$E=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleHourEvents(){let e=this.core.getHour();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;e.classList.add(`active`);let t=this.core.getMinutes();t?.classList.remove(`active`),this.emitter.emit(`select:hour`,{hour:e.value});let n=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:e.value,minutes:t?.value,type:n?.textContent||void 0})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t));let n=e.value,r=()=>{if(this.core.isDestroyed||e.hasAttribute(`readonly`))return;let t=this.core.options.clock.type===`12h`,r=ZE(e.value,t);if(e.value=r,e.setAttribute(`aria-valuenow`,r),e.value!==n){n=e.value,this.emitter.emit(`animation:clock`,{}),this.emitter.emit(`select:hour`,{hour:e.value});let t=this.core.getMinutes(),r=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:e.value,minutes:t?.value,type:r?.textContent||void 0})}};e.addEventListener(`blur`,r),this.cleanupHandlers.push(()=>e.removeEventListener(`blur`,r))}handleMinutesEvents(){let e=this.core.getMinutes();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;e.classList.add(`active`);let t=this.core.getHour();t?.classList.remove(`active`),this.emitter.emit(`select:minute`,{minutes:e.value});let n=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:t?.value,minutes:e.value,type:n?.textContent||void 0})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t));let n=e.value,r=()=>{if(this.core.isDestroyed||e.hasAttribute(`readonly`))return;let t=QE(e.value);if(e.value=t,e.setAttribute(`aria-valuenow`,t),e.value!==n){n=e.value,this.emitter.emit(`animation:clock`,{}),this.emitter.emit(`select:minute`,{minutes:e.value});let t=this.core.getHour(),r=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:t?.value,minutes:e.value,type:r?.textContent||void 0})}};e.addEventListener(`blur`,r),this.cleanupHandlers.push(()=>e.removeEventListener(`blur`,r))}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},eD=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleOpenOnEnterFocus(){let e=this.core.getInput();if(!e)return;let t=e=>{e.key===`Enter`&&!this.core.isDestroyed&&!this.core.isOpen&&this.emitter.emit(`show`,{})};e.addEventListener(`keydown`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`keydown`,t))}handleEscClick(){if(aE()===!1)return;let e=e=>{this.core.isDestroyed||e.key===`Escape`&&this.emitter.emit(`cancel`,{})};document.addEventListener(`keydown`,e),this.cleanupHandlers.push(()=>document.removeEventListener(`keydown`,e))}handleKeyboardInput(){let e=this.core.getHour(),t=this.core.getMinutes();if(e){let t=t=>{if(this.core.isDestroyed||t.key!==`ArrowUp`&&t.key!==`ArrowDown`)return;t.preventDefault();let n=parseInt(e.value)||0,r=parseInt(e.getAttribute(`max`)||`23`),i=this.core.options.clock.type===`12h`,a;a=t.key===`ArrowUp`?i?n>=12?1:n+1:n>=r?0:n+1:i?n<=1?12:n-1:n<=0?r:n-1,e.value=a.toString().padStart(2,`0`),e.setAttribute(`aria-valuenow`,e.value),qE(this.core.getModalElement(),`Hour: ${e.value}`),this.emitter.emit(`animation:clock`,{}),this.emitter.emit(`select:hour`,{hour:e.value});let o=this.core.getMinutes(),s=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:e.value,minutes:o?.value,type:s?.textContent||void 0})};e.addEventListener(`keydown`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`keydown`,t))}if(t){let e=e=>{if(this.core.isDestroyed||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let n=parseInt(t.value)||0,r;r=e.key===`ArrowUp`?n>=59?0:n+1:n<=0?59:n-1,t.value=r.toString().padStart(2,`0`),t.setAttribute(`aria-valuenow`,t.value),qE(this.core.getModalElement(),`Minutes: ${t.value}`),this.emitter.emit(`animation:clock`,{}),this.emitter.emit(`select:minute`,{minutes:t.value});let i=this.core.getHour(),a=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:i?.value,minutes:t.value,type:a?.textContent||void 0})};t.addEventListener(`keydown`,e),this.cleanupHandlers.push(()=>t.removeEventListener(`keydown`,e))}}focusTrapHandler(){if(aE()===!1)return;let e=this.core.getWrapper();if(!e)return;let t=t=>{if(this.core.isDestroyed||t.key!==`Tab`)return;let n=e.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`),r=n[0],i=n[n.length-1];t.shiftKey&&document.activeElement===r?(i?.focus(),t.preventDefault()):!t.shiftKey&&document.activeElement===i&&(r?.focus(),t.preventDefault())};e.addEventListener(`keydown`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`keydown`,t))}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},tD=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleBackdropClick(){let e=this.core.getModalElement();if(!e)return;let t=t=>{this.core.isDestroyed||t.target===e&&this.emitter.emit(`cancel`,{})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handleMoveHand(){if(aE()===!1)return;let e=e=>{this.core.isDestroyed||e.preventDefault()};document.addEventListener(`mousedown`,e,!1),document.addEventListener(`touchstart`,e,{passive:!1}),this.cleanupHandlers.push(()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)})}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},nD=class{buttonHandlers;inputHandlers;keyboardHandlers;modalHandlers;constructor(e,t){this.buttonHandlers=new YE(e,t),this.inputHandlers=new $E(e,t),this.keyboardHandlers=new eD(e,t),this.modalHandlers=new tD(e,t)}handleOpenOnClick(){this.buttonHandlers.handleOpenOnClick()}handleOpenOnEnterFocus(){this.keyboardHandlers.handleOpenOnEnterFocus()}handleCancelButton(){this.buttonHandlers.handleCancelButton()}handleOkButton(){this.buttonHandlers.handleOkButton()}handleBackdropClick(){this.modalHandlers.handleBackdropClick()}handleEscClick(){this.keyboardHandlers.handleEscClick()}handleAmClick(){this.buttonHandlers.handleAmClick()}handlePmClick(){this.buttonHandlers.handlePmClick()}handleHourEvents(){this.inputHandlers.handleHourEvents()}handleMinutesEvents(){this.inputHandlers.handleMinutesEvents()}handleKeyboardInput(){this.keyboardHandlers.handleKeyboardInput()}focusTrapHandler(){this.keyboardHandlers.focusTrapHandler()}handleMoveHand(){this.modalHandlers.handleMoveHand()}handleSwitchViewButton(){this.buttonHandlers.handleSwitchViewButton()}destroy(){this.buttonHandlers.destroy(),this.inputHandlers.destroy(),this.keyboardHandlers.destroy(),this.modalHandlers.destroy()}},rD=class{emitter;getClockSystem;setHoursToClock;setMinutesToClock;updateAmPm;convertDisabledTime;constructor(e,t,n,r,i,a){this.emitter=e,this.getClockSystem=t,this.setHoursToClock=n,this.setMinutesToClock=r,this.updateAmPm=i,this.convertDisabledTime=a}setup(){this.emitter.on(`select:hour`,({hour:e})=>{this.emitter.emit(`animation:clock`,{}),this.setHoursToClock(e||null)}),this.emitter.on(`select:minute`,({minutes:e})=>{this.emitter.emit(`animation:clock`,{}),this.setMinutesToClock(e||null)}),this.emitter.on(`select:am`,()=>{this.updateAmPm()}),this.emitter.on(`select:pm`,()=>{this.updateAmPm()}),this.emitter.on(`animation:start`,()=>{this.getClockSystem()?.blockInteractions()}),this.emitter.on(`animation:end`,()=>{this.getClockSystem()?.unblockInteractions()}),this.emitter.on(`range:switch`,e=>{this.refreshDisabledTimeForRange(e.disabledTime)})}refreshDisabledTimeForRange(e){let t=this.getClockSystem();if(!t)return;let n=this.convertDisabledTime(),r=n;if(e){let t=[...n?.hours||[],...e.hours||[]],i=[...n?.minutes||[],...e.minutes||[]];r={...n,hours:t.length>0?t:void 0,minutes:i.length>0?i:void 0,rangeFromType:e.fromType,rangeFromHour:e.fromHour}}t.updateDisabledTime(r)}},iD=class{static angleToIndex(e,t,n){let r=Math.round(e/30)%12;if(t===`24h`)if(n){let e=r+12;return e===12?0:e}else return r===0?12:r;return r===0?12:r}static indexToValue(e,t){if(t===`24h`)return e.toString().padStart(2,`0`);let n=e;return n===0&&(n=12),n>12&&(n-=12),n.toString().padStart(2,`0`)}static indexToAngle(e,t){return t===`24h`?e>=12?(e-12)%12*30:e%12*30:(e===0?12:e)%12*30}static isDisabled(e,t,n){return n?n.isInterval&&n.intervals&&n.clockType?this.isDisabledByInterval(e,t,n):n.rangeFromType!==void 0&&n.rangeFromHour!==void 0?this.isDisabledForRange12h(e,t,n):n.hours?n.hours.some(t=>String(t)===e||Number(t)===Number(e)||t===e):!1:!1}static isDisabledForRange12h(e,t,n){let r=n.rangeFromType,i=n.rangeFromHour,a=parseInt(e,10);return r===null||i===void 0?!1:t===`AM`&&r===`PM`?!0:t===`AM`&&r===`AM`?i===12?!1:a===12?!0:a<i:t===`PM`&&r===`AM`?!1:t===`PM`&&r===`PM`?i===12?!1:a===12?!0:a<i:!1}static isDisabledByInterval(e,t,n){if(!n.intervals)return!1;for(let r=0;r<60;r++){let i=r.toString().padStart(2,`0`);if(!this.isTimeInIntervals(e,i,t,n.intervals,n.clockType))return!1}return!0}static isTimeInIntervals(e,t,n,r,i){let a=i===`12h`?`${e}:${t} ${n}`:`${e}:${t}`;for(let e of r){let[t,n]=e.split(`-`).map(e=>e.trim());if(this.isTimeBetween(a,t,n,i))return!0}return!1}static isTimeBetween(e,t,n,r){let i=this.timeToMinutes(e,r),a=this.timeToMinutes(t,r),o=this.timeToMinutes(n,r);return i>=a&&i<=o}static timeToMinutes(e,t){if(t===`12h`){let t=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!t)return 0;let n=parseInt(t[1]),r=parseInt(t[2]),i=t[3].toUpperCase();return i===`PM`&&n!==12&&(n+=12),i===`AM`&&n===12&&(n=0),n*60+r}else{let[t,n]=e.split(`:`).map(Number);return t*60+n}}static findNearestValid(e,t,n,r){let i=t===`24h`?23:12;for(let a=0;a<=i;a++){let o=a===0?[e]:[e+a,e-a];for(let e of o){let a=e;a<0&&(a+=i+1),a>i&&(a%=i+1);let o=this.indexToValue(a,t);if(!this.isDisabled(o,n,r))return a}}return e}},aD=class{static angleToIndex(e){return Math.round(e/6)%60}static indexToValue(e){return e.toString().padStart(2,`0`)}static indexToAngle(e){return e%60*6}static isDisabled(e,t,n,r,i){return r?r.isInterval&&r.intervals?this.isDisabledByInterval(e,t,n,r,i):r.rangeFromType!==void 0&&r.rangeFromHour!==void 0?this.isDisabledForRange12h(e,t,n,r):r.rangeFromHour!==void 0&&parseInt(t,10)!==r.rangeFromHour?!1:r.minutes?r.minutes.some(t=>String(t)===e||Number(t)===Number(e)||t===e):!1:!1}static isDisabledForRange12h(e,t,n,r){let i=r.rangeFromType,a=r.rangeFromHour,o=parseInt(t,10),s=parseInt(e,10);if(i===null||a===void 0)return!1;let c=r.minutes||[],l=c.length>0?parseInt(c[c.length-1],10)+1:0;return n===`AM`&&i===`PM`?!0:n===`PM`&&i===`AM`?!1:o===a||o===12&&a===12||n===i&&o===a?s<l:!1}static isDisabledByInterval(e,t,n,r,i){if(!r.intervals)return!1;let a=i===`12h`?`${t}:${e} ${n}`:`${t}:${e}`;for(let e of r.intervals){let[t,n]=e.split(`-`).map(e=>e.trim());if(this.isTimeBetween(a,t,n,i))return!0}return!1}static isTimeBetween(e,t,n,r){let i=this.timeToMinutes(e,r),a=this.timeToMinutes(t,r),o=this.timeToMinutes(n,r);return i>=a&&i<=o}static timeToMinutes(e,t){if(t===`12h`){let t=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!t)return 0;let n=parseInt(t[1]),r=parseInt(t[2]),i=t[3].toUpperCase();return i===`PM`&&n!==12&&(n+=12),i===`AM`&&n===12&&(n=0),n*60+r}else{let[t,n]=e.split(`:`).map(Number);return t*60+n}}static findNearestValid(e,t,n,r,i){for(let a=0;a<60;a++){let o=a===0?[e]:[e+a,e-a];for(let e of o){let a=e;a<0&&(a+=60),a>=60&&(a%=60);let o=this.indexToValue(a);if(!this.isDisabled(o,t,n,r,i))return a}}return e}},oD=class{static normalizeAngle(e){let t=e%360;return t<0&&(t+=360),t}static calculateRawAngle(e,t){let n=e.x-t.x,r=e.y-t.y,i=Math.atan2(r,n)*180/Math.PI+90;return this.normalizeAngle(i)}static snapToIncrement(e,t){let n=Math.round(e/t)*t;return this.normalizeAngle(n)}static calculateDistance(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}static isInnerCircle(e,t){return e<t*.75}static calculateShortestPath(e,t){let n=this.normalizeAngle(e),r=this.normalizeAngle(t)-n,i=r>=0?r:r+360,a=r<=0?r:r-360;return e+(Math.abs(i)<Math.abs(a)?i:a)}},sD=class{config;currentAngle=0;tipsCache=new Map;cachedDimensions=new Map;constructor(e){this.config=e}getCachedDimensions(e){let t=this.cachedDimensions.get(e);if(!t){let n=(e.offsetWidth-32)/2;t={width:n,height:(e.offsetHeight-32)/2,radius:n-9},this.cachedDimensions.set(e,t)}return t}setHandAngle(e){let t=oD.calculateShortestPath(this.currentAngle,e);Math.abs(this.currentAngle-t)<.01||(this.currentAngle=t,this.config.clockHand.style.transform=`rotateZ(${t}deg)`)}animateToAngle(e){let t=oD.calculateShortestPath(this.currentAngle,e);this.currentAngle=t,this.config.tipsWrapper.classList.add(`tp-ui-tips-animation`),this.config.clockHand.style.transform=`rotateZ(${t}deg)`,setTimeout(()=>{this.config.tipsWrapper.classList.remove(`tp-ui-tips-animation`)},401)}setActiveValue(e){let t=[this.config.tipsWrapper];this.config.tipsWrapperFor24h&&t.push(this.config.tipsWrapperFor24h),t.forEach(t=>{t.querySelectorAll(`.tp-ui-value-tips, .tp-ui-value-tips-24h`).forEach(t=>{let n=t;n.textContent===e||Number(n.textContent)===Number(e)?(n.classList.add(`active`),n.setAttribute(`aria-selected`,`true`)):(n.classList.remove(`active`),n.setAttribute(`aria-selected`,`false`))})})}renderTips(e,t,n,r,i,a=!0,o,s=``,c=`12`){if(aE()===!1)return;let l=o||this.config.tipsWrapper;a&&(l.innerHTML=``,this.tipsCache.clear());let{width:u,height:d,radius:f}=this.getCachedDimensions(l),p=document.createDocumentFragment(),m=`${t}-${this.config.theme||`default`}`;e.forEach((a,o)=>{let l=`${m}-${a}`,h=this.tipsCache.get(l);h||(h=this.createTip(a,t,i),this.tipsCache.set(l,h));let{wrapper:g,tip:_}=h;this.updateTipState(g,_,a,n,r,i,s,c);let v=o*(360/e.length)*(Math.PI/180);g.style.left=`${u+Math.sin(v)*f}px`,g.style.bottom=`${d+Math.cos(v)*f}px`,p.appendChild(g)}),l.appendChild(p)}createTip(e,t,n){if(aE()===!1){let e={};return{wrapper:e,tip:e}}let r=document.createElement(`span`),i=document.createElement(`span`);i.textContent=e,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.tabIndex=0;let a=n===`24h`&&t.includes(`24`)?`tp-ui-value-tips-24h`:`tp-ui-value-tips`;return i.classList.add(a),r.classList.add(t),this.config.theme&&(r.classList.add(this.config.theme),i.classList.add(this.config.theme)),r.appendChild(i),{wrapper:r,tip:i}}updateTipState(e,t,n,r,i,a,o,s){e.classList.remove(`tp-ui-tips-disabled`),t.classList.remove(`tp-ui-tips-disabled`),t.removeAttribute(`aria-disabled`),t.tabIndex=0,this.checkIfDisabled(n,r,i,a,o,s)&&(e.classList.add(`tp-ui-tips-disabled`),t.classList.add(`tp-ui-tips-disabled`),t.setAttribute(`aria-disabled`,`true`),t.tabIndex=-1)}checkIfDisabled(e,t,n,r,i,a){return n?t===`hours`?iD.isDisabled(e,i,n):t===`minutes`?aD.isDisabled(e,a,i,n,r):!1:!1}setCircleSize(e){e?this.config.circle.classList.remove(`small-circle`):this.config.circle.classList.add(`small-circle`)}setCircle24hMode(e){e?(this.config.circle.classList.add(`tp-ui-circle-hand-24h`),this.config.clockHand.classList.add(`tp-ui-clock-hand-24h`)):(this.config.circle.classList.remove(`tp-ui-circle-hand-24h`),this.config.clockHand.classList.remove(`tp-ui-clock-hand-24h`))}destroy(){this.tipsCache.clear(),this.cachedDimensions.clear(),this.config.tipsWrapper.innerHTML=``}},cD=class{static processPointerInput(e){let t=oD.calculateRawAngle(e.pointerPosition,e.clockCenter);return e.mode===`hours`?this.processHours(t,e):this.processMinutes(t,e)}static processHours(e,t){let n=t.smoothHourSnap??!0,r;if(n)r=e;else{let n=t.incrementHours*30;r=oD.snapToIncrement(e,n)}let i=oD.calculateDistance(t.pointerPosition,t.clockCenter),a=t.clockType===`24h`&&oD.isInnerCircle(i,t.clockRadius),o=iD.angleToIndex(r,t.clockType,a),s=iD.indexToValue(o,t.clockType),c=iD.isDisabled(s,t.amPm,t.disabledTime);c&&(o=iD.findNearestValid(o,t.clockType,t.amPm,t.disabledTime));let l=iD.indexToValue(o,t.clockType),u;return u=n?e:iD.indexToAngle(o,t.clockType),{angle:u,value:l,index:o,isValid:!c,isInnerCircle:t.clockType===`24h`?a:void 0}}static processMinutes(e,t){let n=t.incrementMinutes*6,r=oD.snapToIncrement(e,n),i=aD.angleToIndex(r),a=aD.indexToValue(i),o=t.currentHour||`00`,s=aD.isDisabled(a,o,t.amPm,t.disabledTime,t.clockType);s&&(i=aD.findNearestValid(i,o,t.amPm,t.disabledTime,t.clockType));let c=aD.indexToValue(i);return{angle:aD.indexToAngle(i),value:c,index:i,isValid:!s}}static valueToAngle(e,t,n){let r=parseInt(e,10);return t===`hours`?iD.indexToAngle(r,n):aD.indexToAngle(r)}},lD=class{state;renderer;clockType;disabledTime;incrementHours;incrementMinutes;smoothHourSnap;isDragging=!1;callbacks;lastProcessedX=null;lastProcessedY=null;constructor(e,t,n,r,i=1,a=1,o=!0,s={}){this.renderer=e,this.state={...t},this.clockType=n,this.disabledTime=r,this.incrementHours=i,this.incrementMinutes=a,this.smoothHourSnap=o,this.callbacks=s}handlePointerMove(e,t,n){if(this.isDragging=!0,this.lastProcessedX===e.x&&this.lastProcessedY===e.y)return;this.lastProcessedX=e.x,this.lastProcessedY=e.y;let r={pointerPosition:e,clockCenter:t,clockRadius:n,mode:this.state.mode,clockType:this.clockType,amPm:this.state.amPm,disabledTime:this.disabledTime,incrementHours:this.incrementHours,incrementMinutes:this.incrementMinutes,smoothHourSnap:this.smoothHourSnap,currentHour:this.state.hour},i=cD.processPointerInput(r);if(i.isValid){if(this.state.mode===`hours`){let e=this.state.hour;this.state.hour=i.value,this.state.hourAngle=i.angle,this.clockType===`24h`&&i.isInnerCircle!==void 0&&(this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(i.isInnerCircle)),this.callbacks.onHourChange&&e!==i.value&&this.callbacks.onHourChange(i.value)}else{let e=this.state.minute;this.state.minute=i.value,this.state.minuteAngle=i.angle,this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1),this.callbacks.onMinuteChange&&e!==i.value&&this.callbacks.onMinuteChange(i.value)}this.renderer.setHandAngle(i.angle),this.renderer.setActiveValue(i.value)}}handlePointerUp(){this.isDragging=!1,this.lastProcessedX=null,this.lastProcessedY=null}snapToNearestHour(){if(this.state.mode!==`hours`)return;let e=cD.valueToAngle(this.state.hour,`hours`,this.clockType);this.state.hourAngle=e,this.renderer.animateToAngle(e)}switchMode(e){this.state.mode=e;let t=e===`hours`?this.state.hourAngle:this.state.minuteAngle,n=e===`hours`?this.state.hour:this.state.minute;if(e===`hours`&&this.clockType===`24h`){let e=parseInt(n,10),t=e===0||e>=13;this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(t)}else this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1);this.renderer.setHandAngle(t),this.renderer.setActiveValue(n)}setValue(e,t){let n=cD.valueToAngle(t,e,this.clockType);if(e===`hours`)if(this.state.hour=t,this.state.hourAngle=n,this.clockType===`24h`){let e=parseInt(t,10),n=e===0||e>=13;this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(n)}else this.renderer.setCircle24hMode(!1);else this.state.minute=t,this.state.minuteAngle=n,this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1);this.state.mode===e&&(this.renderer.setHandAngle(n),this.renderer.setActiveValue(t))}setAmPm(e){this.state.amPm=e}getState(){return{...this.state}}getHour(){return this.state.hour}getMinute(){return this.state.minute}getAmPm(){return this.state.amPm}updateDisabledTime(e){this.disabledTime=e}destroy(){this.renderer.destroy()}},uD=class{controller;clockFace;isActive=!1;isBlocked=!1;config;cachedRect=null;cachedCenter=null;cachedRadius=null;rafId=null;constructor(e,t,n={}){this.controller=e,this.clockFace=t,this.config=n}attach(){this.clockFace.addEventListener(`mousedown`,this.handlePointerDown),this.clockFace.addEventListener(`touchstart`,this.handlePointerDown,{passive:!1})}detach(){this.clockFace.removeEventListener(`mousedown`,this.handlePointerDown),this.clockFace.removeEventListener(`touchstart`,this.handlePointerDown),this.removeGlobalListeners()}block(){this.isBlocked=!0}unblock(){this.isBlocked=!1}handlePointerDown=e=>{if(iE()||this.isBlocked)return;let t=e.target;t&&t.classList&&t.classList.contains(`tp-ui-tips-disabled`)||(e.preventDefault(),this.isActive=!0,this.cachedRect=this.clockFace.getBoundingClientRect(),this.cachedCenter=this.getClockCenter(),this.cachedRadius=this.getClockRadius(),this.processPointerEvent(e),document.addEventListener(`mousemove`,this.handlePointerMove),document.addEventListener(`touchmove`,this.handlePointerMove,{passive:!1}),document.addEventListener(`mouseup`,this.handlePointerUp),document.addEventListener(`touchend`,this.handlePointerUp))};handlePointerMove=e=>{if(!this.isActive||this.isBlocked)return;let t=this.getTargetElement(e);t&&t.classList&&t.classList.contains(`tp-ui-tips-disabled`)||(e.preventDefault(),this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.processPointerEvent(e)})))};handlePointerUp=()=>{if(!this.isActive)return;this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.isActive=!1,this.cachedRect=null,this.cachedCenter=null,this.cachedRadius=null,this.controller.handlePointerUp();let{autoSwitchToMinutes:e,isMobileView:t,smoothHourSnap:n,hourElement:r,minutesElement:i}=this.config;n&&r?.classList.contains(`active`)&&this.controller.snapToNearestHour(),this.removeGlobalListeners(),e&&r?.classList.contains(`active`)&&!t?(r.classList.remove(`active`),i?.classList.add(`active`),i?.click(),i?.focus(),r.blur()):i?.classList.contains(`active`)&&this.config.onMinuteCommit&&this.config.onMinuteCommit()};processPointerEvent(e){let t=this.getPointerPosition(e),n=this.cachedCenter||this.getClockCenter(),r=this.cachedRadius||this.getClockRadius();this.controller.handlePointerMove(t,n,r)}getPointerPosition(e){let t=this.cachedRect||this.clockFace.getBoundingClientRect();if(`touches`in e){let n=e.touches[0]||e.changedTouches[0];return{x:n.clientX-t.left,y:n.clientY-t.top}}else return{x:e.clientX-t.left,y:e.clientY-t.top}}getTargetElement(e){if(`touches`in e){let t=e.touches[0]||e.changedTouches[0];if(t&&!iE())return document.elementFromPoint(t.clientX,t.clientY)}return e.target}getClockCenter(){let e=this.clockFace.offsetWidth,t=this.clockFace.offsetHeight;return{x:e/2,y:t/2}}getClockRadius(){return this.clockFace.offsetWidth/2}removeGlobalListeners(){aE()!==!1&&(document.removeEventListener(`mousemove`,this.handlePointerMove),document.removeEventListener(`touchmove`,this.handlePointerMove),document.removeEventListener(`mouseup`,this.handlePointerUp),document.removeEventListener(`touchend`,this.handlePointerUp))}},dD=class{renderer;controller;dragHandlers;clockType;disabledTime;tipsWrapper;tipsWrapperFor24h;constructor(e){this.clockType=e.clockType,this.disabledTime=e.disabledTime,this.tipsWrapper=e.tipsWrapper,this.tipsWrapperFor24h=e.tipsWrapperFor24h,this.renderer=new sD({clockFace:e.clockFace,tipsWrapper:e.tipsWrapper,tipsWrapperFor24h:e.tipsWrapperFor24h,clockHand:e.clockHand,circle:e.circle,theme:e.theme});let t={hour:e.initialHour,minute:e.initialMinute,amPm:e.initialAmPm,hourAngle:this.calculateInitialAngle(`hours`,e.initialHour),minuteAngle:this.calculateInitialAngle(`minutes`,e.initialMinute),mode:`hours`},n={onHourChange:e.onHourChange,onMinuteChange:e.onMinuteChange};this.controller=new lD(this.renderer,t,e.clockType,e.disabledTime,e.incrementHours||1,e.incrementMinutes||1,e.smoothHourSnap??!0,n),this.dragHandlers=new uD(this.controller,e.clockFace,e.dragConfig||{})}initialize(){this.dragHandlers.attach(),this.switchToHours()}switchToHours(){this.controller.switchMode(`hours`),this.clockType===`24h`&&this.tipsWrapperFor24h&&this.tipsWrapperFor24h.classList.remove(`none`),this.renderHourTips();let e=this.controller.getState();this.renderer.setActiveValue(e.hour)}switchToMinutes(){this.controller.switchMode(`minutes`),this.tipsWrapperFor24h&&this.tipsWrapperFor24h.classList.add(`none`),this.renderMinuteTips();let e=this.controller.getState();this.renderer.setActiveValue(e.minute)}setHour(e){this.controller.setValue(`hours`,e)}setMinute(e){this.controller.setValue(`minutes`,e)}setAmPm(e){this.controller.setAmPm(e);let t=this.controller.getState();t.mode===`hours`?(this.renderHourTips(),this.renderer.setHandAngle(t.hourAngle),this.renderer.setActiveValue(t.hour)):(this.renderMinuteTips(),this.renderer.setHandAngle(t.minuteAngle),this.renderer.setActiveValue(t.minute))}getHour(){return this.controller.getHour()}getMinute(){return this.controller.getMinute()}getAmPm(){return this.controller.getAmPm()}updateDisabledTime(e){this.disabledTime=e,this.controller.updateDisabledTime(e),this.controller.getState().mode===`hours`?this.renderHourTips():this.renderMinuteTips()}renderHourTips(){let e=this.controller.getState().amPm;this.clockType===`24h`?(this.renderer.renderTips(SE,`tp-ui-hour-time-12`,`hours`,this.disabledTime,this.clockType,!0,this.tipsWrapper,e),this.tipsWrapperFor24h&&this.renderer.renderTips(xE,`tp-ui-hour-time-24`,`hours`,this.disabledTime,this.clockType,!0,this.tipsWrapperFor24h,e)):this.renderer.renderTips(SE,`tp-ui-hour-time-12`,`hours`,this.disabledTime,this.clockType,!0,void 0,e)}renderMinuteTips(){let e=this.controller.getState(),t=e.amPm,n=e.hour;this.renderer.renderTips(CE,`tp-ui-minutes-time`,`minutes`,this.disabledTime,this.clockType,!0,void 0,t,n)}calculateInitialAngle(e,t){let n=parseInt(t,10);return e===`hours`?n%12*30:n*6}destroy(){this.dragHandlers.detach(),this.controller.destroy()}blockInteractions(){this.dragHandlers.block()}unblockInteractions(){this.dragHandlers.unblock()}},fD=class{core;emitter;clockSystem=null;constructor(e,t){this.core=e,this.emitter=t}getClockSystem(){return this.clockSystem}initialize(){let e=this.core.getClockFace(),t=this.core.getClockHand(),n=this.core.getCircle();if(!e||!t||!n)return;let r=this.core.options.clock.type===`24h`,i=this.core.getTipsWrapper();if(!i)return;let a=this.core.getHour(),o=this.core.getMinutes();this.clockSystem=new dD({clockFace:e,tipsWrapper:i,tipsWrapperFor24h:r&&this.core.getTipsWrapperFor24h()||void 0,clockHand:t,circle:n,clockType:this.core.options.clock.type||`12h`,disabledTime:this.convertDisabledTime(),initialHour:a?.value||`12`,initialMinute:o?.value||`00`,initialAmPm:this.getAmPmValue(),theme:this.core.options.ui.theme,incrementHours:this.core.options.clock.incrementHours||1,incrementMinutes:this.core.options.clock.incrementMinutes||1,smoothHourSnap:this.core.options.clock.smoothHourSnap??!0,timepicker:null,dragConfig:{autoSwitchToMinutes:this.core.options.clock.autoSwitchToMinutes,isMobileView:this.core.isMobileView,smoothHourSnap:this.core.options.clock.smoothHourSnap??!0,hourElement:a,minutesElement:o,onMinuteCommit:()=>{let e=this.core.getMinutes(),t=this.core.getHour(),n=this.core.getActiveTypeMode();this.emitter.emit(`range:minute:commit`,{hour:t?.value??`12`,minutes:e?.value??`00`,type:n?.textContent??void 0})}},onHourChange:e=>{let t=this.core.getHour();t&&(t.value=e,t.setAttribute(`aria-valuenow`,e)),qE(this.core.getModalElement(),`Hour: ${e}`);let n=this.core.getMinutes(),r=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:e,minutes:n?.value,type:r?.textContent||void 0})},onMinuteChange:e=>{let t=this.core.getMinutes();t&&(t.value=e,t.setAttribute(`aria-valuenow`,e)),qE(this.core.getModalElement(),`Minutes: ${e}`);let n=this.core.getHour(),r=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:n?.value,minutes:e,type:r?.textContent||void 0})}}),this.clockSystem.initialize()}convertDisabledTime(){let e=this.core.disabledTime?.value;if(!e)return null;let t;return e.intervals&&(t=Array.isArray(e.intervals)?e.intervals:[e.intervals]),{hours:e.hours,minutes:e.minutes,isInterval:e.isInterval,intervals:t,clockType:e.clockType}}getAmPmValue(){if(this.core.options.clock.type===`24h`)return``;let e=this.core.getActiveTypeMode();if(e){let t=e.textContent?.trim();if(t===`AM`||t===`PM`)return t}let t=this.core.getAM();return this.core.options.range?.enabled===!0?t?.classList.contains(`active`)?`AM`:``:t?.classList.contains(`active`)?`AM`:`PM`}destroy(){this.clockSystem&&=(this.clockSystem.destroy(),null)}},pD=class{core;constructor(e){this.core=e}removeCircleClockClasses24h(){let e=this.core.getCircle(),t=this.core.getClockHand();e?.classList.remove(`tp-ui-circle-hand-24h`),t?.classList.remove(`tp-ui-clock-hand-24h`)}setCircleClockClasses24h(){let e=this.core.getCircle(),t=this.core.getClockHand();e&&e.classList.add(`tp-ui-circle-hand-24h`),t&&t.classList.add(`tp-ui-clock-hand-24h`)}setOnStartCSSClassesIfClockType24h(){if(this.core.options.clock.type===`24h`){let e=this.core.getInput();if(!e)return;let t;e.value.length>0&&(t=e.value.split(`:`)[0]),t&&(Number(t)>12||Number(t)===0)&&this.setCircleClockClasses24h()}}setBgColorToCircleWithMinutesTips(){let e=this.core.getMinutes(),t=this.core.getCircle();if(!(!e||!t)&&e.value&&CE.includes(e.value)){let e=getComputedStyle(t).getPropertyValue(`--timepicker-primary`).trim();e&&(t.style.backgroundColor=e),t.classList.remove(`small-circle`)}}removeBgColorToCirleWithMinutesTips(){let e=this.core.getMinutes(),t=this.core.getCircle();!e||!t||e.value&&CE.includes(e.value)||(t.style.backgroundColor=``,t.classList.add(`small-circle`))}setClassActiveToHourOnOpen(){this.core.options.ui.mobile||this.core.isMobileView||this.core.getHour()?.classList.add(IE)}toggleClassActiveToValueTips(e,t){if(e)return;let n=this.core.getAllValueTips();if(!n)return;let r=n.find(e=>Number(e.innerText)===Number(t));n.forEach(e=>{e.classList.remove(IE),e.setAttribute(`aria-selected`,`false`)}),r!==void 0&&(r.classList.add(IE),r.setAttribute(`aria-selected`,`true`))}},mD=class{getClockSystem;styleHandler;getAmPmValue;clockType;constructor(e,t,n,r){this.getClockSystem=e,this.styleHandler=t,this.getAmPmValue=n,this.clockType=r}setMinutesToClock(e){let t=this.getClockSystem();t&&(this.styleHandler.removeBgColorToCirleWithMinutesTips(),e&&t.setMinute(e),t.switchToMinutes())}setHoursToClock(e){let t=this.getClockSystem();t&&(e&&t.setHour(e),t.switchToHours())}setTransformToCircleWithSwitchesHour(e){let t=this.getClockSystem();!t||!e||t.setHour(e)}setTransformToCircleWithSwitchesMinutes(e){let t=this.getClockSystem();!t||!e||t.setMinute(e)}updateAmPm(){let e=this.getClockSystem();if(!e||this.clockType===`24h`)return;let t=this.getAmPmValue();t!==``&&e.setAmPm(t)}},hD=class{systemInitializer;styleHandler;timeHandler;eventHandler;constructor(e,t){this.systemInitializer=new fD(e,t),this.styleHandler=new pD(e);let n=e.options.clock.type||`12h`;this.timeHandler=new mD(()=>this.systemInitializer.getClockSystem(),this.styleHandler,()=>this.systemInitializer.getAmPmValue(),n),this.eventHandler=new rD(t,()=>this.systemInitializer.getClockSystem(),e=>this.timeHandler.setHoursToClock(e),e=>this.timeHandler.setMinutesToClock(e),()=>this.timeHandler.updateAmPm(),()=>this.systemInitializer.convertDisabledTime()),this.eventHandler.setup()}initializeClockSystem(){this.systemInitializer.initialize()}destroyClockSystem(){this.systemInitializer.destroy()}removeCircleClockClasses24h(){this.styleHandler.removeCircleClockClasses24h()}setCircleClockClasses24h(){this.styleHandler.setCircleClockClasses24h()}setOnStartCSSClassesIfClockType24h(){this.styleHandler.setOnStartCSSClassesIfClockType24h()}setBgColorToCircleWithMinutesTips=()=>{this.styleHandler.setBgColorToCircleWithMinutesTips()};removeBgColorToCirleWithMinutesTips=()=>{this.styleHandler.removeBgColorToCirleWithMinutesTips()};setClassActiveToHourOnOpen=()=>{this.styleHandler.setClassActiveToHourOnOpen()};setMinutesToClock=e=>{this.timeHandler.setMinutesToClock(e)};setHoursToClock=e=>{this.timeHandler.setHoursToClock(e)};setTransformToCircleWithSwitchesHour=e=>{this.timeHandler.setTransformToCircleWithSwitchesHour(e)};setTransformToCircleWithSwitchesMinutes=e=>{this.timeHandler.setTransformToCircleWithSwitchesMinutes(e)};updateAmPm=()=>{this.timeHandler.updateAmPm()};toggleClassActiveToValueTips=e=>{let t=this.systemInitializer.getClockSystem()!==null;this.styleHandler.toggleClassActiveToValueTips(t,e)};destroy(){this.destroyClockSystem()}},gD=class{core;emitter;cleanupHandlers=[];wasCleared=!1;constructor(e,t){this.core=e,this.emitter=t}init(){if(!this.core.options.ui.clearButton)return;let e=this.getClearButton();if(!e)return;let t=()=>{this.core.isDestroyed||e.getAttribute(`aria-disabled`)!==`true`&&this.handleClearClick()};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t)),this.setupInternalEventListeners()}setupInternalEventListeners(){this.emitter.on(`update`,()=>{this.updateClearButtonState()}),this.emitter.on(`open`,()=>{this.updateClearButtonState()}),this.emitter.on(`select:hour`,()=>{this.updateClearButtonState(),this.reenableConfirmIfCleared()}),this.emitter.on(`select:minute`,()=>{this.updateClearButtonState(),this.reenableConfirmIfCleared()})}handleClearClick(){let e=this.core.getInput()?.value||null;this.clearTimeValue(),this.resetClockToNeutral(),this.disableConfirmButton(),this.wasCleared=!0,qE(this.core.getModalElement(),`Time cleared`),this.emitter.emit(`clear`,{previousValue:e}),this.emitter.emit(`update`,{hour:void 0,minutes:void 0,type:void 0});let{callbacks:t}=this.core.options;t.onClear&&t.onClear({previousValue:e})}clearTimeValue(){let e=this.core.options.clearBehavior?.clearInput!==!1,t=this.core.getInput();t&&e&&(t.value=``),this.core.setDegreesHours(null),this.core.setDegreesMinutes(null);let n=bE.getClearHandler(`range`);n&&n(this.core,this.emitter);let r=bE.getClearHandler(`timezone`);r&&r(this.core,this.emitter)}resetClockToNeutral(){let e=this.core.options.clock.type,t=e===`12h`?`PM`:void 0,n=this.core.getHour(),r=this.core.getMinutes();n&&(n.value=`12`,n.removeAttribute(`aria-valuenow`)),r&&(r.value=`00`,r.removeAttribute(`aria-valuenow`));let i=this.core.getClockHand();if(i){let e=i.style.transition;i.style.transition=`none`,i.style.transform=`rotateZ(0deg)`,i.offsetHeight,requestAnimationFrame(()=>{i.style.transition=e})}if(this.removeActiveStates(),n&&n.click(),e===`12h`&&t){let e=this.core.getAM(),t=this.core.getPM();e?.classList.remove(`active`),t?.classList.remove(`active`),e?.setAttribute(`aria-pressed`,`false`),t?.setAttribute(`aria-pressed`,`false`),t?.classList.add(`active`),t?.setAttribute(`aria-pressed`,`true`)}this.emitter.emit(`animation:clock`,{})}removeActiveStates(){this.core.getAllValueTips().forEach(e=>{e.classList.remove(`active`),e.removeAttribute(`aria-selected`)});let e=this.core.getHour(),t=this.core.getMinutes();e?.removeAttribute(`aria-valuenow`),t?.removeAttribute(`aria-valuenow`)}disableConfirmButton(){let e=this.core.getOkButton();e&&(e.classList.add(`disabled`),e.setAttribute(`aria-disabled`,`true`))}updateClearButtonState(){let e=this.getClearButton();if(!e)return;let t=this.core.getInput(),n=t?.value&&t.value.trim()!==``,r=this.core.getHour(),i=this.core.getMinutes(),a=this.core.getActiveTypeMode(),o=this.core.options.clock.type,s=r?.value||``,c=i?.value||``,l=a?.textContent||``,u=n||!(o===`12h`?s===`12`&&c===`00`&&l===`PM`:s===`12`&&c===`00`);e.classList.toggle(`disabled`,!u),e.setAttribute(`aria-disabled`,String(!u))}reenableConfirmIfCleared(){if(!this.wasCleared)return;let e=this.core.getOkButton();e&&(e.classList.remove(`disabled`),e.setAttribute(`aria-disabled`,`false`),this.wasCleared=!1)}getClearButton(){return this.core.getModalElement()?.querySelector(`.tp-ui-clear-btn`)||null}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},_D=class{animation;modal;config;theme;validation;events;clock;clearButton;plugins=new Map;constructor(e,t){this.animation=new cE(e,t),this.modal=new jE(e,t),this.config=new HE(e,t),this.theme=new UE(e,t),this.validation=new KE(e,t),this.events=new nD(e,t),this.clock=new hD(e,t),this.clearButton=new gD(e,t),bE.getAll().forEach(n=>{let r=n.factory(e,t);this.plugins.set(n.name,r)})}getPlugin(e){return this.plugins.get(e)}destroy(){this.animation.destroy(),this.modal.destroy(),this.config.destroy(),this.theme.destroy(),this.validation.destroy(),this.events.destroy(),this.clock.destroy(),this.clearButton.destroy(),this.plugins.forEach(e=>e.destroy()),this.plugins.clear()}},vD=`is-rippling`,yD=`ripple-hold`,bD=null,xD=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}},SD=[`basic`,`crane-straight`,`crane`,`m2`,`m3-green`],CD=class{core;managers;emitter;eventsClickMobileHandler=()=>{};mutliEventsMoveHandler=()=>{};unmountTimeouts=[];constructor(e,t,n){this.core=e,this.managers=t,this.emitter=n}init(){if(!this.core.isDestroyed&&!this.core.isInitialized){try{this.managers.config.updateInputValueWithCurrentTimeOnStart(),this.managers.validation.checkDisabledValuesOnStart()}catch{this.core.setIsDestroyed(!0);return}this.managers.theme.setTimepickerClassToElement(),this.managers.theme.setInputClassToInputElement(),this.managers.theme.setDataOpenToInputIfDoesntExistInWrapper(),this.managers.theme.setClassTopOpenElement(),this.managers.config.getDisableTime(),this.core.options.ui.inline?.enabled||this.managers.events.handleOpenOnClick(),this.managers.events.handleOpenOnEnterFocus(),this.setupCallbackBridge(),this.core.setIsInitialized(!0)}}setupCallbackBridge(){let{callbacks:e}=this.core.options;e.onOpen&&this.emitter.on(`open`,e.onOpen),e.onCancel&&this.emitter.on(`cancel`,e.onCancel),e.onConfirm&&this.emitter.on(`confirm`,e.onConfirm),e.onUpdate&&this.emitter.on(`update`,e.onUpdate),e.onSelectHour&&this.emitter.on(`select:hour`,e.onSelectHour),e.onSelectMinute&&this.emitter.on(`select:minute`,e.onSelectMinute),e.onSelectAM&&this.emitter.on(`select:am`,e.onSelectAM),e.onSelectPM&&this.emitter.on(`select:pm`,e.onSelectPM),e.onError&&this.emitter.on(`error`,e.onError),e.onTimezoneChange&&this.emitter.on(`timezone:change`,e.onTimezoneChange),e.onRangeConfirm&&this.emitter.on(`range:confirm`,e.onRangeConfirm),e.onRangeSwitch&&this.emitter.on(`range:switch`,e.onRangeSwitch),e.onRangeValidation&&this.emitter.on(`range:validation`,e.onRangeValidation),e.onClear&&this.emitter.on(`clear`,e.onClear)}mount(){this.core.isDestroyed||this.core.isOpen||(this.core.isInitialized||this.init(),this.eventsBundle())}unmount(e){let t=xD((...e)=>{if(e.length>2)return;let[t]=e.filter(e=>typeof e==`boolean`),[n]=e.filter(e=>typeof e==`function`);this.core.setIsMobileView(!!this.core.options.ui.mobile);let r=this.core.getModalElement();if(t&&r&&this.core.getOkButton()?.click(),this.core.setIsTouchMouseMove(!1),this.core.setIsOpen(!1),this.removeEventListeners(),this.isPopoverMode()){let e=this.managers.getPlugin(`wheel`);e&&`detachPopover`in e&&e.detachPopover()}r&&this.managers.animation.removeAnimationToClose(),this.core.getOpenElement().forEach(e=>e?.classList.remove(`disabled`));let i=setTimeout(()=>{aE()&&(document.body.style.overflowY=``,document.body.style.paddingRight=``)},sE.SCROLLBAR_RESTORE);this.unmountTimeouts.push(i);let a=setTimeout(()=>{let e=this.core.getInput();this.core.options.behavior.focusInputAfterClose&&e?.focus();let t=this.core.getModalElement();t&&t.remove(),this.core.setIsModalRemove(!0)},sE.MODAL_REMOVE);this.unmountTimeouts.push(a),n&&n()},this.core.options.behavior.delayHandler||sE.DEFAULT_DELAY);e?t(e):t()}destroy(e){if(this.core.isDestroyed)return;this.clearUnmountTimeouts();let{keepInputValue:t=!1,callback:n}=typeof e==`function`?{callback:e}:e||{},r=this.core.getInput(),i=t?r?.value:null;this.removeEventListeners(),this.core.getModalElement()?.remove(),this.core.getOpenElement()?.forEach(e=>{e&&(e.classList.remove(`disabled`,`active`,`tp-ui-open-element`),e.classList.remove(...SD))}),r&&(r.classList.remove(`tp-ui-invalid-format`,`invalid-value`,`error`,`active`,`tp-ui-input`),r.removeAttribute(`data-open`),r.removeAttribute(`data-owner-id`),t&&i&&(r.value=i));let a=this.core.element;a&&(a.classList.remove(...SD),a.classList.remove(`error`,`active`,`disabled`),a.removeAttribute(`data-owner-id`),a.removeAttribute(`data-open`),this.core.options.ui.cssClass&&a.classList.remove(this.core.options.ui.cssClass)),a?.querySelectorAll(`.tp-ui-invalid-text`)?.forEach(e=>e.remove()),this.mutliEventsMoveHandler=()=>{},this.eventsClickMobileHandler=()=>{},this.core.reset(),this.managers.destroy(),this.emitter.clear(),iE()||(document.body.style.overflowY=``,document.body.style.paddingRight=``),n&&n()}eventsBundle(){if(this.core.isDestroyed||!this.core.isModalRemove)return;this.clearUnmountTimeouts(),this.core.setIsOpen(!0),this.core.setIsModalRemove(!1),this.setupValidation(),this.disableOpenElements(),this.setupModal(),this.applyExpandedState(),this.managers.modal.setFlexEndToFooterIfNoKeyboardIcon(),this.applyThemeDeferred(),this.managers.animation.setAnimationToOpen(),this.managers.config.getInputValueOnOpenAndSet();let e=this.resolveWheelMode();if(this.emitMissingPluginErrors(),this.initClockOrWheel(e),this.initOptionalPlugins(e),this.bindEventHandlers(e),this.finalizeModal(e),this.isPopoverMode()){let e=this.managers.getPlugin(`wheel`);e&&`attachPopover`in e&&e.attachPopover()}this.managers.modal.setShowClassToBackdrop()}setupValidation(){this.managers.validation.setErrorHandler(),this.managers.validation.removeErrorHandler()}disableOpenElements(){this.core.options.ui.inline?.enabled||(this.core.getOpenElement().forEach(e=>e?.classList.add(`disabled`)),this.isPopoverMode()||this.core.getInput()?.blur())}setupModal(){this.managers.modal.setScrollbarOrNot(),this.managers.modal.setModalTemplate(),this.managers.modal.setNormalizeClass(),this.managers.modal.removeBackdrop()}applyExpandedState(){if(this.core.isMobileView)this.managers.config.updateClockFaceAccessibility(!0);else{let e=this.core.getModalElement(),t=e?.querySelector(`.tp-ui-mobile-clock-wrapper`),n=e?.querySelector(`.tp-ui-wrapper`),r=e?.querySelectorAll(`*`);t?.classList.add(`expanded`),n?.classList.add(`expanded`),r?.forEach(e=>{!e.classList.contains(`tp-ui-select-time`)&&!e.classList.contains(`tp-ui-mobile-clock-wrapper`)&&!e.classList.contains(`tp-ui-wrapper`)&&e.classList.add(`expanded`)})}}applyThemeDeferred(){setTimeout(()=>{this.managers.theme.setTheme();let e=this.core.getWrapper();e&&this.core.options.ui.cssClass&&e.classList.add(this.core.options.ui.cssClass)},0)}isCompactWheelMode(){return this.core.options.ui.mode===`compact-wheel`}isPopoverMode(){return this.isCompactWheelMode()&&!!this.core.options.wheel?.placement}resolveWheelMode(){let e=this.core.options.ui.mode;return(e===`wheel`||e===`compact-wheel`)&&bE.has(`wheel`)}emitMissingPluginErrors(){let e=this.core.options.ui.mode;(e===`wheel`||e===`compact-wheel`)&&!bE.has(`wheel`)&&this.emitter.emit(`error`,{error:`WheelPlugin is not registered. Import and register it: PluginRegistry.register(WheelPlugin)`}),this.core.options.range?.enabled&&!bE.has(`range`)&&this.emitter.emit(`error`,{error:`RangePlugin is not registered. Import and register it: PluginRegistry.register(RangePlugin)`}),this.core.options.timezone?.enabled&&!bE.has(`timezone`)&&this.emitter.emit(`error`,{error:`TimezonePlugin is not registered. Import and register it: PluginRegistry.register(TimezonePlugin)`})}initClockOrWheel(e){if(e){let e=this.managers.getPlugin(`wheel`);e&&e.init()}else this.managers.clock.initializeClockSystem(),this.managers.clock.setOnStartCSSClassesIfClockType24h(),this.managers.clock.setClassActiveToHourOnOpen()}initOptionalPlugins(e){let t=this.managers.getPlugin(`timezone`);t&&t.init();let n=this.managers.getPlugin(`range`);n&&!e&&n.init()}bindEventHandlers(e){this.managers.events.handleCancelButton(),this.managers.events.handleOkButton(),this.managers.clearButton.init(),e||(this.managers.events.handleHourEvents(),this.managers.events.handleMinutesEvents()),this.managers.events.handleKeyboardInput(),this.core.options.ui.enableSwitchIcon&&!e&&this.managers.events.handleSwitchViewButton(),this.core.options.clock.type!==`24h`&&!this.isCompactWheelMode()&&(this.managers.events.handleAmClick(),this.managers.events.handlePmClick()),this.core.options.behavior.focusTrap&&this.managers.events.focusTrapHandler(),this.core.options.ui.inline?.enabled||(this.managers.events.handleEscClick(),this.isPopoverMode()||(this.core.options.ui.mode===`wheel`||this.core.options.ui.mode===`compact-wheel`)&&this.core.options.wheel?.ignoreOutsideClick||this.managers.events.handleBackdropClick())}finalizeModal(e){let t=this.core.getModalElement();if(t&&nE(t),!e){let e=this.core.getClockFace();e&&typeof requestAnimationFrame<`u`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e?.classList.add(`scale-in`)})})}}clearUnmountTimeouts(){this.unmountTimeouts.forEach(clearTimeout),this.unmountTimeouts=[]}removeEventListeners(){aE()!==!1&&(FE.split(` `).forEach(e=>{document.removeEventListener(e,this.mutliEventsMoveHandler,!1)}),document.removeEventListener(`mousedown`,this.eventsClickMobileHandler))}},wD=class{events=new Map;on(e,t){this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(t)}once(e,t){let n=r=>{t(r),this.off(e,n)};this.on(e,n)}off(e,t){t?this.events.get(e)?.delete(t):this.events.delete(e)}emit(e,t){this.events.get(e)?.forEach(e=>{e(t)})}clear(){this.events.clear()}hasListeners(e){return(this.events.get(e)?.size??0)>0}},TD={clock:{type:`12h`,incrementHours:1,incrementMinutes:1,autoSwitchToMinutes:!0,disabledTime:void 0,currentTime:void 0},ui:{mode:`clock`,theme:`basic`,animation:!0,backdrop:!0,mobile:!1,enableSwitchIcon:!1,editable:!1,enableScrollbar:!1,cssClass:void 0,appendModalSelector:``,iconTemplate:``,iconTemplateMobile:``,inline:void 0,clearButton:!1},labels:{am:`AM`,pm:`PM`,ok:`OK`,cancel:`Cancel`,time:`Select time`,mobileTime:`Enter Time`,mobileHour:`Hour`,mobileMinute:`Minute`,clear:`Clear`},behavior:{focusInputAfterClose:!1,focusTrap:!0,delayHandler:300,id:void 0},callbacks:{onOpen:void 0,onCancel:void 0,onConfirm:void 0,onUpdate:void 0,onSelectHour:void 0,onSelectMinute:void 0,onSelectAM:void 0,onSelectPM:void 0,onError:void 0,onTimezoneChange:void 0,onRangeConfirm:void 0,onRangeSwitch:void 0,onRangeValidation:void 0,onClear:void 0},timezone:{enabled:!1,default:void 0,whitelist:void 0,label:`Timezone`},range:{enabled:!1,minDuration:void 0,maxDuration:void 0,fromLabel:`From`,toLabel:`To`},wheel:{placement:void 0,hideFooter:void 0,commitOnScroll:void 0,hideDisabled:void 0,ignoreOutsideClick:void 0},clearBehavior:{clearInput:!0}},ED=e=>e.replace(/[^0-9:APMapm\s]/g,``),DD=new Map,OD=class{core;managers;lifecycle;emitter;constructor(e,t){if(iE())throw Error(`TimepickerUI requires browser environment`);let n=this.resolveInputElement(e);if(!n)throw Error(`Input element not found`);let r=t?.behavior?.id,i=r||`tp-ui-${gE()}`,a=this.createWrapperElement(n),o=rE(t||{});if(o.ui.inline?.enabled&&typeof t?.behavior?.focusTrap>`u`&&(o.behavior.focusTrap=!1),o.ui.inline?.enabled){if(!o.ui.inline.containerId)throw Error(`inline.containerId is required when inline mode is enabled`);if(!iE()&&!document.getElementById(o.ui.inline.containerId))throw Error(`Container element with id "${o.ui.inline.containerId}" not found`)}this.emitter=new wD,this.core=new oE(a,o,i,r);let s=this.core.getInput();if(s){let e=ME(s,o.clock.type),t=Number(e.hour)*30,n=Number(e.minutes)*6;this.core.setDegreesHours(t),this.core.setDegreesMinutes(n)}this.managers=new _D(this.core,this.emitter),this.lifecycle=new CD(this.core,this.managers,this.emitter),this.managers.config.checkMobileOption(),this.managers.config.preventClockTypeByCurrentTime(),this.setupInternalEventListeners(),DD.set(this.core.instanceId,this)}setupInternalEventListeners(){this.emitter.on(`show`,()=>{this.core.isDestroyed||this.lifecycle.mount()}),this.emitter.on(`cancel`,()=>{this.core.isDestroyed||this.lifecycle.unmount()}),this.emitter.on(`confirm`,e=>{if(!this.core.isDestroyed){if(this.core.options.range?.enabled)return;let t=this.core.getInput();if(t&&e.hour&&e.minutes){let n=e.type?` ${e.type}`:``;t.value=`${e.hour}:${e.minutes}${n}`}e.autoCommit||this.lifecycle.unmount()}}),this.emitter.on(`range:confirm`,e=>{if(this.core.isDestroyed)return;let t=this.core.getInput();t&&(t.value=`${e.from} - ${e.to}`),this.lifecycle.unmount()})}create(){this.lifecycle.init(),this.core.options.ui.inline?.enabled&&this.lifecycle.mount()}open(e){this.lifecycle.mount(),e&&e()}close(e,t){this.lifecycle.unmount(e?t:void 0),!e&&t&&t()}destroy(e){DD.delete(this.core.instanceId),this.lifecycle.destroy(e)}update(e,t){this.core.isDestroyed||(this.core.updateOptions(e.options),this.managers.config.checkMobileOption(),this.managers.config.getDisableTime(),e.create&&this.create(),t&&t())}getValue(){if(this.core.isDestroyed)return{hour:``,minutes:``,type:void 0,time:``,degreesHours:null,degreesMinutes:null};let e=this.core.getModalElement(),t=this.core.getInput(),n=`12`,r=`00`,i=this.core.options.clock.type===`24h`?void 0:`AM`,a=null,o=null;if(e){let e=this.core.getHour(),t=this.core.getMinutes(),s=this.core.getActiveTypeMode();n=e?.value||`12`,r=t?.value||`00`,i=this.core.options.clock.type===`24h`?void 0:s?.textContent||`AM`,a=this.core.degreesHours,o=this.core.degreesMinutes}else if(t){let e=ME(t,this.core.options.clock.type);n=e.hour,r=e.minutes,i=e.type,a=Number(n)*30,o=Number(r)*6}let s=``;return s=this.core.options.clock.type===`24h`?`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`:`${n}:${r.padStart(2,`0`)} ${i}`,{hour:n,minutes:r,type:i,time:s,degreesHours:a,degreesMinutes:o}}setValue(e,t=!0){if(this.core.isDestroyed||!e||typeof e!=`string`)return;this.core.isInitialized||this.create();let n=ED(e.trim());try{let e=this.parseTimeString(n);if(this.applyParsedTime(e),this.syncPeriodIndicator(e.typeValue),t){let e=this.core.getInput();e&&(e.value=n)}this.syncClockVisual(e)}catch{return}}parseTimeString(e){if(this.core.options.clock.type===`24h`){let t=e.match(/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])$/);if(!t)throw Error(`Invalid 24h format. Expected HH:MM`);return{hourValue:t[1].padStart(2,`0`),minutesValue:t[2],typeValue:`AM`}}let t=e.match(/^(1[0-2]|[1-9]):([0-5][0-9])\s*(AM|PM)$/i);if(!t)throw Error(`Invalid 12h format. Expected HH:MM AM/PM`);return{hourValue:t[1],minutesValue:t[2],typeValue:t[3].toUpperCase()}}applyParsedTime(e){let t=this.core.getHour(),n=this.core.getMinutes();t&&(t.value=e.hourValue,t.setAttribute(`aria-valuenow`,e.hourValue),this.core.setDegreesHours(Number(e.hourValue)*30)),n&&(n.value=e.minutesValue,n.setAttribute(`aria-valuenow`,e.minutesValue),this.core.setDegreesMinutes(Number(e.minutesValue)*6))}syncPeriodIndicator(e){if(this.core.options.clock.type===`24h`)return;let t=this.core.getAM(),n=this.core.getPM();!t||!n||(e===`AM`?(t.classList.add(`active`),n.classList.remove(`active`)):(n.classList.add(`active`),t.classList.remove(`active`)))}syncClockVisual(e){let t=this.core.options.ui.mode;if(t===`wheel`||t===`compact-wheel`){let t=this.managers.getPlugin(`wheel`);t&&`scrollToValue`in t&&t.scrollToValue(e.hourValue,e.minutesValue,e.typeValue)}else{let e=this.core.getClockHand();e&&(e.style.transform=`rotateZ(${this.core.degreesHours||0}deg)`)}}getElement(){return this.core.element}get instanceId(){return this.core.instanceId}get options(){return this.core.options}get isInitialized(){return this.core.isInitialized}get isDestroyed(){return this.core.isDestroyed}get hour(){return this.core.getHour()}get minutes(){return this.core.getMinutes()}get okButton(){return this.core.getOkButton()}get cancelButton(){return this.core.getCancelButton()}get clockHand(){return this.core.getClockHand()}on(e,t){this.core.isDestroyed||this.emitter.on(e,t)}once(e,t){this.core.isDestroyed||this.emitter.once(e,t)}off(e,t){this.core.isDestroyed||this.emitter.off(e,t)}resolveInputElement(e){if(aE()===!1)return null;let t=null;if(typeof e==`string`){if(t=document.querySelector(e),!t)return null}else if(e instanceof HTMLElement)t=e;else return null;return t.tagName===`INPUT`?t:t.querySelector(`input`)}createWrapperElement(e){if(aE()===!1)return e;let t=e.parentElement;if(e.tagName===`INPUT`&&!t?.classList.contains(`tp-ui`)){let t=document.createElement(`div`);return t.className=`tp-ui`,e.parentNode?.insertBefore(t,e),t.appendChild(e),t}return t&&!t.classList.contains(`tp-ui`)&&t.classList.add(`tp-ui`),t||e}static getById(e){return DD.get(e)}static getAllInstances(){return Array.from(DD.values())}static isAvailable(e){return iE()?!1:typeof e==`string`?document.querySelector(e)!==null:e instanceof HTMLElement?document.contains(e):!1}static destroyAll(){Array.from(DD.values()).forEach(e=>e.destroy()),DD.clear()}},kD=OD,AD=kD})),MD=u({RangeManager:()=>VD,RangePlugin:()=>HD});function ND(e){if(!e||e===`--:--`)return null;let t=e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(t)return{hour:t[1],minutes:t[2],type:t[3].toUpperCase()};let n=e.match(/^(\d{1,2}):(\d{2})$/);return n?{hour:n[1],minutes:n[2]}:null}function PD(e){let t=e.minutes===`--`?`--`:e.minutes.padStart(2,`0`),n=`${e.hour}:${t}`;return e.type?`${n} ${e.type}`:n}function FD(e,t){if(!e)return 0;let n=parseInt(e.hour,10),r=parseInt(e.minutes,10);return t===`12h`&&e.type&&(e.type===`PM`&&n!==12&&(n+=12),e.type===`AM`&&n===12&&(n=0)),n*60+r}function ID(e,t,n){if(!e||!t)return 0;let r=FD(e,n);return FD(t,n)-r}function LD(e,t){return e?t===`12h`?!!(e.hour&&e.minutes&&e.type):!!(e.hour&&e.minutes):!1}function RD(e){if(!e||!e.includes(` - `))return{from:null,to:null};let t=e.split(` - `).map(e=>e.trim());return t.length!==2||t[0]===`--:--`||t[1]===`--:--`?{from:null,to:null}:{from:ND(t[0]),to:ND(t[1])}}var zD,BD,VD,HD,UD=c((()=>{zD=class{activePart=`from`;fromValue=null;toValue=null;previewValue=null;clockType;minDuration;maxDuration;emitter;constructor(e,t,n,r){this.clockType=e,this.minDuration=t,this.maxDuration=n,this.emitter=r}getActivePart(){return this.activePart}getFromValue(){return this.fromValue}getToValue(){return this.toValue}getPreviewValue(){return this.previewValue}setFromValue(e){this.fromValue=e}setToValue(e){this.toValue=e}setPreviewValue(e){this.previewValue=e}isFromComplete(){return LD(this.fromValue,this.clockType)}isToComplete(){return LD(this.toValue,this.clockType)}canSwitchToEnd(){return this.isFromComplete()}canConfirm(){return!this.isFromComplete()||!this.isToComplete()?!1:this.getDuration()>0}setActivePart(e){if(e===`to`&&!this.canSwitchToEnd())return!1;let t=this.activePart!==e;return this.activePart=e,t&&(this.previewValue=null),t}resetActivePart(){this.activePart=`from`,this.previewValue=null}getCurrentValue(){return this.previewValue?this.previewValue:this.activePart===`from`?this.fromValue:this.toValue}getSavedValue(){return this.activePart===`from`?this.fromValue:this.toValue}commitPreview(){this.previewValue&&=(this.activePart===`from`?this.fromValue=this.previewValue:this.toValue=this.previewValue,null)}getDuration(){return ID(this.fromValue,this.toValue,this.clockType)}validate(){if(!this.fromValue||!this.toValue)return{valid:!0,duration:0};let e=this.getDuration(),t=!0;return this.minDuration!==void 0&&e<this.minDuration&&(t=!1),this.maxDuration!==void 0&&e>this.maxDuration&&(t=!1),this.emitter.emit(`range:validation`,{valid:t,duration:e,minDuration:this.minDuration,maxDuration:this.maxDuration}),{valid:t,duration:e}}getDisabledTimeForEndPart(){if(this.activePart===`from`||!this.fromValue||!this.isFromComplete())return null;let e=[],t=[],n=parseInt(this.fromValue.hour,10),r=parseInt(this.fromValue.minutes,10),i=this.fromValue.type;if(this.clockType===`24h`){for(let t=0;t<n;t++)e.push(t.toString().padStart(2,`0`));for(let e=0;e<r;e++)t.push(e.toString().padStart(2,`0`));return{hours:e,minutes:t,fromHour:n}}for(let e=0;e<r;e++)t.push(e.toString().padStart(2,`0`));return{hours:e,minutes:t,fromType:i,fromHour:n}}reset(){this.activePart=`from`,this.fromValue=null,this.toValue=null,this.previewValue=null}},BD=class{core;state;constructor(e,t){this.core=e,this.state=t}updateTabs(){let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(`.tp-ui-range-tab.tp-ui-range-from`),n=e.querySelector(`.tp-ui-range-tab.tp-ui-range-to`),r=this.state.getActivePart()===`from`,i=this.state.isFromComplete();t?.classList.toggle(`active`,r),n?.classList.toggle(`active`,!r),n?.classList.toggle(`disabled`,!i),t?.setAttribute(`aria-selected`,String(r)),n?.setAttribute(`aria-selected`,String(!r)),n?.setAttribute(`aria-disabled`,String(!i)),t?.setAttribute(`tabindex`,r?`0`:`-1`),n?.setAttribute(`tabindex`,r||!i?`-1`:`0`)}updateTimeDisplay(){let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(`.tp-ui-range-from-time`),n=e.querySelector(`.tp-ui-range-to-time`),r=this.state.getActivePart(),i=this.state.getPreviewValue(),a=this.state.getFromValue(),o=this.state.getToValue(),s=`--:--`;r===`from`&&i?s=PD(i):a&&(s=PD(a));let c=`--:--`;r===`to`&&i?c=PD(i):o&&(c=PD(o)),t&&(t.textContent=s),n&&(n.textContent=c)}updateOkButton(){let e=this.core.getOkButton();if(!e)return;let t=this.state.canConfirm();e.classList.toggle(`disabled`,!t),e.setAttribute(`aria-disabled`,String(!t))}updateInputValue(){let e=this.core.getInput();if(!e)return;let t=this.state.getFromValue(),n=this.state.getToValue();e.value=`${t?PD(t):`--:--`} - ${n?PD(n):`--:--`}`}syncClockToActivePart(){let e=this.state.getSavedValue(),t=this.core.getHour(),n=this.core.getMinutes();if(t&&(t.value=e?.hour??`12`),n&&(n.value=e?.minutes??`00`),this.core.options.clock.type===`12h`){let t=this.core.getAM(),n=this.core.getPM();e?.type===`AM`?(t?.classList.add(`active`),n?.classList.remove(`active`)):e?.type===`PM`?(n?.classList.add(`active`),t?.classList.remove(`active`)):(t?.classList.remove(`active`),n?.classList.remove(`active`))}n&&(n.blur(),n.classList.remove(`active`)),t&&t.click()}updateAll(){this.updateTabs(),this.updateTimeDisplay(),this.updateOkButton()}},VD=class{core;emitter;state;ui;cleanupHandlers=[];isSyncingAmPm=!1;boundHandleMinuteCommit;boundHandleConfirm;boundHandleUpdate;boundHandleAmPm;boundHandleClear;constructor(e,t){this.core=e,this.emitter=t;let{range:n,clock:r}=e.options;this.state=new zD(r.type,n?.minDuration,n?.maxDuration,t),this.ui=new BD(e,this.state),this.boundHandleMinuteCommit=this.handleMinuteCommit.bind(this),this.boundHandleConfirm=this.handleConfirm.bind(this),this.boundHandleUpdate=this.handleUpdate.bind(this),this.boundHandleAmPm=this.handleAmPm.bind(this),this.boundHandleClear=this.handleClear.bind(this)}get isEnabled(){return this.core.options.range?.enabled===!0}init(){if(!this.isEnabled)return;let{from:e,to:t}=RD(this.core.getInput()?.value||``);this.state.setFromValue(e),this.state.setToValue(t),this.state.setActivePart(`from`),this.state.setPreviewValue(null),this.bindEvents(),this.ui.syncClockToActivePart(),this.emitAmPmSyncEvent(),this.ui.updateAll()}getActivePart(){return this.state.getActivePart()}setActivePart(e){this.isEnabled&&(this.state.setActivePart(e)&&this.emitter.emit(`range:switch`,{active:e,disabledTime:this.state.getDisabledTimeForEndPart()}),this.ui.syncClockToActivePart(),this.emitAmPmSyncEvent(),this.ui.updateAll())}getFromValue(){return this.state.getFromValue()}getToValue(){return this.state.getToValue()}getDisabledTimeForEndPart(){return this.isEnabled?this.state.getDisabledTimeForEndPart():null}getDuration(){return this.state.getDuration()}validateRange(){return this.isEnabled?this.state.validate():{valid:!0,duration:0}}canConfirm(){return this.isEnabled?this.state.canConfirm():!0}getFormattedRange(){let e=this.state.getFromValue(),t=this.state.getToValue();return!e||!t?null:{from:PD(e),to:PD(t)}}bindEvents(){let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(`.tp-ui-range-tab.tp-ui-range-from`),n=e.querySelector(`.tp-ui-range-tab.tp-ui-range-to`);if(t){let e=()=>this.setActivePart(`from`);t.addEventListener(`click`,e),this.cleanupHandlers.push(()=>t.removeEventListener(`click`,e))}if(n){let e=()=>this.setActivePart(`to`);n.addEventListener(`click`,e),this.cleanupHandlers.push(()=>n.removeEventListener(`click`,e))}this.emitter.on(`update`,this.boundHandleUpdate),this.cleanupHandlers.push(()=>this.emitter.off(`update`,this.boundHandleUpdate)),this.emitter.on(`range:minute:commit`,this.boundHandleMinuteCommit),this.cleanupHandlers.push(()=>this.emitter.off(`range:minute:commit`,this.boundHandleMinuteCommit)),this.emitter.on(`confirm`,this.boundHandleConfirm),this.cleanupHandlers.push(()=>this.emitter.off(`confirm`,this.boundHandleConfirm)),this.emitter.on(`select:am`,this.boundHandleAmPm),this.cleanupHandlers.push(()=>this.emitter.off(`select:am`,this.boundHandleAmPm)),this.emitter.on(`select:pm`,this.boundHandleAmPm),this.cleanupHandlers.push(()=>this.emitter.off(`select:pm`,this.boundHandleAmPm)),this.emitter.on(`clear`,this.boundHandleClear),this.cleanupHandlers.push(()=>this.emitter.off(`clear`,this.boundHandleClear))}handleClear(){this.isEnabled&&(this.state.setFromValue(null),this.state.setToValue(null),this.state.setPreviewValue(null),this.state.resetActivePart())}handleUpdate(){if(!this.isEnabled)return;let e=this.core.getHour(),t=this.core.getMinutes(),n=this.core.getActiveTypeMode(),r=e?.value??`12`,i=this.state.getSavedValue(),a=i?.minutes&&i.minutes!==`--`?t?.value??`--`:`--`,o=this.core.options.clock.type===`12h`?n?.textContent??void 0:void 0;this.state.setPreviewValue({hour:r,minutes:a,type:o}),this.ui.updateAll()}handleMinuteCommit(e){if(!this.isEnabled)return;let t={hour:e.hour,minutes:e.minutes,type:e.type??void 0};this.state.getActivePart()===`from`?(this.state.setFromValue(t),this.state.setPreviewValue(null),this.state.isFromComplete()&&(this.state.setActivePart(`to`),this.emitter.emit(`range:switch`,{active:`to`,disabledTime:this.state.getDisabledTimeForEndPart()}),this.ui.syncClockToActivePart(),this.emitAmPmSyncEvent())):(this.state.setToValue(t),this.state.setPreviewValue(null)),this.state.validate(),this.ui.updateAll()}handleAmPm(){if(!this.isEnabled||this.isSyncingAmPm||this.core.options.clock.type!==`12h`)return;let e=this.core.getActiveTypeMode()?.textContent;if(e){if(this.state.getActivePart()===`from`){let t=this.state.getFromValue();t&&(this.state.setFromValue({...t,type:e}),this.state.isFromComplete()&&(this.state.setActivePart(`to`),this.state.setPreviewValue(null),this.emitter.emit(`range:switch`,{active:`to`,disabledTime:this.state.getDisabledTimeForEndPart()}),this.ui.syncClockToActivePart(),this.emitAmPmSyncEvent()))}else{let t=this.state.getToValue();t&&this.state.setToValue({...t,type:e}),this.emitter.emit(`range:switch`,{active:`to`,disabledTime:this.state.getDisabledTimeForEndPart()})}this.state.validate(),this.ui.updateAll()}}emitAmPmSyncEvent(){if(this.core.options.clock.type!==`12h`)return;let e=this.state.getSavedValue();if(e?.type){this.isSyncingAmPm=!0;try{e.type===`AM`?this.emitter.emit(`select:am`,{}):e.type===`PM`&&this.emitter.emit(`select:pm`,{})}finally{this.isSyncingAmPm=!1}}}handleConfirm(e){if(!this.isEnabled)return;this.state.commitPreview();let t=this.state.getFromValue(),n=this.state.getToValue(),r=t?PD(t):`--:--`,i=n?PD(n):`--:--`,a=this.state.getDuration();this.ui.updateInputValue(),this.emitter.emit(`range:confirm`,{from:r,to:i,duration:a})}reset(){this.state.reset()}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[],this.reset()}},HD={name:`range`,factory:(e,t)=>new VD(e,t),clearHandler:(e,t)=>{if(!e.options.range?.enabled)return;let n=e.getModalElement();if(!n)return;let r=n.querySelector(`.tp-ui-range-from`),i=n.querySelector(`.tp-ui-range-to`),a=n.querySelector(`.tp-ui-range-from-time`),o=n.querySelector(`.tp-ui-range-to-time`);a&&(a.textContent=`--:--`),o&&(o.textContent=`--:--`),r?.classList.add(`active`),i?.classList.remove(`active`),r?.setAttribute(`aria-selected`,`true`),i?.setAttribute(`aria-selected`,`false`),r?.setAttribute(`tabindex`,`0`),i?.setAttribute(`tabindex`,`-1`),i?.classList.add(`disabled`),i?.setAttribute(`aria-disabled`,`true`);let s=e.getHour();s&&s.focus(),t.emit(`range:switch`,{active:`from`,disabledTime:null})}}})),WD,GD,KD,qD=!1;async function JD(){if(!WD){let e=await Promise.resolve().then(()=>(jD(),QT));WD=e.TimepickerUI,GD=e.PluginRegistry,KD=(await Promise.resolve().then(()=>(UD(),MD))).RangePlugin,!qD&&GD&&KD&&(GD.register(KD),qD=!0)}}var YD=class{constructor(e){if(this.config={dayStartTime:`00:00`,dayEndTime:`23:59`,minuteIncrement:5,clockType:`12h`,...e},this.selectedStart=this.extractTimeAsHHMM(e.startTime),e.endTime)this.selectedEnd=this.extractTimeAsHHMM(e.endTime);else{let e=new Date(`2000-01-01T${this.selectedStart}:00Z`),n=new Date(e.getTime()+3600*1e3);this.selectedEnd=t.tools.dateTime.extractTime(n.toISOString())}this.inputElement=document.createElement(`input`),this.container=this.createUI()}extractTimeAsHHMM(e){return e.includes(`T`)?t.tools.dateTime.extractTime(e):e}createUI(){let e=document.createElement(`div`);return e.style.cssText=`
230
+ </div>`},TE=e=>{let{range:{enabled:t,fromLabel:n,toLabel:r}}=e;return!t||!bE.has(`range`)?``:`<div class="tp-ui-range-header" role="tablist" aria-label="Range selection"><button type="button" class="tp-ui-range-tab tp-ui-range-from active" role="tab" tabindex="0" aria-selected="true"><span class="tp-ui-range-tab-label">${n}</span><span class="tp-ui-range-tab-value tp-ui-range-from-time">--:--</span></button><button type="button" class="tp-ui-range-tab tp-ui-range-to" role="tab" tabindex="-1" aria-selected="false"><span class="tp-ui-range-tab-label">${r}</span><span class="tp-ui-range-tab-value tp-ui-range-to-time">--:--</span></button></div>`},EE=(e,t)=>{let{ui:{clearButton:n},labels:{clear:r}}=e;return n?`<div class="tp-ui-clear-btn ${t} disabled" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${r}" aria-disabled="true">${r}</div>`:``},DE=(e,t,n)=>{if(e.isWheelMode){let t=bE.getTemplateProvider(`wheel`);return t?`<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}">${t(n,e.instanceId)}</div>`:`<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}"></div>`}return`<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}"><div class="tp-ui-body ${e.mobileClass}"><div class="tp-ui-clock-face ${e.mobileClass}" role="group" aria-label="Clock"><div class="tp-ui-dot ${e.mobileClass}" aria-hidden="true"></div><div class="tp-ui-clock-hand ${e.mobileClass}" aria-hidden="true"><div class="tp-ui-circle-hand ${e.mobileClass}"></div></div><div class="tp-ui-tips-wrapper ${e.mobileClass}" role="listbox" aria-label="Time"></div>${e.clockType===`24h`?`<div class="tp-ui-tips-wrapper-24h ${e.mobileClass}" role="listbox" aria-label="24h"></div>`:``}</div></div></div>`},OE=(e,t)=>{let{labels:{time:n,mobileTime:r,am:i,pm:a,mobileMinute:o,mobileHour:s},ui:{editable:c}}=e,{mobileClass:l,clockType:u,instanceId:d}=t,f=l?r:n,p=u===`24h`?``:`<div class="tp-ui-wrapper-type-time ${l}" role="group" aria-label="Period"><div class="tp-ui-type-mode tp-ui-am ${l?`mobile`:`tp-ui-ripple`}" data-md3-ripple tabindex="0" role="button" aria-label="${i}" aria-pressed="false" data-type="AM">${i}</div><div class="tp-ui-type-mode tp-ui-pm ${l?`mobile`:`tp-ui-ripple`}" data-md3-ripple tabindex="0" role="button" aria-label="${a}" aria-pressed="false" data-type="PM">${a}</div></div>`;return`<div class="tp-ui-select-time ${l}" id="tp-ui-label-${d}">${f}</div><div class="tp-ui-header ${l}"><div class="tp-ui-wrapper-time ${l} ${u===`24h`?`tp-ui-wrapper-time-24h`:``}" role="group" aria-label="${f}"><div class="tp-ui-input-wrapper ${l}"><div class="tp-ui-input-ripple-wrapper ${l}" data-md3-ripple><input name="hour" ${!c&&!l?`readonly`:``} class="tp-ui-hour ${l}" tabindex="0" type="number" min="0" max="${u===`12h`?`12`:`23`}" aria-label="${l?s:`Hour`}" role="spinbutton" aria-valuenow="12"></div><div class="tp-ui-hour-text ${l}">${s}</div></div><div class="tp-ui-dots ${l}" aria-hidden="true"><span></span><span></span></div><div class="tp-ui-input-wrapper ${l}"><div class="tp-ui-input-ripple-wrapper ${l}" data-md3-ripple><input name="minutes" ${!c&&!l?`readonly`:``} class="tp-ui-minutes ${l}" tabindex="0" type="number" min="0" max="59" aria-label="${l?o:`Minute`}" role="spinbutton" aria-valuenow="0"></div><div class="tp-ui-minute-text ${l}">${o}</div></div></div>${p}</div>`},kE=(e,t)=>{let{ui:{enableSwitchIcon:n,iconTemplate:r,iconTemplateMobile:i},labels:{cancel:a,ok:o}}=e,s=`<button aria-label="Keyboard" type="button" class="tp-ui-keyboard-icon">${r||_E}</button>`,c=i||`<button aria-label="Clock" type="button" class="tp-ui-keyboard-icon">${i||vE}</button>`,l=n?`<div class="tp-ui-keyboard-icon-wrapper ${t}" tabindex="0" role="button" aria-pressed="false" aria-label="Toggle" data-view="desktop">${t?c:s}</div>`:``,u=EE(e,t);return`<div class="tp-ui-footer ${t}" ${t?`data-view="mobile"`:``}>${l}<div class="tp-ui-wrapper-btn ${t}">${u}<div class="tp-ui-cancel-btn ${t}" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${a}">${a}</div><div class="tp-ui-ok-btn ${t}" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${o}">${o}</div></div></div>`},AE=(e,t)=>{let{ui:{mode:n,animation:r,theme:i,mobile:a},clock:{incrementMinutes:o}}=e,s=a?`mobile`:``,c=n===`compact-wheel`&&bE.has(`wheel`),l=(n===`wheel`||c)&&bE.has(`wheel`),u=!!e.range?.enabled&&bE.has(`range`),d=!!e.timezone?.enabled&&bE.has(`timezone`),f={mobileClass:s,clockType:e.clock.type||`12h`,instanceId:t,isWheelMode:l,isCompactWheel:c,isRangeMode:u},p=TE(e),m=wE(e,s,t),h=c?``:OE(e,f),g=DE(f,o??1,e),_=c&&e.wheel?.hideFooter===!0?``:kE(e,s),v;return v=c?` tp-ui-compact-wheel-mode`:l?` tp-ui-wheel-mode`:``,`<div class="tp-ui-modal normalize ${s}${u?` tp-ui-range-mode`:``}${d?` tp-ui-tz-mode`:``}${v}" data-theme="${i}" role="dialog" aria-modal="true" aria-labelledby="tp-ui-label-${t}" data-owner-id="${t}" style='transition:${r?`opacity 0.15s linear`:`none`}'><div class="tp-ui-wrapper ${s}" tabindex="0">${p}${h}${m}${g}${_}</div><div class="timepicker-announcer sr-only" role="status" aria-live="polite" aria-atomic="true"></div></div>`},jE=class{core;emitter;timeouts=[];originalOverflow;originalPaddingRight;constructor(e,t){this.core=e,this.emitter=t}runWithTimeout(e,t=sE.DEFAULT_DELAY){let n=setTimeout(e,t);this.timeouts.push(n)}clearAllTimeouts(){this.timeouts.forEach(clearTimeout),this.timeouts=[]}isPopoverMode(){return this.core.options.ui.mode===`compact-wheel`&&!!this.core.options.wheel?.placement}clearExistingModal(){if(aE()===!1)return;let e=this.core.getModalElement();e&&e.remove()}setModalTemplate(){if(aE()===!1)return;this.clearExistingModal();let e=AE(this.core.options,this.core.instanceId);if(this.core.options.ui.inline?.enabled){let t=document.getElementById(this.core.options.ui.inline.containerId);if(!t)return;t.innerHTML=``,t.insertAdjacentHTML(`beforeend`,e);let n=t.querySelector(`.tp-ui-modal`);if(n){n.classList.add(`tp-ui--inline`);let{showButtons:e}=this.core.options.ui.inline;(e===!1||e===void 0)&&n.querySelectorAll(`.tp-ui-wrapper-btn, .tp-ui-wrapper-btn.mobile`).forEach(e=>e.style.display=`none`)}return}let{appendModalSelector:t}=this.core.options.ui;t?document.querySelector(t)?.insertAdjacentHTML(`beforeend`,e):document.body.insertAdjacentHTML(`beforeend`,e)}setScrollbarOrNot(){aE()!==!1&&(this.core.options.ui.inline?.enabled||this.isPopoverMode()||(this.core.options.ui.enableScrollbar?this.runWithTimeout(()=>{iE()||this.runWithTimeout(()=>{typeof document<`u`&&(document.body.style.overflowY=this.originalOverflow||``,document.body.style.paddingRight=this.originalPaddingRight||``)},sE.SCROLLBAR_RESTORE)},400):(this.originalOverflow=document.body.style.overflowY,this.originalPaddingRight=document.body.style.paddingRight,document.body.style.paddingRight=`${lE()}px`,document.body.style.overflowY=`hidden`)))}removeBackdrop(){if(this.core.options.ui.inline?.enabled||this.core.options.ui.backdrop)return;let e=this.core.getModalElement(),t=this.core.getOpenElement();e?.classList.add(`removed`),t.forEach(e=>e?.classList.add(`disabled`))}setNormalizeClass(){let e=this.core.getModalElement();e&&(e.classList.add(`tp-ui-normalize`),e.querySelectorAll(`:scope > div`).forEach(e=>e.classList.add(`tp-ui-normalize`)))}setShowClassToBackdrop(){if(this.core.options.ui.inline?.enabled||this.isPopoverMode()){this.core.getModalElement()?.classList.add(`show`),this.setInitialFocus();return}this.core.options.ui.backdrop&&this.runWithTimeout(()=>{this.core.getModalElement()?.classList.add(`show`),this.setInitialFocus()},sE.MODAL_ANIMATION)}setInitialFocus(){if(!this.core.options.behavior.focusTrap)return;let e=this.core.getWrapper();e&&typeof requestAnimationFrame<`u`&&requestAnimationFrame(()=>{e.focus()})}setFlexEndToFooterIfNoKeyboardIcon(){let e=this.core.getFooter();!this.core.options.ui.enableSwitchIcon&&e&&(e.style.justifyContent=`flex-end`)}destroy(){this.clearAllTimeouts(),!iE()&&!this.core.options.ui.inline?.enabled&&(document.body.style.overflowY=this.originalOverflow||``,document.body.style.paddingRight=this.originalPaddingRight||``),this.clearExistingModal()}},ME=(e,t,n,r)=>{let i={hour:`12`,minutes:`00`,type:t===`24h`?void 0:`PM`};if(!e)return i;let a=e.value.trim();if(!n&&!a)return i;if(typeof n==`boolean`&&n){let[e,n]=new Date().toLocaleTimeString().split(`:`),r=e.padStart(2,`0`);if(/[a-z]/i.test(n)&&t===`12h`){let[e,t]=n.split(` `);return{hour:r,minutes:e,type:t}}return{hour:r,minutes:n,type:void 0}}if(typeof n==`object`){let{time:e,locales:i,preventClockType:a}=n,o=e??new Date;if(a&&r){let[e,t]=new Date(o).toLocaleTimeString().split(`:`);if(/[a-z]/i.test(t)){let[n,r]=t.split(` `);return{hour:e,minutes:n,type:r}}return{hour:e.padStart(2,`0`),minutes:t,type:void 0}}let[s,c]=new Date(o).toLocaleTimeString(i||`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:t===`12h`}).split(`:`);if(t===`12h`&&/[a-z]/i.test(c)){let e=c.trim().split(` `);return{hour:s,minutes:e[0],type:e[1]||`AM`}}return{hour:s,minutes:c.replace(/\D/g,``),type:void 0}}let[o,s]=a.split(` `),[c=``,l=``]=o.split(`:`),u=c.replace(/\D/g,``),d=l.replace(/\D/g,``),f={hour:u.padStart(2,`0`),minutes:d.padStart(2,`0`),type:t===`12h`?s:void 0};if(u.length>2||d.length>2)return{...f,error:`Invalid input: too many digits.`,currentHour:c,currentMin:l};if(/[a-z]/i.test(o))return{...f,error:`Input contains invalid letters.`};if(a.includes(` `)&&(!s||a.length>8||s!==`AM`&&s!==`PM`))return{...f,error:`Invalid AM/PM format or length.`,currentLength:a.length,currentType:s};let p=Number(u),m=Number(d);if(t===`12h`){if(p<1||p>12||m<0||m>59||s!==`AM`&&s!==`PM`)return{...f,error:`Invalid 12h time.`,currentHour:p,currentMin:m,currentType:s}}else if(p<0||p>23||m<0||m>59)return{...f,error:`Invalid 24h time.`,currentHour:p,currentMin:m};return f},NE=(e,t,n)=>{let r=Number(e);if(Number.isNaN(r))return!1;switch(t){case`hour`:return n===`24h`?r>=0&&r<=23:r>0&&r<=12;case`minutes`:return r>=0&&r<=59;default:return}},PE=`tp-ui`,FE=`mousedown mouseup mousemove mouseleave mouseover touchstart touchmove touchend`,IE=`active`,LE=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}isCurrentTimeEnabled(e){let t=this.core.options.clock.currentTime;return typeof t==`boolean`?t:!!t?.[e]}preventClockTypeByCurrentTime(){if(!this.isCurrentTimeEnabled(`preventClockType`))return;let e=this.core.getInput();if(!e)return;let{currentTime:t,clockType:n}={currentTime:this.core.options.clock.currentTime,clockType:this.core.options.clock.type},{type:r}=ME(e,n,t,!0);this.core.updateOptions({clock:{type:r?`12h`:`24h`}})}updateInputValueWithCurrentTimeOnStart(){if(!this.isCurrentTimeEnabled(`updateInput`))return;let e=this.core.getInput();if(!e)return;let{hour:t,minutes:n,type:r}=ME(e,this.core.options.clock.type,this.core.options.clock.currentTime);e.value=r?`${t}:${n} ${r}`:`${t}:${n}`}getInputValueOnOpenAndSet(){let e=this.core.getInput();if(!e)return;let t=ME(e,this.core.options.clock.type,this.core.options.clock.currentTime),n=this.core.getHour(),r=this.core.getMinutes(),i=this.core.getActiveTypeMode(),a=this.core.getAM();if(t===void 0){n&&(n.value=`12`),r&&(r.value=`00`);let e={hour:n?.value||`12`,minutes:r?.value||`00`,type:i?.dataset.type,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes};this.emitter.emit(`open`,e);let t=this.core.options.range?.enabled===!0;this.core.options.clock.type!==`24h`&&a&&!t&&a.classList.add(IE);return}let[o,s,c]=e.value.split(`:`).join(` `).split(` `);e.value.length===0&&(o=t.hour,s=t.minutes,c=t.type),this.core.options.clock.type!==`24h`&&!c&&(c=t.type||`AM`),n&&(n.value=o.padStart(2,`0`)),r&&(r.value=s.padStart(2,`0`));let l=this.core.getModalElement()?.querySelector(`[data-type='${c}']`);this.core.options.clock.type!==`24h`&&l&&l.classList.add(IE);let u={...t,type:i?.dataset.type,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes};this.emitter.emit(`open`,u)}getInputValue(e,t,n){return ME(e,t,n)}destroy(){}},RE=class{core;emitter;isAnimating=!1;constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on(`switch:view`,()=>{this.toggleMobileClockFace()})}checkMobileOption(){this.core.setIsMobileView(!!this.core.options.ui.mobile),this.core.options.ui.mobile&&this.core.updateOptions({ui:{editable:!0}})}toggleMobileClockFace(){if(this.isAnimating)return;let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(`.tp-ui-wrapper`),n=this.core.getKeyboardClockIcon(),r=e.querySelector(`.tp-ui-mobile-clock-wrapper`),i=e.querySelectorAll(`*`),a=e.querySelector(`.tp-ui-select-time`),o=this.core.getHour(),s=this.core.getMinutes(),c=this.core.getClockFace();if(!t)return;let l=t.classList.contains(`expanded`),u=this.core.isMobileView;l?this.collapseClockFace(t,r,i,n,a,o,s,c,u):this.expandClockFace(t,r,i,n,a,o,s,c)}collapseClockFace(e,t,n,r,i,a,o,s,c){if(this.isAnimating=!0,typeof requestAnimationFrame<`u`){let l=typeof window<`u`&&window.matchMedia(`(orientation: landscape) and (min-width: 320px) and (max-width: 825px)`).matches;requestAnimationFrame(()=>{l&&e instanceof HTMLElement?this.collapseLandscape(e,t,n,r,i,a,o,s,c):this.collapsePortrait(e,t,n,r,i,a,o,s,c)})}else this.switchView(i,r,a,o,!0),this.isAnimating=!1;r?.setAttribute(`aria-label`,`Show clock face`),r?.setAttribute(`aria-pressed`,`false`)}collapseLandscape(e,t,n,r,i,a,o,s,c){s?.classList.remove(`scale-in`);let l=this.core.getModalElement(),u=this.getMobileLandscapeHeight(l);e.style.width=`328px`,e.style.height=u,t instanceof HTMLElement&&(t.style.height=`0`,t.style.opacity=`0`,t.style.transform=`scale(0)`),setTimeout(()=>{this.applyMobileClasses(e,t,n,i,c),e.classList.add(`mobile`),t&&t.classList.add(`mobile`),this.switchView(i,r,a,o,!0),requestAnimationFrame(()=>{e.style.width=``,e.style.height=``,t instanceof HTMLElement&&(t.style.height=``,t.style.opacity=``,t.style.transform=``),this.isAnimating=!1})},sE.WRAPPER_TRANSITION)}collapsePortrait(e,t,n,r,i,a,o,s,c){c?s?.classList.remove(`scale-in`):s?.classList.add(`scale-in`),t?.classList.remove(`expanded`),c&&t?.classList.add(`mobile`),requestAnimationFrame(()=>{this.applyMobileClasses(e,t,n,i,c),this.switchView(i,r,a,o,!0),setTimeout(()=>{this.isAnimating=!1},sE.MOBILE_TOGGLE)})}applyMobileClasses(e,t,n,r,i){e.classList.remove(`expanded`),t?.classList.remove(`expanded`),i&&(e.classList.add(`mobile`),t?.classList.add(`mobile`)),n.forEach(n=>{n!==t&&n!==e&&n!==r&&(n.classList.remove(`expanded`),i&&n.classList.add(`mobile`))}),r&&(r.classList.remove(`expanded`),i&&r.classList.add(`mobile`))}expandClockFace(e,t,n,r,i,a,o,s){this.isAnimating=!0,o?.classList.contains(`active`)&&o?this.emitter.emit(`select:minute`,{minutes:o.value}):a&&this.emitter.emit(`select:hour`,{hour:a.value}),n.forEach(n=>{n!==t&&n!==e&&n!==i&&(n.classList.remove(`mobile`),n.classList.add(`expanded`))}),i&&(i.classList.remove(`mobile`),i.classList.add(`expanded`)),this.switchView(i,r,a,o,!1),typeof requestAnimationFrame<`u`?requestAnimationFrame(()=>{e.classList.remove(`mobile`),e.classList.add(`expanded`),requestAnimationFrame(()=>{t&&(t.classList.remove(`mobile`),t.classList.add(`expanded`)),s&&s.classList.remove(`scale-in`),setTimeout(()=>{s&&s.classList.add(`scale-in`)},sE.CLOCK_SCALE_DELAY),setTimeout(()=>{this.isAnimating=!1},sE.MOBILE_TOGGLE)})}):this.isAnimating=!1,r?.setAttribute(`aria-label`,`Hide clock face`),r?.setAttribute(`aria-pressed`,`true`)}switchView(e,t,n,r,i){let a=this.core.getModalElement(),o=a?.querySelector(`.tp-ui-hour-text`),s=a?.querySelector(`.tp-ui-minute-text`),c=t?.querySelector(`.tp-ui-keyboard-icon`),l=this.core.getInputWrappers(),u=this.core.getHeader(),d=a?.querySelector(`.tp-ui-wrapper-type-time`),f=a?.querySelector(`.tp-ui-am`),p=a?.querySelector(`.tp-ui-pm`),m=a?.querySelectorAll(`.tp-ui-input-ripple-wrapper`),{iconTemplate:h,iconTemplateMobile:g}=this.core.options.ui,{time:_,mobileTime:v}=this.core.options.labels;i?(e?.classList.add(`mobile`),t?.classList.add(`mobile`),n?.classList.add(`mobile`),n?.removeAttribute(`readonly`),r?.classList.add(`mobile`),r?.removeAttribute(`readonly`),o?.classList.add(`mobile`),s?.classList.add(`mobile`),u?.classList.add(`mobile`),d?.classList.add(`mobile`),f?.classList.add(`mobile`),f?.classList.remove(`tp-ui-ripple`),p?.classList.add(`mobile`),p?.classList.remove(`tp-ui-ripple`),l?.forEach(e=>{e.classList.add(`mobile`)}),m?.forEach(e=>{e.classList.add(`mobile`)}),e&&v&&(e.textContent=v),c&&(c.innerHTML=g||vE),this.updateClockFaceAccessibility(!0)):(e?.classList.remove(`mobile`),t?.classList.remove(`mobile`),n?.classList.remove(`mobile`),r?.classList.remove(`mobile`),this.core.options.ui.editable||(n?.setAttribute(`readonly`,``),r?.setAttribute(`readonly`,``)),o?.classList.remove(`mobile`),s?.classList.remove(`mobile`),u?.classList.remove(`mobile`),d?.classList.remove(`mobile`),f?.classList.remove(`mobile`),f?.classList.add(`tp-ui-ripple`),p?.classList.remove(`mobile`),p?.classList.add(`tp-ui-ripple`),l?.forEach(e=>{e.classList.remove(`mobile`)}),m?.forEach(e=>{e.classList.remove(`mobile`)}),e&&_&&(e.textContent=_),c&&(c.innerHTML=h||_E),this.updateClockFaceAccessibility(!1))}updateClockFaceAccessibility(e){let t=this.core.getClockFace();if(!t)return;let n=t.querySelector(`.tp-ui-tips-wrapper`),r=t.querySelector(`.tp-ui-tips-wrapper-24h`),i=t.querySelectorAll(`.tp-ui-tip`);e?(t.setAttribute(`aria-hidden`,`true`),n?.setAttribute(`aria-hidden`,`true`),r?.setAttribute(`aria-hidden`,`true`),i.forEach(e=>{e.setAttribute(`tabindex`,`-1`),e.setAttribute(`aria-hidden`,`true`)})):(t.removeAttribute(`aria-hidden`),n?.removeAttribute(`aria-hidden`),r?.removeAttribute(`aria-hidden`),i.forEach(e=>{e.setAttribute(`tabindex`,`0`),e.removeAttribute(`aria-hidden`)}))}getMobileLandscapeHeight(e){return e?.classList.contains(`tp-ui-tz-mode`)?`326px`:e?.classList.contains(`tp-ui-range-mode`)?`287px`:`258px`}destroy(){}},zE=e=>{if(!e)return;let{disabledTime:t,type:n}=e.clock;if(!t||!Object.keys(t).length)return;let{hours:r,minutes:i,interval:a}=t;if(a){delete t.hours,delete t.minutes;let e=Array.isArray(a)?a:[a];if(!n)throw Error(`clockType required for interval`);return hE(e,n),{value:e.map(e=>{let[t,r]=e.trim().split(`-`),{hour:i,minutes:a,type:o}=ME({value:t.trim()},n),{hour:s,minutes:c,type:l}=ME({value:r.trim()},n),u=dE(i,s).map(e=>Number(e)===0?`00`:String(Number(e))),d=[],f=Number(a),p=Number(c);if(l===o)return f>0&&p<=0?(d.push(u[0],u[u.length-1]),u=u.slice(1,-1)):p<59&&p>0&&f<=0?(d.push(void 0,u[u.length-1]),u=u.slice(0,-1)):p>0&&f>0?(d.push(u[0],u[u.length-1]),u=u.slice(1,-1)):p===0&&f===0&&(d.push(void 0,u[u.length-1]),u.pop()),{removedStartedHour:d[0]!==void 0&&Number(d[0])<=9?`0${d[0]}`:d[0],removedEndHour:d[1]!==void 0&&Number(d[1])<=9?`0${d[1]}`:d[1],rangeArrHour:u,startMinutes:dE(a,59).map(e=>Number(e)<=9?`0${e}`:`${e}`),endMinutes:fE(0,c).map(e=>Number(e)<=9?`0${e}`:`${e}`),startType:o,endType:l};{let e=dE(i,12).map(String),t=fE(1,s).map(String),n=[],r=[];return f>0&&p<=0?(r.push(t[t.length-1]),n.push(e[0]),t.pop(),e.shift()):p<59&&p>0&&f<=0?(n.push(e[0]),r.push(t[t.length-1]),t.pop()):p>0&&f>0?(r.push(t[t.length-1]),n.push(e[0]),t.pop(),e.shift()):p===0&&f===0&&(r.push(t[t.length-1]),n.push(e[0]),t.pop()),{startType:o,endType:l,amHours:e,pmHours:t,removedAmHour:n[0]&&Number(n[0])<=9?`0${n[0]}`:n[0],removedPmHour:r[0]&&Number(r[0])<=9?`0${r[0]}`:r[0],startMinutes:Number(a)===0?[]:dE(a,59).map(e=>Number(e)<=9?`0${e}`:`${e}`),endMinutes:fE(0,c).map(e=>Number(e)<=9?`0${e}`:`${e}`)}}}).reduce((e,t)=>(Object.entries(t).forEach(([t,n])=>{Array.isArray(n)?e[t]=Array.isArray(e[t])?[...e[t],...n]:[...n]:e[t]=n}),e),{isInterval:!0,clockType:n,intervals:e})}}return r?.forEach(e=>{if(n===`12h`&&Number(e)>12)throw Error(`The disabled hours value has to be less than 13`);if(n===`24h`&&Number(e)>23)throw Error(`The disabled hours value has to be less than 24`)}),i?.forEach(e=>{if(Number(e)>59)throw Error(`The disabled minutes value has to be less than 60`)}),{value:{hours:r?.map(e=>e===`00`||Number(e)===0?`0${Number(e)}`:`${Number(e)}`),minutes:i?.map(e=>Number(e)<=9?`0${e}`:`${e}`)}}},BE=(e,t,n,r)=>{if(e){if(Array.isArray(e)&&e.length>0)return!e.map(e=>NE(e,t,n)).some(e=>e===!1);if(typeof e==`string`||typeof e==`number`){let i=NE(e,t,n),a=r?.map(Number).includes(Number(e));return!!(i&&!a)}}},VE=class{core;constructor(e){this.core=e}getDisableTime(){let e=zE(this.core.options);this.core.setDisabledTime(e||null)}destroy(){}},HE=class{inputValueHandler;mobileViewHandler;disabledTimeHandler;core;constructor(e,t){this.core=e,this.inputValueHandler=new LE(e,t),this.mobileViewHandler=new RE(e,t),this.disabledTimeHandler=new VE(e)}preventClockTypeByCurrentTime(){this.inputValueHandler.preventClockTypeByCurrentTime()}updateInputValueWithCurrentTimeOnStart(){this.inputValueHandler.updateInputValueWithCurrentTimeOnStart()}getInputValueOnOpenAndSet(){this.inputValueHandler.getInputValueOnOpenAndSet()}getInputValue(e,t,n){return this.inputValueHandler.getInputValue(e,t,n)}checkMobileOption(){this.mobileViewHandler.checkMobileOption()}toggleMobileClockFace(){this.mobileViewHandler.toggleMobileClockFace()}updateClockFaceAccessibility(e){this.mobileViewHandler.updateClockFaceAccessibility(e)}getDisableTime(){this.disabledTimeHandler.getDisableTime()}destroy(){this.inputValueHandler.destroy(),this.mobileViewHandler.destroy(),this.disabledTimeHandler.destroy()}},UE=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}setTheme(){let e=this.core.getModalElement();if(!e)return;let{theme:t}=this.core.options.ui;t&&e.setAttribute(`data-theme`,t)}setInputClassToInputElement(){let e=this.core.getInput();e&&(uE(e,`tp-ui-input`)||e.classList.add(`tp-ui-input`))}setDataOpenToInputIfDoesntExistInWrapper(){let e=this.core.getOpenElementData(),t=this.core.getInput();e===null&&t&&t.setAttribute(`data-open`,`tp-ui-input`)}setClassTopOpenElement(){let e=this.core.getOpenElement();for(let t of e)t&&t.classList.add(`tp-ui-open-element`)}setTimepickerClassToElement(){let e=this.core.element;if(!e)return;e.classList.add(PE);let t=this.core.options.ui.cssClass;t&&t!==PE&&e.classList.add(t)}destroy(){let e=this.core.getModalElement();e&&e.removeAttribute(`data-theme`)}},WE=class e extends Error{constructor(t,n){super(`[TimepickerUI] ${t}`),this.code=n,this.name=`TimepickerError`,Object.setPrototypeOf(this,e.prototype)}},GE={ELEMENT_NOT_FOUND:`ELEMENT_NOT_FOUND`,INVALID_PARAMETER:`INVALID_PARAMETER`,NO_INPUT_ELEMENT:`NO_INPUT_ELEMENT`,INSTANCE_DESTROYED:`INSTANCE_DESTROYED`,NOT_INITIALIZED:`NOT_INITIALIZED`,INVALID_TIME_FORMAT:`INVALID_TIME_FORMAT`,INLINE_CONFIG_ERROR:`INLINE_CONFIG_ERROR`,CONTAINER_NOT_FOUND:`CONTAINER_NOT_FOUND`,SSR_ENVIRONMENT:`SSR_ENVIRONMENT`},KE=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}setErrorHandler(){let e=this.core.getInput();if(!e)return!0;let{error:t,currentHour:n,currentMin:r,currentType:i,currentLength:a}=ME(e,this.core.options.clock.type);if(this.removeErrorHandler(),t){if(aE()===!1)return!1;let o=document.createElement(`div`);o.classList.add(`tp-ui-invalid-text`),o.innerHTML=`<b>Invalid Time Format</b>`,e.classList.add(`tp-ui-invalid-format`),e.nextElementSibling?.classList.contains(`tp-ui-invalid-text`)||e.after(o);let s={error:t,rejectedHour:void 0,rejectedMinute:void 0,inputHour:n,inputMinute:r,inputType:i,inputLength:a};return this.emitter.emit(`error`,s),!1}return!0}removeErrorHandler(){let e=this.core.getInput();if(!e)return;e.classList.remove(`tp-ui-invalid-format`);let t=e.nextElementSibling;t?.classList.contains(`tp-ui-invalid-text`)&&t.remove()}checkDisabledValuesOnStart(){if(!this.core.options.clock.disabledTime)return;let{disabledTime:e,type:t}=this.core.options.clock;if(e.interval){if(!t)throw new WE(`clockType is required when using disabledTime.interval`,GE.INVALID_PARAMETER);let n=Array.isArray(e.interval)?e.interval:[e.interval];try{hE(n,t)}catch(e){throw new WE(`Invalid disabledTime.interval: ${e.message}`,GE.INVALID_PARAMETER)}return}let{hours:n,minutes:r}=e,i=n?BE(n,`hour`,t):!0,a=r?BE(r,`minutes`,t):!0;if(!i||!a)throw new WE(`Invalid hours or minutes in disabledTime option`,GE.INVALID_PARAMETER)}destroy(){this.removeErrorHandler()}},qE=(e,t)=>{if(!e)return;let n=e.querySelector(`.timepicker-announcer`);n&&(n.textContent=``,setTimeout(()=>{n.textContent=t},100))},JE=(e,t)=>{e&&e.setAttribute(`aria-pressed`,String(t))},YE=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleOpenOnClick(){let e=this.core.getOpenElement();if(!e)return;let t=e=>{this.core.isDestroyed||e.currentTarget?.classList.contains(`disabled`)||this.emitter.emit(`show`,{})};e.forEach(e=>{e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))})}handleCancelButton(){let e=this.core.getCancelButton();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit(`cancel`,{})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handleOkButton(){let e=this.core.getOkButton();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let e=this.core.getHour(),t=this.core.getMinutes();if(e&&t){let n=this.core.getActiveTypeMode();this.emitter.emit(`confirm`,{hour:e.value,minutes:t.value,type:n?.textContent||void 0});return}let n=this.core.getModalElement();if(n){let e=n.querySelector(`.tp-ui-wheel-hours .tp-ui-wheel-item.is-center`),t=n.querySelector(`.tp-ui-wheel-minutes .tp-ui-wheel-item.is-center`),r=n.querySelector(`.tp-ui-wheel-ampm .tp-ui-wheel-item.is-center`);this.emitter.emit(`confirm`,{hour:e?.getAttribute(`data-value`)??void 0,minutes:t?.getAttribute(`data-value`)??void 0,type:r?.getAttribute(`data-value`)??void 0})}};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handleAmClick(){let e=this.core.getAM();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let t=this.core.getPM();e.classList.add(`active`),t?.classList.remove(`active`),JE(e,!0),JE(t,!1),qE(this.core.getModalElement(),`AM selected`),this.emitter.emit(`select:am`,{});let n=this.core.getHour(),r=this.core.getMinutes();this.emitter.emit(`update`,{hour:n?.value,minutes:r?.value,type:`AM`})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handlePmClick(){let e=this.core.getPM();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let t=this.core.getAM();e.classList.add(`active`),t?.classList.remove(`active`),JE(e,!0),JE(t,!1),qE(this.core.getModalElement(),`PM selected`),this.emitter.emit(`select:pm`,{});let n=this.core.getHour(),r=this.core.getMinutes();this.emitter.emit(`update`,{hour:n?.value,minutes:r?.value,type:`PM`})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handleSwitchViewButton(){let e=this.core.getKeyboardClockIcon();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit(`switch:view`,{})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},XE=(e,t,n)=>Math.max(t,Math.min(n,e)),ZE=(e,t)=>{if(e===``)return``;let n=parseInt(e,10);return Number.isNaN(n)?``:XE(n,+!!t,t?12:23).toString().padStart(2,`0`)},QE=e=>{if(e===``)return``;let t=parseInt(e,10);return Number.isNaN(t)?``:XE(t,0,59).toString().padStart(2,`0`)},$E=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleHourEvents(){let e=this.core.getHour();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;e.classList.add(`active`);let t=this.core.getMinutes();t?.classList.remove(`active`),this.emitter.emit(`select:hour`,{hour:e.value});let n=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:e.value,minutes:t?.value,type:n?.textContent||void 0})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t));let n=e.value,r=()=>{if(this.core.isDestroyed||e.hasAttribute(`readonly`))return;let t=this.core.options.clock.type===`12h`,r=ZE(e.value,t);if(e.value=r,e.setAttribute(`aria-valuenow`,r),e.value!==n){n=e.value,this.emitter.emit(`animation:clock`,{}),this.emitter.emit(`select:hour`,{hour:e.value});let t=this.core.getMinutes(),r=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:e.value,minutes:t?.value,type:r?.textContent||void 0})}};e.addEventListener(`blur`,r),this.cleanupHandlers.push(()=>e.removeEventListener(`blur`,r))}handleMinutesEvents(){let e=this.core.getMinutes();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;e.classList.add(`active`);let t=this.core.getHour();t?.classList.remove(`active`),this.emitter.emit(`select:minute`,{minutes:e.value});let n=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:t?.value,minutes:e.value,type:n?.textContent||void 0})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t));let n=e.value,r=()=>{if(this.core.isDestroyed||e.hasAttribute(`readonly`))return;let t=QE(e.value);if(e.value=t,e.setAttribute(`aria-valuenow`,t),e.value!==n){n=e.value,this.emitter.emit(`animation:clock`,{}),this.emitter.emit(`select:minute`,{minutes:e.value});let t=this.core.getHour(),r=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:t?.value,minutes:e.value,type:r?.textContent||void 0})}};e.addEventListener(`blur`,r),this.cleanupHandlers.push(()=>e.removeEventListener(`blur`,r))}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},eD=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleOpenOnEnterFocus(){let e=this.core.getInput();if(!e)return;let t=e=>{e.key===`Enter`&&!this.core.isDestroyed&&!this.core.isOpen&&this.emitter.emit(`show`,{})};e.addEventListener(`keydown`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`keydown`,t))}handleEscClick(){if(aE()===!1)return;let e=e=>{this.core.isDestroyed||e.key===`Escape`&&this.emitter.emit(`cancel`,{})};document.addEventListener(`keydown`,e),this.cleanupHandlers.push(()=>document.removeEventListener(`keydown`,e))}handleKeyboardInput(){let e=this.core.getHour(),t=this.core.getMinutes();if(e){let t=t=>{if(this.core.isDestroyed||t.key!==`ArrowUp`&&t.key!==`ArrowDown`)return;t.preventDefault();let n=parseInt(e.value)||0,r=parseInt(e.getAttribute(`max`)||`23`),i=this.core.options.clock.type===`12h`,a;a=t.key===`ArrowUp`?i?n>=12?1:n+1:n>=r?0:n+1:i?n<=1?12:n-1:n<=0?r:n-1,e.value=a.toString().padStart(2,`0`),e.setAttribute(`aria-valuenow`,e.value),qE(this.core.getModalElement(),`Hour: ${e.value}`),this.emitter.emit(`animation:clock`,{}),this.emitter.emit(`select:hour`,{hour:e.value});let o=this.core.getMinutes(),s=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:e.value,minutes:o?.value,type:s?.textContent||void 0})};e.addEventListener(`keydown`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`keydown`,t))}if(t){let e=e=>{if(this.core.isDestroyed||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let n=parseInt(t.value)||0,r;r=e.key===`ArrowUp`?n>=59?0:n+1:n<=0?59:n-1,t.value=r.toString().padStart(2,`0`),t.setAttribute(`aria-valuenow`,t.value),qE(this.core.getModalElement(),`Minutes: ${t.value}`),this.emitter.emit(`animation:clock`,{}),this.emitter.emit(`select:minute`,{minutes:t.value});let i=this.core.getHour(),a=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:i?.value,minutes:t.value,type:a?.textContent||void 0})};t.addEventListener(`keydown`,e),this.cleanupHandlers.push(()=>t.removeEventListener(`keydown`,e))}}focusTrapHandler(){if(aE()===!1)return;let e=this.core.getWrapper();if(!e)return;let t=t=>{if(this.core.isDestroyed||t.key!==`Tab`)return;let n=e.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`),r=n[0],i=n[n.length-1];t.shiftKey&&document.activeElement===r?(i?.focus(),t.preventDefault()):!t.shiftKey&&document.activeElement===i&&(r?.focus(),t.preventDefault())};e.addEventListener(`keydown`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`keydown`,t))}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},tD=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleBackdropClick(){let e=this.core.getModalElement();if(!e)return;let t=t=>{this.core.isDestroyed||t.target===e&&this.emitter.emit(`cancel`,{})};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t))}handleMoveHand(){if(aE()===!1)return;let e=e=>{this.core.isDestroyed||e.preventDefault()};document.addEventListener(`mousedown`,e,!1),document.addEventListener(`touchstart`,e,{passive:!1}),this.cleanupHandlers.push(()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)})}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},nD=class{buttonHandlers;inputHandlers;keyboardHandlers;modalHandlers;constructor(e,t){this.buttonHandlers=new YE(e,t),this.inputHandlers=new $E(e,t),this.keyboardHandlers=new eD(e,t),this.modalHandlers=new tD(e,t)}handleOpenOnClick(){this.buttonHandlers.handleOpenOnClick()}handleOpenOnEnterFocus(){this.keyboardHandlers.handleOpenOnEnterFocus()}handleCancelButton(){this.buttonHandlers.handleCancelButton()}handleOkButton(){this.buttonHandlers.handleOkButton()}handleBackdropClick(){this.modalHandlers.handleBackdropClick()}handleEscClick(){this.keyboardHandlers.handleEscClick()}handleAmClick(){this.buttonHandlers.handleAmClick()}handlePmClick(){this.buttonHandlers.handlePmClick()}handleHourEvents(){this.inputHandlers.handleHourEvents()}handleMinutesEvents(){this.inputHandlers.handleMinutesEvents()}handleKeyboardInput(){this.keyboardHandlers.handleKeyboardInput()}focusTrapHandler(){this.keyboardHandlers.focusTrapHandler()}handleMoveHand(){this.modalHandlers.handleMoveHand()}handleSwitchViewButton(){this.buttonHandlers.handleSwitchViewButton()}destroy(){this.buttonHandlers.destroy(),this.inputHandlers.destroy(),this.keyboardHandlers.destroy(),this.modalHandlers.destroy()}},rD=class{emitter;getClockSystem;setHoursToClock;setMinutesToClock;updateAmPm;convertDisabledTime;constructor(e,t,n,r,i,a){this.emitter=e,this.getClockSystem=t,this.setHoursToClock=n,this.setMinutesToClock=r,this.updateAmPm=i,this.convertDisabledTime=a}setup(){this.emitter.on(`select:hour`,({hour:e})=>{this.emitter.emit(`animation:clock`,{}),this.setHoursToClock(e||null)}),this.emitter.on(`select:minute`,({minutes:e})=>{this.emitter.emit(`animation:clock`,{}),this.setMinutesToClock(e||null)}),this.emitter.on(`select:am`,()=>{this.updateAmPm()}),this.emitter.on(`select:pm`,()=>{this.updateAmPm()}),this.emitter.on(`animation:start`,()=>{this.getClockSystem()?.blockInteractions()}),this.emitter.on(`animation:end`,()=>{this.getClockSystem()?.unblockInteractions()}),this.emitter.on(`range:switch`,e=>{this.refreshDisabledTimeForRange(e.disabledTime)})}refreshDisabledTimeForRange(e){let t=this.getClockSystem();if(!t)return;let n=this.convertDisabledTime(),r=n;if(e){let t=[...n?.hours||[],...e.hours||[]],i=[...n?.minutes||[],...e.minutes||[]];r={...n,hours:t.length>0?t:void 0,minutes:i.length>0?i:void 0,rangeFromType:e.fromType,rangeFromHour:e.fromHour}}t.updateDisabledTime(r)}},iD=class{static angleToIndex(e,t,n){let r=Math.round(e/30)%12;if(t===`24h`)if(n){let e=r+12;return e===12?0:e}else return r===0?12:r;return r===0?12:r}static indexToValue(e,t){if(t===`24h`)return e.toString().padStart(2,`0`);let n=e;return n===0&&(n=12),n>12&&(n-=12),n.toString().padStart(2,`0`)}static indexToAngle(e,t){return t===`24h`?e>=12?(e-12)%12*30:e%12*30:(e===0?12:e)%12*30}static isDisabled(e,t,n){return n?n.isInterval&&n.intervals&&n.clockType?this.isDisabledByInterval(e,t,n):n.rangeFromType!==void 0&&n.rangeFromHour!==void 0?this.isDisabledForRange12h(e,t,n):n.hours?n.hours.some(t=>String(t)===e||Number(t)===Number(e)||t===e):!1:!1}static isDisabledForRange12h(e,t,n){let r=n.rangeFromType,i=n.rangeFromHour,a=parseInt(e,10);return r===null||i===void 0?!1:t===`AM`&&r===`PM`?!0:t===`AM`&&r===`AM`?i===12?!1:a===12?!0:a<i:t===`PM`&&r===`AM`?!1:t===`PM`&&r===`PM`?i===12?!1:a===12?!0:a<i:!1}static isDisabledByInterval(e,t,n){if(!n.intervals)return!1;for(let r=0;r<60;r++){let i=r.toString().padStart(2,`0`);if(!this.isTimeInIntervals(e,i,t,n.intervals,n.clockType))return!1}return!0}static isTimeInIntervals(e,t,n,r,i){let a=i===`12h`?`${e}:${t} ${n}`:`${e}:${t}`;for(let e of r){let[t,n]=e.split(`-`).map(e=>e.trim());if(this.isTimeBetween(a,t,n,i))return!0}return!1}static isTimeBetween(e,t,n,r){let i=this.timeToMinutes(e,r),a=this.timeToMinutes(t,r),o=this.timeToMinutes(n,r);return i>=a&&i<=o}static timeToMinutes(e,t){if(t===`12h`){let t=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!t)return 0;let n=parseInt(t[1]),r=parseInt(t[2]),i=t[3].toUpperCase();return i===`PM`&&n!==12&&(n+=12),i===`AM`&&n===12&&(n=0),n*60+r}else{let[t,n]=e.split(`:`).map(Number);return t*60+n}}static findNearestValid(e,t,n,r){let i=t===`24h`?23:12;for(let a=0;a<=i;a++){let o=a===0?[e]:[e+a,e-a];for(let e of o){let a=e;a<0&&(a+=i+1),a>i&&(a%=i+1);let o=this.indexToValue(a,t);if(!this.isDisabled(o,n,r))return a}}return e}},aD=class{static angleToIndex(e){return Math.round(e/6)%60}static indexToValue(e){return e.toString().padStart(2,`0`)}static indexToAngle(e){return e%60*6}static isDisabled(e,t,n,r,i){return r?r.isInterval&&r.intervals?this.isDisabledByInterval(e,t,n,r,i):r.rangeFromType!==void 0&&r.rangeFromHour!==void 0?this.isDisabledForRange12h(e,t,n,r):r.rangeFromHour!==void 0&&parseInt(t,10)!==r.rangeFromHour?!1:r.minutes?r.minutes.some(t=>String(t)===e||Number(t)===Number(e)||t===e):!1:!1}static isDisabledForRange12h(e,t,n,r){let i=r.rangeFromType,a=r.rangeFromHour,o=parseInt(t,10),s=parseInt(e,10);if(i===null||a===void 0)return!1;let c=r.minutes||[],l=c.length>0?parseInt(c[c.length-1],10)+1:0;return n===`AM`&&i===`PM`?!0:n===`PM`&&i===`AM`?!1:o===a||o===12&&a===12||n===i&&o===a?s<l:!1}static isDisabledByInterval(e,t,n,r,i){if(!r.intervals)return!1;let a=i===`12h`?`${t}:${e} ${n}`:`${t}:${e}`;for(let e of r.intervals){let[t,n]=e.split(`-`).map(e=>e.trim());if(this.isTimeBetween(a,t,n,i))return!0}return!1}static isTimeBetween(e,t,n,r){let i=this.timeToMinutes(e,r),a=this.timeToMinutes(t,r),o=this.timeToMinutes(n,r);return i>=a&&i<=o}static timeToMinutes(e,t){if(t===`12h`){let t=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!t)return 0;let n=parseInt(t[1]),r=parseInt(t[2]),i=t[3].toUpperCase();return i===`PM`&&n!==12&&(n+=12),i===`AM`&&n===12&&(n=0),n*60+r}else{let[t,n]=e.split(`:`).map(Number);return t*60+n}}static findNearestValid(e,t,n,r,i){for(let a=0;a<60;a++){let o=a===0?[e]:[e+a,e-a];for(let e of o){let a=e;a<0&&(a+=60),a>=60&&(a%=60);let o=this.indexToValue(a);if(!this.isDisabled(o,t,n,r,i))return a}}return e}},oD=class{static normalizeAngle(e){let t=e%360;return t<0&&(t+=360),t}static calculateRawAngle(e,t){let n=e.x-t.x,r=e.y-t.y,i=Math.atan2(r,n)*180/Math.PI+90;return this.normalizeAngle(i)}static snapToIncrement(e,t){let n=Math.round(e/t)*t;return this.normalizeAngle(n)}static calculateDistance(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}static isInnerCircle(e,t){return e<t*.75}static calculateShortestPath(e,t){let n=this.normalizeAngle(e),r=this.normalizeAngle(t)-n,i=r>=0?r:r+360,a=r<=0?r:r-360;return e+(Math.abs(i)<Math.abs(a)?i:a)}},sD=class{config;currentAngle=0;tipsCache=new Map;cachedDimensions=new Map;constructor(e){this.config=e}getCachedDimensions(e){let t=this.cachedDimensions.get(e);if(!t){let n=(e.offsetWidth-32)/2;t={width:n,height:(e.offsetHeight-32)/2,radius:n-9},this.cachedDimensions.set(e,t)}return t}setHandAngle(e){let t=oD.calculateShortestPath(this.currentAngle,e);Math.abs(this.currentAngle-t)<.01||(this.currentAngle=t,this.config.clockHand.style.transform=`rotateZ(${t}deg)`)}animateToAngle(e){let t=oD.calculateShortestPath(this.currentAngle,e);this.currentAngle=t,this.config.tipsWrapper.classList.add(`tp-ui-tips-animation`),this.config.clockHand.style.transform=`rotateZ(${t}deg)`,setTimeout(()=>{this.config.tipsWrapper.classList.remove(`tp-ui-tips-animation`)},401)}setActiveValue(e){let t=[this.config.tipsWrapper];this.config.tipsWrapperFor24h&&t.push(this.config.tipsWrapperFor24h),t.forEach(t=>{t.querySelectorAll(`.tp-ui-value-tips, .tp-ui-value-tips-24h`).forEach(t=>{let n=t;n.textContent===e||Number(n.textContent)===Number(e)?(n.classList.add(`active`),n.setAttribute(`aria-selected`,`true`)):(n.classList.remove(`active`),n.setAttribute(`aria-selected`,`false`))})})}renderTips(e,t,n,r,i,a=!0,o,s=``,c=`12`){if(aE()===!1)return;let l=o||this.config.tipsWrapper;a&&(l.innerHTML=``,this.tipsCache.clear());let{width:u,height:d,radius:f}=this.getCachedDimensions(l),p=document.createDocumentFragment(),m=`${t}-${this.config.theme||`default`}`;e.forEach((a,o)=>{let l=`${m}-${a}`,h=this.tipsCache.get(l);h||(h=this.createTip(a,t,i),this.tipsCache.set(l,h));let{wrapper:g,tip:_}=h;this.updateTipState(g,_,a,n,r,i,s,c);let v=o*(360/e.length)*(Math.PI/180);g.style.left=`${u+Math.sin(v)*f}px`,g.style.bottom=`${d+Math.cos(v)*f}px`,p.appendChild(g)}),l.appendChild(p)}createTip(e,t,n){if(aE()===!1){let e={};return{wrapper:e,tip:e}}let r=document.createElement(`span`),i=document.createElement(`span`);i.textContent=e,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.tabIndex=0;let a=n===`24h`&&t.includes(`24`)?`tp-ui-value-tips-24h`:`tp-ui-value-tips`;return i.classList.add(a),r.classList.add(t),this.config.theme&&(r.classList.add(this.config.theme),i.classList.add(this.config.theme)),r.appendChild(i),{wrapper:r,tip:i}}updateTipState(e,t,n,r,i,a,o,s){e.classList.remove(`tp-ui-tips-disabled`),t.classList.remove(`tp-ui-tips-disabled`),t.removeAttribute(`aria-disabled`),t.tabIndex=0,this.checkIfDisabled(n,r,i,a,o,s)&&(e.classList.add(`tp-ui-tips-disabled`),t.classList.add(`tp-ui-tips-disabled`),t.setAttribute(`aria-disabled`,`true`),t.tabIndex=-1)}checkIfDisabled(e,t,n,r,i,a){return n?t===`hours`?iD.isDisabled(e,i,n):t===`minutes`?aD.isDisabled(e,a,i,n,r):!1:!1}setCircleSize(e){e?this.config.circle.classList.remove(`small-circle`):this.config.circle.classList.add(`small-circle`)}setCircle24hMode(e){e?(this.config.circle.classList.add(`tp-ui-circle-hand-24h`),this.config.clockHand.classList.add(`tp-ui-clock-hand-24h`)):(this.config.circle.classList.remove(`tp-ui-circle-hand-24h`),this.config.clockHand.classList.remove(`tp-ui-clock-hand-24h`))}destroy(){this.tipsCache.clear(),this.cachedDimensions.clear(),this.config.tipsWrapper.innerHTML=``}},cD=class{static processPointerInput(e){let t=oD.calculateRawAngle(e.pointerPosition,e.clockCenter);return e.mode===`hours`?this.processHours(t,e):this.processMinutes(t,e)}static processHours(e,t){let n=t.smoothHourSnap??!0,r;if(n)r=e;else{let n=t.incrementHours*30;r=oD.snapToIncrement(e,n)}let i=oD.calculateDistance(t.pointerPosition,t.clockCenter),a=t.clockType===`24h`&&oD.isInnerCircle(i,t.clockRadius),o=iD.angleToIndex(r,t.clockType,a),s=iD.indexToValue(o,t.clockType),c=iD.isDisabled(s,t.amPm,t.disabledTime);c&&(o=iD.findNearestValid(o,t.clockType,t.amPm,t.disabledTime));let l=iD.indexToValue(o,t.clockType),u;return u=n?e:iD.indexToAngle(o,t.clockType),{angle:u,value:l,index:o,isValid:!c,isInnerCircle:t.clockType===`24h`?a:void 0}}static processMinutes(e,t){let n=t.incrementMinutes*6,r=oD.snapToIncrement(e,n),i=aD.angleToIndex(r),a=aD.indexToValue(i),o=t.currentHour||`00`,s=aD.isDisabled(a,o,t.amPm,t.disabledTime,t.clockType);s&&(i=aD.findNearestValid(i,o,t.amPm,t.disabledTime,t.clockType));let c=aD.indexToValue(i);return{angle:aD.indexToAngle(i),value:c,index:i,isValid:!s}}static valueToAngle(e,t,n){let r=parseInt(e,10);return t===`hours`?iD.indexToAngle(r,n):aD.indexToAngle(r)}},lD=class{state;renderer;clockType;disabledTime;incrementHours;incrementMinutes;smoothHourSnap;isDragging=!1;callbacks;lastProcessedX=null;lastProcessedY=null;constructor(e,t,n,r,i=1,a=1,o=!0,s={}){this.renderer=e,this.state={...t},this.clockType=n,this.disabledTime=r,this.incrementHours=i,this.incrementMinutes=a,this.smoothHourSnap=o,this.callbacks=s}handlePointerMove(e,t,n){if(this.isDragging=!0,this.lastProcessedX===e.x&&this.lastProcessedY===e.y)return;this.lastProcessedX=e.x,this.lastProcessedY=e.y;let r={pointerPosition:e,clockCenter:t,clockRadius:n,mode:this.state.mode,clockType:this.clockType,amPm:this.state.amPm,disabledTime:this.disabledTime,incrementHours:this.incrementHours,incrementMinutes:this.incrementMinutes,smoothHourSnap:this.smoothHourSnap,currentHour:this.state.hour},i=cD.processPointerInput(r);if(i.isValid){if(this.state.mode===`hours`){let e=this.state.hour;this.state.hour=i.value,this.state.hourAngle=i.angle,this.clockType===`24h`&&i.isInnerCircle!==void 0&&(this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(i.isInnerCircle)),this.callbacks.onHourChange&&e!==i.value&&this.callbacks.onHourChange(i.value)}else{let e=this.state.minute;this.state.minute=i.value,this.state.minuteAngle=i.angle,this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1),this.callbacks.onMinuteChange&&e!==i.value&&this.callbacks.onMinuteChange(i.value)}this.renderer.setHandAngle(i.angle),this.renderer.setActiveValue(i.value)}}handlePointerUp(){this.isDragging=!1,this.lastProcessedX=null,this.lastProcessedY=null}snapToNearestHour(){if(this.state.mode!==`hours`)return;let e=cD.valueToAngle(this.state.hour,`hours`,this.clockType);this.state.hourAngle=e,this.renderer.animateToAngle(e)}switchMode(e){this.state.mode=e;let t=e===`hours`?this.state.hourAngle:this.state.minuteAngle,n=e===`hours`?this.state.hour:this.state.minute;if(e===`hours`&&this.clockType===`24h`){let e=parseInt(n,10),t=e===0||e>=13;this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(t)}else this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1);this.renderer.setHandAngle(t),this.renderer.setActiveValue(n)}setValue(e,t){let n=cD.valueToAngle(t,e,this.clockType);if(e===`hours`)if(this.state.hour=t,this.state.hourAngle=n,this.clockType===`24h`){let e=parseInt(t,10),n=e===0||e>=13;this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(n)}else this.renderer.setCircle24hMode(!1);else this.state.minute=t,this.state.minuteAngle=n,this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1);this.state.mode===e&&(this.renderer.setHandAngle(n),this.renderer.setActiveValue(t))}setAmPm(e){this.state.amPm=e}getState(){return{...this.state}}getHour(){return this.state.hour}getMinute(){return this.state.minute}getAmPm(){return this.state.amPm}updateDisabledTime(e){this.disabledTime=e}destroy(){this.renderer.destroy()}},uD=class{controller;clockFace;isActive=!1;isBlocked=!1;config;cachedRect=null;cachedCenter=null;cachedRadius=null;rafId=null;constructor(e,t,n={}){this.controller=e,this.clockFace=t,this.config=n}attach(){this.clockFace.addEventListener(`mousedown`,this.handlePointerDown),this.clockFace.addEventListener(`touchstart`,this.handlePointerDown,{passive:!1})}detach(){this.clockFace.removeEventListener(`mousedown`,this.handlePointerDown),this.clockFace.removeEventListener(`touchstart`,this.handlePointerDown),this.removeGlobalListeners()}block(){this.isBlocked=!0}unblock(){this.isBlocked=!1}handlePointerDown=e=>{if(iE()||this.isBlocked)return;let t=e.target;t&&t.classList&&t.classList.contains(`tp-ui-tips-disabled`)||(e.preventDefault(),this.isActive=!0,this.cachedRect=this.clockFace.getBoundingClientRect(),this.cachedCenter=this.getClockCenter(),this.cachedRadius=this.getClockRadius(),this.processPointerEvent(e),document.addEventListener(`mousemove`,this.handlePointerMove),document.addEventListener(`touchmove`,this.handlePointerMove,{passive:!1}),document.addEventListener(`mouseup`,this.handlePointerUp),document.addEventListener(`touchend`,this.handlePointerUp))};handlePointerMove=e=>{if(!this.isActive||this.isBlocked)return;let t=this.getTargetElement(e);t&&t.classList&&t.classList.contains(`tp-ui-tips-disabled`)||(e.preventDefault(),this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null,this.processPointerEvent(e)})))};handlePointerUp=()=>{if(!this.isActive)return;this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.isActive=!1,this.cachedRect=null,this.cachedCenter=null,this.cachedRadius=null,this.controller.handlePointerUp();let{autoSwitchToMinutes:e,isMobileView:t,smoothHourSnap:n,hourElement:r,minutesElement:i}=this.config;n&&r?.classList.contains(`active`)&&this.controller.snapToNearestHour(),this.removeGlobalListeners(),e&&r?.classList.contains(`active`)&&!t?(r.classList.remove(`active`),i?.classList.add(`active`),i?.click(),i?.focus(),r.blur()):i?.classList.contains(`active`)&&this.config.onMinuteCommit&&this.config.onMinuteCommit()};processPointerEvent(e){let t=this.getPointerPosition(e),n=this.cachedCenter||this.getClockCenter(),r=this.cachedRadius||this.getClockRadius();this.controller.handlePointerMove(t,n,r)}getPointerPosition(e){let t=this.cachedRect||this.clockFace.getBoundingClientRect();if(`touches`in e){let n=e.touches[0]||e.changedTouches[0];return{x:n.clientX-t.left,y:n.clientY-t.top}}else return{x:e.clientX-t.left,y:e.clientY-t.top}}getTargetElement(e){if(`touches`in e){let t=e.touches[0]||e.changedTouches[0];if(t&&!iE())return document.elementFromPoint(t.clientX,t.clientY)}return e.target}getClockCenter(){let e=this.clockFace.offsetWidth,t=this.clockFace.offsetHeight;return{x:e/2,y:t/2}}getClockRadius(){return this.clockFace.offsetWidth/2}removeGlobalListeners(){aE()!==!1&&(document.removeEventListener(`mousemove`,this.handlePointerMove),document.removeEventListener(`touchmove`,this.handlePointerMove),document.removeEventListener(`mouseup`,this.handlePointerUp),document.removeEventListener(`touchend`,this.handlePointerUp))}},dD=class{renderer;controller;dragHandlers;clockType;disabledTime;tipsWrapper;tipsWrapperFor24h;constructor(e){this.clockType=e.clockType,this.disabledTime=e.disabledTime,this.tipsWrapper=e.tipsWrapper,this.tipsWrapperFor24h=e.tipsWrapperFor24h;let t={clockFace:e.clockFace,tipsWrapper:e.tipsWrapper,tipsWrapperFor24h:e.tipsWrapperFor24h,clockHand:e.clockHand,circle:e.circle,theme:e.theme};this.renderer=new sD(t);let n={hour:e.initialHour,minute:e.initialMinute,amPm:e.initialAmPm,hourAngle:this.calculateInitialAngle(`hours`,e.initialHour),minuteAngle:this.calculateInitialAngle(`minutes`,e.initialMinute),mode:`hours`},r={onHourChange:e.onHourChange,onMinuteChange:e.onMinuteChange};this.controller=new lD(this.renderer,n,e.clockType,e.disabledTime,e.incrementHours||1,e.incrementMinutes||1,e.smoothHourSnap??!0,r),this.dragHandlers=new uD(this.controller,e.clockFace,e.dragConfig||{})}initialize(){this.dragHandlers.attach(),this.switchToHours()}switchToHours(){this.controller.switchMode(`hours`),this.clockType===`24h`&&this.tipsWrapperFor24h&&this.tipsWrapperFor24h.classList.remove(`none`),this.renderHourTips();let e=this.controller.getState();this.renderer.setActiveValue(e.hour)}switchToMinutes(){this.controller.switchMode(`minutes`),this.tipsWrapperFor24h&&this.tipsWrapperFor24h.classList.add(`none`),this.renderMinuteTips();let e=this.controller.getState();this.renderer.setActiveValue(e.minute)}setHour(e){this.controller.setValue(`hours`,e)}setMinute(e){this.controller.setValue(`minutes`,e)}setAmPm(e){this.controller.setAmPm(e);let t=this.controller.getState();t.mode===`hours`?(this.renderHourTips(),this.renderer.setHandAngle(t.hourAngle),this.renderer.setActiveValue(t.hour)):(this.renderMinuteTips(),this.renderer.setHandAngle(t.minuteAngle),this.renderer.setActiveValue(t.minute))}getHour(){return this.controller.getHour()}getMinute(){return this.controller.getMinute()}getAmPm(){return this.controller.getAmPm()}updateDisabledTime(e){this.disabledTime=e,this.controller.updateDisabledTime(e),this.controller.getState().mode===`hours`?this.renderHourTips():this.renderMinuteTips()}renderHourTips(){let e=this.controller.getState().amPm;this.clockType===`24h`?(this.renderer.renderTips(SE,`tp-ui-hour-time-12`,`hours`,this.disabledTime,this.clockType,!0,this.tipsWrapper,e),this.tipsWrapperFor24h&&this.renderer.renderTips(xE,`tp-ui-hour-time-24`,`hours`,this.disabledTime,this.clockType,!0,this.tipsWrapperFor24h,e)):this.renderer.renderTips(SE,`tp-ui-hour-time-12`,`hours`,this.disabledTime,this.clockType,!0,void 0,e)}renderMinuteTips(){let e=this.controller.getState(),t=e.amPm,n=e.hour;this.renderer.renderTips(CE,`tp-ui-minutes-time`,`minutes`,this.disabledTime,this.clockType,!0,void 0,t,n)}calculateInitialAngle(e,t){let n=parseInt(t,10);return e===`hours`?n%12*30:n*6}destroy(){this.dragHandlers.detach(),this.controller.destroy()}blockInteractions(){this.dragHandlers.block()}unblockInteractions(){this.dragHandlers.unblock()}},fD=class{core;emitter;clockSystem=null;constructor(e,t){this.core=e,this.emitter=t}getClockSystem(){return this.clockSystem}initialize(){let e=this.core.getClockFace(),t=this.core.getClockHand(),n=this.core.getCircle();if(!e||!t||!n)return;let r=this.core.options.clock.type===`24h`,i=this.core.getTipsWrapper();if(!i)return;let a=this.core.getHour(),o=this.core.getMinutes(),s={clockFace:e,tipsWrapper:i,tipsWrapperFor24h:r&&this.core.getTipsWrapperFor24h()||void 0,clockHand:t,circle:n,clockType:this.core.options.clock.type||`12h`,disabledTime:this.convertDisabledTime(),initialHour:a?.value||`12`,initialMinute:o?.value||`00`,initialAmPm:this.getAmPmValue(),theme:this.core.options.ui.theme,incrementHours:this.core.options.clock.incrementHours||1,incrementMinutes:this.core.options.clock.incrementMinutes||1,smoothHourSnap:this.core.options.clock.smoothHourSnap??!0,timepicker:null,dragConfig:{autoSwitchToMinutes:this.core.options.clock.autoSwitchToMinutes,isMobileView:this.core.isMobileView,smoothHourSnap:this.core.options.clock.smoothHourSnap??!0,hourElement:a,minutesElement:o,onMinuteCommit:()=>{let e=this.core.getMinutes(),t=this.core.getHour(),n=this.core.getActiveTypeMode();this.emitter.emit(`range:minute:commit`,{hour:t?.value??`12`,minutes:e?.value??`00`,type:n?.textContent??void 0})}},onHourChange:e=>{let t=this.core.getHour();t&&(t.value=e,t.setAttribute(`aria-valuenow`,e)),qE(this.core.getModalElement(),`Hour: ${e}`);let n=this.core.getMinutes(),r=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:e,minutes:n?.value,type:r?.textContent||void 0})},onMinuteChange:e=>{let t=this.core.getMinutes();t&&(t.value=e,t.setAttribute(`aria-valuenow`,e)),qE(this.core.getModalElement(),`Minutes: ${e}`);let n=this.core.getHour(),r=this.core.getActiveTypeMode();this.emitter.emit(`update`,{hour:n?.value,minutes:e,type:r?.textContent||void 0})}};this.clockSystem=new dD(s),this.clockSystem.initialize()}convertDisabledTime(){let e=this.core.disabledTime?.value;if(!e)return null;let t;return e.intervals&&(t=Array.isArray(e.intervals)?e.intervals:[e.intervals]),{hours:e.hours,minutes:e.minutes,isInterval:e.isInterval,intervals:t,clockType:e.clockType}}getAmPmValue(){if(this.core.options.clock.type===`24h`)return``;let e=this.core.getActiveTypeMode();if(e){let t=e.textContent?.trim();if(t===`AM`||t===`PM`)return t}let t=this.core.getAM();return this.core.options.range?.enabled===!0?t?.classList.contains(`active`)?`AM`:``:t?.classList.contains(`active`)?`AM`:`PM`}destroy(){this.clockSystem&&=(this.clockSystem.destroy(),null)}},pD=class{core;constructor(e){this.core=e}removeCircleClockClasses24h(){let e=this.core.getCircle(),t=this.core.getClockHand();e?.classList.remove(`tp-ui-circle-hand-24h`),t?.classList.remove(`tp-ui-clock-hand-24h`)}setCircleClockClasses24h(){let e=this.core.getCircle(),t=this.core.getClockHand();e&&e.classList.add(`tp-ui-circle-hand-24h`),t&&t.classList.add(`tp-ui-clock-hand-24h`)}setOnStartCSSClassesIfClockType24h(){if(this.core.options.clock.type===`24h`){let e=this.core.getInput();if(!e)return;let t;e.value.length>0&&(t=e.value.split(`:`)[0]),t&&(Number(t)>12||Number(t)===0)&&this.setCircleClockClasses24h()}}setBgColorToCircleWithMinutesTips(){let e=this.core.getMinutes(),t=this.core.getCircle();if(!(!e||!t)&&e.value&&CE.includes(e.value)){let e=getComputedStyle(t).getPropertyValue(`--timepicker-primary`).trim();e&&(t.style.backgroundColor=e),t.classList.remove(`small-circle`)}}removeBgColorToCirleWithMinutesTips(){let e=this.core.getMinutes(),t=this.core.getCircle();!e||!t||e.value&&CE.includes(e.value)||(t.style.backgroundColor=``,t.classList.add(`small-circle`))}setClassActiveToHourOnOpen(){this.core.options.ui.mobile||this.core.isMobileView||this.core.getHour()?.classList.add(IE)}toggleClassActiveToValueTips(e,t){if(e)return;let n=this.core.getAllValueTips();if(!n)return;let r=n.find(e=>Number(e.innerText)===Number(t));n.forEach(e=>{e.classList.remove(IE),e.setAttribute(`aria-selected`,`false`)}),r!==void 0&&(r.classList.add(IE),r.setAttribute(`aria-selected`,`true`))}},mD=class{getClockSystem;styleHandler;getAmPmValue;clockType;constructor(e,t,n,r){this.getClockSystem=e,this.styleHandler=t,this.getAmPmValue=n,this.clockType=r}setMinutesToClock(e){let t=this.getClockSystem();t&&(this.styleHandler.removeBgColorToCirleWithMinutesTips(),e&&t.setMinute(e),t.switchToMinutes())}setHoursToClock(e){let t=this.getClockSystem();t&&(e&&t.setHour(e),t.switchToHours())}setTransformToCircleWithSwitchesHour(e){let t=this.getClockSystem();!t||!e||t.setHour(e)}setTransformToCircleWithSwitchesMinutes(e){let t=this.getClockSystem();!t||!e||t.setMinute(e)}updateAmPm(){let e=this.getClockSystem();if(!e||this.clockType===`24h`)return;let t=this.getAmPmValue();t!==``&&e.setAmPm(t)}},hD=class{systemInitializer;styleHandler;timeHandler;eventHandler;constructor(e,t){this.systemInitializer=new fD(e,t),this.styleHandler=new pD(e);let n=e.options.clock.type||`12h`;this.timeHandler=new mD(()=>this.systemInitializer.getClockSystem(),this.styleHandler,()=>this.systemInitializer.getAmPmValue(),n),this.eventHandler=new rD(t,()=>this.systemInitializer.getClockSystem(),e=>this.timeHandler.setHoursToClock(e),e=>this.timeHandler.setMinutesToClock(e),()=>this.timeHandler.updateAmPm(),()=>this.systemInitializer.convertDisabledTime()),this.eventHandler.setup()}initializeClockSystem(){this.systemInitializer.initialize()}destroyClockSystem(){this.systemInitializer.destroy()}removeCircleClockClasses24h(){this.styleHandler.removeCircleClockClasses24h()}setCircleClockClasses24h(){this.styleHandler.setCircleClockClasses24h()}setOnStartCSSClassesIfClockType24h(){this.styleHandler.setOnStartCSSClassesIfClockType24h()}setBgColorToCircleWithMinutesTips=()=>{this.styleHandler.setBgColorToCircleWithMinutesTips()};removeBgColorToCirleWithMinutesTips=()=>{this.styleHandler.removeBgColorToCirleWithMinutesTips()};setClassActiveToHourOnOpen=()=>{this.styleHandler.setClassActiveToHourOnOpen()};setMinutesToClock=e=>{this.timeHandler.setMinutesToClock(e)};setHoursToClock=e=>{this.timeHandler.setHoursToClock(e)};setTransformToCircleWithSwitchesHour=e=>{this.timeHandler.setTransformToCircleWithSwitchesHour(e)};setTransformToCircleWithSwitchesMinutes=e=>{this.timeHandler.setTransformToCircleWithSwitchesMinutes(e)};updateAmPm=()=>{this.timeHandler.updateAmPm()};toggleClassActiveToValueTips=e=>{let t=this.systemInitializer.getClockSystem()!==null;this.styleHandler.toggleClassActiveToValueTips(t,e)};destroy(){this.destroyClockSystem()}},gD=class{core;emitter;cleanupHandlers=[];wasCleared=!1;constructor(e,t){this.core=e,this.emitter=t}init(){if(!this.core.options.ui.clearButton)return;let e=this.getClearButton();if(!e)return;let t=()=>{this.core.isDestroyed||e.getAttribute(`aria-disabled`)!==`true`&&this.handleClearClick()};e.addEventListener(`click`,t),this.cleanupHandlers.push(()=>e.removeEventListener(`click`,t)),this.setupInternalEventListeners()}setupInternalEventListeners(){this.emitter.on(`update`,()=>{this.updateClearButtonState()}),this.emitter.on(`open`,()=>{this.updateClearButtonState()}),this.emitter.on(`select:hour`,()=>{this.updateClearButtonState(),this.reenableConfirmIfCleared()}),this.emitter.on(`select:minute`,()=>{this.updateClearButtonState(),this.reenableConfirmIfCleared()})}handleClearClick(){let e=this.core.getInput()?.value||null;this.clearTimeValue(),this.resetClockToNeutral(),this.disableConfirmButton(),this.wasCleared=!0,qE(this.core.getModalElement(),`Time cleared`),this.emitter.emit(`clear`,{previousValue:e}),this.emitter.emit(`update`,{hour:void 0,minutes:void 0,type:void 0});let{callbacks:t}=this.core.options;t.onClear&&t.onClear({previousValue:e})}clearTimeValue(){let e=this.core.options.clearBehavior?.clearInput!==!1,t=this.core.getInput();t&&e&&(t.value=``),this.core.setDegreesHours(null),this.core.setDegreesMinutes(null);let n=bE.getClearHandler(`range`);n&&n(this.core,this.emitter);let r=bE.getClearHandler(`timezone`);r&&r(this.core,this.emitter)}resetClockToNeutral(){let e=this.core.options.clock.type,t=e===`12h`?`PM`:void 0,n=this.core.getHour(),r=this.core.getMinutes();n&&(n.value=`12`,n.removeAttribute(`aria-valuenow`)),r&&(r.value=`00`,r.removeAttribute(`aria-valuenow`));let i=this.core.getClockHand();if(i){let e=i.style.transition;i.style.transition=`none`,i.style.transform=`rotateZ(0deg)`,i.offsetHeight,requestAnimationFrame(()=>{i.style.transition=e})}if(this.removeActiveStates(),n&&n.click(),e===`12h`&&t){let e=this.core.getAM(),t=this.core.getPM();e?.classList.remove(`active`),t?.classList.remove(`active`),e?.setAttribute(`aria-pressed`,`false`),t?.setAttribute(`aria-pressed`,`false`),t?.classList.add(`active`),t?.setAttribute(`aria-pressed`,`true`)}this.emitter.emit(`animation:clock`,{})}removeActiveStates(){this.core.getAllValueTips().forEach(e=>{e.classList.remove(`active`),e.removeAttribute(`aria-selected`)});let e=this.core.getHour(),t=this.core.getMinutes();e?.removeAttribute(`aria-valuenow`),t?.removeAttribute(`aria-valuenow`)}disableConfirmButton(){let e=this.core.getOkButton();e&&(e.classList.add(`disabled`),e.setAttribute(`aria-disabled`,`true`))}updateClearButtonState(){let e=this.getClearButton();if(!e)return;let t=this.core.getInput(),n=t?.value&&t.value.trim()!==``,r=this.core.getHour(),i=this.core.getMinutes(),a=this.core.getActiveTypeMode(),o=this.core.options.clock.type,s=r?.value||``,c=i?.value||``,l=a?.textContent||``,u=n||!(o===`12h`?s===`12`&&c===`00`&&l===`PM`:s===`12`&&c===`00`);e.classList.toggle(`disabled`,!u),e.setAttribute(`aria-disabled`,String(!u))}reenableConfirmIfCleared(){if(!this.wasCleared)return;let e=this.core.getOkButton();e&&(e.classList.remove(`disabled`),e.setAttribute(`aria-disabled`,`false`),this.wasCleared=!1)}getClearButton(){return this.core.getModalElement()?.querySelector(`.tp-ui-clear-btn`)||null}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}},_D=class{animation;modal;config;theme;validation;events;clock;clearButton;plugins=new Map;constructor(e,t){this.animation=new cE(e,t),this.modal=new jE(e,t),this.config=new HE(e,t),this.theme=new UE(e,t),this.validation=new KE(e,t),this.events=new nD(e,t),this.clock=new hD(e,t),this.clearButton=new gD(e,t),bE.getAll().forEach(n=>{let r=n.factory(e,t);this.plugins.set(n.name,r)})}getPlugin(e){return this.plugins.get(e)}destroy(){this.animation.destroy(),this.modal.destroy(),this.config.destroy(),this.theme.destroy(),this.validation.destroy(),this.events.destroy(),this.clock.destroy(),this.clearButton.destroy(),this.plugins.forEach(e=>e.destroy()),this.plugins.clear()}},vD=`is-rippling`,yD=`ripple-hold`,bD=null,xD=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}},SD=[`basic`,`crane-straight`,`crane`,`m2`,`m3-green`],CD=class{core;managers;emitter;eventsClickMobileHandler=()=>{};mutliEventsMoveHandler=()=>{};unmountTimeouts=[];constructor(e,t,n){this.core=e,this.managers=t,this.emitter=n}init(){if(!this.core.isDestroyed&&!this.core.isInitialized){try{this.managers.config.updateInputValueWithCurrentTimeOnStart(),this.managers.validation.checkDisabledValuesOnStart()}catch{this.core.setIsDestroyed(!0);return}this.managers.theme.setTimepickerClassToElement(),this.managers.theme.setInputClassToInputElement(),this.managers.theme.setDataOpenToInputIfDoesntExistInWrapper(),this.managers.theme.setClassTopOpenElement(),this.managers.config.getDisableTime(),this.core.options.ui.inline?.enabled||this.managers.events.handleOpenOnClick(),this.managers.events.handleOpenOnEnterFocus(),this.setupCallbackBridge(),this.core.setIsInitialized(!0)}}setupCallbackBridge(){let{callbacks:e}=this.core.options;e.onOpen&&this.emitter.on(`open`,e.onOpen),e.onCancel&&this.emitter.on(`cancel`,e.onCancel),e.onConfirm&&this.emitter.on(`confirm`,e.onConfirm),e.onUpdate&&this.emitter.on(`update`,e.onUpdate),e.onSelectHour&&this.emitter.on(`select:hour`,e.onSelectHour),e.onSelectMinute&&this.emitter.on(`select:minute`,e.onSelectMinute),e.onSelectAM&&this.emitter.on(`select:am`,e.onSelectAM),e.onSelectPM&&this.emitter.on(`select:pm`,e.onSelectPM),e.onError&&this.emitter.on(`error`,e.onError),e.onTimezoneChange&&this.emitter.on(`timezone:change`,e.onTimezoneChange),e.onRangeConfirm&&this.emitter.on(`range:confirm`,e.onRangeConfirm),e.onRangeSwitch&&this.emitter.on(`range:switch`,e.onRangeSwitch),e.onRangeValidation&&this.emitter.on(`range:validation`,e.onRangeValidation),e.onClear&&this.emitter.on(`clear`,e.onClear)}mount(){this.core.isDestroyed||this.core.isOpen||(this.core.isInitialized||this.init(),this.eventsBundle())}unmount(e){let t=xD((...e)=>{if(e.length>2)return;let[t]=e.filter(e=>typeof e==`boolean`),[n]=e.filter(e=>typeof e==`function`);this.core.setIsMobileView(!!this.core.options.ui.mobile);let r=this.core.getModalElement();if(t&&r&&this.core.getOkButton()?.click(),this.core.setIsTouchMouseMove(!1),this.core.setIsOpen(!1),this.removeEventListeners(),this.isPopoverMode()){let e=this.managers.getPlugin(`wheel`);e&&`detachPopover`in e&&e.detachPopover()}r&&this.managers.animation.removeAnimationToClose(),this.core.getOpenElement().forEach(e=>e?.classList.remove(`disabled`));let i=setTimeout(()=>{aE()&&(document.body.style.overflowY=``,document.body.style.paddingRight=``)},sE.SCROLLBAR_RESTORE);this.unmountTimeouts.push(i);let a=setTimeout(()=>{let e=this.core.getInput();this.core.options.behavior.focusInputAfterClose&&e?.focus();let t=this.core.getModalElement();t&&t.remove(),this.core.setIsModalRemove(!0)},sE.MODAL_REMOVE);this.unmountTimeouts.push(a),n&&n()},this.core.options.behavior.delayHandler||sE.DEFAULT_DELAY);e?t(e):t()}destroy(e){if(this.core.isDestroyed)return;this.clearUnmountTimeouts();let{keepInputValue:t=!1,callback:n}=typeof e==`function`?{callback:e}:e||{},r=this.core.getInput(),i=t?r?.value:null;this.removeEventListeners(),this.core.getModalElement()?.remove(),this.core.getOpenElement()?.forEach(e=>{e&&(e.classList.remove(`disabled`,`active`,`tp-ui-open-element`),e.classList.remove(...SD))}),r&&(r.classList.remove(`tp-ui-invalid-format`,`invalid-value`,`error`,`active`,`tp-ui-input`),r.removeAttribute(`data-open`),r.removeAttribute(`data-owner-id`),t&&i&&(r.value=i));let a=this.core.element;a&&(a.classList.remove(...SD),a.classList.remove(`error`,`active`,`disabled`),a.removeAttribute(`data-owner-id`),a.removeAttribute(`data-open`),this.core.options.ui.cssClass&&a.classList.remove(this.core.options.ui.cssClass)),a?.querySelectorAll(`.tp-ui-invalid-text`)?.forEach(e=>e.remove()),this.mutliEventsMoveHandler=()=>{},this.eventsClickMobileHandler=()=>{},this.core.reset(),this.managers.destroy(),this.emitter.clear(),iE()||(document.body.style.overflowY=``,document.body.style.paddingRight=``),n&&n()}eventsBundle(){if(this.core.isDestroyed||!this.core.isModalRemove)return;this.clearUnmountTimeouts(),this.core.setIsOpen(!0),this.core.setIsModalRemove(!1),this.setupValidation(),this.disableOpenElements(),this.setupModal(),this.applyExpandedState(),this.managers.modal.setFlexEndToFooterIfNoKeyboardIcon(),this.applyThemeDeferred(),this.managers.animation.setAnimationToOpen(),this.managers.config.getInputValueOnOpenAndSet();let e=this.resolveWheelMode();if(this.emitMissingPluginErrors(),this.initClockOrWheel(e),this.initOptionalPlugins(e),this.bindEventHandlers(e),this.finalizeModal(e),this.isPopoverMode()){let e=this.managers.getPlugin(`wheel`);e&&`attachPopover`in e&&e.attachPopover()}this.managers.modal.setShowClassToBackdrop()}setupValidation(){this.managers.validation.setErrorHandler(),this.managers.validation.removeErrorHandler()}disableOpenElements(){this.core.options.ui.inline?.enabled||(this.core.getOpenElement().forEach(e=>e?.classList.add(`disabled`)),this.isPopoverMode()||this.core.getInput()?.blur())}setupModal(){this.managers.modal.setScrollbarOrNot(),this.managers.modal.setModalTemplate(),this.managers.modal.setNormalizeClass(),this.managers.modal.removeBackdrop()}applyExpandedState(){if(this.core.isMobileView)this.managers.config.updateClockFaceAccessibility(!0);else{let e=this.core.getModalElement(),t=e?.querySelector(`.tp-ui-mobile-clock-wrapper`),n=e?.querySelector(`.tp-ui-wrapper`),r=e?.querySelectorAll(`*`);t?.classList.add(`expanded`),n?.classList.add(`expanded`),r?.forEach(e=>{!e.classList.contains(`tp-ui-select-time`)&&!e.classList.contains(`tp-ui-mobile-clock-wrapper`)&&!e.classList.contains(`tp-ui-wrapper`)&&e.classList.add(`expanded`)})}}applyThemeDeferred(){setTimeout(()=>{this.managers.theme.setTheme();let e=this.core.getWrapper();e&&this.core.options.ui.cssClass&&e.classList.add(this.core.options.ui.cssClass)},0)}isCompactWheelMode(){return this.core.options.ui.mode===`compact-wheel`}isPopoverMode(){return this.isCompactWheelMode()&&!!this.core.options.wheel?.placement}resolveWheelMode(){let e=this.core.options.ui.mode;return(e===`wheel`||e===`compact-wheel`)&&bE.has(`wheel`)}emitMissingPluginErrors(){let e=this.core.options.ui.mode;(e===`wheel`||e===`compact-wheel`)&&!bE.has(`wheel`)&&this.emitter.emit(`error`,{error:`WheelPlugin is not registered. Import and register it: PluginRegistry.register(WheelPlugin)`}),this.core.options.range?.enabled&&!bE.has(`range`)&&this.emitter.emit(`error`,{error:`RangePlugin is not registered. Import and register it: PluginRegistry.register(RangePlugin)`}),this.core.options.timezone?.enabled&&!bE.has(`timezone`)&&this.emitter.emit(`error`,{error:`TimezonePlugin is not registered. Import and register it: PluginRegistry.register(TimezonePlugin)`})}initClockOrWheel(e){if(e){let e=this.managers.getPlugin(`wheel`);e&&e.init()}else this.managers.clock.initializeClockSystem(),this.managers.clock.setOnStartCSSClassesIfClockType24h(),this.managers.clock.setClassActiveToHourOnOpen()}initOptionalPlugins(e){let t=this.managers.getPlugin(`timezone`);t&&t.init();let n=this.managers.getPlugin(`range`);n&&!e&&n.init()}bindEventHandlers(e){this.managers.events.handleCancelButton(),this.managers.events.handleOkButton(),this.managers.clearButton.init(),e||(this.managers.events.handleHourEvents(),this.managers.events.handleMinutesEvents()),this.managers.events.handleKeyboardInput(),this.core.options.ui.enableSwitchIcon&&!e&&this.managers.events.handleSwitchViewButton(),this.core.options.clock.type!==`24h`&&!this.isCompactWheelMode()&&(this.managers.events.handleAmClick(),this.managers.events.handlePmClick()),this.core.options.behavior.focusTrap&&this.managers.events.focusTrapHandler(),this.core.options.ui.inline?.enabled||(this.managers.events.handleEscClick(),this.isPopoverMode()||(this.core.options.ui.mode===`wheel`||this.core.options.ui.mode===`compact-wheel`)&&this.core.options.wheel?.ignoreOutsideClick||this.managers.events.handleBackdropClick())}finalizeModal(e){let t=this.core.getModalElement();if(t&&nE(t),!e){let e=this.core.getClockFace();e&&typeof requestAnimationFrame<`u`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e?.classList.add(`scale-in`)})})}}clearUnmountTimeouts(){this.unmountTimeouts.forEach(clearTimeout),this.unmountTimeouts=[]}removeEventListeners(){aE()!==!1&&(FE.split(` `).forEach(e=>{document.removeEventListener(e,this.mutliEventsMoveHandler,!1)}),document.removeEventListener(`mousedown`,this.eventsClickMobileHandler))}},wD=class{events=new Map;on(e,t){this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(t)}once(e,t){let n=r=>{t(r),this.off(e,n)};this.on(e,n)}off(e,t){t?this.events.get(e)?.delete(t):this.events.delete(e)}emit(e,t){this.events.get(e)?.forEach(e=>{e(t)})}clear(){this.events.clear()}hasListeners(e){return(this.events.get(e)?.size??0)>0}},TD={clock:{type:`12h`,incrementHours:1,incrementMinutes:1,autoSwitchToMinutes:!0,disabledTime:void 0,currentTime:void 0},ui:{mode:`clock`,theme:`basic`,animation:!0,backdrop:!0,mobile:!1,enableSwitchIcon:!1,editable:!1,enableScrollbar:!1,cssClass:void 0,appendModalSelector:``,iconTemplate:``,iconTemplateMobile:``,inline:void 0,clearButton:!1},labels:{am:`AM`,pm:`PM`,ok:`OK`,cancel:`Cancel`,time:`Select time`,mobileTime:`Enter Time`,mobileHour:`Hour`,mobileMinute:`Minute`,clear:`Clear`},behavior:{focusInputAfterClose:!1,focusTrap:!0,delayHandler:300,id:void 0},callbacks:{onOpen:void 0,onCancel:void 0,onConfirm:void 0,onUpdate:void 0,onSelectHour:void 0,onSelectMinute:void 0,onSelectAM:void 0,onSelectPM:void 0,onError:void 0,onTimezoneChange:void 0,onRangeConfirm:void 0,onRangeSwitch:void 0,onRangeValidation:void 0,onClear:void 0},timezone:{enabled:!1,default:void 0,whitelist:void 0,label:`Timezone`},range:{enabled:!1,minDuration:void 0,maxDuration:void 0,fromLabel:`From`,toLabel:`To`},wheel:{placement:void 0,hideFooter:void 0,commitOnScroll:void 0,hideDisabled:void 0,ignoreOutsideClick:void 0},clearBehavior:{clearInput:!0}},ED=e=>e.replace(/[^0-9:APMapm\s]/g,``),DD=new Map,OD=class{core;managers;lifecycle;emitter;constructor(e,t){if(iE())throw Error(`TimepickerUI requires browser environment`);let n=this.resolveInputElement(e);if(!n)throw Error(`Input element not found`);let r=t?.behavior?.id,i=r||`tp-ui-${gE()}`,a=this.createWrapperElement(n),o=rE(t||{});if(o.ui.inline?.enabled&&typeof t?.behavior?.focusTrap>`u`&&(o.behavior.focusTrap=!1),o.ui.inline?.enabled){if(!o.ui.inline.containerId)throw Error(`inline.containerId is required when inline mode is enabled`);if(!iE()&&!document.getElementById(o.ui.inline.containerId))throw Error(`Container element with id "${o.ui.inline.containerId}" not found`)}this.emitter=new wD,this.core=new oE(a,o,i,r);let s=this.core.getInput();if(s){let e=ME(s,o.clock.type),t=Number(e.hour)*30,n=Number(e.minutes)*6;this.core.setDegreesHours(t),this.core.setDegreesMinutes(n)}this.managers=new _D(this.core,this.emitter),this.lifecycle=new CD(this.core,this.managers,this.emitter),this.managers.config.checkMobileOption(),this.managers.config.preventClockTypeByCurrentTime(),this.setupInternalEventListeners(),DD.set(this.core.instanceId,this)}setupInternalEventListeners(){this.emitter.on(`show`,()=>{this.core.isDestroyed||this.lifecycle.mount()}),this.emitter.on(`cancel`,()=>{this.core.isDestroyed||this.lifecycle.unmount()}),this.emitter.on(`confirm`,e=>{if(!this.core.isDestroyed){if(this.core.options.range?.enabled)return;let t=this.core.getInput();if(t&&e.hour&&e.minutes){let n=e.type?` ${e.type}`:``;t.value=`${e.hour}:${e.minutes}${n}`}e.autoCommit||this.lifecycle.unmount()}}),this.emitter.on(`range:confirm`,e=>{if(this.core.isDestroyed)return;let t=this.core.getInput();t&&(t.value=`${e.from} - ${e.to}`),this.lifecycle.unmount()})}create(){this.lifecycle.init(),this.core.options.ui.inline?.enabled&&this.lifecycle.mount()}open(e){this.lifecycle.mount(),e&&e()}close(e,t){this.lifecycle.unmount(e?t:void 0),!e&&t&&t()}destroy(e){DD.delete(this.core.instanceId),this.lifecycle.destroy(e)}update(e,t){this.core.isDestroyed||(this.core.updateOptions(e.options),this.managers.config.checkMobileOption(),this.managers.config.getDisableTime(),e.create&&this.create(),t&&t())}getValue(){if(this.core.isDestroyed)return{hour:``,minutes:``,type:void 0,time:``,degreesHours:null,degreesMinutes:null};let e=this.core.getModalElement(),t=this.core.getInput(),n=`12`,r=`00`,i=this.core.options.clock.type===`24h`?void 0:`AM`,a=null,o=null;if(e){let e=this.core.getHour(),t=this.core.getMinutes(),s=this.core.getActiveTypeMode();n=e?.value||`12`,r=t?.value||`00`,i=this.core.options.clock.type===`24h`?void 0:s?.textContent||`AM`,a=this.core.degreesHours,o=this.core.degreesMinutes}else if(t){let e=ME(t,this.core.options.clock.type);n=e.hour,r=e.minutes,i=e.type,a=Number(n)*30,o=Number(r)*6}let s=``;return s=this.core.options.clock.type===`24h`?`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`:`${n}:${r.padStart(2,`0`)} ${i}`,{hour:n,minutes:r,type:i,time:s,degreesHours:a,degreesMinutes:o}}setValue(e,t=!0){if(this.core.isDestroyed||!e||typeof e!=`string`)return;this.core.isInitialized||this.create();let n=ED(e.trim());try{let e=this.parseTimeString(n);if(this.applyParsedTime(e),this.syncPeriodIndicator(e.typeValue),t){let e=this.core.getInput();e&&(e.value=n)}this.syncClockVisual(e)}catch{return}}parseTimeString(e){if(this.core.options.clock.type===`24h`){let t=e.match(/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])$/);if(!t)throw Error(`Invalid 24h format. Expected HH:MM`);return{hourValue:t[1].padStart(2,`0`),minutesValue:t[2],typeValue:`AM`}}let t=e.match(/^(1[0-2]|[1-9]):([0-5][0-9])\s*(AM|PM)$/i);if(!t)throw Error(`Invalid 12h format. Expected HH:MM AM/PM`);return{hourValue:t[1],minutesValue:t[2],typeValue:t[3].toUpperCase()}}applyParsedTime(e){let t=this.core.getHour(),n=this.core.getMinutes();t&&(t.value=e.hourValue,t.setAttribute(`aria-valuenow`,e.hourValue),this.core.setDegreesHours(Number(e.hourValue)*30)),n&&(n.value=e.minutesValue,n.setAttribute(`aria-valuenow`,e.minutesValue),this.core.setDegreesMinutes(Number(e.minutesValue)*6))}syncPeriodIndicator(e){if(this.core.options.clock.type===`24h`)return;let t=this.core.getAM(),n=this.core.getPM();!t||!n||(e===`AM`?(t.classList.add(`active`),n.classList.remove(`active`)):(n.classList.add(`active`),t.classList.remove(`active`)))}syncClockVisual(e){let t=this.core.options.ui.mode;if(t===`wheel`||t===`compact-wheel`){let t=this.managers.getPlugin(`wheel`);t&&`scrollToValue`in t&&t.scrollToValue(e.hourValue,e.minutesValue,e.typeValue)}else{let e=this.core.getClockHand();e&&(e.style.transform=`rotateZ(${this.core.degreesHours||0}deg)`)}}getElement(){return this.core.element}get instanceId(){return this.core.instanceId}get options(){return this.core.options}get isInitialized(){return this.core.isInitialized}get isDestroyed(){return this.core.isDestroyed}get hour(){return this.core.getHour()}get minutes(){return this.core.getMinutes()}get okButton(){return this.core.getOkButton()}get cancelButton(){return this.core.getCancelButton()}get clockHand(){return this.core.getClockHand()}on(e,t){this.core.isDestroyed||this.emitter.on(e,t)}once(e,t){this.core.isDestroyed||this.emitter.once(e,t)}off(e,t){this.core.isDestroyed||this.emitter.off(e,t)}resolveInputElement(e){if(aE()===!1)return null;let t=null;if(typeof e==`string`){if(t=document.querySelector(e),!t)return null}else if(e instanceof HTMLElement)t=e;else return null;return t.tagName===`INPUT`?t:t.querySelector(`input`)}createWrapperElement(e){if(aE()===!1)return e;let t=e.parentElement;if(e.tagName===`INPUT`&&!t?.classList.contains(`tp-ui`)){let t=document.createElement(`div`);return t.className=`tp-ui`,e.parentNode?.insertBefore(t,e),t.appendChild(e),t}return t&&!t.classList.contains(`tp-ui`)&&t.classList.add(`tp-ui`),t||e}static getById(e){return DD.get(e)}static getAllInstances(){return Array.from(DD.values())}static isAvailable(e){return iE()?!1:typeof e==`string`?document.querySelector(e)!==null:e instanceof HTMLElement?document.contains(e):!1}static destroyAll(){Array.from(DD.values()).forEach(e=>e.destroy()),DD.clear()}},kD=OD,AD=kD})),MD=u({RangeManager:()=>VD,RangePlugin:()=>HD});function ND(e){if(!e||e===`--:--`)return null;let t=e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(t)return{hour:t[1],minutes:t[2],type:t[3].toUpperCase()};let n=e.match(/^(\d{1,2}):(\d{2})$/);return n?{hour:n[1],minutes:n[2]}:null}function PD(e){let t=e.minutes===`--`?`--`:e.minutes.padStart(2,`0`),n=`${e.hour}:${t}`;return e.type?`${n} ${e.type}`:n}function FD(e,t){if(!e)return 0;let n=parseInt(e.hour,10),r=parseInt(e.minutes,10);return t===`12h`&&e.type&&(e.type===`PM`&&n!==12&&(n+=12),e.type===`AM`&&n===12&&(n=0)),n*60+r}function ID(e,t,n){if(!e||!t)return 0;let r=FD(e,n);return FD(t,n)-r}function LD(e,t){return e?t===`12h`?!!(e.hour&&e.minutes&&e.type):!!(e.hour&&e.minutes):!1}function RD(e){if(!e||!e.includes(` - `))return{from:null,to:null};let t=e.split(` - `).map(e=>e.trim());return t.length!==2||t[0]===`--:--`||t[1]===`--:--`?{from:null,to:null}:{from:ND(t[0]),to:ND(t[1])}}var zD,BD,VD,HD,UD=c((()=>{zD=class{activePart=`from`;fromValue=null;toValue=null;previewValue=null;clockType;minDuration;maxDuration;emitter;constructor(e,t,n,r){this.clockType=e,this.minDuration=t,this.maxDuration=n,this.emitter=r}getActivePart(){return this.activePart}getFromValue(){return this.fromValue}getToValue(){return this.toValue}getPreviewValue(){return this.previewValue}setFromValue(e){this.fromValue=e}setToValue(e){this.toValue=e}setPreviewValue(e){this.previewValue=e}isFromComplete(){return LD(this.fromValue,this.clockType)}isToComplete(){return LD(this.toValue,this.clockType)}canSwitchToEnd(){return this.isFromComplete()}canConfirm(){return!this.isFromComplete()||!this.isToComplete()?!1:this.getDuration()>0}setActivePart(e){if(e===`to`&&!this.canSwitchToEnd())return!1;let t=this.activePart!==e;return this.activePart=e,t&&(this.previewValue=null),t}resetActivePart(){this.activePart=`from`,this.previewValue=null}getCurrentValue(){return this.previewValue?this.previewValue:this.activePart===`from`?this.fromValue:this.toValue}getSavedValue(){return this.activePart===`from`?this.fromValue:this.toValue}commitPreview(){this.previewValue&&=(this.activePart===`from`?this.fromValue=this.previewValue:this.toValue=this.previewValue,null)}getDuration(){return ID(this.fromValue,this.toValue,this.clockType)}validate(){if(!this.fromValue||!this.toValue)return{valid:!0,duration:0};let e=this.getDuration(),t=!0;return this.minDuration!==void 0&&e<this.minDuration&&(t=!1),this.maxDuration!==void 0&&e>this.maxDuration&&(t=!1),this.emitter.emit(`range:validation`,{valid:t,duration:e,minDuration:this.minDuration,maxDuration:this.maxDuration}),{valid:t,duration:e}}getDisabledTimeForEndPart(){if(this.activePart===`from`||!this.fromValue||!this.isFromComplete())return null;let e=[],t=[],n=parseInt(this.fromValue.hour,10),r=parseInt(this.fromValue.minutes,10),i=this.fromValue.type;if(this.clockType===`24h`){for(let t=0;t<n;t++)e.push(t.toString().padStart(2,`0`));for(let e=0;e<r;e++)t.push(e.toString().padStart(2,`0`));return{hours:e,minutes:t,fromHour:n}}for(let e=0;e<r;e++)t.push(e.toString().padStart(2,`0`));return{hours:e,minutes:t,fromType:i,fromHour:n}}reset(){this.activePart=`from`,this.fromValue=null,this.toValue=null,this.previewValue=null}},BD=class{core;state;constructor(e,t){this.core=e,this.state=t}updateTabs(){let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(`.tp-ui-range-tab.tp-ui-range-from`),n=e.querySelector(`.tp-ui-range-tab.tp-ui-range-to`),r=this.state.getActivePart()===`from`,i=this.state.isFromComplete();t?.classList.toggle(`active`,r),n?.classList.toggle(`active`,!r),n?.classList.toggle(`disabled`,!i),t?.setAttribute(`aria-selected`,String(r)),n?.setAttribute(`aria-selected`,String(!r)),n?.setAttribute(`aria-disabled`,String(!i)),t?.setAttribute(`tabindex`,r?`0`:`-1`),n?.setAttribute(`tabindex`,r||!i?`-1`:`0`)}updateTimeDisplay(){let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(`.tp-ui-range-from-time`),n=e.querySelector(`.tp-ui-range-to-time`),r=this.state.getActivePart(),i=this.state.getPreviewValue(),a=this.state.getFromValue(),o=this.state.getToValue(),s=`--:--`;r===`from`&&i?s=PD(i):a&&(s=PD(a));let c=`--:--`;r===`to`&&i?c=PD(i):o&&(c=PD(o)),t&&(t.textContent=s),n&&(n.textContent=c)}updateOkButton(){let e=this.core.getOkButton();if(!e)return;let t=this.state.canConfirm();e.classList.toggle(`disabled`,!t),e.setAttribute(`aria-disabled`,String(!t))}updateInputValue(){let e=this.core.getInput();if(!e)return;let t=this.state.getFromValue(),n=this.state.getToValue();e.value=`${t?PD(t):`--:--`} - ${n?PD(n):`--:--`}`}syncClockToActivePart(){let e=this.state.getSavedValue(),t=this.core.getHour(),n=this.core.getMinutes();if(t&&(t.value=e?.hour??`12`),n&&(n.value=e?.minutes??`00`),this.core.options.clock.type===`12h`){let t=this.core.getAM(),n=this.core.getPM();e?.type===`AM`?(t?.classList.add(`active`),n?.classList.remove(`active`)):e?.type===`PM`?(n?.classList.add(`active`),t?.classList.remove(`active`)):(t?.classList.remove(`active`),n?.classList.remove(`active`))}n&&(n.blur(),n.classList.remove(`active`)),t&&t.click()}updateAll(){this.updateTabs(),this.updateTimeDisplay(),this.updateOkButton()}},VD=class{core;emitter;state;ui;cleanupHandlers=[];isSyncingAmPm=!1;boundHandleMinuteCommit;boundHandleConfirm;boundHandleUpdate;boundHandleAmPm;boundHandleClear;constructor(e,t){this.core=e,this.emitter=t;let{range:n,clock:r}=e.options;this.state=new zD(r.type,n?.minDuration,n?.maxDuration,t),this.ui=new BD(e,this.state),this.boundHandleMinuteCommit=this.handleMinuteCommit.bind(this),this.boundHandleConfirm=this.handleConfirm.bind(this),this.boundHandleUpdate=this.handleUpdate.bind(this),this.boundHandleAmPm=this.handleAmPm.bind(this),this.boundHandleClear=this.handleClear.bind(this)}get isEnabled(){return this.core.options.range?.enabled===!0}init(){if(!this.isEnabled)return;let{from:e,to:t}=RD(this.core.getInput()?.value||``);this.state.setFromValue(e),this.state.setToValue(t),this.state.setActivePart(`from`),this.state.setPreviewValue(null),this.bindEvents(),this.ui.syncClockToActivePart(),this.emitAmPmSyncEvent(),this.ui.updateAll()}getActivePart(){return this.state.getActivePart()}setActivePart(e){this.isEnabled&&(this.state.setActivePart(e)&&this.emitter.emit(`range:switch`,{active:e,disabledTime:this.state.getDisabledTimeForEndPart()}),this.ui.syncClockToActivePart(),this.emitAmPmSyncEvent(),this.ui.updateAll())}getFromValue(){return this.state.getFromValue()}getToValue(){return this.state.getToValue()}getDisabledTimeForEndPart(){return this.isEnabled?this.state.getDisabledTimeForEndPart():null}getDuration(){return this.state.getDuration()}validateRange(){return this.isEnabled?this.state.validate():{valid:!0,duration:0}}canConfirm(){return this.isEnabled?this.state.canConfirm():!0}getFormattedRange(){let e=this.state.getFromValue(),t=this.state.getToValue();return!e||!t?null:{from:PD(e),to:PD(t)}}bindEvents(){let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(`.tp-ui-range-tab.tp-ui-range-from`),n=e.querySelector(`.tp-ui-range-tab.tp-ui-range-to`);if(t){let e=()=>this.setActivePart(`from`);t.addEventListener(`click`,e),this.cleanupHandlers.push(()=>t.removeEventListener(`click`,e))}if(n){let e=()=>this.setActivePart(`to`);n.addEventListener(`click`,e),this.cleanupHandlers.push(()=>n.removeEventListener(`click`,e))}this.emitter.on(`update`,this.boundHandleUpdate),this.cleanupHandlers.push(()=>this.emitter.off(`update`,this.boundHandleUpdate)),this.emitter.on(`range:minute:commit`,this.boundHandleMinuteCommit),this.cleanupHandlers.push(()=>this.emitter.off(`range:minute:commit`,this.boundHandleMinuteCommit)),this.emitter.on(`confirm`,this.boundHandleConfirm),this.cleanupHandlers.push(()=>this.emitter.off(`confirm`,this.boundHandleConfirm)),this.emitter.on(`select:am`,this.boundHandleAmPm),this.cleanupHandlers.push(()=>this.emitter.off(`select:am`,this.boundHandleAmPm)),this.emitter.on(`select:pm`,this.boundHandleAmPm),this.cleanupHandlers.push(()=>this.emitter.off(`select:pm`,this.boundHandleAmPm)),this.emitter.on(`clear`,this.boundHandleClear),this.cleanupHandlers.push(()=>this.emitter.off(`clear`,this.boundHandleClear))}handleClear(){this.isEnabled&&(this.state.setFromValue(null),this.state.setToValue(null),this.state.setPreviewValue(null),this.state.resetActivePart())}handleUpdate(){if(!this.isEnabled)return;let e=this.core.getHour(),t=this.core.getMinutes(),n=this.core.getActiveTypeMode(),r=e?.value??`12`,i=this.state.getSavedValue(),a=i?.minutes&&i.minutes!==`--`?t?.value??`--`:`--`,o=this.core.options.clock.type===`12h`?n?.textContent??void 0:void 0;this.state.setPreviewValue({hour:r,minutes:a,type:o}),this.ui.updateAll()}handleMinuteCommit(e){if(!this.isEnabled)return;let t={hour:e.hour,minutes:e.minutes,type:e.type??void 0};this.state.getActivePart()===`from`?(this.state.setFromValue(t),this.state.setPreviewValue(null),this.state.isFromComplete()&&(this.state.setActivePart(`to`),this.emitter.emit(`range:switch`,{active:`to`,disabledTime:this.state.getDisabledTimeForEndPart()}),this.ui.syncClockToActivePart(),this.emitAmPmSyncEvent())):(this.state.setToValue(t),this.state.setPreviewValue(null)),this.state.validate(),this.ui.updateAll()}handleAmPm(){if(!this.isEnabled||this.isSyncingAmPm||this.core.options.clock.type!==`12h`)return;let e=this.core.getActiveTypeMode()?.textContent;if(e){if(this.state.getActivePart()===`from`){let t=this.state.getFromValue();t&&(this.state.setFromValue({...t,type:e}),this.state.isFromComplete()&&(this.state.setActivePart(`to`),this.state.setPreviewValue(null),this.emitter.emit(`range:switch`,{active:`to`,disabledTime:this.state.getDisabledTimeForEndPart()}),this.ui.syncClockToActivePart(),this.emitAmPmSyncEvent()))}else{let t=this.state.getToValue();t&&this.state.setToValue({...t,type:e}),this.emitter.emit(`range:switch`,{active:`to`,disabledTime:this.state.getDisabledTimeForEndPart()})}this.state.validate(),this.ui.updateAll()}}emitAmPmSyncEvent(){if(this.core.options.clock.type!==`12h`)return;let e=this.state.getSavedValue();if(e?.type){this.isSyncingAmPm=!0;try{e.type===`AM`?this.emitter.emit(`select:am`,{}):e.type===`PM`&&this.emitter.emit(`select:pm`,{})}finally{this.isSyncingAmPm=!1}}}handleConfirm(e){if(!this.isEnabled)return;this.state.commitPreview();let t=this.state.getFromValue(),n=this.state.getToValue(),r=t?PD(t):`--:--`,i=n?PD(n):`--:--`,a=this.state.getDuration();this.ui.updateInputValue(),this.emitter.emit(`range:confirm`,{from:r,to:i,duration:a})}reset(){this.state.reset()}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[],this.reset()}},HD={name:`range`,factory:(e,t)=>new VD(e,t),clearHandler:(e,t)=>{if(!e.options.range?.enabled)return;let n=e.getModalElement();if(!n)return;let r=n.querySelector(`.tp-ui-range-from`),i=n.querySelector(`.tp-ui-range-to`),a=n.querySelector(`.tp-ui-range-from-time`),o=n.querySelector(`.tp-ui-range-to-time`);a&&(a.textContent=`--:--`),o&&(o.textContent=`--:--`),r?.classList.add(`active`),i?.classList.remove(`active`),r?.setAttribute(`aria-selected`,`true`),i?.setAttribute(`aria-selected`,`false`),r?.setAttribute(`tabindex`,`0`),i?.setAttribute(`tabindex`,`-1`),i?.classList.add(`disabled`),i?.setAttribute(`aria-disabled`,`true`);let s=e.getHour();s&&s.focus(),t.emit(`range:switch`,{active:`from`,disabledTime:null})}}})),WD,GD,KD,qD=!1;async function JD(){if(!WD){let e=await Promise.resolve().then(()=>(jD(),QT));WD=e.TimepickerUI,GD=e.PluginRegistry,KD=(await Promise.resolve().then(()=>(UD(),MD))).RangePlugin,!qD&&GD&&KD&&(GD.register(KD),qD=!0)}}var YD=class{constructor(e){if(this.config={dayStartTime:`00:00`,dayEndTime:`23:59`,minuteIncrement:5,clockType:`12h`,...e},this.selectedStart=this.extractTimeAsHHMM(e.startTime),e.endTime)this.selectedEnd=this.extractTimeAsHHMM(e.endTime);else{let e=new Date(`2000-01-01T${this.selectedStart}:00Z`),n=new Date(e.getTime()+3600*1e3);this.selectedEnd=t.tools.dateTime.extractTime(n.toISOString())}this.inputElement=document.createElement(`input`),this.container=this.createUI()}extractTimeAsHHMM(e){return e.includes(`T`)?t.tools.dateTime.extractTime(e):e}createUI(){let e=document.createElement(`div`);return e.style.cssText=`
231
231
  position: fixed;
232
232
  left: -9999px;
233
233
  top: -9999px;
@@ -243,7 +243,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
243
243
  `,i.addEventListener(`mouseenter`,()=>{i.style.background=$D,i.style.color=eO}),i.addEventListener(`mouseleave`,()=>{i.style.background=`transparent`,i.style.color=``}),i.addEventListener(`click`,()=>{e.onTypeSelected(r.type),n()}),t.appendChild(i)}if(e.onAdjustTime||e.onDelete){let e=document.createElement(`div`);e.style.cssText=`border-top:1px solid var(--chc-border-primary); margin:4px 0;`,t.appendChild(e)}if(e.onAdjustTime){let r=document.createElement(`div`);r.style.cssText=QD,r.innerHTML=`<span style="font-size:14px;">&#128339;</span> Adjust Time`,r.addEventListener(`mouseenter`,()=>{r.style.background=$D,r.style.color=eO}),r.addEventListener(`mouseleave`,()=>{r.style.background=`transparent`,r.style.color=``}),r.addEventListener(`click`,()=>{let t=e.onAdjustTime;n(),e.startTime&&e.endTime&&XD({startTime:e.startTime,endTime:e.endTime,dayStartTime:`06:00`,dayEndTime:`22:00`,minuteIncrement:5,onConfirm:(e,n)=>t(e,n),onCancel:()=>{}})}),t.appendChild(r)}if(e.onDelete){let r=document.createElement(`div`);r.style.cssText=`padding:6px 12px; cursor:pointer; display:flex; align-items:center; gap:8px; color:#e74c3c;`,r.innerHTML=`<span style="font-size:14px;">&#128465;</span> Delete`,r.addEventListener(`mouseenter`,()=>{r.style.background=`#fdecea`}),r.addEventListener(`mouseleave`,()=>{r.style.background=`transparent`}),r.addEventListener(`click`,()=>{let t=e.onDelete;n(),t()}),t.appendChild(r)}return t}function i(e){let{blockId:t,engine:r,day:i,onBlockChanged:a}=e,o=document.createElement(`div`);o.style.cssText=`font-family:sans-serif; font-size:13px; min-width:150px;`;for(let[e,s]of tO){let c=HT[e],l=document.createElement(`div`);l.style.cssText=QD,l.innerHTML=`
244
244
  <span style="width:10px;height:10px;border-radius:2px;background:${c};display:inline-block;"></span>
245
245
  ${s}
246
- `,l.addEventListener(`mouseenter`,()=>{l.style.background=$D,l.style.color=eO}),l.addEventListener(`mouseleave`,()=>{l.style.background=`transparent`,l.style.color=``}),l.addEventListener(`click`,()=>{let o=r.getDayBlocks(i).find(e=>e.id===t);o&&(r.removeBlock(t),r.applyBlock({courts:[o.court],timeRange:{start:o.start,end:o.end},type:e,reason:s}),a()),n()}),o.appendChild(l)}let s=document.createElement(`div`);s.style.cssText=`border-top:1px solid var(--chc-border-primary); margin:4px 0;`,o.appendChild(s);let c=document.createElement(`div`);c.style.cssText=QD,c.innerHTML=`<span style="font-size:14px;">&#128339;</span> Adjust Time`,c.addEventListener(`mouseenter`,()=>{c.style.background=$D,c.style.color=eO}),c.addEventListener(`mouseleave`,()=>{c.style.background=`transparent`,c.style.color=``}),c.addEventListener(`click`,()=>{n();let e=r.getDayBlocks(i).find(e=>e.id===t);e&&XD({startTime:e.start,endTime:e.end,dayStartTime:`06:00`,dayEndTime:`22:00`,minuteIncrement:5,onConfirm:(n,i)=>{let o=e.start.slice(0,10);r.resizeBlock({blockId:t,newTimeRange:{start:`${o}T${n}:00`,end:`${o}T${i}:00`}}),a()},onCancel:()=>{}})}),o.appendChild(c);let l=document.createElement(`div`);return l.style.cssText=`padding:6px 12px; cursor:pointer; display:flex; align-items:center; gap:8px; color:#e74c3c;`,l.innerHTML=`<span style="font-size:14px;">&#128465;</span> Delete`,l.addEventListener(`mouseenter`,()=>{l.style.background=`#fdecea`}),l.addEventListener(`mouseleave`,()=>{l.style.background=`transparent`}),l.addEventListener(`click`,()=>{r.removeBlock(t),a(),n()}),o.appendChild(l),o}function a(r,i,a){n();let o=mm(r,{content:i,allowHTML:!0,interactive:!0,trigger:`manual`,placement:`bottom`,appendTo:document.body,onHidden:()=>{e=null,t=null}});e=o,t=a,o.show()}return{show(e,i){if(t===i.itemId){n();return}a(e,r(i),i.itemId)},showForEngineBlock(e,r){if(t===r.itemId){n();return}a(e,i(r),r.itemId)},destroy(){n()},isActiveFor(e){return t===e}}}var rO={day:{label:`1 Day`,days:1,timeAxis:{scale:`hour`,step:1}},days3:{label:`3 Days`,days:3,timeAxis:{scale:`hour`,step:3}},week:{label:`Week`,days:7,timeAxis:{scale:`hour`,step:6}},all:{label:`Tournament`,days:0,timeAxis:{scale:`hour`,step:6}}};function iO(e,t,n,r){let i=r?.labels,a=document.createElement(`div`);a.className=`tg-view-toolbar`;let o=document.createElement(`span`);o.textContent=(i?.view??`View`)+`:`,o.className=`tg-view-toolbar-label`,a.appendChild(o);let s=document.createElement(`input`);s.type=`text`,s.readOnly=!0,s.className=`tg-view-toolbar-date`,n&&s.addEventListener(`changeDate`,()=>{let e=s.value;e&&n(e)}),a.appendChild(s);let c={day:i?.day1??`1 Day`,days3:i?.days3??`3 Days`,week:i?.week??`Week`,all:i?.tournament??`Tournament`},l=[],u=[],d=t||`day`,f=e=>{l.forEach((t,n)=>{u[n]===e?t.className=`sp-btn sp-btn--active`:t.className=`sp-btn`})};for(let[t]of Object.entries(rO)){let n=document.createElement(`button`);n.textContent=c[t],n.className=t===d?`sp-btn sp-btn--active`:`sp-btn`,n.addEventListener(`click`,()=>{f(t),e(t)}),l.push(n),u.push(t),a.appendChild(n)}if(r?.onSetDefaultAvailability||r?.onSave){let e=document.createElement(`div`);e.className=`tg-view-toolbar-spacer`,a.appendChild(e)}if(r?.onSetDefaultAvailability){let e=document.createElement(`button`);e.textContent=i?.setDefaultAvailability??`Set Default Availability`,e.className=`sp-btn sp-btn--fill-muted`,e.addEventListener(`click`,r.onSetDefaultAvailability),a.appendChild(e)}let p=null;return r?.onSave&&(p=document.createElement(`button`),p.textContent=i?.saveToTournament??`Save to Tournament`,p.className=`sp-btn sp-btn--fill`,p.disabled=!0,p.addEventListener(`click`,r.onSave),a.appendChild(p)),{element:a,dateInput:s,setActiveView:f,setDate:e=>{s.value=e},setSaveEnabled:e=>{p&&(p.disabled=!e)}}}var aO=class{constructor(e,t,n){this._dailyStartMin=0,this._dailyEndMin=1440,this._useDailyBounds=!1,this._visibleDays=null,this._visibleDayMs=null,this._start=e.getTime(),this._end=t.getTime(),this._width=Math.max(n,1),this._min=this._start,this._max=this._end,this._zoomMin=900*1e3,this._zoomMax=(this._end-this._start)*2}get start(){return new Date(this._start)}get end(){return new Date(this._end)}get width(){return this._width}get duration(){return this._end-this._start}get msPerPx(){if(!this._useDailyBounds)return this.duration/this._width;let e=this.toCollapsedMin(new Date(this._start)),t=this.toCollapsedMin(new Date(this._end))-e;return t<=0?1:t*60*1e3/this._width}getDailyBounds(){return this._useDailyBounds?{startMin:this._dailyStartMin,endMin:this._dailyEndMin}:null}getVisibleDays(){return this._visibleDays}timeToX(e){if(!this._useDailyBounds)return(e.getTime()-this._start)/this.duration*this._width;let t=this.toCollapsedMin(e),n=this.toCollapsedMin(new Date(this._start)),r=this.toCollapsedMin(new Date(this._end))-n;return r<=0?0:(t-n)/r*this._width}xToTime(e){if(!this._useDailyBounds){let t=e/this._width*this.duration;return new Date(this._start+t)}let t=this.toCollapsedMin(new Date(this._start)),n=this.toCollapsedMin(new Date(this._end))-t;if(n<=0)return new Date(this._start);let r=t+e/this._width*n;return this.fromCollapsedMin(r)}snap(e,t){let n=e.getTime(),r=t*60*1e3;return new Date(Math.round(n/r)*r)}setWindow(e,t){this._start=e.getTime(),this._end=t.getTime(),this.clampBounds()}setLimits(e){e.min!==void 0&&(this._min=e.min.getTime()),e.max!==void 0&&(this._max=e.max.getTime()),e.zoomMin!==void 0&&(this._zoomMin=e.zoomMin),e.zoomMax!==void 0&&(this._zoomMax=e.zoomMax)}setWidth(e){this._width=Math.max(e,1)}setDailyBounds(e,t){let[n,r]=e.split(`:`).map(Number),[i,a]=t.split(`:`).map(Number);this._dailyStartMin=n*60+r,this._dailyEndMin=i*60+a,this._useDailyBounds=!0}clearDailyBounds(){this._useDailyBounds=!1,this._dailyStartMin=0,this._dailyEndMin=1440,this._visibleDays=null,this._visibleDayMs=null}setVisibleDays(e){this._visibleDays=e,this._visibleDayMs=e.map(e=>new Date(e+`T00:00:00`).getTime())}clearVisibleDays(){this._visibleDays=null,this._visibleDayMs=null}pan(e){if(this._visibleDays)return;if(this._useDailyBounds){let t=this.toCollapsedMin(new Date(this._start)),n=this.toCollapsedMin(new Date(this._end)),r=n-t;if(r<=0)return;let i=e/this._width*r,a=this.fromCollapsedMin(t+i),o=this.fromCollapsedMin(n+i);this._start=a.getTime(),this._end=o.getTime(),this.clampBounds();return}let t=e*this.msPerPx,n=this._start+t,r=this._end+t;if(n<this._min){let e=this._min-n;n+=e,r+=e}if(r>this._max){let e=r-this._max;n-=e,r-=e}this._start=n,this._end=r}zoom(e,t){if(this._visibleDays)return;if(this._useDailyBounds){let n=this.toCollapsedMin(new Date(this._start)),r=this.toCollapsedMin(new Date(this._end))-n,i=n+t/this._width*r,a=r*e,o=this._zoomMin/(60*1e3),s=this._zoomMax/(60*1e3);a=Math.max(o,Math.min(s,a));let c=t/this._width,l=this.fromCollapsedMin(i-a*c),u=this.fromCollapsedMin(i+a*(1-c));this._start=l.getTime(),this._end=u.getTime(),this.clampBounds();return}let n=this._start+t/this._width*this.duration,r=this.duration*e;r=Math.max(this._zoomMin,Math.min(this._zoomMax,r));let i=t/this._width;this._start=n-r*i,this._end=n+r*(1-i),this.clampBounds()}toCollapsedMin(e){let t=this._dailyEndMin-this._dailyStartMin;if(t<=0)return 0;let n=e.getHours()*60+e.getMinutes()+e.getSeconds()/60,r=Math.max(this._dailyStartMin,Math.min(this._dailyEndMin,n))-this._dailyStartMin;if(this._visibleDays&&this._visibleDayMs){let n=new Date(e);n.setHours(0,0,0,0);let i=n.getTime(),a=-1;for(let e=0;e<this._visibleDayMs.length;e++)if(this._visibleDayMs[e]===i){a=e;break}if(a===-1){if(i<this._visibleDayMs[0])return 0;if(i>this._visibleDayMs[this._visibleDayMs.length-1])return this._visibleDayMs.length*t;for(let e=0;e<this._visibleDayMs.length-1;e++)if(i>this._visibleDayMs[e]&&i<this._visibleDayMs[e+1])return(e+1)*t;return 0}return a*t+r}let i=new Date(this._start);i.setHours(0,0,0,0);let a=new Date(e);return a.setHours(0,0,0,0),Math.round((a.getTime()-i.getTime())/(1440*60*1e3))*t+r}fromCollapsedMin(e){let t=this._dailyEndMin-this._dailyStartMin;if(t<=0)return new Date(this._start);let n=Math.floor(e/t),r=e-n*t;if(this._visibleDays&&this._visibleDayMs){let e=Math.max(0,Math.min(n,this._visibleDayMs.length-1)),t=new Date(this._visibleDayMs[e]),i=this._dailyStartMin+r;return t.setHours(Math.floor(i/60),Math.round(i%60),0,0),t}let i=new Date(this._start);i.setHours(0,0,0,0);let a=new Date(i);a.setDate(a.getDate()+n);let o=this._dailyStartMin+r;return a.setHours(Math.floor(o/60),Math.round(o%60),0,0),a}clampBounds(){let e=this._end-this._start;this._start<this._min&&(this._start=this._min,this._end=this._min+e),this._end>this._max&&(this._end=this._max,this._start=this._max-e),this._start<this._min&&(this._start=this._min),this._end>this._max&&(this._end=this._max)}},oO=`tg-tick-day`,sO=`tg-tick-hour`,cO=class{constructor(e,t){this.scale=e,this.tickConfig=lO(t),this.dayEl=document.createElement(`div`),this.dayEl.className=`tg-day-axis`,this.dayEl.setAttribute(`role`,`presentation`),this.hourEl=document.createElement(`div`),this.hourEl.className=`tg-hour-axis`,this.hourEl.setAttribute(`role`,`presentation`),this.dayEl.addEventListener(`click`,e=>{let t=(e.target.closest?.(`.${oO}`))?.dataset.day;t&&this.onDayClick&&this.onDayClick(t)})}getDayElement(){return this.dayEl}getHourElement(){return this.hourEl}setTimeAxisOptions(e){this.tickConfig=lO(e)}render(){this.renderDayLabels(),this.renderHourTicks()}renderDayLabels(){this.dayEl.innerHTML=``;let{dayFormat:e}=this.tickConfig,t=this.tickConfig.scale,n=this.scale.getDailyBounds();if(n&&t===`hour`){this.renderDayLabelsWithBounds(n,e);return}if(t===`hour`){let t=this.scale.start.getTime(),n=dO(t,this.scale.end.getTime());if(n.length===0){let n=new Date(t);n.setHours(0,0,0,0);let r=document.createElement(`div`);r.className=oO,r.style.left=`0px`,r.style.maxWidth=`${this.scale.width}px`,r.dataset.day=uO(n),r.textContent=e.format(n),this.dayEl.appendChild(r);return}for(let t of n){let n=this.scale.timeToX(t),r=document.createElement(`div`);r.className=oO,r.style.left=`${n}px`,r.dataset.day=uO(t),r.textContent=e.format(t),this.dayEl.appendChild(r)}}else if(t===`day`){let e=pO(this.scale.start.getTime(),this.scale.end.getTime());for(let t of e){let e=this.scale.timeToX(t),n=document.createElement(`div`);n.className=oO,n.style.left=`${e}px`,n.dataset.day=uO(t),n.textContent=this.tickConfig.dayFormat.format(t),this.dayEl.appendChild(n)}}}renderDayLabelsWithBounds(e,t){let n=this.getVisibleDayDates(e),r=this.scale.getVisibleDays(),i=n.length,a=i>0?this.scale.width/i:this.scale.width,o=a<150?new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`}):t;if(r&&r.length>0)for(let t of n){let n=new Date(t);n.setHours(0,0,0,0),n.setMinutes(e.startMin);let r=this.scale.timeToX(n),i=document.createElement(`div`);i.className=oO,i.style.left=`${r}px`,i.style.maxWidth=`${Math.floor(a)-4}px`,i.dataset.day=uO(t),i.textContent=o.format(n),this.dayEl.appendChild(i)}else{let t=this.scale.width;for(let r of n){let n=new Date(r);n.setHours(0,0,0,0),n.setMinutes(e.startMin);let i=new Date(r);i.setHours(0,0,0,0),i.setDate(i.getDate()+1),i.setMinutes(e.startMin);let a=this.scale.timeToX(n),s=this.scale.timeToX(i),c=Math.max(a,0),l=Math.min(s,t)-c;if(l<=0)continue;let u=document.createElement(`div`);u.className=oO,u.style.left=`${c}px`,u.style.maxWidth=`${l}px`,u.dataset.day=uO(r),u.textContent=o.format(n),this.dayEl.appendChild(u)}}}renderHourTicks(){this.hourEl.innerHTML=``;let{hourFormat:e}=this.tickConfig,t=this.tickConfig.scale,n=this.tickConfig.step,r=this.scale.getDailyBounds();if(r&&t===`hour`){this.renderHourTicksWithBounds(r,n,e);return}let i=this.scale.start.getTime(),a=this.scale.end.getTime();if(t===`hour`){let t=new Set(dO(i,a).map(e=>e.getTime())),r=fO(i,a,n);for(let n of r){if(t.has(n.getTime()))continue;let r=this.scale.timeToX(n),i=document.createElement(`div`);i.className=sO,i.style.left=`${r}px`,i.textContent=e.format(n),this.hourEl.appendChild(i)}}else if(t===`day`){let e=new Set(pO(i,a).map(e=>e.getTime())),t=dO(i,a);for(let n of t){if(e.has(n.getTime()))continue;let t=this.scale.timeToX(n),r=document.createElement(`div`);r.className=sO,r.style.left=`${t}px`,r.textContent=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`}).format(n),this.hourEl.appendChild(r)}}}renderHourTicksWithBounds(e,t,n){let r=this.getVisibleDayDates(e);for(let i of r){let r=new Date(i);r.setHours(0,0,0,0),r.setMinutes(e.startMin);let a=new Date(i);a.setHours(0,0,0,0),a.setMinutes(e.endMin);let o=Math.ceil(e.startMin/60),s=new Date(i);for(s.setHours(o,0,0,0),s.getHours()%t!==0&&s.setHours(s.getHours()+(t-s.getHours()%t));s.getTime()<=a.getTime();){if(s.getTime()!==r.getTime()){let e=this.scale.timeToX(s),t=document.createElement(`div`);t.className=sO,t.style.left=`${e}px`,t.textContent=n.format(s),this.hourEl.appendChild(t)}s.setHours(s.getHours()+t)}}}getVisibleDayDates(e){let t=this.scale.getVisibleDays();if(t&&t.length>0)return t.map(e=>new Date(e+`T00:00:00`));let n=this.scale.start.getTime(),r=this.scale.end.getTime(),i=[],a=new Date(n);for(a.setHours(0,0,0,0);;){let t=new Date(a);if(t.setHours(0,0,0,0),t.setMinutes(e.endMin),t.getTime()<n){a.setDate(a.getDate()+1);continue}let o=new Date(a);if(o.setHours(0,0,0,0),o.setMinutes(e.startMin),o.getTime()>r)break;i.push(new Date(a)),a.setDate(a.getDate()+1)}return i}renderGridlines(e,t){e.querySelectorAll(`.tg-gridline`).forEach(e=>e.remove());let n=this.computeTickPositions();for(let{x:r,isMajor:i}of n){let n=document.createElement(`div`);n.className=i?`tg-gridline tg-gridline-major`:`tg-gridline`,n.style.left=`${r}px`,n.style.height=`${t}px`,e.appendChild(n)}}computeTickPositions(){let e=[],t=this.tickConfig.scale,n=this.tickConfig.step,r=this.scale.getDailyBounds(),i=this.scale.start.getTime(),a=this.scale.end.getTime();if(r&&t===`hour`){let t=this.getVisibleDayDates(r);for(let i of t){let t=new Date(i);t.setHours(0,0,0,0),t.setMinutes(r.startMin);let a=new Date(i);a.setHours(0,0,0,0),a.setMinutes(r.endMin),e.push({x:this.scale.timeToX(t),isMajor:!0});let o=Math.ceil(r.startMin/60),s=new Date(i);for(s.setHours(o,0,0,0),s.getHours()%n!==0&&s.setHours(s.getHours()+(n-s.getHours()%n));s.getTime()<=a.getTime();)s.getTime()!==t.getTime()&&e.push({x:this.scale.timeToX(s),isMajor:!1}),s.setHours(s.getHours()+n)}}else if(t===`hour`){let t=dO(i,a),r=new Set(t.map(e=>e.getTime()));for(let n of t)e.push({x:this.scale.timeToX(n),isMajor:!0});for(let t of fO(i,a,n))r.has(t.getTime())||e.push({x:this.scale.timeToX(t),isMajor:!1})}else if(t===`day`){let t=pO(i,a),n=new Set(t.map(e=>e.getTime()));for(let n of t)e.push({x:this.scale.timeToX(n),isMajor:!0});for(let t of dO(i,a))n.has(t.getTime())||e.push({x:this.scale.timeToX(t),isMajor:!1})}return e}destroy(){this.dayEl.remove(),this.hourEl.remove()}};function lO(e){let t=e?.scale??`hour`,n=e?.step??1;switch(t){case`hour`:return{scale:t,step:n,hourFormat:new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),dayFormat:new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`})};case`day`:return{scale:t,step:n,hourFormat:new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`}),dayFormat:new Intl.DateTimeFormat(void 0,{month:`long`,year:`numeric`})};default:return{scale:`hour`,step:1,hourFormat:new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),dayFormat:new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`})}}}function uO(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function dO(e,t){let n=[],r=new Date(e);for(r.setHours(0,0,0,0);r.getTime()<=t;)r.getTime()>=e&&n.push(new Date(r)),r.setDate(r.getDate()+1);return n}function fO(e,t,n){let r=[],i=new Date(e);i.setMinutes(0,0,0);let a=i.getHours();for(i.setHours(a-a%n);i.getTime()<=t;)i.getTime()>=e&&r.push(new Date(i)),i.setHours(i.getHours()+n);return r}function pO(e,t){let n=[],r=new Date(e);r.setHours(0,0,0,0);let i=r.getDay(),a=i===0?6:i-1;for(r.setDate(r.getDate()-a);r.getTime()<=t;)r.getTime()>=e&&n.push(new Date(r)),r.setDate(r.getDate()+7);return n}var mO=class{constructor(e=40){this.groups=[],this.groupIndex=new Map,this.rowHeight=e,this.labelPanel=document.createElement(`div`),this.labelPanel.className=`tg-label-panel`,this.labelPanel.setAttribute(`role`,`rowheader`),this.contentArea=document.createElement(`div`),this.contentArea.className=`tg-content`,this.contentArea.setAttribute(`role`,`grid`)}getLabelPanel(){return this.labelPanel}getContentArea(){return this.contentArea}getRowHeight(){return this.rowHeight}getGroups(){return this.groups}getGroupCount(){return this.groups.length}getGroupAtIndex(e){return this.groups[e]}yToGroupId(e){let t=Math.floor(e/this.rowHeight);return t<0||t>=this.groups.length?null:this.groups[t].id}groupIdToRowIndex(e){return this.groupIndex.get(e)??-1}getRowRange(e,t){let n=Math.max(0,Math.floor(Math.min(e,t)/this.rowHeight)),r=Math.min(this.groups.length-1,Math.floor(Math.max(e,t)/this.rowHeight)),i=[];for(let e=n;e<=r;e++)i.push(this.groups[e].id);return i}getRowTop(e){return e*this.rowHeight}setGroups(e){this.groups=e.slice().sort((e,t)=>e.order!==void 0&&t.order!==void 0?e.order-t.order:e.order===void 0?t.order===void 0?e.content.localeCompare(t.content,void 0,{numeric:!0}):1:-1),this.groupIndex.clear();for(let e=0;e<this.groups.length;e++)this.groupIndex.set(this.groups[e].id,e)}render(){this.renderLabels(),this.renderRows()}renderLabels(){this.labelPanel.innerHTML=``;for(let e of this.groups){let t=document.createElement(`div`);t.className=`tg-label`,t.style.height=`${this.rowHeight}px`,t.textContent=e.content,t.title=e.content,t.dataset.groupId=e.id,this.labelPanel.appendChild(t)}}renderRows(){this.contentArea.querySelectorAll(`.tg-row`).forEach(e=>e.remove());for(let e=0;e<this.groups.length;e++){let t=document.createElement(`div`);t.className=`tg-row`,t.style.height=`${this.rowHeight}px`,t.style.top=`${e*this.rowHeight}px`,t.dataset.groupId=this.groups[e].id,this.contentArea.appendChild(t)}this.contentArea.style.height=`${this.groups.length*this.rowHeight}px`}destroy(){this.labelPanel.remove(),this.contentArea.remove()}},hO=class{constructor(e,t){this.items=[],this.itemElements=new Map,this.ghostEl=null,this.ghostCountBadge=null,this.scale=e,this.layout=t,this.contentArea=t.getContentArea()}setItems(e){this.items=e}render(){for(let e of this.itemElements.values())e.remove();this.itemElements.clear(),this.contentArea.querySelectorAll(`[data-item-id]`).forEach(e=>{e.dataset.itemId!==`__ghost__`&&e.remove()});for(let e of this.items){let t=this.renderItem(e);t&&(this.contentArea.appendChild(t),this.itemElements.set(e.id,t))}}renderItem(e){let t=this.layout.groupIdToRowIndex(e.group);if(t===-1)return null;let n=e.start instanceof Date?e.start:new Date(e.start),r=e.end?e.end instanceof Date?e.end:new Date(e.end):n,i=this.scale.timeToX(n),a=this.scale.timeToX(r)-i,o=this.layout.getRowTop(t),s=this.layout.getRowHeight();if(a<.5)return null;let c=document.createElement(`div`);if(c.dataset.itemId=e.id,c.title=e.title||e.content,e.type===`background`||e.isSegment)c.className=`tg-item-background ${e.className||``}`.trim(),e.style&&(c.style.cssText=e.style),c.style.position=`absolute`,c.style.left=`${i}px`,c.style.top=`${o}px`,c.style.width=`${a}px`,c.style.height=`${s}px`,c.style.pointerEvents=`none`;else{c.className=`tg-item tg-item-range ${e.className||``}`.trim(),e.style&&(c.style.cssText+=e.style),c.style.position=`absolute`,c.style.left=`${i}px`,c.style.top=`${o+2}px`,c.style.width=`${a}px`,c.style.height=`${s-4}px`,c.style.cursor=`move`;let t=document.createElement(`span`);t.className=`tg-item-content`,t.textContent=e.content,c.appendChild(t);let n=document.createElement(`div`);n.className=`tg-resize-handle tg-resize-left`,n.dataset.handle=`left`,c.appendChild(n);let r=document.createElement(`div`);r.className=`tg-resize-handle tg-resize-right`,r.dataset.handle=`right`,c.appendChild(r)}return c}updateItemPosition(e,t,n,r){let i=this.itemElements.get(e);i&&(i.style.left=`${t}px`,i.style.top=`${n+2}px`,i.style.width=`${r}px`)}showGhost(e){if(!this.ghostEl){this.ghostEl=document.createElement(`div`),this.ghostEl.className=`tg-ghost`,this.ghostEl.dataset.itemId=`__ghost__`;for(let e of[`left`,`right`,`top`,`bottom`]){let t=document.createElement(`div`);t.className=`tg-resize-handle tg-resize-${e}`,t.dataset.handle=e,this.ghostEl.appendChild(t)}this.ghostCountBadge=document.createElement(`div`),this.ghostCountBadge.className=`tg-ghost-count`,this.ghostEl.appendChild(this.ghostCountBadge),this.contentArea.appendChild(this.ghostEl)}let t=this.scale.timeToX(e.startTime),n=this.scale.timeToX(e.endTime)-t,r=this.layout.getRowHeight(),i=e.topRowIndex*r,a=(e.bottomRowIndex-e.topRowIndex+1)*r,o=e.bottomRowIndex-e.topRowIndex+1;this.ghostEl.style.left=`${t}px`,this.ghostEl.style.top=`${i}px`,this.ghostEl.style.width=`${n}px`,this.ghostEl.style.height=`${a}px`,this.ghostEl.style.display=`block`,this.ghostCountBadge&&(this.ghostCountBadge.textContent=`${o} court${o>1?`s`:``}`,this.ghostCountBadge.style.display=o>1?`flex`:`none`)}clearGhost(){this.ghostEl&&(this.ghostEl.remove(),this.ghostEl=null,this.ghostCountBadge=null)}isGhostVisible(){return this.ghostEl!==null&&this.ghostEl.style.display!==`none`}highlightRows(e){this.clearHighlights();for(let t of e){let e=this.contentArea.querySelectorAll(`.tg-row`);e[t]&&e[t].classList.add(`tg-row-highlight`)}}clearHighlights(){this.contentArea.querySelectorAll(`.tg-row-highlight`).forEach(e=>{e.classList.remove(`tg-row-highlight`)})}static hitTest(e){if(!(e instanceof HTMLElement))return{itemId:null,handle:null};let t=e.closest(`.tg-resize-handle`)?.dataset.handle??null;return{itemId:e.closest(`[data-item-id]`)?.dataset.itemId??null,handle:t}}destroy(){this.clearGhost(),this.clearHighlights();for(let e of this.itemElements.values())e.remove();this.itemElements.clear()}},gO=3,_O=30,vO=8,yO=3600*1e3,bO=class{constructor(e,t,n,r,i=5,a=!1){this.mode=`IDLE`,this.gesture=null,this.items=[],this.ghostStartTime=null,this.ghostEndTime=null,this.ghostTopRow=0,this.ghostBottomRow=0,this.justDragged=!1,this.autoScrollRaf=null,this.autoScrollDelta=0,this.scrollContainer=null,this.onPointerDown=e=>{if(e.button!==0)return;let{itemId:t,handle:n}=hO.hitTest(e.target);if(this.mode===`GHOST_EDITING`){if(t===`__ghost__`&&n){this.startGesture(e,`__ghost__`,n===`left`?`RESIZING_LEFT`:n===`right`?`RESIZING_RIGHT`:n===`top`?`RESIZING_TOP`:`RESIZING_BOTTOM`);return}if(t===`__ghost__`&&!n){this.confirmGhost();return}this.cancelGhost();return}if(t)if(n===`left`)this.startGesture(e,t,`RESIZING_LEFT`);else if(n===`right`)this.startGesture(e,t,`RESIZING_RIGHT`);else{let n=this.items.find(e=>e.id===t);if(!n||n.isSegment||n.type===`background`)return;this.startGesture(e,t,`DRAGGING`)}},this.onPointerMove=e=>{if(this.gesture){if(this.gesture.currentX=e.clientX,this.gesture.currentY=e.clientY,!this.gesture.thresholdExceeded){let t=Math.abs(e.clientX-this.gesture.startX),n=Math.abs(e.clientY-this.gesture.startY);if(t<gO&&n<gO)return;this.gesture.thresholdExceeded=!0}switch(this.checkAutoScroll(e),this.mode){case`DRAGGING`:this.handleDragMove(e);break;case`RESIZING_LEFT`:case`RESIZING_RIGHT`:this.gesture.itemId===`__ghost__`?this.handleGhostTimeResize(e):this.handleResizeMove(e);break;case`RESIZING_TOP`:case`RESIZING_BOTTOM`:this.handleGhostRowResize(e);break}}},this.onPointerUp=e=>{if(document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp),this.stopAutoScroll(),!this.gesture){this.mode=`IDLE`;return}let t=this.gesture.itemId===`__ghost__`;if(!this.gesture.thresholdExceeded&&!t){this.gesture.itemId&&this.callbacks.onItemClick?.(this.gesture.itemId,e),this.gesture=null,this.mode=`IDLE`,this.renderer.clearHighlights();return}if(t){this.gesture=null,this.mode=`GHOST_EDITING`;return}if(this.gesture.itemId&&this.gesture.thresholdExceeded){this.justDragged=!0,setTimeout(()=>this.justDragged=!1,300);let t=(e.clientX-this.gesture.startX)*this.scale.msPerPx,n=this.gesture.originalEnd.getTime()-this.gesture.originalStart.getTime(),r,i,a=this.gesture.originalGroup;if(this.mode===`DRAGGING`){r=this.scale.snap(new Date(this.gesture.originalStart.getTime()+t),this.snapMinutes),i=new Date(r.getTime()+n);let o=this.contentArea.getBoundingClientRect(),s=e.clientY-o.top+this.contentArea.scrollTop;a=this.layout.yToGroupId(s)||this.gesture.originalGroup}else this.mode===`RESIZING_LEFT`?(r=this.scale.snap(new Date(this.gesture.originalStart.getTime()+t),this.snapMinutes),i=this.gesture.originalEnd,r>=i&&(r=new Date(i.getTime()-this.snapMinutes*60*1e3))):(r=this.gesture.originalStart,i=this.scale.snap(new Date(this.gesture.originalEnd.getTime()+t),this.snapMinutes),i<=r&&(i=new Date(r.getTime()+this.snapMinutes*60*1e3)));this.callbacks.onMove?.({id:this.gesture.itemId,group:a,start:r,end:i})}this.gesture=null,this.mode=`IDLE`,this.renderer.clearHighlights()},this.onDblClick=e=>{if(this.justDragged)return;let{itemId:t}=hO.hitTest(e.target);if(t)return;let n=this.contentArea.getBoundingClientRect(),r=e.clientX-n.left+this.contentArea.scrollLeft,i=e.clientY-n.top+this.contentArea.scrollTop,a=this.scale.xToTime(r),o=this.scale.snap(a,this.snapMinutes),s=new Date(o.getTime()+yO),c=this.layout.yToGroupId(i);if(!c)return;let l=this.layout.groupIdToRowIndex(c);l<0||(this.ghostStartTime=o,this.ghostEndTime=s,this.ghostTopRow=l,this.ghostBottomRow=l,this.mode=`GHOST_EDITING`,this.renderer.showGhost({startTime:o,endTime:s,topRowIndex:l,bottomRowIndex:l}),this.renderer.highlightRows([l]))},this.onWheel=e=>{if(!((e.ctrlKey||e.metaKey)&&!this.enablePinchZoom)){if(e.preventDefault(),(e.ctrlKey||e.metaKey)&&this.enablePinchZoom){let t=e.deltaY>0?1.15:.87,n=this.contentArea.getBoundingClientRect(),r=e.clientX-n.left;this.scale.zoom(t,r)}else if(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY)){let t=e.deltaX||e.deltaY;this.scale.pan(t)}else{this.scrollContainer&&(this.scrollContainer.scrollTop+=e.deltaY);return}this.onScaleChanged?.()}},this.onScaleChanged=null,this.onKeyDown=e=>{e.key===`Escape`&&this.mode===`GHOST_EDITING`&&this.cancelGhost()},this.scale=e,this.layout=t,this.renderer=n,this.contentArea=t.getContentArea(),this.wheelTarget=this.contentArea,this.callbacks=r,this.snapMinutes=i,this.enablePinchZoom=a}setItems(e){this.items=e}setScrollContainer(e){this.scrollContainer=e}setWheelTarget(e){this.wheelTarget=e}attach(){this.contentArea.addEventListener(`pointerdown`,this.onPointerDown),this.contentArea.addEventListener(`dblclick`,this.onDblClick),this.wheelTarget.addEventListener(`wheel`,this.onWheel,{passive:!1}),document.addEventListener(`keydown`,this.onKeyDown)}detach(){this.contentArea.removeEventListener(`pointerdown`,this.onPointerDown),this.contentArea.removeEventListener(`dblclick`,this.onDblClick),this.wheelTarget.removeEventListener(`wheel`,this.onWheel),document.removeEventListener(`keydown`,this.onKeyDown),document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp),this.stopAutoScroll()}getMode(){return this.mode}startGesture(e,t,n){e.preventDefault();let r=this.items.find(e=>e.id===t),i,a,o;if(t===`__ghost__`)i=this.ghostStartTime,a=this.ghostEndTime,o=``;else if(r)i=r.start instanceof Date?r.start:new Date(r.start),a=r.end?r.end instanceof Date?r.end:new Date(r.end):i,o=r.group;else return;this.gesture={mode:n,itemId:t,startX:e.clientX,startY:e.clientY,originalStart:i,originalEnd:a,originalGroup:o,currentX:e.clientX,currentY:e.clientY,thresholdExceeded:!1},this.mode=n,this.contentArea.setPointerCapture(e.pointerId),document.addEventListener(`pointermove`,this.onPointerMove),document.addEventListener(`pointerup`,this.onPointerUp)}handleDragMove(e){if(!this.gesture||!this.gesture.itemId)return;let t=(e.clientX-this.gesture.startX)*this.scale.msPerPx,n=this.gesture.originalEnd.getTime()-this.gesture.originalStart.getTime(),r=this.scale.snap(new Date(this.gesture.originalStart.getTime()+t),this.snapMinutes),i=new Date(r.getTime()+n),a=this.contentArea.getBoundingClientRect(),o=e.clientY-a.top+this.contentArea.scrollTop,s=this.layout.yToGroupId(o)||this.gesture.originalGroup;if(this.callbacks.onMoving){let e=this.callbacks.onMoving({id:this.gesture.itemId,group:s,start:r,end:i});if(e===null)return;r=e.start,i=e.end}let c=this.scale.timeToX(r),l=this.scale.timeToX(i)-c,u=this.layout.groupIdToRowIndex(s),d=this.layout.getRowTop(u>=0?u:0);this.renderer.updateItemPosition(this.gesture.itemId,c,d,l),u>=0&&this.renderer.highlightRows([u])}handleResizeMove(e){if(!this.gesture||!this.gesture.itemId)return;let t=(e.clientX-this.gesture.startX)*this.scale.msPerPx,n=this.gesture.originalStart,r=this.gesture.originalEnd;if(this.mode===`RESIZING_LEFT`?(n=this.scale.snap(new Date(this.gesture.originalStart.getTime()+t),this.snapMinutes),n>=r&&(n=new Date(r.getTime()-this.snapMinutes*60*1e3))):(r=this.scale.snap(new Date(this.gesture.originalEnd.getTime()+t),this.snapMinutes),r<=n&&(r=new Date(n.getTime()+this.snapMinutes*60*1e3))),this.callbacks.onMoving){let e=this.callbacks.onMoving({id:this.gesture.itemId,group:this.gesture.originalGroup,start:n,end:r});if(e===null)return;n=e.start,r=e.end}let i=this.scale.timeToX(n),a=this.scale.timeToX(r)-i,o=this.layout.groupIdToRowIndex(this.gesture.originalGroup),s=this.layout.getRowTop(o>=0?o:0);this.renderer.updateItemPosition(this.gesture.itemId,i,s,a)}handleGhostTimeResize(e){if(!this.gesture)return;let t=this.contentArea.getBoundingClientRect(),n=e.clientX-t.left+this.contentArea.scrollLeft,r=this.scale.snap(this.scale.xToTime(n),this.snapMinutes);this.mode===`RESIZING_LEFT`?r<this.ghostEndTime&&(this.ghostStartTime=r):r>this.ghostStartTime&&(this.ghostEndTime=r),this.updateGhostDisplay()}handleGhostRowResize(e){if(!this.gesture)return;let t=this.contentArea.getBoundingClientRect(),n=e.clientY-t.top+this.contentArea.scrollTop,r=Math.floor(n/this.layout.getRowHeight()),i=Math.max(0,Math.min(this.layout.getGroupCount()-1,r));this.mode===`RESIZING_TOP`?i<=this.ghostBottomRow&&(this.ghostTopRow=i):i>=this.ghostTopRow&&(this.ghostBottomRow=i),this.updateGhostDisplay()}updateGhostDisplay(){this.renderer.showGhost({startTime:this.ghostStartTime,endTime:this.ghostEndTime,topRowIndex:this.ghostTopRow,bottomRowIndex:this.ghostBottomRow});let e=[];for(let t=this.ghostTopRow;t<=this.ghostBottomRow;t++)e.push(t);this.renderer.highlightRows(e)}confirmGhost(){if(!this.ghostStartTime||!this.ghostEndTime){this.cancelGhost();return}let e=[];for(let t=this.ghostTopRow;t<=this.ghostBottomRow;t++){let n=this.layout.getGroupAtIndex(t);n&&e.push(n.id)}if(e.length===0){this.cancelGhost();return}let t={groupIds:e,topRowIndex:this.ghostTopRow,bottomRowIndex:this.ghostBottomRow,startTime:this.ghostStartTime,endTime:this.ghostEndTime};this.renderer.clearGhost(),this.renderer.clearHighlights(),this.mode=`IDLE`,this.callbacks.onMultiRowCreate?.(t),this.ghostStartTime=null,this.ghostEndTime=null}cancelGhost(){this.renderer.clearGhost(),this.renderer.clearHighlights(),this.mode=`IDLE`,this.ghostStartTime=null,this.ghostEndTime=null}checkAutoScroll(e){if(!this.scrollContainer)return;let t=this.scrollContainer.getBoundingClientRect(),n=t.bottom-e.clientY,r=e.clientY-t.top;n<_O?(this.autoScrollDelta=vO*(1-n/_O),this.startAutoScroll()):r<_O?(this.autoScrollDelta=-vO*(1-r/_O),this.startAutoScroll()):this.stopAutoScroll()}startAutoScroll(){if(this.autoScrollRaf!==null)return;let e=()=>{this.scrollContainer&&(this.scrollContainer.scrollTop+=this.autoScrollDelta,this.autoScrollRaf=requestAnimationFrame(e))};this.autoScrollRaf=requestAnimationFrame(e)}stopAutoScroll(){this.autoScrollRaf!==null&&(cancelAnimationFrame(this.autoScrollRaf),this.autoScrollRaf=null),this.autoScrollDelta=0}},xO=class{constructor(e,t,n,r={}){this.callbacks={},this.resizeObserver=null,this._batchUpdating=!1,this.eventListeners=new Map,this.options={rowHeight:40,...r};let i=new Date;this.scale=new aO(r.start||i,r.end||new Date(i.getTime()+720*60*1e3),e.clientWidth||800),(r.min||r.max||r.zoomMin||r.zoomMax)&&this.scale.setLimits({min:r.min,max:r.max,zoomMin:r.zoomMin,zoomMax:r.zoomMax}),this.timeAxis=new cO(this.scale,r.timeAxis),this.layout=new mO(this.options.rowHeight),this.renderer=new hO(this.scale,this.layout),this.interaction=new bO(this.scale,this.layout,this.renderer,this.callbacks,5,r.enablePinchZoom??!1),this.rootEl=document.createElement(`div`),this.rootEl.className=`tg-timeline`,r.height&&(this.rootEl.style.height=r.height);let a=document.createElement(`div`);a.className=`tg-axis-header`;let o=document.createElement(`div`);o.className=`tg-axis-spacer`,a.appendChild(o),a.appendChild(this.timeAxis.getDayElement()),a.appendChild(this.timeAxis.getHourElement()),this.rootEl.appendChild(a),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tg-body`,this.bodyEl.appendChild(this.layout.getLabelPanel());let s=document.createElement(`div`);s.className=`tg-scroll-wrapper`,s.appendChild(this.layout.getContentArea()),this.bodyEl.appendChild(s),this.rootEl.appendChild(this.bodyEl),e.appendChild(this.rootEl),s.addEventListener(`scroll`,()=>{this.layout.getLabelPanel().scrollTop=s.scrollTop}),this.interaction.setScrollContainer(s),this.interaction.setWheelTarget(this.rootEl),this.interaction.onScaleChanged=()=>this.renderAll(),this.layout.setGroups(n),this.renderer.setItems(t),this.interaction.setItems(t),this.interaction.attach(),this.renderAll(),this.resizeObserver=new ResizeObserver(()=>{let t=s.clientWidth||e.clientWidth;this.scale.setWidth(t),this.renderAll()}),this.resizeObserver.observe(s)}setGroups(e){this.layout.setGroups(e),this.renderAll()}setItems(e){this.renderer.setItems(e),this.interaction.setItems(e),this.renderAll()}setWindow(e,t,n){this.scale.setWindow(e,t),this.renderAll()}setOptions(e){(e.min!==void 0||e.max!==void 0||e.zoomMin!==void 0||e.zoomMax!==void 0)&&this.scale.setLimits({min:e.min,max:e.max,zoomMin:e.zoomMin,zoomMax:e.zoomMax}),e.timeAxis&&this.timeAxis.setTimeAxisOptions(e.timeAxis),e.rowHeight!==void 0&&(this.options.rowHeight=e.rowHeight),Object.assign(this.options,e),this.renderAll()}on(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t),e===`click`&&(this.callbacks.onItemClick=(e,t)=>{this.emit(`click`,{item:e,event:t})})}off(e,t){this.eventListeners.get(e)?.delete(t)}emit(e,t){let n=this.eventListeners.get(e);if(n)for(let e of n)e(t)}onMultiRowCreate(e){this.callbacks.onMultiRowCreate=e}onAdd(e){this.callbacks.onAdd=e}onMove(e){this.callbacks.onMove=e}onMoving(e){this.callbacks.onMoving=e}onDayClick(e){this.timeAxis.onDayClick=e}getContentElement(){return this.layout.getContentArea()}setDailyBounds(e,t){this.scale.setDailyBounds(e,t),this.renderAll()}clearDailyBounds(){this.scale.clearDailyBounds(),this.renderAll()}setVisibleDays(e){this.scale.setVisibleDays(e),this.renderAll()}clearVisibleDays(){this.scale.clearVisibleDays(),this.renderAll()}beginBatchUpdate(){this._batchUpdating=!0}endBatchUpdate(){this._batchUpdating=!1,this.renderAll()}renderAll(){if(this._batchUpdating)return;this.timeAxis.render(),this.layout.render(),this.renderer.render();let e=this.layout.getContentArea(),t=this.layout.getGroupCount()*(this.options.rowHeight??40);this.timeAxis.renderGridlines(e,t)}destroy(){this.interaction.detach(),this.resizeObserver?.disconnect(),this.timeAxis.destroy(),this.layout.destroy(),this.renderer.destroy(),this.rootEl.remove(),this.eventListeners.clear()}},{BLOCK_TYPES:SO}=t.temporal,CO=class{constructor(e,t){this.timeline=null,this.unsubscribe=null,this.currentItems=new Map,this.isRendering=!1,this.popoverManager=nO(),this.viewState=new VT,this.currentDay=null,this.currentView=`day`,this.selectedCourts=new Set,this.visibleCourts=null,this.handleOnMove=e=>{let t=XT(e.id);if(!t)return!1;let n=YT(e.group),r=this.toLocalISO(e.start),i=this.toLocalISO(e.end),a=this.engine.moveBlock({blockId:t,newTimeRange:{start:r,end:i},newCourt:n||void 0});return a.conflicts.some(e=>e.severity===`ERROR`)?(this.showConflictDialog(a.conflicts),!1):(this.render(),!0)},this.handleOnMoving=e=>{this.popoverManager.destroy();let t=this.currentItems.get(e.id);if(t&&(t.isSegment||t.type===`background`))return null;let{start:n,end:r}=e,i=YT(e.group);if(i){let e=n.toISOString().slice(0,10),t=this.engine.getCourtAvailability(i,e),a=new Date(`${e}T${t.startTime}:00`),o=new Date(`${e}T${t.endTime}:00`);n<a&&(n=a),r>o&&(r=o)}return{start:n,end:r}},this.handleTimelineClick=e=>{let t=e.item;if(!t){this.popoverManager.destroy();return}let n=this.currentItems.get(t);if(!n){this.popoverManager.destroy();return}if(n.isSegment||n.type===`background`){this.popoverManager.destroy();return}if(this.popoverManager.isActiveFor(t)){this.popoverManager.destroy();return}let r=XT(t);if(!r)return;let i=(e.event?.target)?.closest?.(`.tg-item`)??this.config.container.querySelector(`[data-item-id="${t}"]`);if(i){let e=String(n.start).slice(0,10);this.popoverManager.showForEngineBlock(i,{itemId:t,blockId:r,engine:this.engine,day:e,onBlockChanged:()=>this.render()})}this.config.onBlockSelected&&this.config.onBlockSelected(r)},this.handleMultiRowCreate=e=>{let t=[];for(let n of e.groupIds){let e=YT(n);e&&t.push(e)}if(t.length===0)return;let n=this.toLocalISO(e.startTime),r=this.toLocalISO(e.endTime),i=this.engine.applyBlock({courts:t,timeRange:{start:n,end:r},type:SO.BLOCKED,reason:`New Block`});if(this.render(),i.applied.length>0){let e=i.applied[0].block.id,t=`block-${e}`,r=n.slice(0,10);setTimeout(()=>{let n=this.config.container.querySelector(`[data-item-id="${t}"]`);n&&this.popoverManager.showForEngineBlock(n,{itemId:t,blockId:e,engine:this.engine,day:r,onBlockChanged:()=>this.render()})},50)}this.config.onTimeRangeSelected&&this.config.onTimeRangeSelected({courts:t,start:n,end:r})},this.handleEngineEvent=e=>{switch(e.type){case`STATE_CHANGED`:case`BLOCKS_CHANGED`:this.render(),e.type===`BLOCKS_CHANGED`&&this.config.onBlocksChanged&&this.config.onBlocksChanged();break;case`CONFLICTS_CHANGED`:this.config.showConflicts&&this.render();break;case`AVAILABILITY_CHANGED`:this.updateTimelineWindow(),this.render();break}},this.engine=e,this.config={groupingMode:`BY_VENUE`,showConflicts:!0,showSegmentLabels:!1,colorScheme:HT,...t},this.initialize()}initialize(){if(this.config.initialDay)this.currentDay=this.config.initialDay;else{let e=this.engine.getActiveDays();this.currentDay=e.length>0?e[0]:t.tools.dateTime.extractDate(new Date().toISOString())}this.viewState.setSelectedDay(this.currentDay),this.config.initialView&&(this.currentView=this.config.initialView),this.unsubscribe=this.engine.subscribe(this.handleEngineEvent),this.ensureTimeline()}ensureTimeline(){this.timeline||setTimeout(()=>{this.timeline||this.createTimelineWithData()},0)}getViewDays(){if(!this.currentDay)return[];let e=rO[this.currentView],t=e?e.days:1;if(t<=0)return this.engine.getActiveDays();if(t<=1)return[this.currentDay];let n=this.engine.getActiveDays(),r=n.indexOf(this.currentDay);return r===-1?[this.currentDay]:n.slice(r,r+t)}buildViewData(){if(!this.currentDay)return{groups:[],items:[]};let e=this.getViewDays(),t=this.engine.listCourtMeta(),n=this.viewState.getLayerVisibility(),r={groupingMode:this.config.groupingMode,layerVisibility:n,showSegmentLabels:this.config.showSegmentLabels,colorScheme:this.config.colorScheme},i=UT(this.engine.getDayTimeline(e[0]),t,r);this.visibleCourts!==null&&this.visibleCourts.size>0&&(i=i.filter(e=>this.visibleCourts.has(String(e.id))));let a=this.visibleCourts!==null&&this.visibleCourts.size>0&&i.length>0?new Set(i.map(e=>String(e.id))):null,o=e.length<=1?this.engine.getActiveDays():e,s=[],c=[];for(let e of o){let t=this.engine.getDayTimeline(e);s.push(...WT(t,r)),c.push(...KT(this.engine.getDayBlocks(e),r))}let l=a?s.filter(e=>a.has(String(e.group))):s,u=a?c.filter(e=>a.has(String(e.group))):c,d=[...l,...u];return{groups:i.map((e,t)=>({id:String(e.id),content:typeof e.content==`string`?e.content:``,order:t,courtRef:e.courtRef,surface:e.surface,indoor:e.indoor,hasLights:e.hasLights,tags:e.tags})),items:d.map(e=>({id:String(e.id),group:String(e.group),content:e.content,start:e.start,end:e.end,type:e.type===`background`?`background`:`range`,className:e.className,style:e.style,title:e.title,editable:e.editable,blockId:e.blockId,status:e.status,reason:e.reason,isBlock:e.isBlock,isSegment:e.isSegment,isConflict:e.isConflict}))}}createTimelineWithData(){let e=this.engine.getConfig(),n=this.currentDay||t.tools.dateTime.extractDate(new Date().toISOString()),r=this.getViewDays(),i=r[0]||n,a=r[r.length-1]||n,o=this.engine.getVisibleTimeRange(i),s=this.engine.getVisibleTimeRange(a),c=ZT({dayStartTime:o.startTime,dayEndTime:o.endTime,slotMinutes:e.slotMinutes,day:i}),l=rO[this.currentView],u=r.length>1?new Date(`${a}T${s.endTime}:00`):c.end,d=this.engine.getActiveDays(),f=d[0]||i,p=d[d.length-1]||a,m=this.engine.getVisibleTimeRange(f),h=this.engine.getVisibleTimeRange(p),g=new Date(`${f}T${m.startTime}:00`),_=new Date(`${p}T${h.endTime}:00`),{groups:v,items:y}=this.buildViewData();this.currentItems.clear();for(let e of y)this.currentItems.set(e.id,e);this.timeline=new xO(this.config.container,y,v,{start:c.start,end:u,min:g,max:_,zoomMin:c.zoomMin,zoomMax:_.getTime()-g.getTime(),snap:e=>this.snapToMinutes(e,5),rowHeight:40,height:`100%`,timeAxis:l?l.timeAxis:{scale:`hour`,step:1},showTooltips:!0}),this.timeline.setDailyBounds(o.startTime,o.endTime),r.length>1&&this.timeline.setVisibleDays(r),this.timeline.on(`click`,this.handleTimelineClick),this.timeline.onMove(this.handleOnMove),this.timeline.onMoving(this.handleOnMoving),this.timeline.onMultiRowCreate(this.handleMultiRowCreate),this.timeline.onDayClick(e=>{this.setDay(e),this.setViewPreset(`day`),this.config.onDayNavigate?.(e)}),this.config.onBlocksChanged?.()}setDay(e){this.currentDay!==e&&(this.currentDay=e,this.viewState.setSelectedDay(e),this.updateTimelineWindow(),this.render())}getDay(){return this.currentDay}setView(e){this.currentView=e,this.updateTimelineWindow()}setViewPreset(e){let t=rO[e];if(!t||!this.timeline||!this.currentDay)return;this.currentView=e;let n=this.getViewDays(),r=n[0],i=n[n.length-1],a=this.engine.getVisibleTimeRange(r),o=this.engine.getVisibleTimeRange(i);this.timeline.beginBatchUpdate();let s=t.days===0||t.days>1;this.timeline.setDailyBounds(a.startTime,a.endTime),s?this.timeline.setVisibleDays(n):this.timeline.clearVisibleDays();let c=new Date(`${r}T${a.startTime}:00`),l=new Date(`${i}T${o.endTime}:00`);this.timeline.setWindow(c,l,{animation:!1}),this.timeline.setOptions({timeAxis:t.timeAxis});let{groups:u,items:d}=this.buildViewData();this.currentItems.clear();for(let e of d)this.currentItems.set(e.id,e);this.timeline.setGroups(u),this.timeline.setItems(d),this.timeline.endBatchUpdate(),this.config.onBlocksChanged?.()}setSelectedCourts(e){this.selectedCourts=new Set(e)}getSelectedCourts(){return Array.from(this.selectedCourts)}setVisibleCourts(e){e&&e.size===0?this.visibleCourts=null:this.visibleCourts=e,this.render()}setLayerVisibility(e,t){this.viewState.setLayerVisibility(e,t),this.render()}refresh(){this.updateTimelineWindow(),this.render()}destroy(){this.popoverManager.destroy(),this.unsubscribe&&this.unsubscribe(),this.timeline&&=(this.timeline.destroy(),null)}updateTimelineWindow(){if(!this.timeline||!this.currentDay)return;let e=this.engine.getConfig(),t=this.getViewDays(),n=t[0]||this.currentDay,r=t[t.length-1]||this.currentDay,i=this.engine.getVisibleTimeRange(n),a=this.engine.getVisibleTimeRange(r),o=ZT({dayStartTime:i.startTime,dayEndTime:i.endTime,slotMinutes:e.slotMinutes,day:n}),s=rO[this.currentView],c=t.length>1?new Date(`${r}T${a.endTime}:00`):o.end,l=this.engine.getActiveDays(),u=l[0]||n,d=l[l.length-1]||r,f=this.engine.getVisibleTimeRange(u),p=this.engine.getVisibleTimeRange(d),m=new Date(`${u}T${f.startTime}:00`),h=new Date(`${d}T${p.endTime}:00`);this.timeline.beginBatchUpdate(),this.timeline.setDailyBounds(i.startTime,i.endTime),t.length>1?this.timeline.setVisibleDays(t):this.timeline.clearVisibleDays(),this.timeline.setOptions({min:m,max:h}),this.timeline.setWindow(o.start,c,{animation:!1}),s&&this.timeline.setOptions({timeAxis:s.timeAxis}),this.timeline.endBatchUpdate()}render(){if(this.currentDay&&!this.isRendering){if(!this.timeline){this.ensureTimeline();return}this.isRendering=!0;try{let{groups:e,items:t}=this.buildViewData();this.currentItems.clear();for(let e of t)this.currentItems.set(e.id,e);this.timeline.setGroups(e),this.timeline.setItems(t)}finally{this.isRendering=!1}}}getPopoverManager(){return this.popoverManager}snapToMinutes(e,t){let n=e.getTime(),r=t*60*1e3,i=Math.round(n/r)*r;return new Date(i)}toLocalISO(e){let t=e=>e.toString().padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}showConflictDialog(e){let t=e.filter(e=>e.severity===`ERROR`).map(e=>e.message).join(`
246
+ `,l.addEventListener(`mouseenter`,()=>{l.style.background=$D,l.style.color=eO}),l.addEventListener(`mouseleave`,()=>{l.style.background=`transparent`,l.style.color=``}),l.addEventListener(`click`,()=>{let o=r.getDayBlocks(i).find(e=>e.id===t);o&&(r.removeBlock(t),r.applyBlock({courts:[o.court],timeRange:{start:o.start,end:o.end},type:e,reason:s}),a()),n()}),o.appendChild(l)}let s=document.createElement(`div`);s.style.cssText=`border-top:1px solid var(--chc-border-primary); margin:4px 0;`,o.appendChild(s);let c=document.createElement(`div`);c.style.cssText=QD,c.innerHTML=`<span style="font-size:14px;">&#128339;</span> Adjust Time`,c.addEventListener(`mouseenter`,()=>{c.style.background=$D,c.style.color=eO}),c.addEventListener(`mouseleave`,()=>{c.style.background=`transparent`,c.style.color=``}),c.addEventListener(`click`,()=>{n();let e=r.getDayBlocks(i).find(e=>e.id===t);e&&XD({startTime:e.start,endTime:e.end,dayStartTime:`06:00`,dayEndTime:`22:00`,minuteIncrement:5,onConfirm:(n,i)=>{let o=e.start.slice(0,10);r.resizeBlock({blockId:t,newTimeRange:{start:`${o}T${n}:00`,end:`${o}T${i}:00`}}),a()},onCancel:()=>{}})}),o.appendChild(c);let l=document.createElement(`div`);return l.style.cssText=`padding:6px 12px; cursor:pointer; display:flex; align-items:center; gap:8px; color:#e74c3c;`,l.innerHTML=`<span style="font-size:14px;">&#128465;</span> Delete`,l.addEventListener(`mouseenter`,()=>{l.style.background=`#fdecea`}),l.addEventListener(`mouseleave`,()=>{l.style.background=`transparent`}),l.addEventListener(`click`,()=>{r.removeBlock(t),a(),n()}),o.appendChild(l),o}function a(r,i,a){n();let o=mm(r,{content:i,allowHTML:!0,interactive:!0,trigger:`manual`,placement:`bottom`,appendTo:document.body,onHidden:()=>{e=null,t=null}});e=o,t=a,o.show()}return{show(e,i){if(t===i.itemId){n();return}a(e,r(i),i.itemId)},showForEngineBlock(e,r){if(t===r.itemId){n();return}a(e,i(r),r.itemId)},destroy(){n()},isActiveFor(e){return t===e}}}var rO={day:{label:`1 Day`,days:1,timeAxis:{scale:`hour`,step:1}},days3:{label:`3 Days`,days:3,timeAxis:{scale:`hour`,step:3}},week:{label:`Week`,days:7,timeAxis:{scale:`hour`,step:6}},all:{label:`Tournament`,days:0,timeAxis:{scale:`hour`,step:6}}};function iO(e,t,n,r){let i=r?.labels,a=document.createElement(`div`);a.className=`tg-view-toolbar`;let o=document.createElement(`span`);o.textContent=(i?.view??`View`)+`:`,o.className=`tg-view-toolbar-label`,a.appendChild(o);let s=document.createElement(`input`);s.type=`text`,s.readOnly=!0,s.className=`tg-view-toolbar-date`,n&&s.addEventListener(`changeDate`,()=>{let e=s.value;e&&n(e)}),a.appendChild(s);let c={day:i?.day1??`1 Day`,days3:i?.days3??`3 Days`,week:i?.week??`Week`,all:i?.tournament??`Tournament`},l=[],u=[],d=t||`day`,f=e=>{l.forEach((t,n)=>{u[n]===e?t.className=`sp-btn sp-btn--active`:t.className=`sp-btn`})};for(let[t]of Object.entries(rO)){let n=document.createElement(`button`);n.textContent=c[t],n.className=t===d?`sp-btn sp-btn--active`:`sp-btn`,n.addEventListener(`click`,()=>{f(t),e(t)}),l.push(n),u.push(t),a.appendChild(n)}if(r?.onSetDefaultAvailability||r?.onSave){let e=document.createElement(`div`);e.className=`tg-view-toolbar-spacer`,a.appendChild(e)}if(r?.onSetDefaultAvailability){let e=document.createElement(`button`);e.textContent=i?.setDefaultAvailability??`Set Default Availability`,e.className=`sp-btn sp-btn--fill-muted`,e.addEventListener(`click`,r.onSetDefaultAvailability),a.appendChild(e)}let p=null;return r?.onSave&&(p=document.createElement(`button`),p.textContent=i?.saveToTournament??`Save to Tournament`,p.className=`sp-btn sp-btn--fill`,p.disabled=!0,p.addEventListener(`click`,r.onSave),a.appendChild(p)),{element:a,dateInput:s,setActiveView:f,setDate:e=>{s.value=e},setSaveEnabled:e=>{p&&(p.disabled=!e)}}}var aO=class{constructor(e,t,n){this._dailyStartMin=0,this._dailyEndMin=1440,this._useDailyBounds=!1,this._visibleDays=null,this._visibleDayMs=null,this._start=e.getTime(),this._end=t.getTime(),this._width=Math.max(n,1),this._min=this._start,this._max=this._end,this._zoomMin=900*1e3,this._zoomMax=(this._end-this._start)*2}get start(){return new Date(this._start)}get end(){return new Date(this._end)}get width(){return this._width}get duration(){return this._end-this._start}get msPerPx(){if(!this._useDailyBounds)return this.duration/this._width;let e=this.toCollapsedMin(new Date(this._start)),t=this.toCollapsedMin(new Date(this._end))-e;return t<=0?1:t*60*1e3/this._width}getDailyBounds(){return this._useDailyBounds?{startMin:this._dailyStartMin,endMin:this._dailyEndMin}:null}getVisibleDays(){return this._visibleDays}timeToX(e){if(!this._useDailyBounds)return(e.getTime()-this._start)/this.duration*this._width;let t=this.toCollapsedMin(e),n=this.toCollapsedMin(new Date(this._start)),r=this.toCollapsedMin(new Date(this._end))-n;return r<=0?0:(t-n)/r*this._width}xToTime(e){if(!this._useDailyBounds){let t=e/this._width*this.duration;return new Date(this._start+t)}let t=this.toCollapsedMin(new Date(this._start)),n=this.toCollapsedMin(new Date(this._end))-t;if(n<=0)return new Date(this._start);let r=t+e/this._width*n;return this.fromCollapsedMin(r)}snap(e,t){let n=e.getTime(),r=t*60*1e3;return new Date(Math.round(n/r)*r)}setWindow(e,t){this._start=e.getTime(),this._end=t.getTime(),this.clampBounds()}setLimits(e){e.min!==void 0&&(this._min=e.min.getTime()),e.max!==void 0&&(this._max=e.max.getTime()),e.zoomMin!==void 0&&(this._zoomMin=e.zoomMin),e.zoomMax!==void 0&&(this._zoomMax=e.zoomMax)}setWidth(e){this._width=Math.max(e,1)}setDailyBounds(e,t){let[n,r]=e.split(`:`).map(Number),[i,a]=t.split(`:`).map(Number);this._dailyStartMin=n*60+r,this._dailyEndMin=i*60+a,this._useDailyBounds=!0}clearDailyBounds(){this._useDailyBounds=!1,this._dailyStartMin=0,this._dailyEndMin=1440,this._visibleDays=null,this._visibleDayMs=null}setVisibleDays(e){this._visibleDays=e,this._visibleDayMs=e.map(e=>new Date(e+`T00:00:00`).getTime())}clearVisibleDays(){this._visibleDays=null,this._visibleDayMs=null}pan(e){if(this._visibleDays)return;if(this._useDailyBounds){let t=this.toCollapsedMin(new Date(this._start)),n=this.toCollapsedMin(new Date(this._end)),r=n-t;if(r<=0)return;let i=e/this._width*r,a=this.fromCollapsedMin(t+i),o=this.fromCollapsedMin(n+i);this._start=a.getTime(),this._end=o.getTime(),this.clampBounds();return}let t=e*this.msPerPx,n=this._start+t,r=this._end+t;if(n<this._min){let e=this._min-n;n+=e,r+=e}if(r>this._max){let e=r-this._max;n-=e,r-=e}this._start=n,this._end=r}zoom(e,t){if(this._visibleDays)return;if(this._useDailyBounds){let n=this.toCollapsedMin(new Date(this._start)),r=this.toCollapsedMin(new Date(this._end))-n,i=n+t/this._width*r,a=r*e,o=this._zoomMin/(60*1e3),s=this._zoomMax/(60*1e3);a=Math.max(o,Math.min(s,a));let c=t/this._width,l=this.fromCollapsedMin(i-a*c),u=this.fromCollapsedMin(i+a*(1-c));this._start=l.getTime(),this._end=u.getTime(),this.clampBounds();return}let n=this._start+t/this._width*this.duration,r=this.duration*e;r=Math.max(this._zoomMin,Math.min(this._zoomMax,r));let i=t/this._width;this._start=n-r*i,this._end=n+r*(1-i),this.clampBounds()}toCollapsedMin(e){let t=this._dailyEndMin-this._dailyStartMin;if(t<=0)return 0;let n=e.getHours()*60+e.getMinutes()+e.getSeconds()/60,r=Math.max(this._dailyStartMin,Math.min(this._dailyEndMin,n))-this._dailyStartMin;if(this._visibleDays&&this._visibleDayMs){let n=new Date(e);n.setHours(0,0,0,0);let i=n.getTime(),a=-1;for(let e=0;e<this._visibleDayMs.length;e++)if(this._visibleDayMs[e]===i){a=e;break}if(a===-1){if(i<this._visibleDayMs[0])return 0;if(i>this._visibleDayMs[this._visibleDayMs.length-1])return this._visibleDayMs.length*t;for(let e=0;e<this._visibleDayMs.length-1;e++)if(i>this._visibleDayMs[e]&&i<this._visibleDayMs[e+1])return(e+1)*t;return 0}return a*t+r}let i=new Date(this._start);i.setHours(0,0,0,0);let a=new Date(e);return a.setHours(0,0,0,0),Math.round((a.getTime()-i.getTime())/(1440*60*1e3))*t+r}fromCollapsedMin(e){let t=this._dailyEndMin-this._dailyStartMin;if(t<=0)return new Date(this._start);let n=Math.floor(e/t),r=e-n*t;if(this._visibleDays&&this._visibleDayMs){let e=Math.max(0,Math.min(n,this._visibleDayMs.length-1)),t=new Date(this._visibleDayMs[e]),i=this._dailyStartMin+r;return t.setHours(Math.floor(i/60),Math.round(i%60),0,0),t}let i=new Date(this._start);i.setHours(0,0,0,0);let a=new Date(i);a.setDate(a.getDate()+n);let o=this._dailyStartMin+r;return a.setHours(Math.floor(o/60),Math.round(o%60),0,0),a}clampBounds(){let e=this._end-this._start;this._start<this._min&&(this._start=this._min,this._end=this._min+e),this._end>this._max&&(this._end=this._max,this._start=this._max-e),this._start<this._min&&(this._start=this._min),this._end>this._max&&(this._end=this._max)}},oO=`tg-tick-day`,sO=`tg-tick-hour`,cO=class{constructor(e,t){this.scale=e,this.tickConfig=lO(t),this.dayEl=document.createElement(`div`),this.dayEl.className=`tg-day-axis`,this.dayEl.setAttribute(`role`,`presentation`),this.hourEl=document.createElement(`div`),this.hourEl.className=`tg-hour-axis`,this.hourEl.setAttribute(`role`,`presentation`),this.dayEl.addEventListener(`click`,e=>{let t=(e.target.closest?.(`.${oO}`))?.dataset.day;t&&this.onDayClick&&this.onDayClick(t)})}getDayElement(){return this.dayEl}getHourElement(){return this.hourEl}setTimeAxisOptions(e){this.tickConfig=lO(e)}render(){this.renderDayLabels(),this.renderHourTicks()}renderDayLabels(){this.dayEl.innerHTML=``;let{dayFormat:e}=this.tickConfig,t=this.tickConfig.scale,n=this.scale.getDailyBounds();if(n&&t===`hour`){this.renderDayLabelsWithBounds(n,e);return}if(t===`hour`){let t=this.scale.start.getTime(),n=dO(t,this.scale.end.getTime());if(n.length===0){let n=new Date(t);n.setHours(0,0,0,0);let r=document.createElement(`div`);r.className=oO,r.style.left=`0px`,r.style.maxWidth=`${this.scale.width}px`,r.dataset.day=uO(n),r.textContent=e.format(n),this.dayEl.appendChild(r);return}for(let t of n){let n=this.scale.timeToX(t),r=document.createElement(`div`);r.className=oO,r.style.left=`${n}px`,r.dataset.day=uO(t),r.textContent=e.format(t),this.dayEl.appendChild(r)}}else if(t===`day`){let e=pO(this.scale.start.getTime(),this.scale.end.getTime());for(let t of e){let e=this.scale.timeToX(t),n=document.createElement(`div`);n.className=oO,n.style.left=`${e}px`,n.dataset.day=uO(t),n.textContent=this.tickConfig.dayFormat.format(t),this.dayEl.appendChild(n)}}}renderDayLabelsWithBounds(e,t){let n=this.getVisibleDayDates(e),r=this.scale.getVisibleDays(),i=n.length,a=i>0?this.scale.width/i:this.scale.width,o=a<150?new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`}):t;if(r&&r.length>0)for(let t of n){let n=new Date(t);n.setHours(0,0,0,0),n.setMinutes(e.startMin);let r=this.scale.timeToX(n),i=document.createElement(`div`);i.className=oO,i.style.left=`${r}px`,i.style.maxWidth=`${Math.floor(a)-4}px`,i.dataset.day=uO(t),i.textContent=o.format(n),this.dayEl.appendChild(i)}else{let t=this.scale.width;for(let r of n){let n=new Date(r);n.setHours(0,0,0,0),n.setMinutes(e.startMin);let i=new Date(r);i.setHours(0,0,0,0),i.setDate(i.getDate()+1),i.setMinutes(e.startMin);let a=this.scale.timeToX(n),s=this.scale.timeToX(i),c=Math.max(a,0),l=Math.min(s,t)-c;if(l<=0)continue;let u=document.createElement(`div`);u.className=oO,u.style.left=`${c}px`,u.style.maxWidth=`${l}px`,u.dataset.day=uO(r),u.textContent=o.format(n),this.dayEl.appendChild(u)}}}renderHourTicks(){this.hourEl.innerHTML=``;let{hourFormat:e}=this.tickConfig,t=this.tickConfig.scale,n=this.tickConfig.step,r=this.scale.getDailyBounds();if(r&&t===`hour`){this.renderHourTicksWithBounds(r,n,e);return}let i=this.scale.start.getTime(),a=this.scale.end.getTime();if(t===`hour`){let t=new Set(dO(i,a).map(e=>e.getTime())),r=fO(i,a,n);for(let n of r){if(t.has(n.getTime()))continue;let r=this.scale.timeToX(n),i=document.createElement(`div`);i.className=sO,i.style.left=`${r}px`,i.textContent=e.format(n),this.hourEl.appendChild(i)}}else if(t===`day`){let e=new Set(pO(i,a).map(e=>e.getTime())),t=dO(i,a);for(let n of t){if(e.has(n.getTime()))continue;let t=this.scale.timeToX(n),r=document.createElement(`div`);r.className=sO,r.style.left=`${t}px`,r.textContent=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`}).format(n),this.hourEl.appendChild(r)}}}renderHourTicksWithBounds(e,t,n){let r=this.getVisibleDayDates(e);for(let i of r){let r=new Date(i);r.setHours(0,0,0,0),r.setMinutes(e.startMin);let a=new Date(i);a.setHours(0,0,0,0),a.setMinutes(e.endMin);let o=Math.ceil(e.startMin/60),s=new Date(i);for(s.setHours(o,0,0,0),s.getHours()%t!==0&&s.setHours(s.getHours()+(t-s.getHours()%t));s.getTime()<=a.getTime();){if(s.getTime()!==r.getTime()){let e=this.scale.timeToX(s),t=document.createElement(`div`);t.className=sO,t.style.left=`${e}px`,t.textContent=n.format(s),this.hourEl.appendChild(t)}s.setHours(s.getHours()+t)}}}getVisibleDayDates(e){let t=this.scale.getVisibleDays();if(t&&t.length>0)return t.map(e=>new Date(e+`T00:00:00`));let n=this.scale.start.getTime(),r=this.scale.end.getTime(),i=[],a=new Date(n);for(a.setHours(0,0,0,0);;){let t=new Date(a);if(t.setHours(0,0,0,0),t.setMinutes(e.endMin),t.getTime()<n){a.setDate(a.getDate()+1);continue}let o=new Date(a);if(o.setHours(0,0,0,0),o.setMinutes(e.startMin),o.getTime()>r)break;i.push(new Date(a)),a.setDate(a.getDate()+1)}return i}renderGridlines(e,t){e.querySelectorAll(`.tg-gridline`).forEach(e=>e.remove());let n=this.computeTickPositions();for(let{x:r,isMajor:i}of n){let n=document.createElement(`div`);n.className=i?`tg-gridline tg-gridline-major`:`tg-gridline`,n.style.left=`${r}px`,n.style.height=`${t}px`,e.appendChild(n)}}computeTickPositions(){let e=[],t=this.tickConfig.scale,n=this.tickConfig.step,r=this.scale.getDailyBounds(),i=this.scale.start.getTime(),a=this.scale.end.getTime();if(r&&t===`hour`){let t=this.getVisibleDayDates(r);for(let i of t){let t=new Date(i);t.setHours(0,0,0,0),t.setMinutes(r.startMin);let a=new Date(i);a.setHours(0,0,0,0),a.setMinutes(r.endMin),e.push({x:this.scale.timeToX(t),isMajor:!0});let o=Math.ceil(r.startMin/60),s=new Date(i);for(s.setHours(o,0,0,0),s.getHours()%n!==0&&s.setHours(s.getHours()+(n-s.getHours()%n));s.getTime()<=a.getTime();)s.getTime()!==t.getTime()&&e.push({x:this.scale.timeToX(s),isMajor:!1}),s.setHours(s.getHours()+n)}}else if(t===`hour`){let t=dO(i,a),r=new Set(t.map(e=>e.getTime()));for(let n of t)e.push({x:this.scale.timeToX(n),isMajor:!0});for(let t of fO(i,a,n))r.has(t.getTime())||e.push({x:this.scale.timeToX(t),isMajor:!1})}else if(t===`day`){let t=pO(i,a),n=new Set(t.map(e=>e.getTime()));for(let n of t)e.push({x:this.scale.timeToX(n),isMajor:!0});for(let t of dO(i,a))n.has(t.getTime())||e.push({x:this.scale.timeToX(t),isMajor:!1})}return e}destroy(){this.dayEl.remove(),this.hourEl.remove()}};function lO(e){let t=e?.scale??`hour`,n=e?.step??1;switch(t){case`hour`:return{scale:t,step:n,hourFormat:new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),dayFormat:new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`})};case`day`:return{scale:t,step:n,hourFormat:new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`}),dayFormat:new Intl.DateTimeFormat(void 0,{month:`long`,year:`numeric`})};default:return{scale:`hour`,step:1,hourFormat:new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),dayFormat:new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`})}}}function uO(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function dO(e,t){let n=[],r=new Date(e);for(r.setHours(0,0,0,0);r.getTime()<=t;)r.getTime()>=e&&n.push(new Date(r)),r.setDate(r.getDate()+1);return n}function fO(e,t,n){let r=[],i=new Date(e);i.setMinutes(0,0,0);let a=i.getHours();for(i.setHours(a-a%n);i.getTime()<=t;)i.getTime()>=e&&r.push(new Date(i)),i.setHours(i.getHours()+n);return r}function pO(e,t){let n=[],r=new Date(e);r.setHours(0,0,0,0);let i=r.getDay(),a=i===0?6:i-1;for(r.setDate(r.getDate()-a);r.getTime()<=t;)r.getTime()>=e&&n.push(new Date(r)),r.setDate(r.getDate()+7);return n}var mO=class{constructor(e=40){this.groups=[],this.groupIndex=new Map,this.rowHeight=e,this.labelPanel=document.createElement(`div`),this.labelPanel.className=`tg-label-panel`,this.labelPanel.setAttribute(`role`,`rowheader`),this.contentArea=document.createElement(`div`),this.contentArea.className=`tg-content`,this.contentArea.setAttribute(`role`,`grid`)}getLabelPanel(){return this.labelPanel}getContentArea(){return this.contentArea}getRowHeight(){return this.rowHeight}getGroups(){return this.groups}getGroupCount(){return this.groups.length}getGroupAtIndex(e){return this.groups[e]}yToGroupId(e){let t=Math.floor(e/this.rowHeight);return t<0||t>=this.groups.length?null:this.groups[t].id}groupIdToRowIndex(e){return this.groupIndex.get(e)??-1}getRowRange(e,t){let n=Math.max(0,Math.floor(Math.min(e,t)/this.rowHeight)),r=Math.min(this.groups.length-1,Math.floor(Math.max(e,t)/this.rowHeight)),i=[];for(let e=n;e<=r;e++)i.push(this.groups[e].id);return i}getRowTop(e){return e*this.rowHeight}setGroups(e){this.groups=e.slice().sort((e,t)=>e.order!==void 0&&t.order!==void 0?e.order-t.order:e.order===void 0?t.order===void 0?e.content.localeCompare(t.content,void 0,{numeric:!0}):1:-1),this.groupIndex.clear();for(let e=0;e<this.groups.length;e++)this.groupIndex.set(this.groups[e].id,e)}render(){this.renderLabels(),this.renderRows()}renderLabels(){this.labelPanel.innerHTML=``;for(let e of this.groups){let t=document.createElement(`div`);t.className=`tg-label`,t.style.height=`${this.rowHeight}px`,t.textContent=e.content,t.title=e.content,t.dataset.groupId=e.id,this.labelPanel.appendChild(t)}}renderRows(){this.contentArea.querySelectorAll(`.tg-row`).forEach(e=>e.remove());for(let e=0;e<this.groups.length;e++){let t=document.createElement(`div`);t.className=`tg-row`,t.style.height=`${this.rowHeight}px`,t.style.top=`${e*this.rowHeight}px`,t.dataset.groupId=this.groups[e].id,this.contentArea.appendChild(t)}this.contentArea.style.height=`${this.groups.length*this.rowHeight}px`}destroy(){this.labelPanel.remove(),this.contentArea.remove()}},hO=class{constructor(e,t){this.items=[],this.itemElements=new Map,this.ghostEl=null,this.ghostCountBadge=null,this.scale=e,this.layout=t,this.contentArea=t.getContentArea()}setItems(e){this.items=e}render(){for(let e of this.itemElements.values())e.remove();this.itemElements.clear(),this.contentArea.querySelectorAll(`[data-item-id]`).forEach(e=>{e.dataset.itemId!==`__ghost__`&&e.remove()});for(let e of this.items){let t=this.renderItem(e);t&&(this.contentArea.appendChild(t),this.itemElements.set(e.id,t))}}renderItem(e){let t=this.layout.groupIdToRowIndex(e.group);if(t===-1)return null;let n=e.start instanceof Date?e.start:new Date(e.start),r=e.end?e.end instanceof Date?e.end:new Date(e.end):n,i=this.scale.timeToX(n),a=this.scale.timeToX(r)-i,o=this.layout.getRowTop(t),s=this.layout.getRowHeight();if(a<.5)return null;let c=document.createElement(`div`);if(c.dataset.itemId=e.id,c.title=e.title||e.content,e.type===`background`||e.isSegment)c.className=`tg-item-background ${e.className||``}`.trim(),e.style&&(c.style.cssText=e.style),c.style.position=`absolute`,c.style.left=`${i}px`,c.style.top=`${o}px`,c.style.width=`${a}px`,c.style.height=`${s}px`,c.style.pointerEvents=`none`;else{c.className=`tg-item tg-item-range ${e.className||``}`.trim(),e.style&&(c.style.cssText+=e.style),c.style.position=`absolute`,c.style.left=`${i}px`,c.style.top=`${o+2}px`,c.style.width=`${a}px`,c.style.height=`${s-4}px`,c.style.cursor=`move`;let t=document.createElement(`span`);t.className=`tg-item-content`,t.textContent=e.content,c.appendChild(t);let n=document.createElement(`div`);n.className=`tg-resize-handle tg-resize-left`,n.dataset.handle=`left`,c.appendChild(n);let r=document.createElement(`div`);r.className=`tg-resize-handle tg-resize-right`,r.dataset.handle=`right`,c.appendChild(r)}return c}updateItemPosition(e,t,n,r){let i=this.itemElements.get(e);i&&(i.style.left=`${t}px`,i.style.top=`${n+2}px`,i.style.width=`${r}px`)}showGhost(e){if(!this.ghostEl){this.ghostEl=document.createElement(`div`),this.ghostEl.className=`tg-ghost`,this.ghostEl.dataset.itemId=`__ghost__`;for(let e of[`left`,`right`,`top`,`bottom`]){let t=document.createElement(`div`);t.className=`tg-resize-handle tg-resize-${e}`,t.dataset.handle=e,this.ghostEl.appendChild(t)}this.ghostCountBadge=document.createElement(`div`),this.ghostCountBadge.className=`tg-ghost-count`,this.ghostEl.appendChild(this.ghostCountBadge),this.contentArea.appendChild(this.ghostEl)}let t=this.scale.timeToX(e.startTime),n=this.scale.timeToX(e.endTime)-t,r=this.layout.getRowHeight(),i=e.topRowIndex*r,a=(e.bottomRowIndex-e.topRowIndex+1)*r,o=e.bottomRowIndex-e.topRowIndex+1;this.ghostEl.style.left=`${t}px`,this.ghostEl.style.top=`${i}px`,this.ghostEl.style.width=`${n}px`,this.ghostEl.style.height=`${a}px`,this.ghostEl.style.display=`block`,this.ghostCountBadge&&(this.ghostCountBadge.textContent=`${o} court${o>1?`s`:``}`,this.ghostCountBadge.style.display=o>1?`flex`:`none`)}clearGhost(){this.ghostEl&&(this.ghostEl.remove(),this.ghostEl=null,this.ghostCountBadge=null)}isGhostVisible(){return this.ghostEl!==null&&this.ghostEl.style.display!==`none`}highlightRows(e){this.clearHighlights();for(let t of e){let e=this.contentArea.querySelectorAll(`.tg-row`);e[t]&&e[t].classList.add(`tg-row-highlight`)}}clearHighlights(){this.contentArea.querySelectorAll(`.tg-row-highlight`).forEach(e=>{e.classList.remove(`tg-row-highlight`)})}static hitTest(e){if(!(e instanceof HTMLElement))return{itemId:null,handle:null};let t=e.closest(`.tg-resize-handle`)?.dataset.handle??null;return{itemId:e.closest(`[data-item-id]`)?.dataset.itemId??null,handle:t}}destroy(){this.clearGhost(),this.clearHighlights();for(let e of this.itemElements.values())e.remove();this.itemElements.clear()}},gO=3,_O=30,vO=8,yO=3600*1e3,bO=class{constructor(e,t,n,r,i=5,a=!1){this.mode=`IDLE`,this.gesture=null,this.items=[],this.ghostStartTime=null,this.ghostEndTime=null,this.ghostTopRow=0,this.ghostBottomRow=0,this.justDragged=!1,this.autoScrollRaf=null,this.autoScrollDelta=0,this.scrollContainer=null,this.onPointerDown=e=>{if(e.button!==0)return;let{itemId:t,handle:n}=hO.hitTest(e.target);if(this.mode===`GHOST_EDITING`){if(t===`__ghost__`&&n){this.startGesture(e,`__ghost__`,n===`left`?`RESIZING_LEFT`:n===`right`?`RESIZING_RIGHT`:n===`top`?`RESIZING_TOP`:`RESIZING_BOTTOM`);return}if(t===`__ghost__`&&!n){this.confirmGhost();return}this.cancelGhost();return}if(t)if(n===`left`)this.startGesture(e,t,`RESIZING_LEFT`);else if(n===`right`)this.startGesture(e,t,`RESIZING_RIGHT`);else{let n=this.items.find(e=>e.id===t);if(!n||n.isSegment||n.type===`background`)return;this.startGesture(e,t,`DRAGGING`)}},this.onPointerMove=e=>{if(this.gesture){if(this.gesture.currentX=e.clientX,this.gesture.currentY=e.clientY,!this.gesture.thresholdExceeded){let t=Math.abs(e.clientX-this.gesture.startX),n=Math.abs(e.clientY-this.gesture.startY);if(t<gO&&n<gO)return;this.gesture.thresholdExceeded=!0}switch(this.checkAutoScroll(e),this.mode){case`DRAGGING`:this.handleDragMove(e);break;case`RESIZING_LEFT`:case`RESIZING_RIGHT`:this.gesture.itemId===`__ghost__`?this.handleGhostTimeResize(e):this.handleResizeMove(e);break;case`RESIZING_TOP`:case`RESIZING_BOTTOM`:this.handleGhostRowResize(e);break}}},this.onPointerUp=e=>{if(document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp),this.stopAutoScroll(),!this.gesture){this.mode=`IDLE`;return}let t=this.gesture.itemId===`__ghost__`;if(!this.gesture.thresholdExceeded&&!t){this.gesture.itemId&&this.callbacks.onItemClick?.(this.gesture.itemId,e),this.gesture=null,this.mode=`IDLE`,this.renderer.clearHighlights();return}if(t){this.gesture=null,this.mode=`GHOST_EDITING`;return}if(this.gesture.itemId&&this.gesture.thresholdExceeded){this.justDragged=!0,setTimeout(()=>this.justDragged=!1,300);let t=(e.clientX-this.gesture.startX)*this.scale.msPerPx,n=this.gesture.originalEnd.getTime()-this.gesture.originalStart.getTime(),r,i,a=this.gesture.originalGroup;if(this.mode===`DRAGGING`){r=this.scale.snap(new Date(this.gesture.originalStart.getTime()+t),this.snapMinutes),i=new Date(r.getTime()+n);let o=this.contentArea.getBoundingClientRect(),s=e.clientY-o.top+this.contentArea.scrollTop;a=this.layout.yToGroupId(s)||this.gesture.originalGroup}else this.mode===`RESIZING_LEFT`?(r=this.scale.snap(new Date(this.gesture.originalStart.getTime()+t),this.snapMinutes),i=this.gesture.originalEnd,r>=i&&(r=new Date(i.getTime()-this.snapMinutes*60*1e3))):(r=this.gesture.originalStart,i=this.scale.snap(new Date(this.gesture.originalEnd.getTime()+t),this.snapMinutes),i<=r&&(i=new Date(r.getTime()+this.snapMinutes*60*1e3)));this.callbacks.onMove?.({id:this.gesture.itemId,group:a,start:r,end:i})}this.gesture=null,this.mode=`IDLE`,this.renderer.clearHighlights()},this.onDblClick=e=>{if(this.justDragged)return;let{itemId:t}=hO.hitTest(e.target);if(t)return;let n=this.contentArea.getBoundingClientRect(),r=e.clientX-n.left+this.contentArea.scrollLeft,i=e.clientY-n.top+this.contentArea.scrollTop,a=this.scale.xToTime(r),o=this.scale.snap(a,this.snapMinutes),s=new Date(o.getTime()+yO),c=this.layout.yToGroupId(i);if(!c)return;let l=this.layout.groupIdToRowIndex(c);l<0||(this.ghostStartTime=o,this.ghostEndTime=s,this.ghostTopRow=l,this.ghostBottomRow=l,this.mode=`GHOST_EDITING`,this.renderer.showGhost({startTime:o,endTime:s,topRowIndex:l,bottomRowIndex:l}),this.renderer.highlightRows([l]))},this.onWheel=e=>{if(!((e.ctrlKey||e.metaKey)&&!this.enablePinchZoom)){if(e.preventDefault(),(e.ctrlKey||e.metaKey)&&this.enablePinchZoom){let t=e.deltaY>0?1.15:.87,n=this.contentArea.getBoundingClientRect(),r=e.clientX-n.left;this.scale.zoom(t,r)}else if(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY)){let t=e.deltaX||e.deltaY;this.scale.pan(t)}else{this.scrollContainer&&(this.scrollContainer.scrollTop+=e.deltaY);return}this.onScaleChanged?.()}},this.onScaleChanged=null,this.onKeyDown=e=>{e.key===`Escape`&&this.mode===`GHOST_EDITING`&&this.cancelGhost()},this.scale=e,this.layout=t,this.renderer=n,this.contentArea=t.getContentArea(),this.wheelTarget=this.contentArea,this.callbacks=r,this.snapMinutes=i,this.enablePinchZoom=a}setItems(e){this.items=e}setScrollContainer(e){this.scrollContainer=e}setWheelTarget(e){this.wheelTarget=e}attach(){this.contentArea.addEventListener(`pointerdown`,this.onPointerDown),this.contentArea.addEventListener(`dblclick`,this.onDblClick),this.wheelTarget.addEventListener(`wheel`,this.onWheel,{passive:!1}),document.addEventListener(`keydown`,this.onKeyDown)}detach(){this.contentArea.removeEventListener(`pointerdown`,this.onPointerDown),this.contentArea.removeEventListener(`dblclick`,this.onDblClick),this.wheelTarget.removeEventListener(`wheel`,this.onWheel),document.removeEventListener(`keydown`,this.onKeyDown),document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp),this.stopAutoScroll()}getMode(){return this.mode}startGesture(e,t,n){e.preventDefault();let r=this.items.find(e=>e.id===t),i,a,o;if(t===`__ghost__`)i=this.ghostStartTime,a=this.ghostEndTime,o=``;else if(r)i=r.start instanceof Date?r.start:new Date(r.start),a=r.end?r.end instanceof Date?r.end:new Date(r.end):i,o=r.group;else return;this.gesture={mode:n,itemId:t,startX:e.clientX,startY:e.clientY,originalStart:i,originalEnd:a,originalGroup:o,currentX:e.clientX,currentY:e.clientY,thresholdExceeded:!1},this.mode=n,this.contentArea.setPointerCapture(e.pointerId),document.addEventListener(`pointermove`,this.onPointerMove),document.addEventListener(`pointerup`,this.onPointerUp)}handleDragMove(e){if(!this.gesture||!this.gesture.itemId)return;let t=(e.clientX-this.gesture.startX)*this.scale.msPerPx,n=this.gesture.originalEnd.getTime()-this.gesture.originalStart.getTime(),r=this.scale.snap(new Date(this.gesture.originalStart.getTime()+t),this.snapMinutes),i=new Date(r.getTime()+n),a=this.contentArea.getBoundingClientRect(),o=e.clientY-a.top+this.contentArea.scrollTop,s=this.layout.yToGroupId(o)||this.gesture.originalGroup;if(this.callbacks.onMoving){let e=this.callbacks.onMoving({id:this.gesture.itemId,group:s,start:r,end:i});if(e===null)return;r=e.start,i=e.end}let c=this.scale.timeToX(r),l=this.scale.timeToX(i)-c,u=this.layout.groupIdToRowIndex(s),d=this.layout.getRowTop(u>=0?u:0);this.renderer.updateItemPosition(this.gesture.itemId,c,d,l),u>=0&&this.renderer.highlightRows([u])}handleResizeMove(e){if(!this.gesture||!this.gesture.itemId)return;let t=(e.clientX-this.gesture.startX)*this.scale.msPerPx,n=this.gesture.originalStart,r=this.gesture.originalEnd;if(this.mode===`RESIZING_LEFT`?(n=this.scale.snap(new Date(this.gesture.originalStart.getTime()+t),this.snapMinutes),n>=r&&(n=new Date(r.getTime()-this.snapMinutes*60*1e3))):(r=this.scale.snap(new Date(this.gesture.originalEnd.getTime()+t),this.snapMinutes),r<=n&&(r=new Date(n.getTime()+this.snapMinutes*60*1e3))),this.callbacks.onMoving){let e=this.callbacks.onMoving({id:this.gesture.itemId,group:this.gesture.originalGroup,start:n,end:r});if(e===null)return;n=e.start,r=e.end}let i=this.scale.timeToX(n),a=this.scale.timeToX(r)-i,o=this.layout.groupIdToRowIndex(this.gesture.originalGroup),s=this.layout.getRowTop(o>=0?o:0);this.renderer.updateItemPosition(this.gesture.itemId,i,s,a)}handleGhostTimeResize(e){if(!this.gesture)return;let t=this.contentArea.getBoundingClientRect(),n=e.clientX-t.left+this.contentArea.scrollLeft,r=this.scale.snap(this.scale.xToTime(n),this.snapMinutes);this.mode===`RESIZING_LEFT`?r<this.ghostEndTime&&(this.ghostStartTime=r):r>this.ghostStartTime&&(this.ghostEndTime=r),this.updateGhostDisplay()}handleGhostRowResize(e){if(!this.gesture)return;let t=this.contentArea.getBoundingClientRect(),n=e.clientY-t.top+this.contentArea.scrollTop,r=Math.floor(n/this.layout.getRowHeight()),i=Math.max(0,Math.min(this.layout.getGroupCount()-1,r));this.mode===`RESIZING_TOP`?i<=this.ghostBottomRow&&(this.ghostTopRow=i):i>=this.ghostTopRow&&(this.ghostBottomRow=i),this.updateGhostDisplay()}updateGhostDisplay(){this.renderer.showGhost({startTime:this.ghostStartTime,endTime:this.ghostEndTime,topRowIndex:this.ghostTopRow,bottomRowIndex:this.ghostBottomRow});let e=[];for(let t=this.ghostTopRow;t<=this.ghostBottomRow;t++)e.push(t);this.renderer.highlightRows(e)}confirmGhost(){if(!this.ghostStartTime||!this.ghostEndTime){this.cancelGhost();return}let e=[];for(let t=this.ghostTopRow;t<=this.ghostBottomRow;t++){let n=this.layout.getGroupAtIndex(t);n&&e.push(n.id)}if(e.length===0){this.cancelGhost();return}let t={groupIds:e,topRowIndex:this.ghostTopRow,bottomRowIndex:this.ghostBottomRow,startTime:this.ghostStartTime,endTime:this.ghostEndTime};this.renderer.clearGhost(),this.renderer.clearHighlights(),this.mode=`IDLE`,this.callbacks.onMultiRowCreate?.(t),this.ghostStartTime=null,this.ghostEndTime=null}cancelGhost(){this.renderer.clearGhost(),this.renderer.clearHighlights(),this.mode=`IDLE`,this.ghostStartTime=null,this.ghostEndTime=null}checkAutoScroll(e){if(!this.scrollContainer)return;let t=this.scrollContainer.getBoundingClientRect(),n=t.bottom-e.clientY,r=e.clientY-t.top;n<_O?(this.autoScrollDelta=vO*(1-n/_O),this.startAutoScroll()):r<_O?(this.autoScrollDelta=-vO*(1-r/_O),this.startAutoScroll()):this.stopAutoScroll()}startAutoScroll(){if(this.autoScrollRaf!==null)return;let e=()=>{this.scrollContainer&&(this.scrollContainer.scrollTop+=this.autoScrollDelta,this.autoScrollRaf=requestAnimationFrame(e))};this.autoScrollRaf=requestAnimationFrame(e)}stopAutoScroll(){this.autoScrollRaf!==null&&(cancelAnimationFrame(this.autoScrollRaf),this.autoScrollRaf=null),this.autoScrollDelta=0}},xO=class{constructor(e,t,n,r={}){this.callbacks={},this.resizeObserver=null,this._batchUpdating=!1,this.eventListeners=new Map,this.options={rowHeight:40,...r};let i=new Date,a=r.start||i,o=r.end||new Date(i.getTime()+720*60*1e3),s=e.clientWidth||800;this.scale=new aO(a,o,s),(r.min||r.max||r.zoomMin||r.zoomMax)&&this.scale.setLimits({min:r.min,max:r.max,zoomMin:r.zoomMin,zoomMax:r.zoomMax}),this.timeAxis=new cO(this.scale,r.timeAxis),this.layout=new mO(this.options.rowHeight),this.renderer=new hO(this.scale,this.layout),this.interaction=new bO(this.scale,this.layout,this.renderer,this.callbacks,5,r.enablePinchZoom??!1),this.rootEl=document.createElement(`div`),this.rootEl.className=`tg-timeline`,r.height&&(this.rootEl.style.height=r.height);let c=document.createElement(`div`);c.className=`tg-axis-header`;let l=document.createElement(`div`);l.className=`tg-axis-spacer`,c.appendChild(l),c.appendChild(this.timeAxis.getDayElement()),c.appendChild(this.timeAxis.getHourElement()),this.rootEl.appendChild(c),this.bodyEl=document.createElement(`div`),this.bodyEl.className=`tg-body`,this.bodyEl.appendChild(this.layout.getLabelPanel());let u=document.createElement(`div`);u.className=`tg-scroll-wrapper`,u.appendChild(this.layout.getContentArea()),this.bodyEl.appendChild(u),this.rootEl.appendChild(this.bodyEl),e.appendChild(this.rootEl),u.addEventListener(`scroll`,()=>{this.layout.getLabelPanel().scrollTop=u.scrollTop}),this.interaction.setScrollContainer(u),this.interaction.setWheelTarget(this.rootEl),this.interaction.onScaleChanged=()=>this.renderAll(),this.layout.setGroups(n),this.renderer.setItems(t),this.interaction.setItems(t),this.interaction.attach(),this.renderAll(),this.resizeObserver=new ResizeObserver(()=>{let t=u.clientWidth||e.clientWidth;this.scale.setWidth(t),this.renderAll()}),this.resizeObserver.observe(u)}setGroups(e){this.layout.setGroups(e),this.renderAll()}setItems(e){this.renderer.setItems(e),this.interaction.setItems(e),this.renderAll()}setWindow(e,t,n){this.scale.setWindow(e,t),this.renderAll()}setOptions(e){(e.min!==void 0||e.max!==void 0||e.zoomMin!==void 0||e.zoomMax!==void 0)&&this.scale.setLimits({min:e.min,max:e.max,zoomMin:e.zoomMin,zoomMax:e.zoomMax}),e.timeAxis&&this.timeAxis.setTimeAxisOptions(e.timeAxis),e.rowHeight!==void 0&&(this.options.rowHeight=e.rowHeight),Object.assign(this.options,e),this.renderAll()}on(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t),e===`click`&&(this.callbacks.onItemClick=(e,t)=>{this.emit(`click`,{item:e,event:t})})}off(e,t){this.eventListeners.get(e)?.delete(t)}emit(e,t){let n=this.eventListeners.get(e);if(n)for(let e of n)e(t)}onMultiRowCreate(e){this.callbacks.onMultiRowCreate=e}onAdd(e){this.callbacks.onAdd=e}onMove(e){this.callbacks.onMove=e}onMoving(e){this.callbacks.onMoving=e}onDayClick(e){this.timeAxis.onDayClick=e}getContentElement(){return this.layout.getContentArea()}setDailyBounds(e,t){this.scale.setDailyBounds(e,t),this.renderAll()}clearDailyBounds(){this.scale.clearDailyBounds(),this.renderAll()}setVisibleDays(e){this.scale.setVisibleDays(e),this.renderAll()}clearVisibleDays(){this.scale.clearVisibleDays(),this.renderAll()}beginBatchUpdate(){this._batchUpdating=!0}endBatchUpdate(){this._batchUpdating=!1,this.renderAll()}renderAll(){if(this._batchUpdating)return;this.timeAxis.render(),this.layout.render(),this.renderer.render();let e=this.layout.getContentArea(),t=this.layout.getGroupCount()*(this.options.rowHeight??40);this.timeAxis.renderGridlines(e,t)}destroy(){this.interaction.detach(),this.resizeObserver?.disconnect(),this.timeAxis.destroy(),this.layout.destroy(),this.renderer.destroy(),this.rootEl.remove(),this.eventListeners.clear()}},{BLOCK_TYPES:SO}=t.temporal,CO=class{constructor(e,t){this.timeline=null,this.unsubscribe=null,this.currentItems=new Map,this.isRendering=!1,this.popoverManager=nO(),this.viewState=new VT,this.currentDay=null,this.currentView=`day`,this.selectedCourts=new Set,this.visibleCourts=null,this.handleOnMove=e=>{let t=XT(e.id);if(!t)return!1;let n=YT(e.group),r=this.toLocalISO(e.start),i=this.toLocalISO(e.end),a=this.engine.moveBlock({blockId:t,newTimeRange:{start:r,end:i},newCourt:n||void 0});return a.conflicts.some(e=>e.severity===`ERROR`)?(this.showConflictDialog(a.conflicts),!1):(this.render(),!0)},this.handleOnMoving=e=>{this.popoverManager.destroy();let t=this.currentItems.get(e.id);if(t&&(t.isSegment||t.type===`background`))return null;let{start:n,end:r}=e,i=YT(e.group);if(i){let e=n.toISOString().slice(0,10),t=this.engine.getCourtAvailability(i,e),a=new Date(`${e}T${t.startTime}:00`),o=new Date(`${e}T${t.endTime}:00`);n<a&&(n=a),r>o&&(r=o)}return{start:n,end:r}},this.handleTimelineClick=e=>{let t=e.item;if(!t){this.popoverManager.destroy();return}let n=this.currentItems.get(t);if(!n){this.popoverManager.destroy();return}if(n.isSegment||n.type===`background`){this.popoverManager.destroy();return}if(this.popoverManager.isActiveFor(t)){this.popoverManager.destroy();return}let r=XT(t);if(!r)return;let i=(e.event?.target)?.closest?.(`.tg-item`)??this.config.container.querySelector(`[data-item-id="${t}"]`);if(i){let e=String(n.start).slice(0,10);this.popoverManager.showForEngineBlock(i,{itemId:t,blockId:r,engine:this.engine,day:e,onBlockChanged:()=>this.render()})}this.config.onBlockSelected&&this.config.onBlockSelected(r)},this.handleMultiRowCreate=e=>{let t=[];for(let n of e.groupIds){let e=YT(n);e&&t.push(e)}if(t.length===0)return;let n=this.toLocalISO(e.startTime),r=this.toLocalISO(e.endTime),i=this.engine.applyBlock({courts:t,timeRange:{start:n,end:r},type:SO.BLOCKED,reason:`New Block`});if(this.render(),i.applied.length>0){let e=i.applied[0].block.id,t=`block-${e}`,r=n.slice(0,10);setTimeout(()=>{let n=this.config.container.querySelector(`[data-item-id="${t}"]`);n&&this.popoverManager.showForEngineBlock(n,{itemId:t,blockId:e,engine:this.engine,day:r,onBlockChanged:()=>this.render()})},50)}this.config.onTimeRangeSelected&&this.config.onTimeRangeSelected({courts:t,start:n,end:r})},this.handleEngineEvent=e=>{switch(e.type){case`STATE_CHANGED`:case`BLOCKS_CHANGED`:this.render(),e.type===`BLOCKS_CHANGED`&&this.config.onBlocksChanged&&this.config.onBlocksChanged();break;case`CONFLICTS_CHANGED`:this.config.showConflicts&&this.render();break;case`AVAILABILITY_CHANGED`:this.updateTimelineWindow(),this.render();break}},this.engine=e,this.config={groupingMode:`BY_VENUE`,showConflicts:!0,showSegmentLabels:!1,colorScheme:HT,...t},this.initialize()}initialize(){if(this.config.initialDay)this.currentDay=this.config.initialDay;else{let e=this.engine.getActiveDays();this.currentDay=e.length>0?e[0]:t.tools.dateTime.extractDate(new Date().toISOString())}this.viewState.setSelectedDay(this.currentDay),this.config.initialView&&(this.currentView=this.config.initialView),this.unsubscribe=this.engine.subscribe(this.handleEngineEvent),this.ensureTimeline()}ensureTimeline(){this.timeline||setTimeout(()=>{this.timeline||this.createTimelineWithData()},0)}getViewDays(){if(!this.currentDay)return[];let e=rO[this.currentView],t=e?e.days:1;if(t<=0)return this.engine.getActiveDays();if(t<=1)return[this.currentDay];let n=this.engine.getActiveDays(),r=n.indexOf(this.currentDay);return r===-1?[this.currentDay]:n.slice(r,r+t)}buildViewData(){if(!this.currentDay)return{groups:[],items:[]};let e=this.getViewDays(),t=this.engine.listCourtMeta(),n=this.viewState.getLayerVisibility(),r={groupingMode:this.config.groupingMode,layerVisibility:n,showSegmentLabels:this.config.showSegmentLabels,colorScheme:this.config.colorScheme},i=UT(this.engine.getDayTimeline(e[0]),t,r);this.visibleCourts!==null&&this.visibleCourts.size>0&&(i=i.filter(e=>this.visibleCourts.has(String(e.id))));let a=this.visibleCourts!==null&&this.visibleCourts.size>0&&i.length>0?new Set(i.map(e=>String(e.id))):null,o=e.length<=1?this.engine.getActiveDays():e,s=[],c=[];for(let e of o){let t=this.engine.getDayTimeline(e);s.push(...WT(t,r)),c.push(...KT(this.engine.getDayBlocks(e),r))}let l=a?s.filter(e=>a.has(String(e.group))):s,u=a?c.filter(e=>a.has(String(e.group))):c,d=[...l,...u];return{groups:i.map((e,t)=>({id:String(e.id),content:typeof e.content==`string`?e.content:``,order:t,courtRef:e.courtRef,surface:e.surface,indoor:e.indoor,hasLights:e.hasLights,tags:e.tags})),items:d.map(e=>({id:String(e.id),group:String(e.group),content:e.content,start:e.start,end:e.end,type:e.type===`background`?`background`:`range`,className:e.className,style:e.style,title:e.title,editable:e.editable,blockId:e.blockId,status:e.status,reason:e.reason,isBlock:e.isBlock,isSegment:e.isSegment,isConflict:e.isConflict}))}}createTimelineWithData(){let e=this.engine.getConfig(),n=this.currentDay||t.tools.dateTime.extractDate(new Date().toISOString()),r=this.getViewDays(),i=r[0]||n,a=r[r.length-1]||n,o=this.engine.getVisibleTimeRange(i),s=this.engine.getVisibleTimeRange(a),c=ZT({dayStartTime:o.startTime,dayEndTime:o.endTime,slotMinutes:e.slotMinutes,day:i}),l=rO[this.currentView],u=r.length>1?new Date(`${a}T${s.endTime}:00`):c.end,d=this.engine.getActiveDays(),f=d[0]||i,p=d[d.length-1]||a,m=this.engine.getVisibleTimeRange(f),h=this.engine.getVisibleTimeRange(p),g=new Date(`${f}T${m.startTime}:00`),_=new Date(`${p}T${h.endTime}:00`),{groups:v,items:y}=this.buildViewData();this.currentItems.clear();for(let e of y)this.currentItems.set(e.id,e);this.timeline=new xO(this.config.container,y,v,{start:c.start,end:u,min:g,max:_,zoomMin:c.zoomMin,zoomMax:_.getTime()-g.getTime(),snap:e=>this.snapToMinutes(e,5),rowHeight:40,height:`100%`,timeAxis:l?l.timeAxis:{scale:`hour`,step:1},showTooltips:!0}),this.timeline.setDailyBounds(o.startTime,o.endTime),r.length>1&&this.timeline.setVisibleDays(r),this.timeline.on(`click`,this.handleTimelineClick),this.timeline.onMove(this.handleOnMove),this.timeline.onMoving(this.handleOnMoving),this.timeline.onMultiRowCreate(this.handleMultiRowCreate),this.timeline.onDayClick(e=>{this.setDay(e),this.setViewPreset(`day`),this.config.onDayNavigate?.(e)}),this.config.onBlocksChanged?.()}setDay(e){this.currentDay!==e&&(this.currentDay=e,this.viewState.setSelectedDay(e),this.updateTimelineWindow(),this.render())}getDay(){return this.currentDay}setView(e){this.currentView=e,this.updateTimelineWindow()}setViewPreset(e){let t=rO[e];if(!t||!this.timeline||!this.currentDay)return;this.currentView=e;let n=this.getViewDays(),r=n[0],i=n[n.length-1],a=this.engine.getVisibleTimeRange(r),o=this.engine.getVisibleTimeRange(i);this.timeline.beginBatchUpdate();let s=t.days===0||t.days>1;this.timeline.setDailyBounds(a.startTime,a.endTime),s?this.timeline.setVisibleDays(n):this.timeline.clearVisibleDays();let c=new Date(`${r}T${a.startTime}:00`),l=new Date(`${i}T${o.endTime}:00`);this.timeline.setWindow(c,l,{animation:!1}),this.timeline.setOptions({timeAxis:t.timeAxis});let{groups:u,items:d}=this.buildViewData();this.currentItems.clear();for(let e of d)this.currentItems.set(e.id,e);this.timeline.setGroups(u),this.timeline.setItems(d),this.timeline.endBatchUpdate(),this.config.onBlocksChanged?.()}setSelectedCourts(e){this.selectedCourts=new Set(e)}getSelectedCourts(){return Array.from(this.selectedCourts)}setVisibleCourts(e){e&&e.size===0?this.visibleCourts=null:this.visibleCourts=e,this.render()}setLayerVisibility(e,t){this.viewState.setLayerVisibility(e,t),this.render()}refresh(){this.updateTimelineWindow(),this.render()}destroy(){this.popoverManager.destroy(),this.unsubscribe&&this.unsubscribe(),this.timeline&&=(this.timeline.destroy(),null)}updateTimelineWindow(){if(!this.timeline||!this.currentDay)return;let e=this.engine.getConfig(),t=this.getViewDays(),n=t[0]||this.currentDay,r=t[t.length-1]||this.currentDay,i=this.engine.getVisibleTimeRange(n),a=this.engine.getVisibleTimeRange(r),o=ZT({dayStartTime:i.startTime,dayEndTime:i.endTime,slotMinutes:e.slotMinutes,day:n}),s=rO[this.currentView],c=t.length>1?new Date(`${r}T${a.endTime}:00`):o.end,l=this.engine.getActiveDays(),u=l[0]||n,d=l[l.length-1]||r,f=this.engine.getVisibleTimeRange(u),p=this.engine.getVisibleTimeRange(d),m=new Date(`${u}T${f.startTime}:00`),h=new Date(`${d}T${p.endTime}:00`);this.timeline.beginBatchUpdate(),this.timeline.setDailyBounds(i.startTime,i.endTime),t.length>1?this.timeline.setVisibleDays(t):this.timeline.clearVisibleDays(),this.timeline.setOptions({min:m,max:h}),this.timeline.setWindow(o.start,c,{animation:!1}),s&&this.timeline.setOptions({timeAxis:s.timeAxis}),this.timeline.endBatchUpdate()}render(){if(this.currentDay&&!this.isRendering){if(!this.timeline){this.ensureTimeline();return}this.isRendering=!0;try{let{groups:e,items:t}=this.buildViewData();this.currentItems.clear();for(let e of t)this.currentItems.set(e.id,e);this.timeline.setGroups(e),this.timeline.setItems(t)}finally{this.isRendering=!1}}}getPopoverManager(){return this.popoverManager}snapToMinutes(e,t){let n=e.getTime(),r=t*60*1e3,i=Math.round(n/r)*r;return new Date(i)}toLocalISO(e){let t=e=>e.toString().padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}showConflictDialog(e){let t=e.filter(e=>e.severity===`ERROR`).map(e=>e.message).join(`
247
247
  `);alert(`Cannot complete operation:\n\n${t}`)}getTimeline(){return this.timeline}getEngine(){return this.engine}getViewState(){return this.viewState}};function wO(e){let t=e?.totalHours??`Total Hours`,n=e?.blocked??`Blocked`,r=e?.available??`Available`,i=e?.avgPerCourt??`Avg Avail/Court`,a=document.createElement(`div`);a.className=`tg-stats-bar`;let o=e=>{let t=document.createElement(`span`);return t.innerHTML=`${e}: <b>&mdash;</b>`,a.appendChild(t),t},s=o(t),c=o(n),l=o(r),u=o(i);return{element:a,update:e=>{s.innerHTML=`${t}: <b>${e.totalHours.toFixed(1)}h</b>`,c.innerHTML=`${n}: <b>${e.blockedHours.toFixed(1)}h</b>`,l.innerHTML=`${r}: <b>${e.availableHours.toFixed(1)}h</b>`,u.innerHTML=`${i}: <b>${e.avgPerCourt.toFixed(1)}h</b>`}}}var TO,EO,DO,OO=!1;async function kO(){if(!TO){let e=await Promise.resolve().then(()=>(jD(),QT));TO=e.TimepickerUI,EO=e.PluginRegistry,DO=(await Promise.resolve().then(()=>(UD(),MD))).RangePlugin,!OO&&EO&&DO&&(EO.register(DO),OO=!0)}}var AO=0;async function jO(e){let{title:t,currentDay:n,currentStartTime:r,currentEndTime:i,showScopeToggle:a=!0,venueBounds:o,onConfirm:s,onCancel:c,labels:l={}}=e;await kO();let u=new Date(n+`T12:00:00`).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`}),d=`tp-court-avail-${++AO}`,f=a?`current-day`:`all-days`,p=document.createElement(`div`);p.className=`tg-modal`,p.style.cssText=`
248
248
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
249
249
  background: var(--chc-bg-overlay); z-index: 10000;
@@ -317,5 +317,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
317
317
  `}).join(``)}
318
318
  </div>
319
319
  </div>
320
- `}e.innerHTML=a,e.querySelectorAll(`.court-checkbox`).forEach(e=>{e.addEventListener(`change`,this.handleCourtCheckboxChange)}),e.querySelectorAll(`.venue-checkbox`).forEach(e=>{e.addEventListener(`change`,this.handleVenueCheckboxChange)}),e.querySelectorAll(`.venue-edit-icon`).forEach(e=>{e.addEventListener(`click`,e=>{e.stopPropagation();let t=e.currentTarget,n=t.dataset.venue,r=t.dataset.tournamentId,i=t.dataset.venueName||n,a=this.control?.getDay()||this.engine.getActiveDays()[0]||`2026-01-01`,o=this.engine.getVenueAvailability(r,n),s=this.engine.getConfig();jO({title:`Venue Defaults \u2014 ${i}`,currentDay:a,currentStartTime:o?.startTime||s.dayStartTime,currentEndTime:o?.endTime||s.dayEndTime,showScopeToggle:!1,onConfirm:({startTime:e,endTime:t})=>{this.engine.setVenueDefaultAvailability(r,n,{startTime:e,endTime:t}),this.engine.clearCourtAvailabilityForVenue(r,n),this.control?.refresh()}})})}),e.querySelectorAll(`.court-edit-icon`).forEach(e=>{e.addEventListener(`click`,e=>{e.stopPropagation();let t=e.currentTarget,n=t.dataset.courtId,r=t.dataset.venueId,i=t.dataset.tournamentId,a=t.dataset.courtName||n,o={tournamentId:i,venueId:r,courtId:n},s=this.control?.getDay()||this.engine.getActiveDays()[0]||`2026-01-01`,c=this.engine.getCourtAvailability(o,s);jO({title:`Court \u2014 ${a}`,currentDay:s,currentStartTime:c.startTime,currentEndTime:c.endTime,showScopeToggle:!0,onConfirm:({startTime:e,endTime:t,scope:n})=>{n===`all-days`?this.engine.setCourtAvailabilityAllDays(o,{startTime:e,endTime:t}):this.engine.setCourtAvailability(o,s,{startTime:e,endTime:t}),this.control?.refresh()}})})})}updateVenueCheckboxState(e){let t=this.engine.listCourtMeta().filter(t=>t.ref.venueId===e),n=t.filter(e=>{let t=`${e.ref.tournamentId}|${e.ref.venueId}|${e.ref.courtId}`;return this.visibleCourts.has(t)}).length,r=this.venueTreeElement?.querySelector(`.venue-checkbox[data-venue="${e}"]`);r&&(n===0?(r.checked=!1,r.indeterminate=!1):n===t.length?(r.checked=!0,r.indeterminate=!1):(r.checked=!1,r.indeterminate=!0))}getEngine(){return this.engine}getControl(){return this.control}setDay(e){this.control?.setDay(e),this.updateCapacityStats()}refresh(){this.control?.refresh(),this.updateCapacityStats(),this.updateVenueTree()}};function PO(e,t){let n=new NO(e);return n.render(t),n}var{LUCKY_DRAW:FO,ROUND_ROBIN:IO,AD_HOC:LO}=t.drawDefinitionConstants;function RO(e){let t=Math.max(2,e),n=2**Math.floor(Math.log2(t)),r=t-n;if(r<=0)return new Map;let i=new Map,a=0,o=n/2;for(;o>=1;)a++,r&o&&(a++,i.set(a,o)),o=Math.floor(o/2);return i}function zO(e){let t=Math.max(2,e),n=2**Math.floor(Math.log2(t)),r=t-n,i=0,a=n/2;for(;a>=1;)i++,r&a&&i++,a=Math.floor(a/2);return i}function BO(e){let t=Math.max(2,e),n=t%2?t+1:t,r=!!(Math.ceil(n/2)%2),i=[{participantsCount:n,preFeedRound:r}];for(;n>2;){let e=Math.ceil(n/2),t=e===1,r=!!(!t&&e%2);n=!t&&r?e+1:e;let a=!!(n!==2&&Math.ceil(n/2)%2);i.push({participantsCount:n,preFeedRound:a,feedRound:r})}return i}function VO(e){let t=Math.max(2,e);return t&t-1?BO(e).length:Math.ceil(Math.log2(t))}function HO(e,t){let n=Math.max(2,e);if(!(n&n-1))return Math.floor(n/2**t);let r=BO(e),i=t-1;if(i<0||i>=r.length)return 0;let{participantsCount:a,preFeedRound:o}=r[i],s=a/2,c=o?s-1:s;if(t===1&&n%2!=0){let e=a-n;c-=e}return c}function UO(e,t,n){return e===IO?(n?.groupSize||Math.min(t,4))-1:e===LO?n?.roundsCount||1:e===FO?VO(t):zO(t)}function WO(e,t,n){return e===FO?HO(t,n):Math.floor(t/2**n)}var{ROUND_ROBIN:GO,AD_HOC:KO,LUCKY_DRAW:qO}=t.drawDefinitionConstants,JO=0;function YO({structureType:e,drawSize:t,stage:n,structureId:r,qualifyingPositions:i,structureOptions:a}){return e===GO?ZO({drawSize:t,stage:n,structureId:r,structureOptions:a}):e===KO?$O({drawSize:t,stage:n,structureId:r,roundsCount:a?.roundsCount||1}):e===qO?QO({drawSize:t,stage:n,structureId:r}):XO({drawSize:t,stage:n,structureId:r,qualifyingPositions:i})}function XO({drawSize:e,stage:t,structureId:n,qualifyingPositions:r}){let i=Math.max(2,e),a=2**Math.floor(Math.log2(i)),o=i-a,s=[],c=a/2;for(;c>=1;)s.push({count:c,isFeed:!1}),o&c&&s.push({count:c,isFeed:!0}),c=Math.floor(c/2);if(r&&r>0&&e>r){let t=Math.round(Math.log2(e/r));t>0&&s.length>t&&(s.length=t)}let l=s.length,u=[],d=1,f=0,p=new Set;for(let e=0;e<l-1;e++)!s[e].isFeed&&s[e+1].isFeed&&p.add(e);for(let e=0;e<l;e++){let{count:r,isFeed:i}=s[e],a=e+1,o=i?2**Math.max(0,f-1):2**f,c=i||p.has(e);for(let s=1;s<=r;s++){let r=a===1&&!i;u.push({matchUpId:`preview-${++JO}`,roundNumber:a,roundPosition:s,drawPositions:r?[(s-1)*2+1,(s-1)*2+2]:i?[d++]:[],finishingRound:l-e,roundFactor:o,preFeedRound:c,stage:t,structureId:n})}i||f++}return u}function ZO({drawSize:e,stage:t,structureId:n,structureOptions:r}){let i=[],a=r?.groupSize||Math.min(e,4),o=Math.ceil(e/a),s=a-1;for(let e=0;e<o;e++)for(let r=1;r<=s;r++){let o=Math.floor(a/2);for(let a=1;a<=o;a++)i.push({matchUpId:`preview-${++JO}`,roundNumber:r,roundPosition:e*o+a,isRoundRobin:!0,stage:t,structureId:`${n}-g${e}`})}return i}function QO({drawSize:e,stage:t,structureId:n}){let r=Math.max(2,e);if(!(r&r-1))return XO({drawSize:e,stage:t,structureId:n});let i=BO(r),a=i.length,o=[],s=1;for(let e=0;e<a;e++){let{participantsCount:r,preFeedRound:c}=i[e],l=r/2,u=e+1;for(let r=1;r<=l;r++){let i=u===1;o.push({matchUpId:`preview-${++JO}`,roundNumber:u,roundPosition:r,drawPositions:i?[s++,s++]:[],finishingRound:a-e,roundFactor:1,preFeedRound:!!c,stage:t,structureId:n})}}return o}function $O({drawSize:e,stage:t,structureId:n,roundsCount:r=1}){let i=[];if(e<2)return i;let a=Math.floor(e/2);for(let e=1;e<=r;e++)for(let r=1;r<=a;r++)i.push({matchUpId:`preview-${++JO}`,roundNumber:e,roundPosition:r,finishingRound:1,stage:t,structureId:n});return i}var{ROUND_ROBIN:ek}=t.drawDefinitionConstants,tk=new Map;function nk(e,n,r){let i=`${e}:${n}:${r||``}`,a=tk.get(i);if(a)return a;try{let a={drawSize:n,drawType:e};r&&(a.structureOptions={groupSize:r});let{tournamentRecord:o}=t.mocksEngine.generateTournamentRecord({drawProfiles:[a]}),s=o?.events?.[0]?.drawDefinitions?.[0];if(!s)return rk(i,{});let c=(s.structures||[])[0];if(!c)return rk(i,{});let l=c.structureType===`CONTAINER`,u={};if(l||e===ek){let{availablePlayoffProfiles:e}=t.drawsGovernor.getAvailablePlayoffProfiles({drawDefinition:s}),n=e?.[0];n&&(u={playoffFinishingPositionRanges:n.playoffFinishingPositionRanges,finishingPositionsAvailable:n.finishingPositionsAvailable})}else{let e=c.structureId,{playoffRounds:n,playoffRoundsRanges:r}=t.drawsGovernor.getAvailablePlayoffProfiles({drawDefinition:s,structureId:e});u={playoffRounds:n,playoffRoundsRanges:r}}return rk(i,u)}catch{return rk(i,{})}}function rk(e,t){return tk.set(e,t),t}var{MAIN:ik,QUALIFYING:ak,CONSOLATION:ok,PLAY_OFF:sk,ROUND_ROBIN:ck,AD_HOC:lk,LUCKY_DRAW:uk,WINNER:dk,LOSER:fk}=t.drawDefinitionConstants,pk=240,mk=48,hk=16;function gk(e){if(e.structureType===ck)return(e.structureOptions?.groupSize||Math.min(e.drawSize,4))-1;if(e.structureType===lk)return e.structureOptions?.roundsCount||1;if(e.structureType===uk)return VO(e.drawSize);let t=Math.max(2,e.drawSize),n=2**Math.floor(Math.log2(t)),r=t-n,i=0,a=n/2;for(;a>=1;)i++,r&a&&i++,a=Math.floor(a/2);if(e.qualifyingPositions&&e.qualifyingPositions>0&&e.drawSize>e.qualifyingPositions){let t=Math.round(Math.log2(e.drawSize/e.qualifyingPositions));t>0&&t<i&&(i=t)}return i}function _k(e){let t=gk(e);return Math.max(pk,t*mk+hk)}var vk={[ik]:`tb-card-badge--main`,[ak]:`tb-card-badge--qualifying`,[ok]:`tb-card-badge--consolation`,[sk]:`tb-card-badge--playoff`};function yk(e,t,n,r,i,a,o,s){let c=a&&a.length>0,l=document.createElement(`div`);l.className=`tb-card${n?` tb-card--selected`:``}${c?` tb-card--warning`:``}`,l.style.left=`${e.position.x}px`,l.style.top=`${e.position.y}px`,l.style.minWidth=`${_k(e)}px`,l.setAttribute(`data-node-id`,e.id);let u=document.createElement(`div`);u.className=`tb-card-header`;let d=document.createElement(`span`);d.className=`tb-card-badge ${vk[e.stage]||`tb-card-badge--main`}`,d.textContent=e.stage.substring(0,4);let f=document.createElement(`span`);f.className=`tb-card-name`,f.textContent=e.structureName;let p=document.createElement(`span`);if(p.className=`tb-card-size`,p.textContent=`\u00d7${e.drawSize}`,u.appendChild(d),u.appendChild(f),u.appendChild(p),o){let e=document.createElement(`div`);e.className=`tb-card-advance`,e.textContent=o,u.appendChild(e)}let m=document.createElement(`div`);m.className=`tb-card-preview`;let h=e.matchUps||YO({structureType:e.structureType,drawSize:e.drawSize,stage:e.stage,structureId:e.id,qualifyingPositions:e.qualifyingPositions,structureOptions:e.structureOptions});if(h.length>0)try{let t=li({matchUps:h,structureId:e.id,showHeaders:!1});t.style.transform=`scale(0.8)`,t.style.transformOrigin=`top left`,m.appendChild(t)}catch{m.textContent=`${e.structureType} \u00d7${e.drawSize}`,m.style.cssText+=`font-size:11px;color:var(--chc-text-muted);display:flex;align-items:center;justify-content:center;`}if(i?.length&&m.querySelector(`.chc-schematic-structure`)){let e=m.querySelectorAll(`.chc-schematic-round-container[data-round-number]`);for(let n of e){let e=parseInt(n.getAttribute(`data-round-number`)||`0`),r=i.filter(t=>t.roundNumber===e);if(!r.length)continue;let a=r.find(e=>e.isSelected)||r.find(e=>e.linkType===fk)||r.find(e=>e.linkType===dk)||r[0];n.classList.add(`tb-round-linked`),n.classList.add(`tb-round-linked--${a.linkType.toLowerCase()}`),n.classList.add(`tb-round-linked--${a.direction}`),a.isSelected&&n.classList.add(`tb-round-linked--active`),n.style.cursor=`pointer`,n.addEventListener(`click`,e=>{e.stopPropagation(),t.onSelectEdge(a.edgeId)}),n.title=r.map(t=>`R${e} ${t.linkType} ${t.direction===`source`?`out`:`in`}`).join(`, `)}}let g=nk(e.structureType,e.drawSize,e.structureOptions?.groupSize),_=null;g.playoffRoundsRanges?.length?(_=document.createElement(`div`),_.className=`tb-card-rounds`,_.textContent=g.playoffRoundsRanges.map(e=>`R${e.roundNumber}:${e.finishingPositionRange}`).join(` `)):g.playoffFinishingPositionRanges?.length&&(_=document.createElement(`div`),_.className=`tb-card-rounds`,_.textContent=g.playoffFinishingPositionRanges.map(e=>`P${e.finishingPosition}:${e.finishingPositionRange}`).join(` `));let v=document.createElement(`div`);v.className=`tb-card-ports`;let y=document.createElement(`div`);y.className=`tb-port tb-port--input`,y.title=`Input`,y.addEventListener(`mouseup`,()=>{t.onPortMouseUp(e.id)});let b=document.createElement(`div`);b.className=`tb-port-group`;let x=document.createElement(`div`);x.className=`tb-port tb-port--winner${r?` tb-port--connected`:``}`,x.title=r?`Winner linked`:`Winner output`,r||x.addEventListener(`mousedown`,n=>{n.stopPropagation(),t.onPortMouseDown(e.id,`winner`)});let S=document.createElement(`div`);if(S.className=`tb-port tb-port--loser`,S.title=`Loser output`,S.addEventListener(`mousedown`,n=>{n.stopPropagation(),t.onPortMouseDown(e.id,`loser`)}),b.appendChild(x),b.appendChild(S),v.appendChild(y),v.appendChild(b),l.appendChild(u),l.appendChild(m),s?.length){let e=document.createElement(`div`);e.className=`tb-card-chips`;for(let n of s){let r=document.createElement(`span`);r.className=`tb-card-chip`,r.textContent=`P${n.position}`,r.title=`Position ${n.position} → ${n.targetName}`,r.addEventListener(`click`,e=>{e.stopPropagation(),t.onSelectEdge(n.edgeId)}),e.appendChild(r)}l.appendChild(e)}if(_&&l.appendChild(_),c){let e=document.createElement(`div`);e.className=`tb-card-warning`,e.textContent=`⚠ Issue`;let t=document.createElement(`div`);t.className=`tb-card-warning-detail`,t.textContent=a.join(`; `),e.appendChild(t),e.addEventListener(`click`,t=>{t.stopPropagation(),e.classList.toggle(`tb-card-warning--open`)}),l.appendChild(e)}return l.appendChild(v),l.addEventListener(`mouseup`,()=>{t.onPortMouseUp(e.id)}),l.addEventListener(`click`,n=>{n.stopPropagation(),t.onSelect(e.id)}),t.onDoubleClick&&l.addEventListener(`dblclick`,n=>{n.stopPropagation(),t.onDoubleClick(e.id)}),l.addEventListener(`mousedown`,n=>{n.target.classList.contains(`tb-port`)||t.onDragStart(e.id,n.clientX,n.clientY)}),l}function bk(e,t){let n=_k(e);switch(t){case`input`:return{x:e.position.x,y:e.position.y+160/2};case`winner`:return{x:e.position.x+n,y:e.position.y+160/2-8};case`loser`:return{x:e.position.x+n,y:e.position.y+160/2+8}}}var{MAIN:xk,QUALIFYING:Sk,CONSOLATION:Ck,WINNER:wk,LOSER:Tk,ROUND_ROBIN:Ek}=t.drawDefinitionConstants,Dk=`POSITION`,Ok=0;function kk(e){return`${e}-${++Ok}-${Date.now().toString(36)}`}function Ak(e){let t=2;for(;t*2<=e;)t*=2;return t}var jk=160,Mk=60,Nk=30,Pk=class{constructor(e){this.listeners=new Set,this.state={nodes:[],edges:[],selectedNodeId:null,selectedEdgeId:null,drawName:`New Draw`,...e}}getState(){return{...this.state}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){let e=this.getState();for(let t of this.listeners)t(e)}setDrawName(e){this.state.drawName=e,this.notify()}addNode(e){let t={...e,id:kk(`node`),position:this.nextNodePosition()};return this.state.nodes.push(t),this.state.templateName=void 0,this.notify(),t}updateNode(e,t){let n=this.state.nodes.find(t=>t.id===e);n&&(Object.keys(t).some(e=>e!==`position`)&&(this.state.templateName=void 0),Object.assign(n,t),this.notify())}removeNode(e){let t=this.state.edges.filter(t=>t.sourceNodeId===e).map(e=>e.targetNodeId);this.state.nodes=this.state.nodes.filter(t=>t.id!==e),this.state.edges=this.state.edges.filter(t=>t.sourceNodeId!==e&&t.targetNodeId!==e),this.state.selectedNodeId===e&&(this.state.selectedNodeId=null),this.state.templateName=void 0;for(let e of t)this.clampConsolationDrawSize(e);this.notify()}addEdge(e){if(e.linkType===wk&&this.state.edges.find(t=>t.sourceNodeId===e.sourceNodeId&&t.linkType===wk))return null;let t=this.state.nodes.find(t=>t.id===e.sourceNodeId),n=this.state.nodes.find(t=>t.id===e.targetNodeId);if(t?.structureType===Ek&&e.linkType!==Dk||t?.stage===Sk&&n&&n.stage!==Sk&&n.stage!==xk||n?.stage===Sk&&t&&t.stage!==Sk)return null;let r={...e,id:kk(`edge`),targetRoundNumber:e.targetRoundNumber||1,label:this.computeEdgeLabel(e)};return this.state.edges.push(r),this.state.templateName=void 0,this.clampConsolationDrawSize(r.targetNodeId),this.notify(),r}updateEdge(e,t){let n=this.state.edges.find(t=>t.id===e);n&&(Object.assign(n,t),n.label=this.computeEdgeLabel(n),this.state.templateName=void 0,this.notify())}removeEdge(e){let t=this.state.edges.find(t=>t.id===e);this.state.edges=this.state.edges.filter(t=>t.id!==e),this.state.selectedEdgeId===e&&(this.state.selectedEdgeId=null),this.state.templateName=void 0,t&&this.clampConsolationDrawSize(t.targetNodeId),this.notify()}selectNode(e){this.state.selectedNodeId=e,this.state.selectedEdgeId=null,this.notify()}selectEdge(e){this.state.selectedEdgeId=e,this.state.selectedNodeId=null,this.notify()}clampConsolationDrawSize(e){let t=this.state.nodes.find(t=>t.id===e);if(!t||t.stage!==Ck)return;let n=this.inboundCapacity(e);n>0&&t.drawSize>n&&(t.drawSize=Ak(n))}inboundCapacity(e){let t=this.state.edges.filter(t=>t.targetNodeId===e),n=0;for(let e of t){let t=this.state.nodes.find(t=>t.id===e.sourceNodeId);if(t)if(e.linkType===Tk){let r=e.sourceRoundNumber||1;n+=WO(t.structureType,t.drawSize,r)}else n+=t.qualifyingPositions||Math.floor(t.drawSize/2)}return n}nextNodePosition(){if(this.state.nodes.length===0)return{x:40,y:40};let e=0;for(let t of this.state.nodes)e=Math.max(e,t.position.x+_k(t));return{x:e+Mk,y:40}}autoLayout(){let e=this.state.nodes,t=this.state.edges;if(!e.length)return;let n=new Map,r=new Map;for(let e of t)r.has(e.sourceNodeId)||r.set(e.sourceNodeId,[]),r.get(e.sourceNodeId).push(e.targetNodeId),n.has(e.targetNodeId)||n.set(e.targetNodeId,[]),n.get(e.targetNodeId).push(e.sourceNodeId);let i=e.filter(e=>!n.has(e.id)||n.get(e.id).length===0);if(!i.length){let t=e.filter(e=>e.stage===xk);i.push(...t.length?t:[e[0]])}let a=new Map,o=new Set(e.filter(e=>e.stage===Sk).map(e=>e.id)),s=[];for(let e of i)o.has(e.id)?a.set(e.id,-1):a.set(e.id,0),s.push(e.id);for(;s.length;){let e=s.shift(),t=a.get(e),n=r.get(e)||[];for(let e of n){let n=t+1,r=a.get(e);(r===void 0||n>r)&&(a.set(e,n),s.push(e))}}for(let t of e)a.has(t.id)||a.set(t.id,0);let c=Math.min(...a.values());if(c<0)for(let[e,t]of a)a.set(e,t-c);let l=new Map;for(let t of e){let e=a.get(t.id);l.has(e)||l.set(e,[]),l.get(e).push(t)}let u=[...l.keys()].sort((e,t)=>e-t),d=40;for(let e of u){let t=l.get(e),n=Math.max(...t.map(e=>_k(e)));t.forEach((e,t)=>{e.position={x:d,y:t*(jk+Nk)+40}}),d+=n+Mk}}loadState(e){this.state={...e},this.notify()}computeEdgeLabel(e){let t=e.linkType||`LINK`,n=``;return e.sourceRoundNumber&&(n+=`R${e.sourceRoundNumber} `),n+=t.toLowerCase(),e.targetRoundNumber&&(n+=` \u2192 R${e.targetRoundNumber}`),e.qualifyingPositions&&(n+=` (${e.qualifyingPositions}Q)`),e.finishingPositions?.length&&(n+=` [${e.finishingPositions.join(`,`)}]`),n}},{WINNER:Fk,LOSER:Ik,QUALIFYING:Lk,CONSOLATION:Rk,ROUND_ROBIN:zk}=t.drawDefinitionConstants,Bk=`POSITION`,Vk=e=>e===zk;function Hk(e,t){if(!Vk(e.structureType))return;let n=t.edges.filter(t=>t.sourceNodeId===e.id&&t.linkType===Bk);if(!n.length)return;let r=new Set(n.flatMap(e=>e.finishingPositions||[])),i=e.structureOptions?.groupSize||4;return`${r.size} of ${i} advance`}var Uk=`http://www.w3.org/2000/svg`,Wk={[Fk]:`tb-edge--winner`,[Ik]:`tb-edge--loser`,[Bk]:`tb-edge--position`};function Gk(e){let t=document.createElement(`div`);t.className=`tb-canvas`;let n=document.createElementNS(Uk,`svg`);n.classList.add(`tb-canvas-svg`);let r=document.createElementNS(Uk,`defs`);for(let[e,t]of Object.entries(Wk)){let n=document.createElementNS(Uk,`marker`);n.setAttribute(`id`,`arrowhead-${e}`),n.setAttribute(`markerWidth`,`8`),n.setAttribute(`markerHeight`,`6`),n.setAttribute(`refX`,`8`),n.setAttribute(`refY`,`3`),n.setAttribute(`orient`,`auto`);let i=document.createElementNS(Uk,`polygon`);i.setAttribute(`points`,`0 0, 8 3, 0 6`),i.setAttribute(`class`,t),i.style.fill=`currentColor`,n.appendChild(i),r.appendChild(n)}n.appendChild(r);let i=document.createElement(`div`);i.className=`tb-canvas-nodes`;let a=document.createElement(`div`);a.className=`tb-canvas-spacer`,t.appendChild(n),t.appendChild(i),t.appendChild(a);let o=null,s=null,c=null,l=!1,u=null;t.addEventListener(`click`,()=>{l||(e.onSelectNode(null),e.onSelectEdge(null))}),t.addEventListener(`mousemove`,n=>{if(s&&!c){let e=n.clientX-s.startX,t=n.clientY-s.startY;Math.abs(e)+Math.abs(t)>=4&&(c=s,s=null)}if(c&&u){let t=n.clientX-c.startX,r=n.clientY-c.startY;e.onMoveNode(c.nodeId,Math.max(0,c.origX+t),Math.max(0,c.origY+r))}if(o?.tempLine){let e=t.getBoundingClientRect();o.tempLine.setAttribute(`x2`,String(n.clientX-e.left+t.scrollLeft)),o.tempLine.setAttribute(`y2`,String(n.clientY-e.top+t.scrollTop))}}),t.addEventListener(`mouseup`,()=>{c&&(l=!0,c=null,setTimeout(()=>{l=!1},0)),s=null,o?.tempLine&&(n.removeChild(o.tempLine),o=null)});function d(e){return new Set(e.edges.filter(e=>e.linkType===Fk).map(e=>e.sourceNodeId).filter(t=>{let n=e.nodes.find(e=>e.id===t);return n&&n.stage===Lk&&!Vk(n.structureType)}))}function f(e){let t=new Map;for(let n of e.edges){let r=n.sourceRoundNumber,i=n.targetRoundNumber,a=n.id===e.selectedEdgeId;if(!r&&n.linkType===Fk){let t=e.nodes.find(e=>e.id===n.sourceNodeId);t&&(r=gk(t))}r&&(t.has(n.sourceNodeId)||t.set(n.sourceNodeId,[]),t.get(n.sourceNodeId).push({roundNumber:r,linkType:n.linkType,direction:`source`,edgeId:n.id,isSelected:a})),i&&(t.has(n.targetNodeId)||t.set(n.targetNodeId,[]),t.get(n.targetNodeId).push({roundNumber:i,linkType:n.linkType,direction:`target`,edgeId:n.id,isSelected:a}))}return t}function p(e){let t=new Map;for(let n of e.edges){if(n.linkType!==Fk)continue;let r=n.targetRoundNumber||1;if(r<=1)continue;let i=e.nodes.find(e=>e.id===n.sourceNodeId);if(!i||i.stage!==Lk)continue;t.has(n.targetNodeId)||t.set(n.targetNodeId,[]);let a=i.qualifyingPositions||Math.floor(i.drawSize/4);t.get(n.targetNodeId).push({targetRound:r,qp:a,warning:`Round ${r} needs fed drawPositions to accommodate ${i.structureName} link`})}let n=new Map;for(let[r,i]of t){let t=e.nodes.find(e=>e.id===r);if(!t)continue;let a=RO(t.drawSize),o=new Map;for(let e of i)o.set(e.targetRound,(o.get(e.targetRound)||0)+e.qp);let s=[];for(let e of i)(a.get(e.targetRound)||0)<(o.get(e.targetRound)||0)&&s.push(e.warning);s.length>0&&n.set(r,s)}return n}function m(e){let t=new Map;for(let n of e.nodes){if(!Vk(n.structureType))continue;let r=e.edges.filter(e=>e.sourceNodeId===n.id&&e.linkType===Bk);if(!r.length)continue;let i=[];for(let t of r){let n=e.nodes.find(e=>e.id===t.targetNodeId);for(let e of t.finishingPositions||[])i.push({position:e,edgeId:t.id,targetName:n?.structureName||`?`})}i.sort((e,t)=>e.position-t.position),t.set(n.id,i)}return t}function h(e,t,n){return e&&Vk(e.structureType)?Bk:n===`loser`||t?.stage===Rk?Ik:Fk}function g(t){return{onSelect:t=>{e.onSelectNode(t)},onSelectEdge:t=>{e.onSelectEdge(t)},onDoubleClick:e.onDoubleClickNode?t=>e.onDoubleClickNode(t):void 0,onPortMouseDown:(e,r)=>{let i=t.nodes.find(t=>t.id===e);if(!i)return;let a=bk(i,r),s=document.createElementNS(Uk,`line`);s.setAttribute(`x1`,String(a.x)),s.setAttribute(`y1`,String(a.y)),s.setAttribute(`x2`,String(a.x)),s.setAttribute(`y2`,String(a.y)),s.setAttribute(`stroke`,r===`winner`?`green`:`red`),s.setAttribute(`stroke-width`,`2`),s.setAttribute(`stroke-dasharray`,`4 2`),n.appendChild(s),o={sourceNodeId:e,portType:r,tempLine:s}},onPortMouseUp:r=>{if(o&&o.sourceNodeId!==r){let n=h(t.nodes.find(e=>e.id===o.sourceNodeId),t.nodes.find(e=>e.id===r),o.portType);e.onCreateEdge(o.sourceNodeId,r,n)}o?.tempLine&&n.removeChild(o.tempLine),o=null},onDragStart:(e,n,r)=>{let i=t.nodes.find(t=>t.id===e);i&&(s={nodeId:e,startX:n,startY:r,origX:i.position.x,origY:i.position.y})}}}function _(e){u=e,i.innerHTML=``;let t=d(e),r=f(e),o=p(e),s=m(e),c=g(e);for(let n of e.nodes){let a=yk(n,c,e.selectedNodeId===n.id,t.has(n.id),r.get(n.id),o.get(n.id),Hk(n,e),s.get(n.id));i.appendChild(a)}n.querySelectorAll(`path, text.tb-edge-label, path.tb-edge-hit`).forEach(e=>n.removeChild(e));let l=new Map;for(let t of e.edges){let e=`${t.sourceNodeId}:${t.targetNodeId}`;l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let t of l.values()){let r=t.length;t.forEach((t,i)=>{v(n,t,e,r>1?(i-(r-1)/2)*14:0)})}let h=600,_=400;for(let t of e.nodes)h=Math.max(h,t.position.x+_k(t)+40),_=Math.max(_,t.position.y+180);n.setAttribute(`width`,String(h)),n.setAttribute(`height`,String(_)),i.style.width=`${h}px`,i.style.height=`${_}px`,a.style.width=`${h}px`,a.style.height=`${_}px`}function v(t,n,r,i=0){let a=r.nodes.find(e=>e.id===n.sourceNodeId),o=r.nodes.find(e=>e.id===n.targetNodeId);if(!a||!o)return;let s=bk(a,n.linkType===Ik?`loser`:`winner`),c=bk(o,`input`),l=s.y+i,u=c.y+i,d=c.x-s.x,f=`M ${s.x},${l} C ${s.x+d/2},${l} ${s.x+d/2},${u} ${c.x},${u}`,p=document.createElementNS(Uk,`path`);p.setAttribute(`d`,f),p.classList.add(`tb-edge-hit`),p.addEventListener(`click`,t=>{t.stopPropagation(),e.onSelectEdge(n.id)}),t.appendChild(p);let m=document.createElementNS(Uk,`path`);if(m.setAttribute(`d`,f),m.classList.add(Wk[n.linkType]||`tb-edge--winner`),r.selectedEdgeId===n.id&&m.classList.add(`tb-edge--selected`),m.setAttribute(`marker-end`,`url(#arrowhead-${n.linkType})`),m.addEventListener(`click`,t=>{t.stopPropagation(),e.onSelectEdge(n.id)}),t.appendChild(m),n.label){let e=(s.x+c.x)/2,r=(l+u)/2-8,i=document.createElementNS(Uk,`text`);i.classList.add(`tb-edge-label`),i.setAttribute(`x`,String(e)),i.setAttribute(`y`,String(r)),i.setAttribute(`text-anchor`,`middle`),i.textContent=n.label,t.appendChild(i)}}return{element:t,update:_}}var{SINGLE_ELIMINATION:Kk,ROUND_ROBIN:qk,FEED_IN:Jk,FEED_IN_CHAMPIONSHIP:Yk,FIRST_MATCH_LOSER_CONSOLATION:Xk,COMPASS:Zk,OLYMPIC:Qk,AD_HOC:$k,LUCKY_DRAW:eA,MAIN:tA,QUALIFYING:nA,CONSOLATION:rA,PLAY_OFF:iA,WINNER:aA}=t.drawDefinitionConstants,oA=`POSITION`,sA=[{label:`Single Elimination`,value:Kk},{label:`Round Robin`,value:qk},{label:`Feed-In Championship`,value:Yk},{label:`FMLC`,value:Xk},{label:`Compass`,value:Zk},{label:`Olympic`,value:Qk},{label:`Ad-hoc`,value:$k}],cA=[{label:`Single Elimination`,value:Kk},{label:`Round Robin`,value:qk},{label:`Lucky Draw`,value:eA},{label:`Staggered Entry`,value:Jk},{label:`Ad-hoc`,value:$k}],lA=[{label:`Main`,value:tA},{label:`Qualifying`,value:nA},{label:`Consolation`,value:rA},{label:`Playoff`,value:iA}];function uA(e){let t=[],n=Math.floor(e/2);for(;n>=1;)t.push(n),n=Math.floor(n/2);return t}function dA(e,t=8){let n=[];for(let r=3;r<=t;r++){let t=Math.ceil(e/r),i=t*r-e,a=Math.ceil(e/t),o=Math.ceil(i/t);(!i||i<r)&&a===r&&a>=3&&o<2&&n.push(r)}return n}function fA(e,t,n,r,i,a){let o=dA(e.drawSize),s=e.structureOptions?.groupSize||4,c=o.includes(s)?o:[s,...o].sort((e,t)=>e-t),l=Math.ceil(e.drawSize/s);i.push({label:`Group Size`,field:`groupSize`,value:String(s),disabled:n,options:c.map(e=>({label:String(e),value:String(e),selected:e===s}))}),i.push({label:`Groups`,field:`groupCount`,value:String(l),disabled:!0}),n||a.push({control:`groupSize`,onChange:({e:t})=>{let n=parseInt(t.target.value);r.onUpdateNode(e.id,{structureOptions:{...e.structureOptions,groupSize:n}})}});let u=t.edges.filter(t=>t.sourceNodeId===e.id&&t.linkType===oA),d=new Set(u.flatMap(e=>e.finishingPositions||[])),f=d.size||0,p=Array.from({length:s},(e,t)=>t+1);i.push({label:`Advance Per Group`,field:`advancePerGroup`,value:String(f),disabled:n||u.length===0,options:p.map(e=>({label:String(e),value:String(e),selected:e===f}))}),!n&&u.length>0&&a.push({control:`advancePerGroup`,onChange:({e})=>{let t=parseInt(e.target.value),n=d.size;if(t!==n)if(t>n){let e=u.at(-1),n=[];for(let e=1;e<=s&&d.size+n.length<t;e++)d.has(e)||n.push(e);n.length>0&&r.onUpdateEdge(e.id,{finishingPositions:[...e.finishingPositions||[],...n].sort((e,t)=>e-t)})}else{let e=[...d].sort((e,t)=>t-e),i=new Set(e.slice(0,n-t));for(let e of u){let t=(e.finishingPositions||[]).filter(e=>!i.has(e));t.length!==(e.finishingPositions||[]).length&&r.onUpdateEdge(e.id,{finishingPositions:t})}}}}),u.length>0&&f>0&&pA(u,t,l,i)}function pA(e,t,n,r){let i=new Map;for(let t of e)i.has(t.targetNodeId)||i.set(t.targetNodeId,[]),i.get(t.targetNodeId).push(...t.finishingPositions||[]);let a=[];for(let[e,r]of i){let i=t.nodes.find(t=>t.id===e),o=[...new Set(r)].sort((e,t)=>e-t),s=o.length===1?`P${o[0]}`:`P${o.join(`,`)}`;a.push(`${s} → ${i?.structureName||`?`} (${o.length*n})`)}a.length>0&&r.push({label:`Playoff Groups`,field:`playoffSummary`,value:a.join(`
321
- `),disabled:!0})}function mA(e,t,n,r,i,a){let o=t.edges.find(t=>t.targetNodeId===e.id&&t.linkType===oA);if(!o||t.nodes.find(e=>e.id===o.sourceNodeId)?.structureType!==qk)return;let s=e.structureOptions?.playoffDrawType||Kk;if(i.push({label:`Playoff Draw Type`,field:`playoffDrawType`,value:s,disabled:n,options:sA.map(e=>({...e,selected:e.value===s}))}),n||a.push({control:`playoffDrawType`,onChange:({e:t})=>r.onUpdateNode(e.id,{structureOptions:{...e.structureOptions,playoffDrawType:t.target.value}})}),s===qk){let t=e.structureOptions?.groupSize||4;i.push({label:`Playoff Group Size`,field:`playoffGroupSize`,value:String(t),disabled:n,options:[3,4,5,6,8].map(e=>({label:String(e),value:String(e),selected:e===t}))}),n||a.push({control:`playoffGroupSize`,onChange:({e:t})=>r.onUpdateNode(e.id,{structureOptions:{...e.structureOptions,groupSize:parseInt(t.target.value)}})})}}function hA(e,t,n,r,i){let a=uA(e.drawSize),o=e.qualifyingPositions??a[0];r.push({label:`Qualifying Positions`,field:`qualifyingPositions`,value:String(o),disabled:t,options:a.map(e=>({label:String(e),value:String(e),selected:e===o}))}),t||i.push({control:`qualifyingPositions`,onChange:({e:t})=>n.onUpdateNode(e.id,{qualifyingPositions:parseInt(t.target.value)})})}function gA(e,t,n){let r=RO(e.drawSize),i=new Map,a=[];for(let n of t.edges){if(n.linkType!==aA||n.targetNodeId!==e.id)continue;let r=n.targetRoundNumber||1;if(r<=1)continue;let o=t.nodes.find(e=>e.id===n.sourceNodeId);if(!o||o.stage!==nA)continue;let s=o.qualifyingPositions||Math.floor(o.drawSize/4);i.set(r,(i.get(r)||0)+s),a.push({targetRound:r,qp:s,sourceName:o.structureName})}let o=[];for(let e of a){let t=r.get(e.targetRound)||0;t>=(i.get(e.targetRound)||0)||(t===0?o.push(`Round ${e.targetRound} is not a feed round — ${e.sourceName} sends ${e.qp} qualifiers`):o.push(`Round ${e.targetRound} has ${t} feed positions but ${e.sourceName} sends ${e.qp} qualifiers`))}if(o.length>0){let e=document.createElement(`div`);e.className=`tb-editor-warning`;for(let t of o){let n=document.createElement(`div`);n.textContent=`\u26a0 ${t}`,e.appendChild(n)}let t=document.createElement(`div`);t.style.marginTop=`6px`,t.textContent=`Change the target round to a feed round, or increase the draw size to create feed positions at that round.`,e.appendChild(t),n.appendChild(e)}}function _A(e){let t=document.createElement(`div`),n=!!e.readOnly;function r(r){t.innerHTML=``;let i=r.selectedNodeId?r.nodes.find(e=>e.id===r.selectedNodeId):null;if(!i)return;let a=document.createElement(`div`);a.className=`tb-editor-header`,a.textContent=`Structure Properties`,t.appendChild(a);let o=document.createElement(`div`);o.className=`tb-editor-body`;let s=[{label:`Name`,field:`structureName`,value:i.structureName,...n?{disabled:!0}:{validator:eh(1),error:`Name required`}},{label:`Stage`,field:`stage`,value:i.stage,disabled:n,options:lA.map(e=>({...e,selected:e.value===i.stage}))},{label:`Structure Type`,field:`structureType`,value:i.structureType,disabled:n,options:cA.map(e=>({...e,selected:e.value===i.structureType}))},{label:i.stage===tA?`Draw Size`:`Structure Size`,field:`drawSize`,type:`number`,value:String(i.drawSize),...n?{disabled:!0}:i.structureType===$k?{validator:nh(0,256),error:`Must be 0-256`}:{validator:nh(2,256),error:`Must be 2-256`}}],c=n?[]:[{control:`structureName`,onChange:({inputs:t})=>e.onUpdateNode(i.id,{structureName:t.structureName.value})},{control:`stage`,onChange:({e:t})=>e.onUpdateNode(i.id,{stage:t.target.value})},{control:`structureType`,onChange:({e:t})=>e.onUpdateNode(i.id,{structureType:t.target.value})},{control:`drawSize`,onChange:({inputs:t})=>{let n=parseInt(t.drawSize.value);if(n<(i.structureType===$k?0:2))return;let r={drawSize:n};if(i.structureType===qk){let e=i.structureOptions?.groupSize||4,t=dA(n);!t.includes(e)&&t.length>0&&(r.structureOptions={...i.structureOptions,groupSize:t[0]})}e.onUpdateNode(i.id,r)}}];i.structureType===qk&&fA(i,r,n,e,s,c),i.stage===iA&&mA(i,r,n,e,s,c),i.stage===nA&&hA(i,n,e,s,c),ui(o,s,c);let l=document.createElement(`div`);l.className=`field font-medium`,l.style.cssText=`flex-grow: 1`;let u=document.createElement(`label`);u.style.cssText=`font-weight: bold; font-size: larger;`,u.textContent=`MatchUp Format`,l.appendChild(u);let d=document.createElement(`div`);if(d.className=`tb-format-trigger`,d.textContent=i.matchUpFormat||`Not set`,n?(d.style.cursor=`default`,d.style.opacity=`0.7`):d.onclick=()=>{Ca({existingMatchUpFormat:i.matchUpFormat,callback:t=>{e.onUpdateNode(i.id,{matchUpFormat:t||void 0}),d.textContent=t||`Not set`}})},l.appendChild(d),o.appendChild(l),gA(i,r,o),!n&&!e.hideDelete){let t=document.createElement(`button`);t.className=`sp-btn sp-btn--danger sp-btn--full`,t.style.marginTop=`12px`,t.textContent=`Delete Structure`,t.onclick=()=>e.onDeleteNode(i.id),o.appendChild(t)}t.appendChild(o)}return{element:t,update:r}}var{WINNER:vA,LOSER:yA,TOP_DOWN:bA,BOTTOM_UP:xA,QUALIFYING:SA,ROUND_ROBIN:CA}=t.drawDefinitionConstants,wA=`POSITION`,TA=`ALTERNATING`,EA=e=>e===CA,DA=[{label:`Winner`,value:vA},{label:`Loser`,value:yA},{label:`Position`,value:wA}],OA=[{label:`Top-Down`,value:bA},{label:`Bottom-Up`,value:xA},{label:`Alternating`,value:TA}];function kA(e){let t=document.createElement(`div`),n=!!e.readOnly;function r(t,r,i,a,o,s){let c=[],l=[],u=r?nk(r.structureType,r.drawSize,r.structureOptions?.groupSize):{},d=u.playoffRoundsRanges&&u.playoffRoundsRanges.length>0;if(d){let e=u.playoffRoundsRanges.map(e=>({label:`R${e.roundNumber} (${e.finishingPositionRange})`,value:String(e.roundNumber),selected:e.roundNumber===(t.sourceRoundNumber||a)}));c.push({label:`Source Round`,field:`sourceRoundNumber`,value:String(t.sourceRoundNumber||a),disabled:n,options:e})}else c.push({label:`Source Round`,field:`sourceRoundNumber`,type:`number`,value:String(t.sourceRoundNumber||a),disabled:n});return c.push({label:s?`Enter at Round`:`Target Round`,field:`targetRoundNumber`,type:`number`,value:String(t.targetRoundNumber||0),disabled:n}),n||(d?l.push({control:`sourceRoundNumber`,onChange:({e:n})=>{let r=Number.parseInt(n.target.value)||0;e.onUpdateEdge(t.id,{sourceRoundNumber:r||void 0})}}):l.push({control:`sourceRoundNumber`,onChange:({inputs:n})=>{let r=Number.parseInt(n.sourceRoundNumber.value)||0,i=Math.max(0,Math.min(r,a));e.onUpdateEdge(t.id,{sourceRoundNumber:i||void 0})}}),l.push({control:`targetRoundNumber`,onChange:({inputs:n})=>{let r=Number.parseInt(n.targetRoundNumber.value)||0,i=Math.max(0,Math.min(r,o));e.onUpdateEdge(t.id,{targetRoundNumber:i||void 0})}})),{items:c,relationships:l}}function i(t,r,i){let a=r.structureOptions?.groupSize||4,o=new Set(t.finishingPositions||[]),s=i.edges.filter(e=>e.id!==t.id&&e.sourceNodeId===t.sourceNodeId&&e.linkType===wA),c=new Set;for(let e of s)for(let t of e.finishingPositions||[])c.add(t);let l=document.createElement(`div`);l.className=`field`,l.style.marginBottom=`10px`;let u=document.createElement(`label`);u.style.cssText=`font-size:11px;font-weight:600;color:var(--chc-text-secondary);margin-bottom:3px;display:block;`,u.textContent=`Finishing Positions`,l.appendChild(u);for(let r=1;r<=a;r++){let i=document.createElement(`label`);i.style.cssText=`display:flex;align-items:center;gap:4px;font-size:12px;padding:2px 0;cursor:pointer;`;let a=document.createElement(`input`);a.type=`checkbox`,a.checked=o.has(r);let s=c.has(r);n||s?a.disabled=!0:a.addEventListener(`change`,()=>{let n=new Set(o);a.checked?n.add(r):n.delete(r),e.onUpdateEdge(t.id,{finishingPositions:Array.from(n).sort((e,t)=>e-t)})});let u=document.createElement(`span`);u.textContent=`Position ${r}`,s&&(u.style.color=`var(--chc-text-muted, #999)`,u.title=`Used by another link`,i.style.opacity=`0.5`,i.style.cursor=`not-allowed`),i.appendChild(a),i.appendChild(u),l.appendChild(i)}return l}function a(a){t.innerHTML=``;let o=a.selectedEdgeId?a.edges.find(e=>e.id===a.selectedEdgeId):null;if(!o)return;let s=a.nodes.find(e=>e.id===o.sourceNodeId),c=a.nodes.find(e=>e.id===o.targetNodeId),l=document.createElement(`div`);l.className=`tb-editor-header`,l.textContent=`Link Properties`,t.appendChild(l);let u=document.createElement(`div`);u.className=`tb-editor-body`;let d=document.createElement(`div`);d.style.cssText=`font-size:11px;color:var(--chc-text-muted);margin-bottom:8px;`,d.textContent=`${s?.structureName||`Source`} → ${c?.structureName||`Target`}`,u.appendChild(d);let f=o.linkType===vA&&s?.stage===SA,p=s?UO(s.structureType,s.drawSize,s.structureOptions):8,m=c?UO(c.structureType,c.drawSize,c.structureOptions):8,h=o.linkType===wA&&s&&EA(s.structureType),g=[{label:`Link Type`,field:`linkType`,value:o.linkType,disabled:n,options:DA.map(e=>({...e,selected:e.value===o.linkType}))}],_=n?[]:[{control:`linkType`,onChange:({e:t})=>e.onUpdateEdge(o.id,{linkType:t.target.value})}];if(!h){let e=r(o,s,c,p,m,f);g.push(...e.items),_.push(...e.relationships)}if(f&&s){let t=Math.floor(s.drawSize/2),r=Math.floor(s.drawSize/4),i=o.qualifyingPositions||r;g.push({label:`Qualifying Positions`,field:`qualifyingPositions`,type:`number`,value:String(i),disabled:n}),n||_.push({control:`qualifyingPositions`,onChange:({inputs:n})=>{let r=Number.parseInt(n.qualifyingPositions.value)||1,i=Math.max(1,Math.min(r,t));e.onUpdateEdge(o.id,{qualifyingPositions:i})}})}if(o.linkType===yA&&(g.push({label:`Feed Profile`,field:`feedProfile`,value:o.feedProfile||bA,disabled:n,options:OA.map(e=>({...e,selected:e.value===(o.feedProfile||bA)}))}),n||_.push({control:`feedProfile`,onChange:({e:t})=>e.onUpdateEdge(o.id,{feedProfile:t.target.value})})),o.linkType===wA&&!h&&(g.push({label:`Finishing Positions`,field:`finishingPositions`,value:(o.finishingPositions||[]).join(`, `),placeholder:`e.g., 1, 2`,disabled:n}),n||_.push({control:`finishingPositions`,onChange:({inputs:t})=>{let n=t.finishingPositions.value.split(`,`).map(e=>Number.parseInt(e.trim())).filter(e=>!Number.isNaN(e));e.onUpdateEdge(o.id,{finishingPositions:n})}})),ui(u,g,_),h&&s&&u.appendChild(i(o,s,a)),!n){let t=document.createElement(`button`);t.className=`sp-btn sp-btn--danger sp-btn--full`,t.style.marginTop=`12px`,t.textContent=`Delete Link`,t.onclick=()=>e.onDeleteEdge(o.id),u.appendChild(t)}t.appendChild(u)}return{element:t,update:a}}var{MAIN:AA,QUALIFYING:jA,CONSOLATION:MA,WINNER:NA,LOSER:PA,SINGLE_ELIMINATION:FA,ROUND_ROBIN:IA,AD_HOC:LA}=t.drawDefinitionConstants,RA=`POSITION`;function zA(e){let t=[],n=BA(e,t);return HA(e,VA(e),t),UA(e,t),WA(e,t),GA(e,t),KA(e,n,t),qA(e,t),JA(e,t),XA(e,t),ZA(e,t),QA(e)&&t.push({severity:`error`,message:`Circular dependency detected between structures`}),t}function BA(e,t){let n=e.nodes.filter(e=>e.stage===AA);return n.length===0?t.push({severity:`error`,message:`A main draw structure is required`}):n.length>1&&t.push({severity:`error`,message:`Only one main draw structure is allowed`}),n}function VA(e){let t=new Set;for(let n of e.edges)n.linkType===NA&&(n.targetRoundNumber||1)>1&&e.nodes.find(e=>e.id===n.sourceNodeId)?.stage===jA&&t.add(n.targetNodeId);let n=new Map;for(let t of e.edges)t.linkType===PA&&n.set(t.targetNodeId,(n.get(t.targetNodeId)||0)+1);for(let[e,r]of n)r>1&&t.add(e);return t}function HA(e,t,n){for(let r of e.nodes){if(r.structureType===FA&&!t.has(r.id)){let t=e.edges.some(e=>e.targetNodeId===r.id);(r.stage===AA||r.stage===jA)&&!t&&(r.drawSize>0&&!(r.drawSize&r.drawSize-1)||n.push({severity:`error`,message:`"${r.structureName}" draw size must be a power of 2`,nodeId:r.id}))}let i=r.structureType===LA?0:2;r.drawSize<i&&n.push({message:`"${r.structureName}" draw size must be at least ${i}`,severity:`error`,nodeId:r.id})}}function UA(e,t){for(let n of e.edges){let r=e.nodes.find(e=>e.id===n.sourceNodeId),i=e.nodes.find(e=>e.id===n.targetNodeId);if(r||t.push({severity:`error`,message:`Edge references missing source node`,edgeId:n.id}),i||t.push({severity:`error`,message:`Edge references missing target node`,edgeId:n.id}),r&&n.sourceRoundNumber){let e=UO(r.structureType,r.drawSize,r.structureOptions);(n.sourceRoundNumber>e||n.sourceRoundNumber<1)&&t.push({severity:`warning`,message:`Edge source round ${n.sourceRoundNumber} is outside "${r.structureName}" range (1-${e})`,edgeId:n.id})}if(i&&n.targetRoundNumber){let e=UO(i.structureType,i.drawSize,i.structureOptions);(n.targetRoundNumber>e||n.targetRoundNumber<1)&&t.push({severity:`warning`,message:`Edge target round ${n.targetRoundNumber} is outside "${i.structureName}" range (1-${e})`,edgeId:n.id})}}}function WA(e,t){let n=new Map;for(let t of e.edges)t.linkType===NA&&(n.has(t.sourceNodeId)||n.set(t.sourceNodeId,[]),n.get(t.sourceNodeId).push(t.id));for(let[r,i]of n)if(i.length>1){let n=e.nodes.find(e=>e.id===r)?.structureName||`Unknown`;for(let e of i)t.push({severity:`error`,message:`"${n}" has multiple winner links (only one allowed)`,edgeId:e})}}function GA(e,t){let n=new Map;for(let t of e.edges)t.sourceRoundNumber&&(n.has(t.sourceNodeId)||n.set(t.sourceNodeId,[]),n.get(t.sourceNodeId).push({round:t.sourceRoundNumber,edgeId:t.id}));for(let[r,i]of n){let n=new Map,a=e.nodes.find(e=>e.id===r)?.structureName||`Unknown`;for(let{round:e,edgeId:r}of i)n.has(e)?t.push({severity:`error`,message:`"${a}" has multiple links from round ${e}`,edgeId:r}):n.set(e,r)}}function KA(e,t,n){let r=e.nodes.filter(e=>e.stage===jA);for(let i of r){let r=e.edges.find(e=>e.sourceNodeId===i.id&&e.linkType===NA&&t.some(t=>t.id===e.targetNodeId));if(r||n.push({severity:`warning`,message:`Qualifying structure "${i.structureName}" has no winner link to a main structure`,nodeId:i.id}),r?.qualifyingPositions){let e=Math.floor(i.drawSize/2);r.qualifyingPositions>e&&n.push({severity:`warning`,message:`Qualifying positions (${r.qualifyingPositions}) exceeds half of "${i.structureName}" draw size (${e})`,edgeId:r.id})}}}function qA(e,t){let n=new Map;for(let t of e.edges){if(t.linkType!==NA)continue;let r=t.targetRoundNumber||1;if(r<=1)continue;let i=e.nodes.find(e=>e.id===t.sourceNodeId);if(!i||i.stage!==jA)continue;n.has(t.targetNodeId)||n.set(t.targetNodeId,[]);let a=i.qualifyingPositions||Math.floor(i.drawSize/4);n.get(t.targetNodeId).push({edgeId:t.id,targetRound:r,qp:a,sourceName:i.structureName})}for(let[r,i]of n){let n=e.nodes.find(e=>e.id===r);if(!n)continue;let a=RO(n.drawSize),o=new Map;for(let e of i)o.set(e.targetRound,(o.get(e.targetRound)||0)+e.qp);for(let{edgeId:e,targetRound:s,sourceName:c}of i)(a.get(s)||0)<(o.get(s)||0)&&t.push({severity:`warning`,message:`"${n.structureName}" round ${s} is not a feed round or has insufficient capacity for ${c} link`,nodeId:r,edgeId:e})}}function JA(e,t){for(let n of e.edges){if(n.linkType!==PA)continue;let r=e.nodes.find(e=>e.id===n.sourceNodeId),i=e.nodes.find(e=>e.id===n.targetNodeId);if(!r||!i)continue;let a=n.sourceRoundNumber||1,o=n.targetRoundNumber||1,s=WO(r.structureType,r.drawSize,a),c=RO(i.drawSize);o!==1&&YA(c,o,s,r,i,a,n.id,t)}}function YA(e,t,n,r,i,a,o,s){let c=e.get(t);c===void 0?s.push({severity:`error`,message:`"${i.structureName}" R${t} is not a feed round — cannot receive ${n} losers from "${r.structureName}" R${a}`,edgeId:o}):n>c?s.push({severity:`error`,message:`"${r.structureName}" R${a} produces ${n} losers but "${i.structureName}" R${t} only has ${c} feed positions`,edgeId:o}):n<c&&s.push({severity:`warning`,message:`"${r.structureName}" R${a} produces ${n} losers but "${i.structureName}" R${t} has ${c} feed positions — ${c-n} will be empty`,edgeId:o})}function XA(e,t){let n=e.nodes.filter(e=>e.stage===MA);for(let r of n){let n=e.edges.filter(e=>e.targetNodeId===r.id);if(n.length===0)continue;let i=0;for(let t of n){let n=e.nodes.find(e=>e.id===t.sourceNodeId);if(n)if(t.linkType===PA){let e=t.sourceRoundNumber||1;i+=WO(n.structureType,n.drawSize,e)}else i+=n.qualifyingPositions||Math.floor(n.drawSize/2)}i>0&&r.drawSize>i&&t.push({severity:`warning`,message:`"${r.structureName}" draw size (${r.drawSize}) exceeds inbound capacity (${i})`,nodeId:r.id}),i>0&&i>r.drawSize&&t.push({severity:`error`,message:`"${r.structureName}" receives ${i} participants but only has ${r.drawSize} positions`,nodeId:r.id})}}function ZA(e,t){let n=new Map;for(let r of e.edges){if(r.linkType!==RA)continue;n.has(r.sourceNodeId)||n.set(r.sourceNodeId,[]),n.get(r.sourceNodeId).push({edgeId:r.id,positions:r.finishingPositions||[]});let i=e.nodes.find(e=>e.id===r.sourceNodeId);if(i&&i.structureType===IA){let e=i.structureOptions?.groupSize||4;for(let n of r.finishingPositions||[])(n<1||n>e)&&t.push({severity:`error`,message:`Position ${n} is outside valid range (1-${e}) for "${i.structureName}"`,edgeId:r.id})}}for(let[r,i]of n){if(i.length<2)continue;let n=e.nodes.find(e=>e.id===r)?.structureName||`Unknown`,a=new Map;for(let{edgeId:e,positions:r}of i)for(let i of r)a.has(i)?t.push({severity:`warning`,message:`Position ${i} from "${n}" is used by multiple POSITION links`,edgeId:e}):a.set(i,e)}}function QA(e){let t=new Map;for(let n of e.nodes)t.set(n.id,[]);for(let n of e.edges){let e=t.get(n.sourceNodeId);e&&e.push(n.targetNodeId)}let n=new Set,r=new Set;function i(e){if(r.has(e))return!0;if(n.has(e))return!1;n.add(e),r.add(e);for(let n of t.get(e)||[])if(i(n))return!0;return r.delete(e),!1}for(let t of e.nodes)if(i(t.id))return!0;return!1}var{MAIN:$A,QUALIFYING:ej,CONSOLATION:tj,PLAY_OFF:nj,LUCKY_DRAW:rj}=t.drawDefinitionConstants;function ij(e,t,n={}){let r=document.createElement(`div`);r.className=`tb-toolbar-wrapper`;let i=document.createElement(`div`);i.className=`tb-toolbar-row`;let a=document.createElement(`div`);a.style.flex=`1`,a.style.minWidth=`0`,i.appendChild(a),r.appendChild(i);let o=document.createElement(`div`);o.className=`tb-validation`,o.style.display=`none`,r.appendChild(o);let s=null,c=()=>{if(!s)return;let e=zA(s);if(o.innerHTML=``,e.length===0){o.style.display=`block`;let e=document.createElement(`div`);e.className=`tb-validation-item`,e.innerHTML=`<span style="color:var(--chc-status-success)">&#10003; Valid topology</span>`,o.appendChild(e)}else{o.style.display=`block`;for(let t of e){let e=document.createElement(`div`);e.className=`tb-validation-item`;let n=document.createElement(`span`);n.className=`tb-validation-icon tb-validation-icon--${t.severity}`,n.textContent=t.severity===`error`?`!`:`?`;let r=document.createElement(`span`);r.textContent=t.message,e.appendChild(n),e.appendChild(r),o.appendChild(e)}}setTimeout(()=>{o.style.display=`none`},5e3)},l=[];if(!n.readOnly){let t=[{label:`Main`,value:$A,onClick:()=>e.onAddStructure($A),close:!0},{label:`Lucky Draw`,value:rj,onClick:()=>e.onAddStructure($A,rj),close:!0},{label:`Qualifying`,value:ej,onClick:()=>e.onAddStructure(ej),close:!0},{label:`Consolation`,value:tj,onClick:()=>e.onAddStructure(tj),close:!0},{label:`Playoff`,value:nj,onClick:()=>e.onAddStructure(nj),close:!0}];l.push({label:`Add Structure`,location:`right`,options:t})}if(!n.hideTemplates&&t.length>0){let n=t.map(n=>({label:n.name,value:n.name,onClick:()=>{let r=t.find(e=>e.name===n.name);r&&e.onLoadTemplate(r)},close:!0}));l.push({label:`Templates`,location:`right`,options:n})}!n.readOnly&&e.onClear&&l.push({label:`Clear`,location:`right`,onClick:()=>e.onClear()}),n.readOnly||l.push({label:`Auto Layout`,location:`right`,onClick:()=>e.onAutoLayout()},{label:`Validate`,location:`right`,onClick:()=>c()}),!n.readOnly&&e.onSaveTemplate&&l.push({label:`Save Template`,location:`right`,intent:`is-success`,onClick:()=>e.onSaveTemplate()}),!n.readOnly&&!n.hideGenerate&&l.push({label:`Generate Draw`,location:`right`,intent:`is-success`,onClick:()=>e.onGenerate()}),IC({target:a,items:l});function u(e){s=e}return{element:r,update:u}}function aj({toolbar:e,canvas:t,nodeEditor:n,edgeEditor:r}){let i=document.createElement(`div`);i.className=`tb-layout`,i.appendChild(e.element);let a=document.createElement(`div`);a.className=`tb-body`,a.appendChild(t.element);let o=document.createElement(`div`);o.className=`tb-editor`,o.appendChild(n.element),o.appendChild(r.element),a.appendChild(o),i.appendChild(a);function s(i){if(e.update(i),t.update(i),n.element.style.display=i.selectedNodeId?``:`none`,r.element.style.display=i.selectedEdgeId?``:`none`,!i.selectedNodeId&&!i.selectedEdgeId){if(!o.querySelector(`.tb-editor-empty`)){let e=document.createElement(`div`);e.className=`tb-editor-empty`,e.textContent=`Select a structure or link to view properties`,o.appendChild(e)}}else{let e=o.querySelector(`.tb-editor-empty`);e&&e.remove()}n.update(i),r.update(i)}function c(){e.destroy?.(),t.destroy?.(),n.destroy?.(),r.destroy?.()}return{element:i,update:s,destroy:c}}var{SINGLE_ELIMINATION:oj,FEED_IN:sj,ROUND_ROBIN:cj,LUCKY_DRAW:lj,MAIN:uj,QUALIFYING:dj,CONSOLATION:fj,PLAY_OFF:pj}=t.drawDefinitionConstants,mj=`WINNER`,hj=`LOSER`,gj=`POSITION`,_j=`tpl-edge-1`,vj=`tpl-edge-2`,yj=`tpl-edge-3`,bj=`tpl-edge-4`,xj=`tpl-edge-5`,Sj=`tpl-edge-6`,Cj=`tpl-edge-7`,wj=`R1 losers → R1`,Tj=[{name:`Single Elimination + Qualifying`,description:`Standard SE main draw with one qualifying structure`,state:{drawName:`SE + Qualifying`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:oj,drawSize:32,position:{x:320,y:40}},{id:`tpl-qual`,structureName:`Qualifying`,stage:dj,structureType:oj,drawSize:16,qualifyingPositions:4,position:{x:40,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-qual`,targetNodeId:`tpl-main`,linkType:mj,targetRoundNumber:1,qualifyingPositions:4,label:`winners → R1 (4Q)`}]}},{name:`FMLC (First Match Loser Consolation)`,description:`Main draw with first match loser consolation`,state:{drawName:`FMLC`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:oj,drawSize:32,position:{x:40,y:40}},{id:`tpl-cons`,structureName:`Consolation`,stage:fj,structureType:oj,drawSize:16,position:{x:320,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj}]}},{name:`Feed-In Championship (FIC)`,description:`Main draw with multi-round fed consolation`,state:{drawName:`FIC`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:oj,drawSize:32,position:{x:40,y:40}},{id:`tpl-cons`,structureName:`Consolation`,stage:fj,structureType:sj,drawSize:31,position:{x:460,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj},{id:vj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:2,targetRoundNumber:2,label:`R2 losers → R2`},{id:yj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:3,targetRoundNumber:4,label:`R3 losers → R4`},{id:bj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:4,targetRoundNumber:6,label:`R4 losers → R6`},{id:xj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:5,targetRoundNumber:8,label:`R5 losers → R8`}]}},{name:`Compass`,description:`8-draw compass structure`,state:{drawName:`Compass`,nodes:[{id:`tpl-east`,structureName:`East`,stage:uj,structureType:oj,drawSize:32,position:{x:40,y:40}},{id:`tpl-west`,structureName:`West`,stage:fj,structureType:oj,drawSize:16,position:{x:400,y:40}},{id:`tpl-north`,structureName:`North`,stage:fj,structureType:oj,drawSize:8,position:{x:400,y:210}},{id:`tpl-ne`,structureName:`Northeast`,stage:fj,structureType:oj,drawSize:4,position:{x:400,y:380}},{id:`tpl-south`,structureName:`South`,stage:fj,structureType:oj,drawSize:8,position:{x:680,y:40}},{id:`tpl-sw`,structureName:`Southwest`,stage:fj,structureType:oj,drawSize:4,position:{x:680,y:210}},{id:`tpl-nw`,structureName:`Northwest`,stage:fj,structureType:oj,drawSize:4,position:{x:680,y:380}},{id:`tpl-se`,structureName:`Southeast`,stage:fj,structureType:oj,drawSize:4,position:{x:960,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-east`,targetNodeId:`tpl-west`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj},{id:vj,sourceNodeId:`tpl-east`,targetNodeId:`tpl-north`,linkType:hj,sourceRoundNumber:2,targetRoundNumber:1,label:`R2 losers → R1`},{id:yj,sourceNodeId:`tpl-east`,targetNodeId:`tpl-ne`,linkType:hj,sourceRoundNumber:3,targetRoundNumber:1,label:`R3 losers → R1`},{id:bj,sourceNodeId:`tpl-west`,targetNodeId:`tpl-south`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj},{id:xj,sourceNodeId:`tpl-west`,targetNodeId:`tpl-sw`,linkType:hj,sourceRoundNumber:2,targetRoundNumber:1,label:`R2 losers → R1`},{id:Sj,sourceNodeId:`tpl-north`,targetNodeId:`tpl-nw`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj},{id:Cj,sourceNodeId:`tpl-south`,targetNodeId:`tpl-se`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj}]}},{name:`Round Robin + Playoff`,description:`Round robin groups with winners and consolation playoffs`,state:{drawName:`RR + Playoff`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:cj,drawSize:16,structureOptions:{groupSize:4},position:{x:40,y:40}},{id:`tpl-playoff-gold`,structureName:`Gold Flight`,stage:pj,structureType:oj,drawSize:8,position:{x:320,y:40}},{id:`tpl-playoff-silver`,structureName:`Silver Flight`,stage:pj,structureType:oj,drawSize:8,position:{x:320,y:220}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-playoff-gold`,linkType:gj,finishingPositions:[1,2],label:`positions 1,2`},{id:vj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-playoff-silver`,linkType:gj,finishingPositions:[3,4],label:`positions 3,4`}]}},{name:`Lucky Draw + Consolation`,description:`Lucky draw main with consolation receiving R1 losers`,state:{drawName:`Lucky + Consolation`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:lj,drawSize:11,position:{x:40,y:40}},{id:`tpl-cons`,structureName:`Consolation`,stage:fj,structureType:oj,drawSize:4,position:{x:340,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj}]}},{name:`Lucky Draw → Round Robin`,description:`Lucky draw main with R1 losers feeding into round robin consolation`,state:{drawName:`Lucky → RR`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:lj,drawSize:25,position:{x:40,y:40}},{id:`tpl-cons-rr`,structureName:`Consolation RR`,stage:fj,structureType:cj,drawSize:12,structureOptions:{groupSize:4},position:{x:500,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons-rr`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj}]}},{name:`Adaptive (drawSize 11)`,description:`Compass-like multi-structure topology with lucky draw structures`,state:{drawName:`Adaptive`,nodes:[{id:`tpl-east`,structureName:`East`,stage:uj,structureType:lj,drawSize:11,position:{x:40,y:40}},{id:`tpl-west`,structureName:`West`,stage:fj,structureType:lj,drawSize:6,position:{x:340,y:40}},{id:`tpl-north`,structureName:`North`,stage:fj,structureType:oj,drawSize:2,position:{x:340,y:250}},{id:`tpl-south`,structureName:`South`,stage:fj,structureType:oj,drawSize:2,position:{x:600,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-east`,targetNodeId:`tpl-west`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:`R1 losers → R1 (6 losers)`},{id:vj,sourceNodeId:`tpl-east`,targetNodeId:`tpl-north`,linkType:hj,sourceRoundNumber:2,targetRoundNumber:1,label:`R2 losers → R1 (2 losers)`},{id:yj,sourceNodeId:`tpl-west`,targetNodeId:`tpl-south`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:`R1 losers → R1 (2 losers)`}]}}],{MAIN:Ej,QUALIFYING:Dj,CONSOLATION:Oj,PLAY_OFF:kj,SINGLE_ELIMINATION:Aj,LUCKY_DRAW:jj,WINNER:Mj,LOSER:Nj}=t.drawDefinitionConstants,Pj=`POSITION`,Fj=class{constructor(e={}){this.config=e,this.store=new Pk(e.initialState);let t=[...Tj,...e.templates||[]],n=!!e.readOnly;this.layout=aj({toolbar:this.buildToolbarPanel(t,n),canvas:this.buildCanvasPanel(n),nodeEditor:_A({onUpdateNode:n?()=>{}:(e,t)=>this.store.updateNode(e,t),onUpdateEdge:n?()=>{}:(e,t)=>this.store.updateEdge(e,t),onDeleteNode:n?()=>{}:e=>this.store.removeNode(e),readOnly:n,hideDelete:e.hideDelete}),edgeEditor:kA({onUpdateEdge:n?()=>{}:(e,t)=>this.store.updateEdge(e,t),onDeleteEdge:n?()=>{}:e=>this.store.removeEdge(e),readOnly:n})}),this.unsubscribe=this.store.subscribe(e=>{this.layout.update(e)}),this.layout.update(this.store.getState())}buildToolbarPanel(e,t){return ij({onAddStructure:(e,t)=>this.addDefaultStructure(e,t),onLoadTemplate:e=>{this.store.loadState({...e.state,selectedNodeId:null,selectedEdgeId:null,templateName:e.name})},onAutoLayout:()=>{this.store.autoLayout();let e=this.store.getState();this.store.loadState(e)},onGenerate:()=>this.handleGenerate(),onSaveTemplate:this.config.onSaveTemplate?()=>this.config.onSaveTemplate(this.store.getState()):void 0,onClear:this.config.onClear},e,{hideTemplates:this.config.hideTemplates,hideGenerate:this.config.hideGenerate,readOnly:t})}buildCanvasPanel(e){return Gk({onSelectNode:e=>this.store.selectNode(e),onSelectEdge:e=>this.store.selectEdge(e),onDoubleClickNode:this.config.onDoubleClickNode?e=>{let t=this.store.getState(),n=t.nodes.find(t=>t.id===e);n&&this.config.onDoubleClickNode(n,t)}:void 0,onMoveNode:(e,t,n)=>this.store.updateNode(e,{position:{x:t,y:n}}),onCreateEdge:e?()=>{}:(e,t,n)=>{this.handleCreateEdge(e,t,n)},onPortMouseDown:()=>{}})}handleCreateEdge(e,t,n){let r=this.store.getState().nodes.find(t=>t.id===e);if(n===Pj){let i=this.store.getState().edges.filter(t=>t.sourceNodeId===e&&t.linkType===Pj),a=new Set(i.flatMap(e=>e.finishingPositions||[])),o=r?.structureOptions?.groupSize||4,s=1;for(let e=1;e<=o;e++)if(!a.has(e)){s=e;break}this.store.addEdge({sourceNodeId:e,targetNodeId:t,linkType:n,finishingPositions:[s]})}else if(n===Nj){let i=this.store.getState().edges.filter(t=>t.sourceNodeId===e&&t.linkType===Nj),a=new Set(i.map(e=>e.sourceRoundNumber)),o=r?UO(r.structureType,r.drawSize,r.structureOptions):1,s=1;for(let e=1;e<=o;e++)if(!a.has(e)){s=e;break}this.store.addEdge({sourceNodeId:e,targetNodeId:t,linkType:n,sourceRoundNumber:s})}else{let i=n===Mj&&r?.stage===Dj;this.store.addEdge({sourceNodeId:e,targetNodeId:t,linkType:n,...i&&{targetRoundNumber:1}})}}render(e){e.appendChild(this.layout.element)}destroy(){this.unsubscribe(),this.layout.destroy?.(),this.layout.element.remove()}autoLayout(){this.store.autoLayout();let e=this.store.getState();this.store.loadState(e)}getState(){return this.store.getState()}loadState(e){this.store.loadState(e)}addDefaultStructure(e,t){let n=t===jj,r=this.store.getState().nodes.filter(t=>t.stage===e).length,i={[Ej]:n?`Lucky Draw`:`Main Draw`,[Dj]:`Qualifying ${r+1}`,[Oj]:`Consolation`,[kj]:`Playoff ${r+1}`},a={[Ej]:n?11:32,[Dj]:16,[Oj]:16,[kj]:4}[e]||16,o=this.store.addNode({structureName:i[e]||e,stage:e,structureType:t||Aj,drawSize:a,...e===Dj&&{qualifyingPositions:Math.floor(a/4)}});this.scrollCanvasToNode(o)}scrollCanvasToNode(e){let t=this.layout.element.querySelector(`.tb-canvas`);t&&requestAnimationFrame(()=>{let n=e.position.x+_k(e)+40;n>t.scrollLeft+t.clientWidth&&t.scrollTo({left:n-t.clientWidth,behavior:`smooth`})})}handleGenerate(){let e=this.store.getState(),t=zA(e);t.some(e=>e.severity===`error`)&&console.warn(`Topology validation errors:`,t),this.config.onGenerate&&this.config.onGenerate(e)}},{MAIN:Ij,CONSOLATION:Lj,QUALIFYING:Rj,PLAY_OFF:zj,SINGLE_ELIMINATION:Bj,FEED_IN:Vj,FIRST_MATCH_LOSER_CONSOLATION:Hj,FEED_IN_CHAMPIONSHIP:Uj,COMPASS:Wj,WINNER:Gj,LOSER:Kj,ROUND_ROBIN:qj,AD_HOC:Jj,LUCKY_DRAW:Yj}=t.drawDefinitionConstants,Xj=`POSITION`;function Zj(e,t){let n=e.nodes.filter(e=>e.stage===Lj),r=e.nodes.filter(e=>e.stage===Rj),i=e.nodes.filter(e=>e.stage===zj);if(t.structureType===qj)return e.edges.some(n=>n.sourceNodeId===t.id&&n.linkType===Xj&&e.nodes.some(e=>e.id===n.targetNodeId&&e.stage===zj))?`ROUND_ROBIN_WITH_PLAYOFF`:qj;if(t.structureType===Jj)return Jj;if(t.structureType===Vj)return Vj;if(t.structureType===Yj)return Yj;if(n.length===7&&r.length===0&&i.length===0){let n=e.edges.filter(e=>e.linkType===Kj&&e.sourceNodeId===t.id),r=new Set(n.map(e=>e.sourceRoundNumber));if(r.has(1)&&r.has(2)&&r.has(3))return Wj}if(n.length===1&&r.length===0&&i.length===0){let r=n[0],i=e.edges.filter(e=>e.linkType===Kj&&e.sourceNodeId===t.id&&e.targetNodeId===r.id);if(r.structureType===Vj||i.length>1)return Uj;if(i.length===1&&i[0].sourceRoundNumber===1)return Hj}return Bj}function Qj(e){let t=e.nodes.find(e=>e.stage===Ij);if(!t)throw Error(`No main structure node found`);let n=e.nodes.filter(e=>e.stage===Rj),r=e.nodes.filter(e=>e.stage===zj),i=Zj(e,t);i===Bj&&!rM(t.drawSize)&&(i=Vj);let a={drawName:e.drawName,drawType:i,drawSize:t.drawSize,matchUpFormat:t.matchUpFormat||void 0,structureOptions:t.structureOptions||void 0,automated:!0};n.length>0&&tM(a,n,e.edges);let o=[];return $j(e,t,i,o),eM(e,t,r,a),{drawOptions:a,postGenerationMethods:o}}function $j(e,t,n,r){let i=e.nodes.filter(e=>e.stage===Lj),a=e.edges.filter(e=>e.linkType===Kj&&e.sourceNodeId===t.id&&i.some(t=>t.id===e.targetNodeId)),o=[Hj,Uj,Wj];if(a.length===0||o.includes(n))return;let s=new Map;for(let e of a)s.has(e.targetNodeId)||s.set(e.targetNodeId,[]),s.get(e.targetNodeId).push(e);for(let[e,t]of s){let n=i.find(t=>t.id===e);if(!n)continue;let a=t.map(e=>({sourceRoundNumber:e.sourceRoundNumber||1,targetRoundNumber:e.targetRoundNumber||1}));r.push({method:`attachConsolationStructures`,params:{structureName:n.structureName,structureType:n.structureType,drawSize:n.drawSize,matchUpFormat:n.matchUpFormat||void 0,structureOptions:n.structureOptions||void 0,links:a}})}}function eM(e,t,n,r){let i=t.structureType===qj,a=i?e.edges.filter(e=>e.sourceNodeId===t.id&&e.linkType===Xj&&n.some(t=>t.id===e.targetNodeId)):[];if(i&&a.length>0){let e=new Map;for(let t of a)e.has(t.targetNodeId)||e.set(t.targetNodeId,[]),e.get(t.targetNodeId).push(t);let t=[];for(let[r,i]of e){let e=n.find(e=>e.id===r);if(!e)continue;let a=Array.from(new Set(i.flatMap(e=>e.finishingPositions||[]))).sort((e,t)=>e-t),o=e.structureOptions?.playoffDrawType||Bj,s={finishingPositions:a,structureName:e.structureName,drawType:o};o===qj&&e.structureOptions?.groupSize&&(s.structureOptions={groupSize:e.structureOptions.groupSize}),t.push(s)}t.length>0&&(r.structureOptions={...r.structureOptions,playoffGroups:t})}else if(n.length>0){let i=nM(t.id,n,e.edges);i&&(r.withPlayoffs=i)}}function tM(e,t,n){let r=n.filter(e=>e.linkType===Gj&&t.some(t=>t.id===e.sourceNodeId)),i={};for(let e of t){let t=r.find(t=>t.sourceNodeId===e.id),n=t?.targetRoundNumber||1;i[n]||(i[n]=[]),i[n].push({node:e,edge:t})}let a=0;e.qualifyingProfiles=Object.entries(i).map(([e,t])=>{let n=t.map(({node:e,edge:t})=>{let n=e.qualifyingPositions||t?.qualifyingPositions||Math.floor(e.drawSize/4);return a+=n,{structureName:e.structureName,drawType:e.structureType,drawSize:e.drawSize,qualifyingPositions:n,seedsCount:0}});return{roundTarget:Number(e),structureProfiles:n}}),e.qualifiersCount=a,e.qualifyingPlaceholder=!0}function nM(e,t,n){let r=n.filter(n=>n.sourceNodeId===e&&n.linkType===Kj&&t.some(e=>e.id===n.targetNodeId));if(!r.length)return;let i=[],a={},o={};for(let e of r){if(!e.sourceRoundNumber)continue;let r=t.find(t=>t.id===e.targetNodeId);if(!r)continue;i.push({[e.sourceRoundNumber]:1});let s=`0-${i.length}`;a[s]={name:r.structureName,abbreviation:r.structureName.substring(0,3)};let c=nM(r.id,t,n);c&&(o[e.sourceRoundNumber]=c)}if(i.length)return{roundProfiles:i,...Object.keys(a).length>0&&{playoffAttributes:a},...Object.keys(o).length>0&&{roundPlayoffs:o}}}function rM(e){return e>0&&(e&e-1)==0}var{MAIN:iM}=t.drawDefinitionConstants,aM=()=>`spl-layout`,oM=()=>`spl-left`,sM=()=>`spl-toggle`,cM=()=>`spl-center`,lM=()=>`spl-center-header`,uM=()=>`spl-center-title`,dM=()=>`spl-center-meta`,fM=()=>`spl-grid-slot`,pM=()=>`spl-right`,mM=()=>`spl-matchup-card`,hM=()=>`spl-card-title`,gM=()=>`spl-card-sides`,_M=()=>`spl-card-meta`,vM=()=>`spl-card-chips`,yM=()=>`spl-card-chip`,bM=()=>`sp-panel`,xM=()=>`sp-panel-header`,SM=()=>`sp-panel-title`,CM=()=>`sp-panel-meta`,wM=()=>`sp-date-strip`,TM=()=>`sp-date-chip`,EM=()=>`sp-badges`,DM=()=>`sp-catalog`,OM=()=>`sp-catalog-toolbar`,kM=()=>`sp-input`,AM=()=>`sp-select`,jM=()=>`sp-group`,MM=()=>`sp-group-header`,NM=()=>`sp-group-body`,PM=()=>`sp-group-chevron`,FM=()=>`sp-issues`,IM=()=>`sp-issue`,LM=()=>`sp-issue-code`,RM=()=>`sp-issue-msg`,zM=()=>`sp-inspector`,BM=()=>`sp-kv`,VM=()=>`sp-kv-key`,HM=()=>`sp-kv-value`,UM=()=>`sp-small`;function WM(e,t,n){let r=!!n?.hideLeft,i=n?.catalogSide===`left`,a=document.createElement(`div`);a.className=aM();let o=null,s=null;if(r)i?a.classList.add(`spl-catalog-left`):a.classList.add(`spl-no-left`);else{o=document.createElement(`div`),o.className=oM(),s=document.createElement(`button`),s.className=sM(),s.textContent=`◀`,s.title=`Toggle sidebar`,s.addEventListener(`click`,()=>t.onToggleLeft()),o.appendChild(s);let n=document.createElement(`div`);n.className=`spl-left-content`,n.style.cssText=`display:flex;flex-direction:column;gap:12px;flex:1;min-height:0`,e.dateStrip.element.style.flex=`1`,e.dateStrip.element.style.minHeight=`0`,e.dateStrip.element.style.overflow=`auto`,n.appendChild(e.dateStrip.element),e.issuesPanel.element.style.flex=`1`,e.issuesPanel.element.style.minHeight=`0`,e.issuesPanel.element.style.overflow=`auto`,n.appendChild(e.issuesPanel.element),o.appendChild(n)}let c=e.courtGridSlot.element,l=document.createElement(`div`);l.className=pM(),e.matchUpCatalog.element.style.flex=`3`,e.matchUpCatalog.element.style.minHeight=`0`,e.matchUpCatalog.element.style.overflow=`auto`,l.appendChild(e.matchUpCatalog.element),e.inspectorPanel.element.style.flex=`1`,e.inspectorPanel.element.style.minHeight=`120px`,e.inspectorPanel.element.style.overflow=`auto`,l.appendChild(e.inspectorPanel.element),o&&a.appendChild(o),i&&r?(a.appendChild(l),a.appendChild(c)):(a.appendChild(c),a.appendChild(l));function u(t){r||(t.leftCollapsed?(a.classList.add(`spl-left-collapsed`),s&&(s.textContent=`▶`)):(a.classList.remove(`spl-left-collapsed`),s&&(s.textContent=`◀`)),e.dateStrip.update(t),e.issuesPanel.update(t)),e.courtGridSlot.update(t),e.matchUpCatalog.update(t),e.inspectorPanel.update(t)}return{element:a,update:u}}function GM(e){let t=e.sides;if(t?.length===2){let e=KM(t[0]),n=KM(t[1]);if(e&&n)return`${e} vs ${n}`;if(e)return`${e} vs TBD`;if(n)return`TBD vs ${n}`}return`TBD vs TBD`}function KM(e){return e?`${e.participantName??``}${e.seedNumber?` [${e.seedNumber}]`:``}`:``}function qM(e){let t=[e.eventName,e.drawName??``,e.roundName??``];if(e.sides)for(let n of e.sides)n.participantName&&t.push(n.participantName);return t.join(` `).toLowerCase()}function JM(){let e=document.createElement(`div`);e.className=bM();let t=document.createElement(`div`);t.className=xM();let n=document.createElement(`div`);n.className=SM(),n.textContent=`Inspector`,t.appendChild(n),e.appendChild(t);let r=document.createElement(`div`);r.className=zM(),e.appendChild(r);function i(e){r.innerHTML=``;let t=e.selectedMatchUp;if(!t){let e=document.createElement(`div`);e.className=UM(),e.textContent=`Select a matchUp in the catalog to see details.`,r.appendChild(e);return}if(YM(r,`Event`,t.eventName),YM(r,`Draw`,t.drawName??t.drawId),YM(r,`Round`,t.roundName??`Round ${t.roundNumber}`),YM(r,`Type`,t.matchUpType??`—`),YM(r,`Format`,t.matchUpFormat??`—`),YM(r,`Scheduled`,t.isScheduled?`Yes`:`No`),t.scheduledTime&&YM(r,`Time`,t.scheduledTime),t.scheduledCourtName&&YM(r,`Court`,t.scheduledCourtName),t.sides?.length){let e=document.createElement(`div`);e.className=UM(),e.style.marginTop=`8px`,e.textContent=`Participants:`,r.appendChild(e);let n=document.createElement(`div`);n.className=`spl-inspector-sides`;for(let e of t.sides){let t=document.createElement(`div`);t.className=`spl-inspector-side`;let r=document.createElement(`span`);if(r.textContent=KM(e)||`TBD`,t.appendChild(r),e.ranking){let n=document.createElement(`span`);n.className=`spl-inspector-seed`,n.textContent=`#${e.ranking}`,t.appendChild(n)}n.appendChild(t)}r.appendChild(n)}}return{element:e,update:i}}function YM(e,t,n){let r=document.createElement(`div`);r.className=BM();let i=document.createElement(`div`);i.className=VM(),i.textContent=t;let a=document.createElement(`div`);a.className=HM(),a.textContent=n,r.appendChild(i),r.appendChild(a),e.appendChild(r)}var XM=new Set([`COMPLETED`,`RETIRED`,`WALKOVER`,`DEFAULTED`,`DOUBLE_WALKOVER`,`DOUBLE_DEFAULT`,`CANCELLED`,`ABANDONED`,`DEAD_RUBBER`]);function ZM(e){return!!e&&XM.has(e)}function QM(e,t,n=`dim`,r,i=!1){let a=t.toLowerCase().trim();return e.filter(e=>n===`hide`&&e.isScheduled||!i&&ZM(e.matchUpStatus)||r&&(r.eventType&&e.matchUpType!==r.eventType||r.eventName&&e.eventName!==r.eventName||r.drawName&&(e.drawName??e.drawId)!==r.drawName||r.gender&&e.gender!==r.gender||r.roundName&&e.roundName!==r.roundName)?!1:a?qM(e).includes(a):!0)}function $M(e,t){let n=new Map,r=e=>t===`draw`?`${e.eventName} \u2014 ${e.drawName??e.drawId}`:t===`round`?e.roundName??`Round ${e.roundNumber}`:t===`structure`?`${e.eventName} \u2014 ${e.structureId}`:e.eventName;for(let t of e){let e=r(t),i=n.get(e);i?i.push(t):n.set(e,[t])}return new Map([...n.entries()].sort((e,t)=>e[0].localeCompare(t[0],void 0,{numeric:!0})))}function eN(e,t){let n=document.createElement(`div`);n.className=mM(),n.setAttribute(`data-matchup-id`,e.matchUpId);let r=ZM(e.matchUpStatus);e.isScheduled?(n.classList.add(`scheduled`),n.draggable=!1):r?(n.classList.add(`completed`),n.draggable=!1):(n.draggable=!0,n.addEventListener(`dragstart`,t=>{t.stopPropagation(),t.dataTransfer.setDragImage(n,n.offsetWidth/2,20),t.dataTransfer.setData(`application/json`,JSON.stringify({type:`CATALOG_MATCHUP`,matchUp:e})),t.dataTransfer.effectAllowed=`copyMove`})),t.onClick&&n.addEventListener(`click`,n=>{n.stopPropagation(),t.onClick(e)});let i=document.createElement(`div`);i.className=hM(),i.textContent=`${e.eventName} \u2014 ${e.roundName??`Round `+e.roundNumber}`,n.appendChild(i);let a=document.createElement(`div`);a.className=gM(),a.textContent=GM(e),n.appendChild(a);let o=document.createElement(`div`);o.className=_M();let s=[];e.drawName&&s.push(e.drawName),e.matchUpType&&s.push(e.matchUpType.toLowerCase()),o.textContent=s.join(` · `),n.appendChild(o);let c=document.createElement(`div`);if(c.className=vM(),e.scheduledTime&&c.appendChild(tN(e.scheduledTime,`time`)),e.scheduledCourtName&&c.appendChild(tN(e.scheduledCourtName,`court`)),e.matchUpFormat&&c.appendChild(tN(e.matchUpFormat,`type`)),r&&e.matchUpStatus){let t=e.matchUpStatus.replace(/_/g,` `);c.appendChild(tN(t,`status`))}if(c.children.length&&n.appendChild(c),e.isScheduled){let e=document.createElement(`span`);e.className=`spl-matchup-check`,e.textContent=`✓`,n.appendChild(e)}return n}function tN(e,t){let n=document.createElement(`div`);return n.className=yM()+` `+t,n.textContent=e,n}function nN(e,t){let n=new Set;for(let r of e){let e=t(r);e&&n.add(e)}return[...n].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function rN(e){let t=document.createElement(`div`);t.className=bM();let n=`spl-catalog-drop-over`,r=new Set,i=null,a,o={};t.addEventListener(`dragover`,e=>{e.preventDefault(),t.classList.add(n),e.dataTransfer.dropEffect=`move`}),t.addEventListener(`dragleave`,e=>{t.contains(e.relatedTarget)||t.classList.remove(n)}),t.addEventListener(`drop`,r=>{if(t.classList.remove(n),r.preventDefault(),!e.onDropRemove)return;let i;try{i=JSON.parse(r.dataTransfer.getData(`application/json`))}catch{return}(i.type===`CATALOG_MATCHUP`||i.type===`GRID_MATCHUP`)&&e.onDropRemove(i.matchUp.matchUpId)});let s=document.createElement(`div`);s.className=xM();let c=document.createElement(`div`);c.className=`spl-catalog-title-row`;let l=document.createElement(`div`);l.className=SM(),l.textContent=`MatchUp Catalog`;let u=document.createElement(`button`);u.className=`spl-catalog-filter-btn`,u.title=`Filter matchUps`,u.innerHTML=`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/></svg>`,c.appendChild(l),c.appendChild(u);let d=document.createElement(`div`);d.className=CM(),s.appendChild(c),s.appendChild(d),t.appendChild(s);let f=document.createElement(`div`);f.className=OM();let p=document.createElement(`input`);p.type=`text`,p.placeholder=`Search matchUps...`,p.className=kM(),p.addEventListener(`input`,()=>e.onSearchChange(p.value));let m=document.createElement(`select`);m.className=AM();for(let[e,t]of[[`event`,`By Event`],[`draw`,`By Draw`],[`round`,`By Round`],[`structure`,`By Structure`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,m.appendChild(n)}m.addEventListener(`change`,()=>e.onGroupByChange(m.value)),f.appendChild(p),f.appendChild(m),t.appendChild(f);function h(){a&&=(a.destroy(),void 0)}function g(){return!!(o.eventType||o.eventName||o.drawName||o.gender||o.roundName)}function _(){u.classList.toggle(`active`,g())}function v(){let t=i?.matchUpCatalog??[],n=document.createElement(`div`);n.className=`spl-filter-popover`;let r=document.createElement(`div`);r.className=`spl-filter-header`;let a=document.createElement(`button`);a.className=`spl-filter-clear-btn`,a.textContent=`Clear All`,a.addEventListener(`click`,t=>{t.stopPropagation(),o={},e.onFilterChange(o),_();for(let e of n.querySelectorAll(`select`))e.value=``}),r.appendChild(a);let s=document.createElement(`button`);s.className=`spl-filter-close-btn`,s.textContent=`×`,s.addEventListener(`click`,e=>{e.stopPropagation(),h()}),r.appendChild(s),n.appendChild(r);let c=[{label:`All Event Types`,key:`eventType`,values:nN(t,e=>e.matchUpType)},{label:`All Events`,key:`eventName`,values:nN(t,e=>e.eventName)},{label:`All Flights`,key:`drawName`,values:nN(t,e=>e.drawName)},{label:`All Genders`,key:`gender`,values:nN(t,e=>e.gender)},{label:`All Rounds`,key:`roundName`,values:nN(t,e=>e.roundName)}];for(let t of c){if(t.values.length<2)continue;let r=document.createElement(`label`);r.className=`spl-filter-label`,r.textContent=t.label,n.appendChild(r);let i=document.createElement(`select`);i.className=`spl-filter-select`;let a=document.createElement(`option`);a.value=``,a.textContent=t.label,i.appendChild(a);for(let e of t.values){let t=document.createElement(`option`);t.value=e,t.textContent=e,i.appendChild(t)}i.value=o[t.key]??``,i.addEventListener(`change`,()=>{o={...o,[t.key]:i.value||void 0},e.onFilterChange(o),_()}),n.appendChild(i)}let l=document.createElement(`label`);l.className=`spl-filter-toggle`;let u=document.createElement(`input`);u.type=`checkbox`,u.checked=i?.showScheduled??!1,u.addEventListener(`change`,()=>{e.onShowScheduledChange?.(u.checked)}),l.appendChild(u),l.appendChild(document.createTextNode(` Show assigned`)),n.appendChild(l);let d=document.createElement(`label`);d.className=`spl-filter-toggle`;let f=document.createElement(`input`);return f.type=`checkbox`,f.checked=i?.showCompleted??!1,f.addEventListener(`change`,()=>{e.onShowCompletedChange(f.checked)}),d.appendChild(f),d.appendChild(document.createTextNode(` Show completed`)),n.appendChild(d),n}u.addEventListener(`click`,()=>{h(),a=mm(u,{content:v(),placement:`bottom-start`,interactive:!0,trigger:`manual`,appendTo:()=>t,onClickOutside:()=>h(),theme:``}),a.show()});let y=document.createElement(`div`);y.className=DM(),t.appendChild(y);function b(t){i=t,o=t.catalogFilters??{},_();let n=t.showScheduled?t.scheduledBehavior:`hide`,a=QM(t.matchUpCatalog,t.catalogSearchQuery,n,t.catalogFilters,t.showCompleted),s=$M(a,t.catalogGroupBy);d.textContent=`${a.filter(e=>!e.isScheduled).length} unscheduled`,p.value!==t.catalogSearchQuery&&(p.value=t.catalogSearchQuery),m.value!==t.catalogGroupBy&&(m.value=t.catalogGroupBy),y.innerHTML=``;for(let[n,a]of s){let o=document.createElement(`div`);o.className=jM();let s=r.has(n),c=document.createElement(`div`);c.className=MM();let l=document.createElement(`span`);l.className=PM(),l.textContent=s?`▶`:`▼`;let u=document.createElement(`span`);u.textContent=`${n} (${a.length})`,c.appendChild(l),c.appendChild(u),c.addEventListener(`click`,()=>{r.has(n)?r.delete(n):r.add(n),i&&b(i)});let d=document.createElement(`div`);d.className=NM(),s&&(d.style.display=`none`);for(let n of a){let r=eN(n,{onClick:t=>e.onMatchUpSelected?.(t)});t.selectedMatchUp?.matchUpId===n.matchUpId&&r.classList.add(`selected`),d.appendChild(r)}o.appendChild(c),o.appendChild(d),y.appendChild(o)}}return{element:t,update:b}}function iN(e){let t={ERROR:[],WARN:[],INFO:[]},n={},r={total:e.length,ERROR:0,WARN:0,INFO:0},i={},a=e=>e===`ERROR`?0:e===`WARN`?1:2;for(let a of e)if(t[a.severity].push(a),r[a.severity]++,a.date){(n[a.date]??=[]).push(a);let e=i[a.date]??={total:0,ERROR:0,WARN:0,INFO:0};e.total++,e[a.severity]++}let o=(e,t)=>a(e.severity)-a(t.severity)||e.message.localeCompare(t.message),s=[...e].sort(o);for(let e of Object.keys(t))t[e].sort(o);for(let e of Object.keys(n))n[e].sort(o);return{all:s,bySeverity:t,byDate:n,counts:r,countsByDate:i}}var aN=`spl-cell--issue-pulse`;function oN(){let e=document.createElement(`div`);e.className=bM();let t=document.createElement(`div`);t.className=xM();let n=document.createElement(`div`);n.className=SM(),n.textContent=`Issues`;let r=document.createElement(`div`);r.className=CM(),t.appendChild(n),t.appendChild(r),e.appendChild(t);let i=document.createElement(`div`);i.className=FM(),e.appendChild(i);function a(e){let t=iN(e.issues);if(r.textContent=`${t.counts.total} total (${t.counts.ERROR} errors)`,i.innerHTML=``,!t.all.length){let e=document.createElement(`div`);e.className=UM(),e.textContent=`No scheduling conflicts.`,i.appendChild(e);return}for(let e of t.all.slice(0,30)){let t=document.createElement(`div`);t.className=IM(),e.severity===`ERROR`?t.classList.add(`error`):e.severity===`WARN`?t.classList.add(`warn`):t.classList.add(`info`);let n=document.createElement(`div`);n.className=LM(),n.textContent=e.severity;let r=document.createElement(`div`);if(r.className=RM(),e.participants){if(e.prefix){let t=document.createElement(`span`);t.textContent=e.prefix,t.style.opacity=`0.7`,r.appendChild(t)}let t=document.createElement(`span`);t.textContent=(e.issueType||``)+`: `,t.style.opacity=`0.7`,r.appendChild(t);let n=document.createElement(`span`);if(n.textContent=e.participants,n.style.color=`var(--spl-issue-participant1, #4fc3f7)`,n.style.fontWeight=`600`,r.appendChild(n),e.conflictParticipants?.length){let t=document.createElement(`span`);t.textContent=` conflicts with `,t.style.opacity=`0.7`,r.appendChild(t),e.conflictParticipants.forEach((e,t)=>{if(t>0){let e=document.createElement(`span`);e.textContent=`, `,e.style.opacity=`0.7`,r.appendChild(e)}let n=document.createElement(`span`);n.textContent=e,n.style.color=`var(--spl-issue-participant2, #ffb74d)`,n.style.fontWeight=`600`,r.appendChild(n)})}}else r.textContent=e.message;if(e.matchUpId){t.style.cursor=`pointer`;let n=e.matchUpId;t.addEventListener(`click`,()=>{console.log(`[issuesPanel] clicked issue row, matchUpId:`,n),o(n)})}else console.log(`[issuesPanel] issue has no matchUpId:`,e.message);t.appendChild(n),t.appendChild(r),i.appendChild(t)}}function o(e){let t=`.spl-grid-cell[data-matchup-id="${e}"]`,n=document.querySelector(t);console.log(`[issuesPanel] scrollToMatchUp selector:`,t,`found:`,!!n),n&&(n.scrollIntoView({behavior:`smooth`,block:`center`,inline:`center`}),n.classList.remove(aN),n.offsetWidth,n.classList.add(aN),n.addEventListener(`animationend`,()=>n.classList.remove(aN),{once:!0}))}return{element:e,update:a}}function sN(e){let t=document.createElement(`div`);t.className=bM();let n=document.createElement(`div`);n.className=xM();let r=document.createElement(`div`);r.className=SM(),r.textContent=`Dates`;let i=document.createElement(`div`);i.className=CM(),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=wM(),t.appendChild(a);function o(t){let n=t.scheduleDates;i.textContent=`${n.length} dates`,a.innerHTML=``;for(let r of n){let n=document.createElement(`div`);n.className=TM(),r.date===t.selectedDate&&n.classList.add(`selected`),r.isActive||n.classList.add(`inactive`),n.setAttribute(`data-date`,r.date);let i=document.createElement(`div`),o=document.createElement(`div`);o.style.cssText=`font-weight:800;font-size:0.75rem`,o.textContent=r.date;let s=document.createElement(`div`);s.style.cssText=`font-size:0.6875rem;color:var(--sp-muted)`,s.textContent=r.isActive?`Active`:`Inactive`,i.appendChild(o),i.appendChild(s);let c=document.createElement(`div`);if(c.className=EM(),r.matchUpCount!=null){let e=document.createElement(`div`);e.className=`spl-date-badge matchups`,e.textContent=`${r.matchUpCount} matchUps`,c.appendChild(e)}if(r.issueCount&&r.issueCount>0){let e=document.createElement(`div`);e.className=`spl-date-badge issues`,e.textContent=`${r.issueCount} issues`,c.appendChild(e)}n.appendChild(i),n.appendChild(c),n.addEventListener(`click`,()=>e.onDateSelected(r.date)),a.appendChild(n)}}return{element:t,update:o}}function cN(e,t,n){let r=document.createElement(`div`);r.className=cM();let i=document.createElement(`div`);i.className=lM();let a=document.createElement(`div`);a.className=uM(),a.textContent=`Court Grid`;let o=document.createElement(`div`);o.className=dM(),i.appendChild(a),i.appendChild(o),r.appendChild(i);let s=document.createElement(`div`);s.className=fM(),n?.gridMaxHeight&&(s.style.maxHeight=n.gridMaxHeight),e&&s.appendChild(e),s.addEventListener(`dragover`,e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`}),s.addEventListener(`drop`,e=>{if(e.preventDefault(),!t.onMatchUpDrop)return;let n;try{n=JSON.parse(e.dataTransfer.getData(`application/json`))}catch{return}(n.type===`CATALOG_MATCHUP`||n.type===`GRID_MATCHUP`)&&t.onMatchUpDrop(n,e)}),r.appendChild(s);function c(e){o.textContent=e.selectedDate??`No date selected`}return{element:r,update:c}}var lN=class{constructor(e){this.listeners=new Set,this.config=e,this.state={matchUpCatalog:e.matchUpCatalog,scheduleDates:e.scheduleDates,issues:e.issues??[],selectedDate:e.scheduleDates[0]?.date??null,selectedMatchUp:null,catalogSearchQuery:``,catalogGroupBy:`event`,catalogFilters:{},showCompleted:!1,showScheduled:!1,scheduledBehavior:e.scheduledBehavior??`dim`,schedulingMode:e.schedulingMode??`immediate`,pendingActions:[],hasUnsavedChanges:!1,leftCollapsed:!!e.hideLeft,hideLeft:!!e.hideLeft}}getState(){return this.state}setMatchUpCatalog(e){this.setState({matchUpCatalog:e}),this.state.selectedMatchUp&&(e.some(e=>e.matchUpId===this.state.selectedMatchUp?.matchUpId)||this.setState({selectedMatchUp:null}))}setScheduleDates(e){this.setState({scheduleDates:e})}setIssues(e){this.setState({issues:e})}handleMatchUpDrop(e,t){if(this.state.schedulingMode===`immediate`)this.config.onMatchUpDrop?.(e,t);else{let n={kind:`schedule`,matchUpId:e.matchUp.matchUpId,matchUp:e.matchUp,event:t};this.setState({pendingActions:[...this.state.pendingActions,n],hasUnsavedChanges:!0})}}handleMatchUpRemove(e){if(this.state.schedulingMode===`immediate`)this.config.onMatchUpRemove?.(e);else{let t=this.state.pendingActions.findIndex(t=>t.kind===`schedule`&&t.matchUpId===e);if(t>=0){let e=[...this.state.pendingActions];e.splice(t,1),this.setState({pendingActions:e,hasUnsavedChanges:e.length>0})}else{let t={kind:`unschedule`,matchUpId:e};this.setState({pendingActions:[...this.state.pendingActions,t],hasUnsavedChanges:!0})}}}save(){let e=this.state.pendingActions;return e.length?(this.config.onBulkSave?.(e),this.setState({pendingActions:[],hasUnsavedChanges:!1}),e):[]}discardPending(){this.setState({pendingActions:[],hasUnsavedChanges:!1})}getPendingActions(){return this.state.pendingActions}selectDate(e){this.state.selectedDate!==e&&(this.setState({selectedDate:e}),this.config.onDateSelected?.(e))}selectMatchUp(e){this.setState({selectedMatchUp:e}),this.config.onMatchUpSelected?.(e)}setCatalogSearch(e){this.setState({catalogSearchQuery:e})}setCatalogGroupBy(e){this.setState({catalogGroupBy:e})}setCatalogFilters(e){this.setState({catalogFilters:e})}setShowCompleted(e){this.setState({showCompleted:e})}setShowScheduled(e){this.setState({showScheduled:e})}toggleLeftPanel(){this.setState({leftCollapsed:!this.state.leftCollapsed})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state={...this.state,...e},this.emit()}emit(){for(let e of this.listeners)e(this.state)}},uN=class{constructor(e){this.container=null,this.store=new lN(e),this.layout=WM({dateStrip:sN({onDateSelected:e=>this.store.selectDate(e)}),issuesPanel:oN(),courtGridSlot:cN(e.courtGridElement,{onMatchUpDrop:(e,t)=>{this.store.handleMatchUpDrop(e,t)}},{gridMaxHeight:e.gridMaxHeight}),matchUpCatalog:rN({onSearchChange:e=>this.store.setCatalogSearch(e),onGroupByChange:e=>this.store.setCatalogGroupBy(e),onFilterChange:e=>this.store.setCatalogFilters(e),onShowCompletedChange:e=>this.store.setShowCompleted(e),onShowScheduledChange:e=>this.store.setShowScheduled(e),onMatchUpSelected:e=>this.store.selectMatchUp(e),onDropRemove:e=>{this.store.handleMatchUpRemove(e)}}),inspectorPanel:JM()},{onToggleLeft:()=>this.store.toggleLeftPanel()},{hideLeft:e.hideLeft,catalogSide:e.catalogSide}),this.unsubscribe=this.store.subscribe(e=>{this.layout.update(e)}),this.layout.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.layout.element)}destroy(){this.unsubscribe(),this.container&&this.layout.element.parentNode===this.container&&this.layout.element.remove(),this.container=null}setMatchUpCatalog(e){this.store.setMatchUpCatalog(e)}setScheduleDates(e){this.store.setScheduleDates(e)}setIssues(e){this.store.setIssues(e)}save(){return this.store.save()}discardPending(){this.store.discardPending()}get hasUnsavedChanges(){return this.store.getState().hasUnsavedChanges}getStore(){return this.store}},dN=`spl-cell--conflict-highlight`,fN=`spl-cell--complete`,pN={header:[`time`],body:[`eventRound`,`participants`],footer:[`score`],participantDisplay:{nameFormat:`full`,showSeed:!1,showRanking:!1,showNationality:!1,boldWinner:!0,showPotentials:!0}};function mN(e,t){let n=t??pN;return e.isBlocked?hN(e):e.matchUpId?_N(e,n):gN()}function hN(e){let t=document.createElement(`div`);t.className=`spl-grid-cell spl-cell--blocked`;let n=e.booking?.bookingType||`BLOCKED`;t.dataset.bookingType=n;let r=document.createElement(`div`);r.className=`spl-grid-cell__block-label`;let i=document.createElement(`div`);if(i.className=`spl-grid-cell__block-type`,i.textContent=n,r.appendChild(i),e.booking?.rowCount){let t=document.createElement(`div`);t.className=`spl-grid-cell__block-rows`,t.textContent=`${e.booking.rowCount} rows`,r.appendChild(t)}if(e.booking?.notes){let t=document.createElement(`div`);t.className=`spl-grid-cell__block-notes`,t.textContent=e.booking.notes,r.appendChild(t)}return t.appendChild(r),t}function gN(){let e=document.createElement(`div`);return e.className=`spl-grid-cell spl-cell--empty`,e}function _N(e,t){let n=document.createElement(`div`);if(n.className=`spl-grid-cell`,n.dataset.matchupId=e.matchUpId,e.drawId&&(n.dataset.drawId=e.drawId),e.gender&&(n.dataset.gender=e.gender),vN(n,e),t.header.length){let r=document.createElement(`div`);r.className=`spl-grid-cell__header`,yN(r,t.header,e,t),n.appendChild(r)}if(t.body.length){let r=document.createElement(`div`);r.className=`spl-grid-cell__body`,yN(r,t.body,e,t),n.appendChild(r)}if(t.footer.length){let r=document.createElement(`div`);r.className=`spl-grid-cell__footer`,yN(r,t.footer,e,t),n.appendChild(r)}return e.issueIds?.length&&(n.addEventListener(`mouseenter`,()=>{n.classList.add(dN);for(let t of e.issueIds)document.querySelectorAll(`[data-matchup-id="${t}"]`).forEach(e=>e.classList.add(dN))}),n.addEventListener(`mouseleave`,()=>{n.classList.remove(dN);for(let t of e.issueIds)document.querySelectorAll(`[data-matchup-id="${t}"]`).forEach(e=>e.classList.remove(dN))})),n}function vN(e,t){let n=t.matchUpStatus?.toUpperCase();n===`COMPLETED`||n===`RETIRED`||n===`DEFAULTED`||n===`WALKOVER`?e.classList.add(fN):n===`IN_PROGRESS`?e.classList.add(`spl-cell--inprogress`):n===`ABANDONED`?e.classList.add(`spl-cell--abandoned`):n===`CANCELLED`?e.classList.add(`spl-cell--cancelled`):n===`DOUBLE_WALKOVER`&&e.classList.add(`spl-cell--double-walkover`);let r=t.scheduleState?.toUpperCase();r===`SCHEDULE_ERROR`||r===`ERROR`?e.classList.add(`spl-cell--error`):r===`SCHEDULE_CONFLICT`||r===`CONFLICT`?e.classList.add(`spl-cell--conflict`):r===`SCHEDULE_WARNING`||r===`WARNING`?e.classList.add(`spl-cell--warning`):(r===`SCHEDULE_ISSUE`||r===`ISSUE`)&&e.classList.add(`spl-cell--issue`),(t.issueType===`DOUBLE_BOOKING`||t.issueType===`courtDoubleBooking`)&&e.classList.add(`spl-cell--double-booking`)}function yN(e,t,n,r){for(let i of t){let t=bN(i,n,r);t&&e.appendChild(t)}}function bN(e,t,n){switch(e){case`time`:return xN(t);case`eventRound`:return SN(t);case`participants`:return CN(t,n.participantDisplay);case`score`:return ON(t);case`matchUpStatus`:return kN(t);case`matchUpFormat`:return AN(t);case`umpire`:return jN(t);default:return null}}function xN(e){let t=e.schedule?.scheduledTime||e.schedule?.startTime,n=e.schedule?.timeModifiers,r=e.schedule?.courtAnnotation;if(!t&&!n?.length&&!r)return null;let i=document.createElement(`div`);i.className=`spl-grid-cell__time`;let a=[];if(n?.length&&a.push(n.join(` `)),t&&a.push(t),i.textContent=a.join(` `)||``,r){let e=document.createElement(`span`);e.className=`spl-grid-cell__court-annotation`,e.textContent=` ${r}`,i.appendChild(e)}return i}function SN(e){let t=[e.eventName,e.roundName].filter(Boolean);if(!t.length)return null;let n=document.createElement(`div`);return n.className=`spl-grid-cell__event-round`,n.textContent=t.join(` `),n}function CN(e,t){let n=t??pN.participantDisplay,r=document.createElement(`div`);r.className=`spl-grid-cell__participants`;let i=e.sides||[],a=e.matchUpStatus?.toUpperCase()===`BYE`,o=i.some(e=>e.bye);if(i.length===0&&n.showPotentials!==!1&&e.potentialParticipants?.length){for(let t=0;t<e.potentialParticipants.length;t++){t>0&&r.appendChild(EN());let n=e.potentialParticipants[t].map(e=>e?.participantName||`TBD`).join(` / `),i=document.createElement(`div`);i.className=`spl-grid-cell__side spl-grid-cell__potential`,i.textContent=n||`TBD`,r.appendChild(i)}return r}if(i.length===0)return null;for(let t=0;t<i.length;t++){let a=i[t];a.bye?r.appendChild(TN()):(t>0&&!i[t-1]?.bye&&r.appendChild(EN()),r.appendChild(wN(a,e,n,a.sideNumber??t+1)))}return(a||o)&&i.length===1&&!i[0].bye&&r.appendChild(TN()),r}function wN(e,t,n,r){let i=document.createElement(`div`);i.className=`spl-grid-cell__side`;let a=document.createElement(`span`);a.className=`spl-grid-cell__name`;let o=DN(e.participantName,n.nameFormat)||`TBD`;if(n.showSeed&&e.seedNumber&&(o+=` [${e.seedNumber}]`),n.showRanking&&e.ranking&&(o+=` (#${e.ranking})`),n.showNationality&&e.nationality&&(o+=` ${e.nationality}`),a.textContent=o,n.boldWinner!==!1&&t.winningSide===r&&(a.style.fontWeight=`bold`),i.appendChild(a),e.teamName){let t=document.createElement(`div`);t.className=`spl-grid-cell__team-name`,t.textContent=e.teamName,i.appendChild(t)}return i}function TN(){let e=document.createElement(`div`);return e.className=`spl-grid-cell__bye`,e.textContent=`BYE`,e}function EN(){let e=document.createElement(`div`);return e.className=`spl-grid-cell__vs`,e.textContent=`vs.`,e}function DN(e,t){if(!e)return``;switch(t){case`last`:return e.includes(`,`)?e.split(`,`)[0].trim():e.trim().split(/\s+/).at(-1);case`lastFirst`:{if(e.includes(`,`))return e.trim();let t=e.trim().split(/\s+/);return t.length<2?e:`${t.at(-1)}, ${t.slice(0,-1).join(` `)}`}case`firstLast`:{if(!e.includes(`,`))return e.trim();let[t,...n]=e.split(`,`);return`${n.join(`,`).trim()} ${t.trim()}`}default:return e}}function ON(e){let t=e.score?.scoreStringSide1,n=e.matchUpStatus?.toUpperCase(),r=n===`WALKOVER`?`WALKOVER`:n===`DEFAULTED`?`DEFAULT`:n===`RETIRED`?`RET.`:n===`DOUBLE_WALKOVER`?`D.W/O`:n===`ABANDONED`?`ABN.`:null;if(!t&&!r)return null;let i=document.createElement(`div`);return i.className=`spl-grid-cell__score`,i.textContent=t||r||``,i}function kN(e){if(!e.matchUpStatus)return null;let t=document.createElement(`div`);t.className=`spl-grid-cell__status-badge`;let n=e.matchUpStatus.toUpperCase();return n===`IN_PROGRESS`?(t.textContent=`LIVE`,t.classList.add(`spl-grid-cell__status-badge--live`)):n===`COMPLETED`||n===`RETIRED`||n===`DEFAULTED`||n===`WALKOVER`?(t.textContent=`DONE`,t.classList.add(`spl-grid-cell__status-badge--done`)):t.textContent=e.matchUpStatus.replaceAll(`_`,` `),t}function AN(e){if(!e.matchUpFormat)return null;let t=document.createElement(`div`);return t.className=`spl-grid-cell__format`,t.textContent=e.matchUpFormat,t}function jN(e){if(!e.umpire)return null;let t=document.createElement(`div`);return t.className=`spl-grid-cell__umpire`,t.textContent=e.umpire,t}function MN(e){if(!e)return{matchUpId:``};if(e.isBlocked)return{matchUpId:``,isBlocked:!0,booking:e.booking};let t=(e.sides||[]).map((e,t)=>({sideNumber:e.sideNumber??t+1,participantName:e.participant?.participantName??e.participantName,participantId:e.participantId??e.participant?.participantId,seedNumber:e.seedValue??e.seedNumber,ranking:e.ranking,nationality:e.participant?.nationalityCode??e.participant?.person?.nationalityCode??e.nationalityCode,teamName:e.teamParticipant?.participantName??e.teamName,bye:e.bye||void 0}));return{matchUpId:e.matchUpId,drawId:e.drawId,eventName:e.eventName,roundName:e.roundName,matchUpFormat:e.matchUpFormat,matchUpType:e.matchUpType,matchUpStatus:e.matchUpStatus,winningSide:e.winningSide,gender:e.gender??e.eventGender,sides:t,potentialParticipants:e.potentialParticipants,schedule:e.schedule?{scheduledTime:e.schedule.scheduledTime,startTime:e.schedule.startTime,timeModifiers:e.schedule.timeModifiers,courtAnnotation:e.schedule.courtAnnotation,courtId:e.schedule.courtId,courtOrder:e.schedule.courtOrder,venueId:e.schedule.venueId}:void 0,score:e.score?{scoreStringSide1:e.score.scoreStringSide1,scoreStringSide2:e.score.scoreStringSide2}:void 0,umpire:e.umpire?.participantName??e.umpireName,scheduleState:e.scheduleState,issueType:e.issueType,issueIds:e.issueIds}}function NN({cell:e,listProvider:t,onSelect:n,onCancel:r}){let i=e.innerHTML,a=[],o=!1,s=!1;e.classList.add(`spl-cell--typeahead`),e.innerHTML=``;let c=document.createElement(`div`);c.className=`spl-cell--typeahead-wrapper`,e.appendChild(c);let l=document.createElement(`input`);l.type=`text`,l.placeholder=`Search matchUps...`,l.setAttribute(`inputmode`,`search`),l.setAttribute(`autocapitalize`,`off`),l.setAttribute(`enterkeyhint`,`search`),l.setAttribute(`autocomplete`,`off`),c.appendChild(l);let u=e,d=0;for(;u&&d<10;){let e=window.getComputedStyle(u);(e.overflow!==`visible`||e.overflowX!==`visible`||e.overflowY!==`visible`)&&(a.push({el:u,overflow:u.style.overflow,overflowX:u.style.overflowX,overflowY:u.style.overflowY}),u.style.setProperty(`overflow`,`visible`,`important`),u.style.setProperty(`overflow-x`,`visible`,`important`),u.style.setProperty(`overflow-y`,`visible`,`important`)),u=u.parentElement,d++}ne({list:t(),element:l,listProvider:t,callback:e=>{e&&!s&&(o=!0,p(),n(e))}}),l.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),p(),r?.())}),l.addEventListener(`blur`,()=>{setTimeout(()=>{!o&&!s&&(p(),r?.())},200)});let f=e=>{e.target!==l&&!c.contains(e.target)&&(e.preventDefault(),l.blur())};e.addEventListener(`mousedown`,f),c.addEventListener(`click`,e=>{e.stopPropagation()}),setTimeout(()=>l.focus(),0);function p(){if(!s){s=!0,e.removeEventListener(`mousedown`,f),e.classList.remove(`spl-cell--typeahead`),e.innerHTML=i;for(let{el:e,overflow:t,overflowX:n,overflowY:r}of a)t?e.style.overflow=t:e.style.removeProperty(`overflow`),n?e.style.overflowX=n:e.style.removeProperty(`overflow-x`),r?e.style.overflowY=r:e.style.removeProperty(`overflow-y`)}}return{destroy:p}}function PN(e,t){let n=new uN(e);return n.render(t),n}var FN=class{constructor(e){this.listeners=new Set,this.config=e,this.state={compositionName:e.compositionName||`Custom`,theme:e.composition?.theme||``,configuration:{...e.composition?.configuration||{}},expandedSections:new Set([`theme`,`display`]),isDirty:!1,readOnly:e.readOnly||!1}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}toggleSection(e){let t=new Set(this.state.expandedSections);t.has(e)?t.delete(e):t.add(e),this.setState({expandedSections:t})}setTheme(e){this.setState({theme:e,isDirty:!0}),this.notifyChange()}setCompositionName(e){this.setState({compositionName:e,isDirty:!0})}setConfigField(e,t){let n={...this.state.configuration,[e]:t};this.setState({configuration:n,isDirty:!0}),this.notifyChange()}setConfigNestedField(e,t,n){let r={...this.state.configuration[e]||{},[t]:n};this.setConfigField(e,r)}setConfiguration(e){this.setState({configuration:{...e},isDirty:!0}),this.notifyChange()}loadComposition(e,t,n){this.setState({compositionName:e,theme:t,configuration:{...n},isDirty:!1}),this.notifyChange()}resetToInitial(){this.setState({compositionName:this.config.compositionName||`Custom`,theme:this.config.composition?.theme||``,configuration:{...this.config.composition?.configuration||{}},isDirty:!1}),this.notifyChange()}setState(e){this.state={...this.state,...e},this.emit()}emit(){for(let e of this.listeners)e(this.state)}notifyChange(){this.config.onChange?.({theme:this.state.theme,configuration:this.state.configuration})}},IN=()=>`ce-layout`,LN=()=>`ce-left`,RN=()=>`ce-right`,zN=()=>`ce-name-row`,BN=()=>`ce-name-label`,VN=()=>`ce-name-input`,HN=()=>`ce-section`,UN=()=>`ce-section-header`,WN=()=>`ce-section-chevron`,GN=()=>`ce-section-body`,KN=()=>`ce-field`,qN=()=>`ce-field-label`,JN=()=>`ce-field-control`,YN=()=>`ce-select`,XN=()=>`ce-text-input`,ZN=()=>`ce-color-input`,QN=()=>`ce-toggle`,$N=()=>`ce-toggle-track`,eP=()=>`ce-preview`,tP=()=>`ce-preview-header`,nP=()=>`ce-preview-body`,rP=()=>`ce-preview-matchup`,iP=()=>`ce-subgroup`,aP=()=>`ce-subgroup-title`;function oP(e,t){let n=document.createElement(`div`);n.className=HN();let r=document.createElement(`div`);r.className=UN();let i=document.createElement(`span`);i.className=WN();let a=document.createElement(`span`);a.textContent=e.label,r.appendChild(i),r.appendChild(a),r.addEventListener(`click`,()=>t.toggleSection(e.id));let o=document.createElement(`div`);o.className=GN();let s=e.factory(t);o.appendChild(s.element),n.appendChild(r),n.appendChild(o);function c(t){let n=t.expandedSections.has(e.id);i.textContent=n?`▼`:`▶`,o.style.display=n?`block`:`none`,n&&s.update(t)}return{element:n,update:c}}function sP(e,t,n,r=!1){let i=document.createElement(`div`);i.className=KN();let a=document.createElement(`span`);a.className=qN(),a.textContent=e,i.appendChild(a);let o=document.createElement(`label`);o.className=QN();let s=document.createElement(`input`);s.type=`checkbox`,s.checked=t,s.disabled=r,s.addEventListener(`change`,()=>n(s.checked));let c=document.createElement(`span`);c.className=$N(),o.appendChild(s),o.appendChild(c);let l=document.createElement(`div`);return l.className=JN(),l.appendChild(o),i.appendChild(l),{element:i,setChecked:e=>{s.checked=e},setDisabled:e=>{s.disabled=e}}}function cP(e,t,n,r,i=!1){let a=document.createElement(`div`);a.className=KN();let o=document.createElement(`span`);o.className=qN(),o.textContent=e,a.appendChild(o);let s=document.createElement(`select`);s.className=YN(),s.disabled=i;for(let e of t){let t=document.createElement(`option`);t.value=e.value,t.textContent=e.label,e.value===n&&(t.selected=!0),s.appendChild(t)}s.addEventListener(`change`,()=>r(s.value));let c=document.createElement(`div`);return c.className=JN(),c.appendChild(s),a.appendChild(c),{element:a,setValue:e=>{s.value=e}}}function lP(e,t,n,r=``,i=!1){let a=document.createElement(`div`);a.className=KN();let o=document.createElement(`span`);o.className=qN(),o.textContent=e,a.appendChild(o);let s=document.createElement(`input`);s.type=`text`,s.className=XN(),s.value=t,s.placeholder=r,s.disabled=i,s.addEventListener(`input`,()=>n(s.value));let c=document.createElement(`div`);return c.className=JN(),c.appendChild(s),a.appendChild(c),{element:a,setValue:e=>{s.value=e}}}function uP(e,t,n,r=!1){let i=document.createElement(`div`);i.className=KN();let a=document.createElement(`span`);a.className=qN(),a.textContent=e,i.appendChild(a);let o=document.createElement(`input`);o.type=`color`,o.className=ZN(),o.value=t||`#000000`,o.disabled=r,o.addEventListener(`input`,()=>n(o.value));let s=document.createElement(`div`);return s.className=JN(),s.appendChild(o),i.appendChild(s),{element:i,setValue:e=>{o.value=e||`#000000`}}}var dP=[],fP=new Set;for(let[,e]of Object.entries(ri))if(!fP.has(e.theme)){fP.add(e.theme);let t=e.theme.replace(`chc-theme-`,``).replace(/-/g,` `).replace(/\b\w/g,e=>e.toUpperCase());dP.push({value:e.theme,label:t})}function pP(e){let t=document.createElement(`div`),n=cP(`Load preset`,[{value:``,label:`— Load preset —`},...Object.keys(ri).map(e=>({value:e,label:e}))],``,t=>{if(!t)return;let r=ri[t];r&&e.loadComposition(t,r.theme,r.configuration||{}),n.setValue(``)},e.getState().readOnly);t.appendChild(n.element);let r=document.createElement(`div`);r.style.cssText=`font-size:0.7rem; color:var(--chc-text-secondary, #999); padding:0 0 0.3rem; line-height:1.3;`,r.textContent=`Replaces all settings with a built-in composition.`,t.appendChild(r);let i=cP(`Color theme`,dP,e.getState().theme,t=>e.setTheme(t),e.getState().readOnly);t.appendChild(i.element);let a=document.createElement(`div`);a.style.cssText=`font-size:0.7rem; color:var(--chc-text-secondary, #999); padding:0 0 0.3rem; line-height:1.3;`,a.textContent=`Changes only the color scheme, not the display settings.`,t.appendChild(a);function o(e){i.setValue(e.theme)}return{element:t,update:o}}function mP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=sP(`Nationality flags`,!!r.flags,t=>e.setConfigField(`flags`,t),n),a=cP(`Seeding style`,[{value:``,label:`None`},{value:`true`,label:`Parentheses`},{value:`square`,label:`Square brackets`}],r.bracketedSeeds===`square`?`square`:r.bracketedSeeds?`true`:``,t=>{t===`square`?e.setConfigField(`bracketedSeeds`,`square`):t===`true`?e.setConfigField(`bracketedSeeds`,!0):e.setConfigField(`bracketedSeeds`,void 0)},n),o=cP(`Seed element`,[{value:``,label:`Default`},{value:`sup`,label:`Superscript`},{value:`span`,label:`Inline`}],r.seedingElement||``,t=>e.setConfigField(`seedingElement`,t||void 0),n),s=sP(`Draw positions (1st round)`,!!r.drawPositions,t=>e.setConfigField(`drawPositions`,t),n),c=sP(`Draw positions (all rounds)`,!!r.allDrawPositions,t=>e.setConfigField(`allDrawPositions`,t),n),l=sP(`Team logo`,r.teamLogo!==!1,t=>e.setConfigField(`teamLogo`,t),n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element),t.appendChild(s.element),t.appendChild(c.element),t.appendChild(l.element);function u(e){let t=e.configuration;i.setChecked(!!t.flags),a.setValue(t.bracketedSeeds===`square`?`square`:t.bracketedSeeds?`true`:``),o.setValue(t.seedingElement||``),s.setChecked(!!t.drawPositions),c.setChecked(!!t.allDrawPositions),l.setChecked(t.teamLogo!==!1)}return{element:t,update:u}}function hP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=sP(`Score box`,!!r.scoreBox,t=>e.setConfigField(`scoreBox`,t),n),a=sP(`Game score only`,!!r.gameScoreOnly,t=>e.setConfigField(`gameScoreOnly`,t),n);t.appendChild(i.element),t.appendChild(a.element);let o=document.createElement(`div`);o.className=iP();let s=document.createElement(`div`);s.className=aP(),s.textContent=`Game Score Display`,o.appendChild(s);let c=cP(`Position`,[{value:``,label:`Default`},{value:`leading`,label:`Leading`},{value:`trailing`,label:`Trailing`}],r.gameScore?.position||``,t=>e.setConfigNestedField(`gameScore`,`position`,t||void 0),n),l=sP(`Inverted`,!!r.gameScore?.inverted,t=>e.setConfigNestedField(`gameScore`,`inverted`,t),n);o.appendChild(c.element),o.appendChild(l.element),t.appendChild(o);function u(e){let t=e.configuration;i.setChecked(!!t.scoreBox),a.setChecked(!!t.gameScoreOnly),c.setValue(t.gameScore?.position||``),l.setChecked(!!t.gameScore?.inverted)}return{element:t,update:u}}function gP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=sP(`Gender color`,!!r.genderColor,t=>e.setConfigField(`genderColor`,t),n),a=sP(`Winner color`,!!r.winnerColor,t=>e.setConfigField(`winnerColor`,t),n),o=cP(`Detail`,[{value:``,label:`Default`},{value:`TEAM`,label:`Team`},{value:`ADDRESS`,label:`Address`}],r.participantDetail||``,t=>{e.setConfigField(`participantDetail`,t||void 0),e.setConfigField(`showAddress`,t===`ADDRESS`)},n),s=lP(`Position color`,r.drawPositionColor||``,t=>e.setConfigField(`drawPositionColor`,t||void 0),`#999`,n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element),t.appendChild(s.element);function c(e){let t=e.configuration;i.setChecked(!!t.genderColor),a.setChecked(!!t.winnerColor),o.setValue(t.participantDetail||``),s.setValue(t.drawPositionColor||``)}return{element:t,update:c}}function _P(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=lP(`TBD text`,r.placeHolders?.tbd||``,t=>e.setConfigNestedField(`placeHolders`,`tbd`,t||void 0),`TBD`,n),a=lP(`Bye text`,r.placeHolders?.bye||``,t=>e.setConfigNestedField(`placeHolders`,`bye`,t||void 0),`Bye`,n),o=lP(`Qualifier text`,r.placeHolders?.qualifier||``,t=>e.setConfigNestedField(`placeHolders`,`qualifier`,t||void 0),`Qualifier`,n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element);function s(e){let t=e.configuration;i.setValue(t.placeHolders?.tbd||``),a.setValue(t.placeHolders?.bye||``),o.setValue(t.placeHolders?.qualifier||``)}return{element:t,update:s}}var vP=[{scaleName:`WTN`,accessor:`wtnRating`,label:`WTN`},{scaleName:`UTR`,accessor:`utrRating`,label:`UTR`},{scaleName:`NTRP`,accessor:`ntrpRating`,label:`NTRP`},{scaleName:`ELO`,accessor:`eloRating`,label:`ELO`}];function yP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration.scaleAttributes||{},i=cP(`Scale type`,[{value:``,label:`None`},{value:`RATING`,label:`Rating`},{value:`RANKING`,label:`Ranking`},{value:`SEEDING`,label:`Seeding`}],r.scaleType||``,t=>e.setConfigNestedField(`scaleAttributes`,`scaleType`,t||void 0),n),a=cP(`Scale name`,[{value:``,label:`None`},...vP.map(e=>({value:e.scaleName,label:e.label}))],r.scaleName||``,t=>{e.setConfigNestedField(`scaleAttributes`,`scaleName`,t||void 0);let n=vP.find(e=>e.scaleName===t);e.setConfigNestedField(`scaleAttributes`,`accessor`,n?.accessor||void 0)},n),o=uP(`Color`,r.scaleColor||`#ff0000`,t=>e.setConfigNestedField(`scaleAttributes`,`scaleColor`,t),n),s=cP(`Event type`,[{value:``,label:`Any`},{value:`SINGLES`,label:`Singles`},{value:`DOUBLES`,label:`Doubles`}],r.eventType||``,t=>e.setConfigNestedField(`scaleAttributes`,`eventType`,t||void 0),n),c=sP(`Fallback`,!!r.fallback,t=>e.setConfigNestedField(`scaleAttributes`,`fallback`,t),n),l=sP(`Right of name`,r.scalePosition===`right`,t=>e.setConfigNestedField(`scaleAttributes`,`scalePosition`,t?`right`:`left`),n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element),t.appendChild(s.element),t.appendChild(c.element),t.appendChild(l.element);function u(e){let t=e.configuration.scaleAttributes||{},n=!!e.configuration.flags;i.setValue(t.scaleType||``),a.setValue(t.scaleName||``),o.setValue(t.scaleColor||`#ff0000`),s.setValue(t.eventType||``),c.setChecked(!!t.fallback),n?(l.setChecked(!0),l.setDisabled(!0)):(l.setChecked(t.scalePosition===`right`),l.setDisabled(!1))}return{element:t,update:u}}function bP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=sP(`Schedule info`,!!r.scheduleInfo,t=>e.setConfigField(`scheduleInfo`,t),n),a=sP(`MatchUp footer`,!!r.matchUpFooter,t=>e.setConfigField(`matchUpFooter`,t),n),o=sP(`Center info`,!!r.centerInfo,t=>e.setConfigField(`centerInfo`,t),n),s=sP(`Set number`,!!r.resultsInfo,t=>e.setConfigField(`resultsInfo`,t),n),c=sP(`Winner chevron`,!!r.winnerChevron,t=>e.setConfigField(`winnerChevron`,t),n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element),t.appendChild(s.element),t.appendChild(c.element);function l(e){let t=e.configuration;i.setChecked(!!t.scheduleInfo),a.setChecked(!!t.matchUpFooter),o.setChecked(!!t.centerInfo),s.setChecked(!!t.resultsInfo),c.setChecked(!!t.winnerChevron)}return{element:t,update:l}}var{DOUBLES:xP,SINGLES:SP}=t.eventConstants,{AD_HOC:CP}=t.drawDefinitionConstants,{INDIVIDUAL:wP}=t.participantConstants;function TP({matchUpFormat:e=`SET5-S:6/TB7`,randomWinningSide:n=!0,qualifyingProfiles:r,participantsCount:i,completionGoal:a,drawSize:o=4,eventType:s,outcomes:c,drawType:l,withRatings:u,withAllRatings:d}={}){let f=a<100?Math.floor(o*.01*a):void 0,p=`venueId`,m=[{venueName:`Challenge Courts`,venueAbbreviation:`CC`,startTime:`08:00`,endTime:`20:00`,venueId:p,courtNames:[1,2,3,4,5,6,7,8],courtIds:[`c1`,`c2`,`c3`,`c4`],courtsCount:8}],h={eventType:s===xP?xP:SP,completionGoal:f,qualifyingProfiles:r,participantsCount:i,seedsCount:8,matchUpFormat:e,drawSize:o,drawType:l,outcomes:c};l===CP&&Object.assign(h,{drawMatic:!0,roundsCount:3});let{tournamentRecord:g}=t.mocksEngine.generateTournamentRecord({drawProfiles:[h],completeAllMatchUps:!0,randomWinningSide:n,venueProfiles:m});t.tournamentEngine.setState(g),t.tournamentEngine.createTeamsFromParticipantAttributes({personAttribute:`nationalityCode`,addParticipants:!0});let _=d||(u?[{...u,accessor:u.scaleName}]:[]);if(_.length>0){let{participants:e}=t.tournamentEngine.getParticipants({participantFilters:{participantTypes:[wP]}});for(let n of _)e.forEach(e=>{let r=+(10+Math.random()*6).toFixed(2);t.tournamentEngine.setParticipantScaleItem({participantId:e.participantId,scaleItem:{scaleValue:{[n.accessor]:r},scaleName:n.scaleName,scaleType:n.scaleType||`RATING`,eventType:n.eventType||SP}})})}let{matchUps:v}=t.tournamentEngine.allTournamentMatchUps({participantsProfile:{withGroupings:!0}}),y=v.map(({matchUpId:e})=>e),b={startTime:`08:00`,endTime:`10:00`,scheduledTime:`07:00`,scheduledDate:`2021-01-01`,courtId:`c1`,venueId:p};t.tournamentEngine.bulkScheduleMatchUps({matchUpIds:y,schedule:b});let{matchUps:x}=t.tournamentEngine.allTournamentMatchUps({participantsProfile:{withISO2:!0,withIOC:!0,withScaleValues:!!(u||d)}});return{matchUps:x}}var EP=null;function DP(){if(!EP){let{matchUps:e}=TP({drawSize:8,eventType:`SINGLES`,randomWinningSide:!0,matchUpFormat:`SET3-S:6/TB7`,withAllRatings:vP.map(e=>({scaleName:e.scaleName,accessor:e.accessor}))}),t=e.filter(e=>e.roundNumber===1).slice(0,2),n=t[0]?.sides?.[0]?.participant,r=t[0]?.sides?.[1]?.participant,i={matchUpId:`preview-in-progress`,matchUpType:`SINGLES`,matchUpStatus:`IN_PROGRESS`,roundNumber:1,sides:[{sideNumber:1,drawPosition:5,seedNumber:3,seedValue:`3`,participant:n},{sideNumber:2,drawPosition:6,seedNumber:6,seedValue:`6`,participant:r}],score:{scoreStringSide1:`6-4 3-2`,scoreStringSide2:`4-6 2-3`,sets:[{setNumber:1,side1Score:6,side2Score:4,winningSide:1},{setNumber:2,side1Score:3,side2Score:2,side1PointScore:`30`,side2PointScore:`15`}]}},a={matchUpId:`preview-bye`,matchUpType:`SINGLES`,matchUpStatus:`BYE`,roundNumber:1,sides:[{sideNumber:1,drawPosition:7,seedNumber:2,seedValue:`2`,participant:n},{sideNumber:2,drawPosition:8,bye:!0}]},o={matchUpId:`preview-tbd`,matchUpType:`SINGLES`,matchUpStatus:`TO_BE_PLAYED`,roundNumber:1,sides:[{sideNumber:1,drawPosition:9,seedNumber:3,seedValue:`3`,participant:n},{sideNumber:2,drawPosition:10}]},s={matchUpId:`preview-qualifier`,matchUpType:`SINGLES`,matchUpStatus:`TO_BE_PLAYED`,roundNumber:1,sides:[{sideNumber:1,drawPosition:11,qualifier:!0},{sideNumber:2,drawPosition:12,seedNumber:4,seedValue:`4`,participant:n}]};EP=[...t,i,a,o,s]}return EP}function OP(){let e=document.createElement(`div`);e.className=eP();let t=document.createElement(`div`);t.className=tP(),t.textContent=`Preview`,e.appendChild(t);let n=document.createElement(`div`);n.className=nP(),e.appendChild(n);let r=``,i=``;function a(e){let t=JSON.stringify(e.configuration);if(e.theme===r&&t===i)return;r=e.theme,i=t,n.innerHTML=``;let a={theme:e.theme,configuration:{...e.configuration}},o=DP();for(let e of o){let t=document.createElement(`div`);t.className=rP();let r=Wr({matchUp:e,composition:a,isLucky:!0});t.appendChild(r),n.appendChild(t)}}return{element:e,update:a}}var kP=[{id:`theme`,label:`Theme & Preset`,factory:pP},{id:`display`,label:`Display`,factory:mP},{id:`score`,label:`Score`,factory:hP},{id:`participant`,label:`Participant`,factory:gP},{id:`placeholder`,label:`Placeholders`,factory:_P},{id:`scale`,label:`Scale Attributes`,factory:yP},{id:`layout`,label:`Layout & Info`,factory:bP}];function AP(e,t){let n=new FN(t),r=document.createElement(`div`);r.className=IN();let i=document.createElement(`div`);i.className=LN();let a=document.createElement(`div`);a.className=zN();let o=document.createElement(`span`);o.className=BN(),o.textContent=`Name`;let s=document.createElement(`input`);s.type=`text`,s.className=VN(),s.value=n.getState().compositionName,s.disabled=n.getState().readOnly,s.addEventListener(`input`,()=>n.setCompositionName(s.value)),a.appendChild(o),a.appendChild(s),i.appendChild(a);let c=kP.map(e=>{let t=oP(e,n);return i.appendChild(t.element),t}),l=document.createElement(`div`);l.className=RN();let u=OP();l.appendChild(u.element),r.appendChild(i),r.appendChild(l),e.appendChild(r);let d=n.subscribe(e=>{s.value=e.compositionName;for(let t of c)t.update(e);u.update(e)}),f=n.getState();for(let e of c)e.update(f);return u.update(f),{destroy:()=>{d(),e.contains(r)&&e.removeChild(r)},getComposition:()=>{let e=n.getState(),{participantProvider:t,persistInputFields:r,inlineAssignment:i,...a}=e.configuration;return{compositionName:e.compositionName,theme:e.theme,configuration:a,version:1}}}}var jP=`chc-scorecard-side-score--winner`;function MP({matchUp:e,composition:t,eventHandlers:n,swapSides:r}){let i=document.createElement(`div`);i.className=`chc-scorecard`;let a=r?2:1,o=r?1:2,s=VP(e,a)||``,c=VP(e,o)||``,l=r?RP(e.winningSide):e.winningSide,u=NP({side1Name:s,side2Name:c,sets:r?zP(e.score?.sets):e.score?.sets,winningSide:l,side1Id:`chc-sc-side1`,side2Id:`chc-sc-side2`});i.appendChild(u);let d=e.tieFormat?.collectionDefinitions?.slice().sort((e,t)=>(e.collectionOrder||0)-(t.collectionOrder||0))||[];for(let a of d){let o=LP({collectionDefinition:a,collectionMatchUps:(e.tieMatchUps||[]).filter(e=>e.collectionId===a.collectionId).sort((e,t)=>(e.collectionPosition||0)-(t.collectionPosition||0)),composition:t,eventHandlers:n,swapSides:r});i.appendChild(o)}return i}function NP({side1Name:e,side2Name:t,sets:n,winningSide:r,side1Id:i,side2Id:a}){let o=document.createElement(`div`);o.className=`chc-scorecard-header`;let s=document.createElement(`div`);s.className=`chc-scorecard-header-body`;let c=FP(e,`end`),l=FP(t,`start`),u=IP(n,1,r,i),d=IP(n,2,r,a),f=document.createElement(`div`);f.className=`chc-scorecard-score-box`;let p=document.createElement(`div`);p.className=`chc-scorecard-score-flex`;let m=document.createElement(`div`);return m.className=`chc-scorecard-vs`,m.textContent=`vs`,p.appendChild(u),p.appendChild(m),p.appendChild(d),f.appendChild(p),s.appendChild(c),s.appendChild(f),s.appendChild(l),o.appendChild(s),o}function PP(e,t=`chc-sc-side1`,n=`chc-sc-side2`,r){let i=e?.score?.sets?.[0];if(!i)return;let a=document.getElementById(t),o=document.getElementById(n);if(!a||!o)return;a.classList.remove(jP),o.classList.remove(jP);let s=r?`side2Score`:`side1Score`,c=r?`side1Score`:`side2Score`;a.textContent=String(i[s]??0),o.textContent=String(i[c]??0);let l=r?RP(e.winningSide):e.winningSide;l===1&&a.classList.add(jP),l===2&&o.classList.add(jP)}function FP(e,t){let n=document.createElement(`div`);n.className=`chc-scorecard-side chc-scorecard-side--${t}`;let r=document.createElement(`div`);return r.className=`chc-scorecard-side-name`,r.textContent=e,n.appendChild(r),n}function IP(e,t,n,r){let i=e?.[0]?.[`side${t}Score`]??0,a=document.createElement(`span`);return a.className=`chc-scorecard-side-score`,r&&(a.id=r),t===1?a.style.paddingLeft=`1rem`:a.style.paddingRight=`1rem`,t===n&&a.classList.add(jP),a.textContent=String(i),a}function LP({collectionDefinition:e,collectionMatchUps:t,composition:n,eventHandlers:r,swapSides:i}){let a=document.createElement(`div`);a.className=`chc-scorecard-panel`;let o=document.createElement(`div`);o.className=`chc-scorecard-panel-header`;let s=document.createElement(`div`);s.className=`chc-scorecard-panel-name`,s.textContent=e.collectionName||`Collection`;let c=document.createElement(`div`);c.className=`chc-scorecard-panel-meta`;let l=(e.matchUpType||``).toUpperCase(),u=document.createElement(`span`);u.className=`chc-scorecard-type-badge chc-scorecard-type-badge--${l===`DOUBLES`?`doubles`:`singles`}`,u.textContent=l===`DOUBLES`?`D`:`S`;let d=document.createElement(`span`);d.className=`chc-scorecard-count-badge`,d.textContent=String(t.length),c.appendChild(u),c.appendChild(d),o.appendChild(s),o.appendChild(c),a.appendChild(o);let f=document.createElement(`div`);f.className=`chc-scorecard-grid`;for(let e of t){let t=Wr({matchUp:i?BP(e):e,isLucky:!0,eventHandlers:r,composition:n});t.classList.add(`chc-scorecard-card`),f.appendChild(t)}return a.appendChild(f),a}function RP(e){if(e===1)return 2;if(e===2)return 1}function zP(e){if(e)return e.map(e=>({...e,side1Score:e.side2Score,side2Score:e.side1Score,side1TiebreakScore:e.side2TiebreakScore,side2TiebreakScore:e.side1TiebreakScore}))}function BP(e){let t=e.sides?.map(e=>({...e,sideNumber:e.sideNumber===1?2:1}));return{...e,sides:t,score:e.score?{...e.score,sets:zP(e.score.sets)}:e.score,winningSide:RP(e.winningSide)}}function VP(e,t){return e.sides?.find(e=>e.sideNumber===t)?.participant?.participantName}function HP(e){let{matchUpId:t,manager:n,baseMatchUp:r,onUpdate:i,showSituation:a}=e,o=document.createElement(`div`);o.className=`chc-inline-scoring-footer`;let s=document.createElement(`div`);s.className=`chc-inline-scoring-buttons`;let c=(e,t)=>{let n=document.createElement(`button`);return n.textContent=e,n.className=`chc-inline-scoring-btn ${t}`,n},l=c(`Undo`,`chc-is-undo`),u=c(`Redo`,`chc-is-redo`),d=c(`Clear`,`chc-is-clear`),f=c(`Submit`,`chc-is-submit`),p;a&&(p=document.createElement(`span`),p.className=`chc-inline-scoring-situation`),l.onclick=e=>{e.stopPropagation();let a=n.undo(t,r);a&&(i(a),m())},u.onclick=e=>{e.stopPropagation();let a=n.redo(t,r);a&&(i(a),m())},d.onclick=e=>{e.stopPropagation();let a=n.reset(t,r);a&&(i(a),m())},f.onclick=e=>{e.stopPropagation();let i=n.get(t);if(i){let e=n.getMatchUp(t,r);n.callbacks?.onSubmit?.({matchUpId:t,matchUp:e,engine:i.engine})}},s.append(l,u,d,f),o.appendChild(s),p&&o.appendChild(p);function m(){let e=n.canUndo(t),r=n.canRedo(t),i=n.isComplete(t);if(l.disabled=!e,u.disabled=!r,d.disabled=!e&&!r,p){let e=n.getSituation(t);if(e&&!i){let t=[e.isTiebreak&&`TB`,e.isBreakPoint&&`Break`,e.isGamePoint&&`Game`,e.isSetPoint&&`Set`,e.isMatchPoint&&`Match`].filter(Boolean);p.textContent=t.length?t.join(` • `):``}else p.textContent=i?`Complete`:``}}return m(),{element:o,update:m}}var UP=`chc-iss-score-cell`;function WP(e){if(!e?.matchUpId)throw Error(`buildInteractiveScoringShell: matchUpId is required`);if(!e?.matchUpFormat)throw Error(`buildInteractiveScoringShell: matchUpFormat is required`);let t=e.initialMatchUp??GP(e),n=new Set,r=new Zo({onScoreChange:({matchUp:e})=>{a(e,!1)},onMatchComplete:({winningSide:n})=>{a(r.getMatchUp(e.matchUpId,t),!0,n)}});r.getOrCreate(e.matchUpId,e.matchUpFormat,t);let i=document.createElement(`div`);i.className=`chc-interactive-scoring-shell`,i.dataset.matchupId=e.matchUpId,i.dataset.tournamentId=e.tournamentId,l();function a(t,r,i){let a={matchUpId:e.matchUpId,matchUp:t,isComplete:r,winningSide:i??t.winningSide},o=new CustomEvent(`stateChanged`,{detail:a});n.forEach(e=>{try{e(o)}catch(e){console.warn(`[interactive-scoring] listener threw`,e)}})}function o(n){r.isComplete(e.matchUpId)||(r.addPoint(e.matchUpId,n,t),l())}function s(){r.canUndo(e.matchUpId)&&(r.undo(e.matchUpId,t),l(),a(r.getMatchUp(e.matchUpId,t),r.isComplete(e.matchUpId)))}function c(){XP()&&(r.reset(e.matchUpId,t),l(),a(r.getMatchUp(e.matchUpId,t),!1))}function l(){i.innerHTML=``,i.append(KP(e),qP(r,e,t),JP(r,e,o),YP(r,e,s,c))}return{element:i,getState:()=>r.getMatchUp(e.matchUpId,t),reset:()=>{r.reset(e.matchUpId,t),l(),a(r.getMatchUp(e.matchUpId,t),!1)},destroy:()=>{n.clear(),r.remove(e.matchUpId),i.innerHTML=``},addEventListener:(e,t)=>{e===`stateChanged`&&n.add(t)},removeEventListener:(e,t)=>{e===`stateChanged`&&n.delete(t)}}}function GP(e){return{matchUpId:e.matchUpId,tournamentId:e.tournamentId,matchUpFormat:e.matchUpFormat,matchUpStatus:`TO_BE_PLAYED`,score:{sets:[]},sides:[{sideNumber:1,participant:{participantName:e.side1Name}},{sideNumber:2,participant:{participantName:e.side2Name}}]}}function KP(e){let t=document.createElement(`div`);t.className=`chc-iss-header`;let n=document.createElement(`div`);n.className=`chc-iss-header-side chc-iss-header-side1`,n.textContent=e.side1Name||`Side 1`;let r=document.createElement(`div`);r.className=`chc-iss-header-vs`,r.textContent=`vs`;let i=document.createElement(`div`);return i.className=`chc-iss-header-side chc-iss-header-side2`,i.textContent=e.side2Name||`Side 2`,t.append(n,r,i),t}function qP(e,t,n){let r=document.createElement(`div`);r.className=`chc-iss-score-display`;let i=e.getMatchUp(t.matchUpId,n),a=i.score?.sets??[],o=document.createElement(`div`);o.className=`chc-iss-score-grid`,o.style.setProperty(`--sets`,String(Math.max(a.length,1)));let s=document.createElement(`div`);s.className=`chc-iss-score-row chc-iss-score-row-side1`;let c=document.createElement(`div`);c.className=`chc-iss-score-row chc-iss-score-row-side2`;for(let e of a){let t=document.createElement(`div`);t.className=UP,t.textContent=String(e.side1Score??0),e.winningSide===1&&t.classList.add(`chc-iss-score-cell-won`),s.append(t);let n=document.createElement(`div`);n.className=UP,n.textContent=String(e.side2Score??0),e.winningSide===2&&n.classList.add(`chc-iss-score-cell-won`),c.append(n)}if(a.length===0){let e=document.createElement(`div`);e.className=UP,e.textContent=`0`,s.append(e);let t=document.createElement(`div`);t.className=UP,t.textContent=`0`,c.append(t)}o.append(s,c),r.append(o);let l=a.at(-1);if(l&&!l.winningSide&&l.side1PointScore!=null){let e=document.createElement(`div`);e.className=`chc-iss-game-score`;let t=document.createElement(`span`);t.className=`chc-iss-game-score-side1`,t.textContent=String(l.side1PointScore);let n=document.createElement(`span`);n.className=`chc-iss-game-score-sep`,n.textContent=` — `;let i=document.createElement(`span`);i.className=`chc-iss-game-score-side2`,i.textContent=String(l.side2PointScore),e.append(t,n,i),r.append(e)}if(e.isComplete(t.matchUpId)){let e=document.createElement(`div`);e.className=`chc-iss-match-complete`,e.textContent=`${(i.winningSide===1?t.side1Name:t.side2Name)||`Match`} wins`,r.append(e)}return r}function JP(e,t,n){let r=document.createElement(`div`);r.className=`chc-iss-point-buttons`;let i=e.isComplete(t.matchUpId),a=document.createElement(`button`);a.type=`button`,a.className=`chc-iss-point-button chc-iss-point-button-side1`,a.disabled=i,a.setAttribute(`aria-label`,`${t.side1Name} won the point`);let o=document.createElement(`span`);o.className=`chc-iss-point-button-label`,o.textContent=t.side1Name||`Side 1`;let s=document.createElement(`span`);s.className=`chc-iss-point-button-hint`,s.textContent=`won the point`,a.append(o,s),a.addEventListener(`click`,()=>n(0));let c=document.createElement(`button`);c.type=`button`,c.className=`chc-iss-point-button chc-iss-point-button-side2`,c.disabled=i,c.setAttribute(`aria-label`,`${t.side2Name} won the point`);let l=document.createElement(`span`);l.className=`chc-iss-point-button-label`,l.textContent=t.side2Name||`Side 2`;let u=document.createElement(`span`);return u.className=`chc-iss-point-button-hint`,u.textContent=`won the point`,c.append(l,u),c.addEventListener(`click`,()=>n(1)),r.append(a,c),r}function YP(e,t,n,r){let i=document.createElement(`div`);i.className=`chc-iss-control-bar`;let a=document.createElement(`button`);a.type=`button`,a.className=`chc-iss-control-button chc-iss-control-undo`,a.textContent=`Undo`,a.disabled=!e.canUndo(t.matchUpId),a.addEventListener(`click`,n);let o=document.createElement(`button`);return o.type=`button`,o.className=`chc-iss-control-button chc-iss-control-reset`,o.textContent=`Reset`,o.addEventListener(`click`,r),i.append(a,o),i}function XP(){return typeof globalThis>`u`||typeof globalThis.confirm!=`function`?!1:globalThis.confirm(`Reset the scoring session? This will clear all points.`)}function ZP(){return{policyName:`New Ranking Policy`,policyVersion:`1.0`,awardProfiles:[{profileName:`Default`,finishingPositionRanges:{1:100,2:70,4:50,8:30,16:15,32:8}}],requireWinForPoints:!0,doublesAttribution:`fullToEach`}}function Q(e){return structuredClone(e)}var QP=class{constructor(e){this.listeners=new Set,this.config=e;let t=Q(e.initialPolicy??ZP()),n=t.awardProfiles?.length??0;this.state={draft:t,expandedSections:new Set(n>5?[`awardProfiles`]:[`metadata`,`awardProfiles`,`qualityWinProfiles`,`aggregationRules`]),expandedProfiles:new Set(n<=5?Array.from({length:n},(e,t)=>t):[]),profileFilter:``,dirty:!1,readonly:e.readonly??!1}}getState(){return this.state}getData(){return Q(this.state.draft)}setData(e){let t=e.awardProfiles?.length??0;this.state={...this.state,draft:Q(e),expandedProfiles:new Set(t<=5?Array.from({length:t},(e,t)=>t):[]),profileFilter:``,dirty:!1},this.emit()}toggleSection(e){let t=new Set(this.state.expandedSections);t.has(e)?t.delete(e):t.add(e),this.state={...this.state,expandedSections:t},this.emit()}toggleProfile(e){let t=new Set(this.state.expandedProfiles);t.has(e)?t.delete(e):t.add(e),this.state={...this.state,expandedProfiles:t},this.emit()}setProfileFilter(e){this.state={...this.state,profileFilter:e},this.emit()}setPolicyName(e){let t=Q(this.state.draft);t.policyName=e,this.commitDraft(t)}setPolicyVersion(e){let t=Q(this.state.draft);t.policyVersion=e,this.commitDraft(t)}setValidDateRange(e,t){let n=Q(this.state.draft);n.validDateRange||={},n.validDateRange[e]=t||void 0,this.commitDraft(n)}setGlobalFlag(e,t){let n=Q(this.state.draft);n[e]=t,this.commitDraft(n)}setDoublesAttribution(e){let t=Q(this.state.draft);t.doublesAttribution=e||void 0,this.commitDraft(t)}setCategoryResolution(e){let t=Q(this.state.draft);t.categoryResolution=e||void 0,this.commitDraft(t)}addProfile(){let e=Q(this.state.draft);e.awardProfiles||=[],e.awardProfiles.push({profileName:`Profile ${e.awardProfiles.length+1}`,finishingPositionRanges:{1:100,2:70,4:50,8:30}});let t=new Set(this.state.expandedProfiles);t.add(e.awardProfiles.length-1),this.state={...this.state,expandedProfiles:t},this.commitDraft(e)}removeProfile(e){let t=Q(this.state.draft);if(!t.awardProfiles||e<0||e>=t.awardProfiles.length)return;t.awardProfiles.splice(e,1);let n=new Set;for(let t of this.state.expandedProfiles)t<e?n.add(t):t>e&&n.add(t-1);this.state={...this.state,expandedProfiles:n},this.commitDraft(t)}duplicateProfile(e){let t=Q(this.state.draft);if(!t.awardProfiles||e<0||e>=t.awardProfiles.length)return;let n=Q(t.awardProfiles[e]);n.profileName=`${n.profileName??`Profile`} (Copy)`,t.awardProfiles.splice(e+1,0,n);let r=new Set;for(let t of this.state.expandedProfiles)t<=e?r.add(t):r.add(t+1);r.add(e+1),this.state={...this.state,expandedProfiles:r},this.commitDraft(t)}moveProfile(e,t){let n=Q(this.state.draft);if(!n.awardProfiles||e<0||e>=n.awardProfiles.length||t<0||t>=n.awardProfiles.length)return;let[r]=n.awardProfiles.splice(e,1);n.awardProfiles.splice(t,0,r),this.commitDraft(n)}setProfileName(e,t){let n=Q(this.state.draft);n.awardProfiles?.[e]&&(n.awardProfiles[e].profileName=t,this.commitDraft(n))}setProfileFlag(e,t,n){let r=Q(this.state.draft);r.awardProfiles?.[e]&&(n===void 0?delete r.awardProfiles[e][t]:r.awardProfiles[e][t]=n,this.commitDraft(r))}setFlatPositionPoints(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e];i&&(i.finishingPositionRanges||={},i.finishingPositionRanges[t]=n,this.commitDraft(r))}addPositionRow(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];r&&(r.finishingPositionRanges||={},r.finishingPositionRanges[t]===void 0&&(r.finishingPositionRanges[t]=0,this.commitDraft(n)))}removePositionRow(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];r?.finishingPositionRanges&&(delete r.finishingPositionRanges[t],this.commitDraft(n))}setPointsPerWin(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];r&&(t===void 0?delete r.pointsPerWin:r.pointsPerWin=t,this.commitDraft(n))}addBonusPoint(e){let t=Q(this.state.draft),n=t.awardProfiles?.[e];n&&(n.bonusPoints||=[],n.bonusPoints.push({finishingPositions:[1],value:0}),this.commitDraft(t))}removeBonusPoint(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];r?.bonusPoints&&(r.bonusPoints.splice(t,1),r.bonusPoints.length||delete r.bonusPoints,this.commitDraft(n))}setBonusPointPositions(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e]?.bonusPoints?.[t];i&&(i.finishingPositions=n,this.commitDraft(r))}setBonusPointValue(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e]?.bonusPoints?.[t];i&&(i.value=n,this.commitDraft(r))}setLevelPositionPoints(e,t,n,r){let i=Q(this.state.draft),a=i.awardProfiles?.[e];if(!a)return;a.finishingPositionRanges||={};let o=a.finishingPositionRanges[t];o&&typeof o==`object`&&o.level&&(o.level[n]=r),this.commitDraft(i)}addLevel(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];if(r?.finishingPositionRanges){for(let e of Object.keys(r.finishingPositionRanges)){let n=r.finishingPositionRanges[e];n&&typeof n==`object`&&n.level&&n.level[t]===void 0&&(n.level[t]=0)}r.levels&&!r.levels.includes(t)&&(r.levels.push(t),r.levels.sort((e,t)=>e-t)),this.commitDraft(n)}}removeLevel(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];if(r?.finishingPositionRanges){for(let e of Object.keys(r.finishingPositionRanges)){let n=r.finishingPositionRanges[e];n&&typeof n==`object`&&n.level&&delete n.level[t]}r.levels&&=r.levels.filter(e=>e!==t),this.commitDraft(n)}}setProfileScope(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e];i&&(n.length?i[t]=n:delete i[t],this.commitDraft(r))}setProfileField(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e];i&&(n===void 0||n===``?delete i[t]:i[t]=n,this.commitDraft(r))}addQualityWinProfile(){let e=Q(this.state.draft);e.qualityWinProfiles||=[],e.qualityWinProfiles.push({rankingScaleName:`New Profile`,rankingRanges:[{rankRange:[1,10],value:10}]}),this.commitDraft(e)}removeQualityWinProfile(e){let t=Q(this.state.draft);t.qualityWinProfiles&&(t.qualityWinProfiles.splice(e,1),t.qualityWinProfiles.length||delete t.qualityWinProfiles,this.commitDraft(t))}setQualityWinField(e,t,n){let r=Q(this.state.draft),i=r.qualityWinProfiles?.[e];i&&(n===void 0||n===``?delete i[t]:i[t]=n,this.commitDraft(r))}addQualityWinRange(e){let t=Q(this.state.draft),n=t.qualityWinProfiles?.[e];if(!n)return;let r=n.rankingRanges.at(-1),i=r?r.rankRange[1]+1:1;n.rankingRanges.push({rankRange:[i,i+9],value:0}),this.commitDraft(t)}removeQualityWinRange(e,t){let n=Q(this.state.draft),r=n.qualityWinProfiles?.[e];r&&(r.rankingRanges.splice(t,1),this.commitDraft(n))}setQualityWinRange(e,t,n,r){let i=Q(this.state.draft),a=i.qualityWinProfiles?.[e]?.rankingRanges?.[t];a&&(n===`rankRange`?a.rankRange=r:a.value=r,this.commitDraft(i))}setAggregationField(e,t){let n=Q(this.state.draft);n.aggregationRules||={},t===void 0||t===``?delete n.aggregationRules[e]:n.aggregationRules[e]=t,this.commitDraft(n)}addTiebreakCriterion(e){let t=Q(this.state.draft);t.aggregationRules||={},t.aggregationRules.tiebreakCriteria||(t.aggregationRules.tiebreakCriteria=[]),t.aggregationRules.tiebreakCriteria.push(e),this.commitDraft(t)}removeTiebreakCriterion(e){let t=Q(this.state.draft);t.aggregationRules?.tiebreakCriteria&&(t.aggregationRules.tiebreakCriteria.splice(e,1),t.aggregationRules.tiebreakCriteria.length||delete t.aggregationRules.tiebreakCriteria,this.commitDraft(t))}addCountingBucket(){let e=Q(this.state.draft);e.aggregationRules||={},e.aggregationRules.countingBuckets||(e.aggregationRules.countingBuckets=[]),e.aggregationRules.countingBuckets.push({bucketName:`New Bucket`}),this.commitDraft(e)}removeCountingBucket(e){let t=Q(this.state.draft);t.aggregationRules?.countingBuckets&&(t.aggregationRules.countingBuckets.splice(e,1),t.aggregationRules.countingBuckets.length||delete t.aggregationRules.countingBuckets,this.commitDraft(t))}setCountingBucketField(e,t,n){let r=Q(this.state.draft),i=r.aggregationRules?.countingBuckets?.[e];i&&(n===void 0||n===``?delete i[t]:i[t]=n,this.commitDraft(r))}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}commitDraft(e){this.state={...this.state,draft:e,dirty:!0},this.emit(),this.config.onChange?.(Q(e))}emit(){for(let e of this.listeners)e(this.state)}},$P=()=>`re-section`,eF=()=>`re-section-header`,tF=()=>`re-section-chevron`,nF=()=>`re-section-count`,rF=()=>`re-section-body`,iF=()=>`re-field-row`,aF=()=>`re-field-label`,oF=()=>`re-field-input re-field-input--text`,sF=()=>`re-field-input re-field-input--number`,cF=()=>`re-field-input re-field-input--date`,lF=()=>`re-field-select`,uF=()=>`re-checkbox-row`,dF=()=>`re-points-input`,fF=()=>`re-profile-card`,pF=()=>`re-profile-header`,mF=()=>`re-profile-name-input`,hF=()=>`re-profile-body`,gF=()=>`re-profile-actions`,_F=()=>`re-icon-btn`,vF=()=>`re-icon-btn re-icon-btn--danger`,yF=()=>`re-empty`,bF=()=>`re-editor`,xF=[`totalPoints`,`bestResult`,`headToHead`,`numberOfWins`,`recentResults`,`drawSize`,`numberOfResults`];function SF(e){let t=document.createElement(`div`),n=``;function r(t,n,r,i,a,o){let s=document.createElement(`div`);s.className=iF();let c=document.createElement(`div`);if(c.className=aF(),c.textContent=n,s.appendChild(c),o){let e=document.createElement(`span`);e.style.cssText=`font-size:0.85rem;color:var(--sp-text)`,e.textContent=String(i),s.appendChild(e)}else if(r===`select`){let n=document.createElement(`select`);n.className=lF();let r=document.createElement(`option`);r.value=``,r.textContent=`(none)`,n.appendChild(r);for(let e of a??[]){let t=document.createElement(`option`);t.value=e,t.textContent=e,n.appendChild(t)}n.value=i??``,n.addEventListener(`change`,()=>e.setAggregationField(t,n.value||void 0)),s.appendChild(n)}else{let n=document.createElement(`input`);n.type=`number`,n.className=sF(),n.value=i===void 0?``:String(i),n.placeholder=`—`,n.addEventListener(`change`,()=>{let r=n.value.trim();e.setAggregationField(t,r?Number.parseInt(r,10):void 0)}),s.appendChild(n)}return s}function i(n,r){let i=document.createElement(`div`);if(i.style.cssText=`font-weight:600;font-size:0.8rem;margin:0.5rem 0 0.3rem;color:var(--sp-text)`,i.textContent=`Tiebreak Order`,t.appendChild(i),n.length){let i=document.createElement(`ol`);i.style.cssText=`font-size:0.8rem;margin:0;padding-left:1.5rem;color:var(--sp-text)`;for(let t=0;t<n.length;t++){let a=document.createElement(`li`);a.style.cssText=`display:flex;align-items:center;gap:6px;margin-bottom:2px`;let o=document.createElement(`span`);if(o.textContent=n[t],a.appendChild(o),!r){let n=document.createElement(`span`);n.className=vF(),n.textContent=`×`,n.style.cursor=`pointer`,n.addEventListener(`click`,()=>e.removeTiebreakCriterion(t)),a.appendChild(n)}i.appendChild(a)}t.appendChild(i)}else if(r){let e=document.createElement(`div`);e.className=yF(),e.textContent=`No tiebreak criteria`,t.appendChild(e)}if(!r){let r=document.createElement(`div`);r.style.cssText=`display:flex;align-items:center;gap:4px;margin-top:4px`;let i=document.createElement(`select`);i.className=lF(),i.style.fontSize=`0.75rem`;let a=new Set(n),o=xF.filter(e=>!a.has(e));for(let e of o){let t=document.createElement(`option`);t.value=e,t.textContent=e,i.appendChild(t)}let s=document.createElement(`button`);s.className=`sp-btn sp-btn--sm sp-btn--outline`,s.textContent=`+ Add`,s.addEventListener(`click`,()=>{i.value&&e.addTiebreakCriterion(i.value)}),o.length&&(r.appendChild(i),r.appendChild(s),t.appendChild(r))}}function a(t,n,r){let i=document.createElement(`div`);i.style.cssText=`border:1px solid var(--sp-border);border-radius:8px;padding:0.4rem;margin-bottom:0.4rem;font-size:0.8rem`;let a=document.createElement(`div`);if(a.style.cssText=`display:flex;align-items:center;gap:6px;margin-bottom:0.2rem`,r){let e=document.createElement(`span`);e.style.cssText=`font-weight:600;color:var(--sp-text)`,e.textContent=t.bucketName||`Bucket`,a.appendChild(e)}else{let r=document.createElement(`input`);r.type=`text`,r.className=`re-field-input re-field-input--text`,r.style.cssText=`width:120px;font-size:0.75rem;font-weight:600`,r.value=t.bucketName||``,r.placeholder=`Bucket name`,r.addEventListener(`change`,()=>e.setCountingBucketField(n,`bucketName`,r.value)),a.appendChild(r);let i=document.createElement(`div`);i.style.flexGrow=`1`,a.appendChild(i);let o=document.createElement(`span`);o.className=vF(),o.textContent=`✕`,o.style.cursor=`pointer`,o.addEventListener(`click`,()=>e.removeCountingBucket(n)),a.appendChild(o)}i.appendChild(a);let o=[];if(t.eventTypes?.length&&o.push(`Events: ${t.eventTypes.join(`, `)}`),t.bestOfCount!==void 0&&o.push(`Best of: ${t.bestOfCount}`),t.levels?.length&&o.push(`Levels: ${t.levels.join(`, `)}`),t.minResults!==void 0&&o.push(`Min: ${t.minResults}`),r&&o.length){let e=document.createElement(`div`);e.style.cssText=`color:var(--sp-muted);font-size:0.75rem`,e.textContent=o.join(` | `),i.appendChild(e)}else if(!r){let r=document.createElement(`div`);r.className=iF();let a=document.createElement(`div`);a.className=aF(),a.style.cssText=`min-width:70px;font-size:0.75rem`,a.textContent=`Best of`,r.appendChild(a);let o=document.createElement(`input`);o.type=`number`,o.className=sF(),o.style.fontSize=`0.75rem`,o.value=t.bestOfCount===void 0?``:String(t.bestOfCount),o.addEventListener(`change`,()=>{let t=o.value.trim();e.setCountingBucketField(n,`bestOfCount`,t?Number.parseInt(t,10):void 0)}),r.appendChild(o),i.appendChild(r)}return i}function o(n){let o=n.draft.aggregationRules;if(t.innerHTML=``,!o&&n.readonly){let e=document.createElement(`div`);e.className=yF(),e.textContent=`No aggregation rules defined (all results summed)`,t.appendChild(e);return}let s=[[`rollingPeriodDays`,`Rolling period (days)`,`number`,o?.rollingPeriodDays],[`bestOfCount`,`Best of count`,`number`,o?.bestOfCount],[`minCountableResults`,`Min countable results`,`number`,o?.minCountableResults],[`decayFunction`,`Decay function`,`select`,o?.decayFunction,[`none`,`linear`,`exponential`,`step`]]];for(let[e,i,a,o,c]of s)o===void 0&&n.readonly||t.appendChild(r(e,i,a,o,c,n.readonly));let c=[[`separateByGender`,`Separate by gender`,o?.separateByGender],[`perCategory`,`Per category`,o?.perCategory]];for(let[r,i,a]of c){if(a===void 0&&n.readonly)continue;let o=document.createElement(`div`);o.className=uF();let s=document.createElement(`input`);s.type=`checkbox`,s.checked=a??!1,s.disabled=n.readonly,s.addEventListener(`change`,()=>e.setAggregationField(r,s.checked));let c=document.createElement(`label`);c.textContent=i,o.appendChild(s),o.appendChild(c),t.appendChild(o)}i(o?.tiebreakCriteria??[],n.readonly);let l=o?.countingBuckets??[];if(l.length||!n.readonly){let r=document.createElement(`div`);r.style.cssText=`font-weight:600;font-size:0.8rem;margin:0.5rem 0 0.3rem;color:var(--sp-text)`,r.textContent=`Counting Buckets`,t.appendChild(r);for(let e=0;e<l.length;e++)t.appendChild(a(l[e],e,n.readonly));if(!n.readonly){let n=document.createElement(`button`);n.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,n.textContent=`+ Add Bucket`,n.addEventListener(`click`,()=>e.addCountingBucket()),t.appendChild(n)}}}function s(e){let t=JSON.stringify(e.draft.aggregationRules??{});t!==n&&(n=t,o(e))}return{element:t,update:s}}function CF(e){let t=document.createElement(`div`),n=``;function r(t,n,r){let i=document.createElement(`div`);if(i.style.cssText=`display:flex;align-items:center;gap:0.5rem;margin-bottom:0.4rem`,r){let e=document.createElement(`span`);e.style.cssText=`font-weight:600;font-size:0.85rem;color:var(--sp-text)`,e.textContent=n.rankingScaleName,i.appendChild(e)}else{let r=document.createElement(`input`);r.type=`text`,r.className=oF(),r.style.cssText=`width:150px;font-weight:600`,r.value=n.rankingScaleName,r.addEventListener(`change`,()=>e.setQualityWinField(t,`rankingScaleName`,r.value)),i.appendChild(r);let a=document.createElement(`div`);a.style.flexGrow=`1`,i.appendChild(a);let o=document.createElement(`span`);o.className=vF(),o.textContent=`✕`,o.title=`Delete profile`,o.style.cursor=`pointer`,o.addEventListener(`click`,()=>e.removeQualityWinProfile(t)),i.appendChild(o)}return i}let i=`text-align:right;padding:2px 4px`,a=`text-align:right;width:4rem`;function o(t,n,r,a){let o=document.createElement(`tr`);if(a)for(let e of[r.rankRange[0],r.rankRange[1],r.value]){let t=document.createElement(`td`);t.style.cssText=`text-align:right;font-variant-numeric:tabular-nums;padding:2px 4px`,t.textContent=e.toLocaleString(),o.appendChild(t)}else{let a=document.createElement(`td`);a.style.cssText=i,a.appendChild(wF(r.rankRange[0],i=>{e.setQualityWinRange(t,n,`rankRange`,[i,r.rankRange[1]])})),o.appendChild(a);let s=document.createElement(`td`);s.style.cssText=i,s.appendChild(wF(r.rankRange[1],i=>{e.setQualityWinRange(t,n,`rankRange`,[r.rankRange[0],i])})),o.appendChild(s);let c=document.createElement(`td`);c.style.cssText=i,c.appendChild(wF(r.value,r=>{e.setQualityWinRange(t,n,`value`,r)})),o.appendChild(c);let l=document.createElement(`td`);l.style.cssText=`text-align:center;padding:2px`;let u=document.createElement(`span`);u.className=vF(),u.textContent=`×`,u.style.cursor=`pointer`,u.addEventListener(`click`,()=>e.removeQualityWinRange(t,n)),l.appendChild(u),o.appendChild(l)}return o}function s(e,t,n){let r=document.createElement(`table`);r.style.cssText=`font-size:0.8rem;margin-bottom:0.3rem;border-collapse:collapse`;let i=document.createElement(`thead`),s=document.createElement(`tr`);for(let[e,t]of[[`From`,a],[`To`,a],[`Bonus`,a]]){let n=document.createElement(`th`);n.textContent=e,n.style.cssText=t+`;padding:2px 4px`,s.appendChild(n)}if(!n){let e=document.createElement(`th`);e.style.cssText=`width:2rem;padding:2px`,s.appendChild(e)}i.appendChild(s),r.appendChild(i);let c=document.createElement(`tbody`);for(let r=0;r<t.rankingRanges.length;r++)c.appendChild(o(e,r,t.rankingRanges[r],n));return r.appendChild(c),r}function c(t,n,r,i,a){let o=document.createElement(`div`);o.className=iF();let s=document.createElement(`div`);if(s.className=aF(),s.style.minWidth=`100px`,s.style.fontSize=`0.75rem`,s.textContent=r,o.appendChild(s),a){let e=document.createElement(`span`);e.style.cssText=`font-size:0.75rem;color:var(--sp-muted)`,e.textContent=String(i),o.appendChild(e)}else{let r=document.createElement(`input`);r.type=typeof i==`number`?`number`:`text`,r.className=typeof i==`number`?sF():oF(),r.style.fontSize=`0.75rem`,r.value=i===void 0?``:String(i),r.addEventListener(`change`,()=>{let a=r.value.trim();typeof i==`number`||n===`maxBonusPerTournament`?e.setQualityWinField(t,n,a?Number.parseFloat(a):void 0):e.setQualityWinField(t,n,a||void 0)}),o.appendChild(r)}return o}function l(n){let i=n.draft.qualityWinProfiles;if(t.innerHTML=``,!i?.length){let r=document.createElement(`div`);if(r.className=yF(),r.textContent=`No quality win profiles defined`,t.appendChild(r),!n.readonly){let n=document.createElement(`button`);n.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,n.textContent=`+ Add Quality Win Profile`,n.addEventListener(`click`,()=>e.addQualityWinProfile()),t.appendChild(n)}return}for(let a=0;a<i.length;a++){let o=i[a],l=document.createElement(`div`);if(l.style.cssText=`border:1px solid var(--sp-border);border-radius:10px;padding:0.5rem;margin-bottom:0.5rem`,l.appendChild(r(a,o,n.readonly)),o.rankingRanges?.length&&(l.appendChild(s(a,o,n.readonly)),!n.readonly)){let t=document.createElement(`button`);t.className=`sp-btn sp-btn--sm sp-btn--outline`,t.textContent=`+ Range`,t.style.marginBottom=`0.3rem`,t.addEventListener(`click`,()=>e.addQualityWinRange(a)),l.appendChild(t)}let u=[[`maxBonusPerTournament`,`Max bonus/tournament`,o.maxBonusPerTournament],[`rankingSnapshot`,`Ranking snapshot`,o.rankingSnapshot]];for(let[e,t,r]of u)r===void 0&&n.readonly||l.appendChild(c(a,e,t,r,n.readonly));if(o.includeWalkovers!==void 0||!n.readonly){let t=document.createElement(`div`);t.className=uF();let r=document.createElement(`input`);r.type=`checkbox`,r.checked=o.includeWalkovers??!1,r.disabled=n.readonly,r.addEventListener(`change`,()=>e.setQualityWinField(a,`includeWalkovers`,r.checked));let i=document.createElement(`label`);i.textContent=`Include walkovers`,i.style.fontSize=`0.75rem`,t.appendChild(r),t.appendChild(i),l.appendChild(t)}t.appendChild(l)}if(!n.readonly){let n=document.createElement(`button`);n.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,n.textContent=`+ Add Quality Win Profile`,n.addEventListener(`click`,()=>e.addQualityWinProfile()),t.appendChild(n)}}function u(e){let t=JSON.stringify(e.draft.qualityWinProfiles??[]);t!==n&&(n=t,l(e))}return{element:t,update:u}}function wF(e,t){let n=document.createElement(`input`);return n.type=`number`,n.className=dF(),n.value=String(e),n.addEventListener(`change`,()=>{let e=Number.parseFloat(n.value);Number.isNaN(e)||t(e)}),n}function TF(e){let t=document.createElement(`div`),n=document.createElement(`div`);n.className=iF();let r=document.createElement(`div`);r.className=aF(),r.textContent=`Name`;let i=document.createElement(`input`);i.type=`text`,i.className=oF(),i.placeholder=`Policy name`,i.addEventListener(`change`,()=>e.setPolicyName(i.value)),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=iF();let o=document.createElement(`div`);o.className=aF(),o.textContent=`Version`;let s=document.createElement(`input`);s.type=`text`,s.className=oF(),s.placeholder=`1.0`,s.style.width=`80px`,s.addEventListener(`change`,()=>e.setPolicyVersion(s.value)),a.appendChild(o),a.appendChild(s),t.appendChild(a);let c=document.createElement(`div`);c.className=iF();let l=document.createElement(`div`);l.className=aF(),l.textContent=`Valid from`;let u=document.createElement(`input`);u.type=`date`,u.className=cF(),u.addEventListener(`change`,()=>e.setValidDateRange(`startDate`,u.value)),c.appendChild(l),c.appendChild(u),t.appendChild(c);let d=document.createElement(`div`);d.className=iF();let f=document.createElement(`div`);f.className=aF(),f.textContent=`Valid until`;let p=document.createElement(`input`);p.type=`date`,p.className=cF(),p.addEventListener(`change`,()=>e.setValidDateRange(`endDate`,p.value)),d.appendChild(f),d.appendChild(p),t.appendChild(d);let m=document.createElement(`div`);m.className=iF();let h=document.createElement(`div`);h.className=aF(),h.textContent=`Doubles attribution`;let g=document.createElement(`select`);g.className=lF();for(let[e,t]of[[``,`(none)`],[`fullToEach`,`Full to each`],[`halfToEach`,`Half to each`],[`split`,`Split`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,g.appendChild(n)}g.addEventListener(`change`,()=>e.setDoublesAttribution(g.value)),m.appendChild(h),m.appendChild(g),t.appendChild(m);let _=document.createElement(`div`);_.className=iF();let v=document.createElement(`div`);v.className=aF(),v.textContent=`Category resolution`;let y=document.createElement(`select`);y.className=lF();for(let[e,t]of[[``,`(none)`],[`matchCategory`,`Match category`],[`eventCategory`,`Event category`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,y.appendChild(n)}y.addEventListener(`change`,()=>e.setCategoryResolution(y.value)),_.appendChild(v),_.appendChild(y),t.appendChild(_);let b=document.createElement(`div`);b.className=uF();let x=document.createElement(`input`);x.type=`checkbox`,x.id=`re-require-win`;let S=document.createElement(`label`);S.htmlFor=`re-require-win`,S.textContent=`Require win for points`,x.addEventListener(`change`,()=>e.setGlobalFlag(`requireWinForPoints`,x.checked)),b.appendChild(x),b.appendChild(S),t.appendChild(b);let C=document.createElement(`div`);C.className=uF();let w=document.createElement(`input`);w.type=`checkbox`,w.id=`re-require-win-r1`;let T=document.createElement(`label`);T.htmlFor=`re-require-win-r1`,T.textContent=`Require win in first round`,w.addEventListener(`change`,()=>e.setGlobalFlag(`requireWinFirstRound`,w.checked)),C.appendChild(w),C.appendChild(T),t.appendChild(C);let E=[i,s,u,p],D=[g,y],O=[x,w];function k(e){let{draft:t}=e;document.activeElement!==i&&(i.value=t.policyName??``),document.activeElement!==s&&(s.value=t.policyVersion??``),document.activeElement!==u&&(u.value=t.validDateRange?.startDate??``),document.activeElement!==p&&(p.value=t.validDateRange?.endDate??``),document.activeElement!==g&&(g.value=t.doublesAttribution??``),document.activeElement!==y&&(y.value=t.categoryResolution??``),x.checked=t.requireWinForPoints??!1,w.checked=t.requireWinFirstRound??!1;let n=e.readonly;for(let e of E)e.disabled=n;for(let e of D)e.disabled=n;for(let e of O)e.disabled=n}return{element:t,update:k}}var EF={1:`W`,2:`F`,4:`SF`,8:`QF`,16:`R16`,32:`R32`,64:`R64`,128:`R128`,256:`R256`},DF=`level-keyed`;function OF(e){return EF[e]??`R${e}`}function kF(e){if(!e)return{type:`flat`};let t=Object.values(e);if(!t.length||t.every(e=>typeof e==`number`))return{type:`flat`};let n=AF(t);return n.hasConditionalArray?{type:`conditional`}:n.hasLevelFlightNesting?jF(t,n.allLevels):n.allLevels.size>0?{type:`level-columns`,levels:[...n.allLevels].sort((e,t)=>e-t)}:n.allFlights.size>0?{type:`flight-columns`,flights:[...n.allFlights].sort((e,t)=>e-t)}:{type:`flat`}}function AF(e){let t=new Set,n=new Set,r=!1,i=!1;for(let a of e){let e=MF(a);if(e.type===DF){for(let n of e.levels)t.add(n);e.hasFlightNesting&&(i=!0)}else if(e.type===`flight-keyed`)for(let t=0;t<e.flightCount;t++)n.add(t+1);else e.type===`conditional-array`&&(r=!0)}return{allLevels:t,allFlights:n,hasConditionalArray:r,hasLevelFlightNesting:i}}function jF(e,t){let n={},r=[...t].sort((e,t)=>e-t);for(let t of e){let e=MF(t);if(e.type===DF&&e.flightDetails)for(let[t,r]of Object.entries(e.flightDetails)){let e=Number(t);n[e]||(n[e]=[]);for(let t of r)n[e].includes(t)||n[e].push(t)}}return{type:`level-flight-tabs`,levels:r,flightsPerLevel:n}}function MF(e){if(typeof e==`number`)return{type:`flat`,levels:[],flightCount:0,hasFlightNesting:!1};if(Array.isArray(e))return{type:`conditional-array`,levels:[],flightCount:0,hasFlightNesting:!1};if(typeof e!=`object`||!e)return{type:`flat`,levels:[],flightCount:0,hasFlightNesting:!1};if(e.level!==void 0){if(Array.isArray(e.level))return{type:DF,levels:e.level.map((e,t)=>t+1),flightCount:0,hasFlightNesting:!1};if(typeof e.level==`object`){let t=Object.keys(e.level).map(Number).filter(e=>!Number.isNaN(e)),n=!1,r={};for(let[t,i]of Object.entries(e.level))typeof i==`object`&&i&&i.flights&&(n=!0,r[Number(t)]=i.flights.map((e,t)=>t+1));return{type:DF,levels:t,flightCount:0,hasFlightNesting:n,flightDetails:r}}}return e.flights!==void 0||e.f!==void 0?{type:`flight-keyed`,levels:[],flightCount:(e.flights??e.f??[]).length,hasFlightNesting:!1}:e.value===void 0?{type:`flat`,levels:[],flightCount:0,hasFlightNesting:!1}:{type:`explicit-flat`,levels:[],flightCount:0,hasFlightNesting:!1}}function NF(e,t={}){if(typeof e==`number`)return e;if(e!=null){if(Array.isArray(e))return PF(e,t);if(typeof e==`object`){if(e.level!==void 0&&t.level!==void 0)return FF(e,t);if(t.flight!==void 0){let n=e.flights??e.f;if(Array.isArray(n))return n[t.flight-1]}if(e.value!==void 0)return e.value}}}function PF(e,t){for(let n of e){if(n.drawSizes&&t.drawSize&&n.drawSizes.includes(t.drawSize))return NF(n,t);if(n.drawSize!==void 0&&t.drawSize!==void 0&&(n.threshold?t.drawSize>=n.drawSize:t.drawSize===n.drawSize))return NF({...n,drawSize:void 0,drawSizes:void 0,threshold:void 0},t);if(n.drawSize===void 0&&n.drawSizes===void 0)return NF(n,t)}}function FF(e,t){let n=Array.isArray(e.level)?e.level[t.level-1]:e.level[t.level];if(n!==void 0)return typeof n==`object`&&n?NF(n,t):typeof n==`number`?n:void 0}function IF(e){let t=[],n=Object.keys(e.finishingPositionRanges??{}).length;return n&&t.push(`${n} positions`),(e.perWinPoints||e.pointsPerWin)&&t.push(`per-win`),e.bonusPoints?.length&&t.push(`${e.bonusPoints.length} bonus`),t.join(`, `)||`empty`}function LF(e){let t=[];for(let n of e.eventTypes??[])t.push({label:n,intent:`re-badge--accent`});for(let n of e.stages??[])t.push({label:n,intent:`re-badge--success`});for(let n of e.levels??[])t.push({label:`L${n}`,intent:`re-badge--warn`});for(let n of e.drawTypes??[])t.push({label:n.replaceAll(`_`,` `),intent:`re-badge--primary`});return e.participationOrder!==void 0&&t.push({label:`PO:${e.participationOrder}`,intent:`re-badge--info`}),t}function RF(e){return e==null?`--`:e.toLocaleString()}var zF=[1,2,4,8,16,32,64,128],BF=`font-size:0.8rem;margin-bottom:0;border-collapse:collapse`,VF=`width:3.5rem;text-align:center`;function HF(e,t){let n=document.createElement(`div`);n.style.cssText=`overflow-x:auto`;let r=``;function i(r){let i=r.draft.awardProfiles?.[t]?.finishingPositionRanges;if(n.innerHTML=``,!i||!Object.keys(i).length){let i=document.createElement(`div`);if(i.className=yF(),i.textContent=`No finishing position points defined`,!r.readonly){let n=document.createElement(`button`);n.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,n.textContent=`+ Add position`,n.style.marginLeft=`8px`,n.addEventListener(`click`,()=>e.addPositionRow(t,1)),i.appendChild(n)}n.appendChild(i);return}let a=kF(i),o=Object.keys(i).map(Number).sort((e,t)=>e-t);a.type===`flat`?UF(n,o,i,r.readonly,e,t):a.type===`level-columns`?WF(n,o,i,a.levels,r.readonly,e,t):GF(n,o,i,a)}function a(e){let n=e.draft.awardProfiles?.[t],a=JSON.stringify(n?.finishingPositionRanges??{});a!==r&&(r=a,i(e))}return{element:n,update:a}}function UF(e,t,n,r,i,a){let o=document.createElement(`table`);o.style.cssText=BF;let s=document.createElement(`thead`),c=document.createElement(`tr`);KF(c,`Pos`,VF),KF(c,`Points`,`text-align:right`),r||KF(c,``,`width:2rem`),s.appendChild(c),o.appendChild(s);let l=document.createElement(`tbody`);for(let e of t){let t=document.createElement(`tr`);qF(t,e);let o=document.createElement(`td`);o.style.cssText=`text-align:right;padding:2px 4px`,r?(o.style.fontVariantNumeric=`tabular-nums`,o.textContent=RF(typeof n[e]==`number`?n[e]:NF(n[e]))):o.appendChild(YF(typeof n[e]==`number`?n[e]:NF(n[e])??0,t=>i.setFlatPositionPoints(a,e,t))),t.appendChild(o),r||JF(t,()=>i.removePositionRow(a,e)),l.appendChild(t)}o.appendChild(l),e.appendChild(o),r||XF(e,t,i,a)}function WF(e,t,n,r,i,a,o){let s=document.createElement(`table`);s.style.cssText=BF;let c=document.createElement(`thead`),l=document.createElement(`tr`);KF(l,`Pos`,VF);for(let e of r){let t=document.createElement(`th`);if(t.style.cssText=`text-align:right;min-width:3.5rem;padding:2px 4px`,i)t.textContent=`L${e}`;else{let n=document.createElement(`div`);n.style.cssText=`display:flex;align-items:center;justify-content:flex-end;gap:4px`;let r=document.createElement(`span`);r.textContent=`L${e}`,n.appendChild(r);let i=document.createElement(`span`);i.className=vF(),i.textContent=`×`,i.title=`Remove level ${e}`,i.style.cssText=`cursor:pointer;font-size:0.65rem`,i.addEventListener(`click`,()=>a.removeLevel(o,e)),n.appendChild(i),t.appendChild(n)}l.appendChild(t)}i||KF(l,``,`width:2rem`),c.appendChild(l),s.appendChild(c);let u=document.createElement(`tbody`);for(let e of t){let t=document.createElement(`tr`);qF(t,e);for(let s of r){let r=document.createElement(`td`);r.style.cssText=`text-align:right;padding:2px 4px`;let c=NF(n[e],{level:s});i?(r.style.fontVariantNumeric=`tabular-nums`,r.textContent=RF(c),c===void 0&&(r.style.color=`var(--sp-muted)`)):r.appendChild(YF(c??0,t=>a.setLevelPositionPoints(o,e,s,t))),t.appendChild(r)}i||JF(t,()=>a.removePositionRow(o,e)),u.appendChild(t)}if(s.appendChild(u),e.appendChild(s),!i){let n=document.createElement(`div`);n.style.cssText=`display:flex;gap:8px;margin-top:6px;flex-wrap:wrap`;let i=document.createElement(`div`);i.style.cssText=`display:flex;align-items:center;gap:4px`;let s=document.createElement(`input`);s.type=`number`,s.className=dF(),s.style.width=`50px`,s.placeholder=`L#`,s.min=`1`;let c=document.createElement(`button`);c.className=`sp-btn sp-btn--sm sp-btn--outline`,c.textContent=`+ Level`,c.addEventListener(`click`,()=>{let e=Number.parseInt(s.value,10);!Number.isNaN(e)&&e>0&&!r.includes(e)&&(a.addLevel(o,e),s.value=``)}),i.appendChild(s),i.appendChild(c),n.appendChild(i),ZF(n,t,a,o),e.appendChild(n)}}function GF(e,t,n,r){let i=document.createElement(`div`);i.style.cssText=`font-size:0.7rem;color:var(--sp-muted);margin-bottom:4px;font-style:italic`,i.textContent=`(${r.type} layout — view only)`,e.appendChild(i);let a=document.createElement(`table`);a.style.cssText=BF;let o=document.createElement(`thead`),s=document.createElement(`tr`);if(KF(s,`Pos`,VF),r.type===`flight-columns`)for(let e of r.flights)KF(s,`F${e}`,`text-align:right;min-width:3.5rem`);else KF(s,`Points`,`text-align:right`);o.appendChild(s),a.appendChild(o);let c=document.createElement(`tbody`);for(let e of t){let t=document.createElement(`tr`);qF(t,e);let i=n[e];if(r.type===`flight-columns`)for(let e of r.flights){let n=document.createElement(`td`);n.style.cssText=`text-align:right;font-variant-numeric:tabular-nums;padding:2px 4px`;let r=NF(i,{flight:e});n.textContent=RF(r),r===void 0&&(n.style.color=`var(--sp-muted)`),t.appendChild(n)}else{let e=document.createElement(`td`);if(e.style.cssText=`text-align:right;font-variant-numeric:tabular-nums;padding:2px 4px`,e.textContent=RF(NF(i)),Array.isArray(i)){let t=document.createElement(`span`);t.style.cssText=`margin-left:0.3rem;font-size:0.65rem;color:var(--sp-muted)`,t.textContent=`${i.length} variants`,t.title=JSON.stringify(i,null,2),e.appendChild(t)}t.appendChild(e)}c.appendChild(t)}a.appendChild(c),e.appendChild(a)}function KF(e,t,n){let r=document.createElement(`th`);r.textContent=t,r.style.cssText=n+`;padding:2px 4px`,e.appendChild(r)}function qF(e,t){let n=document.createElement(`td`);n.style.cssText=`text-align:center;font-weight:600;color:var(--sp-text);padding:2px 4px`,n.textContent=OF(t),e.appendChild(n)}function JF(e,t){let n=document.createElement(`td`);n.style.cssText=`text-align:center;vertical-align:middle;padding:2px`;let r=document.createElement(`span`);r.className=vF(),r.textContent=`×`,r.title=`Remove position`,r.style.cursor=`pointer`,r.addEventListener(`click`,t),n.appendChild(r),e.appendChild(n)}function YF(e,t){let n=document.createElement(`input`);return n.type=`number`,n.className=dF(),n.value=String(e),n.addEventListener(`change`,()=>{let e=Number.parseFloat(n.value);Number.isNaN(e)||t(e)}),n}function XF(e,t,n,r){let i=document.createElement(`div`);i.style.cssText=`display:flex;gap:8px;margin-top:6px;flex-wrap:wrap`,ZF(i,t,n,r),e.appendChild(i)}function ZF(e,t,n,r){let i=new Set(t),a=zF.filter(e=>!i.has(e));if(!a.length)return;let o=document.createElement(`div`);o.style.cssText=`display:flex;align-items:center;gap:4px`;let s=document.createElement(`select`);s.className=`re-field-select`,s.style.cssText=`min-width:80px;font-size:11px;padding:4px 6px`;for(let e of a){let t=document.createElement(`option`);t.value=String(e),t.textContent=OF(e),s.appendChild(t)}let c=document.createElement(`button`);c.className=`sp-btn sp-btn--sm sp-btn--outline`,c.textContent=`+ Position`,c.addEventListener(`click`,()=>{let e=Number.parseInt(s.value,10);Number.isNaN(e)||n.addPositionRow(r,e)}),o.appendChild(s),o.appendChild(c),e.appendChild(o)}function QF(e,t){let n=document.createElement(`div`);n.style.cssText=`padding:0.25rem 0;font-size:0.8rem`;let r=document.createElement(`div`);r.className=iF();let i=document.createElement(`div`);i.className=aF(),i.textContent=`Per-Win`,i.style.minWidth=`80px`;let a=document.createElement(`input`);a.type=`number`,a.className=dF(),a.placeholder=`—`,a.addEventListener(`change`,()=>{let n=a.value.trim();e.setPointsPerWin(t,n===``?void 0:parseFloat(n))});let o=document.createElement(`div`);o.style.cssText=`font-size:0.75rem;color:var(--sp-muted)`,r.appendChild(i),r.appendChild(a),n.appendChild(r),n.appendChild(o);function s(e){let r=e.draft.awardProfiles?.[t];if(!r){n.style.display=`none`;return}let i=r.perWinPoints,s=r.pointsPerWin;if(!i&&s===void 0){n.style.display=`none`;return}if(n.style.display=``,a.disabled=e.readonly,s!==void 0&&typeof s==`number`?(a.style.display=``,o.style.display=`none`,document.activeElement!==a&&(a.value=String(s))):s===void 0?i&&(a.style.display=`none`,o.style.display=``,o.textContent=(Array.isArray(i)?i:[i]).map(e=>{let t=[];return e.participationOrders?.length&&t.push(`PO:${e.participationOrders.join(`,`)}`),e.value!==void 0&&t.push(`${e.value} pts/win`),e.limit!==void 0&&t.push(`limit: ${e.limit}`),t.join(` | `)}).join(`; `)):(a.style.display=`none`,o.style.display=``,o.textContent=`${RF(NF(s))} pts/win (complex)`),r.maxCountableMatches!==void 0){let e=typeof r.maxCountableMatches==`number`?r.maxCountableMatches:`level-keyed`;o.style.display=``;let t=o.textContent;o.textContent=t?`${t} — max countable: ${e}`:`Max countable: ${e}`}}return{element:n,update:s}}function $F(e,t){let n=document.createElement(`div`);n.style.cssText=`padding:0.25rem 0;font-size:0.8rem`;let r=``;function i(r){let i=r.draft.awardProfiles?.[t]?.bonusPoints;if(n.innerHTML=``,!i?.length&&r.readonly){n.style.display=`none`;return}n.style.display=``;let a=document.createElement(`div`);if(a.style.cssText=`font-weight:600;color:var(--sp-text);margin-bottom:4px`,a.textContent=`Bonus Points`,n.appendChild(a),i?.length)for(let a=0;a<i.length;a++){let o=i[a],s=document.createElement(`div`);if(s.style.cssText=`display:flex;align-items:center;gap:6px;margin-bottom:4px;padding-left:0.5rem`,r.readonly){let e=o.finishingPositions.map(OF).join(`, `),t=document.createElement(`span`);t.textContent=`${e}: `,s.appendChild(t);let n=document.createElement(`span`);n.style.fontVariantNumeric=`tabular-nums`,n.textContent=typeof o.value==`number`?o.value.toLocaleString():String(o.value??`—`),s.appendChild(n)}else{let n=document.createElement(`span`);n.style.cssText=`font-size:0.75rem;color:var(--sp-muted);min-width:30px`,n.textContent=`Pos:`,s.appendChild(n);let r=document.createElement(`input`);r.type=`text`,r.className=dF(),r.style.width=`80px`,r.value=o.finishingPositions.join(`, `),r.title=`Comma-separated positions (e.g. 1, 2)`,r.addEventListener(`change`,()=>{let n=r.value.split(`,`).map(e=>Number.parseInt(e.trim(),10)).filter(e=>!Number.isNaN(e)&&e>0);n.length&&e.setBonusPointPositions(t,a,n)}),s.appendChild(r);let i=document.createElement(`span`);i.style.cssText=`font-size:0.75rem;color:var(--sp-muted)`,i.textContent=`Pts:`,s.appendChild(i);let c=document.createElement(`input`);c.type=`number`,c.className=dF(),c.value=typeof o.value==`number`?String(o.value):``,c.addEventListener(`change`,()=>{let n=Number.parseFloat(c.value);Number.isNaN(n)||e.setBonusPointValue(t,a,n)}),s.appendChild(c);let l=document.createElement(`span`);l.className=vF(),l.textContent=`×`,l.title=`Remove bonus`,l.style.cursor=`pointer`,l.addEventListener(`click`,()=>e.removeBonusPoint(t,a)),s.appendChild(l)}n.appendChild(s)}if(!r.readonly){let r=document.createElement(`button`);r.className=`sp-btn sp-btn--sm sp-btn--outline`,r.textContent=`+ Add bonus`,r.style.cssText=`margin-top:4px;margin-left:0.5rem`,r.addEventListener(`click`,()=>e.addBonusPoint(t)),n.appendChild(r)}}function a(e){let n=e.draft.awardProfiles?.[t],a=JSON.stringify(n?.bonusPoints??[]);a!==r&&(r=a,i(e))}return{element:n,update:a}}function eI(e){let t=document.createElement(`div`);t.style.cssText=`display:inline-flex;gap:0.25rem;flex-wrap:wrap;margin-bottom:0`;let n=LF(e);if(!n.length){let e=document.createElement(`span`);return e.className=`re-badge re-badge--neutral`,e.textContent=`All`,t.appendChild(e),t}for(let e of n){let n=document.createElement(`span`);n.className=`re-badge ${e.intent}`,n.textContent=e.label,t.appendChild(n)}return t}var tI=[{field:`eventTypes`,label:`Event types`,options:[`SINGLES`,`DOUBLES`,`TEAM`]},{field:`drawTypes`,label:`Draw types`,options:[`SINGLE_ELIMINATION`,`DOUBLE_ELIMINATION`,`ROUND_ROBIN`,`COMPASS`,`FEED_IN`,`AD_HOC`,`LUCKY_DRAW`]},{field:`stages`,label:`Stages`,options:[`MAIN`,`QUALIFYING`,`CONSOLATION`,`PLAY_OFF`]},{field:`levels`,label:`Levels`,options:[],isNumeric:!0}],nI=[[`maxDrawSize`,`Max draw size`],[`maxLevel`,`Max level`],[`priority`,`Priority`],[`participationOrder`,`Participation order`]];function rI(e,t){let n=document.createElement(`div`);n.style.cssText=`padding:0.25rem 0`;let r=document.createElement(`div`);r.style.cssText=`font-weight:600;font-size:0.8rem;color:var(--sp-text);margin-bottom:4px`,r.textContent=`Scope`,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=``;function o(n,r){if(n.isNumeric){let i=document.createElement(`input`);return i.type=`number`,i.min=`1`,i.placeholder=`+`,i.style.cssText=`width:36px;font-size:0.7rem;padding:2px 4px;border:1px dashed var(--sp-border);border-radius:4px;background:transparent;color:var(--sp-text);outline:none;text-align:center`,i.addEventListener(`keydown`,a=>{if(a.key===`Enter`){let a=Number.parseInt(i.value,10);!Number.isNaN(a)&&a>0&&!r.includes(a)&&(e.setProfileScope(t,n.field,[...r,a].sort((e,t)=>e-t)),i.value=``)}}),i}let i=n.options.filter(e=>!r.includes(e));if(!i.length)return;let a=document.createElement(`select`);a.style.cssText=`font-size:0.65rem;padding:2px 4px;border:1px dashed var(--sp-border);border-radius:4px;background:transparent;color:var(--sp-muted);outline:none;cursor:pointer`;let o=document.createElement(`option`);o.value=``,o.textContent=`+`,a.appendChild(o);for(let e of i){let t=document.createElement(`option`);t.value=e,t.textContent=e,a.appendChild(t)}return a.addEventListener(`change`,()=>{a.value&&e.setProfileScope(t,n.field,[...r,a.value])}),a}function s(n,r,i){let a=document.createElement(`div`);a.style.cssText=`margin-bottom:6px`;let s=document.createElement(`div`);s.style.cssText=`font-size:0.7rem;color:var(--sp-muted);margin-bottom:2px`,s.textContent=n.label,a.appendChild(s);let c=document.createElement(`div`);c.style.cssText=`display:flex;flex-wrap:wrap;gap:4px;align-items:center`;for(let a of r){let o=document.createElement(`span`);if(o.className=`re-badge re-badge--accent`,o.style.cssText=`display:inline-flex;align-items:center;gap:3px`,o.textContent=n.isNumeric?`L${a}`:String(a),!i){let i=document.createElement(`span`);i.style.cssText=`cursor:pointer;font-size:0.6rem;opacity:0.7`,i.textContent=`×`,i.addEventListener(`click`,()=>{e.setProfileScope(t,n.field,r.filter(e=>e!==a))}),o.appendChild(i)}c.appendChild(o)}if(!i){let e=o(n,r);e&&c.appendChild(e)}return a.appendChild(c),a}function c(r){i.innerHTML=``;let a=r.draft.awardProfiles?.[t];if(!a)return;let o=r.readonly;for(let e of tI){let t=a[e.field]??[];o&&!t.length||i.appendChild(s(e,t,o))}for(let[n,r]of nI){let s=a[n];if(o&&s===void 0)continue;let c=document.createElement(`div`);c.className=iF();let l=document.createElement(`div`);if(l.className=aF(),l.style.cssText=`min-width:110px;font-size:0.75rem`,l.textContent=r,c.appendChild(l),o){let e=document.createElement(`span`);e.style.cssText=`font-size:0.75rem;color:var(--sp-text)`,e.textContent=String(s),c.appendChild(e)}else{let r=document.createElement(`input`);r.type=`number`,r.className=sF(),r.style.fontSize=`0.75rem`,r.value=s===void 0?``:String(s),r.placeholder=`—`,r.addEventListener(`change`,()=>{let i=r.value.trim();e.setProfileField(t,n,i?Number.parseInt(i,10):void 0)}),c.appendChild(r)}i.appendChild(c)}let c=i.children.length>0;n.style.display=c?``:`none`}function l(e){let n=e.draft.awardProfiles?.[t],r=tI.map(e=>n?.[e.field]??[]),i=nI.map(([e])=>n?.[e]),o=JSON.stringify([r,i,e.readonly]);o!==a&&(a=o,c(e))}return{element:n,update:l}}function iI(e,t){let n=document.createElement(`div`);n.className=fF();let r=document.createElement(`div`);r.className=pF();let i=document.createElement(`span`);i.className=tF(),i.style.flexShrink=`0`,r.appendChild(i);let a=document.createElement(`input`);a.type=`text`,a.className=mF(),a.addEventListener(`click`,e=>e.stopPropagation()),a.addEventListener(`change`,()=>e.setProfileName(t,a.value)),r.appendChild(a);let o=document.createElement(`div`);o.style.cssText=`flex-grow:1;display:inline-flex;gap:0.25rem;flex-wrap:wrap`,r.appendChild(o);let s=document.createElement(`span`);s.style.cssText=`font-size:0.75rem;color:var(--sp-muted);white-space:nowrap;flex-shrink:0`,r.appendChild(s);let c=document.createElement(`div`);c.className=gF();let l=document.createElement(`button`);l.className=_F(),l.textContent=`⎘`,l.title=`Duplicate profile`,l.addEventListener(`click`,n=>{n.stopPropagation(),e.duplicateProfile(t)});let u=document.createElement(`button`);u.className=vF(),u.textContent=`✕`,u.title=`Delete profile`,u.addEventListener(`click`,n=>{n.stopPropagation(),e.removeProfile(t)}),c.appendChild(l),c.appendChild(u),r.appendChild(c),r.addEventListener(`click`,()=>e.toggleProfile(t)),n.appendChild(r);let d=document.createElement(`div`);d.className=hF();let f=document.createElement(`div`);f.style.cssText=`font-weight:600;font-size:0.85rem;color:var(--sp-text);margin-bottom:6px`,d.appendChild(f);let p=HF(e,t);d.appendChild(p.element);let m=QF(e,t);d.appendChild(m.element);let h=$F(e,t);d.appendChild(h.element);let g=rI(e,t);d.appendChild(g.element);let _=document.createElement(`div`);_.style.cssText=`padding:0.25rem 0;font-size:0.75rem;color:var(--sp-muted)`,d.appendChild(_),n.appendChild(d);function v(e){let r=e.draft.awardProfiles?.[t];if(!r){n.style.display=`none`;return}n.style.display=``;let l=e.expandedProfiles.has(t),u=e.readonly;i.textContent=l?`▼`:`▶`;let v=r.profileName||`Profile ${t+1}`;document.activeElement!==a&&(a.value=v),a.title=v,a.disabled=u,o.innerHTML=``;let y=eI(r);if(y.style.flexGrow=`1`,o.appendChild(y),s.textContent=l?``:IF(r),c.style.display=u?`none`:`flex`,d.style.display=l?``:`none`,l){f.textContent=v,p.update(e),m.update(e),h.update(e),g.update(e);let t=[];r.requireWinForPoints!==void 0&&t.push(`requireWin: ${r.requireWinForPoints}`),r.requireWinFirstRound!==void 0&&t.push(`requireWinR1: ${r.requireWinFirstRound}`),_.textContent=t.join(` | `),_.style.display=t.length?``:`none`}}return{element:n,update:v}}function aI(e,t){let n=document.createElement(`div`);n.className=bF();let r=TF(e),i=CF(e),a=SF(e),o=[{id:`metadata`,label:`Metadata`},{id:`awardProfiles`,label:`Award Profiles`,countFn:e=>e.draft.awardProfiles?.length??0},{id:`qualityWinProfiles`,label:`Quality Win Profiles`,countFn:e=>e.draft.qualityWinProfiles?.length??0},{id:`aggregationRules`,label:`Aggregation Rules`}],s=[];for(let t of o){let o=document.createElement(`div`);o.className=$P();let c=document.createElement(`div`);c.className=eF();let l=document.createElement(`span`);l.className=tF();let u=document.createElement(`span`);u.textContent=t.label;let d=document.createElement(`span`);d.className=nF(),c.appendChild(l),c.appendChild(u),c.appendChild(d),c.addEventListener(`click`,()=>e.toggleSection(t.id));let f=document.createElement(`div`);f.className=rF(),t.id===`metadata`&&f.appendChild(r.element),t.id===`qualityWinProfiles`&&f.appendChild(i.element),t.id===`aggregationRules`&&f.appendChild(a.element),o.appendChild(c),o.appendChild(f),n.appendChild(o),s.push({id:t.id,chevron:l,countEl:d,bodyEl:f})}let c=[],l=-1,u=``,d=null;function f(e,t){for(let n=0;n<o.length;n++){let r=o[n],i=s[n],a=e.has(r.id);if(i.chevron.textContent=a?`▼`:`▶`,i.bodyEl.style.display=a?`block`:`none`,r.countFn){let e=r.countFn(t);i.countEl.textContent=e?`(${e})`:``}}}function p(t,n){let r=s[1].bodyEl;r.innerHTML=``,c=[];let i=t.draft.awardProfiles??[],a=0;for(let t=0;t<i.length;t++){let o=i[t];if(n&&![o.profileName??``,...o.eventTypes??[],...o.stages??[],...(o.levels??[]).map(e=>`L${e}`),...o.drawTypes??[]].join(` `).toLowerCase().includes(n))continue;let s=iI(e,t);c.push(s),r.appendChild(s.element),a++}if(!a){let e=document.createElement(`div`);e.className=yF(),e.textContent=n?`No profiles match filter`:`No award profiles defined`,r.appendChild(e)}t.readonly||(d=document.createElement(`button`),d.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,d.textContent=`+ Add Profile`,d.addEventListener(`click`,()=>e.addProfile()),r.appendChild(d))}return{element:n,update:e=>{let{draft:t,expandedSections:n,profileFilter:o}=e;if(f(n,e),n.has(`metadata`)&&r.update(e),n.has(`awardProfiles`)){let n=t.awardProfiles?.length??0,r=o.toLowerCase();(n!==l||r!==u)&&(l=n,u=r,p(e,r));for(let t of c)t.update(e);d&&(d.style.display=e.readonly?`none`:``)}n.has(`qualityWinProfiles`)&&i.update(e),n.has(`aggregationRules`)&&a.update(e)}}}var oI=class e{constructor(e){this.container=null,this.store=new QP(e),this.panel=aI(this.store,e),this.unsubscribe=this.store.subscribe(e=>{this.panel.update(e)}),this.panel.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.panel.element)}destroy(){this.unsubscribe(),this.container&&this.panel.element.parentNode===this.container&&this.panel.element.remove(),this.container=null}getData(){return this.store.getData()}setData(e){this.store.setData(e)}getStore(){return this.store}static createEditorInstance(t){let n=new e({initialPolicy:t.initialData,onChange:e=>t.onChange(e),readonly:t.readonly});return{element:n.panel.element,setData(e){n.setData(e)},getData(){return n.getData()},destroy(){n.destroy()}}}};function sI(e){return cI[e]??e}var cI={"SET3-S:6/TB7":`Best of 3 TB sets`,"SET3-S:6/TB7-F:TB10":`2 TB sets, MTB10`,"SET3-S:6/TB7-F:TB7":`2 TB sets, MTB7`,"SET3-S:4NOAD-F:TB7":`2 short sets (4, NOAD), MTB7`,"SET3-S:4/TB7":`Best of 3 short sets (4)`,"SET3-S:4/TB7-F:TB7":`2 short sets (4), MTB7`,"SET3-S:4/TB7-F:TB10":`2 short sets (4), MTB10`,"SET3-S:4/TB5@3":`3 short sets (4), TB5@3`,"SET1-S:8/TB7":`8-game pro-set, TB7`,"SET1-S:8/TB7@7":`8-game pro-set, TB7@7`,"SET1-S:5/TB9@4":`1 set to 5, TB9@4`,"SET1-S:6/TB7":`1 TB set`,"SET1-S:6NOAD":`1 set to 6, NOAD`,"SET1-S:4/TB7":`1 short set (4), TB7`,"SET1-S:4/TB5@3":`1 short set (4), TB5@3`,"SET1-S:4NOAD":`1 short set (4), NOAD`,"SET3-S:TB10":`Best of 3 TB10 games`,"SET1-S:T20":`Timed 20 min`,"SET1-S:TB10":`1 TB10 game`,"SET5-S:6/TB7":`Best of 5 TB sets`,"SET5-S:6/TB7-F:TB10":`5 sets, MTB10`,"SET1-S:6/TB10":`1 set, TB10`,"SET1-S:8":`Pro-set to 8`,"SET1-S:10":`Pro-set to 10`,"SET1-S:T7":`TB7 only`,"SET1-S:T21":`TB21 only`};function lI(){return{allowModificationWhenMatchUpsScheduled:{courts:!1,venues:!1},defaultTimes:{averageTimes:[{categoryNames:[],minutes:{default:90}}],recoveryTimes:[{minutes:{default:60}}]},defaultDailyLimits:{SINGLES:2,DOUBLES:2,total:3},matchUpAverageTimes:[],matchUpRecoveryTimes:[],matchUpDailyLimits:[]}}function $(e){return structuredClone(e)}var uI=class{constructor(e){this.listeners=new Set,this.config=e,this.state={draft:$(e.initialPolicy??lI()),expandedSections:new Set([`modificationFlags`,`dailyLimits`,`defaultTimes`,`averageTimes`,`recoveryTimes`]),dirty:!1}}getState(){return this.state}getData(){return $(this.state.draft)}setData(e){this.state={...this.state,draft:$(e),dirty:!1},this.emit()}toggleSection(e){let t=new Set(this.state.expandedSections);t.has(e)?t.delete(e):t.add(e),this.state={...this.state,expandedSections:t},this.emit()}setModificationFlag(e,t){let n=$(this.state.draft);n.allowModificationWhenMatchUpsScheduled||={courts:!1,venues:!1},n.allowModificationWhenMatchUpsScheduled[e]=t,this.commitDraft(n)}setDailyLimit(e,t){let n=$(this.state.draft);n.defaultDailyLimits||={},n.defaultDailyLimits[e]=t,this.commitDraft(n)}setDefaultAverageTime(e,t,n){let r=$(this.state.draft);r.defaultTimes||={},r.defaultTimes.averageTimes||(r.defaultTimes.averageTimes=[{categoryNames:[],minutes:{default:90}}]);let i=r.defaultTimes.averageTimes[e];i&&(t===`DOUBLES`?n===void 0?delete i.minutes.DOUBLES:i.minutes.DOUBLES=n:i.minutes.default=n??0,this.commitDraft(r))}setDefaultRecoveryTime(e,t,n){let r=$(this.state.draft);r.defaultTimes||={},r.defaultTimes.recoveryTimes||(r.defaultTimes.recoveryTimes=[{minutes:{default:60}}]);let i=r.defaultTimes.recoveryTimes[e];i&&(t===`DOUBLES`?n===void 0?delete i.minutes.DOUBLES:i.minutes.DOUBLES=n:i.minutes.default=n??0,this.commitDraft(r))}addAverageFormatGroup(){let e=$(this.state.draft);e.matchUpAverageTimes||=[],e.matchUpAverageTimes.push({matchUpFormatCodes:[],averageTimes:[{categoryNames:[],minutes:{default:60}}]}),this.commitDraft(e)}removeAverageFormatGroup(e){let t=$(this.state.draft);t.matchUpAverageTimes&&(t.matchUpAverageTimes.splice(e,1),this.commitDraft(t))}setAverageFormatCodes(e,t){let n=$(this.state.draft),r=n.matchUpAverageTimes?.[e];r&&(r.matchUpFormatCodes=t,this.commitDraft(n))}setAverageTime(e,t,n,r){let i=$(this.state.draft),a=i.matchUpAverageTimes?.[e]?.averageTimes?.[t];a&&(n===`DOUBLES`?r===void 0?delete a.minutes.DOUBLES:a.minutes.DOUBLES=r:a.minutes.default=r??0,this.commitDraft(i))}addAverageCategoryOverride(e){let t=$(this.state.draft),n=t.matchUpAverageTimes?.[e];n&&(n.averageTimes.push({categoryTypes:[],minutes:{default:60}}),this.commitDraft(t))}removeAverageCategoryOverride(e,t){let n=$(this.state.draft),r=n.matchUpAverageTimes?.[e];r&&(r.averageTimes.splice(t,1),this.commitDraft(n))}setAverageOverrideCategories(e,t,n,r){let i=$(this.state.draft),a=i.matchUpAverageTimes?.[e]?.averageTimes?.[t];a&&(n===`categoryNames`?(delete a.categoryTypes,a.categoryNames=r):(delete a.categoryNames,a.categoryTypes=r),this.commitDraft(i))}addRecoveryFormatGroup(){let e=$(this.state.draft);e.matchUpRecoveryTimes||=[],e.matchUpRecoveryTimes.push({matchUpFormatCodes:[],recoveryTimes:[{categoryNames:[],minutes:{default:30}}]}),this.commitDraft(e)}removeRecoveryFormatGroup(e){let t=$(this.state.draft);t.matchUpRecoveryTimes&&(t.matchUpRecoveryTimes.splice(e,1),this.commitDraft(t))}setRecoveryFormatCodes(e,t){let n=$(this.state.draft),r=n.matchUpRecoveryTimes?.[e];r&&(r.matchUpFormatCodes=t,this.commitDraft(n))}setRecoveryTime(e,t,n,r){let i=$(this.state.draft),a=i.matchUpRecoveryTimes?.[e]?.recoveryTimes?.[t];a&&(n===`DOUBLES`?r===void 0?delete a.minutes.DOUBLES:a.minutes.DOUBLES=r:a.minutes.default=r??0,this.commitDraft(i))}addRecoveryCategoryOverride(e){let t=$(this.state.draft),n=t.matchUpRecoveryTimes?.[e];n&&(n.recoveryTimes.push({categoryTypes:[],minutes:{default:30}}),this.commitDraft(t))}removeRecoveryCategoryOverride(e,t){let n=$(this.state.draft),r=n.matchUpRecoveryTimes?.[e];r&&(r.recoveryTimes.splice(t,1),this.commitDraft(n))}setRecoveryOverrideCategories(e,t,n,r){let i=$(this.state.draft),a=i.matchUpRecoveryTimes?.[e]?.recoveryTimes?.[t];a&&(n===`categoryNames`?(delete a.categoryTypes,a.categoryNames=r):(delete a.categoryNames,a.categoryTypes=r),this.commitDraft(i))}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}commitDraft(e){this.state={...this.state,draft:e,dirty:!0},this.emit(),this.config.onChange?.($(e))}emit(){for(let e of this.listeners)e(this.state)}},dI=()=>`se-section`,fI=()=>`se-section-header`,pI=()=>`se-section-chevron`,mI=()=>`se-section-body`,hI=()=>`se-field-row`,gI=()=>`se-field-label`,_I=()=>`se-field-input`,vI=()=>`se-field-unit`,yI=()=>`se-checkbox-row`,bI=()=>`se-format-group`,xI=()=>`se-format-group-header`,SI=()=>`se-format-group-label`,CI=()=>`se-tag-picker`,wI=()=>`sp-chip`,TI=()=>`sp-chip__remove`,EI=()=>`se-tag-add-wrap`,DI=()=>`sp-btn-icon`,OI=()=>`se-override-row`,kI=()=>`se-override-categories`,AI=()=>`se-override-remove`,jI=()=>`sp-btn sp-btn--sm sp-btn--outline se-add-btn`,MI=()=>`sp-btn-icon sp-btn-icon--danger`,NI=()=>`se-editor`;function PI(e){let t=document.createElement(`div`),n=document.createElement(`div`);n.className=yI();let r=document.createElement(`input`);r.type=`checkbox`,r.id=`se-mod-courts`;let i=document.createElement(`label`);i.htmlFor=`se-mod-courts`,i.textContent=`Allow court modifications when matchUps scheduled`,r.addEventListener(`change`,()=>{e.setModificationFlag(`courts`,r.checked)}),n.appendChild(r),n.appendChild(i);let a=document.createElement(`div`);a.className=yI();let o=document.createElement(`input`);o.type=`checkbox`,o.id=`se-mod-venues`;let s=document.createElement(`label`);s.htmlFor=`se-mod-venues`,s.textContent=`Allow venue modifications when matchUps scheduled`,o.addEventListener(`change`,()=>{e.setModificationFlag(`venues`,o.checked)}),a.appendChild(o),a.appendChild(s),t.appendChild(n),t.appendChild(a);function c(e){let t=e.draft.allowModificationWhenMatchUpsScheduled;r.checked=t?.courts??!1,o.checked=t?.venues??!1}return{element:t,update:c}}var FI=`is-success`,II=`is-danger`;function LI(e){if(e===``)return!0;let t=parseInt(e,10);return!isNaN(t)&&t>=0&&String(t)===e.trim()}function RI(e,t){if(t===``){e.classList.remove(FI,II);return}LI(t)?(e.classList.remove(II),e.classList.add(FI)):(e.classList.remove(FI),e.classList.add(II))}function zI(e){let t=document.createElement(`div`),n=[];for(let[r,i]of[[`SINGLES`,`Singles limit`],[`DOUBLES`,`Doubles limit`],[`total`,`Total limit`]]){let a=document.createElement(`div`);a.className=hI();let o=document.createElement(`div`);o.className=gI(),o.textContent=i;let s=document.createElement(`input`);s.type=`text`,s.className=_I(),s.placeholder=`0`,s.addEventListener(`input`,()=>{RI(s,s.value)}),s.addEventListener(`change`,()=>{let t=parseInt(s.value,10);!isNaN(t)&&t>=0&&e.setDailyLimit(r,t)}),a.appendChild(o),a.appendChild(s),t.appendChild(a),n.push({key:r,label:i,input:s})}function r(e){let t=e.draft.defaultDailyLimits;for(let e of n){let n=t?.[e.key];document.activeElement!==e.input&&(e.input.value=n===void 0?``:String(n))}}return{element:t,update:r}}var BI=`is-success`,VI=`is-danger`;function HI(e){if(e===``)return!0;let t=parseInt(e,10);return!isNaN(t)&&t>=0&&String(t)===e.trim()}function UI(e,t,n){if(t===``&&n){e.classList.remove(BI,VI);return}HI(t)&&(t!==``||n)?(e.classList.remove(VI),e.classList.add(BI)):(e.classList.remove(BI),e.classList.add(VI))}function WI(e){let t=document.createElement(`div`),n=document.createElement(`div`);n.style.cssText=`font-size:11px;font-weight:700;color:var(--sp-muted);margin-bottom:6px;`,n.textContent=`Default Average Times`,t.appendChild(n);let r=GI(`Default`,`min`,!1),i=GI(`Doubles override`,`min`,!0);t.appendChild(r.row),t.appendChild(i.row),r.input.addEventListener(`input`,()=>{UI(r.input,r.input.value,!1)}),r.input.addEventListener(`change`,()=>{let t=parseInt(r.input.value,10);!isNaN(t)&&t>=0&&e.setDefaultAverageTime(0,`default`,t)}),i.input.addEventListener(`input`,()=>{UI(i.input,i.input.value,!0)}),i.input.addEventListener(`change`,()=>{let t=i.input.value.trim();if(t===``||t===`-`)e.setDefaultAverageTime(0,`DOUBLES`,void 0);else{let n=parseInt(t,10);!isNaN(n)&&n>=0&&e.setDefaultAverageTime(0,`DOUBLES`,n)}});let a=document.createElement(`div`);a.style.height=`12px`,t.appendChild(a);let o=document.createElement(`div`);o.style.cssText=`font-size:11px;font-weight:700;color:var(--sp-muted);margin-bottom:6px;`,o.textContent=`Default Recovery Times`,t.appendChild(o);let s=GI(`Default`,`min`,!1),c=GI(`Doubles override`,`min`,!0);t.appendChild(s.row),t.appendChild(c.row),s.input.addEventListener(`input`,()=>{UI(s.input,s.input.value,!1)}),s.input.addEventListener(`change`,()=>{let t=parseInt(s.input.value,10);!isNaN(t)&&t>=0&&e.setDefaultRecoveryTime(0,`default`,t)}),c.input.addEventListener(`input`,()=>{UI(c.input,c.input.value,!0)}),c.input.addEventListener(`change`,()=>{let t=c.input.value.trim();if(t===``||t===`-`)e.setDefaultRecoveryTime(0,`DOUBLES`,void 0);else{let n=parseInt(t,10);!isNaN(n)&&n>=0&&e.setDefaultRecoveryTime(0,`DOUBLES`,n)}});function l(e){let t=e.draft.defaultTimes?.averageTimes?.[0];document.activeElement!==r.input&&(r.input.value=t?String(t.minutes.default):``),document.activeElement!==i.input&&(i.input.value=t?.minutes.DOUBLES===void 0?``:String(t.minutes.DOUBLES)),i.input.placeholder=`—`;let n=e.draft.defaultTimes?.recoveryTimes?.[0];document.activeElement!==s.input&&(s.input.value=n?String(n.minutes.default):``),document.activeElement!==c.input&&(c.input.value=n?.minutes.DOUBLES===void 0?``:String(n.minutes.DOUBLES)),c.input.placeholder=`—`}return{element:t,update:l}}function GI(e,t,n){let r=document.createElement(`div`);r.className=hI();let i=document.createElement(`div`);i.className=gI(),i.textContent=e;let a=document.createElement(`input`);a.type=`text`,a.className=_I(),a.placeholder=n?`—`:`0`;let o=document.createElement(`div`);return o.className=vI(),o.textContent=t,r.appendChild(i),r.appendChild(a),r.appendChild(o),{row:r,input:a}}var KI=`is-success`,qI=`is-danger`;function JI(e){if(e===``)return!0;let t=parseInt(e,10);return!isNaN(t)&&t>=0&&String(t)===e.trim()}function YI(e,t,n){if(t===``&&n){e.classList.remove(KI,qI);return}JI(t)&&(t!==``||n)?(e.classList.remove(qI),e.classList.add(KI)):(e.classList.remove(KI),e.classList.add(qI))}function XI(e){let t=document.createElement(`div`);t.className=bI();let n=document.createElement(`div`);n.className=xI();let r=document.createElement(`div`);r.style.flex=`1`;let i=document.createElement(`div`);i.className=SI(),i.textContent=`Formats`,r.appendChild(i);let a=document.createElement(`div`);a.className=CI();for(let t of e.formatCodes){let n=document.createElement(`span`);n.className=wI(),n.title=`${t} — click to edit`;let r=document.createElement(`span`);r.textContent=sI(t),n.addEventListener(`click`,()=>{Ca({existingMatchUpFormat:t,callback:n=>{if(!n||n===t)return;let r=e.formatCodes.map(e=>e===t?n:e);e.onFormatCodesChange(r)}})});let i=document.createElement(`span`);i.className=TI(),i.textContent=`×`,i.addEventListener(`click`,n=>{n.stopPropagation(),e.onFormatCodesChange(e.formatCodes.filter(e=>e!==t))}),n.appendChild(r),n.appendChild(i),a.appendChild(n)}let o=document.createElement(`div`);o.className=EI();let s=document.createElement(`button`);s.className=DI(),s.textContent=`+`,s.type=`button`,s.title=`Add format code`,s.addEventListener(`click`,t=>{t.stopPropagation(),Ca({existingMatchUpFormat:`SET3-S:6/TB7`,callback:t=>{t&&!e.formatCodes.includes(t)&&e.onFormatCodesChange([...e.formatCodes,t])}})}),o.appendChild(s),a.appendChild(o),r.appendChild(a);let c=document.createElement(`button`);c.className=MI(),c.textContent=`×`,c.type=`button`,c.title=`Remove format group`,c.addEventListener(`click`,()=>e.onRemoveGroup()),n.appendChild(r),n.appendChild(c),t.appendChild(n);for(let n=0;n<e.overrides.length;n++){let r=e.overrides[n],i=document.createElement(`div`);i.className=OI();let a=document.createElement(`div`);a.className=`${kI()}${r.isDefault?` all`:``}`,a.textContent=r.categoryLabel;let o=document.createElement(`input`);o.type=`text`,o.className=_I(),o.value=String(r.defaultMinutes),o.placeholder=`0`;let s=n;o.addEventListener(`input`,()=>{YI(o,o.value,!1)}),o.addEventListener(`change`,()=>{let t=parseInt(o.value,10);!isNaN(t)&&t>=0&&e.onTimeChange(s,`default`,t)});let c=document.createElement(`span`);c.className=vI(),c.textContent=`min`;let l=document.createElement(`span`);l.style.cssText=`font-size:11px;color:var(--sp-muted);margin-left:8px;`,l.textContent=`Doubles:`;let u=document.createElement(`input`);if(u.type=`text`,u.className=_I(),u.value=r.doublesMinutes===void 0?``:String(r.doublesMinutes),u.placeholder=`—`,u.addEventListener(`input`,()=>{YI(u,u.value,!0)}),u.addEventListener(`change`,()=>{let t=u.value.trim();if(t===``||t===`-`)e.onTimeChange(s,`DOUBLES`,void 0);else{let n=parseInt(t,10);!isNaN(n)&&n>=0&&e.onTimeChange(s,`DOUBLES`,n)}}),i.appendChild(a),i.appendChild(o),i.appendChild(c),i.appendChild(l),i.appendChild(u),!r.isDefault){let t=document.createElement(`span`);t.className=AI(),t.textContent=`×`,t.addEventListener(`click`,()=>e.onRemoveOverride(s)),i.appendChild(t)}t.appendChild(i)}let l=document.createElement(`button`);return l.className=jI(),l.textContent=`+ Add Override`,l.type=`button`,l.addEventListener(`click`,()=>e.onAddOverride()),t.appendChild(l),t}function ZI(e,t){let n=document.createElement(`div`),r=document.createElement(`div`);n.appendChild(r);let i=document.createElement(`button`);i.className=jI(),i.textContent=`+ Add Format Group`,i.type=`button`,i.addEventListener(`click`,()=>e.addAverageFormatGroup()),n.appendChild(i);function a(n){r.innerHTML=``;let i=n.draft.matchUpAverageTimes??[];for(let n=0;n<i.length;n++){let a=i[n],o=a.averageTimes.map((e,t)=>{let n=e.categoryTypes??e.categoryNames??[];return{categoryLabel:n.length===0&&t===0?`All categories`:n.join(`, `)||`All categories`,isDefault:n.length===0&&t===0,defaultMinutes:e.minutes.default,doublesMinutes:e.minutes.DOUBLES}}),s=n,c=XI({formatCodes:a.matchUpFormatCodes,overrides:o,availableFormats:t.matchUpFormatCodes??QI(),onFormatCodesChange:t=>e.setAverageFormatCodes(s,t),onTimeChange:(t,n,r)=>e.setAverageTime(s,t,n,r),onAddOverride:()=>e.addAverageCategoryOverride(s),onRemoveOverride:t=>e.removeAverageCategoryOverride(s,t),onRemoveGroup:()=>e.removeAverageFormatGroup(s)});r.appendChild(c)}if(i.length===0){let e=document.createElement(`div`);e.style.cssText=`font-size:12px;color:var(--sp-muted);padding:8px 0;`,e.textContent=`No format-specific average times configured. Add a format group to set per-format times.`,r.appendChild(e)}}return{element:n,update:a}}function QI(){return[`SET3-S:6/TB7`,`SET3-S:6/TB7-F:TB10`,`SET3-S:6/TB7-F:TB7`,`SET3-S:4NOAD-F:TB7`,`SET3-S:4/TB7`,`SET3-S:4/TB7-F:TB7`,`SET3-S:4/TB7-F:TB10`,`SET3-S:4/TB5@3`,`SET1-S:8/TB7`,`SET1-S:8/TB7@7`,`SET1-S:5/TB9@4`,`SET1-S:6/TB7`,`SET1-S:6NOAD`,`SET1-S:4/TB7`,`SET1-S:4/TB5@3`,`SET1-S:4NOAD`,`SET3-S:TB10`,`SET1-S:T20`,`SET1-S:TB10`]}function $I(e,t){let n=document.createElement(`div`),r=document.createElement(`div`);n.appendChild(r);let i=document.createElement(`button`);i.className=jI(),i.textContent=`+ Add Format Group`,i.type=`button`,i.addEventListener(`click`,()=>e.addRecoveryFormatGroup()),n.appendChild(i);function a(n){r.innerHTML=``;let i=n.draft.matchUpRecoveryTimes??[];for(let n=0;n<i.length;n++){let a=i[n],o=a.recoveryTimes.map((e,t)=>{let n=e.categoryTypes??e.categoryNames??[];return{categoryLabel:n.length===0&&t===0?`All categories`:n.join(`, `)||`All categories`,isDefault:n.length===0&&t===0,defaultMinutes:e.minutes.default,doublesMinutes:e.minutes.DOUBLES}}),s=n,c=XI({formatCodes:a.matchUpFormatCodes,overrides:o,availableFormats:t.matchUpFormatCodes??eL(),onFormatCodesChange:t=>e.setRecoveryFormatCodes(s,t),onTimeChange:(t,n,r)=>e.setRecoveryTime(s,t,n,r),onAddOverride:()=>e.addRecoveryCategoryOverride(s),onRemoveOverride:t=>e.removeRecoveryCategoryOverride(s,t),onRemoveGroup:()=>e.removeRecoveryFormatGroup(s)});r.appendChild(c)}if(i.length===0){let e=document.createElement(`div`);e.style.cssText=`font-size:12px;color:var(--sp-muted);padding:8px 0;`,e.textContent=`No format-specific recovery times configured. Add a format group to set per-format recovery.`,r.appendChild(e)}}return{element:n,update:a}}function eL(){return[`SET3-S:6/TB7`,`SET3-S:6/TB7-F:TB10`,`SET3-S:6/TB7-F:TB7`,`SET3-S:4NOAD-F:TB7`,`SET3-S:4/TB7`,`SET3-S:4/TB7-F:TB7`,`SET3-S:4/TB7-F:TB10`,`SET3-S:4/TB5@3`,`SET1-S:8/TB7`,`SET1-S:8/TB7@7`,`SET1-S:5/TB9@4`,`SET1-S:6/TB7`,`SET1-S:6NOAD`,`SET1-S:4/TB7`,`SET1-S:4/TB5@3`,`SET1-S:4NOAD`,`SET3-S:TB10`,`SET1-S:T20`,`SET1-S:TB10`]}function tL(e,t){let n=document.createElement(`div`);n.className=NI();let r=[{id:`modificationFlags`,label:`Modification Flags`,factory:()=>PI(e)},{id:`dailyLimits`,label:`Daily Limits`,factory:()=>zI(e)},{id:`defaultTimes`,label:`Default Times`,factory:()=>WI(e)},{id:`averageTimes`,label:`Match Average Times`,factory:()=>ZI(e,t)},{id:`recoveryTimes`,label:`Match Recovery Times`,factory:()=>$I(e,t)}],i=[];for(let t of r){let r=document.createElement(`div`);r.className=dI();let a=document.createElement(`div`);a.className=fI();let o=document.createElement(`span`);o.className=pI();let s=document.createElement(`span`);s.textContent=t.label,a.appendChild(o),a.appendChild(s),a.addEventListener(`click`,()=>e.toggleSection(t.id));let c=document.createElement(`div`);c.className=mI();let l=t.factory();c.appendChild(l.element),r.appendChild(a),r.appendChild(c),n.appendChild(r),i.push({id:t.id,chevron:o,bodyEl:c,inner:l})}function a(e){for(let t of i){let n=e.expandedSections.has(t.id);t.chevron.textContent=n?`▼`:`▶`,t.bodyEl.style.display=n?`block`:`none`,n&&t.inner.update(e)}}return{element:n,update:a}}var nL=class e{constructor(e){this.container=null,this.store=new uI(e),this.panel=tL(this.store,e),this.unsubscribe=this.store.subscribe(e=>{this.panel.update(e)}),this.panel.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.panel.element)}destroy(){this.unsubscribe(),this.container&&this.panel.element.parentNode===this.container&&this.container.removeChild(this.panel.element),this.container=null}getData(){return this.store.getData()}setData(e){this.store.setData(e)}getStore(){return this.store}static createEditorInstance(t){let n=new e({initialPolicy:t.initialData,onChange:e=>t.onChange(e)});return{element:n.panel.element,setData(e){n.setData(e)},getData(){return n.getData()},destroy(){n.destroy()}}}};function rL(e,t){let n=new nL(e);return n.render(t),n}var iL=()=>`pc-layout`,aL=()=>`pc-panel`,oL=()=>`pc-panel-header`,sL=()=>`pc-panel-title`,cL=()=>`pc-panel-meta`,lL=()=>`pc-toolbar`,uL=()=>`pc-input`,dL=()=>`pc-select`,fL=()=>`pc-catalog`,pL=()=>`pc-group`,mL=()=>`pc-group-header`,hL=()=>`pc-group-chevron`,gL=()=>`pc-group-body`,_L=()=>`pc-card`,vL=()=>`pc-card-title`,yL=()=>`pc-card-meta`,bL=()=>`pc-type-badge`,xL=()=>`pc-editor`,SL=()=>`pc-editor-header`,CL=()=>`pc-editor-header-left`,wL=()=>`pc-editor-actions`,TL=()=>`sp-btn sp-btn--sm`,EL=()=>`sp-btn sp-btn--sm sp-btn--accent`,DL=()=>`pc-dirty-dot`,OL=()=>`pc-editor-body`,kL=()=>`pc-empty`,AL=()=>`pc-json-editor`,jL=()=>`pc-json-error`;function ML(e){let t=document.createElement(`div`);t.className=iL(),t.appendChild(e.catalogPanel.element),t.appendChild(e.editorShell.element);function n(t){e.catalogPanel.update(t),e.editorShell.update(t)}return{element:t,update:n}}var NL=`scheduling`,PL=`scoring`,FL=`seeding`,IL=`draws`,LL=`avoidance`,RL=`feedIn`,zL=`progression`,BL=`roundNaming`,VL=`positionActions`,HL=`matchUpActions`,UL=`roundRobinTally`,WL=`rankingPoints`,GL=`competitiveBands`,KL=`voluntaryConsolation`,qL=`participant`,JL=`display`,YL=`audit`,XL=`Tournament Operations`,ZL=`Scoring & Results`,QL=`Ranking Points`,$L=`Draw Configuration`,eR=`Participants`,tR=`Display & Audit`,nR=(e,t,n,r,i)=>({policyType:e,label:t,description:n,group:r,hasEditor:i}),rR=[nR(NL,`Scheduling`,`Match scheduling, average times, recovery times, daily limits`,XL,!0),nR(VL,`Position Actions`,`Allowed position actions (alternates, walkovers, withdrawals)`,XL,!1),nR(HL,`MatchUp Actions`,`Allowed matchUp status transitions and actions`,XL,!1),nR(LL,`Avoidance`,`Draw placement avoidance rules (club, nationality, region)`,XL,!1),nR(PL,`Scoring`,`Score entry validation and completion rules`,ZL,!1),nR(UL,`Round Robin Tally`,`Round-robin group standing calculation method`,ZL,!1),nR(WL,`Ranking Points`,`Point allocation by draw size, round, and result`,QL,!0),nR(GL,`Competitive Bands`,`Rating/ranking band definitions for competitive grouping`,ZL,!1),nR(IL,`Draws`,`Draw generation rules and structure options`,$L,!1),nR(FL,`Seeding`,`Seeding thresholds and placement rules by draw size`,$L,!1),nR(RL,`Feed-In`,`Feed-in consolation structure rules`,$L,!1),nR(zL,`Progression`,`Player progression between draw structures`,$L,!1),nR(KL,`Voluntary Consolation`,`Voluntary consolation entry rules`,$L,!1),nR(BL,`Round Naming`,`Custom round name labels (QF, SF, F, etc.)`,$L,!1),nR(qL,`Participant`,`Participant display and data rules`,eR,!1),nR(JL,`Display`,`Client display configuration (public vs admin views)`,tR,!1),nR(YL,`Audit`,`Audit trail and change logging configuration`,tR,!1)];function iR(e){return rR.find(t=>t.policyType===e)}function aR(e){return e===`rankingPoints`?ZP():e===`scheduling`?lI():{}}var oR=[XL,ZL,QL,$L,eR,tR];function sR(e,t){let n=t.toLowerCase().trim();return n?e.filter(e=>{let t=iR(e.policyType);return[e.name,e.description,e.policyType,t?.label??``,e.source].join(` `).toLowerCase().includes(n)}):e}function cR(e,t){let n=new Map;if(t===`type`){for(let e of oR)n.set(e,[]);for(let t of e){let e=iR(t.policyType)?.group??`Display & Audit`,r=n.get(e);r?r.push(t):n.set(e,[t])}for(let[e,t]of n)t.length===0&&n.delete(e)}else for(let t of e){let e=t.source===`builtin`?`Built-in Policies`:`User Policies`,r=n.get(e);r?r.push(t):n.set(e,[t])}return n}function lR(e){let t=document.createElement(`div`);t.className=aL(),t.style.overflowY=`auto`,t.style.scrollbarWidth=`thin`,t.style.scrollbarColor=`var(--sp-scrollbar) transparent`;let n=new Set,r=null,i=document.createElement(`div`);i.className=oL();let a=document.createElement(`div`);a.className=sL(),a.textContent=`Policy Catalog`;let o=document.createElement(`div`);o.className=cL(),i.appendChild(a),i.appendChild(o),t.appendChild(i);let s=document.createElement(`div`);s.className=lL();let c=document.createElement(`input`);c.type=`text`,c.placeholder=`Search policies...`,c.className=uL(),c.addEventListener(`input`,()=>e.onSearchChange(c.value));let l=document.createElement(`select`);l.className=dL();for(let[e,t]of[[`type`,`By Type`],[`source`,`By Source`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,l.appendChild(n)}l.addEventListener(`change`,()=>e.onGroupByChange(l.value));let u=document.createElement(`div`);u.style.cssText=`position:relative;flex-shrink:0`;let d=document.createElement(`button`);d.className=`sp-btn-icon`,d.textContent=`+`,d.title=`New policy`,d.style.cssText=`font-size:1rem;font-weight:700`;let f=document.createElement(`div`);f.style.cssText=`display:none;position:absolute;top:100%;right:0;z-index:100;min-width:180px;background:var(--sp-panel-bg);border:1px solid var(--sp-border);border-radius:12px;box-shadow:var(--sp-panel-shadow);padding:4px;margin-top:4px`;let p=rR.filter(e=>e.hasEditor);for(let t of p){let n=document.createElement(`div`);n.style.cssText=`padding:6px 10px;font-size:12px;border-radius:8px;cursor:pointer;color:var(--sp-text)`,n.textContent=t.label,n.addEventListener(`mouseenter`,()=>{n.style.background=`var(--sp-hover-bg)`}),n.addEventListener(`mouseleave`,()=>{n.style.background=``}),n.addEventListener(`click`,n=>{n.stopPropagation(),f.style.display=`none`,e.onNewPolicy?.(t.policyType)}),f.appendChild(n)}d.addEventListener(`click`,e=>{e.stopPropagation(),f.style.display=f.style.display===`none`?`block`:`none`}),document.addEventListener(`click`,()=>{f.style.display=`none`}),u.appendChild(d),u.appendChild(f),s.appendChild(c),s.appendChild(l),s.appendChild(u),t.appendChild(s);let m=document.createElement(`div`);m.className=fL(),t.appendChild(m);function h(t){r=t;let i=sR(t.catalog,t.searchQuery),a=cR(i,t.groupBy);o.textContent=`${i.length} policies`,c.value!==t.searchQuery&&(c.value=t.searchQuery),l.value!==t.groupBy&&(l.value=t.groupBy),m.innerHTML=``;for(let[i,o]of a){let a=document.createElement(`div`);a.className=pL();let s=n.has(i),c=document.createElement(`div`);c.className=mL();let l=document.createElement(`span`);l.className=hL(),l.textContent=s?`▶`:`▼`;let u=document.createElement(`span`);u.textContent=`${i} (${o.length})`,c.appendChild(l),c.appendChild(u),c.addEventListener(`click`,()=>{n.has(i)?n.delete(i):n.add(i),r&&h(r)});let d=document.createElement(`div`);d.className=gL(),s&&(d.style.display=`none`);for(let n of o){let r=document.createElement(`div`);r.className=_L(),n.id===t.selectedId&&r.classList.add(`active`),r.addEventListener(`click`,()=>e.onSelectPolicy(n.id));let i=document.createElement(`div`);i.style.cssText=`display:flex;align-items:center;gap:4px`;let a=document.createElement(`div`);if(a.className=vL(),a.style.flex=`1`,a.textContent=n.name,i.appendChild(a),e.onDuplicatePolicy){let t=document.createElement(`span`);t.style.cssText=`font-size:10px;cursor:pointer;color:var(--sp-muted);padding:2px`,t.textContent=`⎘`,t.title=`Duplicate`,t.addEventListener(`click`,t=>{t.stopPropagation(),e.onDuplicatePolicy?.(n.id)}),i.appendChild(t)}if(n.source===`user`&&e.onDeletePolicy){let t=document.createElement(`span`);t.style.cssText=`font-size:10px;cursor:pointer;color:var(--sp-muted);padding:2px`,t.textContent=`✕`,t.title=`Delete`,t.addEventListener(`click`,t=>{t.stopPropagation(),e.onDeletePolicy?.(n.id)}),i.appendChild(t)}r.appendChild(i);let o=document.createElement(`div`);o.className=yL();let s=iR(n.policyType),c=document.createElement(`span`);c.className=bL(),c.textContent=s?.label??n.policyType;let l=document.createElement(`span`);l.className=`${bL()} ${n.source}`,l.textContent=n.source,o.appendChild(c),o.appendChild(l),r.appendChild(o),d.appendChild(r)}a.appendChild(c),a.appendChild(d),m.appendChild(a)}}return{element:t,update:h}}function uR(e){return structuredClone(e)}var dR=class{constructor(e){this.listeners=new Set,this.config=e;let t=new Set((e.builtinPolicies??[]).map(e=>e.id));this.state={catalog:[...e.builtinPolicies??[],...(e.userPolicies??[]).filter(e=>!t.has(e.id))],searchQuery:``,groupBy:`type`,selectedId:null,editorDraft:null,dirty:!1}}getState(){return this.state}getSelectedItem(){return this.state.selectedId?this.state.catalog.find(e=>e.id===this.state.selectedId)??null:null}setCatalogSearch(e){this.setState({searchQuery:e})}setCatalogGroupBy(e){this.setState({groupBy:e})}selectPolicy(e){if(this.state.selectedId===e)return;let t=this.state.catalog.find(t=>t.id===e);t&&(this.setState({selectedId:e,editorDraft:uR(t.policyData),dirty:!1}),this.config.onSelectionChanged?.(t))}clearSelection(){this.state.selectedId&&(this.setState({selectedId:null,editorDraft:null,dirty:!1}),this.config.onSelectionChanged?.(null))}updateEditorDraft(e){this.setState({editorDraft:e,dirty:!0})}markDirty(){this.state.dirty||this.setState({dirty:!0})}markClean(){this.state.dirty&&this.setState({dirty:!1})}savePolicy(){let e=this.getSelectedItem();if(!e||!this.state.editorDraft)return;let t={...e,policyData:uR(this.state.editorDraft)},n=this.state.catalog.map(e=>e.id===t.id?t:e);this.state={...this.state,catalog:n,dirty:!1},this.emit(),this.config.onPolicySaved?.(t)}resetDraft(){let e=this.getSelectedItem();e&&this.setState({editorDraft:uR(e.policyData),dirty:!1})}applyPolicy(){let e=this.getSelectedItem();if(!e)return;let t={...e,policyData:this.state.editorDraft?uR(this.state.editorDraft):uR(e.policyData)};this.config.onPolicyApplied?.(t)}addNewPolicy(e){let t=`user-${e}-${Date.now()}`,n={id:t,name:`New ${e} policy`,policyType:e,source:`user`,description:``,policyData:aR(e)},r=[...this.state.catalog,n];return this.state={...this.state,catalog:r,selectedId:t,editorDraft:uR(n.policyData),dirty:!1},this.emit(),this.config.onPolicyCreated?.(n),this.config.onSelectionChanged?.(n),t}duplicatePolicy(e){let t=this.state.catalog.find(t=>t.id===e);if(!t)return null;let n=`user-${t.policyType}-${Date.now()}`,r={id:n,name:`${t.name} (Copy)`,policyType:t.policyType,source:`user`,description:t.description,policyData:uR(t.policyData)},i=[...this.state.catalog,r];return this.state={...this.state,catalog:i,selectedId:n,editorDraft:uR(r.policyData),dirty:!1},this.emit(),this.config.onPolicyCreated?.(r),this.config.onSelectionChanged?.(r),n}deletePolicy(e){let t=this.state.catalog.find(t=>t.id===e);if(!t||t.source===`builtin`)return;let n=this.state.catalog.filter(t=>t.id!==e),r=this.state.selectedId===e;this.state={...this.state,catalog:n,...r?{selectedId:null,editorDraft:null,dirty:!1}:{}},this.emit(),this.config.onPolicyDeleted?.(e),r&&this.config.onSelectionChanged?.(null)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state={...this.state,...e},this.emit()}emit(){for(let e of this.listeners)e(this.state)}};function fR(e){let t=document.createElement(`div`);t.className=aL();let n=document.createElement(`div`);n.className=xL();let r=document.createElement(`div`);r.className=SL();let i=document.createElement(`div`);i.className=CL();let a=document.createElement(`div`);a.className=sL();let o=document.createElement(`span`);o.className=bL();let s=document.createElement(`span`);s.className=bL(),s.textContent=`read-only`,s.style.display=`none`;let c=document.createElement(`div`);c.className=DL(),c.style.display=`none`,c.title=`Unsaved changes`,i.appendChild(c),i.appendChild(a),i.appendChild(o),i.appendChild(s);let l=document.createElement(`div`);l.className=wL();let u=document.createElement(`button`);u.className=TL(),u.textContent=`Reset`,u.addEventListener(`click`,()=>e.onReset());let d=document.createElement(`button`);d.className=EL(),d.textContent=`Save`,d.addEventListener(`click`,()=>e.onSave());let f=document.createElement(`button`);f.className=TL(),f.textContent=`Apply`,f.addEventListener(`click`,()=>e.onApply());let p=document.createElement(`button`);p.className=TL(),p.textContent=`Duplicate`,p.addEventListener(`click`,()=>e.onDuplicate()),l.appendChild(u),l.appendChild(d),l.appendChild(f),l.appendChild(p);let m=document.createElement(`div`);m.className=wL();let h=document.createElement(`button`);h.className=EL(),h.textContent=`Use as Template`,h.addEventListener(`click`,()=>e.onDuplicate()),m.appendChild(h),r.appendChild(i),r.appendChild(l),r.appendChild(m);let g=document.createElement(`div`);g.className=OL(),n.appendChild(r),n.appendChild(g);let _=document.createElement(`div`);_.className=kL(),_.textContent=`Select a policy to edit`,t.appendChild(n),t.appendChild(_);function v(e){let t=e.selectedId!==null;if(n.style.display=t?`flex`:`none`,_.style.display=t?`none`:`flex`,!t)return;let r=e.catalog.find(t=>t.id===e.selectedId);if(!r)return;let i=r.source===`builtin`;a.textContent=r.name,o.textContent=iR(r.policyType)?.label??r.policyType,s.style.display=i?``:`none`,l.style.display=i?`none`:`flex`,m.style.display=i?`flex`:`none`,c.style.display=!i&&e.dirty?`block`:`none`}return{element:t,update:v,bodyElement:g}}function pR(e){let t=document.createElement(`div`);t.className=AL();let n=document.createElement(`textarea`);n.value=JSON.stringify(e.initialData,null,2);let r=document.createElement(`div`);r.className=jL(),r.style.display=`none`;let i={...e.initialData};return n.addEventListener(`input`,()=>{try{let t=JSON.parse(n.value);i=t,r.style.display=`none`,e.onChange(t)}catch(e){r.style.display=`block`,r.textContent=`Invalid JSON: ${e.message}`}}),t.appendChild(n),t.appendChild(r),{element:t,setData(e){i={...e},n.value=JSON.stringify(e,null,2),r.style.display=`none`},getData(){return{...i}},destroy(){t.remove()}}}var mR=class{constructor(e){this.currentEditor=null,this.container=null,this.store=new dR(e);let t=lR({onSearchChange:e=>this.store.setCatalogSearch(e),onGroupByChange:e=>this.store.setCatalogGroupBy(e),onSelectPolicy:e=>this.handleSelectPolicy(e),onNewPolicy:e=>{this.store.addNewPolicy(e),this.mountEditorForSelection()},onDuplicatePolicy:e=>{this.store.duplicatePolicy(e),this.mountEditorForSelection()},onDeletePolicy:e=>{this.store.deletePolicy(e),this.store.getSelectedItem()||this.destroyCurrentEditor()}});this.editorShell=fR({onSave:()=>this.store.savePolicy(),onReset:()=>{this.store.resetDraft(),this.syncEditorFromStore()},onApply:()=>this.store.applyPolicy(),onDuplicate:()=>{let e=this.store.getSelectedItem();e&&(this.store.duplicatePolicy(e.id),this.mountEditorForSelection())}}),this.layout=ML({catalogPanel:t,editorShell:this.editorShell}),this.unsubscribe=this.store.subscribe(e=>{this.layout.update(e)}),this.layout.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.layout.element)}destroy(){this.destroyCurrentEditor(),this.unsubscribe(),this.container&&this.layout.element.parentNode===this.container&&this.layout.element.remove(),this.container=null}getStore(){return this.store}handleSelectPolicy(e){this.store.selectPolicy(e),this.mountEditorForSelection()}mountEditorForSelection(){this.destroyCurrentEditor();let e=this.store.getSelectedItem();if(!e)return;let t=e.source===`builtin`,n={initialData:{...e.policyData},onChange:e=>{this.store.updateEditorDraft(e)},readonly:t};e.policyType===`scheduling`?this.currentEditor=nL.createEditorInstance(n):e.policyType===`rankingPoints`?this.currentEditor=oI.createEditorInstance(n):this.currentEditor=pR(n),this.editorShell.bodyElement.innerHTML=``,this.editorShell.bodyElement.appendChild(this.currentEditor.element)}syncEditorFromStore(){let e=this.store.getState();this.currentEditor&&e.editorDraft&&this.currentEditor.setData(e.editorDraft)}destroyCurrentEditor(){this.currentEditor&&=(this.currentEditor.destroy(),null),this.editorShell.bodyElement.innerHTML=``}};function hR(e,t,n,r){e!==void 0&&e<0&&r.push({severity:`error`,path:t,message:n})}function gR(e,t){if(!e.defaultTimes)return;let n=e.defaultTimes.averageTimes;if(n)for(let e=0;e<n.length;e++)hR(n[e].minutes.default,`defaultTimes.averageTimes[${e}].minutes.default`,`Default average time must be non-negative`,t),hR(n[e].minutes.DOUBLES,`defaultTimes.averageTimes[${e}].minutes.DOUBLES`,`Doubles average time must be non-negative`,t);let r=e.defaultTimes.recoveryTimes;if(r)for(let e=0;e<r.length;e++)hR(r[e].minutes.default,`defaultTimes.recoveryTimes[${e}].minutes.default`,`Default recovery time must be non-negative`,t)}function _R(e,t){if(!e.defaultDailyLimits)return;let n=e.defaultDailyLimits;hR(n.SINGLES,`defaultDailyLimits.SINGLES`,`Singles daily limit must be non-negative`,t),hR(n.DOUBLES,`defaultDailyLimits.DOUBLES`,`Doubles daily limit must be non-negative`,t),hR(n.total,`defaultDailyLimits.total`,`Total daily limit must be non-negative`,t)}function vR(e){let t=[];return gR(e,t),_R(e,t),e.matchUpAverageTimes&&yR(e.matchUpAverageTimes,`matchUpAverageTimes`,`averageTimes`,t),e.matchUpRecoveryTimes&&bR(e.matchUpRecoveryTimes,`matchUpRecoveryTimes`,t),xR(e,t),t}function yR(e,t,n,r){for(let i=0;i<e.length;i++){let a=e[i];a.matchUpFormatCodes.length||r.push({severity:`error`,path:`${t}[${i}].matchUpFormatCodes`,message:`At least one format code is required per format group`});let o=a[n];if(o)for(let e=0;e<o.length;e++)hR(o[e].minutes.default,`${t}[${i}].${n}[${e}].minutes.default`,`Time must be non-negative`,r),hR(o[e].minutes.DOUBLES,`${t}[${i}].${n}[${e}].minutes.DOUBLES`,`Doubles time must be non-negative`,r)}}function bR(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.matchUpFormatCodes.length||n.push({severity:`error`,path:`${t}[${r}].matchUpFormatCodes`,message:`At least one format code is required per format group`});for(let e=0;e<i.recoveryTimes.length;e++)hR(i.recoveryTimes[e].minutes.default,`${t}[${r}].recoveryTimes[${e}].minutes.default`,`Recovery time must be non-negative`,n),hR(i.recoveryTimes[e].minutes.DOUBLES,`${t}[${r}].recoveryTimes[${e}].minutes.DOUBLES`,`Doubles recovery time must be non-negative`,n)}}function xR(e,t){let n=(e,n)=>{if(!e)return;let r=new Map;for(let i=0;i<e.length;i++)for(let a of e[i].matchUpFormatCodes)r.has(a)?t.push({severity:`warning`,path:`${n}[${i}].matchUpFormatCodes`,message:`Format code "${a}" also appears in group ${r.get(a)}`}):r.set(a,i)};n(e.matchUpAverageTimes,`matchUpAverageTimes`),n(e.matchUpRecoveryTimes,`matchUpRecoveryTimes`)}function SR(e,t){let n=new mR(e);return n.render(t),n}e.CompositionEditorStore=FN,e.DEFAULT_SCHEDULE_CELL_CONFIG=pN,e.DrawStateManager=lh,e.InlineScoringManager=Zo,e.MATCH_FORMATS=Qm,e.POLICY_TYPE_GROUPS=oR,e.POLICY_TYPE_METADATA=rR,e.PolicyCatalogControl=mR,e.PolicyCatalogStore=dR,e.ProfileStore=ET,e.SchedulePageControl=uN,e.SchedulePageStore=lN,e.SchedulingEditorControl=nL,e.SchedulingEditorStore=uI,e.SchedulingProfileControl=zT,e.TemporalGrid=NO,e.TopologyBuilderControl=Fj,e.TopologyStore=Pk,e.activateScheduleCellTypeAhead=NN,e.applyDropCommit=ST,e.badmintonCourt=Ym,e.barButton=vC,e.baseballDiamond=Km,e.basketballCourt=Gm,e.buildCourtGridSlot=cN,e.buildDateStrip=LT,e.buildEdgeEditor=kA,e.buildEditorShell=fR,e.buildInspectorPanel=Xw,e.buildInteractiveScoringShell=WP,e.buildIssueIndex=bT,e.buildIssuesPanel=aT,e.buildJsonEditor=pR,e.buildMatchUpCard=eN,e.buildMatchUpCatalog=rN,e.buildNodeEditor=_A,e.buildPolicyCatalogLayout=ML,e.buildPolicyCatalogPanel=lR,e.buildRoundCard=MT,e.buildRoundCatalog=iT,e.buildScheduleDateStrip=sN,e.buildScheduleGridCell=mN,e.buildScheduleInspectorPanel=JM,e.buildScheduleIssueIndex=iN,e.buildScheduleIssuesPanel=oN,e.buildSchedulePageLayout=WM,e.buildSchedulingEditorPanel=tL,e.buildSchedulingProfileLayout=Iw,e.buildSetScore=Es,e.buildStructureCard=yk,e.buildToolbar=ij,e.buildTopologyBuilderLayout=aj,e.buildTopologyCanvas=Gk,e.buildVenueBoard=PT,e.burstChart=GS,e.cModal=F,e.calculateComplement=Ss,e.compositions=ri,e.controlBar=IC,e.courthiveComponentsVersion=Zm,e.createCardPopoverManager=Lw,e.createCompositionEditor=AP,e.createInlineScoringFooter=HP,e.createPolicyCatalog=SR,e.createSchedulePage=PN,e.createSchedulingEditor=rL,e.createSchedulingProfile=BT,e.createTemporalGrid=PO,e.destroyTipster=Vm,e.drawer=ad,e.dropDownButton=pC,e.emptySchedulingPolicy=lI,e.engineToMatchUp=Yo,e.filterCatalog=$w,e.filterMatchUpCatalog=QM,e.filterPolicyCatalog=sR,e.findIssuesForLocator=Kw,e.formatCodeLabel=sI,e.fromFactoryDrawData=ZS,e.fromLegacyDraw=eC,e.generatePreviewMatchUps=YO,e.getAgeCategoryModal=uo,e.getCategoryModal=mo,e.getFlightProfileModal=Go,e.getGenerateTeamsModal=Di,e.getMatchUpFormatModal=Ca,e.getMatchWinner=xs,e.getMaxAllowedScore=_s,e.getMockParticipantsModal=xi,e.getPlannedRoundKeys=tT,e.getPolicyTypeMeta=iR,e.getPortPosition=bk,e.getRoundAt=Gw,e.getScoringConfig=es,e.getSetFormatForIndex=ms,e.getSetWinner=ys,e.getVenueRounds=Ww,e.groupCatalog=eT,e.groupMatchUpCatalog=$M,e.groupPolicyCatalog=cR,e.hockeyRink=qm,e.initDrawer=od,e.isCompletedStatus=ZM,e.isMatchComplete=bs,e.isSetComplete=vs,e.isSetTiebreakOnly=hs,e.isSetTimed=gs,e.mapMatchUpToCellData=MN,e.matchUpLabel=GM,e.matchUpSearchKey=qM,e.maxSeverity=Jw,e.notesToolbar=bm,e.openCompositionEditorModal=Ni,e.openScheduleCellConfigModal=Fi,e.padelCourt=Xm,e.participantLabel=KM,e.pickleballCourt=Jm,e.renderButtons=$m,e.renderContainer=Jr,e.renderField=ln,e.renderForm=ui,e.renderInlineMatchUp=qo,e.renderMatchUp=Wr,e.renderMenu=Rm,e.renderOptions=cn,e.renderParticipant=cr,e.renderParticipantInput=gn,e.renderRound=Gr,e.renderRoundHeader=ur,e.renderSchematicMatchUp=si,e.renderSchematicRound=ci,e.renderSchematicStructure=li,e.renderScorecard=MP,e.renderStructure=Kr,e.renderTeamVsHeader=NP,e.resetScoringConfig=ns,e.resolvePublishedComposition=ai,e.scoringModal=Wl,e.selectItem=hC,e.setScoringConfig=ts,e.shouldApplySmartComplement=Cs,e.shouldCreateNextSet=Ts,e.shouldShowTiebreak=ws,e.showCourtAvailabilityModal=jO,e.standardTemplates=Tj,e.tennisCourt=Wm,e.tipster=Hm,e.toggleOverlay=EC,e.topologyToDrawOptions=Qj,e.updateHeadingSelect=Sm,e.updateTieScore=PP,e.updateToolbarState=xm,e.validateProfile=lT,e.validateSchedulingPolicy=vR,e.validateTopology=zA,e.validator=an,Object.defineProperty(e,`validators`,{enumerable:!0,get:function(){return ch}})});
320
+ `}e.innerHTML=a,e.querySelectorAll(`.court-checkbox`).forEach(e=>{e.addEventListener(`change`,this.handleCourtCheckboxChange)}),e.querySelectorAll(`.venue-checkbox`).forEach(e=>{e.addEventListener(`change`,this.handleVenueCheckboxChange)}),e.querySelectorAll(`.venue-edit-icon`).forEach(e=>{e.addEventListener(`click`,e=>{e.stopPropagation();let t=e.currentTarget,n=t.dataset.venue,r=t.dataset.tournamentId,i=t.dataset.venueName||n,a=this.control?.getDay()||this.engine.getActiveDays()[0]||`2026-01-01`,o=this.engine.getVenueAvailability(r,n),s=this.engine.getConfig();jO({title:`Venue Defaults \u2014 ${i}`,currentDay:a,currentStartTime:o?.startTime||s.dayStartTime,currentEndTime:o?.endTime||s.dayEndTime,showScopeToggle:!1,onConfirm:({startTime:e,endTime:t})=>{this.engine.setVenueDefaultAvailability(r,n,{startTime:e,endTime:t}),this.engine.clearCourtAvailabilityForVenue(r,n),this.control?.refresh()}})})}),e.querySelectorAll(`.court-edit-icon`).forEach(e=>{e.addEventListener(`click`,e=>{e.stopPropagation();let t=e.currentTarget,n=t.dataset.courtId,r=t.dataset.venueId,i=t.dataset.tournamentId,a=t.dataset.courtName||n,o={tournamentId:i,venueId:r,courtId:n},s=this.control?.getDay()||this.engine.getActiveDays()[0]||`2026-01-01`,c=this.engine.getCourtAvailability(o,s);jO({title:`Court \u2014 ${a}`,currentDay:s,currentStartTime:c.startTime,currentEndTime:c.endTime,showScopeToggle:!0,onConfirm:({startTime:e,endTime:t,scope:n})=>{n===`all-days`?this.engine.setCourtAvailabilityAllDays(o,{startTime:e,endTime:t}):this.engine.setCourtAvailability(o,s,{startTime:e,endTime:t}),this.control?.refresh()}})})})}updateVenueCheckboxState(e){let t=this.engine.listCourtMeta().filter(t=>t.ref.venueId===e),n=t.filter(e=>{let t=`${e.ref.tournamentId}|${e.ref.venueId}|${e.ref.courtId}`;return this.visibleCourts.has(t)}).length,r=this.venueTreeElement?.querySelector(`.venue-checkbox[data-venue="${e}"]`);r&&(n===0?(r.checked=!1,r.indeterminate=!1):n===t.length?(r.checked=!0,r.indeterminate=!1):(r.checked=!1,r.indeterminate=!0))}getEngine(){return this.engine}getControl(){return this.control}setDay(e){this.control?.setDay(e),this.updateCapacityStats()}refresh(){this.control?.refresh(),this.updateCapacityStats(),this.updateVenueTree()}};function PO(e,t){let n=new NO(e);return n.render(t),n}var{LUCKY_DRAW:FO,ROUND_ROBIN:IO,AD_HOC:LO}=t.drawDefinitionConstants;function RO(e){let t=Math.max(2,e),n=2**Math.floor(Math.log2(t)),r=t-n;if(r<=0)return new Map;let i=new Map,a=0,o=n/2;for(;o>=1;)a++,r&o&&(a++,i.set(a,o)),o=Math.floor(o/2);return i}function zO(e){let t=Math.max(2,e),n=2**Math.floor(Math.log2(t)),r=t-n,i=0,a=n/2;for(;a>=1;)i++,r&a&&i++,a=Math.floor(a/2);return i}function BO(e){let t=Math.max(2,e),n=t%2?t+1:t,r=!!(Math.ceil(n/2)%2),i=[{participantsCount:n,preFeedRound:r}];for(;n>2;){let e=Math.ceil(n/2),t=e===1,r=!!(!t&&e%2);n=!t&&r?e+1:e;let a=!!(n!==2&&Math.ceil(n/2)%2);i.push({participantsCount:n,preFeedRound:a,feedRound:r})}return i}function VO(e){let t=Math.max(2,e);return t&t-1?BO(e).length:Math.ceil(Math.log2(t))}function HO(e,t){let n=Math.max(2,e);if(!(n&n-1))return Math.floor(n/2**t);let r=BO(e),i=t-1;if(i<0||i>=r.length)return 0;let{participantsCount:a,preFeedRound:o}=r[i],s=a/2,c=o?s-1:s;if(t===1&&n%2!=0){let e=a-n;c-=e}return c}function UO(e,t,n){return e===IO?(n?.groupSize||Math.min(t,4))-1:e===LO?n?.roundsCount||1:e===FO?VO(t):zO(t)}function WO(e,t,n){return e===FO?HO(t,n):Math.floor(t/2**n)}var{ROUND_ROBIN:GO,AD_HOC:KO,LUCKY_DRAW:qO}=t.drawDefinitionConstants,JO=0;function YO({structureType:e,drawSize:t,stage:n,structureId:r,qualifyingPositions:i,structureOptions:a}){return e===GO?ZO({drawSize:t,stage:n,structureId:r,structureOptions:a}):e===KO?$O({drawSize:t,stage:n,structureId:r,roundsCount:a?.roundsCount||1}):e===qO?QO({drawSize:t,stage:n,structureId:r}):XO({drawSize:t,stage:n,structureId:r,qualifyingPositions:i})}function XO({drawSize:e,stage:t,structureId:n,qualifyingPositions:r}){let i=Math.max(2,e),a=2**Math.floor(Math.log2(i)),o=i-a,s=[],c=a/2;for(;c>=1;)s.push({count:c,isFeed:!1}),o&c&&s.push({count:c,isFeed:!0}),c=Math.floor(c/2);if(r&&r>0&&e>r){let t=Math.round(Math.log2(e/r));t>0&&s.length>t&&(s.length=t)}let l=s.length,u=[],d=1,f=0,p=new Set;for(let e=0;e<l-1;e++)!s[e].isFeed&&s[e+1].isFeed&&p.add(e);for(let e=0;e<l;e++){let{count:r,isFeed:i}=s[e],a=e+1,o=i?2**Math.max(0,f-1):2**f,c=i||p.has(e);for(let s=1;s<=r;s++){let r=a===1&&!i;u.push({matchUpId:`preview-${++JO}`,roundNumber:a,roundPosition:s,drawPositions:r?[(s-1)*2+1,(s-1)*2+2]:i?[d++]:[],finishingRound:l-e,roundFactor:o,preFeedRound:c,stage:t,structureId:n})}i||f++}return u}function ZO({drawSize:e,stage:t,structureId:n,structureOptions:r}){let i=[],a=r?.groupSize||Math.min(e,4),o=Math.ceil(e/a),s=a-1;for(let e=0;e<o;e++)for(let r=1;r<=s;r++){let o=Math.floor(a/2);for(let a=1;a<=o;a++)i.push({matchUpId:`preview-${++JO}`,roundNumber:r,roundPosition:e*o+a,isRoundRobin:!0,stage:t,structureId:`${n}-g${e}`})}return i}function QO({drawSize:e,stage:t,structureId:n}){let r=Math.max(2,e);if(!(r&r-1))return XO({drawSize:e,stage:t,structureId:n});let i=BO(r),a=i.length,o=[],s=1;for(let e=0;e<a;e++){let{participantsCount:r,preFeedRound:c}=i[e],l=r/2,u=e+1;for(let r=1;r<=l;r++){let i=u===1;o.push({matchUpId:`preview-${++JO}`,roundNumber:u,roundPosition:r,drawPositions:i?[s++,s++]:[],finishingRound:a-e,roundFactor:1,preFeedRound:!!c,stage:t,structureId:n})}}return o}function $O({drawSize:e,stage:t,structureId:n,roundsCount:r=1}){let i=[];if(e<2)return i;let a=Math.floor(e/2);for(let e=1;e<=r;e++)for(let r=1;r<=a;r++)i.push({matchUpId:`preview-${++JO}`,roundNumber:e,roundPosition:r,finishingRound:1,stage:t,structureId:n});return i}var{ROUND_ROBIN:ek}=t.drawDefinitionConstants,tk=new Map;function nk(e,n,r){let i=`${e}:${n}:${r||``}`,a=tk.get(i);if(a)return a;try{let a={drawSize:n,drawType:e};r&&(a.structureOptions={groupSize:r});let{tournamentRecord:o}=t.mocksEngine.generateTournamentRecord({drawProfiles:[a]}),s=o?.events?.[0]?.drawDefinitions?.[0];if(!s)return rk(i,{});let c=(s.structures||[])[0];if(!c)return rk(i,{});let l=c.structureType===`CONTAINER`,u={};if(l||e===ek){let{availablePlayoffProfiles:e}=t.drawsGovernor.getAvailablePlayoffProfiles({drawDefinition:s}),n=e?.[0];n&&(u={playoffFinishingPositionRanges:n.playoffFinishingPositionRanges,finishingPositionsAvailable:n.finishingPositionsAvailable})}else{let e=c.structureId,{playoffRounds:n,playoffRoundsRanges:r}=t.drawsGovernor.getAvailablePlayoffProfiles({drawDefinition:s,structureId:e});u={playoffRounds:n,playoffRoundsRanges:r}}return rk(i,u)}catch{return rk(i,{})}}function rk(e,t){return tk.set(e,t),t}var{MAIN:ik,QUALIFYING:ak,CONSOLATION:ok,PLAY_OFF:sk,ROUND_ROBIN:ck,AD_HOC:lk,LUCKY_DRAW:uk,WINNER:dk,LOSER:fk}=t.drawDefinitionConstants,pk=240,mk=48,hk=16;function gk(e){if(e.structureType===ck)return(e.structureOptions?.groupSize||Math.min(e.drawSize,4))-1;if(e.structureType===lk)return e.structureOptions?.roundsCount||1;if(e.structureType===uk)return VO(e.drawSize);let t=Math.max(2,e.drawSize),n=2**Math.floor(Math.log2(t)),r=t-n,i=0,a=n/2;for(;a>=1;)i++,r&a&&i++,a=Math.floor(a/2);if(e.qualifyingPositions&&e.qualifyingPositions>0&&e.drawSize>e.qualifyingPositions){let t=Math.round(Math.log2(e.drawSize/e.qualifyingPositions));t>0&&t<i&&(i=t)}return i}function _k(e){let t=gk(e);return Math.max(pk,t*mk+hk)}var vk={[ik]:`tb-card-badge--main`,[ak]:`tb-card-badge--qualifying`,[ok]:`tb-card-badge--consolation`,[sk]:`tb-card-badge--playoff`};function yk(e,t,n,r,i,a,o,s){let c=a&&a.length>0,l=document.createElement(`div`);l.className=`tb-card${n?` tb-card--selected`:``}${c?` tb-card--warning`:``}`,l.style.left=`${e.position.x}px`,l.style.top=`${e.position.y}px`,l.style.minWidth=`${_k(e)}px`,l.setAttribute(`data-node-id`,e.id);let u=document.createElement(`div`);u.className=`tb-card-header`;let d=document.createElement(`span`);d.className=`tb-card-badge ${vk[e.stage]||`tb-card-badge--main`}`,d.textContent=e.stage.substring(0,4);let f=document.createElement(`span`);f.className=`tb-card-name`,f.textContent=e.structureName;let p=document.createElement(`span`);if(p.className=`tb-card-size`,p.textContent=`\u00d7${e.drawSize}`,u.appendChild(d),u.appendChild(f),u.appendChild(p),o){let e=document.createElement(`div`);e.className=`tb-card-advance`,e.textContent=o,u.appendChild(e)}let m=document.createElement(`div`);m.className=`tb-card-preview`;let h=e.matchUps||YO({structureType:e.structureType,drawSize:e.drawSize,stage:e.stage,structureId:e.id,qualifyingPositions:e.qualifyingPositions,structureOptions:e.structureOptions});if(h.length>0)try{let t=li({matchUps:h,structureId:e.id,showHeaders:!1});t.style.transform=`scale(0.8)`,t.style.transformOrigin=`top left`,m.appendChild(t)}catch{m.textContent=`${e.structureType} \u00d7${e.drawSize}`,m.style.cssText+=`font-size:11px;color:var(--chc-text-muted);display:flex;align-items:center;justify-content:center;`}if(i?.length&&m.querySelector(`.chc-schematic-structure`)){let e=m.querySelectorAll(`.chc-schematic-round-container[data-round-number]`);for(let n of e){let e=parseInt(n.getAttribute(`data-round-number`)||`0`),r=i.filter(t=>t.roundNumber===e);if(!r.length)continue;let a=r.find(e=>e.isSelected)||r.find(e=>e.linkType===fk)||r.find(e=>e.linkType===dk)||r[0];n.classList.add(`tb-round-linked`),n.classList.add(`tb-round-linked--${a.linkType.toLowerCase()}`),n.classList.add(`tb-round-linked--${a.direction}`),a.isSelected&&n.classList.add(`tb-round-linked--active`),n.style.cursor=`pointer`,n.addEventListener(`click`,e=>{e.stopPropagation(),t.onSelectEdge(a.edgeId)}),n.title=r.map(t=>`R${e} ${t.linkType} ${t.direction===`source`?`out`:`in`}`).join(`, `)}}let g=nk(e.structureType,e.drawSize,e.structureOptions?.groupSize),_=null;g.playoffRoundsRanges?.length?(_=document.createElement(`div`),_.className=`tb-card-rounds`,_.textContent=g.playoffRoundsRanges.map(e=>`R${e.roundNumber}:${e.finishingPositionRange}`).join(` `)):g.playoffFinishingPositionRanges?.length&&(_=document.createElement(`div`),_.className=`tb-card-rounds`,_.textContent=g.playoffFinishingPositionRanges.map(e=>`P${e.finishingPosition}:${e.finishingPositionRange}`).join(` `));let v=document.createElement(`div`);v.className=`tb-card-ports`;let y=document.createElement(`div`);y.className=`tb-port tb-port--input`,y.title=`Input`,y.addEventListener(`mouseup`,()=>{t.onPortMouseUp(e.id)});let b=document.createElement(`div`);b.className=`tb-port-group`;let x=document.createElement(`div`);x.className=`tb-port tb-port--winner${r?` tb-port--connected`:``}`,x.title=r?`Winner linked`:`Winner output`,r||x.addEventListener(`mousedown`,n=>{n.stopPropagation(),t.onPortMouseDown(e.id,`winner`)});let S=document.createElement(`div`);if(S.className=`tb-port tb-port--loser`,S.title=`Loser output`,S.addEventListener(`mousedown`,n=>{n.stopPropagation(),t.onPortMouseDown(e.id,`loser`)}),b.appendChild(x),b.appendChild(S),v.appendChild(y),v.appendChild(b),l.appendChild(u),l.appendChild(m),s?.length){let e=document.createElement(`div`);e.className=`tb-card-chips`;for(let n of s){let r=document.createElement(`span`);r.className=`tb-card-chip`,r.textContent=`P${n.position}`,r.title=`Position ${n.position} → ${n.targetName}`,r.addEventListener(`click`,e=>{e.stopPropagation(),t.onSelectEdge(n.edgeId)}),e.appendChild(r)}l.appendChild(e)}if(_&&l.appendChild(_),c){let e=document.createElement(`div`);e.className=`tb-card-warning`,e.textContent=`⚠ Issue`;let t=document.createElement(`div`);t.className=`tb-card-warning-detail`,t.textContent=a.join(`; `),e.appendChild(t),e.addEventListener(`click`,t=>{t.stopPropagation(),e.classList.toggle(`tb-card-warning--open`)}),l.appendChild(e)}return l.appendChild(v),l.addEventListener(`mouseup`,()=>{t.onPortMouseUp(e.id)}),l.addEventListener(`click`,n=>{n.stopPropagation(),t.onSelect(e.id)}),t.onDoubleClick&&l.addEventListener(`dblclick`,n=>{n.stopPropagation(),t.onDoubleClick(e.id)}),l.addEventListener(`mousedown`,n=>{n.target.classList.contains(`tb-port`)||t.onDragStart(e.id,n.clientX,n.clientY)}),l}function bk(e,t){let n=_k(e);switch(t){case`input`:return{x:e.position.x,y:e.position.y+160/2};case`winner`:return{x:e.position.x+n,y:e.position.y+160/2-8};case`loser`:return{x:e.position.x+n,y:e.position.y+160/2+8}}}var{MAIN:xk,QUALIFYING:Sk,CONSOLATION:Ck,WINNER:wk,LOSER:Tk,ROUND_ROBIN:Ek}=t.drawDefinitionConstants,Dk=`POSITION`,Ok=0;function kk(e){return`${e}-${++Ok}-${Date.now().toString(36)}`}function Ak(e){let t=2;for(;t*2<=e;)t*=2;return t}var jk=160,Mk=60,Nk=30,Pk=class{constructor(e){this.listeners=new Set,this.state={nodes:[],edges:[],selectedNodeId:null,selectedEdgeId:null,drawName:`New Draw`,...e}}getState(){return{...this.state}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){let e=this.getState();for(let t of this.listeners)t(e)}setDrawName(e){this.state.drawName=e,this.notify()}addNode(e){let t={...e,id:kk(`node`),position:this.nextNodePosition()};return this.state.nodes.push(t),this.state.templateName=void 0,this.notify(),t}updateNode(e,t){let n=this.state.nodes.find(t=>t.id===e);n&&(Object.keys(t).some(e=>e!==`position`)&&(this.state.templateName=void 0),Object.assign(n,t),this.notify())}removeNode(e){let t=this.state.edges.filter(t=>t.sourceNodeId===e).map(e=>e.targetNodeId);this.state.nodes=this.state.nodes.filter(t=>t.id!==e),this.state.edges=this.state.edges.filter(t=>t.sourceNodeId!==e&&t.targetNodeId!==e),this.state.selectedNodeId===e&&(this.state.selectedNodeId=null),this.state.templateName=void 0;for(let e of t)this.clampConsolationDrawSize(e);this.notify()}addEdge(e){if(e.linkType===wk&&this.state.edges.find(t=>t.sourceNodeId===e.sourceNodeId&&t.linkType===wk))return null;let t=this.state.nodes.find(t=>t.id===e.sourceNodeId),n=this.state.nodes.find(t=>t.id===e.targetNodeId);if(t?.structureType===Ek&&e.linkType!==Dk||t?.stage===Sk&&n&&n.stage!==Sk&&n.stage!==xk||n?.stage===Sk&&t&&t.stage!==Sk)return null;let r={...e,id:kk(`edge`),targetRoundNumber:e.targetRoundNumber||1,label:this.computeEdgeLabel(e)};return this.state.edges.push(r),this.state.templateName=void 0,this.clampConsolationDrawSize(r.targetNodeId),this.notify(),r}updateEdge(e,t){let n=this.state.edges.find(t=>t.id===e);n&&(Object.assign(n,t),n.label=this.computeEdgeLabel(n),this.state.templateName=void 0,this.notify())}removeEdge(e){let t=this.state.edges.find(t=>t.id===e);this.state.edges=this.state.edges.filter(t=>t.id!==e),this.state.selectedEdgeId===e&&(this.state.selectedEdgeId=null),this.state.templateName=void 0,t&&this.clampConsolationDrawSize(t.targetNodeId),this.notify()}selectNode(e){this.state.selectedNodeId=e,this.state.selectedEdgeId=null,this.notify()}selectEdge(e){this.state.selectedEdgeId=e,this.state.selectedNodeId=null,this.notify()}clampConsolationDrawSize(e){let t=this.state.nodes.find(t=>t.id===e);if(!t||t.stage!==Ck)return;let n=this.inboundCapacity(e);n>0&&t.drawSize>n&&(t.drawSize=Ak(n))}inboundCapacity(e){let t=this.state.edges.filter(t=>t.targetNodeId===e),n=0;for(let e of t){let t=this.state.nodes.find(t=>t.id===e.sourceNodeId);if(t)if(e.linkType===Tk){let r=e.sourceRoundNumber||1;n+=WO(t.structureType,t.drawSize,r)}else n+=t.qualifyingPositions||Math.floor(t.drawSize/2)}return n}nextNodePosition(){if(this.state.nodes.length===0)return{x:40,y:40};let e=0;for(let t of this.state.nodes)e=Math.max(e,t.position.x+_k(t));return{x:e+Mk,y:40}}autoLayout(){let e=this.state.nodes,t=this.state.edges;if(!e.length)return;let n=new Map,r=new Map;for(let e of t)r.has(e.sourceNodeId)||r.set(e.sourceNodeId,[]),r.get(e.sourceNodeId).push(e.targetNodeId),n.has(e.targetNodeId)||n.set(e.targetNodeId,[]),n.get(e.targetNodeId).push(e.sourceNodeId);let i=e.filter(e=>!n.has(e.id)||n.get(e.id).length===0);if(!i.length){let t=e.filter(e=>e.stage===xk);i.push(...t.length?t:[e[0]])}let a=new Map,o=new Set(e.filter(e=>e.stage===Sk).map(e=>e.id)),s=[];for(let e of i)o.has(e.id)?a.set(e.id,-1):a.set(e.id,0),s.push(e.id);let c=e.length*(e.length-1)+e.length,l=0;for(;s.length&&l<c;){l++;let e=s.shift(),t=a.get(e),n=r.get(e)||[];for(let e of n){let n=t+1,r=a.get(e);(r===void 0||n>r)&&(a.set(e,n),s.push(e))}}for(let t of e)a.has(t.id)||a.set(t.id,0);let u=Math.min(...a.values());if(u<0)for(let[e,t]of a)a.set(e,t-u);let d=new Map;for(let t of e){let e=a.get(t.id);d.has(e)||d.set(e,[]),d.get(e).push(t)}let f=[...d.keys()].sort((e,t)=>e-t),p=40;for(let e of f){let t=d.get(e),n=Math.max(...t.map(e=>_k(e)));t.forEach((e,t)=>{e.position={x:p,y:t*(jk+Nk)+40}}),p+=n+Mk}}loadState(e){this.state={...e},this.notify()}computeEdgeLabel(e){let t=e.linkType||`LINK`,n=``;return e.sourceRoundNumber&&(n+=`R${e.sourceRoundNumber} `),n+=t.toLowerCase(),e.targetRoundNumber&&(n+=` \u2192 R${e.targetRoundNumber}`),e.qualifyingPositions&&(n+=` (${e.qualifyingPositions}Q)`),e.finishingPositions?.length&&(n+=` [${e.finishingPositions.join(`,`)}]`),n}},{WINNER:Fk,LOSER:Ik,QUALIFYING:Lk,CONSOLATION:Rk,ROUND_ROBIN:zk}=t.drawDefinitionConstants,Bk=`POSITION`,Vk=e=>e===zk;function Hk(e,t){if(!Vk(e.structureType))return;let n=t.edges.filter(t=>t.sourceNodeId===e.id&&t.linkType===Bk);if(!n.length)return;let r=new Set(n.flatMap(e=>e.finishingPositions||[])),i=e.structureOptions?.groupSize||4;return`${r.size} of ${i} advance`}var Uk=`http://www.w3.org/2000/svg`,Wk={[Fk]:`tb-edge--winner`,[Ik]:`tb-edge--loser`,[Bk]:`tb-edge--position`};function Gk(e){let t=document.createElement(`div`);t.className=`tb-canvas`;let n=document.createElementNS(Uk,`svg`);n.classList.add(`tb-canvas-svg`);let r=document.createElementNS(Uk,`defs`);for(let[e,t]of Object.entries(Wk)){let n=document.createElementNS(Uk,`marker`);n.setAttribute(`id`,`arrowhead-${e}`),n.setAttribute(`markerWidth`,`8`),n.setAttribute(`markerHeight`,`6`),n.setAttribute(`refX`,`8`),n.setAttribute(`refY`,`3`),n.setAttribute(`orient`,`auto`);let i=document.createElementNS(Uk,`polygon`);i.setAttribute(`points`,`0 0, 8 3, 0 6`),i.setAttribute(`class`,t),i.style.fill=`currentColor`,n.appendChild(i),r.appendChild(n)}n.appendChild(r);let i=document.createElement(`div`);i.className=`tb-canvas-nodes`;let a=document.createElement(`div`);a.className=`tb-canvas-spacer`,t.appendChild(n),t.appendChild(i),t.appendChild(a);let o=null,s=null,c=null,l=!1,u=null;t.addEventListener(`click`,()=>{l||(e.onSelectNode(null),e.onSelectEdge(null))}),t.addEventListener(`mousemove`,n=>{if(s&&!c){let e=n.clientX-s.startX,t=n.clientY-s.startY;Math.abs(e)+Math.abs(t)>=4&&(c=s,s=null)}if(c&&u){let t=n.clientX-c.startX,r=n.clientY-c.startY;e.onMoveNode(c.nodeId,Math.max(0,c.origX+t),Math.max(0,c.origY+r))}if(o?.tempLine){let e=t.getBoundingClientRect();o.tempLine.setAttribute(`x2`,String(n.clientX-e.left+t.scrollLeft)),o.tempLine.setAttribute(`y2`,String(n.clientY-e.top+t.scrollTop))}}),t.addEventListener(`mouseup`,()=>{c&&(l=!0,c=null,setTimeout(()=>{l=!1},0)),s=null,o?.tempLine&&(n.removeChild(o.tempLine),o=null)});function d(e){return new Set(e.edges.filter(e=>e.linkType===Fk).map(e=>e.sourceNodeId).filter(t=>{let n=e.nodes.find(e=>e.id===t);return n&&n.stage===Lk&&!Vk(n.structureType)}))}function f(e){let t=new Map;for(let n of e.edges){let r=n.sourceRoundNumber,i=n.targetRoundNumber,a=n.id===e.selectedEdgeId;if(!r&&n.linkType===Fk){let t=e.nodes.find(e=>e.id===n.sourceNodeId);t&&(r=gk(t))}r&&(t.has(n.sourceNodeId)||t.set(n.sourceNodeId,[]),t.get(n.sourceNodeId).push({roundNumber:r,linkType:n.linkType,direction:`source`,edgeId:n.id,isSelected:a})),i&&(t.has(n.targetNodeId)||t.set(n.targetNodeId,[]),t.get(n.targetNodeId).push({roundNumber:i,linkType:n.linkType,direction:`target`,edgeId:n.id,isSelected:a}))}return t}function p(e){let t=new Map;for(let n of e.edges){if(n.linkType!==Fk)continue;let r=n.targetRoundNumber||1;if(r<=1)continue;let i=e.nodes.find(e=>e.id===n.sourceNodeId);if(!i||i.stage!==Lk)continue;t.has(n.targetNodeId)||t.set(n.targetNodeId,[]);let a=i.qualifyingPositions||Math.floor(i.drawSize/4);t.get(n.targetNodeId).push({targetRound:r,qp:a,warning:`Round ${r} needs fed drawPositions to accommodate ${i.structureName} link`})}let n=new Map;for(let[r,i]of t){let t=e.nodes.find(e=>e.id===r);if(!t)continue;let a=RO(t.drawSize),o=new Map;for(let e of i)o.set(e.targetRound,(o.get(e.targetRound)||0)+e.qp);let s=[];for(let e of i)(a.get(e.targetRound)||0)<(o.get(e.targetRound)||0)&&s.push(e.warning);s.length>0&&n.set(r,s)}return n}function m(e){let t=new Map;for(let n of e.nodes){if(!Vk(n.structureType))continue;let r=e.edges.filter(e=>e.sourceNodeId===n.id&&e.linkType===Bk);if(!r.length)continue;let i=[];for(let t of r){let n=e.nodes.find(e=>e.id===t.targetNodeId);for(let e of t.finishingPositions||[])i.push({position:e,edgeId:t.id,targetName:n?.structureName||`?`})}i.sort((e,t)=>e.position-t.position),t.set(n.id,i)}return t}function h(e,t,n){return e&&Vk(e.structureType)?Bk:n===`loser`||t?.stage===Rk?Ik:Fk}function g(t){return{onSelect:t=>{e.onSelectNode(t)},onSelectEdge:t=>{e.onSelectEdge(t)},onDoubleClick:e.onDoubleClickNode?t=>e.onDoubleClickNode(t):void 0,onPortMouseDown:(e,r)=>{let i=t.nodes.find(t=>t.id===e);if(!i)return;let a=bk(i,r),s=document.createElementNS(Uk,`line`);s.setAttribute(`x1`,String(a.x)),s.setAttribute(`y1`,String(a.y)),s.setAttribute(`x2`,String(a.x)),s.setAttribute(`y2`,String(a.y)),s.setAttribute(`stroke`,r===`winner`?`green`:`red`),s.setAttribute(`stroke-width`,`2`),s.setAttribute(`stroke-dasharray`,`4 2`),n.appendChild(s),o={sourceNodeId:e,portType:r,tempLine:s}},onPortMouseUp:r=>{if(o&&o.sourceNodeId!==r){let n=h(t.nodes.find(e=>e.id===o.sourceNodeId),t.nodes.find(e=>e.id===r),o.portType);e.onCreateEdge(o.sourceNodeId,r,n)}o?.tempLine&&n.removeChild(o.tempLine),o=null},onDragStart:(e,n,r)=>{let i=t.nodes.find(t=>t.id===e);i&&(s={nodeId:e,startX:n,startY:r,origX:i.position.x,origY:i.position.y})}}}function _(e){u=e,i.innerHTML=``;let t=d(e),r=f(e),o=p(e),s=m(e),c=g(e);for(let n of e.nodes){let a=yk(n,c,e.selectedNodeId===n.id,t.has(n.id),r.get(n.id),o.get(n.id),Hk(n,e),s.get(n.id));i.appendChild(a)}n.querySelectorAll(`path, text.tb-edge-label, path.tb-edge-hit`).forEach(e=>n.removeChild(e));let l=new Map;for(let t of e.edges){let e=`${t.sourceNodeId}:${t.targetNodeId}`;l.has(e)||l.set(e,[]),l.get(e).push(t)}for(let t of l.values()){let r=t.length;t.forEach((t,i)=>{v(n,t,e,r>1?(i-(r-1)/2)*14:0)})}let h=600,_=400;for(let t of e.nodes)h=Math.max(h,t.position.x+_k(t)+40),_=Math.max(_,t.position.y+180);n.setAttribute(`width`,String(h)),n.setAttribute(`height`,String(_)),i.style.width=`${h}px`,i.style.height=`${_}px`,a.style.width=`${h}px`,a.style.height=`${_}px`}function v(t,n,r,i=0){let a=r.nodes.find(e=>e.id===n.sourceNodeId),o=r.nodes.find(e=>e.id===n.targetNodeId);if(!a||!o)return;let s=bk(a,n.linkType===Ik?`loser`:`winner`),c=bk(o,`input`),l=s.y+i,u=c.y+i,d=c.x-s.x,f=`M ${s.x},${l} C ${s.x+d/2},${l} ${s.x+d/2},${u} ${c.x},${u}`,p=document.createElementNS(Uk,`path`);p.setAttribute(`d`,f),p.classList.add(`tb-edge-hit`),p.addEventListener(`click`,t=>{t.stopPropagation(),e.onSelectEdge(n.id)}),t.appendChild(p);let m=document.createElementNS(Uk,`path`);if(m.setAttribute(`d`,f),m.classList.add(Wk[n.linkType]||`tb-edge--winner`),r.selectedEdgeId===n.id&&m.classList.add(`tb-edge--selected`),m.setAttribute(`marker-end`,`url(#arrowhead-${n.linkType})`),m.addEventListener(`click`,t=>{t.stopPropagation(),e.onSelectEdge(n.id)}),t.appendChild(m),n.label){let e=(s.x+c.x)/2,r=(l+u)/2-8,i=document.createElementNS(Uk,`text`);i.classList.add(`tb-edge-label`),i.setAttribute(`x`,String(e)),i.setAttribute(`y`,String(r)),i.setAttribute(`text-anchor`,`middle`),i.textContent=n.label,t.appendChild(i)}}return{element:t,update:_}}var{SINGLE_ELIMINATION:Kk,ROUND_ROBIN:qk,FEED_IN:Jk,FEED_IN_CHAMPIONSHIP:Yk,FIRST_MATCH_LOSER_CONSOLATION:Xk,COMPASS:Zk,OLYMPIC:Qk,AD_HOC:$k,LUCKY_DRAW:eA,MAIN:tA,QUALIFYING:nA,CONSOLATION:rA,PLAY_OFF:iA,WINNER:aA}=t.drawDefinitionConstants,oA=`POSITION`,sA=[{label:`Single Elimination`,value:Kk},{label:`Round Robin`,value:qk},{label:`Feed-In Championship`,value:Yk},{label:`FMLC`,value:Xk},{label:`Compass`,value:Zk},{label:`Olympic`,value:Qk},{label:`Ad-hoc`,value:$k}],cA=[{label:`Single Elimination`,value:Kk},{label:`Round Robin`,value:qk},{label:`Lucky Draw`,value:eA},{label:`Staggered Entry`,value:Jk},{label:`Ad-hoc`,value:$k}],lA=[{label:`Main`,value:tA},{label:`Qualifying`,value:nA},{label:`Consolation`,value:rA},{label:`Playoff`,value:iA}];function uA(e){let t=[],n=Math.floor(e/2);for(;n>=1;)t.push(n),n=Math.floor(n/2);return t}function dA(e,t=8){let n=[];for(let r=3;r<=t;r++){let t=Math.ceil(e/r),i=t*r-e,a=Math.ceil(e/t),o=Math.ceil(i/t);(!i||i<r)&&a===r&&a>=3&&o<2&&n.push(r)}return n}function fA(e,t,n,r,i,a){let o=dA(e.drawSize),s=e.structureOptions?.groupSize||4,c=o.includes(s)?o:[s,...o].sort((e,t)=>e-t),l=Math.ceil(e.drawSize/s);i.push({label:`Group Size`,field:`groupSize`,value:String(s),disabled:n,options:c.map(e=>({label:String(e),value:String(e),selected:e===s}))}),i.push({label:`Groups`,field:`groupCount`,value:String(l),disabled:!0}),n||a.push({control:`groupSize`,onChange:({e:t})=>{let n=parseInt(t.target.value);r.onUpdateNode(e.id,{structureOptions:{...e.structureOptions,groupSize:n}})}});let u=t.edges.filter(t=>t.sourceNodeId===e.id&&t.linkType===oA),d=new Set(u.flatMap(e=>e.finishingPositions||[])),f=d.size||0,p=Array.from({length:s},(e,t)=>t+1);i.push({label:`Advance Per Group`,field:`advancePerGroup`,value:String(f),disabled:n||u.length===0,options:p.map(e=>({label:String(e),value:String(e),selected:e===f}))}),!n&&u.length>0&&a.push({control:`advancePerGroup`,onChange:({e})=>{let t=parseInt(e.target.value),n=d.size;if(t!==n)if(t>n){let e=u.at(-1),n=[];for(let e=1;e<=s&&d.size+n.length<t;e++)d.has(e)||n.push(e);n.length>0&&r.onUpdateEdge(e.id,{finishingPositions:[...e.finishingPositions||[],...n].sort((e,t)=>e-t)})}else{let e=[...d].sort((e,t)=>t-e),i=new Set(e.slice(0,n-t));for(let e of u){let t=(e.finishingPositions||[]).filter(e=>!i.has(e));t.length!==(e.finishingPositions||[]).length&&r.onUpdateEdge(e.id,{finishingPositions:t})}}}}),u.length>0&&f>0&&pA(u,t,l,i)}function pA(e,t,n,r){let i=new Map;for(let t of e)i.has(t.targetNodeId)||i.set(t.targetNodeId,[]),i.get(t.targetNodeId).push(...t.finishingPositions||[]);let a=[];for(let[e,r]of i){let i=t.nodes.find(t=>t.id===e),o=[...new Set(r)].sort((e,t)=>e-t),s=o.length===1?`P${o[0]}`:`P${o.join(`,`)}`;a.push(`${s} → ${i?.structureName||`?`} (${o.length*n})`)}a.length>0&&r.push({label:`Playoff Groups`,field:`playoffSummary`,value:a.join(`
321
+ `),disabled:!0})}function mA(e,t,n,r,i,a){let o=t.edges.find(t=>t.targetNodeId===e.id&&t.linkType===oA);if(!o||t.nodes.find(e=>e.id===o.sourceNodeId)?.structureType!==qk)return;let s=e.structureOptions?.playoffDrawType||Kk;if(i.push({label:`Playoff Draw Type`,field:`playoffDrawType`,value:s,disabled:n,options:sA.map(e=>({...e,selected:e.value===s}))}),n||a.push({control:`playoffDrawType`,onChange:({e:t})=>r.onUpdateNode(e.id,{structureOptions:{...e.structureOptions,playoffDrawType:t.target.value}})}),s===qk){let t=e.structureOptions?.groupSize||4;i.push({label:`Playoff Group Size`,field:`playoffGroupSize`,value:String(t),disabled:n,options:[3,4,5,6,8].map(e=>({label:String(e),value:String(e),selected:e===t}))}),n||a.push({control:`playoffGroupSize`,onChange:({e:t})=>r.onUpdateNode(e.id,{structureOptions:{...e.structureOptions,groupSize:parseInt(t.target.value)}})})}}function hA(e,t,n,r,i){let a=uA(e.drawSize),o=e.qualifyingPositions??a[0];r.push({label:`Qualifying Positions`,field:`qualifyingPositions`,value:String(o),disabled:t,options:a.map(e=>({label:String(e),value:String(e),selected:e===o}))}),t||i.push({control:`qualifyingPositions`,onChange:({e:t})=>n.onUpdateNode(e.id,{qualifyingPositions:parseInt(t.target.value)})})}function gA(e,t,n){let r=RO(e.drawSize),i=new Map,a=[];for(let n of t.edges){if(n.linkType!==aA||n.targetNodeId!==e.id)continue;let r=n.targetRoundNumber||1;if(r<=1)continue;let o=t.nodes.find(e=>e.id===n.sourceNodeId);if(!o||o.stage!==nA)continue;let s=o.qualifyingPositions||Math.floor(o.drawSize/4);i.set(r,(i.get(r)||0)+s),a.push({targetRound:r,qp:s,sourceName:o.structureName})}let o=[];for(let e of a){let t=r.get(e.targetRound)||0;t>=(i.get(e.targetRound)||0)||(t===0?o.push(`Round ${e.targetRound} is not a feed round — ${e.sourceName} sends ${e.qp} qualifiers`):o.push(`Round ${e.targetRound} has ${t} feed positions but ${e.sourceName} sends ${e.qp} qualifiers`))}if(o.length>0){let e=document.createElement(`div`);e.className=`tb-editor-warning`;for(let t of o){let n=document.createElement(`div`);n.textContent=`\u26a0 ${t}`,e.appendChild(n)}let t=document.createElement(`div`);t.style.marginTop=`6px`,t.textContent=`Change the target round to a feed round, or increase the draw size to create feed positions at that round.`,e.appendChild(t),n.appendChild(e)}}function _A(e){let t=document.createElement(`div`),n=!!e.readOnly;function r(r){t.innerHTML=``;let i=r.selectedNodeId?r.nodes.find(e=>e.id===r.selectedNodeId):null;if(!i)return;let a=document.createElement(`div`);a.className=`tb-editor-header`,a.textContent=`Structure Properties`,t.appendChild(a);let o=document.createElement(`div`);o.className=`tb-editor-body`;let s=[{label:`Name`,field:`structureName`,value:i.structureName,...n?{disabled:!0}:{validator:eh(1),error:`Name required`}},{label:`Stage`,field:`stage`,value:i.stage,disabled:n,options:lA.map(e=>({...e,selected:e.value===i.stage}))},{label:`Structure Type`,field:`structureType`,value:i.structureType,disabled:n,options:cA.map(e=>({...e,selected:e.value===i.structureType}))},{label:i.stage===tA?`Draw Size`:`Structure Size`,field:`drawSize`,type:`number`,value:String(i.drawSize),...n?{disabled:!0}:i.structureType===$k?{validator:nh(0,256),error:`Must be 0-256`}:{validator:nh(2,256),error:`Must be 2-256`}}],c=n?[]:[{control:`structureName`,onChange:({inputs:t})=>e.onUpdateNode(i.id,{structureName:t.structureName.value})},{control:`stage`,onChange:({e:t})=>e.onUpdateNode(i.id,{stage:t.target.value})},{control:`structureType`,onChange:({e:t})=>e.onUpdateNode(i.id,{structureType:t.target.value})},{control:`drawSize`,onChange:({inputs:t})=>{let n=parseInt(t.drawSize.value);if(n<(i.structureType===$k?0:2))return;let r={drawSize:n};if(i.structureType===qk){let e=i.structureOptions?.groupSize||4,t=dA(n);!t.includes(e)&&t.length>0&&(r.structureOptions={...i.structureOptions,groupSize:t[0]})}e.onUpdateNode(i.id,r)}}];i.structureType===qk&&fA(i,r,n,e,s,c),i.stage===iA&&mA(i,r,n,e,s,c),i.stage===nA&&hA(i,n,e,s,c),ui(o,s,c);let l=document.createElement(`div`);l.className=`field font-medium`,l.style.cssText=`flex-grow: 1`;let u=document.createElement(`label`);u.style.cssText=`font-weight: bold; font-size: larger;`,u.textContent=`MatchUp Format`,l.appendChild(u);let d=document.createElement(`div`);if(d.className=`tb-format-trigger`,d.textContent=i.matchUpFormat||`Not set`,n?(d.style.cursor=`default`,d.style.opacity=`0.7`):d.onclick=()=>{Ca({existingMatchUpFormat:i.matchUpFormat,callback:t=>{e.onUpdateNode(i.id,{matchUpFormat:t||void 0}),d.textContent=t||`Not set`}})},l.appendChild(d),o.appendChild(l),gA(i,r,o),!n&&!e.hideDelete){let t=document.createElement(`button`);t.className=`sp-btn sp-btn--danger sp-btn--full`,t.style.marginTop=`12px`,t.textContent=`Delete Structure`,t.onclick=()=>e.onDeleteNode(i.id),o.appendChild(t)}t.appendChild(o)}return{element:t,update:r}}var{WINNER:vA,LOSER:yA,TOP_DOWN:bA,BOTTOM_UP:xA,QUALIFYING:SA,ROUND_ROBIN:CA}=t.drawDefinitionConstants,wA=`POSITION`,TA=`ALTERNATING`,EA=e=>e===CA,DA=[{label:`Winner`,value:vA},{label:`Loser`,value:yA},{label:`Position`,value:wA}],OA=[{label:`Top-Down`,value:bA},{label:`Bottom-Up`,value:xA},{label:`Alternating`,value:TA}];function kA(e){let t=document.createElement(`div`),n=!!e.readOnly;function r(t,r,i,a,o,s){let c=[],l=[],u=r?nk(r.structureType,r.drawSize,r.structureOptions?.groupSize):{},d=u.playoffRoundsRanges&&u.playoffRoundsRanges.length>0;if(d){let e=u.playoffRoundsRanges.map(e=>({label:`R${e.roundNumber} (${e.finishingPositionRange})`,value:String(e.roundNumber),selected:e.roundNumber===(t.sourceRoundNumber||a)}));c.push({label:`Source Round`,field:`sourceRoundNumber`,value:String(t.sourceRoundNumber||a),disabled:n,options:e})}else c.push({label:`Source Round`,field:`sourceRoundNumber`,type:`number`,value:String(t.sourceRoundNumber||a),disabled:n});return c.push({label:s?`Enter at Round`:`Target Round`,field:`targetRoundNumber`,type:`number`,value:String(t.targetRoundNumber||0),disabled:n}),n||(d?l.push({control:`sourceRoundNumber`,onChange:({e:n})=>{let r=Number.parseInt(n.target.value)||0;e.onUpdateEdge(t.id,{sourceRoundNumber:r||void 0})}}):l.push({control:`sourceRoundNumber`,onChange:({inputs:n})=>{let r=Number.parseInt(n.sourceRoundNumber.value)||0,i=Math.max(0,Math.min(r,a));e.onUpdateEdge(t.id,{sourceRoundNumber:i||void 0})}}),l.push({control:`targetRoundNumber`,onChange:({inputs:n})=>{let r=Number.parseInt(n.targetRoundNumber.value)||0,i=Math.max(0,Math.min(r,o));e.onUpdateEdge(t.id,{targetRoundNumber:i||void 0})}})),{items:c,relationships:l}}function i(t,r,i){let a=r.structureOptions?.groupSize||4,o=new Set(t.finishingPositions||[]),s=i.edges.filter(e=>e.id!==t.id&&e.sourceNodeId===t.sourceNodeId&&e.linkType===wA),c=new Set;for(let e of s)for(let t of e.finishingPositions||[])c.add(t);let l=document.createElement(`div`);l.className=`field`,l.style.marginBottom=`10px`;let u=document.createElement(`label`);u.style.cssText=`font-size:11px;font-weight:600;color:var(--chc-text-secondary);margin-bottom:3px;display:block;`,u.textContent=`Finishing Positions`,l.appendChild(u);for(let r=1;r<=a;r++){let i=document.createElement(`label`);i.style.cssText=`display:flex;align-items:center;gap:4px;font-size:12px;padding:2px 0;cursor:pointer;`;let a=document.createElement(`input`);a.type=`checkbox`,a.checked=o.has(r);let s=c.has(r);n||s?a.disabled=!0:a.addEventListener(`change`,()=>{let n=new Set(o);a.checked?n.add(r):n.delete(r),e.onUpdateEdge(t.id,{finishingPositions:Array.from(n).sort((e,t)=>e-t)})});let u=document.createElement(`span`);u.textContent=`Position ${r}`,s&&(u.style.color=`var(--chc-text-muted, #999)`,u.title=`Used by another link`,i.style.opacity=`0.5`,i.style.cursor=`not-allowed`),i.appendChild(a),i.appendChild(u),l.appendChild(i)}return l}function a(a){t.innerHTML=``;let o=a.selectedEdgeId?a.edges.find(e=>e.id===a.selectedEdgeId):null;if(!o)return;let s=a.nodes.find(e=>e.id===o.sourceNodeId),c=a.nodes.find(e=>e.id===o.targetNodeId),l=document.createElement(`div`);l.className=`tb-editor-header`,l.textContent=`Link Properties`,t.appendChild(l);let u=document.createElement(`div`);u.className=`tb-editor-body`;let d=document.createElement(`div`);d.style.cssText=`font-size:11px;color:var(--chc-text-muted);margin-bottom:8px;`,d.textContent=`${s?.structureName||`Source`} → ${c?.structureName||`Target`}`,u.appendChild(d);let f=o.linkType===vA&&s?.stage===SA,p=s?UO(s.structureType,s.drawSize,s.structureOptions):8,m=c?UO(c.structureType,c.drawSize,c.structureOptions):8,h=o.linkType===wA&&s&&EA(s.structureType),g=[{label:`Link Type`,field:`linkType`,value:o.linkType,disabled:n,options:DA.map(e=>({...e,selected:e.value===o.linkType}))}],_=n?[]:[{control:`linkType`,onChange:({e:t})=>e.onUpdateEdge(o.id,{linkType:t.target.value})}];if(!h){let e=r(o,s,c,p,m,f);g.push(...e.items),_.push(...e.relationships)}if(f&&s){let t=Math.floor(s.drawSize/2),r=Math.floor(s.drawSize/4),i=o.qualifyingPositions||r;g.push({label:`Qualifying Positions`,field:`qualifyingPositions`,type:`number`,value:String(i),disabled:n}),n||_.push({control:`qualifyingPositions`,onChange:({inputs:n})=>{let r=Number.parseInt(n.qualifyingPositions.value)||1,i=Math.max(1,Math.min(r,t));e.onUpdateEdge(o.id,{qualifyingPositions:i})}})}if(o.linkType===yA&&(g.push({label:`Feed Profile`,field:`feedProfile`,value:o.feedProfile||bA,disabled:n,options:OA.map(e=>({...e,selected:e.value===(o.feedProfile||bA)}))}),n||_.push({control:`feedProfile`,onChange:({e:t})=>e.onUpdateEdge(o.id,{feedProfile:t.target.value})})),o.linkType===wA&&!h&&(g.push({label:`Finishing Positions`,field:`finishingPositions`,value:(o.finishingPositions||[]).join(`, `),placeholder:`e.g., 1, 2`,disabled:n}),n||_.push({control:`finishingPositions`,onChange:({inputs:t})=>{let n=t.finishingPositions.value.split(`,`).map(e=>Number.parseInt(e.trim())).filter(e=>!Number.isNaN(e));e.onUpdateEdge(o.id,{finishingPositions:n})}})),ui(u,g,_),h&&s&&u.appendChild(i(o,s,a)),!n){let t=document.createElement(`button`);t.className=`sp-btn sp-btn--danger sp-btn--full`,t.style.marginTop=`12px`,t.textContent=`Delete Link`,t.onclick=()=>e.onDeleteEdge(o.id),u.appendChild(t)}t.appendChild(u)}return{element:t,update:a}}var{MAIN:AA,QUALIFYING:jA,CONSOLATION:MA,WINNER:NA,LOSER:PA,SINGLE_ELIMINATION:FA,ROUND_ROBIN:IA,AD_HOC:LA}=t.drawDefinitionConstants,RA=`POSITION`;function zA(e){let t=[],n=BA(e,t);return HA(e,VA(e),t),UA(e,t),WA(e,t),GA(e,t),KA(e,n,t),qA(e,t),JA(e,t),XA(e,t),ZA(e,t),QA(e)&&t.push({severity:`error`,message:`Circular dependency detected between structures`}),t}function BA(e,t){let n=e.nodes.filter(e=>e.stage===AA);return n.length===0?t.push({severity:`error`,message:`A main draw structure is required`}):n.length>1&&t.push({severity:`error`,message:`Only one main draw structure is allowed`}),n}function VA(e){let t=new Set;for(let n of e.edges)n.linkType===NA&&(n.targetRoundNumber||1)>1&&e.nodes.find(e=>e.id===n.sourceNodeId)?.stage===jA&&t.add(n.targetNodeId);let n=new Map;for(let t of e.edges)t.linkType===PA&&n.set(t.targetNodeId,(n.get(t.targetNodeId)||0)+1);for(let[e,r]of n)r>1&&t.add(e);return t}function HA(e,t,n){for(let r of e.nodes){if(r.structureType===FA&&!t.has(r.id)){let t=e.edges.some(e=>e.targetNodeId===r.id);(r.stage===AA||r.stage===jA)&&!t&&(r.drawSize>0&&!(r.drawSize&r.drawSize-1)||n.push({severity:`error`,message:`"${r.structureName}" draw size must be a power of 2`,nodeId:r.id}))}let i=r.structureType===LA?0:2;r.drawSize<i&&n.push({message:`"${r.structureName}" draw size must be at least ${i}`,severity:`error`,nodeId:r.id})}}function UA(e,t){for(let n of e.edges){let r=e.nodes.find(e=>e.id===n.sourceNodeId),i=e.nodes.find(e=>e.id===n.targetNodeId);if(r||t.push({severity:`error`,message:`Edge references missing source node`,edgeId:n.id}),i||t.push({severity:`error`,message:`Edge references missing target node`,edgeId:n.id}),r&&n.sourceRoundNumber){let e=UO(r.structureType,r.drawSize,r.structureOptions);(n.sourceRoundNumber>e||n.sourceRoundNumber<1)&&t.push({severity:`warning`,message:`Edge source round ${n.sourceRoundNumber} is outside "${r.structureName}" range (1-${e})`,edgeId:n.id})}if(i&&n.targetRoundNumber){let e=UO(i.structureType,i.drawSize,i.structureOptions);(n.targetRoundNumber>e||n.targetRoundNumber<1)&&t.push({severity:`warning`,message:`Edge target round ${n.targetRoundNumber} is outside "${i.structureName}" range (1-${e})`,edgeId:n.id})}}}function WA(e,t){let n=new Map;for(let t of e.edges)t.linkType===NA&&(n.has(t.sourceNodeId)||n.set(t.sourceNodeId,[]),n.get(t.sourceNodeId).push(t.id));for(let[r,i]of n)if(i.length>1){let n=e.nodes.find(e=>e.id===r)?.structureName||`Unknown`;for(let e of i)t.push({severity:`error`,message:`"${n}" has multiple winner links (only one allowed)`,edgeId:e})}}function GA(e,t){let n=new Map;for(let t of e.edges)t.sourceRoundNumber&&(n.has(t.sourceNodeId)||n.set(t.sourceNodeId,[]),n.get(t.sourceNodeId).push({round:t.sourceRoundNumber,edgeId:t.id}));for(let[r,i]of n){let n=new Map,a=e.nodes.find(e=>e.id===r)?.structureName||`Unknown`;for(let{round:e,edgeId:r}of i)n.has(e)?t.push({severity:`error`,message:`"${a}" has multiple links from round ${e}`,edgeId:r}):n.set(e,r)}}function KA(e,t,n){let r=e.nodes.filter(e=>e.stage===jA);for(let i of r){let r=e.edges.find(e=>e.sourceNodeId===i.id&&e.linkType===NA&&t.some(t=>t.id===e.targetNodeId));if(r||n.push({severity:`warning`,message:`Qualifying structure "${i.structureName}" has no winner link to a main structure`,nodeId:i.id}),r?.qualifyingPositions){let e=Math.floor(i.drawSize/2);r.qualifyingPositions>e&&n.push({severity:`warning`,message:`Qualifying positions (${r.qualifyingPositions}) exceeds half of "${i.structureName}" draw size (${e})`,edgeId:r.id})}}}function qA(e,t){let n=new Map;for(let t of e.edges){if(t.linkType!==NA)continue;let r=t.targetRoundNumber||1;if(r<=1)continue;let i=e.nodes.find(e=>e.id===t.sourceNodeId);if(!i||i.stage!==jA)continue;n.has(t.targetNodeId)||n.set(t.targetNodeId,[]);let a=i.qualifyingPositions||Math.floor(i.drawSize/4);n.get(t.targetNodeId).push({edgeId:t.id,targetRound:r,qp:a,sourceName:i.structureName})}for(let[r,i]of n){let n=e.nodes.find(e=>e.id===r);if(!n)continue;let a=RO(n.drawSize),o=new Map;for(let e of i)o.set(e.targetRound,(o.get(e.targetRound)||0)+e.qp);for(let{edgeId:e,targetRound:s,sourceName:c}of i)(a.get(s)||0)<(o.get(s)||0)&&t.push({severity:`warning`,message:`"${n.structureName}" round ${s} is not a feed round or has insufficient capacity for ${c} link`,nodeId:r,edgeId:e})}}function JA(e,t){for(let n of e.edges){if(n.linkType!==PA)continue;let r=e.nodes.find(e=>e.id===n.sourceNodeId),i=e.nodes.find(e=>e.id===n.targetNodeId);if(!r||!i)continue;let a=n.sourceRoundNumber||1,o=n.targetRoundNumber||1,s=WO(r.structureType,r.drawSize,a),c=RO(i.drawSize);o!==1&&YA(c,o,s,r,i,a,n.id,t)}}function YA(e,t,n,r,i,a,o,s){let c=e.get(t);c===void 0?s.push({severity:`error`,message:`"${i.structureName}" R${t} is not a feed round — cannot receive ${n} losers from "${r.structureName}" R${a}`,edgeId:o}):n>c?s.push({severity:`error`,message:`"${r.structureName}" R${a} produces ${n} losers but "${i.structureName}" R${t} only has ${c} feed positions`,edgeId:o}):n<c&&s.push({severity:`warning`,message:`"${r.structureName}" R${a} produces ${n} losers but "${i.structureName}" R${t} has ${c} feed positions — ${c-n} will be empty`,edgeId:o})}function XA(e,t){let n=e.nodes.filter(e=>e.stage===MA);for(let r of n){let n=e.edges.filter(e=>e.targetNodeId===r.id);if(n.length===0)continue;let i=0;for(let t of n){let n=e.nodes.find(e=>e.id===t.sourceNodeId);if(n)if(t.linkType===PA){let e=t.sourceRoundNumber||1;i+=WO(n.structureType,n.drawSize,e)}else i+=n.qualifyingPositions||Math.floor(n.drawSize/2)}i>0&&r.drawSize>i&&t.push({severity:`warning`,message:`"${r.structureName}" draw size (${r.drawSize}) exceeds inbound capacity (${i})`,nodeId:r.id}),i>0&&i>r.drawSize&&t.push({severity:`error`,message:`"${r.structureName}" receives ${i} participants but only has ${r.drawSize} positions`,nodeId:r.id})}}function ZA(e,t){let n=new Map;for(let r of e.edges){if(r.linkType!==RA)continue;n.has(r.sourceNodeId)||n.set(r.sourceNodeId,[]),n.get(r.sourceNodeId).push({edgeId:r.id,positions:r.finishingPositions||[]});let i=e.nodes.find(e=>e.id===r.sourceNodeId);if(i&&i.structureType===IA){let e=i.structureOptions?.groupSize||4;for(let n of r.finishingPositions||[])(n<1||n>e)&&t.push({severity:`error`,message:`Position ${n} is outside valid range (1-${e}) for "${i.structureName}"`,edgeId:r.id})}}for(let[r,i]of n){if(i.length<2)continue;let n=e.nodes.find(e=>e.id===r)?.structureName||`Unknown`,a=new Map;for(let{edgeId:e,positions:r}of i)for(let i of r)a.has(i)?t.push({severity:`warning`,message:`Position ${i} from "${n}" is used by multiple POSITION links`,edgeId:e}):a.set(i,e)}}function QA(e){let t=new Map;for(let n of e.nodes)t.set(n.id,[]);for(let n of e.edges){let e=t.get(n.sourceNodeId);e&&e.push(n.targetNodeId)}let n=new Set,r=new Set;function i(e){if(r.has(e))return!0;if(n.has(e))return!1;n.add(e),r.add(e);for(let n of t.get(e)||[])if(i(n))return!0;return r.delete(e),!1}for(let t of e.nodes)if(i(t.id))return!0;return!1}var{MAIN:$A,QUALIFYING:ej,CONSOLATION:tj,PLAY_OFF:nj,LUCKY_DRAW:rj}=t.drawDefinitionConstants;function ij(e,t,n={}){let r=document.createElement(`div`);r.className=`tb-toolbar-wrapper`;let i=document.createElement(`div`);i.className=`tb-toolbar-row`;let a=document.createElement(`div`);a.style.flex=`1`,a.style.minWidth=`0`,i.appendChild(a),r.appendChild(i);let o=document.createElement(`div`);o.className=`tb-validation`,o.style.display=`none`,r.appendChild(o);let s=null,c=()=>{if(!s)return;let e=zA(s);if(o.innerHTML=``,e.length===0){o.style.display=`block`;let e=document.createElement(`div`);e.className=`tb-validation-item`,e.innerHTML=`<span style="color:var(--chc-status-success)">&#10003; Valid topology</span>`,o.appendChild(e)}else{o.style.display=`block`;for(let t of e){let e=document.createElement(`div`);e.className=`tb-validation-item`;let n=document.createElement(`span`);n.className=`tb-validation-icon tb-validation-icon--${t.severity}`,n.textContent=t.severity===`error`?`!`:`?`;let r=document.createElement(`span`);r.textContent=t.message,e.appendChild(n),e.appendChild(r),o.appendChild(e)}}setTimeout(()=>{o.style.display=`none`},5e3)},l=[];if(!n.readOnly){let t=[{label:`Main`,value:$A,onClick:()=>e.onAddStructure($A),close:!0},{label:`Lucky Draw`,value:rj,onClick:()=>e.onAddStructure($A,rj),close:!0},{label:`Qualifying`,value:ej,onClick:()=>e.onAddStructure(ej),close:!0},{label:`Consolation`,value:tj,onClick:()=>e.onAddStructure(tj),close:!0},{label:`Playoff`,value:nj,onClick:()=>e.onAddStructure(nj),close:!0}];l.push({label:`Add Structure`,location:`right`,options:t})}if(!n.hideTemplates&&t.length>0){let n=t.map(n=>({label:n.name,value:n.name,onClick:()=>{let r=t.find(e=>e.name===n.name);r&&e.onLoadTemplate(r)},close:!0}));l.push({label:`Templates`,location:`right`,options:n})}!n.readOnly&&e.onClear&&l.push({label:`Clear`,location:`right`,onClick:()=>e.onClear()}),n.readOnly||l.push({label:`Auto Layout`,location:`right`,onClick:()=>e.onAutoLayout()},{label:`Validate`,location:`right`,onClick:()=>c()}),!n.readOnly&&e.onSaveTemplate&&l.push({label:`Save Template`,location:`right`,intent:`is-success`,onClick:()=>e.onSaveTemplate()}),!n.readOnly&&!n.hideGenerate&&l.push({label:`Generate Draw`,location:`right`,intent:`is-success`,onClick:()=>e.onGenerate()}),IC({target:a,items:l});function u(e){s=e}return{element:r,update:u}}function aj({toolbar:e,canvas:t,nodeEditor:n,edgeEditor:r}){let i=document.createElement(`div`);i.className=`tb-layout`,i.appendChild(e.element);let a=document.createElement(`div`);a.className=`tb-body`,a.appendChild(t.element);let o=document.createElement(`div`);o.className=`tb-editor`,o.appendChild(n.element),o.appendChild(r.element),a.appendChild(o),i.appendChild(a);function s(i){if(e.update(i),t.update(i),n.element.style.display=i.selectedNodeId?``:`none`,r.element.style.display=i.selectedEdgeId?``:`none`,!i.selectedNodeId&&!i.selectedEdgeId){if(!o.querySelector(`.tb-editor-empty`)){let e=document.createElement(`div`);e.className=`tb-editor-empty`,e.textContent=`Select a structure or link to view properties`,o.appendChild(e)}}else{let e=o.querySelector(`.tb-editor-empty`);e&&e.remove()}n.update(i),r.update(i)}function c(){e.destroy?.(),t.destroy?.(),n.destroy?.(),r.destroy?.()}return{element:i,update:s,destroy:c}}var{SINGLE_ELIMINATION:oj,FEED_IN:sj,ROUND_ROBIN:cj,LUCKY_DRAW:lj,MAIN:uj,QUALIFYING:dj,CONSOLATION:fj,PLAY_OFF:pj}=t.drawDefinitionConstants,mj=`WINNER`,hj=`LOSER`,gj=`POSITION`,_j=`tpl-edge-1`,vj=`tpl-edge-2`,yj=`tpl-edge-3`,bj=`tpl-edge-4`,xj=`tpl-edge-5`,Sj=`tpl-edge-6`,Cj=`tpl-edge-7`,wj=`R1 losers → R1`,Tj=[{name:`Single Elimination + Qualifying`,description:`Standard SE main draw with one qualifying structure`,state:{drawName:`SE + Qualifying`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:oj,drawSize:32,position:{x:320,y:40}},{id:`tpl-qual`,structureName:`Qualifying`,stage:dj,structureType:oj,drawSize:16,qualifyingPositions:4,position:{x:40,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-qual`,targetNodeId:`tpl-main`,linkType:mj,targetRoundNumber:1,qualifyingPositions:4,label:`winners → R1 (4Q)`}]}},{name:`FMLC (First Match Loser Consolation)`,description:`Main draw with first match loser consolation`,state:{drawName:`FMLC`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:oj,drawSize:32,position:{x:40,y:40}},{id:`tpl-cons`,structureName:`Consolation`,stage:fj,structureType:oj,drawSize:16,position:{x:320,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj}]}},{name:`Feed-In Championship (FIC)`,description:`Main draw with multi-round fed consolation`,state:{drawName:`FIC`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:oj,drawSize:32,position:{x:40,y:40}},{id:`tpl-cons`,structureName:`Consolation`,stage:fj,structureType:sj,drawSize:31,position:{x:460,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj},{id:vj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:2,targetRoundNumber:2,label:`R2 losers → R2`},{id:yj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:3,targetRoundNumber:4,label:`R3 losers → R4`},{id:bj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:4,targetRoundNumber:6,label:`R4 losers → R6`},{id:xj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:5,targetRoundNumber:8,label:`R5 losers → R8`}]}},{name:`Compass`,description:`8-draw compass structure`,state:{drawName:`Compass`,nodes:[{id:`tpl-east`,structureName:`East`,stage:uj,structureType:oj,drawSize:32,position:{x:40,y:40}},{id:`tpl-west`,structureName:`West`,stage:fj,structureType:oj,drawSize:16,position:{x:400,y:40}},{id:`tpl-north`,structureName:`North`,stage:fj,structureType:oj,drawSize:8,position:{x:400,y:210}},{id:`tpl-ne`,structureName:`Northeast`,stage:fj,structureType:oj,drawSize:4,position:{x:400,y:380}},{id:`tpl-south`,structureName:`South`,stage:fj,structureType:oj,drawSize:8,position:{x:680,y:40}},{id:`tpl-sw`,structureName:`Southwest`,stage:fj,structureType:oj,drawSize:4,position:{x:680,y:210}},{id:`tpl-nw`,structureName:`Northwest`,stage:fj,structureType:oj,drawSize:4,position:{x:680,y:380}},{id:`tpl-se`,structureName:`Southeast`,stage:fj,structureType:oj,drawSize:4,position:{x:960,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-east`,targetNodeId:`tpl-west`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj},{id:vj,sourceNodeId:`tpl-east`,targetNodeId:`tpl-north`,linkType:hj,sourceRoundNumber:2,targetRoundNumber:1,label:`R2 losers → R1`},{id:yj,sourceNodeId:`tpl-east`,targetNodeId:`tpl-ne`,linkType:hj,sourceRoundNumber:3,targetRoundNumber:1,label:`R3 losers → R1`},{id:bj,sourceNodeId:`tpl-west`,targetNodeId:`tpl-south`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj},{id:xj,sourceNodeId:`tpl-west`,targetNodeId:`tpl-sw`,linkType:hj,sourceRoundNumber:2,targetRoundNumber:1,label:`R2 losers → R1`},{id:Sj,sourceNodeId:`tpl-north`,targetNodeId:`tpl-nw`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj},{id:Cj,sourceNodeId:`tpl-south`,targetNodeId:`tpl-se`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj}]}},{name:`Round Robin + Playoff`,description:`Round robin groups with winners and consolation playoffs`,state:{drawName:`RR + Playoff`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:cj,drawSize:16,structureOptions:{groupSize:4},position:{x:40,y:40}},{id:`tpl-playoff-gold`,structureName:`Gold Flight`,stage:pj,structureType:oj,drawSize:8,position:{x:320,y:40}},{id:`tpl-playoff-silver`,structureName:`Silver Flight`,stage:pj,structureType:oj,drawSize:8,position:{x:320,y:220}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-playoff-gold`,linkType:gj,finishingPositions:[1,2],label:`positions 1,2`},{id:vj,sourceNodeId:`tpl-main`,targetNodeId:`tpl-playoff-silver`,linkType:gj,finishingPositions:[3,4],label:`positions 3,4`}]}},{name:`Lucky Draw + Consolation`,description:`Lucky draw main with consolation receiving R1 losers`,state:{drawName:`Lucky + Consolation`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:lj,drawSize:11,position:{x:40,y:40}},{id:`tpl-cons`,structureName:`Consolation`,stage:fj,structureType:oj,drawSize:4,position:{x:340,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj}]}},{name:`Lucky Draw → Round Robin`,description:`Lucky draw main with R1 losers feeding into round robin consolation`,state:{drawName:`Lucky → RR`,nodes:[{id:`tpl-main`,structureName:`Main Draw`,stage:uj,structureType:lj,drawSize:25,position:{x:40,y:40}},{id:`tpl-cons-rr`,structureName:`Consolation RR`,stage:fj,structureType:cj,drawSize:12,structureOptions:{groupSize:4},position:{x:500,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-main`,targetNodeId:`tpl-cons-rr`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:wj}]}},{name:`Adaptive (drawSize 11)`,description:`Compass-like multi-structure topology with lucky draw structures`,state:{drawName:`Adaptive`,nodes:[{id:`tpl-east`,structureName:`East`,stage:uj,structureType:lj,drawSize:11,position:{x:40,y:40}},{id:`tpl-west`,structureName:`West`,stage:fj,structureType:lj,drawSize:6,position:{x:340,y:40}},{id:`tpl-north`,structureName:`North`,stage:fj,structureType:oj,drawSize:2,position:{x:340,y:250}},{id:`tpl-south`,structureName:`South`,stage:fj,structureType:oj,drawSize:2,position:{x:600,y:40}}],edges:[{id:_j,sourceNodeId:`tpl-east`,targetNodeId:`tpl-west`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:`R1 losers → R1 (6 losers)`},{id:vj,sourceNodeId:`tpl-east`,targetNodeId:`tpl-north`,linkType:hj,sourceRoundNumber:2,targetRoundNumber:1,label:`R2 losers → R1 (2 losers)`},{id:yj,sourceNodeId:`tpl-west`,targetNodeId:`tpl-south`,linkType:hj,sourceRoundNumber:1,targetRoundNumber:1,label:`R1 losers → R1 (2 losers)`}]}}],{MAIN:Ej,QUALIFYING:Dj,CONSOLATION:Oj,PLAY_OFF:kj,SINGLE_ELIMINATION:Aj,LUCKY_DRAW:jj,WINNER:Mj,LOSER:Nj}=t.drawDefinitionConstants,Pj=`POSITION`,Fj=class{constructor(e={}){this.config=e,this.store=new Pk(e.initialState);let t=[...Tj,...e.templates||[]],n=!!e.readOnly,r=this.buildToolbarPanel(t,n),i=this.buildCanvasPanel(n),a=_A({onUpdateNode:n?()=>{}:(e,t)=>this.store.updateNode(e,t),onUpdateEdge:n?()=>{}:(e,t)=>this.store.updateEdge(e,t),onDeleteNode:n?()=>{}:e=>this.store.removeNode(e),readOnly:n,hideDelete:e.hideDelete}),o=kA({onUpdateEdge:n?()=>{}:(e,t)=>this.store.updateEdge(e,t),onDeleteEdge:n?()=>{}:e=>this.store.removeEdge(e),readOnly:n});this.layout=aj({toolbar:r,canvas:i,nodeEditor:a,edgeEditor:o}),this.unsubscribe=this.store.subscribe(e=>{this.layout.update(e)}),this.layout.update(this.store.getState())}buildToolbarPanel(e,t){return ij({onAddStructure:(e,t)=>this.addDefaultStructure(e,t),onLoadTemplate:e=>{this.store.loadState({...e.state,selectedNodeId:null,selectedEdgeId:null,templateName:e.name})},onAutoLayout:()=>{this.store.autoLayout();let e=this.store.getState();this.store.loadState(e)},onGenerate:()=>this.handleGenerate(),onSaveTemplate:this.config.onSaveTemplate?()=>this.config.onSaveTemplate(this.store.getState()):void 0,onClear:this.config.onClear},e,{hideTemplates:this.config.hideTemplates,hideGenerate:this.config.hideGenerate,readOnly:t})}buildCanvasPanel(e){return Gk({onSelectNode:e=>this.store.selectNode(e),onSelectEdge:e=>this.store.selectEdge(e),onDoubleClickNode:this.config.onDoubleClickNode?e=>{let t=this.store.getState(),n=t.nodes.find(t=>t.id===e);n&&this.config.onDoubleClickNode(n,t)}:void 0,onMoveNode:(e,t,n)=>this.store.updateNode(e,{position:{x:t,y:n}}),onCreateEdge:e?()=>{}:(e,t,n)=>{this.handleCreateEdge(e,t,n)},onPortMouseDown:()=>{}})}handleCreateEdge(e,t,n){let r=this.store.getState().nodes.find(t=>t.id===e);if(n===Pj){let i=this.store.getState().edges.filter(t=>t.sourceNodeId===e&&t.linkType===Pj),a=new Set(i.flatMap(e=>e.finishingPositions||[])),o=r?.structureOptions?.groupSize||4,s=1;for(let e=1;e<=o;e++)if(!a.has(e)){s=e;break}this.store.addEdge({sourceNodeId:e,targetNodeId:t,linkType:n,finishingPositions:[s]})}else if(n===Nj){let i=this.store.getState().edges.filter(t=>t.sourceNodeId===e&&t.linkType===Nj),a=new Set(i.map(e=>e.sourceRoundNumber)),o=r?UO(r.structureType,r.drawSize,r.structureOptions):1,s=1;for(let e=1;e<=o;e++)if(!a.has(e)){s=e;break}this.store.addEdge({sourceNodeId:e,targetNodeId:t,linkType:n,sourceRoundNumber:s})}else{let i=n===Mj&&r?.stage===Dj;this.store.addEdge({sourceNodeId:e,targetNodeId:t,linkType:n,...i&&{targetRoundNumber:1}})}}render(e){e.appendChild(this.layout.element)}destroy(){this.unsubscribe(),this.layout.destroy?.(),this.layout.element.remove()}autoLayout(){this.store.autoLayout();let e=this.store.getState();this.store.loadState(e)}getState(){return this.store.getState()}loadState(e){this.store.loadState(e)}addDefaultStructure(e,t){let n=t===jj,r=this.store.getState().nodes.filter(t=>t.stage===e).length,i={[Ej]:n?`Lucky Draw`:`Main Draw`,[Dj]:`Qualifying ${r+1}`,[Oj]:`Consolation`,[kj]:`Playoff ${r+1}`},a={[Ej]:n?11:32,[Dj]:16,[Oj]:16,[kj]:4}[e]||16,o=this.store.addNode({structureName:i[e]||e,stage:e,structureType:t||Aj,drawSize:a,...e===Dj&&{qualifyingPositions:Math.floor(a/4)}});this.scrollCanvasToNode(o)}scrollCanvasToNode(e){let t=this.layout.element.querySelector(`.tb-canvas`);t&&requestAnimationFrame(()=>{let n=e.position.x+_k(e)+40;n>t.scrollLeft+t.clientWidth&&t.scrollTo({left:n-t.clientWidth,behavior:`smooth`})})}handleGenerate(){let e=this.store.getState(),t=zA(e);t.some(e=>e.severity===`error`)&&console.warn(`Topology validation errors:`,t),this.config.onGenerate&&this.config.onGenerate(e)}},{MAIN:Ij,CONSOLATION:Lj,QUALIFYING:Rj,PLAY_OFF:zj,SINGLE_ELIMINATION:Bj,FEED_IN:Vj,FIRST_MATCH_LOSER_CONSOLATION:Hj,FEED_IN_CHAMPIONSHIP:Uj,COMPASS:Wj,WINNER:Gj,LOSER:Kj,ROUND_ROBIN:qj,AD_HOC:Jj,LUCKY_DRAW:Yj}=t.drawDefinitionConstants,Xj=`POSITION`;function Zj(e,t){let n=e.nodes.filter(e=>e.stage===Lj),r=e.nodes.filter(e=>e.stage===Rj),i=e.nodes.filter(e=>e.stage===zj);if(t.structureType===qj)return e.edges.some(n=>n.sourceNodeId===t.id&&n.linkType===Xj&&e.nodes.some(e=>e.id===n.targetNodeId&&e.stage===zj))?`ROUND_ROBIN_WITH_PLAYOFF`:qj;if(t.structureType===Jj)return Jj;if(t.structureType===Vj)return Vj;if(t.structureType===Yj)return Yj;if(n.length===7&&r.length===0&&i.length===0){let n=e.edges.filter(e=>e.linkType===Kj&&e.sourceNodeId===t.id),r=new Set(n.map(e=>e.sourceRoundNumber));if(r.has(1)&&r.has(2)&&r.has(3))return Wj}if(n.length===1&&r.length===0&&i.length===0){let r=n[0],i=e.edges.filter(e=>e.linkType===Kj&&e.sourceNodeId===t.id&&e.targetNodeId===r.id);if(r.structureType===Vj||i.length>1)return Uj;if(i.length===1&&i[0].sourceRoundNumber===1)return Hj}return Bj}function Qj(e){let t=e.nodes.find(e=>e.stage===Ij);if(!t)throw Error(`No main structure node found`);let n=e.nodes.filter(e=>e.stage===Rj),r=e.nodes.filter(e=>e.stage===zj),i=Zj(e,t);i===Bj&&!rM(t.drawSize)&&(i=Vj);let a={drawName:e.drawName,drawType:i,drawSize:t.drawSize,matchUpFormat:t.matchUpFormat||void 0,structureOptions:t.structureOptions||void 0,automated:!0};n.length>0&&tM(a,n,e.edges);let o=[];return $j(e,t,i,o),eM(e,t,r,a),{drawOptions:a,postGenerationMethods:o}}function $j(e,t,n,r){let i=e.nodes.filter(e=>e.stage===Lj),a=e.edges.filter(e=>e.linkType===Kj&&e.sourceNodeId===t.id&&i.some(t=>t.id===e.targetNodeId)),o=[Hj,Uj,Wj];if(a.length===0||o.includes(n))return;let s=new Map;for(let e of a)s.has(e.targetNodeId)||s.set(e.targetNodeId,[]),s.get(e.targetNodeId).push(e);for(let[e,t]of s){let n=i.find(t=>t.id===e);if(!n)continue;let a=t.map(e=>({sourceRoundNumber:e.sourceRoundNumber||1,targetRoundNumber:e.targetRoundNumber||1}));r.push({method:`attachConsolationStructures`,params:{structureName:n.structureName,structureType:n.structureType,drawSize:n.drawSize,matchUpFormat:n.matchUpFormat||void 0,structureOptions:n.structureOptions||void 0,links:a}})}}function eM(e,t,n,r){let i=t.structureType===qj,a=i?e.edges.filter(e=>e.sourceNodeId===t.id&&e.linkType===Xj&&n.some(t=>t.id===e.targetNodeId)):[];if(i&&a.length>0){let e=new Map;for(let t of a)e.has(t.targetNodeId)||e.set(t.targetNodeId,[]),e.get(t.targetNodeId).push(t);let t=[];for(let[r,i]of e){let e=n.find(e=>e.id===r);if(!e)continue;let a=Array.from(new Set(i.flatMap(e=>e.finishingPositions||[]))).sort((e,t)=>e-t),o=e.structureOptions?.playoffDrawType||Bj,s={finishingPositions:a,structureName:e.structureName,drawType:o};o===qj&&e.structureOptions?.groupSize&&(s.structureOptions={groupSize:e.structureOptions.groupSize}),t.push(s)}t.length>0&&(r.structureOptions={...r.structureOptions,playoffGroups:t})}else if(n.length>0){let i=nM(t.id,n,e.edges);i&&(r.withPlayoffs=i)}}function tM(e,t,n){let r=n.filter(e=>e.linkType===Gj&&t.some(t=>t.id===e.sourceNodeId)),i={};for(let e of t){let t=r.find(t=>t.sourceNodeId===e.id),n=t?.targetRoundNumber||1;i[n]||(i[n]=[]),i[n].push({node:e,edge:t})}let a=0;e.qualifyingProfiles=Object.entries(i).map(([e,t])=>{let n=t.map(({node:e,edge:t})=>{let n=e.qualifyingPositions||t?.qualifyingPositions||Math.floor(e.drawSize/4);return a+=n,{structureName:e.structureName,drawType:e.structureType,drawSize:e.drawSize,qualifyingPositions:n,seedsCount:0}});return{roundTarget:Number(e),structureProfiles:n}}),e.qualifiersCount=a,e.qualifyingPlaceholder=!0}function nM(e,t,n){let r=n.filter(n=>n.sourceNodeId===e&&n.linkType===Kj&&t.some(e=>e.id===n.targetNodeId));if(!r.length)return;let i=[],a={},o={};for(let e of r){if(!e.sourceRoundNumber)continue;let r=t.find(t=>t.id===e.targetNodeId);if(!r)continue;i.push({[e.sourceRoundNumber]:1});let s=`0-${i.length}`;a[s]={name:r.structureName,abbreviation:r.structureName.substring(0,3)};let c=nM(r.id,t,n);c&&(o[e.sourceRoundNumber]=c)}if(i.length)return{roundProfiles:i,...Object.keys(a).length>0&&{playoffAttributes:a},...Object.keys(o).length>0&&{roundPlayoffs:o}}}function rM(e){return e>0&&(e&e-1)==0}var{MAIN:iM}=t.drawDefinitionConstants,aM=()=>`spl-layout`,oM=()=>`spl-left`,sM=()=>`spl-toggle`,cM=()=>`spl-center`,lM=()=>`spl-center-header`,uM=()=>`spl-center-title`,dM=()=>`spl-center-meta`,fM=()=>`spl-grid-slot`,pM=()=>`spl-right`,mM=()=>`spl-matchup-card`,hM=()=>`spl-card-title`,gM=()=>`spl-card-sides`,_M=()=>`spl-card-meta`,vM=()=>`spl-card-chips`,yM=()=>`spl-card-chip`,bM=()=>`sp-panel`,xM=()=>`sp-panel-header`,SM=()=>`sp-panel-title`,CM=()=>`sp-panel-meta`,wM=()=>`sp-date-strip`,TM=()=>`sp-date-chip`,EM=()=>`sp-badges`,DM=()=>`sp-catalog`,OM=()=>`sp-catalog-toolbar`,kM=()=>`sp-input`,AM=()=>`sp-select`,jM=()=>`sp-group`,MM=()=>`sp-group-header`,NM=()=>`sp-group-body`,PM=()=>`sp-group-chevron`,FM=()=>`sp-issues`,IM=()=>`sp-issue`,LM=()=>`sp-issue-code`,RM=()=>`sp-issue-msg`,zM=()=>`sp-inspector`,BM=()=>`sp-kv`,VM=()=>`sp-kv-key`,HM=()=>`sp-kv-value`,UM=()=>`sp-small`;function WM(e,t,n){let r=!!n?.hideLeft,i=n?.catalogSide===`left`,a=document.createElement(`div`);a.className=aM();let o=null,s=null;if(r)i?a.classList.add(`spl-catalog-left`):a.classList.add(`spl-no-left`);else{o=document.createElement(`div`),o.className=oM(),s=document.createElement(`button`),s.className=sM(),s.textContent=`◀`,s.title=`Toggle sidebar`,s.addEventListener(`click`,()=>t.onToggleLeft()),o.appendChild(s);let n=document.createElement(`div`);n.className=`spl-left-content`,n.style.cssText=`display:flex;flex-direction:column;gap:12px;flex:1;min-height:0`,e.dateStrip.element.style.flex=`1`,e.dateStrip.element.style.minHeight=`0`,e.dateStrip.element.style.overflow=`auto`,n.appendChild(e.dateStrip.element),e.issuesPanel.element.style.flex=`1`,e.issuesPanel.element.style.minHeight=`0`,e.issuesPanel.element.style.overflow=`auto`,n.appendChild(e.issuesPanel.element),o.appendChild(n)}let c=e.courtGridSlot.element,l=document.createElement(`div`);l.className=pM(),e.matchUpCatalog.element.style.flex=`3`,e.matchUpCatalog.element.style.minHeight=`0`,e.matchUpCatalog.element.style.overflow=`auto`,l.appendChild(e.matchUpCatalog.element),e.inspectorPanel.element.style.flex=`1`,e.inspectorPanel.element.style.minHeight=`120px`,e.inspectorPanel.element.style.overflow=`auto`,l.appendChild(e.inspectorPanel.element),o&&a.appendChild(o),i&&r?(a.appendChild(l),a.appendChild(c)):(a.appendChild(c),a.appendChild(l));function u(t){r||(t.leftCollapsed?(a.classList.add(`spl-left-collapsed`),s&&(s.textContent=`▶`)):(a.classList.remove(`spl-left-collapsed`),s&&(s.textContent=`◀`)),e.dateStrip.update(t),e.issuesPanel.update(t)),e.courtGridSlot.update(t),e.matchUpCatalog.update(t),e.inspectorPanel.update(t)}return{element:a,update:u}}function GM(e){let t=e.sides;if(t?.length===2){let e=KM(t[0]),n=KM(t[1]);if(e&&n)return`${e} vs ${n}`;if(e)return`${e} vs TBD`;if(n)return`TBD vs ${n}`}return`TBD vs TBD`}function KM(e){return e?`${e.participantName??``}${e.seedNumber?` [${e.seedNumber}]`:``}`:``}function qM(e){let t=[e.eventName,e.drawName??``,e.roundName??``];if(e.sides)for(let n of e.sides)n.participantName&&t.push(n.participantName);return t.join(` `).toLowerCase()}function JM(){let e=document.createElement(`div`);e.className=bM();let t=document.createElement(`div`);t.className=xM();let n=document.createElement(`div`);n.className=SM(),n.textContent=`Inspector`,t.appendChild(n),e.appendChild(t);let r=document.createElement(`div`);r.className=zM(),e.appendChild(r);function i(e){r.innerHTML=``;let t=e.selectedMatchUp;if(!t){let e=document.createElement(`div`);e.className=UM(),e.textContent=`Select a matchUp in the catalog to see details.`,r.appendChild(e);return}if(YM(r,`Event`,t.eventName),YM(r,`Draw`,t.drawName??t.drawId),YM(r,`Round`,t.roundName??`Round ${t.roundNumber}`),YM(r,`Type`,t.matchUpType??`—`),YM(r,`Format`,t.matchUpFormat??`—`),YM(r,`Scheduled`,t.isScheduled?`Yes`:`No`),t.scheduledTime&&YM(r,`Time`,t.scheduledTime),t.scheduledCourtName&&YM(r,`Court`,t.scheduledCourtName),t.sides?.length){let e=document.createElement(`div`);e.className=UM(),e.style.marginTop=`8px`,e.textContent=`Participants:`,r.appendChild(e);let n=document.createElement(`div`);n.className=`spl-inspector-sides`;for(let e of t.sides){let t=document.createElement(`div`);t.className=`spl-inspector-side`;let r=document.createElement(`span`);if(r.textContent=KM(e)||`TBD`,t.appendChild(r),e.ranking){let n=document.createElement(`span`);n.className=`spl-inspector-seed`,n.textContent=`#${e.ranking}`,t.appendChild(n)}n.appendChild(t)}r.appendChild(n)}}return{element:e,update:i}}function YM(e,t,n){let r=document.createElement(`div`);r.className=BM();let i=document.createElement(`div`);i.className=VM(),i.textContent=t;let a=document.createElement(`div`);a.className=HM(),a.textContent=n,r.appendChild(i),r.appendChild(a),e.appendChild(r)}var XM=new Set([`COMPLETED`,`RETIRED`,`WALKOVER`,`DEFAULTED`,`DOUBLE_WALKOVER`,`DOUBLE_DEFAULT`,`CANCELLED`,`ABANDONED`,`DEAD_RUBBER`]);function ZM(e){return!!e&&XM.has(e)}function QM(e,t,n=`dim`,r,i=!1){let a=t.toLowerCase().trim();return e.filter(e=>n===`hide`&&e.isScheduled||!i&&ZM(e.matchUpStatus)||r&&(r.eventType&&e.matchUpType!==r.eventType||r.eventName&&e.eventName!==r.eventName||r.drawName&&(e.drawName??e.drawId)!==r.drawName||r.gender&&e.gender!==r.gender||r.roundName&&e.roundName!==r.roundName)?!1:a?qM(e).includes(a):!0)}function $M(e,t){let n=new Map,r=e=>t===`draw`?`${e.eventName} \u2014 ${e.drawName??e.drawId}`:t===`round`?e.roundName??`Round ${e.roundNumber}`:t===`structure`?`${e.eventName} \u2014 ${e.structureId}`:e.eventName;for(let t of e){let e=r(t),i=n.get(e);i?i.push(t):n.set(e,[t])}return new Map([...n.entries()].sort((e,t)=>e[0].localeCompare(t[0],void 0,{numeric:!0})))}function eN(e,t){let n=document.createElement(`div`);n.className=mM(),n.setAttribute(`data-matchup-id`,e.matchUpId);let r=ZM(e.matchUpStatus);e.isScheduled?(n.classList.add(`scheduled`),n.draggable=!1):r?(n.classList.add(`completed`),n.draggable=!1):(n.draggable=!0,n.addEventListener(`dragstart`,t=>{t.stopPropagation(),t.dataTransfer.setDragImage(n,n.offsetWidth/2,20),t.dataTransfer.setData(`application/json`,JSON.stringify({type:`CATALOG_MATCHUP`,matchUp:e})),t.dataTransfer.effectAllowed=`copyMove`})),t.onClick&&n.addEventListener(`click`,n=>{n.stopPropagation(),t.onClick(e)});let i=document.createElement(`div`);i.className=hM(),i.textContent=`${e.eventName} \u2014 ${e.roundName??`Round `+e.roundNumber}`,n.appendChild(i);let a=document.createElement(`div`);a.className=gM(),a.textContent=GM(e),n.appendChild(a);let o=document.createElement(`div`);o.className=_M();let s=[];e.drawName&&s.push(e.drawName),e.matchUpType&&s.push(e.matchUpType.toLowerCase()),o.textContent=s.join(` · `),n.appendChild(o);let c=document.createElement(`div`);if(c.className=vM(),e.scheduledTime&&c.appendChild(tN(e.scheduledTime,`time`)),e.scheduledCourtName&&c.appendChild(tN(e.scheduledCourtName,`court`)),e.matchUpFormat&&c.appendChild(tN(e.matchUpFormat,`type`)),r&&e.matchUpStatus){let t=e.matchUpStatus.replace(/_/g,` `);c.appendChild(tN(t,`status`))}if(c.children.length&&n.appendChild(c),e.isScheduled){let e=document.createElement(`span`);e.className=`spl-matchup-check`,e.textContent=`✓`,n.appendChild(e)}return n}function tN(e,t){let n=document.createElement(`div`);return n.className=yM()+` `+t,n.textContent=e,n}function nN(e,t){let n=new Set;for(let r of e){let e=t(r);e&&n.add(e)}return[...n].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function rN(e){let t=document.createElement(`div`);t.className=bM();let n=`spl-catalog-drop-over`,r=new Set,i=null,a,o={};t.addEventListener(`dragover`,e=>{e.preventDefault(),t.classList.add(n),e.dataTransfer.dropEffect=`move`}),t.addEventListener(`dragleave`,e=>{t.contains(e.relatedTarget)||t.classList.remove(n)}),t.addEventListener(`drop`,r=>{if(t.classList.remove(n),r.preventDefault(),!e.onDropRemove)return;let i;try{i=JSON.parse(r.dataTransfer.getData(`application/json`))}catch{return}(i.type===`CATALOG_MATCHUP`||i.type===`GRID_MATCHUP`)&&e.onDropRemove(i.matchUp.matchUpId)});let s=document.createElement(`div`);s.className=xM();let c=document.createElement(`div`);c.className=`spl-catalog-title-row`;let l=document.createElement(`div`);l.className=SM(),l.textContent=`MatchUp Catalog`;let u=document.createElement(`button`);u.className=`spl-catalog-filter-btn`,u.title=`Filter matchUps`,u.innerHTML=`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/></svg>`,c.appendChild(l),c.appendChild(u);let d=document.createElement(`div`);d.className=CM(),s.appendChild(c),s.appendChild(d),t.appendChild(s);let f=document.createElement(`div`);f.className=OM();let p=document.createElement(`input`);p.type=`text`,p.placeholder=`Search matchUps...`,p.className=kM(),p.addEventListener(`input`,()=>e.onSearchChange(p.value));let m=document.createElement(`select`);m.className=AM();for(let[e,t]of[[`event`,`By Event`],[`draw`,`By Draw`],[`round`,`By Round`],[`structure`,`By Structure`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,m.appendChild(n)}m.addEventListener(`change`,()=>e.onGroupByChange(m.value)),f.appendChild(p),f.appendChild(m),t.appendChild(f);function h(){a&&=(a.destroy(),void 0)}function g(){return!!(o.eventType||o.eventName||o.drawName||o.gender||o.roundName)}function _(){u.classList.toggle(`active`,g())}function v(){let t=i?.matchUpCatalog??[],n=document.createElement(`div`);n.className=`spl-filter-popover`;let r=document.createElement(`div`);r.className=`spl-filter-header`;let a=document.createElement(`button`);a.className=`spl-filter-clear-btn`,a.textContent=`Clear All`,a.addEventListener(`click`,t=>{t.stopPropagation(),o={},e.onFilterChange(o),_();for(let e of n.querySelectorAll(`select`))e.value=``}),r.appendChild(a);let s=document.createElement(`button`);s.className=`spl-filter-close-btn`,s.textContent=`×`,s.addEventListener(`click`,e=>{e.stopPropagation(),h()}),r.appendChild(s),n.appendChild(r);let c=[{label:`All Event Types`,key:`eventType`,values:nN(t,e=>e.matchUpType)},{label:`All Events`,key:`eventName`,values:nN(t,e=>e.eventName)},{label:`All Flights`,key:`drawName`,values:nN(t,e=>e.drawName)},{label:`All Genders`,key:`gender`,values:nN(t,e=>e.gender)},{label:`All Rounds`,key:`roundName`,values:nN(t,e=>e.roundName)}];for(let t of c){if(t.values.length<2)continue;let r=document.createElement(`label`);r.className=`spl-filter-label`,r.textContent=t.label,n.appendChild(r);let i=document.createElement(`select`);i.className=`spl-filter-select`;let a=document.createElement(`option`);a.value=``,a.textContent=t.label,i.appendChild(a);for(let e of t.values){let t=document.createElement(`option`);t.value=e,t.textContent=e,i.appendChild(t)}i.value=o[t.key]??``,i.addEventListener(`change`,()=>{o={...o,[t.key]:i.value||void 0},e.onFilterChange(o),_()}),n.appendChild(i)}let l=document.createElement(`label`);l.className=`spl-filter-toggle`;let u=document.createElement(`input`);u.type=`checkbox`,u.checked=i?.showScheduled??!1,u.addEventListener(`change`,()=>{e.onShowScheduledChange?.(u.checked)}),l.appendChild(u),l.appendChild(document.createTextNode(` Show assigned`)),n.appendChild(l);let d=document.createElement(`label`);d.className=`spl-filter-toggle`;let f=document.createElement(`input`);return f.type=`checkbox`,f.checked=i?.showCompleted??!1,f.addEventListener(`change`,()=>{e.onShowCompletedChange(f.checked)}),d.appendChild(f),d.appendChild(document.createTextNode(` Show completed`)),n.appendChild(d),n}u.addEventListener(`click`,()=>{h(),a=mm(u,{content:v(),placement:`bottom-start`,interactive:!0,trigger:`manual`,appendTo:()=>t,onClickOutside:()=>h(),theme:``}),a.show()});let y=document.createElement(`div`);y.className=DM(),t.appendChild(y);function b(t){i=t,o=t.catalogFilters??{},_();let n=t.showScheduled?t.scheduledBehavior:`hide`,a=QM(t.matchUpCatalog,t.catalogSearchQuery,n,t.catalogFilters,t.showCompleted),s=$M(a,t.catalogGroupBy);d.textContent=`${a.filter(e=>!e.isScheduled).length} unscheduled`,p.value!==t.catalogSearchQuery&&(p.value=t.catalogSearchQuery),m.value!==t.catalogGroupBy&&(m.value=t.catalogGroupBy),y.innerHTML=``;for(let[n,a]of s){let o=document.createElement(`div`);o.className=jM();let s=r.has(n),c=document.createElement(`div`);c.className=MM();let l=document.createElement(`span`);l.className=PM(),l.textContent=s?`▶`:`▼`;let u=document.createElement(`span`);u.textContent=`${n} (${a.length})`,c.appendChild(l),c.appendChild(u),c.addEventListener(`click`,()=>{r.has(n)?r.delete(n):r.add(n),i&&b(i)});let d=document.createElement(`div`);d.className=NM(),s&&(d.style.display=`none`);for(let n of a){let r=eN(n,{onClick:t=>e.onMatchUpSelected?.(t)});t.selectedMatchUp?.matchUpId===n.matchUpId&&r.classList.add(`selected`),d.appendChild(r)}o.appendChild(c),o.appendChild(d),y.appendChild(o)}}return{element:t,update:b}}function iN(e){let t={ERROR:[],WARN:[],INFO:[]},n={},r={total:e.length,ERROR:0,WARN:0,INFO:0},i={},a=e=>e===`ERROR`?0:e===`WARN`?1:2;for(let a of e)if(t[a.severity].push(a),r[a.severity]++,a.date){(n[a.date]??=[]).push(a);let e=i[a.date]??={total:0,ERROR:0,WARN:0,INFO:0};e.total++,e[a.severity]++}let o=(e,t)=>a(e.severity)-a(t.severity)||e.message.localeCompare(t.message),s=[...e].sort(o);for(let e of Object.keys(t))t[e].sort(o);for(let e of Object.keys(n))n[e].sort(o);return{all:s,bySeverity:t,byDate:n,counts:r,countsByDate:i}}var aN=`spl-cell--issue-pulse`;function oN(){let e=document.createElement(`div`);e.className=bM();let t=document.createElement(`div`);t.className=xM();let n=document.createElement(`div`);n.className=SM(),n.textContent=`Issues`;let r=document.createElement(`div`);r.className=CM(),t.appendChild(n),t.appendChild(r),e.appendChild(t);let i=document.createElement(`div`);i.className=FM(),e.appendChild(i);function a(e){let t=iN(e.issues);if(r.textContent=`${t.counts.total} total (${t.counts.ERROR} errors)`,i.innerHTML=``,!t.all.length){let e=document.createElement(`div`);e.className=UM(),e.textContent=`No scheduling conflicts.`,i.appendChild(e);return}for(let e of t.all.slice(0,30)){let t=document.createElement(`div`);t.className=IM(),e.severity===`ERROR`?t.classList.add(`error`):e.severity===`WARN`?t.classList.add(`warn`):t.classList.add(`info`);let n=document.createElement(`div`);n.className=LM(),n.textContent=e.severity;let r=document.createElement(`div`);if(r.className=RM(),e.participants){if(e.prefix){let t=document.createElement(`span`);t.textContent=e.prefix,t.style.opacity=`0.7`,r.appendChild(t)}let t=document.createElement(`span`);t.textContent=(e.issueType||``)+`: `,t.style.opacity=`0.7`,r.appendChild(t);let n=document.createElement(`span`);if(n.textContent=e.participants,n.style.color=`var(--spl-issue-participant1, #4fc3f7)`,n.style.fontWeight=`600`,r.appendChild(n),e.conflictParticipants?.length){let t=document.createElement(`span`);t.textContent=` conflicts with `,t.style.opacity=`0.7`,r.appendChild(t),e.conflictParticipants.forEach((e,t)=>{if(t>0){let e=document.createElement(`span`);e.textContent=`, `,e.style.opacity=`0.7`,r.appendChild(e)}let n=document.createElement(`span`);n.textContent=e,n.style.color=`var(--spl-issue-participant2, #ffb74d)`,n.style.fontWeight=`600`,r.appendChild(n)})}}else r.textContent=e.message;if(e.matchUpId){t.style.cursor=`pointer`;let n=e.matchUpId;t.addEventListener(`click`,()=>{console.log(`[issuesPanel] clicked issue row, matchUpId:`,n),o(n)})}else console.log(`[issuesPanel] issue has no matchUpId:`,e.message);t.appendChild(n),t.appendChild(r),i.appendChild(t)}}function o(e){let t=`.spl-grid-cell[data-matchup-id="${e}"]`,n=document.querySelector(t);console.log(`[issuesPanel] scrollToMatchUp selector:`,t,`found:`,!!n),n&&(n.scrollIntoView({behavior:`smooth`,block:`center`,inline:`center`}),n.classList.remove(aN),n.offsetWidth,n.classList.add(aN),n.addEventListener(`animationend`,()=>n.classList.remove(aN),{once:!0}))}return{element:e,update:a}}function sN(e){let t=document.createElement(`div`);t.className=bM();let n=document.createElement(`div`);n.className=xM();let r=document.createElement(`div`);r.className=SM(),r.textContent=`Dates`;let i=document.createElement(`div`);i.className=CM(),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=wM(),t.appendChild(a);function o(t){let n=t.scheduleDates;i.textContent=`${n.length} dates`,a.innerHTML=``;for(let r of n){let n=document.createElement(`div`);n.className=TM(),r.date===t.selectedDate&&n.classList.add(`selected`),r.isActive||n.classList.add(`inactive`),n.setAttribute(`data-date`,r.date);let i=document.createElement(`div`),o=document.createElement(`div`);o.style.cssText=`font-weight:800;font-size:0.75rem`,o.textContent=r.date;let s=document.createElement(`div`);s.style.cssText=`font-size:0.6875rem;color:var(--sp-muted)`,s.textContent=r.isActive?`Active`:`Inactive`,i.appendChild(o),i.appendChild(s);let c=document.createElement(`div`);if(c.className=EM(),r.matchUpCount!=null){let e=document.createElement(`div`);e.className=`spl-date-badge matchups`,e.textContent=`${r.matchUpCount} matchUps`,c.appendChild(e)}if(r.issueCount&&r.issueCount>0){let e=document.createElement(`div`);e.className=`spl-date-badge issues`,e.textContent=`${r.issueCount} issues`,c.appendChild(e)}n.appendChild(i),n.appendChild(c),n.addEventListener(`click`,()=>e.onDateSelected(r.date)),a.appendChild(n)}}return{element:t,update:o}}function cN(e,t,n){let r=document.createElement(`div`);r.className=cM();let i=document.createElement(`div`);i.className=lM();let a=document.createElement(`div`);a.className=uM(),a.textContent=`Court Grid`;let o=document.createElement(`div`);o.className=dM(),i.appendChild(a),i.appendChild(o),r.appendChild(i);let s=document.createElement(`div`);s.className=fM(),n?.gridMaxHeight&&(s.style.maxHeight=n.gridMaxHeight),e&&s.appendChild(e),s.addEventListener(`dragover`,e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`}),s.addEventListener(`drop`,e=>{if(e.preventDefault(),!t.onMatchUpDrop)return;let n;try{n=JSON.parse(e.dataTransfer.getData(`application/json`))}catch{return}(n.type===`CATALOG_MATCHUP`||n.type===`GRID_MATCHUP`)&&t.onMatchUpDrop(n,e)}),r.appendChild(s);function c(e){o.textContent=e.selectedDate??`No date selected`}return{element:r,update:c}}var lN=class{constructor(e){this.listeners=new Set,this.config=e,this.state={matchUpCatalog:e.matchUpCatalog,scheduleDates:e.scheduleDates,issues:e.issues??[],selectedDate:e.scheduleDates[0]?.date??null,selectedMatchUp:null,catalogSearchQuery:``,catalogGroupBy:`event`,catalogFilters:{},showCompleted:!1,showScheduled:!1,scheduledBehavior:e.scheduledBehavior??`dim`,schedulingMode:e.schedulingMode??`immediate`,pendingActions:[],hasUnsavedChanges:!1,leftCollapsed:!!e.hideLeft,hideLeft:!!e.hideLeft}}getState(){return this.state}setMatchUpCatalog(e){this.setState({matchUpCatalog:e}),this.state.selectedMatchUp&&(e.some(e=>e.matchUpId===this.state.selectedMatchUp?.matchUpId)||this.setState({selectedMatchUp:null}))}setScheduleDates(e){this.setState({scheduleDates:e})}setIssues(e){this.setState({issues:e})}handleMatchUpDrop(e,t){if(this.state.schedulingMode===`immediate`)this.config.onMatchUpDrop?.(e,t);else{let n={kind:`schedule`,matchUpId:e.matchUp.matchUpId,matchUp:e.matchUp,event:t};this.setState({pendingActions:[...this.state.pendingActions,n],hasUnsavedChanges:!0})}}handleMatchUpRemove(e){if(this.state.schedulingMode===`immediate`)this.config.onMatchUpRemove?.(e);else{let t=this.state.pendingActions.findIndex(t=>t.kind===`schedule`&&t.matchUpId===e);if(t>=0){let e=[...this.state.pendingActions];e.splice(t,1),this.setState({pendingActions:e,hasUnsavedChanges:e.length>0})}else{let t={kind:`unschedule`,matchUpId:e};this.setState({pendingActions:[...this.state.pendingActions,t],hasUnsavedChanges:!0})}}}save(){let e=this.state.pendingActions;return e.length?(this.config.onBulkSave?.(e),this.setState({pendingActions:[],hasUnsavedChanges:!1}),e):[]}discardPending(){this.setState({pendingActions:[],hasUnsavedChanges:!1})}getPendingActions(){return this.state.pendingActions}selectDate(e){this.state.selectedDate!==e&&(this.setState({selectedDate:e}),this.config.onDateSelected?.(e))}selectMatchUp(e){this.setState({selectedMatchUp:e}),this.config.onMatchUpSelected?.(e)}setCatalogSearch(e){this.setState({catalogSearchQuery:e})}setCatalogGroupBy(e){this.setState({catalogGroupBy:e})}setCatalogFilters(e){this.setState({catalogFilters:e})}setShowCompleted(e){this.setState({showCompleted:e})}setShowScheduled(e){this.setState({showScheduled:e})}toggleLeftPanel(){this.setState({leftCollapsed:!this.state.leftCollapsed})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state={...this.state,...e},this.emit()}emit(){for(let e of this.listeners)e(this.state)}},uN=class{constructor(e){this.container=null,this.store=new lN(e);let t=sN({onDateSelected:e=>this.store.selectDate(e)}),n=oN(),r=cN(e.courtGridElement,{onMatchUpDrop:(e,t)=>{this.store.handleMatchUpDrop(e,t)}},{gridMaxHeight:e.gridMaxHeight}),i=rN({onSearchChange:e=>this.store.setCatalogSearch(e),onGroupByChange:e=>this.store.setCatalogGroupBy(e),onFilterChange:e=>this.store.setCatalogFilters(e),onShowCompletedChange:e=>this.store.setShowCompleted(e),onShowScheduledChange:e=>this.store.setShowScheduled(e),onMatchUpSelected:e=>this.store.selectMatchUp(e),onDropRemove:e=>{this.store.handleMatchUpRemove(e)}}),a=JM();this.layout=WM({dateStrip:t,issuesPanel:n,courtGridSlot:r,matchUpCatalog:i,inspectorPanel:a},{onToggleLeft:()=>this.store.toggleLeftPanel()},{hideLeft:e.hideLeft,catalogSide:e.catalogSide}),this.unsubscribe=this.store.subscribe(e=>{this.layout.update(e)}),this.layout.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.layout.element)}destroy(){this.unsubscribe(),this.container&&this.layout.element.parentNode===this.container&&this.layout.element.remove(),this.container=null}setMatchUpCatalog(e){this.store.setMatchUpCatalog(e)}setScheduleDates(e){this.store.setScheduleDates(e)}setIssues(e){this.store.setIssues(e)}save(){return this.store.save()}discardPending(){this.store.discardPending()}get hasUnsavedChanges(){return this.store.getState().hasUnsavedChanges}getStore(){return this.store}},dN=`spl-cell--conflict-highlight`,fN=`spl-cell--complete`,pN={header:[`time`],body:[`eventRound`,`participants`],footer:[`score`],participantDisplay:{nameFormat:`full`,showSeed:!1,showRanking:!1,showNationality:!1,boldWinner:!0,showPotentials:!0}};function mN(e,t){let n=t??pN;return e.isBlocked?hN(e):e.matchUpId?_N(e,n):gN()}function hN(e){let t=document.createElement(`div`);t.className=`spl-grid-cell spl-cell--blocked`;let n=e.booking?.bookingType||`BLOCKED`;t.dataset.bookingType=n;let r=document.createElement(`div`);r.className=`spl-grid-cell__block-label`;let i=document.createElement(`div`);if(i.className=`spl-grid-cell__block-type`,i.textContent=n,r.appendChild(i),e.booking?.rowCount){let t=document.createElement(`div`);t.className=`spl-grid-cell__block-rows`,t.textContent=`${e.booking.rowCount} rows`,r.appendChild(t)}if(e.booking?.notes){let t=document.createElement(`div`);t.className=`spl-grid-cell__block-notes`,t.textContent=e.booking.notes,r.appendChild(t)}return t.appendChild(r),t}function gN(){let e=document.createElement(`div`);return e.className=`spl-grid-cell spl-cell--empty`,e}function _N(e,t){let n=document.createElement(`div`);if(n.className=`spl-grid-cell`,n.dataset.matchupId=e.matchUpId,e.drawId&&(n.dataset.drawId=e.drawId),e.gender&&(n.dataset.gender=e.gender),vN(n,e),t.header.length){let r=document.createElement(`div`);r.className=`spl-grid-cell__header`,yN(r,t.header,e,t),n.appendChild(r)}if(t.body.length){let r=document.createElement(`div`);r.className=`spl-grid-cell__body`,yN(r,t.body,e,t),n.appendChild(r)}if(t.footer.length){let r=document.createElement(`div`);r.className=`spl-grid-cell__footer`,yN(r,t.footer,e,t),n.appendChild(r)}return e.issueIds?.length&&(n.addEventListener(`mouseenter`,()=>{n.classList.add(dN);for(let t of e.issueIds)document.querySelectorAll(`[data-matchup-id="${t}"]`).forEach(e=>e.classList.add(dN))}),n.addEventListener(`mouseleave`,()=>{n.classList.remove(dN);for(let t of e.issueIds)document.querySelectorAll(`[data-matchup-id="${t}"]`).forEach(e=>e.classList.remove(dN))})),n}function vN(e,t){let n=t.matchUpStatus?.toUpperCase();n===`COMPLETED`||n===`RETIRED`||n===`DEFAULTED`||n===`WALKOVER`?e.classList.add(fN):n===`IN_PROGRESS`?e.classList.add(`spl-cell--inprogress`):n===`ABANDONED`?e.classList.add(`spl-cell--abandoned`):n===`CANCELLED`?e.classList.add(`spl-cell--cancelled`):n===`DOUBLE_WALKOVER`&&e.classList.add(`spl-cell--double-walkover`);let r=t.scheduleState?.toUpperCase();r===`SCHEDULE_ERROR`||r===`ERROR`?e.classList.add(`spl-cell--error`):r===`SCHEDULE_CONFLICT`||r===`CONFLICT`?e.classList.add(`spl-cell--conflict`):r===`SCHEDULE_WARNING`||r===`WARNING`?e.classList.add(`spl-cell--warning`):(r===`SCHEDULE_ISSUE`||r===`ISSUE`)&&e.classList.add(`spl-cell--issue`),(t.issueType===`DOUBLE_BOOKING`||t.issueType===`courtDoubleBooking`)&&e.classList.add(`spl-cell--double-booking`)}function yN(e,t,n,r){for(let i of t){let t=bN(i,n,r);t&&e.appendChild(t)}}function bN(e,t,n){switch(e){case`time`:return xN(t);case`eventRound`:return SN(t);case`participants`:return CN(t,n.participantDisplay);case`score`:return ON(t);case`matchUpStatus`:return kN(t);case`matchUpFormat`:return AN(t);case`umpire`:return jN(t);default:return null}}function xN(e){let t=e.schedule?.scheduledTime||e.schedule?.startTime,n=e.schedule?.timeModifiers,r=e.schedule?.courtAnnotation;if(!t&&!n?.length&&!r)return null;let i=document.createElement(`div`);i.className=`spl-grid-cell__time`;let a=[];if(n?.length&&a.push(n.join(` `)),t&&a.push(t),i.textContent=a.join(` `)||``,r){let e=document.createElement(`span`);e.className=`spl-grid-cell__court-annotation`,e.textContent=` ${r}`,i.appendChild(e)}return i}function SN(e){let t=[e.eventName,e.roundName].filter(Boolean);if(!t.length)return null;let n=document.createElement(`div`);return n.className=`spl-grid-cell__event-round`,n.textContent=t.join(` `),n}function CN(e,t){let n=t??pN.participantDisplay,r=document.createElement(`div`);r.className=`spl-grid-cell__participants`;let i=e.sides||[],a=e.matchUpStatus?.toUpperCase()===`BYE`,o=i.some(e=>e.bye);if(i.length===0&&n.showPotentials!==!1&&e.potentialParticipants?.length){for(let t=0;t<e.potentialParticipants.length;t++){t>0&&r.appendChild(EN());let n=e.potentialParticipants[t].map(e=>e?.participantName||`TBD`).join(` / `),i=document.createElement(`div`);i.className=`spl-grid-cell__side spl-grid-cell__potential`,i.textContent=n||`TBD`,r.appendChild(i)}return r}if(i.length===0)return null;for(let t=0;t<i.length;t++){let a=i[t];a.bye?r.appendChild(TN()):(t>0&&!i[t-1]?.bye&&r.appendChild(EN()),r.appendChild(wN(a,e,n,a.sideNumber??t+1)))}return(a||o)&&i.length===1&&!i[0].bye&&r.appendChild(TN()),r}function wN(e,t,n,r){let i=document.createElement(`div`);i.className=`spl-grid-cell__side`;let a=document.createElement(`span`);a.className=`spl-grid-cell__name`;let o=DN(e.participantName,n.nameFormat)||`TBD`;if(n.showSeed&&e.seedNumber&&(o+=` [${e.seedNumber}]`),n.showRanking&&e.ranking&&(o+=` (#${e.ranking})`),n.showNationality&&e.nationality&&(o+=` ${e.nationality}`),a.textContent=o,n.boldWinner!==!1&&t.winningSide===r&&(a.style.fontWeight=`bold`),i.appendChild(a),e.teamName){let t=document.createElement(`div`);t.className=`spl-grid-cell__team-name`,t.textContent=e.teamName,i.appendChild(t)}return i}function TN(){let e=document.createElement(`div`);return e.className=`spl-grid-cell__bye`,e.textContent=`BYE`,e}function EN(){let e=document.createElement(`div`);return e.className=`spl-grid-cell__vs`,e.textContent=`vs.`,e}function DN(e,t){if(!e)return``;switch(t){case`last`:return e.includes(`,`)?e.split(`,`)[0].trim():e.trim().split(/\s+/).at(-1);case`lastFirst`:{if(e.includes(`,`))return e.trim();let t=e.trim().split(/\s+/);return t.length<2?e:`${t.at(-1)}, ${t.slice(0,-1).join(` `)}`}case`firstLast`:{if(!e.includes(`,`))return e.trim();let[t,...n]=e.split(`,`);return`${n.join(`,`).trim()} ${t.trim()}`}default:return e}}function ON(e){let t=e.score?.scoreStringSide1,n=e.matchUpStatus?.toUpperCase(),r=n===`WALKOVER`?`WALKOVER`:n===`DEFAULTED`?`DEFAULT`:n===`RETIRED`?`RET.`:n===`DOUBLE_WALKOVER`?`D.W/O`:n===`ABANDONED`?`ABN.`:null;if(!t&&!r)return null;let i=document.createElement(`div`);return i.className=`spl-grid-cell__score`,i.textContent=t||r||``,i}function kN(e){if(!e.matchUpStatus)return null;let t=document.createElement(`div`);t.className=`spl-grid-cell__status-badge`;let n=e.matchUpStatus.toUpperCase();return n===`IN_PROGRESS`?(t.textContent=`LIVE`,t.classList.add(`spl-grid-cell__status-badge--live`)):n===`COMPLETED`||n===`RETIRED`||n===`DEFAULTED`||n===`WALKOVER`?(t.textContent=`DONE`,t.classList.add(`spl-grid-cell__status-badge--done`)):t.textContent=e.matchUpStatus.replaceAll(`_`,` `),t}function AN(e){if(!e.matchUpFormat)return null;let t=document.createElement(`div`);return t.className=`spl-grid-cell__format`,t.textContent=e.matchUpFormat,t}function jN(e){if(!e.umpire)return null;let t=document.createElement(`div`);return t.className=`spl-grid-cell__umpire`,t.textContent=e.umpire,t}function MN(e){if(!e)return{matchUpId:``};if(e.isBlocked)return{matchUpId:``,isBlocked:!0,booking:e.booking};let t=(e.sides||[]).map((e,t)=>({sideNumber:e.sideNumber??t+1,participantName:e.participant?.participantName??e.participantName,participantId:e.participantId??e.participant?.participantId,seedNumber:e.seedValue??e.seedNumber,ranking:e.ranking,nationality:e.participant?.nationalityCode??e.participant?.person?.nationalityCode??e.nationalityCode,teamName:e.teamParticipant?.participantName??e.teamName,bye:e.bye||void 0}));return{matchUpId:e.matchUpId,drawId:e.drawId,eventName:e.eventName,roundName:e.roundName,matchUpFormat:e.matchUpFormat,matchUpType:e.matchUpType,matchUpStatus:e.matchUpStatus,winningSide:e.winningSide,gender:e.gender??e.eventGender,sides:t,potentialParticipants:e.potentialParticipants,schedule:e.schedule?{scheduledTime:e.schedule.scheduledTime,startTime:e.schedule.startTime,timeModifiers:e.schedule.timeModifiers,courtAnnotation:e.schedule.courtAnnotation,courtId:e.schedule.courtId,courtOrder:e.schedule.courtOrder,venueId:e.schedule.venueId}:void 0,score:e.score?{scoreStringSide1:e.score.scoreStringSide1,scoreStringSide2:e.score.scoreStringSide2}:void 0,umpire:e.umpire?.participantName??e.umpireName,scheduleState:e.scheduleState,issueType:e.issueType,issueIds:e.issueIds}}function NN({cell:e,listProvider:t,onSelect:n,onCancel:r}){let i=e.innerHTML,a=[],o=!1,s=!1;e.classList.add(`spl-cell--typeahead`),e.innerHTML=``;let c=document.createElement(`div`);c.className=`spl-cell--typeahead-wrapper`,e.appendChild(c);let l=document.createElement(`input`);l.type=`text`,l.placeholder=`Search matchUps...`,l.setAttribute(`inputmode`,`search`),l.setAttribute(`autocapitalize`,`off`),l.setAttribute(`enterkeyhint`,`search`),l.setAttribute(`autocomplete`,`off`),c.appendChild(l);let u=e,d=0;for(;u&&d<10;){let e=window.getComputedStyle(u);(e.overflow!==`visible`||e.overflowX!==`visible`||e.overflowY!==`visible`)&&(a.push({el:u,overflow:u.style.overflow,overflowX:u.style.overflowX,overflowY:u.style.overflowY}),u.style.setProperty(`overflow`,`visible`,`important`),u.style.setProperty(`overflow-x`,`visible`,`important`),u.style.setProperty(`overflow-y`,`visible`,`important`)),u=u.parentElement,d++}ne({list:t(),element:l,listProvider:t,callback:e=>{e&&!s&&(o=!0,p(),n(e))}}),l.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),p(),r?.())}),l.addEventListener(`blur`,()=>{setTimeout(()=>{!o&&!s&&(p(),r?.())},200)});let f=e=>{e.target!==l&&!c.contains(e.target)&&(e.preventDefault(),l.blur())};e.addEventListener(`mousedown`,f),c.addEventListener(`click`,e=>{e.stopPropagation()}),setTimeout(()=>l.focus(),0);function p(){if(!s){s=!0,e.removeEventListener(`mousedown`,f),e.classList.remove(`spl-cell--typeahead`),e.innerHTML=i;for(let{el:e,overflow:t,overflowX:n,overflowY:r}of a)t?e.style.overflow=t:e.style.removeProperty(`overflow`),n?e.style.overflowX=n:e.style.removeProperty(`overflow-x`),r?e.style.overflowY=r:e.style.removeProperty(`overflow-y`)}}return{destroy:p}}function PN(e,t){let n=new uN(e);return n.render(t),n}var FN=class{constructor(e){this.listeners=new Set,this.config=e,this.state={compositionName:e.compositionName||`Custom`,theme:e.composition?.theme||``,configuration:{...e.composition?.configuration||{}},expandedSections:new Set([`theme`,`display`]),isDirty:!1,readOnly:e.readOnly||!1}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}toggleSection(e){let t=new Set(this.state.expandedSections);t.has(e)?t.delete(e):t.add(e),this.setState({expandedSections:t})}setTheme(e){this.setState({theme:e,isDirty:!0}),this.notifyChange()}setCompositionName(e){this.setState({compositionName:e,isDirty:!0})}setConfigField(e,t){let n={...this.state.configuration,[e]:t};this.setState({configuration:n,isDirty:!0}),this.notifyChange()}setConfigNestedField(e,t,n){let r={...this.state.configuration[e]||{},[t]:n};this.setConfigField(e,r)}setConfiguration(e){this.setState({configuration:{...e},isDirty:!0}),this.notifyChange()}loadComposition(e,t,n){this.setState({compositionName:e,theme:t,configuration:{...n},isDirty:!1}),this.notifyChange()}resetToInitial(){this.setState({compositionName:this.config.compositionName||`Custom`,theme:this.config.composition?.theme||``,configuration:{...this.config.composition?.configuration||{}},isDirty:!1}),this.notifyChange()}setState(e){this.state={...this.state,...e},this.emit()}emit(){for(let e of this.listeners)e(this.state)}notifyChange(){this.config.onChange?.({theme:this.state.theme,configuration:this.state.configuration})}},IN=()=>`ce-layout`,LN=()=>`ce-left`,RN=()=>`ce-right`,zN=()=>`ce-name-row`,BN=()=>`ce-name-label`,VN=()=>`ce-name-input`,HN=()=>`ce-section`,UN=()=>`ce-section-header`,WN=()=>`ce-section-chevron`,GN=()=>`ce-section-body`,KN=()=>`ce-field`,qN=()=>`ce-field-label`,JN=()=>`ce-field-control`,YN=()=>`ce-select`,XN=()=>`ce-text-input`,ZN=()=>`ce-color-input`,QN=()=>`ce-toggle`,$N=()=>`ce-toggle-track`,eP=()=>`ce-preview`,tP=()=>`ce-preview-header`,nP=()=>`ce-preview-body`,rP=()=>`ce-preview-matchup`,iP=()=>`ce-subgroup`,aP=()=>`ce-subgroup-title`;function oP(e,t){let n=document.createElement(`div`);n.className=HN();let r=document.createElement(`div`);r.className=UN();let i=document.createElement(`span`);i.className=WN();let a=document.createElement(`span`);a.textContent=e.label,r.appendChild(i),r.appendChild(a),r.addEventListener(`click`,()=>t.toggleSection(e.id));let o=document.createElement(`div`);o.className=GN();let s=e.factory(t);o.appendChild(s.element),n.appendChild(r),n.appendChild(o);function c(t){let n=t.expandedSections.has(e.id);i.textContent=n?`▼`:`▶`,o.style.display=n?`block`:`none`,n&&s.update(t)}return{element:n,update:c}}function sP(e,t,n,r=!1){let i=document.createElement(`div`);i.className=KN();let a=document.createElement(`span`);a.className=qN(),a.textContent=e,i.appendChild(a);let o=document.createElement(`label`);o.className=QN();let s=document.createElement(`input`);s.type=`checkbox`,s.checked=t,s.disabled=r,s.addEventListener(`change`,()=>n(s.checked));let c=document.createElement(`span`);c.className=$N(),o.appendChild(s),o.appendChild(c);let l=document.createElement(`div`);return l.className=JN(),l.appendChild(o),i.appendChild(l),{element:i,setChecked:e=>{s.checked=e},setDisabled:e=>{s.disabled=e}}}function cP(e,t,n,r,i=!1){let a=document.createElement(`div`);a.className=KN();let o=document.createElement(`span`);o.className=qN(),o.textContent=e,a.appendChild(o);let s=document.createElement(`select`);s.className=YN(),s.disabled=i;for(let e of t){let t=document.createElement(`option`);t.value=e.value,t.textContent=e.label,e.value===n&&(t.selected=!0),s.appendChild(t)}s.addEventListener(`change`,()=>r(s.value));let c=document.createElement(`div`);return c.className=JN(),c.appendChild(s),a.appendChild(c),{element:a,setValue:e=>{s.value=e}}}function lP(e,t,n,r=``,i=!1){let a=document.createElement(`div`);a.className=KN();let o=document.createElement(`span`);o.className=qN(),o.textContent=e,a.appendChild(o);let s=document.createElement(`input`);s.type=`text`,s.className=XN(),s.value=t,s.placeholder=r,s.disabled=i,s.addEventListener(`input`,()=>n(s.value));let c=document.createElement(`div`);return c.className=JN(),c.appendChild(s),a.appendChild(c),{element:a,setValue:e=>{s.value=e}}}function uP(e,t,n,r=!1){let i=document.createElement(`div`);i.className=KN();let a=document.createElement(`span`);a.className=qN(),a.textContent=e,i.appendChild(a);let o=document.createElement(`input`);o.type=`color`,o.className=ZN(),o.value=t||`#000000`,o.disabled=r,o.addEventListener(`input`,()=>n(o.value));let s=document.createElement(`div`);return s.className=JN(),s.appendChild(o),i.appendChild(s),{element:i,setValue:e=>{o.value=e||`#000000`}}}var dP=[],fP=new Set;for(let[,e]of Object.entries(ri))if(!fP.has(e.theme)){fP.add(e.theme);let t=e.theme.replace(`chc-theme-`,``).replace(/-/g,` `).replace(/\b\w/g,e=>e.toUpperCase());dP.push({value:e.theme,label:t})}function pP(e){let t=document.createElement(`div`),n=cP(`Load preset`,[{value:``,label:`— Load preset —`},...Object.keys(ri).map(e=>({value:e,label:e}))],``,t=>{if(!t)return;let r=ri[t];r&&e.loadComposition(t,r.theme,r.configuration||{}),n.setValue(``)},e.getState().readOnly);t.appendChild(n.element);let r=document.createElement(`div`);r.style.cssText=`font-size:0.7rem; color:var(--chc-text-secondary, #999); padding:0 0 0.3rem; line-height:1.3;`,r.textContent=`Replaces all settings with a built-in composition.`,t.appendChild(r);let i=cP(`Color theme`,dP,e.getState().theme,t=>e.setTheme(t),e.getState().readOnly);t.appendChild(i.element);let a=document.createElement(`div`);a.style.cssText=`font-size:0.7rem; color:var(--chc-text-secondary, #999); padding:0 0 0.3rem; line-height:1.3;`,a.textContent=`Changes only the color scheme, not the display settings.`,t.appendChild(a);function o(e){i.setValue(e.theme)}return{element:t,update:o}}function mP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=sP(`Nationality flags`,!!r.flags,t=>e.setConfigField(`flags`,t),n),a=cP(`Seeding style`,[{value:``,label:`None`},{value:`true`,label:`Parentheses`},{value:`square`,label:`Square brackets`}],r.bracketedSeeds===`square`?`square`:r.bracketedSeeds?`true`:``,t=>{t===`square`?e.setConfigField(`bracketedSeeds`,`square`):t===`true`?e.setConfigField(`bracketedSeeds`,!0):e.setConfigField(`bracketedSeeds`,void 0)},n),o=cP(`Seed element`,[{value:``,label:`Default`},{value:`sup`,label:`Superscript`},{value:`span`,label:`Inline`}],r.seedingElement||``,t=>e.setConfigField(`seedingElement`,t||void 0),n),s=sP(`Draw positions (1st round)`,!!r.drawPositions,t=>e.setConfigField(`drawPositions`,t),n),c=sP(`Draw positions (all rounds)`,!!r.allDrawPositions,t=>e.setConfigField(`allDrawPositions`,t),n),l=sP(`Team logo`,r.teamLogo!==!1,t=>e.setConfigField(`teamLogo`,t),n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element),t.appendChild(s.element),t.appendChild(c.element),t.appendChild(l.element);function u(e){let t=e.configuration;i.setChecked(!!t.flags),a.setValue(t.bracketedSeeds===`square`?`square`:t.bracketedSeeds?`true`:``),o.setValue(t.seedingElement||``),s.setChecked(!!t.drawPositions),c.setChecked(!!t.allDrawPositions),l.setChecked(t.teamLogo!==!1)}return{element:t,update:u}}function hP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=sP(`Score box`,!!r.scoreBox,t=>e.setConfigField(`scoreBox`,t),n),a=sP(`Game score only`,!!r.gameScoreOnly,t=>e.setConfigField(`gameScoreOnly`,t),n);t.appendChild(i.element),t.appendChild(a.element);let o=document.createElement(`div`);o.className=iP();let s=document.createElement(`div`);s.className=aP(),s.textContent=`Game Score Display`,o.appendChild(s);let c=cP(`Position`,[{value:``,label:`Default`},{value:`leading`,label:`Leading`},{value:`trailing`,label:`Trailing`}],r.gameScore?.position||``,t=>e.setConfigNestedField(`gameScore`,`position`,t||void 0),n),l=sP(`Inverted`,!!r.gameScore?.inverted,t=>e.setConfigNestedField(`gameScore`,`inverted`,t),n);o.appendChild(c.element),o.appendChild(l.element),t.appendChild(o);function u(e){let t=e.configuration;i.setChecked(!!t.scoreBox),a.setChecked(!!t.gameScoreOnly),c.setValue(t.gameScore?.position||``),l.setChecked(!!t.gameScore?.inverted)}return{element:t,update:u}}function gP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=sP(`Gender color`,!!r.genderColor,t=>e.setConfigField(`genderColor`,t),n),a=sP(`Winner color`,!!r.winnerColor,t=>e.setConfigField(`winnerColor`,t),n),o=cP(`Detail`,[{value:``,label:`Default`},{value:`TEAM`,label:`Team`},{value:`ADDRESS`,label:`Address`}],r.participantDetail||``,t=>{e.setConfigField(`participantDetail`,t||void 0),e.setConfigField(`showAddress`,t===`ADDRESS`)},n),s=lP(`Position color`,r.drawPositionColor||``,t=>e.setConfigField(`drawPositionColor`,t||void 0),`#999`,n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element),t.appendChild(s.element);function c(e){let t=e.configuration;i.setChecked(!!t.genderColor),a.setChecked(!!t.winnerColor),o.setValue(t.participantDetail||``),s.setValue(t.drawPositionColor||``)}return{element:t,update:c}}function _P(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=lP(`TBD text`,r.placeHolders?.tbd||``,t=>e.setConfigNestedField(`placeHolders`,`tbd`,t||void 0),`TBD`,n),a=lP(`Bye text`,r.placeHolders?.bye||``,t=>e.setConfigNestedField(`placeHolders`,`bye`,t||void 0),`Bye`,n),o=lP(`Qualifier text`,r.placeHolders?.qualifier||``,t=>e.setConfigNestedField(`placeHolders`,`qualifier`,t||void 0),`Qualifier`,n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element);function s(e){let t=e.configuration;i.setValue(t.placeHolders?.tbd||``),a.setValue(t.placeHolders?.bye||``),o.setValue(t.placeHolders?.qualifier||``)}return{element:t,update:s}}var vP=[{scaleName:`WTN`,accessor:`wtnRating`,label:`WTN`},{scaleName:`UTR`,accessor:`utrRating`,label:`UTR`},{scaleName:`NTRP`,accessor:`ntrpRating`,label:`NTRP`},{scaleName:`ELO`,accessor:`eloRating`,label:`ELO`}];function yP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration.scaleAttributes||{},i=cP(`Scale type`,[{value:``,label:`None`},{value:`RATING`,label:`Rating`},{value:`RANKING`,label:`Ranking`},{value:`SEEDING`,label:`Seeding`}],r.scaleType||``,t=>e.setConfigNestedField(`scaleAttributes`,`scaleType`,t||void 0),n),a=cP(`Scale name`,[{value:``,label:`None`},...vP.map(e=>({value:e.scaleName,label:e.label}))],r.scaleName||``,t=>{e.setConfigNestedField(`scaleAttributes`,`scaleName`,t||void 0);let n=vP.find(e=>e.scaleName===t);e.setConfigNestedField(`scaleAttributes`,`accessor`,n?.accessor||void 0)},n),o=uP(`Color`,r.scaleColor||`#ff0000`,t=>e.setConfigNestedField(`scaleAttributes`,`scaleColor`,t),n),s=cP(`Event type`,[{value:``,label:`Any`},{value:`SINGLES`,label:`Singles`},{value:`DOUBLES`,label:`Doubles`}],r.eventType||``,t=>e.setConfigNestedField(`scaleAttributes`,`eventType`,t||void 0),n),c=sP(`Fallback`,!!r.fallback,t=>e.setConfigNestedField(`scaleAttributes`,`fallback`,t),n),l=sP(`Right of name`,r.scalePosition===`right`,t=>e.setConfigNestedField(`scaleAttributes`,`scalePosition`,t?`right`:`left`),n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element),t.appendChild(s.element),t.appendChild(c.element),t.appendChild(l.element);function u(e){let t=e.configuration.scaleAttributes||{},n=!!e.configuration.flags;i.setValue(t.scaleType||``),a.setValue(t.scaleName||``),o.setValue(t.scaleColor||`#ff0000`),s.setValue(t.eventType||``),c.setChecked(!!t.fallback),n?(l.setChecked(!0),l.setDisabled(!0)):(l.setChecked(t.scalePosition===`right`),l.setDisabled(!1))}return{element:t,update:u}}function bP(e){let t=document.createElement(`div`),n=e.getState().readOnly,r=e.getState().configuration,i=sP(`Schedule info`,!!r.scheduleInfo,t=>e.setConfigField(`scheduleInfo`,t),n),a=sP(`MatchUp footer`,!!r.matchUpFooter,t=>e.setConfigField(`matchUpFooter`,t),n),o=sP(`Center info`,!!r.centerInfo,t=>e.setConfigField(`centerInfo`,t),n),s=sP(`Set number`,!!r.resultsInfo,t=>e.setConfigField(`resultsInfo`,t),n),c=sP(`Winner chevron`,!!r.winnerChevron,t=>e.setConfigField(`winnerChevron`,t),n);t.appendChild(i.element),t.appendChild(a.element),t.appendChild(o.element),t.appendChild(s.element),t.appendChild(c.element);function l(e){let t=e.configuration;i.setChecked(!!t.scheduleInfo),a.setChecked(!!t.matchUpFooter),o.setChecked(!!t.centerInfo),s.setChecked(!!t.resultsInfo),c.setChecked(!!t.winnerChevron)}return{element:t,update:l}}var{DOUBLES:xP,SINGLES:SP}=t.eventConstants,{AD_HOC:CP}=t.drawDefinitionConstants,{INDIVIDUAL:wP}=t.participantConstants;function TP({matchUpFormat:e=`SET5-S:6/TB7`,randomWinningSide:n=!0,qualifyingProfiles:r,participantsCount:i,completionGoal:a,drawSize:o=4,eventType:s,outcomes:c,drawType:l,withRatings:u,withAllRatings:d}={}){let f=a<100?Math.floor(o*.01*a):void 0,p=`venueId`,m=[{venueName:`Challenge Courts`,venueAbbreviation:`CC`,startTime:`08:00`,endTime:`20:00`,venueId:p,courtNames:[1,2,3,4,5,6,7,8],courtIds:[`c1`,`c2`,`c3`,`c4`],courtsCount:8}],h={eventType:s===xP?xP:SP,completionGoal:f,qualifyingProfiles:r,participantsCount:i,seedsCount:8,matchUpFormat:e,drawSize:o,drawType:l,outcomes:c};l===CP&&Object.assign(h,{drawMatic:!0,roundsCount:3});let{tournamentRecord:g}=t.mocksEngine.generateTournamentRecord({drawProfiles:[h],completeAllMatchUps:!0,randomWinningSide:n,venueProfiles:m});t.tournamentEngine.setState(g),t.tournamentEngine.createTeamsFromParticipantAttributes({personAttribute:`nationalityCode`,addParticipants:!0});let _=d||(u?[{...u,accessor:u.scaleName}]:[]);if(_.length>0){let{participants:e}=t.tournamentEngine.getParticipants({participantFilters:{participantTypes:[wP]}});for(let n of _)e.forEach(e=>{let r=+(10+Math.random()*6).toFixed(2);t.tournamentEngine.setParticipantScaleItem({participantId:e.participantId,scaleItem:{scaleValue:{[n.accessor]:r},scaleName:n.scaleName,scaleType:n.scaleType||`RATING`,eventType:n.eventType||SP}})})}let{matchUps:v}=t.tournamentEngine.allTournamentMatchUps({participantsProfile:{withGroupings:!0}}),y=v.map(({matchUpId:e})=>e),b={startTime:`08:00`,endTime:`10:00`,scheduledTime:`07:00`,scheduledDate:`2021-01-01`,courtId:`c1`,venueId:p};t.tournamentEngine.bulkScheduleMatchUps({matchUpIds:y,schedule:b});let{matchUps:x}=t.tournamentEngine.allTournamentMatchUps({participantsProfile:{withISO2:!0,withIOC:!0,withScaleValues:!!(u||d)}});return{matchUps:x}}var EP=null;function DP(){if(!EP){let{matchUps:e}=TP({drawSize:8,eventType:`SINGLES`,randomWinningSide:!0,matchUpFormat:`SET3-S:6/TB7`,withAllRatings:vP.map(e=>({scaleName:e.scaleName,accessor:e.accessor}))}),t=e.filter(e=>e.roundNumber===1).slice(0,2),n=t[0]?.sides?.[0]?.participant,r=t[0]?.sides?.[1]?.participant,i={matchUpId:`preview-in-progress`,matchUpType:`SINGLES`,matchUpStatus:`IN_PROGRESS`,roundNumber:1,sides:[{sideNumber:1,drawPosition:5,seedNumber:3,seedValue:`3`,participant:n},{sideNumber:2,drawPosition:6,seedNumber:6,seedValue:`6`,participant:r}],score:{scoreStringSide1:`6-4 3-2`,scoreStringSide2:`4-6 2-3`,sets:[{setNumber:1,side1Score:6,side2Score:4,winningSide:1},{setNumber:2,side1Score:3,side2Score:2,side1PointScore:`30`,side2PointScore:`15`}]}},a={matchUpId:`preview-bye`,matchUpType:`SINGLES`,matchUpStatus:`BYE`,roundNumber:1,sides:[{sideNumber:1,drawPosition:7,seedNumber:2,seedValue:`2`,participant:n},{sideNumber:2,drawPosition:8,bye:!0}]},o={matchUpId:`preview-tbd`,matchUpType:`SINGLES`,matchUpStatus:`TO_BE_PLAYED`,roundNumber:1,sides:[{sideNumber:1,drawPosition:9,seedNumber:3,seedValue:`3`,participant:n},{sideNumber:2,drawPosition:10}]},s={matchUpId:`preview-qualifier`,matchUpType:`SINGLES`,matchUpStatus:`TO_BE_PLAYED`,roundNumber:1,sides:[{sideNumber:1,drawPosition:11,qualifier:!0},{sideNumber:2,drawPosition:12,seedNumber:4,seedValue:`4`,participant:n}]};EP=[...t,i,a,o,s]}return EP}function OP(){let e=document.createElement(`div`);e.className=eP();let t=document.createElement(`div`);t.className=tP(),t.textContent=`Preview`,e.appendChild(t);let n=document.createElement(`div`);n.className=nP(),e.appendChild(n);let r=``,i=``;function a(e){let t=JSON.stringify(e.configuration);if(e.theme===r&&t===i)return;r=e.theme,i=t,n.innerHTML=``;let a={theme:e.theme,configuration:{...e.configuration}},o=DP();for(let e of o){let t=document.createElement(`div`);t.className=rP();let r=Wr({matchUp:e,composition:a,isLucky:!0});t.appendChild(r),n.appendChild(t)}}return{element:e,update:a}}var kP=[{id:`theme`,label:`Theme & Preset`,factory:pP},{id:`display`,label:`Display`,factory:mP},{id:`score`,label:`Score`,factory:hP},{id:`participant`,label:`Participant`,factory:gP},{id:`placeholder`,label:`Placeholders`,factory:_P},{id:`scale`,label:`Scale Attributes`,factory:yP},{id:`layout`,label:`Layout & Info`,factory:bP}];function AP(e,t){let n=new FN(t),r=document.createElement(`div`);r.className=IN();let i=document.createElement(`div`);i.className=LN();let a=document.createElement(`div`);a.className=zN();let o=document.createElement(`span`);o.className=BN(),o.textContent=`Name`;let s=document.createElement(`input`);s.type=`text`,s.className=VN(),s.value=n.getState().compositionName,s.disabled=n.getState().readOnly,s.addEventListener(`input`,()=>n.setCompositionName(s.value)),a.appendChild(o),a.appendChild(s),i.appendChild(a);let c=kP.map(e=>{let t=oP(e,n);return i.appendChild(t.element),t}),l=document.createElement(`div`);l.className=RN();let u=OP();l.appendChild(u.element),r.appendChild(i),r.appendChild(l),e.appendChild(r);let d=n.subscribe(e=>{s.value=e.compositionName;for(let t of c)t.update(e);u.update(e)}),f=n.getState();for(let e of c)e.update(f);return u.update(f),{destroy:()=>{d(),e.contains(r)&&e.removeChild(r)},getComposition:()=>{let e=n.getState(),{participantProvider:t,persistInputFields:r,inlineAssignment:i,...a}=e.configuration;return{compositionName:e.compositionName,theme:e.theme,configuration:a,version:1}}}}var jP=`chc-scorecard-side-score--winner`;function MP({matchUp:e,composition:t,eventHandlers:n,swapSides:r}){let i=document.createElement(`div`);i.className=`chc-scorecard`;let a=r?2:1,o=r?1:2,s=VP(e,a)||``,c=VP(e,o)||``,l=r?RP(e.winningSide):e.winningSide,u=NP({side1Name:s,side2Name:c,sets:r?zP(e.score?.sets):e.score?.sets,winningSide:l,side1Id:`chc-sc-side1`,side2Id:`chc-sc-side2`});i.appendChild(u);let d=e.tieFormat?.collectionDefinitions?.slice().sort((e,t)=>(e.collectionOrder||0)-(t.collectionOrder||0))||[];for(let a of d){let o=LP({collectionDefinition:a,collectionMatchUps:(e.tieMatchUps||[]).filter(e=>e.collectionId===a.collectionId).sort((e,t)=>(e.collectionPosition||0)-(t.collectionPosition||0)),composition:t,eventHandlers:n,swapSides:r});i.appendChild(o)}return i}function NP({side1Name:e,side2Name:t,sets:n,winningSide:r,side1Id:i,side2Id:a}){let o=document.createElement(`div`);o.className=`chc-scorecard-header`;let s=document.createElement(`div`);s.className=`chc-scorecard-header-body`;let c=FP(e,`end`),l=FP(t,`start`),u=IP(n,1,r,i),d=IP(n,2,r,a),f=document.createElement(`div`);f.className=`chc-scorecard-score-box`;let p=document.createElement(`div`);p.className=`chc-scorecard-score-flex`;let m=document.createElement(`div`);return m.className=`chc-scorecard-vs`,m.textContent=`vs`,p.appendChild(u),p.appendChild(m),p.appendChild(d),f.appendChild(p),s.appendChild(c),s.appendChild(f),s.appendChild(l),o.appendChild(s),o}function PP(e,t=`chc-sc-side1`,n=`chc-sc-side2`,r){let i=e?.score?.sets?.[0];if(!i)return;let a=document.getElementById(t),o=document.getElementById(n);if(!a||!o)return;a.classList.remove(jP),o.classList.remove(jP);let s=r?`side2Score`:`side1Score`,c=r?`side1Score`:`side2Score`;a.textContent=String(i[s]??0),o.textContent=String(i[c]??0);let l=r?RP(e.winningSide):e.winningSide;l===1&&a.classList.add(jP),l===2&&o.classList.add(jP)}function FP(e,t){let n=document.createElement(`div`);n.className=`chc-scorecard-side chc-scorecard-side--${t}`;let r=document.createElement(`div`);return r.className=`chc-scorecard-side-name`,r.textContent=e,n.appendChild(r),n}function IP(e,t,n,r){let i=e?.[0]?.[`side${t}Score`]??0,a=document.createElement(`span`);return a.className=`chc-scorecard-side-score`,r&&(a.id=r),t===1?a.style.paddingLeft=`1rem`:a.style.paddingRight=`1rem`,t===n&&a.classList.add(jP),a.textContent=String(i),a}function LP({collectionDefinition:e,collectionMatchUps:t,composition:n,eventHandlers:r,swapSides:i}){let a=document.createElement(`div`);a.className=`chc-scorecard-panel`;let o=document.createElement(`div`);o.className=`chc-scorecard-panel-header`;let s=document.createElement(`div`);s.className=`chc-scorecard-panel-name`,s.textContent=e.collectionName||`Collection`;let c=document.createElement(`div`);c.className=`chc-scorecard-panel-meta`;let l=(e.matchUpType||``).toUpperCase(),u=document.createElement(`span`);u.className=`chc-scorecard-type-badge chc-scorecard-type-badge--${l===`DOUBLES`?`doubles`:`singles`}`,u.textContent=l===`DOUBLES`?`D`:`S`;let d=document.createElement(`span`);d.className=`chc-scorecard-count-badge`,d.textContent=String(t.length),c.appendChild(u),c.appendChild(d),o.appendChild(s),o.appendChild(c),a.appendChild(o);let f=document.createElement(`div`);f.className=`chc-scorecard-grid`;for(let e of t){let t=Wr({matchUp:i?BP(e):e,isLucky:!0,eventHandlers:r,composition:n});t.classList.add(`chc-scorecard-card`),f.appendChild(t)}return a.appendChild(f),a}function RP(e){if(e===1)return 2;if(e===2)return 1}function zP(e){if(e)return e.map(e=>({...e,side1Score:e.side2Score,side2Score:e.side1Score,side1TiebreakScore:e.side2TiebreakScore,side2TiebreakScore:e.side1TiebreakScore}))}function BP(e){let t=e.sides?.map(e=>({...e,sideNumber:e.sideNumber===1?2:1}));return{...e,sides:t,score:e.score?{...e.score,sets:zP(e.score.sets)}:e.score,winningSide:RP(e.winningSide)}}function VP(e,t){return e.sides?.find(e=>e.sideNumber===t)?.participant?.participantName}function HP(e){let{matchUpId:t,manager:n,baseMatchUp:r,onUpdate:i,showSituation:a}=e,o=document.createElement(`div`);o.className=`chc-inline-scoring-footer`;let s=document.createElement(`div`);s.className=`chc-inline-scoring-buttons`;let c=(e,t)=>{let n=document.createElement(`button`);return n.textContent=e,n.className=`chc-inline-scoring-btn ${t}`,n},l=c(`Undo`,`chc-is-undo`),u=c(`Redo`,`chc-is-redo`),d=c(`Clear`,`chc-is-clear`),f=c(`Submit`,`chc-is-submit`),p;a&&(p=document.createElement(`span`),p.className=`chc-inline-scoring-situation`),l.onclick=e=>{e.stopPropagation();let a=n.undo(t,r);a&&(i(a),m())},u.onclick=e=>{e.stopPropagation();let a=n.redo(t,r);a&&(i(a),m())},d.onclick=e=>{e.stopPropagation();let a=n.reset(t,r);a&&(i(a),m())},f.onclick=e=>{e.stopPropagation();let i=n.get(t);if(i){let e=n.getMatchUp(t,r);n.callbacks?.onSubmit?.({matchUpId:t,matchUp:e,engine:i.engine})}},s.append(l,u,d,f),o.appendChild(s),p&&o.appendChild(p);function m(){let e=n.canUndo(t),r=n.canRedo(t),i=n.isComplete(t);if(l.disabled=!e,u.disabled=!r,d.disabled=!e&&!r,p){let e=n.getSituation(t);if(e&&!i){let t=[e.isTiebreak&&`TB`,e.isBreakPoint&&`Break`,e.isGamePoint&&`Game`,e.isSetPoint&&`Set`,e.isMatchPoint&&`Match`].filter(Boolean);p.textContent=t.length?t.join(` • `):``}else p.textContent=i?`Complete`:``}}return m(),{element:o,update:m}}var UP=`chc-iss-score-cell`;function WP(e){if(!e?.matchUpId)throw Error(`buildInteractiveScoringShell: matchUpId is required`);if(!e?.matchUpFormat)throw Error(`buildInteractiveScoringShell: matchUpFormat is required`);let t=e.initialMatchUp??GP(e),n=new Set,r=new Zo({onScoreChange:({matchUp:e})=>{a(e,!1)},onMatchComplete:({winningSide:n})=>{a(r.getMatchUp(e.matchUpId,t),!0,n)}});r.getOrCreate(e.matchUpId,e.matchUpFormat,t);let i=document.createElement(`div`);i.className=`chc-interactive-scoring-shell`,i.dataset.matchupId=e.matchUpId,i.dataset.tournamentId=e.tournamentId,l();function a(t,r,i){let a={matchUpId:e.matchUpId,matchUp:t,isComplete:r,winningSide:i??t.winningSide},o=new CustomEvent(`stateChanged`,{detail:a});n.forEach(e=>{try{e(o)}catch(e){console.warn(`[interactive-scoring] listener threw`,e)}})}function o(n){r.isComplete(e.matchUpId)||(r.addPoint(e.matchUpId,n,t),l())}function s(){r.canUndo(e.matchUpId)&&(r.undo(e.matchUpId,t),l(),a(r.getMatchUp(e.matchUpId,t),r.isComplete(e.matchUpId)))}function c(){XP()&&(r.reset(e.matchUpId,t),l(),a(r.getMatchUp(e.matchUpId,t),!1))}function l(){i.innerHTML=``,i.append(KP(e),qP(r,e,t),JP(r,e,o),YP(r,e,s,c))}return{element:i,getState:()=>r.getMatchUp(e.matchUpId,t),reset:()=>{r.reset(e.matchUpId,t),l(),a(r.getMatchUp(e.matchUpId,t),!1)},destroy:()=>{n.clear(),r.remove(e.matchUpId),i.innerHTML=``},addEventListener:(e,t)=>{e===`stateChanged`&&n.add(t)},removeEventListener:(e,t)=>{e===`stateChanged`&&n.delete(t)}}}function GP(e){return{matchUpId:e.matchUpId,tournamentId:e.tournamentId,matchUpFormat:e.matchUpFormat,matchUpStatus:`TO_BE_PLAYED`,score:{sets:[]},sides:[{sideNumber:1,participant:{participantName:e.side1Name}},{sideNumber:2,participant:{participantName:e.side2Name}}]}}function KP(e){let t=document.createElement(`div`);t.className=`chc-iss-header`;let n=document.createElement(`div`);n.className=`chc-iss-header-side chc-iss-header-side1`,n.textContent=e.side1Name||`Side 1`;let r=document.createElement(`div`);r.className=`chc-iss-header-vs`,r.textContent=`vs`;let i=document.createElement(`div`);return i.className=`chc-iss-header-side chc-iss-header-side2`,i.textContent=e.side2Name||`Side 2`,t.append(n,r,i),t}function qP(e,t,n){let r=document.createElement(`div`);r.className=`chc-iss-score-display`;let i=e.getMatchUp(t.matchUpId,n),a=i.score?.sets??[],o=document.createElement(`div`);o.className=`chc-iss-score-grid`,o.style.setProperty(`--sets`,String(Math.max(a.length,1)));let s=document.createElement(`div`);s.className=`chc-iss-score-row chc-iss-score-row-side1`;let c=document.createElement(`div`);c.className=`chc-iss-score-row chc-iss-score-row-side2`;for(let e of a){let t=document.createElement(`div`);t.className=UP,t.textContent=String(e.side1Score??0),e.winningSide===1&&t.classList.add(`chc-iss-score-cell-won`),s.append(t);let n=document.createElement(`div`);n.className=UP,n.textContent=String(e.side2Score??0),e.winningSide===2&&n.classList.add(`chc-iss-score-cell-won`),c.append(n)}if(a.length===0){let e=document.createElement(`div`);e.className=UP,e.textContent=`0`,s.append(e);let t=document.createElement(`div`);t.className=UP,t.textContent=`0`,c.append(t)}o.append(s,c),r.append(o);let l=a.at(-1);if(l&&!l.winningSide&&l.side1PointScore!=null){let e=document.createElement(`div`);e.className=`chc-iss-game-score`;let t=document.createElement(`span`);t.className=`chc-iss-game-score-side1`,t.textContent=String(l.side1PointScore);let n=document.createElement(`span`);n.className=`chc-iss-game-score-sep`,n.textContent=` — `;let i=document.createElement(`span`);i.className=`chc-iss-game-score-side2`,i.textContent=String(l.side2PointScore),e.append(t,n,i),r.append(e)}if(e.isComplete(t.matchUpId)){let e=document.createElement(`div`);e.className=`chc-iss-match-complete`,e.textContent=`${(i.winningSide===1?t.side1Name:t.side2Name)||`Match`} wins`,r.append(e)}return r}function JP(e,t,n){let r=document.createElement(`div`);r.className=`chc-iss-point-buttons`;let i=e.isComplete(t.matchUpId),a=document.createElement(`button`);a.type=`button`,a.className=`chc-iss-point-button chc-iss-point-button-side1`,a.disabled=i,a.setAttribute(`aria-label`,`${t.side1Name} won the point`);let o=document.createElement(`span`);o.className=`chc-iss-point-button-label`,o.textContent=t.side1Name||`Side 1`;let s=document.createElement(`span`);s.className=`chc-iss-point-button-hint`,s.textContent=`won the point`,a.append(o,s),a.addEventListener(`click`,()=>n(0));let c=document.createElement(`button`);c.type=`button`,c.className=`chc-iss-point-button chc-iss-point-button-side2`,c.disabled=i,c.setAttribute(`aria-label`,`${t.side2Name} won the point`);let l=document.createElement(`span`);l.className=`chc-iss-point-button-label`,l.textContent=t.side2Name||`Side 2`;let u=document.createElement(`span`);return u.className=`chc-iss-point-button-hint`,u.textContent=`won the point`,c.append(l,u),c.addEventListener(`click`,()=>n(1)),r.append(a,c),r}function YP(e,t,n,r){let i=document.createElement(`div`);i.className=`chc-iss-control-bar`;let a=document.createElement(`button`);a.type=`button`,a.className=`chc-iss-control-button chc-iss-control-undo`,a.textContent=`Undo`,a.disabled=!e.canUndo(t.matchUpId),a.addEventListener(`click`,n);let o=document.createElement(`button`);return o.type=`button`,o.className=`chc-iss-control-button chc-iss-control-reset`,o.textContent=`Reset`,o.addEventListener(`click`,r),i.append(a,o),i}function XP(){return typeof globalThis>`u`||typeof globalThis.confirm!=`function`?!1:globalThis.confirm(`Reset the scoring session? This will clear all points.`)}function ZP(){return{policyName:`New Ranking Policy`,policyVersion:`1.0`,awardProfiles:[{profileName:`Default`,finishingPositionRanges:{1:100,2:70,4:50,8:30,16:15,32:8}}],requireWinForPoints:!0,doublesAttribution:`fullToEach`}}function Q(e){return structuredClone(e)}var QP=class{constructor(e){this.listeners=new Set,this.config=e;let t=Q(e.initialPolicy??ZP()),n=t.awardProfiles?.length??0;this.state={draft:t,expandedSections:new Set(n>5?[`awardProfiles`]:[`metadata`,`awardProfiles`,`qualityWinProfiles`,`aggregationRules`]),expandedProfiles:new Set(n<=5?Array.from({length:n},(e,t)=>t):[]),profileFilter:``,dirty:!1,readonly:e.readonly??!1}}getState(){return this.state}getData(){return Q(this.state.draft)}setData(e){let t=e.awardProfiles?.length??0;this.state={...this.state,draft:Q(e),expandedProfiles:new Set(t<=5?Array.from({length:t},(e,t)=>t):[]),profileFilter:``,dirty:!1},this.emit()}toggleSection(e){let t=new Set(this.state.expandedSections);t.has(e)?t.delete(e):t.add(e),this.state={...this.state,expandedSections:t},this.emit()}toggleProfile(e){let t=new Set(this.state.expandedProfiles);t.has(e)?t.delete(e):t.add(e),this.state={...this.state,expandedProfiles:t},this.emit()}setProfileFilter(e){this.state={...this.state,profileFilter:e},this.emit()}setPolicyName(e){let t=Q(this.state.draft);t.policyName=e,this.commitDraft(t)}setPolicyVersion(e){let t=Q(this.state.draft);t.policyVersion=e,this.commitDraft(t)}setValidDateRange(e,t){let n=Q(this.state.draft);n.validDateRange||={},n.validDateRange[e]=t||void 0,this.commitDraft(n)}setGlobalFlag(e,t){let n=Q(this.state.draft);n[e]=t,this.commitDraft(n)}setDoublesAttribution(e){let t=Q(this.state.draft);t.doublesAttribution=e||void 0,this.commitDraft(t)}setCategoryResolution(e){let t=Q(this.state.draft);t.categoryResolution=e||void 0,this.commitDraft(t)}addProfile(){let e=Q(this.state.draft);e.awardProfiles||=[],e.awardProfiles.push({profileName:`Profile ${e.awardProfiles.length+1}`,finishingPositionRanges:{1:100,2:70,4:50,8:30}});let t=new Set(this.state.expandedProfiles);t.add(e.awardProfiles.length-1),this.state={...this.state,expandedProfiles:t},this.commitDraft(e)}removeProfile(e){let t=Q(this.state.draft);if(!t.awardProfiles||e<0||e>=t.awardProfiles.length)return;t.awardProfiles.splice(e,1);let n=new Set;for(let t of this.state.expandedProfiles)t<e?n.add(t):t>e&&n.add(t-1);this.state={...this.state,expandedProfiles:n},this.commitDraft(t)}duplicateProfile(e){let t=Q(this.state.draft);if(!t.awardProfiles||e<0||e>=t.awardProfiles.length)return;let n=Q(t.awardProfiles[e]);n.profileName=`${n.profileName??`Profile`} (Copy)`,t.awardProfiles.splice(e+1,0,n);let r=new Set;for(let t of this.state.expandedProfiles)t<=e?r.add(t):r.add(t+1);r.add(e+1),this.state={...this.state,expandedProfiles:r},this.commitDraft(t)}moveProfile(e,t){let n=Q(this.state.draft);if(!n.awardProfiles||e<0||e>=n.awardProfiles.length||t<0||t>=n.awardProfiles.length)return;let[r]=n.awardProfiles.splice(e,1);n.awardProfiles.splice(t,0,r),this.commitDraft(n)}setProfileName(e,t){let n=Q(this.state.draft);n.awardProfiles?.[e]&&(n.awardProfiles[e].profileName=t,this.commitDraft(n))}setProfileFlag(e,t,n){let r=Q(this.state.draft);r.awardProfiles?.[e]&&(n===void 0?delete r.awardProfiles[e][t]:r.awardProfiles[e][t]=n,this.commitDraft(r))}setFlatPositionPoints(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e];i&&(i.finishingPositionRanges||={},i.finishingPositionRanges[t]=n,this.commitDraft(r))}addPositionRow(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];r&&(r.finishingPositionRanges||={},r.finishingPositionRanges[t]===void 0&&(r.finishingPositionRanges[t]=0,this.commitDraft(n)))}removePositionRow(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];r?.finishingPositionRanges&&(delete r.finishingPositionRanges[t],this.commitDraft(n))}setPointsPerWin(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];r&&(t===void 0?delete r.pointsPerWin:r.pointsPerWin=t,this.commitDraft(n))}addBonusPoint(e){let t=Q(this.state.draft),n=t.awardProfiles?.[e];n&&(n.bonusPoints||=[],n.bonusPoints.push({finishingPositions:[1],value:0}),this.commitDraft(t))}removeBonusPoint(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];r?.bonusPoints&&(r.bonusPoints.splice(t,1),r.bonusPoints.length||delete r.bonusPoints,this.commitDraft(n))}setBonusPointPositions(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e]?.bonusPoints?.[t];i&&(i.finishingPositions=n,this.commitDraft(r))}setBonusPointValue(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e]?.bonusPoints?.[t];i&&(i.value=n,this.commitDraft(r))}setLevelPositionPoints(e,t,n,r){let i=Q(this.state.draft),a=i.awardProfiles?.[e];if(!a)return;a.finishingPositionRanges||={};let o=a.finishingPositionRanges[t];o&&typeof o==`object`&&o.level&&(o.level[n]=r),this.commitDraft(i)}addLevel(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];if(r?.finishingPositionRanges){for(let e of Object.keys(r.finishingPositionRanges)){let n=r.finishingPositionRanges[e];n&&typeof n==`object`&&n.level&&n.level[t]===void 0&&(n.level[t]=0)}r.levels&&!r.levels.includes(t)&&(r.levels.push(t),r.levels.sort((e,t)=>e-t)),this.commitDraft(n)}}removeLevel(e,t){let n=Q(this.state.draft),r=n.awardProfiles?.[e];if(r?.finishingPositionRanges){for(let e of Object.keys(r.finishingPositionRanges)){let n=r.finishingPositionRanges[e];n&&typeof n==`object`&&n.level&&delete n.level[t]}r.levels&&=r.levels.filter(e=>e!==t),this.commitDraft(n)}}setProfileScope(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e];i&&(n.length?i[t]=n:delete i[t],this.commitDraft(r))}setProfileField(e,t,n){let r=Q(this.state.draft),i=r.awardProfiles?.[e];i&&(n===void 0||n===``?delete i[t]:i[t]=n,this.commitDraft(r))}addQualityWinProfile(){let e=Q(this.state.draft);e.qualityWinProfiles||=[],e.qualityWinProfiles.push({rankingScaleName:`New Profile`,rankingRanges:[{rankRange:[1,10],value:10}]}),this.commitDraft(e)}removeQualityWinProfile(e){let t=Q(this.state.draft);t.qualityWinProfiles&&(t.qualityWinProfiles.splice(e,1),t.qualityWinProfiles.length||delete t.qualityWinProfiles,this.commitDraft(t))}setQualityWinField(e,t,n){let r=Q(this.state.draft),i=r.qualityWinProfiles?.[e];i&&(n===void 0||n===``?delete i[t]:i[t]=n,this.commitDraft(r))}addQualityWinRange(e){let t=Q(this.state.draft),n=t.qualityWinProfiles?.[e];if(!n)return;let r=n.rankingRanges.at(-1),i=r?r.rankRange[1]+1:1;n.rankingRanges.push({rankRange:[i,i+9],value:0}),this.commitDraft(t)}removeQualityWinRange(e,t){let n=Q(this.state.draft),r=n.qualityWinProfiles?.[e];r&&(r.rankingRanges.splice(t,1),this.commitDraft(n))}setQualityWinRange(e,t,n,r){let i=Q(this.state.draft),a=i.qualityWinProfiles?.[e]?.rankingRanges?.[t];a&&(n===`rankRange`?a.rankRange=r:a.value=r,this.commitDraft(i))}setAggregationField(e,t){let n=Q(this.state.draft);n.aggregationRules||={},t===void 0||t===``?delete n.aggregationRules[e]:n.aggregationRules[e]=t,this.commitDraft(n)}addTiebreakCriterion(e){let t=Q(this.state.draft);t.aggregationRules||={},t.aggregationRules.tiebreakCriteria||(t.aggregationRules.tiebreakCriteria=[]),t.aggregationRules.tiebreakCriteria.push(e),this.commitDraft(t)}removeTiebreakCriterion(e){let t=Q(this.state.draft);t.aggregationRules?.tiebreakCriteria&&(t.aggregationRules.tiebreakCriteria.splice(e,1),t.aggregationRules.tiebreakCriteria.length||delete t.aggregationRules.tiebreakCriteria,this.commitDraft(t))}addCountingBucket(){let e=Q(this.state.draft);e.aggregationRules||={},e.aggregationRules.countingBuckets||(e.aggregationRules.countingBuckets=[]),e.aggregationRules.countingBuckets.push({bucketName:`New Bucket`}),this.commitDraft(e)}removeCountingBucket(e){let t=Q(this.state.draft);t.aggregationRules?.countingBuckets&&(t.aggregationRules.countingBuckets.splice(e,1),t.aggregationRules.countingBuckets.length||delete t.aggregationRules.countingBuckets,this.commitDraft(t))}setCountingBucketField(e,t,n){let r=Q(this.state.draft),i=r.aggregationRules?.countingBuckets?.[e];i&&(n===void 0||n===``?delete i[t]:i[t]=n,this.commitDraft(r))}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}commitDraft(e){this.state={...this.state,draft:e,dirty:!0},this.emit(),this.config.onChange?.(Q(e))}emit(){for(let e of this.listeners)e(this.state)}},$P=()=>`re-section`,eF=()=>`re-section-header`,tF=()=>`re-section-chevron`,nF=()=>`re-section-count`,rF=()=>`re-section-body`,iF=()=>`re-field-row`,aF=()=>`re-field-label`,oF=()=>`re-field-input re-field-input--text`,sF=()=>`re-field-input re-field-input--number`,cF=()=>`re-field-input re-field-input--date`,lF=()=>`re-field-select`,uF=()=>`re-checkbox-row`,dF=()=>`re-points-input`,fF=()=>`re-profile-card`,pF=()=>`re-profile-header`,mF=()=>`re-profile-name-input`,hF=()=>`re-profile-body`,gF=()=>`re-profile-actions`,_F=()=>`re-icon-btn`,vF=()=>`re-icon-btn re-icon-btn--danger`,yF=()=>`re-empty`,bF=()=>`re-editor`,xF=[`totalPoints`,`bestResult`,`headToHead`,`numberOfWins`,`recentResults`,`drawSize`,`numberOfResults`];function SF(e){let t=document.createElement(`div`),n=``;function r(t,n,r,i,a,o){let s=document.createElement(`div`);s.className=iF();let c=document.createElement(`div`);if(c.className=aF(),c.textContent=n,s.appendChild(c),o){let e=document.createElement(`span`);e.style.cssText=`font-size:0.85rem;color:var(--sp-text)`,e.textContent=String(i),s.appendChild(e)}else if(r===`select`){let n=document.createElement(`select`);n.className=lF();let r=document.createElement(`option`);r.value=``,r.textContent=`(none)`,n.appendChild(r);for(let e of a??[]){let t=document.createElement(`option`);t.value=e,t.textContent=e,n.appendChild(t)}n.value=i??``,n.addEventListener(`change`,()=>e.setAggregationField(t,n.value||void 0)),s.appendChild(n)}else{let n=document.createElement(`input`);n.type=`number`,n.className=sF(),n.value=i===void 0?``:String(i),n.placeholder=`—`,n.addEventListener(`change`,()=>{let r=n.value.trim();e.setAggregationField(t,r?Number.parseInt(r,10):void 0)}),s.appendChild(n)}return s}function i(n,r){let i=document.createElement(`div`);if(i.style.cssText=`font-weight:600;font-size:0.8rem;margin:0.5rem 0 0.3rem;color:var(--sp-text)`,i.textContent=`Tiebreak Order`,t.appendChild(i),n.length){let i=document.createElement(`ol`);i.style.cssText=`font-size:0.8rem;margin:0;padding-left:1.5rem;color:var(--sp-text)`;for(let t=0;t<n.length;t++){let a=document.createElement(`li`);a.style.cssText=`display:flex;align-items:center;gap:6px;margin-bottom:2px`;let o=document.createElement(`span`);if(o.textContent=n[t],a.appendChild(o),!r){let n=document.createElement(`span`);n.className=vF(),n.textContent=`×`,n.style.cursor=`pointer`,n.addEventListener(`click`,()=>e.removeTiebreakCriterion(t)),a.appendChild(n)}i.appendChild(a)}t.appendChild(i)}else if(r){let e=document.createElement(`div`);e.className=yF(),e.textContent=`No tiebreak criteria`,t.appendChild(e)}if(!r){let r=document.createElement(`div`);r.style.cssText=`display:flex;align-items:center;gap:4px;margin-top:4px`;let i=document.createElement(`select`);i.className=lF(),i.style.fontSize=`0.75rem`;let a=new Set(n),o=xF.filter(e=>!a.has(e));for(let e of o){let t=document.createElement(`option`);t.value=e,t.textContent=e,i.appendChild(t)}let s=document.createElement(`button`);s.className=`sp-btn sp-btn--sm sp-btn--outline`,s.textContent=`+ Add`,s.addEventListener(`click`,()=>{i.value&&e.addTiebreakCriterion(i.value)}),o.length&&(r.appendChild(i),r.appendChild(s),t.appendChild(r))}}function a(t,n,r){let i=document.createElement(`div`);i.style.cssText=`border:1px solid var(--sp-border);border-radius:8px;padding:0.4rem;margin-bottom:0.4rem;font-size:0.8rem`;let a=document.createElement(`div`);if(a.style.cssText=`display:flex;align-items:center;gap:6px;margin-bottom:0.2rem`,r){let e=document.createElement(`span`);e.style.cssText=`font-weight:600;color:var(--sp-text)`,e.textContent=t.bucketName||`Bucket`,a.appendChild(e)}else{let r=document.createElement(`input`);r.type=`text`,r.className=`re-field-input re-field-input--text`,r.style.cssText=`width:120px;font-size:0.75rem;font-weight:600`,r.value=t.bucketName||``,r.placeholder=`Bucket name`,r.addEventListener(`change`,()=>e.setCountingBucketField(n,`bucketName`,r.value)),a.appendChild(r);let i=document.createElement(`div`);i.style.flexGrow=`1`,a.appendChild(i);let o=document.createElement(`span`);o.className=vF(),o.textContent=`✕`,o.style.cursor=`pointer`,o.addEventListener(`click`,()=>e.removeCountingBucket(n)),a.appendChild(o)}i.appendChild(a);let o=[];if(t.eventTypes?.length&&o.push(`Events: ${t.eventTypes.join(`, `)}`),t.bestOfCount!==void 0&&o.push(`Best of: ${t.bestOfCount}`),t.levels?.length&&o.push(`Levels: ${t.levels.join(`, `)}`),t.minResults!==void 0&&o.push(`Min: ${t.minResults}`),r&&o.length){let e=document.createElement(`div`);e.style.cssText=`color:var(--sp-muted);font-size:0.75rem`,e.textContent=o.join(` | `),i.appendChild(e)}else if(!r){let r=document.createElement(`div`);r.className=iF();let a=document.createElement(`div`);a.className=aF(),a.style.cssText=`min-width:70px;font-size:0.75rem`,a.textContent=`Best of`,r.appendChild(a);let o=document.createElement(`input`);o.type=`number`,o.className=sF(),o.style.fontSize=`0.75rem`,o.value=t.bestOfCount===void 0?``:String(t.bestOfCount),o.addEventListener(`change`,()=>{let t=o.value.trim();e.setCountingBucketField(n,`bestOfCount`,t?Number.parseInt(t,10):void 0)}),r.appendChild(o),i.appendChild(r)}return i}function o(n){let o=n.draft.aggregationRules;if(t.innerHTML=``,!o&&n.readonly){let e=document.createElement(`div`);e.className=yF(),e.textContent=`No aggregation rules defined (all results summed)`,t.appendChild(e);return}let s=[[`rollingPeriodDays`,`Rolling period (days)`,`number`,o?.rollingPeriodDays],[`bestOfCount`,`Best of count`,`number`,o?.bestOfCount],[`minCountableResults`,`Min countable results`,`number`,o?.minCountableResults],[`decayFunction`,`Decay function`,`select`,o?.decayFunction,[`none`,`linear`,`exponential`,`step`]]];for(let[e,i,a,o,c]of s)o===void 0&&n.readonly||t.appendChild(r(e,i,a,o,c,n.readonly));let c=[[`separateByGender`,`Separate by gender`,o?.separateByGender],[`perCategory`,`Per category`,o?.perCategory]];for(let[r,i,a]of c){if(a===void 0&&n.readonly)continue;let o=document.createElement(`div`);o.className=uF();let s=document.createElement(`input`);s.type=`checkbox`,s.checked=a??!1,s.disabled=n.readonly,s.addEventListener(`change`,()=>e.setAggregationField(r,s.checked));let c=document.createElement(`label`);c.textContent=i,o.appendChild(s),o.appendChild(c),t.appendChild(o)}i(o?.tiebreakCriteria??[],n.readonly);let l=o?.countingBuckets??[];if(l.length||!n.readonly){let r=document.createElement(`div`);r.style.cssText=`font-weight:600;font-size:0.8rem;margin:0.5rem 0 0.3rem;color:var(--sp-text)`,r.textContent=`Counting Buckets`,t.appendChild(r);for(let e=0;e<l.length;e++)t.appendChild(a(l[e],e,n.readonly));if(!n.readonly){let n=document.createElement(`button`);n.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,n.textContent=`+ Add Bucket`,n.addEventListener(`click`,()=>e.addCountingBucket()),t.appendChild(n)}}}function s(e){let t=JSON.stringify(e.draft.aggregationRules??{});t!==n&&(n=t,o(e))}return{element:t,update:s}}function CF(e){let t=document.createElement(`div`),n=``;function r(t,n,r){let i=document.createElement(`div`);if(i.style.cssText=`display:flex;align-items:center;gap:0.5rem;margin-bottom:0.4rem`,r){let e=document.createElement(`span`);e.style.cssText=`font-weight:600;font-size:0.85rem;color:var(--sp-text)`,e.textContent=n.rankingScaleName,i.appendChild(e)}else{let r=document.createElement(`input`);r.type=`text`,r.className=oF(),r.style.cssText=`width:150px;font-weight:600`,r.value=n.rankingScaleName,r.addEventListener(`change`,()=>e.setQualityWinField(t,`rankingScaleName`,r.value)),i.appendChild(r);let a=document.createElement(`div`);a.style.flexGrow=`1`,i.appendChild(a);let o=document.createElement(`span`);o.className=vF(),o.textContent=`✕`,o.title=`Delete profile`,o.style.cursor=`pointer`,o.addEventListener(`click`,()=>e.removeQualityWinProfile(t)),i.appendChild(o)}return i}let i=`text-align:right;padding:2px 4px`,a=`text-align:right;width:4rem`;function o(t,n,r,a){let o=document.createElement(`tr`);if(a)for(let e of[r.rankRange[0],r.rankRange[1],r.value]){let t=document.createElement(`td`);t.style.cssText=`text-align:right;font-variant-numeric:tabular-nums;padding:2px 4px`,t.textContent=e.toLocaleString(),o.appendChild(t)}else{let a=document.createElement(`td`);a.style.cssText=i,a.appendChild(wF(r.rankRange[0],i=>{e.setQualityWinRange(t,n,`rankRange`,[i,r.rankRange[1]])})),o.appendChild(a);let s=document.createElement(`td`);s.style.cssText=i,s.appendChild(wF(r.rankRange[1],i=>{e.setQualityWinRange(t,n,`rankRange`,[r.rankRange[0],i])})),o.appendChild(s);let c=document.createElement(`td`);c.style.cssText=i,c.appendChild(wF(r.value,r=>{e.setQualityWinRange(t,n,`value`,r)})),o.appendChild(c);let l=document.createElement(`td`);l.style.cssText=`text-align:center;padding:2px`;let u=document.createElement(`span`);u.className=vF(),u.textContent=`×`,u.style.cursor=`pointer`,u.addEventListener(`click`,()=>e.removeQualityWinRange(t,n)),l.appendChild(u),o.appendChild(l)}return o}function s(e,t,n){let r=document.createElement(`table`);r.style.cssText=`font-size:0.8rem;margin-bottom:0.3rem;border-collapse:collapse`;let i=document.createElement(`thead`),s=document.createElement(`tr`);for(let[e,t]of[[`From`,a],[`To`,a],[`Bonus`,a]]){let n=document.createElement(`th`);n.textContent=e,n.style.cssText=t+`;padding:2px 4px`,s.appendChild(n)}if(!n){let e=document.createElement(`th`);e.style.cssText=`width:2rem;padding:2px`,s.appendChild(e)}i.appendChild(s),r.appendChild(i);let c=document.createElement(`tbody`);for(let r=0;r<t.rankingRanges.length;r++)c.appendChild(o(e,r,t.rankingRanges[r],n));return r.appendChild(c),r}function c(t,n,r,i,a){let o=document.createElement(`div`);o.className=iF();let s=document.createElement(`div`);if(s.className=aF(),s.style.minWidth=`100px`,s.style.fontSize=`0.75rem`,s.textContent=r,o.appendChild(s),a){let e=document.createElement(`span`);e.style.cssText=`font-size:0.75rem;color:var(--sp-muted)`,e.textContent=String(i),o.appendChild(e)}else{let r=document.createElement(`input`);r.type=typeof i==`number`?`number`:`text`,r.className=typeof i==`number`?sF():oF(),r.style.fontSize=`0.75rem`,r.value=i===void 0?``:String(i),r.addEventListener(`change`,()=>{let a=r.value.trim();typeof i==`number`||n===`maxBonusPerTournament`?e.setQualityWinField(t,n,a?Number.parseFloat(a):void 0):e.setQualityWinField(t,n,a||void 0)}),o.appendChild(r)}return o}function l(n){let i=n.draft.qualityWinProfiles;if(t.innerHTML=``,!i?.length){let r=document.createElement(`div`);if(r.className=yF(),r.textContent=`No quality win profiles defined`,t.appendChild(r),!n.readonly){let n=document.createElement(`button`);n.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,n.textContent=`+ Add Quality Win Profile`,n.addEventListener(`click`,()=>e.addQualityWinProfile()),t.appendChild(n)}return}for(let a=0;a<i.length;a++){let o=i[a],l=document.createElement(`div`);if(l.style.cssText=`border:1px solid var(--sp-border);border-radius:10px;padding:0.5rem;margin-bottom:0.5rem`,l.appendChild(r(a,o,n.readonly)),o.rankingRanges?.length&&(l.appendChild(s(a,o,n.readonly)),!n.readonly)){let t=document.createElement(`button`);t.className=`sp-btn sp-btn--sm sp-btn--outline`,t.textContent=`+ Range`,t.style.marginBottom=`0.3rem`,t.addEventListener(`click`,()=>e.addQualityWinRange(a)),l.appendChild(t)}let u=[[`maxBonusPerTournament`,`Max bonus/tournament`,o.maxBonusPerTournament],[`rankingSnapshot`,`Ranking snapshot`,o.rankingSnapshot]];for(let[e,t,r]of u)r===void 0&&n.readonly||l.appendChild(c(a,e,t,r,n.readonly));if(o.includeWalkovers!==void 0||!n.readonly){let t=document.createElement(`div`);t.className=uF();let r=document.createElement(`input`);r.type=`checkbox`,r.checked=o.includeWalkovers??!1,r.disabled=n.readonly,r.addEventListener(`change`,()=>e.setQualityWinField(a,`includeWalkovers`,r.checked));let i=document.createElement(`label`);i.textContent=`Include walkovers`,i.style.fontSize=`0.75rem`,t.appendChild(r),t.appendChild(i),l.appendChild(t)}t.appendChild(l)}if(!n.readonly){let n=document.createElement(`button`);n.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,n.textContent=`+ Add Quality Win Profile`,n.addEventListener(`click`,()=>e.addQualityWinProfile()),t.appendChild(n)}}function u(e){let t=JSON.stringify(e.draft.qualityWinProfiles??[]);t!==n&&(n=t,l(e))}return{element:t,update:u}}function wF(e,t){let n=document.createElement(`input`);return n.type=`number`,n.className=dF(),n.value=String(e),n.addEventListener(`change`,()=>{let e=Number.parseFloat(n.value);Number.isNaN(e)||t(e)}),n}function TF(e){let t=document.createElement(`div`),n=document.createElement(`div`);n.className=iF();let r=document.createElement(`div`);r.className=aF(),r.textContent=`Name`;let i=document.createElement(`input`);i.type=`text`,i.className=oF(),i.placeholder=`Policy name`,i.addEventListener(`change`,()=>e.setPolicyName(i.value)),n.appendChild(r),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=iF();let o=document.createElement(`div`);o.className=aF(),o.textContent=`Version`;let s=document.createElement(`input`);s.type=`text`,s.className=oF(),s.placeholder=`1.0`,s.style.width=`80px`,s.addEventListener(`change`,()=>e.setPolicyVersion(s.value)),a.appendChild(o),a.appendChild(s),t.appendChild(a);let c=document.createElement(`div`);c.className=iF();let l=document.createElement(`div`);l.className=aF(),l.textContent=`Valid from`;let u=document.createElement(`input`);u.type=`date`,u.className=cF(),u.addEventListener(`change`,()=>e.setValidDateRange(`startDate`,u.value)),c.appendChild(l),c.appendChild(u),t.appendChild(c);let d=document.createElement(`div`);d.className=iF();let f=document.createElement(`div`);f.className=aF(),f.textContent=`Valid until`;let p=document.createElement(`input`);p.type=`date`,p.className=cF(),p.addEventListener(`change`,()=>e.setValidDateRange(`endDate`,p.value)),d.appendChild(f),d.appendChild(p),t.appendChild(d);let m=document.createElement(`div`);m.className=iF();let h=document.createElement(`div`);h.className=aF(),h.textContent=`Doubles attribution`;let g=document.createElement(`select`);g.className=lF();for(let[e,t]of[[``,`(none)`],[`fullToEach`,`Full to each`],[`halfToEach`,`Half to each`],[`split`,`Split`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,g.appendChild(n)}g.addEventListener(`change`,()=>e.setDoublesAttribution(g.value)),m.appendChild(h),m.appendChild(g),t.appendChild(m);let _=document.createElement(`div`);_.className=iF();let v=document.createElement(`div`);v.className=aF(),v.textContent=`Category resolution`;let y=document.createElement(`select`);y.className=lF();for(let[e,t]of[[``,`(none)`],[`matchCategory`,`Match category`],[`eventCategory`,`Event category`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,y.appendChild(n)}y.addEventListener(`change`,()=>e.setCategoryResolution(y.value)),_.appendChild(v),_.appendChild(y),t.appendChild(_);let b=document.createElement(`div`);b.className=uF();let x=document.createElement(`input`);x.type=`checkbox`,x.id=`re-require-win`;let S=document.createElement(`label`);S.htmlFor=`re-require-win`,S.textContent=`Require win for points`,x.addEventListener(`change`,()=>e.setGlobalFlag(`requireWinForPoints`,x.checked)),b.appendChild(x),b.appendChild(S),t.appendChild(b);let C=document.createElement(`div`);C.className=uF();let w=document.createElement(`input`);w.type=`checkbox`,w.id=`re-require-win-r1`;let T=document.createElement(`label`);T.htmlFor=`re-require-win-r1`,T.textContent=`Require win in first round`,w.addEventListener(`change`,()=>e.setGlobalFlag(`requireWinFirstRound`,w.checked)),C.appendChild(w),C.appendChild(T),t.appendChild(C);let E=[i,s,u,p],D=[g,y],O=[x,w];function k(e){let{draft:t}=e;document.activeElement!==i&&(i.value=t.policyName??``),document.activeElement!==s&&(s.value=t.policyVersion??``),document.activeElement!==u&&(u.value=t.validDateRange?.startDate??``),document.activeElement!==p&&(p.value=t.validDateRange?.endDate??``),document.activeElement!==g&&(g.value=t.doublesAttribution??``),document.activeElement!==y&&(y.value=t.categoryResolution??``),x.checked=t.requireWinForPoints??!1,w.checked=t.requireWinFirstRound??!1;let n=e.readonly;for(let e of E)e.disabled=n;for(let e of D)e.disabled=n;for(let e of O)e.disabled=n}return{element:t,update:k}}var EF={1:`W`,2:`F`,4:`SF`,8:`QF`,16:`R16`,32:`R32`,64:`R64`,128:`R128`,256:`R256`},DF=`level-keyed`;function OF(e){return EF[e]??`R${e}`}function kF(e){if(!e)return{type:`flat`};let t=Object.values(e);if(!t.length||t.every(e=>typeof e==`number`))return{type:`flat`};let n=AF(t);return n.hasConditionalArray?{type:`conditional`}:n.hasLevelFlightNesting?jF(t,n.allLevels):n.allLevels.size>0?{type:`level-columns`,levels:[...n.allLevels].sort((e,t)=>e-t)}:n.allFlights.size>0?{type:`flight-columns`,flights:[...n.allFlights].sort((e,t)=>e-t)}:{type:`flat`}}function AF(e){let t=new Set,n=new Set,r=!1,i=!1;for(let a of e){let e=MF(a);if(e.type===DF){for(let n of e.levels)t.add(n);e.hasFlightNesting&&(i=!0)}else if(e.type===`flight-keyed`)for(let t=0;t<e.flightCount;t++)n.add(t+1);else e.type===`conditional-array`&&(r=!0)}return{allLevels:t,allFlights:n,hasConditionalArray:r,hasLevelFlightNesting:i}}function jF(e,t){let n={},r=[...t].sort((e,t)=>e-t);for(let t of e){let e=MF(t);if(e.type===DF&&e.flightDetails)for(let[t,r]of Object.entries(e.flightDetails)){let e=Number(t);n[e]||(n[e]=[]);for(let t of r)n[e].includes(t)||n[e].push(t)}}return{type:`level-flight-tabs`,levels:r,flightsPerLevel:n}}function MF(e){if(typeof e==`number`)return{type:`flat`,levels:[],flightCount:0,hasFlightNesting:!1};if(Array.isArray(e))return{type:`conditional-array`,levels:[],flightCount:0,hasFlightNesting:!1};if(typeof e!=`object`||!e)return{type:`flat`,levels:[],flightCount:0,hasFlightNesting:!1};if(e.level!==void 0){if(Array.isArray(e.level))return{type:DF,levels:e.level.map((e,t)=>t+1),flightCount:0,hasFlightNesting:!1};if(typeof e.level==`object`){let t=Object.keys(e.level).map(Number).filter(e=>!Number.isNaN(e)),n=!1,r={};for(let[t,i]of Object.entries(e.level))typeof i==`object`&&i&&i.flights&&(n=!0,r[Number(t)]=i.flights.map((e,t)=>t+1));return{type:DF,levels:t,flightCount:0,hasFlightNesting:n,flightDetails:r}}}return e.flights!==void 0||e.f!==void 0?{type:`flight-keyed`,levels:[],flightCount:(e.flights??e.f??[]).length,hasFlightNesting:!1}:e.value===void 0?{type:`flat`,levels:[],flightCount:0,hasFlightNesting:!1}:{type:`explicit-flat`,levels:[],flightCount:0,hasFlightNesting:!1}}function NF(e,t={}){if(typeof e==`number`)return e;if(e!=null){if(Array.isArray(e))return PF(e,t);if(typeof e==`object`){if(e.level!==void 0&&t.level!==void 0)return FF(e,t);if(t.flight!==void 0){let n=e.flights??e.f;if(Array.isArray(n))return n[t.flight-1]}if(e.value!==void 0)return e.value}}}function PF(e,t){for(let n of e){if(n.drawSizes&&t.drawSize&&n.drawSizes.includes(t.drawSize))return NF(n,t);if(n.drawSize!==void 0&&t.drawSize!==void 0&&(n.threshold?t.drawSize>=n.drawSize:t.drawSize===n.drawSize))return NF({...n,drawSize:void 0,drawSizes:void 0,threshold:void 0},t);if(n.drawSize===void 0&&n.drawSizes===void 0)return NF(n,t)}}function FF(e,t){let n=Array.isArray(e.level)?e.level[t.level-1]:e.level[t.level];if(n!==void 0)return typeof n==`object`&&n?NF(n,t):typeof n==`number`?n:void 0}function IF(e){let t=[],n=Object.keys(e.finishingPositionRanges??{}).length;return n&&t.push(`${n} positions`),(e.perWinPoints||e.pointsPerWin)&&t.push(`per-win`),e.bonusPoints?.length&&t.push(`${e.bonusPoints.length} bonus`),t.join(`, `)||`empty`}function LF(e){let t=[];for(let n of e.eventTypes??[])t.push({label:n,intent:`re-badge--accent`});for(let n of e.stages??[])t.push({label:n,intent:`re-badge--success`});for(let n of e.levels??[])t.push({label:`L${n}`,intent:`re-badge--warn`});for(let n of e.drawTypes??[])t.push({label:n.replaceAll(`_`,` `),intent:`re-badge--primary`});return e.participationOrder!==void 0&&t.push({label:`PO:${e.participationOrder}`,intent:`re-badge--info`}),t}function RF(e){return e==null?`--`:e.toLocaleString()}var zF=[1,2,4,8,16,32,64,128],BF=`font-size:0.8rem;margin-bottom:0;border-collapse:collapse`,VF=`width:3.5rem;text-align:center`;function HF(e,t){let n=document.createElement(`div`);n.style.cssText=`overflow-x:auto`;let r=``;function i(r){let i=r.draft.awardProfiles?.[t]?.finishingPositionRanges;if(n.innerHTML=``,!i||!Object.keys(i).length){let i=document.createElement(`div`);if(i.className=yF(),i.textContent=`No finishing position points defined`,!r.readonly){let n=document.createElement(`button`);n.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,n.textContent=`+ Add position`,n.style.marginLeft=`8px`,n.addEventListener(`click`,()=>e.addPositionRow(t,1)),i.appendChild(n)}n.appendChild(i);return}let a=kF(i),o=Object.keys(i).map(Number).sort((e,t)=>e-t);a.type===`flat`?UF(n,o,i,r.readonly,e,t):a.type===`level-columns`?WF(n,o,i,a.levels,r.readonly,e,t):GF(n,o,i,a)}function a(e){let n=e.draft.awardProfiles?.[t],a=JSON.stringify(n?.finishingPositionRanges??{});a!==r&&(r=a,i(e))}return{element:n,update:a}}function UF(e,t,n,r,i,a){let o=document.createElement(`table`);o.style.cssText=BF;let s=document.createElement(`thead`),c=document.createElement(`tr`);KF(c,`Pos`,VF),KF(c,`Points`,`text-align:right`),r||KF(c,``,`width:2rem`),s.appendChild(c),o.appendChild(s);let l=document.createElement(`tbody`);for(let e of t){let t=document.createElement(`tr`);qF(t,e);let o=document.createElement(`td`);o.style.cssText=`text-align:right;padding:2px 4px`,r?(o.style.fontVariantNumeric=`tabular-nums`,o.textContent=RF(typeof n[e]==`number`?n[e]:NF(n[e]))):o.appendChild(YF(typeof n[e]==`number`?n[e]:NF(n[e])??0,t=>i.setFlatPositionPoints(a,e,t))),t.appendChild(o),r||JF(t,()=>i.removePositionRow(a,e)),l.appendChild(t)}o.appendChild(l),e.appendChild(o),r||XF(e,t,i,a)}function WF(e,t,n,r,i,a,o){let s=document.createElement(`table`);s.style.cssText=BF;let c=document.createElement(`thead`),l=document.createElement(`tr`);KF(l,`Pos`,VF);for(let e of r){let t=document.createElement(`th`);if(t.style.cssText=`text-align:right;min-width:3.5rem;padding:2px 4px`,i)t.textContent=`L${e}`;else{let n=document.createElement(`div`);n.style.cssText=`display:flex;align-items:center;justify-content:flex-end;gap:4px`;let r=document.createElement(`span`);r.textContent=`L${e}`,n.appendChild(r);let i=document.createElement(`span`);i.className=vF(),i.textContent=`×`,i.title=`Remove level ${e}`,i.style.cssText=`cursor:pointer;font-size:0.65rem`,i.addEventListener(`click`,()=>a.removeLevel(o,e)),n.appendChild(i),t.appendChild(n)}l.appendChild(t)}i||KF(l,``,`width:2rem`),c.appendChild(l),s.appendChild(c);let u=document.createElement(`tbody`);for(let e of t){let t=document.createElement(`tr`);qF(t,e);for(let s of r){let r=document.createElement(`td`);r.style.cssText=`text-align:right;padding:2px 4px`;let c=NF(n[e],{level:s});i?(r.style.fontVariantNumeric=`tabular-nums`,r.textContent=RF(c),c===void 0&&(r.style.color=`var(--sp-muted)`)):r.appendChild(YF(c??0,t=>a.setLevelPositionPoints(o,e,s,t))),t.appendChild(r)}i||JF(t,()=>a.removePositionRow(o,e)),u.appendChild(t)}if(s.appendChild(u),e.appendChild(s),!i){let n=document.createElement(`div`);n.style.cssText=`display:flex;gap:8px;margin-top:6px;flex-wrap:wrap`;let i=document.createElement(`div`);i.style.cssText=`display:flex;align-items:center;gap:4px`;let s=document.createElement(`input`);s.type=`number`,s.className=dF(),s.style.width=`50px`,s.placeholder=`L#`,s.min=`1`;let c=document.createElement(`button`);c.className=`sp-btn sp-btn--sm sp-btn--outline`,c.textContent=`+ Level`,c.addEventListener(`click`,()=>{let e=Number.parseInt(s.value,10);!Number.isNaN(e)&&e>0&&!r.includes(e)&&(a.addLevel(o,e),s.value=``)}),i.appendChild(s),i.appendChild(c),n.appendChild(i),ZF(n,t,a,o),e.appendChild(n)}}function GF(e,t,n,r){let i=document.createElement(`div`);i.style.cssText=`font-size:0.7rem;color:var(--sp-muted);margin-bottom:4px;font-style:italic`,i.textContent=`(${r.type} layout — view only)`,e.appendChild(i);let a=document.createElement(`table`);a.style.cssText=BF;let o=document.createElement(`thead`),s=document.createElement(`tr`);if(KF(s,`Pos`,VF),r.type===`flight-columns`)for(let e of r.flights)KF(s,`F${e}`,`text-align:right;min-width:3.5rem`);else KF(s,`Points`,`text-align:right`);o.appendChild(s),a.appendChild(o);let c=document.createElement(`tbody`);for(let e of t){let t=document.createElement(`tr`);qF(t,e);let i=n[e];if(r.type===`flight-columns`)for(let e of r.flights){let n=document.createElement(`td`);n.style.cssText=`text-align:right;font-variant-numeric:tabular-nums;padding:2px 4px`;let r=NF(i,{flight:e});n.textContent=RF(r),r===void 0&&(n.style.color=`var(--sp-muted)`),t.appendChild(n)}else{let e=document.createElement(`td`);if(e.style.cssText=`text-align:right;font-variant-numeric:tabular-nums;padding:2px 4px`,e.textContent=RF(NF(i)),Array.isArray(i)){let t=document.createElement(`span`);t.style.cssText=`margin-left:0.3rem;font-size:0.65rem;color:var(--sp-muted)`,t.textContent=`${i.length} variants`,t.title=JSON.stringify(i,null,2),e.appendChild(t)}t.appendChild(e)}c.appendChild(t)}a.appendChild(c),e.appendChild(a)}function KF(e,t,n){let r=document.createElement(`th`);r.textContent=t,r.style.cssText=n+`;padding:2px 4px`,e.appendChild(r)}function qF(e,t){let n=document.createElement(`td`);n.style.cssText=`text-align:center;font-weight:600;color:var(--sp-text);padding:2px 4px`,n.textContent=OF(t),e.appendChild(n)}function JF(e,t){let n=document.createElement(`td`);n.style.cssText=`text-align:center;vertical-align:middle;padding:2px`;let r=document.createElement(`span`);r.className=vF(),r.textContent=`×`,r.title=`Remove position`,r.style.cursor=`pointer`,r.addEventListener(`click`,t),n.appendChild(r),e.appendChild(n)}function YF(e,t){let n=document.createElement(`input`);return n.type=`number`,n.className=dF(),n.value=String(e),n.addEventListener(`change`,()=>{let e=Number.parseFloat(n.value);Number.isNaN(e)||t(e)}),n}function XF(e,t,n,r){let i=document.createElement(`div`);i.style.cssText=`display:flex;gap:8px;margin-top:6px;flex-wrap:wrap`,ZF(i,t,n,r),e.appendChild(i)}function ZF(e,t,n,r){let i=new Set(t),a=zF.filter(e=>!i.has(e));if(!a.length)return;let o=document.createElement(`div`);o.style.cssText=`display:flex;align-items:center;gap:4px`;let s=document.createElement(`select`);s.className=`re-field-select`,s.style.cssText=`min-width:80px;font-size:11px;padding:4px 6px`;for(let e of a){let t=document.createElement(`option`);t.value=String(e),t.textContent=OF(e),s.appendChild(t)}let c=document.createElement(`button`);c.className=`sp-btn sp-btn--sm sp-btn--outline`,c.textContent=`+ Position`,c.addEventListener(`click`,()=>{let e=Number.parseInt(s.value,10);Number.isNaN(e)||n.addPositionRow(r,e)}),o.appendChild(s),o.appendChild(c),e.appendChild(o)}function QF(e,t){let n=document.createElement(`div`);n.style.cssText=`padding:0.25rem 0;font-size:0.8rem`;let r=document.createElement(`div`);r.className=iF();let i=document.createElement(`div`);i.className=aF(),i.textContent=`Per-Win`,i.style.minWidth=`80px`;let a=document.createElement(`input`);a.type=`number`,a.className=dF(),a.placeholder=`—`,a.addEventListener(`change`,()=>{let n=a.value.trim();e.setPointsPerWin(t,n===``?void 0:parseFloat(n))});let o=document.createElement(`div`);o.style.cssText=`font-size:0.75rem;color:var(--sp-muted)`,r.appendChild(i),r.appendChild(a),n.appendChild(r),n.appendChild(o);function s(e){let r=e.draft.awardProfiles?.[t];if(!r){n.style.display=`none`;return}let i=r.perWinPoints,s=r.pointsPerWin;if(!i&&s===void 0){n.style.display=`none`;return}if(n.style.display=``,a.disabled=e.readonly,s!==void 0&&typeof s==`number`?(a.style.display=``,o.style.display=`none`,document.activeElement!==a&&(a.value=String(s))):s===void 0?i&&(a.style.display=`none`,o.style.display=``,o.textContent=(Array.isArray(i)?i:[i]).map(e=>{let t=[];return e.participationOrders?.length&&t.push(`PO:${e.participationOrders.join(`,`)}`),e.value!==void 0&&t.push(`${e.value} pts/win`),e.limit!==void 0&&t.push(`limit: ${e.limit}`),t.join(` | `)}).join(`; `)):(a.style.display=`none`,o.style.display=``,o.textContent=`${RF(NF(s))} pts/win (complex)`),r.maxCountableMatches!==void 0){let e=typeof r.maxCountableMatches==`number`?r.maxCountableMatches:`level-keyed`;o.style.display=``;let t=o.textContent;o.textContent=t?`${t} — max countable: ${e}`:`Max countable: ${e}`}}return{element:n,update:s}}function $F(e,t){let n=document.createElement(`div`);n.style.cssText=`padding:0.25rem 0;font-size:0.8rem`;let r=``;function i(r){let i=r.draft.awardProfiles?.[t]?.bonusPoints;if(n.innerHTML=``,!i?.length&&r.readonly){n.style.display=`none`;return}n.style.display=``;let a=document.createElement(`div`);if(a.style.cssText=`font-weight:600;color:var(--sp-text);margin-bottom:4px`,a.textContent=`Bonus Points`,n.appendChild(a),i?.length)for(let a=0;a<i.length;a++){let o=i[a],s=document.createElement(`div`);if(s.style.cssText=`display:flex;align-items:center;gap:6px;margin-bottom:4px;padding-left:0.5rem`,r.readonly){let e=o.finishingPositions.map(OF).join(`, `),t=document.createElement(`span`);t.textContent=`${e}: `,s.appendChild(t);let n=document.createElement(`span`);n.style.fontVariantNumeric=`tabular-nums`,n.textContent=typeof o.value==`number`?o.value.toLocaleString():String(o.value??`—`),s.appendChild(n)}else{let n=document.createElement(`span`);n.style.cssText=`font-size:0.75rem;color:var(--sp-muted);min-width:30px`,n.textContent=`Pos:`,s.appendChild(n);let r=document.createElement(`input`);r.type=`text`,r.className=dF(),r.style.width=`80px`,r.value=o.finishingPositions.join(`, `),r.title=`Comma-separated positions (e.g. 1, 2)`,r.addEventListener(`change`,()=>{let n=r.value.split(`,`).map(e=>Number.parseInt(e.trim(),10)).filter(e=>!Number.isNaN(e)&&e>0);n.length&&e.setBonusPointPositions(t,a,n)}),s.appendChild(r);let i=document.createElement(`span`);i.style.cssText=`font-size:0.75rem;color:var(--sp-muted)`,i.textContent=`Pts:`,s.appendChild(i);let c=document.createElement(`input`);c.type=`number`,c.className=dF(),c.value=typeof o.value==`number`?String(o.value):``,c.addEventListener(`change`,()=>{let n=Number.parseFloat(c.value);Number.isNaN(n)||e.setBonusPointValue(t,a,n)}),s.appendChild(c);let l=document.createElement(`span`);l.className=vF(),l.textContent=`×`,l.title=`Remove bonus`,l.style.cursor=`pointer`,l.addEventListener(`click`,()=>e.removeBonusPoint(t,a)),s.appendChild(l)}n.appendChild(s)}if(!r.readonly){let r=document.createElement(`button`);r.className=`sp-btn sp-btn--sm sp-btn--outline`,r.textContent=`+ Add bonus`,r.style.cssText=`margin-top:4px;margin-left:0.5rem`,r.addEventListener(`click`,()=>e.addBonusPoint(t)),n.appendChild(r)}}function a(e){let n=e.draft.awardProfiles?.[t],a=JSON.stringify(n?.bonusPoints??[]);a!==r&&(r=a,i(e))}return{element:n,update:a}}function eI(e){let t=document.createElement(`div`);t.style.cssText=`display:inline-flex;gap:0.25rem;flex-wrap:wrap;margin-bottom:0`;let n=LF(e);if(!n.length){let e=document.createElement(`span`);return e.className=`re-badge re-badge--neutral`,e.textContent=`All`,t.appendChild(e),t}for(let e of n){let n=document.createElement(`span`);n.className=`re-badge ${e.intent}`,n.textContent=e.label,t.appendChild(n)}return t}var tI=[{field:`eventTypes`,label:`Event types`,options:[`SINGLES`,`DOUBLES`,`TEAM`]},{field:`drawTypes`,label:`Draw types`,options:[`SINGLE_ELIMINATION`,`DOUBLE_ELIMINATION`,`ROUND_ROBIN`,`COMPASS`,`FEED_IN`,`AD_HOC`,`LUCKY_DRAW`]},{field:`stages`,label:`Stages`,options:[`MAIN`,`QUALIFYING`,`CONSOLATION`,`PLAY_OFF`]},{field:`levels`,label:`Levels`,options:[],isNumeric:!0}],nI=[[`maxDrawSize`,`Max draw size`],[`maxLevel`,`Max level`],[`priority`,`Priority`],[`participationOrder`,`Participation order`]];function rI(e,t){let n=document.createElement(`div`);n.style.cssText=`padding:0.25rem 0`;let r=document.createElement(`div`);r.style.cssText=`font-weight:600;font-size:0.8rem;color:var(--sp-text);margin-bottom:4px`,r.textContent=`Scope`,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=``;function o(n,r){if(n.isNumeric){let i=document.createElement(`input`);return i.type=`number`,i.min=`1`,i.placeholder=`+`,i.style.cssText=`width:36px;font-size:0.7rem;padding:2px 4px;border:1px dashed var(--sp-border);border-radius:4px;background:transparent;color:var(--sp-text);outline:none;text-align:center`,i.addEventListener(`keydown`,a=>{if(a.key===`Enter`){let a=Number.parseInt(i.value,10);!Number.isNaN(a)&&a>0&&!r.includes(a)&&(e.setProfileScope(t,n.field,[...r,a].sort((e,t)=>e-t)),i.value=``)}}),i}let i=n.options.filter(e=>!r.includes(e));if(!i.length)return;let a=document.createElement(`select`);a.style.cssText=`font-size:0.65rem;padding:2px 4px;border:1px dashed var(--sp-border);border-radius:4px;background:transparent;color:var(--sp-muted);outline:none;cursor:pointer`;let o=document.createElement(`option`);o.value=``,o.textContent=`+`,a.appendChild(o);for(let e of i){let t=document.createElement(`option`);t.value=e,t.textContent=e,a.appendChild(t)}return a.addEventListener(`change`,()=>{a.value&&e.setProfileScope(t,n.field,[...r,a.value])}),a}function s(n,r,i){let a=document.createElement(`div`);a.style.cssText=`margin-bottom:6px`;let s=document.createElement(`div`);s.style.cssText=`font-size:0.7rem;color:var(--sp-muted);margin-bottom:2px`,s.textContent=n.label,a.appendChild(s);let c=document.createElement(`div`);c.style.cssText=`display:flex;flex-wrap:wrap;gap:4px;align-items:center`;for(let a of r){let o=document.createElement(`span`);if(o.className=`re-badge re-badge--accent`,o.style.cssText=`display:inline-flex;align-items:center;gap:3px`,o.textContent=n.isNumeric?`L${a}`:String(a),!i){let i=document.createElement(`span`);i.style.cssText=`cursor:pointer;font-size:0.6rem;opacity:0.7`,i.textContent=`×`,i.addEventListener(`click`,()=>{e.setProfileScope(t,n.field,r.filter(e=>e!==a))}),o.appendChild(i)}c.appendChild(o)}if(!i){let e=o(n,r);e&&c.appendChild(e)}return a.appendChild(c),a}function c(r){i.innerHTML=``;let a=r.draft.awardProfiles?.[t];if(!a)return;let o=r.readonly;for(let e of tI){let t=a[e.field]??[];o&&!t.length||i.appendChild(s(e,t,o))}for(let[n,r]of nI){let s=a[n];if(o&&s===void 0)continue;let c=document.createElement(`div`);c.className=iF();let l=document.createElement(`div`);if(l.className=aF(),l.style.cssText=`min-width:110px;font-size:0.75rem`,l.textContent=r,c.appendChild(l),o){let e=document.createElement(`span`);e.style.cssText=`font-size:0.75rem;color:var(--sp-text)`,e.textContent=String(s),c.appendChild(e)}else{let r=document.createElement(`input`);r.type=`number`,r.className=sF(),r.style.fontSize=`0.75rem`,r.value=s===void 0?``:String(s),r.placeholder=`—`,r.addEventListener(`change`,()=>{let i=r.value.trim();e.setProfileField(t,n,i?Number.parseInt(i,10):void 0)}),c.appendChild(r)}i.appendChild(c)}let c=i.children.length>0;n.style.display=c?``:`none`}function l(e){let n=e.draft.awardProfiles?.[t],r=tI.map(e=>n?.[e.field]??[]),i=nI.map(([e])=>n?.[e]),o=JSON.stringify([r,i,e.readonly]);o!==a&&(a=o,c(e))}return{element:n,update:l}}function iI(e,t){let n=document.createElement(`div`);n.className=fF();let r=document.createElement(`div`);r.className=pF();let i=document.createElement(`span`);i.className=tF(),i.style.flexShrink=`0`,r.appendChild(i);let a=document.createElement(`input`);a.type=`text`,a.className=mF(),a.addEventListener(`click`,e=>e.stopPropagation()),a.addEventListener(`change`,()=>e.setProfileName(t,a.value)),r.appendChild(a);let o=document.createElement(`div`);o.style.cssText=`flex-grow:1;display:inline-flex;gap:0.25rem;flex-wrap:wrap`,r.appendChild(o);let s=document.createElement(`span`);s.style.cssText=`font-size:0.75rem;color:var(--sp-muted);white-space:nowrap;flex-shrink:0`,r.appendChild(s);let c=document.createElement(`div`);c.className=gF();let l=document.createElement(`button`);l.className=_F(),l.textContent=`⎘`,l.title=`Duplicate profile`,l.addEventListener(`click`,n=>{n.stopPropagation(),e.duplicateProfile(t)});let u=document.createElement(`button`);u.className=vF(),u.textContent=`✕`,u.title=`Delete profile`,u.addEventListener(`click`,n=>{n.stopPropagation(),e.removeProfile(t)}),c.appendChild(l),c.appendChild(u),r.appendChild(c),r.addEventListener(`click`,()=>e.toggleProfile(t)),n.appendChild(r);let d=document.createElement(`div`);d.className=hF();let f=document.createElement(`div`);f.style.cssText=`font-weight:600;font-size:0.85rem;color:var(--sp-text);margin-bottom:6px`,d.appendChild(f);let p=HF(e,t);d.appendChild(p.element);let m=QF(e,t);d.appendChild(m.element);let h=$F(e,t);d.appendChild(h.element);let g=rI(e,t);d.appendChild(g.element);let _=document.createElement(`div`);_.style.cssText=`padding:0.25rem 0;font-size:0.75rem;color:var(--sp-muted)`,d.appendChild(_),n.appendChild(d);function v(e){let r=e.draft.awardProfiles?.[t];if(!r){n.style.display=`none`;return}n.style.display=``;let l=e.expandedProfiles.has(t),u=e.readonly;i.textContent=l?`▼`:`▶`;let v=r.profileName||`Profile ${t+1}`;document.activeElement!==a&&(a.value=v),a.title=v,a.disabled=u,o.innerHTML=``;let y=eI(r);if(y.style.flexGrow=`1`,o.appendChild(y),s.textContent=l?``:IF(r),c.style.display=u?`none`:`flex`,d.style.display=l?``:`none`,l){f.textContent=v,p.update(e),m.update(e),h.update(e),g.update(e);let t=[];r.requireWinForPoints!==void 0&&t.push(`requireWin: ${r.requireWinForPoints}`),r.requireWinFirstRound!==void 0&&t.push(`requireWinR1: ${r.requireWinFirstRound}`),_.textContent=t.join(` | `),_.style.display=t.length?``:`none`}}return{element:n,update:v}}function aI(e,t){let n=document.createElement(`div`);n.className=bF();let r=TF(e),i=CF(e),a=SF(e),o=[{id:`metadata`,label:`Metadata`},{id:`awardProfiles`,label:`Award Profiles`,countFn:e=>e.draft.awardProfiles?.length??0},{id:`qualityWinProfiles`,label:`Quality Win Profiles`,countFn:e=>e.draft.qualityWinProfiles?.length??0},{id:`aggregationRules`,label:`Aggregation Rules`}],s=[];for(let t of o){let o=document.createElement(`div`);o.className=$P();let c=document.createElement(`div`);c.className=eF();let l=document.createElement(`span`);l.className=tF();let u=document.createElement(`span`);u.textContent=t.label;let d=document.createElement(`span`);d.className=nF(),c.appendChild(l),c.appendChild(u),c.appendChild(d),c.addEventListener(`click`,()=>e.toggleSection(t.id));let f=document.createElement(`div`);f.className=rF(),t.id===`metadata`&&f.appendChild(r.element),t.id===`qualityWinProfiles`&&f.appendChild(i.element),t.id===`aggregationRules`&&f.appendChild(a.element),o.appendChild(c),o.appendChild(f),n.appendChild(o),s.push({id:t.id,chevron:l,countEl:d,bodyEl:f})}let c=[],l=-1,u=``,d=null;function f(e,t){for(let n=0;n<o.length;n++){let r=o[n],i=s[n],a=e.has(r.id);if(i.chevron.textContent=a?`▼`:`▶`,i.bodyEl.style.display=a?`block`:`none`,r.countFn){let e=r.countFn(t);i.countEl.textContent=e?`(${e})`:``}}}function p(t,n){let r=s[1].bodyEl;r.innerHTML=``,c=[];let i=t.draft.awardProfiles??[],a=0;for(let t=0;t<i.length;t++){let o=i[t];if(n&&![o.profileName??``,...o.eventTypes??[],...o.stages??[],...(o.levels??[]).map(e=>`L${e}`),...o.drawTypes??[]].join(` `).toLowerCase().includes(n))continue;let s=iI(e,t);c.push(s),r.appendChild(s.element),a++}if(!a){let e=document.createElement(`div`);e.className=yF(),e.textContent=n?`No profiles match filter`:`No award profiles defined`,r.appendChild(e)}t.readonly||(d=document.createElement(`button`),d.className=`sp-btn sp-btn--sm sp-btn--outline re-add-btn`,d.textContent=`+ Add Profile`,d.addEventListener(`click`,()=>e.addProfile()),r.appendChild(d))}return{element:n,update:e=>{let{draft:t,expandedSections:n,profileFilter:o}=e;if(f(n,e),n.has(`metadata`)&&r.update(e),n.has(`awardProfiles`)){let n=t.awardProfiles?.length??0,r=o.toLowerCase();(n!==l||r!==u)&&(l=n,u=r,p(e,r));for(let t of c)t.update(e);d&&(d.style.display=e.readonly?`none`:``)}n.has(`qualityWinProfiles`)&&i.update(e),n.has(`aggregationRules`)&&a.update(e)}}}var oI=class e{constructor(e){this.container=null,this.store=new QP(e),this.panel=aI(this.store,e),this.unsubscribe=this.store.subscribe(e=>{this.panel.update(e)}),this.panel.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.panel.element)}destroy(){this.unsubscribe(),this.container&&this.panel.element.parentNode===this.container&&this.panel.element.remove(),this.container=null}getData(){return this.store.getData()}setData(e){this.store.setData(e)}getStore(){return this.store}static createEditorInstance(t){let n=new e({initialPolicy:t.initialData,onChange:e=>t.onChange(e),readonly:t.readonly});return{element:n.panel.element,setData(e){n.setData(e)},getData(){return n.getData()},destroy(){n.destroy()}}}};function sI(e){return cI[e]??e}var cI={"SET3-S:6/TB7":`Best of 3 TB sets`,"SET3-S:6/TB7-F:TB10":`2 TB sets, MTB10`,"SET3-S:6/TB7-F:TB7":`2 TB sets, MTB7`,"SET3-S:4NOAD-F:TB7":`2 short sets (4, NOAD), MTB7`,"SET3-S:4/TB7":`Best of 3 short sets (4)`,"SET3-S:4/TB7-F:TB7":`2 short sets (4), MTB7`,"SET3-S:4/TB7-F:TB10":`2 short sets (4), MTB10`,"SET3-S:4/TB5@3":`3 short sets (4), TB5@3`,"SET1-S:8/TB7":`8-game pro-set, TB7`,"SET1-S:8/TB7@7":`8-game pro-set, TB7@7`,"SET1-S:5/TB9@4":`1 set to 5, TB9@4`,"SET1-S:6/TB7":`1 TB set`,"SET1-S:6NOAD":`1 set to 6, NOAD`,"SET1-S:4/TB7":`1 short set (4), TB7`,"SET1-S:4/TB5@3":`1 short set (4), TB5@3`,"SET1-S:4NOAD":`1 short set (4), NOAD`,"SET3-S:TB10":`Best of 3 TB10 games`,"SET1-S:T20":`Timed 20 min`,"SET1-S:TB10":`1 TB10 game`,"SET5-S:6/TB7":`Best of 5 TB sets`,"SET5-S:6/TB7-F:TB10":`5 sets, MTB10`,"SET1-S:6/TB10":`1 set, TB10`,"SET1-S:8":`Pro-set to 8`,"SET1-S:10":`Pro-set to 10`,"SET1-S:T7":`TB7 only`,"SET1-S:T21":`TB21 only`};function lI(){return{allowModificationWhenMatchUpsScheduled:{courts:!1,venues:!1},defaultTimes:{averageTimes:[{categoryNames:[],minutes:{default:90}}],recoveryTimes:[{minutes:{default:60}}]},defaultDailyLimits:{SINGLES:2,DOUBLES:2,total:3},matchUpAverageTimes:[],matchUpRecoveryTimes:[],matchUpDailyLimits:[]}}function $(e){return structuredClone(e)}var uI=class{constructor(e){this.listeners=new Set,this.config=e,this.state={draft:$(e.initialPolicy??lI()),expandedSections:new Set([`modificationFlags`,`dailyLimits`,`defaultTimes`,`averageTimes`,`recoveryTimes`]),dirty:!1}}getState(){return this.state}getData(){return $(this.state.draft)}setData(e){this.state={...this.state,draft:$(e),dirty:!1},this.emit()}toggleSection(e){let t=new Set(this.state.expandedSections);t.has(e)?t.delete(e):t.add(e),this.state={...this.state,expandedSections:t},this.emit()}setModificationFlag(e,t){let n=$(this.state.draft);n.allowModificationWhenMatchUpsScheduled||={courts:!1,venues:!1},n.allowModificationWhenMatchUpsScheduled[e]=t,this.commitDraft(n)}setDailyLimit(e,t){let n=$(this.state.draft);n.defaultDailyLimits||={},n.defaultDailyLimits[e]=t,this.commitDraft(n)}setDefaultAverageTime(e,t,n){let r=$(this.state.draft);r.defaultTimes||={},r.defaultTimes.averageTimes||(r.defaultTimes.averageTimes=[{categoryNames:[],minutes:{default:90}}]);let i=r.defaultTimes.averageTimes[e];i&&(t===`DOUBLES`?n===void 0?delete i.minutes.DOUBLES:i.minutes.DOUBLES=n:i.minutes.default=n??0,this.commitDraft(r))}setDefaultRecoveryTime(e,t,n){let r=$(this.state.draft);r.defaultTimes||={},r.defaultTimes.recoveryTimes||(r.defaultTimes.recoveryTimes=[{minutes:{default:60}}]);let i=r.defaultTimes.recoveryTimes[e];i&&(t===`DOUBLES`?n===void 0?delete i.minutes.DOUBLES:i.minutes.DOUBLES=n:i.minutes.default=n??0,this.commitDraft(r))}addAverageFormatGroup(){let e=$(this.state.draft);e.matchUpAverageTimes||=[],e.matchUpAverageTimes.push({matchUpFormatCodes:[],averageTimes:[{categoryNames:[],minutes:{default:60}}]}),this.commitDraft(e)}removeAverageFormatGroup(e){let t=$(this.state.draft);t.matchUpAverageTimes&&(t.matchUpAverageTimes.splice(e,1),this.commitDraft(t))}setAverageFormatCodes(e,t){let n=$(this.state.draft),r=n.matchUpAverageTimes?.[e];r&&(r.matchUpFormatCodes=t,this.commitDraft(n))}setAverageTime(e,t,n,r){let i=$(this.state.draft),a=i.matchUpAverageTimes?.[e]?.averageTimes?.[t];a&&(n===`DOUBLES`?r===void 0?delete a.minutes.DOUBLES:a.minutes.DOUBLES=r:a.minutes.default=r??0,this.commitDraft(i))}addAverageCategoryOverride(e){let t=$(this.state.draft),n=t.matchUpAverageTimes?.[e];n&&(n.averageTimes.push({categoryTypes:[],minutes:{default:60}}),this.commitDraft(t))}removeAverageCategoryOverride(e,t){let n=$(this.state.draft),r=n.matchUpAverageTimes?.[e];r&&(r.averageTimes.splice(t,1),this.commitDraft(n))}setAverageOverrideCategories(e,t,n,r){let i=$(this.state.draft),a=i.matchUpAverageTimes?.[e]?.averageTimes?.[t];a&&(n===`categoryNames`?(delete a.categoryTypes,a.categoryNames=r):(delete a.categoryNames,a.categoryTypes=r),this.commitDraft(i))}addRecoveryFormatGroup(){let e=$(this.state.draft);e.matchUpRecoveryTimes||=[],e.matchUpRecoveryTimes.push({matchUpFormatCodes:[],recoveryTimes:[{categoryNames:[],minutes:{default:30}}]}),this.commitDraft(e)}removeRecoveryFormatGroup(e){let t=$(this.state.draft);t.matchUpRecoveryTimes&&(t.matchUpRecoveryTimes.splice(e,1),this.commitDraft(t))}setRecoveryFormatCodes(e,t){let n=$(this.state.draft),r=n.matchUpRecoveryTimes?.[e];r&&(r.matchUpFormatCodes=t,this.commitDraft(n))}setRecoveryTime(e,t,n,r){let i=$(this.state.draft),a=i.matchUpRecoveryTimes?.[e]?.recoveryTimes?.[t];a&&(n===`DOUBLES`?r===void 0?delete a.minutes.DOUBLES:a.minutes.DOUBLES=r:a.minutes.default=r??0,this.commitDraft(i))}addRecoveryCategoryOverride(e){let t=$(this.state.draft),n=t.matchUpRecoveryTimes?.[e];n&&(n.recoveryTimes.push({categoryTypes:[],minutes:{default:30}}),this.commitDraft(t))}removeRecoveryCategoryOverride(e,t){let n=$(this.state.draft),r=n.matchUpRecoveryTimes?.[e];r&&(r.recoveryTimes.splice(t,1),this.commitDraft(n))}setRecoveryOverrideCategories(e,t,n,r){let i=$(this.state.draft),a=i.matchUpRecoveryTimes?.[e]?.recoveryTimes?.[t];a&&(n===`categoryNames`?(delete a.categoryTypes,a.categoryNames=r):(delete a.categoryNames,a.categoryTypes=r),this.commitDraft(i))}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}commitDraft(e){this.state={...this.state,draft:e,dirty:!0},this.emit(),this.config.onChange?.($(e))}emit(){for(let e of this.listeners)e(this.state)}},dI=()=>`se-section`,fI=()=>`se-section-header`,pI=()=>`se-section-chevron`,mI=()=>`se-section-body`,hI=()=>`se-field-row`,gI=()=>`se-field-label`,_I=()=>`se-field-input`,vI=()=>`se-field-unit`,yI=()=>`se-checkbox-row`,bI=()=>`se-format-group`,xI=()=>`se-format-group-header`,SI=()=>`se-format-group-label`,CI=()=>`se-tag-picker`,wI=()=>`sp-chip`,TI=()=>`sp-chip__remove`,EI=()=>`se-tag-add-wrap`,DI=()=>`sp-btn-icon`,OI=()=>`se-override-row`,kI=()=>`se-override-categories`,AI=()=>`se-override-remove`,jI=()=>`sp-btn sp-btn--sm sp-btn--outline se-add-btn`,MI=()=>`sp-btn-icon sp-btn-icon--danger`,NI=()=>`se-editor`;function PI(e){let t=document.createElement(`div`),n=document.createElement(`div`);n.className=yI();let r=document.createElement(`input`);r.type=`checkbox`,r.id=`se-mod-courts`;let i=document.createElement(`label`);i.htmlFor=`se-mod-courts`,i.textContent=`Allow court modifications when matchUps scheduled`,r.addEventListener(`change`,()=>{e.setModificationFlag(`courts`,r.checked)}),n.appendChild(r),n.appendChild(i);let a=document.createElement(`div`);a.className=yI();let o=document.createElement(`input`);o.type=`checkbox`,o.id=`se-mod-venues`;let s=document.createElement(`label`);s.htmlFor=`se-mod-venues`,s.textContent=`Allow venue modifications when matchUps scheduled`,o.addEventListener(`change`,()=>{e.setModificationFlag(`venues`,o.checked)}),a.appendChild(o),a.appendChild(s),t.appendChild(n),t.appendChild(a);function c(e){let t=e.draft.allowModificationWhenMatchUpsScheduled;r.checked=t?.courts??!1,o.checked=t?.venues??!1}return{element:t,update:c}}var FI=`is-success`,II=`is-danger`;function LI(e){if(e===``)return!0;let t=parseInt(e,10);return!isNaN(t)&&t>=0&&String(t)===e.trim()}function RI(e,t){if(t===``){e.classList.remove(FI,II);return}LI(t)?(e.classList.remove(II),e.classList.add(FI)):(e.classList.remove(FI),e.classList.add(II))}function zI(e){let t=document.createElement(`div`),n=[];for(let[r,i]of[[`SINGLES`,`Singles limit`],[`DOUBLES`,`Doubles limit`],[`total`,`Total limit`]]){let a=document.createElement(`div`);a.className=hI();let o=document.createElement(`div`);o.className=gI(),o.textContent=i;let s=document.createElement(`input`);s.type=`text`,s.className=_I(),s.placeholder=`0`,s.addEventListener(`input`,()=>{RI(s,s.value)}),s.addEventListener(`change`,()=>{let t=parseInt(s.value,10);!isNaN(t)&&t>=0&&e.setDailyLimit(r,t)}),a.appendChild(o),a.appendChild(s),t.appendChild(a),n.push({key:r,label:i,input:s})}function r(e){let t=e.draft.defaultDailyLimits;for(let e of n){let n=t?.[e.key];document.activeElement!==e.input&&(e.input.value=n===void 0?``:String(n))}}return{element:t,update:r}}var BI=`is-success`,VI=`is-danger`;function HI(e){if(e===``)return!0;let t=parseInt(e,10);return!isNaN(t)&&t>=0&&String(t)===e.trim()}function UI(e,t,n){if(t===``&&n){e.classList.remove(BI,VI);return}HI(t)&&(t!==``||n)?(e.classList.remove(VI),e.classList.add(BI)):(e.classList.remove(BI),e.classList.add(VI))}function WI(e){let t=document.createElement(`div`),n=document.createElement(`div`);n.style.cssText=`font-size:11px;font-weight:700;color:var(--sp-muted);margin-bottom:6px;`,n.textContent=`Default Average Times`,t.appendChild(n);let r=GI(`Default`,`min`,!1),i=GI(`Doubles override`,`min`,!0);t.appendChild(r.row),t.appendChild(i.row),r.input.addEventListener(`input`,()=>{UI(r.input,r.input.value,!1)}),r.input.addEventListener(`change`,()=>{let t=parseInt(r.input.value,10);!isNaN(t)&&t>=0&&e.setDefaultAverageTime(0,`default`,t)}),i.input.addEventListener(`input`,()=>{UI(i.input,i.input.value,!0)}),i.input.addEventListener(`change`,()=>{let t=i.input.value.trim();if(t===``||t===`-`)e.setDefaultAverageTime(0,`DOUBLES`,void 0);else{let n=parseInt(t,10);!isNaN(n)&&n>=0&&e.setDefaultAverageTime(0,`DOUBLES`,n)}});let a=document.createElement(`div`);a.style.height=`12px`,t.appendChild(a);let o=document.createElement(`div`);o.style.cssText=`font-size:11px;font-weight:700;color:var(--sp-muted);margin-bottom:6px;`,o.textContent=`Default Recovery Times`,t.appendChild(o);let s=GI(`Default`,`min`,!1),c=GI(`Doubles override`,`min`,!0);t.appendChild(s.row),t.appendChild(c.row),s.input.addEventListener(`input`,()=>{UI(s.input,s.input.value,!1)}),s.input.addEventListener(`change`,()=>{let t=parseInt(s.input.value,10);!isNaN(t)&&t>=0&&e.setDefaultRecoveryTime(0,`default`,t)}),c.input.addEventListener(`input`,()=>{UI(c.input,c.input.value,!0)}),c.input.addEventListener(`change`,()=>{let t=c.input.value.trim();if(t===``||t===`-`)e.setDefaultRecoveryTime(0,`DOUBLES`,void 0);else{let n=parseInt(t,10);!isNaN(n)&&n>=0&&e.setDefaultRecoveryTime(0,`DOUBLES`,n)}});function l(e){let t=e.draft.defaultTimes?.averageTimes?.[0];document.activeElement!==r.input&&(r.input.value=t?String(t.minutes.default):``),document.activeElement!==i.input&&(i.input.value=t?.minutes.DOUBLES===void 0?``:String(t.minutes.DOUBLES)),i.input.placeholder=`—`;let n=e.draft.defaultTimes?.recoveryTimes?.[0];document.activeElement!==s.input&&(s.input.value=n?String(n.minutes.default):``),document.activeElement!==c.input&&(c.input.value=n?.minutes.DOUBLES===void 0?``:String(n.minutes.DOUBLES)),c.input.placeholder=`—`}return{element:t,update:l}}function GI(e,t,n){let r=document.createElement(`div`);r.className=hI();let i=document.createElement(`div`);i.className=gI(),i.textContent=e;let a=document.createElement(`input`);a.type=`text`,a.className=_I(),a.placeholder=n?`—`:`0`;let o=document.createElement(`div`);return o.className=vI(),o.textContent=t,r.appendChild(i),r.appendChild(a),r.appendChild(o),{row:r,input:a}}var KI=`is-success`,qI=`is-danger`;function JI(e){if(e===``)return!0;let t=parseInt(e,10);return!isNaN(t)&&t>=0&&String(t)===e.trim()}function YI(e,t,n){if(t===``&&n){e.classList.remove(KI,qI);return}JI(t)&&(t!==``||n)?(e.classList.remove(qI),e.classList.add(KI)):(e.classList.remove(KI),e.classList.add(qI))}function XI(e){let t=document.createElement(`div`);t.className=bI();let n=document.createElement(`div`);n.className=xI();let r=document.createElement(`div`);r.style.flex=`1`;let i=document.createElement(`div`);i.className=SI(),i.textContent=`Formats`,r.appendChild(i);let a=document.createElement(`div`);a.className=CI();for(let t of e.formatCodes){let n=document.createElement(`span`);n.className=wI(),n.title=`${t} — click to edit`;let r=document.createElement(`span`);r.textContent=sI(t),n.addEventListener(`click`,()=>{Ca({existingMatchUpFormat:t,callback:n=>{if(!n||n===t)return;let r=e.formatCodes.map(e=>e===t?n:e);e.onFormatCodesChange(r)}})});let i=document.createElement(`span`);i.className=TI(),i.textContent=`×`,i.addEventListener(`click`,n=>{n.stopPropagation(),e.onFormatCodesChange(e.formatCodes.filter(e=>e!==t))}),n.appendChild(r),n.appendChild(i),a.appendChild(n)}let o=document.createElement(`div`);o.className=EI();let s=document.createElement(`button`);s.className=DI(),s.textContent=`+`,s.type=`button`,s.title=`Add format code`,s.addEventListener(`click`,t=>{t.stopPropagation(),Ca({existingMatchUpFormat:`SET3-S:6/TB7`,callback:t=>{t&&!e.formatCodes.includes(t)&&e.onFormatCodesChange([...e.formatCodes,t])}})}),o.appendChild(s),a.appendChild(o),r.appendChild(a);let c=document.createElement(`button`);c.className=MI(),c.textContent=`×`,c.type=`button`,c.title=`Remove format group`,c.addEventListener(`click`,()=>e.onRemoveGroup()),n.appendChild(r),n.appendChild(c),t.appendChild(n);for(let n=0;n<e.overrides.length;n++){let r=e.overrides[n],i=document.createElement(`div`);i.className=OI();let a=document.createElement(`div`);a.className=`${kI()}${r.isDefault?` all`:``}`,a.textContent=r.categoryLabel;let o=document.createElement(`input`);o.type=`text`,o.className=_I(),o.value=String(r.defaultMinutes),o.placeholder=`0`;let s=n;o.addEventListener(`input`,()=>{YI(o,o.value,!1)}),o.addEventListener(`change`,()=>{let t=parseInt(o.value,10);!isNaN(t)&&t>=0&&e.onTimeChange(s,`default`,t)});let c=document.createElement(`span`);c.className=vI(),c.textContent=`min`;let l=document.createElement(`span`);l.style.cssText=`font-size:11px;color:var(--sp-muted);margin-left:8px;`,l.textContent=`Doubles:`;let u=document.createElement(`input`);if(u.type=`text`,u.className=_I(),u.value=r.doublesMinutes===void 0?``:String(r.doublesMinutes),u.placeholder=`—`,u.addEventListener(`input`,()=>{YI(u,u.value,!0)}),u.addEventListener(`change`,()=>{let t=u.value.trim();if(t===``||t===`-`)e.onTimeChange(s,`DOUBLES`,void 0);else{let n=parseInt(t,10);!isNaN(n)&&n>=0&&e.onTimeChange(s,`DOUBLES`,n)}}),i.appendChild(a),i.appendChild(o),i.appendChild(c),i.appendChild(l),i.appendChild(u),!r.isDefault){let t=document.createElement(`span`);t.className=AI(),t.textContent=`×`,t.addEventListener(`click`,()=>e.onRemoveOverride(s)),i.appendChild(t)}t.appendChild(i)}let l=document.createElement(`button`);return l.className=jI(),l.textContent=`+ Add Override`,l.type=`button`,l.addEventListener(`click`,()=>e.onAddOverride()),t.appendChild(l),t}function ZI(e,t){let n=document.createElement(`div`),r=document.createElement(`div`);n.appendChild(r);let i=document.createElement(`button`);i.className=jI(),i.textContent=`+ Add Format Group`,i.type=`button`,i.addEventListener(`click`,()=>e.addAverageFormatGroup()),n.appendChild(i);function a(n){r.innerHTML=``;let i=n.draft.matchUpAverageTimes??[];for(let n=0;n<i.length;n++){let a=i[n],o=a.averageTimes.map((e,t)=>{let n=e.categoryTypes??e.categoryNames??[];return{categoryLabel:n.length===0&&t===0?`All categories`:n.join(`, `)||`All categories`,isDefault:n.length===0&&t===0,defaultMinutes:e.minutes.default,doublesMinutes:e.minutes.DOUBLES}}),s=n,c=XI({formatCodes:a.matchUpFormatCodes,overrides:o,availableFormats:t.matchUpFormatCodes??QI(),onFormatCodesChange:t=>e.setAverageFormatCodes(s,t),onTimeChange:(t,n,r)=>e.setAverageTime(s,t,n,r),onAddOverride:()=>e.addAverageCategoryOverride(s),onRemoveOverride:t=>e.removeAverageCategoryOverride(s,t),onRemoveGroup:()=>e.removeAverageFormatGroup(s)});r.appendChild(c)}if(i.length===0){let e=document.createElement(`div`);e.style.cssText=`font-size:12px;color:var(--sp-muted);padding:8px 0;`,e.textContent=`No format-specific average times configured. Add a format group to set per-format times.`,r.appendChild(e)}}return{element:n,update:a}}function QI(){return[`SET3-S:6/TB7`,`SET3-S:6/TB7-F:TB10`,`SET3-S:6/TB7-F:TB7`,`SET3-S:4NOAD-F:TB7`,`SET3-S:4/TB7`,`SET3-S:4/TB7-F:TB7`,`SET3-S:4/TB7-F:TB10`,`SET3-S:4/TB5@3`,`SET1-S:8/TB7`,`SET1-S:8/TB7@7`,`SET1-S:5/TB9@4`,`SET1-S:6/TB7`,`SET1-S:6NOAD`,`SET1-S:4/TB7`,`SET1-S:4/TB5@3`,`SET1-S:4NOAD`,`SET3-S:TB10`,`SET1-S:T20`,`SET1-S:TB10`]}function $I(e,t){let n=document.createElement(`div`),r=document.createElement(`div`);n.appendChild(r);let i=document.createElement(`button`);i.className=jI(),i.textContent=`+ Add Format Group`,i.type=`button`,i.addEventListener(`click`,()=>e.addRecoveryFormatGroup()),n.appendChild(i);function a(n){r.innerHTML=``;let i=n.draft.matchUpRecoveryTimes??[];for(let n=0;n<i.length;n++){let a=i[n],o=a.recoveryTimes.map((e,t)=>{let n=e.categoryTypes??e.categoryNames??[];return{categoryLabel:n.length===0&&t===0?`All categories`:n.join(`, `)||`All categories`,isDefault:n.length===0&&t===0,defaultMinutes:e.minutes.default,doublesMinutes:e.minutes.DOUBLES}}),s=n,c=XI({formatCodes:a.matchUpFormatCodes,overrides:o,availableFormats:t.matchUpFormatCodes??eL(),onFormatCodesChange:t=>e.setRecoveryFormatCodes(s,t),onTimeChange:(t,n,r)=>e.setRecoveryTime(s,t,n,r),onAddOverride:()=>e.addRecoveryCategoryOverride(s),onRemoveOverride:t=>e.removeRecoveryCategoryOverride(s,t),onRemoveGroup:()=>e.removeRecoveryFormatGroup(s)});r.appendChild(c)}if(i.length===0){let e=document.createElement(`div`);e.style.cssText=`font-size:12px;color:var(--sp-muted);padding:8px 0;`,e.textContent=`No format-specific recovery times configured. Add a format group to set per-format recovery.`,r.appendChild(e)}}return{element:n,update:a}}function eL(){return[`SET3-S:6/TB7`,`SET3-S:6/TB7-F:TB10`,`SET3-S:6/TB7-F:TB7`,`SET3-S:4NOAD-F:TB7`,`SET3-S:4/TB7`,`SET3-S:4/TB7-F:TB7`,`SET3-S:4/TB7-F:TB10`,`SET3-S:4/TB5@3`,`SET1-S:8/TB7`,`SET1-S:8/TB7@7`,`SET1-S:5/TB9@4`,`SET1-S:6/TB7`,`SET1-S:6NOAD`,`SET1-S:4/TB7`,`SET1-S:4/TB5@3`,`SET1-S:4NOAD`,`SET3-S:TB10`,`SET1-S:T20`,`SET1-S:TB10`]}function tL(e,t){let n=document.createElement(`div`);n.className=NI();let r=[{id:`modificationFlags`,label:`Modification Flags`,factory:()=>PI(e)},{id:`dailyLimits`,label:`Daily Limits`,factory:()=>zI(e)},{id:`defaultTimes`,label:`Default Times`,factory:()=>WI(e)},{id:`averageTimes`,label:`Match Average Times`,factory:()=>ZI(e,t)},{id:`recoveryTimes`,label:`Match Recovery Times`,factory:()=>$I(e,t)}],i=[];for(let t of r){let r=document.createElement(`div`);r.className=dI();let a=document.createElement(`div`);a.className=fI();let o=document.createElement(`span`);o.className=pI();let s=document.createElement(`span`);s.textContent=t.label,a.appendChild(o),a.appendChild(s),a.addEventListener(`click`,()=>e.toggleSection(t.id));let c=document.createElement(`div`);c.className=mI();let l=t.factory();c.appendChild(l.element),r.appendChild(a),r.appendChild(c),n.appendChild(r),i.push({id:t.id,chevron:o,bodyEl:c,inner:l})}function a(e){for(let t of i){let n=e.expandedSections.has(t.id);t.chevron.textContent=n?`▼`:`▶`,t.bodyEl.style.display=n?`block`:`none`,n&&t.inner.update(e)}}return{element:n,update:a}}var nL=class e{constructor(e){this.container=null,this.store=new uI(e),this.panel=tL(this.store,e),this.unsubscribe=this.store.subscribe(e=>{this.panel.update(e)}),this.panel.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.panel.element)}destroy(){this.unsubscribe(),this.container&&this.panel.element.parentNode===this.container&&this.container.removeChild(this.panel.element),this.container=null}getData(){return this.store.getData()}setData(e){this.store.setData(e)}getStore(){return this.store}static createEditorInstance(t){let n=new e({initialPolicy:t.initialData,onChange:e=>t.onChange(e)});return{element:n.panel.element,setData(e){n.setData(e)},getData(){return n.getData()},destroy(){n.destroy()}}}};function rL(e,t){let n=new nL(e);return n.render(t),n}var iL=()=>`pc-layout`,aL=()=>`pc-panel`,oL=()=>`pc-panel-header`,sL=()=>`pc-panel-title`,cL=()=>`pc-panel-meta`,lL=()=>`pc-toolbar`,uL=()=>`pc-input`,dL=()=>`pc-select`,fL=()=>`pc-catalog`,pL=()=>`pc-group`,mL=()=>`pc-group-header`,hL=()=>`pc-group-chevron`,gL=()=>`pc-group-body`,_L=()=>`pc-card`,vL=()=>`pc-card-title`,yL=()=>`pc-card-meta`,bL=()=>`pc-type-badge`,xL=()=>`pc-editor`,SL=()=>`pc-editor-header`,CL=()=>`pc-editor-header-left`,wL=()=>`pc-editor-actions`,TL=()=>`sp-btn sp-btn--sm`,EL=()=>`sp-btn sp-btn--sm sp-btn--accent`,DL=()=>`pc-dirty-dot`,OL=()=>`pc-editor-body`,kL=()=>`pc-empty`,AL=()=>`pc-json-editor`,jL=()=>`pc-json-error`;function ML(e){let t=document.createElement(`div`);t.className=iL(),t.appendChild(e.catalogPanel.element),t.appendChild(e.editorShell.element);function n(t){e.catalogPanel.update(t),e.editorShell.update(t)}return{element:t,update:n}}var NL=`scheduling`,PL=`scoring`,FL=`seeding`,IL=`draws`,LL=`avoidance`,RL=`feedIn`,zL=`progression`,BL=`roundNaming`,VL=`positionActions`,HL=`matchUpActions`,UL=`roundRobinTally`,WL=`rankingPoints`,GL=`competitiveBands`,KL=`voluntaryConsolation`,qL=`participant`,JL=`display`,YL=`audit`,XL=`Tournament Operations`,ZL=`Scoring & Results`,QL=`Ranking Points`,$L=`Draw Configuration`,eR=`Participants`,tR=`Display & Audit`,nR=(e,t,n,r,i)=>({policyType:e,label:t,description:n,group:r,hasEditor:i}),rR=[nR(NL,`Scheduling`,`Match scheduling, average times, recovery times, daily limits`,XL,!0),nR(VL,`Position Actions`,`Allowed position actions (alternates, walkovers, withdrawals)`,XL,!1),nR(HL,`MatchUp Actions`,`Allowed matchUp status transitions and actions`,XL,!1),nR(LL,`Avoidance`,`Draw placement avoidance rules (club, nationality, region)`,XL,!1),nR(PL,`Scoring`,`Score entry validation and completion rules`,ZL,!1),nR(UL,`Round Robin Tally`,`Round-robin group standing calculation method`,ZL,!1),nR(WL,`Ranking Points`,`Point allocation by draw size, round, and result`,QL,!0),nR(GL,`Competitive Bands`,`Rating/ranking band definitions for competitive grouping`,ZL,!1),nR(IL,`Draws`,`Draw generation rules and structure options`,$L,!1),nR(FL,`Seeding`,`Seeding thresholds and placement rules by draw size`,$L,!1),nR(RL,`Feed-In`,`Feed-in consolation structure rules`,$L,!1),nR(zL,`Progression`,`Player progression between draw structures`,$L,!1),nR(KL,`Voluntary Consolation`,`Voluntary consolation entry rules`,$L,!1),nR(BL,`Round Naming`,`Custom round name labels (QF, SF, F, etc.)`,$L,!1),nR(qL,`Participant`,`Participant display and data rules`,eR,!1),nR(JL,`Display`,`Client display configuration (public vs admin views)`,tR,!1),nR(YL,`Audit`,`Audit trail and change logging configuration`,tR,!1)];function iR(e){return rR.find(t=>t.policyType===e)}function aR(e){return e===`rankingPoints`?ZP():e===`scheduling`?lI():{}}var oR=[XL,ZL,QL,$L,eR,tR];function sR(e,t){let n=t.toLowerCase().trim();return n?e.filter(e=>{let t=iR(e.policyType);return[e.name,e.description,e.policyType,t?.label??``,e.source].join(` `).toLowerCase().includes(n)}):e}function cR(e,t){let n=new Map;if(t===`type`){for(let e of oR)n.set(e,[]);for(let t of e){let e=iR(t.policyType)?.group??`Display & Audit`,r=n.get(e);r?r.push(t):n.set(e,[t])}for(let[e,t]of n)t.length===0&&n.delete(e)}else for(let t of e){let e=t.source===`builtin`?`Built-in Policies`:`User Policies`,r=n.get(e);r?r.push(t):n.set(e,[t])}return n}function lR(e){let t=document.createElement(`div`);t.className=aL(),t.style.overflowY=`auto`,t.style.scrollbarWidth=`thin`,t.style.scrollbarColor=`var(--sp-scrollbar) transparent`;let n=new Set,r=null,i=document.createElement(`div`);i.className=oL();let a=document.createElement(`div`);a.className=sL(),a.textContent=`Policy Catalog`;let o=document.createElement(`div`);o.className=cL(),i.appendChild(a),i.appendChild(o),t.appendChild(i);let s=document.createElement(`div`);s.className=lL();let c=document.createElement(`input`);c.type=`text`,c.placeholder=`Search policies...`,c.className=uL(),c.addEventListener(`input`,()=>e.onSearchChange(c.value));let l=document.createElement(`select`);l.className=dL();for(let[e,t]of[[`type`,`By Type`],[`source`,`By Source`]]){let n=document.createElement(`option`);n.value=e,n.textContent=t,l.appendChild(n)}l.addEventListener(`change`,()=>e.onGroupByChange(l.value));let u=document.createElement(`div`);u.style.cssText=`position:relative;flex-shrink:0`;let d=document.createElement(`button`);d.className=`sp-btn-icon`,d.textContent=`+`,d.title=`New policy`,d.style.cssText=`font-size:1rem;font-weight:700`;let f=document.createElement(`div`);f.style.cssText=`display:none;position:absolute;top:100%;right:0;z-index:100;min-width:180px;background:var(--sp-panel-bg);border:1px solid var(--sp-border);border-radius:12px;box-shadow:var(--sp-panel-shadow);padding:4px;margin-top:4px`;let p=rR.filter(e=>e.hasEditor);for(let t of p){let n=document.createElement(`div`);n.style.cssText=`padding:6px 10px;font-size:12px;border-radius:8px;cursor:pointer;color:var(--sp-text)`,n.textContent=t.label,n.addEventListener(`mouseenter`,()=>{n.style.background=`var(--sp-hover-bg)`}),n.addEventListener(`mouseleave`,()=>{n.style.background=``}),n.addEventListener(`click`,n=>{n.stopPropagation(),f.style.display=`none`,e.onNewPolicy?.(t.policyType)}),f.appendChild(n)}d.addEventListener(`click`,e=>{e.stopPropagation(),f.style.display=f.style.display===`none`?`block`:`none`}),document.addEventListener(`click`,()=>{f.style.display=`none`}),u.appendChild(d),u.appendChild(f),s.appendChild(c),s.appendChild(l),s.appendChild(u),t.appendChild(s);let m=document.createElement(`div`);m.className=fL(),t.appendChild(m);function h(t){r=t;let i=sR(t.catalog,t.searchQuery),a=cR(i,t.groupBy);o.textContent=`${i.length} policies`,c.value!==t.searchQuery&&(c.value=t.searchQuery),l.value!==t.groupBy&&(l.value=t.groupBy),m.innerHTML=``;for(let[i,o]of a){let a=document.createElement(`div`);a.className=pL();let s=n.has(i),c=document.createElement(`div`);c.className=mL();let l=document.createElement(`span`);l.className=hL(),l.textContent=s?`▶`:`▼`;let u=document.createElement(`span`);u.textContent=`${i} (${o.length})`,c.appendChild(l),c.appendChild(u),c.addEventListener(`click`,()=>{n.has(i)?n.delete(i):n.add(i),r&&h(r)});let d=document.createElement(`div`);d.className=gL(),s&&(d.style.display=`none`);for(let n of o){let r=document.createElement(`div`);r.className=_L(),n.id===t.selectedId&&r.classList.add(`active`),r.addEventListener(`click`,()=>e.onSelectPolicy(n.id));let i=document.createElement(`div`);i.style.cssText=`display:flex;align-items:center;gap:4px`;let a=document.createElement(`div`);if(a.className=vL(),a.style.flex=`1`,a.textContent=n.name,i.appendChild(a),e.onDuplicatePolicy){let t=document.createElement(`span`);t.style.cssText=`font-size:10px;cursor:pointer;color:var(--sp-muted);padding:2px`,t.textContent=`⎘`,t.title=`Duplicate`,t.addEventListener(`click`,t=>{t.stopPropagation(),e.onDuplicatePolicy?.(n.id)}),i.appendChild(t)}if(n.source===`user`&&e.onDeletePolicy){let t=document.createElement(`span`);t.style.cssText=`font-size:10px;cursor:pointer;color:var(--sp-muted);padding:2px`,t.textContent=`✕`,t.title=`Delete`,t.addEventListener(`click`,t=>{t.stopPropagation(),e.onDeletePolicy?.(n.id)}),i.appendChild(t)}r.appendChild(i);let o=document.createElement(`div`);o.className=yL();let s=iR(n.policyType),c=document.createElement(`span`);c.className=bL(),c.textContent=s?.label??n.policyType;let l=document.createElement(`span`);l.className=`${bL()} ${n.source}`,l.textContent=n.source,o.appendChild(c),o.appendChild(l),r.appendChild(o),d.appendChild(r)}a.appendChild(c),a.appendChild(d),m.appendChild(a)}}return{element:t,update:h}}function uR(e){return structuredClone(e)}var dR=class{constructor(e){this.listeners=new Set,this.config=e;let t=new Set((e.builtinPolicies??[]).map(e=>e.id)),n=[...e.builtinPolicies??[],...(e.userPolicies??[]).filter(e=>!t.has(e.id))];this.state={catalog:n,searchQuery:``,groupBy:`type`,selectedId:null,editorDraft:null,dirty:!1}}getState(){return this.state}getSelectedItem(){return this.state.selectedId?this.state.catalog.find(e=>e.id===this.state.selectedId)??null:null}setCatalogSearch(e){this.setState({searchQuery:e})}setCatalogGroupBy(e){this.setState({groupBy:e})}selectPolicy(e){if(this.state.selectedId===e)return;let t=this.state.catalog.find(t=>t.id===e);t&&(this.setState({selectedId:e,editorDraft:uR(t.policyData),dirty:!1}),this.config.onSelectionChanged?.(t))}clearSelection(){this.state.selectedId&&(this.setState({selectedId:null,editorDraft:null,dirty:!1}),this.config.onSelectionChanged?.(null))}updateEditorDraft(e){this.setState({editorDraft:e,dirty:!0})}markDirty(){this.state.dirty||this.setState({dirty:!0})}markClean(){this.state.dirty&&this.setState({dirty:!1})}savePolicy(){let e=this.getSelectedItem();if(!e||!this.state.editorDraft)return;let t={...e,policyData:uR(this.state.editorDraft)},n=this.state.catalog.map(e=>e.id===t.id?t:e);this.state={...this.state,catalog:n,dirty:!1},this.emit(),this.config.onPolicySaved?.(t)}resetDraft(){let e=this.getSelectedItem();e&&this.setState({editorDraft:uR(e.policyData),dirty:!1})}applyPolicy(){let e=this.getSelectedItem();if(!e)return;let t={...e,policyData:this.state.editorDraft?uR(this.state.editorDraft):uR(e.policyData)};this.config.onPolicyApplied?.(t)}addNewPolicy(e){let t=`user-${e}-${Date.now()}`,n={id:t,name:`New ${e} policy`,policyType:e,source:`user`,description:``,policyData:aR(e)},r=[...this.state.catalog,n];return this.state={...this.state,catalog:r,selectedId:t,editorDraft:uR(n.policyData),dirty:!1},this.emit(),this.config.onPolicyCreated?.(n),this.config.onSelectionChanged?.(n),t}duplicatePolicy(e){let t=this.state.catalog.find(t=>t.id===e);if(!t)return null;let n=`user-${t.policyType}-${Date.now()}`,r={id:n,name:`${t.name} (Copy)`,policyType:t.policyType,source:`user`,description:t.description,policyData:uR(t.policyData)},i=[...this.state.catalog,r];return this.state={...this.state,catalog:i,selectedId:n,editorDraft:uR(r.policyData),dirty:!1},this.emit(),this.config.onPolicyCreated?.(r),this.config.onSelectionChanged?.(r),n}deletePolicy(e){let t=this.state.catalog.find(t=>t.id===e);if(!t||t.source===`builtin`)return;let n=this.state.catalog.filter(t=>t.id!==e),r=this.state.selectedId===e;this.state={...this.state,catalog:n,...r?{selectedId:null,editorDraft:null,dirty:!1}:{}},this.emit(),this.config.onPolicyDeleted?.(e),r&&this.config.onSelectionChanged?.(null)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state={...this.state,...e},this.emit()}emit(){for(let e of this.listeners)e(this.state)}};function fR(e){let t=document.createElement(`div`);t.className=aL();let n=document.createElement(`div`);n.className=xL();let r=document.createElement(`div`);r.className=SL();let i=document.createElement(`div`);i.className=CL();let a=document.createElement(`div`);a.className=sL();let o=document.createElement(`span`);o.className=bL();let s=document.createElement(`span`);s.className=bL(),s.textContent=`read-only`,s.style.display=`none`;let c=document.createElement(`div`);c.className=DL(),c.style.display=`none`,c.title=`Unsaved changes`,i.appendChild(c),i.appendChild(a),i.appendChild(o),i.appendChild(s);let l=document.createElement(`div`);l.className=wL();let u=document.createElement(`button`);u.className=TL(),u.textContent=`Reset`,u.addEventListener(`click`,()=>e.onReset());let d=document.createElement(`button`);d.className=EL(),d.textContent=`Save`,d.addEventListener(`click`,()=>e.onSave());let f=document.createElement(`button`);f.className=TL(),f.textContent=`Apply`,f.addEventListener(`click`,()=>e.onApply());let p=document.createElement(`button`);p.className=TL(),p.textContent=`Duplicate`,p.addEventListener(`click`,()=>e.onDuplicate()),l.appendChild(u),l.appendChild(d),l.appendChild(f),l.appendChild(p);let m=document.createElement(`div`);m.className=wL();let h=document.createElement(`button`);h.className=EL(),h.textContent=`Use as Template`,h.addEventListener(`click`,()=>e.onDuplicate()),m.appendChild(h),r.appendChild(i),r.appendChild(l),r.appendChild(m);let g=document.createElement(`div`);g.className=OL(),n.appendChild(r),n.appendChild(g);let _=document.createElement(`div`);_.className=kL(),_.textContent=`Select a policy to edit`,t.appendChild(n),t.appendChild(_);function v(e){let t=e.selectedId!==null;if(n.style.display=t?`flex`:`none`,_.style.display=t?`none`:`flex`,!t)return;let r=e.catalog.find(t=>t.id===e.selectedId);if(!r)return;let i=r.source===`builtin`;a.textContent=r.name,o.textContent=iR(r.policyType)?.label??r.policyType,s.style.display=i?``:`none`,l.style.display=i?`none`:`flex`,m.style.display=i?`flex`:`none`,c.style.display=!i&&e.dirty?`block`:`none`}return{element:t,update:v,bodyElement:g}}function pR(e){let t=document.createElement(`div`);t.className=AL();let n=document.createElement(`textarea`);n.value=JSON.stringify(e.initialData,null,2);let r=document.createElement(`div`);r.className=jL(),r.style.display=`none`;let i={...e.initialData};return n.addEventListener(`input`,()=>{try{let t=JSON.parse(n.value);i=t,r.style.display=`none`,e.onChange(t)}catch(e){r.style.display=`block`,r.textContent=`Invalid JSON: ${e.message}`}}),t.appendChild(n),t.appendChild(r),{element:t,setData(e){i={...e},n.value=JSON.stringify(e,null,2),r.style.display=`none`},getData(){return{...i}},destroy(){t.remove()}}}var mR=class{constructor(e){this.currentEditor=null,this.container=null,this.store=new dR(e);let t=lR({onSearchChange:e=>this.store.setCatalogSearch(e),onGroupByChange:e=>this.store.setCatalogGroupBy(e),onSelectPolicy:e=>this.handleSelectPolicy(e),onNewPolicy:e=>{this.store.addNewPolicy(e),this.mountEditorForSelection()},onDuplicatePolicy:e=>{this.store.duplicatePolicy(e),this.mountEditorForSelection()},onDeletePolicy:e=>{this.store.deletePolicy(e),this.store.getSelectedItem()||this.destroyCurrentEditor()}});this.editorShell=fR({onSave:()=>this.store.savePolicy(),onReset:()=>{this.store.resetDraft(),this.syncEditorFromStore()},onApply:()=>this.store.applyPolicy(),onDuplicate:()=>{let e=this.store.getSelectedItem();e&&(this.store.duplicatePolicy(e.id),this.mountEditorForSelection())}}),this.layout=ML({catalogPanel:t,editorShell:this.editorShell}),this.unsubscribe=this.store.subscribe(e=>{this.layout.update(e)}),this.layout.update(this.store.getState())}render(e){this.container=e,e.appendChild(this.layout.element)}destroy(){this.destroyCurrentEditor(),this.unsubscribe(),this.container&&this.layout.element.parentNode===this.container&&this.layout.element.remove(),this.container=null}getStore(){return this.store}handleSelectPolicy(e){this.store.selectPolicy(e),this.mountEditorForSelection()}mountEditorForSelection(){this.destroyCurrentEditor();let e=this.store.getSelectedItem();if(!e)return;let t=e.source===`builtin`,n={initialData:{...e.policyData},onChange:e=>{this.store.updateEditorDraft(e)},readonly:t};e.policyType===`scheduling`?this.currentEditor=nL.createEditorInstance(n):e.policyType===`rankingPoints`?this.currentEditor=oI.createEditorInstance(n):this.currentEditor=pR(n),this.editorShell.bodyElement.innerHTML=``,this.editorShell.bodyElement.appendChild(this.currentEditor.element)}syncEditorFromStore(){let e=this.store.getState();this.currentEditor&&e.editorDraft&&this.currentEditor.setData(e.editorDraft)}destroyCurrentEditor(){this.currentEditor&&=(this.currentEditor.destroy(),null),this.editorShell.bodyElement.innerHTML=``}};function hR(e,t,n,r){e!==void 0&&e<0&&r.push({severity:`error`,path:t,message:n})}function gR(e,t){if(!e.defaultTimes)return;let n=e.defaultTimes.averageTimes;if(n)for(let e=0;e<n.length;e++)hR(n[e].minutes.default,`defaultTimes.averageTimes[${e}].minutes.default`,`Default average time must be non-negative`,t),hR(n[e].minutes.DOUBLES,`defaultTimes.averageTimes[${e}].minutes.DOUBLES`,`Doubles average time must be non-negative`,t);let r=e.defaultTimes.recoveryTimes;if(r)for(let e=0;e<r.length;e++)hR(r[e].minutes.default,`defaultTimes.recoveryTimes[${e}].minutes.default`,`Default recovery time must be non-negative`,t)}function _R(e,t){if(!e.defaultDailyLimits)return;let n=e.defaultDailyLimits;hR(n.SINGLES,`defaultDailyLimits.SINGLES`,`Singles daily limit must be non-negative`,t),hR(n.DOUBLES,`defaultDailyLimits.DOUBLES`,`Doubles daily limit must be non-negative`,t),hR(n.total,`defaultDailyLimits.total`,`Total daily limit must be non-negative`,t)}function vR(e){let t=[];return gR(e,t),_R(e,t),e.matchUpAverageTimes&&yR(e.matchUpAverageTimes,`matchUpAverageTimes`,`averageTimes`,t),e.matchUpRecoveryTimes&&bR(e.matchUpRecoveryTimes,`matchUpRecoveryTimes`,t),xR(e,t),t}function yR(e,t,n,r){for(let i=0;i<e.length;i++){let a=e[i];a.matchUpFormatCodes.length||r.push({severity:`error`,path:`${t}[${i}].matchUpFormatCodes`,message:`At least one format code is required per format group`});let o=a[n];if(o)for(let e=0;e<o.length;e++)hR(o[e].minutes.default,`${t}[${i}].${n}[${e}].minutes.default`,`Time must be non-negative`,r),hR(o[e].minutes.DOUBLES,`${t}[${i}].${n}[${e}].minutes.DOUBLES`,`Doubles time must be non-negative`,r)}}function bR(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.matchUpFormatCodes.length||n.push({severity:`error`,path:`${t}[${r}].matchUpFormatCodes`,message:`At least one format code is required per format group`});for(let e=0;e<i.recoveryTimes.length;e++)hR(i.recoveryTimes[e].minutes.default,`${t}[${r}].recoveryTimes[${e}].minutes.default`,`Recovery time must be non-negative`,n),hR(i.recoveryTimes[e].minutes.DOUBLES,`${t}[${r}].recoveryTimes[${e}].minutes.DOUBLES`,`Doubles recovery time must be non-negative`,n)}}function xR(e,t){let n=(e,n)=>{if(!e)return;let r=new Map;for(let i=0;i<e.length;i++)for(let a of e[i].matchUpFormatCodes)r.has(a)?t.push({severity:`warning`,path:`${n}[${i}].matchUpFormatCodes`,message:`Format code "${a}" also appears in group ${r.get(a)}`}):r.set(a,i)};n(e.matchUpAverageTimes,`matchUpAverageTimes`),n(e.matchUpRecoveryTimes,`matchUpRecoveryTimes`)}function SR(e,t){let n=new mR(e);return n.render(t),n}e.CompositionEditorStore=FN,e.DEFAULT_SCHEDULE_CELL_CONFIG=pN,e.DrawStateManager=lh,e.InlineScoringManager=Zo,e.MATCH_FORMATS=Qm,e.POLICY_TYPE_GROUPS=oR,e.POLICY_TYPE_METADATA=rR,e.PolicyCatalogControl=mR,e.PolicyCatalogStore=dR,e.ProfileStore=ET,e.SchedulePageControl=uN,e.SchedulePageStore=lN,e.SchedulingEditorControl=nL,e.SchedulingEditorStore=uI,e.SchedulingProfileControl=zT,e.TemporalGrid=NO,e.TopologyBuilderControl=Fj,e.TopologyStore=Pk,e.activateScheduleCellTypeAhead=NN,e.applyDropCommit=ST,e.badmintonCourt=Ym,e.barButton=vC,e.baseballDiamond=Km,e.basketballCourt=Gm,e.buildCourtGridSlot=cN,e.buildDateStrip=LT,e.buildEdgeEditor=kA,e.buildEditorShell=fR,e.buildInspectorPanel=Xw,e.buildInteractiveScoringShell=WP,e.buildIssueIndex=bT,e.buildIssuesPanel=aT,e.buildJsonEditor=pR,e.buildMatchUpCard=eN,e.buildMatchUpCatalog=rN,e.buildNodeEditor=_A,e.buildPolicyCatalogLayout=ML,e.buildPolicyCatalogPanel=lR,e.buildRoundCard=MT,e.buildRoundCatalog=iT,e.buildScheduleDateStrip=sN,e.buildScheduleGridCell=mN,e.buildScheduleInspectorPanel=JM,e.buildScheduleIssueIndex=iN,e.buildScheduleIssuesPanel=oN,e.buildSchedulePageLayout=WM,e.buildSchedulingEditorPanel=tL,e.buildSchedulingProfileLayout=Iw,e.buildSetScore=Es,e.buildStructureCard=yk,e.buildToolbar=ij,e.buildTopologyBuilderLayout=aj,e.buildTopologyCanvas=Gk,e.buildVenueBoard=PT,e.burstChart=GS,e.cModal=F,e.calculateComplement=Ss,e.compositions=ri,e.controlBar=IC,e.courthiveComponentsVersion=Zm,e.createCardPopoverManager=Lw,e.createCompositionEditor=AP,e.createInlineScoringFooter=HP,e.createPolicyCatalog=SR,e.createSchedulePage=PN,e.createSchedulingEditor=rL,e.createSchedulingProfile=BT,e.createTemporalGrid=PO,e.destroyTipster=Vm,e.drawer=ad,e.dropDownButton=pC,e.emptySchedulingPolicy=lI,e.engineToMatchUp=Yo,e.filterCatalog=$w,e.filterMatchUpCatalog=QM,e.filterPolicyCatalog=sR,e.findIssuesForLocator=Kw,e.formatCodeLabel=sI,e.fromFactoryDrawData=ZS,e.fromLegacyDraw=eC,e.generatePreviewMatchUps=YO,e.getAgeCategoryModal=uo,e.getCategoryModal=mo,e.getFlightProfileModal=Go,e.getGenerateTeamsModal=Di,e.getMatchUpFormatModal=Ca,e.getMatchWinner=xs,e.getMaxAllowedScore=_s,e.getMockParticipantsModal=xi,e.getPlannedRoundKeys=tT,e.getPolicyTypeMeta=iR,e.getPortPosition=bk,e.getRoundAt=Gw,e.getScoringConfig=es,e.getSetFormatForIndex=ms,e.getSetWinner=ys,e.getVenueRounds=Ww,e.groupCatalog=eT,e.groupMatchUpCatalog=$M,e.groupPolicyCatalog=cR,e.hockeyRink=qm,e.initDrawer=od,e.isCompletedStatus=ZM,e.isMatchComplete=bs,e.isSetComplete=vs,e.isSetTiebreakOnly=hs,e.isSetTimed=gs,e.mapMatchUpToCellData=MN,e.matchUpLabel=GM,e.matchUpSearchKey=qM,e.maxSeverity=Jw,e.notesToolbar=bm,e.openCompositionEditorModal=Ni,e.openScheduleCellConfigModal=Fi,e.padelCourt=Xm,e.participantLabel=KM,e.pickleballCourt=Jm,e.renderButtons=$m,e.renderContainer=Jr,e.renderField=ln,e.renderForm=ui,e.renderInlineMatchUp=qo,e.renderMatchUp=Wr,e.renderMenu=Rm,e.renderOptions=cn,e.renderParticipant=cr,e.renderParticipantInput=gn,e.renderRound=Gr,e.renderRoundHeader=ur,e.renderSchematicMatchUp=si,e.renderSchematicRound=ci,e.renderSchematicStructure=li,e.renderScorecard=MP,e.renderStructure=Kr,e.renderTeamVsHeader=NP,e.resetScoringConfig=ns,e.resolvePublishedComposition=ai,e.scoringModal=Wl,e.selectItem=hC,e.setScoringConfig=ts,e.shouldApplySmartComplement=Cs,e.shouldCreateNextSet=Ts,e.shouldShowTiebreak=ws,e.showCourtAvailabilityModal=jO,e.standardTemplates=Tj,e.tennisCourt=Wm,e.tipster=Hm,e.toggleOverlay=EC,e.topologyToDrawOptions=Qj,e.updateHeadingSelect=Sm,e.updateTieScore=PP,e.updateToolbarState=xm,e.validateProfile=lT,e.validateSchedulingPolicy=vR,e.validateTopology=zA,e.validator=an,Object.defineProperty(e,`validators`,{enumerable:!0,get:function(){return ch}})});