@toclocoinc/lattice-grid 1.80.0 → 1.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/angular/package.json +1 -1
  4. package/docs/API.html +4 -4
  5. package/docs/THEMING.md +6 -3
  6. package/docs/api/adapters.html +1 -1
  7. package/docs/api/ai.html +1 -1
  8. package/docs/api/alarms.html +1 -1
  9. package/docs/api/charts.html +1 -1
  10. package/docs/api/dashboard.html +1 -1
  11. package/docs/api/data-router.html +1 -1
  12. package/docs/api/deckgl.html +1 -1
  13. package/docs/api/gantt.html +1 -1
  14. package/docs/api/geometry.html +1 -1
  15. package/docs/api/grid.html +2 -2
  16. package/docs/api/index.html +1 -1
  17. package/docs/api/kanban.html +1 -1
  18. package/docs/api/kpi.html +1 -1
  19. package/docs/api/layout.html +1 -1
  20. package/docs/api/leaflet.html +1 -1
  21. package/docs/api/list.html +1 -1
  22. package/docs/api/mock-socket.html +1 -1
  23. package/docs/api/presets.html +1 -1
  24. package/docs/api/tabs.html +1 -1
  25. package/docs/api/types.html +1 -1
  26. package/docs/api-detail.html +4 -4
  27. package/docs/warnings.json +1 -1
  28. package/lattice-grid.d.ts +1 -1
  29. package/lattice-grid.esm.min.js +3 -3
  30. package/lattice-grid.min.cjs +3 -3
  31. package/lattice-grid.min.css +1 -1
  32. package/lattice-grid.min.js +3 -3
  33. package/modules/ai.d.ts +1 -1
  34. package/modules/ai.esm.min.js +2 -2
  35. package/modules/ai.min.cjs +2 -2
  36. package/modules/ai.min.js +2 -2
  37. package/modules/alarms.d.ts +1 -1
  38. package/modules/alarms.esm.min.js +2 -2
  39. package/modules/alarms.min.cjs +2 -2
  40. package/modules/alarms.min.js +2 -2
  41. package/modules/angular.d.ts +1 -1
  42. package/modules/angular.esm.min.js +2 -2
  43. package/modules/angular.min.cjs +2 -2
  44. package/modules/angular.min.js +2 -2
  45. package/modules/chart-alluvial.d.ts +1 -1
  46. package/modules/chart-alluvial.esm.min.js +1 -1
  47. package/modules/chart-alluvial.min.cjs +1 -1
  48. package/modules/chart-alluvial.min.js +1 -1
  49. package/modules/chart-arc.d.ts +1 -1
  50. package/modules/chart-arc.esm.min.js +1 -1
  51. package/modules/chart-arc.min.cjs +1 -1
  52. package/modules/chart-arc.min.js +1 -1
  53. package/modules/chart-bubblemap.d.ts +1 -1
  54. package/modules/chart-bubblemap.esm.min.js +1 -1
  55. package/modules/chart-bubblemap.min.cjs +1 -1
  56. package/modules/chart-bubblemap.min.js +1 -1
  57. package/modules/chart-bump.d.ts +1 -1
  58. package/modules/chart-bump.esm.min.js +1 -1
  59. package/modules/chart-bump.min.cjs +1 -1
  60. package/modules/chart-bump.min.js +1 -1
  61. package/modules/chart-calendar.d.ts +1 -1
  62. package/modules/chart-calendar.esm.min.js +1 -1
  63. package/modules/chart-calendar.min.cjs +1 -1
  64. package/modules/chart-calendar.min.js +1 -1
  65. package/modules/chart-choropleth.d.ts +1 -1
  66. package/modules/chart-choropleth.esm.min.js +1 -1
  67. package/modules/chart-choropleth.min.cjs +1 -1
  68. package/modules/chart-choropleth.min.js +1 -1
  69. package/modules/chart-decomposition.d.ts +1 -1
  70. package/modules/chart-decomposition.esm.min.js +1 -1
  71. package/modules/chart-decomposition.min.cjs +1 -1
  72. package/modules/chart-decomposition.min.js +1 -1
  73. package/modules/chart-diverging.d.ts +1 -1
  74. package/modules/chart-diverging.esm.min.js +1 -1
  75. package/modules/chart-diverging.min.cjs +1 -1
  76. package/modules/chart-diverging.min.js +1 -1
  77. package/modules/chart-dumbbell.d.ts +1 -1
  78. package/modules/chart-dumbbell.esm.min.js +1 -1
  79. package/modules/chart-dumbbell.min.cjs +1 -1
  80. package/modules/chart-dumbbell.min.js +1 -1
  81. package/modules/chart-fan.d.ts +1 -1
  82. package/modules/chart-fan.esm.min.js +1 -1
  83. package/modules/chart-fan.min.cjs +1 -1
  84. package/modules/chart-fan.min.js +1 -1
  85. package/modules/chart-hexbin.d.ts +1 -1
  86. package/modules/chart-hexbin.esm.min.js +1 -1
  87. package/modules/chart-hexbin.min.cjs +1 -1
  88. package/modules/chart-hexbin.min.js +1 -1
  89. package/modules/chart-hexmap.d.ts +1 -1
  90. package/modules/chart-hexmap.esm.min.js +1 -1
  91. package/modules/chart-hexmap.min.cjs +1 -1
  92. package/modules/chart-hexmap.min.js +1 -1
  93. package/modules/chart-icicle.d.ts +1 -1
  94. package/modules/chart-icicle.esm.min.js +1 -1
  95. package/modules/chart-icicle.min.cjs +1 -1
  96. package/modules/chart-icicle.min.js +1 -1
  97. package/modules/chart-markermap.d.ts +1 -1
  98. package/modules/chart-markermap.esm.min.js +1 -1
  99. package/modules/chart-markermap.min.cjs +1 -1
  100. package/modules/chart-markermap.min.js +1 -1
  101. package/modules/chart-parallel.d.ts +1 -1
  102. package/modules/chart-parallel.esm.min.js +1 -1
  103. package/modules/chart-parallel.min.cjs +1 -1
  104. package/modules/chart-parallel.min.js +1 -1
  105. package/modules/chart-ridgeline.d.ts +1 -1
  106. package/modules/chart-ridgeline.esm.min.js +1 -1
  107. package/modules/chart-ridgeline.min.cjs +1 -1
  108. package/modules/chart-ridgeline.min.js +1 -1
  109. package/modules/chart-roc.d.ts +1 -1
  110. package/modules/chart-roc.esm.min.js +1 -1
  111. package/modules/chart-roc.min.cjs +1 -1
  112. package/modules/chart-roc.min.js +1 -1
  113. package/modules/chart-slope.d.ts +1 -1
  114. package/modules/chart-slope.esm.min.js +1 -1
  115. package/modules/chart-slope.min.cjs +1 -1
  116. package/modules/chart-slope.min.js +1 -1
  117. package/modules/chart-splom.d.ts +1 -1
  118. package/modules/chart-splom.esm.min.js +1 -1
  119. package/modules/chart-splom.min.cjs +1 -1
  120. package/modules/chart-splom.min.js +1 -1
  121. package/modules/chart-waffle.d.ts +1 -1
  122. package/modules/chart-waffle.esm.min.js +1 -1
  123. package/modules/chart-waffle.min.cjs +1 -1
  124. package/modules/chart-waffle.min.js +1 -1
  125. package/modules/charts.d.ts +1 -1
  126. package/modules/charts.esm.min.js +2 -2
  127. package/modules/charts.min.cjs +2 -2
  128. package/modules/charts.min.js +2 -2
  129. package/modules/dashboard.d.ts +1 -1
  130. package/modules/dashboard.esm.min.js +2 -2
  131. package/modules/dashboard.min.cjs +2 -2
  132. package/modules/dashboard.min.js +2 -2
  133. package/modules/data-router.d.ts +1 -1
  134. package/modules/data-router.esm.min.js +2 -2
  135. package/modules/data-router.min.cjs +2 -2
  136. package/modules/data-router.min.js +2 -2
  137. package/modules/deckgl.d.ts +1 -1
  138. package/modules/deckgl.esm.min.js +2 -2
  139. package/modules/deckgl.min.cjs +2 -2
  140. package/modules/deckgl.min.js +2 -2
  141. package/modules/devtools.d.ts +1 -1
  142. package/modules/devtools.esm.min.js +1 -1
  143. package/modules/devtools.min.cjs +1 -1
  144. package/modules/devtools.min.js +1 -1
  145. package/modules/dhtmlx-compat.d.ts +1 -1
  146. package/modules/dhtmlx-compat.esm.min.js +2 -2
  147. package/modules/dhtmlx-compat.min.cjs +2 -2
  148. package/modules/dhtmlx-compat.min.js +2 -2
  149. package/modules/gantt.d.ts +1 -1
  150. package/modules/gantt.esm.min.js +2 -2
  151. package/modules/gantt.min.cjs +2 -2
  152. package/modules/gantt.min.js +2 -2
  153. package/modules/geo-europe-nuts.d.ts +1 -1
  154. package/modules/geo-europe-nuts.esm.min.js +1 -1
  155. package/modules/geo-europe-nuts.min.cjs +1 -1
  156. package/modules/geo-europe-nuts.min.js +1 -1
  157. package/modules/geo-uk.d.ts +1 -1
  158. package/modules/geo-uk.esm.min.js +1 -1
  159. package/modules/geo-uk.min.cjs +1 -1
  160. package/modules/geo-uk.min.js +1 -1
  161. package/modules/geo-us-states.d.ts +1 -1
  162. package/modules/geo-us-states.esm.min.js +1 -1
  163. package/modules/geo-us-states.min.cjs +1 -1
  164. package/modules/geo-us-states.min.js +1 -1
  165. package/modules/geo-world-110m.d.ts +1 -1
  166. package/modules/geo-world-110m.esm.min.js +1 -1
  167. package/modules/geo-world-110m.min.cjs +1 -1
  168. package/modules/geo-world-110m.min.js +1 -1
  169. package/modules/geo-world-50m.d.ts +1 -1
  170. package/modules/geo-world-50m.esm.min.js +1 -1
  171. package/modules/geo-world-50m.min.cjs +1 -1
  172. package/modules/geo-world-50m.min.js +1 -1
  173. package/modules/geometry.d.ts +1 -1
  174. package/modules/geometry.esm.min.js +2 -2
  175. package/modules/geometry.min.cjs +2 -2
  176. package/modules/geometry.min.js +2 -2
  177. package/modules/htmx.d.ts +1 -1
  178. package/modules/htmx.esm.min.js +3 -3
  179. package/modules/htmx.min.cjs +3 -3
  180. package/modules/htmx.min.js +3 -3
  181. package/modules/kanban.d.ts +1 -1
  182. package/modules/kanban.esm.min.js +2 -2
  183. package/modules/kanban.min.cjs +2 -2
  184. package/modules/kanban.min.js +2 -2
  185. package/modules/kpi.d.ts +1 -1
  186. package/modules/kpi.esm.min.js +2 -2
  187. package/modules/kpi.min.cjs +2 -2
  188. package/modules/kpi.min.js +2 -2
  189. package/modules/layout.d.ts +1 -1
  190. package/modules/layout.esm.min.js +2 -2
  191. package/modules/layout.min.cjs +2 -2
  192. package/modules/layout.min.js +2 -2
  193. package/modules/leaflet.d.ts +1 -1
  194. package/modules/leaflet.esm.min.js +2 -2
  195. package/modules/leaflet.min.cjs +2 -2
  196. package/modules/leaflet.min.js +2 -2
  197. package/modules/list.d.ts +1 -1
  198. package/modules/list.esm.min.js +2 -2
  199. package/modules/list.min.cjs +2 -2
  200. package/modules/list.min.js +2 -2
  201. package/modules/mock-socket.d.ts +1 -1
  202. package/modules/mock-socket.esm.min.js +1 -1
  203. package/modules/mock-socket.min.cjs +1 -1
  204. package/modules/mock-socket.min.js +1 -1
  205. package/modules/presets/antd5.css +23 -0
  206. package/modules/presets/bootstrap5.css +46 -5
  207. package/modules/presets/fluent2.css +31 -4
  208. package/modules/presets/material3.css +53 -5
  209. package/modules/presets.d.ts +1 -1
  210. package/modules/presets.esm.min.js +2 -2
  211. package/modules/presets.min.cjs +2 -2
  212. package/modules/presets.min.js +2 -2
  213. package/modules/react.d.ts +1 -1
  214. package/modules/react.esm.min.js +2 -2
  215. package/modules/react.min.cjs +2 -2
  216. package/modules/react.min.js +2 -2
  217. package/modules/svelte.d.ts +1 -1
  218. package/modules/svelte.esm.min.js +2 -2
  219. package/modules/svelte.min.cjs +2 -2
  220. package/modules/svelte.min.js +2 -2
  221. package/modules/tabs.d.ts +1 -1
  222. package/modules/tabs.esm.min.js +2 -2
  223. package/modules/tabs.min.cjs +2 -2
  224. package/modules/tabs.min.js +2 -2
  225. package/modules/vue.d.ts +1 -1
  226. package/modules/vue.esm.min.js +2 -2
  227. package/modules/vue.min.cjs +2 -2
  228. package/modules/vue.min.js +2 -2
  229. package/modules/webcomponent.d.ts +1 -1
  230. package/modules/webcomponent.esm.min.js +3 -3
  231. package/modules/webcomponent.min.cjs +3 -3
  232. package/modules/webcomponent.min.js +3 -3
  233. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * Lattice Grid 1.80.0, gantt module
2
+ * Lattice Grid 1.81.0, gantt module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- (function(te){"use strict";var Vt=Object.create(null),Yt=Object.create(null);function Tt(h,pt){Vt[h]=pt}function Zt(h){var pt=Yt[h];if(pt)return pt;var xt=Object.create(null);Yt[h]=xt;var dt=Vt[h];if(!dt)throw new Error("[lattice] missing module: "+h);return dt(xt,Zt),xt}Tt("packages/core/src/internal/util.js",function(h,pt){"use strict";Object.defineProperty(h,"VERSION",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"reportedWarnings",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"warnOnce",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"infoOnce",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"resetWarnings",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"fail",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"invariant",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"DEV",{enumerable:!0,get:function(){return K}}),Object.defineProperty(h,"isObject",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"isFunction",{enumerable:!0,get:function(){return E}}),Object.defineProperty(h,"isNil",{enumerable:!0,get:function(){return X}}),Object.defineProperty(h,"isBlank",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"isCtor",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"pathGetter",{enumerable:!0,get:function(){return f}}),Object.defineProperty(h,"pathSetter",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(h,"getPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(h,"setPath",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(h,"humanise",{enumerable:!0,get:function(){return j}}),Object.defineProperty(h,"escapeHtml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(h,"titleCase",{enumerable:!0,get:function(){return L}}),Object.defineProperty(h,"expand",{enumerable:!0,get:function(){return k}}),Object.defineProperty(h,"toArray",{enumerable:!0,get:function(){return U}}),Object.defineProperty(h,"merge",{enumerable:!0,get:function(){return B}}),Object.defineProperty(h,"mergeRow",{enumerable:!0,get:function(){return W}}),Object.defineProperty(h,"Lru",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(h,"collator",{enumerable:!0,get:function(){return S}}),Object.defineProperty(h,"defaultCompare",{enumerable:!0,get:function(){return p}}),Object.defineProperty(h,"now",{enumerable:!0,get:function(){return M}}),Object.defineProperty(h,"nextFrame",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(h,"cancelFrame",{enumerable:!0,get:function(){return st}}),Object.defineProperty(h,"frameBatched",{enumerable:!0,get:function(){return r}}),Object.defineProperty(h,"settleDebounce",{enumerable:!0,get:function(){return c}}),Object.defineProperty(h,"whenIdle",{enumerable:!0,get:function(){return m}}),Object.defineProperty(h,"uid",{enumerable:!0,get:function(){return z}});const xt="1.80.0";async function dt(){return xt}const at="1.80.0",V=new Set,tt=2e3;function D(s){if(V.add(s),V.size>tt){const e=V.values().next().value;e!==void 0&&V.delete(e)}}const J=[],l=500;function v(s,e,t){J.push({key:s,level:e,message:t.map(n=>typeof n=="string"?n:g(n)).join(" "),at:Date.now()}),J.length>l&&J.shift()}function g(s){if(s instanceof Error)return s.message;try{return JSON.stringify(s)}catch{return String(s)}}function $(){return J.map(s=>({...s}))}function q(s){if(s.length===0||typeof s[0]!="string")return s;const e=s[0].replace(/^\[lattice\]\s*/,"");return e===s[0]?s:[e,...s.slice(1)]}function et(s,...e){if(V.has(s))return;D(s);const t=q(e);v(s,"warn",t),console.warn("[lattice]",...t)}function _(s,...e){if(V.has(s))return;D(s);const t=q(e);v(s,"info",t),console.info("[lattice]",...t)}function F(){V.clear(),J.length=0}function A(s,e){const t=new Error(`[lattice] ${s}`);throw e!==void 0&&(t.cause=e),t}function ot(s,e){s||A(e)}const K=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function R(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function E(s){return typeof s=="function"}function X(s){return s==null}function Q(s){return s==null||s===""}function it(s){return typeof s!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(s))?!0:!!(s.prototype&&Object.getOwnPropertyNames(s.prototype).length>1)}const y=new Map;function f(s){let e=y.get(s);if(e)return e;if(!s.includes("."))e=t=>t?.[s];else{const t=s.split("."),n=t.length;e=i=>{let a=i;for(let b=0;b<n;b++){if(a==null)return;a=a[t[b]]}return a}}return y.set(s,e),e}const N=new Map;function Y(s){let e=N.get(s);if(e)return e;if(!s.includes("."))e=(t,n)=>{t!=null&&(t[s]=n)};else{const t=s.split("."),n=t.length-1;e=(i,a)=>{let b=i;for(let d=0;d<n;d++){if(b==null)return;const P=t[d];b[P]==null&&(b[P]={}),b=b[P]}b!=null&&(b[t[n]]=a)}}return N.set(s,e),e}function I(s,e){return f(e)(s)}function rt(s,e,t){Y(e)(s,t)}function j(s){return s?(s.includes(".")?s.slice(s.lastIndexOf(".")+1):s).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase()):""}const H={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function u(s){const e=s==null?"":String(s);return/[&<>"']/.test(e)?e.replace(/[&<>"']/g,t=>H[t]):e}function L(s){return String(s).replace(/\w\S*/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function k(s,e,t){if(s!==void 0)return s===!0?{enabled:!0,...t}:s===!1?{enabled:!1}:R(s)?s:{[e]:s,enabled:!0}}function U(s){return s==null?[]:Array.isArray(s)?s:[s]}const o=Object.freeze(new Set(["__proto__","constructor","prototype"]));function B(s,e){if(!R(s))return R(e)?{...e}:e;if(!R(e))return e===void 0?s:e;const t={...s};for(const n of Object.keys(e)){if(o.has(n))continue;const i=e[n];i!==void 0&&(t[n]=R(i)&&R(t[n])?B(t[n],i):i)}return t}function W(s,e){if(!R(s)||!R(e)||s===e)return e;const t=Object.create(Object.getPrototypeOf(s));return Object.assign(t,s,e),t}class Z{#n;#r=new Map;#t;constructor(e=256,t=null){this.#n=e,this.#t=t}get size(){return this.#r.size}get max(){return this.#n}set max(e){this.#n=e,this.#e()}has(e){return this.#r.has(e)}get(e){const t=this.#r;if(!t.has(e))return;const n=t.get(e);return t.delete(e),t.set(e,n),n}peek(e){return this.#r.get(e)}set(e,t){const n=this.#r;return n.has(e)&&n.delete(e),n.set(e,t),this.#e(),t}delete(e){const t=this.#r.get(e);return this.#r.delete(e)&&this.#t&&this.#t(t,e),t}clear(){if(this.#t)for(const[e,t]of this.#r)this.#t(t,e);this.#r.clear()}keys(){return this.#r.keys()}values(){return this.#r.values()}#e(){const e=this.#r;for(;e.size>this.#n;){const t=e.keys().next().value,n=e.get(t);e.delete(t),this.#t&&this.#t(n,t)}}}const T=new Map;function S(s,e){const t=`${s||""}|${e?JSON.stringify(e):""}`;let n=T.get(t);return n||(n=new Intl.Collator(s||void 0,{numeric:!0,sensitivity:"variant",...e}),T.set(t,n)),n}function p(s,e){if(s===e)return 0;if(s==null)return 1;if(e==null)return-1;if(typeof s=="number"&&typeof e=="number")return Number.isNaN(s)?Number.isNaN(e)?0:1:Number.isNaN(e)||s<e?-1:s>e?1:0;const t=String(s),n=String(e);return t<n?-1:t>n?1:0}function M(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const lt=typeof requestAnimationFrame=="function";function wt(s){return lt?requestAnimationFrame(s):setTimeout(()=>s(M()),16)}function st(s){s!=null&&(lt?cancelAnimationFrame(s):clearTimeout(s))}function r(s){let e=null,t=null;const n=()=>{e=null;const a=t;t=null,s(...a||[])},i=(...a)=>{t=a,e===null&&(e=wt(n))};return i.cancel=()=>{st(e),e=null,t=null},i.flush=()=>{e!==null&&(st(e),n())},i}function c(s,e){let t=null,n=null;const i=()=>{if(t=null,n===null)return;const d=n;n=null,s(...d),a()},a=()=>{t=setTimeout(i,e),typeof t?.unref=="function"&&t.unref()},b=(...d)=>{t===null?(s(...d),a()):(n=d,clearTimeout(t),a())};return b.flush=()=>{if(t!==null&&clearTimeout(t),t=null,n===null)return;const d=n;n=null,s(...d)},b.cancel=()=>{t!==null&&clearTimeout(t),t=null,n=null},b.pending=()=>t!==null||n!==null,b}function m(s,e=50){return typeof requestIdleCallback=="function"?requestIdleCallback(s,{timeout:e}):setTimeout(()=>s({timeRemaining:()=>0,didTimeout:!0}),1)}let w=0;function z(s="l"){return`${s}${(++w).toString(36)}`}}),Tt("packages/modules/shared/emitter.js",function(h,pt){"use strict";Object.defineProperty(h,"WILDCARD",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"Emitter",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"gate",{enumerable:!0,get:function(){return l}});const xt=pt("packages/core/src/internal/util.js"),dt=xt.isFunction,at=xt.warnOnce,V="*",tt=new Set(["api","user","init","ai"]);function D(v,g){return v&&v.name?v.name:`#${g}`}class J{#n=new Map;#r;constructor(g="module"){this.#r=String(g)}on(g,$){if(!dt($))return()=>{};let q=this.#n.get(g);return q||(q=new Set,this.#n.set(g,q)),q.add($),()=>this.off(g,$)}off(g,$){const q=this.#n.get(g);q&&q.delete($)}count(g){const $=this.#n.get(g);return $?$.size:0}emit(g,$){const q=this.#n.get(g),et=this.#n.get(V);if((!q||q.size===0)&&(!et||et.size===0))return;const _={...$||null,type:g};q&&q.size&&this.#t([...q],_,g),et&&et.size&&this.#t([...et],_,V)}#t(g,$,q){for(let et=0;et<g.length;et++)try{g[et]($)}catch(_){at(`${this.#r}.emit.throw:${q}:${D(g[et],et)}`,`${this.#r}: a '${q}' handler threw; other handlers were unaffected.`,_)}}emitBefore(g,$,q){const et=q??($&&$.origin),_=tt.has(et)?et:"user";let F=!1,A=null;const ot=it=>{F=!0,it!=null&&A===null&&(A=String(it))},K={...$||null,type:g,origin:_,get defaultPrevented(){return F},get reason(){return A},preventDefault(it){ot(it)}},R=this.#n.get(g);if(!R||R.size===0)return!0;const E=[...R],X=()=>(F&&A===null&&(A="prevented"),F&&$&&typeof $=="object"&&($.reason=A),!F),Q=[];for(let it=0;it<E.length;it++){const y=E[it];try{const f=y(K);f&&dt(f.then)?Q.push(f):f===!1&&ot("prevented")}catch(f){ot("error"),at(`${this.#r}.beforeThrow:${g}:${D(y,it)}`,`${this.#r}: a '${g}' before-handler threw; the action was cancelled.`,f)}}return Q.length===0?X():Promise.allSettled(Q).then(it=>{for(const y of it)y.status==="rejected"?(ot("error"),at(`${this.#r}.beforeReject:${g}`,`${this.#r}: a '${g}' before-handler rejected; the action was cancelled.`,y.reason)):y.value===!1&&ot("prevented");return X()})}clear(){this.#n.clear()}}function l(v,g,$,q,et){const _=v.emitBefore(g,q,q.origin),F=()=>(v.emit($,{...q,reason:q.reason||"prevented"}),!1);return _===!1?F():_&&dt(_.then)?_.then(A=>A?et():F()):et()}}),Tt("packages/modules/gantt/time.js",function(h,pt){"use strict";Object.defineProperty(h,"toDayNumber",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"fromDayNumber",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"toISODate",{enumerable:!0,get:function(){return D}}),Object.defineProperty(h,"resolveProjectEpoch",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=864e5;function V(l){if(l==null||l==="")return null;if(typeof l=="number")return Number.isFinite(l)?l:null;if(l instanceof Date)return Number.isFinite(l.getTime())?Math.floor(Date.UTC(l.getFullYear(),l.getMonth(),l.getDate())/at):null;const v=Date.parse(l);return Number.isFinite(v)?Math.floor(v/at):null}function tt(l){return Number.isFinite(l)?new Date(Math.round(l)*at):null}function D(l){const v=tt(l);return v?v.toISOString().slice(0,10):null}function J(l){if(l==null||l==="")return 0;const v=V(l);return Number.isFinite(v)?v:(dt(`gantt.projectEpoch:${String(l)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(l)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),Tt("packages/modules/gantt/calendar.js",function(h,pt){"use strict";Object.defineProperty(h,"createCalendar",{enumerable:!0,get:function(){return tt}});const xt=pt("packages/modules/gantt/time.js"),dt=xt.fromDayNumber,at=xt.toDayNumber,V=Object.freeze([1,2,3,4,5]);function tt(D,J=0){if(D==null)return null;let l,v;D==="weekends"?(l=V,v=new Set):(l=Array.isArray(D.workdays)&&D.workdays.length?D.workdays.map(Number).filter(R=>R>=0&&R<=6):V,v=new Set((Array.isArray(D.holidays)?D.holidays:[]).map(R=>at(R)).filter(R=>R!=null)));const g=new Set(l);if(g.size===7&&v.size===0||g.size===0)return null;const $=R=>{const E=dt(R);return E?g.has(E.getUTCDay())&&!v.has(R):!1},q=R=>{let E=R;for(;!$(E);)E+=1;return E},et=R=>{let E=R;for(;!$(E);)E-=1;return E},_=q(Math.round(Number.isFinite(J)?J:0)),F=new Map([[0,_]]),A=new Map([[_,0]]);return{isWorking:$,nextWorking:q,dayOf:R=>{const E=Math.round(R);if(F.has(E))return F.get(E);if(E>0){let it=E-1;for(;!F.has(it);)it-=1;let y=F.get(it);for(let f=it+1;f<=E;f+=1)y=q(y+1),F.set(f,y),A.set(y,f);return F.get(E)}let X=E+1;for(;!F.has(X);)X+=1;let Q=F.get(X);for(let it=X-1;it>=E;it-=1)Q=et(Q-1),F.set(it,Q),A.set(Q,it);return F.get(E)},indexOf:R=>{const E=q(Math.round(R));if(A.has(E))return A.get(E);if(E>_){let it=0,y=_;for(;A.has(q(y+1))&&y<E;)y=q(y+1),it=A.get(y);for(;y<E;)y=q(y+1),it+=1,F.set(it,y),A.set(y,it);return it}let X=0,Q=_;for(;Q>E;)Q=et(Q-1),X-=1,F.set(X,Q),A.set(Q,X);return X},anchor:_}}}),Tt("packages/modules/gantt/schedule.js",function(h,pt){"use strict";Object.defineProperty(h,"LINK_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(h,"EPS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"TASK_FIELDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"taskIdReader",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"taskFieldWriters",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"normalizeTasks",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"buildTree",{enumerable:!0,get:function(){return E}}),Object.defineProperty(h,"normalizeLinkSpec",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"normalizeDependencies",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"expandDependencies",{enumerable:!0,get:function(){return y}}),Object.defineProperty(h,"topoOrder",{enumerable:!0,get:function(){return f}}),Object.defineProperty(h,"computeSchedule",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(h,"findViolations",{enumerable:!0,get:function(){return L}});const dt=pt("packages/core/src/internal/util.js").warnOnce,V=pt("packages/modules/gantt/calendar.js").createCalendar,D=pt("packages/modules/gantt/time.js").toDayNumber,J=["FS","SS","FF","SF"],l=["MSO","MFO","ALAP"],v=Object.freeze({mso:"MSO","must-start-on":"MSO",muststarton:"MSO","start-on":"MSO",mfo:"MFO","must-finish-on":"MFO",mustfinishon:"MFO","finish-on":"MFO",alap:"ALAP","as-late-as-possible":"ALAP",aslateaspossible:"ALAP",late:"ALAP"}),g=1e-9,$={CYCLE:"cycle",DUPLICATE_ID:"duplicate-id",UNKNOWN_TASK:"unknown-task",BAD_DURATION:"bad-duration",BAD_LINK_TYPE:"bad-link-type",SELF_DEPENDENCY:"self-dependency",UNKNOWN_PARENT:"unknown-parent",PARENT_CYCLE:"parent-cycle",DEP_ACROSS_HIERARCHY:"dep-across-hierarchy"};function q(k){if(k==null||k==="")return null;const U=typeof k=="number"?k:Number(k);return Number.isFinite(U)?U:null}function et(k){return k==null||k===""?null:D(k)}const _=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate"]);function F(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of _){const W=U[B];if(typeof W=="function")o[B]=W;else if(typeof W=="string"&&W!==""){const Z=W;o[B]=T=>T[Z]}else o[B]=Z=>Z[B]}return o}function A(k){return F(k).id}function ot(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of _){const W=U[B];typeof W=="string"&&W!==""?o[B]=W:typeof W=="function"?o[B]=null:o[B]=B}return o}function K(k,U){const o=U.constraint(k),B=o??(k&&k.constraintType);if(B==null||B==="")return null;const W=v[String(B).toLowerCase().replace(/\s+/g,"-")]??(l.includes(String(B).toUpperCase())?String(B).toUpperCase():null);if(!W)return null;const Z=et(U.constraintDate(k)??k.constraintAt??k.at);return{type:W,at:Z}}function R(k,U){const o=new Map,B=[],W=F(U);if(!Array.isArray(k))return{ok:!1,error:{code:$.BAD_DURATION,message:"tasks must be an array"},order:B,byId:o};for(const Z of k){const T=Z?W.id(Z):null,S=T!=null?String(T):null;if(S==null)return{ok:!1,error:{code:$.UNKNOWN_TASK,message:"every task needs an id"},order:B,byId:o};if(o.has(S))return{ok:!1,error:{code:$.DUPLICATE_ID,message:`duplicate task id "${S}"`,id:S},order:B,byId:o};const p=et(W.start(Z)),M=et(W.end(Z)),lt=W.milestone(Z)===!0;let wt=lt?0:q(W.duration(Z));if(wt==null&&p!=null&&M!=null&&(wt=M-p),wt!=null&&wt<0)return{ok:!1,error:{code:$.BAD_DURATION,message:`task "${S}" has negative duration ${wt}`,id:S},order:B,byId:o};const st=W.name(Z),r=W.parent(Z);o.set(S,{id:S,name:st!=null?String(st):S,duration:wt,milestoneFlag:lt,earliestStart:p,placedStart:p,placedEnd:M,percentComplete:q(W.percentComplete(Z)),parent:r!=null?String(r):null,constraint:K(Z,W),baselineStart:et(W.baselineStart(Z)??(Z.baseline&&Z.baseline.start)),baselineEnd:et(W.baselineEnd(Z)??(Z.baseline&&Z.baseline.end))}),B.push(S)}return{ok:!0,order:B,byId:o}}function E(k,U){const o=new Map(k.map(S=>[S,[]]));for(const S of k){const p=U.get(S).parent;if(p!=null){if(!U.has(p))return{ok:!1,error:{code:$.UNKNOWN_PARENT,message:`task "${S}" names unknown parent "${p}"`,id:S}};o.get(p).push(S)}}for(const S of k){const p=new Set;let M=U.get(S).parent;for(;M!=null;){if(M===S||p.has(M))return{ok:!1,error:{code:$.PARENT_CYCLE,message:`parent cycle at "${S}"`,id:S}};p.add(M),M=U.get(M)?.parent??null}}const B=S=>o.get(S).length>0,W=new Map,Z=S=>{if(W.has(S))return W.get(S);const p=o.get(S),M=p.length===0?[S]:p.flatMap(lt=>Z(lt));return W.set(S,M),M};return{ok:!0,children:o,isSummary:B,descendantLeaves:Z,ancestors:S=>{const p=new Set;let M=U.get(S).parent;for(;M!=null;)p.add(M),M=U.get(M).parent;return p}}}const X=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function Q(k){const U={...k||null};if(typeof U.type!="string")return U;const o=X.exec(U.type);if(!o||!o[2])return U;const B=(o[2]==="-"?-1:1)*Number(o[3]);U.type=o[1].toUpperCase();const W=q(k.lag);return W!=null&&W!==B?(dt(`gantt-link-shorthand-${String(k.type)}-${W}`,`[lattice] gantt: dependency type ${JSON.stringify(k.type)} carries a lag of ${B} but lag: ${W} was also given; the explicit lag wins. Give one or the other.`),U):(U.lag=B,U)}function it(k,U,o={}){const B=[];if(k==null)return{ok:!0,edges:B};if(!Array.isArray(k))return{ok:!1,error:{code:$.UNKNOWN_TASK,message:"dependencies must be an array"},edges:B};const W=typeof o.ancestors=="function"?o.ancestors:null;for(const Z of k){const T=Q(Z),S=T&&T.from!=null?String(T.from):null,p=T&&T.to!=null?String(T.to):null,M=T&&T.type!=null?String(T.type).toUpperCase():"FS",lt=q(T.lag)??0;if(S==null||p==null)return{ok:!1,error:{code:$.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:B};if(!U.has(S))return{ok:!1,error:{code:$.UNKNOWN_TASK,message:`dependency references unknown task "${S}"`,id:S},edges:B};if(!U.has(p))return{ok:!1,error:{code:$.UNKNOWN_TASK,message:`dependency references unknown task "${p}"`,id:p},edges:B};if(S===p)return{ok:!1,error:{code:$.SELF_DEPENDENCY,message:`task "${S}" depends on itself`,id:S},edges:B};if(!J.includes(M))return{ok:!1,error:{code:$.BAD_LINK_TYPE,message:`unknown link type "${M}" (expected one of ${J.join("/")})`},edges:B};if(W&&(W(S).has(p)||W(p).has(S)))return{ok:!1,error:{code:$.DEP_ACROSS_HIERARCHY,message:`dependency between "${S}" and "${p}" crosses their own parent/child hierarchy`,from:S,to:p},edges:B};B.push({from:S,to:p,type:M,lag:lt})}return{ok:!0,edges:B}}function y(k,U){const o=new Set,B=[];for(const W of k){(U.isSummary(W.from)||U.isSummary(W.to))&&W.type!=="FS"&&dt(`gantt-summary-link-${W.type}-${W.from}-${W.to}`,`[lattice] gantt: ${W.type} link with a summary endpoint (${W.from} -> ${W.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const T of U.descendantLeaves(W.from))for(const S of U.descendantLeaves(W.to)){if(T===S)continue;const p=[T,S,W.type,W.lag].join("");o.has(p)||(o.add(p),B.push({from:T,to:S,type:W.type,lag:W.lag}))}}return B}function f(k,U){const o=new Map(k.map(T=>[T,0])),B=new Map(k.map(T=>[T,[]]));for(const T of U)N(o,T.to),B.get(T.from).push(T.to);const W=k.filter(T=>o.get(T)===0),Z=[];for(;W.length;){const T=W.shift();Z.push(T);for(const S of B.get(T)){const p=o.get(S)-1;o.set(S,p),p===0&&W.push(S)}}return Z.length===k.length?{ok:!0,sorted:Z}:{ok:!1,cycle:Y(k,B,new Set(Z))}}function N(k,U){k.set(U,k.get(U)+1)}function Y(k,U,o){const B=k.find(S=>!o.has(S)),W=[],Z=new Map;let T=B;for(;T!=null&&!Z.has(T);)Z.set(T,W.length),W.push(T),T=U.get(T).find(S=>!o.has(S));return T==null?W:W.slice(Z.get(T)).concat(T)}function I(k,U,o,B,W,Z=new Map){const T=f(k,o);if(!T.ok)return dt(`gantt-cycle-${T.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${T.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:$.CYCLE,message:`dependency cycle: ${T.cycle.join(" -> ")}`,cycle:T.cycle}};const S=T.sorted,p=new Map(k.map(w=>[w,[]])),M=new Map(k.map(w=>[w,[]]));for(const w of o)p.get(w.to).push(w),M.get(w.from).push(w);const lt=new Map;for(const w of k){const z=U.get(w);lt.set(w,{id:w,name:z.name,duration:z.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:z.percentComplete,parent:z.parent,isSummary:!1,isMilestone:z.duration===0,children:[]})}const wt=[];for(const w of S){const z=U.get(w),s=lt.get(w);let e=Math.max(B,z.earliestStart??B);for(const n of p.get(w)){const i=lt.get(n.from);let a;switch(n.type){case"FS":a=i.ef+n.lag;break;case"SS":a=i.es+n.lag;break;case"FF":a=i.ef+n.lag-s.duration;break;case"SF":a=i.es+n.lag-s.duration;break;default:a=-1/0}a>e&&(e=a)}const t=Z.get(w);if(t&&t.type!=="ALAP"&&t.at!=null){const n=t.type==="MFO"?t.at-s.duration:t.at;n<e-g?wt.push({id:w,type:t.type,at:t.at,earliestFeasible:e}):e=n,s.pinned=!0}s.es=e,s.ef=e+s.duration}const st=k.length?Math.max(...k.map(w=>lt.get(w).ef)):B,r=Number.isFinite(W)?W:st;for(let w=S.length-1;w>=0;w-=1){const z=S[w],s=lt.get(z);let e=r;for(const t of M.get(z)){const n=lt.get(t.to);let i;switch(t.type){case"FS":i=n.ls-t.lag;break;case"SS":i=n.ls-t.lag+s.duration;break;case"FF":i=n.lf-t.lag;break;case"SF":i=n.lf-t.lag+s.duration;break;default:i=1/0}i<e&&(e=i)}s.pinned&&(e=s.ef),s.lf=e,s.ls=e-s.duration,s.totalFloat=s.ls-s.es,s.critical=s.totalFloat<=g}for(const w of k){const z=Z.get(w);if(!z||z.type!=="ALAP")continue;const s=lt.get(w);s.es=s.ls,s.ef=s.lf,s.totalFloat=0,s.critical=!0}const c=k.filter(w=>lt.get(w).critical),m=u(k,o,lt);return{ok:!0,tasks:lt,critical:c,criticalPaths:m,projectFinish:st,conflicts:wt}}function rt(k,U=[],o={}){const B=et(o.projectStart)??0,W=et(o.deadline),Z=V(o.calendar,B),T=a=>a==null?null:Z?Z.indexOf(a):a,S=a=>Z?Z.dayOf(a):a,p=R(k,o.fields);if(!p.ok)return{ok:!1,error:p.error};const{order:M,byId:lt}=p,wt=E(M,lt);if(!wt.ok)return{ok:!1,error:wt.error};const st=it(U,lt,wt);if(!st.ok)return{ok:!1,error:st.error};for(const a of M)if(!wt.isSummary(a)&&lt.get(a).duration==null)return{ok:!1,error:{code:$.BAD_DURATION,message:`task "${a}" has no duration and no start+end to derive one`,id:a}};const r=M.filter(a=>!wt.isSummary(a)),c=new Map(r.map(a=>{const b=lt.get(a);return[a,{...b,earliestStart:T(b.earliestStart)}]})),m=new Map;for(const a of r){const b=lt.get(a).constraint;b&&m.set(a,{type:b.type,at:T(b.at)})}const w=Z?Z.indexOf(B):B,z=W==null?void 0:T(W),s=y(st.edges,wt),e=I(r,c,s,w,z,m);if(!e.ok)return{ok:!1,error:e.error};const t=e.tasks;for(const a of r){const b=t.get(a);b.es=S(b.es),b.ef=S(b.ef),b.ls=S(b.ls),b.lf=S(b.lf),j(b,lt.get(a).baselineStart,lt.get(a).baselineEnd)}for(let a=M.length-1;a>=0;a-=1){const b=M[a];wt.isSummary(b)&&t.set(b,H(b,lt.get(b),wt,t))}for(const a of M)wt.isSummary(a)&&(t.get(a).children=wt.children.get(a).slice());const n=Z?Z.anchor:B,i=S(e.projectFinish);return{ok:!0,tasks:t,order:M,critical:e.critical,criticalPaths:e.criticalPaths,projectStart:n,projectFinish:i,projectDuration:i-n,conflicts:e.conflicts||[],calendar:!!Z}}function j(k,U,o){U==null&&o==null||(k.baselineStart=U??null,k.baselineEnd=o??null,k.startVariance=U==null?null:k.es-U,k.finishVariance=o==null?null:k.ef-o,k.durationVariance=U==null||o==null?null:k.ef-k.es-(o-U))}function H(k,U,o,B){const W=o.children.get(k).map(m=>B.get(m)),Z=Math.min(...W.map(m=>m.es)),T=Math.max(...W.map(m=>m.ef)),S=Math.min(...W.map(m=>m.ls)),p=Math.max(...W.map(m=>m.lf)),M=o.descendantLeaves(k).map(m=>B.get(m)),lt=M.reduce((m,w)=>m+w.duration,0),wt=lt>g?M.reduce((m,w)=>m+w.duration*(w.percentComplete??0),0)/lt:null,st={id:k,name:U.name,duration:T-Z,es:Z,ef:T,ls:S,lf:p,totalFloat:S-Z,critical:W.some(m=>m.critical),percentComplete:wt,parent:U.parent,isSummary:!0,isMilestone:!1,children:[]},r=M.map(m=>m.baselineStart).filter(m=>m!=null),c=M.map(m=>m.baselineEnd).filter(m=>m!=null);return(r.length||c.length)&&j(st,r.length?Math.min(...r):null,c.length?Math.max(...c):null),st}function u(k,U,o){const B=new Map(k.map(p=>[p,[]])),W=new Set;for(const p of U){const M=o.get(p.from),lt=o.get(p.to);if(!M.critical||!lt.critical)continue;let wt;switch(p.type){case"FS":wt=M.ef+p.lag;break;case"SS":wt=M.es+p.lag;break;case"FF":wt=M.ef+p.lag-lt.duration;break;case"SF":wt=M.es+p.lag-lt.duration;break;default:wt=-1/0}Math.abs(wt-lt.es)<=g&&(B.get(p.from).push(p.to),W.add(p.to))}const Z=k.filter(p=>o.get(p).critical&&!W.has(p)),T=[],S=(p,M)=>{const lt=B.get(p);if(!lt.length){T.push(M);return}for(const wt of lt)S(wt,M.concat(wt))};for(const p of Z)S(p,[p]);return T}function L(k,U,o){if(!U||!U.ok)return[];const B=[],W=F(o);for(const Z of k){const T=Z?W.id(Z):null,S=T!=null?String(T):null;if(S==null||!U.tasks.has(S))continue;const p=U.tasks.get(S);if(p.isSummary)continue;const M=q(W.start(Z));M!=null&&M<p.es-g&&B.push({id:S,placedStart:M,earliestStart:p.es,by:p.es-M})}return B}}),Tt("packages/modules/gantt/resources.js",function(h,pt){"use strict";Object.defineProperty(h,"parseAssignments",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"normalizeCapacities",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"sweepLoad",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"computeResourceLoad",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"levelResources",{enumerable:!0,get:function(){return A}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/schedule.js"),V=at.computeSchedule,tt=at.EPS,D=at.taskIdReader,l=pt("packages/modules/gantt/calendar.js").createCalendar;function v(K){if(K==null||K==="")return null;const R=typeof K=="number"?K:Number(K);return Number.isFinite(R)?R:null}function g(K){if(K&&Array.isArray(K.assignments))return K.assignments.map(X=>{const Q=X&&(X.resource??X.name??X.id);if(Q==null||Q==="")return null;const it=v(X.units)??v(X.allocation)??1;return{resource:String(Q),units:it}}).filter(Boolean);const R=K?K.assignee??K.assignees??K.owner:null;return(Array.isArray(R)?R:R==null||R===""?[]:[R]).map(X=>String(X)).filter(X=>X!=="").map(X=>({resource:X,units:1}))}function $(K,R){const E=new Map;if(Array.isArray(K))for(const X of K){const Q=X&&(X.id??X.name??X.resource);if(Q==null||Q==="")continue;const it=v(X.capacity??X.maxUnits??X.max??X.units);E.set(String(Q),it??R)}else if(K&&typeof K=="object")for(const[X,Q]of Object.entries(K)){const it=v(Q);E.set(String(X),it??R)}return E}function q(K){if(!K.length)return[];const R=new Set;for(const Q of K)R.add(Q.s),R.add(Q.e);const E=[...R].sort((Q,it)=>Q-it),X=[];for(let Q=0;Q<E.length-1;Q+=1){const it=E[Q],y=E[Q+1];if(y<=it)continue;let f=0;const N=[];for(const Y of K)Y.s<=it&&Y.e>=y&&(f+=Y.units,N.push(Y.taskId));N.length&&X.push({s:it,e:y,load:f,taskIds:N})}return X}function et(K,R,E={}){const X={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!R||!R.ok)return X;const Q=v(E.defaultCapacity)??1,it=$(E.resources,Q),y=E.calendar!=null?l(E.calendar,R.projectStart):null,f=L=>it.has(L)?it.get(L):Q,N=L=>y?y.indexOf(L):L,Y=L=>y?y.dayOf(L):L,I=D(E.fields),rt=new Map;for(const L of R.order){const k=R.tasks.get(L);if(!k||k.isSummary)continue;const U=K.find(Z=>Z&&I(Z)!=null&&String(I(Z))===L);if(!U)continue;const o=g(U);if(!o.length)continue;const B=N(k.es),W=N(k.ef);if(!(W<=B))for(const Z of o)rt.has(Z.resource)||rt.set(Z.resource,[]),rt.get(Z.resource).push({s:B,e:W,units:Z.units,taskId:L})}const j=new Map,H=[],u=[];for(const[L,k]of rt){const U=f(L),o=q(k);let B=0;const W=o.map(T=>{T.load>B&&(B=T.load);const S={start:Y(T.s),end:Y(T.e),load:T.load,taskIds:T.taskIds};return T.load>U+tt&&u.push({resource:L,capacity:U,start:S.start,end:S.end,load:T.load,taskIds:T.taskIds.slice()}),S}),Z={resource:L,capacity:U,peak:B,segments:W};j.set(L,Z),H.push(Z)}return H.sort((L,k)=>L.resource<k.resource?-1:L.resource>k.resource?1:0),u.sort((L,k)=>L.start-k.start||(L.resource<k.resource?-1:1)),{ok:!0,resources:H,overAllocations:u,byResource:j}}function _(K){if(!K)return!1;const R=K.constraint??K.constraintType;if(R==null||R==="")return!1;const E=String(R).toLowerCase().replace(/\s+/g,"-");return E==="mso"||E==="must-start-on"||E==="muststarton"||E==="start-on"||E==="mfo"||E==="must-finish-on"||E==="mustfinishon"||E==="finish-on"}function F(K,R){return K?v(K[R])??0:0}function A(K,R,E={}){const X={projectStart:E.projectStart,deadline:E.deadline,calendar:E.calendar,fields:E.fields},Q=E.priorityField||"priority",it=E.maxIterations!=null?E.maxIterations:Math.max(100,K.length*K.length*2),y=D(E.fields),f=K.map(u=>({...u})),N=f.map(u=>String(y(u))),Y=u=>N.indexOf(u);let I=V(f,R,X);if(!I.ok)return{ok:!1,error:I.error};const rt=new Map;for(const u of I.order){const L=I.tasks.get(u);L&&!L.isSummary&&rt.set(u,L.es)}let j=0;for(;j<it;j+=1){const u=et(f,I,E);if(!u.overAllocations.length)return{ok:!0,resolved:!0,tasks:f,schedule:I,moves:ot(rt,I),iterations:j};const L=u.overAllocations.slice().sort((T,S)=>T.start-S.start||S.load-T.load)[0],k=new Map(f.map(T=>[String(y(T)),T])),U=L.taskIds.map(T=>I.tasks.get(T)).filter(Boolean),o=U.filter(T=>!_(k.get(T.id)));if(!o.length)return{ok:!0,resolved:!1,tasks:f,schedule:I,moves:ot(rt,I),remaining:u.overAllocations,iterations:j};o.sort((T,S)=>{if(S.totalFloat!==T.totalFloat)return S.totalFloat-T.totalFloat;const p=F(k.get(T.id),Q),M=F(k.get(S.id),Q);return p!==M?p-M:S.es!==T.es?S.es-T.es:Y(S.id)-Y(T.id)});const B=o[0],W=U.filter(T=>T.id!==B.id).map(T=>T.ef).filter(T=>T>B.es+tt),Z=W.length?Math.min(...W):B.es+1;if(k.get(B.id).start=Z,I=V(f,R,X),!I.ok)return{ok:!1,error:I.error}}const H=et(f,I,E);return H.overAllocations.length&&dt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${it}-iteration cap with ${H.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:H.overAllocations.length===0,tasks:f,schedule:I,moves:ot(rt,I),remaining:H.overAllocations,iterations:j}}function ot(K,R){const E=[];for(const X of R.order){const Q=R.tasks.get(X);if(!Q||Q.isSummary)continue;const it=K.get(X);it!=null&&Q.es>it+tt&&E.push({id:X,from:it,to:Q.es,delay:Q.es-it})}return E}}),Tt("packages/modules/gantt/earned-value.js",function(h,pt){"use strict";Object.defineProperty(h,"computeEarnedValue",{enumerable:!0,get:function(){return l}});const dt=pt("packages/modules/gantt/time.js").toDayNumber,at=1e-9;function V(v){if(v==null||v==="")return null;const g=typeof v=="number"?v:Number(v);return Number.isFinite(g)?g:null}function tt(v,g,$){return $-g<=at?v>=$?1:0:v<=g?0:v>=$?1:(v-g)/($-g)}function D(v,g,$,q,et){const _=g?V(g[q]):null,F=_??v.duration,A=g?V(g[et]):null,ot=v.percentComplete==null?0:Math.max(0,Math.min(100,v.percentComplete))/100,K=v.baselineStart!=null||v.baselineEnd!=null,R=v.baselineStart!=null?v.baselineStart:v.es,E=v.baselineEnd!=null?v.baselineEnd:v.ef,X=F*tt($,R,E),Q=F*ot;return{bac:F,pv:X,ev:Q,ac:A,hasBaseline:K}}function J(v){const g=v.ac;return{bac:v.bac,pv:v.pv,ev:v.ev,ac:g,sv:v.ev-v.pv,cv:g==null?null:v.ev-g,spi:Math.abs(v.pv)<at?null:v.ev/v.pv,cpi:g==null||Math.abs(g)<at?null:v.ev/g}}function l(v,g,$={}){if(!g||!g.ok||!g.tasks||!g.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const q=$.costField||"cost",et=$.actualCostField||"actualCost",_=$.statusDate==null?g.projectFinish:dt($.statusDate)??g.projectFinish,F=new Map;for(const Q of Array.isArray(v)?v:[])Q&&Q.id!=null&&F.set(String(Q.id),Q);const A=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),ot=new Map;for(const Q of g.order)ot.set(Q,A());const K=A();for(const Q of g.order){const it=g.tasks.get(Q);if(!it||it.isSummary)continue;const y=D(it,F.get(Q),_,q,et);let f=Q;for(;f!=null&&ot.has(f);){const N=ot.get(f);N.bac+=y.bac,N.pv+=y.pv,N.ev+=y.ev,y.ac!=null&&(N.ac+=y.ac,N.acAny=!0),y.hasBaseline&&(N.hasBaseline=!0),f=g.tasks.get(f).parent}K.bac+=y.bac,K.pv+=y.pv,K.ev+=y.ev,y.ac!=null&&(K.ac+=y.ac,K.acAny=!0),y.hasBaseline&&(K.hasBaseline=!0)}const R=Q=>J({bac:Q.bac,pv:Q.pv,ev:Q.ev,ac:Q.acAny?Q.ac:null}),E=new Map,X=[];for(const Q of g.order){const it=g.tasks.get(Q),y=ot.get(Q),f={id:it.id,name:it.name,isSummary:!!it.isSummary,isMilestone:!!it.isMilestone,percentComplete:it.percentComplete??null,hasBaseline:y.hasBaseline,hasActualCost:y.acAny,...R(y)};E.set(Q,f),X.push(f)}return{ok:!0,statusDate:_,byTask:E,rows:X,project:{hasActualCost:K.acAny,hasBaseline:K.hasBaseline,...R(K)}}}}),Tt("packages/modules/gantt/mspdi.js",function(h,pt){"use strict";Object.defineProperty(h,"parseXml",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"importMSPDI",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"exportMSPDI",{enumerable:!0,get:function(){return f}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/time.js"),V=at.toDayNumber,tt=at.toISODate,D=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),J=Object.freeze({FF:0,FS:1,SF:2,SS:3}),l=Object.freeze({1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on"}),v=Object.freeze({ALAP:1,MSO:2,MFO:3});function g(j){return String(j).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(H,u)=>{if(u[0]==="#"){const L=u[1]==="x"||u[1]==="X"?parseInt(u.slice(2),16):parseInt(u.slice(1),10);return Number.isFinite(L)?String.fromCodePoint(L):H}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[u]??H})}function $(j){return String(j??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function q(j){const H=j.indexOf(":");return H<0?j:j.slice(H+1)}function et(j){const H=String(j);let u=0;const L=[];let k=null;for(;u<H.length;){const U=H.indexOf("<",u);if(U<0)break;if(U>u&&L.length){const M=H.slice(u,U);M.trim()&&(L[L.length-1].text+=g(M))}if(H.startsWith("<?",U)){const M=H.indexOf("?>",U);u=M<0?H.length:M+2;continue}if(H.startsWith("<!--",U)){const M=H.indexOf("-->",U);u=M<0?H.length:M+3;continue}if(H.startsWith("<![CDATA[",U)){const M=H.indexOf("]]>",U);L.length&&(L[L.length-1].text+=H.slice(U+9,M<0?H.length:M)),u=M<0?H.length:M+3;continue}if(H.startsWith("<!",U)){const M=H.indexOf(">",U);u=M<0?H.length:M+1;continue}const o=H.indexOf(">",U);if(o<0)break;let B=H.slice(U+1,o).trim();if(B[0]==="/"){L.pop(),u=o+1;continue}const W=B.endsWith("/");W&&(B=B.slice(0,-1).trim());const Z=B.search(/\s/),T=q(Z<0?B:B.slice(0,Z)),S={};if(Z>=0)for(const M of B.slice(Z).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))S[q(M[1]??M[3])]=g(M[2]??M[4]??"");const p={name:T,attrs:S,children:[],text:""};L.length?L[L.length-1].children.push(p):k||(k=p),W||L.push(p),u=o+1}return k}function _(j,H){return j?j.children.find(u=>u.name===H):void 0}function F(j,H){return j?j.children.filter(u=>u.name===H):[]}function A(j,H){const u=_(j,H);return u?u.text.trim():void 0}function ot(j){if(!j)return null;const H=String(j).match(/^\d{4}-\d{2}-\d{2}/);return V(H?H[0]:j)}function K(j,H){return`${tt(j)}T${String(H).padStart(2,"0")}:00:00`}function R(j,H){if(!j)return null;const u=String(j).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return u?((Number(u[1])||0)+(Number(u[2])||0)/60+(Number(u[3])||0)/3600)/H:null}function E(j,H){return`PT${Math.round((j||0)*H*1e3)/1e3}H0M0S`}function X(j,H){return(Number(j)||0)/(600*H)}function Q(j,H){return Math.round((j||0)*10*60*H)}function it(j,H={}){const u=H.hoursPerDay??8,L=et(j);if(!L||L.name!=="Project")return dt("gantt-mspdi-not-project","[lattice] gantt: importMSPDI input is not an MSPDI <Project> document."),{ok:!1,error:"not an MSPDI <Project> document",tasks:[],dependencies:[],resources:[]};const k=ot(A(L,"StartDate")),U=_(L,"Resources"),o=new Map,B=[];for(const c of F(U,"Resource")){const m=A(c,"UID"),w=A(c,"Name");if(m==null||w==null||w==="")continue;o.set(m,w);const z=A(c,"MaxUnits");B.push({id:w,name:w,capacity:z==null?1:Number(z)})}const W=_(L,"Assignments"),Z=new Map;for(const c of F(W,"Assignment")){const m=A(c,"TaskUID"),w=A(c,"ResourceUID"),z=o.get(w);if(m==null||z==null)continue;const s=A(c,"Units");Z.has(m)||Z.set(m,[]),Z.get(m).push({resource:z,units:s==null?1:Number(s)})}const T=_(L,"Tasks"),S=[],p=[],M=new Map,lt=[],wt=[];for(const c of F(T,"Task")){if(A(c,"IsNull")==="1")continue;const m=A(c,"UID");if(m==null||m==="0")continue;const w=m;M.set(m,w);const z=Number(A(c,"OutlineLevel"))||1;for(;lt.length&&lt[lt.length-1].level>=z;)lt.pop();const s=lt.length?lt[lt.length-1].uid:null;lt.push({uid:m,level:z});const e=A(c,"Summary")==="1",t=A(c,"Milestone")==="1",n={id:w,name:A(c,"Name")??w};if(s&&(n.parent=s),t&&(n.milestone=!0),!e&&!t){const G=R(A(c,"Duration"),u);G!=null&&(n.duration=G)}const i=ot(A(c,"Start"));!e&&i!=null&&(n.start=i);const a=A(c,"PercentComplete");a!=null&&(n.percentComplete=Number(a));const b=l[Number(A(c,"ConstraintType"))];if(b){n.constraint=b;const G=ot(A(c,"ConstraintDate"));G!=null&&(n.constraintDate=G)}const d=_(c,"Baseline");if(d){const G=ot(A(d,"Start")),C=ot(A(d,"Finish"));G!=null&&(n.baselineStart=G),C!=null&&(n.baselineEnd=C)}const P=Z.get(m);P&&P.length&&(n.assignments=P),S.push(n);for(const G of F(c,"PredecessorLink"))wt.push({raw:G,uid:m})}for(const{raw:c,uid:m}of wt){const w=A(c,"PredecessorUID"),z=M.get(w),s=M.get(m);if(z==null||s==null)continue;const e=D[Number(A(c,"Type")??1)]??"FS",t=X(A(c,"LinkLag"),u),n={from:z,to:s,type:e};t&&(n.lag=t),p.push(n)}const st=y(L),r={ok:!0,tasks:S,dependencies:p,resources:B};return k!=null&&(r.projectStart=k),st&&(r.calendar=st),r}function y(j){const H=_(j,"Calendars"),u=F(H,"Calendar"),L=A(j,"CalendarUID"),k=u.find(T=>A(T,"UID")===L)??u[0];if(!k)return null;const U=_(k,"WeekDays"),o=[];let B=!1;for(const T of F(U,"WeekDay")){const S=Number(A(T,"DayType"));S>=1&&S<=7&&(B=!0,A(T,"DayWorking")==="1"&&o.push(S-1))}const W=[],Z=_(k,"Exceptions");for(const T of F(Z,"Exception")){if(A(T,"DayWorking")==="1")continue;const S=_(T,"TimePeriod"),p=ot(A(S,"FromDate")),M=ot(A(S,"ToDate"))??p;if(p!=null)for(let lt=p;lt<=M;lt+=1)W.push(lt)}return!B&&!W.length?null:{workdays:B?o:[1,2,3,4,5],holidays:W}}function f(j,H={}){const u=H.hoursPerDay??8,L=Array.isArray(j.tasks)?j.tasks:[],k=Array.isArray(j.dependencies)?j.dependencies:[],U=Array.isArray(j.resources)?j.resources:j.resources&&typeof j.resources=="object"?Object.entries(j.resources).map(([r,c])=>({id:r,name:r,capacity:c})):[],o=j.schedule&&j.schedule.ok?j.schedule:null,B=new Map;L.forEach((r,c)=>{const m=String(r.id);B.set(m,/^\d+$/.test(m)?m:String(c+1))});const W=new Map;for(const r of L){const c=r.parent!=null?String(r.parent):null;c&&(W.has(c)||W.set(c,[]),W.get(c).push(String(r.id)))}const Z=r=>W.has(r),T=r=>{let c=1,m=L.find(w=>String(w.id)===r);for(;m&&m.parent!=null;)c+=1,m=L.find(w=>String(w.id)===String(m.parent));return c},S=new Map;for(const r of k){const c=String(r.to);S.has(c)||S.set(c,[]),S.get(c).push(r)}const p=[];p.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),p.push('<Project xmlns="http://schemas.microsoft.com/project">'),p.push(` <Name>${$(H.projectName||"Lattice Gantt export")}</Name>`);const M=j.projectStart!=null?V(j.projectStart):o?o.projectStart:null;M!=null&&p.push(` <StartDate>${K(M,8)}</StartDate>`);const lt=Y(j.calendar);if(lt&&p.push(" <CalendarUID>1</CalendarUID>"),lt){p.push(" <Calendars>"),p.push(" <Calendar>"),p.push(" <UID>1</UID>"),p.push(" <Name>Standard</Name>"),p.push(" <IsBaseCalendar>1</IsBaseCalendar>"),p.push(" <WeekDays>");for(let r=0;r<=6;r+=1){const c=lt.workdays.includes(r);p.push(" <WeekDay>"),p.push(` <DayType>${r+1}</DayType>`),p.push(` <DayWorking>${c?1:0}</DayWorking>`),p.push(" </WeekDay>")}if(p.push(" </WeekDays>"),lt.holidays.length){p.push(" <Exceptions>");for(const r of lt.holidays)p.push(" <Exception>"),p.push(" <DayWorking>0</DayWorking>"),p.push(` <TimePeriod><FromDate>${K(r,0)}</FromDate><ToDate>${K(r,23)}</ToDate></TimePeriod>`),p.push(" </Exception>");p.push(" </Exceptions>")}p.push(" </Calendar>"),p.push(" </Calendars>")}p.push(" <Tasks>");for(const r of L){const c=String(r.id),m=B.get(c),w=Z(c),z=!!r.milestone||!w&&Number(r.duration)===0,s=o?o.tasks.get(c):null;p.push(" <Task>"),p.push(` <UID>${$(m)}</UID>`),p.push(` <ID>${$(m)}</ID>`),p.push(` <Name>${$(r.name!=null?r.name:c)}</Name>`),p.push(` <OutlineLevel>${T(c)}</OutlineLevel>`),p.push(` <Summary>${w?1:0}</Summary>`),p.push(` <Milestone>${z?1:0}</Milestone>`);const e=s?s.duration:r.duration!=null?Number(r.duration):null;e!=null&&p.push(` <Duration>${E(e,u)}</Duration>`),p.push(" <DurationFormat>7</DurationFormat>");const t=s?s.es:r.start!=null?V(r.start):null,n=s?s.ef:r.end!=null?V(r.end):t!=null&&e!=null?t+e:null;t!=null&&p.push(` <Start>${K(t,8)}</Start>`),n!=null&&p.push(` <Finish>${K(n,17)}</Finish>`);const i=s?s.percentComplete:r.percentComplete;i!=null&&p.push(` <PercentComplete>${Math.round(Number(i))}</PercentComplete>`);const a=I(r.constraint??r.constraintType);if(a!=null){p.push(` <ConstraintType>${a}</ConstraintType>`);const P=rt(r.constraintDate??r.constraintAt??r.at);P!=null&&p.push(` <ConstraintDate>${K(P,8)}</ConstraintDate>`)}const b=rt(r.baselineStart??(r.baseline&&r.baseline.start)),d=rt(r.baselineEnd??(r.baseline&&r.baseline.end));(b!=null||d!=null)&&(p.push(" <Baseline>"),p.push(" <Number>0</Number>"),b!=null&&p.push(` <Start>${K(b,8)}</Start>`),d!=null&&p.push(` <Finish>${K(d,17)}</Finish>`),b!=null&&d!=null&&p.push(` <Duration>${E(d-b,u)}</Duration>`),p.push(" </Baseline>"));for(const P of S.get(c)||[]){const G=B.get(String(P.from));G!=null&&(p.push(" <PredecessorLink>"),p.push(` <PredecessorUID>${$(G)}</PredecessorUID>`),p.push(` <Type>${J[P.type?String(P.type).toUpperCase():"FS"]??1}</Type>`),P.lag&&(p.push(` <LinkLag>${Q(Number(P.lag),u)}</LinkLag>`),p.push(" <LagFormat>7</LagFormat>")),p.push(" </PredecessorLink>"))}p.push(" </Task>")}p.push(" </Tasks>");const wt=new Map;U.forEach((r,c)=>{const m=String(r.name??r.id??`Resource ${c+1}`);wt.set(m,{uid:String(c+1),capacity:r.capacity??r.maxUnits??1})});const st=[];for(const r of L)for(const c of N(r))wt.has(c.resource)||wt.set(c.resource,{uid:String(wt.size+1),capacity:1}),st.push({taskUid:B.get(String(r.id)),resUid:wt.get(c.resource).uid,units:c.units});p.push(" <Resources>");for(const[r,c]of wt)p.push(" <Resource>"),p.push(` <UID>${$(c.uid)}</UID>`),p.push(` <ID>${$(c.uid)}</ID>`),p.push(` <Name>${$(r)}</Name>`),p.push(` <MaxUnits>${Number(c.capacity)}</MaxUnits>`),p.push(" </Resource>");return p.push(" </Resources>"),p.push(" <Assignments>"),st.forEach((r,c)=>{p.push(" <Assignment>"),p.push(` <UID>${c+1}</UID>`),p.push(` <TaskUID>${$(r.taskUid)}</TaskUID>`),p.push(` <ResourceUID>${$(r.resUid)}</ResourceUID>`),p.push(` <Units>${Number(r.units)}</Units>`),p.push(" </Assignment>")}),p.push(" </Assignments>"),p.push("</Project>"),p.join(`
6
+ (function(te){"use strict";var Vt=Object.create(null),Yt=Object.create(null);function Tt(h,pt){Vt[h]=pt}function Zt(h){var pt=Yt[h];if(pt)return pt;var xt=Object.create(null);Yt[h]=xt;var dt=Vt[h];if(!dt)throw new Error("[lattice] missing module: "+h);return dt(xt,Zt),xt}Tt("packages/core/src/internal/util.js",function(h,pt){"use strict";Object.defineProperty(h,"VERSION",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"reportedWarnings",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"warnOnce",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"infoOnce",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"resetWarnings",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"fail",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"invariant",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"DEV",{enumerable:!0,get:function(){return K}}),Object.defineProperty(h,"isObject",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"isFunction",{enumerable:!0,get:function(){return E}}),Object.defineProperty(h,"isNil",{enumerable:!0,get:function(){return X}}),Object.defineProperty(h,"isBlank",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"isCtor",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"pathGetter",{enumerable:!0,get:function(){return f}}),Object.defineProperty(h,"pathSetter",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(h,"getPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(h,"setPath",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(h,"humanise",{enumerable:!0,get:function(){return j}}),Object.defineProperty(h,"escapeHtml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(h,"titleCase",{enumerable:!0,get:function(){return L}}),Object.defineProperty(h,"expand",{enumerable:!0,get:function(){return k}}),Object.defineProperty(h,"toArray",{enumerable:!0,get:function(){return U}}),Object.defineProperty(h,"merge",{enumerable:!0,get:function(){return B}}),Object.defineProperty(h,"mergeRow",{enumerable:!0,get:function(){return W}}),Object.defineProperty(h,"Lru",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(h,"collator",{enumerable:!0,get:function(){return S}}),Object.defineProperty(h,"defaultCompare",{enumerable:!0,get:function(){return p}}),Object.defineProperty(h,"now",{enumerable:!0,get:function(){return M}}),Object.defineProperty(h,"nextFrame",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(h,"cancelFrame",{enumerable:!0,get:function(){return st}}),Object.defineProperty(h,"frameBatched",{enumerable:!0,get:function(){return r}}),Object.defineProperty(h,"settleDebounce",{enumerable:!0,get:function(){return c}}),Object.defineProperty(h,"whenIdle",{enumerable:!0,get:function(){return m}}),Object.defineProperty(h,"uid",{enumerable:!0,get:function(){return z}});const xt="1.81.0";async function dt(){return xt}const at="1.81.0",V=new Set,tt=2e3;function D(s){if(V.add(s),V.size>tt){const e=V.values().next().value;e!==void 0&&V.delete(e)}}const J=[],l=500;function v(s,e,t){J.push({key:s,level:e,message:t.map(n=>typeof n=="string"?n:g(n)).join(" "),at:Date.now()}),J.length>l&&J.shift()}function g(s){if(s instanceof Error)return s.message;try{return JSON.stringify(s)}catch{return String(s)}}function $(){return J.map(s=>({...s}))}function q(s){if(s.length===0||typeof s[0]!="string")return s;const e=s[0].replace(/^\[lattice\]\s*/,"");return e===s[0]?s:[e,...s.slice(1)]}function et(s,...e){if(V.has(s))return;D(s);const t=q(e);v(s,"warn",t),console.warn("[lattice]",...t)}function _(s,...e){if(V.has(s))return;D(s);const t=q(e);v(s,"info",t),console.info("[lattice]",...t)}function F(){V.clear(),J.length=0}function A(s,e){const t=new Error(`[lattice] ${s}`);throw e!==void 0&&(t.cause=e),t}function ot(s,e){s||A(e)}const K=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function R(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function E(s){return typeof s=="function"}function X(s){return s==null}function Q(s){return s==null||s===""}function it(s){return typeof s!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(s))?!0:!!(s.prototype&&Object.getOwnPropertyNames(s.prototype).length>1)}const y=new Map;function f(s){let e=y.get(s);if(e)return e;if(!s.includes("."))e=t=>t?.[s];else{const t=s.split("."),n=t.length;e=i=>{let a=i;for(let b=0;b<n;b++){if(a==null)return;a=a[t[b]]}return a}}return y.set(s,e),e}const N=new Map;function Y(s){let e=N.get(s);if(e)return e;if(!s.includes("."))e=(t,n)=>{t!=null&&(t[s]=n)};else{const t=s.split("."),n=t.length-1;e=(i,a)=>{let b=i;for(let d=0;d<n;d++){if(b==null)return;const P=t[d];b[P]==null&&(b[P]={}),b=b[P]}b!=null&&(b[t[n]]=a)}}return N.set(s,e),e}function I(s,e){return f(e)(s)}function rt(s,e,t){Y(e)(s,t)}function j(s){return s?(s.includes(".")?s.slice(s.lastIndexOf(".")+1):s).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase()):""}const H={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function u(s){const e=s==null?"":String(s);return/[&<>"']/.test(e)?e.replace(/[&<>"']/g,t=>H[t]):e}function L(s){return String(s).replace(/\w\S*/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function k(s,e,t){if(s!==void 0)return s===!0?{enabled:!0,...t}:s===!1?{enabled:!1}:R(s)?s:{[e]:s,enabled:!0}}function U(s){return s==null?[]:Array.isArray(s)?s:[s]}const o=Object.freeze(new Set(["__proto__","constructor","prototype"]));function B(s,e){if(!R(s))return R(e)?{...e}:e;if(!R(e))return e===void 0?s:e;const t={...s};for(const n of Object.keys(e)){if(o.has(n))continue;const i=e[n];i!==void 0&&(t[n]=R(i)&&R(t[n])?B(t[n],i):i)}return t}function W(s,e){if(!R(s)||!R(e)||s===e)return e;const t=Object.create(Object.getPrototypeOf(s));return Object.assign(t,s,e),t}class Z{#n;#r=new Map;#t;constructor(e=256,t=null){this.#n=e,this.#t=t}get size(){return this.#r.size}get max(){return this.#n}set max(e){this.#n=e,this.#e()}has(e){return this.#r.has(e)}get(e){const t=this.#r;if(!t.has(e))return;const n=t.get(e);return t.delete(e),t.set(e,n),n}peek(e){return this.#r.get(e)}set(e,t){const n=this.#r;return n.has(e)&&n.delete(e),n.set(e,t),this.#e(),t}delete(e){const t=this.#r.get(e);return this.#r.delete(e)&&this.#t&&this.#t(t,e),t}clear(){if(this.#t)for(const[e,t]of this.#r)this.#t(t,e);this.#r.clear()}keys(){return this.#r.keys()}values(){return this.#r.values()}#e(){const e=this.#r;for(;e.size>this.#n;){const t=e.keys().next().value,n=e.get(t);e.delete(t),this.#t&&this.#t(n,t)}}}const T=new Map;function S(s,e){const t=`${s||""}|${e?JSON.stringify(e):""}`;let n=T.get(t);return n||(n=new Intl.Collator(s||void 0,{numeric:!0,sensitivity:"variant",...e}),T.set(t,n)),n}function p(s,e){if(s===e)return 0;if(s==null)return 1;if(e==null)return-1;if(typeof s=="number"&&typeof e=="number")return Number.isNaN(s)?Number.isNaN(e)?0:1:Number.isNaN(e)||s<e?-1:s>e?1:0;const t=String(s),n=String(e);return t<n?-1:t>n?1:0}function M(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const lt=typeof requestAnimationFrame=="function";function wt(s){return lt?requestAnimationFrame(s):setTimeout(()=>s(M()),16)}function st(s){s!=null&&(lt?cancelAnimationFrame(s):clearTimeout(s))}function r(s){let e=null,t=null;const n=()=>{e=null;const a=t;t=null,s(...a||[])},i=(...a)=>{t=a,e===null&&(e=wt(n))};return i.cancel=()=>{st(e),e=null,t=null},i.flush=()=>{e!==null&&(st(e),n())},i}function c(s,e){let t=null,n=null;const i=()=>{if(t=null,n===null)return;const d=n;n=null,s(...d),a()},a=()=>{t=setTimeout(i,e),typeof t?.unref=="function"&&t.unref()},b=(...d)=>{t===null?(s(...d),a()):(n=d,clearTimeout(t),a())};return b.flush=()=>{if(t!==null&&clearTimeout(t),t=null,n===null)return;const d=n;n=null,s(...d)},b.cancel=()=>{t!==null&&clearTimeout(t),t=null,n=null},b.pending=()=>t!==null||n!==null,b}function m(s,e=50){return typeof requestIdleCallback=="function"?requestIdleCallback(s,{timeout:e}):setTimeout(()=>s({timeRemaining:()=>0,didTimeout:!0}),1)}let w=0;function z(s="l"){return`${s}${(++w).toString(36)}`}}),Tt("packages/modules/shared/emitter.js",function(h,pt){"use strict";Object.defineProperty(h,"WILDCARD",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"Emitter",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"gate",{enumerable:!0,get:function(){return l}});const xt=pt("packages/core/src/internal/util.js"),dt=xt.isFunction,at=xt.warnOnce,V="*",tt=new Set(["api","user","init","ai"]);function D(v,g){return v&&v.name?v.name:`#${g}`}class J{#n=new Map;#r;constructor(g="module"){this.#r=String(g)}on(g,$){if(!dt($))return()=>{};let q=this.#n.get(g);return q||(q=new Set,this.#n.set(g,q)),q.add($),()=>this.off(g,$)}off(g,$){const q=this.#n.get(g);q&&q.delete($)}count(g){const $=this.#n.get(g);return $?$.size:0}emit(g,$){const q=this.#n.get(g),et=this.#n.get(V);if((!q||q.size===0)&&(!et||et.size===0))return;const _={...$||null,type:g};q&&q.size&&this.#t([...q],_,g),et&&et.size&&this.#t([...et],_,V)}#t(g,$,q){for(let et=0;et<g.length;et++)try{g[et]($)}catch(_){at(`${this.#r}.emit.throw:${q}:${D(g[et],et)}`,`${this.#r}: a '${q}' handler threw; other handlers were unaffected.`,_)}}emitBefore(g,$,q){const et=q??($&&$.origin),_=tt.has(et)?et:"user";let F=!1,A=null;const ot=it=>{F=!0,it!=null&&A===null&&(A=String(it))},K={...$||null,type:g,origin:_,get defaultPrevented(){return F},get reason(){return A},preventDefault(it){ot(it)}},R=this.#n.get(g);if(!R||R.size===0)return!0;const E=[...R],X=()=>(F&&A===null&&(A="prevented"),F&&$&&typeof $=="object"&&($.reason=A),!F),Q=[];for(let it=0;it<E.length;it++){const y=E[it];try{const f=y(K);f&&dt(f.then)?Q.push(f):f===!1&&ot("prevented")}catch(f){ot("error"),at(`${this.#r}.beforeThrow:${g}:${D(y,it)}`,`${this.#r}: a '${g}' before-handler threw; the action was cancelled.`,f)}}return Q.length===0?X():Promise.allSettled(Q).then(it=>{for(const y of it)y.status==="rejected"?(ot("error"),at(`${this.#r}.beforeReject:${g}`,`${this.#r}: a '${g}' before-handler rejected; the action was cancelled.`,y.reason)):y.value===!1&&ot("prevented");return X()})}clear(){this.#n.clear()}}function l(v,g,$,q,et){const _=v.emitBefore(g,q,q.origin),F=()=>(v.emit($,{...q,reason:q.reason||"prevented"}),!1);return _===!1?F():_&&dt(_.then)?_.then(A=>A?et():F()):et()}}),Tt("packages/modules/gantt/time.js",function(h,pt){"use strict";Object.defineProperty(h,"toDayNumber",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"fromDayNumber",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"toISODate",{enumerable:!0,get:function(){return D}}),Object.defineProperty(h,"resolveProjectEpoch",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=864e5;function V(l){if(l==null||l==="")return null;if(typeof l=="number")return Number.isFinite(l)?l:null;if(l instanceof Date)return Number.isFinite(l.getTime())?Math.floor(Date.UTC(l.getFullYear(),l.getMonth(),l.getDate())/at):null;const v=Date.parse(l);return Number.isFinite(v)?Math.floor(v/at):null}function tt(l){return Number.isFinite(l)?new Date(Math.round(l)*at):null}function D(l){const v=tt(l);return v?v.toISOString().slice(0,10):null}function J(l){if(l==null||l==="")return 0;const v=V(l);return Number.isFinite(v)?v:(dt(`gantt.projectEpoch:${String(l)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(l)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),Tt("packages/modules/gantt/calendar.js",function(h,pt){"use strict";Object.defineProperty(h,"createCalendar",{enumerable:!0,get:function(){return tt}});const xt=pt("packages/modules/gantt/time.js"),dt=xt.fromDayNumber,at=xt.toDayNumber,V=Object.freeze([1,2,3,4,5]);function tt(D,J=0){if(D==null)return null;let l,v;D==="weekends"?(l=V,v=new Set):(l=Array.isArray(D.workdays)&&D.workdays.length?D.workdays.map(Number).filter(R=>R>=0&&R<=6):V,v=new Set((Array.isArray(D.holidays)?D.holidays:[]).map(R=>at(R)).filter(R=>R!=null)));const g=new Set(l);if(g.size===7&&v.size===0||g.size===0)return null;const $=R=>{const E=dt(R);return E?g.has(E.getUTCDay())&&!v.has(R):!1},q=R=>{let E=R;for(;!$(E);)E+=1;return E},et=R=>{let E=R;for(;!$(E);)E-=1;return E},_=q(Math.round(Number.isFinite(J)?J:0)),F=new Map([[0,_]]),A=new Map([[_,0]]);return{isWorking:$,nextWorking:q,dayOf:R=>{const E=Math.round(R);if(F.has(E))return F.get(E);if(E>0){let it=E-1;for(;!F.has(it);)it-=1;let y=F.get(it);for(let f=it+1;f<=E;f+=1)y=q(y+1),F.set(f,y),A.set(y,f);return F.get(E)}let X=E+1;for(;!F.has(X);)X+=1;let Q=F.get(X);for(let it=X-1;it>=E;it-=1)Q=et(Q-1),F.set(it,Q),A.set(Q,it);return F.get(E)},indexOf:R=>{const E=q(Math.round(R));if(A.has(E))return A.get(E);if(E>_){let it=0,y=_;for(;A.has(q(y+1))&&y<E;)y=q(y+1),it=A.get(y);for(;y<E;)y=q(y+1),it+=1,F.set(it,y),A.set(y,it);return it}let X=0,Q=_;for(;Q>E;)Q=et(Q-1),X-=1,F.set(X,Q),A.set(Q,X);return X},anchor:_}}}),Tt("packages/modules/gantt/schedule.js",function(h,pt){"use strict";Object.defineProperty(h,"LINK_TYPES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(h,"EPS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"TASK_FIELDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"taskIdReader",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"taskFieldWriters",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"normalizeTasks",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"buildTree",{enumerable:!0,get:function(){return E}}),Object.defineProperty(h,"normalizeLinkSpec",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"normalizeDependencies",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"expandDependencies",{enumerable:!0,get:function(){return y}}),Object.defineProperty(h,"topoOrder",{enumerable:!0,get:function(){return f}}),Object.defineProperty(h,"computeSchedule",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(h,"findViolations",{enumerable:!0,get:function(){return L}});const dt=pt("packages/core/src/internal/util.js").warnOnce,V=pt("packages/modules/gantt/calendar.js").createCalendar,D=pt("packages/modules/gantt/time.js").toDayNumber,J=["FS","SS","FF","SF"],l=["MSO","MFO","ALAP"],v=Object.freeze({mso:"MSO","must-start-on":"MSO",muststarton:"MSO","start-on":"MSO",mfo:"MFO","must-finish-on":"MFO",mustfinishon:"MFO","finish-on":"MFO",alap:"ALAP","as-late-as-possible":"ALAP",aslateaspossible:"ALAP",late:"ALAP"}),g=1e-9,$={CYCLE:"cycle",DUPLICATE_ID:"duplicate-id",UNKNOWN_TASK:"unknown-task",BAD_DURATION:"bad-duration",BAD_LINK_TYPE:"bad-link-type",SELF_DEPENDENCY:"self-dependency",UNKNOWN_PARENT:"unknown-parent",PARENT_CYCLE:"parent-cycle",DEP_ACROSS_HIERARCHY:"dep-across-hierarchy"};function q(k){if(k==null||k==="")return null;const U=typeof k=="number"?k:Number(k);return Number.isFinite(U)?U:null}function et(k){return k==null||k===""?null:D(k)}const _=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate"]);function F(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of _){const W=U[B];if(typeof W=="function")o[B]=W;else if(typeof W=="string"&&W!==""){const Z=W;o[B]=T=>T[Z]}else o[B]=Z=>Z[B]}return o}function A(k){return F(k).id}function ot(k){const U=k&&typeof k=="object"?k:{},o={};for(const B of _){const W=U[B];typeof W=="string"&&W!==""?o[B]=W:typeof W=="function"?o[B]=null:o[B]=B}return o}function K(k,U){const o=U.constraint(k),B=o??(k&&k.constraintType);if(B==null||B==="")return null;const W=v[String(B).toLowerCase().replace(/\s+/g,"-")]??(l.includes(String(B).toUpperCase())?String(B).toUpperCase():null);if(!W)return null;const Z=et(U.constraintDate(k)??k.constraintAt??k.at);return{type:W,at:Z}}function R(k,U){const o=new Map,B=[],W=F(U);if(!Array.isArray(k))return{ok:!1,error:{code:$.BAD_DURATION,message:"tasks must be an array"},order:B,byId:o};for(const Z of k){const T=Z?W.id(Z):null,S=T!=null?String(T):null;if(S==null)return{ok:!1,error:{code:$.UNKNOWN_TASK,message:"every task needs an id"},order:B,byId:o};if(o.has(S))return{ok:!1,error:{code:$.DUPLICATE_ID,message:`duplicate task id "${S}"`,id:S},order:B,byId:o};const p=et(W.start(Z)),M=et(W.end(Z)),lt=W.milestone(Z)===!0;let wt=lt?0:q(W.duration(Z));if(wt==null&&p!=null&&M!=null&&(wt=M-p),wt!=null&&wt<0)return{ok:!1,error:{code:$.BAD_DURATION,message:`task "${S}" has negative duration ${wt}`,id:S},order:B,byId:o};const st=W.name(Z),r=W.parent(Z);o.set(S,{id:S,name:st!=null?String(st):S,duration:wt,milestoneFlag:lt,earliestStart:p,placedStart:p,placedEnd:M,percentComplete:q(W.percentComplete(Z)),parent:r!=null?String(r):null,constraint:K(Z,W),baselineStart:et(W.baselineStart(Z)??(Z.baseline&&Z.baseline.start)),baselineEnd:et(W.baselineEnd(Z)??(Z.baseline&&Z.baseline.end))}),B.push(S)}return{ok:!0,order:B,byId:o}}function E(k,U){const o=new Map(k.map(S=>[S,[]]));for(const S of k){const p=U.get(S).parent;if(p!=null){if(!U.has(p))return{ok:!1,error:{code:$.UNKNOWN_PARENT,message:`task "${S}" names unknown parent "${p}"`,id:S}};o.get(p).push(S)}}for(const S of k){const p=new Set;let M=U.get(S).parent;for(;M!=null;){if(M===S||p.has(M))return{ok:!1,error:{code:$.PARENT_CYCLE,message:`parent cycle at "${S}"`,id:S}};p.add(M),M=U.get(M)?.parent??null}}const B=S=>o.get(S).length>0,W=new Map,Z=S=>{if(W.has(S))return W.get(S);const p=o.get(S),M=p.length===0?[S]:p.flatMap(lt=>Z(lt));return W.set(S,M),M};return{ok:!0,children:o,isSummary:B,descendantLeaves:Z,ancestors:S=>{const p=new Set;let M=U.get(S).parent;for(;M!=null;)p.add(M),M=U.get(M).parent;return p}}}const X=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function Q(k){const U={...k||null};if(typeof U.type!="string")return U;const o=X.exec(U.type);if(!o||!o[2])return U;const B=(o[2]==="-"?-1:1)*Number(o[3]);U.type=o[1].toUpperCase();const W=q(k.lag);return W!=null&&W!==B?(dt(`gantt-link-shorthand-${String(k.type)}-${W}`,`[lattice] gantt: dependency type ${JSON.stringify(k.type)} carries a lag of ${B} but lag: ${W} was also given; the explicit lag wins. Give one or the other.`),U):(U.lag=B,U)}function it(k,U,o={}){const B=[];if(k==null)return{ok:!0,edges:B};if(!Array.isArray(k))return{ok:!1,error:{code:$.UNKNOWN_TASK,message:"dependencies must be an array"},edges:B};const W=typeof o.ancestors=="function"?o.ancestors:null;for(const Z of k){const T=Q(Z),S=T&&T.from!=null?String(T.from):null,p=T&&T.to!=null?String(T.to):null,M=T&&T.type!=null?String(T.type).toUpperCase():"FS",lt=q(T.lag)??0;if(S==null||p==null)return{ok:!1,error:{code:$.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:B};if(!U.has(S))return{ok:!1,error:{code:$.UNKNOWN_TASK,message:`dependency references unknown task "${S}"`,id:S},edges:B};if(!U.has(p))return{ok:!1,error:{code:$.UNKNOWN_TASK,message:`dependency references unknown task "${p}"`,id:p},edges:B};if(S===p)return{ok:!1,error:{code:$.SELF_DEPENDENCY,message:`task "${S}" depends on itself`,id:S},edges:B};if(!J.includes(M))return{ok:!1,error:{code:$.BAD_LINK_TYPE,message:`unknown link type "${M}" (expected one of ${J.join("/")})`},edges:B};if(W&&(W(S).has(p)||W(p).has(S)))return{ok:!1,error:{code:$.DEP_ACROSS_HIERARCHY,message:`dependency between "${S}" and "${p}" crosses their own parent/child hierarchy`,from:S,to:p},edges:B};B.push({from:S,to:p,type:M,lag:lt})}return{ok:!0,edges:B}}function y(k,U){const o=new Set,B=[];for(const W of k){(U.isSummary(W.from)||U.isSummary(W.to))&&W.type!=="FS"&&dt(`gantt-summary-link-${W.type}-${W.from}-${W.to}`,`[lattice] gantt: ${W.type} link with a summary endpoint (${W.from} -> ${W.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const T of U.descendantLeaves(W.from))for(const S of U.descendantLeaves(W.to)){if(T===S)continue;const p=[T,S,W.type,W.lag].join("");o.has(p)||(o.add(p),B.push({from:T,to:S,type:W.type,lag:W.lag}))}}return B}function f(k,U){const o=new Map(k.map(T=>[T,0])),B=new Map(k.map(T=>[T,[]]));for(const T of U)N(o,T.to),B.get(T.from).push(T.to);const W=k.filter(T=>o.get(T)===0),Z=[];for(;W.length;){const T=W.shift();Z.push(T);for(const S of B.get(T)){const p=o.get(S)-1;o.set(S,p),p===0&&W.push(S)}}return Z.length===k.length?{ok:!0,sorted:Z}:{ok:!1,cycle:Y(k,B,new Set(Z))}}function N(k,U){k.set(U,k.get(U)+1)}function Y(k,U,o){const B=k.find(S=>!o.has(S)),W=[],Z=new Map;let T=B;for(;T!=null&&!Z.has(T);)Z.set(T,W.length),W.push(T),T=U.get(T).find(S=>!o.has(S));return T==null?W:W.slice(Z.get(T)).concat(T)}function I(k,U,o,B,W,Z=new Map){const T=f(k,o);if(!T.ok)return dt(`gantt-cycle-${T.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${T.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:$.CYCLE,message:`dependency cycle: ${T.cycle.join(" -> ")}`,cycle:T.cycle}};const S=T.sorted,p=new Map(k.map(w=>[w,[]])),M=new Map(k.map(w=>[w,[]]));for(const w of o)p.get(w.to).push(w),M.get(w.from).push(w);const lt=new Map;for(const w of k){const z=U.get(w);lt.set(w,{id:w,name:z.name,duration:z.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:z.percentComplete,parent:z.parent,isSummary:!1,isMilestone:z.duration===0,children:[]})}const wt=[];for(const w of S){const z=U.get(w),s=lt.get(w);let e=Math.max(B,z.earliestStart??B);for(const n of p.get(w)){const i=lt.get(n.from);let a;switch(n.type){case"FS":a=i.ef+n.lag;break;case"SS":a=i.es+n.lag;break;case"FF":a=i.ef+n.lag-s.duration;break;case"SF":a=i.es+n.lag-s.duration;break;default:a=-1/0}a>e&&(e=a)}const t=Z.get(w);if(t&&t.type!=="ALAP"&&t.at!=null){const n=t.type==="MFO"?t.at-s.duration:t.at;n<e-g?wt.push({id:w,type:t.type,at:t.at,earliestFeasible:e}):e=n,s.pinned=!0}s.es=e,s.ef=e+s.duration}const st=k.length?Math.max(...k.map(w=>lt.get(w).ef)):B,r=Number.isFinite(W)?W:st;for(let w=S.length-1;w>=0;w-=1){const z=S[w],s=lt.get(z);let e=r;for(const t of M.get(z)){const n=lt.get(t.to);let i;switch(t.type){case"FS":i=n.ls-t.lag;break;case"SS":i=n.ls-t.lag+s.duration;break;case"FF":i=n.lf-t.lag;break;case"SF":i=n.lf-t.lag+s.duration;break;default:i=1/0}i<e&&(e=i)}s.pinned&&(e=s.ef),s.lf=e,s.ls=e-s.duration,s.totalFloat=s.ls-s.es,s.critical=s.totalFloat<=g}for(const w of k){const z=Z.get(w);if(!z||z.type!=="ALAP")continue;const s=lt.get(w);s.es=s.ls,s.ef=s.lf,s.totalFloat=0,s.critical=!0}const c=k.filter(w=>lt.get(w).critical),m=u(k,o,lt);return{ok:!0,tasks:lt,critical:c,criticalPaths:m,projectFinish:st,conflicts:wt}}function rt(k,U=[],o={}){const B=et(o.projectStart)??0,W=et(o.deadline),Z=V(o.calendar,B),T=a=>a==null?null:Z?Z.indexOf(a):a,S=a=>Z?Z.dayOf(a):a,p=R(k,o.fields);if(!p.ok)return{ok:!1,error:p.error};const{order:M,byId:lt}=p,wt=E(M,lt);if(!wt.ok)return{ok:!1,error:wt.error};const st=it(U,lt,wt);if(!st.ok)return{ok:!1,error:st.error};for(const a of M)if(!wt.isSummary(a)&&lt.get(a).duration==null)return{ok:!1,error:{code:$.BAD_DURATION,message:`task "${a}" has no duration and no start+end to derive one`,id:a}};const r=M.filter(a=>!wt.isSummary(a)),c=new Map(r.map(a=>{const b=lt.get(a);return[a,{...b,earliestStart:T(b.earliestStart)}]})),m=new Map;for(const a of r){const b=lt.get(a).constraint;b&&m.set(a,{type:b.type,at:T(b.at)})}const w=Z?Z.indexOf(B):B,z=W==null?void 0:T(W),s=y(st.edges,wt),e=I(r,c,s,w,z,m);if(!e.ok)return{ok:!1,error:e.error};const t=e.tasks;for(const a of r){const b=t.get(a);b.es=S(b.es),b.ef=S(b.ef),b.ls=S(b.ls),b.lf=S(b.lf),j(b,lt.get(a).baselineStart,lt.get(a).baselineEnd)}for(let a=M.length-1;a>=0;a-=1){const b=M[a];wt.isSummary(b)&&t.set(b,H(b,lt.get(b),wt,t))}for(const a of M)wt.isSummary(a)&&(t.get(a).children=wt.children.get(a).slice());const n=Z?Z.anchor:B,i=S(e.projectFinish);return{ok:!0,tasks:t,order:M,critical:e.critical,criticalPaths:e.criticalPaths,projectStart:n,projectFinish:i,projectDuration:i-n,conflicts:e.conflicts||[],calendar:!!Z}}function j(k,U,o){U==null&&o==null||(k.baselineStart=U??null,k.baselineEnd=o??null,k.startVariance=U==null?null:k.es-U,k.finishVariance=o==null?null:k.ef-o,k.durationVariance=U==null||o==null?null:k.ef-k.es-(o-U))}function H(k,U,o,B){const W=o.children.get(k).map(m=>B.get(m)),Z=Math.min(...W.map(m=>m.es)),T=Math.max(...W.map(m=>m.ef)),S=Math.min(...W.map(m=>m.ls)),p=Math.max(...W.map(m=>m.lf)),M=o.descendantLeaves(k).map(m=>B.get(m)),lt=M.reduce((m,w)=>m+w.duration,0),wt=lt>g?M.reduce((m,w)=>m+w.duration*(w.percentComplete??0),0)/lt:null,st={id:k,name:U.name,duration:T-Z,es:Z,ef:T,ls:S,lf:p,totalFloat:S-Z,critical:W.some(m=>m.critical),percentComplete:wt,parent:U.parent,isSummary:!0,isMilestone:!1,children:[]},r=M.map(m=>m.baselineStart).filter(m=>m!=null),c=M.map(m=>m.baselineEnd).filter(m=>m!=null);return(r.length||c.length)&&j(st,r.length?Math.min(...r):null,c.length?Math.max(...c):null),st}function u(k,U,o){const B=new Map(k.map(p=>[p,[]])),W=new Set;for(const p of U){const M=o.get(p.from),lt=o.get(p.to);if(!M.critical||!lt.critical)continue;let wt;switch(p.type){case"FS":wt=M.ef+p.lag;break;case"SS":wt=M.es+p.lag;break;case"FF":wt=M.ef+p.lag-lt.duration;break;case"SF":wt=M.es+p.lag-lt.duration;break;default:wt=-1/0}Math.abs(wt-lt.es)<=g&&(B.get(p.from).push(p.to),W.add(p.to))}const Z=k.filter(p=>o.get(p).critical&&!W.has(p)),T=[],S=(p,M)=>{const lt=B.get(p);if(!lt.length){T.push(M);return}for(const wt of lt)S(wt,M.concat(wt))};for(const p of Z)S(p,[p]);return T}function L(k,U,o){if(!U||!U.ok)return[];const B=[],W=F(o);for(const Z of k){const T=Z?W.id(Z):null,S=T!=null?String(T):null;if(S==null||!U.tasks.has(S))continue;const p=U.tasks.get(S);if(p.isSummary)continue;const M=q(W.start(Z));M!=null&&M<p.es-g&&B.push({id:S,placedStart:M,earliestStart:p.es,by:p.es-M})}return B}}),Tt("packages/modules/gantt/resources.js",function(h,pt){"use strict";Object.defineProperty(h,"parseAssignments",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"normalizeCapacities",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"sweepLoad",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"computeResourceLoad",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"levelResources",{enumerable:!0,get:function(){return A}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/schedule.js"),V=at.computeSchedule,tt=at.EPS,D=at.taskIdReader,l=pt("packages/modules/gantt/calendar.js").createCalendar;function v(K){if(K==null||K==="")return null;const R=typeof K=="number"?K:Number(K);return Number.isFinite(R)?R:null}function g(K){if(K&&Array.isArray(K.assignments))return K.assignments.map(X=>{const Q=X&&(X.resource??X.name??X.id);if(Q==null||Q==="")return null;const it=v(X.units)??v(X.allocation)??1;return{resource:String(Q),units:it}}).filter(Boolean);const R=K?K.assignee??K.assignees??K.owner:null;return(Array.isArray(R)?R:R==null||R===""?[]:[R]).map(X=>String(X)).filter(X=>X!=="").map(X=>({resource:X,units:1}))}function $(K,R){const E=new Map;if(Array.isArray(K))for(const X of K){const Q=X&&(X.id??X.name??X.resource);if(Q==null||Q==="")continue;const it=v(X.capacity??X.maxUnits??X.max??X.units);E.set(String(Q),it??R)}else if(K&&typeof K=="object")for(const[X,Q]of Object.entries(K)){const it=v(Q);E.set(String(X),it??R)}return E}function q(K){if(!K.length)return[];const R=new Set;for(const Q of K)R.add(Q.s),R.add(Q.e);const E=[...R].sort((Q,it)=>Q-it),X=[];for(let Q=0;Q<E.length-1;Q+=1){const it=E[Q],y=E[Q+1];if(y<=it)continue;let f=0;const N=[];for(const Y of K)Y.s<=it&&Y.e>=y&&(f+=Y.units,N.push(Y.taskId));N.length&&X.push({s:it,e:y,load:f,taskIds:N})}return X}function et(K,R,E={}){const X={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!R||!R.ok)return X;const Q=v(E.defaultCapacity)??1,it=$(E.resources,Q),y=E.calendar!=null?l(E.calendar,R.projectStart):null,f=L=>it.has(L)?it.get(L):Q,N=L=>y?y.indexOf(L):L,Y=L=>y?y.dayOf(L):L,I=D(E.fields),rt=new Map;for(const L of R.order){const k=R.tasks.get(L);if(!k||k.isSummary)continue;const U=K.find(Z=>Z&&I(Z)!=null&&String(I(Z))===L);if(!U)continue;const o=g(U);if(!o.length)continue;const B=N(k.es),W=N(k.ef);if(!(W<=B))for(const Z of o)rt.has(Z.resource)||rt.set(Z.resource,[]),rt.get(Z.resource).push({s:B,e:W,units:Z.units,taskId:L})}const j=new Map,H=[],u=[];for(const[L,k]of rt){const U=f(L),o=q(k);let B=0;const W=o.map(T=>{T.load>B&&(B=T.load);const S={start:Y(T.s),end:Y(T.e),load:T.load,taskIds:T.taskIds};return T.load>U+tt&&u.push({resource:L,capacity:U,start:S.start,end:S.end,load:T.load,taskIds:T.taskIds.slice()}),S}),Z={resource:L,capacity:U,peak:B,segments:W};j.set(L,Z),H.push(Z)}return H.sort((L,k)=>L.resource<k.resource?-1:L.resource>k.resource?1:0),u.sort((L,k)=>L.start-k.start||(L.resource<k.resource?-1:1)),{ok:!0,resources:H,overAllocations:u,byResource:j}}function _(K){if(!K)return!1;const R=K.constraint??K.constraintType;if(R==null||R==="")return!1;const E=String(R).toLowerCase().replace(/\s+/g,"-");return E==="mso"||E==="must-start-on"||E==="muststarton"||E==="start-on"||E==="mfo"||E==="must-finish-on"||E==="mustfinishon"||E==="finish-on"}function F(K,R){return K?v(K[R])??0:0}function A(K,R,E={}){const X={projectStart:E.projectStart,deadline:E.deadline,calendar:E.calendar,fields:E.fields},Q=E.priorityField||"priority",it=E.maxIterations!=null?E.maxIterations:Math.max(100,K.length*K.length*2),y=D(E.fields),f=K.map(u=>({...u})),N=f.map(u=>String(y(u))),Y=u=>N.indexOf(u);let I=V(f,R,X);if(!I.ok)return{ok:!1,error:I.error};const rt=new Map;for(const u of I.order){const L=I.tasks.get(u);L&&!L.isSummary&&rt.set(u,L.es)}let j=0;for(;j<it;j+=1){const u=et(f,I,E);if(!u.overAllocations.length)return{ok:!0,resolved:!0,tasks:f,schedule:I,moves:ot(rt,I),iterations:j};const L=u.overAllocations.slice().sort((T,S)=>T.start-S.start||S.load-T.load)[0],k=new Map(f.map(T=>[String(y(T)),T])),U=L.taskIds.map(T=>I.tasks.get(T)).filter(Boolean),o=U.filter(T=>!_(k.get(T.id)));if(!o.length)return{ok:!0,resolved:!1,tasks:f,schedule:I,moves:ot(rt,I),remaining:u.overAllocations,iterations:j};o.sort((T,S)=>{if(S.totalFloat!==T.totalFloat)return S.totalFloat-T.totalFloat;const p=F(k.get(T.id),Q),M=F(k.get(S.id),Q);return p!==M?p-M:S.es!==T.es?S.es-T.es:Y(S.id)-Y(T.id)});const B=o[0],W=U.filter(T=>T.id!==B.id).map(T=>T.ef).filter(T=>T>B.es+tt),Z=W.length?Math.min(...W):B.es+1;if(k.get(B.id).start=Z,I=V(f,R,X),!I.ok)return{ok:!1,error:I.error}}const H=et(f,I,E);return H.overAllocations.length&&dt("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${it}-iteration cap with ${H.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:H.overAllocations.length===0,tasks:f,schedule:I,moves:ot(rt,I),remaining:H.overAllocations,iterations:j}}function ot(K,R){const E=[];for(const X of R.order){const Q=R.tasks.get(X);if(!Q||Q.isSummary)continue;const it=K.get(X);it!=null&&Q.es>it+tt&&E.push({id:X,from:it,to:Q.es,delay:Q.es-it})}return E}}),Tt("packages/modules/gantt/earned-value.js",function(h,pt){"use strict";Object.defineProperty(h,"computeEarnedValue",{enumerable:!0,get:function(){return l}});const dt=pt("packages/modules/gantt/time.js").toDayNumber,at=1e-9;function V(v){if(v==null||v==="")return null;const g=typeof v=="number"?v:Number(v);return Number.isFinite(g)?g:null}function tt(v,g,$){return $-g<=at?v>=$?1:0:v<=g?0:v>=$?1:(v-g)/($-g)}function D(v,g,$,q,et){const _=g?V(g[q]):null,F=_??v.duration,A=g?V(g[et]):null,ot=v.percentComplete==null?0:Math.max(0,Math.min(100,v.percentComplete))/100,K=v.baselineStart!=null||v.baselineEnd!=null,R=v.baselineStart!=null?v.baselineStart:v.es,E=v.baselineEnd!=null?v.baselineEnd:v.ef,X=F*tt($,R,E),Q=F*ot;return{bac:F,pv:X,ev:Q,ac:A,hasBaseline:K}}function J(v){const g=v.ac;return{bac:v.bac,pv:v.pv,ev:v.ev,ac:g,sv:v.ev-v.pv,cv:g==null?null:v.ev-g,spi:Math.abs(v.pv)<at?null:v.ev/v.pv,cpi:g==null||Math.abs(g)<at?null:v.ev/g}}function l(v,g,$={}){if(!g||!g.ok||!g.tasks||!g.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const q=$.costField||"cost",et=$.actualCostField||"actualCost",_=$.statusDate==null?g.projectFinish:dt($.statusDate)??g.projectFinish,F=new Map;for(const Q of Array.isArray(v)?v:[])Q&&Q.id!=null&&F.set(String(Q.id),Q);const A=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),ot=new Map;for(const Q of g.order)ot.set(Q,A());const K=A();for(const Q of g.order){const it=g.tasks.get(Q);if(!it||it.isSummary)continue;const y=D(it,F.get(Q),_,q,et);let f=Q;for(;f!=null&&ot.has(f);){const N=ot.get(f);N.bac+=y.bac,N.pv+=y.pv,N.ev+=y.ev,y.ac!=null&&(N.ac+=y.ac,N.acAny=!0),y.hasBaseline&&(N.hasBaseline=!0),f=g.tasks.get(f).parent}K.bac+=y.bac,K.pv+=y.pv,K.ev+=y.ev,y.ac!=null&&(K.ac+=y.ac,K.acAny=!0),y.hasBaseline&&(K.hasBaseline=!0)}const R=Q=>J({bac:Q.bac,pv:Q.pv,ev:Q.ev,ac:Q.acAny?Q.ac:null}),E=new Map,X=[];for(const Q of g.order){const it=g.tasks.get(Q),y=ot.get(Q),f={id:it.id,name:it.name,isSummary:!!it.isSummary,isMilestone:!!it.isMilestone,percentComplete:it.percentComplete??null,hasBaseline:y.hasBaseline,hasActualCost:y.acAny,...R(y)};E.set(Q,f),X.push(f)}return{ok:!0,statusDate:_,byTask:E,rows:X,project:{hasActualCost:K.acAny,hasBaseline:K.hasBaseline,...R(K)}}}}),Tt("packages/modules/gantt/mspdi.js",function(h,pt){"use strict";Object.defineProperty(h,"parseXml",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"importMSPDI",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"exportMSPDI",{enumerable:!0,get:function(){return f}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/gantt/time.js"),V=at.toDayNumber,tt=at.toISODate,D=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),J=Object.freeze({FF:0,FS:1,SF:2,SS:3}),l=Object.freeze({1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on"}),v=Object.freeze({ALAP:1,MSO:2,MFO:3});function g(j){return String(j).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(H,u)=>{if(u[0]==="#"){const L=u[1]==="x"||u[1]==="X"?parseInt(u.slice(2),16):parseInt(u.slice(1),10);return Number.isFinite(L)?String.fromCodePoint(L):H}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[u]??H})}function $(j){return String(j??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function q(j){const H=j.indexOf(":");return H<0?j:j.slice(H+1)}function et(j){const H=String(j);let u=0;const L=[];let k=null;for(;u<H.length;){const U=H.indexOf("<",u);if(U<0)break;if(U>u&&L.length){const M=H.slice(u,U);M.trim()&&(L[L.length-1].text+=g(M))}if(H.startsWith("<?",U)){const M=H.indexOf("?>",U);u=M<0?H.length:M+2;continue}if(H.startsWith("<!--",U)){const M=H.indexOf("-->",U);u=M<0?H.length:M+3;continue}if(H.startsWith("<![CDATA[",U)){const M=H.indexOf("]]>",U);L.length&&(L[L.length-1].text+=H.slice(U+9,M<0?H.length:M)),u=M<0?H.length:M+3;continue}if(H.startsWith("<!",U)){const M=H.indexOf(">",U);u=M<0?H.length:M+1;continue}const o=H.indexOf(">",U);if(o<0)break;let B=H.slice(U+1,o).trim();if(B[0]==="/"){L.pop(),u=o+1;continue}const W=B.endsWith("/");W&&(B=B.slice(0,-1).trim());const Z=B.search(/\s/),T=q(Z<0?B:B.slice(0,Z)),S={};if(Z>=0)for(const M of B.slice(Z).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))S[q(M[1]??M[3])]=g(M[2]??M[4]??"");const p={name:T,attrs:S,children:[],text:""};L.length?L[L.length-1].children.push(p):k||(k=p),W||L.push(p),u=o+1}return k}function _(j,H){return j?j.children.find(u=>u.name===H):void 0}function F(j,H){return j?j.children.filter(u=>u.name===H):[]}function A(j,H){const u=_(j,H);return u?u.text.trim():void 0}function ot(j){if(!j)return null;const H=String(j).match(/^\d{4}-\d{2}-\d{2}/);return V(H?H[0]:j)}function K(j,H){return`${tt(j)}T${String(H).padStart(2,"0")}:00:00`}function R(j,H){if(!j)return null;const u=String(j).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return u?((Number(u[1])||0)+(Number(u[2])||0)/60+(Number(u[3])||0)/3600)/H:null}function E(j,H){return`PT${Math.round((j||0)*H*1e3)/1e3}H0M0S`}function X(j,H){return(Number(j)||0)/(600*H)}function Q(j,H){return Math.round((j||0)*10*60*H)}function it(j,H={}){const u=H.hoursPerDay??8,L=et(j);if(!L||L.name!=="Project")return dt("gantt-mspdi-not-project","[lattice] gantt: importMSPDI input is not an MSPDI <Project> document."),{ok:!1,error:"not an MSPDI <Project> document",tasks:[],dependencies:[],resources:[]};const k=ot(A(L,"StartDate")),U=_(L,"Resources"),o=new Map,B=[];for(const c of F(U,"Resource")){const m=A(c,"UID"),w=A(c,"Name");if(m==null||w==null||w==="")continue;o.set(m,w);const z=A(c,"MaxUnits");B.push({id:w,name:w,capacity:z==null?1:Number(z)})}const W=_(L,"Assignments"),Z=new Map;for(const c of F(W,"Assignment")){const m=A(c,"TaskUID"),w=A(c,"ResourceUID"),z=o.get(w);if(m==null||z==null)continue;const s=A(c,"Units");Z.has(m)||Z.set(m,[]),Z.get(m).push({resource:z,units:s==null?1:Number(s)})}const T=_(L,"Tasks"),S=[],p=[],M=new Map,lt=[],wt=[];for(const c of F(T,"Task")){if(A(c,"IsNull")==="1")continue;const m=A(c,"UID");if(m==null||m==="0")continue;const w=m;M.set(m,w);const z=Number(A(c,"OutlineLevel"))||1;for(;lt.length&&lt[lt.length-1].level>=z;)lt.pop();const s=lt.length?lt[lt.length-1].uid:null;lt.push({uid:m,level:z});const e=A(c,"Summary")==="1",t=A(c,"Milestone")==="1",n={id:w,name:A(c,"Name")??w};if(s&&(n.parent=s),t&&(n.milestone=!0),!e&&!t){const G=R(A(c,"Duration"),u);G!=null&&(n.duration=G)}const i=ot(A(c,"Start"));!e&&i!=null&&(n.start=i);const a=A(c,"PercentComplete");a!=null&&(n.percentComplete=Number(a));const b=l[Number(A(c,"ConstraintType"))];if(b){n.constraint=b;const G=ot(A(c,"ConstraintDate"));G!=null&&(n.constraintDate=G)}const d=_(c,"Baseline");if(d){const G=ot(A(d,"Start")),C=ot(A(d,"Finish"));G!=null&&(n.baselineStart=G),C!=null&&(n.baselineEnd=C)}const P=Z.get(m);P&&P.length&&(n.assignments=P),S.push(n);for(const G of F(c,"PredecessorLink"))wt.push({raw:G,uid:m})}for(const{raw:c,uid:m}of wt){const w=A(c,"PredecessorUID"),z=M.get(w),s=M.get(m);if(z==null||s==null)continue;const e=D[Number(A(c,"Type")??1)]??"FS",t=X(A(c,"LinkLag"),u),n={from:z,to:s,type:e};t&&(n.lag=t),p.push(n)}const st=y(L),r={ok:!0,tasks:S,dependencies:p,resources:B};return k!=null&&(r.projectStart=k),st&&(r.calendar=st),r}function y(j){const H=_(j,"Calendars"),u=F(H,"Calendar"),L=A(j,"CalendarUID"),k=u.find(T=>A(T,"UID")===L)??u[0];if(!k)return null;const U=_(k,"WeekDays"),o=[];let B=!1;for(const T of F(U,"WeekDay")){const S=Number(A(T,"DayType"));S>=1&&S<=7&&(B=!0,A(T,"DayWorking")==="1"&&o.push(S-1))}const W=[],Z=_(k,"Exceptions");for(const T of F(Z,"Exception")){if(A(T,"DayWorking")==="1")continue;const S=_(T,"TimePeriod"),p=ot(A(S,"FromDate")),M=ot(A(S,"ToDate"))??p;if(p!=null)for(let lt=p;lt<=M;lt+=1)W.push(lt)}return!B&&!W.length?null:{workdays:B?o:[1,2,3,4,5],holidays:W}}function f(j,H={}){const u=H.hoursPerDay??8,L=Array.isArray(j.tasks)?j.tasks:[],k=Array.isArray(j.dependencies)?j.dependencies:[],U=Array.isArray(j.resources)?j.resources:j.resources&&typeof j.resources=="object"?Object.entries(j.resources).map(([r,c])=>({id:r,name:r,capacity:c})):[],o=j.schedule&&j.schedule.ok?j.schedule:null,B=new Map;L.forEach((r,c)=>{const m=String(r.id);B.set(m,/^\d+$/.test(m)?m:String(c+1))});const W=new Map;for(const r of L){const c=r.parent!=null?String(r.parent):null;c&&(W.has(c)||W.set(c,[]),W.get(c).push(String(r.id)))}const Z=r=>W.has(r),T=r=>{let c=1,m=L.find(w=>String(w.id)===r);for(;m&&m.parent!=null;)c+=1,m=L.find(w=>String(w.id)===String(m.parent));return c},S=new Map;for(const r of k){const c=String(r.to);S.has(c)||S.set(c,[]),S.get(c).push(r)}const p=[];p.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),p.push('<Project xmlns="http://schemas.microsoft.com/project">'),p.push(` <Name>${$(H.projectName||"Lattice Gantt export")}</Name>`);const M=j.projectStart!=null?V(j.projectStart):o?o.projectStart:null;M!=null&&p.push(` <StartDate>${K(M,8)}</StartDate>`);const lt=Y(j.calendar);if(lt&&p.push(" <CalendarUID>1</CalendarUID>"),lt){p.push(" <Calendars>"),p.push(" <Calendar>"),p.push(" <UID>1</UID>"),p.push(" <Name>Standard</Name>"),p.push(" <IsBaseCalendar>1</IsBaseCalendar>"),p.push(" <WeekDays>");for(let r=0;r<=6;r+=1){const c=lt.workdays.includes(r);p.push(" <WeekDay>"),p.push(` <DayType>${r+1}</DayType>`),p.push(` <DayWorking>${c?1:0}</DayWorking>`),p.push(" </WeekDay>")}if(p.push(" </WeekDays>"),lt.holidays.length){p.push(" <Exceptions>");for(const r of lt.holidays)p.push(" <Exception>"),p.push(" <DayWorking>0</DayWorking>"),p.push(` <TimePeriod><FromDate>${K(r,0)}</FromDate><ToDate>${K(r,23)}</ToDate></TimePeriod>`),p.push(" </Exception>");p.push(" </Exceptions>")}p.push(" </Calendar>"),p.push(" </Calendars>")}p.push(" <Tasks>");for(const r of L){const c=String(r.id),m=B.get(c),w=Z(c),z=!!r.milestone||!w&&Number(r.duration)===0,s=o?o.tasks.get(c):null;p.push(" <Task>"),p.push(` <UID>${$(m)}</UID>`),p.push(` <ID>${$(m)}</ID>`),p.push(` <Name>${$(r.name!=null?r.name:c)}</Name>`),p.push(` <OutlineLevel>${T(c)}</OutlineLevel>`),p.push(` <Summary>${w?1:0}</Summary>`),p.push(` <Milestone>${z?1:0}</Milestone>`);const e=s?s.duration:r.duration!=null?Number(r.duration):null;e!=null&&p.push(` <Duration>${E(e,u)}</Duration>`),p.push(" <DurationFormat>7</DurationFormat>");const t=s?s.es:r.start!=null?V(r.start):null,n=s?s.ef:r.end!=null?V(r.end):t!=null&&e!=null?t+e:null;t!=null&&p.push(` <Start>${K(t,8)}</Start>`),n!=null&&p.push(` <Finish>${K(n,17)}</Finish>`);const i=s?s.percentComplete:r.percentComplete;i!=null&&p.push(` <PercentComplete>${Math.round(Number(i))}</PercentComplete>`);const a=I(r.constraint??r.constraintType);if(a!=null){p.push(` <ConstraintType>${a}</ConstraintType>`);const P=rt(r.constraintDate??r.constraintAt??r.at);P!=null&&p.push(` <ConstraintDate>${K(P,8)}</ConstraintDate>`)}const b=rt(r.baselineStart??(r.baseline&&r.baseline.start)),d=rt(r.baselineEnd??(r.baseline&&r.baseline.end));(b!=null||d!=null)&&(p.push(" <Baseline>"),p.push(" <Number>0</Number>"),b!=null&&p.push(` <Start>${K(b,8)}</Start>`),d!=null&&p.push(` <Finish>${K(d,17)}</Finish>`),b!=null&&d!=null&&p.push(` <Duration>${E(d-b,u)}</Duration>`),p.push(" </Baseline>"));for(const P of S.get(c)||[]){const G=B.get(String(P.from));G!=null&&(p.push(" <PredecessorLink>"),p.push(` <PredecessorUID>${$(G)}</PredecessorUID>`),p.push(` <Type>${J[P.type?String(P.type).toUpperCase():"FS"]??1}</Type>`),P.lag&&(p.push(` <LinkLag>${Q(Number(P.lag),u)}</LinkLag>`),p.push(" <LagFormat>7</LagFormat>")),p.push(" </PredecessorLink>"))}p.push(" </Task>")}p.push(" </Tasks>");const wt=new Map;U.forEach((r,c)=>{const m=String(r.name??r.id??`Resource ${c+1}`);wt.set(m,{uid:String(c+1),capacity:r.capacity??r.maxUnits??1})});const st=[];for(const r of L)for(const c of N(r))wt.has(c.resource)||wt.set(c.resource,{uid:String(wt.size+1),capacity:1}),st.push({taskUid:B.get(String(r.id)),resUid:wt.get(c.resource).uid,units:c.units});p.push(" <Resources>");for(const[r,c]of wt)p.push(" <Resource>"),p.push(` <UID>${$(c.uid)}</UID>`),p.push(` <ID>${$(c.uid)}</ID>`),p.push(` <Name>${$(r)}</Name>`),p.push(` <MaxUnits>${Number(c.capacity)}</MaxUnits>`),p.push(" </Resource>");return p.push(" </Resources>"),p.push(" <Assignments>"),st.forEach((r,c)=>{p.push(" <Assignment>"),p.push(` <UID>${c+1}</UID>`),p.push(` <TaskUID>${$(r.taskUid)}</TaskUID>`),p.push(` <ResourceUID>${$(r.resUid)}</ResourceUID>`),p.push(` <Units>${Number(r.units)}</Units>`),p.push(" </Assignment>")}),p.push(" </Assignments>"),p.push("</Project>"),p.join(`
7
7
  `)}function N(j){if(j&&Array.isArray(j.assignments))return j.assignments.map(L=>{const k=L&&(L.resource??L.name??L.id);if(k==null||k==="")return null;const U=Number(L.units??L.allocation??1);return{resource:String(k),units:Number.isFinite(U)?U:1}}).filter(Boolean);const H=j?j.assignee??j.assignees??j.owner:null;return(Array.isArray(H)?H:H==null||H===""?[]:[H]).map(L=>String(L)).filter(L=>L!=="").map(L=>({resource:L,units:1}))}function Y(j){if(j==null)return null;if(j==="weekends")return{workdays:[1,2,3,4,5],holidays:[]};const H=Array.isArray(j.workdays)&&j.workdays.length?j.workdays.map(Number).filter(L=>L>=0&&L<=6):[1,2,3,4,5],u=(Array.isArray(j.holidays)?j.holidays:[]).map(L=>V(L)).filter(L=>L!=null);return{workdays:H,holidays:u}}function I(j){if(j==null||j==="")return null;const H=String(j).toLowerCase().replace(/\s+/g,"-"),L={mso:"MSO","must-start-on":"MSO",muststarton:"MSO","start-on":"MSO",mfo:"MFO","must-finish-on":"MFO",mustfinishon:"MFO","finish-on":"MFO",alap:"ALAP","as-late-as-possible":"ALAP",aslateaspossible:"ALAP",late:"ALAP"}[H]??(["MSO","MFO","ALAP"].includes(String(j).toUpperCase())?String(j).toUpperCase():null);return L?v[L]:null}function rt(j){return j==null||j===""?null:V(j)}}),Tt("packages/modules/gantt/workload.js",function(h,pt){"use strict";Object.defineProperty(h,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"statedHours",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"taskContour",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"contourTotal",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"serializeContour",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"contourSpan",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"spanDuration",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(h,"spreadHours",{enumerable:!0,get:function(){return K}}),Object.defineProperty(h,"setContourBucket",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"retimeContour",{enumerable:!0,get:function(){return E}}),Object.defineProperty(h,"recordWorkingDays",{enumerable:!0,get:function(){return X}}),Object.defineProperty(h,"workloadBuckets",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"computeWorkload",{enumerable:!0,get:function(){return it}}),Object.defineProperty(h,"formatHours",{enumerable:!0,get:function(){return y}});const dt=pt("packages/modules/gantt/resources.js").parseAssignments,at=pt("packages/modules/gantt/schedule.js"),V=at.EPS,tt=at.taskIdReader,D=pt("packages/modules/gantt/time.js"),J=D.fromDayNumber,l=D.toDayNumber,v=D.toISODate,g=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0});function $(f){if(f==null||f===""||typeof f=="boolean")return null;const N=typeof f=="number"?f:Number(f);return Number.isFinite(N)?N:null}function q(f){if(!f||Array.isArray(f.work))return null;const N=$(f.work);return N??$(f.hours)}function et(f){if(!f||!Array.isArray(f.work))return null;const N=[];for(const I of f.work){if(!I||typeof I!="object")continue;const rt=l(I.date),j=$(I.hours);rt==null||j==null||N.push({day:Math.round(rt),hours:j})}N.sort((I,rt)=>I.day-rt.day);const Y=[];for(const I of N){const rt=Y[Y.length-1];rt&&rt.day===I.day?rt.hours+=I.hours:Y.push({day:I.day,hours:I.hours})}return Y}function _(f){return(Array.isArray(f)?f:[]).reduce((N,Y)=>N+($(Y.hours)??0),0)}function F(f){const N=[];for(const Y of Array.isArray(f)?f:[]){const I=$(Y.hours);if(I==null||!(Math.abs(I)>V))continue;const rt=v(Y.day);rt!=null&&N.push({date:rt,hours:Math.round(I*1e6)/1e6})}return N}function A(f){const N=(Array.isArray(f)?f:[]).filter(Y=>Math.abs($(Y.hours)??0)>V);return N.length?{first:N[0].day,last:N[N.length-1].day}:null}function ot(f,N,Y=null){if(!Number.isFinite(f)||!Number.isFinite(N)||N<f)return 0;if(typeof Y!="function")return Math.round(N-f)+1;let I=0;for(let rt=Math.round(f);rt<=Math.round(N);rt+=1)Y(rt)&&(I+=1);return I}function K(f,N){if(!Array.isArray(f)||!f.length)return[];const Y=N/f.length;return f.map(I=>({day:I,hours:Y}))}function R(f,N,Y,I){const rt=(Array.isArray(f)?f:[]).filter(H=>!(H.day>=N.start&&H.day<N.end)),j=Math.abs(I)>V?K(Y,I):[];return[...rt,...j].sort((H,u)=>H.day-u.day)}function E(f,N,Y){const I=Array.isArray(N)?N:[],rt=Array.isArray(Y)?Y:[];if(!Array.isArray(f)||!I.length||!rt.length)return Array.isArray(f)?f:[];const j=new Map(f.map(k=>[k.day,$(k.hours)??0])),H=I.map(k=>j.get(k)??0),u=H.length,L=[];for(let k=0;k<rt.length;k+=1){const U=H[Math.min(u-1,Math.floor(k*u/rt.length))];Math.abs(U)>V&&L.push({day:rt[k],hours:U})}return L}function X(f,N=null){const Y=[];if(!f||!Number.isFinite(f.es)||!Number.isFinite(f.ef))return Y;for(let I=Math.floor(f.es);I<Math.ceil(f.ef);I+=1)(typeof N!="function"||N(I))&&Y.push(I);return Y}function Q(f,N,Y){const I=Math.floor(N),rt=Math.ceil(Y),j=[];if(!(rt>I))return j;if(f==="day"){for(let L=I;L<rt;L+=1)j.push({start:L,end:L+1});return j}if(f==="month"||f==="quarter"){const L=J(I);if(!L)return j;let k=Date.UTC(L.getUTCFullYear(),L.getUTCMonth(),1)/864e5;for(;k<rt;){const U=J(k),o=Date.UTC(U.getUTCFullYear(),U.getUTCMonth()+1,1)/864e5;j.push({start:k,end:o}),k=o}return j}const H=J(I);let u=I-(H?H.getUTCDay():0);for(;u<rt;u+=7)j.push({start:u,end:u+7});return j}function it(f,N,Y={}){const I=Array.isArray(Y.buckets)?Y.buckets:[],rt={ok:!1,buckets:[],rows:[],totals:I.map(()=>null),grandTotal:0};if(!N||!N.ok)return rt;const j=$(Y.hoursPerDay)??g.hoursPerDay,H=typeof Y.isWorking=="function"?Y.isWorking:null,u=Y.capacities instanceof Map?Y.capacities:null,L=tt(Y.fields),k=new Map,U=(st,r,c,m)=>{k.has(st)||k.set(st,{days:new Map,tasks:new Map});const w=k.get(st);w.days.set(r,(w.days.get(r)||0)+c),w.tasks.has(m.id)||w.tasks.set(m.id,{...m,days:new Map});const z=w.tasks.get(m.id);z.days.set(r,(z.days.get(r)||0)+c)},o=new Map;for(const st of Array.isArray(f)?f:[]){const r=st?L(st):null;r!=null&&o.set(String(r),st)}const B=Array.isArray(f)&&N.order.length===f.length;for(let st=0;st<N.order.length;st+=1){const r=N.order[st],c=N.tasks.get(r);if(!c||c.isSummary)continue;const m=o.get(r)||(B?f[st]:null);if(!m)continue;const w=X(c,H),z=et(m);if(!z&&!w.length)continue;const s=dt(m),e=s.length?s:[{resource:null,units:1}],t=e.reduce((i,a)=>i+($(a.units)??0),0);if(!(t>0))continue;let n;if(z)n=z.filter(i=>Math.abs(i.hours)>V);else{const i=q(m),a=i??w.length*j*t;if(!(Math.abs(a)>V))continue;n=K(w,a)}if(n.length)for(const i of e){const a=$(i.units)??0,b=a/t;if(!(Math.abs(b)>0))continue;const d={id:r,name:c.name,units:a,unitsTotal:t,raw:m};for(const P of n)U(i.resource,P.day,P.hours*b,d)}}const W=st=>{let r=0,c=I.length-1;for(;r<=c;){const m=r+c>>1;if(st<I[m].start)c=m-1;else if(st>=I[m].end)r=m+1;else return m}return-1},Z=I.map(st=>{let r=0;for(let c=Math.floor(st.start);c<Math.ceil(st.end);c+=1)(!H||H(c))&&(r+=1);return{start:st.start,end:st.end,workingDays:r}}),T=st=>{const r=Z.map(()=>0);for(const[c,m]of st){const w=W(c);w>=0&&(r[w]+=m)}return r},S=[...k.keys()].filter(st=>st!=null).sort(),p=k.has(null)?[...S,null]:S,M=[],lt=Z.map(()=>0);let wt=0;for(const st of p){const r=k.get(st),c=T(r.days),m=st!=null&&u&&u.has(st)?u.get(st):null,w=c.map(t=>Math.abs(t)>V?t:null),z=c.map((t,n)=>{if(m==null)return!1;const i=m*j*Z[n].workingDays;return t>i+V});let s=0;c.forEach((t,n)=>{s+=t,lt[n]+=t}),wt+=s;const e=[...r.tasks.values()].map(t=>{const n=T(t.days);return{id:t.id,name:t.name,units:t.units,unitsTotal:t.unitsTotal,raw:t.raw,cells:n.map(i=>Math.abs(i)>V?i:null),total:n.reduce((i,a)=>i+a,0)}});M.push({resource:st,capacity:m,cells:w,over:z,total:s,tasks:e})}return{ok:!0,buckets:Z,rows:M,totals:lt.map(st=>Math.abs(st)>V?st:null),grandTotal:wt}}function y(f,N){if(f==null||!Number.isFinite(f))return"";const I=10**(Number.isFinite(N)?Math.max(0,Math.min(6,Math.round(N))):1),rt=Math.round(f*I)/I;return Object.is(rt,-0)||rt===0?"0":String(rt)}}),Tt("packages/modules/shared/autosize.js",function(h,pt){"use strict";Object.defineProperty(h,"contentWidth",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"contentHeight",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"firstMeasured",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"watchSize",{enumerable:!0,get:function(){return D}}),Object.defineProperty(h,"watchBox",{enumerable:!0,get:function(){return J}});const dt=pt("packages/core/src/internal/util.js").warnOnce;function at(l){if(!l||typeof l!="object")return null;const v=Number(l.clientWidth);if(Number.isFinite(v)&&v>0)return v;if(typeof l.getBoundingClientRect=="function"){const g=l.getBoundingClientRect(),$=g&&Number(g.width);if(Number.isFinite($)&&$>0)return $}return null}function V(l){if(!l||typeof l!="object")return null;const v=Number(l.clientHeight);if(Number.isFinite(v)&&v>0)return v;if(typeof l.getBoundingClientRect=="function"){const g=l.getBoundingClientRect(),$=g&&Number(g.height);if(Number.isFinite($)&&$>0)return $}return null}function tt(l,v=at){for(const g of l||[]){const $=v(g);if(Number.isFinite($)&&$>0)return $}return null}function D(l){const v=(l&&Array.isArray(l.targets)?l.targets:[]).filter(Boolean),g=l&&typeof l.read=="function"?l.read:()=>null,$=l&&typeof l.apply=="function"?l.apply:()=>{},q=Number.isFinite(l&&l.epsilon)?Number(l.epsilon):1;let et=null,_=!1;const F=()=>{if(_)return!1;const E=g();if(!Number.isFinite(E)||E<=0||et!=null&&Math.abs(E-et)<q)return!1;et=E,_=!0;try{$(E)}finally{_=!1}return!0};F();const A=v[0],ot=l&&l.view||A&&A.ownerDocument&&A.ownerDocument.defaultView||globalThis,K=ot&&ot.ResizeObserver;let R=null;if(typeof K=="function"&&v.length){R=new K(()=>{F()});for(const E of v)E&&typeof R.observe=="function"&&R.observe(E)}else v.length&&dt("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:F,get applied(){return et},release(){if(R&&typeof R.disconnect=="function")try{R.disconnect()}catch{}R=null}}}function J(l){const v=(l&&Array.isArray(l.targets)?l.targets:[]).filter(Boolean),g=l&&typeof l.read=="function"?l.read:()=>({}),$=l&&typeof l.apply=="function"?l.apply:()=>{},q=Number.isFinite(l&&l.epsilon)?Number(l.epsilon):1;let et=null,_=!1;const F=X=>{if(et==null)return!0;for(const[Q,it]of Object.entries(X)){if(!Number.isFinite(it)||it<=0)continue;const y=et[Q];if(!Number.isFinite(y)||Math.abs(it-y)>=q)return!0}return!1},A=()=>{if(_)return!1;const X=g();if(!X||typeof X!="object"||!Object.values(X).some(it=>Number.isFinite(it)&&it>0)||!F(X))return!1;et={...et,...X},_=!0;try{$(X)}finally{_=!1}return!0};A();const ot=v[0],K=l&&l.view||ot&&ot.ownerDocument&&ot.ownerDocument.defaultView||globalThis,R=K&&K.ResizeObserver;let E=null;if(typeof R=="function"&&v.length){E=new R(()=>{A()});for(const X of v)X&&typeof E.observe=="function"&&E.observe(X)}else v.length&&dt("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:A,get applied(){return et},release(){if(E&&typeof E.disconnect=="function")try{E.disconnect()}catch{}E=null}}}}),Tt("packages/modules/shared/axislabels.js",function(h,pt){"use strict";Object.defineProperty(h,"CHAR_RATIO",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(h,"BOLD_FACTOR",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(h,"MIN_GAP",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"estimateLabelWidth",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"thinLabels",{enumerable:!0,get:function(){return tt}});const xt=.62,dt=1.05,at=6;function V(D,J,l=!1){return String(D??"").length*J*xt*(l?dt:1)}function tt(D,J){const l=Number.isFinite(J.gap)?Number(J.gap):at,v=Number.isFinite(J.fontSize)?Number(J.fontSize):11,g=typeof J.measure=="function"?J.measure:F=>V(F,v,!!J.bold),$=D.filter(F=>F&&Number.isFinite(F.at)).map(F=>({...F,width:g(String(F.text??""))})).sort((F,A)=>F.at-A.at);if($.length<2)return{every:1,kept:$};const q=F=>{let A=null;for(let ot=0;ot<$.length;ot+=F){const K=$[ot];if(A&&K.at-A.at<A.width+l)return!1;A=K}return!0};let et=1;for(;et<$.length&&!q(et);)et++;const _=[];for(let F=0;F<$.length;F+=et)_.push($[F]);return{every:et,kept:_}}}),Tt("packages/modules/charts/svg.js",function(h,pt){"use strict";Object.defineProperty(h,"SVG_NS",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(h,"el",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(h,"svg",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"attr",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"attrs",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"setText",{enumerable:!0,get:function(){return D}}),Object.defineProperty(h,"clear",{enumerable:!0,get:function(){return J}}),Object.defineProperty(h,"append",{enumerable:!0,get:function(){return l}}),Object.defineProperty(h,"path",{enumerable:!0,get:function(){return v}}),Object.defineProperty(h,"ribbonPath",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"round",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"pathRings",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"insideRings",{enumerable:!0,get:function(){return et}});const xt="http://www.w3.org/2000/svg";function dt(_,F,A){const ot=_.createElement(F);return A&&ot.setAttribute("class",A),ot}function at(_,F,A){const ot=_.createElementNS(xt,F);if(A)for(const K of Object.keys(A))ot.setAttribute(K,String(A[K]));return ot}function V(_,F,A){_&&(A==null?_.removeAttribute(F):_.setAttribute(F,String(A)))}function tt(_,F){if(_)for(const A of Object.keys(F))V(_,A,F[A])}function D(_,F){_&&(_.textContent=F==null?"":String(F))}function J(_){if(_)for(;_.firstChild;)_.removeChild(_.firstChild)}function l(_,F){for(const A of F)A&&_.appendChild(A);return _}function v(_){return _.join(" ")}function g(_){if(!_||_.length<2)return"";const F=["M",_[0].x,_[0].upper];for(let A=1;A<_.length;A++)F.push("L",_[A].x,_[A].upper);for(let A=_.length-1;A>=0;A--)F.push("L",_[A].x,_[A].lower);return F.push("Z"),v(F)}function $(_){return Math.round(_*100)/100}function q(_){const F=[];let A=[];const ot=String(_||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let K="",R=[];const E=()=>{if(!K||!R.length){R=[];return}if(K==="M"||K==="L")for(let X=0;X+1<R.length;X+=2)A.push([R[X],R[X+1]]);else K!=="Z"&&R.length>=2&&A.push([R[R.length-2],R[R.length-1]]);R=[]};for(const X of ot){if(/[A-Za-z]/.test(X)){if(E(),X==="Z"||X==="z"){A.length>2&&F.push(A),A=[],K="";continue}X==="M"&&A.length>2&&(F.push(A),A=[]),K=X;continue}R.push(Number(X))}return E(),A.length>2&&F.push(A),F}function et(_,F,A){let ot=!1;for(const K of _)for(let R=0,E=K.length-1;R<K.length;E=R++){const[X,Q]=K[R],[it,y]=K[E];Q>A!=y>A&&F<(it-X)*(A-Q)/(y-Q||1e-12)+X&&(ot=!ot)}return ot}}),Tt("packages/modules/charts/scale.js",function(h,pt){"use strict";Object.defineProperty(h,"isNumber",{enumerable:!0,get:function(){return l}}),Object.defineProperty(h,"toNumber",{enumerable:!0,get:function(){return v}}),Object.defineProperty(h,"toTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(h,"extent",{enumerable:!0,get:function(){return $}}),Object.defineProperty(h,"niceStep",{enumerable:!0,get:function(){return q}}),Object.defineProperty(h,"niceDomain",{enumerable:!0,get:function(){return et}}),Object.defineProperty(h,"measureDomain",{enumerable:!0,get:function(){return _}}),Object.defineProperty(h,"linearTicks",{enumerable:!0,get:function(){return F}}),Object.defineProperty(h,"timeStepFor",{enumerable:!0,get:function(){return A}}),Object.defineProperty(h,"timeTicks",{enumerable:!0,get:function(){return K}}),Object.defineProperty(h,"linearScale",{enumerable:!0,get:function(){return R}}),Object.defineProperty(h,"timeScale",{enumerable:!0,get:function(){return E}}),Object.defineProperty(h,"key",{enumerable:!0,get:function(){return X}}),Object.defineProperty(h,"bandScale",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(h,"sqrtScale",{enumerable:!0,get:function(){return it}});const xt=[1,2,2.5,5,10],dt=6e4,at=36e5,V=864e5,tt=365.25*V,D=[1,2,5,10,20,25,50,100],J=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,dt,5*dt,15*dt,30*dt,at,3*at,6*at,12*at,V,2*V,7*V,14*V,30*V,90*V,180*V,...D.map(y=>y*tt)];function l(y){return typeof y=="number"&&Number.isFinite(y)}function v(y){if(y==null||y==="")return null;if(y instanceof Date){const N=y.getTime();return Number.isFinite(N)?N:null}if(typeof y=="boolean")return y?1:0;const f=Number(y);return Number.isFinite(f)?f:null}function g(y){if(y==null||y==="")return null;if(y instanceof Date){const N=y.getTime();return Number.isFinite(N)?N:null}if(typeof y=="number")return Number.isFinite(y)?y:null;const f=Date.parse(String(y));return Number.isFinite(f)?f:null}function $(y){let f=1/0,N=-1/0;for(let Y=0;Y<y.length;Y++){const I=y[Y];l(I)&&(I<f&&(f=I),I>N&&(N=I))}return f===1/0?null:{min:f,max:N}}function q(y){if(!(y>0))return 1;const f=10**Math.floor(Math.log10(y));for(const N of xt)if(y<=N*f)return N*f;return 10*f}function et(y,f=5){const N=q((y.max-y.min)/Math.max(1,f));return{min:Math.floor(y.min/N)*N,max:Math.ceil(y.max/N)*N,step:N}}function _(y,f={}){const N=$(y)||{min:0,max:1};let{min:Y,max:I}=N;if(f.zero&&(Y>0&&(Y=0),I<0&&(I=0)),Y===I){const rt=Math.abs(Y)>0?Math.abs(Y)/10:1;Y-=rt,I+=rt}if(f.nice!==!1){const rt=et({min:Y,max:I},f.ticks||5);Y=rt.min,I=rt.max}return l(f.min)&&(Y=f.min),l(f.max)&&(I=f.max),Y===I&&(I=Y+1),{min:Y,max:I}}function F(y,f=5){const N=q((y.max-y.min)/Math.max(1,f)),Y=Math.ceil(y.min/N),I=Math.floor(y.max/N),rt=[];for(let j=Y;j<=I;j++){const H=j*N;rt.push(Math.abs(H)<N/1e6?0:Number(H.toPrecision(12)))}return rt}function A(y,f=5){const N=Math.max(1,f),Y=y/N;let I=J[J.length-1];for(const H of J)if(H>=Y){I=H;break}if(I<tt)return I;let rt=I,j=Math.abs(y/I-N);for(const H of J){if(H<tt)continue;const u=Math.abs(y/H-N);u<j&&(j=u,rt=H)}return rt}function ot(y,f){const N=new Date(y.min).getUTCFullYear();let Y=Math.ceil(N/f)*f;Date.UTC(Y,0,1)<y.min&&(Y+=f);const I=[];for(;Date.UTC(Y,0,1)<=y.max;Y+=f)I.push(Date.UTC(Y,0,1));return I}function K(y,f=5){const N=A(y.max-y.min,f);if(N>=tt)return ot(y,Math.round(N/tt));const Y=[],I=Math.ceil(y.min/N)*N;for(let rt=I;rt<=y.max;rt+=N)Y.push(rt);return Y}function R(y,f){const N=y.max-y.min||1,[Y,I]=f;return{kind:"linear",domain:y,range:f,of(rt){return Y+(rt-y.min)/N*(I-Y)},invert(rt){return y.min+(rt-Y)/(I-Y||1)*N},ticks(rt=5){return F(y,rt)}}}function E(y,f){return{...R(y,f),kind:"time",ticks(Y=5){return K(y,Y)}}}function X(y){if(y==null)return" null";if(y instanceof Date)return` date:${y.getTime()}`;if(typeof y=="object"){const f=y,N=f.id??f.key??f.value;return N!==void 0&&typeof N!="object"?` obj:${String(N)}`:` obj:${String(y)}`}return String(y)}function Q(y,f,N=.2){const Y=Math.min(.9,Math.max(0,N)),[I,rt]=f,j=new Map;for(let L=0;L<y.length;L++){const k=X(y[L]);j.has(k)||j.set(k,L)}const H=y.length?(rt-I)/y.length:rt-I,u=Math.max(0,H*(1-Y));return{kind:"band",domain:y,range:f,bandwidth:u,step:H,of(L){const k=j.get(X(L));return k===void 0?NaN:I+k*H+(H-u)/2},centre(L){const k=this.of(L);return Number.isNaN(k)?NaN:k+u/2},ticks(){return y}}}function it(y,f){const[N,Y]=f,I=Math.max(Math.abs(y.max),Math.abs(y.min),0)||1;return{kind:"sqrt",domain:y,range:f,of(rt){const j=Math.sqrt(Math.abs(rt)/I);return N+j*(Y-N)}}}}),Tt("packages/modules/gantt/links.js",function(h,pt){"use strict";Object.defineProperty(h,"LINK_SIDES",{enumerable:!0,get:function(){return V}}),Object.defineProperty(h,"linkSides",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(h,"routeLink",{enumerable:!0,get:function(){return D}}),Object.defineProperty(h,"arrowheadPath",{enumerable:!0,get:function(){return J}});const xt=pt("packages/modules/charts/svg.js"),dt=xt.path,at=xt.round,V=Object.freeze({FS:Object.freeze({depart:1,arrive:-1}),SS:Object.freeze({depart:-1,arrive:-1}),FF:Object.freeze({depart:1,arrive:1}),SF:Object.freeze({depart:-1,arrive:1})});function tt(l){return V[String(l||"FS").toUpperCase()]||V.FS}function D(l){const v=Number(l.sx),g=Number(l.sy),$=Number(l.ex),q=Number(l.ey),et=Number.isFinite(l.elbow)&&l.elbow>0?Number(l.elbow):8,_=Number.isFinite(l.rowGap)&&l.rowGap>0?Number(l.rowGap):et,F=tt(l.type),A=-F.arrive,ot=Math.abs(q-g)<.5,K=($-v)*A;if(ot&&K>0)return{d:dt(["M",at(v),at(g),"H",at($)]),arrowDir:A,route:"straight"};if(K>=0)return{d:dt(["M",at(v),at(g),"V",at(q),"H",at($)]),arrowDir:A,route:"drop"};const R=ot?g+_:(g+q)/2,E=v+F.depart*et,X=$+F.arrive*et;return{d:dt(["M",at(v),at(g),"H",at(E),"V",at(R),"H",at(X),"V",at(q),"H",at($)]),arrowDir:A,route:"detour"}}function J(l,v,g,$=4){return dt(["M",at(l),at(v),"L",at(l-g*$),at(v-$),"L",at(l-g*$),at(v+$),"Z"])}}),Tt("packages/modules/gantt/messages.js",function(h,pt){"use strict";Object.defineProperty(h,"FALLBACK_EN",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"createTranslator",{enumerable:!0,get:function(){return V}});const dt=pt("packages/core/src/internal/util.js").isFunction,at=Object.freeze({"gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d"});function V(tt,D){return function(l,v){const g=dt(D)?D():null,$=tt&&tt.grid,q=g&&dt(g.t)&&g||$&&$.messages&&dt($.messages.t)&&$.messages||null;if(q){let _;try{_=q.t(l,v)}catch{_=null}if(typeof _=="string"&&_&&_!==l)return _}const et=at[l];return et?et.replace(/\{(\w+)\}/g,(_,F)=>v&&F in v?String(v[F]):_):l}}}),Tt("packages/modules/gantt/gestures.js",function(h,pt){"use strict";Object.defineProperty(h,"describeTask",{enumerable:!0,get:function(){return at}}),Object.defineProperty(h,"GanttGestures",{enumerable:!0,get:function(){return V}});const dt=pt("packages/modules/charts/svg.js").round;function at(tt,D){const J=tt.isSummary?"summary":tt.isMilestone?"milestone":"task",l=D.dateAxis===!1?`day ${dt(tt.es)} to ${dt(tt.ef)}`:`${D.iso(tt.es)} to ${D.iso(tt.ef)}`,v=[`${tt.name}, ${J}`,l];return tt.isMilestone||v.push(`${dt(tt.duration)} days`),tt.percentComplete!=null&&v.push(`${Math.round(tt.percentComplete)}% complete`),v.push(`slack ${dt(tt.totalFloat)} days`),tt.critical&&v.push("on the critical path"),v.join(", ")}class V{#n;#r=null;#t=null;#e=null;constructor(D){this.#n=D}#o(){return this.#n.options()||{}}get dragging(){return this.#r!==null}#i(){const D=this.#n.plot();if(D&&typeof D.getScreenCTM=="function"){let l=null;try{l=D.getScreenCTM()}catch{l=null}if(l&&Number.isFinite(l.a)&&l.a>0)return{scale:l.a,origin:Number.isFinite(l.e)?l.e:0}}const J=D&&D.getBoundingClientRect?D.getBoundingClientRect():null;return{scale:1,origin:J&&J.left||0}}#u(D){const{scale:J,origin:l}=this.#i();return((D.clientX||0)-l)/J}#a(D){const{scale:J}=this.#i();return Math.round(D/J/(this.#n.pxPerDay()||1))}onPointerDown(D){const J=this.#n.controller.schedule;if(!J||!J.ok)return;const l=this.#n.rowOf(D.target);if(!l)return;const v=l.getAttribute("data-task"),g=J.tasks.get(v);if(!g||g.isSummary)return;const $=this.#n.barOf(l);if(!$)return;const q=this.#u(D),et=Number.isFinite(this.#o().resizeZone)?Number(this.#o().resizeZone):6,_=!g.isMilestone&&q>=this.#y($)-et?"resize":"move";this.#r={id:v,mode:_,startX:D.clientX||0,origStart:g.es,origDuration:g.duration,barEl:$},D.preventDefault&&D.preventDefault();const F=ot=>this.#s(ot),A=ot=>this.#N(ot);this.#t={move:F,up:A},this.#n.doc.addEventListener("pointermove",F),this.#n.doc.addEventListener("pointerup",A)}#y(D){const J=parseFloat(D.getAttribute("x")),l=parseFloat(D.getAttribute("width"));return Number.isFinite(J)&&Number.isFinite(l)?J+l:Number.POSITIVE_INFINITY}#s(D){if(!this.#r)return;const J=this.#n.pxPerDay()||1,l=this.#a((D.clientX||0)-this.#r.startX),v=this.#r.barEl;if(this.#r.mode==="move")v.getAttribute("d")?this.#x(v,l*J):(v.setAttribute("x",dt(parseFloat(v.getAttribute("x"))+l*J-this.#c(v))),this.#w(v,l*J));else{const g=Math.max(1,parseFloat(v.getAttribute("width"))+(l*J-this.#c(v)));v.setAttribute("width",dt(g)),this.#w(v,l*J)}}#c(D){return parseFloat(D.getAttribute("data-preview")||"0")}#w(D,J){D.setAttribute("data-preview",String(J))}#x(D,J){const l=this.#c(D),v=D.getAttribute("d").split(" ");for(let g=1;g<v.length;g+=1){const $=parseFloat(v[g]);!Number.isNaN($)&&g%3===1&&(v[g]=String(dt($+(J-l))))}D.setAttribute("d",v.join(" ")),this.#w(D,J)}#N(D){const J=this.#r;if(this.#g(),this.#r=null,!J)return;const l=this.#a((D.clientX||0)-J.startX);if(l===0){this.#n.redraw();return}J.mode==="move"?this.#n.controller.applyEdit({id:J.id,start:J.origStart+l},{writeBack:!0}):this.#n.controller.applyEdit({id:J.id,duration:Math.max(0,J.origDuration+l)},{writeBack:!0}),this.#n.redraw()}#g(){this.#t&&(this.#n.doc.removeEventListener("pointermove",this.#t.move),this.#n.doc.removeEventListener("pointerup",this.#t.up),this.#t=null)}onKey(D){const J=this.#n.controller,l=J.schedule;if(!l||!l.ok)return;const v=this.#n.rowOf(D.target),g=v?v.getAttribute("data-task"):null,$=g?l.tasks.get(g):null;if(!$)return;const q=this.#o(),et=Number.isFinite(q.moveStep)?Number(q.moveStep):1,_=D.key,F=this.#n.t;if(_==="ArrowRight"||_==="ArrowLeft"){if($.isSummary)return;const A=_==="ArrowRight"?1:-1;if(this.#n.focusTask(g),D.shiftKey){if($.isMilestone)return;const ot=Math.max(0,$.duration+A*et);J.applyEdit({id:g,duration:ot},{writeBack:!0}),this.#n.announce(F("gantt.a11y.resized",{name:$.name,days:ot}))}else{const ot=$.es+A*et,K=q.dateAxis===!1?F("gantt.a11y.day",{day:ot}):this.#n.iso(ot);J.applyEdit({id:g,start:ot},{writeBack:!0}),this.#n.announce(F("gantt.a11y.moved",{name:$.name,date:K}))}D.preventDefault&&D.preventDefault()}else if(_==="l"||_==="L"){if($.isSummary)return;if(!this.#e)this.#e=g,this.#n.announce(F("gantt.a11y.linkFrom",{name:$.name}));else if(this.#e!==g){const A=this.#e;this.#e=null,this.#n.focusTask(g),J.setDependencies([...J.dependencies,{from:A,to:g,type:"FS"}]),this.#n.announce(F("gantt.a11y.linked",{from:A,to:$.name}))}D.preventDefault&&D.preventDefault()}else if(_==="Delete"||_==="Backspace"){if($.isSummary)return;J.deleteTask(g),this.#n.announce(F("gantt.a11y.deleted",{name:$.name})),D.preventDefault&&D.preventDefault()}else _==="Escape"&&this.#e&&(this.#e=null,this.#n.announce(F("gantt.a11y.linkCancelled")))}destroy(){this.#g(),this.#r=null,this.#e=null}}}),Tt("packages/modules/gantt/render.js",function(h,pt){"use strict";Object.defineProperty(h,"NS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(h,"GanttView",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(h,"mountGantt",{enumerable:!0,get:function(){return wt}});const dt=pt("packages/core/src/internal/util.js").warnOnce,at=pt("packages/modules/shared/autosize.js"),V=at.contentWidth,tt=at.firstMeasured,D=at.watchSize,l=pt("packages/modules/shared/axislabels.js").thinLabels,v=pt("packages/modules/charts/svg.js"),g=v.svg,$=v.el,q=v.setText,et=v.path,_=v.round,A=pt("packages/modules/charts/scale.js").linearScale,ot=pt("packages/modules/gantt/time.js"),K=ot.toISODate,R=ot.fromDayNumber,E=ot.toDayNumber,X=ot.resolveProjectEpoch,Q=pt("packages/modules/gantt/links.js"),it=Q.routeLink,y=Q.arrowheadPath,N=pt("packages/modules/gantt/schedule.js").EPS,Y=pt("packages/modules/gantt/messages.js"),I=Y.createTranslator,rt=pt("packages/modules/gantt/gestures.js"),j=rt.GanttGestures,H=rt.describeTask;Object.defineProperty(h,"FALLBACK_EN",{enumerable:!0,get:function(){return Y.FALLBACK_EN}});const u="lat-gantt",L="data-lat-gantt-styles",k=720,U=Object.freeze({messages:null,width:"container",rowHeight:26,barPadding:4,labelWidth:160,axisHeight:22,rightPadding:16,rowLabels:!0,showArrows:!0,showCritical:!0,showProgress:!0,hoverChain:!0,dateAxis:!0,label:"name",today:null,nonWorking:null,editable:!0,resizeZone:6,zoom:null,projectEpoch:null,scrollToToday:!1,tooltip:!0,groupBy:null,keyboard:!0,moveStep:1}),o=11,B=Object.freeze({day:{px:28,step:1,level:"day"},week:{px:12,step:7,level:"week"},month:{px:4,step:30,level:"month"},quarter:{px:1.6,step:91,level:"quarter"}});function W(){return`
8
8
  .${u}{font:12px/1.4 system-ui,sans-serif;color:var(--lattice-foreground,#1f2933);overflow:auto}
9
9
  .${u}__plot{max-width:100%;height:auto;display:block}