@svar-ui/gantt-store 2.6.1 → 2.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/dist/index.js CHANGED
@@ -1 +1 @@
1
- var $t=new Date().valueOf(),De=()=>$t++;function st(){return"temp://"+$t++}var Pt=class{constructor(t){this._data=t,this._pool=new Map;for(let e=0;e<t.length;e++){const n=t[e];this._pool.set(n.id,n)}}add(t){t={id:De(),...t},this._data.push(t),this._pool.set(t.id,t)}update(t,e){const n=this._data.findIndex(a=>a.id==t),s={...this._data[n],...e};this._data[n]=s,this._pool.set(s.id,s)}remove(t){this._data=this._data.filter(e=>e.id!=t),this._pool.delete(t)}filter(t){this._data=this._data.filter(e=>{const n=t(e);return n||this._pool.delete(e.id),n})}byId(t){return this._pool.get(t)}map(t){return this._data.map(t)}forEach(t){this._data.forEach(t)}},Te=class{constructor(t){const e={id:0,$level:0,data:[],parent:null},n=new Map;n.set(0,e),this._pool=n,t&&t.length&&this.parse(t,0)}parse(t,e){const n=this._pool;for(let a=0;a<t.length;a++){const r=t[a];r.parent=r.parent||e,r.data=null,n.set(r.id,r)}for(let a=0;a<t.length;a++){const r=t[a],i=n.get(r.parent);i&&(i.data||(i.data=[]),i.data.push(r))}const s=n.get(e);this.setLevel(s,s.$level+1,!1)}add(t,e){const n=this._pool.get(t.parent||0);t.$level=n.$level+1,this._pool.set(t.id,t),n.data?e===-1?n.data=[...n.data,t]:Et(n,e,t):n.data=[t]}addAfter(t,e){if(!e)return this.add(t,-1);const n=this.byId(e),s=this.byId(n.parent),a=R(s,n.id)+1;t.parent=s.id,t.$level=s.$level+1,this.add(t,a)}remove(t){const e=this._pool.get(t);this._remove(e);const n=this._pool.get(e.parent);n.data=n.data.filter(s=>s.id!=t),this._clearBranch(n)}_remove(t){t.data&&t.data.forEach(e=>this._remove(e)),this._pool.delete(t.id)}update(t,e){let n=this._pool.get(t);const s=this._pool.get(n.parent),a=R(s,n.id);n={...n,...e},s&&a>=0&&(s.data[a]=n,s.data=[...s.data]),this._pool.set(n.id,n)}move(t,e,n){const s=this._pool.get(t),a=e==="child",r=this._pool.get(n),i=r.$level+(a?1:0);if(!s||!r)return;const o=this._pool.get(s.parent),c=a?r:this._pool.get(r.parent);c.data||(c.data=[]);const d=R(o,s.id);Ie(o,d);const u=a?c.data.length:R(c,r.id)+(e==="after"?1:0);if(Et(c,u,s),o.id===c.id&&d===u)return null;s.parent=c.id,s.$level!==i&&(s.$level=i,this.setLevel(s,i+1,!0)),this.update(s.id,s),this._clearBranch(o)}_clearBranch(t){t.data&&!t.data.length&&(t.open&&delete t.open,this.update(t.id,{data:null}))}toArray(){const t=[],e=this._pool.get(0).data;return e&&Ct(e,t),t}byId(t){return this._pool.get(t)}getBranch(t){return this._pool.get(t).data}forEach(t){this._pool.forEach((e,n)=>{n!==0&&t(e)})}eachChild(t,e){const n=this.byId(e);!n||!n.data||n.data.forEach((s,a)=>{t(this.byId(s.id),a),this.eachChild(t,s.id)})}setLevel(t,e,n){t.data&&(t.data=t.data.map(s=>(n&&(s={...s},this._pool.set(s.id,s)),s.$level=e,s.data&&this.setLevel(s,e+1,n),s)))}};function Ct(t,e){t.forEach(n=>{e.push(n),n.open===!0&&Ct(n.data,e)})}function Ie(t,e){const n=[...t.data];n.splice(e,1),t.data=n}function Et(t,e,n){const s=[...t.data];s.splice(e,0,n),t.data=s}function R(t,e){return t?.data.findIndex(n=>n.id===e)}var Ot=2,We=class{constructor(t){t&&(this._writable=t.writable,this._async=t.async),this._values={},this._state={}}setState(t,e=0){const n={};return this._wrapProperties(t,this._state,this._values,"",n,e),n}getState(){return this._values}getReactive(){return this._state}_wrapProperties(t,e,n,s,a,r){for(const i in t){const o=e[i],c=n[i],d=t[i];if(o&&(c===d&&typeof d!="object"||d instanceof Date&&c instanceof Date&&c.getTime()===d.getTime()))continue;const u=s+(s?".":"")+i;o?(o.__parse(d,u,a,r)&&(n[i]=d),r&Ot?a[u]=o.__trigger:o.__trigger()):(d&&d.__reactive?e[i]=this._wrapNested(d,d,u,a):e[i]=this._wrapWritable(d),n[i]=d),a[u]=a[u]||null}}_wrapNested(t,e,n,s){const a=this._wrapWritable(t);return this._wrapProperties(t,a,e,n,s,0),a.__parse=(r,i,o,c)=>(this._wrapProperties(r,a,e,i,o,c),!1),a}_wrapWritable(t){const e=[],n=function(){for(let s=0;s<e.length;s++)e[s](t)};return{subscribe:s=>(e.push(s),this._async?setTimeout(s,1,t):s(t),()=>{const a=e.indexOf(s);a>=0&&e.splice(a,1)}),__trigger:()=>{e.length&&(this._async?setTimeout(n,1):n())},__parse:function(s){return t=s,!0}}}},$e=class{constructor(t,e,n,s){typeof t=="function"?this._setter=t:this._setter=t.setState.bind(t),this._routes=e,this._parsers=n,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(a=>{a.in.forEach(r=>{const i=this._triggers.get(r)||[];i.push(a),this._triggers.set(r,i)}),a.out.forEach(r=>{const i=this._sources.get(r)||{};a.in.forEach(o=>i[o]=!0),this._sources.set(r,i)})}),this._routes.forEach(a=>{a.length=Math.max(...a.in.map(r=>Ht(r,this._sources,1)))}),this._bus=s}init(t){const e={};for(const n in t)if(this._prev[n]!==t[n]){const s=this._parsers[n];e[n]=s?s(t[n]):t[n]}this._prev=this._prev?{...this._prev,...t}:{...t},this.setState(e),this._bus&&this._bus.exec("init-state",e)}setStateAsync(t){const e=this._setter(t,Ot);return this._async?Object.assign(this._async.signals,e):this._async={signals:e,timer:setTimeout(this._applyState.bind(this),1)},e}_applyState(){const t=this._async;if(t){this._async=null,this._triggerUpdates(t.signals,[]);for(const e in t.signals){const n=t.signals[e];n&&n()}}}setState(t,e=[]){const n=this._setter(t);return this._triggerUpdates(n,e),n}_triggerUpdates(t,e){const n=Object.keys(t),s=!e.length;e=e||[];for(let a=0;a<n.length;a++){const r=n[a],i=this._triggers.get(r);i&&i.forEach(o=>{e.indexOf(o)==-1&&e.push(o)})}s&&this._execNext(e)}_execNext(t){for(;t.length;){t.sort((n,s)=>n.length<s.length?1:-1);const e=t[t.length-1];t.splice(t.length-1),e.exec(t)}}};function Ht(t,e,n){const s=e.get(t);if(!s)return n;const a=Object.keys(s).map(r=>Ht(r,e,n+1));return Math.max(...a)}var Pe=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(t,e,n){let s=this._handlers[t];s?n&&n.intercept?s.unshift(e):s.push(e):s=this._handlers[t]=[e],n&&n.tag&&this._tag.set(e,n.tag)}intercept(t,e,n){this.on(t,e,{...n,intercept:!0})}detach(t){for(const e in this._handlers){const n=this._handlers[e];for(let s=n.length-1;s>=0;s--)this._tag.get(n[s])===t&&n.splice(s,1)}}async exec(t,e){const n=this._handlers[t];if(n)for(let s=0;s<n.length;s++){const a=n[s](e);if(a===!1||a&&a.then&&await a===!1)return}return this._nextHandler&&await this._nextHandler.exec(t,e),e}setNext(t){return this._nextHandler=t}};new Date().valueOf();function Ce(t){return e=>e[t]}function at(t,e){return(e.getter||Ce(e.id))(t)}const Ee={text:(t,e)=>t?t.toString().toLowerCase().indexOf(e.toLowerCase())!==-1:!e,richselect:(t,e)=>typeof e!="number"&&!e?!0:t==e,datepicker:(t,e)=>e?t&&Fe(t,e):!0};function Oe(t){return Ee[t]}function He(t,e){const n=[];for(const s in t){const a=e.find(c=>c.id==s),{config:r,type:i}=a.header.find(c=>c.filter).filter,o=t[s];n.push(c=>{const d=at(c,a);return r?.handler?r.handler(d,o):Oe(i)(d,o)})}return s=>{for(let a=0;a<n.length;a++)if(!n[a](s))return!1;return!0}}function Fe(t,e){return t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}new Date().valueOf(),new Date().valueOf();function Ne(t,e){return typeof t=="string"?t.localeCompare(e,void 0,{numeric:!0}):t instanceof Date||e instanceof Date?t?e?t.getTime()-e.getTime():-1:1:(t??0)-(e??0)}function Ye(t,e){return typeof t=="string"?-t.localeCompare(e,void 0,{numeric:!0}):t instanceof Date||e instanceof Date?e?t?e.getTime()-t.getTime():-1:1:(e??0)-(t??0)}function Ae({order:t,key:e},n){const s=t==="asc"?Ne:Ye;return(a,r)=>s(n?at(a,n):a[e],n?at(r,n):r[e])}function ze(t,e){if(!t||!t.length)return;const n=t.map(s=>{const a=e.find(r=>r.id==s.key);return Ae(s,a)});return t.length===1?n[0]:function(s,a){for(let r=0;r<n.length;r++){const i=n[r](s,a);if(i!==0)return i}return 0}}function Be(t,e,n){return t.sort(ze(e,n))}function Ft(t,e,n,s){const a=t.id===0||e(t);let r=!1;if(Array.isArray(t.data)){for(const i of t.data)Ft(i,e,n,s)&&(r=!0);r?(delete t.$empty,s&&(t.open=!0)):t.$empty=!0}return(a||r)&&t.id!==0?(n.add(t.id),!0):!1}function Nt(t,e,n){t.has(e)&&t.delete(e),n?.length&&n.forEach(s=>Nt(t,s.id,s.data))}class je extends Te{_filteredIds;constructor(e){super(),this.parse(e,0)}parse(e,n){if(!e||!e.length)return;const s=e.map(a=>this.normalizeTask(a));super.parse(s,n)}getBranch(e){const n=this._pool.get(e);return this._pool.get(n.parent||0).data}contains(e,n){const s=this._pool.get(e).data;let a=!1;if(s)for(let r=0;r<s.length;r++){if(s[r].id===n){a=!0;break}if(s[r].data&&(a=this.contains(s[r].id,n),a))break}return a}getIndexById(e){return this.getBranch(e).findIndex(n=>n.id===e)}add(e,n){const s=this.normalizeTask(e);if(super.add(s,n),this._filteredIds&&this._filteredIds.add(s.id),this._filteredIds&&e.parent){const a=this.byId(e.parent);this.hasChildItems(a)&&delete a.$empty}return s}copy(e,n,s){const a=this.add({...e,id:null,data:null,parent:n},s);let r=[[e.id,a.id]];return e.data?.forEach((i,o)=>{const c=this.copy(i,a.id,o);r=r.concat(c)}),r}remove(e){const n=this.byId(e);if(this._filteredIds&&Nt(this._filteredIds,e,n.data),super.remove(e),this._filteredIds&&n.parent){const s=this.byId(n.parent);this.hasChildItems(s)||(s.$empty=!0)}}normalizeTask(e){const n=e.id||st(),s=e.parent||0,a=e.text||"",r=e.type||"task",i=e.progress||0,o=e.details||"",c={...e,id:n,text:a,parent:s,progress:i,type:r,details:o};return e.segments&&(c.segments=e.segments.map(d=>({...d}))),e.segments&&(c.segments=e.segments.map(d=>({...d}))),c}getSummaryId(e,n=!1){const s=this._pool.get(e);if(!s.parent)return null;const a=this._pool.get(s.parent);if(n){let r=e,i=this.getSummaryId(r);const o=[];for(;i;)r=i,o.push(i),i=this.getSummaryId(r);return o}return a.type==="summary"?a.id:this.getSummaryId(a.id)}sort(e,n){e&&this.sortBranch(e,0,n)}sortBranch(e,n,s){const a=this._pool.get(n||0).data;a&&(Be(a,e,s),a.forEach(r=>{this.sortBranch(e,r.id,s)}))}serialize(){const e=[],n=this._pool.get(0).data;return n&&Yt(n,e),e}clear(){this.forEach(e=>{this.remove(e.id)})}filterTree(e,n){if(e){const s=this._pool.get(0),a=new Set;Ft(s,e,a,n),this._filteredIds=a}else this._filteredIds=null}toArray(e){let n=super.toArray();return!e&&this._filteredIds&&(n=n.filter(s=>this.isFilteredId(s.id))),n}isFilteredId(e){return this._filteredIds?.has(e)}hasChildItems(e){const n=e.data?.length;return n&&this._filteredIds?e.data.some(s=>this.isFilteredId(s.id)):!!n}}function Yt(t,e){t.forEach(n=>{e.push(n),n.data&&Yt(n.data,e)})}function w(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function D(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function V(t,e){const n=w(t);return isNaN(e)?D(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function rt(t,e){const n=w(t);if(isNaN(e))return D(t,NaN);if(!e)return n;const s=n.getDate(),a=D(t,n.getTime());a.setMonth(n.getMonth()+e+1,0);const r=a.getDate();return s>=r?a:(n.setFullYear(a.getFullYear(),a.getMonth(),s),n)}function At(t,e){const n=+w(t);return D(t,n+e)}const J=6048e5,qe=864e5,zt=6e4,Bt=36e5;function Le(t,e){return At(t,e*Bt)}let Ue={};function j(){return Ue}function C(t,e){const n=j(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=w(t),r=a.getDay(),i=(r<s?7:0)+r-s;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function Y(t){return C(t,{weekStartsOn:1})}function jt(t){const e=w(t),n=e.getFullYear(),s=D(t,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const a=Y(s),r=D(t,0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);const i=Y(r);return e.getTime()>=a.getTime()?n+1:e.getTime()>=i.getTime()?n:n-1}function O(t){const e=w(t);return e.setHours(0,0,0,0),e}function K(t){const e=w(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function it(t,e){const n=O(t),s=O(e),a=+n-K(n),r=+s-K(s);return Math.round((a-r)/qe)}function ot(t){const e=jt(t),n=D(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),Y(n)}function Xe(t,e){return At(t,e*zt)}function Qe(t,e){const n=e*3;return rt(t,n)}function qt(t,e){const n=e*7;return V(t,n)}function Ge(t,e){return rt(t,e*12)}function q(t,e){const n=w(t),s=w(e),a=n.getTime()-s.getTime();return a<0?-1:a>0?1:a}function Re(t,e){const n=O(t),s=O(e);return+n==+s}function Ve(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Je(t){if(!Ve(t)&&typeof t!="number")return!1;const e=w(t);return!isNaN(Number(e))}function ct(t,e){const n=Y(t),s=Y(e),a=+n-K(n),r=+s-K(s);return Math.round((a-r)/J)}function Ke(t,e){const n=w(t),s=w(e),a=n.getFullYear()-s.getFullYear(),r=n.getMonth()-s.getMonth();return a*12+r}function Ze(t,e){const n=w(t),s=w(e);return n.getFullYear()-s.getFullYear()}function dt(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function Lt(t,e){return+w(t)-+w(e)}function tn(t,e,n){const s=Lt(t,e)/Bt;return dt(n?.roundingMethod)(s)}function en(t,e,n){const s=Lt(t,e)/zt;return dt(n?.roundingMethod)(s)}function Ut(t){const e=w(t);return e.setHours(23,59,59,999),e}function ut(t){const e=w(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function nn(t){const e=w(t);return+Ut(e)==+ut(e)}function Xt(t,e){const n=w(t),s=w(e),a=q(n,s),r=Math.abs(Ke(n,s));let i;if(r<1)i=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*r);let o=q(n,s)===-a;nn(w(t))&&r===1&&q(t,s)===1&&(o=!1),i=a*(r-Number(o))}return i===0?0:i}function sn(t,e,n){const s=Xt(t,e)/3;return dt(n?.roundingMethod)(s)}function an(t,e){const n=w(t),s=w(e),a=q(n,s),r=Math.abs(Ze(n,s));n.setFullYear(1584),s.setFullYear(1584);const i=q(n,s)===-a,o=a*(r-+i);return o===0?0:o}function L(t){const e=w(t),n=e.getMonth(),s=n-n%3;return e.setMonth(s,1),e.setHours(0,0,0,0),e}function Qt(t){const e=w(t);return e.setDate(1),e.setHours(0,0,0,0),e}function rn(t){const e=w(t),n=e.getFullYear();return e.setFullYear(n+1,0,0),e.setHours(23,59,59,999),e}function Gt(t){const e=w(t),n=D(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function on(t){const e=w(t);return e.setMinutes(59,59,999),e}function cn(t,e){const n=j(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=w(t),r=a.getDay(),i=(r<s?-7:0)+6-(r-s);return a.setDate(a.getDate()+i),a.setHours(23,59,59,999),a}function lt(t){const e=w(t),n=e.getMonth(),s=n-n%3+3;return e.setMonth(s,0),e.setHours(23,59,59,999),e}const dn={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},un=(t,e,n)=>{let s;const a=dn[t];return typeof a=="string"?s=a:e===1?s=a.one:s=a.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function ht(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const ln={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},hn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},fn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},mn={date:ht({formats:ln,defaultWidth:"full"}),time:ht({formats:hn,defaultWidth:"full"}),dateTime:ht({formats:fn,defaultWidth:"full"})},gn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},pn=(t,e,n,s)=>gn[t];function U(t){return(e,n)=>{const s=n?.context?String(n.context):"standalone";let a;if(s==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):i;a=t.formattingValues[o]||t.formattingValues[i]}else{const i=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;a=t.values[o]||t.values[i]}const r=t.argumentCallback?t.argumentCallback(e):e;return a[r]}}const yn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},kn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wn={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},bn={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},_n={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},xn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},vn=(t,e)=>{const n=Number(t),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Sn={ordinalNumber:vn,era:U({values:yn,defaultWidth:"wide"}),quarter:U({values:kn,defaultWidth:"wide",argumentCallback:t=>t-1}),month:U({values:wn,defaultWidth:"wide"}),day:U({values:bn,defaultWidth:"wide"}),dayPeriod:U({values:_n,defaultWidth:"wide",formattingValues:xn,defaultFormattingWidth:"wide"})};function X(t){return(e,n={})=>{const s=n.width,a=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],r=e.match(a);if(!r)return null;const i=r[0],o=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(o)?Dn(o,h=>h.test(i)):Mn(o,h=>h.test(i));let d;d=t.valueCallback?t.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const u=e.slice(i.length);return{value:d,rest:u}}}function Mn(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Dn(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Tn(t){return(e,n={})=>{const s=e.match(t.matchPattern);if(!s)return null;const a=s[0],r=e.match(t.parsePattern);if(!r)return null;let i=t.valueCallback?t.valueCallback(r[0]):r[0];i=n.valueCallback?n.valueCallback(i):i;const o=e.slice(a.length);return{value:i,rest:o}}}const In=/^(\d+)(th|st|nd|rd)?/i,Wn=/\d+/i,$n={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Pn={any:[/^b/i,/^(a|c)/i]},Cn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},En={any:[/1/i,/2/i,/3/i,/4/i]},On={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Hn={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Fn={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Nn={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Yn={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},An={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},zn={ordinalNumber:Tn({matchPattern:In,parsePattern:Wn,valueCallback:t=>parseInt(t,10)}),era:X({matchPatterns:$n,defaultMatchWidth:"wide",parsePatterns:Pn,defaultParseWidth:"any"}),quarter:X({matchPatterns:Cn,defaultMatchWidth:"wide",parsePatterns:En,defaultParseWidth:"any",valueCallback:t=>t+1}),month:X({matchPatterns:On,defaultMatchWidth:"wide",parsePatterns:Hn,defaultParseWidth:"any"}),day:X({matchPatterns:Fn,defaultMatchWidth:"wide",parsePatterns:Nn,defaultParseWidth:"any"}),dayPeriod:X({matchPatterns:Yn,defaultMatchWidth:"any",parsePatterns:An,defaultParseWidth:"any"})},Bn={code:"en-US",formatDistance:un,formatLong:mn,formatRelative:pn,localize:Sn,match:zn,options:{weekStartsOn:0,firstWeekContainsDate:1}};function jn(t){const e=w(t);return it(e,Gt(e))+1}function qn(t){const e=w(t),n=+Y(e)-+ot(e);return Math.round(n/J)+1}function Rt(t,e){const n=w(t),s=n.getFullYear(),a=j(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=D(t,0);i.setFullYear(s+1,0,r),i.setHours(0,0,0,0);const o=C(i,e),c=D(t,0);c.setFullYear(s,0,r),c.setHours(0,0,0,0);const d=C(c,e);return n.getTime()>=o.getTime()?s+1:n.getTime()>=d.getTime()?s:s-1}function Ln(t,e){const n=j(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=Rt(t,e),r=D(t,0);return r.setFullYear(a,0,s),r.setHours(0,0,0,0),C(r,e)}function Un(t,e){const n=w(t),s=+C(n,e)-+Ln(n,e);return Math.round(s/J)+1}function x(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const E={y(t,e){const n=t.getFullYear(),s=n>0?n:1-n;return x(e==="yy"?s%100:s,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):x(n+1,2)},d(t,e){return x(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return x(t.getHours()%12||12,e.length)},H(t,e){return x(t.getHours(),e.length)},m(t,e){return x(t.getMinutes(),e.length)},s(t,e){return x(t.getSeconds(),e.length)},S(t,e){const n=e.length,s=t.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return x(a,e.length)}},A={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Vt={G:function(t,e,n){const s=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const s=t.getFullYear(),a=s>0?s:1-s;return n.ordinalNumber(a,{unit:"year"})}return E.y(t,e)},Y:function(t,e,n,s){const a=Rt(t,s),r=a>0?a:1-a;if(e==="YY"){const i=r%100;return x(i,2)}return e==="Yo"?n.ordinalNumber(r,{unit:"year"}):x(r,e.length)},R:function(t,e){const n=jt(t);return x(n,e.length)},u:function(t,e){const n=t.getFullYear();return x(n,e.length)},Q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return x(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return x(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,e,n){const s=t.getMonth();switch(e){case"M":case"MM":return E.M(t,e);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(t,e,n){const s=t.getMonth();switch(e){case"L":return String(s+1);case"LL":return x(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(t,e,n,s){const a=Un(t,s);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):x(a,e.length)},I:function(t,e,n){const s=qn(t);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):x(s,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):E.d(t,e)},D:function(t,e,n){const s=jn(t);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):x(s,e.length)},E:function(t,e,n){const s=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(t,e,n,s){const a=t.getDay(),r=(a-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return x(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,s){const a=t.getDay(),r=(a-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return x(r,e.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const s=t.getDay(),a=s===0?7:s;switch(e){case"i":return String(a);case"ii":return x(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const s=t.getHours();let a;switch(s===12?a=A.noon:s===0?a=A.midnight:a=s/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const s=t.getHours();let a;switch(s>=17?a=A.evening:s>=12?a=A.afternoon:s>=4?a=A.morning:a=A.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let s=t.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return E.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):E.H(t,e)},K:function(t,e,n){const s=t.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):x(s,e.length)},k:function(t,e,n){let s=t.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):x(s,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):E.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):E.s(t,e)},S:function(t,e){return E.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return Kt(s);case"XXXX":case"XX":return H(s);case"XXXXX":case"XXX":default:return H(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return Kt(s);case"xxxx":case"xx":return H(s);case"xxxxx":case"xxx":default:return H(s,":")}},O:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Jt(s,":");case"OOOO":default:return"GMT"+H(s,":")}},z:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Jt(s,":");case"zzzz":default:return"GMT"+H(s,":")}},t:function(t,e,n){const s=Math.trunc(t.getTime()/1e3);return x(s,e.length)},T:function(t,e,n){const s=t.getTime();return x(s,e.length)}};function Jt(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=Math.trunc(s/60),r=s%60;return r===0?n+String(a):n+String(a)+e+x(r,2)}function Kt(t,e){return t%60===0?(t>0?"-":"+")+x(Math.abs(t)/60,2):H(t,e)}function H(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=x(Math.trunc(s/60),2),r=x(s%60,2);return n+a+e+r}const Zt=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},te=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Xn=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return Zt(t,e);let r;switch(s){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",Zt(s,e)).replace("{{time}}",te(a,e))},Qn={p:te,P:Xn},Gn=/^D+$/,Rn=/^Y+$/,Vn=["D","DD","YY","YYYY"];function Jn(t){return Gn.test(t)}function Kn(t){return Rn.test(t)}function Zn(t,e,n){const s=ts(t,e,n);if(console.warn(s),Vn.includes(t))throw new RangeError(s)}function ts(t,e,n){const s=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const es=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ns=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ss=/^'([^]*?)'?$/,as=/''/g,rs=/[a-zA-Z]/;function is(t,e,n){const s=j(),a=n?.locale??s.locale??Bn,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,o=w(t);if(!Je(o))throw new RangeError("Invalid time value");let c=e.match(ns).map(u=>{const h=u[0];if(h==="p"||h==="P"){const l=Qn[h];return l(u,a.formatLong)}return u}).join("").match(es).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const h=u[0];if(h==="'")return{isToken:!1,value:os(u)};if(Vt[h])return{isToken:!0,value:u};if(h.match(rs))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:u}});a.localize.preprocessor&&(c=a.localize.preprocessor(o,c));const d={firstWeekContainsDate:r,weekStartsOn:i,locale:a};return c.map(u=>{if(!u.isToken)return u.value;const h=u.value;(!n?.useAdditionalWeekYearTokens&&Kn(h)||!n?.useAdditionalDayOfYearTokens&&Jn(h))&&Zn(h,e,String(t));const l=Vt[h[0]];return l(o,h,a.localize,d)}).join("")}function os(t){const e=t.match(ss);return e?e[1].replace(as,"'"):t}function ee(t){const e=w(t),n=e.getFullYear(),s=e.getMonth(),a=D(t,0);return a.setFullYear(n,s+1,0),a.setHours(0,0,0,0),a.getDate()}function cs(t){const e=w(t).getFullYear();return e%400===0||e%4===0&&e%100!==0}function ne(t){const e=w(t);return String(new Date(e))==="Invalid Date"?NaN:cs(e)?366:365}function ds(t){const e=ot(t),n=+ot(qt(e,60))-+e;return Math.round(n/J)}function z(t,e){const n=w(t),s=w(e);return+n==+s}function us(t){const e=w(t);return e.setMinutes(0,0,0),e}function ls(t,e,n){const s=C(t,n),a=C(e,n);return+s==+a}function hs(t,e){const n=w(t),s=w(e);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function fs(t,e){const n=L(t),s=L(e);return+n==+s}function ms(t,e){const n=w(t),s=w(e);return n.getFullYear()===s.getFullYear()}const ft={year:an,quarter:sn,month:Xt,week:ct,day:it,hour:tn,minute:en},F={year:{quarter:4,month:12,week:ds,day:gs,hour:ps},quarter:{month:3,week:ys,day:se,hour:ks},month:{week:ws,day:bs,hour:_s},week:{day:7,hour:24*7},day:{hour:24},hour:{minute:60}};function gs(t){return t?ne(t):365}function ps(t){return ne(t)*24}function ys(t){const e=L(t),n=V(O(lt(t)),1);return ct(n,e)}function se(t){if(t){const e=L(t),n=lt(t);return it(n,e)+1}return 91}function ks(t){return se(t)*24}function ws(t){if(t){const e=Qt(t),n=V(O(ut(t)),1);return ct(n,e)}return 5}function bs(t){return t?ee(t):30}function _s(t){return ee(t)*24}function Z(t,e,n){const s=F[t][e];return s?typeof s=="number"?s:s(n):1}function xs(t,e){return t===e||!!(F[t]&&F[t][e])}const tt={year:Ge,quarter:Qe,month:rt,week:qt,day:V,hour:Le,minute:Xe};function et(t,e,n){if(e){if(t==="day")return(s,a)=>e.getWorkingDays(a,s,!0);if(t==="hour")return(s,a)=>e.getWorkingHours(a,s,!0)}return(s,a,r,i)=>{const o=F[t]?.[r];return!o||typeof o=="number"||ie(t,s,a,n)?Q(t,s,a,r,i,n):vs(s,a,t,r,i,n)}}function Q(t,e,n,s,a,r){const i=s||t;let o=n,c=e;if(a&&(o=W(i,n,r),c=W(i,e,r),c<e&&(c=I(i)(c,1))),t!==i){const d=ft[i](c,o),u=Z(t,i,n);return d/u}else return ft[i](c,o)}function vs(t,e,n,s,a,r){let i=0;const o=W(n,e,r);if(e>o){const d=tt[n](o,1);i=Q(n,d,e,s,void 0,r),e=d}let c=0;return ie(n,e,t,r)||(c=Q(n,W(n,t,r),e,void 0,void 0,r),e=tt[n](e,c)),c+=i+Q(n,t,e,s,void 0,r),!c&&a&&(c=Q(n,t,e,s,a,r)),c}function I(t,e){if(e){if(t==="day")return(n,s)=>e.addWorkingDays(n,s,!0);if(t==="hour")return(n,s)=>e.addWorkingHours(n,s)}return tt[t]}const ae={year:Gt,quarter:L,month:Qt,week:(t,e)=>C(t,{weekStartsOn:e}),day:O,hour:us};function W(t,e,n){const s=ae[t];return s?s(e,n):new Date(e)}const Ss={year:rn,quarter:lt,month:ut,week:(t,e)=>cn(t,{weekStartsOn:e}),day:Ut,hour:on},re={year:ms,quarter:fs,month:hs,week:(t,e,n)=>ls(t,e,{weekStartsOn:n}),day:Re};function ie(t,e,n,s){const a=re[t];return a?a(e,n,s):!1}const Ms={start:ae,end:Ss,add:tt,isSame:re,diff:ft,smallerCount:F},oe=t=>typeof t=="function"?t(new Date):t;function Ds(t,e){for(const n in e){if(n==="smallerCount"){const s=Object.keys(e[n]).sort((o,c)=>$.indexOf(o)-$.indexOf(c)).shift();let a=$.indexOf(s);const r=e[n][s],i=oe(r);for(let o=a-1;o>=0;o--){const c=$[o],d=oe(F[c][s]);if(i<=d)break;a=o}$.splice(a,0,t)}if(n==="biggerCount")for(const s in e[n])F[s][t]=e[n][s];else Ms[n][t]=e[n]}}function mt(t,e=1,n){return n.isWorkingDay(t)||(t=e>0?n.getNextWorkingDay(t):n.getPreviousWorkingDay(t)),t}function Ts(t){return(e,n)=>{if(n>0)for(let s=0;s<n;s++)e=t.getNextWorkingDay(e);if(n<0)for(let s=0;s>n;s--)e=t.getPreviousWorkingDay(e);return e}}function B(t){const e=new Date;return t.map(n=>({item:n,len:I(n.unit)(e,1)})).sort((n,s)=>n.len<s.len?-1:1)[0].item}const $=["year","quarter","month","week","day","hour"],gt=50,pt=300;function Is(t,e,n,s,a,r,i,o,c){const d=!t||n,u=!e||n;let h=t,l=e,m=!1,g=!1;(d||u)&&a?.forEach(p=>{let y=p.start;c&&p.base_start<p.start&&(y=p.base_start),d&&(!h||y<=h)&&(h=y,m=!0);let k=p.type==="milestone"?p.start:p.end;if(c){const b=p.type==="milestone"?p.base_start:p.base_end;b&&b>k&&(k=b)}u&&(!l||k>=l)&&(l=k,g=!0)});const f=I(s||"day");return h?m&&(h=f(h,-1)):l?h=f(l,-30):h=new Date,l?g&&(l=f(l,1)):l=f(h,30),{_start:h,_end:l}}function Ws(t,e,n,s,a,r,i,o){const c=B(i).unit,d=et(c,void 0,r),u=d(e,t,"",!0),h=W(c,e,r);t=W(c,t,r),e=h<e?I(c)(h,1):h;const l=u*s,m=a*Math.max(o,i.length),g=i.map(p=>{const y=[],k=I(p.unit);let b=W(p.unit,t,r);for(;b<e;){const _=k(b,p.step),v=b<t?t:b,M=_>e?e:_,P=d(M,v,"",!0)*s,T=typeof p.format=="function"?p.format(b,_):p.format;let S="";p.css&&(S+=typeof p.css=="function"?p.css(b):p.css),y.push({width:P,value:T,date:v,css:S,unit:p.unit}),b=_}return{cells:y,add:k,height:m/i.length}});let f=s;return c!==n&&(f=f/Z(c,n)),{rows:g,width:l,height:m,diff:d,start:t,end:e,lengthUnit:n,minUnit:c,lengthUnitWidth:f}}function $s(t,e,n,s){const a=typeof t=="boolean"?{}:t,r=$.indexOf(B(n).unit);if(typeof a.level>"u"&&(a.level=r),a.levels)a.levels.forEach(c=>{c.minCellWidth||(c.minCellWidth=nt(a.minCellWidth,gt)),c.maxCellWidth||(c.maxCellWidth=nt(a.maxCellWidth,pt))});else{const c=[],d=n.length||1,u=nt(a.minCellWidth,gt),h=nt(a.maxCellWidth,pt);n.forEach(l=>{l.format&&!e[l.unit]&&(e[l.unit]=l.format)}),$.forEach((l,m)=>{if(m===r)c.push({minCellWidth:u,maxCellWidth:h,scales:n});else{const g=[];if(m)for(let f=d-1;f>0;f--){const p=$[m-f];p&&g.push({unit:p,step:1,format:e[p]})}g.push({unit:l,step:1,format:e[l]}),c.push({minCellWidth:u,maxCellWidth:h,scales:g})}}),a.levels=c}a.levels[a.level]||(a.level=0);const i=a.levels[a.level],o=Math.min(Math.max(s,i.minCellWidth),i.maxCellWidth);return{zoom:a,scales:i.scales,cellWidth:o}}function Ps(t,e,n,s,a,r,i){t.level=n;let o;const c=s.scales||s,d=B(c).unit,u=Es(d,a);if(e<0){const m=Z(d,a);o=i*m}else{const m=Z(B(r).unit,d);o=Math.round(i/m)}const h=s.minCellWidth??gt,l=s.maxCellWidth??pt;return{scales:c,cellWidth:Math.min(l,Math.max(h,o)),lengthUnit:u,zoom:t}}function Cs(t,e){const{_start:n,_scales:s,start:a,end:r,_end:i,cellWidth:o,_scaleDate:c,_zoomOffset:d,_weekStart:u}=e,h=I(s.minUnit);let l=s.width;if(a&&r){if(l<t&&l){const y=t/l;return{cellWidth:o*y}}return{}}let m=0;for(;l<t;)l+=o,m++;let g=0;if(m){if(r)g=-m;else if(c&&d!==null){const y=d/o,k=s.diff(c,n,"hour");g=Math.floor(k-y)}}let f=a;a||(f=W(s.minUnit,h(n,g),u));let p=0;if(c){const y=s.diff(c,f,"hour");p=Math.max(0,Math.round(y*o)-(d||0))}return{_start:f,_end:r||h(i,m-g),scrollLeft:p}}function Es(t,e){const n=$.indexOf(t),s=$.indexOf(e);return s>=n?t==="hour"?"hour":"day":$[s]}function nt(t,e){return t??e}const yt=7,Os=3,kt=8,ce=4,Hs=kt+ce;function de(t,e,n){(t.open||t.type!=="summary"||n)&&t.data?.forEach(s=>{s.$x+=e,s.$x_rollup&&(s.$x_rollup+=e),de(s,e,n)})}function wt(t,e){const n=t.getSummaryId(e.id);if(n){const s=t.byId(n),a={xMin:1/0,xMax:0};ue(s,a),s.$x=a.xMin,s.$w=a.xMax-a.xMin,wt(t,s)}}function ue(t,e){t.data?.forEach(n=>{if(!n.unscheduled){const s=n.type==="milestone"&&n.$h?n.$h/2:0;e.xMin>n.$x+s&&(e.xMin=n.$x+s);const a=n.$x+n.$w-s;e.xMax<a&&(e.xMax=a)}n.type!=="summary"&&ue(n,e)})}function bt(t,e){let n;e&&(n=e.filter(a=>a.parent===t.id));const s={data:n,...t};if(s.data?.length)s.data.forEach(a=>{if(a.unscheduled&&!a.data)return;(e||a.type!=="summary"&&a.data)&&(a.unscheduled&&(a={...a,start:void 0,end:void 0}),a=bt(a,e)),a.start&&(!s.start||s.start>a.start)&&(s.start=new Date(a.start));const r=a.end||a.start;r&&(!s.end||s.end<r)&&(s.end=new Date(r))});else if(t.type==="summary")throw Error("Summary tasks must have start and end dates if they have no subtasks");return s}function le(t,e,n){return _t(t,e,n,!1),n.splitTasks&&t.segments?.forEach(s=>{le(s,e,{...n,baselines:!1}),s.$x-=t.$x}),n.baselines&&_t(t,e,n,!0),t.data&&!t.open&&he(t,n),t}function _t(t,e,n,s){const{cellWidth:a,cellHeight:r,_scales:i,baselines:o,_rollups:c}=n,{start:d,end:u,lengthUnit:h,diff:l}=i,m=(s?"base_":"")+"start",g=(s?"base_":"")+"end",f="$x"+(s?"_base":""),p="$y"+(s?"_base":""),y="$w"+(s?"_base":""),k="$h"+(s?"_base":""),b="$skip"+(s?"_baseline":"");let _=t[m],v=t[g];if(s&&!_){t[b]=!0;return}t[m]<d&&(t[g]<d||z(t[g],d))?_=v=d:t[m]>u&&(_=v=u),t[f]=Math.round(l(_,d,h)*a),t[y]=Math.round(l(v,_,h,!0)*a),e!==null&&(t[p]=s?t.$y+t.$h+ce:r*e+Os),t[k]=s?kt:o?r-yt-Hs:r-yt,t.type==="milestone"&&(t[f]=t[f]-t.$h/2,t[y]=t.$h,s&&(t[p]=t.$y+kt,t[y]=t[k]=t.$h)),n.unscheduledTasks&&t.unscheduled&&!s?t.$skip=!0:t[b]=z(_,v)}function he(t,e,n){n=n??t.type!=="summary",t.data&&!t.$skip&&(n||e._rollups)&&t.data.forEach(s=>{(n||s.rollup)&&_t(s,null,e,!1),he(s,e,n)})}function Fs(t,e){return!1}function Ns(t,e){}const xt=20,Ys=function(t,e,n,s){if(!e||!n||!e.$y||!n.$y||e.$skip||n.$skip)return t.$p="",t.$pl=0,t;let a=!1,r=!1;switch(t.type){case"e2s":r=!0;break;case"s2s":a=!0,r=!0;break;case"s2e":a=!0;break}const i=a?e.$x:e.$x+e.$w,o=e.$y+e.$h/2,c=r?n.$x:n.$x+n.$w,d=n.$y+n.$h/2,u=(s-yt-n.$h)/2;if(i!==c||o!==d){const h=zs(i,o,c,d,a,r,s/2,u),l=Bs(c,d,r);t.$p=`${h},${l}`,t.$pl=As(t.$p)}return t};function As(t){const e=t.split(",").map(Number),n=[];for(let a=0;a<e.length;a+=2)a+1<e.length&&n.push([e[a],e[a+1]]);let s=0;for(let a=0;a<n.length-1;a++){const[r,i]=n[a],[o,c]=n[a+1];s+=Math.hypot(o-r,c-i)}return s}function zs(t,e,n,s,a,r,i,o){const c=xt*(a?-1:1),d=xt*(r?-1:1),u=t+c,h=n+d,l=[t,e,u,e,0,0,0,0,h,s,n,s],m=h-u;let g=s-e;const f=r===a;return f||(h<=t+xt-2&&r||h>t&&!r)&&(g=g-i+o),f&&r&&u>h||f&&!r&&u<h?(l[4]=l[2]+m,l[5]=l[3],l[6]=l[4],l[7]=l[5]+g):(l[4]=l[2],l[5]=l[3]+g,l[6]=l[4]+m,l[7]=l[5]),l.join(",")}function Bs(t,e,n){return n?`${t-5},${e-3},${t-5},${e+3},${t},${e}`:`${t+5},${e+3},${t+5},${e-3},${t},${e}`}function js(t,e,n){if(e&&n){const s=n.x-e.x,a=n.y-e.y,r=(s>0?e.x:n.x)-t.left,i=(a>0?e.y:n.y)-t.top,o=`${s>0?0:-s},${a>0?0:-a},${s>0?s:0},${a>0?a:0}`;return{width:Math.abs(s),height:Math.abs(a),left:r,top:i,p:o}}else return null}function fe(t){return t.map(e=>{const n=e.id||st();return{...e,id:n}})}const me=["start","end","duration"];function qs(t,e){const{type:n,unscheduled:s}=t;return s||n==="summary"?!me.includes(e):n==="milestone"?!["end","duration"].includes(e):!0}function Ls(t,e){return typeof e=="function"?e:me.includes(t)?(typeof e=="string"&&(e={type:e,config:{}}),e.config||(e.config={}),e.type==="datepicker"&&(e.config.buttons=["today"]),(n,s)=>qs(n,s.id)?e:null):e}function Us(t){return!t||!t.length?[]:t.map(e=>{const n=e.align||"left",s=e.id==="add-task",a=!s&&e.flexgrow?e.flexgrow:null,r=a?1:e.width||(s?50:120),i=e.editor&&Ls(e.id,e.editor);let o=Array.isArray(e.header)?e.header:[e.header];return o=o.map(c=>(typeof c!="object"&&(c={text:c}),c.filter&&typeof c.filter!="object"&&(c.filter={type:c.filter}),c)),{width:r,align:n,header:o,id:e.id,template:e.template,_template:e._template,...a&&{flexgrow:a},cell:e.cell,resize:e.resize??!0,sort:e.sort??!s,...i&&{editor:i},...e.options&&{options:e.options},getter:e.getter}})}const Xs=[{id:"text",header:"Task name",flexgrow:1,sort:!0},{id:"start",header:"Start date",align:"center",sort:!0},{id:"duration",header:"Duration",width:100,align:"center",sort:!0},{id:"add-task",header:"Add task",width:50,align:"center",sort:!1,resize:!1}];function G(t,e,n,s){const{selected:a,tasks:r}=t.getState(),i=a.length,o=["edit-task","paste-task","edit-task:task","edit-task:segment"],c=["copy-task","cut-task"],d=["copy-task","cut-task","delete-task","indent-task:remove","move-task:down"],u=["add-task","undo","redo"],h=["indent-task:add","move-task:down","move-task:up"],l={"indent-task:remove":2},m=!i&&u.includes(e),g={parent:h.includes(e),level:l[e]};if(n=n||(i?a[a.length-1]:null),!(!n&&!m)){if(e!=="paste-task"&&(t._temp=null),o.includes(e)||m||a.length===1)ge(t,e,n,s);else if(i){const f=c.includes(e)?a:Qs(a,r,g);d.includes(e)&&f.reverse();const p=t.getHistory();p&&p.startBatch(),f.forEach((y,k)=>ge(t,e,y,s,k)),p&&p.endBatch()}}}function Qs(t,e,n){let s=t.map(a=>{const r=e.byId(a);return{id:a,level:r.$level,parent:r.parent,index:e.getIndexById(a)}});return(n.parent||n.level)&&(s=s.filter(a=>n.level&&a.level<=n.level||!t.includes(a.parent))),s.sort((a,r)=>a.level-r.level||a.index-r.index),s.map(a=>a.id)}function ge(t,e,n,s,a){const r=t.exec?t.exec:t.in.exec;let i=e.split(":")[0],o=e.split(":")[1];const c=n?.id||n;let d={id:c},u={},h=!1;if(i==="copy-task"||i==="cut-task"){t._temp||(t._temp=[]),t._temp.push({id:c,cut:i==="cut-task"});return}else if(i==="paste-task"){if(t._temp&&t._temp.length){const l=t.getHistory();l&&l.startBatch();const m=new Map;if(t._temp.forEach(g=>{const f={id:g.id,target:c,mode:"after"};r(g.cut?"move-task":"copy-task",f),m.set(g.id,f.id)}),!t._temp[0].cut){const{links:g}=t.getState(),f=t._temp.map(y=>y.id),p=[];g.forEach(y=>{f.includes(y.source)&&f.includes(y.target)&&p.push(y)}),p.forEach(y=>{r("add-link",{link:{source:m.get(y.source),target:m.get(y.target),type:y.type}})}),t._temp.forEach((y,k)=>{r("select-task",{id:m.get(y.id),toggle:!!k})})}l&&l.endBatch(),t._temp=null}return}else i==="add-task"?(u={task:{type:"task",text:s("New Task")},target:c,show:!0,mode:"after",select:!1},d={},h=!0):i==="edit-task"?(i="show-editor",o==="segment"&&typeof n=="object"&&(u=n)):i==="convert-task"?(i="update-task",u={task:{type:o}},o=void 0):i==="indent-task"&&(o=o==="add");if(i==="split-task"&&typeof n=="object")u=n;else if(i==="delete-task"&&o==="segment"&&typeof n=="object"){const l=t.getTask(c),{segmentIndex:m}=n,g=l.segments.filter((f,p)=>p!==m);r("update-task",{id:c,task:{segments:g}});return}typeof o<"u"&&(u={...u,mode:o}),d={...d,...u},r(i,d),h&&r("select-task",{id:d.id,toggle:!!a})}function pe(t,e){return t.some(n=>n.data?pe(n.data,e):n.id===e)}const ye=(t,e)=>I(t,e),Gs=(t,e)=>et(t,e);function ke(t,e){Array.isArray(t)&&(t.forEach(n=>N(n,e)),t.forEach(n=>{if(n.type==="summary"&&!(n.start&&n.end)){const{start:s,end:a}=bt(n,t);n.start=s,n.end=a,N(n,e)}}))}function N(t,e){t.unscheduled||we(t,e,!1),t.base_start&&we(t,e,!0)}function we(t,e,n){const{calendar:s,durationUnit:a}=e,r=a||"day",[i,o,c]=be(n);t.type==="milestone"?(t[c]=0,t[o]=void 0):t[i]&&(t[c]?t[o]=ye(r,s)(t[i],t[c]):t[o]?t[c]=Gs(r,s)(t[o],t[i]):(t[o]=ye(r,s)(t[i],1),t[c]=1))}function be(t){return t?["base_start","base_end","base_duration"]:["start","end","duration"]}function _e(t,e,n){const[s,a,r]=be(n);(e===r||e===s)&&(t[a]=null),e===a&&(t[r]=0,t[s]&&t[s]>=t[a]&&(t[a]=null,t[r]=1))}function Rs(t,e,n){_e(t,n,!1),t.base_start&&_e(t,n,!0),N(t,e)}class Vs extends We{in;_router;_modules=new Map;constructor(e){super({writable:e,async:!1}),this._router=new $e(super.setState.bind(this),[{in:["tasks","start","end","scales","autoScale","markers","projectStart","projectEnd","baselines"],out:["_start","_end"],exec:a=>{const{_end:r,_start:i,start:o,end:c,tasks:d,scales:u,autoScale:h,markers:l,projectStart:m,projectEnd:g,baselines:f}=this.getState();if(!o||!c||h){const p=B(u).unit,y=Is(o,c,h,p,d,l,m,g,f);(y._end!==r||y._start!==i)&&this.setState(y,a)}else this.setState({_start:o,_end:c},a)}},{in:["columns"],out:["_headerLength"],exec:a=>{const r=this.getState().columns;let i=1;r.length&&r.forEach(o=>{i=Math.max(o.header.length,i)}),this.setState({_headerLength:i},a)}},{in:["_start","_end","cellWidth","scaleHeight","scales","lengthUnit","_weekStart","_headerLength"],out:["_scales"],exec:a=>{const r=this.getState();let{lengthUnit:i}=r;const{_start:o,_end:c,cellWidth:d,scaleHeight:u,scales:h,_weekStart:l,_headerLength:m}=r,g=B(h).unit;xs(g,i)||(i=g);const f=Ws(o,c,i,d,u,l,h,m);this.setState({_scales:f},a)}},{in:["_scales","rollups","tasks","cellHeight","baselines","unscheduledTasks"],out:["_tasks"],exec:a=>{const{cellWidth:r,cellHeight:i,tasks:o,_scales:c,baselines:d,splitTasks:u,unscheduledTasks:h,_rollups:l}=this.getState(),m=o.toArray().map((g,f)=>le(g,f,{cellWidth:r,cellHeight:i,_scales:c,baselines:d,splitTasks:u,unscheduledTasks:h,_rollups:l}));this.setState({_tasks:m},a)}},{in:["_tasks","links","cellHeight"],out:["_links"],exec:a=>{const{tasks:r,links:i,cellHeight:o,criticalPath:c,_isFiltered:d}=this.getState(),u=i.map(h=>{const l=r.byId(h.source),m=r.byId(h.target);return Ys(h,l,m,o)}).toSorted((h,l)=>c?!!h.critical==!!l.critical?l.$pl-h.$pl:h.critical?1:-1:l.$pl-h.$pl).filter(h=>h&&d?r.isFilteredId(h.source)&&r.isFilteredId(h.target):h!==null);this.setState({_links:u},a)}},{in:["tasks","activeTask"],out:["_activeTask"],exec:a=>{const r=this.getState();let{activeTask:i}=r;i&&typeof i=="object"&&(i=i.id);const o=r.tasks.byId(i);this.setState({_activeTask:o||null},a)}},{in:["tasks","selected"],out:["_selected"],exec:a=>{const{tasks:r,selected:i,_isFiltered:o}=this.getState(),c=i.map(d=>r.byId(d)).filter(d=>d?!o||r.isFilteredId(d.id):!1);this.setState({_selected:c},a)}},{in:["start","end"],out:["cellWidth"],exec:a=>{const{_cellWidth:r,cellWidth:i}=this.getState();r!==i&&this.setState({cellWidth:r},a)}}],{tasks:a=>new je(a),links:a=>new Pt(a),columns:a=>Us(a)});const n=this.in=new Pe;n.on("show-editor",a=>{const{splitTasks:r}=this.getState();if(r){const{id:i,segmentIndex:o}=a;if(i&&(o||o===0)){this.setStateAsync({activeTask:{id:i,segmentIndex:o}});return}}this.setStateAsync({activeTask:a.id})}),n.on("select-task",({id:a,toggle:r,range:i,show:o=!0,segmentIndex:c,focus:d,eventSource:u})=>{const{selected:h,_tasks:l,activeTask:m,splitTasks:g}=this.getState();let f=!1,p;if(h.length&&(r||i)){const k=[...h];if(i){const b=k[k.length-1],_=l.findIndex(S=>S.id===b),v=l.findIndex(S=>S.id===a),M=Math.min(_,v),P=Math.max(_,v)+1,T=l.slice(M,P).map(S=>S.id);_>v&&T.reverse(),T.forEach(S=>{k.includes(S)||k.push(S)})}else if(r){const b=k.findIndex(_=>_===a);b===-1?k.push(a):(f=!0,k.splice(b,1))}p=k}else p=[a];const y={selected:p};this.setStateAsync(y),p.length&&(d&&(o=d==="chart"?"xy":o||"y"),o&&(this.scrollToTask(p[0],o,u||"select-task"),d&&this.setStateAsync({focusTask:{id:p[0],column:d==="grid"}}))),!f&&m&&(m!==a||g)&&n.exec("show-editor",{id:a,...g&&{segmentIndex:c}})}),n.on("delete-link",({id:a})=>{const{links:r}=this.getState();r.remove(a),this.setStateAsync({links:r})}),n.on("update-link",a=>{const{links:r}=this.getState(),i=a.id;let o=a.link;r.update(i,o),o=r.byId(i),!o.lag&&o.lag!==0&&delete o.lag,this.setStateAsync({links:r}),a.link=o}),n.on("add-link",a=>{const{link:r}=a,{links:i}=this.getState();!r.source||!r.target||(r.type||(r.type="e2s"),r.id=r.id||st(),i.add(r),this.setStateAsync({links:i}),a.id=r.id,a.link=i.byId(r.id))});let s=null;n.on("move-task",a=>{const{tasks:r}=this.getState();let{mode:i,target:o}=a;const{id:c,inProgress:d}=a,u=r.byId(c);if(typeof d>"u"?a.source=u.parent:a.source=s=s??u.parent,d===!1){r.update(u.id,{$reorder:!1}),this.setState({tasks:r}),s=null;return}if(o===c||r.contains(c,o)){a.skipProvider=!0;return}if(i==="up"||i==="down"){const h=r.getBranch(c);let l=r.getIndexById(c);if(i==="up"){const m=u.parent===0;if(l===0&&m){a.skipProvider=!0;return}l-=1,i="before"}else if(i==="down"){const m=l===h.length-1,g=u.parent===0;if(m&&g){a.skipProvider=!0;return}l+=1,i="after"}if(o=h[l]&&h[l].id||u.parent,o){const m=r.getBranch(o);let g=r.getIndexById(o),f=m[g];if(f.data){if(i==="before"){if(f.parent===u.parent){for(;f.data;)f.open||n.exec("open-task",{id:f.id,mode:!0}),f=f.data[f.data.length-1];o=f.id}}else if(i==="after"){let k;f.parent===u.parent?(k=f,f=f.data[0],o=f.id,i="before"):m.length-1!==g&&(k=f,g+=1,f=m[g],u.$level>f.$level&&f.data?(k=f,f=f.data[0],o=f.id,i="before"):o=f.id),k&&!k.open&&n.exec("open-task",{id:k.id,mode:!0})}}const p=r.getSummaryId(u.id);r.move(c,i,o);const y=r.getSummaryId(c);p!==y&&(p&&this.resetSummaryDates(p,"move-task"),y&&this.resetSummaryDates(y,"move-task"))}}else{const h=r.byId(o);let l=h,m=!1;for(;l.$level>u.$level;)l=r.byId(l.parent),l.id===c&&(m=!0);if(m)return;const g=r.getSummaryId(u.id);if(r.move(c,i,o),i==="child"){let p=h;for(;p.id!==0&&!p.open;)n.exec("open-task",{id:p.id,mode:!0}),p=r.byId(p.parent)}const f=r.getSummaryId(c);g!==f&&(g&&this.resetSummaryDates(g,"move-task"),f&&this.resetSummaryDates(f,"move-task"))}d?this.setState({tasks:r}):this.setStateAsync({tasks:r}),a.target=o,a.mode=i}),n.on("drag-task",a=>{const r=this.getState(),{tasks:i,_tasks:o,_selected:c,rollups:d,slack:u}=r,h=i.byId(a.id),{left:l,top:m,width:g,inProgress:f}=a,p={_tasks:o,_selected:c};if(typeof g<"u"&&(h.$w=g,wt(i,h)),typeof l<"u"){if(h.type==="summary"){const y=l-h.$x;de(h,y,!!d)}h.$x=l,wt(i,h)}typeof m<"u"&&(h.$y=m+4,h.$reorder=f),this.setState(p)}),n.on("update-task",a=>{const{id:r,segmentIndex:i,diff:o,eventSource:c}=a;let{task:d}=a;const{tasks:u,_scales:h,durationUnit:l,splitTasks:m,calendar:g}=this.getState(),f=u.byId(r),p={durationUnit:l,calendar:g};if(c==="add-task"||c==="copy-task"||c==="move-task"||c==="update-task"||c==="delete-task"||c==="provide-data"){N(d,p),u.update(r,d);return}const y=h.lengthUnit;let k=I(y);const b=et(l,g);if(o&&(d.start&&(d.start=k(d.start,o)),!i&&i!==0&&(d.start&&d.end?d.duration=f.duration:(d.start?d.end=f.end:(d.end=k(d.end,o),d.start=f.start,d.duration=b(d.end,d.start)),b(d.end,d.start)||(d.duration=1)))),d.type=d.type??f.type,g&&d.start&&(d.start=mt(d.start,o,g)),d.start&&d.end&&(!z(d.start,f.start)||!z(d.end,f.end))&&d.type==="summary"&&f.data?.length){let v=o||b(d.start,f.start);g&&(v=d.start>f.start?b(d.start,f.start):-b(f.start,d.start),k=Ts(g)),this.moveSummaryKids(f,M=>(M=k(M,v),g?mt(M,o,g):M),"update-task")}d.start||(d.start=f.start),!d.end&&!d.duration&&(d.duration=f.duration),N(d,p),u.update(r,d),(g&&d.type==="summary"||d.type==="summary"&&f.type!=="summary")&&this.resetSummaryDates(r,"update-task",!0);const _=u.getSummaryId(r);_&&this.resetSummaryDates(_,"update-task"),this.setStateAsync({tasks:u}),a.task=u.byId(r)}),n.on("add-task",a=>{const{tasks:r,_scales:i,unscheduledTasks:o,durationUnit:c,splitTasks:d,calendar:u}=this.getState(),{target:h,mode:l,task:m,show:g,select:f=!0,focus:p}=a;!a.eventSource&&o&&(m.unscheduled=!0);let y=-1,k,b;if(h?(b=r.byId(h),l==="child"?(k=b,m.parent=k.id):(b.parent!==null&&(k=r.byId(b.parent),m.parent=k.id),y=r.getIndexById(h),l==="after"&&(y+=1))):m.parent&&(k=r.byId(m.parent)),!m.start){if(k?.start)m.start=new Date(k.start.valueOf());else if(b)m.start=new Date(b.start.valueOf());else{const P=r.getBranch(0);let T;if(P?.length){const S=P[P.length-1];if(!S.$skip){const Wt=new Date(S.start.valueOf());i.start<=Wt&&(T=Wt)}}m.start=T||I(c,u)(i.start,1)}m.duration=1}u&&(m.start=mt(m.start,1,u)),this.getState().baselines&&(m.base_start=m.start,m.base_duration=m.duration),N(m,{durationUnit:c,calendar:u});const _=r.add(m,y),v={tasks:r};if(g)for(;k&&k.id;)n.exec("open-task",{id:k.id,mode:!0}),k=r.byId(k.parent);a.id=_.id;const M=r.getSummaryId(_.id);M&&this.resetSummaryDates(M,"add-task"),this.setStateAsync(v),a.id=_.id,a.task=_,f?n.exec("select-task",{id:_.id,show:g,focus:p,eventSource:"add-task"}):g&&this.scrollToTask(_.id,g,"add-task")}),n.on("delete-task",a=>{const{id:r}=a,{tasks:i,links:o,selected:c}=this.getState(),d=i.byId(r);a.source=d.parent;const u=i.getSummaryId(r),h=[r];i.eachChild(m=>h.push(m.id),r),o.filter(m=>!(h.includes(m.source)||h.includes(m.target)));const l={tasks:i,links:o};c.includes(r)&&(l.selected=c.filter(m=>m!==r)),i.remove(r),u&&this.resetSummaryDates(u,"delete-task"),this.setStateAsync(l)}),n.on("indent-task",({id:a,mode:r})=>{const{tasks:i}=this.getState();if(r){const o=i.getBranch(a)[i.getIndexById(a)-1];o&&n.exec("move-task",{id:a,mode:"child",target:o.id})}else{const o=i.byId(a),c=i.byId(o.parent);c&&c.parent!==null&&n.exec("move-task",{id:a,mode:"after",target:o.parent})}}),n.on("copy-task",a=>{const{id:r,target:i,mode:o,eventSource:c}=a;if(c==="copy-task")return;const{tasks:d,links:u}=this.getState();if(d.contains(r,i)){a.skipProvider=!0;return}const h=d.getSummaryId(r),l=d.getSummaryId(i);let m=d.getIndexById(i);o==="before"&&(m-=1);const g=d.byId(r),f=d.copy(g,d.byId(i).parent,m+1);a.source=a.id,a.id=f[0][1],g.lazy&&(a.lazy=!0),h!==l&&l&&this.resetSummaryDates(l,"copy-task");let p=[];for(let y=1;y<f.length;y++){const[k,b]=f[y];u.forEach(_=>{if(_.source===k){const v={..._};delete v.target,p.push({...v,source:b})}else if(_.target===k){const v={..._};delete v.source,p.push({...v,target:b})}})}p=p.reduce((y,k)=>{const b=y.findIndex(_=>_.id===k.id);return b>-1?y[b]={...y[b],...k}:y.push(k),y},[]);for(let y=1;y<f.length;y++){const[k,b]=f[y],_=d.byId(b);n.exec("copy-task",{source:k,id:b,lazy:!!_.lazy,eventSource:"copy-task",target:_.parent,mode:"child",skipUndo:!0})}p.forEach(y=>{n.exec("add-link",{link:{source:y.source,target:y.target,type:y.type},eventSource:"copy-task",skipUndo:!0})}),this.setStateAsync({tasks:d})}),n.on("open-task",({id:a,mode:r})=>{const{tasks:i}=this.getState(),o=i.byId(a);o.lazy?n.exec("request-data",{id:o.id}):(i.toArray().forEach(c=>c.$y=0),i.update(a,{open:r}),this.setState({tasks:i}))}),n.on("scroll-chart",({left:a,top:r,date:i,eventSource:o})=>{const{_chartWidth:c,_chartHeight:d,_tasks:u,cellHeight:h,_scales:l,cellWidth:m,_start:g}=this.getState();let f={};if(i){const p=l.diff(i,g,"hour");a=Math.round(p*m)}if(!isNaN(a)){if(typeof c<"u"&&!isNaN(l.width)){const p=l.width-c;a=Math.max(Math.min(a,p),0)}f={scrollLeft:a,_scaleDate:this.calcScaleDate(a),_zoomOffset:null}}if(!isNaN(r)){if(typeof d<"u"){const p=l.height+u.length*h-d;r=Math.max(Math.min(r,p),0)}f.scrollTop=r}o==="add-task"?this.setStateAsync(f):this.setState(f)}),n.on("render-data",a=>{this.setState({area:a})}),n.on("provide-data",a=>{const{tasks:r,links:i,durationUnit:o,calendar:c,splitTasks:d}=this.getState(),u=r.byId(a.id);u.lazy?(u.lazy=!1,u.open=!0):u.data=[],ke(a.data.tasks,{durationUnit:o,calendar:c}),r.parse(a.data.tasks,a.id),u.type==="summary"&&this.resetSummaryDates(u.id,"provide-data"),this.setStateAsync({tasks:r,links:new Pt(i.map(h=>h).concat(fe(a.data.links)))})}),n.on("zoom-scale",({dir:a,ratio:r,offset:i})=>{const{zoom:o,cellWidth:c,_cellWidth:d,scrollLeft:u}=this.getState(),h=(i||0)+u,l=this.calcScaleDate(h),m=a<0&&d||c;let g=Math.round(m*(1+a*(r||.15)));const{maxCellWidth:f,minCellWidth:p}=o.levels[o.level],y=a<0&&c>f;if(g<p||g>f||y){if(!this.changeScale(o,a))if(g=Math.max(Math.min(g,f),p),g!==c)this.setState({cellWidth:g,_cellWidth:g});else return}else this.setState({cellWidth:g,_cellWidth:g});const{_scales:k,_start:b,cellWidth:_,_weekStart:v}=this.getState(),M=W(k.minUnit,b,v),P=k.diff(l,M,"hour");typeof i>"u"&&(i=_);let T=Math.round(P*_)-i;T<0&&(T=0),this.setState({scrollLeft:T,_scaleDate:l,_zoomOffset:i})}),n.on("sort-tasks",({key:a,order:r,add:i})=>{const o=this.getState(),{tasks:c,columns:d}=o;let u=o._sort;const h={key:a,order:r};let l=u?.length||0;l&&i?(u.forEach((m,g)=>{m.key===a&&(l=g)}),u[l]=h):u=[h],c.sort(u,d),this.setState({_sort:u,tasks:c})}),n.on("filter-tasks",a=>{const{open:r,key:i,value:o}=a;let c=a.filter;const d=this.getState(),{tasks:u,columns:h}=d;let l=d.filterValues;i?l={...l,[i]:o}:Object.keys(a).length||(l={}),!c&&Object.values(l).some(m=>m||m===0)&&(c=He(l,h)),u.filterTree(c,r??!0),this.setState({tasks:u,_isFiltered:!!c,filterValues:l})}),n.on("hotkey",({key:a,event:r,eventSource:i})=>{switch(a){case"arrowup":case"arrowdown":{const{selected:o,_tasks:c}=this.getState();r.preventDefault();const d=o.length;let u;if(a==="arrowup"?u=d?this.getPrevRow(o[d-1])?.id:c[c.length-1]?.id:u=d?this.getNextRow(o[d-1])?.id:c[0]?.id,u){const h=i==="chart"?"xy":!0,l=i;this.in.exec("select-task",{id:u,show:h,focus:l})}break}case"ctrl+c":{G(this,"copy-task",null,null);break}case"ctrl+x":{G(this,"cut-task",null,null);break}case"ctrl+v":{G(this,"paste-task",null,null);break}case"ctrl+d":case"backspace":{r.preventDefault(),G(this,"delete-task",null,null);break}case"ctrl+z":{this.in.exec("undo",{});break}case"ctrl+y":{this.in.exec("redo",{});break}}}),n.on("resize-chart",({width:a,height:r,scrollSize:i})=>{let o={};const c=this.getState();a>c._scales?.width&&(o=Cs(a,c)),this.setState({...o,_chartWidth:a,_chartHeight:r,_scrollSize:i})})}init(e){const n=this.getState().area?{}:{scrollLeft:0,scrollTop:0,area:{from:0,start:0,end:0},_isFiltered:!1,filterValues:{}};if(e.cellWidth&&(e._cellWidth=e.cellWidth),e._sort=null,e.unscheduledTasks=!1,e.baselines=!1,e.markers=[],e._markers=[],e.undo=!1,e.schedule={},e.criticalPath=null,e.splitTasks=!1,e.summary={},e.rollups=!1,e._rollups={},e.slack=!1,!e.tasks._ready&&Array.isArray(e.tasks)){e.tasks._ready=!0,this.getHistory()?.resetHistory();const s=this.getState();s.tasks&&s._isFiltered&&(this.setState({_isFiltered:!1,filterValues:{}}),s.tasks.filterTree())}this._router.init({selected:[],markers:[],autoScale:!0,durationUnit:"day",focusTask:null,...n,...e})}setState(e,n){return this._router.setState(e,n)}setStateAsync(e){this._router.setStateAsync(e)}getTask(e){const{tasks:n}=this.getState();return n.byId(e)}getHistory(){return this.getState().undo?this._modules.get("historyManager"):null}serialize(){return this.getState().tasks.serialize()}changeScale(e,n){const s=e.level+n,a=e.levels[s];if(a){const{cellWidth:r,scales:i,_scales:o}=this.getState(),c=Ps(e,n,s,a,o.lengthUnit,i,r);return c._cellWidth=c.cellWidth,this.setState(c),!0}return!1}isScheduled(e){return this.getState().unscheduledTasks?e.some(n=>!n.unscheduled||n.data&&this.isScheduled(n.data)):!0}resetSummaryDates(e,n,s){const{tasks:a,durationUnit:r,splitTasks:i,calendar:o}=this.getState(),c=a.byId(e),d=c.data;if(d?.length&&this.isScheduled(d)){const u=bt({...c,start:void 0,end:void 0,duration:void 0});if(!z(c.start,u.start)||!z(c.end,u.end)){s?(N(u,{durationUnit:r,calendar:o}),a.update(e,u)):this.in.exec("update-task",{id:e,task:u,eventSource:n,skipUndo:!0});const h=a.getSummaryId(e);h&&this.resetSummaryDates(h,n)}}}moveSummaryKids(e,n,s){const{tasks:a}=this.getState();e.data.forEach(r=>{const i={...a.byId(r.id),start:n(r.start)};delete i.end,delete i.id,this.in.exec("update-task",{id:r.id,task:i,eventSource:s,skipUndo:!0}),r.data?.length&&this.moveSummaryKids(r,n,s)})}calcScaleDate(e){const{_scales:n,_start:s,_weekStart:a}=this.getState(),r=n.lengthUnit==="day"?n.lengthUnitWidth/24:n.lengthUnitWidth;return I("hour")(W(n.minUnit,s,a),Math.floor(e/r))}getNextRow(e){const n=this.getState()._tasks,s=n.findIndex(a=>a.id===e);return n[s+1]}getPrevRow(e){const n=this.getState()._tasks,s=n.findIndex(a=>a.id===e);return n[s-1]}scrollToTask(e,n,s){const{_chartWidth:a,_chartHeight:r,scrollLeft:i,scrollTop:o,cellWidth:c,cellHeight:d,tasks:u,_tasks:h,_scrollSize:l}=this.getState(),m=this.getTask(e),g={eventSource:s};if(n?.toString().indexOf("x")!==-1){if(m.$x+m.$w/2<i)g.left=Math.max(m.$x-(c||0),0);else if(m.$x+m.$w/2>=a+i){const p=a<m.$w?c:m.$w;g.left=m.$x-a+p}}const f=(s==="add-task"?u.toArray():h).findIndex(p=>p.id===e);if(f>-1){const p=f*d;let y=null;p<o?y=p:p+d>o+r&&(y=p-r+d+l),y!==null&&(g.top=Math.max(y,0)),this.in.exec("scroll-chart",g)}}}function Js(t,e,n,s){if(typeof document>"u")return"";const a=document.createElement("canvas");{const r=Ks(a,t,e,1,n);Zs(r,s,0,t,0,e)}return a.toDataURL()}function Ks(t,e,n,s,a){t.setAttribute("width",(e*s).toString()),t.setAttribute("height",(n*s).toString());const r=t.getContext("2d");return r.translate(-.5,-.5),r.strokeStyle=a,r}function Zs(t,e,n,s,a,r){t.beginPath(),t.moveTo(s,a),t.lineTo(s,r),e==="full"&&t.lineTo(n,r),t.stroke()}const vt=[{id:"task",label:"Task"},{id:"summary",label:"Summary task"},{id:"milestone",label:"Milestone"}];function ta(t){let e=[...ve];const n=t?.taskTypes||vt,s=e.find(a=>a.id==="convert-task");return s.data=[],n.forEach(a=>{(!t?.summary?.autoConvert||a.id!=="summary")&&s.data.push(s.dataFactory(a))}),e}function St(t){return t.map(e=>{switch(e.data&&St(e.data),e.id){case"add-task:before":case"move-task:up":e.isDisabled=(n,s)=>na(n,s);break;case"move-task:down":e.isDisabled=(n,s)=>sa(n,s);break;case"indent-task:add":e.isDisabled=(n,s)=>aa(n,s)===n.parent;break;case"indent-task:remove":e.isDisabled=n=>ea(n);break}return e})}function ea(t){return t.parent===0}function na(t,e){const{_tasks:n}=e;return n[0]?.id===t.id}function sa(t,e){const{_tasks:n}=e;return n[n.length-1]?.id===t.id}function aa(t,e){const{_tasks:n}=e,s=n.findIndex(a=>a.id===t.id);return n[s-1]?.id??t.parent}function xe(t){return t&&typeof t=="object"}function ra(t){return!t.selected||t.selected.length<2}const ia=t=>e=>e.type===t,ve=St([{id:"add-task",text:"Add",icon:"wxi-plus",data:[{id:"add-task:child",text:"Child task"},{id:"add-task:before",text:"Task above"},{id:"add-task:after",text:"Task below"}]},{type:"separator"},{id:"convert-task",text:"Convert to",icon:"wxi-swap-horizontal",dataFactory:t=>({id:`convert-task:${t.id}`,text:`${t.label}`,isDisabled:ia(t.id)})},{id:"edit-task",text:"Edit",icon:"wxi-edit",isHidden:(t,e,n)=>xe(n)},{type:"separator"},{id:"cut-task",text:"Cut",icon:"wxi-content-cut",subtext:"Ctrl+X"},{id:"copy-task",text:"Copy",icon:"wxi-content-copy",subtext:"Ctrl+C"},{id:"paste-task",text:"Paste",icon:"wxi-content-paste",subtext:"Ctrl+V"},{id:"move-task",text:"Move",icon:"wxi-swap-vertical",data:[{id:"move-task:up",text:"Up"},{id:"move-task:down",text:"Down"}]},{type:"separator"},{id:"indent-task:add",text:"Indent",icon:"wxi-indent"},{id:"indent-task:remove",text:"Outdent",icon:"wxi-unindent"},{type:"separator"},{id:"delete-task",icon:"wxi-delete",text:"Delete",subtext:"Ctrl+D / BS",isHidden:(t,e,n)=>ra(e)&&xe(n)}]);function oa(t){return[...Se]}const Se=St([{id:"add-task",comp:"button",icon:"wxi-plus",text:"New task",type:"primary"},{id:"edit-task",comp:"icon",icon:"wxi-edit",menuText:"Edit",text:"Ctrl+E"},{id:"delete-task",comp:"icon",icon:"wxi-delete",menuText:"Delete",text:"Ctrl+D, Backspace"},{comp:"separator"},{id:"move-task:up",comp:"icon",icon:"wxi-angle-up",menuText:"Move up"},{id:"move-task:down",comp:"icon",icon:"wxi-angle-down",menuText:"Move down"},{comp:"separator"},{id:"copy-task",comp:"icon",icon:"wxi-content-copy",menuText:"Copy",text:"Ctrl+V"},{id:"cut-task",comp:"icon",icon:"wxi-content-cut",menuText:"Cut",text:"Ctrl+X"},{id:"paste-task",comp:"icon",icon:"wxi-content-paste",menuText:"Paste",text:"Ctrl+V"},{comp:"separator"},{id:"indent-task:add",comp:"icon",icon:"wxi-indent",menuText:"Indent"},{id:"indent-task:remove",comp:"icon",icon:"wxi-unindent",menuText:"Outdent"}]);function Mt(t){return t.type==="summary"}function Dt(t){return t.type==="milestone"}function Tt(t){return typeof t.parent>"u"}function It(t,e){return e.unscheduledTasks&&t.unscheduled}function ca(t){const e=Me.map(s=>({...s})),n=e.find(s=>s.key==="type");return n.options=t?.taskTypes||vt,e}const Me=[{key:"text",comp:"text",label:"Name",config:{placeholder:"Add task name"}},{key:"details",comp:"textarea",label:"Description",config:{placeholder:"Add description"}},{key:"type",comp:"select",label:"Type",isHidden:t=>Tt(t)},{key:"start",comp:"date",label:"Start date",config:{format:"%d-%m-%Y"},isHidden:t=>Mt(t),isDisabled:It},{key:"end",comp:"date",label:"End date",config:{format:"%d-%m-%Y"},isHidden:t=>Mt(t)||Dt(t),isDisabled:It},{key:"duration",comp:"counter",label:"Duration",config:{min:1},isHidden:t=>Mt(t)||Dt(t),isDisabled:It},{key:"progress",comp:"slider",label:"Progress",config:{min:1,max:100},isHidden:t=>Dt(t)||Tt(t)},{key:"links",comp:"links",label:"",isHidden:t=>Tt(t)}];export{Vs as DataStore,Xs as defaultColumns,Me as defaultEditorItems,ve as defaultMenuOptions,vt as defaultTaskTypes,Se as defaultToolbarButtons,Ns as extendDragOptions,is as format,I as getAdder,et as getDiffer,ca as getEditorItems,ta as getMenuOptions,oa as getToolbarButtons,W as getUnitStart,Js as grid,G as handleAction,pe as isHandledAction,Fs as isSegmentMoveAllowed,fe as normalizeLinks,$s as normalizeZoom,ke as parseTaskDates,js as placeLink,Rs as prepareEditTask,Ds as registerScaleUnit};
1
+ var Ft=new Date().valueOf(),ze=()=>Ft++;function Nt(){return"temp://"+Ft++}function je(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in t){const s=e[n],r=t[n];if(!J(s,r))return!1}return!0}function J(e,t){if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e===null)return e===t;if(typeof e!=typeof t||(e===null||t===null)&&e!==t||e instanceof Date&&t instanceof Date&&e.getTime()!==t.getTime())return!1;if(typeof e=="object")if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=e.length-1;n>=0;n--)if(!J(e[n],t[n]))return!1;return!0}else return je(e,t);return e===t}var K=class{constructor(e){this._data=e,this._pool=new Map;for(let t=0;t<e.length;t++){const n=e[t];this._pool.set(n.id,n)}}add(e){e={id:ze(),...e},this._data.push(e),this._pool.set(e.id,e)}update(e,t){const n=this._data.findIndex(r=>r.id==e),s={...this._data[n],...t};this._data[n]=s,this._pool.set(s.id,s)}remove(e){this._data=this._data.filter(t=>t.id!=e),this._pool.delete(e)}filter(e){this._data=this._data.filter(t=>{const n=e(t);return n||this._pool.delete(t.id),n})}byId(e){return this._pool.get(e)}map(e){return this._data.map(e)}forEach(e){this._data.forEach(e)}},Bt=class{constructor(e){const t={id:0,$level:0,data:[],parent:null},n=new Map;n.set(0,t),this._pool=n,e&&e.length&&this.parse(e,0)}parse(e,t){const n=this._pool;for(let r=0;r<e.length;r++){const a=e[r];a.parent=a.parent||t,a.data=null,n.set(a.id,a)}for(let r=0;r<e.length;r++){const a=e[r],i=n.get(a.parent);i&&(i.data||(i.data=[]),i.data.push(a))}const s=n.get(t);this.setLevel(s,s.$level+1,!1)}add(e,t){const n=this._pool.get(e.parent||0);e.$level=n.$level+1,this._pool.set(e.id,e),n.data?t===-1?n.data=[...n.data,e]:zt(n,t,e):n.data=[e]}addAfter(e,t){if(!t)return this.add(e,-1);const n=this.byId(t),s=this.byId(n.parent),r=Z(s,n.id)+1;e.parent=s.id,e.$level=s.$level+1,this.add(e,r)}remove(e){const t=this._pool.get(e);this._remove(t);const n=this._pool.get(t.parent);n.data=n.data.filter(s=>s.id!=e),this._clearBranch(n)}_remove(e){e.data&&e.data.forEach(t=>this._remove(t)),this._pool.delete(e.id)}update(e,t){let n=this._pool.get(e);const s=this._pool.get(n.parent),r=Z(s,n.id);n={...n,...t},s&&r>=0&&(s.data[r]=n,s.data=[...s.data]),this._pool.set(n.id,n)}move(e,t,n){const s=this._pool.get(e),r=t==="child",a=this._pool.get(n),i=a.$level+(r?1:0);if(!s||!a)return;const o=this._pool.get(s.parent),c=r?a:this._pool.get(a.parent);c.data||(c.data=[]);const d=Z(o,s.id);Le(o,d);const l=r?c.data.length:Z(c,a.id)+(t==="after"?1:0);if(zt(c,l,s),o.id===c.id&&d===l)return null;s.parent=c.id,s.$level!==i&&(s.$level=i,this.setLevel(s,i+1,!0)),this.update(s.id,s),this._clearBranch(o)}_clearBranch(e){e.data&&!e.data.length&&(e.open&&delete e.open,this.update(e.id,{data:null}))}toArray(){const e=[],t=this._pool.get(0).data;return t&&Yt(t,e),e}byId(e){return this._pool.get(e)}getBranch(e){return this._pool.get(e).data}forEach(e){this._pool.forEach((t,n)=>{n!==0&&e(t)})}eachChild(e,t){const n=this.byId(t);!n||!n.data||n.data.forEach((s,r)=>{e(this.byId(s.id),r),this.eachChild(e,s.id)})}setLevel(e,t,n){e.data&&(e.data=e.data.map(s=>(n&&(s={...s},this._pool.set(s.id,s)),s.$level=t,s.data&&this.setLevel(s,t+1,n),s)))}};function Yt(e,t){e.forEach(n=>{t.push(n),n.open===!0&&Yt(n.data,t)})}function Le(e,t){const n=[...e.data];n.splice(t,1),e.data=n}function zt(e,t,n){const s=[...e.data];s.splice(t,0,n),e.data=s}function Z(e,t){return e?.data.findIndex(n=>n.id===t)}var jt=2,Ue=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,t=0){const n={};return this._wrapProperties(e,this._state,this._values,"",n,t),n}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,t,n,s,r,a){for(const i in e){const o=t[i],c=n[i],d=e[i];if(o&&(c===d&&typeof d!="object"||d instanceof Date&&c instanceof Date&&c.getTime()===d.getTime()))continue;const l=s+(s?".":"")+i;o?(o.__parse(d,l,r,a)&&(n[i]=d),a&jt?r[l]=o.__trigger:o.__trigger()):(d&&d.__reactive?t[i]=this._wrapNested(d,d,l,r):t[i]=this._wrapWritable(d),n[i]=d),r[l]=r[l]||null}}_wrapNested(e,t,n,s){const r=this._wrapWritable(e);return this._wrapProperties(e,r,t,n,s,0),r.__parse=(a,i,o,c)=>(this._wrapProperties(a,r,t,i,o,c),!1),r}_wrapWritable(e){const t=[],n=function(){for(let s=0;s<t.length;s++)t[s](e)};return{subscribe:s=>(t.push(s),this._async?setTimeout(s,1,e):s(e),()=>{const r=t.indexOf(s);r>=0&&t.splice(r,1)}),__trigger:()=>{t.length&&(this._async?setTimeout(n,1):n())},__parse:function(s){return e=s,!0}}}},qe=class{constructor(e,t,n,s){typeof e=="function"?this._setter=e:this._setter=e.setState.bind(e),this._routes=t,this._parsers=n,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(r=>{r.in.forEach(a=>{const i=this._triggers.get(a)||[];i.push(r),this._triggers.set(a,i)}),r.out.forEach(a=>{const i=this._sources.get(a)||{};r.in.forEach(o=>i[o]=!0),this._sources.set(a,i)})}),this._routes.forEach(r=>{r.length=Math.max(...r.in.map(a=>Lt(a,this._sources,1)))}),this._bus=s}init(e){const t={};for(const n in e)if(this._prev[n]!==e[n]){const s=this._parsers[n];t[n]=s?s(e[n]):e[n]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(t),this._bus&&this._bus.exec("init-state",t)}setStateAsync(e){const t=this._setter(e,jt);return this._async?Object.assign(this._async.signals,t):this._async={signals:t,timer:setTimeout(this._applyState.bind(this),1)},t}_applyState(){const e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(const t in e.signals){const n=e.signals[t];n&&n()}}}setState(e,t=[]){const n=this._setter(e);return this._triggerUpdates(n,t),n}_triggerUpdates(e,t){const n=Object.keys(e),s=!t.length;t=t||[];for(let r=0;r<n.length;r++){const a=n[r],i=this._triggers.get(a);i&&i.forEach(o=>{t.indexOf(o)==-1&&t.push(o)})}s&&this._execNext(t)}_execNext(e){for(;e.length;){e.sort((n,s)=>n.length<s.length?1:-1);const t=e[e.length-1];e.splice(e.length-1),t.exec(e)}}};function Lt(e,t,n){const s=t.get(e);if(!s)return n;const r=Object.keys(s).map(a=>Lt(a,t,n+1));return Math.max(...r)}var Xe=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(e,t,n){let s=this._handlers[e];s?n&&n.intercept?s.unshift(t):s.push(t):s=this._handlers[e]=[t],n&&n.tag&&this._tag.set(t,n.tag)}intercept(e,t,n){this.on(e,t,{...n,intercept:!0})}detach(e){for(const t in this._handlers){const n=this._handlers[t];for(let s=n.length-1;s>=0;s--)this._tag.get(n[s])===e&&n.splice(s,1)}}async exec(e,t){const n=this._handlers[e];if(n)for(let s=0;s<n.length;s++){const r=n[s](t);if(r===!1||r&&r.then&&await r===!1)return}return this._nextHandler&&await this._nextHandler.exec(e,t),t}setNext(e){return this._nextHandler=e}};new Date().valueOf();function Ge(e){return t=>t[e]}function lt(e,t){return(t.getter||Ge(t.id))(e)}const Re={text:(e,t)=>e?e.toString().toLowerCase().indexOf(t.toLowerCase())!==-1:!t,richselect:(e,t)=>typeof t!="number"&&!t?!0:e==t,datepicker:(e,t)=>t?e&&Je(e,t):!0,multiselect:(e,t)=>!t||t?.length===0?!0:Array.isArray(e)?e?.some(n=>t.includes(n)):e&&t.includes(e)};function Qe(e){return Re[e]}function Ve(e,t){const n=[];for(const s in e){const r=t.find(c=>c.id==s),{config:a,type:i}=r.header.find(c=>c.filter).filter,o=e[s];n.push(c=>{const d=lt(c,r);return a?.handler?a.handler(d,o):Qe(i)(d,o)})}return s=>{for(let r=0;r<n.length;r++)if(!n[r](s))return!1;return!0}}function Je(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}new Date().valueOf(),new Date().valueOf();function Ke(e,t){return typeof e=="string"?e.localeCompare(t,void 0,{numeric:!0}):e instanceof Date||t instanceof Date?e?t?e.getTime()-t.getTime():-1:1:(e??0)-(t??0)}function Ze(e,t){return typeof e=="string"?-e.localeCompare(t,void 0,{numeric:!0}):e instanceof Date||t instanceof Date?t?e?t.getTime()-e.getTime():-1:1:(t??0)-(e??0)}function tn({order:e,key:t},n){if(typeof n?.sort=="function")return function(r,a){const i=n.sort(r,a);return e==="asc"?i:-i};const s=e==="asc"?Ke:Ze;return(r,a)=>s(n?lt(r,n):r[t],n?lt(a,n):a[t])}function en(e,t){if(!e||!e.length)return;const n=e.map(s=>{const r=t.find(a=>a.id==s.key);return tn(s,r)});return e.length===1?n[0]:function(s,r){for(let a=0;a<n.length;a++){const i=n[a](s,r);if(i!==0)return i}return 0}}function nn(e,t,n){return e.sort(en(t,n))}function Ut(e,t,n,s){const r=e.id===0||t(e);let a=!1;if(Array.isArray(e.data)){for(const i of e.data)Ut(i,t,n,s)&&(a=!0);a?(delete e.$empty,s&&(e.open=!0)):e.$empty=!0}return(r||a)&&e.id!==0?(n.add(e.id),!0):!1}function qt(e,t,n){e.has(t)&&e.delete(t),n?.length&&n.forEach(s=>qt(e,s.id,s.data))}function Xt(e){e.id!==0&&delete e.$empty,Array.isArray(e.data)&&e.data.forEach(t=>Xt(t))}class Gt extends Bt{_filteredIds;constructor(t){super(),this.parse(t,0)}parse(t,n){if(!t||!t.length)return;const s=t.map(r=>this.normalizeTask(r));super.parse(s,n)}getBranch(t){const n=this._pool.get(t);return this._pool.get(n.parent||0).data}contains(t,n){const s=this._pool.get(t).data;let r=!1;if(s)for(let a=0;a<s.length;a++){if(s[a].id===n){r=!0;break}if(s[a].data&&(r=this.contains(s[a].id,n),r))break}return r}getIndexById(t){return this.getBranch(t).findIndex(n=>n.id===t)}add(t,n){const s=this.normalizeTask(t);if(super.add(s,n),this._filteredIds&&this._filteredIds.add(s.id),this._filteredIds&&t.parent){const r=this.byId(t.parent);this.hasChildItems(r)&&delete r.$empty}return s}copy(t,n,s){const r=this.add({...t,id:null,data:null,parent:n},s);let a=[[t.id,r.id]];return t.data?.forEach((i,o)=>{const c=this.copy(i,r.id,o);a=a.concat(c)}),a}remove(t){const n=this.byId(t);if(this._filteredIds&&qt(this._filteredIds,t,n.data),super.remove(t),this._filteredIds&&n.parent){const s=this.byId(n.parent);this.hasChildItems(s)||(s.$empty=!0)}}normalizeTask(t){const n=t.id||Nt(),s=t.parent||0,r=t.text??"",a=t.type||"task",i=t.progress||0,o=t.details||"",c={...t,id:n,text:r,parent:s,progress:i,type:a,details:o};return t.segments&&(c.segments=t.segments.map(d=>({...d}))),t.segments&&(c.segments=t.segments.map(d=>({...d}))),c}getSummaryId(t,n=!1){const s=this._pool.get(t);if(!s.parent)return null;const r=this._pool.get(s.parent);if(n){let a=t,i=this.getSummaryId(a);const o=[];for(;i;)a=i,o.push(i),i=this.getSummaryId(a);return o}return r.type==="summary"?r.id:this.getSummaryId(r.id)}sort(t,n){t&&this.sortBranch(t,0,n)}sortBranch(t,n,s){const r=this._pool.get(n||0).data;r&&(nn(r,t,s),r.forEach(a=>{this.sortBranch(t,a.id,s)}))}serialize(){const t=[],n=this._pool.get(0).data;return n&&Rt(n,t),t}clear(){this.forEach(t=>{this.remove(t.id)})}filterTree(t,n){if(t){const s=this._pool.get(0),r=new Set;Ut(s,t,r,n),this._filteredIds=r}else{const s=this._pool.get(0);Xt(s),this._filteredIds=null}}toArray(t){let n=super.toArray();return!t&&this._filteredIds&&(n=n.filter(s=>this.isFilteredId(s.id))),n}isFilteredId(t){return this._filteredIds?.has(t)}hasChildItems(t){const n=t.data?.length;return n&&this._filteredIds?t.data.some(s=>this.isFilteredId(s.id)):!!n}}function Rt(e,t){e.forEach(n=>{t.push(n),n.data&&Rt(n.data,t)})}function b(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function $(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function tt(e,t){const n=b(e);return isNaN(t)?$(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function ut(e,t){const n=b(e);if(isNaN(t))return $(e,NaN);if(!t)return n;const s=n.getDate(),r=$(e,n.getTime());r.setMonth(n.getMonth()+t+1,0);const a=r.getDate();return s>=a?r:(n.setFullYear(r.getFullYear(),r.getMonth(),s),n)}function Qt(e,t){const n=+b(e);return $(e,n+t)}const et=6048e5,sn=864e5,Vt=6e4,Jt=36e5;function an(e,t){return Qt(e,t*Jt)}let rn={};function U(){return rn}function E(e,t){const n=U(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=b(e),a=r.getDay(),i=(a<s?7:0)+a-s;return r.setDate(r.getDate()-i),r.setHours(0,0,0,0),r}function Y(e){return E(e,{weekStartsOn:1})}function Kt(e){const t=b(e),n=t.getFullYear(),s=$(e,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const r=Y(s),a=$(e,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const i=Y(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function A(e){const t=b(e);return t.setHours(0,0,0,0),t}function nt(e){const t=b(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function ht(e,t){const n=A(e),s=A(t),r=+n-nt(n),a=+s-nt(s);return Math.round((r-a)/sn)}function ft(e){const t=Kt(e),n=$(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Y(n)}function on(e,t){return Qt(e,t*Vt)}function cn(e,t){const n=t*3;return ut(e,n)}function Zt(e,t){const n=t*7;return tt(e,n)}function dn(e,t){return ut(e,t*12)}function q(e,t){const n=b(e),s=b(t),r=n.getTime()-s.getTime();return r<0?-1:r>0?1:r}function ln(e,t){const n=A(e),s=A(t);return+n==+s}function un(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function hn(e){if(!un(e)&&typeof e!="number")return!1;const t=b(e);return!isNaN(Number(t))}function gt(e,t){const n=Y(e),s=Y(t),r=+n-nt(n),a=+s-nt(s);return Math.round((r-a)/et)}function fn(e,t){const n=b(e),s=b(t),r=n.getFullYear()-s.getFullYear(),a=n.getMonth()-s.getMonth();return r*12+a}function gn(e,t){const n=b(e),s=b(t);return n.getFullYear()-s.getFullYear()}function mt(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function te(e,t){return+b(e)-+b(t)}function mn(e,t,n){const s=te(e,t)/Jt;return mt(n?.roundingMethod)(s)}function pn(e,t,n){const s=te(e,t)/Vt;return mt(n?.roundingMethod)(s)}function ee(e){const t=b(e);return t.setHours(23,59,59,999),t}function pt(e){const t=b(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function yn(e){const t=b(e);return+ee(t)==+pt(t)}function ne(e,t){const n=b(e),s=b(t),r=q(n,s),a=Math.abs(fn(n,s));let i;if(a<1)i=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*a);let o=q(n,s)===-r;yn(b(e))&&a===1&&q(e,s)===1&&(o=!1),i=r*(a-Number(o))}return i===0?0:i}function kn(e,t,n){const s=ne(e,t)/3;return mt(n?.roundingMethod)(s)}function _n(e,t){const n=b(e),s=b(t),r=q(n,s),a=Math.abs(gn(n,s));n.setFullYear(1584),s.setFullYear(1584);const i=q(n,s)===-r,o=r*(a-+i);return o===0?0:o}function X(e){const t=b(e),n=t.getMonth(),s=n-n%3;return t.setMonth(s,1),t.setHours(0,0,0,0),t}function se(e){const t=b(e);return t.setDate(1),t.setHours(0,0,0,0),t}function bn(e){const t=b(e),n=t.getFullYear();return t.setFullYear(n+1,0,0),t.setHours(23,59,59,999),t}function ae(e){const t=b(e),n=$(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function wn(e){const t=b(e);return t.setMinutes(59,59,999),t}function xn(e,t){const n=U(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=b(e),a=r.getDay(),i=(a<s?-7:0)+6-(a-s);return r.setDate(r.getDate()+i),r.setHours(23,59,59,999),r}function yt(e){const t=b(e),n=t.getMonth(),s=n-n%3+3;return t.setMonth(s,0),t.setHours(23,59,59,999),t}const Sn={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},vn=(e,t,n)=>{let s;const r=Sn[e];return typeof r=="string"?s=r:t===1?s=r.one:s=r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function kt(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Mn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Tn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Dn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Wn={date:kt({formats:Mn,defaultWidth:"full"}),time:kt({formats:Tn,defaultWidth:"full"}),dateTime:kt({formats:Dn,defaultWidth:"full"})},$n={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},In=(e,t,n,s)=>$n[e];function G(e){return(t,n)=>{const s=n?.context?String(n.context):"standalone";let r;if(s==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,o=n?.width?String(n.width):i;r=e.formattingValues[o]||e.formattingValues[i]}else{const i=e.defaultWidth,o=n?.width?String(n.width):e.defaultWidth;r=e.values[o]||e.values[i]}const a=e.argumentCallback?e.argumentCallback(t):t;return r[a]}}const Cn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Pn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},En={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},On={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},An={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Hn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Fn=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Nn={ordinalNumber:Fn,era:G({values:Cn,defaultWidth:"wide"}),quarter:G({values:Pn,defaultWidth:"wide",argumentCallback:e=>e-1}),month:G({values:En,defaultWidth:"wide"}),day:G({values:On,defaultWidth:"wide"}),dayPeriod:G({values:An,defaultWidth:"wide",formattingValues:Hn,defaultFormattingWidth:"wide"})};function R(e){return(t,n={})=>{const s=n.width,r=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],a=t.match(r);if(!a)return null;const i=a[0],o=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(o)?Yn(o,h=>h.test(i)):Bn(o,h=>h.test(i));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const l=t.slice(i.length);return{value:d,rest:l}}}function Bn(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Yn(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function zn(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const r=s[0],a=t.match(e.parsePattern);if(!a)return null;let i=e.valueCallback?e.valueCallback(a[0]):a[0];i=n.valueCallback?n.valueCallback(i):i;const o=t.slice(r.length);return{value:i,rest:o}}}const jn=/^(\d+)(th|st|nd|rd)?/i,Ln=/\d+/i,Un={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},qn={any:[/^b/i,/^(a|c)/i]},Xn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Gn={any:[/1/i,/2/i,/3/i,/4/i]},Rn={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Qn={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Vn={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Jn={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Kn={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Zn={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ts={ordinalNumber:zn({matchPattern:jn,parsePattern:Ln,valueCallback:e=>parseInt(e,10)}),era:R({matchPatterns:Un,defaultMatchWidth:"wide",parsePatterns:qn,defaultParseWidth:"any"}),quarter:R({matchPatterns:Xn,defaultMatchWidth:"wide",parsePatterns:Gn,defaultParseWidth:"any",valueCallback:e=>e+1}),month:R({matchPatterns:Rn,defaultMatchWidth:"wide",parsePatterns:Qn,defaultParseWidth:"any"}),day:R({matchPatterns:Vn,defaultMatchWidth:"wide",parsePatterns:Jn,defaultParseWidth:"any"}),dayPeriod:R({matchPatterns:Kn,defaultMatchWidth:"any",parsePatterns:Zn,defaultParseWidth:"any"})},es={code:"en-US",formatDistance:vn,formatLong:Wn,formatRelative:In,localize:Nn,match:ts,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ns(e){const t=b(e);return ht(t,ae(t))+1}function ss(e){const t=b(e),n=+Y(t)-+ft(t);return Math.round(n/et)+1}function re(e,t){const n=b(e),s=n.getFullYear(),r=U(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=$(e,0);i.setFullYear(s+1,0,a),i.setHours(0,0,0,0);const o=E(i,t),c=$(e,0);c.setFullYear(s,0,a),c.setHours(0,0,0,0);const d=E(c,t);return n.getTime()>=o.getTime()?s+1:n.getTime()>=d.getTime()?s:s-1}function as(e,t){const n=U(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=re(e,t),a=$(e,0);return a.setFullYear(r,0,s),a.setHours(0,0,0,0),E(a,t)}function rs(e,t){const n=b(e),s=+E(n,t)-+as(n,t);return Math.round(s/et)+1}function S(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const O={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return S(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):S(n+1,2)},d(e,t){return S(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return S(e.getHours()%12||12,t.length)},H(e,t){return S(e.getHours(),t.length)},m(e,t){return S(e.getMinutes(),t.length)},s(e,t){return S(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),r=Math.trunc(s*Math.pow(10,n-3));return S(r,t.length)}},z={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ie={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),r=s>0?s:1-s;return n.ordinalNumber(r,{unit:"year"})}return O.y(e,t)},Y:function(e,t,n,s){const r=re(e,s),a=r>0?r:1-r;if(t==="YY"){const i=a%100;return S(i,2)}return t==="Yo"?n.ordinalNumber(a,{unit:"year"}):S(a,t.length)},R:function(e,t){const n=Kt(e);return S(n,t.length)},u:function(e,t){const n=e.getFullYear();return S(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return S(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return S(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return O.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return S(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const r=rs(e,s);return t==="wo"?n.ordinalNumber(r,{unit:"week"}):S(r,t.length)},I:function(e,t,n){const s=ss(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):S(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):O.d(e,t)},D:function(e,t,n){const s=ns(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):S(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const r=e.getDay(),a=(r-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return S(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});case"eeee":default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const r=e.getDay(),a=(r-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return S(a,t.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});case"cccc":default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),r=s===0?7:s;switch(t){case"i":return String(r);case"ii":return S(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let r;switch(s===12?r=z.noon:s===0?r=z.midnight:r=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let r;switch(s>=17?r=z.evening:s>=12?r=z.afternoon:s>=4?r=z.morning:r=z.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return O.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):O.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):S(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):S(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):O.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):O.s(e,t)},S:function(e,t){return O.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return ce(s);case"XXXX":case"XX":return H(s);case"XXXXX":case"XXX":default:return H(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return ce(s);case"xxxx":case"xx":return H(s);case"xxxxx":case"xxx":default:return H(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+oe(s,":");case"OOOO":default:return"GMT"+H(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+oe(s,":");case"zzzz":default:return"GMT"+H(s,":")}},t:function(e,t,n){const s=Math.trunc(e.getTime()/1e3);return S(s,t.length)},T:function(e,t,n){const s=e.getTime();return S(s,t.length)}};function oe(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=Math.trunc(s/60),a=s%60;return a===0?n+String(r):n+String(r)+t+S(a,2)}function ce(e,t){return e%60===0?(e>0?"-":"+")+S(Math.abs(e)/60,2):H(e,t)}function H(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=S(Math.trunc(s/60),2),a=S(s%60,2);return n+r+t+a}const de=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},le=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},is=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],r=n[2];if(!r)return de(e,t);let a;switch(s){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",de(s,t)).replace("{{time}}",le(r,t))},os={p:le,P:is},cs=/^D+$/,ds=/^Y+$/,ls=["D","DD","YY","YYYY"];function us(e){return cs.test(e)}function hs(e){return ds.test(e)}function fs(e,t,n){const s=gs(e,t,n);if(console.warn(s),ls.includes(e))throw new RangeError(s)}function gs(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ms=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ps=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ys=/^'([^]*?)'?$/,ks=/''/g,_s=/[a-zA-Z]/;function ue(e,t,n){const s=U(),r=n?.locale??s.locale??es,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,o=b(e);if(!hn(o))throw new RangeError("Invalid time value");let c=t.match(ps).map(l=>{const h=l[0];if(h==="p"||h==="P"){const u=os[h];return u(l,r.formatLong)}return l}).join("").match(ms).map(l=>{if(l==="''")return{isToken:!1,value:"'"};const h=l[0];if(h==="'")return{isToken:!1,value:bs(l)};if(ie[h])return{isToken:!0,value:l};if(h.match(_s))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:l}});r.localize.preprocessor&&(c=r.localize.preprocessor(o,c));const d={firstWeekContainsDate:a,weekStartsOn:i,locale:r};return c.map(l=>{if(!l.isToken)return l.value;const h=l.value;(!n?.useAdditionalWeekYearTokens&&hs(h)||!n?.useAdditionalDayOfYearTokens&&us(h))&&fs(h,t,String(e));const u=ie[h[0]];return u(o,h,r.localize,d)}).join("")}function bs(e){const t=e.match(ys);return t?t[1].replace(ks,"'"):e}function he(e){const t=b(e),n=t.getFullYear(),s=t.getMonth(),r=$(e,0);return r.setFullYear(n,s+1,0),r.setHours(0,0,0,0),r.getDate()}function ws(e){const t=b(e).getFullYear();return t%400===0||t%4===0&&t%100!==0}function fe(e){const t=b(e);return String(new Date(t))==="Invalid Date"?NaN:ws(t)?366:365}function xs(e){const t=ft(e),n=+ft(Zt(t,60))-+t;return Math.round(n/et)}function j(e,t){const n=b(e),s=b(t);return+n==+s}function Ss(e){const t=b(e);return t.setMinutes(0,0,0),t}function vs(e,t,n){const s=E(e,n),r=E(t,n);return+s==+r}function Ms(e,t){const n=b(e),s=b(t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function Ts(e,t){const n=X(e),s=X(t);return+n==+s}function Ds(e,t){const n=b(e),s=b(t);return n.getFullYear()===s.getFullYear()}const _t={year:_n,quarter:kn,month:ne,week:gt,day:ht,hour:mn,minute:pn},F={year:{quarter:4,month:12,week:xs,day:Ws,hour:$s},quarter:{month:3,week:Is,day:ge,hour:Cs},month:{week:Ps,day:Es,hour:Os},week:{day:7,hour:24*7},day:{hour:24},hour:{minute:60}};function Ws(e){return e?fe(e):365}function $s(e){return fe(e)*24}function Is(e){const t=X(e),n=tt(A(yt(e)),1);return gt(n,t)}function ge(e){if(e){const t=X(e),n=yt(e);return ht(n,t)+1}return 91}function Cs(e){return ge(e)*24}function Ps(e){if(e){const t=se(e),n=tt(A(pt(e)),1);return gt(n,t)}return 5}function Es(e){return e?he(e):30}function Os(e){return he(e)*24}function st(e,t,n){const s=F[e][t];return s?typeof s=="number"?s:s(n):1}function As(e,t){return e===t||!!(F[e]&&F[e][t])}const at={year:dn,quarter:cn,month:ut,week:Zt,day:tt,hour:an,minute:on};function rt(e,t,n){if(t){if(e==="day")return(s,r)=>t.getWorkingDays(r,s,!0);if(e==="hour")return(s,r)=>t.getWorkingHours(r,s,!0)}return(s,r,a,i)=>{const o=F[e]?.[a];return!o||typeof o=="number"||ye(e,s,r,n)?Q(e,s,r,a,i,n):Hs(s,r,e,a,i,n)}}function Q(e,t,n,s,r,a){const i=s||e;let o=n,c=t;if(r&&(o=C(i,n,a),c=C(i,t,a),c<t&&(c=I(i)(c,1))),e!==i){const d=_t[i](c,o),l=st(e,i,n);return d/l}else return _t[i](c,o)}function Hs(e,t,n,s,r,a){let i=0;const o=C(n,t,a);if(t>o){const d=at[n](o,1);i=Q(n,d,t,s,void 0,a),t=d}let c=0;return ye(n,t,e,a)||(c=Q(n,C(n,e,a),t,void 0,void 0,a),t=at[n](t,c)),c+=i+Q(n,e,t,s,void 0,a),!c&&r&&(c=Q(n,e,t,s,r,a)),c}function I(e,t){if(t){if(e==="day")return(n,s)=>t.addWorkingDays(n,s,!0);if(e==="hour")return(n,s)=>t.addWorkingHours(n,s)}return at[e]}const me={year:ae,quarter:X,month:se,week:(e,t)=>E(e,{weekStartsOn:t}),day:A,hour:Ss};function C(e,t,n){const s=me[e];return s?s(t,n):new Date(t)}const Fs={year:bn,quarter:yt,month:pt,week:(e,t)=>xn(e,{weekStartsOn:t}),day:ee,hour:wn},pe={year:Ds,quarter:Ts,month:Ms,week:(e,t,n)=>vs(e,t,{weekStartsOn:n}),day:ln};function ye(e,t,n,s){const r=pe[e];return r?r(t,n,s):!1}const Ns={start:me,end:Fs,add:at,isSame:pe,diff:_t,smallerCount:F},ke=e=>typeof e=="function"?e(new Date):e;function Bs(e,t){for(const n in t){if(n==="smallerCount"){const s=Object.keys(t[n]).sort((o,c)=>P.indexOf(o)-P.indexOf(c)).shift();let r=P.indexOf(s);const a=t[n][s],i=ke(a);for(let o=r-1;o>=0;o--){const c=P[o],d=ke(F[c][s]);if(i<=d)break;r=o}P.splice(r,0,e)}if(n==="biggerCount")for(const s in t[n])F[s][e]=t[n][s];else Ns[n][e]=t[n]}}function bt(e,t=1,n){return n.isWorkingDay(e)||(e=t>0?n.getNextWorkingDay(e):n.getPreviousWorkingDay(e)),e}function Ys(e){return(t,n)=>{if(n>0)for(let s=0;s<n;s++)t=e.getNextWorkingDay(t);if(n<0)for(let s=0;s>n;s--)t=e.getPreviousWorkingDay(t);return t}}function _e(e){return ue(e,"yyyy-MM-dd")}function L(e){const t=new Date;return e.map(n=>({item:n,len:I(n.unit)(t,1)})).sort((n,s)=>n.len<s.len?-1:1)[0].item}const P=["year","quarter","month","week","day","hour"],wt=50,xt=300;function zs(e,t,n,s,r,a,i,o,c){const d=!e||n,l=!t||n;let h=e,u=t,g=!1,m=!1;(d||l)&&r?.forEach(f=>{let y=f.start;c&&f.base_start<f.start&&(y=f.base_start),d&&(!h||y<=h)&&(h=y,g=!0);let k=f.type==="milestone"?f.start:f.end;if(c){const _=f.type==="milestone"?f.base_start:f.base_end;_&&_>k&&(k=_)}l&&(!u||k>=u)&&(u=k,m=!0)});const p=I(s||"day");return h?g&&(h=p(h,-1)):u?h=p(u,-30):h=new Date,u?m&&(u=p(u,1)):u=p(h,30),{_start:h,_end:u}}function js(e,t,n,s,r,a,i,o){const c=L(i).unit,d=rt(c,void 0,a),l=d(t,e,"",!0),h=C(c,t,a);e=C(c,e,a),t=h<t?I(c)(h,1):h;const u=l*s,g=r*Math.max(o,i.length),m=i.map(f=>{const y=[],k=I(f.unit);let _=C(f.unit,e,a);for(;_<t;){const w=k(_,f.step),x=_<e?e:_,v=w>t?t:w,T=d(v,x,"",!0)*s,M=typeof f.format=="function"?f.format(_,w):f.format;let D="";f.css&&(D+=typeof f.css=="function"?f.css(_):f.css),y.push({width:T,value:M,date:x,key:_e(x),css:D,unit:f.unit}),_=w}return{cells:y,add:k,height:g/i.length}});let p=s;return c!==n&&(p=p/st(c,n)),{rows:m,width:u,height:g,diff:d,start:e,end:t,lengthUnit:n,minUnit:c,lengthUnitWidth:p}}function Ls(e,t,n,s){const r=typeof e=="boolean"?{}:e,a=P.indexOf(L(n).unit);if(typeof r.level>"u"&&(r.level=a),r.levels)r.levels.forEach(c=>{c.minCellWidth||(c.minCellWidth=it(r.minCellWidth,wt)),c.maxCellWidth||(c.maxCellWidth=it(r.maxCellWidth,xt))});else{const c=[],d=n.length||1,l=it(r.minCellWidth,wt),h=it(r.maxCellWidth,xt);n.forEach(u=>{u.format&&!t[u.unit]&&(t[u.unit]=u.format)}),P.forEach((u,g)=>{if(g===a)c.push({minCellWidth:l,maxCellWidth:h,scales:n});else{const m=[];if(g)for(let p=d-1;p>0;p--){const f=P[g-p];f&&m.push({unit:f,step:1,format:t[f]})}m.push({unit:u,step:1,format:t[u]}),c.push({minCellWidth:l,maxCellWidth:h,scales:m})}}),r.levels=c}r.levels[r.level]||(r.level=0);const i=r.levels[r.level],o=Math.min(Math.max(s,i.minCellWidth),i.maxCellWidth);return{zoom:r,scales:i.scales,cellWidth:o}}function Us(e,t,n,s,r,a,i){e.level=n;let o;const c=s.scales||s,d=L(c).unit,l=Xs(d,r);if(t<0){const g=st(d,r);o=i*g}else{const g=st(L(a).unit,d);o=Math.round(i/g)}const h=s.minCellWidth??wt,u=s.maxCellWidth??xt;return{scales:c,cellWidth:Math.min(u,Math.max(h,o)),lengthUnit:l,zoom:e}}function qs(e,t){const{_start:n,_scales:s,start:r,end:a,_end:i,cellWidth:o,_scaleDate:c,_zoomOffset:d,_weekStart:l}=t,h=I(s.minUnit);let u=s.width;if(r&&a){if(u<e&&u){const y=e/u;return{cellWidth:o*y}}return{}}let g=0;for(;u<e;)u+=o,g++;let m=0;if(g){if(a)m=-g;else if(c&&d!==null){const y=d/o,k=s.diff(c,n,"hour");m=Math.floor(k-y)}}let p=r;r||(p=C(s.minUnit,h(n,m),l));let f=0;if(c){const y=s.diff(c,p,"hour");f=Math.max(0,Math.round(y*o)-(d||0))}return{_start:p,_end:a||h(i,g-m),scrollLeft:f}}function Xs(e,t){const n=P.indexOf(e),s=P.indexOf(t);return s>=n?e==="hour"?"hour":"day":P[s]}function it(e,t){return e??t}function be(e,t){const{_scales:n,_start:s,_weekStart:r}=t,a=n.lengthUnit==="day"?n.lengthUnitWidth/24:n.lengthUnitWidth;return I("hour")(C(n.minUnit,s,r),Math.floor(e/a))}const St=7,Gs=3,vt=8,we=4,Rs=vt+we;function xe(e,t,n){(e.open||e.type!=="summary"||n)&&e.data?.forEach(s=>{s.$x+=t,s.$x_rollup&&(s.$x_rollup+=t),xe(s,t,n)})}function Mt(e,t){const n=e.getSummaryId(t.id);if(n){const s=e.byId(n),r={xMin:1/0,xMax:0};Se(s,r),s.$x=r.xMin,s.$w=r.xMax-r.xMin,Mt(e,s)}}function Se(e,t){e.data?.forEach(n=>{if(!n.unscheduled){const s=n.type==="milestone"&&n.$h?n.$h/2:0;t.xMin>n.$x+s&&(t.xMin=n.$x+s);const r=n.$x+n.$w-s;t.xMax<r&&(t.xMax=r)}n.type!=="summary"&&Se(n,t)})}function Tt(e,t){let n;t&&(n=t.filter(r=>r.parent===e.id));const s={data:n,...e};if(s.data?.length)s.data.forEach(r=>{if(r.unscheduled&&!r.data)return;(t||r.type!=="summary"&&r.data)&&(r.unscheduled&&(r={...r,start:void 0,end:void 0}),r=Tt(r,t)),r.start&&(!s.start||s.start>r.start)&&(s.start=new Date(r.start));const a=r.end||r.start;a&&(!s.end||s.end<a)&&(s.end=new Date(a))});else if(e.type==="summary")throw Error("Summary tasks must have start and end dates if they have no subtasks");return s}function ve(e,t,n){return Dt(e,t,n,!1),n.splitTasks&&e.segments?.forEach(s=>{ve(s,t,{...n,baselines:!1}),s.$x-=e.$x}),n.baselines&&Dt(e,t,n,!0),e.data&&!e.open&&Me(e,n),e}function Dt(e,t,n,s){const{cellWidth:r,cellHeight:a,_scales:i,baselines:o,_rollups:c}=n,{start:d,end:l,lengthUnit:h,diff:u}=i,g=(s?"base_":"")+"start",m=(s?"base_":"")+"end",p="$x"+(s?"_base":""),f="$y"+(s?"_base":""),y="$w"+(s?"_base":""),k="$h"+(s?"_base":""),_="$skip"+(s?"_baseline":"");let w=e[g],x=e[m];if(s&&!w){e[_]=!0;return}e[g]<d&&(e[m]<d||j(e[m],d))?w=x=d:e[g]>l&&(w=x=l),e[p]=Math.round(u(w,d,h)*r),e[y]=Math.round(u(x,w,h,!0)*r),t!==null&&(e[f]=s?e.$y+e.$h+we:a*t+Gs),e[k]=s?vt:o?a-St-Rs:a-St,e.type==="milestone"&&(e[p]=e[p]-e.$h/2,e[y]=e.$h,s&&(e[f]=e.$y+vt,e[y]=e[k]=e.$h)),n.unscheduledTasks&&e.unscheduled&&!s||n.groupBy&&e.$group?e.$skip=!0:e[_]=j(w,x)}function Me(e,t,n){n=n??e.type!=="summary",e.data&&!e.$skip&&(n||t._rollups)&&e.data.forEach(s=>{(n||s.rollup)&&Dt(s,null,t,!1),Me(s,t,n)})}function Qs(e,t){return!1}function Vs(e,t){}var Te=new Date().valueOf();function Js(){return Te+=1,Te}const Wt=20,Ks=function(e,t,n,s){if(!t||!n||!t.$y||!n.$y||t.$skip||n.$skip)return e.$p="",e.$pl=0,e;let r=!1,a=!1;switch(e.type){case"e2s":a=!0;break;case"s2s":r=!0,a=!0;break;case"s2e":r=!0;break}const i=r?t.$x:t.$x+t.$w,o=t.$y+t.$h/2,c=a?n.$x:n.$x+n.$w,d=n.$y+n.$h/2,l=(s-St-n.$h)/2;if(i!==c||o!==d){const h=ta(i,o,c,d,r,a,s/2,l),u=ea(c,d,a);e.$p=`${h},${u}`,e.$pl=Zs(e.$p)}return e};function Zs(e){const t=e.split(",").map(Number),n=[];for(let r=0;r<t.length;r+=2)r+1<t.length&&n.push([t[r],t[r+1]]);let s=0;for(let r=0;r<n.length-1;r++){const[a,i]=n[r],[o,c]=n[r+1];s+=Math.hypot(o-a,c-i)}return s}function ta(e,t,n,s,r,a,i,o){const c=Wt*(r?-1:1),d=Wt*(a?-1:1),l=e+c,h=n+d,u=[e,t,l,t,0,0,0,0,h,s,n,s],g=h-l;let m=s-t;const p=a===r;return p||(h<=e+Wt-2&&a||h>e&&!a)&&(m=m-i+o),p&&a&&l>h||p&&!a&&l<h?(u[4]=u[2]+g,u[5]=u[3],u[6]=u[4],u[7]=u[5]+m):(u[4]=u[2],u[5]=u[3]+m,u[6]=u[4]+g,u[7]=u[5]),u.join(",")}function ea(e,t,n){return n?`${e-5},${t-3},${e-5},${t+3},${e},${t}`:`${e+5},${t+3},${e+5},${t-3},${e},${t}`}function na(e,t,n){if(t&&n){const s=n.x-t.x,r=n.y-t.y,a=(s>0?t.x:n.x)-e.left,i=(r>0?t.y:n.y)-e.top,o=`${s>0?0:-s},${r>0?0:-r},${s>0?s:0},${r>0?r:0}`;return{width:Math.abs(s),height:Math.abs(r),left:a,top:i,p:o}}else return null}function $t(e){return e?.map(t=>{const n=t.id||Js();return{...t,id:n}})}const ot=37,De=["start","end","duration"];function sa(e,t){const{type:n,unscheduled:s}=e;return s||n==="summary"?!De.includes(t):n==="milestone"?!["end","duration"].includes(t):!0}function aa(e,t){if(typeof t=="function")return t;const n=De.includes(e);return(n||e==="resources")&&(typeof t=="string"&&(t={type:t,config:{}}),t.config||(t.config={}),t.type==="datepicker"&&(t.config.buttons=["today"]),n)?(s,r)=>sa(s,r.id)?t:null:t}function ra(e){return!e||!e.length?[]:e.map(t=>{const n=t.align||"left",s=t.id==="add-task",r=!s&&t.flexgrow?t.flexgrow:null,a=r?1:t.width||(s?ot:120),i=t.editor&&aa(t.id,t.editor);let o=Array.isArray(t.header)?t.header:[t.header];return o=o.map(c=>(typeof c!="object"&&(c={text:c}),c.filter&&typeof c.filter!="object"&&(c.filter={type:c.filter}),c)),{width:a,align:n,header:o,id:t.id,template:t.template,_template:t._template,...r&&{flexgrow:r},cell:t.cell,resize:t.resize??!0,sort:t.sort??!s,...i&&{editor:i},...t.options&&{options:t.options},getter:t.getter}})}const We=[{id:"text",header:"Task name",flexgrow:1,sort:!0},{id:"start",header:"Start date",align:"center",sort:!0},{id:"duration",header:"Duration",width:100,align:"center",sort:!0},{id:"add-task",header:"Add task",width:ot,align:"center",sort:!1,resize:!1}];function ia(e={}){return We.map(t=>({...t}))}function oa(){return[]}function V(e,t,n,s){const r=e.getState(),{selected:a}=r,i=a.length,o=["edit-task","paste-task","undo","redo"],c=["copy-task","cut-task"],d=["copy-task","cut-task","delete-task","indent-task:remove","move-task:down"],l=["add-task","undo","redo"],h=["indent-task:add","move-task:down","move-task:up"],u={"indent-task:remove":2},g=!i&&l.includes(t),m={parent:h.includes(t),level:u[t]};if(n=n||(i?a[a.length-1]:null),!(!n&&!g)){if(t!=="paste-task"&&(e._temp=null),o.includes(t)||g||a.length===1)$e(e,t,n,s);else if(i){const p=c.includes(t)?a:ca(a,m,r);d.includes(t)&&p.reverse();const f=e.getHistory();f&&f.startBatch(),p.forEach((y,k)=>$e(e,t,y,s,k)),f&&f.endBatch()}}}function ca(e,t,n){const{tasks:s,tree:r,groupBy:a}=n;let i=e.map(o=>{let c=o;a?.field&&(c=r.byId(c)?.$id||c);const d=s.byId(c);return{id:c,level:d.$level,parent:d.parent,index:s.getIndexById(c)}});return(t.parent||t.level)&&(i=i.filter(o=>t.level&&o.level<=t.level||!e.includes(o.parent))),i.sort((o,c)=>o.level-c.level||o.index-c.index),i.map(o=>o.id)}function $e(e,t,n,s,r){const a=e.exec?e.exec:e.in.exec;let i=t.split(":")[0],o=t.split(":")[1];const c=n?.id||n;let d={id:c},l={},h=!1;if(i==="copy-task"||i==="cut-task"){e._temp||(e._temp=[]),e._temp.push({id:c,cut:i==="cut-task"});return}else if(i==="paste-task"){if(e._temp&&e._temp.length){const u=e.getHistory();u&&u.startBatch();const g=new Map;if(e._temp.forEach(m=>{const p={id:m.id,target:c,mode:"after"};a(m.cut?"move-task":"copy-task",p),g.set(m.id,p.id)}),!e._temp[0].cut){const{links:m}=e.getState(),p=e._temp.map(y=>y.id),f=[];m.forEach(y=>{p.includes(y.source)&&p.includes(y.target)&&f.push(y)}),f.forEach(y=>{a("add-link",{link:{source:g.get(y.source),target:g.get(y.target),type:y.type}})}),e._temp.forEach((y,k)=>{a("select-task",{id:g.get(y.id),toggle:!!k})})}u&&u.endBatch(),e._temp=null}return}else i==="add-task"?(l={task:{type:"task",text:s("New Task")},target:c,show:!0,mode:"after",select:!1},d={},h=!0):i==="edit-task"?i="show-editor":i==="convert-task"?(i="update-task",l={task:{type:o}},o=void 0):i==="indent-task"&&(o=o==="add");if(i==="split-task"&&typeof n=="object")l=n;else if(i==="delete-task"&&o==="segment"&&typeof n=="object"){const u=e.getTask(c),{segmentIndex:g}=n,m=u.segments.filter((p,f)=>f!==g);a("update-task",{id:c,task:{segments:m}});return}typeof o<"u"&&(l={...l,mode:o}),d={...d,...l},a(i,d),h&&a("select-task",{id:d.id,toggle:!!r,eventSource:i})}function Ie(e,t){return e.some(n=>n.data?Ie(n.data,t):n.id===t)}function Ce(e,t,n,s=1){const r=n[0].width,a=Math.max(0,Math.floor(e/r)-s),i=Math.min(n.length,Math.ceil((e+t)/r)+s);return{from:a*r,to:i*r,start:a,end:i}}const It=null,Pe=(e,t)=>I(e,t),da=(e,t)=>rt(e,t);function Ct(e,t,n){Array.isArray(e)&&(e.forEach(s=>N(s,t,n(s))),e.forEach(s=>{if(s.type==="summary"&&!(s.start&&s.end)){const{start:r,end:a}=Tt(s,e);s.start=r,s.end=a,N(s,t,n(s))}}))}function N(e,t,n){e.unscheduled||Ee(e,t,n,!1),e.base_start&&Ee(e,t,n,!0)}function Ee(e,t,n,s){const{durationUnit:r}=t,a=r||"day",[i,o,c]=Oe(s);e.type==="milestone"?(e[c]=0,e[o]=void 0):e[i]&&(e[c]?e[o]=Pe(a,n)(e[i],e[c]):e[o]?e[c]=da(a,n)(e[o],e[i]):(e[o]=Pe(a,n)(e[i],1),e[c]=1))}function Oe(e){return e?["base_start","base_end","base_duration"]:["start","end","duration"]}function Ae(e,t,n){const[s,r,a]=Oe(n);(t===a||t===s)&&(e[r]=null),t===r&&(e[a]=0,e[s]&&e[s]>=e[r]&&(e[r]=null,e[a]=1))}function la(e,t,n,s){Ae(e,s,!1),e.base_start&&Ae(e,s,!0),N(e,t,n)}class ua extends Ue{in;_router;_modules=new Map;_prevScaleMinUnit;_prevConfig={};constructor(t){super({writable:t,async:!1}),this._router=new qe(super.setState.bind(this),[{in:["tasks","start","end","scales","autoScale","markers","projectStart","projectEnd","baselines"],out:["_start","_end"],exec:a=>{const{_end:i,_start:o,start:c,end:d,tasks:l,scales:h,autoScale:u,markers:g,projectStart:m,projectEnd:p,baselines:f,_tasksPatch:y}=this.getState();if(!y)if(!c||!d||u){const k=L(h).unit,_=zs(c,d,u,k,l,g,m,p,f);(_._end!==i||_._start!==o)&&this.setState(_,a)}else this.setState({_start:c,_end:d},a)}},{in:["columns"],out:["_headerLength","_gridCollapseThreshold"],exec:a=>{const i=this.getState().columns;let o=1,c=ot;i.length&&i.forEach(d=>{d.id==="add-task"&&d.width&&(c=d.width),o=Math.max(d.header.length,o)}),this.setState({_headerLength:o,_gridCollapseThreshold:c},a)}},{in:["_compactMode"],out:["displayMode"],exec:a=>{const{displayMode:i,_compactMode:o}=this.getState();let c=i;o?c=i==="all"?"grid":c:c="all",this.setState({displayMode:c},a)}},{in:["displayMode","columns"],out:["gridWidth","_columnsWidth"],exec:a=>{const{columns:i,displayMode:o,gridWidth:c,_columnsWidth:d}=this.getState();if(!i?.length){this.setState({gridWidth:0,_columnsWidth:0},a);return}let l=0;o==="chart"&&(l=i?.find(h=>h.id==="add-task")?.width||ot),o==="all"&&(i?.length?(l=d?440:c,i.every(h=>h.width&&!h.flexgrow)&&(l=i.reduce((h,u)=>h+u.width,0))):l=440),l&&this.setState({gridWidth:l,_columnsWidth:l},a)}},{in:["start","end"],out:["cellWidth"],exec:a=>{const{_cellWidth:i,cellWidth:o}=this.getState();i!==o&&this.setState({cellWidth:i},a)}},{in:["_start","_end","cellWidth","scaleHeight","scales","lengthUnit","_weekStart","_headerLength"],out:["_scales"],exec:a=>{const i=this.getState();let{lengthUnit:o}=i;const{_start:c,_end:d,cellWidth:l,scaleHeight:h,scales:u,_weekStart:g,_headerLength:m}=i,p=L(u).unit;As(p,o)||(o=p);const f=js(c,d,o,l,h,g,u,m);this.setState({_scales:f,_scaleMinUnit:p},a)}},{in:["assignments"],out:["_assignments"],exec:a=>{const{assignments:i}=this.getState(),o={byTask:{},byResource:{}};i&&i.forEach(c=>{const d=c.task,l=c.resource;o.byTask[d]||(o.byTask[d]=[]),o.byTask[d].push(c),o.byResource[l]||(o.byResource[l]=[]),o.byResource[l].push(c)}),this.setState({_assignments:o},a)}},{in:["_scales","scrollLeft","_chartWidth"],out:["xArea"],exec:a=>{const{_scales:i,scrollLeft:o,_chartWidth:c}=this.getState();if(!i||!c){this.setState({xArea:{from:0,to:0,start:0,end:0}},a);return}const d=i.rows[i.rows.length-1].cells;this.setState({xArea:Ce(o||0,c,d)},a)}},{in:["tasks","_assignments","groupBy","_scales"],out:["tree"],exec:a=>{this.getState();const{tasks:i,_scales:o}=this.getState(),c=this.getGrouping();if(c){if(!o)return;const d=c.buildTree();this.setState({tree:d});return}this.setState({tree:i},a)}},{in:["tree","_scales","_rollups","cellHeight","baselines","unscheduledTasks"],out:["_tasks"],exec:a=>{const{cellWidth:i,cellHeight:o,tree:c,_scales:d,baselines:l,splitTasks:h,unscheduledTasks:u,_rollups:g,groupBy:m,_tasksPatch:p}=this.getState();if(p){this.setState({_tasks:c.toArray(),_tasksPatch:null},a);return}const f=c.toArray().map((y,k)=>ve(y,k,{cellWidth:i,cellHeight:o,_scales:d,baselines:l,splitTasks:h,unscheduledTasks:u,_rollups:g,groupBy:m}));this.setState({_tasks:f},a)}},{in:["_tasks","links","cellHeight"],out:["_links"],exec:a=>{const{tree:i,links:o,cellHeight:c,criticalPath:d,_isFiltered:l}=this.getState(),h=o.map(u=>{const g=i.byId(u.source),m=i.byId(u.target);return!g||!m?null:Ks(u,g,m,c)}).toSorted((u,g)=>!u||!g?0:d?!!u.critical==!!g.critical?g.$pl-u.$pl:u.critical?1:-1:g.$pl-u.$pl).filter(u=>u&&l?i.isFilteredId(u.source)&&i.isFilteredId(u.target):u!==null);this.setState({_links:h},a)}},{in:["tasks","activeTask"],out:["_activeTask"],exec:a=>{const{activeTask:i,tasks:o}=this.getState(),c=o.byId(i);this.setState({_activeTask:c||null},a)}},{in:["tree","selected"],out:["_selected"],exec:a=>{const{tree:i,selected:o,_isFiltered:c}=this.getState(),d=o.map(l=>i.byId(l)).filter(l=>l?!c||i.isFilteredId(l.id):!1);this.setState({_selected:d},a)}}],{tasks:a=>new Gt(a),links:a=>new K($t(a)),columns:a=>ra(a)});const n=this.in=new Xe;n.on("show-editor",a=>{this.setStateAsync({activeTask:a.id})}),n.on("select-task",({id:a,toggle:i,range:o,show:c=!0,focus:d,eventSource:l})=>{const{selected:h,_tasks:u,activeTask:g}=this.getState();let m=!1,p;if(h.length&&(i||o)){const y=[...h];if(o){const k=y[y.length-1],_=u.findIndex(M=>M.id===k),w=u.findIndex(M=>M.id===a),x=Math.min(_,w),v=Math.max(_,w)+1,T=u.slice(x,v).map(M=>M.id);_>w&&T.reverse(),T.forEach(M=>{y.includes(M)||y.push(M)})}else if(i){const k=y.findIndex(_=>_===a);k===-1?y.push(a):(m=!0,y.splice(k,1))}p=y}else p=[a];const f={selected:p};if(this.setStateAsync(f),p.length&&(d&&(c=d==="chart"?"xy":c||"y"),c)){const y=()=>{this.scrollToTask(p[0],c),d&&this.setStateAsync({focusTask:{id:p[0],column:d==="grid"}})};l==="add-task"?setTimeout(y,1):y()}!m&&g&&g!==a&&n.exec("show-editor",{id:a})}),n.on("delete-link",({id:a})=>{const{links:i}=this.getState();i.remove(a),this.setStateAsync({links:i})}),n.on("update-link",a=>{const{links:i}=this.getState(),o=a.id;let c=a.link;i.update(o,c),c=i.byId(o),!c.lag&&c.lag!==0&&delete c.lag,this.setStateAsync({links:i}),a.link=c}),n.on("add-link",a=>{const{link:i}=a,{links:o}=this.getState();!i.source||!i.target||(i.type||(i.type="e2s"),i.id=i.id||Nt(),o.add(i),this.setStateAsync({links:o}),a.id=i.id,a.link=o.byId(i.id))});let s=null;n.on("move-task",a=>{const{tasks:i}=this.getState();let{mode:o,target:c}=a;const{id:d,inProgress:l}=a,h=i.byId(d);if(typeof l>"u"?a.source=h.parent:a.source=s=s??h.parent,l===!1){i.update(h.id,{$reorder:!1}),this.setState({tasks:i}),s=null;return}if(c===d||i.contains(d,c)){a.skipProvider=!0;return}if(o==="up"||o==="down"){const u=i.getBranch(d);let g=i.getIndexById(d);if(o==="up"){const m=h.parent===0;if(g===0&&m){a.skipProvider=!0;return}g-=1,o="before"}else if(o==="down"){const m=g===u.length-1,p=h.parent===0;if(m&&p){a.skipProvider=!0;return}g+=1,o="after"}if(c=u[g]&&u[g].id||h.parent,c){const m=i.getBranch(c);let p=i.getIndexById(c),f=m[p];if(f.data){if(o==="before"){if(f.parent===h.parent){for(;f.data;)f.open||n.exec("open-task",{id:f.id,mode:!0}),f=f.data[f.data.length-1];c=f.id}}else if(o==="after"){let _;f.parent===h.parent?(_=f,f=f.data[0],c=f.id,o="before"):m.length-1!==p&&(_=f,p+=1,f=m[p],h.$level>f.$level&&f.data?(_=f,f=f.data[0],c=f.id,o="before"):c=f.id),_&&!_.open&&n.exec("open-task",{id:_.id,mode:!0})}}const y=i.getSummaryId(h.id);i.move(d,o,c);const k=i.getSummaryId(d);y!==k&&(y&&this.resetSummaryDates(y,"move-task"),k&&this.resetSummaryDates(k,"move-task"))}}else{const u=i.byId(c);let g=u,m=!1;for(;g.$level>h.$level;)g=i.byId(g.parent),g.id===d&&(m=!0);if(m)return;const p=i.getSummaryId(h.id);if(i.move(d,o,c),o==="child"){let y=u;for(;y.id!==0&&!y.open;)n.exec("open-task",{id:y.id,mode:!0}),y=i.byId(y.parent)}const f=i.getSummaryId(d);p!==f&&(p&&this.resetSummaryDates(p,"move-task"),f&&this.resetSummaryDates(f,"move-task"))}l?this.setState({tasks:i}):this.setStateAsync({tasks:i}),a.target=c,a.mode=o}),n.on("drag-task",a=>{const i=this.getState(),{tree:o,_tasks:c,_selected:d,rollups:l,slack:h}=i,u=o.byId(a.id),{left:g,top:m,width:p,inProgress:f}=a,y={_tasks:c,_selected:d};if(typeof p<"u"&&(u.$w=p,Mt(o,u)),typeof g<"u"){if(u.type==="summary"){const k=g-u.$x;xe(u,k,!!l)}u.$x=g,Mt(o,u)}typeof m<"u"&&(u.$y=m+4,u.$reorder=f),this.setState(y)});const r=new Set(["start","end","duration","type","unscheduled","base_start","base_end","base_duration","segments","rollup"]);n.on("update-task",a=>{const{id:i,segmentIndex:o,diff:c,eventSource:d}=a;let{task:l}=a;const h=this.getState(),{tasks:u,_scales:g,durationUnit:m,splitTasks:p,_calendars:f}=h,y={tasks:u,_tasksPatch:!1},k=u.byId(i),_=this.getTaskCalendar({...k,...l}),w={durationUnit:m};if(d==="add-task"||d==="copy-task"||d==="move-task"||d==="update-task"||d==="delete-task"||d==="provide-data"||d==="schedule-tasks"){d==="schedule-tasks"?(u.update(i,l),this.setState({tasks:u})):(N(l,w,_),u.update(i,l));return}if(!(c||o>=0||"type"in l&&l.type!==k.type||Object.keys(l).some(D=>{if(!r.has(D)||D==="type")return!1;const W=l[D],B=k[D];return!J(W,B)}))){u.update(i,l),this.setStateAsync({tasks:u,_tasksPatch:!this.getGrouping()}),a.task=u.byId(i);return}const x=g.lengthUnit;let v=I(x);const T=rt(m,_);if(c&&(l.start&&(l.start=v(l.start,c)),!o&&o!==0&&(l.start&&l.end?l.duration=k.duration:(l.start?l.end=k.end:(l.end=v(l.end,c),l.start=k.start,l.duration=T(l.end,l.start)),T(l.end,l.start)||(l.duration=1)))),l.type=l.type??k.type,_&&l.start&&(l.start=bt(l.start,c,_)),l.start&&l.end&&(!j(l.start,k.start)||!j(l.end,k.end))&&l.type==="summary"&&k.data?.length){let D=c||T(l.start,k.start);_&&(D=l.start>k.start?T(l.start,k.start):-T(k.start,l.start),v=Ys(_)),this.moveSummaryKids(k,(W,B)=>{if(W=v(W,D),!_)return W;const Ye=f?this.getTaskCalendar(B):_;return bt(W,c,Ye)},"update-task")}l.start||(l.start=k.start),!l.end&&!l.duration&&(l.duration=k.duration),N(l,w,_),u.update(i,l),(_&&l.type==="summary"||l.type==="summary"&&k.type!=="summary")&&this.resetSummaryDates(i,"update-task",!0);const M=u.getSummaryId(i);M&&this.resetSummaryDates(M,"update-task"),this.setStateAsync(y),a.task=u.byId(i)}),n.on("add-task",a=>{const{tasks:i,_scales:o,unscheduledTasks:c,durationUnit:d,splitTasks:l,tree:h}=this.getState(),{target:u,mode:g,task:m,show:p,select:f=!0}=a;!a.eventSource&&c&&(m.unscheduled=!0);const y=this.getTaskCalendar(m);let k=-1,_,w;if(u?(w=i.byId(u),g==="child"?(_=w,m.parent=_.id):(w.parent!==null&&(_=i.byId(w.parent),m.parent=_.id),k=i.getIndexById(u),g==="after"&&(k+=1))):m.parent&&(_=i.byId(m.parent)),!m.start){if(_?.start)m.start=new Date(_.start.valueOf());else if(w)m.start=new Date(w.start.valueOf());else{const M=i.getBranch(0);let D;if(M?.length){const W=M[M.length-1];if(!W.$skip){const B=new Date(W.start.valueOf());o.start<=B&&(D=B)}}m.start=D||I(d,y)(o.start,1)}m.duration=m.duration||1}y&&(m.start=bt(m.start,1,y)),this.getState().baselines&&(m.base_start=m.start,m.base_duration=m.duration),N(m,{durationUnit:d},y);const x=i.add(m,k),v={tasks:i};if(p)for(;_&&_.id;)n.exec("open-task",{id:_.id,mode:!0}),_=h.byId(_.parent);a.id=x.id;const T=i.getSummaryId(x.id);T&&this.resetSummaryDates(T,"add-task"),this.setStateAsync(v),a.id=x.id,a.task=x,f?n.exec("select-task",{id:x.id,show:p,eventSource:"add-task"}):p&&this.scrollToTask(x.id,p)}),n.on("delete-task",a=>{const{id:i}=a,o=this.getState(),{tasks:c,links:d,selected:l}=o,h=c.byId(i);a.source=h.parent;const u=c.getSummaryId(i),g=[i];c.eachChild(f=>g.push(f.id),i),d.filter(f=>!(g.includes(f.source)||g.includes(f.target)));const m={tasks:c,links:d},p=o.groupBy?.field==="resource";(l.includes(i)||p)&&(m.selected=l.filter(f=>f!==i&&(!p||o.tree.byId(f)?.$id!==i))),c.remove(i),u&&this.resetSummaryDates(u,"delete-task"),this.setStateAsync(m)}),n.on("indent-task",({id:a,mode:i})=>{const{tasks:o}=this.getState();if(i){const c=o.getBranch(a)[o.getIndexById(a)-1];c&&n.exec("move-task",{id:a,mode:"child",target:c.id})}else{const c=o.byId(a),d=o.byId(c.parent);d&&d.parent!==null&&n.exec("move-task",{id:a,mode:"after",target:c.parent})}}),n.on("copy-task",a=>{const{id:i,target:o,mode:c,eventSource:d}=a;if(d==="copy-task")return;const{tasks:l,links:h}=this.getState();if(l.contains(i,o)){a.skipProvider=!0;return}const u=l.getSummaryId(i),g=l.getSummaryId(o);let m=l.getIndexById(o);c==="before"&&(m-=1);const p=l.byId(i),f=l.copy(p,l.byId(o).parent,m+1);a.source=a.id,a.id=f[0][1],p.lazy&&(a.lazy=!0),u!==g&&g&&this.resetSummaryDates(g,"copy-task");let y=[];for(let k=1;k<f.length;k++){const[_,w]=f[k];h.forEach(x=>{if(x.source===_){const v={...x};delete v.target,y.push({...v,source:w})}else if(x.target===_){const v={...x};delete v.source,y.push({...v,target:w})}})}y=y.reduce((k,_)=>{const w=k.findIndex(x=>x.id===_.id);return w>-1?k[w]={...k[w],..._}:k.push(_),k},[]);for(let k=1;k<f.length;k++){const[_,w]=f[k],x=l.byId(w);n.exec("copy-task",{source:_,id:w,lazy:!!x.lazy,eventSource:"copy-task",target:x.parent,mode:"child",skipUndo:!0})}y.forEach(k=>{n.exec("add-link",{link:{source:k.source,target:k.target,type:k.type},eventSource:"copy-task",skipUndo:!0})}),this.setStateAsync({tasks:l})}),n.on("open-task",({id:a,mode:i})=>{const{tree:o}=this.getState(),c=o.byId(a);c.lazy?n.exec("request-data",{id:c.id}):(o.toArray().forEach(d=>d.$y=0),o.update(a,{open:i}),this.setState({tree:o}))}),n.on("scroll-chart",({left:a,top:i,date:o})=>{const{_chartWidth:c,_chartHeight:d,_tasks:l,cellHeight:h,_scales:u,cellWidth:g,_start:m,_weekStart:p}=this.getState();let f={};if(o){const y=u.diff(o,m,"hour");a=Math.round(y*g)}if(!isNaN(a)){if(typeof c<"u"&&!isNaN(u.width)){const y=u.width-c;a=Math.max(Math.min(a,y),0)}f={scrollLeft:a,_scaleDate:be(a,{_scales:u,_start:m,_weekStart:p}),_zoomOffset:null}}if(!isNaN(i)){if(typeof d<"u"){const y=u.height+l.length*h-d;i=Math.max(Math.min(i,y),0)}f.scrollTop=i}this.setState(f)}),n.on("render-data",a=>{this.setState({area:a})}),n.on("provide-data",a=>{const{tasks:i,links:o,assignments:c,durationUnit:d,splitTasks:l}=this.getState(),h=i.byId(a.id);h.lazy?(h.lazy=!1,h.open=!0):h.data=[],Ct(a.data.tasks,{durationUnit:d},this.getTaskCalendar.bind(this)),i.parse(a.data.tasks,a.id),h.type==="summary"&&this.resetSummaryDates(h.id,"provide-data");const u={tasks:i,links:new K(o.map(g=>g).concat($t(a.data.links)))};a.data.assignments&&c&&(u.assignments=new K(c.map(g=>g).concat(normalizeAssignments(a.data.assignments)))),this.setStateAsync(u)}),n.on("zoom-scale",({dir:a,ratio:i,offset:o})=>{const c=this.getState(),{zoom:d,cellWidth:l,_cellWidth:h,scrollLeft:u}=c,g=(o||0)+u,m=be(g,c),p=a<0&&h||l;let f=Math.round(p*(1+a*(i??.15)));const{maxCellWidth:y,minCellWidth:k}=d.levels[d.level],_=a<0&&l>y;if(this.shouldExpandScale(f)){this.changeScale(d,a)&&this.setState({cellWidth:f,_cellWidth:f});return}if(f<k||f>y||_){if(!this.changeScale(d,a))if(f=Math.max(Math.min(f,y),k),f!==l)this.setState({cellWidth:f,_cellWidth:f});else return}else this.setState({cellWidth:f,_cellWidth:f});const{_scales:w,_start:x,cellWidth:v,_weekStart:T}=this.getState(),M=C(w.minUnit,x,T),D=w.diff(m,M,"hour");typeof o>"u"&&(o=v);let W=Math.round(D*v)-o;W<0&&(W=0),this.setState({scrollLeft:W,_scaleDate:m,_zoomOffset:o})}),n.on("sort-tasks",({key:a,order:i,add:o})=>{const c=this.getState(),{tasks:d,tree:l,columns:h}=c;let u=c._sort;const g={key:a,order:i};let m=u?.length||0;m&&o?(u.forEach((p,f)=>{p.key===a&&(m=f)}),u[m]=g):u=[g],l.sort(u,h),this.setState({_sort:u,tree:l})}),n.on("filter-tasks",a=>{const{open:i,key:o,value:c}=a;let d=a.filter;const l=this.getState(),{tasks:h,columns:u}=l;let g=l.filterValues;o?g={...g,[o]:c}:Object.keys(a).length||(g={}),!d&&Object.values(g).some(m=>m||m===0)&&(d=Ve(g,u)),h.filterTree(d,i??!0),this.setState({tasks:h,_isFiltered:!!d,filterValues:g})}),n.on("hotkey",({key:a,event:i,eventSource:o})=>{switch(a){case"arrowup":case"arrowdown":{const{selected:c,_tasks:d}=this.getState();i.preventDefault();const l=c.length;let h;if(a==="arrowup"?h=l?this.getPrevRow(c[l-1])?.id:d[d.length-1]?.id:h=l?this.getNextRow(c[l-1])?.id:d[0]?.id,h){const u=o==="chart"?"xy":!0,g=o;this.in.exec("select-task",{id:h,show:u,focus:g})}break}case"ctrl+c":{V(this,"copy-task",null,null);break}case"ctrl+x":{V(this,"cut-task",null,null);break}case"ctrl+v":{V(this,"paste-task",null,null);break}case"ctrl+d":case"backspace":{i.preventDefault(),V(this,"delete-task",null,null);break}case"ctrl+z":{this.in.exec("undo",{});break}case"ctrl+y":{this.in.exec("redo",{});break}}}),n.on("resize-chart",({width:a,height:i,scrollSize:o})=>{let c={};const d=this.getState();a>d._scales?.width&&(c=qs(a,d)),this.setState({...c,_chartWidth:a,_chartHeight:i,_scrollSize:o})}),n.on("resize-grid",({width:a})=>{this.setState({gridWidth:a})}),n.on("set-display-mode",({mode:a})=>{this.getState()._compactMode&&a==="all"||this.setState({displayMode:a})}),n.on("open-resource-row",({id:a,mode:i})=>{const{resources:o}=this.getState();o.update(a,{open:i}),this.setState({resources:o})}),n.on("sort-resources",({key:a,order:i,add:o,_columns:c})=>{const d=this.getState(),{resources:l}=d;let h=d._resourceSort;const u={key:a,order:i};let g=h?.length||0;g&&o?(h.forEach((m,p)=>{m.key===a&&(g=p)}),h[g]=u):h=[u],l.sort(h,c),this.setState({_resourceSort:h,resources:l})})}init(t){const n=this.getState().area?{}:{scrollLeft:0,scrollTop:0,area:{from:0,start:0,end:0},xArea:{from:0,to:0,start:0,end:0},_isFiltered:!1,filterValues:{},groupBy:{field:null},tree:[]};t.cellWidth&&(t._cellWidth=t.cellWidth),t._compactMode&&t.displayMode!==this.getState().displayMode&&(t.displayMode=t.displayMode==="all"?"grid":t.displayMode),t.unscheduledTasks=!1,t.baselines=!1,t.markers=[],t._markers=[],t.undo=!1,t.schedule={},t.criticalPath=null,t.splitTasks=!1,t.summary={},t.rollups=!1,t._rollups={},t.slack=!1,t.resources=null,t._resources=[],t.assignments=[],t.calendar=null,t.calendars=[],t._calendar=null,t._calendars={},t.groupBy=null,t.wbs=null;const s=this.getState();if(Array.isArray(t.calendars)&&t.calendars.length>0?s.calendars===t.calendars?t._calendars=s._calendars:(t._calendars={},t.calendars.forEach(({id:o,...c})=>{t._calendars[o]=new It(c),t._calendars[o].css=c.css})):s._calendars||(t._calendars={}),s.calendar===t.calendar&&s._calendar)t._calendar=s._calendar;else if(typeof t.calendar=="string"){const o=t._calendars?.[t.calendar];o&&(t._calendar=o)}else t.calendar&&typeof t.calendar=="object"?t._calendar=new It(t.calendar):t.calendar===!0&&(t._calendar=new It);t._calendar&&t.tasks&&(t.highlightTime=(o,c)=>{const d=this.getCalendar();return d&&(c==="day"||c==="hour")&&!d.isWorkingDay(o)?"wx-weekend":""});const r=this.changed(t,"tasks"),a=this.changed(t,"links"),i=this.changed(t,"resources");this.changed(t,"projectStart"),r||a||this.changed(t,"criticalPath","slack","unscheduledTasks");for(const o in t)o[0]!=="_"&&(this._prevConfig[o]=t[o]);if(t.tasks)if(r){const o=t.tasks.map(c=>{const d={...c};return c.segments&&(d.segments=c.segments.map(l=>({...l}))),d});Ct(o,{durationUnit:t.durationUnit,splitTasks:t.splitTasks},c=>{const d=c?.calendar;return d!=null&&t._calendars?.[d]?t._calendars[d]:t._calendar}),t.tasks=o}else delete t.tasks;if(r){this.getHistory()?.resetHistory();const o=this.getState();o._isFiltered&&this.setState({_isFiltered:!1,filterValues:{}}),o._sort&&this.setState({_sort:null})}i&&this.getState()._resourceSort&&this.setState({_resourceSort:null}),this._router.init({selected:[],markers:[],autoScale:!0,durationUnit:"day",highlightTime:null,focusTask:null,gridWidth:440,_compactMode:!1,_sort:null,_resourceSort:null,...n,...t})}changed(t,...n){return n.some(s=>{if(!(s in t))return!1;const r=this._prevConfig[s],a=t[s];return r!==a&&!J(r,a)})}setState(t,n){return this._router.setState(t,n)}setStateAsync(t){this._router.setStateAsync(t)}getTask(t){const{tree:n}=this.getState();return n.byId(t)}getResource(t){const{resources:n}=this.getState();return n.byId(t)}getHistory(){return this.getState().undo?this._modules.get("historyManager"):null}getCalendar(t){const{_calendar:n,_calendars:s}=this.getState();return s?.[t]??n??void 0}getTaskCalendar(t){return this.getCalendar(t?.calendar)}getResourceCalendar(t){return this.getCalendar(t?.calendar)}getLoadHours(t,n,s){const r=this.getTaskCalendar(n),a=this.getResourceCalendar(s);return r&&a?Math.min(r.getWorkingHours(t),a.getWorkingHours(t)):a?.getWorkingHours(t)??r?.getWorkingHours(t)}getGrouping(){return this.getState().groupBy?.field?this._modules.get("groupManager"):null}serialize(t){const n=t?.data||"tasks";if(n==="calendars"){const{_calendars:r}=this.getState();return r?Object.entries(r).map(([a,i])=>({...i?.serialize?.()||{},...i?.css?{css:i.css}:{},id:a})):null}const s=this.getState()[n];if(s){if(s instanceof Gt)return s.serialize();if(s instanceof K)return s.map(r=>r);if(s instanceof Bt)return s.toArray()}return null}getTaskResources(t){const{_assignments:n,resources:s}=this.getState();if(!s||!n)return[];const r=n.byTask[t];return r?r.map(a=>{const i=s.byId(a.resource),o={...a};return delete o.resource,delete o.task,i?{...o,...i,assignmentId:a.id}:null}).filter(Boolean):[]}getResourceTasks(t){const{_assignments:n,tasks:s}=this.getState();if(!n)return[];const r=n.byResource[t];return r?r.map(a=>s.byId(a.task)||null).filter(Boolean):[]}changeScale(t,n){const s=t.level+n,r=t.levels[s];if(r){const{cellWidth:a,scales:i,_scales:o}=this.getState(),c=Us(t,n,s,r,o.lengthUnit,i,a);return c._cellWidth=c.cellWidth,this.setState(c),!0}return!1}shouldExpandScale(t){const{start:n,end:s,_chartWidth:r,_scales:a,cellWidth:i}=this.getState();return n&&s&&r&&a?.width&&i?a.width/i*t<r:!1}isScheduled(t){return this.getState().unscheduledTasks?t.some(n=>!n.unscheduled||n.data&&this.isScheduled(n.data)):!0}resetSummaryDates(t,n,s){const{tasks:r,durationUnit:a,splitTasks:i}=this.getState(),o=r.byId(t),c=o.data;if(c?.length&&this.isScheduled(c)){const d=Tt({...o,start:void 0,end:void 0,duration:void 0});if(!j(o.start,d.start)||!j(o.end,d.end)){s?(N(d,{durationUnit:a},this.getTaskCalendar(d)),r.update(t,d)):this.in.exec("update-task",{id:t,task:d,eventSource:n,skipUndo:!0});const l=r.getSummaryId(t);l&&this.resetSummaryDates(l,n)}}}moveSummaryKids(t,n,s){const{tasks:r}=this.getState();t.data.forEach(a=>{const i={...r.byId(a.id),start:n(a.start,a)};delete i.end,delete i.id,this.in.exec("update-task",{id:a.id,task:i,eventSource:s,skipUndo:!0}),a.data?.length&&this.moveSummaryKids(a,n,s)})}getNextRow(t){const n=this.getState()._tasks,s=n.findIndex(r=>r.id===t);return n[s+1]}getPrevRow(t){const n=this.getState()._tasks,s=n.findIndex(r=>r.id===t);return n[s-1]}scrollToTask(t,n){const{_chartWidth:s,_chartHeight:r,scrollLeft:a,scrollTop:i,cellWidth:o,cellHeight:c,_tasks:d,_scrollSize:l}=this.getState(),h=d.findIndex(f=>f.id===t||f.$id===t);if(h<0)return;const u=this.getTask(d[h].id),g={};if(n?.toString().indexOf("x")!==-1){if(u.$x+u.$w/2<a)g.left=Math.max(u.$x-(o||0),0);else if(u.$x+u.$w/2>=s+a){const f=s<u.$w?o:u.$w;g.left=u.$x-s+f}}const m=h*c;let p=null;m<i?p=m:m+c>i+r&&(p=m-r+c+l),p!==null&&(g.top=Math.max(p,0)),this.in.exec("scroll-chart",g)}}function ha(e,t,n,s){if(typeof document>"u")return"";const r=document.createElement("canvas");{const a=fa(r,e,t,1,n);ga(a,s,0,e,0,t)}return r.toDataURL()}function fa(e,t,n,s,r){e.setAttribute("width",(t*s).toString()),e.setAttribute("height",(n*s).toString());const a=e.getContext("2d");return a.translate(-.5,-.5),a.strokeStyle=r,a}function ga(e,t,n,s,r,a){e.beginPath(),e.moveTo(s,r),e.lineTo(s,a),t==="full"&&e.lineTo(n,a),e.stroke()}const Pt=[{id:"task",label:"Task"},{id:"summary",label:"Summary task"},{id:"milestone",label:"Milestone"}];function He(e){return!e.$group&&typeof e.$groupValue<"u"}function ma(e){return e.$group}function pa(e){let t=Fe.map(r=>({...r}));const n=e?.taskTypes||Pt,s=t.find(r=>r.id==="convert-task");return s.data=[],n.forEach(r=>{(!e?.summary?.autoConvert||r.id!=="summary")&&s.data.push(s.dataFactory(r))}),t}function Et(e){return e.map(t=>{switch(t.data&&Et(t.data),t.id){case"add-task:before":case"move-task:up":t.isDisabled=(n,s)=>ka(n,s)||He(n)||ma(n);break;case"move-task:down":t.isDisabled=(n,s)=>_a(n,s);break;case"indent-task:add":t.isDisabled=(n,s)=>ba(n,s)===n.parent;break;case"indent-task:remove":t.isDisabled=n=>ya(n);break}return t})}function ya(e){return e.parent===0}function ka(e,t){const{_tasks:n}=t;return n[0]?.id===e.id}function _a(e,t){const{_tasks:n}=t;return n[n.length-1]?.id===e.id}function ba(e,t){const{_tasks:n}=t,s=n.findIndex(r=>r.id===e.id);return n[s-1]?.id??e.parent}function wa(e){return e&&typeof e=="object"}function xa(e){return!e.selected||e.selected.length<2}const Sa=e=>t=>t.type===e||e==="summary"&&He(t),Fe=Et([{id:"add-task",text:"Add",icon:"wxi-plus",data:[{id:"add-task:child",text:"Child task"},{id:"add-task:before",text:"Task above"},{id:"add-task:after",text:"Task below"}]},{comp:"separator"},{id:"convert-task",text:"Convert to",icon:"wxi-swap-horizontal",dataFactory:e=>({id:`convert-task:${e.id}`,text:`${e.label}`,isDisabled:Sa(e.id)})},{id:"edit-task",text:"Edit",icon:"wxi-edit"},{comp:"separator"},{id:"cut-task",text:"Cut",icon:"wxi-content-cut",subtext:"Ctrl+X"},{id:"copy-task",text:"Copy",icon:"wxi-content-copy",subtext:"Ctrl+C"},{id:"paste-task",text:"Paste",icon:"wxi-content-paste",subtext:"Ctrl+V"},{id:"move-task",text:"Move",icon:"wxi-swap-vertical",data:[{id:"move-task:up",text:"Up"},{id:"move-task:down",text:"Down"}]},{comp:"separator"},{id:"indent-task:add",text:"Indent",icon:"wxi-indent"},{id:"indent-task:remove",text:"Outdent",icon:"wxi-unindent"},{comp:"separator"},{id:"delete-task",icon:"wxi-delete",text:"Delete",subtext:"Ctrl+D / BS",isHidden:(e,t,n)=>xa(t)&&wa(n)}]);function va(e){return[...Ne]}const Ne=Et([{id:"add-task",comp:"button",icon:"wxi-plus",text:"New task",type:"primary"},{id:"edit-task",comp:"icon",icon:"wxi-edit",menuText:"Edit",text:"Ctrl+E"},{id:"delete-task",comp:"icon",icon:"wxi-delete",menuText:"Delete",text:"Ctrl+D, Backspace"},{comp:"separator"},{id:"move-task:up",comp:"icon",icon:"wxi-angle-up",menuText:"Move up"},{id:"move-task:down",comp:"icon",icon:"wxi-angle-down",menuText:"Move down"},{comp:"separator"},{id:"copy-task",comp:"icon",icon:"wxi-content-copy",menuText:"Copy",text:"Ctrl+V"},{id:"cut-task",comp:"icon",icon:"wxi-content-cut",menuText:"Cut",text:"Ctrl+X"},{id:"paste-task",comp:"icon",icon:"wxi-content-paste",menuText:"Paste",text:"Ctrl+V"},{comp:"separator"},{id:"indent-task:add",comp:"icon",icon:"wxi-indent",menuText:"Indent"},{id:"indent-task:remove",comp:"icon",icon:"wxi-unindent",menuText:"Outdent"}]);function ct(e){return e.type==="summary"}function Ot(e){return e.type==="milestone"}function dt(e){return typeof e.parent>"u"}function At(e,t){return t.unscheduledTasks&&e.unscheduled}function Ma(e){const t=Be.map(s=>({...s})),n=t.find(s=>s.key==="type");return n.options=e?.taskTypes||Pt,t}const Be=[{key:"text",comp:"text",label:"Name",config:{placeholder:"Add task name"}},{key:"details",comp:"textarea",label:"Description",config:{placeholder:"Add description"}},{key:"type",comp:"select",label:"Type",isHidden:e=>dt(e)},{key:"start",comp:"date",label:"Start date",config:{format:"%d-%m-%Y"},isHidden:e=>ct(e),isDisabled:At},{key:"end",comp:"date",label:"End date",config:{format:"%d-%m-%Y"},isHidden:e=>ct(e)||Ot(e),isDisabled:At},{key:"duration",comp:"counter",label:"Duration",config:{min:1},isHidden:e=>ct(e)||Ot(e),isDisabled:At},{key:"progress",comp:"slider",label:"Progress",config:{min:1,max:100},isHidden:e=>Ot(e)||dt(e)},{key:"links",comp:"links",label:"",batch:"links",isHidden:e=>dt(e)}];function Ht(e,t){return!e||!Array.isArray(e)?e:e.filter(t).map(n=>n.items&&Array.isArray(n.items)?{...n,items:Ht(n.items,t)}:{...n})}const Ta=[{items:[{comp:"icon",icon:"wxi-close",id:"close"},{comp:"spacer"},{comp:"button",type:"danger",text:"Delete",id:"delete"},{comp:"button",type:"primary",text:"Save",id:"save"}]},{id:"tabs",comp:"tabs",css:"wx-toolbar-tabs",options:[{id:"general",label:"General"},{id:"links",label:"Links"}]}];function Da(e){let t=Ta.map(s=>({...s}));e?.autoSave!==!1&&(t=Ht(t,s=>s.id!=="save"));const n=t.find(s=>s.id==="tabs");return n?.options&&(n.options=[...n.options]),e?.resources&&n?.options.push({id:"resources",label:"Resources",isHidden:s=>ct(s)||dt(s)}),e?.splitTasks&&n?.options.push({id:"segments",label:"Segments",isHidden:s=>!s.segments?.length}),t}function Wa(e){return null}export{ua as DataStore,Ce as calculateArea,Wa as createCalendar,We as defaultColumns,Be as defaultEditorItems,Fe as defaultMenuOptions,Pt as defaultTaskTypes,Ne as defaultToolbarButtons,Vs as extendDragOptions,Ht as filterEditorButtons,ue as format,_e as formatDay,I as getAdder,ia as getDefaultColumns,rt as getDiffer,Da as getEditorButtons,Ma as getEditorItems,pa as getMenuOptions,oa as getResourceColumns,va as getToolbarButtons,C as getUnitStart,ha as grid,V as handleAction,Ie as isHandledAction,Qs as isSegmentMoveAllowed,$t as normalizeLinks,Ls as normalizeZoom,Ct as parseTaskDates,na as placeLink,la as prepareEditTask,Bs as registerScaleUnit};