histropediajs 1.6.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -2
- package/dist/histropedia.esm.js +3251 -2008
- package/dist/histropedia.umd.js +8673 -7413
- package/dist/histropedia.umd.min.js +2 -2
- package/index.d.ts +139 -32
- package/package.json +7 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
HistropediaJS v1.
|
|
2
|
+
HistropediaJS v1.7.0 | Histropedia Ltd. (c) 2026 | https://js.histropedia.com
|
|
3
3
|
Use of this software is subject to our End User Licence Agreement: https://js.histropedia.com/licence.html
|
|
4
4
|
*/
|
|
5
|
-
(function(H,Y){typeof exports=="object"&&typeof module!="undefined"?module.exports=Y():typeof define=="function"&&define.amd?define(Y):(H=typeof globalThis!="undefined"?globalThis:H||self,H.Histropedia=Y())})(this,(function(){"use strict";var Qa=Object.defineProperty,tl=Object.defineProperties;var el=Object.getOwnPropertyDescriptors;var Ro=Object.getOwnPropertySymbols;var il=Object.prototype.hasOwnProperty,nl=Object.prototype.propertyIsEnumerable;var Oo=(H,Y,k)=>Y in H?Qa(H,Y,{enumerable:!0,configurable:!0,writable:!0,value:k}):H[Y]=k,W=(H,Y)=>{for(var k in Y||(Y={}))il.call(Y,k)&&Oo(H,k,Y[k]);if(Ro)for(var k of Ro(Y))nl.call(Y,k)&&Oo(H,k,Y[k]);return H},zt=(H,Y)=>tl(H,el(Y));const H={linear:t=>t,swing:t=>.5-Math.cos(t*Math.PI)/2,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:-1+(4-2*t)*t,easeInCubic:t=>t**3,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>t<.5?4*t**3:1+--t*(2*t)**2};function Y({from:t=0,to:e=1,duration:i=400,easing:n=H.linear,onUpdate:o,onComplete:s,autoStart:r=!0}={}){let a=null,l=!1;function c(u){if(l)return;a===null&&(a=u);const m=Math.min(1,(u-a)/i),d=n(m),g=t+(e-t)*d;o==null||o(g,d),m<1?requestAnimationFrame(c):s==null||s()}function h(){l=!1,a=null,requestAnimationFrame(c)}return r&&h(),{stop(){l=!0},restart(){l=!1,h()}}}const k=0,F=1,Eo=2,lt=-4,G=-3,K=-2,j=-1,O=0,$=1,rt=2,de=3,Rt=4,fe=5,Fi=6,Bi=7,Hi=8,Yi=9,Wi=10,Vi=11,Zi="millisecond",Ui="second",Gi="minute",ji="hour",$i="day",No="month",xo="year",zo="decade",Fo="century",Bo="millennium",Ho="million-years",Yo="billion-years",Wo={3:{label:" ka",value:1e3},6:{label:" Ma",value:1e6},9:{label:" Ga",value:1e9}},Vo="low",Zo="medium",Uo="high",Go="all",jo="all",$o="screen",Je=[{region:-26,zoom:{from:Number.NEGATIVE_INFINITY,to:-80.86},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:134217728}},{region:-25,zoom:{from:-80.86,to:-77.75},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:67108864}},{region:-24,zoom:{from:-77.75,to:-74.64},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:33554432}},{region:-23,zoom:{from:-74.64,to:-71.53},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:16777216}},{region:-22,zoom:{from:-71.53,to:-68.42},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:8388608}},{region:-21,zoom:{from:-68.42,to:-65.31},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:4194304}},{region:-20,zoom:{from:-65.31,to:-62.2},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:2097152}},{region:-19,zoom:{from:-62.2,to:-59.09},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:1048576}},{region:-18,zoom:{from:-59.09,to:-55.98},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:524288}},{region:-17,zoom:{from:-55.98,to:-52.87},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:262144}},{region:-16,zoom:{from:-52.87,to:-49.76},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:131072}},{region:-15,zoom:{from:-49.76,to:-46.65},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:65536}},{region:-14,zoom:{from:-46.65,to:-43.54},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:32768}},{region:-13,zoom:{from:-43.54,to:-40.43},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:16384}},{region:-12,zoom:{from:-40.43,to:-37.32},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:8192}},{region:-11,zoom:{from:-37.32,to:-34.21},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:4096}},{region:-10,zoom:{from:-34.21,to:-31.1},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:2048}},{region:-9,zoom:{from:-31.1,to:-27.99},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:1024}},{region:-8,zoom:{from:-27.99,to:-24.88},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:512}},{region:-7,zoom:{from:-24.88,to:-21.77},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:256}},{region:-6,zoom:{from:-21.77,to:-18.66},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:128}},{region:-5,zoom:{from:-18.66,to:-15.55},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:64}},{region:-4,zoom:{from:-15.55,to:-12.44},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:32}},{region:-3,zoom:{from:-12.44,to:-9.33},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:16}},{region:-2,zoom:{from:-9.33,to:-6.22},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:8}},{region:-1,zoom:{from:-6.22,to:-3.11},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:4}},{region:0,zoom:{from:-3.11,to:0},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:2}},{region:1,zoom:{from:0,to:3.11},low:1,medium:2,high:3,all:25,step:{months:0,days:1}},{region:2,zoom:{from:3.11,to:6.22},low:1,medium:2,high:3,all:25,step:{months:0,days:2}},{region:3,zoom:{from:6.22,to:9.33},low:1,medium:2,high:3,all:25,step:{months:0,days:4}},{region:4,zoom:{from:9.33,to:12.44},low:1,medium:2,high:3,all:25,step:{months:0,days:8}},{region:5,zoom:{from:12.44,to:15.55},low:1,medium:2,high:3,all:25,step:{months:0,days:16}},{region:6,zoom:{from:15.55,to:18.66},low:1,medium:2,high:3,all:25,step:{months:0,days:32}},{region:7,zoom:{from:18.66,to:21.77},low:1,medium:2,high:3,all:25,step:{months:0,days:64}},{region:8,zoom:{from:21.77,to:24.88},low:1,medium:2,high:3,all:25,step:{months:0,days:128}},{region:9,zoom:{from:24.88,to:27.99},low:1,medium:2,high:3,all:25,step:{months:0,days:256}},{region:10,zoom:{from:27.99,to:31.1},low:1,medium:2,high:3,all:25,step:{months:0,days:512}},{region:11,zoom:{from:31.1,to:34.21},low:1,medium:2,high:3,all:25,step:{months:0,days:1024}},{region:12,zoom:{from:34.21,to:37.32},low:1,medium:2,high:3,all:25,step:{months:0,days:2048}},{region:13,zoom:{from:37.32,to:40.43},low:1,medium:2,high:3,all:25,step:{months:0,days:4096}},{region:14,zoom:{from:40.43,to:43.54},low:1,medium:2,high:3,all:25,step:{months:0,days:8192}},{region:15,zoom:{from:43.54,to:46.65},low:1,medium:2,high:3,all:25,step:{months:0,days:16384}},{region:16,zoom:{from:46.65,to:49.76},low:1,medium:2,high:3,all:25,step:{months:0,days:32768}},{region:17,zoom:{from:49.76,to:52.87},low:1,medium:2,high:3,all:25,step:{months:0,days:65536}},{region:18,zoom:{from:52.87,to:55.98},low:1,medium:2,high:3,all:25,step:{months:0,days:131072}},{region:19,zoom:{from:55.98,to:59.09},low:1,medium:2,high:3,all:25,step:{months:0,days:262144}},{region:20,zoom:{from:59.09,to:62.2},low:1,medium:2,high:3,all:25,step:{months:0,days:524288}},{region:21,zoom:{from:62.2,to:65.31},low:1,medium:2,high:3,all:25,step:{months:0,days:1048576}},{region:22,zoom:{from:65.31,to:68.42},low:1,medium:2,high:3,all:25,step:{months:0,days:2097152}},{region:23,zoom:{from:68.42,to:71.53},low:1,medium:2,high:3,all:25,step:{months:0,days:4194304}},{region:24,zoom:{from:71.53,to:74.64},low:1,medium:2,high:3,all:25,step:{months:0,days:8388608}},{region:25,zoom:{from:74.64,to:77.75},low:1,medium:2,high:3,all:25,step:{months:0,days:16777216}},{region:26,zoom:{from:77.75,to:80.86},low:1,medium:2,high:3,all:25,step:{months:0,days:33554432}},{region:27,zoom:{from:80.86,to:83.97},low:1,medium:2,high:3,all:25,step:{months:0,days:67108864}},{region:28,zoom:{from:83.97,to:87.08},low:1,medium:2,high:3,all:25,step:{months:0,days:134217728}},{region:29,zoom:{from:87.08,to:90.19},low:1,medium:2,high:3,all:25,step:{months:0,days:268435456}},{region:30,zoom:{from:90.19,to:93.3},low:1,medium:2,high:3,all:25,step:{months:0,days:536870912}},{region:31,zoom:{from:93.3,to:96.41},low:1,medium:2,high:3,all:25,step:{months:0,days:1073741824}},{region:32,zoom:{from:96.41,to:99.52},low:1,medium:2,high:3,all:25,step:{months:0,days:2147483648}},{region:33,zoom:{from:99.52,to:102.63},low:1,medium:2,high:3,all:25,step:{months:0,days:4294967296}},{region:34,zoom:{from:102.63,to:105.74},low:1,medium:2,high:3,all:25,step:{months:0,days:8589934592}},{region:35,zoom:{from:105.74,to:108.85},low:1,medium:2,high:3,all:25,step:{months:0,days:17179869184}},{region:36,zoom:{from:108.85,to:111.96},low:1,medium:2,high:3,all:25,step:{months:0,days:34359738368}},{region:37,zoom:{from:111.96,to:115.07},low:1,medium:2,high:3,all:25,step:{months:0,days:68719476736}},{region:38,zoom:{from:115.07,to:118.18},low:1,medium:2,high:3,all:25,step:{months:0,days:137438953472}},{region:39,zoom:{from:118.18,to:121.29},low:1,medium:2,high:3,all:25,step:{months:0,days:274877906944}},{region:40,zoom:{from:121.29,to:124.4},low:1,medium:2,high:3,all:25,step:{months:0,days:549755813888}}],Xo=Object.freeze(Object.defineProperty({__proto__:null,DENSITY_ALL:Go,DENSITY_HIGH:Uo,DENSITY_LOW:Vo,DENSITY_MEDIUM:Zo,DENSITY_SETTINGS:Je,ERA_MARKER:Eo,MAJOR_MARKER:F,MINOR_MARKER:k,PRECISION_BILLION_YEARS:Yo,PRECISION_CENTURY:Fo,PRECISION_DAY:$i,PRECISION_DECADE:zo,PRECISION_HOUR:ji,PRECISION_MILLENNIUM:Bo,PRECISION_MILLION_YEARS:Ho,PRECISION_MILLISECOND:Zi,PRECISION_MINUTE:Gi,PRECISION_MONTH:No,PRECISION_SECOND:Ui,PRECISION_YEAR:xo,RANGE_ALL:jo,RANGE_SCREEN:$o,YEAR_PREFIXES:Wo,ZOOM_100_MILLION_YEARS:Wi,ZOOM_100_THOUSAND_YEARS:Bi,ZOOM_10_MILLION_YEARS:Yi,ZOOM_10_THOUSAND_YEARS:Fi,ZOOM_BILLION_YEARS:Vi,ZOOM_CENTURY:Rt,ZOOM_DAY:O,ZOOM_DECADE:de,ZOOM_HOUR:j,ZOOM_MILLENNIUM:fe,ZOOM_MILLION_YEARS:Hi,ZOOM_MILLISECOND:lt,ZOOM_MINUTE:K,ZOOM_MONTH:$,ZOOM_SECOND:G,ZOOM_YEAR:rt},Symbol.toStringTag,{value:"Module"}));class qo{constructor(){this._enabled=!1,this._prefix="[Histropedia]";const e=typeof console!="undefined"?console:null;this._console=e,this._fns={log:e&&e.log?e.log.bind(e):()=>{},warn:e&&e.warn?e.warn.bind(e):()=>{},error:e&&e.error?e.error.bind(e):()=>{},info:e&&e.info?e.info.bind(e):()=>{},debug:e&&e.debug?e.debug.bind(e):e&&e.log?e.log.bind(e):()=>{},group:e&&e.group?e.group.bind(e):e&&e.log?e.log.bind(e):()=>{},groupCollapsed:e&&e.groupCollapsed?e.groupCollapsed.bind(e):e&&e.group?e.group.bind(e):e&&e.log?e.log.bind(e):()=>{},groupEnd:e&&e.groupEnd?e.groupEnd.bind(e):()=>{}}}setEnabled(e){this._enabled=!!e}isEnabled(){return!!this._enabled}setPrefix(e){this._prefix=String(e||"")}getPrefix(){return this._prefix}_withPrefixedArgs(e){if(!this._prefix)return e;if(e&&e.length>0&&typeof e[0]=="string"){const i=e.slice();return i[0]=`${this._prefix} ${i[0]}`,i}return[this._prefix,...e]}_log(e,i){if(!this._enabled)return;(this._fns[e]||this._fns.log)(...this._withPrefixedArgs(i))}log(...e){this._log("log",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}group(...e){this._enabled&&this._fns.group(...this._withPrefixedArgs(e))}groupCollapsed(...e){this._enabled&&this._fns.groupCollapsed(...this._withPrefixedArgs(e))}groupEnd(){this._enabled&&this._fns.groupEnd()}}const T=new qo,Ae=[31,28,31,30,31,30,31,31,30,31,30,31],Ko=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Xi={1:"billion-years",3:"million-years",6:"millennium",7:"century",8:"decade",9:"year",10:"month",11:"day",12:"hour",13:"minute",14:"second",15:"millisecond"},Jo=/^(-?\d+)(?:-(\d{1,2}))?(?:-(\d{1,2}))?(?:[T ](\d{1,2})(?::(\d{1,2}))?(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?$/,Ft=1e3,Bt=60*Ft,Ht=60*Bt,U=24*Ht;function Qe(t){return Object.prototype.hasOwnProperty.call(Xi,t)?Xi[t]:t||"day"}function me(t){if(t.precision!==void 0)return t.precision;if(!(t instanceof y)){for(const e of[Zi,Ui,Gi,ji])if(t[e]!==void 0)return e}return $i}function $t(t,e){if(t<=0){const n=1-t,o=Math.ceil(n/e)*e;return{startYear:1-o,endYear:e-o}}const i=Math.ceil(t/e)*e;return{startYear:i-e+1,endYear:i}}function qi(t){if(t<=0){const i=Math.floor((1-t)/10)*10;return{startYear:1-(i+9),endYear:1-Math.max(1,i)}}const e=Math.floor(t/10)*10;return{startYear:Math.max(1,e),endYear:e+9}}function Ie(t,e,i,n){const o=Number(t);return Number.isFinite(o)?Math.min(n,Math.max(i,Math.trunc(o))):e}function Ki(t,e,i,n,o){const s={hour:Ie(e,0,0,23),minute:Ie(i,0,0,59),second:Ie(n,0,0,59),millisecond:Ie(o,0,0,999)};for(const[r,a]of Object.entries(s))Object.defineProperty(t,r,{value:a,enumerable:a!==0,configurable:!0,writable:!0})}function Qo(t,e){e!==void 0&&Object.defineProperty(t,"precision",{value:e,enumerable:!1,configurable:!0,writable:!0})}function Xt(t,e){return new y(zt(W({},e),{precision:me(t)}))}function y(t,e,i,n,o,s,r){if(typeof t=="object"){const a=t;this.year=a.year,this.month=a.month,this.day=Ji(a.year,a.month,a.day),Ki(this,a.hour,a.minute,a.second,a.millisecond),Qo(this,me(a))}else this.year=t,this.month=e,this.day=Ji(t,e,i),Ki(this,n,o,s,r)}function Ji(t,e,i){return i>28?Math.min(i,qt(t,e)):i}function qt(t,e){return e===2&&(t%4===0&&t%100!==0||t%400===0)?29:Ae[e-1]}function Me(t,e){return t=t.toString(),e=typeof e=="string"?e:",",t.length<=4?t:t.replace(/\B(?=(\d{3})+(?!\d))/g,e)}y.prototype.getDaysTo=function(t){const e=t.getDaysSinceYearZero()-this.getDaysSinceYearZero(),i=t.getMillisecondsOfDay()-this.getMillisecondsOfDay();return e+i/U},y.prototype.getMillisecondsOfDay=function(){return this.hour*Ht+this.minute*Bt+this.second*Ft+this.millisecond},y.prototype.getMonthsTo=function(t){return this.getYearsTo(t)*12},y.prototype.getYearsTo=function(t){let e=t.year-this.year;return e+=(t.month-this.month)/12+(t.day-this.day)/365.2422+(t.getMillisecondsOfDay()-this.getMillisecondsOfDay())/(U*365.2422),e},y.prototype.getLeapYearsSinceYearZero=function(){let t=this.year;return this.month<3&&t--,Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400)},y.prototype.getDaysSinceYearZero=function(){let e=this.year*365+this.day;for(let i=0;i<this.month-1;i++)e+=Ae[i];return e+=this.getLeapYearsSinceYearZero(),e},y.prototype.getDayOfYear=function(){let t=this.day;for(let e=1;e<this.month;e++)t+=qt(this.year,e);return t},y.getByDayOfYear=function(t,e){const i=new y(t,1,1);let n=Ae[0];for(let o=0;o<e-1;o++)i.day++,i.day>n&&(i.day=1,i.month++,i.month>12&&(i.month=1,i.year++),n=i.month===2?qt(i.year,i.month):Ae[i.month-1]);return i},y.prototype.getNextDay=function(){return this.addDays(1)},y.prototype.addDays=function(t){let e=this.day,i=this.month,n=this.year;const o=t<0?-1:1;let s=Math.abs(Math.trunc(t));for(;s>0;)o>0?(e++,e>qt(n,i)&&(e=1,i++,i>12&&(i=1,n++))):(e--,e<1&&(i--,i<1&&(i=12,n--),e=qt(n,i))),s--;return Xt(this,{year:n,month:i,day:e,hour:this.hour,minute:this.minute,second:this.second,millisecond:this.millisecond})},y.prototype.addMilliseconds=function(t){let e=this,i=this.getMillisecondsOfDay()+Math.trunc(t);for(;i<0;)e=e.addDays(-1),i+=U;for(;i>=U;)e=e.addDays(1),i-=U;const n=Math.floor(i/Ht);i-=n*Ht;const o=Math.floor(i/Bt);i-=o*Bt;const s=Math.floor(i/Ft),r=i-s*Ft;return Xt(this,{year:e.year,month:e.month,day:e.day,hour:n,minute:o,second:s,millisecond:r})},y.prototype.addSeconds=function(t){return this.addMilliseconds(t*Ft)},y.prototype.addMinutes=function(t){return this.addMilliseconds(t*Bt)},y.prototype.addHours=function(t){return this.addMilliseconds(t*Ht)},y.prototype.addMonths=function(t){let e=this.month,i=this.year;for(let n=0;n<t;n++)e++,e>12&&(e=1,i++);return Xt(this,{year:i,month:e,day:1})},y.prototype.getPreviousDay=function(){return this.addDays(-1)},y.prototype.getNextMonth=function(){let t=this.month,e=this.year;return t++,t>12&&(t=1,e++),Xt(this,{year:e,month:t,day:1})},y.prototype.getPreviousMonth=function(){let t=this.month,e=this.year;return t--,t<1&&(t=12,e--),Xt(this,{year:e,month:t,day:1})},y.prototype.addYears=function(t){return Xt(this,{year:this.year+t,month:1,day:1})};function Ce(t,e){return String(t).padStart(e,"0")}y.prototype.format=function(t,e){e=e||{},t=t||"D MMM YYYY";const i=e.yearPrefix,n=typeof e.bceText=="string"?e.bceText:" ʙᴄᴇ",o=this.year<=0,s=this.year===0,r=e.thousandsSeparator;if(i&&!s){const a=i.value||1,l=i.label||"";let c;return o?c=Me((-this.year+1)/a,r)+l+n:c=Me(this.year/a,r)+l,c}return t.replace("YYYY",o?Me(-this.year+1,r)+n:Me(this.year,r)).replace("D",this.day).replace("MMM",Ko[this.month-1]).replace("HH",Ce(this.hour,2)).replace("mm",Ce(this.minute,2)).replace("ss",Ce(this.second,2)).replace("SSS",Ce(this.millisecond,3))},y.prototype.isSame=function(t){return t.year===this.year&&t.month===this.month&&t.day===this.day&&(t.hour||0)===this.hour&&(t.minute||0)===this.minute&&(t.second||0)===this.second&&(t.millisecond||0)===this.millisecond},y.prototype.toKeyString=function(){const t=`${this.year}|${this.month}|${this.day}`;return this.getMillisecondsOfDay()===0?t:`${t}|${this.hour}|${this.minute}|${this.second}|${this.millisecond}`},y.prototype.isAfter=function(t){const e=["year","month","day","hour","minute","second","millisecond"];for(let i=0;i<e.length;i++){const n=e[i],o=this[n]||0,s=t[n]||0;if(o!==s)return o>s}return!1},y.prototype.isBetween=function(t,e){return this.isAfter(t)&&e.isAfter(this)},y.prototype.compare=function(t){return this.isSame(t)?0:this.isAfter(t)?1:-1},y.prototype.asFloat=function(){const t=this.month-1,e=this.day-1,i=this.getMillisecondsOfDay()/U;return t===0&&e===0&&i===0?this.year:Math.round((this.year+(t*31+e+i)/371)*100)/100},y.prototype.isInFuture=function(){const t=new Date,e=new y(t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return this.isAfter(e)},y.prototype.convertToIso=function(){return this.year<0&&(this.year+=1),this},y.CreateAsStartOfPeriod=function(t,e){const i=t.year,n=t.month||1,o=t.day||1;if(e=Qe(e),e==="millisecond")return new y(t);if(e==="second")return new y(i,n,o,t.hour,t.minute,t.second,0);if(e==="minute")return new y(i,n,o,t.hour,t.minute,0,0);if(e==="hour")return new y(i,n,o,t.hour,0,0,0);if(e==="day")return new y(i,n,o);if(e==="month")return new y(i,n,1);if(e==="year")return new y(i,1,1);if(e==="million-years"||e==="billion-years"){const s=e==="million-years"?1e6:1e9;return new y(i<=0?$t(i,s).startYear:i,1,1)}return e==="decade"?new y(qi(i).startYear,1,1):e==="century"?new y($t(i,100).startYear,1,1):e==="millennium"?new y($t(i,1e3).startYear,1,1):new y(i,n,o)},y.CreateAsEndOfPeriod=function(t,e){const i=t.year,n=t.month||1,o=t.day||1;if(e=Qe(e),e==="millisecond")return new y(t);if(e==="second")return new y(i,n,o,t.hour,t.minute,t.second,999);if(e==="minute")return new y(i,n,o,t.hour,t.minute,59,999);if(e==="hour")return new y(i,n,o,t.hour,59,59,999);if(e==="day")return new y(i,n,o);if(e==="month")return new y(i,n,qt(i,n));if(e==="year")return new y(i,12,31);if(e==="decade")return new y(qi(i).endYear,12,31);if(e==="century")return new y($t(i,100).endYear,12,31);if(e==="millennium")return new y($t(i,1e3).endYear,12,31);if(e==="million-years"||e==="billion-years"){const s=e==="million-years"?1e6:1e9;return new y(i<=0?$t(i,s).endYear:i+s-1,12,31)}return T.error("precision is not implemented"),new y(i,n,o)},y.CreateAsExclusiveEndOfPeriod=function(t,e){e=Qe(e);const i=y.CreateAsStartOfPeriod(t,e);return e==="millisecond"?i.addMilliseconds(1):e==="second"?i.addSeconds(1):e==="minute"?i.addMinutes(1):e==="hour"?i.addHours(1):e==="day"?i.addDays(1):y.CreateAsEndOfPeriod(t,e).addDays(1)},y.now=function(){const t=new Date;return new y({year:t.getYear()+1900,month:t.getMonth()+1,day:t.getDate()})};function ti(t){const e=String(t).match(Jo);if(!e)return null;const i=parseInt(e[1],10),n=e[2]==null?1:parseInt(e[2],10),o=e[3]==null?1:parseInt(e[3],10),s=e[4]==null?0:parseInt(e[4],10),r=e[5]==null?0:parseInt(e[5],10),a=e[6]==null?0:parseInt(e[6],10),l=e[7]?parseInt(e[7].padEnd(3,"0"),10):0;return{date:new y(i,n,o,s,r,a,l),hasMonth:e[2]!=null,hasDay:e[3]!=null,hasTime:e[4]!=null}}y.fromString=function(t){const e=ti(t);return e?e.date:new y(NaN,1,1)};function ei(t,...e){return Object.assign(t,...e)}function L(t,...e){const i=s=>{if(s&&typeof s=="object"&&!Object.prototype.hasOwnProperty.call(s,"__proto__"))try{Object.defineProperty(s,"__proto__",{value:void 0,writable:!0,enumerable:!1,configurable:!0})}catch(r){}};i(t);const n=s=>s==="__proto__"||s==="constructor"||s==="prototype",o=s=>{if(s===null||typeof s!="object")return!1;const r=Object.getPrototypeOf(s);return r===Object.prototype||r===null};for(const s of e)if(!(!s||typeof s!="object"))for(const r of Object.keys(s)){if(n(r))continue;const a=s[r];if(Array.isArray(a)){t[r]=a.slice();continue}if(o(a)){const l=o(t[r])?t[r]:{};i(l),t[r]=L(l,a);continue}t[r]=a}return i(t),t}function bt(t,e){const i=t.split("."),n=i[i.length-1];let o={};o[n]=e;for(let s=i.length-2;s>=0;s--){const r=i[s],a=L({},o);o={},o[r]=a}return o}function Qi(t,e){const i=`_${e}`;t[i]=void 0,Object.defineProperty(t,e,{get(){const n=this[i];return typeof n=="function"?n(this):n},set(n){this[i]=n},enumerable:!0,configurable:!1})}function De(t){return typeof t=="undefined"}const tn={id:"i",title:"t",rank:"r",subtitle:"s","from.year":"fy","from.month":"fm","from.day":"fd","from.hour":"fhr","from.minute":"fmi","from.second":"fs","from.millisecond":"fms","from.precision":"fp","to.year":"ty","to.month":"tm","to.day":"td","to.hour":"thr","to.minute":"tmi","to.second":"ts","to.millisecond":"tms","to.precision":"tp",isToPresent:"p",isStarred:"v","offset.left":"ol","offset.top":"ot",imageUrl:"m",lane:"ln",style:"st",activeStyle:"ast",hiddenByFilter:"h",hidePeriodLine:"hp"};function en(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:t[tn[e]]}function nn(t,e){const n=e.split(".").reduce((o,s)=>o?o[s]:void 0,t);return De(n)?t[tn[e]]:n}function on(t){return t.indexOf(".")>-1}function _(t,e){return on(e)?nn(t,e):en(t,e)}function Te(t,e){const i=me(Object.fromEntries(["precision","hour","minute","second","millisecond"].map(o=>[o,_(t,`${e}.${o}`)]))),n=Object.fromEntries(["year","month","day","hour","minute","second","millisecond"].map(o=>[o,parseInt(_(t,`${e}.${o}`))]));return new y(zt(W({},n),{precision:i}))}function A(t,e){return on(e)?!De(nn(t,e)):!De(en(t,e))}Qi(I.prototype,"hidePeriodLine"),Qi(I.prototype,"hiddenByFilter");function I(t,e){this.id=e,this.owner=t,this.isDataLoaded=!1,this.imageLoaded=!1,this.stacking=0,this.groupIndex=0,this.isActive=!1,this.isVisible=!1,this.isVisibleInLane=!0,this.isInRange=!1,this.isInView=!1,this.isVisibleInGroup=!1,this.isVisibleInRows=!0,this.isStarred=!1,this.isMouseOverStar=!1,this.isMouseover=!1,this.isDragging=!1,this.registeredPosition={left:0,top:0},this.position={left:0,top:0},this.dragStartOffset={left:0,top:0},this.indicator={fromX:0,toX:0},this.offset={left:0,top:0},this.finalOffset={left:0,top:0},this.isVisibleAfterFade=!1,this.opacity=0,this.fadeAnimation={finalOpacity:0,dummyElement:null},this.moveAnimation={finalOffset:{left:0,top:0},dummyElement:void 0},this.row=0,this.laneId=null,this.laneOrder=0,this.isFading=!1,this.isMoving=!1,this._cachedHeight=0,this._cachedWidth=0,this._sizeValid=!1,this._sizeCacheKey=null,this._layoutCaches=null,this._resolvedDefaultCardLayout=null,this._resolvedCardLayoutName=null}I.prototype.setupByReceivedData=function(t){this.owner._assignArticleToLane(this,this.owner._resolveLaneIdFromArticleData(t));const e=this.owner._getResolvedArticleOptions(this).defaultData,i=L({},e,t);A(t,"to")||delete i.to,this.data=L({},t),this.title=_(i,"title")||"",this.rank=_(i,"rank")||0,this.subtitle=_(i,"subtitle")||"",this._setupArticlePeriod(i),this.offset.left=this.finalOffset.left=this.moveAnimation.finalOffset.left=i.offsetLeft||0,this.offset.top=this.finalOffset.top=this.moveAnimation.finalOffset.top=i.offsetTop||0,this.isStarred=!!i.starred,this.cardLayout=_(i,"cardLayout")||null,this.initialiseStyles(i),this.hiddenByFilter=_(i,"hiddenByFilter"),this.hidePeriodLine=A(i,"hidePeriodLine")?_(i,"hidePeriodLine"):this.owner.options.article.periodLine.defaultHide,this.isDataLoaded=!0,this.isImageInfoLoaded=!1},I.prototype._setupArticlePeriod=function(t){let e=Te(t,"from");e=this.owner.getDmyFromInput(e);const i=e.precision,n=_(t,"isToPresent"),o=n===!0||n===1;let s,r;o?s=y.now():A(t,"to")?(s=Te(t,"to"),s=this.owner.getDmyFromInput(s),r=s.precision):(s=e,r=i);const a=y.CreateAsStartOfPeriod(e,i),l=y.CreateAsExclusiveEndOfPeriod(s,r);this.period={from:a,to:l,isToPresent:o},this.period.years=this.period.to.asFloat()-this.period.from.asFloat()},I.prototype.setImage=function(){this.isImageInfoLoaded=!0,_(this.data,"imageUrl")?this.owner.enqueueImageLoad(this):(this._releaseImageResource(),this.image=null,this.imageLoaded=!1)},I.prototype._releaseImageResource=function(t={}){const e=typeof this._closeImage=="function"?this._closeImage:null;if(e){this._closeImage=null;try{e(t)}catch(i){}return}t.keepState||(this.image=null,this.imageLoaded=!1,this._loadedImageKey=null)},I.prototype.registerPosition=function(t){this.registeredPosition=this.position=t},I.prototype.overlaps=function(t){return t.period.from.isSame(this.period.from)&&t.period.to.isSame(this.period.to)||t.period.from.isBetween(this.period.from,this.period.to)||t.period.to.isBetween(this.period.from,this.period.to)||this.period.from.isBetween(t.period.from,t.period.to)||this.period.to.isBetween(t.period.from,t.period.to)},I.prototype.overlapsInclusiveWithDates=function(t,e){return!(this.period.from.isAfter(e)||t.isAfter(this.period.to))},I.prototype.overlapsInclusive=function(t){return this.overlapsInclusiveWithDates(t.period.from,t.period.to)},I.prototype.isInside=function(t){if(!this.isVisible)return!1;this._ensureSizeCache();const e=this.position.left,i=this.position.top,n=this._cachedWidth,o=this._cachedHeight;return t.left>=e&&t.left<=e+n&&t.top>=i&&t.top<=i+o},I.prototype.pointerEnter=function(t){this.isMouseover=!0,this.owner.trigger("article-pointerenter",this,t)},I.prototype.pointerLeave=function(t){this.isMouseover=!1,this.owner.trigger("article-pointerleave",this,t)},I.prototype.updateIsMouseOverStar=function(t){const e=this.getIconBox();if(!e)return!1;const i=this.isMouseOverStar;return this.isMouseOverStar=t.left>=e.left&&t.left<=e.left+e.width&&t.top>=e.top&&t.top<=e.top+e.height,this.isMouseOverStar!==i&&!this.owner.isAnimating&&this.owner.redraw(),this.isMouseOverStar},I.prototype.getCursor=function(t){const e=this.owner.options.style.cursor;return this.isDragging?e.article.dragging:(this.updateIsMouseOverStar(t),this.owner.options.article.draggable&&this.isActive?this.isMouseOverStar?e.clickable:e.article.hoverDraggable:e.clickable)},I.prototype.clicked=function(t){return this.updateIsMouseOverStar(t),this.isMouseOverStar?(this.isStarred=!this.isStarred,!0):!1},I.prototype.getStatusForSave=function(){const t={i:this.id};return this.offset.left!==0&&(t.l=this.offset.left),this.offset.top!==0&&(t.t=this.offset.top),this.isStarred&&(t.v=!0),t},I.prototype.headerOverlapsWith=function(t){const e=this.registeredPosition.left,i=t.registeredPosition.left,n=e+this.getWidth();return i+t.getWidth()>=e&&n>=i},I.prototype._getWidth=function(){return this.getCurrentStyle().width},I.prototype.getWidth=function(){return this._ensureSizeCache(),this._cachedWidth},I.prototype.getHeight=function(){return this._ensureSizeCache(),this._cachedHeight},I.prototype.setOption=function(t,e){let i=!1;if(typeof t=="string"){if(typeof e=="undefined")return _(this.data,t);t=bt(t,e)}L(this.data,t),A(t,"id")&&(this.id=t.id),A(t,"title")&&(this.title=t.title,this.titleLines=void 0),A(t,"subtitle")&&(this.subtitle=t.subtitle,this.summarisedSubtitle=void 0),(A(t,"from")||A(t,"to")||A(t,"isToPresent"))&&(this._setupArticlePeriod(this.data),i=!0),A(t,"imageUrl")&&this.setImage(),A(t,"rank")&&(this.rank=t.rank,i=!0),A(t,"starred")&&(this.isStarred=t.starred),A(t,"hiddenByFilter")&&(this.hiddenByFilter=t.hiddenByFilter),A(t,"hidePeriodLine")&&(this.hidePeriodLine=t.hidePeriodLine);const n=A(t,"lane");n&&(this.owner._assignArticleToLane(this,t.lane),this.initialiseStyles(this.data),this.invalidateCaches(),i=!0);const o=A(t,"style"),s=A(t,"activeStyle"),r=A(t,"hoverStyle");(o||r||s)&&this.initialiseStyles(this.data),this.invalidateCaches(),A(t,"cardLayout")&&this.setCardLayout(t.cardLayout),n&&this.owner.updateArticlesGroupIndex(),i?this.owner.requestRedraw():this.owner.requestRedraw(this.redraw)},I.prototype.initialiseStyles=function(t=this.data){const e=this.owner._resolveDefaultCardLayoutName(this),n=this.owner._getExplicitArticleCardLayout(this)||e;this._resolvedDefaultCardLayout=e,this._resolvedCardLayoutName=n;const o=this.owner._getResolvedArticleStyleOverrides(this,n),s=L({},o.style,_(t,"style")||{}),r=L({},o.activeStyle,_(t,"activeStyle")||{}),a=L({},o.hoverStyle,_(t,"hoverStyle")||{});this.style=s,this.activeStyle=L({},s,r),this.hoverStyle=L({},s,a),this.activeHoverStyle=L({},s,a,r)},I.prototype.setStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return _(this.style,t);t=bt(t,e)}this.data.style=L(this.data.style||{},t),this.initialiseStyles(this.data),this.invalidateCaches(),this.owner.requestRedraw()},I.prototype.setHoverStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return _(this.activeStyle,t);t=bt(t,e)}this.data.hoverStyle=L(this.data.hoverStyle||{},t),this.initialiseStyles(this.data),this.owner.requestRedraw()},I.prototype.setActiveStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return _(this.activeStyle,t);t=bt(t,e)}this.data.activeStyle=L(this.data.activeStyle||{},t),this.initialiseStyles(this.data),this.owner.requestRedraw()},I.prototype.activated=function(){T.warn('DEPRECATION WARNING: article.activated() was deprecated in v1.3.0. Use timeline.select(article.id) and handle selection with options.on["article-select"] instead.'),this.owner.trigger("article-click",this)},I.prototype.updateVisibility=function(){const t=this.isVisibleAfterFade,e=this.isInRange&&this.isVisibleInLane&&this.isVisibleInGroup&&this.isVisibleInRows&&!this.isHiddenByFilter;if(!this.isVisibleInLane){this.setVisibility(!1);return}if(t!==e){if(e&&!this.isImageInfoLoaded&&this.setImage(),!this.owner.options.article.animation.fade.active){this.setVisibility(e);return}this.setVisibilityWithFade(e)}},I.prototype.setVisibility=function(t){var e,i,n,o;this.isFading&&((i=(e=this.fadeAnimation)==null?void 0:e.dummyElement)!=null&&i.stop)&&(this.fadeAnimation.dummyElement.stop(),this.isFading=!1,((o=(n=this.owner)==null?void 0:n.lastAnimatingArticle)==null?void 0:o.id)===this.id&&this.owner.lastAnimatingArticle.animationType==="fade"&&(this.owner.isAnimatingArticles=!1)),this.isVisible=t,this.isVisibleAfterFade=t,this.opacity=t?1:0,t||this._releaseImageResource({skipRedraw:!0})},I.prototype.setVisibilityWithFade=function(t){var c,h,u,m;const e=this;if(t===e.isVisibleAfterFade)return;e.isFading&&((h=(c=e.fadeAnimation)==null?void 0:c.dummyElement)!=null&&h.stop)&&e.fadeAnimation.dummyElement.stop(),e.isFading=!0,e.isVisibleAfterFade=t,e.fadeAnimation=e.fadeAnimation||{},e.fadeAnimation.finalOpacity=t,t&&(e.isVisible=!0),e.owner.notifyArticleAnimating("fade",e.id);const i=e.owner.options.article.animation.fade,n=(u=i.duration)!=null?u:400,o=(m=i.easing)!=null?m:"swing",s=H[o]||H.swing,r=e.opacity,l=Y({from:r,to:t?1:0,duration:n,easing:s,onUpdate(d){e.opacity=d,e.owner.requestRedraw()},onComplete(){e.isFading=!1,t||(e.isVisible=!1,e._releaseImageResource({skipRedraw:!0}));const d=e.owner.lastAnimatingArticle;e.id===d.id&&d.animationType==="fade"&&(e.owner.isAnimatingArticles=!1),typeof i.complete=="function"&&i.complete.call(e)}});e.fadeAnimation.dummyElement=l},I.prototype.moveToOffset=function(t){this.finalOffset.top=this.offset.top=t.top||this.offset.top,this.finalOffset.left=this.offset.left=t.left||this.offset.left,this.position.top=this.registeredPosition.top+this.offset.top,this.position.left=this.registeredPosition.left+this.offset.left},I.prototype.moveTo=function(t){const e={left:t.left-this.registeredPosition.left,top:t.top-this.registeredPosition.top};this.moveToOffset(e)},I.prototype.moveToWithAnim=function(t){const e={left:t.left-this.registeredPosition.left,top:t.top-this.registeredPosition.top};this.moveToOffsetWithAnim(e)},I.prototype.moveToOffsetWithAnim=function(t){var m,d,g;const e=this,i=e.moveAnimation;if(t.top===i.finalOffset.top&&t.left===i.finalOffset.left)return;e.isMoving&&((m=i==null?void 0:i.dummyElement)!=null&&m.stop)&&i.dummyElement.stop(),i.finalOffset=this.finalOffset={left:t.left,top:t.top},e.isMoving=!0,e.owner.notifyArticleAnimating("move",e.id);const n=e.owner.options.article.animation.move,o=(d=n.duration)!=null?d:400,s=(g=n.easing)!=null?g:"swing",r=H[s]||H.swing,a=e.offset.top,l=e.offset.left,c=t.top-a,h=t.left-l,u=Y({from:0,to:1,duration:o,easing:r,onUpdate(p){e.offset.top=a+c*p,e.offset.left=l+h*p,e.position.top=e.registeredPosition.top+e.offset.top,e.position.left=e.registeredPosition.left+e.offset.left,e.owner.requestRedraw()},onComplete(){e.offset.top=t.top,e.offset.left=t.left,e.position.top=e.registeredPosition.top+t.top,e.position.left=e.registeredPosition.left+t.left,e.isMoving=!1;const p=e.owner.lastAnimatingArticle;e.id===p.id&&p.animationType==="move"&&(e.owner.isAnimatingArticles=!1)}});i.dummyElement=u};function Pe(t){return Math.round(t)}function ts(t,e=1){const i=typeof e=="number"&&isFinite(e)&&e>0?e:1;return Math.round(t*i)/i}function sn(t){return t}function rn(t=1,e="device"){return e===!1||e==="none"?sn:e==="css"?Pe:function(n){return ts(n,t)}}function es(t=1,e="device",i=1){if(e===!1||e==="none")return sn;const n=typeof t=="number"&&isFinite(t)&&t>0?t:1,o=e==="css"?1:n,r=(typeof i=="number"&&isFinite(i)&&i>0?i:1)*o/2;return function(l){return(Math.round(l*o-r)+r)/o}}function is(t,e,i){i||(i=Pe);const n=e/2;return{left:i(t.left+n),top:i(t.top+n),width:i(t.width-e),height:i(t.height-e)}}I.prototype.draw=function(t){if(!this.isDataLoaded||isNaN(this.position.left))return;this._ensureSizeCache(),t.globalAlpha=this.opacity,this._getCurrentCardLayout().draw.call(this,t)},I.prototype.getCurrentStyle=function(){return this.isActive?this.isMouseover?this.activeHoverStyle:this.activeStyle:this.isMouseover?this.hoverStyle:this.style},I.prototype._getCurrentStyle=function(){return this.getCurrentStyle()},I.prototype._getPeriodLineRenderGeometry=function(t){const i=this.owner._getResolvedArticleOptions(this).periodLine||{},o=(this.owner.options.article.periodLine||{}).position||"axis",s=Number.isFinite(i.baselineGap)?i.baselineGap:0,r=this.hidePeriodLine?0:i.spacing||0,a=this.hidePeriodLine?0:i.thickness||0,l=(r+a)*this.stacking;let c=t,h=this.owner.options.style.mainLine.size/2;if(o==="lane"&&this.owner._isLaneLayoutActive()){const m=this.owner.getLaneById(this.laneId);m&&m.geometry&&(c=Math.floor(m.geometry.bottom),h=0)}const u=c-s-l-h-a/2;return{position:o,baselineGap:s,spacing:r,thickness:a,anchorY:c,anchorOffset:h,y:u}},I.prototype.drawPeriodLinesAndConnectors=function(t,e){var v,S,M,P,E,x;t.globalAlpha=this.opacity;const i=this.getCurrentStyle(),n=this._getPeriodLineRenderGeometry(e),o=n.y;if(!this.hidePeriodLine){const Z=this.indicator.fromX,R=this.indicator.toX;if(t.beginPath(),t.lineWidth=n.thickness,t.moveTo(Z,o),t.lineTo(R,o),this.period.isToPresent){const V=R-Z,B=15,z=Math.max(1-B/V,.7),it=t.createLinearGradient(Z,o,R,o);it.addColorStop(0,i.color),it.addColorStop(z,i.color),it.addColorStop(1,"rgba(255,255,255,0)"),t.strokeStyle=it}else t.strokeStyle=i.color;t.stroke()}if(!i.connectorLine.visible)return;const s=this._getCurrentCardLayout(),r=typeof s.getConnectorEnd=="function"?s.getConnectorEnd.call(this):{left:this.position.left+i.connectorLine.offsetX,top:this.position.top+this.getHeight()+i.connectorLine.offsetY},a=Math.max(0,this.indicator.fromX),l=o,c=r.left,h=r.top,u=Math.abs(a-c)<Number.EPSILON,m=(P=(M=(S=(v=this.owner)==null?void 0:v.options)==null?void 0:S.article)==null?void 0:M.rendering)==null?void 0:P.pixelSnap,d=es(((x=(E=this.owner)==null?void 0:E.getCanvasDpr)==null?void 0:x.call(E))||1,m,i.connectorLine.thickness),g=u?d(c):null,p=g!=null?g:a,w=g!=null?g:c;t.strokeStyle=t.fillStyle=i.color,t.lineWidth=i.connectorLine.thickness,t.beginPath(),t.moveTo(p,l),t.lineTo(w,h),t.stroke();const b=Math.atan((h-l)/(w-p))+(w>=p?-90:90)*Math.PI/180;t.save(),t.beginPath(),t.translate(w,h),t.rotate(b),t.moveTo(-i.connectorLine.arrow.width,0),t.lineTo(i.connectorLine.arrow.width,0),t.lineTo(0,-i.connectorLine.arrow.height),t.closePath(),t.restore(),t.fill()},I.prototype.getIconBox=function(){return this._getCurrentCardLayout().getIconBox.call(this)},I.prototype.startDragging=function(t,e){this.isMoving&&this.moveAnimation.dummyElement.stop(),this.isDragging=!0,this.dragInitialPosition={left:this.position.left,top:this.position.top},this.lastDragPosition={left:this.position.left,top:this.position.top},this.dragStartOffset={left:t.left-this.position.left,top:t.top-this.position.top},this.owner.startAnimation(),this.owner&&typeof this.owner.trigger=="function"&&this.owner.trigger("article-drag-start",this,e)},I.prototype.stopDragging=function(t){var e,i;this.offset=this.finalOffset=this.moveAnimation.finalOffset={left:this.position.left-this.registeredPosition.left,top:this.position.top-this.registeredPosition.top},this.isDragging=!1,(i=(e=this.owner)==null?void 0:e._markTimelineStateChanged)==null||i.call(e),this.owner&&typeof this.owner.trigger=="function"&&this.owner.trigger("article-drag-end",this,t)},I.prototype.dragging=function(t,e){const i={left:t.left-this.dragStartOffset.left,top:t.top-this.dragStartOffset.top},n=this.lastDragPosition||{left:this.position.left,top:this.position.top},o=this.dragInitialPosition||n,s=i.left-n.left,r=i.top-n.top,a=i.left-o.left,l=i.top-o.top;this.position=i,this.lastDragPosition=i,this.owner&&typeof this.owner.trigger=="function"&&this.owner.trigger("article-drag",this,{dx:s,dy:r,totalDx:a,totalDy:l},e)},I.prototype._cacheBucket=function(){const t=this._getCurrentCardLayoutName();return this._layoutCaches||(this._layoutCaches=Object.create(null)),this._layoutCaches[t]||(this._layoutCaches[t]=Object.create(null))},I.prototype.memo=function(t,e){const i=this._cacheBucket();return t in i?i[t]:i[t]=e.call(this)},I.prototype._getSizeCacheKey=function(){var l,c;const t=typeof this.getCurrentStyle=="function"?this.getCurrentStyle():null,e=t&&t.image||{},i=t&&t.header||{},n=t&&t.subheader||{},o=t&&t.border||{},s=typeof this._getCurrentCardLayoutName=="function"?this._getCurrentCardLayoutName():"",r=this.imageLoaded&&this.image;return[s,t&&t.width,t&&t.height,i.height,n.height,o.width,(l=e.margin)!=null?l:0,e.shape||"",(c=e.maxHeight)!=null?c:"",t&&t.maxImageHeight!==void 0?t.maxImageHeight:"",r?this.image.width:"noimg",r?this.image.height:""].join("|")},I.prototype.updateCachedSize=function(){const t=this._getCurrentCardLayout();this._cachedWidth=t.getWidth.call(this),this._cachedHeight=t.getHeight.call(this),this.height=this._cachedHeight,this._sizeValid=!0,this._sizeCacheKey=this._getSizeCacheKey()},I.prototype._ensureSizeCache=function(){const t=this._getSizeCacheKey();(!this._sizeValid||t!==this._sizeCacheKey)&&this.updateCachedSize()},I.prototype.invalidateCaches=function(){if(this._sizeValid=!1,this._sizeCacheKey=null,this._layoutCaches){const t=this._layoutCaches;for(const e in t){const i=t[e];if(i)for(const n in i){const o=i[n];if(o&&typeof o.close=="function")try{o.close()}catch(s){}}}}this._layoutCaches=null},I.prototype._getCurrentCardLayoutName=function(){return this._resolvedCardLayoutName||this.cardLayout||this._resolvedDefaultCardLayout||this.owner._resolveArticleCardLayoutName(this)},I.prototype._getCurrentCardLayout=function(){return this.owner.getCardLayout(this._getCurrentCardLayoutName())},I.prototype.setCardLayout=function(t){if(!this.owner.getCardLayout(t))throw new Error(`Card layout "${t}" not found`);this.cardLayout=t,this._resolvedCardLayoutName=t,this.initialiseStyles(),this.invalidateCaches(),this.owner.requestRedraw(this.redraw)};function Mt(t,e){const i=Number(t),n=Number(e);if(Number.isFinite(i)&&Number.isFinite(n))return i-n;const s=String(t),r=String(e);return s===r?0:s<r?-1:1}function ns(t,e){const i=t.period.from.getDaysTo(t.period.to),n=e.period.from.getDaysTo(e.period.to);return i<n?1:i>n?-1:Mt(t.id,e.id)}function os(t,e){const i=t.period.years,n=e.period.years;return i<n?1:i>n?-1:Mt(t.id,e.id)}function ss(t,e){const i=t.isInView&&t.isVisible,n=e.isInView&&e.isVisible;return!i&&n?-1:i&&!n?1:t.position.top-e.position.top}function an(t,e){const i=t.period.from,n=e.period.from;let o=i.compare(n);return o===0&&(o=Mt(e.id,t.id)),o}function rs(t,e){const i=t.period.to;let o=e.period.to.compare(i);return o===0&&(o=Mt(e.id,t.id)),o}function as(t,e){const i=t.position.top,n=e.position.top;return i<n?-1:i>n?1:Mt(e.id,t.id)}function ii(t,e){const i=t.laneOrder||0,n=e.laneOrder||0;if(i>n)return-1;if(i<n)return 1;const o=t.row,s=e.row;return o<s?1:o>s?-1:Mt(e.id,t.id)}function ni(t,e){const i=t.rank,n=e.rank;return i<n?1:i>n?-1:Mt(e.id,t.id)}function ls(t,e){const i=t.effectiveRank,n=e.effectiveRank;return i<n?1:i>n?-1:Mt(e.id,t.id)}function cs(t,e){const i=t.position.left,n=e.position.left;let o=i<n?1:i>n?-1:0;return o===0&&(o=t.position.top-e.position.top,o===0&&(o=t.period.from.compare(e.period.from),o===0&&(o=Mt(t.id,e.id)))),o}const hs=Object.freeze(Object.defineProperty({__proto__:null,ARTICLE_DURATION_SORTER:ns,ARTICLE_DURATION_YEARS_SORTER:os,ARTICLE_EFFECTIVE_RANK_SORTER:ls,ARTICLE_FROM_SORTER:an,ARTICLE_IMAGE_QUEUE_SORTER:ss,ARTICLE_POSITION_SORTER:cs,ARTICLE_RANK_SORTER:ni,ARTICLE_ROW_SORTER:ii,ARTICLE_TOP_SORTER:as,ARTICLE_TO_SORTER:rs},Symbol.toStringTag,{value:"Module"})),ln=new Map;function cn(t,e){!t||typeof e!="function"||ln.set(t,e)}function us(t){return ln.get(t)}const oi=["#2563eb","#dc2626","#16a34a","#9333ea","#ea580c","#0891b2","#be123c","#4f46e5"],Kt={source:"data",includeZero:!1,padding:.05,tickMode:"round",tickTarget:5},ds={area:{stacking:{active:!0,interpolation:"linear"}}},hn={lineWidth:2,lineDash:[],area:{fillColor:null,opacity:.2},point:{visible:!1,radius:2.5,fillColor:null,strokeColor:null,lineWidth:1}},un={padding:{top:8,right:12,bottom:8,left:48},backgroundColor:"rgba(255, 255, 255, 0)",gridLine:{x:{major:{visible:!0,color:"rgba(0, 0, 0, 0.08)",thickness:1},minor:{visible:!0,color:"rgba(0, 0, 0, 0.035)",thickness:1,minimumSpacing:20}},y:{major:{visible:!0,color:"rgba(120, 120, 120, 0.24)",thickness:1}}},axis:{visible:!0,color:"rgba(80, 80, 80, 0.45)",lineWidth:1},yAxis:{visible:!0,font:"normal 11px Calibri",color:"#555",margin:6,thousandsSeparator:",",formatter:null},legend:{visible:"auto",position:"top-left",font:"normal 12px Calibri",color:"#333",markerSize:10,markerGap:4,itemGap:12,inset:{x:8,y:8}},series:W({},hn)};function Ct(t){return typeof t=="number"&&Number.isFinite(t)}function si(t){return t!=null&&t.date&&typeof t.date.toKeyString=="function"?t.date.toKeyString():null}function dn(t){var n,o;const e=((o=(n=t==null?void 0:t.typeOptions)==null?void 0:n.area)==null?void 0:o.stacking)||{},i=e.interpolation;return{active:e.active!==!1,interpolation:i==="step"||i==="none"?i:"linear"}}function fs(t,e){return(t==null?void 0:t.date)&&t.date.compare(e)===0}function ms(t,e,i){let n=null;for(let o=i;o<t.length&&fs(t[o],e);o++)n=t[o];return n}function gs(t,e){let i=0,n=t.length;for(;i<n;){const o=Math.floor((i+n)/2);t[o].date.compare(e)<0?i=o+1:n=o}return i}function ps(t,e){var i,n;for(let o=e-1;o>=0;o--){if(Ct((i=t[o])==null?void 0:i.value))return t[o];if(((n=t[o])==null?void 0:n.value)===null)return null}return null}function ys(t,e){var i,n;for(let o=e;o<t.length;o++){if(Ct((i=t[o])==null?void 0:i.value))return t[o];if(((n=t[o])==null?void 0:n.value)===null)return null}return null}function ws(t,e,i){if(!e||!i||!e.date||!i.date)return 0;const n=e.date.getDaysTo(i.date);if(!Ct(n)||n===0)return e.value;const o=e.date.getDaysTo(t);return Ct(o)?e.value+(i.value-e.value)*(o/n):0}function bs(t,e,i,n){const o=ps(t,i),s=ys(t,i);return!o||!s||n==="none"?0:n==="step"?o.value:ws(e,o,s)}function vs(t){var i;const e=new Map;for(let n=0;n<t.length;n++){const o=Array.isArray((i=t[n])==null?void 0:i.points)?t[n].points:[];for(let s=0;s<o.length;s++){const r=o[s],a=si(r);a&&e.set(a,r.date)}}return Array.from(e.values()).sort((n,o)=>n.compare(o))}function Ss(t,e,i){const n=Array.isArray(t==null?void 0:t.points)?t.points:[];return e.map(o=>{const s=gs(n,o),r=ms(n,o,s);return r?{date:o,value:Ct(r.value)?r.value:null,sourcePoint:r,isResolved:!0}:{date:o,value:bs(n,o,s,i),sourcePoint:null,isResolved:!0}})}function Ls(t){const e=new Map,i=Array.isArray(t==null?void 0:t.series)?t.series:[],n=vs(i),{interpolation:o}=dn(t),s=i.map(r=>{const l=Ss(r,n,o).map(c=>{const h=si(c);if(!Ct(c.value))return{date:c.date,value:null,baseValue:null,sourcePoint:c.sourcePoint,isResolved:!0};const u=h&&e.get(h)||0;return{date:c.date,value:u+c.value,baseValue:u,sourcePoint:c.sourcePoint,isResolved:!0}});for(let c=0;c<l.length;c++){const h=l[c],u=si(h);u&&Ct(h.value)&&e.set(u,h.value)}return{series:r,points:l}});return t._resolvedAreaXDomain=n,t._resolvedStackedAreaSeries=s,t._resolvedStackedAreaDirty=!1,s}function fn(t){return(t==null?void 0:t.type)==="area"&&dn(t).active}function mn(t){return(Array.isArray(t==null?void 0:t.series)?t.series:[]).map(i=>{const n=Array.isArray(i==null?void 0:i.points)?i.points.map(o=>({date:o==null?void 0:o.date,value:Ct(o==null?void 0:o.value)?o.value:null,baseValue:Ct(o==null?void 0:o.value)?0:null,sourcePoint:o})):[];return{series:i,points:n}})}function _s(t){return fn(t)?t&&t._resolvedStackedAreaDirty!==!0&&Array.isArray(t._resolvedStackedAreaSeries)?t._resolvedStackedAreaSeries:Ls(t):mn(t)}function gn(t){return fn(t)?_s(t):mn(t)}function Jt(t){return typeof t=="number"&&Number.isFinite(t)}function ke(t){const e=Number(t);return Number.isFinite(e)?e:null}function ri(t,e=5){const i=Number(t),n=Number.isFinite(i)?i:e;return Math.max(2,Math.round(n))}function pn(t){const e=t!=null&&t.scale?ke(t.scale.tickTarget):null;return e!=null?ri(e):Kt.tickTarget}function yn(t,e){const i=e&&e.tokens?e.tokens:null;return!i||!i.start||!i.end||!t.date?!0:!t.date.isAfter(i.end)&&!i.start.isAfter(t.date)}function wn(t,e,i){return!i||!i.start||!i.end||!(t!=null&&t.date)||!(e!=null&&e.date)?!0:t.date.compare(i.end)<=0&&e.date.compare(i.start)>=0}function As(t,e){Jt(t)&&(e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),e.hasValues=!0)}function Qt(t,e){As(t==null?void 0:t.value,e)}function Is(t,e){const i=e&&e.tokens?e.tokens:null,n=(t.scale||Kt).source==="viewport",o={min:1/0,max:-1/0,hasValues:!1},s=gn(t);for(let r=0;r<s.length;r++){const a=s[r].points;for(let l=0;l<a.length;l++){const c=a[l];if(!Jt(c==null?void 0:c.value)||((!n||yn(c,e))&&Qt(c,o),!n||l>=a.length-1))continue;const h=a[l+1];Jt(h==null?void 0:h.value)&&wn(c,h,i)&&(Qt(c,o),Qt(h,o))}}return o.hasValues?{min:o.min,max:o.max}:null}function Ms(t,e){const i=e&&e.tokens?e.tokens:null,n={min:1/0,max:-1/0,hasValues:!1};for(let o=0;o<t.series.length;o++){const s=t.series[o];for(let r=0;r<s.points.length;r++){const a=s.points[r];if(yn(a,e)&&Qt(a,n),r>=s.points.length-1)continue;const l=s.points[r+1];Jt(a==null?void 0:a.value)&&Jt(l==null?void 0:l.value)&&wn(a,l,i)&&(Qt(a,n),Qt(l,n))}}return n.hasValues?{min:n.min,max:n.max}:null}function Cs(t,e){if(t.type==="area")return Is(t,e);if((t.scale||Kt).source==="viewport")return Ms(t,e);let o=1/0,s=-1/0,r=!1;for(let a=0;a<t.series.length;a++){const l=t.series[a];for(let c=0;c<l.points.length;c++){const h=l.points[c];Jt(h.value)&&(o=Math.min(o,h.value),s=Math.max(s,h.value),r=!0)}}return r?{min:o,max:s}:null}function ai(t,e){if(t!==e)return{min:t,max:e};const i=Math.abs(t)||1;return{min:t-i*.5,max:e+i*.5}}function li(t,e){if(!Number.isFinite(t)||t<=0)return 1;const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let o;return e?n<1.5?o=1:n<3?o=2:n<7?o=5:o=10:n<=1?o=1:n<=2?o=2:n<=5?o=5:o=10,o*Math.pow(10,i)}function Ds(t){if(!Number.isFinite(t))return 0;const e=t.toExponential(),i=Number(e.split("e")[1]);return Math.max(0,-i+1)}function bn(t,e){const i=Math.min(12,Ds(e));return Number(t.toFixed(i))}function Ts(t,e,i,n,o){const s=e-t,r=li(s,!1),a=li(r/(ri(i)-1),!0);return{min:n?t:Math.floor(t/a)*a,max:o?e:Math.ceil(e/a)*a}}function Ps(t,e){const i=W(W({},Kt),t.scale||{}),n=Cs(t,e),o=ke(i.min),s=ke(i.max),r=o!=null,a=s!=null;let l,c;n?(l=n.min,c=n.max):o!=null&&s!=null?(l=o,c=s):o!=null?(l=o,c=o+1):s!=null?(l=s-1,c=s):(l=0,c=1),i.includeZero&&(l=Math.min(0,l),c=Math.max(0,c)),{min:l,max:c}=ai(l,c);const h=ke(i.padding);if(h!=null&&h>0){const u=c-l;l-=u*h,c+=u*h}if(o!=null&&(l=o),s!=null&&(c=s),c<l){const u=l;l=c,c=u}return{min:l,max:c}=ai(l,c),i.tickMode!=="exact"&&({min:l,max:c}=Ts(l,c,pn(t),r,a),{min:l,max:c}=ai(l,c)),{min:l,max:c}}function ks(t,e,i=5){const n=Math.max(2,Math.round(Number.isFinite(i)?i:5)),o=[],s=(e-t)/(n-1);for(let r=0;r<n;r++)o.push(t+s*r);return o}function Rs(t,e,i=5){const n=ri(i),o=li((e-t)/(n-1),!0),s=[];let r=t;for(;r<e&&s.length<1e3;)s.push(bn(r,o)),r+=o;return(s.length===0||s[s.length-1]!==e)&&s.push(bn(e,o)),s}function Os(t,e){var o;const i=pn(t);return(((o=t==null?void 0:t.scale)==null?void 0:o.tickMode)||Kt.tickMode)==="exact"?ks(e.min,e.max,i):Rs(e.min,e.max,i)}function Es(t,e){if(typeof e!="string"||e.length===0)return t;const i=t.split(".");return i[0]=i[0].replace(/\B(?=(\d{3})+(?!\d))/g,e),i.join(".")}function Ns(t,e,i){if(typeof e=="function")return e(t);let n;return Math.abs(t)>=1e3||Math.abs(t)<.01?n=Number(t.toPrecision(4)).toString():n=Number(t.toFixed(2)).toString(),Es(n,i)}function X(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function xs(t){const e=t.padding||{};return{top:X(e.top,8),right:X(e.right,12),bottom:X(e.bottom,8),left:X(e.left,48)}}function zs(t){switch(t){case"top-right":case"bottom-left":case"bottom-right":return t;default:return"top-left"}}function Fs(t){const e=t.inset||{};return{x:X(e.x,8),y:X(e.y,8)}}function Bs(t,e){const i=t.left+e.left,n=t.top+e.top,o=t.right-e.right,s=t.bottom-e.bottom;return{left:i,top:n,right:o,bottom:s,width:Math.max(0,o-i),height:Math.max(0,s-n)}}function te(t,e,i){return i.bottom-(t-e.min)/(e.max-e.min)*i.height}function ee(t,e,i){return Math.max(e,Math.min(i,t))}function vn(t,e){const i=e&&e.tokens?e.tokens:null;if(!i||!i.start||!i.end||t.length===0)return{start:0,end:t.length-1};let n=0,o=t.length;for(;n<o;){const a=Math.floor((n+o)/2);t[a].date.compare(i.start)<0?n=a+1:o=a}const s=n;if(s===t.length)return{start:t.length-1,end:t.length-1};for(n=s,o=t.length;n<o;){const a=Math.floor((n+o)/2);t[a].date.compare(i.end)<=0?n=a+1:o=a}const r=n;return{start:Math.max(0,s-1),end:Math.min(t.length-1,r)}}function ci(t,e){t.beginPath(),t.moveTo(e.left,e.top),t.lineTo(e.right,e.top),t.lineTo(e.right,e.bottom),t.lineTo(e.left,e.bottom),t.closePath(),t.clip()}function Hs(t,e,i){const n=e.x-t.x,o=e.y-t.y;let s=0,r=1,a=null,l=null;const c=[[-n,t.x-i.left],[n,i.right-t.x],[-o,t.y-i.top],[o,i.bottom-t.y]];for(let u=0;u<c.length;u++){const[m,d]=c[u];if(m===0){if(d<0)return null;continue}const g=d/m;if(m<0?g>s&&(s=g,a=u):g<r&&(r=g,l=u),s>r)return null}const h=(u,m)=>{if(u===0)return t;if(u===1)return e;const d={x:ee(t.x+n*u,i.left,i.right),y:ee(t.y+o*u,i.top,i.bottom)};return m===0?d.x=i.left:m===1?d.x=i.right:m===2?d.y=i.top:m===3&&(d.y=i.bottom),d};return{from:h(s,a),to:h(r,l)}}function Ys(t,e){return t&&e&&t.x===e.x&&t.y===e.y}function Sn(t,e,i){if(t.length===0)return t;const n=[];let o=t[t.length-1],s=e(o);for(let r=0;r<t.length;r++){const a=t[r],l=e(a);l?(s||n.push(i(o,a)),n.push(a)):s&&n.push(i(o,a)),o=a,s=l}return n}function Ws(t,e){const i=(s,r,a)=>Sn(s,l=>a?l.x>=r:l.x<=r,(l,c)=>{const h=(r-l.x)/(c.x-l.x);return{x:r,y:ee(l.y+(c.y-l.y)*h,e.top,e.bottom)}}),n=(s,r,a)=>Sn(s,l=>a?l.y>=r:l.y<=r,(l,c)=>{const h=(r-l.y)/(c.y-l.y);return{x:ee(l.x+(c.x-l.x)*h,e.left,e.right),y:r}});let o=i(t,e.left,!0);return o=i(o,e.right,!1),o=n(o,e.top,!0),n(o,e.bottom,!1)}function Vs(t,e,i){i.backgroundColor&&(t.fillStyle=i.backgroundColor,t.fillRect(e.left,e.top,e.width,e.height))}function Zs(t,e,i,n,o){const s=e.style||{},r=s.gridLine||{},a=s.axis||{},l=s.yAxis||{},c=Os(e,n);Gs(t,i,r,e.owner,o);const h=r.y&&r.y.major?r.y.major:{};if(h.visible!==!1){t.beginPath(),t.lineWidth=X(h.thickness,1),t.strokeStyle=h.color||"rgba(120, 120, 120, 0.24)";for(let u=0;u<c.length;u++){const m=Math.round(te(c[u],n,i))+.5;t.moveTo(i.left,m),t.lineTo(i.right,m)}t.stroke()}if(a.visible!==!1&&(t.beginPath(),t.lineWidth=X(a.lineWidth,1),t.strokeStyle=a.color||"rgba(80, 80, 80, 0.45)",t.moveTo(i.left,i.top),t.lineTo(i.left,i.bottom),t.lineTo(i.right,i.bottom),t.stroke()),l.visible!==!1){t.font=l.font||"normal 11px Calibri",t.fillStyle=l.color||"#555",t.textAlign="right",t.textBaseline="middle";const u=X(l.margin,6);for(let m=0;m<c.length;m++){const d=te(c[m],n,i);t.fillText(Ns(c[m],l.formatter,l.thousandsSeparator),i.left-u,d)}}}function Ln(t,e){const i=t&&t.markers?t.markers:null,n=i?i[e]:null;return Array.isArray(n)?n:[]}function Us(t,e){var n;if(e<=0)return!0;const i=(n=t==null?void 0:t.timescaleManager)==null?void 0:n.unitSizeInPixels;return typeof i!="number"||!Number.isFinite(i)?!0:i>=e}function _n(t,e,i,n,o=0){if(!(!n||n.visible!==!0||i.length===0)){t.beginPath(),t.lineWidth=X(n.thickness,1),t.strokeStyle=n.color||"rgba(0, 0, 0, 0.08)";for(let s=0;s<i.length;s++){const r=i[s];if(r.adaptive&&r.markerSpacingInPixels<o||typeof r.drawX!="number"||!Number.isFinite(r.drawX))continue;const a=Math.round(r.drawX)+.5;a<e.left||a>e.right||(t.moveTo(a,e.top),t.lineTo(a,e.bottom))}t.stroke()}}function Gs(t,e,i,n,o){const s=i.x||{},r=s.major||{},a=s.minor||{},l=Math.max(0,X(a.minimumSpacing,20));_n(t,e,Ln(o,F),r),Us(n,l)&&_n(t,e,Ln(o,k),a,l)}function js(t,e,i){const n=e.style.legend||{},o=n.visible==null?"auto":n.visible,s=e.series.filter(v=>v.title);if(o===!1||o==="auto"&&s.length<2)return;t.save(),t.font=n.font||"normal 12px Calibri",t.fillStyle=n.color||"#333",t.textAlign="left",t.textBaseline="middle";const r=X(n.markerSize,10),a=X(n.markerGap,4),l=X(n.itemGap,12),c=Fs(n),h=zs(n.position),u=[],m=Math.max(0,i.width-c.x);let d=0;for(let v=0;v<s.length;v++){const S=s[v],M=t.measureText(S.title).width,P=r+a+M,E=d===0?P:d+l+P;if(E>m)break;u.push({series:S,entryWidth:P}),d=E}const g=h==="top-right"||h==="bottom-right",p=h==="bottom-left"||h==="bottom-right";let w=g?i.right-c.x-d:i.left+c.x;const b=p?i.bottom-c.y-r/2:i.top+c.y+r/2;for(let v=0;v<u.length;v++){const S=u[v];t.fillStyle=S.series.style.color,t.fillRect(w,b-r/2,r,r),t.fillStyle=n.color||"#333",t.fillText(S.series.title,w+r+a,b),w+=S.entryWidth+l}t.restore()}function An(t,e,i,n,o,s,r=i.points){const a=i.style||{},l=X(a.lineWidth,2);t.save(),ci(t,o),t.beginPath(),t.lineWidth=l,t.strokeStyle=a.color||"#2563eb",Array.isArray(a.lineDash)&&typeof t.setLineDash=="function"&&t.setLineDash(a.lineDash);let c=null,h=null;const u=vn(r,s);for(let m=u.start;m<=u.end;m++){const d=r[m];if(typeof d.value!="number"||!Number.isFinite(d.value)){c=null,h=null;continue}const g=e.getPixel(d.date,s),p=te(d.value,n,o),w={x:g,y:p};if(c&&Number.isFinite(c.x)&&Number.isFinite(c.y)&&Number.isFinite(w.x)&&Number.isFinite(w.y)){const b=Hs(c,w,o);b?(Ys(h,b.from)||t.moveTo(b.from.x,b.from.y),t.lineTo(b.to.x,b.to.y),h=b.to):h=null}c=w}t.stroke(),typeof t.setLineDash=="function"&&t.setLineDash([]),t.restore()}function $s(t,e,i,n,o,s){const r=i.series||{},a=i.points||[],l=r.style||{},c=l.area||{},h=ee(X(c.opacity,.2),0,1);t.save(),ci(t,o),t.fillStyle=c.fillColor||l.color||"#2563eb",t.globalAlpha=X(t.globalAlpha,1)*h;let u=[];const m=vn(a,s),d=()=>{if(u.length===0)return;const g=[];for(let w=0;w<u.length;w++)g.push({x:u[w].x,y:u[w].y});for(let w=u.length-1;w>=0;w--)g.push({x:u[w].x,y:u[w].baseY});const p=Ws(g,o);if(p.length>=3){t.beginPath(),t.moveTo(p[0].x,p[0].y);for(let w=1;w<p.length;w++)t.lineTo(p[w].x,p[w].y);t.closePath(),t.fill()}u=[]};for(let g=m.start;g<=m.end;g++){const p=a[g];if(typeof p.value!="number"||!Number.isFinite(p.value)||typeof p.baseValue!="number"||!Number.isFinite(p.baseValue)){d();continue}const w=e.getPixel(p.date,s),b=te(p.value,n,o),v=ee(te(p.baseValue,n,o),o.top,o.bottom);u.push({x:w,y:b,baseY:v})}d(),t.restore()}function In(t,e,i,n,o,s,r=i.points,a={}){var u;const l=((u=i.style)==null?void 0:u.point)||{};if(l.visible!==!0)return;const c=X(l.radius,2.5),h=X(l.lineWidth,1);t.save(),ci(t,o),t.lineWidth=h,t.fillStyle=l.fillColor||i.style.color||"#2563eb",t.strokeStyle=l.strokeColor||"#fff";for(let m=0;m<r.length;m++){const d=r[m];if(a.sourcePointsOnly&&!d.sourcePoint||typeof d.value!="number"||!Number.isFinite(d.value))continue;const g=e.getPixel(d.date,s);if(g<o.left-c||g>o.right+c)continue;const p=te(d.value,n,o);t.beginPath(),t.arc(g,p,c,0,Math.PI*2),t.fill(),h>0&&t.stroke()}t.restore()}function Mn({chart:t,ctx:e,geometry:i,drawCycleContext:n,stackArea:o=!1}){if(!i||i.width<=0||i.height<=0)return;const s=t.style||{},r=xs(s),a=Bs(i,r);if(a.width<=0||a.height<=0)return;const l=t.getScaleDomain(n);Vs(e,i,s),Zs(e,t,a,l,n);const c=o?gn(t):t.series;for(let h=0;h<c.length;h++)if(o){const u=c[h];$s(e,t.owner,u,l,a,n),An(e,t.owner,u.series,l,a,n,u.points),In(e,t.owner,u.series,l,a,n,u.points,{sourcePointsOnly:!0})}else An(e,t.owner,c[h],l,a,n),In(e,t.owner,c[h],l,a,n);js(e,t,a)}function Xs(t){Mn(t)}function qs(t){Mn(zt(W({},t),{stackArea:!0}))}cn("line",Xs),cn("area",qs);function ie(t,e,...i){return typeof t=="function"?t.call(e,...i):t}function Yt(t,e=null){const i=parseInt(t,10);return Number.isFinite(i)?i:e}function Ks(t,e){if(!e||typeof e!="object")return null;const i=Yt(e.year);if(i==null)return null;const n=Yt(e.month,1),o=Yt(e.day,1),s=me(e);let r=new y({year:i,month:n,day:o,precision:s,hour:Yt(e.hour,0),minute:Yt(e.minute,0),second:Yt(e.second,0),millisecond:Yt(e.millisecond,0)});return r=t.getDmyFromInput(r),y.CreateAsStartOfPeriod(r,s)}function Js(t,e){if(!e||typeof e!="object")return null;const i=Ks(t,e.date);if(!i)return null;const n=e.value===null?null:Number(e.value);return{date:i,value:Number.isFinite(n)?n:null}}function Qs(t,e){return t!=null&&Object.prototype.hasOwnProperty.call(t,e)}function tr(t){return Qs(t==null?void 0:t.style,"color")}function er(t){var e;return!!((e=t==null?void 0:t.series)!=null&&e.color)}function ir(t,e){const i=Array.isArray(t==null?void 0:t._seriesColors)?t._seriesColors:[];for(let n=0;n<i.length;n++)if(i[n].id===e)return i[n].color}function nr(t,e,i){if(t){Array.isArray(t._seriesColors)||(t._seriesColors=[]);for(let n=0;n<t._seriesColors.length;n++)if(t._seriesColors[n].id===e){t._seriesColors[n].color=i;return}t._seriesColors.push({id:e,color:i})}}function or(t){const e=t&&t.seriesColors;if(!Array.isArray(e))return oi;const i=e.filter(n=>typeof n=="string"&&n.length>0);return i.length>0?i:oi}function sr(t,e,i,n,o,s){const r=i||{},a=L({},hn,e.series||{});a.color||(a.color=o||s[n%s.length]);const l=Array.isArray(r.points)?r.points.map(c=>Js(t,c)).filter(Boolean):[];return l.sort((c,h)=>c.date.compare(h.date)),{id:r.id!=null?r.id:n,title:r.title||"",style:L({},a,r.style||{}),points:l}}function Cn(t,e){return t&&t.id!=null?t.id:e}function Dn(t){const e=t._getResolvedData();return Array.isArray(e.series)?e.series.slice():[]}function Tn(t,e){t.data||(t.data={id:t.id}),t.data.series=e,t._resolveFromData(),t.owner&&typeof t.owner.requestRedraw=="function"&&t.owner.requestRedraw()}function ct(t,e){this.id=e,this.owner=t,this.isDataLoaded=!1,this.type="line",this.title="",this.laneId=null,this.area=null,this.scale={},this.typeOptions={},this.style={},this.series=[],this._seriesColors=[],this._resolvedAreaXDomain=[],this._resolvedStackedAreaSeries=null,this._resolvedStackedAreaDirty=!0}ct.prototype.setupByReceivedData=function(t){this.data=L({},t||{}),this.id=this.data.id!=null?this.data.id:this.id,this._resolveFromData(),this.isDataLoaded=!0},ct.prototype._getResolvedData=function(){const t=this.owner&&this.owner.options?this.owner.options.chart||{}:{},e=L({},t.defaultData||{});return delete e.id,L({},e,this.data||{})},ct.prototype._resolveFromData=function(){const t=this.owner&&this.owner.options?this.owner.options.chart||{}:{},e=this._getResolvedData(),i=_(e,"type")||"line",n=_(e,"lane");this.type=i==="line"?i:String(i),this.title=_(e,"title")||"",this.laneId=n!=null&&n!==""?n:null,this.area=_(e,"area")||null,this.scale=L({},Kt,_(e,"scale")||{}),this.typeOptions=L({},ds,_(e,"typeOptions")||{}),this.style=L({},un,t.defaultStyle||{},_(e,"style")||{});const o=Array.isArray(e.series)?e.series:[],s=or(t);this.series=o.map((r,a)=>{const l=Cn(r,a),c=ir(this,l),h=sr(this.owner,this.style,r,a,c,s);return(tr(r)||!er(this.style))&&nr(this,l,h.style.color),h}),this._resolvedStackedAreaDirty=!0},ct.prototype.addSeries=function(t){const e=Dn(this);e.push(t||{}),Tn(this,e)},ct.prototype.removeSeriesById=function(t){const e=Dn(this);for(let i=0;i<e.length;i++)if(Cn(e[i],i)===t)return e.splice(i,1),Tn(this,e),!0;return!1},ct.prototype.getSeriesById=function(t){for(let e=0;e<this.series.length;e++){const i=this.series[e];if(i.id===t)return i}},ct.prototype.getScaleDomain=function(t){return Ps(this,t)},ct.prototype.draw=function(t,e,i){const n=us(this.type);if(!n){T.warn(`Unknown chart type "${this.type}". Skipping chart render.`,{chartId:this.id});return}n({chart:this,ctx:t,geometry:e,drawCycleContext:i})},ct.prototype.setOption=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return _(this.data,t);t=bt(t,e)}t=L({},t);const i=A(t,"lane");if(!(A(t,"id")&&(T.warn("Ignoring chart id change; chart ids are immutable after load",{chartId:this.id,nextId:_(t,"id")}),delete t.id,Object.keys(t).length===0))){if(L(this.data,t),i&&this.owner&&typeof this.owner._ensureChartLane=="function"){const o=_(this.data,"lane");o!=null&&o!==""&&this.owner._ensureChartLane(o)}this._resolveFromData(),i&&this.owner&&(typeof this.owner._refreshLaneOrder=="function"&&this.owner._refreshLaneOrder(),typeof this.owner._updateLaneLayout=="function"&&this.owner._updateLaneLayout()),this.owner.requestRedraw()}},ct.prototype.setStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return _(this.style,t);t=bt(t,e)}this.data.style=L(this.data.style||{},t),this._resolveFromData(),this.owner.requestRedraw()},Object.defineProperty(ct.prototype,"visibility",{get(){const t=this&&this.data?this.data.visibility:void 0;if(typeof t=="undefined")return"visible";const e=ie(t,this,this);return e==="visible"||e==="hidden"?e:(T.warn("Invalid Chart.visibility value; expected 'visible'|'hidden'. Defaulting to 'visible'",{chartId:this&&this.id,value:e}),"visible")},set(t){this.data||(this.data={}),this.data.visibility=t},enumerable:!0,configurable:!1});const rr=["defaultCardLayout","defaultStyle","defaultHoverStyle","defaultActiveStyle","layoutStyles"],ar=["defaultData","density","distanceToBaseline","autoStacking.active","autoStacking.rowSpacing","autoStacking.fitToHeight","autoStacking.topGap","periodLine.baselineGap","periodLine.spacing","periodLine.thickness"];function Pn(t,e){if(!t||typeof t!="object")return!1;for(let i=0;i<e.length;i++)if(A(t,e[i]))return!0;return!1}function ge(t){return typeof t=="number"&&Number.isFinite(t)}function hi(t,e,i){return Math.min(Math.max(t,e),i)}function kn(t){const e=Pn(t,rr);return{cacheChanged:e||Pn(t,ar),styleChanged:e}}function Rn(t={},e={}){const i=t||{},n=e||{},o=i.autoStacking||{},s=n.autoStacking||{},r=i.periodLine||{},a=n.periodLine||{};return{defaultData:L({},i.defaultData||{},n.defaultData||{}),density:Object.prototype.hasOwnProperty.call(n,"density")?n.density:i.density,distanceToBaseline:L({},i.distanceToBaseline||{},n.distanceToBaseline||{}),defaultCardLayout:Object.prototype.hasOwnProperty.call(n,"defaultCardLayout")?n.defaultCardLayout:i.defaultCardLayout,defaultStyle:L({},i.defaultStyle||{},n.defaultStyle||{}),defaultHoverStyle:L({},i.defaultHoverStyle||{},n.defaultHoverStyle||{}),defaultActiveStyle:L({},i.defaultActiveStyle||{},n.defaultActiveStyle||{}),layoutStyles:L({},i.layoutStyles||{},n.layoutStyles||{}),autoStacking:{active:A(n,"autoStacking.active")?s.active:o.active,rowSpacing:A(n,"autoStacking.rowSpacing")?s.rowSpacing:o.rowSpacing,fitToHeight:A(n,"autoStacking.fitToHeight")?s.fitToHeight:o.fitToHeight,topGap:A(n,"autoStacking.topGap")?s.topGap:o.topGap},periodLine:{baselineGap:A(n,"periodLine.baselineGap")?a.baselineGap:r.baselineGap,spacing:A(n,"periodLine.spacing")?a.spacing:r.spacing,thickness:A(n,"periodLine.thickness")?a.thickness:r.thickness}}}function lr(t,e,i,n){var p;if(!t||t.active!==!0)return null;const o=t.lanesOnly!==!1;if(!i&&o)return null;const s=(p=t.byCardLayout)==null?void 0:p[n];if(!s)return null;const r=Math.max(0,ge(e)?e:0),a=Math.max(0,ge(s.ratio)?s.ratio:0),l=ge(s.min)?s.min:0,c=ge(s.max)?s.max:Number.POSITIVE_INFINITY,h=Math.max(0,Math.min(l,c)),u=Math.max(h,c),m=hi(h,0,r),d=hi(u,m,r),g=Math.round(r*a);return hi(g,m,d)}function Re(t,e,i,n){const o=lr(t==null?void 0:t.responsive,e,i,n);return Number.isFinite(o)?o:ge(t==null?void 0:t.value)?t.value:0}const cr={from:{},to:{},rank:0,starred:!1,hidePeriodLine:!1,hiddenByFilter:!1},hr={width:150,color:"#e5e5e5",backgroundColor:"#fff",topRadius:3,maxImageHeight:400,image:{shape:"natural",margin:0,maxHeight:200,borderRadius:0},header:{height:50,text:{font:"normal 14px 'Segoe UI'",align:"left",baseline:"middle",margin:10,color:"#333",lineHeight:18,numberOfLines:2,offsetY:0}},subheader:{height:30,color:"#555",text:{font:"normal 11px 'Segoe UI'",color:"#eee",align:"left",baseline:"middle",margin:10,lineHeight:6,offsetY:0}},shadow:{x:0,y:0,amount:0,color:"#000"},border:{color:"#ddd",width:1},connectorLine:{visible:!0,offsetX:18,offsetY:-20,thickness:1,arrow:{width:16,height:45}},star:{width:16,margin:3}},ur={color:"#a6c6e2"},dr={color:"#337ab7",header:{text:{color:"#fff"}},subheader:{color:"#333"},shadow:{x:3,y:3,amount:5,color:"#333"},border:{width:2,color:"#2e6da4"},connectorLine:{thickness:2}},fr={heightWeight:1,header:{visible:!0,height:24,padding:{left:12,right:12}}},mr={header:{},body:{},title:{}},gr={backgroundColor:"rgba(200, 200, 200, 0.25)",border:{color:"rgba(120, 120, 120, 0.25)",width:1},text:{font:"normal 16px Calibri",color:"#555",align:"left",baseline:"bottom",verticalAlign:"bottom",margin:4,offsetY:0}},On="#cdd2d8",En={width:1e3,height:500,verticalOffset:40,enableUserControl:!0,enableCursor:!0,canvas:{dpr:"auto",dprMode:"stable",maxDpr:3},debugOverlays:{densityRegions:!1},zoom:{initial:34,minimum:0,maximum:123,wheelStep:.2,wheelSpeed:3,allowCtrlWheel:!1,wheelMode:"auto",discreteWheelAnimation:{active:!0,duration:250},proportionalGain:2,proportionalExponent:1.1,ratio:.8,unitSize:{initial:200,showMinorLabels:48,minimum:8,minimumMajor:120}},initialDate:{year:1990,month:1,day:1},bounds:{minDate:null,maxDate:null,overflow:"elastic"},shiftBceDates:!1,draggingVicinity:!0,pan:{momentum:{active:!0,sampleWindow:100,minVelocity:.01,stopVelocity:.005,friction:.005,maxDuration:5600}},style:{mainLine:{visible:!0,position:"bottom",size:8,color:On,opacity:.75,dateIndicators:{visible:!0,shape:"rectangle",size:4,color:"#666",opacity:1,hiddenStyle:{opacity:.25},activeStyle:{color:"article",opacity:1}}},draggingHighlight:{visible:!0,color:"rgba(237, 247, 255, 0.5)",area:{up:0,down:"edge"}},marker:{minor:{height:12,extend:!1,color:"#6097f2",futureColor:"#ccc"},major:{height:30,extend:!1,color:"#0c3a88",futureColor:"#ccc"}},dateLabel:{minor:{font:"normal 10px Calibri",color:"#333",futureColor:"#ccc",textAlign:"start",offset:{x:4,y:0},bceText:"",thousandsSeparator:",",yearPrefixes:{ka:{label:"ka",value:1e3,minDivision:1e3},Ma:{label:"Ma",value:1e6,minDivision:1e5},Ga:{label:"Ga",value:1e9,minDivision:1e8}}},major:{font:"normal 16px Calibri",color:"#000",futureColor:"#ccc",textAlign:"start",offset:{x:4,y:0},sticky:{enabled:"auto",offsetX:4},bceText:" ʙᴄᴇ",thousandsSeparator:",",yearPrefixes:{ka:{label:"ka",value:1e3,minDivision:1e5},Ma:{label:"Ma",value:1e6,minDivision:1e6},Ga:{label:"Ga",value:1e9,minDivision:1e9}}},parent:{visible:!1,levels:"all",height:20,font:"normal 14px Calibri",color:"#444",futureColor:"#ccc",textAlign:"start",offset:{x:4,y:0},sticky:{enabled:!0,offsetX:4}}},cursor:{timeline:{hover:"default",dragging:"e-resize"},clickable:"pointer",article:{hoverDraggable:"move",dragging:"move"}}},timeBand:{visible:!0,reserveSpace:!0,reserveSpacePixels:20,area:{up:0,down:"edge"},defaultStyle:gr,data:[]},chart:{visible:!0,area:{up:"edge",down:0},seriesColors:[...oi],defaultData:{},defaultStyle:L({},un),data:[]},lane:{visible:!0,defaultId:"default",gap:0,topGap:0,axisGap:0,defaultLayout:L({},fr),defaultStyle:L({},mr),defaultClassName:"",defaultHeaderClassName:"",defaultBodyClassName:"",defaultTitleClassName:"",data:[]},image:{maxConcurrent:6,maxCacheBytes:64*1024*1024,requireCORS:!1,decodeMode:"auto",sanitizer:{allowedSchemes:["http","https","data","blob"]}},article:{density:"all",rendering:{pixelSnap:"device"},draggable:!0,distanceToBaseline:{value:350,responsive:{active:!0,lanesOnly:!0,byCardLayout:{portrait:{ratio:.6,min:310,max:410},landscape:{ratio:.6,min:100,max:160}}}},collectOngoing:!1,autoStacking:{active:!0,rowSpacing:50,range:"all",fitToHeight:!0,topGap:10},periodLine:{position:"lane",baselineGap:0,spacing:4,thickness:10,stacking:{sorter:an,reverseOrder:!1}},animation:{fade:{active:!0,duration:1500,easing:"swing"},move:{active:!0,duration:1500,easing:"swing"}},star:{visible:!0},defaultData:W({},cr),defaultCardLayout:"portrait",cardLayoutBreakpoints:[{maxHeight:320,layout:"landscape"}],defaultStyle:W({},hr),defaultHoverStyle:W({},ur),defaultActiveStyle:W({},dr),layoutStyles:{}}};function pr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ui(t,e){T.warn(`DEPRECATION WARNING: ${t} is deprecated. Use ${e} instead.`)}const yr=new Set(["rectangle","circle"]);function di(t,e,{allowVisible:i=!1}={}){if(t!==void 0){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError(`${e} must be an object`);if(i&&t.visible!==void 0&&typeof t.visible!="boolean")throw new TypeError(`${e}.visible must be a boolean`);if(t.shape!==void 0&&!yr.has(t.shape))throw new TypeError(`${e}.shape must be "rectangle" or "circle"`);if(t.size!==void 0&&(typeof t.size!="number"||!Number.isFinite(t.size)||t.size<=0))throw new TypeError(`${e}.size must be a positive finite number`);if(t.color!==void 0&&typeof t.color!="string")throw new TypeError(`${e}.color must be a CSS colour string or "article"`);if(t.opacity!==void 0&&(typeof t.opacity!="number"||!Number.isFinite(t.opacity)||t.opacity<0||t.opacity>1))throw new TypeError(`${e}.opacity must be a finite number between 0 and 1`)}}function wr(t){var i,n;const e=(n=(i=t==null?void 0:t.style)==null?void 0:i.mainLine)==null?void 0:n.dateIndicators;di(e,"style.mainLine.dateIndicators",{allowVisible:!0}),di(e==null?void 0:e.hiddenStyle,"style.mainLine.dateIndicators.hiddenStyle"),di(e==null?void 0:e.activeStyle,"style.mainLine.dateIndicators.activeStyle")}function Nn(t,e,i){(t==null?void 0:t.distanceToMainLine)!==void 0&&(ui(`${i}.distanceToMainLine`,`${i}.distanceToBaseline.value`),e&&((!e.distanceToBaseline||typeof e.distanceToBaseline!="object")&&(e.distanceToBaseline={}),pr(e.distanceToBaseline,"value")||(e.distanceToBaseline.value=t.distanceToMainLine),delete e.distanceToMainLine))}function xn(t){if(typeof t!="string")return t;const e=t.replace(/(^article\.|\.article\.)distanceToMainLine$/,"$1distanceToBaseline.value").replace(/^chart\.gridLine(?=\.|$)/,"chart.defaultStyle.gridLine");return e!==t&&ui(t,e),e}function fi(t){var i;if(!t)return t;const e=L({},t);return((i=t.article)==null?void 0:i.distanceToMainLine)!==void 0&&(e.article||(e.article={}),Nn(t.article,e.article,"lane.article")),e}function zn(t){var n,o,s,r,a,l;if(!t)return t;wr(t);const e=L({},t);if(((n=t.chart)==null?void 0:n.gridLine)!==void 0&&(ui("chart.gridLine","chart.defaultStyle.gridLine"),e.chart.defaultStyle||(e.chart.defaultStyle={}),e.chart.defaultStyle.gridLine=L({},t.chart.gridLine,((o=t.chart.defaultStyle)==null?void 0:o.gridLine)||{}),delete e.chart.gridLine),((s=t.article)==null?void 0:s.distanceToMainLine)!==void 0&&(e.article||(e.article={}),Nn(t.article,e.article,"article")),Array.isArray((r=t.lane)==null?void 0:r.data)){e.lane||(e.lane={}),e.lane.data=e.lane.data||[];for(let c=0;c<t.lane.data.length;c++)e.lane.data[c]=fi(t.lane.data[c])}if(((l=(a=t.article)==null?void 0:a.periodLine)==null?void 0:l.defaultHide)!==void 0&&(T.warn("DEPRECATION WARNING: article.periodLine.defaultHide is deprecated. Use article.defaultData.hidePeriodLine instead."),e.article||(e.article={}),e.article.defaultData||(e.article.defaultData={}),e.article.defaultData.hidePeriodLine=t.article.periodLine.defaultHide),["defaultStyle","defaultHoverStyle","defaultActiveStyle"].forEach(c=>{var h,u;((u=(h=t.article)==null?void 0:h[c])==null?void 0:u.maxImageHeight)!==void 0&&(T.warn(`DEPRECATION WARNING: article.${c}.maxImageHeight is deprecated. Use article.${c}.image.maxHeight instead.`),e.article||(e.article={}),e.article[c]||(e.article[c]={}),e.article[c].image||(e.article[c].image={}),e.article[c].image.maxHeight=t.article[c].maxImageHeight)}),t.onSave!==void 0&&(T.warn('DEPRECATION WARNING: onSave is deprecated. Use options.on["timeline-state-change"] instead.'),e.on||(e.on={}),!e.on["timeline-state-change"])){const c=t.onSave;typeof c=="function"&&(e.on["timeline-state-change"]=function(h){c.call(this,h)})}if(t.onArticleClick!==void 0&&(T.warn('DEPRECATION WARNING: onArticleClick is deprecated. Use options.on["article-click"] for click events, or options.on["article-select"] for selection by any means.'),e.on||(e.on={}),!e.on["article-click"])){const c=t.onArticleClick;typeof c=="function"&&(e.on["article-click"]=function(h,u){c.call(this,h)})}if(t.onArticleDoubleClick!==void 0&&(T.warn('DEPRECATION WARNING: onArticleDoubleClick is deprecated. Use options.on["article-dblclick"] instead.'),e.on||(e.on={}),!e.on["article-dblclick"])){const c=t.onArticleDoubleClick;typeof c=="function"&&(e.on["article-dblclick"]=function(h,u){c.call(this,h)})}if(t.onRedraw!==void 0){if(T.warn('DEPRECATION WARNING: onRedraw is deprecated. Use options.on["timeline-render-end"] instead.'),e.on||(e.on={}),!e.on["timeline-render-end"]){const c=t.onRedraw;typeof c=="function"&&(e.on["timeline-render-end"]=function(h){c.call(this,h)})}delete e.onRedraw}return e}const mi=L({},En);function et(t,e){this.id=e,this.owner=t,this.isDataLoaded=!1,this.isImplicit=!1,this.order=0,this.title="",this.className="",this.headerClassName="",this.bodyClassName="",this.titleClassName="",this.layout={},this.style={},this.articleOptions={},this.resolvedArticleOptions={},this._runtimeArticleOptions={},this.geometry=null,this.currentVisibility="visible"}et.prototype.setupByReceivedData=function(t,{implicit:e=!1}={}){this.data=fi(t),this.isImplicit=!!e,this._resolveFromData(),this.isDataLoaded=!0},et.prototype._resolveFromData=function(){var i,n;const t=this.owner&&this.owner.options?this.owner.options.lane||{}:{},e=this.data||{};this.title=_(e,"title")||"",this.className=_(e,"className")||"",this.headerClassName=_(e,"headerClassName")||"",this.bodyClassName=_(e,"bodyClassName")||"",this.titleClassName=_(e,"titleClassName")||"",this.layout=L({},t.defaultLayout||{},e.layout||{}),this.style=L({},t.defaultStyle||{},e.style||{}),this.articleOptions=L({},e.article||{}),this.resolvedArticleOptions=Rn(((n=(i=this.owner)==null?void 0:i.options)==null?void 0:n.article)||{},this.articleOptions)},et.prototype._applyOption=function(t,{suppressRedraw:e=!1,markExplicit:i=!1,suppressArticleRefresh:n=!1}={}){if(!t||typeof t!="object")return;t=fi(t);const o=this.id,s=A(t,"id")?t.id:o;if(s!==o){const a=this.owner.getLaneById(s);if(a&&a!==this)throw new Error(`Lane "${s}" already exists`)}L(this.data,t),i&&(this.isImplicit=!1),s!==o&&(this.id=s);const r=kn(_(t,"article"));return this._resolveFromData(),s!==o&&this.owner._handleLaneIdChange(this,o),r.styleChanged&&!n&&this.owner._refreshArticlesForLane(this,{refreshStyles:!0}),this.owner._handleLaneChange({requestRedraw:!e}),{articleImpact:r,idChanged:s!==o,laneId:this.id}},et.prototype.setOption=function(t,e){if(typeof t=="string"){const i=xn(t);if(typeof e=="undefined")return _(this.data,i);t=bt(i,e)}this._applyOption(t)},et.prototype.hide=function(){this.setOption("visibility","hidden")},et.prototype.show=function(){this.setOption("visibility","visible")},et.prototype.moveToIndex=function(t){return this.owner.moveLaneToIndex(this,t)},et.prototype.moveBefore=function(t){return this.owner.moveLaneBefore(this,t)},et.prototype.moveAfter=function(t){return this.owner.moveLaneAfter(this,t)},et.prototype.moveUp=function(){return this.owner.moveLaneUp(this)},et.prototype.moveDown=function(){return this.owner.moveLaneDown(this)},et.prototype.setStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return _(this.style,t);t=bt(t,e)}this.data.style=L(this.data.style||{},t),this._resolveFromData(),this.owner._handleLaneChange({requestRedraw:!0,refreshOrder:!1})},Object.defineProperty(et.prototype,"visibility",{get(){const t=this&&this.data?this.data.visibility:void 0;if(typeof t=="undefined")return"visible";const e=ie(t,this,this);return e==="visible"||e==="hidden"?e:(T.warn("Invalid Lane.visibility value; expected 'visible'|'hidden'. Defaulting to 'visible'",{laneId:this&&this.id,value:e}),"visible")},set(t){this.data||(this.data={}),this.data.visibility=t},enumerable:!0,configurable:!1});function Dt(t,e){this.id=e,this.owner=t,this.isDataLoaded=!1,this.title="",this.style={},this.period={from:null,to:null,isToPresent:!1}}Dt.prototype.setupByReceivedData=function(t){this.data=W({},t),this.title=_(t,"title")||"",this.style=_(t,"style")||{},this._setupPeriod(t),this.isDataLoaded=!0},Dt.prototype._setupPeriod=function(t){let e=Te(t,"from");e=this.owner.getDmyFromInput(e);const i=e.precision,n=_(t,"isToPresent"),o=n===!0||n===1;let s,r;o?s=y.now():A(t,"to")?(s=Te(t,"to"),s=this.owner.getDmyFromInput(s),r=s.precision):(s=e,r=i);const a=y.CreateAsStartOfPeriod(e,i),l=y.CreateAsExclusiveEndOfPeriod(s,r);this.period={from:a,to:l,isToPresent:o}},Dt.prototype.overlapsInclusiveWithDates=function(t,e){return!(this.period.from.isAfter(e)||t.isAfter(this.period.to))},Dt.prototype.setOption=function(t,e){let i=!1;if(typeof t=="string"){if(typeof e=="undefined")return _(this.data,t);t=bt(t,e)}if(L(this.data,t),A(t,"id")&&(this.id=t.id),A(t,"title")&&(this.title=t.title),(A(t,"from")||A(t,"to")||A(t,"isToPresent"))&&(this._setupPeriod(this.data),i=!0),A(t,"style")){const n=this.owner.options.timeBand&&this.owner.options.timeBand.defaultStyle||{};this.style=L({},n,this.data.style||{})}i?this.owner.requestRedraw():this.owner.requestRedraw(this.owner.redraw)},Dt.prototype.setStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return _(this.style,t);t=bt(t,e)}this.data.style=L(this.data.style||{},t);const i=this.owner.options.timeBand&&this.owner.options.timeBand.defaultStyle||{};this.style=L({},i,this.data.style||{}),this.owner.requestRedraw()},Object.defineProperty(Dt.prototype,"visibility",{get(){const t=this&&this.data?this.data.visibility:void 0;if(typeof t=="undefined")return"visible";const e=ie(t,this,this);return e==="visible"||e==="hidden"?e:(T.warn("Invalid TimeBand.visibility value; expected 'visible'|'hidden'. Defaulting to 'visible'",{bandId:this&&this.id,value:e}),"visible")},set(t){this.data||(this.data={}),this.data.visibility=t},enumerable:!0,configurable:!1});function br(t,e,i){if(i>=t.length){let n=i-t.length;for(;n--+1;)t.push(void 0)}return t.splice(i,0,t.splice(e,1)[0]),t}function vr(t,e){if(t.length===0)return-1;let i=0,n=t[0][e];for(let o=1;o<t.length;o++)t[o][e]<n&&(n=t[o][e],i=o);return i}function gi(t){return t==="screen"||t===1}class Sr{constructor(e){this.invalidateCb=e,this.seen=new Set,this.loading=new Set,this.loaded=new Set,typeof document!="undefined"&&document.fonts&&document.fonts.addEventListener&&document.fonts.addEventListener("loadingdone",i=>{for(const n of i.fontfaces)this._notifyFamily(n.family)})}use(e){!e||this.loading.has(e)||this.loaded.has(e)||(this.seen.add(e),typeof document!="undefined"&&document.fonts&&document.fonts.load&&(this.loading.add(e),document.fonts.load(e).then(()=>{this.loading.delete(e),this.loaded.add(e),this.invalidateCb(e)}).catch(i=>{T.warn("[FontWatcher] Font load failed:",e,i),this.loading.delete(e)})))}_notifyFamily(e){for(const i of this.seen)i.includes(e)&&(this.loading.delete(i),this.loaded.add(i),this.invalidateCb(i))}}const Lr=64*1024*1024,_r=new Set(["square","circle"]),Ar=new Set(["auto","prefer-bitmap","bitmap","prefer-img","img"]);function Wt(t){return typeof t=="number"&&Number.isFinite(t)&&t>0}function ht(t){return Math.max(1,Math.floor(t||0))}class Ir{constructor(e={}){const{maxConcurrent:i=6,maxCacheBytes:n,requireCORS:o=!1,decodeMode:s="auto"}=e;this.maxConcurrent=Math.max(1,i|0),this.requireCORS=!!o;let r;typeof n=="number"?r=Number.isFinite(n)?Math.max(0,n):1/0:r=Lr,this.maxCacheBytes=r;let a=typeof s=="string"?s.toLowerCase():"auto";Ar.has(a)||(a="auto"),this.decodeMode=a,this.queue=[],this.active=0,this.cache=new Map,this.totalBytes=0,this.inflight=new Map}enqueue(e,i,n,o={}){if(!e||!i||typeof n!="function")return()=>{};const s=typeof o.shape=="string"?o.shape.toLowerCase():"natural",r={key:e,url:i,onReady:n,options:{targetW:Wt(o.targetW)?o.targetW:null,targetH:Wt(o.targetH)?o.targetH:null,shape:s,article:o.article||null},cancelled:!1,delivered:!1},a=this.cache.get(e);if(a){const c=this._acquire(a,r.options.article);r.delivered=!0;try{n(a.image,a.tainted,a.kind,a.close,c)}catch(h){throw c({keepState:!0,skipRedraw:!0}),h}return()=>{}}const l=this.inflight.get(e);return l?l.requests.push(r):r.options.article&&r.options.article.isInView?this.queue.unshift(r):this.queue.push(r),this._pump(),()=>this._cancel(r)}_cancel(e){var n;if(!e||e.cancelled||e.delivered)return;e.cancelled=!0;const i=this.inflight.get(e.key);if(i){const o=i.requests.indexOf(e);if(o!==-1&&i.requests.splice(o,1),i.requests.length===0)try{(n=i.controller)==null||n.abort()}catch(s){}}else{const o=this.queue.indexOf(e);o!==-1&&this.queue.splice(o,1)}}_pump(){if(!(this.active>=this.maxConcurrent))for(;this.active<this.maxConcurrent&&this.queue.length;){const e=this.queue.shift();if(!e||e.cancelled)continue;const i=e.options&&e.options.article;if(i&&i.isInRange===!1){e.cancelled=!0;try{i._pendingImageKey===e.key&&(i._pendingImageKey=null,typeof i._imageCancel=="function"&&(i._imageCancel=null))}catch(o){}continue}if(this.cache.has(e.key)){this._serveFromCache(e);continue}const n=this.inflight.get(e.key);if(n){n.requests.push(e);continue}this._startLoad(e)}}_serveFromCache(e){const i=this.cache.get(e.key);if(!i||e.cancelled)return;const n=this._acquire(i,e.options.article);e.delivered=!0;try{e.onReady(i.image,i.tainted,i.kind,i.close,n)}catch(o){throw n({keepState:!0,skipRedraw:!0}),o}}_startLoad(e){const i=typeof AbortController!="undefined"?new AbortController:null,n={requests:[e],controller:i};this.inflight.set(e.key,n),this.active++;const o=i?i.signal:void 0,s=this._loadResource(e,o);n.promise=s,s.then(r=>{if(!r)return;const a=this.cache.get(e.key);a&&this._evictEntry(e.key,a),r.key=e.key,r.refs=0,r.articles=new Set,r.lastUsed=this._now(),this.cache.set(e.key,r),this.totalBytes+=r.bytes||0;const l=n.requests.slice();for(const c of l){if(!c||c.cancelled)continue;const h=this._acquire(r,c.options.article);c.delivered=!0;try{c.onReady(r.image,r.tainted,r.kind,r.close,h)}catch(u){throw h({keepState:!0,skipRedraw:!0}),u}}this._trimCache()}).catch(()=>{}).finally(()=>{this.inflight.delete(e.key),this.active=Math.max(0,this.active-1),this._pump()})}_acquire(e,i){e.refs=(e.refs||0)+1,e.lastUsed=this._now(),i&&e.articles.add(i);let n=!1;const o=(s={})=>{n||(n=!0,this._releaseInternal(e.key,i,s))};return o._key=e.key,i&&(o._article=i),o}_releaseInternal(e,i,n={}){const o=this.cache.get(e);o&&(o.refs>0&&(o.refs-=1),o.lastUsed=this._now(),i&&o.articles instanceof Set&&o.articles.delete(i),this._dropArticleState(i,e,n),this._trimCache())}_dropArticleState(e,i,n){if(!e||!i)return;const o=!!n.keepState,s=!!n.skipRedraw;if(!o&&e._loadedImageKey===i){if(e.imageLoaded=!1,e.image=null,e._loadedImageKey=null,typeof e._cacheBucket=="function")try{const a=e._cacheBucket(),l=`imageRaster:${i}`;a&&Object.prototype.hasOwnProperty.call(a,l)&&delete a[l]}catch(a){}if(typeof e.updateCachedSize=="function")try{e.updateCachedSize()}catch(a){}const r=e.owner;if(!s&&r&&typeof r.requestRedraw=="function")try{r.requestRedraw()}catch(a){}}e._closeImage&&e._closeImage._key===i&&(e._closeImage=null)}_trimCache(){if(!Number.isFinite(this.maxCacheBytes)||this.totalBytes<=this.maxCacheBytes)return;const e=[];for(const[i,n]of this.cache.entries())n&&e.push({key:i,entry:n});e.sort((i,n)=>{const o=typeof i.entry.lastUsed=="number"?i.entry.lastUsed:0,s=typeof n.entry.lastUsed=="number"?n.entry.lastUsed:0;return o-s});for(const{key:i,entry:n}of e){if(this.totalBytes<=this.maxCacheBytes)break;n.refs>0||this._evictEntry(i,n)}}_evictEntry(e,i){if(this.cache.has(e)&&(this.cache.delete(e),this.totalBytes=Math.max(0,this.totalBytes-(i.bytes||0)),i&&typeof i.close=="function"))try{i.close()}catch(n){}}async _loadResource(e,i){if(!e||e.cancelled)return null;const n=this.decodeMode,o=typeof createImageBitmap=="function",s=async a=>{if(!o){if(a)throw new Error("ImageBitmap not supported");return null}try{return await this._loadViaFetch(e,i)}catch(l){if(a)throw l}try{return await this._loadViaImageElement(e,!0)}catch(l){if(a)throw l;return null}},r=async a=>{try{return await this._loadViaImageElement(e,!1)}catch(l){if(!a)throw l;return await s(!1)}};switch(n){case"bitmap":return await s(!0);case"prefer-bitmap":case"auto":{const a=await s(!1);return a||await r(!1)}case"prefer-img":{const a=await r(!0);return a||await s(!1)}case"img":return await r(!1);default:{const a=await s(!1);return a||await r(!1)}}}async _loadViaFetch(e,i){const n={signal:i,mode:"cors",credentials:this.requireCORS?"same-origin":"omit"},o=await fetch(e.url,n);if(!o.ok)throw new Error("image fetch failed");const s=await o.blob(),r=await createImageBitmap(s),a=this._computeTransform(e.options,r.width,r.height);let l=r;if(a.needsCrop||a.needsResize){const c=a.sw,h=a.sh,u={};a.resizeWidth&&(u.resizeWidth=a.resizeWidth),a.resizeHeight&&(u.resizeHeight=a.resizeHeight),l=await createImageBitmap(r,a.sx,a.sy,c,h,u);try{r.close()}catch(m){}}return this._buildEntryFromBitmap(l,!1)}async _loadViaImageElement(e,i){const n=await this._createImageElement(e.url),o=ht(n.naturalWidth||n.width||0),s=ht(n.naturalHeight||n.height||0),r=e.options.shape||"natural",a=this._computeTransform(e.options,o,s);if(!i&&r==="natural"&&(a.needsResize=!1,a.resizeWidth=null,a.resizeHeight=null),i&&typeof createImageBitmap=="function"){const l={};a.resizeWidth&&(l.resizeWidth=a.resizeWidth),a.resizeHeight&&(l.resizeHeight=a.resizeHeight);const c=await createImageBitmap(n,a.sx,a.sy,a.sw,a.sh,l);return this._buildEntryFromBitmap(c,!this.requireCORS)}if(a.needsCrop||a.needsResize){const l=this._drawToCanvas(n,a);return this._buildEntryFromCanvas(l,!this.requireCORS)}return{image:n,kind:"img",tainted:!this.requireCORS,close:()=>{},bytes:this._estimateBytes(o,s)}}_drawToCanvas(e,i){let n=i.resizeWidth!=null?i.resizeWidth:i.sw,o=i.resizeHeight!=null?i.resizeHeight:i.sh;if(i.resizeWidth!=null&&i.resizeHeight==null&&i.sw>0){const a=i.resizeWidth/i.sw;o=Math.max(1,Math.round(i.sh*a))}else if(i.resizeHeight!=null&&i.resizeWidth==null&&i.sh>0){const a=i.resizeHeight/i.sh;n=Math.max(1,Math.round(i.sw*a))}n=Math.max(1,Math.round(n)),o=Math.max(1,Math.round(o));const s=this._createCanvas(n,o),r=s.getContext&&s.getContext("2d");return r&&r.drawImage(e,i.sx,i.sy,i.sw,i.sh,0,0,n,o),s}_createCanvas(e,i){const n=ht(e),o=ht(i);if(typeof document!="undefined"&&typeof document.createElement=="function"){const s=document.createElement("canvas");return s.width=n,s.height=o,s}return typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(n,o):{width:n,height:o,getContext:()=>null}}_buildEntryFromBitmap(e,i){return{image:e,kind:"bitmap",tainted:i,close:()=>{try{e.close()}catch(o){}},bytes:this._estimateBytes(e.width,e.height)}}_buildEntryFromCanvas(e,i){return{image:e,kind:"canvas",tainted:i,close:()=>{if(typeof e.close=="function")try{e.close()}catch(o){}},bytes:this._estimateBytes(e.width,e.height)}}_computeTransform(e,i,n){const o={sx:0,sy:0,sw:ht(i),sh:ht(n),resizeWidth:null,resizeHeight:null,needsCrop:!1,needsResize:!1},s=e.shape||"natural";if(_r.has(s)){o.sw!==o.sh&&(o.sw>o.sh?(o.sx=Math.floor((o.sw-o.sh)/2),o.sw=o.sh):(o.sy=Math.floor((o.sh-o.sw)/2),o.sh=o.sw),o.needsCrop=!0);const r=e.targetW||e.targetH;if(Wt(r)){const a=ht(r);o.resizeWidth=a,o.resizeHeight=a,o.needsResize=!0}}else{const r=e.targetW,a=e.targetH,l=o.sw,c=o.sh,h=u=>{if(!Number.isFinite(u)||u<=0)return;const m=ht(l*u),d=ht(c*u);m===l&&d===c||(o.resizeWidth=m,o.resizeHeight=d,o.needsResize=!0)};if(Wt(r)&&Wt(a)){const u=Math.min(r/l,a/c);h(u)}else Wt(r)?h(r/l):Wt(a)&&h(a/c)}return o.resizeWidth!=null&&o.resizeHeight==null?o.resizeHeight=ht(o.sh):o.resizeHeight!=null&&o.resizeWidth==null&&(o.resizeWidth=ht(o.sw)),o}_estimateBytes(e,i){return ht(e)*ht(i)*4}_now(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}_createImageElement(e){return new Promise((i,n)=>{const o=new Image;this.requireCORS&&(o.crossOrigin="anonymous"),o.decoding="async",o.fetchPriority="low",o.onload=()=>i(o),o.onerror=()=>n(new Error("image load error")),o.src=e,typeof o.decode=="function"&&o.decode().then(()=>i(o)).catch(()=>{})})}}const Oe={[lt]:1,[G]:Ft,[K]:Bt,[j]:Ht},Mr={[j]:[12,6,3,1],[K]:[30,10,5,1],[G]:[30,10,5,1],[lt]:[500,100,50,10,5,1]},Fn=[{majorUnit:O,majorMilliseconds:U,minorUnit:j},{majorUnit:j,majorMilliseconds:Ht,minorUnit:K},{majorUnit:K,majorMilliseconds:Bt,minorUnit:G},{majorUnit:G,majorMilliseconds:Ft,minorUnit:lt}],Cr=Rt;function Ee(t){return t<O?Oe[t]/U:t===O?1:null}function Dr(t,e,i){return e===O?t.format("D MMM YYYY",i):e===G?t.format("HH:mm:ss"):t.format("HH:mm")}function pe(t,e){return e===j||e===K?t.format("HH:mm"):e===G?`:${t.format("ss")}`:`.${t.format("SSS")}`}function Tr(t,e){const i=t%100;let n;if(i>=11&&i<=13)n="th";else switch(t%10){case 1:n="st";break;case 2:n="nd";break;case 3:n="rd";break;default:n="th"}return`${new y(t,1,1).format("YYYY",{thousandsSeparator:e,bceText:""})}${n}`}function Pr(t,e){switch(e){case G:return new y(t.year,t.month,t.day,t.hour,t.minute,t.second);case K:return new y(t.year,t.month,t.day,t.hour,t.minute);case j:return new y(t.year,t.month,t.day,t.hour);case O:return new y(t.year,t.month,t.day);case $:return new y(t.year,t.month,1);case rt:return new y(t.year,1,1);case de:return y.CreateAsStartOfPeriod(t,"decade");case Rt:return y.CreateAsStartOfPeriod(t,"century");case fe:return y.CreateAsStartOfPeriod(t,"millennium");default:return null}}function kr(t,e){switch(e){case G:return t.addSeconds(1);case K:return t.addMinutes(1);case j:return t.addHours(1);case O:return t.getNextDay();case $:return t.getNextMonth();case rt:return t.addYears(1);case de:return y.CreateAsExclusiveEndOfPeriod(t,"decade");case Rt:return y.CreateAsExclusiveEndOfPeriod(t,"century");case fe:return y.CreateAsExclusiveEndOfPeriod(t,"millennium");default:return null}}class D{constructor(e,i){this.owner=e,this.zoomOptions=i,this.zoom=0,this.startToken=null,this.unit=O,this.unitSizeInPixels=100,this.adaptiveMinorUnit=null,this.adaptiveMinorInterval=null,this.adaptiveMinorMarkerSpacingInPixels=null,this.unitLengthInYears=1,this.zoomChangedHandlers=[],this.yearPrefix={minor:!1,major:!1},this.unitLevels=[],this.unitOrder=[]}}D.prototype.getUnitSizeInPixelsForZoom=function(t){var s;const e=this.zoomOptions.ratio,i=this.unitLevels[this.unit],n=(s=i.referenceZoom)!=null?s:i.zoomStart;return i.startUnitSize*Math.pow(e,t-n)},D.prototype.getChangePoint=function(t){return this.unitLevels[this.unit].zoomStart},D.prototype.getUnitFromZoom=function(t){for(let e=this.unitOrder.length-1;e>=0;e--){const i=this.unitOrder[e];if(t>=this.unitLevels[i].zoomStart)return i}throw new Error(`Zoom ${t} is out of range`)},D.prototype.getAdaptiveMinorInterval=function(t=this.unit,e=this.unitSizeInPixels){var r;const i=Mr[t];if(!i)return 1;const n=this.zoomOptions.unitSize.minimum,o=(r=this.zoomOptions.unitSize.showMinorLabels)!=null?r:n,s=Math.max(n,o);for(let a=i.length-1;a>=0;a--)if(e*i[a]>=s)return i[a];return null},D.prototype.getSubdayVisualMarkerLayout=function(){var r;if(this.zoomOptions.minimum>=O||this.zoom>O||this.unit>O)return null;const t=this.unit===O?U:Oe[this.unit],e=this.unitSizeInPixels/t,i=(r=this.zoomOptions.unitSize.minimumMajor)!=null?r:120;let n=null;for(let a=Fn.length-1;a>=0;a--){const l=Fn[a];if(l.majorMilliseconds*e>=i){n=l;break}}if(!n)return null;const o=Oe[n.minorUnit]*e,s=this.getAdaptiveMinorInterval(n.minorUnit,o);return zt(W({},n),{majorMarkerSpacingInPixels:n.majorMilliseconds*e,minorInterval:s,minorMarkerSpacingInPixels:s?o*s:null,minorMilliseconds:s?Oe[n.minorUnit]*s:null,pixelsPerMillisecond:e})},D.prototype.getParentContextScale=function(){const t=this.getSubdayVisualMarkerLayout(),e=t?t.majorUnit:this.unit+1;return e<lt||e>Cr?null:{level:this.zoomUnitToString(e),levelUnit:e,parentUnit:e<=j?O:e+1}},D.prototype.isParentContextTextVisible=function(t){if((t==null?void 0:t.visible)!==!0)return!1;const e=this.getParentContextScale();return e?t.levels==="all"?!0:Array.isArray(t.levels)&&t.levels.includes(e.level):!1},D.prototype.formatParentContextLabel=function(t,e){const i=this.getDateLabelFormatOptions(F);switch(e){case G:case K:case j:case O:return t.format("D MMM YYYY",i);case $:return t.format("MMM YYYY",i);case rt:return t.format("YYYY",i);case de:{const n=t.year<=0?1-t.year:t.year,o=Math.floor(n/10)*10;return o===0?t.year<=0?`9–1${i.bceText}`:"1–9":`${new y(o,1,1).format("YYYY",{thousandsSeparator:i.thousandsSeparator,bceText:""})}s${t.year<=0?i.bceText:""}`}case Rt:case fe:{const n=t.year<=0?1-t.year:t.year,s=Math.ceil(n/(e===Rt?100:1e3)),r=e===Rt?"century":"millennium";return`${Tr(s,i.thousandsSeparator)} ${r}${t.year<=0?i.bceText:""}`}default:return""}},D.prototype.createParentContextTokens=function(t,e,i){const n=this.getParentContextScale();if(!n||!t||!this.startToken)return[];const o=[];let s=Pr(t,n.parentUnit),r=i+this.getPixelsBetween(this.startToken.value,s);do{const a=kr(s,n.parentUnit);if(!a)break;const l=i+this.getPixelsBetween(this.startToken.value,a);o.push({drawX:r,label:this.formatParentContextLabel(s,n.parentUnit),length:l-r,unit:n.parentUnit,value:s}),s=a,r=l}while(o.length<1e3&&o[o.length-1].drawX<=e);return o},D.prototype.setAdaptiveMinorInterval=function(){const t=this.getSubdayVisualMarkerLayout();if(!t){this.adaptiveMinorUnit=null,this.adaptiveMinorInterval=null,this.adaptiveMinorMarkerSpacingInPixels=null;return}this.adaptiveMinorUnit=t.minorUnit,this.adaptiveMinorInterval=t.minorInterval,this.adaptiveMinorMarkerSpacingInPixels=t.minorMarkerSpacingInPixels},D.prototype.createSubdayVisualMarkers=function(t,e,i=this.getSubdayVisualMarkerLayout()){const n={[F]:[],[k]:[]};if(!i||!this.startToken)return n;const o=150,s=i.minorMilliseconds||i.majorMilliseconds,r=Math.floor((-o-e)/i.pixelsPerMillisecond),a=this.startToken.value.addMilliseconds(r),l=new y(a.year,a.month,a.day),c=Math.floor(a.getMillisecondsOfDay()/s)*s;let h=l.addMilliseconds(c);const u=i.minorMarkerSpacingInPixels>=this.zoomOptions.unitSize.showMinorLabels,m=p=>({drawX:e+this.getPixelsBetween(this.startToken.value,p),label:Dr(p,i.majorUnit,this.getDateLabelFormatOptions(F)),length:i.majorMarkerSpacingInPixels,markerSpacingInPixels:i.majorMarkerSpacingInPixels,type:F,unit:i.majorUnit,value:p,visual:!0}),d=Math.floor(a.getMillisecondsOfDay()/i.majorMilliseconds)*i.majorMilliseconds,g=l.addMilliseconds(d);for(g.isAfter(h)===!1&&!g.isSame(h)&&n[F].push(m(g));;){const p=e+this.getPixelsBetween(this.startToken.value,h);if(p>t+o)break;h.getMillisecondsOfDay()%i.majorMilliseconds===0?n[F].push(m(h)):i.minorMilliseconds&&n[k].push({adaptive:i.minorInterval!==1,drawX:p,label:u?pe(h,i.minorUnit):void 0,length:i.minorMarkerSpacingInPixels,markerSpacingInPixels:i.minorMarkerSpacingInPixels,type:k,unit:i.minorUnit,value:h,visual:!0}),h=h.addMilliseconds(s)}return n},D.prototype.createHourToken=function(t){const e={unit:j,value:t,length:this.unitSizeInPixels},i=this.unitLevels[j];return t.hour===0?(e.label=t.format("D MMM YYYY",this.getDateLabelFormatOptions(F)),e.type=F):(e.type=k,this.zoom<i.zoomHideMinorLabels&&(e.label=pe(t,j))),e},D.prototype.createMinuteToken=function(t){const e={unit:K,value:t,length:this.unitSizeInPixels},i=this.unitLevels[K];return t.minute===0?(e.label=t.format("HH:mm"),e.type=F):(e.type=k,this.zoom<i.zoomHideMinorLabels&&(e.label=pe(t,K))),e},D.prototype.createSecondToken=function(t){const e={unit:G,value:t,length:this.unitSizeInPixels},i=this.unitLevels[G];return t.second===0?(e.label=t.format("HH:mm:ss"),e.type=F):(e.type=k,this.zoom<i.zoomHideMinorLabels&&(e.label=pe(t,G))),e},D.prototype.createMillisecondToken=function(t){const e={unit:lt,value:t,length:this.unitSizeInPixels},i=this.unitLevels[lt];return t.millisecond===0?(e.label=t.format("HH:mm:ss.SSS"),e.type=F):(e.type=k,this.zoom<i.zoomHideMinorLabels&&(e.label=pe(t,lt))),e},D.prototype.getDateLabelFormatOptions=function(t){t=t===F?"major":"minor";const e=this.owner.options.style.dateLabel[t];return{thousandsSeparator:e.thousandsSeparator,bceText:e.bceText,yearPrefix:this.yearPrefix[t]}},D.prototype.createYearToken=function(t){const e={unit:this.unit,value:t,length:this.unitSizeInPixels};let i=t.year;const n=i===0;i<=0&&(i=-i+1);const o=this.unitLengthInYears,s=this.unitLevels[this.unit];return i%(o*10)===0||n?(e.label=t.format("YYYY",this.getDateLabelFormatOptions(F)),e.type=F):(e.type=k,this.zoom<s.zoomHideMinorLabels&&(e.label=t.format("YYYY",this.getDateLabelFormatOptions(k)))),e},D.prototype.createMonthToken=function(t){const e={unit:this.unit,value:t,length:this.unitSizeInPixels},i=this.unitLevels[$];return t.month===1?(e.label=t.format("YYYY",this.getDateLabelFormatOptions(F)),e.type=F):(e.type=k,this.zoom<i.zoomHideMinorLabels&&(e.label=t.format("MMM"))),e},D.prototype.createDayToken=function(t){const e={unit:this.unit,value:t,length:this.unitSizeInPixels},i=this.unitLevels[O];return t.day===1?(e.label=t.format("MMM YYYY",this.getDateLabelFormatOptions(F)),e.type=F):(e.type=k,this.zoom<i.zoomHideMinorLabels&&(e.label=t.format("D"))),e},D.prototype.addZoomChangedHandler=function(t,e){this.zoomChangedHandlers.push({callback:t,context:e||this})},D.prototype.notifyZoomChanged=function(){for(let t=0;t<this.zoomChangedHandlers.length;t++)this.zoomChangedHandlers[t].callback.call(this.zoomChangedHandlers[t].context)},D.prototype.setZoom=function(t){var o,s;const e=this.zoom;let i=parseFloat(t.toFixed(4));i<this.zoomOptions.minimum&&(i=this.zoomOptions.minimum),i>this.zoomOptions.maximum&&(i=this.zoomOptions.maximum),this.zoom=i,this.unit=this.getUnitFromZoom(this.zoom),this.unitSizeInPixels=this.getUnitSizeInPixelsForZoom(this.zoom),this.setAdaptiveMinorInterval();let n=0;if(this.unit>=rt){const r=this.unit-rt;n=Math.pow(10,r)}if(this.unitLengthInYears=n,this.setCurrentYearPrefixes(),this.owner._isInitialized){const r=this.zoom-e;this.owner.trigger("zoom",{zoom:this.zoom,zoomDelta:r})}return(s=(o=this.owner)._markTimelineStateChanged)==null||s.call(o),this.notifyZoomChanged(),this.zoom},D.prototype.getPixelsBetween=function(t,e){const i=this.unit;return i<=O?t.getDaysTo(e)*this.unitSizeInPixels/Ee(i):i===$?t.getMonthsTo(e)*this.unitSizeInPixels:t.getYearsTo(e)*this.unitSizeInPixels/this.unitLengthInYears},D.prototype.setStartToken=function(t){return this.startToken=t},D.prototype.setStartDate=function(t){let e=0;switch(t.year<0&&(e=1),this.unit){case lt:return this.startToken=this.createMillisecondToken(new y(t)),0;case G:{const i=new y(t.year,t.month,t.day,t.hour,t.minute,t.second);return this.startToken=this.createSecondToken(i),-this.getPixelsBetween(i,t)}case K:{const i=new y(t.year,t.month,t.day,t.hour,t.minute);return this.startToken=this.createMinuteToken(i),-this.getPixelsBetween(i,t)}case j:{const i=new y(t.year,t.month,t.day,t.hour);return this.startToken=this.createHourToken(i),-this.getPixelsBetween(i,t)}case O:return this.startToken=this.createDayToken(new y(t.year,t.month,t.day)),-this.getPixelsBetween(this.startToken.value,t);case $:return this.startToken=this.createMonthToken(new y(t.year,t.month,1)),this.unitSizeInPixels/30.44*(this.startToken.value.day-t.day);case rt:return this.startToken=this.createYearToken(new y(t.year,1,1)),this.unitSizeInPixels/365.2422*((this.startToken.value.month-t.month)*30.44+(this.startToken.value.day-t.day));default:{const i=this.unitLengthInYears;return this.startToken=this.createYearToken(new y(Math.floor(t.year/i)*i+e,1,1)),this.unitSizeInPixels/(365.2422*i)*((this.startToken.value.year-t.year)*365.2422+(this.startToken.value.month-t.month)*30.44+(this.startToken.value.day-t.day))}}},D.prototype.getStartTokenCloned=function(){switch(this.startToken.unit){case lt:return this.createMillisecondToken(this.startToken.value);case G:return this.createSecondToken(this.startToken.value);case K:return this.createMinuteToken(this.startToken.value);case j:return this.createHourToken(this.startToken.value);case O:return this.createDayToken(this.startToken.value);case $:return this.createMonthToken(this.startToken.value);default:return this.createYearToken(this.startToken.value)}},D.prototype.getNext=function(t){switch(t.unit){case lt:return this.createMillisecondToken(t.value.addMilliseconds(1));case G:return this.createSecondToken(t.value.addSeconds(1));case K:return this.createMinuteToken(t.value.addMinutes(1));case j:return this.createHourToken(t.value.addHours(1));case O:return this.createDayToken(t.value.getNextDay());case $:return this.createMonthToken(t.value.getNextMonth());case rt:return this.createYearToken(t.value.addYears(1));default:{const e=this.unitLengthInYears;return this.createYearToken(t.value.addYears(t.value.year===-(e-1)?e-1:e))}}},D.prototype.getPrevious=function(t){switch(t.unit){case lt:return this.createMillisecondToken(t.value.addMilliseconds(-1));case G:return this.createSecondToken(t.value.addSeconds(-1));case K:return this.createMinuteToken(t.value.addMinutes(-1));case j:return this.createHourToken(t.value.addHours(-1));case O:return this.createDayToken(t.value.getPreviousDay());case $:return this.createMonthToken(t.value.getPreviousMonth());case rt:return this.createYearToken(t.value.addYears(-1));default:{const e=this.unitLengthInYears;return this.createYearToken(t.value.addYears(t.value.year===0?1-e:-e))}}},D.prototype.getPreviousNth=function(t,e){for(let i=0;i<e;i++)t=this.getPrevious(t);return t},D.prototype.zoomUnitToString=function(t){switch(t){case lt:return"millisecond";case G:return"second";case K:return"minute";case j:return"hour";case O:return"day";case $:return"month";case rt:return"year";case de:return"decade";case Rt:return"century";case fe:return"millennium";case Fi:return"10 thousand years";case Bi:return"100 thousand years";case Hi:return"million years";case Yi:return"10 million years";case Wi:return"100 million years";case Vi:return"billion years";default:return"unknown"}},D.prototype.setUnitLevels=function(){this.unitLevels=[],this.unitOrder=[];const t=this.zoomOptions.unitSize.minimum,e=this.zoomOptions.unitSize.showMinorLabels,i=0,n=(z,it)=>{this.unitLevels[z]=it,this.unitOrder.push(z)},o=this.getZoomChangeByDistance(e,t),s=this.zoomOptions.unitSize.initial,r=this.getZoomChangeByDistance(s,t),a=i+r,l=a-o;n(O,{startUnitSize:s,zoomStart:i,zoomHideMinorLabels:l,zoomEnd:a});const h=s/24,u=this.getZoomChangeByDistance(h,t*60);n(j,{startUnitSize:t*60,zoomStart:u,zoomEnd:i,zoomHideMinorLabels:u+this.getZoomChangeByDistance(t*60,e)});const m=u+this.getZoomChangeByDistance(t,t*60);n(K,{startUnitSize:t*60,zoomStart:m,zoomEnd:u,zoomHideMinorLabels:m+this.getZoomChangeByDistance(t*60,e)});const d=m+this.getZoomChangeByDistance(t,t*1e3);n(G,{startUnitSize:t*1e3,zoomStart:d,zoomEnd:m,zoomHideMinorLabels:d+this.getZoomChangeByDistance(t*1e3,e)}),n(lt,{startUnitSize:t,referenceZoom:d,zoomStart:Number.NEGATIVE_INFINITY,zoomEnd:d,zoomHideMinorLabels:d+this.getZoomChangeByDistance(t,e)});const g=t*31,p=this.getZoomChangeByDistance(g,t),w=a+p,b=w-o;n($,{startUnitSize:g,zoomStart:a,zoomHideMinorLabels:b,zoomEnd:w});const v=t*12,S=this.getZoomChangeByDistance(v,t),M=w+S,P=M-o;n(rt,{startUnitSize:v,zoomStart:w,zoomHideMinorLabels:P,zoomEnd:M});let E,x,Z=M,R,V;const B=8;for(let z=1;z<=B;z++)E=t*10,x=this.getZoomChangeByDistance(E,t),R=Z+x,V=R-o,n(rt+z,{startUnitSize:E,zoomStart:Z,zoomHideMinorLabels:V,zoomEnd:R}),Z=R,z===B&&(this.zoomOptions.maximum=Math.min(this.zoomOptions.maximum,R));this.unitOrder.sort((z,it)=>z-it)},D.prototype.getZoomChangeByDistance=function(t,e){const i=this.zoomOptions.ratio;return Math.log(e/t)/Math.log(i)},D.prototype.scaleDistanceByZoomChange=function(t,e){const i=this.zoomOptions.ratio;return t*Math.pow(i,e)},D.prototype.setCurrentYearPrefixes=function(){const t=["minor","major"];if(this.unit<rt){for(let n=0;n<t.length;n++)this.yearPrefix[t[n]]=!1;return}const e=this.owner.options.style.dateLabel,i={minor:this.unitLengthInYears,major:this.unitLengthInYears*10};for(let n=0;n<t.length;n++){const o=t[n],s=Object.values(e[o].yearPrefixes);this.yearPrefix[o]=!1,s.sort(function(r,a){return a.minDivision-r.minDivision});for(let r=0;r<s.length;r++){const a=s[r];if(a.minDivision<=i[o]){this.yearPrefix[o]={label:a.label,value:a.value};break}}}};const Bn=["http","https","data","blob"];function Rr(t,e=Bn){if(typeof t!="string")return!1;const i=t.trim(),n=i.toLowerCase();if(n.startsWith("data:"))return e.includes("data");if(n.startsWith("blob:"))return e.includes("blob");try{const o=new URL(i,typeof window!="undefined"?window.location.href:void 0);return e.includes(o.protocol.replace(":",""))}catch(o){return!1}}function Or(t){return/^data:image\//i.test(t)}function Er(t,e){if(!Array.isArray(e)||e.length===0)return!0;try{const i=new URL(t,typeof window!="undefined"?window.location.href:void 0),n=i.origin.toLowerCase(),o=i.hostname.toLowerCase();for(const s of e){if(typeof s!="string")continue;const r=s.trim().toLowerCase();if(r.includes("://")){try{const a=new URL(r).origin.toLowerCase();if(n===a)return!0}catch(a){}continue}if(r.startsWith("*.")&&(o===r.slice(2)||o.endsWith(`.${r.slice(2)}`))||r.startsWith(".")&&(o===r.slice(1)||o.endsWith(r))||o===r||o.endsWith(`.${r}`))return!0}return!1}catch(i){return!0}}function Nr(t,e={}){if(typeof t!="string")return null;const i=Array.isArray(e.allowedSchemes)&&e.allowedSchemes.length?e.allowedSchemes:Bn;if(!Rr(t,i))return null;const n=t.trim().toLowerCase();return n.startsWith("data:")?Or(n)?t:null:Er(t,e.allowedOrigins)?t:null}function xr(){const t=typeof globalThis!="undefined"&&globalThis.devicePixelRatio||1;return typeof t!="number"||!isFinite(t)||t<=0?1:t}function zr(t){const e=t&&t.dprMode==="native",i=xr(),n=e?i:Math.ceil(i),o=t&&typeof t.dpr=="number"&&isFinite(t.dpr)&&t.dpr>0?t.dpr:n,s=t&&typeof t.maxDpr=="number"&&isFinite(t.maxDpr)&&t.maxDpr>0?t.maxDpr:4;return Math.min(s,Math.max(1,o))}function pi(t,e,i,n,o){const s=zr(o),r=Math.max(1,Math.round(e!=null?e:t.clientWidth||t.width||1)),a=Math.max(1,Math.round(i!=null?i:t.clientHeight||t.height||1));t.style&&(t.style.width!==`${r}px`&&(t.style.width=`${r}px`),t.style.height!==`${a}px`&&(t.style.height=`${a}px`));const l=r*s,c=a*s;t.width!==l&&(t.width=l),t.height!==c&&(t.height=c);const h=n||t.getContext&&t.getContext("2d")||null;return h&&typeof h.setTransform=="function"&&h.setTransform(s,0,0,s,0,0),t._dpr=s,s}function Hn(t,e){const i=t.canvas._dpr||1;t.shadowOffsetX=e.x*i,t.shadowOffsetY=e.y*i,t.shadowBlur=e.amount*i,t.shadowColor=e.color}function Fr(t){return t instanceof HTMLCanvasElement||t&&t.nodeName==="CANVAS"}function Br({width:t,height:e,className:i,style:n}={}){const o=document.createElement("canvas");return t!=null&&(o.width=t),e!=null&&(o.height=e),i&&(o.className=i),o.style.touchAction="none",n&&Object.assign(o.style,n),o}function Yn(t,e){return t!=null&&t.append?t.append(e):t.appendChild(e),e}function Hr(t){const e=t.getBoundingClientRect();return{left:e.left,top:e.top}}function Yr(){document.selection?document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges()}const vt=typeof window!="undefined"&&"onpointerdown"in window,Wr=750,Wn=vt?{down:"pointerdown",move:"pointermove",up:"pointerup",cancel:"pointercancel",leave:"pointerleave"}:{down:"mousedown",move:"mousemove",up:"mouseup",cancel:"mouseleave",leave:"mouseleave"};function Ne(t,e,i,n){const o=Wn[e]||e;t.addEventListener(o,i,n),vt||(e==="down"&&t.addEventListener("touchstart",i,n),e==="move"&&t.addEventListener("touchmove",i,n),e==="up"&&(t.addEventListener("touchend",i,n),t.addEventListener("touchcancel",i,n)))}function xe(t,e,i,n){const o=Wn[e]||e;t.removeEventListener(o,i,n),vt||(e==="down"&&t.removeEventListener("touchstart",i,n),e==="move"&&t.removeEventListener("touchmove",i,n),e==="up"&&(t.removeEventListener("touchend",i,n),t.removeEventListener("touchcancel",i,n)))}function ne(t){if(t.touches&&t.touches[0]){const e=t.touches[0];return{x:e.clientX,y:e.clientY}}if(t.changedTouches&&t.changedTouches[0]){const e=t.changedTouches[0];return{x:e.clientX,y:e.clientY}}return{x:t.clientX,y:t.clientY}}class Vr{constructor(e,{onStart:i,onMove:n,onEnd:o}={}){this.target=e,this.onStart=i,this.onMove=n,this.onEnd=o,this.pointers=new Map,this.lastTouchTime=0,this._handleDown=this._handleDown.bind(this),this._handleMove=this._handleMove.bind(this),this._handleUp=this._handleUp.bind(this),Ne(e,"down",this._handleDown),Ne(window,"move",this._handleMove),Ne(window,"up",this._handleUp),vt&&Ne(window,"cancel",this._handleUp)}destroy(){xe(this.target,"down",this._handleDown),xe(window,"move",this._handleMove),xe(window,"up",this._handleUp),vt&&xe(window,"cancel",this._handleUp),this.pointers.clear()}_handleDown(e){if(!vt){if(this._isTouchEvent(e))this.lastTouchTime=Date.now();else if(this._shouldIgnoreMouseEvent(e))return}vt?this._addOrUpdatePointer(e):e.touches?this._syncTouches(e):this.pointers.set("mouse",{id:"mouse",x:e.clientX,y:e.clientY,type:"mouse"}),this.onStart&&this.onStart(e,this)}_handleMove(e){if(!vt){if(this._isTouchEvent(e))this.lastTouchTime=Date.now();else if(this._shouldIgnoreMouseEvent(e))return}if(vt)this.pointers.has(this._getPointerId(e))&&this._addOrUpdatePointer(e);else if(e.touches)this._syncTouches(e);else if(this.pointers.has("mouse")){const i=this.pointers.get("mouse");i.x=e.clientX,i.y=e.clientY}this.onMove&&this.onMove(e,this)}_handleUp(e){if(!vt){if(this._isTouchEvent(e))this.lastTouchTime=Date.now();else if(this._shouldIgnoreMouseEvent(e))return}if(vt)this.pointers.delete(this._getPointerId(e));else if(e.changedTouches){for(const i of e.changedTouches)this.pointers.delete(i.identifier);(!e.touches||e.touches.length===0)&&this.pointers.delete("mouse")}else this.pointers.delete("mouse");this.onEnd&&this.onEnd(e,this)}_getPointerId(e){return e.pointerId!=null?e.pointerId:"mouse"}_isTouchEvent(e){return!!(e.touches||e.changedTouches)}_shouldIgnoreMouseEvent(e){return!this._isTouchEvent(e)&&Date.now()-this.lastTouchTime<Wr}_addOrUpdatePointer(e){this.pointers.set(this._getPointerId(e),{id:this._getPointerId(e),x:e.clientX,y:e.clientY,type:e.pointerType||"mouse"})}_syncTouches(e){this.pointers.clear();for(const i of e.touches)this.pointers.set(i.identifier,{id:i.identifier,x:i.clientX,y:i.clientY,type:"touch"})}get list(){return Array.from(this.pointers.values())}}function Zr(t){return t.list[0]||null}function Vn(t){const e=t.list;return e.length===0?null:e.length===1?{x:e[0].x,y:e[0].y}:{x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2}}function Zn(t){const e=t.list;if(e.length<2)return 0;const i=e[0].x-e[1].x,n=e[0].y-e[1].y;return Math.hypot(i,n)}function f(t,e){var l;const i=zn(e);this._registeredArticleLayoutStyles=L({},mi.article.layoutStyles||{}),this._explicitArticleOptions=L({},(i==null?void 0:i.article)||{}),this.options=L({},mi,i),Fr(t)?this.canvas=t:(this.canvas=Br(),Yn(t,this.canvas)),this.canvas&&this.canvas.style&&(this.options.width!=null&&(this.canvas.style.width=`${this.options.width}px`),this.options.height!=null&&(this.canvas.style.height=`${this.options.height}px`)),this.canvasContext=this.canvas.getContext("2d"),this.canvasDpr=pi(this.canvas,this.options.width,this.options.height,this.canvasContext,this.options.canvas),this.fontWatcher=new Sr(c=>{this.forLoadedArticles(h=>h.invalidateCaches()),this.requestRedraw()});const n=this.canvasContext,o=n.measureText.bind(n);n.measureText=c=>(this.fontWatcher.use(n.font),o(c)),this.width=this.canvas.clientWidth||this.options.width,this.top=this.options.height-this._getEffectiveVerticalOffset(),this.repositionWindow=0,this.uniqueId=`tl${new Date().getTime()}`,this.title="My timeline",this.ownerId=void 0,this.cursor="default",this.mouseoverArticle=null,this.isDragging=!1,this.draggingArticle=null,this.dragStartX=0,this.isPanning=!1,this.isPinching=!1,this.isAnimating=!1,this.isAnimatingArticles=!1,this.isCustomAnimating=!1,this.animation={redrawFunction:!1,defaultRedrawFunction:this.repositionRedraw,dragRedrawFunction:this.defaultRedraw,pan:null,zoom:null},this.lastAnimatingArticle={id:null,endTime:0},this.topRow=0,this.loadingHttpRequests=[],this.articles=[],this.lanes=[],this.timeBands=[],this.charts=[],this._runtimeArticleOptions={},this.redrawRequests={default:!1,reposition:!1},this._initialiseLaneHost(t),this.handlers={},this.options.on&&this.onMultiple(this.options.on),this._isInitialized=!1,this._hasPendingTimelineStateChange=!1;const s=this.options.zoom,r=this.getDmyFromInput(this.options.initialDate);this.timescaleManager=new D(this,s),this.timescaleManager.setUnitLevels(),this.timescaleManager.addZoomChangedHandler(this.zoomChanged,this),this.timescaleManager.setZoom(s.initial),this.timescaleManager.setStartDate(r),(l=this.settleDateBounds)==null||l.call(this,{animate:!1}),this.options.enableUserControl&&(this.enableZoomByWheel(),this.enableDragging()),this.groups={level:-1,periods:[]};const a=this.options.image||{};this.imageLoader=new Ir({maxConcurrent:a.maxConcurrent,maxCacheBytes:a.maxCacheBytes,requireCORS:a.requireCORS,decodeMode:a.decodeMode}),this.options.lane&&Array.isArray(this.options.lane.data)&&this.options.lane.data.length>0&&this.addLanes(this.options.lane.data),this.options.timeBand&&Array.isArray(this.options.timeBand.data)&&this.options.timeBand.data.length>0&&typeof this.addTimeBands=="function"&&this.addTimeBands(this.options.timeBand.data),this.options.chart&&Array.isArray(this.options.chart.data)&&this.options.chart.data.length>0&&typeof this.addCharts=="function"&&this.addCharts(this.options.chart.data),this.requestRedraw(),this._isInitialized=!0}f.prototype.setTitle=function(t){this.title=t,this._emitTimelineStateChange()},f.prototype.getWidth=function(){return this.canvas.clientWidth||this.options.width},f.prototype.getCanvasDpr=function(){return this.canvasDpr||1},f.prototype.isInVicinity=function(t,e,i){if(e=ie(e,this,t,i),typeof e=="boolean")return e;const n=i||this.getRelativePosition(t),o=e.up===void 0||n.top>this.top-e.up,s=e.down===void 0||n.top<this.top+e.down;return o&&s},f.prototype.getPixel=function(t,e){let i;const n=t.toKeyString();if(e){if(i=e.tokens,Object.prototype.hasOwnProperty.call(i,n))return i[n]}else i={};const o=this.repositionWindow,s=this.timescaleManager.startToken;return i[n]=this.timescaleManager.getPixelsBetween(s.value,t)+o},f.prototype.getRelativePosition=function(t){const{x:e,y:i}=ne(t),n=this.canvas.getBoundingClientRect();return{left:e-n.left,top:i-n.top}},f.prototype.updateCursor=function(t){const e=this.cursor,i=this.cursor=this.getCursor(t);e!==i&&(this.canvas.style.cursor=i)},f.prototype.getCursor=function(t){const e=this.options.style.cursor;if(this.isDragging)return e.timeline.dragging;const i=this.getRelativePosition(t);return this.draggingArticle?this.draggingArticle.getCursor(i):!this.options.disableBranding&&(this._isInsideHistropediaJSLink(i)||this._isInsideTermsLink(i))?e.clickable:this.mouseoverArticle!==null?this.mouseoverArticle.getCursor(i):e.timeline.hover},f.prototype.onRedraw=function(t){T.warn('DEPRECATION WARNING: timeline.onRedraw(handler) is deprecated. Use timeline.on("timeline-render-end", handler) instead.'),typeof this.on=="function"&&this.on("timeline-render-end",t)},f.prototype.zoomChanged=function(){let t;this.currentDensitySetting&&(t=this.currentDensitySetting.region),this.updateCurrentDensitySetting(),t!==this.currentDensitySetting.region&&this.updateArticlesGroupIndex()},f.prototype.updateCurrentDensitySetting=function(){for(let t=0;t<Je.length;t++){const e=Je[t];if(this.timescaleManager.zoom>=e.zoom.from&&this.timescaleManager.zoom<e.zoom.to){this.currentDensitySetting=e;break}}},f.prototype.calculateEndToken=function(){const t=this.getWidth();let e=this.repositionWindow,n=this.timescaleManager.startToken,o;do o=n,n=this.timescaleManager.getNext(n),e+=n.length;while(e<t);return o},f.prototype.getDensityPick=function(t=this.options.article.density){switch(t){case"low":case 1:return this.currentDensitySetting.low;case"medium":case 2:return this.currentDensitySetting.medium;case"high":case 3:return this.currentDensitySetting.high;case"all":case 0:return this.currentDensitySetting.all}T.error(`Unknown density selector:${t}`)},f.prototype.invoke=function(t,e,i){Object.prototype.hasOwnProperty.call(e,t)&&e[t].call(this,i)},f.prototype.forLoadedArticles=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];i.isDataLoaded&&t.call(this,i)}},f.prototype.forVisibleArticles=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];i.isDataLoaded&&i.isVisible&&t.call(this,i)}},f.prototype.forInRangeArticles=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];i.isDataLoaded&&(i.isInRange||i.isFading)&&t.call(this,i)}},f.prototype.enqueueImageLoad=function(t){let e=_(t.data,"imageUrl");if(!e){if(typeof t._closeImage=="function")try{t._closeImage({keepState:!1,skipRedraw:!0})}catch(l){}t.image=null,t.imageLoaded=!1,t._closeImage=null,t._loadedImageKey=null,t._pendingImageKey=null;return}const{sanitizer:i,customSanitizer:n}=this.options.image;if(typeof n=="function")try{e=n(e,i)}catch(l){e=null}else e=Nr(e,i);if(!e){if(typeof t._closeImage=="function")try{t._closeImage({keepState:!1,skipRedraw:!0})}catch(l){}t.image=null,t.imageLoaded=!1,t._closeImage=null,t._loadedImageKey=null,t._pendingImageKey=null;return}const o=this._getArticleImageTargetSpec(t),s=o&&Number.isFinite(o.dpr)&&o.dpr>0?Math.round(Math.max(1,o.dpr)*1e3)/1e3:1,r=`img:${e}:${o.layout}:${o.shape}:${o.targetW||0}x${o.targetH||0}@${s}`;if(t._loadedImageKey===r&&t.imageLoaded&&t.image||t._pendingImageKey===r&&typeof t._imageCancel=="function")return;if(t._pendingImageKey&&t._pendingImageKey!==r&&typeof t._imageCancel=="function"){try{t._imageCancel()}catch(l){}t._imageCancel=null}t.imageLoaded&&t.image||(t.imageLoaded=!1),t._pendingImageKey=r;const a=this.imageLoader.enqueue(r,e,(l,c,h,u,m)=>{if(typeof t._closeImage=="function")try{t._closeImage({keepState:!1,skipRedraw:!0})}catch(g){}let d=null;typeof m=="function"?d=m:typeof u=="function"&&(d=function(){try{u()}catch(g){}}),t.image=l,t.imageLoaded=!0,t._loadedImageKey=r,t._pendingImageKey=null,t._imageCancel=null,t._closeImage=d,t._closeImage&&t._closeImage._key==null&&typeof m=="function"&&(t._closeImage._key=r,t._closeImage._article=t),typeof t.updateCachedSize=="function"&&t.updateCachedSize(),this.requestRedraw(this.redraw)},{targetW:o.targetW,targetH:o.targetH,shape:o.shape,article:t});t._imageCancel=a},f.prototype._getArticleImageTargetSpec=function(t){const e=t._getCurrentCardLayoutName(),i=t.getCurrentStyle(),n=i&&i.image?i.image:{},o=n.shape||"square";let s=null,r=null;if(e==="landscape"){const m=n.margin||0,d=Math.max(1,(i.height||0)-m*2);s=d,r=d}else if(e==="portrait"){const m=n.margin||0,g=Math.max(1,(i.width||0)-0-m*2);o==="square"||o==="circle"?(s=g,r=g):s=g}else i&&typeof i.width=="number"&&(s=i.width);const a=typeof this.getCanvasDpr=="function"?this.getCanvasDpr():Number(this.canvasDpr),l=Number.isFinite(a)&&a>0?a:1,c=m=>typeof m!="number"||!Number.isFinite(m)||m<=0?null:Math.max(1,Math.round(m*l)),h=c(s),u=c(r);return{layout:e,targetW:h,targetH:u,shape:o,dpr:l}},f.prototype.setOption=function(t,e){if(typeof t=="string"){const d=xn(t),g=_(this.options,d);if(typeof e=="undefined")return g;t=bt(d,e)}const i=this.top;t=zn(t),A(t,"article")&&L(this._explicitArticleOptions,t.article||{}),L(this.options,t);const n=t.width||t.height;n&&this.setSize(this.options.width,this.options.height);const o=A(t,"canvas.dpr")||A(t,"canvas.dprMode")||A(t,"canvas.maxDpr");!n&&o&&(this.canvasDpr=pi(this.canvas,this.options.width,this.options.height,this.canvasContext,this.options.canvas)),typeof t.verticalOffset=="number"&&(this.top=this.options.height-this._getEffectiveVerticalOffset()),(A(t,"timeBand.visible")||A(t,"timeBand.reserveSpace")||A(t,"timeBand.reserveSpacePixels"))&&(this.top=this.options.height-this._getEffectiveVerticalOffset()),(A(t,"style.dateLabel.parent.visible")||A(t,"style.dateLabel.parent.height"))&&(this.top=this.options.height-this._getEffectiveVerticalOffset());const a=kn(_(t,"article"));if(A(t,"timeBand.defaultStyle")&&Array.isArray(this.timeBands)&&this.timeBands.length>0){const d=this.options.timeBand&&this.options.timeBand.defaultStyle?this.options.timeBand.defaultStyle:{};for(let g=0;g<this.timeBands.length;g++){const p=this.timeBands[g],w=p&&p.data&&p.data.style?p.data.style:{};p.style=L({},d,w)}}const c=_(t,"chart.data");Array.isArray(c)&&typeof this.addCharts=="function"&&this.addCharts(c);const h=A(t,"chart.seriesColors");if((h||A(t,"chart.defaultData")||A(t,"chart.defaultStyle"))&&Array.isArray(this.charts)&&this.charts.length>0){let d=!1;for(let g=0;g<this.charts.length;g++){const p=this.charts[g].laneId;h&&(this.charts[g]._seriesColors=[]),this.charts[g]._resolveFromData(),A(t,"chart.defaultData")&&this.charts[g].laneId!=null&&this._ensureChartLane(this.charts[g].laneId),d=d||p!==this.charts[g].laneId}d&&(this._refreshLaneOrder(),this._updateLaneLayout())}let m={styleLaneIds:new Set};if(A(t,"lane")){const d=_(t,"lane.data");Array.isArray(d)&&(m=this.addLanes(d,{suppressArticleRefresh:!0}))}if(A(t,"lane")||a.cacheChanged){const d=a.styleChanged?"all":m.styleLaneIds.size>0?m.styleLaneIds:null;this._refreshResolvedLanesFromOptions({articleStyleScope:d})}this.top!==i&&this.options.article.autoStacking.fitToHeight&&!this._isLaneLayoutActive()&&this.fitToHeight(),this.requestRedraw()},f.prototype.setSize=function(t,e){this.canvas&&this.canvas.style&&(typeof t=="number"&&(this.canvas.style.width=`${t}px`),typeof e=="number"&&(this.canvas.style.height=`${e}px`)),this.options.width=t,this.options.height=e,this.canvasDpr=pi(this.canvas,t,e,this.canvasContext,this.options.canvas),typeof this._syncLaneViewportSize=="function"&&this._syncLaneViewportSize(),this.width=this.canvas.clientWidth||t,this.top=e-this._getEffectiveVerticalOffset(),this.requestRedraw()},f.prototype._getEffectiveVerticalOffset=function(){var a,l;const t=this.options.verticalOffset||0,e=this.options.timeBand||{},i=Array.isArray(this.timeBands)&&this.timeBands.length>0,o=!!e.reserveSpace&&e.visible&&i&&e.reserveSpacePixels||0,s=((l=(a=this.options.style)==null?void 0:a.dateLabel)==null?void 0:l.parent)||{},r=s.visible===!0&&s.height||0;return t+o+r},f.prototype.generateDensitySettings=function(){const t=this.timescaleManager.zoomOptions.ratio,e=[],i=a=>Math.round(a*100)/100,n=i(Math.log(.5)/Math.log(t)),o=Math.ceil(Math.log2(U));for(let a=o;a>=1;a--)e.push({region:1-a,zoom:{from:a===o?Number.NEGATIVE_INFINITY:i(-a*n),to:i(-(a-1)*n)},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:Math.pow(2,a)}});const s=Math.ceil(this.timescaleManager.zoomOptions.maximum/n);for(let a=0;a<s;a++){const l=i(a*n),c=i((a+1)*n),h={region:a+1,zoom:{from:l,to:c},low:1,medium:2,high:3,all:25,step:{months:0,days:Math.pow(2,a)}};e.push(h)}const r=JSON.stringify(e,(a,l)=>l===Number.NEGATIVE_INFINITY?"__DENSITY_NEGATIVE_INFINITY__":l,2).replace('"__DENSITY_NEGATIVE_INFINITY__"',"Number.NEGATIVE_INFINITY");T.log(r)};function oe(t){return t!=null&&typeof t=="object"}function Ur(t,e){return{day:t.getDaysSinceYearZero(),division:Math.floor(t.getMillisecondsOfDay()*e/U),divisionsPerDay:e}}function se(t,e){return!oe(t)&&!oe(e)?t===e?0:t<e?-1:1:t.day!==e.day?t.day<e.day?-1:1:t.division!==e.division?t.division<e.division?-1:1:0}function St(t,e){if(!oe(t))return t+e;const i=t.division+e,n=Math.floor(i/t.divisionsPerDay);return{day:t.day+n,division:i-n*t.divisionsPerDay,divisionsPerDay:t.divisionsPerDay}}function Un(t,e,i){return se(t,e)<0?e:se(t,i)>0?i:t}function yi(t){return oe(t)?`${t.day}:${t.division}`:String(t)}function Gr(t){return{dayNumber:t.day,dayFraction:t.division/t.divisionsPerDay}}function jr(t,e){return`${t}::${yi(e)}`}const $r=1e7,Xr=2e7;function qr(t){return t.isActive?t.rank+Xr:t.rank+(t.isStarred?$r:0)}function Kr(t,e){const i=[];let n=0;for(let o=0;o<t.length;o++){const s=t[o];if(s.effectiveRank=qr(s),i.length<e){i.push(s),s.effectiveRank<i[n].effectiveRank&&(n=i.length-1);continue}s.effectiveRank>i[n].effectiveRank&&(i[n]=s,n=vr(i,"effectiveRank"))}return i}f.prototype.updateArticlesGroupIndex=function(){this.forLoadedArticles(function(t){t.groupIndex=this.calculateGroupIndex(t.period.from)})},f.prototype.updateVisibleArticlesOfGroups=function(t){if(this._isLaneLayoutActive()){this.groups={};const o=gi(this.options.article.autoStacking.range)?1:20,s=St(this.calculateGroupIndex(t.tokens.start),-o),r=St(this.calculateGroupIndex(t.tokens.end),o),a=this._getActiveLanesForLayout();this.forLoadedArticles(function(l){l.isVisibleInGroup=!1});for(let l=0;l<a.length;l++){const c=a[l];for(let h=s;se(h,r)<=0;h=St(h,1)){const u=jr(c.id,h);this.groups[u]=this.getArticlesInGroup(h,s,r,c.id).map(function(m){return m.isVisibleInGroup=!0,m.id})}}return}this.groups={};const e=gi(this.options.article.autoStacking.range)?1:20,i=St(this.calculateGroupIndex(t.tokens.start),-e),n=St(this.calculateGroupIndex(t.tokens.end),e);this.forLoadedArticles(function(o){o.isVisibleInGroup=!1});for(let o=i;se(o,n)<=0;o=St(o,1))this.groups[yi(o)]=this.getArticlesInGroup(o,i,n).map(function(s){return s.isVisibleInGroup=!0,s.id})},f.prototype.getArticlesInGroup=function(t,e,i,n){const o=typeof n!="undefined"?this.getLaneById(n):null,s=o&&o.resolvedArticleOptions?o.resolvedArticleOptions.density:this.options.article.density,r=this.getDensityPick(s),a=[];for(let l=0;l<this.articles.length;l++){const c=this.articles[l];!c.isDataLoaded||c.isHiddenByFilter||typeof n!="undefined"&&c.laneId!==n||!(se(Un(c.groupIndex,e,i),t)===0)||a.push(c)}return Kr(a,r)},f.prototype.calculateGroupIndex=function(t){if(this.currentDensitySetting.step.divisionsPerDay)return Ur(t,this.currentDensitySetting.step.divisionsPerDay);if(this.timescaleManager.unit>=$&&this.currentDensitySetting.step.months!==0){const i=t.year*12+(t.month-1);return Math.floor(i/this.currentDensitySetting.step.months)}const e=t.year*372+(t.month-1)*31+t.day;return this.currentDensitySetting.step.days===0?Math.floor(e/(this.currentDensitySetting.step.months*30)):Math.floor(e/this.currentDensitySetting.step.days)},f.prototype.canBeVisibleInGroup=function(t,e,i){if(t.isActive)return!0;e=e||this.timescaleManager.startToken,i=i||this.calculateEndToken();const n=St(this.calculateGroupIndex(e.value),-1),o=St(this.calculateGroupIndex(i.value),1),s=Un(t.groupIndex,n,o),r=yi(s);return Object.prototype.hasOwnProperty.call(this.groups,r)?this.groups[r].indexOf(t.id)>=0:!1};const Jr=64;function Qr({velocity:t,friction:e,minVelocity:i,maxDuration:n,maxFrameDelta:o=Jr,shouldStop:s,onUpdate:r,onComplete:a}={}){let l=t;const c=performance.now();let h=c,u=!1;if(!Number.isFinite(l)||!Number.isFinite(e)||e<=0||!Number.isFinite(i)||i<0||!Number.isFinite(n)||n<=0)return{stop(){}};function m(){u=!0}function d(){u||(u=!0,a==null||a())}function g(p){if(u)return;if(s!=null&&s()){m();return}if(p-c>=n||Math.abs(l)<i){d();return}const w=Math.min(Math.max(p-h,0),o);if(h=p,w>0){const b=Math.exp(-e*w),v=l*(1-b)/e;l*=b,v!==0&&(r==null||r(v,l))}requestAnimationFrame(g)}return requestAnimationFrame(g),{stop:m}}function Gn(t=0){var e,i;return typeof t=="number"?{left:t,right:t}:{left:(e=t==null?void 0:t.left)!=null?e:0,right:(i=t==null?void 0:t.right)!=null?i:0}}function ze(t){var i,n,o,s,r,a,l;const e=typeof t=="string"?(i=ti(t))==null?void 0:i.date:t;if(!e||!Number.isFinite(e.year))throw new Error("Date input requires a numeric year or canonical Histropedia date string");return new y({precision:me(e),year:e.year,month:(n=e.month)!=null?n:1,day:(o=e.day)!=null?o:1,hour:(s=e.hour)!=null?s:0,minute:(r=e.minute)!=null?r:0,second:(a=e.second)!=null?a:0,millisecond:(l=e.millisecond)!=null?l:0})}function wi(t){const e=Math.floor(t.millisecond/U);return{dayNumber:t.dayNumber+e,millisecond:t.millisecond-e*U}}function re(t){return{dayNumber:t.getDaysSinceYearZero(),millisecond:t.getMillisecondsOfDay()}}function Ot(t,e){return t.dayNumber!==e.dayNumber?t.dayNumber<e.dayNumber?-1:1:t.millisecond!==e.millisecond?t.millisecond<e.millisecond?-1:1:0}function Lt(t,e){const i=e.dayNumber-t.dayNumber,n=e.millisecond-t.millisecond;return i+n/U}function Tt(t,e){const i=Math.floor(e);return wi({dayNumber:t.dayNumber+i,millisecond:t.millisecond+(e-i)*U})}function jn(t,e,i){if(i<=0)return W({},t);if(i>=1)return W({},e);const n=(e.dayNumber-t.dayNumber)*i,o=Math.floor(n),s=t.millisecond+(n-o)*U+(e.millisecond-t.millisecond)*i;return wi({dayNumber:t.dayNumber+o,millisecond:s})}function ye(t){return new y(t===-1?1:t+1,1,1)}function ta(t,e){return e===12?ye(t):new y(t,e+1,1)}function $n(t){const e=ze(t),i=typeof t=="string"?ti(t):null,n=i?i.hasMonth:t.month!=null,o=i?i.hasDay:t.day!=null,s=i?i.hasTime:t.hour!=null||t.minute!=null||t.second!=null||t.millisecond!=null;return!n&&!s?{start:e,end:ye(e.year)}:!o&&!s?{start:e,end:ta(e.year,e.month)}:{start:e,end:ze(t)}}function bi(t,e){return Math.max(1,t.getWidth()-e.left-e.right)}function ea(t,e){var s,r;const i=(s=t.zoomOptions)==null?void 0:s.minimum,n=(r=t.zoomOptions)==null?void 0:r.maximum;let o=e;return Number.isFinite(i)&&o<i&&(o=i),Number.isFinite(n)&&o>n&&(o=n),o}function Fe(t,e){return Number.isFinite(e)?parseFloat(ea(t,e).toFixed(4)):e}function Xn(t,e){if(typeof t.getUnitFromZoom=="function")return t.getUnitFromZoom(e);const i=t.unitLevels;if(!Array.isArray(i)||i.length===0)return t.unit;const n=t.unitOrder||i.map((o,s)=>s);for(let o=n.length-1;o>=0;o--){const s=n[o];if(e>=i[s].zoomStart)return s}return t.unit}function qn(t,e,i){var r,a,l,c;const n=(r=t.unitLevels)==null?void 0:r[e],o=(a=t.zoomOptions)==null?void 0:a.ratio;if(n&&Number.isFinite(n.startUnitSize)&&Number.isFinite((l=n.referenceZoom)!=null?l:n.zoomStart)&&Number.isFinite(o)&&o>0)return n.startUnitSize*Math.pow(o,i-((c=n.referenceZoom)!=null?c:n.zoomStart));if(!Number.isFinite(t.unitSizeInPixels))return NaN;const s=i-t.zoom;return t.scaleDistanceByZoomChange?t.scaleDistanceByZoomChange(t.unitSizeInPixels,s):NaN}function Kn(t){return t>=rt?Math.pow(10,t-rt):0}function ia(t,e,i,n){const o=Fe(t,n),s=Xn(t,o),r=qn(t,s,o);return!Number.isFinite(r)||r<=0?NaN:s<=O?e.getDaysTo(i)*r/Ee(s):s===$?e.getMonthsTo(i)*r:e.getYearsTo(i)*r/Kn(s)}function na(t,e,i,n){const o=Fe(t,n),s=Xn(t,o),r=qn(t,s,o);if(!Number.isFinite(r)||r<=0)return NaN;const a=Lt(e,i);return s<=O?a*r/Ee(s):s===$?a*r/30.44:a*r/(365.2422*Kn(s))}function oa(t,e,i,n){const o=t.timescaleManager,s=o.getPixelsBetween(e,i);if(!Number.isFinite(s)||s<=0)return o.zoom;const r=bi(t,n),a=o.getZoomChangeByDistance(s,r);if(!Number.isFinite(a))return o.zoom;let l=o.zoom+a;for(let c=0;c<4;c++){const h=ia(o,e,i,l);if(!Number.isFinite(h)||h<=0)break;const u=o.getZoomChangeByDistance(h,r);if(!Number.isFinite(u)||(l+=u,Math.abs(u)<5e-5))break}return Fe(o,l)}function Jn(t,e){return e==null?null:t.getDmyFromInput(ze(e))}function we(t){var o;const e=(o=t.options)==null?void 0:o.bounds;if(!e)return null;let i=Jn(t,e.minDate),n=Jn(t,e.maxDate);return!i&&!n?null:(i&&n&&i.compare(n)>0&&([i,n]=[n,i]),{minDate:i,maxDate:n,minPoint:i?re(i):null,maxPoint:n?re(n):null,minDay:i?Zt(i):null,maxDay:n?Zt(n):null,overflow:e.overflow==="clamp"?"clamp":"elastic"})}function Qn(t){const e=He(t,0),i=He(t,t.getWidth());return Ot(e,i)<=0?{start:e,end:i}:{start:i,end:e}}function sa(t,e,i){const n=t.minPoint?Lt(e.start,t.minPoint):0,o=t.maxPoint?Lt(t.maxPoint,e.end):0;return n>0&&n>=o?{type:"min",dayPoint:t.minPoint,dayNumber:t.minDay,pixelOffset:0,overflowDays:n}:o>0?{type:"max",dayPoint:t.maxPoint,dayNumber:t.maxDay,pixelOffset:i,overflowDays:o}:null}function Be(t,e=we(t),i={}){if(!e)return null;const n=Qn(t),o=t.getWidth(),s=sa(e,n,o);return i.mode==="elastic"&&e.overflow==="elastic"&&s?s:e.minPoint&&e.maxPoint&&Lt(n.start,n.end)>Lt(e.minPoint,e.maxPoint)?{type:"range",zoom:io(t,e.minPoint,e.maxPoint,{left:0,right:0},t.timescaleManager.zoom),dayPoint:e.minPoint,dayNumber:e.minDay,pixelOffset:0}:s}function vi(t,e){const i=At(t);if(!i||!Number.isFinite(e)||e<=0)return 0;const n=Math.max(1,t.getWidth()),o=Math.max(32,n*.22),s=e*i;return o*s/(o+s)/i}function to(t,e){const i=At(t);if(!i||!Number.isFinite(e)||e<=0)return 0;const n=Math.max(1,t.getWidth()),o=Math.max(32,n*.22),s=e*i;return s>=o?Number.MAX_SAFE_INTEGER/i:o*s/(o-s)/i}function ra(t,e,i){const n=we(t);let o=e;if((n==null?void 0:n.overflow)==="elastic"&&Number.isFinite(i)){const s=Tt(e,i);if(n.minPoint&&Ot(e,n.minPoint)<0){const r=Lt(e,n.minPoint);o=Tt(n.minPoint,-vi(t,r))}else if(n.maxPoint&&Ot(s,n.maxPoint)>0){const r=Lt(n.maxPoint,s);o=Tt(n.maxPoint,vi(t,r)-i)}}Vt(t,o,0,!1,{skipDateBounds:!0})}function Et(t,e={}){const i=we(t);if(!i)return!1;const n=e.mode||"clamp",o=Be(t,i,{mode:n});if(!o)return!1;if(o.type==="range")return o.zoom!==t.timescaleManager.zoom&&t.timescaleManager.setZoom(o.zoom),Vt(t,o.dayPoint,o.pixelOffset,!1,{skipDateBounds:!0}),!0;if(n==="elastic"&&i.overflow==="elastic"){const s=vi(t,o.overflowDays);return o.type==="min"?Vt(t,Tt(o.dayPoint,-s),0,!1,{skipDateBounds:!0}):Vt(t,Tt(o.dayPoint,s),o.pixelOffset,!1,{skipDateBounds:!0}),!0}return Vt(t,o.dayPoint,o.pixelOffset,!1,{skipDateBounds:!0}),!0}function aa(t){return!!Be(t)}function At(t){var o;const e=t.timescaleManager,i=e.unitSizeInPixels;if(!Number.isFinite(i)||i<=0)return 0;if(e.unit==null||e.unit<=O)return i/Ee((o=e.unit)!=null?o:O);if(e.unit===$)return i/30.44;const n=Number.isFinite(e.unitLengthInYears)&&e.unitLengthInYears>0?e.unitLengthInYears:1;return i/(365.2422*n)}function Vt(t,e,i,n=!1,o={}){var u;const s=wi(e),r=Math.floor(s.millisecond),a=s.millisecond-r,l=Si(s.dayNumber).addMilliseconds(r),c=a*At(t)/U,h=t.timescaleManager.setStartDate(l);t.repositionWindow=h-c,i&&t.updateFromByPixels(-i,{skipDateBounds:!0}),o.skipDateBounds||Et(t,{mode:o.boundsMode||"clamp"}),t.requestRedraw(),(u=t._markTimelineStateChanged)==null||u.call(t),n&&t._emitTimelineStateChange()}function eo(t,e,i,n=!1,o={}){Vt(t,re(e),i,n,o)}function la(t,e){const i=At(t),n=re(e.date);return i?Tt(n,e.fraction/i):n}function He(t,e){return la(t,t.getPivotPoint(e))}function Zt(t){return t.getDaysSinceYearZero()+t.getMillisecondsOfDay()/U}function Si(t){const e=Math.floor(t);let i=Math.floor(e/365.2422),n=Zt(new y(i,1,1)),o=Zt(ye(i));for(;n>e;)i-=1,n=Zt(new y(i,1,1)),o=Zt(ye(i));for(;o<=e;)i=i===-1?1:i+1,n=o,o=Zt(ye(i));return y.getByDayOfYear(i,e-n+1)}function ca(t,e,i){return t+(e-t)*i}function io(t,e,i,n,o){if(Ot(i,e)<=0)return o;const s=t.timescaleManager,r=Lt(e,i)*At(t);if(!Number.isFinite(r)||r<=0)return o;const a=bi(t,n),l=s.getZoomChangeByDistance(r,a);if(!Number.isFinite(l))return o;let c=s.zoom+l;for(let h=0;h<4;h++){const u=na(s,e,i,c);if(!Number.isFinite(u)||u<=0)break;const m=s.getZoomChangeByDistance(u,a);if(!Number.isFinite(m)||(c+=m,Math.abs(m)<5e-5))break}return Fe(s,c)}function ha(t){var e,i,n,o,s;typeof t.stopPanAnimation=="function"?t.stopPanAnimation():(t.isPanning&&((i=(e=t.animation)==null?void 0:e.pan)!=null&&i.stop)&&t.animation.pan.stop(),t.isPanning=!1),typeof t.stopZoomAnimation=="function"?t.stopZoomAnimation():((o=(n=t.animation)==null?void 0:n.zoom)!=null&&o.stop&&t.animation.zoom.stop(),((s=t.animation)==null?void 0:s.wheelZoomFrame)!=null&&cancelAnimationFrame(t.animation.wheelZoomFrame),t.animation&&(t.animation.zoom=null,t.animation.wheelZoomTarget=null,t.animation.wheelZoomPivotPoint=null,t.animation.wheelZoomPivotPixel=null,t.animation.wheelZoomLastFrameTime=null,t.animation.wheelZoomFrame=null))}function ua(t,e,i,n,o,s={}){var g;ha(t),t.switchToPositiveRepositionWindow(),t.isPanning=!0,t.startAnimation();const r=t.timescaleManager.zoom,a=bi(t,o),l=He(t,o.left),c=He(t,o.left+a),h=re(e),u=re(i),m=Ot(c,l)>0&&Ot(u,h)>0,d=Y({from:0,to:1,duration:(g=s.duration)!=null?g:2e3,easing:H[s.easing]||H.swing,onUpdate(p){if(t.isPinching){t.isPanning=!1,d.stop();return}const w=jn(l,h,p);let b=r;p>0&&(b=m?io(t,w,jn(c,u,p),o,t.timescaleManager.zoom):ca(r,n,p)),b!==t.timescaleManager.zoom&&t.timescaleManager.setZoom(b),Vt(t,w,o.left)},onComplete(){n!==t.timescaleManager.zoom&&t.timescaleManager.setZoom(n),eo(t,e,o.left,!0),t.isPanning=!1}});t.animation.pan=d}function da(t,e){var a,l,c,h;const i=t.articles||[];let n=null,o=null,s=0,r=0;for(let u=0;u<i.length;u++){const m=i[u];if(!e(m)||!((a=m.period)!=null&&a.from))continue;const d=m.period.from;(!n||d.compare(n)<0)&&(n=d),(!o||d.compare(o)>0)&&(o=d);const g=m.getCurrentStyle(),p=(c=(l=g.connectorLine)==null?void 0:l.offsetX)!=null?c:0,w=(h=g.width)!=null?h:0;s=Math.max(s,p),r=Math.max(r,w-p)}return n?{earliest:n,latest:o,maxCardLeftOffset:s,maxCardRightOffset:r}:null}f.prototype._drawBranding=function(t){this._drawCopyrightLinks(t)};const Ye=117,Li=22,no=0,oo=0,We=8,_i=0,ae=12,fa="HistropediaJS",so=75,ma="Terms",ga=33,pa=10,ya=`${fa} | ${ma}`;f.prototype._drawCopyrightLinks=function(t){t.beginPath(),t.fillStyle="rgba(255, 255, 255, 0.8)",t.fillRect(this.width-Ye-no-We*2,this.top-Math.floor(this.options.style.mainLine.size/2)-Li-oo-_i*2,Ye+We*2,Li+_i*2),t.textAlign="left",t.textBaseline="middle",t.fillStyle="#000000",t.font=`normal ${ae}px "Helvetica Neue", Helvetica, Arial, sans-serif`;const e=this._getBrandingTextCoords();t.fillText(ya,e.left,e.top,Ye+We)},f.prototype._getBrandingTextCoords=function(){return{left:this.width-Ye-no-We,top:this.top-Math.floor(this.options.style.mainLine.size/2)-Li-oo+ae-_i}},f.prototype._isInsideHistropediaJSLink=function(t){const e=this._getBrandingTextCoords();return ro(t,{left:e.left,top:e.top-ae/2,width:so,height:ae})},f.prototype._isInsideTermsLink=function(t){const e=this._getBrandingTextCoords();return ro(t,{left:e.left+so+pa,top:e.top-ae/2,width:ga,height:ae})};function wa(){const t=window.open("https://js.histropedia.com","_blank","noopener,noreferrer");t&&(t.opener=null)}function ba(){const t=window.open("https://js.histropedia.com/licence.html","_blank","noopener,noreferrer");t&&(t.opener=null)}function ro(t,e){return t.left>=e.left&&t.left<=e.left+e.width&&t.top>=e.top&&t.top<=e.top+e.height}const Ai=({startToken:t,offsetX:e=0,dx:i=0,totalDx:n=0}={})=>({startToken:t,offsetX:e,dx:i,totalDx:n}),Ii=({centre:t=null,scale:e=0,zoom:i=0,distance:n=0,zoomDelta:o=0,dx:s=0,totalZoomDelta:r=0,pointers:a=[]}={})=>({centre:t,scale:e,zoom:i,distance:n,zoomDelta:o,dx:s,totalZoomDelta:r,pointers:a}),va=({centre:t=null,zoom:e=0,zoomDelta:i=0}={})=>({centre:t,zoom:e,zoomDelta:i}),Sa=({viewport:t}={})=>{var n,o;if(!t)return{viewport:{x:0,y:0}};const{x:e=(n=t.left)!=null?n:0,y:i=(o=t.top)!=null?o:0}=t;return{viewport:{x:e,y:i}}},ao=100,La=.01,_a=.005,Aa=.004,Ia=1200;function le(t,e){return Number.isFinite(t)&&t>0?t:e}function Ma(t,e){if(!(t!=null&&t.canvas))return!1;const i=t.canvas.ownerDocument;if(!i||typeof i.elementFromPoint!="function")return!0;const{x:n,y:o}=ne(e),s=i.elementFromPoint(n,o);if(!s)return!1;const r=t._laneViewportElement||t.canvas;return r===s||r.contains(s)}f.prototype.enableDragging=function(){const e=this,i={relativePos:null,isDoubleClick:!1,isArticleClick:!1,isArticleDoubleClick:!1,isTermsClick:!1,isHjsClick:!1,article:null,lastClick:{time:0,targetType:null,articleId:null,relativePos:null}},n={initial:{distance:0,zoom:0},centre:{},scale:1,prevActualZoom:0},o=2,s=5,r=500;function a(b,v,S=o){return Math.abs(b.left-v.left)<=S&&Math.abs(b.top-v.top)<=S}function l(b){const v=Hr(e.canvas);return{x:b.x-v.left,y:b.y-v.top}}function c(){i.relativePos=null,i.isDoubleClick=!1,i.isArticleClick=!1,i.isArticleDoubleClick=!1,i.isTermsClick=!1,i.isHjsClick=!1,i.article=null}function h(){i.lastClick.time=0,i.lastClick.targetType=null,i.lastClick.articleId=null,i.lastClick.relativePos=null}function u(){return i.isHjsClick?"branding-hjs":i.isTermsClick?"branding-terms":i.isArticleClick&&i.article?"article":"timeline"}function m(b,v){const{lastClick:S}=i,M=u();return!S.time||b-S.time>=r||S.targetType!==M?!1:M==="article"?!!i.article&&S.articleId===i.article.id:M==="timeline"?!!S.relativePos&&a(S.relativePos,v,s):!1}function d(b){i.lastClick.time=Date.now(),i.lastClick.targetType=u(),i.lastClick.articleId=i.article?i.article.id:null,i.lastClick.relativePos=b?W({},b):null}function g(b,v){if(Yr(),v.list.length>=2){c(),h(),e.isPinching||(n.centre=l(Vn(v)),n.initial.distance=Zn(v),n.initial.zoom=e.timescaleManager.zoom,e.isPinching=!0,n.prevActualZoom=n.initial.zoom,e.startAnimation(),e.trigger("zoom-pinch-start",Ii({centre:n.centre,scale:1,distance:n.initial.distance,zoom:n.initial.zoom,zoomDelta:0,totalZoomDelta:0,pointers:[...v.list]}),b));return}c();const S=i.relativePos=e.getRelativePosition(b);e.options.disableBranding||(i.isHjsClick=e._isInsideHistropediaJSLink(S),i.isTermsClick=e._isInsideTermsLink(S));let M=!1;if(!(i.isHjsClick||i.isTermsClick))for(let E=e.articles.length-1;E>=0;E--){const x=e.articles[E];if(x.isVisible&&x.isInside(S)){i.isArticleClick=!0,i.article=x,x.isActive&&e.options.article.draggable&&(M=!0);break}}const P=Date.now();if(i.isDoubleClick=m(P,S),i.isArticleDoubleClick=i.isArticleClick&&i.isDoubleClick,M){e.draggingArticle=i.article,i.article.startDragging(S,b);return}e.draggingArticle===null&&e.isInVicinity(b,e.options.draggingVicinity,S)&&e.startDragging(b)}function p(b,v){if(e.isPinching){const S=e.timescaleManager.zoomOptions.ratio,M=n.centre.x;n.centre=l(Vn(v));const P=Zn(v);n.scale=P/n.initial.distance;const E=Math.log(n.scale)/Math.log(S),x=n.initial.zoom+E,Z=M-n.centre.x;e.setZoomByPivotPixel(x,n.centre.x,Z);const R=e.timescaleManager.zoom,V=R-n.initial.zoom,B=R-n.prevActualZoom;n.prevActualZoom=R,e.trigger("zoom-pinch",Ii({centre:n.centre,scale:n.scale,distance:P,zoom:R,pointers:[...v.list],dx:Z,zoomDelta:B,totalZoomDelta:V}),b)}else if(e.isDragging)e.doDrag(b);else if(e.draggingArticle!==null){const S=e.getRelativePosition(b);e.draggingArticle.dragging(S,b)}else b.pointerType==="mouse"&&(e.updateMouseoverArticle(b),e.mouseoverArticle!==null&&e.trigger("article-pointermove",e.mouseoverArticle,b));e.options.enableCursor&&e.updateCursor(b)}function w(b,v){var x,Z,R;if(e.isPinching&&v.list.length<2){const V=v.list.length===1?Zr(v):null,B=n.scale||1,z=e.timescaleManager.zoom,it=z-n.initial.zoom,kt=z,ut=(n.initial.distance||0)*B;e.isPinching=!1,c(),e.trigger("zoom-pinch-end",Ii({centre:n.centre,scale:B,distance:ut,zoom:kt,zoomDelta:0,dx:0,totalZoomDelta:it,pointers:[...v.list]}),b),V?e.isDragging&&e.resetDragTracking(V):e.isDragging?(e.resetDragTracking(ne(b)),e.endDragging(b)):((x=e.settleDateBounds)==null||x.call(e),e.isPanning||(Z=e._flushTimelineStateChange)==null||Z.call(e));return}const S=e.getRelativePosition(b),M=b.type==="pointercancel"||b.type==="touchcancel";let P=!1;if(!M&&i.relativePos&&a(i.relativePos,S)){if(i.isHjsClick)wa();else if(i.isTermsClick)ba();else if(i.isArticleClick)e.select(i.article.id),i.article.clicked(i.relativePos),e.options.enableCursor&&(e.canvas.style.cursor=i.article.getCursor(S)),e.trigger("article-click",i.article,b),i.isArticleDoubleClick&&e.trigger("article-dblclick",i.article,b);else{const{left:V=0,top:B=0}=i.relativePos||{},z=Sa({viewport:{x:V,y:B}});e.trigger("timeline-click",z,b),i.isDoubleClick&&e.trigger("timeline-dblclick",z,b)}P=!0}P?d(i.relativePos):i.relativePos&&h(),c();const E=e.draggingArticle;E!==null?(E.stopDragging(b),e.draggingArticle=null,(R=e._flushTimelineStateChange)==null||R.call(e)):e.isDragging&&e.endDragging(b),e.redraw()}this._dragPointerTracker=new Vr(this.canvas,{onStart:g,onMove:p,onEnd:w})},f.prototype.startDragging=function(e){var n,o;(n=this.stopPanAnimation)==null||n.call(this),(o=this.stopZoomAnimation)==null||o.call(this),this.isDragging=!0;const i=ne(e);f.prototype.resetDragTracking.call(this,i),this.trigger("viewport-drag-start",Ai({startToken:this.timescaleManager.startToken,offsetX:this.repositionWindow}),e)},f.prototype.resetDragTracking=function(e){this.dragOrigin={left:e.x,top:e.y},this.dragStartX=e.x,this.dragStartY=e.y,this.dragMomentumSamples=[{time:Date.now(),x:e.x}],this.dragDateBoundsState=null;const i=we(this);if((i==null?void 0:i.overflow)==="elastic"){const n=At(this);if(!n)return;const o=Qn(this),s=Lt(o.start,o.end);let r=o.start;if(i.minPoint&&Ot(o.start,i.minPoint)<0){const a=Lt(o.start,i.minPoint);r=Tt(i.minPoint,-to(this,a))}else if(i.maxPoint&&Ot(o.end,i.maxPoint)>0){const a=Lt(i.maxPoint,o.end);r=Tt(i.maxPoint,to(this,a)-s)}this.dragDateBoundsState={leftDayPoint:r,pixelsPerDay:n,viewportSpanDays:s}}},f.prototype.endDragging=function(e){var o,s,r;this.isDragging=!1;const i=ne(e),n=this.dragOrigin.left-i.x;if(this.trackDragMomentumSample(i.x),this.trigger("viewport-drag-end",Ai({startToken:this.timescaleManager.startToken,offsetX:this.repositionWindow,totalDx:n}),e),(o=this.settleDateBounds)!=null&&o.call(this)){this.dragDateBoundsState=null,this.isPanning||(s=this._flushTimelineStateChange)==null||s.call(this);return}this.dragDateBoundsState=null,this.startDragMomentum(),this.isPanning||(r=this._flushTimelineStateChange)==null||r.call(this)},f.prototype.doDrag=function(e){var r;this.isPanning&&((r=this.stopPanAnimation)==null||r.call(this));const i=ne(e),n=this.dragStartX-i.x,o=this.dragOrigin.left-i.x,s=Math.abs(o);if(this.dragStartX=i.x,this.trackDragMomentumSample(i.x),this.isAnimating||this.startAnimation(),s>30&&(this.animation.dragRedrawFunction=this.defaultRedraw),this.dragDateBoundsState){const a=Tt(this.dragDateBoundsState.leftDayPoint,o/this.dragDateBoundsState.pixelsPerDay);ra(this,a,this.dragDateBoundsState.viewportSpanDays)}else this.updateFromByPixels(n);this.trigger("viewport-drag",Ai({startToken:this.timescaleManager.startToken,offsetX:this.repositionWindow,dx:n,totalDx:o}),e)},f.prototype.trackDragMomentumSample=function(e){var a;const i=Date.now(),n=((a=this.options.pan)==null?void 0:a.momentum)||{},o=le(n.sampleWindow,ao),s=this.dragMomentumSamples||[],r=i-o;for(;s.length>0&&s[0].time<r;)s.shift();s.push({time:i,x:e}),this.dragMomentumSamples=s},f.prototype.startDragMomentum=function(){var p,w,b;const e=((p=this.options.pan)==null?void 0:p.momentum)||{};if(e.active!==!0){this.dragMomentumSamples=[];return}const i=le(e.sampleWindow,ao),n=Date.now()-i,o=(this.dragMomentumSamples||[]).filter(v=>v.time>=n);if(this.dragMomentumSamples=[],o.length<2||this.isPinching||this.draggingArticle!==null)return;const s=o[0],r=o[o.length-1],a=r.time-s.time;if(a<=0)return;const l=(s.x-r.x)/a,c=le(e.minVelocity,La);if(Math.abs(l)<c)return;this.isPanning&&((w=this.animation.pan)!=null&&w.stop)&&this.animation.pan.stop(),(b=this.stopZoomAnimation)==null||b.call(this);const h=le(e.friction,Aa),u=le(e.stopVelocity,_a),m=le(e.maxDuration,Ia);if(!Number.isFinite(l)||!Number.isFinite(h))return;this.isPanning=!0,this.startAnimation();const d=this,g=Qr({velocity:l,friction:h,minVelocity:u,maxDuration:m,shouldStop(){return d.isDragging||d.isPinching?(d.isPanning=!1,!0):!1},onUpdate(v){var S;d.updateFromByPixels(v),d.requestRedraw(),aa(d)&&(d.isPanning=!1,d.animation.pan===g&&(d.animation.pan=null),g.stop(),(S=d.settleDateBounds)==null||S.call(d))},onComplete(){var v;d.isPanning=!1,d.animation.pan===g&&(d.animation.pan=null),(v=d.settleDateBounds)==null||v.call(d)}});this.animation.pan=g},f.prototype.updateFromByPixels=function(t,e={}){var o;this.repositionWindow-=t;let i=this.timescaleManager.startToken,n=this.timescaleManager.getPrevious(i);for(;this.repositionWindow>=n.length;)this.repositionWindow-=n.length,i=n,n=this.timescaleManager.getPrevious(i);for(;-this.repositionWindow>=i.length;)this.repositionWindow+=i.length,i=this.timescaleManager.getNext(i);this.timescaleManager.setStartToken(i),(o=this._markTimelineStateChanged)==null||o.call(this),!(e.skipDateBounds||!we(this))&&Et(this,{mode:this.isDragging||this.isPinching?"elastic":"clamp"})},f.prototype.updateMouseoverArticle=function(t,e=this.articles){const i=this.mouseoverArticle;let n=null;if(Ma(this,t)){const o=this.getRelativePosition(t);for(let s=e.length-1;s>=0;s--){const r=e[s];if(r.isVisible&&r.isInside(o)){n=r;break}}}this.mouseoverArticle=n,i!==n&&(i!==null&&i.pointerLeave(t),n!==null&&n.pointerEnter(t),this.requestRedraw(this.redraw))},f.prototype.load=function(t){this.addArticles(t),this.updateCurrentDensitySetting(),this.updateArticlesGroupIndex(),this.requestRedraw()},f.prototype.addArticles=function(t,e,i){if(t.length===0){i&&i.call(this);return}const n=this.articles.map(function(s){return s.id}),o=[];for(let s=0;s<t.length;s++){const r=t[s];n.indexOf(_(r,"id"))===-1&&(o.push(r),this._createImplicitLane(this._resolveLaneIdFromArticleData(r)))}this._updateLaneLayout();for(let s=0;s<o.length;s++){const r=new I(this,_(o[s],"id"));this.articles.push(r),r.setupByReceivedData(o[s]),r.registerPosition(this.getOriginalPosition(r))}this._refreshLaneOrder(),this.updateIsActiveStatus(),i&&i.call(this)},f.prototype.getDmyFromInput=function(t){var i,n,o;let e;if(typeof t=="string"){if(e=y.fromString(t),!Number.isFinite(e.year))throw new Error(`Invalid Histropedia date string: ${t}`)}else t instanceof y?e=new y(t):e=new y({precision:t.precision,year:t.year,month:(i=t.month)!=null?i:1,day:(n=t.day)!=null?n:1,hour:t.hour,minute:t.minute,second:t.second,millisecond:t.millisecond});return(o=this.options)!=null&&o.shiftBceDates&&e.year<0&&(e.year+=1),e},f.prototype.getActiveArticle=function(){for(let t=this.articles.length-1;t>=0;t--)if(this.articles[t].isActive)return this.articles[t];return null},f.prototype.getArticleById=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];if(i.id===t)return i}},f.prototype.bringFront=function(t){const e=lo(this.articles,t);e>=0&&br(this.articles,e,this.articles.length-1)},f.prototype.select=function(t){this.bringFront(t);const e=this.getActiveArticle();this.updateIsActiveStatus();const i=this.getActiveArticle();i!==e&&i&&this.trigger("article-select",i),this._emitTimelineStateChange()},f.prototype.activated=function(t){this.select(t.id)},f.prototype.updateIsActiveStatus=function(){for(let t=0;t<this.articles.length;t++)this.articles[t].isActive=!1;for(let t=this.articles.length-1;t>=0;t--)if(this.articles[t].isDataLoaded){this.articles[t].isActive=!0;return}},f.prototype.getVisibleArticlesClone=function(){const t=[];for(let e=0;e<this.articles.length;e++){const i=this.articles[e];i.isVisible&&i.isDataLoaded&&t.push(i)}return t},f.prototype.hasArticle=function(t){let e;for(let i=0;i<this.articles.length;i++)this.articles[i].id===t&&(e=this.articles[i]);return!De(e)},f.prototype.reposition=function(t,e){if(t.isDragging)return;const i=this.getOriginalPosition(t,e);t.registeredPosition=i;const n=t.finalOffset;if(!this.options.article.animation.move.active){t.position={left:i.left+n.left,top:i.top+n.top},t.offset={left:n.left,top:n.top};return}t.moveAnimation.finalOffset.top!==n.top||t.moveAnimation.finalOffset.left!==n.left?t.moveToOffsetWithAnim(n,!0):t.position={left:i.left+t.offset.left,top:i.top+t.offset.top}},f.prototype.getOriginalPosition=function(t,e){let i=this.getPixel(t.period.from,e);if(this.options.article.collectOngoing){const s=this.getPixel(t.period.to,e),r=isNaN(i)||i<0,a=isNaN(s)||s>0;r&&a&&(i=0)}const n=t.getCurrentStyle(),o=this.getLaneById(t.laneId);return this._isLaneLayoutActive()&&o&&o.geometry?{left:i-n.connectorLine.offsetX,top:o.geometry.bodyContentBottom-this._getLaneDistanceToBaseline(o)}:{left:i-n.connectorLine.offsetX,top:this.top-this._getTimelineDistanceToBaseline()}},f.prototype.reorderArticles=function(t){const e=[];for(let o=0;o<t.length;o++){const s=lo(this.articles,t[o]);e.push(this.articles[s])}const i=this.getActiveArticle();this.articles=e,this.updateIsActiveStatus();const n=this.getActiveArticle();n!==i&&n&&this.trigger("article-select",n)},f.prototype.getSortedByYearClone=function(){},f.prototype.removeArticleById=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];if(i.id===t){if(typeof i._imageCancel=="function")try{i._imageCancel()}catch(n){}if(typeof i._closeImage=="function")try{i._closeImage({skipRedraw:!0})}catch(n){}i._pendingImageKey=null,this.articles.splice(e,1),this._emitTimelineStateChange();break}}},f.prototype.deleteCurrentArticle=function(){if(this.articles.length!==0){this.removeById(this.articles,this.getActiveArticle().id),this.requestRedraw();for(let t=this.articles.length-1;t>=0;t--){const e=this.articles[t];if(e.isVisible){this.select(e.id),this.requestRedraw();return}}}},f.prototype.pp=function(t){let e="";for(let i=0;i<this.articles.length;i++)e+=`${this.articles[i].title.split(" ")[0]},`;t=t||"",T.log(`${t}:${e}`)};function lo(t,e){return t.findIndex(i=>i.id===e)}Dt.prototype.draw=function(t,e){t.globalAlpha=1;const i=e.left,n=e.right,o=e.top,s=e.height,r=Math.max(0,n-i);if(r<=0)return;const a=this.style||{};t.fillStyle=a.backgroundColor||"rgba(200,200,200,0.25)",t.fillRect(i,o,r,s);const l=a.border||null;l&&l.width&&(t.lineWidth=l.width,t.strokeStyle=l.color||"rgba(120,120,120,0.6)",t.strokeRect(i+.5,o+.5,r-1,s-1));const c=a.text||{},h=c.margin||6,u=Math.max(0,r-h*2);if(u>2){t.font=c.font||"500 12px Calibri",t.textAlign=c.align||"center",t.textBaseline=c.baseline||"middle",t.fillStyle=c.color||"#222";const m=this.title||"",d=t.measureText(m).width;let g=m;if(d>u){const v=t.measureText.bind(t);let S=0,M=m.length,P=0;const x=v("…").width,Z=Math.max(0,u-x);for(;S<=M;){const R=Math.floor((S+M)/2),V=m.substring(0,R);v(V).width<=Z?(P=R,S=R+1):M=R-1}g=P>0?`${m.substring(0,P)}…`:""}const p=c.align==="left"?i+h:c.align==="right"?n-h:Math.floor((i+n)/2);let w;switch(c.verticalAlign||"middle"){case"top":w=o+(c.margin||0);break;case"bottom":w=o+s-(c.margin||0);break;default:w=o+Math.floor(s/2);break}w+=c.offsetY||0,t.fillText(g,p,w)}};function co(t){t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor="transparent black"}function ho(t,e,i,n,o,s){t.moveTo(e+s,i),t.lineTo(e+n-s,i),s>0&&t.quadraticCurveTo(e+n,i,e+n,i+s),t.lineTo(e+n,i+o),t.lineTo(e,i+o),t.lineTo(e,i+s),s>0&&t.quadraticCurveTo(e,i,e+s,i),s===0&&t.closePath()}function Ve(t,e,i,n,o,s){t.beginPath(),t.moveTo(e+s,i),t.lineTo(e+n-s,i),t.arcTo(e+n,i,e+n,i+s,s),t.lineTo(e+n,i+o-s),t.arcTo(e+n,i+o,e+n-s,i+o,s),t.lineTo(e+s,i+o),t.arcTo(e,i+o,e,i+o-s,s),t.lineTo(e,i+s),t.arcTo(e,i,e+s,i,s),t.closePath()}function uo(t,e,i,n,o,s,r,a){t.beginPath();const l=Math.PI/n;for(let c=0;c<2*n;c++){const h=(c&1)===0?s:o,u=e+Math.cos(1+c*l)*h,m=i+Math.sin(1+c*l)*h;c===0?t.moveTo(u,m):t.lineTo(u,m)}t.closePath(),t.lineWidth=1,t.strokeStyle=a,t.fillStyle=r,t.stroke(),t.fill()}function fo(t,e,i,n,o){let s;switch(i){case"left":s=t+n;break;case"center":s=t+e/2;break;case"right":s=t+e-n;break;default:s=t+n}return typeof o=="function"?o(s):i==="center"?t+Math.floor(e/2):s}function mo(t,e,i,n,o,s,r,a,l){const c=l/2;t.save(),t.beginPath(),t.arc(r+c,a+c,c,0,Math.PI*2,!1),t.closePath(),t.clip(),t.drawImage(e,i,n,o,s,r,a,l,l),t.restore()}function Ze(t,e,i){const n=t.split(" "),o=[];let s=n[0];for(let r=1;r<n.length;r++){const a=n[r];e.measureText(`${s} ${a}`).width<i?s+=` ${a}`:(o.push(s),s=a)}return o.push(s),o}function Mi(t,e,i,n="…"){if(!t||typeof t.measureText!="function")throw new Error("Invalid canvas context provided");if(typeof e!="string"||e===""||typeof i!="number"||i<=0)return"";if(typeof n!="string"&&(n="…"),t.measureText(e).width<=i)return e;const s=t.measureText(n).width;if(s>=i)return"";const r=i-s;if(r<=0)return"";let a=0,l=e.length,c=0;for(;a<=l;){const h=Math.floor((a+l)/2),u=e.substring(0,h);t.measureText(u).width<=r?(c=h,a=h+1):l=h-1}return c===0?"":e.substring(0,c)+n}function Ue(t,e,i=null,n=null){if(!Array.isArray(t)||t.length===0)return t;if(typeof e!="number"||e<=0)return[];const o=t.length>e,s=o?t.slice(0,e):[...t];if(s.length>0){const r=s.length-1,a=s[r];if(i&&typeof n=="number"&&n>0)if(o){const l=Mi(i,a,n);s[r]=l,l===a&&(s[r]=Mi(i,`${a}…`,n,"…"))}else s[r]=Mi(i,a,n);else o&&(s[r]+="...")}return s}const go={up:0,down:0};function Ci(t,e={}){const{anchorY:i=0,canvasHeight:n=0,fallbackArea:o=go}=e,s=Number.isFinite(i)?i:0,r=Number.isFinite(n)?n:0,a=typeof(o==null?void 0:o.up)=="number"&&Number.isFinite(o.up)?Math.max(0,o.up):0,l=typeof(o==null?void 0:o.down)=="number"&&Number.isFinite(o.down)?Math.max(0,o.down):0,c=t||o||go,h=!!t,u=typeof c.up=="undefined"?h?0:a:c.up,m=typeof c.down=="undefined"?h?0:l:c.down,d=(w,b)=>{if(typeof b=="number")return Number.isFinite(b)?Math.max(0,b):0;const v=typeof b=="object"&&b!==null&&b.value==="edge";if(b==="edge"||v){const S=v?b.padding:0,M=typeof S=="number"&&Number.isFinite(S)?Math.max(0,S):0,P=w==="up"?Math.max(0,s):Math.max(0,r-s);return Math.max(0,P-M)}return 0},g=d("up",u),p=d("down",m);return{up:g,down:p,height:g+p}}const po=150;f.prototype.defaultRedraw=function(){this.redraw({onArticlesInRangeIsReady:function(e){this.updateVisibleArticlesOfGroups(e),this.forInRangeArticles(function(n){this.reposition(n,e)}),this.stack(e)},onArticlesVisiblityIsReady:function(e){this.updateArticleLines()}})},f.prototype.repositionRedraw=function(){this.redraw({onArticlesInRangeIsReady:function(e){this.updateVisibleArticlesOfGroups(e),this.forInRangeArticles(function(n){this.reposition(n,e)})},onArticlesVisiblityIsReady:function(e){this.updateArticleLines()}})},f.prototype.redraw=function(t){if(this.redrawInProgress)return;this.redrawInProgress=!0;const e=this.topRow;t=t||{};const i=this.canvasContext,n=this.getWidth(),o=this.top;this.trigger("timeline-render-start",{canvasContext:i,top:o});const s={},r=this.getTokensAndMarkers(n),a=r.markers,l=r.tokens;s.tokens=l,s.markers=a,this._updateLaneLayout(),this._refreshAdaptiveArticleRuntimeOptions(),this._syncLaneDom(),this.invoke("onMainRangeIsReady",t,s),this.forLoadedArticles(function(h){h.isInView=h.overlapsInclusiveWithDates(s.tokens.start,s.tokens.end),gi(this.options.article.autoStacking.range)?h.isInRange=h.isInView:h.isInRange=!0,h.isVisibleInLane=this._isArticleLaneVisible(h),h.isInRange&&(h.isHiddenByFilter=h.hiddenByFilter)}),this.invoke("onArticlesInRangeIsReady",t,s),this.forLoadedArticles(function(h){h.updateVisibility()}),this.forVisibleArticles(function(h){this.enqueueImageLoad(h)}),this.invoke("onArticlesVisiblityIsReady",t,s),this.forInRangeArticles(function(h){h.indicator={fromX:Math.max(-3,Math.round(this.getPixel(h.period.from,s))),toX:Math.min(this.options.width,Math.round(this.getPixel(h.period.to,s)))},h.indicator.toX-h.indicator.fromX<2&&(h.indicator.toX=h.indicator.fromX+2)}),!this._isLaneLayoutActive()&&this.options.article.autoStacking.fitToHeight&&e!==this.topRow&&this.fitToHeight(!0),this.render(i,o,n,a,s),this.redrawInProgress=!1,this.trigger("timeline-render-end",{canvasContext:i,drawCycleContext:s,top:o})},f.prototype.render=function(t,e,i,n,o){const s=this._getEffectiveVerticalOffset?this._getEffectiveVerticalOffset():this.options.verticalOffset;this.owner||t.clearRect(0,0,i,this.top+s),this.drawTimeBands(t,e,i,o),typeof this.drawCharts=="function"&&this.drawCharts(t,e,i,o),this.drawDraggingHighlight(t,e,i);const r=this.options.style.mainLine.position==="top"?-s:e;this.drawMainline(t,r,i,n),this.drawDateIndicators(t,r),t.globalAlpha=1;for(let l=0;l<this.articles.length;l++){const c=this.articles[l];c.isDataLoaded&&c.isVisible&&!c.isActive&&c.drawPeriodLinesAndConnectors(t,e)}for(let l=0;l<this.articles.length;l++){const c=this.articles[l];c.isDataLoaded&&c.isVisible&&!c.isActive&&c.draw(t)}const a=this.getActiveArticle();a&&a.isVisible&&(a.drawPeriodLinesAndConnectors(t,e),a.draw(t)),this.options.disableBranding||(t.globalAlpha=1,this._drawBranding(t)),this.drawDebugOverlays(t,i,o)},f.prototype.drawDebugOverlays=function(t,e,i){var n;(n=this.options.debugOverlays)!=null&&n.densityRegions&&this.drawDensityRegionBoundaries(t,e,i)};function Ca(t,e,i,n){var o,s,r;return i!=="article"?i:n?((o=e.activeStyle)==null?void 0:o.color)||((s=e.style)==null?void 0:s.color)||t.options.article.defaultStyle.color:((r=e.style)==null?void 0:r.color)||t.options.article.defaultStyle.color}f.prototype.drawDateIndicators=function(t,e){const i=this.options.style.mainLine.dateIndicators;if(!i.visible)return;const n=this.options.style.mainLine.size,o=n/2;t.save(),t.globalAlpha=1,this.forInRangeArticles(function(r){var p;if(r.isHiddenByFilter||!r.isInView)return;const a=r.isActive===!0,l=!a&&r.isVisibleInLane!==!1&&r.isVisibleInGroup===!1,c=a?i.activeStyle:l?i.hiddenStyle:null,h=c?W(W({},i),c):i,u=h.size,m=u/2,d=r.indicator.fromX,g=a&&(c==null?void 0:c.color)==="article";if(t.globalAlpha=(p=h.opacity)!=null?p:1,t.fillStyle=Ca(this,r,h.color,g),h.shape==="circle"){t.beginPath(),t.arc(d,e,m,0,Math.PI*2),t.fill();return}t.fillRect(d-m,e-o,u,n)}),t.restore()},f.prototype.getDensityRegionBoundaryDate=function(t){if(oe(t))return Si(t.day);const e=this.currentDensitySetting.step;if(this.timescaleManager.unit>=$&&e.months!==0){const c=t*e.months,h=Math.floor(c/12),u=c-h*12+1;return new y(h,u,1)}const i=e.days===0?e.months*30:e.days,n=t*i;let o=Math.floor((n-1)/372);const s=n-o*372;let r=Math.floor((s-1)/31)+1;const a=(s-1)%31+1,l=new y(o,r,a);return l.day!==a?(r++,r>12&&(r=1,o++),new y(o,r,1)):l},f.prototype.getDensityRegionBoundaryPoint=function(t){if(oe(t)){const e=Gr(t);return{date:Si(e.dayNumber),dayFraction:e.dayFraction}}return{date:this.getDensityRegionBoundaryDate(t),dayFraction:0}},f.prototype.drawDensityRegionBoundaries=function(t,e,i){var h;const n=i==null?void 0:i.tokens;if(!(n!=null&&n.start)||!(n!=null&&n.end)||!((h=this.currentDensitySetting)!=null&&h.step))return;const o=St(this.calculateGroupIndex(n.start),-1),s=St(this.calculateGroupIndex(n.end),1),r=this.timescaleManager.startToken.value,a=At(this),l=this.options.height;let c=null;t.save(),t.beginPath(),t.globalAlpha=1,t.lineWidth=1,t.strokeStyle="rgba(204, 0, 153, 0.8)",t.setLineDash([4,4]);for(let u=o;se(u,s)<=0;u=St(u,1)){const m=this.getDensityRegionBoundaryPoint(u),d=this.timescaleManager.getPixelsBetween(r,m.date)+m.dayFraction*a+this.repositionWindow,g=Math.round(d)+.5;g<0||g>e||g===c||(t.moveTo(g,0),t.lineTo(g,l),c=g)}t.stroke(),t.restore()},f.prototype.drawMainline=function(t,e,i,n){if(this.options.style.mainLine.visible){t.globalAlpha=1;const o=this.options.style.mainLine.size>>1,s=this.options.style.mainLine.color;let r=typeof s=="string"?s:On;(s==null?void 0:s.type)==="gradient"&&typeof s.topColor=="string"&&typeof s.bottomColor=="string"&&(r=t.createLinearGradient(0,e-o,0,e+o),r.addColorStop(0,s.topColor),r.addColorStop(1,s.bottomColor)),t.beginPath(),t.lineWidth=this.options.style.mainLine.size,t.strokeStyle=t.fillStyle=r,t.moveTo(0,e),t.lineTo(i,e),t.stroke();for(const a in n)this.drawMarkersAndLabels(t,n[a],a,e+o,{minorTokens:n[k],viewportWidth:i});this.drawParentDateLabels(t,e+o,i)}},f.prototype.drawDraggingHighlight=function(t,e,i){if(!this.isDragging)return;const n=this.options.style.draggingHighlight||{};if(!n.visible)return;t.fillStyle=n.color;const o=this.top,s=this.options.height,r={up:0,down:60},{up:a,height:l}=Ci(n.area,{anchorY:o,canvasHeight:s,fallbackArea:r});l<=0||t.fillRect(0,o-a,i,l)},f.prototype.drawTimeBands=function(t,e,i,n){const o=this.options.timeBand||{};if(!o.visible||!this.timeBands||this.timeBands.length===0)return;const s=n||{tokens:this.getTokensAndMarkers(i).tokens},r=this._getVisibleTimeBands(s);if(r.length===0)return;const a=this.top,l=this.options.height,c={up:0,down:40},{up:h,height:u}=Ci(o.area,{anchorY:a,canvasHeight:l,fallbackArea:c});if(u<=0)return;const m=a-h;t.save();for(let d=0;d<r.length;d++){const g=r[d];let p=Math.round(this.getPixel(g.period.from,s)),w=Math.round(this.getPixel(g.period.to,s));w<0||p>i||(p=Math.max(0,p),w=Math.min(i,w),!(w-p<=0)&&g.draw(t,{left:p,right:w,top:m,height:u}))}t.restore()},f.prototype.getTokensAndMarkers=function(t){var c,h;const e={},i={};i[F]=[],i[k]=[];const n=(h=(c=this.timescaleManager).getSubdayVisualMarkerLayout)==null?void 0:h.call(c);let o=this.repositionWindow,s=this.timescaleManager.startToken;e.start=s.value;const r=9;let a=0,l=s.type===F&&o<=0;for(;a<r||!l;)s=this.timescaleManager.getPrevious(s),o-=s.length,a++,s.type===F&&o<=0&&(l=!0);do s.drawX=o,e[s.value.toKeyString()]=o,n||i[s.type].push(s),o+=s.length,s=this.timescaleManager.getNext(s);while(o<t+po);if(n){const u=this.timescaleManager.createSubdayVisualMarkers(t,this.repositionWindow,n);i[F]=u[F],i[k]=u[k]}return e.end=this.getPivotPoint(t+po).date,{tokens:e,markers:i}};function Ge(t,e,i){var a;const n=t.measureText(e.label).width,o=Number.isFinite((a=i.offset)==null?void 0:a.x)?i.offset.x:0;let r=Math.round(e.drawX)+o;return i.textAlign==="center"?r-=n/2:(i.textAlign==="right"||i.textAlign==="end")&&(r-=n),{left:r,width:n}}function yo(t,e,i){return i==="center"?t+e/2:i==="right"||i==="end"?t+e:t}function Da(t,e){var i;return(t==null?void 0:t.enabled)===!0?!0:(t==null?void 0:t.enabled)!=="auto"?!1:Number.isFinite((i=e[0])==null?void 0:i.unit)&&e[0].unit<=$}const Di=8;function Ta(t,e,i,n){var h;if(((h=i.sticky)==null?void 0:h.enabled)!==!0||!Number.isFinite(n))return null;const o=Number.isFinite(i.sticky.offsetX)?i.sticky.offsetX:0;let s=-1,r;for(let u=0;u<e.length;u++){const m=Ge(t,e[u],i);m.left<=o&&(s=u,r=m)}if(s<0)return null;const a=e[s],l=e[s+1];if(a.drawX>n||!l&&a.drawX+a.length<0)return null;let c=o;if(l){const u=Ge(t,l,i);c=Math.min(c,u.left-r.width-Di)}return{token:a,labelX:yo(c,r.width,i.textAlign)}}function Pa(t,e,i,n){const o=i.sticky,s=n.minorTokens||[],r=n.viewportWidth;if(!Da(o,e)||!Number.isFinite(r))return null;const a=Number.isFinite(o.offsetX)?o.offsetX:0;let l=-1,c;for(let g=0;g<e.length;g++){const p=Ge(t,e[g],i);p.left<=a&&(l=g,c=p)}if(l<0)return null;const h=e[l],u=e[l+1];if(!(h.drawX<=r&&(u?u.drawX>=0:h.visual===!0&&h.drawX+h.length>=0||s.some(g=>g.drawX>=0&&g.drawX<=r&&g.drawX>h.drawX))))return null;let d=a;if(u){const g=Ge(t,u,i);d=Math.min(d,g.left-c.width-Di)}return{token:h,labelX:yo(d,c.width,i.textAlign)}}f.prototype.drawParentDateLabels=function(t,e,i){const n=this.options.style.dateLabel.parent;if(!this.timescaleManager.isParentContextTextVisible(n))return;const o=this.getPivotPoint(0).date,s=this.timescaleManager.createParentContextTokens(o,i,this.repositionWindow);if(s.length===0)return;const r=this.options.style.mainLine.position==="top"?-1:1,a=this.options.style.dateLabel.major,l=this.options.style.marker.major.height,c=e+l*r+a.offset.y+n.height*r+n.offset.y;t.font=n.font,t.textAlign=n.textAlign,t.textBaseline=r===1?"alphabetic":"top";const h=Ta(t,s,n,i);let u=Number.NEGATIVE_INFINITY;for(let m=0;m<s.length;m++){const d=s[m],g=(h==null?void 0:h.token)===d?h.labelX:Math.round(d.drawX)+n.offset.x,p=t.measureText(d.label).width;let w=g;n.textAlign==="center"?w-=p/2:(n.textAlign==="right"||n.textAlign==="end")&&(w-=p),!((h==null?void 0:h.token)!==d&&w<u+Di)&&(t.fillStyle=d.value.isInFuture()?n.futureColor:n.color,t.fillText(d.label,g,c),u=w+p)}},f.prototype.drawMarkersAndLabels=function(t,e,i,n,o={}){if(e.length===0)return;switch(i){case JSON.stringify(k):i="minor";break;case JSON.stringify(F):i="major";break;default:T.log("token type not recognised",i,k)}const s=this.options.style.marker[i],r=s.extend,a=this.options.style.mainLine.position==="top"?-1:1,l=s.height,c=e.some(p=>p.label);let h=e[0].value.isInFuture(),u=!h,m,d;a===-1&&(n-=this.options.style.mainLine.size),c&&(m=this.options.style.dateLabel[i],t.font=m.font,t.textAlign=m.textAlign,t.textBaseline=a===1?"alphabetic":"top",d=n+l*a+m.offset.y);const g=c&&i==="major"?Pa(t,e,m,o):null;t.beginPath();for(let p=0;p<e.length;p++){const w=e[p];h=w.value.isInFuture(),u&&h&&(u=!1,t.strokeStyle=s.color,t.lineWidth=1,t.stroke(),t.beginPath());const b=Math.round(w.drawX);t.moveTo(b,n+l*a);const v=r?n+-1*a*this.top:n;if(t.lineTo(b,v),c&&w.label){const S=(g==null?void 0:g.token)===w?g.labelX:b+m.offset.x;t.fillStyle=h?m.futureColor:m.color,t.fillText(w.label,S,d)}}t.strokeStyle=h?s.futureColor:s.color,t.lineWidth=1,t.stroke()},f.prototype.loadTimeBands=function(t){this.addTimeBands(t),typeof this._getEffectiveVerticalOffset=="function"&&(this.top=this.options.height-this._getEffectiveVerticalOffset()),this.requestRedraw()},f.prototype.addTimeBands=function(t){if(!Array.isArray(t)||t.length===0)return;const e=this.timeBands.map(o=>o.id),i=t.filter(o=>e.indexOf(o.id)===-1),n=this.options.timeBand&&this.options.timeBand.defaultStyle||{};for(let o=0;o<i.length;o++){const s=i[o],r=new Dt(this,s.id);r.setupByReceivedData(s),r.style=L({},n,s.style||{}),this.timeBands.push(r)}typeof this._getEffectiveVerticalOffset=="function"&&(this.top=this.options.height-this._getEffectiveVerticalOffset())},f.prototype._getVisibleTimeBands=function(t){if(!this.timeBands||this.timeBands.length===0)return[];const e=t.tokens.start,i=t.tokens.end;return this.timeBands.filter(n=>n.isDataLoaded&&n.visibility!=="hidden"&&n.overlapsInclusiveWithDates(e,i))};function Ti(t,e){return e&&e.resolvedArticleOptions?e.resolvedArticleOptions:Rn(t.options.article||{})}f.prototype._getResolvedArticleOptions=function(t){const e=t&&t.laneId!=null?t.laneId:this._resolveLaneIdFromArticleData(t),i=this.getLaneById(e);return Ti(this,i)},f.prototype._getResolvedArticleStyleOverrides=function(t,e){var h,u,m;const i=t&&t.laneId!=null?t.laneId:this._resolveLaneIdFromArticleData(t),n=this.getLaneById(i),o=En.article||{},s=((h=this._registeredArticleLayoutStyles)==null?void 0:h[e])||{},r=this._explicitArticleOptions||{},a=((u=r.layoutStyles)==null?void 0:u[e])||{},l=(n==null?void 0:n.articleOptions)||{},c=((m=l.layoutStyles)==null?void 0:m[e])||{};return{style:L({},o.defaultStyle||{},s.style||{},r.defaultStyle||{},a.style||{},l.defaultStyle||{},c.style||{}),hoverStyle:L({},o.defaultHoverStyle||{},s.hoverStyle||{},r.defaultHoverStyle||{},a.hoverStyle||{},l.defaultHoverStyle||{},c.hoverStyle||{}),activeStyle:L({},o.defaultActiveStyle||{},s.activeStyle||{},r.defaultActiveStyle||{},a.activeStyle||{},l.defaultActiveStyle||{},c.activeStyle||{})}},f.prototype._getExplicitArticleCardLayout=function(t){if(!t)return null;if(typeof t.cardLayout=="string"&&t.cardLayout!=="")return t.cardLayout;const e=t.data||t,i=_(e,"cardLayout");return typeof i=="string"&&i!==""?i:null},f.prototype._getResolvedArticleTopGap=function(t=this.options.article||{}){const e=t.autoStacking||{};let i=Number(ie(e.topGap,this))||0;return this.options.style.mainLine.position==="top"&&(i-=this.options.verticalOffset),i},f.prototype._getTimelineArticleAvailableHeight=function(){return Math.max(0,this.top-this._getResolvedArticleTopGap())},f.prototype._getLaneArticleAvailableHeight=function(t){return!t||!t.geometry?0:Math.max(0,t.geometry.bodyContentBottom-t.geometry.bodyContentTop)},f.prototype._getAvailableHeightForArticle=function(t){const e=t&&t.laneId!=null?t.laneId:this._resolveLaneIdFromArticleData(t);return this._isLaneLayoutActive()?this._getLaneArticleAvailableHeight(this.getLaneById(e)):this._getTimelineArticleAvailableHeight()},f.prototype._resolveCardLayoutFromBreakpoints=function(t){var i;const e=Array.isArray((i=this.options.article)==null?void 0:i.cardLayoutBreakpoints)?this.options.article.cardLayoutBreakpoints:[];for(let n=0;n<e.length;n++){const o=e[n];if(!(!o||!Number.isFinite(o.maxHeight)||typeof o.layout!="string"||o.layout==="")&&t<=o.maxHeight)return o.layout}return null},f.prototype._resolveDefaultCardLayoutName=function(t){const e=this._getResolvedArticleOptions(t),i=this._resolveCardLayoutFromBreakpoints(this._getAvailableHeightForArticle(t));if(i)return i;const n=e.defaultCardLayout;return typeof n=="string"&&n!==""?n:"portrait"},f.prototype._resolveArticleCardLayoutName=function(t){return this._getExplicitArticleCardLayout(t)||this._resolveDefaultCardLayoutName(t)},f.prototype._getTimelineDistanceToBaseline=function(){var e,i;if(Number.isFinite((e=this._runtimeArticleOptions)==null?void 0:e.distanceToBaseline))return this._runtimeArticleOptions.distanceToBaseline;const t=this._resolveDefaultCardLayoutName();return Re((i=this.options.article)==null?void 0:i.distanceToBaseline,this._getTimelineArticleAvailableHeight(),!1,t)},f.prototype._getLaneAutoStackingOptions=function(t){return Ti(this,t).autoStacking||{}},f.prototype._getLaneDistanceToBaseline=function(t){var n;if(!this._isLaneLayoutActive())return this._getTimelineDistanceToBaseline();if(Number.isFinite((n=t==null?void 0:t._runtimeArticleOptions)==null?void 0:n.distanceToBaseline))return t._runtimeArticleOptions.distanceToBaseline;const e=Ti(this,t),i=this._resolveDefaultCardLayoutName({laneId:t==null?void 0:t.id});return Re(e.distanceToBaseline,this._getLaneArticleAvailableHeight(t),!0,i)},f.prototype._refreshAdaptiveArticleRuntimeOptions=function(){var n,o;const t=this._isLaneLayoutActive(),e=this._getTimelineArticleAvailableHeight(),i=this._resolveDefaultCardLayoutName();this._runtimeArticleOptions={availableHeight:e,defaultCardLayout:i,distanceToBaseline:Re((n=this.options.article)==null?void 0:n.distanceToBaseline,e,!1,i)};for(let s=0;s<this.lanes.length;s++){const r=this.lanes[s],a=t&&r.geometry?this._getLaneArticleAvailableHeight(r):0,l=(o=r==null?void 0:r.resolvedArticleOptions)==null?void 0:o.distanceToBaseline,c=this._resolveDefaultCardLayoutName({laneId:r==null?void 0:r.id});r._runtimeArticleOptions={availableHeight:a,defaultCardLayout:c,distanceToBaseline:Re(l,a,t,c)}}this.forLoadedArticles(s=>{const r=this._resolveDefaultCardLayoutName(s),a=this._resolveArticleCardLayoutName(s);if(s._resolvedCardLayoutName!==a){s.initialiseStyles(s.data),s.invalidateCaches();return}s._resolvedDefaultCardLayout=r,s._resolvedCardLayoutName=a})};function Nt(...t){return t.filter(Boolean).join(" ")}function Pt(t){return`${Math.round(t||0)}px`}function wo(t,e){const i=e===t.length-1,n=e===0,o=["histropedia-lane",`histropedia-lane-index-${e}`];return i&&o.push("histropedia-lane-position-top"),n&&o.push("histropedia-lane-position-bottom"),!i&&!n&&o.push("histropedia-lane-position-middle"),o}function ka(t){switch(t){case"center":return"center";case"right":return"flex-end";default:return"flex-start"}}function xt(t,e){return A(t||{},e)?_(t,e):void 0}function bo(t,e,i){return e?{visible:!1,rootClassName:Nt(...wo(t.lanes,i),t.options.lane.defaultClassName,e.className),zIndex:String(t.lanes.length-i),headerClassName:Nt("histropedia-lane-header",t.options.lane.defaultHeaderClassName,e.headerClassName),bodyClassName:Nt("histropedia-lane-body",t.options.lane.defaultBodyClassName,e.bodyClassName),titleClassName:Nt("histropedia-lane-title",t.options.lane.defaultTitleClassName,e.titleClassName)}:{visible:!1}}function Ra(t,e,i){var l,c;const n=e.geometry,o=e.style||{},s=xt(o,"title.textAlign"),r=xt(o,"body.borderWidth"),a=xt(o,"body.borderRadius");return{visible:!0,rootClassName:Nt(...wo(t.lanes,i),t.options.lane.defaultClassName,e.className),zIndex:String(t.lanes.length-i),headerClassName:Nt("histropedia-lane-header",t.options.lane.defaultHeaderClassName,e.headerClassName),bodyClassName:Nt("histropedia-lane-body",t.options.lane.defaultBodyClassName,e.bodyClassName),titleClassName:Nt("histropedia-lane-title",t.options.lane.defaultTitleClassName,e.titleClassName),top:Pt(n.top),height:Pt(n.height),headerHeight:Pt(n.headerHeight||0),headerDisplay:n.headerHeight>0?"":"none",headerBackgroundColor:xt(o,"header.backgroundColor"),bodyTop:Pt(n.bodyTop-n.top),bodyBottom:Pt(n.bottom-n.bodyBottom),bodyBackgroundColor:xt(o,"body.backgroundColor"),bodyBorderColor:xt(o,"body.borderColor"),bodyBorderWidth:typeof r=="undefined"?void 0:Pt(r),bodyBorderStyle:typeof r=="undefined"?void 0:"solid",bodyBorderRadius:typeof a=="undefined"?void 0:Pt(a),titleLeft:Pt(((l=n.headerPadding)==null?void 0:l.left)||0),titleRight:Pt(((c=n.headerPadding)==null?void 0:c.right)||0),titleJustifyContent:typeof s=="undefined"?void 0:ka(s),titleColor:xt(o,"title.color"),titleFont:xt(o,"title.font"),titleTextAlign:s,titleText:e.title||""}}function _t(t,e,i){t[e]=typeof i=="undefined"?"":i}function Oa(t,e){const i=[];for(let n=t.lanes.length-1;n>=0;n--){const o=String(t.lanes[n].id),s=t._laneDomNodes.get(o);s&&i.push(s.root)}for(let n=0;n<i.length;n++)e.children[n]!==i[n]&&e.insertBefore(i[n],e.children[n]||null)}function vo(t,e,i){if((!e||e.rootClassName!==i.rootClassName)&&(t.root.className=i.rootClassName),(!e||e.headerClassName!==i.headerClassName)&&(t.header.className=i.headerClassName),(!e||e.bodyClassName!==i.bodyClassName)&&(t.body.className=i.bodyClassName),(!e||e.titleClassName!==i.titleClassName)&&(t.title.className=i.titleClassName),(!e||e.zIndex!==i.zIndex)&&_t(t.root.style,"zIndex",i.zIndex),!(e&&e.visible===i.visible&&i.visible===!1)){if(!i.visible){t.root.style.display="none";return}(!e||e.visible!==!0)&&(t.root.style.display=""),(!e||e.top!==i.top)&&(t.root.style.top=i.top),(!e||e.height!==i.height)&&(t.root.style.height=i.height),(!e||e.headerHeight!==i.headerHeight)&&(t.header.style.height=i.headerHeight),(!e||e.headerDisplay!==i.headerDisplay)&&(t.header.style.display=i.headerDisplay),(!e||e.headerBackgroundColor!==i.headerBackgroundColor)&&_t(t.header.style,"backgroundColor",i.headerBackgroundColor),(!e||e.bodyTop!==i.bodyTop)&&(t.body.style.top=i.bodyTop),(!e||e.bodyBottom!==i.bodyBottom)&&(t.body.style.bottom=i.bodyBottom),(!e||e.bodyBackgroundColor!==i.bodyBackgroundColor)&&_t(t.body.style,"backgroundColor",i.bodyBackgroundColor),(!e||e.bodyBorderColor!==i.bodyBorderColor)&&_t(t.body.style,"borderColor",i.bodyBorderColor),(!e||e.bodyBorderWidth!==i.bodyBorderWidth)&&_t(t.body.style,"borderWidth",i.bodyBorderWidth),(!e||e.bodyBorderStyle!==i.bodyBorderStyle)&&_t(t.body.style,"borderStyle",i.bodyBorderStyle),(!e||e.bodyBorderRadius!==i.bodyBorderRadius)&&_t(t.body.style,"borderRadius",i.bodyBorderRadius),(!e||e.titleLeft!==i.titleLeft)&&(t.title.style.left=i.titleLeft),(!e||e.titleRight!==i.titleRight)&&(t.title.style.right=i.titleRight),(!e||e.titleJustifyContent!==i.titleJustifyContent)&&_t(t.title.style,"justifyContent",i.titleJustifyContent),(!e||e.titleColor!==i.titleColor)&&_t(t.title.style,"color",i.titleColor),(!e||e.titleFont!==i.titleFont)&&_t(t.title.style,"font",i.titleFont),(!e||e.titleTextAlign!==i.titleTextAlign)&&_t(t.title.style,"textAlign",i.titleTextAlign),(!e||e.titleText!==i.titleText)&&(t.title.textContent=i.titleText)}}f.prototype._initialiseLaneHost=function(t){if(this._laneHostElement=null,this._laneViewportElement=null,this._laneLayer=null,this._laneDomNodes=new Map,this._laneDomState=new Map,this._laneDomDirty=!0,this._laneLayerDisplay=null,this._hasExplicitLanes=!1,!(t&&t===this.canvas)&&t&&t.nodeName!=="CANVAS"){this._laneHostElement=t;return}const i=this.canvas?this.canvas.parentElement:null;i&&i.firstElementChild===this.canvas&&i.children.length===1&&(this._laneHostElement=i)},f.prototype._ensureLaneViewport=function(){if(!this._laneHostElement||!this.canvas)return null;if(this._laneViewportElement)return this._laneViewportElement;const t=this.canvas.parentElement;if(!t)return null;const e=document.createElement("div");return e.className="histropedia-viewport",e.style.display="block",e.style.position="relative",t.insertBefore(e,this.canvas),e.appendChild(this.canvas),this._laneViewportElement=e,this._syncLaneViewportSize(),e},f.prototype._syncLaneViewportSize=function(){if(!this._laneViewportElement||!this.canvas)return;const t=this.canvas.style&&this.canvas.style.width?this.canvas.style.width:"",e=this.canvas.style&&this.canvas.style.height?this.canvas.style.height:"";this._laneViewportElement.style.width=t,this._laneViewportElement.style.height=e},f.prototype._markLaneDomDirty=function(){this._laneDomDirty=!0},f.prototype._setLaneLayerDisplay=function(t){!this._laneLayer||this._laneLayerDisplay===t||(this._laneLayer.style.display=t,this._laneLayerDisplay=t)},f.prototype._isLaneChromeActive=function(){return this._isLaneLayoutActive()&&this.options.lane.visible!==!1},f.prototype._ensureLaneLayer=function(){const t=this._ensureLaneViewport();if(!t)return null;if(!this._laneLayer){const e=document.createElement("div");e.setAttribute("aria-hidden","true"),e.dataset.histropediaLaneLayer="true",e.style.position="absolute",e.style.inset="0",e.style.pointerEvents="none",e.style.zIndex="0",e.style.overflow="hidden";const i=typeof window!="undefined"&&window.getComputedStyle?window.getComputedStyle(this.canvas).position:this.canvas.style.position;(!i||i==="static")&&(this.canvas.style.position="relative"),this.canvas.style.zIndex="1",this.canvas.style.display||(this.canvas.style.display="block"),this.canvas.parentElement===t?t.insertBefore(e,this.canvas):Yn(t,e),this._laneLayer=e}return this._laneLayer},f.prototype._syncLaneDom=function(){if(!this._isLaneChromeActive()){this._laneLayer&&this._setLaneLayerDisplay("none");return}const t=this._ensureLaneLayer();if(!t)return;this._setLaneLayerDisplay("");const e=this._laneDomDirty,i=new Set;for(let n=0;n<this.lanes.length;n++){const o=this.lanes[n],s=o.geometry,r=o.currentVisibility!=="hidden"&&s,a=String(o.id);let l=this._laneDomNodes.get(a);if(!l){const u=document.createElement("div"),m=document.createElement("div"),d=document.createElement("div"),g=document.createElement("div");u.dataset.histropediaLaneId=a,m.appendChild(d),u.appendChild(m),u.appendChild(g),t.appendChild(u),u.style.position="absolute",u.style.left="0",u.style.right="0",u.style.boxSizing="border-box",u.style.pointerEvents="none",m.style.position="absolute",m.style.left="0",m.style.right="0",m.style.top="0",m.style.boxSizing="border-box",m.style.pointerEvents="none",g.style.position="absolute",g.style.left="0",g.style.right="0",g.style.boxSizing="border-box",g.style.pointerEvents="none",d.style.position="absolute",d.style.top="0",d.style.bottom="0",d.style.display="flex",d.style.alignItems="center",d.style.boxSizing="border-box",d.style.pointerEvents="none",d.style.overflow="hidden",d.style.whiteSpace="nowrap",d.style.textOverflow="ellipsis",l={root:u,header:m,title:d,body:g},this._laneDomNodes.set(a,l)}i.add(a);const c=r?Ra(this,o,n):bo(this,o,n),h=this._laneDomState.get(a);vo(l,h,c),this._laneDomState.set(a,c)}this._laneDomNodes.forEach((n,o)=>{if(!i.has(o)){const s=bo(),r=this._laneDomState.get(o);vo(n,r,s),this._laneDomState.set(o,s)}}),e&&Oa(this,t),this._laneDomDirty=!1};function ce(t,e){return t===e}function Ea(t){const e=t&&t.layout?t.layout:{},i=Number.isFinite(e.height)?e.height:null,n=Number.isFinite(e.heightWeight)&&e.heightWeight>0?e.heightWeight:1;return{explicitHeight:i,heightWeight:n}}function je(t){return Math.round(t||0)}function Na(t,e){return e&&(t.cacheChanged=t.cacheChanged||!!e.cacheChanged,e.styleChanged&&e.laneId!=null&&t.styleLaneIds.add(String(e.laneId))),t}function So(t,e){if(!Number.isFinite(t))throw new Error(`Lane index must be a finite number. Received: ${t}`);return e<=1?0:Math.min(Math.max(Math.trunc(t),0),e-1)}f.prototype._getDefaultLaneId=function(){const t=this.options&&this.options.lane?this.options.lane:{};return t.defaultId!=null?t.defaultId:"default"},f.prototype._isLaneLayoutActive=function(){if(!Array.isArray(this.lanes)||this.lanes.length===0)return!1;if(this.lanes.length!==1)return!0;const t=this.lanes[0];return!(t&&t.isImplicit&&ce(t.id,this._getDefaultLaneId())&&!this._hasExplicitLanes)},f.prototype.getLaneById=function(t){for(let e=0;e<this.lanes.length;e++){const i=this.lanes[e];if(ce(i.id,t))return i}},f.prototype._resolveLaneReference=function(t){if(t instanceof et||t&&typeof t=="object"&&t.owner){if(t.owner===this){const e=this.lanes.indexOf(t);if(e>=0)return this.lanes[e]}throw new Error(`Lane "${t.id}" does not belong to this timeline`)}if(t!=null&&t!==""){const e=this.getLaneById(t);if(e)return e}throw new Error(`Lane "${t}" does not exist on this timeline`)},f.prototype._getLanePublicIndex=function(t){const e=this.lanes.indexOf(t);if(e<0)throw new Error(`Lane "${t&&t.id}" does not belong to this timeline`);return e},f.prototype._getInternalLaneIndexFromPublicIndex=function(t,e=this.lanes.length){return So(t,e)},f.prototype._handleLaneChange=function({requestRedraw:t=!1,refreshOrder:e=!0}={}){e&&this._refreshLaneOrder(),this._markLaneDomDirty(),t&&this.requestRedraw()},f.prototype._createImplicitLane=function(t){const e=t!=null&&t!==""?t:this._getDefaultLaneId(),i=this.getLaneById(e);if(i)return i;const n=new et(this,e);return n.setupByReceivedData({id:e},{implicit:!0}),this.lanes.push(n),this._handleLaneChange(),n},f.prototype._resolveLaneIdFromArticleData=function(t){const e=t?_(t,"lane"):void 0;return e!=null&&e!==""?e:this._getDefaultLaneId()},f.prototype._assignArticleToLane=function(t,e){const i=this._createImplicitLane(e);return t.laneId=i.id,t.laneOrder=i.order||0,i},f.prototype._refreshLaneOrder=function(){for(let t=0;t<this.lanes.length;t++)this.lanes[t].order=t;for(let t=0;t<this.articles.length;t++){const e=this.articles[t],i=this.getLaneById(e.laneId);e.laneOrder=i?i.order:0}this._hasExplicitLanes=this.lanes.some(t=>!t.isImplicit)},f.prototype._handleLaneIdChange=function(t,e){for(let i=0;i<this.articles.length;i++){const n=this.articles[i];ce(n.laneId,e)&&(n.laneId=t.id,n.data&&_(n.data,"lane")!=null&&(n.data.lane=t.id))}for(let i=0;i<this.charts.length;i++){const n=this.charts[i];ce(n.laneId,e)&&(n.laneId=t.id,n.data&&n.data.lane!=null&&(n.data.lane=t.id))}this._markLaneDomDirty()},f.prototype._refreshArticlesForLane=function(t,{refreshStyles:e=!0}={}){if(e)for(let i=0;i<this.articles.length;i++){const n=this.articles[i];!n.isDataLoaded||!ce(n.laneId,t.id)||(n.initialiseStyles(n.data),n.invalidateCaches())}},f.prototype._refreshAllLaneArticleStyles=function(){this.forLoadedArticles(t=>{t.initialiseStyles(t.data),t.invalidateCaches()})},f.prototype._refreshLaneArticleStylesByIds=function(t){!t||t.size===0||this.forLoadedArticles(e=>{t.has(String(e.laneId))&&(e.initialiseStyles(e.data),e.invalidateCaches())})},f.prototype._refreshResolvedLanesFromOptions=function({articleStyleScope:t=null}={}){for(let e=0;e<this.lanes.length;e++)this.lanes[e]._resolveFromData();this._handleLaneChange(),t==="all"?this._refreshAllLaneArticleStyles():t instanceof Set&&this._refreshLaneArticleStylesByIds(t)},f.prototype.loadLanes=function(t){this.addLanes(t),this.requestRedraw()},f.prototype.addLanes=function(t,{suppressArticleRefresh:e=!1}={}){var n,o;if(!Array.isArray(t)||t.length===0)return{cacheChanged:!1,styleLaneIds:new Set};const i={cacheChanged:!1,styleLaneIds:new Set};for(let s=0;s<t.length;s++){const r=t[s]||{},a=r.id!=null?r.id:this._getDefaultLaneId(),l=this.getLaneById(a);if(l){const h=l._applyOption(L({},r,{id:a}),{suppressRedraw:!0,markExplicit:!0,suppressArticleRefresh:e});Na(i,{cacheChanged:(n=h==null?void 0:h.articleImpact)==null?void 0:n.cacheChanged,styleChanged:(o=h==null?void 0:h.articleImpact)==null?void 0:o.styleChanged,laneId:h==null?void 0:h.laneId});continue}const c=new et(this,a);c.setupByReceivedData(L({},r,{id:a}),{implicit:!1}),this.lanes.push(c)}return this._handleLaneChange(),i},f.prototype.moveLaneToIndex=function(t,e){const i=this._resolveLaneReference(t),n=this._getLanePublicIndex(i),o=So(e,this.lanes.length);if(n===o)return i;const s=this._getInternalLaneIndexFromPublicIndex(n),r=this._getInternalLaneIndexFromPublicIndex(o),a=this.lanes.splice(s,1)[0];return this.lanes.splice(r,0,a),this._handleLaneChange({requestRedraw:!0}),a},f.prototype.moveLaneBefore=function(t,e){const i=this._resolveLaneReference(t),n=this._resolveLaneReference(e);if(i===n)return i;const o=this._getLanePublicIndex(i),s=this._getLanePublicIndex(n),r=o<s?s-1:s;return this.moveLaneToIndex(i,r)},f.prototype.moveLaneAfter=function(t,e){const i=this._resolveLaneReference(t),n=this._resolveLaneReference(e);if(i===n)return i;const o=this._getLanePublicIndex(i),s=this._getLanePublicIndex(n),r=o<s?s:s+1;return this.moveLaneToIndex(i,r)},f.prototype.moveLaneUp=function(t){const e=this._resolveLaneReference(t);return this.moveLaneToIndex(e,e.order+1)},f.prototype.moveLaneDown=function(t){const e=this._resolveLaneReference(t);return this.moveLaneToIndex(e,e.order-1)},f.prototype.loadLaneArticles=function(t,e){const i=t!=null&&t!==""?t:this._getDefaultLaneId(),o=(Array.isArray(e)?e:[]).map(s=>{const r=L({},s),a=_(s,"lane");return a!=null&&a!==""&&!ce(a,i)&&T.warn("loadLaneArticles overriding conflicting article.lane value",{articleId:_(s,"id"),from:a,to:i}),r.lane=i,r});this._createImplicitLane(i),this.load(o)},f.prototype._getActiveLanesForLayout=function(){if(!Array.isArray(this.lanes)||this.lanes.length===0)return[];const t=[];for(let e=0;e<this.lanes.length;e++){const i=this.lanes[e];i.currentVisibility=i.visibility,i.currentVisibility!=="hidden"?t.push(i):i.geometry=null}return t},f.prototype._updateLaneLayout=function(){var w,b,v;const t=this._getActiveLanesForLayout();if(!this._isLaneLayoutActive()||t.length===0){for(let S=0;S<this.lanes.length;S++)this.lanes[S].geometry=null;return}const e=this.options.lane||{},i=typeof e.gap=="number"?e.gap:0,n=typeof e.topGap=="number"?e.topGap:0,o=typeof e.axisGap=="number"?e.axisGap:0,s=this.top-this.options.style.mainLine.size/2-o,r=i*Math.max(t.length-1,0),a=s-n-r,l=t.map(S=>Ea(S));let c=0,h=0;for(let S=0;S<l.length;S++){const M=l[S];M.explicitHeight!=null?c+=M.explicitHeight:h+=M.heightWeight}const u=Math.max(0,a-c),m=this.getWidth(),d=je(s),g=h>0;let p=n;for(let S=t.length-1;S>=0;S--){const M=t[S],P=l[S],E=P.explicitHeight!=null?P.explicitHeight:h>0?u*P.heightWeight/h:0,x=je(p),Z=p+E,R=S===0&&g?d:je(Z),V=Math.max(0,R-x),B=x+V,z=((w=M.layout.header)==null?void 0:w.padding)||{},kt=((b=M.layout.header)==null?void 0:b.visible)!==!1&&typeof((v=M.layout.header)==null?void 0:v.height)=="number"?je(M.layout.header.height):0,ut=x+kt,Ut=B;M.geometry={top:x,left:0,width:m,height:V,bottom:B,headerTop:x,headerHeight:kt,headerBottom:ut,bodyTop:ut,bodyBottom:Ut,bodyLeft:0,bodyRight:m,bodyContentTop:ut,bodyContentBottom:Ut,bodyContentLeft:0,bodyContentRight:m,headerPadding:z},p=Z+i}},f.prototype._isArticleLaneVisible=function(t){const e=this.getLaneById(t.laneId);return!e||!this._isLaneLayoutActive()?!0:e.currentVisibility!=="hidden"};function be(t){return t!=null&&t!==""}function Lo(t){return be(t==null?void 0:t.lane)?t.lane:null}function _o(t,e){return be(e)?e:t._getDefaultLaneId()}f.prototype.getChartById=function(t){for(let e=0;e<this.charts.length;e++){const i=this.charts[e];if(i.id===t)return i}},f.prototype.loadCharts=function(t){this.addCharts(t),this.requestRedraw()},f.prototype.removeChart=function(t){for(let e=0;e<this.charts.length;e++)if(this.charts[e].id===t)return this.charts.splice(e,1),this.requestRedraw(),!0;return!1},f.prototype.clearCharts=function(){!Array.isArray(this.charts)||this.charts.length===0||(this.charts=[],this.requestRedraw())},f.prototype.loadLaneCharts=function(t,e){const i=_o(this,t),o=(Array.isArray(e)?e:[]).map(s=>{const r=L({},s),a=Lo(s);return a!=null&&a!==i&&T.warn("loadLaneCharts overriding conflicting chart.lane value",{chartId:s==null?void 0:s.id,from:a,to:i}),r.lane=i,r});this.addCharts(o),this.requestRedraw()},f.prototype.addCharts=function(t){if(!Array.isArray(t)||t.length===0)return;const e=this.charts.map(i=>i.id);for(let i=0;i<t.length;i++){const n=t[i]||{};if(n.id==null){T.warn("Skipping chart without id",n);continue}if(e.indexOf(n.id)!==-1){T.warn("Skipping chart with duplicate id",{chartId:n.id,chart:n});continue}const o=Lo(n);o!=null&&this._ensureChartLane(o);const s=new ct(this,n.id);s.setupByReceivedData(n),be(s.laneId)&&this._ensureChartLane(s.laneId),this.charts.push(s),e.push(s.id)}this._refreshLaneOrder(),this._updateLaneLayout()},f.prototype._ensureChartLane=function(t){const e=_o(this,t),i=this.getLaneById(e);return i&&!i.isImplicit?i:(typeof this.addLanes=="function"&&this.addLanes([{id:e}],{suppressArticleRefresh:!0}),this.getLaneById(e))},f.prototype._isChartLaneVisible=function(t){if(!be(t.laneId))return!0;const e=this.getLaneById(t.laneId);return e?this._isLaneLayoutActive()?e.currentVisibility!=="hidden":!0:!1},f.prototype._getVisibleCharts=function(){return!this.charts||this.charts.length===0?[]:this.charts.filter(t=>t.isDataLoaded&&t.visibility!=="hidden"&&this._isChartLaneVisible(t))},f.prototype._getChartGeometry=function(t,e){if(be(t.laneId)){const l=this.getLaneById(t.laneId),c=l&&l.geometry?l.geometry:null;return c?{left:c.bodyContentLeft,right:c.bodyContentRight,top:c.bodyContentTop,bottom:c.bodyContentBottom,width:c.bodyContentRight-c.bodyContentLeft,height:c.bodyContentBottom-c.bodyContentTop,lane:l}:null}const i=this.options.chart||{},n=t.area||i.area,o={up:this.top,down:0},{up:s,height:r}=Ci(n,{anchorY:this.top,canvasHeight:this.options.height,fallbackArea:o});if(r<=0)return null;const a=this.top-s;return{left:0,right:e,top:a,bottom:a+r,width:e,height:r}},f.prototype.drawCharts=function(t,e,i,n){if(!(this.options.chart||{}).visible)return;const s=this._getVisibleCharts();if(s.length!==0){t.save();for(let r=0;r<s.length;r++){const a=s[r],l=this._getChartGeometry(a,i);!l||l.width<=0||l.height<=0||a.draw(t,l,n)}t.restore()}},f.prototype._getLaneRowSpacing=function(t,e){const i=this._getLaneAutoStackingOptions(t),n=Array.isArray(e)?e.length:e;if(!t||!i.fitToHeight||n<=1||!t.geometry)return i.rowSpacing;const o=Number(ie(i.topGap,this))||0,s=t.geometry.bodyContentBottom-this._getLaneDistanceToBaseline(t),r=t.geometry.bodyContentTop+o,a=Math.max(0,s-r);return Math.max(Math.round(a/(n-1)),1)},f.prototype.updateArticleLines=function(){const t=this,e=this.options.article.periodLine||{},i=this._isLaneLayoutActive()&&e.position==="lane";function n(l){const c=[];return t.forVisibleArticles(function(h){h.hidePeriodLine||(c.push(h),c[c.length-1].stacking=-1)}),c.sort(t.options.article.periodLine.stacking.sorter),t.options.article.periodLine.stacking.reverseOrder&&c.reverse(),c}function o(l,c){for(let h=0;h<c.length;h++)if(l.overlaps(c[h]))return!1;return!0}function s(l){let c=0;const h=[];let u;do{h[c]=[],u=!1;for(let m=0;m<l.length;m++){const d=l[m];d.stacking>=0||o(d,h[c])&&(h[c].push(d),d.stacking=c,u=!0)}c++}while(u)}const r=n(this.articles);if(!i){s(r);return}const a=new Map;for(let l=0;l<r.length;l++){const c=r[l],h=String(c.laneId),u=a.get(h)||[];u.push(c),a.set(h,u)}a.forEach(l=>{s(l)})},f.prototype.stack=function(t){if(this.articles.length===0||!this.options.article.autoStacking.active)return;function e(c){let h;const u=[],m=[];for(let d=0;d<c.length;d++){const g=c[d];g.isDataLoaded&&g.isInRange&&g.isVisibleInGroup&&!g.isHiddenByFilter&&(g.isActive?h=g:g.isStarred?u.push(g):m.push(g))}return u.sort(ni),m.sort(ni),[].concat(h||[],u,m)}function i(c,h){for(let u=0;u<c.length;u++){const m=c[u];if(h.headerOverlapsWith(m))return!1}return!0}function n(c,h){for(let u=0;u<c.length;u++)if(i(c[u],h))return u;return c.length}function o(c,h){const u=n(c,h);return u>=c.length&&(c[u]=[]),c[u].push(h),!0}const s=e(this.articles);if(this._isLaneLayoutActive()){const c=new Map;for(let u=0;u<s.length;u++){const m=s[u],d=this.getLaneById(m.laneId),g=this._getLaneAutoStackingOptions(d),p=String(m.laneId),w=c.get(p)||[];g.active===!1?(w[0]||(w[0]=[]),w[0].push(m),m.isVisibleInRows=!0):m.isVisibleInRows=o(w,m),c.set(p,w)}this.topRow=0,c.forEach((u,m)=>{const d=this.getLaneById(m),g=this._getLaneAutoStackingOptions(d),p=g.active===!1?0:this._getLaneRowSpacing(d,u);d&&(d.topRow=0);for(let w=0;w<u.length;w++)for(let b=0;b<u[w].length;b++){const v=u[w][b],S=g.active===!1;S||(v.finalOffset={left:0,top:w*-p}),v.row=S?0:w,d&&(d.topRow=Math.max(d.topRow,v.row)),v.isInView&&(this.topRow=Math.max(this.topRow,v.row)),S||this.reposition(v,t)}});const h=this.getActiveArticle();this.articles.sort(ii),h&&this.bringFront(h.id);return}const r=this.options.article.autoStacking.rowSpacing,a=[];for(let c=0;c<s.length;c++)s[c].isVisibleInRows=o(a,s[c]);this.topRow=0;for(let c=0;c<a.length;c++)for(let h=0;h<a[c].length;h++){const u=a[c][h];u.finalOffset={left:0,top:c*-r},u.row=c,u.isInView&&(this.topRow=Math.max(this.topRow,c)),this.reposition(u,t)}const l=this.getActiveArticle();this.articles.sort(ii),l&&this.bringFront(l.id)},f.prototype.notifyEventSpacingChanged=function(){this.requestRedraw(this.defaultRedraw)};const Ao=.001,xa=120,za=1e3/60,Io=120,Fa=24,Ba=1e-7,Mo=[.25,1/3,.5,.67,.75,.8,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4,5];function Ha(t,e="discrete"){let i=0;if("deltaY"in t&&typeof t.deltaY=="number"&&t.deltaY!==0?i=-t.deltaY:"wheelDelta"in t&&typeof t.wheelDelta=="number"&&t.wheelDelta!==0?i=t.wheelDelta:"detail"in t&&typeof t.detail=="number"&&t.detail!==0&&(i=-t.detail),e==="discrete")return i>0?1:-1;const n=i/120;return n===0?0:n}function Co(t,e){const i=Math.max(1,Math.abs(e)*.015);return Math.abs(t-e)<=i}function Do(t){const e=Math.abs(t);if(e<Fa)return!1;for(let i=0;i<Mo.length;i++){const n=Mo[i];if(Co(e,Io*n)||Co(e,Io/n))return!0}return!1}function Ya(t){return!!(t.deltaMode===1||typeof t.deltaY=="number"&&Do(t.deltaY)||"wheelDelta"in t&&typeof t.wheelDelta=="number"&&Do(t.wheelDelta))}function Wa(t,e){const i=t.discreteWheelAnimation;return i!=null&&i.active?e:!1}function Va(t,e){return e&&Number.isFinite(t.animation.wheelZoomTarget)?t.animation.wheelZoomTarget:t.timescaleManager.zoom}function To(t,e){let i=e;return i>t.maximum&&(i=t.maximum),i<t.minimum&&(i=t.minimum),i}function Za(t,e){var n;const i=((n=t.discreteWheelAnimation)==null?void 0:n.duration)||250;return i<=0?1:1-Math.pow(.05,Math.max(e,0)/i)}function Pi(t){t.wheelZoomTarget=null,t.wheelZoomPivotPoint=null,t.wheelZoomPivotPixel=null,t.wheelZoomLastFrameTime=null,t.wheelZoomFrame=null}function Ua(t){t._wheelZoomStateChangeTimer!=null&&clearTimeout(t._wheelZoomStateChangeTimer),t._wheelZoomStateChangeTimer=setTimeout(()=>{var e;t._wheelZoomStateChangeTimer=null,(e=t._flushTimelineStateChange)==null||e.call(t)},xa)}f.prototype.enableZoomByWheel=function(){this._wheelEnabled||(this._wheelEnabled=!0,this._wheelHandler=e=>{const{allowCtrlWheel:i=!1,wheelMode:n="auto"}=this.options.zoom||{};if(!i&&e.ctrlKey)return;const s=Ha(e,n==="discrete"?"discrete":"proportional");this.onWheel(e,s)},this.canvas.addEventListener("wheel",this._wheelHandler,{passive:!1}),this.canvas.addEventListener("DOMMouseScroll",this._wheelHandler,{passive:!1}))},f.prototype.disableZoomByWheel=function(){this._wheelEnabled&&(this.canvas.removeEventListener("wheel",this._wheelHandler),this.canvas.removeEventListener("DOMMouseScroll",this._wheelHandler),this._wheelEnabled=!1,this._wheelHandler=null)},f.prototype.onWheel=function(e,i){const{wheelSpeed:n,wheelStep:o,maximum:s,minimum:r,proportionalGain:a,proportionalExponent:l,wheelMode:c}=this.options.zoom,h=c!=="discrete",u=Ya(e);if(h&&!u){const S=Math.sign(i)||1;let M=Math.abs(i);M>=1&&l&&l!==1&&(M=Math.pow(M,l)),M*=a,i=S*M}else h&&u&&(i=i>0?1:-1);const m=Wa(this.options.zoom,u);let d=Va(this,m)+-i*n*o;d=To({maximum:s,minimum:r},d);let g,p;if(e.target===this.canvas&&"offsetX"in e&&typeof e.offsetX=="number")g=e.offsetX,p=e.offsetY;else{const S=this.canvas.getBoundingClientRect();g=e.clientX-S.left,p=e.clientY-S.top}const w=this.timescaleManager.zoom;m?this.animateZoomByPivotPoint(d,this.getPivotPoint(g),g):(this.animation.wheelZoomFrame!=null&&cancelAnimationFrame(this.animation.wheelZoomFrame),Pi(this.animation),this.setZoomByPivotPixel(d,g),Ua(this));const b=this.timescaleManager.zoom,v=d-w;this.requestRedraw(),e.preventDefault(),this.trigger("zoom-wheel",va({centre:{x:g,y:p},zoom:m?d:b,zoomDelta:v}),e)},f.prototype.animateZoomByPivotPoint=function(e,i,n){var r,a;if((r=this.stopPanAnimation)==null||r.call(this),this.animation.wheelZoomFrame==null&&((a=this.animation.zoom)!=null&&a.stop)&&(this.animation.zoom.stop(),this.animation.zoom=null),this.animation.wheelZoomTarget=To(this.options.zoom,e),this.animation.wheelZoomPivotPoint=i,this.animation.wheelZoomPivotPixel=n,this.animation.wheelZoomFrame!=null)return;const o=this;function s(l){var v;const c=o.animation.wheelZoomTarget;if(!Number.isFinite(c)){Pi(o.animation);return}const h=o.timescaleManager.zoom,u=c-h,m=o.animation.wheelZoomPivotPoint,d=o.animation.wheelZoomPivotPixel;if(Math.abs(u)<=Ao){o.setZoomByPivotPoint(c,m,d),o.requestRedraw(),Pi(o.animation),(v=o._flushTimelineStateChange)==null||v.call(o);return}const g=o.animation.wheelZoomLastFrameTime,p=g==null?za:l-g;o.animation.wheelZoomLastFrameTime=l;const w=Za(o.options.zoom,p),b=h+u*w;o.setZoomByPivotPoint(b,m,d),Math.abs(o.timescaleManager.zoom-b)>Ao&&(o.animation.wheelZoomTarget=o.timescaleManager.zoom),o.requestRedraw(o.repositionRedraw),o.animation.wheelZoomFrame=requestAnimationFrame(s)}this.animation.wheelZoomFrame=requestAnimationFrame(s)},f.prototype.setZoom=function(e,i,n=0){var r,a,l;(r=this.stopPanAnimation)==null||r.call(this),(a=this.stopZoomAnimation)==null||a.call(this);const o=i==null?this.width/2:i,s=n?Math.round(n):0;this.setZoomByPivotPixel(e,o,s),this.requestRedraw(),(l=this._flushTimelineStateChange)==null||l.call(this)},f.prototype.setZoomByPivotPixel=function(e,i,n=0){this.setZoomByPivotPoint(e,this.getPivotPoint(i),i,n)},f.prototype.setZoomByPivotPoint=function(e,i,n,o=0){this.timescaleManager.setZoom(e);const s=this.timescaleManager.setStartDate(i.date),r=Number.isFinite(i.millisecondFraction)?i.millisecondFraction*At(this)/U:i.fraction;this.repositionWindow=s-r,this.updateFromByPixels(-n+o),Et(this,{mode:this.isDragging||this.isPinching?"elastic":"clamp"})},f.prototype.getPivotPoint=function(e){let i=this.timescaleManager.getStartTokenCloned(),n=this.repositionWindow;n>=0&&(i=this.timescaleManager.getPrevious(i),n-=i.length);let o=i;for(;n<=e;)n+=i.length,o=i,i=this.timescaleManager.getNext(i);const s=o.unit,r=o.length;let a=e-(n-i.length);const l=o.value;let{year:c,month:h,day:u}=l;if(s<=O){const m=At(this)/U;let d=m>0?a/m:0;const g=Math.round(d);Math.abs(d-g)<Ba&&(d=g);const p=Math.floor(d),w=d-p;return o.value=o.value.addMilliseconds(p),a-=p*m,{date:o.value,fraction:a,millisecondFraction:w}}else if(s===$)u=Math.floor(a/r*30.44)+1,a-=(u-1)*r/30.44,o.value=new y(c,h,u);else if(s!==O){const m=this.timescaleManager.unitLengthInYears;let d=Math.floor(a*365.2422*m/r)+1,g=0;d>365&&(g=Math.floor(d/365),d=d-365*g),a=0,o.value=y.getByDayOfYear(c+g,d)}return{date:o.value,fraction:a}},f.prototype.startAnimation=function(t){this.isAnimating||(this.isAnimating=!0,this.animation.redrawFunction=t,this.drawAnimationFrame())},f.prototype.stopAnimation=function(){var t;this.isAnimating=!1,this.animation.dragRedrawFunction=this.repositionRedraw,this.animation.redrawFunction=!1,(t=this._flushTimelineStateChange)==null||t.call(this)},f.prototype.areAnimationsFinished=function(){return!(this.isDragging||this.isPanning||this.isPinching||this.draggingArticle!==null||this.isAnimatingArticles||this.isCustomAnimating)},f.prototype.drawAnimationFrame=function(){if(this.areAnimationsFinished())return this.stopAnimation();const t=this,e=this.getAnimationRedrawFunction();this.updateRedrawRequests(e),requestAnimationFrame(function(i){e.call(t),t.drawAnimationFrame()})},f.prototype.requestRedraw=function(t){t=t||this.defaultRedraw;const e=this;if(!this.isAnimating)return t.call(e);t===this.defaultRedraw&&(this.redrawRequests.default=!0),t===this.repositionRedraw&&(this.redrawRequests.reposition=!0)},f.prototype.updateRedrawRequests=function(t){t===this.defaultRedraw&&(this.redrawRequests.default=!1,this.redrawRequests.reposition=!1),t===this.repositionRedraw&&(this.redrawRequests.reposition=!1)},f.prototype.getAnimationRedrawFunction=function(){return this.isDragging?this.animation.dragRedrawFunction:this.isPanning||this.isPinching?this.defaultRedraw:this.redrawRequests.default?this.defaultRedraw:this.redrawRequests.reposition?this.repositionRedraw:this.animation.redrawFunction||this.animation.defaultRedrawFunction},f.prototype.stopPanAnimation=function(){var t;(t=this.animation.pan)!=null&&t.stop&&this.animation.pan.stop(),this.animation.pan=null,this.isPanning=!1},f.prototype.stopZoomAnimation=function(){var t;(t=this.animation.zoom)!=null&&t.stop&&this.animation.zoom.stop(),this.animation.zoom=null,this.animation.wheelZoomFrame!=null&&cancelAnimationFrame(this.animation.wheelZoomFrame),this._wheelZoomStateChangeTimer!=null&&(clearTimeout(this._wheelZoomStateChangeTimer),this._wheelZoomStateChangeTimer=null),this.animation.wheelZoomTarget=null,this.animation.wheelZoomPivotPoint=null,this.animation.wheelZoomPivotPixel=null,this.animation.wheelZoomLastFrameTime=null,this.animation.wheelZoomFrame=null},f.prototype.switchToPositiveRepositionWindow=function(){if(this.repositionWindow<0){let t=this.timescaleManager.startToken;this.repositionWindow=t.length+this.repositionWindow,t=this.timescaleManager.getNext(t),this.timescaleManager.setStartToken(t)}},f.prototype.zoomToAnim=function(t,e){this.stopPanAnimation(),this.stopZoomAnimation();const i=this.timescaleManager.zoom,n=2e3,o=H.swing,s=this,r=Y({from:i,to:t,duration:n,easing:o,onUpdate(a){s.setZoomByPivotPixel(a,s.width/2),s.requestRedraw()},onComplete(){var a;s.animation.zoom=null,(a=s._flushTimelineStateChange)==null||a.call(s),typeof e=="function"&&e.call(s)}});this.animation.zoom=r},f.prototype.goToPixelAnim=function(t,e={}){var a;this.stopPanAnimation(),this.stopZoomAnimation(),this.isPanning=!0;const i=1e8;let n=!1;Math.abs(t)>i&&(t=Math.sign(t)*i,n=!0),this.startAnimation();let o=0;const s=this,r=Y({from:0,to:t,duration:(a=e.duration)!=null?a:2e3,easing:H[e.easing]||H.swing,onUpdate(l){const c=l-o;o=l,s.updateFromByPixels(c),s.isPinching?(s.isPanning=!1,r.stop()):s.requestRedraw()},onComplete(){var l;n&&e.targetDmy&&s.setStartDate(e.targetDmy),s.isPanning=!1,(l=e.complete)==null||l.call(s)}});this.animation.pan=r},f.prototype.goToDateAnim=function(t,e={}){var i;T.warn("DEPRECATION WARNING: timeline.goToDateAnim(dmy, options) is deprecated. Use timeline.setStartDate(dmy, { padding, animation: { active: true, ... } }) instead."),this.setStartDate(t,{padding:(i=e.offsetX)!=null?i:0,animation:{active:!0,duration:e.duration,easing:e.easing,complete:e.complete}})},f.prototype.repositionWithAnim=function(t){const e=this.getOriginalPosition(t);t.registeredPosition=e;const i={left:e.left+t.dragFinishOffset.left,top:e.top+t.dragFinishOffset.top};t.moveToWithAnim(i)},f.prototype.notifyArticleAnimating=function(t,e){const i=new Date().getTime(),n=this.options.article.animation[t].duration,o=i+n;o>this.lastAnimatingArticle.endTime&&(this.lastAnimatingArticle.id=e,this.lastAnimatingArticle.endTime=o,this.lastAnimatingArticle.animationType=t),this.isAnimatingArticles=!0,this.startAnimation()},f.prototype.toggleAutoFit=function(){const t=this.options.article.autoStacking.fitToHeight=!this.options.article.autoStacking.fitToHeight;return t&&this.fitToHeight(!0),t},f.prototype.fitToHeight=function(t){if(this.topRow+1===1)return;const i=this.options.article.autoStacking.rowSpacing=this.getFitToHeightRowSpacing();return t&&this.requestRedraw(),i},f.prototype.getFitToHeightRowSpacing=function(){const t=this.top-this._getTimelineDistanceToBaseline(),e=this._getResolvedArticleTopGap(),i=this.topRow;if(i===0)return!1;const n=Math.abs(t-e);return Math.max(Math.round(n/i),1)},f.prototype.incrementRowSpacing=function(t,e){return this.options.article.rowSpacing=Math.max(this.options.article.rowSpacing+t,1),e&&this.requestRedraw(),this.options.article.rowSpacing};function Ga(t){return typeof t=="number"?(T.warn("DEPRECATION WARNING: timeline.setStartDate(date, pixelOffset) is deprecated. Use timeline.setStartDate(date, { padding }) instead."),{padding:t}):t||{}}function ja(t,e,i,n){t.switchToPositiveRepositionWindow();const o=t.timescaleManager.startToken.value,s=t.repositionWindow-t.timescaleManager.getPixelsBetween(e,o)-i;t.goToPixelAnim(s,zt(W({},n),{targetDmy:e}))}f.prototype.setStartDate=function(t,e){var s;const i=Ga(e),n=i.padding||0;if(t=this.getDmyFromInput(ze(t)),(s=i.animation)!=null&&s.active){ja(this,t,n,i.animation);return}const o=this.timescaleManager.setStartDate(t);this.repositionWindow=o,n&&this.updateFromByPixels(-n),Et(this),this.requestRedraw(),this._emitTimelineStateChange()},f.prototype.getZoom=function(){return this.timescaleManager.zoom},f.prototype.setCentreDate=function(t,e){this.setStartDate(t,{padding:this.getWidth()/2+(e||0)})};function ki(t,e,i,n={}){var r;const o=Gn(n.padding),s=oa(t,e,i,o);if((r=n.animation)!=null&&r.active){ua(t,e,i,s,o,n.animation);return}s!==t.timescaleManager.zoom&&t.setZoom(s),eo(t,e,o.left,!0)}f.prototype.fitDateRange=function(e,i,n={}){let o=$n(e),s=$n(i);o.start.compare(s.start)>0&&([o,s]=[s,o]),ki(this,this.getDmyFromInput(o.start),this.getDmyFromInput(s.end),n)},f.prototype.settleDateBounds=function(e={}){var h;let i=Be(this);if(!i)return!1;if(i.type==="range"&&i.zoom===this.timescaleManager.zoom&&(i=Be(this,void 0,{mode:"elastic"})||i),e.animate===!1||i.type==="range")return Et(this,{mode:"clamp"}),!0;const n=At(this);if(!n)return Et(this,{mode:"clamp"}),!0;const o=i.type==="min"?i.overflowDays*n:-i.overflowDays*n;if(!Number.isFinite(o)||o===0)return Et(this,{mode:"clamp"}),!0;(h=this.stopPanAnimation)==null||h.call(this),this.isPanning=!0,this.startAnimation();let s=0;const r=300,a=H.swing,l=this,c=Y({from:0,to:o,duration:r,easing:a,onUpdate(u){const m=u-s;s=u,l.updateFromByPixels(m,{skipDateBounds:!0}),l.requestRedraw()},onComplete(){l.isPanning=!1,l.animation.pan===c&&(l.animation.pan=null),Et(l,{mode:"clamp"})}});return this.animation.pan=c,!0},f.prototype.fitArticleRange=function(e,i={}){var n;return!((n=e==null?void 0:e.period)!=null&&n.from)||!e.period.to?!1:(ki(this,e.period.from,e.period.to,{padding:i.padding,animation:i.animation}),!0)},f.prototype.fitArticles=function(e={}){var r;const i=e.articleFilter||function(l){return!l.hiddenByFilter},n=da(this,i);if(!n)return!1;const o=Gn((r=e.padding)!=null?r:40),s={left:o.left+n.maxCardLeftOffset,right:o.right+n.maxCardRightOffset};return ki(this,n.earliest,n.latest,{padding:s,animation:e.animation}),!0},f.prototype.on=function(t,e){if(typeof t=="object")return this.onMultiple(t);this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(e)},f.prototype.trigger=function(t,...e){if(!this.handlers[t])return;const i=this.handlers[t];for(let n=0;n<i.length;n++)i[n].call(this,...e)},f.prototype.onMultiple=function(t){for(const e in t)this.on(e,t[e])},f.prototype.off=function(t,e){if(typeof t=="object")return this.offMultiple(t);this.handlers[t]&&(this.handlers[t]=this.handlers[t].filter(i=>i!==e))},f.prototype.offMultiple=function(t){for(const e in t)this.off(e,t[e])};function Ri(t){var n,o,s,r,a,l;const e=((o=(n=t.owner)==null?void 0:n.getCanvasDpr)==null?void 0:o.call(n))||1,i=(l=(a=(r=(s=t.owner)==null?void 0:s.options)==null?void 0:r.article)==null?void 0:a.rendering)==null?void 0:l.pixelSnap;return rn(e,i)}function Oi(t){const e=Ri(t);return{top:e(t.position.top),left:e(t.position.left)}}const $a={name:"landscape",draw(t){var ot,J,Q,at;if(!this.isDataLoaded||isNaN(this.position.left))return;const e=this.getCurrentStyle(),i=Ri(this),n=Oi(this),o=n.top,s=n.left,r=e.width,a=e.height,l=e.backgroundColor||"#FFF",c=e.shadow,h=e.borderRadius||0;Hn(t,c),t.fillStyle=l,h>0?(Ve(t,s,o,r,a,h),t.fill()):t.fillRect(s,o,r,a),co(t);let u=s,m=r;if(this.imageLoaded){const C=e.image,q=C.margin,tt=s+q,pt=o+q,mt=a-q*2;let yt,wt,ue,qe;this.image.width>this.image.height?(yt=Pe((this.image.width-this.image.height)/2),wt=0,ue=qe=this.image.height):(yt=0,wt=0,ue=qe=this.image.width);const Ja=C.shape||"square",Po=C.borderRadius||0,ko=(ve,Se,Le,Ke,_e,Ni,xi,zi)=>{Po>0?(t.save(),Ve(t,_e,Ni,xi,zi,Po),t.clip(),t.drawImage(this.image,ve,Se,Le,Ke,_e,Ni,xi,zi),t.restore()):t.drawImage(this.image,ve,Se,Le,Ke,_e,Ni,xi,zi)};switch(Ja){case"circle":{mo(t,this.image,yt,wt,ue,qe,tt,pt,mt);break}case"square":{ko(yt,wt,ue,qe,tt,pt,mt,mt);break}default:{const ve=Math.min(mt/this.image.width,mt/this.image.height),Se=i(this.image.width*ve),Le=i(this.image.height*ve),Ke=i(tt+(mt-Se)/2),_e=i(pt+(mt-Le)/2);ko(0,0,this.image.width,this.image.height,Ke,_e,Se,Le);break}}u=s+mt+q,m=r-mt-q}const d=((at=(Q=(J=(ot=this.owner)==null?void 0:ot.options)==null?void 0:J.article)==null?void 0:Q.star)==null?void 0:at.visible)!==!1&&(this.isActive||this.isStarred);if(d){const C=e.star.width,q=e.star.margin,tt=C+q;m=Math.max(0,m-tt)}const g=e.header.text,p=g.margin,w=g.lineHeight,b=u+p,v=m-p*2,S=g.offsetY||0,M=this.title,P=g.numberOfLines,E=this.memo(`titleLines:${M}:${v}:${g.font}:${P}`,()=>{t.font=g.font;let C=Ze(M,t,v);return C.length>P&&(C=Ue(C,P,t,v)),C}),x=E.length,R=this.memo(`headerMetrics:${g.font}`,()=>(t.font=g.font,t.measureText("Hg"))).actualBoundingBoxAscent,V=`${this.subtitle}`,B=e.subheader.text,z=B.font,it=B.margin,kt=u+it,ut=m-it*2,Ut=B.offsetY||0,N=this.memo(`subtitle:${V}:${ut}:${z}`,()=>{t.font=z;const C=Ze(V,t,ut);return C.length>1?Ue(C,1,t,ut)[0]:C[0]}),dt=this.memo(`subheaderMetrics:${z}`,()=>(t.font=z,t.measureText("Hg"))),ft=dt.actualBoundingBoxAscent,gt=dt.actualBoundingBoxDescent,Gt=x*w,nt=ft+gt,st=Gt+nt;let It=i(o+(a-st)/2)+R+S;t.font=g.font,t.fillStyle=g.color,t.textAlign=g.align,t.textBaseline=g.baseline;for(let C=0;C<E.length;C++)t.fillText(E[C],b,It,v),It+=w;It+=Ut,t.font=B.font,t.fillStyle=B.color,t.textAlign=B.align,t.textBaseline=B.baseline,t.fillText(N,kt,It,ut);const he=e.border;if(he.width>0&&(t.strokeStyle=he.color,t.lineWidth=he.width,h>0?(Ve(t,s,o,r,a,h),t.stroke()):t.strokeRect(s,o,r,a)),d){const C=this.getIconBox(),q=i(C.left+C.width/2),tt=i(C.top+C.height/2),pt=i(Math.min(C.width,C.height)/2),mt=i(pt/2);let yt,wt;this.isStarred?this.isMouseOverStar?(yt="#8A8A8A",wt="#fff800"):(yt="#a5a5a5",wt="#fff800"):this.isMouseOverStar?(yt="#8A8A8A",wt="#dfdfdf"):(yt="#a5a5a5",wt="#ebebeb"),uo(t,q,tt,5,mt,pt,wt,yt)}},getWidth(){return this.getCurrentStyle().width},getHeight(){return this.getCurrentStyle().height},getConnectorEnd(){const t=this.getCurrentStyle(),e=Oi(this);return{left:e.left+t.connectorLine.offsetX,top:e.top+this.getHeight()+t.connectorLine.offsetY}},getIconBox(){var r,a,l,c;if(((c=(l=(a=(r=this.owner)==null?void 0:r.options)==null?void 0:a.article)==null?void 0:l.star)==null?void 0:c.visible)===!1)return!1;const t=this.getCurrentStyle(),e=Ri(this),i=t.star.width,n={width:i,height:i},o=t.borderRadius||0,s=Oi(this);return n.left=e(s.left-o/4+this._getWidth()-n.width-t.star.margin),n.top=e(s.top+o/4+t.star.margin),n},defaultStyle:{width:220,height:70,borderRadius:4,image:{shape:"square",margin:4,borderRadius:4},header:{text:{color:"#333",baseline:"alphabetic"}},subheader:{text:{color:"#777",baseline:"alphabetic"}}},defaultHoverStyle:{border:{color:"#a6c6e2"}},defaultActiveStyle:{header:{text:{color:"#000"}},subheader:{text:{color:"#333"}}}};function $e(t){var n,o,s,r,a,l;const e=((o=(n=t.owner)==null?void 0:n.getCanvasDpr)==null?void 0:o.call(n))||1,i=(l=(a=(r=(s=t.owner)==null?void 0:s.options)==null?void 0:r.article)==null?void 0:a.rendering)==null?void 0:l.pixelSnap;return rn(e,i)}function Ei(t){const e=$e(t);return{top:e(t.position.top),left:e(t.position.left)}}const Xa={name:"portrait",draw(t){var R,V,B,z,it,kt,ut,Ut;const e=this.getCurrentStyle(),i=$e(this),n=e.border.width,o=Math.max(n,((V=(R=this.hoverStyle)==null?void 0:R.border)==null?void 0:V.width)||0,((z=(B=this.activeStyle)==null?void 0:B.border)==null?void 0:z.width)||0),s=e.header.height,r=e.subheader.height,a=Ei(this),l={top:a.top,left:a.left,width:i(this._getWidth()),height:i(this._cachedHeight)},c=i(l.top+n/2),u=i(c+s),m=u+r,d=is(l,o,i);e.shadow&&(Hn(t,e.shadow),t.fillStyle=e.backgroundColor,t.fillRect(l.left,l.top+e.topRadius,l.width,l.height-e.topRadius),co(t)),t.save(),t.beginPath(),ho(t,l.left,l.top,l.width,l.height,e.topRadius),t.clip(),t.fillStyle=e.color,t.fillRect(l.left,l.top,l.width,i(s+n/2)),t.restore(),r!==0&&(t.fillStyle=e.subheader.color,t.fillRect(l.left,u,l.width,r),t.beginPath(),t.lineWidth=1,t.moveTo(d.left+5,u+1),t.lineTo(d.left+10,u-5),t.lineTo(d.left+15,u+1),t.closePath(),t.fill());const g=e.header.text.align;t.fillStyle=e.header.text.color,t.font=e.header.text.font,t.textAlign=g,t.textBaseline=e.header.text.baseline;const p=e.header.text.margin,w=e.header.text.lineHeight,b=d.width-p*2,v=e.header.text.numberOfLines,S=this.memo(`titleLines:${this.title}:${b}:${e.header.text.font}:${v}`,()=>{t.font=e.header.text.font;let N=Ze(this.title,t,b);return N.length>v&&(N=Ue(N,v,t,b)),this.titleLines=N,N}),M=Math.min(v,S.length),P=(M-1)*w,x=c+(s-P)/2,Z=fo(d.left,d.width,g,p,i);for(let N=0;N<M;N++){const dt=i(x+N*w);t.fillText(S[N],Z,dt,b)}if(e.subheader.height!==0){const N=e.subheader.text.align,dt=e.subheader.text.margin,ft=d.width-dt*2;t.textAlign=N,t.textBaseline=e.subheader.text.baseline,t.fillStyle=e.subheader.text.color,t.font=e.subheader.text.font;const gt=`${this.subtitle}`,Gt=this.memo(`subtitle:${gt}:${ft}:${e.subheader.text.font}`,()=>{t.font=e.subheader.text.font;const jt=Ze(gt,t,ft),It=jt.length>1?Ue(jt,1,t,ft)[0]:jt[0];return this.summarisedSubtitle=It,It}),nt=fo(d.left,d.width,N,dt,i),st=i(u+r/2);t.fillText(Gt,nt,st,ft)}if(this.imageLoaded){const N=e.image,dt=N.margin||0,ft=i(l.left+dt),gt=i(m+dt),Gt=Math.max(0,l.width-dt*2),nt=i(Gt);let st;const jt=N.shape||"square";switch(jt){case"circle":case"square":st=nt;break;default:const ot=nt/this.image.width,J=this.image.height*ot,Q=N.maxHeight||e.maxImageHeight||400;st=Math.min(J,Q);break}st=i(st),t.fillStyle=e.backgroundColor,t.fillRect(ft,gt,nt,st);const It=N.borderRadius||0,he=(ot,J,Q,at,C,q,tt,pt)=>{It>0?(t.save(),Ve(t,C,q,tt,pt,It),t.clip(),t.drawImage(this.image,ot,J,Q,at,C,q,tt,pt),t.restore()):t.drawImage(this.image,ot,J,Q,at,C,q,tt,pt)};switch(jt){case"circle":{let ot,J,Q,at;this.image.width>this.image.height?(ot=(this.image.width-this.image.height)/2,J=0,Q=at=this.image.height):(ot=0,J=(this.image.height-this.image.width)/2,Q=at=this.image.width);const C=nt,q=ft,tt=gt;mo(t,this.image,ot,J,Q,at,q,tt,C);break}case"square":{let ot,J,Q,at;this.image.width>this.image.height?(ot=(this.image.width-this.image.height)/2,J=0,Q=at=this.image.height):(ot=0,J=(this.image.height-this.image.width)/2,Q=at=this.image.width);const C=nt;he(ot,J,Q,at,ft,gt,C,C);break}default:{const ot=nt/this.image.width,J=this.image.height*ot,Q=N.maxHeight||e.maxImageHeight||400,at=0;let C=0;const q=this.image.width;let tt=this.image.height;const pt=nt,mt=st,yt=ft,wt=gt;if(J>Q){const ue=Q/J;tt=this.image.height*ue,C=Pe((this.image.height-tt)/2)}he(at,C,q,tt,yt,wt,pt,mt);break}}}if(e.border.width>0&&(t.beginPath(),ho(t,l.left,l.top,l.width,l.height,e.topRadius),t.lineWidth=e.border.width,t.strokeStyle=e.border.color,t.stroke()),((Ut=(ut=(kt=(it=this.owner)==null?void 0:it.options)==null?void 0:kt.article)==null?void 0:ut.star)==null?void 0:Ut.visible)!==!1&&(this.isActive||this.isStarred)){const N=this.getIconBox(),dt=i(N.left+N.width/2),ft=i(N.top+N.height/2),gt=i(Math.min(N.width,N.height)/2),Gt=i(gt/2);let nt,st;this.isStarred?this.isMouseOverStar?(nt="#8A8A8A",st="#fff800"):(nt="#a5a5a5",st="#fff800"):this.isMouseOverStar?(nt="#8A8A8A",st="#dfdfdf"):(nt="#a5a5a5",st="#ebebeb"),uo(t,dt,ft,5,Gt,gt,st,nt)}},getWidth(){return this.getCurrentStyle().width},getHeight(){const t=this.getCurrentStyle(),e=$e(this);let i=0;if(this.imageLoaded){const o=t.image,s=o.margin||0,r=o.shape||"square",a=e(t.width-t.border.width/2-s*2);switch(r){case"circle":case"square":i=a+s*2;break;default:const l=a/this.image.width,c=this.image.height*l,h=t.image.maxHeight||t.maxImageHeight||400;i=Math.min(c,h)+s*2;break}}const n=e(t.header.height+t.subheader.height);return i+n+t.border.width},getConnectorEnd(){const t=this.getCurrentStyle(),e=Ei(this);return{left:e.left+t.connectorLine.offsetX,top:e.top+this.getHeight()+t.connectorLine.offsetY}},getIconBox(){var s,r,a,l;if(((l=(a=(r=(s=this.owner)==null?void 0:s.options)==null?void 0:r.article)==null?void 0:a.star)==null?void 0:l.visible)===!1)return!1;const t=this.getCurrentStyle(),e=$e(this),i=Ei(this),n=t.star.width,o={width:n,height:n};return o.left=e(i.left-t.topRadius/4+this._getWidth()-o.width-t.star.margin),o.top=e(i.top+t.topRadius/4+t.star.margin),o}},Xe=new Map;function qa(t){return typeof t.getWidth!="function"&&(t.getWidth=function(){return this.getCurrentStyle().width}),typeof t.getHeight!="function"&&(t.getHeight=function(){return this.getCurrentStyle().height}),typeof t.getIconBox!="function"&&(t.getIconBox=function(){return!1}),t}function Ka(t){return t&&t.aliasOf?Xe.get(t.aliasOf):t}return f.registerCardLayout=function(e){if(!e||typeof e!="object")throw new Error("Card layout definition must be an object");const{name:i,draw:n,aliasOf:o}=e;if(!i||typeof i!="string")throw new Error("Card layout must have a unique string 'name'");if(o){Xe.set(i,{aliasOf:o});return}if(typeof n!="function")throw new Error(`Card layout "${i}" must implement draw(ctx)`);Xe.set(i,qa(W({},e)));const{defaultStyle:s,defaultHoverStyle:r,defaultActiveStyle:a}=e,l=mi.article.layoutStyles[i]={};s&&(l.style=ei({},s)),r&&(l.hoverStyle=ei({},r)),a&&(l.activeStyle=ei({},a))},f.getCardLayout=function(e){const i=Ka(Xe.get(e));return i||(T.warn(`Unknown card layout "${e}"`),null)},f.prototype._getCurrentCardLayoutName=function(){return this.options.article.defaultCardLayout},f.prototype.registerCardLayout=f.registerCardLayout,f.prototype.getCardLayout=f.getCardLayout,f.registerCardLayout(Xa),f.registerCardLayout($a),f.registerCardLayout({name:"default",aliasOf:"portrait"}),f.prototype.getStatusForSave=function(){const t=this.timescaleManager.startToken.value,e=[],i={};t.hour&&(i.fhr=t.hour),t.minute&&(i.fmi=t.minute),t.second&&(i.fs=t.second),t.millisecond&&(i.fms=t.millisecond);for(let n=0;n<this.articles.length;n++)e.push(this.articles[n].getStatusForSave());return JSON.stringify(zt(W({t:this.title,o:this.ownerId,z:this.timescaleManager.zoom,fy:t.year,fm:t.month,fd:t.day},i),{w:this.repositionWindow,a:e}))},f.prototype._emitTimelineStateChange=function(){this&&this._isInitialized===!0&&(this._hasPendingTimelineStateChange=!1,this.trigger("timeline-state-change",this.getStatusForSave()))},f.prototype._markTimelineStateChanged=function(){this&&this._isInitialized===!0&&(this._hasPendingTimelineStateChange=!0)},f.prototype._flushTimelineStateChange=function(){this&&this._hasPendingTimelineStateChange===!0&&this._emitTimelineStateChange()},zt(W(W({Timeline:f,Article:I,Chart:ct,Lane:et,TimeBand:Dt,Dmy:y},Xo),hs),{Logger:T,setDebug(t){T.setEnabled(!!t)},isDebugEnabled(){return T.isEnabled()},enableDebug(){T.setEnabled(!0)},disableDebug(){T.setEnabled(!1)}})}));
|
|
5
|
+
(function(H,Z){typeof exports=="object"&&typeof module!="undefined"?module.exports=Z():typeof define=="function"&&define.amd?define(Z):(H=typeof globalThis!="undefined"?globalThis:H||self,H.Histropedia=Z())})(this,(function(){"use strict";var Wl=Object.defineProperty,Yl=Object.defineProperties;var Vl=Object.getOwnPropertyDescriptors;var li=Object.getOwnPropertySymbols;var us=Object.prototype.hasOwnProperty,ds=Object.prototype.propertyIsEnumerable;var cs=(H,Z,B)=>Z in H?Wl(H,Z,{enumerable:!0,configurable:!0,writable:!0,value:B}):H[Z]=B,N=(H,Z)=>{for(var B in Z||(Z={}))us.call(Z,B)&&cs(H,B,Z[B]);if(li)for(var B of li(Z))ds.call(Z,B)&&cs(H,B,Z[B]);return H},ot=(H,Z)=>Yl(H,Vl(Z));var fs=(H,Z)=>{var B={};for(var E in H)us.call(H,E)&&Z.indexOf(E)<0&&(B[E]=H[E]);if(H!=null&&li)for(var E of li(H))Z.indexOf(E)<0&&ds.call(H,E)&&(B[E]=H[E]);return B};const H={linear:t=>t,swing:t=>.5-Math.cos(t*Math.PI)/2,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:-1+(4-2*t)*t,easeInCubic:t=>t**3,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>t<.5?4*t**3:1+--t*(2*t)**2};function Z({from:t=0,to:e=1,duration:i=400,easing:n=H.linear,onUpdate:o,onComplete:s,autoStart:r=!0}={}){let a=null,l=!1;function c(u){if(l)return;a===null&&(a=u);const d=i<=0?1:Math.min(1,(u-a)/i),f=n(d),g=t+(e-t)*f;o==null||o(g,f),!l&&(d<1?requestAnimationFrame(c):s==null||s())}function h(){l=!1,a=null,requestAnimationFrame(c)}return r&&h(),{stop(){l=!0},restart(){l=!1,h()}}}const B=0,E=1,ms=2,st=-4,X=-3,J=-2,q=-1,V=0,$=1,it=2,pe=3,vt=4,ye=5,Ji=6,Qi=7,tn=8,en=9,nn=10,on=11,sn="millisecond",rn="second",an="minute",ln="hour",hn="day",gs="month",ps="year",ys="decade",ws="century",bs="millennium",vs="million-years",Ss="billion-years",_s={3:{label:" ka",value:1e3},6:{label:" Ma",value:1e6},9:{label:" Ga",value:1e9}},Ls="low",Ms="medium",As="high",Is="all",Cs="all",Ps="screen",hi=[{region:-26,zoom:{from:Number.NEGATIVE_INFINITY,to:-80.86},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:134217728}},{region:-25,zoom:{from:-80.86,to:-77.75},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:67108864}},{region:-24,zoom:{from:-77.75,to:-74.64},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:33554432}},{region:-23,zoom:{from:-74.64,to:-71.53},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:16777216}},{region:-22,zoom:{from:-71.53,to:-68.42},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:8388608}},{region:-21,zoom:{from:-68.42,to:-65.31},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:4194304}},{region:-20,zoom:{from:-65.31,to:-62.2},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:2097152}},{region:-19,zoom:{from:-62.2,to:-59.09},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:1048576}},{region:-18,zoom:{from:-59.09,to:-55.98},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:524288}},{region:-17,zoom:{from:-55.98,to:-52.87},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:262144}},{region:-16,zoom:{from:-52.87,to:-49.76},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:131072}},{region:-15,zoom:{from:-49.76,to:-46.65},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:65536}},{region:-14,zoom:{from:-46.65,to:-43.54},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:32768}},{region:-13,zoom:{from:-43.54,to:-40.43},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:16384}},{region:-12,zoom:{from:-40.43,to:-37.32},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:8192}},{region:-11,zoom:{from:-37.32,to:-34.21},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:4096}},{region:-10,zoom:{from:-34.21,to:-31.1},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:2048}},{region:-9,zoom:{from:-31.1,to:-27.99},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:1024}},{region:-8,zoom:{from:-27.99,to:-24.88},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:512}},{region:-7,zoom:{from:-24.88,to:-21.77},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:256}},{region:-6,zoom:{from:-21.77,to:-18.66},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:128}},{region:-5,zoom:{from:-18.66,to:-15.55},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:64}},{region:-4,zoom:{from:-15.55,to:-12.44},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:32}},{region:-3,zoom:{from:-12.44,to:-9.33},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:16}},{region:-2,zoom:{from:-9.33,to:-6.22},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:8}},{region:-1,zoom:{from:-6.22,to:-3.11},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:4}},{region:0,zoom:{from:-3.11,to:0},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:2}},{region:1,zoom:{from:0,to:3.11},low:1,medium:2,high:3,all:25,step:{months:0,days:1}},{region:2,zoom:{from:3.11,to:6.22},low:1,medium:2,high:3,all:25,step:{months:0,days:2}},{region:3,zoom:{from:6.22,to:9.33},low:1,medium:2,high:3,all:25,step:{months:0,days:4}},{region:4,zoom:{from:9.33,to:12.44},low:1,medium:2,high:3,all:25,step:{months:0,days:8}},{region:5,zoom:{from:12.44,to:15.55},low:1,medium:2,high:3,all:25,step:{months:0,days:16}},{region:6,zoom:{from:15.55,to:18.66},low:1,medium:2,high:3,all:25,step:{months:0,days:32}},{region:7,zoom:{from:18.66,to:21.77},low:1,medium:2,high:3,all:25,step:{months:0,days:64}},{region:8,zoom:{from:21.77,to:24.88},low:1,medium:2,high:3,all:25,step:{months:0,days:128}},{region:9,zoom:{from:24.88,to:27.99},low:1,medium:2,high:3,all:25,step:{months:0,days:256}},{region:10,zoom:{from:27.99,to:31.1},low:1,medium:2,high:3,all:25,step:{months:0,days:512}},{region:11,zoom:{from:31.1,to:34.21},low:1,medium:2,high:3,all:25,step:{months:0,days:1024}},{region:12,zoom:{from:34.21,to:37.32},low:1,medium:2,high:3,all:25,step:{months:0,days:2048}},{region:13,zoom:{from:37.32,to:40.43},low:1,medium:2,high:3,all:25,step:{months:0,days:4096}},{region:14,zoom:{from:40.43,to:43.54},low:1,medium:2,high:3,all:25,step:{months:0,days:8192}},{region:15,zoom:{from:43.54,to:46.65},low:1,medium:2,high:3,all:25,step:{months:0,days:16384}},{region:16,zoom:{from:46.65,to:49.76},low:1,medium:2,high:3,all:25,step:{months:0,days:32768}},{region:17,zoom:{from:49.76,to:52.87},low:1,medium:2,high:3,all:25,step:{months:0,days:65536}},{region:18,zoom:{from:52.87,to:55.98},low:1,medium:2,high:3,all:25,step:{months:0,days:131072}},{region:19,zoom:{from:55.98,to:59.09},low:1,medium:2,high:3,all:25,step:{months:0,days:262144}},{region:20,zoom:{from:59.09,to:62.2},low:1,medium:2,high:3,all:25,step:{months:0,days:524288}},{region:21,zoom:{from:62.2,to:65.31},low:1,medium:2,high:3,all:25,step:{months:0,days:1048576}},{region:22,zoom:{from:65.31,to:68.42},low:1,medium:2,high:3,all:25,step:{months:0,days:2097152}},{region:23,zoom:{from:68.42,to:71.53},low:1,medium:2,high:3,all:25,step:{months:0,days:4194304}},{region:24,zoom:{from:71.53,to:74.64},low:1,medium:2,high:3,all:25,step:{months:0,days:8388608}},{region:25,zoom:{from:74.64,to:77.75},low:1,medium:2,high:3,all:25,step:{months:0,days:16777216}},{region:26,zoom:{from:77.75,to:80.86},low:1,medium:2,high:3,all:25,step:{months:0,days:33554432}},{region:27,zoom:{from:80.86,to:83.97},low:1,medium:2,high:3,all:25,step:{months:0,days:67108864}},{region:28,zoom:{from:83.97,to:87.08},low:1,medium:2,high:3,all:25,step:{months:0,days:134217728}},{region:29,zoom:{from:87.08,to:90.19},low:1,medium:2,high:3,all:25,step:{months:0,days:268435456}},{region:30,zoom:{from:90.19,to:93.3},low:1,medium:2,high:3,all:25,step:{months:0,days:536870912}},{region:31,zoom:{from:93.3,to:96.41},low:1,medium:2,high:3,all:25,step:{months:0,days:1073741824}},{region:32,zoom:{from:96.41,to:99.52},low:1,medium:2,high:3,all:25,step:{months:0,days:2147483648}},{region:33,zoom:{from:99.52,to:102.63},low:1,medium:2,high:3,all:25,step:{months:0,days:4294967296}},{region:34,zoom:{from:102.63,to:105.74},low:1,medium:2,high:3,all:25,step:{months:0,days:8589934592}},{region:35,zoom:{from:105.74,to:108.85},low:1,medium:2,high:3,all:25,step:{months:0,days:17179869184}},{region:36,zoom:{from:108.85,to:111.96},low:1,medium:2,high:3,all:25,step:{months:0,days:34359738368}},{region:37,zoom:{from:111.96,to:115.07},low:1,medium:2,high:3,all:25,step:{months:0,days:68719476736}},{region:38,zoom:{from:115.07,to:118.18},low:1,medium:2,high:3,all:25,step:{months:0,days:137438953472}},{region:39,zoom:{from:118.18,to:121.29},low:1,medium:2,high:3,all:25,step:{months:0,days:274877906944}},{region:40,zoom:{from:121.29,to:124.4},low:1,medium:2,high:3,all:25,step:{months:0,days:549755813888}}],Ds=Object.freeze(Object.defineProperty({__proto__:null,DENSITY_ALL:Is,DENSITY_HIGH:As,DENSITY_LOW:Ls,DENSITY_MEDIUM:Ms,DENSITY_SETTINGS:hi,ERA_MARKER:ms,MAJOR_MARKER:E,MINOR_MARKER:B,PRECISION_BILLION_YEARS:Ss,PRECISION_CENTURY:ws,PRECISION_DAY:hn,PRECISION_DECADE:ys,PRECISION_HOUR:ln,PRECISION_MILLENNIUM:bs,PRECISION_MILLION_YEARS:vs,PRECISION_MILLISECOND:sn,PRECISION_MINUTE:an,PRECISION_MONTH:gs,PRECISION_SECOND:rn,PRECISION_YEAR:ps,RANGE_ALL:Cs,RANGE_SCREEN:Ps,YEAR_PREFIXES:_s,ZOOM_100_MILLION_YEARS:nn,ZOOM_100_THOUSAND_YEARS:Qi,ZOOM_10_MILLION_YEARS:en,ZOOM_10_THOUSAND_YEARS:Ji,ZOOM_BILLION_YEARS:on,ZOOM_CENTURY:vt,ZOOM_DAY:V,ZOOM_DECADE:pe,ZOOM_HOUR:q,ZOOM_MILLENNIUM:ye,ZOOM_MILLION_YEARS:tn,ZOOM_MILLISECOND:st,ZOOM_MINUTE:J,ZOOM_MONTH:$,ZOOM_SECOND:X,ZOOM_YEAR:it},Symbol.toStringTag,{value:"Module"}));class Ts{constructor(){this._enabled=!1,this._prefix="[Histropedia]";const e=typeof console!="undefined"?console:null;this._console=e,this._fns={log:e&&e.log?e.log.bind(e):()=>{},warn:e&&e.warn?e.warn.bind(e):()=>{},error:e&&e.error?e.error.bind(e):()=>{},info:e&&e.info?e.info.bind(e):()=>{},debug:e&&e.debug?e.debug.bind(e):e&&e.log?e.log.bind(e):()=>{},group:e&&e.group?e.group.bind(e):e&&e.log?e.log.bind(e):()=>{},groupCollapsed:e&&e.groupCollapsed?e.groupCollapsed.bind(e):e&&e.group?e.group.bind(e):e&&e.log?e.log.bind(e):()=>{},groupEnd:e&&e.groupEnd?e.groupEnd.bind(e):()=>{}}}setEnabled(e){this._enabled=!!e}isEnabled(){return!!this._enabled}setPrefix(e){this._prefix=String(e||"")}getPrefix(){return this._prefix}_withPrefixedArgs(e){if(!this._prefix)return e;if(e&&e.length>0&&typeof e[0]=="string"){const i=e.slice();return i[0]=`${this._prefix} ${i[0]}`,i}return[this._prefix,...e]}_log(e,i){if(!this._enabled)return;(this._fns[e]||this._fns.log)(...this._withPrefixedArgs(i))}log(...e){this._log("log",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}group(...e){this._enabled&&this._fns.group(...this._withPrefixedArgs(e))}groupCollapsed(...e){this._enabled&&this._fns.groupCollapsed(...this._withPrefixedArgs(e))}groupEnd(){this._enabled&&this._fns.groupEnd()}}const W=new Ts,Ee=[31,28,31,30,31,30,31,31,30,31,30,31],Os=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],cn={1:"billion-years",3:"million-years",6:"millennium",7:"century",8:"decade",9:"year",10:"month",11:"day",12:"hour",13:"minute",14:"second",15:"millisecond"},Rs=/^(-?\d+)(?:-(\d{1,2}))?(?:-(\d{1,2}))?(?:[T ](\d{1,2})(?::(\d{1,2}))?(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?$/,xt=1e3,Nt=60*xt,Et=60*Nt,j=24*Et;function ci(t){return Object.prototype.hasOwnProperty.call(cn,t)?cn[t]:t||"day"}function we(t){if(t.precision!==void 0)return t.precision;if(!(t instanceof b)){for(const e of[sn,rn,an,ln])if(t[e]!==void 0)return e}return hn}function qt(t,e){if(t<=0){const n=1-t,o=Math.ceil(n/e)*e;return{startYear:1-o,endYear:e-o}}const i=Math.ceil(t/e)*e;return{startYear:i-e+1,endYear:i}}function un(t){if(t<=0){const i=Math.floor((1-t)/10)*10;return{startYear:1-(i+9),endYear:1-Math.max(1,i)}}const e=Math.floor(t/10)*10;return{startYear:Math.max(1,e),endYear:e+9}}function ze(t,e,i,n){const o=Number(t);return Number.isFinite(o)?Math.min(n,Math.max(i,Math.trunc(o))):e}function dn(t,e,i,n,o){const s={hour:ze(e,0,0,23),minute:ze(i,0,0,59),second:ze(n,0,0,59),millisecond:ze(o,0,0,999)};for(const[r,a]of Object.entries(s))Object.defineProperty(t,r,{value:a,enumerable:a!==0,configurable:!0,writable:!0})}function ks(t,e){e!==void 0&&Object.defineProperty(t,"precision",{value:e,enumerable:!1,configurable:!0,writable:!0})}function $t(t,e){return new b(ot(N({},e),{precision:we(t)}))}function b(t,e,i,n,o,s,r){if(typeof t=="object"){const a=t;this.year=a.year,this.month=a.month,this.day=fn(a.year,a.month,a.day),dn(this,a.hour,a.minute,a.second,a.millisecond),ks(this,we(a))}else this.year=t,this.month=e,this.day=fn(t,e,i),dn(this,n,o,s,r)}function fn(t,e,i){return i>28?Math.min(i,Kt(t,e)):i}function Kt(t,e){return e===2&&(t%4===0&&t%100!==0||t%400===0)?29:Ee[e-1]}function Fe(t,e){return t=t.toString(),e=typeof e=="string"?e:",",t.length<=4?t:t.replace(/\B(?=(\d{3})+(?!\d))/g,e)}b.prototype.getDaysTo=function(t){const e=t.getDaysSinceYearZero()-this.getDaysSinceYearZero(),i=t.getMillisecondsOfDay()-this.getMillisecondsOfDay();return e+i/j},b.prototype.getMillisecondsOfDay=function(){return this.hour*Et+this.minute*Nt+this.second*xt+this.millisecond},b.prototype.getMonthsTo=function(t){return this.getYearsTo(t)*12},b.prototype.getYearsTo=function(t){let e=t.year-this.year;return e+=(t.month-this.month)/12+(t.day-this.day)/365.2422+(t.getMillisecondsOfDay()-this.getMillisecondsOfDay())/(j*365.2422),e},b.prototype.getLeapYearsSinceYearZero=function(){let t=this.year;return this.month<3&&t--,Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400)},b.prototype.getDaysSinceYearZero=function(){let e=this.year*365+this.day;for(let i=0;i<this.month-1;i++)e+=Ee[i];return e+=this.getLeapYearsSinceYearZero(),e},b.prototype.getDayOfYear=function(){let t=this.day;for(let e=1;e<this.month;e++)t+=Kt(this.year,e);return t},b.getByDayOfYear=function(t,e){const i=new b(t,1,1);let n=Ee[0];for(let o=0;o<e-1;o++)i.day++,i.day>n&&(i.day=1,i.month++,i.month>12&&(i.month=1,i.year++),n=i.month===2?Kt(i.year,i.month):Ee[i.month-1]);return i},b.prototype.getNextDay=function(){return this.addDays(1)},b.prototype.addDays=function(t){let e=this.day,i=this.month,n=this.year;const o=t<0?-1:1;let s=Math.abs(Math.trunc(t));for(;s>0;)o>0?(e++,e>Kt(n,i)&&(e=1,i++,i>12&&(i=1,n++))):(e--,e<1&&(i--,i<1&&(i=12,n--),e=Kt(n,i))),s--;return $t(this,{year:n,month:i,day:e,hour:this.hour,minute:this.minute,second:this.second,millisecond:this.millisecond})},b.prototype.addMilliseconds=function(t){let e=this,i=this.getMillisecondsOfDay()+Math.trunc(t);for(;i<0;)e=e.addDays(-1),i+=j;for(;i>=j;)e=e.addDays(1),i-=j;const n=Math.floor(i/Et);i-=n*Et;const o=Math.floor(i/Nt);i-=o*Nt;const s=Math.floor(i/xt),r=i-s*xt;return $t(this,{year:e.year,month:e.month,day:e.day,hour:n,minute:o,second:s,millisecond:r})},b.prototype.addSeconds=function(t){return this.addMilliseconds(t*xt)},b.prototype.addMinutes=function(t){return this.addMilliseconds(t*Nt)},b.prototype.addHours=function(t){return this.addMilliseconds(t*Et)},b.prototype.addMonths=function(t){let e=this.month,i=this.year;for(let n=0;n<t;n++)e++,e>12&&(e=1,i++);return $t(this,{year:i,month:e,day:1})},b.prototype.getPreviousDay=function(){return this.addDays(-1)},b.prototype.getNextMonth=function(){let t=this.month,e=this.year;return t++,t>12&&(t=1,e++),$t(this,{year:e,month:t,day:1})},b.prototype.getPreviousMonth=function(){let t=this.month,e=this.year;return t--,t<1&&(t=12,e--),$t(this,{year:e,month:t,day:1})},b.prototype.addYears=function(t){return $t(this,{year:this.year+t,month:1,day:1})};function Be(t,e){return String(t).padStart(e,"0")}b.prototype.format=function(t,e){e=e||{},t=t||"D MMM YYYY";const i=e.yearPrefix,n=typeof e.bceText=="string"?e.bceText:" ʙᴄᴇ",o=this.year<=0,s=this.year===0,r=e.thousandsSeparator;if(i&&!s){const a=i.value||1,l=i.label||"";let c;return o?c=Fe((-this.year+1)/a,r)+l+n:c=Fe(this.year/a,r)+l,c}return t.replace("YYYY",o?Fe(-this.year+1,r)+n:Fe(this.year,r)).replace("D",this.day).replace("MMM",Os[this.month-1]).replace("HH",Be(this.hour,2)).replace("mm",Be(this.minute,2)).replace("ss",Be(this.second,2)).replace("SSS",Be(this.millisecond,3))},b.prototype.isSame=function(t){return t.year===this.year&&t.month===this.month&&t.day===this.day&&(t.hour||0)===this.hour&&(t.minute||0)===this.minute&&(t.second||0)===this.second&&(t.millisecond||0)===this.millisecond},b.prototype.toKeyString=function(){const t=`${this.year}|${this.month}|${this.day}`;return this.getMillisecondsOfDay()===0?t:`${t}|${this.hour}|${this.minute}|${this.second}|${this.millisecond}`},b.prototype.isAfter=function(t){const e=["year","month","day","hour","minute","second","millisecond"];for(let i=0;i<e.length;i++){const n=e[i],o=this[n]||0,s=t[n]||0;if(o!==s)return o>s}return!1},b.prototype.isBetween=function(t,e){return this.isAfter(t)&&e.isAfter(this)},b.prototype.compare=function(t){return this.isSame(t)?0:this.isAfter(t)?1:-1},b.prototype.asFloat=function(){const t=this.month-1,e=this.day-1,i=this.getMillisecondsOfDay()/j;return t===0&&e===0&&i===0?this.year:Math.round((this.year+(t*31+e+i)/371)*100)/100},b.prototype.isInFuture=function(){const t=new Date,e=new b(t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return this.isAfter(e)},b.prototype.convertToIso=function(){return this.year<0&&(this.year+=1),this},b.CreateAsStartOfPeriod=function(t,e){const i=t.year,n=t.month||1,o=t.day||1;if(e=ci(e),e==="millisecond")return new b(t);if(e==="second")return new b(i,n,o,t.hour,t.minute,t.second,0);if(e==="minute")return new b(i,n,o,t.hour,t.minute,0,0);if(e==="hour")return new b(i,n,o,t.hour,0,0,0);if(e==="day")return new b(i,n,o);if(e==="month")return new b(i,n,1);if(e==="year")return new b(i,1,1);if(e==="million-years"||e==="billion-years"){const s=e==="million-years"?1e6:1e9;return new b(i<=0?qt(i,s).startYear:i,1,1)}return e==="decade"?new b(un(i).startYear,1,1):e==="century"?new b(qt(i,100).startYear,1,1):e==="millennium"?new b(qt(i,1e3).startYear,1,1):new b(i,n,o)},b.CreateAsEndOfPeriod=function(t,e){const i=t.year,n=t.month||1,o=t.day||1;if(e=ci(e),e==="millisecond")return new b(t);if(e==="second")return new b(i,n,o,t.hour,t.minute,t.second,999);if(e==="minute")return new b(i,n,o,t.hour,t.minute,59,999);if(e==="hour")return new b(i,n,o,t.hour,59,59,999);if(e==="day")return new b(i,n,o);if(e==="month")return new b(i,n,Kt(i,n));if(e==="year")return new b(i,12,31);if(e==="decade")return new b(un(i).endYear,12,31);if(e==="century")return new b(qt(i,100).endYear,12,31);if(e==="millennium")return new b(qt(i,1e3).endYear,12,31);if(e==="million-years"||e==="billion-years"){const s=e==="million-years"?1e6:1e9;return new b(i<=0?qt(i,s).endYear:i+s-1,12,31)}return W.error("precision is not implemented"),new b(i,n,o)},b.CreateAsExclusiveEndOfPeriod=function(t,e){e=ci(e);const i=b.CreateAsStartOfPeriod(t,e);return e==="millisecond"?i.addMilliseconds(1):e==="second"?i.addSeconds(1):e==="minute"?i.addMinutes(1):e==="hour"?i.addHours(1):e==="day"?i.addDays(1):b.CreateAsEndOfPeriod(t,e).addDays(1)},b.now=function(){const t=new Date;return new b({year:t.getYear()+1900,month:t.getMonth()+1,day:t.getDate()})};function ui(t){const e=String(t).match(Rs);if(!e)return null;const i=parseInt(e[1],10),n=e[2]==null?1:parseInt(e[2],10),o=e[3]==null?1:parseInt(e[3],10),s=e[4]==null?0:parseInt(e[4],10),r=e[5]==null?0:parseInt(e[5],10),a=e[6]==null?0:parseInt(e[6],10),l=e[7]?parseInt(e[7].padEnd(3,"0"),10):0;return{date:new b(i,n,o,s,r,a,l),hasMonth:e[2]!=null,hasDay:e[3]!=null,hasTime:e[4]!=null}}b.fromString=function(t){const e=ui(t);return e?e.date:new b(NaN,1,1)};const U=Symbol("Histropedia.UNSET");function tt(t,e){for(const i of e.split(".")){if(t===U)return!0;t=t==null?void 0:t[i]}return t!==void 0}function mn(t,e){for(const i of e)t=Object.prototype.hasOwnProperty.call(t||{},i)?t[i]:void 0;return t}function di(t,...e){return Object.assign(t,...e)}function D(t,...e){for(const i of e)fi(t,i);return be(t),t}function nt(t,e,i){return fi(t,e,{path:[],resolveUnset:i})}function be(t){if(t&&typeof t=="object"&&!Object.prototype.hasOwnProperty.call(t,"__proto__"))try{Object.defineProperty(t,"__proto__",{value:void 0,writable:!0,enumerable:!1,configurable:!0})}catch(e){}}const gn=t=>t==="__proto__"||t==="constructor"||t==="prototype",He=t=>{if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null};function pn(t,e){if(He(e)){const i=He(t)?t:{};for(const n of Object.keys(i))Object.prototype.hasOwnProperty.call(e,n)||delete i[n];for(const n of Object.keys(e))gn(n)||(i[n]=pn(i[n],e[n]));return be(i),i}return Array.isArray(e)?e.slice():e}function fi(t,e,i){var n;if(be(t),e&&typeof e=="object")for(const o of Object.keys(e)){if(gn(o))continue;const s=e[o];if(s===U&&i){const r=(n=i.resolveUnset)==null?void 0:n.call(i,[...i.path,o]);r!==void 0?t[o]=pn(t[o],r):delete t[o];continue}if(Array.isArray(s)){t[o]=s.slice();continue}if(He(s)){const r=He(t[o])?t[o]:{};be(r),i&&i.path.push(o),t[o]=fi(r,s,i),i&&i.path.pop();continue}t[o]=s}return be(t),t}function ct(t,e){const i=t.split("."),n=i[i.length-1];let o={};o[n]=e;for(let s=i.length-2;s>=0;s--){const r=i[s],a=D({},o);o={},o[r]=a}return o}function yn(t,e){const i=`_${e}`;t[i]=void 0,Object.defineProperty(t,e,{get(){const n=this[i];return typeof n=="function"?n(this):n},set(n){this[i]=n},enumerable:!0,configurable:!1})}function We(t){return typeof t=="undefined"}const wn={id:"i",title:"t",rank:"r",subtitle:"s","from.year":"fy","from.month":"fm","from.day":"fd","from.hour":"fhr","from.minute":"fmi","from.second":"fs","from.millisecond":"fms","from.precision":"fp","to.year":"ty","to.month":"tm","to.day":"td","to.hour":"thr","to.minute":"tmi","to.second":"ts","to.millisecond":"tms","to.precision":"tp",isToPresent:"p",isStarred:"v","offset.left":"ol","offset.top":"ot",imageUrl:"m",lane:"ln",style:"st",activeStyle:"ast",hiddenByFilter:"h",hidePeriodLine:"hp"};function bn(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:t[wn[e]]}function vn(t,e){const n=e.split(".").reduce((o,s)=>o?o[s]:void 0,t);return We(n)?t[wn[e]]:n}function Sn(t){return t.indexOf(".")>-1}function I(t,e){return Sn(e)?vn(t,e):bn(t,e)}function Ye(t,e){const i=we(Object.fromEntries(["precision","hour","minute","second","millisecond"].map(o=>[o,I(t,`${e}.${o}`)]))),n=Object.fromEntries(["year","month","day","hour","minute","second","millisecond"].map(o=>[o,parseInt(I(t,`${e}.${o}`))]));return new b(ot(N({},n),{precision:i}))}function R(t,e){return Sn(e)?!We(vn(t,e)):!We(bn(t,e))}yn(M.prototype,"hidePeriodLine"),yn(M.prototype,"hiddenByFilter");function M(t,e){this.id=e,this.owner=t,this.isDataLoaded=!1,this.imageLoaded=!1,this.stacking=0,this.groupIndex=0,this.isActive=!1,this.isVisible=!1,this.isVisibleInLane=!0,this.isInRange=!1,this.isInView=!1,this.isVisibleInGroup=!1,this.isVisibleInRows=!0,this.isStarred=!1,this.isMouseOverStar=!1,this.isMouseover=!1,this.isDragging=!1,this.registeredPosition={left:0,top:0},this.position={left:0,top:0},this.dragStartOffset={left:0,top:0},this.indicator={fromX:0,toX:0},this.offset={left:0,top:0},this.finalOffset={left:0,top:0},this.isVisibleAfterFade=!1,this.opacity=0,this.fadeAnimation={finalOpacity:0,dummyElement:null},this.moveAnimation={finalOffset:{left:0,top:0},dummyElement:void 0},this.row=0,this.laneId=null,this.laneOrder=0,this.isFading=!1,this.isMoving=!1,this._cachedHeight=0,this._cachedWidth=0,this._sizeValid=!1,this._sizeCacheKey=null,this._layoutCaches=null,this._textBlockLayouts=null,this._resolvedDefaultCardLayout=null,this._resolvedCardLayoutName=null}M.prototype.setupByReceivedData=function(t){this.owner._assignArticleToLane(this,this.owner._resolveLaneIdFromArticleData(t));const e=this.owner._getResolvedArticleOptions(this).defaultData,i=D({},e,t);R(t,"to")||delete i.to,this.data=D({},t),this.title=I(i,"title")||"",this.rank=I(i,"rank")||0,this.subtitle=I(i,"subtitle")||"",this._setupArticlePeriod(i),this.offset.left=this.finalOffset.left=this.moveAnimation.finalOffset.left=i.offsetLeft||0,this.offset.top=this.finalOffset.top=this.moveAnimation.finalOffset.top=i.offsetTop||0,this.isStarred=!!i.starred,this.cardLayout=I(i,"cardLayout")||null,this.initialiseStyles(i),this.hiddenByFilter=I(i,"hiddenByFilter"),this.hidePeriodLine=R(i,"hidePeriodLine")?I(i,"hidePeriodLine"):this.owner.options.article.periodLine.defaultHide,this.isDataLoaded=!0,this.isImageInfoLoaded=!1},M.prototype._setupArticlePeriod=function(t){let e=Ye(t,"from");e=this.owner.getDmyFromInput(e);const i=e.precision,n=I(t,"isToPresent"),o=n===!0||n===1;let s,r;o?s=b.now():R(t,"to")?(s=Ye(t,"to"),s=this.owner.getDmyFromInput(s),r=s.precision):(s=e,r=i);const a=b.CreateAsStartOfPeriod(e,i),l=b.CreateAsExclusiveEndOfPeriod(s,r);this.period={from:a,to:l,isToPresent:o},this.period.years=this.period.to.asFloat()-this.period.from.asFloat()},M.prototype.setImage=function(){this.isImageInfoLoaded=!0,I(this.data,"imageUrl")?this.owner.enqueueImageLoad(this):(this._releaseImageResource(),this.image=null,this.imageLoaded=!1)},M.prototype._releaseImageResource=function(t={}){const e=typeof this._closeImage=="function"?this._closeImage:null;if(e){this._closeImage=null;try{e(t)}catch(i){}return}t.keepState||(this.image=null,this.imageLoaded=!1,this._loadedImageKey=null)},M.prototype.registerPosition=function(t){this.registeredPosition=this.position=t},M.prototype.overlaps=function(t){return t.period.from.isSame(this.period.from)&&t.period.to.isSame(this.period.to)||t.period.from.isBetween(this.period.from,this.period.to)||t.period.to.isBetween(this.period.from,this.period.to)||this.period.from.isBetween(t.period.from,t.period.to)||this.period.to.isBetween(t.period.from,t.period.to)},M.prototype.overlapsInclusiveWithDates=function(t,e){return!(this.period.from.isAfter(e)||t.isAfter(this.period.to))},M.prototype.overlapsInclusive=function(t){return this.overlapsInclusiveWithDates(t.period.from,t.period.to)},M.prototype.isInside=function(t){if(!this.isVisible)return!1;this._ensureSizeCache();const e=this.position.left,i=this.position.top,n=this._cachedWidth,o=this._cachedHeight;return t.left>=e&&t.left<=e+n&&t.top>=i&&t.top<=i+o},M.prototype.pointerEnter=function(t){this.isMouseover=!0,this.owner.trigger("article-pointerenter",this,t)},M.prototype.pointerLeave=function(t){this.isMouseover=!1,this.owner.trigger("article-pointerleave",this,t)},M.prototype.updateIsMouseOverStar=function(t){const e=this.getIconBox();if(!e)return!1;const i=this.isMouseOverStar;return this.isMouseOverStar=t.left>=e.left&&t.left<=e.left+e.width&&t.top>=e.top&&t.top<=e.top+e.height,this.isMouseOverStar!==i&&!this.owner.isAnimating&&this.owner.redraw(),this.isMouseOverStar},M.prototype.getCursor=function(t){const e=this.owner.options.style.cursor;return this.isDragging?e.article.dragging:(this.updateIsMouseOverStar(t),this.owner.options.article.draggable&&this.isActive?this.isMouseOverStar?e.clickable:e.article.hoverDraggable:e.clickable)},M.prototype.clicked=function(t){return this.updateIsMouseOverStar(t),this.isMouseOverStar?(this.isStarred=!this.isStarred,!0):!1},M.prototype.getStatusForSave=function(){const t={i:this.id};return this.offset.left!==0&&(t.l=this.offset.left),this.offset.top!==0&&(t.t=this.offset.top),this.isStarred&&(t.v=!0),t},M.prototype.headerOverlapsWith=function(t,e=this.getWidth(),i=t.getWidth()){const n=this.registeredPosition.left,o=t.registeredPosition.left,s=n+e;return o+i>=n&&s>=o},M.prototype._getWidth=function(){return this.getWidth()},M.prototype.getWidth=function(){return this._ensureSizeCache(),this._cachedWidth},M.prototype.getHeight=function(){return this._ensureSizeCache(),this._cachedHeight},M.prototype.setOption=function(t,e){let i=!1;if(typeof t=="string"){if(typeof e=="undefined")return I(this.data,t);t=ct(t,e)}let n=!1;nt(this.data,t,()=>{n=!0});const o=n?D({},this.owner._getResolvedArticleOptions({laneId:this.owner._resolveLaneIdFromArticleData(this.data)}).defaultData,this.data):t;n&&!R(this.data,"to")&&delete o.to,R(t,"id")&&(this.id=o.id),R(t,"title")&&(this.title=t.title===U?o.title||"":o.title,this.titleLines=void 0),R(t,"subtitle")&&(this.subtitle=t.subtitle===U?o.subtitle||"":o.subtitle,this.summarisedSubtitle=void 0),(R(t,"from")||R(t,"to")||R(t,"isToPresent"))&&(this._setupArticlePeriod(n?o:this.data),i=!0),R(t,"imageUrl")&&this.setImage(),R(t,"rank")&&(this.rank=o.rank,i=!0),R(t,"starred")&&(this.isStarred=o.starred),R(t,"hiddenByFilter")&&(this.hiddenByFilter=o.hiddenByFilter),R(t,"hidePeriodLine")&&(this.hidePeriodLine=o.hidePeriodLine);const s=R(t,"lane");s&&(this.owner._assignArticleToLane(this,o.lane),this.initialiseStyles(this.data),this.invalidateCaches(),i=!0);const r=R(t,"style"),a=R(t,"activeStyle"),l=R(t,"hoverStyle");(r||l||a)&&this.initialiseStyles(this.data),this.invalidateCaches(),R(t,"cardLayout")&&(t.cardLayout===U?(this.cardLayout=o.cardLayout||null,this.initialiseStyles(this.data)):this.setCardLayout(t.cardLayout)),s&&this.owner.updateArticlesGroupIndex(),i?this.owner.requestRedraw():this.owner.requestRedraw(this.redraw)},M.prototype.initialiseStyles=function(t=this.data){const e=this.owner._resolveDefaultCardLayoutName(this),n=this.owner._getExplicitArticleCardLayout(this)||e;this._resolvedDefaultCardLayout=e,this._resolvedCardLayoutName=n;const o=this.owner._getResolvedArticleStyleOverrides(this,n),s=D({},o.style,I(t,"style")||{}),r=D({},o.activeStyle,I(t,"activeStyle")||{}),a=D({},o.hoverStyle,I(t,"hoverStyle")||{});this.style=s,this.activeStyle=D({},s,r),this.hoverStyle=D({},s,a),this.activeHoverStyle=D({},s,a,r)},M.prototype.setStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return I(this.style,t);t=ct(t,e)}this.data.style=nt(this.data.style||{},t),this.initialiseStyles(this.data),this.invalidateCaches(),this.owner.requestRedraw()},M.prototype.setHoverStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return I(this.activeStyle,t);t=ct(t,e)}let i=!1;this.data.hoverStyle=nt(this.data.hoverStyle||{},t,()=>{i=!0}),this.initialiseStyles(this.data),i&&this.invalidateCaches(),this.owner.requestRedraw()},M.prototype.setActiveStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return I(this.activeStyle,t);t=ct(t,e)}let i=!1;this.data.activeStyle=nt(this.data.activeStyle||{},t,()=>{i=!0}),this.initialiseStyles(this.data),i&&this.invalidateCaches(),this.owner.requestRedraw()},M.prototype.activated=function(){W.warn('DEPRECATION WARNING: article.activated() was deprecated in v1.3.0. Use timeline.select(article.id) and handle selection with options.on["article-select"] instead.'),this.owner.trigger("article-click",this)},M.prototype.updateVisibility=function(){const t=this.isVisibleAfterFade,e=this.isInRange&&this.isVisibleInLane&&this.isVisibleInGroup&&this.isVisibleInRows&&!this.isHiddenByFilter;if(!this.isVisibleInLane){this.setVisibility(!1);return}if(t!==e){if(e&&!this.isImageInfoLoaded&&this.setImage(),!this.owner.options.article.animation.fade.active){this.setVisibility(e);return}this.setVisibilityWithFade(e)}},M.prototype.setVisibility=function(t){var e,i,n,o;this.isFading&&((i=(e=this.fadeAnimation)==null?void 0:e.dummyElement)!=null&&i.stop)&&(this.fadeAnimation.dummyElement.stop(),this.isFading=!1,((o=(n=this.owner)==null?void 0:n.lastAnimatingArticle)==null?void 0:o.id)===this.id&&this.owner.lastAnimatingArticle.animationType==="fade"&&(this.owner.isAnimatingArticles=!1)),this.isVisible=t,this.isVisibleAfterFade=t,this.opacity=t?1:0,t||this._releaseImageResource({skipRedraw:!0})},M.prototype.setVisibilityWithFade=function(t){var c,h,u,d;const e=this;if(t===e.isVisibleAfterFade)return;e.isFading&&((h=(c=e.fadeAnimation)==null?void 0:c.dummyElement)!=null&&h.stop)&&e.fadeAnimation.dummyElement.stop(),e.isFading=!0,e.isVisibleAfterFade=t,e.fadeAnimation=e.fadeAnimation||{},e.fadeAnimation.finalOpacity=t,t&&(e.isVisible=!0),e.owner.notifyArticleAnimating("fade",e.id);const i=e.owner.options.article.animation.fade,n=(u=i.duration)!=null?u:400,o=(d=i.easing)!=null?d:"swing",s=H[o]||H.swing,r=e.opacity,l=Z({from:r,to:t?1:0,duration:n,easing:s,onUpdate(f){e.opacity=f,e.owner.requestRedraw(e.owner.redraw)},onComplete(){e.isFading=!1,t||(e.isVisible=!1,e._releaseImageResource({skipRedraw:!0}));const f=e.owner.lastAnimatingArticle;e.id===f.id&&f.animationType==="fade"&&(e.owner.isAnimatingArticles=!1),typeof i.complete=="function"&&i.complete.call(e)}});e.fadeAnimation.dummyElement=l},M.prototype.moveToOffset=function(t){this.finalOffset.top=this.offset.top=t.top||this.offset.top,this.finalOffset.left=this.offset.left=t.left||this.offset.left,this.position.top=this.registeredPosition.top+this.offset.top,this.position.left=this.registeredPosition.left+this.offset.left},M.prototype.moveTo=function(t){const e={left:t.left-this.registeredPosition.left,top:t.top-this.registeredPosition.top};this.moveToOffset(e)},M.prototype.moveToWithAnim=function(t){const e={left:t.left-this.registeredPosition.left,top:t.top-this.registeredPosition.top};this.moveToOffsetWithAnim(e)},M.prototype.moveToOffsetWithAnim=function(t){var d,f,g;const e=this,i=e.moveAnimation;if(t.top===i.finalOffset.top&&t.left===i.finalOffset.left)return;e.isMoving&&((d=i==null?void 0:i.dummyElement)!=null&&d.stop)&&i.dummyElement.stop(),i.finalOffset=this.finalOffset={left:t.left,top:t.top},e.isMoving=!0,e.owner.notifyArticleAnimating("move",e.id);const n=e.owner.options.article.animation.move,o=(f=n.duration)!=null?f:400,s=(g=n.easing)!=null?g:"swing",r=H[s]||H.swing,a=e.offset.top,l=e.offset.left,c=t.top-a,h=t.left-l,u=Z({from:0,to:1,duration:o,easing:r,onUpdate(p){e.offset.top=a+c*p,e.offset.left=l+h*p,e.position.top=e.registeredPosition.top+e.offset.top,e.position.left=e.registeredPosition.left+e.offset.left,e.owner.requestRedraw(e.owner.redraw)},onComplete(){e.offset.top=t.top,e.offset.left=t.left,e.position.top=e.registeredPosition.top+t.top,e.position.left=e.registeredPosition.left+t.left,e.isMoving=!1;const p=e.owner.lastAnimatingArticle;e.id===p.id&&p.animationType==="move"&&(e.owner.isAnimatingArticles=!1)}});i.dummyElement=u};function Ve(t){return Math.round(t)}function xs(t,e=1){const i=typeof e=="number"&&isFinite(e)&&e>0?e:1;return Math.round(t*i)/i}function _n(t){return t}function Ln(t=1,e="device"){return e===!1||e==="none"?_n:e==="css"?Ve:function(n){return xs(n,t)}}function Ns(t=1,e="device",i=1){if(e===!1||e==="none")return _n;const n=typeof t=="number"&&isFinite(t)&&t>0?t:1,o=e==="css"?1:n,r=(typeof i=="number"&&isFinite(i)&&i>0?i:1)*o/2;return function(l){return(Math.round(l*o-r)+r)/o}}function Es(t,e,i){i||(i=Ve);const n=e/2;return{left:i(t.left+n),top:i(t.top+n),width:i(t.width-e),height:i(t.height-e)}}M.prototype.draw=function(t){if(!this.isDataLoaded||isNaN(this.position.left))return;this._ensureSizeCache(),t.globalAlpha=this.opacity,this._getCurrentCardLayout().draw.call(this,t)},M.prototype.getCurrentStyle=function(){return this.isActive?this.isMouseover?this.activeHoverStyle:this.activeStyle:this.isMouseover?this.hoverStyle:this.style},M.prototype._getCurrentStyle=function(){return this.getCurrentStyle()},M.prototype._getPeriodLineRenderGeometry=function(t){const i=this.owner._getResolvedArticleOptions(this).periodLine||{},o=(this.owner.options.article.periodLine||{}).position||"axis",s=Number.isFinite(i.baselineGap)?i.baselineGap:0,r=this.hidePeriodLine?0:i.spacing||0,a=this.hidePeriodLine?0:i.thickness||0,l=(r+a)*this.stacking;let c=t,h=this.owner.options.style.mainLine.size/2;if(o==="lane"&&this.owner._isLaneLayoutActive()){const d=this.owner.getLaneById(this.laneId);d&&d.geometry&&(c=Math.floor(d.geometry.bottom),h=0)}const u=c-s-l-h-a/2;return{position:o,baselineGap:s,spacing:r,thickness:a,anchorY:c,anchorOffset:h,y:u}},M.prototype.drawPeriodLinesAndConnectors=function(t,e){var i,n,o,s,r,a;t.save();try{t.globalAlpha=this.opacity;const l=this.getCurrentStyle(),c=this._getPeriodLineRenderGeometry(e),h=c.y;if(!this.hidePeriodLine){const O=this.indicator.fromX,x=this.indicator.toX;if(t.beginPath(),t.setLineDash([]),t.lineCap="butt",t.lineWidth=c.thickness,t.moveTo(O,h),t.lineTo(x,h),this.period.isToPresent){const F=x-O,Y=15,G=Math.max(1-Y/F,.7),Q=t.createLinearGradient(O,h,x,h);Q.addColorStop(0,l.color),Q.addColorStop(G,l.color),Q.addColorStop(1,"rgba(255,255,255,0)"),t.strokeStyle=Q}else t.strokeStyle=l.color;t.stroke()}const u=l.connectorLine;if(!u.visible)return;const d=this._getCurrentCardLayout(),f=typeof d.getConnectorEnd=="function"?d.getConnectorEnd.call(this):{left:this.position.left+l.connectorLine.offsetX,top:this.position.top+this.getHeight()+l.connectorLine.offsetY},g=Math.max(0,this.indicator.fromX),p=h,y=f.left,v=f.top,w=Math.abs(g-y)<Number.EPSILON,S=(s=(o=(n=(i=this.owner)==null?void 0:i.options)==null?void 0:n.article)==null?void 0:o.rendering)==null?void 0:s.pixelSnap,_=Ns(((a=(r=this.owner)==null?void 0:r.getCanvasDpr)==null?void 0:a.call(r))||1,S,l.connectorLine.thickness),L=w?_(y):null,P=L!=null?L:g,T=L!=null?L:y,C=u.color==="article"?l.color:u.color,A=u.arrow,k=A.color==="inherit"?C:A.color==="article"?l.color:A.color;if(u.thickness>0&&(t.strokeStyle=C,t.lineWidth=u.thickness,t.setLineDash(u.dash),t.lineCap=u.lineCap,t.beginPath(),t.moveTo(P,p),t.lineTo(T,v),t.stroke()),A.visible){const O=Math.atan((v-p)/(T-P))+(T>=P?-90:90)*Math.PI/180;t.fillStyle=k,t.beginPath(),t.translate(T,v),t.rotate(O),t.moveTo(-l.connectorLine.arrow.width,0),t.lineTo(l.connectorLine.arrow.width,0),t.lineTo(0,-l.connectorLine.arrow.height),t.closePath(),t.fill()}}finally{t.restore()}},M.prototype.getIconBox=function(){return this._getCurrentCardLayout().getIconBox.call(this)},M.prototype.startDragging=function(t,e){this.isMoving&&this.moveAnimation.dummyElement.stop(),this.isDragging=!0,this.dragInitialPosition={left:this.position.left,top:this.position.top},this.lastDragPosition={left:this.position.left,top:this.position.top},this.dragStartOffset={left:t.left-this.position.left,top:t.top-this.position.top},this.owner.startAnimation(),this.owner&&typeof this.owner.trigger=="function"&&this.owner.trigger("article-drag-start",this,e)},M.prototype.stopDragging=function(t){var e,i;this.offset=this.finalOffset=this.moveAnimation.finalOffset={left:this.position.left-this.registeredPosition.left,top:this.position.top-this.registeredPosition.top},this.isDragging=!1,(i=(e=this.owner)==null?void 0:e._markTimelineStateChanged)==null||i.call(e),this.owner&&typeof this.owner.trigger=="function"&&this.owner.trigger("article-drag-end",this,t)},M.prototype.dragging=function(t,e){const i={left:t.left-this.dragStartOffset.left,top:t.top-this.dragStartOffset.top},n=this.lastDragPosition||{left:this.position.left,top:this.position.top},o=this.dragInitialPosition||n,s=i.left-n.left,r=i.top-n.top,a=i.left-o.left,l=i.top-o.top;this.position=i,this.lastDragPosition=i,this.owner&&typeof this.owner.trigger=="function"&&this.owner.trigger("article-drag",this,{dx:s,dy:r,totalDx:a,totalDy:l},e)},M.prototype._cacheBucket=function(){const t=this._getCurrentCardLayoutName();return this._layoutCaches||(this._layoutCaches=Object.create(null)),this._layoutCaches[t]||(this._layoutCaches[t]=Object.create(null))},M.prototype.memo=function(t,e){const i=this._cacheBucket();return t in i?i[t]:i[t]=e.call(this)},M.prototype._getSizeCacheKey=function(){var l,c,h,u,d,f,g,p,y,v,w,S,_,L,P,T,C,A,k,O,x,F,Y,G,Q,jt,ai,xe,Ne,Tt,Ot,Rt,Xt,kt,fe,me,ge,rs,as,ls,hs;const t=typeof this.getCurrentStyle=="function"?this.getCurrentStyle():null,e=t&&t.image||{},i=t&&t.header||{},n=t&&t.subheader||{},o=t&&t.border||{},s=typeof this._getCurrentCardLayoutName=="function"?this._getCurrentCardLayoutName():"",r=this.imageLoaded&&this.image,a=[s,t&&t.width,t&&t.height,i.height,n.height,typeof i.padding=="number"?i.padding:null,(l=i.padding)==null?void 0:l.top,(c=i.padding)==null?void 0:c.right,(h=i.padding)==null?void 0:h.bottom,(u=i.padding)==null?void 0:u.left,typeof n.padding=="number"?n.padding:null,(d=n.padding)==null?void 0:d.top,(f=n.padding)==null?void 0:f.right,(g=n.padding)==null?void 0:g.bottom,(p=n.padding)==null?void 0:p.left,o.width,(v=(y=this.style)==null?void 0:y.border)==null?void 0:v.width,typeof e.margin=="number"?e.margin:null,(w=e.margin)==null?void 0:w.top,(S=e.margin)==null?void 0:S.right,(_=e.margin)==null?void 0:_.bottom,(L=e.margin)==null?void 0:L.left,e.visible!==!1,e.shape||"",(P=e.maxHeight)!=null?P:"",t&&t.maxImageHeight!==void 0?t.maxImageHeight:"",r?this.image.width:"noimg",r?this.image.height:"",(T=i.text)==null?void 0:T.font,(C=i.text)==null?void 0:C.margin,(A=i.text)==null?void 0:A.lineHeight,(k=i.text)==null?void 0:k.numberOfLines,(O=i.text)==null?void 0:O.baseline,(x=i.text)==null?void 0:x.offsetY,(F=n.text)==null?void 0:F.font,(Y=n.text)==null?void 0:Y.margin,(G=n.text)==null?void 0:G.lineHeight,(Q=n.text)==null?void 0:Q.numberOfLines,(jt=n.text)==null?void 0:jt.baseline,(ai=n.text)==null?void 0:ai.offsetY,(Ne=(xe=this.hoverStyle)==null?void 0:xe.border)==null?void 0:Ne.width,(Ot=(Tt=this.activeStyle)==null?void 0:Tt.border)==null?void 0:Ot.width,(Rt=t.star)==null?void 0:Rt.width,(Xt=t.star)==null?void 0:Xt.margin,this.isActive,this.isStarred,(me=(fe=(kt=this.owner.options)==null?void 0:kt.article)==null?void 0:fe.star)==null?void 0:me.visible,(as=(rs=(ge=this.owner.options)==null?void 0:ge.article)==null?void 0:rs.rendering)==null?void 0:as.pixelSnap,(hs=(ls=this.owner).getCanvasDpr)==null?void 0:hs.call(ls)];return t&&t.width==="auto"&&a.push(t.maxWidth),a},M.prototype.updateCachedSize=function(){this._textBlockLayouts=null;const t=this._getCurrentCardLayout(),e=this.getCurrentStyle();this._cachedWidth=t.getWidth.call(this),e.width==="auto"&&Number.isFinite(e.maxWidth)&&e.maxWidth>=0&&(this._cachedWidth=Math.min(this._cachedWidth,e.maxWidth)),this._cachedHeight=t.getHeight.call(this),this.height=this._cachedHeight,this._sizeValid=!0,this._sizeCacheKey=this._getSizeCacheKey()},M.prototype._ensureSizeCache=function(){const t=this._getSizeCacheKey(),e=this._sizeCacheKey;(!this._sizeValid||!e||t.length!==e.length||t.some((i,n)=>!Object.is(i,e[n])))&&this.updateCachedSize()},M.prototype.invalidateCaches=function(){if(this._sizeValid=!1,this._sizeCacheKey=null,this._textBlockLayouts=null,this._layoutCaches){const t=this._layoutCaches;for(const e in t){const i=t[e];if(i)for(const n in i){const o=i[n];if(o&&typeof o.close=="function")try{o.close()}catch(s){}}}}this._layoutCaches=null},M.prototype._getCurrentCardLayoutName=function(){return this._resolvedCardLayoutName||this.cardLayout||this._resolvedDefaultCardLayout||this.owner._resolveArticleCardLayoutName(this)},M.prototype._getCurrentCardLayout=function(){return this.owner.getCardLayout(this._getCurrentCardLayoutName())},M.prototype.setCardLayout=function(t){if(!this.owner.getCardLayout(t))throw new Error(`Card layout "${t}" not found`);this.cardLayout=t,this._resolvedCardLayoutName=t,this.initialiseStyles(),this.invalidateCaches(),this.owner.requestRedraw(this.redraw)};function St(t,e){const i=Number(t),n=Number(e);if(Number.isFinite(i)&&Number.isFinite(n))return i-n;const s=String(t),r=String(e);return s===r?0:s<r?-1:1}function zs(t,e){const i=t.period.from.getDaysTo(t.period.to),n=e.period.from.getDaysTo(e.period.to);return i<n?1:i>n?-1:St(t.id,e.id)}function Fs(t,e){const i=t.period.years,n=e.period.years;return i<n?1:i>n?-1:St(t.id,e.id)}function Bs(t,e){const i=t.isInView&&t.isVisible,n=e.isInView&&e.isVisible;return!i&&n?-1:i&&!n?1:t.position.top-e.position.top}function Mn(t,e){const i=t.period.from,n=e.period.from;let o=i.compare(n);return o===0&&(o=St(e.id,t.id)),o}function Hs(t,e){const i=t.period.to;let o=e.period.to.compare(i);return o===0&&(o=St(e.id,t.id)),o}function Ws(t,e){const i=t.position.top,n=e.position.top;return i<n?-1:i>n?1:St(e.id,t.id)}function mi(t,e){const i=t.laneOrder||0,n=e.laneOrder||0;if(i>n)return-1;if(i<n)return 1;const o=t.row,s=e.row;return o<s?1:o>s?-1:St(e.id,t.id)}function Ze(t,e){const i=t.rank,n=e.rank;return i<n?1:i>n?-1:St(e.id,t.id)}function Jt(t,e){const i=t.isActive?2:t.isStarred?1:0,n=e.isActive?2:e.isStarred?1:0;return i!==n?n-i:Ze(t,e)}function Ys(t,e){const i=t.position.left,n=e.position.left;let o=i<n?1:i>n?-1:0;return o===0&&(o=t.position.top-e.position.top,o===0&&(o=t.period.from.compare(e.period.from),o===0&&(o=St(t.id,e.id)))),o}const Vs=Object.freeze(Object.defineProperty({__proto__:null,ARTICLE_DURATION_SORTER:zs,ARTICLE_DURATION_YEARS_SORTER:Fs,ARTICLE_EFFECTIVE_RANK_SORTER:Jt,ARTICLE_FROM_SORTER:Mn,ARTICLE_IMAGE_QUEUE_SORTER:Bs,ARTICLE_POSITION_SORTER:Ys,ARTICLE_RANK_SORTER:Ze,ARTICLE_ROW_SORTER:mi,ARTICLE_TOP_SORTER:Ws,ARTICLE_TO_SORTER:Hs},Symbol.toStringTag,{value:"Module"})),An=new Map;function In(t,e){!t||typeof e!="function"||An.set(t,e)}function Zs(t){return An.get(t)}const gi=["#2563eb","#dc2626","#16a34a","#9333ea","#ea580c","#0891b2","#be123c","#4f46e5"],Qt={source:"data",includeZero:!1,padding:.05,tickMode:"round",tickTarget:5},Us={area:{stacking:{active:!0,interpolation:"linear"}}},Cn={lineWidth:2,lineDash:[],area:{fillColor:null,opacity:.2},point:{visible:!1,radius:2.5,fillColor:null,strokeColor:null,lineWidth:1}},Pn={padding:{top:8,right:12,bottom:8,left:48},backgroundColor:"rgba(255, 255, 255, 0)",gridLine:{x:{major:{visible:!0,color:"rgba(0, 0, 0, 0.08)",thickness:1},minor:{visible:!0,color:"rgba(0, 0, 0, 0.035)",thickness:1,minimumSpacing:20}},y:{major:{visible:!0,color:"rgba(120, 120, 120, 0.24)",thickness:1}}},axis:{visible:!0,color:"rgba(80, 80, 80, 0.45)",lineWidth:1},yAxis:{visible:!0,font:"normal 11px Calibri",color:"#555",margin:6,thousandsSeparator:",",formatter:null},legend:{visible:"auto",position:"top-left",font:"normal 12px Calibri",color:"#333",markerSize:10,markerGap:4,itemGap:12,inset:{x:8,y:8}},series:N({},Cn)};function gt(t){return typeof t=="number"&&Number.isFinite(t)}function pi(t){return t!=null&&t.date&&typeof t.date.toKeyString=="function"?t.date.toKeyString():null}function Dn(t){var n,o;const e=((o=(n=t==null?void 0:t.typeOptions)==null?void 0:n.area)==null?void 0:o.stacking)||{},i=e.interpolation;return{active:e.active!==!1,interpolation:i==="step"||i==="none"?i:"linear"}}function Gs(t,e){return(t==null?void 0:t.date)&&t.date.compare(e)===0}function js(t,e,i){let n=null;for(let o=i;o<t.length&&Gs(t[o],e);o++)n=t[o];return n}function Xs(t,e){let i=0,n=t.length;for(;i<n;){const o=Math.floor((i+n)/2);t[o].date.compare(e)<0?i=o+1:n=o}return i}function qs(t,e){var i,n;for(let o=e-1;o>=0;o--){if(gt((i=t[o])==null?void 0:i.value))return t[o];if(((n=t[o])==null?void 0:n.value)===null)return null}return null}function $s(t,e){var i,n;for(let o=e;o<t.length;o++){if(gt((i=t[o])==null?void 0:i.value))return t[o];if(((n=t[o])==null?void 0:n.value)===null)return null}return null}function Ks(t,e,i){if(!e||!i||!e.date||!i.date)return 0;const n=e.date.getDaysTo(i.date);if(!gt(n)||n===0)return e.value;const o=e.date.getDaysTo(t);return gt(o)?e.value+(i.value-e.value)*(o/n):0}function Js(t,e,i,n){const o=qs(t,i),s=$s(t,i);return!o||!s||n==="none"?0:n==="step"?o.value:Ks(e,o,s)}function Qs(t){var i;const e=new Map;for(let n=0;n<t.length;n++){const o=Array.isArray((i=t[n])==null?void 0:i.points)?t[n].points:[];for(let s=0;s<o.length;s++){const r=o[s],a=pi(r);a&&e.set(a,r.date)}}return Array.from(e.values()).sort((n,o)=>n.compare(o))}function tr(t,e,i){const n=Array.isArray(t==null?void 0:t.points)?t.points:[];return e.map(o=>{const s=Xs(n,o),r=js(n,o,s);return r?{date:o,value:gt(r.value)?r.value:null,sourcePoint:r,isResolved:!0}:{date:o,value:Js(n,o,s,i),sourcePoint:null,isResolved:!0}})}function er(t){const e=new Map,i=Array.isArray(t==null?void 0:t.series)?t.series:[],n=Qs(i),{interpolation:o}=Dn(t),s=i.map(r=>{const l=tr(r,n,o).map(c=>{const h=pi(c);if(!gt(c.value))return{date:c.date,value:null,baseValue:null,sourcePoint:c.sourcePoint,isResolved:!0};const u=h&&e.get(h)||0;return{date:c.date,value:u+c.value,baseValue:u,sourcePoint:c.sourcePoint,isResolved:!0}});for(let c=0;c<l.length;c++){const h=l[c],u=pi(h);u&>(h.value)&&e.set(u,h.value)}return{series:r,points:l}});return t._resolvedAreaXDomain=n,t._resolvedStackedAreaSeries=s,t._resolvedStackedAreaDirty=!1,s}function Tn(t){return(t==null?void 0:t.type)==="area"&&Dn(t).active}function On(t){return(Array.isArray(t==null?void 0:t.series)?t.series:[]).map(i=>{const n=Array.isArray(i==null?void 0:i.points)?i.points.map(o=>({date:o==null?void 0:o.date,value:gt(o==null?void 0:o.value)?o.value:null,baseValue:gt(o==null?void 0:o.value)?0:null,sourcePoint:o})):[];return{series:i,points:n}})}function ir(t){return Tn(t)?t&&t._resolvedStackedAreaDirty!==!0&&Array.isArray(t._resolvedStackedAreaSeries)?t._resolvedStackedAreaSeries:er(t):On(t)}function Rn(t){return Tn(t)?ir(t):On(t)}function te(t){return typeof t=="number"&&Number.isFinite(t)}function Ue(t){const e=Number(t);return Number.isFinite(e)?e:null}function yi(t,e=5){const i=Number(t),n=Number.isFinite(i)?i:e;return Math.max(2,Math.round(n))}function kn(t){const e=t!=null&&t.scale?Ue(t.scale.tickTarget):null;return e!=null?yi(e):Qt.tickTarget}function xn(t,e){const i=e&&e.tokens?e.tokens:null;return!i||!i.start||!i.end||!t.date?!0:!t.date.isAfter(i.end)&&!i.start.isAfter(t.date)}function Nn(t,e,i){return!i||!i.start||!i.end||!(t!=null&&t.date)||!(e!=null&&e.date)?!0:t.date.compare(i.end)<=0&&e.date.compare(i.start)>=0}function nr(t,e){te(t)&&(e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),e.hasValues=!0)}function ee(t,e){nr(t==null?void 0:t.value,e)}function or(t,e){const i=e&&e.tokens?e.tokens:null,n=(t.scale||Qt).source==="viewport",o={min:1/0,max:-1/0,hasValues:!1},s=Rn(t);for(let r=0;r<s.length;r++){const a=s[r].points;for(let l=0;l<a.length;l++){const c=a[l];if(!te(c==null?void 0:c.value)||((!n||xn(c,e))&&ee(c,o),!n||l>=a.length-1))continue;const h=a[l+1];te(h==null?void 0:h.value)&&Nn(c,h,i)&&(ee(c,o),ee(h,o))}}return o.hasValues?{min:o.min,max:o.max}:null}function sr(t,e){const i=e&&e.tokens?e.tokens:null,n={min:1/0,max:-1/0,hasValues:!1};for(let o=0;o<t.series.length;o++){const s=t.series[o];for(let r=0;r<s.points.length;r++){const a=s.points[r];if(xn(a,e)&&ee(a,n),r>=s.points.length-1)continue;const l=s.points[r+1];te(a==null?void 0:a.value)&&te(l==null?void 0:l.value)&&Nn(a,l,i)&&(ee(a,n),ee(l,n))}}return n.hasValues?{min:n.min,max:n.max}:null}function rr(t,e){if(t.type==="area")return or(t,e);if((t.scale||Qt).source==="viewport")return sr(t,e);let o=1/0,s=-1/0,r=!1;for(let a=0;a<t.series.length;a++){const l=t.series[a];for(let c=0;c<l.points.length;c++){const h=l.points[c];te(h.value)&&(o=Math.min(o,h.value),s=Math.max(s,h.value),r=!0)}}return r?{min:o,max:s}:null}function wi(t,e){if(t!==e)return{min:t,max:e};const i=Math.abs(t)||1;return{min:t-i*.5,max:e+i*.5}}function bi(t,e){if(!Number.isFinite(t)||t<=0)return 1;const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let o;return e?n<1.5?o=1:n<3?o=2:n<7?o=5:o=10:n<=1?o=1:n<=2?o=2:n<=5?o=5:o=10,o*Math.pow(10,i)}function ar(t){if(!Number.isFinite(t))return 0;const e=t.toExponential(),i=Number(e.split("e")[1]);return Math.max(0,-i+1)}function En(t,e){const i=Math.min(12,ar(e));return Number(t.toFixed(i))}function lr(t,e,i,n,o){const s=e-t,r=bi(s,!1),a=bi(r/(yi(i)-1),!0);return{min:n?t:Math.floor(t/a)*a,max:o?e:Math.ceil(e/a)*a}}function hr(t,e){const i=N(N({},Qt),t.scale||{}),n=rr(t,e),o=Ue(i.min),s=Ue(i.max),r=o!=null,a=s!=null;let l,c;n?(l=n.min,c=n.max):o!=null&&s!=null?(l=o,c=s):o!=null?(l=o,c=o+1):s!=null?(l=s-1,c=s):(l=0,c=1),i.includeZero&&(l=Math.min(0,l),c=Math.max(0,c)),{min:l,max:c}=wi(l,c);const h=Ue(i.padding);if(h!=null&&h>0){const u=c-l;l-=u*h,c+=u*h}if(o!=null&&(l=o),s!=null&&(c=s),c<l){const u=l;l=c,c=u}return{min:l,max:c}=wi(l,c),i.tickMode!=="exact"&&({min:l,max:c}=lr(l,c,kn(t),r,a),{min:l,max:c}=wi(l,c)),{min:l,max:c}}function cr(t,e,i=5){const n=Math.max(2,Math.round(Number.isFinite(i)?i:5)),o=[],s=(e-t)/(n-1);for(let r=0;r<n;r++)o.push(t+s*r);return o}function ur(t,e,i=5){const n=yi(i),o=bi((e-t)/(n-1),!0),s=[];let r=t;for(;r<e&&s.length<1e3;)s.push(En(r,o)),r+=o;return(s.length===0||s[s.length-1]!==e)&&s.push(En(e,o)),s}function dr(t,e){var o;const i=kn(t);return(((o=t==null?void 0:t.scale)==null?void 0:o.tickMode)||Qt.tickMode)==="exact"?cr(e.min,e.max,i):ur(e.min,e.max,i)}function fr(t,e){if(typeof e!="string"||e.length===0)return t;const i=t.split(".");return i[0]=i[0].replace(/\B(?=(\d{3})+(?!\d))/g,e),i.join(".")}function mr(t,e,i){if(typeof e=="function")return e(t);let n;return Math.abs(t)>=1e3||Math.abs(t)<.01?n=Number(t.toPrecision(4)).toString():n=Number(t.toFixed(2)).toString(),fr(n,i)}function K(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function gr(t){const e=t.padding||{};return{top:K(e.top,8),right:K(e.right,12),bottom:K(e.bottom,8),left:K(e.left,48)}}function pr(t){switch(t){case"top-right":case"bottom-left":case"bottom-right":return t;default:return"top-left"}}function yr(t){const e=t.inset||{};return{x:K(e.x,8),y:K(e.y,8)}}function wr(t,e){const i=t.left+e.left,n=t.top+e.top,o=t.right-e.right,s=t.bottom-e.bottom;return{left:i,top:n,right:o,bottom:s,width:Math.max(0,o-i),height:Math.max(0,s-n)}}function ie(t,e,i){return i.bottom-(t-e.min)/(e.max-e.min)*i.height}function ne(t,e,i){return Math.max(e,Math.min(i,t))}function zn(t,e){const i=e&&e.tokens?e.tokens:null;if(!i||!i.start||!i.end||t.length===0)return{start:0,end:t.length-1};let n=0,o=t.length;for(;n<o;){const a=Math.floor((n+o)/2);t[a].date.compare(i.start)<0?n=a+1:o=a}const s=n;if(s===t.length)return{start:t.length-1,end:t.length-1};for(n=s,o=t.length;n<o;){const a=Math.floor((n+o)/2);t[a].date.compare(i.end)<=0?n=a+1:o=a}const r=n;return{start:Math.max(0,s-1),end:Math.min(t.length-1,r)}}function vi(t,e){t.beginPath(),t.moveTo(e.left,e.top),t.lineTo(e.right,e.top),t.lineTo(e.right,e.bottom),t.lineTo(e.left,e.bottom),t.closePath(),t.clip()}function br(t,e,i){const n=e.x-t.x,o=e.y-t.y;let s=0,r=1,a=null,l=null;const c=[[-n,t.x-i.left],[n,i.right-t.x],[-o,t.y-i.top],[o,i.bottom-t.y]];for(let u=0;u<c.length;u++){const[d,f]=c[u];if(d===0){if(f<0)return null;continue}const g=f/d;if(d<0?g>s&&(s=g,a=u):g<r&&(r=g,l=u),s>r)return null}const h=(u,d)=>{if(u===0)return t;if(u===1)return e;const f={x:ne(t.x+n*u,i.left,i.right),y:ne(t.y+o*u,i.top,i.bottom)};return d===0?f.x=i.left:d===1?f.x=i.right:d===2?f.y=i.top:d===3&&(f.y=i.bottom),f};return{from:h(s,a),to:h(r,l)}}function vr(t,e){return t&&e&&t.x===e.x&&t.y===e.y}function Fn(t,e,i){if(t.length===0)return t;const n=[];let o=t[t.length-1],s=e(o);for(let r=0;r<t.length;r++){const a=t[r],l=e(a);l?(s||n.push(i(o,a)),n.push(a)):s&&n.push(i(o,a)),o=a,s=l}return n}function Sr(t,e){const i=(s,r,a)=>Fn(s,l=>a?l.x>=r:l.x<=r,(l,c)=>{const h=(r-l.x)/(c.x-l.x);return{x:r,y:ne(l.y+(c.y-l.y)*h,e.top,e.bottom)}}),n=(s,r,a)=>Fn(s,l=>a?l.y>=r:l.y<=r,(l,c)=>{const h=(r-l.y)/(c.y-l.y);return{x:ne(l.x+(c.x-l.x)*h,e.left,e.right),y:r}});let o=i(t,e.left,!0);return o=i(o,e.right,!1),o=n(o,e.top,!0),n(o,e.bottom,!1)}function _r(t,e,i){i.backgroundColor&&(t.fillStyle=i.backgroundColor,t.fillRect(e.left,e.top,e.width,e.height))}function Lr(t,e,i,n,o){const s=e.style||{},r=s.gridLine||{},a=s.axis||{},l=s.yAxis||{},c=dr(e,n);Ar(t,i,r,e.owner,o);const h=r.y&&r.y.major?r.y.major:{};if(h.visible!==!1){t.beginPath(),t.lineWidth=K(h.thickness,1),t.strokeStyle=h.color||"rgba(120, 120, 120, 0.24)";for(let u=0;u<c.length;u++){const d=Math.round(ie(c[u],n,i))+.5;t.moveTo(i.left,d),t.lineTo(i.right,d)}t.stroke()}if(a.visible!==!1&&(t.beginPath(),t.lineWidth=K(a.lineWidth,1),t.strokeStyle=a.color||"rgba(80, 80, 80, 0.45)",t.moveTo(i.left,i.top),t.lineTo(i.left,i.bottom),t.lineTo(i.right,i.bottom),t.stroke()),l.visible!==!1){t.font=l.font||"normal 11px Calibri",t.fillStyle=l.color||"#555",t.textAlign="right",t.textBaseline="middle";const u=K(l.margin,6);for(let d=0;d<c.length;d++){const f=ie(c[d],n,i);t.fillText(mr(c[d],l.formatter,l.thousandsSeparator),i.left-u,f)}}}function Bn(t,e){const i=t&&t.markers?t.markers:null,n=i?i[e]:null;return Array.isArray(n)?n:[]}function Mr(t,e){var n;if(e<=0)return!0;const i=(n=t==null?void 0:t.timescaleManager)==null?void 0:n.unitSizeInPixels;return typeof i!="number"||!Number.isFinite(i)?!0:i>=e}function Hn(t,e,i,n,o=0){if(!(!n||n.visible!==!0||i.length===0)){t.beginPath(),t.lineWidth=K(n.thickness,1),t.strokeStyle=n.color||"rgba(0, 0, 0, 0.08)";for(let s=0;s<i.length;s++){const r=i[s];if(r.adaptive&&r.markerSpacingInPixels<o||typeof r.drawX!="number"||!Number.isFinite(r.drawX))continue;const a=Math.round(r.drawX)+.5;a<e.left||a>e.right||(t.moveTo(a,e.top),t.lineTo(a,e.bottom))}t.stroke()}}function Ar(t,e,i,n,o){const s=i.x||{},r=s.major||{},a=s.minor||{},l=Math.max(0,K(a.minimumSpacing,20));Hn(t,e,Bn(o,E),r),Mr(n,l)&&Hn(t,e,Bn(o,B),a,l)}function Ir(t,e,i){const n=e.style.legend||{},o=n.visible==null?"auto":n.visible,s=e.series.filter(w=>w.title);if(o===!1||o==="auto"&&s.length<2)return;t.save(),t.font=n.font||"normal 12px Calibri",t.fillStyle=n.color||"#333",t.textAlign="left",t.textBaseline="middle";const r=K(n.markerSize,10),a=K(n.markerGap,4),l=K(n.itemGap,12),c=yr(n),h=pr(n.position),u=[],d=Math.max(0,i.width-c.x);let f=0;for(let w=0;w<s.length;w++){const S=s[w],_=t.measureText(S.title).width,L=r+a+_,P=f===0?L:f+l+L;if(P>d)break;u.push({series:S,entryWidth:L}),f=P}const g=h==="top-right"||h==="bottom-right",p=h==="bottom-left"||h==="bottom-right";let y=g?i.right-c.x-f:i.left+c.x;const v=p?i.bottom-c.y-r/2:i.top+c.y+r/2;for(let w=0;w<u.length;w++){const S=u[w];t.fillStyle=S.series.style.color,t.fillRect(y,v-r/2,r,r),t.fillStyle=n.color||"#333",t.fillText(S.series.title,y+r+a,v),y+=S.entryWidth+l}t.restore()}function Wn(t,e,i,n,o,s,r=i.points){const a=i.style||{},l=K(a.lineWidth,2);t.save(),vi(t,o),t.beginPath(),t.lineWidth=l,t.strokeStyle=a.color||"#2563eb",Array.isArray(a.lineDash)&&typeof t.setLineDash=="function"&&t.setLineDash(a.lineDash);let c=null,h=null;const u=zn(r,s);for(let d=u.start;d<=u.end;d++){const f=r[d];if(typeof f.value!="number"||!Number.isFinite(f.value)){c=null,h=null;continue}const g=e.getPixel(f.date,s),p=ie(f.value,n,o),y={x:g,y:p};if(c&&Number.isFinite(c.x)&&Number.isFinite(c.y)&&Number.isFinite(y.x)&&Number.isFinite(y.y)){const v=br(c,y,o);v?(vr(h,v.from)||t.moveTo(v.from.x,v.from.y),t.lineTo(v.to.x,v.to.y),h=v.to):h=null}c=y}t.stroke(),typeof t.setLineDash=="function"&&t.setLineDash([]),t.restore()}function Cr(t,e,i,n,o,s){const r=i.series||{},a=i.points||[],l=r.style||{},c=l.area||{},h=ne(K(c.opacity,.2),0,1);t.save(),vi(t,o),t.fillStyle=c.fillColor||l.color||"#2563eb",t.globalAlpha=K(t.globalAlpha,1)*h;let u=[];const d=zn(a,s),f=()=>{if(u.length===0)return;const g=[];for(let y=0;y<u.length;y++)g.push({x:u[y].x,y:u[y].y});for(let y=u.length-1;y>=0;y--)g.push({x:u[y].x,y:u[y].baseY});const p=Sr(g,o);if(p.length>=3){t.beginPath(),t.moveTo(p[0].x,p[0].y);for(let y=1;y<p.length;y++)t.lineTo(p[y].x,p[y].y);t.closePath(),t.fill()}u=[]};for(let g=d.start;g<=d.end;g++){const p=a[g];if(typeof p.value!="number"||!Number.isFinite(p.value)||typeof p.baseValue!="number"||!Number.isFinite(p.baseValue)){f();continue}const y=e.getPixel(p.date,s),v=ie(p.value,n,o),w=ne(ie(p.baseValue,n,o),o.top,o.bottom);u.push({x:y,y:v,baseY:w})}f(),t.restore()}function Yn(t,e,i,n,o,s,r=i.points,a={}){var u;const l=((u=i.style)==null?void 0:u.point)||{};if(l.visible!==!0)return;const c=K(l.radius,2.5),h=K(l.lineWidth,1);t.save(),vi(t,o),t.lineWidth=h,t.fillStyle=l.fillColor||i.style.color||"#2563eb",t.strokeStyle=l.strokeColor||"#fff";for(let d=0;d<r.length;d++){const f=r[d];if(a.sourcePointsOnly&&!f.sourcePoint||typeof f.value!="number"||!Number.isFinite(f.value))continue;const g=e.getPixel(f.date,s);if(g<o.left-c||g>o.right+c)continue;const p=ie(f.value,n,o);t.beginPath(),t.arc(g,p,c,0,Math.PI*2),t.fill(),h>0&&t.stroke()}t.restore()}function Vn({chart:t,ctx:e,geometry:i,drawCycleContext:n,stackArea:o=!1}){if(!i||i.width<=0||i.height<=0)return;const s=t.style||{},r=gr(s),a=wr(i,r);if(a.width<=0||a.height<=0)return;const l=t.getScaleDomain(n);_r(e,i,s),Lr(e,t,a,l,n);const c=o?Rn(t):t.series;for(let h=0;h<c.length;h++)if(o){const u=c[h];Cr(e,t.owner,u,l,a,n),Wn(e,t.owner,u.series,l,a,n,u.points),Yn(e,t.owner,u.series,l,a,n,u.points,{sourcePointsOnly:!0})}else Wn(e,t.owner,c[h],l,a,n),Yn(e,t.owner,c[h],l,a,n);Ir(e,t,a)}function Pr(t){Vn(t)}function Dr(t){Vn(ot(N({},t),{stackArea:!0}))}In("line",Pr),In("area",Dr);function oe(t,e,...i){return typeof t=="function"?t.call(e,...i):t}function zt(t,e=null){const i=parseInt(t,10);return Number.isFinite(i)?i:e}function Tr(t,e){if(!e||typeof e!="object")return null;const i=zt(e.year);if(i==null)return null;const n=zt(e.month,1),o=zt(e.day,1),s=we(e);let r=new b({year:i,month:n,day:o,precision:s,hour:zt(e.hour,0),minute:zt(e.minute,0),second:zt(e.second,0),millisecond:zt(e.millisecond,0)});return r=t.getDmyFromInput(r),b.CreateAsStartOfPeriod(r,s)}function Or(t,e){if(!e||typeof e!="object")return null;const i=Tr(t,e.date);if(!i)return null;const n=e.value===null?null:Number(e.value);return{date:i,value:Number.isFinite(n)?n:null}}function Rr(t,e){return t!=null&&Object.prototype.hasOwnProperty.call(t,e)}function kr(t){return Rr(t==null?void 0:t.style,"color")}function xr(t){var e;return!!((e=t==null?void 0:t.series)!=null&&e.color)}function Nr(t,e){const i=Array.isArray(t==null?void 0:t._seriesColors)?t._seriesColors:[];for(let n=0;n<i.length;n++)if(i[n].id===e)return i[n].color}function Er(t,e,i){if(t){Array.isArray(t._seriesColors)||(t._seriesColors=[]);for(let n=0;n<t._seriesColors.length;n++)if(t._seriesColors[n].id===e){t._seriesColors[n].color=i;return}t._seriesColors.push({id:e,color:i})}}function zr(t){const e=t&&t.seriesColors;if(!Array.isArray(e))return gi;const i=e.filter(n=>typeof n=="string"&&n.length>0);return i.length>0?i:gi}function Fr(t,e,i,n,o,s){const r=i||{},a=D({},Cn,e.series||{});a.color||(a.color=o||s[n%s.length]);const l=Array.isArray(r.points)?r.points.map(c=>Or(t,c)).filter(Boolean):[];return l.sort((c,h)=>c.date.compare(h.date)),{id:r.id!=null?r.id:n,title:r.title||"",style:D({},a,r.style||{}),points:l}}function Zn(t,e){return t&&t.id!=null?t.id:e}function Un(t){const e=t._getResolvedData();return Array.isArray(e.series)?e.series.slice():[]}function Gn(t,e){t.data||(t.data={id:t.id}),t.data.series=e,t._resolveFromData(),t.owner&&typeof t.owner.requestRedraw=="function"&&t.owner.requestRedraw()}function rt(t,e){this.id=e,this.owner=t,this.isDataLoaded=!1,this.type="line",this.title="",this.laneId=null,this.area=null,this.scale={},this.typeOptions={},this.style={},this.series=[],this._seriesColors=[],this._resolvedAreaXDomain=[],this._resolvedStackedAreaSeries=null,this._resolvedStackedAreaDirty=!0}rt.prototype.setupByReceivedData=function(t){this.data=D({},t||{}),this.id=this.data.id!=null?this.data.id:this.id,this._resolveFromData(),this.isDataLoaded=!0},rt.prototype._getResolvedData=function(){const t=this.owner&&this.owner.options?this.owner.options.chart||{}:{},e=D({},t.defaultData||{});return delete e.id,D({},e,this.data||{})},rt.prototype._resolveFromData=function(){const t=this.owner&&this.owner.options?this.owner.options.chart||{}:{},e=this._getResolvedData(),i=I(e,"type")||"line",n=I(e,"lane");this.type=i==="line"?i:String(i),this.title=I(e,"title")||"",this.laneId=n!=null&&n!==""?n:null,this.area=I(e,"area")||null,this.scale=D({},Qt,I(e,"scale")||{}),this.typeOptions=D({},Us,I(e,"typeOptions")||{}),this.style=D({},Pn,t.defaultStyle||{},I(e,"style")||{});const o=Array.isArray(e.series)?e.series:[],s=zr(t);this.series=o.map((r,a)=>{const l=Zn(r,a),c=Nr(this,l),h=Fr(this.owner,this.style,r,a,c,s);return(kr(r)||!xr(this.style))&&Er(this,l,h.style.color),h}),this._resolvedStackedAreaDirty=!0},rt.prototype.addSeries=function(t){const e=Un(this);e.push(t||{}),Gn(this,e)},rt.prototype.removeSeriesById=function(t){const e=Un(this);for(let i=0;i<e.length;i++)if(Zn(e[i],i)===t)return e.splice(i,1),Gn(this,e),!0;return!1},rt.prototype.getSeriesById=function(t){for(let e=0;e<this.series.length;e++){const i=this.series[e];if(i.id===t)return i}},rt.prototype.getScaleDomain=function(t){return hr(this,t)},rt.prototype.draw=function(t,e,i){const n=Zs(this.type);if(!n){W.warn(`Unknown chart type "${this.type}". Skipping chart render.`,{chartId:this.id});return}n({chart:this,ctx:t,geometry:e,drawCycleContext:i})},rt.prototype.setOption=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return I(this.data,t);t=ct(t,e)}t=D({},t);const i=R(t,"lane");if(!(R(t,"id")&&(W.warn("Ignoring chart id change; chart ids are immutable after load",{chartId:this.id,nextId:I(t,"id")}),delete t.id,Object.keys(t).length===0))){if(nt(this.data,t),i&&this.owner&&typeof this.owner._ensureChartLane=="function"){const o=I(this.data,"lane");o!=null&&o!==""&&this.owner._ensureChartLane(o)}this._resolveFromData(),i&&this.owner&&(typeof this.owner._refreshLaneOrder=="function"&&this.owner._refreshLaneOrder(),typeof this.owner._updateLaneLayout=="function"&&this.owner._updateLaneLayout()),this.owner.requestRedraw()}},rt.prototype.setStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return I(this.style,t);t=ct(t,e)}this.data.style=nt(this.data.style||{},t),this._resolveFromData(),this.owner.requestRedraw()},Object.defineProperty(rt.prototype,"visibility",{get(){const t=this&&this.data?this.data.visibility:void 0;if(typeof t=="undefined")return"visible";const e=oe(t,this,this);return e==="visible"||e==="hidden"?e:(W.warn("Invalid Chart.visibility value; expected 'visible'|'hidden'. Defaulting to 'visible'",{chartId:this&&this.id,value:e}),"visible")},set(t){this.data||(this.data={}),this.data.visibility=t},enumerable:!0,configurable:!1});const Br=["defaultCardLayout","defaultStyle","defaultHoverStyle","defaultActiveStyle","layoutStyles"],Hr=["defaultData","density","distanceToBaseline","autoStacking.active","autoStacking.rowSpacing","autoStacking.fitToHeight","autoStacking.topGap","periodLine.baselineGap","periodLine.spacing","periodLine.thickness"];function jn(t,e){if(t===U)return!0;if(!t||typeof t!="object")return!1;for(let i=0;i<e.length;i++)if(tt(t,e[i]))return!0;return!1}function ve(t){return typeof t=="number"&&Number.isFinite(t)}function Si(t,e,i){return Math.min(Math.max(t,e),i)}function Xn(t){const e=jn(t,Br);return{cacheChanged:e||jn(t,Hr),styleChanged:e}}function qn(t={},e={}){const i=t||{},n=e||{},o=i.autoStacking||{},s=n.autoStacking||{},r=i.periodLine||{},a=n.periodLine||{};return{defaultData:D({},i.defaultData||{},n.defaultData||{}),density:Object.prototype.hasOwnProperty.call(n,"density")?n.density:i.density,distanceToBaseline:D({},i.distanceToBaseline||{},n.distanceToBaseline||{}),defaultCardLayout:Object.prototype.hasOwnProperty.call(n,"defaultCardLayout")?n.defaultCardLayout:i.defaultCardLayout,defaultStyle:D({},i.defaultStyle||{},n.defaultStyle||{}),defaultHoverStyle:D({},i.defaultHoverStyle||{},n.defaultHoverStyle||{}),defaultActiveStyle:D({},i.defaultActiveStyle||{},n.defaultActiveStyle||{}),layoutStyles:D({},i.layoutStyles||{},n.layoutStyles||{}),autoStacking:{active:R(n,"autoStacking.active")?s.active:o.active,rowSpacing:R(n,"autoStacking.rowSpacing")?s.rowSpacing:o.rowSpacing,fitToHeight:R(n,"autoStacking.fitToHeight")?s.fitToHeight:o.fitToHeight,topGap:R(n,"autoStacking.topGap")?s.topGap:o.topGap},periodLine:{baselineGap:R(n,"periodLine.baselineGap")?a.baselineGap:r.baselineGap,spacing:R(n,"periodLine.spacing")?a.spacing:r.spacing,thickness:R(n,"periodLine.thickness")?a.thickness:r.thickness}}}function Wr(t,e,i,n){var p;if(!t||t.active!==!0)return null;const o=t.lanesOnly!==!1;if(!i&&o)return null;const s=(p=t.byCardLayout)==null?void 0:p[n];if(!s)return null;const r=Math.max(0,ve(e)?e:0),a=Math.max(0,ve(s.ratio)?s.ratio:0),l=ve(s.min)?s.min:0,c=ve(s.max)?s.max:Number.POSITIVE_INFINITY,h=Math.max(0,Math.min(l,c)),u=Math.max(h,c),d=Si(h,0,r),f=Si(u,d,r),g=Math.round(r*a);return Si(g,d,f)}function Ge(t,e,i,n){const o=Wr(t==null?void 0:t.responsive,e,i,n);return Number.isFinite(o)?o:ve(t==null?void 0:t.value)?t.value:0}const Yr={from:{},to:{},rank:0,starred:!1,hidePeriodLine:!1,hiddenByFilter:!1},Vr={width:150,color:"#e5e5e5",backgroundColor:"#fff",topRadius:3,maxImageHeight:400,image:{visible:!0,shape:"natural",margin:0,maxHeight:200,borderRadius:0},header:{height:50,padding:{top:0,right:0,bottom:0,left:0},text:{font:"normal 14px 'Segoe UI'",align:"left",baseline:"middle",margin:10,color:"#333",lineHeight:18,numberOfLines:2,offsetY:0}},subheader:{height:30,padding:{top:0,right:0,bottom:0,left:0},color:"#555",text:{font:"normal 11px 'Segoe UI'",color:"#eee",align:"left",baseline:"middle",margin:10,lineHeight:14,numberOfLines:1,offsetY:0}},shadow:{x:0,y:0,amount:0,color:"#000"},border:{color:"#ddd",width:1},connectorLine:{visible:!0,color:"article",dash:[],lineCap:"butt",offsetX:18,offsetY:-20,thickness:1,arrow:{visible:!0,color:"inherit",width:16,height:45}},star:{width:16,margin:3}},Zr={color:"#a6c6e2"},Ur={color:"#337ab7",header:{text:{color:"#fff"}},shadow:{x:3,y:3,amount:5,color:"#333"},border:{width:2,color:"#2e6da4"},connectorLine:{thickness:2}},Gr={heightWeight:1,header:{visible:!0,height:24,padding:{left:12,right:12}}},jr={header:{},body:{},title:{}},Xr={backgroundColor:"rgba(200, 200, 200, 0.25)",border:{color:"rgba(120, 120, 120, 0.25)",width:1},text:{font:"normal 16px Calibri",color:"#555",align:"left",baseline:"bottom",verticalAlign:"bottom",margin:4,offsetY:0}},$n="#cdd2d8",se={width:1e3,height:500,verticalOffset:40,enableUserControl:!0,enableCursor:!0,canvas:{dpr:"auto",dprMode:"stable",maxDpr:3},debugOverlays:{densityRegions:!1},zoom:{initial:34,minimum:0,maximum:123,wheelStep:.2,wheelSpeed:3,allowCtrlWheel:!1,wheelMode:"auto",pinchMomentum:{active:!0,sampleWindow:50,minVelocity:.001,stopVelocity:1e-4,friction:.005,maxDuration:1200},discreteWheelAnimation:{active:!0,duration:250},proportionalGain:2,proportionalExponent:1.1,ratio:.8,unitSize:{initial:200,showMinorLabels:48,minimum:8,minimumMajor:120}},initialDate:{year:1990,month:1,day:1},bounds:{minDate:null,maxDate:null,overflow:"elastic"},shiftBceDates:!1,draggingVicinity:!0,pan:{momentum:{active:!0,sampleWindow:100,minVelocity:.01,stopVelocity:.005,friction:.005,maxDuration:5600}},style:{mainLine:{visible:!0,position:"bottom",size:8,color:$n,opacity:.75,dateIndicators:{visible:!0,shape:"rectangle",size:4,color:"#666",opacity:1,hiddenStyle:{opacity:.25},activeStyle:{color:"article",opacity:1}}},draggingHighlight:{visible:!0,color:"rgba(237, 247, 255, 0.5)",area:{up:0,down:"edge"}},marker:{minor:{height:12,extend:!1,color:"#6097f2",futureColor:"#ccc"},major:{height:30,extend:!1,color:"#0c3a88",futureColor:"#ccc"}},dateLabel:{minor:{font:"normal 10px Calibri",color:"#333",futureColor:"#ccc",textAlign:"start",offset:{x:4,y:0},bceText:"",thousandsSeparator:",",yearPrefixes:{ka:{label:"ka",value:1e3,minDivision:1e3},Ma:{label:"Ma",value:1e6,minDivision:1e5},Ga:{label:"Ga",value:1e9,minDivision:1e8}}},major:{font:"normal 16px Calibri",color:"#000",futureColor:"#ccc",textAlign:"start",offset:{x:4,y:0},sticky:{enabled:"auto",offsetX:4},bceText:" ʙᴄᴇ",thousandsSeparator:",",yearPrefixes:{ka:{label:"ka",value:1e3,minDivision:1e5},Ma:{label:"Ma",value:1e6,minDivision:1e6},Ga:{label:"Ga",value:1e9,minDivision:1e9}}},parent:{visible:!1,levels:"all",height:20,font:"normal 14px Calibri",color:"#444",futureColor:"#ccc",textAlign:"start",offset:{x:4,y:0},sticky:{enabled:!0,offsetX:4}}},cursor:{timeline:{hover:"default",dragging:"e-resize"},clickable:"pointer",article:{hoverDraggable:"move",dragging:"move"}}},timeBand:{visible:!0,reserveSpace:!0,reserveSpacePixels:20,area:{up:0,down:"edge"},defaultStyle:Xr,data:[]},chart:{visible:!0,area:{up:"edge",down:0},seriesColors:[...gi],defaultData:{},defaultStyle:D({},Pn),data:[]},lane:{visible:!0,defaultId:"default",gap:0,topGap:0,axisGap:0,defaultLayout:D({},Gr),defaultStyle:D({},jr),defaultClassName:"",defaultHeaderClassName:"",defaultBodyClassName:"",defaultTitleClassName:"",data:[]},image:{maxConcurrent:6,maxCacheBytes:64*1024*1024,requireCORS:!1,decodeMode:"auto",sanitizer:{allowedSchemes:["http","https","data","blob"]}},article:{density:"all",rendering:{pixelSnap:"device"},draggable:!0,distanceToBaseline:{value:350,responsive:{active:!0,lanesOnly:!0,byCardLayout:{portrait:{ratio:.6,min:310,max:410},landscape:{ratio:.6,min:100,max:160}}}},collectOngoing:!1,autoStacking:{active:!0,rowSpacing:50,range:"all",fitToHeight:!0,topGap:10},periodLine:{position:"lane",baselineGap:0,spacing:4,thickness:10,stacking:{sorter:Mn,reverseOrder:!1}},animation:{fade:{active:!0,duration:1500,easing:"swing"},move:{active:!0,duration:1500,easing:"swing"}},star:{visible:!0},defaultData:N({},Yr),defaultCardLayout:"portrait",cardLayoutBreakpoints:[{maxHeight:320,layout:"landscape"}],defaultStyle:N({},Vr),defaultHoverStyle:N({},Zr),defaultActiveStyle:N({},Ur),layoutStyles:{}}};function qr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _i(t,e){W.warn(`DEPRECATION WARNING: ${t} is deprecated. Use ${e} instead.`)}const $r=new Set(["rectangle","circle"]);function Li(t,e,{allowVisible:i=!1}={}){if(!(t===void 0||t===U)){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError(`${e} must be an object`);if(i&&t.visible!==void 0&&t.visible!==U&&typeof t.visible!="boolean")throw new TypeError(`${e}.visible must be a boolean`);if(t.shape!==void 0&&t.shape!==U&&!$r.has(t.shape))throw new TypeError(`${e}.shape must be "rectangle" or "circle"`);if(t.size!==void 0&&t.size!==U&&(typeof t.size!="number"||!Number.isFinite(t.size)||t.size<=0))throw new TypeError(`${e}.size must be a positive finite number`);if(t.color!==void 0&&t.color!==U&&typeof t.color!="string")throw new TypeError(`${e}.color must be a CSS colour string or "article"`);if(t.opacity!==void 0&&t.opacity!==U&&(typeof t.opacity!="number"||!Number.isFinite(t.opacity)||t.opacity<0||t.opacity>1))throw new TypeError(`${e}.opacity must be a finite number between 0 and 1`)}}function Kr(t){var i,n;const e=(n=(i=t==null?void 0:t.style)==null?void 0:i.mainLine)==null?void 0:n.dateIndicators;Li(e,"style.mainLine.dateIndicators",{allowVisible:!0}),Li(e==null?void 0:e.hiddenStyle,"style.mainLine.dateIndicators.hiddenStyle"),Li(e==null?void 0:e.activeStyle,"style.mainLine.dateIndicators.activeStyle")}function Kn(t,e,i){(t==null?void 0:t.distanceToMainLine)!==void 0&&(_i(`${i}.distanceToMainLine`,`${i}.distanceToBaseline.value`),e&&((!e.distanceToBaseline||typeof e.distanceToBaseline!="object")&&(e.distanceToBaseline={}),qr(e.distanceToBaseline,"value")||(e.distanceToBaseline.value=t.distanceToMainLine),delete e.distanceToMainLine))}function Jn(t){if(typeof t!="string")return t;const e=t.replace(/(^article\.|\.article\.)distanceToMainLine$/,"$1distanceToBaseline.value").replace(/^chart\.gridLine(?=\.|$)/,"chart.defaultStyle.gridLine");return e!==t&&_i(t,e),e}function Mi(t){var i;if(!t)return t;const e=D({},t);return((i=t.article)==null?void 0:i.distanceToMainLine)!==void 0&&(e.article||(e.article={}),Kn(t.article,e.article,"lane.article")),e}function Qn(t){var n,o,s,r,a,l,c;if(!t)return t;Kr(t);const e=D({},t);if(((n=t.chart)==null?void 0:n.gridLine)!==void 0&&(_i("chart.gridLine","chart.defaultStyle.gridLine"),e.chart.defaultStyle||(e.chart.defaultStyle={}),e.chart.defaultStyle.gridLine=t.chart.gridLine===U?((o=t.chart.defaultStyle)==null?void 0:o.gridLine)||U:D({},t.chart.gridLine,((s=t.chart.defaultStyle)==null?void 0:s.gridLine)||{}),delete e.chart.gridLine),((r=t.article)==null?void 0:r.distanceToMainLine)!==void 0&&(e.article||(e.article={}),Kn(t.article,e.article,"article")),Array.isArray((a=t.lane)==null?void 0:a.data)){e.lane||(e.lane={}),e.lane.data=e.lane.data||[];for(let h=0;h<t.lane.data.length;h++)e.lane.data[h]=Mi(t.lane.data[h])}if(((c=(l=t.article)==null?void 0:l.periodLine)==null?void 0:c.defaultHide)!==void 0&&(W.warn("DEPRECATION WARNING: article.periodLine.defaultHide is deprecated. Use article.defaultData.hidePeriodLine instead."),e.article||(e.article={}),e.article.defaultData||(e.article.defaultData={}),e.article.defaultData.hidePeriodLine=t.article.periodLine.defaultHide),["defaultStyle","defaultHoverStyle","defaultActiveStyle"].forEach(h=>{var u,d;((d=(u=t.article)==null?void 0:u[h])==null?void 0:d.maxImageHeight)!==void 0&&(W.warn(`DEPRECATION WARNING: article.${h}.maxImageHeight is deprecated. Use article.${h}.image.maxHeight instead.`),e.article||(e.article={}),e.article[h]||(e.article[h]={}),e.article[h].image||(e.article[h].image={}),e.article[h].image.maxHeight=t.article[h].maxImageHeight)}),t.onSave!==void 0&&(W.warn('DEPRECATION WARNING: onSave is deprecated. Use options.on["timeline-state-change"] instead.'),e.on||(e.on={}),!e.on["timeline-state-change"])){const h=t.onSave;typeof h=="function"&&(e.on["timeline-state-change"]=function(u){h.call(this,u)})}if(t.onArticleClick!==void 0&&(W.warn('DEPRECATION WARNING: onArticleClick is deprecated. Use options.on["article-click"] for click events, or options.on["article-select"] for selection by any means.'),e.on||(e.on={}),!e.on["article-click"])){const h=t.onArticleClick;typeof h=="function"&&(e.on["article-click"]=function(u,d){h.call(this,u)})}if(t.onArticleDoubleClick!==void 0&&(W.warn('DEPRECATION WARNING: onArticleDoubleClick is deprecated. Use options.on["article-dblclick"] instead.'),e.on||(e.on={}),!e.on["article-dblclick"])){const h=t.onArticleDoubleClick;typeof h=="function"&&(e.on["article-dblclick"]=function(u,d){h.call(this,u)})}if(t.onRedraw!==void 0){if(W.warn('DEPRECATION WARNING: onRedraw is deprecated. Use options.on["timeline-render-end"] instead.'),e.on||(e.on={}),!e.on["timeline-render-end"]){const h=t.onRedraw;typeof h=="function"&&(e.on["timeline-render-end"]=function(u){h.call(this,u)})}delete e.onRedraw}return e}const Se=D({},se);function et(t,e){this.id=e,this.owner=t,this.isDataLoaded=!1,this.isImplicit=!1,this.order=0,this.title="",this.className="",this.headerClassName="",this.bodyClassName="",this.titleClassName="",this.layout={},this.style={},this.articleOptions={},this.resolvedArticleOptions={},this._runtimeArticleOptions={},this.geometry=null,this.currentVisibility="visible"}et.prototype.setupByReceivedData=function(t,{implicit:e=!1}={}){this.data=Mi(t),this.isImplicit=!!e,this._resolveFromData(),this.isDataLoaded=!0},et.prototype._resolveFromData=function(){var i,n;const t=this.owner&&this.owner.options?this.owner.options.lane||{}:{},e=this.data||{};this.title=I(e,"title")||"",this.className=I(e,"className")||"",this.headerClassName=I(e,"headerClassName")||"",this.bodyClassName=I(e,"bodyClassName")||"",this.titleClassName=I(e,"titleClassName")||"",this.layout=D({},t.defaultLayout||{},e.layout||{}),this.style=D({},t.defaultStyle||{},e.style||{}),this.articleOptions=D({},e.article||{}),this.resolvedArticleOptions=qn(((n=(i=this.owner)==null?void 0:i.options)==null?void 0:n.article)||{},this.articleOptions)},et.prototype._applyOption=function(t,{suppressRedraw:e=!1,markExplicit:i=!1,suppressArticleRefresh:n=!1}={}){if(!t||typeof t!="object")return;t=Mi(t);const o=this.id,s=R(t,"id")&&t.id!==U?t.id:o;if(s!==o){const a=this.owner.getLaneById(s);if(a&&a!==this)throw new Error(`Lane "${s}" already exists`)}nt(this.data,t),i&&(this.isImplicit=!1),s!==o&&(this.id=s);const r=Xn(I(t,"article"));return this._resolveFromData(),s!==o&&this.owner._handleLaneIdChange(this,o),r.styleChanged&&!n&&this.owner._refreshArticlesForLane(this,{refreshStyles:!0}),this.owner._handleLaneChange({requestRedraw:!e}),{articleImpact:r,idChanged:s!==o,laneId:this.id}},et.prototype.setOption=function(t,e){if(typeof t=="string"){const i=Jn(t);if(typeof e=="undefined")return I(this.data,i);t=ct(i,e)}this._applyOption(t)},et.prototype.hide=function(){this.setOption("visibility","hidden")},et.prototype.show=function(){this.setOption("visibility","visible")},et.prototype.moveToIndex=function(t){return this.owner.moveLaneToIndex(this,t)},et.prototype.moveBefore=function(t){return this.owner.moveLaneBefore(this,t)},et.prototype.moveAfter=function(t){return this.owner.moveLaneAfter(this,t)},et.prototype.moveUp=function(){return this.owner.moveLaneUp(this)},et.prototype.moveDown=function(){return this.owner.moveLaneDown(this)},et.prototype.setStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return I(this.style,t);t=ct(t,e)}this.data.style=nt(this.data.style||{},t),this._resolveFromData(),this.owner._handleLaneChange({requestRedraw:!0,refreshOrder:!1})},Object.defineProperty(et.prototype,"visibility",{get(){const t=this&&this.data?this.data.visibility:void 0;if(typeof t=="undefined")return"visible";const e=oe(t,this,this);return e==="visible"||e==="hidden"?e:(W.warn("Invalid Lane.visibility value; expected 'visible'|'hidden'. Defaulting to 'visible'",{laneId:this&&this.id,value:e}),"visible")},set(t){this.data||(this.data={}),this.data.visibility=t},enumerable:!0,configurable:!1});function pt(t,e){this.id=e,this.owner=t,this.isDataLoaded=!1,this.title="",this.style={},this.period={from:null,to:null,isToPresent:!1}}pt.prototype.setupByReceivedData=function(t){this.data=N({},t),this.title=I(t,"title")||"",this.style=I(t,"style")||{},this._setupPeriod(t),this.isDataLoaded=!0},pt.prototype._setupPeriod=function(t){let e=Ye(t,"from");e=this.owner.getDmyFromInput(e);const i=e.precision,n=I(t,"isToPresent"),o=n===!0||n===1;let s,r;o?s=b.now():R(t,"to")?(s=Ye(t,"to"),s=this.owner.getDmyFromInput(s),r=s.precision):(s=e,r=i);const a=b.CreateAsStartOfPeriod(e,i),l=b.CreateAsExclusiveEndOfPeriod(s,r);this.period={from:a,to:l,isToPresent:o}},pt.prototype.overlapsInclusiveWithDates=function(t,e){return!(this.period.from.isAfter(e)||t.isAfter(this.period.to))},pt.prototype.setOption=function(t,e){let i=!1;if(typeof t=="string"){if(typeof e=="undefined")return I(this.data,t);t=ct(t,e)}if(nt(this.data,t),R(t,"id")&&(this.id=this.data.id),R(t,"title")&&(this.title=this.data.title),(R(t,"from")||R(t,"to")||R(t,"isToPresent"))&&(this._setupPeriod(this.data),i=!0),R(t,"style")){const n=this.owner.options.timeBand&&this.owner.options.timeBand.defaultStyle||{};this.style=D({},n,this.data.style||{})}i?this.owner.requestRedraw():this.owner.requestRedraw(this.owner.redraw)},pt.prototype.setStyle=function(t,e){if(typeof t=="string"){if(typeof e=="undefined")return I(this.style,t);t=ct(t,e)}this.data.style=nt(this.data.style||{},t);const i=this.owner.options.timeBand&&this.owner.options.timeBand.defaultStyle||{};this.style=D({},i,this.data.style||{}),this.owner.requestRedraw()},Object.defineProperty(pt.prototype,"visibility",{get(){const t=this&&this.data?this.data.visibility:void 0;if(typeof t=="undefined")return"visible";const e=oe(t,this,this);return e==="visible"||e==="hidden"?e:(W.warn("Invalid TimeBand.visibility value; expected 'visible'|'hidden'. Defaulting to 'visible'",{bandId:this&&this.id,value:e}),"visible")},set(t){this.data||(this.data={}),this.data.visibility=t},enumerable:!0,configurable:!1});function to(t){return t==="screen"||t===1}function Jr(){const t=typeof globalThis!="undefined"&&globalThis.devicePixelRatio||1;return typeof t!="number"||!isFinite(t)||t<=0?1:t}function Qr(t){const e=t&&t.dprMode==="native",i=Jr(),n=e?i:Math.ceil(i),o=t&&typeof t.dpr=="number"&&isFinite(t.dpr)&&t.dpr>0?t.dpr:n,s=t&&typeof t.maxDpr=="number"&&isFinite(t.maxDpr)&&t.maxDpr>0?t.maxDpr:4;return Math.min(s,Math.max(1,o))}function Ai(t,e,i,n,o){const s=Qr(o),r=Math.max(1,Math.round(e!=null?e:t.clientWidth||t.width||1)),a=Math.max(1,Math.round(i!=null?i:t.clientHeight||t.height||1));t.style&&(t.style.width!==`${r}px`&&(t.style.width=`${r}px`),t.style.height!==`${a}px`&&(t.style.height=`${a}px`));const l=r*s,c=a*s;t.width!==l&&(t.width=l),t.height!==c&&(t.height=c);const h=n||t.getContext&&t.getContext("2d")||null;return h&&typeof h.setTransform=="function"&&h.setTransform(s,0,0,s,0,0),t._dpr=s,s}function eo(t,e){const i=t.canvas._dpr||1;t.shadowOffsetX=e.x*i,t.shadowOffsetY=e.y*i,t.shadowBlur=e.amount*i,t.shadowColor=e.color}function io(t){t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor="transparent black"}function Ii(t,e,i,n,o,s){t.moveTo(e+s,i),t.lineTo(e+n-s,i),s>0&&t.quadraticCurveTo(e+n,i,e+n,i+s),t.lineTo(e+n,i+o),t.lineTo(e,i+o),t.lineTo(e,i+s),s>0&&t.quadraticCurveTo(e,i,e+s,i),s===0&&t.closePath()}function _e(t,e,i,n,o,s){t.beginPath(),t.moveTo(e+s,i),t.lineTo(e+n-s,i),t.arcTo(e+n,i,e+n,i+s,s),t.lineTo(e+n,i+o-s),t.arcTo(e+n,i+o,e+n-s,i+o,s),t.lineTo(e+s,i+o),t.arcTo(e,i+o,e,i+o-s,s),t.lineTo(e,i+s),t.arcTo(e,i,e+s,i,s),t.closePath()}function no(t,e,i,n,o,s,r,a){t.beginPath();const l=Math.PI/n;for(let c=0;c<2*n;c++){const h=(c&1)===0?s:o,u=e+Math.cos(1+c*l)*h,d=i+Math.sin(1+c*l)*h;c===0?t.moveTo(u,d):t.lineTo(u,d)}t.closePath(),t.lineWidth=1,t.strokeStyle=a,t.fillStyle=r,t.stroke(),t.fill()}function ta(t,e,i,n,o){let s;switch(i){case"left":s=t+n;break;case"center":s=t+e/2;break;case"right":s=t+e-n;break;default:s=t+n}return typeof o=="function"?o(s):i==="center"?t+Math.floor(e/2):s}function oo(t,e,i,n,o,s,r,a,l){const c=l/2;t.save(),t.beginPath(),t.arc(r+c,a+c,c,0,Math.PI*2,!1),t.closePath(),t.clip(),t.drawImage(e,i,n,o,s,r,a,l,l),t.restore()}function ea(t,e,i){const n=t.split(" "),o=[];let s=n[0];for(let r=1;r<n.length;r++){const a=n[r];e.measureText(`${s} ${a}`).width<=i?s+=` ${a}`:(o.push(s),s=a)}return o.push(s),o}let so;function ia(t){if(!/[^\u0020-\u007e]/u.test(t))return null;let e=t;typeof Intl!="undefined"&&typeof Intl.Segmenter=="function"&&(so||(so=new Intl.Segmenter(void 0,{granularity:"grapheme"})),e=so.segment(t));const i=[0];let n=0;for(const o of e)n+=typeof o=="string"?o.length:o.segment.length,i.push(n);return i}function ro(t,e,i,n="…"){if(!t||typeof t.measureText!="function")throw new Error("Invalid canvas context provided");if(typeof e!="string"||e===""||typeof i!="number"||Number.isNaN(i)||i<=0)return"";if(typeof n!="string"&&(n="…"),t.measureText(e).width<=i)return e;if(t.measureText(n).width>i)return"";const r=ia(e);let a=0,l=r?r.length-1:e.length,c="";for(;a<=l;){const h=Math.floor((a+l)/2),u=e.substring(0,r?r[h]:h).trimEnd();t.measureText(u+n).width<=i?(c=u,a=h+1):l=h-1}return c+n}function na(t,e,i=null,n=null){if(!Array.isArray(t)||t.length===0)return t;if(typeof e!="number"||e<=0)return[];const o=t.length>e,s=o?t.slice(0,e):[...t];if(s.length>0){const r=s.length-1,a=s[r];if(i&&typeof n=="number"){const l=o?t.slice(r).join(" "):a;s[r]=ro(i,l,n)}else o&&(s[r]+="...")}return s}const ao={up:0,down:0};function Ci(t,e={}){const{anchorY:i=0,canvasHeight:n=0,fallbackArea:o=ao}=e,s=Number.isFinite(i)?i:0,r=Number.isFinite(n)?n:0,a=typeof(o==null?void 0:o.up)=="number"&&Number.isFinite(o.up)?Math.max(0,o.up):0,l=typeof(o==null?void 0:o.down)=="number"&&Number.isFinite(o.down)?Math.max(0,o.down):0,c=t||o||ao,h=!!t,u=typeof c.up=="undefined"?h?0:a:c.up,d=typeof c.down=="undefined"?h?0:l:c.down,f=(y,v)=>{if(typeof v=="number")return Number.isFinite(v)?Math.max(0,v):0;const w=typeof v=="object"&&v!==null&&v.value==="edge";if(v==="edge"||w){const S=w?v.padding:0,_=typeof S=="number"&&Number.isFinite(S)?Math.max(0,S):0,L=y==="up"?Math.max(0,s):Math.max(0,r-s);return Math.max(0,L-_)}return 0},g=f("up",u),p=f("down",d);return{up:g,down:p,height:g+p}}const Le=t=>Number.isFinite(t)?Math.max(0,t):0;function yt(t){if(typeof t=="number"){const i=Le(t);return{top:i,right:i,bottom:i,left:i}}const e=t||{};return{top:Le(e.top),right:Le(e.right),bottom:Le(e.bottom),left:Le(e.left)}}function Pi(t){return yt(t.padding)}function Ft(t){var e,i,n;return(n=(i=(e=t.style)==null?void 0:e.border)==null?void 0:i.width)!=null?n:t.getCurrentStyle().border.width}function Me(t){var e,i;return Math.max(0,(i=(e=t.image.maxHeight)!=null?e:t.maxImageHeight)!=null?i:400)}function lo(t,e,i){const n=String(e!=null?e:"");return t.memo(`textWidth:${JSON.stringify([n,i])}`,()=>{if(!n)return 0;const o=t.owner.canvasContext;o.save(),o.font=i;const s=o.measureText(n).width;return o.restore(),s})}function Di(t,e=!0){const i=t.getCurrentStyle(),n=i.header.text,o=Pi(i.header),s=i.header.height!==0&&n.numberOfLines!==0?lo(t,t.title,n.font)+n.margin*2+o.left+o.right:0;if(!e)return s;const r=i.subheader.text,a=Pi(i.subheader),l=i.subheader.height!==0&&r.numberOfLines!==0?lo(t,t.subtitle,r.font)+r.margin*2+a.left+a.right:0;return Math.max(s,l)}function oa(t){const e=t.getCurrentStyle();return e.width==="auto"?Ti(t,Di(t),e.border.width):e.width}function Ti(t,e,i=0){var r,a,l,c,h;const n=(l=(a=(r=t.owner.options)==null?void 0:r.article)==null?void 0:a.rendering)==null?void 0:l.pixelSnap,o=((h=(c=t.owner).getCanvasDpr)==null?void 0:h.call(c))||1,s=n==="css"||n==="none"||n===!1?1:o;return(Math.floor(e*s)+1+Math.ceil(i*s))/s}const _t=t=>Math.max(0,Number(t)||0);function ho(t,e,i,n,o){var u;const s=e.text,r=String(i!=null?i:""),a=Pi(e),l=_t(n-a.left-a.right-_t(s.margin)*2),c=Math.max(0,Math.floor((u=s.numberOfLines)!=null?u:1)),h=`textBlock:${JSON.stringify([r,l,s.font,s.baseline,s.lineHeight,c,s.offsetY,e.height===0,a.top,a.right,a.bottom,a.left])}`;return t.memo(h,()=>{var w,S;const d=[{lines:[],height:0,ascent:0,descent:0,advance:0}];if(!r.trim()||!c||!l||e.height===0)return{variants:d,textWidth:l,padding:a};const f=o||t.owner.canvasContext;f.save(),f.font=s.font,f.textBaseline=s.baseline;const g=parseFloat((w=s.font.match(/[\d.]+px/))==null?void 0:w[0])||14;let p;const y=(_,L)=>{var A,k;const P=_[`fontBoundingBox${L}`];if(Number.isFinite(P))return P;p||(p=t.memo(`fontMetrics:${JSON.stringify([s.font,s.baseline])}`,()=>f.measureText("Mg")));const T=s.baseline==="middle"?.5:.8,C=g*(L==="Ascent"?T:1-T);return(k=(A=p[`emHeight${L}`])!=null?A:p[`actualBoundingBox${L}`])!=null?k:C},v=c===1?[r]:ea(r,f,l);for(let _=1;_<=Math.min(c,v.length);_++){const L=na(v,_,f,l).map(O=>ro(f,O,l));if(!L.some(O=>O.length>0))continue;const P=L.map(O=>f.measureText(O)),T=Math.max(...P.map(O=>y(O,"Ascent"))),C=Math.max(...P.map(O=>y(O,"Descent"))),A=_t((S=s.lineHeight)!=null?S:T+C),k=Math.max(0,T+C+(L.length-1)*A)+2*Math.abs(s.offsetY||0)+a.top+a.bottom;d.push({lines:L,height:k,ascent:T,descent:C,advance:A})}return f.restore(),{variants:d,textWidth:l,padding:a}})}function re(t,e){let i=t.variants[0];for(const n of t.variants)n.height<=e&&(i=n);return i}function sa(t,e,i,n,o=1/0){var u,d;const s=Math.max(0,o),r=t.height==="auto",a=e.height==="auto";let l=r?0:_t(t.height),c=a?0:_t(e.height);const h=Math.max(0,s-l-c);if(r&&a){const f=((u=i.variants[1])==null?void 0:u.height)||0,g=((d=n.variants[1])==null?void 0:d.height)||0,p=f+g<=h?g:0;l=re(i,h-p).height,c=re(n,h-l).height}else r?l=re(i,h).height:a&&(c=re(n,h).height);return{header:ot(N(N({},i),r?re(i,l):i.variants.at(-1)),{automatic:r,height:l,top:0}),subheader:ot(N(N({},n),a?re(n,c):n.variants.at(-1)),{automatic:a,height:c,top:l}),height:l+c}}function je(t,e,i=1/0,n){const o=t._textBlockLayouts;if(o){for(const l of o)if(l.width===e&&l.available===i&&l.title===t.title&&l.subtitle===t.subtitle)return l.result}const s=t.getCurrentStyle(),r=sa(s.header,s.subheader,ho(t,s.header,t.title,e,n),ho(t,s.subheader,t.subtitle,e,n),i),a=o||(t._textBlockLayouts=[]);return a.length===2&&a.shift(),a.push({width:e,available:i,title:t.title,subtitle:t.subtitle,result:r}),r}function Xe(t,e,i,n,o,s,r,a=e.height,l=i.baseline==="middle"){if(!e.lines.length||e.textWidth<=0)return;t.font=i.font,t.fillStyle=i.color,t.textAlign=i.align,t.textBaseline=i.baseline;const c=e.padding;n+=c.left,o+=c.top,s=_t(s-c.left-c.right);const h=(e.lines.length-1)*e.advance,u=e.ascent+e.descent+h,d=_t((e.automatic?Math.min(e.height,Math.max(0,a)):e.height)-c.top-c.bottom),f=(e.automatic?i.baseline==="middle":l)?(d-h)/2:(d-u)/2+e.ascent,g=i.align==="end"?"right":i.align==="start"?"left":i.align,p=ta(n,s,g,_t(i.margin),r);if(!e.automatic){for(let v=0;v<e.lines.length;v++)t.fillText(e.lines[v],p,r(o+f+(i.offsetY||0)+v*e.advance));return}const y=Math.min(d-h-e.descent,Math.max(e.ascent,f+(i.offsetY||0)));for(let v=0;v<e.lines.length;v++){const w=Math.min(o+d-e.descent,Math.max(o+e.ascent,r(o+y+v*e.advance)));t.fillText(e.lines[v],p,w)}}function Oi(t){var n,o,s,r,a,l;const e=((o=(n=t.owner)==null?void 0:n.getCanvasDpr)==null?void 0:o.call(n))||1,i=(l=(a=(r=(s=t.owner)==null?void 0:s.options)==null?void 0:r.article)==null?void 0:a.rendering)==null?void 0:l.pixelSnap;return Ln(e,i)}function Ri(t){const e=Oi(t);return{top:e(t.position.top),left:e(t.position.left)}}const co=70;function ra(t,e=1/0){var n,o;const i=t.getCurrentStyle();return i.image.visible===!1||!t.imageLoaded||!((n=t.image)!=null&&n.width)||!((o=t.image)!=null&&o.height)?0:uo(i,e)}function uo(t,e=1/0){const i=yt(t.image.margin),n=(t.height==="auto"?co:t.height)-i.top-i.bottom,o=Me(t);return Math.max(0,Math.min(n,o,e-i.left-i.right))}function ki(t,e){const i=t.getCurrentStyle(),n=ra(t,e),o=yt(i.image.margin),s=n>0?n+o.left+o.right:0;return{left:s,width:Math.max(0,e-s),imageSize:n}}const aa={name:"landscape",draw(t){var L,P,T,C;if(!this.isDataLoaded||isNaN(this.position.left))return;const e=this.getCurrentStyle(),i=Oi(this),n=Ri(this),o=n.top,s=n.left,r=this._cachedWidth,a=this._cachedHeight,l=e.backgroundColor||"#FFF",c=e.shadow,h=Math.max(0,Math.min(e.borderRadius||0,r/2,a/2));eo(t,c),t.fillStyle=l,h>0?(_e(t,s,o,r,a,h),t.fill()):t.fillRect(s,o,r,a),io(t),t.save(),_e(t,s,o,r,a,h),t.clip();const u=ki(this,r),d=s+u.left,f=u.width;if(u.imageSize>0){const A=e.image,k=yt(A.margin),O=s+k.left,x=o+k.top,F=u.imageSize;let Y,G,Q,jt;this.image.width>this.image.height?(Y=Ve((this.image.width-this.image.height)/2),G=0,Q=jt=this.image.height):(Y=0,G=0,Q=jt=this.image.width);const ai=A.shape||"square",xe=A.borderRadius||0,Ne=(Tt,Ot,Rt,Xt,kt,fe,me,ge)=>{xe>0?(t.save(),_e(t,kt,fe,me,ge,xe),t.clip(),t.drawImage(this.image,Tt,Ot,Rt,Xt,kt,fe,me,ge),t.restore()):t.drawImage(this.image,Tt,Ot,Rt,Xt,kt,fe,me,ge)};switch(ai){case"circle":{oo(t,this.image,Y,G,Q,jt,O,x,F);break}case"square":{Ne(Y,G,Q,jt,O,x,F,F);break}default:{const Tt=Math.min(F/this.image.width,F/this.image.height),Ot=Math.min(F,i(this.image.width*Tt)),Rt=Math.min(F,i(this.image.height*Tt)),Xt=i(O+(F-Ot)/2),kt=i(x+(F-Rt)/2);Ne(0,0,this.image.width,this.image.height,Xt,kt,Ot,Rt);break}}}const g=Ft(this),p=Math.max(0,a-g),y=je(this,f,p,t),v=o+g/2+Math.max(0,(p-y.height)/2),w=t.globalCompositeOperation==="source-over";for(const A of["header","subheader"]){const k=y[A];k.height>0&&(!w||e[A].color!=="transparent")&&(t.fillStyle=e[A].color,t.fillRect(d,v+k.top,f,k.height))}const S=e.height==="auto"&&(!y.header.automatic||!y.subheader.automatic);S&&t.restore(),Xe(t,y.header,e.header.text,d,v,f,i,p),Xe(t,y.subheader,e.subheader.text,d,v+y.subheader.top,f,i,Math.max(0,p-y.header.height)),this.titleLines=y.header.lines,this.summarisedSubtitle=y.subheader.lines.join(" "),S||t.restore();const _=e.border;if(_.width>0&&(t.strokeStyle=_.color,t.lineWidth=_.width,h>0?(_e(t,s,o,r,a,h),t.stroke()):t.strokeRect(s,o,r,a)),((C=(T=(P=(L=this.owner)==null?void 0:L.options)==null?void 0:P.article)==null?void 0:T.star)==null?void 0:C.visible)!==!1&&(this.isActive||this.isStarred)){const A=this.getIconBox(),k=i(A.left+A.width/2),O=i(A.top+A.height/2),x=i(Math.min(A.width,A.height)/2),F=i(x/2);let Y,G;this.isStarred?this.isMouseOverStar?(Y="#8A8A8A",G="#fff800"):(Y="#a5a5a5",G="#fff800"):this.isMouseOverStar?(Y="#8A8A8A",G="#dfdfdf"):(Y="#a5a5a5",G="#ebebeb"),no(t,k,O,5,F,x,G,Y)}},getWidth(){const t=this.getCurrentStyle();if(t.width!=="auto")return t.width;const e=Number.isFinite(t.maxWidth)?Math.max(0,t.maxWidth):1/0,i=ki(this,e).left;return Ti(this,Di(this)+i)},getHeight(){const t=this.getCurrentStyle();if(t.height!=="auto")return Math.max(0,t.height);const e=ki(this,this._cachedWidth),i=je(this,e.width).height+Ft(this),n=yt(t.image.margin),o=e.imageSize>0?e.imageSize+n.top+n.bottom:0;return Math.max(i,o)},getConnectorEnd(){const t=this.getCurrentStyle(),e=Ri(this);return{left:e.left+t.connectorLine.offsetX,top:e.top+this.getHeight()+t.connectorLine.offsetY}},getIconBox(){var l,c,h,u;if(((u=(h=(c=(l=this.owner)==null?void 0:l.options)==null?void 0:c.article)==null?void 0:h.star)==null?void 0:u.visible)===!1)return!1;const t=this.getCurrentStyle(),e=Oi(this),i=this._getWidth(),n=this._cachedHeight,o=Math.max(0,Math.min(t.star.width,i,n)),s={width:o,height:o},r=t.borderRadius||0,a=Ri(this);return s.left=e(a.left-r/4+i-s.width-t.star.margin),s.top=e(a.top+r/4+t.star.margin),s.left=Math.min(a.left+i-s.width,Math.max(a.left,s.left)),s.top=Math.min(a.top+n-s.height,Math.max(a.top,s.top)),s},defaultStyle:{width:220,height:co,borderRadius:4,image:{shape:"square",margin:4,borderRadius:4},header:{height:"auto",color:"transparent",text:{color:"#333",baseline:"alphabetic"}},subheader:{height:"auto",color:"transparent",text:{offsetY:3,color:"#777",baseline:"alphabetic"}}},defaultHoverStyle:{border:{color:"#a6c6e2"}},defaultActiveStyle:{header:{text:{color:"#000"}},subheader:{text:{color:"#333"}}}};class la{constructor(e){this.invalidateCb=e,this.seen=new Set,this.loading=new Set,this.loaded=new Set,typeof document!="undefined"&&document.fonts&&document.fonts.addEventListener&&document.fonts.addEventListener("loadingdone",i=>{for(const n of i.fontfaces)this._notifyFamily(n.family)})}use(e){!e||this.loading.has(e)||this.loaded.has(e)||(this.seen.add(e),typeof document!="undefined"&&document.fonts&&document.fonts.load&&(this.loading.add(e),document.fonts.load(e).then(()=>{this.loading.delete(e),this.loaded.add(e),this.invalidateCb(e)}).catch(i=>{W.warn("[FontWatcher] Font load failed:",e,i),this.loading.delete(e)})))}_notifyFamily(e){for(const i of this.seen)i.includes(e)&&(this.loading.delete(i),this.loaded.add(i),this.invalidateCb(i))}}const ha=64*1024*1024,ca=new Set(["square","circle"]),ua=new Set(["auto","prefer-bitmap","bitmap","prefer-img","img"]);function Bt(t){return typeof t=="number"&&Number.isFinite(t)&&t>0}function at(t){return Math.max(1,Math.floor(t||0))}class da{constructor(e={}){const{maxConcurrent:i=6,maxCacheBytes:n,requireCORS:o=!1,decodeMode:s="auto"}=e;this.maxConcurrent=Math.max(1,i|0),this.requireCORS=!!o;let r;typeof n=="number"?r=Number.isFinite(n)?Math.max(0,n):1/0:r=ha,this.maxCacheBytes=r;let a=typeof s=="string"?s.toLowerCase():"auto";ua.has(a)||(a="auto"),this.decodeMode=a,this.queue=[],this.active=0,this.cache=new Map,this.totalBytes=0,this.inflight=new Map}enqueue(e,i,n,o={}){if(!e||!i||typeof n!="function")return()=>{};const s=typeof o.shape=="string"?o.shape.toLowerCase():"natural",r={key:e,url:i,onReady:n,options:{targetW:Bt(o.targetW)?o.targetW:null,targetH:Bt(o.targetH)?o.targetH:null,allowUpscale:o.allowUpscale!==!1,shape:s,article:o.article||null},cancelled:!1,delivered:!1},a=this.cache.get(e);if(a){const c=this._acquire(a,r.options.article);r.delivered=!0;try{n(a.image,a.tainted,a.kind,a.close,c)}catch(h){throw c({keepState:!0,skipRedraw:!0}),h}return()=>{}}const l=this.inflight.get(e);return l?l.requests.push(r):r.options.article&&r.options.article.isInView?this.queue.unshift(r):this.queue.push(r),this._pump(),()=>this._cancel(r)}_cancel(e){var n;if(!e||e.cancelled||e.delivered)return;e.cancelled=!0;const i=this.inflight.get(e.key);if(i){const o=i.requests.indexOf(e);if(o!==-1&&i.requests.splice(o,1),i.requests.length===0)try{(n=i.controller)==null||n.abort()}catch(s){}}else{const o=this.queue.indexOf(e);o!==-1&&this.queue.splice(o,1)}}_pump(){if(!(this.active>=this.maxConcurrent))for(;this.active<this.maxConcurrent&&this.queue.length;){const e=this.queue.shift();if(!e||e.cancelled)continue;const i=e.options&&e.options.article;if(i&&i.isInRange===!1){e.cancelled=!0;try{i._pendingImageKey===e.key&&(i._pendingImageKey=null,typeof i._imageCancel=="function"&&(i._imageCancel=null))}catch(o){}continue}if(this.cache.has(e.key)){this._serveFromCache(e);continue}const n=this.inflight.get(e.key);if(n){n.requests.push(e);continue}this._startLoad(e)}}_serveFromCache(e){const i=this.cache.get(e.key);if(!i||e.cancelled)return;const n=this._acquire(i,e.options.article);e.delivered=!0;try{e.onReady(i.image,i.tainted,i.kind,i.close,n)}catch(o){throw n({keepState:!0,skipRedraw:!0}),o}}_startLoad(e){const i=typeof AbortController!="undefined"?new AbortController:null,n={requests:[e],controller:i};this.inflight.set(e.key,n),this.active++;const o=i?i.signal:void 0,s=this._loadResource(e,o);n.promise=s,s.then(r=>{if(!r)return;const a=this.cache.get(e.key);a&&this._evictEntry(e.key,a),r.key=e.key,r.refs=0,r.articles=new Set,r.lastUsed=this._now(),this.cache.set(e.key,r),this.totalBytes+=r.bytes||0;const l=n.requests.slice();for(const c of l){if(!c||c.cancelled)continue;const h=this._acquire(r,c.options.article);c.delivered=!0;try{c.onReady(r.image,r.tainted,r.kind,r.close,h)}catch(u){throw h({keepState:!0,skipRedraw:!0}),u}}this._trimCache()}).catch(()=>{}).finally(()=>{this.inflight.delete(e.key),this.active=Math.max(0,this.active-1),this._pump()})}_acquire(e,i){e.refs=(e.refs||0)+1,e.lastUsed=this._now(),i&&e.articles.add(i);let n=!1;const o=(s={})=>{n||(n=!0,this._releaseInternal(e.key,i,s))};return o._key=e.key,i&&(o._article=i),o}_releaseInternal(e,i,n={}){const o=this.cache.get(e);o&&(o.refs>0&&(o.refs-=1),o.lastUsed=this._now(),i&&o.articles instanceof Set&&o.articles.delete(i),this._dropArticleState(i,e,n),this._trimCache())}_dropArticleState(e,i,n){if(!e||!i)return;const o=!!n.keepState,s=!!n.skipRedraw;if(!o&&e._loadedImageKey===i){if(e.imageLoaded=!1,e.image=null,e._loadedImageKey=null,typeof e._cacheBucket=="function")try{const a=e._cacheBucket(),l=`imageRaster:${i}`;a&&Object.prototype.hasOwnProperty.call(a,l)&&delete a[l]}catch(a){}if(typeof e.updateCachedSize=="function")try{e.updateCachedSize()}catch(a){}const r=e.owner;if(!s&&r&&typeof r.requestRedraw=="function")try{r.requestRedraw()}catch(a){}}e._closeImage&&e._closeImage._key===i&&(e._closeImage=null)}_trimCache(){if(!Number.isFinite(this.maxCacheBytes)||this.totalBytes<=this.maxCacheBytes)return;const e=[];for(const[i,n]of this.cache.entries())n&&e.push({key:i,entry:n});e.sort((i,n)=>{const o=typeof i.entry.lastUsed=="number"?i.entry.lastUsed:0,s=typeof n.entry.lastUsed=="number"?n.entry.lastUsed:0;return o-s});for(const{key:i,entry:n}of e){if(this.totalBytes<=this.maxCacheBytes)break;n.refs>0||this._evictEntry(i,n)}}_evictEntry(e,i){if(this.cache.has(e)&&(this.cache.delete(e),this.totalBytes=Math.max(0,this.totalBytes-(i.bytes||0)),i&&typeof i.close=="function"))try{i.close()}catch(n){}}async _loadResource(e,i){if(!e||e.cancelled)return null;const n=this.decodeMode,o=typeof createImageBitmap=="function",s=async a=>{if(!o){if(a)throw new Error("ImageBitmap not supported");return null}try{return await this._loadViaFetch(e,i)}catch(l){if(a)throw l}try{return await this._loadViaImageElement(e,!0)}catch(l){if(a)throw l;return null}},r=async a=>{try{return await this._loadViaImageElement(e,!1)}catch(l){if(!a)throw l;return await s(!1)}};switch(n){case"bitmap":return await s(!0);case"prefer-bitmap":case"auto":{const a=await s(!1);return a||await r(!1)}case"prefer-img":{const a=await r(!0);return a||await s(!1)}case"img":return await r(!1);default:{const a=await s(!1);return a||await r(!1)}}}async _loadViaFetch(e,i){const n={signal:i,mode:"cors",credentials:this.requireCORS?"same-origin":"omit"},o=await fetch(e.url,n);if(!o.ok)throw new Error("image fetch failed");const s=await o.blob(),r=await createImageBitmap(s),a=this._computeTransform(e.options,r.width,r.height);let l=r;if(a.needsCrop||a.needsResize){const c=a.sw,h=a.sh,u={};a.resizeWidth&&(u.resizeWidth=a.resizeWidth),a.resizeHeight&&(u.resizeHeight=a.resizeHeight),l=await createImageBitmap(r,a.sx,a.sy,c,h,u);try{r.close()}catch(d){}}return this._buildEntryFromBitmap(l,!1)}async _loadViaImageElement(e,i){const n=await this._createImageElement(e.url),o=at(n.naturalWidth||n.width||0),s=at(n.naturalHeight||n.height||0),r=e.options.shape||"natural",a=this._computeTransform(e.options,o,s);if(!i&&r==="natural"&&(a.needsResize=!1,a.resizeWidth=null,a.resizeHeight=null),i&&typeof createImageBitmap=="function"){const l={};a.resizeWidth&&(l.resizeWidth=a.resizeWidth),a.resizeHeight&&(l.resizeHeight=a.resizeHeight);const c=await createImageBitmap(n,a.sx,a.sy,a.sw,a.sh,l);return this._buildEntryFromBitmap(c,!this.requireCORS)}if(a.needsCrop||a.needsResize){const l=this._drawToCanvas(n,a);return this._buildEntryFromCanvas(l,!this.requireCORS)}return{image:n,kind:"img",tainted:!this.requireCORS,close:()=>{},bytes:this._estimateBytes(o,s)}}_drawToCanvas(e,i){let n=i.resizeWidth!=null?i.resizeWidth:i.sw,o=i.resizeHeight!=null?i.resizeHeight:i.sh;if(i.resizeWidth!=null&&i.resizeHeight==null&&i.sw>0){const a=i.resizeWidth/i.sw;o=Math.max(1,Math.round(i.sh*a))}else if(i.resizeHeight!=null&&i.resizeWidth==null&&i.sh>0){const a=i.resizeHeight/i.sh;n=Math.max(1,Math.round(i.sw*a))}n=Math.max(1,Math.round(n)),o=Math.max(1,Math.round(o));const s=this._createCanvas(n,o),r=s.getContext&&s.getContext("2d");return r&&r.drawImage(e,i.sx,i.sy,i.sw,i.sh,0,0,n,o),s}_createCanvas(e,i){const n=at(e),o=at(i);if(typeof document!="undefined"&&typeof document.createElement=="function"){const s=document.createElement("canvas");return s.width=n,s.height=o,s}return typeof OffscreenCanvas!="undefined"?new OffscreenCanvas(n,o):{width:n,height:o,getContext:()=>null}}_buildEntryFromBitmap(e,i){return{image:e,kind:"bitmap",tainted:i,close:()=>{try{e.close()}catch(o){}},bytes:this._estimateBytes(e.width,e.height)}}_buildEntryFromCanvas(e,i){return{image:e,kind:"canvas",tainted:i,close:()=>{if(typeof e.close=="function")try{e.close()}catch(o){}},bytes:this._estimateBytes(e.width,e.height)}}_computeTransform(e,i,n){const o={sx:0,sy:0,sw:at(i),sh:at(n),resizeWidth:null,resizeHeight:null,needsCrop:!1,needsResize:!1},s=e.shape||"natural";if(ca.has(s)){o.sw!==o.sh&&(o.sw>o.sh?(o.sx=Math.floor((o.sw-o.sh)/2),o.sw=o.sh):(o.sy=Math.floor((o.sh-o.sw)/2),o.sh=o.sw),o.needsCrop=!0);const r=e.targetW||e.targetH;if(Bt(r)){const a=at(e.allowUpscale===!1?Math.min(r,o.sw):r);(a!==o.sw||e.allowUpscale!==!1)&&(o.resizeWidth=a,o.resizeHeight=a,o.needsResize=!0)}}else{const r=e.targetW,a=e.targetH,l=o.sw,c=o.sh,h=u=>{if(!Number.isFinite(u)||u<=0)return;e.allowUpscale===!1&&(u=Math.min(u,1));const d=at(l*u),f=at(c*u);d===l&&f===c||(o.resizeWidth=d,o.resizeHeight=f,o.needsResize=!0)};if(Bt(r)&&Bt(a)){const u=Math.min(r/l,a/c);h(u)}else Bt(r)?h(r/l):Bt(a)&&h(a/c)}return o.resizeWidth!=null&&o.resizeHeight==null?o.resizeHeight=at(o.sh):o.resizeHeight!=null&&o.resizeWidth==null&&(o.resizeWidth=at(o.sw)),o}_estimateBytes(e,i){return at(e)*at(i)*4}_now(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}_createImageElement(e){return new Promise((i,n)=>{const o=new Image;this.requireCORS&&(o.crossOrigin="anonymous"),o.decoding="async",o.fetchPriority="low",o.onload=()=>i(o),o.onerror=()=>n(new Error("image load error")),o.src=e,typeof o.decode=="function"&&o.decode().then(()=>i(o)).catch(()=>{})})}}const qe={[st]:1,[X]:xt,[J]:Nt,[q]:Et},fa={[q]:[12,6,3,1],[J]:[30,10,5,1],[X]:[30,10,5,1],[st]:[500,100,50,10,5,1]},fo=[{majorUnit:V,majorMilliseconds:j,minorUnit:q},{majorUnit:q,majorMilliseconds:Et,minorUnit:J},{majorUnit:J,majorMilliseconds:Nt,minorUnit:X},{majorUnit:X,majorMilliseconds:xt,minorUnit:st}],ma=vt;function $e(t){return t<V?qe[t]/j:t===V?1:null}function ga(t,e,i){return e===V?t.format("D MMM YYYY",i):e===X?t.format("HH:mm:ss"):t.format("HH:mm")}function Ae(t,e){return e===q||e===J?t.format("HH:mm"):e===X?`:${t.format("ss")}`:`.${t.format("SSS")}`}function pa(t,e){const i=t%100;let n;if(i>=11&&i<=13)n="th";else switch(t%10){case 1:n="st";break;case 2:n="nd";break;case 3:n="rd";break;default:n="th"}return`${new b(t,1,1).format("YYYY",{thousandsSeparator:e,bceText:""})}${n}`}function ya(t,e){switch(e){case X:return new b(t.year,t.month,t.day,t.hour,t.minute,t.second);case J:return new b(t.year,t.month,t.day,t.hour,t.minute);case q:return new b(t.year,t.month,t.day,t.hour);case V:return new b(t.year,t.month,t.day);case $:return new b(t.year,t.month,1);case it:return new b(t.year,1,1);case pe:return b.CreateAsStartOfPeriod(t,"decade");case vt:return b.CreateAsStartOfPeriod(t,"century");case ye:return b.CreateAsStartOfPeriod(t,"millennium");default:return null}}function wa(t,e){switch(e){case X:return t.addSeconds(1);case J:return t.addMinutes(1);case q:return t.addHours(1);case V:return t.getNextDay();case $:return t.getNextMonth();case it:return t.addYears(1);case pe:return b.CreateAsExclusiveEndOfPeriod(t,"decade");case vt:return b.CreateAsExclusiveEndOfPeriod(t,"century");case ye:return b.CreateAsExclusiveEndOfPeriod(t,"millennium");default:return null}}class z{constructor(e,i){this.owner=e,this.zoomOptions=i,this.zoom=0,this.startToken=null,this.unit=V,this.unitSizeInPixels=100,this.adaptiveMinorUnit=null,this.adaptiveMinorInterval=null,this.adaptiveMinorMarkerSpacingInPixels=null,this.unitLengthInYears=1,this.zoomChangedHandlers=[],this.yearPrefix={minor:!1,major:!1},this.unitLevels=[],this.unitOrder=[]}}z.prototype.getUnitSizeInPixelsForZoom=function(t){var s;const e=this.zoomOptions.ratio,i=this.unitLevels[this.unit],n=(s=i.referenceZoom)!=null?s:i.zoomStart;return i.startUnitSize*Math.pow(e,t-n)},z.prototype.getChangePoint=function(t){return this.unitLevels[this.unit].zoomStart},z.prototype.getUnitFromZoom=function(t){for(let e=this.unitOrder.length-1;e>=0;e--){const i=this.unitOrder[e];if(t>=this.unitLevels[i].zoomStart)return i}throw new Error(`Zoom ${t} is out of range`)},z.prototype.getAdaptiveMinorInterval=function(t=this.unit,e=this.unitSizeInPixels){var r;const i=fa[t];if(!i)return 1;const n=this.zoomOptions.unitSize.minimum,o=(r=this.zoomOptions.unitSize.showMinorLabels)!=null?r:n,s=Math.max(n,o);for(let a=i.length-1;a>=0;a--)if(e*i[a]>=s)return i[a];return null},z.prototype.getSubdayVisualMarkerLayout=function(){var r;if(this.zoomOptions.minimum>=V||this.zoom>V||this.unit>V)return null;const t=this.unit===V?j:qe[this.unit],e=this.unitSizeInPixels/t,i=(r=this.zoomOptions.unitSize.minimumMajor)!=null?r:120;let n=null;for(let a=fo.length-1;a>=0;a--){const l=fo[a];if(l.majorMilliseconds*e>=i){n=l;break}}if(!n)return null;const o=qe[n.minorUnit]*e,s=this.getAdaptiveMinorInterval(n.minorUnit,o);return ot(N({},n),{majorMarkerSpacingInPixels:n.majorMilliseconds*e,minorInterval:s,minorMarkerSpacingInPixels:s?o*s:null,minorMilliseconds:s?qe[n.minorUnit]*s:null,pixelsPerMillisecond:e})},z.prototype.getParentContextScale=function(){const t=this.getSubdayVisualMarkerLayout(),e=t?t.majorUnit:this.unit+1;return e<st||e>ma?null:{level:this.zoomUnitToString(e),levelUnit:e,parentUnit:e<=q?V:e+1}},z.prototype.isParentContextTextVisible=function(t){if((t==null?void 0:t.visible)!==!0)return!1;const e=this.getParentContextScale();return e?t.levels==="all"?!0:Array.isArray(t.levels)&&t.levels.includes(e.level):!1},z.prototype.formatParentContextLabel=function(t,e){const i=this.getDateLabelFormatOptions(E);switch(e){case X:case J:case q:case V:return t.format("D MMM YYYY",i);case $:return t.format("MMM YYYY",i);case it:return t.format("YYYY",i);case pe:{const n=t.year<=0?1-t.year:t.year,o=Math.floor(n/10)*10;return o===0?t.year<=0?`9–1${i.bceText}`:"1–9":`${new b(o,1,1).format("YYYY",{thousandsSeparator:i.thousandsSeparator,bceText:""})}s${t.year<=0?i.bceText:""}`}case vt:case ye:{const n=t.year<=0?1-t.year:t.year,s=Math.ceil(n/(e===vt?100:1e3)),r=e===vt?"century":"millennium";return`${pa(s,i.thousandsSeparator)} ${r}${t.year<=0?i.bceText:""}`}default:return""}},z.prototype.createParentContextTokens=function(t,e,i){const n=this.getParentContextScale();if(!n||!t||!this.startToken)return[];const o=[];let s=ya(t,n.parentUnit),r=i+this.getPixelsBetween(this.startToken.value,s);do{const a=wa(s,n.parentUnit);if(!a)break;const l=i+this.getPixelsBetween(this.startToken.value,a);o.push({drawX:r,label:this.formatParentContextLabel(s,n.parentUnit),length:l-r,unit:n.parentUnit,value:s}),s=a,r=l}while(o.length<1e3&&o[o.length-1].drawX<=e);return o},z.prototype.setAdaptiveMinorInterval=function(){const t=this.getSubdayVisualMarkerLayout();if(!t){this.adaptiveMinorUnit=null,this.adaptiveMinorInterval=null,this.adaptiveMinorMarkerSpacingInPixels=null;return}this.adaptiveMinorUnit=t.minorUnit,this.adaptiveMinorInterval=t.minorInterval,this.adaptiveMinorMarkerSpacingInPixels=t.minorMarkerSpacingInPixels},z.prototype.createSubdayVisualMarkers=function(t,e,i=this.getSubdayVisualMarkerLayout()){const n={[E]:[],[B]:[]};if(!i||!this.startToken)return n;const o=150,s=i.minorMilliseconds||i.majorMilliseconds,r=Math.floor((-o-e)/i.pixelsPerMillisecond),a=this.startToken.value.addMilliseconds(r),l=new b(a.year,a.month,a.day),c=Math.floor(a.getMillisecondsOfDay()/s)*s;let h=l.addMilliseconds(c);const u=i.minorMarkerSpacingInPixels>=this.zoomOptions.unitSize.showMinorLabels,d=p=>({drawX:e+this.getPixelsBetween(this.startToken.value,p),label:ga(p,i.majorUnit,this.getDateLabelFormatOptions(E)),length:i.majorMarkerSpacingInPixels,markerSpacingInPixels:i.majorMarkerSpacingInPixels,type:E,unit:i.majorUnit,value:p,visual:!0}),f=Math.floor(a.getMillisecondsOfDay()/i.majorMilliseconds)*i.majorMilliseconds,g=l.addMilliseconds(f);for(g.isAfter(h)===!1&&!g.isSame(h)&&n[E].push(d(g));;){const p=e+this.getPixelsBetween(this.startToken.value,h);if(p>t+o)break;h.getMillisecondsOfDay()%i.majorMilliseconds===0?n[E].push(d(h)):i.minorMilliseconds&&n[B].push({adaptive:i.minorInterval!==1,drawX:p,label:u?Ae(h,i.minorUnit):void 0,length:i.minorMarkerSpacingInPixels,markerSpacingInPixels:i.minorMarkerSpacingInPixels,type:B,unit:i.minorUnit,value:h,visual:!0}),h=h.addMilliseconds(s)}return n},z.prototype.createHourToken=function(t){const e={unit:q,value:t,length:this.unitSizeInPixels},i=this.unitLevels[q];return t.hour===0?(e.label=t.format("D MMM YYYY",this.getDateLabelFormatOptions(E)),e.type=E):(e.type=B,this.zoom<i.zoomHideMinorLabels&&(e.label=Ae(t,q))),e},z.prototype.createMinuteToken=function(t){const e={unit:J,value:t,length:this.unitSizeInPixels},i=this.unitLevels[J];return t.minute===0?(e.label=t.format("HH:mm"),e.type=E):(e.type=B,this.zoom<i.zoomHideMinorLabels&&(e.label=Ae(t,J))),e},z.prototype.createSecondToken=function(t){const e={unit:X,value:t,length:this.unitSizeInPixels},i=this.unitLevels[X];return t.second===0?(e.label=t.format("HH:mm:ss"),e.type=E):(e.type=B,this.zoom<i.zoomHideMinorLabels&&(e.label=Ae(t,X))),e},z.prototype.createMillisecondToken=function(t){const e={unit:st,value:t,length:this.unitSizeInPixels},i=this.unitLevels[st];return t.millisecond===0?(e.label=t.format("HH:mm:ss.SSS"),e.type=E):(e.type=B,this.zoom<i.zoomHideMinorLabels&&(e.label=Ae(t,st))),e},z.prototype.getDateLabelFormatOptions=function(t){t=t===E?"major":"minor";const e=this.owner.options.style.dateLabel[t];return{thousandsSeparator:e.thousandsSeparator,bceText:e.bceText,yearPrefix:this.yearPrefix[t]}},z.prototype.createYearToken=function(t){const e={unit:this.unit,value:t,length:this.unitSizeInPixels};let i=t.year;const n=i===0;i<=0&&(i=-i+1);const o=this.unitLengthInYears,s=this.unitLevels[this.unit];return i%(o*10)===0||n?(e.label=t.format("YYYY",this.getDateLabelFormatOptions(E)),e.type=E):(e.type=B,this.zoom<s.zoomHideMinorLabels&&(e.label=t.format("YYYY",this.getDateLabelFormatOptions(B)))),e},z.prototype.createMonthToken=function(t){const e={unit:this.unit,value:t,length:this.unitSizeInPixels},i=this.unitLevels[$];return t.month===1?(e.label=t.format("YYYY",this.getDateLabelFormatOptions(E)),e.type=E):(e.type=B,this.zoom<i.zoomHideMinorLabels&&(e.label=t.format("MMM"))),e},z.prototype.createDayToken=function(t){const e={unit:this.unit,value:t,length:this.unitSizeInPixels},i=this.unitLevels[V];return t.day===1?(e.label=t.format("MMM YYYY",this.getDateLabelFormatOptions(E)),e.type=E):(e.type=B,this.zoom<i.zoomHideMinorLabels&&(e.label=t.format("D"))),e},z.prototype.addZoomChangedHandler=function(t,e){this.zoomChangedHandlers.push({callback:t,context:e||this})},z.prototype.notifyZoomChanged=function(){for(let t=0;t<this.zoomChangedHandlers.length;t++)this.zoomChangedHandlers[t].callback.call(this.zoomChangedHandlers[t].context)},z.prototype.setZoom=function(t){var o,s;const e=this.zoom;let i=parseFloat(t.toFixed(4));i<this.zoomOptions.minimum&&(i=this.zoomOptions.minimum),i>this.zoomOptions.maximum&&(i=this.zoomOptions.maximum),this.zoom=i,this.unit=this.getUnitFromZoom(this.zoom),this.unitSizeInPixels=this.getUnitSizeInPixelsForZoom(this.zoom),this.setAdaptiveMinorInterval();let n=0;if(this.unit>=it){const r=this.unit-it;n=Math.pow(10,r)}if(this.unitLengthInYears=n,this.setCurrentYearPrefixes(),this.owner._isInitialized){const r=this.zoom-e;this.owner.trigger("zoom",{zoom:this.zoom,zoomDelta:r})}return(s=(o=this.owner)._markTimelineStateChanged)==null||s.call(o),this.notifyZoomChanged(),this.zoom},z.prototype.getPixelsBetween=function(t,e){const i=this.unit;return i<=V?t.getDaysTo(e)*this.unitSizeInPixels/$e(i):i===$?t.getMonthsTo(e)*this.unitSizeInPixels:t.getYearsTo(e)*this.unitSizeInPixels/this.unitLengthInYears},z.prototype.setStartToken=function(t){return this.startToken=t},z.prototype.setStartDate=function(t){let e=0;switch(t.year<0&&(e=1),this.unit){case st:return this.startToken=this.createMillisecondToken(new b(t)),0;case X:{const i=new b(t.year,t.month,t.day,t.hour,t.minute,t.second);return this.startToken=this.createSecondToken(i),-this.getPixelsBetween(i,t)}case J:{const i=new b(t.year,t.month,t.day,t.hour,t.minute);return this.startToken=this.createMinuteToken(i),-this.getPixelsBetween(i,t)}case q:{const i=new b(t.year,t.month,t.day,t.hour);return this.startToken=this.createHourToken(i),-this.getPixelsBetween(i,t)}case V:return this.startToken=this.createDayToken(new b(t.year,t.month,t.day)),-this.getPixelsBetween(this.startToken.value,t);case $:return this.startToken=this.createMonthToken(new b(t.year,t.month,1)),this.unitSizeInPixels/30.44*(this.startToken.value.day-t.day);case it:return this.startToken=this.createYearToken(new b(t.year,1,1)),this.unitSizeInPixels/365.2422*((this.startToken.value.month-t.month)*30.44+(this.startToken.value.day-t.day));default:{const i=this.unitLengthInYears;return this.startToken=this.createYearToken(new b(Math.floor(t.year/i)*i+e,1,1)),this.unitSizeInPixels/(365.2422*i)*((this.startToken.value.year-t.year)*365.2422+(this.startToken.value.month-t.month)*30.44+(this.startToken.value.day-t.day))}}},z.prototype.getStartTokenCloned=function(){switch(this.startToken.unit){case st:return this.createMillisecondToken(this.startToken.value);case X:return this.createSecondToken(this.startToken.value);case J:return this.createMinuteToken(this.startToken.value);case q:return this.createHourToken(this.startToken.value);case V:return this.createDayToken(this.startToken.value);case $:return this.createMonthToken(this.startToken.value);default:return this.createYearToken(this.startToken.value)}},z.prototype.getNext=function(t){switch(t.unit){case st:return this.createMillisecondToken(t.value.addMilliseconds(1));case X:return this.createSecondToken(t.value.addSeconds(1));case J:return this.createMinuteToken(t.value.addMinutes(1));case q:return this.createHourToken(t.value.addHours(1));case V:return this.createDayToken(t.value.getNextDay());case $:return this.createMonthToken(t.value.getNextMonth());case it:return this.createYearToken(t.value.addYears(1));default:{const e=this.unitLengthInYears;return this.createYearToken(t.value.addYears(t.value.year===-(e-1)?e-1:e))}}},z.prototype.getPrevious=function(t){switch(t.unit){case st:return this.createMillisecondToken(t.value.addMilliseconds(-1));case X:return this.createSecondToken(t.value.addSeconds(-1));case J:return this.createMinuteToken(t.value.addMinutes(-1));case q:return this.createHourToken(t.value.addHours(-1));case V:return this.createDayToken(t.value.getPreviousDay());case $:return this.createMonthToken(t.value.getPreviousMonth());case it:return this.createYearToken(t.value.addYears(-1));default:{const e=this.unitLengthInYears;return this.createYearToken(t.value.addYears(t.value.year===0?1-e:-e))}}},z.prototype.getPreviousNth=function(t,e){for(let i=0;i<e;i++)t=this.getPrevious(t);return t},z.prototype.zoomUnitToString=function(t){switch(t){case st:return"millisecond";case X:return"second";case J:return"minute";case q:return"hour";case V:return"day";case $:return"month";case it:return"year";case pe:return"decade";case vt:return"century";case ye:return"millennium";case Ji:return"10 thousand years";case Qi:return"100 thousand years";case tn:return"million years";case en:return"10 million years";case nn:return"100 million years";case on:return"billion years";default:return"unknown"}},z.prototype.setUnitLevels=function(){this.unitLevels=[],this.unitOrder=[];const t=this.zoomOptions.unitSize.minimum,e=this.zoomOptions.unitSize.showMinorLabels,i=0,n=(x,F)=>{this.unitLevels[x]=F,this.unitOrder.push(x)},o=this.getZoomChangeByDistance(e,t),s=this.zoomOptions.unitSize.initial,r=this.getZoomChangeByDistance(s,t),a=i+r,l=a-o;n(V,{startUnitSize:s,zoomStart:i,zoomHideMinorLabels:l,zoomEnd:a});const h=s/24,u=this.getZoomChangeByDistance(h,t*60);n(q,{startUnitSize:t*60,zoomStart:u,zoomEnd:i,zoomHideMinorLabels:u+this.getZoomChangeByDistance(t*60,e)});const d=u+this.getZoomChangeByDistance(t,t*60);n(J,{startUnitSize:t*60,zoomStart:d,zoomEnd:u,zoomHideMinorLabels:d+this.getZoomChangeByDistance(t*60,e)});const f=d+this.getZoomChangeByDistance(t,t*1e3);n(X,{startUnitSize:t*1e3,zoomStart:f,zoomEnd:d,zoomHideMinorLabels:f+this.getZoomChangeByDistance(t*1e3,e)}),n(st,{startUnitSize:t,referenceZoom:f,zoomStart:Number.NEGATIVE_INFINITY,zoomEnd:f,zoomHideMinorLabels:f+this.getZoomChangeByDistance(t,e)});const g=t*31,p=this.getZoomChangeByDistance(g,t),y=a+p,v=y-o;n($,{startUnitSize:g,zoomStart:a,zoomHideMinorLabels:v,zoomEnd:y});const w=t*12,S=this.getZoomChangeByDistance(w,t),_=y+S,L=_-o;n(it,{startUnitSize:w,zoomStart:y,zoomHideMinorLabels:L,zoomEnd:_});let P,T,C=_,A,k;const O=8;for(let x=1;x<=O;x++)P=t*10,T=this.getZoomChangeByDistance(P,t),A=C+T,k=A-o,n(it+x,{startUnitSize:P,zoomStart:C,zoomHideMinorLabels:k,zoomEnd:A}),C=A,x===O&&(this.zoomOptions.maximum=Math.min(this.zoomOptions.maximum,A));this.unitOrder.sort((x,F)=>x-F)},z.prototype.getZoomChangeByDistance=function(t,e){const i=this.zoomOptions.ratio;return Math.log(e/t)/Math.log(i)},z.prototype.scaleDistanceByZoomChange=function(t,e){const i=this.zoomOptions.ratio;return t*Math.pow(i,e)},z.prototype.setCurrentYearPrefixes=function(){const t=["minor","major"];if(this.unit<it){for(let n=0;n<t.length;n++)this.yearPrefix[t[n]]=!1;return}const e=this.owner.options.style.dateLabel,i={minor:this.unitLengthInYears,major:this.unitLengthInYears*10};for(let n=0;n<t.length;n++){const o=t[n],s=Object.values(e[o].yearPrefixes);this.yearPrefix[o]=!1,s.sort(function(r,a){return a.minDivision-r.minDivision});for(let r=0;r<s.length;r++){const a=s[r];if(a.minDivision<=i[o]){this.yearPrefix[o]={label:a.label,value:a.value};break}}}};const mo=["http","https","data","blob"];function ba(t,e=mo){if(typeof t!="string")return!1;const i=t.trim(),n=i.toLowerCase();if(n.startsWith("data:"))return e.includes("data");if(n.startsWith("blob:"))return e.includes("blob");try{const o=new URL(i,typeof window!="undefined"?window.location.href:void 0);return e.includes(o.protocol.replace(":",""))}catch(o){return!1}}function va(t){return/^data:image\//i.test(t)}function Sa(t,e){if(!Array.isArray(e)||e.length===0)return!0;try{const i=new URL(t,typeof window!="undefined"?window.location.href:void 0),n=i.origin.toLowerCase(),o=i.hostname.toLowerCase();for(const s of e){if(typeof s!="string")continue;const r=s.trim().toLowerCase();if(r.includes("://")){try{const a=new URL(r).origin.toLowerCase();if(n===a)return!0}catch(a){}continue}if(r.startsWith("*.")&&(o===r.slice(2)||o.endsWith(`.${r.slice(2)}`))||r.startsWith(".")&&(o===r.slice(1)||o.endsWith(r))||o===r||o.endsWith(`.${r}`))return!0}return!1}catch(i){return!0}}function _a(t,e={}){if(typeof t!="string")return null;const i=Array.isArray(e.allowedSchemes)&&e.allowedSchemes.length?e.allowedSchemes:mo;if(!ba(t,i))return null;const n=t.trim().toLowerCase();return n.startsWith("data:")?va(n)?t:null:Sa(t,e.allowedOrigins)?t:null}function La(t){return t instanceof HTMLCanvasElement||t&&t.nodeName==="CANVAS"}function Ma({width:t,height:e,className:i,style:n}={}){const o=document.createElement("canvas");return t!=null&&(o.width=t),e!=null&&(o.height=e),i&&(o.className=i),o.style.touchAction="none",n&&Object.assign(o.style,n),o}function go(t,e){return t!=null&&t.append?t.append(e):t.appendChild(e),e}function Aa(t){const e=t.getBoundingClientRect();return{left:e.left,top:e.top}}function Ia(){document.selection?document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges()}const ut=typeof window!="undefined"&&"onpointerdown"in window,Ca=750,po=ut?{down:"pointerdown",move:"pointermove",up:"pointerup",cancel:"pointercancel",leave:"pointerleave"}:{down:"mousedown",move:"mousemove",up:"mouseup",cancel:"mouseleave",leave:"mouseleave"};function Ke(t,e,i,n){const o=po[e]||e;t.addEventListener(o,i,n),ut||(e==="down"&&t.addEventListener("touchstart",i,n),e==="move"&&t.addEventListener("touchmove",i,n),e==="up"&&(t.addEventListener("touchend",i,n),t.addEventListener("touchcancel",i,n)))}function Je(t,e,i,n){const o=po[e]||e;t.removeEventListener(o,i,n),ut||(e==="down"&&t.removeEventListener("touchstart",i,n),e==="move"&&t.removeEventListener("touchmove",i,n),e==="up"&&(t.removeEventListener("touchend",i,n),t.removeEventListener("touchcancel",i,n)))}function Lt(t){if(t.touches&&t.touches[0]){const e=t.touches[0];return{x:e.clientX,y:e.clientY}}if(t.changedTouches&&t.changedTouches[0]){const e=t.changedTouches[0];return{x:e.clientX,y:e.clientY}}return{x:t.clientX,y:t.clientY}}class Pa{constructor(e,{onStart:i,onMove:n,onEnd:o,onDestroy:s}={}){this.target=e,this.onStart=i,this.onMove=n,this.onEnd=o,this.onDestroy=s,this.pointers=new Map,this.lastTouchTime=0,this._handleDown=this._handleDown.bind(this),this._handleMove=this._handleMove.bind(this),this._handleUp=this._handleUp.bind(this),Ke(e,"down",this._handleDown),Ke(window,"move",this._handleMove),Ke(window,"up",this._handleUp),ut&&Ke(window,"cancel",this._handleUp)}destroy(){var e;Je(this.target,"down",this._handleDown),Je(window,"move",this._handleMove),Je(window,"up",this._handleUp),ut&&Je(window,"cancel",this._handleUp),this.pointers.clear(),(e=this.onDestroy)==null||e.call(this)}_handleDown(e){if(!ut){if(this._isTouchEvent(e))this.lastTouchTime=Date.now();else if(this._shouldIgnoreMouseEvent(e))return}ut?this._addOrUpdatePointer(e):e.touches?this._syncTouches(e):this.pointers.set("mouse",{id:"mouse",x:e.clientX,y:e.clientY,type:"mouse"}),this.onStart&&this.onStart(e,this)}_handleMove(e){if(!ut){if(this._isTouchEvent(e))this.lastTouchTime=Date.now();else if(this._shouldIgnoreMouseEvent(e))return}if(ut)this.pointers.has(this._getPointerId(e))&&this._addOrUpdatePointer(e);else if(e.touches)this._syncTouches(e);else if(this.pointers.has("mouse")){const i=this.pointers.get("mouse");i.x=e.clientX,i.y=e.clientY}this.onMove&&this.onMove(e,this)}_handleUp(e){if(!ut){if(this._isTouchEvent(e))this.lastTouchTime=Date.now();else if(this._shouldIgnoreMouseEvent(e))return}if(ut)this.pointers.delete(this._getPointerId(e));else if(e.changedTouches){for(const i of e.changedTouches)this.pointers.delete(i.identifier);(!e.touches||e.touches.length===0)&&this.pointers.delete("mouse")}else this.pointers.delete("mouse");this.onEnd&&this.onEnd(e,this)}_getPointerId(e){return e.pointerId!=null?e.pointerId:"mouse"}_isTouchEvent(e){return!!(e.touches||e.changedTouches)}_shouldIgnoreMouseEvent(e){return!this._isTouchEvent(e)&&Date.now()-this.lastTouchTime<Ca}_addOrUpdatePointer(e){this.pointers.set(this._getPointerId(e),{id:this._getPointerId(e),x:e.clientX,y:e.clientY,type:e.pointerType||"mouse"})}_syncTouches(e){this.pointers.clear();for(const i of e.touches)this.pointers.set(i.identifier,{id:i.identifier,x:i.clientX,y:i.clientY,type:"touch"})}get list(){return Array.from(this.pointers.values())}}function Da(t){return t.list[0]||null}function yo(t){const e=t.list;return e.length===0?null:e.length===1?{x:e[0].x,y:e[0].y}:{x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2}}function wo(t){const e=t.list;if(e.length<2)return 0;const i=e[0].x-e[1].x,n=e[0].y-e[1].y;return Math.hypot(i,n)}function m(t,e){var l;const i=Qn(e);this._registeredArticleLayoutStyles=D({},Se.article.layoutStyles||{}),this._explicitArticleOptions=nt({},(i==null?void 0:i.article)||{}),this.options=nt(D({},Se),i,c=>this._getDefaultOption(c)),La(t)?this.canvas=t:(this.canvas=Ma(),go(t,this.canvas)),this.canvas&&this.canvas.style&&(this.options.width!=null&&(this.canvas.style.width=`${this.options.width}px`),this.options.height!=null&&(this.canvas.style.height=`${this.options.height}px`)),this.canvasContext=this.canvas.getContext("2d"),this.canvasDpr=Ai(this.canvas,this.options.width,this.options.height,this.canvasContext,this.options.canvas),this.fontWatcher=new la(c=>{this.forLoadedArticles(h=>h.invalidateCaches()),this.requestRedraw()});const n=this.canvasContext,o=n.measureText.bind(n);n.measureText=c=>(this.fontWatcher.use(n.font),o(c)),this.width=this.canvas.clientWidth||this.options.width,this.top=this.options.height-this._getEffectiveVerticalOffset(),this.repositionWindow=0,this.uniqueId=`tl${new Date().getTime()}`,this.title="My timeline",this.ownerId=void 0,this.cursor="default",this.mouseoverArticle=null,this.isDragging=!1,this.draggingArticle=null,this.dragStartX=0,this.isPanning=!1,this.isPinching=!1,this.isAnimating=!1,this.isAnimatingArticles=!1,this.isCustomAnimating=!1,this.animation={redrawFunction:!1,defaultRedrawFunction:this.repositionRedraw,dragRedrawFunction:this.defaultRedraw,pan:null,zoom:null,pinchZoom:null},this.lastAnimatingArticle={id:null,endTime:0},this.topRow=0,this.loadingHttpRequests=[],this.articles=[],this.lanes=[],this.timeBands=[],this.charts=[],this._runtimeArticleOptions={},this.redrawRequests={default:!1,reposition:!1},this._initialiseLaneHost(t),this.handlers={},this.options.on&&this.onMultiple(this.options.on),this._isInitialized=!1,this._hasPendingTimelineStateChange=!1;const s=this.options.zoom,r=this.getDmyFromInput(this.options.initialDate);this.timescaleManager=new z(this,s),this.timescaleManager.setUnitLevels(),this.timescaleManager.addZoomChangedHandler(this.zoomChanged,this),this.timescaleManager.setZoom(s.initial),this.timescaleManager.setStartDate(r),(l=this.settleDateBounds)==null||l.call(this,{animate:!1}),this.options.enableUserControl&&(this.enableZoomByWheel(),this.enableDragging()),this.groups={level:-1,periods:[]};const a=this.options.image||{};this.imageLoader=new da({maxConcurrent:a.maxConcurrent,maxCacheBytes:a.maxCacheBytes,requireCORS:a.requireCORS,decodeMode:a.decodeMode}),this.options.lane&&Array.isArray(this.options.lane.data)&&this.options.lane.data.length>0&&this.addLanes(this.options.lane.data),this.options.timeBand&&Array.isArray(this.options.timeBand.data)&&this.options.timeBand.data.length>0&&typeof this.addTimeBands=="function"&&this.addTimeBands(this.options.timeBand.data),this.options.chart&&Array.isArray(this.options.chart.data)&&this.options.chart.data.length>0&&typeof this.addCharts=="function"&&this.addCharts(this.options.chart.data),this.requestRedraw(),this._isInitialized=!0}m.prototype.setTitle=function(t){this.title=t,this._emitTimelineStateChange()},m.prototype.getWidth=function(){return this.canvas.clientWidth||this.options.width},m.prototype.getCanvasDpr=function(){return this.canvasDpr||1},m.prototype.isInVicinity=function(t,e,i){if(e=oe(e,this,t,i),typeof e=="boolean")return e;const n=i||this.getRelativePosition(t),o=e.up===void 0||n.top>this.top-e.up,s=e.down===void 0||n.top<this.top+e.down;return o&&s},m.prototype.getPixel=function(t,e){let i;const n=t.toKeyString();if(e){if(i=e.tokens,Object.prototype.hasOwnProperty.call(i,n))return i[n]}else i={};const o=this.repositionWindow,s=this.timescaleManager.startToken;return i[n]=this.timescaleManager.getPixelsBetween(s.value,t)+o},m.prototype.getRelativePosition=function(t){const{x:e,y:i}=Lt(t),n=this.canvas.getBoundingClientRect();return{left:e-n.left,top:i-n.top}},m.prototype.updateCursor=function(t){const e=this.cursor,i=this.cursor=this.getCursor(t);e!==i&&(this.canvas.style.cursor=i)},m.prototype.getCursor=function(t){const e=this.options.style.cursor;if(this.isDragging)return e.timeline.dragging;const i=this.getRelativePosition(t);return this.draggingArticle?this.draggingArticle.getCursor(i):!this.options.disableBranding&&(this._isInsideHistropediaJSLink(i)||this._isInsideTermsLink(i))?e.clickable:this.mouseoverArticle!==null?this.mouseoverArticle.getCursor(i):e.timeline.hover},m.prototype.onRedraw=function(t){W.warn('DEPRECATION WARNING: timeline.onRedraw(handler) is deprecated. Use timeline.on("timeline-render-end", handler) instead.'),typeof this.on=="function"&&this.on("timeline-render-end",t)},m.prototype.zoomChanged=function(){let t;this.currentDensitySetting&&(t=this.currentDensitySetting.region),this.updateCurrentDensitySetting(),t!==this.currentDensitySetting.region&&this.updateArticlesGroupIndex()},m.prototype.updateCurrentDensitySetting=function(){for(let t=0;t<hi.length;t++){const e=hi[t];if(this.timescaleManager.zoom>=e.zoom.from&&this.timescaleManager.zoom<e.zoom.to){this.currentDensitySetting=e;break}}},m.prototype.calculateEndToken=function(){const t=this.getWidth();let e=this.repositionWindow,n=this.timescaleManager.startToken,o;do o=n,n=this.timescaleManager.getNext(n),e+=n.length;while(e<t);return o},m.prototype.getDensityPick=function(t=this.options.article.density){switch(t){case"low":case 1:return this.currentDensitySetting.low;case"medium":case 2:return this.currentDensitySetting.medium;case"high":case 3:return this.currentDensitySetting.high;case"all":case 0:return this.currentDensitySetting.all}W.error(`Unknown density selector:${t}`)},m.prototype.invoke=function(t,e,i){Object.prototype.hasOwnProperty.call(e,t)&&e[t].call(this,i)},m.prototype.forLoadedArticles=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];i.isDataLoaded&&t.call(this,i)}},m.prototype.forVisibleArticles=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];i.isDataLoaded&&i.isVisible&&t.call(this,i)}},m.prototype.forInRangeArticles=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];i.isDataLoaded&&(i.isInRange||i.isFading)&&t.call(this,i)}},m.prototype.enqueueImageLoad=function(t){let e=I(t.data,"imageUrl");if(!e){if(typeof t._closeImage=="function")try{t._closeImage({keepState:!1,skipRedraw:!0})}catch(l){}t.image=null,t.imageLoaded=!1,t._closeImage=null,t._loadedImageKey=null,t._pendingImageKey=null;return}const{sanitizer:i,customSanitizer:n}=this.options.image;if(typeof n=="function")try{e=n(e,i)}catch(l){e=null}else e=_a(e,i);if(!e){if(typeof t._closeImage=="function")try{t._closeImage({keepState:!1,skipRedraw:!0})}catch(l){}t.image=null,t.imageLoaded=!1,t._closeImage=null,t._loadedImageKey=null,t._pendingImageKey=null;return}const o=this._getArticleImageTargetSpec(t),s=o&&Number.isFinite(o.dpr)&&o.dpr>0?Math.round(Math.max(1,o.dpr)*1e3)/1e3:1,r=`img:${e}:${o.layout}:${o.shape}:${o.targetW||0}x${o.targetH||0}@${s}${o.allowUpscale===!1?":downscale":""}`;if(t._loadedImageKey===r&&t.imageLoaded&&t.image||t._pendingImageKey===r&&typeof t._imageCancel=="function")return;if(t._pendingImageKey&&t._pendingImageKey!==r&&typeof t._imageCancel=="function"){try{t._imageCancel()}catch(l){}t._imageCancel=null}t.imageLoaded&&t.image||(t.imageLoaded=!1),t._pendingImageKey=r;const a=this.imageLoader.enqueue(r,e,(l,c,h,u,d)=>{const f=t.getWidth();if(typeof t._closeImage=="function")try{t._closeImage({keepState:!1,skipRedraw:!0})}catch(y){}let g=null;typeof d=="function"?g=d:typeof u=="function"&&(g=function(){try{u()}catch(y){}}),t.image=l,t.imageLoaded=!0,t._loadedImageKey=r,t._pendingImageKey=null,t._imageCancel=null,t._closeImage=g,t._closeImage&&t._closeImage._key==null&&typeof d=="function"&&(t._closeImage._key=r,t._closeImage._article=t),typeof t.updateCachedSize=="function"&&t.updateCachedSize();const p=t.getWidth()!==f;this.requestRedraw(p?this.defaultRedraw:this.redraw)},{targetW:o.targetW,targetH:o.targetH,shape:o.shape,allowUpscale:o.allowUpscale,article:t});t._imageCancel=a},m.prototype._getArticleImageTargetSpec=function(t){var d;const e=t._getCurrentCardLayoutName(),i=t.getCurrentStyle(),n=i&&i.image?i.image:{},o=n.shape||"square";let s=null,r=null;if(e==="landscape"){const f=i.width==="auto"?(d=i.maxWidth)!=null?d:1/0:i.width,g=Math.max(1,uo(i,f));s=g,r=g}else if(e==="portrait"){const f=yt(n.margin),g=0,p=i.width==="auto"?t.getWidth():i.width,y=Number.isFinite(p)?Math.max(1,p-g-f.left-f.right):null;o==="square"||o==="circle"?(s=y,r=y):s=y}else i&&(s=i.width==="auto"?Math.max(1,t.getWidth()):i.width);const a=typeof this.getCanvasDpr=="function"?this.getCanvasDpr():Number(this.canvasDpr),l=Number.isFinite(a)&&a>0?a:1,c=f=>typeof f!="number"||!Number.isFinite(f)||f<=0?null:Math.max(1,Math.round(f*l)),h=c(s),u=c(r);return{layout:e,targetW:h,targetH:u,shape:o,dpr:l,allowUpscale:i.width!=="auto"}},m.prototype._getDefaultOption=function(t){if(t[0]==="article"){if(t.length===1)return ot(N({},Se.article),{layoutStyles:this._registeredArticleLayoutStyles});if(t[1]==="layoutStyles")return mn(this._registeredArticleLayoutStyles,t.slice(2))}return mn(Se,t)},m.prototype.setOption=function(t,e){if(typeof t=="string"){const f=Jn(t),g=I(this.options,f);if(typeof e=="undefined")return g;t=ct(f,e)}const i=this.top;t=Qn(t),tt(t,"article")&&(t.article===U?this._explicitArticleOptions={}:nt(this._explicitArticleOptions,t.article||{})),nt(this.options,t,f=>this._getDefaultOption(f));const n=t.width||t.height;n&&this.setSize(this.options.width,this.options.height);const o=tt(t,"canvas.dpr")||tt(t,"canvas.dprMode")||tt(t,"canvas.maxDpr");!n&&o&&(this.canvasDpr=Ai(this.canvas,this.options.width,this.options.height,this.canvasContext,this.options.canvas)),(typeof t.verticalOffset=="number"||t.verticalOffset===U)&&(this.top=this.options.height-this._getEffectiveVerticalOffset()),(tt(t,"timeBand.visible")||tt(t,"timeBand.reserveSpace")||tt(t,"timeBand.reserveSpacePixels"))&&(this.top=this.options.height-this._getEffectiveVerticalOffset()),(tt(t,"style.dateLabel.parent.visible")||tt(t,"style.dateLabel.parent.height"))&&(this.top=this.options.height-this._getEffectiveVerticalOffset());const a=Xn(I(t,"article"));if(tt(t,"timeBand.defaultStyle")&&Array.isArray(this.timeBands)&&this.timeBands.length>0){const f=this.options.timeBand&&this.options.timeBand.defaultStyle?this.options.timeBand.defaultStyle:{};for(let g=0;g<this.timeBands.length;g++){const p=this.timeBands[g],y=p&&p.data&&p.data.style?p.data.style:{};p.style=D({},f,y)}}const c=I(t,"chart.data");Array.isArray(c)&&typeof this.addCharts=="function"&&this.addCharts(c);const h=tt(t,"chart.seriesColors");if((h||tt(t,"chart.defaultData")||tt(t,"chart.defaultStyle"))&&Array.isArray(this.charts)&&this.charts.length>0){let f=!1;for(let g=0;g<this.charts.length;g++){const p=this.charts[g].laneId;h&&(this.charts[g]._seriesColors=[]),this.charts[g]._resolveFromData(),tt(t,"chart.defaultData")&&this.charts[g].laneId!=null&&this._ensureChartLane(this.charts[g].laneId),f=f||p!==this.charts[g].laneId}f&&(this._refreshLaneOrder(),this._updateLaneLayout())}let d={styleLaneIds:new Set};if(tt(t,"lane")){const f=I(t,"lane.data");Array.isArray(f)&&(d=this.addLanes(f,{suppressArticleRefresh:!0}))}if(tt(t,"lane")||a.cacheChanged){const f=a.styleChanged?"all":d.styleLaneIds.size>0?d.styleLaneIds:null;this._refreshResolvedLanesFromOptions({articleStyleScope:f})}this.top!==i&&this.options.article.autoStacking.fitToHeight&&!this._isLaneLayoutActive()&&this.fitToHeight(),this.requestRedraw()},m.prototype.setSize=function(t,e){this.canvas&&this.canvas.style&&(typeof t=="number"&&(this.canvas.style.width=`${t}px`),typeof e=="number"&&(this.canvas.style.height=`${e}px`)),this.options.width=t,this.options.height=e,this.canvasDpr=Ai(this.canvas,t,e,this.canvasContext,this.options.canvas),typeof this._syncLaneViewportSize=="function"&&this._syncLaneViewportSize(),this.width=this.canvas.clientWidth||t,this.top=e-this._getEffectiveVerticalOffset(),this.requestRedraw()},m.prototype._getEffectiveVerticalOffset=function(){var a,l;const t=this.options.verticalOffset||0,e=this.options.timeBand||{},i=Array.isArray(this.timeBands)&&this.timeBands.length>0,o=!!e.reserveSpace&&e.visible&&i&&e.reserveSpacePixels||0,s=((l=(a=this.options.style)==null?void 0:a.dateLabel)==null?void 0:l.parent)||{},r=s.visible===!0&&s.height||0;return t+o+r},m.prototype.generateDensitySettings=function(){const t=this.timescaleManager.zoomOptions.ratio,e=[],i=a=>Math.round(a*100)/100,n=i(Math.log(.5)/Math.log(t)),o=Math.ceil(Math.log2(j));for(let a=o;a>=1;a--)e.push({region:1-a,zoom:{from:a===o?Number.NEGATIVE_INFINITY:i(-a*n),to:i(-(a-1)*n)},low:1,medium:2,high:3,all:25,step:{months:0,days:0,divisionsPerDay:Math.pow(2,a)}});const s=Math.ceil(this.timescaleManager.zoomOptions.maximum/n);for(let a=0;a<s;a++){const l=i(a*n),c=i((a+1)*n),h={region:a+1,zoom:{from:l,to:c},low:1,medium:2,high:3,all:25,step:{months:0,days:Math.pow(2,a)}};e.push(h)}const r=JSON.stringify(e,(a,l)=>l===Number.NEGATIVE_INFINITY?"__DENSITY_NEGATIVE_INFINITY__":l,2).replace('"__DENSITY_NEGATIVE_INFINITY__"',"Number.NEGATIVE_INFINITY");W.log(r)};function ae(t){return t!=null&&typeof t=="object"}function Ta(t,e){return{day:t.getDaysSinceYearZero(),division:Math.floor(t.getMillisecondsOfDay()*e/j),divisionsPerDay:e}}function Ie(t,e){return!ae(t)&&!ae(e)?t===e?0:t<e?-1:1:t.day!==e.day?t.day<e.day?-1:1:t.division!==e.division?t.division<e.division?-1:1:0}function Mt(t,e){if(!ae(t))return t+e;const i=t.division+e,n=Math.floor(i/t.divisionsPerDay);return{day:t.day+n,division:i-n*t.divisionsPerDay,divisionsPerDay:t.divisionsPerDay}}function xi(t,e,i){return Ie(t,e)<0?e:Ie(t,i)>0?i:t}function Ce(t){return ae(t)?`${t.day}:${t.division}`:String(t)}function Oa(t){return{dayNumber:t.day,dayFraction:t.division/t.divisionsPerDay}}function Ra(t,e){return`${t}::${Ce(e)}`}function ka(t,e){const i=[];let n=0;for(const o of t)if(i.length<e)i.push(o),Jt(o,i[n])>0&&(n=i.length-1);else if(Jt(o,i[n])<0){i[n]=o,n=0;for(let s=1;s<i.length;s++)Jt(i[s],i[n])>0&&(n=s)}return i}function xa(t,e){if(t.length<=e)return t;if(!(e>0))return[];const i=Number.isFinite(Number(t[0].id));if(t.some(a=>Number.isFinite(Number(a.id))!==i))return ka(t,e);const n=t.slice(0,Math.ceil(e)),o=n.map((a,l)=>l);function s(a,l){const c=Jt(n[a],n[l]);return c>0||c===0&&a<l}function r(a){const l=o[a];for(;a*2+1<o.length;){let c=a*2+1;if(c+1<o.length&&s(o[c+1],o[c])&&c++,!s(o[c],l))break;o[a]=o[c],a=c}o[a]=l}for(let a=Math.floor(o.length/2)-1;a>=0;a--)r(a);for(let a=n.length;a<t.length;a++)Jt(t[a],n[o[0]])<0&&(n[o[0]]=t[a],r(0));return n}m.prototype.updateArticlesGroupIndex=function(){this.forLoadedArticles(function(t){t.groupIndex=this.calculateGroupIndex(t.period.from)})},m.prototype.updateVisibleArticlesOfGroups=function(t){this.groups={};const e=to(this.options.article.autoStacking.range)?1:20,i=Mt(this.calculateGroupIndex(t.tokens.start),-e),n=Mt(this.calculateGroupIndex(t.tokens.end),e),o=this._isLaneLayoutActive(),s=o?this._getActiveLanesForLayout().map(a=>a.id):[void 0],r=new Map(s.map(a=>[a,new Map]));this.forLoadedArticles(function(a){if(a.isVisibleInGroup=!1,a.isHiddenByFilter)return;const l=r.get(o?a.laneId:void 0);if(!l)return;const c=Ce(xi(a.groupIndex,i,n)),h=l.get(c);h?h.push(a):l.set(c,[a])});for(const a of s){const l=r.get(a);for(let c=i;Ie(c,n)<=0;c=Mt(c,1)){const h=o?Ra(a,c):Ce(c);this.groups[h]=this.getArticlesInGroup(c,i,n,a,l.get(Ce(c))||[]).map(function(u){return u.isVisibleInGroup=!0,u.id})}}},m.prototype.getArticlesInGroup=function(t,e,i,n,o=this.articles){const s=typeof n!="undefined"?this.getLaneById(n):null,r=s&&s.resolvedArticleOptions?s.resolvedArticleOptions.density:this.options.article.density,a=this.getDensityPick(r),l=[];for(let c=0;c<o.length;c++){const h=o[c];!h.isDataLoaded||h.isHiddenByFilter||typeof n!="undefined"&&h.laneId!==n||!(Ie(xi(h.groupIndex,e,i),t)===0)||l.push(h)}return xa(l,a)},m.prototype.calculateGroupIndex=function(t){if(this.currentDensitySetting.step.divisionsPerDay)return Ta(t,this.currentDensitySetting.step.divisionsPerDay);if(this.timescaleManager.unit>=$&&this.currentDensitySetting.step.months!==0){const i=t.year*12+(t.month-1);return Math.floor(i/this.currentDensitySetting.step.months)}const e=t.year*372+(t.month-1)*31+t.day;return this.currentDensitySetting.step.days===0?Math.floor(e/(this.currentDensitySetting.step.months*30)):Math.floor(e/this.currentDensitySetting.step.days)},m.prototype.canBeVisibleInGroup=function(t,e,i){if(t.isActive)return!0;e=e||this.timescaleManager.startToken,i=i||this.calculateEndToken();const n=Mt(this.calculateGroupIndex(e.value),-1),o=Mt(this.calculateGroupIndex(i.value),1),s=xi(t.groupIndex,n,o),r=Ce(s);return Object.prototype.hasOwnProperty.call(this.groups,r)?this.groups[r].indexOf(t.id)>=0:!1};const Na=64;function bo({velocity:t,friction:e,minVelocity:i,maxDuration:n,maxFrameDelta:o=Na,shouldStop:s,onUpdate:r,onComplete:a}={}){let l=t;const c=performance.now();let h=c,u=!1;if(!Number.isFinite(l)||!Number.isFinite(e)||e<=0||!Number.isFinite(i)||i<0||!Number.isFinite(n)||n<=0)return{stop(){}};function d(){u=!0}function f(){u||(u=!0,a==null||a())}function g(p){if(u)return;if(s!=null&&s()){d();return}if(p-c>=n||Math.abs(l)<i){f();return}const y=Math.min(Math.max(p-h,0),o);if(h=p,y>0){const v=Math.exp(-e*y),w=l*(1-v)/e;l*=v,w!==0&&(r==null||r(w,l))}requestAnimationFrame(g)}return requestAnimationFrame(g),{stop:d}}function Ht(t={},e=t.complete){return typeof t.onComplete=="function"?t.onComplete:e}function le(t){const e=t._navigationRequest;e&&(e.cancelled=!0,e.frame!=null&&cancelAnimationFrame(e.frame),t._navigationRequest=null)}function he(t,e){le(t);const i={callback:e,cancelled:!1,frame:null};return t._navigationRequest=i,i}function lt(t,e){e.cancelled||e.frame!=null||(e.frame=requestAnimationFrame(()=>{var i,n;if(!(e.cancelled||t._navigationRequest!==e)){if((i=t.redrawRequests)!=null&&i.default||(n=t.redrawRequests)!=null&&n.reposition){const o=t.getAnimationRedrawFunction();t.updateRedrawRequests(o),o.call(t)}e.cancelled||t._navigationRequest!==e||(t._navigationRequest=null,e.cancelled=!0,typeof e.callback=="function"&&e.callback.call(t))}}))}function vo(t){var n;const e=t.timescaleManager,i=(n=e.startToken)==null?void 0:n.value;return i?[e.zoom,i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond,t.repositionWindow].join(":"):null}function Pe(t,e){const i=vo(t),n=Object.prototype.hasOwnProperty.call(t,"requestRedraw"),o=t.requestRedraw;let s=!1;t.requestRedraw=()=>{s=!0};try{e()}finally{n?t.requestRedraw=o:delete t.requestRedraw}s&&(i===null||i!==vo(t))&&o.call(t)}function Qe(t,e,i){const n=i.stop;return i.stop=()=>{var o,s;n(),e.cancelled=!0,((o=t.animation)==null?void 0:o.pan)===i&&(t.animation.pan=null,t.isPanning=!1),((s=t.animation)==null?void 0:s.zoom)===i&&(t.animation.zoom=null),t._navigationRequest===e&&le(t)},i}function So(t=0){var e,i;return typeof t=="number"?{left:t,right:t}:{left:(e=t==null?void 0:t.left)!=null?e:0,right:(i=t==null?void 0:t.right)!=null?i:0}}function ti(t){var i,n,o,s,r,a,l;const e=typeof t=="string"?(i=ui(t))==null?void 0:i.date:t;if(!e||!Number.isFinite(e.year))throw new Error("Date input requires a numeric year or canonical Histropedia date string");return new b({precision:we(e),year:e.year,month:(n=e.month)!=null?n:1,day:(o=e.day)!=null?o:1,hour:(s=e.hour)!=null?s:0,minute:(r=e.minute)!=null?r:0,second:(a=e.second)!=null?a:0,millisecond:(l=e.millisecond)!=null?l:0})}function Ni(t){const e=Math.floor(t.millisecond/j);return{dayNumber:t.dayNumber+e,millisecond:t.millisecond-e*j}}function ce(t){return{dayNumber:t.getDaysSinceYearZero(),millisecond:t.getMillisecondsOfDay()}}function ht(t,e){return t.dayNumber!==e.dayNumber?t.dayNumber<e.dayNumber?-1:1:t.millisecond!==e.millisecond?t.millisecond<e.millisecond?-1:1:0}function dt(t,e){const i=e.dayNumber-t.dayNumber,n=e.millisecond-t.millisecond;return i+n/j}function wt(t,e){const i=Math.floor(e);return Ni({dayNumber:t.dayNumber+i,millisecond:t.millisecond+(e-i)*j})}function _o(t,e,i){if(i<=0)return N({},t);if(i>=1)return N({},e);const n=(e.dayNumber-t.dayNumber)*i,o=Math.floor(n),s=t.millisecond+(n-o)*j+(e.millisecond-t.millisecond)*i;return Ni({dayNumber:t.dayNumber+o,millisecond:s})}function De(t){return new b(t===-1?1:t+1,1,1)}function Ea(t,e){return e===12?De(t):new b(t,e+1,1)}function Lo(t){const e=ti(t),i=typeof t=="string"?ui(t):null,n=i?i.hasMonth:t.month!=null,o=i?i.hasDay:t.day!=null,s=i?i.hasTime:t.hour!=null||t.minute!=null||t.second!=null||t.millisecond!=null;return!n&&!s?{start:e,end:De(e.year)}:!o&&!s?{start:e,end:Ea(e.year,e.month)}:{start:e,end:ti(t)}}function Ei(t,e){return Math.max(1,t.getWidth()-e.left-e.right)}function za(t,e){var s,r;const i=(s=t.zoomOptions)==null?void 0:s.minimum,n=(r=t.zoomOptions)==null?void 0:r.maximum;let o=e;return Number.isFinite(i)&&o<i&&(o=i),Number.isFinite(n)&&o>n&&(o=n),o}function Te(t,e){return Number.isFinite(e)?parseFloat(za(t,e).toFixed(4)):e}function Mo(t,e){if(typeof t.getUnitFromZoom=="function")return t.getUnitFromZoom(e);const i=t.unitLevels;if(!Array.isArray(i)||i.length===0)return t.unit;const n=t.unitOrder||i.map((o,s)=>s);for(let o=n.length-1;o>=0;o--){const s=n[o];if(e>=i[s].zoomStart)return s}return t.unit}function Ao(t,e,i){var r,a,l,c;const n=(r=t.unitLevels)==null?void 0:r[e],o=(a=t.zoomOptions)==null?void 0:a.ratio;if(n&&Number.isFinite(n.startUnitSize)&&Number.isFinite((l=n.referenceZoom)!=null?l:n.zoomStart)&&Number.isFinite(o)&&o>0)return n.startUnitSize*Math.pow(o,i-((c=n.referenceZoom)!=null?c:n.zoomStart));if(!Number.isFinite(t.unitSizeInPixels))return NaN;const s=i-t.zoom;return t.scaleDistanceByZoomChange?t.scaleDistanceByZoomChange(t.unitSizeInPixels,s):NaN}function Io(t){return t>=it?Math.pow(10,t-it):0}function Fa(t,e,i,n){const o=Te(t,n),s=Mo(t,o),r=Ao(t,s,o);return!Number.isFinite(r)||r<=0?NaN:s<=V?e.getDaysTo(i)*r/$e(s):s===$?e.getMonthsTo(i)*r:e.getYearsTo(i)*r/Io(s)}function Co(t,e,i,n){const o=Te(t,n),s=Mo(t,o),r=Ao(t,s,o);if(!Number.isFinite(r)||r<=0)return NaN;const a=dt(e,i);return s<=V?a*r/$e(s):s===$?a*r/30.44:a*r/(365.2422*Io(s))}function Ba(t,e,i,n){const o=t.timescaleManager,s=o.getPixelsBetween(e,i);if(!Number.isFinite(s)||s<=0)return o.zoom;const r=Ei(t,n),a=o.getZoomChangeByDistance(s,r);if(!Number.isFinite(a))return o.zoom;let l=o.zoom+a;for(let c=0;c<4;c++){const h=Fa(o,e,i,l);if(!Number.isFinite(h)||h<=0)break;const u=o.getZoomChangeByDistance(h,r);if(!Number.isFinite(u)||(l+=u,Math.abs(u)<5e-5))break}return Te(o,l)}function Po(t,e){return e==null?null:t.getDmyFromInput(ti(e))}function Wt(t){var o;const e=(o=t.options)==null?void 0:o.bounds;if(!e)return null;let i=Po(t,e.minDate),n=Po(t,e.maxDate);return!i&&!n?null:(i&&n&&i.compare(n)>0&&([i,n]=[n,i]),{minDate:i,maxDate:n,minPoint:i?ce(i):null,maxPoint:n?ce(n):null,minDay:i?Zt(i):null,maxDay:n?Zt(n):null,overflow:e.overflow==="clamp"?"clamp":"elastic"})}function Do(t){const e=Vt(t,0),i=Vt(t,t.getWidth());return ht(e,i)<=0?{start:e,end:i}:{start:i,end:e}}function Ha(t,e,i){const n=t.minPoint?dt(e.start,t.minPoint):0,o=t.maxPoint?dt(t.maxPoint,e.end):0;return n>0&&n>=o?{type:"min",dayPoint:t.minPoint,dayNumber:t.minDay,pixelOffset:0,overflowDays:n}:o>0?{type:"max",dayPoint:t.maxPoint,dayNumber:t.maxDay,pixelOffset:i,overflowDays:o}:null}function At(t,e=Wt(t),i={}){if(!e)return null;const n=Do(t),o=t.getWidth(),s=Ha(e,n,o);return i.mode==="elastic"&&e.overflow==="elastic"&&s?s:e.minPoint&&e.maxPoint&&dt(n.start,n.end)>dt(e.minPoint,e.maxPoint)?{type:"range",zoom:Hi(t,e.minPoint,e.maxPoint,{left:0,right:0},t.timescaleManager.zoom),dayPoint:e.minPoint,dayNumber:e.minDay,pixelOffset:0}:s}function zi(t,e){const i=ft(t);if(!i||!Number.isFinite(e)||e<=0)return 0;const n=Math.max(1,t.getWidth()),o=Math.max(32,n*.22),s=e*i;return o*s/(o+s)/i}function To(t,e){const i=ft(t);if(!i||!Number.isFinite(e)||e<=0)return 0;const n=Math.max(1,t.getWidth()),o=Math.max(32,n*.22),s=e*i;return s>=o?Number.MAX_SAFE_INTEGER/i:o*s/(o-s)/i}function Wa(t,e,i){const n=Wt(t);let o=e;if((n==null?void 0:n.overflow)==="elastic"&&Number.isFinite(i)){const s=wt(e,i);if(n.minPoint&&ht(e,n.minPoint)<0){const r=dt(e,n.minPoint);o=wt(n.minPoint,-zi(t,r))}else if(n.maxPoint&&ht(s,n.maxPoint)>0){const r=dt(n.maxPoint,s);o=wt(n.maxPoint,zi(t,r)-i)}}Yt(t,o,0,!1,{skipDateBounds:!0})}function It(t,e={}){const i=Wt(t);if(!i)return!1;const n=e.mode||"clamp",o=At(t,i,{mode:n});if(!o)return!1;if(o.type==="range")return o.zoom!==t.timescaleManager.zoom&&t.timescaleManager.setZoom(o.zoom),Yt(t,o.dayPoint,o.pixelOffset,!1,{skipDateBounds:!0}),!0;if(n==="elastic"&&i.overflow==="elastic"){const s=zi(t,o.overflowDays);return o.type==="min"?Yt(t,wt(o.dayPoint,-s),0,!1,{skipDateBounds:!0}):Yt(t,wt(o.dayPoint,s),o.pixelOffset,!1,{skipDateBounds:!0}),!0}return Yt(t,o.dayPoint,o.pixelOffset,!1,{skipDateBounds:!0}),!0}function Ya(t){return!!At(t)}function ft(t){var o;const e=t.timescaleManager,i=e.unitSizeInPixels;if(!Number.isFinite(i)||i<=0)return 0;if(e.unit==null||e.unit<=V)return i/$e((o=e.unit)!=null?o:V);if(e.unit===$)return i/30.44;const n=Number.isFinite(e.unitLengthInYears)&&e.unitLengthInYears>0?e.unitLengthInYears:1;return i/(365.2422*n)}function Yt(t,e,i,n=!1,o={}){var u;const s=Ni(e),r=Math.floor(s.millisecond),a=s.millisecond-r,l=Bi(s.dayNumber).addMilliseconds(r),c=a*ft(t)/j,h=t.timescaleManager.setStartDate(l);t.repositionWindow=h-c,i&&t.updateFromByPixels(-i,{skipDateBounds:!0}),o.skipDateBounds||It(t,{mode:o.boundsMode||"clamp"}),t.requestRedraw(),(u=t._markTimelineStateChanged)==null||u.call(t),n&&t._emitTimelineStateChange()}function Fi(t,e,i,n=!1,o={}){Yt(t,ce(e),i,n,o)}function Va(t,e){const i=ft(t),n=ce(e.date);return i?wt(n,e.fraction/i):n}function Vt(t,e){return Va(t,t.getPivotPoint(e))}function Zt(t){return t.getDaysSinceYearZero()+t.getMillisecondsOfDay()/j}function Bi(t){const e=Math.floor(t);let i=Math.floor(e/365.2422),n=Zt(new b(i,1,1)),o=Zt(De(i));for(;n>e;)i-=1,n=Zt(new b(i,1,1)),o=Zt(De(i));for(;o<=e;)i=i===-1?1:i+1,n=o,o=Zt(De(i));return b.getByDayOfYear(i,e-n+1)}function Za(t,e,i){return t+(e-t)*i}function Hi(t,e,i,n,o){if(ht(i,e)<=0)return o;const s=t.timescaleManager,r=dt(e,i)*ft(t);if(!Number.isFinite(r)||r<=0)return o;const a=Ei(t,n),l=s.getZoomChangeByDistance(r,a);if(!Number.isFinite(l))return o;let c=s.zoom+l;for(let h=0;h<4;h++){const u=Co(s,e,i,c);if(!Number.isFinite(u)||u<=0)break;const d=s.getZoomChangeByDistance(u,a);if(!Number.isFinite(d)||(c+=d,Math.abs(d)<5e-5))break}return Te(s,c)}function Oo(t,e){if(e===0)return!At(t);if(t.isDragging||t.isPinching)return!1;const i=Wt(t);if(!i)return!1;const n=At(t,i);return(n==null?void 0:n.type)==="range"&&n.zoom!==t.timescaleManager.zoom?!1:e<0&&i.minPoint?ht(Vt(t,0),i.minPoint)===0:e>0&&i.maxPoint?ht(Vt(t,t.getWidth()),i.maxPoint)===0:!1}function Ua(t,e,i,n){const o=t.timescaleManager;if(i===o.zoom&&o.startToken){const a=t.repositionWindow-o.getPixelsBetween(e,o.startToken.value)-n.left;if(Oo(t,a))return!0}const s=Wt(t);return!(s!=null&&s.minPoint)||!s.maxPoint||Co(o,s.minPoint,s.maxPoint,i)>=t.getWidth()?!1:Hi(t,s.minPoint,s.maxPoint,{left:0,right:0},o.zoom)===o.zoom&&ht(Vt(t,0),s.minPoint)===0}function ei(t){var e,i,n,o,s;le(t),typeof t.stopPanAnimation=="function"?t.stopPanAnimation():(t.isPanning&&((i=(e=t.animation)==null?void 0:e.pan)!=null&&i.stop)&&t.animation.pan.stop(),t.isPanning=!1),typeof t.stopZoomAnimation=="function"?t.stopZoomAnimation():((o=(n=t.animation)==null?void 0:n.zoom)!=null&&o.stop&&t.animation.zoom.stop(),((s=t.animation)==null?void 0:s.wheelZoomFrame)!=null&&cancelAnimationFrame(t.animation.wheelZoomFrame),t.animation&&(t.animation.zoom=null,t.animation.wheelZoomTarget=null,t.animation.wheelZoomPivotPoint=null,t.animation.wheelZoomPivotPixel=null,t.animation.wheelZoomLastFrameTime=null,t.animation.wheelZoomFrame=null))}function Ga(t,e,i,n,o,s={}){var p;ei(t);const r=he(t,Ht(s));if(Ua(t,e,n,o)){lt(t,r);return}if(s.duration===0){Pe(t,()=>{n!==t.timescaleManager.zoom&&t.timescaleManager.setZoom(n),Fi(t,e,o.left,!0)}),lt(t,r);return}t.switchToPositiveRepositionWindow();const a=t.timescaleManager.zoom,l=Ei(t,o),c=Vt(t,o.left),h=Vt(t,o.left+l),u=ce(e),d=ce(i);if(a===n&&ht(c,u)===0&&!At(t)){lt(t,r);return}t.isPanning=!0,t.startAnimation();const f=ht(h,c)>0&&ht(d,u)>0,g=Z({from:0,to:1,duration:(p=s.duration)!=null?p:2e3,easing:H[s.easing]||H.swing,onUpdate(y){if(t.isPinching){t.isPanning=!1,g.stop(),le(t);return}const v=_o(c,u,y);let w=a;y>0&&(w=f?Hi(t,v,_o(h,d,y),o,t.timescaleManager.zoom):Za(a,n,y)),w!==t.timescaleManager.zoom&&t.timescaleManager.setZoom(w),Yt(t,v,o.left)},onComplete(){n!==t.timescaleManager.zoom&&t.timescaleManager.setZoom(n),Fi(t,e,o.left,!0),t.isPanning=!1,t.animation.pan=null,lt(t,r)}});t.animation.pan=Qe(t,r,g)}function ja(t,e){var a,l,c,h;const i=t.articles||[];let n=null,o=null,s=0,r=0;for(let u=0;u<i.length;u++){const d=i[u];if(!e(d)||!((a=d.period)!=null&&a.from))continue;const f=d.period.from;(!n||f.compare(n)<0)&&(n=f),(!o||f.compare(o)>0)&&(o=f);const g=d.getCurrentStyle(),p=(c=(l=g.connectorLine)==null?void 0:l.offsetX)!=null?c:0,y=g.width==="auto"?d.getWidth():(h=g.width)!=null?h:0;s=Math.max(s,p),r=Math.max(r,y-p)}return n?{earliest:n,latest:o,maxCardLeftOffset:s,maxCardRightOffset:r}:null}m.prototype._drawBranding=function(t){this._drawCopyrightLinks(t)};const ii=117,Wi=22,Ro=0,ko=0,ni=8,Yi=0,ue=12,Xa="HistropediaJS",xo=75,qa="Terms",$a=33,Ka=10,Ja=`${Xa} | ${qa}`;m.prototype._drawCopyrightLinks=function(t){t.beginPath(),t.fillStyle="rgba(255, 255, 255, 0.8)",t.fillRect(this.width-ii-Ro-ni*2,this.top-Math.floor(this.options.style.mainLine.size/2)-Wi-ko-Yi*2,ii+ni*2,Wi+Yi*2),t.textAlign="left",t.textBaseline="middle",t.fillStyle="#000000",t.font=`normal ${ue}px "Helvetica Neue", Helvetica, Arial, sans-serif`;const e=this._getBrandingTextCoords();t.fillText(Ja,e.left,e.top,ii+ni)},m.prototype._getBrandingTextCoords=function(){return{left:this.width-ii-Ro-ni,top:this.top-Math.floor(this.options.style.mainLine.size/2)-Wi-ko+ue-Yi}},m.prototype._isInsideHistropediaJSLink=function(t){const e=this._getBrandingTextCoords();return No(t,{left:e.left,top:e.top-ue/2,width:xo,height:ue})},m.prototype._isInsideTermsLink=function(t){const e=this._getBrandingTextCoords();return No(t,{left:e.left+xo+Ka,top:e.top-ue/2,width:$a,height:ue})};function Qa(){const t=window.open("https://js.histropedia.com","_blank","noopener,noreferrer");t&&(t.opener=null)}function tl(){const t=window.open("https://js.histropedia.com/licence.html","_blank","noopener,noreferrer");t&&(t.opener=null)}function No(t,e){return t.left>=e.left&&t.left<=e.left+e.width&&t.top>=e.top&&t.top<=e.top+e.height}const Vi=({startToken:t,offsetX:e=0,dx:i=0,totalDx:n=0}={})=>({startToken:t,offsetX:e,dx:i,totalDx:n}),Zi=({centre:t=null,scale:e=0,zoom:i=0,distance:n=0,zoomDelta:o=0,dx:s=0,totalZoomDelta:r=0,pointers:a=[]}={})=>({centre:t,scale:e,zoom:i,distance:n,zoomDelta:o,dx:s,totalZoomDelta:r,pointers:a}),el=({centre:t=null,zoom:e=0,zoomDelta:i=0}={})=>({centre:t,zoom:e,zoomDelta:i}),il=({viewport:t}={})=>{var n,o;if(!t)return{viewport:{x:0,y:0}};const{x:e=(n=t.left)!=null?n:0,y:i=(o=t.top)!=null?o:0}=t;return{viewport:{x:e,y:i}}},nl=100;function Ut(t,e){return Number.isFinite(t)&&t>0?t:e}function oi(t){return Number.isFinite(t==null?void 0:t.timeStamp)?t.timeStamp:performance.now()}function Ct(t){var e;clearTimeout(t._pinchRegrabTimer),t._pinchRegrabTimer=null,(e=t.animation.pinchZoom)==null||e.stop(),t.animation.pinchZoom=null}function Eo(t,e,i,n){const o=t.pinchMomentum;if(!o)return;const s=i!=null?i:performance.now(),r=Math.max(Ut(t.options.pan.momentum.sampleWindow,se.pan.momentum.sampleWindow),Ut(t.options.zoom.pinchMomentum.sampleWindow,se.zoom.pinchMomentum.sampleWindow));for(;o.samples.length>1&&o.samples[1].time<s-r;)o.samples.shift();o.centre=N({},e);const a={time:s,x:e.x,zoom:n!=null?n:t.timescaleManager.zoom},l=o.samples[o.samples.length-1];(l==null?void 0:l.time)===s||o.samples.length>1&&s-l.time>=0&&s-l.time<4?o.samples[o.samples.length-1]=a:(!l||s>l.time)&&o.samples.push(a)}function ol(t,e,i,n){const o=t[t.length-1];if(!o||t.length<2)return 0;const s=Math.max(0,n-o.time);if(s>=i)return 0;const r=Math.min(32,i/2),a=Math.min(1,(i-s)/(i-r)),l=o.time-i;let c=0;for(;c<t.length-2&&t[c+1].time<=l;)c++;let h=0;for(let v=t.length-1;v>c;v--){const w=Math.sign(t[v][e]-t[v-1][e]);if(w){if(h&&w!==h){c=v;break}h=w}}const u=t[c],d=t[c+1],f=Math.max(u.time,l),g=(f-u.time)/(d.time-u.time),p=u[e]+(d[e]-u[e])*g,y=o.time-f;return y>0?(o[e]-p)/y*a:0}function sl(t,e=performance.now()){var d;const i=t.pinchMomentum;t.pinchMomentum=null,Ct(t);const n=(d=i.releaseTime)!=null?d:e,o=(f,g,p)=>{const y=Ut(g.sampleWindow,p.sampleWindow);return e-n>=nl?0:ol(i.samples,f,y,n)},s=-o("x",t.options.pan.momentum,se.pan.momentum);t.startDragMomentum(f=>{i.centre.x-=f},s);const r=t.options.zoom.pinchMomentum;if(r.active!==!0)return;const a=se.zoom.pinchMomentum,l=o("zoom",r,a);if(Math.abs(l)<Ut(r.minVelocity,a.minVelocity))return;const c=t.getPivotPoint(i.centre.x),h=()=>{u.stop(),t.animation.pinchZoom===u&&(t.animation.pinchZoom=null),t.requestRedraw()},u=bo({velocity:l,friction:Ut(r.friction,a.friction),minVelocity:Ut(r.stopVelocity,a.stopVelocity),maxDuration:Ut(r.maxDuration,a.maxDuration),onUpdate(f){const g=t.timescaleManager.zoom+f;t.setZoomByPivotPoint(g,c,i.centre.x),It(t,{mode:"clamp"}),t.requestRedraw(),Math.abs(t.timescaleManager.zoom-g)>1e-4&&h()},onComplete:h});t.animation.pinchZoom=u,t.startAnimation()}const Ui=100,rl=.01,al=.005,ll=.004,hl=1200,cl=8,ul=16,dl=40,fl=80;function Gt(t,e){return Number.isFinite(t)&&t>0?t:e}function zo(t,e){t.isDragging=!0,t.trigger("viewport-drag-start",Vi({startToken:t.timescaleManager.startToken,offsetX:t.repositionWindow}),e)}function ml(t,e){var o,s;const i=Gt((s=(o=t.options.pan)==null?void 0:o.momentum)==null?void 0:s.sampleWindow,Ui),n=e.movementTimes.filter(r=>r>=Date.now()-i);return e.status==="confirmed"&&n.length>=2&&n[n.length-1]-n[0]>=dl}function Fo(t,e){e!=="pinch"&&(t.pinchMomentum=null),e!=="drag"&&(t.dragMomentumSamples=[]),t.settleDateBounds()?(t.pinchMomentum=null,t.dragMomentumSamples=[]):e==="pinch"?t.pinchMomentum&&sl(t,t.pinchMomentum.endTime):e==="drag"&&t.startDragMomentum(),!t.isPanning&&!t.animation.pinchZoom&&t._flushTimelineStateChange()}function gl(t,e){if(!(t!=null&&t.canvas))return!1;const i=t.canvas.ownerDocument;if(!i||typeof i.elementFromPoint!="function")return!0;const{x:n,y:o}=Lt(e),s=i.elementFromPoint(n,o);if(!s)return!1;const r=t._laneViewportElement||t.canvas;return r===s||r.contains(s)}m.prototype.enableDragging=function(){const e=this;e._pinchPanHandoff=null;let i=!1;const n={relativePos:null,isDoubleClick:!1,isArticleClick:!1,isArticleDoubleClick:!1,isTermsClick:!1,isHjsClick:!1,article:null,lastClick:{time:0,targetType:null,articleId:null,relativePos:null}},o={initial:{distance:0,zoom:0},baseZoom:0,centre:{},scale:1,prevActualZoom:0,gestureZoom:0},s=2,r=5,a=500;function l(w,S,_=s){return Math.abs(w.left-S.left)<=_&&Math.abs(w.top-S.top)<=_}function c(w){const S=Aa(e.canvas);return{x:w.x-S.left,y:w.y-S.top}}function h(){n.relativePos=null,n.isDoubleClick=!1,n.isArticleClick=!1,n.isArticleDoubleClick=!1,n.isTermsClick=!1,n.isHjsClick=!1,n.article=null}function u(){n.lastClick.time=0,n.lastClick.targetType=null,n.lastClick.articleId=null,n.lastClick.relativePos=null}function d(){return n.isHjsClick?"branding-hjs":n.isTermsClick?"branding-terms":n.isArticleClick&&n.article?"article":"timeline"}function f(w,S){const{lastClick:_}=n,L=d();return!_.time||w-_.time>=a||_.targetType!==L?!1:L==="article"?!!n.article&&_.articleId===n.article.id:L==="timeline"?!!_.relativePos&&l(_.relativePos,S,r):!1}function g(w){n.lastClick.time=Date.now(),n.lastClick.targetType=d(),n.lastClick.articleId=n.article?n.article.id:null,n.lastClick.relativePos=w?N({},w):null}function p(w,S){if(S.list.length===1&&(i=!1),i)return;if(e._pinchPanHandoff=null,Ia(),e.isPinching||(e.stopPanAnimation(),(w.pointerType==="touch"||!!w.touches)&&e.animation.pinchZoom?e._pinchRegrabTimer==null&&(e._pinchRegrabTimer=setTimeout(()=>{Ct(e),e.isDragging&&!e.isPinching&&e.resetDragTracking({x:e.dragStartX,y:e.dragStartY})},fl)):e.stopZoomAnimation()),S.list.length>=2){h(),u(),e.isPinching||(o.centre=c(yo(S)),o.initial.distance=wo(S),o.initial.zoom=e.timescaleManager.zoom,o.baseZoom=o.initial.zoom,o.scale=1,o.gestureZoom=0,e.pinchMomentum={samples:[],centre:o.centre},Eo(e,o.centre,oi(w),0),e.isPinching=!0,o.prevActualZoom=o.initial.zoom,e.startAnimation(),e.trigger("zoom-pinch-start",Zi({centre:o.centre,scale:1,distance:o.initial.distance,zoom:o.initial.zoom,zoomDelta:0,totalZoomDelta:0,pointers:[...S.list]}),w));return}h();const _=n.relativePos=e.getRelativePosition(w);e.options.disableBranding||(n.isHjsClick=e._isInsideHistropediaJSLink(_),n.isTermsClick=e._isInsideTermsLink(_));let L=!1;if(!(n.isHjsClick||n.isTermsClick))for(let T=e.articles.length-1;T>=0;T--){const C=e.articles[T];if(C.isVisible&&C.isInside(_)){n.isArticleClick=!0,n.article=C,C.isActive&&e.options.article.draggable&&(L=!0);break}}const P=Date.now();if(n.isDoubleClick=f(P,_),n.isArticleDoubleClick=n.isArticleClick&&n.isDoubleClick,L){e.stopZoomAnimation(),e.draggingArticle=n.article,n.article.startDragging(_,w);return}e.draggingArticle===null&&e.isInVicinity(w,e.options.draggingVicinity,_)&&e.startDragging(w,{preservePinchCoast:!!e.animation.pinchZoom})}function y(w,S){if(!i){if(e.isPinching){const _=e.timescaleManager.zoomOptions.ratio,L=o.centre.x,P=wo(S);if(P<=0)return;const T=c(yo(S));if(e.animation.pinchZoom&&P===o.initial.distance*o.scale&&T.x===o.centre.x&&T.y===o.centre.y)return;const C=e.timescaleManager.zoom-o.prevActualZoom;o.baseZoom+=C,o.prevActualZoom=e.timescaleManager.zoom,Ct(e),o.centre=T,o.initial.distance<=0&&(o.initial.distance=P,o.baseZoom=e.timescaleManager.zoom),o.scale=P/o.initial.distance;const A=Math.log(o.scale)/Math.log(_),k=o.baseZoom+A,O=L-o.centre.x;e.setZoomByPivotPixel(k,L,O);const x=e.timescaleManager.zoom,F=x-o.initial.zoom,Y=x-o.prevActualZoom;o.gestureZoom+=Y,Eo(e,o.centre,oi(w),o.gestureZoom),o.prevActualZoom=x,e.trigger("zoom-pinch",Zi({centre:o.centre,scale:o.scale,distance:P,zoom:x,pointers:[...S.list],dx:O,zoomDelta:Y,totalZoomDelta:F}),w)}else if(e._pinchPanHandoff){const _=e._pinchPanHandoff,L=S.list.find(P=>P.id===_.pointerId);if(!L||!_.canPan)return;if(_.status==="pending"){const P=L.x-_.originX,T=L.x!==_.lastX,C=_.hasMovement&&T?cl:ul;if(_.hasMovement||(_.hasMovement=T),Math.abs(P)<=C){e.trackDragMomentumSample(L.x,!0);return}_.status="confirmed",e.pinchMomentum=null;const A=_.originX+Math.sign(P)*C;e.dragStartX=A,e.dragOrigin.left=A,e.isDragging||zo(e,w)}e.doDrag(w,L)}else if(e.isDragging){if(e._pinchRegrabTimer!=null){const _=Lt(w);if(Math.abs(_.x-e.dragStartX)<=s)return;Ct(e),e.resetDragTracking({x:e.dragStartX,y:e.dragStartY})}e.doDrag(w)}else if(e.draggingArticle!==null){const _=e.getRelativePosition(w);e.draggingArticle.dragging(_,w)}else w.pointerType==="mouse"&&(e.updateMouseoverArticle(w),e.mouseoverArticle!==null&&e.trigger("article-pointermove",e.mouseoverArticle,w));e.options.enableCursor&&e.updateCursor(w)}}function v(w,S){(w.type==="pointercancel"||w.type==="touchcancel")&&(Ct(e),i=!0,e._pinchPanHandoff=null,e.pinchMomentum=null,e.dragMomentumSamples=[]);let L=i?"none":void 0;if(e.isPinching&&S.list.length<2){Ct(e);const O=S.list.length===1?Da(S):null,x=o.scale,F=e.timescaleManager.zoom,Y=F-o.initial.zoom,G=o.initial.distance*x;if(e.pinchMomentum&&(e.pinchMomentum.releaseTime=oi(w)),e.isPinching=!1,h(),e.trigger("zoom-pinch-end",Zi({centre:o.centre,scale:x,distance:G,zoom:F,zoomDelta:0,dx:0,totalZoomDelta:Y,pointers:[...S.list]}),w),O){if(!i){e.resetDragTracking(O);const Q=c(O);e._pinchPanHandoff={status:"pending",pointerId:O.id,originX:O.x,lastX:O.x,lastMovementTime:Date.now(),movementTimes:[],hasMovement:!1,canPan:e.draggingArticle===null&&(e.isDragging||e.isInVicinity(w,e.options.draggingVicinity,{left:Q.x,top:Q.y}))}}return}L=i?"none":"pinch",e.isDragging&&e.resetDragTracking(Lt(w))}if(S.list.length>0)return;Ct(e),e.pinchMomentum&&(e.pinchMomentum.endTime=oi(w));const P=e._pinchPanHandoff;P&&!i&&(L=P.status==="pending"?"pinch":ml(e,P)?"drag":"none");const T=P||i?{x:e.dragStartX,y:e.dragStartY}:Lt(w);e._pinchPanHandoff=null;const C=e.getRelativePosition(w);let A=!1;if(!i&&n.relativePos&&l(n.relativePos,C)){if(n.isHjsClick)Qa();else if(n.isTermsClick)tl();else if(n.isArticleClick)e.select(n.article.id),n.article.clicked(n.relativePos),e.options.enableCursor&&(e.canvas.style.cursor=n.article.getCursor(C)),e.trigger("article-click",n.article,w),n.isArticleDoubleClick&&e.trigger("article-dblclick",n.article,w);else{const{left:O=0,top:x=0}=n.relativePos||{},F=il({viewport:{x:O,y:x}});e.trigger("timeline-click",F,w),n.isDoubleClick&&e.trigger("timeline-dblclick",F,w)}A=!0}A?g(n.relativePos):n.relativePos&&u(),h();const k=e.draggingArticle;k!==null?(k.stopDragging(w),e.draggingArticle=null,e.pinchMomentum=null,e.dragMomentumSamples=[],e._flushTimelineStateChange()):e.isDragging?e.endDragging(w,{momentum:L,point:T}):S.list.length===0&&Fo(e,L||"none"),i=!1,e.redraw()}this._dragPointerTracker=new Pa(this.canvas,{onStart:p,onMove:y,onEnd:v,onDestroy(){i=!0,e._pinchPanHandoff=null,e.pinchMomentum=null,e.dragMomentumSamples=[],e.dragDateBoundsState=null,e.isDragging=!1,e.isPinching=!1,e.stopPanAnimation(),e.stopZoomAnimation(),h(),u()}})},m.prototype.startDragging=function(e,{preservePinchCoast:i=!1}={}){var o,s;(o=this.stopPanAnimation)==null||o.call(this),i||(s=this.stopZoomAnimation)==null||s.call(this),this._pinchPanHandoff=null;const n=Lt(e);m.prototype.resetDragTracking.call(this,n),zo(this,e)},m.prototype.resetDragTracking=function(e){this.dragOrigin={left:e.x,top:e.y},this.dragStartX=e.x,this.dragStartY=e.y,this.dragMomentumSamples=[{time:Date.now(),x:e.x}],this.dragDateBoundsState=null;const i=Wt(this);if((i==null?void 0:i.overflow)==="elastic"){const n=ft(this);if(!n)return;const o=Do(this),s=dt(o.start,o.end);let r=o.start;if(i.minPoint&&ht(o.start,i.minPoint)<0){const a=dt(o.start,i.minPoint);r=wt(i.minPoint,-To(this,a))}else if(i.maxPoint&&ht(o.end,i.maxPoint)>0){const a=dt(i.maxPoint,o.end);r=wt(i.maxPoint,To(this,a)-s)}this.dragDateBoundsState={leftDayPoint:r,pixelsPerDay:n,viewportSpanDays:s}}},m.prototype.endDragging=function(e,{momentum:i=this.pinchMomentum?"pinch":"drag",point:n=Lt(e)}={}){this.isDragging=!1;const o=this.dragOrigin.left-n.x;i==="drag"&&this.trackDragMomentumSample(n.x),this.trigger("viewport-drag-end",Vi({startToken:this.timescaleManager.startToken,offsetX:this.repositionWindow,totalDx:o}),e),this.dragDateBoundsState=null,this._pinchPanHandoff=null,Fo(this,i)},m.prototype.doDrag=function(e,i=Lt(e)){var r;this.isPanning&&((r=this.stopPanAnimation)==null||r.call(this)),this.dragDateBoundsState&&this.dragDateBoundsState.pixelsPerDay!==ft(this)&&this.resetDragTracking({x:this.dragStartX,y:this.dragStartY});const n=this.dragStartX-i.x,o=this.dragOrigin.left-i.x,s=Math.abs(o);if(this.dragStartX=i.x,this.trackDragMomentumSample(i.x,!0),this.isAnimating||this.startAnimation(),s>30&&(this.animation.dragRedrawFunction=this.defaultRedraw),this.dragDateBoundsState){const a=wt(this.dragDateBoundsState.leftDayPoint,o/this.dragDateBoundsState.pixelsPerDay);Wa(this,a,this.dragDateBoundsState.viewportSpanDays)}else this.updateFromByPixels(n);this.trigger("viewport-drag",Vi({startToken:this.timescaleManager.startToken,offsetX:this.repositionWindow,dx:n,totalDx:o}),e)},m.prototype.trackDragMomentumSample=function(e,i=!1){var c;const n=Date.now(),o=((c=this.options.pan)==null?void 0:c.momentum)||{},s=Gt(o.sampleWindow,Ui),r=this.dragMomentumSamples||[],a=n-s,l=this._pinchPanHandoff;for(l&&i&&(l.movementTimes=l.movementTimes.filter(h=>h>=a),e!==l.lastX&&n>l.lastMovementTime&&(l.movementTimes.push(n),l.lastMovementTime=n),l.lastX=e);r.length>0&&r[0].time<a;)r.shift();r.push({time:n,x:e}),this.dragMomentumSamples=r},m.prototype.startDragMomentum=function(e,i){var g,p,y;const n=((g=this.options.pan)==null?void 0:g.momentum)||{};if(n.active!==!0){this.dragMomentumSamples=[];return}const o=Gt(n.sampleWindow,Ui),s=Date.now()-o,r=(this.dragMomentumSamples||[]).filter(v=>v.time>=s);if(this.dragMomentumSamples=[],this.isPinching||this.draggingArticle!==null)return;let a=i;if(a==null){if(r.length<2)return;const v=r[0],w=r[r.length-1],S=w.time-v.time;if(S<=0)return;a=(v.x-w.x)/S}const l=Gt(n.minVelocity,rl);if(Math.abs(a)<l)return;this.isPanning&&((p=this.animation.pan)!=null&&p.stop)&&this.animation.pan.stop(),(y=this.stopZoomAnimation)==null||y.call(this);const c=Gt(n.friction,ll),h=Gt(n.stopVelocity,al),u=Gt(n.maxDuration,hl);if(!Number.isFinite(a)||!Number.isFinite(c))return;this.isPanning=!0,this.startAnimation();const d=this,f=bo({velocity:a,friction:c,minVelocity:h,maxDuration:u,shouldStop(){return d.isDragging||d.isPinching?(d.isPanning=!1,!0):!1},onUpdate(v){var w;d.updateFromByPixels(v),e==null||e(v),d.requestRedraw(),Ya(d)&&(d.isPanning=!1,d.animation.pan===f&&(d.animation.pan=null),f.stop(),(w=d.settleDateBounds)==null||w.call(d))},onComplete(){var v;d.isPanning=!1,d.animation.pan===f&&(d.animation.pan=null),(v=d.settleDateBounds)==null||v.call(d)}});this.animation.pan=f},m.prototype.updateFromByPixels=function(t,e={}){var o;this.repositionWindow-=t;let i=this.timescaleManager.startToken,n=this.timescaleManager.getPrevious(i);for(;this.repositionWindow>=n.length;)this.repositionWindow-=n.length,i=n,n=this.timescaleManager.getPrevious(i);for(;-this.repositionWindow>=i.length;)this.repositionWindow+=i.length,i=this.timescaleManager.getNext(i);this.timescaleManager.setStartToken(i),(o=this._markTimelineStateChanged)==null||o.call(this),!(e.skipDateBounds||!Wt(this))&&It(this,{mode:this.isDragging||this.isPinching?"elastic":"clamp"})},m.prototype.updateMouseoverArticle=function(t,e=this.articles){const i=this.mouseoverArticle;let n=null;if(gl(this,t)){const o=this.getRelativePosition(t);for(let s=e.length-1;s>=0;s--){const r=e[s];if(r.isVisible&&r.isInside(o)){n=r;break}}}this.mouseoverArticle=n,i!==n&&(i!==null&&i.pointerLeave(t),n!==null&&n.pointerEnter(t),this.requestRedraw(this.redraw))},m.prototype.load=function(t){this.addArticles(t),this.updateCurrentDensitySetting(),this.updateArticlesGroupIndex(),this.requestRedraw()},m.prototype.addArticles=function(t,e,i){if(t.length===0){i&&i.call(this);return}const n=this.articles.map(function(s){return s.id}),o=[];for(let s=0;s<t.length;s++){const r=t[s];n.indexOf(I(r,"id"))===-1&&(o.push(r),this._createImplicitLane(this._resolveLaneIdFromArticleData(r)))}this._updateLaneLayout();for(let s=0;s<o.length;s++){const r=new M(this,I(o[s],"id"));this.articles.push(r),r.setupByReceivedData(o[s]),r.registerPosition(this.getOriginalPosition(r))}this._refreshLaneOrder(),this.updateIsActiveStatus(),i&&i.call(this)},m.prototype.getDmyFromInput=function(t){var i,n,o;let e;if(typeof t=="string"){if(e=b.fromString(t),!Number.isFinite(e.year))throw new Error(`Invalid Histropedia date string: ${t}`)}else t instanceof b?e=new b(t):e=new b({precision:t.precision,year:t.year,month:(i=t.month)!=null?i:1,day:(n=t.day)!=null?n:1,hour:t.hour,minute:t.minute,second:t.second,millisecond:t.millisecond});return(o=this.options)!=null&&o.shiftBceDates&&e.year<0&&(e.year+=1),e};function pl(t,e,i){if(i>=t.length){let n=i-t.length;for(;n--+1;)t.push(void 0)}return t.splice(i,0,t.splice(e,1)[0]),t}m.prototype.getActiveArticle=function(){for(let t=this.articles.length-1;t>=0;t--)if(this.articles[t].isActive)return this.articles[t];return null},m.prototype.getArticleById=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];if(i.id===t)return i}},m.prototype.bringFront=function(t){const e=Bo(this.articles,t);e>=0&&pl(this.articles,e,this.articles.length-1)},m.prototype.select=function(t){this.bringFront(t);const e=this.getActiveArticle();this.updateIsActiveStatus();const i=this.getActiveArticle();i!==e&&i&&this.trigger("article-select",i),this._emitTimelineStateChange()},m.prototype.activated=function(t){this.select(t.id)},m.prototype.updateIsActiveStatus=function(){for(let t=0;t<this.articles.length;t++)this.articles[t].isActive=!1;for(let t=this.articles.length-1;t>=0;t--)if(this.articles[t].isDataLoaded){this.articles[t].isActive=!0;return}},m.prototype.getVisibleArticlesClone=function(){const t=[];for(let e=0;e<this.articles.length;e++){const i=this.articles[e];i.isVisible&&i.isDataLoaded&&t.push(i)}return t},m.prototype.hasArticle=function(t){let e;for(let i=0;i<this.articles.length;i++)this.articles[i].id===t&&(e=this.articles[i]);return!We(e)},m.prototype.reposition=function(t,e){if(t.isDragging)return;const i=this.getOriginalPosition(t,e);t.registeredPosition=i;const n=t.finalOffset;if(!this.options.article.animation.move.active){t.position={left:i.left+n.left,top:i.top+n.top},t.offset={left:n.left,top:n.top};return}t.moveAnimation.finalOffset.top!==n.top||t.moveAnimation.finalOffset.left!==n.left?t.moveToOffsetWithAnim(n,!0):t.position={left:i.left+t.offset.left,top:i.top+t.offset.top}},m.prototype.getOriginalPosition=function(t,e){let i=this.getPixel(t.period.from,e);if(this.options.article.collectOngoing){const s=this.getPixel(t.period.to,e),r=isNaN(i)||i<0,a=isNaN(s)||s>0;r&&a&&(i=0)}const n=t.getCurrentStyle(),o=this.getLaneById(t.laneId);return this._isLaneLayoutActive()&&o&&o.geometry?{left:i-n.connectorLine.offsetX,top:o.geometry.bodyContentBottom-this._getLaneDistanceToBaseline(o)}:{left:i-n.connectorLine.offsetX,top:this.top-this._getTimelineDistanceToBaseline()}},m.prototype.reorderArticles=function(t){const e=[];for(let o=0;o<t.length;o++){const s=Bo(this.articles,t[o]);e.push(this.articles[s])}const i=this.getActiveArticle();this.articles=e,this.updateIsActiveStatus();const n=this.getActiveArticle();n!==i&&n&&this.trigger("article-select",n)},m.prototype.getSortedByYearClone=function(){},m.prototype.removeArticleById=function(t){for(let e=0;e<this.articles.length;e++){const i=this.articles[e];if(i.id===t){if(typeof i._imageCancel=="function")try{i._imageCancel()}catch(n){}if(typeof i._closeImage=="function")try{i._closeImage({skipRedraw:!0})}catch(n){}i._pendingImageKey=null,this.articles.splice(e,1),this._emitTimelineStateChange();break}}},m.prototype.deleteCurrentArticle=function(){if(this.articles.length!==0){this.removeById(this.articles,this.getActiveArticle().id),this.requestRedraw();for(let t=this.articles.length-1;t>=0;t--){const e=this.articles[t];if(e.isVisible){this.select(e.id),this.requestRedraw();return}}}},m.prototype.pp=function(t){let e="";for(let i=0;i<this.articles.length;i++)e+=`${this.articles[i].title.split(" ")[0]},`;t=t||"",W.log(`${t}:${e}`)};function Bo(t,e){return t.findIndex(i=>i.id===e)}pt.prototype.draw=function(t,e){t.globalAlpha=1;const i=e.left,n=e.right,o=e.top,s=e.height,r=Math.max(0,n-i);if(r<=0)return;const a=this.style||{};t.fillStyle=a.backgroundColor||"rgba(200,200,200,0.25)",t.fillRect(i,o,r,s);const l=a.border||null;l&&l.width&&(t.lineWidth=l.width,t.strokeStyle=l.color||"rgba(120,120,120,0.6)",t.strokeRect(i+.5,o+.5,r-1,s-1));const c=a.text||{},h=c.margin||6,u=Math.max(0,r-h*2);if(u>2){t.font=c.font||"500 12px Calibri",t.textAlign=c.align||"center",t.textBaseline=c.baseline||"middle",t.fillStyle=c.color||"#222";const d=this.title||"",f=t.measureText(d).width;let g=d;if(f>u){const w=t.measureText.bind(t);let S=0,_=d.length,L=0;const T=w("…").width,C=Math.max(0,u-T);for(;S<=_;){const A=Math.floor((S+_)/2),k=d.substring(0,A);w(k).width<=C?(L=A,S=A+1):_=A-1}g=L>0?`${d.substring(0,L)}…`:""}const p=c.align==="left"?i+h:c.align==="right"?n-h:Math.floor((i+n)/2);let y;switch(c.verticalAlign||"middle"){case"top":y=o+(c.margin||0);break;case"bottom":y=o+s-(c.margin||0);break;default:y=o+Math.floor(s/2);break}y+=c.offsetY||0,t.fillText(g,p,y)}};const Ho=150;m.prototype.defaultRedraw=function(){this.redraw({onArticlesInRangeIsReady:function(e){this.updateVisibleArticlesOfGroups(e),this.forInRangeArticles(function(n){this.reposition(n,e)}),this.stack(e)},onArticlesVisiblityIsReady:function(e){this.updateArticleLines()}})},m.prototype.repositionRedraw=function(){this.redraw({onArticlesInRangeIsReady:function(e){this.updateVisibleArticlesOfGroups(e),this.forInRangeArticles(function(n){this.reposition(n,e)})},onArticlesVisiblityIsReady:function(e){this.updateArticleLines()}})},m.prototype.redraw=function(t){if(this.redrawInProgress)return;this.redrawInProgress=!0;const e=this.topRow;t=t||{};const i=this.canvasContext,n=this.getWidth(),o=this.top;this.trigger("timeline-render-start",{canvasContext:i,top:o});const s={},r=this.getTokensAndMarkers(n),a=r.markers,l=r.tokens;s.tokens=l,s.markers=a,this._updateLaneLayout(),this._refreshAdaptiveArticleRuntimeOptions(),this._syncLaneDom(),this.invoke("onMainRangeIsReady",t,s),this.forLoadedArticles(function(h){h.isInView=h.overlapsInclusiveWithDates(s.tokens.start,s.tokens.end),to(this.options.article.autoStacking.range)?h.isInRange=h.isInView:h.isInRange=!0,h.isVisibleInLane=this._isArticleLaneVisible(h),h.isInRange&&(h.isHiddenByFilter=h.hiddenByFilter)}),this.invoke("onArticlesInRangeIsReady",t,s),this.forLoadedArticles(function(h){h.updateVisibility()}),this.forVisibleArticles(function(h){this.enqueueImageLoad(h)}),this.invoke("onArticlesVisiblityIsReady",t,s),this.forInRangeArticles(function(h){h.indicator={fromX:Math.max(-3,Math.round(this.getPixel(h.period.from,s))),toX:Math.min(this.options.width,Math.round(this.getPixel(h.period.to,s)))},h.indicator.toX-h.indicator.fromX<2&&(h.indicator.toX=h.indicator.fromX+2)}),!this._isLaneLayoutActive()&&this.options.article.autoStacking.fitToHeight&&e!==this.topRow&&this.fitToHeight(!0),this.render(i,o,n,a,s),this.redrawInProgress=!1,this.trigger("timeline-render-end",{canvasContext:i,drawCycleContext:s,top:o})},m.prototype.render=function(t,e,i,n,o){const s=this._getEffectiveVerticalOffset?this._getEffectiveVerticalOffset():this.options.verticalOffset;this.owner||t.clearRect(0,0,i,this.top+s),this.drawTimeBands(t,e,i,o),typeof this.drawCharts=="function"&&this.drawCharts(t,e,i,o),this.drawDraggingHighlight(t,e,i);const r=this.options.style.mainLine.position==="top"?-s:e;this.drawMainline(t,r,i,n),this.drawDateIndicators(t,r),t.globalAlpha=1;for(let l=0;l<this.articles.length;l++){const c=this.articles[l];c.isDataLoaded&&c.isVisible&&!c.isActive&&c.drawPeriodLinesAndConnectors(t,e)}for(let l=0;l<this.articles.length;l++){const c=this.articles[l];c.isDataLoaded&&c.isVisible&&!c.isActive&&c.draw(t)}const a=this.getActiveArticle();a&&a.isVisible&&(a.drawPeriodLinesAndConnectors(t,e),a.draw(t)),this.options.disableBranding||(t.globalAlpha=1,this._drawBranding(t)),this.drawDebugOverlays(t,i,o)},m.prototype.drawDebugOverlays=function(t,e,i){var n;(n=this.options.debugOverlays)!=null&&n.densityRegions&&this.drawDensityRegionBoundaries(t,e,i)};function yl(t,e,i,n){var o,s,r;return i!=="article"?i:n?((o=e.activeStyle)==null?void 0:o.color)||((s=e.style)==null?void 0:s.color)||t.options.article.defaultStyle.color:((r=e.style)==null?void 0:r.color)||t.options.article.defaultStyle.color}m.prototype.drawDateIndicators=function(t,e){const i=this.options.style.mainLine.dateIndicators;if(!i.visible)return;const n=this.options.style.mainLine.size,o=n/2,s=N(N({},i),i.activeStyle),r=N(N({},i),i.hiddenStyle);t.save(),t.globalAlpha=1,this.forInRangeArticles(function(l){var y,v;if(l.isHiddenByFilter||!l.isInView)return;const c=l.isActive===!0,h=!c&&l.isVisibleInLane!==!1&&l.isVisibleInGroup===!1,u=c?s:h?r:i,d=u.size,f=d/2,g=l.indicator.fromX,p=c&&((y=i.activeStyle)==null?void 0:y.color)==="article";if(t.globalAlpha=(v=u.opacity)!=null?v:1,t.fillStyle=yl(this,l,u.color,p),u.shape==="circle"){t.beginPath(),t.arc(g,e,f,0,Math.PI*2),t.fill();return}t.fillRect(g-f,e-o,d,n)}),t.restore()},m.prototype.getDensityRegionBoundaryDate=function(t){if(ae(t))return Bi(t.day);const e=this.currentDensitySetting.step;if(this.timescaleManager.unit>=$&&e.months!==0){const c=t*e.months,h=Math.floor(c/12),u=c-h*12+1;return new b(h,u,1)}const i=e.days===0?e.months*30:e.days,n=t*i;let o=Math.floor((n-1)/372);const s=n-o*372;let r=Math.floor((s-1)/31)+1;const a=(s-1)%31+1,l=new b(o,r,a);return l.day!==a?(r++,r>12&&(r=1,o++),new b(o,r,1)):l},m.prototype.getDensityRegionBoundaryPoint=function(t){if(ae(t)){const e=Oa(t);return{date:Bi(e.dayNumber),dayFraction:e.dayFraction}}return{date:this.getDensityRegionBoundaryDate(t),dayFraction:0}},m.prototype.drawDensityRegionBoundaries=function(t,e,i){var h;const n=i==null?void 0:i.tokens;if(!(n!=null&&n.start)||!(n!=null&&n.end)||!((h=this.currentDensitySetting)!=null&&h.step))return;const o=Mt(this.calculateGroupIndex(n.start),-1),s=Mt(this.calculateGroupIndex(n.end),1),r=this.timescaleManager.startToken.value,a=ft(this),l=this.options.height;let c=null;t.save(),t.beginPath(),t.globalAlpha=1,t.lineWidth=1,t.strokeStyle="rgba(204, 0, 153, 0.8)",t.setLineDash([4,4]);for(let u=o;Ie(u,s)<=0;u=Mt(u,1)){const d=this.getDensityRegionBoundaryPoint(u),f=this.timescaleManager.getPixelsBetween(r,d.date)+d.dayFraction*a+this.repositionWindow,g=Math.round(f)+.5;g<0||g>e||g===c||(t.moveTo(g,0),t.lineTo(g,l),c=g)}t.stroke(),t.restore()},m.prototype.drawMainline=function(t,e,i,n){if(this.options.style.mainLine.visible){t.globalAlpha=1;const o=this.options.style.mainLine.size>>1,s=this.options.style.mainLine.color;let r=typeof s=="string"?s:$n;(s==null?void 0:s.type)==="gradient"&&typeof s.topColor=="string"&&typeof s.bottomColor=="string"&&(r=t.createLinearGradient(0,e-o,0,e+o),r.addColorStop(0,s.topColor),r.addColorStop(1,s.bottomColor)),t.beginPath(),t.lineWidth=this.options.style.mainLine.size,t.strokeStyle=t.fillStyle=r,t.moveTo(0,e),t.lineTo(i,e),t.stroke();for(const a in n)this.drawMarkersAndLabels(t,n[a],a,e+o,{minorTokens:n[B],viewportWidth:i});this.drawParentDateLabels(t,e+o,i)}},m.prototype.drawDraggingHighlight=function(t,e,i){if(!this.isDragging)return;const n=this.options.style.draggingHighlight||{};if(!n.visible)return;t.fillStyle=n.color;const o=this.top,s=this.options.height,r={up:0,down:60},{up:a,height:l}=Ci(n.area,{anchorY:o,canvasHeight:s,fallbackArea:r});l<=0||t.fillRect(0,o-a,i,l)},m.prototype.drawTimeBands=function(t,e,i,n){const o=this.options.timeBand||{};if(!o.visible||!this.timeBands||this.timeBands.length===0)return;const s=n||{tokens:this.getTokensAndMarkers(i).tokens},r=this._getVisibleTimeBands(s);if(r.length===0)return;const a=this.top,l=this.options.height,c={up:0,down:40},{up:h,height:u}=Ci(o.area,{anchorY:a,canvasHeight:l,fallbackArea:c});if(u<=0)return;const d=a-h;t.save();for(let f=0;f<r.length;f++){const g=r[f];let p=Math.round(this.getPixel(g.period.from,s)),y=Math.round(this.getPixel(g.period.to,s));y<0||p>i||(p=Math.max(0,p),y=Math.min(i,y),!(y-p<=0)&&g.draw(t,{left:p,right:y,top:d,height:u}))}t.restore()},m.prototype.getTokensAndMarkers=function(t){var c,h;const e={},i={};i[E]=[],i[B]=[];const n=(h=(c=this.timescaleManager).getSubdayVisualMarkerLayout)==null?void 0:h.call(c);let o=this.repositionWindow,s=this.timescaleManager.startToken;e.start=s.value;const r=9;let a=0,l=s.type===E&&o<=0;for(;a<r||!l;)s=this.timescaleManager.getPrevious(s),o-=s.length,a++,s.type===E&&o<=0&&(l=!0);do s.drawX=o,e[s.value.toKeyString()]=o,n||i[s.type].push(s),o+=s.length,s=this.timescaleManager.getNext(s);while(o<t+Ho);if(n){const u=this.timescaleManager.createSubdayVisualMarkers(t,this.repositionWindow,n);i[E]=u[E],i[B]=u[B]}return e.end=this.getPivotPoint(t+Ho).date,{tokens:e,markers:i}};function si(t,e,i){var a;const n=t.measureText(e.label).width,o=Number.isFinite((a=i.offset)==null?void 0:a.x)?i.offset.x:0;let r=Math.round(e.drawX)+o;return i.textAlign==="center"?r-=n/2:(i.textAlign==="right"||i.textAlign==="end")&&(r-=n),{left:r,width:n}}function Wo(t,e,i){return i==="center"?t+e/2:i==="right"||i==="end"?t+e:t}function wl(t,e){var i;return(t==null?void 0:t.enabled)===!0?!0:(t==null?void 0:t.enabled)!=="auto"?!1:Number.isFinite((i=e[0])==null?void 0:i.unit)&&e[0].unit<=$}const Gi=8;function bl(t,e,i,n){var h;if(((h=i.sticky)==null?void 0:h.enabled)!==!0||!Number.isFinite(n))return null;const o=Number.isFinite(i.sticky.offsetX)?i.sticky.offsetX:0;let s=-1,r;for(let u=0;u<e.length;u++){const d=si(t,e[u],i);d.left<=o&&(s=u,r=d)}if(s<0)return null;const a=e[s],l=e[s+1];if(a.drawX>n||!l&&a.drawX+a.length<0)return null;let c=o;if(l){const u=si(t,l,i);c=Math.min(c,u.left-r.width-Gi)}return{token:a,labelX:Wo(c,r.width,i.textAlign)}}function vl(t,e,i,n){const o=i.sticky,s=n.minorTokens||[],r=n.viewportWidth;if(!wl(o,e)||!Number.isFinite(r))return null;const a=Number.isFinite(o.offsetX)?o.offsetX:0;let l=-1,c;for(let g=0;g<e.length;g++){const p=si(t,e[g],i);p.left<=a&&(l=g,c=p)}if(l<0)return null;const h=e[l],u=e[l+1];if(!(h.drawX<=r&&(u?u.drawX>=0:h.visual===!0&&h.drawX+h.length>=0||s.some(g=>g.drawX>=0&&g.drawX<=r&&g.drawX>h.drawX))))return null;let f=a;if(u){const g=si(t,u,i);f=Math.min(f,g.left-c.width-Gi)}return{token:h,labelX:Wo(f,c.width,i.textAlign)}}m.prototype.drawParentDateLabels=function(t,e,i){const n=this.options.style.dateLabel.parent;if(!this.timescaleManager.isParentContextTextVisible(n))return;const o=this.getPivotPoint(0).date,s=this.timescaleManager.createParentContextTokens(o,i,this.repositionWindow);if(s.length===0)return;const r=this.options.style.mainLine.position==="top"?-1:1,a=this.options.style.dateLabel.major,l=this.options.style.marker.major.height,c=e+l*r+a.offset.y+n.height*r+n.offset.y;t.font=n.font,t.textAlign=n.textAlign,t.textBaseline=r===1?"alphabetic":"top";const h=bl(t,s,n,i);let u=Number.NEGATIVE_INFINITY;for(let d=0;d<s.length;d++){const f=s[d],g=(h==null?void 0:h.token)===f?h.labelX:Math.round(f.drawX)+n.offset.x,p=t.measureText(f.label).width;let y=g;n.textAlign==="center"?y-=p/2:(n.textAlign==="right"||n.textAlign==="end")&&(y-=p),!((h==null?void 0:h.token)!==f&&y<u+Gi)&&(t.fillStyle=f.value.isInFuture()?n.futureColor:n.color,t.fillText(f.label,g,c),u=y+p)}},m.prototype.drawMarkersAndLabels=function(t,e,i,n,o={}){if(e.length===0)return;switch(i){case JSON.stringify(B):i="minor";break;case JSON.stringify(E):i="major";break;default:W.log("token type not recognised",i,B)}const s=this.options.style.marker[i],r=s.extend,a=this.options.style.mainLine.position==="top"?-1:1,l=s.height,c=e.some(p=>p.label);let h=e[0].value.isInFuture(),u=!h,d,f;a===-1&&(n-=this.options.style.mainLine.size),c&&(d=this.options.style.dateLabel[i],t.font=d.font,t.textAlign=d.textAlign,t.textBaseline=a===1?"alphabetic":"top",f=n+l*a+d.offset.y);const g=c&&i==="major"?vl(t,e,d,o):null;t.beginPath();for(let p=0;p<e.length;p++){const y=e[p];h=y.value.isInFuture(),u&&h&&(u=!1,t.strokeStyle=s.color,t.lineWidth=1,t.stroke(),t.beginPath());const v=Math.round(y.drawX);t.moveTo(v,n+l*a);const w=r?n+-1*a*this.top:n;if(t.lineTo(v,w),c&&y.label){const S=(g==null?void 0:g.token)===y?g.labelX:v+d.offset.x;t.fillStyle=h?d.futureColor:d.color,t.fillText(y.label,S,f)}}t.strokeStyle=h?s.futureColor:s.color,t.lineWidth=1,t.stroke()},m.prototype.loadTimeBands=function(t){this.addTimeBands(t),typeof this._getEffectiveVerticalOffset=="function"&&(this.top=this.options.height-this._getEffectiveVerticalOffset()),this.requestRedraw()},m.prototype.addTimeBands=function(t){if(!Array.isArray(t)||t.length===0)return;const e=this.timeBands.map(o=>o.id),i=t.filter(o=>e.indexOf(o.id)===-1),n=this.options.timeBand&&this.options.timeBand.defaultStyle||{};for(let o=0;o<i.length;o++){const s=i[o],r=new pt(this,s.id);r.setupByReceivedData(s),r.style=D({},n,s.style||{}),this.timeBands.push(r)}typeof this._getEffectiveVerticalOffset=="function"&&(this.top=this.options.height-this._getEffectiveVerticalOffset())},m.prototype._getVisibleTimeBands=function(t){if(!this.timeBands||this.timeBands.length===0)return[];const e=t.tokens.start,i=t.tokens.end;return this.timeBands.filter(n=>n.isDataLoaded&&n.visibility!=="hidden"&&n.overlapsInclusiveWithDates(e,i))};function ji(t,e){return e&&e.resolvedArticleOptions?e.resolvedArticleOptions:qn(t.options.article||{})}m.prototype._getResolvedArticleOptions=function(t){const e=t&&t.laneId!=null?t.laneId:this._resolveLaneIdFromArticleData(t),i=this.getLaneById(e);return ji(this,i)},m.prototype._getResolvedArticleStyleOverrides=function(t,e){var h,u,d,f,g;const i=t&&t.laneId!=null?t.laneId:this._resolveLaneIdFromArticleData(t),n=this.getLaneById(i),o=se.article||{},s=((h=this._registeredArticleLayoutStyles)==null?void 0:h[e])||((d=this._registeredArticleLayoutStyles)==null?void 0:d[(u=this.getCardLayout(e))==null?void 0:u.name])||{},r=this._explicitArticleOptions||{},a=((f=r.layoutStyles)==null?void 0:f[e])||{},l=(n==null?void 0:n.articleOptions)||{},c=((g=l.layoutStyles)==null?void 0:g[e])||{};return{style:D({},o.defaultStyle||{},s.style||{},r.defaultStyle||{},a.style||{},l.defaultStyle||{},c.style||{}),hoverStyle:D({},o.defaultHoverStyle||{},s.hoverStyle||{},r.defaultHoverStyle||{},a.hoverStyle||{},l.defaultHoverStyle||{},c.hoverStyle||{}),activeStyle:D({},o.defaultActiveStyle||{},s.activeStyle||{},r.defaultActiveStyle||{},a.activeStyle||{},l.defaultActiveStyle||{},c.activeStyle||{})}},m.prototype._getExplicitArticleCardLayout=function(t){if(!t)return null;if(typeof t.cardLayout=="string"&&t.cardLayout!=="")return t.cardLayout;const e=t.data||t,i=I(e,"cardLayout");return typeof i=="string"&&i!==""?i:null},m.prototype._getResolvedArticleTopGap=function(t=this.options.article||{}){const e=t.autoStacking||{};let i=Number(oe(e.topGap,this))||0;return this.options.style.mainLine.position==="top"&&(i-=this.options.verticalOffset),i},m.prototype._getTimelineArticleAvailableHeight=function(){return Math.max(0,this.top-this._getResolvedArticleTopGap())},m.prototype._getLaneArticleAvailableHeight=function(t){return!t||!t.geometry?0:Math.max(0,t.geometry.bodyContentBottom-t.geometry.bodyContentTop)},m.prototype._getAvailableHeightForArticle=function(t){const e=t&&t.laneId!=null?t.laneId:this._resolveLaneIdFromArticleData(t);return this._isLaneLayoutActive()?this._getLaneArticleAvailableHeight(this.getLaneById(e)):this._getTimelineArticleAvailableHeight()},m.prototype._resolveCardLayoutFromBreakpoints=function(t){var i;const e=Array.isArray((i=this.options.article)==null?void 0:i.cardLayoutBreakpoints)?this.options.article.cardLayoutBreakpoints:[];for(let n=0;n<e.length;n++){const o=e[n];if(!(!o||!Number.isFinite(o.maxHeight)||typeof o.layout!="string"||o.layout==="")&&t<=o.maxHeight)return o.layout}return null},m.prototype._resolveDefaultCardLayoutName=function(t){const e=this._getResolvedArticleOptions(t),i=this._resolveCardLayoutFromBreakpoints(this._getAvailableHeightForArticle(t));if(i)return i;const n=e.defaultCardLayout;return typeof n=="string"&&n!==""?n:"portrait"},m.prototype._resolveArticleCardLayoutName=function(t){return this._getExplicitArticleCardLayout(t)||this._resolveDefaultCardLayoutName(t)},m.prototype._getTimelineDistanceToBaseline=function(){var e,i;if(Number.isFinite((e=this._runtimeArticleOptions)==null?void 0:e.distanceToBaseline))return this._runtimeArticleOptions.distanceToBaseline;const t=this._resolveDefaultCardLayoutName();return Ge((i=this.options.article)==null?void 0:i.distanceToBaseline,this._getTimelineArticleAvailableHeight(),!1,t)},m.prototype._getLaneAutoStackingOptions=function(t){return ji(this,t).autoStacking||{}},m.prototype._getLaneDistanceToBaseline=function(t){var n;if(!this._isLaneLayoutActive())return this._getTimelineDistanceToBaseline();if(Number.isFinite((n=t==null?void 0:t._runtimeArticleOptions)==null?void 0:n.distanceToBaseline))return t._runtimeArticleOptions.distanceToBaseline;const e=ji(this,t),i=this._resolveDefaultCardLayoutName({laneId:t==null?void 0:t.id});return Ge(e.distanceToBaseline,this._getLaneArticleAvailableHeight(t),!0,i)},m.prototype._refreshAdaptiveArticleRuntimeOptions=function(){var o,s;const t=this._isLaneLayoutActive(),e=new Map,i=this._getTimelineArticleAvailableHeight(),n=this._resolveDefaultCardLayoutName();this._runtimeArticleOptions={availableHeight:i,defaultCardLayout:n,distanceToBaseline:Ge((o=this.options.article)==null?void 0:o.distanceToBaseline,i,!1,n)};for(let r=0;r<this.lanes.length;r++){const a=this.lanes[r],l=t&&a.geometry?this._getLaneArticleAvailableHeight(a):0,c=(s=a==null?void 0:a.resolvedArticleOptions)==null?void 0:s.distanceToBaseline,h=this._resolveDefaultCardLayoutName({laneId:a==null?void 0:a.id});e.set(a.id,h),a._runtimeArticleOptions={availableHeight:l,defaultCardLayout:h,distanceToBaseline:Ge(c,l,t,h)}}this.forLoadedArticles(r=>{const a=e.get(r.laneId)||this._resolveDefaultCardLayoutName(r),l=this._getExplicitArticleCardLayout(r)||a;if(r._resolvedCardLayoutName!==l){r.initialiseStyles(r.data),r.invalidateCaches();return}r._resolvedDefaultCardLayout=a,r._resolvedCardLayoutName=l})};function Pt(...t){return t.filter(Boolean).join(" ")}function bt(t){return`${Math.round(t||0)}px`}function Yo(t,e){const i=e===t.length-1,n=e===0,o=["histropedia-lane",`histropedia-lane-index-${e}`];return i&&o.push("histropedia-lane-position-top"),n&&o.push("histropedia-lane-position-bottom"),!i&&!n&&o.push("histropedia-lane-position-middle"),o}function Sl(t){switch(t){case"center":return"center";case"right":return"flex-end";default:return"flex-start"}}function Dt(t,e){return R(t||{},e)?I(t,e):void 0}function Vo(t,e,i){return e?{visible:!1,rootClassName:Pt(...Yo(t.lanes,i),t.options.lane.defaultClassName,e.className),zIndex:String(t.lanes.length-i),headerClassName:Pt("histropedia-lane-header",t.options.lane.defaultHeaderClassName,e.headerClassName),bodyClassName:Pt("histropedia-lane-body",t.options.lane.defaultBodyClassName,e.bodyClassName),titleClassName:Pt("histropedia-lane-title",t.options.lane.defaultTitleClassName,e.titleClassName)}:{visible:!1}}function _l(t,e,i){var l,c;const n=e.geometry,o=e.style||{},s=Dt(o,"title.textAlign"),r=Dt(o,"body.borderWidth"),a=Dt(o,"body.borderRadius");return{visible:!0,rootClassName:Pt(...Yo(t.lanes,i),t.options.lane.defaultClassName,e.className),zIndex:String(t.lanes.length-i),headerClassName:Pt("histropedia-lane-header",t.options.lane.defaultHeaderClassName,e.headerClassName),bodyClassName:Pt("histropedia-lane-body",t.options.lane.defaultBodyClassName,e.bodyClassName),titleClassName:Pt("histropedia-lane-title",t.options.lane.defaultTitleClassName,e.titleClassName),top:bt(n.top),height:bt(n.height),headerHeight:bt(n.headerHeight||0),headerDisplay:n.headerHeight>0?"":"none",headerBackgroundColor:Dt(o,"header.backgroundColor"),bodyTop:bt(n.bodyTop-n.top),bodyBottom:bt(n.bottom-n.bodyBottom),bodyBackgroundColor:Dt(o,"body.backgroundColor"),bodyBorderColor:Dt(o,"body.borderColor"),bodyBorderWidth:typeof r=="undefined"?void 0:bt(r),bodyBorderStyle:typeof r=="undefined"?void 0:"solid",bodyBorderRadius:typeof a=="undefined"?void 0:bt(a),titleLeft:bt(((l=n.headerPadding)==null?void 0:l.left)||0),titleRight:bt(((c=n.headerPadding)==null?void 0:c.right)||0),titleJustifyContent:typeof s=="undefined"?void 0:Sl(s),titleColor:Dt(o,"title.color"),titleFont:Dt(o,"title.font"),titleTextAlign:s,titleText:e.title||""}}function mt(t,e,i){t[e]=typeof i=="undefined"?"":i}function Ll(t,e){const i=[];for(let n=t.lanes.length-1;n>=0;n--){const o=String(t.lanes[n].id),s=t._laneDomNodes.get(o);s&&i.push(s.root)}for(let n=0;n<i.length;n++)e.children[n]!==i[n]&&e.insertBefore(i[n],e.children[n]||null)}function Zo(t,e,i){if((!e||e.rootClassName!==i.rootClassName)&&(t.root.className=i.rootClassName),(!e||e.headerClassName!==i.headerClassName)&&(t.header.className=i.headerClassName),(!e||e.bodyClassName!==i.bodyClassName)&&(t.body.className=i.bodyClassName),(!e||e.titleClassName!==i.titleClassName)&&(t.title.className=i.titleClassName),(!e||e.zIndex!==i.zIndex)&&mt(t.root.style,"zIndex",i.zIndex),!(e&&e.visible===i.visible&&i.visible===!1)){if(!i.visible){t.root.style.display="none";return}(!e||e.visible!==!0)&&(t.root.style.display=""),(!e||e.top!==i.top)&&(t.root.style.top=i.top),(!e||e.height!==i.height)&&(t.root.style.height=i.height),(!e||e.headerHeight!==i.headerHeight)&&(t.header.style.height=i.headerHeight),(!e||e.headerDisplay!==i.headerDisplay)&&(t.header.style.display=i.headerDisplay),(!e||e.headerBackgroundColor!==i.headerBackgroundColor)&&mt(t.header.style,"backgroundColor",i.headerBackgroundColor),(!e||e.bodyTop!==i.bodyTop)&&(t.body.style.top=i.bodyTop),(!e||e.bodyBottom!==i.bodyBottom)&&(t.body.style.bottom=i.bodyBottom),(!e||e.bodyBackgroundColor!==i.bodyBackgroundColor)&&mt(t.body.style,"backgroundColor",i.bodyBackgroundColor),(!e||e.bodyBorderColor!==i.bodyBorderColor)&&mt(t.body.style,"borderColor",i.bodyBorderColor),(!e||e.bodyBorderWidth!==i.bodyBorderWidth)&&mt(t.body.style,"borderWidth",i.bodyBorderWidth),(!e||e.bodyBorderStyle!==i.bodyBorderStyle)&&mt(t.body.style,"borderStyle",i.bodyBorderStyle),(!e||e.bodyBorderRadius!==i.bodyBorderRadius)&&mt(t.body.style,"borderRadius",i.bodyBorderRadius),(!e||e.titleLeft!==i.titleLeft)&&(t.title.style.left=i.titleLeft),(!e||e.titleRight!==i.titleRight)&&(t.title.style.right=i.titleRight),(!e||e.titleJustifyContent!==i.titleJustifyContent)&&mt(t.title.style,"justifyContent",i.titleJustifyContent),(!e||e.titleColor!==i.titleColor)&&mt(t.title.style,"color",i.titleColor),(!e||e.titleFont!==i.titleFont)&&mt(t.title.style,"font",i.titleFont),(!e||e.titleTextAlign!==i.titleTextAlign)&&mt(t.title.style,"textAlign",i.titleTextAlign),(!e||e.titleText!==i.titleText)&&(t.title.textContent=i.titleText)}}m.prototype._initialiseLaneHost=function(t){if(this._laneHostElement=null,this._laneViewportElement=null,this._laneLayer=null,this._laneDomNodes=new Map,this._laneDomState=new Map,this._laneDomDirty=!0,this._laneLayerDisplay=null,this._hasExplicitLanes=!1,!(t&&t===this.canvas)&&t&&t.nodeName!=="CANVAS"){this._laneHostElement=t;return}const i=this.canvas?this.canvas.parentElement:null;i&&i.firstElementChild===this.canvas&&i.children.length===1&&(this._laneHostElement=i)},m.prototype._ensureLaneViewport=function(){if(!this._laneHostElement||!this.canvas)return null;if(this._laneViewportElement)return this._laneViewportElement;const t=this.canvas.parentElement;if(!t)return null;const e=document.createElement("div");return e.className="histropedia-viewport",e.style.display="block",e.style.position="relative",t.insertBefore(e,this.canvas),e.appendChild(this.canvas),this._laneViewportElement=e,this._syncLaneViewportSize(),e},m.prototype._syncLaneViewportSize=function(){if(!this._laneViewportElement||!this.canvas)return;const t=this.canvas.style&&this.canvas.style.width?this.canvas.style.width:"",e=this.canvas.style&&this.canvas.style.height?this.canvas.style.height:"";this._laneViewportElement.style.width=t,this._laneViewportElement.style.height=e},m.prototype._markLaneDomDirty=function(){this._laneDomDirty=!0},m.prototype._setLaneLayerDisplay=function(t){!this._laneLayer||this._laneLayerDisplay===t||(this._laneLayer.style.display=t,this._laneLayerDisplay=t)},m.prototype._isLaneChromeActive=function(){return this._isLaneLayoutActive()&&this.options.lane.visible!==!1},m.prototype._ensureLaneLayer=function(){const t=this._ensureLaneViewport();if(!t)return null;if(!this._laneLayer){const e=document.createElement("div");e.setAttribute("aria-hidden","true"),e.dataset.histropediaLaneLayer="true",e.style.position="absolute",e.style.inset="0",e.style.pointerEvents="none",e.style.zIndex="0",e.style.overflow="hidden";const i=typeof window!="undefined"&&window.getComputedStyle?window.getComputedStyle(this.canvas).position:this.canvas.style.position;(!i||i==="static")&&(this.canvas.style.position="relative"),this.canvas.style.zIndex="1",this.canvas.style.display||(this.canvas.style.display="block"),this.canvas.parentElement===t?t.insertBefore(e,this.canvas):go(t,e),this._laneLayer=e}return this._laneLayer},m.prototype._syncLaneDom=function(){if(!this._isLaneChromeActive()){this._laneLayer&&this._setLaneLayerDisplay("none");return}const t=this._ensureLaneLayer();if(!t)return;this._setLaneLayerDisplay("");const e=this._laneDomDirty,i=new Set;for(let n=0;n<this.lanes.length;n++){const o=this.lanes[n],s=o.geometry,r=o.currentVisibility!=="hidden"&&s,a=String(o.id);let l=this._laneDomNodes.get(a);if(!l){const u=document.createElement("div"),d=document.createElement("div"),f=document.createElement("div"),g=document.createElement("div");u.dataset.histropediaLaneId=a,d.appendChild(f),u.appendChild(d),u.appendChild(g),t.appendChild(u),u.style.position="absolute",u.style.left="0",u.style.right="0",u.style.boxSizing="border-box",u.style.pointerEvents="none",d.style.position="absolute",d.style.left="0",d.style.right="0",d.style.top="0",d.style.boxSizing="border-box",d.style.pointerEvents="none",g.style.position="absolute",g.style.left="0",g.style.right="0",g.style.boxSizing="border-box",g.style.pointerEvents="none",f.style.position="absolute",f.style.top="0",f.style.bottom="0",f.style.display="flex",f.style.alignItems="center",f.style.boxSizing="border-box",f.style.pointerEvents="none",f.style.overflow="hidden",f.style.whiteSpace="nowrap",f.style.textOverflow="ellipsis",l={root:u,header:d,title:f,body:g},this._laneDomNodes.set(a,l)}i.add(a);const c=r?_l(this,o,n):Vo(this,o,n),h=this._laneDomState.get(a);Zo(l,h,c),this._laneDomState.set(a,c)}this._laneDomNodes.forEach((n,o)=>{if(!i.has(o)){const s=Vo(),r=this._laneDomState.get(o);Zo(n,r,s),this._laneDomState.set(o,s)}}),e&&Ll(this,t),this._laneDomDirty=!1};function de(t,e){return t===e}function Ml(t){const e=t&&t.layout?t.layout:{},i=Number.isFinite(e.height)?e.height:null,n=Number.isFinite(e.heightWeight)&&e.heightWeight>0?e.heightWeight:1;return{explicitHeight:i,heightWeight:n}}function ri(t){return Math.round(t||0)}function Al(t,e){return e&&(t.cacheChanged=t.cacheChanged||!!e.cacheChanged,e.styleChanged&&e.laneId!=null&&t.styleLaneIds.add(String(e.laneId))),t}function Uo(t,e){if(!Number.isFinite(t))throw new Error(`Lane index must be a finite number. Received: ${t}`);return e<=1?0:Math.min(Math.max(Math.trunc(t),0),e-1)}m.prototype._getDefaultLaneId=function(){const t=this.options&&this.options.lane?this.options.lane:{};return t.defaultId!=null?t.defaultId:"default"},m.prototype._isLaneLayoutActive=function(){if(!Array.isArray(this.lanes)||this.lanes.length===0)return!1;if(this.lanes.length!==1)return!0;const t=this.lanes[0];return!(t&&t.isImplicit&&de(t.id,this._getDefaultLaneId())&&!this._hasExplicitLanes)},m.prototype.getLaneById=function(t){for(let e=0;e<this.lanes.length;e++){const i=this.lanes[e];if(de(i.id,t))return i}},m.prototype._resolveLaneReference=function(t){if(t instanceof et||t&&typeof t=="object"&&t.owner){if(t.owner===this){const e=this.lanes.indexOf(t);if(e>=0)return this.lanes[e]}throw new Error(`Lane "${t.id}" does not belong to this timeline`)}if(t!=null&&t!==""){const e=this.getLaneById(t);if(e)return e}throw new Error(`Lane "${t}" does not exist on this timeline`)},m.prototype._getLanePublicIndex=function(t){const e=this.lanes.indexOf(t);if(e<0)throw new Error(`Lane "${t&&t.id}" does not belong to this timeline`);return e},m.prototype._getInternalLaneIndexFromPublicIndex=function(t,e=this.lanes.length){return Uo(t,e)},m.prototype._handleLaneChange=function({requestRedraw:t=!1,refreshOrder:e=!0}={}){e&&this._refreshLaneOrder(),this._markLaneDomDirty(),t&&this.requestRedraw()},m.prototype._createImplicitLane=function(t){const e=t!=null&&t!==""?t:this._getDefaultLaneId(),i=this.getLaneById(e);if(i)return i;const n=new et(this,e);return n.setupByReceivedData({id:e},{implicit:!0}),this.lanes.push(n),this._handleLaneChange(),n},m.prototype._resolveLaneIdFromArticleData=function(t){const e=t?I(t,"lane"):void 0;return e!=null&&e!==""?e:this._getDefaultLaneId()},m.prototype._assignArticleToLane=function(t,e){const i=this._createImplicitLane(e);return t.laneId=i.id,t.laneOrder=i.order||0,i},m.prototype._refreshLaneOrder=function(){for(let t=0;t<this.lanes.length;t++)this.lanes[t].order=t;for(let t=0;t<this.articles.length;t++){const e=this.articles[t],i=this.getLaneById(e.laneId);e.laneOrder=i?i.order:0}this._hasExplicitLanes=this.lanes.some(t=>!t.isImplicit)},m.prototype._handleLaneIdChange=function(t,e){for(let i=0;i<this.articles.length;i++){const n=this.articles[i];de(n.laneId,e)&&(n.laneId=t.id,n.data&&I(n.data,"lane")!=null&&(n.data.lane=t.id))}for(let i=0;i<this.charts.length;i++){const n=this.charts[i];de(n.laneId,e)&&(n.laneId=t.id,n.data&&n.data.lane!=null&&(n.data.lane=t.id))}this._markLaneDomDirty()},m.prototype._refreshArticlesForLane=function(t,{refreshStyles:e=!0}={}){if(e)for(let i=0;i<this.articles.length;i++){const n=this.articles[i];!n.isDataLoaded||!de(n.laneId,t.id)||(n.initialiseStyles(n.data),n.invalidateCaches())}},m.prototype._refreshAllLaneArticleStyles=function(){this.forLoadedArticles(t=>{t.initialiseStyles(t.data),t.invalidateCaches()})},m.prototype._refreshLaneArticleStylesByIds=function(t){!t||t.size===0||this.forLoadedArticles(e=>{t.has(String(e.laneId))&&(e.initialiseStyles(e.data),e.invalidateCaches())})},m.prototype._refreshResolvedLanesFromOptions=function({articleStyleScope:t=null}={}){for(let e=0;e<this.lanes.length;e++)this.lanes[e]._resolveFromData();this._handleLaneChange(),t==="all"?this._refreshAllLaneArticleStyles():t instanceof Set&&this._refreshLaneArticleStylesByIds(t)},m.prototype.loadLanes=function(t){this.addLanes(t),this.requestRedraw()},m.prototype.addLanes=function(t,{suppressArticleRefresh:e=!1}={}){var n,o;if(!Array.isArray(t)||t.length===0)return{cacheChanged:!1,styleLaneIds:new Set};const i={cacheChanged:!1,styleLaneIds:new Set};for(let s=0;s<t.length;s++){const r=t[s]||{},a=r.id!=null?r.id:this._getDefaultLaneId(),l=this.getLaneById(a);if(l){const h=l._applyOption(D({},r,{id:a}),{suppressRedraw:!0,markExplicit:!0,suppressArticleRefresh:e});Al(i,{cacheChanged:(n=h==null?void 0:h.articleImpact)==null?void 0:n.cacheChanged,styleChanged:(o=h==null?void 0:h.articleImpact)==null?void 0:o.styleChanged,laneId:h==null?void 0:h.laneId});continue}const c=new et(this,a);c.setupByReceivedData(D({},r,{id:a}),{implicit:!1}),this.lanes.push(c)}return this._handleLaneChange(),i},m.prototype.moveLaneToIndex=function(t,e){const i=this._resolveLaneReference(t),n=this._getLanePublicIndex(i),o=Uo(e,this.lanes.length);if(n===o)return i;const s=this._getInternalLaneIndexFromPublicIndex(n),r=this._getInternalLaneIndexFromPublicIndex(o),a=this.lanes.splice(s,1)[0];return this.lanes.splice(r,0,a),this._handleLaneChange({requestRedraw:!0}),a},m.prototype.moveLaneBefore=function(t,e){const i=this._resolveLaneReference(t),n=this._resolveLaneReference(e);if(i===n)return i;const o=this._getLanePublicIndex(i),s=this._getLanePublicIndex(n),r=o<s?s-1:s;return this.moveLaneToIndex(i,r)},m.prototype.moveLaneAfter=function(t,e){const i=this._resolveLaneReference(t),n=this._resolveLaneReference(e);if(i===n)return i;const o=this._getLanePublicIndex(i),s=this._getLanePublicIndex(n),r=o<s?s:s+1;return this.moveLaneToIndex(i,r)},m.prototype.moveLaneUp=function(t){const e=this._resolveLaneReference(t);return this.moveLaneToIndex(e,e.order+1)},m.prototype.moveLaneDown=function(t){const e=this._resolveLaneReference(t);return this.moveLaneToIndex(e,e.order-1)},m.prototype.loadLaneArticles=function(t,e){const i=t!=null&&t!==""?t:this._getDefaultLaneId(),o=(Array.isArray(e)?e:[]).map(s=>{const r=D({},s),a=I(s,"lane");return a!=null&&a!==""&&!de(a,i)&&W.warn("loadLaneArticles overriding conflicting article.lane value",{articleId:I(s,"id"),from:a,to:i}),r.lane=i,r});this._createImplicitLane(i),this.load(o)},m.prototype._getActiveLanesForLayout=function(){if(!Array.isArray(this.lanes)||this.lanes.length===0)return[];const t=[];for(let e=0;e<this.lanes.length;e++){const i=this.lanes[e];i.currentVisibility=i.visibility,i.currentVisibility!=="hidden"?t.push(i):i.geometry=null}return t},m.prototype._updateLaneLayout=function(){var y,v,w;const t=this._getActiveLanesForLayout();if(!this._isLaneLayoutActive()||t.length===0){for(let S=0;S<this.lanes.length;S++)this.lanes[S].geometry=null;return}const e=this.options.lane||{},i=typeof e.gap=="number"?e.gap:0,n=typeof e.topGap=="number"?e.topGap:0,o=typeof e.axisGap=="number"?e.axisGap:0,s=this.top-this.options.style.mainLine.size/2-o,r=i*Math.max(t.length-1,0),a=s-n-r,l=t.map(S=>Ml(S));let c=0,h=0;for(let S=0;S<l.length;S++){const _=l[S];_.explicitHeight!=null?c+=_.explicitHeight:h+=_.heightWeight}const u=Math.max(0,a-c),d=this.getWidth(),f=ri(s),g=h>0;let p=n;for(let S=t.length-1;S>=0;S--){const _=t[S],L=l[S],P=L.explicitHeight!=null?L.explicitHeight:h>0?u*L.heightWeight/h:0,T=ri(p),C=p+P,A=S===0&&g?f:ri(C),k=Math.max(0,A-T),O=T+k,x=((y=_.layout.header)==null?void 0:y.padding)||{},Y=((v=_.layout.header)==null?void 0:v.visible)!==!1&&typeof((w=_.layout.header)==null?void 0:w.height)=="number"?ri(_.layout.header.height):0,G=T+Y,Q=O;_.geometry={top:T,left:0,width:d,height:k,bottom:O,headerTop:T,headerHeight:Y,headerBottom:G,bodyTop:G,bodyBottom:Q,bodyLeft:0,bodyRight:d,bodyContentTop:G,bodyContentBottom:Q,bodyContentLeft:0,bodyContentRight:d,headerPadding:x},p=C+i}},m.prototype._isArticleLaneVisible=function(t){const e=this.getLaneById(t.laneId);return!e||!this._isLaneLayoutActive()?!0:e.currentVisibility!=="hidden"};function Oe(t){return t!=null&&t!==""}function Go(t){return Oe(t==null?void 0:t.lane)?t.lane:null}function jo(t,e){return Oe(e)?e:t._getDefaultLaneId()}m.prototype.getChartById=function(t){for(let e=0;e<this.charts.length;e++){const i=this.charts[e];if(i.id===t)return i}},m.prototype.loadCharts=function(t){this.addCharts(t),this.requestRedraw()},m.prototype.removeChart=function(t){for(let e=0;e<this.charts.length;e++)if(this.charts[e].id===t)return this.charts.splice(e,1),this.requestRedraw(),!0;return!1},m.prototype.clearCharts=function(){!Array.isArray(this.charts)||this.charts.length===0||(this.charts=[],this.requestRedraw())},m.prototype.loadLaneCharts=function(t,e){const i=jo(this,t),o=(Array.isArray(e)?e:[]).map(s=>{const r=D({},s),a=Go(s);return a!=null&&a!==i&&W.warn("loadLaneCharts overriding conflicting chart.lane value",{chartId:s==null?void 0:s.id,from:a,to:i}),r.lane=i,r});this.addCharts(o),this.requestRedraw()},m.prototype.addCharts=function(t){if(!Array.isArray(t)||t.length===0)return;const e=this.charts.map(i=>i.id);for(let i=0;i<t.length;i++){const n=t[i]||{};if(n.id==null){W.warn("Skipping chart without id",n);continue}if(e.indexOf(n.id)!==-1){W.warn("Skipping chart with duplicate id",{chartId:n.id,chart:n});continue}const o=Go(n);o!=null&&this._ensureChartLane(o);const s=new rt(this,n.id);s.setupByReceivedData(n),Oe(s.laneId)&&this._ensureChartLane(s.laneId),this.charts.push(s),e.push(s.id)}this._refreshLaneOrder(),this._updateLaneLayout()},m.prototype._ensureChartLane=function(t){const e=jo(this,t),i=this.getLaneById(e);return i&&!i.isImplicit?i:(typeof this.addLanes=="function"&&this.addLanes([{id:e}],{suppressArticleRefresh:!0}),this.getLaneById(e))},m.prototype._isChartLaneVisible=function(t){if(!Oe(t.laneId))return!0;const e=this.getLaneById(t.laneId);return e?this._isLaneLayoutActive()?e.currentVisibility!=="hidden":!0:!1},m.prototype._getVisibleCharts=function(){return!this.charts||this.charts.length===0?[]:this.charts.filter(t=>t.isDataLoaded&&t.visibility!=="hidden"&&this._isChartLaneVisible(t))},m.prototype._getChartGeometry=function(t,e){if(Oe(t.laneId)){const l=this.getLaneById(t.laneId),c=l&&l.geometry?l.geometry:null;return c?{left:c.bodyContentLeft,right:c.bodyContentRight,top:c.bodyContentTop,bottom:c.bodyContentBottom,width:c.bodyContentRight-c.bodyContentLeft,height:c.bodyContentBottom-c.bodyContentTop,lane:l}:null}const i=this.options.chart||{},n=t.area||i.area,o={up:this.top,down:0},{up:s,height:r}=Ci(n,{anchorY:this.top,canvasHeight:this.options.height,fallbackArea:o});if(r<=0)return null;const a=this.top-s;return{left:0,right:e,top:a,bottom:a+r,width:e,height:r}},m.prototype.drawCharts=function(t,e,i,n){if(!(this.options.chart||{}).visible)return;const s=this._getVisibleCharts();if(s.length!==0){t.save();for(let r=0;r<s.length;r++){const a=s[r],l=this._getChartGeometry(a,i);!l||l.width<=0||l.height<=0||a.draw(t,l,n)}t.restore()}};const Il=M.prototype.headerOverlapsWith;m.prototype._getLaneRowSpacing=function(t,e){const i=this._getLaneAutoStackingOptions(t),n=Array.isArray(e)?e.length:e;if(!t||!i.fitToHeight||n<=1||!t.geometry)return i.rowSpacing;const o=Number(oe(i.topGap,this))||0,s=t.geometry.bodyContentBottom-this._getLaneDistanceToBaseline(t),r=t.geometry.bodyContentTop+o,a=Math.max(0,s-r);return Math.max(Math.round(a/(n-1)),1)},m.prototype.updateArticleLines=function(){const t=this,e=this.options.article.periodLine||{},i=this._isLaneLayoutActive()&&e.position==="lane";function n(l){const c=[];return t.forVisibleArticles(function(h){h.hidePeriodLine||(c.push(h),c[c.length-1].stacking=-1)}),c.sort(t.options.article.periodLine.stacking.sorter),t.options.article.periodLine.stacking.reverseOrder&&c.reverse(),c}function o(l,c){for(let h=0;h<c.length;h++)if(l.overlaps(c[h]))return!1;return!0}function s(l){let c=0;const h=[];let u;do{h[c]=[],u=!1;for(let d=0;d<l.length;d++){const f=l[d];f.stacking>=0||o(f,h[c])&&(h[c].push(f),f.stacking=c,u=!0)}c++}while(u)}const r=n(this.articles);if(!i){s(r);return}const a=new Map;for(let l=0;l<r.length;l++){const c=r[l],h=String(c.laneId),u=a.get(h)||[];u.push(c),a.set(h,u)}a.forEach(l=>{s(l)})},m.prototype.stack=function(t){if(this.articles.length===0||!this.options.article.autoStacking.active)return;function e(h){let u;const d=[],f=[];for(let g=0;g<h.length;g++){const p=h[g];p.isDataLoaded&&p.isInRange&&p.isVisibleInGroup&&!p.isHiddenByFilter&&(p.isActive?u=p:p.isStarred?d.push(p):f.push(p))}return d.sort(Ze),f.sort(Ze),[].concat(u||[],d,f)}function i(h,u){const d=r.get(u);for(let f=0;f<h.length;f++){const g=h[f];if(u.headerOverlapsWith===Il?u.headerOverlapsWith(g,d,r.get(g)):u.headerOverlapsWith(g))return!1}return!0}function n(h,u){for(let d=0;d<h.length;d++)if(i(h[d],u))return d;return h.length}function o(h,u){const d=n(h,u);return d>=h.length&&(h[d]=[]),h[d].push(u),!0}const s=e(this.articles),r=new Map(s.map(h=>[h,h.getWidth()]));if(this._isLaneLayoutActive()){const h=new Map;for(let d=0;d<s.length;d++){const f=s[d],g=this.getLaneById(f.laneId),p=this._getLaneAutoStackingOptions(g),y=String(f.laneId),v=h.get(y)||[];p.active===!1?(v[0]||(v[0]=[]),v[0].push(f),f.isVisibleInRows=!0):f.isVisibleInRows=o(v,f),h.set(y,v)}this.topRow=0,h.forEach((d,f)=>{const g=this.getLaneById(f),p=this._getLaneAutoStackingOptions(g),y=p.active===!1?0:this._getLaneRowSpacing(g,d);g&&(g.topRow=0);for(let v=0;v<d.length;v++)for(let w=0;w<d[v].length;w++){const S=d[v][w],_=p.active===!1;_||(S.finalOffset={left:0,top:v*-y}),S.row=_?0:v,g&&(g.topRow=Math.max(g.topRow,S.row)),S.isInView&&(this.topRow=Math.max(this.topRow,S.row)),_||this.reposition(S,t)}});const u=this.getActiveArticle();this.articles.sort(mi),u&&this.bringFront(u.id);return}const a=this.options.article.autoStacking.rowSpacing,l=[];for(let h=0;h<s.length;h++)s[h].isVisibleInRows=o(l,s[h]);this.topRow=0;for(let h=0;h<l.length;h++)for(let u=0;u<l[h].length;u++){const d=l[h][u];d.finalOffset={left:0,top:h*-a},d.row=h,d.isInView&&(this.topRow=Math.max(this.topRow,h)),this.reposition(d,t)}const c=this.getActiveArticle();this.articles.sort(mi),c&&this.bringFront(c.id)},m.prototype.notifyEventSpacingChanged=function(){this.requestRedraw(this.defaultRedraw)};const Xo=.001,Cl=120,Pl=1e3/60,qo=120,Dl=24,Tl=1e-7,$o=[.25,1/3,.5,.67,.75,.8,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4,5];function Ol(t,e="discrete"){let i=0;if("deltaY"in t&&typeof t.deltaY=="number"&&t.deltaY!==0?i=-t.deltaY:"wheelDelta"in t&&typeof t.wheelDelta=="number"&&t.wheelDelta!==0?i=t.wheelDelta:"detail"in t&&typeof t.detail=="number"&&t.detail!==0&&(i=-t.detail),e==="discrete")return i>0?1:-1;const n=i/120;return n===0?0:n}function Ko(t,e){const i=Math.max(1,Math.abs(e)*.015);return Math.abs(t-e)<=i}function Jo(t){const e=Math.abs(t);if(e<Dl)return!1;for(let i=0;i<$o.length;i++){const n=$o[i];if(Ko(e,qo*n)||Ko(e,qo/n))return!0}return!1}function Rl(t){return!!(t.deltaMode===1||typeof t.deltaY=="number"&&Jo(t.deltaY)||"wheelDelta"in t&&typeof t.wheelDelta=="number"&&Jo(t.wheelDelta))}function kl(t,e){const i=t.discreteWheelAnimation;return i!=null&&i.active?e:!1}function xl(t,e){return e&&Number.isFinite(t.animation.wheelZoomTarget)?t.animation.wheelZoomTarget:t.timescaleManager.zoom}function Qo(t,e){let i=e;return i>t.maximum&&(i=t.maximum),i<t.minimum&&(i=t.minimum),i}function Nl(t,e){var n;const i=((n=t.discreteWheelAnimation)==null?void 0:n.duration)||250;return i<=0?1:1-Math.pow(.05,Math.max(e,0)/i)}function ts(t){t.wheelZoomTarget=null,t.wheelZoomPivotPoint=null,t.wheelZoomPivotPixel=null,t.wheelZoomLastFrameTime=null,t.wheelZoomFrame=null}function El(t){t._wheelZoomStateChangeTimer!=null&&clearTimeout(t._wheelZoomStateChangeTimer),t._wheelZoomStateChangeTimer=setTimeout(()=>{var e;t._wheelZoomStateChangeTimer=null,(e=t._flushTimelineStateChange)==null||e.call(t)},Cl)}m.prototype.enableZoomByWheel=function(){this._wheelEnabled||(this._wheelEnabled=!0,this._wheelHandler=e=>{const{allowCtrlWheel:i=!1,wheelMode:n="auto"}=this.options.zoom||{};if(!i&&e.ctrlKey)return;const s=Ol(e,n==="discrete"?"discrete":"proportional");this.onWheel(e,s)},this.canvas.addEventListener("wheel",this._wheelHandler,{passive:!1}),this.canvas.addEventListener("DOMMouseScroll",this._wheelHandler,{passive:!1}))},m.prototype.disableZoomByWheel=function(){this._wheelEnabled&&(this.canvas.removeEventListener("wheel",this._wheelHandler),this.canvas.removeEventListener("DOMMouseScroll",this._wheelHandler),this._wheelEnabled=!1,this._wheelHandler=null)},m.prototype.onWheel=function(e,i){const{wheelSpeed:n,wheelStep:o,maximum:s,minimum:r,proportionalGain:a,proportionalExponent:l,wheelMode:c}=this.options.zoom,h=c!=="discrete",u=Rl(e);if(h&&!u){const S=Math.sign(i)||1;let _=Math.abs(i);_>=1&&l&&l!==1&&(_=Math.pow(_,l)),_*=a,i=S*_}else h&&u&&(i=i>0?1:-1);const d=kl(this.options.zoom,u);let f=xl(this,d)+-i*n*o;f=Qo({maximum:s,minimum:r},f);let g,p;if(e.target===this.canvas&&"offsetX"in e&&typeof e.offsetX=="number")g=e.offsetX,p=e.offsetY;else{const S=this.canvas.getBoundingClientRect();g=e.clientX-S.left,p=e.clientY-S.top}const y=this.timescaleManager.zoom;d?this.animateZoomByPivotPoint(f,this.getPivotPoint(g),g):(this.stopPanAnimation(),this.stopZoomAnimation(),this.setZoomByPivotPixel(f,g),El(this));const v=this.timescaleManager.zoom,w=f-y;this.requestRedraw(),e.preventDefault(),this.trigger("zoom-wheel",el({centre:{x:g,y:p},zoom:d?f:v,zoomDelta:w}),e)},m.prototype.animateZoomByPivotPoint=function(e,i,n){if(this.stopPanAnimation(),this.animation.wheelZoomFrame==null&&this.stopZoomAnimation(),this.animation.wheelZoomTarget=Qo(this.options.zoom,e),this.animation.wheelZoomPivotPoint=i,this.animation.wheelZoomPivotPixel=n,this.animation.wheelZoomFrame!=null)return;const o=this;function s(r){var y;const a=o.animation.wheelZoomTarget;if(!Number.isFinite(a)){ts(o.animation);return}const l=o.timescaleManager.zoom,c=a-l,h=o.animation.wheelZoomPivotPoint,u=o.animation.wheelZoomPivotPixel;if(Math.abs(c)<=Xo){o.setZoomByPivotPoint(a,h,u),o.requestRedraw(),ts(o.animation),(y=o._flushTimelineStateChange)==null||y.call(o);return}const d=o.animation.wheelZoomLastFrameTime,f=d==null?Pl:r-d;o.animation.wheelZoomLastFrameTime=r;const g=Nl(o.options.zoom,f),p=l+c*g;o.setZoomByPivotPoint(p,h,u),Math.abs(o.timescaleManager.zoom-p)>Xo&&(o.animation.wheelZoomTarget=o.timescaleManager.zoom),o.requestRedraw(o.repositionRedraw),o.animation.wheelZoomFrame=requestAnimationFrame(s)}this.animation.wheelZoomFrame=requestAnimationFrame(s)},m.prototype.setZoom=function(e,i,n=0){var r,a,l;(r=this.stopPanAnimation)==null||r.call(this),(a=this.stopZoomAnimation)==null||a.call(this);const o=i==null?this.width/2:i,s=n?Math.round(n):0;this.setZoomByPivotPixel(e,o,s),this.requestRedraw(),(l=this._flushTimelineStateChange)==null||l.call(this)},m.prototype.setZoomByPivotPixel=function(e,i,n=0){this.setZoomByPivotPoint(e,this.getPivotPoint(i),i,n)},m.prototype.setZoomByPivotPoint=function(e,i,n,o=0){this.timescaleManager.setZoom(e);const s=this.timescaleManager.setStartDate(i.date),r=Number.isFinite(i.millisecondFraction)?i.millisecondFraction*ft(this)/j:i.fraction;this.repositionWindow=s-r,this.updateFromByPixels(-n+o),It(this,{mode:this.isDragging||this.isPinching?"elastic":"clamp"})},m.prototype.getPivotPoint=function(e){let i=this.timescaleManager.getStartTokenCloned(),n=this.repositionWindow;n>=0&&(i=this.timescaleManager.getPrevious(i),n-=i.length);let o=i;for(;n<=e;)n+=i.length,o=i,i=this.timescaleManager.getNext(i);const s=o.unit,r=o.length;let a=e-(n-i.length);const l=o.value;let{year:c,month:h,day:u}=l;if(s<=V){const d=ft(this)/j;let f=d>0?a/d:0;const g=Math.round(f);Math.abs(f-g)<Tl&&(f=g);const p=Math.floor(f),y=f-p;return o.value=o.value.addMilliseconds(p),a-=p*d,{date:o.value,fraction:a,millisecondFraction:y}}else if(s===$)u=Math.floor(a/r*30.44)+1,a-=(u-1)*r/30.44,o.value=new b(c,h,u);else if(s!==V){const d=this.timescaleManager.unitLengthInYears;let f=Math.floor(a*365.2422*d/r)+1,g=0;f>365&&(g=Math.floor(f/365),f=f-365*g),a=0,o.value=b.getByDayOfYear(c+g,f)}return{date:o.value,fraction:a}},m.prototype.startAnimation=function(t){this.isAnimating||(this.isAnimating=!0,this.animation.redrawFunction=t,this.drawAnimationFrame())},m.prototype.stopAnimation=function(){var t;this.isAnimating=!1,this.animation.dragRedrawFunction=this.repositionRedraw,this.animation.redrawFunction=!1,(t=this._flushTimelineStateChange)==null||t.call(this)},m.prototype.areAnimationsFinished=function(){return!(this.isDragging||this.isPanning||this.isPinching||this._pinchPanHandoff||this.pinchMomentum||this.animation.pinchZoom||this.draggingArticle!==null||this.isAnimatingArticles||this.isCustomAnimating)},m.prototype.drawAnimationFrame=function(){if(this.areAnimationsFinished())return this.stopAnimation();const t=this;requestAnimationFrame(function(e){const i=t.getAnimationRedrawFunction();t.updateRedrawRequests(i),i.call(t),t.drawAnimationFrame()})},m.prototype.requestRedraw=function(t){t=t||this.defaultRedraw;const e=this;if(!this.isAnimating)return t.call(e);t===this.defaultRedraw&&(this.redrawRequests.default=!0),t===this.repositionRedraw&&(this.redrawRequests.reposition=!0)},m.prototype.updateRedrawRequests=function(t){t===this.defaultRedraw&&(this.redrawRequests.default=!1,this.redrawRequests.reposition=!1),t===this.repositionRedraw&&(this.redrawRequests.reposition=!1)},m.prototype.getAnimationRedrawFunction=function(){return this.isPinching||this.animation.pinchZoom?this.defaultRedraw:this.isDragging?this.animation.dragRedrawFunction:this.isPanning?this.defaultRedraw:this.redrawRequests.default?this.defaultRedraw:this.redrawRequests.reposition?this.repositionRedraw:this.animation.redrawFunction||this.animation.defaultRedrawFunction},m.prototype.stopPanAnimation=function(){var t;le(this),(t=this.animation.pan)==null||t.stop(),this.animation.pan=null,this.isPanning=!1},m.prototype.stopZoomAnimation=function(){var t;le(this),Ct(this),this.pinchMomentum=null,(t=this.animation.zoom)==null||t.stop(),this.animation.zoom=null,this.animation.wheelZoomFrame!=null&&cancelAnimationFrame(this.animation.wheelZoomFrame),this._wheelZoomStateChangeTimer!=null&&(clearTimeout(this._wheelZoomStateChangeTimer),this._wheelZoomStateChangeTimer=null),this.animation.wheelZoomTarget=null,this.animation.wheelZoomPivotPoint=null,this.animation.wheelZoomPivotPixel=null,this.animation.wheelZoomLastFrameTime=null,this.animation.wheelZoomFrame=null},m.prototype.switchToPositiveRepositionWindow=function(){if(this.repositionWindow<0){let t=this.timescaleManager.startToken;this.repositionWindow=t.length+this.repositionWindow,t=this.timescaleManager.getNext(t),this.timescaleManager.setStartToken(t)}},m.prototype.zoomToAnim=function(t,e){if(typeof t=="number"&&!Number.isFinite(t))return;this.stopPanAnimation(),this.stopZoomAnimation();const i=he(this,e),n=this.timescaleManager.zoom;if(Te(this.timescaleManager,t)===n&&!At(this)){lt(this,i);return}const o=2e3,s=H.swing,r=this,a=Z({from:n,to:t,duration:o,easing:s,onUpdate(l){r.setZoomByPivotPixel(l,r.width/2),r.requestRedraw()},onComplete(){var l;r.animation.zoom=null,(l=r._flushTimelineStateChange)==null||l.call(r),lt(r,i)}});this.animation.zoom=Qe(this,i,a)},m.prototype.goToPixelAnim=function(t,e={}){var c;if(!Number.isFinite(t))return;this.stopPanAnimation(),this.stopZoomAnimation();const i=he(this,Ht(e));if(Oo(this,t)){lt(this,i);return}const n=1e8;let o=!1;Math.abs(t)>n&&(t=Math.sign(t)*n,o=!0);const s=()=>{o&&e.targetDmy&&(this.repositionWindow=this.timescaleManager.setStartDate(e.targetDmy),It(this),this.requestRedraw(),this._emitTimelineStateChange()),this.isPanning=!1,this.animation.pan=null,lt(this,i)};if(e.duration===0){Pe(this,()=>{this.updateFromByPixels(t),this.requestRedraw(),s()});return}this.isPanning=!0,this.startAnimation();let r=0;const a=this,l=Z({from:0,to:t,duration:(c=e.duration)!=null?c:2e3,easing:H[e.easing]||H.swing,onUpdate(h){const u=h-r;r=h,a.updateFromByPixels(u),a.isPinching?a.stopPanAnimation():a.requestRedraw()},onComplete:s});this.animation.pan=Qe(this,i,l)},m.prototype.goToDateAnim=function(t,e={}){var i;W.warn("DEPRECATION WARNING: timeline.goToDateAnim(dmy, options) is deprecated. Use timeline.setStartDate(dmy, { padding, animation: { active: true, ... } }) instead."),this.setStartDate(t,{padding:(i=e.offsetX)!=null?i:0,onComplete:e.onComplete,animation:{active:!0,duration:e.duration,easing:e.easing,complete:e.complete}})},m.prototype.repositionWithAnim=function(t){const e=this.getOriginalPosition(t);t.registeredPosition=e;const i={left:e.left+t.dragFinishOffset.left,top:e.top+t.dragFinishOffset.top};t.moveToWithAnim(i)},m.prototype.notifyArticleAnimating=function(t,e){const i=new Date().getTime(),n=this.options.article.animation[t].duration,o=i+n;o>this.lastAnimatingArticle.endTime&&(this.lastAnimatingArticle.id=e,this.lastAnimatingArticle.endTime=o,this.lastAnimatingArticle.animationType=t),this.isAnimatingArticles=!0,this.startAnimation()},m.prototype.toggleAutoFit=function(){const t=this.options.article.autoStacking.fitToHeight=!this.options.article.autoStacking.fitToHeight;return t&&this.fitToHeight(!0),t},m.prototype.fitToHeight=function(t){if(this.topRow+1===1)return;const i=this.options.article.autoStacking.rowSpacing=this.getFitToHeightRowSpacing();return t&&this.requestRedraw(),i},m.prototype.getFitToHeightRowSpacing=function(){const t=this.top-this._getTimelineDistanceToBaseline(),e=this._getResolvedArticleTopGap(),i=this.topRow;if(i===0)return!1;const n=Math.abs(t-e);return Math.max(Math.round(n/i),1)},m.prototype.incrementRowSpacing=function(t,e){return this.options.article.rowSpacing=Math.max(this.options.article.rowSpacing+t,1),e&&this.requestRedraw(),this.options.article.rowSpacing};function zl(t){return typeof t=="number"?(W.warn("DEPRECATION WARNING: timeline.setStartDate(date, pixelOffset) is deprecated. Use timeline.setStartDate(date, { padding }) instead."),{padding:t}):t||{}}function Fl(t,e,i,n){t.switchToPositiveRepositionWindow();const o=t.timescaleManager.startToken.value,s=t.repositionWindow-t.timescaleManager.getPixelsBetween(e,o)-i;t.goToPixelAnim(s,ot(N({},n),{targetDmy:e}))}m.prototype.setStartDate=function(t,e){var s,r;const i=zl(e),n=i.padding||0;if(t=this.getDmyFromInput(ti(t)),(s=i.animation)!=null&&s.active){Fl(this,t,n,ot(N({},i.animation),{onComplete:Ht(i,i.animation.complete)}));return}ei(this);const o=he(this,Ht(i,(r=i.animation)==null?void 0:r.complete));Pe(this,()=>{const a=this.timescaleManager.setStartDate(t);this.repositionWindow=a,n&&this.updateFromByPixels(-n),It(this),this.requestRedraw(),this._emitTimelineStateChange()}),lt(this,o)},m.prototype.getZoom=function(){return this.timescaleManager.zoom},m.prototype.setCentreDate=function(t,e){this.setStartDate(t,{padding:this.getWidth()/2+(e||0)})};function Xi(t,e,i,n={}){var a,l;const o=So(n.padding),s=Ba(t,e,i,o);if((a=n.animation)!=null&&a.active){Ga(t,e,i,s,o,ot(N({},n.animation),{onComplete:Ht(n,n.animation.complete)}));return}ei(t);const r=he(t,Ht(n,(l=n.animation)==null?void 0:l.complete));Pe(t,()=>{s!==t.timescaleManager.zoom&&t.timescaleManager.setZoom(s),!r.cancelled&&Fi(t,e,o.left,!0)}),lt(t,r)}m.prototype.fitDateRange=function(e,i,n={}){let o=Lo(e),s=Lo(i);o.start.compare(s.start)>0&&([o,s]=[s,o]),Xi(this,this.getDmyFromInput(o.start),this.getDmyFromInput(s.end),n)},m.prototype.settleDateBounds=function(e={}){let i=At(this);if(!i)return!1;i.type==="range"&&i.zoom===this.timescaleManager.zoom&&(i=At(this,void 0,{mode:"elastic"})||i),ei(this);const n=he(this,Ht(e)),o=()=>{Pe(this,()=>{It(this,{mode:"clamp"}),this.requestRedraw()}),lt(this,n)};if(e.animate===!1||i.type==="range")return o(),!0;const s=ft(this);if(!s)return o(),!0;const r=i.type==="min"?i.overflowDays*s:-i.overflowDays*s;if(!Number.isFinite(r)||r===0)return o(),!0;this.isPanning=!0,this.startAnimation();let a=0;const l=300,c=H.swing,h=this,u=Z({from:0,to:r,duration:l,easing:c,onUpdate(d){const f=d-a;a=d,h.updateFromByPixels(f,{skipDateBounds:!0}),h.requestRedraw()},onComplete(){h.isPanning=!1,h.animation.pan===u&&(h.animation.pan=null),It(h,{mode:"clamp"}),h.requestRedraw(),lt(h,n)}});return this.animation.pan=Qe(this,n,u),!0},m.prototype.fitArticleRange=function(e,i={}){var n;return!((n=e==null?void 0:e.period)!=null&&n.from)||!e.period.to?!1:(Xi(this,e.period.from,e.period.to,{padding:i.padding,animation:i.animation,onComplete:i.onComplete}),!0)},m.prototype.fitArticles=function(e={}){var r;const i=e.articleFilter||function(l){return!l.hiddenByFilter},n=ja(this,i);if(!n)return!1;const o=So((r=e.padding)!=null?r:40),s={left:o.left+n.maxCardLeftOffset,right:o.right+n.maxCardRightOffset};return Xi(this,n.earliest,n.latest,{padding:s,animation:e.animation,onComplete:e.onComplete}),!0},m.prototype.on=function(t,e){if(typeof t=="object")return this.onMultiple(t);this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(e)},m.prototype.trigger=function(t,...e){if(!this.handlers[t])return;const i=this.handlers[t];for(let n=0;n<i.length;n++)i[n].call(this,...e)},m.prototype.onMultiple=function(t){for(const e in t)this.on(e,t[e])},m.prototype.off=function(t,e){if(typeof t=="object")return this.offMultiple(t);this.handlers[t]&&(this.handlers[t]=this.handlers[t].filter(i=>i!==e))},m.prototype.offMultiple=function(t){for(const e in t)this.off(e,t[e])};function Re(t){var n,o,s,r,a,l;const e=((o=(n=t.owner)==null?void 0:n.getCanvasDpr)==null?void 0:o.call(n))||1,i=(l=(a=(r=(s=t.owner)==null?void 0:s.options)==null?void 0:r.article)==null?void 0:a.rendering)==null?void 0:l.pixelSnap;return Ln(e,i)}function qi(t){const e=Re(t);return{top:e(t.position.top),left:e(t.position.left)}}function $i(t,e){var i,n,o,s;return Math.max(Ft(t),e.border.width,((n=(i=t.hoverStyle)==null?void 0:i.border)==null?void 0:n.width)||0,((s=(o=t.activeStyle)==null?void 0:o.border)==null?void 0:s.width)||0)}function es(t,e,i){const n=t.getCurrentStyle(),o=t.image;if(n.image.visible===!1||!t.imageLoaded||!(o!=null&&o.width)||!(o!=null&&o.height))return null;const s=yt(n.image.margin),r=s.left+s.right,a=s.top+s.bottom,l=typeof n.height=="number",c=Ft(t),h=Re(t),u=Math.max(0,i-r),d=Math.max(0,Math.min(i-r,h(u))),f=h(c/2+e+s.top),g=l?Math.max(0,Math.min(n.height-c-e-a,n.height-f-s.bottom)):1/0,p=Me(n),y=n.image.shape||"square";let v=0,w=0,S=o.width,_=o.height;const L=y==="square"||y==="circle";L&&(S=_=Math.min(o.width,o.height),v=(o.width-S)/2,w=(o.height-_)/2);const P=d,T=L?P:_*P/S,C=Math.min(T,g,p);return T>C&&(_*=C/T,w=Ve((o.height-_)/2)),P>0&&C>0?{left:s.left,top:f,width:P,height:C,sx:v,sy:w,sw:S,sh:_,space:C+a}:null}const is={name:"portrait",defaultStyle:{height:"auto"},defaultActiveStyle:{subheader:{color:"#333"}},draw(t){var S,_,L,P,T;const e=this.getCurrentStyle(),i=Re(this),n=Ft(this),o=$i(this,e),s=je(this,Math.max(0,i(this._cachedWidth-o)),typeof e.height=="number"?Math.max(0,e.height-n):1/0,t),r=s.header.height,a=s.subheader.height,l=e.height==="auto"&&(!s.header.automatic||!s.subheader.automatic),c=qi(this),h={top:c.top,left:c.left,width:this._cachedWidth,height:this._cachedHeight},u=h.top+n/2,d=u+r,f=d,g=i(d),p=i(u+s.height),y=Es(h,o,i),v=Math.max(0,Math.min(e.topRadius,h.width/2,h.height/2));t.beginPath(),Ii(t,h.left,h.top,h.width,h.height,v),eo(t,e.shadow),t.fillStyle=e.backgroundColor,t.fill(),io(t),t.save(),t.clip(),r!==0&&(t.fillStyle=(S=e.header.color)!=null?S:e.color,t.fillRect(h.left,h.top,h.width,g-h.top)),a!==0&&(t.fillStyle=e.subheader.color,t.fillRect(h.left,g,h.width,p-g),t.beginPath(),t.lineWidth=1,t.moveTo(y.left+5,f+1),t.lineTo(y.left+10,f-5),t.lineTo(y.left+15,f+1),t.closePath(),t.fill()),l&&t.restore(),Xe(t,s.header,e.header.text,y.left,s.header.automatic?u:i(u),y.width,i,Math.max(0,h.height-n),!0),Xe(t,s.subheader,e.subheader.text,y.left,s.subheader.automatic?f:i((s.header.automatic?u:i(u))+r),y.width,i,Math.max(0,h.height-n-r),!0),this.titleLines=s.header.lines,this.summarisedSubtitle=s.subheader.lines.join(" ");const w=es(this,s.height,this._cachedWidth);if(w){l&&(t.save(),t.beginPath(),Ii(t,h.left,h.top,h.width,h.height,v),t.clip());const C=h.left+w.left,A=h.top+w.top,k=[this.image,w.sx,w.sy,w.sw,w.sh,C,A,w.width,w.height];e.image.shape==="circle"&&w.height<w.width?(t.save(),t.beginPath(),t.arc(C+w.width/2,A+w.height/2,w.width/2,0,Math.PI*2),t.closePath(),t.clip(),t.drawImage(...k),t.restore()):e.image.shape==="circle"?oo(t,...k.slice(0,-1)):(t.save(),e.image.borderRadius>0&&(_e(t,C,A,w.width,w.height,Math.min(e.image.borderRadius,w.width/2,w.height/2)),t.clip()),t.drawImage(...k),t.restore()),l&&t.restore()}if(l||t.restore(),e.border.width>0&&(t.beginPath(),Ii(t,h.left,h.top,h.width,h.height,v),t.lineWidth=e.border.width,t.strokeStyle=e.border.color,t.stroke()),((T=(P=(L=(_=this.owner)==null?void 0:_.options)==null?void 0:L.article)==null?void 0:P.star)==null?void 0:T.visible)!==!1&&(this.isActive||this.isStarred)){const C=this.getIconBox(),A=i(C.left+C.width/2),k=i(C.top+C.height/2),O=i(Math.min(C.width,C.height)/2),x=i(O/2);let F,Y;this.isStarred?this.isMouseOverStar?(F="#8A8A8A",Y="#fff800"):(F="#a5a5a5",Y="#fff800"):this.isMouseOverStar?(F="#8A8A8A",Y="#dfdfdf"):(F="#a5a5a5",Y="#ebebeb"),no(t,A,k,5,x,O,Y,F)}},getWidth(){const t=this.getCurrentStyle();return t.width!=="auto"?t.width:Ti(this,Di(this,t.subheader.height!==0),$i(this,t))},getHeight(){const t=this.getCurrentStyle(),e=Re(this);if(typeof t.height=="number")return Math.max(0,t.height);const i=this._cachedWidth,n=t.header.height==="auto"||t.subheader.height==="auto"?je(this,Math.max(0,e(i-$i(this,t)))).height:Math.max(0,t.header.height)+Math.max(0,t.subheader.height),o=Ft(this),s=es(this,n,i);return s?Math.max(n+s.space+o,s.top+s.height+yt(t.image.margin).bottom):n+o},getConnectorEnd(){const t=this.getCurrentStyle(),e=qi(this);return{left:e.left+t.connectorLine.offsetX,top:e.top+this.getHeight()+t.connectorLine.offsetY}},getIconBox(){var a,l,c,h;if(((h=(c=(l=(a=this.owner)==null?void 0:a.options)==null?void 0:l.article)==null?void 0:c.star)==null?void 0:h.visible)===!1)return!1;const t=this.getCurrentStyle(),e=Re(this),i=qi(this),n=this._getWidth(),o=this._cachedHeight,s=Math.max(0,Math.min(t.star.width,n,o)),r={width:s,height:s};return r.left=e(i.left-t.topRadius/4+n-r.width-t.star.margin),r.top=e(i.top+t.topRadius/4+t.star.margin),r.left=Math.min(i.left+n-r.width,Math.max(i.left,r.left)),r.top=Math.min(i.top+o-r.height,Math.max(i.top,r.top)),r}},Ki=220;function ns(t){var e,i;return t.getCurrentStyle().image.visible!==!1&&t.imageLoaded&&((e=t.image)==null?void 0:e.width)>0&&((i=t.image)==null?void 0:i.height)>0}const os={getWidth(){const t=this.getCurrentStyle();if(t.width!=="auto")return t.width;if(!ns(this))return typeof t.height=="number"?Math.max(1,t.height):Math.max(1,Math.min(Ki,Me(t)));if(typeof t.height=="number"){const e=yt(t.image.margin),i=Math.max(0,Math.min(t.height-Ft(this)-e.top-e.bottom,Me(t))),n=t.image.shape==="natural"?this.image.width/this.image.height:1;return Math.max(1,i*n+e.left+e.right)}return Ki},getHeight(){const t=this.getCurrentStyle();return typeof t.height=="number"||ns(this)?is.getHeight.call(this):Math.max(1,Math.min(this._cachedWidth,Me(t)))},defaultStyle:{width:Ki,backgroundColor:"#f0f0f0"}},Bl=[{name:"title-only",extends:"portrait",defaultStyle:{width:220,image:{visible:!1},header:{height:"auto",padding:{top:12,bottom:12},text:{numberOfLines:6,lineHeight:20}},subheader:{height:0}},defaultActiveStyle:{subheader:U}},{name:"title-subtitle",extends:"portrait",defaultStyle:{width:240,image:{visible:!1},header:{height:"auto",padding:{top:10,bottom:10},text:{font:"600 14px 'Segoe UI'",numberOfLines:3,lineHeight:20}},subheader:{height:"auto",padding:{top:8,bottom:10},color:"#f1f5f9",text:{font:"normal 13px 'Segoe UI'",color:"#475569",numberOfLines:4,lineHeight:18}}},defaultActiveStyle:{subheader:{color:U}}},{name:"label",extends:"portrait",defaultStyle:{width:"auto",maxWidth:280,image:{visible:!1},header:{height:"auto",padding:{top:5,bottom:5},text:{numberOfLines:1,margin:8}},subheader:{height:0}},defaultActiveStyle:{subheader:U}},{name:"image-text",extends:"portrait",defaultStyle:{width:220,header:{height:"auto",padding:{top:8,bottom:8},text:{numberOfLines:1}},subheader:{height:"auto",padding:{top:6,bottom:6}}}},ot(N({},os),{name:"image-only",extends:"portrait",defaultStyle:ot(N({},os.defaultStyle),{header:{height:0},subheader:{height:0}}),defaultActiveStyle:{subheader:U}}),{name:"pill",extends:"landscape",defaultStyle:{width:"auto",maxWidth:360,image:{shape:"circle",margin:{top:4,right:0,bottom:4,left:4}},header:{padding:{left:14,right:14},text:{margin:0,numberOfLines:1}},subheader:{padding:{left:14,right:14},text:{margin:0}},borderRadius:36,connectorLine:{offsetX:35,offsetY:-27,arrow:{width:14}}}}],ke=new Map;function Hl(t){return typeof t.getWidth!="function"&&(t.getWidth=function(){return oa(this)}),typeof t.getHeight!="function"&&(t.getHeight=function(){return this.getCurrentStyle().height}),typeof t.getIconBox!="function"&&(t.getIconBox=function(){return!1}),t}function ss(t){return t&&t.aliasOf?ke.get(t.aliasOf):t}return m.registerCardLayout=function(e){if(!e||typeof e!="object")throw new Error("Card layout definition must be an object");const{name:i,aliasOf:n}=e;if(!i||typeof i!="string")throw new Error("Card layout must have a unique string 'name'");const o="extends"in e;if(o&&"aliasOf"in e)throw new Error(`Card layout "${i}" cannot specify both aliasOf and extends`);if(n){ke.set(i,{aliasOf:n});return}let s=N({},e);if(o){const h=e,{extends:u}=h,d=fs(h,["extends"]);if(!u||typeof u!="string")throw new Error(`Card layout "${i}" must specify a non-empty string 'extends'`);if(u===i)throw new Error(`Card layout "${i}" cannot extend itself`);const f=ss(ke.get(u));if(!f||typeof f.draw!="function")throw new Error(`Card layout "${i}" cannot extend "${u}": parent must be registered first and resolve to a concrete layout`);s=N(N({},f),d);for(const g of["defaultStyle","defaultHoverStyle","defaultActiveStyle"])(f[g]||d[g])&&(s[g]=d[g]===U?{}:nt(D({},f[g]),d[g]))}if(typeof s.draw!="function")throw new Error(`Card layout "${i}" must implement draw(ctx)`);ke.set(i,Hl(s));const{defaultStyle:r,defaultHoverStyle:a,defaultActiveStyle:l}=s,c=Se.article.layoutStyles[i]={};r&&(c.style=di({},r)),a&&(c.hoverStyle=di({},a)),l&&(c.activeStyle=di({},l))},m.getCardLayout=function(e){const i=ss(ke.get(e));return i||(W.warn(`Unknown card layout "${e}"`),null)},m.prototype._getCurrentCardLayoutName=function(){return this.options.article.defaultCardLayout},m.prototype.registerCardLayout=m.registerCardLayout,m.prototype.getCardLayout=m.getCardLayout,m.registerCardLayout(is),m.registerCardLayout(aa),Bl.forEach(t=>m.registerCardLayout(t)),m.registerCardLayout({name:"default",aliasOf:"portrait"}),m.prototype.getStatusForSave=function(){const t=this.timescaleManager.startToken.value,e=[],i={};t.hour&&(i.fhr=t.hour),t.minute&&(i.fmi=t.minute),t.second&&(i.fs=t.second),t.millisecond&&(i.fms=t.millisecond);for(let n=0;n<this.articles.length;n++)e.push(this.articles[n].getStatusForSave());return JSON.stringify(ot(N({t:this.title,o:this.ownerId,z:this.timescaleManager.zoom,fy:t.year,fm:t.month,fd:t.day},i),{w:this.repositionWindow,a:e}))},m.prototype._emitTimelineStateChange=function(){this&&this._isInitialized===!0&&(this._hasPendingTimelineStateChange=!1,this.trigger("timeline-state-change",this.getStatusForSave()))},m.prototype._markTimelineStateChanged=function(){this&&this._isInitialized===!0&&(this._hasPendingTimelineStateChange=!0)},m.prototype._flushTimelineStateChange=function(){this&&this._hasPendingTimelineStateChange===!0&&this._emitTimelineStateChange()},ot(N(N({UNSET:U,Timeline:m,Article:M,Chart:rt,Lane:et,TimeBand:pt,Dmy:b},Ds),Vs),{Logger:W,setDebug(t){W.setEnabled(!!t)},isDebugEnabled(){return W.isEnabled()},enableDebug(){W.setEnabled(!0)},disableDebug(){W.setEnabled(!1)}})}));
|