@svar-ui/gantt-store 2.4.2 → 2.4.4
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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/DataStore.d.ts +1 -1
- package/dist/types/helpers/editorItems.d.ts +1 -1
- package/dist/types/helpers/menuOptions.d.ts +1 -1
- package/dist/types/helpers/toolbarButtons.d.ts +1 -1
- package/dist/types/types.d.ts +2 -2
- package/package.json +1 -1
- package/dist/types/helpers/getCircularLinks.d.ts +0 -3
- package/dist/types/modules/AutoScheduler.pro.d.ts +0 -15
- package/dist/types/modules/ChangeTracker.pro.d.ts +0 -10
- package/dist/types/modules/CriticalPath.pro.d.ts +0 -11
- package/dist/types/modules/EventTracker.pro.d.ts +0 -20
- package/dist/types/modules/HistoryManager.pro.d.ts +0 -48
- package/dist/types/splitTasks.pro.d.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Mt=new Date().valueOf(),xe=()=>Mt++;function nt(){return"temp://"+Mt++}var Dt=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:xe(),...t},this._data.push(t),this._pool.set(t.id,t)}update(t,e){const n=this._data.findIndex(s=>s.id==t),a={...this._data[n],...e};this._data[n]=a,this._pool.set(a.id,a)}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)}},_e=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 s=0;s<t.length;s++){const r=t[s];r.parent=r.parent||e,r.data=null,n.set(r.id,r)}for(let s=0;s<t.length;s++){const r=t[s],i=n.get(r.parent);i&&(i.data||(i.data=[]),i.data.push(r))}const a=n.get(e);this.setLevel(a,a.$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]:Wt(n,e,t):n.data=[t]}addAfter(t,e){if(!e)return this.add(t,-1);const n=this.byId(e),a=this.byId(n.parent),s=G(a,n.id)+1;t.parent=a.id,t.$level=a.$level+1,this.add(t,s)}remove(t){const e=this._pool.get(t);this._remove(e);const n=this._pool.get(e.parent);n.data=n.data.filter(a=>a.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 a=this._pool.get(n.parent),s=G(a,n.id);n={...n,...e},a&&s>=0&&(a.data[s]=n,a.data=[...a.data]),this._pool.set(n.id,n)}move(t,e,n){const a=this._pool.get(t),s=e==="child",r=this._pool.get(n),i=r.$level+(s?1:0);if(!a||!r)return;const o=this._pool.get(a.parent),c=s?r:this._pool.get(r.parent);c.data||(c.data=[]);const d=G(o,a.id);ve(o,d);const u=s?c.data.length:G(c,r.id)+(e==="after"?1:0);if(Wt(c,u,a),o.id===c.id&&d===u)return null;a.parent=c.id,a.$level!==i&&(a.$level=i,this.setLevel(a,i+1,!0)),this.update(a.id,a),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&&Tt(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((a,s)=>{t(this.byId(a.id),s),this.eachChild(t,a.id)})}setLevel(t,e,n){t.data&&(t.data=t.data.map(a=>(n&&(a={...a},this._pool.set(a.id,a)),a.$level=e,a.data&&this.setLevel(a,e+1,n),a)))}};function Tt(t,e){t.forEach(n=>{e.push(n),n.open===!0&&Tt(n.data,e)})}function ve(t,e){const n=[...t.data];n.splice(e,1),t.data=n}function Wt(t,e,n){const a=[...t.data];a.splice(e,0,n),t.data=a}function G(t,e){return t?.data.findIndex(n=>n.id===e)}var $t=2,Se=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,a,s,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=a+(a?".":"")+i;o?(o.__parse(d,u,s,r)&&(n[i]=d),r&$t?s[u]=o.__trigger:o.__trigger()):(d&&d.__reactive?e[i]=this._wrapNested(d,d,u,s):e[i]=this._wrapWritable(d),n[i]=d),s[u]=s[u]||null}}_wrapNested(t,e,n,a){const s=this._wrapWritable(t);return this._wrapProperties(t,s,e,n,a,0),s.__parse=(r,i,o,c)=>(this._wrapProperties(r,s,e,i,o,c),!1),s}_wrapWritable(t){const e=[],n=function(){for(let a=0;a<e.length;a++)e[a](t)};return{subscribe:a=>(e.push(a),this._async?setTimeout(a,1,t):a(t),()=>{const s=e.indexOf(a);s>=0&&e.splice(s,1)}),__trigger:()=>{e.length&&(this._async?setTimeout(n,1):n())},__parse:function(a){return t=a,!0}}}},Me=class{constructor(t,e,n,a){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(s=>{s.in.forEach(r=>{const i=this._triggers.get(r)||[];i.push(s),this._triggers.set(r,i)}),s.out.forEach(r=>{const i=this._sources.get(r)||{};s.in.forEach(o=>i[o]=!0),this._sources.set(r,i)})}),this._routes.forEach(s=>{s.length=Math.max(...s.in.map(r=>It(r,this._sources,1)))}),this._bus=a}init(t){const e={};for(const n in t)if(this._prev[n]!==t[n]){const a=this._parsers[n];e[n]=a?a(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,$t);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),a=!e.length;e=e||[];for(let s=0;s<n.length;s++){const r=n[s],i=this._triggers.get(r);i&&i.forEach(o=>{e.indexOf(o)==-1&&e.push(o)})}a&&this._execNext(e)}_execNext(t){for(;t.length;){t.sort((n,a)=>n.length<a.length?1:-1);const e=t[t.length-1];t.splice(t.length-1),e.exec(t)}}};function It(t,e,n){const a=e.get(t);if(!a)return n;const s=Object.keys(a).map(r=>It(r,e,n+1));return Math.max(...s)}var De=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(t,e,n){let a=this._handlers[t];a?n&&n.intercept?a.unshift(e):a.push(e):a=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 a=n.length-1;a>=0;a--)this._tag.get(n[a])===t&&n.splice(a,1)}}async exec(t,e){const n=this._handlers[t];if(n)for(let a=0;a<n.length;a++){const s=n[a](e);if(s===!1||s&&s.then&&await s===!1)return}return this._nextHandler&&await this._nextHandler.exec(t,e),e}setNext(t){return this._nextHandler=t}};function Te(t,e){return typeof t=="string"?t.localeCompare(e,void 0,{numeric:!0}):typeof t=="object"?t.getTime()-e.getTime():(t??0)-(e??0)}function We(t,e){return typeof t=="string"?-t.localeCompare(e,void 0,{numeric:!0}):typeof e=="object"?e.getTime()-t.getTime():(e??0)-(t??0)}function $e({key:t,order:e}){const n=e==="asc"?Te:We;return(a,s)=>n(a[t],s[t])}function Ie(t){if(!t||!t.length)return;const e=t.map(n=>$e(n));return t.length===1?e[0]:function(n,a){for(let s=0;s<e.length;s++){const r=e[s](n,a);if(r!==0)return r}return 0}}function Pe(t,e){return t.sort(Ie(e))}class Ce extends _e{_sort;constructor(e){super(),this.parse(e,0)}parse(e,n){if(!e||!e.length)return;const a=e.map(s=>this.normalizeTask(s,e));super.parse(a,n),this._sort&&this.sortBranch(this._sort,n)}getBranch(e){const n=this._pool.get(e);return this._pool.get(n.parent||0).data}contains(e,n){const a=this._pool.get(e).data;let s=!1;if(a)for(let r=0;r<a.length;r++){if(a[r].id===n){s=!0;break}if(a[r].data&&(s=this.contains(a[r].id,n),s))break}return s}getIndexById(e){return this.getBranch(e).findIndex(n=>n.id===e)}add(e,n){const a=this.normalizeTask(e);return super.add(a,n),a}copy(e,n,a){const s=this.add({...e,id:null,data:null,parent:n},a);let r=[[e.id,s.id]];return e.data?.forEach((i,o)=>{const c=this.copy(i,s.id,o);r=r.concat(c)}),r}normalizeTask(e){const n=e.id||nt(),a=e.parent||0,s=e.text||"",r=e.type||"task",i=e.progress||0,o=e.details||"",c={...e,id:n,text:s,parent:a,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 a=this._pool.get(e);if(!a.parent)return null;const s=this._pool.get(a.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 s.type==="summary"?s.id:this.getSummaryId(s.id)}sort(e){this._sort=e,e&&this.sortBranch(e,0)}sortBranch(e,n){const a=this._pool.get(n||0).data;a&&(Pe(a,e),a.forEach(s=>{this.sortBranch(e,s.id)}))}serialize(){const e=[],n=this._pool.get(0).data;return n&&Pt(n,e),e}}function Pt(t,e){t.forEach(n=>{e.push(n),n.data&&Pt(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 R(t,e){const n=w(t);return isNaN(e)?D(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function at(t,e){const n=w(t);if(isNaN(e))return D(t,NaN);if(!e)return n;const a=n.getDate(),s=D(t,n.getTime());s.setMonth(n.getMonth()+e+1,0);const r=s.getDate();return a>=r?s:(n.setFullYear(s.getFullYear(),s.getMonth(),a),n)}function Ct(t,e){const n=+w(t);return D(t,n+e)}const J=6048e5,Ee=864e5,Et=6e4,Ot=36e5;function Oe(t,e){return Ct(t,e*Ot)}let He={};function F(){return He}function I(t,e){const n=F(),a=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=w(t),r=s.getDay(),i=(r<a?7:0)+r-a;return s.setDate(s.getDate()-i),s.setHours(0,0,0,0),s}function N(t){return I(t,{weekStartsOn:1})}function Ht(t){const e=w(t),n=e.getFullYear(),a=D(t,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const s=N(a),r=D(t,0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);const i=N(r);return e.getTime()>=s.getTime()?n+1:e.getTime()>=i.getTime()?n:n-1}function E(t){const e=w(t);return e.setHours(0,0,0,0),e}function V(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 st(t,e){const n=E(t),a=E(e),s=+n-V(n),r=+a-V(a);return Math.round((s-r)/Ee)}function rt(t){const e=Ht(t),n=D(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),N(n)}function Ne(t,e){return Ct(t,e*Et)}function Ye(t,e){const n=e*3;return at(t,n)}function Nt(t,e){const n=e*7;return R(t,n)}function ze(t,e){return at(t,e*12)}function q(t,e){const n=w(t),a=w(e),s=n.getTime()-a.getTime();return s<0?-1:s>0?1:s}function Ae(t,e){const n=E(t),a=E(e);return+n==+a}function Be(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Fe(t){if(!Be(t)&&typeof t!="number")return!1;const e=w(t);return!isNaN(Number(e))}function it(t,e){const n=N(t),a=N(e),s=+n-V(n),r=+a-V(a);return Math.round((s-r)/J)}function qe(t,e){const n=w(t),a=w(e),s=n.getFullYear()-a.getFullYear(),r=n.getMonth()-a.getMonth();return s*12+r}function Ue(t,e){const n=w(t),a=w(e);return n.getFullYear()-a.getFullYear()}function ot(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function Yt(t,e){return+w(t)-+w(e)}function je(t,e,n){const a=Yt(t,e)/Ot;return ot(n?.roundingMethod)(a)}function Le(t,e,n){const a=Yt(t,e)/Et;return ot(n?.roundingMethod)(a)}function zt(t){const e=w(t);return e.setHours(23,59,59,999),e}function ct(t){const e=w(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function Xe(t){const e=w(t);return+zt(e)==+ct(e)}function At(t,e){const n=w(t),a=w(e),s=q(n,a),r=Math.abs(qe(n,a));let i;if(r<1)i=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*r);let o=q(n,a)===-s;Xe(w(t))&&r===1&&q(t,a)===1&&(o=!1),i=s*(r-Number(o))}return i===0?0:i}function Qe(t,e,n){const a=At(t,e)/3;return ot(n?.roundingMethod)(a)}function Ge(t,e){const n=w(t),a=w(e),s=q(n,a),r=Math.abs(Ue(n,a));n.setFullYear(1584),a.setFullYear(1584);const i=q(n,a)===-s,o=s*(r-+i);return o===0?0:o}function U(t){const e=w(t),n=e.getMonth(),a=n-n%3;return e.setMonth(a,1),e.setHours(0,0,0,0),e}function Bt(t){const e=w(t);return e.setDate(1),e.setHours(0,0,0,0),e}function Re(t){const e=w(t),n=e.getFullYear();return e.setFullYear(n+1,0,0),e.setHours(23,59,59,999),e}function Ft(t){const e=w(t),n=D(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Je(t){const e=w(t);return e.setMinutes(59,59,999),e}function Ve(t,e){const n=F(),a=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=w(t),r=s.getDay(),i=(r<a?-7:0)+6-(r-a);return s.setDate(s.getDate()+i),s.setHours(23,59,59,999),s}function dt(t){const e=w(t),n=e.getMonth(),a=n-n%3+3;return e.setMonth(a,0),e.setHours(23,59,59,999),e}const Ke={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"}},Ze=(t,e,n)=>{let a;const s=Ke[t];return typeof s=="string"?a=s:e===1?a=s.one:a=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a};function ut(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const tn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},en={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},nn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},an={date:ut({formats:tn,defaultWidth:"full"}),time:ut({formats:en,defaultWidth:"full"}),dateTime:ut({formats:nn,defaultWidth:"full"})},sn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},rn=(t,e,n,a)=>sn[t];function j(t){return(e,n)=>{const a=n?.context?String(n.context):"standalone";let s;if(a==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):i;s=t.formattingValues[o]||t.formattingValues[i]}else{const i=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;s=t.values[o]||t.values[i]}const r=t.argumentCallback?t.argumentCallback(e):e;return s[r]}}const on={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},cn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},dn={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"]},un={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"]},ln={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=(t,e)=>{const n=Number(t),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},mn={ordinalNumber:fn,era:j({values:on,defaultWidth:"wide"}),quarter:j({values:cn,defaultWidth:"wide",argumentCallback:t=>t-1}),month:j({values:dn,defaultWidth:"wide"}),day:j({values:un,defaultWidth:"wide"}),dayPeriod:j({values:ln,defaultWidth:"wide",formattingValues:hn,defaultFormattingWidth:"wide"})};function L(t){return(e,n={})=>{const a=n.width,s=a&&t.matchPatterns[a]||t.matchPatterns[t.defaultMatchWidth],r=e.match(s);if(!r)return null;const i=r[0],o=a&&t.parsePatterns[a]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(o)?pn(o,l=>l.test(i)):gn(o,l=>l.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 gn(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function pn(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function yn(t){return(e,n={})=>{const a=e.match(t.matchPattern);if(!a)return null;const s=a[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(s.length);return{value:i,rest:o}}}const kn=/^(\d+)(th|st|nd|rd)?/i,wn=/\d+/i,bn={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},xn={any:[/^b/i,/^(a|c)/i]},_n={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},vn={any:[/1/i,/2/i,/3/i,/4/i]},Sn={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},Mn={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]},Dn={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},Tn={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]},Wn={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},$n={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}},In={ordinalNumber:yn({matchPattern:kn,parsePattern:wn,valueCallback:t=>parseInt(t,10)}),era:L({matchPatterns:bn,defaultMatchWidth:"wide",parsePatterns:xn,defaultParseWidth:"any"}),quarter:L({matchPatterns:_n,defaultMatchWidth:"wide",parsePatterns:vn,defaultParseWidth:"any",valueCallback:t=>t+1}),month:L({matchPatterns:Sn,defaultMatchWidth:"wide",parsePatterns:Mn,defaultParseWidth:"any"}),day:L({matchPatterns:Dn,defaultMatchWidth:"wide",parsePatterns:Tn,defaultParseWidth:"any"}),dayPeriod:L({matchPatterns:Wn,defaultMatchWidth:"any",parsePatterns:$n,defaultParseWidth:"any"})},Pn={code:"en-US",formatDistance:Ze,formatLong:an,formatRelative:rn,localize:mn,match:In,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Cn(t){const e=w(t);return st(e,Ft(e))+1}function En(t){const e=w(t),n=+N(e)-+rt(e);return Math.round(n/J)+1}function qt(t,e){const n=w(t),a=n.getFullYear(),s=F(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=D(t,0);i.setFullYear(a+1,0,r),i.setHours(0,0,0,0);const o=I(i,e),c=D(t,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const d=I(c,e);return n.getTime()>=o.getTime()?a+1:n.getTime()>=d.getTime()?a:a-1}function On(t,e){const n=F(),a=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=qt(t,e),r=D(t,0);return r.setFullYear(s,0,a),r.setHours(0,0,0,0),I(r,e)}function Hn(t,e){const n=w(t),a=+I(n,e)-+On(n,e);return Math.round(a/J)+1}function x(t,e){const n=t<0?"-":"",a=Math.abs(t).toString().padStart(e,"0");return n+a}const P={y(t,e){const n=t.getFullYear(),a=n>0?n:1-n;return x(e==="yy"?a%100:a,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,a=t.getMilliseconds(),s=Math.trunc(a*Math.pow(10,n-3));return x(s,e.length)}},Y={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ut={G:function(t,e,n){const a=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const a=t.getFullYear(),s=a>0?a:1-a;return n.ordinalNumber(s,{unit:"year"})}return P.y(t,e)},Y:function(t,e,n,a){const s=qt(t,a),r=s>0?s:1-s;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=Ht(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 a=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(a);case"QQ":return x(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(t,e,n){const a=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(a);case"qq":return x(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(t,e,n){const a=t.getMonth();switch(e){case"M":case"MM":return P.M(t,e);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(t,e,n){const a=t.getMonth();switch(e){case"L":return String(a+1);case"LL":return x(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(t,e,n,a){const s=Hn(t,a);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):x(s,e.length)},I:function(t,e,n){const a=En(t);return e==="Io"?n.ordinalNumber(a,{unit:"week"}):x(a,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):P.d(t,e)},D:function(t,e,n){const a=Cn(t);return e==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):x(a,e.length)},E:function(t,e,n){const a=t.getDay();switch(e){case"E":case"EE":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"})}},e:function(t,e,n,a){const s=t.getDay(),r=(s-a.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(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"})}},c:function(t,e,n,a){const s=t.getDay(),r=(s-a.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(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const a=t.getDay(),s=a===0?7:a;switch(e){case"i":return String(s);case"ii":return x(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const a=t.getHours();let s;switch(a===12?s=Y.noon:a===0?s=Y.midnight:s=a/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const a=t.getHours();let s;switch(a>=17?s=Y.evening:a>=12?s=Y.afternoon:a>=4?s=Y.morning:s=Y.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let a=t.getHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return P.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):P.H(t,e)},K:function(t,e,n){const a=t.getHours()%12;return e==="Ko"?n.ordinalNumber(a,{unit:"hour"}):x(a,e.length)},k:function(t,e,n){let a=t.getHours();return a===0&&(a=24),e==="ko"?n.ordinalNumber(a,{unit:"hour"}):x(a,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):P.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):P.s(t,e)},S:function(t,e){return P.S(t,e)},X:function(t,e,n){const a=t.getTimezoneOffset();if(a===0)return"Z";switch(e){case"X":return Lt(a);case"XXXX":case"XX":return O(a);case"XXXXX":case"XXX":default:return O(a,":")}},x:function(t,e,n){const a=t.getTimezoneOffset();switch(e){case"x":return Lt(a);case"xxxx":case"xx":return O(a);case"xxxxx":case"xxx":default:return O(a,":")}},O:function(t,e,n){const a=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+jt(a,":");case"OOOO":default:return"GMT"+O(a,":")}},z:function(t,e,n){const a=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+jt(a,":");case"zzzz":default:return"GMT"+O(a,":")}},t:function(t,e,n){const a=Math.trunc(t.getTime()/1e3);return x(a,e.length)},T:function(t,e,n){const a=t.getTime();return x(a,e.length)}};function jt(t,e=""){const n=t>0?"-":"+",a=Math.abs(t),s=Math.trunc(a/60),r=a%60;return r===0?n+String(s):n+String(s)+e+x(r,2)}function Lt(t,e){return t%60===0?(t>0?"-":"+")+x(Math.abs(t)/60,2):O(t,e)}function O(t,e=""){const n=t>0?"-":"+",a=Math.abs(t),s=x(Math.trunc(a/60),2),r=x(a%60,2);return n+s+e+r}const Xt=(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"})}},Qt=(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"})}},Nn=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],a=n[1],s=n[2];if(!s)return Xt(t,e);let r;switch(a){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}}",Xt(a,e)).replace("{{time}}",Qt(s,e))},Yn={p:Qt,P:Nn},zn=/^D+$/,An=/^Y+$/,Bn=["D","DD","YY","YYYY"];function Fn(t){return zn.test(t)}function qn(t){return An.test(t)}function Un(t,e,n){const a=jn(t,e,n);if(console.warn(a),Bn.includes(t))throw new RangeError(a)}function jn(t,e,n){const a=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Ln=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Xn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Qn=/^'([^]*?)'?$/,Gn=/''/g,Rn=/[a-zA-Z]/;function Jn(t,e,n){const a=F(),s=n?.locale??a.locale??Pn,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,o=w(t);if(!Fe(o))throw new RangeError("Invalid time value");let c=e.match(Xn).map(u=>{const l=u[0];if(l==="p"||l==="P"){const h=Yn[l];return h(u,s.formatLong)}return u}).join("").match(Ln).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const l=u[0];if(l==="'")return{isToken:!1,value:Vn(u)};if(Ut[l])return{isToken:!0,value:u};if(l.match(Rn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return{isToken:!1,value:u}});s.localize.preprocessor&&(c=s.localize.preprocessor(o,c));const d={firstWeekContainsDate:r,weekStartsOn:i,locale:s};return c.map(u=>{if(!u.isToken)return u.value;const l=u.value;(!n?.useAdditionalWeekYearTokens&&qn(l)||!n?.useAdditionalDayOfYearTokens&&Fn(l))&&Un(l,e,String(t));const h=Ut[l[0]];return h(o,l,s.localize,d)}).join("")}function Vn(t){const e=t.match(Qn);return e?e[1].replace(Gn,"'"):t}function Gt(t){const e=w(t),n=e.getFullYear(),a=e.getMonth(),s=D(t,0);return s.setFullYear(n,a+1,0),s.setHours(0,0,0,0),s.getDate()}function Kn(t){const e=w(t).getFullYear();return e%400===0||e%4===0&&e%100!==0}function Rt(t){const e=w(t);return String(new Date(e))==="Invalid Date"?NaN:Kn(e)?366:365}function Zn(t){const e=rt(t),n=+rt(Nt(e,60))-+e;return Math.round(n/J)}function z(t,e){const n=w(t),a=w(e);return+n==+a}function ta(t){const e=w(t);return e.setMinutes(0,0,0),e}function ea(t,e,n){const a=I(t,n),s=I(e,n);return+a==+s}function na(t,e){const n=w(t),a=w(e);return n.getFullYear()===a.getFullYear()&&n.getMonth()===a.getMonth()}function aa(t,e){const n=U(t),a=U(e);return+n==+a}function sa(t,e){const n=w(t),a=w(e);return n.getFullYear()===a.getFullYear()}const lt={year:Ge,quarter:Qe,month:At,week:it,day:st,hour:je,minute:Le},C={year:{quarter:4,month:12,week:Zn,day:ra,hour:ia},quarter:{month:3,week:oa,day:Jt,hour:ca},month:{week:da,day:ua,hour:la},week:{day:7,hour:24*7},day:{hour:24},hour:{minute:60}};function ra(t){return t?Rt(t):365}function ia(t){return Rt(t)*24}function oa(t){const e=U(t),n=R(E(dt(t)),1);return it(n,e)}function Jt(t){if(t){const e=U(t),n=dt(t);return st(n,e)+1}return 91}function ca(t){return Jt(t)*24}function da(t){if(t){const e=Bt(t),n=R(E(ct(t)),1);return it(n,e)}return 5}function ua(t){return t?Gt(t):30}function la(t){return Gt(t)*24}function K(t,e,n){const a=C[t][e];return a?typeof a=="number"?a:a(n):1}function ha(t,e){return t===e||!!(C[t]&&C[t][e])}const Z={year:ze,quarter:Ye,month:at,week:Nt,day:R,hour:Oe,minute:Ne};function tt(t,e,n){if(e){if(t==="day")return(a,s)=>e.getWorkingDays(s,a,!0);if(t==="hour")return(a,s)=>e.getWorkingHours(s,a,!0)}return(a,s,r,i)=>!C[t][r]||typeof C[t][r]=="number"||Zt(t,a,s,n)?X(t,a,s,r,i,n):fa(a,s,t,r,i,n)}function X(t,e,n,a,s,r){const i=a||t;let o=n,c=e;if(s&&(o=$(i,n,r),c=$(i,e,r),c<e&&(c=T(i)(c,1))),t!==i){const d=lt[i](c,o),u=K(t,i,n);return d/u}else return lt[i](c,o)}function fa(t,e,n,a,s,r){let i=0;const o=$(n,e,r);if(e>o){const d=Z[n](o,1);i=X(n,d,e,a,void 0,r),e=d}let c=0;return Zt(n,e,t,r)||(c=X(n,$(n,t,r),e,void 0,void 0,r),e=Z[n](e,c)),c+=i+X(n,t,e,a,void 0,r),!c&&s&&(c=X(n,t,e,a,s,r)),c}function T(t,e){if(e){if(t==="day")return(n,a)=>e.addWorkingDays(n,a,!0);if(t==="hour")return(n,a)=>e.addWorkingHours(n,a)}return Z[t]}const Vt={year:Ft,quarter:U,month:Bt,week:(t,e)=>I(t,{weekStartsOn:e}),day:E,hour:ta};function $(t,e,n){const a=Vt[t];return a?a(e,n):new Date(e)}const ma={year:Re,quarter:dt,month:ct,week:(t,e)=>Ve(t,{weekStartsOn:e}),day:zt,hour:Je},Kt={year:sa,quarter:aa,month:na,week:(t,e,n)=>ea(t,e,{weekStartsOn:n}),day:Ae};function Zt(t,e,n,a){const s=Kt[t];return s?s(e,n,a):!1}const ga={start:Vt,end:ma,add:Z,isSame:Kt,diff:lt,smallerCount:C},te=t=>typeof t=="function"?t(new Date):t;function pa(t,e){for(const n in e){if(n==="smallerCount"){const a=Object.keys(e[n]).sort((o,c)=>W.indexOf(o)-W.indexOf(c)).shift();let s=W.indexOf(a);const r=e[n][a],i=te(r);for(let o=s-1;o>=0;o--){const c=W[o],d=te(C[c][a]);if(i<=d)break;s=o}W.splice(s,0,t)}if(n==="biggerCount")for(const a in e[n])C[a][t]=e[n][a];else ga[n][t]=e[n]}}function ht(t,e=1,n){return n.isWorkingDay(t)||(t=e>0?n.getNextWorkingDay(t):n.getPreviousWorkingDay(t)),t}function ya(t){return(e,n)=>{if(n>0)for(let a=0;a<n;a++)e=t.getNextWorkingDay(e);if(n<0)for(let a=0;a>n;a--)e=t.getPreviousWorkingDay(e);return e}}function A(t){const e=new Date;return t.map(n=>({item:n,len:T(n.unit)(e,1)})).sort((n,a)=>n.len<a.len?-1:1)[0].item}const W=["year","quarter","month","week","day","hour"],ft=50,mt=300;function ka(t,e,n,a,s){let r=t,i=e,o=!1,c=!1;s&&s.forEach(u=>{(!t||n)&&(!r||u.start<=r)&&(r=u.start,o=!0);const l=u.type==="milestone"?u.start:u.end;(!e||n)&&(!i||l>=i)&&(i=l,c=!0)});const d=T(a||"day");return r?o&&(r=d(r,-1)):i?r=d(i,-30):r=new Date,i?c&&(i=d(i,1)):i=d(r,30),{_start:r,_end:i}}function wa(t,e,n,a,s,r,i){const o=A(i).unit,c=tt(o,void 0,r),d=c(e,t,"",!0),u=$(o,e,r);t=$(o,t,r),e=u<e?T(o)(u,1):u;const l=d*a,h=s*i.length,m=i.map(f=>{const y=[],p=T(f.unit);let k=$(f.unit,t,r);for(;k<e;){const b=p(k,f.step),_=k<t?t:k,v=b>e?e:b,S=c(v,_,"",!0)*a,M=typeof f.format=="function"?f.format(k,b):f.format;let B="";f.css&&(B+=typeof f.css=="function"?f.css(k):f.css),y.push({width:S,value:M,date:_,css:B,unit:f.unit}),k=b}return{cells:y,add:p,height:s}});let g=a;return o!==n&&(g=Math.round(g/K(o,n))||1),{rows:m,width:l,height:h,diff:c,start:t,end:e,lengthUnit:n,minUnit:o,lengthUnitWidth:g}}function ba(t,e,n,a){const s=typeof t=="boolean"?{}:t,r=W.indexOf(A(n).unit);if(typeof s.level>"u"&&(s.level=r),s.levels)s.levels.forEach(c=>{c.minCellWidth||(c.minCellWidth=et(s.minCellWidth,ft)),c.maxCellWidth||(c.maxCellWidth=et(s.maxCellWidth,mt))});else{const c=[],d=n.length||1,u=et(s.minCellWidth,ft),l=et(s.maxCellWidth,mt);n.forEach(h=>{h.format&&!e[h.unit]&&(e[h.unit]=h.format)}),W.forEach((h,m)=>{if(m===r)c.push({minCellWidth:u,maxCellWidth:l,scales:n});else{const g=[];if(m)for(let f=d-1;f>0;f--){const y=W[m-f];y&&g.push({unit:y,step:1,format:e[y]})}g.push({unit:h,step:1,format:e[h]}),c.push({minCellWidth:u,maxCellWidth:l,scales:g})}}),s.levels=c}s.levels[s.level]||(s.level=0);const i=s.levels[s.level],o=Math.min(Math.max(a,i.minCellWidth),i.maxCellWidth);return{zoom:s,scales:i.scales,cellWidth:o}}function xa(t,e,n,a,s,r,i){t.level=n;let o;const c=a.scales||a,d=A(c).unit,u=_a(d,s);if(e===-1){const m=K(d,s);o=i*m}else{const m=K(A(r).unit,d);o=Math.round(i/m)}const l=a.minCellWidth??ft,h=a.maxCellWidth??mt;return{scales:c,cellWidth:Math.min(h,Math.max(l,o)),lengthUnit:u,zoom:t}}function _a(t,e){const n=W.indexOf(t),a=W.indexOf(e);return a>=n?t==="hour"?"hour":"day":W[a]}function et(t,e){return t??e}const gt=8,ee=4,va=3,ne=7,Sa=gt+ee;function ae(t,e,n,a){(t.open||t.type!="summary")&&t.data?.forEach(s=>{typeof s.$x>"u"&&re(s,n,a),s.$x+=e,ae(s,e,n,a)})}function pt(t,e,n,a){const s=t.getSummaryId(e.id);if(s){const r=t.byId(s),i={xMin:1/0,xMax:0};se(r,i,n,a),r.$x=i.xMin,r.$w=i.xMax-i.xMin,pt(t,r,n,a)}}function se(t,e,n,a){t.data?.forEach(s=>{if(!s.unscheduled){typeof s.$x>"u"&&re(s,n,a);const r=s.type==="milestone"&&s.$h?s.$h/2:0;e.xMin>s.$x&&(e.xMin=s.$x+r);const i=s.$x+s.$w-r;e.xMax<i&&(e.xMax=i)}s.type!=="summary"&&se(s,e,n,a)})}function re(t,e,n){t.$x=Math.round(e.diff(t.start,e.start,e.lengthUnit)*n),t.$w=Math.round(e.diff(t.end,t.start,e.lengthUnit,!0)*n)}function yt(t,e){let n;e&&(n=e.filter(s=>s.parent==t.id));const a={data:n,...t};if(a.data?.length)a.data.forEach(s=>{if(s.unscheduled&&!s.data)return;(e||s.type!="summary"&&s.data)&&(s.unscheduled&&(s={...s,start:void 0,end:void 0}),s=yt(s,e)),s.start&&(!a.start||a.start>s.start)&&(a.start=new Date(s.start));const r=s.end||s.start;r&&(!a.end||a.end<r)&&(a.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 a}function ie(t,e,n){return oe(t,e,n,!1),n.splitTasks&&t.segments?.forEach(a=>{ie(a,e,{...n,baselines:!1}),a.$x-=t.$x}),n.baselines&&oe(t,e,n,!0),t}function oe(t,e,n,a){const{cellWidth:s,cellHeight:r,_scales:i,baselines:o}=n,{start:c,end:d,lengthUnit:u,diff:l}=i,h=(a?"base_":"")+"start",m=(a?"base_":"")+"end",g="$x"+(a?"_base":""),f="$y"+(a?"_base":""),y="$w"+(a?"_base":""),p="$h"+(a?"_base":""),k="$skip"+(a?"_baseline":"");let b=t[h],_=t[m];if(a&&!b){t[k]=!0;return}t[h]<c&&(t[m]<c||z(t[m],c))?b=_=c:t[h]>d&&(b=_=d),t[g]=Math.round(l(b,c,u)*s),t[f]=a?t.$y+t.$h+ee:r*e+va,t[y]=Math.round(l(_,b,u,!0)*s),t[p]=a?gt:o?r-ne-Sa:r-ne,t.type==="milestone"&&(t[g]=t[g]-t.$h/2,t[y]=t.$h,a&&(t[f]=t.$y+gt,t[y]=t[p]=t.$h)),n.unscheduledTasks&&t.unscheduled&&!a?t.$skip=!0:t[k]=z(b,_)}function Ma(t,e){return!1}function Da(t,e){}const kt=20,Ta=function(t,e,n,a,s){const r=Math.round(a/2)-3;if(!e||!n||!e.$y||!n.$y||e.$skip||n.$skip)return t.$p="",t.$pl=0,t;let i=!1,o=!1;switch(t.type){case"e2s":o=!0;break;case"s2s":i=!0,o=!0;break;case"s2e":i=!0;break}const c=i?e.$x:e.$x+e.$w,d=s?e.$y-7:e.$y,u=o?n.$x:n.$x+n.$w,l=s?n.$y-7:n.$y;if(c!==u||d!==l){const h=$a(c,d+r,u,l+r,i,o,a/2,s),m=Ia(u,l+r,o);t.$p=`${h},${m}`,t.$pl=Wa(t.$p)}return t};function Wa(t){const e=t.split(",").map(Number),n=[];for(let s=0;s<e.length;s+=2)s+1<e.length&&n.push([e[s],e[s+1]]);let a=0;for(let s=0;s<n.length-1;s++){const[r,i]=n[s],[o,c]=n[s+1];a+=Math.hypot(o-r,c-i)}return a}function $a(t,e,n,a,s,r,i,o){const c=kt*(s?-1:1),d=kt*(r?-1:1),u=t+c,l=n+d,h=[t,e,u,e,0,0,0,0,l,a,n,a],m=l-u;let g=a-e;const f=r===s;return f||(l<=t+kt-2&&r||l>t&&!r)&&(g=o?g-i+6:g-i),f&&r&&u>l||f&&!r&&u<l?(h[4]=h[2]+m,h[5]=h[3],h[6]=h[4],h[7]=h[5]+g):(h[4]=h[2],h[5]=h[3]+g,h[6]=h[4]+m,h[7]=h[5]),h.join(",")}function Ia(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 Pa(t,e,n){if(e&&n){const a=n.x-e.x,s=n.y-e.y,r=(a>0?e.x:n.x)-t.left,i=(s>0?e.y:n.y)-t.top,o=`${a>0?0:-a},${s>0?0:-s},${a>0?a:0},${s>0?s:0}`;return{width:Math.abs(a),height:Math.abs(s),left:r,top:i,p:o}}else return null}function ce(t){return t.map(e=>{const n=e.id||nt();return{...e,id:n}})}const de=["start","end","duration"];function Ca(t,e){const{type:n,unscheduled:a}=t;return a||n==="summary"?!de.includes(e):n==="milestone"?!["end","duration"].includes(e):!0}function Ea(t,e){return typeof e=="function"?e:de.includes(t)?(typeof e=="string"&&(e={type:e,config:{}}),e.config||(e.config={}),e.type==="datepicker"&&(e.config.buttons=["today"]),(n,a)=>Ca(n,a.id)?e:null):e}function Oa(t){return!t||!t.length?[]:t.map(e=>{const n=e.align||"left",a=e.id==="add-task",s=!a&&e.flexgrow?e.flexgrow:null,r=s?1:e.width||(a?50:120),i=e.editor&&Ea(e.id,e.editor);return{width:r,align:n,header:e.header,id:e.id,template:e.template,_template:e._template,...s&&{flexgrow:s},cell:e.cell,resize:e.resize??!0,sort:e.sort??!a,...i&&{editor:i},...e.options&&{options:e.options}}})}const Ha=[{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 Q(t,e,n,a){const{selected:s,tasks:r}=t.getState(),i=s.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"],l=["indent-task:add","move-task:down","move-task:up"],h={"indent-task:remove":2},m=!i&&u.includes(e),g={parent:l.includes(e),level:h[e]};if(n=n||(i?s[s.length-1]:null),!(!n&&!m)){if(e!=="paste-task"&&(t._temp=null),o.includes(e)||m||s.length===1)ue(t,e,n,a);else if(i){const f=c.includes(e)?s:Na(s,r,g);d.includes(e)&&f.reverse();const y=t.getHistory();y&&y.startBatch(),f.forEach((p,k)=>ue(t,e,p,a,k)),y&&y.endBatch()}}}function Na(t,e,n){let a=t.map(s=>{const r=e.byId(s);return{id:s,level:r.$level,parent:r.parent,index:e.getIndexById(s)}});return(n.parent||n.level)&&(a=a.filter(s=>n.level&&s.level<=n.level||!t.includes(s.parent))),a.sort((s,r)=>s.level-r.level||s.index-r.index),a.map(s=>s.id)}function ue(t,e,n,a,s){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={},l=!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 h=t.getHistory();h&&h.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(p=>p.id),y=[];g.forEach(p=>{f.includes(p.source)&&f.includes(p.target)&&y.push(p)}),y.forEach(p=>{r("add-link",{link:{source:m.get(p.source),target:m.get(p.target),type:p.type}})}),t._temp.forEach((p,k)=>{r("select-task",{id:m.get(p.id),toggle:!!k})})}h&&h.endBatch(),t._temp=null}return}else i==="add-task"?(u={task:{type:"task",text:a("New Task")},target:c,show:!0,select:!1},d={},l=!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 h=t.getTask(c),{segmentIndex:m}=n,g=h.segments.filter((f,y)=>y!==m);r("update-task",{id:c,task:{segments:g}});return}typeof o<"u"&&(u={mode:o,...u}),d={...d,...u},r(i,d),l&&r("select-task",{id:d.id,toggle:!!s})}function le(t,e){return t.some(n=>n.data?le(n.data,e):n.id===e)}const he=(t,e)=>T(t,e),Ya=(t,e)=>tt(t,e);function fe(t,e){Array.isArray(t)&&(t.forEach(n=>H(n,e)),t.forEach(n=>{if(n.type==="summary"&&!(n.start&&n.end)){const{start:a,end:s}=yt(n,t);n.start=a,n.end=s,H(n,e)}}))}function H(t,e){t.unscheduled||me(t,e,!1),t.base_start&&me(t,e,!0)}function me(t,e,n){const{calendar:a,durationUnit:s}=e,r=s||"day",[i,o,c]=ge(n);t.type==="milestone"?(t[c]=0,t[o]=void 0):t[i]&&(t[c]?t[o]=he(r,a)(t[i],t[c]):t[o]?t[c]=Ya(r,a)(t[o],t[i]):(t[o]=he(r,a)(t[i],1),t[c]=1))}function ge(t){return t?["base_start","base_end","base_duration"]:["start","end","duration"]}function pe(t,e,n){const[a,s,r]=ge(n);(e===r||e===a)&&(t[s]=null),e===s&&(t[r]=0,t[a]&&t[a]>=t[s]&&(t[s]=null,t[r]=1))}function za(t,e,n){pe(t,n,!1),t.base_start&&pe(t,n,!0),H(t,e)}class Aa extends Se{in;_router;_modules=new Map;constructor(e){super({writable:e,async:!1}),this._router=new Me(super.setState.bind(this),[{in:["tasks","start","end","scales","autoScale"],out:["_start","_end"],exec:s=>{const{_end:r,_start:i,start:o,end:c,tasks:d,scales:u,autoScale:l}=this.getState();if(!o||!c||l){const h=A(u).unit,m=ka(o,c,l,h,d);(m._end!=r||m._start!=i)&&this.setState(m,s)}else this.setState({_start:o,_end:c},s)}},{in:["_start","_end","cellWidth","scaleHeight","scales","lengthUnit","_weekStart"],out:["_scales"],exec:s=>{const r=this.getState();let{lengthUnit:i}=r;const{_start:o,_end:c,cellWidth:d,scaleHeight:u,scales:l,_weekStart:h}=r,m=A(l).unit;ha(m,i)||(i=m);const g=wa(o,c,i,d,u,h,l);this.setState({_scales:g},s)}},{in:["_scales","tasks","cellHeight","baselines","unscheduledTasks"],out:["_tasks"],exec:s=>{const{cellWidth:r,cellHeight:i,tasks:o,_scales:c,baselines:d,splitTasks:u,unscheduledTasks:l}=this.getState(),h=o.toArray().map((m,g)=>ie(m,g,{cellWidth:r,cellHeight:i,_scales:c,baselines:d,splitTasks:u,unscheduledTasks:l}));this.setState({_tasks:h},s)}},{in:["_tasks","links","cellHeight"],out:["_links"],exec:s=>{const{tasks:r,links:i,cellHeight:o,baselines:c,criticalPath:d}=this.getState(),u=i.map(l=>{const h=r.byId(l.source),m=r.byId(l.target);return Ta(l,h,m,o,c)}).toSorted((l,h)=>d?!!l.$critical==!!h.$critical?h.$pl-l.$pl:l.$critical?1:-1:h.$pl-l.$pl).filter(l=>l!==null);this.setState({_links:u},s)}},{in:["tasks","activeTask"],out:["_activeTask"],exec:s=>{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},s)}},{in:["tasks","selected"],out:["_selected"],exec:s=>{const{tasks:r,selected:i}=this.getState(),o=i.map(c=>r.byId(c)).filter(c=>!!c);this.setState({_selected:o},s)}},{in:["start","end"],out:["cellWidth"],exec:s=>{const{_cellWidth:r,cellWidth:i}=this.getState();r!=i&&this.setState({cellWidth:r},s)}}],{tasks:s=>new Ce(s),links:s=>new Dt(s),columns:s=>Oa(s)});const n=this.in=new De;n.on("show-editor",s=>{const{splitTasks:r}=this.getState();if(r){const{id:i,segmentIndex:o}=s;if(i&&(o||o===0)){this.setStateAsync({activeTask:{id:i,segmentIndex:o}});return}}this.setStateAsync({activeTask:s.id})}),n.on("select-task",({id:s,toggle:r,range:i,show:o,segmentIndex:c})=>{const{selected:d,_tasks:u,activeTask:l,splitTasks:h}=this.getState();let m=!1,g;if(d.length&&(r||i)){const y=[...d];if(i){const p=y[y.length-1],k=u.findIndex(M=>M.id==p),b=u.findIndex(M=>M.id==s),_=Math.min(k,b),v=Math.max(k,b)+1,S=u.slice(_,v).map(M=>M.id);k>b&&S.reverse(),S.forEach(M=>{y.includes(M)||y.push(M)})}else if(r){const p=y.findIndex(k=>k==s);p===-1?y.push(s):(m=!0,y.splice(p,1))}g=y}else g=[s];const f={selected:g};o&&g.length&&(f._scrollTask={id:g[0],mode:o}),this.setStateAsync(f),!m&&l&&(l!==s||h)&&n.exec("show-editor",{id:s,...h&&{segmentIndex:c}})}),n.on("delete-link",({id:s})=>{const{links:r}=this.getState();r.remove(s),this.setStateAsync({links:r})}),n.on("update-link",s=>{const{links:r}=this.getState(),i=s.id;let o=s.link;r.update(i,o),o=r.byId(i),!o.lag&&o.lag!==0&&delete o.lag,this.setStateAsync({links:r}),s.link=o}),n.on("add-link",s=>{const{link:r}=s,{links:i}=this.getState();!r.source||!r.target||(r.type||(r.type="e2s"),r.id=r.id||nt(),i.add(r),this.setStateAsync({links:i}),s.id=r.id,s.link=i.byId(r.id))});let a=null;n.on("move-task",s=>{const{tasks:r}=this.getState();let{mode:i,target:o}=s;const{id:c,inProgress:d}=s,u=r.byId(c);if(typeof d>"u"?s.source=u.parent:s.source=a=a??u.parent,d===!1){r.update(u.id,{$reorder:!1}),this.setState({tasks:r}),a=null;return}if(o===c||r.contains(c,o)){s.skipProvider=!0;return}if(i==="up"||i==="down"){const l=r.getBranch(c);let h=r.getIndexById(c);if(i==="up"){const m=u.parent===0;if(h===0&&m){s.skipProvider=!0;return}h-=1,i="before"}else if(i==="down"){const m=h===l.length-1,g=u.parent===0;if(m&&g){s.skipProvider=!0;return}h+=1,i="after"}if(o=l[h]&&l[h].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 y=r.getSummaryId(u.id);r.move(c,i,o);const p=r.getSummaryId(c);y!=p&&(y&&this.resetSummaryDates(y,"move-task"),p&&this.resetSummaryDates(p,"move-task"))}}else{const l=r.byId(o);let h=l,m=!1;for(;h.$level>u.$level;)h=r.byId(h.parent),h.id===c&&(m=!0);if(m)return;const g=r.getSummaryId(u.id);if(r.move(c,i,o),i=="child"){let y=l;for(;y.id!==0&&!y.open;)n.exec("open-task",{id:y.id,mode:!0}),y=r.byId(y.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}),s.target=o,s.mode=i}),n.on("drag-task",s=>{const r=this.getState(),{tasks:i,_tasks:o,_selected:c,_scales:d,cellWidth:u}=r,l=i.byId(s.id),{left:h,top:m,width:g,inProgress:f}=s,y={_tasks:o,_selected:c};if(typeof g<"u"&&(l.$w=g,pt(i,l,d,u)),typeof h<"u"){if(l.type==="summary"){const p=h-l.$x;ae(l,p,d,u)}l.$x=h,pt(i,l,d,u)}typeof m<"u"&&(l.$y=m+4,l.$reorder=f),typeof g<"u"&&(l.$w=g),typeof h<"u"&&(l.$x=h),typeof m<"u"&&(l.$y=m+4,l.$reorder=f),this.setState(y)}),n.on("update-task",s=>{const{id:r,segmentIndex:i,diff:o,eventSource:c}=s;let{task:d}=s;const{tasks:u,_scales:l,durationUnit:h,splitTasks:m,calendar:g}=this.getState(),f=u.byId(r),y={durationUnit:h,calendar:g};if(c==="add-task"||c==="copy-task"||c==="move-task"||c==="update-task"||c==="delete-task"||c==="provide-data"){H(d,y),u.update(r,d);return}const p=l.lengthUnit;let k=T(p);const b=tt(p,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=ht(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=ya(g)),this.moveSummaryKids(f,S=>(S=k(S,v),g?ht(S,o,g):S),"update-task")}d.start||(d.start=f.start),!d.end&&!d.duration&&(d.duration=f.duration),H(d,y),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}),s.task=u.byId(r)}),n.on("add-task",s=>{const{tasks:r,_scales:i,unscheduledTasks:o,durationUnit:c,splitTasks:d,calendar:u}=this.getState(),{target:l,mode:h,task:m,show:g,select:f=!0}=s;!s.eventSource&&o&&(m.unscheduled=!0);let y=-1,p,k;if(l?(k=r.byId(l),h=="child"?(p=k,m.parent=p.id):(k.parent!==null&&(p=r.byId(k.parent),m.parent=p.id),y=r.getIndexById(l),h=="after"&&(y+=1))):m.parent&&(p=r.byId(m.parent)),!m.start){if(p?.start)m.start=new Date(p.start.valueOf());else if(k)m.start=new Date(k.start.valueOf());else{const S=r.getBranch(0);let M;if(S?.length){const B=S[S.length-1];if(!B.$skip){const St=new Date(B.start.valueOf());i.start<=St&&(M=St)}}m.start=M||T(c,u)(i.start,1)}m.duration=1}u&&(m.start=ht(m.start,1,u)),this.getState().baselines&&(m.base_start=m.start,m.base_duration=m.duration),H(m,{durationUnit:c,calendar:u});const b=r.add(m,y),_={tasks:r};if(p&&g){for(;p&&p.id;)n.exec("open-task",{id:p.id,mode:!0}),p=r.byId(p.parent);_._scrollTask={id:b.id,mode:g}}s.id=b.id;const v=r.getSummaryId(b.id);v&&this.resetSummaryDates(v,"add-task"),this.setStateAsync(_),s.id=b.id,s.task=b,f&&n.exec("select-task",{id:b.id})}),n.on("delete-task",s=>{const{id:r}=s,{tasks:i,links:o,selected:c}=this.getState();s.source=i.byId(r).parent;const d=i.getSummaryId(r),u=[r];i.eachChild(h=>u.push(h.id),r),o.filter(h=>!(u.includes(h.source)||u.includes(h.target)));const l={tasks:i,links:o};c.includes(r)&&(l.selected=c.filter(h=>h!==r)),i.remove(r),d&&this.resetSummaryDates(d,"delete-task"),this.setStateAsync(l)}),n.on("indent-task",({id:s,mode:r})=>{const{tasks:i}=this.getState();if(r){const o=i.getBranch(s)[i.getIndexById(s)-1];o&&n.exec("move-task",{id:s,mode:"child",target:o.id})}else{const o=i.byId(s),c=i.byId(o.parent);c&&c.parent!==null&&n.exec("move-task",{id:s,mode:"after",target:o.parent})}}),n.on("copy-task",s=>{const{id:r,target:i,mode:o,eventSource:c}=s;if(c==="copy-task")return;const{tasks:d,links:u}=this.getState();if(d.contains(r,i)){s.skipProvider=!0;return}const l=d.getSummaryId(r),h=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);s.source=s.id,s.id=f[0][1],g.lazy&&(s.lazy=!0),l!=h&&h&&this.resetSummaryDates(h,"copy-task");let y=[];for(let p=1;p<f.length;p++){const[k,b]=f[p];u.forEach(_=>{if(_.source===k){const v={..._};delete v.target,y.push({...v,source:b})}else if(_.target===k){const v={..._};delete v.source,y.push({...v,target:b})}})}y=y.reduce((p,k)=>{const b=p.findIndex(_=>_.id===k.id);return b>-1?p[b]={...p[b],...k}:p.push(k),p},[]);for(let p=1;p<f.length;p++){const[k,b]=f[p],_=d.byId(b);n.exec("copy-task",{source:k,id:b,lazy:!!_.lazy,eventSource:"copy-task",target:_.parent,mode:"child",skipUndo:!0})}y.forEach(p=>{n.exec("add-link",{link:{source:p.source,target:p.target,type:p.type},eventSource:"copy-task",skipUndo:!0})}),this.setStateAsync({tasks:d})}),n.on("open-task",({id:s,mode:r})=>{const{tasks:i}=this.getState(),o=i.byId(s);o.lazy?n.exec("request-data",{id:o.id}):(i.toArray().forEach(c=>c.$y=0),i.update(s,{open:r}),this.setState({tasks:i}))}),n.on("scroll-chart",({left:s,top:r})=>{if(!isNaN(s)){const i=this.calcScaleDate(s);this.setState({scrollLeft:s,_scaleDate:i})}isNaN(r)||this.setState({scrollTop:r})}),n.on("render-data",s=>{this.setState({area:s})}),n.on("provide-data",s=>{const{tasks:r,links:i,durationUnit:o,calendar:c,splitTasks:d}=this.getState(),u=r.byId(s.id);u.lazy?(u.lazy=!1,u.open=!0):u.data=[],fe(s.data.tasks,{durationUnit:o,calendar:c}),r.parse(s.data.tasks,s.id),u.type=="summary"&&this.resetSummaryDates(u.id,"provide-data"),this.setStateAsync({tasks:r,links:new Dt(i.map(l=>l).concat(ce(s.data.links)))})}),n.on("zoom-scale",({dir:s,offset:r})=>{const{zoom:i,cellWidth:o,_cellWidth:c,scrollLeft:d}=this.getState(),u=r+d,l=this.calcScaleDate(u);let h=o;s<0&&(h=c||o);const m=h+s*50,g=i.levels[i.level],f=s<0&&o>g.maxCellWidth;if(m<g.minCellWidth||m>g.maxCellWidth||f){if(!this.changeScale(i,s))return}else this.setState({cellWidth:m,_cellWidth:m});const{_scales:y,_start:p,cellWidth:k,_weekStart:b}=this.getState(),_=$(y.minUnit,p,b),v=y.diff(l,_,"hour");typeof r>"u"&&(r=k);let S=Math.round(v*k)-r;S<0&&(S=0),this.setState({scrollLeft:S,_scaleDate:l,_zoomOffset:r})}),n.on("expand-scale",({minWidth:s})=>{const{_start:r,_scales:i,start:o,end:c,_end:d,cellWidth:u,_scaleDate:l,_zoomOffset:h}=this.getState(),m=T(i.minUnit);let g=i.width;if(o&&c){if(g<s&&g){const b=s/g;this.setState({cellWidth:u*b})}return!0}let f=0;for(;g<s;)g+=u,f++;const y=f?c?-f:-1:0,p=o||m(r,y);let k=0;if(l){const b=i.diff(l,p,"hour");k=Math.max(0,Math.round(b*u)-(h||0))}this.setState({_start:p,_end:c||m(d,f),scrollLeft:k})}),n.on("sort-tasks",({key:s,order:r,add:i})=>{const o=this.getState(),{tasks:c}=o;let d=o._sort;const u={key:s,order:r};let l=d?.length||0;l&&i?(d.forEach((h,m)=>{h.key===s&&(l=m)}),d[l]=u):d=[u],c.sort(d),this.setState({_sort:d,tasks:c})}),n.on("hotkey",({key:s,event:r,eventSource:i})=>{switch(s){case"arrowup":case"arrowdown":{const{selected:o,_tasks:c}=this.getState();r.preventDefault();const d=o.length;let u;if(s==="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 l=i==="chart"?"xy":!0;this.in.exec("select-task",{id:u,show:l})}break}case"ctrl+c":{Q(this,"copy-task",null,null);break}case"ctrl+x":{Q(this,"cut-task",null,null);break}case"ctrl+v":{Q(this,"paste-task",null,null);break}case"ctrl+d":case"backspace":{r.preventDefault(),Q(this,"delete-task",null,null);break}case"ctrl+z":{this.in.exec("undo",{});break}case"ctrl+y":{this.in.exec("redo",{});break}}})}init(e){const n=this.getState().area?{}:{scrollLeft:0,scrollTop:0,area:{from:0,start:0,end:0}};e.cellWidth&&(e._cellWidth=e.cellWidth),e._sort=null,e.unscheduledTasks=!1,e.baselines=!1,e.markers=[],e.undo=!1,e.schedule={},e.criticalPath=null,e.splitTasks=!1,Array.isArray(e.tasks)&&this.getHistory()?.resetHistory(),this._router.init({_scrollTask:null,selected:[],markers:[],autoScale:!0,durationUnit:"day",...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(){const{tasks:e}=this.getState();return e.serialize()}changeScale(e,n){const a=e.level+n,s=e.levels[a];if(s){const{cellWidth:r,scales:i,_scales:o}=this.getState(),c=xa(e,n,a,s,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,a){const{tasks:s,durationUnit:r,splitTasks:i,calendar:o}=this.getState(),c=s.byId(e),d=c.data;if(d?.length&&this.isScheduled(d)){const u=yt({...c,start:void 0,end:void 0,duration:void 0});if(!z(c.start,u.start)||!z(c.end,u.end)){a?(H(u,{durationUnit:r,calendar:o}),s.update(e,u)):this.in.exec("update-task",{id:e,task:u,eventSource:n,skipUndo:!0});const l=s.getSummaryId(e);l&&this.resetSummaryDates(l,n)}}}moveSummaryKids(e,n,a){const{tasks:s}=this.getState();e.data.forEach(r=>{const i={...s.byId(r.id),start:n(r.start)};delete i.end,delete i.id,this.in.exec("update-task",{id:r.id,task:i,eventSource:a,skipUndo:!0}),r.data?.length&&this.moveSummaryKids(r,n,a)})}calcScaleDate(e){const{_scales:n,_start:a,_weekStart:s}=this.getState(),r=n.lengthUnit==="day"?n.lengthUnitWidth/24:n.lengthUnitWidth;return T("hour")($(n.minUnit,a,s),Math.floor(e/r))}getNextRow(e){const n=this.getState()._tasks,a=n.findIndex(s=>s.id==e);return n[a+1]}getPrevRow(e){const n=this.getState()._tasks,a=n.findIndex(s=>s.id==e);return n[a-1]}}function Ba(t,e,n,a){if(typeof document>"u")return"";const s=document.createElement("canvas");{const r=Fa(s,t,e,1,n);qa(r,a,0,t,0,e)}return s.toDataURL()}function Fa(t,e,n,a,s){t.setAttribute("width",(e*a).toString()),t.setAttribute("height",(n*a).toString());const r=t.getContext("2d");return r.translate(-.5,-.5),r.strokeStyle=s,r}function qa(t,e,n,a,s,r){t.beginPath(),t.moveTo(a,s),t.lineTo(a,r),e==="full"&&t.lineTo(n,r),t.stroke()}function Ua(t){return[...ke]}function wt(t){return t.map(e=>{switch(e.data&&wt(e.data),e.id){case"add-task:before":case"move-task:up":e.isDisabled=(n,a)=>La(n,a);break;case"move-task:down":e.isDisabled=(n,a)=>Xa(n,a);break;case"indent-task:add":e.isDisabled=(n,a)=>Qa(n,a)===n.parent;break;case"indent-task:remove":e.isDisabled=n=>ja(n);break}return e})}function ja(t){return t.parent===0}function La(t,e){const{_tasks:n}=e;return n[0]?.id===t.id}function Xa(t,e){const{_tasks:n}=e;return n[n.length-1]?.id===t.id}function Qa(t,e){const{_tasks:n}=e,a=n.findIndex(s=>s.id===t.id);return n[a-1]?.id??t.parent}function ye(t){return t&&typeof t=="object"}function Ga(t){return!t.selected||t.selected.length<2}const Ra=t=>e=>e.type===t,ke=wt([{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:Ra(t.id)})},{id:"edit-task",text:"Edit",icon:"wxi-edit",isHidden:(t,e,n)=>ye(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)=>Ga(e)&&ye(n)}]);function Ja(t){return[...we]}const we=wt([{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 bt(t){return t.type==="summary"}function xt(t){return t.type==="milestone"}function _t(t){return typeof t.parent>"u"}function vt(t,e){return e.unscheduledTasks&&t.unscheduled}function Va(t){return[...be]}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:t=>_t(t)},{key:"start",comp:"date",label:"Start date",isHidden:t=>bt(t),isDisabled:vt},{key:"end",comp:"date",label:"End date",isHidden:t=>bt(t)||xt(t),isDisabled:vt},{key:"duration",comp:"counter",label:"Duration",config:{min:1},isHidden:t=>bt(t)||xt(t),isDisabled:vt},{key:"progress",comp:"slider",label:"Progress",config:{min:1,max:100},isHidden:t=>xt(t)||_t(t)},{key:"links",comp:"links",label:"",isHidden:t=>_t(t)}],Ka=[{id:"task",label:"Task"},{id:"summary",label:"Summary task"},{id:"milestone",label:"Milestone"}];export{Aa as DataStore,Ha as defaultColumns,be as defaultEditorItems,ke as defaultMenuOptions,Ka as defaultTaskTypes,we as defaultToolbarButtons,Da as extendDragOptions,Jn as format,T as getAdder,tt as getDiffer,Va as getEditorItems,Ua as getMenuOptions,Ja as getToolbarButtons,$ as getUnitStart,Ba as grid,Q as handleAction,le as isHandledAction,Ma as isSegmentMoveAllowed,ce as normalizeLinks,ba as normalizeZoom,fe as parseTaskDates,Pa as placeLink,za as prepareEditTask,pa as registerScaleUnit};
|
|
1
|
+
var Mt=new Date().valueOf(),xe=()=>Mt++;function nt(){return"temp://"+Mt++}var Dt=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:xe(),...t},this._data.push(t),this._pool.set(t.id,t)}update(t,e){const n=this._data.findIndex(s=>s.id==t),a={...this._data[n],...e};this._data[n]=a,this._pool.set(a.id,a)}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)}},_e=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 s=0;s<t.length;s++){const r=t[s];r.parent=r.parent||e,r.data=null,n.set(r.id,r)}for(let s=0;s<t.length;s++){const r=t[s],i=n.get(r.parent);i&&(i.data||(i.data=[]),i.data.push(r))}const a=n.get(e);this.setLevel(a,a.$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]:Wt(n,e,t):n.data=[t]}addAfter(t,e){if(!e)return this.add(t,-1);const n=this.byId(e),a=this.byId(n.parent),s=G(a,n.id)+1;t.parent=a.id,t.$level=a.$level+1,this.add(t,s)}remove(t){const e=this._pool.get(t);this._remove(e);const n=this._pool.get(e.parent);n.data=n.data.filter(a=>a.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 a=this._pool.get(n.parent),s=G(a,n.id);n={...n,...e},a&&s>=0&&(a.data[s]=n,a.data=[...a.data]),this._pool.set(n.id,n)}move(t,e,n){const a=this._pool.get(t),s=e==="child",r=this._pool.get(n),i=r.$level+(s?1:0);if(!a||!r)return;const o=this._pool.get(a.parent),c=s?r:this._pool.get(r.parent);c.data||(c.data=[]);const d=G(o,a.id);ve(o,d);const u=s?c.data.length:G(c,r.id)+(e==="after"?1:0);if(Wt(c,u,a),o.id===c.id&&d===u)return null;a.parent=c.id,a.$level!==i&&(a.$level=i,this.setLevel(a,i+1,!0)),this.update(a.id,a),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&&Tt(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((a,s)=>{t(this.byId(a.id),s),this.eachChild(t,a.id)})}setLevel(t,e,n){t.data&&(t.data=t.data.map(a=>(n&&(a={...a},this._pool.set(a.id,a)),a.$level=e,a.data&&this.setLevel(a,e+1,n),a)))}};function Tt(t,e){t.forEach(n=>{e.push(n),n.open===!0&&Tt(n.data,e)})}function ve(t,e){const n=[...t.data];n.splice(e,1),t.data=n}function Wt(t,e,n){const a=[...t.data];a.splice(e,0,n),t.data=a}function G(t,e){return t?.data.findIndex(n=>n.id===e)}var $t=2,Se=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,a,s,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=a+(a?".":"")+i;o?(o.__parse(d,u,s,r)&&(n[i]=d),r&$t?s[u]=o.__trigger:o.__trigger()):(d&&d.__reactive?e[i]=this._wrapNested(d,d,u,s):e[i]=this._wrapWritable(d),n[i]=d),s[u]=s[u]||null}}_wrapNested(t,e,n,a){const s=this._wrapWritable(t);return this._wrapProperties(t,s,e,n,a,0),s.__parse=(r,i,o,c)=>(this._wrapProperties(r,s,e,i,o,c),!1),s}_wrapWritable(t){const e=[],n=function(){for(let a=0;a<e.length;a++)e[a](t)};return{subscribe:a=>(e.push(a),this._async?setTimeout(a,1,t):a(t),()=>{const s=e.indexOf(a);s>=0&&e.splice(s,1)}),__trigger:()=>{e.length&&(this._async?setTimeout(n,1):n())},__parse:function(a){return t=a,!0}}}},Me=class{constructor(t,e,n,a){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(s=>{s.in.forEach(r=>{const i=this._triggers.get(r)||[];i.push(s),this._triggers.set(r,i)}),s.out.forEach(r=>{const i=this._sources.get(r)||{};s.in.forEach(o=>i[o]=!0),this._sources.set(r,i)})}),this._routes.forEach(s=>{s.length=Math.max(...s.in.map(r=>It(r,this._sources,1)))}),this._bus=a}init(t){const e={};for(const n in t)if(this._prev[n]!==t[n]){const a=this._parsers[n];e[n]=a?a(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,$t);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),a=!e.length;e=e||[];for(let s=0;s<n.length;s++){const r=n[s],i=this._triggers.get(r);i&&i.forEach(o=>{e.indexOf(o)==-1&&e.push(o)})}a&&this._execNext(e)}_execNext(t){for(;t.length;){t.sort((n,a)=>n.length<a.length?1:-1);const e=t[t.length-1];t.splice(t.length-1),e.exec(t)}}};function It(t,e,n){const a=e.get(t);if(!a)return n;const s=Object.keys(a).map(r=>It(r,e,n+1));return Math.max(...s)}var De=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(t,e,n){let a=this._handlers[t];a?n&&n.intercept?a.unshift(e):a.push(e):a=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 a=n.length-1;a>=0;a--)this._tag.get(n[a])===t&&n.splice(a,1)}}async exec(t,e){const n=this._handlers[t];if(n)for(let a=0;a<n.length;a++){const s=n[a](e);if(s===!1||s&&s.then&&await s===!1)return}return this._nextHandler&&await this._nextHandler.exec(t,e),e}setNext(t){return this._nextHandler=t}};function Te(t,e){return typeof t=="string"?t.localeCompare(e,void 0,{numeric:!0}):typeof t=="object"?t.getTime()-e.getTime():(t??0)-(e??0)}function We(t,e){return typeof t=="string"?-t.localeCompare(e,void 0,{numeric:!0}):typeof e=="object"?e.getTime()-t.getTime():(e??0)-(t??0)}function $e({key:t,order:e}){const n=e==="asc"?Te:We;return(a,s)=>n(a[t],s[t])}function Ie(t){if(!t||!t.length)return;const e=t.map(n=>$e(n));return t.length===1?e[0]:function(n,a){for(let s=0;s<e.length;s++){const r=e[s](n,a);if(r!==0)return r}return 0}}function Pe(t,e){return t.sort(Ie(e))}class Ce extends _e{_sort;constructor(e){super(),this.parse(e,0)}parse(e,n){if(!e||!e.length)return;const a=e.map(s=>this.normalizeTask(s));super.parse(a,n),this._sort&&this.sortBranch(this._sort,n)}getBranch(e){const n=this._pool.get(e);return this._pool.get(n.parent||0).data}contains(e,n){const a=this._pool.get(e).data;let s=!1;if(a)for(let r=0;r<a.length;r++){if(a[r].id===n){s=!0;break}if(a[r].data&&(s=this.contains(a[r].id,n),s))break}return s}getIndexById(e){return this.getBranch(e).findIndex(n=>n.id===e)}add(e,n){const a=this.normalizeTask(e);return super.add(a,n),a}copy(e,n,a){const s=this.add({...e,id:null,data:null,parent:n},a);let r=[[e.id,s.id]];return e.data?.forEach((i,o)=>{const c=this.copy(i,s.id,o);r=r.concat(c)}),r}normalizeTask(e){const n=e.id||nt(),a=e.parent||0,s=e.text||"",r=e.type||"task",i=e.progress||0,o=e.details||"",c={...e,id:n,text:s,parent:a,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 a=this._pool.get(e);if(!a.parent)return null;const s=this._pool.get(a.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 s.type==="summary"?s.id:this.getSummaryId(s.id)}sort(e){this._sort=e,e&&this.sortBranch(e,0)}sortBranch(e,n){const a=this._pool.get(n||0).data;a&&(Pe(a,e),a.forEach(s=>{this.sortBranch(e,s.id)}))}serialize(){const e=[],n=this._pool.get(0).data;return n&&Pt(n,e),e}}function Pt(t,e){t.forEach(n=>{e.push(n),n.data&&Pt(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 R(t,e){const n=w(t);return isNaN(e)?D(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function at(t,e){const n=w(t);if(isNaN(e))return D(t,NaN);if(!e)return n;const a=n.getDate(),s=D(t,n.getTime());s.setMonth(n.getMonth()+e+1,0);const r=s.getDate();return a>=r?s:(n.setFullYear(s.getFullYear(),s.getMonth(),a),n)}function Ct(t,e){const n=+w(t);return D(t,n+e)}const J=6048e5,Ee=864e5,Et=6e4,Ot=36e5;function Oe(t,e){return Ct(t,e*Ot)}let He={};function F(){return He}function I(t,e){const n=F(),a=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=w(t),r=s.getDay(),i=(r<a?7:0)+r-a;return s.setDate(s.getDate()-i),s.setHours(0,0,0,0),s}function N(t){return I(t,{weekStartsOn:1})}function Ht(t){const e=w(t),n=e.getFullYear(),a=D(t,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const s=N(a),r=D(t,0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);const i=N(r);return e.getTime()>=s.getTime()?n+1:e.getTime()>=i.getTime()?n:n-1}function E(t){const e=w(t);return e.setHours(0,0,0,0),e}function V(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 st(t,e){const n=E(t),a=E(e),s=+n-V(n),r=+a-V(a);return Math.round((s-r)/Ee)}function rt(t){const e=Ht(t),n=D(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),N(n)}function Ne(t,e){return Ct(t,e*Et)}function Ye(t,e){const n=e*3;return at(t,n)}function Nt(t,e){const n=e*7;return R(t,n)}function ze(t,e){return at(t,e*12)}function q(t,e){const n=w(t),a=w(e),s=n.getTime()-a.getTime();return s<0?-1:s>0?1:s}function Ae(t,e){const n=E(t),a=E(e);return+n==+a}function Be(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Fe(t){if(!Be(t)&&typeof t!="number")return!1;const e=w(t);return!isNaN(Number(e))}function it(t,e){const n=N(t),a=N(e),s=+n-V(n),r=+a-V(a);return Math.round((s-r)/J)}function qe(t,e){const n=w(t),a=w(e),s=n.getFullYear()-a.getFullYear(),r=n.getMonth()-a.getMonth();return s*12+r}function Ue(t,e){const n=w(t),a=w(e);return n.getFullYear()-a.getFullYear()}function ot(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function Yt(t,e){return+w(t)-+w(e)}function je(t,e,n){const a=Yt(t,e)/Ot;return ot(n?.roundingMethod)(a)}function Le(t,e,n){const a=Yt(t,e)/Et;return ot(n?.roundingMethod)(a)}function zt(t){const e=w(t);return e.setHours(23,59,59,999),e}function ct(t){const e=w(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function Xe(t){const e=w(t);return+zt(e)==+ct(e)}function At(t,e){const n=w(t),a=w(e),s=q(n,a),r=Math.abs(qe(n,a));let i;if(r<1)i=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*r);let o=q(n,a)===-s;Xe(w(t))&&r===1&&q(t,a)===1&&(o=!1),i=s*(r-Number(o))}return i===0?0:i}function Qe(t,e,n){const a=At(t,e)/3;return ot(n?.roundingMethod)(a)}function Ge(t,e){const n=w(t),a=w(e),s=q(n,a),r=Math.abs(Ue(n,a));n.setFullYear(1584),a.setFullYear(1584);const i=q(n,a)===-s,o=s*(r-+i);return o===0?0:o}function U(t){const e=w(t),n=e.getMonth(),a=n-n%3;return e.setMonth(a,1),e.setHours(0,0,0,0),e}function Bt(t){const e=w(t);return e.setDate(1),e.setHours(0,0,0,0),e}function Re(t){const e=w(t),n=e.getFullYear();return e.setFullYear(n+1,0,0),e.setHours(23,59,59,999),e}function Ft(t){const e=w(t),n=D(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Je(t){const e=w(t);return e.setMinutes(59,59,999),e}function Ve(t,e){const n=F(),a=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=w(t),r=s.getDay(),i=(r<a?-7:0)+6-(r-a);return s.setDate(s.getDate()+i),s.setHours(23,59,59,999),s}function dt(t){const e=w(t),n=e.getMonth(),a=n-n%3+3;return e.setMonth(a,0),e.setHours(23,59,59,999),e}const Ke={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"}},Ze=(t,e,n)=>{let a;const s=Ke[t];return typeof s=="string"?a=s:e===1?a=s.one:a=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a};function ut(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const tn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},en={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},nn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},an={date:ut({formats:tn,defaultWidth:"full"}),time:ut({formats:en,defaultWidth:"full"}),dateTime:ut({formats:nn,defaultWidth:"full"})},sn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},rn=(t,e,n,a)=>sn[t];function j(t){return(e,n)=>{const a=n?.context?String(n.context):"standalone";let s;if(a==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):i;s=t.formattingValues[o]||t.formattingValues[i]}else{const i=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;s=t.values[o]||t.values[i]}const r=t.argumentCallback?t.argumentCallback(e):e;return s[r]}}const on={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},cn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},dn={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"]},un={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"]},ln={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=(t,e)=>{const n=Number(t),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},mn={ordinalNumber:fn,era:j({values:on,defaultWidth:"wide"}),quarter:j({values:cn,defaultWidth:"wide",argumentCallback:t=>t-1}),month:j({values:dn,defaultWidth:"wide"}),day:j({values:un,defaultWidth:"wide"}),dayPeriod:j({values:ln,defaultWidth:"wide",formattingValues:hn,defaultFormattingWidth:"wide"})};function L(t){return(e,n={})=>{const a=n.width,s=a&&t.matchPatterns[a]||t.matchPatterns[t.defaultMatchWidth],r=e.match(s);if(!r)return null;const i=r[0],o=a&&t.parsePatterns[a]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(o)?pn(o,l=>l.test(i)):gn(o,l=>l.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 gn(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function pn(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function yn(t){return(e,n={})=>{const a=e.match(t.matchPattern);if(!a)return null;const s=a[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(s.length);return{value:i,rest:o}}}const kn=/^(\d+)(th|st|nd|rd)?/i,wn=/\d+/i,bn={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},xn={any:[/^b/i,/^(a|c)/i]},_n={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},vn={any:[/1/i,/2/i,/3/i,/4/i]},Sn={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},Mn={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]},Dn={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},Tn={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]},Wn={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},$n={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}},In={ordinalNumber:yn({matchPattern:kn,parsePattern:wn,valueCallback:t=>parseInt(t,10)}),era:L({matchPatterns:bn,defaultMatchWidth:"wide",parsePatterns:xn,defaultParseWidth:"any"}),quarter:L({matchPatterns:_n,defaultMatchWidth:"wide",parsePatterns:vn,defaultParseWidth:"any",valueCallback:t=>t+1}),month:L({matchPatterns:Sn,defaultMatchWidth:"wide",parsePatterns:Mn,defaultParseWidth:"any"}),day:L({matchPatterns:Dn,defaultMatchWidth:"wide",parsePatterns:Tn,defaultParseWidth:"any"}),dayPeriod:L({matchPatterns:Wn,defaultMatchWidth:"any",parsePatterns:$n,defaultParseWidth:"any"})},Pn={code:"en-US",formatDistance:Ze,formatLong:an,formatRelative:rn,localize:mn,match:In,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Cn(t){const e=w(t);return st(e,Ft(e))+1}function En(t){const e=w(t),n=+N(e)-+rt(e);return Math.round(n/J)+1}function qt(t,e){const n=w(t),a=n.getFullYear(),s=F(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=D(t,0);i.setFullYear(a+1,0,r),i.setHours(0,0,0,0);const o=I(i,e),c=D(t,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const d=I(c,e);return n.getTime()>=o.getTime()?a+1:n.getTime()>=d.getTime()?a:a-1}function On(t,e){const n=F(),a=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=qt(t,e),r=D(t,0);return r.setFullYear(s,0,a),r.setHours(0,0,0,0),I(r,e)}function Hn(t,e){const n=w(t),a=+I(n,e)-+On(n,e);return Math.round(a/J)+1}function x(t,e){const n=t<0?"-":"",a=Math.abs(t).toString().padStart(e,"0");return n+a}const P={y(t,e){const n=t.getFullYear(),a=n>0?n:1-n;return x(e==="yy"?a%100:a,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,a=t.getMilliseconds(),s=Math.trunc(a*Math.pow(10,n-3));return x(s,e.length)}},Y={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ut={G:function(t,e,n){const a=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const a=t.getFullYear(),s=a>0?a:1-a;return n.ordinalNumber(s,{unit:"year"})}return P.y(t,e)},Y:function(t,e,n,a){const s=qt(t,a),r=s>0?s:1-s;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=Ht(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 a=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(a);case"QQ":return x(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(t,e,n){const a=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(a);case"qq":return x(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(t,e,n){const a=t.getMonth();switch(e){case"M":case"MM":return P.M(t,e);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(t,e,n){const a=t.getMonth();switch(e){case"L":return String(a+1);case"LL":return x(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(t,e,n,a){const s=Hn(t,a);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):x(s,e.length)},I:function(t,e,n){const a=En(t);return e==="Io"?n.ordinalNumber(a,{unit:"week"}):x(a,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):P.d(t,e)},D:function(t,e,n){const a=Cn(t);return e==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):x(a,e.length)},E:function(t,e,n){const a=t.getDay();switch(e){case"E":case"EE":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"})}},e:function(t,e,n,a){const s=t.getDay(),r=(s-a.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(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"})}},c:function(t,e,n,a){const s=t.getDay(),r=(s-a.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(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const a=t.getDay(),s=a===0?7:a;switch(e){case"i":return String(s);case"ii":return x(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const a=t.getHours();let s;switch(a===12?s=Y.noon:a===0?s=Y.midnight:s=a/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const a=t.getHours();let s;switch(a>=17?s=Y.evening:a>=12?s=Y.afternoon:a>=4?s=Y.morning:s=Y.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let a=t.getHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return P.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):P.H(t,e)},K:function(t,e,n){const a=t.getHours()%12;return e==="Ko"?n.ordinalNumber(a,{unit:"hour"}):x(a,e.length)},k:function(t,e,n){let a=t.getHours();return a===0&&(a=24),e==="ko"?n.ordinalNumber(a,{unit:"hour"}):x(a,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):P.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):P.s(t,e)},S:function(t,e){return P.S(t,e)},X:function(t,e,n){const a=t.getTimezoneOffset();if(a===0)return"Z";switch(e){case"X":return Lt(a);case"XXXX":case"XX":return O(a);case"XXXXX":case"XXX":default:return O(a,":")}},x:function(t,e,n){const a=t.getTimezoneOffset();switch(e){case"x":return Lt(a);case"xxxx":case"xx":return O(a);case"xxxxx":case"xxx":default:return O(a,":")}},O:function(t,e,n){const a=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+jt(a,":");case"OOOO":default:return"GMT"+O(a,":")}},z:function(t,e,n){const a=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+jt(a,":");case"zzzz":default:return"GMT"+O(a,":")}},t:function(t,e,n){const a=Math.trunc(t.getTime()/1e3);return x(a,e.length)},T:function(t,e,n){const a=t.getTime();return x(a,e.length)}};function jt(t,e=""){const n=t>0?"-":"+",a=Math.abs(t),s=Math.trunc(a/60),r=a%60;return r===0?n+String(s):n+String(s)+e+x(r,2)}function Lt(t,e){return t%60===0?(t>0?"-":"+")+x(Math.abs(t)/60,2):O(t,e)}function O(t,e=""){const n=t>0?"-":"+",a=Math.abs(t),s=x(Math.trunc(a/60),2),r=x(a%60,2);return n+s+e+r}const Xt=(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"})}},Qt=(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"})}},Nn=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],a=n[1],s=n[2];if(!s)return Xt(t,e);let r;switch(a){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}}",Xt(a,e)).replace("{{time}}",Qt(s,e))},Yn={p:Qt,P:Nn},zn=/^D+$/,An=/^Y+$/,Bn=["D","DD","YY","YYYY"];function Fn(t){return zn.test(t)}function qn(t){return An.test(t)}function Un(t,e,n){const a=jn(t,e,n);if(console.warn(a),Bn.includes(t))throw new RangeError(a)}function jn(t,e,n){const a=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Ln=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Xn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Qn=/^'([^]*?)'?$/,Gn=/''/g,Rn=/[a-zA-Z]/;function Jn(t,e,n){const a=F(),s=n?.locale??a.locale??Pn,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,o=w(t);if(!Fe(o))throw new RangeError("Invalid time value");let c=e.match(Xn).map(u=>{const l=u[0];if(l==="p"||l==="P"){const h=Yn[l];return h(u,s.formatLong)}return u}).join("").match(Ln).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const l=u[0];if(l==="'")return{isToken:!1,value:Vn(u)};if(Ut[l])return{isToken:!0,value:u};if(l.match(Rn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return{isToken:!1,value:u}});s.localize.preprocessor&&(c=s.localize.preprocessor(o,c));const d={firstWeekContainsDate:r,weekStartsOn:i,locale:s};return c.map(u=>{if(!u.isToken)return u.value;const l=u.value;(!n?.useAdditionalWeekYearTokens&&qn(l)||!n?.useAdditionalDayOfYearTokens&&Fn(l))&&Un(l,e,String(t));const h=Ut[l[0]];return h(o,l,s.localize,d)}).join("")}function Vn(t){const e=t.match(Qn);return e?e[1].replace(Gn,"'"):t}function Gt(t){const e=w(t),n=e.getFullYear(),a=e.getMonth(),s=D(t,0);return s.setFullYear(n,a+1,0),s.setHours(0,0,0,0),s.getDate()}function Kn(t){const e=w(t).getFullYear();return e%400===0||e%4===0&&e%100!==0}function Rt(t){const e=w(t);return String(new Date(e))==="Invalid Date"?NaN:Kn(e)?366:365}function Zn(t){const e=rt(t),n=+rt(Nt(e,60))-+e;return Math.round(n/J)}function z(t,e){const n=w(t),a=w(e);return+n==+a}function ta(t){const e=w(t);return e.setMinutes(0,0,0),e}function ea(t,e,n){const a=I(t,n),s=I(e,n);return+a==+s}function na(t,e){const n=w(t),a=w(e);return n.getFullYear()===a.getFullYear()&&n.getMonth()===a.getMonth()}function aa(t,e){const n=U(t),a=U(e);return+n==+a}function sa(t,e){const n=w(t),a=w(e);return n.getFullYear()===a.getFullYear()}const lt={year:Ge,quarter:Qe,month:At,week:it,day:st,hour:je,minute:Le},C={year:{quarter:4,month:12,week:Zn,day:ra,hour:ia},quarter:{month:3,week:oa,day:Jt,hour:ca},month:{week:da,day:ua,hour:la},week:{day:7,hour:24*7},day:{hour:24},hour:{minute:60}};function ra(t){return t?Rt(t):365}function ia(t){return Rt(t)*24}function oa(t){const e=U(t),n=R(E(dt(t)),1);return it(n,e)}function Jt(t){if(t){const e=U(t),n=dt(t);return st(n,e)+1}return 91}function ca(t){return Jt(t)*24}function da(t){if(t){const e=Bt(t),n=R(E(ct(t)),1);return it(n,e)}return 5}function ua(t){return t?Gt(t):30}function la(t){return Gt(t)*24}function K(t,e,n){const a=C[t][e];return a?typeof a=="number"?a:a(n):1}function ha(t,e){return t===e||!!(C[t]&&C[t][e])}const Z={year:ze,quarter:Ye,month:at,week:Nt,day:R,hour:Oe,minute:Ne};function tt(t,e,n){if(e){if(t==="day")return(a,s)=>e.getWorkingDays(s,a,!0);if(t==="hour")return(a,s)=>e.getWorkingHours(s,a,!0)}return(a,s,r,i)=>!C[t][r]||typeof C[t][r]=="number"||Zt(t,a,s,n)?X(t,a,s,r,i,n):fa(a,s,t,r,i,n)}function X(t,e,n,a,s,r){const i=a||t;let o=n,c=e;if(s&&(o=$(i,n,r),c=$(i,e,r),c<e&&(c=T(i)(c,1))),t!==i){const d=lt[i](c,o),u=K(t,i,n);return d/u}else return lt[i](c,o)}function fa(t,e,n,a,s,r){let i=0;const o=$(n,e,r);if(e>o){const d=Z[n](o,1);i=X(n,d,e,a,void 0,r),e=d}let c=0;return Zt(n,e,t,r)||(c=X(n,$(n,t,r),e,void 0,void 0,r),e=Z[n](e,c)),c+=i+X(n,t,e,a,void 0,r),!c&&s&&(c=X(n,t,e,a,s,r)),c}function T(t,e){if(e){if(t==="day")return(n,a)=>e.addWorkingDays(n,a,!0);if(t==="hour")return(n,a)=>e.addWorkingHours(n,a)}return Z[t]}const Vt={year:Ft,quarter:U,month:Bt,week:(t,e)=>I(t,{weekStartsOn:e}),day:E,hour:ta};function $(t,e,n){const a=Vt[t];return a?a(e,n):new Date(e)}const ma={year:Re,quarter:dt,month:ct,week:(t,e)=>Ve(t,{weekStartsOn:e}),day:zt,hour:Je},Kt={year:sa,quarter:aa,month:na,week:(t,e,n)=>ea(t,e,{weekStartsOn:n}),day:Ae};function Zt(t,e,n,a){const s=Kt[t];return s?s(e,n,a):!1}const ga={start:Vt,end:ma,add:Z,isSame:Kt,diff:lt,smallerCount:C},te=t=>typeof t=="function"?t(new Date):t;function pa(t,e){for(const n in e){if(n==="smallerCount"){const a=Object.keys(e[n]).sort((o,c)=>W.indexOf(o)-W.indexOf(c)).shift();let s=W.indexOf(a);const r=e[n][a],i=te(r);for(let o=s-1;o>=0;o--){const c=W[o],d=te(C[c][a]);if(i<=d)break;s=o}W.splice(s,0,t)}if(n==="biggerCount")for(const a in e[n])C[a][t]=e[n][a];else ga[n][t]=e[n]}}function ht(t,e=1,n){return n.isWorkingDay(t)||(t=e>0?n.getNextWorkingDay(t):n.getPreviousWorkingDay(t)),t}function ya(t){return(e,n)=>{if(n>0)for(let a=0;a<n;a++)e=t.getNextWorkingDay(e);if(n<0)for(let a=0;a>n;a--)e=t.getPreviousWorkingDay(e);return e}}function A(t){const e=new Date;return t.map(n=>({item:n,len:T(n.unit)(e,1)})).sort((n,a)=>n.len<a.len?-1:1)[0].item}const W=["year","quarter","month","week","day","hour"],ft=50,mt=300;function ka(t,e,n,a,s){let r=t,i=e,o=!1,c=!1;s&&s.forEach(u=>{(!t||n)&&(!r||u.start<=r)&&(r=u.start,o=!0);const l=u.type==="milestone"?u.start:u.end;(!e||n)&&(!i||l>=i)&&(i=l,c=!0)});const d=T(a||"day");return r?o&&(r=d(r,-1)):i?r=d(i,-30):r=new Date,i?c&&(i=d(i,1)):i=d(r,30),{_start:r,_end:i}}function wa(t,e,n,a,s,r,i){const o=A(i).unit,c=tt(o,void 0,r),d=c(e,t,"",!0),u=$(o,e,r);t=$(o,t,r),e=u<e?T(o)(u,1):u;const l=d*a,h=s*i.length,m=i.map(f=>{const y=[],p=T(f.unit);let k=$(f.unit,t,r);for(;k<e;){const b=p(k,f.step),_=k<t?t:k,v=b>e?e:b,S=c(v,_,"",!0)*a,M=typeof f.format=="function"?f.format(k,b):f.format;let B="";f.css&&(B+=typeof f.css=="function"?f.css(k):f.css),y.push({width:S,value:M,date:_,css:B,unit:f.unit}),k=b}return{cells:y,add:p,height:s}});let g=a;return o!==n&&(g=Math.round(g/K(o,n))||1),{rows:m,width:l,height:h,diff:c,start:t,end:e,lengthUnit:n,minUnit:o,lengthUnitWidth:g}}function ba(t,e,n,a){const s=typeof t=="boolean"?{}:t,r=W.indexOf(A(n).unit);if(typeof s.level>"u"&&(s.level=r),s.levels)s.levels.forEach(c=>{c.minCellWidth||(c.minCellWidth=et(s.minCellWidth,ft)),c.maxCellWidth||(c.maxCellWidth=et(s.maxCellWidth,mt))});else{const c=[],d=n.length||1,u=et(s.minCellWidth,ft),l=et(s.maxCellWidth,mt);n.forEach(h=>{h.format&&!e[h.unit]&&(e[h.unit]=h.format)}),W.forEach((h,m)=>{if(m===r)c.push({minCellWidth:u,maxCellWidth:l,scales:n});else{const g=[];if(m)for(let f=d-1;f>0;f--){const y=W[m-f];y&&g.push({unit:y,step:1,format:e[y]})}g.push({unit:h,step:1,format:e[h]}),c.push({minCellWidth:u,maxCellWidth:l,scales:g})}}),s.levels=c}s.levels[s.level]||(s.level=0);const i=s.levels[s.level],o=Math.min(Math.max(a,i.minCellWidth),i.maxCellWidth);return{zoom:s,scales:i.scales,cellWidth:o}}function xa(t,e,n,a,s,r,i){t.level=n;let o;const c=a.scales||a,d=A(c).unit,u=_a(d,s);if(e===-1){const m=K(d,s);o=i*m}else{const m=K(A(r).unit,d);o=Math.round(i/m)}const l=a.minCellWidth??ft,h=a.maxCellWidth??mt;return{scales:c,cellWidth:Math.min(h,Math.max(l,o)),lengthUnit:u,zoom:t}}function _a(t,e){const n=W.indexOf(t),a=W.indexOf(e);return a>=n?t==="hour"?"hour":"day":W[a]}function et(t,e){return t??e}const gt=8,ee=4,va=3,ne=7,Sa=gt+ee;function ae(t,e,n,a){(t.open||t.type!="summary")&&t.data?.forEach(s=>{typeof s.$x>"u"&&re(s,n,a),s.$x+=e,ae(s,e,n,a)})}function pt(t,e,n,a){const s=t.getSummaryId(e.id);if(s){const r=t.byId(s),i={xMin:1/0,xMax:0};se(r,i,n,a),r.$x=i.xMin,r.$w=i.xMax-i.xMin,pt(t,r,n,a)}}function se(t,e,n,a){t.data?.forEach(s=>{if(!s.unscheduled){typeof s.$x>"u"&&re(s,n,a);const r=s.type==="milestone"&&s.$h?s.$h/2:0;e.xMin>s.$x&&(e.xMin=s.$x+r);const i=s.$x+s.$w-r;e.xMax<i&&(e.xMax=i)}s.type!=="summary"&&se(s,e,n,a)})}function re(t,e,n){t.$x=Math.round(e.diff(t.start,e.start,e.lengthUnit)*n),t.$w=Math.round(e.diff(t.end,t.start,e.lengthUnit,!0)*n)}function yt(t,e){let n;e&&(n=e.filter(s=>s.parent==t.id));const a={data:n,...t};if(a.data?.length)a.data.forEach(s=>{if(s.unscheduled&&!s.data)return;(e||s.type!="summary"&&s.data)&&(s.unscheduled&&(s={...s,start:void 0,end:void 0}),s=yt(s,e)),s.start&&(!a.start||a.start>s.start)&&(a.start=new Date(s.start));const r=s.end||s.start;r&&(!a.end||a.end<r)&&(a.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 a}function ie(t,e,n){return oe(t,e,n,!1),n.splitTasks&&t.segments?.forEach(a=>{ie(a,e,{...n,baselines:!1}),a.$x-=t.$x}),n.baselines&&oe(t,e,n,!0),t}function oe(t,e,n,a){const{cellWidth:s,cellHeight:r,_scales:i,baselines:o}=n,{start:c,end:d,lengthUnit:u,diff:l}=i,h=(a?"base_":"")+"start",m=(a?"base_":"")+"end",g="$x"+(a?"_base":""),f="$y"+(a?"_base":""),y="$w"+(a?"_base":""),p="$h"+(a?"_base":""),k="$skip"+(a?"_baseline":"");let b=t[h],_=t[m];if(a&&!b){t[k]=!0;return}t[h]<c&&(t[m]<c||z(t[m],c))?b=_=c:t[h]>d&&(b=_=d),t[g]=Math.round(l(b,c,u)*s),t[f]=a?t.$y+t.$h+ee:r*e+va,t[y]=Math.round(l(_,b,u,!0)*s),t[p]=a?gt:o?r-ne-Sa:r-ne,t.type==="milestone"&&(t[g]=t[g]-t.$h/2,t[y]=t.$h,a&&(t[f]=t.$y+gt,t[y]=t[p]=t.$h)),n.unscheduledTasks&&t.unscheduled&&!a?t.$skip=!0:t[k]=z(b,_)}function Ma(t,e){return!1}function Da(t,e){}const kt=20,Ta=function(t,e,n,a,s){const r=Math.round(a/2)-3;if(!e||!n||!e.$y||!n.$y||e.$skip||n.$skip)return t.$p="",t.$pl=0,t;let i=!1,o=!1;switch(t.type){case"e2s":o=!0;break;case"s2s":i=!0,o=!0;break;case"s2e":i=!0;break}const c=i?e.$x:e.$x+e.$w,d=s?e.$y-7:e.$y,u=o?n.$x:n.$x+n.$w,l=s?n.$y-7:n.$y;if(c!==u||d!==l){const h=$a(c,d+r,u,l+r,i,o,a/2,s),m=Ia(u,l+r,o);t.$p=`${h},${m}`,t.$pl=Wa(t.$p)}return t};function Wa(t){const e=t.split(",").map(Number),n=[];for(let s=0;s<e.length;s+=2)s+1<e.length&&n.push([e[s],e[s+1]]);let a=0;for(let s=0;s<n.length-1;s++){const[r,i]=n[s],[o,c]=n[s+1];a+=Math.hypot(o-r,c-i)}return a}function $a(t,e,n,a,s,r,i,o){const c=kt*(s?-1:1),d=kt*(r?-1:1),u=t+c,l=n+d,h=[t,e,u,e,0,0,0,0,l,a,n,a],m=l-u;let g=a-e;const f=r===s;return f||(l<=t+kt-2&&r||l>t&&!r)&&(g=o?g-i+6:g-i),f&&r&&u>l||f&&!r&&u<l?(h[4]=h[2]+m,h[5]=h[3],h[6]=h[4],h[7]=h[5]+g):(h[4]=h[2],h[5]=h[3]+g,h[6]=h[4]+m,h[7]=h[5]),h.join(",")}function Ia(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 Pa(t,e,n){if(e&&n){const a=n.x-e.x,s=n.y-e.y,r=(a>0?e.x:n.x)-t.left,i=(s>0?e.y:n.y)-t.top,o=`${a>0?0:-a},${s>0?0:-s},${a>0?a:0},${s>0?s:0}`;return{width:Math.abs(a),height:Math.abs(s),left:r,top:i,p:o}}else return null}function ce(t){return t.map(e=>{const n=e.id||nt();return{...e,id:n}})}const de=["start","end","duration"];function Ca(t,e){const{type:n,unscheduled:a}=t;return a||n==="summary"?!de.includes(e):n==="milestone"?!["end","duration"].includes(e):!0}function Ea(t,e){return typeof e=="function"?e:de.includes(t)?(typeof e=="string"&&(e={type:e,config:{}}),e.config||(e.config={}),e.type==="datepicker"&&(e.config.buttons=["today"]),(n,a)=>Ca(n,a.id)?e:null):e}function Oa(t){return!t||!t.length?[]:t.map(e=>{const n=e.align||"left",a=e.id==="add-task",s=!a&&e.flexgrow?e.flexgrow:null,r=s?1:e.width||(a?50:120),i=e.editor&&Ea(e.id,e.editor);return{width:r,align:n,header:e.header,id:e.id,template:e.template,_template:e._template,...s&&{flexgrow:s},cell:e.cell,resize:e.resize??!0,sort:e.sort??!a,...i&&{editor:i},...e.options&&{options:e.options}}})}const Ha=[{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 Q(t,e,n,a){const{selected:s,tasks:r}=t.getState(),i=s.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"],l=["indent-task:add","move-task:down","move-task:up"],h={"indent-task:remove":2},m=!i&&u.includes(e),g={parent:l.includes(e),level:h[e]};if(n=n||(i?s[s.length-1]:null),!(!n&&!m)){if(e!=="paste-task"&&(t._temp=null),o.includes(e)||m||s.length===1)ue(t,e,n,a);else if(i){const f=c.includes(e)?s:Na(s,r,g);d.includes(e)&&f.reverse();const y=t.getHistory();y&&y.startBatch(),f.forEach((p,k)=>ue(t,e,p,a,k)),y&&y.endBatch()}}}function Na(t,e,n){let a=t.map(s=>{const r=e.byId(s);return{id:s,level:r.$level,parent:r.parent,index:e.getIndexById(s)}});return(n.parent||n.level)&&(a=a.filter(s=>n.level&&s.level<=n.level||!t.includes(s.parent))),a.sort((s,r)=>s.level-r.level||s.index-r.index),a.map(s=>s.id)}function ue(t,e,n,a,s){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={},l=!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 h=t.getHistory();h&&h.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(p=>p.id),y=[];g.forEach(p=>{f.includes(p.source)&&f.includes(p.target)&&y.push(p)}),y.forEach(p=>{r("add-link",{link:{source:m.get(p.source),target:m.get(p.target),type:p.type}})}),t._temp.forEach((p,k)=>{r("select-task",{id:m.get(p.id),toggle:!!k})})}h&&h.endBatch(),t._temp=null}return}else i==="add-task"?(u={task:{type:"task",text:a("New Task")},target:c,show:!0,select:!1},d={},l=!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 h=t.getTask(c),{segmentIndex:m}=n,g=h.segments.filter((f,y)=>y!==m);r("update-task",{id:c,task:{segments:g}});return}typeof o<"u"&&(u={mode:o,...u}),d={...d,...u},r(i,d),l&&r("select-task",{id:d.id,toggle:!!s})}function le(t,e){return t.some(n=>n.data?le(n.data,e):n.id===e)}const he=(t,e)=>T(t,e),Ya=(t,e)=>tt(t,e);function fe(t,e){Array.isArray(t)&&(t.forEach(n=>H(n,e)),t.forEach(n=>{if(n.type==="summary"&&!(n.start&&n.end)){const{start:a,end:s}=yt(n,t);n.start=a,n.end=s,H(n,e)}}))}function H(t,e){t.unscheduled||me(t,e,!1),t.base_start&&me(t,e,!0)}function me(t,e,n){const{calendar:a,durationUnit:s}=e,r=s||"day",[i,o,c]=ge(n);t.type==="milestone"?(t[c]=0,t[o]=void 0):t[i]&&(t[c]?t[o]=he(r,a)(t[i],t[c]):t[o]?t[c]=Ya(r,a)(t[o],t[i]):(t[o]=he(r,a)(t[i],1),t[c]=1))}function ge(t){return t?["base_start","base_end","base_duration"]:["start","end","duration"]}function pe(t,e,n){const[a,s,r]=ge(n);(e===r||e===a)&&(t[s]=null),e===s&&(t[r]=0,t[a]&&t[a]>=t[s]&&(t[s]=null,t[r]=1))}function za(t,e,n){pe(t,n,!1),t.base_start&&pe(t,n,!0),H(t,e)}class Aa extends Se{in;_router;_modules=new Map;constructor(e){super({writable:e,async:!1}),this._router=new Me(super.setState.bind(this),[{in:["tasks","start","end","scales","autoScale"],out:["_start","_end"],exec:s=>{const{_end:r,_start:i,start:o,end:c,tasks:d,scales:u,autoScale:l}=this.getState();if(!o||!c||l){const h=A(u).unit,m=ka(o,c,l,h,d);(m._end!=r||m._start!=i)&&this.setState(m,s)}else this.setState({_start:o,_end:c},s)}},{in:["_start","_end","cellWidth","scaleHeight","scales","lengthUnit","_weekStart"],out:["_scales"],exec:s=>{const r=this.getState();let{lengthUnit:i}=r;const{_start:o,_end:c,cellWidth:d,scaleHeight:u,scales:l,_weekStart:h}=r,m=A(l).unit;ha(m,i)||(i=m);const g=wa(o,c,i,d,u,h,l);this.setState({_scales:g},s)}},{in:["_scales","tasks","cellHeight","baselines","unscheduledTasks"],out:["_tasks"],exec:s=>{const{cellWidth:r,cellHeight:i,tasks:o,_scales:c,baselines:d,splitTasks:u,unscheduledTasks:l}=this.getState(),h=o.toArray().map((m,g)=>ie(m,g,{cellWidth:r,cellHeight:i,_scales:c,baselines:d,splitTasks:u,unscheduledTasks:l}));this.setState({_tasks:h},s)}},{in:["_tasks","links","cellHeight"],out:["_links"],exec:s=>{const{tasks:r,links:i,cellHeight:o,baselines:c,criticalPath:d}=this.getState(),u=i.map(l=>{const h=r.byId(l.source),m=r.byId(l.target);return Ta(l,h,m,o,c)}).toSorted((l,h)=>d?!!l.$critical==!!h.$critical?h.$pl-l.$pl:l.$critical?1:-1:h.$pl-l.$pl).filter(l=>l!==null);this.setState({_links:u},s)}},{in:["tasks","activeTask"],out:["_activeTask"],exec:s=>{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},s)}},{in:["tasks","selected"],out:["_selected"],exec:s=>{const{tasks:r,selected:i}=this.getState(),o=i.map(c=>r.byId(c)).filter(c=>!!c);this.setState({_selected:o},s)}},{in:["start","end"],out:["cellWidth"],exec:s=>{const{_cellWidth:r,cellWidth:i}=this.getState();r!=i&&this.setState({cellWidth:r},s)}}],{tasks:s=>new Ce(s),links:s=>new Dt(s),columns:s=>Oa(s)});const n=this.in=new De;n.on("show-editor",s=>{const{splitTasks:r}=this.getState();if(r){const{id:i,segmentIndex:o}=s;if(i&&(o||o===0)){this.setStateAsync({activeTask:{id:i,segmentIndex:o}});return}}this.setStateAsync({activeTask:s.id})}),n.on("select-task",({id:s,toggle:r,range:i,show:o,segmentIndex:c})=>{const{selected:d,_tasks:u,activeTask:l,splitTasks:h}=this.getState();let m=!1,g;if(d.length&&(r||i)){const y=[...d];if(i){const p=y[y.length-1],k=u.findIndex(M=>M.id==p),b=u.findIndex(M=>M.id==s),_=Math.min(k,b),v=Math.max(k,b)+1,S=u.slice(_,v).map(M=>M.id);k>b&&S.reverse(),S.forEach(M=>{y.includes(M)||y.push(M)})}else if(r){const p=y.findIndex(k=>k==s);p===-1?y.push(s):(m=!0,y.splice(p,1))}g=y}else g=[s];const f={selected:g};o&&g.length&&(f._scrollTask={id:g[0],mode:o}),this.setStateAsync(f),!m&&l&&(l!==s||h)&&n.exec("show-editor",{id:s,...h&&{segmentIndex:c}})}),n.on("delete-link",({id:s})=>{const{links:r}=this.getState();r.remove(s),this.setStateAsync({links:r})}),n.on("update-link",s=>{const{links:r}=this.getState(),i=s.id;let o=s.link;r.update(i,o),o=r.byId(i),!o.lag&&o.lag!==0&&delete o.lag,this.setStateAsync({links:r}),s.link=o}),n.on("add-link",s=>{const{link:r}=s,{links:i}=this.getState();!r.source||!r.target||(r.type||(r.type="e2s"),r.id=r.id||nt(),i.add(r),this.setStateAsync({links:i}),s.id=r.id,s.link=i.byId(r.id))});let a=null;n.on("move-task",s=>{const{tasks:r}=this.getState();let{mode:i,target:o}=s;const{id:c,inProgress:d}=s,u=r.byId(c);if(typeof d>"u"?s.source=u.parent:s.source=a=a??u.parent,d===!1){r.update(u.id,{$reorder:!1}),this.setState({tasks:r}),a=null;return}if(o===c||r.contains(c,o)){s.skipProvider=!0;return}if(i==="up"||i==="down"){const l=r.getBranch(c);let h=r.getIndexById(c);if(i==="up"){const m=u.parent===0;if(h===0&&m){s.skipProvider=!0;return}h-=1,i="before"}else if(i==="down"){const m=h===l.length-1,g=u.parent===0;if(m&&g){s.skipProvider=!0;return}h+=1,i="after"}if(o=l[h]&&l[h].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 y=r.getSummaryId(u.id);r.move(c,i,o);const p=r.getSummaryId(c);y!=p&&(y&&this.resetSummaryDates(y,"move-task"),p&&this.resetSummaryDates(p,"move-task"))}}else{const l=r.byId(o);let h=l,m=!1;for(;h.$level>u.$level;)h=r.byId(h.parent),h.id===c&&(m=!0);if(m)return;const g=r.getSummaryId(u.id);if(r.move(c,i,o),i=="child"){let y=l;for(;y.id!==0&&!y.open;)n.exec("open-task",{id:y.id,mode:!0}),y=r.byId(y.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}),s.target=o,s.mode=i}),n.on("drag-task",s=>{const r=this.getState(),{tasks:i,_tasks:o,_selected:c,_scales:d,cellWidth:u}=r,l=i.byId(s.id),{left:h,top:m,width:g,inProgress:f}=s,y={_tasks:o,_selected:c};if(typeof g<"u"&&(l.$w=g,pt(i,l,d,u)),typeof h<"u"){if(l.type==="summary"){const p=h-l.$x;ae(l,p,d,u)}l.$x=h,pt(i,l,d,u)}typeof m<"u"&&(l.$y=m+4,l.$reorder=f),typeof g<"u"&&(l.$w=g),typeof h<"u"&&(l.$x=h),typeof m<"u"&&(l.$y=m+4,l.$reorder=f),this.setState(y)}),n.on("update-task",s=>{const{id:r,segmentIndex:i,diff:o,eventSource:c}=s;let{task:d}=s;const{tasks:u,_scales:l,durationUnit:h,splitTasks:m,calendar:g}=this.getState(),f=u.byId(r),y={durationUnit:h,calendar:g};if(c==="add-task"||c==="copy-task"||c==="move-task"||c==="update-task"||c==="delete-task"||c==="provide-data"){H(d,y),u.update(r,d);return}const p=l.lengthUnit;let k=T(p);const b=tt(p,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=ht(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=ya(g)),this.moveSummaryKids(f,S=>(S=k(S,v),g?ht(S,o,g):S),"update-task")}d.start||(d.start=f.start),!d.end&&!d.duration&&(d.duration=f.duration),H(d,y),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}),s.task=u.byId(r)}),n.on("add-task",s=>{const{tasks:r,_scales:i,unscheduledTasks:o,durationUnit:c,splitTasks:d,calendar:u}=this.getState(),{target:l,mode:h,task:m,show:g,select:f=!0}=s;!s.eventSource&&o&&(m.unscheduled=!0);let y=-1,p,k;if(l?(k=r.byId(l),h=="child"?(p=k,m.parent=p.id):(k.parent!==null&&(p=r.byId(k.parent),m.parent=p.id),y=r.getIndexById(l),h=="after"&&(y+=1))):m.parent&&(p=r.byId(m.parent)),!m.start){if(p?.start)m.start=new Date(p.start.valueOf());else if(k)m.start=new Date(k.start.valueOf());else{const S=r.getBranch(0);let M;if(S?.length){const B=S[S.length-1];if(!B.$skip){const St=new Date(B.start.valueOf());i.start<=St&&(M=St)}}m.start=M||T(c,u)(i.start,1)}m.duration=1}u&&(m.start=ht(m.start,1,u)),this.getState().baselines&&(m.base_start=m.start,m.base_duration=m.duration),H(m,{durationUnit:c,calendar:u});const b=r.add(m,y),_={tasks:r};if(p&&g){for(;p&&p.id;)n.exec("open-task",{id:p.id,mode:!0}),p=r.byId(p.parent);_._scrollTask={id:b.id,mode:g}}s.id=b.id;const v=r.getSummaryId(b.id);v&&this.resetSummaryDates(v,"add-task"),this.setStateAsync(_),s.id=b.id,s.task=b,f&&n.exec("select-task",{id:b.id})}),n.on("delete-task",s=>{const{id:r}=s,{tasks:i,links:o,selected:c}=this.getState();s.source=i.byId(r).parent;const d=i.getSummaryId(r),u=[r];i.eachChild(h=>u.push(h.id),r),o.filter(h=>!(u.includes(h.source)||u.includes(h.target)));const l={tasks:i,links:o};c.includes(r)&&(l.selected=c.filter(h=>h!==r)),i.remove(r),d&&this.resetSummaryDates(d,"delete-task"),this.setStateAsync(l)}),n.on("indent-task",({id:s,mode:r})=>{const{tasks:i}=this.getState();if(r){const o=i.getBranch(s)[i.getIndexById(s)-1];o&&n.exec("move-task",{id:s,mode:"child",target:o.id})}else{const o=i.byId(s),c=i.byId(o.parent);c&&c.parent!==null&&n.exec("move-task",{id:s,mode:"after",target:o.parent})}}),n.on("copy-task",s=>{const{id:r,target:i,mode:o,eventSource:c}=s;if(c==="copy-task")return;const{tasks:d,links:u}=this.getState();if(d.contains(r,i)){s.skipProvider=!0;return}const l=d.getSummaryId(r),h=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);s.source=s.id,s.id=f[0][1],g.lazy&&(s.lazy=!0),l!=h&&h&&this.resetSummaryDates(h,"copy-task");let y=[];for(let p=1;p<f.length;p++){const[k,b]=f[p];u.forEach(_=>{if(_.source===k){const v={..._};delete v.target,y.push({...v,source:b})}else if(_.target===k){const v={..._};delete v.source,y.push({...v,target:b})}})}y=y.reduce((p,k)=>{const b=p.findIndex(_=>_.id===k.id);return b>-1?p[b]={...p[b],...k}:p.push(k),p},[]);for(let p=1;p<f.length;p++){const[k,b]=f[p],_=d.byId(b);n.exec("copy-task",{source:k,id:b,lazy:!!_.lazy,eventSource:"copy-task",target:_.parent,mode:"child",skipUndo:!0})}y.forEach(p=>{n.exec("add-link",{link:{source:p.source,target:p.target,type:p.type},eventSource:"copy-task",skipUndo:!0})}),this.setStateAsync({tasks:d})}),n.on("open-task",({id:s,mode:r})=>{const{tasks:i}=this.getState(),o=i.byId(s);o.lazy?n.exec("request-data",{id:o.id}):(i.toArray().forEach(c=>c.$y=0),i.update(s,{open:r}),this.setState({tasks:i}))}),n.on("scroll-chart",({left:s,top:r})=>{if(!isNaN(s)){const i=this.calcScaleDate(s);this.setState({scrollLeft:s,_scaleDate:i})}isNaN(r)||this.setState({scrollTop:r})}),n.on("render-data",s=>{this.setState({area:s})}),n.on("provide-data",s=>{const{tasks:r,links:i,durationUnit:o,calendar:c,splitTasks:d}=this.getState(),u=r.byId(s.id);u.lazy?(u.lazy=!1,u.open=!0):u.data=[],fe(s.data.tasks,{durationUnit:o,calendar:c}),r.parse(s.data.tasks,s.id),u.type=="summary"&&this.resetSummaryDates(u.id,"provide-data"),this.setStateAsync({tasks:r,links:new Dt(i.map(l=>l).concat(ce(s.data.links)))})}),n.on("zoom-scale",({dir:s,offset:r})=>{const{zoom:i,cellWidth:o,_cellWidth:c,scrollLeft:d}=this.getState(),u=r+d,l=this.calcScaleDate(u);let h=o;s<0&&(h=c||o);const m=h+s*50,g=i.levels[i.level],f=s<0&&o>g.maxCellWidth;if(m<g.minCellWidth||m>g.maxCellWidth||f){if(!this.changeScale(i,s))return}else this.setState({cellWidth:m,_cellWidth:m});const{_scales:y,_start:p,cellWidth:k,_weekStart:b}=this.getState(),_=$(y.minUnit,p,b),v=y.diff(l,_,"hour");typeof r>"u"&&(r=k);let S=Math.round(v*k)-r;S<0&&(S=0),this.setState({scrollLeft:S,_scaleDate:l,_zoomOffset:r})}),n.on("expand-scale",({minWidth:s})=>{const{_start:r,_scales:i,start:o,end:c,_end:d,cellWidth:u,_scaleDate:l,_zoomOffset:h}=this.getState(),m=T(i.minUnit);let g=i.width;if(o&&c){if(g<s&&g){const b=s/g;this.setState({cellWidth:u*b})}return!0}let f=0;for(;g<s;)g+=u,f++;const y=f?c?-f:-1:0,p=o||m(r,y);let k=0;if(l){const b=i.diff(l,p,"hour");k=Math.max(0,Math.round(b*u)-(h||0))}this.setState({_start:p,_end:c||m(d,f),scrollLeft:k})}),n.on("sort-tasks",({key:s,order:r,add:i})=>{const o=this.getState(),{tasks:c}=o;let d=o._sort;const u={key:s,order:r};let l=d?.length||0;l&&i?(d.forEach((h,m)=>{h.key===s&&(l=m)}),d[l]=u):d=[u],c.sort(d),this.setState({_sort:d,tasks:c})}),n.on("hotkey",({key:s,event:r,eventSource:i})=>{switch(s){case"arrowup":case"arrowdown":{const{selected:o,_tasks:c}=this.getState();r.preventDefault();const d=o.length;let u;if(s==="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 l=i==="chart"?"xy":!0;this.in.exec("select-task",{id:u,show:l})}break}case"ctrl+c":{Q(this,"copy-task",null,null);break}case"ctrl+x":{Q(this,"cut-task",null,null);break}case"ctrl+v":{Q(this,"paste-task",null,null);break}case"ctrl+d":case"backspace":{r.preventDefault(),Q(this,"delete-task",null,null);break}case"ctrl+z":{this.in.exec("undo",{});break}case"ctrl+y":{this.in.exec("redo",{});break}}})}init(e){const n=this.getState().area?{}:{scrollLeft:0,scrollTop:0,area:{from:0,start:0,end:0}};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,Array.isArray(e.tasks)&&this.getHistory()?.resetHistory(),this._router.init({_scrollTask:null,selected:[],markers:[],autoScale:!0,durationUnit:"day",...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(){const{tasks:e}=this.getState();return e.serialize()}changeScale(e,n){const a=e.level+n,s=e.levels[a];if(s){const{cellWidth:r,scales:i,_scales:o}=this.getState(),c=xa(e,n,a,s,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,a){const{tasks:s,durationUnit:r,splitTasks:i,calendar:o}=this.getState(),c=s.byId(e),d=c.data;if(d?.length&&this.isScheduled(d)){const u=yt({...c,start:void 0,end:void 0,duration:void 0});if(!z(c.start,u.start)||!z(c.end,u.end)){a?(H(u,{durationUnit:r,calendar:o}),s.update(e,u)):this.in.exec("update-task",{id:e,task:u,eventSource:n,skipUndo:!0});const l=s.getSummaryId(e);l&&this.resetSummaryDates(l,n)}}}moveSummaryKids(e,n,a){const{tasks:s}=this.getState();e.data.forEach(r=>{const i={...s.byId(r.id),start:n(r.start)};delete i.end,delete i.id,this.in.exec("update-task",{id:r.id,task:i,eventSource:a,skipUndo:!0}),r.data?.length&&this.moveSummaryKids(r,n,a)})}calcScaleDate(e){const{_scales:n,_start:a,_weekStart:s}=this.getState(),r=n.lengthUnit==="day"?n.lengthUnitWidth/24:n.lengthUnitWidth;return T("hour")($(n.minUnit,a,s),Math.floor(e/r))}getNextRow(e){const n=this.getState()._tasks,a=n.findIndex(s=>s.id==e);return n[a+1]}getPrevRow(e){const n=this.getState()._tasks,a=n.findIndex(s=>s.id==e);return n[a-1]}}function Ba(t,e,n,a){if(typeof document>"u")return"";const s=document.createElement("canvas");{const r=Fa(s,t,e,1,n);qa(r,a,0,t,0,e)}return s.toDataURL()}function Fa(t,e,n,a,s){t.setAttribute("width",(e*a).toString()),t.setAttribute("height",(n*a).toString());const r=t.getContext("2d");return r.translate(-.5,-.5),r.strokeStyle=s,r}function qa(t,e,n,a,s,r){t.beginPath(),t.moveTo(a,s),t.lineTo(a,r),e==="full"&&t.lineTo(n,r),t.stroke()}function Ua(t){return[...ke]}function wt(t){return t.map(e=>{switch(e.data&&wt(e.data),e.id){case"add-task:before":case"move-task:up":e.isDisabled=(n,a)=>La(n,a);break;case"move-task:down":e.isDisabled=(n,a)=>Xa(n,a);break;case"indent-task:add":e.isDisabled=(n,a)=>Qa(n,a)===n.parent;break;case"indent-task:remove":e.isDisabled=n=>ja(n);break}return e})}function ja(t){return t.parent===0}function La(t,e){const{_tasks:n}=e;return n[0]?.id===t.id}function Xa(t,e){const{_tasks:n}=e;return n[n.length-1]?.id===t.id}function Qa(t,e){const{_tasks:n}=e,a=n.findIndex(s=>s.id===t.id);return n[a-1]?.id??t.parent}function ye(t){return t&&typeof t=="object"}function Ga(t){return!t.selected||t.selected.length<2}const Ra=t=>e=>e.type===t,ke=wt([{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:Ra(t.id)})},{id:"edit-task",text:"Edit",icon:"wxi-edit",isHidden:(t,e,n)=>ye(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)=>Ga(e)&&ye(n)}]);function Ja(t){return[...we]}const we=wt([{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 bt(t){return t.type==="summary"}function xt(t){return t.type==="milestone"}function _t(t){return typeof t.parent>"u"}function vt(t,e){return e.unscheduledTasks&&t.unscheduled}function Va(t){return[...be]}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:t=>_t(t)},{key:"start",comp:"date",label:"Start date",isHidden:t=>bt(t),isDisabled:vt},{key:"end",comp:"date",label:"End date",isHidden:t=>bt(t)||xt(t),isDisabled:vt},{key:"duration",comp:"counter",label:"Duration",config:{min:1},isHidden:t=>bt(t)||xt(t),isDisabled:vt},{key:"progress",comp:"slider",label:"Progress",config:{min:1,max:100},isHidden:t=>xt(t)||_t(t)},{key:"links",comp:"links",label:"",isHidden:t=>_t(t)}],Ka=[{id:"task",label:"Task"},{id:"summary",label:"Summary task"},{id:"milestone",label:"Milestone"}];export{Aa as DataStore,Ha as defaultColumns,be as defaultEditorItems,ke as defaultMenuOptions,Ka as defaultTaskTypes,we as defaultToolbarButtons,Da as extendDragOptions,Jn as format,T as getAdder,tt as getDiffer,Va as getEditorItems,Ua as getMenuOptions,Ja as getToolbarButtons,$ as getUnitStart,Ba as grid,Q as handleAction,le as isHandledAction,Ma as isSegmentMoveAllowed,ce as normalizeLinks,ba as normalizeZoom,fe as parseTaskDates,Pa as placeLink,za as prepareEditTask,pa as registerScaleUnit};
|