@toclocoinc/lattice-grid 1.122.0 → 1.122.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +5 -5
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.html +1 -1
- package/docs/api/calendar.html +1 -1
- package/docs/api/charts.html +1 -1
- package/docs/api/dashboard.html +1 -1
- package/docs/api/data-router.html +1 -1
- package/docs/api/dataview.html +1 -1
- package/docs/api/deckgl.html +1 -1
- package/docs/api/designer.html +1 -1
- package/docs/api/form.html +1 -1
- package/docs/api/gantt.html +2 -2
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +1 -1
- package/docs/api/kanban.html +1 -1
- package/docs/api/kpi.html +1 -1
- package/docs/api/layout.html +1 -1
- package/docs/api/leaflet.html +1 -1
- package/docs/api/list.html +1 -1
- package/docs/api/listview.html +1 -1
- package/docs/api/mapview.html +1 -1
- package/docs/api/mock-socket.html +1 -1
- package/docs/api/pdf.html +1 -1
- package/docs/api/presets.html +1 -1
- package/docs/api/scheduler.html +1 -1
- package/docs/api/shell.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/tree.html +1 -1
- package/docs/api/types.html +1 -1
- package/docs/api-detail.html +5 -5
- package/docs/warnings.json +1 -1
- package/lattice-grid.d.ts +1 -1
- package/lattice-grid.esm.min.js +2 -2
- package/lattice-grid.min.cjs +2 -2
- package/lattice-grid.min.js +2 -2
- package/locales/all.d.ts +1 -1
- package/locales/all.esm.min.js +1 -1
- package/locales/all.min.cjs +1 -1
- package/locales/all.min.js +1 -1
- package/locales/ar.d.ts +1 -1
- package/locales/ar.esm.min.js +1 -1
- package/locales/ar.min.cjs +1 -1
- package/locales/ar.min.js +1 -1
- package/locales/cs-CZ.d.ts +1 -1
- package/locales/cs-CZ.esm.min.js +1 -1
- package/locales/cs-CZ.min.cjs +1 -1
- package/locales/cs-CZ.min.js +1 -1
- package/locales/da-DK.d.ts +1 -1
- package/locales/da-DK.esm.min.js +1 -1
- package/locales/da-DK.min.cjs +1 -1
- package/locales/da-DK.min.js +1 -1
- package/locales/de-DE.d.ts +1 -1
- package/locales/de-DE.esm.min.js +1 -1
- package/locales/de-DE.min.cjs +1 -1
- package/locales/de-DE.min.js +1 -1
- package/locales/el-GR.d.ts +1 -1
- package/locales/el-GR.esm.min.js +1 -1
- package/locales/el-GR.min.cjs +1 -1
- package/locales/el-GR.min.js +1 -1
- package/locales/en-US.d.ts +1 -1
- package/locales/en-US.esm.min.js +1 -1
- package/locales/en-US.min.cjs +1 -1
- package/locales/en-US.min.js +1 -1
- package/locales/es-ES.d.ts +1 -1
- package/locales/es-ES.esm.min.js +1 -1
- package/locales/es-ES.min.cjs +1 -1
- package/locales/es-ES.min.js +1 -1
- package/locales/fi-FI.d.ts +1 -1
- package/locales/fi-FI.esm.min.js +1 -1
- package/locales/fi-FI.min.cjs +1 -1
- package/locales/fi-FI.min.js +1 -1
- package/locales/fr-CA.d.ts +1 -1
- package/locales/fr-CA.esm.min.js +1 -1
- package/locales/fr-CA.min.cjs +1 -1
- package/locales/fr-CA.min.js +1 -1
- package/locales/fr-FR.d.ts +1 -1
- package/locales/fr-FR.esm.min.js +1 -1
- package/locales/fr-FR.min.cjs +1 -1
- package/locales/fr-FR.min.js +1 -1
- package/locales/hu-HU.d.ts +1 -1
- package/locales/hu-HU.esm.min.js +1 -1
- package/locales/hu-HU.min.cjs +1 -1
- package/locales/hu-HU.min.js +1 -1
- package/locales/it-IT.d.ts +1 -1
- package/locales/it-IT.esm.min.js +1 -1
- package/locales/it-IT.min.cjs +1 -1
- package/locales/it-IT.min.js +1 -1
- package/locales/ja-JP.d.ts +1 -1
- package/locales/ja-JP.esm.min.js +1 -1
- package/locales/ja-JP.min.cjs +1 -1
- package/locales/ja-JP.min.js +1 -1
- package/locales/nb-NO.d.ts +1 -1
- package/locales/nb-NO.esm.min.js +1 -1
- package/locales/nb-NO.min.cjs +1 -1
- package/locales/nb-NO.min.js +1 -1
- package/locales/nl-NL.d.ts +1 -1
- package/locales/nl-NL.esm.min.js +1 -1
- package/locales/nl-NL.min.cjs +1 -1
- package/locales/nl-NL.min.js +1 -1
- package/locales/pl-PL.d.ts +1 -1
- package/locales/pl-PL.esm.min.js +1 -1
- package/locales/pl-PL.min.cjs +1 -1
- package/locales/pl-PL.min.js +1 -1
- package/locales/pt-BR.d.ts +1 -1
- package/locales/pt-BR.esm.min.js +1 -1
- package/locales/pt-BR.min.cjs +1 -1
- package/locales/pt-BR.min.js +1 -1
- package/locales/ro-RO.d.ts +1 -1
- package/locales/ro-RO.esm.min.js +1 -1
- package/locales/ro-RO.min.cjs +1 -1
- package/locales/ro-RO.min.js +1 -1
- package/locales/sv-SE.d.ts +1 -1
- package/locales/sv-SE.esm.min.js +1 -1
- package/locales/sv-SE.min.cjs +1 -1
- package/locales/sv-SE.min.js +1 -1
- package/locales/uk-UA.d.ts +1 -1
- package/locales/uk-UA.esm.min.js +1 -1
- package/locales/uk-UA.min.cjs +1 -1
- package/locales/uk-UA.min.js +1 -1
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +1 -1
- package/modules/ai.min.cjs +1 -1
- package/modules/ai.min.js +1 -1
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +1 -1
- package/modules/alarms.min.cjs +1 -1
- package/modules/alarms.min.js +1 -1
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +1 -1
- package/modules/angular.min.cjs +1 -1
- package/modules/angular.min.js +1 -1
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +1 -1
- package/modules/calendar.min.cjs +1 -1
- package/modules/calendar.min.js +1 -1
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-barrace.d.ts +1 -1
- package/modules/chart-barrace.esm.min.js +1 -1
- package/modules/chart-barrace.min.cjs +1 -1
- package/modules/chart-barrace.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bubblemap.min.cjs +1 -1
- package/modules/chart-bubblemap.min.js +1 -1
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-choropleth.d.ts +1 -1
- package/modules/chart-choropleth.esm.min.js +1 -1
- package/modules/chart-choropleth.min.cjs +1 -1
- package/modules/chart-choropleth.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-forcetree.d.ts +1 -1
- package/modules/chart-forcetree.esm.min.js +1 -1
- package/modules/chart-forcetree.min.cjs +1 -1
- package/modules/chart-forcetree.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-motion.d.ts +1 -1
- package/modules/chart-motion.esm.min.js +1 -1
- package/modules/chart-motion.min.cjs +1 -1
- package/modules/chart-motion.min.js +1 -1
- package/modules/chart-pack.d.ts +1 -1
- package/modules/chart-pack.esm.min.js +1 -1
- package/modules/chart-pack.min.cjs +1 -1
- package/modules/chart-pack.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-pictorial.d.ts +1 -1
- package/modules/chart-pictorial.esm.min.js +1 -1
- package/modules/chart-pictorial.min.cjs +1 -1
- package/modules/chart-pictorial.min.js +1 -1
- package/modules/chart-polararea.d.ts +1 -1
- package/modules/chart-polararea.esm.min.js +1 -1
- package/modules/chart-polararea.min.cjs +1 -1
- package/modules/chart-polararea.min.js +1 -1
- package/modules/chart-polarscatter.d.ts +1 -1
- package/modules/chart-polarscatter.esm.min.js +1 -1
- package/modules/chart-polarscatter.min.cjs +1 -1
- package/modules/chart-polarscatter.min.js +1 -1
- package/modules/chart-pyramid.d.ts +1 -1
- package/modules/chart-pyramid.esm.min.js +1 -1
- package/modules/chart-pyramid.min.cjs +1 -1
- package/modules/chart-pyramid.min.js +1 -1
- package/modules/chart-radialbar.d.ts +1 -1
- package/modules/chart-radialbar.esm.min.js +1 -1
- package/modules/chart-radialbar.min.cjs +1 -1
- package/modules/chart-radialbar.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-scatter3d.d.ts +1 -1
- package/modules/chart-scatter3d.esm.min.js +1 -1
- package/modules/chart-scatter3d.min.cjs +1 -1
- package/modules/chart-scatter3d.min.js +1 -1
- package/modules/chart-serpentine.d.ts +1 -1
- package/modules/chart-serpentine.esm.min.js +1 -1
- package/modules/chart-serpentine.min.cjs +1 -1
- package/modules/chart-serpentine.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-spiral.d.ts +1 -1
- package/modules/chart-spiral.esm.min.js +1 -1
- package/modules/chart-spiral.min.cjs +1 -1
- package/modules/chart-spiral.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-tree.d.ts +1 -1
- package/modules/chart-tree.esm.min.js +1 -1
- package/modules/chart-tree.min.cjs +1 -1
- package/modules/chart-tree.min.js +1 -1
- package/modules/chart-venn.d.ts +1 -1
- package/modules/chart-venn.esm.min.js +1 -1
- package/modules/chart-venn.min.cjs +1 -1
- package/modules/chart-venn.min.js +1 -1
- package/modules/chart-voronoi.d.ts +1 -1
- package/modules/chart-voronoi.esm.min.js +1 -1
- package/modules/chart-voronoi.min.cjs +1 -1
- package/modules/chart-voronoi.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- package/modules/chart-wordcloud.d.ts +1 -1
- package/modules/chart-wordcloud.esm.min.js +1 -1
- package/modules/chart-wordcloud.min.cjs +1 -1
- package/modules/chart-wordcloud.min.js +1 -1
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +1 -1
- package/modules/charts.min.cjs +1 -1
- package/modules/charts.min.js +1 -1
- package/modules/contextmenu.d.ts +1 -1
- package/modules/contextmenu.esm.min.js +1 -1
- package/modules/contextmenu.min.cjs +1 -1
- package/modules/contextmenu.min.js +1 -1
- package/modules/dashboard.d.ts +1 -1
- package/modules/dashboard.esm.min.js +1 -1
- package/modules/dashboard.min.cjs +1 -1
- package/modules/dashboard.min.js +1 -1
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +1 -1
- package/modules/data-router.min.cjs +1 -1
- package/modules/data-router.min.js +1 -1
- package/modules/dataview.d.ts +1 -1
- package/modules/dataview.esm.min.js +1 -1
- package/modules/dataview.min.cjs +1 -1
- package/modules/dataview.min.js +1 -1
- package/modules/deckgl.d.ts +1 -1
- package/modules/deckgl.esm.min.js +1 -1
- package/modules/deckgl.min.cjs +1 -1
- package/modules/deckgl.min.js +1 -1
- package/modules/designer.d.ts +1 -1
- package/modules/designer.esm.min.js +1 -1
- package/modules/designer.min.cjs +1 -1
- package/modules/designer.min.js +1 -1
- package/modules/devtools.d.ts +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/devtools.min.cjs +1 -1
- package/modules/devtools.min.js +1 -1
- package/modules/dhtmlx-compat.d.ts +1 -1
- package/modules/dhtmlx-compat.esm.min.js +1 -1
- package/modules/dhtmlx-compat.min.cjs +1 -1
- package/modules/dhtmlx-compat.min.js +1 -1
- package/modules/form.d.ts +1 -1
- package/modules/form.esm.min.js +1 -1
- package/modules/form.min.cjs +1 -1
- package/modules/form.min.js +1 -1
- package/modules/gantt.d.ts +2 -2
- package/modules/gantt.esm.min.js +165 -156
- package/modules/gantt.esm.min.js.map +2 -2
- package/modules/gantt.min.cjs +165 -156
- package/modules/gantt.min.js +165 -156
- package/modules/gantt.min.js.map +2 -2
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-europe-nuts.min.cjs +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/geometry.d.ts +1 -1
- package/modules/geometry.esm.min.js +1 -1
- package/modules/geometry.min.cjs +1 -1
- package/modules/geometry.min.js +1 -1
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +2 -2
- package/modules/htmx.min.cjs +2 -2
- package/modules/htmx.min.js +2 -2
- package/modules/htmx.shared.esm.min.js +1 -1
- package/modules/htmx.shared.min.cjs +1 -1
- package/modules/htmx.shared.min.js +1 -1
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +1 -1
- package/modules/kanban.min.cjs +1 -1
- package/modules/kanban.min.js +1 -1
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +1 -1
- package/modules/kpi.min.cjs +1 -1
- package/modules/kpi.min.js +1 -1
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +1 -1
- package/modules/layout.min.cjs +1 -1
- package/modules/layout.min.js +1 -1
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +1 -1
- package/modules/leaflet.min.cjs +1 -1
- package/modules/leaflet.min.js +1 -1
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +1 -1
- package/modules/list.min.cjs +1 -1
- package/modules/list.min.js +1 -1
- package/modules/listview.d.ts +1 -1
- package/modules/listview.esm.min.js +1 -1
- package/modules/listview.min.cjs +1 -1
- package/modules/listview.min.js +1 -1
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +1 -1
- package/modules/mapview.min.cjs +1 -1
- package/modules/mapview.min.js +1 -1
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/pdf.d.ts +1 -1
- package/modules/pdf.esm.min.js +1 -1
- package/modules/pdf.min.cjs +1 -1
- package/modules/pdf.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +1 -1
- package/modules/presets.min.cjs +1 -1
- package/modules/presets.min.js +1 -1
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +1 -1
- package/modules/react.min.cjs +1 -1
- package/modules/react.min.js +1 -1
- package/modules/recordeditor.d.ts +1 -1
- package/modules/recordeditor.esm.min.js +1 -1
- package/modules/recordeditor.min.cjs +1 -1
- package/modules/recordeditor.min.js +1 -1
- package/modules/scheduler.d.ts +1 -1
- package/modules/scheduler.esm.min.js +7 -7
- package/modules/scheduler.esm.min.js.map +2 -2
- package/modules/scheduler.min.cjs +7 -7
- package/modules/scheduler.min.js +7 -7
- package/modules/scheduler.min.js.map +2 -2
- package/modules/shell.d.ts +1 -1
- package/modules/shell.esm.min.js +1 -1
- package/modules/shell.min.cjs +1 -1
- package/modules/shell.min.js +1 -1
- package/modules/sidebar.d.ts +1 -1
- package/modules/sidebar.esm.min.js +1 -1
- package/modules/sidebar.min.cjs +1 -1
- package/modules/sidebar.min.js +1 -1
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +1 -1
- package/modules/svelte.min.cjs +1 -1
- package/modules/svelte.min.js +1 -1
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +1 -1
- package/modules/tabs.min.cjs +1 -1
- package/modules/tabs.min.js +1 -1
- package/modules/toolbar.d.ts +1 -1
- package/modules/toolbar.esm.min.js +1 -1
- package/modules/toolbar.min.cjs +1 -1
- package/modules/toolbar.min.js +1 -1
- package/modules/tree.d.ts +1 -1
- package/modules/tree.esm.min.js +1 -1
- package/modules/tree.min.cjs +1 -1
- package/modules/tree.min.js +1 -1
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +1 -1
- package/modules/vue.min.cjs +1 -1
- package/modules/vue.min.js +1 -1
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +2 -2
- package/modules/webcomponent.min.cjs +2 -2
- package/modules/webcomponent.min.js +2 -2
- package/package.json +1 -1
package/modules/gantt.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.122.
|
|
2
|
+
* Lattice Grid 1.122.1, gantt module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
|
-
(function(ur){"use strict";var gr=!0,rr=Object.create(null),sr=Object.create(null);function ae(g,V){rr[g]=V}function or(g){var V=sr[g];if(V)return V;var St=Object.create(null);sr[g]=St;var U=rr[g];if(!U)throw new Error("[lattice] missing module: "+g);return U(St,or),St}ae("packages/core/src/internal/warn.js",function(g,V){"use strict";Object.defineProperty(g,"reportedWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"warnOnce",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"infoOnce",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"resetWarnings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"fail",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"invariant",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"DEV",{enumerable:!0,get:function(){return S}});const St=new Set,U=2e3;function K(_){if(St.add(_),St.size>U){const C=St.values().next().value;C!==void 0&&St.delete(C)}}const Y=[],H=500;function l(_,C,a){Y.push({key:_,level:C,message:a.map(o=>typeof o=="string"?o:L(o)).join(" "),at:Date.now()}),Y.length>H&&Y.shift()}function L(_){if(_ instanceof Error)return _.message;try{return JSON.stringify(_)}catch{return String(_)}}function v(){return Y.map(_=>({..._}))}function m(_){if(_.length===0||typeof _[0]!="string")return _;const C=_[0].replace(/^\[lattice\]\s*/,"");return C===_[0]?_:[C,..._.slice(1)]}function w(_,...C){if(St.has(_))return;K(_);const a=m(C);l(_,"warn",a),console.warn("[lattice]",...a)}function k(_,...C){if(St.has(_))return;K(_);const a=m(C);l(_,"info",a),console.info("[lattice]",...a)}function u(){St.clear(),Y.length=0}function f(_,C){const a=new Error(`[lattice] ${_}`);throw C!==void 0&&(a.cause=C),a}function d(_,C){_||f(C)}const S=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),ae("packages/core/src/internal/predicates.js",function(g,V){"use strict";Object.defineProperty(g,"isObject",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"isFunction",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"isNil",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"isBlank",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"isCtor",{enumerable:!0,get:function(){return H}});function St(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)}function U(l){return typeof l=="function"}function K(l){return l==null}function Y(l){return l==null||l===""}function H(l){return typeof l!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(l))?!0:!!(l.prototype&&Object.getOwnPropertyNames(l.prototype).length>1)}}),ae("packages/modules/shared/emitter.js",function(g,V){"use strict";Object.defineProperty(g,"WILDCARD",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"Emitter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"gate",{enumerable:!0,get:function(){return m}});const U=V("packages/core/src/internal/predicates.js").isFunction,Y=V("packages/core/src/internal/warn.js").warnOnce,H="*",l=new Set(["api","user","init","ai"]);function L(w,k){return w&&w.name?w.name:`#${k}`}class v{#t=new Map;#i;constructor(k="module"){this.#i=String(k)}on(k,u){if(!U(u))return()=>{};let f=this.#t.get(k);return f||(f=new Set,this.#t.set(k,f)),f.add(u),()=>this.off(k,u)}off(k,u){const f=this.#t.get(k);f&&f.delete(u)}count(k){const u=this.#t.get(k);return u?u.size:0}emit(k,u){const f=this.#t.get(k),d=this.#t.get(H);if((!f||f.size===0)&&(!d||d.size===0))return;const S={...u||null,type:k};f&&f.size&&this.#e([...f],S,k),d&&d.size&&this.#e([...d],S,H)}#e(k,u,f){for(let d=0;d<k.length;d++)try{k[d](u)}catch(S){Y(`${this.#i}.emit.throw:${f}:${L(k[d],d)}`,`${this.#i}: a '${f}' handler threw; other handlers were unaffected.`,S)}}emitBefore(k,u,f){const d=f??(u&&u.origin),S=l.has(d)?d:"user";let _=!1,C=null;const a=i=>{_=!0,i!=null&&C===null&&(C=String(i))},o={...u||null,type:k,origin:S,get defaultPrevented(){return _},get reason(){return C},preventDefault(i){a(i)}},p=this.#t.get(k);if(!p||p.size===0)return!0;const $=[...p],h=()=>(_&&C===null&&(C="prevented"),_&&u&&typeof u=="object"&&(u.reason=C),!_),y=[];for(let i=0;i<$.length;i++){const r=$[i];try{const b=r(o);b&&U(b.then)?y.push(b):b===!1&&a("prevented")}catch(b){a("error"),Y(`${this.#i}.beforeThrow:${k}:${L(r,i)}`,`${this.#i}: a '${k}' before-handler threw; the action was cancelled.`,b)}}return y.length===0?h():Promise.allSettled(y).then(i=>{for(const r of i)r.status==="rejected"?(a("error"),Y(`${this.#i}.beforeReject:${k}`,`${this.#i}: a '${k}' before-handler rejected; the action was cancelled.`,r.reason)):r.value===!1&&a("prevented");return h()})}clear(){this.#t.clear()}}function m(w,k,u,f,d){const S=w.emitBefore(k,f,f.origin),_=()=>(w.emit(u,{...f,reason:f.reason||"prevented"}),!1);return S===!1?_():S&&U(S.then)?S.then(C=>C?d():_()):d()}}),ae("packages/core/src/internal/schedule.js",function(g,V){"use strict";Object.defineProperty(g,"now",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"nextFrame",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"cancelFrame",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"frameBatched",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"settleDebounce",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"whenIdle",{enumerable:!0,get:function(){return L}});function St(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function U(){return typeof requestAnimationFrame=="function"}function K(v){return U()?requestAnimationFrame(v):setTimeout(()=>v(St()),16)}function Y(v){v!=null&&(U()?cancelAnimationFrame(v):clearTimeout(v))}function H(v){let m=null,w=null;const k=()=>{m=null;const f=w;w=null,v(...f||[])},u=(...f)=>{w=f,m===null&&(m=K(k))};return u.cancel=()=>{Y(m),m=null,w=null},u.flush=()=>{m!==null&&(Y(m),k())},u}function l(v,m){let w=null,k=null;const u=()=>{if(w=null,k===null)return;const S=k;k=null,v(...S),f()},f=()=>{w=setTimeout(u,m),typeof w?.unref=="function"&&w.unref()},d=(...S)=>{w===null?(v(...S),f()):(k=S,clearTimeout(w),f())};return d.flush=()=>{if(w!==null&&clearTimeout(w),w=null,k===null)return;const S=k;k=null,v(...S)},d.cancel=()=>{w!==null&&clearTimeout(w),w=null,k=null},d.pending=()=>w!==null||k!==null,d}function L(v,m=50){return typeof requestIdleCallback=="function"?requestIdleCallback(v,{timeout:m}):setTimeout(()=>v({timeRemaining:()=>0,didTimeout:!0}),1)}}),ae("packages/core/src/model/history.js",function(g,V){"use strict";Object.defineProperty(g,"DEFAULT_HISTORY_DEPTH",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"DEFAULT_COALESCE_MS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"HISTORY_TYPES",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"COALESCING_TYPES",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"HISTORY_LABELS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"diffSlices",{enumerable:!0,get:function(){return C}}),Object.defineProperty(g,"HistoryModel",{enumerable:!0,get:function(){return a}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/core/src/internal/predicates.js"),Y=K.isFunction,H=K.isObject,L=V("packages/core/src/internal/schedule.js").now,v=10,m=400,w=["sort","filter","group","pivot","column:move","column:resize","column:visible","column:pin","column:decorate","page","edit","transaction"],k=new Set(["column:resize","column:move"]),u={sort:"sort",filter:"filter",group:"grouping",pivot:"pivot",formatting:"conditional formatting","column:move":"column move","column:resize":"column resize","column:visible":"column visibility","column:pin":"column pin","column:decorate":"column decoration",page:"page change",edit:"edit",transaction:"change"};function f(o){if(o===null||typeof o!="object")return o;try{return structuredClone(o)}catch{try{return JSON.parse(JSON.stringify(o))}catch{return o}}}function d(o,p){if(o===p)return!0;if(o===null||p===null||typeof o!="object"||typeof p!="object")return o!==o&&p!==p;if(o instanceof Date||p instanceof Date)return o instanceof Date&&p instanceof Date&&o.getTime()===p.getTime();if(Array.isArray(o)||Array.isArray(p))return!Array.isArray(o)||!Array.isArray(p)||o.length!==p.length?!1:o.every((y,i)=>d(y,p[i]));const $=Object.keys(o),h=Object.keys(p);return $.length!==h.length?!1:$.every(y=>Object.prototype.hasOwnProperty.call(p,y)&&d(o[y],p[y]))}function S(o,p){const $=new Map;for(const r of p)H(r)&&typeof r.id=="string"&&$.set(r.id,r);const h=new Set,y=[],i=[];for(const r of o){if(!H(r)||typeof r.id!="string")continue;h.add(r.id);const b=$.get(r.id);if(!b){y.push({...r});continue}const T=new Set([...Object.keys(r),...Object.keys(b)]);T.delete("id");const j={id:r.id},I={id:r.id};let O=!1;for(const z of T)d(r[z],b[z])||(O=!0,z in r&&(j[z]=r[z]),z in b&&(I[z]=b[z]));O&&(y.push(j),i.push(I))}for(const r of p)!H(r)||typeof r.id!="string"||h.has(r.id)||i.push({...r});return y.length===0&&i.length===0?null:{before:y,after:i}}function _(o){if(typeof o=="string")return"";if(Array.isArray(o))return[]}function C(o,p){const $=H(o)?o:null,h=H(p)?p:null;if(!$&&!h)return null;if(!$||!h)return{before:$?{...$}:null,after:h?{...h}:null};const y={},i={};let r=!1;const b=new Set([...Object.keys($),...Object.keys(h)]);b.delete("version");for(const T of b){if(T==="columns"&&Array.isArray($.columns)&&Array.isArray(h.columns)){const O=S($.columns,h.columns);if(!O)continue;y.columns=O.before,i.columns=O.after,r=!0;continue}if(d($[T],h[T]))continue;r=!0;const j=T in $,I=T in h;j?y[T]=$[T]:_(h[T])!==void 0&&(y[T]=_(h[T])),I?i[T]=h[T]:_($[T])!==void 0&&(i[T]=_($[T]))}return r?(y.columns&&Array.isArray($.columnOrder)&&(y.columnOrder=$.columnOrder),i.columns&&Array.isArray(h.columnOrder)&&(i.columnOrder=h.columnOrder),$.version!==void 0&&(y.version=$.version),h.version!==void 0&&(i.version=h.version),{before:y,after:i}):null}class a{#t=[];#i=[];#e=v;#n=m;#s=null;#o=null;#l=null;#d=L;#g=!1;#p=0;#h=0;constructor(p={}){p.apply&&(this.#s=p.apply),p.capture&&(this.#o=p.capture),p.edit&&(this.#l=p.edit),Y(p.now)&&(this.#d=p.now),this.configure(p)}configure(p={}){typeof p.depth=="number"&&p.depth>=0&&(this.#e=Math.floor(p.depth),this.#c()),typeof p.coalesceMs=="number"&&p.coalesceMs>=0&&(this.#n=p.coalesceMs)}get depth(){return this.#e}set depth(p){this.configure({depth:p})}get coalesceMs(){return this.#n}set coalesceMs(p){this.configure({coalesceMs:p})}get size(){return this.#t.length}get redoSize(){return this.#i.length}get replaying(){return this.#g}canUndo(){return this.#t.length>0}canRedo(){return this.#i.length>0}push(p){if(this.#g||this.#p>0||this.#e===0||!H(p)||typeof p.type!="string"||!p.type)return null;const $=p.type,h=$==="edit";let y=null,i=null;if(!h){const T=C(f(p.before??null),f(p.after??null));if(!T)return null;y=T.before,i=T.after}const r={seq:++this.#h,type:$,label:typeof p.label=="string"&&p.label?p.label:u[$]||$,target:p.target==null?null:String(p.target),before:y,after:i,at:typeof p.at=="number"?p.at:this.#d(),delegated:h,mergeable:h?!1:p.coalesce===void 0?k.has($):!!p.coalesce};this.#i.length=0;const b=this.#a(r);return b!==void 0?b:(this.#t.push(r),this.#c(),r)}recordEdit(p,$={}){return this.push({type:"edit",label:p,target:$.target,at:$.at})}transaction(p,$,h={}){if(!Y($))return null;if(this.#g||this.#p>0){this.#p++;try{$()}finally{this.#p--}return null}const y=h.type||"transaction",i=h.type?y:void 0,r=this.#f(i,h.target);this.#p++;try{$()}finally{this.#p--}const b=this.#f(i,h.target);return this.push({type:y,label:p,target:h.target,before:r,after:b,coalesce:h.coalesce===void 0?!1:h.coalesce})}#a(p){if(!p.mergeable)return;const $=this.#t[this.#t.length-1];if(!$||!$.mergeable||$.delegated||$.type!==p.type||$.target!==p.target||p.at-$.at>this.#n)return;const h=C($.before,p.after);return h?($.before=h.before,$.after=h.after,$.at=p.at,$.label=p.label,$):(this.#t.pop(),null)}get busy(){return this.#g||this.#p>0}capture(p,$){return this.#f(p,$)}#f(p,$){if(!this.#o)return null;try{return f(this.#o(p,$??null))}catch(h){return U("history.capture.throw","history capture threw; the action was not recorded.",h),null}}#c(){for(;this.#t.length>this.#e;)this.#t.shift();for(;this.#i.length>this.#e;)this.#i.shift()}undo(){return this.#b("undo")}redo(){return this.#b("redo")}#b(p){if(this.#g)return null;const $=p==="undo"?this.#t:this.#i,h=p==="undo"?this.#i:this.#t;this.#g=!0;try{for(;$.length;){const y=$[$.length-1],i=this.#y(y,p);if(y.delegated){if(!this.#r(p)){$.pop();continue}}else i.patch&&this.#m(i.patch,i);return $.pop(),h.push(y),this.#c(),i}return null}finally{this.#g=!1}}#r(p){const $=this.#l;if(!$||!Y($[p]))return!1;try{return $[p]({origin:"history"})!=null}catch(h){return U("history.edit.throw",`edit ${p} threw; the entry was dropped.`,h),!1}}#m(p,$){if(this.#s)try{this.#s(p,$)}catch(h){U("history.apply.throw",`applying the ${$.direction} of '${$.label}' threw.`,h)}}#y(p,$){return{direction:$,seq:p.seq,type:p.type,label:p.label,target:p.target,at:p.at,delegated:p.delegated,patch:p.delegated?null:f($==="undo"?p.before:p.after)}}peek(p="undo"){const $=p==="redo"?this.#i:this.#t,h=$[$.length-1];return h?{seq:h.seq,type:h.type,label:h.label,target:h.target,at:h.at,delegated:h.delegated}:null}list(){const p=($,h)=>({seq:$.seq,type:$.type,label:$.label,target:$.target,at:$.at,delegated:$.delegated,undone:h});return[...this.#i.map($=>p($,!0)),...[...this.#t].reverse().map($=>p($,!1))]}clear(){this.#t.length=0,this.#i.length=0}destroy(){this.clear(),this.#l=null}}}),ae("packages/modules/gantt/time.js",function(g,V){"use strict";Object.defineProperty(g,"toDayNumber",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"fromDayNumber",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"toISODate",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"resolveProjectEpoch",{enumerable:!0,get:function(){return L}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=864e5;function Y(v){if(v==null||v==="")return null;if(typeof v=="number")return Number.isFinite(v)?v:null;if(v instanceof Date)return Number.isFinite(v.getTime())?Math.floor(Date.UTC(v.getFullYear(),v.getMonth(),v.getDate())/K):null;const m=Date.parse(v);return Number.isFinite(m)?Math.floor(m/K):null}function H(v){return Number.isFinite(v)?new Date(Math.round(v)*K):null}function l(v){const m=H(v);return m?m.toISOString().slice(0,10):null}function L(v){if(v==null||v==="")return 0;const m=Y(v);return Number.isFinite(m)?m:(U(`gantt.projectEpoch:${String(v)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(v)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),ae("packages/modules/gantt/calendar.js",function(g,V){"use strict";Object.defineProperty(g,"createCalendar",{enumerable:!0,get:function(){return Y}});const U=V("packages/modules/gantt/time.js").toDayNumber,K=Object.freeze([1,2,3,4,5]);function Y(H,l=0){if(H==null)return null;let L,v;H==="weekends"?(L=K,v=new Set):(L=Array.isArray(H.workdays)&&H.workdays.length?H.workdays.map(Number).filter(a=>a>=0&&a<=6):K,v=new Set((Array.isArray(H.holidays)?H.holidays:[]).map(a=>U(a)).filter(a=>a!=null)));const m=new Set(L);if(m.size===7&&v.size===0||m.size===0)return null;const w=a=>{let o=(a%7+4)%7;return o<0&&(o+=7),o},k=a=>{if(!Number.isFinite(a))return!1;const o=Math.round(a);return m.has(w(o))&&!v.has(o)},u=a=>{let o=a;for(;!k(o);)o+=1;return o},f=u(Math.round(Number.isFinite(l)?l:0)),d=m.size,S=(a,o)=>{if(o<a)return 0;const p=o-a+1,$=Math.floor(p/7);let h=$*d;const y=w(a);for(let i=$*7;i<p;i+=1)m.has((y+i)%7)&&(h+=1);for(const i of v)i>=a&&i<=o&&m.has(w(i))&&(h-=1);return h};return{isWorking:k,nextWorking:u,dayOf:a=>{const o=Math.round(a);if(o===0)return f;if(o>0){const r=Math.floor(o/d);let b=f+r*7,T=o-r*d;for(;T>0;)b+=1,m.has(w(b))&&(T-=1);let j=0;for(const I of v)I>f&&I<=b&&m.has(w(I))&&(j+=1);for(;j>0;)b+=1,k(b)&&(j-=1);for(;!k(b);)b+=1;return b}const p=-o,$=Math.floor(p/d);let h=f-$*7,y=p-$*d;for(;y>0;)h-=1,m.has(w(h))&&(y-=1);let i=0;for(const r of v)r>=h&&r<f&&m.has(w(r))&&(i+=1);for(;i>0;)h-=1,k(h)&&(i-=1);for(;!k(h);)h-=1;return h},indexOf:a=>{const o=u(Math.round(a));return o>=f?S(f,o)-1:-(S(o,f)-1)},anchor:f}}}),ae("packages/modules/gantt/task-calendars.js",function(g,V){"use strict";Object.defineProperty(g,"PLAN_CALENDAR_ID",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"parseHolidayDays",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"planWorkingTime",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"normalizeCalendarSpec",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"resolveCalendars",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"PLAIN_TIME",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"createTimeModel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"workingRuns",{enumerable:!0,get:function(){return d}});const U=V("packages/modules/gantt/calendar.js").createCalendar,Y=V("packages/modules/gantt/time.js").toDayNumber,H="plan",l=Object.freeze([0,1,2,3,4,5,6]),L=Object.freeze([1,2,3,4,5]);function v(S){const _=new Set;for(const C of Array.isArray(S)?S:[]){if(C&&typeof C=="object"&&!(C instanceof Date)&&("from"in C||"to"in C)){const o=Y(C.from),p=Y(C.to??C.from);if(o==null)continue;const $=p??o;for(let h=Math.min(o,$);h<=Math.max(o,$);h+=1)_.add(h);continue}const a=Y(C);a!=null&&_.add(a)}return[..._].sort((C,a)=>C-a)}function m(S){return S==null?{workdays:[...l],holidays:[],hoursPerDay:null}:S==="weekends"?{workdays:[...L],holidays:[],hoursPerDay:null}:{workdays:Array.isArray(S.workdays)&&S.workdays.length?S.workdays.map(Number).filter(C=>C>=0&&C<=6):[...L],holidays:v(S.holidays),hoursPerDay:null}}function w(S,_){let C,a,o=null;if(S==="weekends")C=[...L],a=[];else if(S&&typeof S=="object"&&!Array.isArray(S)&&!(S instanceof Date)){const $=S,h=$.workdays??$.workingDays;C=Array.isArray(h)&&h.length?h.map(Number).filter(i=>i>=0&&i<=6):_.workdays;const y=$.holidays??$.exceptions;a=Array.isArray(y)?v(y):_.holidays,$.hoursPerDay!=null&&(o=$.hoursPerDay)}else return null;const p=[...new Set(C)].sort(($,h)=>$-h);return{workdays:p,holidays:a,hoursPerDay:o,key:`${p.join(",")}|${a.join(",")}`}}function k(S){const _=m(S.calendar),C=Number.isFinite(S.projectStart)?S.projectStart:0,a=w({workdays:_.workdays,holidays:_.holidays},_).key,o=new Map,p=[],$=new Map;for(const[T,j]of Object.entries(S.calendars&&typeof S.calendars=="object"?S.calendars:{})){const I=w(j,_);I&&$.set(T,I)}const h=(T,j)=>{if(!o.has(T)){const I=U({workdays:j.workdays,holidays:j.holidays},C);o.set(T,{id:T,workdays:j.workdays,holidays:j.holidays,hoursPerDay:j.hoursPerDay,calendar:I,isWorking:I?O=>I.isWorking(O):()=>!0,key:j.key})}return o.get(T)};h(H,{..._,key:a});const y=(T,j,I)=>{if(T==null||T==="")return H;if(typeof T=="string"&&$.has(T))return h(T,$.get(T)).id;const O=T==="weekends"||T&&typeof T=="object"?w(T,_):null;if(O){const W=T==="weekends"?"weekends":`${I}:${j}`;return h(W,O).id}const z=typeof T=="string"?T:JSON.stringify(T);return p.push({code:"unknown-calendar",message:`${I} "${j}" names unknown calendar "${z}"`,id:j,calendar:z,owner:I}),null},i=new Map;let r=!1;for(const T of S.tasks||[]){const j=y(T.calendar,T.id,"task");j!=null&&(i.set(T.id,j),o.get(j).key!==a&&(r=!0))}const b=new Map;for(const T of S.resources||[]){const j=y(T.calendar,T.id,"resource");if(j==null||j===H)continue;const I=o.get(j);b.set(T.id,{workingDays:I.workdays,holidays:I.holidays,...I.hoursPerDay!=null?{hoursPerDay:I.hoursPerDay}:null})}return{errors:p,customised:r,models:o,ofTask:i,resourceSpec:b}}const u=Object.freeze({custom:!1,norm:(S,_)=>_,fin:(S,_,C)=>_+C,back:(S,_,C)=>_-C,shift:(S,_,C)=>_+C,unshift:(S,_,C)=>_-C,between:(S,_,C)=>_-C});function f(S){return{custom:!0,norm:(_,C)=>{const a=S(_);return a?a.nextWorking(C):C},fin:(_,C,a)=>{const o=S(_);return o?o.dayOf(o.indexOf(C)+a):C+a},back:(_,C,a)=>{const o=S(_);return o?o.dayOf(o.indexOf(C)-a):C-a},shift:(_,C,a)=>{const o=S(_);return o?o.dayOf(o.indexOf(C)+a):C+a},unshift:(_,C,a)=>{const o=S(_);return o?o.dayOf(o.indexOf(C)-a):C-a},between:(_,C,a)=>{const o=S(_);return o?o.indexOf(C)-o.indexOf(a):C-a}}}function d(S,_,C){const a=[];let o=null;for(let p=Math.round(S);p<Math.round(_);p+=1)C(p)?o==null&&(o=p):o!=null&&(a.push([o,p]),o=null);return o!=null&&a.push([o,Math.round(_)]),a}}),ae("packages/modules/gantt/assignments.js",function(g,V){"use strict";Object.defineProperty(g,"parseAssignments",{enumerable:!0,get:function(){return U}});function St(K){if(K==null||K==="")return null;const Y=typeof K=="number"?K:Number(K);return Number.isFinite(Y)?Y:null}function U(K){if(K&&Array.isArray(K.assignments))return K.assignments.map(l=>{const L=l&&(l.resource??l.name??l.id);if(L==null||L==="")return null;const v=St(l.units)??St(l.allocation)??1;return{resource:String(L),units:v}}).filter(Boolean);const Y=K?K.assignee??K.assignees??K.owner:null;return(Array.isArray(Y)?Y:Y==null||Y===""?[]:[Y]).map(l=>String(l)).filter(l=>l!=="").map(l=>({resource:l,units:1}))}}),ae("packages/modules/gantt/unscheduled.js",function(g,V){"use strict";Object.defineProperty(g,"UNSCHEDULED_DEFAULT_DURATION",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"isUnscheduled",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"findUnscheduled",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"activeEdges",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"unscheduledRecord",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"completeUnscheduledPatch",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"unscheduledMarker",{enumerable:!0,get:function(){return L}});const St=1;function U(v){return!!(v&&v.unscheduled===!0)}function K(v,m,w){const k=new Set;for(const u of v)!w.isSummary(u)&&m.get(u).duration==null&&k.add(u);if(!k.size)return k;for(const u of v)w.isSummary(u)&&w.descendantLeaves(u).every(f=>k.has(f))&&k.add(u);return k}function Y(v,m){return m.size?v.filter(w=>!m.has(w.from)&&!m.has(w.to)):v}function H(v,m){return{id:v.id,name:v.name,duration:null,es:null,ef:null,ls:null,lf:null,totalFloat:null,critical:!1,percentComplete:m?null:v.percentComplete,parent:v.parent,isSummary:m,isMilestone:!1,locked:m?!1:!!v.locked,unscheduled:!0,children:[]}}function l(v,m){if(!U(m)||m.isSummary||v.duration!==void 0)return v;const w=v.start!=null&&v.start!=="",k=v.end!=null&&v.end!=="";if(!w&&!k)return v;const u={...v,duration:St};if(!w){const f=Number(v.end);Number.isFinite(f)&&(u.start=f-St)}return u}function L(v,m,w){const k=v.createElement("span");return k.setAttribute("class",`${m}__unscheduled`),k.textContent=w("gantt.unscheduled"),k}}),ae("packages/modules/gantt/inactive.js",function(g,V){"use strict";Object.defineProperty(g,"bridgeInactive",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"inactiveRecord",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"inactiveMarker",{enumerable:!0,get:function(){return l}});const St=Object.freeze({FS:"es",SS:"es",FF:"ef",SF:"ef"}),U=Object.freeze({FS:"ef",SS:"es",FF:"ef",SF:"es"});function K(L,v){const m=L.lag+v.lag,w=U[L.type],k=St[v.type];let u;return w==="ef"&&k==="es"?u="FS":w==="ef"&&k==="ef"?u="FF":w==="es"&&k==="es"?u="SS":u="SF",{from:L.from,to:v.to,type:u,lag:m}}function Y(L,v){if(!v.size)return L;let m=L;for(const w of v){if(!m.some(_=>_.from===w||_.to===w))continue;const u=m.filter(_=>_.to===w),f=m.filter(_=>_.from===w),d=m.filter(_=>_.from!==w&&_.to!==w),S=[];for(const _ of u)for(const C of f)_.from!==C.to&&S.push(K(_,C));m=d.concat(S)}return m}function H(L){const v=L.earliestStart??null,m=L.duration??null,w=v!=null&&m!=null?v+m:null;return{id:L.id,name:L.name,duration:m,es:v,ef:w,ls:v,lf:w,totalFloat:null,critical:!1,percentComplete:L.percentComplete,parent:L.parent,isSummary:!1,isMilestone:m===0,locked:!!L.locked,inactive:!0,children:[],colour:L.colour??null}}function l(L,v,m){const w=L.createElement("span");return w.setAttribute("class",`${v}__inactive-marker`),w.textContent=m("gantt.inactive"),w}}),ae("packages/modules/gantt/schedule.js",function(g,V){"use strict";Object.defineProperty(g,"LINK_TYPES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(g,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(g,"resolveConstraintCode",{enumerable:!0,get:function(){return y}}),Object.defineProperty(g,"SCHEDULING_MODES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(g,"resolveSchedulingMode",{enumerable:!0,get:function(){return b}}),Object.defineProperty(g,"effortRate",{enumerable:!0,get:function(){return j}}),Object.defineProperty(g,"recomputeEffort",{enumerable:!0,get:function(){return I}}),Object.defineProperty(g,"reconcileEffort",{enumerable:!0,get:function(){return O}}),Object.defineProperty(g,"EPS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(g,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return W}}),Object.defineProperty(g,"TASK_FIELDS",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(g,"taskIdReader",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(g,"taskFieldWriters",{enumerable:!0,get:function(){return D}}),Object.defineProperty(g,"isTaskLocked",{enumerable:!0,get:function(){return x}}),Object.defineProperty(g,"normalizeTasks",{enumerable:!0,get:function(){return R}}),Object.defineProperty(g,"buildTree",{enumerable:!0,get:function(){return N}}),Object.defineProperty(g,"normalizeLinkSpec",{enumerable:!0,get:function(){return G}}),Object.defineProperty(g,"normalizeDependencies",{enumerable:!0,get:function(){return J}}),Object.defineProperty(g,"expandDependencies",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(g,"topoOrder",{enumerable:!0,get:function(){return st}}),Object.defineProperty(g,"wouldCreateCycle",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(g,"computeSchedule",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(g,"findViolations",{enumerable:!0,get:function(){return Ot}});const U=V("packages/core/src/internal/warn.js").warnOnce,Y=V("packages/modules/gantt/calendar.js").createCalendar,H=V("packages/modules/gantt/task-calendars.js"),l=H.PLAIN_TIME,L=H.createTimeModel,v=H.resolveCalendars,w=V("packages/modules/gantt/assignments.js").parseAssignments,u=V("packages/modules/gantt/time.js").toDayNumber,f=V("packages/modules/gantt/unscheduled.js"),d=f.activeEdges,S=f.findUnscheduled,_=f.unscheduledRecord,C=V("packages/modules/gantt/inactive.js"),a=C.bridgeInactive,o=C.inactiveRecord,p=["FS","SS","FF","SF"],$=["ASAP","MSO","MFO","ALAP","SNET","SNLT","FNET","FNLT"],h=Object.freeze({asap:"ASAP","as-soon-as-possible":"ASAP",assoonaspossible:"ASAP",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",snet:"SNET","start-no-earlier-than":"SNET",startnoearlierthan:"SNET",snlt:"SNLT","start-no-later-than":"SNLT",startnolaterthan:"SNLT",fnet:"FNET","finish-no-earlier-than":"FNET",finishnoearlierthan:"FNET",fnlt:"FNLT","finish-no-later-than":"FNLT",finishnolaterthan:"FNLT"});function y(et){if(et==null||et===""||typeof et=="object"&&!Array.isArray(et)&&!(et instanceof Date)&&(et=et.type??et.constraint??et.code??null,et==null||et===""))return null;const gt=String(et).toLowerCase().replace(/\s+/g,"-");return h[gt]??($.includes(String(et).toUpperCase())?String(et).toUpperCase():null)}const i=["fixedDuration","fixedEffort","fixedUnits"],r=Object.freeze({fixedduration:"fixedDuration","fixed-duration":"fixedDuration",duration:"fixedDuration",fixedeffort:"fixedEffort","fixed-effort":"fixedEffort",effort:"fixedEffort",work:"fixedEffort",fixedwork:"fixedEffort",fixedunits:"fixedUnits","fixed-units":"fixedUnits",units:"fixedUnits"});function b(et){if(et==null||et==="")return null;const gt=String(et).toLowerCase().replace(/\s+/g,"-");if(r[gt])return r[gt];const q=gt.replace(/-/g,"");return r[q]??null}const T=8;function j(et,gt){const q=gt.hoursPerDay,jt=gt.resourceHours instanceof Map?gt.resourceHours:new Map;if(!et||et.length===0)return{rate:q,units:1};let Et=0,mt=0;for(const yt of et){const Q=jt.has(yt.resource)?jt.get(yt.resource):q;Et+=yt.units*Q,mt+=yt.units}return{rate:Et,units:mt}}function I(et,gt){const q=et.schedulingMode||gt.defaultMode||"fixedDuration",jt=et.effortDriven!=null?!!et.effortDriven:!!gt.defaultEffortDriven,{rate:Et,units:mt}=j(et.assignments,gt),yt=et.duration,Q=et.statedEffort;let Mt=yt,Lt=Q??(yt!=null?yt*Et:null);return q==="fixedEffort"?Q!=null&&Et>0?Mt=Q/Et:Lt=yt!=null?yt*Et:null:q==="fixedUnits"?yt!=null?(Mt=yt,Lt=yt*Et):Q!=null&&Et>0&&(Mt=Q/Et,Lt=Q):Mt=yt,{duration:Mt,effort:Lt,units:mt,schedulingMode:q,effortDriven:jt}}function O(et,gt){const q=b(et.mode)||et.mode||"fixedDuration",jt=!!et.effortDriven,Et=et.hoursPerDay>0?et.hoursPerDay:T;let mt=et.duration,yt=et.units;const Q=mt*yt*Et,Mt=gt.field,Lt=gt.units!=null?gt.units:1;if(Mt==="duration")mt=gt.value,q==="fixedEffort"&&(yt=mt>0?Q/(mt*Et):yt);else if(Mt==="effort"){const Rt=gt.value;q==="fixedDuration"?yt=mt>0?Rt/(mt*Et):yt:mt=yt>0?Rt/(yt*Et):mt}else if(Mt==="units")yt=gt.value,q!=="fixedDuration"&&(mt=yt>0?Q/(yt*Et):mt);else if(Mt==="addResource"||Mt==="removeResource"){const Rt=Mt==="addResource"?Lt:-Lt;q==="fixedDuration"?jt||(yt=yt+Rt):(yt=yt+Rt,mt=yt>0?Q/(yt*Et):mt)}return{duration:mt,units:yt,effort:mt*yt*Et}}const z=1e-9,W={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",UNKNOWN_CALENDAR:"unknown-calendar"};function B(et){if(et==null||et==="")return null;const gt=typeof et=="number"?et:Number(et);return Number.isFinite(gt)?gt:null}function at(et){if(!et)return null;const gt=B(et.effort)??(Array.isArray(et.work)?null:B(et.work))??B(et.hours);if(gt!=null)return gt;if(Array.isArray(et.work)){let q=0,jt=!1;for(const Et of et.work){const mt=B(Et&&Et.hours);mt!=null&&(q+=mt,jt=!0)}return jt?q:null}return null}function ct(et){return et==null||et===""?null:u(et)}const kt=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate","deadline"]);function Tt(et){const gt=et&&typeof et=="object"?et:{},q={};for(const jt of kt){const Et=gt[jt];if(typeof Et=="function")q[jt]=Et;else if(typeof Et=="string"&&Et!==""){const mt=Et;q[jt]=yt=>yt[mt]}else q[jt]=mt=>mt[jt]}return q}function Ft(et){return Tt(et).id}function D(et){const gt=et&&typeof et=="object"?et:{},q={};for(const jt of kt){const Et=gt[jt];typeof Et=="string"&&Et!==""?q[jt]=Et:typeof Et=="function"?q[jt]=null:q[jt]=jt}return q}function P(et,gt){const q=gt.constraint(et);let jt=q??(et&&et.constraintType),Et=null;if(jt&&typeof jt=="object"&&!Array.isArray(jt)&&!(jt instanceof Date)&&(Et=jt.date??jt.at??jt.constraintDate??null,jt=jt.type??jt.constraint??jt.code??null),jt==null||jt==="")return null;const mt=y(jt);if(!mt)return null;const yt=ct(Et??gt.constraintDate(et)??et.constraintAt??et.at);return{type:mt,at:yt}}function x(et,gt){if(!et)return!1;if(et.locked===!0||typeof et.constraintMode=="string"&&et.constraintMode.toLowerCase()==="hard")return!0;if(typeof gt=="function")try{return!!gt(et)}catch{return!1}return!1}function R(et,gt,q){const jt=new Map,Et=[],mt=Tt(gt);if(!Array.isArray(et))return{ok:!1,error:{code:W.BAD_DURATION,message:"tasks must be an array"},order:Et,byId:jt};for(const yt of et){const Q=yt?mt.id(yt):null,Mt=Q!=null?String(Q):null;if(Mt==null)return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"every task needs an id"},order:Et,byId:jt};if(jt.has(Mt))return{ok:!1,error:{code:W.DUPLICATE_ID,message:`duplicate task id "${Mt}"`,id:Mt},order:Et,byId:jt};const Lt=ct(mt.start(yt)),Rt=ct(mt.end(yt)),Zt=mt.milestone(yt)===!0;let Vt=Zt?0:B(mt.duration(yt));if(Vt==null&&Lt!=null&&Rt!=null&&(Vt=Rt-Lt),Vt!=null&&Vt<0)return{ok:!1,error:{code:W.BAD_DURATION,message:`task "${Mt}" has negative duration ${Vt}`,id:Mt},order:Et,byId:jt};const xt=mt.name(yt),Ht=mt.parent(yt),ge=yt.colour??yt.color;jt.set(Mt,{id:Mt,name:xt!=null?String(xt):Mt,colour:typeof ge=="string"&&ge.trim()!==""?ge.trim():null,duration:Vt,milestoneFlag:Zt,earliestStart:Lt,placedStart:Lt,placedEnd:Rt,percentComplete:B(mt.percentComplete(yt)),parent:Ht!=null?String(Ht):null,constraint:P(yt,mt),locked:x(yt,q),inactive:yt.inactive===!0,baselineStart:ct(mt.baselineStart(yt)??(yt.baseline&&yt.baseline.start)),baselineEnd:ct(mt.baselineEnd(yt)??(yt.baseline&&yt.baseline.end)),deadline:ct(mt.deadline(yt)),schedulingMode:b(yt.schedulingMode??yt.taskType),effortDriven:yt.effortDriven==null?null:!!yt.effortDriven,statedEffort:at(yt),assignments:w(yt)}),Et.push(Mt)}return{ok:!0,order:Et,byId:jt}}function N(et,gt){const q=new Map(et.map(Q=>[Q,[]]));for(const Q of et){const Mt=gt.get(Q).parent;if(Mt!=null){if(!gt.has(Mt))return{ok:!1,error:{code:W.UNKNOWN_PARENT,message:`task "${Q}" names unknown parent "${Mt}"`,id:Q}};q.get(Mt).push(Q)}}for(const Q of et){const Mt=new Set;let Lt=gt.get(Q).parent;for(;Lt!=null;){if(Lt===Q||Mt.has(Lt))return{ok:!1,error:{code:W.PARENT_CYCLE,message:`parent cycle at "${Q}"`,id:Q}};Mt.add(Lt),Lt=gt.get(Lt)?.parent??null}}const jt=Q=>q.get(Q).length>0,Et=new Map,mt=Q=>{if(Et.has(Q))return Et.get(Q);const Mt=q.get(Q),Lt=Mt.length===0?[Q]:Mt.flatMap(Rt=>mt(Rt));return Et.set(Q,Lt),Lt};return{ok:!0,children:q,isSummary:jt,descendantLeaves:mt,ancestors:Q=>{const Mt=new Set;let Lt=gt.get(Q).parent;for(;Lt!=null;)Mt.add(Lt),Lt=gt.get(Lt).parent;return Mt}}}const X=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function G(et){const gt={...et||null};if(typeof gt.type!="string")return gt;const q=X.exec(gt.type);if(!q||!q[2])return gt;const jt=(q[2]==="-"?-1:1)*Number(q[3]);gt.type=q[1].toUpperCase();const Et=B(et.lag);return Et!=null&&Et!==jt?(U(`gantt-link-shorthand-${String(et.type)}-${Et}`,`[lattice] gantt: dependency type ${JSON.stringify(et.type)} carries a lag of ${jt} but lag: ${Et} was also given; the explicit lag wins. Give one or the other.`),gt):(gt.lag=jt,gt)}function J(et,gt,q={}){const jt=[];if(et==null)return{ok:!0,edges:jt};if(!Array.isArray(et))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"dependencies must be an array"},edges:jt};const Et=typeof q.ancestors=="function"?q.ancestors:null;for(const mt of et){const yt=G(mt),Q=yt&&yt.from!=null?String(yt.from):null,Mt=yt&&yt.to!=null?String(yt.to):null,Lt=yt&&yt.type!=null?String(yt.type).toUpperCase():"FS",Rt=B(yt.lag)??0;if(Q==null||Mt==null)return{ok:!1,error:{code:W.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:jt};if(!gt.has(Q))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:`dependency references unknown task "${Q}"`,id:Q},edges:jt};if(!gt.has(Mt))return{ok:!1,error:{code:W.UNKNOWN_TASK,message:`dependency references unknown task "${Mt}"`,id:Mt},edges:jt};if(Q===Mt)return{ok:!1,error:{code:W.SELF_DEPENDENCY,message:`task "${Q}" depends on itself`,id:Q},edges:jt};if(!p.includes(Lt))return{ok:!1,error:{code:W.BAD_LINK_TYPE,message:`unknown link type "${Lt}" (expected one of ${p.join("/")})`},edges:jt};if(Et&&(Et(Q).has(Mt)||Et(Mt).has(Q)))return{ok:!1,error:{code:W.DEP_ACROSS_HIERARCHY,message:`dependency between "${Q}" and "${Mt}" crosses their own parent/child hierarchy`,from:Q,to:Mt},edges:jt};jt.push({from:Q,to:Mt,type:Lt,lag:Rt})}return{ok:!0,edges:jt}}function tt(et,gt){const q=new Set,jt=[];for(const Et of et){(gt.isSummary(Et.from)||gt.isSummary(Et.to))&&Et.type!=="FS"&&U(`gantt-summary-link-${Et.type}-${Et.from}-${Et.to}`,`[lattice] gantt: ${Et.type} link with a summary endpoint (${Et.from} -> ${Et.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const yt of gt.descendantLeaves(Et.from))for(const Q of gt.descendantLeaves(Et.to)){if(yt===Q)continue;const Mt=[yt,Q,Et.type,Et.lag].join("");q.has(Mt)||(q.add(Mt),jt.push({from:yt,to:Q,type:Et.type,lag:Et.lag}))}}return jt}function ft(et,gt,q,jt=l){return et.map(Et=>{const mt=gt.get(Et.from),yt=gt.get(Et.to);if(!mt||!yt||mt.earliestStart==null||mt.duration==null||yt.earliestStart==null||yt.duration==null)return Et;if(jt.custom){const Vt=jt.norm(Et.from,mt.earliestStart),xt=jt.fin(Et.from,Vt,mt.duration),Ht=jt.norm(Et.to,yt.earliestStart),ge=jt.fin(Et.to,Ht,yt.duration);switch(Et.type){case"FS":return{...Et,lag:jt.between(Et.to,Ht,xt)};case"SS":return{...Et,lag:jt.between(Et.to,Ht,Vt)};case"FF":return{...Et,lag:jt.between(Et.to,ge,xt)};case"SF":return{...Et,lag:jt.between(Et.to,ge,Vt)};default:return Et}}const Q=q(mt.earliestStart),Mt=Q+mt.duration,Lt=q(yt.earliestStart),Rt=Lt+yt.duration;let Zt;switch(Et.type){case"FS":Zt=Lt-Mt;break;case"SS":Zt=Lt-Q;break;case"FF":Zt=Rt-Mt;break;case"SF":Zt=Rt-Q;break;default:return Et}return{...Et,lag:Zt}})}function st(et,gt){const q=new Map(et.map(yt=>[yt,0])),jt=new Map(et.map(yt=>[yt,[]]));for(const yt of gt)ht(q,yt.to),jt.get(yt.from).push(yt.to);const Et=et.filter(yt=>q.get(yt)===0),mt=[];for(;Et.length;){const yt=Et.shift();mt.push(yt);for(const Q of jt.get(yt)){const Mt=q.get(Q)-1;q.set(Q,Mt),Mt===0&&Et.push(Q)}}return mt.length===et.length?{ok:!0,sorted:mt}:{ok:!1,cycle:Pt(et,jt,new Set(mt))}}function ht(et,gt){et.set(gt,et.get(gt)+1)}function Pt(et,gt,q){const jt=et.find(Q=>!q.has(Q)),Et=[],mt=new Map;let yt=jt;for(;yt!=null&&!mt.has(yt);)mt.set(yt,Et.length),Et.push(yt),yt=gt.get(yt).find(Q=>!q.has(Q));return yt==null?Et:Et.slice(mt.get(yt)).concat(yt)}function wt(et,gt,q){const jt=String(gt),Et=String(q);if(jt===Et)return!0;const mt=new Map;for(const Mt of et){const Lt=String(Mt.from);mt.has(Lt)||mt.set(Lt,[]),mt.get(Lt).push(String(Mt.to))}const yt=new Set,Q=[Et];for(;Q.length;){const Mt=Q.pop();if(Mt===jt)return!0;if(!yt.has(Mt)){yt.add(Mt);for(const Lt of mt.get(Mt)||[])Q.push(Lt)}}return!1}function Jt(et,gt,q,jt){switch(gt.type){case"FS":return et.shift(jt.id,q.ef,gt.lag);case"SS":return et.shift(jt.id,q.es,gt.lag);case"FF":return et.back(jt.id,et.shift(jt.id,q.ef,gt.lag),jt.duration);case"SF":return et.back(jt.id,et.shift(jt.id,q.es,gt.lag),jt.duration);default:return-1/0}}function dt(et,gt,q,jt,Et,mt=new Map,yt=new Map,Q=!1,Mt=l){const Lt=st(et,q);if(!Lt.ok)return U(`gantt-cycle-${Lt.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${Lt.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:W.CYCLE,message:`dependency cycle: ${Lt.cycle.join(" -> ")}`,cycle:Lt.cycle}};const Rt=Lt.sorted,Zt=new Map(et.map(It=>[It,[]])),Vt=new Map(et.map(It=>[It,[]]));for(const It of q)Zt.get(It.to).push(It),Vt.get(It.from).push(It);const xt=new Map;for(const It of et){const ie=gt.get(It);xt.set(It,{id:It,name:ie.name,duration:ie.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:ie.percentComplete,parent:ie.parent,isSummary:!1,isMilestone:ie.duration===0,children:[],colour:ie.colour??null,locked:!!ie.locked})}const Ht=[];for(const It of Rt){const ie=gt.get(It),Yt=xt.get(It);let lt=Math.max(jt,ie.earliestStart??jt);for(const Ct of Zt.get(It)){const Dt=xt.get(Ct.from),Bt=Jt(Mt,Ct,Dt,Yt);Bt>lt&&(lt=Bt)}const bt=mt.get(It);if(bt&&bt.at!=null)switch(bt.type){case"MSO":bt.at<lt-z?Ht.push({id:It,type:bt.type,date:bt.at,scheduled:lt,at:bt.at,earliestFeasible:lt}):lt=bt.at,Yt.pinned=!0;break;case"MFO":{const Ct=Mt.back(It,bt.at,Yt.duration);Ct<lt-z?Ht.push({id:It,type:bt.type,date:bt.at,scheduled:Mt.fin(It,lt,Yt.duration),at:bt.at,earliestFeasible:lt}):lt=Ct,Yt.pinned=!0;break}case"SNET":bt.at>lt+z&&(lt=bt.at);break;case"SNLT":lt>bt.at+z&&Ht.push({id:It,type:bt.type,date:bt.at,scheduled:lt,at:bt.at,earliestFeasible:lt});break;case"FNET":{const Ct=Mt.back(It,bt.at,Yt.duration);Ct>lt+z&&(lt=Ct);break}case"FNLT":{const Ct=Mt.fin(It,lt,Yt.duration);Ct>bt.at+z&&Ht.push({id:It,type:bt.type,date:bt.at,scheduled:Ct,at:bt.at,earliestFeasible:lt});break}default:break}if(ie.locked){const Ct=bt&&bt.at!=null?bt.type==="MFO"?Mt.back(It,bt.at,Yt.duration):bt.type==="MSO"?bt.at:null:null,Dt=ie.earliestStart!=null?ie.earliestStart:Ct??lt;if(lt-z>Dt)for(const Bt of Zt.get(It)){const Ut=xt.get(Bt.from),oe=Jt(Mt,Bt,Ut,Yt);oe>Dt+z&&Ht.push({id:It,from:Bt.from,to:It,type:"LOCKED",date:Dt,scheduled:oe,at:Dt,earliestFeasible:Dt})}lt=Dt,Yt.pinned=!0}lt=Mt.norm(It,lt),Yt.es=lt,Yt.ef=Mt.fin(It,lt,Yt.duration)}const ge=et.length?Math.max(...et.map(It=>xt.get(It).ef)):jt,$e=Number.isFinite(Et)?Et:ge;for(let It=Rt.length-1;It>=0;It-=1){const ie=Rt[It],Yt=xt.get(ie);let lt=$e;const bt=yt.get(ie);bt!=null&&bt<lt&&(lt=bt);for(const Ct of Vt.get(ie)){const Dt=xt.get(Ct.to);let Bt;switch(Ct.type){case"FS":Bt=Mt.unshift(Ct.to,Dt.ls,Ct.lag);break;case"SS":Bt=Mt.fin(ie,Mt.unshift(Ct.to,Dt.ls,Ct.lag),Yt.duration);break;case"FF":Bt=Mt.unshift(Ct.to,Dt.lf,Ct.lag);break;case"SF":Bt=Mt.fin(ie,Mt.unshift(Ct.to,Dt.lf,Ct.lag),Yt.duration);break;default:Bt=1/0}Bt<lt&&(lt=Bt)}Yt.pinned&&(lt=Yt.ef),Yt.lf=lt,Yt.ls=Mt.back(ie,lt,Yt.duration),Yt.totalFloat=Mt.between(ie,Yt.ls,Yt.es),Yt.critical=Yt.totalFloat<=z,bt!=null&&(Yt.deadline=bt,Yt.late=Yt.ef>bt+z)}for(const It of et){const ie=mt.get(It);if(!ie||ie.type!=="ALAP")continue;const Yt=xt.get(It);Yt.es=Yt.ls,Yt.ef=Yt.lf,Yt.totalFloat=0,Yt.critical=!0}const qt=et.filter(It=>xt.get(It).critical),se=Q?[]:zt(et,q,xt,Mt);return{ok:!0,tasks:xt,critical:qt,criticalPaths:se,projectFinish:ge,conflicts:Ht}}function nt(et,gt){let q=null;if(Array.isArray(et))for(const jt of et){const Et=ct(jt?gt(jt):null);Et!=null&&(q==null||Et<q)&&(q=Et)}return q}function ot(et,gt=[],q={}){const jt=Tt(q.fields),Et=ct(q.projectStart),mt=Et??0,yt=Et??nt(et,jt.start)??0,Q=ct(q.deadline),Mt=Y(q.calendar,mt),Lt=[];for(const ne of Array.isArray(et)?et:[]){const xe=ne?jt.id(ne):null;xe!=null&&ne.calendar!=null&&Lt.push({id:String(xe),calendar:ne.calendar})}const Rt=[];for(const ne of Array.isArray(q.resources)?q.resources:[]){const xe=ne&&(ne.id??ne.name??ne.resource);xe!=null&&ne.calendar!=null&&Rt.push({id:String(xe),calendar:ne.calendar})}const Zt=q.calendars&&typeof q.calendars=="object"&&Object.keys(q.calendars).length>0,Vt=Lt.length||Rt.length||Zt?v({calendar:q.calendar,calendars:q.calendars,projectStart:mt,tasks:Lt,resources:Rt}):null;if(Vt&&Vt.errors.length){const ne=Vt.errors.map(xe=>({...xe,code:W.UNKNOWN_CALENDAR}));return{ok:!1,error:ne[0],errors:ne}}const xt=!!(Vt&&Vt.customised),Ht=xt?null:Mt,ge=xt?L(ne=>Vt.models.get(Vt.ofTask.get(ne)??"plan").calendar):l,$e=ne=>ne==null?null:Ht?Ht.indexOf(ne):ne,qt=ne=>Ht?Ht.dayOf(ne):ne,se=R(et,q.fields,q.lockWhen);if(!se.ok)return{ok:!1,error:se.error,errors:[se.error]};const{order:It,byId:ie}=se,Yt=N(It,ie);if(!Yt.ok)return{ok:!1,error:Yt.error,errors:[Yt.error]};const lt=J(gt,ie,Yt);if(!lt.ok)return{ok:!1,error:lt.error,errors:[lt.error]};const bt=q.honourDates?ft(lt.edges,ie,$e,ge):lt.edges,Ct={defaultMode:b(q.schedulingMode)||"fixedDuration",defaultEffortDriven:!!q.effortDriven,hoursPerDay:B(q.hoursPerDay)??T,resourceHours:q.resourceHours instanceof Map?q.resourceHours:new Map},Dt=new Map;for(const ne of It){if(Yt.isSummary(ne))continue;const xe=ie.get(ne);if(!(xe.schedulingMode!=null||xe.effortDriven!=null||xe.statedEffort!=null||q.schedulingMode!=null||q.effortDriven!=null))continue;const Le=I(xe,Ct);Le.duration!=null&&(xe.duration=Le.duration),Dt.set(ne,{schedulingMode:Le.schedulingMode,effortDriven:Le.effortDriven,effort:Le.effort,units:Le.units})}const Bt=S(It,ie,Yt),Ut=new Set(It.filter(ne=>!Yt.isSummary(ne)&&ie.get(ne).inactive===!0)),oe=new Set([...Bt].filter(ne=>!Ut.has(ne))),de=It.filter(ne=>!Yt.isSummary(ne)&&!oe.has(ne)&&!Ut.has(ne)),me=new Map(de.map(ne=>{const xe=ie.get(ne);return[ne,{...xe,earliestStart:$e(xe.earliestStart)}]})),we=new Map;for(const ne of de){const xe=ie.get(ne).constraint;xe&&we.set(ne,{type:xe.type,at:$e(xe.at)})}const Fe=Ht?Ht.indexOf(mt):mt,Pe=Q==null?void 0:$e(Q),Ee=new Map;for(const ne of de){const xe=me.get(ne).deadline;if(xe==null)continue;const Ge=Ht?Ht.indexOf(xe):xe;Number.isFinite(Ge)&&Ee.set(ne,Ge)}const _e=a(d(tt(bt,Yt),oe),Ut),qe=dt(de,me,_e,Fe,Pe,we,Ee,!!q.skipCriticalPaths,ge);if(!qe.ok)return{ok:!1,error:qe.error,errors:[qe.error]};const He=qe.tasks;for(const ne of de){const xe=He.get(ne);xe.es=qt(xe.es),xe.ef=qt(xe.ef),xe.ls=qt(xe.ls),xe.lf=qt(xe.lf),xe.deadline!=null&&(xe.deadline=qt(xe.deadline)),vt(xe,ie.get(ne).baselineStart,ie.get(ne).baselineEnd);const Ge=Dt.get(ne);Ge&&(xe.schedulingMode=Ge.schedulingMode,xe.effortDriven=Ge.effortDriven,xe.effort=Ge.effort,xe.units=Ge.units)}for(const ne of It)oe.has(ne)?He.set(ne,_(ie.get(ne),Yt.isSummary(ne))):Ut.has(ne)&&He.set(ne,o(ie.get(ne)));if(Vt)for(const ne of It)He.get(ne).calendar=Vt.ofTask.get(ne)??"plan";for(let ne=It.length-1;ne>=0;ne-=1){const xe=It[ne];!Yt.isSummary(xe)||oe.has(xe)||He.set(xe,pt(xe,ie.get(xe),Yt,He))}for(const ne of It)Yt.isSummary(ne)&&(He.get(ne).children=Yt.children.get(ne).slice());const ln=Mt?Mt.nextWorking(yt):yt,pn=qt(qe.projectFinish);return{ok:!0,tasks:He,order:It,critical:qe.critical,criticalPaths:qe.criticalPaths,projectStart:ln,projectFinish:pn,projectDuration:pn-ln,conflicts:(qe.conflicts||[]).map(ne=>({id:ne.id,type:ne.type,date:qt(ne.date),scheduled:qt(ne.scheduled),at:qt(ne.at),earliestFeasible:qt(ne.earliestFeasible),...ne.from!==void 0?{from:ne.from,to:ne.to}:null})),calendar:!!Mt,...xt?{calendars:Vt.models}:null,unscheduled:It.filter(ne=>oe.has(ne)),...q.honourDates?{dependencies:bt}:{}}}function vt(et,gt,q){gt==null&&q==null||(et.baselineStart=gt??null,et.baselineEnd=q??null,et.startVariance=gt==null?null:et.es-gt,et.finishVariance=q==null?null:et.ef-q,et.durationVariance=gt==null||q==null?null:et.ef-et.es-(q-gt))}function pt(et,gt,q,jt){const Et=q.children.get(et).map(It=>jt.get(It)),mt=Et.filter(It=>!It.unscheduled&&!It.inactive),yt=mt.length?mt:Et,Q=Math.min(...yt.map(It=>It.es)),Mt=Math.max(...yt.map(It=>It.ef)),Lt=Math.min(...yt.map(It=>It.ls)),Rt=Math.max(...yt.map(It=>It.lf)),Zt=q.descendantLeaves(et).map(It=>jt.get(It)),Vt=Zt.filter(It=>!It.unscheduled&&!It.inactive),xt=Vt.length?Vt:Zt,Ht=xt.reduce((It,ie)=>It+ie.duration,0),ge=Ht>z?xt.reduce((It,ie)=>It+ie.duration*(ie.percentComplete??0),0)/Ht:null,$e={id:et,name:gt.name,duration:Mt-Q,es:Q,ef:Mt,ls:Lt,lf:Rt,totalFloat:Lt-Q,critical:yt.some(It=>It.critical),percentComplete:ge,parent:gt.parent,isSummary:!0,isMilestone:!1,locked:!1,...gt.inactive===!0?{inactive:!0}:null,children:[],colour:gt.colour??null},qt=xt.map(It=>It.baselineStart).filter(It=>It!=null),se=xt.map(It=>It.baselineEnd).filter(It=>It!=null);return(qt.length||se.length)&&vt($e,qt.length?Math.min(...qt):null,se.length?Math.max(...se):null),$e}function zt(et,gt,q,jt=l){const Et=new Map(et.map(Lt=>[Lt,[]])),mt=new Set;for(const Lt of gt){const Rt=q.get(Lt.from),Zt=q.get(Lt.to);if(!Rt.critical||!Zt.critical)continue;const Vt=Jt(jt,Lt,Rt,Zt);Math.abs(Vt-Zt.es)<=z&&(Et.get(Lt.from).push(Lt.to),mt.add(Lt.to))}const yt=et.filter(Lt=>q.get(Lt).critical&&!mt.has(Lt)),Q=[],Mt=(Lt,Rt)=>{const Zt=Et.get(Lt);if(!Zt.length){Q.push(Rt);return}for(const Vt of Zt)Mt(Vt,Rt.concat(Vt))};for(const Lt of yt)Mt(Lt,[Lt]);return Q}function Ot(et,gt,q){if(!gt||!gt.ok)return[];const jt=[],Et=Tt(q);for(const mt of et){const yt=mt?Et.id(mt):null,Q=yt!=null?String(yt):null;if(Q==null||!gt.tasks.has(Q))continue;const Mt=gt.tasks.get(Q);if(Mt.isSummary)continue;const Lt=B(Et.start(mt));Lt==null||Mt.unscheduled||Lt<Mt.es-z&&jt.push({id:Q,placedStart:Lt,earliestStart:Mt.es,by:Mt.es-Lt})}return jt}}),ae("packages/modules/gantt/resources.js",function(g,V){"use strict";Object.defineProperty(g,"normalizeCapacities",{enumerable:!0,get:function(){return y}}),Object.defineProperty(g,"resourceDisplayNames",{enumerable:!0,get:function(){return i}}),Object.defineProperty(g,"resourceSpecsByKey",{enumerable:!0,get:function(){return r}}),Object.defineProperty(g,"resourceAvatars",{enumerable:!0,get:function(){return b}}),Object.defineProperty(g,"normalizeResources",{enumerable:!0,get:function(){return z}}),Object.defineProperty(g,"resourceDailyHours",{enumerable:!0,get:function(){return W}}),Object.defineProperty(g,"sweepLoad",{enumerable:!0,get:function(){return B}}),Object.defineProperty(g,"computeResourceLoad",{enumerable:!0,get:function(){return at}}),Object.defineProperty(g,"normalizeResourceRates",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(g,"rateOn",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(g,"levelResources",{enumerable:!0,get:function(){return x}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/modules/gantt/schedule.js"),Y=K.computeSchedule,H=K.EPS,l=K.taskIdReader,L=K.resolveConstraintCode,v=V("packages/modules/gantt/assignments.js"),m=v.parseAssignments,k=V("packages/modules/gantt/calendar.js").createCalendar,u=V("packages/modules/gantt/task-calendars.js"),f=u.parseHolidayDays,d=u.normalizeCalendarSpec,S=u.planWorkingTime,_=u.workingRuns,C=V("packages/modules/gantt/time.js"),a=C.fromDayNumber,o=C.toDayNumber;Object.defineProperty(g,"parseAssignments",{enumerable:!0,get:function(){return v.parseAssignments}});const p=Object.freeze([1,2,3,4,5]),$=8;function h(N){if(N==null||N==="")return null;const X=typeof N=="number"?N:Number(N);return Number.isFinite(X)?X:null}function y(N,X){const G=new Map;if(Array.isArray(N))for(const J of N){const tt=J&&(J.id??J.name??J.resource);if(tt==null||tt==="")continue;const ft=h(J.capacity??J.maxUnits??J.max??J.units);G.set(String(tt),ft??X)}else if(N&&typeof N=="object")for(const[J,tt]of Object.entries(N)){const ft=h(tt);G.set(String(J),ft??X)}return G}function i(N){const X=new Map;if(Array.isArray(N))for(const G of N){if(!G)continue;const J=G.id??G.name??G.resource;if(J==null||J==="")continue;const tt=G.name??G.id??G.resource;X.set(String(J),String(tt))}else if(N&&typeof N=="object")for(const[G,J]of Object.entries(N))X.set(G,J&&typeof J=="object"&&J.name!=null?String(J.name):G);return X}function r(N){const X=new Map;if(Array.isArray(N))for(const G of N){if(!G||typeof G!="object")continue;const J=G.id??G.name??G.resource;J!=null&&J!==""&&X.set(String(J),{...G})}else if(N&&typeof N=="object")for(const[G,J]of Object.entries(N))X.set(G,J&&typeof J=="object"?{...J}:{capacity:J});return X}function b(N){const X=new Map,G=J=>typeof J=="string"?J.trim():"";if(Array.isArray(N))for(const J of N){if(!J)continue;const tt=J.id??J.name??J.resource;if(tt==null||tt==="")continue;const ft=G(J.avatar);ft&&X.set(String(tt),ft)}else if(N&&typeof N=="object")for(const[J,tt]of Object.entries(N)){const ft=tt&&typeof tt=="object"?G(tt.avatar):"";ft&&X.set(J,ft)}return X}function T(N){return new Set(f(N))}function j(N){return N==null?{workdays:[0,1,2,3,4,5,6],holidays:new Set}:N==="weekends"?{workdays:[...p],holidays:new Set}:{workdays:Array.isArray(N.workdays)&&N.workdays.length?N.workdays.map(Number).filter(G=>G>=0&&G<=6):[...p],holidays:T(N.holidays)}}function I(N,X,G){let J=N;if(typeof N=="string"&&(J=X&&Object.prototype.hasOwnProperty.call(X,N)?X[N]:N==="weekends"?N:null),J==null||typeof J=="string"&&J!=="weekends")return null;const tt=d(J,G);if(!tt)return null;const ft=J;return{...ft==="weekends"||ft.workdays||ft.workingDays?{workingDays:tt.workdays}:null,...ft!=="weekends"&&(ft.holidays||ft.exceptions)?{holidays:tt.holidays}:null,...tt.hoursPerDay!=null?{hoursPerDay:tt.hoursPerDay}:null}}function O(N,X,G,J){const tt=new Set(Array.isArray(N.workingDays)&&N.workingDays.length?N.workingDays.map(Number).filter(pt=>pt>=0&&pt<=6):J.workdays),ft=T(N.holidays);for(const pt of J.holidays)ft.add(pt);const st=N.hoursPerDay,ht=pt=>{if(st!=null&&typeof st=="object"){const Ot=h(st[pt]);return Ot??G}const zt=h(st);return zt??G},Pt=pt=>{const zt=a(pt);return zt?tt.has(zt.getUTCDay())&&!ft.has(pt):!1},wt=pt=>Pt(pt)?X??ht(a(pt).getUTCDay()):0,Jt=pt=>G>0?wt(pt)/G:0;let dt=0;for(const pt of tt){const zt=X??ht(pt);zt>dt&&(dt=zt)}const nt=G>0?dt/G:0;let ot=0;for(const pt of J.workdays)tt.has(pt)&&(ot+=X??ht(pt));const vt=J.workdays.length?ot/J.workdays.length:G;return{hasCalendar:!0,capacityUnits:nt,hoursPerWorkingDay:vt,worksOn:Pt,capacityHoursOn:wt,capacityUnitsOn:Jt}}function z(N,X,G={}){const J=h(G.hoursPerDay)??$,tt=j(G.calendar),ft=new Map,st=(ht,Pt)=>{const wt=h(Pt.capacity??Pt.maxUnits??Pt.max??Pt.units),Jt=I(Pt.calendar,G.calendars,S(G.calendar));Jt?ft.set(ht,O(Jt,wt,J,tt)):ft.set(ht,{hasCalendar:!1,capacityUnits:wt??X,hoursPerWorkingDay:J})};if(Array.isArray(N))for(const ht of N){const Pt=ht&&(ht.id??ht.name??ht.resource);Pt==null||Pt===""||st(String(Pt),ht)}else if(N&&typeof N=="object")for(const[ht,Pt]of Object.entries(N))st(String(ht),typeof Pt=="object"&&Pt?Pt:{capacity:Pt});return ft}function W(N,X,G={}){const J=h(G.hoursPerDay)??$,tt=z(N,X,G),ft=new Map;for(const[st,ht]of tt)ft.set(st,ht.hoursPerWorkingDay!=null?ht.hoursPerWorkingDay:J);return ft}function B(N){if(!N.length)return[];const X=new Set;for(const tt of N)X.add(tt.s),X.add(tt.e);const G=[...X].sort((tt,ft)=>tt-ft),J=[];for(let tt=0;tt<G.length-1;tt+=1){const ft=G[tt],st=G[tt+1];if(st<=ft)continue;let ht=0;const Pt=[];for(const wt of N)wt.s<=ft&&wt.e>=st&&(ht+=wt.units,Pt.push(wt.taskId));Pt.length&&J.push({s:ft,e:st,load:ht,taskIds:Pt})}return J}function at(N,X,G={}){const J={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!X||!X.ok)return J;const tt=h(G.defaultCapacity)??1,ft=y(G.resources,tt),st=z(G.resources,tt,{calendar:G.calendar,calendars:G.calendars,hoursPerDay:G.hoursPerDay}),ht=X.calendars instanceof Map?X.calendars:null,Pt=G.calendar!=null&&!ht?k(G.calendar,X.projectStart):null,wt=et=>ft.has(et)?ft.get(et):tt,Jt=et=>Pt?Pt.indexOf(et):et,dt=et=>Pt?Pt.dayOf(et):et,nt=l(G.fields),ot=new Map;for(const et of N){if(!et)continue;const gt=nt(et);if(gt==null)continue;const q=String(gt);ot.has(q)||ot.set(q,et)}const vt=new Map;for(const et of X.order){const gt=X.tasks.get(et);if(!gt||gt.isSummary||gt.unscheduled)continue;const q=ot.get(et);if(!q)continue;const jt=m(q);if(!jt.length)continue;const Et=Jt(gt.es),mt=Jt(gt.ef);if(mt<=Et)continue;const yt=ht&&ht.get(gt.calendar),Q=yt?_(Et,mt,yt.isWorking):[[Et,mt]];for(const Mt of jt){vt.has(Mt.resource)||vt.set(Mt.resource,[]);for(const[Lt,Rt]of Q)vt.get(Mt.resource).push({s:Lt,e:Rt,units:Mt.units,taskId:et})}}const pt=new Map,zt=[],Ot=[];for(const[et,gt]of vt){const q=st.get(et),jt=B(gt);let Et=0,mt,yt;if(q&&q.hasCalendar){yt=q.capacityUnits,mt=[];for(const Mt of jt){Mt.load>Et&&(Et=Mt.load);let Lt=Mt.s,Rt=q.capacityUnitsOn(dt(Mt.s));const Zt=Vt=>{const xt={start:dt(Lt),end:dt(Vt),load:Mt.load,taskIds:Mt.taskIds};mt.push(xt),Mt.load>Rt+H&&Ot.push({resource:et,capacity:Rt,start:xt.start,end:xt.end,load:Mt.load,taskIds:Mt.taskIds.slice()})};for(let Vt=Mt.s+1;Vt<Mt.e;Vt+=1){const xt=q.capacityUnitsOn(dt(Vt));xt!==Rt&&(Zt(Vt),Lt=Vt,Rt=xt)}Zt(Mt.e)}}else yt=wt(et),mt=jt.map(Mt=>{Mt.load>Et&&(Et=Mt.load);const Lt={start:dt(Mt.s),end:dt(Mt.e),load:Mt.load,taskIds:Mt.taskIds};return Mt.load>yt+H&&Ot.push({resource:et,capacity:yt,start:Lt.start,end:Lt.end,load:Mt.load,taskIds:Mt.taskIds.slice()}),Lt});const Q={resource:et,capacity:yt,peak:Et,segments:mt};pt.set(et,Q),zt.push(Q)}return zt.sort((et,gt)=>et.resource<gt.resource?-1:et.resource>gt.resource?1:0),Ot.sort((et,gt)=>et.start-gt.start||(et.resource<gt.resource?-1:1)),{ok:!0,resources:zt,overAllocations:Ot,byResource:pt}}function ct(N){const X=[];for(const G of Array.isArray(N)?N:[]){const J=o(G&&G.from),tt=h(G&&G.rate);J==null||tt==null||X.push({from:Math.round(J),rate:tt})}return X.sort((G,J)=>G.from-J.from),X}function kt(N){const X=new Map,G=(J,tt)=>{if(!tt||typeof tt!="object")return;const ft=tt.type==="material"||tt.type==="cost"?tt.type:"work",st=h(tt.rate),ht=ct(tt.rates),Pt=h(tt.cost);st==null&&!ht.length&&Pt==null||X.set(J,{type:ft,rate:st,rates:ht,cost:Pt})};if(Array.isArray(N))for(const J of N){const tt=J&&(J.id??J.name??J.resource);tt==null||tt===""||G(String(tt),J)}else if(N&&typeof N=="object")for(const[J,tt]of Object.entries(N))tt&&typeof tt=="object"&&G(J,tt);return X}function Tt(N,X){if(!N)return null;let G=N.rate;for(const J of N.rates)if(J.from<=X)G=J.rate;else break;return G??null}function Ft(N){if(!N)return!1;const X=N.constraint??N.constraintType;if(X==null||X==="")return!1;const G=String(X).toLowerCase().replace(/\s+/g,"-");return G==="mso"||G==="must-start-on"||G==="muststarton"||G==="start-on"||G==="mfo"||G==="must-finish-on"||G==="mustfinishon"||G==="finish-on"}function D(N){if(!N)return null;const X=N.constraint??N.constraintType,G=L(X);if(G!=="SNLT"&&G!=="FNLT")return null;let J=N.constraintDate??N.constraintAt??N.at;if(X&&typeof X=="object"&&J==null&&(J=X.date),J==null||J==="")return null;const tt=o(J);return Number.isFinite(tt)?{type:G,date:tt}:null}function P(N,X){return N?h(N[X])??0:0}function x(N,X,G={}){const J={projectStart:G.projectStart,deadline:G.deadline,calendar:G.calendar,fields:G.fields,calendars:G.calendars,resources:Array.isArray(G.resources)?G.resources:void 0,skipCriticalPaths:!0},tt=G.priorityField||"priority",ft=G.maxIterations!=null?G.maxIterations:Math.max(100,N.length*N.length*2),st=l(G.fields),ht=N.map(mt=>({...mt})),Pt=ht.map(mt=>String(st(mt))),wt=new Map(ht.map(mt=>[String(st(mt)),mt])),Jt=new Map(Pt.map((mt,yt)=>[mt,yt])),dt=mt=>Jt.has(mt)?Jt.get(mt):-1;let nt=Y(ht,X,J);if(!nt.ok)return{ok:!1,error:nt.error};const ot=new Map;for(const mt of nt.order){const yt=nt.tasks.get(mt);yt&&!yt.isSummary&&!yt.unscheduled&&ot.set(mt,yt.es)}const vt=h(G.defaultCapacity)??1,pt=z(G.resources,vt,{calendar:G.calendar,calendars:G.calendars,hoursPerDay:G.hoursPerDay}),zt=G.calendar!=null?k(G.calendar,nt.projectStart):null,Ot=(mt,yt,Q)=>{const Mt=m(yt).map(Rt=>pt.get(Rt.resource)).filter(Rt=>Rt&&Rt.hasCalendar);let Lt=Math.round(mt);for(let Rt=0;Rt<3660;Rt+=1){if((Q?Q(Lt):!zt||zt.isWorking(Lt))&&Mt.every(Zt=>Zt.worksOn(Lt)))return Lt;Lt+=1}return Math.round(mt)};let et=0;const gt=Math.max(32,N.length*2);let q=1/0,jt=0;for(;et<ft;et+=1){const mt=at(ht,nt,G);mt.overAllocations.length<q?(q=mt.overAllocations.length,jt=0):jt+=1;const yt=mt.overAllocations.filter(Vt=>new Set(Vt.taskIds).size>=2);if(!yt.length)return{ok:!0,resolved:mt.overAllocations.length===0,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:mt.overAllocations,iterations:et};if(jt>=gt)return U("gantt-level-unresolved",`[lattice] gantt: resource leveling could not clear ${mt.overAllocations.length} over-allocation(s) after ${et} iterations; the plan cannot be fully levelled, returning the partial result.`),{ok:!0,resolved:!1,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:mt.overAllocations,iterations:et};const Mt=yt.slice().sort((Vt,xt)=>Vt.start-xt.start||xt.load-Vt.load)[0].taskIds.map(Vt=>nt.tasks.get(Vt)).filter(Boolean),Lt=Mt.filter(Vt=>!Ft(wt.get(Vt.id)));if(!Lt.length)return{ok:!0,resolved:!1,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:mt.overAllocations,iterations:et};Lt.sort((Vt,xt)=>{if(xt.totalFloat!==Vt.totalFloat)return xt.totalFloat-Vt.totalFloat;const Ht=P(wt.get(Vt.id),tt),ge=P(wt.get(xt.id),tt);return Ht!==ge?Ht-ge:xt.es!==Vt.es?xt.es-Vt.es:dt(xt.id)-dt(Vt.id)});let Rt=null,Zt=null;for(const Vt of Lt){const xt=Mt.filter(qt=>qt.id!==Vt.id).map(qt=>qt.ef).filter(qt=>qt>Vt.es+H),Ht=xt.length?Math.min(...xt):Vt.es+1,ge=Ot(Ht,wt.get(Vt.id),nt.calendars instanceof Map?nt.calendars.get(Vt.calendar).isWorking:void 0),$e=D(wt.get(Vt.id));if(!($e&&($e.type==="SNLT"?ge:ge+(Vt.ef-Vt.es))>$e.date+H)){Rt=Vt,Zt=ge;break}}if(!Rt)return{ok:!0,resolved:!1,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:mt.overAllocations,iterations:et};if(wt.get(Rt.id).start=Zt,nt=Y(ht,X,J),!nt.ok)return{ok:!1,error:nt.error}}const Et=at(ht,nt,G);return Et.overAllocations.length&&U("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${ft}-iteration cap with ${Et.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:Et.overAllocations.length===0,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:Et.overAllocations,iterations:et}}function R(N,X){const G=[];for(const J of X.order){const tt=X.tasks.get(J);if(!tt||tt.isSummary||tt.unscheduled)continue;const ft=N.get(J);ft!=null&&tt.es>ft+H&&G.push({id:J,from:ft,to:tt.es,delay:tt.es-ft})}return G}}),ae("packages/modules/gantt/week.js",function(g,V){"use strict";Object.defineProperty(g,"EXPLICIT_WEEK_START_DAY",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"localeWeekStartDay",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"validWeekStartDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"resolveWeekStartDay",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"weekStartOf",{enumerable:!0,get:function(){return v}});const U=V("packages/modules/gantt/time.js").fromDayNumber,K=Symbol("gantt.explicitWeekStartDay"),Y=new Set(["US","CA","MX","BR","AR","CO","VE","EC","PE","CL","IL","JP","KR","TW","HK","PH","ZA","EG"]);function H(m){if(!m||typeof m!="string")return null;try{const w=new Intl.Locale(m),k=w.weekInfo??(typeof w.getWeekInfo=="function"?w.getWeekInfo():null);if(k&&Number.isFinite(k.firstDay))return k.firstDay===7?0:k.firstDay;const u=w.region||m.split(/[-_]/).find(f=>f.length===2);if(u)return Y.has(u.toUpperCase())?0:1}catch{}return null}function l(m){return Number.isFinite(m)&&m>=0&&m<=6?Math.floor(m):null}function L(m,w){const k=l(m);if(k!=null)return k;const u=H(w);return u??0}function v(m,w){const k=U(m),u=k?k.getUTCDay():0;return m-((u-w)%7+7)%7}}),ae("packages/modules/gantt/workload.js",function(g,V){"use strict";Object.defineProperty(g,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"HISTOGRAM_DEFAULTS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"normalizeThresholds",{enumerable:!0,get:function(){return a}}),Object.defineProperty(g,"thresholdFor",{enumerable:!0,get:function(){return o}}),Object.defineProperty(g,"normalizeExternalLoad",{enumerable:!0,get:function(){return $}}),Object.defineProperty(g,"statedHours",{enumerable:!0,get:function(){return y}}),Object.defineProperty(g,"taskContour",{enumerable:!0,get:function(){return i}}),Object.defineProperty(g,"contourTotal",{enumerable:!0,get:function(){return r}}),Object.defineProperty(g,"serializeContour",{enumerable:!0,get:function(){return b}}),Object.defineProperty(g,"contourSpan",{enumerable:!0,get:function(){return T}}),Object.defineProperty(g,"spanDuration",{enumerable:!0,get:function(){return j}}),Object.defineProperty(g,"spreadHours",{enumerable:!0,get:function(){return I}}),Object.defineProperty(g,"setContourBucket",{enumerable:!0,get:function(){return O}}),Object.defineProperty(g,"retimeContour",{enumerable:!0,get:function(){return z}}),Object.defineProperty(g,"recordWorkingDays",{enumerable:!0,get:function(){return W}}),Object.defineProperty(g,"workloadBuckets",{enumerable:!0,get:function(){return B}}),Object.defineProperty(g,"taskAssignmentEffort",{enumerable:!0,get:function(){return at}}),Object.defineProperty(g,"computeWorkload",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(g,"formatHours",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(g,"formatPercent",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(g,"formatCost",{enumerable:!0,get:function(){return Ft}});const St=V("packages/modules/gantt/resources.js"),U=St.parseAssignments,K=St.rateOn,Y=V("packages/modules/gantt/schedule.js"),H=Y.EPS,l=Y.taskIdReader,L=V("packages/modules/gantt/time.js"),v=L.fromDayNumber,m=L.toDayNumber,w=L.toISODate,u=V("packages/core/src/internal/warn.js").warnOnce,d=V("packages/modules/gantt/week.js").weekStartOf,S=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0,maxHeight:null,unit:"hours",thresholds:null,showUnassigned:!0,labelWidth:null}),_=Object.freeze({resources:null,unit:"hours",stacked:!1,height:160,rowHeight:48,maxHeight:null,labelWidth:null});function C(D){if(D==null||D===""||typeof D=="boolean")return null;const P=typeof D=="number"?D:Number(D);return Number.isFinite(P)?P:null}function a(D){if(!Array.isArray(D))return null;const P=[];for(const x of D){if(!x||typeof x!="object")continue;const R=C(x.at);if(R==null||R<0)continue;const N=typeof x.className=="string"&&x.className?x.className:null,X=typeof x.colour=="string"&&x.colour?x.colour:typeof x.color=="string"&&x.color?x.color:null;!N&&!X||P.push({at:R,className:N,colour:X})}return P.length?(P.sort((x,R)=>x.at-R.at),P):null}function o(D,P){if(!D||P==null||!Number.isFinite(P))return null;let x=null;for(const R of D)if(P>=R.at)x=R;else break;return x}function p(D,P){if(D==null||D==="")return null;if(typeof D=="number")return Number.isFinite(D)?D:null;const x=m(D);return Number.isFinite(x)?x-P:null}function $(D,P=0){if(!Array.isArray(D))return[];const x=[];for(let R=0;R<D.length;R+=1){const N=D[R],X=N&&typeof N=="object"&&N.resource!=null&&N.resource!==""?String(N.resource):null,G=N&&typeof N=="object"?p(N.start,P):null,J=N&&typeof N=="object"?p(N.end,P):null;if(X==null||G==null||J==null){u(`gantt.workloadExternal.${R}`,`[lattice] gantt: workload.external entry ${R} has no resource or no drawable start/end; it is skipped.`);continue}const tt=typeof N.label=="string"&&N.label!==""?N.label:null,ft=typeof N.group=="string"&&N.group!==""?N.group:null;x.push({index:R,resource:X,start:G,end:J,units:C(N.units),hours:C(N.hours),label:tt,group:ft})}return x}function h(D){const P=m(D.start);if(!Number.isFinite(P))return null;const x=m(D.end);if(Number.isFinite(x))return{es:P,ef:x};const R=C(D.duration);return{es:P,ef:P+(R??0)}}function y(D){if(!D||Array.isArray(D.work))return null;const P=C(D.work);return P??C(D.hours)}function i(D){if(!D||!Array.isArray(D.work))return null;const P=[];for(const R of D.work){if(!R||typeof R!="object")continue;const N=m(R.date),X=C(R.hours);N==null||X==null||P.push({day:Math.round(N),hours:X})}P.sort((R,N)=>R.day-N.day);const x=[];for(const R of P){const N=x[x.length-1];N&&N.day===R.day?N.hours+=R.hours:x.push({day:R.day,hours:R.hours})}return x}function r(D){return(Array.isArray(D)?D:[]).reduce((P,x)=>P+(C(x.hours)??0),0)}function b(D){const P=[];for(const x of Array.isArray(D)?D:[]){const R=C(x.hours);if(R==null||!(Math.abs(R)>H))continue;const N=w(x.day);N!=null&&P.push({date:N,hours:Math.round(R*1e6)/1e6})}return P}function T(D){const P=(Array.isArray(D)?D:[]).filter(x=>Math.abs(C(x.hours)??0)>H);return P.length?{first:P[0].day,last:P[P.length-1].day}:null}function j(D,P,x=null){if(!Number.isFinite(D)||!Number.isFinite(P)||P<D)return 0;if(typeof x!="function")return Math.round(P-D)+1;let R=0;for(let N=Math.round(D);N<=Math.round(P);N+=1)x(N)&&(R+=1);return R}function I(D,P){if(!Array.isArray(D)||!D.length)return[];const x=P/D.length;return D.map(R=>({day:R,hours:x}))}function O(D,P,x,R){const N=(Array.isArray(D)?D:[]).filter(G=>!(G.day>=P.start&&G.day<P.end)),X=Math.abs(R)>H?I(x,R):[];return[...N,...X].sort((G,J)=>G.day-J.day)}function z(D,P,x){const R=Array.isArray(P)?P:[],N=Array.isArray(x)?x:[];if(!Array.isArray(D)||!R.length||!N.length)return Array.isArray(D)?D:[];const X=new Map(D.map(ft=>[ft.day,C(ft.hours)??0])),G=R.map(ft=>X.get(ft)??0),J=G.length,tt=[];for(let ft=0;ft<N.length;ft+=1){const st=G[Math.min(J-1,Math.floor(ft*J/N.length))];Math.abs(st)>H&&tt.push({day:N[ft],hours:st})}return tt}function W(D,P=null){const x=[];if(!D||!Number.isFinite(D.es)||!Number.isFinite(D.ef))return x;for(let R=Math.floor(D.es);R<Math.ceil(D.ef);R+=1)(typeof P!="function"||P(R))&&x.push(R);return x}function B(D,P,x,R=0){const N=Math.floor(P),X=Math.ceil(x),G=[];if(!(X>N))return G;if(D==="day"){for(let tt=N;tt<X;tt+=1)G.push({start:tt,end:tt+1});return G}if(D==="month"||D==="quarter"){const tt=v(N);if(!tt)return G;let ft=Date.UTC(tt.getUTCFullYear(),tt.getUTCMonth(),1)/864e5;for(;ft<X;){const st=v(ft),ht=Date.UTC(st.getUTCFullYear(),st.getUTCMonth()+1,1)/864e5;G.push({start:ft,end:ht}),ft=ht}return G}let J=d(N,R);for(;J<X;J+=7)G.push({start:J,end:J+7});return G}function at(D,P,x={}){const R=C(x.hoursPerDay)??S.hoursPerDay,N=typeof x.isWorking=="function"?x.isWorking:null,X=W(P,N),G=i(D);if(!G&&!X.length)return[];const J=U(D),tt=J.length?J:[{resource:null,units:1}],ft=tt.reduce((ht,Pt)=>ht+(C(Pt.units)??0),0);if(!(ft>0))return[];let st;if(G)st=G.filter(ht=>Math.abs(ht.hours)>H);else{const ht=y(D),Pt=ht??X.length*R*ft;if(!(Math.abs(Pt)>H))return[];st=I(X,Pt)}return st.length?tt.map(ht=>{const Pt=C(ht.units)??0,wt=Pt/ft;return{resource:ht.resource,units:Pt,unitsTotal:ft,perDay:wt>0?st.map(Jt=>({day:Jt.day,hours:Jt.hours*wt})):[]}}):[]}function ct(D,P,x={}){const R=Array.isArray(x.buckets)?x.buckets:[],N={ok:!1,buckets:[],rows:[],totals:R.map(()=>null),totalsAvailable:R.map(()=>null),totalsCost:R.map(()=>null),grandTotal:0,grandAvailableTotal:null,grandCostTotal:null};if(!P||!P.ok)return N;const X=C(x.hoursPerDay)??S.hoursPerDay,G=typeof x.isWorking=="function"?x.isWorking:null,J=x.capacities instanceof Map?x.capacities:null,tt=x.resourceModels instanceof Map?x.resourceModels:null,ft=x.resourceRates instanceof Map?x.resourceRates:null,st=l(x.fields),ht=new Map,Pt=(mt,yt,Q,Mt)=>{ht.has(mt)||ht.set(mt,{days:new Map,costs:new Map,tasks:new Map});const Lt=ht.get(mt);if(Lt.days.set(yt,(Lt.days.get(yt)||0)+Q),ft&&mt!=null){const Zt=K(ft.get(mt),yt);Zt!=null&&Lt.costs.set(yt,(Lt.costs.get(yt)||0)+Q*Zt)}Lt.tasks.has(Mt.id)||Lt.tasks.set(Mt.id,{...Mt,days:new Map});const Rt=Lt.tasks.get(Mt.id);Rt.days.set(yt,(Rt.days.get(yt)||0)+Q)},wt=new Map;for(const mt of Array.isArray(D)?D:[]){const yt=mt?st(mt):null;yt!=null&&wt.set(String(yt),mt)}const Jt=Array.isArray(D)&&P.order.length===D.length;for(let mt=0;mt<P.order.length;mt+=1){const yt=P.order[mt],Q=P.tasks.get(yt);if(!Q||Q.isSummary||Q.unscheduled||Q.inactive)continue;const Mt=wt.get(yt)||(Jt?D[mt]:null);if(!Mt||Mt.loadOnly===!0)continue;const Lt=P.calendars instanceof Map?P.calendars.get(Q.calendar):null,Rt=at(Mt,Q,{hoursPerDay:X,isWorking:Lt?Lt.isWorking:G});for(const Zt of Rt){if(!Zt.perDay.length)continue;const Vt={id:yt,name:Q.name,units:Zt.units,unitsTotal:Zt.unitsTotal,raw:Mt,loadOnly:!1,external:!1,group:null};for(const xt of Zt.perDay)Pt(Zt.resource,xt.day,xt.hours,Vt)}}for(const mt of Array.isArray(D)?D:[]){if(!mt||mt.loadOnly!==!0)continue;const yt=h(mt);if(!yt)continue;const Q=st(mt),Mt=Q!=null?String(Q):`loadOnly:${D.indexOf(mt)}`,Lt=mt.name!=null?String(mt.name):Mt,Rt=at(mt,yt,{hoursPerDay:X,isWorking:G});for(const Zt of Rt){if(!Zt.perDay.length)continue;const Vt={id:Mt,name:Lt,units:Zt.units,unitsTotal:Zt.unitsTotal,raw:mt,loadOnly:!0,external:!1,group:null};for(const xt of Zt.perDay)Pt(Zt.resource,xt.day,xt.hours,Vt)}}for(const mt of Array.isArray(x.external)?x.external:[]){if(!mt||mt.resource==null)continue;const yt=C(mt.start),Q=C(mt.end);if(yt==null||Q==null)continue;const Mt=W({es:yt,ef:Q},G),Lt=mt.hours!=null?C(mt.hours):Mt.length*X*(C(mt.units)??1);if(Lt==null||!(Math.abs(Lt)>H)||!Mt.length)continue;const Zt={id:`external:${mt.index??D.length}`,name:mt.label,units:null,unitsTotal:null,raw:null,loadOnly:!0,external:!0,group:mt.group??null};for(const Vt of I(Mt,Lt))Pt(String(mt.resource),Vt.day,Vt.hours,Zt)}const dt=mt=>{let yt=0,Q=R.length-1;for(;yt<=Q;){const Mt=yt+Q>>1;if(mt<R[Mt].start)Q=Mt-1;else if(mt>=R[Mt].end)yt=Mt+1;else return Mt}return-1},nt=R.map(mt=>{let yt=0;for(let Q=Math.floor(mt.start);Q<Math.ceil(mt.end);Q+=1)(!G||G(Q))&&(yt+=1);return{start:mt.start,end:mt.end,workingDays:yt}}),ot=mt=>{const yt=nt.map(()=>0);for(const[Q,Mt]of mt){const Lt=dt(Q);Lt>=0&&(yt[Lt]+=Mt)}return yt},vt=[...ht.keys()].filter(mt=>mt!=null).sort(),pt=ht.has(null)?[...vt,null]:vt,zt=[],Ot=nt.map(()=>0),et=nt.map(()=>null),gt=ft?nt.map(()=>0):nt.map(()=>null);let q=0,jt=ft?0:null;for(const mt of pt){const yt=ht.get(mt),Q=ot(yt.days),Mt=ft?ot(yt.costs):null,Lt=mt!=null&&J&&J.has(mt)?J.get(mt):null,Rt=mt!=null&&tt?tt.get(mt):null,Zt=Q.map(se=>Math.abs(se)>H?se:null),Vt=Q.map((se,It)=>{if(Rt&&Rt.hasCalendar){let ie=0;for(let Yt=Math.floor(nt[It].start);Yt<Math.ceil(nt[It].end);Yt+=1)(!G||G(Yt))&&(ie+=Rt.capacityHoursOn(Yt));return ie}return Lt==null?null:Lt*X*nt[It].workingDays}),xt=Q.map((se,It)=>Vt[It]!=null&&se>Vt[It]+H);let Ht=0,ge=null,$e=ft?0:null;Q.forEach((se,It)=>{Ht+=se,Ot[It]+=se,Vt[It]!=null&&(ge=(ge??0)+Vt[It],et[It]=(et[It]??0)+Vt[It]),Mt&&($e+=Mt[It],gt[It]+=Mt[It])}),q+=Ht,ft&&(jt+=$e);const qt=[...yt.tasks.values()].map(se=>{const It=ot(se.days);return{id:se.id,name:se.name,units:se.units,unitsTotal:se.unitsTotal,raw:se.raw,cells:It.map(ie=>Math.abs(ie)>H?ie:null),total:It.reduce((ie,Yt)=>ie+Yt,0),loadOnly:!!se.loadOnly,external:!!se.external,group:se.group??null}});zt.push({resource:mt,capacity:Lt,available:Vt,availableTotal:ge,cells:Zt,over:xt,total:Ht,costCells:Mt?Mt.map(se=>Math.abs(se)>H?se:null):null,costTotal:$e,tasks:qt})}let Et=null;for(const mt of et)mt!=null&&(Et=(Et??0)+mt);return{ok:!0,buckets:nt,rows:zt,totals:Ot.map(mt=>Math.abs(mt)>H?mt:null),totalsAvailable:et,totalsCost:gt,grandTotal:q,grandAvailableTotal:Et,grandCostTotal:jt}}function kt(D,P){if(D==null||!Number.isFinite(D))return"";const R=10**(Number.isFinite(P)?Math.max(0,Math.min(6,Math.round(P))):1),N=Math.round(D*R)/R;return Object.is(N,-0)||N===0?"0":String(N)}function Tt(D,P,x){if(P==null||!(P>H))return"–";const R=Number.isFinite(D)?D:0;return kt(R/P*100,x)}function Ft(D,P=2){return kt(D,P)}}),ae("packages/modules/gantt/cost.js",function(g,V){"use strict";Object.defineProperty(g,"computeCost",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"bucketCost",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"computeCostByBucket",{enumerable:!0,get:function(){return C}});const St=V("packages/modules/gantt/resources.js"),U=St.parseAssignments,K=St.normalizeResourceRates,Y=St.rateOn,H=V("packages/modules/gantt/workload.js"),l=H.taskAssignmentEffort,L=H.workloadBuckets,m=V("packages/modules/gantt/schedule.js").taskIdReader,k=V("packages/modules/gantt/time.js").toDayNumber;function u(a){if(a==null||a==="")return null;const o=typeof a=="number"?a:Number(a);return Number.isFinite(o)?o:null}function f(a,o,p,$){const h=u(a?a[$.costField]:null)??0;let y=0,i=!1;const r=U(a),T=r.some(j=>{const I=p.get(j.resource);return!I||I.type==="work"})?l(a,o,{hoursPerDay:$.hoursPerDay,isWorking:$.isWorking}):null;for(let j=0;j<r.length;j+=1){const I=r[j],O=p.get(I.resource);if(O)if(O.type==="cost")O.cost!=null&&(y+=O.cost,i=!0);else if(O.type==="material"){const z=Y(O,Math.round(o.es));z!=null&&(y+=(u(I.units)??0)*z,i=!0)}else{const z=T?T[j]:null;if(!z)continue;for(const W of z.perDay){const B=Y(O,W.day);B!=null&&(y+=W.hours*B,i=!0)}}}return{cost:h+y,rateCost:y,fixedCost:h,hasRate:i}}function d(a,o,p={}){if(!o||!o.ok||!o.tasks||!o.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"cost needs a successful schedule"}};const $=p.costField||"cost",h=u(p.hoursPerDay)??8,y=typeof p.isWorking=="function"?p.isWorking:null,i=p.resourceRates instanceof Map?p.resourceRates:K(p.resources),r=m(p.fields),b=new Map;for(const W of Array.isArray(a)?a:[]){const B=r(W);B!=null&&b.set(String(B),W)}const T=()=>({cost:0,rateCost:0,fixedCost:0,hasRate:!1}),j=new Map;for(const W of o.order)j.set(W,T());const I=T();for(const W of o.order){const B=o.tasks.get(W);if(!B||B.isSummary||B.unscheduled||B.inactive)continue;const at=f(b.get(W),B,i,{hoursPerDay:h,isWorking:y,costField:$});let ct=W;for(;ct!=null&&j.has(ct);){const kt=j.get(ct);kt.cost+=at.cost,kt.rateCost+=at.rateCost,kt.fixedCost+=at.fixedCost,at.hasRate&&(kt.hasRate=!0),ct=o.tasks.get(ct).parent}I.cost+=at.cost,I.rateCost+=at.rateCost,I.fixedCost+=at.fixedCost,at.hasRate&&(I.hasRate=!0)}const O=new Map,z=[];for(const W of o.order){const B=o.tasks.get(W),at=j.get(W),ct={id:B.id,name:B.name,isSummary:!!B.isSummary,isMilestone:!!B.isMilestone,cost:at.cost,rateCost:at.rateCost,fixedCost:at.fixedCost,hasRate:at.hasRate};O.set(W,ct),z.push(ct)}return{ok:!0,byTask:O,rows:z,project:{...I}}}function S(a,o){const p=o.map(()=>0);if(!a||!a.size)return p;const $=[...a.entries()].sort((y,i)=>y[0]-i[0]);let h=0;for(const[y,i]of $){for(;h<o.length&&y>=o[h].end;)h+=1;if(h>=o.length)break;y>=o[h].start&&(p[h]+=i)}return p}function _(a,o,p={}){const $=u(p.hoursPerDay)??8,h=typeof p.isWorking=="function"?p.isWorking:null,y=p.resourceRates instanceof Map?p.resourceRates:K(p.resources),i=m(p.fields),r=new Map;for(const z of Array.isArray(a)?a:[]){const W=i(z);W!=null&&r.set(String(W),z)}const b=new Map;for(const z of o.order)b.set(z,new Map);const T=new Map,j=new Map,I=(z,W,B)=>z.set(W,(z.get(W)||0)+B),O=z=>(T.has(z)||T.set(z,new Map),T.get(z));for(const z of o.order){const W=o.tasks.get(z);if(!W||W.isSummary||W.unscheduled||W.inactive)continue;const B=r.get(z);if(!B)continue;const at=U(B),kt=at.some(D=>{const P=y.get(D.resource);return!P||P.type==="work"})?l(B,W,{hoursPerDay:$,isWorking:h}):null,Tt=Math.round(W.es),Ft=new Map;for(let D=0;D<at.length;D+=1){const P=at[D],x=y.get(P.resource);if(x)if(x.type==="cost")x.cost!=null&&(I(Ft,Tt,x.cost),I(O(P.resource),Tt,x.cost));else if(x.type==="material"){const R=Y(x,Tt);if(R!=null){const N=(u(P.units)??0)*R;I(Ft,Tt,N),I(O(P.resource),Tt,N)}}else{const R=kt?kt[D]:null;if(!R)continue;for(const N of R.perDay){const X=Y(x,N.day);if(X!=null){const G=N.hours*X;I(Ft,N.day,G),I(O(P.resource),N.day,G)}}}}for(const[D,P]of Ft){let x=z;for(;x!=null&&b.has(x);)I(b.get(x),D,P),x=o.tasks.get(x).parent;I(j,D,P)}}return{byTask:b,byResource:T,project:j}}function C(a,o,p={}){if(!o||!o.ok||!o.tasks||!o.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"cost by bucket needs a successful schedule"}};const $=p.from!=null?k(p.from):null,h=p.to!=null?k(p.to):null,y=Math.floor($??o.projectStart),i=Math.ceil(h??o.projectFinish),r=p.zoom==null?"day":p.zoom,b=p.by==="resource"||p.by==="project"?p.by:"task",T=Number.isFinite(Number(p.weekStartDay))?Number(p.weekStartDay):0,j=L(r,y,i,T),I=_(a,o,p),O=kt=>S(kt,j),z=kt=>kt.reduce((Tt,Ft)=>Tt+Ft,0),W=new Map,B=new Map,at=[],ct=O(I.project);if(b==="resource")for(const kt of[...I.byResource.keys()].sort()){const Tt=O(I.byResource.get(kt));B.set(kt,Tt),at.push({key:kt,label:kt,cells:Tt,total:z(Tt)})}else if(b==="project")at.push({key:"project",label:"Project",cells:ct,total:z(ct)});else for(const kt of o.order){const Tt=o.tasks.get(kt),Ft=O(I.byTask.get(kt)||new Map);W.set(kt,Ft),at.push({key:kt,label:Tt?String(Tt.name??kt):kt,cells:Ft,total:z(Ft)})}return{ok:!0,buckets:j,rows:at,byTask:W,byResource:B,total:ct,projectTotal:z(ct)}}}),ae("packages/modules/gantt/earned-value.js",function(g,V){"use strict";Object.defineProperty(g,"computeEarnedValue",{enumerable:!0,get:function(){return w}});const U=V("packages/modules/gantt/time.js").toDayNumber,Y=V("packages/modules/gantt/schedule.js").taskIdReader,H=1e-9;function l(k){if(k==null||k==="")return null;const u=typeof k=="number"?k:Number(k);return Number.isFinite(u)?u:null}function L(k,u,f){return f-u<=H?k>=f?1:0:k<=u?0:k>=f?1:(k-u)/(f-u)}function v(k,u,f,d,S,_){const C=u?l(u[d]):null,a=C??(_&&_.hasRate?_.cost:k.duration),o=u?l(u[S]):null,p=k.percentComplete==null?0:Math.max(0,Math.min(100,k.percentComplete))/100,$=k.baselineStart!=null||k.baselineEnd!=null,h=k.baselineStart!=null?k.baselineStart:k.es,y=k.baselineEnd!=null?k.baselineEnd:k.ef,i=a*L(f,h,y),r=a*p;return{bac:a,pv:i,ev:r,ac:o,hasBaseline:$}}function m(k){const u=k.ac;return{bac:k.bac,pv:k.pv,ev:k.ev,ac:u,sv:k.ev-k.pv,cv:u==null?null:k.ev-u,spi:Math.abs(k.pv)<H?null:k.ev/k.pv,cpi:u==null||Math.abs(u)<H?null:k.ev/u}}function w(k,u,f={}){if(!u||!u.ok||!u.tasks||!u.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const d=f.costField||"cost",S=f.actualCostField||"actualCost",_=f.statusDate==null?u.projectFinish:U(f.statusDate)??u.projectFinish,C=f.rateCosts instanceof Map?f.rateCosts:null,a=Y(f.fields),o=new Map;for(const b of Array.isArray(k)?k:[]){const T=a(b);T!=null&&o.set(String(T),b)}const p=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),$=new Map;for(const b of u.order)$.set(b,p());const h=p();for(const b of u.order){const T=u.tasks.get(b);if(!T||T.isSummary||T.unscheduled||T.inactive)continue;const j=v(T,o.get(b),_,d,S,C?C.get(b):null);let I=b;for(;I!=null&&$.has(I);){const O=$.get(I);O.bac+=j.bac,O.pv+=j.pv,O.ev+=j.ev,j.ac!=null&&(O.ac+=j.ac,O.acAny=!0),j.hasBaseline&&(O.hasBaseline=!0),I=u.tasks.get(I).parent}h.bac+=j.bac,h.pv+=j.pv,h.ev+=j.ev,j.ac!=null&&(h.ac+=j.ac,h.acAny=!0),j.hasBaseline&&(h.hasBaseline=!0)}const y=b=>m({bac:b.bac,pv:b.pv,ev:b.ev,ac:b.acAny?b.ac:null}),i=new Map,r=[];for(const b of u.order){const T=u.tasks.get(b),j=$.get(b),I={id:T.id,name:T.name,isSummary:!!T.isSummary,isMilestone:!!T.isMilestone,percentComplete:T.percentComplete??null,hasBaseline:j.hasBaseline,hasActualCost:j.acAny,...y(j)};i.set(b,I),r.push(I)}return{ok:!0,statusDate:_,byTask:i,rows:r,project:{hasActualCost:h.acAny,hasBaseline:h.hasBaseline,...y(h)}}}}),ae("packages/modules/gantt/wbs.js",function(g,V){"use strict";Object.defineProperty(g,"deriveWbs",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"compareWbs",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"isWbsCode",{enumerable:!0,get:function(){return K}});function St(Y,H,l){const L=new Map,v=[];for(const k of Y){const u=H(k);if(u==null){v.push(k);continue}L.has(u)||L.set(u,[]),L.get(u).push(k)}const m=new Map,w=(k,u)=>{k.forEach((f,d)=>{const S=l(f),_=S??(u!=null?`${u}.${d+1}`:String(d+1));m.set(f,_);const C=L.get(f);C&&C.length&&w(C,_)})};return w(v,null),m}function U(Y,H){const l=String(Y).split("."),L=String(H).split(".");for(let v=0;v<Math.min(l.length,L.length);v++){const m=l[v],w=L[v];if(m!==w)return/^\d+$/.test(m)&&/^\d+$/.test(w)?Number(m)-Number(w):m<w?-1:1}return l.length-L.length}function K(Y){return typeof Y=="string"&&/^\d+(\.\d+)*$/.test(Y)}}),ae("packages/modules/gantt/mspdi.js",function(g,V){"use strict";Object.defineProperty(g,"parseXml",{enumerable:!0,get:function(){return T}}),Object.defineProperty(g,"importMSPDI",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(g,"exportMSPDI",{enumerable:!0,get:function(){return x}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/modules/gantt/time.js"),Y=K.toDayNumber,H=K.toISODate,l=V("packages/modules/gantt/schedule.js"),L=l.taskIdReader,v=l.resolveConstraintCode,m=l.resolveSchedulingMode,k=V("packages/modules/gantt/task-calendars.js").resolveCalendars,f=V("packages/modules/gantt/wbs.js").deriveWbs,d=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),S=Object.freeze({FF:0,FS:1,SF:2,SS:3}),_=Object.freeze({0:"ASAP",1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on",4:"SNET",5:"SNLT",6:"FNET",7:"FNLT"}),C=Object.freeze({ASAP:0,ALAP:1,MSO:2,MFO:3,SNET:4,SNLT:5,FNET:6,FNLT:7}),a=Object.freeze({0:"fixedUnits",1:"fixedDuration",2:"fixedEffort"}),o=Object.freeze({fixedUnits:0,fixedDuration:1,fixedEffort:2}),p=Object.freeze({0:"material",1:"work",2:"cost"}),$=Object.freeze({material:0,work:1,cost:2});function h(st){if(st==null)return null;const ht=/^(-?[0-9.]+)/.exec(String(st).trim());if(!ht)return null;const Pt=Number(ht[1]);return Number.isFinite(Pt)?Pt:null}function y(st){if(st==null||st==="")return null;const ht=typeof st=="number"?st:Number(st);return Number.isFinite(ht)?ht:null}function i(st){return String(st).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(ht,Pt)=>{if(Pt[0]==="#"){const wt=Pt[1]==="x"||Pt[1]==="X"?parseInt(Pt.slice(2),16):parseInt(Pt.slice(1),10);return Number.isFinite(wt)?String.fromCodePoint(wt):ht}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[Pt]??ht})}function r(st){return String(st??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function b(st){const ht=st.indexOf(":");return ht<0?st:st.slice(ht+1)}function T(st){const ht=String(st);let Pt=0;const wt=[];let Jt=null;for(;Pt<ht.length;){const dt=ht.indexOf("<",Pt);if(dt<0)break;if(dt>Pt&&wt.length){const gt=ht.slice(Pt,dt);gt.trim()&&(wt[wt.length-1].text+=i(gt))}if(ht.startsWith("<?",dt)){const gt=ht.indexOf("?>",dt);Pt=gt<0?ht.length:gt+2;continue}if(ht.startsWith("<!--",dt)){const gt=ht.indexOf("-->",dt);Pt=gt<0?ht.length:gt+3;continue}if(ht.startsWith("<![CDATA[",dt)){const gt=ht.indexOf("]]>",dt);wt.length&&(wt[wt.length-1].text+=ht.slice(dt+9,gt<0?ht.length:gt)),Pt=gt<0?ht.length:gt+3;continue}if(ht.startsWith("<!",dt)){const gt=ht.indexOf(">",dt);Pt=gt<0?ht.length:gt+1;continue}const nt=ht.indexOf(">",dt);if(nt<0)break;let ot=ht.slice(dt+1,nt).trim();if(ot[0]==="/"){wt.pop(),Pt=nt+1;continue}const vt=ot.endsWith("/");vt&&(ot=ot.slice(0,-1).trim());const pt=ot.search(/\s/),zt=b(pt<0?ot:ot.slice(0,pt)),Ot={};if(pt>=0)for(const gt of ot.slice(pt).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))Ot[b(gt[1]??gt[3])]=i(gt[2]??gt[4]??"");const et={name:zt,attrs:Ot,children:[],text:""};wt.length?wt[wt.length-1].children.push(et):Jt||(Jt=et),vt||wt.push(et),Pt=nt+1}return Jt}function j(st,ht){return st?st.children.find(Pt=>Pt.name===ht):void 0}function I(st,ht){return st?st.children.filter(Pt=>Pt.name===ht):[]}function O(st,ht){const Pt=j(st,ht);return Pt?Pt.text.trim():void 0}function z(st){if(!st)return null;const ht=String(st).match(/^\d{4}-\d{2}-\d{2}/);return Y(ht?ht[0]:st)}function W(st,ht){return`${H(st)}T${String(ht).padStart(2,"0")}:00:00`}function B(st,ht){if(!st)return null;const Pt=String(st).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return Pt?((Number(Pt[1])||0)+(Number(Pt[2])||0)/60+(Number(Pt[3])||0)/3600)/ht:null}function at(st,ht){return`PT${Math.round((st||0)*ht*1e3)/1e3}H0M0S`}function ct(st,ht){return(Number(st)||0)/(600*ht)}function kt(st,ht){return Math.round((st||0)*10*60*ht)}function Tt(st,ht={}){const Pt=ht.hoursPerDay??8,wt=T(st);if(!wt||wt.name!=="Project")return U("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 Jt=z(O(wt,"StartDate")),dt=j(wt,"Resources"),nt=j(wt,"Calendars"),ot=I(nt,"Calendar"),vt=new Map,pt=[];for(const qt of I(dt,"Resource")){const se=O(qt,"UID"),It=O(qt,"Name");if(se==null||It==null||It==="")continue;vt.set(se,It);const ie=O(qt,"MaxUnits"),Yt=O(qt,"CalendarUID"),lt=Yt!=null?P(ot,Yt,Pt):null,bt={id:It,name:It,capacity:ie==null?1:Number(ie)};lt&&(bt.calendar=lt.calendar,ie==null||Math.abs(Number(ie)-1)<1e-9?delete bt.capacity:bt.capacity=Number(ie)*lt.fullDayHours);const Ct=p[Number(O(qt,"Type"))];Ct&&Ct!=="work"&&(bt.type=Ct);const Dt=h(O(qt,"StandardRate"));Dt!=null&&(bt.rate=Dt);const Bt=O(qt,"Cost"),Ut=Bt==null?null:Number(Bt);Ut!=null&&Number.isFinite(Ut)&&(bt.cost=Ut),pt.push(bt)}const zt=j(wt,"Assignments"),Ot=new Map;for(const qt of I(zt,"Assignment")){const se=O(qt,"TaskUID"),It=O(qt,"ResourceUID"),ie=vt.get(It);if(se==null||ie==null)continue;const Yt=O(qt,"Units");Ot.has(se)||Ot.set(se,[]),Ot.get(se).push({resource:ie,units:Yt==null?1:Number(Yt)})}const et=j(wt,"Tasks"),gt=[],q=[],jt=new Map,Et=new Map,mt=[],yt={},Q=new Map,Mt=qt=>{if(Q.has(qt))return Q.get(qt);const se=P(ot,qt,Pt);let It=null;if(se){const ie=ot.find(Dt=>O(Dt,"UID")===qt),Yt=ie&&O(ie,"Name")||`calendar-${qt}`;It=Object.prototype.hasOwnProperty.call(yt,Yt)?`${Yt} (${qt})`:Yt;const{workingDays:lt,hoursPerDay:bt,holidays:Ct}=se.calendar;yt[It]={workdays:lt,...Ct?{holidays:Ct}:{holidays:[]},hoursPerDay:bt}}return Q.set(qt,It),It},Lt=new Map,Rt=[],Zt=[];for(const qt of I(et,"Task")){if(O(qt,"IsNull")==="1")continue;const se=O(qt,"UID");if(se==null||se==="0")continue;const It=se;Lt.set(se,It);const ie=Number(O(qt,"OutlineLevel"))||1;for(;Rt.length&&Rt[Rt.length-1].level>=ie;)Rt.pop();const Yt=Rt.length?Rt[Rt.length-1].uid:null;Rt.push({uid:se,level:ie});const lt=O(qt,"Summary")==="1",bt=O(qt,"Milestone")==="1",Ct={id:It,name:O(qt,"Name")??It};if(Yt&&(Ct.parent=Yt),bt&&(Ct.milestone=!0),!lt&&!bt){const Pe=B(O(qt,"Duration"),Pt);Pe!=null&&(Ct.duration=Pe)}const Dt=z(O(qt,"Start"));!lt&&Dt!=null&&(Ct.start=Dt);const Bt=O(qt,"PercentComplete");Bt!=null&&(Ct.percentComplete=Number(Bt));const Ut=O(qt,"WBS");if(Ut!=null&&Ut!==""&&(Ct.wbs=Ut),!lt){const Pe=O(qt,"Type");Pe!=null&&a[Number(Pe)]&&(Ct.schedulingMode=a[Number(Pe)]);const Ee=O(qt,"EffortDriven");Ee!=null&&(Ct.effortDriven=Ee==="1");const _e=B(O(qt,"Work"),Pt);_e!=null&&(Ct.effort=_e*Pt)}const oe=_[Number(O(qt,"ConstraintType"))];if(oe){Ct.constraint=oe;const Pe=z(O(qt,"ConstraintDate"));Pe!=null&&(Ct.constraintDate=Pe)}const de=z(O(qt,"Deadline"));de!=null&&(Ct.deadline=de),O(qt,"Active")==="0"&&(Ct.inactive=!0);const me=j(qt,"Baseline");if(me){const Pe=z(O(me,"Start")),Ee=z(O(me,"Finish"));Pe!=null&&(Ct.baselineStart=Pe),Ee!=null&&(Ct.baselineEnd=Ee)}const we=Ot.get(se);we&&we.length&&(Ct.assignments=we);const Fe=O(qt,"CalendarUID");if(Fe!=null&&Fe!==O(wt,"CalendarUID")&&!lt){const Pe=Mt(Fe);Pe!=null&&(Ct.calendar=Pe)}gt.push(Ct),q.push(It),jt.set(It,Yt),Et.set(Ct,It);for(const Pe of I(qt,"PredecessorLink"))Zt.push({raw:Pe,uid:se})}const Vt=f(q,qt=>jt.get(qt)||null,()=>null);for(const qt of gt)qt.wbs!==void 0&&qt.wbs===Vt.get(Et.get(qt))&&delete qt.wbs;for(const{raw:qt,uid:se}of Zt){const It=O(qt,"PredecessorUID"),ie=Lt.get(It),Yt=Lt.get(se);if(ie==null||Yt==null)continue;const lt=d[Number(O(qt,"Type")??1)]??"FS",bt=ct(O(qt,"LinkLag"),Pt),Ct={from:ie,to:Yt,type:lt};bt&&(Ct.lag=bt),mt.push(Ct)}const xt=Ft(wt),Ht=O(wt,"WeekStartDay"),ge=Ht!=null&&/^\d+$/.test(Ht.trim())?Math.min(6,Math.max(0,Number(Ht))):null,$e={ok:!0,tasks:gt,dependencies:mt,resources:pt};return Jt!=null&&($e.projectStart=Jt),xt&&($e.calendar=xt),ge!=null&&($e.weekStartDay=ge),Object.keys(yt).length&&($e.calendars=yt),$e}function Ft(st){const ht=j(st,"Calendars"),Pt=I(ht,"Calendar"),wt=O(st,"CalendarUID"),Jt=(wt!=null?Pt.find(zt=>O(zt,"UID")===wt):null)??Pt.find(zt=>O(zt,"IsBaseCalendar")!=="0");if(!Jt)return null;const dt=j(Jt,"WeekDays"),nt=[];let ot=!1;for(const zt of I(dt,"WeekDay")){const Ot=Number(O(zt,"DayType"));Ot>=1&&Ot<=7&&(ot=!0,O(zt,"DayWorking")==="1"&&nt.push(Ot-1))}const vt=[],pt=j(Jt,"Exceptions");for(const zt of I(pt,"Exception")){if(O(zt,"DayWorking")==="1")continue;const Ot=j(zt,"TimePeriod"),et=z(O(Ot,"FromDate")),gt=z(O(Ot,"ToDate"))??et;if(et!=null)for(let q=et;q<=gt;q+=1)vt.push(q)}return!ot&&!vt.length?null:{workdays:ot?nt:[1,2,3,4,5],holidays:vt}}function D(st){if(st==null)return null;const ht=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(String(st).trim());return ht?Number(ht[1])+Number(ht[2])/60+Number(ht[3]??0)/3600:null}function P(st,ht,Pt){const wt=st.find(Ot=>O(Ot,"UID")===ht);if(!wt)return null;const Jt=[],dt={};for(const Ot of I(j(wt,"WeekDays"),"WeekDay")){const et=Number(O(Ot,"DayType"));if(!(et>=1&&et<=7)||O(Ot,"DayWorking")!=="1")continue;const gt=et-1;Jt.push(gt);let q=0;for(const jt of I(j(Ot,"WorkingTimes"),"WorkingTime")){const Et=D(O(jt,"FromTime")),mt=D(O(jt,"ToTime"));Et!=null&&mt!=null&&mt>Et&&(q+=mt-Et)}dt[gt]=q>0?q:Pt}const nt=[];for(const Ot of I(j(wt,"Exceptions"),"Exception")){if(O(Ot,"DayWorking")==="1")continue;const et=j(Ot,"TimePeriod"),gt=z(O(et,"FromDate")),q=z(O(et,"ToDate"))??gt;if(gt!=null)for(let jt=gt;jt<=q;jt+=1)nt.push(jt)}if(!Jt.length&&!nt.length)return null;const ot=Jt.map(Ot=>dt[Ot]),vt=ot.length&&ot.every(Ot=>Math.abs(Ot-ot[0])<1e-9),pt={workingDays:Jt.slice().sort((Ot,et)=>Ot-et),hoursPerDay:vt?ot[0]:dt};nt.length&&(pt.holidays=nt);const zt=ot.reduce((Ot,et)=>Math.max(Ot,et),0)||Pt;return{calendar:pt,fullDayHours:zt}}function x(st,ht={}){const Pt=ht.hoursPerDay??8,wt=Array.isArray(st.tasks)?st.tasks:[],Jt=Array.isArray(st.dependencies)?st.dependencies:[],dt=Array.isArray(st.resources)?st.resources:st.resources&&typeof st.resources=="object"?Object.entries(st.resources).map(([xt,Ht])=>({id:xt,name:xt,capacity:Ht})):[],nt=st.schedule&&st.schedule.ok?st.schedule:null,ot=L(st.fields),vt=new Map;wt.forEach((xt,Ht)=>{const ge=String(ot(xt));vt.set(ge,/^\d+$/.test(ge)?ge:String(Ht+1))});const pt=new Map;for(const xt of wt){const Ht=xt.parent!=null?String(xt.parent):null;Ht&&(pt.has(Ht)||pt.set(Ht,[]),pt.get(Ht).push(String(ot(xt))))}const zt=xt=>pt.has(xt),Ot=xt=>{let Ht=1,ge=wt.find($e=>String(ot($e))===xt);for(;ge&&ge.parent!=null;)Ht+=1,ge=wt.find($e=>String(ot($e))===String(ge.parent));return Ht},et=f(wt.map(xt=>String(ot(xt))),xt=>{const Ht=wt.find(ge=>String(ot(ge))===xt);return Ht&&Ht.parent!=null?String(Ht.parent):null},xt=>{const Ht=wt.find(ge=>String(ot(ge))===xt);return Ht&&typeof Ht.wbs=="string"&&Ht.wbs.trim()!==""?Ht.wbs.trim():null}),gt=new Map;for(const xt of Jt){const Ht=String(xt.to);gt.has(Ht)||gt.set(Ht,[]),gt.get(Ht).push(xt)}const q=[];q.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),q.push('<Project xmlns="http://schemas.microsoft.com/project">'),q.push(` <Name>${r(ht.projectName||"Lattice Gantt export")}</Name>`);const jt=st.projectStart!=null?Y(st.projectStart):nt?nt.projectStart:null;jt!=null&&q.push(` <StartDate>${W(jt,8)}</StartDate>`),Number.isFinite(st.weekStartDay)&&st.weekStartDay>=0&&st.weekStartDay<=6&&q.push(` <WeekStartDay>${Math.floor(st.weekStartDay)}</WeekStartDay>`);const Et=N(st.calendar);Et&&q.push(" <CalendarUID>1</CalendarUID>");const mt=Pt;let yt=Et?2:1;const Q=k({calendar:st.calendar,calendars:st.calendars,tasks:wt.map(xt=>({id:String(ot(xt)),calendar:xt.calendar})).filter(xt=>xt.calendar!=null),resources:dt.map(xt=>({id:String(xt&&(xt.name??xt.id??xt.resource)),calendar:xt&&xt.calendar})).filter(xt=>xt.calendar!=null)}),Mt=new Map;for(const xt of dt){const Ht=xt&&(xt.name??xt.id??xt.resource);if(Ht==null||Ht==="")continue;const ge=xt.calendar&&typeof xt.calendar=="object"?xt.calendar:Q.resourceSpec.get(String(Ht));ge&&(Mt.set(String(Ht),{uid:yt,spec:X(ge,mt)}),yt+=1)}const Lt=new Map,Rt=new Map;for(const[xt,Ht]of Q.ofTask)if(Ht!=="plan"){if(!Lt.has(Ht)){const ge=Q.models.get(Ht),$e={workingDays:ge.workdays,holidays:ge.holidays,hoursPerDay:ge.hoursPerDay};Lt.set(Ht,{uid:yt,spec:X($e,mt)}),yt+=1}Rt.set(xt,Lt.get(Ht).uid)}if(Et||Mt.size||Lt.size){if(q.push(" <Calendars>"),Et){q.push(" <Calendar>"),q.push(" <UID>1</UID>"),q.push(" <Name>Standard</Name>"),q.push(" <IsBaseCalendar>1</IsBaseCalendar>"),q.push(" <WeekDays>");for(let xt=0;xt<=6;xt+=1){const Ht=Et.workdays.includes(xt);q.push(" <WeekDay>"),q.push(` <DayType>${xt+1}</DayType>`),q.push(` <DayWorking>${Ht?1:0}</DayWorking>`),q.push(" </WeekDay>")}if(q.push(" </WeekDays>"),Et.holidays.length){q.push(" <Exceptions>");for(const xt of Et.holidays)q.push(" <Exception>"),q.push(" <DayWorking>0</DayWorking>"),q.push(` <TimePeriod><FromDate>${W(xt,0)}</FromDate><ToDate>${W(xt,23)}</ToDate></TimePeriod>`),q.push(" </Exception>");q.push(" </Exceptions>")}q.push(" </Calendar>")}for(const[xt,Ht]of Mt)for(const ge of J(Ht.uid,xt,Ht.spec))q.push(ge);for(const[xt,Ht]of Lt)for(const ge of J(Ht.uid,xt,Ht.spec))q.push(ge);q.push(" </Calendars>")}q.push(" <Tasks>");for(const xt of wt){const Ht=String(ot(xt)),ge=vt.get(Ht),$e=zt(Ht),qt=!!xt.milestone||!$e&&Number(xt.duration)===0,se=nt?nt.tasks.get(Ht):null;q.push(" <Task>"),q.push(` <UID>${r(ge)}</UID>`),q.push(` <ID>${r(ge)}</ID>`),q.push(` <Name>${r(xt.name!=null?xt.name:Ht)}</Name>`),q.push(` <OutlineLevel>${Ot(Ht)}</OutlineLevel>`);const It=se&&se.wbs!=null?se.wbs:et.get(Ht);It!=null&&q.push(` <WBS>${r(It)}</WBS>`),q.push(` <Summary>${$e?1:0}</Summary>`),q.push(` <Milestone>${qt?1:0}</Milestone>`),q.push(` <Active>${xt.inactive===!0?0:1}</Active>`),Rt.has(Ht)&&q.push(` <CalendarUID>${Rt.get(Ht)}</CalendarUID>`);const ie=se?se.duration:xt.duration!=null?Number(xt.duration):null;ie!=null&&q.push(` <Duration>${at(ie,Pt)}</Duration>`),q.push(" <DurationFormat>7</DurationFormat>");const Yt=se?se.es:xt.start!=null?Y(xt.start):null,lt=se?se.ef:xt.end!=null?Y(xt.end):Yt!=null&&ie!=null?Yt+ie:null;Yt!=null&&q.push(` <Start>${W(Yt,8)}</Start>`),lt!=null&&q.push(` <Finish>${W(lt,17)}</Finish>`);const bt=se?se.percentComplete:xt.percentComplete;if(bt!=null&&q.push(` <PercentComplete>${Math.round(Number(bt))}</PercentComplete>`),!$e&&!qt){const oe=se&&se.schedulingMode||m(xt.schedulingMode??xt.taskType),de=se&&se.effortDriven!=null?se.effortDriven:xt.effortDriven!=null?!!xt.effortDriven:null,me=se&&se.effort!=null?se.effort:Number.isFinite(Number(xt.effort))?Number(xt.effort):typeof xt.work=="number"?xt.work:Number.isFinite(Number(xt.hours))?Number(xt.hours):null;(oe!=null||de!=null||me!=null)&&(oe!=null&&q.push(` <Type>${o[oe]}</Type>`),q.push(` <EffortDriven>${de?1:0}</EffortDriven>`),me!=null&&q.push(` <Work>${at(me/Pt,Pt)}</Work>`))}const Ct=tt(xt.constraint??xt.constraintType);if(Ct!=null){q.push(` <ConstraintType>${Ct}</ConstraintType>`);const oe=ft(xt.constraintDate??xt.constraintAt??xt.at??(xt.constraint&&typeof xt.constraint=="object"?xt.constraint.date:null));oe!=null&&q.push(` <ConstraintDate>${W(oe,8)}</ConstraintDate>`)}const Dt=ft(xt.deadline);Dt!=null&&q.push(` <Deadline>${W(Dt,17)}</Deadline>`);const Bt=ft(xt.baselineStart??(xt.baseline&&xt.baseline.start)),Ut=ft(xt.baselineEnd??(xt.baseline&&xt.baseline.end));(Bt!=null||Ut!=null)&&(q.push(" <Baseline>"),q.push(" <Number>0</Number>"),Bt!=null&&q.push(` <Start>${W(Bt,8)}</Start>`),Ut!=null&&q.push(` <Finish>${W(Ut,17)}</Finish>`),Bt!=null&&Ut!=null&&q.push(` <Duration>${at(Ut-Bt,Pt)}</Duration>`),q.push(" </Baseline>"));for(const oe of gt.get(Ht)||[]){const de=vt.get(String(oe.from));de!=null&&(q.push(" <PredecessorLink>"),q.push(` <PredecessorUID>${r(de)}</PredecessorUID>`),q.push(` <Type>${S[oe.type?String(oe.type).toUpperCase():"FS"]??1}</Type>`),oe.lag&&(q.push(` <LinkLag>${kt(Number(oe.lag),Pt)}</LinkLag>`),q.push(" <LagFormat>7</LagFormat>")),q.push(" </PredecessorLink>"))}q.push(" </Task>")}q.push(" </Tasks>");const Zt=new Map;dt.forEach((xt,Ht)=>{const ge=String(xt.name??xt.id??`Resource ${Ht+1}`),$e=Mt.get(ge),qt=xt.capacity??xt.maxUnits??1,se=$e?xt.capacity!=null?Number(xt.capacity)/$e.spec.fullDayHours:1:Number(qt),It=y(xt.rate),ie=y(xt.cost),Yt=xt.type==="material"||xt.type==="cost"?xt.type:null;Zt.set(ge,{uid:String(Ht+1),maxUnits:se,calUid:$e?$e.uid:null,rate:It,cost:ie,type:Yt})});const Vt=[];for(const xt of wt)for(const Ht of R(xt))Zt.has(Ht.resource)||Zt.set(Ht.resource,{uid:String(Zt.size+1),maxUnits:1,calUid:null}),Vt.push({taskUid:vt.get(String(ot(xt))),resUid:Zt.get(Ht.resource).uid,units:Ht.units});q.push(" <Resources>");for(const[xt,Ht]of Zt)q.push(" <Resource>"),q.push(` <UID>${r(Ht.uid)}</UID>`),q.push(` <ID>${r(Ht.uid)}</ID>`),q.push(` <Name>${r(xt)}</Name>`),q.push(` <MaxUnits>${Number(Ht.maxUnits)}</MaxUnits>`),Ht.calUid!=null&&q.push(` <CalendarUID>${Ht.calUid}</CalendarUID>`),Ht.type!=null&&q.push(` <Type>${$[Ht.type]}</Type>`),Ht.rate!=null&&q.push(` <StandardRate>${Ht.rate}/h</StandardRate>`),Ht.cost!=null&&q.push(` <Cost>${Ht.cost}</Cost>`),q.push(" </Resource>");return q.push(" </Resources>"),q.push(" <Assignments>"),Vt.forEach((xt,Ht)=>{q.push(" <Assignment>"),q.push(` <UID>${Ht+1}</UID>`),q.push(` <TaskUID>${r(xt.taskUid)}</TaskUID>`),q.push(` <ResourceUID>${r(xt.resUid)}</ResourceUID>`),q.push(` <Units>${Number(xt.units)}</Units>`),q.push(" </Assignment>")}),q.push(" </Assignments>"),q.push("</Project>"),q.join(`
|
|
7
|
-
`)}function R(st){if(st&&Array.isArray(st.assignments))return st.assignments.map(wt=>{const Jt=wt&&(wt.resource??wt.name??wt.id);if(Jt==null||Jt==="")return null;const dt=Number(wt.units??wt.allocation??1);return{resource:String(Jt),units:Number.isFinite(dt)?dt:1}}).filter(Boolean);const ht=st?st.assignee??st.assignees??st.owner:null;return(Array.isArray(ht)?ht:ht==null||ht===""?[]:[ht]).map(wt=>String(wt)).filter(wt=>wt!=="").map(wt=>({resource:wt,units:1}))}function N(st){if(st==null)return null;if(st==="weekends")return{workdays:[1,2,3,4,5],holidays:[]};const ht=Array.isArray(st.workdays)&&st.workdays.length?st.workdays.map(Number).filter(wt=>wt>=0&&wt<=6):[1,2,3,4,5],Pt=(Array.isArray(st.holidays)?st.holidays:[]).map(wt=>Y(wt)).filter(wt=>wt!=null);return{workdays:ht,holidays:Pt}}function X(st,ht){const Pt=Array.isArray(st.workingDays)&&st.workingDays.length?[...new Set(st.workingDays.map(Number).filter(ot=>ot>=0&&ot<=6))].sort((ot,vt)=>ot-vt):[1,2,3,4,5],wt=st.hoursPerDay,Jt={};for(const ot of Pt){const vt=wt!=null&&typeof wt=="object"?Number(wt[ot]):Number(wt);Jt[ot]=Number.isFinite(vt)&&vt>0?vt:ht}const dt=[];for(const ot of Array.isArray(st.holidays)?st.holidays:[]){if(ot&&typeof ot=="object"&&!(ot instanceof Date)&&("from"in ot||"to"in ot)){const pt=Y(ot.from),zt=Y(ot.to??ot.from);if(pt==null)continue;const Ot=zt??pt;for(let et=Math.min(pt,Ot);et<=Math.max(pt,Ot);et+=1)dt.push(et);continue}const vt=Y(ot);vt!=null&&dt.push(vt)}const nt=Pt.reduce((ot,vt)=>Math.max(ot,Jt[vt]),0)||ht;return{workingDays:Pt,holidays:dt,hoursByWeekday:Jt,fullDayHours:nt}}function G(st){const ht=Math.round(st*60),Pt=Math.floor(ht/60),wt=ht%60;return`${String(Pt).padStart(2,"0")}:${String(wt).padStart(2,"0")}:00`}function J(st,ht,Pt){const wt=[],Jt=new Set(Pt.workingDays);wt.push(" <Calendar>"),wt.push(` <UID>${st}</UID>`),wt.push(` <Name>${r(ht)}</Name>`),wt.push(" <IsBaseCalendar>0</IsBaseCalendar>"),wt.push(" <WeekDays>");for(let dt=0;dt<=6;dt+=1){const nt=Jt.has(dt);if(wt.push(" <WeekDay>"),wt.push(` <DayType>${dt+1}</DayType>`),wt.push(` <DayWorking>${nt?1:0}</DayWorking>`),nt){const ot=Pt.hoursByWeekday[dt];wt.push(" <WorkingTimes>"),wt.push(" <WorkingTime>"),wt.push(` <FromTime>${G(8)}</FromTime>`),wt.push(` <ToTime>${G(8+ot)}</ToTime>`),wt.push(" </WorkingTime>"),wt.push(" </WorkingTimes>")}wt.push(" </WeekDay>")}if(wt.push(" </WeekDays>"),Pt.holidays.length){wt.push(" <Exceptions>");for(const dt of Pt.holidays)wt.push(" <Exception>"),wt.push(" <DayWorking>0</DayWorking>"),wt.push(` <TimePeriod><FromDate>${W(dt,0)}</FromDate><ToDate>${W(dt,23)}</ToDate></TimePeriod>`),wt.push(" </Exception>");wt.push(" </Exceptions>")}return wt.push(" </Calendar>"),wt}function tt(st){if(st==null||st==="")return null;const ht=v(st);return ht?C[ht]:null}function ft(st){return st==null||st===""?null:Y(st)}}),ae("packages/core/src/internal/ready.js",function(g,V){"use strict";Object.defineProperty(g,"createReadySignal",{enumerable:!0,get:function(){return St}});function St(){let U=!1,K,Y;const H=new Promise((l,L)=>{K=l,Y=L});return H.catch(()=>{}),{promise:H,settleSoon(){U||queueMicrotask(()=>{U||(U=!0,K())})},settleAfterFrames(){if(U)return;const l=typeof requestAnimationFrame=="function"?requestAnimationFrame:null;if(!l){this.settleSoon();return}let L=!1;const v=()=>{L||(L=!0,this.settleNow())};l(()=>l(v)),setTimeout(v,250)},settleNow(){U||(U=!0,K())},fail(l){U||(U=!0,Y(l))}}}}),ae("packages/modules/shared/autosize.js",function(g,V){"use strict";Object.defineProperty(g,"contentWidth",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"contentHeight",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"firstMeasured",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"watchSize",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"watchBox",{enumerable:!0,get:function(){return L}});const U=V("packages/core/src/internal/warn.js").warnOnce;function K(v){if(!v||typeof v!="object")return null;const m=Number(v.clientWidth);if(Number.isFinite(m)&&m>0)return m;if(typeof v.getBoundingClientRect=="function"){const w=v.getBoundingClientRect(),k=w&&Number(w.width);if(Number.isFinite(k)&&k>0)return k}return null}function Y(v){if(!v||typeof v!="object")return null;const m=Number(v.clientHeight);if(Number.isFinite(m)&&m>0)return m;if(typeof v.getBoundingClientRect=="function"){const w=v.getBoundingClientRect(),k=w&&Number(w.height);if(Number.isFinite(k)&&k>0)return k}return null}function H(v,m=K){for(const w of v||[]){const k=m(w);if(Number.isFinite(k)&&k>0)return k}return null}function l(v){const m=(v&&Array.isArray(v.targets)?v.targets:[]).filter(Boolean),w=v&&typeof v.read=="function"?v.read:()=>null,k=v&&typeof v.apply=="function"?v.apply:()=>{},u=Number.isFinite(v&&v.epsilon)?Number(v.epsilon):1;let f=null,d=!1;const S=()=>{if(d)return!1;const p=w();if(!Number.isFinite(p)||p<=0||f!=null&&Math.abs(p-f)<u)return!1;f=p,d=!0;try{k(p)}finally{d=!1}return!0};S();const _=m[0],C=v&&v.view||_&&_.ownerDocument&&_.ownerDocument.defaultView||globalThis,a=C&&C.ResizeObserver;let o=null;if(typeof a=="function"&&m.length){o=new a(()=>{S()});for(const p of m)p&&typeof o.observe=="function"&&o.observe(p)}else m.length&&U("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:S,get applied(){return f},release(){if(o&&typeof o.disconnect=="function")try{o.disconnect()}catch{}o=null}}}function L(v){const m=(v&&Array.isArray(v.targets)?v.targets:[]).filter(Boolean),w=v&&typeof v.read=="function"?v.read:()=>({}),k=v&&typeof v.apply=="function"?v.apply:()=>{},u=Number.isFinite(v&&v.epsilon)?Number(v.epsilon):1;let f=null,d=!1;const S=$=>{if(f==null)return!0;for(const[h,y]of Object.entries($)){if(!Number.isFinite(y)||y<=0)continue;const i=f[h];if(!Number.isFinite(i)||Math.abs(y-i)>=u)return!0}return!1},_=()=>{if(d)return!1;const $=w();if(!$||typeof $!="object"||!Object.values($).some(y=>Number.isFinite(y)&&y>0)||!S($))return!1;f={...f,...$},d=!0;try{k($)}finally{d=!1}return!0};_();const C=m[0],a=v&&v.view||C&&C.ownerDocument&&C.ownerDocument.defaultView||globalThis,o=a&&a.ResizeObserver;let p=null;if(typeof o=="function"&&m.length){p=new o(()=>{_()});for(const $ of m)$&&typeof p.observe=="function"&&p.observe($)}else m.length&&U("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:_,get applied(){return f},release(){if(p&&typeof p.disconnect=="function")try{p.disconnect()}catch{}p=null}}}}),ae("packages/modules/shared/axislabels.js",function(g,V){"use strict";Object.defineProperty(g,"CHAR_RATIO",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"BOLD_FACTOR",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"MIN_GAP",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"estimateLabelWidth",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"thinLabels",{enumerable:!0,get:function(){return H}});const St=.62,U=1.05,K=6;function Y(l,L,v=!1){return String(l??"").length*L*St*(v?U:1)}function H(l,L){const v=Number.isFinite(L.gap)?Number(L.gap):K,m=Number.isFinite(L.fontSize)?Number(L.fontSize):11,w=typeof L.measure=="function"?L.measure:S=>Y(S,m,!!L.bold),k=l.filter(S=>S&&Number.isFinite(S.at)).map(S=>({...S,width:w(String(S.text??""))})).sort((S,_)=>S.at-_.at);if(k.length<2)return{every:1,kept:k};const u=S=>{let _=null;for(let C=0;C<k.length;C+=S){const a=k[C];if(_&&a.at-_.at<_.width+v)return!1;_=a}return!0};let f=1;for(;f<k.length&&!u(f);)f++;const d=[];for(let S=0;S<k.length;S+=f)d.push(k[S]);return{every:f,kept:d}}}),ae("packages/modules/shared/token-scope.js",function(g,V){"use strict";Object.defineProperty(g,"claimTokenScope",{enumerable:!0,get:function(){return U}});const St="lattice-tokens";function U(K,Y){const H=Y||K.parentElement,l=K.classList.contains(St)||!!(H&&H.closest&&H.closest(".lattice, .lattice-tokens"));return l||K.classList.add(St),()=>{l||K.classList.remove(St)}}}),ae("packages/modules/charts/svg.js",function(g,V){"use strict";Object.defineProperty(g,"SVG_NS",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"el",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"svg",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"attr",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"attrs",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"setText",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"clear",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"append",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"path",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"ribbonPath",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"round",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"pathRings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"insideRings",{enumerable:!0,get:function(){return d}});const St="http://www.w3.org/2000/svg";function U(S){const _=S.indexOf(")");return _<0?S:S.slice(_+1).trim()||"#0072b2"}function K(S,_,C){const a=S.createElement(_);return C&&a.setAttribute("class",C),a}function Y(S,_,C){const a=S.createElementNS(St,_);if(C)for(const o of Object.keys(C))a.setAttribute(o,String(C[o]));return a}function H(S,_,C){if(!S)return;if(C==null){S.removeAttribute(_);return}let a=String(C);a.startsWith("url(#")&&(_==="stroke"||_==="fill"&&S.localName==="text")&&(a=U(a)),S.setAttribute(_,a)}function l(S,_){if(S)for(const C of Object.keys(_))H(S,C,_[C])}function L(S,_){S&&(S.textContent=_==null?"":String(_))}function v(S){if(S)for(;S.firstChild;)S.removeChild(S.firstChild)}function m(S,_){for(const C of _)C&&S.appendChild(C);return S}function w(S){return S.join(" ")}function k(S){if(!S||S.length<2)return"";const _=["M",S[0].x,S[0].upper];for(let C=1;C<S.length;C++)_.push("L",S[C].x,S[C].upper);for(let C=S.length-1;C>=0;C--)_.push("L",S[C].x,S[C].lower);return _.push("Z"),w(_)}function u(S){return Math.round(S*100)/100}function f(S){const _=[];let C=[];const a=String(S||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let o="",p=[];const $=()=>{if(!o||!p.length){p=[];return}if(o==="M"||o==="L")for(let h=0;h+1<p.length;h+=2)C.push([p[h],p[h+1]]);else o!=="Z"&&p.length>=2&&C.push([p[p.length-2],p[p.length-1]]);p=[]};for(const h of a){if(/[A-Za-z]/.test(h)){if($(),h==="Z"||h==="z"){C.length>2&&_.push(C),C=[],o="";continue}h==="M"&&C.length>2&&(_.push(C),C=[]),o=h;continue}p.push(Number(h))}return $(),C.length>2&&_.push(C),_}function d(S,_,C){let a=!1;for(const o of S)for(let p=0,$=o.length-1;p<o.length;$=p++){const[h,y]=o[p],[i,r]=o[$];y>C!=r>C&&_<(i-h)*(C-y)/(r-y||1e-12)+h&&(a=!a)}return a}}),ae("packages/modules/charts/scale.js",function(g,V){"use strict";Object.defineProperty(g,"isNumber",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"toNumber",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"toTime",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"extent",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"niceStep",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"niceDomain",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"measureDomain",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"linearTicks",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"timeStepFor",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"MONTH_STEPS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(g,"timeTicks",{enumerable:!0,get:function(){return i}}),Object.defineProperty(g,"linearScale",{enumerable:!0,get:function(){return r}}),Object.defineProperty(g,"timeScale",{enumerable:!0,get:function(){return b}}),Object.defineProperty(g,"key",{enumerable:!0,get:function(){return T}}),Object.defineProperty(g,"bandScale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(g,"sqrtScale",{enumerable:!0,get:function(){return I}});const St=[1,2,2.5,5,10],U=6e4,K=36e5,Y=864e5,H=365.25*Y,l=[1,2,5,10,20,25,50,100],L=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,U,5*U,15*U,30*U,K,3*K,6*K,12*K,Y,2*Y,7*Y,14*Y,30*Y,90*Y,180*Y,...l.map(O=>O*H)];function v(O){return typeof O=="number"&&Number.isFinite(O)}function m(O){if(O==null||O==="")return null;if(O instanceof Date){const W=O.getTime();return Number.isFinite(W)?W:null}if(typeof O=="boolean")return O?1:0;const z=Number(O);return Number.isFinite(z)?z:null}function w(O){if(O==null||O==="")return null;if(O instanceof Date){const W=O.getTime();return Number.isFinite(W)?W:null}if(typeof O=="number")return Number.isFinite(O)?O:null;const z=Date.parse(String(O));return Number.isFinite(z)?z:null}function k(O){let z=1/0,W=-1/0;for(let B=0;B<O.length;B++){const at=O[B];v(at)&&(at<z&&(z=at),at>W&&(W=at))}return z===1/0?null:{min:z,max:W}}function u(O){if(!(O>0))return 1;const z=10**Math.floor(Math.log10(O));for(const W of St)if(O<=W*z)return W*z;return 10*z}function f(O,z=5){const W=u((O.max-O.min)/Math.max(1,z));return{min:Math.floor(O.min/W)*W,max:Math.ceil(O.max/W)*W,step:W}}function d(O,z={}){const W=k(O)||{min:0,max:1};let{min:B,max:at}=W;if(z.zero&&(B>0&&(B=0),at<0&&(at=0)),B===at){const ct=Math.abs(B)>0?Math.abs(B)/10:1;B-=ct,at+=ct}if(z.nice!==!1){const ct=f({min:B,max:at},z.ticks||5);B=ct.min,at=ct.max}return v(z.min)&&(B=z.min),v(z.max)&&(at=z.max),B===at&&(at=B+1),{min:B,max:at}}function S(O,z=5){const W=u((O.max-O.min)/Math.max(1,z)),B=Math.ceil(O.min/W),at=Math.floor(O.max/W),ct=[];for(let kt=B;kt<=at;kt++){const Tt=kt*W;ct.push(Math.abs(Tt)<W/1e6?0:Number(Tt.toPrecision(12)))}return ct}function _(O,z=5){const W=Math.max(1,z),B=O/W;let at=L[L.length-1];for(const Tt of L)if(Tt>=B){at=Tt;break}if(at<H)return at;let ct=at,kt=Math.abs(O/at-W);for(const Tt of L){if(Tt<H)continue;const Ft=Math.abs(O/Tt-W);Ft<kt&&(kt=Ft,ct=Tt)}return ct}const C=new Map;function a(O){let z=C.get(O);return z||(z=new Intl.DateTimeFormat("en-US",{timeZone:O,year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),C.set(O,z)),z}function o(O,z){const W={year:0,month:0,day:1,hour:0,minute:0,second:0};for(const B of a(z).formatToParts(new Date(O)))switch(B.type){case"year":W.year=Number(B.value);break;case"month":W.month=Number(B.value)-1;break;case"day":W.day=Number(B.value);break;case"hour":W.hour=Number(B.value)%24;break;case"minute":W.minute=Number(B.value);break;case"second":W.second=Number(B.value);break;default:break}return W}function p(O,z,W){const B=Date.UTC(O,z,1);let at=B;for(let ct=0;ct<2;ct++){const kt=o(at,W),Tt=Date.UTC(kt.year,kt.month,kt.day,kt.hour,kt.minute,kt.second),Ft=B-Tt;if(Ft===0)break;at+=Ft}return at}function $(O,z,W){const B=W?o(O.min,W).year:new Date(O.min).getUTCFullYear();let at=Math.ceil(B/z)*z;const ct=Tt=>W?p(Tt,0,W):Date.UTC(Tt,0,1);ct(at)<O.min&&(at+=z);const kt=[];for(;ct(at)<=O.max;at+=z)kt.push(ct(at));return kt}const h=new Map([[30*Y,1],[90*Y,3],[180*Y,6]]);function y(O,z,W){const B=W?o(O.min,W):{year:new Date(O.min).getUTCFullYear(),month:new Date(O.min).getUTCMonth()};let at=B.year*12+B.month;const ct=Tt=>{const Ft=Math.floor(Tt/12),D=Tt-Ft*12;return W?p(Ft,D,W):Date.UTC(Ft,D,1)};ct(at)<O.min&&(at+=1),at=Math.ceil(at/z)*z;const kt=[];for(;;at+=z){const Tt=ct(at);if(Tt>O.max)break;kt.push(Tt)}return kt}function i(O,z=5,W){const B=_(O.max-O.min,z);if(B>=H)return $(O,Math.round(B/H),W);const at=h.get(B);if(at)return y(O,at,W);const ct=[],kt=Math.ceil(O.min/B)*B;for(let Tt=kt;Tt<=O.max;Tt+=B)ct.push(Tt);return ct}function r(O,z){const W=O.max-O.min||1,[B,at]=z;return{kind:"linear",domain:O,range:z,of(ct){return B+(ct-O.min)/W*(at-B)},invert(ct){return O.min+(ct-B)/(at-B||1)*W},ticks(ct=5){return S(O,ct)}}}function b(O,z){return{...r(O,z),kind:"time",ticks(B=5,at){return i(O,B,at)}}}function T(O){if(O==null)return" null";if(O instanceof Date)return` date:${O.getTime()}`;if(typeof O=="object"){const z=O,W=z.id??z.key??z.value;return W!==void 0&&typeof W!="object"?` obj:${String(W)}`:` obj:${String(O)}`}return String(O)}function j(O,z,W=.2){const B=Math.min(.9,Math.max(0,W)),[at,ct]=z,kt=new Map;for(let D=0;D<O.length;D++){const P=T(O[D]);kt.has(P)||kt.set(P,D)}const Tt=O.length?(ct-at)/O.length:ct-at,Ft=Math.max(0,Tt*(1-B));return{kind:"band",domain:O,range:z,bandwidth:Ft,step:Tt,of(D){const P=kt.get(T(D));return P===void 0?NaN:at+P*Tt+(Tt-Ft)/2},centre(D){const P=this.of(D);return Number.isNaN(P)?NaN:P+Ft/2},ticks(){return O}}}function I(O,z){const[W,B]=z,at=Math.max(Math.abs(O.max),Math.abs(O.min),0)||1;return{kind:"sqrt",domain:O,range:z,of(ct){const kt=Math.sqrt(Math.abs(ct)/at);return W+kt*(B-W)}}}}),ae("packages/modules/gantt/links.js",function(g,V){"use strict";Object.defineProperty(g,"LINK_SIDES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"linkSides",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"linkTypeForSides",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"routeLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"arrowheadPath",{enumerable:!0,get:function(){return v}});const St=V("packages/modules/charts/svg.js"),U=St.path,K=St.round,Y=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 H(m){return Y[String(m||"FS").toUpperCase()]||Y.FS}function l(m,w){for(const[k,u]of Object.entries(Y))if(u.depart===m&&u.arrive===w)return k;return"FS"}function L(m){const w=Number(m.sx),k=Number(m.sy),u=Number(m.ex),f=Number(m.ey),d=Number.isFinite(m.elbow)&&m.elbow>0?Number(m.elbow):8,S=Number.isFinite(m.rowGap)&&m.rowGap>0?Number(m.rowGap):d,_=H(m.type),C=-_.arrive,a=Math.abs(f-k)<.5,o=(u-w)*C;if(a&&o>0)return{d:U(["M",K(w),K(k),"H",K(u)]),arrowDir:C,route:"straight"};if(o>=0)return{d:U(["M",K(w),K(k),"V",K(f),"H",K(u)]),arrowDir:C,route:"drop"};const p=a?k+S:(k+f)/2,$=w+_.depart*d,h=u+_.arrive*d;return{d:U(["M",K(w),K(k),"H",K($),"V",K(p),"H",K(h),"V",K(f),"H",K(u)]),arrowDir:C,route:"detour"}}function v(m,w,k,u=4){return U(["M",K(m),K(w),"L",K(m-k*u),K(w-u),"L",K(m-k*u),K(w+u),"Z"])}}),ae("packages/modules/gantt/colour.js",function(g,V){"use strict";Object.defineProperty(g,"resolveTaskColour",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"darkenColour",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"contrastColour",{enumerable:!0,get:function(){return Y}});function St(H,l){if(typeof l=="function"){const L=l(H);if(L)return String(L)}return H&&H.colour?String(H.colour):null}function U(H){const l=String(H).trim();let L;return(L=/^#([0-9a-f]{3})$/i.exec(l))?[L[1][0]+L[1][0],L[1][1]+L[1][1],L[1][2]+L[1][2]].map(v=>parseInt(v,16)):(L=/^#([0-9a-f]{6})$/i.exec(l))?[L[1].slice(0,2),L[1].slice(2,4),L[1].slice(4,6)].map(v=>parseInt(v,16)):(L=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(l))?[Number(L[1]),Number(L[2]),Number(L[3])]:null}function K(H){const l=U(H);if(!l)return H;const L=.7;return`#${l.map(m=>Math.max(0,Math.min(255,Math.round(m*L)))).map(m=>m.toString(16).padStart(2,"0")).join("")}`}function Y(H){const l=U(H);if(!l)return null;const L=l.map(m=>{const w=m/255;return w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4)});return .2126*L[0]+.7152*L[1]+.0722*L[2]>.179?"#1a1a1a":"#ffffff"}}),ae("packages/modules/gantt/messages.js",function(g,V){"use strict";Object.defineProperty(g,"FALLBACK_EN",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"createTranslator",{enumerable:!0,get:function(){return Y}});const U=V("packages/core/src/internal/predicates.js").isFunction,K=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.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","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.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","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","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors."});function Y(H,l){return function(v,m){const w=U(l)?l():null,k=H&&H.grid,u=w&&U(w.t)&&w||k&&k.messages&&U(k.messages.t)&&k.messages||null;if(u){let d;try{d=u.t(v,m)}catch{d=null}if(typeof d=="string"&&d&&d!==v)return d}const f=K[v];return f?f.replace(/\{(\w+)\}/g,(d,S)=>m&&S in m?String(m[S]):d):v}}}),ae("packages/modules/gantt/roles.js",function(g,V){"use strict";Object.defineProperty(g,"ROLE_DEFAULTS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"expand",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"readRole",{enumerable:!0,get:function(){return Y}});const St=Object.freeze({bar:"var(--lattice-accent)","bar-fg":"var(--lattice-foreground)",progress:"color-mix(in srgb, var(--lattice-accent) 70%, var(--lattice-foreground))",milestone:"var(--lattice-variant-warning-solid)",critical:"var(--lattice-variant-danger-solid)",link:"var(--lattice-foreground-muted)",today:"var(--lattice-variant-danger-solid)",nonworking:"var(--lattice-surface)",summary:"var(--lattice-variant-neutral-solid)",baseline:"var(--lattice-border-strong)",band:"var(--lattice-row-stripe)",selected:"var(--lattice-selected-background)",handle:"var(--lattice-background)","tooltip-bg":"var(--lattice-foreground)","tooltip-fg":"var(--lattice-background)","header-bg":"var(--lattice-surface)"}),U=Object.entries(St).map(([H,l])=>`--lattice-gantt-d-${H}:${l};`).join("");function K(H){return String(H).replace(/var\(--lattice-gantt-([a-z-]+)\)/g,(l,L)=>Object.hasOwn(St,L)?`var(--lattice-gantt-${L},var(--lattice-gantt-d-${L}))`:l)}function Y(H,l){return String(H.getPropertyValue(`--lattice-gantt-${l}`)).trim()||String(H.getPropertyValue(`--lattice-gantt-d-${l}`)).trim()}}),ae("packages/modules/shared/drag-gesture.js",function(g,V){"use strict";Object.defineProperty(g,"attachDragGesture",{enumerable:!0,get:function(){return H}});const St=300,U=3,K=24,Y=12;function H(l,L={}){const v=L.holdMs==null?St:L.holdMs,m=typeof L.canStart=="function"?L.canStart:null,w=typeof L.onStart=="function"?L.onStart:null,k=typeof L.onMove=="function"?L.onMove:null,u=typeof L.onEnd=="function"?L.onEnd:null,f=typeof L.onCancel=="function"?L.onCancel:null,d=typeof L.autoScroll=="function"?L.autoScroll:null,S=Array.isArray(L.autoScroll)?L.autoScroll:[],_=l&&l.ownerDocument?l.ownerDocument:l;if(!l||!_||typeof l.addEventListener!="function")return()=>{};let C=null;function a(B,at,ct,kt,Tt){if(ct>=B&&ct<B+K&&kt>0){const Ft=K-(ct-B);return-Math.max(1,Math.round(Y*Ft/K))}if(ct>at-K&&ct<=at&&kt<Tt){const Ft=K-(at-ct);return Math.max(1,Math.round(Y*Ft/K))}return 0}function o(){const B=C;if(B){if(C=null,B.holdTimer&&clearTimeout(B.holdTimer),W(B),B.started&&B.pressed&&B.pressed.style&&(B.pressed.style.touchAction=B.prevTouchAction),B.pressed&&typeof B.pressed.releasePointerCapture=="function"&&B.pointerId!==void 0)try{B.pressed.releasePointerCapture(B.pointerId)}catch{}_.removeEventListener("pointermove",i),_.removeEventListener("pointerup",b),_.removeEventListener("pointercancel",T),_.removeEventListener("keydown",j),_.removeEventListener("pointerdown",I),_.removeEventListener("touchmove",r)}}function p(B){if(!B.started){if(B.started=!0,B.pressed&&B.pressed.style&&(B.prevTouchAction=B.pressed.style.touchAction||"",B.pressed.style.touchAction="none"),B.pressed&&typeof B.pressed.setPointerCapture=="function"&&B.pointerId!==void 0)try{B.pressed.setPointerCapture(B.pointerId)}catch{}w&&w(B.drag,B.downEvent),z(B)}}function $(B,at){const ct=B.started;o(),ct&&u&&u(B.drag,at)}function h(B,at){const ct=B.started;o(),ct&&f&&f(B.drag,at)}function y(){const B=C;B&&!B.started&&p(B)}function i(B){const at=C;if(!at||B.pointerId!==void 0&&B.pointerId!==at.pointerId)return;const ct=typeof B.clientX=="number"?B.clientX:at.lastX,kt=typeof B.clientY=="number"?B.clientY:at.lastY;if(at.lastX=ct,at.lastY=kt,at.lastEvent=B,!at.started){if(Math.hypot(ct-at.startX,kt-at.startY)<=U)return;if(at.pointerType==="mouse")p(at);else{o();return}}k&&k(at.drag,B)}function r(B){C&&C.started&&typeof B.preventDefault=="function"&&B.preventDefault()}function b(B){const at=C;at&&(B.pointerId!==void 0&&B.pointerId!==at.pointerId||$(at,B))}function T(B){const at=C;at&&(B.pointerId!==void 0&&B.pointerId!==at.pointerId||h(at,B))}function j(B){C&&B.key==="Escape"&&h(C,B)}function I(B){const at=C;at&&B.pointerId!==void 0&&B.pointerId!==at.pointerId&&h(at,B)}function O(B){if(B.button!=null&&B.button!==0||C)return;const at=m?m(B):B.target||null;if(!at)return;const ct=typeof B.clientX=="number"?B.clientX:0,kt=typeof B.clientY=="number"?B.clientY:0,Tt=B.pointerId,Ft=B.pointerType||"mouse";C={drag:{el:at,pointerId:Tt,pointerType:Ft,startX:ct,startY:kt,lastX:ct,lastY:kt},pressed:at,pointerId:Tt,pointerType:Ft,startX:ct,startY:kt,lastX:ct,lastY:kt,started:!1,downEvent:B,lastEvent:B,holdTimer:null,prevTouchAction:"",frameId:null},Ft!=="mouse"&&(C.holdTimer=setTimeout(y,v)),_.addEventListener("pointermove",i),_.addEventListener("pointerup",b),_.addEventListener("pointercancel",T),_.addEventListener("keydown",j),_.addEventListener("pointerdown",I),Ft==="touch"&&_.addEventListener("touchmove",r,{passive:!1})}function z(B){if(typeof requestAnimationFrame!="function"||!d&&!S.length)return;function at(){const ct=C;if(!ct||ct!==B||!ct.started){B.frameId=null;return}const kt=d?d():S;let Tt=!1;if(Array.isArray(kt))for(const Ft of kt){if(!Ft||typeof Ft.getBoundingClientRect!="function")continue;const D=Ft.getBoundingClientRect(),P=a(D.left,D.right,ct.lastX,Ft.scrollLeft,Ft.scrollWidth-Ft.clientWidth),x=a(D.top,D.bottom,ct.lastY,Ft.scrollTop,Ft.scrollHeight-Ft.clientHeight);P&&(Ft.scrollLeft+=P,Tt=!0),x&&(Ft.scrollTop+=x,Tt=!0)}Tt&&k&&ct.lastEvent&&k(ct.drag,ct.lastEvent),B.frameId=requestAnimationFrame(at)}B.frameId=requestAnimationFrame(at)}function W(B){B.frameId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(B.frameId),B.frameId=null}return l.addEventListener("pointerdown",O),()=>{o(),l.removeEventListener("pointerdown",O)}}}),ae("packages/modules/gantt/events-pointer.js",function(g,V){"use strict";Object.defineProperty(g,"GESTURE_EVENTS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"DRAG_THRESHOLD",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"DEFAULT_PROGRESS_STEP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"HANDLE_TARGET",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"TOUCH_TARGET",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"emitGesture",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"gateGesture",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"taskContext",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"pointerOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"snapProgress",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"FrameThrottle",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"partOfElement",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"partOfTask",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"TaskPointerEvents",{enumerable:!0,get:function(){return C}}),Object.defineProperty(g,"gateTooltipShow",{enumerable:!0,get:function(){return a}}),Object.defineProperty(g,"fireTooltipHide",{enumerable:!0,get:function(){return o}}),Object.defineProperty(g,"drawProgressHandle",{enumerable:!0,get:function(){return p}}),Object.defineProperty(g,"previewProgress",{enumerable:!0,get:function(){return $}}),Object.defineProperty(g,"progressHandleCss",{enumerable:!0,get:function(){return h}});const St=V("packages/modules/charts/svg.js"),U=St.svg,K=St.round,Y=Object.freeze(["beforeTaskDrag","taskDragStart","taskDrag","taskDrag:cancelled","beforeTaskResizeStart","taskResizeStart","taskPartialResize","taskResizeEnd","taskResize:cancelled","beforePercentBarDrag","percentBarDragStart","percentBarDrag","percentBarDrop","percentBarDrag:cancelled","taskClick","taskDblClick","taskMouseOver","taskMouseOut","taskContextMenu","linkClick","linkDblClick","linkContextMenu","linkHover","tooltipShow","tooltipHide"]),H=3,l=5,L=16,v=24;function m(y,i,r){y&&typeof y.emitGesture=="function"&&y.emitGesture(i,r)}function w(y,i,r,b){return!y||typeof y.gateGesture!="function"?!0:y.gateGesture(i,r,b)}function k(y,i){const r=y&&y.schedule,b=r&&r.ok?r.tasks.get(i):null,T=y&&typeof y.taskById=="function"?y.taskById(i):null;return{id:i,rawTask:T,task:b?{...b}:null}}function u(y){return!y||!Number.isFinite(y.clientX)?null:{x:y.clientX,y:Number.isFinite(y.clientY)?y.clientY:0}}function f(y,i){const r=Number.isFinite(i)&&i>0?Number(i):l,b=Math.round((Number(y)||0)/r)*r;return Math.max(0,Math.min(100,Math.round(b*1e3)/1e3))}class d{#t;#i;#e=null;#n=null;constructor(i,r){this.#t=r;const b=i&&i.defaultView;this.#i=b&&typeof b.requestAnimationFrame=="function"?b:null}push(i){if(!this.#i){this.#t(i);return}this.#n={value:i},this.#e==null&&(this.#e=this.#i.requestAnimationFrame(()=>{this.#e=null;const r=this.#n;this.#n=null,r&&this.#t(r.value)}))}flush(){const i=this.#n;this.cancel(),i&&this.#t(i.value)}cancel(){this.#e!=null&&this.#i&&this.#i.cancelAnimationFrame(this.#e),this.#e=null,this.#n=null}}function S(y,i){const r=y&&y.classList;return r?r.contains(`${i}__progresshandle-hit`)||r.contains(`${i}__progresshandle-thumb`)||r.contains(`${i}__progress`)?"progress":r.contains(`${i}__bar`)?"bar":r.contains(`${i}__barlabel`)||r.contains(`${i}__label`)?"label":r.contains(`${i}__baseline`)?"baseline":r.contains(`${i}__milestone`)?"milestone":r.contains(`${i}__summary-bar`)||r.contains(`${i}__summary`)?"summary":null:null}function _(y){return y&&y.isSummary?"summary":y&&y.isMilestone?"milestone":"bar"}class C{#t;#i=[];#e=null;#n=null;constructor(i){this.#t=i}attach(i){if(!i||!i.addEventListener)return;const z=[["click",W=>this.#d(W)],["dblclick",W=>this.#g(W)],["pointerover",W=>this.#p(W)],["pointerout",W=>this.#h(W)],["focusin",W=>this.#c(W)],["focusout",W=>this.#b(W)]];if(this.#t.keyboard){const W=B=>this.#r(B);z.push(["keydown",W])}for(const[W,B]of z)i.addEventListener(W,B),this.#i.push([i,W,B])}#s(i){const r=S(i,this.#t.ns);if(!r)return null;const b=this.#t.rowOf(i),T=b?b.getAttribute("data-task"):null;return T==null?null:{id:String(T),part:r}}#o(i,r){return{...k(this.#t.controller,i),view:this.#t.view(),...r}}#l(i,r){let b=Number.isFinite(i&&i.clientX)?this.#t.dayAt(i):null;if(!Number.isFinite(b)){const T=this.#t.controller.schedule,j=T&&T.ok?T.tasks.get(r):null;b=j?j.es:null}return Number.isFinite(b)?this.#t.date(Math.floor(b)):null}#d(i){if(this.#t.consumeDragRelease())return;const r=this.#s(i.target);r&&m(this.#t.controller,"taskClick",this.#o(r.id,{part:r.part,date:this.#l(i,r.id),event:i}))}#g(i){const r=this.#s(i.target);if(!r)return;!w(this.#t.controller,"taskDblClick",null,this.#o(r.id,{part:r.part,date:this.#l(i,r.id),event:i}))&&i.preventDefault&&i.preventDefault()}#p(i){if(this.#t.dragging())return;const r=this.#s(i.target);!r||this.#e&&this.#e.id===r.id||(this.#e&&this.#a(i),this.#e=r,m(this.#t.controller,"taskMouseOver",this.#o(r.id,{part:r.part,event:i})))}#h(i){if(!this.#e)return;const r=i.relatedTarget?this.#s(i.relatedTarget):null;r&&r.id===this.#e.id||this.#a(i)}#a(i){const r=this.#e;this.#e=null,m(this.#t.controller,"taskMouseOut",this.#o(r.id,{part:r.part,event:i}))}#f(i){const r=this.#t.rowOf(i.target);if(!r||r!==i.target)return null;const b=String(r.getAttribute("data-task")),T=this.#t.controller.schedule;return{id:b,part:_(T&&T.ok?T.tasks.get(b):null)}}#c(i){const r=this.#f(i);!r||r.id===this.#n||(this.#n=r.id,m(this.#t.controller,"taskMouseOver",this.#o(r.id,{part:r.part,event:i})))}#b(i){const r=this.#f(i);!r||r.id!==this.#n||(this.#n=null,m(this.#t.controller,"taskMouseOut",this.#o(r.id,{part:r.part,event:i})))}#r(i){if(i.key!=="Enter"&&i.key!==" "||i.ctrlKey||i.metaKey||i.altKey)return;const r=this.#f(i);r&&(i.preventDefault&&i.preventDefault(),m(this.#t.controller,"taskClick",this.#o(r.id,{part:r.part,date:this.#l(null,r.id),event:i})))}gateContextMenu(i,r,b){return w(this.#t.controller,"taskContextMenu",null,this.#o(i,{part:r,event:b}))}destroy(){for(const[i,r,b]of this.#i)i.removeEventListener(r,b);this.#i=[],this.#e=null,this.#n=null}}function a(y,i,r,b,T){return w(y,"tooltipShow",null,{...k(y,r),view:i,text:b,event:T})}function o(y,i,r,b){m(y,"tooltipHide",{...k(y,r),view:i,event:b})}function p(y,i){const r=Math.max(0,Math.min(100,Number(i.percent)||0)),b=i.x0+i.w*(r/100),T=i.barY+i.barH,j=T-L/2,I=L,O=U(y,"g",{class:`${i.ns}__progresshandle`,"data-task":i.id,"data-percent":String(r),"aria-hidden":"true"}),z=U(y,"rect",{class:`${i.ns}__progresshandle-hit`,x:K(b-L/2),y:K(j),width:L,height:K(I),fill:"transparent"}),W=U(y,"title",{});return W.textContent=i.title,z.appendChild(W),O.appendChild(z),O.appendChild(U(y,"path",{class:`${i.ns}__progresshandle-thumb`,d:`M ${K(b)} ${K(T-3)} L ${K(b+5)} ${K(T+5)} L ${K(b-5)} ${K(T+5)} Z`})),O}function $(y,i,r,b){const T=i&&i.querySelector(`.${r}__bar`);if(!T)return;const j=parseFloat(T.getAttribute("x")),I=parseFloat(T.getAttribute("width"));if(!Number.isFinite(j)||!Number.isFinite(I))return;let O=i.querySelector(`.${r}__progress`);O||(O=U(y,"rect",{class:`${r}__progress`,x:j,y:T.getAttribute("y"),height:T.getAttribute("height"),rx:3,width:0}),T.parentNode.insertBefore(O,T.nextSibling)),O.setAttribute("width",String(K(I*(b/100))));const z=i.querySelector(`.${r}__progresshandle`);if(!z)return;const W=parseFloat(z.getAttribute("data-percent"))||0,B=K(I*((b-W)/100));z.setAttribute("transform",`translate(${B} 0)`),z.setAttribute("data-preview-percent",String(b))}function h(y,i="barrow"){return`.${y}__progresshandle{opacity:0;transition:opacity .1s;cursor:ew-resize}
|
|
6
|
+
(function(ur){"use strict";var gr=!0,rr=Object.create(null),sr=Object.create(null);function ae(p,V){rr[p]=V}function or(p){var V=sr[p];if(V)return V;var St=Object.create(null);sr[p]=St;var U=rr[p];if(!U)throw new Error("[lattice] missing module: "+p);return U(St,or),St}ae("packages/core/src/internal/warn.js",function(p,V){"use strict";Object.defineProperty(p,"reportedWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"warnOnce",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"infoOnce",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"resetWarnings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"fail",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"invariant",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"DEV",{enumerable:!0,get:function(){return S}});const St=new Set,U=2e3;function K(_){if(St.add(_),St.size>U){const C=St.values().next().value;C!==void 0&&St.delete(C)}}const Y=[],W=500;function l(_,C,a){Y.push({key:_,level:C,message:a.map(o=>typeof o=="string"?o:L(o)).join(" "),at:Date.now()}),Y.length>W&&Y.shift()}function L(_){if(_ instanceof Error)return _.message;try{return JSON.stringify(_)}catch{return String(_)}}function v(){return Y.map(_=>({..._}))}function b(_){if(_.length===0||typeof _[0]!="string")return _;const C=_[0].replace(/^\[lattice\]\s*/,"");return C===_[0]?_:[C,..._.slice(1)]}function w(_,...C){if(St.has(_))return;K(_);const a=b(C);l(_,"warn",a),console.warn("[lattice]",...a)}function k(_,...C){if(St.has(_))return;K(_);const a=b(C);l(_,"info",a),console.info("[lattice]",...a)}function u(){St.clear(),Y.length=0}function g(_,C){const a=new Error(`[lattice] ${_}`);throw C!==void 0&&(a.cause=C),a}function d(_,C){_||g(C)}const S=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),ae("packages/core/src/internal/predicates.js",function(p,V){"use strict";Object.defineProperty(p,"isObject",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"isFunction",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"isNil",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"isBlank",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"isCtor",{enumerable:!0,get:function(){return W}});function St(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)}function U(l){return typeof l=="function"}function K(l){return l==null}function Y(l){return l==null||l===""}function W(l){return typeof l!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(l))?!0:!!(l.prototype&&Object.getOwnPropertyNames(l.prototype).length>1)}}),ae("packages/modules/shared/emitter.js",function(p,V){"use strict";Object.defineProperty(p,"WILDCARD",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"Emitter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"gate",{enumerable:!0,get:function(){return b}});const U=V("packages/core/src/internal/predicates.js").isFunction,Y=V("packages/core/src/internal/warn.js").warnOnce,W="*",l=new Set(["api","user","init","ai"]);function L(w,k){return w&&w.name?w.name:`#${k}`}class v{#t=new Map;#i;constructor(k="module"){this.#i=String(k)}on(k,u){if(!U(u))return()=>{};let g=this.#t.get(k);return g||(g=new Set,this.#t.set(k,g)),g.add(u),()=>this.off(k,u)}off(k,u){const g=this.#t.get(k);g&&g.delete(u)}count(k){const u=this.#t.get(k);return u?u.size:0}emit(k,u){const g=this.#t.get(k),d=this.#t.get(W);if((!g||g.size===0)&&(!d||d.size===0))return;const S={...u||null,type:k};g&&g.size&&this.#e([...g],S,k),d&&d.size&&this.#e([...d],S,W)}#e(k,u,g){for(let d=0;d<k.length;d++)try{k[d](u)}catch(S){Y(`${this.#i}.emit.throw:${g}:${L(k[d],d)}`,`${this.#i}: a '${g}' handler threw; other handlers were unaffected.`,S)}}emitBefore(k,u,g){const d=g??(u&&u.origin),S=l.has(d)?d:"user";let _=!1,C=null;const a=i=>{_=!0,i!=null&&C===null&&(C=String(i))},o={...u||null,type:k,origin:S,get defaultPrevented(){return _},get reason(){return C},preventDefault(i){a(i)}},m=this.#t.get(k);if(!m||m.size===0)return!0;const $=[...m],h=()=>(_&&C===null&&(C="prevented"),_&&u&&typeof u=="object"&&(u.reason=C),!_),y=[];for(let i=0;i<$.length;i++){const r=$[i];try{const f=r(o);f&&U(f.then)?y.push(f):f===!1&&a("prevented")}catch(f){a("error"),Y(`${this.#i}.beforeThrow:${k}:${L(r,i)}`,`${this.#i}: a '${k}' before-handler threw; the action was cancelled.`,f)}}return y.length===0?h():Promise.allSettled(y).then(i=>{for(const r of i)r.status==="rejected"?(a("error"),Y(`${this.#i}.beforeReject:${k}`,`${this.#i}: a '${k}' before-handler rejected; the action was cancelled.`,r.reason)):r.value===!1&&a("prevented");return h()})}clear(){this.#t.clear()}}function b(w,k,u,g,d){const S=w.emitBefore(k,g,g.origin),_=()=>(w.emit(u,{...g,reason:g.reason||"prevented"}),!1);return S===!1?_():S&&U(S.then)?S.then(C=>C?d():_()):d()}}),ae("packages/core/src/internal/schedule.js",function(p,V){"use strict";Object.defineProperty(p,"now",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"nextFrame",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"cancelFrame",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"frameBatched",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"settleDebounce",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"whenIdle",{enumerable:!0,get:function(){return L}});function St(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}function U(){return typeof requestAnimationFrame=="function"}function K(v){return U()?requestAnimationFrame(v):setTimeout(()=>v(St()),16)}function Y(v){v!=null&&(U()?cancelAnimationFrame(v):clearTimeout(v))}function W(v){let b=null,w=null;const k=()=>{b=null;const g=w;w=null,v(...g||[])},u=(...g)=>{w=g,b===null&&(b=K(k))};return u.cancel=()=>{Y(b),b=null,w=null},u.flush=()=>{b!==null&&(Y(b),k())},u}function l(v,b){let w=null,k=null;const u=()=>{if(w=null,k===null)return;const S=k;k=null,v(...S),g()},g=()=>{w=setTimeout(u,b),typeof w?.unref=="function"&&w.unref()},d=(...S)=>{w===null?(v(...S),g()):(k=S,clearTimeout(w),g())};return d.flush=()=>{if(w!==null&&clearTimeout(w),w=null,k===null)return;const S=k;k=null,v(...S)},d.cancel=()=>{w!==null&&clearTimeout(w),w=null,k=null},d.pending=()=>w!==null||k!==null,d}function L(v,b=50){return typeof requestIdleCallback=="function"?requestIdleCallback(v,{timeout:b}):setTimeout(()=>v({timeRemaining:()=>0,didTimeout:!0}),1)}}),ae("packages/core/src/model/history.js",function(p,V){"use strict";Object.defineProperty(p,"DEFAULT_HISTORY_DEPTH",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"DEFAULT_COALESCE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"HISTORY_TYPES",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"COALESCING_TYPES",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"HISTORY_LABELS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"diffSlices",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"HistoryModel",{enumerable:!0,get:function(){return a}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/core/src/internal/predicates.js"),Y=K.isFunction,W=K.isObject,L=V("packages/core/src/internal/schedule.js").now,v=10,b=400,w=["sort","filter","group","pivot","column:move","column:resize","column:visible","column:pin","column:decorate","page","edit","transaction"],k=new Set(["column:resize","column:move"]),u={sort:"sort",filter:"filter",group:"grouping",pivot:"pivot",formatting:"conditional formatting","column:move":"column move","column:resize":"column resize","column:visible":"column visibility","column:pin":"column pin","column:decorate":"column decoration",page:"page change",edit:"edit",transaction:"change"};function g(o){if(o===null||typeof o!="object")return o;try{return structuredClone(o)}catch{try{return JSON.parse(JSON.stringify(o))}catch{return o}}}function d(o,m){if(o===m)return!0;if(o===null||m===null||typeof o!="object"||typeof m!="object")return o!==o&&m!==m;if(o instanceof Date||m instanceof Date)return o instanceof Date&&m instanceof Date&&o.getTime()===m.getTime();if(Array.isArray(o)||Array.isArray(m))return!Array.isArray(o)||!Array.isArray(m)||o.length!==m.length?!1:o.every((y,i)=>d(y,m[i]));const $=Object.keys(o),h=Object.keys(m);return $.length!==h.length?!1:$.every(y=>Object.prototype.hasOwnProperty.call(m,y)&&d(o[y],m[y]))}function S(o,m){const $=new Map;for(const r of m)W(r)&&typeof r.id=="string"&&$.set(r.id,r);const h=new Set,y=[],i=[];for(const r of o){if(!W(r)||typeof r.id!="string")continue;h.add(r.id);const f=$.get(r.id);if(!f){y.push({...r});continue}const M=new Set([...Object.keys(r),...Object.keys(f)]);M.delete("id");const D={id:r.id},I={id:r.id};let O=!1;for(const B of M)d(r[B],f[B])||(O=!0,B in r&&(D[B]=r[B]),B in f&&(I[B]=f[B]));O&&(y.push(D),i.push(I))}for(const r of m)!W(r)||typeof r.id!="string"||h.has(r.id)||i.push({...r});return y.length===0&&i.length===0?null:{before:y,after:i}}function _(o){if(typeof o=="string")return"";if(Array.isArray(o))return[]}function C(o,m){const $=W(o)?o:null,h=W(m)?m:null;if(!$&&!h)return null;if(!$||!h)return{before:$?{...$}:null,after:h?{...h}:null};const y={},i={};let r=!1;const f=new Set([...Object.keys($),...Object.keys(h)]);f.delete("version");for(const M of f){if(M==="columns"&&Array.isArray($.columns)&&Array.isArray(h.columns)){const O=S($.columns,h.columns);if(!O)continue;y.columns=O.before,i.columns=O.after,r=!0;continue}if(d($[M],h[M]))continue;r=!0;const D=M in $,I=M in h;D?y[M]=$[M]:_(h[M])!==void 0&&(y[M]=_(h[M])),I?i[M]=h[M]:_($[M])!==void 0&&(i[M]=_($[M]))}return r?(y.columns&&Array.isArray($.columnOrder)&&(y.columnOrder=$.columnOrder),i.columns&&Array.isArray(h.columnOrder)&&(i.columnOrder=h.columnOrder),$.version!==void 0&&(y.version=$.version),h.version!==void 0&&(i.version=h.version),{before:y,after:i}):null}class a{#t=[];#i=[];#e=v;#n=b;#s=null;#o=null;#l=null;#h=L;#f=!1;#p=0;#g=0;constructor(m={}){m.apply&&(this.#s=m.apply),m.capture&&(this.#o=m.capture),m.edit&&(this.#l=m.edit),Y(m.now)&&(this.#h=m.now),this.configure(m)}configure(m={}){typeof m.depth=="number"&&m.depth>=0&&(this.#e=Math.floor(m.depth),this.#c()),typeof m.coalesceMs=="number"&&m.coalesceMs>=0&&(this.#n=m.coalesceMs)}get depth(){return this.#e}set depth(m){this.configure({depth:m})}get coalesceMs(){return this.#n}set coalesceMs(m){this.configure({coalesceMs:m})}get size(){return this.#t.length}get redoSize(){return this.#i.length}get replaying(){return this.#f}canUndo(){return this.#t.length>0}canRedo(){return this.#i.length>0}push(m){if(this.#f||this.#p>0||this.#e===0||!W(m)||typeof m.type!="string"||!m.type)return null;const $=m.type,h=$==="edit";let y=null,i=null;if(!h){const M=C(g(m.before??null),g(m.after??null));if(!M)return null;y=M.before,i=M.after}const r={seq:++this.#g,type:$,label:typeof m.label=="string"&&m.label?m.label:u[$]||$,target:m.target==null?null:String(m.target),before:y,after:i,at:typeof m.at=="number"?m.at:this.#h(),delegated:h,mergeable:h?!1:m.coalesce===void 0?k.has($):!!m.coalesce};this.#i.length=0;const f=this.#a(r);return f!==void 0?f:(this.#t.push(r),this.#c(),r)}recordEdit(m,$={}){return this.push({type:"edit",label:m,target:$.target,at:$.at})}transaction(m,$,h={}){if(!Y($))return null;if(this.#f||this.#p>0){this.#p++;try{$()}finally{this.#p--}return null}const y=h.type||"transaction",i=h.type?y:void 0,r=this.#d(i,h.target);this.#p++;try{$()}finally{this.#p--}const f=this.#d(i,h.target);return this.push({type:y,label:m,target:h.target,before:r,after:f,coalesce:h.coalesce===void 0?!1:h.coalesce})}#a(m){if(!m.mergeable)return;const $=this.#t[this.#t.length-1];if(!$||!$.mergeable||$.delegated||$.type!==m.type||$.target!==m.target||m.at-$.at>this.#n)return;const h=C($.before,m.after);return h?($.before=h.before,$.after=h.after,$.at=m.at,$.label=m.label,$):(this.#t.pop(),null)}get busy(){return this.#f||this.#p>0}capture(m,$){return this.#d(m,$)}#d(m,$){if(!this.#o)return null;try{return g(this.#o(m,$??null))}catch(h){return U("history.capture.throw","history capture threw; the action was not recorded.",h),null}}#c(){for(;this.#t.length>this.#e;)this.#t.shift();for(;this.#i.length>this.#e;)this.#i.shift()}undo(){return this.#y("undo")}redo(){return this.#y("redo")}#y(m){if(this.#f)return null;const $=m==="undo"?this.#t:this.#i,h=m==="undo"?this.#i:this.#t;this.#f=!0;try{for(;$.length;){const y=$[$.length-1],i=this.#w(y,m);if(y.delegated){if(!this.#r(m)){$.pop();continue}}else i.patch&&this.#m(i.patch,i);return $.pop(),h.push(y),this.#c(),i}return null}finally{this.#f=!1}}#r(m){const $=this.#l;if(!$||!Y($[m]))return!1;try{return $[m]({origin:"history"})!=null}catch(h){return U("history.edit.throw",`edit ${m} threw; the entry was dropped.`,h),!1}}#m(m,$){if(this.#s)try{this.#s(m,$)}catch(h){U("history.apply.throw",`applying the ${$.direction} of '${$.label}' threw.`,h)}}#w(m,$){return{direction:$,seq:m.seq,type:m.type,label:m.label,target:m.target,at:m.at,delegated:m.delegated,patch:m.delegated?null:g($==="undo"?m.before:m.after)}}peek(m="undo"){const $=m==="redo"?this.#i:this.#t,h=$[$.length-1];return h?{seq:h.seq,type:h.type,label:h.label,target:h.target,at:h.at,delegated:h.delegated}:null}list(){const m=($,h)=>({seq:$.seq,type:$.type,label:$.label,target:$.target,at:$.at,delegated:$.delegated,undone:h});return[...this.#i.map($=>m($,!0)),...[...this.#t].reverse().map($=>m($,!1))]}clear(){this.#t.length=0,this.#i.length=0}destroy(){this.clear(),this.#l=null}}}),ae("packages/modules/gantt/time.js",function(p,V){"use strict";Object.defineProperty(p,"toDayNumber",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"fromDayNumber",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"toISODate",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"resolveProjectEpoch",{enumerable:!0,get:function(){return L}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=864e5;function Y(v){if(v==null||v==="")return null;if(typeof v=="number")return Number.isFinite(v)?v:null;if(v instanceof Date)return Number.isFinite(v.getTime())?Math.floor(Date.UTC(v.getFullYear(),v.getMonth(),v.getDate())/K):null;const b=Date.parse(v);return Number.isFinite(b)?Math.floor(b/K):null}function W(v){return Number.isFinite(v)?new Date(Math.round(v)*K):null}function l(v){const b=W(v);return b?b.toISOString().slice(0,10):null}function L(v){if(v==null||v==="")return 0;const b=Y(v);return Number.isFinite(b)?b:(U(`gantt.projectEpoch:${String(v)}`,`[lattice] gantt: projectEpoch ${JSON.stringify(v)} is not a date or a day number; the plan is rendered against the Unix epoch (day 0 = 1970-01-01).`),0)}}),ae("packages/modules/gantt/calendar.js",function(p,V){"use strict";Object.defineProperty(p,"createCalendar",{enumerable:!0,get:function(){return Y}});const U=V("packages/modules/gantt/time.js").toDayNumber,K=Object.freeze([1,2,3,4,5]);function Y(W,l=0){if(W==null)return null;let L,v;W==="weekends"?(L=K,v=new Set):(L=Array.isArray(W.workdays)&&W.workdays.length?W.workdays.map(Number).filter(a=>a>=0&&a<=6):K,v=new Set((Array.isArray(W.holidays)?W.holidays:[]).map(a=>U(a)).filter(a=>a!=null)));const b=new Set(L);if(b.size===7&&v.size===0||b.size===0)return null;const w=a=>{let o=(a%7+4)%7;return o<0&&(o+=7),o},k=a=>{if(!Number.isFinite(a))return!1;const o=Math.round(a);return b.has(w(o))&&!v.has(o)},u=a=>{let o=a;for(;!k(o);)o+=1;return o},g=u(Math.round(Number.isFinite(l)?l:0)),d=b.size,S=(a,o)=>{if(o<a)return 0;const m=o-a+1,$=Math.floor(m/7);let h=$*d;const y=w(a);for(let i=$*7;i<m;i+=1)b.has((y+i)%7)&&(h+=1);for(const i of v)i>=a&&i<=o&&b.has(w(i))&&(h-=1);return h};return{isWorking:k,nextWorking:u,dayOf:a=>{const o=Math.round(a);if(o===0)return g;if(o>0){const r=Math.floor(o/d);let f=g+r*7,M=o-r*d;for(;M>0;)f+=1,b.has(w(f))&&(M-=1);let D=0;for(const I of v)I>g&&I<=f&&b.has(w(I))&&(D+=1);for(;D>0;)f+=1,k(f)&&(D-=1);for(;!k(f);)f+=1;return f}const m=-o,$=Math.floor(m/d);let h=g-$*7,y=m-$*d;for(;y>0;)h-=1,b.has(w(h))&&(y-=1);let i=0;for(const r of v)r>=h&&r<g&&b.has(w(r))&&(i+=1);for(;i>0;)h-=1,k(h)&&(i-=1);for(;!k(h);)h-=1;return h},indexOf:a=>{const o=u(Math.round(a));return o>=g?S(g,o)-1:-(S(o,g)-1)},anchor:g}}}),ae("packages/modules/gantt/task-calendars.js",function(p,V){"use strict";Object.defineProperty(p,"PLAN_CALENDAR_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"parseHolidayDays",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"planWorkingTime",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"normalizeCalendarSpec",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"resolveCalendars",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"PLAIN_TIME",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"createTimeModel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"workingRuns",{enumerable:!0,get:function(){return d}});const U=V("packages/modules/gantt/calendar.js").createCalendar,Y=V("packages/modules/gantt/time.js").toDayNumber,W="plan",l=Object.freeze([0,1,2,3,4,5,6]),L=Object.freeze([1,2,3,4,5]);function v(S){const _=new Set;for(const C of Array.isArray(S)?S:[]){if(C&&typeof C=="object"&&!(C instanceof Date)&&("from"in C||"to"in C)){const o=Y(C.from),m=Y(C.to??C.from);if(o==null)continue;const $=m??o;for(let h=Math.min(o,$);h<=Math.max(o,$);h+=1)_.add(h);continue}const a=Y(C);a!=null&&_.add(a)}return[..._].sort((C,a)=>C-a)}function b(S){return S==null?{workdays:[...l],holidays:[],hoursPerDay:null}:S==="weekends"?{workdays:[...L],holidays:[],hoursPerDay:null}:{workdays:Array.isArray(S.workdays)&&S.workdays.length?S.workdays.map(Number).filter(C=>C>=0&&C<=6):[...L],holidays:v(S.holidays),hoursPerDay:null}}function w(S,_){let C,a,o=null;if(S==="weekends")C=[...L],a=[];else if(S&&typeof S=="object"&&!Array.isArray(S)&&!(S instanceof Date)){const $=S,h=$.workdays??$.workingDays;C=Array.isArray(h)&&h.length?h.map(Number).filter(i=>i>=0&&i<=6):_.workdays;const y=$.holidays??$.exceptions;a=Array.isArray(y)?v(y):_.holidays,$.hoursPerDay!=null&&(o=$.hoursPerDay)}else return null;const m=[...new Set(C)].sort(($,h)=>$-h);return{workdays:m,holidays:a,hoursPerDay:o,key:`${m.join(",")}|${a.join(",")}`}}function k(S){const _=b(S.calendar),C=Number.isFinite(S.projectStart)?S.projectStart:0,a=w({workdays:_.workdays,holidays:_.holidays},_).key,o=new Map,m=[],$=new Map;for(const[M,D]of Object.entries(S.calendars&&typeof S.calendars=="object"?S.calendars:{})){const I=w(D,_);I&&$.set(M,I)}const h=(M,D)=>{if(!o.has(M)){const I=U({workdays:D.workdays,holidays:D.holidays},C);o.set(M,{id:M,workdays:D.workdays,holidays:D.holidays,hoursPerDay:D.hoursPerDay,calendar:I,isWorking:I?O=>I.isWorking(O):()=>!0,key:D.key})}return o.get(M)};h(W,{..._,key:a});const y=(M,D,I)=>{if(M==null||M==="")return W;if(typeof M=="string"&&$.has(M))return h(M,$.get(M)).id;const O=M==="weekends"||M&&typeof M=="object"?w(M,_):null;if(O){const H=M==="weekends"?"weekends":`${I}:${D}`;return h(H,O).id}const B=typeof M=="string"?M:JSON.stringify(M);return m.push({code:"unknown-calendar",message:`${I} "${D}" names unknown calendar "${B}"`,id:D,calendar:B,owner:I}),null},i=new Map;let r=!1;for(const M of S.tasks||[]){const D=y(M.calendar,M.id,"task");D!=null&&(i.set(M.id,D),o.get(D).key!==a&&(r=!0))}const f=new Map;for(const M of S.resources||[]){const D=y(M.calendar,M.id,"resource");if(D==null||D===W)continue;const I=o.get(D);f.set(M.id,{workingDays:I.workdays,holidays:I.holidays,...I.hoursPerDay!=null?{hoursPerDay:I.hoursPerDay}:null})}return{errors:m,customised:r,models:o,ofTask:i,resourceSpec:f}}const u=Object.freeze({custom:!1,norm:(S,_)=>_,fin:(S,_,C)=>_+C,back:(S,_,C)=>_-C,shift:(S,_,C)=>_+C,unshift:(S,_,C)=>_-C,between:(S,_,C)=>_-C});function g(S){return{custom:!0,norm:(_,C)=>{const a=S(_);return a?a.nextWorking(C):C},fin:(_,C,a)=>{const o=S(_);return o?o.dayOf(o.indexOf(C)+a):C+a},back:(_,C,a)=>{const o=S(_);return o?o.dayOf(o.indexOf(C)-a):C-a},shift:(_,C,a)=>{const o=S(_);return o?o.dayOf(o.indexOf(C)+a):C+a},unshift:(_,C,a)=>{const o=S(_);return o?o.dayOf(o.indexOf(C)-a):C-a},between:(_,C,a)=>{const o=S(_);return o?o.indexOf(C)-o.indexOf(a):C-a}}}function d(S,_,C){const a=[];let o=null;for(let m=Math.round(S);m<Math.round(_);m+=1)C(m)?o==null&&(o=m):o!=null&&(a.push([o,m]),o=null);return o!=null&&a.push([o,Math.round(_)]),a}}),ae("packages/modules/gantt/assignments.js",function(p,V){"use strict";Object.defineProperty(p,"parseAssignments",{enumerable:!0,get:function(){return U}});function St(K){if(K==null||K==="")return null;const Y=typeof K=="number"?K:Number(K);return Number.isFinite(Y)?Y:null}function U(K){if(K&&Array.isArray(K.assignments))return K.assignments.map(l=>{const L=l&&(l.resource??l.name??l.id);if(L==null||L==="")return null;const v=St(l.units)??St(l.allocation)??1;return{resource:String(L),units:v}}).filter(Boolean);const Y=K?K.assignee??K.assignees??K.owner:null;return(Array.isArray(Y)?Y:Y==null||Y===""?[]:[Y]).map(l=>String(l)).filter(l=>l!=="").map(l=>({resource:l,units:1}))}}),ae("packages/modules/gantt/unscheduled.js",function(p,V){"use strict";Object.defineProperty(p,"UNSCHEDULED_DEFAULT_DURATION",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"isUnscheduled",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"findUnscheduled",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"activeEdges",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"unscheduledRecord",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"completeUnscheduledPatch",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"unscheduledMarker",{enumerable:!0,get:function(){return L}});const St=1;function U(v){return!!(v&&v.unscheduled===!0)}function K(v,b,w){const k=new Set;for(const u of v)!w.isSummary(u)&&b.get(u).duration==null&&k.add(u);if(!k.size)return k;for(const u of v)w.isSummary(u)&&w.descendantLeaves(u).every(g=>k.has(g))&&k.add(u);return k}function Y(v,b){return b.size?v.filter(w=>!b.has(w.from)&&!b.has(w.to)):v}function W(v,b){return{id:v.id,name:v.name,duration:null,es:null,ef:null,ls:null,lf:null,totalFloat:null,critical:!1,percentComplete:b?null:v.percentComplete,parent:v.parent,isSummary:b,isMilestone:!1,locked:b?!1:!!v.locked,unscheduled:!0,children:[]}}function l(v,b){if(!U(b)||b.isSummary||v.duration!==void 0)return v;const w=v.start!=null&&v.start!=="",k=v.end!=null&&v.end!=="";if(!w&&!k)return v;const u={...v,duration:St};if(!w){const g=Number(v.end);Number.isFinite(g)&&(u.start=g-St)}return u}function L(v,b,w){const k=v.createElement("span");return k.setAttribute("class",`${b}__unscheduled`),k.textContent=w("gantt.unscheduled"),k}}),ae("packages/modules/gantt/inactive.js",function(p,V){"use strict";Object.defineProperty(p,"bridgeInactive",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"inactiveRecord",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"inactiveMarker",{enumerable:!0,get:function(){return l}});const St=Object.freeze({FS:"es",SS:"es",FF:"ef",SF:"ef"}),U=Object.freeze({FS:"ef",SS:"es",FF:"ef",SF:"es"});function K(L,v){const b=L.lag+v.lag,w=U[L.type],k=St[v.type];let u;return w==="ef"&&k==="es"?u="FS":w==="ef"&&k==="ef"?u="FF":w==="es"&&k==="es"?u="SS":u="SF",{from:L.from,to:v.to,type:u,lag:b}}function Y(L,v){if(!v.size)return L;let b=L;for(const w of v){if(!b.some(_=>_.from===w||_.to===w))continue;const u=b.filter(_=>_.to===w),g=b.filter(_=>_.from===w),d=b.filter(_=>_.from!==w&&_.to!==w),S=[];for(const _ of u)for(const C of g)_.from!==C.to&&S.push(K(_,C));b=d.concat(S)}return b}function W(L){const v=L.earliestStart??null,b=L.duration??null,w=v!=null&&b!=null?v+b:null;return{id:L.id,name:L.name,duration:b,es:v,ef:w,ls:v,lf:w,totalFloat:null,critical:!1,percentComplete:L.percentComplete,parent:L.parent,isSummary:!1,isMilestone:b===0,locked:!!L.locked,inactive:!0,children:[],colour:L.colour??null}}function l(L,v,b){const w=L.createElement("span");return w.setAttribute("class",`${v}__inactive-marker`),w.textContent=b("gantt.inactive"),w}}),ae("packages/modules/gantt/schedule.js",function(p,V){"use strict";Object.defineProperty(p,"LINK_TYPES",{enumerable:!0,get:function(){return m}}),Object.defineProperty(p,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(p,"resolveConstraintCode",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"SCHEDULING_MODES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(p,"resolveSchedulingMode",{enumerable:!0,get:function(){return f}}),Object.defineProperty(p,"effortRate",{enumerable:!0,get:function(){return D}}),Object.defineProperty(p,"recomputeEffort",{enumerable:!0,get:function(){return I}}),Object.defineProperty(p,"reconcileEffort",{enumerable:!0,get:function(){return O}}),Object.defineProperty(p,"EPS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(p,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return H}}),Object.defineProperty(p,"TASK_FIELDS",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(p,"taskIdReader",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(p,"taskFieldWriters",{enumerable:!0,get:function(){return P}}),Object.defineProperty(p,"isTaskLocked",{enumerable:!0,get:function(){return x}}),Object.defineProperty(p,"normalizeTasks",{enumerable:!0,get:function(){return R}}),Object.defineProperty(p,"buildTree",{enumerable:!0,get:function(){return N}}),Object.defineProperty(p,"normalizeLinkSpec",{enumerable:!0,get:function(){return G}}),Object.defineProperty(p,"normalizeDependencies",{enumerable:!0,get:function(){return J}}),Object.defineProperty(p,"expandDependencies",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(p,"topoOrder",{enumerable:!0,get:function(){return st}}),Object.defineProperty(p,"wouldCreateCycle",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(p,"computeSchedule",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(p,"findViolations",{enumerable:!0,get:function(){return Pt}});const U=V("packages/core/src/internal/warn.js").warnOnce,Y=V("packages/modules/gantt/calendar.js").createCalendar,W=V("packages/modules/gantt/task-calendars.js"),l=W.PLAIN_TIME,L=W.createTimeModel,v=W.resolveCalendars,w=V("packages/modules/gantt/assignments.js").parseAssignments,u=V("packages/modules/gantt/time.js").toDayNumber,g=V("packages/modules/gantt/unscheduled.js"),d=g.activeEdges,S=g.findUnscheduled,_=g.unscheduledRecord,C=V("packages/modules/gantt/inactive.js"),a=C.bridgeInactive,o=C.inactiveRecord,m=["FS","SS","FF","SF"],$=["ASAP","MSO","MFO","ALAP","SNET","SNLT","FNET","FNLT"],h=Object.freeze({asap:"ASAP","as-soon-as-possible":"ASAP",assoonaspossible:"ASAP",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",snet:"SNET","start-no-earlier-than":"SNET",startnoearlierthan:"SNET",snlt:"SNLT","start-no-later-than":"SNLT",startnolaterthan:"SNLT",fnet:"FNET","finish-no-earlier-than":"FNET",finishnoearlierthan:"FNET",fnlt:"FNLT","finish-no-later-than":"FNLT",finishnolaterthan:"FNLT"});function y(et){if(et==null||et===""||typeof et=="object"&&!Array.isArray(et)&&!(et instanceof Date)&&(et=et.type??et.constraint??et.code??null,et==null||et===""))return null;const ft=String(et).toLowerCase().replace(/\s+/g,"-");return h[ft]??($.includes(String(et).toUpperCase())?String(et).toUpperCase():null)}const i=["fixedDuration","fixedEffort","fixedUnits"],r=Object.freeze({fixedduration:"fixedDuration","fixed-duration":"fixedDuration",duration:"fixedDuration",fixedeffort:"fixedEffort","fixed-effort":"fixedEffort",effort:"fixedEffort",work:"fixedEffort",fixedwork:"fixedEffort",fixedunits:"fixedUnits","fixed-units":"fixedUnits",units:"fixedUnits"});function f(et){if(et==null||et==="")return null;const ft=String(et).toLowerCase().replace(/\s+/g,"-");if(r[ft])return r[ft];const q=ft.replace(/-/g,"");return r[q]??null}const M=8;function D(et,ft){const q=ft.hoursPerDay,jt=ft.resourceHours instanceof Map?ft.resourceHours:new Map;if(!et||et.length===0)return{rate:q,units:1};let Et=0,mt=0;for(const yt of et){const tt=jt.has(yt.resource)?jt.get(yt.resource):q;Et+=yt.units*tt,mt+=yt.units}return{rate:Et,units:mt}}function I(et,ft){const q=et.schedulingMode||ft.defaultMode||"fixedDuration",jt=et.effortDriven!=null?!!et.effortDriven:!!ft.defaultEffortDriven,{rate:Et,units:mt}=D(et.assignments,ft),yt=et.duration,tt=et.statedEffort;let Mt=yt,It=tt??(yt!=null?yt*Et:null);return q==="fixedEffort"?tt!=null&&Et>0?Mt=tt/Et:It=yt!=null?yt*Et:null:q==="fixedUnits"?yt!=null?(Mt=yt,It=yt*Et):tt!=null&&Et>0&&(Mt=tt/Et,It=tt):Mt=yt,{duration:Mt,effort:It,units:mt,schedulingMode:q,effortDriven:jt}}function O(et,ft){const q=f(et.mode)||et.mode||"fixedDuration",jt=!!et.effortDriven,Et=et.hoursPerDay>0?et.hoursPerDay:M;let mt=et.duration,yt=et.units;const tt=mt*yt*Et,Mt=ft.field,It=ft.units!=null?ft.units:1;if(Mt==="duration")mt=ft.value,q==="fixedEffort"&&(yt=mt>0?tt/(mt*Et):yt);else if(Mt==="effort"){const Rt=ft.value;q==="fixedDuration"?yt=mt>0?Rt/(mt*Et):yt:mt=yt>0?Rt/(yt*Et):mt}else if(Mt==="units")yt=ft.value,q!=="fixedDuration"&&(mt=yt>0?tt/(yt*Et):mt);else if(Mt==="addResource"||Mt==="removeResource"){const Rt=Mt==="addResource"?It:-It;q==="fixedDuration"?jt||(yt=yt+Rt):(yt=yt+Rt,mt=yt>0?tt/(yt*Et):mt)}return{duration:mt,units:yt,effort:mt*yt*Et}}const B=1e-9,H={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",UNKNOWN_CALENDAR:"unknown-calendar"};function z(et){if(et==null||et==="")return null;const ft=typeof et=="number"?et:Number(et);return Number.isFinite(ft)?ft:null}function at(et){if(!et)return null;const ft=z(et.effort)??(Array.isArray(et.work)?null:z(et.work))??z(et.hours);if(ft!=null)return ft;if(Array.isArray(et.work)){let q=0,jt=!1;for(const Et of et.work){const mt=z(Et&&Et.hours);mt!=null&&(q+=mt,jt=!0)}return jt?q:null}return null}function dt(et){return et==null||et===""?null:u(et)}const kt=Object.freeze(["id","name","start","end","duration","milestone","percentComplete","parent","baselineStart","baselineEnd","constraint","constraintDate","deadline"]);function Tt(et){const ft=et&&typeof et=="object"?et:{},q={};for(const jt of kt){const Et=ft[jt];if(typeof Et=="function")q[jt]=Et;else if(typeof Et=="string"&&Et!==""){const mt=Et;q[jt]=yt=>yt[mt]}else q[jt]=mt=>mt[jt]}return q}function Ft(et){return Tt(et).id}function P(et){const ft=et&&typeof et=="object"?et:{},q={};for(const jt of kt){const Et=ft[jt];typeof Et=="string"&&Et!==""?q[jt]=Et:typeof Et=="function"?q[jt]=null:q[jt]=jt}return q}function j(et,ft){const q=ft.constraint(et);let jt=q??(et&&et.constraintType),Et=null;if(jt&&typeof jt=="object"&&!Array.isArray(jt)&&!(jt instanceof Date)&&(Et=jt.date??jt.at??jt.constraintDate??null,jt=jt.type??jt.constraint??jt.code??null),jt==null||jt==="")return null;const mt=y(jt);if(!mt)return null;const yt=dt(Et??ft.constraintDate(et)??et.constraintAt??et.at);return{type:mt,at:yt}}function x(et,ft){if(!et)return!1;if(et.locked===!0||typeof et.constraintMode=="string"&&et.constraintMode.toLowerCase()==="hard")return!0;if(typeof ft=="function")try{return!!ft(et)}catch{return!1}return!1}function R(et,ft,q){const jt=new Map,Et=[],mt=Tt(ft);if(!Array.isArray(et))return{ok:!1,error:{code:H.BAD_DURATION,message:"tasks must be an array"},order:Et,byId:jt};for(const yt of et){const tt=yt?mt.id(yt):null,Mt=tt!=null?String(tt):null;if(Mt==null)return{ok:!1,error:{code:H.UNKNOWN_TASK,message:"every task needs an id"},order:Et,byId:jt};if(jt.has(Mt))return{ok:!1,error:{code:H.DUPLICATE_ID,message:`duplicate task id "${Mt}"`,id:Mt},order:Et,byId:jt};const It=dt(mt.start(yt)),Rt=dt(mt.end(yt)),Xt=mt.milestone(yt)===!0;let Vt=Xt?0:z(mt.duration(yt));if(Vt==null&&It!=null&&Rt!=null&&(Vt=Rt-It),Vt!=null&&Vt<0)return{ok:!1,error:{code:H.BAD_DURATION,message:`task "${Mt}" has negative duration ${Vt}`,id:Mt},order:Et,byId:jt};const $t=mt.name(yt),Bt=mt.parent(yt),pe=yt.colour??yt.color;jt.set(Mt,{id:Mt,name:$t!=null?String($t):Mt,colour:typeof pe=="string"&&pe.trim()!==""?pe.trim():null,duration:Vt,milestoneFlag:Xt,earliestStart:It,placedStart:It,placedEnd:Rt,percentComplete:z(mt.percentComplete(yt)),parent:Bt!=null?String(Bt):null,constraint:j(yt,mt),locked:x(yt,q),inactive:yt.inactive===!0,baselineStart:dt(mt.baselineStart(yt)??(yt.baseline&&yt.baseline.start)),baselineEnd:dt(mt.baselineEnd(yt)??(yt.baseline&&yt.baseline.end)),deadline:dt(mt.deadline(yt)),schedulingMode:f(yt.schedulingMode??yt.taskType),effortDriven:yt.effortDriven==null?null:!!yt.effortDriven,statedEffort:at(yt),assignments:w(yt)}),Et.push(Mt)}return{ok:!0,order:Et,byId:jt}}function N(et,ft){const q=new Map(et.map(tt=>[tt,[]]));for(const tt of et){const Mt=ft.get(tt).parent;if(Mt!=null){if(!ft.has(Mt))return{ok:!1,error:{code:H.UNKNOWN_PARENT,message:`task "${tt}" names unknown parent "${Mt}"`,id:tt}};q.get(Mt).push(tt)}}for(const tt of et){const Mt=new Set;let It=ft.get(tt).parent;for(;It!=null;){if(It===tt||Mt.has(It))return{ok:!1,error:{code:H.PARENT_CYCLE,message:`parent cycle at "${tt}"`,id:tt}};Mt.add(It),It=ft.get(It)?.parent??null}}const jt=tt=>q.get(tt).length>0,Et=new Map,mt=tt=>{if(Et.has(tt))return Et.get(tt);const Mt=q.get(tt),It=Mt.length===0?[tt]:Mt.flatMap(Rt=>mt(Rt));return Et.set(tt,It),It};return{ok:!0,children:q,isSummary:jt,descendantLeaves:mt,ancestors:tt=>{const Mt=new Set;let It=ft.get(tt).parent;for(;It!=null;)Mt.add(It),It=ft.get(It).parent;return Mt}}}const X=/^\s*(FS|SS|FF|SF)\s*(?:([+-])\s*(\d+(?:\.\d+)?))?\s*$/i;function G(et){const ft={...et||null};if(typeof ft.type!="string")return ft;const q=X.exec(ft.type);if(!q||!q[2])return ft;const jt=(q[2]==="-"?-1:1)*Number(q[3]);ft.type=q[1].toUpperCase();const Et=z(et.lag);return Et!=null&&Et!==jt?(U(`gantt-link-shorthand-${String(et.type)}-${Et}`,`[lattice] gantt: dependency type ${JSON.stringify(et.type)} carries a lag of ${jt} but lag: ${Et} was also given; the explicit lag wins. Give one or the other.`),ft):(ft.lag=jt,ft)}function J(et,ft,q={}){const jt=[];if(et==null)return{ok:!0,edges:jt};if(!Array.isArray(et))return{ok:!1,error:{code:H.UNKNOWN_TASK,message:"dependencies must be an array"},edges:jt};const Et=typeof q.ancestors=="function"?q.ancestors:null;for(const mt of et){const yt=G(mt),tt=yt&&yt.from!=null?String(yt.from):null,Mt=yt&&yt.to!=null?String(yt.to):null,It=yt&&yt.type!=null?String(yt.type).toUpperCase():"FS",Rt=z(yt.lag)??0;if(tt==null||Mt==null)return{ok:!1,error:{code:H.UNKNOWN_TASK,message:"a dependency needs both `from` and `to`"},edges:jt};if(!ft.has(tt))return{ok:!1,error:{code:H.UNKNOWN_TASK,message:`dependency references unknown task "${tt}"`,id:tt},edges:jt};if(!ft.has(Mt))return{ok:!1,error:{code:H.UNKNOWN_TASK,message:`dependency references unknown task "${Mt}"`,id:Mt},edges:jt};if(tt===Mt)return{ok:!1,error:{code:H.SELF_DEPENDENCY,message:`task "${tt}" depends on itself`,id:tt},edges:jt};if(!m.includes(It))return{ok:!1,error:{code:H.BAD_LINK_TYPE,message:`unknown link type "${It}" (expected one of ${m.join("/")})`},edges:jt};if(Et&&(Et(tt).has(Mt)||Et(Mt).has(tt)))return{ok:!1,error:{code:H.DEP_ACROSS_HIERARCHY,message:`dependency between "${tt}" and "${Mt}" crosses their own parent/child hierarchy`,from:tt,to:Mt},edges:jt};jt.push({from:tt,to:Mt,type:It,lag:Rt})}return{ok:!0,edges:jt}}function Q(et,ft){const q=new Set,jt=[];for(const Et of et){(ft.isSummary(Et.from)||ft.isSummary(Et.to))&&Et.type!=="FS"&&U(`gantt-summary-link-${Et.type}-${Et.from}-${Et.to}`,`[lattice] gantt: ${Et.type} link with a summary endpoint (${Et.from} -> ${Et.to}) is expanded to descendant leaves — a conservative v1 reading; only FS is exact for summary endpoints.`);for(const yt of ft.descendantLeaves(Et.from))for(const tt of ft.descendantLeaves(Et.to)){if(yt===tt)continue;const Mt=[yt,tt,Et.type,Et.lag].join("");q.has(Mt)||(q.add(Mt),jt.push({from:yt,to:tt,type:Et.type,lag:Et.lag}))}}return jt}function pt(et,ft,q,jt=l){return et.map(Et=>{const mt=ft.get(Et.from),yt=ft.get(Et.to);if(!mt||!yt||mt.earliestStart==null||mt.duration==null||yt.earliestStart==null||yt.duration==null)return Et;if(jt.custom){const Vt=jt.norm(Et.from,mt.earliestStart),$t=jt.fin(Et.from,Vt,mt.duration),Bt=jt.norm(Et.to,yt.earliestStart),pe=jt.fin(Et.to,Bt,yt.duration);switch(Et.type){case"FS":return{...Et,lag:jt.between(Et.to,Bt,$t)};case"SS":return{...Et,lag:jt.between(Et.to,Bt,Vt)};case"FF":return{...Et,lag:jt.between(Et.to,pe,$t)};case"SF":return{...Et,lag:jt.between(Et.to,pe,Vt)};default:return Et}}const tt=q(mt.earliestStart),Mt=tt+mt.duration,It=q(yt.earliestStart),Rt=It+yt.duration;let Xt;switch(Et.type){case"FS":Xt=It-Mt;break;case"SS":Xt=It-tt;break;case"FF":Xt=Rt-Mt;break;case"SF":Xt=Rt-tt;break;default:return Et}return{...Et,lag:Xt}})}function st(et,ft){const q=new Map(et.map(yt=>[yt,0])),jt=new Map(et.map(yt=>[yt,[]]));for(const yt of ft)ht(q,yt.to),jt.get(yt.from).push(yt.to);const Et=et.filter(yt=>q.get(yt)===0),mt=[];for(;Et.length;){const yt=Et.shift();mt.push(yt);for(const tt of jt.get(yt)){const Mt=q.get(tt)-1;q.set(tt,Mt),Mt===0&&Et.push(tt)}}return mt.length===et.length?{ok:!0,sorted:mt}:{ok:!1,cycle:Ot(et,jt,new Set(mt))}}function ht(et,ft){et.set(ft,et.get(ft)+1)}function Ot(et,ft,q){const jt=et.find(tt=>!q.has(tt)),Et=[],mt=new Map;let yt=jt;for(;yt!=null&&!mt.has(yt);)mt.set(yt,Et.length),Et.push(yt),yt=ft.get(yt).find(tt=>!q.has(tt));return yt==null?Et:Et.slice(mt.get(yt)).concat(yt)}function wt(et,ft,q){const jt=String(ft),Et=String(q);if(jt===Et)return!0;const mt=new Map;for(const Mt of et){const It=String(Mt.from);mt.has(It)||mt.set(It,[]),mt.get(It).push(String(Mt.to))}const yt=new Set,tt=[Et];for(;tt.length;){const Mt=tt.pop();if(Mt===jt)return!0;if(!yt.has(Mt)){yt.add(Mt);for(const It of mt.get(Mt)||[])tt.push(It)}}return!1}function Jt(et,ft,q,jt){switch(ft.type){case"FS":return et.shift(jt.id,q.ef,ft.lag);case"SS":return et.shift(jt.id,q.es,ft.lag);case"FF":return et.back(jt.id,et.shift(jt.id,q.ef,ft.lag),jt.duration);case"SF":return et.back(jt.id,et.shift(jt.id,q.es,ft.lag),jt.duration);default:return-1/0}}function lt(et,ft,q,jt,Et,mt=new Map,yt=new Map,tt=!1,Mt=l){const It=st(et,q);if(!It.ok)return U(`gantt-cycle-${It.cycle.join(">")}`,`[lattice] gantt: dependency cycle detected (${It.cycle.join(" -> ")}); schedule refused.`),{ok:!1,error:{code:H.CYCLE,message:`dependency cycle: ${It.cycle.join(" -> ")}`,cycle:It.cycle}};const Rt=It.sorted,Xt=new Map(et.map(Lt=>[Lt,[]])),Vt=new Map(et.map(Lt=>[Lt,[]]));for(const Lt of q)Xt.get(Lt.to).push(Lt),Vt.get(Lt.from).push(Lt);const $t=new Map;for(const Lt of et){const ne=ft.get(Lt);$t.set(Lt,{id:Lt,name:ne.name,duration:ne.duration,es:0,ef:0,ls:0,lf:0,totalFloat:0,critical:!1,percentComplete:ne.percentComplete,parent:ne.parent,isSummary:!1,isMilestone:ne.duration===0,children:[],colour:ne.colour??null,locked:!!ne.locked})}const Bt=[];for(const Lt of Rt){const ne=ft.get(Lt),Zt=$t.get(Lt);let ct=Math.max(jt,ne.earliestStart??jt);for(const Ct of Xt.get(Lt)){const Dt=$t.get(Ct.from),zt=Jt(Mt,Ct,Dt,Zt);zt>ct&&(ct=zt)}const bt=mt.get(Lt);if(bt&&bt.at!=null)switch(bt.type){case"MSO":bt.at<ct-B?Bt.push({id:Lt,type:bt.type,date:bt.at,scheduled:ct,at:bt.at,earliestFeasible:ct}):ct=bt.at,Zt.pinned=!0;break;case"MFO":{const Ct=Mt.back(Lt,bt.at,Zt.duration);Ct<ct-B?Bt.push({id:Lt,type:bt.type,date:bt.at,scheduled:Mt.fin(Lt,ct,Zt.duration),at:bt.at,earliestFeasible:ct}):ct=Ct,Zt.pinned=!0;break}case"SNET":bt.at>ct+B&&(ct=bt.at);break;case"SNLT":ct>bt.at+B&&Bt.push({id:Lt,type:bt.type,date:bt.at,scheduled:ct,at:bt.at,earliestFeasible:ct});break;case"FNET":{const Ct=Mt.back(Lt,bt.at,Zt.duration);Ct>ct+B&&(ct=Ct);break}case"FNLT":{const Ct=Mt.fin(Lt,ct,Zt.duration);Ct>bt.at+B&&Bt.push({id:Lt,type:bt.type,date:bt.at,scheduled:Ct,at:bt.at,earliestFeasible:ct});break}default:break}if(ne.locked){const Ct=bt&&bt.at!=null?bt.type==="MFO"?Mt.back(Lt,bt.at,Zt.duration):bt.type==="MSO"?bt.at:null:null,Dt=ne.earliestStart!=null?ne.earliestStart:Ct??ct;if(ct-B>Dt)for(const zt of Xt.get(Lt)){const Ut=$t.get(zt.from),oe=Jt(Mt,zt,Ut,Zt);oe>Dt+B&&Bt.push({id:Lt,from:zt.from,to:Lt,type:"LOCKED",date:Dt,scheduled:oe,at:Dt,earliestFeasible:Dt})}ct=Dt,Zt.pinned=!0}ct=Mt.norm(Lt,ct),Zt.es=ct,Zt.ef=Mt.fin(Lt,ct,Zt.duration)}const pe=et.length?Math.max(...et.map(Lt=>$t.get(Lt).ef)):jt,we=Number.isFinite(Et)?Et:pe;for(let Lt=Rt.length-1;Lt>=0;Lt-=1){const ne=Rt[Lt],Zt=$t.get(ne);let ct=we;const bt=yt.get(ne);bt!=null&&bt<ct&&(ct=bt);for(const Ct of Vt.get(ne)){const Dt=$t.get(Ct.to);let zt;switch(Ct.type){case"FS":zt=Mt.unshift(Ct.to,Dt.ls,Ct.lag);break;case"SS":zt=Mt.fin(ne,Mt.unshift(Ct.to,Dt.ls,Ct.lag),Zt.duration);break;case"FF":zt=Mt.unshift(Ct.to,Dt.lf,Ct.lag);break;case"SF":zt=Mt.fin(ne,Mt.unshift(Ct.to,Dt.lf,Ct.lag),Zt.duration);break;default:zt=1/0}zt<ct&&(ct=zt)}Zt.pinned&&(ct=Zt.ef),Zt.lf=ct,Zt.ls=Mt.back(ne,ct,Zt.duration),Zt.totalFloat=Mt.between(ne,Zt.ls,Zt.es),Zt.critical=Zt.totalFloat<=B,bt!=null&&(Zt.deadline=bt,Zt.late=Zt.ef>bt+B)}for(const Lt of et){const ne=mt.get(Lt);if(!ne||ne.type!=="ALAP")continue;const Zt=$t.get(Lt);Zt.es=Zt.ls,Zt.ef=Zt.lf,Zt.totalFloat=0,Zt.critical=!0}const Yt=et.filter(Lt=>$t.get(Lt).critical),re=tt?[]:Ht(et,q,$t,Mt);return{ok:!0,tasks:$t,critical:Yt,criticalPaths:re,projectFinish:pe,conflicts:Bt}}function nt(et,ft){let q=null;if(Array.isArray(et))for(const jt of et){const Et=dt(jt?ft(jt):null);Et!=null&&(q==null||Et<q)&&(q=Et)}return q}function ot(et,ft=[],q={}){const jt=Tt(q.fields),Et=dt(q.projectStart),mt=Et??0,yt=Et??nt(et,jt.start)??0,tt=dt(q.deadline),Mt=Y(q.calendar,mt),It=[];for(const ie of Array.isArray(et)?et:[]){const xe=ie?jt.id(ie):null;xe!=null&&ie.calendar!=null&&It.push({id:String(xe),calendar:ie.calendar})}const Rt=[];for(const ie of Array.isArray(q.resources)?q.resources:[]){const xe=ie&&(ie.id??ie.name??ie.resource);xe!=null&&ie.calendar!=null&&Rt.push({id:String(xe),calendar:ie.calendar})}const Xt=q.calendars&&typeof q.calendars=="object"&&Object.keys(q.calendars).length>0,Vt=It.length||Rt.length||Xt?v({calendar:q.calendar,calendars:q.calendars,projectStart:mt,tasks:It,resources:Rt}):null;if(Vt&&Vt.errors.length){const ie=Vt.errors.map(xe=>({...xe,code:H.UNKNOWN_CALENDAR}));return{ok:!1,error:ie[0],errors:ie}}const $t=!!(Vt&&Vt.customised),Bt=$t?null:Mt,pe=$t?L(ie=>Vt.models.get(Vt.ofTask.get(ie)??"plan").calendar):l,we=ie=>ie==null?null:Bt?Bt.indexOf(ie):ie,Yt=ie=>Bt?Bt.dayOf(ie):ie,re=R(et,q.fields,q.lockWhen);if(!re.ok)return{ok:!1,error:re.error,errors:[re.error]};const{order:Lt,byId:ne}=re,Zt=N(Lt,ne);if(!Zt.ok)return{ok:!1,error:Zt.error,errors:[Zt.error]};const ct=J(ft,ne,Zt);if(!ct.ok)return{ok:!1,error:ct.error,errors:[ct.error]};const bt=q.honourDates?pt(ct.edges,ne,we,pe):ct.edges,Ct={defaultMode:f(q.schedulingMode)||"fixedDuration",defaultEffortDriven:!!q.effortDriven,hoursPerDay:z(q.hoursPerDay)??M,resourceHours:q.resourceHours instanceof Map?q.resourceHours:new Map},Dt=new Map;for(const ie of Lt){if(Zt.isSummary(ie))continue;const xe=ne.get(ie);if(!(xe.schedulingMode!=null||xe.effortDriven!=null||xe.statedEffort!=null||q.schedulingMode!=null||q.effortDriven!=null))continue;const Ne=I(xe,Ct);Ne.duration!=null&&(xe.duration=Ne.duration),Dt.set(ie,{schedulingMode:Ne.schedulingMode,effortDriven:Ne.effortDriven,effort:Ne.effort,units:Ne.units})}const zt=S(Lt,ne,Zt),Ut=new Set(Lt.filter(ie=>!Zt.isSummary(ie)&&ne.get(ie).inactive===!0)),oe=new Set([...zt].filter(ie=>!Ut.has(ie))),de=Lt.filter(ie=>!Zt.isSummary(ie)&&!oe.has(ie)&&!Ut.has(ie)),me=new Map(de.map(ie=>{const xe=ne.get(ie);return[ie,{...xe,earliestStart:we(xe.earliestStart)}]})),ve=new Map;for(const ie of de){const xe=ne.get(ie).constraint;xe&&ve.set(ie,{type:xe.type,at:we(xe.at)})}const Fe=Bt?Bt.indexOf(mt):mt,je=tt==null?void 0:we(tt),Ee=new Map;for(const ie of de){const xe=me.get(ie).deadline;if(xe==null)continue;const Ge=Bt?Bt.indexOf(xe):xe;Number.isFinite(Ge)&&Ee.set(ie,Ge)}const Se=a(d(Q(bt,Zt),oe),Ut),qe=lt(de,me,Se,Fe,je,ve,Ee,!!q.skipCriticalPaths,pe);if(!qe.ok)return{ok:!1,error:qe.error,errors:[qe.error]};const He=qe.tasks;for(const ie of de){const xe=He.get(ie);xe.es=Yt(xe.es),xe.ef=Yt(xe.ef),xe.ls=Yt(xe.ls),xe.lf=Yt(xe.lf),xe.deadline!=null&&(xe.deadline=Yt(xe.deadline)),vt(xe,ne.get(ie).baselineStart,ne.get(ie).baselineEnd);const Ge=Dt.get(ie);Ge&&(xe.schedulingMode=Ge.schedulingMode,xe.effortDriven=Ge.effortDriven,xe.effort=Ge.effort,xe.units=Ge.units)}for(const ie of Lt)oe.has(ie)?He.set(ie,_(ne.get(ie),Zt.isSummary(ie))):Ut.has(ie)&&He.set(ie,o(ne.get(ie)));if(Vt)for(const ie of Lt)He.get(ie).calendar=Vt.ofTask.get(ie)??"plan";for(let ie=Lt.length-1;ie>=0;ie-=1){const xe=Lt[ie];!Zt.isSummary(xe)||oe.has(xe)||He.set(xe,gt(xe,ne.get(xe),Zt,He))}for(const ie of Lt)Zt.isSummary(ie)&&(He.get(ie).children=Zt.children.get(ie).slice());const ln=Mt?Mt.nextWorking(yt):yt,pn=Yt(qe.projectFinish);return{ok:!0,tasks:He,order:Lt,critical:qe.critical,criticalPaths:qe.criticalPaths,projectStart:ln,projectFinish:pn,projectDuration:pn-ln,conflicts:(qe.conflicts||[]).map(ie=>({id:ie.id,type:ie.type,date:Yt(ie.date),scheduled:Yt(ie.scheduled),at:Yt(ie.at),earliestFeasible:Yt(ie.earliestFeasible),...ie.from!==void 0?{from:ie.from,to:ie.to}:null})),calendar:!!Mt,...$t?{calendars:Vt.models}:null,unscheduled:Lt.filter(ie=>oe.has(ie)),...q.honourDates?{dependencies:bt}:{}}}function vt(et,ft,q){ft==null&&q==null||(et.baselineStart=ft??null,et.baselineEnd=q??null,et.startVariance=ft==null?null:et.es-ft,et.finishVariance=q==null?null:et.ef-q,et.durationVariance=ft==null||q==null?null:et.ef-et.es-(q-ft))}function gt(et,ft,q,jt){const Et=q.children.get(et).map(Lt=>jt.get(Lt)),mt=Et.filter(Lt=>!Lt.unscheduled&&!Lt.inactive),yt=mt.length?mt:Et,tt=Math.min(...yt.map(Lt=>Lt.es)),Mt=Math.max(...yt.map(Lt=>Lt.ef)),It=Math.min(...yt.map(Lt=>Lt.ls)),Rt=Math.max(...yt.map(Lt=>Lt.lf)),Xt=q.descendantLeaves(et).map(Lt=>jt.get(Lt)),Vt=Xt.filter(Lt=>!Lt.unscheduled&&!Lt.inactive),$t=Vt.length?Vt:Xt,Bt=$t.reduce((Lt,ne)=>Lt+ne.duration,0),pe=Bt>B?$t.reduce((Lt,ne)=>Lt+ne.duration*(ne.percentComplete??0),0)/Bt:null,we={id:et,name:ft.name,duration:Mt-tt,es:tt,ef:Mt,ls:It,lf:Rt,totalFloat:It-tt,critical:yt.some(Lt=>Lt.critical),percentComplete:pe,parent:ft.parent,isSummary:!0,isMilestone:!1,locked:!1,...ft.inactive===!0?{inactive:!0}:null,children:[],colour:ft.colour??null},Yt=$t.map(Lt=>Lt.baselineStart).filter(Lt=>Lt!=null),re=$t.map(Lt=>Lt.baselineEnd).filter(Lt=>Lt!=null);return(Yt.length||re.length)&&vt(we,Yt.length?Math.min(...Yt):null,re.length?Math.max(...re):null),we}function Ht(et,ft,q,jt=l){const Et=new Map(et.map(It=>[It,[]])),mt=new Set;for(const It of ft){const Rt=q.get(It.from),Xt=q.get(It.to);if(!Rt.critical||!Xt.critical)continue;const Vt=Jt(jt,It,Rt,Xt);Math.abs(Vt-Xt.es)<=B&&(Et.get(It.from).push(It.to),mt.add(It.to))}const yt=et.filter(It=>q.get(It).critical&&!mt.has(It)),tt=[],Mt=(It,Rt)=>{const Xt=Et.get(It);if(!Xt.length){tt.push(Rt);return}for(const Vt of Xt)Mt(Vt,Rt.concat(Vt))};for(const It of yt)Mt(It,[It]);return tt}function Pt(et,ft,q){if(!ft||!ft.ok)return[];const jt=[],Et=Tt(q);for(const mt of et){const yt=mt?Et.id(mt):null,tt=yt!=null?String(yt):null;if(tt==null||!ft.tasks.has(tt))continue;const Mt=ft.tasks.get(tt);if(Mt.isSummary)continue;const It=z(Et.start(mt));It==null||Mt.unscheduled||It<Mt.es-B&&jt.push({id:tt,placedStart:It,earliestStart:Mt.es,by:Mt.es-It})}return jt}}),ae("packages/modules/gantt/resources.js",function(p,V){"use strict";Object.defineProperty(p,"normalizeCapacities",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"resourceDisplayNames",{enumerable:!0,get:function(){return i}}),Object.defineProperty(p,"resourceSpecsByKey",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"resourceAvatars",{enumerable:!0,get:function(){return f}}),Object.defineProperty(p,"normalizeResources",{enumerable:!0,get:function(){return B}}),Object.defineProperty(p,"resourceDailyHours",{enumerable:!0,get:function(){return H}}),Object.defineProperty(p,"sweepLoad",{enumerable:!0,get:function(){return z}}),Object.defineProperty(p,"computeResourceLoad",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"normalizeResourceRates",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(p,"rateOn",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(p,"levelResources",{enumerable:!0,get:function(){return x}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/modules/gantt/schedule.js"),Y=K.computeSchedule,W=K.EPS,l=K.taskIdReader,L=K.resolveConstraintCode,v=V("packages/modules/gantt/assignments.js"),b=v.parseAssignments,k=V("packages/modules/gantt/calendar.js").createCalendar,u=V("packages/modules/gantt/task-calendars.js"),g=u.parseHolidayDays,d=u.normalizeCalendarSpec,S=u.planWorkingTime,_=u.workingRuns,C=V("packages/modules/gantt/time.js"),a=C.fromDayNumber,o=C.toDayNumber;Object.defineProperty(p,"parseAssignments",{enumerable:!0,get:function(){return v.parseAssignments}});const m=Object.freeze([1,2,3,4,5]),$=8;function h(N){if(N==null||N==="")return null;const X=typeof N=="number"?N:Number(N);return Number.isFinite(X)?X:null}function y(N,X){const G=new Map;if(Array.isArray(N))for(const J of N){const Q=J&&(J.id??J.name??J.resource);if(Q==null||Q==="")continue;const pt=h(J.capacity??J.maxUnits??J.max??J.units);G.set(String(Q),pt??X)}else if(N&&typeof N=="object")for(const[J,Q]of Object.entries(N)){const pt=h(Q);G.set(String(J),pt??X)}return G}function i(N){const X=new Map;if(Array.isArray(N))for(const G of N){if(!G)continue;const J=G.id??G.name??G.resource;if(J==null||J==="")continue;const Q=G.name??G.id??G.resource;X.set(String(J),String(Q))}else if(N&&typeof N=="object")for(const[G,J]of Object.entries(N))X.set(G,J&&typeof J=="object"&&J.name!=null?String(J.name):G);return X}function r(N){const X=new Map;if(Array.isArray(N))for(const G of N){if(!G||typeof G!="object")continue;const J=G.id??G.name??G.resource;J!=null&&J!==""&&X.set(String(J),{...G})}else if(N&&typeof N=="object")for(const[G,J]of Object.entries(N))X.set(G,J&&typeof J=="object"?{...J}:{capacity:J});return X}function f(N){const X=new Map,G=J=>typeof J=="string"?J.trim():"";if(Array.isArray(N))for(const J of N){if(!J)continue;const Q=J.id??J.name??J.resource;if(Q==null||Q==="")continue;const pt=G(J.avatar);pt&&X.set(String(Q),pt)}else if(N&&typeof N=="object")for(const[J,Q]of Object.entries(N)){const pt=Q&&typeof Q=="object"?G(Q.avatar):"";pt&&X.set(J,pt)}return X}function M(N){return new Set(g(N))}function D(N){return N==null?{workdays:[0,1,2,3,4,5,6],holidays:new Set}:N==="weekends"?{workdays:[...m],holidays:new Set}:{workdays:Array.isArray(N.workdays)&&N.workdays.length?N.workdays.map(Number).filter(G=>G>=0&&G<=6):[...m],holidays:M(N.holidays)}}function I(N,X,G){let J=N;if(typeof N=="string"&&(J=X&&Object.prototype.hasOwnProperty.call(X,N)?X[N]:N==="weekends"?N:null),J==null||typeof J=="string"&&J!=="weekends")return null;const Q=d(J,G);if(!Q)return null;const pt=J;return{...pt==="weekends"||pt.workdays||pt.workingDays?{workingDays:Q.workdays}:null,...pt!=="weekends"&&(pt.holidays||pt.exceptions)?{holidays:Q.holidays}:null,...Q.hoursPerDay!=null?{hoursPerDay:Q.hoursPerDay}:null}}function O(N,X,G,J){const Q=new Set(Array.isArray(N.workingDays)&&N.workingDays.length?N.workingDays.map(Number).filter(gt=>gt>=0&><=6):J.workdays),pt=M(N.holidays);for(const gt of J.holidays)pt.add(gt);const st=N.hoursPerDay,ht=gt=>{if(st!=null&&typeof st=="object"){const Pt=h(st[gt]);return Pt??G}const Ht=h(st);return Ht??G},Ot=gt=>{const Ht=a(gt);return Ht?Q.has(Ht.getUTCDay())&&!pt.has(gt):!1},wt=gt=>Ot(gt)?X??ht(a(gt).getUTCDay()):0,Jt=gt=>G>0?wt(gt)/G:0;let lt=0;for(const gt of Q){const Ht=X??ht(gt);Ht>lt&&(lt=Ht)}const nt=G>0?lt/G:0;let ot=0;for(const gt of J.workdays)Q.has(gt)&&(ot+=X??ht(gt));const vt=J.workdays.length?ot/J.workdays.length:G;return{hasCalendar:!0,capacityUnits:nt,hoursPerWorkingDay:vt,worksOn:Ot,capacityHoursOn:wt,capacityUnitsOn:Jt}}function B(N,X,G={}){const J=h(G.hoursPerDay)??$,Q=D(G.calendar),pt=new Map,st=(ht,Ot)=>{const wt=h(Ot.capacity??Ot.maxUnits??Ot.max??Ot.units),Jt=I(Ot.calendar,G.calendars,S(G.calendar));Jt?pt.set(ht,O(Jt,wt,J,Q)):pt.set(ht,{hasCalendar:!1,capacityUnits:wt??X,hoursPerWorkingDay:J})};if(Array.isArray(N))for(const ht of N){const Ot=ht&&(ht.id??ht.name??ht.resource);Ot==null||Ot===""||st(String(Ot),ht)}else if(N&&typeof N=="object")for(const[ht,Ot]of Object.entries(N))st(String(ht),typeof Ot=="object"&&Ot?Ot:{capacity:Ot});return pt}function H(N,X,G={}){const J=h(G.hoursPerDay)??$,Q=B(N,X,G),pt=new Map;for(const[st,ht]of Q)pt.set(st,ht.hoursPerWorkingDay!=null?ht.hoursPerWorkingDay:J);return pt}function z(N){if(!N.length)return[];const X=new Set;for(const Q of N)X.add(Q.s),X.add(Q.e);const G=[...X].sort((Q,pt)=>Q-pt),J=[];for(let Q=0;Q<G.length-1;Q+=1){const pt=G[Q],st=G[Q+1];if(st<=pt)continue;let ht=0;const Ot=[];for(const wt of N)wt.s<=pt&&wt.e>=st&&(ht+=wt.units,Ot.push(wt.taskId));Ot.length&&J.push({s:pt,e:st,load:ht,taskIds:Ot})}return J}function at(N,X,G={}){const J={ok:!1,resources:[],overAllocations:[],byResource:new Map};if(!X||!X.ok)return J;const Q=h(G.defaultCapacity)??1,pt=y(G.resources,Q),st=B(G.resources,Q,{calendar:G.calendar,calendars:G.calendars,hoursPerDay:G.hoursPerDay}),ht=X.calendars instanceof Map?X.calendars:null,Ot=G.calendar!=null&&!ht?k(G.calendar,X.projectStart):null,wt=et=>pt.has(et)?pt.get(et):Q,Jt=et=>Ot?Ot.indexOf(et):et,lt=et=>Ot?Ot.dayOf(et):et,nt=l(G.fields),ot=new Map;for(const et of N){if(!et)continue;const ft=nt(et);if(ft==null)continue;const q=String(ft);ot.has(q)||ot.set(q,et)}const vt=new Map;for(const et of X.order){const ft=X.tasks.get(et);if(!ft||ft.isSummary||ft.unscheduled)continue;const q=ot.get(et);if(!q)continue;const jt=b(q);if(!jt.length)continue;const Et=Jt(ft.es),mt=Jt(ft.ef);if(mt<=Et)continue;const yt=ht&&ht.get(ft.calendar),tt=yt?_(Et,mt,yt.isWorking):[[Et,mt]];for(const Mt of jt){vt.has(Mt.resource)||vt.set(Mt.resource,[]);for(const[It,Rt]of tt)vt.get(Mt.resource).push({s:It,e:Rt,units:Mt.units,taskId:et})}}const gt=new Map,Ht=[],Pt=[];for(const[et,ft]of vt){const q=st.get(et),jt=z(ft);let Et=0,mt,yt;if(q&&q.hasCalendar){yt=q.capacityUnits,mt=[];for(const Mt of jt){Mt.load>Et&&(Et=Mt.load);let It=Mt.s,Rt=q.capacityUnitsOn(lt(Mt.s));const Xt=Vt=>{const $t={start:lt(It),end:lt(Vt),load:Mt.load,taskIds:Mt.taskIds};mt.push($t),Mt.load>Rt+W&&Pt.push({resource:et,capacity:Rt,start:$t.start,end:$t.end,load:Mt.load,taskIds:Mt.taskIds.slice()})};for(let Vt=Mt.s+1;Vt<Mt.e;Vt+=1){const $t=q.capacityUnitsOn(lt(Vt));$t!==Rt&&(Xt(Vt),It=Vt,Rt=$t)}Xt(Mt.e)}}else yt=wt(et),mt=jt.map(Mt=>{Mt.load>Et&&(Et=Mt.load);const It={start:lt(Mt.s),end:lt(Mt.e),load:Mt.load,taskIds:Mt.taskIds};return Mt.load>yt+W&&Pt.push({resource:et,capacity:yt,start:It.start,end:It.end,load:Mt.load,taskIds:Mt.taskIds.slice()}),It});const tt={resource:et,capacity:yt,peak:Et,segments:mt};gt.set(et,tt),Ht.push(tt)}return Ht.sort((et,ft)=>et.resource<ft.resource?-1:et.resource>ft.resource?1:0),Pt.sort((et,ft)=>et.start-ft.start||(et.resource<ft.resource?-1:1)),{ok:!0,resources:Ht,overAllocations:Pt,byResource:gt}}function dt(N){const X=[];for(const G of Array.isArray(N)?N:[]){const J=o(G&&G.from),Q=h(G&&G.rate);J==null||Q==null||X.push({from:Math.round(J),rate:Q})}return X.sort((G,J)=>G.from-J.from),X}function kt(N){const X=new Map,G=(J,Q)=>{if(!Q||typeof Q!="object")return;const pt=Q.type==="material"||Q.type==="cost"?Q.type:"work",st=h(Q.rate),ht=dt(Q.rates),Ot=h(Q.cost);st==null&&!ht.length&&Ot==null||X.set(J,{type:pt,rate:st,rates:ht,cost:Ot})};if(Array.isArray(N))for(const J of N){const Q=J&&(J.id??J.name??J.resource);Q==null||Q===""||G(String(Q),J)}else if(N&&typeof N=="object")for(const[J,Q]of Object.entries(N))Q&&typeof Q=="object"&&G(J,Q);return X}function Tt(N,X){if(!N)return null;let G=N.rate;for(const J of N.rates)if(J.from<=X)G=J.rate;else break;return G??null}function Ft(N){if(!N)return!1;const X=N.constraint??N.constraintType;if(X==null||X==="")return!1;const G=String(X).toLowerCase().replace(/\s+/g,"-");return G==="mso"||G==="must-start-on"||G==="muststarton"||G==="start-on"||G==="mfo"||G==="must-finish-on"||G==="mustfinishon"||G==="finish-on"}function P(N){if(!N)return null;const X=N.constraint??N.constraintType,G=L(X);if(G!=="SNLT"&&G!=="FNLT")return null;let J=N.constraintDate??N.constraintAt??N.at;if(X&&typeof X=="object"&&J==null&&(J=X.date),J==null||J==="")return null;const Q=o(J);return Number.isFinite(Q)?{type:G,date:Q}:null}function j(N,X){return N?h(N[X])??0:0}function x(N,X,G={}){const J={projectStart:G.projectStart,deadline:G.deadline,calendar:G.calendar,fields:G.fields,calendars:G.calendars,resources:Array.isArray(G.resources)?G.resources:void 0,skipCriticalPaths:!0},Q=G.priorityField||"priority",pt=G.maxIterations!=null?G.maxIterations:Math.max(100,N.length*N.length*2),st=l(G.fields),ht=N.map(mt=>({...mt})),Ot=ht.map(mt=>String(st(mt))),wt=new Map(ht.map(mt=>[String(st(mt)),mt])),Jt=new Map(Ot.map((mt,yt)=>[mt,yt])),lt=mt=>Jt.has(mt)?Jt.get(mt):-1;let nt=Y(ht,X,J);if(!nt.ok)return{ok:!1,error:nt.error};const ot=new Map;for(const mt of nt.order){const yt=nt.tasks.get(mt);yt&&!yt.isSummary&&!yt.unscheduled&&ot.set(mt,yt.es)}const vt=h(G.defaultCapacity)??1,gt=B(G.resources,vt,{calendar:G.calendar,calendars:G.calendars,hoursPerDay:G.hoursPerDay}),Ht=G.calendar!=null?k(G.calendar,nt.projectStart):null,Pt=(mt,yt,tt)=>{const Mt=b(yt).map(Rt=>gt.get(Rt.resource)).filter(Rt=>Rt&&Rt.hasCalendar);let It=Math.round(mt);for(let Rt=0;Rt<3660;Rt+=1){if((tt?tt(It):!Ht||Ht.isWorking(It))&&Mt.every(Xt=>Xt.worksOn(It)))return It;It+=1}return Math.round(mt)};let et=0;const ft=Math.max(32,N.length*2);let q=1/0,jt=0;for(;et<pt;et+=1){const mt=at(ht,nt,G);mt.overAllocations.length<q?(q=mt.overAllocations.length,jt=0):jt+=1;const yt=mt.overAllocations.filter(Vt=>new Set(Vt.taskIds).size>=2);if(!yt.length)return{ok:!0,resolved:mt.overAllocations.length===0,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:mt.overAllocations,iterations:et};if(jt>=ft)return U("gantt-level-unresolved",`[lattice] gantt: resource leveling could not clear ${mt.overAllocations.length} over-allocation(s) after ${et} iterations; the plan cannot be fully levelled, returning the partial result.`),{ok:!0,resolved:!1,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:mt.overAllocations,iterations:et};const Mt=yt.slice().sort((Vt,$t)=>Vt.start-$t.start||$t.load-Vt.load)[0].taskIds.map(Vt=>nt.tasks.get(Vt)).filter(Boolean),It=Mt.filter(Vt=>!Ft(wt.get(Vt.id)));if(!It.length)return{ok:!0,resolved:!1,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:mt.overAllocations,iterations:et};It.sort((Vt,$t)=>{if($t.totalFloat!==Vt.totalFloat)return $t.totalFloat-Vt.totalFloat;const Bt=j(wt.get(Vt.id),Q),pe=j(wt.get($t.id),Q);return Bt!==pe?Bt-pe:$t.es!==Vt.es?$t.es-Vt.es:lt($t.id)-lt(Vt.id)});let Rt=null,Xt=null;for(const Vt of It){const $t=Mt.filter(Yt=>Yt.id!==Vt.id).map(Yt=>Yt.ef).filter(Yt=>Yt>Vt.es+W),Bt=$t.length?Math.min(...$t):Vt.es+1,pe=Pt(Bt,wt.get(Vt.id),nt.calendars instanceof Map?nt.calendars.get(Vt.calendar).isWorking:void 0),we=P(wt.get(Vt.id));if(!(we&&(we.type==="SNLT"?pe:pe+(Vt.ef-Vt.es))>we.date+W)){Rt=Vt,Xt=pe;break}}if(!Rt)return{ok:!0,resolved:!1,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:mt.overAllocations,iterations:et};if(wt.get(Rt.id).start=Xt,nt=Y(ht,X,J),!nt.ok)return{ok:!1,error:nt.error}}const Et=at(ht,nt,G);return Et.overAllocations.length&&U("gantt-level-unresolved",`[lattice] gantt: resource leveling hit its ${pt}-iteration cap with ${Et.overAllocations.length} over-allocation(s) unresolved; returning the partial result.`),{ok:!0,resolved:Et.overAllocations.length===0,tasks:ht,schedule:nt,moves:R(ot,nt),remaining:Et.overAllocations,iterations:et}}function R(N,X){const G=[];for(const J of X.order){const Q=X.tasks.get(J);if(!Q||Q.isSummary||Q.unscheduled)continue;const pt=N.get(J);pt!=null&&Q.es>pt+W&&G.push({id:J,from:pt,to:Q.es,delay:Q.es-pt})}return G}}),ae("packages/modules/gantt/week.js",function(p,V){"use strict";Object.defineProperty(p,"EXPLICIT_WEEK_START_DAY",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"localeWeekStartDay",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"validWeekStartDay",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"resolveWeekStartDay",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"weekStartOf",{enumerable:!0,get:function(){return v}});const U=V("packages/modules/gantt/time.js").fromDayNumber,K=Symbol("gantt.explicitWeekStartDay"),Y=new Set(["US","CA","MX","BR","AR","CO","VE","EC","PE","CL","IL","JP","KR","TW","HK","PH","ZA","EG"]);function W(b){if(!b||typeof b!="string")return null;try{const w=new Intl.Locale(b),k=w.weekInfo??(typeof w.getWeekInfo=="function"?w.getWeekInfo():null);if(k&&Number.isFinite(k.firstDay))return k.firstDay===7?0:k.firstDay;const u=w.region||b.split(/[-_]/).find(g=>g.length===2);if(u)return Y.has(u.toUpperCase())?0:1}catch{}return null}function l(b){return Number.isFinite(b)&&b>=0&&b<=6?Math.floor(b):null}function L(b,w){const k=l(b);if(k!=null)return k;const u=W(w);return u??0}function v(b,w){const k=U(b),u=k?k.getUTCDay():0;return b-((u-w)%7+7)%7}}),ae("packages/modules/gantt/workload.js",function(p,V){"use strict";Object.defineProperty(p,"WORKLOAD_DEFAULTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"HISTOGRAM_DEFAULTS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"normalizeThresholds",{enumerable:!0,get:function(){return a}}),Object.defineProperty(p,"thresholdFor",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"normalizeExternalLoad",{enumerable:!0,get:function(){return $}}),Object.defineProperty(p,"statedHours",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"taskContour",{enumerable:!0,get:function(){return i}}),Object.defineProperty(p,"contourTotal",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"serializeContour",{enumerable:!0,get:function(){return f}}),Object.defineProperty(p,"contourSpan",{enumerable:!0,get:function(){return M}}),Object.defineProperty(p,"spanDuration",{enumerable:!0,get:function(){return D}}),Object.defineProperty(p,"spreadHours",{enumerable:!0,get:function(){return I}}),Object.defineProperty(p,"setContourBucket",{enumerable:!0,get:function(){return O}}),Object.defineProperty(p,"retimeContour",{enumerable:!0,get:function(){return B}}),Object.defineProperty(p,"recordWorkingDays",{enumerable:!0,get:function(){return H}}),Object.defineProperty(p,"workloadBuckets",{enumerable:!0,get:function(){return z}}),Object.defineProperty(p,"taskAssignmentEffort",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"computeWorkload",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(p,"formatHours",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(p,"formatPercent",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(p,"formatCost",{enumerable:!0,get:function(){return Ft}});const St=V("packages/modules/gantt/resources.js"),U=St.parseAssignments,K=St.rateOn,Y=V("packages/modules/gantt/schedule.js"),W=Y.EPS,l=Y.taskIdReader,L=V("packages/modules/gantt/time.js"),v=L.fromDayNumber,b=L.toDayNumber,w=L.toISODate,u=V("packages/core/src/internal/warn.js").warnOnce,d=V("packages/modules/gantt/week.js").weekStartOf,S=Object.freeze({hoursPerDay:8,height:160,rowHeight:28,decimals:1,totals:!0,maxHeight:null,unit:"hours",thresholds:null,showUnassigned:!0,labelWidth:null}),_=Object.freeze({resources:null,unit:"hours",stacked:!1,height:160,rowHeight:48,maxHeight:null,labelWidth:null});function C(P){if(P==null||P===""||typeof P=="boolean")return null;const j=typeof P=="number"?P:Number(P);return Number.isFinite(j)?j:null}function a(P){if(!Array.isArray(P))return null;const j=[];for(const x of P){if(!x||typeof x!="object")continue;const R=C(x.at);if(R==null||R<0)continue;const N=typeof x.className=="string"&&x.className?x.className:null,X=typeof x.colour=="string"&&x.colour?x.colour:typeof x.color=="string"&&x.color?x.color:null;!N&&!X||j.push({at:R,className:N,colour:X})}return j.length?(j.sort((x,R)=>x.at-R.at),j):null}function o(P,j){if(!P||j==null||!Number.isFinite(j))return null;let x=null;for(const R of P)if(j>=R.at)x=R;else break;return x}function m(P,j){if(P==null||P==="")return null;if(typeof P=="number")return Number.isFinite(P)?P:null;const x=b(P);return Number.isFinite(x)?x-j:null}function $(P,j=0){if(!Array.isArray(P))return[];const x=[];for(let R=0;R<P.length;R+=1){const N=P[R],X=N&&typeof N=="object"&&N.resource!=null&&N.resource!==""?String(N.resource):null,G=N&&typeof N=="object"?m(N.start,j):null,J=N&&typeof N=="object"?m(N.end,j):null;if(X==null||G==null||J==null){u(`gantt.workloadExternal.${R}`,`[lattice] gantt: workload.external entry ${R} has no resource or no drawable start/end; it is skipped.`);continue}const Q=typeof N.label=="string"&&N.label!==""?N.label:null,pt=typeof N.group=="string"&&N.group!==""?N.group:null;x.push({index:R,resource:X,start:G,end:J,units:C(N.units),hours:C(N.hours),label:Q,group:pt})}return x}function h(P){const j=b(P.start);if(!Number.isFinite(j))return null;const x=b(P.end);if(Number.isFinite(x))return{es:j,ef:x};const R=C(P.duration);return{es:j,ef:j+(R??0)}}function y(P){if(!P||Array.isArray(P.work))return null;const j=C(P.work);return j??C(P.hours)}function i(P){if(!P||!Array.isArray(P.work))return null;const j=[];for(const R of P.work){if(!R||typeof R!="object")continue;const N=b(R.date),X=C(R.hours);N==null||X==null||j.push({day:Math.round(N),hours:X})}j.sort((R,N)=>R.day-N.day);const x=[];for(const R of j){const N=x[x.length-1];N&&N.day===R.day?N.hours+=R.hours:x.push({day:R.day,hours:R.hours})}return x}function r(P){return(Array.isArray(P)?P:[]).reduce((j,x)=>j+(C(x.hours)??0),0)}function f(P){const j=[];for(const x of Array.isArray(P)?P:[]){const R=C(x.hours);if(R==null||!(Math.abs(R)>W))continue;const N=w(x.day);N!=null&&j.push({date:N,hours:Math.round(R*1e6)/1e6})}return j}function M(P){const j=(Array.isArray(P)?P:[]).filter(x=>Math.abs(C(x.hours)??0)>W);return j.length?{first:j[0].day,last:j[j.length-1].day}:null}function D(P,j,x=null){if(!Number.isFinite(P)||!Number.isFinite(j)||j<P)return 0;if(typeof x!="function")return Math.round(j-P)+1;let R=0;for(let N=Math.round(P);N<=Math.round(j);N+=1)x(N)&&(R+=1);return R}function I(P,j){if(!Array.isArray(P)||!P.length)return[];const x=j/P.length;return P.map(R=>({day:R,hours:x}))}function O(P,j,x,R){const N=(Array.isArray(P)?P:[]).filter(G=>!(G.day>=j.start&&G.day<j.end)),X=Math.abs(R)>W?I(x,R):[];return[...N,...X].sort((G,J)=>G.day-J.day)}function B(P,j,x){const R=Array.isArray(j)?j:[],N=Array.isArray(x)?x:[];if(!Array.isArray(P)||!R.length||!N.length)return Array.isArray(P)?P:[];const X=new Map(P.map(pt=>[pt.day,C(pt.hours)??0])),G=R.map(pt=>X.get(pt)??0),J=G.length,Q=[];for(let pt=0;pt<N.length;pt+=1){const st=G[Math.min(J-1,Math.floor(pt*J/N.length))];Math.abs(st)>W&&Q.push({day:N[pt],hours:st})}return Q}function H(P,j=null){const x=[];if(!P||!Number.isFinite(P.es)||!Number.isFinite(P.ef))return x;for(let R=Math.floor(P.es);R<Math.ceil(P.ef);R+=1)(typeof j!="function"||j(R))&&x.push(R);return x}function z(P,j,x,R=0){const N=Math.floor(j),X=Math.ceil(x),G=[];if(!(X>N))return G;if(P==="day"){for(let Q=N;Q<X;Q+=1)G.push({start:Q,end:Q+1});return G}if(P==="month"||P==="quarter"){const Q=v(N);if(!Q)return G;const pt=P==="quarter"?Q.getUTCMonth()-Q.getUTCMonth()%3:Q.getUTCMonth();let st=Date.UTC(Q.getUTCFullYear(),pt,1)/864e5;for(;st<X;){const ht=v(st),Ot=P==="quarter"?3-ht.getUTCMonth()%3:1,wt=Date.UTC(ht.getUTCFullYear(),ht.getUTCMonth()+Ot,1)/864e5;G.push({start:st,end:wt}),st=wt}return G}let J=d(N,R);for(;J<X;J+=7)G.push({start:J,end:J+7});return G}function at(P,j,x={}){const R=C(x.hoursPerDay)??S.hoursPerDay,N=typeof x.isWorking=="function"?x.isWorking:null,X=H(j,N),G=i(P);if(!G&&!X.length)return[];const J=U(P),Q=J.length?J:[{resource:null,units:1}],pt=Q.reduce((ht,Ot)=>ht+(C(Ot.units)??0),0);if(!(pt>0))return[];let st;if(G)st=G.filter(ht=>Math.abs(ht.hours)>W);else{const ht=y(P),Ot=ht??X.length*R*pt;if(!(Math.abs(Ot)>W))return[];st=I(X,Ot)}return st.length?Q.map(ht=>{const Ot=C(ht.units)??0,wt=Ot/pt;return{resource:ht.resource,units:Ot,unitsTotal:pt,perDay:wt>0?st.map(Jt=>({day:Jt.day,hours:Jt.hours*wt})):[]}}):[]}function dt(P,j,x={}){const R=Array.isArray(x.buckets)?x.buckets:[],N={ok:!1,buckets:[],rows:[],totals:R.map(()=>null),totalsAvailable:R.map(()=>null),totalsCost:R.map(()=>null),grandTotal:0,grandAvailableTotal:null,grandCostTotal:null};if(!j||!j.ok)return N;const X=C(x.hoursPerDay)??S.hoursPerDay,G=typeof x.isWorking=="function"?x.isWorking:null,J=x.capacities instanceof Map?x.capacities:null,Q=x.resourceModels instanceof Map?x.resourceModels:null,pt=x.resourceRates instanceof Map?x.resourceRates:null,st=l(x.fields),ht=new Map,Ot=(mt,yt,tt,Mt)=>{ht.has(mt)||ht.set(mt,{days:new Map,costs:new Map,tasks:new Map});const It=ht.get(mt);if(It.days.set(yt,(It.days.get(yt)||0)+tt),pt&&mt!=null){const Xt=K(pt.get(mt),yt);Xt!=null&&It.costs.set(yt,(It.costs.get(yt)||0)+tt*Xt)}It.tasks.has(Mt.id)||It.tasks.set(Mt.id,{...Mt,days:new Map});const Rt=It.tasks.get(Mt.id);Rt.days.set(yt,(Rt.days.get(yt)||0)+tt)},wt=new Map;for(const mt of Array.isArray(P)?P:[]){const yt=mt?st(mt):null;yt!=null&&wt.set(String(yt),mt)}const Jt=Array.isArray(P)&&j.order.length===P.length;for(let mt=0;mt<j.order.length;mt+=1){const yt=j.order[mt],tt=j.tasks.get(yt);if(!tt||tt.isSummary||tt.unscheduled||tt.inactive)continue;const Mt=wt.get(yt)||(Jt?P[mt]:null);if(!Mt||Mt.loadOnly===!0)continue;const It=j.calendars instanceof Map?j.calendars.get(tt.calendar):null,Rt=at(Mt,tt,{hoursPerDay:X,isWorking:It?It.isWorking:G});for(const Xt of Rt){if(!Xt.perDay.length)continue;const Vt={id:yt,name:tt.name,units:Xt.units,unitsTotal:Xt.unitsTotal,raw:Mt,loadOnly:!1,external:!1,group:null};for(const $t of Xt.perDay)Ot(Xt.resource,$t.day,$t.hours,Vt)}}for(const mt of Array.isArray(P)?P:[]){if(!mt||mt.loadOnly!==!0)continue;const yt=h(mt);if(!yt)continue;const tt=st(mt),Mt=tt!=null?String(tt):`loadOnly:${P.indexOf(mt)}`,It=mt.name!=null?String(mt.name):Mt,Rt=at(mt,yt,{hoursPerDay:X,isWorking:G});for(const Xt of Rt){if(!Xt.perDay.length)continue;const Vt={id:Mt,name:It,units:Xt.units,unitsTotal:Xt.unitsTotal,raw:mt,loadOnly:!0,external:!1,group:null};for(const $t of Xt.perDay)Ot(Xt.resource,$t.day,$t.hours,Vt)}}for(const mt of Array.isArray(x.external)?x.external:[]){if(!mt||mt.resource==null)continue;const yt=C(mt.start),tt=C(mt.end);if(yt==null||tt==null)continue;const Mt=H({es:yt,ef:tt},G),It=mt.hours!=null?C(mt.hours):Mt.length*X*(C(mt.units)??1);if(It==null||!(Math.abs(It)>W)||!Mt.length)continue;const Xt={id:`external:${mt.index??P.length}`,name:mt.label,units:null,unitsTotal:null,raw:null,loadOnly:!0,external:!0,group:mt.group??null};for(const Vt of I(Mt,It))Ot(String(mt.resource),Vt.day,Vt.hours,Xt)}const lt=mt=>{let yt=0,tt=R.length-1;for(;yt<=tt;){const Mt=yt+tt>>1;if(mt<R[Mt].start)tt=Mt-1;else if(mt>=R[Mt].end)yt=Mt+1;else return Mt}return-1},nt=R.map(mt=>{let yt=0;for(let tt=Math.floor(mt.start);tt<Math.ceil(mt.end);tt+=1)(!G||G(tt))&&(yt+=1);return{start:mt.start,end:mt.end,workingDays:yt}}),ot=mt=>{const yt=nt.map(()=>0);for(const[tt,Mt]of mt){const It=lt(tt);It>=0&&(yt[It]+=Mt)}return yt},vt=[...ht.keys()].filter(mt=>mt!=null).sort(),gt=ht.has(null)?[...vt,null]:vt,Ht=[],Pt=nt.map(()=>0),et=nt.map(()=>null),ft=pt?nt.map(()=>0):nt.map(()=>null);let q=0,jt=pt?0:null;for(const mt of gt){const yt=ht.get(mt),tt=ot(yt.days),Mt=pt?ot(yt.costs):null,It=mt!=null&&J&&J.has(mt)?J.get(mt):null,Rt=mt!=null&&Q?Q.get(mt):null,Xt=tt.map(re=>Math.abs(re)>W?re:null),Vt=tt.map((re,Lt)=>{if(Rt&&Rt.hasCalendar){let ne=0;for(let Zt=Math.floor(nt[Lt].start);Zt<Math.ceil(nt[Lt].end);Zt+=1)(!G||G(Zt))&&(ne+=Rt.capacityHoursOn(Zt));return ne}return It==null?null:It*X*nt[Lt].workingDays}),$t=tt.map((re,Lt)=>Vt[Lt]!=null&&re>Vt[Lt]+W);let Bt=0,pe=null,we=pt?0:null;tt.forEach((re,Lt)=>{Bt+=re,Pt[Lt]+=re,Vt[Lt]!=null&&(pe=(pe??0)+Vt[Lt],et[Lt]=(et[Lt]??0)+Vt[Lt]),Mt&&(we+=Mt[Lt],ft[Lt]+=Mt[Lt])}),q+=Bt,pt&&(jt+=we);const Yt=[...yt.tasks.values()].map(re=>{const Lt=ot(re.days);return{id:re.id,name:re.name,units:re.units,unitsTotal:re.unitsTotal,raw:re.raw,cells:Lt.map(ne=>Math.abs(ne)>W?ne:null),total:Lt.reduce((ne,Zt)=>ne+Zt,0),loadOnly:!!re.loadOnly,external:!!re.external,group:re.group??null}});Ht.push({resource:mt,capacity:It,available:Vt,availableTotal:pe,cells:Xt,over:$t,total:Bt,costCells:Mt?Mt.map(re=>Math.abs(re)>W?re:null):null,costTotal:we,tasks:Yt})}let Et=null;for(const mt of et)mt!=null&&(Et=(Et??0)+mt);return{ok:!0,buckets:nt,rows:Ht,totals:Pt.map(mt=>Math.abs(mt)>W?mt:null),totalsAvailable:et,totalsCost:ft,grandTotal:q,grandAvailableTotal:Et,grandCostTotal:jt}}function kt(P,j){if(P==null||!Number.isFinite(P))return"";const R=10**(Number.isFinite(j)?Math.max(0,Math.min(6,Math.round(j))):1),N=Math.round(P*R)/R;return Object.is(N,-0)||N===0?"0":String(N)}function Tt(P,j,x){if(j==null||!(j>W))return"–";const R=Number.isFinite(P)?P:0;return kt(R/j*100,x)}function Ft(P,j=2){return kt(P,j)}}),ae("packages/modules/gantt/cost.js",function(p,V){"use strict";Object.defineProperty(p,"computeCost",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"bucketCost",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"computeCostByBucket",{enumerable:!0,get:function(){return C}});const St=V("packages/modules/gantt/resources.js"),U=St.parseAssignments,K=St.normalizeResourceRates,Y=St.rateOn,W=V("packages/modules/gantt/workload.js"),l=W.taskAssignmentEffort,L=W.workloadBuckets,b=V("packages/modules/gantt/schedule.js").taskIdReader,k=V("packages/modules/gantt/time.js").toDayNumber;function u(a){if(a==null||a==="")return null;const o=typeof a=="number"?a:Number(a);return Number.isFinite(o)?o:null}function g(a,o,m,$){const h=u(a?a[$.costField]:null)??0;let y=0,i=!1;const r=U(a),M=r.some(D=>{const I=m.get(D.resource);return!I||I.type==="work"})?l(a,o,{hoursPerDay:$.hoursPerDay,isWorking:$.isWorking}):null;for(let D=0;D<r.length;D+=1){const I=r[D],O=m.get(I.resource);if(O)if(O.type==="cost")O.cost!=null&&(y+=O.cost,i=!0);else if(O.type==="material"){const B=Y(O,Math.round(o.es));B!=null&&(y+=(u(I.units)??0)*B,i=!0)}else{const B=M?M[D]:null;if(!B)continue;for(const H of B.perDay){const z=Y(O,H.day);z!=null&&(y+=H.hours*z,i=!0)}}}return{cost:h+y,rateCost:y,fixedCost:h,hasRate:i}}function d(a,o,m={}){if(!o||!o.ok||!o.tasks||!o.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"cost needs a successful schedule"}};const $=m.costField||"cost",h=u(m.hoursPerDay)??8,y=typeof m.isWorking=="function"?m.isWorking:null,i=m.resourceRates instanceof Map?m.resourceRates:K(m.resources),r=b(m.fields),f=new Map;for(const H of Array.isArray(a)?a:[]){const z=r(H);z!=null&&f.set(String(z),H)}const M=()=>({cost:0,rateCost:0,fixedCost:0,hasRate:!1}),D=new Map;for(const H of o.order)D.set(H,M());const I=M();for(const H of o.order){const z=o.tasks.get(H);if(!z||z.isSummary||z.unscheduled||z.inactive)continue;const at=g(f.get(H),z,i,{hoursPerDay:h,isWorking:y,costField:$});let dt=H;for(;dt!=null&&D.has(dt);){const kt=D.get(dt);kt.cost+=at.cost,kt.rateCost+=at.rateCost,kt.fixedCost+=at.fixedCost,at.hasRate&&(kt.hasRate=!0),dt=o.tasks.get(dt).parent}I.cost+=at.cost,I.rateCost+=at.rateCost,I.fixedCost+=at.fixedCost,at.hasRate&&(I.hasRate=!0)}const O=new Map,B=[];for(const H of o.order){const z=o.tasks.get(H),at=D.get(H),dt={id:z.id,name:z.name,isSummary:!!z.isSummary,isMilestone:!!z.isMilestone,cost:at.cost,rateCost:at.rateCost,fixedCost:at.fixedCost,hasRate:at.hasRate};O.set(H,dt),B.push(dt)}return{ok:!0,byTask:O,rows:B,project:{...I}}}function S(a,o){const m=o.map(()=>0);if(!a||!a.size)return m;const $=[...a.entries()].sort((y,i)=>y[0]-i[0]);let h=0;for(const[y,i]of $){for(;h<o.length&&y>=o[h].end;)h+=1;if(h>=o.length)break;y>=o[h].start&&(m[h]+=i)}return m}function _(a,o,m={}){const $=u(m.hoursPerDay)??8,h=typeof m.isWorking=="function"?m.isWorking:null,y=m.resourceRates instanceof Map?m.resourceRates:K(m.resources),i=b(m.fields),r=new Map;for(const B of Array.isArray(a)?a:[]){const H=i(B);H!=null&&r.set(String(H),B)}const f=new Map;for(const B of o.order)f.set(B,new Map);const M=new Map,D=new Map,I=(B,H,z)=>B.set(H,(B.get(H)||0)+z),O=B=>(M.has(B)||M.set(B,new Map),M.get(B));for(const B of o.order){const H=o.tasks.get(B);if(!H||H.isSummary||H.unscheduled||H.inactive)continue;const z=r.get(B);if(!z)continue;const at=U(z),kt=at.some(P=>{const j=y.get(P.resource);return!j||j.type==="work"})?l(z,H,{hoursPerDay:$,isWorking:h}):null,Tt=Math.round(H.es),Ft=new Map;for(let P=0;P<at.length;P+=1){const j=at[P],x=y.get(j.resource);if(x)if(x.type==="cost")x.cost!=null&&(I(Ft,Tt,x.cost),I(O(j.resource),Tt,x.cost));else if(x.type==="material"){const R=Y(x,Tt);if(R!=null){const N=(u(j.units)??0)*R;I(Ft,Tt,N),I(O(j.resource),Tt,N)}}else{const R=kt?kt[P]:null;if(!R)continue;for(const N of R.perDay){const X=Y(x,N.day);if(X!=null){const G=N.hours*X;I(Ft,N.day,G),I(O(j.resource),N.day,G)}}}}for(const[P,j]of Ft){let x=B;for(;x!=null&&f.has(x);)I(f.get(x),P,j),x=o.tasks.get(x).parent;I(D,P,j)}}return{byTask:f,byResource:M,project:D}}function C(a,o,m={}){if(!o||!o.ok||!o.tasks||!o.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"cost by bucket needs a successful schedule"}};const $=m.from!=null?k(m.from):null,h=m.to!=null?k(m.to):null,y=Math.floor($??o.projectStart),i=Math.ceil(h??o.projectFinish),r=m.zoom==null?"day":m.zoom,f=m.by==="resource"||m.by==="project"?m.by:"task",M=Number.isFinite(Number(m.weekStartDay))?Number(m.weekStartDay):0,D=L(r,y,i,M),I=_(a,o,m),O=kt=>S(kt,D),B=kt=>kt.reduce((Tt,Ft)=>Tt+Ft,0),H=new Map,z=new Map,at=[],dt=O(I.project);if(f==="resource")for(const kt of[...I.byResource.keys()].sort()){const Tt=O(I.byResource.get(kt));z.set(kt,Tt),at.push({key:kt,label:kt,cells:Tt,total:B(Tt)})}else if(f==="project")at.push({key:"project",label:"Project",cells:dt,total:B(dt)});else for(const kt of o.order){const Tt=o.tasks.get(kt),Ft=O(I.byTask.get(kt)||new Map);H.set(kt,Ft),at.push({key:kt,label:Tt?String(Tt.name??kt):kt,cells:Ft,total:B(Ft)})}return{ok:!0,buckets:D,rows:at,byTask:H,byResource:z,total:dt,projectTotal:B(dt)}}}),ae("packages/modules/gantt/earned-value.js",function(p,V){"use strict";Object.defineProperty(p,"computeEarnedValue",{enumerable:!0,get:function(){return w}});const U=V("packages/modules/gantt/time.js").toDayNumber,Y=V("packages/modules/gantt/schedule.js").taskIdReader,W=1e-9;function l(k){if(k==null||k==="")return null;const u=typeof k=="number"?k:Number(k);return Number.isFinite(u)?u:null}function L(k,u,g){return g-u<=W?k>=g?1:0:k<=u?0:k>=g?1:(k-u)/(g-u)}function v(k,u,g,d,S,_){const C=u?l(u[d]):null,a=C??(_&&_.hasRate?_.cost:k.duration),o=u?l(u[S]):null,m=k.percentComplete==null?0:Math.max(0,Math.min(100,k.percentComplete))/100,$=k.baselineStart!=null||k.baselineEnd!=null,h=k.baselineStart!=null?k.baselineStart:k.es,y=k.baselineEnd!=null?k.baselineEnd:k.ef,i=a*L(g,h,y),r=a*m;return{bac:a,pv:i,ev:r,ac:o,hasBaseline:$}}function b(k){const u=k.ac;return{bac:k.bac,pv:k.pv,ev:k.ev,ac:u,sv:k.ev-k.pv,cv:u==null?null:k.ev-u,spi:Math.abs(k.pv)<W?null:k.ev/k.pv,cpi:u==null||Math.abs(u)<W?null:k.ev/u}}function w(k,u,g={}){if(!u||!u.ok||!u.tasks||!u.order)return{ok:!1,error:{code:"NO_SCHEDULE",message:"earned value needs a successful schedule"}};const d=g.costField||"cost",S=g.actualCostField||"actualCost",_=g.statusDate==null?u.projectFinish:U(g.statusDate)??u.projectFinish,C=g.rateCosts instanceof Map?g.rateCosts:null,a=Y(g.fields),o=new Map;for(const f of Array.isArray(k)?k:[]){const M=a(f);M!=null&&o.set(String(M),f)}const m=()=>({bac:0,pv:0,ev:0,ac:0,acAny:!1,hasBaseline:!1}),$=new Map;for(const f of u.order)$.set(f,m());const h=m();for(const f of u.order){const M=u.tasks.get(f);if(!M||M.isSummary||M.unscheduled||M.inactive)continue;const D=v(M,o.get(f),_,d,S,C?C.get(f):null);let I=f;for(;I!=null&&$.has(I);){const O=$.get(I);O.bac+=D.bac,O.pv+=D.pv,O.ev+=D.ev,D.ac!=null&&(O.ac+=D.ac,O.acAny=!0),D.hasBaseline&&(O.hasBaseline=!0),I=u.tasks.get(I).parent}h.bac+=D.bac,h.pv+=D.pv,h.ev+=D.ev,D.ac!=null&&(h.ac+=D.ac,h.acAny=!0),D.hasBaseline&&(h.hasBaseline=!0)}const y=f=>b({bac:f.bac,pv:f.pv,ev:f.ev,ac:f.acAny?f.ac:null}),i=new Map,r=[];for(const f of u.order){const M=u.tasks.get(f),D=$.get(f),I={id:M.id,name:M.name,isSummary:!!M.isSummary,isMilestone:!!M.isMilestone,percentComplete:M.percentComplete??null,hasBaseline:D.hasBaseline,hasActualCost:D.acAny,...y(D)};i.set(f,I),r.push(I)}return{ok:!0,statusDate:_,byTask:i,rows:r,project:{hasActualCost:h.acAny,hasBaseline:h.hasBaseline,...y(h)}}}}),ae("packages/modules/gantt/wbs.js",function(p,V){"use strict";Object.defineProperty(p,"deriveWbs",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"compareWbs",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"isWbsCode",{enumerable:!0,get:function(){return K}});function St(Y,W,l){const L=new Map,v=[];for(const k of Y){const u=W(k);if(u==null){v.push(k);continue}L.has(u)||L.set(u,[]),L.get(u).push(k)}const b=new Map,w=(k,u)=>{k.forEach((g,d)=>{const S=l(g),_=S??(u!=null?`${u}.${d+1}`:String(d+1));b.set(g,_);const C=L.get(g);C&&C.length&&w(C,_)})};return w(v,null),b}function U(Y,W){const l=String(Y).split("."),L=String(W).split(".");for(let v=0;v<Math.min(l.length,L.length);v++){const b=l[v],w=L[v];if(b!==w)return/^\d+$/.test(b)&&/^\d+$/.test(w)?Number(b)-Number(w):b<w?-1:1}return l.length-L.length}function K(Y){return typeof Y=="string"&&/^\d+(\.\d+)*$/.test(Y)}}),ae("packages/modules/gantt/mspdi.js",function(p,V){"use strict";Object.defineProperty(p,"parseXml",{enumerable:!0,get:function(){return M}}),Object.defineProperty(p,"importMSPDI",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(p,"exportMSPDI",{enumerable:!0,get:function(){return x}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/modules/gantt/time.js"),Y=K.toDayNumber,W=K.toISODate,l=V("packages/modules/gantt/schedule.js"),L=l.taskIdReader,v=l.resolveConstraintCode,b=l.resolveSchedulingMode,k=V("packages/modules/gantt/task-calendars.js").resolveCalendars,g=V("packages/modules/gantt/wbs.js").deriveWbs,d=Object.freeze({0:"FF",1:"FS",2:"SF",3:"SS"}),S=Object.freeze({FF:0,FS:1,SF:2,SS:3}),_=Object.freeze({0:"ASAP",1:"as-late-as-possible",2:"must-start-on",3:"must-finish-on",4:"SNET",5:"SNLT",6:"FNET",7:"FNLT"}),C=Object.freeze({ASAP:0,ALAP:1,MSO:2,MFO:3,SNET:4,SNLT:5,FNET:6,FNLT:7}),a=Object.freeze({0:"fixedUnits",1:"fixedDuration",2:"fixedEffort"}),o=Object.freeze({fixedUnits:0,fixedDuration:1,fixedEffort:2}),m=Object.freeze({0:"material",1:"work",2:"cost"}),$=Object.freeze({material:0,work:1,cost:2});function h(st){if(st==null)return null;const ht=/^(-?[0-9.]+)/.exec(String(st).trim());if(!ht)return null;const Ot=Number(ht[1]);return Number.isFinite(Ot)?Ot:null}function y(st){if(st==null||st==="")return null;const ht=typeof st=="number"?st:Number(st);return Number.isFinite(ht)?ht:null}function i(st){return String(st).replace(/&(#x?[0-9a-fA-F]+|lt|gt|amp|quot|apos);/g,(ht,Ot)=>{if(Ot[0]==="#"){const wt=Ot[1]==="x"||Ot[1]==="X"?parseInt(Ot.slice(2),16):parseInt(Ot.slice(1),10);return Number.isFinite(wt)?String.fromCodePoint(wt):ht}return{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"}[Ot]??ht})}function r(st){return String(st??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function f(st){const ht=st.indexOf(":");return ht<0?st:st.slice(ht+1)}function M(st){const ht=String(st);let Ot=0;const wt=[];let Jt=null;for(;Ot<ht.length;){const lt=ht.indexOf("<",Ot);if(lt<0)break;if(lt>Ot&&wt.length){const ft=ht.slice(Ot,lt);ft.trim()&&(wt[wt.length-1].text+=i(ft))}if(ht.startsWith("<?",lt)){const ft=ht.indexOf("?>",lt);Ot=ft<0?ht.length:ft+2;continue}if(ht.startsWith("<!--",lt)){const ft=ht.indexOf("-->",lt);Ot=ft<0?ht.length:ft+3;continue}if(ht.startsWith("<![CDATA[",lt)){const ft=ht.indexOf("]]>",lt);wt.length&&(wt[wt.length-1].text+=ht.slice(lt+9,ft<0?ht.length:ft)),Ot=ft<0?ht.length:ft+3;continue}if(ht.startsWith("<!",lt)){const ft=ht.indexOf(">",lt);Ot=ft<0?ht.length:ft+1;continue}const nt=ht.indexOf(">",lt);if(nt<0)break;let ot=ht.slice(lt+1,nt).trim();if(ot[0]==="/"){wt.pop(),Ot=nt+1;continue}const vt=ot.endsWith("/");vt&&(ot=ot.slice(0,-1).trim());const gt=ot.search(/\s/),Ht=f(gt<0?ot:ot.slice(0,gt)),Pt={};if(gt>=0)for(const ft of ot.slice(gt).matchAll(/([\w:.-]+)\s*=\s*"([^"]*)"|([\w:.-]+)\s*=\s*'([^']*)'/g))Pt[f(ft[1]??ft[3])]=i(ft[2]??ft[4]??"");const et={name:Ht,attrs:Pt,children:[],text:""};wt.length?wt[wt.length-1].children.push(et):Jt||(Jt=et),vt||wt.push(et),Ot=nt+1}return Jt}function D(st,ht){return st?st.children.find(Ot=>Ot.name===ht):void 0}function I(st,ht){return st?st.children.filter(Ot=>Ot.name===ht):[]}function O(st,ht){const Ot=D(st,ht);return Ot?Ot.text.trim():void 0}function B(st){if(!st)return null;const ht=String(st).match(/^\d{4}-\d{2}-\d{2}/);return Y(ht?ht[0]:st)}function H(st,ht){return`${W(st)}T${String(ht).padStart(2,"0")}:00:00`}function z(st,ht){if(!st)return null;const Ot=String(st).match(/PT?(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?/);return Ot?((Number(Ot[1])||0)+(Number(Ot[2])||0)/60+(Number(Ot[3])||0)/3600)/ht:null}function at(st,ht){return`PT${Math.round((st||0)*ht*1e3)/1e3}H0M0S`}function dt(st,ht){return(Number(st)||0)/(600*ht)}function kt(st,ht){return Math.round((st||0)*10*60*ht)}function Tt(st,ht={}){const Ot=ht.hoursPerDay??8,wt=M(st);if(!wt||wt.name!=="Project")return U("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 Jt=B(O(wt,"StartDate")),lt=D(wt,"Resources"),nt=D(wt,"Calendars"),ot=I(nt,"Calendar"),vt=new Map,gt=[];for(const Yt of I(lt,"Resource")){const re=O(Yt,"UID"),Lt=O(Yt,"Name");if(re==null||Lt==null||Lt==="")continue;vt.set(re,Lt);const ne=O(Yt,"MaxUnits"),Zt=O(Yt,"CalendarUID"),ct=Zt!=null?j(ot,Zt,Ot):null,bt={id:Lt,name:Lt,capacity:ne==null?1:Number(ne)};ct&&(bt.calendar=ct.calendar,ne==null||Math.abs(Number(ne)-1)<1e-9?delete bt.capacity:bt.capacity=Number(ne)*ct.fullDayHours);const Ct=m[Number(O(Yt,"Type"))];Ct&&Ct!=="work"&&(bt.type=Ct);const Dt=h(O(Yt,"StandardRate"));Dt!=null&&(bt.rate=Dt);const zt=O(Yt,"Cost"),Ut=zt==null?null:Number(zt);Ut!=null&&Number.isFinite(Ut)&&(bt.cost=Ut),gt.push(bt)}const Ht=D(wt,"Assignments"),Pt=new Map;for(const Yt of I(Ht,"Assignment")){const re=O(Yt,"TaskUID"),Lt=O(Yt,"ResourceUID"),ne=vt.get(Lt);if(re==null||ne==null)continue;const Zt=O(Yt,"Units");Pt.has(re)||Pt.set(re,[]),Pt.get(re).push({resource:ne,units:Zt==null?1:Number(Zt)})}const et=D(wt,"Tasks"),ft=[],q=[],jt=new Map,Et=new Map,mt=[],yt={},tt=new Map,Mt=Yt=>{if(tt.has(Yt))return tt.get(Yt);const re=j(ot,Yt,Ot);let Lt=null;if(re){const ne=ot.find(Dt=>O(Dt,"UID")===Yt),Zt=ne&&O(ne,"Name")||`calendar-${Yt}`;Lt=Object.prototype.hasOwnProperty.call(yt,Zt)?`${Zt} (${Yt})`:Zt;const{workingDays:ct,hoursPerDay:bt,holidays:Ct}=re.calendar;yt[Lt]={workdays:ct,...Ct?{holidays:Ct}:{holidays:[]},hoursPerDay:bt}}return tt.set(Yt,Lt),Lt},It=new Map,Rt=[],Xt=[];for(const Yt of I(et,"Task")){if(O(Yt,"IsNull")==="1")continue;const re=O(Yt,"UID");if(re==null||re==="0")continue;const Lt=re;It.set(re,Lt);const ne=Number(O(Yt,"OutlineLevel"))||1;for(;Rt.length&&Rt[Rt.length-1].level>=ne;)Rt.pop();const Zt=Rt.length?Rt[Rt.length-1].uid:null;Rt.push({uid:re,level:ne});const ct=O(Yt,"Summary")==="1",bt=O(Yt,"Milestone")==="1",Ct={id:Lt,name:O(Yt,"Name")??Lt};if(Zt&&(Ct.parent=Zt),bt&&(Ct.milestone=!0),!ct&&!bt){const je=z(O(Yt,"Duration"),Ot);je!=null&&(Ct.duration=je)}const Dt=B(O(Yt,"Start"));!ct&&Dt!=null&&(Ct.start=Dt);const zt=O(Yt,"PercentComplete");zt!=null&&(Ct.percentComplete=Number(zt));const Ut=O(Yt,"WBS");if(Ut!=null&&Ut!==""&&(Ct.wbs=Ut),!ct){const je=O(Yt,"Type");je!=null&&a[Number(je)]&&(Ct.schedulingMode=a[Number(je)]);const Ee=O(Yt,"EffortDriven");Ee!=null&&(Ct.effortDriven=Ee==="1");const Se=z(O(Yt,"Work"),Ot);Se!=null&&(Ct.effort=Se*Ot)}const oe=_[Number(O(Yt,"ConstraintType"))];if(oe){Ct.constraint=oe;const je=B(O(Yt,"ConstraintDate"));je!=null&&(Ct.constraintDate=je)}const de=B(O(Yt,"Deadline"));de!=null&&(Ct.deadline=de),O(Yt,"Active")==="0"&&(Ct.inactive=!0);const me=D(Yt,"Baseline");if(me){const je=B(O(me,"Start")),Ee=B(O(me,"Finish"));je!=null&&(Ct.baselineStart=je),Ee!=null&&(Ct.baselineEnd=Ee)}const ve=Pt.get(re);ve&&ve.length&&(Ct.assignments=ve);const Fe=O(Yt,"CalendarUID");if(Fe!=null&&Fe!==O(wt,"CalendarUID")&&!ct){const je=Mt(Fe);je!=null&&(Ct.calendar=je)}ft.push(Ct),q.push(Lt),jt.set(Lt,Zt),Et.set(Ct,Lt);for(const je of I(Yt,"PredecessorLink"))Xt.push({raw:je,uid:re})}const Vt=g(q,Yt=>jt.get(Yt)||null,()=>null);for(const Yt of ft)Yt.wbs!==void 0&&Yt.wbs===Vt.get(Et.get(Yt))&&delete Yt.wbs;for(const{raw:Yt,uid:re}of Xt){const Lt=O(Yt,"PredecessorUID"),ne=It.get(Lt),Zt=It.get(re);if(ne==null||Zt==null)continue;const ct=d[Number(O(Yt,"Type")??1)]??"FS",bt=dt(O(Yt,"LinkLag"),Ot),Ct={from:ne,to:Zt,type:ct};bt&&(Ct.lag=bt),mt.push(Ct)}const $t=Ft(wt),Bt=O(wt,"WeekStartDay"),pe=Bt!=null&&/^\d+$/.test(Bt.trim())?Math.min(6,Math.max(0,Number(Bt))):null,we={ok:!0,tasks:ft,dependencies:mt,resources:gt};return Jt!=null&&(we.projectStart=Jt),$t&&(we.calendar=$t),pe!=null&&(we.weekStartDay=pe),Object.keys(yt).length&&(we.calendars=yt),we}function Ft(st){const ht=D(st,"Calendars"),Ot=I(ht,"Calendar"),wt=O(st,"CalendarUID"),Jt=(wt!=null?Ot.find(Ht=>O(Ht,"UID")===wt):null)??Ot.find(Ht=>O(Ht,"IsBaseCalendar")!=="0");if(!Jt)return null;const lt=D(Jt,"WeekDays"),nt=[];let ot=!1;for(const Ht of I(lt,"WeekDay")){const Pt=Number(O(Ht,"DayType"));Pt>=1&&Pt<=7&&(ot=!0,O(Ht,"DayWorking")==="1"&&nt.push(Pt-1))}const vt=[],gt=D(Jt,"Exceptions");for(const Ht of I(gt,"Exception")){if(O(Ht,"DayWorking")==="1")continue;const Pt=D(Ht,"TimePeriod"),et=B(O(Pt,"FromDate")),ft=B(O(Pt,"ToDate"))??et;if(et!=null)for(let q=et;q<=ft;q+=1)vt.push(q)}return!ot&&!vt.length?null:{workdays:ot?nt:[1,2,3,4,5],holidays:vt}}function P(st){if(st==null)return null;const ht=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(String(st).trim());return ht?Number(ht[1])+Number(ht[2])/60+Number(ht[3]??0)/3600:null}function j(st,ht,Ot){const wt=st.find(Pt=>O(Pt,"UID")===ht);if(!wt)return null;const Jt=[],lt={};for(const Pt of I(D(wt,"WeekDays"),"WeekDay")){const et=Number(O(Pt,"DayType"));if(!(et>=1&&et<=7)||O(Pt,"DayWorking")!=="1")continue;const ft=et-1;Jt.push(ft);let q=0;for(const jt of I(D(Pt,"WorkingTimes"),"WorkingTime")){const Et=P(O(jt,"FromTime")),mt=P(O(jt,"ToTime"));Et!=null&&mt!=null&&mt>Et&&(q+=mt-Et)}lt[ft]=q>0?q:Ot}const nt=[];for(const Pt of I(D(wt,"Exceptions"),"Exception")){if(O(Pt,"DayWorking")==="1")continue;const et=D(Pt,"TimePeriod"),ft=B(O(et,"FromDate")),q=B(O(et,"ToDate"))??ft;if(ft!=null)for(let jt=ft;jt<=q;jt+=1)nt.push(jt)}if(!Jt.length&&!nt.length)return null;const ot=Jt.map(Pt=>lt[Pt]),vt=ot.length&&ot.every(Pt=>Math.abs(Pt-ot[0])<1e-9),gt={workingDays:Jt.slice().sort((Pt,et)=>Pt-et),hoursPerDay:vt?ot[0]:lt};nt.length&&(gt.holidays=nt);const Ht=ot.reduce((Pt,et)=>Math.max(Pt,et),0)||Ot;return{calendar:gt,fullDayHours:Ht}}function x(st,ht={}){const Ot=ht.hoursPerDay??8,wt=Array.isArray(st.tasks)?st.tasks:[],Jt=Array.isArray(st.dependencies)?st.dependencies:[],lt=Array.isArray(st.resources)?st.resources:st.resources&&typeof st.resources=="object"?Object.entries(st.resources).map(([$t,Bt])=>({id:$t,name:$t,capacity:Bt})):[],nt=st.schedule&&st.schedule.ok?st.schedule:null,ot=L(st.fields),vt=new Map;wt.forEach(($t,Bt)=>{const pe=String(ot($t));vt.set(pe,/^\d+$/.test(pe)?pe:String(Bt+1))});const gt=new Map;for(const $t of wt){const Bt=$t.parent!=null?String($t.parent):null;Bt&&(gt.has(Bt)||gt.set(Bt,[]),gt.get(Bt).push(String(ot($t))))}const Ht=$t=>gt.has($t),Pt=$t=>{let Bt=1,pe=wt.find(we=>String(ot(we))===$t);for(;pe&&pe.parent!=null;)Bt+=1,pe=wt.find(we=>String(ot(we))===String(pe.parent));return Bt},et=g(wt.map($t=>String(ot($t))),$t=>{const Bt=wt.find(pe=>String(ot(pe))===$t);return Bt&&Bt.parent!=null?String(Bt.parent):null},$t=>{const Bt=wt.find(pe=>String(ot(pe))===$t);return Bt&&typeof Bt.wbs=="string"&&Bt.wbs.trim()!==""?Bt.wbs.trim():null}),ft=new Map;for(const $t of Jt){const Bt=String($t.to);ft.has(Bt)||ft.set(Bt,[]),ft.get(Bt).push($t)}const q=[];q.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),q.push('<Project xmlns="http://schemas.microsoft.com/project">'),q.push(` <Name>${r(ht.projectName||"Lattice Gantt export")}</Name>`);const jt=st.projectStart!=null?Y(st.projectStart):nt?nt.projectStart:null;jt!=null&&q.push(` <StartDate>${H(jt,8)}</StartDate>`),Number.isFinite(st.weekStartDay)&&st.weekStartDay>=0&&st.weekStartDay<=6&&q.push(` <WeekStartDay>${Math.floor(st.weekStartDay)}</WeekStartDay>`);const Et=N(st.calendar);Et&&q.push(" <CalendarUID>1</CalendarUID>");const mt=Ot;let yt=Et?2:1;const tt=k({calendar:st.calendar,calendars:st.calendars,tasks:wt.map($t=>({id:String(ot($t)),calendar:$t.calendar})).filter($t=>$t.calendar!=null),resources:lt.map($t=>({id:String($t&&($t.name??$t.id??$t.resource)),calendar:$t&&$t.calendar})).filter($t=>$t.calendar!=null)}),Mt=new Map;for(const $t of lt){const Bt=$t&&($t.name??$t.id??$t.resource);if(Bt==null||Bt==="")continue;const pe=$t.calendar&&typeof $t.calendar=="object"?$t.calendar:tt.resourceSpec.get(String(Bt));pe&&(Mt.set(String(Bt),{uid:yt,spec:X(pe,mt)}),yt+=1)}const It=new Map,Rt=new Map;for(const[$t,Bt]of tt.ofTask)if(Bt!=="plan"){if(!It.has(Bt)){const pe=tt.models.get(Bt),we={workingDays:pe.workdays,holidays:pe.holidays,hoursPerDay:pe.hoursPerDay};It.set(Bt,{uid:yt,spec:X(we,mt)}),yt+=1}Rt.set($t,It.get(Bt).uid)}if(Et||Mt.size||It.size){if(q.push(" <Calendars>"),Et){q.push(" <Calendar>"),q.push(" <UID>1</UID>"),q.push(" <Name>Standard</Name>"),q.push(" <IsBaseCalendar>1</IsBaseCalendar>"),q.push(" <WeekDays>");for(let $t=0;$t<=6;$t+=1){const Bt=Et.workdays.includes($t);q.push(" <WeekDay>"),q.push(` <DayType>${$t+1}</DayType>`),q.push(` <DayWorking>${Bt?1:0}</DayWorking>`),q.push(" </WeekDay>")}if(q.push(" </WeekDays>"),Et.holidays.length){q.push(" <Exceptions>");for(const $t of Et.holidays)q.push(" <Exception>"),q.push(" <DayWorking>0</DayWorking>"),q.push(` <TimePeriod><FromDate>${H($t,0)}</FromDate><ToDate>${H($t,23)}</ToDate></TimePeriod>`),q.push(" </Exception>");q.push(" </Exceptions>")}q.push(" </Calendar>")}for(const[$t,Bt]of Mt)for(const pe of J(Bt.uid,$t,Bt.spec))q.push(pe);for(const[$t,Bt]of It)for(const pe of J(Bt.uid,$t,Bt.spec))q.push(pe);q.push(" </Calendars>")}q.push(" <Tasks>");for(const $t of wt){const Bt=String(ot($t)),pe=vt.get(Bt),we=Ht(Bt),Yt=!!$t.milestone||!we&&Number($t.duration)===0,re=nt?nt.tasks.get(Bt):null;q.push(" <Task>"),q.push(` <UID>${r(pe)}</UID>`),q.push(` <ID>${r(pe)}</ID>`),q.push(` <Name>${r($t.name!=null?$t.name:Bt)}</Name>`),q.push(` <OutlineLevel>${Pt(Bt)}</OutlineLevel>`);const Lt=re&&re.wbs!=null?re.wbs:et.get(Bt);Lt!=null&&q.push(` <WBS>${r(Lt)}</WBS>`),q.push(` <Summary>${we?1:0}</Summary>`),q.push(` <Milestone>${Yt?1:0}</Milestone>`),q.push(` <Active>${$t.inactive===!0?0:1}</Active>`),Rt.has(Bt)&&q.push(` <CalendarUID>${Rt.get(Bt)}</CalendarUID>`);const ne=re?re.duration:$t.duration!=null?Number($t.duration):null;ne!=null&&q.push(` <Duration>${at(ne,Ot)}</Duration>`),q.push(" <DurationFormat>7</DurationFormat>");const Zt=re?re.es:$t.start!=null?Y($t.start):null,ct=re?re.ef:$t.end!=null?Y($t.end):Zt!=null&&ne!=null?Zt+ne:null;Zt!=null&&q.push(` <Start>${H(Zt,8)}</Start>`),ct!=null&&q.push(` <Finish>${H(ct,17)}</Finish>`);const bt=re?re.percentComplete:$t.percentComplete;if(bt!=null&&q.push(` <PercentComplete>${Math.round(Number(bt))}</PercentComplete>`),!we&&!Yt){const oe=re&&re.schedulingMode||b($t.schedulingMode??$t.taskType),de=re&&re.effortDriven!=null?re.effortDriven:$t.effortDriven!=null?!!$t.effortDriven:null,me=re&&re.effort!=null?re.effort:Number.isFinite(Number($t.effort))?Number($t.effort):typeof $t.work=="number"?$t.work:Number.isFinite(Number($t.hours))?Number($t.hours):null;(oe!=null||de!=null||me!=null)&&(oe!=null&&q.push(` <Type>${o[oe]}</Type>`),q.push(` <EffortDriven>${de?1:0}</EffortDriven>`),me!=null&&q.push(` <Work>${at(me/Ot,Ot)}</Work>`))}const Ct=Q($t.constraint??$t.constraintType);if(Ct!=null){q.push(` <ConstraintType>${Ct}</ConstraintType>`);const oe=pt($t.constraintDate??$t.constraintAt??$t.at??($t.constraint&&typeof $t.constraint=="object"?$t.constraint.date:null));oe!=null&&q.push(` <ConstraintDate>${H(oe,8)}</ConstraintDate>`)}const Dt=pt($t.deadline);Dt!=null&&q.push(` <Deadline>${H(Dt,17)}</Deadline>`);const zt=pt($t.baselineStart??($t.baseline&&$t.baseline.start)),Ut=pt($t.baselineEnd??($t.baseline&&$t.baseline.end));(zt!=null||Ut!=null)&&(q.push(" <Baseline>"),q.push(" <Number>0</Number>"),zt!=null&&q.push(` <Start>${H(zt,8)}</Start>`),Ut!=null&&q.push(` <Finish>${H(Ut,17)}</Finish>`),zt!=null&&Ut!=null&&q.push(` <Duration>${at(Ut-zt,Ot)}</Duration>`),q.push(" </Baseline>"));for(const oe of ft.get(Bt)||[]){const de=vt.get(String(oe.from));de!=null&&(q.push(" <PredecessorLink>"),q.push(` <PredecessorUID>${r(de)}</PredecessorUID>`),q.push(` <Type>${S[oe.type?String(oe.type).toUpperCase():"FS"]??1}</Type>`),oe.lag&&(q.push(` <LinkLag>${kt(Number(oe.lag),Ot)}</LinkLag>`),q.push(" <LagFormat>7</LagFormat>")),q.push(" </PredecessorLink>"))}q.push(" </Task>")}q.push(" </Tasks>");const Xt=new Map;lt.forEach(($t,Bt)=>{const pe=String($t.name??$t.id??`Resource ${Bt+1}`),we=Mt.get(pe),Yt=$t.capacity??$t.maxUnits??1,re=we?$t.capacity!=null?Number($t.capacity)/we.spec.fullDayHours:1:Number(Yt),Lt=y($t.rate),ne=y($t.cost),Zt=$t.type==="material"||$t.type==="cost"?$t.type:null;Xt.set(pe,{uid:String(Bt+1),maxUnits:re,calUid:we?we.uid:null,rate:Lt,cost:ne,type:Zt})});const Vt=[];for(const $t of wt)for(const Bt of R($t))Xt.has(Bt.resource)||Xt.set(Bt.resource,{uid:String(Xt.size+1),maxUnits:1,calUid:null}),Vt.push({taskUid:vt.get(String(ot($t))),resUid:Xt.get(Bt.resource).uid,units:Bt.units});q.push(" <Resources>");for(const[$t,Bt]of Xt)q.push(" <Resource>"),q.push(` <UID>${r(Bt.uid)}</UID>`),q.push(` <ID>${r(Bt.uid)}</ID>`),q.push(` <Name>${r($t)}</Name>`),q.push(` <MaxUnits>${Number(Bt.maxUnits)}</MaxUnits>`),Bt.calUid!=null&&q.push(` <CalendarUID>${Bt.calUid}</CalendarUID>`),Bt.type!=null&&q.push(` <Type>${$[Bt.type]}</Type>`),Bt.rate!=null&&q.push(` <StandardRate>${Bt.rate}/h</StandardRate>`),Bt.cost!=null&&q.push(` <Cost>${Bt.cost}</Cost>`),q.push(" </Resource>");return q.push(" </Resources>"),q.push(" <Assignments>"),Vt.forEach(($t,Bt)=>{q.push(" <Assignment>"),q.push(` <UID>${Bt+1}</UID>`),q.push(` <TaskUID>${r($t.taskUid)}</TaskUID>`),q.push(` <ResourceUID>${r($t.resUid)}</ResourceUID>`),q.push(` <Units>${Number($t.units)}</Units>`),q.push(" </Assignment>")}),q.push(" </Assignments>"),q.push("</Project>"),q.join(`
|
|
7
|
+
`)}function R(st){if(st&&Array.isArray(st.assignments))return st.assignments.map(wt=>{const Jt=wt&&(wt.resource??wt.name??wt.id);if(Jt==null||Jt==="")return null;const lt=Number(wt.units??wt.allocation??1);return{resource:String(Jt),units:Number.isFinite(lt)?lt:1}}).filter(Boolean);const ht=st?st.assignee??st.assignees??st.owner:null;return(Array.isArray(ht)?ht:ht==null||ht===""?[]:[ht]).map(wt=>String(wt)).filter(wt=>wt!=="").map(wt=>({resource:wt,units:1}))}function N(st){if(st==null)return null;if(st==="weekends")return{workdays:[1,2,3,4,5],holidays:[]};const ht=Array.isArray(st.workdays)&&st.workdays.length?st.workdays.map(Number).filter(wt=>wt>=0&&wt<=6):[1,2,3,4,5],Ot=(Array.isArray(st.holidays)?st.holidays:[]).map(wt=>Y(wt)).filter(wt=>wt!=null);return{workdays:ht,holidays:Ot}}function X(st,ht){const Ot=Array.isArray(st.workingDays)&&st.workingDays.length?[...new Set(st.workingDays.map(Number).filter(ot=>ot>=0&&ot<=6))].sort((ot,vt)=>ot-vt):[1,2,3,4,5],wt=st.hoursPerDay,Jt={};for(const ot of Ot){const vt=wt!=null&&typeof wt=="object"?Number(wt[ot]):Number(wt);Jt[ot]=Number.isFinite(vt)&&vt>0?vt:ht}const lt=[];for(const ot of Array.isArray(st.holidays)?st.holidays:[]){if(ot&&typeof ot=="object"&&!(ot instanceof Date)&&("from"in ot||"to"in ot)){const gt=Y(ot.from),Ht=Y(ot.to??ot.from);if(gt==null)continue;const Pt=Ht??gt;for(let et=Math.min(gt,Pt);et<=Math.max(gt,Pt);et+=1)lt.push(et);continue}const vt=Y(ot);vt!=null&<.push(vt)}const nt=Ot.reduce((ot,vt)=>Math.max(ot,Jt[vt]),0)||ht;return{workingDays:Ot,holidays:lt,hoursByWeekday:Jt,fullDayHours:nt}}function G(st){const ht=Math.round(st*60),Ot=Math.floor(ht/60),wt=ht%60;return`${String(Ot).padStart(2,"0")}:${String(wt).padStart(2,"0")}:00`}function J(st,ht,Ot){const wt=[],Jt=new Set(Ot.workingDays);wt.push(" <Calendar>"),wt.push(` <UID>${st}</UID>`),wt.push(` <Name>${r(ht)}</Name>`),wt.push(" <IsBaseCalendar>0</IsBaseCalendar>"),wt.push(" <WeekDays>");for(let lt=0;lt<=6;lt+=1){const nt=Jt.has(lt);if(wt.push(" <WeekDay>"),wt.push(` <DayType>${lt+1}</DayType>`),wt.push(` <DayWorking>${nt?1:0}</DayWorking>`),nt){const ot=Ot.hoursByWeekday[lt];wt.push(" <WorkingTimes>"),wt.push(" <WorkingTime>"),wt.push(` <FromTime>${G(8)}</FromTime>`),wt.push(` <ToTime>${G(8+ot)}</ToTime>`),wt.push(" </WorkingTime>"),wt.push(" </WorkingTimes>")}wt.push(" </WeekDay>")}if(wt.push(" </WeekDays>"),Ot.holidays.length){wt.push(" <Exceptions>");for(const lt of Ot.holidays)wt.push(" <Exception>"),wt.push(" <DayWorking>0</DayWorking>"),wt.push(` <TimePeriod><FromDate>${H(lt,0)}</FromDate><ToDate>${H(lt,23)}</ToDate></TimePeriod>`),wt.push(" </Exception>");wt.push(" </Exceptions>")}return wt.push(" </Calendar>"),wt}function Q(st){if(st==null||st==="")return null;const ht=v(st);return ht?C[ht]:null}function pt(st){return st==null||st===""?null:Y(st)}}),ae("packages/core/src/internal/ready.js",function(p,V){"use strict";Object.defineProperty(p,"createReadySignal",{enumerable:!0,get:function(){return St}});function St(){let U=!1,K,Y;const W=new Promise((l,L)=>{K=l,Y=L});return W.catch(()=>{}),{promise:W,settleSoon(){U||queueMicrotask(()=>{U||(U=!0,K())})},settleAfterFrames(){if(U)return;const l=typeof requestAnimationFrame=="function"?requestAnimationFrame:null;if(!l){this.settleSoon();return}let L=!1;const v=()=>{L||(L=!0,this.settleNow())};l(()=>l(v)),setTimeout(v,250)},settleNow(){U||(U=!0,K())},fail(l){U||(U=!0,Y(l))}}}}),ae("packages/modules/shared/autosize.js",function(p,V){"use strict";Object.defineProperty(p,"contentWidth",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"contentHeight",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"firstMeasured",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"watchSize",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"watchBox",{enumerable:!0,get:function(){return L}});const U=V("packages/core/src/internal/warn.js").warnOnce;function K(v){if(!v||typeof v!="object")return null;const b=Number(v.clientWidth);if(Number.isFinite(b)&&b>0)return b;if(typeof v.getBoundingClientRect=="function"){const w=v.getBoundingClientRect(),k=w&&Number(w.width);if(Number.isFinite(k)&&k>0)return k}return null}function Y(v){if(!v||typeof v!="object")return null;const b=Number(v.clientHeight);if(Number.isFinite(b)&&b>0)return b;if(typeof v.getBoundingClientRect=="function"){const w=v.getBoundingClientRect(),k=w&&Number(w.height);if(Number.isFinite(k)&&k>0)return k}return null}function W(v,b=K){for(const w of v||[]){const k=b(w);if(Number.isFinite(k)&&k>0)return k}return null}function l(v){const b=(v&&Array.isArray(v.targets)?v.targets:[]).filter(Boolean),w=v&&typeof v.read=="function"?v.read:()=>null,k=v&&typeof v.apply=="function"?v.apply:()=>{},u=Number.isFinite(v&&v.epsilon)?Number(v.epsilon):1;let g=null,d=!1;const S=()=>{if(d)return!1;const m=w();if(!Number.isFinite(m)||m<=0||g!=null&&Math.abs(m-g)<u)return!1;g=m,d=!0;try{k(m)}finally{d=!1}return!0};S();const _=b[0],C=v&&v.view||_&&_.ownerDocument&&_.ownerDocument.defaultView||globalThis,a=C&&C.ResizeObserver;let o=null;if(typeof a=="function"&&b.length){o=new a(()=>{S()});for(const m of b)m&&typeof o.observe=="function"&&o.observe(m)}else b.length&&U("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:S,get applied(){return g},release(){if(o&&typeof o.disconnect=="function")try{o.disconnect()}catch{}o=null}}}function L(v){const b=(v&&Array.isArray(v.targets)?v.targets:[]).filter(Boolean),w=v&&typeof v.read=="function"?v.read:()=>({}),k=v&&typeof v.apply=="function"?v.apply:()=>{},u=Number.isFinite(v&&v.epsilon)?Number(v.epsilon):1;let g=null,d=!1;const S=$=>{if(g==null)return!0;for(const[h,y]of Object.entries($)){if(!Number.isFinite(y)||y<=0)continue;const i=g[h];if(!Number.isFinite(i)||Math.abs(y-i)>=u)return!0}return!1},_=()=>{if(d)return!1;const $=w();if(!$||typeof $!="object"||!Object.values($).some(y=>Number.isFinite(y)&&y>0)||!S($))return!1;g={...g,...$},d=!0;try{k($)}finally{d=!1}return!0};_();const C=b[0],a=v&&v.view||C&&C.ownerDocument&&C.ownerDocument.defaultView||globalThis,o=a&&a.ResizeObserver;let m=null;if(typeof o=="function"&&b.length){m=new o(()=>{_()});for(const $ of b)$&&typeof m.observe=="function"&&m.observe($)}else b.length&&U("shared.autosize.no-resize-observer","ResizeObserver is unavailable; this view was sized once at mount and will not follow its container.");return{refresh:_,get applied(){return g},release(){if(m&&typeof m.disconnect=="function")try{m.disconnect()}catch{}m=null}}}}),ae("packages/modules/shared/axislabels.js",function(p,V){"use strict";Object.defineProperty(p,"CHAR_RATIO",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"BOLD_FACTOR",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"MIN_GAP",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"estimateLabelWidth",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"thinLabels",{enumerable:!0,get:function(){return W}});const St=.62,U=1.05,K=6;function Y(l,L,v=!1){return String(l??"").length*L*St*(v?U:1)}function W(l,L){const v=Number.isFinite(L.gap)?Number(L.gap):K,b=Number.isFinite(L.fontSize)?Number(L.fontSize):11,w=typeof L.measure=="function"?L.measure:S=>Y(S,b,!!L.bold),k=l.filter(S=>S&&Number.isFinite(S.at)).map(S=>({...S,width:w(String(S.text??""))})).sort((S,_)=>S.at-_.at);if(k.length<2)return{every:1,kept:k};const u=S=>{let _=null;for(let C=0;C<k.length;C+=S){const a=k[C];if(_&&a.at-_.at<_.width+v)return!1;_=a}return!0};let g=1;for(;g<k.length&&!u(g);)g++;const d=[];for(let S=0;S<k.length;S+=g)d.push(k[S]);return{every:g,kept:d}}}),ae("packages/modules/shared/token-scope.js",function(p,V){"use strict";Object.defineProperty(p,"claimTokenScope",{enumerable:!0,get:function(){return U}});const St="lattice-tokens";function U(K,Y){const W=Y||K.parentElement,l=K.classList.contains(St)||!!(W&&W.closest&&W.closest(".lattice, .lattice-tokens"));return l||K.classList.add(St),()=>{l||K.classList.remove(St)}}}),ae("packages/modules/charts/svg.js",function(p,V){"use strict";Object.defineProperty(p,"SVG_NS",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"el",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"svg",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"attr",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"attrs",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"setText",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"clear",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"append",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"path",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"ribbonPath",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"round",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"pathRings",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"insideRings",{enumerable:!0,get:function(){return d}});const St="http://www.w3.org/2000/svg";function U(S){const _=S.indexOf(")");return _<0?S:S.slice(_+1).trim()||"#0072b2"}function K(S,_,C){const a=S.createElement(_);return C&&a.setAttribute("class",C),a}function Y(S,_,C){const a=S.createElementNS(St,_);if(C)for(const o of Object.keys(C))a.setAttribute(o,String(C[o]));return a}function W(S,_,C){if(!S)return;if(C==null){S.removeAttribute(_);return}let a=String(C);a.startsWith("url(#")&&(_==="stroke"||_==="fill"&&S.localName==="text")&&(a=U(a)),S.setAttribute(_,a)}function l(S,_){if(S)for(const C of Object.keys(_))W(S,C,_[C])}function L(S,_){S&&(S.textContent=_==null?"":String(_))}function v(S){if(S)for(;S.firstChild;)S.removeChild(S.firstChild)}function b(S,_){for(const C of _)C&&S.appendChild(C);return S}function w(S){return S.join(" ")}function k(S){if(!S||S.length<2)return"";const _=["M",S[0].x,S[0].upper];for(let C=1;C<S.length;C++)_.push("L",S[C].x,S[C].upper);for(let C=S.length-1;C>=0;C--)_.push("L",S[C].x,S[C].lower);return _.push("Z"),w(_)}function u(S){return Math.round(S*100)/100}function g(S){const _=[];let C=[];const a=String(S||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let o="",m=[];const $=()=>{if(!o||!m.length){m=[];return}if(o==="M"||o==="L")for(let h=0;h+1<m.length;h+=2)C.push([m[h],m[h+1]]);else o!=="Z"&&m.length>=2&&C.push([m[m.length-2],m[m.length-1]]);m=[]};for(const h of a){if(/[A-Za-z]/.test(h)){if($(),h==="Z"||h==="z"){C.length>2&&_.push(C),C=[],o="";continue}h==="M"&&C.length>2&&(_.push(C),C=[]),o=h;continue}m.push(Number(h))}return $(),C.length>2&&_.push(C),_}function d(S,_,C){let a=!1;for(const o of S)for(let m=0,$=o.length-1;m<o.length;$=m++){const[h,y]=o[m],[i,r]=o[$];y>C!=r>C&&_<(i-h)*(C-y)/(r-y||1e-12)+h&&(a=!a)}return a}}),ae("packages/modules/charts/scale.js",function(p,V){"use strict";Object.defineProperty(p,"isNumber",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"toNumber",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"toTime",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"extent",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"niceStep",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"niceDomain",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"measureDomain",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"linearTicks",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"timeStepFor",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"MONTH_STEPS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(p,"timeTicks",{enumerable:!0,get:function(){return i}}),Object.defineProperty(p,"linearScale",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"timeScale",{enumerable:!0,get:function(){return f}}),Object.defineProperty(p,"key",{enumerable:!0,get:function(){return M}}),Object.defineProperty(p,"bandScale",{enumerable:!0,get:function(){return D}}),Object.defineProperty(p,"sqrtScale",{enumerable:!0,get:function(){return I}});const St=[1,2,2.5,5,10],U=6e4,K=36e5,Y=864e5,W=365.25*Y,l=[1,2,5,10,20,25,50,100],L=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,U,5*U,15*U,30*U,K,3*K,6*K,12*K,Y,2*Y,7*Y,14*Y,30*Y,90*Y,180*Y,...l.map(O=>O*W)];function v(O){return typeof O=="number"&&Number.isFinite(O)}function b(O){if(O==null||O==="")return null;if(O instanceof Date){const H=O.getTime();return Number.isFinite(H)?H:null}if(typeof O=="boolean")return O?1:0;const B=Number(O);return Number.isFinite(B)?B:null}function w(O){if(O==null||O==="")return null;if(O instanceof Date){const H=O.getTime();return Number.isFinite(H)?H:null}if(typeof O=="number")return Number.isFinite(O)?O:null;const B=Date.parse(String(O));return Number.isFinite(B)?B:null}function k(O){let B=1/0,H=-1/0;for(let z=0;z<O.length;z++){const at=O[z];v(at)&&(at<B&&(B=at),at>H&&(H=at))}return B===1/0?null:{min:B,max:H}}function u(O){if(!(O>0))return 1;const B=10**Math.floor(Math.log10(O));for(const H of St)if(O<=H*B)return H*B;return 10*B}function g(O,B=5){const H=u((O.max-O.min)/Math.max(1,B));return{min:Math.floor(O.min/H)*H,max:Math.ceil(O.max/H)*H,step:H}}function d(O,B={}){const H=k(O)||{min:0,max:1};let{min:z,max:at}=H;if(B.zero&&(z>0&&(z=0),at<0&&(at=0)),z===at){const dt=Math.abs(z)>0?Math.abs(z)/10:1;z-=dt,at+=dt}if(B.nice!==!1){const dt=g({min:z,max:at},B.ticks||5);z=dt.min,at=dt.max}return v(B.min)&&(z=B.min),v(B.max)&&(at=B.max),z===at&&(at=z+1),{min:z,max:at}}function S(O,B=5){const H=u((O.max-O.min)/Math.max(1,B)),z=Math.ceil(O.min/H),at=Math.floor(O.max/H),dt=[];for(let kt=z;kt<=at;kt++){const Tt=kt*H;dt.push(Math.abs(Tt)<H/1e6?0:Number(Tt.toPrecision(12)))}return dt}function _(O,B=5){const H=Math.max(1,B),z=O/H;let at=L[L.length-1];for(const Tt of L)if(Tt>=z){at=Tt;break}if(at<W)return at;let dt=at,kt=Math.abs(O/at-H);for(const Tt of L){if(Tt<W)continue;const Ft=Math.abs(O/Tt-H);Ft<kt&&(kt=Ft,dt=Tt)}return dt}const C=new Map;function a(O){let B=C.get(O);return B||(B=new Intl.DateTimeFormat("en-US",{timeZone:O,year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),C.set(O,B)),B}function o(O,B){const H={year:0,month:0,day:1,hour:0,minute:0,second:0};for(const z of a(B).formatToParts(new Date(O)))switch(z.type){case"year":H.year=Number(z.value);break;case"month":H.month=Number(z.value)-1;break;case"day":H.day=Number(z.value);break;case"hour":H.hour=Number(z.value)%24;break;case"minute":H.minute=Number(z.value);break;case"second":H.second=Number(z.value);break;default:break}return H}function m(O,B,H){const z=Date.UTC(O,B,1);let at=z;for(let dt=0;dt<2;dt++){const kt=o(at,H),Tt=Date.UTC(kt.year,kt.month,kt.day,kt.hour,kt.minute,kt.second),Ft=z-Tt;if(Ft===0)break;at+=Ft}return at}function $(O,B,H){const z=H?o(O.min,H).year:new Date(O.min).getUTCFullYear();let at=Math.ceil(z/B)*B;const dt=Tt=>H?m(Tt,0,H):Date.UTC(Tt,0,1);dt(at)<O.min&&(at+=B);const kt=[];for(;dt(at)<=O.max;at+=B)kt.push(dt(at));return kt}const h=new Map([[30*Y,1],[90*Y,3],[180*Y,6]]);function y(O,B,H){const z=H?o(O.min,H):{year:new Date(O.min).getUTCFullYear(),month:new Date(O.min).getUTCMonth()};let at=z.year*12+z.month;const dt=Tt=>{const Ft=Math.floor(Tt/12),P=Tt-Ft*12;return H?m(Ft,P,H):Date.UTC(Ft,P,1)};dt(at)<O.min&&(at+=1),at=Math.ceil(at/B)*B;const kt=[];for(;;at+=B){const Tt=dt(at);if(Tt>O.max)break;kt.push(Tt)}return kt}function i(O,B=5,H){const z=_(O.max-O.min,B);if(z>=W)return $(O,Math.round(z/W),H);const at=h.get(z);if(at)return y(O,at,H);const dt=[],kt=Math.ceil(O.min/z)*z;for(let Tt=kt;Tt<=O.max;Tt+=z)dt.push(Tt);return dt}function r(O,B){const H=O.max-O.min||1,[z,at]=B;return{kind:"linear",domain:O,range:B,of(dt){return z+(dt-O.min)/H*(at-z)},invert(dt){return O.min+(dt-z)/(at-z||1)*H},ticks(dt=5){return S(O,dt)}}}function f(O,B){return{...r(O,B),kind:"time",ticks(z=5,at){return i(O,z,at)}}}function M(O){if(O==null)return" null";if(O instanceof Date)return` date:${O.getTime()}`;if(typeof O=="object"){const B=O,H=B.id??B.key??B.value;return H!==void 0&&typeof H!="object"?` obj:${String(H)}`:` obj:${String(O)}`}return String(O)}function D(O,B,H=.2){const z=Math.min(.9,Math.max(0,H)),[at,dt]=B,kt=new Map;for(let P=0;P<O.length;P++){const j=M(O[P]);kt.has(j)||kt.set(j,P)}const Tt=O.length?(dt-at)/O.length:dt-at,Ft=Math.max(0,Tt*(1-z));return{kind:"band",domain:O,range:B,bandwidth:Ft,step:Tt,of(P){const j=kt.get(M(P));return j===void 0?NaN:at+j*Tt+(Tt-Ft)/2},centre(P){const j=this.of(P);return Number.isNaN(j)?NaN:j+Ft/2},ticks(){return O}}}function I(O,B){const[H,z]=B,at=Math.max(Math.abs(O.max),Math.abs(O.min),0)||1;return{kind:"sqrt",domain:O,range:B,of(dt){const kt=Math.sqrt(Math.abs(dt)/at);return H+kt*(z-H)}}}}),ae("packages/modules/gantt/links.js",function(p,V){"use strict";Object.defineProperty(p,"LINK_SIDES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"linkSides",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"linkTypeForSides",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"routeLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"arrowheadPath",{enumerable:!0,get:function(){return v}});const St=V("packages/modules/charts/svg.js"),U=St.path,K=St.round,Y=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 W(b){return Y[String(b||"FS").toUpperCase()]||Y.FS}function l(b,w){for(const[k,u]of Object.entries(Y))if(u.depart===b&&u.arrive===w)return k;return"FS"}function L(b){const w=Number(b.sx),k=Number(b.sy),u=Number(b.ex),g=Number(b.ey),d=Number.isFinite(b.elbow)&&b.elbow>0?Number(b.elbow):8,S=Number.isFinite(b.rowGap)&&b.rowGap>0?Number(b.rowGap):d,_=W(b.type),C=-_.arrive,a=Math.abs(g-k)<.5,o=(u-w)*C;if(a&&o>0)return{d:U(["M",K(w),K(k),"H",K(u)]),arrowDir:C,route:"straight"};if(o>=0)return{d:U(["M",K(w),K(k),"V",K(g),"H",K(u)]),arrowDir:C,route:"drop"};const m=a?k+S:(k+g)/2,$=w+_.depart*d,h=u+_.arrive*d;return{d:U(["M",K(w),K(k),"H",K($),"V",K(m),"H",K(h),"V",K(g),"H",K(u)]),arrowDir:C,route:"detour"}}function v(b,w,k,u=4){return U(["M",K(b),K(w),"L",K(b-k*u),K(w-u),"L",K(b-k*u),K(w+u),"Z"])}}),ae("packages/modules/gantt/colour.js",function(p,V){"use strict";Object.defineProperty(p,"resolveTaskColour",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"darkenColour",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"contrastColour",{enumerable:!0,get:function(){return Y}});function St(W,l){if(typeof l=="function"){const L=l(W);if(L)return String(L)}return W&&W.colour?String(W.colour):null}function U(W){const l=String(W).trim();let L;return(L=/^#([0-9a-f]{3})$/i.exec(l))?[L[1][0]+L[1][0],L[1][1]+L[1][1],L[1][2]+L[1][2]].map(v=>parseInt(v,16)):(L=/^#([0-9a-f]{6})$/i.exec(l))?[L[1].slice(0,2),L[1].slice(2,4),L[1].slice(4,6)].map(v=>parseInt(v,16)):(L=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(l))?[Number(L[1]),Number(L[2]),Number(L[3])]:null}function K(W){const l=U(W);if(!l)return W;const L=.7;return`#${l.map(b=>Math.max(0,Math.min(255,Math.round(b*L)))).map(b=>b.toString(16).padStart(2,"0")).join("")}`}function Y(W){const l=U(W);if(!l)return null;const L=l.map(b=>{const w=b/255;return w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4)});return .2126*L[0]+.7152*L[1]+.0722*L[2]>.179?"#1a1a1a":"#ffffff"}}),ae("packages/modules/gantt/messages.js",function(p,V){"use strict";Object.defineProperty(p,"FALLBACK_EN",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"createTranslator",{enumerable:!0,get:function(){return Y}});const U=V("packages/core/src/internal/predicates.js").isFunction,K=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.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","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.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","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","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors."});function Y(W,l){return function(v,b){const w=U(l)?l():null,k=W&&W.grid,u=w&&U(w.t)&&w||k&&k.messages&&U(k.messages.t)&&k.messages||null;if(u){let d;try{d=u.t(v,b)}catch{d=null}if(typeof d=="string"&&d&&d!==v)return d}const g=K[v];return g?g.replace(/\{(\w+)\}/g,(d,S)=>b&&S in b?String(b[S]):d):v}}}),ae("packages/modules/gantt/roles.js",function(p,V){"use strict";Object.defineProperty(p,"ROLE_DEFAULTS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"expand",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"readRole",{enumerable:!0,get:function(){return Y}});const St=Object.freeze({bar:"var(--lattice-accent)","bar-fg":"var(--lattice-foreground)",progress:"color-mix(in srgb, var(--lattice-accent) 70%, var(--lattice-foreground))",milestone:"var(--lattice-variant-warning-solid)",critical:"var(--lattice-variant-danger-solid)",link:"var(--lattice-foreground-muted)",today:"var(--lattice-variant-danger-solid)",nonworking:"var(--lattice-surface)",summary:"var(--lattice-variant-neutral-solid)",baseline:"var(--lattice-border-strong)",band:"var(--lattice-row-stripe)",selected:"var(--lattice-selected-background)",handle:"var(--lattice-background)","tooltip-bg":"var(--lattice-foreground)","tooltip-fg":"var(--lattice-background)","header-bg":"var(--lattice-surface)"}),U=Object.entries(St).map(([W,l])=>`--lattice-gantt-d-${W}:${l};`).join("");function K(W){return String(W).replace(/var\(--lattice-gantt-([a-z-]+)\)/g,(l,L)=>Object.hasOwn(St,L)?`var(--lattice-gantt-${L},var(--lattice-gantt-d-${L}))`:l)}function Y(W,l){return String(W.getPropertyValue(`--lattice-gantt-${l}`)).trim()||String(W.getPropertyValue(`--lattice-gantt-d-${l}`)).trim()}}),ae("packages/modules/shared/drag-gesture.js",function(p,V){"use strict";Object.defineProperty(p,"attachDragGesture",{enumerable:!0,get:function(){return W}});const St=300,U=3,K=24,Y=12;function W(l,L={}){const v=L.holdMs==null?St:L.holdMs,b=typeof L.canStart=="function"?L.canStart:null,w=typeof L.onStart=="function"?L.onStart:null,k=typeof L.onMove=="function"?L.onMove:null,u=typeof L.onEnd=="function"?L.onEnd:null,g=typeof L.onCancel=="function"?L.onCancel:null,d=typeof L.autoScroll=="function"?L.autoScroll:null,S=Array.isArray(L.autoScroll)?L.autoScroll:[],_=l&&l.ownerDocument?l.ownerDocument:l;if(!l||!_||typeof l.addEventListener!="function")return()=>{};let C=null;function a(z,at,dt,kt,Tt){if(dt>=z&&dt<z+K&&kt>0){const Ft=K-(dt-z);return-Math.max(1,Math.round(Y*Ft/K))}if(dt>at-K&&dt<=at&&kt<Tt){const Ft=K-(at-dt);return Math.max(1,Math.round(Y*Ft/K))}return 0}function o(){const z=C;if(z){if(C=null,z.holdTimer&&clearTimeout(z.holdTimer),H(z),z.started&&z.pressed&&z.pressed.style&&(z.pressed.style.touchAction=z.prevTouchAction),z.pressed&&typeof z.pressed.releasePointerCapture=="function"&&z.pointerId!==void 0)try{z.pressed.releasePointerCapture(z.pointerId)}catch{}_.removeEventListener("pointermove",i),_.removeEventListener("pointerup",f),_.removeEventListener("pointercancel",M),_.removeEventListener("keydown",D),_.removeEventListener("pointerdown",I),_.removeEventListener("touchmove",r)}}function m(z){if(!z.started){if(z.started=!0,z.pressed&&z.pressed.style&&(z.prevTouchAction=z.pressed.style.touchAction||"",z.pressed.style.touchAction="none"),z.pressed&&typeof z.pressed.setPointerCapture=="function"&&z.pointerId!==void 0)try{z.pressed.setPointerCapture(z.pointerId)}catch{}w&&w(z.drag,z.downEvent),B(z)}}function $(z,at){const dt=z.started;o(),dt&&u&&u(z.drag,at)}function h(z,at){const dt=z.started;o(),dt&&g&&g(z.drag,at)}function y(){const z=C;z&&!z.started&&m(z)}function i(z){const at=C;if(!at||z.pointerId!==void 0&&z.pointerId!==at.pointerId)return;const dt=typeof z.clientX=="number"?z.clientX:at.lastX,kt=typeof z.clientY=="number"?z.clientY:at.lastY;if(at.lastX=dt,at.lastY=kt,at.lastEvent=z,!at.started){if(Math.hypot(dt-at.startX,kt-at.startY)<=U)return;if(at.pointerType==="mouse")m(at);else{o();return}}k&&k(at.drag,z)}function r(z){C&&C.started&&typeof z.preventDefault=="function"&&z.preventDefault()}function f(z){const at=C;at&&(z.pointerId!==void 0&&z.pointerId!==at.pointerId||$(at,z))}function M(z){const at=C;at&&(z.pointerId!==void 0&&z.pointerId!==at.pointerId||h(at,z))}function D(z){C&&z.key==="Escape"&&h(C,z)}function I(z){const at=C;at&&z.pointerId!==void 0&&z.pointerId!==at.pointerId&&h(at,z)}function O(z){if(z.button!=null&&z.button!==0||C)return;const at=b?b(z):z.target||null;if(!at)return;const dt=typeof z.clientX=="number"?z.clientX:0,kt=typeof z.clientY=="number"?z.clientY:0,Tt=z.pointerId,Ft=z.pointerType||"mouse";C={drag:{el:at,pointerId:Tt,pointerType:Ft,startX:dt,startY:kt,lastX:dt,lastY:kt},pressed:at,pointerId:Tt,pointerType:Ft,startX:dt,startY:kt,lastX:dt,lastY:kt,started:!1,downEvent:z,lastEvent:z,holdTimer:null,prevTouchAction:"",frameId:null},Ft!=="mouse"&&(C.holdTimer=setTimeout(y,v)),_.addEventListener("pointermove",i),_.addEventListener("pointerup",f),_.addEventListener("pointercancel",M),_.addEventListener("keydown",D),_.addEventListener("pointerdown",I),Ft==="touch"&&_.addEventListener("touchmove",r,{passive:!1})}function B(z){if(typeof requestAnimationFrame!="function"||!d&&!S.length)return;function at(){const dt=C;if(!dt||dt!==z||!dt.started){z.frameId=null;return}const kt=d?d():S;let Tt=!1;if(Array.isArray(kt))for(const Ft of kt){if(!Ft||typeof Ft.getBoundingClientRect!="function")continue;const P=Ft.getBoundingClientRect(),j=a(P.left,P.right,dt.lastX,Ft.scrollLeft,Ft.scrollWidth-Ft.clientWidth),x=a(P.top,P.bottom,dt.lastY,Ft.scrollTop,Ft.scrollHeight-Ft.clientHeight);j&&(Ft.scrollLeft+=j,Tt=!0),x&&(Ft.scrollTop+=x,Tt=!0)}Tt&&k&&dt.lastEvent&&k(dt.drag,dt.lastEvent),z.frameId=requestAnimationFrame(at)}z.frameId=requestAnimationFrame(at)}function H(z){z.frameId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(z.frameId),z.frameId=null}return l.addEventListener("pointerdown",O),()=>{o(),l.removeEventListener("pointerdown",O)}}}),ae("packages/modules/gantt/events-pointer.js",function(p,V){"use strict";Object.defineProperty(p,"GESTURE_EVENTS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"DRAG_THRESHOLD",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"DEFAULT_PROGRESS_STEP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"HANDLE_TARGET",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"TOUCH_TARGET",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"emitGesture",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"gateGesture",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"taskContext",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"pointerOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"snapProgress",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"FrameThrottle",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"partOfElement",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"partOfTask",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"TaskPointerEvents",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"gateTooltipShow",{enumerable:!0,get:function(){return a}}),Object.defineProperty(p,"fireTooltipHide",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"drawProgressHandle",{enumerable:!0,get:function(){return m}}),Object.defineProperty(p,"previewProgress",{enumerable:!0,get:function(){return $}}),Object.defineProperty(p,"progressHandleCss",{enumerable:!0,get:function(){return h}});const St=V("packages/modules/charts/svg.js"),U=St.svg,K=St.round,Y=Object.freeze(["beforeTaskDrag","taskDragStart","taskDrag","taskDrag:cancelled","beforeTaskResizeStart","taskResizeStart","taskPartialResize","taskResizeEnd","taskResize:cancelled","beforePercentBarDrag","percentBarDragStart","percentBarDrag","percentBarDrop","percentBarDrag:cancelled","taskClick","taskDblClick","taskMouseOver","taskMouseOut","taskContextMenu","linkClick","linkDblClick","linkContextMenu","linkHover","tooltipShow","tooltipHide"]),W=3,l=5,L=16,v=24;function b(y,i,r){y&&typeof y.emitGesture=="function"&&y.emitGesture(i,r)}function w(y,i,r,f){return!y||typeof y.gateGesture!="function"?!0:y.gateGesture(i,r,f)}function k(y,i){const r=y&&y.schedule,f=r&&r.ok?r.tasks.get(i):null,M=y&&typeof y.taskById=="function"?y.taskById(i):null;return{id:i,rawTask:M,task:f?{...f}:null}}function u(y){return!y||!Number.isFinite(y.clientX)?null:{x:y.clientX,y:Number.isFinite(y.clientY)?y.clientY:0}}function g(y,i){const r=Number.isFinite(i)&&i>0?Number(i):l,f=Math.round((Number(y)||0)/r)*r;return Math.max(0,Math.min(100,Math.round(f*1e3)/1e3))}class d{#t;#i;#e=null;#n=null;constructor(i,r){this.#t=r;const f=i&&i.defaultView;this.#i=f&&typeof f.requestAnimationFrame=="function"?f:null}push(i){if(!this.#i){this.#t(i);return}this.#n={value:i},this.#e==null&&(this.#e=this.#i.requestAnimationFrame(()=>{this.#e=null;const r=this.#n;this.#n=null,r&&this.#t(r.value)}))}flush(){const i=this.#n;this.cancel(),i&&this.#t(i.value)}cancel(){this.#e!=null&&this.#i&&this.#i.cancelAnimationFrame(this.#e),this.#e=null,this.#n=null}}function S(y,i){const r=y&&y.classList;return r?r.contains(`${i}__progresshandle-hit`)||r.contains(`${i}__progresshandle-thumb`)||r.contains(`${i}__progress`)?"progress":r.contains(`${i}__bar`)?"bar":r.contains(`${i}__barlabel`)||r.contains(`${i}__label`)?"label":r.contains(`${i}__baseline`)?"baseline":r.contains(`${i}__milestone`)?"milestone":r.contains(`${i}__summary-bar`)||r.contains(`${i}__summary`)?"summary":null:null}function _(y){return y&&y.isSummary?"summary":y&&y.isMilestone?"milestone":"bar"}class C{#t;#i=[];#e=null;#n=null;constructor(i){this.#t=i}attach(i){if(!i||!i.addEventListener)return;const B=[["click",H=>this.#h(H)],["dblclick",H=>this.#f(H)],["pointerover",H=>this.#p(H)],["pointerout",H=>this.#g(H)],["focusin",H=>this.#c(H)],["focusout",H=>this.#y(H)]];if(this.#t.keyboard){const H=z=>this.#r(z);B.push(["keydown",H])}for(const[H,z]of B)i.addEventListener(H,z),this.#i.push([i,H,z])}#s(i){const r=S(i,this.#t.ns);if(!r)return null;const f=this.#t.rowOf(i),M=f?f.getAttribute("data-task"):null;return M==null?null:{id:String(M),part:r}}#o(i,r){return{...k(this.#t.controller,i),view:this.#t.view(),...r}}#l(i,r){let f=Number.isFinite(i&&i.clientX)?this.#t.dayAt(i):null;if(!Number.isFinite(f)){const M=this.#t.controller.schedule,D=M&&M.ok?M.tasks.get(r):null;f=D?D.es:null}return Number.isFinite(f)?this.#t.date(Math.floor(f)):null}#h(i){if(this.#t.consumeDragRelease())return;const r=this.#s(i.target);r&&b(this.#t.controller,"taskClick",this.#o(r.id,{part:r.part,date:this.#l(i,r.id),event:i}))}#f(i){const r=this.#s(i.target);if(!r)return;!w(this.#t.controller,"taskDblClick",null,this.#o(r.id,{part:r.part,date:this.#l(i,r.id),event:i}))&&i.preventDefault&&i.preventDefault()}#p(i){if(this.#t.dragging())return;const r=this.#s(i.target);!r||this.#e&&this.#e.id===r.id||(this.#e&&this.#a(i),this.#e=r,b(this.#t.controller,"taskMouseOver",this.#o(r.id,{part:r.part,event:i})))}#g(i){if(!this.#e)return;const r=i.relatedTarget?this.#s(i.relatedTarget):null;r&&r.id===this.#e.id||this.#a(i)}#a(i){const r=this.#e;this.#e=null,b(this.#t.controller,"taskMouseOut",this.#o(r.id,{part:r.part,event:i}))}#d(i){const r=this.#t.rowOf(i.target);if(!r||r!==i.target)return null;const f=String(r.getAttribute("data-task")),M=this.#t.controller.schedule;return{id:f,part:_(M&&M.ok?M.tasks.get(f):null)}}#c(i){const r=this.#d(i);!r||r.id===this.#n||(this.#n=r.id,b(this.#t.controller,"taskMouseOver",this.#o(r.id,{part:r.part,event:i})))}#y(i){const r=this.#d(i);!r||r.id!==this.#n||(this.#n=null,b(this.#t.controller,"taskMouseOut",this.#o(r.id,{part:r.part,event:i})))}#r(i){if(i.key!=="Enter"&&i.key!==" "||i.ctrlKey||i.metaKey||i.altKey)return;const r=this.#d(i);r&&(i.preventDefault&&i.preventDefault(),b(this.#t.controller,"taskClick",this.#o(r.id,{part:r.part,date:this.#l(null,r.id),event:i})))}gateContextMenu(i,r,f){return w(this.#t.controller,"taskContextMenu",null,this.#o(i,{part:r,event:f}))}destroy(){for(const[i,r,f]of this.#i)i.removeEventListener(r,f);this.#i=[],this.#e=null,this.#n=null}}function a(y,i,r,f,M){return w(y,"tooltipShow",null,{...k(y,r),view:i,text:f,event:M})}function o(y,i,r,f){b(y,"tooltipHide",{...k(y,r),view:i,event:f})}function m(y,i){const r=Math.max(0,Math.min(100,Number(i.percent)||0)),f=i.x0+i.w*(r/100),M=i.barY+i.barH,D=M-L/2,I=L,O=U(y,"g",{class:`${i.ns}__progresshandle`,"data-task":i.id,"data-percent":String(r),"aria-hidden":"true"}),B=U(y,"rect",{class:`${i.ns}__progresshandle-hit`,x:K(f-L/2),y:K(D),width:L,height:K(I),fill:"transparent"}),H=U(y,"title",{});return H.textContent=i.title,B.appendChild(H),O.appendChild(B),O.appendChild(U(y,"path",{class:`${i.ns}__progresshandle-thumb`,d:`M ${K(f)} ${K(M-3)} L ${K(f+5)} ${K(M+5)} L ${K(f-5)} ${K(M+5)} Z`})),O}function $(y,i,r,f){const M=i&&i.querySelector(`.${r}__bar`);if(!M)return;const D=parseFloat(M.getAttribute("x")),I=parseFloat(M.getAttribute("width"));if(!Number.isFinite(D)||!Number.isFinite(I))return;let O=i.querySelector(`.${r}__progress`);O||(O=U(y,"rect",{class:`${r}__progress`,x:D,y:M.getAttribute("y"),height:M.getAttribute("height"),rx:3,width:0}),M.parentNode.insertBefore(O,M.nextSibling)),O.setAttribute("width",String(K(I*(f/100))));const B=i.querySelector(`.${r}__progresshandle`);if(!B)return;const H=parseFloat(B.getAttribute("data-percent"))||0,z=K(I*((f-H)/100));B.setAttribute("transform",`translate(${z} 0)`),B.setAttribute("data-preview-percent",String(f))}function h(y,i="barrow"){return`.${y}__progresshandle{opacity:0;transition:opacity .1s;cursor:ew-resize}
|
|
8
8
|
.${y}__${i}:hover .${y}__progresshandle,.${y}__${i}:focus .${y}__progresshandle,.${y}__progresshandle--active{opacity:1}
|
|
9
9
|
.${y}__progresshandle-thumb{fill:var(--lattice-background);stroke:var(--lattice-foreground);stroke-width:1.5}
|
|
10
10
|
.${y}__progresshandle--active .${y}__progresshandle-thumb{stroke:var(--lattice-focus-color)}
|
|
@@ -12,22 +12,22 @@
|
|
|
12
12
|
.${y}__${i}--readonly .${y}__progresshandle-thumb{fill:var(--lattice-foreground-muted);stroke:var(--lattice-foreground-muted)}
|
|
13
13
|
@media (pointer: coarse) {
|
|
14
14
|
.${y}__progresshandle-hit{transform-box:fill-box;transform-origin:center;transform:scale(${v/L})}
|
|
15
|
-
}`}}),ae("packages/modules/gantt/gestures.js",function(g,V){"use strict";Object.defineProperty(g,"describeTask",{enumerable:!0,get:function(){return $}}),Object.defineProperty(g,"GanttGestures",{enumerable:!0,get:function(){return h}});const U=V("packages/modules/charts/svg.js").round,Y=V("packages/modules/shared/drag-gesture.js").attachDragGesture,l=V("packages/modules/gantt/links.js").linkTypeForSides,v=V("packages/modules/gantt/schedule.js").wouldCreateCycle,m=V("packages/modules/gantt/events-pointer.js"),w=m.emitGesture,k=m.gateGesture,u=m.taskContext,f=m.pointerOf,d=m.snapProgress,S=m.previewProgress,_=m.FrameThrottle,C=m.DRAG_THRESHOLD,a=24,o=90,p=2e3;function $(y,i){const r=y.isSummary?"summary":y.isMilestone?"milestone":"task";if(y.unscheduled)return[`${y.name}, ${r}`,i.unscheduled].filter(Boolean).join(", ");if(y.inactive&&y.es==null)return[`${y.name}, ${r}`,i.inactive].filter(Boolean).join(", ");const b=i.dateAxis===!1?`day ${U(y.es)} to ${U(y.ef)}`:`${i.iso(y.es)} to ${i.iso(y.ef)}`,T=[`${y.name}, ${r}`,b];return y.isMilestone||T.push(`${U(y.duration)} days`),y.percentComplete!=null&&T.push(`${Math.round(y.percentComplete)}% complete`),T.push(`slack ${U(y.totalFloat)} days`),y.critical&&T.push("on the critical path"),y.inactive&&i.inactive&&T.push(i.inactive),T.join(", ")}class h{#t;#i=null;#e=null;#n=null;#s=null;#o=-1/0;#l=null;#d=null;#g=null;constructor(i){this.#t=i}#p(){return this.#t.options()||{}}get dragging(){return this.#i!==null}get draggedId(){return this.#i?this.#i.id:null}consumeDragRelease(){if(this.#i&&this.#i.started)return!0;const i=Date.now()-this.#o<400;return this.#o=-1/0,i}#h(i){if(this.#p().dateAxis===!1)return i;const r=this.#t.iso(i);return r??i}#a(i){const r=typeof this.#t.view=="function"?this.#t.view():null;return{...u(this.#t.controller,i),view:r}}#f(i){const r=this.#t.controller;return typeof r.isTaskLocked=="function"?!!r.isTaskLocked(i):!1}#c(i){const r=this.#t.controller;return typeof r.isTaskReadOnly=="function"?!!r.isTaskReadOnly(i):!1}#b(i,r,b){const T=this.#t.controller,j=f(b),I=this.#c(r.id);if(i==="move"){const z=()=>({...this.#a(r.id),start:this.#h(r.origStart),end:this.#h(r.origEnd),pointer:j,event:b});return I?(w(T,"taskDrag:cancelled",{...z(),phase:"start",reason:"readOnly"}),!1):k(T,"beforeTaskDrag","taskDrag:cancelled",{...z(),phase:"start"})?(w(T,"taskDragStart",z()),!0):!1}if(i==="resize"){const z=r.edge==="start"?"start":"end",W=()=>({...this.#a(r.id),edge:z,from:this.#r(r.origStart,r.origEnd,r.origDuration),pointer:j,event:b}),B=z==="start"?{id:r.id,start:r.origStart,duration:r.origDuration}:{id:r.id,duration:r.origDuration};if(I)return w(T,"taskResize:cancelled",{...W(),patch:B,origin:"user",phase:"start",reason:"readOnly"}),!1;const at={...W(),patch:B,origin:"user",phase:"start"};return k(T,"beforeTaskResizeStart","taskResize:cancelled",at)?(w(T,"taskResizeStart",W()),!0):!1}const O=()=>({...this.#a(r.id),from:r.origPercent,pointer:j,event:b});return I?(w(T,"percentBarDrag:cancelled",{...O(),to:r.origPercent,reason:"readOnly"}),!1):k(T,"beforePercentBarDrag","percentBarDrag:cancelled",{...O(),to:r.origPercent})?(w(T,"percentBarDragStart",O()),!0):!1}#r(i,r,b){return{start:this.#h(i),end:this.#h(r),duration:b}}#m(){const i=this.#i;if(!i||!i.started||!i.last)return;const r=this.#t.controller,b=i.last.event;if(i.mode==="progress"){w(r,"percentBarDrag",{...this.#a(i.id),from:i.origPercent,to:i.percent,pointer:f(b),event:b});return}const T=this.#P(i,i.last.deltaDays);i.mode==="move"?w(r,"taskDrag",{...this.#a(i.id),from:{start:this.#h(i.origStart),end:this.#h(i.origEnd)},to:{start:T.to.start,end:T.to.end},deltaDays:i.last.deltaDays,valid:T.valid,pointer:f(b),pushed:T.pushed,event:b}):w(r,"taskPartialResize",{...this.#a(i.id),edge:i.edge==="start"?"start":"end",from:this.#r(i.origStart,i.origEnd,i.origDuration),to:T.to,valid:T.valid,pointer:f(b),event:b})}#y(i,r){if(i.mode==="move")return{askStart:i.origStart+r,askDuration:i.origDuration};if(i.mode==="resize"&&i.edge==="start"){const b=Math.min(r,i.origDuration-1);return{askStart:i.origStart+b,askDuration:Math.max(1,i.origDuration-b)}}return{askStart:i.origStart,askDuration:Math.max(0,i.origDuration+r)}}#D(i,r,b){return i.mode==="move"?{id:i.id,start:r}:i.mode==="resize"&&i.edge==="start"?{id:i.id,start:r,duration:b}:{id:i.id,duration:b}}#P(i,r){const b=this.#t.controller,{askStart:T,askDuration:j}=this.#y(i,r),I=i.preview&&i.preview.delta===r?i.preview.schedule:this.#J()?null:typeof b.previewEdit=="function"?b.previewEdit(this.#D(i,T,j)):null,O=I&&I.tasks?I.tasks.get(i.id):null,z=O?O.es:T,W=O?O.duration:j,B=O?O.ef:T+j,at=!!O&&O.es===T&&(i.mode==="move"||O.duration===j),ct=[],kt=b.schedule;if(I&&I.tasks&&kt&&kt.ok)for(const[Tt,Ft]of I.tasks){if(Tt===i.id)continue;const D=kt.tasks.get(Tt);D&&(D.es!==Ft.es||D.ef!==Ft.ef)&&ct.push({id:Tt,to:{start:this.#h(Ft.es),end:this.#h(Ft.ef)}})}return{to:this.#r(z,B,W),valid:at&&!this.#f(i.id),pushed:ct}}#w(){const i=this.#t.plot();if(i&&typeof i.getScreenCTM=="function"){let b=null;try{b=i.getScreenCTM()}catch{b=null}if(b&&Number.isFinite(b.a)&&b.a>0)return{scale:b.a,origin:Number.isFinite(b.e)?b.e:0}}const r=i&&i.getBoundingClientRect?i.getBoundingClientRect():null;return{scale:1,origin:r&&r.left||0}}#T(i){const{scale:r,origin:b}=this.#w();return((i.clientX||0)-b)/r}#N(i){const r=this.#t.plot(),b=r&&r.getBoundingClientRect?r.getBoundingClientRect():null;return(i.clientY||0)-(b&&b.top||0)}#E(i){const{scale:r}=this.#w();return Math.round(i/r/(this.#t.pxPerDay()||1))}#x(i,r){return(r.clientX||0)-i.startX+(i.origin-this.#w().origin)}onPointerDown(i){const r=this.#t.controller.schedule;if(!r||!r.ok)return;const b=this.#t.connectorOf?this.#t.connectorOf(i.target):null;if(b){if(this.#n&&i.pointerType&&i.pointerType!=="mouse")return;this.#Nt(b,i);return}const T=this.#t.linkOf?this.#t.linkOf(i.target):null;if(T){i.preventDefault&&i.preventDefault(),T.focus&&T.focus();return}this.#K(i)||this.#O(i,!1)}#K(i){if(!this.#n||!i.pointerType||i.pointerType==="mouse")return null;const r=this.#t.controller.schedule;if(!r||!r.ok)return null;const b=this.#t;if(b.connectorOf&&b.connectorOf(i.target)||b.linkOf&&b.linkOf(i.target))return null;const T=b.rowOf(i.target);if(!T)return null;const j=r.tasks.get(T.getAttribute("data-task"));return!j||j.isSummary||j.unscheduled?null:b.barOf(T)||null}attachTouch(i){if(this.#n)return;const r=this.#t;this.#n=Y(i,{canStart:b=>{if(b.pointerType&&b.pointerType!=="mouse"){const T=r.connectorOf?r.connectorOf(b.target):null;if(T)return T}return this.#K(b)},onStart:(b,T)=>{const j=r.connectorOf?r.connectorOf(b.el):null;if(j){this.#Ut(j,T);return}this.#O(T,!0)},onMove:(b,T)=>{if(this.#d){this.#gt(T);return}this.#L(T)},onEnd:(b,T)=>{if(this.#d){this.#yt(T,this.#ot(T));return}this.#tt(T)},onCancel:(b,T)=>{if(this.#d){this.#pt();return}this.#St(T)},autoScroll:()=>typeof r.scrollers=="function"?r.scrollers():[]})}#ot(i){const r=this.#t.doc;if(r&&typeof r.elementFromPoint=="function"){const b=r.elementFromPoint(i.clientX||0,i.clientY||0);if(b)return b}return i.target}#O(i,r){const b=this.#t.controller.schedule;if(!b||!b.ok)return;const T=this.#t.rowOf(i.target);if(!T)return;const j=T.getAttribute("data-task"),I=b.tasks.get(j);if(!I||I.isSummary||I.unscheduled)return;const O=this.#t.barOf(T);if(!O)return;const z=this.#t.progressOf?this.#t.progressOf(i.target):null,W=this.#t.resizeStartOf?this.#t.resizeStartOf(i.target):null,B=this.#T(i),at=Math.max(Number.isFinite(this.#p().resizeZone)?Number(this.#p().resizeZone):6,r?a:0);let ct="move",kt="end";I.isMilestone||(B>=this.#A(O)-at?(ct="resize",kt="end"):W&&(ct="resize",kt="start")),z&&!I.isMilestone&&(ct="progress");const Tt=Number.isFinite(Number(I.percentComplete))?Number(I.percentComplete):0;if(this.#i={id:j,mode:ct,edge:kt,startX:i.clientX||0,origStart:I.es,origEnd:I.ef,origDuration:I.duration,barEl:O,row:T,origPercent:Tt,percent:Tt,origin:this.#w().origin,started:!1,last:null,preview:null,rescheduleTimer:null},i.preventDefault&&!r&&i.preventDefault(),this.#s=new _(this.#t.doc,()=>this.#m()),r)return;const Ft=x=>this.#L(x),D=x=>this.#tt(x),P=x=>{x.key==="Escape"&&this.#St(x)};this.#e={move:Ft,up:D,key:P},this.#t.doc.addEventListener("pointermove",Ft),this.#t.doc.addEventListener("pointerup",D),this.#t.doc.addEventListener("keydown",P)}#V(i){const r=this.#i;if(r.started)return!0;if(Math.abs((i.clientX||0)-r.startX)<C)return!1;if(!this.#b(r.mode,r,i))return this.#ft(),this.#o=Date.now(),!1;if(r.started=!0,r.mode==="progress"&&this.#t.nsOf){const b=this.#t.nsOf(),T=r.row.querySelector(`.${b}__progresshandle`);T&&T.classList&&T.classList.add(`${b}__progresshandle--active`)}return!0}#A(i){const r=parseFloat(i.getAttribute("x")),b=parseFloat(i.getAttribute("width"));return Number.isFinite(r)&&Number.isFinite(b)?r+b:Number.POSITIVE_INFINITY}#L(i){if(!this.#i||!this.#V(i))return;if(this.#i.mode==="progress"){this.#Y(i),this.#s.push(null);return}const r=this.#t.pxPerDay()||1,b=this.#E(this.#x(this.#i,i)),T=this.#i.barEl;if(this.#i.mode==="move")T.getAttribute("d")?this.#at(T,b*r):(T.setAttribute("x",U(parseFloat(T.getAttribute("x"))+b*r-this.#Pt(T))),this.#Z(T,b*r));else if(this.#i.edge==="start"){const{askStart:j}=this.#y(this.#i,b),I=j-this.#i.origStart,O=I*r-this.#Pt(T);T.setAttribute("x",U(parseFloat(T.getAttribute("x"))+O)),T.setAttribute("width",U(Math.max(1,parseFloat(T.getAttribute("width"))-O))),this.#Z(T,I*r)}else{const j=Math.max(1,parseFloat(T.getAttribute("width"))+(b*r-this.#Pt(T)));T.setAttribute("width",U(j)),this.#Z(T,b*r)}this.#q(b),this.#i.last={deltaDays:b,event:i},this.#s.push(null)}#Y(i){const r=this.#i,b=r.barEl,T=parseFloat(b.getAttribute("x")),j=parseFloat(b.getAttribute("width"));!Number.isFinite(T)||!(j>0)||(r.percent=d((this.#T(i)-T)/j*100,this.#p().progressStep),r.last={deltaDays:0,event:i},this.#t.nsOf&&S(this.#t.doc,r.row,this.#t.nsOf(),r.percent))}#q(i){const r=this.#t,b=this.#i;if(!(typeof r.previewDrag!="function"||typeof r.controller.previewEdit!="function")){if(this.#J()){const T=this.#_t(b,i);T&&r.previewDrag(T),this.#I(i);return}this.#Q(i)}}#nt(){const i=this.#t.doc&&this.#t.doc.defaultView;return i&&typeof i.requestAnimationFrame=="function"&&typeof i.setTimeout=="function"?i:null}#J(){if(!this.#nt())return!1;const i=this.#t.controller,r=i&&i.schedule;return(r&&r.tasks instanceof Map?r.tasks.size:Array.isArray(i&&i.tasks)?i.tasks.length:0)>p}#Q(i){const r=this.#t,b=this.#i;if(b){if(!b.preview||b.preview.delta!==i){const{askStart:T,askDuration:j}=this.#y(b,i),I=r.controller.previewEdit(this.#D(b,T,j));b.preview={delta:i,schedule:I}}r.previewDrag(b.preview.schedule)}}#I(i){const r=this.#nt(),b=this.#i;!r||!b||(b.rescheduleTimer!=null&&r.clearTimeout(b.rescheduleTimer),b.rescheduleTimer=r.setTimeout(()=>{b.rescheduleTimer=null,this.#i===b&&this.#Q(i)},o))}#_t(i,r){const b=this.#t.controller.schedule;if(!b||!b.ok||!(b.tasks instanceof Map))return i.preview?i.preview.schedule:null;const T=b.tasks.get(String(i.id));if(!T)return b;const{askStart:j,askDuration:I}=this.#y(i,r),O={...T};i.mode==="move"?(O.es=j,O.ef=T.ef+(j-T.es)):i.mode==="resize"&&i.edge==="start"?(O.es=j,O.duration=I):(O.ef=T.ef+r,O.duration=I);const z=new Map(b.tasks);return z.set(String(i.id),O),{...b,tasks:z}}#Pt(i){return parseFloat(i.getAttribute("data-preview")||"0")}#Z(i,r){i.setAttribute("data-preview",String(r))}#at(i,r){const b=this.#Pt(i),T=i.getAttribute("d").split(" ");for(let j=1;j<T.length;j+=1){const I=parseFloat(T[j]);!Number.isNaN(I)&&j%3===1&&(T[j]=String(U(I+(r-b))))}i.setAttribute("d",T.join(" ")),this.#Z(i,r)}#tt(i){const r=this.#i;if(!r){this.#ft();return}if(!r.started&&Math.abs((i.clientX||0)-r.startX)>=C){if(!this.#V(i))return;r.mode==="progress"?this.#Y(i):r.last={deltaDays:this.#E(this.#x(r,i)),event:i}}if(r.started&&(this.#J()&&r.last&&this.#Q(r.last.deltaDays),this.#s.flush(),this.#o=Date.now()),this.#ft(),typeof this.#t.previewDrag=="function"&&this.#t.previewDrag(null),!r.started)return;const b=this.#t.controller;if(r.mode==="progress"){w(b,"percentBarDrop",{...this.#a(r.id),from:r.origPercent,to:r.percent,pointer:f(i),event:i}),r.percent!==r.origPercent&&this.#et(r.id,r.percent,i),this.#t.redraw();return}const T=this.#E(this.#x(r,i));if(r.mode==="resize"){const O=this.#P(r,T);w(b,"taskResizeEnd",{...this.#a(r.id),edge:r.edge==="start"?"start":"end",from:this.#r(r.origStart,r.origEnd,r.origDuration),to:O.to,valid:O.valid,pointer:f(i),event:i})}if(T===0){this.#t.redraw();return}const{askStart:j,askDuration:I}=this.#y(r,T);b.applyEdit(this.#D(r,j,I),{writeBack:!0,event:i}),this.#t.redraw()}#St(i){const r=this.#i;if(r){if(this.#ft(),typeof this.#t.previewDrag=="function"&&this.#t.previewDrag(null),i.preventDefault&&i.preventDefault(),r.started){this.#o=Date.now();const b=this.#t.controller,T={...this.#a(r.id),pointer:null,event:i,reason:"escape"};if(r.mode==="move")w(b,"taskDrag:cancelled",{...T,start:this.#h(r.origStart),end:this.#h(r.origEnd)});else if(r.mode==="resize"){const j=r.edge==="start"?"start":"end",I=j==="start"?{id:r.id,start:r.origStart,duration:r.origDuration}:{id:r.id,duration:r.origDuration};w(b,"taskResize:cancelled",{...T,edge:j,from:this.#r(r.origStart,r.origEnd,r.origDuration),patch:I,origin:"user",phase:"drag"})}else w(b,"percentBarDrag:cancelled",{...T,from:r.origPercent,to:r.percent})}this.#t.redraw()}}#et(i,r,b=null){const T=this.#t.controller,j=T.schedule,I=j&&j.ok?j.tasks.get(i):null;T.applyEdit({id:i,percentComplete:r},{writeBack:!0,event:b}),this.#t.announce(this.#t.t("gantt.a11y.progress",{name:I?I.name:i,percent:r}))}#ft(){this.#s&&this.#s.cancel(),this.#s=null;const i=this.#nt();i&&this.#i&&this.#i.rescheduleTimer!=null&&i.clearTimeout(this.#i.rescheduleTimer),this.#jt(),this.#i=null}#jt(){this.#e&&(this.#t.doc.removeEventListener("pointermove",this.#e.move),this.#t.doc.removeEventListener("pointerup",this.#e.up),this.#t.doc.removeEventListener("keydown",this.#e.key),this.#e=null)}#Nt(i,r){this.#Ut(i,r);const b=j=>this.#gt(j),T=j=>this.#yt(j,j.target);this.#g={move:b,up:T},this.#t.doc.addEventListener("pointermove",b),this.#t.doc.addEventListener("pointerup",T)}#Ut(i,r){const b=i.getAttribute("data-task"),T=i.getAttribute("data-end"),j=parseFloat(i.getAttribute("cx")),I=parseFloat(i.getAttribute("cy"));this.#d={id:b,end:T,x1:j,y1:I},r.preventDefault&&r.preventDefault(),this.#t.showLinkPreview&&this.#t.showLinkPreview(j,I,j,I)}#gt(i){!this.#d||!this.#t.showLinkPreview||this.#t.showLinkPreview(this.#d.x1,this.#d.y1,this.#T(i),this.#N(i))}#yt(i,r){const b=this.#d;if(this.#kt(),this.#d=null,this.#t.hideLinkPreview&&this.#t.hideLinkPreview(),!b)return;const T=this.#t.connectorOf?this.#t.connectorOf(r):null;let j,I;if(T)j=T.getAttribute("data-task"),I=T.getAttribute("data-end");else{const ct=this.#t.milestoneOf?this.#t.milestoneOf(r):null,kt=ct&&this.#t.rowOf?this.#t.rowOf(ct):null;if(!kt)return;j=kt.getAttribute("data-task"),I="start"}if(j===b.id)return;const O=this.#t.controller,z=O.schedule,W=z&&z.ok&&z.tasks.get(b.id)&&z.tasks.get(b.id).name||b.id,B=z&&z.ok&&z.tasks.get(j)&&z.tasks.get(j).name||j;if(v(O.dependencies,b.id,j)){this.#t.announce(this.#t.t("gantt.a11y.linkCycle",{from:W,to:B}));return}const at=l(b.end==="start"?-1:1,I==="start"?-1:1);O.setDependencies([...O.dependencies,{from:b.id,to:j,type:at}],{event:i}),this.#t.announce(this.#t.t("gantt.a11y.linkCreated",{from:W,to:B,type:at}))}#pt(){this.#d=null,this.#t.hideLinkPreview&&this.#t.hideLinkPreview()}#kt(){this.#g&&(this.#t.doc.removeEventListener("pointermove",this.#g.move),this.#t.doc.removeEventListener("pointerup",this.#g.up),this.#g=null)}onKey(i){const r=this.#t.controller,b=r.schedule;if(!b||!b.ok)return;const T=this.#t.linkOf?this.#t.linkOf(i.target):null;if(T){this.#$t(i,T);return}const j=this.#t.rowOf(i.target),I=j?j.getAttribute("data-task"):null,O=I?b.tasks.get(I):null;if(!O)return;const z=this.#p(),W=Number.isFinite(z.moveStep)?Number(z.moveStep):1,B=i.key,at=this.#t.t;if(B==="ArrowRight"||B==="ArrowLeft"){if(O.isSummary||O.unscheduled)return;const ct=B==="ArrowRight"?1:-1;this.#t.focusTask(I);const kt={id:I,origStart:O.es,origEnd:O.ef,origDuration:O.duration,origPercent:Number.isFinite(Number(O.percentComplete))?Number(O.percentComplete):0};if(i.preventDefault&&i.preventDefault(),i.shiftKey&&i.altKey){if(O.isMilestone)return;const Tt=d(kt.origPercent+ct*(Number(z.progressStep)>0?Number(z.progressStep):5),z.progressStep);if(Tt===kt.origPercent||!this.#b("progress",kt,i))return;w(r,"percentBarDrop",{...this.#a(I),from:kt.origPercent,to:Tt,pointer:null,event:i}),this.#et(I,Tt,i)}else if(i.ctrlKey&&i.shiftKey){if(O.isMilestone)return;const Tt={...kt,edge:"start"},Ft=ct*W,{askStart:D,askDuration:P}=this.#y({origStart:O.es,origDuration:O.duration,mode:"resize",edge:"start"},Ft);if(!this.#b("resize",Tt,i))return;const x=this.#P({...Tt,mode:"resize",preview:null},Ft);w(r,"taskResizeEnd",{...this.#a(I),edge:"start",from:this.#r(O.es,O.ef,O.duration),to:x.to,valid:x.valid,pointer:null,event:i}),r.applyEdit({id:I,start:D,duration:P},{writeBack:!0,event:i});const R=z.dateAxis===!1?at("gantt.a11y.day",{day:D}):this.#t.iso(D);this.#t.announce(at("gantt.a11y.resizedStart",{name:O.name,date:R,days:P}))}else if(i.shiftKey){if(O.isMilestone)return;const Tt=Math.max(0,O.duration+ct*W);if(!this.#b("resize",kt,i))return;const Ft=this.#P({...kt,mode:"resize",preview:null},Tt-O.duration);w(r,"taskResizeEnd",{...this.#a(I),edge:"end",from:this.#r(O.es,O.ef,O.duration),to:Ft.to,valid:Ft.valid,pointer:null,event:i}),r.applyEdit({id:I,duration:Tt},{writeBack:!0,event:i}),this.#t.announce(at("gantt.a11y.resized",{name:O.name,days:Tt}))}else{const Tt=O.es+ct*W,Ft=z.dateAxis===!1?at("gantt.a11y.day",{day:Tt}):this.#t.iso(Tt);if(!this.#b("move",kt,i))return;r.applyEdit({id:I,start:Tt},{writeBack:!0,event:i}),this.#t.announce(at("gantt.a11y.moved",{name:O.name,date:Ft}))}}else if(B==="l"||B==="L"){if(O.isSummary)return;if(!this.#l)this.#l=I,this.#t.announce(at("gantt.a11y.linkFrom",{name:O.name}));else if(this.#l!==I){const ct=this.#l;this.#l=null,this.#t.focusTask(I),v(r.dependencies,ct,I)?this.#t.announce(at("gantt.a11y.linkCycle",{from:ct,to:O.name})):(r.setDependencies([...r.dependencies,{from:ct,to:I,type:"FS"}],{event:i}),this.#t.announce(at("gantt.a11y.linked",{from:ct,to:O.name})))}i.preventDefault&&i.preventDefault()}else if(B==="Delete"||B==="Backspace"){if(O.isSummary)return;r.deleteTask(I,{event:i}),this.#t.announce(at("gantt.a11y.deleted",{name:O.name})),i.preventDefault&&i.preventDefault()}else B==="Escape"&&this.#l&&(this.#l=null,this.#t.announce(at("gantt.a11y.linkCancelled")))}#$t(i,r){const b=this.#t.controller,T=r.getAttribute("data-from"),j=r.getAttribute("data-to"),I=r.getAttribute("data-type")||"FS",O=i.key,z=b.schedule,W=B=>z&&z.ok&&z.tasks.get(B)&&z.tasks.get(B).name||B;O==="Delete"||O==="Backspace"?(b.deleteDependency({from:T,to:j,type:I},{event:i}),this.#t.announce(this.#t.t("gantt.a11y.linkDeleted",{from:W(T),to:W(j)})),i.preventDefault&&i.preventDefault()):(O==="Enter"||O===" ")&&(this.#t.openLinkEditor&&this.#t.openLinkEditor({from:T,to:j,type:I},r,i),i.preventDefault&&i.preventDefault())}onHistoryKey(i){if(!i||!(i.ctrlKey||i.metaKey))return;const r=this.#t;if(typeof r.editing=="function"&&r.editing())return;const b=i.target,T=b&&b.tagName?String(b.tagName).toLowerCase():"";if(T==="input"||T==="textarea"||T==="select"||b&&b.isContentEditable)return;const j=typeof i.key=="string"?i.key.toLowerCase():"";let I;if(j==="z"&&!i.shiftKey)I=r.controller.undo()?"gantt.a11y.undone":"gantt.a11y.nothingToUndo";else if(j==="z"&&i.shiftKey||j==="y")I=r.controller.redo()?"gantt.a11y.redone":"gantt.a11y.nothingToRedo";else return;r.announce(r.t(I)),i.preventDefault&&i.preventDefault()}destroy(){this.#n&&(this.#n(),this.#n=null),this.#ft(),this.#kt(),this.#d=null,this.#l=null}}}),ae("packages/modules/gantt/export.js",function(g,V){"use strict";Object.defineProperty(g,"PRINT_NS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"PAPERS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"PAGE_MARGIN",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"resolveVar",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"resolvePalette",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"resolveFontFamily",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"resolveFontSizes",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"PALETTE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(g,"esc",{enumerable:!0,get:function(){return a}}),Object.defineProperty(g,"paperPx",{enumerable:!0,get:function(){return o}}),Object.defineProperty(g,"resolveRange",{enumerable:!0,get:function(){return p}}),Object.defineProperty(g,"cellText",{enumerable:!0,get:function(){return $}}),Object.defineProperty(g,"barMarkup",{enumerable:!0,get:function(){return h}}),Object.defineProperty(g,"timeHeadMarkup",{enumerable:!0,get:function(){return y}}),Object.defineProperty(g,"bandRowsMarkup",{enumerable:!0,get:function(){return r}}),Object.defineProperty(g,"bandGridMarkup",{enumerable:!0,get:function(){return b}}),Object.defineProperty(g,"dataBandMarkup",{enumerable:!0,get:function(){return T}}),Object.defineProperty(g,"buildSplitSVG",{enumerable:!0,get:function(){return j}}),Object.defineProperty(g,"inlineSvgStyles",{enumerable:!0,get:function(){return I}}),Object.defineProperty(g,"rasterizePNG",{enumerable:!0,get:function(){return O}}),Object.defineProperty(g,"buildPrintDocument",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(g,"openPrintWindow",{enumerable:!0,get:function(){return Ft}});const U=V("packages/modules/charts/scale.js").linearScale,K=V("packages/modules/gantt/time.js"),Y=K.toISODate,H=K.toDayNumber,l="lat-gantt-print",L=Object.freeze({A4:{w:794,h:1123},Letter:{w:816,h:1056},A3:{w:1123,h:1587}}),v=36,m=26,w=20,k=24,u=28;function f(D,P,x){if(!D||!P||typeof D.getComputedStyle!="function")return"";const R=D.getComputedStyle(P);return!R||typeof R.getPropertyValue!="function"?"":String(R.getPropertyValue(x)||"").trim()}function d(D,P){const x=N=>f(D,P,N),R=N=>x(`--lattice-gantt-${N}`)||x(`--lattice-gantt-d-${N}`);return{text:x("--lattice-foreground"),muted:x("--lattice-foreground-muted"),border:x("--lattice-border-color"),surface:x("--lattice-surface"),bar:R("bar"),critical:R("critical"),summary:R("summary"),milestone:R("milestone"),progress:R("progress"),today:R("today"),workload:x("--lattice-scheduler-workload"),histogram:x("--lattice-scheduler-workload"),over:x("--lattice-scheduler-overalloc"),pageBg:x("--lattice-background")}}function S(D,P){return f(D,P,"--lattice-font-family")}function _(D,P){return{sm:f(D,P,"--lattice-font-size-sm"),body:f(D,P,"--lattice-font-size")}}const C=Object.freeze({text:"#1f2933",muted:"#57606a",border:"#d0d7de",surface:"#f1f3f5",bar:"#4a90d9",critical:"#e2513b",summary:"#2c3e50",milestone:"#33404d",progress:"rgba(0,0,0,0.28)",today:"#e2513b",workload:"#4a90d9",histogram:"#2c7a7b",over:"#e2513b",pageBg:"#ffffff"});function a(D){return String(D??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function o(D,P){const x=L[D]||L.A4;return P==="portrait"?{w:x.w,h:x.h}:{w:x.h,h:x.w}}function p(D,P){const x=P&&P.from!=null?H(P.from):D.domainMin,R=P&&P.to!=null?H(P.to):D.domainMax;return Number.isFinite(x)&&Number.isFinite(R)&&R>x?{from:x,to:R}:{from:D.domainMin,to:D.domainMax}}function $(D,P,x){if(P.unscheduled&&(D.kind==="start"||D.kind==="end"||D.kind==="duration"))return"";switch(D.kind){case"name":return P.name??"";case"start":return Y(P.es)??String(P.es);case"end":return Y(P.ef)??String(P.ef);case"duration":return String(Math.round(P.ef-P.es));case"assignee":{const R=x?x.assignee??x.assignees??x.owner:null;return(Array.isArray(R)?R:R==null?[]:[R]).map(String).filter(Boolean).join(", ")}case"progress":return P.percentComplete==null?"":`${Math.round(P.percentComplete)}%`;default:return x&&D.key?String(x[D.key]??""):""}}function h(D,P,x,R,N){if(!Number.isFinite(D.es)||!Number.isFinite(D.ef))return"";const X=Math.max(2,Math.round(R*.18)),G=x+X,J=Math.max(2,R-X*2);if(D.milestone){const wt=P(D.es),Jt=x+R/2,dt=Math.max(4,Math.min(9,R*.3)),nt=D.critical?N.critical:N.milestone;return`<path d="M ${wt} ${Jt-dt} L ${wt+dt} ${Jt} L ${wt} ${Jt+dt} L ${wt-dt} ${Jt} Z" fill="${nt}"/>`}const tt=P(D.es),ft=P(D.ef),st=Math.max(1,ft-tt),ht=D.isSummary?N.summary:D.critical?N.critical:N.bar;let Pt=`<rect x="${tt}" y="${G}" width="${st}" height="${J}" rx="3" fill="${ht}"/>`;if(!D.isSummary&&D.percentComplete!=null&&D.percentComplete>0){const wt=Math.max(0,Math.min(100,D.percentComplete)),Jt=Math.round(st*wt/100);Pt+=`<rect x="${tt}" y="${G}" width="${Jt}" height="${J}" fill="${N.progress}"/>`}return Pt}function y(D,P,x,R,N,X,G=C,J="11"){const tt=X==="month"||X==="quarter"?30:7;let ft=`<rect x="0" y="0" width="${R}" height="${N}" fill="${G.surface}"/>`,st=Math.floor(D/tt)*tt;for(;st<P;st+=tt){const ht=x(st);ft+=`<line x1="${ht}" y1="0" x2="${ht}" y2="${N}" stroke="${G.border}"/>`,ft+=`<text x="${ht+4}" y="${Math.round(N*.68)}" font-size="${J}" font-weight="600" fill="${G.muted}">${a(Y(st)??String(st))}</text>`}return ft+=`<line x1="0" y1="${N}" x2="${R}" y2="${N}" stroke="${G.border}"/>`,ft}function i(D,P,x,R,N,X,G,J,tt){const ft=Math.max(1,...D.flatMap(ht=>(ht.cells||[]).filter(Pt=>Pt!=null)));let st="";return(P.cells||[]).forEach((ht,Pt)=>{if(ht==null)return;const wt=J[Pt];if(!wt)return;const Jt=R+x(wt.start),dt=Math.max(1,x(wt.end)-x(wt.start)-2),nt=Math.max(1,Math.round(ht/ft*(N-8))),ot=X+N-4-nt,vt=P.over&&P.over[Pt];st+=`<rect x="${Jt}" y="${ot}" width="${dt}" height="${nt}" fill="${vt?tt:G}"/>`}),st}function r(D,P,x,R,N,X,G,J){if(!D||!D.rows||!D.rows.length)return"";let tt="";return D.rows.forEach((ft,st)=>{const ht=N+st*R;tt+=`<text x="4" y="${ht+R/2+4}" font-size="${J}" fill="${G.text}">${a(ft.label)}</text>`,tt+=`<line x1="0" y1="${ht+R}" x2="${x}" y2="${ht+R}" stroke="${G.border}"/>`,tt+=i(D.rows,ft,P,x,R,ht,X,D.buckets,G.over)}),tt}function b(D,P,x,R,N,X,G){const J=D&&D.grid;if(!J||!J.rows||!J.rows.length)return"";const tt=J.columns,ft=J.columnWidths,st=ft.reduce((wt,Jt)=>wt+Jt,0);let ht="",Pt=0;for(let wt=0;wt<tt.length;wt++)ht+=`<text x="${Pt+6}" y="${R+Math.round(x*.65)}" font-size="${G}" font-weight="600" fill="${X.muted}">${a(tt[wt].title||tt[wt].id)}</text>`,Pt+=ft[wt];return ht+=`<line x1="0" y1="${R+x}" x2="${st}" y2="${R+x}" stroke="${X.border}"/>`,J.rows.forEach((wt,Jt)=>{const dt=R+x+Jt*x;let nt=0;for(let ot=0;ot<tt.length;ot++){const vt=ot===0&&wt.taskId!=null?14:6;ht+=`<text x="${nt+vt}" y="${dt+x/2+4}" font-size="${G}" fill="${X.text}">${a(wt.texts?wt.texts[ot]:"")}</text>`,nt+=ft[ot]}ht+=`<line x1="0" y1="${dt+x}" x2="${st}" y2="${dt+x}" stroke="${X.border}"/>`,ht+=i(J.rows,wt,P,st,x,dt,N,D.buckets,X.over)}),ht}function T(D,P,x,R,N,X,G){const J=D.rowHeight;let tt=`<text x="6" y="${R+Math.round(J*.65)}" font-size="${G}" font-weight="600" fill="${X.muted}">${a(D.title)}</text>`;if(tt+=`<line x1="0" y1="${R+J}" x2="${x+N}" y2="${R+J}" stroke="${X.border}"/>`,D.collapsed)return tt;const ft=D.totalsColumn?x-6:null;return D.rows.forEach((st,ht)=>{const Pt=R+J+ht*J,wt=Pt+J/2+4,Jt=st.isTotal||st.isSummary?600:400;tt+=`<text x="${6+(st.depth||0)*14}" y="${wt}" font-size="${G}" font-weight="${Jt}" fill="${X.text}">${a(st.label)}</text>`,ft!=null&&st.totalText&&(tt+=`<text x="${ft}" y="${wt}" font-size="${G}" font-weight="${Jt}" text-anchor="end" fill="${X.text}">${a(st.totalText)}</text>`),(st.texts||[]).forEach((dt,nt)=>{const ot=D.buckets[nt];if(!ot||!dt)return;const vt=P(ot.end);vt<=0||P(ot.start)>=N||(tt+=`<text x="${x+Math.min(N,vt)-4}" y="${wt}" font-size="${G}" font-weight="${Jt}" text-anchor="end" fill="${X.text}">${a(dt)}</text>`)}),tt+=`<line x1="0" y1="${Pt+J}" x2="${x+N}" y2="${Pt+J}" stroke="${X.border}"/>`}),tt}function j(D,P={}){const x=d(P.view,P.el),R=S(P.view,P.el),N=_(P.view,P.el),X=p(D,P.range),G=Math.max(1,Math.round(D.pxPerDay*(X.to-X.from))),J=U({min:X.from,max:X.to},[0,G]),tt=pt=>Math.round(J.of(pt)),ft=D.columnWidths.reduce((pt,zt)=>pt+zt,0),st=ft+G,ht=Math.max(k,u),Pt=ht;let wt=0;D.workload&&(wt+=D.workload.cfg.height),D.histogram&&(wt+=D.histogram.cfg.height);const Jt=Array.isArray(D.dataBands)?D.dataBands:[];for(const pt of Jt)wt+=pt.collapsed?pt.rowHeight:(pt.rows.length+1)*pt.rowHeight;const dt=Pt+D.totalHeight+wt;let nt="",ot=0;for(let pt=0;pt<D.columns.length;pt++){const zt=D.columnWidths[pt];nt+=`<text x="${ot+6}" y="${Math.round(ht*.65)}" font-size="${N.sm}" font-weight="600" fill="${x.muted}">${a(D.columns[pt].title||D.columns[pt].id||D.columns[pt].key)}</text>`,ot+=zt}if(nt+=`<line x1="0" y1="${ht}" x2="${ft}" y2="${ht}" stroke="${x.border}"/>`,nt+=`<g transform="translate(${ft},0)">${y(X.from,X.to,tt,G,ht,D.zoomLevel,x,N.sm)}</g>`,D.rows.forEach((pt,zt)=>{const Ot=Pt+pt.top;let et=0;for(let gt=0;gt<D.columns.length;gt++){const q=D.columns[gt],jt=D.columnWidths[gt],Et=D.cellTexts?D.cellTexts[zt][gt]:$(q,pt.rec,D.rawById.get(String(pt.id))),mt=q.kind==="name"?pt.depth*14+6:6;nt+=`<text x="${et+mt}" y="${Ot+pt.height/2+4}" font-size="${N.body}" font-weight="${pt.rec.isSummary?600:400}" fill="${pt.rec.isSummary?x.summary:x.text}">${a(Et)}</text>`,et+=jt}nt+=`<line x1="0" y1="${Ot+pt.height}" x2="${st}" y2="${Ot+pt.height}" stroke="${x.border}"/>`,nt+=`<g transform="translate(${ft},${Ot})">${h(pt.rec,tt,0,pt.height,x)}</g>`}),D.today!=null&&D.today>=X.from&&D.today<=X.to){const pt=ft+tt(D.today);nt+=`<line x1="${pt}" y1="0" x2="${pt}" y2="${Pt+D.totalHeight}" stroke="${x.today}" stroke-width="1.5" stroke-dasharray="4 3"/>`}let vt=Pt+D.totalHeight;for(const[pt,zt]of[[D.workload,x.workload],[D.histogram,x.histogram]])if(pt){if(nt+=`<rect x="0" y="${vt}" width="${st}" height="${pt.cfg.height}" fill="${x.pageBg}"/>`,pt.data&&pt.data.grid)nt+=b(pt.data,tt,pt.cfg.rowHeight,vt,zt,x,N.sm);else{const Ot=Math.max(40,ft);nt+=`<g transform="translate(${Ot},0)">${r(pt.data,tt,0,pt.cfg.rowHeight,vt,zt,x,N.sm)}</g>`}nt+=`<line x1="0" y1="${vt}" x2="${st}" y2="${vt}" stroke="${x.border}" stroke-width="2"/>`,vt+=pt.cfg.height}for(const pt of Jt){const zt=pt.collapsed?pt.rowHeight:(pt.rows.length+1)*pt.rowHeight;nt+=`<g data-band="${a(pt.id)}">${T(pt,tt,ft,vt,G,x,N.sm)}</g>`,nt+=`<line x1="0" y1="${vt}" x2="${st}" y2="${vt}" stroke="${x.border}" stroke-width="2"/>`,vt+=zt}return`<svg xmlns="http://www.w3.org/2000/svg" width="${st}" height="${dt}" viewBox="0 0 ${st} ${dt}" font-family="${R}"><rect x="0" y="0" width="${st}" height="${dt}" fill="${x.pageBg}"/>${nt}</svg>`}function I(D,P,x){const R=["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linejoin","stroke-linecap","font-size","font-family","font-weight","opacity","text-anchor","dominant-baseline","visibility"],N=[D,...D.querySelectorAll("*")],X=[P,...P.querySelectorAll("*")];for(let G=0;G<N.length&&G<X.length;G++){const J=x.getComputedStyle(N[G]),tt=[];for(const ft of R){const st=J.getPropertyValue(ft);st&&tt.push(`${ft}:${st}`)}tt.length&&X[G].setAttribute("style",tt.join(";"))}}async function O(D,P,x,R,N,X){const G=D&&D.defaultView||globalThis;if(!G.Image||!D.createElement)return null;const J=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(P)}`,tt=new G.Image;await new Promise((ht,Pt)=>{tt.onload=ht,tt.onerror=()=>Pt(new Error("the plan could not be rasterised")),tt.src=J});const ft=D.createElement("canvas");ft.width=Math.max(1,Math.round(x*N)),ft.height=Math.max(1,Math.round(R*N));const st=ft.getContext("2d");return X&&(st.fillStyle=X,st.fillRect(0,0,ft.width,ft.height)),st.drawImage(tt,0,0,ft.width,ft.height),new Promise(ht=>ft.toBlob(ht,"image/png"))}function z(D,P){const x=[];let R=[],N=0;for(const X of D){const G=Math.max(1,X.height);R.length&&N+G>P&&(x.push(R),R=[],N=0),R.push(X),N+=G}return(R.length||!x.length)&&x.push(R),x}function W(D,P,x,R){return`
|
|
16
|
-
@page { size: ${
|
|
15
|
+
}`}}),ae("packages/modules/gantt/gestures.js",function(p,V){"use strict";Object.defineProperty(p,"describeTask",{enumerable:!0,get:function(){return $}}),Object.defineProperty(p,"GanttGestures",{enumerable:!0,get:function(){return h}});const U=V("packages/modules/charts/svg.js").round,Y=V("packages/modules/shared/drag-gesture.js").attachDragGesture,l=V("packages/modules/gantt/links.js").linkTypeForSides,v=V("packages/modules/gantt/schedule.js").wouldCreateCycle,b=V("packages/modules/gantt/events-pointer.js"),w=b.emitGesture,k=b.gateGesture,u=b.taskContext,g=b.pointerOf,d=b.snapProgress,S=b.previewProgress,_=b.FrameThrottle,C=b.DRAG_THRESHOLD,a=24,o=90,m=2e3;function $(y,i){const r=y.isSummary?"summary":y.isMilestone?"milestone":"task";if(y.unscheduled)return[`${y.name}, ${r}`,i.unscheduled].filter(Boolean).join(", ");if(y.inactive&&y.es==null)return[`${y.name}, ${r}`,i.inactive].filter(Boolean).join(", ");const f=i.dateAxis===!1?`day ${U(y.es)} to ${U(y.ef)}`:`${i.iso(y.es)} to ${i.iso(y.ef)}`,M=[`${y.name}, ${r}`,f];return y.isMilestone||M.push(`${U(y.duration)} days`),y.percentComplete!=null&&M.push(`${Math.round(y.percentComplete)}% complete`),M.push(`slack ${U(y.totalFloat)} days`),y.critical&&M.push("on the critical path"),y.inactive&&i.inactive&&M.push(i.inactive),M.join(", ")}class h{#t;#i=null;#e=null;#n=null;#s=null;#o=-1/0;#l=null;#h=null;#f=null;#p=null;constructor(i){this.#t=i}#g(){return this.#t.options()||{}}get dragging(){return this.#i!==null}get draggedId(){return this.#i?this.#i.id:null}consumeDragRelease(){if(this.#i&&this.#i.started)return!0;const i=Date.now()-this.#o<400;return this.#o=-1/0,i}#a(i){if(this.#g().dateAxis===!1)return i;const r=this.#t.iso(i);return r??i}#d(i){const r=typeof this.#t.view=="function"?this.#t.view():null;return{...u(this.#t.controller,i),view:r}}#c(i){const r=this.#t.controller;return typeof r.isTaskLocked=="function"?!!r.isTaskLocked(i):!1}#y(i){const r=this.#t.controller;return typeof r.isTaskReadOnly=="function"?!!r.isTaskReadOnly(i):!1}#r(i,r,f){const M=this.#t.controller,D=g(f),I=this.#y(r.id);if(i==="move"){const B=()=>({...this.#d(r.id),start:this.#a(r.origStart),end:this.#a(r.origEnd),pointer:D,event:f});return I?(w(M,"taskDrag:cancelled",{...B(),phase:"start",reason:"readOnly"}),!1):k(M,"beforeTaskDrag","taskDrag:cancelled",{...B(),phase:"start"})?(w(M,"taskDragStart",B()),!0):!1}if(i==="resize"){const B=r.edge==="start"?"start":"end",H=()=>({...this.#d(r.id),edge:B,from:this.#m(r.origStart,r.origEnd,r.origDuration),pointer:D,event:f}),z=B==="start"?{id:r.id,start:r.origStart,duration:r.origDuration}:{id:r.id,duration:r.origDuration};if(I)return w(M,"taskResize:cancelled",{...H(),patch:z,origin:"user",phase:"start",reason:"readOnly"}),!1;const at={...H(),patch:z,origin:"user",phase:"start"};return k(M,"beforeTaskResizeStart","taskResize:cancelled",at)?(w(M,"taskResizeStart",H()),!0):!1}const O=()=>({...this.#d(r.id),from:r.origPercent,pointer:D,event:f});return I?(w(M,"percentBarDrag:cancelled",{...O(),to:r.origPercent,reason:"readOnly"}),!1):k(M,"beforePercentBarDrag","percentBarDrag:cancelled",{...O(),to:r.origPercent})?(w(M,"percentBarDragStart",O()),!0):!1}#m(i,r,f){return{start:this.#a(i),end:this.#a(r),duration:f}}#w(){const i=this.#i;if(!i||!i.started||!i.last)return;const r=this.#t.controller,f=i.last.event;if(i.mode==="progress"){w(r,"percentBarDrag",{...this.#d(i.id),from:i.origPercent,to:i.percent,pointer:g(f),event:f});return}const M=this.#k(i,i.last.deltaDays);i.mode==="move"?w(r,"taskDrag",{...this.#d(i.id),from:{start:this.#a(i.origStart),end:this.#a(i.origEnd)},to:{start:M.to.start,end:M.to.end},deltaDays:i.last.deltaDays,valid:M.valid,pointer:g(f),pushed:M.pushed,event:f}):w(r,"taskPartialResize",{...this.#d(i.id),edge:i.edge==="start"?"start":"end",from:this.#m(i.origStart,i.origEnd,i.origDuration),to:M.to,valid:M.valid,pointer:g(f),event:f})}#E(i,r){if(i.mode==="move")return{askStart:i.origStart+r,askDuration:i.origDuration};if(i.mode==="resize"&&i.edge==="start"){const f=Math.min(r,i.origDuration-1);return{askStart:i.origStart+f,askDuration:Math.max(1,i.origDuration-f)}}return{askStart:i.origStart,askDuration:Math.max(0,i.origDuration+r)}}#P(i,r,f){return i.mode==="move"?{id:i.id,start:r}:i.mode==="resize"&&i.edge==="start"?{id:i.id,start:r,duration:f}:{id:i.id,duration:f}}#k(i,r){const f=this.#t.controller,{askStart:M,askDuration:D}=this.#E(i,r),I=i.preview&&i.preview.delta===r?i.preview.schedule:this.#ht()?null:typeof f.previewEdit=="function"?f.previewEdit(this.#P(i,M,D)):null,O=I&&I.tasks?I.tasks.get(i.id):null,B=O?O.es:M,H=O?O.duration:D,z=O?O.ef:M+D,at=!!O&&O.es===M&&(i.mode==="move"||O.duration===D),dt=[],kt=f.schedule;if(I&&I.tasks&&kt&&kt.ok)for(const[Tt,Ft]of I.tasks){if(Tt===i.id)continue;const P=kt.tasks.get(Tt);P&&(P.es!==Ft.es||P.ef!==Ft.ef)&&dt.push({id:Tt,to:{start:this.#a(Ft.es),end:this.#a(Ft.ef)}})}return{to:this.#m(B,z,H),valid:at&&!this.#c(i.id),pushed:dt}}#M(){const i=this.#t.plot();if(i&&typeof i.getScreenCTM=="function"){let f=null;try{f=i.getScreenCTM()}catch{f=null}if(f&&Number.isFinite(f.a)&&f.a>0)return{scale:f.a,origin:Number.isFinite(f.e)?f.e:0}}const r=i&&i.getBoundingClientRect?i.getBoundingClientRect():null;return{scale:1,origin:r&&r.left||0}}#D(i){const{scale:r,origin:f}=this.#M();return((i.clientX||0)-f)/r}#j(i){const r=this.#t.plot(),f=r&&r.getBoundingClientRect?r.getBoundingClientRect():null;return(i.clientY||0)-(f&&f.top||0)}#x(i){const{scale:r}=this.#M();return Math.round(i/r/(this.#t.pxPerDay()||1))}#U(i,r){return(r.clientX||0)-i.startX+(i.origin-this.#M().origin)}onPointerDown(i){const r=this.#t.controller.schedule;if(!r||!r.ok)return;const f=this.#t.connectorOf?this.#t.connectorOf(i.target):null;if(f){if(this.#n&&i.pointerType&&i.pointerType!=="mouse")return;this.#At(f,i);return}const M=this.#t.linkOf?this.#t.linkOf(i.target):null;if(M&&!this.#q(i)){i.preventDefault&&i.preventDefault(),M.focus&&M.focus();return}this.#O(i)||this.#F(i,!1)}#q(i){const r=this.#t.doc;if(!r||typeof r.elementsFromPoint!="function"||!Number.isFinite(i.clientX))return null;const f=this.#t;for(const M of r.elementsFromPoint(i.clientX,i.clientY||0)){const D=f.rowOf(M);if(!D)continue;const I=f.barOf(D),O=I&&(M===I||typeof I.contains=="function"&&I.contains(M)),B=f.progressOf&&f.progressOf(M)||f.resizeStartOf&&f.resizeStartOf(M);if(O||B)return D}return null}#O(i){if(!this.#n||!i.pointerType||i.pointerType==="mouse")return null;const r=this.#t.controller.schedule;if(!r||!r.ok)return null;const f=this.#t;if(f.connectorOf&&f.connectorOf(i.target))return null;const M=f.rowOf(i.target)||this.#q(i);if(!M)return null;const D=r.tasks.get(M.getAttribute("data-task"));return!D||D.isSummary||D.unscheduled?null:f.barOf(M)||null}attachTouch(i){if(this.#n)return;const r=this.#t;this.#n=Y(i,{canStart:f=>{if(f.pointerType&&f.pointerType!=="mouse"){const M=r.connectorOf?r.connectorOf(f.target):null;if(M)return M}return this.#O(f)},onStart:(f,M)=>{const D=r.connectorOf?r.connectorOf(f.el):null;if(D){this.#ot(D,M);return}this.#F(M,!0)},onMove:(f,M)=>{if(this.#f){this.#vt(M);return}this.#rt(M)},onEnd:(f,M)=>{if(this.#f){this.#_t(M,this.#X(M));return}this.#Lt(M)},onCancel:(f,M)=>{if(this.#f){this.#It();return}this.#xt(M)},autoScroll:()=>typeof r.scrollers=="function"?r.scrollers():[]})}#X(i){const r=this.#t.doc;if(r&&typeof r.elementFromPoint=="function"){const f=r.elementFromPoint(i.clientX||0,i.clientY||0);if(f)return f}return i.target}#C(i,r,f,M){const D=this.#t.resizeStartOf?this.#t.resizeStartOf(i.target):null,I=this.#D(i),O=Math.max(Number.isFinite(this.#g().resizeZone)?Number(this.#g().resizeZone):6,M?a:0);let B="move",H="end";return r.isMilestone||(I>=this.#J(f)-O?(B="resize",H="end"):D&&(B="resize",H="start")),{mode:B,edge:H}}hoverCursor(i){if(this.dragging)return;const r=this.#t.controller.schedule;if(!r||!r.ok){this.clearHoverCursor();return}const f=this.#t.rowOf(i.target),M=f?f.getAttribute("data-task"):null,D=M!=null?r.tasks.get(M):null,I=D?this.#t.barOf(f):null;if(!D||D.isSummary||D.unscheduled||!I||this.#y(M)){this.clearHoverCursor();return}const O=this.#C(i,D,I,!1).mode==="resize";this.#h&&this.#h!==I&&(this.#h.style.cursor=""),I.style.cursor=O?"ew-resize":"",this.#h=O?I:null}clearHoverCursor(){this.#h&&(this.#h.style.cursor="",this.#h=null)}#F(i,r){const f=this.#t.controller.schedule;if(!f||!f.ok)return;const M=this.#t.rowOf(i.target)||this.#q(i);if(!M)return;const D=M.getAttribute("data-task"),I=f.tasks.get(D);if(!I||I.isSummary||I.unscheduled)return;const O=this.#t.barOf(M);if(!O)return;const B=this.#t.progressOf?this.#t.progressOf(i.target):null,{mode:H,edge:z}=this.#C(i,I,O,r);let at=H;B&&!I.isMilestone&&(at="progress");const dt=Number.isFinite(Number(I.percentComplete))?Number(I.percentComplete):0;if(this.#i={id:D,mode:at,edge:z,startX:i.clientX||0,origStart:I.es,origEnd:I.ef,origDuration:I.duration,barEl:O,row:M,origPercent:dt,percent:dt,origin:this.#M().origin,started:!1,last:null,preview:null,rescheduleTimer:null},i.preventDefault&&!r&&i.preventDefault(),this.#s=new _(this.#t.doc,()=>this.#w()),r)return;const kt=P=>this.#rt(P),Tt=P=>this.#Lt(P),Ft=P=>{P.key==="Escape"&&this.#xt(P)};this.#e={move:kt,up:Tt,key:Ft},this.#t.doc.addEventListener("pointermove",kt),this.#t.doc.addEventListener("pointerup",Tt),this.#t.doc.addEventListener("keydown",Ft)}#V(i){const r=this.#i;if(r.started)return!0;if(Math.abs((i.clientX||0)-r.startX)<C)return!1;if(!this.#r(r.mode,r,i))return this.#kt(),this.#o=Date.now(),!1;if(r.started=!0,r.mode==="progress"&&this.#t.nsOf){const f=this.#t.nsOf(),M=r.row.querySelector(`.${f}__progresshandle`);M&&M.classList&&M.classList.add(`${f}__progresshandle--active`)}return!0}#J(i){const r=parseFloat(i.getAttribute("x")),f=parseFloat(i.getAttribute("width"));return Number.isFinite(r)&&Number.isFinite(f)?r+f:Number.POSITIVE_INFINITY}#rt(i){if(!this.#i||!this.#V(i))return;if(this.#i.mode==="progress"){this.#Q(i),this.#s.push(null);return}const r=this.#t.pxPerDay()||1,f=this.#x(this.#U(this.#i,i)),M=this.#i.barEl;if(this.#i.mode==="move")M.getAttribute("d")?this.#et(M,f*r):(M.setAttribute("x",U(parseFloat(M.getAttribute("x"))+f*r-this.#Y(M))),this.#ft(M,f*r));else if(this.#i.edge==="start"){const{askStart:D}=this.#E(this.#i,f),I=D-this.#i.origStart,O=I*r-this.#Y(M);M.setAttribute("x",U(parseFloat(M.getAttribute("x"))+O)),M.setAttribute("width",U(Math.max(1,parseFloat(M.getAttribute("width"))-O))),this.#ft(M,I*r)}else{const D=Math.max(1,parseFloat(M.getAttribute("width"))+(f*r-this.#Y(M)));M.setAttribute("width",U(D)),this.#ft(M,f*r)}this.#dt(f),this.#i.last={deltaDays:f,event:i},this.#s.push(null)}#Q(i){const r=this.#i,f=r.barEl,M=parseFloat(f.getAttribute("x")),D=parseFloat(f.getAttribute("width"));!Number.isFinite(M)||!(D>0)||(r.percent=d((this.#D(i)-M)/D*100,this.#g().progressStep),r.last={deltaDays:0,event:i},this.#t.nsOf&&S(this.#t.doc,r.row,this.#t.nsOf(),r.percent))}#dt(i){const r=this.#t,f=this.#i;if(!(typeof r.previewDrag!="function"||typeof r.controller.previewEdit!="function")){if(this.#ht()){const M=this.#st(f,i);M&&r.previewDrag(M),this.#tt(i);return}this.#Kt(i)}}#N(){const i=this.#t.doc&&this.#t.doc.defaultView;return i&&typeof i.requestAnimationFrame=="function"&&typeof i.setTimeout=="function"?i:null}#ht(){if(!this.#N())return!1;const i=this.#t.controller,r=i&&i.schedule;return(r&&r.tasks instanceof Map?r.tasks.size:Array.isArray(i&&i.tasks)?i.tasks.length:0)>m}#Kt(i){const r=this.#t,f=this.#i;if(f){if(!f.preview||f.preview.delta!==i){const{askStart:M,askDuration:D}=this.#E(f,i),I=r.controller.previewEdit(this.#P(f,M,D));f.preview={delta:i,schedule:I}}r.previewDrag(f.preview.schedule)}}#tt(i){const r=this.#N(),f=this.#i;!r||!f||(f.rescheduleTimer!=null&&r.clearTimeout(f.rescheduleTimer),f.rescheduleTimer=r.setTimeout(()=>{f.rescheduleTimer=null,this.#i===f&&this.#Kt(i)},o))}#st(i,r){const f=this.#t.controller.schedule;if(!f||!f.ok||!(f.tasks instanceof Map))return i.preview?i.preview.schedule:null;const M=f.tasks.get(String(i.id));if(!M)return f;const{askStart:D,askDuration:I}=this.#E(i,r),O={...M};i.mode==="move"?(O.es=D,O.ef=M.ef+(D-M.es)):i.mode==="resize"&&i.edge==="start"?(O.es=D,O.duration=I):(O.ef=M.ef+r,O.duration=I);const B=new Map(f.tasks);return B.set(String(i.id),O),{...f,tasks:B}}#Y(i){return parseFloat(i.getAttribute("data-preview")||"0")}#ft(i,r){i.setAttribute("data-preview",String(r))}#et(i,r){const f=this.#Y(i),M=i.getAttribute("d").split(" ");for(let D=1;D<M.length;D+=1){const I=parseFloat(M[D]);!Number.isNaN(I)&&D%3===1&&(M[D]=String(U(I+(r-f))))}i.setAttribute("d",M.join(" ")),this.#ft(i,r)}#Lt(i){const r=this.#i;if(!r){this.#kt();return}if(!r.started&&Math.abs((i.clientX||0)-r.startX)>=C){if(!this.#V(i))return;r.mode==="progress"?this.#Q(i):r.last={deltaDays:this.#x(this.#U(r,i)),event:i}}if(r.started&&(this.#ht()&&r.last&&this.#Kt(r.last.deltaDays),this.#s.flush(),this.#o=Date.now()),this.#kt(),typeof this.#t.previewDrag=="function"&&this.#t.previewDrag(null),!r.started)return;const f=this.#t.controller;if(r.mode==="progress"){w(f,"percentBarDrop",{...this.#d(r.id),from:r.origPercent,to:r.percent,pointer:g(i),event:i}),r.percent!==r.origPercent&&this.#Ct(r.id,r.percent,i),this.#t.redraw();return}const M=this.#x(this.#U(r,i));if(r.mode==="resize"){const O=this.#k(r,M);w(f,"taskResizeEnd",{...this.#d(r.id),edge:r.edge==="start"?"start":"end",from:this.#m(r.origStart,r.origEnd,r.origDuration),to:O.to,valid:O.valid,pointer:g(i),event:i})}if(M===0){this.#t.redraw();return}const{askStart:D,askDuration:I}=this.#E(r,M);f.applyEdit(this.#P(r,D,I),{writeBack:!0,event:i}),this.#t.redraw()}#xt(i){const r=this.#i;if(r){if(this.#kt(),typeof this.#t.previewDrag=="function"&&this.#t.previewDrag(null),i.preventDefault&&i.preventDefault(),r.started){this.#o=Date.now();const f=this.#t.controller,M={...this.#d(r.id),pointer:null,event:i,reason:"escape"};if(r.mode==="move")w(f,"taskDrag:cancelled",{...M,start:this.#a(r.origStart),end:this.#a(r.origEnd)});else if(r.mode==="resize"){const D=r.edge==="start"?"start":"end",I=D==="start"?{id:r.id,start:r.origStart,duration:r.origDuration}:{id:r.id,duration:r.origDuration};w(f,"taskResize:cancelled",{...M,edge:D,from:this.#m(r.origStart,r.origEnd,r.origDuration),patch:I,origin:"user",phase:"drag"})}else w(f,"percentBarDrag:cancelled",{...M,from:r.origPercent,to:r.percent})}this.#t.redraw()}}#Ct(i,r,f=null){const M=this.#t.controller,D=M.schedule,I=D&&D.ok?D.tasks.get(i):null;M.applyEdit({id:i,percentComplete:r},{writeBack:!0,event:f}),this.#t.announce(this.#t.t("gantt.a11y.progress",{name:I?I.name:i,percent:r}))}#kt(){this.#s&&this.#s.cancel(),this.#s=null;const i=this.#N();i&&this.#i&&this.#i.rescheduleTimer!=null&&i.clearTimeout(this.#i.rescheduleTimer),this.#wt(),this.#i=null}#wt(){this.#e&&(this.#t.doc.removeEventListener("pointermove",this.#e.move),this.#t.doc.removeEventListener("pointerup",this.#e.up),this.#t.doc.removeEventListener("keydown",this.#e.key),this.#e=null)}#At(i,r){this.#ot(i,r);const f=D=>this.#vt(D),M=D=>this.#_t(D,D.target);this.#p={move:f,up:M},this.#t.doc.addEventListener("pointermove",f),this.#t.doc.addEventListener("pointerup",M)}#ot(i,r){const f=i.getAttribute("data-task"),M=i.getAttribute("data-end"),D=parseFloat(i.getAttribute("cx")),I=parseFloat(i.getAttribute("cy"));this.#f={id:f,end:M,x1:D,y1:I},r.preventDefault&&r.preventDefault(),this.#t.showLinkPreview&&this.#t.showLinkPreview(D,I,D,I)}#vt(i){!this.#f||!this.#t.showLinkPreview||this.#t.showLinkPreview(this.#f.x1,this.#f.y1,this.#D(i),this.#j(i))}#_t(i,r){const f=this.#f;if(this.#Mt(),this.#f=null,this.#t.hideLinkPreview&&this.#t.hideLinkPreview(),!f)return;const M=this.#t.connectorOf?this.#t.connectorOf(r):null;let D,I;if(M)D=M.getAttribute("data-task"),I=M.getAttribute("data-end");else{const dt=this.#t.milestoneOf?this.#t.milestoneOf(r):null,kt=dt&&this.#t.rowOf?this.#t.rowOf(dt):null;if(!kt)return;D=kt.getAttribute("data-task"),I="start"}if(D===f.id)return;const O=this.#t.controller,B=O.schedule,H=B&&B.ok&&B.tasks.get(f.id)&&B.tasks.get(f.id).name||f.id,z=B&&B.ok&&B.tasks.get(D)&&B.tasks.get(D).name||D;if(v(O.dependencies,f.id,D)){this.#t.announce(this.#t.t("gantt.a11y.linkCycle",{from:H,to:z}));return}const at=l(f.end==="start"?-1:1,I==="start"?-1:1);O.setDependencies([...O.dependencies,{from:f.id,to:D,type:at}],{event:i}),this.#t.announce(this.#t.t("gantt.a11y.linkCreated",{from:H,to:z,type:at}))}#It(){this.#f=null,this.#t.hideLinkPreview&&this.#t.hideLinkPreview()}#Mt(){this.#p&&(this.#t.doc.removeEventListener("pointermove",this.#p.move),this.#t.doc.removeEventListener("pointerup",this.#p.up),this.#p=null)}onKey(i){const r=this.#t.controller,f=r.schedule;if(!f||!f.ok)return;const M=this.#t.linkOf?this.#t.linkOf(i.target):null;if(M){this.#Ft(i,M);return}const D=this.#t.rowOf(i.target),I=D?D.getAttribute("data-task"):null,O=I?f.tasks.get(I):null;if(!O)return;const B=this.#g(),H=Number.isFinite(B.moveStep)?Number(B.moveStep):1,z=i.key,at=this.#t.t;if(z==="ArrowRight"||z==="ArrowLeft"){if(O.isSummary||O.unscheduled)return;const dt=z==="ArrowRight"?1:-1;this.#t.focusTask(I);const kt={id:I,origStart:O.es,origEnd:O.ef,origDuration:O.duration,origPercent:Number.isFinite(Number(O.percentComplete))?Number(O.percentComplete):0};if(i.preventDefault&&i.preventDefault(),i.shiftKey&&i.altKey){if(O.isMilestone)return;const Tt=d(kt.origPercent+dt*(Number(B.progressStep)>0?Number(B.progressStep):5),B.progressStep);if(Tt===kt.origPercent||!this.#r("progress",kt,i))return;w(r,"percentBarDrop",{...this.#d(I),from:kt.origPercent,to:Tt,pointer:null,event:i}),this.#Ct(I,Tt,i)}else if(i.ctrlKey&&i.shiftKey){if(O.isMilestone)return;const Tt={...kt,edge:"start"},Ft=dt*H,{askStart:P,askDuration:j}=this.#E({origStart:O.es,origDuration:O.duration,mode:"resize",edge:"start"},Ft);if(!this.#r("resize",Tt,i))return;const x=this.#k({...Tt,mode:"resize",preview:null},Ft);w(r,"taskResizeEnd",{...this.#d(I),edge:"start",from:this.#m(O.es,O.ef,O.duration),to:x.to,valid:x.valid,pointer:null,event:i}),r.applyEdit({id:I,start:P,duration:j},{writeBack:!0,event:i});const R=B.dateAxis===!1?at("gantt.a11y.day",{day:P}):this.#t.iso(P);this.#t.announce(at("gantt.a11y.resizedStart",{name:O.name,date:R,days:j}))}else if(i.shiftKey){if(O.isMilestone)return;const Tt=Math.max(0,O.duration+dt*H);if(!this.#r("resize",kt,i))return;const Ft=this.#k({...kt,mode:"resize",preview:null},Tt-O.duration);w(r,"taskResizeEnd",{...this.#d(I),edge:"end",from:this.#m(O.es,O.ef,O.duration),to:Ft.to,valid:Ft.valid,pointer:null,event:i}),r.applyEdit({id:I,duration:Tt},{writeBack:!0,event:i}),this.#t.announce(at("gantt.a11y.resized",{name:O.name,days:Tt}))}else{const Tt=O.es+dt*H,Ft=B.dateAxis===!1?at("gantt.a11y.day",{day:Tt}):this.#t.iso(Tt);if(!this.#r("move",kt,i))return;r.applyEdit({id:I,start:Tt},{writeBack:!0,event:i}),this.#t.announce(at("gantt.a11y.moved",{name:O.name,date:Ft}))}}else if(z==="l"||z==="L"){if(O.isSummary)return;if(!this.#l)this.#l=I,this.#t.announce(at("gantt.a11y.linkFrom",{name:O.name}));else if(this.#l!==I){const dt=this.#l;this.#l=null,this.#t.focusTask(I),v(r.dependencies,dt,I)?this.#t.announce(at("gantt.a11y.linkCycle",{from:dt,to:O.name})):(r.setDependencies([...r.dependencies,{from:dt,to:I,type:"FS"}],{event:i}),this.#t.announce(at("gantt.a11y.linked",{from:dt,to:O.name})))}i.preventDefault&&i.preventDefault()}else if(z==="Delete"||z==="Backspace"){if(O.isSummary)return;r.deleteTask(I,{event:i}),this.#t.announce(at("gantt.a11y.deleted",{name:O.name})),i.preventDefault&&i.preventDefault()}else z==="Escape"&&this.#l&&(this.#l=null,this.#t.announce(at("gantt.a11y.linkCancelled")))}#Ft(i,r){const f=this.#t.controller,M=r.getAttribute("data-from"),D=r.getAttribute("data-to"),I=r.getAttribute("data-type")||"FS",O=i.key,B=f.schedule,H=z=>B&&B.ok&&B.tasks.get(z)&&B.tasks.get(z).name||z;O==="Delete"||O==="Backspace"?(f.deleteDependency({from:M,to:D,type:I},{event:i}),this.#t.announce(this.#t.t("gantt.a11y.linkDeleted",{from:H(M),to:H(D)})),i.preventDefault&&i.preventDefault()):(O==="Enter"||O===" ")&&(this.#t.openLinkEditor&&this.#t.openLinkEditor({from:M,to:D,type:I},r,i),i.preventDefault&&i.preventDefault())}onHistoryKey(i){if(!i||!(i.ctrlKey||i.metaKey))return;const r=this.#t;if(typeof r.editing=="function"&&r.editing())return;const f=i.target,M=f&&f.tagName?String(f.tagName).toLowerCase():"";if(M==="input"||M==="textarea"||M==="select"||f&&f.isContentEditable)return;const D=typeof i.key=="string"?i.key.toLowerCase():"";let I;if(D==="z"&&!i.shiftKey)I=r.controller.undo()?"gantt.a11y.undone":"gantt.a11y.nothingToUndo";else if(D==="z"&&i.shiftKey||D==="y")I=r.controller.redo()?"gantt.a11y.redone":"gantt.a11y.nothingToRedo";else return;r.announce(r.t(I)),i.preventDefault&&i.preventDefault()}destroy(){this.#n&&(this.#n(),this.#n=null),this.#kt(),this.#Mt(),this.#f=null,this.#l=null,this.clearHoverCursor()}}}),ae("packages/modules/gantt/export.js",function(p,V){"use strict";Object.defineProperty(p,"PRINT_NS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"PAPERS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"PAGE_MARGIN",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"resolveVar",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"resolvePalette",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"resolveFontFamily",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"resolveFontSizes",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"PALETTE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"esc",{enumerable:!0,get:function(){return a}}),Object.defineProperty(p,"paperPx",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"resolveRange",{enumerable:!0,get:function(){return m}}),Object.defineProperty(p,"cellText",{enumerable:!0,get:function(){return $}}),Object.defineProperty(p,"barMarkup",{enumerable:!0,get:function(){return h}}),Object.defineProperty(p,"timeHeadMarkup",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"bandRowsMarkup",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"bandGridMarkup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(p,"dataBandMarkup",{enumerable:!0,get:function(){return M}}),Object.defineProperty(p,"buildSplitSVG",{enumerable:!0,get:function(){return D}}),Object.defineProperty(p,"inlineSvgStyles",{enumerable:!0,get:function(){return I}}),Object.defineProperty(p,"rasterizePNG",{enumerable:!0,get:function(){return O}}),Object.defineProperty(p,"buildPrintDocument",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(p,"openPrintWindow",{enumerable:!0,get:function(){return Ft}});const U=V("packages/modules/charts/scale.js").linearScale,K=V("packages/modules/gantt/time.js"),Y=K.toISODate,W=K.toDayNumber,l="lat-gantt-print",L=Object.freeze({A4:{w:794,h:1123},Letter:{w:816,h:1056},A3:{w:1123,h:1587}}),v=36,b=26,w=20,k=24,u=28;function g(P,j,x){if(!P||!j||typeof P.getComputedStyle!="function")return"";const R=P.getComputedStyle(j);return!R||typeof R.getPropertyValue!="function"?"":String(R.getPropertyValue(x)||"").trim()}function d(P,j){const x=N=>g(P,j,N),R=N=>x(`--lattice-gantt-${N}`)||x(`--lattice-gantt-d-${N}`);return{text:x("--lattice-foreground"),muted:x("--lattice-foreground-muted"),border:x("--lattice-border-color"),surface:x("--lattice-surface"),bar:R("bar"),critical:R("critical"),summary:R("summary"),milestone:R("milestone"),progress:R("progress"),today:R("today"),workload:x("--lattice-scheduler-workload"),histogram:x("--lattice-scheduler-workload"),over:x("--lattice-scheduler-overalloc"),pageBg:x("--lattice-background")}}function S(P,j){return g(P,j,"--lattice-font-family")}function _(P,j){return{sm:g(P,j,"--lattice-font-size-sm"),body:g(P,j,"--lattice-font-size")}}const C=Object.freeze({text:"#1f2933",muted:"#57606a",border:"#d0d7de",surface:"#f1f3f5",bar:"#4a90d9",critical:"#e2513b",summary:"#2c3e50",milestone:"#33404d",progress:"rgba(0,0,0,0.28)",today:"#e2513b",workload:"#4a90d9",histogram:"#2c7a7b",over:"#e2513b",pageBg:"#ffffff"});function a(P){return String(P??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function o(P,j){const x=L[P]||L.A4;return j==="portrait"?{w:x.w,h:x.h}:{w:x.h,h:x.w}}function m(P,j){const x=j&&j.from!=null?W(j.from):P.domainMin,R=j&&j.to!=null?W(j.to):P.domainMax;return Number.isFinite(x)&&Number.isFinite(R)&&R>x?{from:x,to:R}:{from:P.domainMin,to:P.domainMax}}function $(P,j,x){if(j.unscheduled&&(P.kind==="start"||P.kind==="end"||P.kind==="duration"))return"";switch(P.kind){case"name":return j.name??"";case"start":return Y(j.es)??String(j.es);case"end":return Y(j.ef)??String(j.ef);case"duration":return String(Math.round(j.ef-j.es));case"assignee":{const R=x?x.assignee??x.assignees??x.owner:null;return(Array.isArray(R)?R:R==null?[]:[R]).map(String).filter(Boolean).join(", ")}case"progress":return j.percentComplete==null?"":`${Math.round(j.percentComplete)}%`;default:return x&&P.key?String(x[P.key]??""):""}}function h(P,j,x,R,N){if(!Number.isFinite(P.es)||!Number.isFinite(P.ef))return"";const X=Math.max(2,Math.round(R*.18)),G=x+X,J=Math.max(2,R-X*2);if(P.milestone){const wt=j(P.es),Jt=x+R/2,lt=Math.max(4,Math.min(9,R*.3)),nt=P.critical?N.critical:N.milestone;return`<path d="M ${wt} ${Jt-lt} L ${wt+lt} ${Jt} L ${wt} ${Jt+lt} L ${wt-lt} ${Jt} Z" fill="${nt}"/>`}const Q=j(P.es),pt=j(P.ef),st=Math.max(1,pt-Q),ht=P.isSummary?N.summary:P.critical?N.critical:N.bar;let Ot=`<rect x="${Q}" y="${G}" width="${st}" height="${J}" rx="3" fill="${ht}"/>`;if(!P.isSummary&&P.percentComplete!=null&&P.percentComplete>0){const wt=Math.max(0,Math.min(100,P.percentComplete)),Jt=Math.round(st*wt/100);Ot+=`<rect x="${Q}" y="${G}" width="${Jt}" height="${J}" fill="${N.progress}"/>`}return Ot}function y(P,j,x,R,N,X,G=C,J="11"){const Q=X==="month"||X==="quarter"?30:7;let pt=`<rect x="0" y="0" width="${R}" height="${N}" fill="${G.surface}"/>`,st=Math.floor(P/Q)*Q;for(;st<j;st+=Q){const ht=x(st);pt+=`<line x1="${ht}" y1="0" x2="${ht}" y2="${N}" stroke="${G.border}"/>`,pt+=`<text x="${ht+4}" y="${Math.round(N*.68)}" font-size="${J}" font-weight="600" fill="${G.muted}">${a(Y(st)??String(st))}</text>`}return pt+=`<line x1="0" y1="${N}" x2="${R}" y2="${N}" stroke="${G.border}"/>`,pt}function i(P,j,x,R,N,X,G,J,Q){const pt=Math.max(1,...P.flatMap(ht=>(ht.cells||[]).filter(Ot=>Ot!=null)));let st="";return(j.cells||[]).forEach((ht,Ot)=>{if(ht==null)return;const wt=J[Ot];if(!wt)return;const Jt=R+x(wt.start),lt=Math.max(1,x(wt.end)-x(wt.start)-2),nt=Math.max(1,Math.round(ht/pt*(N-8))),ot=X+N-4-nt,vt=j.over&&j.over[Ot];st+=`<rect x="${Jt}" y="${ot}" width="${lt}" height="${nt}" fill="${vt?Q:G}"/>`}),st}function r(P,j,x,R,N,X,G,J){if(!P||!P.rows||!P.rows.length)return"";let Q="";return P.rows.forEach((pt,st)=>{const ht=N+st*R;Q+=`<text x="4" y="${ht+R/2+4}" font-size="${J}" fill="${G.text}">${a(pt.label)}</text>`,Q+=`<line x1="0" y1="${ht+R}" x2="${x}" y2="${ht+R}" stroke="${G.border}"/>`,Q+=i(P.rows,pt,j,x,R,ht,X,P.buckets,G.over)}),Q}function f(P,j,x,R,N,X,G){const J=P&&P.grid;if(!J||!J.rows||!J.rows.length)return"";const Q=J.columns,pt=J.columnWidths,st=pt.reduce((wt,Jt)=>wt+Jt,0);let ht="",Ot=0;for(let wt=0;wt<Q.length;wt++)ht+=`<text x="${Ot+6}" y="${R+Math.round(x*.65)}" font-size="${G}" font-weight="600" fill="${X.muted}">${a(Q[wt].title||Q[wt].id)}</text>`,Ot+=pt[wt];return ht+=`<line x1="0" y1="${R+x}" x2="${st}" y2="${R+x}" stroke="${X.border}"/>`,J.rows.forEach((wt,Jt)=>{const lt=R+x+Jt*x;let nt=0;for(let ot=0;ot<Q.length;ot++){const vt=ot===0&&wt.taskId!=null?14:6;ht+=`<text x="${nt+vt}" y="${lt+x/2+4}" font-size="${G}" fill="${X.text}">${a(wt.texts?wt.texts[ot]:"")}</text>`,nt+=pt[ot]}ht+=`<line x1="0" y1="${lt+x}" x2="${st}" y2="${lt+x}" stroke="${X.border}"/>`,ht+=i(J.rows,wt,j,st,x,lt,N,P.buckets,X.over)}),ht}function M(P,j,x,R,N,X,G){const J=P.rowHeight;let Q=`<text x="6" y="${R+Math.round(J*.65)}" font-size="${G}" font-weight="600" fill="${X.muted}">${a(P.title)}</text>`;if(Q+=`<line x1="0" y1="${R+J}" x2="${x+N}" y2="${R+J}" stroke="${X.border}"/>`,P.collapsed)return Q;const pt=P.totalsColumn?x-6:null;return P.rows.forEach((st,ht)=>{const Ot=R+J+ht*J,wt=Ot+J/2+4,Jt=st.isTotal||st.isSummary?600:400;Q+=`<text x="${6+(st.depth||0)*14}" y="${wt}" font-size="${G}" font-weight="${Jt}" fill="${X.text}">${a(st.label)}</text>`,pt!=null&&st.totalText&&(Q+=`<text x="${pt}" y="${wt}" font-size="${G}" font-weight="${Jt}" text-anchor="end" fill="${X.text}">${a(st.totalText)}</text>`),(st.texts||[]).forEach((lt,nt)=>{const ot=P.buckets[nt];if(!ot||!lt)return;const vt=j(ot.end);vt<=0||j(ot.start)>=N||(Q+=`<text x="${x+Math.min(N,vt)-4}" y="${wt}" font-size="${G}" font-weight="${Jt}" text-anchor="end" fill="${X.text}">${a(lt)}</text>`)}),Q+=`<line x1="0" y1="${Ot+J}" x2="${x+N}" y2="${Ot+J}" stroke="${X.border}"/>`}),Q}function D(P,j={}){const x=d(j.view,j.el),R=S(j.view,j.el),N=_(j.view,j.el),X=m(P,j.range),G=Math.max(1,Math.round(P.pxPerDay*(X.to-X.from))),J=U({min:X.from,max:X.to},[0,G]),Q=gt=>Math.round(J.of(gt)),pt=P.columnWidths.reduce((gt,Ht)=>gt+Ht,0),st=pt+G,ht=Math.max(k,u),Ot=ht;let wt=0;P.workload&&(wt+=P.workload.cfg.height),P.histogram&&(wt+=P.histogram.cfg.height);const Jt=Array.isArray(P.dataBands)?P.dataBands:[];for(const gt of Jt)wt+=gt.collapsed?gt.rowHeight:(gt.rows.length+1)*gt.rowHeight;const lt=Ot+P.totalHeight+wt;let nt="",ot=0;for(let gt=0;gt<P.columns.length;gt++){const Ht=P.columnWidths[gt];nt+=`<text x="${ot+6}" y="${Math.round(ht*.65)}" font-size="${N.sm}" font-weight="600" fill="${x.muted}">${a(P.columns[gt].title||P.columns[gt].id||P.columns[gt].key)}</text>`,ot+=Ht}if(nt+=`<line x1="0" y1="${ht}" x2="${pt}" y2="${ht}" stroke="${x.border}"/>`,nt+=`<g transform="translate(${pt},0)">${y(X.from,X.to,Q,G,ht,P.zoomLevel,x,N.sm)}</g>`,P.rows.forEach((gt,Ht)=>{const Pt=Ot+gt.top;let et=0;for(let ft=0;ft<P.columns.length;ft++){const q=P.columns[ft],jt=P.columnWidths[ft],Et=P.cellTexts?P.cellTexts[Ht][ft]:$(q,gt.rec,P.rawById.get(String(gt.id))),mt=q.kind==="name"?gt.depth*14+6:6;nt+=`<text x="${et+mt}" y="${Pt+gt.height/2+4}" font-size="${N.body}" font-weight="${gt.rec.isSummary?600:400}" fill="${gt.rec.isSummary?x.summary:x.text}">${a(Et)}</text>`,et+=jt}nt+=`<line x1="0" y1="${Pt+gt.height}" x2="${st}" y2="${Pt+gt.height}" stroke="${x.border}"/>`,nt+=`<g transform="translate(${pt},${Pt})">${h(gt.rec,Q,0,gt.height,x)}</g>`}),P.today!=null&&P.today>=X.from&&P.today<=X.to){const gt=pt+Q(P.today);nt+=`<line x1="${gt}" y1="0" x2="${gt}" y2="${Ot+P.totalHeight}" stroke="${x.today}" stroke-width="1.5" stroke-dasharray="4 3"/>`}let vt=Ot+P.totalHeight;for(const[gt,Ht]of[[P.workload,x.workload],[P.histogram,x.histogram]])if(gt){if(nt+=`<rect x="0" y="${vt}" width="${st}" height="${gt.cfg.height}" fill="${x.pageBg}"/>`,gt.data&>.data.grid)nt+=f(gt.data,Q,gt.cfg.rowHeight,vt,Ht,x,N.sm);else{const Pt=Math.max(40,pt);nt+=`<g transform="translate(${Pt},0)">${r(gt.data,Q,0,gt.cfg.rowHeight,vt,Ht,x,N.sm)}</g>`}nt+=`<line x1="0" y1="${vt}" x2="${st}" y2="${vt}" stroke="${x.border}" stroke-width="2"/>`,vt+=gt.cfg.height}for(const gt of Jt){const Ht=gt.collapsed?gt.rowHeight:(gt.rows.length+1)*gt.rowHeight;nt+=`<g data-band="${a(gt.id)}">${M(gt,Q,pt,vt,G,x,N.sm)}</g>`,nt+=`<line x1="0" y1="${vt}" x2="${st}" y2="${vt}" stroke="${x.border}" stroke-width="2"/>`,vt+=Ht}return`<svg xmlns="http://www.w3.org/2000/svg" width="${st}" height="${lt}" viewBox="0 0 ${st} ${lt}" font-family="${R}"><rect x="0" y="0" width="${st}" height="${lt}" fill="${x.pageBg}"/>${nt}</svg>`}function I(P,j,x){const R=["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linejoin","stroke-linecap","font-size","font-family","font-weight","opacity","text-anchor","dominant-baseline","visibility"],N=[P,...P.querySelectorAll("*")],X=[j,...j.querySelectorAll("*")];for(let G=0;G<N.length&&G<X.length;G++){const J=x.getComputedStyle(N[G]),Q=[];for(const pt of R){const st=J.getPropertyValue(pt);st&&Q.push(`${pt}:${st}`)}Q.length&&X[G].setAttribute("style",Q.join(";"))}}async function O(P,j,x,R,N,X){const G=P&&P.defaultView||globalThis;if(!G.Image||!P.createElement)return null;const J=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(j)}`,Q=new G.Image;await new Promise((ht,Ot)=>{Q.onload=ht,Q.onerror=()=>Ot(new Error("the plan could not be rasterised")),Q.src=J});const pt=P.createElement("canvas");pt.width=Math.max(1,Math.round(x*N)),pt.height=Math.max(1,Math.round(R*N));const st=pt.getContext("2d");return X&&(st.fillStyle=X,st.fillRect(0,0,pt.width,pt.height)),st.drawImage(Q,0,0,pt.width,pt.height),new Promise(ht=>pt.toBlob(ht,"image/png"))}function B(P,j){const x=[];let R=[],N=0;for(const X of P){const G=Math.max(1,X.height);R.length&&N+G>j&&(x.push(R),R=[],N=0),R.push(X),N+=G}return(R.length||!x.length)&&x.push(R),x}function H(P,j,x,R){return`
|
|
16
|
+
@page { size: ${P.w}px ${P.h}px; margin: 0; }
|
|
17
17
|
*{box-sizing:border-box}
|
|
18
|
-
body{margin:0;font:${R.body}/1.4 ${x};color:${
|
|
19
|
-
.${l}__page{width:${
|
|
18
|
+
body{margin:0;font:${R.body}/1.4 ${x};color:${j.text};background:${j.pageBg}}
|
|
19
|
+
.${l}__page{width:${P.w}px;height:${P.h}px;padding:${v}px;break-after:page;page-break-after:always;overflow:hidden;position:relative}
|
|
20
20
|
.${l}__page:last-child{break-after:auto;page-break-after:auto}
|
|
21
21
|
.${l}__title{font-size:${R.body};font-weight:600;margin:0 0 6px 0}
|
|
22
|
-
.${l}__foot{position:absolute;left:${v}px;right:${v}px;bottom:${v-w}px;height:${w}px;font-size:${R.sm};color:${
|
|
22
|
+
.${l}__foot{position:absolute;left:${v}px;right:${v}px;bottom:${v-w}px;height:${w}px;font-size:${R.sm};color:${j.muted};display:flex;justify-content:space-between}
|
|
23
23
|
table.${l}__table{border-collapse:collapse;width:100%}
|
|
24
|
-
.${l}__table th,.${l}__table td{border-bottom:1px solid ${
|
|
25
|
-
.${l}__table thead th{background:${
|
|
24
|
+
.${l}__table th,.${l}__table td{border-bottom:1px solid ${j.border};padding:2px 6px;text-align:left;font-weight:400;vertical-align:middle}
|
|
25
|
+
.${l}__table thead th{background:${j.surface};color:${j.muted};font-weight:600;font-size:${R.sm}}
|
|
26
26
|
.${l}__table tr{break-inside:avoid;page-break-inside:avoid}
|
|
27
27
|
.${l}__bandtitle{font-size:${R.body};font-weight:600;margin:10px 0 4px 0}
|
|
28
28
|
svg{display:block}
|
|
29
|
-
`.trim()}function
|
|
30
|
-
`)}function d(a,o,
|
|
29
|
+
`.trim()}function z(P,j,x,R,N,X,G,J){const Q=P?`<p class="${l}__title">${a(P)}</p>`:"",pt=y(R.from,R.to,x,X,u,j.zoomLevel,G,J),st=j.columns.map((ht,Ot)=>`<th style="width:${j.columnWidths[Ot]}px">${a(ht.title||ht.id||ht.key)}</th>`).join("");return`${Q}<table class="${l}__table"><thead><tr>${st}<th style="width:${X}px;padding:0"><svg width="${X}" height="${u}" viewBox="0 0 ${X} ${u}">${pt}</svg></th></tr></thead><tbody>`}function at(P,j,x,R,N){const X=P.columns.map((J,Q)=>{const pt=P.cellTexts?P.cellTexts[j.rowIndex][Q]:$(J,j.rec,P.rawById.get(String(j.id)));return`<td style="padding-left:${6+(J.kind==="name"?j.depth*14:0)}px;font-weight:${j.rec.isSummary?600:400}">${a(pt)}</td>`}).join(""),G=h(j.rec,x,0,j.height,N);return`<tr style="height:${j.height}px">${X}<td style="padding:0;width:${R}px"><svg width="${R}" height="${j.height}" viewBox="0 0 ${R} ${j.height}">${G}</svg></td></tr>`}function dt(P,j,x,R){return P===!1?null:typeof P=="function"?String(P(j,x)):typeof P=="string"?P:R}function kt(P,j={}){const x=d(j.view,j.el),R=S(j.view,j.el),N=_(j.view,j.el),X=o(j.paper||"A4",j.orientation||"landscape"),G=X.w-v*2,J=X.h-v*2,Q=Math.min(G-80,P.columnWidths.reduce((Rt,Xt)=>Rt+Xt,0)),pt=Math.max(40,G-Q),st=Math.max(1,P.domainMax-P.domainMin),ht=j.fitToWidth!==!1?pt/st:j.scale||P.pxPerDay,Ot=U({min:P.domainMin,max:P.domainMax},[0,ht*st]),wt=Rt=>Math.round(Ot.of(Rt)),Jt=j.fitToWidth!==!1?pt:Math.round(ht*st),lt=typeof j.t=="function"?j.t:(Rt=>Rt),nt=j.title===!1?null:j.title||P.title||null,ot=j.locale||"en-GB",vt=j.printDate instanceof Date?j.printDate:new Date;let gt="";try{gt=new Intl.DateTimeFormat(ot).format(vt)}catch{gt=vt.toISOString().slice(0,10)}const Ht=u,Pt=nt?b:0,et=j.footer!==!1,ft=et?w:0,q=Math.max(P.rowHeight||24,J-Pt-Ht-ft-8),jt=P.rowHeight||24,Et=B(P.rows.map((Rt,Xt)=>({...Rt,height:Math.max(jt,Rt.height),rowIndex:Xt})),q),mt=[];for(const[Rt,Xt,Vt]of[[P.workload,x.workload,"gantt.workload.title"],[P.histogram,x.histogram,"gantt.histogram.title"]]){if(!Rt||!Rt.data)continue;const $t=Rt.data.grid?Rt.data.grid.rows:Rt.data.rows;if(!$t.length)continue;const Bt=$t.map(we=>({...we,height:Rt.cfg.rowHeight})),pe=B(Bt,q);mt.push({title:lt(Vt),rows:pe,color:Xt,band:Rt,grid:!!Rt.data.grid})}const yt=[];for(const Rt of Array.isArray(P.dataBands)?P.dataBands:[]){if(!Rt.rows.length)continue;const Xt=Rt.rows.map(Vt=>({...Vt,height:Rt.rowHeight}));yt.push({band:Rt,rows:B(Xt,q)})}const tt=Et.length+mt.reduce((Rt,Xt)=>Rt+Xt.rows.length,0)+yt.reduce((Rt,Xt)=>Rt+Xt.rows.length,0);let Mt=0,It="";for(const Rt of Et)Mt+=1,It+=Tt({title:nt,header:z(nt,P,wt,{from:P.domainMin,to:P.domainMax},Q,Jt,x,N.sm),body:Rt.map(Xt=>at(P,Xt,wt,Jt,x)).join(""),pageIndex:Mt,totalPages:tt,opts:j,t:lt,locale:ot,dateText:gt,footerOn:et});for(const Rt of mt)for(const Xt of Rt.rows){if(Mt+=1,Rt.grid){const we=Rt.band.data.grid,Yt=we.columns,re=we.columnWidths,Lt=re.reduce((Ct,Dt)=>Ct+Dt,0),ne=Math.max(40,G-Lt),Zt=Ct=>Math.round((Ct-P.domainMin)/st*ne),ct=Yt.map((Ct,Dt)=>`<th style="width:${re[Dt]}px">${a(Ct.title||Ct.id)}</th>`).join(""),bt=Xt.map(Ct=>{const Dt=Yt.map((Ut,oe)=>`<td style="padding-left:${6+(oe===0&&Ct.taskId!=null?14:0)}px">${a(Ct.texts?Ct.texts[oe]:"")}</td>`).join(""),zt=i(Xt,Ct,Zt,0,Ct.height,0,Rt.color,Rt.band.data.buckets,x.over);return`<tr style="height:${Ct.height}px">${Dt}<td style="padding:0;width:${ne}px"><svg width="${ne}" height="${Ct.height}" viewBox="0 0 ${ne} ${Ct.height}">${zt}</svg></td></tr>`}).join("");It+=Tt({title:nt?`${nt} — ${Rt.title}`:Rt.title,header:`<p class="${l}__title">${a(nt?`${nt} — ${Rt.title}`:Rt.title)}</p><table class="${l}__table"><thead><tr>${ct}<th style="width:${ne}px"></th></tr></thead><tbody>`,body:bt,pageIndex:Mt,totalPages:tt,opts:j,t:lt,locale:ot,dateText:gt,footerOn:et});continue}const Vt=140,$t=G-Vt,Bt=we=>Math.round((we-P.domainMin)/st*$t),pe=Xt.map(we=>{const Yt=r({rows:[we],buckets:Rt.band.data.buckets},Bt,0,we.height,0,Rt.color,x,N.sm);return`<tr style="height:${we.height}px"><td style="width:${Vt}px"></td><td style="padding:0;width:${$t}px"><svg width="${$t}" height="${we.height}" viewBox="0 0 ${$t} ${we.height}">${Yt}</svg></td></tr>`}).join("");It+=Tt({title:nt?`${nt} — ${Rt.title}`:Rt.title,header:`<p class="${l}__title">${a(nt?`${nt} — ${Rt.title}`:Rt.title)}</p><table class="${l}__table"><thead><tr><th style="width:${Vt}px"></th><th style="width:${$t}px"></th></tr></thead><tbody>`,body:pe,pageIndex:Mt,totalPages:tt,opts:j,t:lt,locale:ot,dateText:gt,footerOn:et})}for(const Rt of yt){const Xt=Rt.band,Vt=Xt.buckets.map((pe,we)=>({b:pe,i:we})).filter(({b:pe})=>pe.end>P.domainMin&&pe.start<P.domainMax),$t=nt?`${nt} — ${Xt.title}`:Xt.title,Bt=`<th></th>${Xt.totalsColumn?"<th></th>":""}${Vt.map(({b:pe})=>`<th>${a(Y(pe.start))}</th>`).join("")}`;for(const pe of Rt.rows){Mt+=1;const we=pe.map(Yt=>{const re=Yt.isTotal||Yt.isSummary?"font-weight:600;":"";return`<tr style="height:${Yt.height}px;${re}"><td style="padding-left:${6+(Yt.depth||0)*14}px">${a(Yt.label)}</td>${Xt.totalsColumn?`<td style="text-align:right">${a(Yt.totalText)}</td>`:""}${Vt.map(({i:Lt})=>`<td style="text-align:right">${a(Yt.texts[Lt]||"")}</td>`).join("")}</tr>`}).join("");It+=Tt({title:$t,header:`<p class="${l}__title">${a($t)}</p><table class="${l}__table" data-band="${a(Xt.id)}"><thead><tr>${Bt}</tr></thead><tbody>`,body:we,pageIndex:Mt,totalPages:tt,opts:j,t:lt,locale:ot,dateText:gt,footerOn:et})}}return`<!DOCTYPE html><html><head><meta charset="utf-8"><title>${a(nt||"Gantt")}</title><style>${H(X,x,R,N)}</style></head><body>${It}</body></html>`}function Tt(P){const j=P.footerOn?dt(P.opts.footer,P.pageIndex,P.totalPages,`${P.t("gantt.print.page",{page:P.pageIndex,pages:P.totalPages})} · ${P.t("gantt.print.printed",{date:P.dateText})}`):null,x=P.opts.header===!1?null:typeof P.opts.header=="function"||typeof P.opts.header=="string"?dt(P.opts.header,P.pageIndex,P.totalPages,null):null,R=x?`<p class="${l}__title">${a(x)}</p>`:"";return`<div class="${l}__page">${R}${P.header}${P.body}</tbody></table>`+(j?`<div class="${l}__foot"><span>${a(j)}</span></div>`:"")+"</div>"}function Ft(P,j){const x=P&&P.defaultView||globalThis;if(typeof x.open!="function")return!1;const R=x.open("","_blank");if(!R||!R.document)return!1;R.document.open(),R.document.write(j),R.document.close();const N=()=>{try{R.focus(),R.print()}catch{}};return R.document.readyState==="complete"?N():R.addEventListener("load",N,{once:!0}),!0}}),ae("packages/modules/gantt/tooltip.js",function(p,V){"use strict";Object.defineProperty(p,"taskTooltipRows",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"taskTooltipText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"buildTooltipCard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"resolveTaskTooltip",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"positionTooltip",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"tooltipCss",{enumerable:!0,get:function(){return C}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=St.round,l=V("packages/modules/gantt/assignments.js").parseAssignments,v=V("packages/modules/gantt/workload.js").formatCost,b=["start","end","duration","percentComplete","effort","resources","cost","slack","deadline"],w=new Set(["start","end","duration","slack"]);function k(a,o,m,$){const{t:h,formatDate:y}=$;switch(a){case"start":return{label:h("gantt.tip.start"),value:y(o.es)};case"end":return{label:h("gantt.tip.end"),value:y(o.ef)};case"duration":return{label:h("gantt.tip.durationLabel"),value:h("gantt.tip.durationValue",{days:Y(o.duration)})};case"percentComplete":return o.percentComplete==null?null:{label:h("gantt.tip.complete"),value:`${Math.round(o.percentComplete)}%`};case"effort":return o.effort==null?null:{label:h("gantt.tip.effortLabel"),value:h("gantt.tip.effortValue",{hours:Y(o.effort)})};case"resources":{const i=l(m).map(r=>r.resource);return i.length?{label:h("gantt.tip.assigned"),value:i.map(r=>$.resourceName(r)).join(", ")}:null}case"cost":{const i=m&&m.cost!=null?Number(m.cost):NaN;return Number.isFinite(i)?{label:h("gantt.tip.cost"),value:v(i)}:null}case"slack":return Number.isFinite(o.totalFloat)?{label:h("gantt.tip.slackLabel"),value:h("gantt.tip.slackValue",{days:Y(o.totalFloat)})}:null;case"deadline":return Number.isFinite(o.deadline)?{label:h("gantt.tip.deadline"),value:y(o.deadline)}:null;default:return null}}function u(a,o,m,$){if(a.isMilestone&&!a.unscheduled)return[{label:$.t("gantt.tip.date"),value:$.formatDate(a.es)}];let h=Array.isArray(m)&&m.length?m:b;a.unscheduled&&(h=h.filter(i=>!w.has(i)));const y=[];for(const i of h){const r=k(i,a,o,$);r&&y.push(r)}return y}function g(a,o,m){return[a.name,...o.map($=>m("gantt.tip.row",{label:$.label,value:$.value}))].join(`
|
|
30
|
+
`)}function d(a,o,m,$){const h=U(a,"div",`${o}__tip-card`),y=U(a,"div",`${o}__tip-title`);K(y,m.name),h.appendChild(y);for(const i of $){const r=U(a,"div",`${o}__tip-row`),f=U(a,"span",`${o}__tip-label`);K(f,i.label);const M=U(a,"span",`${o}__tip-value`);K(M,i.value),r.appendChild(f),r.appendChild(M),h.appendChild(r)}return h}function S(a,o,m,$,h,y){if(typeof h=="function"){const f=h(m,{...y,rawTask:$});if(f==null||f==="")return null;if(typeof f=="string")return{node:null,text:f};const M=f.textContent||"",D=U(a,"div",`${o}__tip-card`);return D.appendChild(f),{node:D,text:M}}const i=h&&typeof h=="object"&&Array.isArray(h.fields)?h.fields:null,r=u(m,$,i,y);return{node:d(a,o,m,r),text:g(m,r,y.t)}}function _(a,o,m,$,h,y={}){const i=Number.isFinite(y.gap)?y.gap:8,r=a.offsetWidth||0,f=a.offsetHeight||0,M=m.left+m.width/2,D=m.top+m.height/2;let I="top",O=M-r/2,B=m.top-f-i;if(B<$.top&&(I="bottom",B=m.bottom+i),I==="bottom"&&B+f>$.bottom&&(B=D-f/2,I=m.right+i+r<=$.right?"right":"left",O=I==="right"?m.right+i:m.left-r-i),O=Math.min(Math.max(O,$.left),Math.max($.left,$.right-r)),B=Math.min(Math.max(B,$.top),Math.max($.top,$.bottom-f)),a.setAttribute("data-placement",I),a.style.left=`${Y(O-h.left)}px`,a.style.top=`${Y(B-h.top)}px`,!o)return;const H=(o.offsetWidth||0)/2,z=(o.offsetHeight||0)/2;if(I==="top"||I==="bottom"){const at=Math.min(Math.max(M-O-H,10-H),Math.max(10-H,r-10-H));o.style.left=`${Y(at)}px`,o.style.top=""}else{const at=Math.min(Math.max(D-B-z,10-z),Math.max(10-z,f-10-z));o.style.top=`${Y(at)}px`,o.style.left=""}}function C(a){return`
|
|
31
31
|
.${a}__tip-card{position:relative;max-width:280px;padding:6px 10px;border-radius:var(--lattice-radius);font-size:var(--lattice-font-size-sm);line-height:1.5;
|
|
32
32
|
background:var(--lattice-surface);color:var(--lattice-foreground);
|
|
33
33
|
border:1px solid var(--lattice-border-color);
|
|
@@ -42,70 +42,70 @@ svg{display:block}
|
|
|
42
42
|
.${a}__tooltip[data-placement="bottom"] .${a}__tip-arrow{top:-5px;border-bottom:none;border-right:none}
|
|
43
43
|
.${a}__tooltip[data-placement="right"] .${a}__tip-arrow{left:-5px;border-top:none;border-right:none}
|
|
44
44
|
.${a}__tooltip[data-placement="left"] .${a}__tip-arrow{right:-5px;border-bottom:none;border-left:none}
|
|
45
|
-
`.trim()}}),ae("packages/modules/gantt/markers.js",function(
|
|
45
|
+
`.trim()}}),ae("packages/modules/gantt/markers.js",function(p,V){"use strict";Object.defineProperty(p,"normalizeMarkers",{enumerable:!0,get:function(){return l}});const U=V("packages/core/src/internal/warn.js").warnOnce,Y=V("packages/modules/gantt/time.js").toDayNumber;function W(L,v){if(L==null||L==="")return null;if(typeof L=="number")return Number.isFinite(L)?L:null;const b=Y(L);return Number.isFinite(b)?b-v:null}function l(L,v=0){if(!Array.isArray(L))return[];const b=[];for(let w=0;w<L.length;w+=1){const k=L[w],u=k&&typeof k=="object"&&typeof k.label=="string"&&k.label!==""?k.label:null,g=k&&typeof k=="object"&&typeof k.colour=="string"&&k.colour!==""?k.colour:null,d=!!(k&&typeof k=="object"&&k.dashed);if(k&&typeof k=="object"&&(k.from!=null||k.to!=null)){const _=W(k.from,v),C=W(k.to,v);if(_==null||C==null){U(`gantt.marker.${w}`,`[lattice] gantt: marker ${w} has no drawable date or from/to range; it is skipped.`);continue}b.push({index:w,label:u,colour:g,dashed:d,date:null,from:_,to:C})}else{const _=k&&typeof k=="object"?W(k.date,v):null;if(_==null){U(`gantt.marker.${w}`,`[lattice] gantt: marker ${w} has no drawable date or from/to range; it is skipped.`);continue}b.push({index:w,label:u,colour:g,dashed:d,date:_,from:null,to:null})}}return b}}),ae("packages/modules/gantt/draw-event.js",function(p,V){"use strict";Object.defineProperty(p,"createDrawEventScheduler",{enumerable:!0,get:function(){return St}});function St(U){let K=!1,Y=null;const W=()=>{K=!1;const l=Y;Y=null,l&&U(l)};return l=>{Y=l,!K&&(K=!0,Promise.resolve().then(W))}}}),ae("packages/modules/gantt/events-link.js",function(p,V){"use strict";Object.defineProperty(p,"linkContext",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"LinkPointerEvents",{enumerable:!0,get:function(){return W}});const St=V("packages/modules/gantt/events-pointer.js"),U=St.emitGesture,K=St.gateGesture;function Y(l,L,v,b){const w=l&&Array.isArray(l.dependencies)?l.dependencies:[],k=String(b||"FS").toUpperCase(),u=w.find(d=>String(d.from)===String(L)&&String(d.to)===String(v)&&String(d.type||"FS").toUpperCase()===k),g=u&&Number.isFinite(Number(u.lag))?Number(u.lag):0;return{from:String(L),to:String(v),type:k,lag:g}}class W{#t;#i=[];#e=null;constructor(L){this.#t=L}attach(L){if(!L||!L.addEventListener)return;const g=[["click",d=>this.#o(d)],["dblclick",d=>this.#l(d)],["contextmenu",d=>this.#h(d)],["pointerover",d=>this.#f(d)],["pointerout",d=>this.#p(d)]];for(const[d,S]of g)L.addEventListener(d,S),this.#i.push([L,d,S])}#n(L){const v=this.#t.linkOf?this.#t.linkOf(L):null;if(!v)return null;const b=v.getAttribute("data-from"),w=v.getAttribute("data-to");if(b==null||w==null)return null;const k=v.getAttribute("data-type")||"FS",u=Y(this.#t.controller,b,w,k);return{key:`${u.from}|${u.to}|${u.type}`,...u}}#s(L,v){return{from:L.from,to:L.to,linkType:L.type,lag:L.lag,view:this.#t.view(),event:v}}#o(L){const v=this.#n(L.target);v&&U(this.#t.controller,"linkClick",this.#s(v,L))}#l(L){const v=this.#n(L.target);v&&this.gateDblClick(v.from,v.to,v.type,L)}gateDblClick(L,v,b,w){const k=Y(this.#t.controller,L,v,b),u=K(this.#t.controller,"linkDblClick",null,this.#s(k,w));return!u&&w&&w.preventDefault&&w.preventDefault(),u}#h(L){const v=this.#n(L.target);if(!v)return;!K(this.#t.controller,"linkContextMenu",null,this.#s(v,L))&&L.preventDefault&&L.preventDefault()}#f(L){const v=this.#n(L.target);!v||this.#e===v.key||(this.#e=v.key,U(this.#t.controller,"linkHover",this.#s(v,L)))}#p(L){if(!this.#e)return;const v=L.relatedTarget?this.#n(L.relatedTarget):null;v&&v.key===this.#e||(this.#e=null)}destroy(){for(const[L,v,b]of this.#i)L.removeEventListener(v,b);this.#i=[],this.#e=null}}}),ae("packages/modules/gantt/resize-handle.js",function(p,V){"use strict";Object.defineProperty(p,"drawResizeHandle",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"resizeHandleCss",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"setBaseDescription",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"restoreDescription",{enumerable:!0,get:function(){return k}});const St=V("packages/modules/charts/svg.js"),U=St.svg,K=St.round,Y=V("packages/modules/gantt/events-pointer.js"),W=Y.HANDLE_TARGET,l=Y.TOUCH_TARGET,L=2;function v(u,g){const d=g.barY+g.barH,S=d-W/2,_=U(u,"g",{class:`${g.ns}__resizehandle`,"data-task":g.id,"data-edge":"start","aria-hidden":"true"}),C=U(u,"rect",{class:`${g.ns}__resizehandle-hit`,x:K(g.x0+L),y:K(S),width:W,height:W,fill:"transparent"}),a=U(u,"title",{});return a.textContent=g.title,C.appendChild(a),_.appendChild(C),_.appendChild(U(u,"rect",{class:`${g.ns}__resizehandle-grip`,x:K(g.x0-1.5),y:K(d-W/2+2),width:3,height:K(W-4),rx:1.5})),_}function b(u,g="barrow"){return`.${u}__resizehandle{opacity:0;transition:opacity .1s}
|
|
46
46
|
.${u}__resizehandle-hit{cursor:ew-resize}
|
|
47
|
-
.${u}__${
|
|
47
|
+
.${u}__${g}:hover .${u}__resizehandle,.${u}__${g}:focus .${u}__resizehandle{opacity:1}
|
|
48
48
|
.${u}__resizehandle-grip{pointer-events:none;fill:var(--lattice-background);stroke:var(--lattice-foreground);stroke-width:1}
|
|
49
|
-
.${u}__${
|
|
50
|
-
.${u}__${
|
|
49
|
+
.${u}__${g}--readonly .${u}__resizehandle-hit{cursor:default}
|
|
50
|
+
.${u}__${g}--readonly .${u}__resizehandle-grip{fill:var(--lattice-foreground-muted);stroke:var(--lattice-foreground-muted)}
|
|
51
51
|
@media (pointer: coarse) {
|
|
52
|
-
.${u}__resizehandle-hit{transform-box:fill-box;transform-origin:center;transform:scale(${l/
|
|
53
|
-
}`}function w(u,
|
|
54
|
-
.${
|
|
55
|
-
.${
|
|
56
|
-
.${
|
|
57
|
-
.${
|
|
58
|
-
.${
|
|
59
|
-
.${
|
|
60
|
-
.${
|
|
61
|
-
.${
|
|
62
|
-
.${
|
|
63
|
-
.${
|
|
64
|
-
.${
|
|
65
|
-
.${
|
|
66
|
-
.${
|
|
67
|
-
.${
|
|
68
|
-
.${
|
|
69
|
-
.${
|
|
70
|
-
.${
|
|
71
|
-
.${
|
|
72
|
-
.${
|
|
73
|
-
.${
|
|
74
|
-
.${
|
|
75
|
-
.${
|
|
76
|
-
.${
|
|
77
|
-
.${
|
|
78
|
-
.${
|
|
79
|
-
.${
|
|
80
|
-
.${
|
|
81
|
-
.${
|
|
82
|
-
.${
|
|
83
|
-
.${
|
|
84
|
-
.${
|
|
85
|
-
.${
|
|
86
|
-
.${
|
|
87
|
-
.${
|
|
88
|
-
.${
|
|
89
|
-
.${
|
|
90
|
-
.${
|
|
91
|
-
.${
|
|
92
|
-
.${
|
|
93
|
-
.${
|
|
94
|
-
.${
|
|
95
|
-
.${
|
|
96
|
-
.${
|
|
97
|
-
.${
|
|
98
|
-
.${
|
|
99
|
-
${st(
|
|
100
|
-
${vt(
|
|
101
|
-
${Et(
|
|
102
|
-
.${
|
|
103
|
-
.${
|
|
52
|
+
.${u}__resizehandle-hit{transform-box:fill-box;transform-origin:center;transform:scale(${l/W})}
|
|
53
|
+
}`}function w(u,g){g&&(u.setAttribute("aria-description",g),u.setAttribute("data-base-description",g))}function k(u){const g=u.getAttribute("data-base-description");g?u.setAttribute("aria-description",g):u.removeAttribute("aria-description")}}),ae("packages/modules/gantt/render.js",function(p,V){"use strict";Object.defineProperty(p,"NS",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(p,"GanttView",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(p,"mountGantt",{enumerable:!0,get:function(){return ne}});const U=V("packages/core/src/internal/warn.js").warnOnce,Y=V("packages/core/src/internal/ready.js").createReadySignal,W=V("packages/modules/shared/autosize.js"),l=W.contentWidth,L=W.firstMeasured,v=W.watchSize,w=V("packages/modules/shared/axislabels.js").thinLabels,u=V("packages/modules/shared/token-scope.js").claimTokenScope,g=V("packages/modules/charts/svg.js"),d=g.svg,S=g.el,_=g.setText,C=g.path,a=g.round,m=V("packages/modules/charts/scale.js").linearScale,$=V("packages/modules/gantt/time.js"),h=$.toISODate,y=$.fromDayNumber,i=$.toDayNumber,r=$.resolveProjectEpoch,f=V("packages/modules/gantt/links.js"),M=f.routeLink,D=f.arrowheadPath,O=V("packages/modules/gantt/schedule.js").EPS,B=V("packages/modules/gantt/colour.js"),H=B.resolveTaskColour,z=B.darkenColour,at=V("packages/modules/gantt/messages.js"),dt=at.createTranslator,kt=V("packages/modules/gantt/roles.js"),Tt=kt.ROLE_DEFAULTS,Ft=kt.expand,P=V("packages/modules/gantt/gestures.js"),j=P.GanttGestures,x=P.describeTask,R=V("packages/modules/gantt/export.js"),N=R.inlineSvgStyles,X=R.rasterizePNG,G=R.resolveVar,J=V("packages/modules/gantt/tooltip.js"),Q=J.resolveTaskTooltip,pt=J.positionTooltip,st=J.tooltipCss,Ot=V("packages/modules/gantt/markers.js").normalizeMarkers,Jt=V("packages/modules/gantt/draw-event.js").createDrawEventScheduler,lt=V("packages/modules/gantt/events-pointer.js"),nt=lt.TaskPointerEvents,ot=lt.drawProgressHandle,vt=lt.progressHandleCss,gt=lt.partOfElement,Ht=lt.gateTooltipShow,Pt=lt.fireTooltipHide,ft=V("packages/modules/gantt/events-link.js").LinkPointerEvents,q=V("packages/modules/gantt/resize-handle.js"),jt=q.drawResizeHandle,Et=q.resizeHandleCss,mt=q.setBaseDescription,yt=q.restoreDescription;Object.defineProperty(p,"FALLBACK_EN",{enumerable:!0,get:function(){return at.FALLBACK_EN}});const tt="lat-gantt",Mt="data-lat-gantt-styles",It=720,Rt=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,markers:null,nonWorking:null,editable:!0,resizeZone:6,zoom:null,projectEpoch:null,scrollToToday:!1,tooltip:!0,groupBy:null,keyboard:!0,moveStep:1,barColour:null}),Xt=11,Vt=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 $t(){return`
|
|
54
|
+
.${tt}{${Tt}position:relative;font:var(--lattice-font-size)/var(--lattice-line-height) var(--lattice-font-family);color:var(--lattice-foreground);overflow:auto}
|
|
55
|
+
.${tt}__plot{max-width:100%;height:auto;display:block}
|
|
56
|
+
.${tt}__shade{fill:var(--lattice-gantt-nonworking)}
|
|
57
|
+
.${tt}__gridline{stroke:var(--lattice-border-color);stroke-width:1}
|
|
58
|
+
.${tt}__tick{fill:var(--lattice-foreground-muted);font-size:var(--lattice-font-size-sm)}
|
|
59
|
+
.${tt}__lane-band{fill:var(--lattice-surface)}
|
|
60
|
+
.${tt}__lane-label{fill:var(--lattice-foreground);font-size:var(--lattice-font-size);font-weight:600}
|
|
61
|
+
.${tt}__rowlabel{fill:var(--lattice-foreground);font-size:var(--lattice-font-size)}
|
|
62
|
+
.${tt}__rowlabel--summary{font-weight:600}
|
|
63
|
+
.${tt}__bar{fill:var(--lattice-gantt-bar);rx:3;cursor:grab}
|
|
64
|
+
.${tt}__bar--critical{fill:var(--lattice-gantt-critical)}
|
|
65
|
+
.${tt}__bar--inactive,.${tt}__summary--inactive,.${tt}__milestone--inactive{fill:var(--lattice-foreground-muted);opacity:0.55}
|
|
66
|
+
.${tt}__bar--violation{stroke:var(--lattice-variant-warning-solid);stroke-width:2}
|
|
67
|
+
.${tt}__bar--conflict{stroke:var(--lattice-variant-warning-solid);stroke-width:2}
|
|
68
|
+
.${tt}__bar--overdue{stroke:var(--lattice-variant-danger-solid);stroke-width:2;stroke-dasharray:3 2}
|
|
69
|
+
.${tt}__bar--atrisk{stroke:var(--lattice-variant-warning-solid);stroke-width:2}
|
|
70
|
+
.${tt}__summary{fill:var(--lattice-gantt-summary)}
|
|
71
|
+
.${tt}__milestone{fill:var(--lattice-gantt-milestone);cursor:grab}
|
|
72
|
+
.${tt}__milestone--critical{fill:var(--lattice-gantt-critical)}
|
|
73
|
+
.${tt}__progress{fill:var(--lattice-gantt-progress)}
|
|
74
|
+
.${tt}__label{fill:var(--lattice-gantt-bar-fg);font-size:var(--lattice-font-size-sm);dominant-baseline:middle}
|
|
75
|
+
.${tt}__link{fill:none;stroke:var(--lattice-gantt-link);stroke-width:1.5}
|
|
76
|
+
.${tt}__link--critical{stroke:var(--lattice-gantt-critical)}
|
|
77
|
+
.${tt}__link--conflict{stroke:var(--lattice-variant-warning-solid);stroke-width:2;stroke-dasharray:4 2}
|
|
78
|
+
.${tt}__link--chain{stroke:var(--lattice-link-color);stroke-width:2.5}
|
|
79
|
+
.${tt}__arrowhead{fill:var(--lattice-gantt-link)}
|
|
80
|
+
.${tt}__arrowhead--critical{fill:var(--lattice-gantt-critical)}
|
|
81
|
+
.${tt}__arrowhead--conflict{fill:var(--lattice-variant-warning-solid)}
|
|
82
|
+
.${tt}__arrowhead--chain{fill:var(--lattice-link-color)}
|
|
83
|
+
.${tt}__bar--chain{stroke:var(--lattice-link-color);stroke-width:2}
|
|
84
|
+
.${tt}__milestone--chain{stroke:var(--lattice-link-color);stroke-width:2}
|
|
85
|
+
.${tt}__summary--chain{stroke:var(--lattice-link-color);stroke-width:2}
|
|
86
|
+
.${tt}__lag{fill:var(--lattice-foreground-muted);font-size:var(--lattice-font-size-sm)}
|
|
87
|
+
.${tt}__today{stroke:var(--lattice-gantt-today);stroke-width:1.5;stroke-dasharray:4 3}
|
|
88
|
+
.${tt}__marker{stroke:var(--lattice-foreground-muted);stroke-width:1.5}
|
|
89
|
+
.${tt}__marker-range{fill:var(--lattice-range-background)}
|
|
90
|
+
.${tt}__marker-label{fill:var(--lattice-foreground-muted);font-size:var(--lattice-font-size-sm)}
|
|
91
|
+
.${tt}__deadline{stroke:var(--lattice-variant-danger-solid);stroke-width:1.5}
|
|
92
|
+
.${tt}__deadline-glyph{fill:var(--lattice-variant-danger-solid)}
|
|
93
|
+
.${tt}__row--late .${tt}__rowlabel{color:var(--lattice-variant-danger-solid)}
|
|
94
|
+
.${tt}__bar--late{stroke:var(--lattice-variant-danger-solid);stroke-width:2}
|
|
95
|
+
.${tt}__bar--readonly{cursor:default;opacity:.75}
|
|
96
|
+
.${tt}__milestone--readonly{cursor:default;opacity:.75}
|
|
97
|
+
.${tt}__tooltip{position:absolute;pointer-events:none;z-index:5}
|
|
98
|
+
.${tt}__tooltip[hidden]{display:none}
|
|
99
|
+
${st(tt)}
|
|
100
|
+
${vt(tt,"row")}
|
|
101
|
+
${Et(tt,"row")}
|
|
102
|
+
.${tt}__live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
103
|
+
.${tt}__row:focus{outline:2px solid var(--lattice-focus-color);outline-offset:1px}
|
|
104
104
|
/* Native scrollbars follow the nearest data-theme (BACKLOG-0001462). */
|
|
105
|
-
@scope ([data-theme="dark"]){:scope.${
|
|
106
|
-
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${
|
|
107
|
-
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${
|
|
108
|
-
`.trim()}function Ht(Yt){const lt=Yt.documentElement;if(!lt||lt.getAttribute(Mt))return;lt.setAttribute(Mt,"1");const bt=Yt.createElement("style");bt.textContent=Ft(xt()),(Yt.head||Yt.body||lt).appendChild(bt)}function ge(Yt,lt=0){return Yt==="weekends"?bt=>{const Ct=y(bt+lt),Dt=Ct?Ct.getUTCDay():0;return Dt===0||Dt===6}:typeof Yt=="function"?Yt:null}function $e(Yt){return String(Yt??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function qt(Yt){const lt=Yt.attributes;if(!lt)return[];if(lt instanceof Map)return[...lt.entries()];const bt=[];for(let Ct=0;Ct<lt.length;Ct+=1)bt.push([lt[Ct].name,lt[Ct].value]);return bt}function se(Yt){const lt=Yt.tagName?Yt.tagName.toLowerCase():null;if(!lt)return"";const bt=qt(Yt).map(([Bt,Ut])=>` ${Bt}="${$e(Ut)}"`).join(""),Ct=Yt.children||[];if(Ct.length)return`<${lt}${bt}>${[...Ct].map(se).join("")}</${lt}>`;const Dt=Yt.textContent?$e(Yt.textContent):"";return Dt?`<${lt}${bt}>${Dt}</${lt}>`:`<${lt}${bt}></${lt}>`}class It{#t;#i;#e;#n;#s=null;#o=null;#l=null;#d=null;#g=null;#p=null;#h=null;#a="";#f=null;#c=null;#b=null;#r=null;#m;#y=!1;#D=1;#P=0;#w=null;#T=null;#N=null;#E=null;#x=null;#K=null;#ot=null;#O;#V=null;#A;#L=0;#Y=null;#q=[];#nt=Lt;#J=null;#Q=8;#I=Y();get ready(){return this.#I.promise}constructor(lt,bt,Ct={}){this.#t=lt,this.#i=bt,this.#e=bt.ownerDocument,this.#n={...Rt,...Ct},this.#L=r(this.#n.projectEpoch),this.#Y=this.#Z(this.#n.today),this.#q=Pt(this.#n.markers,this.#L),this.#Pt(Ct),this.#nt=Number.isFinite(this.#n.width)?Number(this.#n.width):Lt,Ht(this.#e),this.#s=S(this.#e,"div",Q),this.#r=u(this.#s,this.#i),this.#i.appendChild(this.#s),this.#i.__latticeGantt||(this.#i.__latticeGantt=this),this.#n.tooltip&&(this.#l=S(this.#e,"div",`${Q}__tooltip`),this.#l.setAttribute("hidden",""),this.#d=S(this.#e,"div",`${Q}__tip-arrow`),this.#l.appendChild(this.#d),this.#s.appendChild(this.#l),this.#s.addEventListener("scroll",()=>this.#it())),this.#h=S(this.#e,"div",`${Q}__live`),this.#h.setAttribute("role","status"),this.#h.setAttribute("aria-live","polite"),this.#s.appendChild(this.#h),this.#A=ct(lt,()=>this.#n.messages),this.#O=new P({doc:this.#e,controller:lt,options:()=>this.#n,plot:()=>this.#o,rowOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${Q}__row`):null,barOf:Dt=>Dt.querySelector(`.${Q}__bar`)||Dt.querySelector(`.${Q}__milestone`),pxPerDay:()=>this.#D,announce:Dt=>this.#ne(Dt,{repeat:!0}),t:(Dt,Bt)=>this.#A(Dt,Bt),iso:Dt=>this.#tt(Dt),redraw:()=>this.draw(),previewDrag:Dt=>this.#Qt(Dt),focusTask:Dt=>{this.#f=Dt},editing:()=>!1,view:()=>this,progressOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${Q}__progresshandle`):null,resizeStartOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${Q}__resizehandle`):null,nsOf:()=>Q,scrollers:()=>[this.#s]}),this.#w=new nt({controller:lt,ns:Q,view:()=>this,rowOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${Q}__row`):null,dayAt:Dt=>this.#ie(Dt),date:Dt=>this.#n.dateAxis===!1?Dt:this.#tt(Dt),dragging:()=>this.#O.dragging,consumeDragRelease:()=>this.#O.consumeDragRelease(),keyboard:!!this.#n.keyboard}),this.#w.attach(this.#s),this.#n.editable&&this.#O.attachTouch(this.#s),this.#T=new gt({controller:lt,view:()=>this,linkOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${Q}__link`):null}),this.#T.attach(this.#s),this.#N=Dt=>this.#nn(Dt),this.#s.addEventListener("contextmenu",this.#N),this.#_t(),this.#b=lt.on("schedule",()=>this.draw()),this.#m=Jt(Dt=>lt.emitDraw(Dt)),this.draw(),lt.emitViewMount({view:this,element:this.#s}),this.#I.settleAfterFrames()}#_t(){this.#n.width==="container"&&(this.#et(this.#n.zoom)||(this.#J=v({targets:[this.#s,this.#i],read:()=>L([this.#s,this.#i],l),apply:lt=>{this.#nt=lt,this.#o&&this.draw()}})))}#Pt(lt){!lt||!Number.isFinite(lt.width)||this.#et(this.#n.zoom)&&U(`gantt.zoomWidth:${String(this.#n.zoom)}`,`[lattice] gantt: mount was given both zoom (${JSON.stringify(this.#n.zoom)}) and width (${lt.width}); zoom fixes the pixels-per-day, so the width is ignored and the plot scrolls. Drop one of the two.`)}#Z(lt){if(lt==null||lt==="")return null;if(Number.isFinite(lt))return Number(lt);const bt=i(lt);return Number.isFinite(bt)?bt-this.#L:(U(`gantt.today:${String(lt)}`,`[lattice] gantt: today ${JSON.stringify(lt)} is not a date or a day number; no today line is drawn.`),null)}#at(lt){return lt+this.#L}#tt(lt){return h(this.#at(lt))}get element(){return this.#s}get options(){return{...this.#n}}draw(){if(this.#y)return;const lt=this.#s;lt&<.setAttribute("aria-busy","true"),this.#St(),lt&<.setAttribute("aria-busy","false")}#St(){const lt=this.#t.schedule;if(!lt||!lt.ok)return;const bt=this.#n,Ct=lt.order,Dt=bt.rowLabels?bt.labelWidth:0,Bt=this.#jt(lt),Ut=bt.axisHeight+Bt.count*bt.rowHeight,oe=lt.projectStart,de=lt.projectFinish,me=this.#Y,we=[oe,de];Number.isFinite(me)&&we.push(me);for(const je of this.#q)je.date!=null?we.push(je.date):we.push(je.from,je.to);const Fe=Math.min(...we),Pe=Math.max(...we),Ee=Math.max(1,(Pe-Fe)*.04),_e=Fe-Ee,qe=Pe+Ee,He=this.#et(bt.zoom),ln=this.#nt,pn=He?Math.max(1,(qe-_e)*He.px):Math.max(1,ln-Dt-bt.rightPadding),ne=He?Dt+pn+bt.rightPadding:ln,xe=p({min:_e,max:qe},[0,pn]);this.#D=xe.of(1)-xe.of(0),this.#x=He?He.step:null,this.#Q=this.#n.width==="container"?Math.max(2,Math.min(8,Math.floor(pn/(this.#n.dateAxis?78:44)))):8,this.#K=He?He.level:null,this.#ot=Number.isFinite(me)?a(Dt+xe.of(me)):null;const Ge=je=>a(Dt+xe.of(je));this.#P=Dt+xe.of(0);const Le=d(this.#e,"svg",{class:`${Q}__plot`,width:ne,height:Ut,viewBox:`0 0 ${ne} ${Ut}`,preserveAspectRatio:"xMinYMin meet",role:"img","aria-label":"Gantt chart"}),ve=Bt.rowIndexById,Me=this.#Nt(lt),Ze=new Set(this.#t.findViolations().map(je=>je.id)),We=new Set((lt.conflicts||[]).map(je=>je.id));if(this.#p=bt.tooltip?new Map(this.#t.tasks.map(je=>[String(this.#t.readId(je)),je])):null,this.#Ut(Le,xe,Ge,Fe,Pe,Dt,bt.axisHeight,Ut),this.#Lt(Le,Ge,Dt,bt.axisHeight,Ut),this.#gt(Le,xe,Ge,Ut),this.#kt(Le,lt,Bt,Me,Ge,Ze,We),this.#V={plot:Le,schedule:lt,rowIndex:ve,x:Ge},bt.showArrows&&this.#Gt(Le,lt,ve,Ge),Number.isFinite(me)&&this.#wt(Le,Ge,me,bt.axisHeight,Ut),this.#It(Le,Ge,bt.axisHeight,Ut),bt.editable&&Le.addEventListener("pointerdown",je=>this.#O.onPointerDown(je)),bt.tooltip&&(Le.addEventListener("pointermove",je=>this.#te(je)),Le.addEventListener("pointerleave",()=>this.#it()),Le.addEventListener("focus",je=>this.#en(je),!0),Le.addEventListener("blur",()=>this.#it(),!0),Le.addEventListener("keydown",je=>{je.key==="Escape"&&this.#it()})),bt.keyboard&&(Le.addEventListener("keydown",je=>this.#O.onKey(je)),Le.addEventListener("keydown",je=>this.#O.onHistoryKey(je))),bt.showArrows&&bt.hoverChain&&(Le.addEventListener("pointerover",je=>this.#Rt(je)),Le.addEventListener("pointerleave",()=>this.#Ft())),this.#o&&this.#s.removeChild(this.#o),this.#s.appendChild(Le),this.#o=Le,bt.scrollToToday&&this.scrollToToday(),this.#f){const je=Le.querySelector(`.${Q}__row[data-task="${this.#f}"]`);je&&je.focus&&je.focus()}this.#m({view:this,element:this.#s,range:{start:_e,end:qe},zoom:this.#K})}#et(lt){return Number.isFinite(lt)?{px:Number(lt),step:1,level:"custom"}:typeof lt=="string"&&Vt[lt]?Vt[lt]:null}linkVerticalScroll(lt){if(this.#c&&(this.#c(),this.#c=null),!lt||!this.#s||!lt.addEventListener)return()=>{};const bt=this.#s,Ct=lt;let Dt=!1;const Bt=(me,we)=>{Dt||(Dt=!0,we.scrollTop=me.scrollTop,Dt=!1)},Ut=()=>Bt(bt,Ct),oe=()=>Bt(Ct,bt);bt.addEventListener("scroll",Ut),Ct.addEventListener("scroll",oe);const de=()=>{bt.removeEventListener("scroll",Ut),Ct.removeEventListener("scroll",oe)};return this.#c=de,de}scrollToToday(){if(this.#ot==null||!this.#s)return;const lt=this.#n.rowLabels?this.#n.labelWidth:0;this.#s.scrollLeft=Math.max(0,this.#ot-lt-40)}#ft(lt){const bt=new Map;for(const Ut of lt.order){const oe=lt.tasks.get(Ut),de=oe&&oe.parent==null?"__root__":String(oe.parent);bt.has(de)||bt.set(de,[]),bt.get(de).push(Ut)}const Ct=[],Dt=new Set,Bt=Ut=>{for(const oe of bt.get(Ut)||[])Dt.has(oe)||(Dt.add(oe),Ct.push(oe),Bt(oe))};Bt("__root__");for(const Ut of lt.order)Dt.has(Ut)||(Dt.add(Ut),Ct.push(Ut));return Ct}#jt(lt){const bt=this.#ft(lt),Ct=new Map;if(!this.#n.groupBy){const me=bt.map(we=>({kind:"task",id:we}));return bt.forEach((we,Fe)=>Ct.set(we,Fe)),{rows:me,rowIndexById:Ct,count:me.length}}const Dt=new Map(this.#t.tasks.map(me=>[String(this.#t.readId(me)),me])),Bt=this.#n.groupBy,Ut=me=>{const we=Dt.get(me)||{},Fe=typeof Bt=="function"?Bt(we):we[Bt];return Fe==null||Fe===""?"Ungrouped":String(Fe)},oe=new Map;for(const me of bt){const we=Ut(me);oe.has(we)||oe.set(we,[]),oe.get(we).push(me)}const de=[];for(const[me,we]of oe){de.push({kind:"header",key:me});for(const Fe of we)de.push({kind:"task",id:Fe})}return de.forEach((me,we)=>{me.kind==="task"&&Ct.set(me.id,we)}),{rows:de,rowIndexById:Ct,count:de.length}}#Nt(lt){const bt=new Map;for(const Ct of lt.order){let Dt=0,Bt=lt.tasks.get(Ct).parent;for(;Bt!=null&<.tasks.has(Bt);)Dt+=1,Bt=lt.tasks.get(Bt).parent;bt.set(Ct,Dt)}return bt}#Ut(lt,bt,Ct,Dt,Bt,Ut,oe,de){const me=ge(this.#n.nonWorking,this.#L);if(!me)return;const we=Math.floor(Dt),Fe=Math.ceil(Bt);if(Fe-we>3660)return;const Pe=d(this.#e,"g",{class:`${Q}__shading`});for(let Ee=we;Ee<Fe;Ee+=1){if(!me(Ee))continue;const _e=Math.max(Ut,Ct(Ee)),qe=Ct(Ee+1);Pe.appendChild(d(this.#e,"rect",{class:`${Q}__shade`,"data-day":String(Ee),x:_e,y:oe,width:a(Math.max(0,qe-_e)),height:de-oe}))}lt.appendChild(Pe)}#gt(lt,bt,Ct,Dt){const Bt=d(this.#e,"g",{class:`${Q}__axis`}),Ut=this.#n.axisHeight,oe=this.#yt(bt);for(const we of oe){const Fe=Ct(we);Bt.appendChild(d(this.#e,"line",{class:`${Q}__gridline`,x1:Fe,y1:Ut,x2:Fe,y2:Dt}))}const de=oe.map(we=>({at:Ct(we),text:this.#pt(we)})),{kept:me}=this.#x?w(de,{fontSize:Zt}):{kept:de};for(const we of me){const Fe=d(this.#e,"text",{class:`${Q}__tick`,x:we.at+2,y:Ut-6});_(Fe,we.text),Bt.appendChild(Fe)}lt.appendChild(Bt)}#yt(lt){if(!this.#x)return lt.ticks(this.#Q);const{min:bt,max:Ct}=lt.domain,Dt=this.#x,Bt=[];for(let Ut=Math.ceil(bt/Dt)*Dt;Ut<=Ct;Ut+=Dt)Bt.push(Ut);return Bt.length?Bt:lt.ticks(this.#Q)}#pt(lt){if(!this.#n.dateAxis)return String(a(lt));const bt=this.#tt(Math.round(lt));return bt?this.#K==="month"||this.#K==="quarter"?bt.slice(0,7):bt:String(a(lt))}#kt(lt,bt,Ct,Dt,Bt,Ut,oe){const de=this.#n,me=d(this.#e,"g",{class:`${Q}__rows`});Ct.rows.forEach((we,Fe)=>{const Pe=de.axisHeight+Fe*de.rowHeight;if(we.kind==="header"){this.#Xt(me,we.key,Pe,de.rowHeight);return}const Ee=we.id,_e=bt.tasks.get(Ee),qe=Pe+de.barPadding,He=de.rowHeight-2*de.barPadding,ln=Pe+de.rowHeight/2,pn=de.showCritical&&_e.critical,ne=Ut.has(Ee),xe=oe.has(Ee),Ge=_e.percentComplete==null||_e.percentComplete<100,Le=Number.isFinite(this.#Y)&&Ge&&!_e.isSummary&&!_e.unscheduled&&!_e.inactive&&_e.ef<this.#Y,ve=!_e.inactive&&_e.totalFloat<-O,Me=_e.late===!0,Ze=typeof this.#t.isTaskReadOnly=="function"&&this.#t.isTaskReadOnly(Ee),We=d(this.#e,"g",{class:`${Q}__row${Me?` ${Q}__row--late`:""}${Ze?` ${Q}__row--readonly`:""}`});if(We.setAttribute("data-task",Ee),We.setAttribute("tabindex",de.keyboard?"0":"-1"),We.setAttribute("role",_e.isSummary?"group":"button"),We.setAttribute("aria-label",x(_e,{dateAxis:de.dateAxis,iso:he=>this.#tt(he),unscheduled:this.#A("gantt.unscheduled"),inactive:this.#A("gantt.inactive")})),Ze&&mt(We,this.#A("gantt.a11y.readOnly")),pn&&We.setAttribute("data-critical","true"),ne&&We.setAttribute("data-violation","true"),Le&&We.setAttribute("data-overdue","true"),ve&&We.setAttribute("data-atrisk","true"),Me&&We.setAttribute("data-late","true"),_e.inactive&&We.setAttribute("data-inactive","true"),de.rowLabels){const he=d(this.#e,"text",{class:`${Q}__rowlabel${_e.isSummary?` ${Q}__rowlabel--summary`:""}`,x:6+(Dt.get(Ee)||0)*12,y:ln,"dominant-baseline":"middle"});_(he,_e.name),We.appendChild(he)}const je=_e.inactive?null:W(_e,de.barColour);if(_e.unscheduled||_e.inactive&&_e.es==null)_e.unscheduled&&We.setAttribute("data-unscheduled","true");else if(_e.isMilestone)this.#Jt(We,Bt(_e.es),ln,He/2,pn,je,_e.inactive,Ze);else{const he=Bt(_e.es),Ke=Math.max(1,Bt(_e.ef)-he),zn=_e.isSummary?`${Q}__summary${_e.inactive?` ${Q}__summary--inactive`:""}`:`${Q}__bar${pn?` ${Q}__bar--critical`:""}${ne?` ${Q}__bar--violation`:""}${xe?` ${Q}__bar--conflict`:""}${Le?` ${Q}__bar--overdue`:""}${ve?` ${Q}__bar--atrisk`:""}${Me?` ${Q}__bar--late`:""}${_e.inactive?` ${Q}__bar--inactive`:""}${Ze?` ${Q}__bar--readonly`:""}`,Yn=d(this.#e,"rect",{class:zn,x:he,y:qe,width:a(Ke),height:He,rx:3});if(je&&(Yn.style.fill=je),We.appendChild(Yn),de.showProgress&&_e.percentComplete!=null&&_e.percentComplete>0){const mn=d(this.#e,"rect",{class:`${Q}__progress`,x:he,y:qe,width:a(Ke*Math.min(1,_e.percentComplete/100)),height:He,rx:3});je&&(mn.style.fill=B(je)),We.appendChild(mn)}const Sn=this.#qt(_e);if(Sn){const mn=d(this.#e,"text",{class:`${Q}__label`,x:a(he+Ke+4),y:ln});_(mn,Sn),We.appendChild(mn)}de.editable&&!_e.isSummary&&(Ze||mt(We,[We.getAttribute("aria-description"),this.#A("gantt.a11y.startEdge")].filter(Boolean).join(" ")),We.appendChild(jt(this.#e,{ns:Q,id:Ee,x0:he,barY:qe,barH:He,title:this.#A("gantt.resize.startHandle",{name:_e.name})})),We.appendChild(ot(this.#e,{ns:Q,id:Ee,x0:he,w:Ke,barY:qe,barH:He,percent:_e.percentComplete||0,title:this.#A("gantt.progress.handle",{name:_e.name})})))}this.#$t(We,Bt,_e,Pe,qe,He),me.appendChild(We)}),lt.appendChild(me)}#$t(lt,bt,Ct,Dt,Bt,Ut){if(Ct.deadline==null||!Number.isFinite(Ct.deadline))return;const oe=bt(Ct.deadline),de=Dt+2,me=Bt+Ut;lt.appendChild(d(this.#e,"line",{class:`${Q}__deadline`,x1:oe,y1:de,x2:oe,y2:me,"data-deadline":String(Ct.deadline)}));const we=3;lt.appendChild(d(this.#e,"path",{class:`${Q}__deadline-glyph`,d:C(["M",a(oe-we),a(de),"L",a(oe+we),a(de),"L",a(oe),a(de+we*1.6),"Z"])}))}#Xt(lt,bt,Ct,Dt){const Bt=d(this.#e,"g",{class:`${Q}__lane`});Bt.setAttribute("data-group",bt),Bt.appendChild(d(this.#e,"rect",{class:`${Q}__lane-band`,x:0,y:Ct,width:"100%",height:Dt}));const Ut=d(this.#e,"text",{class:`${Q}__lane-label`,x:6,y:Ct+Dt/2,"dominant-baseline":"middle"});_(Ut,bt),Bt.appendChild(Ut),lt.appendChild(Bt)}#qt(lt){const bt=this.#n.label;if(typeof bt=="function")return String(bt(lt)??"");switch(bt){case"none":return"";case"percent":return lt.percentComplete==null?"":`${Math.round(lt.percentComplete)}%`;case"dates":return this.#n.dateAxis?`${this.#tt(lt.es)} – ${this.#tt(lt.ef)}`:`${a(lt.es)} – ${a(lt.ef)}`;default:return lt.name}}#Jt(lt,bt,Ct,Dt,Bt,Ut=null,oe=!1,de=!1){const me=C(["M",a(bt-Dt),a(Ct),"L",a(bt),a(Ct-Dt),"L",a(bt+Dt),a(Ct),"L",a(bt),a(Ct+Dt),"Z"]),we=d(this.#e,"path",{class:`${Q}__milestone${Bt?` ${Q}__milestone--critical`:""}${oe?` ${Q}__milestone--inactive`:""}${de?` ${Q}__milestone--readonly`:""}`,d:me});Ut&&(we.style.fill=Ut),lt.appendChild(we)}#Gt(lt,bt,Ct,Dt){const Bt=this.#n,Ut=d(this.#e,"g",{class:`${Q}__links`}),oe=new Set((bt.conflicts||[]).filter(me=>me.type==="LOCKED"&&me.from!=null&&me.to!=null).map(me=>`${me.from}:${me.to}`));for(const me of this.#t.dependencies){const we=String(me.from),Fe=String(me.to),Pe=bt.tasks.get(we),Ee=bt.tasks.get(Fe);if(!Pe||!Ee||!Ct.has(we)||!Ct.has(Fe)||Pe.unscheduled||Ee.unscheduled||Pe.es==null||Pe.ef==null||Ee.es==null||Ee.ef==null)continue;const _e=me.type?String(me.type).toUpperCase():"FS",qe=_e==="FS"||_e==="FF"?Pe.ef:Pe.es,He=_e==="FF"||_e==="SF"?Ee.ef:Ee.es,ln=Dt(qe),pn=Bt.axisHeight+Ct.get(we)*Bt.rowHeight+Bt.rowHeight/2,ne=Dt(He),xe=Bt.axisHeight+Ct.get(Fe)*Bt.rowHeight+Bt.rowHeight/2,Ge=Bt.showCritical&&Pe.critical&&Ee.critical,Le=oe.has(`${we}:${Fe}`),ve=Math.max(8,Bt.rowHeight/2),Me=T({sx:ln,sy:pn,ex:ne,ey:xe,type:_e,elbow:ve,rowGap:Bt.rowHeight/2}),Ze=d(this.#e,"path",{class:`${Q}__link${Ge?` ${Q}__link--critical`:""}${Le?` ${Q}__link--conflict`:""}`,d:Me.d});if(Ze.setAttribute("data-from",we),Ze.setAttribute("data-to",Fe),Ze.setAttribute("data-type",_e),Ze.setAttribute("data-route",Me.route),Ge&&Ze.setAttribute("data-critical","true"),Le&&Ze.setAttribute("data-conflict","true"),Ut.appendChild(Ze),Ut.appendChild(this.#F(ne,xe,Me.arrowDir,Ge,Le)),me.lag){const We=d(this.#e,"text",{class:`${Q}__lag`,x:a((ln+ne)/2),y:a((pn+xe)/2)-2});_(We,this.#A(me.lag>0?"gantt.lag":"gantt.lead",{days:me.lag})),Ut.appendChild(We)}}const de=lt.querySelector(`.${Q}__links`);de?lt.replaceChild(Ut,de):lt.appendChild(Ut)}#Qt(lt){const bt=this.#V;if(!(!bt||!lt||!this.#n.showArrows)){this.#Gt(bt.plot,lt,bt.rowIndex,bt.x);for(const[Ct,Dt]of lt.tasks){const Bt=bt.schedule.tasks.get(Ct),Ut=bt.plot.querySelector(`.${Q}__row[data-task="${Ct}"]`);if(!Bt||!Ut||this.#O.draggedId===Ct||Bt.unscheduled||Dt.unscheduled)continue;const oe=bt.x(Dt.es)-bt.x(Bt.es);oe?Ut.setAttribute("transform",`translate(${oe} 0)`):Ut.removeAttribute("transform")}}}#F(lt,bt,Ct,Dt,Bt){return d(this.#e,"path",{class:`${Q}__arrowhead${Dt?` ${Q}__arrowhead--critical`:""}${Bt?` ${Q}__arrowhead--conflict`:""}`,d:j(lt,bt,Ct)})}#wt(lt,bt,Ct,Dt,Bt){const Ut=bt(Ct);lt.appendChild(d(this.#e,"line",{class:`${Q}__today`,x1:Ut,y1:Dt,x2:Ut,y2:Bt,"data-today":String(Ct)}))}#Lt(lt,bt,Ct,Dt,Bt){if(!this.#q.length)return;const Ut=d(this.#e,"g",{class:`${Q}__markers`});for(const oe of this.#q){if(oe.from==null)continue;const de=Math.max(Ct,bt(oe.from)),me=Math.max(Ct,bt(oe.to));if(me<=de)continue;const we=d(this.#e,"rect",{class:`${Q}__marker-range`,x:de,y:Dt,width:a(me-de),height:Bt-Dt,"data-marker":String(oe.index),"data-from":String(oe.from),"data-to":String(oe.to)});oe.colour&&we.setAttribute("fill",oe.colour),Ut.appendChild(we)}lt.appendChild(Ut)}#It(lt,bt,Ct,Dt){if(!this.#q.length)return;const Bt=d(this.#e,"g",{class:`${Q}__markers`});for(const Ut of this.#q){const oe=Ut.date!=null?[Ut.date]:[Ut.from,Ut.to];for(const de of oe){const me=bt(de),we=d(this.#e,"line",{class:`${Q}__marker`,x1:me,y1:Ct,x2:me,y2:Dt,"data-marker":String(Ut.index),"data-date":String(de)});Ut.colour&&we.setAttribute("stroke",Ut.colour),Ut.dashed&&we.setAttribute("stroke-dasharray","4 3"),Bt.appendChild(we)}if(Ut.label){const de=Ut.date!=null?Ut.date:(Ut.from+Ut.to)/2,me=d(this.#e,"text",{class:`${Q}__marker-label`,x:a(bt(de)+3),y:Math.max(4,Ct-10),"data-marker":String(Ut.index)});Ut.colour&&me.setAttribute("fill",Ut.colour),_(me,Ut.label),Bt.appendChild(me)}}lt.appendChild(Bt)}#te(lt){if(this.#O.dragging||!this.#l)return;const bt=this.#t.schedule;if(!bt||!bt.ok){this.#it();return}const Ct=lt.target,Dt=Ct&&Ct.closest?Ct.closest(`.${Q}__row`):null,Bt=Dt?Dt.getAttribute("data-task"):null,Ut=Bt?bt.tasks.get(Bt):null;if(!Ut){this.#it();return}this.#lt(Dt,Ut,lt)}#en(lt){if(this.#O.dragging||!this.#l)return;const bt=this.#t.schedule;if(!bt||!bt.ok)return;const Ct=lt.target,Dt=Ct&&Ct.closest?Ct.closest(`.${Q}__row`):null,Bt=Dt?Dt.getAttribute("data-task"):null,Ut=Bt?bt.tasks.get(Bt):null;Ut&&this.#lt(Dt,Ut,lt)}#nn(lt){const bt=pt(lt.target,Q);if(!bt)return;const Ct=lt.target.closest?lt.target.closest(`.${Q}__row`):null,Dt=Ct?Ct.getAttribute("data-task"):null;Dt!=null&&!this.#w.gateContextMenu(String(Dt),bt,lt)&<.preventDefault&<.preventDefault()}#lt(lt,bt,Ct=null){const Dt=this.#p&&this.#p.get(String(bt.id))||null,Bt=tt(this.#e,Q,bt,Dt,this.#n.tooltip,this.#z());if(!Bt){this.#it();return}if(this.#E!==bt.id){if(!zt(this.#t,this,bt.id,Bt.text,Ct)){this.#it();return}this.#E=bt.id}for(const Ut of[...this.#l.children])Ut!==this.#d&&this.#l.removeChild(Ut);if(Bt.node)this.#l.appendChild(Bt.node);else{const Ut=S(this.#e,"div",`${Q}__tip-card`);_(Ut,Bt.text),this.#l.appendChild(Ut)}this.#l.removeAttribute("hidden"),this.#l.setAttribute("data-task",bt.id),this.#g&&this.#g!==lt&&yt(this.#g),lt.setAttribute("aria-description",Bt.text),this.#g=lt,this.#H(lt)}#z(){const lt=this.#t.resourceNames;return{t:this.#A,formatDate:bt=>this.#ee(bt),dateAxis:this.#n.dateAxis,resourceName:bt=>lt.get(bt)??bt}}#ee(lt){if(this.#n.dateAxis===!1)return this.#A("gantt.a11y.day",{day:a(lt)});const bt=y(this.#at(lt));if(!bt)return"";try{return new Intl.DateTimeFormat(this.#_e(),{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(bt)}catch{return this.#tt(lt)||""}}#_e(){const lt=this.#t.grid,bt=lt&<.messages;return bt&&bt.locale||void 0}#H(lt){if(!this.#l||!this.#s)return;const bt=lt.querySelector(`.${Q}__bar`)||lt.querySelector(`.${Q}__milestone`)||lt.querySelector(`.${Q}__summary`);if(!bt||typeof bt.getBoundingClientRect!="function")return;const Ct=bt.getBoundingClientRect(),Dt=this.#s.getBoundingClientRect(),Bt=this.#e.defaultView||globalThis,Ut=Number.isFinite(Bt.innerWidth)?Bt.innerWidth:1/0,oe=Number.isFinite(Bt.innerHeight)?Bt.innerHeight:1/0,de={left:Math.max(0,Dt.left),top:Math.max(0,Dt.top),right:Math.min(Ut,Dt.right),bottom:Math.min(oe,Dt.bottom)};ft(this.#l,this.#d,Ct,de,Dt)}#it(){if(this.#l&&(this.#l.setAttribute("hidden",""),this.#g&&(yt(this.#g),this.#g=null),this.#E!=null)){const lt=this.#E;this.#E=null,Ot(this.#t,this,lt,null)}}#xt(lt){const bt=new Map,Ct=new Map;for(const Ut of this.#t.dependencies){const oe=String(Ut.from),de=String(Ut.to);(Ct.get(oe)||Ct.set(oe,[]).get(oe)).push(de),(bt.get(de)||bt.set(de,[]).get(de)).push(oe)}const Dt=new Set([lt]),Bt=(Ut,oe)=>{const de=[oe];for(;de.length;){const me=de.pop();for(const we of Ut.get(me)||[])Dt.has(we)||(Dt.add(we),de.push(we))}};return Bt(bt,lt),Bt(Ct,lt),Dt}#de(lt){if(!this.#o)return;this.#Ft();const bt=this.#xt(lt);for(const Ct of this.#o.querySelectorAll(`.${Q}__link`)){const Dt=Ct.getAttribute("data-from"),Bt=Ct.getAttribute("data-to");bt.has(Dt)&&bt.has(Bt)&&Ct.classList.add(`${Q}__link--chain`)}for(const Ct of bt){const Dt=this.#o.querySelector(`.${Q}__row[data-task="${Ct}"]`);if(!Dt)continue;const Bt=Dt.querySelector(`.${Q}__bar`)||Dt.querySelector(`.${Q}__milestone`)||Dt.querySelector(`.${Q}__summary`);if(!Bt)continue;const Ut=Bt.getAttribute("class")||"";Ut.includes(`${Q}__milestone`)?Bt.classList.add(`${Q}__milestone--chain`):Ut.includes(`${Q}__summary`)?Bt.classList.add(`${Q}__summary--chain`):Bt.classList.add(`${Q}__bar--chain`)}}#Ft(){if(this.#o)for(const lt of["__link--chain","__bar--chain","__milestone--chain","__summary--chain"])for(const bt of this.#o.querySelectorAll(`.${Q}${lt}`))bt.classList.remove(`${Q}${lt}`)}#Rt(lt){if(this.#O.dragging)return;const bt=lt.target,Ct=bt&&bt.closest?bt.closest(`.${Q}__row`):null,Dt=Ct?Ct.getAttribute("data-task"):null;Dt?this.#de(Dt):this.#Ft()}#ne(lt,bt){if(!this.#h||!lt)return;if(!!!(bt&&bt.repeat)){if(lt===this.#a)return;this.#a=lt,_(this.#h,lt);return}this.#a=lt,_(this.#h,""),_(this.#h,lt)}toSVG(){return this.#o?se(this.#o):""}async toPNG(lt={}){if(!this.#o)return null;const bt=this.#e.defaultView||globalThis,Ct=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():null,Dt=Math.max(1,Math.round(Ct&&Ct.width||Number(this.#o.getAttribute("width"))||Lt)),Bt=Math.max(1,Math.round(Ct&&Ct.height||Number(this.#o.getAttribute("height"))||1));let Ut=this.#o;bt.getComputedStyle&&this.#o.cloneNode&&(Ut=this.#o.cloneNode(!0),N(this.#o,Ut,bt),Ut.setAttribute("xmlns","http://www.w3.org/2000/svg"));const oe=typeof bt.XMLSerializer=="function"?new bt.XMLSerializer().serializeToString(Ut):se(Ut),de=lt.scale||bt.devicePixelRatio||1,me="background"in lt?lt.background:G(bt,this.#s,"--lattice-background")||null;return X(this.#e,oe,Dt,Bt,de,me)}#ie(lt){const bt=this.#o;if(!bt||!(this.#D>0))return null;let Ct=1,Dt=bt.getBoundingClientRect&&bt.getBoundingClientRect().left||0;const Bt=typeof bt.getScreenCTM=="function"?bt.getScreenCTM():null;return Bt&&Bt.a>0&&(Ct=Bt.a,Dt=Bt.e),(((lt.clientX||0)-Dt)/Ct-this.#P)/this.#D}destroy(){this.#y||(this.#y=!0,this.#I.fail(new Error("lattice-grid: the gantt view was destroyed before it became ready.")),this.#t.emitViewDestroy({view:this,element:this.#s}),this.#O.destroy(),this.#w&&(this.#w.destroy(),this.#w=null),this.#T&&(this.#T.destroy(),this.#T=null),this.#N&&this.#s&&this.#s.removeEventListener("contextmenu",this.#N),this.#N=null,this.#J&&(this.#J.release(),this.#J=null),this.#c&&(this.#c(),this.#c=null),this.#b&&this.#b(),this.#i&&this.#i.__latticeGantt===this&&(this.#i.__latticeGantt=null),this.#r&&(this.#r(),this.#r=null),this.#s&&this.#s.parentNode&&this.#s.parentNode.removeChild(this.#s),this.#s=null,this.#o=null)}}function ie(Yt,lt,bt={}){return new It(Yt,lt,bt)}}),ae("packages/modules/gantt/zoom.js",function(g,V){"use strict";Object.defineProperty(g,"ZOOM_PRESETS",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"ZOOM_LEVEL_NAMES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"resolveZoomPreset",{enumerable:!0,get:function(){return K}});const St=Object.freeze({hour:Object.freeze({px:624,step:1/24,level:"hour"}),day:Object.freeze({px:26,step:1,level:"day"}),week:Object.freeze({px:12,step:7,level:"week"}),month:Object.freeze({px:4,step:30,level:"month"}),quarter:Object.freeze({px:1.8,step:91,level:"quarter"})}),U=Object.freeze(["hour","day","week","month","quarter"]);function K(Y,H="day"){if(typeof Y=="number"&&Number.isFinite(Y)&&Y>0){const l=Y>=60?"hour":Y>=18?"day":Y>=8?"week":Y>=2.5?"month":"quarter";return{px:Y,step:St[l].step,level:l}}return typeof Y=="string"&&Object.prototype.hasOwnProperty.call(St,Y)?{...St[Y]}:{...St[H]||St.day}}}),ae("packages/modules/gantt/calendar-shading.js",function(g,V){"use strict";Object.defineProperty(g,"rowNonWorking",{enumerable:!0,get:function(){return K}});const U=V("packages/modules/gantt/task-calendars.js").PLAN_CALENDAR_ID;function K(Y,H,l){if(!Y||!(Y.calendars instanceof Map))return null;const L=new Map;return H.map(v=>{const m=v.rec&&v.rec.calendar;if(m==null||m===U||!Y.calendars.has(m))return l;if(!L.has(m)){const w=Y.calendars.get(m);L.set(m,k=>!w.isWorking(k))}return L.get(m)})}}),ae("packages/modules/gantt/avatar.js",function(g,V){"use strict";Object.defineProperty(g,"initials",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"avatarColor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"safeAvatarUrl",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"avatarChip",{enumerable:!0,get:function(){return v}});const St="lat-gantt-split",U=["#4a90d9","#e2513b","#2c9c6a","#8b5cf6","#d97706","#0891b2","#be185d"],K=/^\s*(https?:|blob:|data:image\/)/i,Y=/^\s*[a-z][a-z0-9+.-]*:/i;function H(m){const w=String(m).trim().split(/\s+/).filter(Boolean);return w.length?w.length===1?w[0].slice(0,2).toUpperCase():(w[0][0]+w[w.length-1][0]).toUpperCase():"?"}function l(m){let w=0;for(let k=0;k<m.length;k+=1)w=w*31+m.charCodeAt(k)>>>0;return U[w%U.length]}function L(m){if(m==null)return"";const w=String(m).trim();return w?Y.test(w)?K.test(w)?w:"":w:""}function v(m,{name:w,avatar:k,over:u=!1,title:f=null,cssGlyph:d=!1}){const S=String(w??""),_=m.createElement("div");_.setAttribute("class",`${St}__avatar${u?` ${St}__avatar--overalloc`:""}`),_.style.background=l(S),f!=null&&_.setAttribute("title",String(f));const C=L(k);if(C){const o=m.createElement("img");o.setAttribute("class",`${St}__avatar-img`),o.setAttribute("alt",S),o.setAttribute("loading","lazy"),o.setAttribute("decoding","async"),o.setAttribute("src",C),o.addEventListener("error",()=>{o.parentNode===_&&_.removeChild(o)}),_.appendChild(o)}const a=m.createElement("span");return a.setAttribute("class",`${St}__avatar-glyph${d?` ${St}__avatar-glyph--css`:""}`),d?a.setAttribute("data-initials",H(S)):a.textContent=H(S),_.appendChild(a),_}}),ae("packages/modules/gantt/events-table.js",function(g,V){"use strict";Object.defineProperty(g,"TABLE_EVENTS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"isEditOpeningKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"CellTableEvents",{enumerable:!0,get:function(){return v}});const St=V("packages/modules/gantt/events-pointer.js"),U=St.taskContext,K=St.emitGesture,Y=St.gateGesture,H=Object.freeze(["cellClick","cellDblClick","cellContextMenu","beforeCellEditStart","cellEditStart","cellEditStart:cancelled","cellEditCommit","cellEditCancel","rowClick","rowDblClick"]);function l(m){return m?m.key==="Enter"?!0:m.ctrlKey||m.metaKey||m.altKey?!1:m.key==="F2"?!0:typeof m.key=="string"&&m.key.length===1&&m.key!==" "&&!m.isComposing:!1}function L(m){const w=m&&m.target,k=w&&typeof w.closest=="function"?w.closest("[data-col]"):null;if(!k)return null;const u=k.getAttribute("data-col"),f=typeof k.closest=="function"?k.closest("[data-key]"):null,d=f?f.getAttribute("data-key"):null;return u==null||d==null?null:{colId:u,key:d,cellEl:k}}class v{#t;#i;#e;#n=null;#s=null;#o=null;#l=[];constructor(w){this.#t=w.controller,this.#i=w.table,this.#e=w.view}attach(w){if(this.#i.on("cell:clicked",d=>{const S=this.#h(d);S&&K(this.#t,"cellClick",S)}),this.#i.on("cell:dblclicked",d=>{const S=this.#h(d);S&&K(this.#t,"cellDblClick",S)}),this.#i.on("cell:contextmenu",d=>{const S=this.#h(d);S&&K(this.#t,"cellContextMenu",S)}),this.#i.on("row:clicked",d=>{const S=this.#a(d);S&&K(this.#t,"rowClick",S)}),this.#i.on("row:dblclicked",d=>{const S=this.#a(d);S&&K(this.#t,"rowDblClick",S)}),this.#i.on("cell:edit:start",d=>this.#g(d)),this.#i.on("cell:edit:end",d=>this.#p(d)),!w||!w.addEventListener)return;const k=d=>this.#d(d),u=d=>{this.#o=d,l(d)&&this.#d(d)},f=d=>{this.#o=d};w.addEventListener("dblclick",k,!0),w.addEventListener("keydown",u,!0),w.addEventListener("mousedown",f,!0),this.#l.push([w,"dblclick",k,!0],[w,"keydown",u,!0],[w,"mousedown",f,!0])}#d(w){if(this.#n)return;const k=this.#i&&this.#i.grid;if(!k)return;const u=L(w);if(!u)return;const f=k.get&&k.get("edit");if(f===!1||f&&typeof f=="object"&&f.enabled===!1)return;const d=k.columns.get(u.colId);if(!d||!d.edit||!d.edit.enabled)return;const S=String(u.key);if(typeof this.#t.isTaskReadOnly=="function"&&this.#t.isTaskReadOnly(S))return;const _={...U(this.#t,S),columnKey:u.colId,value:k.rows&&typeof k.rows.value=="function"?k.rows.value(S,u.colId):void 0,element:u.cellEl,event:w,view:this.#e()};this.#s=w,Y(this.#t,"beforeCellEditStart","cellEditStart:cancelled",_)||(this.#s=null,typeof w.preventDefault=="function"&&w.preventDefault(),typeof w.stopImmediatePropagation=="function"?w.stopImmediatePropagation():typeof w.stopPropagation=="function"&&w.stopPropagation())}#g(w){const k=w&&(w.key||w.row&&w.row.key);if(k==null||w.colId==null)return;const u=String(k),f=this.#s;this.#s=null,this.#n={key:u,colId:String(w.colId)},K(this.#t,"cellEditStart",{...U(this.#t,u),columnKey:String(w.colId),event:f||null,view:this.#e()})}#p(w){const k=w&&(w.key||w.row&&w.row.key);if(k==null||w.valid===!1)return;this.#n=null;const u=String(k),f={...U(this.#t,u),columnKey:w.colId!=null?String(w.colId):null,view:this.#e(),event:this.#o||null};if(Array.isArray(w.writes)&&w.writes.length){const d=w.writes[0];K(this.#t,"cellEditCommit",{...f,oldValue:d.before,newValue:d.after})}else w.cancelled===!0&&K(this.#t,"cellEditCancel",f)}#h(w){const k=w&&(w.key||w.row&&w.row.key);if(k==null)return null;const u=String(k),f=w.event,d=f&&f.target,S=d&&typeof d.closest=="function"?d.closest(".lat-cell"):null;return{...U(this.#t,u),columnKey:w.colId!=null?String(w.colId):null,value:w.value,element:S,event:f||null,view:this.#e()}}#a(w){const k=w&&(w.key||w.row&&w.row.key);if(k==null)return null;const u=String(k);return{...U(this.#t,u),event:w.event||null,view:this.#e()}}destroy(){for(const[w,k,u,f]of this.#l)w.removeEventListener(k,u,f);this.#l=[],this.#n=null,this.#s=null,this.#o=null}}}),ae("packages/modules/gantt/assignment-picker.js",function(g,V){"use strict";Object.defineProperty(g,"resourceLoadOver",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"pickerWarnings",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"AssignmentPicker",{enumerable:!0,get:function(){return w}});const U=V("packages/modules/gantt/resources.js").parseAssignments,Y=V("packages/modules/gantt/avatar.js").avatarChip,H="lat-gantt-split";function l(k,u,f,d,S=1){const _=k&&k.byResource?k.byResource.get(u):null;if(!_)return{load:0,capacity:S};let C=0;for(const o of _.segments)o.end>f&&o.start<d&&o.load>C&&(C=o.load);const a=(k.overAllocations||[]).find(o=>o.resource===u&&o.end>f&&o.start<d);return{load:C,capacity:a?a.capacity:_.capacity}}function L(k,u){const f=new Map;for(const d of k&&k.overAllocations||[]){if(!d.taskIds.includes(u))continue;const S=f.get(d.resource);(!S||d.load>S.load)&&f.set(d.resource,{resource:d.resource,load:d.load,capacity:d.capacity})}return[...f.values()]}const v=k=>Math.round(k*100);function m(k,u,f,d){const S=k.createElement(u);return f&&S.setAttribute("class",`${H}__${f}`),d!=null&&(S.textContent=d),S}class w{#t;#i;#e;#n;#s;#o;#l=new Map;#d=1/0;#g=!0;#p=[];#h=0;#a="";#f=null;#c=null;#b=null;#r=null;#m=null;#y=null;constructor(u,f,d,S,_,C){this.#t=u,this.#i=f,this.#e=d,this.#n=String(S),this.#s=_,this.#o=C,this.#D=_}#D;#P(){const u=this.#t.schedule;return u&&u.ok&&u.tasks.get(this.#n)||null}#w(u){return this.#t.resourceNames.get(u)??u}open(){const u=this.#i,f=this.#t.taskById(this.#n)||{};for(const b of U(f))this.#l.set(b.resource,b.units);const d=f&&f.assignmentPicker?f.assignmentPicker:null;if(d){const b=Number(d.max);Number.isFinite(b)&&b>=1&&(this.#d=Math.floor(b)),typeof d.units=="boolean"&&(this.#g=d.units)}const S=new Set(this.#l.keys());for(const b of this.#t.resourceModels.keys())S.add(b);const _=this.#t.resources();for(const b of _.resources)S.add(b.resource);this.#p=[...S].sort((b,T)=>b.localeCompare(T));const C=this.#P(),a=m(u,"div","picker");a.setAttribute("role","dialog"),a.setAttribute("aria-label",this.#e("gantt.picker.title",{name:C?C.name:this.#n}));const o=m(u,"input","picker-search");o.setAttribute("type","search"),o.setAttribute("role","combobox"),o.setAttribute("aria-expanded","true"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-label",this.#e("gantt.picker.search")),this.#c=o;const p=m(u,"div","picker-list");p.setAttribute("role","listbox"),p.setAttribute("aria-multiselectable",this.#d===1?"false":"true"),p.setAttribute("aria-label",this.#e("gantt.picker.list")),p.setAttribute("id",`${H}-picker-list-${this.#n}`),p.setAttribute("tabindex","-1"),o.setAttribute("aria-controls",p.getAttribute("id")),this.#b=p;const $=m(u,"div","picker-chosen");$.setAttribute("role","group"),$.setAttribute("aria-label",this.#e("gantt.picker.selected")),this.#r=$;const h=m(u,"div","picker-warn");h.setAttribute("role","status"),h.setAttribute("aria-live","polite"),h.setAttribute("aria-atomic","true"),this.#m=h;const y=m(u,"div","picker-actions"),i=m(u,"button","picker-apply",this.#e("gantt.picker.apply"));i.setAttribute("type","button"),i.addEventListener("click",b=>this.#A(b));const r=m(u,"button","picker-cancel",this.#e("gantt.picker.cancel"));r.setAttribute("type","button"),r.addEventListener("click",()=>this.close()),y.appendChild(i),y.appendChild(r),a.appendChild(o),a.appendChild(p),a.appendChild($),a.appendChild(h),a.appendChild(y),a.addEventListener("keydown",b=>this.#V(b)),o.addEventListener("input",()=>{this.#a=o.value,this.#h=0,this.#x()}),this.#f=a,(u.body||u.documentElement).appendChild(a),this.#y=b=>{this.#f&&!this.#f.contains(b.target)&&this.close()},u.addEventListener("pointerdown",this.#y,!0),this.#x(),o.focus()}#T(){const u=this.#f;if(!u)return;const f=this.#i.defaultView,d=f&&f.innerWidth||this.#i.documentElement.clientWidth,S=f&&f.innerHeight||this.#i.documentElement.clientHeight,_=4,C=this.#D.getBoundingClientRect();u.style.maxHeight=`${Math.max(120,Math.min(420,S-2*_))}px`;const a=u.offsetWidth,o=u.offsetHeight;let p=Math.round(C.left);p=Math.max(_,Math.min(p,d-a-_));let $=Math.round(C.bottom+2);if($+o>S-_){const h=Math.round(C.top-2-o);$=h>=_?h:Math.max(_,S-o-_)}u.style.left=`${p}px`,u.style.top=`${$}px`}#N(){const u=this.#a.trim().toLowerCase();return u?this.#p.filter(f=>this.#w(f).toLowerCase().includes(u)):this.#p}#E(){return[...this.#l].map(([u,f])=>({resource:u,units:f}))}#x(){const u=this.#i,f=this.#P(),d=f?f.es:0,S=f?f.ef:0,_=this.#E(),C=this.#t.previewAssignments(this.#n,_),a=this.#t.resourceModels,o=this.#b;for(;o.firstChild;)o.removeChild(o.firstChild);const p=this.#N();if(this.#h>=p.length&&(this.#h=Math.max(0,p.length-1)),p.forEach((y,i)=>{const{load:r,capacity:b}=l(C,y,d,S,a.has(y)?a.get(y).capacityUnits:1),T=this.#l.has(y),j=r>b+1e-9,I=m(u,"div",`picker-option${j?` ${H}__picker-option--over`:""}`);I.setAttribute("role","option"),I.setAttribute("id",`${H}-picker-opt-${this.#n}-${i}`),I.setAttribute("aria-selected",T?"true":"false"),I.setAttribute("data-resource",y),I.setAttribute("data-load",String(r)),I.setAttribute("data-capacity",String(b)),i===this.#h&&I.setAttribute("data-active","true");const O=this.#w(y);I.appendChild(Y(u,{name:O,avatar:this.#t.resourceAvatars.get(y)}));const z=m(u,"span","picker-option-text",`${O} — ${this.#e("gantt.picker.load",{load:v(r),capacity:v(b)})}`);I.appendChild(z),I.addEventListener("click",()=>{this.#h=i,this.#O(y)}),o.appendChild(I)}),!p.length){const y=m(u,"div","picker-none",this.#e("gantt.picker.none"));y.setAttribute("role","presentation"),o.appendChild(y)}this.#c&&(p.length?this.#c.setAttribute("aria-activedescendant",`${H}-picker-opt-${this.#n}-${this.#h}`):this.#c.removeAttribute("aria-activedescendant"));const $=this.#r,h=u.activeElement&&$.contains(u.activeElement)?u.activeElement.getAttribute("data-for"):null;for(;$.firstChild;)$.removeChild($.firstChild);for(const[y,i]of this.#l){const r=this.#w(y),b=m(u,"div","picker-row");if(b.setAttribute("data-resource",y),b.appendChild(Y(u,{name:r,avatar:this.#t.resourceAvatars.get(y)})),b.appendChild(m(u,"span","picker-row-name",r)),this.#g){const j=m(u,"input","picker-units");j.setAttribute("type","number"),j.setAttribute("min","0"),j.setAttribute("max","1000"),j.setAttribute("step","5"),j.setAttribute("aria-label",this.#e("gantt.picker.units",{name:r})),j.setAttribute("data-for",y),j.value=String(v(i)),j.addEventListener("input",()=>{const I=Number(j.value);j.value===""||!Number.isFinite(I)||I<0||(this.#l.set(y,I/100),this.#K())}),b.appendChild(j),h===y&&j.focus()}const T=m(u,"button","picker-remove","×");T.setAttribute("type","button"),T.setAttribute("aria-label",this.#e("gantt.picker.remove",{name:r})),T.addEventListener("click",()=>{this.#l.delete(y),this.#x(),this.#c&&this.#c.focus()}),b.appendChild(T),$.appendChild(b)}this.#ot(C,_)}#K(){const u=this.#P(),f=u?u.es:0,d=u?u.ef:0,S=this.#E(),_=this.#t.previewAssignments(this.#n,S),C=this.#t.resourceModels;for(const a of this.#b.querySelectorAll('[role="option"]')){const o=a.getAttribute("data-resource"),{load:p,capacity:$}=l(_,o,f,d,C.has(o)?C.get(o).capacityUnits:1);a.setAttribute("data-load",String(p)),a.setAttribute("data-capacity",String($));const h=a.querySelector(`.${H}__picker-option-text`);h&&(h.textContent=`${this.#w(o)} — ${this.#e("gantt.picker.load",{load:v(p),capacity:v($)})}`),a.setAttribute("class",`${H}__picker-option${p>$+1e-9?` ${H}__picker-option--over`:""}`)}this.#ot(_,S)}#ot(u,f){const d=L(u,this.#n),S=this.#m;S.setAttribute("data-over",d.length?"true":"false"),S.setAttribute("class",`${H}__picker-warn${d.length?` ${H}__picker-warn--over`:""}`),S.textContent=d.length?d.map(_=>this.#e("gantt.picker.warn",{name:this.#w(_.resource),load:v(_.load),capacity:v(_.capacity)})).join(". "):f.length?this.#e("gantt.picker.ok"):"",this.#T()}#O(u){this.#l.has(u)?this.#l.delete(u):(this.#l.size>=this.#d&&this.#l.delete(this.#l.keys().next().value),this.#l.set(u,1)),this.#x(),this.#c&&this.#c.focus()}#V(u){const f=this.#N(),d=u.target instanceof Element&&u.target.classList.contains(`${H}__picker-units`);if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),this.close();return}if(u.key==="Tab"&&this.#f){const S=[...this.#f.querySelectorAll("input, button")].filter(a=>!a.disabled),_=S[0],C=S[S.length-1];u.shiftKey&&this.#i.activeElement===_?(u.preventDefault(),C.focus()):!u.shiftKey&&this.#i.activeElement===C&&(u.preventDefault(),_.focus());return}if(d){u.key==="Enter"&&(u.preventDefault(),this.#A(u));return}if(!(u.target instanceof Element&&u.target.tagName==="BUTTON")){if(u.key==="ArrowDown"||u.key==="ArrowUp"){if(u.preventDefault(),!f.length)return;this.#h=(this.#h+(u.key==="ArrowDown"?1:-1)+f.length)%f.length,this.#x()}else if(u.key==="Home"||u.key==="End"){if(u.target===this.#c&&this.#a)return;u.preventDefault(),this.#h=u.key==="Home"?0:Math.max(0,f.length-1),this.#x()}else if((u.key==="Enter"||u.key===" ")&&f.length){if(u.key===" "&&this.#a)return;u.preventDefault(),this.#O(f[this.#h])}}}#A(u=null){const f=U(this.#t.taskById(this.#n)||{}),d=this.#E();f.length===d.length&&f.every(_=>this.#l.has(_.resource)&&Math.abs(this.#l.get(_.resource)-_.units)<1e-9)||this.#t.applyEdit({id:this.#n,assignments:d},{writeBack:!0,event:u}),this.close()}close(){if(!this.#f)return;this.#y&&this.#i.removeEventListener("pointerdown",this.#y,!0),this.#f.remove(),this.#f=null;const u=this.#s;this.#o();const f=u&&u.isConnected?u:this.#i.querySelector(`[data-picker-for="${this.#n}"]`);f&&f.focus&&f.focus()}get element(){return this.#f}}}),ae("packages/modules/gantt/link-editor.js",function(g,V){"use strict";Object.defineProperty(g,"LinkEditor",{enumerable:!0,get:function(){return H}});const U=V("packages/modules/gantt/schedule.js").LINK_TYPES,K="lat-gantt-split";function Y(l,L,v,m){const w=l.createElement(L);return v&&w.setAttribute("class",`${K}__${v}`),m!=null&&(w.textContent=m),w}class H{#t;#i;#e;#n;#s;#o;#l=null;#d=null;#g=null;#p=null;constructor(L,v,m,w,k,u){this.#t=L,this.#i=v,this.#e=m,this.#n=w,this.#s=k,this.#o=u,this.#h=k}#h;#a(){return this.#t.dependencies.find(v=>String(v.from)===this.#n.from&&String(v.to)===this.#n.to&&(v.type?String(v.type).toUpperCase():"FS")===this.#n.type)||this.#n}#f(){const L=this.#t.schedule,v=m=>L&&L.ok&&L.tasks.get(m)&&L.tasks.get(m).name||m;return{from:v(this.#n.from),to:v(this.#n.to)}}open(){const L=this.#i,v=this.#a(),m=this.#f(),w=Y(L,"div","picker");w.setAttribute("role","dialog"),w.setAttribute("aria-label",this.#e("gantt.linkEditor.title",m));const k=Y(L,"select","linkeditor-type");k.setAttribute("aria-label",this.#e("gantt.linkEditor.type"));for(const C of U){const a=L.createElement("option");a.setAttribute("value",C),a.textContent=C,k.appendChild(a)}k.value=v.type?String(v.type).toUpperCase():"FS",this.#d=k;const u=Y(L,"input","linkeditor-lag");u.setAttribute("type","number"),u.setAttribute("step","1"),u.setAttribute("aria-label",this.#e("gantt.linkEditor.lag")),u.value=String(Number.isFinite(v.lag)?v.lag:0),this.#g=u;const f=Y(L,"div","picker-actions"),d=Y(L,"button","picker-apply",this.#e("gantt.linkEditor.apply"));d.setAttribute("type","button"),d.addEventListener("click",C=>this.#r(C));const S=Y(L,"button","picker-remove",this.#e("gantt.linkEditor.delete"));S.setAttribute("type","button"),S.addEventListener("click",C=>this.#m(C));const _=Y(L,"button","picker-cancel",this.#e("gantt.linkEditor.cancel"));_.setAttribute("type","button"),_.addEventListener("click",()=>this.close()),f.appendChild(d),f.appendChild(S),f.appendChild(_),w.appendChild(k),w.appendChild(u),w.appendChild(f),w.addEventListener("keydown",C=>this.#b(C)),this.#l=w,(L.body||L.documentElement).appendChild(w),this.#c(),this.#p=C=>{this.#l&&!this.#l.contains(C.target)&&this.close()},L.addEventListener("pointerdown",this.#p,!0),k.focus()}#c(){const L=this.#l;if(!L)return;const v=this.#i.defaultView,m=v&&v.innerWidth||this.#i.documentElement.clientWidth,w=v&&v.innerHeight||this.#i.documentElement.clientHeight,k=4,u=this.#h&&this.#h.getBoundingClientRect?this.#h.getBoundingClientRect():{left:k,bottom:k,top:k},f=L.offsetWidth,d=L.offsetHeight;let S=Math.round(u.left);S=Math.max(k,Math.min(S,m-f-k));let _=Math.round(u.bottom+2);if(_+d>w-k){const C=Math.round(u.top-2-d);_=C>=k?C:Math.max(k,w-d-k)}L.style.left=`${S}px`,L.style.top=`${_}px`}#b(L){if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),this.close();return}if(L.key==="Tab"&&this.#l){const v=[...this.#l.querySelectorAll("select, input, button")].filter(k=>!k.disabled),m=v[0],w=v[v.length-1];L.shiftKey&&this.#i.activeElement===m?(L.preventDefault(),w.focus()):!L.shiftKey&&this.#i.activeElement===w&&(L.preventDefault(),m.focus())}else L.key==="Enter"&&L.target!==this.#l.querySelector(`.${K}__picker-cancel`)&&(L.preventDefault(),this.#r(L))}#r(L=null){const v=this.#d.value,m=Number(this.#g.value),w=this.#a(),k=this.#t.dependencies.filter(u=>!(String(u.from)===w.from&&String(u.to)===w.to&&(u.type?String(u.type).toUpperCase():"FS")===w.type));k.push({from:w.from,to:w.to,type:v,lag:Number.isFinite(m)?m:0}),this.#t.setDependencies(k,{event:L}),this.close()}#m(L=null){const v=this.#a();this.#t.deleteDependency({from:v.from,to:v.to,type:v.type},{event:L}),this.close()}close(){if(!this.#l)return;this.#p&&this.#i.removeEventListener("pointerdown",this.#p,!0),this.#l.remove(),this.#l=null;const L=this.#s;if(this.#o(),L&&L.isConnected&&L.focus){L.focus();return}const v=this.#i.querySelector(`.${K}__barrow[data-task="${this.#n.from}"]`);v&&v.focus&&v.focus()}get element(){return this.#l}}}),ae("packages/modules/gantt/workload-groups.js",function(g,V){"use strict";Object.defineProperty(g,"GROUP_KEY_PREFIX",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"isGroupKey",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"normalizeGroupBy",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"groupOfResource",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"groupBookingSubRows",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"groupWorkloadRows",{enumerable:!0,get:function(){return v}});const St="group:";function U(m){return typeof m=="string"&&m.startsWith(St)}function K(m){return typeof m=="function"||typeof m=="string"&&m.trim()!==""?m:null}function Y(m,w){let k=null;try{k=typeof m=="function"?m(w):w?w[m]:null}catch{k=null}return k==null||k===""?null:String(k)}function H(m,w){return Array.isArray(w)?m?m.map((k,u)=>{const f=w[u];return f==null?k:k==null?f:k+f}):w.map(k=>k??null):m}function l(m,w){return w==null||!Number.isFinite(w)?m:m==null?w:m+w}function L(m){const w=[],k=new Map;for(const u of m){if(!u.external||u.group==null){w.push(u);continue}const f=k.get(u.group);if(f){f.cells=H(f.cells,u.cells),f.total+=Number(u.total)||0,f.bookings.push(u);continue}const d={...u,id:`${St}${u.group}`,name:u.group,cells:H(null,u.cells),total:Number(u.total)||0,bookings:[u]};k.set(u.group,d),w.push(d)}return w}function v(m,w){const k=new Map;for(const f of m){const d=w(f.resource==null?null:f.resource);k.has(d)||k.set(d,[]),k.get(d).push(f)}return[...k.keys()].sort((f,d)=>f==null?d==null?0:1:d==null?-1:f.localeCompare(d,void 0,{numeric:!0,sensitivity:"base"})).map(f=>{const d=k.get(f);let S=null,_=null,C=null,a=null,o=null,p=0;for(const h of d)S=H(S,h.cells),_=H(_,h.available),C=H(C,h.costCells),a=l(a,h.availableTotal),o=l(o,h.costTotal),p+=Number(h.total)||0;S=S||[];const $=S.map((h,y)=>h!=null&&_!=null&&_[y]!=null&&h>_[y]+1e-9);return{value:f,key:`${St}${f??""}`,rows:d,cells:S,available:_,availableTotal:a,total:p,costCells:C,costTotal:o,over:$}})}}),ae("packages/modules/gantt/workload-events.js",function(g,V){"use strict";Object.defineProperty(g,"WORKLOAD_CELL_EVENTS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"emitWorkloadCell",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"gateWorkloadCell",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"workloadCellPayload",{enumerable:!0,get:function(){return l}});const U=V("packages/modules/gantt/time.js").toISODate,K=Object.freeze(["workloadCellClick","workloadCellDblClick","workloadCellContextMenu","workloadCellHover","workloadCellHoverEnd","workloadResourceClick"]);function Y(L,v,m){L&&typeof L.emitWorkloadCell=="function"&&L.emitWorkloadCell(v,m)}function H(L,v,m){return!L||typeof L.gateWorkloadCell!="function"?!0:L.gateWorkloadCell(v,m)}function l({view:L,unit:v,resourceName:m,rows:w,buckets:k,rowKey:u,index:f,sub:d,rec:S,event:_}){const C=Array.isArray(w)?w.find(i=>(i.resource==null?"":i.resource)===u):null,a=Array.isArray(k)?k[f]:null;if(!C||!a)return null;const o=C.cells&&C.cells[f]!=null?C.cells[f]:0,p=Array.isArray(C.available)?C.available[f]??null:null,$=p!=null&&p>0?o/p*100:null,h=Array.isArray(C.over)?!!C.over[f]:!1,y=(Array.isArray(C.tasks)?C.tasks:[]).filter(i=>(i.cells&&i.cells[f]?i.cells[f]:0)>0).map(i=>({id:String(i.id),name:i.name,hours:i.cells[f],units:i.units??null}));return{resource:C.resource,resourceName:m,bucketStart:U(a.start)??String(a.start),bucketEnd:U(a.end)??String(a.end),booked:o,available:p,percent:$,over:h,unit:v,tasks:y,id:d?String(d.id):null,rawTask:d?d.raw??null:null,task:S??null,view:L,event:_}}}),ae("packages/modules/gantt/link-text.js",function(g,V){"use strict";Object.defineProperty(g,"LINK_COLUMN_ROLE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"refOf",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"buildRefIndex",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"formatLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"linksText",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"parseLinkText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"planLinkEdit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"buildLinkColumns",{enumerable:!0,get:function(){return k}});const U=V("packages/modules/gantt/schedule.js").wouldCreateCycle,K=Object.freeze({predecessors:"to",successors:"from"}),Y=/^([^\s+\-]+?)\s*(FS|SS|FF|SF)?\s*(?:([+-])\s*(\d+(?:\.\d+)?))?$/i;function H(u,f){return u&&u.wbs!=null&&u.wbs!==""?String(u.wbs):String(f)}function l(u){const f=new Map,d=new Map;let S=0;for(const[_,C]of u){S+=1;const a=H(C,S);f.set(_,a),d.set(a.toLowerCase(),_)}return{byId:f,byRef:d}}function L(u,f){const d=f.type?String(f.type).toUpperCase():"FS",S=Number(f.lag),_=Number.isFinite(S)&&S!==0?`${S>0?"+":"-"}${Math.round(Math.abs(S)*100)/100}`:"";return`${u}${d}${_}`}function v(u,f,d,S){const _=K[f],C=_==="to"?"from":"to",a=[];for(const o of d){if(String(o[_])!==u)continue;const p=S.get(String(o[C]));p!=null&&a.push(L(p,o))}return a.join("; ")}function m(u){const f=[];for(const d of String(u??"").split(/[;,]/)){const S=d.trim();if(!S)continue;const _=Y.exec(S);if(!_)return{tokens:f,bad:S};const C=_[3]?(_[3]==="-"?-1:1)*Number(_[4]):0;f.push({token:S,ref:_[1],type:_[2]?_[2].toUpperCase():"FS",lag:C})}return{tokens:f,bad:null}}function w({id:u,column:f,text:d,dependencies:S,refs:_}){const C=K[f],a=C==="to"?"from":"to",{tokens:o,bad:p}=m(d);if(p!=null)return{ok:!1,key:"gantt.link.invalid",token:p};const $=[],h=new Set;for(const W of o){const B=_.byRef.get(W.ref.toLowerCase());if(B==null)return{ok:!1,key:"gantt.link.unknownRef",token:W.token};if(B===u)return{ok:!1,key:"gantt.link.self",token:W.token};const at=`${B}${W.type}`;if(h.has(at))return{ok:!1,key:"gantt.link.duplicate",token:W.token};h.add(at),$.push({...W,other:B})}const y=W=>String(W[C])===u,i=W=>`${String(W[a])}${W.type?String(W.type).toUpperCase():"FS"}`,r=new Map(S.filter(y).map(W=>[i(W),W])),b=S.filter(W=>!y(W)),T=[],j=[];for(const W of $){const B=r.get(`${W.other}${W.type}`);if(B)if((Number(B.lag)||0)===W.lag)T.push(B);else{const{lag:ct,...kt}=B;T.push(W.lag?{...kt,lag:W.lag}:kt)}else j.push({w:W,dep:C==="to"?{from:W.other,to:u,type:W.type}:{from:u,to:W.other,type:W.type}})}const I=[...b,...T];for(const{w:W,dep:B}of j){if(U(I,B.from,B.to))return{ok:!1,key:"gantt.link.cycle",token:W.token};I.push(B)}const O=[...b,...T,...j.map(({w:W,dep:B})=>W.lag?{...B,lag:W.lag}:B)];return{ok:!0,next:O.length===S.length&&O.every(W=>S.some(B=>B===W))?null:O}}function k({t:u,editable:f}){const d=new Map;for(const S of Object.keys(K))d.set(S,{id:S,field:S,title:u(`gantt.col.${S}`),type:"text",layout:{width:120},edit:{enabled:f}});return d}}),ae("packages/modules/gantt/task-columns.js",function(g,V){"use strict";Object.defineProperty(g,"EXTRA_TASK_COLUMN_IDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"VARIANCE_LATE_CLASS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"varianceText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"extraRowData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"extraEditPatch",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"buildExtraTaskColumns",{enumerable:!0,get:function(){return d}});const St=V("packages/modules/gantt/schedule.js"),U=St.CONSTRAINT_TYPES,K=St.resolveConstraintCode,H=V("packages/modules/gantt/time.js").toISODate,l=Object.freeze(["constraint","constraintDate","earlyStart","lateStart","lateFinish","baselineStart","baselineEnd","variance","note","sequence"]),L="lat-gantt-variance--late";function v(S){return S!=null&&typeof S=="object"&&!Array.isArray(S)&&!(S instanceof Date)}function m(S){return Number.isFinite(S)?H(S)??String(S):null}function w(S){if(!Number.isFinite(S))return"";const _=Math.round(S*100)/100;return _>0?`+${_}`:String(_)}function k(S){const _=S?S.constraint??S.constraintType:null,C=K(_),a=v(_)?_.date??_.at??_.constraintDate:S&&(S.constraintDate??S.constraintAt??S.at);let o=null;return a!=null&&a!==""&&(o=typeof a=="number"?m(a):String(a instanceof Date?a.toISOString().slice(0,10):a)),{type:C,date:o}}function u(S,_,C){const{type:a,date:o}=k(_);return{constraint:a,constraintDate:o,earlyStart:m(S.es),lateStart:m(S.ls),lateFinish:m(S.lf),baselineStart:m(S.baselineStart),baselineEnd:m(S.baselineEnd),variance:Number.isFinite(S.finishVariance)?S.finishVariance:null,note:_.note??null,sequence:C}}function f(S,_,C){const a=C==null||C==="";if(_==="note")return{note:a?null:String(C)};if(v(S&&S.constraint)){const o={...S.constraint};return _==="constraint"?o.type=a?"ASAP":C:o.date=a?null:C,{constraint:o}}return _==="constraint"?{constraint:a?"ASAP":C}:{constraintDate:a?null:C}}function d({t:S,editable:_,dateFormat:C,dateEditor:a}){const o=new Map,p=($,h)=>({id:$,field:$,title:S(`gantt.col.${$}`),type:"date",format:C,layout:{width:96},edit:h?{enabled:_,editor:a}:{enabled:!1}});o.set("constraint",{id:"constraint",field:"constraint",title:S("gantt.col.constraint"),layout:{width:150},lookup:{options:U.map($=>({id:$,label:S(`gantt.constraint.${$}`)})),sortBy:"optionOrder"},edit:{enabled:_,editor:"select"}}),o.set("constraintDate",p("constraintDate",!0));for(const $ of["earlyStart","lateStart","lateFinish","baselineStart","baselineEnd"])o.set($,p($,!1));return o.set("variance",{id:"variance",field:"variance",title:S("gantt.col.variance"),type:"number",layout:{width:84},edit:{enabled:!1},format:$=>w($&&$.value),cell:{classWhen:{[L]:$=>!!($&&$.row&&$.row.data&&$.row.data.variance>0)}}}),o.set("note",{id:"note",field:"note",title:S("gantt.col.note"),layout:{width:180},edit:{enabled:_}}),o.set("sequence",{id:"sequence",field:"sequence",title:S("gantt.col.sequence"),type:"number",layout:{width:56},edit:{enabled:!1}}),o}}),ae("packages/modules/gantt/split-grid-fixed.js",function(g,V){"use strict";Object.defineProperty(g,"drawnWidths",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"freezeFlexColumns",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"installFixedWidths",{enumerable:!0,get:function(){return Y}});const St="[data-resize]";function U(H){const l=new Map;if(!H||typeof H.querySelectorAll!="function")return l;for(const L of H.querySelectorAll(".lat-header-cell[data-col]")){const v=Math.round(L.getBoundingClientRect().width);v>0&&l.set(L.getAttribute("data-col"),v)}return l}function K(H,l){if(!H||!H.columns)return!1;const L=U(l);let v=!1;for(const m of H.columns.all()){const w=m&&m.layout;if(!w||!(w.flex>0))continue;const k=L.get(m.id);k>0&&(w.width=k,w.flex=0,v=!0)}return v}function Y(H,l){const L=v=>{const m=v.target;m&&typeof m.closest=="function"&&m.closest(St)&&K(l,H)};return H.addEventListener("pointerdown",L,!0),H.addEventListener("keydown",L,!0),()=>{H.removeEventListener("pointerdown",L,!0),H.removeEventListener("keydown",L,!0)}}}),ae("packages/modules/gantt/split-grid.js",function(g,V){"use strict";Object.defineProperty(g,"KEEP_COL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"keptAncestors",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"deriveParentKeys",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"compareCellValues",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"treeSortRows",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"normalizeColumn",{enumerable:!0,get:function(){return C}}),Object.defineProperty(g,"mergeColumn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(g,"resolveTableColumns",{enumerable:!0,get:function(){return p}}),Object.defineProperty(g,"SplitGridTable",{enumerable:!0,get:function(){return $}});const St=V("packages/modules/gantt/wbs.js"),U=St.compareWbs,K=St.isWbsCode,Y=V("packages/modules/gantt/split-grid-fixed.js"),H=Y.freezeFlexColumns,l=Y.installFixedWidths,L=Y.drawnWidths,v="__keep",m=Object.freeze({col:v,type:"text",op:"eq",value:"1"}),w=Object.freeze({id:v,field:v,title:v,type:"text",layout:{hidden:!0,resizable:!1},edit:{enabled:!1},sort:!1,quickFilter:!1});function k(h,y){const i=new Set(h),r=new Set;for(const b of i)for(let T=y.get(b);T!=null&&!r.has(T)&&!i.has(T);T=y.get(T))r.add(T);return r}const u=["value","cell","edit","layout","header","sort","filter","validation","export"];function f(h){const y=new Map,i=[];for(const r of h){const b=Number(r.__depth)||0;for(;i.length&&i[i.length-1].depth>=b;)i.pop();const T=String(r.__key);y.set(T,i.length?i[i.length-1].key:null),i.push({key:T,depth:b})}return y}function d(h,y){const i=h==null||h==="",r=y==null||y==="";if(i&&r)return 0;if(i)return 1;if(r)return-1;if(typeof h=="number"&&typeof y=="number")return h-y;if(h instanceof Date&&y instanceof Date)return h.getTime()-y.getTime();if(K(h)&&K(y))return U(h,y);const b=String(h),T=String(y);return b<T?-1:b>T?1:0}function S(h,y,i){const r=(y||[]).map(B=>({field:B&&i(B.col),desc:!!B&&(B.dir==="desc"||B.descending===!0)})).filter(B=>B.field!=null);if(!h.length||!r.length)return h;const b=h.filter(B=>B.__pinLast);if(b.length)return[...S(h.filter(B=>!B.__pinLast),y,i),...b];const T=f(h),j=new Map(h.map(B=>[String(B.__key),B])),I=new Map;for(const B of h){const at=String(B.__key),ct=T.get(at);I.has(ct)||I.set(ct,[]),I.get(ct).push(at)}const O=(B,at)=>{const ct=j.get(B),kt=j.get(at);for(const{field:Tt,desc:Ft}of r){const D=ct[Tt],P=kt[Tt],x=D==null||D==="",R=P==null||P==="";if(x||R){if(x&&R)continue;return x?1:-1}const N=d(D,P);if(N)return Ft?-N:N}return B<at?-1:B>at?1:0};for(const B of I.values())B.sort(O);const z=[],W=B=>{for(const at of I.get(B)||[])z.push(j.get(at)),W(at)};return W(null),z}function _(h){return h!=null&&typeof h=="object"&&!Array.isArray(h)}function C(h){const y={...h};y.id==null&&y.key!=null&&(y.id=String(y.key)),delete y.key,delete y.kind;const i=_(y.layout)?{...y.layout}:Number.isFinite(y.layout)?{width:y.layout}:{};return Number.isFinite(h.width)&&i.width==null&&(h.width>0?i.width=h.width:i.flex=1),Number.isFinite(h.minWidth)&&i.min==null&&(i.min=h.minWidth),Number.isFinite(h.maxWidth)&&i.max==null&&(i.max=h.maxWidth),typeof h.resizable=="boolean"&&i.resizable==null&&(i.resizable=h.resizable),typeof h.hidden=="boolean"&&i.hidden==null&&(i.hidden=h.hidden),typeof h.pin=="string"&&i.pin==null&&(i.pin=h.pin),delete y.width,delete y.minWidth,delete y.maxWidth,delete y.resizable,delete y.hidden,delete y.pin,Object.keys(i).length&&(y.layout=i),typeof h.editable=="boolean"&&y.edit==null&&(y.edit={enabled:h.editable}),delete y.editable,_(y.editor)&&a(y),delete y.editor,y}function a(h){const y=h.editor;if(!_(y)||typeof y.type!="string")return;const i=_(h.edit)?{...h.edit}:{};i.editor==null&&(i.editor=y.type);const r={..._(i.props)?i.props:{}};if(y.type==="select"){const b=_(h.lookup)?{...h.lookup}:{};y.options!=null&&(b.options=y.options),b.sortBy==null&&(b.sortBy="optionOrder"),h.lookup=b}else if(y.type==="number"){for(const b of["min","max","step"])Number.isFinite(y[b])&&(r[b]=y[b]);r.clamp==null&&(r.clamp=!0),Number.isFinite(y.step)&&r.spinner==null&&(r.spinner=!0)}Object.keys(r).length&&(i.props=r),i.enabled==null&&(i.enabled=!0),Object.keys(i).length&&(h.edit=i)}function o(h,y){const i={...h,...y};for(const r of u)_(h[r])&&_(y[r])&&(i[r]={...h[r],...y[r]});return _(i.layout)&&i.layout.width>0&&_(h.layout)&&h.layout.flex>0&&_(y.layout)&&y.layout.flex==null&&(i.layout.flex=0),i}function p(h,y,i,r){const b=Array.isArray(h)&&h.length?h:i,T=[],j=new Set;for(const I of b){let O=null;if(typeof I=="string")O=y.has(I)?{...y.get(I)}:null;else if(_(I)){const z=C(I),W=y.has(z.id)?z.id:typeof I.kind=="string"&&y.has(I.kind)?I.kind:null;O=W?o(y.get(W),z):z,W&&O.id==null&&(O.id=W)}!O||O.id==null||j.has(String(O.id))||(O.id=String(O.id),j.add(O.id),T.push(O))}return!j.has(r)&&y.has(r)&&T.unshift({...y.get(r)}),T}class ${host;grid=null;#t=new Map;#i;#e=!1;#n=[];#s=!1;#o={filters:null,quick:"",mode:void 0};#l=null;#d=!1;#g=new Map;#p=[];#h=[];#a=[];constructor({createGrid:y,host:i,columns:r,rowHeight:b,headerHeight:T,config:j,keepAncestors:I,ancestorClass:O,treeSort:z}){this.host=i,this.#i=b,this.#s=!!I,this.#d=!!z,this.#d&&(this.#g=new Map(r.map(at=>[String(at.id),String(at.field!=null?at.field:at.id)])));const W=_(j)?j:{},B=W.rowClass;this.grid=y(i,{...W,...this.#s?{rowClass:at=>{const ct=typeof B=="function"?B(at):B||[],kt=Array.isArray(ct)?ct.slice():[ct];return at&&at.data&&at.data.__ancestor&&kt.push(O),kt.filter(Boolean)}}:{},rows:[],rowKey:"__key",columns:this.#s?[...r,{...w}]:r,headerHeight:T,rowHeight:at=>this.#t.get(String(at&&at.key))||this.#i}),this.grid&&this.#n.push(l(i,this.grid)),this.#s&&this.grid&&this.#r(),this.#d&&this.grid&&this.#f()}#f(){const y=this.grid,i=this;Object.defineProperty(y,"sort",{value:{get:()=>i.#p.map(b=>({...b})),set:b=>{const T=(Array.isArray(b)?b:[]).filter(j=>j&&typeof j.col=="string"&&i.#g.has(j.col)).map(j=>({col:j.col,dir:j.dir==="desc"||j.descending===!0?"desc":"asc"}));if(T.length===1&&T[0].dir==="asc"){const{col:j}=T[0],I=i.#p.length===1&&i.#p[0].col===j?i.#p[0].dir:null;i.#c(I==="asc"?[{col:j,dir:"desc"}]:I==="desc"?[]:T)}else i.#c(T)},clear:()=>i.#c([])},configurable:!0})}#c(y){this.#p=y.map(i=>({...i})),this.#b();for(const i of this.#a.slice())i({sort:this.#p.map(r=>({...r}))})}#b(){if(!this.grid)return;const y=this.#p.length?S(this.#h,this.#p,i=>this.#g.get(i)):this.#h;this.grid.rows.load(y)}#r(){const y=this.grid,i=y.filters;this.#l=i;const r=this.#o,b={...i,get:()=>r.filters,set:T=>{r.filters=T&&Object.keys(T).length?T:null,this.#m()},clear:()=>{r.filters=null,r.quick="",this.#m()},quick:(T,j)=>{r.quick=String(T||"").trim(),j&&typeof j.mode=="string"&&(r.mode=j.mode),this.#m()},quickState:()=>({text:r.quick,mode:r.mode||"contains"})};Object.defineProperty(y,"filters",{value:b,configurable:!0})}#m(){const{filters:y,quick:i}=this.#o,r=[];y&&r.push(y);const b=i?this.#y(i):null;b&&r.push(b);let T=null;r.length===1?T=r[0]:r.length>1&&(T={op:"and",conditions:r});const j=T?{op:"or",conditions:[T,{...m}]}:null,I=this.#l;I.quick(""),I.set(j)}#y(y){const r=this.grid.columns.all().filter(b=>b.id!==v&&b.quickFilter!==!1&&(b.type==null||b.type==="text"||b.type==="string")).map(b=>({col:b.id,op:"contains",value:y}));return r.length?r.length===1?r[0]:{op:"or",conditions:r}:null}isFiltering(){return!!(this.#o.filters||this.#o.quick)}on(y,i){if(this.#d&&y==="sort:changed"){this.#a.push(i),this.#n.push(()=>{const b=this.#a.indexOf(i);b>=0&&this.#a.splice(b,1)});return}const r=this.grid&&typeof this.grid.on=="function"?this.grid.on(y,i):null;typeof r=="function"&&this.#n.push(r)}setRows(y,i){this.grid&&(this.#t=i,this.#d?(this.#h=y,this.#b()):this.grid.rows.load(y))}displayedKeys(){const y=[];return this.grid&&this.grid.rows.forEach(i=>{i&&!i.group&&i.key!=null&&y.push(String(i.key))}),y}viewport(){return this.host.querySelector(".lat-body-viewport")}lockScroll(y){const i=b=>{if(this.#e)return;this.#e=!0;const T=this.viewport(),j=T?T.scrollTop:b&&Number.isFinite(b.top)?b.top:0;y.scrollTop!==j&&(y.scrollTop=j),this.#e=!1},r=()=>{if(this.#e||!this.grid)return;this.#e=!0;const b=this.viewport();b&&b.scrollTop!==y.scrollTop?b.scrollTop=y.scrollTop:!b&&this.grid.scroll&&this.grid.scroll.to({top:y.scrollTop}),this.#e=!1};this.on("scroll",i),y.addEventListener("scroll",r),this.#n.push(()=>y.removeEventListener("scroll",r))}getState(){const y=this.grid&&this.grid.state?this.grid.state.get():null;if(!y)return y;let i=y;return this.#s&&(Array.isArray(i.columns)&&(i.columns=i.columns.filter(r=>r&&r.id!==v)),Array.isArray(i.columnOrder)&&(i.columnOrder=i.columnOrder.filter(r=>r!==v)),this.#o.quick&&(i={...i,ganttQuick:this.#o.quick})),this.#d&&(i={...i,sort:this.#p.map(r=>({...r}))}),i}setState(y){if(!(!this.grid||!this.grid.state||!_(y))){for(const i of Array.isArray(y.columns)?y.columns:[]){const r=i&&this.grid.columns.get(i.id);r&&r.layout&&i.width>0&&!(i.flex>0)&&(r.layout.flex=0)}if(this.grid.state.apply(this.#d?{...y,sort:[]}:y),this.#s&&this.grid.filters.quick(typeof y.ganttQuick=="string"?y.ganttQuick:""),this.#d){const i=(Array.isArray(y.sort)?y.sort:[]).filter(r=>r&&typeof r.col=="string"&&this.#g.has(r.col)).map(r=>({col:r.col,dir:r.dir==="desc"||r.descending===!0?"desc":"asc"}));this.#c(i)}}}freezeColumns(){H(this.grid,this.host)}widths(){const y={};if(!this.grid)return y;for(const r of this.grid.columns.state())r.id!==v&&Number.isFinite(r.width)&&(y[r.id]=r.width);const i=L(this.host);for(const r of this.grid.columns.all())r.layout&&r.layout.flex>0&&i.has(r.id)&&r.id in y&&(y[r.id]=i.get(r.id));return y}destroy(){for(const y of this.#n.splice(0))y();this.grid&&(this.grid.destroy(),this.grid=null),this.host&&this.host.parentNode&&this.host.parentNode.removeChild(this.host)}}}),ae("packages/modules/gantt/band-grid.js",function(g,V){"use strict";Object.defineProperty(g,"bucketColumnSpec",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"bucketColumnWidths",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"pinStart",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"mountBandGrid",{enumerable:!0,get:function(){return Y}});function St({id:H,width:l,format:L=null,cell:v=null,edit:m=null}){const w={id:H,field:H,title:"",type:"number",headerControls:"none",sort:!1,filter:!1,quickFilter:!1,allowGroup:!1,allowPivot:!1,allowTotal:!1,layout:{width:Math.max(1,l),min:1,flex:0,pin:null,movable:!1,resizable:!1,lockVisible:!0},cell:{align:"right",...v||{}}};return L&&(w.format=L),m?w.edit=m:w.edit={enabled:!1},w}function U(H,l){return H.map(L=>Math.round(l(L.end))-Math.max(0,Math.round(l(L.start))))}function K(H,l,L,v={}){const m=Number.isFinite(v.minFill)?v.minFill:60,w=Number.isFinite(v.floor)?v.floor:40;let k=0;for(const f of H){if(f.id===L)continue;const d=f.layout&&typeof f.layout=="object"?f.layout:{},S=Number.isFinite(d.width)?d.width:typeof v.defaultWidth=="function"?v.defaultWidth(f,l):110;f.__w=Math.max(w,S),k+=f.__w}const u=Math.max(m,l-k);for(const f of H){const d=f.id===L?u:f.__w;delete f.__w,f.layout={...f.layout||{},width:d,flex:0,pin:"start"}}}function Y({createGrid:H,host:l,config:L,columns:v,headerHeight:m,rowHeight:w,rowClass:k,centreClass:u,onScroll:f}){const d=H(l,{...L,rows:[],rowKey:"__key",columns:v,headerHeight:m,rowHeight:w,rowClass:k});if(!d)return{grid:null,time:null,centre:null,offScroll:null};const S=l.querySelector(".lat-body-viewport"),_=l.querySelector(".lat-body-centre");_&&u&&_.classList.add(u);let C=null;return S&&f&&(S.addEventListener("scroll",f),C=()=>S&&S.removeEventListener("scroll",f)),{grid:d,time:S,centre:_,offScroll:C}}}),ae("packages/modules/gantt/date-editor.js",function(g,V){"use strict";Object.defineProperty(g,"SplitDateEditor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"default",{enumerable:!0,get:function(){return w}});const St=V("packages/modules/gantt/time.js"),U=St.toDayNumber,K=St.toISODate,Y=["yyyy","yy","MM","M","dd","d"];function H(k){const u=[];let f=0;for(;f<k.length;){if(k[f]==="'"){const S=k.indexOf("'",f+1);f=S<0?k.length:S+1;continue}const d=Y.find(S=>k.startsWith(S,f));if(!d){f+=1;continue}d[0]==="d"?u.push("d"):d[0]==="M"?u.push("M"):u.push("y"),f+=d.length}return u}function l(k){let u=[];try{const f=new Intl.DateTimeFormat(k||void 0,{year:"numeric",month:"numeric",day:"numeric"}).formatToParts(new Date(2e3,0,2));for(const d of f)d.type==="year"?u.push("y"):d.type==="month"?u.push("M"):d.type==="day"&&u.push("d")}catch{u=[]}return u.length===3?u:["y","M","d"]}function L(k,u){const f=String(k).match(/\d+/g);if(!f||f.length<3||!u||u.length<3)return null;const d={};for(let o=0;o<u.length;o+=1)d[u[o]]=Number(f[o]);let{y:S,M:_,d:C}=d;if(!Number.isFinite(S)||!Number.isFinite(_)||!Number.isFinite(C)||(S<100&&(S+=S<70?2e3:1900),_<1||_>12||C<1||C>31))return null;const a=`${String(S).padStart(4,"0")}-${String(_).padStart(2,"0")}-${String(C).padStart(2,"0")}`;return U(a)}function v(k,u,f){const d=String(k??"").trim();if(d==="")return null;if(/^-?\d+(\.\d+)?$/.test(d))return Number(d);const S=u&&u.format,_=S&&typeof S=="object"&&typeof S.pattern=="string"?S.pattern:null,C=_?H(_):l(f),a=L(d,C);if(Number.isFinite(a))return a;const o=U(d);return Number.isFinite(o)?o:null}class m{#t=null;#i=null;#e={};#n;#s="";#o;#l=null;init(u){this.#t=u||{},this.#i=this.#t.document||this.#t.cell&&this.#t.cell.ownerDocument||(typeof document<"u"?document:null),this.#e=this.#t.column||{},this.#n=this.#t.locale,this.#s=this.#t.text==null?"":String(this.#t.text),this.#o=this.#t.value;const f=this.#i.createElement("input");f.setAttribute("type","text"),f.setAttribute("class","lat-editor__input"),this.#e.title&&f.setAttribute("aria-label",String(this.#e.title)),f.value=this.#s,typeof this.#t.key=="string"&&this.#t.key.length===1&&(f.value=this.#t.key),this.#l=f}element(){return this.#l}focusTarget(){return this.#l}value(){const u=this.#l?this.#l.value:"";if(u===this.#s)return this.#o;const f=u.trim();if(f==="")return null;const d=v(f,this.#e,this.#n);return Number.isFinite(d)?K(d)??String(d):f}destroy(){this.#l=null,this.#t=null}}const w=m}),ae("packages/modules/gantt/issues-panel.js",function(g,V){"use strict";Object.defineProperty(g,"issuesPanelCss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"createIssuesPanel",{enumerable:!0,get:function(){return L}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=St.clear,H=Object.freeze({cycle:[{action:"removeLink",labelKey:"gantt.issues.fixRemoveLink"}],constraint:[{action:"asap",labelKey:"gantt.issues.fixAsap"}],lock:[{action:"unlock",labelKey:"gantt.issues.fixUnlock"},{action:"removeLink",labelKey:"gantt.issues.fixRemoveLink"}],deadline:[{action:"clearDeadline",labelKey:"gantt.issues.fixClearDeadline"}]});function l(v){return`
|
|
105
|
+
@scope ([data-theme="dark"]){:scope.${tt},.${tt}{color-scheme:dark}}
|
|
106
|
+
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${tt},.${tt}{color-scheme:light}}
|
|
107
|
+
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${tt},.${tt}{color-scheme:dark}}}
|
|
108
|
+
`.trim()}function Bt(Zt){const ct=Zt.documentElement;if(!ct||ct.getAttribute(Mt))return;ct.setAttribute(Mt,"1");const bt=Zt.createElement("style");bt.textContent=Ft($t()),(Zt.head||Zt.body||ct).appendChild(bt)}function pe(Zt,ct=0){return Zt==="weekends"?bt=>{const Ct=y(bt+ct),Dt=Ct?Ct.getUTCDay():0;return Dt===0||Dt===6}:typeof Zt=="function"?Zt:null}function we(Zt){return String(Zt??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Yt(Zt){const ct=Zt.attributes;if(!ct)return[];if(ct instanceof Map)return[...ct.entries()];const bt=[];for(let Ct=0;Ct<ct.length;Ct+=1)bt.push([ct[Ct].name,ct[Ct].value]);return bt}function re(Zt){const ct=Zt.tagName?Zt.tagName.toLowerCase():null;if(!ct)return"";const bt=Yt(Zt).map(([zt,Ut])=>` ${zt}="${we(Ut)}"`).join(""),Ct=Zt.children||[];if(Ct.length)return`<${ct}${bt}>${[...Ct].map(re).join("")}</${ct}>`;const Dt=Zt.textContent?we(Zt.textContent):"";return Dt?`<${ct}${bt}>${Dt}</${ct}>`:`<${ct}${bt}></${ct}>`}class Lt{#t;#i;#e;#n;#s=null;#o=null;#l=null;#h=null;#f=null;#p=null;#g=null;#a="";#d=null;#c=null;#y=null;#r=null;#m;#w=!1;#E=1;#P=0;#k=null;#M=null;#D=null;#j=null;#x=null;#U=null;#q=null;#O;#X=null;#C;#F=0;#V=null;#J=[];#rt=It;#Q=null;#dt=8;#N=Y();get ready(){return this.#N.promise}constructor(ct,bt,Ct={}){this.#t=ct,this.#i=bt,this.#e=bt.ownerDocument,this.#n={...Rt,...Ct},this.#F=r(this.#n.projectEpoch),this.#V=this.#tt(this.#n.today),this.#J=Ot(this.#n.markers,this.#F),this.#Kt(Ct),this.#rt=Number.isFinite(this.#n.width)?Number(this.#n.width):It,Bt(this.#e),this.#s=S(this.#e,"div",tt),this.#r=u(this.#s,this.#i),this.#i.appendChild(this.#s),this.#i.__latticeGantt||(this.#i.__latticeGantt=this),this.#n.tooltip&&(this.#l=S(this.#e,"div",`${tt}__tooltip`),this.#l.setAttribute("hidden",""),this.#h=S(this.#e,"div",`${tt}__tip-arrow`),this.#l.appendChild(this.#h),this.#s.appendChild(this.#l),this.#s.addEventListener("scroll",()=>this.#pt())),this.#g=S(this.#e,"div",`${tt}__live`),this.#g.setAttribute("role","status"),this.#g.setAttribute("aria-live","polite"),this.#s.appendChild(this.#g),this.#C=dt(ct,()=>this.#n.messages),this.#O=new j({doc:this.#e,controller:ct,options:()=>this.#n,plot:()=>this.#o,rowOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${tt}__row`):null,barOf:Dt=>Dt.querySelector(`.${tt}__bar`)||Dt.querySelector(`.${tt}__milestone`),pxPerDay:()=>this.#E,announce:Dt=>this.#re(Dt,{repeat:!0}),t:(Dt,zt)=>this.#C(Dt,zt),iso:Dt=>this.#Y(Dt),redraw:()=>this.draw(),previewDrag:Dt=>this.#Jt(Dt),focusTask:Dt=>{this.#d=Dt},editing:()=>!1,view:()=>this,progressOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${tt}__progresshandle`):null,resizeStartOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${tt}__resizehandle`):null,nsOf:()=>tt,scrollers:()=>[this.#s]}),this.#k=new nt({controller:ct,ns:tt,view:()=>this,rowOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${tt}__row`):null,dayAt:Dt=>this.#zt(Dt),date:Dt=>this.#n.dateAxis===!1?Dt:this.#Y(Dt),dragging:()=>this.#O.dragging,consumeDragRelease:()=>this.#O.consumeDragRelease(),keyboard:!!this.#n.keyboard}),this.#k.attach(this.#s),this.#n.editable&&this.#O.attachTouch(this.#s),this.#M=new ft({controller:ct,view:()=>this,linkOf:Dt=>Dt&&Dt.closest?Dt.closest(`.${tt}__link`):null}),this.#M.attach(this.#s),this.#D=Dt=>this.#ee(Dt),this.#s.addEventListener("contextmenu",this.#D),this.#ht(),this.#y=ct.on("schedule",()=>this.draw()),this.#m=Jt(Dt=>ct.emitDraw(Dt)),this.draw(),ct.emitViewMount({view:this,element:this.#s}),this.#N.settleAfterFrames()}#ht(){this.#n.width==="container"&&(this.#et(this.#n.zoom)||(this.#Q=v({targets:[this.#s,this.#i],read:()=>L([this.#s,this.#i],l),apply:ct=>{this.#rt=ct,this.#o&&this.draw()}})))}#Kt(ct){!ct||!Number.isFinite(ct.width)||this.#et(this.#n.zoom)&&U(`gantt.zoomWidth:${String(this.#n.zoom)}`,`[lattice] gantt: mount was given both zoom (${JSON.stringify(this.#n.zoom)}) and width (${ct.width}); zoom fixes the pixels-per-day, so the width is ignored and the plot scrolls. Drop one of the two.`)}#tt(ct){if(ct==null||ct==="")return null;if(Number.isFinite(ct))return Number(ct);const bt=i(ct);return Number.isFinite(bt)?bt-this.#F:(U(`gantt.today:${String(ct)}`,`[lattice] gantt: today ${JSON.stringify(ct)} is not a date or a day number; no today line is drawn.`),null)}#st(ct){return ct+this.#F}#Y(ct){return h(this.#st(ct))}get element(){return this.#s}get options(){return{...this.#n}}draw(){if(this.#w)return;const ct=this.#s;ct&&ct.setAttribute("aria-busy","true"),this.#ft(),ct&&ct.setAttribute("aria-busy","false")}#ft(){const ct=this.#t.schedule;if(!ct||!ct.ok)return;const bt=this.#n,Ct=ct.order,Dt=bt.rowLabels?bt.labelWidth:0,zt=this.#xt(ct),Ut=bt.axisHeight+zt.count*bt.rowHeight,oe=ct.projectStart,de=ct.projectFinish,me=this.#V,ve=[oe,de];Number.isFinite(me)&&ve.push(me);for(const Pe of this.#J)Pe.date!=null?ve.push(Pe.date):ve.push(Pe.from,Pe.to);const Fe=Math.min(...ve),je=Math.max(...ve),Ee=Math.max(1,(je-Fe)*.04),Se=Fe-Ee,qe=je+Ee,He=this.#et(bt.zoom),ln=this.#rt,pn=He?Math.max(1,(qe-Se)*He.px):Math.max(1,ln-Dt-bt.rightPadding),ie=He?Dt+pn+bt.rightPadding:ln,xe=m({min:Se,max:qe},[0,pn]);this.#E=xe.of(1)-xe.of(0),this.#x=He?He.step:null,this.#dt=this.#n.width==="container"?Math.max(2,Math.min(8,Math.floor(pn/(this.#n.dateAxis?78:44)))):8,this.#U=He?He.level:null,this.#q=Number.isFinite(me)?a(Dt+xe.of(me)):null;const Ge=Pe=>a(Dt+xe.of(Pe));this.#P=Dt+xe.of(0);const Ne=d(this.#e,"svg",{class:`${tt}__plot`,width:ie,height:Ut,viewBox:`0 0 ${ie} ${Ut}`,preserveAspectRatio:"xMinYMin meet",role:"img","aria-label":"Gantt chart"}),_e=zt.rowIndexById,Me=this.#Ct(ct),Ze=new Set(this.#t.findViolations().map(Pe=>Pe.id)),We=new Set((ct.conflicts||[]).map(Pe=>Pe.id));if(this.#p=bt.tooltip?new Map(this.#t.tasks.map(Pe=>[String(this.#t.readId(Pe)),Pe])):null,this.#kt(Ne,xe,Ge,Fe,je,Dt,bt.axisHeight,Ut),this.#L(Ne,Ge,Dt,bt.axisHeight,Ut),this.#wt(Ne,xe,Ge,Ut),this.#vt(Ne,ct,zt,Me,Ge,Ze,We),this.#X={plot:Ne,schedule:ct,rowIndex:_e,x:Ge},bt.showArrows&&this.#Vt(Ne,ct,_e,Ge),Number.isFinite(me)&&this.#te(Ne,Ge,me,bt.axisHeight,Ut),this.#St(Ne,Ge,bt.axisHeight,Ut),bt.editable&&(Ne.addEventListener("pointerdown",Pe=>this.#O.onPointerDown(Pe)),Ne.addEventListener("pointermove",Pe=>this.#O.hoverCursor(Pe)),Ne.addEventListener("pointerleave",()=>this.#O.clearHoverCursor())),bt.tooltip&&(Ne.addEventListener("pointermove",Pe=>this.#Rt(Pe)),Ne.addEventListener("pointerleave",()=>this.#pt()),Ne.addEventListener("focus",Pe=>this.#Bt(Pe),!0),Ne.addEventListener("blur",()=>this.#pt(),!0),Ne.addEventListener("keydown",Pe=>{Pe.key==="Escape"&&this.#pt()})),bt.keyboard&&(Ne.addEventListener("keydown",Pe=>this.#O.onKey(Pe)),Ne.addEventListener("keydown",Pe=>this.#O.onHistoryKey(Pe))),bt.showArrows&&bt.hoverChain&&(Ne.addEventListener("pointerover",Pe=>this.#he(Pe)),Ne.addEventListener("pointerleave",()=>this.#mt())),this.#o&&this.#s.removeChild(this.#o),this.#s.appendChild(Ne),this.#o=Ne,bt.scrollToToday&&this.scrollToToday(),this.#d){const Pe=Ne.querySelector(`.${tt}__row[data-task="${this.#d}"]`);Pe&&Pe.focus&&Pe.focus()}this.#m({view:this,element:this.#s,range:{start:Se,end:qe},zoom:this.#U})}#et(ct){return Number.isFinite(ct)?{px:Number(ct),step:1,level:"custom"}:typeof ct=="string"&&Vt[ct]?Vt[ct]:null}linkVerticalScroll(ct){if(this.#c&&(this.#c(),this.#c=null),!ct||!this.#s||!ct.addEventListener)return()=>{};const bt=this.#s,Ct=ct;let Dt=!1;const zt=(me,ve)=>{Dt||(Dt=!0,ve.scrollTop=me.scrollTop,Dt=!1)},Ut=()=>zt(bt,Ct),oe=()=>zt(Ct,bt);bt.addEventListener("scroll",Ut),Ct.addEventListener("scroll",oe);const de=()=>{bt.removeEventListener("scroll",Ut),Ct.removeEventListener("scroll",oe)};return this.#c=de,de}scrollToToday(){if(this.#q==null||!this.#s)return;const ct=this.#n.rowLabels?this.#n.labelWidth:0;this.#s.scrollLeft=Math.max(0,this.#q-ct-40)}#Lt(ct){const bt=new Map;for(const Ut of ct.order){const oe=ct.tasks.get(Ut),de=oe&&oe.parent==null?"__root__":String(oe.parent);bt.has(de)||bt.set(de,[]),bt.get(de).push(Ut)}const Ct=[],Dt=new Set,zt=Ut=>{for(const oe of bt.get(Ut)||[])Dt.has(oe)||(Dt.add(oe),Ct.push(oe),zt(oe))};zt("__root__");for(const Ut of ct.order)Dt.has(Ut)||(Dt.add(Ut),Ct.push(Ut));return Ct}#xt(ct){const bt=this.#Lt(ct),Ct=new Map;if(!this.#n.groupBy){const me=bt.map(ve=>({kind:"task",id:ve}));return bt.forEach((ve,Fe)=>Ct.set(ve,Fe)),{rows:me,rowIndexById:Ct,count:me.length}}const Dt=new Map(this.#t.tasks.map(me=>[String(this.#t.readId(me)),me])),zt=this.#n.groupBy,Ut=me=>{const ve=Dt.get(me)||{},Fe=typeof zt=="function"?zt(ve):ve[zt];return Fe==null||Fe===""?"Ungrouped":String(Fe)},oe=new Map;for(const me of bt){const ve=Ut(me);oe.has(ve)||oe.set(ve,[]),oe.get(ve).push(me)}const de=[];for(const[me,ve]of oe){de.push({kind:"header",key:me});for(const Fe of ve)de.push({kind:"task",id:Fe})}return de.forEach((me,ve)=>{me.kind==="task"&&Ct.set(me.id,ve)}),{rows:de,rowIndexById:Ct,count:de.length}}#Ct(ct){const bt=new Map;for(const Ct of ct.order){let Dt=0,zt=ct.tasks.get(Ct).parent;for(;zt!=null&&ct.tasks.has(zt);)Dt+=1,zt=ct.tasks.get(zt).parent;bt.set(Ct,Dt)}return bt}#kt(ct,bt,Ct,Dt,zt,Ut,oe,de){const me=pe(this.#n.nonWorking,this.#F);if(!me)return;const ve=Math.floor(Dt),Fe=Math.ceil(zt);if(Fe-ve>3660)return;const je=d(this.#e,"g",{class:`${tt}__shading`});for(let Ee=ve;Ee<Fe;Ee+=1){if(!me(Ee))continue;const Se=Math.max(Ut,Ct(Ee)),qe=Ct(Ee+1);je.appendChild(d(this.#e,"rect",{class:`${tt}__shade`,"data-day":String(Ee),x:Se,y:oe,width:a(Math.max(0,qe-Se)),height:de-oe}))}ct.appendChild(je)}#wt(ct,bt,Ct,Dt){const zt=d(this.#e,"g",{class:`${tt}__axis`}),Ut=this.#n.axisHeight,oe=this.#At(bt);for(const ve of oe){const Fe=Ct(ve);zt.appendChild(d(this.#e,"line",{class:`${tt}__gridline`,x1:Fe,y1:Ut,x2:Fe,y2:Dt}))}const de=oe.map(ve=>({at:Ct(ve),text:this.#ot(ve)})),{kept:me}=this.#x?w(de,{fontSize:Xt}):{kept:de};for(const ve of me){const Fe=d(this.#e,"text",{class:`${tt}__tick`,x:ve.at+2,y:Ut-6});_(Fe,ve.text),zt.appendChild(Fe)}ct.appendChild(zt)}#At(ct){if(!this.#x)return ct.ticks(this.#dt);const{min:bt,max:Ct}=ct.domain,Dt=this.#x,zt=[];for(let Ut=Math.ceil(bt/Dt)*Dt;Ut<=Ct;Ut+=Dt)zt.push(Ut);return zt.length?zt:ct.ticks(this.#dt)}#ot(ct){if(!this.#n.dateAxis)return String(a(ct));const bt=this.#Y(Math.round(ct));return bt?this.#U==="month"||this.#U==="quarter"?bt.slice(0,7):bt:String(a(ct))}#vt(ct,bt,Ct,Dt,zt,Ut,oe){const de=this.#n,me=d(this.#e,"g",{class:`${tt}__rows`});Ct.rows.forEach((ve,Fe)=>{const je=de.axisHeight+Fe*de.rowHeight;if(ve.kind==="header"){this.#It(me,ve.key,je,de.rowHeight);return}const Ee=ve.id,Se=bt.tasks.get(Ee),qe=je+de.barPadding,He=de.rowHeight-2*de.barPadding,ln=je+de.rowHeight/2,pn=de.showCritical&&Se.critical,ie=Ut.has(Ee),xe=oe.has(Ee),Ge=Se.percentComplete==null||Se.percentComplete<100,Ne=Number.isFinite(this.#V)&&Ge&&!Se.isSummary&&!Se.unscheduled&&!Se.inactive&&Se.ef<this.#V,_e=!Se.inactive&&Se.totalFloat<-O,Me=Se.late===!0,Ze=typeof this.#t.isTaskReadOnly=="function"&&this.#t.isTaskReadOnly(Ee),We=d(this.#e,"g",{class:`${tt}__row${Me?` ${tt}__row--late`:""}${Ze?` ${tt}__row--readonly`:""}`});if(We.setAttribute("data-task",Ee),We.setAttribute("tabindex",de.keyboard?"0":"-1"),We.setAttribute("role",Se.isSummary?"group":"button"),We.setAttribute("aria-label",x(Se,{dateAxis:de.dateAxis,iso:he=>this.#Y(he),unscheduled:this.#C("gantt.unscheduled"),inactive:this.#C("gantt.inactive")})),Ze&&mt(We,this.#C("gantt.a11y.readOnly")),pn&&We.setAttribute("data-critical","true"),ie&&We.setAttribute("data-violation","true"),Ne&&We.setAttribute("data-overdue","true"),_e&&We.setAttribute("data-atrisk","true"),Me&&We.setAttribute("data-late","true"),Se.inactive&&We.setAttribute("data-inactive","true"),de.rowLabels){const he=d(this.#e,"text",{class:`${tt}__rowlabel${Se.isSummary?` ${tt}__rowlabel--summary`:""}`,x:6+(Dt.get(Ee)||0)*12,y:ln,"dominant-baseline":"middle"});_(he,Se.name),We.appendChild(he)}const Pe=Se.inactive?null:H(Se,de.barColour);if(Se.unscheduled||Se.inactive&&Se.es==null)Se.unscheduled&&We.setAttribute("data-unscheduled","true");else if(Se.isMilestone)this.#Ft(We,zt(Se.es),ln,He/2,pn,Pe,Se.inactive,Ze);else{const he=zt(Se.es),Ke=Math.max(1,zt(Se.ef)-he),zn=Se.isSummary?`${tt}__summary${Se.inactive?` ${tt}__summary--inactive`:""}`:`${tt}__bar${pn?` ${tt}__bar--critical`:""}${ie?` ${tt}__bar--violation`:""}${xe?` ${tt}__bar--conflict`:""}${Ne?` ${tt}__bar--overdue`:""}${_e?` ${tt}__bar--atrisk`:""}${Me?` ${tt}__bar--late`:""}${Se.inactive?` ${tt}__bar--inactive`:""}${Ze?` ${tt}__bar--readonly`:""}`,Yn=d(this.#e,"rect",{class:zn,x:he,y:qe,width:a(Ke),height:He,rx:3});if(Pe&&(Yn.style.fill=Pe),We.appendChild(Yn),de.showProgress&&Se.percentComplete!=null&&Se.percentComplete>0){const mn=d(this.#e,"rect",{class:`${tt}__progress`,x:he,y:qe,width:a(Ke*Math.min(1,Se.percentComplete/100)),height:He,rx:3});Pe&&(mn.style.fill=z(Pe)),We.appendChild(mn)}const Sn=this.#Mt(Se);if(Sn){const mn=d(this.#e,"text",{class:`${tt}__label`,x:a(he+Ke+4),y:ln});_(mn,Sn),We.appendChild(mn)}de.editable&&!Se.isSummary&&(Ze||mt(We,[We.getAttribute("aria-description"),this.#C("gantt.a11y.startEdge")].filter(Boolean).join(" ")),We.appendChild(jt(this.#e,{ns:tt,id:Ee,x0:he,barY:qe,barH:He,title:this.#C("gantt.resize.startHandle",{name:Se.name})})),We.appendChild(ot(this.#e,{ns:tt,id:Ee,x0:he,w:Ke,barY:qe,barH:He,percent:Se.percentComplete||0,title:this.#C("gantt.progress.handle",{name:Se.name})})))}this.#_t(We,zt,Se,je,qe,He),me.appendChild(We)}),ct.appendChild(me)}#_t(ct,bt,Ct,Dt,zt,Ut){if(Ct.deadline==null||!Number.isFinite(Ct.deadline))return;const oe=bt(Ct.deadline),de=Dt+2,me=zt+Ut;ct.appendChild(d(this.#e,"line",{class:`${tt}__deadline`,x1:oe,y1:de,x2:oe,y2:me,"data-deadline":String(Ct.deadline)}));const ve=3;ct.appendChild(d(this.#e,"path",{class:`${tt}__deadline-glyph`,d:C(["M",a(oe-ve),a(de),"L",a(oe+ve),a(de),"L",a(oe),a(de+ve*1.6),"Z"])}))}#It(ct,bt,Ct,Dt){const zt=d(this.#e,"g",{class:`${tt}__lane`});zt.setAttribute("data-group",bt),zt.appendChild(d(this.#e,"rect",{class:`${tt}__lane-band`,x:0,y:Ct,width:"100%",height:Dt}));const Ut=d(this.#e,"text",{class:`${tt}__lane-label`,x:6,y:Ct+Dt/2,"dominant-baseline":"middle"});_(Ut,bt),zt.appendChild(Ut),ct.appendChild(zt)}#Mt(ct){const bt=this.#n.label;if(typeof bt=="function")return String(bt(ct)??"");switch(bt){case"none":return"";case"percent":return ct.percentComplete==null?"":`${Math.round(ct.percentComplete)}%`;case"dates":return this.#n.dateAxis?`${this.#Y(ct.es)} – ${this.#Y(ct.ef)}`:`${a(ct.es)} – ${a(ct.ef)}`;default:return ct.name}}#Ft(ct,bt,Ct,Dt,zt,Ut=null,oe=!1,de=!1){const me=C(["M",a(bt-Dt),a(Ct),"L",a(bt),a(Ct-Dt),"L",a(bt+Dt),a(Ct),"L",a(bt),a(Ct+Dt),"Z"]),ve=d(this.#e,"path",{class:`${tt}__milestone${zt?` ${tt}__milestone--critical`:""}${oe?` ${tt}__milestone--inactive`:""}${de?` ${tt}__milestone--readonly`:""}`,d:me});Ut&&(ve.style.fill=Ut),ct.appendChild(ve)}#Vt(ct,bt,Ct,Dt){const zt=this.#n,Ut=d(this.#e,"g",{class:`${tt}__links`}),oe=new Set((bt.conflicts||[]).filter(me=>me.type==="LOCKED"&&me.from!=null&&me.to!=null).map(me=>`${me.from}:${me.to}`));for(const me of this.#t.dependencies){const ve=String(me.from),Fe=String(me.to),je=bt.tasks.get(ve),Ee=bt.tasks.get(Fe);if(!je||!Ee||!Ct.has(ve)||!Ct.has(Fe)||je.unscheduled||Ee.unscheduled||je.es==null||je.ef==null||Ee.es==null||Ee.ef==null)continue;const Se=me.type?String(me.type).toUpperCase():"FS",qe=Se==="FS"||Se==="FF"?je.ef:je.es,He=Se==="FF"||Se==="SF"?Ee.ef:Ee.es,ln=Dt(qe),pn=zt.axisHeight+Ct.get(ve)*zt.rowHeight+zt.rowHeight/2,ie=Dt(He),xe=zt.axisHeight+Ct.get(Fe)*zt.rowHeight+zt.rowHeight/2,Ge=zt.showCritical&&je.critical&&Ee.critical,Ne=oe.has(`${ve}:${Fe}`),_e=Math.max(8,zt.rowHeight/2),Me=M({sx:ln,sy:pn,ex:ie,ey:xe,type:Se,elbow:_e,rowGap:zt.rowHeight/2}),Ze=d(this.#e,"path",{class:`${tt}__link${Ge?` ${tt}__link--critical`:""}${Ne?` ${tt}__link--conflict`:""}`,d:Me.d});if(Ze.setAttribute("data-from",ve),Ze.setAttribute("data-to",Fe),Ze.setAttribute("data-type",Se),Ze.setAttribute("data-route",Me.route),Ge&&Ze.setAttribute("data-critical","true"),Ne&&Ze.setAttribute("data-conflict","true"),Ut.appendChild(Ze),Ut.appendChild(this.#Qt(ie,xe,Me.arrowDir,Ge,Ne)),me.lag){const We=d(this.#e,"text",{class:`${tt}__lag`,x:a((ln+ie)/2),y:a((pn+xe)/2)-2});_(We,this.#C(me.lag>0?"gantt.lag":"gantt.lead",{days:me.lag})),Ut.appendChild(We)}}const de=ct.querySelector(`.${tt}__links`);de?ct.replaceChild(Ut,de):ct.appendChild(Ut)}#Jt(ct){const bt=this.#X;if(!(!bt||!ct||!this.#n.showArrows)){this.#Vt(bt.plot,ct,bt.rowIndex,bt.x);for(const[Ct,Dt]of ct.tasks){const zt=bt.schedule.tasks.get(Ct),Ut=bt.plot.querySelector(`.${tt}__row[data-task="${Ct}"]`);if(!zt||!Ut||this.#O.draggedId===Ct||zt.unscheduled||Dt.unscheduled)continue;const oe=bt.x(Dt.es)-bt.x(zt.es);oe?Ut.setAttribute("transform",`translate(${oe} 0)`):Ut.removeAttribute("transform")}}}#Qt(ct,bt,Ct,Dt,zt){return d(this.#e,"path",{class:`${tt}__arrowhead${Dt?` ${tt}__arrowhead--critical`:""}${zt?` ${tt}__arrowhead--conflict`:""}`,d:D(ct,bt,Ct)})}#te(ct,bt,Ct,Dt,zt){const Ut=bt(Ct);ct.appendChild(d(this.#e,"line",{class:`${tt}__today`,x1:Ut,y1:Dt,x2:Ut,y2:zt,"data-today":String(Ct)}))}#L(ct,bt,Ct,Dt,zt){if(!this.#J.length)return;const Ut=d(this.#e,"g",{class:`${tt}__markers`});for(const oe of this.#J){if(oe.from==null)continue;const de=Math.max(Ct,bt(oe.from)),me=Math.max(Ct,bt(oe.to));if(me<=de)continue;const ve=d(this.#e,"rect",{class:`${tt}__marker-range`,x:de,y:Dt,width:a(me-de),height:zt-Dt,"data-marker":String(oe.index),"data-from":String(oe.from),"data-to":String(oe.to)});oe.colour&&ve.setAttribute("fill",oe.colour),Ut.appendChild(ve)}ct.appendChild(Ut)}#St(ct,bt,Ct,Dt){if(!this.#J.length)return;const zt=d(this.#e,"g",{class:`${tt}__markers`});for(const Ut of this.#J){const oe=Ut.date!=null?[Ut.date]:[Ut.from,Ut.to];for(const de of oe){const me=bt(de),ve=d(this.#e,"line",{class:`${tt}__marker`,x1:me,y1:Ct,x2:me,y2:Dt,"data-marker":String(Ut.index),"data-date":String(de)});Ut.colour&&ve.setAttribute("stroke",Ut.colour),Ut.dashed&&ve.setAttribute("stroke-dasharray","4 3"),zt.appendChild(ve)}if(Ut.label){const de=Ut.date!=null?Ut.date:(Ut.from+Ut.to)/2,me=d(this.#e,"text",{class:`${tt}__marker-label`,x:a(bt(de)+3),y:Math.max(4,Ct-10),"data-marker":String(Ut.index)});Ut.colour&&me.setAttribute("fill",Ut.colour),_(me,Ut.label),zt.appendChild(me)}}ct.appendChild(zt)}#Rt(ct){if(this.#O.dragging||!this.#l)return;const bt=this.#t.schedule;if(!bt||!bt.ok){this.#pt();return}const Ct=ct.target,Dt=Ct&&Ct.closest?Ct.closest(`.${tt}__row`):null,zt=Dt?Dt.getAttribute("data-task"):null,Ut=zt?bt.tasks.get(zt):null;if(!Ut){this.#pt();return}this.#Se(Dt,Ut,ct)}#Bt(ct){if(this.#O.dragging||!this.#l)return;const bt=this.#t.schedule;if(!bt||!bt.ok)return;const Ct=ct.target,Dt=Ct&&Ct.closest?Ct.closest(`.${tt}__row`):null,zt=Dt?Dt.getAttribute("data-task"):null,Ut=zt?bt.tasks.get(zt):null;Ut&&this.#Se(Dt,Ut,ct)}#ee(ct){const bt=gt(ct.target,tt);if(!bt)return;const Ct=ct.target.closest?ct.target.closest(`.${tt}__row`):null,Dt=Ct?Ct.getAttribute("data-task"):null;Dt!=null&&!this.#k.gateContextMenu(String(Dt),bt,ct)&&ct.preventDefault&&ct.preventDefault()}#Se(ct,bt,Ct=null){const Dt=this.#p&&this.#p.get(String(bt.id))||null,zt=Q(this.#e,tt,bt,Dt,this.#n.tooltip,this.#rn());if(!zt){this.#pt();return}if(this.#j!==bt.id){if(!Ht(this.#t,this,bt.id,zt.text,Ct)){this.#pt();return}this.#j=bt.id}for(const Ut of[...this.#l.children])Ut!==this.#h&&this.#l.removeChild(Ut);if(zt.node)this.#l.appendChild(zt.node);else{const Ut=S(this.#e,"div",`${tt}__tip-card`);_(Ut,zt.text),this.#l.appendChild(Ut)}this.#l.removeAttribute("hidden"),this.#l.setAttribute("data-task",bt.id),this.#f&&this.#f!==ct&&yt(this.#f),ct.setAttribute("aria-description",zt.text),this.#f=ct,this.#ne(ct)}#rn(){const ct=this.#t.resourceNames;return{t:this.#C,formatDate:bt=>this.#gt(bt),dateAxis:this.#n.dateAxis,resourceName:bt=>ct.get(bt)??bt}}#gt(ct){if(this.#n.dateAxis===!1)return this.#C("gantt.a11y.day",{day:a(ct)});const bt=y(this.#st(ct));if(!bt)return"";try{return new Intl.DateTimeFormat(this.#z(),{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(bt)}catch{return this.#Y(ct)||""}}#z(){const ct=this.#t.grid,bt=ct&&ct.messages;return bt&&bt.locale||void 0}#ne(ct){if(!this.#l||!this.#s)return;const bt=ct.querySelector(`.${tt}__bar`)||ct.querySelector(`.${tt}__milestone`)||ct.querySelector(`.${tt}__summary`);if(!bt||typeof bt.getBoundingClientRect!="function")return;const Ct=bt.getBoundingClientRect(),Dt=this.#s.getBoundingClientRect(),zt=this.#e.defaultView||globalThis,Ut=Number.isFinite(zt.innerWidth)?zt.innerWidth:1/0,oe=Number.isFinite(zt.innerHeight)?zt.innerHeight:1/0,de={left:Math.max(0,Dt.left),top:Math.max(0,Dt.top),right:Math.min(Ut,Dt.right),bottom:Math.min(oe,Dt.bottom)};pt(this.#l,this.#h,Ct,de,Dt)}#pt(){if(this.#l&&(this.#l.setAttribute("hidden",""),this.#f&&(yt(this.#f),this.#f=null),this.#j!=null)){const ct=this.#j;this.#j=null,Pt(this.#t,this,ct,null)}}#H(ct){const bt=new Map,Ct=new Map;for(const Ut of this.#t.dependencies){const oe=String(Ut.from),de=String(Ut.to);(Ct.get(oe)||Ct.set(oe,[]).get(oe)).push(de),(bt.get(de)||bt.set(de,[]).get(de)).push(oe)}const Dt=new Set([ct]),zt=(Ut,oe)=>{const de=[oe];for(;de.length;){const me=de.pop();for(const ve of Ut.get(me)||[])Dt.has(ve)||(Dt.add(ve),de.push(ve))}};return zt(bt,ct),zt(Ct,ct),Dt}#ie(ct){if(!this.#o)return;this.#mt();const bt=this.#H(ct);for(const Ct of this.#o.querySelectorAll(`.${tt}__link`)){const Dt=Ct.getAttribute("data-from"),zt=Ct.getAttribute("data-to");bt.has(Dt)&&bt.has(zt)&&Ct.classList.add(`${tt}__link--chain`)}for(const Ct of bt){const Dt=this.#o.querySelector(`.${tt}__row[data-task="${Ct}"]`);if(!Dt)continue;const zt=Dt.querySelector(`.${tt}__bar`)||Dt.querySelector(`.${tt}__milestone`)||Dt.querySelector(`.${tt}__summary`);if(!zt)continue;const Ut=zt.getAttribute("class")||"";Ut.includes(`${tt}__milestone`)?zt.classList.add(`${tt}__milestone--chain`):Ut.includes(`${tt}__summary`)?zt.classList.add(`${tt}__summary--chain`):zt.classList.add(`${tt}__bar--chain`)}}#mt(){if(this.#o)for(const ct of["__link--chain","__bar--chain","__milestone--chain","__summary--chain"])for(const bt of this.#o.querySelectorAll(`.${tt}${ct}`))bt.classList.remove(`${tt}${ct}`)}#he(ct){if(this.#O.dragging)return;const bt=ct.target,Ct=bt&&bt.closest?bt.closest(`.${tt}__row`):null,Dt=Ct?Ct.getAttribute("data-task"):null;Dt?this.#ie(Dt):this.#mt()}#re(ct,bt){if(!this.#g||!ct)return;if(!!!(bt&&bt.repeat)){if(ct===this.#a)return;this.#a=ct,_(this.#g,ct);return}this.#a=ct,_(this.#g,""),_(this.#g,ct)}toSVG(){return this.#o?re(this.#o):""}async toPNG(ct={}){if(!this.#o)return null;const bt=this.#e.defaultView||globalThis,Ct=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():null,Dt=Math.max(1,Math.round(Ct&&Ct.width||Number(this.#o.getAttribute("width"))||It)),zt=Math.max(1,Math.round(Ct&&Ct.height||Number(this.#o.getAttribute("height"))||1));let Ut=this.#o;bt.getComputedStyle&&this.#o.cloneNode&&(Ut=this.#o.cloneNode(!0),N(this.#o,Ut,bt),Ut.setAttribute("xmlns","http://www.w3.org/2000/svg"));const oe=typeof bt.XMLSerializer=="function"?new bt.XMLSerializer().serializeToString(Ut):re(Ut),de=ct.scale||bt.devicePixelRatio||1,me="background"in ct?ct.background:G(bt,this.#s,"--lattice-background")||null;return X(this.#e,oe,Dt,zt,de,me)}#zt(ct){const bt=this.#o;if(!bt||!(this.#E>0))return null;let Ct=1,Dt=bt.getBoundingClientRect&&bt.getBoundingClientRect().left||0;const zt=typeof bt.getScreenCTM=="function"?bt.getScreenCTM():null;return zt&&zt.a>0&&(Ct=zt.a,Dt=zt.e),(((ct.clientX||0)-Dt)/Ct-this.#P)/this.#E}destroy(){this.#w||(this.#w=!0,this.#N.fail(new Error("lattice-grid: the gantt view was destroyed before it became ready.")),this.#t.emitViewDestroy({view:this,element:this.#s}),this.#O.destroy(),this.#k&&(this.#k.destroy(),this.#k=null),this.#M&&(this.#M.destroy(),this.#M=null),this.#D&&this.#s&&this.#s.removeEventListener("contextmenu",this.#D),this.#D=null,this.#Q&&(this.#Q.release(),this.#Q=null),this.#c&&(this.#c(),this.#c=null),this.#y&&this.#y(),this.#i&&this.#i.__latticeGantt===this&&(this.#i.__latticeGantt=null),this.#r&&(this.#r(),this.#r=null),this.#s&&this.#s.parentNode&&this.#s.parentNode.removeChild(this.#s),this.#s=null,this.#o=null)}}function ne(Zt,ct,bt={}){return new Lt(Zt,ct,bt)}}),ae("packages/modules/gantt/zoom.js",function(p,V){"use strict";Object.defineProperty(p,"ZOOM_PRESETS",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"ZOOM_LEVEL_NAMES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"resolveZoomPreset",{enumerable:!0,get:function(){return K}});const St=Object.freeze({hour:Object.freeze({px:624,step:1/24,level:"hour"}),day:Object.freeze({px:26,step:1,level:"day"}),week:Object.freeze({px:12,step:7,level:"week"}),month:Object.freeze({px:4,step:30,level:"month"}),quarter:Object.freeze({px:1.8,step:91,level:"quarter"})}),U=Object.freeze(["hour","day","week","month","quarter"]);function K(Y,W="day"){if(typeof Y=="number"&&Number.isFinite(Y)&&Y>0){const l=Y>=60?"hour":Y>=18?"day":Y>=8?"week":Y>=2.5?"month":"quarter";return{px:Y,step:St[l].step,level:l}}return typeof Y=="string"&&Object.prototype.hasOwnProperty.call(St,Y)?{...St[Y]}:{...St[W]||St.day}}}),ae("packages/modules/gantt/calendar-shading.js",function(p,V){"use strict";Object.defineProperty(p,"rowNonWorking",{enumerable:!0,get:function(){return K}});const U=V("packages/modules/gantt/task-calendars.js").PLAN_CALENDAR_ID;function K(Y,W,l){if(!Y||!(Y.calendars instanceof Map))return null;const L=new Map;return W.map(v=>{const b=v.rec&&v.rec.calendar;if(b==null||b===U||!Y.calendars.has(b))return l;if(!L.has(b)){const w=Y.calendars.get(b);L.set(b,k=>!w.isWorking(k))}return L.get(b)})}}),ae("packages/modules/gantt/avatar.js",function(p,V){"use strict";Object.defineProperty(p,"initials",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"avatarColor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"safeAvatarUrl",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"avatarChip",{enumerable:!0,get:function(){return v}});const St="lat-gantt-split",U=["#4a90d9","#e2513b","#2c9c6a","#8b5cf6","#d97706","#0891b2","#be185d"],K=/^\s*(https?:|blob:|data:image\/)/i,Y=/^\s*[a-z][a-z0-9+.-]*:/i;function W(b){const w=String(b).trim().split(/\s+/).filter(Boolean);return w.length?w.length===1?w[0].slice(0,2).toUpperCase():(w[0][0]+w[w.length-1][0]).toUpperCase():"?"}function l(b){let w=0;for(let k=0;k<b.length;k+=1)w=w*31+b.charCodeAt(k)>>>0;return U[w%U.length]}function L(b){if(b==null)return"";const w=String(b).trim();return w?Y.test(w)?K.test(w)?w:"":w:""}function v(b,{name:w,avatar:k,over:u=!1,title:g=null,cssGlyph:d=!1}){const S=String(w??""),_=b.createElement("div");_.setAttribute("class",`${St}__avatar${u?` ${St}__avatar--overalloc`:""}`),_.style.background=l(S),g!=null&&_.setAttribute("title",String(g));const C=L(k);if(C){const o=b.createElement("img");o.setAttribute("class",`${St}__avatar-img`),o.setAttribute("alt",S),o.setAttribute("loading","lazy"),o.setAttribute("decoding","async"),o.setAttribute("src",C),o.addEventListener("error",()=>{o.parentNode===_&&_.removeChild(o)}),_.appendChild(o)}const a=b.createElement("span");return a.setAttribute("class",`${St}__avatar-glyph${d?` ${St}__avatar-glyph--css`:""}`),d?a.setAttribute("data-initials",W(S)):a.textContent=W(S),_.appendChild(a),_}}),ae("packages/modules/gantt/events-table.js",function(p,V){"use strict";Object.defineProperty(p,"TABLE_EVENTS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"isEditOpeningKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"CellTableEvents",{enumerable:!0,get:function(){return v}});const St=V("packages/modules/gantt/events-pointer.js"),U=St.taskContext,K=St.emitGesture,Y=St.gateGesture,W=Object.freeze(["cellClick","cellDblClick","cellContextMenu","beforeCellEditStart","cellEditStart","cellEditStart:cancelled","cellEditCommit","cellEditCancel","rowClick","rowDblClick"]);function l(b){return b?b.key==="Enter"?!0:b.ctrlKey||b.metaKey||b.altKey?!1:b.key==="F2"?!0:typeof b.key=="string"&&b.key.length===1&&b.key!==" "&&!b.isComposing:!1}function L(b){const w=b&&b.target,k=w&&typeof w.closest=="function"?w.closest("[data-col]"):null;if(!k)return null;const u=k.getAttribute("data-col"),g=typeof k.closest=="function"?k.closest("[data-key]"):null,d=g?g.getAttribute("data-key"):null;return u==null||d==null?null:{colId:u,key:d,cellEl:k}}class v{#t;#i;#e;#n=null;#s=null;#o=null;#l=[];constructor(w){this.#t=w.controller,this.#i=w.table,this.#e=w.view}attach(w){if(this.#i.on("cell:clicked",d=>{const S=this.#g(d);S&&K(this.#t,"cellClick",S)}),this.#i.on("cell:dblclicked",d=>{const S=this.#g(d);S&&K(this.#t,"cellDblClick",S)}),this.#i.on("cell:contextmenu",d=>{const S=this.#g(d);S&&K(this.#t,"cellContextMenu",S)}),this.#i.on("row:clicked",d=>{const S=this.#a(d);S&&K(this.#t,"rowClick",S)}),this.#i.on("row:dblclicked",d=>{const S=this.#a(d);S&&K(this.#t,"rowDblClick",S)}),this.#i.on("cell:edit:start",d=>this.#f(d)),this.#i.on("cell:edit:end",d=>this.#p(d)),!w||!w.addEventListener)return;const k=d=>this.#h(d),u=d=>{this.#o=d,l(d)&&this.#h(d)},g=d=>{this.#o=d};w.addEventListener("dblclick",k,!0),w.addEventListener("keydown",u,!0),w.addEventListener("mousedown",g,!0),this.#l.push([w,"dblclick",k,!0],[w,"keydown",u,!0],[w,"mousedown",g,!0])}#h(w){if(this.#n)return;const k=this.#i&&this.#i.grid;if(!k)return;const u=L(w);if(!u)return;const g=k.get&&k.get("edit");if(g===!1||g&&typeof g=="object"&&g.enabled===!1)return;const d=k.columns.get(u.colId);if(!d||!d.edit||!d.edit.enabled)return;const S=String(u.key);if(typeof this.#t.isTaskReadOnly=="function"&&this.#t.isTaskReadOnly(S))return;const _={...U(this.#t,S),columnKey:u.colId,value:k.rows&&typeof k.rows.value=="function"?k.rows.value(S,u.colId):void 0,element:u.cellEl,event:w,view:this.#e()};this.#s=w,Y(this.#t,"beforeCellEditStart","cellEditStart:cancelled",_)||(this.#s=null,typeof w.preventDefault=="function"&&w.preventDefault(),typeof w.stopImmediatePropagation=="function"?w.stopImmediatePropagation():typeof w.stopPropagation=="function"&&w.stopPropagation())}#f(w){const k=w&&(w.key||w.row&&w.row.key);if(k==null||w.colId==null)return;const u=String(k),g=this.#s;this.#s=null,this.#n={key:u,colId:String(w.colId)},K(this.#t,"cellEditStart",{...U(this.#t,u),columnKey:String(w.colId),event:g||null,view:this.#e()})}#p(w){const k=w&&(w.key||w.row&&w.row.key);if(k==null||w.valid===!1)return;this.#n=null;const u=String(k),g={...U(this.#t,u),columnKey:w.colId!=null?String(w.colId):null,view:this.#e(),event:this.#o||null};if(Array.isArray(w.writes)&&w.writes.length){const d=w.writes[0];K(this.#t,"cellEditCommit",{...g,oldValue:d.before,newValue:d.after})}else w.cancelled===!0&&K(this.#t,"cellEditCancel",g)}#g(w){const k=w&&(w.key||w.row&&w.row.key);if(k==null)return null;const u=String(k),g=w.event,d=g&&g.target,S=d&&typeof d.closest=="function"?d.closest(".lat-cell"):null;return{...U(this.#t,u),columnKey:w.colId!=null?String(w.colId):null,value:w.value,element:S,event:g||null,view:this.#e()}}#a(w){const k=w&&(w.key||w.row&&w.row.key);if(k==null)return null;const u=String(k);return{...U(this.#t,u),event:w.event||null,view:this.#e()}}destroy(){for(const[w,k,u,g]of this.#l)w.removeEventListener(k,u,g);this.#l=[],this.#n=null,this.#s=null,this.#o=null}}}),ae("packages/modules/gantt/assignment-picker.js",function(p,V){"use strict";Object.defineProperty(p,"resourceLoadOver",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"pickerWarnings",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"AssignmentPicker",{enumerable:!0,get:function(){return w}});const U=V("packages/modules/gantt/resources.js").parseAssignments,Y=V("packages/modules/gantt/avatar.js").avatarChip,W="lat-gantt-split";function l(k,u,g,d,S=1){const _=k&&k.byResource?k.byResource.get(u):null;if(!_)return{load:0,capacity:S};let C=0;for(const o of _.segments)o.end>g&&o.start<d&&o.load>C&&(C=o.load);const a=(k.overAllocations||[]).find(o=>o.resource===u&&o.end>g&&o.start<d);return{load:C,capacity:a?a.capacity:_.capacity}}function L(k,u){const g=new Map;for(const d of k&&k.overAllocations||[]){if(!d.taskIds.includes(u))continue;const S=g.get(d.resource);(!S||d.load>S.load)&&g.set(d.resource,{resource:d.resource,load:d.load,capacity:d.capacity})}return[...g.values()]}const v=k=>Math.round(k*100);function b(k,u,g,d){const S=k.createElement(u);return g&&S.setAttribute("class",`${W}__${g}`),d!=null&&(S.textContent=d),S}class w{#t;#i;#e;#n;#s;#o;#l=new Map;#h=1/0;#f=!0;#p=[];#g=0;#a="";#d=null;#c=null;#y=null;#r=null;#m=null;#w=null;constructor(u,g,d,S,_,C){this.#t=u,this.#i=g,this.#e=d,this.#n=String(S),this.#s=_,this.#o=C,this.#E=_}#E;#P(){const u=this.#t.schedule;return u&&u.ok&&u.tasks.get(this.#n)||null}#k(u){return this.#t.resourceNames.get(u)??u}open(){const u=this.#i,g=this.#t.taskById(this.#n)||{};for(const f of U(g))this.#l.set(f.resource,f.units);const d=g&&g.assignmentPicker?g.assignmentPicker:null;if(d){const f=Number(d.max);Number.isFinite(f)&&f>=1&&(this.#h=Math.floor(f)),typeof d.units=="boolean"&&(this.#f=d.units)}const S=new Set(this.#l.keys());for(const f of this.#t.resourceModels.keys())S.add(f);const _=this.#t.resources();for(const f of _.resources)S.add(f.resource);this.#p=[...S].sort((f,M)=>f.localeCompare(M));const C=this.#P(),a=b(u,"div","picker");a.setAttribute("role","dialog"),a.setAttribute("aria-label",this.#e("gantt.picker.title",{name:C?C.name:this.#n}));const o=b(u,"input","picker-search");o.setAttribute("type","search"),o.setAttribute("role","combobox"),o.setAttribute("aria-expanded","true"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-label",this.#e("gantt.picker.search")),this.#c=o;const m=b(u,"div","picker-list");m.setAttribute("role","listbox"),m.setAttribute("aria-multiselectable",this.#h===1?"false":"true"),m.setAttribute("aria-label",this.#e("gantt.picker.list")),m.setAttribute("id",`${W}-picker-list-${this.#n}`),m.setAttribute("tabindex","-1"),o.setAttribute("aria-controls",m.getAttribute("id")),this.#y=m;const $=b(u,"div","picker-chosen");$.setAttribute("role","group"),$.setAttribute("aria-label",this.#e("gantt.picker.selected")),this.#r=$;const h=b(u,"div","picker-warn");h.setAttribute("role","status"),h.setAttribute("aria-live","polite"),h.setAttribute("aria-atomic","true"),this.#m=h;const y=b(u,"div","picker-actions"),i=b(u,"button","picker-apply",this.#e("gantt.picker.apply"));i.setAttribute("type","button"),i.addEventListener("click",f=>this.#C(f));const r=b(u,"button","picker-cancel",this.#e("gantt.picker.cancel"));r.setAttribute("type","button"),r.addEventListener("click",()=>this.close()),y.appendChild(i),y.appendChild(r),a.appendChild(o),a.appendChild(m),a.appendChild($),a.appendChild(h),a.appendChild(y),a.addEventListener("keydown",f=>this.#X(f)),o.addEventListener("input",()=>{this.#a=o.value,this.#g=0,this.#x()}),this.#d=a,(u.body||u.documentElement).appendChild(a),this.#w=f=>{this.#d&&!this.#d.contains(f.target)&&this.close()},u.addEventListener("pointerdown",this.#w,!0),this.#x(),o.focus()}#M(){const u=this.#d;if(!u)return;const g=this.#i.defaultView,d=g&&g.innerWidth||this.#i.documentElement.clientWidth,S=g&&g.innerHeight||this.#i.documentElement.clientHeight,_=4,C=this.#E.getBoundingClientRect();u.style.maxHeight=`${Math.max(120,Math.min(420,S-2*_))}px`;const a=u.offsetWidth,o=u.offsetHeight;let m=Math.round(C.left);m=Math.max(_,Math.min(m,d-a-_));let $=Math.round(C.bottom+2);if($+o>S-_){const h=Math.round(C.top-2-o);$=h>=_?h:Math.max(_,S-o-_)}u.style.left=`${m}px`,u.style.top=`${$}px`}#D(){const u=this.#a.trim().toLowerCase();return u?this.#p.filter(g=>this.#k(g).toLowerCase().includes(u)):this.#p}#j(){return[...this.#l].map(([u,g])=>({resource:u,units:g}))}#x(){const u=this.#i,g=this.#P(),d=g?g.es:0,S=g?g.ef:0,_=this.#j(),C=this.#t.previewAssignments(this.#n,_),a=this.#t.resourceModels,o=this.#y;for(;o.firstChild;)o.removeChild(o.firstChild);const m=this.#D();if(this.#g>=m.length&&(this.#g=Math.max(0,m.length-1)),m.forEach((y,i)=>{const{load:r,capacity:f}=l(C,y,d,S,a.has(y)?a.get(y).capacityUnits:1),M=this.#l.has(y),D=r>f+1e-9,I=b(u,"div",`picker-option${D?` ${W}__picker-option--over`:""}`);I.setAttribute("role","option"),I.setAttribute("id",`${W}-picker-opt-${this.#n}-${i}`),I.setAttribute("aria-selected",M?"true":"false"),I.setAttribute("data-resource",y),I.setAttribute("data-load",String(r)),I.setAttribute("data-capacity",String(f)),i===this.#g&&I.setAttribute("data-active","true");const O=this.#k(y);I.appendChild(Y(u,{name:O,avatar:this.#t.resourceAvatars.get(y)}));const B=b(u,"span","picker-option-text",`${O} — ${this.#e("gantt.picker.load",{load:v(r),capacity:v(f)})}`);I.appendChild(B),I.addEventListener("click",()=>{this.#g=i,this.#O(y)}),o.appendChild(I)}),!m.length){const y=b(u,"div","picker-none",this.#e("gantt.picker.none"));y.setAttribute("role","presentation"),o.appendChild(y)}this.#c&&(m.length?this.#c.setAttribute("aria-activedescendant",`${W}-picker-opt-${this.#n}-${this.#g}`):this.#c.removeAttribute("aria-activedescendant"));const $=this.#r,h=u.activeElement&&$.contains(u.activeElement)?u.activeElement.getAttribute("data-for"):null;for(;$.firstChild;)$.removeChild($.firstChild);for(const[y,i]of this.#l){const r=this.#k(y),f=b(u,"div","picker-row");if(f.setAttribute("data-resource",y),f.appendChild(Y(u,{name:r,avatar:this.#t.resourceAvatars.get(y)})),f.appendChild(b(u,"span","picker-row-name",r)),this.#f){const D=b(u,"input","picker-units");D.setAttribute("type","number"),D.setAttribute("min","0"),D.setAttribute("max","1000"),D.setAttribute("step","5"),D.setAttribute("aria-label",this.#e("gantt.picker.units",{name:r})),D.setAttribute("data-for",y),D.value=String(v(i)),D.addEventListener("input",()=>{const I=Number(D.value);D.value===""||!Number.isFinite(I)||I<0||(this.#l.set(y,I/100),this.#U())}),f.appendChild(D),h===y&&D.focus()}const M=b(u,"button","picker-remove","×");M.setAttribute("type","button"),M.setAttribute("aria-label",this.#e("gantt.picker.remove",{name:r})),M.addEventListener("click",()=>{this.#l.delete(y),this.#x(),this.#c&&this.#c.focus()}),f.appendChild(M),$.appendChild(f)}this.#q(C,_)}#U(){const u=this.#P(),g=u?u.es:0,d=u?u.ef:0,S=this.#j(),_=this.#t.previewAssignments(this.#n,S),C=this.#t.resourceModels;for(const a of this.#y.querySelectorAll('[role="option"]')){const o=a.getAttribute("data-resource"),{load:m,capacity:$}=l(_,o,g,d,C.has(o)?C.get(o).capacityUnits:1);a.setAttribute("data-load",String(m)),a.setAttribute("data-capacity",String($));const h=a.querySelector(`.${W}__picker-option-text`);h&&(h.textContent=`${this.#k(o)} — ${this.#e("gantt.picker.load",{load:v(m),capacity:v($)})}`),a.setAttribute("class",`${W}__picker-option${m>$+1e-9?` ${W}__picker-option--over`:""}`)}this.#q(_,S)}#q(u,g){const d=L(u,this.#n),S=this.#m;S.setAttribute("data-over",d.length?"true":"false"),S.setAttribute("class",`${W}__picker-warn${d.length?` ${W}__picker-warn--over`:""}`),S.textContent=d.length?d.map(_=>this.#e("gantt.picker.warn",{name:this.#k(_.resource),load:v(_.load),capacity:v(_.capacity)})).join(". "):g.length?this.#e("gantt.picker.ok"):"",this.#M()}#O(u){this.#l.has(u)?this.#l.delete(u):(this.#l.size>=this.#h&&this.#l.delete(this.#l.keys().next().value),this.#l.set(u,1)),this.#x(),this.#c&&this.#c.focus()}#X(u){const g=this.#D(),d=u.target instanceof Element&&u.target.classList.contains(`${W}__picker-units`);if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),this.close();return}if(u.key==="Tab"&&this.#d){const S=[...this.#d.querySelectorAll("input, button")].filter(a=>!a.disabled),_=S[0],C=S[S.length-1];u.shiftKey&&this.#i.activeElement===_?(u.preventDefault(),C.focus()):!u.shiftKey&&this.#i.activeElement===C&&(u.preventDefault(),_.focus());return}if(d){u.key==="Enter"&&(u.preventDefault(),this.#C(u));return}if(!(u.target instanceof Element&&u.target.tagName==="BUTTON")){if(u.key==="ArrowDown"||u.key==="ArrowUp"){if(u.preventDefault(),!g.length)return;this.#g=(this.#g+(u.key==="ArrowDown"?1:-1)+g.length)%g.length,this.#x()}else if(u.key==="Home"||u.key==="End"){if(u.target===this.#c&&this.#a)return;u.preventDefault(),this.#g=u.key==="Home"?0:Math.max(0,g.length-1),this.#x()}else if((u.key==="Enter"||u.key===" ")&&g.length){if(u.key===" "&&this.#a)return;u.preventDefault(),this.#O(g[this.#g])}}}#C(u=null){const g=U(this.#t.taskById(this.#n)||{}),d=this.#j();g.length===d.length&&g.every(_=>this.#l.has(_.resource)&&Math.abs(this.#l.get(_.resource)-_.units)<1e-9)||this.#t.applyEdit({id:this.#n,assignments:d},{writeBack:!0,event:u}),this.close()}close(){if(!this.#d)return;this.#w&&this.#i.removeEventListener("pointerdown",this.#w,!0),this.#d.remove(),this.#d=null;const u=this.#s;this.#o();const g=u&&u.isConnected?u:this.#i.querySelector(`[data-picker-for="${this.#n}"]`);g&&g.focus&&g.focus()}get element(){return this.#d}}}),ae("packages/modules/gantt/link-editor.js",function(p,V){"use strict";Object.defineProperty(p,"LinkEditor",{enumerable:!0,get:function(){return W}});const U=V("packages/modules/gantt/schedule.js").LINK_TYPES,K="lat-gantt-split";function Y(l,L,v,b){const w=l.createElement(L);return v&&w.setAttribute("class",`${K}__${v}`),b!=null&&(w.textContent=b),w}class W{#t;#i;#e;#n;#s;#o;#l=null;#h=null;#f=null;#p=null;constructor(L,v,b,w,k,u){this.#t=L,this.#i=v,this.#e=b,this.#n=w,this.#s=k,this.#o=u,this.#g=k}#g;#a(){return this.#t.dependencies.find(v=>String(v.from)===this.#n.from&&String(v.to)===this.#n.to&&(v.type?String(v.type).toUpperCase():"FS")===this.#n.type)||this.#n}#d(){const L=this.#t.schedule,v=b=>L&&L.ok&&L.tasks.get(b)&&L.tasks.get(b).name||b;return{from:v(this.#n.from),to:v(this.#n.to)}}open(){const L=this.#i,v=this.#a(),b=this.#d(),w=Y(L,"div","picker");w.setAttribute("role","dialog"),w.setAttribute("aria-label",this.#e("gantt.linkEditor.title",b));const k=Y(L,"select","linkeditor-type");k.setAttribute("aria-label",this.#e("gantt.linkEditor.type"));for(const C of U){const a=L.createElement("option");a.setAttribute("value",C),a.textContent=C,k.appendChild(a)}k.value=v.type?String(v.type).toUpperCase():"FS",this.#h=k;const u=Y(L,"input","linkeditor-lag");u.setAttribute("type","number"),u.setAttribute("step","1"),u.setAttribute("aria-label",this.#e("gantt.linkEditor.lag")),u.value=String(Number.isFinite(v.lag)?v.lag:0),this.#f=u;const g=Y(L,"div","picker-actions"),d=Y(L,"button","picker-apply",this.#e("gantt.linkEditor.apply"));d.setAttribute("type","button"),d.addEventListener("click",C=>this.#r(C));const S=Y(L,"button","picker-remove",this.#e("gantt.linkEditor.delete"));S.setAttribute("type","button"),S.addEventListener("click",C=>this.#m(C));const _=Y(L,"button","picker-cancel",this.#e("gantt.linkEditor.cancel"));_.setAttribute("type","button"),_.addEventListener("click",()=>this.close()),g.appendChild(d),g.appendChild(S),g.appendChild(_),w.appendChild(k),w.appendChild(u),w.appendChild(g),w.addEventListener("keydown",C=>this.#y(C)),this.#l=w,(L.body||L.documentElement).appendChild(w),this.#c(),this.#p=C=>{this.#l&&!this.#l.contains(C.target)&&this.close()},L.addEventListener("pointerdown",this.#p,!0),k.focus()}#c(){const L=this.#l;if(!L)return;const v=this.#i.defaultView,b=v&&v.innerWidth||this.#i.documentElement.clientWidth,w=v&&v.innerHeight||this.#i.documentElement.clientHeight,k=4,u=this.#g&&this.#g.getBoundingClientRect?this.#g.getBoundingClientRect():{left:k,bottom:k,top:k},g=L.offsetWidth,d=L.offsetHeight;let S=Math.round(u.left);S=Math.max(k,Math.min(S,b-g-k));let _=Math.round(u.bottom+2);if(_+d>w-k){const C=Math.round(u.top-2-d);_=C>=k?C:Math.max(k,w-d-k)}L.style.left=`${S}px`,L.style.top=`${_}px`}#y(L){if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),this.close();return}if(L.key==="Tab"&&this.#l){const v=[...this.#l.querySelectorAll("select, input, button")].filter(k=>!k.disabled),b=v[0],w=v[v.length-1];L.shiftKey&&this.#i.activeElement===b?(L.preventDefault(),w.focus()):!L.shiftKey&&this.#i.activeElement===w&&(L.preventDefault(),b.focus())}else L.key==="Enter"&&L.target!==this.#l.querySelector(`.${K}__picker-cancel`)&&(L.preventDefault(),this.#r(L))}#r(L=null){const v=this.#h.value,b=Number(this.#f.value),w=this.#a(),k=this.#t.dependencies.filter(u=>!(String(u.from)===w.from&&String(u.to)===w.to&&(u.type?String(u.type).toUpperCase():"FS")===w.type));k.push({from:w.from,to:w.to,type:v,lag:Number.isFinite(b)?b:0}),this.#t.setDependencies(k,{event:L}),this.close()}#m(L=null){const v=this.#a();this.#t.deleteDependency({from:v.from,to:v.to,type:v.type},{event:L}),this.close()}close(){if(!this.#l)return;this.#p&&this.#i.removeEventListener("pointerdown",this.#p,!0),this.#l.remove(),this.#l=null;const L=this.#s;if(this.#o(),L&&L.isConnected&&L.focus){L.focus();return}const v=this.#i.querySelector(`.${K}__barrow[data-task="${this.#n.from}"]`);v&&v.focus&&v.focus()}get element(){return this.#l}}}),ae("packages/modules/gantt/workload-groups.js",function(p,V){"use strict";Object.defineProperty(p,"GROUP_KEY_PREFIX",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"isGroupKey",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"normalizeGroupBy",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"groupOfResource",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"groupBookingSubRows",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"groupWorkloadRows",{enumerable:!0,get:function(){return v}});const St="group:";function U(b){return typeof b=="string"&&b.startsWith(St)}function K(b){return typeof b=="function"||typeof b=="string"&&b.trim()!==""?b:null}function Y(b,w){let k=null;try{k=typeof b=="function"?b(w):w?w[b]:null}catch{k=null}return k==null||k===""?null:String(k)}function W(b,w){return Array.isArray(w)?b?b.map((k,u)=>{const g=w[u];return g==null?k:k==null?g:k+g}):w.map(k=>k??null):b}function l(b,w){return w==null||!Number.isFinite(w)?b:b==null?w:b+w}function L(b){const w=[],k=new Map;for(const u of b){if(!u.external||u.group==null){w.push(u);continue}const g=k.get(u.group);if(g){g.cells=W(g.cells,u.cells),g.total+=Number(u.total)||0,g.bookings.push(u);continue}const d={...u,id:`${St}${u.group}`,name:u.group,cells:W(null,u.cells),total:Number(u.total)||0,bookings:[u]};k.set(u.group,d),w.push(d)}return w}function v(b,w){const k=new Map;for(const g of b){const d=w(g.resource==null?null:g.resource);k.has(d)||k.set(d,[]),k.get(d).push(g)}return[...k.keys()].sort((g,d)=>g==null?d==null?0:1:d==null?-1:g.localeCompare(d,void 0,{numeric:!0,sensitivity:"base"})).map(g=>{const d=k.get(g);let S=null,_=null,C=null,a=null,o=null,m=0;for(const h of d)S=W(S,h.cells),_=W(_,h.available),C=W(C,h.costCells),a=l(a,h.availableTotal),o=l(o,h.costTotal),m+=Number(h.total)||0;S=S||[];const $=S.map((h,y)=>h!=null&&_!=null&&_[y]!=null&&h>_[y]+1e-9);return{value:g,key:`${St}${g??""}`,rows:d,cells:S,available:_,availableTotal:a,total:m,costCells:C,costTotal:o,over:$}})}}),ae("packages/modules/gantt/workload-events.js",function(p,V){"use strict";Object.defineProperty(p,"WORKLOAD_CELL_EVENTS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"emitWorkloadCell",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"gateWorkloadCell",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"workloadCellPayload",{enumerable:!0,get:function(){return l}});const U=V("packages/modules/gantt/time.js").toISODate,K=Object.freeze(["workloadCellClick","workloadCellDblClick","workloadCellContextMenu","workloadCellHover","workloadCellHoverEnd","workloadResourceClick"]);function Y(L,v,b){L&&typeof L.emitWorkloadCell=="function"&&L.emitWorkloadCell(v,b)}function W(L,v,b){return!L||typeof L.gateWorkloadCell!="function"?!0:L.gateWorkloadCell(v,b)}function l({view:L,unit:v,resourceName:b,rows:w,buckets:k,rowKey:u,index:g,sub:d,rec:S,event:_}){const C=Array.isArray(w)?w.find(i=>(i.resource==null?"":i.resource)===u):null,a=Array.isArray(k)?k[g]:null;if(!C||!a)return null;const o=C.cells&&C.cells[g]!=null?C.cells[g]:0,m=Array.isArray(C.available)?C.available[g]??null:null,$=m!=null&&m>0?o/m*100:null,h=Array.isArray(C.over)?!!C.over[g]:!1,y=(Array.isArray(C.tasks)?C.tasks:[]).filter(i=>(i.cells&&i.cells[g]?i.cells[g]:0)>0).map(i=>({id:String(i.id),name:i.name,hours:i.cells[g],units:i.units??null}));return{resource:C.resource,resourceName:b,bucketStart:U(a.start)??String(a.start),bucketEnd:U(a.end)??String(a.end),booked:o,available:m,percent:$,over:h,unit:v,tasks:y,id:d?String(d.id):null,rawTask:d?d.raw??null:null,task:S??null,view:L,event:_}}}),ae("packages/modules/gantt/link-text.js",function(p,V){"use strict";Object.defineProperty(p,"LINK_COLUMN_ROLE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"refOf",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"buildRefIndex",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"formatLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"linksText",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"parseLinkText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"planLinkEdit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"buildLinkColumns",{enumerable:!0,get:function(){return k}});const U=V("packages/modules/gantt/schedule.js").wouldCreateCycle,K=Object.freeze({predecessors:"to",successors:"from"}),Y=/^([^\s+\-]+?)\s*(FS|SS|FF|SF)?\s*(?:([+-])\s*(\d+(?:\.\d+)?))?$/i;function W(u,g){return u&&u.wbs!=null&&u.wbs!==""?String(u.wbs):String(g)}function l(u){const g=new Map,d=new Map;let S=0;for(const[_,C]of u){S+=1;const a=W(C,S);g.set(_,a),d.set(a.toLowerCase(),_)}return{byId:g,byRef:d}}function L(u,g){const d=g.type?String(g.type).toUpperCase():"FS",S=Number(g.lag),_=Number.isFinite(S)&&S!==0?`${S>0?"+":"-"}${Math.round(Math.abs(S)*100)/100}`:"";return`${u}${d}${_}`}function v(u,g,d,S){const _=K[g],C=_==="to"?"from":"to",a=[];for(const o of d){if(String(o[_])!==u)continue;const m=S.get(String(o[C]));m!=null&&a.push(L(m,o))}return a.join("; ")}function b(u){const g=[];for(const d of String(u??"").split(/[;,]/)){const S=d.trim();if(!S)continue;const _=Y.exec(S);if(!_)return{tokens:g,bad:S};const C=_[3]?(_[3]==="-"?-1:1)*Number(_[4]):0;g.push({token:S,ref:_[1],type:_[2]?_[2].toUpperCase():"FS",lag:C})}return{tokens:g,bad:null}}function w({id:u,column:g,text:d,dependencies:S,refs:_}){const C=K[g],a=C==="to"?"from":"to",{tokens:o,bad:m}=b(d);if(m!=null)return{ok:!1,key:"gantt.link.invalid",token:m};const $=[],h=new Set;for(const H of o){const z=_.byRef.get(H.ref.toLowerCase());if(z==null)return{ok:!1,key:"gantt.link.unknownRef",token:H.token};if(z===u)return{ok:!1,key:"gantt.link.self",token:H.token};const at=`${z}${H.type}`;if(h.has(at))return{ok:!1,key:"gantt.link.duplicate",token:H.token};h.add(at),$.push({...H,other:z})}const y=H=>String(H[C])===u,i=H=>`${String(H[a])}${H.type?String(H.type).toUpperCase():"FS"}`,r=new Map(S.filter(y).map(H=>[i(H),H])),f=S.filter(H=>!y(H)),M=[],D=[];for(const H of $){const z=r.get(`${H.other}${H.type}`);if(z)if((Number(z.lag)||0)===H.lag)M.push(z);else{const{lag:dt,...kt}=z;M.push(H.lag?{...kt,lag:H.lag}:kt)}else D.push({w:H,dep:C==="to"?{from:H.other,to:u,type:H.type}:{from:u,to:H.other,type:H.type}})}const I=[...f,...M];for(const{w:H,dep:z}of D){if(U(I,z.from,z.to))return{ok:!1,key:"gantt.link.cycle",token:H.token};I.push(z)}const O=[...f,...M,...D.map(({w:H,dep:z})=>H.lag?{...z,lag:H.lag}:z)];return{ok:!0,next:O.length===S.length&&O.every(H=>S.some(z=>z===H))?null:O}}function k({t:u,editable:g}){const d=new Map;for(const S of Object.keys(K))d.set(S,{id:S,field:S,title:u(`gantt.col.${S}`),type:"text",layout:{width:120},edit:{enabled:g}});return d}}),ae("packages/modules/gantt/task-columns.js",function(p,V){"use strict";Object.defineProperty(p,"EXTRA_TASK_COLUMN_IDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"VARIANCE_LATE_CLASS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"varianceText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"extraRowData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"extraEditPatch",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"buildExtraTaskColumns",{enumerable:!0,get:function(){return d}});const St=V("packages/modules/gantt/schedule.js"),U=St.CONSTRAINT_TYPES,K=St.resolveConstraintCode,W=V("packages/modules/gantt/time.js").toISODate,l=Object.freeze(["constraint","constraintDate","earlyStart","lateStart","lateFinish","baselineStart","baselineEnd","variance","note","sequence"]),L="lat-gantt-variance--late";function v(S){return S!=null&&typeof S=="object"&&!Array.isArray(S)&&!(S instanceof Date)}function b(S){return Number.isFinite(S)?W(S)??String(S):null}function w(S){if(!Number.isFinite(S))return"";const _=Math.round(S*100)/100;return _>0?`+${_}`:String(_)}function k(S){const _=S?S.constraint??S.constraintType:null,C=K(_),a=v(_)?_.date??_.at??_.constraintDate:S&&(S.constraintDate??S.constraintAt??S.at);let o=null;return a!=null&&a!==""&&(o=typeof a=="number"?b(a):String(a instanceof Date?a.toISOString().slice(0,10):a)),{type:C,date:o}}function u(S,_,C){const{type:a,date:o}=k(_);return{constraint:a,constraintDate:o,earlyStart:b(S.es),lateStart:b(S.ls),lateFinish:b(S.lf),baselineStart:b(S.baselineStart),baselineEnd:b(S.baselineEnd),variance:Number.isFinite(S.finishVariance)?S.finishVariance:null,note:_.note??null,sequence:C}}function g(S,_,C){const a=C==null||C==="";if(_==="note")return{note:a?null:String(C)};if(v(S&&S.constraint)){const o={...S.constraint};return _==="constraint"?o.type=a?"ASAP":C:o.date=a?null:C,{constraint:o}}return _==="constraint"?{constraint:a?"ASAP":C}:{constraintDate:a?null:C}}function d({t:S,editable:_,dateFormat:C,dateEditor:a}){const o=new Map,m=($,h)=>({id:$,field:$,title:S(`gantt.col.${$}`),type:"date",format:C,layout:{width:96},edit:h?{enabled:_,editor:a}:{enabled:!1}});o.set("constraint",{id:"constraint",field:"constraint",title:S("gantt.col.constraint"),layout:{width:150},lookup:{options:U.map($=>({id:$,label:S(`gantt.constraint.${$}`)})),sortBy:"optionOrder"},edit:{enabled:_,editor:"select"}}),o.set("constraintDate",m("constraintDate",!0));for(const $ of["earlyStart","lateStart","lateFinish","baselineStart","baselineEnd"])o.set($,m($,!1));return o.set("variance",{id:"variance",field:"variance",title:S("gantt.col.variance"),type:"number",layout:{width:84},edit:{enabled:!1},format:$=>w($&&$.value),cell:{classWhen:{[L]:$=>!!($&&$.row&&$.row.data&&$.row.data.variance>0)}}}),o.set("note",{id:"note",field:"note",title:S("gantt.col.note"),layout:{width:180},edit:{enabled:_}}),o.set("sequence",{id:"sequence",field:"sequence",title:S("gantt.col.sequence"),type:"number",layout:{width:56},edit:{enabled:!1}}),o}}),ae("packages/modules/gantt/split-grid-fixed.js",function(p,V){"use strict";Object.defineProperty(p,"drawnWidths",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"freezeFlexColumns",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"installFixedWidths",{enumerable:!0,get:function(){return Y}});const St="[data-resize]";function U(W){const l=new Map;if(!W||typeof W.querySelectorAll!="function")return l;for(const L of W.querySelectorAll(".lat-header-cell[data-col]")){const v=Math.round(L.getBoundingClientRect().width);v>0&&l.set(L.getAttribute("data-col"),v)}return l}function K(W,l){if(!W||!W.columns)return!1;const L=U(l);let v=!1;for(const b of W.columns.all()){const w=b&&b.layout;if(!w||!(w.flex>0))continue;const k=L.get(b.id);k>0&&(w.width=k,w.flex=0,v=!0)}return v}function Y(W,l){const L=v=>{const b=v.target;b&&typeof b.closest=="function"&&b.closest(St)&&K(l,W)};return W.addEventListener("pointerdown",L,!0),W.addEventListener("keydown",L,!0),()=>{W.removeEventListener("pointerdown",L,!0),W.removeEventListener("keydown",L,!0)}}}),ae("packages/modules/gantt/split-grid.js",function(p,V){"use strict";Object.defineProperty(p,"KEEP_COL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"keptAncestors",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"deriveParentKeys",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"compareCellValues",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"treeSortRows",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"normalizeColumn",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"mergeColumn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"resolveTableColumns",{enumerable:!0,get:function(){return m}}),Object.defineProperty(p,"SplitGridTable",{enumerable:!0,get:function(){return $}});const St=V("packages/modules/gantt/wbs.js"),U=St.compareWbs,K=St.isWbsCode,Y=V("packages/modules/gantt/split-grid-fixed.js"),W=Y.freezeFlexColumns,l=Y.installFixedWidths,L=Y.drawnWidths,v="__keep",b=Object.freeze({col:v,type:"text",op:"eq",value:"1"}),w=Object.freeze({id:v,field:v,title:v,type:"text",layout:{hidden:!0,resizable:!1},edit:{enabled:!1},sort:!1,quickFilter:!1});function k(h,y){const i=new Set(h),r=new Set;for(const f of i)for(let M=y.get(f);M!=null&&!r.has(M)&&!i.has(M);M=y.get(M))r.add(M);return r}const u=["value","cell","edit","layout","header","sort","filter","validation","export"];function g(h){const y=new Map,i=[];for(const r of h){const f=Number(r.__depth)||0;for(;i.length&&i[i.length-1].depth>=f;)i.pop();const M=String(r.__key);y.set(M,i.length?i[i.length-1].key:null),i.push({key:M,depth:f})}return y}function d(h,y){const i=h==null||h==="",r=y==null||y==="";if(i&&r)return 0;if(i)return 1;if(r)return-1;if(typeof h=="number"&&typeof y=="number")return h-y;if(h instanceof Date&&y instanceof Date)return h.getTime()-y.getTime();if(K(h)&&K(y))return U(h,y);const f=String(h),M=String(y);return f<M?-1:f>M?1:0}function S(h,y,i){const r=(y||[]).map(z=>({field:z&&i(z.col),desc:!!z&&(z.dir==="desc"||z.descending===!0)})).filter(z=>z.field!=null);if(!h.length||!r.length)return h;const f=h.filter(z=>z.__pinLast);if(f.length)return[...S(h.filter(z=>!z.__pinLast),y,i),...f];const M=g(h),D=new Map(h.map(z=>[String(z.__key),z])),I=new Map;for(const z of h){const at=String(z.__key),dt=M.get(at);I.has(dt)||I.set(dt,[]),I.get(dt).push(at)}const O=(z,at)=>{const dt=D.get(z),kt=D.get(at);for(const{field:Tt,desc:Ft}of r){const P=dt[Tt],j=kt[Tt],x=P==null||P==="",R=j==null||j==="";if(x||R){if(x&&R)continue;return x?1:-1}const N=d(P,j);if(N)return Ft?-N:N}return z<at?-1:z>at?1:0};for(const z of I.values())z.sort(O);const B=[],H=z=>{for(const at of I.get(z)||[])B.push(D.get(at)),H(at)};return H(null),B}function _(h){return h!=null&&typeof h=="object"&&!Array.isArray(h)}function C(h){const y={...h};y.id==null&&y.key!=null&&(y.id=String(y.key)),delete y.key,delete y.kind;const i=_(y.layout)?{...y.layout}:Number.isFinite(y.layout)?{width:y.layout}:{};return Number.isFinite(h.width)&&i.width==null&&(h.width>0?i.width=h.width:i.flex=1),Number.isFinite(h.minWidth)&&i.min==null&&(i.min=h.minWidth),Number.isFinite(h.maxWidth)&&i.max==null&&(i.max=h.maxWidth),typeof h.resizable=="boolean"&&i.resizable==null&&(i.resizable=h.resizable),typeof h.hidden=="boolean"&&i.hidden==null&&(i.hidden=h.hidden),typeof h.pin=="string"&&i.pin==null&&(i.pin=h.pin),delete y.width,delete y.minWidth,delete y.maxWidth,delete y.resizable,delete y.hidden,delete y.pin,Object.keys(i).length&&(y.layout=i),typeof h.editable=="boolean"&&y.edit==null&&(y.edit={enabled:h.editable}),delete y.editable,_(y.editor)&&a(y),delete y.editor,y}function a(h){const y=h.editor;if(!_(y)||typeof y.type!="string")return;const i=_(h.edit)?{...h.edit}:{};i.editor==null&&(i.editor=y.type);const r={..._(i.props)?i.props:{}};if(y.type==="select"){const f=_(h.lookup)?{...h.lookup}:{};y.options!=null&&(f.options=y.options),f.sortBy==null&&(f.sortBy="optionOrder"),h.lookup=f}else if(y.type==="number"){for(const f of["min","max","step"])Number.isFinite(y[f])&&(r[f]=y[f]);r.clamp==null&&(r.clamp=!0),Number.isFinite(y.step)&&r.spinner==null&&(r.spinner=!0)}Object.keys(r).length&&(i.props=r),i.enabled==null&&(i.enabled=!0),Object.keys(i).length&&(h.edit=i)}function o(h,y){const i={...h,...y};for(const r of u)_(h[r])&&_(y[r])&&(i[r]={...h[r],...y[r]});return _(i.layout)&&i.layout.width>0&&_(h.layout)&&h.layout.flex>0&&_(y.layout)&&y.layout.flex==null&&(i.layout.flex=0),i}function m(h,y,i,r){const f=Array.isArray(h)&&h.length?h:i,M=[],D=new Set;for(const I of f){let O=null;if(typeof I=="string")O=y.has(I)?{...y.get(I)}:null;else if(_(I)){const B=C(I),H=y.has(B.id)?B.id:typeof I.kind=="string"&&y.has(I.kind)?I.kind:null;O=H?o(y.get(H),B):B,H&&O.id==null&&(O.id=H)}!O||O.id==null||D.has(String(O.id))||(O.id=String(O.id),D.add(O.id),M.push(O))}return!D.has(r)&&y.has(r)&&M.unshift({...y.get(r)}),M}class ${host;grid=null;#t=new Map;#i;#e=!1;#n=[];#s=!1;#o={filters:null,quick:"",mode:void 0};#l=null;#h=!1;#f=new Map;#p=[];#g=[];#a=[];constructor({createGrid:y,host:i,columns:r,rowHeight:f,headerHeight:M,config:D,keepAncestors:I,ancestorClass:O,treeSort:B}){this.host=i,this.#i=f,this.#s=!!I,this.#h=!!B,this.#h&&(this.#f=new Map(r.map(at=>[String(at.id),String(at.field!=null?at.field:at.id)])));const H=_(D)?D:{},z=H.rowClass;this.grid=y(i,{...H,...this.#s?{rowClass:at=>{const dt=typeof z=="function"?z(at):z||[],kt=Array.isArray(dt)?dt.slice():[dt];return at&&at.data&&at.data.__ancestor&&kt.push(O),kt.filter(Boolean)}}:{},rows:[],rowKey:"__key",columns:this.#s?[...r,{...w}]:r,headerHeight:M,rowHeight:at=>this.#t.get(String(at&&at.key))||this.#i}),this.grid&&this.#n.push(l(i,this.grid)),this.#s&&this.grid&&this.#r(),this.#h&&this.grid&&this.#d()}#d(){const y=this.grid,i=this;Object.defineProperty(y,"sort",{value:{get:()=>i.#p.map(f=>({...f})),set:f=>{const M=(Array.isArray(f)?f:[]).filter(D=>D&&typeof D.col=="string"&&i.#f.has(D.col)).map(D=>({col:D.col,dir:D.dir==="desc"||D.descending===!0?"desc":"asc"}));if(M.length===1&&M[0].dir==="asc"){const{col:D}=M[0],I=i.#p.length===1&&i.#p[0].col===D?i.#p[0].dir:null;i.#c(I==="asc"?[{col:D,dir:"desc"}]:I==="desc"?[]:M)}else i.#c(M)},clear:()=>i.#c([])},configurable:!0})}#c(y){this.#p=y.map(i=>({...i})),this.#y();for(const i of this.#a.slice())i({sort:this.#p.map(r=>({...r}))})}#y(){if(!this.grid)return;const y=this.#p.length?S(this.#g,this.#p,i=>this.#f.get(i)):this.#g;this.grid.rows.load(y)}#r(){const y=this.grid,i=y.filters;this.#l=i;const r=this.#o,f={...i,get:()=>r.filters,set:M=>{r.filters=M&&Object.keys(M).length?M:null,this.#m()},clear:()=>{r.filters=null,r.quick="",this.#m()},quick:(M,D)=>{r.quick=String(M||"").trim(),D&&typeof D.mode=="string"&&(r.mode=D.mode),this.#m()},quickState:()=>({text:r.quick,mode:r.mode||"contains"})};Object.defineProperty(y,"filters",{value:f,configurable:!0})}#m(){const{filters:y,quick:i}=this.#o,r=[];y&&r.push(y);const f=i?this.#w(i):null;f&&r.push(f);let M=null;r.length===1?M=r[0]:r.length>1&&(M={op:"and",conditions:r});const D=M?{op:"or",conditions:[M,{...b}]}:null,I=this.#l;I.quick(""),I.set(D)}#w(y){const r=this.grid.columns.all().filter(f=>f.id!==v&&f.quickFilter!==!1&&(f.type==null||f.type==="text"||f.type==="string")).map(f=>({col:f.id,op:"contains",value:y}));return r.length?r.length===1?r[0]:{op:"or",conditions:r}:null}isFiltering(){return!!(this.#o.filters||this.#o.quick)}on(y,i){if(this.#h&&y==="sort:changed"){this.#a.push(i),this.#n.push(()=>{const f=this.#a.indexOf(i);f>=0&&this.#a.splice(f,1)});return}const r=this.grid&&typeof this.grid.on=="function"?this.grid.on(y,i):null;typeof r=="function"&&this.#n.push(r)}setRows(y,i){this.grid&&(this.#t=i,this.#h?(this.#g=y,this.#y()):this.grid.rows.load(y))}displayedKeys(){const y=[];return this.grid&&this.grid.rows.forEach(i=>{i&&!i.group&&i.key!=null&&y.push(String(i.key))}),y}viewport(){return this.host.querySelector(".lat-body-viewport")}lockScroll(y){const i=f=>{if(this.#e)return;this.#e=!0;const M=this.viewport(),D=M?M.scrollTop:f&&Number.isFinite(f.top)?f.top:0;y.scrollTop!==D&&(y.scrollTop=D),this.#e=!1},r=()=>{if(this.#e||!this.grid)return;this.#e=!0;const f=this.viewport();f&&f.scrollTop!==y.scrollTop?f.scrollTop=y.scrollTop:!f&&this.grid.scroll&&this.grid.scroll.to({top:y.scrollTop}),this.#e=!1};this.on("scroll",i),y.addEventListener("scroll",r),this.#n.push(()=>y.removeEventListener("scroll",r))}getState(){const y=this.grid&&this.grid.state?this.grid.state.get():null;if(!y)return y;let i=y;return this.#s&&(Array.isArray(i.columns)&&(i.columns=i.columns.filter(r=>r&&r.id!==v)),Array.isArray(i.columnOrder)&&(i.columnOrder=i.columnOrder.filter(r=>r!==v)),this.#o.quick&&(i={...i,ganttQuick:this.#o.quick})),this.#h&&(i={...i,sort:this.#p.map(r=>({...r}))}),i}setState(y){if(!(!this.grid||!this.grid.state||!_(y))){for(const i of Array.isArray(y.columns)?y.columns:[]){const r=i&&this.grid.columns.get(i.id);r&&r.layout&&i.width>0&&!(i.flex>0)&&(r.layout.flex=0)}if(this.grid.state.apply(this.#h?{...y,sort:[]}:y),this.#s&&this.grid.filters.quick(typeof y.ganttQuick=="string"?y.ganttQuick:""),this.#h){const i=(Array.isArray(y.sort)?y.sort:[]).filter(r=>r&&typeof r.col=="string"&&this.#f.has(r.col)).map(r=>({col:r.col,dir:r.dir==="desc"||r.descending===!0?"desc":"asc"}));this.#c(i)}}}freezeColumns(){W(this.grid,this.host)}widths(){const y={};if(!this.grid)return y;for(const r of this.grid.columns.state())r.id!==v&&Number.isFinite(r.width)&&(y[r.id]=r.width);const i=L(this.host);for(const r of this.grid.columns.all())r.layout&&r.layout.flex>0&&i.has(r.id)&&r.id in y&&(y[r.id]=i.get(r.id));return y}destroy(){for(const y of this.#n.splice(0))y();this.grid&&(this.grid.destroy(),this.grid=null),this.host&&this.host.parentNode&&this.host.parentNode.removeChild(this.host)}}}),ae("packages/modules/gantt/band-grid.js",function(p,V){"use strict";Object.defineProperty(p,"bucketColumnSpec",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"bucketColumnWidths",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"pinStart",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"mountBandGrid",{enumerable:!0,get:function(){return Y}});function St({id:W,width:l,format:L=null,cell:v=null,edit:b=null}){const w={id:W,field:W,title:"",type:"number",headerControls:"none",sort:!1,filter:!1,quickFilter:!1,allowGroup:!1,allowPivot:!1,allowTotal:!1,layout:{width:Math.max(1,l),min:1,flex:0,pin:null,movable:!1,resizable:!1,lockVisible:!0},cell:{align:"right",...v||{}}};return L&&(w.format=L),b?w.edit=b:w.edit={enabled:!1},w}function U(W,l){return W.map(L=>Math.round(l(L.end))-Math.max(0,Math.round(l(L.start))))}function K(W,l,L,v={}){const b=Number.isFinite(v.minFill)?v.minFill:60,w=Number.isFinite(v.floor)?v.floor:40;let k=0;for(const g of W){if(g.id===L)continue;const d=g.layout&&typeof g.layout=="object"?g.layout:{},S=Number.isFinite(d.width)?d.width:typeof v.defaultWidth=="function"?v.defaultWidth(g,l):110;g.__w=Math.max(w,S),k+=g.__w}const u=Math.max(b,l-k);for(const g of W){const d=g.id===L?u:g.__w;delete g.__w,g.layout={...g.layout||{},width:d,flex:0,pin:"start"}}}function Y({createGrid:W,host:l,config:L,columns:v,headerHeight:b,rowHeight:w,rowClass:k,centreClass:u,onScroll:g}){const d=W(l,{...L,rows:[],rowKey:"__key",columns:v,headerHeight:b,rowHeight:w,rowClass:k});if(!d)return{grid:null,time:null,centre:null,offScroll:null};const S=l.querySelector(".lat-body-viewport"),_=l.querySelector(".lat-body-centre");_&&u&&_.classList.add(u);let C=null;return S&&g&&(S.addEventListener("scroll",g),C=()=>S&&S.removeEventListener("scroll",g)),{grid:d,time:S,centre:_,offScroll:C}}}),ae("packages/modules/gantt/date-editor.js",function(p,V){"use strict";Object.defineProperty(p,"SplitDateEditor",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"default",{enumerable:!0,get:function(){return w}});const St=V("packages/modules/gantt/time.js"),U=St.toDayNumber,K=St.toISODate,Y=["yyyy","yy","MM","M","dd","d"];function W(k){const u=[];let g=0;for(;g<k.length;){if(k[g]==="'"){const S=k.indexOf("'",g+1);g=S<0?k.length:S+1;continue}const d=Y.find(S=>k.startsWith(S,g));if(!d){g+=1;continue}d[0]==="d"?u.push("d"):d[0]==="M"?u.push("M"):u.push("y"),g+=d.length}return u}function l(k){let u=[];try{const g=new Intl.DateTimeFormat(k||void 0,{year:"numeric",month:"numeric",day:"numeric"}).formatToParts(new Date(2e3,0,2));for(const d of g)d.type==="year"?u.push("y"):d.type==="month"?u.push("M"):d.type==="day"&&u.push("d")}catch{u=[]}return u.length===3?u:["y","M","d"]}function L(k,u){const g=String(k).match(/\d+/g);if(!g||g.length<3||!u||u.length<3)return null;const d={};for(let o=0;o<u.length;o+=1)d[u[o]]=Number(g[o]);let{y:S,M:_,d:C}=d;if(!Number.isFinite(S)||!Number.isFinite(_)||!Number.isFinite(C)||(S<100&&(S+=S<70?2e3:1900),_<1||_>12||C<1||C>31))return null;const a=`${String(S).padStart(4,"0")}-${String(_).padStart(2,"0")}-${String(C).padStart(2,"0")}`;return U(a)}function v(k,u,g){const d=String(k??"").trim();if(d==="")return null;if(/^-?\d+(\.\d+)?$/.test(d))return Number(d);const S=u&&u.format,_=S&&typeof S=="object"&&typeof S.pattern=="string"?S.pattern:null,C=_?W(_):l(g),a=L(d,C);if(Number.isFinite(a))return a;const o=U(d);return Number.isFinite(o)?o:null}class b{#t=null;#i=null;#e={};#n;#s="";#o;#l=null;init(u){this.#t=u||{},this.#i=this.#t.document||this.#t.cell&&this.#t.cell.ownerDocument||(typeof document<"u"?document:null),this.#e=this.#t.column||{},this.#n=this.#t.locale,this.#s=this.#t.text==null?"":String(this.#t.text),this.#o=this.#t.value;const g=this.#i.createElement("input");g.setAttribute("type","text"),g.setAttribute("class","lat-editor__input"),this.#e.title&&g.setAttribute("aria-label",String(this.#e.title)),g.value=this.#s,typeof this.#t.key=="string"&&this.#t.key.length===1&&(g.value=this.#t.key),this.#l=g}element(){return this.#l}focusTarget(){return this.#l}value(){const u=this.#l?this.#l.value:"";if(u===this.#s)return this.#o;const g=u.trim();if(g==="")return null;const d=v(g,this.#e,this.#n);return Number.isFinite(d)?K(d)??String(d):g}destroy(){this.#l=null,this.#t=null}}const w=b}),ae("packages/modules/gantt/issues-panel.js",function(p,V){"use strict";Object.defineProperty(p,"issuesPanelCss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"createIssuesPanel",{enumerable:!0,get:function(){return L}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=St.clear,W=Object.freeze({cycle:[{action:"removeLink",labelKey:"gantt.issues.fixRemoveLink"}],constraint:[{action:"asap",labelKey:"gantt.issues.fixAsap"}],lock:[{action:"unlock",labelKey:"gantt.issues.fixUnlock"},{action:"removeLink",labelKey:"gantt.issues.fixRemoveLink"}],deadline:[{action:"clearDeadline",labelKey:"gantt.issues.fixClearDeadline"}]});function l(v){return`
|
|
109
109
|
.${v}__issues{flex:0 0 auto;display:flex;flex-direction:column;border-top:1px solid var(--lattice-border-color);background:var(--lattice-surface);color:var(--lattice-foreground);font-size:var(--lattice-font-size);max-height:40%}
|
|
110
110
|
.${v}__issues-head{display:flex;align-items:center;gap:8px;width:100%;margin:0;padding:6px 10px;border:0;background:var(--lattice-surface);color:inherit;font:inherit;font-weight:600;text-align:left;cursor:pointer}
|
|
111
111
|
.${v}__issues-head:focus-visible{outline:2px solid var(--lattice-focus-color);outline-offset:-2px}
|
|
@@ -127,37 +127,37 @@ ${Et(Q,"row")}
|
|
|
127
127
|
.${v}__issues-fix{border:1px solid var(--lattice-border-color);border-radius:var(--lattice-radius);background:var(--lattice-surface);color:inherit;font:inherit;font-size:var(--lattice-font-size);padding:2px 8px;cursor:pointer}
|
|
128
128
|
.${v}__issues-fix:hover{background:var(--lattice-hovered-background)}
|
|
129
129
|
.${v}__issues-fix:focus-visible{outline:2px solid var(--lattice-focus-color);outline-offset:-1px}
|
|
130
|
-
`}function L({doc:v,t:m,ns:w,onSelect:k,onFix:u}){let f=!0,d=[];const S=U(v,"div",`${w}__issues`);S.setAttribute("role","group"),S.setAttribute("aria-label",m("gantt.issues.title"));const _=U(v,"button",`${w}__issues-head`);_.setAttribute("type","button"),_.setAttribute("aria-expanded","true");const C=U(v,"span",`${w}__issues-caret`);C.setAttribute("aria-hidden","true"),K(C,"▾");const a=U(v,"span",`${w}__issues-title`);K(a,m("gantt.issues.title"));const o=U(v,"span",`${w}__issues-badge`);_.appendChild(C),_.appendChild(a),_.appendChild(o);const p=U(v,"div",`${w}__issues-body`),$=U(v,"ul",`${w}__issues-list`);$.setAttribute("role","list");const h=U(v,"p",`${w}__issues-empty`);K(h,m("gantt.issues.empty")),p.appendChild(h),p.appendChild($),S.appendChild(_),S.appendChild(p);const y=()=>{S.classList.toggle(`${w}__issues--collapsed`,!f),_.setAttribute("aria-expanded",f?"true":"false")},i=()=>{f=!f,y()};_.addEventListener("click",i);const r=()=>[...$.querySelectorAll(`.${w}__issues-select`)],b=I=>{const O=I.key;if(O!=="ArrowDown"&&O!=="ArrowUp")return;const z=r();if(!z.length)return;const W=z.indexOf(I.target&&I.target.closest?I.target.closest(`.${w}__issues-select`):null),B=W<0?0:Math.min(z.length-1,Math.max(0,W+(O==="ArrowDown"?1:-1)));I.preventDefault&&I.preventDefault(),z[B].focus()};$.addEventListener("keydown",b);const T=I=>{const O=U(v,"li",`${w}__issues-row`);O.setAttribute("role","listitem");const z=U(v,"button",`${w}__issues-select`);z.setAttribute("type","button"),K(z,I.message);const W=()=>k(I);z.addEventListener("click",W),O.appendChild(z);const B=U(v,"div",`${w}__issues-actions`);for(const at of H[I.kind]||[]){const ct=U(v,"button",`${w}__issues-fix`);ct.setAttribute("type","button"),ct.setAttribute("data-action",at.action),K(ct,m(at.labelKey));const kt=Tt=>{Tt.stopPropagation&&Tt.stopPropagation(),u(I,at.action)};ct.addEventListener("click",kt),B.appendChild(ct)}return B.childNodes.length&&O.appendChild(B),O},j=I=>{d=Array.isArray(I)?I:[],Y($);for(const z of d)$.appendChild(T(z));const O=d.length;O>0?(o.removeAttribute("hidden"),K(o,String(O)),o.setAttribute("aria-label",m("gantt.issues.count",{count:O})),h.setAttribute("hidden",""),$.removeAttribute("hidden")):(o.setAttribute("hidden",""),K(o,""),h.removeAttribute("hidden"),$.setAttribute("hidden",""))};return y(),j([]),{element:S,update:j,isOpen:()=>f,setOpen:I=>{f=!!I,y()},destroy:()=>{_.removeEventListener("click",i),$.removeEventListener("keydown",b),S.parentNode&&S.parentNode.removeChild(S)}}}}),ae("packages/modules/gantt/events-range.js",function(g,V){"use strict";Object.defineProperty(g,"createVisibleRangeNotifier",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"visibleRangeDays",{enumerable:!0,get:function(){return Y}});const U=V("packages/core/src/internal/schedule.js").frameBatched;function K(H,l){let L=null;const m=U(()=>{const w=l();if(!w)return;const k=`${w.start}\0${w.end}\0${w.zoom}`;k!==L&&(L=k,H(w))});return{note(){m()},dispose(){m.cancel()}}}function Y(H,l,L){if(!H||!Number.isFinite(H.domainMin)||!Number.isFinite(H.pxPerDay)||H.pxPerDay<=0)return null;const v=Number(l)||0,m=Math.max(0,Number(L)||0),w=v+m,k=Math.floor(H.domainMin+v/H.pxPerDay),u=Math.ceil(H.domainMin+w/H.pxPerDay)-1;return u<k?null:{start:k,end:u}}}),ae("packages/modules/gantt/events-scroll.js",function(g,V){"use strict";Object.defineProperty(g,"createScrollNotifier",{enumerable:!0,get:function(){return K}});const U=V("packages/core/src/internal/schedule.js").frameBatched;function K(Y,H){let l=null;const v=U(()=>{const m=H();if(!m)return;const w=`${m.top}\0${m.left}`;w!==l&&(l=w,Y(m))});return{note(){v()},dispose(){v.cancel()}}}}),ae("packages/core/src/internal/icon-builtins.js",function(g,V){"use strict";Object.defineProperty(g,"BUILT_IN_ICONS",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"normaliseIcon",{enumerable:!0,get:function(){return U}});const St={chevronRight:{viewBox:"0 0 16 16",paths:["M6 3.5 10.5 8 6 12.5"],paint:"stroke"},chevronDown:{viewBox:"0 0 16 16",paths:["M3.5 6 8 10.5 12.5 6"],paint:"stroke"},chevronUp:{viewBox:"0 0 16 16",paths:["M3.5 10 8 5.5 12.5 10"],paint:"stroke"},chevronLeft:{viewBox:"0 0 16 16",paths:["M10 3.5 5.5 8 10 12.5"],paint:"stroke"},check:{viewBox:"0 0 16 16",paths:["M3.5 8.5 6.5 11.5 12.5 4.5"],paint:"stroke"},dash:{viewBox:"0 0 16 16",paths:["M4 8h8"],paint:"stroke"},close:{viewBox:"0 0 16 16",paths:["M4 4l8 8M12 4l-8 8"],paint:"stroke"},plus:{viewBox:"0 0 16 16",paths:["M8 3.5v9M3.5 8h9"],paint:"stroke"},minus:{viewBox:"0 0 16 16",paths:["M3.5 8h9"],paint:"stroke"},info:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm.75 4a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM7.25 7h1.5v4.5h-1.5Z"]},success:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm3.2 4.4-4 4.6-2.4-2.3 1-1.1 1.3 1.2 3-3.4Z"]},warning:{viewBox:"0 0 16 16",paths:["M8 1.5 15 14H1Zm-.75 4v4h1.5v-4Zm0 5v1.5h1.5V10.5Z"]},danger:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-.75 3h1.5v5h-1.5Zm0 6h1.5V12h-1.5Z"]},clock:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-.75 3h1.5v3.7l2.5 1.5-.75 1.3-3.25-2Z"]},calendar:{viewBox:"0 0 16 16",paths:["M3 2.5h10v11H3z","M3 5.5h10","M5.5 1.5v2","M10.5 1.5v2"],paint:"stroke"},lock:{viewBox:"0 0 16 16",paths:["M4.5 7V5a3.5 3.5 0 1 1 7 0v2H13v7H3V7Zm1.5 0h4V5a2 2 0 1 0-4 0Z"]},link:{viewBox:"0 0 16 16",paths:["M6.5 9.5a3 3 0 0 1 0-4l2-2a3 3 0 0 1 4 4l-1 1M9.5 6.5a3 3 0 0 1 0 4l-2 2a3 3 0 0 1-4-4l1-1"],paint:"stroke"},external:{viewBox:"0 0 16 16",paths:["M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5 7 9"],paint:"stroke"},filter:{viewBox:"0 0 16 16",paths:["M2 3h12l-4.5 5.2V13L6.5 11.5V8.2Z"]},pause:{viewBox:"0 0 16 16",paths:["M4.5 3h2.5v10H4.5zM9 3h2.5v10H9z"]},play:{viewBox:"0 0 16 16",paths:["M4.5 3l8 5-8 5z"]},chart:{viewBox:"0 0 16 16",paths:["M2.5 13.5h11","M4.5 13.5v-4","M8 13.5v-8","M11.5 13.5v-6"],paint:"stroke"},palette:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 0 0 0 13c.7 0 1.2-.5 1.2-1.1 0-.3-.1-.6-.3-.8a1.1 1.1 0 0 1 .8-1.9h1.4A3.4 3.4 0 0 0 14.5 7c0-3-2.9-5.5-6.5-5.5Z","M4.6 7.6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM6.7 4.6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM9.9 4.7a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM11.9 6.9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"]},undo:{viewBox:"0 0 16 16",paths:["M3 8h6.5a3.25 3.25 0 0 1 0 6.5H6M3 8l3-3M3 8l3 3"],paint:"stroke"},redo:{viewBox:"0 0 16 16",paths:["M13 8H6.5a3.25 3.25 0 0 0 0 6.5H10M13 8l-3-3M13 8l-3 3"],paint:"stroke"},columns:{viewBox:"0 0 16 16",paths:["M2.5 2.5h11v11h-11zM6.5 2.5v11M10 2.5v11"],paint:"stroke"},download:{viewBox:"0 0 16 16",paths:["M8 2.5v7.5M8 10 5 7M8 10l3-3M2.5 12.5h11"],paint:"stroke"},restore:{viewBox:"0 0 16 16",paths:["M3 8a5 5 0 1 0 1.6-3.7M3 3v2.8h2.8"],paint:"stroke"},spreadsheet:{viewBox:"0 0 16 16",paths:["M3 2.5h10v11H3zM3 6h10M3 9.5h10M6.5 6v7.5"],paint:"stroke"},print:{viewBox:"0 0 16 16",paths:["M4.5 6V2.5h7V6M4.5 11.5h-2V6h11v5.5h-2M4.5 9.5h7v4h-7z"],paint:"stroke"},maximise:{viewBox:"0 0 16 16",paths:["M2.5 6V2.5H6M10 2.5h3.5V6M13.5 10v3.5H10M6 13.5H2.5V10"],paint:"stroke"},minimise:{viewBox:"0 0 16 16",paths:["M6 2.5V6H2.5M13.5 6H10V2.5M10 13.5V10h3.5M2.5 10H6v3.5"],paint:"stroke"},views:{viewBox:"0 0 16 16",paths:["M4 2.5h8v11L8 11l-4 2.5z"],paint:"stroke"},search:{viewBox:"0 0 16 16",paths:["M7 2.5a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9M10.4 10.4 13.5 13.5"],paint:"stroke"},pencil:{viewBox:"0 0 16 16",paths:["M2.5 11.2 11 2.7l2.3 2.3-8.5 8.5-3 .7z"],paint:"stroke"},trash:{viewBox:"0 0 16 16",paths:["M3 4.5h10M6.5 4.5V3h3v1.5M4.5 4.5l.7 8.5h5.6l.7-8.5M6.8 7v3.7M9.2 7v3.7"],paint:"stroke"},share:{viewBox:"0 0 16 16",paths:["M11.5 5.5a1.8 1.8 0 1 0 0-3.6 1.8 1.8 0 0 0 0 3.6M4.5 9.8a1.8 1.8 0 1 0 0-3.6 1.8 1.8 0 0 0 0 3.6M11.5 14.1a1.8 1.8 0 1 0 0-3.6 1.8 1.8 0 0 0 0 3.6M6.1 7.1l3.8-1.9M6.1 8.9l3.8 1.9"],paint:"stroke"},pin:{viewBox:"0 0 16 16",paths:["M8 2v6M5 8h6l1 2.5H4zM8 10.5V14"],paint:"stroke"},sortAsc:{viewBox:"0 0 16 16",paths:["M8 3.5 12 8H4Z"]},sortDesc:{viewBox:"0 0 16 16",paths:["M8 12.5 4 8h8Z"]},menu:{viewBox:"0 0 16 16",paths:["M2.5 4.5h11M2.5 8h11M2.5 11.5h11"],paint:"stroke"},ellipsis:{viewBox:"0 0 16 16",paths:["M3 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Zm5 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Zm5 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"]},ellipsisVertical:{viewBox:"0 0 16 16",paths:["M6.5 3a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0Zm0 5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0Zm0 5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0Z"]},drag:{viewBox:"0 0 16 16",paths:["M6 3.5h1.5V5H6Zm3 0h1.5V5H9ZM6 7.25h1.5v1.5H6Zm3 0h1.5v1.5H9ZM6 11h1.5v1.5H6Zm3 0h1.5v1.5H9Z"]},star:{viewBox:"0 0 16 16",paths:["M8 1.6l1.96 3.97 4.38.64-3.17 3.09.75 4.36L8 11.6l-3.92 2.06.75-4.36L1.66 6.21l4.38-.64Z"]},heart:{viewBox:"0 0 16 16",paths:["M8 14.2 2.4 8.6a3.3 3.3 0 0 1 4.67-4.67L8 4.86l.93-.93A3.3 3.3 0 0 1 13.6 8.6Z"]},circleFilled:{viewBox:"0 0 16 16",paths:["M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Z"]},square:{viewBox:"0 0 16 16",paths:["M3 3h10v10H3Z"]},bolt:{viewBox:"0 0 16 16",paths:["M9.5 1.5 3.5 9h3.2l-.7 5.5L12.5 7H9.3Z"]},flag:{viewBox:"0 0 16 16",paths:["M4 1.5h1.5v13H4Zm1.5 1h7.5l-1.6 2.6L13 7.7H5.5Z"]},arrow:{viewBox:"0 0 16 16",paths:["M3 13 12.5 3.5","M7.5 3.5H12.5V8.5"],paint:"stroke"},highlight:{viewBox:"0 0 16 16",paths:["M4 11 10 5l2 2-6 6H4z","M3 14.5h10"],paint:"stroke"},eraser:{viewBox:"0 0 16 16",paths:["M3 11 9 5 13 9 7 15Z","M5 13 9 9"],paint:"stroke"},thumbUp:{viewBox:"0 0 16 16",paths:["M5.5 6.8 8.6 1.5a1.6 1.6 0 0 1 1.5 2.1L9.4 6h3.4a1.4 1.4 0 0 1 1.35 1.78l-1.3 4.6A1.9 1.9 0 0 1 11 13.8H5.5ZM4 6.5H1.5v7.3H4Z"]},eye:{viewBox:"0 0 16 16",paths:["M8 3.2c3.3 0 6 3 6.6 4.5C14 9.3 11.3 12.3 8 12.3S2 9.3 1.4 7.7C2 6.2 4.7 3.2 8 3.2Zm0 2a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"]},eyeOff:{viewBox:"0 0 16 16",paths:["M2.2 2.9 13.1 13.8M8 3.2c3.3 0 6 3 6.6 4.5a9.4 9.4 0 0 1-1.9 2.4M5 4.2A9 9 0 0 0 1.4 7.7C2 9.3 4.7 12.3 8 12.3c.9 0 1.7-.2 2.5-.5M6.3 6a2.5 2.5 0 0 0 3.4 3.5"],paint:"stroke"},copy:{viewBox:"0 0 16 16",paths:["M5.5 2.5h8v8M2.5 5.5h8v8h-8Z"],paint:"stroke"},present:{viewBox:"0 0 16 16",paths:["M2 2.5h12v8H2Z","M8 10.5v3","M6 13.5h4"],paint:"stroke"},cabinet:{viewBox:"0 0 16 16",paths:["M3 2h10v12H3ZM5 4v4h2.5V4ZM8.5 4v4H11V4ZM5 9.5V11h6V9.5Z"]},splice:{viewBox:"0 0 16 16",paths:["M8 4.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7ZM8 6.8a1.2 1.2 0 1 1 0 2.4 1.2 1.2 0 0 1 0-2.4ZM1.5 7.2h3v1.6h-3ZM11.5 7.2h3v1.6h-3Z"]},exchange:{viewBox:"0 0 16 16",paths:["M8 1.5 14.5 6v1H1.5V6ZM3 8h2v5H3ZM7 8h2v5H7ZM11 8h2v5h-2ZM1.5 13.5h13V15h-13Z"]},pole:{viewBox:"0 0 16 16",paths:["M7.2 1.5h1.6V15H7.2ZM3 3.5h10V5H3ZM4.5 7h7v1.4h-7Z"]},chamber:{viewBox:"0 0 16 16",paths:["M2.5 3.5h11v9h-11ZM4.5 5.5v5h7v-5ZM6 7h4v1.5H6Z"]},premises:{viewBox:"0 0 16 16",paths:["M8 1.8 14.5 7.5h-2V14h-9V7.5h-2ZM6.8 10.4V14h2.4v-3.6Z"]},fault:{viewBox:"0 0 16 16",paths:["M5.2 1.5h5.6L14.5 5.2v5.6L10.8 14.5H5.2L1.5 10.8V5.2ZM5.4 9.4 6.6 10.6 8 9.2 9.4 10.6 10.6 9.4 9.2 8 10.6 6.6 9.4 5.4 8 6.8 6.6 5.4 5.4 6.6 6.8 8Z"]},user:{viewBox:"0 0 16 16",paths:["M8 2a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z","M8 9c3 0 5.5 1.5 5.5 3.5V14h-11v-1.5C2.5 10.5 5 9 8 9Z"]},blank:{viewBox:"0 0 16 16",paths:[""]}};function U(K){return typeof K=="string"?{viewBox:"0 0 16 16",paths:[K],paint:"fill"}:Array.isArray(K)?{viewBox:"0 0 16 16",paths:K.slice(),paint:"fill"}:{viewBox:K&&K.viewBox||"0 0 16 16",paths:K&&Array.isArray(K.paths)?K.paths.slice():K&&K.path?[K.path]:[],paint:K&&K.paint==="stroke"?"stroke":"fill"}}}),ae("packages/dom/src/cell/icons.js",function(g,V){"use strict";Object.defineProperty(g,"SVG_NS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"registerIcon",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"registerIcons",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"icon",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"iconNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"createIcon",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"updateIcon",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"isIconMarkup",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"renderIconInto",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"resetIcons",{enumerable:!0,get:function(){return C}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/core/src/internal/icon-builtins.js"),Y=K.BUILT_IN_ICONS,H=K.normaliseIcon,l="http://www.w3.org/2000/svg",L=new Map(Object.entries(Y));function v(a,o){L.set(a,H(o))}function m(a){if(a)for(const o of Object.keys(a))v(o,a[o])}function w(a){return L.get(a)}function k(){return[...L.keys()]}function u(a,o,p){let $=L.get(o);$||(U(`icon:${o}`,`Unknown icon '${o}'; drew a blank glyph in its place. Register it with grid.icons or config.icons.`),$=L.get("blank"));const h=a.createElementNS(l,"svg");h.setAttribute("class",p&&p.className||"lat-icon"),h.setAttribute("viewBox",$.viewBox),h.setAttribute("focusable","false"),h.setAttribute("aria-hidden","true"),d(h,$.paint);const y=[];for(const i of $.paths){const r=a.createElementNS(l,"path");r.setAttribute("d",i),h.appendChild(r),y.push(r)}return h.__latIcon={name:o,nodes:y,paint:$.paint},h}function f(a,o){const p=a&&a.__latIcon;if(!p)return!1;if(p.name===o)return!0;const $=L.get(o);if(!$)return U(`icon:${o}`,`Unknown icon '${o}'. Register it with grid.icons or config.icons.`),!1;if($.paths.length!==p.nodes.length)return!1;for(let h=0;h<$.paths.length;h++)p.nodes[h].setAttribute("d",$.paths[h]);return a.setAttribute("viewBox",$.viewBox),$.paint!==p.paint&&(d(a,$.paint),p.paint=$.paint),p.name=o,!0}function d(a,o){if(o==="stroke"){a.setAttribute("fill","none"),a.setAttribute("stroke","currentColor"),a.setAttribute("stroke-width","1.5"),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round");return}a.setAttribute("fill","currentColor"),a.removeAttribute("stroke"),a.removeAttribute("stroke-width"),a.removeAttribute("stroke-linecap"),a.removeAttribute("stroke-linejoin")}function S(a){if(typeof a!="string")return!1;const o=a.trim();return/^<[a-zA-Z!/]/.test(o)&&o.includes(">")}function _(a,o,p){return a.textContent="",a.removeAttribute("data-icon"),o==null||o===""?(o===""&&U(`icon:empty:${p}`,`An empty icon value at ${p} renders nothing; omit \`icon\` instead.`),a):typeof o!="string"?(U(`icon:type:${p}`,`An icon must be a name, a character, or element markup; got ${typeof o} at ${p}.`),a):S(o)?(a.innerHTML=o,a):(a.setAttribute("data-icon",o),a)}function C(){L.clear();for(const[a,o]of Object.entries(Y))L.set(a,o)}}),ae("packages/modules/contextmenu/menu.js",function(g,V){"use strict";Object.defineProperty(g,"resolveMenuItems",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"ContextMenu",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"default",{enumerable:!0,get:function(){return _}});const U=V("packages/dom/src/cell/icons.js").renderIconInto,Y=V("packages/core/src/internal/predicates.js").isFunction,H=Object.freeze({menu:"lat-menu",menuItem:"lat-menu__item",menuItemFocused:"lat-menu__item--focused",menuSeparator:"lat-menu__separator",label:"lat-menu__item__label",shortcut:"lat-menu__item__shortcut",arrow:"lat-menu__item__arrow",icon:"lat-icon",check:"lat-menu__check",swatches:"lat-menu__swatches",swatch:"lat-menu__swatch",swatchSelected:"lat-menu__swatch--selected"});function l(C){if(C&&C.document)return C.document;if(C&&C.host&&C.host.ownerDocument)return C.host.ownerDocument;const a=globalThis;if(!a.document)throw new Error("[lattice] no document available; pass one as options.document");return a.document}let L=0;function v(){return`lat-menu-${++L}`}function m(C){if(!C)return!1;const a=C.ownerDocument&&C.ownerDocument.defaultView;if(a&&Y(a.getComputedStyle))try{return a.getComputedStyle(C).direction==="rtl"?!0:(a.getComputedStyle(C).direction==="ltr",!1)}catch{}for(let o=C;o;o=o.parentNode){const p=Y(o.getAttribute)?o.getAttribute("dir"):null;if(p==="rtl")return!0;if(p==="ltr")return!1}return!1}function w(C,a,o){const p=C.createElement(a);if(!o)return p;if(o.class){for(const $ of Array.isArray(o.class)?o.class:[o.class])if($)for(const h of String($).split(/\s+/))h&&p.classList.add(h)}if(o.text!==void 0&&o.text!==null&&(p.textContent=String(o.text)),o.attrs)for(const[$,h]of Object.entries(o.attrs))h==null||h===!1||p.setAttribute($,h===!0?"":String(h));if(o.style)for(const[$,h]of Object.entries(o.style))p.style[$]=h;if(o.children)for(const $ of o.children)$&&p.appendChild($);return p}function k(C,a,o,p){return C.addEventListener(a,o,p),()=>C.removeEventListener(a,o,p)}function u(C){Y(C.preventDefault)&&C.preventDefault(),Y(C.stopPropagation)&&C.stopPropagation()}function f(C,a){let o=a;for(;o;){if(o===C)return!0;o=o.parentNode}return!1}function d(C,a){const o=[];for(const p of C||[]){const $=Y(p)?p(a):p;if($==null||$===!1)continue;if($==="separator"){o.push({separator:!0});continue}if(typeof $=="string"){o.push({name:$});continue}const h=$,y=h.subMenu||h.children;y?o.push({...h,subMenu:d(y,a)}):o.push(h)}return o.filter((p,$,h)=>p.separator?$===0||$===h.length-1?!1:!h[$-1].separator:!0)}class S{root=null;itemNodes=[];items=[];focused=-1;child=null;off=[];open=!1;armed=!1;trigger=null;anchor=null;constructor(a){const o=a||{};this.doc=l(o),this.host=o.host||this.doc.body,this.ctx=o.ctx||{},this.onClose=o.onClose||null,this.parent=o.parent||null}place(a){const o=this.host,p=Y(o.getBoundingClientRect)?o.getBoundingClientRect():{left:0,top:0},$=Y(this.root.getBoundingClientRect)?this.root.getBoundingClientRect():{width:0,height:0},h=this.doc.defaultView||{innerWidth:0,innerHeight:0},y=h.innerWidth||0,i=h.innerHeight||0;let r=a.x||0,b=a.y||0;const T=m(o);if(a.anchor&&Y(a.anchor.getBoundingClientRect)){const O=a.anchor.getBoundingClientRect();a.placement==="below"?(r=T?O.right-$.width:O.left,b=O.bottom):(r=T?O.left-$.width:O.right,b=O.top)}else T&&(r-=$.width);const j={left:Math.max(0,p.left||0),top:Math.max(0,p.top||0),right:Math.min(y||1/0,(p.left||0)+(p.width||1/0)),bottom:Math.min(i||1/0,(p.top||0)+(p.height||1/0))};r+$.width>j.right&&(r-=$.width),r<j.left&&(r=j.left),b+$.height>j.bottom&&(b-=$.height),b<j.top&&(b=j.top);const I=j.bottom-b;$.height>I&&(this.root.style.maxHeight=`${Math.max(0,Math.floor(I))}px`,this.root.style.overflowY="auto"),this.root.style.left=`${Math.round(r-p.left+(o.scrollLeft||0))}px`,this.root.style.top=`${Math.round(b-p.top+(o.scrollTop||0))}px`}show(a){return this.hide(),a.ctx&&(this.ctx={...this.ctx||{},...a.ctx}),this.items=d(a.items,this.ctx),this.returnFocus=a.returnFocus||null,this.trigger=a.trigger||null,this.anchor=a.anchor&&Y(a.anchor.setAttribute)&&Y(a.anchor.getAttribute)&&a.anchor.getAttribute("aria-haspopup")?a.anchor:null,this.anchor&&this.anchor.setAttribute("aria-expanded","true"),this.root=w(this.doc,"div",{class:H.menu,attrs:{role:"menu",tabindex:"-1"},style:{position:"absolute"}}),a.colId!=null&&(this.root.id=v(),this.root.setAttribute("data-col",String(a.colId)),this.anchor&&this.anchor.setAttribute("aria-controls",this.root.id)),this.itemNodes=[],this.items.forEach((o,p)=>{if(o.separator){this.root.appendChild(w(this.doc,"div",{class:H.menuSeparator,attrs:{role:"separator"}}));return}const $=w(this.doc,"div",{class:[H.menuItem,o.cssClass||"",o.swatches?"has-swatches":""],attrs:{role:o.checked===void 0?"menuitem":"menuitemcheckbox",tabindex:"-1","aria-disabled":o.disabled?"true":null,"aria-checked":o.checked===void 0?null:String(o.checked===!0),"aria-haspopup":o.subMenu?"true":null,"aria-expanded":o.subMenu?"false":null,"data-index":p}});if(o.checked!==void 0){const y=w(this.doc,"span",{class:H.check});o.checked&&U(y,"check",`menu:check:${o.name||p}`),$.appendChild(y)}if(o.icon!=null&&o.icon!==""){const y=w(this.doc,"span",{class:H.icon});U(y,o.icon,`menu:${o.name||p}`),$.appendChild(y)}if($.appendChild(w(this.doc,"span",{class:H.label,text:o.name||""})),o.shortcut&&$.appendChild(w(this.doc,"span",{class:H.shortcut,text:o.shortcut})),o.subMenu&&$.appendChild(w(this.doc,"span",{class:H.arrow,text:"›"})),o.swatches){const y=w(this.doc,"span",{class:H.swatches,attrs:{role:"group","aria-label":o.name||"Colour"}});o.swatches.forEach(i=>{const r=w(this.doc,"button",{class:[H.swatch,o.selected&&String(o.selected).toLowerCase()===String(i).toLowerCase()?H.swatchSelected:""],attrs:{type:"button",title:i,"aria-label":i},style:{background:i}});this.off.push(k(r,"mousedown",b=>b.preventDefault())),this.off.push(k(r,"click",b=>{b.stopPropagation(),!o.disabled&&(this.hideRoot(),Y(o.action)&&o.action({...this.ctx,item:o},i))})),y.appendChild(r)}),$.appendChild(y)}const h=this.itemNodes.length;this.off.push(k($,"click",y=>{y.target.closest&&y.target.closest(`.${H.swatch}`)||this.invoke(h)})),this.off.push(k($,"mouseenter",()=>{this.armed&&this.hover(h)})),this.itemNodes.push($),this.root.appendChild($)}),this.host.appendChild(this.root),this.place(a),this.open=!0,this.armed=!1,this.off.push(k(this.root,"keydown",o=>this.onKeyDown(o))),Y(this.doc.addEventListener)&&(this.off.push(k(this.doc,"mousedown",this.outside=o=>{this.root&&!f(this.root,o.target)&&!(this.child&&this.child.root&&f(this.child.root,o.target))&&!(this.trigger&&f(this.trigger,o.target))&&this.hide()},!0)),this.off.push(k(this.doc,"mousemove",o=>{this.armed=!0;const p=o.target;if(!p||!Y(p.closest))return;const $=p.closest(`.${H.menuItem}`);if(!$||!this.root||!f(this.root,$))return;const h=this.itemNodes.indexOf($);h!==-1&&this.hover(h)},!0))),Y(this.root.focus)&&this.root.focus({preventScroll:!0}),this.focus(this.firstEnabled()),this.root}firstEnabled(){for(let a=0;a<this.itemNodes.length;a++)if(!this.itemAt(a).disabled)return a;return-1}itemAt(a){const o=this.itemNodes[a];return o?this.items[Number(o.getAttribute("data-index"))]||{}:{}}focus(a){if(a<0||a>=this.itemNodes.length)return;const o=this.itemNodes[this.focused];o&&o.classList.remove(H.menuItemFocused),this.focused=a;const p=this.itemNodes[a];p.classList.add(H.menuItemFocused),Y(p.focus)&&p.focus({preventScroll:!0}),Y(p.scrollIntoView)&&p.scrollIntoView({block:"nearest",inline:"nearest"})}hover(a){if(a<0||a>=this.itemNodes.length)return;this.focused!==a&&this.focus(a),this.itemAt(a).subMenu?this.openSubMenu(a):this.closeChild()}move(a){const o=this.itemNodes.length;if(!o)return;let p=this.focused;for(let $=0;$<o;$++)if(p=(p+a+o)%o,!this.itemAt(p).disabled){this.focus(p);return}}step(a){this.move(a)}invoke(a){const o=this.itemAt(a);if(!(!o||o.disabled)){if(o.subMenu){this.openSubMenu(a);return}o.swatches||(Y(o.action)&&o.action({...this.ctx,item:o}),this.hideRoot())}}openSubMenu(a){const o=this.itemAt(a);o.subMenu&&(this.child&&this.child.anchorNode===this.itemNodes[a]||(this.closeChild(),this.child=new S({document:this.doc,host:this.host,ctx:this.ctx,parent:this}),this.child.anchorNode=this.itemNodes[a],this.itemNodes[a].setAttribute("aria-expanded","true"),this.child.show({items:o.subMenu,anchor:this.itemNodes[a]})))}closeChild(){if(!this.child)return;const a=this.itemNodes.indexOf(this.child.anchorNode||null);a!==-1&&this.itemNodes[a].setAttribute("aria-expanded","false"),this.child.hide(),this.child=null}onKeyDown(a){switch(a.key){case"ArrowDown":u(a),this.move(1);break;case"ArrowUp":u(a),this.move(-1);break;case"Home":u(a),this.focus(this.firstEnabled());break;case"End":u(a),this.focus(this.itemNodes.length-1);break;case"ArrowRight":{this.itemAt(this.focused).subMenu&&(u(a),this.openSubMenu(this.focused),this.child&&this.child.focus(this.child.firstEnabled()));break}case"ArrowLeft":u(a),this.parent&&(this.hide(),Y(this.parent.root&&this.parent.root.focus)&&this.parent.root.focus({preventScroll:!0}));break;case"Enter":case" ":{if(u(a),this.itemAt(this.focused).swatches){const p=this.itemNodes[this.focused]&&this.itemNodes[this.focused].querySelector(`.${H.swatchSelected}, .${H.swatch}`);p&&p.click()}else this.invoke(this.focused);break}case"Escape":u(a),this.hideRoot();break;default:a.key&&a.key.length===1&&this.jumpTo(a.key);break}}jumpTo(a){const o=a.toLowerCase(),p=this.itemNodes.length;for(let $=1;$<=p;$++){const h=(this.focused+$+p)%p,y=this.itemAt(h);if(!y.disabled&&(y.name||"").toLowerCase().startsWith(o)){this.focus(h);return}}}hideRoot(){let a=this;for(;a.parent;)a=a.parent;a.hide()}hideAll(){this.hideRoot()}hide(){this.closeChild();for(const a of this.off)a();this.off.length=0,this.root&&this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.root=null,this.itemNodes=[],this.focused=-1,this.anchor&&Y(this.anchor.setAttribute)&&(this.anchor.setAttribute("aria-expanded","false"),this.anchor.removeAttribute("aria-controls")),this.anchor=null,this.open&&this.returnFocus&&Y(this.returnFocus.focus)&&this.returnFocus.focus({preventScroll:!0}),this.open=!1,Y(this.onClose)&&this.onClose()}destroy(){this.hide(),this.items=[]}}const _=S}),ae("packages/dom/src/ui/contextmenu.js",function(g,V){"use strict";const St=V("packages/modules/contextmenu/menu.js");Object.defineProperty(g,"ContextMenu",{enumerable:!0,get:function(){return St.ContextMenu}}),Object.defineProperty(g,"resolveMenuItems",{enumerable:!0,get:function(){return St.resolveMenuItems}}),Object.defineProperty(g,"default",{enumerable:!0,get:function(){return St.default}})}),ae("packages/modules/gantt/zoom-control.js",function(g,V){"use strict";Object.defineProperty(g,"ZOOM_LEVELS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"zoomControlCss",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"createZoomControl",{enumerable:!0,get:function(){return v}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=Object.freeze(["day","week","month","quarter","fit"]),H=new Set(Y),l=Object.freeze({day:"gantt.zoom.day",week:"gantt.zoom.week",month:"gantt.zoom.month",quarter:"gantt.zoom.quarter",fit:"gantt.zoom.fit"});function L(m){return`
|
|
131
|
-
.${
|
|
132
|
-
.${
|
|
133
|
-
.${
|
|
134
|
-
.${
|
|
135
|
-
.${
|
|
136
|
-
`.trim()}function v({doc:
|
|
137
|
-
`)}function k(
|
|
138
|
-
`).length})))},onPaste:$=>{if(!$||S($))return;const h=$.clipboardData,y=h&&typeof h.getData=="function"?h.getData("text/plain"):"";if(!y||!y.trim())return;const i=f.controller.pasteTasks({...a(d,$),text:y,event:$});d=!1,i!==null&&($.preventDefault&&$.preventDefault(),Array.isArray(i)&&i.length&&f.announce(f.t("gantt.a11y.pasted",{count:i.length})))}}}}),ae("packages/modules/gantt/task-actions.js",function(g,V){"use strict";Object.defineProperty(g,"ADD_POSITIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"createTaskActions",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"defaultTaskMenu",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"createTaskActionKeys",{enumerable:!0,get:function(){return v}});const U=V("packages/modules/gantt/time.js").toISODate,Y=V("packages/modules/gantt/paste.js").subtreeIds,H=Object.freeze(["above","below","child","successorOf","predecessorOf"]);function l(m){const w=()=>m.writeProp("id")||"id",k=()=>m.writeProp("parent")||"parent",u=()=>({readId:m.readId,parentOf:p=>{const $=p[k()];return $==null||$===""?null:String($)}}),f=p=>m.getTasks().find($=>String(m.readId($))===p),d=p=>!!(p&&(p.event||p.interactive));function S(){const p=new Set(m.getTasks().map(h=>String(m.readId(h))));let $=p.size+1;for(;p.has(`task-${$}`);)$+=1;return`task-${$}`}function _(p){const $=m.getSchedule(),h=p!=null&&$&&$.ok?$.tasks.get(p):null;if(h&&h.es!=null)return U(h.es)||void 0;const y=m.projectStart();if(typeof y=="string")return y;if(typeof y=="number")return U(y)||void 0}function C(p,$){m.bus.emit(p,{...$,reason:"readOnly"})}function a(p,$){if(m.destroyed())return null;const h=$||{},y=H.filter(P=>h[P]!=null);if(y.length>1)return m.warnOnce("gantt-add-target","[lattice] gantt: addTask takes one of above / below / child / successorOf / predecessorOf; the call was ignored."),null;const i=y[0]||null,r=i?String(h[i]):null;if(r!=null&&!m.has(r))return m.warnOnce(`gantt-add-unknown-${r}`,`[lattice] gantt: addTask for unknown task "${r}" ignored.`),null;const b=u(),T=p&&typeof p=="object"?p:{},j=T.id!=null?String(T.id):null;if(j!=null&&m.has(j))return m.warnOnce(`gantt-add-dup-${j}`,`[lattice] gantt: addTask with an existing id "${j}" ignored.`),null;const I=j??S(),O=r!=null?f(r):null,z=i==="child"?r:O?b.parentOf(O):null,W={};for(const[P,x]of Object.entries(T))W[m.writeProp(P)]=x;W[w()]=I;const B=m.writeProp("name")||"name";W[B]==null&&(W[B]=m.t("gantt.task.newName")),["duration","end","milestone"].some(P=>W[m.writeProp(P)]!=null)||(W[m.writeProp("duration")||"duration"]=1);const ct=m.writeProp("start")||"start";if(W[ct]==null&&i!=="successorOf"&&W[m.writeProp("end")||"end"]==null){const P=_(r);P&&(W[ct]=P)}z!=null&&W[k()]==null&&(W[k()]=z);let kt=null;i==="successorOf"?kt={from:r,to:I,type:"FS"}:i==="predecessorOf"&&(kt={from:I,to:r,type:"FS"});const Tt={id:I,task:{...W},target:i?{[i]:r}:{},dependency:kt?{...kt}:null,origin:"user"};if(i&&i!=="above"&&i!=="below"&&d(h)&&m.isReadOnly(r))return C("taskAdd:cancelled",Tt),null;const Ft=()=>{const P=m.planSlice(),x=m.changes.begin(),R=m.getTasks();let N=R.length;if(i==="above"||i==="predecessorOf")N=R.findIndex(X=>String(m.readId(X))===r);else if(i){const X=new Set(Y(R,[r],b));let G=-1;R.forEach((J,tt)=>{X.has(String(m.readId(J)))&&(G=tt)}),N=G+1}return m.setTasks([...R.slice(0,N),{...W},...R.slice(N)]),kt&&m.setDeps([...m.getDeps(),{...kt}]),m.compute(),m.recordHistory("add","add",I,P,!1),m.changes.commit(x,{origin:"user",primary:new Set([I]),event:h.event}),m.select([I],"api"),I},D=m.gateBefore("beforeTaskAdd","taskAdd:cancelled",Tt,Ft,()=>r==null||m.has(r));return D&&typeof D.then=="function"?D.then(P=>P===void 0?null:P):D===void 0?null:D}function o(p,$,h){if(m.destroyed())return m.getSchedule();const y=p!=null?String(p):null;if(y==null||!m.has(y))return m.warnOnce(`gantt-convert-unknown-${y}`,`[lattice] gantt: ${$==="milestone"?"convertToMilestone":"convertToTask"} for unknown task "${y}" ignored.`),m.getSchedule();const i=m.getSchedule(),r=i&&i.ok?i.tasks.get(y):null,b=f(y),T={id:y,task:{...b},to:$,origin:"user"};if(r&&r.isSummary){m.bus.emit("milestoneConvert:cancelled",{...T,reason:"summary"});return}if(r&&!!r.isMilestone==($==="milestone"))return m.getSchedule();if(d(h)&&m.isReadOnly(y))return C("milestoneConvert:cancelled",T);const j=()=>{const I=m.planSlice(),O=m.changes.begin(),z={...f(y)};delete z[m.writeProp("end")||"end"],delete z[m.writeProp("milestone")||"milestone"];const W=h&&Number(h.duration)>0?Number(h.duration):1;z[m.writeProp("duration")||"duration"]=$==="milestone"?0:W,m.setTasks(m.getTasks().map(at=>String(m.readId(at))===y?z:at));const B=m.compute();return m.recordHistory("convert","convert",y,I,!1),m.changes.commit(O,{origin:"user",primary:new Set([y]),event:h&&h.event}),B};return m.gateBefore("beforeMilestoneConvert","milestoneConvert:cancelled",T,j,()=>m.has(y))}return{addTask:a,convertToMilestone:(p,$)=>o(p,"milestone",$),convertToTask:(p,$)=>o(p,"task",$)}}function L(m,w,k){const u=String(m.readId(w)),f=m.schedule,d=f&&f.ok?f.tasks.get(u):null,S=!!m.isTaskReadOnly(u),_=!!(d&&d.isSummary),C=!!(d&&d.isMilestone),a=(o,p,$)=>({name:k(o),shortcut:p==="below"?"Insert":p==="child"?"Shift+Insert":void 0,disabled:!!($&&S),action:()=>{m.addTask({},{[p]:u,interactive:!0})}});return[a("gantt.menu.addAbove","above"),a("gantt.menu.addBelow","below"),a("gantt.menu.addChild","child",!0),a("gantt.menu.addSuccessor","successorOf",!0),a("gantt.menu.addPredecessor","predecessorOf",!0),{separator:!0},{name:k(C?"gantt.menu.toTask":"gantt.menu.toMilestone"),disabled:S||_,action:()=>{C?m.convertToTask(u,{interactive:!0}):m.convertToMilestone(u,{interactive:!0})}},{separator:!0},{name:k("gantt.menu.delete"),shortcut:"Delete",disabled:S||_,action:()=>{m.deleteTask(u,{interactive:!0})}}]}function v(m){return{onKey:k=>{if(!k||k.ctrlKey||k.metaKey||k.altKey||k.defaultPrevented||k.key!=="Insert"&&k.key!=="Delete"||typeof m.editing=="function"&&m.editing())return;const u=k.target,f=u&&u.tagName?String(u.tagName).toLowerCase():"";if(f==="input"||f==="textarea"||f==="select"||u&&u.isContentEditable)return;const d=u&&typeof u.closest=="function"?u.closest("[data-task]"):null,S=d&&typeof d.getAttribute=="function"?d.getAttribute("data-task"):m.focused();if(S==null)return;const _=m.controller;if(k.key==="Delete"){if(!u||typeof u.closest!="function"||!u.closest(".lat-gantt-split__row"))return;const o=_.schedule,p=o&&o.ok?o.tasks.get(String(S)):null;if(!p||p.isSummary)return;k.preventDefault&&k.preventDefault(),_.deleteTask(S,{event:k});return}k.preventDefault&&k.preventDefault();const C=_.addTask({},k.shiftKey?{child:S,event:k}:{below:S,event:k}),a=o=>{o!=null&&(m.focusTask(o),m.announce(m.t("gantt.a11y.taskAdded",{name:m.t("gantt.task.newName")})))};C&&typeof C.then=="function"?C.then(a):a(C)}}}}),ae("packages/modules/gantt/table-defaults.js",function(g,V){"use strict";Object.defineProperty(g,"resolveTableConfig",{enumerable:!0,get:function(){return U}});const St=K=>K!=null&&typeof K=="object"&&!Array.isArray(K);function U(K,Y,H,l){const{band:L,...v}=K||{},m=Y==="band"&&St(L)?{...v,...L}:v,w=m.selection,k=typeof w=="string"?{mode:w}:St(w)?w:{};return{...H,...m,selection:{...l?{mode:l}:{},ranges:!1,fillHandle:!1,...k}}}}),ae("packages/modules/gantt/split-header-fit.js",function(g,V){"use strict";Object.defineProperty(g,"fitHeaderToTable",{enumerable:!0,get:function(){return St}});function St(U,K,Y){const H=()=>{if(!K||!U)return;const m=U.querySelector(".lat-header"),w=m?Math.ceil(m.offsetHeight||0):0;K.style.height=`${Math.max(Number(Y)||0,w)}px`},l=U&&U.ownerDocument&&U.ownerDocument.defaultView,L=l&&l.ResizeObserver;let v=null;if(typeof L=="function"&&U){v=new L(()=>H());const m=U.querySelector(".lat-header");m?v.observe(m):v.observe(U)}return{apply:H,dispose:()=>{v&&v.disconnect(),v=null}}}}),ae("packages/modules/shared/pinch-gesture.js",function(g,V){"use strict";Object.defineProperty(g,"attachPinchGesture",{enumerable:!0,get:function(){return U}});const St=48;function U(K,Y){const H=Y||{},l=Number.isFinite(H.minSpread)&&H.minSpread>0?H.minSpread:St;if(!K||typeof K.addEventListener!="function")return()=>{};const L=new Map;let v=null;const m=()=>{const[C,a]=[...L.values()];return{spread:Math.hypot(C.x-a.x,C.y-a.y),cx:(C.x+a.x)/2,cy:(C.y+a.y)/2}},w=()=>{v&&(K.style.touchAction=v.prevTouchAction,v=null)},k=C=>{if(C.pointerType==="touch"&&!(typeof H.enabled=="function"&&!H.enabled())&&((L.has(C.pointerId)||L.size>=2)&&(L.clear(),w()),L.set(C.pointerId,{x:C.clientX,y:C.clientY}),L.size===2&&!v)){const a=m();v={spread:a.spread,cx:a.cx,cy:a.cy,prevTouchAction:K.style.touchAction||""},K.style.touchAction="none"}},u=C=>{const a=L.get(C.pointerId);if(!a||(a.x=C.clientX,a.y=C.clientY,!v||L.size<2))return;const o=m(),p=K.getBoundingClientRect(),$={x:o.cx-p.left,y:o.cy-p.top};let h=!1;for(;o.spread-v.spread>=l;)v.spread+=l,h=!0,typeof H.onStep=="function"&&H.onStep("in",$);for(;v.spread-o.spread>=l;)v.spread-=l,h=!0,typeof H.onStep=="function"&&H.onStep("out",$);const y=o.cx-v.cx,i=o.cy-v.cy;v.cx=o.cx,v.cy=o.cy,!h&&(typeof H.onPan=="function"?H.onPan(y,i):(K.scrollLeft-=y,K.scrollTop-=i))},f=C=>{C.type==="pointercancel"?L.clear():L.delete(C.pointerId),L.size<2&&w()},d=C=>{(!C.touches||C.touches.length<2)&&(L.clear(),w())},S=C=>{(v&&C.type==="touchmove"||C.touches&&C.touches.length>=2)&&C.cancelable&&C.preventDefault()},_=K.ownerDocument||K;return K.addEventListener("pointerdown",k),_.addEventListener("pointermove",u),_.addEventListener("pointerup",f),_.addEventListener("pointercancel",f),_.addEventListener("touchend",d),_.addEventListener("touchcancel",d),K.addEventListener("touchstart",S,{passive:!1}),K.addEventListener("touchmove",S,{passive:!1}),()=>{w(),L.clear(),K.removeEventListener("pointerdown",k),_.removeEventListener("pointermove",u),_.removeEventListener("pointerup",f),_.removeEventListener("pointercancel",f),_.removeEventListener("touchend",d),_.removeEventListener("touchcancel",d),K.removeEventListener("touchstart",S),K.removeEventListener("touchmove",S)}}}),ae("packages/modules/gantt/pinch.js",function(g,V){"use strict";Object.defineProperty(g,"GANTT_PINCH_LEVELS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"attachGanttPinch",{enumerable:!0,get:function(){return l}});const U=V("packages/modules/shared/pinch-gesture.js").attachPinchGesture,Y=V("packages/modules/gantt/zoom.js").resolveZoomPreset,H=Object.freeze(["quarter","month","week","day"]);function l(L){const v=L.pane;return U(v,{enabled:L.enabled,minSpread:48,onStep(m,w){const k=L.model();if(!k||!(k.pxPerDay>0))return;const u=L.zoom(),f=typeof u=="string"&&H.includes(u)?u:Y(Number.isFinite(u)?u:k.pxPerDay).level,d=Math.max(0,H.indexOf(f==="hour"?"day":f)),S=H[d+(m==="in"?1:-1)];if(!S)return;const _=k.domainMin+(v.scrollLeft+w.x)/k.pxPerDay;L.setZoom(S,"gesture");const C=L.model();!C||!(C.pxPerDay>0)||L.scrollTo(Math.max(0,Math.round((_-C.domainMin)*C.pxPerDay-w.x)))}})}}),ae("packages/modules/gantt/data-band.js",function(g,V){"use strict";Object.defineProperty(g,"DATA_BAND_DEFAULTS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"normalizeDataBands",{enumerable:!0,get:function(){return y}}),Object.defineProperty(g,"aggregateValues",{enumerable:!0,get:function(){return i}}),Object.defineProperty(g,"seriesPoints",{enumerable:!0,get:function(){return r}}),Object.defineProperty(g,"spreadSpans",{enumerable:!0,get:function(){return T}}),Object.defineProperty(g,"bucketSeries",{enumerable:!0,get:function(){return j}}),Object.defineProperty(g,"reshapeSeries",{enumerable:!0,get:function(){return I}}),Object.defineProperty(g,"writeBucket",{enumerable:!0,get:function(){return O}}),Object.defineProperty(g,"computeDataBand",{enumerable:!0,get:function(){return z}}),Object.defineProperty(g,"formatBandValue",{enumerable:!0,get:function(){return W}}),Object.defineProperty(g,"bandGridFormat",{enumerable:!0,get:function(){return B}}),Object.defineProperty(g,"cellLook",{enumerable:!0,get:function(){return at}}),Object.defineProperty(g,"dataBandCss",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(g,"DataBand",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(g,"DataBands",{enumerable:!0,get:function(){return D}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=V("packages/modules/gantt/time.js"),H=Y.toDayNumber,l=Y.toISODate,v=V("packages/modules/gantt/resources.js").parseAssignments,w=V("packages/modules/gantt/split-grid.js").resolveTableColumns,k=V("packages/modules/gantt/band-grid.js"),u=k.bucketColumnSpec,f=k.bucketColumnWidths,d=k.pinStart,S=k.mountBandGrid,_=Object.freeze({title:null,rows:"tasks",value:null,series:null,interpolate:"none",aggregate:"sum",format:"number",currency:"USD",decimals:null,totals:!0,height:160,rowHeight:26,columns:null,thresholds:null,cellStyle:null,editable:!1,onReschedule:"shift",collapsed:!1}),C=new Set(["tasks","summaries","resources"]),a=new Set(["sum","avg","last","min","max"]),o=new Set(["shift","stretch","keep"]),p=new Set(["ok","info","warn","danger"]),$=1e6,h=P=>Math.round(P*$)/$;function y(P){if(!Array.isArray(P))return[];const x=new Set,R=[];return P.forEach((N,X)=>{if(!N||typeof N!="object")return;const G={..._,...N};let J=N.id!=null&&String(N.id)!==""?String(N.id):`band${X+1}`;for(;x.has(J);)J=`${J}_${X+1}`;x.add(J),G.id=J,G.rows=typeof N.rows=="function"||C.has(N.rows)?N.rows:"tasks",G.value=typeof N.value=="function"?N.value:null,G.series=typeof N.series=="string"&&N.series?N.series:null,G.interpolate=N.interpolate==="spread"?"spread":"none",G.aggregate=typeof N.aggregate=="function"||a.has(N.aggregate)?N.aggregate:"sum";const tt=N.totals;G.totals=tt===!1?{row:!1,column:!1}:tt&&typeof tt=="object"?{row:tt.row!==!1,column:tt.column!==!1}:{row:!0,column:!0},G.rowHeight=Math.max(16,Number(G.rowHeight)||_.rowHeight),G.height=Math.max(G.rowHeight*2,Number(G.height)||_.height),G.thresholds=Array.isArray(N.thresholds)?N.thresholds.filter(ft=>ft&&Number.isFinite(Number(ft.at))).map(ft=>({...ft,at:Number(ft.at)})).sort((ft,st)=>ft.at-st.at):null,G.cellStyle=typeof N.cellStyle=="function"?N.cellStyle:null,G.editable=!!N.editable&&G.series!=null,G.onReschedule=o.has(N.onReschedule)?N.onReschedule:"shift",G.collapsed=!!N.collapsed,R.push(G)}),R}function i(P,x,R={}){const N=(P||[]).filter(X=>X!=null&&Number.isFinite(Number(X))).map(Number);if(!N.length)return null;if(typeof x=="function"){const X=x(N,R);return X==null||!Number.isFinite(Number(X))?null:Number(X)}return x==="avg"?h(N.reduce((X,G)=>X+G,0)/N.length):x==="last"?N[N.length-1]:x==="min"?Math.min(...N):x==="max"?Math.max(...N):h(N.reduce((X,G)=>X+G,0))}function r(P){if(!Array.isArray(P))return[];const x=[];for(const R of P){if(!R||typeof R!="object")continue;const N=H(R.date),X=Number(R.value);if(N==null||R.value==null||!Number.isFinite(X))continue;const G=R.end!=null?H(R.end):null;x.push({day:N,end:G!=null&&G>N?G:null,value:X})}return x.sort((R,N)=>R.day-N.day)}function b(P,x){const R=x>=28&&x<=31?1:x>=89&&x<=92?3:x===365||x===366?12:0;if(!R)return P+Math.max(1,x);const N=new Date(P*864e5);return Math.round(Date.UTC(N.getUTCFullYear(),N.getUTCMonth()+R,N.getUTCDate())/864e5)}function T(P){const x=[];for(let R=0;R<P.length;R+=1){const N=P[R];let X=N.end;X==null&&R+1<P.length&&(X=P[R+1].day),X==null&&(X=R>0?b(N.day,N.day-P[R-1].day):N.day+1),X<=N.day&&(X=N.day+1),x.push({from:N.day,to:X,value:N.value})}return x}function j(P,x,R="none",N="sum"){const X=r(P);if(!X.length)return x.map(()=>null);if(R==="spread"){const G=T(X);return x.map(J=>{let tt=0,ft=!1;for(const st of G){const ht=Math.max(st.from,J.start),Pt=Math.min(st.to,J.end);Pt<=ht||(ft=!0,tt+=st.value*(Pt-ht)/(st.to-st.from))}return ft?h(tt):null})}return x.map(G=>i(X.filter(J=>J.day>=G.start&&J.day<G.end).map(J=>J.value),N))}function I(P,x,R,N){if(!Array.isArray(P)||N==="keep"||!x||!R||x.start===R.start&&x.end===R.end)return null;const X=Math.max(1,x.end-x.start),G=Math.max(1,R.end-R.start),J=tt=>{const ft=H(tt);if(ft==null)return null;const st=N==="stretch"?R.start+Math.round((ft-x.start)*G/X):ft+(R.start-x.start);return l(st)};return N==="shift"&&x.start===R.start?null:P.map(tt=>{if(!tt||typeof tt!="object")return tt;const ft={...tt},st=J(tt.date);if(st!=null&&(ft.date=st),tt.end!=null){const ht=J(tt.end);ht!=null&&(ft.end=ht)}return ft})}function O(P,x,R,N){const X=(Array.isArray(P)?P:[]).filter(G=>{const J=G&&typeof G=="object"?H(G.date):null;return J==null||J<x||J>=R});return N!=null&&X.push({date:l(x),end:l(R),value:N}),X.sort((G,J)=>(H(G&&G.date)??0)-(H(J&&J.date)??0))}function z(P,x){const{rows:R,allRows:N,rawById:X,buckets:G}=x,J=P.value&&typeof x.costByTask=="function"?x.costByTask():null,tt=new Map,ft=[],st=new Map;for(const nt of N){const ot=nt.rec.parent==null?null:String(nt.rec.parent);ot!=null&&(st.has(ot)||st.set(ot,[]),st.get(ot).push(nt.id))}const ht=nt=>{const ot=X.get(nt.id)||{};return P.series?j(ot[P.series],G,P.interpolate,P.aggregate):P.value?G.map((vt,pt)=>{const zt=l(vt.start),Ot=l(vt.end),et={band:P.id,id:nt.id,task:ot,rec:nt.rec,start:vt.start,end:vt.end,zoom:x.zoom||null};J&&(et.cost=q=>{const jt=q!=null?J.get(String(q)):null,Et=jt?jt[pt]:null;return Et==null||Et===0?null:Et});let gt=null;try{gt=P.value(ot,zt,Ot,et)}catch{gt=null}return gt==null||!Number.isFinite(Number(gt))?null:Number(gt)}):G.map(()=>null)};for(let nt=N.length-1;nt>=0;nt-=1){const ot=N[nt],vt=st.get(ot.id)||[];if(!vt.length){tt.set(ot.id,ht(ot));const zt=X.get(ot.id);zt&&zt.inactive===!0||ft.push(ot.id);continue}const pt=vt.filter(zt=>(X.get(zt)||{}).inactive!==!0);tt.set(ot.id,G.map((zt,Ot)=>i(pt.map(et=>(tt.get(et)||[])[Ot]),P.aggregate,{band:P.id,bucket:Ot,id:ot.id})))}ft.reverse();const Pt=nt=>P.totals.column?i(nt,P.aggregate,{band:P.id,total:"column"}):null,wt=nt=>G.map((ot,vt)=>i(nt.map(pt=>(tt.get(pt)||[])[vt]),P.aggregate,{band:P.id,bucket:vt})),Jt=[];if(P.rows==="tasks"||P.rows==="summaries")for(const nt of R){if(P.rows==="summaries"&&!nt.hasChildren)continue;const ot=tt.get(nt.id)||G.map(()=>null);Jt.push({key:nt.id,taskId:nt.id,label:String(nt.rec.name??nt.id),depth:nt.depth,isSummary:!!nt.hasChildren,cells:ot,total:Pt(ot)})}else{let nt;if(P.rows==="resources"){const ot=new Map,vt=[];for(const pt of ft){const zt=v(X.get(pt)||{}).map(Ot=>Ot.resource);zt.length||vt.push(pt);for(const Ot of zt)ot.has(Ot)||ot.set(Ot,[]),ot.get(Ot).push(pt)}nt=[...ot].map(([pt,zt])=>({key:`res:${pt}`,label:pt,tasks:zt})),vt.length&&nt.push({key:"res:",label:x.t("gantt.dataBand.unassigned"),tasks:vt})}else{let ot=null;try{ot=P.rows([...X.values()],{band:P.id})}catch{ot=null}nt=(Array.isArray(ot)?ot:[]).filter(vt=>vt&&vt.key!=null).map(vt=>({key:`grp:${vt.key}`,label:String(vt.label??vt.key),tasks:(Array.isArray(vt.tasks)?vt.tasks:[]).map(String)}))}for(const ot of nt){const vt=wt(ot.tasks);Jt.push({key:ot.key,taskId:null,label:ot.label,depth:0,isSummary:!1,cells:vt,total:Pt(vt)})}}let dt=null;if(P.totals.row){const nt=wt(ft);dt={key:"__total__",taskId:null,label:x.t("gantt.dataBand.total"),depth:0,isSummary:!1,isTotal:!0,cells:nt,total:Pt(nt)}}return{rows:Jt,total:dt,byTask:tt}}function W(P,x,R,N={}){if(P==null)return"";const X=x.format;if(typeof X=="function")try{const ft=X(P,N);return ft==null?"":String(ft)}catch{return String(P)}const G=X&&typeof X=="object"?X:{type:X},J=Number.isFinite(Number(G.decimals??x.decimals))?Number(G.decimals??x.decimals):null,tt={};G.type==="currency"?(tt.style="currency",tt.currency=String(G.currency||x.currency||"USD"),tt.minimumFractionDigits=J??0,tt.maximumFractionDigits=J??0):G.type==="percent"?(tt.style="percent",tt.maximumFractionDigits=J??0):tt.maximumFractionDigits=J??2;try{return new Intl.NumberFormat(R||void 0,tt).format(P)}catch{return String(P)}}function B(P){const x=P.format;if(typeof x=="function")return null;const R=x&&typeof x=="object"?x:{type:x},N=Number.isFinite(Number(R.decimals??P.decimals))?Number(R.decimals??P.decimals):null;return R.type==="currency"?{type:"number",style:"currency",currency:String(R.currency||P.currency||"USD"),decimals:N??0}:R.type==="percent"?{type:"number",style:"percent",decimals:N??0}:{type:"number",decimals:N??2}}function at(P,x,R){const N=[],X={};let G=null;if(P.thresholds&&x!=null){let J=null;for(const tt of P.thresholds)x>=tt.at&&(J=tt);J&&(p.has(J.tone)&&(G=J.tone),typeof J.className=="string"&&N.push(J.className),typeof J.colour=="string"&&(X.backgroundColor=J.colour))}if(P.cellStyle){let J=null;try{J=P.cellStyle(x,R)}catch{J=null}if(typeof J=="string"&&J)N.push(J);else if(J&&typeof J=="object")for(const[tt,ft]of Object.entries(J))tt==="className"?typeof ft=="string"&&ft&&N.push(ft):(typeof ft=="string"||typeof ft=="number")&&(X[tt]=String(ft))}return{tone:G,classes:N,style:X}}function ct(P){return`
|
|
139
|
-
.${
|
|
140
|
-
.${
|
|
141
|
-
.${
|
|
142
|
-
.${
|
|
143
|
-
.${
|
|
144
|
-
.${
|
|
145
|
-
.${
|
|
146
|
-
.${
|
|
147
|
-
.${
|
|
148
|
-
.${
|
|
149
|
-
.${
|
|
150
|
-
.${
|
|
151
|
-
.${
|
|
152
|
-
.${
|
|
153
|
-
.${
|
|
154
|
-
.${
|
|
155
|
-
.${
|
|
156
|
-
.${
|
|
157
|
-
.${
|
|
158
|
-
.${
|
|
159
|
-
.${
|
|
160
|
-
`}const kt="data-lat-gantt-databand-styles";function Tt(P,x){const R=P&&P.documentElement;if(!R||R.getAttribute(kt))return;R.setAttribute(kt,"1");const N=P.createElement("style");N.textContent=ct(x).trim(),(P.head||P.body||R).appendChild(N)}class Ft{cfg;root=null;time=null;#t=null;grid=null;last=null;#i;#e=null;#n=null;#s=null;#o=null;#l=null;#d=[];#g=null;#p=new Map;#h=new Set;#a=!1;#f=null;constructor(x,R){this.#i=x,this.cfg=R}get collapsed(){return!!this.cfg.collapsed}build(x){const R=this.#i,N=R.ns,X=this.cfg,G=R.doc;this.root=U(G,"div",`${N}__db`),this.root.setAttribute("data-band",X.id),this.root.setAttribute("role","table"),this.root.setAttribute("aria-label",this.#c()),this.root.style.flex=`0 0 ${X.height}px`,this.#e=U(G,"div",`${N}__db-head`),this.#e.style.height=`${X.rowHeight}px`;const J=G.createElement("button");J.setAttribute("type","button"),J.setAttribute("class",`${N}__db-toggle`),J.addEventListener("click",()=>this.setCollapsed(!this.cfg.collapsed)),this.#o=J,this.#e.appendChild(J);const tt=U(G,"span",`${N}__db-title`);K(tt,this.#c()),this.#e.appendChild(tt),this.root.appendChild(this.#e),this.#n=U(G,"div",`${N}__db-body`),this.#s=U(G,"div",`${N}__lgrid ${N}__lgrid--databand`),this.#n.appendChild(this.#s),this.root.appendChild(this.#n),x.appendChild(this.root),this.#r()}#c(){return this.cfg.title!=null&&this.cfg.title!==""?String(this.cfg.title):this.#i.t("gantt.dataBand.title")}#b=()=>{this.#a||this.#i.syncScroll(this.time)};setCollapsed(x){const R=!!this.cfg.collapsed;this.cfg.collapsed=!!x,this.#r(),R!==this.cfg.collapsed&&this.root&&this.#i.redraw()}#r(){if(!this.root)return;const x=this.#i.ns;this.root.classList.toggle(`${x}__db--collapsed`,!!this.cfg.collapsed),this.root.style.flex=this.cfg.collapsed?"0 0 auto":`0 0 ${this.cfg.height}px`,this.#o&&(this.#o.setAttribute("aria-expanded",this.cfg.collapsed?"false":"true"),this.#o.setAttribute("aria-label",this.#i.t(this.cfg.collapsed?"gantt.dataBand.expand":"gantt.dataBand.collapse",{name:this.#c()})))}#m(x){const R=this.#i,N=this.cfg,X=new Map;X.set("name",{id:"name",field:"name",title:R.t(N.rows==="resources"?"gantt.dataBand.resource":"gantt.dataBand.name"),layout:{min:60},edit:{enabled:!1},cell:{render:tt=>this.#D(tt&&tt.row&&tt.row.data||{})}}),N.totals.column&&X.set("total",{id:"total",field:"total",title:R.t("gantt.dataBand.total"),type:"number",format:B(N),layout:{min:60},edit:{enabled:!1},cell:{align:"right"}}),this.#d=[];const G=Array.isArray(N.columns)?N.columns.map(tt=>{if(!tt||typeof tt!="object"||typeof tt.value!="function"&&typeof tt.render!="function")return tt;const{value:ft,render:st,align:ht,...Pt}=tt,wt=String(Pt.id??Pt.key);this.#d.push({id:wt,value:typeof ft=="function"?ft:null});const Jt={...Pt.cell&&typeof Pt.cell=="object"?Pt.cell:{},...ht!=null?{align:ht}:{}};return typeof st=="function"&&(Jt.render=dt=>{const nt=dt&&dt.row&&dt.row.data||{};let ot=null;try{ot=st(nt.__row?nt.__row.src:null,nt.__row?nt.__row.ctx:{})}catch{ot=null}return ot==null?"":typeof ot=="object"?ot:String(ot)}),{...Pt,id:wt,field:wt,cell:Jt}}):null,J=w(G,X,N.totals.column?["name","total"]:["name"],"name");return this.#y(J,x),J}#y(x,R){d(x,R,"name",{minFill:60,floor:40,defaultWidth:N=>N.id==="total"?Math.max(70,Math.round(R*.2)):110})}#D(x){const R=this.#i,N=R.ns,X=U(R.doc,"span",`${N}__db-label`);if(X.style.paddingLeft=`${(x.__depth||0)*R.indent()}px`,x.__toggle){const J=R.doc.createElement("button");J.setAttribute("type","button"),J.setAttribute("class",`${N}__db-toggle`),J.setAttribute("aria-expanded",x.__toggle.expanded?"true":"false"),J.setAttribute("aria-label",R.t(x.__toggle.expanded?"gantt.dataBand.collapse":"gantt.dataBand.expand",{name:x.name})),J.addEventListener("click",tt=>{tt.stopPropagation&&tt.stopPropagation(),R.toggleTask(x.__taskId,tt)}),X.appendChild(J)}const G=U(R.doc,"span",`${N}__db-name-text`);return K(G,String(x.name??"")),G.setAttribute("title",String(x.name??"")),X.appendChild(G),X}#P(x,R,N){const X=this.#i.ns,G=l(x.start);return u({id:G,width:R,format:B(this.cfg),cell:{align:"right",class:J=>{const tt=J&&J.row&&J.row.data||{},ft=[`${X}__db-bucket`],st=this.#w(tt,x,J.value);st.tone&&ft.push(`${X}__db-bucket--${st.tone}`);for(const ht of st.classes)ft.push(ht);return N&&this.#h.has(String(tt.__taskId))&&ft.push(`${X}__db-bucket--editable`),ft},style:J=>this.#w(J&&J.row&&J.row.data||{},x,J.value).style},edit:N?{enabled:J=>this.#h.has(String((J&&J.row&&J.row.data||{}).__taskId)),editor:"number"}:null})}#w(x,R,N){const X=this.cfg;return at(X,N??null,{band:X.id,row:x.__key,task:x.__taskId!=null&&x.__row?x.__row.src:null,bucketStart:l(R.start),bucketEnd:l(R.end),isTotal:!!x.__isTotal,isSummary:!!x.__toggle})}#T(x){const R=this.#i,N=R.ns;this.grid&&(this.grid.destroy(),this.grid=null),this.#f&&(this.#f(),this.#f=null);const X=R.gridConfig(),G=X.rowClass,J=S({createGrid:R.createGrid(),host:this.#s,config:X,columns:x,headerHeight:this.cfg.rowHeight,rowHeight:()=>this.cfg.rowHeight,rowClass:tt=>{const ft=typeof G=="function"?G(tt):G||[],st=Array.isArray(ft)?ft.slice():[ft],ht=tt&&tt.data||{};return ht.__isTotal?st.push(`${N}__db-timerow`,`${N}__db-row--total`,"lat-row--db-total"):ht.__toggle?st.push(`${N}__db-timerow`,`${N}__db-row--summary`,"lat-row--db-summary"):st.push(`${N}__db-timerow`),st.filter(Boolean)},centreClass:`${N}__db-time`,onScroll:this.#b});this.grid=J.grid,this.time=J.time,this.#t=J.centre,this.#f=J.offScroll,this.grid&&(this.grid.on&&(this.grid.on("beforeEdit",this.#x),this.grid.on("cell:dblclicked",tt=>{tt&&tt.colId!=null&&this.#p.has(String(tt.colId))&&this.grid.edit&&typeof this.grid.edit.start=="function"&&this.grid.edit.start(tt.key,tt.colId)}),this.grid.on("sort:changed",()=>{this.#a||R.redraw()}),this.grid.on("filter:changed",()=>{this.#a||R.redraw()}),this.grid.on("column:resized",tt=>{tt&&tt.colId!=null&&R.emitResize(`dataBand:${this.cfg.id}:${tt.colId}`,tt.width)})),this.#l&&this.grid.state&&(this.grid.state.apply(this.#l),this.#l=null))}render(x){if(!this.root||!this.#i.createGrid())return;const R=this.#i,N=this.cfg,X=R.locale(),G=z(N,{...x,t:R.t}),J=R.gridWidth(),tt=G.rows.map(dt=>({...dt}));G.total&&tt.push(G.total);const ft=N.editable&&R.editable();this.#h=new Set,this.#p=new Map;for(const dt of x.buckets)this.#p.set(l(dt.start),{start:dt.start,end:dt.end});for(const dt of tt){dt.texts=dt.cells.map((ot,vt)=>W(ot,N,X,{band:N.id,row:dt.key,bucket:vt})),dt.totalText=N.totals.column?W(dt.total,N,X,{band:N.id,row:dt.key,total:!0}):"",dt.toggle=dt.isSummary&&N.rows==="tasks"?{expanded:!x.collapsedIds.has(dt.taskId)}:null;const nt=dt.taskId!=null&&x.rawById.get(dt.taskId)||null;dt.src=nt||{key:dt.key,label:dt.label,cells:dt.cells,total:dt.total},dt.ctx={band:N.id,cells:dt.cells,total:dt.total,isSummary:dt.isSummary,isTotal:!!dt.isTotal,buckets:x.buckets},ft&&dt.taskId!=null&&!dt.isSummary&&!dt.isTotal&&this.#h.add(String(dt.taskId))}const st=`${x.zoom}|${J}|${x.buckets.length}|${x.buckets.length?x.buckets[0].start:0}|${x.buckets.length?x.buckets[x.buckets.length-1].start:0}|${ft}`;if(!this.grid||st!==this.#g){const dt=this.#m(J),nt=f(x.buckets,x.x),ot=x.buckets.map((vt,pt)=>this.#P(vt,nt[pt],ft));this.#T([...dt,...ot]),this.#g=st}if(!this.grid)return;const ht=tt.map(dt=>{const nt={__key:dt.key,__taskId:dt.taskId,__depth:dt.depth,__toggle:dt.toggle,__isTotal:!!dt.isTotal,__row:{src:dt.src,ctx:dt.ctx},name:dt.label,total:dt.total};for(const ot of this.#d){let vt=null;if(ot.value&&!dt.isTotal)try{vt=ot.value(dt.src,dt.ctx)}catch{vt=null}nt[ot.id]=vt===void 0?null:vt}return dt.cells.forEach((ot,vt)=>{nt[l(x.buckets[vt].start)]=ot}),nt});this.#a=!0;try{this.grid.rows.load(ht)}finally{this.#a=!1}const Pt=new Map(tt.map(dt=>[dt.key,dt])),wt=this.#N().map(dt=>Pt.get(dt)).filter(Boolean),Jt=wt.length?[...wt.filter(dt=>!dt.isTotal),...wt.filter(dt=>dt.isTotal)]:tt;this.time&&(this.#a=!0,this.time.scrollLeft=R.timeScrollLeft(),this.#a=!1),this.last={buckets:x.buckets,rows:Jt,byTask:G.byTask,grid:this.#E(Jt)}}#N(){const x=[];return!this.grid||!this.grid.rows||typeof this.grid.rows.forEach!="function"||this.grid.rows.forEach(R=>{R&&!R.group&&R.key!=null&&x.push(String(R.key))}),x}#E(x){const R=this.grid;if(!R||!R.columns||typeof R.columns.visible!="function")return null;const N=R.columns.visible().filter(X=>X.id!=="__keep"&&!this.#p.has(String(X.id)));return{columns:N.map(X=>({id:String(X.id),title:String(X.title??X.id)})),rows:x.map(X=>N.map(G=>{if(G.id==="name")return X.label;if(G.id==="total")return X.totalText;try{return String(R.rows.text(X.key,G.id)??"")}catch{return""}}))}}#x=x=>{const N=(x&&Array.isArray(x.changes)?x.changes:[]).find(G=>G&&this.#p.has(String(G.colId)));if(!N)return;x.preventDefault&&x.preventDefault();const X=x.row&&x.row.key!=null?String(x.row.key):x.key!=null?String(x.key):null;X!=null&&this.commitEdit(X,String(N.colId),N.newValue,x&&x.event?x.event:null)};commitEdit(x,R,N,X=null){const G=this.#i,J=this.cfg,tt=this.#p.get(String(R))||null,ft=G.rawTask(x);if(!tt||!ft||!J.series){G.redraw();return}const st=N==null?"":String(N).trim(),ht=st===""?null:Number(st);if(ht!=null&&!Number.isFinite(ht)){G.redraw();return}const Pt=Array.isArray(ft[J.series])?ft[J.series].map(ot=>({...ot})):[],wt=O(Pt,tt.start,tt.end,ht),Jt=((this.last&&this.last.byTask?this.last.byTask.get(String(x)):null)||[])[this.#K(R)]??null,dt={band:J.id,id:String(x),task:ft,field:J.series,bucketStart:l(tt.start),bucketEnd:l(tt.end),value:ht,oldValue:Jt,series:wt,previous:Pt,view:G.view(),event:X},nt=G.gateEdit(dt,()=>{const ot=G.writeSeries(String(x),J.series,wt)||ft;return G.emitChange({band:J.id,id:String(x),task:ot,field:J.series,series:wt,previous:Pt,reason:"edit",view:G.view(),event:X}),G.redraw(),!0});return nt&&typeof nt.then=="function"?nt.then(ot=>{ot!==!0&&G.redraw()}):nt!==!0&&G.redraw(),nt}#K(x){return!this.last||!this.last.buckets?-1:this.last.buckets.findIndex(R=>l(R.start)===String(x))}tableState(){return this.grid&&this.grid.state?this.grid.state.get():null}setTableState(x){!x||typeof x!="object"||(this.grid&&this.grid.state?this.grid.state.apply(x):this.#l=x)}toTable(){if(!this.last)return null;const x=this.last.grid?this.last.grid.columns:[{id:"name",title:this.#i.t("gantt.dataBand.name")}].concat(this.cfg.totals.column?[{id:"total",title:this.#i.t("gantt.dataBand.total")}]:[]),R=this.last.buckets.map(N=>({id:l(N.start),title:l(N.start)}));return{id:this.cfg.id,title:this.#c(),columns:[...x,...R],rows:this.last.rows.map((N,X)=>[...this.last.grid?this.last.grid.rows[X]:[N.label].concat(this.cfg.totals.column?[N.totalText]:[]),...N.cells])}}exportModel(){return{id:this.cfg.id,title:this.#c(),height:this.cfg.collapsed?this.cfg.rowHeight:this.cfg.height,rowHeight:this.cfg.rowHeight,collapsed:!!this.cfg.collapsed,buckets:this.last?this.last.buckets:[],grid:this.last?this.last.grid:null,rows:this.last?this.last.rows.map(x=>({label:x.label,depth:x.depth,texts:x.texts,totalText:x.totalText,isTotal:!!x.isTotal,isSummary:x.isSummary})):[],totalsColumn:!!this.cfg.totals.column}}destroy(){this.#f&&this.#f(),this.grid&&this.grid.destroy(),this.root&&this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.grid=null,this.root=this.time=this.#t=this.#e=this.#n=this.#s=null,this.last=null}}class D{bands;#t;#i=new Map;constructor(x,R){this.#t=x,this.bands=R.map(N=>new Ft(x,N))}build(x){Tt(this.#t.doc,this.#t.ns);for(const R of this.bands)R.build(x)}panes(){return this.bands.map(x=>x.time).filter(Boolean)}height(){return this.bands.reduce((x,R)=>x+(R.root&&R.root.offsetHeight||0),0)}get(x){return this.bands.find(R=>R.cfg.id===String(x))||null}render(x){for(const R of this.bands)R.render(x)}noteSpans(x){if(this.#i=new Map,!(!x||!x.ok))for(const[R,N]of x.tasks)this.#i.set(String(R),{start:N.es,end:N.ef})}onDatesChanged(x,R){let N=0;const X=x&&Array.isArray(x.changes)?x.changes:[];for(const G of X){if(G.cause!=="user"&&G.cause!=="pushed")continue;const J=this.#i.get(String(G.id));if(!J||!Number.isFinite(G.start)||!Number.isFinite(G.end))continue;let tt=this.#t.rawTask(G.id);if(tt)for(const ft of this.bands){const st=ft.cfg;if(!st.series||!Array.isArray(tt[st.series]))continue;const ht=I(tt[st.series],J,{start:G.start,end:G.end},st.onReschedule);if(!ht)continue;const Pt=tt[st.series];tt=this.#t.writeSeries(String(G.id),st.series,ht)||{...tt,[st.series]:ht},N+=1,this.#t.emitChange({band:st.id,id:String(G.id),task:tt,field:st.series,series:ht,previous:Pt,reason:st.onReschedule,view:this.#t.view(),event:x.event??null})}}return this.noteSpans(R),N}getState(){const x={};for(const R of this.bands)x[R.cfg.id]={collapsed:R.collapsed,table:R.tableState()};return x}setState(x){if(!(!x||typeof x!="object"))for(const[R,N]of Object.entries(x)){const X=this.get(R);!X||!N||typeof N!="object"||(typeof N.collapsed=="boolean"&&X.setCollapsed(N.collapsed),N.table&&X.setTableState(N.table))}}exportModels(){return this.bands.map(x=>x.exportModel())}destroy(){for(const x of this.bands)x.destroy();this.bands=[]}}}),ae("packages/modules/charts/fills.js",function(g,V){"use strict";Object.defineProperty(g,"PATTERNS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"GRADIENTS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"isFill",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"isPaintRef",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"paintFallback",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"normaliseFill",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"swatchCss",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"createFillRegistry",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"rowPaint",{enumerable:!0,get:function(){return C}}),Object.defineProperty(g,"patternSeries",{enumerable:!0,get:function(){return a}}),Object.defineProperty(g,"paintSolid",{enumerable:!0,get:function(){return o}}),Object.defineProperty(g,"rowFillSource",{enumerable:!0,get:function(){return p}}),Object.defineProperty(g,"nodePaint",{enumerable:!0,get:function(){return $}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=Object.freeze(["hatch","crosshatch","dots","grid"]),Y=Object.freeze(["linear","radial"]),H=8,l="#0072b2";let L=0;const v=new Map;function m(h){return!!h&&typeof h=="object"&&!Array.isArray(h)&&(typeof h.gradient=="string"||typeof h.pattern=="string")}function w(h){return typeof h=="string"&&h.startsWith("url(#")}function k(h){if(typeof h!="string")return h==null?"":String(h);if(!h.startsWith("url("))return h;const y=h.indexOf(")");return(y<0?"":h.slice(y+1).trim())||l}function u(h,y){U(`chart:fill:invalid:${h}`,`a chart fill object was ignored: ${y} The mark was drawn in a solid colour instead. A fill is a gradient object (gradient: "linear" or "radial", with stops of [offset, colour]) or a pattern object (pattern: "hatch", "crosshatch", "dots" or "grid", with a colour).`)}function f(h,y){if(!m(h))return null;const i=y||l;if(typeof h.gradient=="string"){if(!Y.includes(h.gradient))return u("gradient",`the gradient "${h.gradient}" is not one of ${Y.join(", ")}.`),null;const j=Array.isArray(h.stops)?h.stops:[],I=[];for(const z of j){const W=Array.isArray(z)?Number(z[0]):Number(z&&z.offset),B=Array.isArray(z)?z[1]:z&&z.colour;!Number.isFinite(W)||typeof B!="string"||!B||I.push({offset:Math.min(1,Math.max(0,W)),colour:B})}if(I.length<2)return u("stops","a gradient needs at least two [offset, colour] stops."),null;I.sort((z,W)=>z.offset-W.offset);const O=Number.isFinite(Number(h.angle))?Number(h.angle):180;return{kind:h.gradient,angle:O,stops:I,solid:I[0].colour}}if(!K.includes(h.pattern))return u("pattern",`the pattern "${h.pattern}" is not one of ${K.join(", ")}.`),null;const r=Number(h.size),b=Number(h.angle),T=typeof h.colour=="string"&&h.colour?h.colour:i;return{kind:"pattern",pattern:h.pattern,colour:T,background:typeof h.background=="string"&&h.background?h.background:null,size:Number.isFinite(r)&&r>=2?r:H,angle:Number.isFinite(b)?b:h.pattern==="grid"||h.pattern==="dots"?0:45,solid:T}}function d(h){if(h.kind==="pattern"){const i=h.colour,r=h.size,b=Math.max(1,r/5),T=h.background||"transparent",j=I=>`repeating-linear-gradient(${I+90}deg,${i} 0 ${b}px,transparent ${b}px ${r}px)`;return h.pattern==="hatch"?`${j(h.angle)},${T}`:h.pattern==="crosshatch"?`${j(h.angle)},${j(h.angle+90)},${T}`:h.pattern==="grid"?`${j(h.angle)},${j(h.angle+90)},${T}`:`radial-gradient(circle at 50% 50%,${i} ${r/6}px,transparent ${r/6+.5}px) 0 0/${r}px ${r}px,${T}`}const y=h.stops.map(i=>`${i.colour} ${Math.round(i.offset*100)}%`).join(",");return h.kind==="radial"?`radial-gradient(circle,${y})`:`linear-gradient(${h.angle}deg,${y})`}function S(h){if(!w(h))return typeof h=="string"?h:"";const y=String(h).indexOf(")"),i=String(h).slice(5,y),r=v.get(i);return r?d(r):k(h)}function _(h){const y=`lattice-fill-${++L}`;let i=new Map,r=0;const b=(j,I)=>{const O=h.ownerDocument.createElementNS("http://www.w3.org/2000/svg",j);for(const z of Object.keys(I))O.setAttribute(z,String(I[z]));return O},T=(j,I)=>{if(I.kind==="pattern"){const z=I.size,W=Math.max(1,z/5),B=b("pattern",{id:j,width:z,height:z,patternUnits:"userSpaceOnUse"});I.angle&&B.setAttribute("patternTransform",`rotate(${I.angle})`),I.background&&B.appendChild(b("rect",{width:z,height:z,fill:I.background}));const at={stroke:I.colour,"stroke-width":W};I.pattern==="dots"?B.appendChild(b("circle",{cx:z/2,cy:z/2,r:Math.max(1,z/6),fill:I.colour})):(B.appendChild(b("line",{x1:z/2,y1:0,x2:z/2,y2:z,...at})),I.pattern!=="hatch"&&B.appendChild(b("line",{x1:0,y1:z/2,x2:z,y2:z/2,...at}))),h.appendChild(B);return}let O;if(I.kind==="radial")O=b("radialGradient",{id:j,cx:.5,cy:.5,r:.5});else{const z=I.angle*Math.PI/180,W=Math.sin(z)/2,B=-Math.cos(z)/2;O=b("linearGradient",{id:j,x1:+(.5-W).toFixed(4),y1:+(.5-B).toFixed(4),x2:+(.5+W).toFixed(4),y2:+(.5+B).toFixed(4)})}for(const z of I.stops)O.appendChild(b("stop",{offset:z.offset,"stop-color":z.colour}));h.appendChild(O)};return{prefix:y,paint(j,I){const O=f(j,I);if(!O)return I||l;if(!h||!h.ownerDocument)return O.solid;const z=JSON.stringify(O);let W=i.get(z);if(!W){const B=`${y}-${r++}`;T(B,O),v.set(B,O),W=`url(#${B}) ${O.solid}`,i.set(z,W)}return W},reset(){for(const j of i.values())v.delete(j.slice(5,j.indexOf(")")));if(i=new Map,r=0,h)for(;h.firstChild;)h.removeChild(h.firstChild)},ids(){return[...i.values()].map(j=>j.slice(5,j.indexOf(")")))}}}function C(h,y,i){if(h==null||h==="")return null;const r=k(i);if(m(h))return y?y.paint(h,r):(f(h,r)||{}).solid||null;if(typeof h=="string"){if(K.includes(h)){const b={pattern:h,colour:r};return y?y.paint(b,r):r}return h}return null}function a(h){const y=[{pattern:"hatch",angle:45},{pattern:"dots"},{pattern:"crosshatch",angle:45},{pattern:"hatch",angle:135},{pattern:"grid"},{pattern:"dots",size:5},{pattern:"hatch",angle:0},{pattern:"crosshatch",angle:0,size:6}];return h.map((i,r)=>({...y[r%y.length],colour:i,background:"var(--lattice-chart-plot-bg,var(--lattice-chart-d-plot-bg))"}))}function o(h){return w(h)?String(h).replace(/^url\([^)]*\)\s*/,""):h}function p(h,y){const i=h.fill;if(m(i))return(b,T)=>C(i,y.fills,o(T));if(typeof i=="function")return(b,T)=>{let j=null;try{j=i({label:b.label,x:b.x,y:b.y,rowKey:b.rowKey})}catch{j=null}return C(j,y.fills,o(T))};const r=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.col=="string"?i.col:null;return r?(b,T)=>b.rowKey===void 0||b.rowKey===null?null:C(h.grid.rows.value(b.rowKey,r),y.fills,o(T)):null}function $(h,y,i){return h&&h({label:y.label,x:y.value,y:y.total,rowKey:y.rowKey},i)||i}}),ae("packages/modules/charts/scheme.js",function(g,V){"use strict";Object.defineProperty(g,"PALETTE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"SCHEMES",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"registerScheme",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"setDefaultScheme",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"schemeNames",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"resolveScheme",{enumerable:!0,get:function(){return C}}),Object.defineProperty(g,"RAMP_SCALES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(g,"toRgb",{enumerable:!0,get:function(){return y}}),Object.defineProperty(g,"rampStops",{enumerable:!0,get:function(){return i}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/modules/charts/fills.js"),Y=K.isFill,H=K.patternSeries,l=K.rowPaint,L=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),v=Object.freeze({default:{series:L,sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"},bright:{series:["#1f77d0","#ff7f0e","#2ca02c","#d62728","#9467bd","#17becf","#e377c2","#7f7f7f"],sequential:["#eef4fb","#1f77d0"],diverging:["#d62728","#f7f7f7","#1f77d0"],positive:"#2ca02c",negative:"#d62728"},earth:{series:["#5b7c6f","#c08b52","#7a6a53","#a4553f","#4e6a83","#8f8259","#6d5566","#8c9196"],sequential:["#f2efe9","#4e6a83"],diverging:["#a4553f","#f2efe9","#4e6a83"],positive:"#5b7c6f",negative:"#a4553f"},mono:{series:["#0b2a3d","#17475f","#2c6480","#4a82a0","#6da0bd","#94bcd6","#bcd7e9","#dfecf5"],sequential:["#eef3f7","#0b2a3d"],diverging:["#7a5c00","#f5f5f5","#0b2a3d"],positive:"#17475f",negative:"#7a5c00"},patterns:{series:H(L),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),m=new Map;let w="default";function k(r,b){!r||!b||m.set(String(r),b)}function u(r){if(typeof r=="string"){w=r;return}r&&typeof r=="object"&&(m.set("__default__",r),w="__default__")}function f(){return[...Object.keys(v),...m.keys()].filter(r=>!r.startsWith("__"))}function d(r){return m.has(r)?m.get(r):v[r]||null}const S=["series","sequential","diverging","positive","negative"];function _(r){return!r||typeof r!="object"||Array.isArray(r)?!1:!S.some(b=>b in r)}function C(r,b){const T=b&&b.fills||null,j=b&&b.variants||null,I=d(w)||v.default,O=r&&r.scheme,z=_(O)?O:null,W=Array.isArray(O)&&O.length?O:null,B=typeof O=="string"?d(O):z||Array.isArray(O)?null:O||null,at=(r&&Array.isArray(r.palette)&&r.palette.length?r.palette:null)||W;z&&at&&U("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const ct=z?null:at,kt={...v.default,...I,...B||{}};ct&&(kt.series=ct);const Tt=r&&r.ramp&&typeof r.ramp=="object"&&!Array.isArray(r.ramp)?r.ramp:null,Ft=Tt?Tt.colours:r&&r.ramp,D=Array.isArray(Ft)&&Ft.length>=2?Ft:null;D&&(kt.sequential=D);const P=Tt?p(Tt.scale):null,x=!!(B||ct||z),R=kt.series&&kt.series.length?kt.series:L,N=b&&b.memory instanceof Map?b.memory:new Map,X=(J,tt)=>{const ft=tt!=null?String(tt):null;if(ft!==null){if(z&&Object.prototype.hasOwnProperty.call(z,ft))return a(z[ft],T,J);if(j&&Object.prototype.hasOwnProperty.call(j,ft))return j[ft]}if((z||j)&&ft!==null){const st=h(N,ft);return a($(R,st,x),T,st)}return a($(R,J,x),T,J)};return{...kt,series:X,seriesNamed:(J,tt)=>{if(tt==null)return X(J);if(z||j)return X(J,tt);const ft=h(N,String(tt));return a($(R,ft,x),T,ft)},explicit:x,nameMap:!!(z||j),rampScale:P,fills:T}}function a(r,b,T){if(!Y(r))return r;const j=L[(T%L.length+L.length)%L.length];return l(r,b,j)||j}const o=Object.freeze(["linear","log","quantile"]);function p(r){return r==null?null:o.includes(r)?r:(U(`chart:ramp:scale:${String(r)}`,`chart "ramp.scale" was "${String(r)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function $(r,b,T){const j=(b%r.length+r.length)%r.length;return T||typeof r[j]!="string"?r[j]:`var(--lattice-chart-${j+1}, ${r[j]})`}function h(r,b){if(r.has(b))return r.get(b);const T=new Set(r.values());let j=0;for(;T.has(j);)j++;return r.set(b,j),j}function y(r){if(typeof r!="string")return null;const b=r.trim(),T=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(b);if(T){const O=T[1];return O.length===3?[0,1,2].map(z=>parseInt(O[z]+O[z],16)):[0,2,4].map(z=>parseInt(O.slice(z,z+2),16))}const j=/^rgba?\(([^)]+)\)$/i.exec(b);if(!j)return null;const I=j[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return I.length===3&&I.every(O=>Number.isFinite(O))?I:null}function i(r,b){const T=b?r.diverging:r.sequential,j=b?v.default.diverging:v.default.sequential,I=(Array.isArray(T)?T:j).map((O,z)=>y(O)||y(j[z])||[0,0,0]);return I.length>=2?I:j.map(O=>y(O))}}),ae("packages/modules/charts/roles.js",function(g,V){"use strict";Object.defineProperty(g,"expand",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"readRole",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"rolesCss",{enumerable:!0,get:function(){return u}});const U=V("packages/modules/charts/scheme.js").PALETTE,K="lat-chartview",Y=Object.freeze(["#4ea6dd","#f0b429","#34c79a","#e39ec4","#7cc7f0","#f07c3f","#a48ad4","#93a3b1"]),H=":where(:root,.lattice,.lattice-tokens,[data-theme])",l=`
|
|
130
|
+
`}function L({doc:v,t:b,ns:w,onSelect:k,onFix:u}){let g=!0,d=[];const S=U(v,"div",`${w}__issues`);S.setAttribute("role","group"),S.setAttribute("aria-label",b("gantt.issues.title"));const _=U(v,"button",`${w}__issues-head`);_.setAttribute("type","button"),_.setAttribute("aria-expanded","true");const C=U(v,"span",`${w}__issues-caret`);C.setAttribute("aria-hidden","true"),K(C,"▾");const a=U(v,"span",`${w}__issues-title`);K(a,b("gantt.issues.title"));const o=U(v,"span",`${w}__issues-badge`);_.appendChild(C),_.appendChild(a),_.appendChild(o);const m=U(v,"div",`${w}__issues-body`),$=U(v,"ul",`${w}__issues-list`);$.setAttribute("role","list");const h=U(v,"p",`${w}__issues-empty`);K(h,b("gantt.issues.empty")),m.appendChild(h),m.appendChild($),S.appendChild(_),S.appendChild(m);const y=()=>{S.classList.toggle(`${w}__issues--collapsed`,!g),_.setAttribute("aria-expanded",g?"true":"false")},i=()=>{g=!g,y()};_.addEventListener("click",i);const r=()=>[...$.querySelectorAll(`.${w}__issues-select`)],f=I=>{const O=I.key;if(O!=="ArrowDown"&&O!=="ArrowUp")return;const B=r();if(!B.length)return;const H=B.indexOf(I.target&&I.target.closest?I.target.closest(`.${w}__issues-select`):null),z=H<0?0:Math.min(B.length-1,Math.max(0,H+(O==="ArrowDown"?1:-1)));I.preventDefault&&I.preventDefault(),B[z].focus()};$.addEventListener("keydown",f);const M=I=>{const O=U(v,"li",`${w}__issues-row`);O.setAttribute("role","listitem");const B=U(v,"button",`${w}__issues-select`);B.setAttribute("type","button"),K(B,I.message);const H=()=>k(I);B.addEventListener("click",H),O.appendChild(B);const z=U(v,"div",`${w}__issues-actions`);for(const at of W[I.kind]||[]){const dt=U(v,"button",`${w}__issues-fix`);dt.setAttribute("type","button"),dt.setAttribute("data-action",at.action),K(dt,b(at.labelKey));const kt=Tt=>{Tt.stopPropagation&&Tt.stopPropagation(),u(I,at.action)};dt.addEventListener("click",kt),z.appendChild(dt)}return z.childNodes.length&&O.appendChild(z),O},D=I=>{d=Array.isArray(I)?I:[],Y($);for(const B of d)$.appendChild(M(B));const O=d.length;O>0?(o.removeAttribute("hidden"),K(o,String(O)),o.setAttribute("aria-label",b("gantt.issues.count",{count:O})),h.setAttribute("hidden",""),$.removeAttribute("hidden")):(o.setAttribute("hidden",""),K(o,""),h.removeAttribute("hidden"),$.setAttribute("hidden",""))};return y(),D([]),{element:S,update:D,isOpen:()=>g,setOpen:I=>{g=!!I,y()},destroy:()=>{_.removeEventListener("click",i),$.removeEventListener("keydown",f),S.parentNode&&S.parentNode.removeChild(S)}}}}),ae("packages/modules/gantt/events-range.js",function(p,V){"use strict";Object.defineProperty(p,"createVisibleRangeNotifier",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"visibleRangeDays",{enumerable:!0,get:function(){return Y}});const U=V("packages/core/src/internal/schedule.js").frameBatched;function K(W,l){let L=null;const b=U(()=>{const w=l();if(!w)return;const k=`${w.start}\0${w.end}\0${w.zoom}`;k!==L&&(L=k,W(w))});return{note(){b()},dispose(){b.cancel()}}}function Y(W,l,L){if(!W||!Number.isFinite(W.domainMin)||!Number.isFinite(W.pxPerDay)||W.pxPerDay<=0)return null;const v=Number(l)||0,b=Math.max(0,Number(L)||0),w=v+b,k=Math.floor(W.domainMin+v/W.pxPerDay),u=Math.ceil(W.domainMin+w/W.pxPerDay)-1;return u<k?null:{start:k,end:u}}}),ae("packages/modules/gantt/events-scroll.js",function(p,V){"use strict";Object.defineProperty(p,"createScrollNotifier",{enumerable:!0,get:function(){return K}});const U=V("packages/core/src/internal/schedule.js").frameBatched;function K(Y,W){let l=null;const v=U(()=>{const b=W();if(!b)return;const w=`${b.top}\0${b.left}`;w!==l&&(l=w,Y(b))});return{note(){v()},dispose(){v.cancel()}}}}),ae("packages/core/src/internal/icon-builtins.js",function(p,V){"use strict";Object.defineProperty(p,"BUILT_IN_ICONS",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"normaliseIcon",{enumerable:!0,get:function(){return U}});const St={chevronRight:{viewBox:"0 0 16 16",paths:["M6 3.5 10.5 8 6 12.5"],paint:"stroke"},chevronDown:{viewBox:"0 0 16 16",paths:["M3.5 6 8 10.5 12.5 6"],paint:"stroke"},chevronUp:{viewBox:"0 0 16 16",paths:["M3.5 10 8 5.5 12.5 10"],paint:"stroke"},chevronLeft:{viewBox:"0 0 16 16",paths:["M10 3.5 5.5 8 10 12.5"],paint:"stroke"},check:{viewBox:"0 0 16 16",paths:["M3.5 8.5 6.5 11.5 12.5 4.5"],paint:"stroke"},dash:{viewBox:"0 0 16 16",paths:["M4 8h8"],paint:"stroke"},close:{viewBox:"0 0 16 16",paths:["M4 4l8 8M12 4l-8 8"],paint:"stroke"},plus:{viewBox:"0 0 16 16",paths:["M8 3.5v9M3.5 8h9"],paint:"stroke"},minus:{viewBox:"0 0 16 16",paths:["M3.5 8h9"],paint:"stroke"},info:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm.75 4a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM7.25 7h1.5v4.5h-1.5Z"]},success:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm3.2 4.4-4 4.6-2.4-2.3 1-1.1 1.3 1.2 3-3.4Z"]},warning:{viewBox:"0 0 16 16",paths:["M8 1.5 15 14H1Zm-.75 4v4h1.5v-4Zm0 5v1.5h1.5V10.5Z"]},danger:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-.75 3h1.5v5h-1.5Zm0 6h1.5V12h-1.5Z"]},clock:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm-.75 3h1.5v3.7l2.5 1.5-.75 1.3-3.25-2Z"]},calendar:{viewBox:"0 0 16 16",paths:["M3 2.5h10v11H3z","M3 5.5h10","M5.5 1.5v2","M10.5 1.5v2"],paint:"stroke"},lock:{viewBox:"0 0 16 16",paths:["M4.5 7V5a3.5 3.5 0 1 1 7 0v2H13v7H3V7Zm1.5 0h4V5a2 2 0 1 0-4 0Z"]},link:{viewBox:"0 0 16 16",paths:["M6.5 9.5a3 3 0 0 1 0-4l2-2a3 3 0 0 1 4 4l-1 1M9.5 6.5a3 3 0 0 1 0 4l-2 2a3 3 0 0 1-4-4l1-1"],paint:"stroke"},external:{viewBox:"0 0 16 16",paths:["M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5 7 9"],paint:"stroke"},filter:{viewBox:"0 0 16 16",paths:["M2 3h12l-4.5 5.2V13L6.5 11.5V8.2Z"]},pause:{viewBox:"0 0 16 16",paths:["M4.5 3h2.5v10H4.5zM9 3h2.5v10H9z"]},play:{viewBox:"0 0 16 16",paths:["M4.5 3l8 5-8 5z"]},chart:{viewBox:"0 0 16 16",paths:["M2.5 13.5h11","M4.5 13.5v-4","M8 13.5v-8","M11.5 13.5v-6"],paint:"stroke"},palette:{viewBox:"0 0 16 16",paths:["M8 1.5a6.5 6.5 0 0 0 0 13c.7 0 1.2-.5 1.2-1.1 0-.3-.1-.6-.3-.8a1.1 1.1 0 0 1 .8-1.9h1.4A3.4 3.4 0 0 0 14.5 7c0-3-2.9-5.5-6.5-5.5Z","M4.6 7.6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM6.7 4.6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM9.9 4.7a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM11.9 6.9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"]},undo:{viewBox:"0 0 16 16",paths:["M3 8h6.5a3.25 3.25 0 0 1 0 6.5H6M3 8l3-3M3 8l3 3"],paint:"stroke"},redo:{viewBox:"0 0 16 16",paths:["M13 8H6.5a3.25 3.25 0 0 0 0 6.5H10M13 8l-3-3M13 8l-3 3"],paint:"stroke"},columns:{viewBox:"0 0 16 16",paths:["M2.5 2.5h11v11h-11zM6.5 2.5v11M10 2.5v11"],paint:"stroke"},download:{viewBox:"0 0 16 16",paths:["M8 2.5v7.5M8 10 5 7M8 10l3-3M2.5 12.5h11"],paint:"stroke"},restore:{viewBox:"0 0 16 16",paths:["M3 8a5 5 0 1 0 1.6-3.7M3 3v2.8h2.8"],paint:"stroke"},spreadsheet:{viewBox:"0 0 16 16",paths:["M3 2.5h10v11H3zM3 6h10M3 9.5h10M6.5 6v7.5"],paint:"stroke"},print:{viewBox:"0 0 16 16",paths:["M4.5 6V2.5h7V6M4.5 11.5h-2V6h11v5.5h-2M4.5 9.5h7v4h-7z"],paint:"stroke"},maximise:{viewBox:"0 0 16 16",paths:["M2.5 6V2.5H6M10 2.5h3.5V6M13.5 10v3.5H10M6 13.5H2.5V10"],paint:"stroke"},minimise:{viewBox:"0 0 16 16",paths:["M6 2.5V6H2.5M13.5 6H10V2.5M10 13.5V10h3.5M2.5 10H6v3.5"],paint:"stroke"},views:{viewBox:"0 0 16 16",paths:["M4 2.5h8v11L8 11l-4 2.5z"],paint:"stroke"},search:{viewBox:"0 0 16 16",paths:["M7 2.5a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9M10.4 10.4 13.5 13.5"],paint:"stroke"},pencil:{viewBox:"0 0 16 16",paths:["M2.5 11.2 11 2.7l2.3 2.3-8.5 8.5-3 .7z"],paint:"stroke"},trash:{viewBox:"0 0 16 16",paths:["M3 4.5h10M6.5 4.5V3h3v1.5M4.5 4.5l.7 8.5h5.6l.7-8.5M6.8 7v3.7M9.2 7v3.7"],paint:"stroke"},share:{viewBox:"0 0 16 16",paths:["M11.5 5.5a1.8 1.8 0 1 0 0-3.6 1.8 1.8 0 0 0 0 3.6M4.5 9.8a1.8 1.8 0 1 0 0-3.6 1.8 1.8 0 0 0 0 3.6M11.5 14.1a1.8 1.8 0 1 0 0-3.6 1.8 1.8 0 0 0 0 3.6M6.1 7.1l3.8-1.9M6.1 8.9l3.8 1.9"],paint:"stroke"},pin:{viewBox:"0 0 16 16",paths:["M8 2v6M5 8h6l1 2.5H4zM8 10.5V14"],paint:"stroke"},sortAsc:{viewBox:"0 0 16 16",paths:["M8 3.5 12 8H4Z"]},sortDesc:{viewBox:"0 0 16 16",paths:["M8 12.5 4 8h8Z"]},menu:{viewBox:"0 0 16 16",paths:["M2.5 4.5h11M2.5 8h11M2.5 11.5h11"],paint:"stroke"},ellipsis:{viewBox:"0 0 16 16",paths:["M3 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Zm5 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Zm5 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"]},ellipsisVertical:{viewBox:"0 0 16 16",paths:["M6.5 3a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0Zm0 5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0Zm0 5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0Z"]},drag:{viewBox:"0 0 16 16",paths:["M6 3.5h1.5V5H6Zm3 0h1.5V5H9ZM6 7.25h1.5v1.5H6Zm3 0h1.5v1.5H9ZM6 11h1.5v1.5H6Zm3 0h1.5v1.5H9Z"]},star:{viewBox:"0 0 16 16",paths:["M8 1.6l1.96 3.97 4.38.64-3.17 3.09.75 4.36L8 11.6l-3.92 2.06.75-4.36L1.66 6.21l4.38-.64Z"]},heart:{viewBox:"0 0 16 16",paths:["M8 14.2 2.4 8.6a3.3 3.3 0 0 1 4.67-4.67L8 4.86l.93-.93A3.3 3.3 0 0 1 13.6 8.6Z"]},circleFilled:{viewBox:"0 0 16 16",paths:["M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Z"]},square:{viewBox:"0 0 16 16",paths:["M3 3h10v10H3Z"]},bolt:{viewBox:"0 0 16 16",paths:["M9.5 1.5 3.5 9h3.2l-.7 5.5L12.5 7H9.3Z"]},flag:{viewBox:"0 0 16 16",paths:["M4 1.5h1.5v13H4Zm1.5 1h7.5l-1.6 2.6L13 7.7H5.5Z"]},arrow:{viewBox:"0 0 16 16",paths:["M3 13 12.5 3.5","M7.5 3.5H12.5V8.5"],paint:"stroke"},highlight:{viewBox:"0 0 16 16",paths:["M4 11 10 5l2 2-6 6H4z","M3 14.5h10"],paint:"stroke"},eraser:{viewBox:"0 0 16 16",paths:["M3 11 9 5 13 9 7 15Z","M5 13 9 9"],paint:"stroke"},thumbUp:{viewBox:"0 0 16 16",paths:["M5.5 6.8 8.6 1.5a1.6 1.6 0 0 1 1.5 2.1L9.4 6h3.4a1.4 1.4 0 0 1 1.35 1.78l-1.3 4.6A1.9 1.9 0 0 1 11 13.8H5.5ZM4 6.5H1.5v7.3H4Z"]},eye:{viewBox:"0 0 16 16",paths:["M8 3.2c3.3 0 6 3 6.6 4.5C14 9.3 11.3 12.3 8 12.3S2 9.3 1.4 7.7C2 6.2 4.7 3.2 8 3.2Zm0 2a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"]},eyeOff:{viewBox:"0 0 16 16",paths:["M2.2 2.9 13.1 13.8M8 3.2c3.3 0 6 3 6.6 4.5a9.4 9.4 0 0 1-1.9 2.4M5 4.2A9 9 0 0 0 1.4 7.7C2 9.3 4.7 12.3 8 12.3c.9 0 1.7-.2 2.5-.5M6.3 6a2.5 2.5 0 0 0 3.4 3.5"],paint:"stroke"},copy:{viewBox:"0 0 16 16",paths:["M5.5 2.5h8v8M2.5 5.5h8v8h-8Z"],paint:"stroke"},present:{viewBox:"0 0 16 16",paths:["M2 2.5h12v8H2Z","M8 10.5v3","M6 13.5h4"],paint:"stroke"},cabinet:{viewBox:"0 0 16 16",paths:["M3 2h10v12H3ZM5 4v4h2.5V4ZM8.5 4v4H11V4ZM5 9.5V11h6V9.5Z"]},splice:{viewBox:"0 0 16 16",paths:["M8 4.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7ZM8 6.8a1.2 1.2 0 1 1 0 2.4 1.2 1.2 0 0 1 0-2.4ZM1.5 7.2h3v1.6h-3ZM11.5 7.2h3v1.6h-3Z"]},exchange:{viewBox:"0 0 16 16",paths:["M8 1.5 14.5 6v1H1.5V6ZM3 8h2v5H3ZM7 8h2v5H7ZM11 8h2v5h-2ZM1.5 13.5h13V15h-13Z"]},pole:{viewBox:"0 0 16 16",paths:["M7.2 1.5h1.6V15H7.2ZM3 3.5h10V5H3ZM4.5 7h7v1.4h-7Z"]},chamber:{viewBox:"0 0 16 16",paths:["M2.5 3.5h11v9h-11ZM4.5 5.5v5h7v-5ZM6 7h4v1.5H6Z"]},premises:{viewBox:"0 0 16 16",paths:["M8 1.8 14.5 7.5h-2V14h-9V7.5h-2ZM6.8 10.4V14h2.4v-3.6Z"]},fault:{viewBox:"0 0 16 16",paths:["M5.2 1.5h5.6L14.5 5.2v5.6L10.8 14.5H5.2L1.5 10.8V5.2ZM5.4 9.4 6.6 10.6 8 9.2 9.4 10.6 10.6 9.4 9.2 8 10.6 6.6 9.4 5.4 8 6.8 6.6 5.4 5.4 6.6 6.8 8Z"]},user:{viewBox:"0 0 16 16",paths:["M8 2a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z","M8 9c3 0 5.5 1.5 5.5 3.5V14h-11v-1.5C2.5 10.5 5 9 8 9Z"]},blank:{viewBox:"0 0 16 16",paths:[""]}};function U(K){return typeof K=="string"?{viewBox:"0 0 16 16",paths:[K],paint:"fill"}:Array.isArray(K)?{viewBox:"0 0 16 16",paths:K.slice(),paint:"fill"}:{viewBox:K&&K.viewBox||"0 0 16 16",paths:K&&Array.isArray(K.paths)?K.paths.slice():K&&K.path?[K.path]:[],paint:K&&K.paint==="stroke"?"stroke":"fill"}}}),ae("packages/dom/src/cell/icons.js",function(p,V){"use strict";Object.defineProperty(p,"SVG_NS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"registerIcon",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"registerIcons",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"icon",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"iconNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"createIcon",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"updateIcon",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"isIconMarkup",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"renderIconInto",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"resetIcons",{enumerable:!0,get:function(){return C}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/core/src/internal/icon-builtins.js"),Y=K.BUILT_IN_ICONS,W=K.normaliseIcon,l="http://www.w3.org/2000/svg",L=new Map(Object.entries(Y));function v(a,o){L.set(a,W(o))}function b(a){if(a)for(const o of Object.keys(a))v(o,a[o])}function w(a){return L.get(a)}function k(){return[...L.keys()]}function u(a,o,m){let $=L.get(o);$||(U(`icon:${o}`,`Unknown icon '${o}'; drew a blank glyph in its place. Register it with grid.icons or config.icons.`),$=L.get("blank"));const h=a.createElementNS(l,"svg");h.setAttribute("class",m&&m.className||"lat-icon"),h.setAttribute("viewBox",$.viewBox),h.setAttribute("focusable","false"),h.setAttribute("aria-hidden","true"),d(h,$.paint);const y=[];for(const i of $.paths){const r=a.createElementNS(l,"path");r.setAttribute("d",i),h.appendChild(r),y.push(r)}return h.__latIcon={name:o,nodes:y,paint:$.paint},h}function g(a,o){const m=a&&a.__latIcon;if(!m)return!1;if(m.name===o)return!0;const $=L.get(o);if(!$)return U(`icon:${o}`,`Unknown icon '${o}'. Register it with grid.icons or config.icons.`),!1;if($.paths.length!==m.nodes.length)return!1;for(let h=0;h<$.paths.length;h++)m.nodes[h].setAttribute("d",$.paths[h]);return a.setAttribute("viewBox",$.viewBox),$.paint!==m.paint&&(d(a,$.paint),m.paint=$.paint),m.name=o,!0}function d(a,o){if(o==="stroke"){a.setAttribute("fill","none"),a.setAttribute("stroke","currentColor"),a.setAttribute("stroke-width","1.5"),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round");return}a.setAttribute("fill","currentColor"),a.removeAttribute("stroke"),a.removeAttribute("stroke-width"),a.removeAttribute("stroke-linecap"),a.removeAttribute("stroke-linejoin")}function S(a){if(typeof a!="string")return!1;const o=a.trim();return/^<[a-zA-Z!/]/.test(o)&&o.includes(">")}function _(a,o,m){return a.textContent="",a.removeAttribute("data-icon"),o==null||o===""?(o===""&&U(`icon:empty:${m}`,`An empty icon value at ${m} renders nothing; omit \`icon\` instead.`),a):typeof o!="string"?(U(`icon:type:${m}`,`An icon must be a name, a character, or element markup; got ${typeof o} at ${m}.`),a):S(o)?(a.innerHTML=o,a):(a.setAttribute("data-icon",o),a)}function C(){L.clear();for(const[a,o]of Object.entries(Y))L.set(a,o)}}),ae("packages/modules/contextmenu/menu.js",function(p,V){"use strict";Object.defineProperty(p,"resolveMenuItems",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"ContextMenu",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"default",{enumerable:!0,get:function(){return _}});const U=V("packages/dom/src/cell/icons.js").renderIconInto,Y=V("packages/core/src/internal/predicates.js").isFunction,W=Object.freeze({menu:"lat-menu",menuItem:"lat-menu__item",menuItemFocused:"lat-menu__item--focused",menuSeparator:"lat-menu__separator",label:"lat-menu__item__label",shortcut:"lat-menu__item__shortcut",arrow:"lat-menu__item__arrow",icon:"lat-icon",check:"lat-menu__check",swatches:"lat-menu__swatches",swatch:"lat-menu__swatch",swatchSelected:"lat-menu__swatch--selected"});function l(C){if(C&&C.document)return C.document;if(C&&C.host&&C.host.ownerDocument)return C.host.ownerDocument;const a=globalThis;if(!a.document)throw new Error("[lattice] no document available; pass one as options.document");return a.document}let L=0;function v(){return`lat-menu-${++L}`}function b(C){if(!C)return!1;const a=C.ownerDocument&&C.ownerDocument.defaultView;if(a&&Y(a.getComputedStyle))try{return a.getComputedStyle(C).direction==="rtl"?!0:(a.getComputedStyle(C).direction==="ltr",!1)}catch{}for(let o=C;o;o=o.parentNode){const m=Y(o.getAttribute)?o.getAttribute("dir"):null;if(m==="rtl")return!0;if(m==="ltr")return!1}return!1}function w(C,a,o){const m=C.createElement(a);if(!o)return m;if(o.class){for(const $ of Array.isArray(o.class)?o.class:[o.class])if($)for(const h of String($).split(/\s+/))h&&m.classList.add(h)}if(o.text!==void 0&&o.text!==null&&(m.textContent=String(o.text)),o.attrs)for(const[$,h]of Object.entries(o.attrs))h==null||h===!1||m.setAttribute($,h===!0?"":String(h));if(o.style)for(const[$,h]of Object.entries(o.style))m.style[$]=h;if(o.children)for(const $ of o.children)$&&m.appendChild($);return m}function k(C,a,o,m){return C.addEventListener(a,o,m),()=>C.removeEventListener(a,o,m)}function u(C){Y(C.preventDefault)&&C.preventDefault(),Y(C.stopPropagation)&&C.stopPropagation()}function g(C,a){let o=a;for(;o;){if(o===C)return!0;o=o.parentNode}return!1}function d(C,a){const o=[];for(const m of C||[]){const $=Y(m)?m(a):m;if($==null||$===!1)continue;if($==="separator"){o.push({separator:!0});continue}if(typeof $=="string"){o.push({name:$});continue}const h=$,y=h.subMenu||h.children;y?o.push({...h,subMenu:d(y,a)}):o.push(h)}return o.filter((m,$,h)=>m.separator?$===0||$===h.length-1?!1:!h[$-1].separator:!0)}class S{root=null;itemNodes=[];items=[];focused=-1;child=null;off=[];open=!1;armed=!1;trigger=null;anchor=null;constructor(a){const o=a||{};this.doc=l(o),this.host=o.host||this.doc.body,this.ctx=o.ctx||{},this.onClose=o.onClose||null,this.parent=o.parent||null}place(a){const o=this.host,m=Y(o.getBoundingClientRect)?o.getBoundingClientRect():{left:0,top:0},$=Y(this.root.getBoundingClientRect)?this.root.getBoundingClientRect():{width:0,height:0},h=this.doc.defaultView||{innerWidth:0,innerHeight:0},y=h.innerWidth||0,i=h.innerHeight||0;let r=a.x||0,f=a.y||0;const M=b(o);if(a.anchor&&Y(a.anchor.getBoundingClientRect)){const O=a.anchor.getBoundingClientRect();a.placement==="below"?(r=M?O.right-$.width:O.left,f=O.bottom):(r=M?O.left-$.width:O.right,f=O.top)}else M&&(r-=$.width);const D={left:Math.max(0,m.left||0),top:Math.max(0,m.top||0),right:Math.min(y||1/0,(m.left||0)+(m.width||1/0)),bottom:Math.min(i||1/0,(m.top||0)+(m.height||1/0))};r+$.width>D.right&&(r-=$.width),r<D.left&&(r=D.left),f+$.height>D.bottom&&(f-=$.height),f<D.top&&(f=D.top);const I=D.bottom-f;$.height>I&&(this.root.style.maxHeight=`${Math.max(0,Math.floor(I))}px`,this.root.style.overflowY="auto"),this.root.style.left=`${Math.round(r-m.left+(o.scrollLeft||0))}px`,this.root.style.top=`${Math.round(f-m.top+(o.scrollTop||0))}px`}show(a){return this.hide(),a.ctx&&(this.ctx={...this.ctx||{},...a.ctx}),this.items=d(a.items,this.ctx),this.returnFocus=a.returnFocus||null,this.trigger=a.trigger||null,this.anchor=a.anchor&&Y(a.anchor.setAttribute)&&Y(a.anchor.getAttribute)&&a.anchor.getAttribute("aria-haspopup")?a.anchor:null,this.anchor&&this.anchor.setAttribute("aria-expanded","true"),this.root=w(this.doc,"div",{class:W.menu,attrs:{role:"menu",tabindex:"-1"},style:{position:"absolute"}}),a.colId!=null&&(this.root.id=v(),this.root.setAttribute("data-col",String(a.colId)),this.anchor&&this.anchor.setAttribute("aria-controls",this.root.id)),this.itemNodes=[],this.items.forEach((o,m)=>{if(o.separator){this.root.appendChild(w(this.doc,"div",{class:W.menuSeparator,attrs:{role:"separator"}}));return}const $=w(this.doc,"div",{class:[W.menuItem,o.cssClass||"",o.swatches?"has-swatches":""],attrs:{role:o.checked===void 0?"menuitem":"menuitemcheckbox",tabindex:"-1","aria-disabled":o.disabled?"true":null,"aria-checked":o.checked===void 0?null:String(o.checked===!0),"aria-haspopup":o.subMenu?"true":null,"aria-expanded":o.subMenu?"false":null,"data-index":m}});if(o.checked!==void 0){const y=w(this.doc,"span",{class:W.check});o.checked&&U(y,"check",`menu:check:${o.name||m}`),$.appendChild(y)}if(o.icon!=null&&o.icon!==""){const y=w(this.doc,"span",{class:W.icon});U(y,o.icon,`menu:${o.name||m}`),$.appendChild(y)}if($.appendChild(w(this.doc,"span",{class:W.label,text:o.name||""})),o.shortcut&&$.appendChild(w(this.doc,"span",{class:W.shortcut,text:o.shortcut})),o.subMenu&&$.appendChild(w(this.doc,"span",{class:W.arrow,text:"›"})),o.swatches){const y=w(this.doc,"span",{class:W.swatches,attrs:{role:"group","aria-label":o.name||"Colour"}});o.swatches.forEach(i=>{const r=w(this.doc,"button",{class:[W.swatch,o.selected&&String(o.selected).toLowerCase()===String(i).toLowerCase()?W.swatchSelected:""],attrs:{type:"button",title:i,"aria-label":i},style:{background:i}});this.off.push(k(r,"mousedown",f=>f.preventDefault())),this.off.push(k(r,"click",f=>{f.stopPropagation(),!o.disabled&&(this.hideRoot(),Y(o.action)&&o.action({...this.ctx,item:o},i))})),y.appendChild(r)}),$.appendChild(y)}const h=this.itemNodes.length;this.off.push(k($,"click",y=>{y.target.closest&&y.target.closest(`.${W.swatch}`)||this.invoke(h)})),this.off.push(k($,"mouseenter",()=>{this.armed&&this.hover(h)})),this.itemNodes.push($),this.root.appendChild($)}),this.host.appendChild(this.root),this.place(a),this.open=!0,this.armed=!1,this.off.push(k(this.root,"keydown",o=>this.onKeyDown(o))),Y(this.doc.addEventListener)&&(this.off.push(k(this.doc,"mousedown",this.outside=o=>{this.root&&!g(this.root,o.target)&&!(this.child&&this.child.root&&g(this.child.root,o.target))&&!(this.trigger&&g(this.trigger,o.target))&&this.hide()},!0)),this.off.push(k(this.doc,"mousemove",o=>{this.armed=!0;const m=o.target;if(!m||!Y(m.closest))return;const $=m.closest(`.${W.menuItem}`);if(!$||!this.root||!g(this.root,$))return;const h=this.itemNodes.indexOf($);h!==-1&&this.hover(h)},!0))),Y(this.root.focus)&&this.root.focus({preventScroll:!0}),this.focus(this.firstEnabled()),this.root}firstEnabled(){for(let a=0;a<this.itemNodes.length;a++)if(!this.itemAt(a).disabled)return a;return-1}itemAt(a){const o=this.itemNodes[a];return o?this.items[Number(o.getAttribute("data-index"))]||{}:{}}focus(a){if(a<0||a>=this.itemNodes.length)return;const o=this.itemNodes[this.focused];o&&o.classList.remove(W.menuItemFocused),this.focused=a;const m=this.itemNodes[a];m.classList.add(W.menuItemFocused),Y(m.focus)&&m.focus({preventScroll:!0}),Y(m.scrollIntoView)&&m.scrollIntoView({block:"nearest",inline:"nearest"})}hover(a){if(a<0||a>=this.itemNodes.length)return;this.focused!==a&&this.focus(a),this.itemAt(a).subMenu?this.openSubMenu(a):this.closeChild()}move(a){const o=this.itemNodes.length;if(!o)return;let m=this.focused;for(let $=0;$<o;$++)if(m=(m+a+o)%o,!this.itemAt(m).disabled){this.focus(m);return}}step(a){this.move(a)}invoke(a){const o=this.itemAt(a);if(!(!o||o.disabled)){if(o.subMenu){this.openSubMenu(a);return}o.swatches||(Y(o.action)&&o.action({...this.ctx,item:o}),this.hideRoot())}}openSubMenu(a){const o=this.itemAt(a);o.subMenu&&(this.child&&this.child.anchorNode===this.itemNodes[a]||(this.closeChild(),this.child=new S({document:this.doc,host:this.host,ctx:this.ctx,parent:this}),this.child.anchorNode=this.itemNodes[a],this.itemNodes[a].setAttribute("aria-expanded","true"),this.child.show({items:o.subMenu,anchor:this.itemNodes[a]})))}closeChild(){if(!this.child)return;const a=this.itemNodes.indexOf(this.child.anchorNode||null);a!==-1&&this.itemNodes[a].setAttribute("aria-expanded","false"),this.child.hide(),this.child=null}onKeyDown(a){switch(a.key){case"ArrowDown":u(a),this.move(1);break;case"ArrowUp":u(a),this.move(-1);break;case"Home":u(a),this.focus(this.firstEnabled());break;case"End":u(a),this.focus(this.itemNodes.length-1);break;case"ArrowRight":{this.itemAt(this.focused).subMenu&&(u(a),this.openSubMenu(this.focused),this.child&&this.child.focus(this.child.firstEnabled()));break}case"ArrowLeft":u(a),this.parent&&(this.hide(),Y(this.parent.root&&this.parent.root.focus)&&this.parent.root.focus({preventScroll:!0}));break;case"Enter":case" ":{if(u(a),this.itemAt(this.focused).swatches){const m=this.itemNodes[this.focused]&&this.itemNodes[this.focused].querySelector(`.${W.swatchSelected}, .${W.swatch}`);m&&m.click()}else this.invoke(this.focused);break}case"Escape":u(a),this.hideRoot();break;default:a.key&&a.key.length===1&&this.jumpTo(a.key);break}}jumpTo(a){const o=a.toLowerCase(),m=this.itemNodes.length;for(let $=1;$<=m;$++){const h=(this.focused+$+m)%m,y=this.itemAt(h);if(!y.disabled&&(y.name||"").toLowerCase().startsWith(o)){this.focus(h);return}}}hideRoot(){let a=this;for(;a.parent;)a=a.parent;a.hide()}hideAll(){this.hideRoot()}hide(){this.closeChild();for(const a of this.off)a();this.off.length=0,this.root&&this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.root=null,this.itemNodes=[],this.focused=-1,this.anchor&&Y(this.anchor.setAttribute)&&(this.anchor.setAttribute("aria-expanded","false"),this.anchor.removeAttribute("aria-controls")),this.anchor=null,this.open&&this.returnFocus&&Y(this.returnFocus.focus)&&this.returnFocus.focus({preventScroll:!0}),this.open=!1,Y(this.onClose)&&this.onClose()}destroy(){this.hide(),this.items=[]}}const _=S}),ae("packages/dom/src/ui/contextmenu.js",function(p,V){"use strict";const St=V("packages/modules/contextmenu/menu.js");Object.defineProperty(p,"ContextMenu",{enumerable:!0,get:function(){return St.ContextMenu}}),Object.defineProperty(p,"resolveMenuItems",{enumerable:!0,get:function(){return St.resolveMenuItems}}),Object.defineProperty(p,"default",{enumerable:!0,get:function(){return St.default}})}),ae("packages/modules/gantt/zoom-control.js",function(p,V){"use strict";Object.defineProperty(p,"ZOOM_LEVELS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"zoomControlCss",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"createZoomControl",{enumerable:!0,get:function(){return v}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=Object.freeze(["day","week","month","quarter","fit"]),W=new Set(Y),l=Object.freeze({day:"gantt.zoom.day",week:"gantt.zoom.week",month:"gantt.zoom.month",quarter:"gantt.zoom.quarter",fit:"gantt.zoom.fit"});function L(b){return`
|
|
131
|
+
.${b}__zoom{display:flex;flex:0 0 auto;align-items:center;gap:2px;padding:0 6px;background:var(--lattice-surface);border-left:1px solid var(--lattice-border-color)}
|
|
132
|
+
.${b}__zoom-btn{flex:0 0 auto;height:26px;padding:0 8px;font:inherit;font-size:var(--lattice-font-size);color:var(--lattice-foreground-muted);background:none;border:1px solid transparent;border-radius:var(--lattice-radius);cursor:pointer}
|
|
133
|
+
.${b}__zoom-btn:hover{background:var(--lattice-hovered-background);color:var(--lattice-foreground)}
|
|
134
|
+
.${b}__zoom-btn:focus-visible{outline:2px solid var(--lattice-focus-color);outline-offset:-2px}
|
|
135
|
+
.${b}__zoom-btn[aria-pressed="true"]{background:var(--lattice-selected-background);color:var(--lattice-selected-foreground);font-weight:600}
|
|
136
|
+
`.trim()}function v({doc:b,view:w,t:k,levels:u,ns:g}){const d=U(b,"div",`${g}__zoom`);d.setAttribute("role","group"),d.setAttribute("aria-label",k("gantt.zoom.label"));const S=Array.isArray(u)?u.filter(a=>W.has(a)):[],_=S.length?S:[...Y],C=new Map;for(const a of _){const o=l[a];if(!o)continue;const m=b.createElement("button");m.setAttribute("type","button"),m.setAttribute("class",`${g}__zoom-btn`),m.setAttribute("data-zoom",a),K(m,k(o)),m.addEventListener("click",()=>{a==="fit"?w.fitZoom("control"):w.setZoom(a,"control")}),d.appendChild(m),C.set(a,m)}return{element:d,update(a){for(const[o,m]of C)m.setAttribute("aria-pressed",o===a?"true":"false")}}}}),ae("packages/modules/gantt/change-events.js",function(p,V){"use strict";Object.defineProperty(p,"datesOf",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"buildChanges",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"snapshotPlan",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"createGanttChangeEvents",{enumerable:!0,get:function(){return L}});const St=["start","end","duration"];function U(v,b){if(v===b)return!0;if(v&&b&&typeof v=="object"&&typeof b=="object")try{return JSON.stringify(v)===JSON.stringify(b)}catch{return!1}return!1}function K(v){return v?{start:v.es,end:v.ef,duration:v.duration}:void 0}function Y(v,b,w,k,u){const g={};for(const S of St){const _=w?w[S]:void 0,C=k?k[S]:void 0;_!==C&&(g[S]={from:_,to:C})}const d=new Set([...v?Object.keys(v):[],...b?Object.keys(b):[]]);for(const S of d){if(u.has(S))continue;const _=v?v[S]:void 0,C=b?b[S]:void 0;U(_,C)||(g[S]={from:_,to:C})}return g}function W(v,b){return!v&&!b?!1:!v||!b?!0:v.start!==b.start||v.end!==b.end||v.duration!==b.duration}function l(v){const{tasks:b,dependencies:w,schedule:k,taskId:u,depKey:g}=v,d=new Map;for(const a of b())d.set(u(a),a);const S=new Map;for(const a of w())S.set(g(a),a);const _=new Map,C=k();if(C&&C.ok&&C.tasks)for(const[a,o]of C.tasks)_.set(String(a),o);return{taskMap:d,depMap:S,recMap:_}}function L(v){const{emit:b,schedule:w,taskId:k,depKey:u,dateProps:g,view:d}=v;return{begin:()=>l(v),commit:(a,o)=>{const m=l(v),$=o.event!=null?o.event:null,h=d?d():null,y=f=>o.promoteAll||o.primary&&o.primary.has(f)?o.origin:"pushed",i=[],r=[];for(const[f,M]of m.taskMap){if(a.taskMap.has(f))continue;const D=Y(void 0,M,void 0,K(m.recMap.get(f)),g),I={id:f,rawTask:M,task:m.recMap.get(f)||null,changes:D,cause:y(f),event:$,view:h};b("taskAdd",I),i.push({type:"taskAdd",...I})}for(const[f,M]of a.taskMap){if(m.taskMap.has(f))continue;const D=Y(M,void 0,K(a.recMap.get(f)),void 0,g),I={id:f,rawTask:M,task:a.recMap.get(f)||null,changes:D,cause:y(f),event:$,view:h};b("taskRemove",I),i.push({type:"taskRemove",...I})}for(const[f,M]of m.taskMap){const D=a.taskMap.get(f);if(!D)continue;const I=K(a.recMap.get(f)),O=K(m.recMap.get(f)),B=Y(D,M,I,O,g);if(!Object.keys(B).length)continue;const H=y(f),z={id:f,rawTask:M,task:m.recMap.get(f)||null,changes:B,cause:H,event:$,view:h};if(b("taskUpdate",z),i.push({type:"taskUpdate",...z}),B.assignments){const at={id:f,from:B.assignments.from,to:B.assignments.to,cause:H,event:$,view:h};b("assignmentChange",at),i.push({type:"assignmentChange",...at})}}for(const[f,M]of m.depMap){if(a.depMap.has(f))continue;const D={id:f,dependency:M,cause:o.origin,event:$,view:h};b("dependencyAdd",D),i.push({type:"dependencyAdd",...D})}for(const[f,M]of a.depMap){if(m.depMap.has(f))continue;const D={id:f,dependency:M,cause:o.origin,event:$,view:h};b("dependencyRemove",D),i.push({type:"dependencyRemove",...D})}for(const[f,M]of m.depMap){const D=a.depMap.get(f);if(!D)continue;const I=Y(D,M,void 0,void 0,new Set);if(!Object.keys(I).length)continue;const O={id:f,dependency:M,changes:I,cause:o.origin,event:$,view:h};b("dependencyUpdate",O),i.push({type:"dependencyUpdate",...O})}for(const[f,M]of m.recMap){const D=K(M),I=K(a.recMap.get(f));W(I,D)&&r.push({id:f,start:D.start,end:D.end,duration:D.duration,cause:y(f)})}r.length&&b("datesChanged",{changes:r,cause:o.origin,event:$,view:h}),i.length&&b("change",{changes:i,cause:o.origin,event:$,view:h})},ready:()=>{b("ready",{schedule:w(),view:d()})}}}}),ae("packages/modules/gantt/dirty-tracking.js",function(p,V){"use strict";Object.defineProperty(p,"createGanttDirtyTracking",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"dirtyFieldsByTask",{enumerable:!0,get:function(){return L}});const St=V("packages/modules/gantt/change-events.js"),U=St.snapshotPlan,K=St.buildChanges,Y=St.datesOf;function W(v,b,w,k,u){const g=[],d=[],S=[];for(const[_,C]of b){if(!v.has(_)){g.push(C);continue}const a=K(v.get(_),C,w(_),k(_),u);Object.keys(a).length&&d.push({id:_,fields:a})}for(const[_]of v)b.has(_)||S.push(_);return{added:g,updated:d,removed:S}}function l(v){const{emit:b,dateProps:w}=v;let k=U(v),u=!1;function g(){const a=U(v),o=W(k.taskMap,a.taskMap,h=>Y(k.recMap.get(h)),h=>Y(a.recMap.get(h)),w),m=W(k.depMap,a.depMap,()=>{},()=>{},new Set),$=[];for(const h of o.updated)h.fields.assignments&&$.push({id:h.id,from:h.fields.assignments.from,to:h.fields.assignments.to});return{tasks:o,dependencies:m,assignments:{updated:$}}}function d(a){return a.tasks.added.length>0||a.tasks.updated.length>0||a.tasks.removed.length>0||a.dependencies.added.length>0||a.dependencies.updated.length>0||a.dependencies.removed.length>0||a.assignments.updated.length>0}function S(){const a=d(g());a!==u&&(u=a,b("dirtyChange",{hasChanges:u}))}function _(){k=U(v),S()}function C(a){a||(k=U(v)),S()}return{changes:g,get hasChanges(){return u},commit:_,recheck:S,resetForLoad:C}}function L(v,b){const w=new Map;for(const k of v.tasks.added)w.set(b(k),new Set(Object.keys(k)));for(const k of v.tasks.updated)w.set(k.id,new Set(Object.keys(k.fields)));return w}}),ae("packages/modules/gantt/paste.js",function(p,V){"use strict";Object.defineProperty(p,"CLIP_COLUMNS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"copyRoots",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"subtreeIds",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"buildClip",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"parseClipText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"formatClipText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"createPasteApi",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"createClipboardKeys",{enumerable:!0,get:function(){return u}});const St=V("packages/modules/gantt/time.js"),U=St.toISODate,K=St.toDayNumber,Y=Object.freeze(["name","start","end","duration","percent"]);function W(g){return typeof structuredClone=="function"?structuredClone(g):JSON.parse(JSON.stringify(g))}function l(g,d,S){const _=new Set(d.map(String)),C=new Map(g.map(o=>[String(S.readId(o)),S.parentOf(o)])),a=[];for(const o of g){const m=String(S.readId(o));if(!_.has(m))continue;let $=C.get(m),h=!1;const y=new Set;for(;$!=null&&!y.has($);){if(_.has($)){h=!0;break}y.add($),$=C.get($)??null}h||a.push(m)}return a}function L(g,d,S){const _=new Set(d.map(String));let C=!0;for(;C;){C=!1;for(const a of g){const o=String(S.readId(a)),m=S.parentOf(a);!_.has(o)&&m!=null&&_.has(m)&&(_.add(o),C=!0)}}return g.map(a=>String(S.readId(a))).filter(a=>_.has(a))}function v(g,d,S,_){const C=l(g,S,_);if(!C.length)return null;const a=new Set(L(g,C,_));return{tasks:g.filter(o=>a.has(String(_.readId(o)))).map(W),dependencies:d.filter(o=>a.has(String(o.from))&&a.has(String(o.to))).map(o=>({...o})),rootIds:C}}function b(g){const d=[];return String(g??"").split(/\r?\n/).forEach((_,C)=>{if(!_.trim())return;const a=_.split(" ").map(M=>M.trim()),o=a[0];if(!o||C===0&&a.length>1&&/^name$/i.test(o))return;const m={name:o},$=M=>M&&/^\d{4}-\d{2}-\d{2}$/.test(M)&&K(M)!=null?M:void 0,h=M=>{const D=M?Number(String(M).replace(/%$/,"")):NaN;return Number.isFinite(D)?D:void 0},y=$(a[1]),i=$(a[2]),r=h(a[3]),f=h(a[4]);y&&(m.start=y),i&&(m.end=i),r!==void 0&&r>=0&&(m.duration=r),f!==void 0&&(m.percent=f),d.push(m)}),d}function w(g){return g.map(d=>[String(d.name==null?"":d.name).replace(/[\t\r\n]+/g," "),d.es==null?"":U(d.es)??"",d.ef==null?"":U(d.ef)??"",d.duration==null?"":d.duration,d.percentComplete==null?"":d.percentComplete].join(" ")).join(`
|
|
137
|
+
`)}function k(g){let d=null;const S=()=>g.writeProp("id")||"id",_=()=>g.writeProp("parent")||"parent",C=()=>({readId:g.readId,parentOf:r=>{const f=r[_()];return f==null||f===""?null:String(f)}});function a(r){try{const f=typeof navigator<"u"?navigator:null;if(f&&f.clipboard&&typeof f.clipboard.writeText=="function"){const M=f.clipboard.writeText(r);M&&typeof M.catch=="function"&&M.catch(()=>{})}}catch{}}function o(r){const f=g.getSchedule(),M=r.tasks.map(D=>{const I=String(g.readId(D));return(f&&f.ok?f.tasks.get(I):null)||{name:D[g.writeProp("name")||"name"]}});return w(M)}function m(r){if(g.destroyed())return null;const f=(Array.isArray(r)?r:[r]).filter(O=>O!=null).map(String),M=f.filter(O=>g.has(O));f.length!==M.length&&g.warnOnce("gantt-copy-unknown","[lattice] gantt: copyTasks ignored an unknown task id.");const D=v(g.getTasks(),g.getDeps(),M,C());if(!D)return null;d=D;const I=o(D);return a(I),I}function $(r){if(g.destroyed())return null;const f=(Array.isArray(r)?r:[r]).filter(H=>H!=null).map(String).filter(H=>g.has(H)),M=v(g.getTasks(),g.getDeps(),f,C());if(!M)return null;for(const H of M.rootIds){const z={...g.getTasks().find(dt=>String(g.readId(dt))===H)},at=g.bus.emitBefore("beforeTaskDelete",{id:H,task:z,origin:"user"});if(at!==!0)return at&&typeof at.catch=="function"&&at.catch(()=>{}),null}const D=o(M),I=new Set(L(g.getTasks(),M.rootIds,C())),O=g.planSlice(),B=g.changes.begin();return g.setTasks(g.getTasks().filter(H=>!I.has(String(g.readId(H))))),g.setDeps(g.getDeps().filter(H=>!I.has(String(H.from))&&!I.has(String(H.to)))),d=M,a(D),g.compute(),g.recordHistory("cut","cut",null,O,!1),g.changes.commit(B,{origin:"user",primary:new Set(I)}),g.select(g.selected().filter(H=>!I.has(H)),"api"),D}function h(r,f){let M=1,D=`${r}-copy`;for(;f.has(D);)M+=1,D=`${r}-copy${M}`;return f.add(D),D}function y(r,f){const M=new Set(g.getTasks().map(H=>String(g.readId(H)))),D=C();if(typeof r=="string"&&r.trim()){const H=b(r);if(!H.length)return null;const z=H.map((at,dt)=>{const kt={};return kt[S()]=h(`pasted${dt+1}`,M),kt[g.writeProp("name")||"name"]=at.name,at.start&&(kt[g.writeProp("start")||"start"]=at.start),at.duration!==void 0?kt[g.writeProp("duration")||"duration"]=at.duration:at.end&&(kt[g.writeProp("end")||"end"]=at.end),at.percent!==void 0&&(kt[g.writeProp("percentComplete")||"percentComplete"]=at.percent),f!=null&&(kt[_()]=f),kt});return{tasks:z,dependencies:[],rootIds:z.map(at=>String(g.readId(at)))}}if(!d)return null;const I=new Map;for(const H of d.tasks){const z=String(g.readId(H));I.set(z,h(z,M))}const O=new Set(d.rootIds);return{tasks:d.tasks.map(H=>{const z=String(g.readId(H)),at=W(H);at[S()]=I.get(z);const dt=D.parentOf(H);return O.has(z)?f!=null?at[_()]=f:delete at[_()]:dt!=null&&I.has(dt)&&(at[_()]=I.get(dt)),at}),dependencies:d.dependencies.map(H=>({...H,from:I.get(String(H.from)),to:I.get(String(H.to))})),rootIds:d.rootIds.map(H=>I.get(H))}}function i(r={}){if(g.destroyed())return null;const f=r||{},M=f.childOf!=null?String(f.childOf):null;let D=f.below!=null?String(f.below):null;if(M==null&&D==null){const dt=g.selected();D=dt.length?dt[dt.length-1]:null}const I=M??D;if(I!=null&&!g.has(I))return g.warnOnce(`gantt-paste-unknown-${I}`,`[lattice] gantt: pasteTasks for unknown task "${I}" ignored.`),[];const O=C();let B=null;if(M!=null)B=M;else if(D!=null){const dt=g.getTasks().find(kt=>String(g.readId(kt))===D);B=O.parentOf(dt)}const H=y(f.text,B);if(!H)return null;const z=()=>{const dt=g.planSlice(),kt=g.changes.begin(),Tt=g.getTasks();let Ft=Tt.length;if(I!=null){const P=new Set(L(Tt,[I],O));let j=-1;Tt.forEach((x,R)=>{P.has(String(g.readId(x)))&&(j=R)}),Ft=j+1}return g.setTasks([...Tt.slice(0,Ft),...H.tasks,...Tt.slice(Ft)]),g.setDeps([...g.getDeps(),...H.dependencies]),g.compute(),g.recordHistory("paste","paste",I,dt,!1),g.changes.commit(kt,{origin:"user",primary:new Set(H.rootIds),event:f.event}),g.select(H.rootIds,"api"),H.tasks.map(P=>String(g.readId(P)))},at=g.gateBefore("beforeTaskPaste","taskPaste:cancelled",{tasks:H.tasks.map(W),dependencies:H.dependencies.map(dt=>({...dt})),target:M!=null?{childOf:M}:{below:D},source:typeof f.text=="string"&&f.text.trim()?"text":"tasks",origin:"user"},z,()=>I==null||g.has(I));return at===void 0?[]:at}return{copyTasks:m,cutTasks:$,pasteTasks:i}}function u(g){let d=!1;const S=$=>{if(typeof g.editing=="function"&&g.editing())return!0;const h=$&&$.target,y=h&&h.tagName?String(h.tagName).toLowerCase():"";return y==="input"||y==="textarea"||y==="select"||!!(h&&h.isContentEditable)},_=$=>{const h=g.controller.selected();if(h.length)return h;const y=C($);return y!=null?[String(y)]:[]},C=$=>{const h=$&&$.target,y=h&&typeof h.closest=="function"?h.closest("[data-task]"):null,i=y&&typeof y.getAttribute=="function"?y.getAttribute("data-task"):null;return i??g.focused()},a=($,h)=>{const y=C(h);return y==null?{}:$?{childOf:y}:{below:y}};return{onKey:$=>{if(!$||!($.ctrlKey||$.metaKey)||$.altKey||S($))return;const h=typeof $.key=="string"?$.key.toLowerCase():"";if(h!=="c"&&h!=="x"&&h!=="v")return;if(h==="v"){d=!!$.shiftKey;const r=g.controller.pasteTasks({...a(d,$),event:$});if(r===null)return;$.preventDefault&&$.preventDefault(),d=!1,Array.isArray(r)&&r.length&&g.announce(g.t("gantt.a11y.pasted",{count:r.length}));return}const y=_($);if(!y.length)return;const i=h==="c"?g.controller.copyTasks(y):g.controller.cutTasks(y);i!=null&&($.preventDefault&&$.preventDefault(),g.announce(g.t(h==="c"?"gantt.a11y.copied":"gantt.a11y.cut",{count:i.split(`
|
|
138
|
+
`).length})))},onPaste:$=>{if(!$||S($))return;const h=$.clipboardData,y=h&&typeof h.getData=="function"?h.getData("text/plain"):"";if(!y||!y.trim())return;const i=g.controller.pasteTasks({...a(d,$),text:y,event:$});d=!1,i!==null&&($.preventDefault&&$.preventDefault(),Array.isArray(i)&&i.length&&g.announce(g.t("gantt.a11y.pasted",{count:i.length})))}}}}),ae("packages/modules/gantt/task-actions.js",function(p,V){"use strict";Object.defineProperty(p,"ADD_POSITIONS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"createTaskActions",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"defaultTaskMenu",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"createTaskActionKeys",{enumerable:!0,get:function(){return v}});const U=V("packages/modules/gantt/time.js").toISODate,Y=V("packages/modules/gantt/paste.js").subtreeIds,W=Object.freeze(["above","below","child","successorOf","predecessorOf"]);function l(b){const w=()=>b.writeProp("id")||"id",k=()=>b.writeProp("parent")||"parent",u=()=>({readId:b.readId,parentOf:m=>{const $=m[k()];return $==null||$===""?null:String($)}}),g=m=>b.getTasks().find($=>String(b.readId($))===m),d=m=>!!(m&&(m.event||m.interactive));function S(){const m=new Set(b.getTasks().map(h=>String(b.readId(h))));let $=m.size+1;for(;m.has(`task-${$}`);)$+=1;return`task-${$}`}function _(m){const $=b.getSchedule(),h=m!=null&&$&&$.ok?$.tasks.get(m):null;if(h&&h.es!=null)return U(h.es)||void 0;const y=b.projectStart();if(typeof y=="string")return y;if(typeof y=="number")return U(y)||void 0}function C(m,$){b.bus.emit(m,{...$,reason:"readOnly"})}function a(m,$){if(b.destroyed())return null;const h=$||{},y=W.filter(j=>h[j]!=null);if(y.length>1)return b.warnOnce("gantt-add-target","[lattice] gantt: addTask takes one of above / below / child / successorOf / predecessorOf; the call was ignored."),null;const i=y[0]||null,r=i?String(h[i]):null;if(r!=null&&!b.has(r))return b.warnOnce(`gantt-add-unknown-${r}`,`[lattice] gantt: addTask for unknown task "${r}" ignored.`),null;const f=u(),M=m&&typeof m=="object"?m:{},D=M.id!=null?String(M.id):null;if(D!=null&&b.has(D))return b.warnOnce(`gantt-add-dup-${D}`,`[lattice] gantt: addTask with an existing id "${D}" ignored.`),null;const I=D??S(),O=r!=null?g(r):null,B=i==="child"?r:O?f.parentOf(O):null,H={};for(const[j,x]of Object.entries(M))H[b.writeProp(j)]=x;H[w()]=I;const z=b.writeProp("name")||"name";H[z]==null&&(H[z]=b.t("gantt.task.newName")),["duration","end","milestone"].some(j=>H[b.writeProp(j)]!=null)||(H[b.writeProp("duration")||"duration"]=1);const dt=b.writeProp("start")||"start";if(H[dt]==null&&i!=="successorOf"&&H[b.writeProp("end")||"end"]==null){const j=_(r);j&&(H[dt]=j)}B!=null&&H[k()]==null&&(H[k()]=B);let kt=null;i==="successorOf"?kt={from:r,to:I,type:"FS"}:i==="predecessorOf"&&(kt={from:I,to:r,type:"FS"});const Tt={id:I,task:{...H},target:i?{[i]:r}:{},dependency:kt?{...kt}:null,origin:"user"};if(i&&i!=="above"&&i!=="below"&&d(h)&&b.isReadOnly(r))return C("taskAdd:cancelled",Tt),null;const Ft=()=>{const j=b.planSlice(),x=b.changes.begin(),R=b.getTasks();let N=R.length;if(i==="above"||i==="predecessorOf")N=R.findIndex(X=>String(b.readId(X))===r);else if(i){const X=new Set(Y(R,[r],f));let G=-1;R.forEach((J,Q)=>{X.has(String(b.readId(J)))&&(G=Q)}),N=G+1}return b.setTasks([...R.slice(0,N),{...H},...R.slice(N)]),kt&&b.setDeps([...b.getDeps(),{...kt}]),b.compute(),b.recordHistory("add","add",I,j,!1),b.changes.commit(x,{origin:"user",primary:new Set([I]),event:h.event}),b.select([I],"api"),I},P=b.gateBefore("beforeTaskAdd","taskAdd:cancelled",Tt,Ft,()=>r==null||b.has(r));return P&&typeof P.then=="function"?P.then(j=>j===void 0?null:j):P===void 0?null:P}function o(m,$,h){if(b.destroyed())return b.getSchedule();const y=m!=null?String(m):null;if(y==null||!b.has(y))return b.warnOnce(`gantt-convert-unknown-${y}`,`[lattice] gantt: ${$==="milestone"?"convertToMilestone":"convertToTask"} for unknown task "${y}" ignored.`),b.getSchedule();const i=b.getSchedule(),r=i&&i.ok?i.tasks.get(y):null,f=g(y),M={id:y,task:{...f},to:$,origin:"user"};if(r&&r.isSummary){b.bus.emit("milestoneConvert:cancelled",{...M,reason:"summary"});return}if(r&&!!r.isMilestone==($==="milestone"))return b.getSchedule();if(d(h)&&b.isReadOnly(y))return C("milestoneConvert:cancelled",M);const D=()=>{const I=b.planSlice(),O=b.changes.begin(),B={...g(y)};delete B[b.writeProp("end")||"end"],delete B[b.writeProp("milestone")||"milestone"];const H=h&&Number(h.duration)>0?Number(h.duration):1;B[b.writeProp("duration")||"duration"]=$==="milestone"?0:H,b.setTasks(b.getTasks().map(at=>String(b.readId(at))===y?B:at));const z=b.compute();return b.recordHistory("convert","convert",y,I,!1),b.changes.commit(O,{origin:"user",primary:new Set([y]),event:h&&h.event}),z};return b.gateBefore("beforeMilestoneConvert","milestoneConvert:cancelled",M,D,()=>b.has(y))}return{addTask:a,convertToMilestone:(m,$)=>o(m,"milestone",$),convertToTask:(m,$)=>o(m,"task",$)}}function L(b,w,k){const u=String(b.readId(w)),g=b.schedule,d=g&&g.ok?g.tasks.get(u):null,S=!!b.isTaskReadOnly(u),_=!!(d&&d.isSummary),C=!!(d&&d.isMilestone),a=(o,m,$)=>({name:k(o),shortcut:m==="below"?"Insert":m==="child"?"Shift+Insert":void 0,disabled:!!($&&S),action:()=>{b.addTask({},{[m]:u,interactive:!0})}});return[a("gantt.menu.addAbove","above"),a("gantt.menu.addBelow","below"),a("gantt.menu.addChild","child",!0),a("gantt.menu.addSuccessor","successorOf",!0),a("gantt.menu.addPredecessor","predecessorOf",!0),{separator:!0},{name:k(C?"gantt.menu.toTask":"gantt.menu.toMilestone"),disabled:S||_,action:()=>{C?b.convertToTask(u,{interactive:!0}):b.convertToMilestone(u,{interactive:!0})}},{separator:!0},{name:k("gantt.menu.delete"),shortcut:"Delete",disabled:S||_,action:()=>{b.deleteTask(u,{interactive:!0})}}]}function v(b){return{onKey:k=>{if(!k||k.ctrlKey||k.metaKey||k.altKey||k.defaultPrevented||k.key!=="Insert"&&k.key!=="Delete"||typeof b.editing=="function"&&b.editing())return;const u=k.target,g=u&&u.tagName?String(u.tagName).toLowerCase():"";if(g==="input"||g==="textarea"||g==="select"||u&&u.isContentEditable)return;const d=u&&typeof u.closest=="function"?u.closest("[data-task]"):null,S=d&&typeof d.getAttribute=="function"?d.getAttribute("data-task"):b.focused();if(S==null)return;const _=b.controller;if(k.key==="Delete"){if(!u||typeof u.closest!="function"||!u.closest(".lat-gantt-split__row"))return;const o=_.schedule,m=o&&o.ok?o.tasks.get(String(S)):null;if(!m||m.isSummary)return;k.preventDefault&&k.preventDefault(),_.deleteTask(S,{event:k});return}k.preventDefault&&k.preventDefault();const C=_.addTask({},k.shiftKey?{child:S,event:k}:{below:S,event:k}),a=o=>{o!=null&&(b.focusTask(o),b.announce(b.t("gantt.a11y.taskAdded",{name:b.t("gantt.task.newName")})))};C&&typeof C.then=="function"?C.then(a):a(C)}}}}),ae("packages/modules/gantt/table-defaults.js",function(p,V){"use strict";Object.defineProperty(p,"resolveTableConfig",{enumerable:!0,get:function(){return U}});const St=K=>K!=null&&typeof K=="object"&&!Array.isArray(K);function U(K,Y,W,l){const{band:L,...v}=K||{},b=Y==="band"&&St(L)?{...v,...L}:v,w=b.selection,k=typeof w=="string"?{mode:w}:St(w)?w:{};return{...W,...b,selection:{...l?{mode:l}:{},ranges:!1,fillHandle:!1,...k}}}}),ae("packages/modules/gantt/split-header-fit.js",function(p,V){"use strict";Object.defineProperty(p,"fitHeaderToTable",{enumerable:!0,get:function(){return St}});function St(U,K,Y){const W=()=>{if(!K||!U)return;const b=U.querySelector(".lat-header"),w=b?Math.ceil(b.offsetHeight||0):0;K.style.height=`${Math.max(Number(Y)||0,w)}px`},l=U&&U.ownerDocument&&U.ownerDocument.defaultView,L=l&&l.ResizeObserver;let v=null;if(typeof L=="function"&&U){v=new L(()=>W());const b=U.querySelector(".lat-header");b?v.observe(b):v.observe(U)}return{apply:W,dispose:()=>{v&&v.disconnect(),v=null}}}}),ae("packages/modules/shared/pinch-gesture.js",function(p,V){"use strict";Object.defineProperty(p,"attachPinchGesture",{enumerable:!0,get:function(){return U}});const St=48;function U(K,Y){const W=Y||{},l=Number.isFinite(W.minSpread)&&W.minSpread>0?W.minSpread:St;if(!K||typeof K.addEventListener!="function")return()=>{};const L=new Map;let v=null;const b=()=>{const[C,a]=[...L.values()];return{spread:Math.hypot(C.x-a.x,C.y-a.y),cx:(C.x+a.x)/2,cy:(C.y+a.y)/2}},w=()=>{v&&(K.style.touchAction=v.prevTouchAction,v=null)},k=C=>{if(C.pointerType==="touch"&&!(typeof W.enabled=="function"&&!W.enabled())&&((L.has(C.pointerId)||L.size>=2)&&(L.clear(),w()),L.set(C.pointerId,{x:C.clientX,y:C.clientY}),L.size===2&&!v)){const a=b();v={spread:a.spread,cx:a.cx,cy:a.cy,prevTouchAction:K.style.touchAction||""},K.style.touchAction="none"}},u=C=>{const a=L.get(C.pointerId);if(!a||(a.x=C.clientX,a.y=C.clientY,!v||L.size<2))return;const o=b(),m=K.getBoundingClientRect(),$={x:o.cx-m.left,y:o.cy-m.top};let h=!1;for(;o.spread-v.spread>=l;)v.spread+=l,h=!0,typeof W.onStep=="function"&&W.onStep("in",$);for(;v.spread-o.spread>=l;)v.spread-=l,h=!0,typeof W.onStep=="function"&&W.onStep("out",$);const y=o.cx-v.cx,i=o.cy-v.cy;v.cx=o.cx,v.cy=o.cy,!h&&(typeof W.onPan=="function"?W.onPan(y,i):(K.scrollLeft-=y,K.scrollTop-=i))},g=C=>{C.type==="pointercancel"?L.clear():L.delete(C.pointerId),L.size<2&&w()},d=C=>{(!C.touches||C.touches.length<2)&&(L.clear(),w())},S=C=>{(v&&C.type==="touchmove"||C.touches&&C.touches.length>=2)&&C.cancelable&&C.preventDefault()},_=K.ownerDocument||K;return K.addEventListener("pointerdown",k),_.addEventListener("pointermove",u),_.addEventListener("pointerup",g),_.addEventListener("pointercancel",g),_.addEventListener("touchend",d),_.addEventListener("touchcancel",d),K.addEventListener("touchstart",S,{passive:!1}),K.addEventListener("touchmove",S,{passive:!1}),()=>{w(),L.clear(),K.removeEventListener("pointerdown",k),_.removeEventListener("pointermove",u),_.removeEventListener("pointerup",g),_.removeEventListener("pointercancel",g),_.removeEventListener("touchend",d),_.removeEventListener("touchcancel",d),K.removeEventListener("touchstart",S),K.removeEventListener("touchmove",S)}}}),ae("packages/modules/gantt/pinch.js",function(p,V){"use strict";Object.defineProperty(p,"GANTT_PINCH_LEVELS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"attachGanttPinch",{enumerable:!0,get:function(){return l}});const U=V("packages/modules/shared/pinch-gesture.js").attachPinchGesture,Y=V("packages/modules/gantt/zoom.js").resolveZoomPreset,W=Object.freeze(["quarter","month","week","day"]);function l(L){const v=L.pane;return U(v,{enabled:L.enabled,minSpread:48,onStep(b,w){const k=L.model();if(!k||!(k.pxPerDay>0))return;const u=L.zoom(),g=typeof u=="string"&&W.includes(u)?u:Y(Number.isFinite(u)?u:k.pxPerDay).level,d=Math.max(0,W.indexOf(g==="hour"?"day":g)),S=W[d+(b==="in"?1:-1)];if(!S)return;const _=k.domainMin+(v.scrollLeft+w.x)/k.pxPerDay;L.setZoom(S,"gesture");const C=L.model();!C||!(C.pxPerDay>0)||L.scrollTo(Math.max(0,Math.round((_-C.domainMin)*C.pxPerDay-w.x)))}})}}),ae("packages/modules/gantt/data-band.js",function(p,V){"use strict";Object.defineProperty(p,"DATA_BAND_DEFAULTS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"normalizeDataBands",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"aggregateValues",{enumerable:!0,get:function(){return i}}),Object.defineProperty(p,"seriesPoints",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"spreadSpans",{enumerable:!0,get:function(){return M}}),Object.defineProperty(p,"bucketSeries",{enumerable:!0,get:function(){return D}}),Object.defineProperty(p,"reshapeSeries",{enumerable:!0,get:function(){return I}}),Object.defineProperty(p,"writeBucket",{enumerable:!0,get:function(){return O}}),Object.defineProperty(p,"computeDataBand",{enumerable:!0,get:function(){return B}}),Object.defineProperty(p,"formatBandValue",{enumerable:!0,get:function(){return H}}),Object.defineProperty(p,"bandGridFormat",{enumerable:!0,get:function(){return z}}),Object.defineProperty(p,"cellLook",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"dataBandCss",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(p,"DataBand",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(p,"DataBands",{enumerable:!0,get:function(){return P}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=V("packages/modules/gantt/time.js"),W=Y.toDayNumber,l=Y.toISODate,v=V("packages/modules/gantt/resources.js").parseAssignments,w=V("packages/modules/gantt/split-grid.js").resolveTableColumns,k=V("packages/modules/gantt/band-grid.js"),u=k.bucketColumnSpec,g=k.bucketColumnWidths,d=k.pinStart,S=k.mountBandGrid,_=Object.freeze({title:null,rows:"tasks",value:null,series:null,interpolate:"none",aggregate:"sum",format:"number",currency:"USD",decimals:null,totals:!0,height:160,rowHeight:26,columns:null,thresholds:null,cellStyle:null,editable:!1,onReschedule:"shift",collapsed:!1}),C=new Set(["tasks","summaries","resources"]),a=new Set(["sum","avg","last","min","max"]),o=new Set(["shift","stretch","keep"]),m=new Set(["ok","info","warn","danger"]),$=1e6,h=j=>Math.round(j*$)/$;function y(j){if(!Array.isArray(j))return[];const x=new Set,R=[];return j.forEach((N,X)=>{if(!N||typeof N!="object")return;const G={..._,...N};let J=N.id!=null&&String(N.id)!==""?String(N.id):`band${X+1}`;for(;x.has(J);)J=`${J}_${X+1}`;x.add(J),G.id=J,G.rows=typeof N.rows=="function"||C.has(N.rows)?N.rows:"tasks",G.value=typeof N.value=="function"?N.value:null,G.series=typeof N.series=="string"&&N.series?N.series:null,G.interpolate=N.interpolate==="spread"?"spread":"none",G.aggregate=typeof N.aggregate=="function"||a.has(N.aggregate)?N.aggregate:"sum";const Q=N.totals;G.totals=Q===!1?{row:!1,column:!1}:Q&&typeof Q=="object"?{row:Q.row!==!1,column:Q.column!==!1}:{row:!0,column:!0},G.rowHeight=Math.max(16,Number(G.rowHeight)||_.rowHeight),G.height=Math.max(G.rowHeight*2,Number(G.height)||_.height),G.thresholds=Array.isArray(N.thresholds)?N.thresholds.filter(pt=>pt&&Number.isFinite(Number(pt.at))).map(pt=>({...pt,at:Number(pt.at)})).sort((pt,st)=>pt.at-st.at):null,G.cellStyle=typeof N.cellStyle=="function"?N.cellStyle:null,G.editable=!!N.editable&&G.series!=null,G.onReschedule=o.has(N.onReschedule)?N.onReschedule:"shift",G.collapsed=!!N.collapsed,R.push(G)}),R}function i(j,x,R={}){const N=(j||[]).filter(X=>X!=null&&Number.isFinite(Number(X))).map(Number);if(!N.length)return null;if(typeof x=="function"){const X=x(N,R);return X==null||!Number.isFinite(Number(X))?null:Number(X)}return x==="avg"?h(N.reduce((X,G)=>X+G,0)/N.length):x==="last"?N[N.length-1]:x==="min"?Math.min(...N):x==="max"?Math.max(...N):h(N.reduce((X,G)=>X+G,0))}function r(j){if(!Array.isArray(j))return[];const x=[];for(const R of j){if(!R||typeof R!="object")continue;const N=W(R.date),X=Number(R.value);if(N==null||R.value==null||!Number.isFinite(X))continue;const G=R.end!=null?W(R.end):null;x.push({day:N,end:G!=null&&G>N?G:null,value:X})}return x.sort((R,N)=>R.day-N.day)}function f(j,x){const R=x>=28&&x<=31?1:x>=89&&x<=92?3:x===365||x===366?12:0;if(!R)return j+Math.max(1,x);const N=new Date(j*864e5);return Math.round(Date.UTC(N.getUTCFullYear(),N.getUTCMonth()+R,N.getUTCDate())/864e5)}function M(j){const x=[];for(let R=0;R<j.length;R+=1){const N=j[R];let X=N.end;X==null&&R+1<j.length&&(X=j[R+1].day),X==null&&(X=R>0?f(N.day,N.day-j[R-1].day):N.day+1),X<=N.day&&(X=N.day+1),x.push({from:N.day,to:X,value:N.value})}return x}function D(j,x,R="none",N="sum"){const X=r(j);if(!X.length)return x.map(()=>null);if(R==="spread"){const G=M(X);return x.map(J=>{let Q=0,pt=!1;for(const st of G){const ht=Math.max(st.from,J.start),Ot=Math.min(st.to,J.end);Ot<=ht||(pt=!0,Q+=st.value*(Ot-ht)/(st.to-st.from))}return pt?h(Q):null})}return x.map(G=>i(X.filter(J=>J.day>=G.start&&J.day<G.end).map(J=>J.value),N))}function I(j,x,R,N){if(!Array.isArray(j)||N==="keep"||!x||!R||x.start===R.start&&x.end===R.end)return null;const X=Math.max(1,x.end-x.start),G=Math.max(1,R.end-R.start),J=Q=>{const pt=W(Q);if(pt==null)return null;const st=N==="stretch"?R.start+Math.round((pt-x.start)*G/X):pt+(R.start-x.start);return l(st)};return N==="shift"&&x.start===R.start?null:j.map(Q=>{if(!Q||typeof Q!="object")return Q;const pt={...Q},st=J(Q.date);if(st!=null&&(pt.date=st),Q.end!=null){const ht=J(Q.end);ht!=null&&(pt.end=ht)}return pt})}function O(j,x,R,N){const X=(Array.isArray(j)?j:[]).filter(G=>{const J=G&&typeof G=="object"?W(G.date):null;return J==null||J<x||J>=R});return N!=null&&X.push({date:l(x),end:l(R),value:N}),X.sort((G,J)=>(W(G&&G.date)??0)-(W(J&&J.date)??0))}function B(j,x){const{rows:R,allRows:N,rawById:X,buckets:G}=x,J=j.value&&typeof x.costByTask=="function"?x.costByTask():null,Q=new Map,pt=[],st=new Map;for(const nt of N){const ot=nt.rec.parent==null?null:String(nt.rec.parent);ot!=null&&(st.has(ot)||st.set(ot,[]),st.get(ot).push(nt.id))}const ht=nt=>{const ot=X.get(nt.id)||{};return j.series?D(ot[j.series],G,j.interpolate,j.aggregate):j.value?G.map((vt,gt)=>{const Ht=l(vt.start),Pt=l(vt.end),et={band:j.id,id:nt.id,task:ot,rec:nt.rec,start:vt.start,end:vt.end,zoom:x.zoom||null};J&&(et.cost=q=>{const jt=q!=null?J.get(String(q)):null,Et=jt?jt[gt]:null;return Et==null||Et===0?null:Et});let ft=null;try{ft=j.value(ot,Ht,Pt,et)}catch{ft=null}return ft==null||!Number.isFinite(Number(ft))?null:Number(ft)}):G.map(()=>null)};for(let nt=N.length-1;nt>=0;nt-=1){const ot=N[nt],vt=st.get(ot.id)||[];if(!vt.length){Q.set(ot.id,ht(ot));const Ht=X.get(ot.id);Ht&&Ht.inactive===!0||pt.push(ot.id);continue}const gt=vt.filter(Ht=>(X.get(Ht)||{}).inactive!==!0);Q.set(ot.id,G.map((Ht,Pt)=>i(gt.map(et=>(Q.get(et)||[])[Pt]),j.aggregate,{band:j.id,bucket:Pt,id:ot.id})))}pt.reverse();const Ot=nt=>j.totals.column?i(nt,j.aggregate,{band:j.id,total:"column"}):null,wt=nt=>G.map((ot,vt)=>i(nt.map(gt=>(Q.get(gt)||[])[vt]),j.aggregate,{band:j.id,bucket:vt})),Jt=[];if(j.rows==="tasks"||j.rows==="summaries")for(const nt of R){if(j.rows==="summaries"&&!nt.hasChildren)continue;const ot=Q.get(nt.id)||G.map(()=>null);Jt.push({key:nt.id,taskId:nt.id,label:String(nt.rec.name??nt.id),depth:nt.depth,isSummary:!!nt.hasChildren,cells:ot,total:Ot(ot)})}else{let nt;if(j.rows==="resources"){const ot=new Map,vt=[];for(const gt of pt){const Ht=v(X.get(gt)||{}).map(Pt=>Pt.resource);Ht.length||vt.push(gt);for(const Pt of Ht)ot.has(Pt)||ot.set(Pt,[]),ot.get(Pt).push(gt)}nt=[...ot].map(([gt,Ht])=>({key:`res:${gt}`,label:gt,tasks:Ht})),vt.length&&nt.push({key:"res:",label:x.t("gantt.dataBand.unassigned"),tasks:vt})}else{let ot=null;try{ot=j.rows([...X.values()],{band:j.id})}catch{ot=null}nt=(Array.isArray(ot)?ot:[]).filter(vt=>vt&&vt.key!=null).map(vt=>({key:`grp:${vt.key}`,label:String(vt.label??vt.key),tasks:(Array.isArray(vt.tasks)?vt.tasks:[]).map(String)}))}for(const ot of nt){const vt=wt(ot.tasks);Jt.push({key:ot.key,taskId:null,label:ot.label,depth:0,isSummary:!1,cells:vt,total:Ot(vt)})}}let lt=null;if(j.totals.row){const nt=wt(pt);lt={key:"__total__",taskId:null,label:x.t("gantt.dataBand.total"),depth:0,isSummary:!1,isTotal:!0,cells:nt,total:Ot(nt)}}return{rows:Jt,total:lt,byTask:Q}}function H(j,x,R,N={}){if(j==null)return"";const X=x.format;if(typeof X=="function")try{const pt=X(j,N);return pt==null?"":String(pt)}catch{return String(j)}const G=X&&typeof X=="object"?X:{type:X},J=Number.isFinite(Number(G.decimals??x.decimals))?Number(G.decimals??x.decimals):null,Q={};G.type==="currency"?(Q.style="currency",Q.currency=String(G.currency||x.currency||"USD"),Q.minimumFractionDigits=J??0,Q.maximumFractionDigits=J??0):G.type==="percent"?(Q.style="percent",Q.maximumFractionDigits=J??0):Q.maximumFractionDigits=J??2;try{return new Intl.NumberFormat(R||void 0,Q).format(j)}catch{return String(j)}}function z(j){const x=j.format;if(typeof x=="function")return null;const R=x&&typeof x=="object"?x:{type:x},N=Number.isFinite(Number(R.decimals??j.decimals))?Number(R.decimals??j.decimals):null;return R.type==="currency"?{type:"number",style:"currency",currency:String(R.currency||j.currency||"USD"),decimals:N??0}:R.type==="percent"?{type:"number",style:"percent",decimals:N??0}:{type:"number",decimals:N??2}}function at(j,x,R){const N=[],X={};let G=null;if(j.thresholds&&x!=null){let J=null;for(const Q of j.thresholds)x>=Q.at&&(J=Q);J&&(m.has(J.tone)&&(G=J.tone),typeof J.className=="string"&&N.push(J.className),typeof J.colour=="string"&&(X.backgroundColor=J.colour))}if(j.cellStyle){let J=null;try{J=j.cellStyle(x,R)}catch{J=null}if(typeof J=="string"&&J)N.push(J);else if(J&&typeof J=="object")for(const[Q,pt]of Object.entries(J))Q==="className"?typeof pt=="string"&&pt&&N.push(pt):(typeof pt=="string"||typeof pt=="number")&&(X[Q]=String(pt))}return{tone:G,classes:N,style:X}}function dt(j){return`
|
|
139
|
+
.${j}__db{position:relative;display:flex;flex-direction:column;border-top:1px solid var(--lattice-border-strong);background:var(--lattice-background)}
|
|
140
|
+
.${j}__db-head{display:flex;flex:0 0 auto;align-items:center;gap:4px;padding:0 6px;overflow:hidden;background:var(--lattice-surface);border-bottom:1px solid var(--lattice-border-color);font-weight:600;color:var(--lattice-foreground)}
|
|
141
|
+
.${j}__db-body{display:flex;flex:1 1 auto;min-height:0;overflow:hidden}
|
|
142
|
+
.${j}__db--collapsed{flex-basis:auto!important}
|
|
143
|
+
.${j}__db--collapsed>.${j}__db-body{display:none}
|
|
144
|
+
.${j}__lgrid--databand{position:relative;flex:1 1 auto;min-height:0;width:100%;background:var(--lattice-background)}
|
|
145
|
+
.${j}__lgrid--databand .lat-body-left-pinned{border-inline-end:1px solid var(--lattice-border-strong)}
|
|
146
|
+
.${j}__db-label{display:flex;align-items:center;gap:2px;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
147
|
+
.${j}__lgrid--databand .lat-row--db-total,.${j}__lgrid--databand .lat-row--db-summary{font-weight:600}
|
|
148
|
+
.${j}__lgrid--databand .lat-row--db-total{background:var(--lattice-surface)}
|
|
149
|
+
.${j}__db-bucket{font-variant-numeric:tabular-nums}
|
|
150
|
+
.${j}__lgrid--databand .lat-body-centre .${j}__db-bucket--editable{cursor:text}
|
|
151
|
+
.${j}__lgrid--databand .lat-body-centre .${j}__db-bucket--ok{background:var(--lattice-variant-success-fill);color:var(--lattice-variant-success-text)}
|
|
152
|
+
.${j}__lgrid--databand .lat-body-centre .${j}__db-bucket--info{background:var(--lattice-variant-info-fill);color:var(--lattice-variant-info-text)}
|
|
153
|
+
.${j}__lgrid--databand .lat-body-centre .${j}__db-bucket--warn{background:var(--lattice-variant-warning-fill);color:var(--lattice-variant-warning-text)}
|
|
154
|
+
.${j}__lgrid--databand .lat-body-centre .${j}__db-bucket--danger{background:var(--lattice-variant-danger-fill);color:var(--lattice-variant-danger-text)}
|
|
155
|
+
.${j}__db-toggle{flex:0 0 auto;width:var(--lattice-toggle-size);height:var(--lattice-toggle-size);line-height:var(--lattice-toggle-size);text-align:center;cursor:pointer;color:var(--lattice-foreground-muted);border:0;background:none;padding:0;font-size:var(--lattice-font-size-lg);border-radius:var(--lattice-radius)}
|
|
156
|
+
.${j}__db-toggle:hover{background:var(--lattice-hovered-background);color:var(--lattice-foreground)}
|
|
157
|
+
.${j}__db-toggle:focus-visible{outline:2px solid var(--lattice-focus-color);outline-offset:-2px}
|
|
158
|
+
.${j}__db-toggle::before{content:"\\25B8"}
|
|
159
|
+
.${j}__db-toggle[aria-expanded="true"]::before{content:"\\25BE"}
|
|
160
|
+
`}const kt="data-lat-gantt-databand-styles";function Tt(j,x){const R=j&&j.documentElement;if(!R||R.getAttribute(kt))return;R.setAttribute(kt,"1");const N=j.createElement("style");N.textContent=dt(x).trim(),(j.head||j.body||R).appendChild(N)}class Ft{cfg;root=null;time=null;#t=null;grid=null;last=null;#i;#e=null;#n=null;#s=null;#o=null;#l=null;#h=[];#f=null;#p=new Map;#g=new Set;#a=!1;#d=null;constructor(x,R){this.#i=x,this.cfg=R}get collapsed(){return!!this.cfg.collapsed}build(x){const R=this.#i,N=R.ns,X=this.cfg,G=R.doc;this.root=U(G,"div",`${N}__db`),this.root.setAttribute("data-band",X.id),this.root.setAttribute("role","table"),this.root.setAttribute("aria-label",this.#c()),this.root.style.flex=`0 0 ${X.height}px`,this.#e=U(G,"div",`${N}__db-head`),this.#e.style.height=`${X.rowHeight}px`;const J=G.createElement("button");J.setAttribute("type","button"),J.setAttribute("class",`${N}__db-toggle`),J.addEventListener("click",()=>this.setCollapsed(!this.cfg.collapsed)),this.#o=J,this.#e.appendChild(J);const Q=U(G,"span",`${N}__db-title`);K(Q,this.#c()),this.#e.appendChild(Q),this.root.appendChild(this.#e),this.#n=U(G,"div",`${N}__db-body`),this.#s=U(G,"div",`${N}__lgrid ${N}__lgrid--databand`),this.#n.appendChild(this.#s),this.root.appendChild(this.#n),x.appendChild(this.root),this.#r()}#c(){return this.cfg.title!=null&&this.cfg.title!==""?String(this.cfg.title):this.#i.t("gantt.dataBand.title")}#y=()=>{this.#a||this.#i.syncScroll(this.time)};setCollapsed(x){const R=!!this.cfg.collapsed;this.cfg.collapsed=!!x,this.#r(),R!==this.cfg.collapsed&&this.root&&this.#i.redraw()}#r(){if(!this.root)return;const x=this.#i.ns;this.root.classList.toggle(`${x}__db--collapsed`,!!this.cfg.collapsed),this.root.style.flex=this.cfg.collapsed?"0 0 auto":`0 0 ${this.cfg.height}px`,this.#o&&(this.#o.setAttribute("aria-expanded",this.cfg.collapsed?"false":"true"),this.#o.setAttribute("aria-label",this.#i.t(this.cfg.collapsed?"gantt.dataBand.expand":"gantt.dataBand.collapse",{name:this.#c()})))}#m(x){const R=this.#i,N=this.cfg,X=new Map;X.set("name",{id:"name",field:"name",title:R.t(N.rows==="resources"?"gantt.dataBand.resource":"gantt.dataBand.name"),layout:{min:60},edit:{enabled:!1},cell:{render:Q=>this.#E(Q&&Q.row&&Q.row.data||{})}}),N.totals.column&&X.set("total",{id:"total",field:"total",title:R.t("gantt.dataBand.total"),type:"number",format:z(N),layout:{min:60},edit:{enabled:!1},cell:{align:"right"}}),this.#h=[];const G=Array.isArray(N.columns)?N.columns.map(Q=>{if(!Q||typeof Q!="object"||typeof Q.value!="function"&&typeof Q.render!="function")return Q;const{value:pt,render:st,align:ht,...Ot}=Q,wt=String(Ot.id??Ot.key);this.#h.push({id:wt,value:typeof pt=="function"?pt:null});const Jt={...Ot.cell&&typeof Ot.cell=="object"?Ot.cell:{},...ht!=null?{align:ht}:{}};return typeof st=="function"&&(Jt.render=lt=>{const nt=lt&<.row&<.row.data||{};let ot=null;try{ot=st(nt.__row?nt.__row.src:null,nt.__row?nt.__row.ctx:{})}catch{ot=null}return ot==null?"":typeof ot=="object"?ot:String(ot)}),{...Ot,id:wt,field:wt,cell:Jt}}):null,J=w(G,X,N.totals.column?["name","total"]:["name"],"name");return this.#w(J,x),J}#w(x,R){d(x,R,"name",{minFill:60,floor:40,defaultWidth:N=>N.id==="total"?Math.max(70,Math.round(R*.2)):110})}#E(x){const R=this.#i,N=R.ns,X=U(R.doc,"span",`${N}__db-label`);if(X.style.paddingLeft=`${(x.__depth||0)*R.indent()}px`,x.__toggle){const J=R.doc.createElement("button");J.setAttribute("type","button"),J.setAttribute("class",`${N}__db-toggle`),J.setAttribute("aria-expanded",x.__toggle.expanded?"true":"false"),J.setAttribute("aria-label",R.t(x.__toggle.expanded?"gantt.dataBand.collapse":"gantt.dataBand.expand",{name:x.name})),J.addEventListener("click",Q=>{Q.stopPropagation&&Q.stopPropagation(),R.toggleTask(x.__taskId,Q)}),X.appendChild(J)}const G=U(R.doc,"span",`${N}__db-name-text`);return K(G,String(x.name??"")),G.setAttribute("title",String(x.name??"")),X.appendChild(G),X}#P(x,R,N){const X=this.#i.ns,G=l(x.start);return u({id:G,width:R,format:z(this.cfg),cell:{align:"right",class:J=>{const Q=J&&J.row&&J.row.data||{},pt=[`${X}__db-bucket`],st=this.#k(Q,x,J.value);st.tone&&pt.push(`${X}__db-bucket--${st.tone}`);for(const ht of st.classes)pt.push(ht);return N&&this.#g.has(String(Q.__taskId))&&pt.push(`${X}__db-bucket--editable`),pt},style:J=>this.#k(J&&J.row&&J.row.data||{},x,J.value).style},edit:N?{enabled:J=>this.#g.has(String((J&&J.row&&J.row.data||{}).__taskId)),editor:"number"}:null})}#k(x,R,N){const X=this.cfg;return at(X,N??null,{band:X.id,row:x.__key,task:x.__taskId!=null&&x.__row?x.__row.src:null,bucketStart:l(R.start),bucketEnd:l(R.end),isTotal:!!x.__isTotal,isSummary:!!x.__toggle})}#M(x){const R=this.#i,N=R.ns;this.grid&&(this.grid.destroy(),this.grid=null),this.#d&&(this.#d(),this.#d=null);const X=R.gridConfig(),G=X.rowClass,J=S({createGrid:R.createGrid(),host:this.#s,config:X,columns:x,headerHeight:this.cfg.rowHeight,rowHeight:()=>this.cfg.rowHeight,rowClass:Q=>{const pt=typeof G=="function"?G(Q):G||[],st=Array.isArray(pt)?pt.slice():[pt],ht=Q&&Q.data||{};return ht.__isTotal?st.push(`${N}__db-timerow`,`${N}__db-row--total`,"lat-row--db-total"):ht.__toggle?st.push(`${N}__db-timerow`,`${N}__db-row--summary`,"lat-row--db-summary"):st.push(`${N}__db-timerow`),st.filter(Boolean)},centreClass:`${N}__db-time`,onScroll:this.#y});this.grid=J.grid,this.time=J.time,this.#t=J.centre,this.#d=J.offScroll,this.grid&&(this.grid.on&&(this.grid.on("beforeEdit",this.#x),this.grid.on("cell:dblclicked",Q=>{Q&&Q.colId!=null&&this.#p.has(String(Q.colId))&&this.grid.edit&&typeof this.grid.edit.start=="function"&&this.grid.edit.start(Q.key,Q.colId)}),this.grid.on("sort:changed",()=>{this.#a||R.redraw()}),this.grid.on("filter:changed",()=>{this.#a||R.redraw()}),this.grid.on("column:resized",Q=>{Q&&Q.colId!=null&&R.emitResize(`dataBand:${this.cfg.id}:${Q.colId}`,Q.width)})),this.#l&&this.grid.state&&(this.grid.state.apply(this.#l),this.#l=null))}render(x){if(!this.root||!this.#i.createGrid())return;const R=this.#i,N=this.cfg,X=R.locale(),G=B(N,{...x,t:R.t}),J=R.gridWidth(),Q=G.rows.map(lt=>({...lt}));G.total&&Q.push(G.total);const pt=N.editable&&R.editable();this.#g=new Set,this.#p=new Map;for(const lt of x.buckets)this.#p.set(l(lt.start),{start:lt.start,end:lt.end});for(const lt of Q){lt.texts=lt.cells.map((ot,vt)=>H(ot,N,X,{band:N.id,row:lt.key,bucket:vt})),lt.totalText=N.totals.column?H(lt.total,N,X,{band:N.id,row:lt.key,total:!0}):"",lt.toggle=lt.isSummary&&N.rows==="tasks"?{expanded:!x.collapsedIds.has(lt.taskId)}:null;const nt=lt.taskId!=null&&x.rawById.get(lt.taskId)||null;lt.src=nt||{key:lt.key,label:lt.label,cells:lt.cells,total:lt.total},lt.ctx={band:N.id,cells:lt.cells,total:lt.total,isSummary:lt.isSummary,isTotal:!!lt.isTotal,buckets:x.buckets},pt&<.taskId!=null&&!lt.isSummary&&!lt.isTotal&&this.#g.add(String(lt.taskId))}const st=`${x.zoom}|${J}|${x.buckets.length}|${x.buckets.length?x.buckets[0].start:0}|${x.buckets.length?x.buckets[x.buckets.length-1].start:0}|${pt}`;if(!this.grid||st!==this.#f){const lt=this.#m(J),nt=g(x.buckets,x.x),ot=x.buckets.map((vt,gt)=>this.#P(vt,nt[gt],pt));this.#M([...lt,...ot]),this.#f=st}if(!this.grid)return;const ht=Q.map(lt=>{const nt={__key:lt.key,__taskId:lt.taskId,__depth:lt.depth,__toggle:lt.toggle,__isTotal:!!lt.isTotal,__row:{src:lt.src,ctx:lt.ctx},name:lt.label,total:lt.total};for(const ot of this.#h){let vt=null;if(ot.value&&!lt.isTotal)try{vt=ot.value(lt.src,lt.ctx)}catch{vt=null}nt[ot.id]=vt===void 0?null:vt}return lt.cells.forEach((ot,vt)=>{nt[l(x.buckets[vt].start)]=ot}),nt});this.#a=!0;try{this.grid.rows.load(ht)}finally{this.#a=!1}const Ot=new Map(Q.map(lt=>[lt.key,lt])),wt=this.#D().map(lt=>Ot.get(lt)).filter(Boolean),Jt=wt.length?[...wt.filter(lt=>!lt.isTotal),...wt.filter(lt=>lt.isTotal)]:Q;this.time&&(this.#a=!0,this.time.scrollLeft=R.timeScrollLeft(),this.#a=!1),this.last={buckets:x.buckets,rows:Jt,byTask:G.byTask,grid:this.#j(Jt)}}#D(){const x=[];return!this.grid||!this.grid.rows||typeof this.grid.rows.forEach!="function"||this.grid.rows.forEach(R=>{R&&!R.group&&R.key!=null&&x.push(String(R.key))}),x}#j(x){const R=this.grid;if(!R||!R.columns||typeof R.columns.visible!="function")return null;const N=R.columns.visible().filter(X=>X.id!=="__keep"&&!this.#p.has(String(X.id)));return{columns:N.map(X=>({id:String(X.id),title:String(X.title??X.id)})),rows:x.map(X=>N.map(G=>{if(G.id==="name")return X.label;if(G.id==="total")return X.totalText;try{return String(R.rows.text(X.key,G.id)??"")}catch{return""}}))}}#x=x=>{const N=(x&&Array.isArray(x.changes)?x.changes:[]).find(G=>G&&this.#p.has(String(G.colId)));if(!N)return;x.preventDefault&&x.preventDefault();const X=x.row&&x.row.key!=null?String(x.row.key):x.key!=null?String(x.key):null;X!=null&&this.commitEdit(X,String(N.colId),N.newValue,x&&x.event?x.event:null)};commitEdit(x,R,N,X=null){const G=this.#i,J=this.cfg,Q=this.#p.get(String(R))||null,pt=G.rawTask(x);if(!Q||!pt||!J.series){G.redraw();return}const st=N==null?"":String(N).trim(),ht=st===""?null:Number(st);if(ht!=null&&!Number.isFinite(ht)){G.redraw();return}const Ot=Array.isArray(pt[J.series])?pt[J.series].map(ot=>({...ot})):[],wt=O(Ot,Q.start,Q.end,ht),Jt=((this.last&&this.last.byTask?this.last.byTask.get(String(x)):null)||[])[this.#U(R)]??null,lt={band:J.id,id:String(x),task:pt,field:J.series,bucketStart:l(Q.start),bucketEnd:l(Q.end),value:ht,oldValue:Jt,series:wt,previous:Ot,view:G.view(),event:X},nt=G.gateEdit(lt,()=>{const ot=G.writeSeries(String(x),J.series,wt)||pt;return G.emitChange({band:J.id,id:String(x),task:ot,field:J.series,series:wt,previous:Ot,reason:"edit",view:G.view(),event:X}),G.redraw(),!0});return nt&&typeof nt.then=="function"?nt.then(ot=>{ot!==!0&&G.redraw()}):nt!==!0&&G.redraw(),nt}#U(x){return!this.last||!this.last.buckets?-1:this.last.buckets.findIndex(R=>l(R.start)===String(x))}tableState(){return this.grid&&this.grid.state?this.grid.state.get():null}setTableState(x){!x||typeof x!="object"||(this.grid&&this.grid.state?this.grid.state.apply(x):this.#l=x)}toTable(){if(!this.last)return null;const x=this.last.grid?this.last.grid.columns:[{id:"name",title:this.#i.t("gantt.dataBand.name")}].concat(this.cfg.totals.column?[{id:"total",title:this.#i.t("gantt.dataBand.total")}]:[]),R=this.last.buckets.map(N=>({id:l(N.start),title:l(N.start)}));return{id:this.cfg.id,title:this.#c(),columns:[...x,...R],rows:this.last.rows.map((N,X)=>[...this.last.grid?this.last.grid.rows[X]:[N.label].concat(this.cfg.totals.column?[N.totalText]:[]),...N.cells])}}exportModel(){return{id:this.cfg.id,title:this.#c(),height:this.cfg.collapsed?this.cfg.rowHeight:this.cfg.height,rowHeight:this.cfg.rowHeight,collapsed:!!this.cfg.collapsed,buckets:this.last?this.last.buckets:[],grid:this.last?this.last.grid:null,rows:this.last?this.last.rows.map(x=>({label:x.label,depth:x.depth,texts:x.texts,totalText:x.totalText,isTotal:!!x.isTotal,isSummary:x.isSummary})):[],totalsColumn:!!this.cfg.totals.column}}destroy(){this.#d&&this.#d(),this.grid&&this.grid.destroy(),this.root&&this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.grid=null,this.root=this.time=this.#t=this.#e=this.#n=this.#s=null,this.last=null}}class P{bands;#t;#i=new Map;constructor(x,R){this.#t=x,this.bands=R.map(N=>new Ft(x,N))}build(x){Tt(this.#t.doc,this.#t.ns);for(const R of this.bands)R.build(x)}panes(){return this.bands.map(x=>x.time).filter(Boolean)}height(){return this.bands.reduce((x,R)=>x+(R.root&&R.root.offsetHeight||0),0)}get(x){return this.bands.find(R=>R.cfg.id===String(x))||null}render(x){for(const R of this.bands)R.render(x)}noteSpans(x){if(this.#i=new Map,!(!x||!x.ok))for(const[R,N]of x.tasks)this.#i.set(String(R),{start:N.es,end:N.ef})}onDatesChanged(x,R){let N=0;const X=x&&Array.isArray(x.changes)?x.changes:[];for(const G of X){if(G.cause!=="user"&&G.cause!=="pushed")continue;const J=this.#i.get(String(G.id));if(!J||!Number.isFinite(G.start)||!Number.isFinite(G.end))continue;let Q=this.#t.rawTask(G.id);if(Q)for(const pt of this.bands){const st=pt.cfg;if(!st.series||!Array.isArray(Q[st.series]))continue;const ht=I(Q[st.series],J,{start:G.start,end:G.end},st.onReschedule);if(!ht)continue;const Ot=Q[st.series];Q=this.#t.writeSeries(String(G.id),st.series,ht)||{...Q,[st.series]:ht},N+=1,this.#t.emitChange({band:st.id,id:String(G.id),task:Q,field:st.series,series:ht,previous:Ot,reason:st.onReschedule,view:this.#t.view(),event:x.event??null})}}return this.noteSpans(R),N}getState(){const x={};for(const R of this.bands)x[R.cfg.id]={collapsed:R.collapsed,table:R.tableState()};return x}setState(x){if(!(!x||typeof x!="object"))for(const[R,N]of Object.entries(x)){const X=this.get(R);!X||!N||typeof N!="object"||(typeof N.collapsed=="boolean"&&X.setCollapsed(N.collapsed),N.table&&X.setTableState(N.table))}}exportModels(){return this.bands.map(x=>x.exportModel())}destroy(){for(const x of this.bands)x.destroy();this.bands=[]}}}),ae("packages/modules/charts/fills.js",function(p,V){"use strict";Object.defineProperty(p,"PATTERNS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"GRADIENTS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"isFill",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"isPaintRef",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"paintFallback",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"normaliseFill",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"swatchCss",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"createFillRegistry",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"rowPaint",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"patternSeries",{enumerable:!0,get:function(){return a}}),Object.defineProperty(p,"paintSolid",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"rowFillSource",{enumerable:!0,get:function(){return m}}),Object.defineProperty(p,"nodePaint",{enumerable:!0,get:function(){return $}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=Object.freeze(["hatch","crosshatch","dots","grid"]),Y=Object.freeze(["linear","radial"]),W=8,l="#0072b2";let L=0;const v=new Map;function b(h){return!!h&&typeof h=="object"&&!Array.isArray(h)&&(typeof h.gradient=="string"||typeof h.pattern=="string")}function w(h){return typeof h=="string"&&h.startsWith("url(#")}function k(h){if(typeof h!="string")return h==null?"":String(h);if(!h.startsWith("url("))return h;const y=h.indexOf(")");return(y<0?"":h.slice(y+1).trim())||l}function u(h,y){U(`chart:fill:invalid:${h}`,`a chart fill object was ignored: ${y} The mark was drawn in a solid colour instead. A fill is a gradient object (gradient: "linear" or "radial", with stops of [offset, colour]) or a pattern object (pattern: "hatch", "crosshatch", "dots" or "grid", with a colour).`)}function g(h,y){if(!b(h))return null;const i=y||l;if(typeof h.gradient=="string"){if(!Y.includes(h.gradient))return u("gradient",`the gradient "${h.gradient}" is not one of ${Y.join(", ")}.`),null;const D=Array.isArray(h.stops)?h.stops:[],I=[];for(const B of D){const H=Array.isArray(B)?Number(B[0]):Number(B&&B.offset),z=Array.isArray(B)?B[1]:B&&B.colour;!Number.isFinite(H)||typeof z!="string"||!z||I.push({offset:Math.min(1,Math.max(0,H)),colour:z})}if(I.length<2)return u("stops","a gradient needs at least two [offset, colour] stops."),null;I.sort((B,H)=>B.offset-H.offset);const O=Number.isFinite(Number(h.angle))?Number(h.angle):180;return{kind:h.gradient,angle:O,stops:I,solid:I[0].colour}}if(!K.includes(h.pattern))return u("pattern",`the pattern "${h.pattern}" is not one of ${K.join(", ")}.`),null;const r=Number(h.size),f=Number(h.angle),M=typeof h.colour=="string"&&h.colour?h.colour:i;return{kind:"pattern",pattern:h.pattern,colour:M,background:typeof h.background=="string"&&h.background?h.background:null,size:Number.isFinite(r)&&r>=2?r:W,angle:Number.isFinite(f)?f:h.pattern==="grid"||h.pattern==="dots"?0:45,solid:M}}function d(h){if(h.kind==="pattern"){const i=h.colour,r=h.size,f=Math.max(1,r/5),M=h.background||"transparent",D=I=>`repeating-linear-gradient(${I+90}deg,${i} 0 ${f}px,transparent ${f}px ${r}px)`;return h.pattern==="hatch"?`${D(h.angle)},${M}`:h.pattern==="crosshatch"?`${D(h.angle)},${D(h.angle+90)},${M}`:h.pattern==="grid"?`${D(h.angle)},${D(h.angle+90)},${M}`:`radial-gradient(circle at 50% 50%,${i} ${r/6}px,transparent ${r/6+.5}px) 0 0/${r}px ${r}px,${M}`}const y=h.stops.map(i=>`${i.colour} ${Math.round(i.offset*100)}%`).join(",");return h.kind==="radial"?`radial-gradient(circle,${y})`:`linear-gradient(${h.angle}deg,${y})`}function S(h){if(!w(h))return typeof h=="string"?h:"";const y=String(h).indexOf(")"),i=String(h).slice(5,y),r=v.get(i);return r?d(r):k(h)}function _(h){const y=`lattice-fill-${++L}`;let i=new Map,r=0;const f=(D,I)=>{const O=h.ownerDocument.createElementNS("http://www.w3.org/2000/svg",D);for(const B of Object.keys(I))O.setAttribute(B,String(I[B]));return O},M=(D,I)=>{if(I.kind==="pattern"){const B=I.size,H=Math.max(1,B/5),z=f("pattern",{id:D,width:B,height:B,patternUnits:"userSpaceOnUse"});I.angle&&z.setAttribute("patternTransform",`rotate(${I.angle})`),I.background&&z.appendChild(f("rect",{width:B,height:B,fill:I.background}));const at={stroke:I.colour,"stroke-width":H};I.pattern==="dots"?z.appendChild(f("circle",{cx:B/2,cy:B/2,r:Math.max(1,B/6),fill:I.colour})):(z.appendChild(f("line",{x1:B/2,y1:0,x2:B/2,y2:B,...at})),I.pattern!=="hatch"&&z.appendChild(f("line",{x1:0,y1:B/2,x2:B,y2:B/2,...at}))),h.appendChild(z);return}let O;if(I.kind==="radial")O=f("radialGradient",{id:D,cx:.5,cy:.5,r:.5});else{const B=I.angle*Math.PI/180,H=Math.sin(B)/2,z=-Math.cos(B)/2;O=f("linearGradient",{id:D,x1:+(.5-H).toFixed(4),y1:+(.5-z).toFixed(4),x2:+(.5+H).toFixed(4),y2:+(.5+z).toFixed(4)})}for(const B of I.stops)O.appendChild(f("stop",{offset:B.offset,"stop-color":B.colour}));h.appendChild(O)};return{prefix:y,paint(D,I){const O=g(D,I);if(!O)return I||l;if(!h||!h.ownerDocument)return O.solid;const B=JSON.stringify(O);let H=i.get(B);if(!H){const z=`${y}-${r++}`;M(z,O),v.set(z,O),H=`url(#${z}) ${O.solid}`,i.set(B,H)}return H},reset(){for(const D of i.values())v.delete(D.slice(5,D.indexOf(")")));if(i=new Map,r=0,h)for(;h.firstChild;)h.removeChild(h.firstChild)},ids(){return[...i.values()].map(D=>D.slice(5,D.indexOf(")")))}}}function C(h,y,i){if(h==null||h==="")return null;const r=k(i);if(b(h))return y?y.paint(h,r):(g(h,r)||{}).solid||null;if(typeof h=="string"){if(K.includes(h)){const f={pattern:h,colour:r};return y?y.paint(f,r):r}return h}return null}function a(h){const y=[{pattern:"hatch",angle:45},{pattern:"dots"},{pattern:"crosshatch",angle:45},{pattern:"hatch",angle:135},{pattern:"grid"},{pattern:"dots",size:5},{pattern:"hatch",angle:0},{pattern:"crosshatch",angle:0,size:6}];return h.map((i,r)=>({...y[r%y.length],colour:i,background:"var(--lattice-chart-plot-bg,var(--lattice-chart-d-plot-bg))"}))}function o(h){return w(h)?String(h).replace(/^url\([^)]*\)\s*/,""):h}function m(h,y){const i=h.fill;if(b(i))return(f,M)=>C(i,y.fills,o(M));if(typeof i=="function")return(f,M)=>{let D=null;try{D=i({label:f.label,x:f.x,y:f.y,rowKey:f.rowKey})}catch{D=null}return C(D,y.fills,o(M))};const r=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.col=="string"?i.col:null;return r?(f,M)=>f.rowKey===void 0||f.rowKey===null?null:C(h.grid.rows.value(f.rowKey,r),y.fills,o(M)):null}function $(h,y,i){return h&&h({label:y.label,x:y.value,y:y.total,rowKey:y.rowKey},i)||i}}),ae("packages/modules/charts/scheme.js",function(p,V){"use strict";Object.defineProperty(p,"PALETTE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"SCHEMES",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"registerScheme",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"setDefaultScheme",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"schemeNames",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"resolveScheme",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"RAMP_SCALES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"toRgb",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"rampStops",{enumerable:!0,get:function(){return i}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/modules/charts/fills.js"),Y=K.isFill,W=K.patternSeries,l=K.rowPaint,L=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),v=Object.freeze({default:{series:L,sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"},bright:{series:["#1f77d0","#ff7f0e","#2ca02c","#d62728","#9467bd","#17becf","#e377c2","#7f7f7f"],sequential:["#eef4fb","#1f77d0"],diverging:["#d62728","#f7f7f7","#1f77d0"],positive:"#2ca02c",negative:"#d62728"},earth:{series:["#5b7c6f","#c08b52","#7a6a53","#a4553f","#4e6a83","#8f8259","#6d5566","#8c9196"],sequential:["#f2efe9","#4e6a83"],diverging:["#a4553f","#f2efe9","#4e6a83"],positive:"#5b7c6f",negative:"#a4553f"},mono:{series:["#0b2a3d","#17475f","#2c6480","#4a82a0","#6da0bd","#94bcd6","#bcd7e9","#dfecf5"],sequential:["#eef3f7","#0b2a3d"],diverging:["#7a5c00","#f5f5f5","#0b2a3d"],positive:"#17475f",negative:"#7a5c00"},patterns:{series:W(L),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),b=new Map;let w="default";function k(r,f){!r||!f||b.set(String(r),f)}function u(r){if(typeof r=="string"){w=r;return}r&&typeof r=="object"&&(b.set("__default__",r),w="__default__")}function g(){return[...Object.keys(v),...b.keys()].filter(r=>!r.startsWith("__"))}function d(r){return b.has(r)?b.get(r):v[r]||null}const S=["series","sequential","diverging","positive","negative"];function _(r){return!r||typeof r!="object"||Array.isArray(r)?!1:!S.some(f=>f in r)}function C(r,f){const M=f&&f.fills||null,D=f&&f.variants||null,I=d(w)||v.default,O=r&&r.scheme,B=_(O)?O:null,H=Array.isArray(O)&&O.length?O:null,z=typeof O=="string"?d(O):B||Array.isArray(O)?null:O||null,at=(r&&Array.isArray(r.palette)&&r.palette.length?r.palette:null)||H;B&&at&&U("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const dt=B?null:at,kt={...v.default,...I,...z||{}};dt&&(kt.series=dt);const Tt=r&&r.ramp&&typeof r.ramp=="object"&&!Array.isArray(r.ramp)?r.ramp:null,Ft=Tt?Tt.colours:r&&r.ramp,P=Array.isArray(Ft)&&Ft.length>=2?Ft:null;P&&(kt.sequential=P);const j=Tt?m(Tt.scale):null,x=!!(z||dt||B),R=kt.series&&kt.series.length?kt.series:L,N=f&&f.memory instanceof Map?f.memory:new Map,X=(J,Q)=>{const pt=Q!=null?String(Q):null;if(pt!==null){if(B&&Object.prototype.hasOwnProperty.call(B,pt))return a(B[pt],M,J);if(D&&Object.prototype.hasOwnProperty.call(D,pt))return D[pt]}if((B||D)&&pt!==null){const st=h(N,pt);return a($(R,st,x),M,st)}return a($(R,J,x),M,J)};return{...kt,series:X,seriesNamed:(J,Q)=>{if(Q==null)return X(J);if(B||D)return X(J,Q);const pt=h(N,String(Q));return a($(R,pt,x),M,pt)},explicit:x,nameMap:!!(B||D),rampScale:j,fills:M}}function a(r,f,M){if(!Y(r))return r;const D=L[(M%L.length+L.length)%L.length];return l(r,f,D)||D}const o=Object.freeze(["linear","log","quantile"]);function m(r){return r==null?null:o.includes(r)?r:(U(`chart:ramp:scale:${String(r)}`,`chart "ramp.scale" was "${String(r)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function $(r,f,M){const D=(f%r.length+r.length)%r.length;return M||typeof r[D]!="string"?r[D]:`var(--lattice-chart-${D+1}, ${r[D]})`}function h(r,f){if(r.has(f))return r.get(f);const M=new Set(r.values());let D=0;for(;M.has(D);)D++;return r.set(f,D),D}function y(r){if(typeof r!="string")return null;const f=r.trim(),M=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(f);if(M){const O=M[1];return O.length===3?[0,1,2].map(B=>parseInt(O[B]+O[B],16)):[0,2,4].map(B=>parseInt(O.slice(B,B+2),16))}const D=/^rgba?\(([^)]+)\)$/i.exec(f);if(!D)return null;const I=D[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return I.length===3&&I.every(O=>Number.isFinite(O))?I:null}function i(r,f){const M=f?r.diverging:r.sequential,D=f?v.default.diverging:v.default.sequential,I=(Array.isArray(M)?M:D).map((O,B)=>y(O)||y(D[B])||[0,0,0]);return I.length>=2?I:D.map(O=>y(O))}}),ae("packages/modules/charts/roles.js",function(p,V){"use strict";Object.defineProperty(p,"expand",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"readRole",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"rolesCss",{enumerable:!0,get:function(){return u}});const U=V("packages/modules/charts/scheme.js").PALETTE,K="lat-chartview",Y=Object.freeze(["#4ea6dd","#f0b429","#34c79a","#e39ec4","#7cc7f0","#f07c3f","#a48ad4","#93a3b1"]),W=":where(:root,.lattice,.lattice-tokens,[data-theme])",l=`
|
|
161
161
|
--lattice-chart-d-sequential-start:var(--lattice-variant-info-fill,#ecf3f9);
|
|
162
162
|
--lattice-chart-d-sequential-end:var(--lattice-accent,#005280);
|
|
163
163
|
--lattice-chart-d-axis:var(--lattice-border-strong,#8c96a0);
|
|
@@ -188,9 +188,9 @@ ${Et(Q,"row")}
|
|
|
188
188
|
--lattice-chart-d-font-size-xs:calc(var(--lattice-font-size-sm,11px) * .82);
|
|
189
189
|
--lattice-chart-d-empty:var(--lattice-surface,#eceff1);
|
|
190
190
|
--lattice-chart-d-map-stroke:var(--lattice-border-color,#dfe3e6);
|
|
191
|
-
`,L=new Set([...l.matchAll(/--lattice-chart-d-([a-z-]+):/g)].map(
|
|
191
|
+
`,L=new Set([...l.matchAll(/--lattice-chart-d-([a-z-]+):/g)].map(g=>g[1]));function v(g){return String(g).replace(/var\(--lattice-chart-([a-z-]+)\)/g,(d,S)=>L.has(S)?`var(--lattice-chart-${S},var(--lattice-chart-d-${S}))`:d)}function b(g,d){return String(g.getPropertyValue(`--lattice-chart-${d}`)).trim()||String(g.getPropertyValue(`--lattice-chart-d-${d}`)).trim()}function w(g){return g.map((d,S)=>`--lattice-chart-${S+1}:${d};`).join("")}function k(){return`${w(Y)}--lattice-chart-basemap-fill:#3a4a55;--lattice-chart-basemap-stroke:#8fb0c2;`}function u(){return`:where(.${K},.${K}__tooltip){${l.replace(/\n\s*/g,"")}}
|
|
192
192
|
@layer lattice.charts{
|
|
193
|
-
${
|
|
193
|
+
${W}{
|
|
194
194
|
${w(U)}
|
|
195
195
|
/* The land under a shapes pack (BACKLOG-0001508): a fill the plot background
|
|
196
196
|
cannot swallow (>=1.3:1 against it) and a border the fill cannot swallow
|
|
@@ -204,7 +204,7 @@ ${H}{
|
|
|
204
204
|
}
|
|
205
205
|
@scope ([data-theme="dark"]){:scope.${K},.${K}{color-scheme:dark}}
|
|
206
206
|
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${K},.${K}{color-scheme:light}}
|
|
207
|
-
@media (prefers-color-scheme: dark){@scope ([data-theme="auto"]){:scope.${K},.${K}{color-scheme:dark}}}`}}),ae("packages/modules/charts/styles.js",function(
|
|
207
|
+
@media (prefers-color-scheme: dark){@scope ([data-theme="auto"]){:scope.${K},.${K}{color-scheme:dark}}}`}}),ae("packages/modules/charts/styles.js",function(p,V){"use strict";Object.defineProperty(p,"NS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"seriesColour",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"css",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"injectStyles",{enumerable:!0,get:function(){return w}});const U=V("packages/modules/charts/scheme.js").PALETTE,K=V("packages/modules/charts/roles.js"),Y=K.rolesCss,W=K.expand,l="lat-chartview",L="data-lattice-chartview";function v(k){const u=(k%U.length+U.length)%U.length;return`var(--lattice-chart-${u+1}, ${U[u]})`}function b(){return W(`
|
|
208
208
|
.${l}{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;
|
|
209
209
|
width:100%;height:100%;box-sizing:border-box;
|
|
210
210
|
font-family:var(--lattice-chart-font);
|
|
@@ -615,26 +615,35 @@ ${Y()}
|
|
|
615
615
|
.${l}__swatch{border:1px solid CanvasText}
|
|
616
616
|
.${l}__mark[data-dim]{opacity:1;fill:GrayText}
|
|
617
617
|
}
|
|
618
|
-
`)}function w(k){const u=k.documentElement;if(!u||u.getAttribute(L))return;u.setAttribute(L,"1");const f=k.createElement("style");f.textContent=m(),(k.head||k.body||u).appendChild(f)}}),ae("packages/modules/charts/typography.js",function(g,V){"use strict";Object.defineProperty(g,"BASE_SIZE",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"BASE_FAMILY",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"CHAR_RATIO",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"resolveType",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"textWidth",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"widestLabel",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"truncateTo",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"textMeasurer",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"breakAtMiddle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"planAxisTitle",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"applySize",{enumerable:!0,get:function(){return u}});const St=12,U="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",K=.62;function Y(f){const d=f&&f.font,S=typeof d=="number"?{size:d}:d||{},_=H(S.size,St);return{family:S.family||U,size:_,small:H(S.small??S.tickSize,Math.max(9,_-1)),title:H(S.title,Math.round(_*1.15)),axisTitle:H(S.axisTitle,Math.max(10,_-1)),weight:S.weight||"inherit"}}function H(f,d){const S=Number(f);return Number.isFinite(S)&&S>0?S:d}function l(f,d){return String(f??"").length*d*K}function L(f,d){let S=0;for(const _ of f||[]){const C=l(_,d);C>S&&(S=C)}return S}function v(f,d,S){const _=String(f??""),C=Math.floor(d/(S*K));return C<=0?"":_.length<=C?_:C===1?"…":`${_.slice(0,C-1)}…`}function m(f,d){try{const S=f&&typeof f.createElement=="function"?f.createElement("canvas"):null,_=S&&typeof S.getContext=="function"?S.getContext("2d"):null;if(!_||typeof _.measureText!="function")return l;const C=f.defaultView,a=C&&typeof C.getComputedStyle=="function"&&d?C.getComputedStyle(d).fontFamily:"";return(p,$)=>{_.font=`${$}px ${a||"sans-serif"}`;const h=_.measureText(String(p??"")).width;return Number.isFinite(h)&&h>0?h:l(p,$)}}catch{return l}}function w(f){const d=String(f??"").trim(),S=d.length/2;let _=-1,C=1/0;for(let p=0;p<d.length;p++)if(/\s/.test(d[p])){const $=Math.abs(p-S);$<C&&(C=$,_=p)}if(_<0)return null;const a=d.slice(0,_).trim(),o=d.slice(_+1).trim();return!a||!o?null:[a,o]}function k(f){const d=String(f.text),S=f.measure,_=Number.isFinite(f.band)?Math.max(0,f.band):null;if(_===null)return{size:f.size,lines:[d],truncated:!1};if(S(d,f.size)<=_)return{size:f.size,lines:[d],truncated:!1};const C=Math.max(f.size-1,Math.min(f.min,f.size));if(S(d,C)<=_)return{size:C,lines:[d],truncated:!1};const a=w(d);if(a&&Math.max(S(a[0],C),S(a[1],C))<=_)return{size:C,lines:a,truncated:!1};const o=v(d,_,C);return{size:C,lines:[o],truncated:o!==d}}function u(f,d){!f||!Number.isFinite(d)||(f.style?f.style.fontSize=`${d}px`:f.setAttribute("style",`font-size:${d}px`))}}),ae("packages/modules/charts/frame.js",function(g,V){"use strict";Object.defineProperty(g,"LABEL_GAP",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"resolveMargin",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"plotRect",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"shouldRotate",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"Pool",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"planCategoryLabels",{enumerable:!0,get:function(){return C}});const U=V("packages/modules/charts/svg.js").SVG_NS,K=V("packages/modules/charts/typography.js"),Y=K.planAxisTitle,H=K.textWidth,l=K.widestLabel,L=8,v=6,m=.4;function w(a,o){const p=typeof a=="number"?a:o,$=a&&typeof a=="object"?a:{},h=y=>Number.isFinite(y)&&y>=0?Number(y):p;return{base:p,top:h($.top),right:h($.right),bottom:h($.bottom),left:h($.left)}}function k(a){const o=w(a.margin,typeof a.padding=="number"?a.padding:8),p=o.base,$=a.fontSize||12,h=a.yLabels||[],y=a.xLabels||[],i=a.ySide==="right"?"right":"left",r=i==="right"?"left":"right",b=a.titles||{},T=a.titleSize||$,j=Number.isFinite(a.titleMin)?a.titleMin:Math.max(0,T-1),I=l(h,$),O=h.length?Math.min(a.width*m,o[i]+I+v):Math.max(L,o[i]),z=o[r]+(a.rightGutter||0),W=l(y.map(D=>String(D).slice(0,14)),$),B=(D,P)=>D?P*(T+v):0,at=D=>{const P=(i==="left"?O:z)+B(b.left,D.left),x=(i==="right"?O:z)+B(b.right,D.right),R=y.length?(a.width-P-(i==="right"?O:z)-B(b.right,D.right))/y.length*.85:0,N=y.length?(a.width-P-(i==="right"?O:z)-B(b.right,D.right))/y.length:0,X=a.rotated==="auto"?u(y,R,$,a.every)&&(!a.labelPlan||(st=>st.rotated||st.mode==="level")(C({labels:y,slot:N,size:$,every:a.every,fit:a.fit,abbreviate:a.abbreviate}))):!!a.rotated,G=(y.length?X?Math.min(a.height*m,v+W):$+v+o.bottom:Math.max(L,o.bottom))+B(b.bottom,D.bottom),J=o.top+(a.topGutter||0),tt=Math.max(0,a.width-P-x),ft=Math.max(0,a.height-J-G);return{left:P,top:J,width:tt,height:ft,right:P+tt,bottom:J+ft,gutter:{left:P,right:x,bottom:G,top:J}}},ct=at({left:b.left?1:0,right:b.right?1:0,bottom:b.bottom?1:0}),kt=(D,P)=>D?Y({text:D,band:P,size:T,min:j,measure:a.measure||H}).lines.length:0,Tt={left:kt(b.left,ct.height),right:kt(b.right,ct.height),bottom:kt(b.bottom,ct.width)},Ft=at(Tt);return{left:Ft.left,top:Ft.top,width:Ft.width,height:Ft.height,right:Ft.right,bottom:Ft.bottom,gutter:Ft.gutter}}function u(a,o,p,$){if(!a.length||o<=0)return!1;const h=Number.isFinite($)&&$>0?Number($):1;return l(a,p)>o*h-4}class f{#t;#i=0;static#e="data-pool-key";constructor(o,p=0){this.#t=o,this.#i=p>0?p:0}next(o,p,$){if($!=null)return this.#n(o,p,String($));const h=this.#t.childNodes[this.#i],y=h&&h.tagName,i=/(^|\s)\S*__axis-title(\s|$)/,r=y&&i.test(String(h.getAttribute("class")||"")),b=!!p&&i.test(String(p));if(y&&(!r||b)&&String(y).toLowerCase()===o.toLowerCase())return p&&h.setAttribute("class",p),this.#i++,h;const T=this.#t.ownerDocument.createElementNS(U,o);return p&&T.setAttribute("class",p),h?this.#t.insertBefore(T,h):this.#t.appendChild(T),this.#i++,T}#n(o,p,$){const h=o.toLowerCase();for(let r=this.#i;r<this.#t.childNodes.length;r++){const b=this.#t.childNodes[r],T=b&&b.tagName;if(T&&String(T).toLowerCase()===h&&b.getAttribute(f.#e)===$)return r!==this.#i&&this.#t.insertBefore(b,this.#t.childNodes[this.#i]),p&&b.setAttribute("class",p),this.#i++,b}const y=this.#t.ownerDocument.createElementNS(U,o);y.setAttribute(f.#e,$),p&&y.setAttribute("class",p);const i=this.#t.childNodes[this.#i];return i?this.#t.insertBefore(y,i):this.#t.appendChild(y),this.#i++,y}finish(){for(;this.#t.childNodes.length>this.#i;)this.#t.removeChild(this.#t.lastChild);this.#i=0}}const d=1.8;function S(a,o){if(a<=1)return a?[0]:[];const p=Math.floor((a-1)/Math.max(1,o));if(p<1)return[0];const $=[];for(let h=0;h<=p;h++)$.push(Math.round(h*(a-1)/p));return $}function _(a){const o=a.map(h=>String(h).trim().split(/\s+/)[0]||""),p=o.map(h=>h.length>3&&/^\p{L}+$/u.test(h)?h.slice(0,3):h),$=[];for(const h of[o,p]){const y=$.length?$[$.length-1]:a;h.some((i,r)=>i!==y[r])&&$.push(h)}return $}function C(a){const{labels:o,slot:p,size:$}=a,h={mode:"level",rotated:!1,text:o,indices:null,stride:1},y=Number.isFinite(a.every)&&a.every>1;if(a.fit==="none"||y||a.rotate!==void 0&&a.rotate!=="auto"||!o.length||!(p>0)||!u(o,p,$))return h;const i=j=>Math.ceil((l(j,$)+4)/p),r=j=>{const I=l(j,$);return p>=$*d&&I<=p*Math.SQRT2-$*1.5&&Math.max(...j.map(O=>String(O).length))<=14},b=(j,I)=>{const O=i(j);return{mode:I,rotated:!1,text:j,indices:S(o.length,O),stride:O}};if(o.length>12&&i(o)<=3)return b(o,"thin");if(r(o))return{...h,mode:"rotate",rotated:!0};const T=typeof a.abbreviate=="function"?[o.map((j,I)=>String(a.abbreviate(j,I)))]:_(o);for(const j of T){if(i(j)<=1)return{...h,mode:"abbreviate",text:j};if(r(j))return{...h,mode:"abbreviate",rotated:!0,text:j}}return b(T.length?T[T.length-1]:o,T.length?"abbreviate":"thin")}}),ae("packages/modules/charts/measure-axis.js",function(g,V){"use strict";Object.defineProperty(g,"GAP",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"labelGap",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"LINE_HEIGHT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(g,"tickValues",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"labelEvery",{enumerable:!0,get:function(){return C}}),Object.defineProperty(g,"paintMeasureAxis",{enumerable:!0,get:function(){return a}}),Object.defineProperty(g,"heldInside",{enumerable:!0,get:function(){return o}});const U=V("packages/modules/charts/frame.js").Pool,K=V("packages/modules/charts/svg.js"),Y=K.attrs,H=K.round,l=K.setText,L=K.svg,v=V("packages/modules/charts/typography.js"),m=v.applySize,w=v.CHAR_RATIO,u=V("packages/modules/charts/styles.js").NS,f=6;function d(p){return Number.isFinite(p)&&p>0?Math.max(f,Math.ceil(p)+1):f}const S=1.2;function _(p,$,h){const y=$&&$.ticks;if(Array.isArray(y)){const r=p.domain;return!r||r.min===void 0?y:y.filter(b=>Number(b)>=r.min&&Number(b)<=r.max)}const i=Number.isFinite(y)&&y>0?Number(y):5;return p.ticks(i,h)}function C(p){const{values:$,scale:h,size:y,horizontal:i,label:r}=p;if($.length<2)return 1;let b=1/0;for(let j=1;j<$.length;j++){const I=Math.abs(h.of($[j])-h.of($[j-1]));Number.isFinite(I)&&I<b&&(b=I)}if(!Number.isFinite(b))return 1;if(b<=0)return $.length;let T=y*S+2;if(i){let j=0;for(const I of $){const O=String(r(I)||"").length*y*w;O>j&&(j=O)}T=j+f}return Math.max(1,Math.ceil(T/b))}function a(p){const{gridGroup:$,axisGroup:h,plot:y,scale:i,format:r}=p,b=p.config||{},T=_(i,b,p.timeZone),j=typeof p.label=="function"?p.label:r&&r.tick||String,I=p.size||11,O=C({values:T,scale:i,size:I,horizontal:!!p.horizontal,label:j}),z=d(p.overhang),W=b.grid===!1?null:$,B=W?new U(W):null,at=new U(h);for(let ct=0;ct<T.length;ct++){const kt=T[ct],Tt=H(i.of(kt)),Ft=kt===0,D=ct%O!==0;if(p.horizontal){if(B&&Y(B.next("line",`${u}__gridline`),{x1:Tt,x2:Tt,y1:H(y.top),y2:H(y.bottom),"stroke-opacity":Ft?1:.6,"stroke-width":Ft?1.5:1}),b.labels===!1||D)continue;const P=j(kt),x=String(P).length*I*w/2,R=y.gutter;if(R&&(Tt-x<y.left-(R.left||0)||Tt+x>y.right+(R.right||0)))continue;const N=at.next("text",`${u}__tick`);m(N,I),Y(N,{x:Tt,y:H(y.bottom+z),"text-anchor":"middle","dominant-baseline":"hanging"}),l(N,P)}else{if(B&&Y(B.next("line",`${u}__gridline`),{x1:H(y.left),x2:H(y.right),y1:Tt,y2:Tt,"stroke-opacity":Ft?1:.6,"stroke-width":Ft?1.5:1}),b.labels===!1||D)continue;const P=p.side==="right",x=j(kt),R=o(Tt,y,I);if(p.dropBottom&&Math.abs(Tt-y.bottom)<=1){if(p.dropBottom===!0)continue;const X=String(x).length*I*w,G=P?{left:y.right+z,right:y.right+z+X}:{left:y.left-z-X,right:y.left-z};G.top=R-I*.85,G.bottom=R+I*.6;const J=p.dropBottom,tt=3;if(G.left<J.right+tt&&G.right>J.left-tt&&G.top<J.bottom+tt&&G.bottom>J.top-tt)continue}const N=at.next("text",`${u}__tick`);m(N,I),Y(N,{x:H(P?y.right+z:y.left-z),y:R,"text-anchor":P?"start":"end","dominant-baseline":"middle"}),l(N,x)}}return B?B.finish():new U($).finish(),at.finish(),T}function o(p,$,h){const y=$&&$.gutter;if(!y)return p;const i=$.top-(Number.isFinite(y.top)?y.top:0)+h*.85+1,r=$.bottom+(Number.isFinite(y.bottom)?y.bottom:0)-h*.6-1;return H(Math.min(Math.max(p,i),Math.max(i,r)))}}),ae("packages/modules/charts/tooltip-legend.js",function(g,V){"use strict";Object.defineProperty(g,"fillTooltip",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"placeTooltip",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"legendItem",{enumerable:!0,get:function(){return d}});const St=V("packages/modules/charts/svg.js"),U=St.append,K=St.clear,Y=St.el,H=St.setText,L=V("packages/modules/charts/styles.js").NS,m=V("packages/modules/charts/fills.js").swatchCss,k=V("packages/modules/charts/typography.js").applySize;function u(S,_,C,a){if(K(_),C){const o=Y(S,"div",`${L}__tooltip-row`),p=Y(S,"strong");H(p,C),o.appendChild(p),_.appendChild(o)}for(const o of a){const p=Y(S,"div",`${L}__tooltip-row`);o.key!=null&&p.setAttribute("data-series",String(o.key));const $=Y(S,"span",`${L}__swatch`);$.setAttribute("style",`background:${m(o.colour)}`);const h=Y(S,"span");H(h,o.label);const y=Y(S,"span",`${L}__tooltip-value`);H(y,o.value),U(p,[$,h,y]),_.appendChild(p)}}function f(S,_,C,a,o=12){const p=typeof S.getBoundingClientRect=="function"?S.getBoundingClientRect():{width:0,height:0},$=_&&_.innerWidth||0,h=_&&_.innerHeight||0;let y=C+o;$&&y+p.width>$-o&&(y=C-o-p.width),y=Math.max(o,y);let i=a+o;h&&i+p.height>h-o&&(i=a-o-p.height),i=Math.max(o,i),S.style.left=`${Math.round(y)}px`,S.style.top=`${Math.round(i)}px`}function d(S,_){const C=Y(S,"button",`${L}__legend-item`);C.setAttribute("type","button"),C.setAttribute("aria-pressed",_.on?"true":"false");const a=Y(S,"span",`${L}__swatch ${L}__swatch--${_.shape||"square"}`);a.setAttribute("style",`background:${m(_.colour)}`);const o=Y(S,"span");return Number.isFinite(_.size)&&k(o,_.size),H(o,_.label),U(C,[a,o]),C}}),ae("packages/modules/gantt/chart-band.js",function(g,V){"use strict";Object.defineProperty(g,"CHART_BAND_DEFAULTS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(g,"compactBandValue",{enumerable:!0,get:function(){return x}}),Object.defineProperty(g,"normalizeChartBands",{enumerable:!0,get:function(){return R}}),Object.defineProperty(g,"normalizeSeries",{enumerable:!0,get:function(){return N}}),Object.defineProperty(g,"pointsFromGrid",{enumerable:!0,get:function(){return X}}),Object.defineProperty(g,"sourceValues",{enumerable:!0,get:function(){return G}}),Object.defineProperty(g,"combineValues",{enumerable:!0,get:function(){return J}}),Object.defineProperty(g,"cumulativeValues",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(g,"computeChartBand",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(g,"chartBandCss",{enumerable:!0,get:function(){return st}}),Object.defineProperty(g,"ChartBand",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(g,"ChartBands",{enumerable:!0,get:function(){return Jt}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=St.svg,H=St.clear,l=St.round,L=V("packages/modules/charts/styles.js"),v=L.injectStyles,m=L.NS,k=V("packages/modules/charts/scheme.js").resolveScheme,u=V("packages/modules/charts/scale.js"),f=u.measureDomain,d=u.linearScale,S=V("packages/modules/charts/measure-axis.js"),_=S.paintMeasureAxis,C=S.tickValues,a=S.labelGap,o=V("packages/modules/charts/tooltip-legend.js"),p=o.fillTooltip,$=o.legendItem,h=o.placeTooltip,y=V("packages/modules/charts/typography.js"),i=y.resolveType,r=y.textMeasurer,b=V("packages/modules/gantt/time.js"),T=b.toDayNumber,j=b.toISODate,I=V("packages/modules/gantt/data-band.js"),O=I.bucketSeries,z=I.formatBandValue,W=Object.freeze({title:null,height:160,rowHeight:24,collapsed:!1,scheme:null,palette:null}),B=new Set(["bar","line","area"]),at=new Set(["sum","diff"]),ct=new Set(["left","right"]),kt=4,Tt=6,Ft=1,D=1e6,P=dt=>Math.round(dt*D)/D;function x(dt,nt,ot){if(dt==null)return"";const vt=nt.format;if(typeof vt=="function")return z(dt,nt,ot);const pt=vt&&typeof vt=="object"?vt:{type:vt},zt={notation:"compact",maximumFractionDigits:1};pt.type==="currency"?(zt.style="currency",zt.currency=String(pt.currency||nt.currency||"USD")):pt.type==="percent"&&(zt.style="percent");try{return new Intl.NumberFormat(ot||void 0,zt).format(dt)}catch{return String(dt)}}function R(dt){if(!Array.isArray(dt))return[];const nt=new Set,ot=[];return dt.forEach((vt,pt)=>{if(!vt||typeof vt!="object")return;const zt={...W,...vt};let Ot=vt.id!=null&&String(vt.id)!==""?String(vt.id):`chart${pt+1}`;for(;nt.has(Ot);)Ot=`${Ot}_${pt+1}`;nt.add(Ot),zt.id=Ot,zt.height=Math.max(zt.rowHeight*2,Number(zt.height)||W.height),zt.rowHeight=Math.max(16,Number(zt.rowHeight)||W.rowHeight),zt.collapsed=!!vt.collapsed,zt.series=N(vt.series,Ot),ot.push(zt)}),ot}function N(dt,nt){if(!Array.isArray(dt))return[];const ot=new Set,vt=[];return dt.forEach((pt,zt)=>{if(!pt||typeof pt!="object")return;const Ot={...pt};let et=pt.id!=null&&String(pt.id)!==""?String(pt.id):`${nt}series${zt+1}`;for(;ot.has(et);)et=`${et}_${zt+1}`;if(ot.add(et),Ot.id=et,Ot.title=pt.title!=null&&pt.title!==""?String(pt.title):et,Ot.mark=B.has(pt.mark)?pt.mark:"bar",Ot.axis=ct.has(pt.axis)?pt.axis:"left",Ot.stack=pt.stack!=null&&String(pt.stack)!==""?String(pt.stack):null,Ot.cumulative=!!pt.cumulative,typeof pt.value!="function"&&(Ot.value=null),Ot.points=Array.isArray(pt.points)?pt.points:null,Ot.grid=pt.grid&&typeof pt.grid=="object"&&pt.grid.grid?{...pt.grid}:null,Ot.combine=pt.combine&&typeof pt.combine=="object"&&at.has(pt.combine.op)&&Array.isArray(pt.combine.of)?{op:pt.combine.op,of:pt.combine.of.map(String)}:null,[Ot.value!=null,Ot.points!=null,Ot.grid!=null,Ot.combine!=null].filter(Boolean).length!==1){if(!Ot.value&&!Ot.points&&!Ot.grid&&!Ot.combine)return;Ot.value?(Ot.points=null,Ot.grid=null,Ot.combine=null):Ot.points?(Ot.grid=null,Ot.combine=null):Ot.grid&&(Ot.combine=null)}vt.push(Ot)}),vt}function X(dt){const nt=dt&&dt.grid;if(!nt||!nt.rows||typeof nt.rows.forEach!="function")return[];const ot=[],vt=String(dt.date||""),pt=String(dt.value||""),zt=dt.series!=null&&dt.series!==""?String(dt.series):null;return nt.rows.forEach(Ot=>{if(!Ot||Ot.group)return;const et=Ot.key,gt=T(nt.rows.value(et,vt)),q=Number(nt.rows.value(et,pt));if(gt==null||!Number.isFinite(q))return;const jt=zt!=null?String(nt.rows.value(et,zt)??""):null;ot.push({day:gt,value:q,name:jt})}),ot}function G(dt,nt,ot,vt){const pt=()=>nt.map(()=>null);if(dt.value){const zt=(Ot,et)=>{let gt=null;try{gt=dt.value(j(Ot.start),j(Ot.end),{band:null,start:Ot.start,end:Ot.end,zoom:ot,bucket:et})}catch{gt=null}return gt==null||!Number.isFinite(Number(gt))?null:Number(gt)};return[{id:dt.id,title:dt.title,values:nt.map(zt)}]}if(dt.points)return[{id:dt.id,title:dt.title,values:O(dt.points,nt)}];if(dt.grid){const zt=X(dt.grid);if(dt.grid.series!=null&&dt.grid.series!==""){const et=new Map;for(const gt of zt){const q=gt.name==null||gt.name===""?"":gt.name;et.has(q)||et.set(q,[]),et.get(q).push({date:j(gt.day),value:gt.value})}return[...et].map(([gt,q])=>({id:`${dt.id}::${gt}`,title:gt===""?dt.title:gt,values:O(q,nt)}))}const Ot=zt.map(et=>({date:j(et.day),value:et.value}));return[{id:dt.id,title:dt.title,values:O(Ot,nt)}]}return dt.combine?[{id:dt.id,title:dt.title,values:pt()}]:[]}function J(dt,nt,ot){const vt=dt.of.map(zt=>nt.get(zt)||[]),pt=[];for(let zt=0;zt<ot;zt+=1){const Ot=vt.map(gt=>gt[zt]==null?0:gt[zt]);let et=0;dt.op==="diff"?et=Ot.length?Ot[0]-Ot.slice(1).reduce((gt,q)=>gt+q,0):0:et=Ot.reduce((gt,q)=>gt+q,0),pt.push(P(et))}return pt}function tt(dt){let nt=0,ot=!1;return dt.map(vt=>(nt+=vt??0,vt!=null&&(ot=!0),ot?P(nt):null))}function ft(dt,nt,ot){const vt=nt.length,pt=[],zt=new Map;for(const Ot of dt.series){const et=Ot.combine?[]:G(Ot,nt,ot,vt);for(const gt of et)zt.set(gt.id,gt.values),pt.push({id:gt.id,title:gt.title,mark:Ot.mark,axis:Ot.axis,stack:Ot.stack,cumulative:Ot.cumulative,values:gt.values})}for(const Ot of dt.series){if(!Ot.combine)continue;const et=J(Ot.combine,zt,vt);zt.set(Ot.id,et),pt.push({id:Ot.id,title:Ot.title,mark:Ot.mark,axis:Ot.axis,stack:Ot.stack,cumulative:Ot.cumulative,values:et})}for(const Ot of pt)Ot.cumulative&&(Ot.values=tt(Ot.values));return{buckets:nt,series:pt}}function st(dt){return`
|
|
619
|
-
.${
|
|
620
|
-
.${
|
|
621
|
-
.${
|
|
622
|
-
.${
|
|
623
|
-
.${
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
.${
|
|
632
|
-
.${
|
|
633
|
-
.${
|
|
634
|
-
.${
|
|
635
|
-
.${
|
|
636
|
-
.${
|
|
637
|
-
`}const ht="data-lat-gantt-chartband-styles";function Pt(dt,nt){const ot=dt&&dt.documentElement;if(!ot||ot.getAttribute(ht))return;ot.setAttribute(ht,"1");try{v(dt)}catch{}const vt=dt.createElement("style");vt.textContent=st(nt).trim(),(dt.head||dt.body||ot).appendChild(vt)}class wt{cfg;root=null;time=null;axis=null;axisRight=null;plot=null;last=null;#t;#i=null;#e=null;#n=null;#s=null;#o=null;#l=null;#d=null;#g=null;#p=new Map;#h=null;#a=null;#f=[];#c=null;#b=[];#r=-1;#m=null;#y=new Set;#D=i({});constructor(nt,ot){this.#t=nt,this.cfg=ot,this.#h=k({scheme:ot.scheme,palette:ot.palette},{memory:this.#p})}get collapsed(){return!!this.cfg.collapsed}build(nt){const ot=this.#t,vt=ot.ns,pt=ot.doc;this.root=U(pt,"div",`${vt}__cb`),this.root.setAttribute("data-chart-band",this.cfg.id),this.root.setAttribute("role","group"),this.root.setAttribute("aria-label",this.#w()),this.root.style.flex=`0 0 ${this.cfg.height}px`,this.#i=U(pt,"div",`${vt}__cb-head`),this.#i.style.height=`${this.cfg.rowHeight}px`;const zt=pt.createElement("button");zt.setAttribute("type","button"),zt.setAttribute("class",`${vt}__cb-toggle`),zt.addEventListener("click",()=>this.setCollapsed(!this.cfg.collapsed)),this.#n=zt,this.#i.appendChild(zt);const Ot=U(pt,"span",`${vt}__cb-title`);K(Ot,this.#w()),this.#i.appendChild(Ot),this.#i.appendChild(U(pt,"div",`${m}__legend ${vt}__cb-legend`)),this.root.appendChild(this.#i),this.#e=U(pt,"div",`${vt}__cb-body`),this.axis=U(pt,"div",`${vt}__cb-axis`),this.axis.style.width=`${ot.gridWidth()}px`,this.#e.appendChild(this.axis),this.#e.appendChild(U(pt,"div",`${vt}__divider`)),this.time=U(pt,"div",`${vt}__cb-time`),this.#e.appendChild(this.time),this.axisRight=U(pt,"div",`${vt}__cb-axis ${vt}__cb-axis--right`),this.axisRight.setAttribute("hidden",""),this.#e.appendChild(this.axisRight),this.root.appendChild(this.#e),nt.appendChild(this.root),this.#s=U(pt,"div",`${m}__tooltip ${vt}__cb-tooltip`),this.#s.setAttribute("role","tooltip"),this.#s.setAttribute("hidden",""),this.root.appendChild(this.#s),this.time.setAttribute("tabindex","0"),this.time.setAttribute("aria-label",this.#w()),this.time.addEventListener("pointermove",this.#E),this.time.addEventListener("pointerleave",this.#x),this.time.addEventListener("keydown",this.#K),this.time.addEventListener("blur",this.#x),this.#c=null,this.#P(),this.#A()}#P(){for(const nt of this.#b)try{nt()}catch{}this.#b=[];for(const nt of this.cfg.series){const ot=nt.grid&&nt.grid.grid;if(!(!ot||typeof ot.on!="function"))for(const vt of["filter:changed","rows:changed","model:changed","cell:changed"]){let pt=null;try{pt=ot.on(vt,()=>this.#t.redraw())}catch{pt=null}pt&&this.#b.push(pt)}}}#w(){return this.cfg.title!=null&&this.cfg.title!==""?String(this.cfg.title):String(this.cfg.id)}#T=()=>{this.#t.syncScroll(this.time)};#N(nt){const ot=this.#a;if(!ot)return-1;for(let vt=0;vt<this.#f.length;vt+=1){const pt=this.#f[vt];if(nt>=ot(pt.start)&&nt<ot(pt.end))return vt}return-1}#E=nt=>{if(!this.time||!this.last)return;const ot=this.time.getBoundingClientRect(),vt=this.#N(nt.clientX-ot.left+this.time.scrollLeft);if(vt<0){this.#V();return}this.#O(vt,nt.clientX,nt.clientY)};#x=()=>{this.#V()};#K=nt=>{if(!this.time||!this.last||!this.#f.length)return;if(nt.key==="Escape"){this.#r>=0&&(this.#V(),nt.preventDefault());return}if(nt.key!=="ArrowLeft"&&nt.key!=="ArrowRight")return;nt.preventDefault();let ot=this.#r;ot<0?ot=Math.max(0,this.#N(this.time.scrollLeft)):ot=Math.min(this.#f.length-1,Math.max(0,ot+(nt.key==="ArrowRight"?1:-1)));const vt=this.#a,pt=this.#f[ot],zt=vt(pt.start),Ot=vt(pt.end);zt<this.time.scrollLeft?this.time.scrollLeft=zt:Ot>this.time.scrollLeft+this.time.clientWidth&&(this.time.scrollLeft=Ot-this.time.clientWidth);const et=this.time.getBoundingClientRect();this.#O(ot,et.left+(zt+Ot)/2-this.time.scrollLeft,et.top+et.height/2)};#ot(nt){const ot=this.#t,vt=zt=>typeof ot.formatDate=="function"?ot.formatDate(zt):j(zt),pt=Math.max(nt.start,nt.end-1);return pt===nt.start?vt(nt.start):`${vt(nt.start)} – ${vt(pt)}`}#O(nt,ot,vt){const pt=this.#s;if(!pt||!this.root||!this.last)return;const zt=this.#t.doc,Ot=this.#f[nt];if(!Ot)return;const et=this.#t.locale(),gt=[];if(this.last.series.forEach((q,jt)=>{this.#y.has(q.id)||gt.push({key:q.id,label:q.title,colour:this.#L(jt,q.title),value:z(q.values[nt]==null?null:q.values[nt],this.cfg,et)})}),p(zt,pt,this.#ot(Ot),gt),pt.setAttribute("data-bucket",String(nt)),pt.removeAttribute("hidden"),this.#r=nt,this.#m&&this.#a){const q=Math.round(this.#a(Ot.start));this.#m.setAttribute("x",String(q)),this.#m.setAttribute("width",String(Math.max(1,Math.round(this.#a(Ot.end))-q))),this.#m.setAttribute("visibility","visible")}h(pt,zt.defaultView,ot,vt)}#V(){this.#r=-1,this.#s&&(this.#s.setAttribute("hidden",""),this.#s.removeAttribute("data-bucket")),this.#m&&this.#m.setAttribute("visibility","hidden")}setCollapsed(nt){const ot=!!this.cfg.collapsed;this.cfg.collapsed=!!nt,this.#A(),ot!==this.cfg.collapsed&&this.root&&this.#t.redraw()}#A(){if(!this.root)return;const nt=this.#t.ns;this.root.classList.toggle(`${nt}__cb--collapsed`,!!this.cfg.collapsed),this.root.style.flex=this.cfg.collapsed?"0 0 auto":`0 0 ${this.cfg.height}px`,this.#n&&(this.#n.setAttribute("aria-expanded",this.cfg.collapsed?"false":"true"),this.#n.setAttribute("aria-label",this.#t.t(this.cfg.collapsed?"gantt.row.expand":"gantt.row.collapse",{name:this.#w()})))}#L(nt,ot){return this.#h?this.#h.seriesNamed(nt,ot):"var(--lattice-chart-0)"}#Y(nt){const ot=this.last?this.last.series.indexOf(nt):0;return this.#L(Math.max(0,ot),nt.title)}#q(nt,ot){const vt=[];for(const pt of ot)if(pt.axis===nt)for(const zt of pt.values)zt!=null&&vt.push(zt);return f(vt,{zero:!0})}data(){if(!this.last)return null;const nt={};for(const ot of this.last.series)nt[ot.id]=ot.values.slice();return{buckets:this.last.buckets.map(ot=>({start:j(ot.start),end:j(ot.end)})),series:nt}}render(nt){if(!this.root)return;const ot=this.#t,vt=ot.ns,pt=ot.doc,zt=ot.locale();this.#a=nt.x,this.#f=nt.buckets,this.last=ft(this.cfg,nt.buckets,nt.zoom||null);const Ot=Math.max(40,this.cfg.height-this.cfg.rowHeight),et=Tt,gt=Ot-Tt,q=this.#D.small,jt=a(0),Et=r(pt,this.axis),mt=this.last.series,yt=mt.filter(qt=>!this.#y.has(qt.id)),Q=yt.filter(qt=>qt.axis==="right"),Mt=(qt,se)=>{const It=d(this.#q(qt,yt),[gt,et]),ie={},Yt=C(It,ie),lt=Dt=>Yt.reduce((Bt,Ut)=>Math.max(Bt,Et(Dt(Ut),q)),0);let bt=Dt=>z(Dt,this.cfg,zt),Ct=lt(bt);if(Ct+jt+kt>se){const Dt=Ut=>x(Ut,this.cfg,zt),Bt=lt(Dt);Bt<Ct&&(bt=Dt,Ct=Bt)}return{scale:It,tick:bt,widest:Ct,config:ie}},Lt=ot.gridWidth();this.axis.style.width=`${Lt}px`;const Rt=Mt("left",Lt),Zt=Q.length?Mt("right",1/0):null,Vt=Zt?Math.ceil(Zt.widest+jt+kt):0;Zt?(this.axisRight.removeAttribute("hidden"),this.axisRight.style.width=`${Vt}px`):this.axisRight.setAttribute("hidden","");const xt=(qt,se)=>{let It=qt.firstChild;(!It||It.tagName!=="svg")&&(qt.replaceChildren(),It=Y(pt,"svg",{class:`${vt}__cb-plot`}),qt.appendChild(It)),It.setAttribute("width",String(se)),It.setAttribute("height",String(Ot)),It.setAttribute("viewBox",`0 0 ${se} ${Ot}`),H(It);const ie=Y(pt,"g",{class:`${m}__axis`});return It.appendChild(ie),ie};this.#d=xt(this.axis,Lt),this.#g=xt(this.axisRight,Math.max(0,Vt));let Ht=this.time.firstChild;(!Ht||Ht.tagName!=="svg")&&(this.time.replaceChildren(),Ht=Y(pt,"svg",{class:`${vt}__cb-plot`,role:"img","aria-label":this.#w()}),this.time.appendChild(Ht)),Ht.setAttribute("width",String(nt.width)),Ht.setAttribute("height",String(Ot)),Ht.setAttribute("viewBox",`0 0 ${nt.width} ${Ot}`),H(Ht),this.#l=Y(pt,"g",{class:`${m}__grid`,transform:`translate(${-Lt} 0)`}),Ht.appendChild(this.#l),this.#m=Y(pt,"rect",{class:`${vt}__cb-hover`,x:0,y:0,width:0,height:Ot}),this.#m.setAttribute("visibility","hidden"),Ht.appendChild(this.#m),this.#o=Y(pt,"g",{class:`${vt}__cb-marks`}),Ht.appendChild(this.#o);const ge={top:Tt,bottom:Tt};_({gridGroup:this.#l,axisGroup:this.#d,plot:{left:Lt,right:Lt+nt.width,top:et,bottom:gt,width:nt.width,height:gt-et,gutter:{...ge,left:Lt,right:0}},scale:Rt.scale,format:{tick:Rt.tick},label:Rt.tick,config:Rt.config,size:q}),Zt&&_({gridGroup:Y(pt,"g"),axisGroup:this.#g,plot:{left:-nt.width,right:0,top:et,bottom:gt,width:nt.width,height:gt-et,gutter:{...ge,left:0,right:Vt}},scale:Zt.scale,format:{tick:Zt.tick},label:Zt.tick,config:{...Zt.config,grid:!1},size:q,side:"right"}),this.#nt(mt),this.#J(yt,Rt.scale,Zt?Zt.scale:Rt.scale),this.#V(),this.time&&this.#c==null&&(this.time.addEventListener("scroll",this.#T),this.#c=()=>this.time.removeEventListener("scroll",this.#T));const $e=ot.timeScrollLeft();this.time.scrollLeft!==$e&&(this.time.scrollLeft=$e)}#nt(nt){const ot=this.#t.ns,vt=this.#i?this.#i.querySelector(`.${ot}__cb-legend`):null;vt&&(vt.replaceChildren(),nt.forEach((pt,zt)=>{const Ot=$(this.#t.doc,{label:pt.title,colour:this.#L(zt,pt.title),on:!this.#y.has(pt.id),shape:pt.mark==="line"?"line":"square",size:this.#D.small});Ot.setAttribute("data-series",pt.id),Ot.addEventListener("click",()=>this.toggleSeries(pt.id)),vt.appendChild(Ot)}))}toggleSeries(nt,ot){const vt=String(nt),pt=ot===void 0?this.#y.has(vt):!!ot;return pt?this.#y.delete(vt):this.#y.add(vt),this.#t.redraw(),pt}#J(nt,ot,vt){const pt=this.#o,zt=q=>q.axis==="right"?vt:ot,Ot=[...nt.filter(q=>q.mark==="bar"),...nt.filter(q=>q.mark!=="bar")],et=new Map;for(const q of Ot.filter(jt=>jt.mark==="bar"&&jt.stack))et.has(q.stack)||et.set(q.stack,[]),et.get(q.stack).push(q);const gt=new Set([...et.values()].flat());for(const q of Ot)q.mark!=="bar"||gt.has(q)||this.#Q(pt,[q],zt(q));for(const q of et.values())this.#Q(pt,q,zt(q[0]));for(const q of Ot)q.mark==="line"?this.#I(pt,q,zt(q)):q.mark==="area"&&this.#_t(pt,q,zt(q))}#Q(nt,ot,vt){const pt=this.#t.doc,zt=this.#t.ns,Ot=this.#a,et=this.#f;for(let gt=0;gt<et.length;gt+=1){const q=et[gt],jt=Math.round(Ot(q.start))+Ft,Et=Math.max(jt+1,Math.round(Ot(q.end))-Ft);if(Et<=jt)continue;let mt=0,yt=0;for(let Q=0;Q<ot.length;Q+=1){const Mt=ot[Q],Lt=Mt.values[gt];if(Lt==null)continue;const Rt=this.#Y(Mt);let Zt,Vt;ot.length>1?Lt>=0?(Zt=vt.of(mt),Vt=vt.of(mt+Lt),mt+=Lt):(Zt=vt.of(yt),Vt=vt.of(yt+Lt),yt+=Lt):(Zt=vt.of(0),Vt=vt.of(Lt));const xt=Math.min(Zt,Vt),Ht=Math.max(1,Math.abs(Vt-Zt)),ge=Y(pt,"rect",{class:`${zt}__cb-bar`,x:jt,y:l(xt),width:l(Et-jt),height:l(Ht),fill:Rt});ge.setAttribute("data-series",Mt.id),ge.setAttribute("data-bucket",String(gt)),nt.appendChild(ge)}}}#I(nt,ot,vt){const pt=this.#t.doc,zt=this.#t.ns,Ot=this.#a,et=[];for(let jt=0;jt<this.#f.length;jt+=1){const Et=ot.values[jt];if(Et==null)continue;const mt=this.#f[jt];et.push([(Ot(mt.start)+Ot(mt.end))/2,vt.of(Et)])}if(!et.length)return;const gt=et.map((jt,Et)=>`${Et?"L":"M"}${l(jt[0])},${l(jt[1])}`).join(""),q=Y(pt,"path",{class:`${zt}__cb-line`,d:gt,fill:"none",stroke:this.#Y(ot),"stroke-width":2,"stroke-linejoin":"round"});q.setAttribute("data-series",ot.id),nt.appendChild(q)}#_t(nt,ot,vt){const pt=this.#t.doc,zt=this.#t.ns,Ot=this.#a,et=vt.of(0),gt=[];for(let Et=0;Et<this.#f.length;Et+=1){const mt=ot.values[Et];if(mt==null)continue;const yt=this.#f[Et];gt.push([(Ot(yt.start)+Ot(yt.end))/2,vt.of(mt)])}if(!gt.length)return;let q=gt.map((Et,mt)=>`${mt?"L":"M"}${l(Et[0])},${l(Et[1])}`).join("");q+=`L${l(gt[gt.length-1][0])},${l(et)}L${l(gt[0][0])},${l(et)}Z`;const jt=Y(pt,"path",{class:`${zt}__cb-area`,d:q,fill:this.#Y(ot),"fill-opacity":.2,stroke:this.#Y(ot),"stroke-width":2});jt.setAttribute("data-series",ot.id),nt.appendChild(jt)}exportModel(){return{id:this.cfg.id,title:this.#w(),height:this.cfg.collapsed?this.cfg.rowHeight:this.cfg.height,rowHeight:this.cfg.rowHeight,collapsed:!!this.cfg.collapsed,data:this.data()}}destroy(){this.#c&&(this.#c(),this.#c=null),this.time&&(this.time.removeEventListener("pointermove",this.#E),this.time.removeEventListener("pointerleave",this.#x),this.time.removeEventListener("keydown",this.#K),this.time.removeEventListener("blur",this.#x));for(const nt of this.#b)try{nt()}catch{}this.#b=[],this.root&&this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.root=this.time=this.axis=this.axisRight=this.plot=null,this.last=null}}class Jt{bands;#t;constructor(nt,ot){this.#t=nt,this.bands=ot.map(vt=>new wt(nt,vt))}build(nt){Pt(this.#t.doc,this.#t.ns);for(const ot of this.bands)ot.build(nt)}panes(){return this.bands.map(nt=>nt.time).filter(Boolean)}height(){return this.bands.reduce((nt,ot)=>nt+(ot.root&&ot.root.offsetHeight||0),0)}get(nt){return this.bands.find(ot=>ot.cfg.id===String(nt))||null}render(nt){for(const ot of this.bands)ot.render(nt)}getState(){const nt={};for(const ot of this.bands)nt[ot.cfg.id]={collapsed:ot.collapsed};return nt}setState(nt){if(!(!nt||typeof nt!="object"))for(const[ot,vt]of Object.entries(nt)){const pt=this.get(ot);!pt||!vt||typeof vt!="object"||typeof vt.collapsed=="boolean"&&pt.setCollapsed(vt.collapsed)}}exportModels(){return this.bands.map(nt=>nt.exportModel())}destroy(){for(const nt of this.bands)nt.destroy();this.bands=[]}}}),ae("packages/modules/gantt/print.js",function(g,V){"use strict";Object.defineProperty(g,"PDF_MODEL_KEY",{enumerable:!0,get:function(){return L}}),Object.defineProperty(g,"PDF_REGISTRY_KEY",{enumerable:!0,get:function(){return v}}),Object.defineProperty(g,"pdfModule",{enumerable:!0,get:function(){return w}}),Object.defineProperty(g,"ganttPrintModel",{enumerable:!0,get:function(){return f}});const U=V("packages/modules/gantt/export.js").cellText,Y=V("packages/modules/gantt/time.js").toISODate,l=V("packages/modules/gantt/links.js").linkSides,L=Symbol.for("lattice-grid.pdf.model"),v=Symbol.for("lattice-grid.modules.pdf"),m=6;function w(){const d=globalThis[v];return d&&typeof d.exportPdf=="function"?d:null}function k(d,S,_,C){return{id:String(S),depth:_||0,cells:C,es:Number.isFinite(d.es)?d.es:null,ef:Number.isFinite(d.ef)?d.ef:null,milestone:!!(d.isMilestone||d.milestone),summary:!!d.isSummary,critical:!!d.critical,progress:d.percentComplete==null?null:Number(d.percentComplete)}}function u(d){return(d||[]).map(S=>{const _=l(S.type);return{from:String(S.from),to:String(S.to),depart:_.depart,arrive:_.arrive}})}function f(d){const{controller:S}=d,_=d.exportModel||null;let C,a,o,p,$;if(_)C=_.columns.map((y,i)=>({title:String(y.title||y.id||y.key||""),width:_.columnWidths[i]||100})),a=_.rows.map((y,i)=>k(y.rec,y.id,y.depth,_.cellTexts?_.cellTexts[i].map(r=>r==null?"":String(r)):_.columns.map(r=>U(r,y.rec,_.rawById.get(String(y.id))||null)))),o=_.domainMin,p=_.domainMax,$=_.pxPerDay;else{const y=S.schedule,i=y&&y.ok?y.tasks:new Map;C=[{title:"Name",width:200},{title:"Start",width:90},{title:"End",width:90}],a=[],o=1/0,p=-1/0;for(const[r,b]of i)a.push(k(b,r,0,[b.name??String(r),Y(b.es)??"",Y(b.ef)??""])),Number.isFinite(b.es)&&(o=Math.min(o,b.es)),Number.isFinite(b.ef)&&(p=Math.max(p,b.ef));Number.isFinite(o)||(o=0,p=30),o-=1,p+=2,$=m}const h=[];if(typeof d.nonWorking=="function")for(let y=Math.floor(o);y<Math.ceil(p);y++)d.nonWorking(y)&&h.push(y);return{kind:"gantt",element:d.element||null,messages:d.messages||null,title:S.title||null,columns:C,rows:a,links:u(S.dependencies),domainMin:o,domainMax:p,pxPerDay:$,today:_&&Number.isFinite(_.today)?_.today:null,nonWorking:h}}}),ae("packages/modules/gantt/split.js",function(g,V){"use strict";Object.defineProperty(g,"SPLIT_NS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(g,"GanttSplitView",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(g,"mountGanttSplit",{enumerable:!0,get:function(){return hr}});const St=V("packages/modules/shared/axislabels.js"),U=St.thinLabels,K=St.estimateLabelWidth,H=V("packages/modules/shared/token-scope.js").claimTokenScope,l=V("packages/modules/gantt/roles.js"),L=l.ROLE_DEFAULTS,v=l.expand,m=V("packages/modules/charts/svg.js"),w=m.svg,k=m.el,u=m.setText,f=m.path,d=m.round,_=V("packages/modules/charts/scale.js").linearScale,C=V("packages/modules/gantt/time.js"),a=C.fromDayNumber,o=C.toISODate,p=C.toDayNumber,h=V("packages/modules/gantt/zoom.js").ZOOM_PRESETS,i=V("packages/modules/gantt/calendar.js").createCalendar,b=V("packages/modules/gantt/calendar-shading.js").rowNonWorking,T=V("packages/modules/gantt/links.js"),j=T.routeLink,I=T.arrowheadPath,z=V("packages/modules/gantt/messages.js").createTranslator,W=V("packages/modules/gantt/colour.js"),B=W.resolveTaskColour,at=W.darkenColour,ct=W.contrastColour,Tt=V("packages/modules/gantt/resources.js").parseAssignments,Ft=V("packages/modules/gantt/avatar.js"),D=Ft.avatarChip,P=Ft.avatarColor,x=V("packages/modules/gantt/gestures.js"),R=x.GanttGestures,N=x.describeTask,X=V("packages/modules/gantt/events-pointer.js"),G=X.TaskPointerEvents,J=X.drawProgressHandle,tt=X.progressHandleCss,ft=X.partOfElement,st=X.partOfTask,ht=X.gateTooltipShow,Pt=X.fireTooltipHide,wt=X.TOUCH_TARGET,dt=V("packages/modules/gantt/events-link.js").LinkPointerEvents,ot=V("packages/modules/gantt/events-table.js").CellTableEvents,vt=V("packages/modules/gantt/resize-handle.js"),pt=vt.drawResizeHandle,zt=vt.resizeHandleCss,Ot=vt.setBaseDescription,et=vt.restoreDescription,q=V("packages/modules/gantt/assignment-picker.js").AssignmentPicker,Et=V("packages/modules/gantt/link-editor.js").LinkEditor,mt=V("packages/modules/gantt/workload.js"),yt=mt.WORKLOAD_DEFAULTS,Q=mt.HISTOGRAM_DEFAULTS,Mt=mt.computeWorkload,Lt=mt.workloadBuckets,Rt=mt.formatHours,Zt=mt.formatPercent,Vt=mt.formatCost,xt=mt.statedHours,Ht=mt.taskContour,ge=mt.setContourBucket,$e=mt.serializeContour,qt=mt.spreadHours,se=mt.recordWorkingDays,It=mt.normalizeThresholds,ie=mt.thresholdFor,Yt=mt.normalizeExternalLoad,lt=V("packages/modules/gantt/workload-groups.js"),bt=lt.GROUP_KEY_PREFIX,Ct=lt.isGroupKey,Dt=lt.normalizeGroupBy,Bt=lt.groupOfResource,Ut=lt.groupWorkloadRows,oe=lt.groupBookingSubRows,me=V("packages/core/src/internal/warn.js").warnOnce,Fe=V("packages/core/src/internal/ready.js").createReadySignal,Pe=V("packages/modules/gantt/workload-events.js"),Ee=Pe.emitWorkloadCell,_e=Pe.gateWorkloadCell,qe=Pe.workloadCellPayload,He=V("packages/modules/gantt/export.js"),ln=He.buildSplitSVG,pn=He.buildPrintDocument,ne=He.rasterizePNG,xe=He.openPrintWindow,Ge=He.resolveVar,Le=V("packages/modules/gantt/tooltip.js"),ve=Le.resolveTaskTooltip,Me=Le.positionTooltip,Ze=Le.tooltipCss,je=V("packages/modules/gantt/markers.js").normalizeMarkers,he=V("packages/modules/gantt/link-text.js"),Ke=he.buildLinkColumns,zn=he.buildRefIndex,Yn=he.linksText,Sn=he.planLinkEdit,mn=he.LINK_COLUMN_ROLE,ri=V("packages/modules/gantt/task-columns.js"),Un=ri.buildExtraTaskColumns,cn=ri.extraRowData,Zn=ri.extraEditPatch,Wi=ri.EXTRA_TASK_COLUMN_IDS,hn=V("packages/modules/gantt/split-grid.js"),ui=hn.SplitGridTable,di=hn.resolveTableColumns,vi=hn.keptAncestors,si=V("packages/modules/gantt/band-grid.js"),_i=si.bucketColumnSpec,ji=si.bucketColumnWidths,Ni=si.pinStart,Si=V("packages/modules/gantt/wbs.js").compareWbs,bn=V("packages/modules/gantt/date-editor.js").SplitDateEditor,Xn=V("packages/modules/gantt/draw-event.js").createDrawEventScheduler,qn=V("packages/modules/gantt/issues-panel.js"),on=qn.createIssuesPanel,Ui=qn.issuesPanelCss,yn=V("packages/modules/gantt/events-range.js"),Ii=yn.createVisibleRangeNotifier,le=yn.visibleRangeDays,fe=V("packages/modules/gantt/events-scroll.js").createScrollNotifier,Tn=V("packages/modules/shared/autosize.js"),Jn=Tn.watchBox,oi=Tn.watchSize,An=Tn.contentWidth,Qn=Tn.contentHeight,Hn=V("packages/modules/gantt/unscheduled.js").unscheduledMarker,xi=V("packages/modules/gantt/inactive.js").inactiveMarker,Ci=V("packages/dom/src/ui/contextmenu.js").ContextMenu,Ai=V("packages/modules/gantt/zoom-control.js"),Ki=Ai.ZOOM_LEVELS,Vi=Ai.createZoomControl,an=Ai.zoomControlCss,ze=V("packages/modules/gantt/dirty-tracking.js").dirtyFieldsByTask,Gn=V("packages/modules/gantt/week.js"),Nn=Gn.EXPLICIT_WEEK_START_DAY,Yi=Gn.resolveWeekStartDay,Zi=Gn.validWeekStartDay,On=Gn.weekStartOf,Ln=V("packages/modules/gantt/paste.js").createClipboardKeys,hi=V("packages/modules/gantt/task-actions.js"),Fi=hi.defaultTaskMenu,Xi=hi.createTaskActionKeys,Ji=V("packages/modules/gantt/table-defaults.js").resolveTableConfig,fi=V("packages/modules/gantt/split-header-fit.js").fitHeaderToTable,gi=V("packages/modules/gantt/pinch.js").attachGanttPinch,pi=V("packages/modules/gantt/data-band.js"),tr=pi.DataBands,$n=pi.normalizeDataBands,Mn=V("packages/modules/gantt/chart-band.js"),ti=Mn.ChartBands,In=Mn.normalizeChartBands,ai=mt.workloadBuckets,mi=V("packages/modules/gantt/print.js"),en=mi.ganttPrintModel,Ri=mi.PDF_MODEL_KEY,ei=mi.pdfModule,Mi=60,li=.5,un=600,s="lat-gantt-split",Z="data-lat-gantt-split-styles",$t=8,At=32,Kt=40,be=80,ce=160,ye=80,Ne=120,Ve=600,Re=150,nn=120,Dn=150,xn=40,Fn=`${s}__cell--dirty`,bi=Object.freeze({assignee:"assignments"}),ci=Object.freeze({height:null,rowHeight:34,headerHeight:44,gridWidth:620,indent:16,wrapNames:!1,zoom:"day",zoomControl:null,pinchZoom:!0,today:null,markers:null,nonWorking:null,calendar:null,showArrows:!0,showProgress:!0,showBaseline:!0,showCritical:!0,criticalStyle:"fill",barLabel:"name",barLabelPosition:"right",barColour:null,columns:null,locale:null,weekStartDay:null,dateFormat:null,progressLine:null,hoverChain:!0,editable:!0,keyboard:!0,resizeZone:6,tooltip:!0,workload:null,histogram:null,contextMenu:null,issuesPanel:!1,resourceOnly:!1,dataBands:null,chartBands:null}),Ti=11,dn=5,_n=2,gn=11,wn=4,Cn=6,Xe=8;let Rn=0;const ni=Object.freeze(new Set(["hours","percent","cost"])),Bi=Object.freeze({hours:"percent",percent:"cost",cost:"hours"}),Kn=Object.freeze({day:h.day,week:h.week,month:h.month,quarter:h.quarter}),Ei=["S","M","T","W","T","F","S"],Vn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ii=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],De=new Set(["start","end","duration"]),Be=new Set(["effort","units"]),Qe=Object.freeze({name:"name",start:"start",end:"end",duration:"duration",progress:"percentComplete",effort:"effort",units:"units"}),Pn=new Set([...Be,"slack","deadline","unscheduled","inactive","wbs"]);function jn(it){return typeof it=="function"?it:typeof it=="string"&&it?{type:"date",pattern:it}:null}function Wn(it,t,e){return e-t<=1e-9?it>=e?1:0:it<=t?0:it>=e?1:(it-t)/(e-t)}function Oi(){const it=s;return`
|
|
618
|
+
`)}function w(k){const u=k.documentElement;if(!u||u.getAttribute(L))return;u.setAttribute(L,"1");const g=k.createElement("style");g.textContent=b(),(k.head||k.body||u).appendChild(g)}}),ae("packages/modules/charts/typography.js",function(p,V){"use strict";Object.defineProperty(p,"BASE_SIZE",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"BASE_FAMILY",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"CHAR_RATIO",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"resolveType",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"textWidth",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"widestLabel",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"truncateTo",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"textMeasurer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"breakAtMiddle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"planAxisTitle",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"applySize",{enumerable:!0,get:function(){return u}});const St=12,U="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",K=.62;function Y(g){const d=g&&g.font,S=typeof d=="number"?{size:d}:d||{},_=W(S.size,St);return{family:S.family||U,size:_,small:W(S.small??S.tickSize,Math.max(9,_-1)),title:W(S.title,Math.round(_*1.15)),axisTitle:W(S.axisTitle,Math.max(10,_-1)),weight:S.weight||"inherit"}}function W(g,d){const S=Number(g);return Number.isFinite(S)&&S>0?S:d}function l(g,d){return String(g??"").length*d*K}function L(g,d){let S=0;for(const _ of g||[]){const C=l(_,d);C>S&&(S=C)}return S}function v(g,d,S){const _=String(g??""),C=Math.floor(d/(S*K));return C<=0?"":_.length<=C?_:C===1?"…":`${_.slice(0,C-1)}…`}function b(g,d){try{const S=g&&typeof g.createElement=="function"?g.createElement("canvas"):null,_=S&&typeof S.getContext=="function"?S.getContext("2d"):null;if(!_||typeof _.measureText!="function")return l;const C=g.defaultView,a=C&&typeof C.getComputedStyle=="function"&&d?C.getComputedStyle(d).fontFamily:"";return(m,$)=>{_.font=`${$}px ${a||"sans-serif"}`;const h=_.measureText(String(m??"")).width;return Number.isFinite(h)&&h>0?h:l(m,$)}}catch{return l}}function w(g){const d=String(g??"").trim(),S=d.length/2;let _=-1,C=1/0;for(let m=0;m<d.length;m++)if(/\s/.test(d[m])){const $=Math.abs(m-S);$<C&&(C=$,_=m)}if(_<0)return null;const a=d.slice(0,_).trim(),o=d.slice(_+1).trim();return!a||!o?null:[a,o]}function k(g){const d=String(g.text),S=g.measure,_=Number.isFinite(g.band)?Math.max(0,g.band):null;if(_===null)return{size:g.size,lines:[d],truncated:!1};if(S(d,g.size)<=_)return{size:g.size,lines:[d],truncated:!1};const C=Math.max(g.size-1,Math.min(g.min,g.size));if(S(d,C)<=_)return{size:C,lines:[d],truncated:!1};const a=w(d);if(a&&Math.max(S(a[0],C),S(a[1],C))<=_)return{size:C,lines:a,truncated:!1};const o=v(d,_,C);return{size:C,lines:[o],truncated:o!==d}}function u(g,d){!g||!Number.isFinite(d)||(g.style?g.style.fontSize=`${d}px`:g.setAttribute("style",`font-size:${d}px`))}}),ae("packages/modules/charts/frame.js",function(p,V){"use strict";Object.defineProperty(p,"LABEL_GAP",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"resolveMargin",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"plotRect",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"shouldRotate",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"Pool",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"planCategoryLabels",{enumerable:!0,get:function(){return C}});const U=V("packages/modules/charts/svg.js").SVG_NS,K=V("packages/modules/charts/typography.js"),Y=K.planAxisTitle,W=K.textWidth,l=K.widestLabel,L=8,v=6,b=.4;function w(a,o){const m=typeof a=="number"?a:o,$=a&&typeof a=="object"?a:{},h=y=>Number.isFinite(y)&&y>=0?Number(y):m;return{base:m,top:h($.top),right:h($.right),bottom:h($.bottom),left:h($.left)}}function k(a){const o=w(a.margin,typeof a.padding=="number"?a.padding:8),m=o.base,$=a.fontSize||12,h=a.yLabels||[],y=a.xLabels||[],i=a.ySide==="right"?"right":"left",r=i==="right"?"left":"right",f=a.titles||{},M=a.titleSize||$,D=Number.isFinite(a.titleMin)?a.titleMin:Math.max(0,M-1),I=l(h,$),O=h.length?Math.min(a.width*b,o[i]+I+v):Math.max(L,o[i]),B=o[r]+(a.rightGutter||0),H=l(y.map(P=>String(P).slice(0,14)),$),z=(P,j)=>P?j*(M+v):0,at=P=>{const j=(i==="left"?O:B)+z(f.left,P.left),x=(i==="right"?O:B)+z(f.right,P.right),R=y.length?(a.width-j-(i==="right"?O:B)-z(f.right,P.right))/y.length*.85:0,N=y.length?(a.width-j-(i==="right"?O:B)-z(f.right,P.right))/y.length:0,X=a.rotated==="auto"?u(y,R,$,a.every)&&(!a.labelPlan||(st=>st.rotated||st.mode==="level")(C({labels:y,slot:N,size:$,every:a.every,fit:a.fit,abbreviate:a.abbreviate}))):!!a.rotated,G=(y.length?X?Math.min(a.height*b,v+H):$+v+o.bottom:Math.max(L,o.bottom))+z(f.bottom,P.bottom),J=o.top+(a.topGutter||0),Q=Math.max(0,a.width-j-x),pt=Math.max(0,a.height-J-G);return{left:j,top:J,width:Q,height:pt,right:j+Q,bottom:J+pt,gutter:{left:j,right:x,bottom:G,top:J}}},dt=at({left:f.left?1:0,right:f.right?1:0,bottom:f.bottom?1:0}),kt=(P,j)=>P?Y({text:P,band:j,size:M,min:D,measure:a.measure||W}).lines.length:0,Tt={left:kt(f.left,dt.height),right:kt(f.right,dt.height),bottom:kt(f.bottom,dt.width)},Ft=at(Tt);return{left:Ft.left,top:Ft.top,width:Ft.width,height:Ft.height,right:Ft.right,bottom:Ft.bottom,gutter:Ft.gutter}}function u(a,o,m,$){if(!a.length||o<=0)return!1;const h=Number.isFinite($)&&$>0?Number($):1;return l(a,m)>o*h-4}class g{#t;#i=0;static#e="data-pool-key";constructor(o,m=0){this.#t=o,this.#i=m>0?m:0}next(o,m,$){if($!=null)return this.#n(o,m,String($));const h=this.#t.childNodes[this.#i],y=h&&h.tagName,i=/(^|\s)\S*__axis-title(\s|$)/,r=y&&i.test(String(h.getAttribute("class")||"")),f=!!m&&i.test(String(m));if(y&&(!r||f)&&String(y).toLowerCase()===o.toLowerCase())return m&&h.setAttribute("class",m),this.#i++,h;const M=this.#t.ownerDocument.createElementNS(U,o);return m&&M.setAttribute("class",m),h?this.#t.insertBefore(M,h):this.#t.appendChild(M),this.#i++,M}#n(o,m,$){const h=o.toLowerCase();for(let r=this.#i;r<this.#t.childNodes.length;r++){const f=this.#t.childNodes[r],M=f&&f.tagName;if(M&&String(M).toLowerCase()===h&&f.getAttribute(g.#e)===$)return r!==this.#i&&this.#t.insertBefore(f,this.#t.childNodes[this.#i]),m&&f.setAttribute("class",m),this.#i++,f}const y=this.#t.ownerDocument.createElementNS(U,o);y.setAttribute(g.#e,$),m&&y.setAttribute("class",m);const i=this.#t.childNodes[this.#i];return i?this.#t.insertBefore(y,i):this.#t.appendChild(y),this.#i++,y}finish(){for(;this.#t.childNodes.length>this.#i;)this.#t.removeChild(this.#t.lastChild);this.#i=0}}const d=1.8;function S(a,o){if(a<=1)return a?[0]:[];const m=Math.floor((a-1)/Math.max(1,o));if(m<1)return[0];const $=[];for(let h=0;h<=m;h++)$.push(Math.round(h*(a-1)/m));return $}function _(a){const o=a.map(h=>String(h).trim().split(/\s+/)[0]||""),m=o.map(h=>h.length>3&&/^\p{L}+$/u.test(h)?h.slice(0,3):h),$=[];for(const h of[o,m]){const y=$.length?$[$.length-1]:a;h.some((i,r)=>i!==y[r])&&$.push(h)}return $}function C(a){const{labels:o,slot:m,size:$}=a,h={mode:"level",rotated:!1,text:o,indices:null,stride:1},y=Number.isFinite(a.every)&&a.every>1;if(a.fit==="none"||y||a.rotate!==void 0&&a.rotate!=="auto"||!o.length||!(m>0)||!u(o,m,$))return h;const i=D=>Math.ceil((l(D,$)+4)/m),r=D=>{const I=l(D,$);return m>=$*d&&I<=m*Math.SQRT2-$*1.5&&Math.max(...D.map(O=>String(O).length))<=14},f=(D,I)=>{const O=i(D);return{mode:I,rotated:!1,text:D,indices:S(o.length,O),stride:O}};if(o.length>12&&i(o)<=3)return f(o,"thin");if(r(o))return{...h,mode:"rotate",rotated:!0};const M=typeof a.abbreviate=="function"?[o.map((D,I)=>String(a.abbreviate(D,I)))]:_(o);for(const D of M){if(i(D)<=1)return{...h,mode:"abbreviate",text:D};if(r(D))return{...h,mode:"abbreviate",rotated:!0,text:D}}return f(M.length?M[M.length-1]:o,M.length?"abbreviate":"thin")}}),ae("packages/modules/charts/measure-axis.js",function(p,V){"use strict";Object.defineProperty(p,"GAP",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"labelGap",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"LINE_HEIGHT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(p,"tickValues",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"labelEvery",{enumerable:!0,get:function(){return C}}),Object.defineProperty(p,"paintMeasureAxis",{enumerable:!0,get:function(){return a}}),Object.defineProperty(p,"heldInside",{enumerable:!0,get:function(){return o}});const U=V("packages/modules/charts/frame.js").Pool,K=V("packages/modules/charts/svg.js"),Y=K.attrs,W=K.round,l=K.setText,L=K.svg,v=V("packages/modules/charts/typography.js"),b=v.applySize,w=v.CHAR_RATIO,u=V("packages/modules/charts/styles.js").NS,g=6;function d(m){return Number.isFinite(m)&&m>0?Math.max(g,Math.ceil(m)+1):g}const S=1.2;function _(m,$,h){const y=$&&$.ticks;if(Array.isArray(y)){const r=m.domain;return!r||r.min===void 0?y:y.filter(f=>Number(f)>=r.min&&Number(f)<=r.max)}const i=Number.isFinite(y)&&y>0?Number(y):5;return m.ticks(i,h)}function C(m){const{values:$,scale:h,size:y,horizontal:i,label:r}=m;if($.length<2)return 1;let f=1/0;for(let D=1;D<$.length;D++){const I=Math.abs(h.of($[D])-h.of($[D-1]));Number.isFinite(I)&&I<f&&(f=I)}if(!Number.isFinite(f))return 1;if(f<=0)return $.length;let M=y*S+2;if(i){let D=0;for(const I of $){const O=String(r(I)||"").length*y*w;O>D&&(D=O)}M=D+g}return Math.max(1,Math.ceil(M/f))}function a(m){const{gridGroup:$,axisGroup:h,plot:y,scale:i,format:r}=m,f=m.config||{},M=_(i,f,m.timeZone),D=typeof m.label=="function"?m.label:r&&r.tick||String,I=m.size||11,O=C({values:M,scale:i,size:I,horizontal:!!m.horizontal,label:D}),B=d(m.overhang),H=f.grid===!1?null:$,z=H?new U(H):null,at=new U(h);for(let dt=0;dt<M.length;dt++){const kt=M[dt],Tt=W(i.of(kt)),Ft=kt===0,P=dt%O!==0;if(m.horizontal){if(z&&Y(z.next("line",`${u}__gridline`),{x1:Tt,x2:Tt,y1:W(y.top),y2:W(y.bottom),"stroke-opacity":Ft?1:.6,"stroke-width":Ft?1.5:1}),f.labels===!1||P)continue;const j=D(kt),x=String(j).length*I*w/2,R=y.gutter;if(R&&(Tt-x<y.left-(R.left||0)||Tt+x>y.right+(R.right||0)))continue;const N=at.next("text",`${u}__tick`);b(N,I),Y(N,{x:Tt,y:W(y.bottom+B),"text-anchor":"middle","dominant-baseline":"hanging"}),l(N,j)}else{if(z&&Y(z.next("line",`${u}__gridline`),{x1:W(y.left),x2:W(y.right),y1:Tt,y2:Tt,"stroke-opacity":Ft?1:.6,"stroke-width":Ft?1.5:1}),f.labels===!1||P)continue;const j=m.side==="right",x=D(kt),R=o(Tt,y,I);if(m.dropBottom&&Math.abs(Tt-y.bottom)<=1){if(m.dropBottom===!0)continue;const X=String(x).length*I*w,G=j?{left:y.right+B,right:y.right+B+X}:{left:y.left-B-X,right:y.left-B};G.top=R-I*.85,G.bottom=R+I*.6;const J=m.dropBottom,Q=3;if(G.left<J.right+Q&&G.right>J.left-Q&&G.top<J.bottom+Q&&G.bottom>J.top-Q)continue}const N=at.next("text",`${u}__tick`);b(N,I),Y(N,{x:W(j?y.right+B:y.left-B),y:R,"text-anchor":j?"start":"end","dominant-baseline":"middle"}),l(N,x)}}return z?z.finish():new U($).finish(),at.finish(),M}function o(m,$,h){const y=$&&$.gutter;if(!y)return m;const i=$.top-(Number.isFinite(y.top)?y.top:0)+h*.85+1,r=$.bottom+(Number.isFinite(y.bottom)?y.bottom:0)-h*.6-1;return W(Math.min(Math.max(m,i),Math.max(i,r)))}}),ae("packages/modules/charts/tooltip-legend.js",function(p,V){"use strict";Object.defineProperty(p,"fillTooltip",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"placeTooltip",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"legendItem",{enumerable:!0,get:function(){return d}});const St=V("packages/modules/charts/svg.js"),U=St.append,K=St.clear,Y=St.el,W=St.setText,L=V("packages/modules/charts/styles.js").NS,b=V("packages/modules/charts/fills.js").swatchCss,k=V("packages/modules/charts/typography.js").applySize;function u(S,_,C,a){if(K(_),C){const o=Y(S,"div",`${L}__tooltip-row`),m=Y(S,"strong");W(m,C),o.appendChild(m),_.appendChild(o)}for(const o of a){const m=Y(S,"div",`${L}__tooltip-row`);o.key!=null&&m.setAttribute("data-series",String(o.key));const $=Y(S,"span",`${L}__swatch`);$.setAttribute("style",`background:${b(o.colour)}`);const h=Y(S,"span");W(h,o.label);const y=Y(S,"span",`${L}__tooltip-value`);W(y,o.value),U(m,[$,h,y]),_.appendChild(m)}}function g(S,_,C,a,o=12){const m=typeof S.getBoundingClientRect=="function"?S.getBoundingClientRect():{width:0,height:0},$=_&&_.innerWidth||0,h=_&&_.innerHeight||0;let y=C+o;$&&y+m.width>$-o&&(y=C-o-m.width),y=Math.max(o,y);let i=a+o;h&&i+m.height>h-o&&(i=a-o-m.height),i=Math.max(o,i),S.style.left=`${Math.round(y)}px`,S.style.top=`${Math.round(i)}px`}function d(S,_){const C=Y(S,"button",`${L}__legend-item`);C.setAttribute("type","button"),C.setAttribute("aria-pressed",_.on?"true":"false");const a=Y(S,"span",`${L}__swatch ${L}__swatch--${_.shape||"square"}`);a.setAttribute("style",`background:${b(_.colour)}`);const o=Y(S,"span");return Number.isFinite(_.size)&&k(o,_.size),W(o,_.label),U(C,[a,o]),C}}),ae("packages/modules/gantt/chart-band.js",function(p,V){"use strict";Object.defineProperty(p,"CHART_BAND_DEFAULTS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(p,"compactBandValue",{enumerable:!0,get:function(){return x}}),Object.defineProperty(p,"normalizeChartBands",{enumerable:!0,get:function(){return R}}),Object.defineProperty(p,"normalizeSeries",{enumerable:!0,get:function(){return N}}),Object.defineProperty(p,"pointsFromGrid",{enumerable:!0,get:function(){return X}}),Object.defineProperty(p,"sourceValues",{enumerable:!0,get:function(){return G}}),Object.defineProperty(p,"combineValues",{enumerable:!0,get:function(){return J}}),Object.defineProperty(p,"cumulativeValues",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(p,"computeChartBand",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(p,"chartBandCss",{enumerable:!0,get:function(){return st}}),Object.defineProperty(p,"ChartBand",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(p,"ChartBands",{enumerable:!0,get:function(){return Jt}});const St=V("packages/modules/charts/svg.js"),U=St.el,K=St.setText,Y=St.svg,W=St.clear,l=St.round,L=V("packages/modules/charts/styles.js"),v=L.injectStyles,b=L.NS,k=V("packages/modules/charts/scheme.js").resolveScheme,u=V("packages/modules/charts/scale.js"),g=u.measureDomain,d=u.linearScale,S=V("packages/modules/charts/measure-axis.js"),_=S.paintMeasureAxis,C=S.tickValues,a=S.labelGap,o=V("packages/modules/charts/tooltip-legend.js"),m=o.fillTooltip,$=o.legendItem,h=o.placeTooltip,y=V("packages/modules/charts/typography.js"),i=y.resolveType,r=y.textMeasurer,f=V("packages/modules/gantt/time.js"),M=f.toDayNumber,D=f.toISODate,I=V("packages/modules/gantt/data-band.js"),O=I.bucketSeries,B=I.formatBandValue,H=Object.freeze({title:null,height:160,rowHeight:24,collapsed:!1,scheme:null,palette:null}),z=new Set(["bar","line","area"]),at=new Set(["sum","diff"]),dt=new Set(["left","right"]),kt=4,Tt=6,Ft=1,P=1e6,j=lt=>Math.round(lt*P)/P;function x(lt,nt,ot){if(lt==null)return"";const vt=nt.format;if(typeof vt=="function")return B(lt,nt,ot);const gt=vt&&typeof vt=="object"?vt:{type:vt},Ht={notation:"compact",maximumFractionDigits:1};gt.type==="currency"?(Ht.style="currency",Ht.currency=String(gt.currency||nt.currency||"USD")):gt.type==="percent"&&(Ht.style="percent");try{return new Intl.NumberFormat(ot||void 0,Ht).format(lt)}catch{return String(lt)}}function R(lt){if(!Array.isArray(lt))return[];const nt=new Set,ot=[];return lt.forEach((vt,gt)=>{if(!vt||typeof vt!="object")return;const Ht={...H,...vt};let Pt=vt.id!=null&&String(vt.id)!==""?String(vt.id):`chart${gt+1}`;for(;nt.has(Pt);)Pt=`${Pt}_${gt+1}`;nt.add(Pt),Ht.id=Pt,Ht.height=Math.max(Ht.rowHeight*2,Number(Ht.height)||H.height),Ht.rowHeight=Math.max(16,Number(Ht.rowHeight)||H.rowHeight),Ht.collapsed=!!vt.collapsed,Ht.series=N(vt.series,Pt),ot.push(Ht)}),ot}function N(lt,nt){if(!Array.isArray(lt))return[];const ot=new Set,vt=[];return lt.forEach((gt,Ht)=>{if(!gt||typeof gt!="object")return;const Pt={...gt};let et=gt.id!=null&&String(gt.id)!==""?String(gt.id):`${nt}series${Ht+1}`;for(;ot.has(et);)et=`${et}_${Ht+1}`;if(ot.add(et),Pt.id=et,Pt.title=gt.title!=null&>.title!==""?String(gt.title):et,Pt.mark=z.has(gt.mark)?gt.mark:"bar",Pt.axis=dt.has(gt.axis)?gt.axis:"left",Pt.stack=gt.stack!=null&&String(gt.stack)!==""?String(gt.stack):null,Pt.cumulative=!!gt.cumulative,typeof gt.value!="function"&&(Pt.value=null),Pt.points=Array.isArray(gt.points)?gt.points:null,Pt.grid=gt.grid&&typeof gt.grid=="object"&>.grid.grid?{...gt.grid}:null,Pt.combine=gt.combine&&typeof gt.combine=="object"&&at.has(gt.combine.op)&&Array.isArray(gt.combine.of)?{op:gt.combine.op,of:gt.combine.of.map(String)}:null,[Pt.value!=null,Pt.points!=null,Pt.grid!=null,Pt.combine!=null].filter(Boolean).length!==1){if(!Pt.value&&!Pt.points&&!Pt.grid&&!Pt.combine)return;Pt.value?(Pt.points=null,Pt.grid=null,Pt.combine=null):Pt.points?(Pt.grid=null,Pt.combine=null):Pt.grid&&(Pt.combine=null)}vt.push(Pt)}),vt}function X(lt){const nt=lt&<.grid;if(!nt||!nt.rows||typeof nt.rows.forEach!="function")return[];const ot=[],vt=String(lt.date||""),gt=String(lt.value||""),Ht=lt.series!=null&<.series!==""?String(lt.series):null;return nt.rows.forEach(Pt=>{if(!Pt||Pt.group)return;const et=Pt.key,ft=M(nt.rows.value(et,vt)),q=Number(nt.rows.value(et,gt));if(ft==null||!Number.isFinite(q))return;const jt=Ht!=null?String(nt.rows.value(et,Ht)??""):null;ot.push({day:ft,value:q,name:jt})}),ot}function G(lt,nt,ot,vt){const gt=()=>nt.map(()=>null);if(lt.value){const Ht=(Pt,et)=>{let ft=null;try{ft=lt.value(D(Pt.start),D(Pt.end),{band:null,start:Pt.start,end:Pt.end,zoom:ot,bucket:et})}catch{ft=null}return ft==null||!Number.isFinite(Number(ft))?null:Number(ft)};return[{id:lt.id,title:lt.title,values:nt.map(Ht)}]}if(lt.points)return[{id:lt.id,title:lt.title,values:O(lt.points,nt)}];if(lt.grid){const Ht=X(lt.grid);if(lt.grid.series!=null&<.grid.series!==""){const et=new Map;for(const ft of Ht){const q=ft.name==null||ft.name===""?"":ft.name;et.has(q)||et.set(q,[]),et.get(q).push({date:D(ft.day),value:ft.value})}return[...et].map(([ft,q])=>({id:`${lt.id}::${ft}`,title:ft===""?lt.title:ft,values:O(q,nt)}))}const Pt=Ht.map(et=>({date:D(et.day),value:et.value}));return[{id:lt.id,title:lt.title,values:O(Pt,nt)}]}return lt.combine?[{id:lt.id,title:lt.title,values:gt()}]:[]}function J(lt,nt,ot){const vt=lt.of.map(Ht=>nt.get(Ht)||[]),gt=[];for(let Ht=0;Ht<ot;Ht+=1){const Pt=vt.map(ft=>ft[Ht]==null?0:ft[Ht]);let et=0;lt.op==="diff"?et=Pt.length?Pt[0]-Pt.slice(1).reduce((ft,q)=>ft+q,0):0:et=Pt.reduce((ft,q)=>ft+q,0),gt.push(j(et))}return gt}function Q(lt){let nt=0,ot=!1;return lt.map(vt=>(nt+=vt??0,vt!=null&&(ot=!0),ot?j(nt):null))}function pt(lt,nt,ot){const vt=nt.length,gt=[],Ht=new Map;for(const Pt of lt.series){const et=Pt.combine?[]:G(Pt,nt,ot,vt);for(const ft of et)Ht.set(ft.id,ft.values),gt.push({id:ft.id,title:ft.title,mark:Pt.mark,axis:Pt.axis,stack:Pt.stack,cumulative:Pt.cumulative,values:ft.values})}for(const Pt of lt.series){if(!Pt.combine)continue;const et=J(Pt.combine,Ht,vt);Ht.set(Pt.id,et),gt.push({id:Pt.id,title:Pt.title,mark:Pt.mark,axis:Pt.axis,stack:Pt.stack,cumulative:Pt.cumulative,values:et})}for(const Pt of gt)Pt.cumulative&&(Pt.values=Q(Pt.values));return{buckets:nt,series:gt}}function st(lt){return`
|
|
619
|
+
.${lt}__cb{position:relative;display:flex;flex-direction:column;border-top:1px solid var(--lattice-border-strong);background:var(--lattice-background)}
|
|
620
|
+
.${lt}__cb-head{display:flex;flex:0 0 auto;align-items:center;gap:4px;padding:0 6px;overflow:hidden;background:var(--lattice-surface);border-bottom:1px solid var(--lattice-border-color);font-weight:600;color:var(--lattice-foreground)}
|
|
621
|
+
.${lt}__cb-body{display:flex;flex:1 1 auto;min-height:0;overflow:hidden;position:relative}
|
|
622
|
+
.${lt}__cb-axis{flex:0 0 auto;overflow:hidden;background:var(--lattice-background)}
|
|
623
|
+
.${lt}__cb-axis[hidden]{display:none}
|
|
624
|
+
/* The y axis is drawn with the charts module's own classes, whose stylesheet
|
|
625
|
+
reads the --lattice-chart-* roles a .lat-chartview root declares — and a
|
|
626
|
+
chart band has no such root, so the roles never resolve and the labels fell
|
|
627
|
+
back to the SVG default (black, invisible on a dark ground) while the
|
|
628
|
+
gridlines drew no stroke at all (BACKLOG-0006399). Scoped here to the band,
|
|
629
|
+
each takes the same core token the split view's own axis and a data band
|
|
630
|
+
use, with no effect on a standalone chart. */
|
|
631
|
+
.${lt}__cb-axis .${b}__tick{fill:var(--lattice-foreground-muted)}
|
|
632
|
+
.${lt}__cb-time .${b}__grid line{stroke:var(--lattice-border-color)}
|
|
633
|
+
.${lt}__cb-time{flex:1 1 auto;overflow-x:auto;overflow-y:hidden;position:relative}
|
|
634
|
+
.${lt}__cb-plot{display:block}
|
|
635
|
+
.${lt}__cb--collapsed{flex-basis:auto!important}
|
|
636
|
+
.${lt}__cb--collapsed>.${lt}__cb-body{display:none}
|
|
637
|
+
.${lt}__cb-title{display:flex;align-items:center;gap:2px;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
638
|
+
.${lt}__cb-legend{flex-wrap:nowrap;align-items:center;min-width:0;overflow:hidden;padding:0;font-weight:400}
|
|
639
|
+
.${lt}__cb-toggle{flex:0 0 auto;width:var(--lattice-toggle-size);height:var(--lattice-toggle-size);line-height:var(--lattice-toggle-size);text-align:center;cursor:pointer;color:var(--lattice-foreground-muted);border:0;background:none;padding:0;font-size:var(--lattice-font-size-lg);border-radius:var(--lattice-radius)}
|
|
640
|
+
.${lt}__cb-toggle:hover{background:var(--lattice-hovered-background);color:var(--lattice-foreground)}
|
|
641
|
+
.${lt}__cb-toggle:focus-visible{outline:2px solid var(--lattice-focus-color);outline-offset:-2px}
|
|
642
|
+
.${lt}__cb-toggle::before{content:"\\25B8"}
|
|
643
|
+
.${lt}__cb-toggle[aria-expanded="true"]::before{content:"\\25BE"}
|
|
644
|
+
.${lt}__cb-hover{fill:var(--lattice-hovered-background);pointer-events:none}
|
|
645
|
+
.${lt}__cb-time:focus-visible{outline:2px solid var(--lattice-focus-color);outline-offset:-2px}
|
|
646
|
+
`}const ht="data-lat-gantt-chartband-styles";function Ot(lt,nt){const ot=lt&<.documentElement;if(!ot||ot.getAttribute(ht))return;ot.setAttribute(ht,"1");try{v(lt)}catch{}const vt=lt.createElement("style");vt.textContent=st(nt).trim(),(lt.head||lt.body||ot).appendChild(vt)}class wt{cfg;root=null;time=null;axis=null;axisRight=null;plot=null;last=null;#t;#i=null;#e=null;#n=null;#s=null;#o=null;#l=null;#h=null;#f=null;#p=new Map;#g=null;#a=null;#d=[];#c=null;#y=[];#r=-1;#m=null;#w=new Set;#E=i({});constructor(nt,ot){this.#t=nt,this.cfg=ot,this.#g=k({scheme:ot.scheme,palette:ot.palette},{memory:this.#p})}get collapsed(){return!!this.cfg.collapsed}build(nt){const ot=this.#t,vt=ot.ns,gt=ot.doc;this.root=U(gt,"div",`${vt}__cb`),this.root.setAttribute("data-chart-band",this.cfg.id),this.root.setAttribute("role","group"),this.root.setAttribute("aria-label",this.#k()),this.root.style.flex=`0 0 ${this.cfg.height}px`,this.#i=U(gt,"div",`${vt}__cb-head`),this.#i.style.height=`${this.cfg.rowHeight}px`;const Ht=gt.createElement("button");Ht.setAttribute("type","button"),Ht.setAttribute("class",`${vt}__cb-toggle`),Ht.addEventListener("click",()=>this.setCollapsed(!this.cfg.collapsed)),this.#n=Ht,this.#i.appendChild(Ht);const Pt=U(gt,"span",`${vt}__cb-title`);K(Pt,this.#k()),this.#i.appendChild(Pt),this.#i.appendChild(U(gt,"div",`${b}__legend ${vt}__cb-legend`)),this.root.appendChild(this.#i),this.#e=U(gt,"div",`${vt}__cb-body`),this.axis=U(gt,"div",`${vt}__cb-axis`),this.axis.style.width=`${ot.gridWidth()}px`,this.#e.appendChild(this.axis),this.#e.appendChild(U(gt,"div",`${vt}__divider`)),this.time=U(gt,"div",`${vt}__cb-time`),this.#e.appendChild(this.time),this.axisRight=U(gt,"div",`${vt}__cb-axis ${vt}__cb-axis--right`),this.axisRight.setAttribute("hidden",""),this.#e.appendChild(this.axisRight),this.root.appendChild(this.#e),nt.appendChild(this.root),this.#s=U(gt,"div",`${b}__tooltip ${vt}__cb-tooltip`),this.#s.setAttribute("role","tooltip"),this.#s.setAttribute("hidden",""),this.root.appendChild(this.#s),this.time.setAttribute("tabindex","0"),this.time.setAttribute("aria-label",this.#k()),this.time.addEventListener("pointermove",this.#j),this.time.addEventListener("pointerleave",this.#x),this.time.addEventListener("keydown",this.#U),this.time.addEventListener("blur",this.#x),this.#c=null,this.#P(),this.#C()}#P(){for(const nt of this.#y)try{nt()}catch{}this.#y=[];for(const nt of this.cfg.series){const ot=nt.grid&&nt.grid.grid;if(!(!ot||typeof ot.on!="function"))for(const vt of["filter:changed","rows:changed","model:changed","cell:changed"]){let gt=null;try{gt=ot.on(vt,()=>this.#t.redraw())}catch{gt=null}gt&&this.#y.push(gt)}}}#k(){return this.cfg.title!=null&&this.cfg.title!==""?String(this.cfg.title):String(this.cfg.id)}#M=()=>{this.#t.syncScroll(this.time)};#D(nt){const ot=this.#a;if(!ot)return-1;for(let vt=0;vt<this.#d.length;vt+=1){const gt=this.#d[vt];if(nt>=ot(gt.start)&&nt<ot(gt.end))return vt}return-1}#j=nt=>{if(!this.time||!this.last)return;const ot=this.time.getBoundingClientRect(),vt=this.#D(nt.clientX-ot.left+this.time.scrollLeft);if(vt<0){this.#X();return}this.#O(vt,nt.clientX,nt.clientY)};#x=()=>{this.#X()};#U=nt=>{if(!this.time||!this.last||!this.#d.length)return;if(nt.key==="Escape"){this.#r>=0&&(this.#X(),nt.preventDefault());return}if(nt.key!=="ArrowLeft"&&nt.key!=="ArrowRight")return;nt.preventDefault();let ot=this.#r;ot<0?ot=Math.max(0,this.#D(this.time.scrollLeft)):ot=Math.min(this.#d.length-1,Math.max(0,ot+(nt.key==="ArrowRight"?1:-1)));const vt=this.#a,gt=this.#d[ot],Ht=vt(gt.start),Pt=vt(gt.end);Ht<this.time.scrollLeft?this.time.scrollLeft=Ht:Pt>this.time.scrollLeft+this.time.clientWidth&&(this.time.scrollLeft=Pt-this.time.clientWidth);const et=this.time.getBoundingClientRect();this.#O(ot,et.left+(Ht+Pt)/2-this.time.scrollLeft,et.top+et.height/2)};#q(nt){const ot=this.#t,vt=Ht=>typeof ot.formatDate=="function"?ot.formatDate(Ht):D(Ht),gt=Math.max(nt.start,nt.end-1);return gt===nt.start?vt(nt.start):`${vt(nt.start)} – ${vt(gt)}`}#O(nt,ot,vt){const gt=this.#s;if(!gt||!this.root||!this.last)return;const Ht=this.#t.doc,Pt=this.#d[nt];if(!Pt)return;const et=this.#t.locale(),ft=[];if(this.last.series.forEach((q,jt)=>{this.#w.has(q.id)||ft.push({key:q.id,label:q.title,colour:this.#F(jt,q.title),value:B(q.values[nt]==null?null:q.values[nt],this.cfg,et)})}),m(Ht,gt,this.#q(Pt),ft),gt.setAttribute("data-bucket",String(nt)),gt.removeAttribute("hidden"),this.#r=nt,this.#m&&this.#a){const q=Math.round(this.#a(Pt.start));this.#m.setAttribute("x",String(q)),this.#m.setAttribute("width",String(Math.max(1,Math.round(this.#a(Pt.end))-q))),this.#m.setAttribute("visibility","visible")}h(gt,Ht.defaultView,ot,vt)}#X(){this.#r=-1,this.#s&&(this.#s.setAttribute("hidden",""),this.#s.removeAttribute("data-bucket")),this.#m&&this.#m.setAttribute("visibility","hidden")}setCollapsed(nt){const ot=!!this.cfg.collapsed;this.cfg.collapsed=!!nt,this.#C(),ot!==this.cfg.collapsed&&this.root&&this.#t.redraw()}#C(){if(!this.root)return;const nt=this.#t.ns;this.root.classList.toggle(`${nt}__cb--collapsed`,!!this.cfg.collapsed),this.root.style.flex=this.cfg.collapsed?"0 0 auto":`0 0 ${this.cfg.height}px`,this.#n&&(this.#n.setAttribute("aria-expanded",this.cfg.collapsed?"false":"true"),this.#n.setAttribute("aria-label",this.#t.t(this.cfg.collapsed?"gantt.row.expand":"gantt.row.collapse",{name:this.#k()})))}#F(nt,ot){return this.#g?this.#g.seriesNamed(nt,ot):"var(--lattice-chart-0)"}#V(nt){const ot=this.last?this.last.series.indexOf(nt):0;return this.#F(Math.max(0,ot),nt.title)}#J(nt,ot){const vt=[];for(const gt of ot)if(gt.axis===nt)for(const Ht of gt.values)Ht!=null&&vt.push(Ht);return g(vt,{zero:!0})}data(){if(!this.last)return null;const nt={};for(const ot of this.last.series)nt[ot.id]=ot.values.slice();return{buckets:this.last.buckets.map(ot=>({start:D(ot.start),end:D(ot.end)})),series:nt}}render(nt){if(!this.root)return;const ot=this.#t,vt=ot.ns,gt=ot.doc,Ht=ot.locale();this.#a=nt.x,this.#d=nt.buckets,this.last=pt(this.cfg,nt.buckets,nt.zoom||null);const Pt=Math.max(40,this.cfg.height-this.cfg.rowHeight),et=Tt,ft=Pt-Tt,q=this.#E.small,jt=a(0),Et=r(gt,this.axis),mt=this.last.series,yt=mt.filter(Yt=>!this.#w.has(Yt.id)),tt=yt.filter(Yt=>Yt.axis==="right"),Mt=(Yt,re)=>{const Lt=d(this.#J(Yt,yt),[ft,et]),ne={},Zt=C(Lt,ne),ct=Dt=>Zt.reduce((zt,Ut)=>Math.max(zt,Et(Dt(Ut),q)),0);let bt=Dt=>B(Dt,this.cfg,Ht),Ct=ct(bt);if(Ct+jt+kt>re){const Dt=Ut=>x(Ut,this.cfg,Ht),zt=ct(Dt);zt<Ct&&(bt=Dt,Ct=zt)}return{scale:Lt,tick:bt,widest:Ct,config:ne}},It=ot.gridWidth();this.axis.style.width=`${It}px`;const Rt=Mt("left",It),Xt=tt.length?Mt("right",1/0):null,Vt=Xt?Math.ceil(Xt.widest+jt+kt):0;Xt?(this.axisRight.removeAttribute("hidden"),this.axisRight.style.width=`${Vt}px`):this.axisRight.setAttribute("hidden","");const $t=(Yt,re)=>{let Lt=Yt.firstChild;(!Lt||Lt.tagName!=="svg")&&(Yt.replaceChildren(),Lt=Y(gt,"svg",{class:`${vt}__cb-plot`}),Yt.appendChild(Lt)),Lt.setAttribute("width",String(re)),Lt.setAttribute("height",String(Pt)),Lt.setAttribute("viewBox",`0 0 ${re} ${Pt}`),W(Lt);const ne=Y(gt,"g",{class:`${b}__axis`});return Lt.appendChild(ne),ne};this.#h=$t(this.axis,It),this.#f=$t(this.axisRight,Math.max(0,Vt));let Bt=this.time.firstChild;(!Bt||Bt.tagName!=="svg")&&(this.time.replaceChildren(),Bt=Y(gt,"svg",{class:`${vt}__cb-plot`,role:"img","aria-label":this.#k()}),this.time.appendChild(Bt)),Bt.setAttribute("width",String(nt.width)),Bt.setAttribute("height",String(Pt)),Bt.setAttribute("viewBox",`0 0 ${nt.width} ${Pt}`),W(Bt),this.#l=Y(gt,"g",{class:`${b}__grid`,transform:`translate(${-It} 0)`}),Bt.appendChild(this.#l),this.#m=Y(gt,"rect",{class:`${vt}__cb-hover`,x:0,y:0,width:0,height:Pt}),this.#m.setAttribute("visibility","hidden"),Bt.appendChild(this.#m),this.#o=Y(gt,"g",{class:`${vt}__cb-marks`}),Bt.appendChild(this.#o);const pe={top:Tt,bottom:Tt};_({gridGroup:this.#l,axisGroup:this.#h,plot:{left:It,right:It+nt.width,top:et,bottom:ft,width:nt.width,height:ft-et,gutter:{...pe,left:It,right:0}},scale:Rt.scale,format:{tick:Rt.tick},label:Rt.tick,config:Rt.config,size:q}),Xt&&_({gridGroup:Y(gt,"g"),axisGroup:this.#f,plot:{left:-nt.width,right:0,top:et,bottom:ft,width:nt.width,height:ft-et,gutter:{...pe,left:0,right:Vt}},scale:Xt.scale,format:{tick:Xt.tick},label:Xt.tick,config:{...Xt.config,grid:!1},size:q,side:"right"}),this.#rt(mt),this.#Q(yt,Rt.scale,Xt?Xt.scale:Rt.scale),this.#X(),this.time&&this.#c==null&&(this.time.addEventListener("scroll",this.#M),this.#c=()=>this.time.removeEventListener("scroll",this.#M));const we=ot.timeScrollLeft();this.time.scrollLeft!==we&&(this.time.scrollLeft=we)}#rt(nt){const ot=this.#t.ns,vt=this.#i?this.#i.querySelector(`.${ot}__cb-legend`):null;vt&&(vt.replaceChildren(),nt.forEach((gt,Ht)=>{const Pt=$(this.#t.doc,{label:gt.title,colour:this.#F(Ht,gt.title),on:!this.#w.has(gt.id),shape:gt.mark==="line"?"line":"square",size:this.#E.small});Pt.setAttribute("data-series",gt.id),Pt.addEventListener("click",()=>this.toggleSeries(gt.id)),vt.appendChild(Pt)}))}toggleSeries(nt,ot){const vt=String(nt),gt=ot===void 0?this.#w.has(vt):!!ot;return gt?this.#w.delete(vt):this.#w.add(vt),this.#t.redraw(),gt}#Q(nt,ot,vt){const gt=this.#o,Ht=q=>q.axis==="right"?vt:ot,Pt=[...nt.filter(q=>q.mark==="bar"),...nt.filter(q=>q.mark!=="bar")],et=[],ft=new Map;for(const q of Pt)q.mark==="bar"&&(q.stack?ft.has(q.stack)?ft.get(q.stack).push(q):(ft.set(q.stack,[q]),et.push(ft.get(q.stack))):et.push([q]));et.forEach((q,jt)=>this.#dt(gt,q,Ht(q[0]),jt,et.length));for(const q of Pt)q.mark==="line"?this.#N(gt,q,Ht(q)):q.mark==="area"&&this.#ht(gt,q,Ht(q))}#dt(nt,ot,vt,gt,Ht){const Pt=this.#t.doc,et=this.#t.ns,ft=this.#a,q=this.#d;for(let jt=0;jt<q.length;jt+=1){const Et=q[jt],mt=Math.round(ft(Et.start))+Ft,yt=Math.max(mt+1,Math.round(ft(Et.end))-Ft);if(yt<=mt)continue;const tt=(yt-mt+Ft)/Ht,Mt=Math.round(mt+gt*tt),It=Math.round(mt+(gt+1)*tt-Ft);if(It<=Mt)continue;let Rt=0,Xt=0;for(let Vt=0;Vt<ot.length;Vt+=1){const $t=ot[Vt],Bt=$t.values[jt];if(Bt==null)continue;const pe=this.#V($t);let we,Yt;ot.length>1?Bt>=0?(we=vt.of(Rt),Yt=vt.of(Rt+Bt),Rt+=Bt):(we=vt.of(Xt),Yt=vt.of(Xt+Bt),Xt+=Bt):(we=vt.of(0),Yt=vt.of(Bt));const re=Math.min(we,Yt),Lt=Math.max(1,Math.abs(Yt-we)),ne=Y(Pt,"rect",{class:`${et}__cb-bar`,x:Mt,y:l(re),width:l(It-Mt),height:l(Lt),fill:pe});ne.setAttribute("data-series",$t.id),ne.setAttribute("data-bucket",String(jt)),nt.appendChild(ne)}}}#N(nt,ot,vt){const gt=this.#t.doc,Ht=this.#t.ns,Pt=this.#a,et=[];for(let jt=0;jt<this.#d.length;jt+=1){const Et=ot.values[jt];if(Et==null)continue;const mt=this.#d[jt];et.push([(Pt(mt.start)+Pt(mt.end))/2,vt.of(Et)])}if(!et.length)return;const ft=et.map((jt,Et)=>`${Et?"L":"M"}${l(jt[0])},${l(jt[1])}`).join(""),q=Y(gt,"path",{class:`${Ht}__cb-line`,d:ft,fill:"none",stroke:this.#V(ot),"stroke-width":2,"stroke-linejoin":"round"});q.setAttribute("data-series",ot.id),nt.appendChild(q)}#ht(nt,ot,vt){const gt=this.#t.doc,Ht=this.#t.ns,Pt=this.#a,et=vt.of(0),ft=[];for(let Et=0;Et<this.#d.length;Et+=1){const mt=ot.values[Et];if(mt==null)continue;const yt=this.#d[Et];ft.push([(Pt(yt.start)+Pt(yt.end))/2,vt.of(mt)])}if(!ft.length)return;let q=ft.map((Et,mt)=>`${mt?"L":"M"}${l(Et[0])},${l(Et[1])}`).join("");q+=`L${l(ft[ft.length-1][0])},${l(et)}L${l(ft[0][0])},${l(et)}Z`;const jt=Y(gt,"path",{class:`${Ht}__cb-area`,d:q,fill:this.#V(ot),"fill-opacity":.2,stroke:this.#V(ot),"stroke-width":2});jt.setAttribute("data-series",ot.id),nt.appendChild(jt)}exportModel(){return{id:this.cfg.id,title:this.#k(),height:this.cfg.collapsed?this.cfg.rowHeight:this.cfg.height,rowHeight:this.cfg.rowHeight,collapsed:!!this.cfg.collapsed,data:this.data()}}destroy(){this.#c&&(this.#c(),this.#c=null),this.time&&(this.time.removeEventListener("pointermove",this.#j),this.time.removeEventListener("pointerleave",this.#x),this.time.removeEventListener("keydown",this.#U),this.time.removeEventListener("blur",this.#x));for(const nt of this.#y)try{nt()}catch{}this.#y=[],this.root&&this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.root=this.time=this.axis=this.axisRight=this.plot=null,this.last=null}}class Jt{bands;#t;constructor(nt,ot){this.#t=nt,this.bands=ot.map(vt=>new wt(nt,vt))}build(nt){Ot(this.#t.doc,this.#t.ns);for(const ot of this.bands)ot.build(nt)}panes(){return this.bands.map(nt=>nt.time).filter(Boolean)}height(){return this.bands.reduce((nt,ot)=>nt+(ot.root&&ot.root.offsetHeight||0),0)}get(nt){return this.bands.find(ot=>ot.cfg.id===String(nt))||null}render(nt){for(const ot of this.bands)ot.render(nt)}getState(){const nt={};for(const ot of this.bands)nt[ot.cfg.id]={collapsed:ot.collapsed};return nt}setState(nt){if(!(!nt||typeof nt!="object"))for(const[ot,vt]of Object.entries(nt)){const gt=this.get(ot);!gt||!vt||typeof vt!="object"||typeof vt.collapsed=="boolean"&>.setCollapsed(vt.collapsed)}}exportModels(){return this.bands.map(nt=>nt.exportModel())}destroy(){for(const nt of this.bands)nt.destroy();this.bands=[]}}}),ae("packages/modules/gantt/print.js",function(p,V){"use strict";Object.defineProperty(p,"PDF_MODEL_KEY",{enumerable:!0,get:function(){return L}}),Object.defineProperty(p,"PDF_REGISTRY_KEY",{enumerable:!0,get:function(){return v}}),Object.defineProperty(p,"pdfModule",{enumerable:!0,get:function(){return w}}),Object.defineProperty(p,"ganttPrintModel",{enumerable:!0,get:function(){return g}});const U=V("packages/modules/gantt/export.js").cellText,Y=V("packages/modules/gantt/time.js").toISODate,l=V("packages/modules/gantt/links.js").linkSides,L=Symbol.for("lattice-grid.pdf.model"),v=Symbol.for("lattice-grid.modules.pdf"),b=6;function w(){const d=globalThis[v];return d&&typeof d.exportPdf=="function"?d:null}function k(d,S,_,C){return{id:String(S),depth:_||0,cells:C,es:Number.isFinite(d.es)?d.es:null,ef:Number.isFinite(d.ef)?d.ef:null,milestone:!!(d.isMilestone||d.milestone),summary:!!d.isSummary,critical:!!d.critical,progress:d.percentComplete==null?null:Number(d.percentComplete)}}function u(d){return(d||[]).map(S=>{const _=l(S.type);return{from:String(S.from),to:String(S.to),depart:_.depart,arrive:_.arrive}})}function g(d){const{controller:S}=d,_=d.exportModel||null;let C,a,o,m,$;if(_)C=_.columns.map((y,i)=>({title:String(y.title||y.id||y.key||""),width:_.columnWidths[i]||100})),a=_.rows.map((y,i)=>k(y.rec,y.id,y.depth,_.cellTexts?_.cellTexts[i].map(r=>r==null?"":String(r)):_.columns.map(r=>U(r,y.rec,_.rawById.get(String(y.id))||null)))),o=_.domainMin,m=_.domainMax,$=_.pxPerDay;else{const y=S.schedule,i=y&&y.ok?y.tasks:new Map;C=[{title:"Name",width:200},{title:"Start",width:90},{title:"End",width:90}],a=[],o=1/0,m=-1/0;for(const[r,f]of i)a.push(k(f,r,0,[f.name??String(r),Y(f.es)??"",Y(f.ef)??""])),Number.isFinite(f.es)&&(o=Math.min(o,f.es)),Number.isFinite(f.ef)&&(m=Math.max(m,f.ef));Number.isFinite(o)||(o=0,m=30),o-=1,m+=2,$=b}const h=[];if(typeof d.nonWorking=="function")for(let y=Math.floor(o);y<Math.ceil(m);y++)d.nonWorking(y)&&h.push(y);return{kind:"gantt",element:d.element||null,messages:d.messages||null,title:S.title||null,columns:C,rows:a,links:u(S.dependencies),domainMin:o,domainMax:m,pxPerDay:$,today:_&&Number.isFinite(_.today)?_.today:null,nonWorking:h}}}),ae("packages/modules/gantt/split.js",function(p,V){"use strict";Object.defineProperty(p,"SPLIT_NS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(p,"GanttSplitView",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(p,"mountGanttSplit",{enumerable:!0,get:function(){return hr}});const St=V("packages/modules/shared/axislabels.js"),U=St.thinLabels,K=St.estimateLabelWidth,W=V("packages/modules/shared/token-scope.js").claimTokenScope,l=V("packages/modules/gantt/roles.js"),L=l.ROLE_DEFAULTS,v=l.expand,b=V("packages/modules/charts/svg.js"),w=b.svg,k=b.el,u=b.setText,g=b.path,d=b.round,_=V("packages/modules/charts/scale.js").linearScale,C=V("packages/modules/gantt/time.js"),a=C.fromDayNumber,o=C.toISODate,m=C.toDayNumber,h=V("packages/modules/gantt/zoom.js").ZOOM_PRESETS,i=V("packages/modules/gantt/calendar.js").createCalendar,f=V("packages/modules/gantt/calendar-shading.js").rowNonWorking,M=V("packages/modules/gantt/links.js"),D=M.routeLink,I=M.arrowheadPath,B=V("packages/modules/gantt/messages.js").createTranslator,H=V("packages/modules/gantt/colour.js"),z=H.resolveTaskColour,at=H.darkenColour,dt=H.contrastColour,Tt=V("packages/modules/gantt/resources.js").parseAssignments,Ft=V("packages/modules/gantt/avatar.js"),P=Ft.avatarChip,j=Ft.avatarColor,x=V("packages/modules/gantt/gestures.js"),R=x.GanttGestures,N=x.describeTask,X=V("packages/modules/gantt/events-pointer.js"),G=X.TaskPointerEvents,J=X.drawProgressHandle,Q=X.progressHandleCss,pt=X.partOfElement,st=X.partOfTask,ht=X.gateTooltipShow,Ot=X.fireTooltipHide,wt=X.TOUCH_TARGET,lt=V("packages/modules/gantt/events-link.js").LinkPointerEvents,ot=V("packages/modules/gantt/events-table.js").CellTableEvents,vt=V("packages/modules/gantt/resize-handle.js"),gt=vt.drawResizeHandle,Ht=vt.resizeHandleCss,Pt=vt.setBaseDescription,et=vt.restoreDescription,q=V("packages/modules/gantt/assignment-picker.js").AssignmentPicker,Et=V("packages/modules/gantt/link-editor.js").LinkEditor,mt=V("packages/modules/gantt/workload.js"),yt=mt.WORKLOAD_DEFAULTS,tt=mt.HISTOGRAM_DEFAULTS,Mt=mt.computeWorkload,It=mt.workloadBuckets,Rt=mt.formatHours,Xt=mt.formatPercent,Vt=mt.formatCost,$t=mt.statedHours,Bt=mt.taskContour,pe=mt.setContourBucket,we=mt.serializeContour,Yt=mt.spreadHours,re=mt.recordWorkingDays,Lt=mt.normalizeThresholds,ne=mt.thresholdFor,Zt=mt.normalizeExternalLoad,ct=V("packages/modules/gantt/workload-groups.js"),bt=ct.GROUP_KEY_PREFIX,Ct=ct.isGroupKey,Dt=ct.normalizeGroupBy,zt=ct.groupOfResource,Ut=ct.groupWorkloadRows,oe=ct.groupBookingSubRows,me=V("packages/core/src/internal/warn.js").warnOnce,Fe=V("packages/core/src/internal/ready.js").createReadySignal,je=V("packages/modules/gantt/workload-events.js"),Ee=je.emitWorkloadCell,Se=je.gateWorkloadCell,qe=je.workloadCellPayload,He=V("packages/modules/gantt/export.js"),ln=He.buildSplitSVG,pn=He.buildPrintDocument,ie=He.rasterizePNG,xe=He.openPrintWindow,Ge=He.resolveVar,Ne=V("packages/modules/gantt/tooltip.js"),_e=Ne.resolveTaskTooltip,Me=Ne.positionTooltip,Ze=Ne.tooltipCss,Pe=V("packages/modules/gantt/markers.js").normalizeMarkers,he=V("packages/modules/gantt/link-text.js"),Ke=he.buildLinkColumns,zn=he.buildRefIndex,Yn=he.linksText,Sn=he.planLinkEdit,mn=he.LINK_COLUMN_ROLE,ri=V("packages/modules/gantt/task-columns.js"),Un=ri.buildExtraTaskColumns,cn=ri.extraRowData,Zn=ri.extraEditPatch,Wi=ri.EXTRA_TASK_COLUMN_IDS,hn=V("packages/modules/gantt/split-grid.js"),ui=hn.SplitGridTable,di=hn.resolveTableColumns,vi=hn.keptAncestors,si=V("packages/modules/gantt/band-grid.js"),_i=si.bucketColumnSpec,ji=si.bucketColumnWidths,Ni=si.pinStart,Si=V("packages/modules/gantt/wbs.js").compareWbs,bn=V("packages/modules/gantt/date-editor.js").SplitDateEditor,Xn=V("packages/modules/gantt/draw-event.js").createDrawEventScheduler,qn=V("packages/modules/gantt/issues-panel.js"),on=qn.createIssuesPanel,Ui=qn.issuesPanelCss,yn=V("packages/modules/gantt/events-range.js"),Ii=yn.createVisibleRangeNotifier,le=yn.visibleRangeDays,fe=V("packages/modules/gantt/events-scroll.js").createScrollNotifier,Tn=V("packages/modules/shared/autosize.js"),Jn=Tn.watchBox,oi=Tn.watchSize,An=Tn.contentWidth,Qn=Tn.contentHeight,Hn=V("packages/modules/gantt/unscheduled.js").unscheduledMarker,xi=V("packages/modules/gantt/inactive.js").inactiveMarker,Ci=V("packages/dom/src/ui/contextmenu.js").ContextMenu,Ai=V("packages/modules/gantt/zoom-control.js"),Ki=Ai.ZOOM_LEVELS,Vi=Ai.createZoomControl,an=Ai.zoomControlCss,ze=V("packages/modules/gantt/dirty-tracking.js").dirtyFieldsByTask,Gn=V("packages/modules/gantt/week.js"),Nn=Gn.EXPLICIT_WEEK_START_DAY,Yi=Gn.resolveWeekStartDay,Zi=Gn.validWeekStartDay,On=Gn.weekStartOf,Ln=V("packages/modules/gantt/paste.js").createClipboardKeys,hi=V("packages/modules/gantt/task-actions.js"),Fi=hi.defaultTaskMenu,Xi=hi.createTaskActionKeys,Ji=V("packages/modules/gantt/table-defaults.js").resolveTableConfig,fi=V("packages/modules/gantt/split-header-fit.js").fitHeaderToTable,gi=V("packages/modules/gantt/pinch.js").attachGanttPinch,pi=V("packages/modules/gantt/data-band.js"),tr=pi.DataBands,$n=pi.normalizeDataBands,Mn=V("packages/modules/gantt/chart-band.js"),ti=Mn.ChartBands,In=Mn.normalizeChartBands,ai=mt.workloadBuckets,mi=V("packages/modules/gantt/print.js"),en=mi.ganttPrintModel,Ri=mi.PDF_MODEL_KEY,ei=mi.pdfModule,Mi=60,li=.5,un=600,s="lat-gantt-split",Z="data-lat-gantt-split-styles",xt=8,At=32,Kt=40,be=80,ce=160,ye=80,Le=120,Ve=600,Re=150,nn=120,Dn=150,xn=40,Fn=`${s}__cell--dirty`,bi=Object.freeze({assignee:"assignments"}),ci=Object.freeze({height:null,rowHeight:34,headerHeight:44,gridWidth:620,indent:16,wrapNames:!1,zoom:"day",zoomControl:null,pinchZoom:!0,today:null,markers:null,nonWorking:null,calendar:null,showArrows:!0,showProgress:!0,showBaseline:!0,showCritical:!0,criticalStyle:"fill",barLabel:"name",barLabelPosition:"right",barColour:null,columns:null,locale:null,weekStartDay:null,dateFormat:null,progressLine:null,hoverChain:!0,editable:!0,keyboard:!0,resizeZone:6,tooltip:!0,workload:null,histogram:null,contextMenu:null,issuesPanel:!1,resourceOnly:!1,dataBands:null,chartBands:null}),Ti=11,dn=5,_n=2,gn=11,wn=4,Cn=6,Xe=8;let Rn=0;const ni=Object.freeze(new Set(["hours","percent","cost"])),Bi=Object.freeze({hours:"percent",percent:"cost",cost:"hours"}),Kn=Object.freeze({day:h.day,week:h.week,month:h.month,quarter:h.quarter}),Ei=["S","M","T","W","T","F","S"],Vn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ii=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],De=new Set(["start","end","duration"]),Be=new Set(["effort","units"]),Qe=Object.freeze({name:"name",start:"start",end:"end",duration:"duration",progress:"percentComplete",effort:"effort",units:"units"}),Pn=new Set([...Be,"slack","deadline","unscheduled","inactive","wbs"]);function jn(it){return typeof it=="function"?it:typeof it=="string"&&it?{type:"date",pattern:it}:null}function Wn(it,t,e){return e-t<=1e-9?it>=e?1:0:it<=t?0:it>=e?1:(it-t)/(e-t)}function Oi(){const it=s;return`
|
|
638
647
|
.${it}{${L}--lattice-toggle-size:24px;position:relative;font:var(--lattice-font-size)/var(--lattice-line-height) var(--lattice-font-family);color:var(--lattice-foreground);display:flex;flex-direction:column;border:1px solid var(--lattice-border-color);border-radius:var(--lattice-radius);overflow:hidden;box-sizing:border-box}
|
|
639
648
|
.${it} *{box-sizing:border-box}
|
|
640
649
|
.${it}__head{display:flex;flex:0 0 auto;overflow:hidden;background:var(--lattice-surface);border-bottom:1px solid var(--lattice-border-color)}
|
|
@@ -731,14 +740,14 @@ ${Y()}
|
|
|
731
740
|
.${it}__plot{display:block}
|
|
732
741
|
.${it}__shade{fill:var(--lattice-gantt-nonworking)}
|
|
733
742
|
.${it}__rowsep{stroke:var(--lattice-border-color);stroke-width:1}
|
|
734
|
-
.${it}__bar{fill:var(--lattice-gantt-bar)}
|
|
743
|
+
.${it}__bar{fill:var(--lattice-gantt-bar);cursor:grab}
|
|
735
744
|
.${it}__bar--critical{fill:var(--lattice-gantt-critical)}
|
|
736
745
|
.${it}__bar--critical-outline{stroke:var(--lattice-gantt-critical);stroke-width:2}
|
|
737
746
|
.${it}__bar--overalloc{stroke:var(--lattice-variant-danger-solid);stroke-width:2;stroke-dasharray:3 2}
|
|
738
747
|
.${it}__bar--conflict{stroke:var(--lattice-variant-warning-solid);stroke-width:2}
|
|
739
748
|
.${it}__progress{fill:var(--lattice-gantt-progress)}
|
|
740
749
|
.${it}__summary-bar{fill:var(--lattice-gantt-summary)}
|
|
741
|
-
.${it}__milestone{fill:var(--lattice-gantt-milestone)}
|
|
750
|
+
.${it}__milestone{fill:var(--lattice-gantt-milestone);cursor:grab}
|
|
742
751
|
.${it}__baseline{fill:var(--lattice-gantt-baseline);opacity:0.7}
|
|
743
752
|
.${it}__barlabel{fill:var(--lattice-gantt-bar-fg);font-size:var(--lattice-font-size-sm);dominant-baseline:middle}
|
|
744
753
|
.${it}__barlabel--inside{fill:var(--lattice-accent-contrast)}
|
|
@@ -802,8 +811,8 @@ ${Y()}
|
|
|
802
811
|
.${it}__tooltip{position:absolute;pointer-events:none;z-index:5}
|
|
803
812
|
.${it}__tooltip[hidden]{display:none}
|
|
804
813
|
${Ze(it)}
|
|
805
|
-
${
|
|
806
|
-
${
|
|
814
|
+
${Q(it)}
|
|
815
|
+
${Ht(it)}
|
|
807
816
|
.${it}__today{stroke:var(--lattice-gantt-today);stroke-width:1.5;stroke-dasharray:4 3}
|
|
808
817
|
.${it}__marker{stroke:var(--lattice-foreground-muted);stroke-width:1.5;pointer-events:none}
|
|
809
818
|
.${it}__marker-range{fill:var(--lattice-range-background);pointer-events:none}
|
|
@@ -905,30 +914,30 @@ ${an(it)}
|
|
|
905
914
|
@scope ([data-theme="dark"]){:scope.${it},.${it}{color-scheme:dark}}
|
|
906
915
|
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${it},.${it}{color-scheme:light}}
|
|
907
916
|
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${it},.${it}{color-scheme:dark}}}
|
|
908
|
-
`.trim()}function yi(it){const t=it.documentElement;if(!t||t.getAttribute(Z))return;t.setAttribute(Z,"1");const e=it.createElement("style");e.textContent=v(Oi()),(it.head||it.body||t).appendChild(e)}function Di(){return[{key:"name",title:"Task name",width:0,kind:"name"},{key:"start",title:"Start",width:96,kind:"start"},{key:"end",title:"Finish",width:96,kind:"end"},{key:"duration",title:"Duration",width:84,kind:"duration"},{key:"assignee",title:"Assignee",width:96,kind:"assignee"},{key:"progress",title:"%",width:56,kind:"progress"}]}function dr(it){if(!Array.isArray(it)||!it.length)return Di();const t=new Map(Di().map(n=>[n.key,n]));t.set("effort",{key:"effort",title:null,width:76,kind:"effort"}),t.set("units",{key:"units",title:null,width:76,kind:"units"}),t.set("unscheduled",{key:"unscheduled",title:null,width:96,kind:"unscheduled"}),t.set("slack",{key:"slack",title:null,width:76,kind:"slack"}),t.set("deadline",{key:"deadline",title:null,width:96,kind:"deadline"}),t.set("wbs",{key:"wbs",title:null,width:64,kind:"wbs"});const e=it.map(n=>typeof n=="string"?t.get(n):n).filter(Boolean);return e.length?e:Di()}class lr{#t;#i;#e;#n;#s;#o=null;#l=null;#d=null;#g="custom";#p=null;#h=null;#a=null;#f=null;#c=null;#b=null;#r=null;#m=new Set;#y=new Set;#D=new Set;#P=[];#w=[];#T=!1;#N=null;#E=null;#x=null;#K=new Set;#ot=new Set;#O=new Set;#V=null;#A=null;#L=[];#Y=null;#q=null;#nt=null;#J=null;#Q=null;#I=null;#_t=null;#Pt;#Z=null;#at=null;#tt=null;#St=!1;#et=null;#ft=null;#jt=null;#Nt=null;#Ut=!1;#gt=null;#yt=null;#pt=null;#kt=null;#$t=null;#Xt=null;#qt=null;#Jt=null;#Gt=null;#Qt=null;#F=null;#wt=null;#Lt=null;#It=null;#te=null;#en=0;#nn=null;#lt=null;#z=null;#ee=null;#_e=null;#H=null;#it=null;#xt=null;#de=null;#Ft=null;#Rt=null;#ne=null;#ie=null;#Se=null;#re=null;#se=null;#u=null;#Bt=null;#yn="";#ct=null;#Kt=null;#$e=null;#oe=1;#rt=!1;#zt=null;#xe=null;#Vt=null;#Ct=!1;#kn=Fe();get ready(){return this.#kn.promise}#k=null;#R=null;#mt=null;#At=null;#v=null;#Ce=null;#Ae=null;#Me=null;#Te=null;#Ee=null;#Oe=null;#De=null;#Pe=null;#je=null;#zn=null;#W=null;#Ht=null;#wn=new Map;#he=new Set;#Ne=new Set;#B=null;#vn=!1;#in=null;#S=null;#j=null;#Mt=null;#Yt=null;#_=null;#Le=null;#ut=null;#U=null;#Ie=null;#Fe=null;#Re=null;#Be=null;#ze=null;#He=null;#We=null;#Ue=null;#Ge=null;#vt=null;#rn=new Map;#M=null;#sn=new Map;#_n=null;#Zt=null;#Ke=null;#dt=null;#C=null;#Ve=null;#Ye=[];#Ze=null;#Hn={};#fe=new Set;#Sn=new Map;#$=null;#ge=new Map;#Wn=null;#Un=null;#ae=null;#on=null;#an=null;#ln=null;#cn=null;#un=null;#dn=null;#hn=null;#le=null;#G=null;#Tt=!1;#Gn=null;#bt=null;#Xe=null;#qe=null;constructor(t,e,n={}){this.#t=t,this.#i=e,this.#e=e.ownerDocument,this.#n={...ci,...n},this.#s=dr(n.columns),this.#g=typeof this.#n.zoom=="string"&&Kn[this.#n.zoom]?this.#n.zoom:"custom",this.#L=je(this.#n.markers,0),yi(this.#e),this.#u=z(t,()=>this.#n.messages),this.#a=k(this.#e,"div",s),this.#q=H(this.#a,this.#i),this.#a.setAttribute("role","table"),this.#St=Number.isFinite(Qn(this.#i)),this.#bi(),this.#a.style.setProperty("--lattice-gantt-row-height",`${Number(this.#n.rowHeight)||34}px`),this.#n.resourceOnly&&this.#a.classList.add(`${s}--resource-only`);const c=k(this.#e,"div",`${s}__head`);this.#f=k(this.#e,"div",`${s}__grid-head`),this.#f.style.width=`${this.#X()}px`,this.#b=k(this.#e,"div",`${s}__time-head`),c.appendChild(this.#f),c.appendChild(k(this.#e,"div",`${s}__divider`)),c.appendChild(this.#b);const A=k(this.#e,"div",`${s}__body`);this.#c=k(this.#e,"div",`${s}__grid-body`),this.#c.style.width=`${this.#X()}px`,this.#r=k(this.#e,"div",`${s}__time-body`),A.appendChild(this.#c),this.#bt=k(this.#e,"div",`${s}__divider ${s}__divider--resize`),this.#bt.setAttribute("tabindex","0"),this.#bt.setAttribute("role","separator"),this.#bt.setAttribute("aria-orientation","vertical"),this.#Xe=E=>this.#Qn(E,"grid"),this.#qe=E=>this.#ei(E,"grid"),this.#bt.addEventListener("pointerdown",this.#Xe),this.#bt.addEventListener("keydown",this.#qe),A.appendChild(this.#bt),A.appendChild(this.#r),this.#a.appendChild(c),this.#a.appendChild(A),this.#h=this.#qi(c),this.#Xs(c),this.#k=this.#Kr(),this.#S=this.#Vr(),this.#k&&this.#S&&(this.#S.unit=this.#k.unit,this.#S.thresholds=this.#k.thresholds),this.#yi(),this.#k&&this.#Qr(),this.#S&&this.#gs();const M=typeof n.createGrid=="function"?$n(this.#n.dataBands):[];M.length&&(this.#o=new tr(this.#uo(),M),this.#o.build(this.#a));const F=In(this.#n.chartBands);if(F.length&&(this.#d=new ti(this.#do(),F),this.#d.build(this.#a)),this.#n.issuesPanel&&this.#Hs(),this.#i.appendChild(this.#a),this.#i.__latticeGantt||(this.#i.__latticeGantt=this),this.#dt=typeof n.createGrid=="function"?n.createGrid:null,this.#dt&&!this.#n.resourceOnly&&this.#qs(),this.#jt=()=>{this.#Et(this.#r),this.#gn(this.#r),this.#ui()},this.#r.addEventListener("scroll",this.#jt),this.#Nt=()=>{this.#gn(this.#c),this.#ts(this.#c),this.#ui()},this.#c.addEventListener("scroll",this.#Nt),this.#Z=Ii(E=>t.emitVisibleRangeChange(E),()=>{const E=this.#r,rt=le(this.#M,E?E.scrollLeft:0,E?E.clientWidth:0);return rt?{view:this,start:o(rt.start),end:o(rt.end),zoom:this.#qn().level}:null}),this.#tt=Jn({targets:[this.#r],read:()=>({width:An(this.#r)}),apply:()=>{this.#z&&this.draw(),this.#Z.note()}}),this.#Yr(),this.#at=fe(E=>t.emitScroll(E),()=>{const E=this.#r;return E?{view:this,top:E.scrollTop,left:E.scrollLeft}:null}),this.#n.hoverChain&&(this.#gt=E=>this.#Zs(E),this.#yt=()=>this.#mn(),this.#c.addEventListener("pointerover",this.#gt),this.#c.addEventListener("pointerleave",this.#yt),this.#r.addEventListener("pointerover",this.#gt),this.#r.addEventListener("pointerleave",this.#yt)),this.#n.editable&&(this.#Xt=E=>this.#Ms(E),this.#c.addEventListener("dblclick",this.#Xt)),this.#Bt=k(this.#e,"div",`${s}__live`),this.#Bt.setAttribute("role","status"),this.#Bt.setAttribute("aria-live","polite"),this.#a.appendChild(this.#Bt),this.#n.tooltip&&(this.#H=k(this.#e,"div",`${s}__tooltip`),this.#H.setAttribute("hidden",""),this.#it=k(this.#e,"div",`${s}__tip-arrow`),this.#H.appendChild(this.#it),this.#a.appendChild(this.#H),A.addEventListener("scroll",()=>this.#ue()),this.#r.addEventListener("scroll",()=>this.#ue())),this.#F=new R({doc:this.#e,controller:t,options:()=>this.#n,plot:()=>this.#r?this.#r.querySelector(`.${s}__plot`):null,rowOf:E=>E&&E.closest?E.closest(`.${s}__barrow`):null,barOf:E=>E.querySelector(`.${s}__bar`)||E.querySelector(`.${s}__milestone`),pxPerDay:()=>this.#oe,announce:E=>this.#ht(E,{repeat:!0}),t:(E,rt)=>this.#u(E,rt),iso:E=>o(E),redraw:()=>this.draw(),previewDrag:E=>this.#Cs(E),focusTask:E=>{this.#ct=E},editing:()=>this.#rt,connectorOf:E=>E&&E.closest?E.closest(`.${s}__connector`):null,linkOf:E=>E&&E.closest?E.closest(`.${s}__linkgroup`):null,milestoneOf:E=>E&&E.closest?E.closest(`.${s}__milestone`):null,showLinkPreview:(E,rt,_t,ut)=>this.#Mr(E,rt,_t,ut),hideLinkPreview:()=>this.#Tr(),openLinkEditor:(E,rt,_t)=>this.#Ar(E,rt,_t),view:()=>this,progressOf:E=>E&&E.closest?E.closest(`.${s}__progresshandle`):null,resizeStartOf:E=>E&&E.closest?E.closest(`.${s}__resizehandle`):null,nsOf:()=>s,scrollers:()=>this.#r?[this.#r]:[]}),this.#wt=new G({controller:t,ns:s,view:()=>this,rowOf:E=>E&&E.closest?E.closest(`.${s}__barrow`):null,dayAt:E=>this.#er(E),date:E=>o(E),dragging:()=>!!(this.#F&&this.#F.dragging),consumeDragRelease:()=>!!(this.#F&&this.#F.consumeDragRelease()),keyboard:!!this.#n.keyboard}),this.#wt.attach(this.#r),this.#Lt=new dt({controller:t,view:()=>this,linkOf:E=>E&&E.closest?E.closest(`.${s}__linkgroup`):null}),this.#Lt.attach(this.#r),this.#n.editable&&(this.#qt=E=>this.#F.onPointerDown(E),this.#r.addEventListener("pointerdown",this.#qt),this.#F.attachTouch(this.#r)),this.#p=gi({pane:this.#r,enabled:()=>this.#n.pinchZoom!==!1,model:()=>this.#M,zoom:()=>this.#n.zoom,setZoom:(E,rt)=>this.setZoom(E,rt),scrollTo:E=>{this.#r.scrollLeft=E,this.#Et(this.#r)}}),this.#n.keyboard){this.#Jt=_t=>this.#F.onKey(_t),this.#r.addEventListener("keydown",this.#Jt);const E=Ln({controller:t,focused:()=>this.#ct,editing:()=>this.#rt,announce:_t=>this.#ht(_t,{repeat:!0}),t:(_t,ut)=>this.#u(_t,ut)}),rt=Xi({controller:t,focused:()=>this.#ct,editing:()=>this.#rt,focusTask:_t=>{this.#ct=_t},announce:_t=>this.#ht(_t,{repeat:!0}),t:(_t,ut)=>this.#u(_t,ut)});this.#Gt=_t=>{this.#F.onHistoryKey(_t),E.onKey(_t),rt.onKey(_t)},this.#a.addEventListener("keydown",this.#Gt),this.#Qt=E.onPaste,this.#a.addEventListener("paste",this.#Qt)}this.#n.tooltip&&(this.#Ft=E=>this.#Br(E),this.#Rt=()=>this.#ue(),this.#r.addEventListener("pointermove",this.#Ft),this.#r.addEventListener("pointerleave",this.#Rt),this.#ne=E=>this.#Hr(E),this.#r.addEventListener("focus",this.#ne,!0),this.#r.addEventListener("blur",this.#Rt,!0),this.#ie=E=>{E.key==="Escape"&&this.#ue()},this.#r.addEventListener("keydown",this.#ie)),this.#N=E=>this.#Zn(E),this.#r.addEventListener("click",this.#N),!this.#C&&this.#c&&(this.#x=E=>this.#Zn(E),this.#c.addEventListener("click",this.#x)),this.#n.keyboard&&(this.#E=E=>this.#nr(E),this.#r.addEventListener("keydown",this.#E)),this.#n.keyboard&&!this.#C&&this.#c&&(this.#$e=E=>this.#$r(E),this.#c.addEventListener("keydown",this.#$e)),this.#Bn()?(this.#Se=new Ci({document:this.#e,host:this.#a}),this.#re=E=>this.#Vi(E,"contextmenu"),this.#se=E=>this.#Vi(E,"keydown"),this.#c.addEventListener("contextmenu",this.#re),this.#r.addEventListener("contextmenu",this.#re),this.#c.addEventListener("keydown",this.#se),this.#r.addEventListener("keydown",this.#se)):(this.#It=E=>this.#fo(E),this.#c.addEventListener("contextmenu",this.#It),this.#r.addEventListener("contextmenu",this.#It)),this.#Y=t.on("schedule",()=>this.draw()),this.#o&&(this.#o.noteSpans(t.schedule),this.#l=t.on("datesChanged",E=>{this.#o&&this.#o.onDatesChanged(E,this.#t.schedule)&&this.draw()})),this.#n.dirtyMarks&&(this.#nt=t.on("dirtyChange",()=>this.draw())),this.#J=t.on("rowMove",E=>this.#xr(E)),this.#Q=t.on("rowMove:cancelled",()=>{this.#ht(this.#u("gantt.a11y.rowMoveCancelled"),{repeat:!0})}),this.#Pt=Xn(E=>t.emitDraw(E)),this.draw(),this.#Z.note(),t.emitViewMount({view:this,element:this.#a}),this.#kn.settleAfterFrames()}get element(){return this.#a}get options(){return{...this.#n}}get scroller(){return this.#a?this.#a.querySelector(`.${s}__time-body`):null}get zoomControl(){return this.#h?this.#h.element:null}#Zi(t){if(!this.#r||!this.#M)return;const e=String(t),n=this.#M.rows.find(F=>String(F.id)===e);if(!n)return;this.#$n(this.#r,"scrollTop","clientHeight",n.top,n.height,()=>this.#gn(this.#r));const c=n.rec||{};if(!Number.isFinite(c.es)||!Number.isFinite(this.#M.pxPerDay)||this.#M.pxPerDay<=0)return;const A=(c.es-this.#M.domainMin)*this.#M.pxPerDay,M=(c.ef-this.#M.domainMin)*this.#M.pxPerDay;this.#$n(this.#r,"scrollLeft","clientWidth",A,Math.max(0,M-A),()=>this.#Et(this.#r))}#$n(t,e,n,c,A,M){const F=t[e],E=t[n]||0;let rt=F;c<F?rt=c:c+A>F+E&&(rt=c+A-E),rt!==F&&(t[e]=Math.max(0,Math.round(rt)),M())}scrollToDate(t){const e=this.#r,n=this.#M;if(!e||!n||!Number.isFinite(n.pxPerDay)||n.pxPerDay<=0)return;const c=p(t);Number.isFinite(c)&&this.#Kn((c-n.domainMin)*n.pxPerDay)}#Kn(t){const e=this.#r,n=Math.max(0,Math.round(t-(e.clientWidth||0)/2));n!==e.scrollLeft&&(e.scrollLeft=n,this.#Et(e))}setZoom(t,e="api"){const n=this.#g,c=this.#r,A=this.#M;let M=null;c&&A&&Number.isFinite(A.pxPerDay)&&A.pxPerDay>0&&(M=A.domainMin+(c.scrollLeft+(c.clientWidth||0)/2)/A.pxPerDay),this.#n.zoom=t,this.#g=typeof t=="string"&&Kn[t]?t:"custom",this.draw(),M!=null&&c&&this.#M&&Number.isFinite(this.#M.pxPerDay)&&this.#Kn((M-this.#M.domainMin)*this.#M.pxPerDay),this.#t.emitZoomChange({view:this,from:n,to:this.#g,cause:e,pxPerDay:this.#oe}),this.#Z.note()}fitZoom(t="api"){const e=this.#g,n=this.#r,c=this.#M,A=c&&Number.isFinite(c.domainMin)&&Number.isFinite(c.domainMax)?c.domainMax-c.domainMin:0,M=n?n.clientWidth:0;this.#g="fit",this.#n.zoom=A>0&&M>0?M/A:Kn.day.px,this.draw(),n&&(n.scrollLeft=0,this.#Et(n)),this.#t.emitZoomChange({view:this,from:e,to:this.#g,cause:t,pxPerDay:this.#oe}),this.#Z.note()}visibleRange(){const t=this.#r,e=le(this.#M,t?t.scrollLeft:0,t?t.clientWidth:0);return e?{start:o(e.start),end:o(e.end)}:null}#Xi(){const t=this.#n.zoomControl;if(!t)return null;const e=t===!0?{}:t&&typeof t=="object"?t:{},n=e.position==="toolbar"?"toolbar":"header",c=Array.isArray(e.levels)?e.levels:[...Ki];return{position:n,levels:c}}#qi(t){const e=this.#Xi();if(!e)return null;const n=Vi({doc:this.#e,view:this,t:this.#u,levels:e.levels,ns:s});return e.position==="header"&&t.appendChild(n.element),n}#X(){return Math.max(80,Number(this.#n.gridWidth)||620)}#Vn(t){const e=t&&Number.isFinite(Number(t.labelWidth))?Number(t.labelWidth):0;return e>0?Math.max(Kt,e):nn}#Ji(){const t=`${this.#X()}px`;this.#f&&(this.#f.style.width=t),this.#c&&(this.#c.style.width=t),this.#At&&(this.#At.style.width=t),this.#Yt&&(this.#Yt.style.width=t)}rowGeometry(){return this.#P.map(t=>({...t}))}get collapsed(){return new Set(this.#m)}toggle(t,e={}){const n=String(t),c=!this.#m.has(n),A=new Set(this.#m);c?A.add(n):A.delete(n);const M=this.#t.schedule,F=M&&M.ok?M.tasks.get(n):null;this.#t.emitTaskToggle(c,{id:n,expandedIds:this.#tr(A),rawTask:this.#Yn(n),task:F||null,view:this,event:e.event||null},()=>{c?this.#m.add(n):this.#m.delete(n),this.draw()})}#Qi(){const t=this.#t.schedule;if(!t||!t.ok)return[];const e=new Map;for(const c of t.order){const A=t.tasks.get(c),M=A.parent==null?"__root__":String(A.parent);e.has(M)||e.set(M,[]),e.get(M).push(c)}const n=[];for(const c of t.order)t.tasks.get(c).isSummary&&(e.get(String(c))||[]).length>0&&n.push(String(c));return n}#tr(t){return this.#Qi().filter(e=>!t.has(e))}#Yn(t){const e=String(t);return this.#t.tasks.find(n=>String(this.#t.readId(n))===e)||null}#er(t){const e=this.#r?this.#r.querySelector(`.${s}__plot`):null;if(!e||!e.getBoundingClientRect||!(this.#oe>0))return null;const n=e.getBoundingClientRect().left||0;return((t.clientX||0)-n-this.#en)/this.#oe}#Zn(t){if(!t||t.target&&t.target.closest&&t.target.closest("button"))return;const e=t.target&&t.target.closest?t.target.closest("[data-task]"):null,n=e?e.getAttribute("data-task"):null;n!=null&&this.#t.selectAt(String(n),{toggle:!!(t.ctrlKey||t.metaKey),range:!!t.shiftKey,order:this.#w.slice(),cause:"pointer",event:t})}#nr(t){if(!t||t.key!=="ArrowUp"&&t.key!=="ArrowDown")return;const e=t.key==="ArrowDown"?1:-1,n=this.#t.selectStep(e,{order:this.#w.slice(),event:t});if(n!=null&&(t.preventDefault&&t.preventDefault(),this.#ct=n,this.#ir(n),this.#r)){const c=this.#r.querySelector(`.${s}__barrow[data-task="${n}"]`);c&&c.focus&&c.focus()}}#ir(t){if(!this.#r)return;const e=String(t),n=this.#P.find(c=>c.id===e);n&&(this.#$n(this.#r,"scrollTop","clientHeight",n.top,n.height,()=>this.#gn(this.#r)),this.#On())}reflectSelection(){if(this.#Ct)return;const t=new Set(this.#t.selected());if(this.#r)for(const e of this.#r.querySelectorAll(`.${s}__barrow`)){const n=e.getAttribute("data-task"),c=n!=null&&t.has(String(n));e.classList.toggle(`${s}__barrow--selected`,c),c?e.setAttribute("aria-selected","true"):e.removeAttribute("aria-selected")}if(this.#C&&this.#C.grid&&this.#C.grid.selection){const e=new Set(this.#w),n=this.#t.selected().filter(M=>e.has(M)),c=this.#C.grid.selection.keys?this.#C.grid.selection.keys().slice().sort():null,A=n.slice().sort();if(!c||c.length!==A.length||c.some((M,F)=>M!==A[F])){this.#T=!0;try{this.#C.grid.selection.set(n)}finally{this.#T=!1}}}else if(this.#c)for(const e of this.#c.querySelectorAll("[data-task]")){const n=e.getAttribute("data-task");e.classList.toggle(`${s}__row--selected`,n!=null&&t.has(String(n)))}}setShowCritical(t){this.#n.showCritical=!!t,this.draw()}scrollToTask(t){const e=String(t);if(this.#Ct)return!1;if(this.#D.has(e))return typeof this.#t.emitTaskFiltered=="function"&&this.#t.emitTaskFiltered({id:e}),!1;const n=this.#t.schedule,c=n&&n.tasks?n.tasks.get(e):null;if(!c)return!1;let A=!1;for(let F=c.parent;F!=null;F=n.tasks.get(String(F)).parent)this.#m.delete(String(F))&&(A=!0);return A&&this.draw(),this.#P.find(F=>F.id===e)?(this.#Zi(e),!0):!1}draw(){if(this.#Ct)return;const t=this.#t.schedule;if(!t||!t.ok)return;this.#Ji();const e=t.overAllocations||[];if(this.#K=new Set(e.map(Te=>Te.resource)),this.#ot=new Set(e.flatMap(Te=>Te.taskIds)),this.#O=new Set((t.conflicts||[]).map(Te=>Te.id)),this.#de=this.#n.tooltip?new Map(this.#t.tasks.map(Te=>[String(this.#t.readId(Te)),Te])):null,this.#V=null,this.#n.evm){const Te=this.#n.evm===!0?{}:this.#n.evm,Ie=Te.statusDate!=null?Te.statusDate:Number.isFinite(this.#n.today)?this.#n.today:void 0,Ue=this.#t.earnedValue({...Te,statusDate:Ie});Ue&&Ue.ok&&(this.#V=Ue.byTask)}this.#A=this.#rr(t);let n=this.#xn(t);this.#C&&(n=this.#io(n,t));const c=this.#Xn(n);this.#P=c,this.#w=n.map(Te=>Te.id),this.#t.noteVisibleTasks(this.#w);const A=c.length?c[c.length-1].top+c[c.length-1].height:0,M=this.#qn(),F=t.projectStart,E=t.projectFinish,rt=this.#n.resourceOnly?[]:[F,E];Number.isFinite(this.#n.today)&&rt.push(this.#n.today);for(const Te of this.#L)Te.date!=null?rt.push(Te.date):rt.push(Te.from,Te.to);if(this.#n.resourceOnly&&this.#k)for(const Te of this.#k.external||[])Number.isFinite(Te.start)&&rt.push(Te.start),Number.isFinite(Te.end)&&rt.push(Te.end);rt.length||rt.push(F,E);const _t=Math.floor(Math.min(...rt)),ut=Math.ceil(Math.max(...rt)),Nt=Math.max(1,Math.round((ut-_t)*.04)),Wt=_t-Nt,te=ut+Nt,ue=M.px,re=!Number.isFinite(this.#n.height)&&!this.#St&&this.#r?this.#r.offsetWidth:0,Xt=re>0?re:An(this.#r),Qt=this.#As(n,Wt,ue),ee=Math.round((te-Wt)*ue);let ke=ee;Number.isFinite(Xt)&&(ke=Math.max(ke,Xt)),Number.isFinite(Xt)&&ee<Xt&&Qt>0&&(ke=Math.max(ke,Qt+Xe));const pe=ke>ee?Math.ceil(Wt+ke/ue):te,Ae=Math.max(1,Math.round((pe-Wt)*ue)),Ce=_({min:Wt,max:pe},[0,Ae]);this.#oe=Ce.of(1)-Ce.of(0),this.#en=Ce.of(0);const Oe=Te=>d(Ce.of(Te));if(this.#C)this.#ro();else if(this.#sr(),this.#fr(t,n,c),this.#ct&&this.#c){const Te=this.#c.querySelector(`.${s}__row[data-task="${this.#ct}"]`);Te&&Te.focus&&Te.focus()}if(this.#Or(M,Wt,pe,Oe,Ae),this.#z={schedule:t,rows:n,geometry:c,x:Oe,width:Ae,totalHeight:A,min:Wt,max:pe},this.#Rr(t,n,c,Oe,Ae,A,Wt,pe),this.#in){const Te=this.getWorkloadUnit();this.#in.setAttribute("aria-pressed",Te==="hours"?"false":"true"),this.#in.setAttribute("data-unit",Te)}if(this.#h&&this.#h.update(this.#g),this.#k&&this.#es(t,M,Wt,te,pe,Oe,Ae),this.#S&&this.#ms(t,M,Wt,pe,Oe,Ae),this.#o){let Te=null;this.#o.render({rows:n,allRows:this.#xn(t,!0),rawById:new Map(this.#t.tasks.map(Ie=>[String(this.#t.readId(Ie)),Ie])),buckets:ai(M.level,Math.floor(Wt),Math.ceil(pe),this.#ce()),zoom:M.level,x:Oe,width:Ae,collapsedIds:this.#m,costByTask:()=>{if(Te==null){const Ie=this.#t.costByBucket(Math.floor(Wt),Math.ceil(pe),{zoom:M.level,by:"task",weekStartDay:this.#ce()});Te=Ie.ok?Ie.byTask:null}return Te}})}this.#d&&this.#d.render({buckets:ai(M.level,Math.floor(Wt),Math.ceil(pe),this.#ce()),zoom:M.level,x:Oe,width:Ae}),this.#Jr(),this.#Zr();const Se=new Map(this.#t.tasks.map(Te=>[String(Te.id),Te]));let Ye=this.#s,Je=this.#Je(),tn=null;if(this.#C){const Te=this.#C.grid,Ie=this.#Mn(Te,"name");Ye=Ie.columns,Je=Ie.columnWidths,tn=n.map((Ue,Pi)=>Ie.visible.map(ki=>this.#An(Te,String(Ue.id),ki,Pi)))}this.#M={columns:Ye,columnWidths:Je,cellTexts:tn,rows:n.map(Te=>({id:Te.id,rec:Te.rec,depth:Te.depth,...c.find(Ie=>Ie.id===Te.id)})),rawById:Se,totalHeight:A,domainMin:Wt,domainMax:te,pxPerDay:this.#oe,zoomLevel:M.level,today:Number.isFinite(this.#n.today)?this.#n.today:null,rowHeight:this.#n.rowHeight,title:this.#n.title||null,workload:this.#k?{cfg:this.#k,data:this.#B}:null,histogram:this.#S?{cfg:this.#S,data:this.#ut}:null,dataBands:this.#o?this.#o.exportModels():null,chartBands:this.#d?this.#d.exportModels():null},this.reflectSelection(),this.#Pt({view:this,element:this.#a,range:{start:Wt,end:pe},zoom:M.level})}#rr(t){const e=this.#n.progressLine;if(e&&typeof e=="object"&&e.statusDate!=null){const n=p(e.statusDate);if(Number.isFinite(n))return n}if(this.#n.evm&&this.#n.evm!==!0&&this.#n.evm.statusDate!=null){const n=p(this.#n.evm.statusDate);if(Number.isFinite(n))return n}return Number.isFinite(this.#n.today)?this.#n.today:Number.isFinite(t.projectFinish)?t.projectFinish:null}#xn(t,e=!1){const n=new Map;for(const M of t.order){const F=t.tasks.get(M),E=F.parent==null?"__root__":String(F.parent);n.has(E)||n.set(E,[]),n.get(E).push(M)}const c=[],A=(M,F)=>{for(const E of n.get(M)||[]){const rt=t.tasks.get(E),_t=!!rt.isSummary&&(n.get(E)||[]).length>0;c.push({id:E,rec:rt,depth:F,hasChildren:_t}),_t&&(e||!this.#m.has(E))&&A(E,F+1)}};return A("__root__",0),c}#Xn(t){const e=Number(this.#n.rowHeight)||34,n=new Map(this.#t.tasks.map(rt=>[String(this.#t.readId(rt)),rt])),c=this.#s.find(rt=>rt.kind==="name"),A=!!this.#dt||!!this.#n.wrapNames,M=A?c&&c.width?c.width:this.#X()-this.#s.filter(rt=>rt.kind!=="name").reduce((rt,_t)=>rt+(_t.width||0),0):0,F=[];let E=0;for(const rt of t){const _t=n.get(rt.id)||{};let ut=e;if(Number.isFinite(_t.height))ut=Math.max(e,Number(_t.height));else if(A){const Nt=Math.max(24,M-rt.depth*(this.#n.indent||16)-28),Wt=Math.max(4,Math.floor(Nt/7)),te=Math.max(1,Math.ceil(String(rt.rec.name||"").length/Wt));te>1&&(ut=Math.max(e,te*18+12))}F.push({id:rt.id,top:E,height:ut}),E+=ut}return F}#qn(){const t=this.#n.zoom;return Number.isFinite(t)?{px:Number(t),step:1,level:"custom"}:typeof t=="string"&&Kn[t]?Kn[t]:Kn.day}#pe(){if(this.#n.calendar){const t=i(this.#n.calendar,0);if(t)return e=>!t.isWorking(e)}return this.#n.nonWorking==="weekends"?t=>{const e=a(t),n=e?e.getUTCDay():0;return n===0||n===6}:typeof this.#n.nonWorking=="function"?this.#n.nonWorking:null}#sr(){const t=this.#f;for(;t.firstChild;)t.removeChild(t.firstChild);t.style.height=`${this.#n.headerHeight}px`;const e=this.#Je();if(this.#s.forEach((n,c)=>{const A=k(this.#e,"div",`${s}__colhead`);A.style.width=`${e[c]}px`,A.style.flex=`0 0 ${e[c]}px`,u(A,n.title||(Pn.has(n.kind)?this.#u(`gantt.col.${n.kind}`):n.key)),n.resizable!==!1&&A.appendChild(this.#or(n)),t.appendChild(A)}),this.#_n){const n=t.querySelector(`.${s}__colresize[data-resize-key="${this.#_n}"]`);n&&n.focus&&n.focus()}}#or(t){const e=k(this.#e,"div",`${s}__colresize`);return e.setAttribute("data-resize-key",t.key),e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical"),e.addEventListener("pointerdown",n=>this.#Qn(n,t.key)),e.addEventListener("keydown",n=>this.#ei(n,t.key)),e}#Je(){const t=this.#X(),e=this.#s.findIndex(c=>c.kind==="name"),n=this.#s.map((c,A)=>this.#sn.has(c.key)?this.#sn.get(c.key):A===e?null:c.width||80);if(e>=0&&n[e]==null){const c=n.reduce((A,M,F)=>F===e?A:A+M,0);n[e]=Math.max(this.#fn(this.#s[e]),t-c)}return n}#fn(t){return Number.isFinite(t.minWidth)?Math.max(1,Number(t.minWidth)):t.kind==="name"?ce:Kt}#Jn(t){return Number.isFinite(t.maxWidth)?Math.max(this.#fn(t),Number(t.maxWidth)):1/0}#Cn(t){return`${t.isTotal?"__total__":t.key}\0${t.taskId??""}`}#ar(t,e){const n=ut=>{const Nt=ut&&ut.layout;return typeof Nt=="number"?{width:Nt}:Nt||{}},c=ut=>{if(typeof ut=="number")return ut>0?ut:0;if(typeof ut!="string")return 0;const Nt=ut.trim();if(!Nt.endsWith("%")){const te=Number(Nt);return Number.isFinite(te)&&te>0?te:0}const Wt=Number(Nt.slice(0,-1));return!Number.isFinite(Wt)||Wt<=0?0:e>0?e*Wt/100:0},A=(ut,Nt)=>Math.min(Math.max(ut,Nt.min>0?Nt.min:xn),Nt.max>0?Nt.max:1/0),M=new Array(t.length),F=[];let E=0;for(let ut=0;ut<t.length;ut++){const Nt=n(t[ut]);if(Nt.flex>0)F.push(ut),M[ut]=0;else{const Wt=c(Nt.width);M[ut]=A(Wt>0?Wt:Dn,Nt),E+=M[ut]}}if(!F.length)return M;let rt=Math.max(0,e-E),_t=F.slice();for(let ut=0;ut<=F.length&&_t.length>0;ut++){let Nt=0;for(const ue of _t)Nt+=n(t[ue]).flex;if(Nt<=0)break;const Wt=[];let te=!1;for(const ue of _t){const Gt=n(t[ue]),re=rt*Gt.flex/Nt,Xt=A(re,Gt);M[ue]=Xt,Math.abs(Xt-re)>.5?(rt-=Xt,te=!0):Wt.push(ue)}if(!te)break;_t=Wt}return M}#An(t,e,n,c){const A=t.rows.text(e,n.id),M=n.cell&&n.cell.render;if(typeof M!="function")return A;const F=t.messages&&typeof t.messages.t=="function"?t.messages.t:(_t=>_t);let E;try{const _t=t.rows.byKey(e);E={value:t.rows.value(e,n.id),text:A,data:_t?_t.data:null,row:_t,column:n,colId:n.id,grid:t,index:c,t:F,context:t.context,props:n.cell.props}}catch{return A}let rt;try{rt=M(E)}catch{return A}return typeof rt=="string"?rt:this.#fe.has(M)?A:rt&&rt.nodeType!=null&&typeof rt.textContent=="string"?rt.textContent:A}#Mn(t,e){const n=t.columns.visible();return{columns:n.map(A=>({id:A.id,title:A.title??A.id,kind:e&&A.id===e?e:null})),columnWidths:this.#ar(n,this.#X()),visible:n}}#lr(){const t=this.#a&&Number.isFinite(this.#a.clientWidth)?this.#a.clientWidth:0;return t>0?Math.max(ye,t-Ne):1/0}#Tn(t){if(t==="grid")return this.#X();const e=this.#s.findIndex(n=>n.key===t);return e<0?0:this.#Je()[e]}#cr(t){if(t==="grid")return"The table/timeline divider";const e=this.#s.find(n=>n.key===t);return e?e.title||e.key:t}#En(t,e){if(t==="grid"){const A=Math.round(Math.max(ye,Math.min(this.#lr(),e)));return this.#n.gridWidth=A,this.draw(),A}const n=this.#s.find(A=>A.key===t);if(!n||n.resizable===!1)return this.#Tn(t);const c=Math.round(Math.max(this.#fn(n),Math.min(this.#Jn(n),e)));return this.#sn.set(t,c),this.draw(),c}#ur(){return{grid:this.#X(),...this.getColumnWidths()}}#me(t,e){typeof this.#t.emitColumnResize=="function"&&this.#t.emitColumnResize({key:t,width:e,widths:this.#ur()})}#Qn(t,e){if(t&&t.button!=null&&t.button!==0)return;this.#Zt={key:e,startX:t&&t.clientX||0,startWidth:this.#Tn(e)},t&&t.preventDefault&&t.preventDefault();const n=A=>this.#dr(A),c=A=>this.#hr(A);this.#Ke={move:n,up:c},this.#e.addEventListener("pointermove",n),this.#e.addEventListener("pointerup",c)}#dr(t){if(!this.#Zt)return;const e=(t&&t.clientX||0)-this.#Zt.startX;this.#En(this.#Zt.key,this.#Zt.startWidth+e)}#hr(t){const e=this.#Zt;if(this.#ti(),this.#Zt=null,!e)return;const n=(t&&t.clientX||0)-e.startX,c=this.#En(e.key,e.startWidth+n);c!==e.startWidth&&this.#me(e.key,c)}#ti(){this.#Ke&&(this.#e.removeEventListener("pointermove",this.#Ke.move),this.#e.removeEventListener("pointerup",this.#Ke.up),this.#Ke=null)}#ei(t,e){if(!(t.key==="ArrowLeft"||t.key==="ArrowRight"))return;t.preventDefault&&t.preventDefault();const c=t.shiftKey?At:$t,A=t.key==="ArrowRight"?c:-c,M=this.#Tn(e);this.#_n=e;const F=this.#En(e,M+A),E=this.#cr(e);F!==M?(this.#ht(`${E} resized to ${F}px`,{repeat:!0}),this.#me(e,F)):this.#ht(`${E} is already at its ${A<0?"minimum":"maximum"} width`,{repeat:!0})}getColumnWidths(){const t={};if(this.#C)Object.assign(t,this.#C.widths());else if(!this.#n.resourceOnly){const e=this.#Je();this.#s.forEach((n,c)=>{t[n.key]=e[c]})}for(const[e,n]of this.#ni())for(const[c,A]of Object.entries(n.widths()))t[`${e==="workload"?"band":"histogram"}:${c}`]=A;return t}#ni(){const t=[];return this.#$&&t.push(["workload",this.#$]),this.#G&&t.push(["histogram",this.#G]),t}setColumnWidths(t){if(!(!t||typeof t!="object")){for(const[e,n]of this.#ni()){const c=e==="workload"?"band:":"histogram:";n.freezeColumns();for(const[A,M]of Object.entries(t)){const F=A.startsWith(c)?A.slice(c.length):null;if(F==null||!Number.isFinite(M))continue;const E=n.grid.columns.get(F);E&&E.layout&&E.layout.resizable!==!1&&n.grid.columns.resize(F,M)}}if(this.#C){const e=this.#C.grid;this.#C.freezeColumns();for(const[n,c]of Object.entries(t)){if(n==="grid"||!Number.isFinite(c))continue;const A=e.columns.get(n);A&&A.layout&&A.layout.resizable!==!1&&e.columns.resize(n,c)}this.draw();return}if(this.#n.resourceOnly){this.draw();return}for(const e of this.#s){const n=t[e.key];!Number.isFinite(n)||e.resizable===!1||this.#sn.set(e.key,Math.round(Math.max(this.#fn(e),Math.min(this.#Jn(e),n))))}this.draw()}}#fr(t,e,n){const c=this.#c;for(;c.firstChild;)c.removeChild(c.firstChild);const A=new Map(this.#t.tasks.map(E=>[String(this.#t.readId(E)),E])),M=this.#Je(),F=M.reduce((E,rt)=>E+(rt||0),0);e.forEach((E,rt)=>{const _t=n[rt],ut=k(this.#e,"div",`${s}__row${E.rec.isSummary?` ${s}__row--summary`:""}${E.rec.late?` ${s}__row--late`:""}`);ut.style.width=`${F}px`,ut.style.height=`${_t.height}px`,ut.setAttribute("role","row"),ut.setAttribute("data-task",E.id),ut.setAttribute("data-row-top",String(_t.top)),ut.setAttribute("data-row-height",String(_t.height)),(this.#n.contextMenu||this.#n.keyboard)&&ut.setAttribute("tabindex","0"),this.#s.forEach((Nt,Wt)=>{const te=this.#n.editable&&!E.rec.isSummary&&this.#Ii(Nt)!=null,ue=k(this.#e,"div",`${s}__cell${Nt.kind==="name"?` ${s}__cell--name`:""}${te?` ${s}__cell--editable`:""}`);ue.style.width=`${M[Wt]}px`,ue.style.flex=`0 0 ${M[Wt]}px`,ue.setAttribute("data-col",String(Wt)),this.#gr(ue,Nt,E,A.get(E.id)||{}),ut.appendChild(ue)}),c.appendChild(ut)})}#gr(t,e,n,c){if(typeof e.render=="function"){const M=e.render(n.rec,{rawTask:c,depth:n.depth});M&&typeof M=="object"&&typeof M.nodeType=="number"?t.appendChild(M):M!=null&&u(t,String(M));return}if(e.kind==="name"){this.#kr(t,n);return}if(e.kind==="assignee"){this.#si(t,c,n);return}if(Be.has(e.kind)){u(t,this.#oi(e.kind,n.rec));return}if(e.kind==="progress"){this.#ai(t,n.rec);return}if(e.kind==="evm"){this.#pr(t,e,n);return}if(e.kind==="plannedPercentComplete"){this.#mr(t,n);return}if(e.kind==="unscheduled"){n.rec.unscheduled&&t.appendChild(Hn(this.#e,s,this.#u));return}if(e.kind==="inactive"){this.#wr(t,n);return}if(e.kind==="slack"){u(t,this.#Er(n.rec));return}if(e.kind==="deadline"){u(t,this.#Fi(n.rec));return}if(e.kind==="wbs"){u(t,n.rec.wbs||"");return}if(De.has(e.kind)){u(t,this.#Nn(e.kind,n.rec));return}const A=c[e.key];u(t,A==null?"":String(A))}#pr(t,e,n){const c=e.metric||"spi",A=this.#V?this.#V.get(n.id):null,M=A?A[c]:null;if(M==null||!Number.isFinite(M)){u(t,"—");return}const F=c==="spi"||c==="cpi"?2:Number.isFinite(e.digits)?e.digits:0;u(t,M.toFixed(F))}#mr(t,e){const n=this.#br(e.rec);if(n==null){u(t,"—");return}u(t,String(Math.round(n)))}#br(t){if(t.isSummary||t.unscheduled||t.inactive||!Number.isFinite(this.#A))return null;const e=t.baselineStart!=null?t.baselineStart:t.es,n=t.baselineEnd!=null?t.baselineEnd:t.ef;return Wn(this.#A,e,n)*100}#yr(t,e){const n=t.percentComplete==null?0:Math.max(0,Math.min(100,t.percentComplete))/100;return e?e.dayOf(e.indexOf(t.es)+n*t.duration):t.es+n*t.duration}#kr(t,e){if(t.style.paddingLeft=`${8+e.depth*(this.#n.indent||16)}px`,this.#n.editable){const M=this.#e.createElement("button");M.setAttribute("class",`${s}__drag-handle`),M.setAttribute("type","button"),M.setAttribute("aria-hidden","true"),M.setAttribute("tabindex","-1"),M.setAttribute("aria-label",this.#u("gantt.row.moveHandle",{name:e.rec.name})),u(M,"⠿"),M.addEventListener("pointerdown",F=>this.#vr(F,e.id)),t.appendChild(M)}const n=this.#e.createElement("button");if(n.setAttribute("class",`${s}__chevron`),n.setAttribute("type","button"),e.hasChildren){const M=this.#m.has(e.id);u(n,M?"▸":"▾"),n.setAttribute("aria-label",this.#u(M?"gantt.row.expand":"gantt.row.collapse",{name:e.rec.name})),n.setAttribute("aria-expanded",M?"false":"true"),n.addEventListener("click",F=>this.toggle(e.id,{event:F})),n.addEventListener("keydown",F=>{F&&(F.key==="Enter"||F.key===" "||F.key==="Spacebar")&&(F.preventDefault&&F.preventDefault(),this.toggle(e.id,{event:F}))})}else n.setAttribute("aria-hidden","true");t.appendChild(n);const c=k(this.#e,"span",`${s}__name-text${e.rec.isSummary?` ${s}__name-text--summary`:""}${this.#n.wrapNames?"":` ${s}__name-text--nowrap`}`);u(c,e.rec.name);const A=String(e.rec.name||"");c.setAttribute("title",A),c.setAttribute("aria-label",A),t.appendChild(c),e.rec.inactive?t.appendChild(xi(this.#e,s,this.#u)):e.rec.unscheduled&&t.appendChild(Hn(this.#e,s,this.#u))}#wr(t,e){if(e.rec.isSummary)return;const n=typeof this.#t.isTaskReadOnly=="function"&&this.#t.isTaskReadOnly(e.id),c=this.#e.createElement("input");c.setAttribute("type","checkbox"),c.setAttribute("class",`${s}__inactive-check`),c.setAttribute("aria-label",this.#u("gantt.col.inactive")),c.checked=!!e.rec.inactive,c.disabled=!this.#n.editable||n,c.addEventListener("change",A=>{this.#t.applyEdit({id:e.id,inactive:c.checked},{writeBack:!0,event:A}),this.draw()}),t.appendChild(c)}#Qe(t){const e=this.#t.schedule;return!e||!e.ok?[]:e.order.filter(n=>{const c=e.tasks.get(n);return(c&&c.parent!=null?String(c.parent):null)===t})}#vr(t,e){if(!t||this.#Kt||this.#Ct)return;t.preventDefault&&t.preventDefault();const n=A=>this.#_r(A),c=A=>this.#Sr(A);this.#Kt={id:e,onMove:n,onUp:c,target:null},this.#e.addEventListener("pointermove",n),this.#e.addEventListener("pointerup",c)}#_r(t){const e=this.#Kt;if(!e||!this.#c||!t)return;this.#ii();const n=this.#e.elementFromPoint?this.#e.elementFromPoint(t.clientX,t.clientY):null,c=n&&n.closest?n.closest(`.${s}__row`):null,A=c?c.getAttribute("data-task"):null;if(!c||A==null||A===e.id){e.target=null;return}const M=this.#t.schedule,F=M&&M.ok?M.tasks.get(A):null;if(!F){e.target=null;return}const E=c.getBoundingClientRect(),rt=E.height?(t.clientY-E.top)/E.height:.5,_t=F.parent!=null?String(F.parent):null;let ut,Nt;rt<.25?(ut="before",Nt={parent:_t,index:this.#Qe(_t).indexOf(A),position:"before",target:A}):rt>.75?(ut="after",Nt={parent:_t,index:this.#Qe(_t).indexOf(A)+1,position:"after",target:A}):(ut="child",Nt={parent:A,index:void 0,position:"inside",target:A}),e.target=Nt,c.classList.add(`${s}__row--drop-${ut}`)}#ii(){if(this.#c)for(const t of["before","after","child"]){const e=this.#c.querySelector(`.${s}__row--drop-${t}`);e&&e.classList.remove(`${s}__row--drop-${t}`)}}#Sr(t){const e=this.#Kt;this.#ri(),!(!e||!e.target)&&(this.#ct=e.id,this.#t.moveRow(e.id,{...e.target,event:t||null}))}#ri(){this.#Kt&&(this.#e.removeEventListener("pointermove",this.#Kt.onMove),this.#e.removeEventListener("pointerup",this.#Kt.onUp)),this.#Kt=null,this.#ii()}#$r(t){if(!t)return;const e=t.target&&t.target.closest?t.target.closest("[data-task]"):null,n=e?e.getAttribute("data-task"):null;if(n==null)return;const c=this.#t.schedule;if(!c||!c.ok)return;const A=c.tasks.get(n);if(!A)return;const M=A.parent!=null?String(A.parent):null;if(t.altKey&&(t.key==="ArrowUp"||t.key==="ArrowDown")){const F=this.#Qe(M),E=F.indexOf(n),rt=E+(t.key==="ArrowUp"?-1:1);t.preventDefault&&t.preventDefault(),this.#ct=n;const _t=t.key==="ArrowUp"?F[E-1]:F[E+1];this.#t.moveRow(n,{parent:M,index:rt,position:t.key==="ArrowUp"?"before":"after",target:_t||null,event:t});return}if(t.key==="Tab"&&!t.shiftKey){const F=this.#Qe(M),E=F.indexOf(n),rt=E>0?F[E-1]:null;if(!rt)return;t.preventDefault&&t.preventDefault(),this.#ct=n,this.#t.moveRow(n,{parent:rt,position:"inside",target:rt,event:t});return}if(t.key==="Tab"&&t.shiftKey){if(M==null)return;const F=c.tasks.get(M),E=F&&F.parent!=null?String(F.parent):null,_t=this.#Qe(E).indexOf(M);t.preventDefault&&t.preventDefault(),this.#ct=n,this.#t.moveRow(n,{parent:E,index:_t+1,position:"after",target:M,event:t})}}#xr(t){const e=this.#t.schedule,n=e&&e.ok?e.tasks.get(t.id):null,c=n?n.name:t.id;if(t.newParent===t.oldParent){this.#ht(this.#u("gantt.a11y.rowMoved",{name:c}),{repeat:!0});return}if(t.newParent==null){this.#ht(this.#u("gantt.a11y.rowPromoted",{name:c}),{repeat:!0});return}const A=e&&e.ok?e.tasks.get(t.newParent):null;this.#ht(this.#u("gantt.a11y.rowReparented",{name:c,parent:A?A.name:t.newParent}),{repeat:!0})}#st(t){return this.#t.resourceNames.get(t)??t}#si(t,e,n){const c=Tt(e).map(F=>F.resource);let A=t;if(this.#n.editable&&n&&!n.rec.isSummary){const F=k(this.#e,"button",`${s}__picker-trigger`);F.setAttribute("type","button"),F.setAttribute("data-picker-for",n.id),F.setAttribute("aria-haspopup","dialog"),F.setAttribute("aria-label",this.#u("gantt.picker.open",{name:n.rec.name})),F.addEventListener("click",()=>this.#Cr(n.id,F)),t.appendChild(F),A=F,c.length||u(F,"+")}if(!c.length)return;const M=k(this.#e,"div",`${s}__avatars`);for(const F of c.slice(0,3)){const E=this.#st(F),rt=this.#K.has(F);M.appendChild(D(this.#e,{name:E,avatar:this.#t.resourceAvatars.get(F),over:rt,title:rt?this.#u("gantt.resource.over",{name:E}):E}))}A.appendChild(M)}#Cr(t,e){this.#rt||(this.#zt&&this.#zt.close(),this.#zt=new q(this.#t,this.#e,this.#u,t,e,()=>{this.#zt=null,this.draw()}),this.#zt.open())}#Ar(t,e,n=null){this.#rt||this.#Lt&&n&&!this.#Lt.gateDblClick(t.from,t.to,t.type,n)||(this.#zt&&this.#zt.close(),this.#xe&&this.#xe.close(),this.#xe=new Et(this.#t,this.#e,this.#u,t,e,()=>{this.#xe=null}),this.#xe.open())}#Mr(t,e,n,c){const A=this.#r?this.#r.querySelector(`.${s}__plot`):null;A&&((!this.#Vt||!this.#Vt.isConnected)&&(this.#Vt=w(this.#e,"path",{class:`${s}__linkpreview`}),A.appendChild(this.#Vt)),this.#Vt.setAttribute("d",f(["M",d(t),d(e),"L",d(n),d(c)])))}#Tr(){this.#Vt&&(this.#Vt.remove(),this.#Vt=null)}#oi(t,e){return e.isSummary?"":t==="effort"?e.effort!=null&&e.effort>0?String(d(e.effort)):"":e.units>0?`${Math.round(e.units*100)}%`:""}#Er(t){return t.isSummary||t.unscheduled||t.inactive?"":String(d(t.totalFloat))}#ai(t,e){const n=e.percentComplete==null?null:Math.max(0,Math.min(100,e.percentComplete));if(n==null)return;const c=26,A=10,M=2*Math.PI*A,F=w(this.#e,"svg",{class:`${s}__ring`,width:c,height:c,viewBox:`0 0 ${c} ${c}`});F.appendChild(w(this.#e,"circle",{class:`${s}__ring-track`,cx:c/2,cy:c/2,r:A,fill:"none","stroke-width":3})),F.appendChild(w(this.#e,"circle",{class:`${s}__ring-progress${n>=100?` ${s}__ring-progress--complete`:""}`,cx:c/2,cy:c/2,r:A,fill:"none","stroke-width":3,"stroke-dasharray":`${d(M*n/100)} ${d(M)}`,"stroke-linecap":"round",transform:`rotate(-90 ${c/2} ${c/2})`}));const E=w(this.#e,"text",{class:`${s}__ring-label`,x:c/2,y:c/2+3,"text-anchor":"middle"});u(E,String(Math.round(n))),F.appendChild(E),t.appendChild(F)}#Or(t,e,n,c,A){const M=this.#b;for(;M.firstChild;)M.removeChild(M.firstChild);M.style.height=`${this.#n.headerHeight}px`;const F=this.#n.headerHeight,E=t.level==="day"?Math.round(F*.55):F,rt=w(this.#e,"svg",{class:`${s}__plot`,width:A,height:F,viewBox:`0 0 ${A} ${F}`});rt.setAttribute("data-role","time-head");const _t=Math.floor(e),ut=Math.ceil(n),Nt=this.#pe(),Wt=An(M),te=Wt==null?null:Math.max(0,Wt-_n),ue=t.level==="month"||t.level==="quarter"?null:7;if(ue){const Gt=[];let re=On(_t,this.#ce());for(;re<ut;re+=ue){const Xt=c(re);rt.appendChild(w(this.#e,"line",{class:`${s}__bandsep`,x1:Xt,y1:0,x2:Xt,y2:F}));const Qt=a(re);Qt&&Gt.push({at:Xt,text:`${Vn[Qt.getUTCDay()]} ${String(Qt.getUTCDate()).padStart(2,"0")} ${ii[Qt.getUTCMonth()]} ${Qt.getUTCFullYear()}`})}for(const Xt of U(Gt,{fontSize:Ti,bold:!0}).kept){if(!this.#li(Xt,te))continue;const Qt=w(this.#e,"text",{class:`${s}__band`,x:Xt.at+4,y:Math.round(E*.62)});u(Qt,Xt.text),rt.appendChild(Qt)}}else{let Gt=a(_t);if(Gt){const re=[];let Xt=Date.UTC(Gt.getUTCFullYear(),Gt.getUTCMonth(),1)/864e5;for(;Xt<ut;){const Qt=a(Xt),ee=c(Xt);rt.appendChild(w(this.#e,"line",{class:`${s}__bandsep`,x1:ee,y1:0,x2:ee,y2:F})),re.push({at:ee,text:`${ii[Qt.getUTCMonth()]} ${Qt.getUTCFullYear()}`}),Xt=Date.UTC(Qt.getUTCFullYear(),Qt.getUTCMonth()+1,1)/864e5}for(const Qt of U(re,{fontSize:Ti,bold:!0}).kept){if(!this.#li(Qt,te))continue;const ee=w(this.#e,"text",{class:`${s}__band`,x:Qt.at+4,y:Math.round(F*.6)});u(ee,Qt.text),rt.appendChild(ee)}}}if(t.level==="day"){rt.appendChild(w(this.#e,"line",{class:`${s}__bandsep`,x1:0,y1:E,x2:A,y2:E}));for(let Gt=_t;Gt<ut;Gt+=1){const re=a(Gt);if(!re)continue;const Xt=(c(Gt)+c(Gt+1))/2;if(te!=null&&(Xt-dn<0||Xt+dn>te))continue;const Qt=w(this.#e,"text",{class:`${s}__dayletter${Nt&&Nt(Gt)?` ${s}__dayletter--nonwork`:""}`,x:d(Xt),y:E+Math.round((F-E)*.62)});u(Qt,Ei[re.getUTCDay()]),rt.appendChild(Qt)}}this.#Dr(rt,c,F),M.appendChild(rt),M.scrollLeft=this.#r?this.#r.scrollLeft:0}#li(t,e){return e==null?!0:t.at+4>=0&&t.at+4+t.width<=e}#Dr(t,e,n){for(const c of this.#L){if(!c.label)continue;const A=c.date!=null?c.date:(c.from+c.to)/2,M=w(this.#e,"text",{class:`${s}__marker-label`,x:d(e(A)+3),y:Math.max(4,n-4),"data-marker":String(c.index)});c.colour&&M.setAttribute("fill",c.colour),u(M,c.label),t.appendChild(M)}}#Pr(t,e,n){if(!this.#L.length)return;const c=w(this.#e,"g",{class:`${s}__markers`});for(const A of this.#L){if(A.from==null)continue;const M=e(A.from),F=e(A.to);if(F<=M)continue;const E=w(this.#e,"rect",{class:`${s}__marker-range`,x:M,y:0,width:d(F-M),height:n,"data-marker":String(A.index),"data-from":String(A.from),"data-to":String(A.to)});A.colour&&E.setAttribute("fill",A.colour),c.appendChild(E)}t.appendChild(c)}#jr(t,e,n){if(!this.#L.length)return;const c=w(this.#e,"g",{class:`${s}__markers`});for(const A of this.#L){const M=A.date!=null?[A.date]:[A.from,A.to];for(const F of M){const E=e(F),rt=w(this.#e,"line",{class:`${s}__marker`,x1:E,y1:0,x2:E,y2:n,"data-marker":String(A.index),"data-date":String(F)});A.colour&&rt.setAttribute("stroke",A.colour),A.dashed&&rt.setAttribute("stroke-dasharray","4 3"),c.appendChild(rt)}}t.appendChild(c)}#ci(t,e,n,c){const A=t.length;if(A===0)return{first:0,last:-1};const M={first:0,last:A-1};if(!(n>0)||e<=n)return M;const F=c-Ve,E=c+n+Ve,rt=this.#Nr(t,F),_t=this.#Lr(t,E);return rt>_t?{first:Math.min(rt,A-1),last:Math.min(rt,A-1)}:{first:rt,last:_t}}#Nr(t,e){let n=0,c=t.length-1,A=t.length-1;for(;n<=c;){const M=n+c>>1;t[M].top+t[M].height>e?(A=M,c=M-1):n=M+1}return A}#Lr(t,e){let n=0,c=t.length-1,A=0;for(;n<=c;){const M=n+c>>1;t[M].top<e?(A=M,n=M+1):c=M-1}return A}#ui(){if(this.#Ct||!this.#z)return;const t=this.#e.defaultView||globalThis;if(typeof t.requestAnimationFrame!="function"){this.#On();return}this.#_e==null&&(this.#_e=t.requestAnimationFrame(()=>{this.#_e=null,this.#On()}))}#On(){if(this.#Ct||!this.#z)return;const t=this.#z,e=this.#r;if(!e||!t.plot)return;const n=t.geometry,c=t.clientHeight||e.clientHeight;if(this.#lt&&n.length&&c>0){const E=n[this.#lt.first].top,rt=n[this.#lt.last],_t=rt.top+rt.height,ut=e.scrollTop,Nt=e.scrollTop+c,Wt=this.#lt.first===0||ut>=E+Re,te=this.#lt.last===n.length-1||Nt<=_t-Re;if(Wt&&te)return}const A=this.#ci(n,t.totalHeight,c,e.scrollTop);this.#lt=A;const{first:M,last:F}=A;t.perRow&&this.#di(t.plot,t.schedule,t.rows,n,t.x,t.totalHeight,t.min,t.max,t.perRow,null,M,F),this.#Ir(M,F),this.#Fr(),this.#n.progressLine&&Number.isFinite(this.#A)&&this.#mi(t.plot,t.schedule,t.rows,n,t.x,M,F),this.reflectSelection()}#Ir(t,e){const n=this.#z;for(const[c,A]of n.barEls){const M=n.rowIndex.get(c);(M==null||M<t||M>e)&&(A.remove(),n.barEls.delete(c))}for(let c=t;c<=e;c+=1){const A=n.rows[c].id;if(n.barEls.has(A))continue;const M=this.#hi(n.rows,n.geometry,n.x,n.width,c);n.barEls.set(A,M),n.bars.appendChild(M)}}#Fr(){const t=this.#z,e=t.plot.querySelector(`.${s}__links`);if(!this.#n.showArrows||!e)return;const n=this.#lt||{first:0,last:Math.max(0,t.rows.length-1)},c=new Set((t.schedule.conflicts||[]).filter(M=>M.type==="LOCKED"&&M.from!=null&&M.to!=null).map(M=>`${M.from}:${M.to}`)),A=new Set;for(const M of this.#t.dependencies){const F=String(M.from),E=String(M.to),rt=t.rowIndex.get(F),_t=t.rowIndex.get(E);rt==null||_t==null||Math.max(rt,_t)<n.first||Math.min(rt,_t)>n.last||A.add(`${F}:${E}:${M.type?String(M.type).toUpperCase():"FS"}`)}for(const[M,F]of t.linkEls)A.has(M)||(F.remove(),t.linkEls.delete(M));for(const M of this.#t.dependencies){const F=String(M.from),E=String(M.to),rt=t.rowIndex.get(F),_t=t.rowIndex.get(E);if(rt==null||_t==null||Math.max(rt,_t)<n.first||Math.min(rt,_t)>n.last)continue;const ut=M.type?String(M.type).toUpperCase():"FS",Nt=`${F}:${E}:${ut}`;if(t.linkEls.has(Nt))continue;const Wt=this.#Ei(t.schedule,t.rowIndex,t.geometry,t.x,M,c);Wt&&(t.linkEls.set(Nt,Wt),e.appendChild(Wt))}}#Rr(t,e,n,c,A,M,F,E){const rt=this.#r,_t=Array.from(rt.childNodes),ut=w(this.#e,"svg",{class:`${s}__plot`,width:A,height:M,viewBox:`0 0 ${A} ${M}`,role:"img","aria-label":"Gantt timeline"}),Nt=this.#ci(n,M,rt.clientHeight,rt.scrollTop);this.#lt=Nt;const{first:Wt,last:te}=Nt,ue=this.#pe(),Gt=b(t,e,ue);this.#di(ut,t,e,n,c,M,F,E,Gt,ue,Wt,te),this.#Pr(ut,c,M);const re=new Map(e.map((ee,ke)=>[ee.id,ke])),Xt=w(this.#e,"g",{class:`${s}__bars`});for(let ee=Wt;ee<=te;ee+=1)Xt.appendChild(this.#hi(e,n,c,A,ee));if(ut.appendChild(Xt),this.#nn={plot:ut,schedule:t,rows:e,rowIndex:re,geometry:n,x:c},this.#n.showArrows&&this.#Ti(ut,t,e,re,n,c),Number.isFinite(this.#n.today)){const ee=c(this.#n.today);ut.appendChild(w(this.#e,"line",{class:`${s}__today`,x1:ee,y1:0,x2:ee,y2:M,"data-today":String(this.#n.today)}))}this.#jr(ut,c,M),this.#n.progressLine&&Number.isFinite(this.#A)&&(this.#Gr(ut,c,M),this.#mi(ut,t,e,n,c,Wt,te)),rt.appendChild(ut);for(const ee of _t)rt.removeChild(ee);this.#z.plot=ut,this.#z.rowIndex=re,this.#z.perRow=Gt,this.#z.bars=Xt,this.#z.barEls=new Map,this.#z.linkEls=new Map,this.#z.clientHeight=rt.clientHeight;for(const ee of Xt.childNodes)this.#z.barEls.set(ee.getAttribute("data-task"),ee);const Qt=ut.querySelector(`.${s}__links`);if(Qt)for(const ee of Qt.childNodes)this.#z.linkEls.set(`${ee.getAttribute("data-from")}:${ee.getAttribute("data-to")}:${ee.getAttribute("data-type")}`,ee);if(this.#ct){const ee=ut.querySelector(`.${s}__barrow[data-task="${this.#ct}"]`);ee&&ee.focus&&ee.focus()}}#di(t,e,n,c,A,M,F,E,rt,_t,ut,Nt){const Wt=E-F<=3660,te=w(this.#e,"g",{class:`${s}__shading`});if(Wt&&rt)for(let Gt=ut;Gt<=Nt;Gt+=1){const re=rt[Gt];if(re)for(let Xt=Math.floor(F);Xt<Math.ceil(E);Xt+=1){if(!re(Xt))continue;const Qt=A(Xt),ee=A(Xt+1);te.appendChild(w(this.#e,"rect",{class:`${s}__shade`,"data-task":n[Gt].id,"data-day":String(Xt),x:Qt,y:c[Gt].top,width:d(Math.max(0,ee-Qt)),height:c[Gt].height}))}}else if(Wt&&_t)for(let Gt=Math.floor(F);Gt<Math.ceil(E);Gt+=1){if(!_t(Gt))continue;const re=A(Gt),Xt=A(Gt+1);te.appendChild(w(this.#e,"rect",{class:`${s}__shade`,x:re,y:0,width:d(Math.max(0,Xt-re)),height:M}))}const ue=t.querySelector(`.${s}__shading`);ue?t.replaceChild(te,ue):t.appendChild(te)}#hi(t,e,n,c,A){const M=t[A],F=e[A],E=M.rec,rt=this.#n.showProgress,_t=this.#n.showBaseline,ut=Math.min(18,F.height-12),Nt=F.top+(F.height-ut)/2,Wt=F.top+F.height/2,te=E.late===!0,ue=typeof this.#t.isTaskReadOnly=="function"&&this.#t.isTaskReadOnly(M.id),Gt=w(this.#e,"g",{class:`${s}__barrow${this.#y.has(M.id)?` ${s}__row--ancestor`:""}${te?` ${s}__barrow--late`:""}${ue?` ${s}__barrow--readonly`:""}`});Gt.setAttribute("data-task",M.id),Gt.setAttribute("data-y",String(F.top)),Gt.setAttribute("data-row-height",String(F.height)),te&&Gt.setAttribute("data-late","true"),Gt.setAttribute("tabindex",this.#n.keyboard?"0":"-1"),Gt.setAttribute("role",E.isSummary?"group":"button"),Gt.setAttribute("aria-label",N(E,{iso:Qt=>o(Qt),unscheduled:this.#u("gantt.unscheduled"),inactive:this.#u("gantt.inactive")})),E.inactive&&Gt.setAttribute("data-inactive","true");const re=[];if(this.#y.has(M.id)&&re.push(this.#u("gantt.row.ancestor")),ue&&re.push(this.#u("gantt.a11y.readOnly")),Ot(Gt,re.join(" ")),Gt.appendChild(w(this.#e,"rect",{class:`${s}__rowbg`,x:0,y:d(F.top),width:c,height:d(F.height),fill:"transparent"})),Gt.appendChild(w(this.#e,"line",{class:`${s}__rowsep`,x1:0,y1:d(F.top+F.height),x2:c,y2:d(F.top+F.height)})),_t&&E.baselineStart!=null&&E.baselineEnd!=null){const Qt=n(E.baselineStart),ee=Math.max(1,n(E.baselineEnd)-Qt);Gt.appendChild(w(this.#e,"rect",{class:`${s}__baseline`,x:Qt,y:d(Nt+ut),width:d(ee),height:4,rx:2}))}const Xt=E.inactive?null:B(E,this.#n.barColour);if(E.unscheduled||E.inactive&&E.es==null)E.unscheduled&&Gt.setAttribute("data-unscheduled","true");else if(E.isMilestone){const Qt=n(E.es),ee=ut/2,ke=w(this.#e,"path",{class:`${s}__milestone${E.inactive?` ${s}__milestone--inactive`:""}${ue?` ${s}__milestone--readonly`:""}`,d:f(["M",d(Qt-ee),d(Wt),"L",d(Qt),d(Wt-ee),"L",d(Qt+ee),d(Wt),"L",d(Qt),d(Wt+ee),"Z"])});Xt&&(ke.style.fill=Xt),Gt.appendChild(ke)}else if(E.isSummary){const Qt=n(E.es),ee=Math.max(2,n(E.ef)-Qt),ke=this.#Pi(E,ee),pe=`${s}__summary-bar${E.inactive?` ${s}__summary-bar--inactive`:""}`;if(ke&&ke.inside){const Ae=w(this.#e,"rect",{class:pe,x:Qt,y:d(Nt),width:d(ee),height:d(ut),rx:3});Xt&&(Ae.style.fill=Xt),Gt.appendChild(Ae)}else{const Ae=w(this.#e,"rect",{class:pe,x:Qt,y:d(Nt+ut/3),width:d(ee),height:d(ut/3),rx:1}),Ce=w(this.#e,"path",{class:pe,d:f(["M",d(Qt),d(Nt+ut/3),"L",d(Qt),d(Nt+ut),"L",d(Qt+5),d(Nt+ut/3),"Z"])}),Oe=w(this.#e,"path",{class:pe,d:f(["M",d(Qt+ee),d(Nt+ut/3),"L",d(Qt+ee),d(Nt+ut),"L",d(Qt+ee-5),d(Nt+ut/3),"Z"])});Xt&&(Ae.style.fill=Xt,Ce.style.fill=Xt,Oe.style.fill=Xt),Gt.appendChild(Ae),Gt.appendChild(Ce),Gt.appendChild(Oe)}this.#ji(Gt,ke,Qt,ee,Wt,Nt,ut,!0,Xt)}else{const Qt=n(E.es),ee=Math.max(1,n(E.ef)-Qt),pe=this.#n.showCritical&&E.critical?this.#n.criticalStyle==="outline"?`${s}__bar--critical-outline`:`${s}__bar--critical`:"",Ae=this.#ot.has(String(E.id)),Ce=this.#O.has(String(E.id)),Oe=w(this.#e,"rect",{class:`${s}__bar${pe?` ${pe}`:""}${Ae?` ${s}__bar--overalloc`:""}${Ce?` ${s}__bar--conflict`:""}${te?` ${s}__bar--late`:""}${E.inactive?` ${s}__bar--inactive`:""}${ue?` ${s}__bar--readonly`:""}`,x:Qt,y:d(Nt),width:d(ee),height:d(ut),rx:3});if(Xt&&(Oe.style.fill=Xt),Gt.appendChild(Oe),rt&&E.percentComplete!=null&&E.percentComplete>0){const Se=w(this.#e,"rect",{class:`${s}__progress`,x:Qt,y:d(Nt),width:d(ee*Math.min(1,E.percentComplete/100)),height:d(ut),rx:3});Xt&&(Se.style.fill=at(Xt)),Gt.appendChild(Se)}this.#ji(Gt,this.#Pi(E,ee),Qt,ee,Wt,Nt,ut,!1,Xt),this.#n.editable&&(ue||Ot(Gt,[Gt.getAttribute("aria-description"),this.#u("gantt.a11y.startEdge")].filter(Boolean).join(" ")),Gt.appendChild(pt(this.#e,{ns:s,id:M.id,x0:Qt,barY:Nt,barH:ut,title:this.#u("gantt.resize.startHandle",{name:E.name})})),Gt.appendChild(J(this.#e,{ns:s,id:M.id,x0:Qt,w:ee,barY:Nt,barH:ut,percent:E.percentComplete||0,title:this.#u("gantt.progress.handle",{name:E.name})})))}if(this.#n.editable&&!E.isSummary&&!E.unscheduled){const Qt=E.isMilestone?n(E.es)-ut/2-2:n(E.es)-2,ee=E.isMilestone?n(E.es)+ut/2+2:n(E.ef)+2;Gt.appendChild(this.#fi(Qt,Wt,M.id,"start")),Gt.appendChild(this.#fi(ee,Wt,M.id,"finish"))}if(E.deadline!=null&&Number.isFinite(E.deadline)){const Qt=n(E.deadline),ee=F.top+2,ke=Nt+ut;Gt.appendChild(w(this.#e,"line",{class:`${s}__deadline`,x1:Qt,y1:ee,x2:Qt,y2:ke,"data-deadline":String(E.deadline)}));const pe=3;Gt.appendChild(w(this.#e,"path",{class:`${s}__deadline-glyph`,d:f(["M",d(Qt-pe),d(ee),"L",d(Qt+pe),d(ee),"L",d(Qt),d(ee+pe*1.6),"Z"])}))}return Gt}#fi(t,e,n,c){const A=w(this.#e,"g",{class:`${s}__connector`,"data-task":n,"data-end":c,cx:d(t),cy:d(e),"aria-hidden":"true"});return A.appendChild(w(this.#e,"circle",{class:`${s}__connector-hit`,cx:d(t),cy:d(e),r:3,fill:"transparent"})),A.appendChild(w(this.#e,"circle",{class:`${s}__connector-dot`,cx:d(t),cy:d(e),r:3})),A}#Br(t){if(this.#F.dragging||!this.#H)return;const e=t.target,n=e&&e.closest?e.closest(`.${s}__barrow`):null,c=n?n.getAttribute("data-task"):null,A=this.#t.schedule,M=c&&A&&A.ok?A.tasks.get(c):null;if(!M||!this.#zr(e)){this.#ue();return}this.#gi(n,M,t)}#zr(t){return!t||typeof t.closest!="function"?!1:!!(t.closest(`.${s}__bar`)||t.closest(`.${s}__progress`)||t.closest(`.${s}__milestone`)||t.closest(`.${s}__summary-bar`))}#Hr(t){if(this.#F.dragging||!this.#H)return;const e=t.target,n=e&&e.closest?e.closest(`.${s}__barrow`):null,c=n?n.getAttribute("data-task"):null,A=this.#t.schedule,M=c&&A&&A.ok?A.tasks.get(c):null;M&&this.#gi(n,M,t)}#gi(t,e,n=null){const c=this.#de&&this.#de.get(String(e.id))||null,A=ve(this.#e,s,e,c,this.#n.tooltip,this.#Wr());if(!A){this.#ue();return}if(this.#te!==e.id){if(!ht(this.#t,this,e.id,A.text,n)){this.#ue();return}this.#te=e.id}for(const M of[...this.#H.children])M!==this.#it&&this.#H.removeChild(M);if(A.node)this.#H.appendChild(A.node);else{const M=k(this.#e,"div",`${s}__tip-card`);u(M,A.text),this.#H.appendChild(M)}this.#H.removeAttribute("hidden"),this.#H.setAttribute("data-task",e.id),this.#xt&&this.#xt!==t&&et(this.#xt),t.setAttribute("aria-description",A.text),this.#xt=t,t===this.#pt&&this.#Fn(t),this.#Ur(t)}#Wr(){const t=this.#t.resourceNames;return{t:this.#u,formatDate:e=>this.#pi(e),dateAxis:!0,resourceName:e=>t.get(e)??e}}#pi(t){const e=a(t);if(!e)return"";try{return new Intl.DateTimeFormat(this.#be(),{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(e)}catch{return o(t)||""}}#be(){if(typeof this.#n.locale=="string"&&this.#n.locale)return this.#n.locale;const t=this.#n.gridConfig;if(t&&typeof t.locale=="string"&&t.locale)return t.locale;const e=this.#t.grid,n=e&&e.messages;return n&&n.locale||void 0}#ce(){const t=Zi(this.#n.weekStartDay)??this.#t[Nn];return Yi(t,this.#be())}#Ur(t){if(!this.#H||!this.#a)return;const e=t.querySelector(`.${s}__bar`)||t.querySelector(`.${s}__milestone`)||t.querySelector(`.${s}__summary-bar`);if(!e||typeof e.getBoundingClientRect!="function")return;const n=e.getBoundingClientRect(),c=this.#a.getBoundingClientRect(),A=this.#e.defaultView||globalThis,M=Number.isFinite(A.innerWidth)?A.innerWidth:1/0,F=Number.isFinite(A.innerHeight)?A.innerHeight:1/0,E={left:Math.max(0,c.left),top:Math.max(0,c.top),right:Math.min(M,c.right),bottom:Math.min(F,c.bottom)};Me(this.#H,this.#it,n,E,c)}#ue(){if(this.#H){if(this.#H.setAttribute("hidden",""),this.#xt){const t=this.#xt;et(t),this.#xt=null,t===this.#pt&&this.#Fn(t)}if(this.#te!=null){const t=this.#te;this.#te=null,Pt(this.#t,this,t,null)}}}#Gr(t,e,n){const c=this.#A,A=e(c);t.appendChild(w(this.#e,"line",{class:`${s}__progressline`,x1:d(A),y1:0,x2:d(A),y2:d(n),"data-status":String(c),"data-status-x":d(A)}))}#mi(t,e,n,c,A,M,F){const E=w(this.#e,"g",{class:`${s}__progressjogs`}),rt=this.#A,_t=A(rt),ut=this.#n.calendar?i(this.#n.calendar,e.projectStart):null;for(let Wt=M;Wt<=F;Wt+=1){const te=n[Wt];if(te.rec.isSummary||te.rec.unscheduled||te.rec.es==null)continue;const ue=c[Wt],Gt=ue.top+ue.height/2,re=A(this.#yr(te.rec,ut));E.appendChild(w(this.#e,"line",{class:`${s}__progressline`,x1:d(_t),y1:d(Gt),x2:d(re),y2:d(Gt),"data-task":te.id,"data-status-x":d(_t),"data-progress-x":d(re)})),E.appendChild(w(this.#e,"circle",{class:`${s}__progressline--dot`,cx:d(re),cy:d(Gt),r:2.5,"data-task":te.id,"data-progress-x":d(re)}))}const Nt=t.querySelector(`.${s}__progressjogs`);Nt?t.replaceChild(E,Nt):t.appendChild(E)}#ht(t,e){if(!this.#Bt||!t)return;if(!!!(e&&e.repeat)){if(t===this.#yn)return;this.#yn=t,u(this.#Bt,t);return}this.#yn=t,u(this.#Bt,""),u(this.#Bt,t)}#Kr(){const t=this.#n.workload;if(t==null||t===!1)return null;const e=t&&typeof t=="object"?t:{},n={...yt,...e},c=Number(this.#t.hoursPerDay),A=Number.isFinite(c)&&c>0?c:yt.hoursPerDay;return n.hoursPerDay=e.hoursPerDay!=null&&Number.isFinite(Number(e.hoursPerDay))&&Number(e.hoursPerDay)>0?Number(e.hoursPerDay):A,n.rowHeight=Math.max(16,Number(n.rowHeight)||yt.rowHeight),n.height=Math.max(n.rowHeight,Number(n.height)||yt.height),n.maxHeight=Number.isFinite(Number(e.maxHeight))&&Number(e.maxHeight)>0?Number(e.maxHeight):null,n.totals=n.totals!==!1,n.unit=ni.has(e.unit)?e.unit:"hours",n.thresholds=It(e.thresholds),n.showUnassigned=e.showUnassigned!==!1,n.external=Yt(e.external,0),n.labelWidth=Number.isFinite(Number(e.labelWidth))&&Number(e.labelWidth)>0?Number(e.labelWidth):null,n.tooltip=e.tooltip===void 0?!0:e.tooltip,n.groupBy=Dt(e.groupBy),n}#Vr(){const t=this.#n.histogram;if(t==null||t===!1)return null;const e=t&&typeof t=="object"?t:{},n={...Q,...e};return n.resources=Array.isArray(n.resources)&&n.resources.length?n.resources.map(c=>String(c)):null,n.unit=ni.has(n.unit)?n.unit:"hours",n.stacked=n.stacked==="task"?"task":!1,n.rowHeight=Math.max(16,Number(n.rowHeight)||Q.rowHeight),n.height=Math.max(n.rowHeight,Number(n.height)||Q.height),n.collapsed=!1,n.maxHeight=Number.isFinite(Number(e.maxHeight))&&Number(e.maxHeight)>0?Number(e.maxHeight):null,n.labelWidth=Number.isFinite(Number(e.labelWidth))&&Number(e.labelWidth)>0?Number(e.labelWidth):null,n}#bi(){const t=this.#n.height;if(Number.isFinite(t)){this.#et=Number(t),this.#a.style.height=`${this.#et}px`,this.#a.style.maxHeight="";return}if(this.#St){const e=Qn(this.#i);this.#et=Number.isFinite(e)?Math.round(e):null,this.#a.style.height=this.#et==null?"100%":`${this.#et}px`,this.#a.style.maxHeight=""}else this.#et=null,this.#a.style.height="",this.#a.style.maxHeight=`${un}px`}#Yr(){Number.isFinite(this.#n.height)||this.#St&&(this.#ft=oi({targets:[this.#i],read:()=>Qn(this.#i),apply:()=>{this.#bi(),this.#yi(),this.#z&&this.draw()}}))}#Zr(){if(Number.isFinite(this.#n.height)||this.#St)return;const t=this.#r;if(!t)return;this.#a.style.height="";const e=t.offsetHeight,n=t.scrollHeight;e>n&&(this.#a.style.height=`${this.#a.offsetHeight-(e-n)}px`)}#yi(){if(this.#n.resourceOnly)return;const t=this.#et;if(!Number.isFinite(t))return;const e=this.#k?this.#k.height:0,n=this.#S?this.#S.height:0,c=e+n;if(c<=0)return;const A=Math.max(0,Math.floor(t-t*li)-4);if(c<=A)return;const M=A/c;let F=Math.round(e*M),E=Math.round(n*M);const rt=this.#S?this.#S.rowHeight+Mi:0;if(this.#S&&E<rt){const _t=Math.ceil((e+rt)/(1-li));me("gantt-histogram-squeeze",`[lattice] gantt: the histogram band needs the split view at least ${_t}px tall to show its bars alongside the workload band (it is ${t}px); showing its header only until there is room.`),this.#S.collapsed=!0,E=this.#S.rowHeight,F=Math.min(e,Math.max(0,A-E))}this.#k&&(this.#k.height=Math.max(this.#k.rowHeight,F)),this.#S&&(this.#S.height=Math.max(this.#S.rowHeight,E))}#Xr(){return this.#k?this.#k.hoursPerDay:yt.hoursPerDay}#qr(){return this.#k?this.#k.external:[]}#ki(t){if(!t)return 0;if(t.collapsed)return t.rowHeight;if(t.maxHeight!=null){const e=Number.isFinite(t.contentHeight)?t.contentHeight:t.height;return Math.min(Math.max(e,t.rowHeight),t.maxHeight)}return t.height}#Jr(){if(this.#n.resourceOnly)return;const t=this.#et;if(!Number.isFinite(t))return;const e=this.#k,n=this.#S;if(!(e&&e.maxHeight!=null||n&&n.maxHeight!=null))return;const c=Math.max(0,Math.floor(t-t*li)-4),A=e?this.#ki(e):0,M=n?this.#ki(n):0,F=A+M;let E=A,rt=M;if(F>c){const _t=c/F;E=Math.round(A*_t),rt=Math.round(M*_t)}e&&(e.height=Math.max(e.rowHeight,E),this.#R&&(this.#R.style.flex=`0 0 ${e.height}px`)),n&&(n.height=Math.max(n.rowHeight,rt),this.#j&&(this.#j.style.flex=`0 0 ${n.height}px`))}#Qr(){const t=this.#k;this.#R=k(this.#e,"div",`${s}__wl`),this.#R.style.flex=this.#n.resourceOnly?"1 1 auto":`0 0 ${t.height}px`,this.#R.setAttribute("role","table"),this.#R.setAttribute("aria-label",this.#u("gantt.workload.title")),this.#mt=k(this.#e,"div",`${s}__wl-head`),this.#mt.style.height=`${t.rowHeight}px`,this.#mt.appendChild(k(this.#e,"div",`${s}__wl-cell ${s}__wl-cell--name`)),t.totals&&this.#mt.appendChild(k(this.#e,"div",`${s}__wl-cell ${s}__wl-cell--total`)),this.#mt.appendChild(k(this.#e,"div",`${s}__divider`));const e=k(this.#e,"div",`${s}__wl-head-spacer`);if(e.appendChild(this.#vi()),this.#mt.appendChild(e),this.#R.appendChild(this.#mt),this.#dt){this.#a.appendChild(this.#R);return}const n=k(this.#e,"div",`${s}__wl-body`);this.#At=k(this.#e,"div",`${s}__wl-grid`),this.#At.style.width=`${this.#X()}px`,this.#v=k(this.#e,"div",`${s}__wl-time`),n.appendChild(this.#At),n.appendChild(k(this.#e,"div",`${s}__divider`)),n.appendChild(this.#v),this.#R.appendChild(n),this.#a.appendChild(this.#R),this.#Ce=()=>this.#Et(this.#v),this.#v.addEventListener("scroll",this.#Ce),this.#W=k(this.#e,"div",`${s}__wl-tooltip`),this.#W.setAttribute("hidden",""),this.#R.appendChild(this.#W),this.#Me=c=>this.#Es(c),this.#v.addEventListener("dblclick",this.#Me),this.#Ae=c=>this.#Os(c),this.#v.addEventListener("click",this.#Ae),this.#Te=c=>this.#Is(c),this.#v.addEventListener("contextmenu",this.#Te),this.#Ee=c=>this.#Wi(c),this.#v.addEventListener("pointerover",this.#Ee),this.#Oe=c=>this.#Ui(c),this.#v.addEventListener("pointerout",this.#Oe),this.#De=c=>this.#Wi(c),this.#v.addEventListener("focusin",this.#De),this.#Pe=c=>this.#Ui(c),this.#v.addEventListener("focusout",this.#Pe),this.#zn=c=>this.#Fs(c),this.#v.addEventListener("keydown",this.#zn),this.#je=c=>this.#Rs(c),this.#At.addEventListener("click",this.#je)}#Et(t){if(this.#vn||!t)return;this.#vn=!0;const e=t.scrollLeft,n=this.#$?this.#$.viewport():this.#v;for(const c of[this.#b,this.#r,n,this.#_,...this.#o?this.#o.panes():[],...this.#d?this.#d.panes():[]])c&&c!==t&&c.scrollLeft!==e&&(c.scrollLeft=e);this.#vn=!1,this.#Z&&this.#Z.note(),this.#at&&this.#at.note()}#gn(t){if(this.#Ut||!t)return;this.#Ut=!0;const e=t.scrollTop;for(const n of[this.#c,this.#r])n&&n!==t&&n.scrollTop!==e&&(n.scrollTop=e);this.#Ut=!1,this.#at&&this.#at.note()}#ts(t){!t||!this.#f||this.#f.scrollLeft!==t.scrollLeft&&(this.#f.scrollLeft=t.scrollLeft)}#wi(){const t=new Map,e=this.#t.resourceModels;if(e instanceof Map)for(const[c,A]of e)A&&Number.isFinite(A.capacityUnits)&&A.capacityUnits>0&&t.set(c,A.capacityUnits);const n=this.#t.resourceLoad;if(n&&n.byResource instanceof Map)for(const[c,A]of n.byResource)A&&Number.isFinite(A.capacity)&&t.set(c,A.capacity);return t}#vi(){const t=this.#e.createElement("button");t.setAttribute("type","button"),t.setAttribute("class",`${s}__unit-toggle`);const e=this.getWorkloadUnit();return t.setAttribute("aria-pressed",e==="hours"?"false":"true"),t.setAttribute("data-unit",e),u(t,this.#u("gantt.workload.unitToggle")),t.addEventListener("click",()=>this.setWorkloadUnit(Bi[this.getWorkloadUnit()])),this.#in=t,t}#es(t,e,n,c,A,M,F){const E=this.#k;if(!E||!this.#mt)return;const rt=this.#pe(),_t=Lt(e.level,Math.floor(n),Math.ceil(c),this.#ce()),ut=this.#t.resourceModels,Nt=Mt(this.#t.tasks,t,{buckets:_t,hoursPerDay:E.hoursPerDay,isWorking:rt?Ce=>!rt(Ce):null,capacities:this.#wi(),resourceModels:ut,resourceRates:this.#t.resourceRates,external:E.external}),Wt=this.#Vn(E),te=Math.max(0,this.#X()-Wt),ue=this.#mt.querySelectorAll(`.${s}__wl-cell`);ue[0]&&(ue[0].style.width=`${Wt}px`,ue[0].style.flex=`0 0 ${Wt}px`,u(ue[0],this.#u("gantt.workload.resource"))),ue[1]&&(ue[1].style.width=`${te}px`,ue[1].style.flex=`0 0 ${te}px`,u(ue[1],this.#u("gantt.workload.total")));const Gt=E.showUnassigned?Nt.rows.slice():Nt.rows.filter(Ce=>Ce.resource!=null),re=Lt(e.level,Math.floor(n),Math.ceil(A),this.#ce()).map(Ce=>({...Ce,workingDays:0}));this.#B={buckets:re,rows:Gt};const Xt=[],Qt=!!E.groupBy,ee=Ce=>{const Oe=Ce.resource==null?"":Ce.resource,Se=Ce.resource==null?this.#u("gantt.workload.unassigned"):this.#st(Ce.resource),Ye=this.#n.resourceOnly?oe(Ce.tasks||[]):Ce.tasks||[],Je=this.#he.has(Oe);if(Xt.push({key:Oe,label:Se,cells:Ce.cells,over:Ce.over,capacity:Ce.capacity,available:Ce.available,availableTotal:Ce.availableTotal,total:Ce.total,costCells:Ce.costCells,costTotal:Ce.costTotal,isTotal:!1,taskId:null,toggle:Ye.length?{expanded:Je,name:Se}:null,depth:Qt?1:null,src:Ce}),!!Je)for(const tn of Ye){const Te=tn.name!=null?tn.name:this.#u("gantt.workload.external");Xt.push({key:Oe,label:tn.loadOnly&&!this.#n.resourceOnly?this.#u("gantt.workload.otherProjectLabel",{name:Te}):Te,cells:tn.cells,over:tn.cells.map(()=>!1),capacity:null,available:Ce.available,availableTotal:Ce.availableTotal,total:tn.total,costCells:null,costTotal:null,isTotal:!1,taskId:String(tn.id),toggle:null,loadOnly:!!tn.loadOnly,external:!!tn.external,group:tn.group??null,depth:Qt?2:null,src:Ce,sub:tn})}};if(Qt){const Ce=this.#t.resourceSpecs,Oe=Ut(Gt,Se=>Se==null?null:Bt(E.groupBy,{...Ce.get(Se)||{},key:Se,name:this.#st(Se)}));for(const Se of Oe){const Ye=Se.value==null?this.#u("gantt.workload.ungrouped"):Se.value,Je=!this.#Ne.has(Se.key);Xt.push({key:Se.key,label:Ye,cells:Se.cells,over:Se.over,capacity:null,available:Se.available,availableTotal:Se.availableTotal,total:Se.total,costCells:Se.costCells,costTotal:Se.costTotal,isTotal:!1,isGroup:!0,taskId:null,toggle:{expanded:Je,name:Ye},depth:0}),Je&&Se.rows.forEach(ee)}}else Gt.forEach(ee);if(E.totals&&Xt.push({key:"__total__",label:this.#u("gantt.workload.total"),cells:Nt.totals,over:Nt.totals.map(()=>!1),capacity:null,available:Nt.totalsAvailable,availableTotal:Nt.grandAvailableTotal,total:Nt.grandTotal,costCells:Nt.totalsCost,costTotal:Nt.grandCostTotal,isTotal:!0,taskId:null,toggle:null,depth:Qt?0:null}),E.contentHeight=(Xt.length+1)*E.rowHeight,this.#dt){const Ce=this.#ds(Xt,E,Wt,re,M),Oe=this.#$.grid,Se=this.#Mn(Oe,null),Ye=new Set(re.map(Ie=>o(Ie.start))),Je=[],tn=[],Te=[];Se.visible.forEach((Ie,Ue)=>{Ye.has(String(Ie.id))||(Je.push(Ue),tn.push(Se.columns[Ue]),Te.push(Se.columnWidths[Ue]))}),this.#B.grid={columns:tn,columnWidths:Te,rows:Ce.map((Ie,Ue)=>({label:Ie.label,cells:Ie.cells,over:Ie.over,taskId:Ie.taskId,texts:Je.map(Pi=>this.#An(Oe,this.#Cn(Ie),Se.visible[Pi],Ue))}))};return}const ke=this.#At,pe=this.#v;for(;ke.firstChild;)ke.removeChild(ke.firstChild);for(;pe.firstChild;)pe.removeChild(pe.firstChild);const Ae=k(this.#e,"div",`${s}__wl-plot`);Ae.style.width=`${F}px`,Ae.style.height=`${Xt.length*E.rowHeight}px`;for(const Ce of Xt)this.#fs(ke,Ae,Ce,re,M,Wt,te,E);pe.appendChild(Ae),this.#r&&(pe.scrollLeft=this.#r.scrollLeft)}#ns(t,e){if(!e.totals)return"";if(e.unit==="percent"&&t.availableTotal!=null){const n=Zt(t.total,t.availableTotal,e.decimals);return n==="–"?n:`${n}%`}return e.unit==="cost"&&t.costTotal!=null?Vt(t.costTotal,e.decimals):Rt(t.total,e.decimals)}#is(t,e){const n=new Map,c=A=>this.#ss(A);return this.#fe.add(c),n.set("resource",{id:"resource",field:"resource",title:this.#u("gantt.workload.resource"),layout:{width:e,min:Kt,movable:!1},edit:{enabled:!1},cell:{render:c}}),t.totals&&n.set("total",{id:"total",field:"total",title:this.#u("gantt.workload.total"),type:"number",layout:{flex:1},edit:{enabled:!1},cell:{render:A=>String((A&&A.row&&A.row.data||{}).__totalText??"")}}),n}#rs(t,e,n){const c=o(t.start);return _i({id:c,width:e,cell:{align:"right",class:A=>this.#Dn(A&&A.row&&A.row.data||{},c).classes,style:A=>this.#Dn(A&&A.row&&A.row.data||{},c).style,render:A=>this.#Dn(A&&A.row&&A.row.data||{},c).text},edit:null})}#Dn(t,e){const n=t&&t.__wl?t.__wl:null,c=this.#k,A=[`${s}__wl-bucket`],M={};if(!n||!c)return{text:"",classes:A,style:M};const F=this.#ge?this.#ge.get(String(e)):null;if(F==null)return{text:"",classes:A,style:M};const E=n.taskId!=null&&!!this.#n.editable&&!n.loadOnly,rt=Array.isArray(n.cells)?n.cells[F]:null,_t=Array.isArray(n.available)?n.available[F]:null,ut=Array.isArray(n.costCells)?n.costCells[F]:null;c.unit!=="cost"&&Array.isArray(n.over)&&n.over[F]&&A.push(`${s}__wl-bucket--over`),E&&A.push(`${s}__wl-bucket--editable`),n.loadOnly&&A.push(`${s}__wl-bucket--loadonly`);const Wt=ie(c.thresholds,_t!=null?(rt??0)/_t:null);Wt&&(Wt.className&&A.push(Wt.className),Wt.colour&&(M.backgroundColor=Wt.colour));const te=c.unit==="percent"&&_t!=null,ue=c.unit==="cost"&&n.costCells!=null,Gt=rt==null&&!(te&&!(_t>0));return{text:te?Gt?"":(()=>{const Xt=Zt(rt,_t,c.decimals);return Xt==="–"?Xt:`${Xt}%`})():ue?Vt(ut,c.decimals):Rt(rt,c.decimals),classes:A,style:M}}#ss(t){const e=t&&t.row&&t.row.data||{},n=k(this.#e,"span",`${s}__lgrid-name`),c=e.__depth!=null?Math.max(0,Number(e.__depth)||0):e.__taskId!=null?1:0;c&&(n.style.paddingLeft=`${c*(this.#n.indent||16)}px`);const A=String(e.resource??"");if(!e.__isTotal&&!e.__isGroup&&e.__taskId==null&&e.__resourceKey&&n.appendChild(D(this.#e,{name:A,avatar:this.#t.resourceAvatars.get(e.__resourceKey),cssGlyph:!0})),e.__toggle){const F=this.#e.createElement("button");F.setAttribute("class",`${s}__wl-toggle`),F.setAttribute("type","button"),F.setAttribute("aria-expanded",e.__toggle.expanded?"true":"false");const E=e.__toggle.expanded?"collapse":"expand";F.setAttribute("aria-label",this.#u(`gantt.workload.${E}${e.__isGroup?"Group":""}`,{name:e.__toggle.name})),F.addEventListener("click",rt=>{rt&&rt.stopPropagation&&rt.stopPropagation(),this.toggleResource(e.__resourceKey,{event:rt})}),n.appendChild(F)}const M=k(this.#e,"span",`${s}__wl-name-text${e.__isGroup?` ${s}__wl-group-name`:""}`);return u(M,A),M.setAttribute("title",A),n.appendChild(M),n}#_i(t,e){const n=[];return this.#Hn[e]=n,Array.isArray(t)?t.map(c=>{if(!c||typeof c!="object"||Array.isArray(c))return c;const A=typeof c.value=="function",M=typeof c.render=="function",{value:F,render:E,subRows:rt,align:_t,...ut}=c,Nt={...ut.cell&&typeof ut.cell=="object"?ut.cell:{},..._t!=null?{align:_t}:{}};if(!A&&!M)return{...ut,...F!==void 0?{value:F}:{},...E!==void 0?{render:E}:{},cell:Nt};const Wt=String(ut.id??ut.key);return n.push({id:Wt,value:A?F:null,subRows:rt??"blank"}),{...ut,id:Wt,field:Wt,cell:M?{...Nt,render:te=>this.#as(te,E,rt==="inherit")}:Nt}}):t}#os(t){return{...t==null?{}:this.#t.resourceSpecs.get(t)||{},key:t??"",name:t==null?this.#u("gantt.workload.unassigned"):this.#st(t)}}#Si(t,e,n,c){const A=this.#Hn[t]||[],M={};if(!e)return M;const F=e.resource==null?null:e.resource,E=Array.isArray(e.over)?e.over:[],rt={band:t,unit:c.unit,capacity:e.capacity??null,total:e.total,cost:e.costTotal??null,available:e.availableTotal??null,cells:e.cells,over:E,overCount:E.filter(Boolean).length,tasks:e.tasks||[],task:n},_t=this.#os(F);M.__ctx={resource:_t,ctx:rt};for(const ut of A){let Nt=null;try{n==null||ut.subRows==="inherit"?Nt=ut.value?ut.value(_t,rt):null:typeof ut.subRows=="function"&&(Nt=ut.subRows(n,_t,rt))}catch{Nt=null}M[ut.id]=Nt===void 0?null:Nt}return M}#as(t,e,n){const c=t&&t.row&&t.row.data||{},A=c.__ctx;if(!A||c.__taskId!=null&&!n){const F=t&&t.value;return F==null?"":String(F)}let M=null;try{M=e(A.resource,A.ctx)}catch{M=null}return M==null?"":typeof M=="object"?M:String(M)}#ls(t){const e=t&&t.row&&t.row.data||{},n=k(this.#e,"span",`${s}__hg-name-text`),c=String(e.resource??"");return u(n,c),n.setAttribute("title",c),n}#cs(t,e,n,c,A,M=!1){const F=k(this.#e,"div",`${s}__lgrid ${s}__lgrid--${A}`);F.style.bottom="0px",t.appendChild(F);const E=new ui({createGrid:this.#dt,host:F,columns:n,rowHeight:c.rowHeight,headerHeight:c.headerHeight||c.rowHeight,config:this.#bn({},"band"),treeSort:M});this.#Ye.push(fi(F,A==="workload"?this.#mt:this.#Mt,c.rowHeight));const rt=t.querySelector(`.${e}`);rt&&E.lockScroll(rt);const _t=()=>{this.#Tt||this.draw()};return E.on("sort:changed",_t),E.on("filter:changed",_t),E.on("column:resized",ut=>{ut&&ut.colId!=null&&this.#me(`${A==="workload"?"band":"histogram"}:${ut.colId}`,ut.width)}),this.#ve(A,E),E}#$i(t){if(!t||typeof t!="object")return t;const e=this.#ge,n=A=>!!(e&&A!=null&&e.has(String(A))),c={...t};return Array.isArray(c.columns)&&(c.columns=c.columns.filter(A=>!(A&&n(A.id)))),Array.isArray(c.columnOrder)&&(c.columnOrder=c.columnOrder.filter(A=>!n(A))),c}#us(t,e){const n=this.#$?this.#$.getState():null;this.#$&&(this.#$.destroy(),this.#$=null),this.#ae&&(this.#ae(),this.#ae=null),this.#le&&(this.#le.dispose(),this.#le=null),this.#on=null,this.#an=null,this.#ln=null,this.#cn=null,this.#un=null,this.#dn=null,this.#hn=null;const c=k(this.#e,"div",`${s}__lgrid ${s}__lgrid--workload`);c.style.bottom="0px",c.style.width="100%",this.#R.appendChild(c),this.#Un=c;const A=this.#bn({},"band"),M=A.rowClass;A.rowClass=rt=>{const _t=typeof M=="function"?M(rt):M||[],ut=Array.isArray(_t)?_t.slice():[_t],Nt=rt&&rt.data||{};return Nt.__isTotal?ut.push(`${s}__wl-row--total`):Nt.__isGroup?ut.push(`${s}__wl-row--group`):Nt.__taskId!=null&&ut.push(`${s}__wl-row--task`),Nt.__wl&&Nt.__wl.loadOnly&&ut.push(`${s}__wl-row--loadonly`),ut.filter(Boolean)},this.#$=new ui({createGrid:this.#dt,host:c,columns:t,rowHeight:e.rowHeight,headerHeight:e.headerHeight||e.rowHeight,config:A,treeSort:!0}),this.#Ye.push(this.#le=fi(c,this.#mt,e.rowHeight));const F=this.#$.viewport();if(F){const rt=()=>this.#Et(F);F.addEventListener("scroll",rt),this.#ae=()=>F.removeEventListener("scroll",rt)}this.#on=rt=>this.#Ps(rt),this.#an=rt=>this.#js(rt),this.#ln=rt=>this.#Ns(rt),this.#cn=rt=>this.#Bi(rt),this.#un=rt=>this.#zi(rt),this.#dn=rt=>this.#Bi(rt),this.#hn=rt=>this.#zi(rt),c.addEventListener("click",this.#on,!0),c.addEventListener("dblclick",this.#an,!0),c.addEventListener("contextmenu",this.#ln,!0),c.addEventListener("pointerover",this.#cn,!0),c.addEventListener("pointerout",this.#un,!0),c.addEventListener("focusin",this.#dn,!0),c.addEventListener("focusout",this.#hn,!0);const E=()=>{this.#Tt||this.draw()};this.#$.on("sort:changed",E),this.#$.on("filter:changed",E),this.#$.on("column:resized",rt=>{rt&&rt.colId!=null&&this.#me(`band:${rt.colId}`,rt.width)}),n?this.#$.setState(this.#$i(n)):this.#ve("workload",this.#$)}#ds(t,e,n,c,A){const M=`${this.#X()}|${c.length}|${c.length?c[0].start:0}|${c.length?c[c.length-1].start:0}`;if(!this.#$||M!==this.#Wn){const ut=di(this.#_i(e.columns,"workload"),this.#is(e,n),e.totals?["resource","total"]:["resource"],"resource");Ni(ut,this.#X(),e.totals?"total":"resource",{minFill:Kt,floor:Kt,defaultWidth:()=>Dn}),this.#ge=new Map(c.map((te,ue)=>[o(te.start),ue]));const Nt=ji(c,A),Wt=c.map((te,ue)=>this.#rs(te,Nt[ue],e));this.#Wn=M,this.#us([...ut,...Wt],e)}this.#$.host.style.width="100%";const F=new Map,E=t.map(ut=>{const Nt=this.#Cn(ut);F.set(Nt,e.rowHeight);const Wt={__key:Nt,__resourceKey:ut.key,__taskId:ut.taskId,__toggle:ut.toggle,__isTotal:ut.isTotal,__isGroup:!!ut.isGroup,...ut.depth!=null?{__depth:ut.depth}:{},__pinLast:!!ut.isTotal,__totalText:this.#ns(ut,e),__wl:ut,resource:ut.label,total:ut.total,capacity:ut.capacity,cost:ut.costTotal,...this.#Si("workload",ut.isTotal?null:ut.src,ut.sub||null,e)};for(let te=0;te<c.length;te++)Wt[o(c[te].start)]=ut.cells?ut.cells[te]:null;return Wt});this.#Tt=!0;try{this.#$.setRows(E,F)}finally{this.#Tt=!1}const rt=new Map(t.map(ut=>[this.#Cn(ut),ut])),_t=this.#$.displayedKeys().map(ut=>rt.get(ut)).filter(Boolean);return[..._t.filter(ut=>!ut.isTotal),..._t.filter(ut=>ut.isTotal)]}#hs(t,e,n,c){if(!this.#G){const E=ut=>this.#ls(ut);this.#fe.add(E);const rt=new Map([["resource",{id:"resource",field:"resource",title:this.#u("gantt.histogram.resource"),layout:{width:c,min:Kt,movable:!1},edit:{enabled:!1},cell:{render:E}}]]),_t=di(this.#_i(n.columns,"histogram"),rt,["resource"],"resource");this.#G=this.#cs(this.#j,`${s}__hg-body`,_t,n,"histogram")}this.#G.host.style.width=`${this.#X()}px`;const A=new Map,M=t.map(E=>{const rt=E??"",_t=e.get(rt)||{};return A.set(rt,n.rowHeight),{__key:rt,resource:E==null?this.#u("gantt.workload.unassigned"):this.#st(E),total:_t.total,capacity:_t.capacity,...this.#Si("histogram",_t.resource===void 0?{..._t,resource:E}:_t,null,n)}});this.#Tt=!0;try{this.#G.setRows(M,A)}finally{this.#Tt=!1}const F=new Map(t.map(E=>[E??"",E]));return this.#G.displayedKeys().filter(E=>F.has(E)).map(E=>F.get(E))}#fs(t,e,n,c,A,M,F,E){const rt=n.taskId!=null,_t=rt&&!!this.#n.editable&&!n.loadOnly,ut=k(this.#e,"div",`${s}__wl-row${n.isTotal?` ${s}__wl-row--total`:""}${n.isGroup?` ${s}__wl-row--group`:""}${rt?` ${s}__wl-row--task`:""}${n.loadOnly?` ${s}__wl-row--loadonly`:""}`);ut.style.height=`${E.rowHeight}px`,ut.setAttribute("role","row"),ut.setAttribute("data-resource",n.key),rt&&ut.setAttribute("data-task",n.taskId),!rt&&!n.isTotal&&!n.isGroup&&n.key&&ut.appendChild(D(this.#e,{name:n.label,avatar:this.#t.resourceAvatars.get(n.key),cssGlyph:!0}));const Nt=k(this.#e,"div",`${s}__wl-cell ${s}__wl-cell--name`);if(Nt.style.width=`${M}px`,Nt.style.flex=`0 0 ${M}px`,Nt.setAttribute("role","rowheader"),n.depth===1&&(Nt.style.paddingLeft=`${8+(this.#n.indent||16)}px`),n.toggle){const re=this.#e.createElement("button");re.setAttribute("class",`${s}__wl-toggle`),re.setAttribute("type","button"),re.setAttribute("aria-expanded",n.toggle.expanded?"true":"false"),re.setAttribute("aria-label",this.#u(`gantt.workload.${n.toggle.expanded?"collapse":"expand"}${n.isGroup?"Group":""}`,{name:n.toggle.name})),re.addEventListener("click",Xt=>this.toggleResource(n.key,{event:Xt})),Nt.appendChild(re)}const Wt=k(this.#e,"span",`${s}__wl-name-text${n.isGroup?` ${s}__wl-group-name`:""}`);if(u(Wt,n.label),Wt.setAttribute("title",n.label),Nt.appendChild(Wt),ut.appendChild(Nt),E.totals){const re=k(this.#e,"div",`${s}__wl-cell ${s}__wl-cell--total`);if(re.style.width=`${F}px`,re.style.flex=`0 0 ${F}px`,re.setAttribute("role","cell"),E.unit==="percent"&&n.availableTotal!=null){const Xt=Zt(n.total,n.availableTotal,E.decimals);u(re,Xt==="–"?Xt:`${Xt}%`)}else E.unit==="cost"&&n.costTotal!=null?u(re,Vt(n.costTotal,E.decimals)):u(re,Rt(n.total,E.decimals));ut.appendChild(re)}t&&t.appendChild(ut);const te=k(this.#e,"div",`${s}__wl-timerow${n.isTotal?` ${s}__wl-timerow--total`:""}${n.isGroup?` ${s}__wl-timerow--group`:""}${rt?` ${s}__wl-timerow--task`:""}${n.loadOnly?` ${s}__wl-timerow--loadonly`:""}`);te.style.height=`${E.rowHeight}px`,te.setAttribute("role","row"),te.setAttribute("data-resource",n.key),rt&&te.setAttribute("data-task",n.taskId);const ue=`${n.key}${n.taskId??""}`,Gt=this.#wn.has(ue)?this.#wn.get(ue):0;c.forEach((re,Xt)=>{const Qt=A(re.start),ee=A(re.end),ke=E.unit!=="cost"&&!!n.over[Xt],pe=k(this.#e,"div",`${s}__wl-bucket${ke?` ${s}__wl-bucket--over`:""}${_t?` ${s}__wl-bucket--editable`:""}${n.loadOnly?` ${s}__wl-bucket--loadonly`:""}`);pe.style.left=`${d(Qt)}px`,pe.style.width=`${d(Math.max(0,ee-Qt))}px`,pe.setAttribute("role","cell");const Ae=o(re.start)??String(re.start);pe.setAttribute("data-bucket",Ae),n.isTotal||pe.setAttribute("tabindex",Xt===Gt?"0":"-1"),_t&&pe.setAttribute("data-bucket-index",String(Xt));const Ce=n.cells[Xt],Oe=n.available?n.available[Xt]:null,Se=n.costCells?n.costCells[Xt]:null,Ye=ie(E.thresholds,Oe!=null?(Ce??0)/Oe:null);Ye&&(Ye.className&&pe.classList.add(Ye.className),Ye.colour&&(pe.style.backgroundColor=Ye.colour));const Je=E.unit==="percent"&&Oe!=null,tn=E.unit==="cost"&&n.costCells!=null,Te=Ce==null&&!(Je&&!(Oe>0)),Ie=Je?Te?"":(()=>{const Ue=Zt(Ce,Oe,E.decimals);return Ue==="–"?Ue:`${Ue}%`})():tn?Vt(Se,E.decimals):Rt(Ce,E.decimals);if(Ie!=="")if(u(pe,Ie),pe.setAttribute("data-hours",String(Ce)),Je)pe.setAttribute("aria-label",Ie==="–"?this.#u("gantt.workload.cellNoCapacity",{date:Ae}):this.#u(ke?"gantt.workload.overPercent":"gantt.workload.cellPercent",{percent:Ie.slice(0,-1),date:Ae}));else if(tn)pe.setAttribute("aria-label",this.#u("gantt.workload.cellCost",{cost:Ie,date:Ae}));else{const Ue={hours:Ie,date:Ae};pe.setAttribute("aria-label",ke?this.#u("gantt.workload.over",{...Ue,capacity:Rt(Oe,E.decimals)}):this.#u("gantt.workload.cell",Ue))}else(_t||!n.isTotal)&&pe.setAttribute("aria-label",Je?this.#u("gantt.workload.cellPercent",{percent:"0",date:Ae}):this.#u("gantt.workload.cell",{hours:"0",date:Ae}));te.appendChild(pe)}),e.appendChild(te)}#gs(){const t=this.#S;this.#j=k(this.#e,"div",`${s}__hg${t.collapsed?` ${s}__hg--collapsed`:""}`),this.#j.style.flex=`0 0 ${t.height}px`,this.#j.setAttribute("role","table"),this.#j.setAttribute("aria-label",this.#u("gantt.histogram.title")),this.#Mt=k(this.#e,"div",`${s}__hg-head`),this.#Mt.style.height=`${t.rowHeight}px`,this.#Mt.appendChild(k(this.#e,"div",`${s}__hg-cell ${s}__hg-cell--name`)),this.#Mt.appendChild(k(this.#e,"div",`${s}__divider`));const e=k(this.#e,"div",`${s}__hg-head-spacer`);this.#k||e.appendChild(this.#vi()),this.#Mt.appendChild(e),this.#j.appendChild(this.#Mt);const n=k(this.#e,"div",`${s}__hg-body`);this.#Yt=k(this.#e,"div",`${s}__hg-grid`),this.#Yt.style.width=`${this.#X()}px`,this.#_=k(this.#e,"div",`${s}__hg-time`),n.appendChild(this.#Yt),n.appendChild(k(this.#e,"div",`${s}__divider`)),n.appendChild(this.#_),this.#j.appendChild(n),this.#a.appendChild(this.#j),this.#Le=()=>this.#Et(this.#_),this.#_.addEventListener("scroll",this.#Le),this.#U=k(this.#e,"div",`${s}__hg-tooltip`),this.#U.setAttribute("hidden",""),this.#j.appendChild(this.#U),this.#Ie=c=>this.#ks(c),this.#Fe=c=>this.#Ci(c),this.#Re=c=>this.#Ai(c),this.#_.addEventListener("pointerover",this.#Ie),this.#_.addEventListener("pointermove",this.#Fe),this.#_.addEventListener("pointerleave",this.#Re),this.#Be=c=>this.#ws(c),this.#ze=c=>this.#Ai(c),this.#_.addEventListener("focus",this.#Be,!0),this.#_.addEventListener("blur",this.#ze,!0),this.#He=c=>this.#$s(c),this.#_.addEventListener("keydown",this.#He),this.#We=c=>this.#vs(c),this.#_.addEventListener("click",this.#We),this.#Ue=c=>this.#_s(c),this.#_.addEventListener("dblclick",this.#Ue),this.#Ge=c=>this.#Ss(c),this.#_.addEventListener("contextmenu",this.#Ge)}#ps(t){const e=this.#S;if(!e.resources)return t.rows.map(c=>c.resource);const n=new Map(t.rows.map(c=>[c.resource==null?"":c.resource,c]));return e.resources.filter(c=>n.has(c))}#ms(t,e,n,c,A,M){const F=this.#S;if(!F||!this.#Yt||!this.#_||!this.#Mt)return;const E=this.#pe(),rt=Lt(e.level,Math.floor(n),Math.ceil(c),this.#ce()),_t=this.#Xr(),ut=Mt(this.#t.tasks,t,{buckets:rt,hoursPerDay:_t,isWorking:E?Ae=>!E(Ae):null,capacities:this.#wi(),resourceModels:this.#t.resourceModels,resourceRates:this.#t.resourceRates,external:this.#qr()}),Nt=this.#Vn(F),Wt=this.#Mt.querySelectorAll(`.${s}__hg-cell`);Wt[0]&&(Wt[0].style.width=`${Nt}px`,Wt[0].style.flex=`0 0 ${Nt}px`,u(Wt[0],this.#u("gantt.histogram.resource")));const te=ut.ok?ut.buckets:rt.map(Ae=>({...Ae,workingDays:0})),ue=ut.ok?this.#ps(ut):[],Gt=new Map(ut.rows.map(Ae=>[Ae.resource==null?"":Ae.resource,Ae]));this.#ut={resources:ue,buckets:te,rows:ut.rows,hoursPerDay:_t};const re=this.#Yt,Xt=this.#_;for(;re.firstChild;)re.removeChild(re.firstChild);for(;Xt.firstChild;)Xt.removeChild(Xt.firstChild);const Qt=Math.max(1,ue.length*F.rowHeight);F.contentHeight=(ue.length+1)*F.rowHeight;const ee=w(this.#e,"svg",{class:`${s}__hg-plot`,width:M,height:Qt,viewBox:`0 0 ${M} ${Qt}`,role:"img","aria-label":this.#u("gantt.histogram.title")}),ke=this.#dt?this.#hs(ue,Gt,F,Nt):ue;if(this.#dt&&this.#G){const Ae=this.#G.grid,Ce=this.#Mn(Ae,null);this.#ut.grid={columns:Ce.columns,columnWidths:Ce.columnWidths,rows:ke.map((Oe,Se)=>{const Ye=Oe??"",Je=Gt.get(Ye);return{label:Oe==null?this.#u("gantt.workload.unassigned"):this.#st(Oe),cells:Je?Je.cells:null,over:Je?Je.over:null,taskId:null,texts:Ce.visible.map(tn=>this.#An(Ae,Ye,tn,Se))}})}}const pe=this.#G?k(this.#e,"div"):re;ke.forEach((Ae,Ce)=>{const Oe=Ae??"",Se=Gt.get(Oe),Ye=Ae==null?this.#u("gantt.workload.unassigned"):this.#st(Ae);this.#ys(pe,ee,Se,Oe,Ye,te,A,Nt,F,Ce,M)}),Xt.appendChild(ee),this.#r&&(Xt.scrollLeft=this.#r.scrollLeft),this.#xs(ue,Gt,te,F)}#bs(t,e,n){const c=t.reduce((F,E)=>Math.max(F,E||0),0),A=e!=null?Math.max(e,c):c,M=Math.max(A*1.15,A>0?A:1);return _({min:0,max:M},[n,0])}#ys(t,e,n,c,A,M,F,E,rt,_t,ut){const Nt=k(this.#e,"div",`${s}__hg-row`);Nt.style.height=`${rt.rowHeight}px`,Nt.setAttribute("role","row"),Nt.setAttribute("data-resource",c);const Wt=k(this.#e,"div",`${s}__hg-cell ${s}__hg-cell--name`);Wt.style.width=`${E}px`,Wt.style.flex=`0 0 ${E}px`,Wt.setAttribute("role","rowheader");const te=k(this.#e,"span",`${s}__hg-name-text`);u(te,A),te.setAttribute("title",A),Wt.appendChild(te),Nt.appendChild(Wt),t.appendChild(Nt);const ue=rt.unit==="cost"&&n&&n.costCells!=null,Gt=M.map((ke,pe)=>n&&(ue?n.costCells[pe]:n.cells[pe])||0),re=!ue&&n&&n.available&&n.available.some(ke=>ke!=null)?n.available:null,Xt=re?re.reduce((ke,pe)=>Math.max(ke,pe),0):null,Qt=this.#bs(Gt,Xt,rt.rowHeight),ee=w(this.#e,"g",{class:`${s}__hg-plotrow`,transform:`translate(0, ${d(_t*rt.rowHeight)})`});if(ee.setAttribute("data-resource",c),ee.setAttribute("data-row-top",String(_t*rt.rowHeight)),ee.setAttribute("data-row-height",String(rt.rowHeight)),ee.setAttribute("role","row"),M.forEach((ke,pe)=>{const Ae=F(ke.start),Ce=F(ke.end),Oe=Gt[pe],Se=re?re[pe]:null,Ye=Se!=null&&Oe>Se,Je=Se!=null?Math.min(Oe,Se):Oe,tn=n?n.cells[pe]??0:0,Te=n&&n.available?n.available[pe]:null,Ie=ie(rt.thresholds,Te!=null?tn/Te:null),Ue=w(this.#e,"g",{class:`${s}__hg-bargroup`});Ue.setAttribute("data-resource",c),Ue.setAttribute("data-bucket",o(ke.start)??String(ke.start)),Ue.setAttribute("data-bucket-index",String(pe));const Pi=this.#rn.has(c)?this.#rn.get(c):0;Ue.setAttribute("tabindex",pe===Pi?"0":"-1"),Ue.setAttribute("role","button"),Ue.setAttribute("aria-label",this.#xi(A,ke,Oe,Se,Ye,n,pe,rt));const ki=d(Ae),zi=d(Math.max(0,Ce-Ae));if(rt.stacked==="task"&&!ue&&n&&n.tasks&&n.tasks.length){let Bn=0;for(const er of n.tasks){const nr=er.cells[pe]||0;if(!(nr>0))continue;const cr=Math.min(Bn,Je),ir=Math.min(Bn+nr,Je);if(Bn+=nr,ir<=cr)continue;const wi=w(this.#e,"rect",{class:`${s}__hg-bar`,x:ki,y:d(Qt.of(ir)),width:zi,height:d(Qt.of(cr)-Qt.of(ir)),fill:P(String(er.id))});wi.setAttribute("data-resource",c),wi.setAttribute("data-bucket",o(ke.start)??String(ke.start)),wi.setAttribute("data-task",String(er.id)),Ie&&(Ie.colour&&(wi.style.fill=Ie.colour),Ie.className&&wi.classList.add(Ie.className)),Ue.appendChild(wi)}}else if(Je>0){const Bn=w(this.#e,"rect",{class:`${s}__hg-bar`,x:ki,y:d(Qt.of(Je)),width:zi,height:d(Qt.of(0)-Qt.of(Je))});Ie&&(Ie.colour&&(Bn.style.fill=Ie.colour),Ie.className&&Bn.classList.add(Ie.className)),Ue.appendChild(Bn)}if(Ye){const Bn=w(this.#e,"rect",{class:`${s}__hg-bar ${s}__hg-bar--overalloc`,x:ki,y:d(Qt.of(Oe)),width:zi,height:d(Qt.of(Je)-Qt.of(Oe))});Bn.setAttribute("data-resource",c),Bn.setAttribute("data-bucket",o(ke.start)??String(ke.start)),Ue.appendChild(Bn)}const fr=w(this.#e,"rect",{x:ki,y:0,width:zi,height:rt.rowHeight,fill:"transparent"});Ue.insertBefore(fr,Ue.firstChild),ee.appendChild(Ue)}),Xt!=null){const ke=d(Qt.of(Xt)),pe=w(this.#e,"line",{class:`${s}__hg-cap`,x1:0,y1:ke,x2:ut,y2:ke});pe.setAttribute("data-resource",c),pe.setAttribute("data-capacity",String(Xt)),ee.appendChild(pe)}e.appendChild(ee)}#xi(t,e,n,c,A,M,F,E){const rt=o(e.start)??String(e.start),_t=o(e.end-1)??String(e.end-1);let ut;if(E.unit==="cost"&&M&&M.costCells!=null)ut=this.#u("gantt.histogram.tipCost",{cost:Vt(n,2)});else if(E.unit!=="percent"||c==null)ut=this.#u("gantt.histogram.tipHours",{hours:Rt(n,1)});else{const Gt=Zt(n,c,0);ut=Gt==="–"?this.#u("gantt.histogram.tipNoCapacity"):this.#u("gantt.histogram.tipPercent",{percent:Gt})}const Nt=c!=null?this.#u("gantt.histogram.tipCapacity",{hours:Rt(c,1)}):"",Wt=M&&M.tasks?M.tasks.filter(Gt=>(Gt.cells[F]||0)>0).map(Gt=>Gt.name):[],te=Wt.length?this.#u("gantt.histogram.tipTasks",{tasks:Wt.join(", ")}):"",ue=A?this.#u("gantt.histogram.tipOver"):"";return this.#u("gantt.histogram.tip",{name:t,from:rt,to:_t,value:ut,capacity:`${Nt}${ue}`,tasks:te})}#ks(t){const e=this.#ye(t),n=e&&e.cell;if(!e||!n||!this.#U){this.#Pn();return}const c=n.getAttribute("aria-label");if(!c){this.#Pn();return}(!this.#vt||this.#vt.key!==e.key||this.#vt.index!==e.index)&&(this.#jn(t),this.#vt={key:e.key,index:e.index},Ee(this.#t,"workloadCellHover",this.#ke(e,t))),u(this.#U,c),this.#U.removeAttribute("hidden"),this.#Ci(t)}#Ci(t){if(!this.#U||this.#U.hasAttribute("hidden")||!this.#j)return;const e=this.#j.getBoundingClientRect?this.#j.getBoundingClientRect():{left:0,top:0},n=Number.isFinite(t.clientX)?t.clientX:0,c=Number.isFinite(t.clientY)?t.clientY:0;this.#U.style.left=`${n-e.left+12}px`,this.#U.style.top=`${c-e.top-28}px`}#ws(t){const e=this.#ye(t),n=e&&e.cell;if(!e||!n||!this.#U)return;const c=n.getAttribute("aria-label");if(!c||((!this.#vt||this.#vt.key!==e.key||this.#vt.index!==e.index)&&(this.#jn(t),this.#vt={key:e.key,index:e.index},Ee(this.#t,"workloadCellHover",this.#ke(e,t))),u(this.#U,c),this.#U.removeAttribute("hidden"),!this.#j||!n.getBoundingClientRect))return;const A=this.#j.getBoundingClientRect(),M=n.getBoundingClientRect();this.#U.style.left=`${M.left-A.left}px`,this.#U.style.top=`${M.top-A.top-28}px`}#Pn(){this.#U&&this.#U.setAttribute("hidden","")}#ye(t){const e=t&&t.target,n=e&&e.closest?e.closest(`.${s}__hg-bargroup`):null;if(!n)return null;const c=n.getAttribute("data-resource")||"",A=Number(n.getAttribute("data-bucket-index")),M=this.#ut;if(!M||!Array.isArray(M.rows)||!Array.isArray(M.buckets)||!Number.isFinite(A))return null;const F=M.rows.find(rt=>(rt.resource==null?"":rt.resource)===c),E=M.buckets[A];return!F||!E?null:{cell:n,key:c,index:A,row:F,bucket:E,resourceName:F.resource==null?this.#u("gantt.workload.unassigned"):this.#st(F.resource)}}#ke(t,e){return!t||!this.#ut?null:qe({view:this,unit:this.getWorkloadUnit(),resourceName:t.resourceName,rows:this.#ut.rows,buckets:this.#ut.buckets,rowKey:t.key,index:t.index,sub:null,rec:null,event:e})}#Ai(t){this.#jn(t),this.#Pn()}#jn(t){const e=this.#vt;if(this.#vt=null,!e||!this.#ut)return;const n=this.#ut.rows.find(A=>(A.resource==null?"":A.resource)===e.key),c=this.#ut.buckets[e.index];!n||!c||Ee(this.#t,"workloadCellHoverEnd",qe({view:this,unit:this.getWorkloadUnit(),resourceName:n.resource==null?this.#u("gantt.workload.unassigned"):this.#st(n.resource),rows:this.#ut.rows,buckets:this.#ut.buckets,rowKey:e.key,index:e.index,sub:null,rec:null,event:t}))}#vs(t){const e=this.#ye(t);e&&Ee(this.#t,"workloadCellClick",this.#ke(e,t))}#_s(t){const e=this.#ye(t);if(!e)return;!_e(this.#t,"workloadCellDblClick",this.#ke(e,t))&&t.preventDefault&&t.preventDefault()}#Ss(t){const e=this.#ye(t);if(!e)return;!_e(this.#t,"workloadCellContextMenu",this.#ke(e,t))&&t.preventDefault&&t.preventDefault()}#$s(t){const e=t.key;if(e==="Enter"||e===" "){if(t.ctrlKey||t.metaKey||t.altKey)return;const F=this.#ye(t);if(!F)return;t.preventDefault&&t.preventDefault(),Ee(this.#t,"workloadCellClick",this.#ke(F,t));return}if(e!=="ArrowLeft"&&e!=="ArrowRight"&&e!=="ArrowUp"&&e!=="ArrowDown")return;const n=t.target&&t.target.closest?t.target.closest(`.${s}__hg-bargroup`):null;if(!n)return;const c=n.getAttribute("data-resource")||"",A=Number(n.getAttribute("data-bucket-index")),M=this.#_;if(M){if(e==="ArrowLeft"||e==="ArrowRight"){const F=e==="ArrowRight"?1:-1,rt=[...M.querySelectorAll(`.${s}__hg-bargroup[data-resource="${c}"]`)].sort((_t,ut)=>Number(_t.getAttribute("data-bucket-index"))-Number(ut.getAttribute("data-bucket-index"))).find(_t=>Number(_t.getAttribute("data-bucket-index"))===A+F);rt&&this.#Mi(c,A+F,rt)}else{const F=[...new Set([...M.querySelectorAll(`.${s}__hg-bargroup`)].map(Nt=>Nt.getAttribute("data-resource")))],E=F.indexOf(c),_t=F[E+(e==="ArrowDown"?1:-1)];if(_t==null)return;const ut=M.querySelector(`.${s}__hg-bargroup[data-resource="${_t}"][data-bucket-index="${A}"]`);ut&&this.#Mi(_t,A,ut)}t.preventDefault&&t.preventDefault()}}#Mi(t,e,n){this.#rn.set(t,e);const c=this.#_;if(c)for(const A of c.querySelectorAll(`.${s}__hg-bargroup[data-resource="${t}"]`))A.setAttribute("tabindex",A===n?"0":"-1");n.focus&&n.focus()}#xs(t,e,n,c){if(!this.#j)return;const A=this.#j.querySelector(`.${s}__hg-table`);A&&A.parentNode&&A.parentNode.removeChild(A);const M=k(this.#e,"div",`${s}__hg-table`),F=this.#e.createElement("table"),E=this.#e.createElement("caption");u(E,this.#u("gantt.histogram.tableTitle")),F.appendChild(E);const rt=this.#e.createElement("tr"),_t=c.unit==="percent"?"gantt.histogram.percent":c.unit==="cost"?"gantt.histogram.cost":"gantt.histogram.hours";for(const ut of["gantt.histogram.resource","gantt.histogram.period",_t,"gantt.histogram.capacity","gantt.histogram.overAllocated"]){const Nt=this.#e.createElement("th");u(Nt,this.#u(ut)),rt.appendChild(Nt)}F.appendChild(rt);for(const ut of t){const Nt=ut??"",Wt=ut==null?this.#u("gantt.workload.unassigned"):this.#st(ut),te=e.get(Nt),ue=c.unit==="cost"&&te&&te.costCells!=null;n.forEach((Gt,re)=>{const Xt=te&&(ue?te.costCells[re]:te.cells[re])||0,Qt=!ue&&te&&te.available?te.available[re]:null,ee=Qt!=null&&Xt>Qt,ke=this.#e.createElement("tr"),pe=this.#e.createElement("th");u(pe,Wt),ke.appendChild(pe);const Ae=this.#e.createElement("td");u(Ae,`${o(Gt.start)??Gt.start} – ${o(Gt.end-1)??Gt.end-1}`),ke.appendChild(Ae);const Ce=this.#e.createElement("td");if(c.unit==="percent"&&Qt!=null){const Ye=Zt(Xt,Qt,0);u(Ce,Ye==="–"?Ye:`${Ye}%`)}else ue?u(Ce,Vt(Xt,2)):u(Ce,Rt(Xt,1));ke.appendChild(Ce);const Oe=this.#e.createElement("td");u(Oe,Qt!=null?Rt(Qt,1):""),ke.appendChild(Oe);const Se=this.#e.createElement("td");u(Se,this.#u(ee?"gantt.histogram.yes":"gantt.histogram.no")),ke.appendChild(Se),F.appendChild(ke)})}M.appendChild(F),this.#j.appendChild(M)}toggleResource(t,e={}){const n=String(t);if(Ct(n)){this.toggleWorkloadGroup(n.slice(bt.length));return}const c=this.#he.has(n);c?this.#he.delete(n):this.#he.add(n),this.draw(),this.#t.emitResourceToggle(c,{resource:n,expandedResources:[...this.#he],view:this,event:e.event||null})}toggleWorkloadGroup(t){const e=`${bt}${t==null?"":String(t)}`;this.#Ne.has(e)?this.#Ne.delete(e):this.#Ne.add(e),this.draw()}get collapsedWorkloadGroups(){return[...this.#Ne].map(t=>t.slice(bt.length))}getWorkloadUnit(){return this.#k?this.#k.unit:this.#S?this.#S.unit:yt.unit}setWorkloadUnit(t){const e=ni.has(t)?t:"hours";if(e===this.getWorkloadUnit()&&!(this.#k&&this.#S&&this.#k.unit!==this.#S.unit)||(this.#k&&(this.#k.unit=e),this.#S&&(this.#S.unit=e),!this.#k&&!this.#S))return;this.draw();const n=e==="percent"?"gantt.workload.unitPercent":e==="cost"?"gantt.workload.unitCost":"gantt.workload.unitHours";this.#ht(this.#u(n),{repeat:!0})}setWorkloadBookings(t){this.#k&&(this.#k.external=Yt(t,0),this.draw())}get expandedResources(){return new Set(this.#he)}#Ti(t,e,n,c,A,M){const F=w(this.#e,"g",{class:`${s}__links`}),E=this.#lt||{first:0,last:Math.max(0,n.length-1)},rt=new Set((e.conflicts||[]).filter(ut=>ut.type==="LOCKED"&&ut.from!=null&&ut.to!=null).map(ut=>`${ut.from}:${ut.to}`));for(const ut of this.#t.dependencies){const Nt=String(ut.from),Wt=String(ut.to);if(!c.has(Nt)||!c.has(Wt))continue;const te=c.get(Nt),ue=c.get(Wt);if(Math.max(te,ue)<E.first||Math.min(te,ue)>E.last)continue;const Gt=this.#Ei(e,c,A,M,ut,rt);Gt&&F.appendChild(Gt)}const _t=t.querySelector(`.${s}__links`);_t?t.replaceChild(F,_t):t.appendChild(F)}#Ei(t,e,n,c,A,M){const F=String(A.from),E=String(A.to),rt=t.tasks.get(F),_t=t.tasks.get(E);if(!rt||!_t||rt.unscheduled||_t.unscheduled||rt.es==null||rt.ef==null||_t.es==null||_t.ef==null)return null;const ut=Ce=>{const Oe=n[e.get(Ce)];return Oe.top+Oe.height/2},Nt=A.type?String(A.type).toUpperCase():"FS",Wt=Nt==="FS"||Nt==="FF"?rt.ef:rt.es,te=Nt==="FF"||Nt==="SF"?_t.ef:_t.es,ue=c(Wt),Gt=ut(F),re=c(te),Xt=ut(E),Qt=this.#n.showCritical&&rt.critical&&_t.critical,ee=M.has(`${F}:${E}`),ke=j({sx:ue,sy:Gt,ex:re,ey:Xt,type:Nt,elbow:10,rowGap:n[e.get(F)].height/2}),pe=w(this.#e,"g",{class:`${s}__linkgroup`});pe.setAttribute("data-from",F),pe.setAttribute("data-to",E),pe.setAttribute("data-type",Nt),pe.setAttribute("tabindex",this.#n.keyboard?"0":"-1"),pe.setAttribute("role","button"),pe.setAttribute("aria-label",this.#u("gantt.a11y.linkLabel",{from:rt.name,to:_t.name,type:Nt}));const Ae=w(this.#e,"path",{class:`${s}__link${Qt?` ${s}__link--critical`:""}${ee?` ${s}__link--conflict`:""}`,d:ke.d});return Ae.setAttribute("data-from",F),Ae.setAttribute("data-to",E),Ae.setAttribute("data-type",Nt),Ae.setAttribute("data-route",ke.route),ee&&Ae.setAttribute("data-conflict","true"),pe.appendChild(Ae),pe.appendChild(w(this.#e,"path",{class:`${s}__arrowhead${Qt?` ${s}__arrowhead--critical`:""}${ee?` ${s}__arrowhead--conflict`:""}`,d:I(re,Xt,ke.arrowDir)})),pe}#Cs(t){const e=this.#nn;if(!e||!t||!this.#n.showArrows)return;this.#Ti(e.plot,t,e.rows,e.rowIndex,e.geometry,e.x);const n=this.#lt||{first:0,last:Math.max(0,e.rows.length-1)};for(let c=n.first;c<=n.last;c+=1){const A=e.rows[c],M=t.tasks.get(A.id),F=e.plot.querySelector(`.${s}__barrow[data-task="${A.id}"]`);if(!M||!F||this.#F&&this.#F.draggedId===A.id||M.unscheduled||A.rec.unscheduled)continue;const E=e.x(M.es)-e.x(A.rec.es);E?F.setAttribute("transform",`translate(${E} 0)`):F.removeAttribute("transform")}}#Oi(t){const e=this.#n.barLabel;if(typeof e=="function")return String(e(t)??"");switch(e){case"none":return"";case"percent":return t.percentComplete==null?"":`${Math.round(t.percentComplete)}%`;case"dates":return`${this.#Li(t.es)} – ${this.#Li(t.ef)}`;default:return t.name}}#Di(t){const e=String(t.id);if(!this.#ee)return this.#Oi(t);if(this.#ee.has(e))return this.#ee.get(e);const n=this.#Oi(t);return this.#ee.set(e,n),n}#Pi(t,e){const n=this.#Di(t);return n?{text:n,inside:this.#Ni(e,n)==="inside"}:null}#As(t,e,n){this.#ee=new Map;let c=0;for(const A of t){const M=A.rec;if(!M||M.unscheduled||M.inactive&&M.es==null||M.isMilestone||!Number.isFinite(M.es)||!Number.isFinite(M.ef))continue;const F=this.#Di(M);if(!F)continue;const E=Math.round((M.es-e)*n),rt=Math.max(M.isSummary?2:1,Math.round((M.ef-e)*n)-E);if(this.#Ni(rt,F)==="inside")continue;const _t=E+rt+Cn+K(F,gn);_t>c&&(c=_t)}return c}#ji(t,e,n,c,A,M,F,E=!1,rt=null){if(!e)return;let _t=`${s}__barlabel`;e.inside&&(_t+=` ${s}__barlabel--inside`,E&&(_t+=` ${s}__barlabel--summary`));const ut=w(this.#e,"text",{class:_t,x:e.inside?d(n+c/2):d(n+c+Cn),y:d(A)});if(e.inside){if(ut.setAttribute("text-anchor","middle"),ut.setAttribute("data-inside","true"),rt){const te=ct(rt);te&&(ut.style.fill=te)}const Nt=`${s}__barlabel-clip-${++Rn}`,Wt=w(this.#e,"clipPath",{id:Nt});Wt.appendChild(w(this.#e,"rect",{x:d(n),y:d(M),width:d(c),height:d(F)})),t.appendChild(Wt),ut.setAttribute("clip-path",`url(#${Nt})`)}u(ut,e.text),t.appendChild(ut)}#Ni(t,e){if(this.#n.barLabelPosition==="right")return"right";const c=K(e,gn);return t>=c+2*wn?"inside":"right"}#Li(t){const e=a(t);return e?`${String(e.getUTCDate()).padStart(2,"0")} ${ii[e.getUTCMonth()]}`:o(t)??String(t)}#Ii(t){return!t||t.editable===!1?null:t.editField?String(t.editField):t.kind==="name"?"name":t.kind==="progress"?"percentComplete":t.kind==="deadline"?"deadline":De.has(t.kind)||Be.has(t.kind)?t.kind:t.editable===!0?t.key:null}#Nn(t,e){if(e.unscheduled)return"";if(t==="duration")return e.duration==null?"":String(d(e.duration));const n=t==="start"?e.es:e.ef;return n==null?"":o(n)??String(d(n))}#Fi(t){return t.deadline==null?"":o(t.deadline)??String(d(t.deadline))}#Ot(t){const e=this.#t.schedule;return e&&e.ok&&e.tasks.get(String(t))||null}#Ln(t){const e=String(t??"").trim();if(e==="")return null;if(/^-?\d+(\.\d+)?$/.test(e))return Number(e);const n=p(e);return Number.isFinite(n)?n:null}#Ms(t){if(this.#rt)return;const e=t.target,n=e&&e.closest?e.closest(`.${s}__cell`):null;if(!n)return;const c=n.closest(`.${s}__row`);if(!c)return;const A=c.getAttribute("data-task"),M=this.#s[Number(n.getAttribute("data-col"))],F=this.#Ii(M);if(!A||!F)return;const E=this.#t.schedule&&this.#t.schedule.ok?this.#t.schedule.tasks.get(A):null;E&&E.isSummary||this.#Ts(n,A,F,M)}#Ts(t,e,n,c){const A=this.#t.taskById(e)||{},M=this.#Ot(e),F=n==="percentComplete"||n==="duration"||Be.has(n)||c.kind==="progress"||c.kind==="number";let E;for(n==="duration"&&M?E=M.unscheduled?"":d(M.duration):Be.has(n)&&M?E=this.#oi(n,M).replace("%",""):n==="start"&&M?E=this.#Nn("start",M):n==="end"&&M?E=this.#Nn("end",M):n==="deadline"&&M?E=this.#Fi(M):n==="percentComplete"&&M&&M.percentComplete!=null?E=M.percentComplete:E=A[n]==null?"":A[n];t.firstChild;)t.removeChild(t.firstChild);const rt=this.#e.createElement("input");rt.setAttribute("class",`${s}__editor`);const _t=/^\d{4}-\d{2}-\d{2}$/.test(String(E));rt.setAttribute("type",F?"number":_t?"date":"text"),rt.value=String(E),t.appendChild(rt),this.#rt=!0,rt.focus&&rt.focus();let ut=!1;const Nt=(Wt,te)=>{ut||(ut=!0,this.#rt=!1,Wt?this.#Ri(e,n,rt.value,F,te):this.draw())};rt.addEventListener("keydown",Wt=>{Wt.key==="Enter"?(Wt.preventDefault&&Wt.preventDefault(),Nt(!0,Wt)):Wt.key==="Escape"&&(Wt.preventDefault&&Wt.preventDefault(),Nt(!1))}),rt.addEventListener("blur",Wt=>Nt(!0,Wt))}#Ri(t,e,n,c,A=null){if(e==="start"||e==="end"){const F=this.#Ln(n),E=this.#Ot(t);if(F==null||!E){this.draw();return}e==="start"||E.unscheduled?this.#t.applyEdit({id:t,[e]:F},{writeBack:!0,event:A}):this.#t.applyEdit({id:t,duration:Math.max(0,E.duration+(F-E.ef))},{writeBack:!0,event:A}),this.draw();return}if(e==="deadline"){const F=String(n??"").trim();if(F==="")this.#t.applyEdit({id:t,deadline:null},{writeBack:!0,event:A});else{const E=this.#Ln(F);this.#t.applyEdit({id:t,deadline:Number.isFinite(E)?o(E)??E:F},{writeBack:!0,event:A})}this.draw();return}let M=n;if(c){const F=Number(n);if(!Number.isFinite(F)){this.draw();return}e==="percentComplete"?M=Math.max(0,Math.min(100,F)):e==="duration"||e==="effort"?M=Math.max(0,F):e==="units"?M=Math.max(0,F)/100:M=F}this.#t.applyEdit({id:t,[e]:M},{writeBack:!0,event:A}),this.draw()}#we(t){const e=t&&t.target,n=e&&e.closest?e.closest(`.${s}__wl-bucket`):null;if(!n)return null;const c=n.closest(`.${s}__wl-timerow`),A=c&&c.getAttribute("data-resource")||"",M=c&&c.getAttribute("data-task")||null,F=this.#B;if(!F||!Array.isArray(F.rows)||!Array.isArray(F.buckets))return null;const E=n.getAttribute("data-bucket"),rt=F.buckets.findIndex(ue=>(o(ue.start)??String(ue.start))===E);if(rt<0)return null;const _t=F.rows.find(ue=>(ue.resource==null?"":ue.resource)===A),ut=F.buckets[rt];if(!_t||!ut)return null;const Nt=M!=null&&Array.isArray(_t.tasks)&&_t.tasks.find(ue=>String(ue.id)===String(M))||null,Wt=M!=null?this.#Ot(M):null,te=_t.resource==null?this.#u("gantt.workload.unassigned"):this.#st(_t.resource);return{cell:n,rowKey:A,taskId:M,index:rt,row:_t,bucket:ut,sub:Nt,rec:Wt,resourceName:te}}#Dt(t,e){return t?qe({view:this,unit:this.getWorkloadUnit(),resourceName:t.resourceName,rows:this.#B?this.#B.rows:[],buckets:this.#B?this.#B.buckets:[],rowKey:t.rowKey,index:t.index,sub:t.sub,rec:t.rec,event:e}):null}#Es(t){const e=this.#we(t);if(!e)return;const n=this.#Dt(e,t);if(!_e(this.#t,"workloadCellDblClick",n)){t.preventDefault&&t.preventDefault();return}this.#rt||!this.#n.editable||!e.taskId||this.#Ki(e.cell,e.taskId,e.rowKey,e.index)}#Os(t){const e=this.#we(t);if(!e)return;const{row:n,bucket:c,index:A}=e,M=n.cells[A]??0,F=n.available?n.available[A]??null:null,E=(n.tasks||[]).filter(rt=>(rt.cells[A]??0)>0).map(rt=>({id:rt.id,name:rt.name,hours:rt.cells[A]}));typeof this.#t.emitWorkloadClick=="function"&&this.#t.emitWorkloadClick({resource:n.resource,bucketStart:o(c.start)??String(c.start),bucketEnd:o(c.end)??String(c.end),booked:M,available:F,tasks:E}),Ee(this.#t,"workloadCellClick",this.#Dt(e,t))}#Ds(t){const e=t&&typeof t.closest=="function"?t.closest('[role="gridcell"]'):null;if(!e)return null;const n=e.closest("[data-key]"),c=n&&n.getAttribute("data-key")||"",A=c.indexOf("\0");return{cell:e,resource:A<0?c:c.slice(0,A),taskId:A<0?null:c.slice(A+1),colId:e.getAttribute("data-col")}}#tn(t){const e=this.#Ds(t);if(!e||!e.colId)return null;const n=this.#B;if(!n||!Array.isArray(n.rows)||!Array.isArray(n.buckets))return null;const c=this.#ge?this.#ge.get(String(e.colId)):null;if(c==null)return null;const A=n.rows.find(ut=>(ut.resource==null?"":ut.resource)===e.resource),M=n.buckets[c];if(!A||!M)return null;const F=e.taskId||null,E=F!=null&&Array.isArray(A.tasks)&&A.tasks.find(ut=>String(ut.id)===String(F))||null,rt=F!=null?this.#Ot(F):null,_t=A.resource==null?this.#u("gantt.workload.unassigned"):this.#st(A.resource);return{cell:e.cell,rowKey:e.resource,taskId:F,index:c,row:A,bucket:M,sub:E,rec:rt,resourceName:_t}}#Ps(t){const e=this.#tn(t&&t.target);e&&(this.#Ls(e.rowKey,o(e.bucket.start)??String(e.bucket.start)),Ee(this.#t,"workloadCellClick",this.#Dt(e,t)))}#js(t){const e=this.#tn(t&&t.target);if(!e)return;const n=this.#Dt(e,t);if(!_e(this.#t,"workloadCellDblClick",n)){t.preventDefault&&t.preventDefault();return}this.#rt||!this.#n.editable||!e.taskId||this.#Ki(e.cell,e.taskId,e.rowKey,e.index)}#Ns(t){const e=this.#tn(t&&t.target);if(!e)return;!_e(this.#t,"workloadCellContextMenu",this.#Dt(e,t))&&t.preventDefault&&t.preventDefault()}#Bi(t){const e=this.#tn(t&&t.target);if(!e){this.#Wt();return}const n=this.#Ht;if(n&&n.key===e.rowKey&&n.index===e.index&&(n.taskId??null)===e.taskId){this.#In(e,t);return}n&&this.#pn(t),this.#Ht={key:e.rowKey,index:e.index,taskId:e.taskId},Ee(this.#t,"workloadCellHover",this.#Dt(e,t)),this.#Gi(e,t)}#zi(t){const e=this.#Ht;if(!e){this.#Wt();return}const n=t&&t.relatedTarget?this.#tn(t.relatedTarget):null;n&&n.rowKey===e.key&&n.index===e.index&&(n.taskId??null)===e.taskId||(this.#pn(t),this.#Wt())}#Ls(t,e){const n=this.#B;if(!n||!Array.isArray(n.rows)||!Array.isArray(n.buckets)||!e)return;const c=n.buckets.findIndex(_t=>(o(_t.start)??String(_t.start))===e);if(c<0)return;const A=n.rows.find(_t=>(_t.resource==null?"":_t.resource)===t),M=n.buckets[c];if(!A||!M)return;const F=A.cells[c]??0,E=A.available?A.available[c]??null:null,rt=(A.tasks||[]).filter(_t=>(_t.cells[c]??0)>0).map(_t=>({id:_t.id,name:_t.name,hours:_t.cells[c]}));typeof this.#t.emitWorkloadClick=="function"&&this.#t.emitWorkloadClick({resource:A.resource,bucketStart:o(M.start)??String(M.start),bucketEnd:o(M.end)??String(M.end),booked:F,available:E,tasks:rt})}#Is(t){const e=this.#we(t);if(!e)return;!_e(this.#t,"workloadCellContextMenu",this.#Dt(e,t))&&t.preventDefault&&t.preventDefault()}#Fs(t){const e=t.key;if(e==="Enter"||e===" "){if(t.ctrlKey||t.metaKey||t.altKey)return;const F=this.#we(t);if(!F)return;t.preventDefault&&t.preventDefault(),Ee(this.#t,"workloadCellClick",this.#Dt(F,t));return}if(e!=="ArrowLeft"&&e!=="ArrowRight"&&e!=="ArrowUp"&&e!=="ArrowDown")return;const n=t.target&&t.target.closest?t.target.closest(`.${s}__wl-bucket`):null;if(!n)return;const c=n.closest(`.${s}__wl-timerow`);if(!c||!this.#v)return;const A=[...c.querySelectorAll(`.${s}__wl-bucket`)],M=A.indexOf(n);if(e==="ArrowLeft"||e==="ArrowRight"){const F=e==="ArrowRight"?1:-1,E=A[M+F];E&&this.#Hi(c,M+F,E)}else{const F=[...this.#v.querySelectorAll(`.${s}__wl-timerow`)],E=e==="ArrowDown"?1:-1;let rt=F[F.indexOf(c)+E];for(;rt&&rt.classList.contains(`${s}__wl-timerow--total`);)rt=F[F.indexOf(rt)+E];if(!rt)return;const _t=rt.querySelectorAll(`.${s}__wl-bucket`)[M];_t&&this.#Hi(rt,M,_t)}t.preventDefault&&t.preventDefault()}#Hi(t,e,n){const c=t.getAttribute("data-resource")||"",A=t.getAttribute("data-task");this.#wn.set(`${c}${A??""}`,e),[...t.querySelectorAll(`.${s}__wl-bucket`)].forEach((M,F)=>{M.setAttribute("tabindex",F===e?"0":"-1")}),n.focus&&n.focus()}#Wi(t){const e=this.#we(t);if(!e){this.#Wt();return}const n=this.#Ht;if(n&&n.key===e.rowKey&&n.index===e.index&&(n.taskId??null)===e.taskId){this.#In(e,t);return}n&&this.#pn(t),this.#Ht={key:e.rowKey,index:e.index,taskId:e.taskId},Ee(this.#t,"workloadCellHover",this.#Dt(e,t)),this.#Gi(e,t)}#Ui(t){const e=this.#Ht;if(!e){this.#Wt();return}const n=t&&t.relatedTarget?this.#we({target:t.relatedTarget}):null;n&&n.rowKey===e.key&&n.index===e.index&&(n.taskId??null)===e.taskId||(this.#pn(t),this.#Wt())}#pn(t){const e=this.#Ht;if(this.#Ht=null,!e)return;const n=this.#B,c=n&&Array.isArray(n.rows)?n.rows.find(E=>(E.resource==null?"":E.resource)===e.key):null,A=n&&Array.isArray(n.buckets)?n.buckets[e.index]:null;if(!c||!A)return;const M=e.taskId!=null&&Array.isArray(c.tasks)&&c.tasks.find(E=>String(E.id)===String(e.taskId))||null,F=e.taskId!=null?this.#Ot(e.taskId):null;Ee(this.#t,"workloadCellHoverEnd",qe({view:this,unit:this.getWorkloadUnit(),resourceName:c.resource==null?this.#u("gantt.workload.unassigned"):this.#st(c.resource),rows:n.rows,buckets:n.buckets,rowKey:e.key,index:e.index,sub:M,rec:F,event:t}))}#Rs(t){const e=t&&t.target;if(!e||!e.closest||e.closest(`.${s}__wl-toggle`))return;const n=e.closest(`.${s}__wl-row`);if(!n||n.getAttribute("data-task"))return;const c=n.getAttribute("data-resource")||"",A=this.#B,M=A&&Array.isArray(A.rows)?A.rows.find(F=>(F.resource==null?"":F.resource)===c):null;M&&Ee(this.#t,"workloadResourceClick",{resource:M.resource,resourceName:M.resource==null?this.#u("gantt.workload.unassigned"):this.#st(M.resource),view:this,event:t})}#Gi(t,e){if(!this.#W)return;const n=this.#Dt(t,e);if(!n){this.#Wt();return}const c=this.#k?this.#k.tooltip:!0;if(c===!1){this.#Wt();return}let A;if(typeof c=="function"){try{A=c(n)}catch{A=null}if(A==null||A===""){this.#Wt();return}}else A=this.#xi(t.resourceName,t.bucket,n.booked,n.available,n.over,t.row,t.index,this.#k);for(;this.#W.firstChild;)this.#W.removeChild(this.#W.firstChild);typeof A=="string"?u(this.#W,A):A&&A.appendChild&&this.#W.appendChild(A),this.#W.removeAttribute("hidden"),this.#In(t,e)}#In(t,e){if(!this.#W||this.#W.hasAttribute("hidden")||!this.#R)return;const n=this.#R.getBoundingClientRect?this.#R.getBoundingClientRect():{left:0,top:0,width:0,height:0},c=e&&(e.type==="focusin"||e.type==="focus");let A,M;if(!c&&Number.isFinite(e&&e.clientX)&&Number.isFinite(e&&e.clientY)&&(e.clientX!==0||e.clientY!==0))A=e.clientX-n.left+12,M=e.clientY-n.top-28;else if(t&&t.cell&&t.cell.getBoundingClientRect){const ut=t.cell.getBoundingClientRect();A=ut.left-n.left,M=ut.top-n.top-28}else return;const F=this.#W.offsetWidth||0,E=this.#W.offsetHeight||0,rt=n.width||this.#R.clientWidth||0,_t=n.height||this.#R.clientHeight||0;A=Math.min(Math.max(0,A),Math.max(0,rt-F-4)),M=Math.min(Math.max(0,M),Math.max(0,_t-E)),this.#W.style.left=`${d(A)}px`,this.#W.style.top=`${d(M)}px`}#Wt(){this.#W&&this.#W.setAttribute("hidden","")}#Ki(t,e,n,c){let A=t.getAttribute("data-hours");if(A==null){const ut=this.#B&&this.#B.rows?this.#B.rows.find(Wt=>(Wt.resource==null?"":Wt.resource)===n):null,Nt=ut&&ut.tasks?ut.tasks.find(Wt=>String(Wt.id)===String(e)):null;Nt&&Array.isArray(Nt.cells)&&Nt.cells[c]!=null&&(A=String(Nt.cells[c]))}const M=this.#k;for(;t.firstChild;)t.removeChild(t.firstChild);const F=this.#e.createElement("input");F.setAttribute("class",`${s}__wl-editor`),F.setAttribute("type","number");let E=null;if(M.unit==="percent"){const ut=this.#B&&this.#B.rows?this.#B.rows.find(Nt=>(Nt.resource==null?"":Nt.resource)===n):null;E=ut&&ut.available?ut.available[c]:null}F.value=A==null?"":E!=null&&E>0?Zt(Number(A),E,M.decimals):Rt(Number(A),M.decimals),t.appendChild(F),this.#rt=!0,F.focus&&F.focus();let rt=!1;const _t=(ut,Nt)=>{rt||(rt=!0,this.#rt=!1,ut?this.#Bs(e,n,c,F.value,Nt):this.draw())};F.addEventListener("keydown",ut=>{ut.key==="Enter"?(ut.preventDefault&&ut.preventDefault(),_t(!0,ut)):ut.key==="Escape"&&(ut.preventDefault&&ut.preventDefault(),_t(!1))}),F.addEventListener("blur",ut=>_t(!0,ut))}#Bs(t,e,n,c,A=null){const M=this.#k,F=this.#B,E=F&&F.buckets?F.buckets[n]:null,rt=F&&F.rows?F.rows.find(Se=>(Se.resource==null?"":Se.resource)===e):null,_t=rt&&rt.tasks?rt.tasks.find(Se=>String(Se.id)===String(t)):null,ut=this.#Ot(t);if(!M||!E||!_t||!ut){this.draw();return}const Nt=String(c??"").trim(),Wt=Nt===""?0:Number(Nt);if(!Number.isFinite(Wt)||Wt<0){this.draw();return}let te=Wt;if(M.unit==="percent"){const Se=rt.available?rt.available[n]:null;Se!=null&&Se>0&&(te=Wt/100*Se)}const ue=this.#pe(),Gt=ue?Se=>!ue(Se):null,re=[];for(let Se=Math.floor(E.start);Se<Math.ceil(E.end);Se+=1)(!Gt||Gt(Se))&&re.push(Se);const Xt=o(E.start)??String(E.start);if(!re.length){this.#ht(this.#u("gantt.a11y.hoursRefused",{name:_t.name,date:Xt}),{repeat:!0}),this.draw();return}const Qt=se(ut,Gt),ee=re.filter(Se=>Qt.includes(Se)),ke=ee.length?ee:re,pe=_t.raw||{};let Ae=Ht(pe);if(!Ae){const Se=xt(pe),Ye=Se??Qt.length*M.hoursPerDay*_t.unitsTotal;Ae=qt(Qt,Ye)}const Ce=_t.units>0?_t.unitsTotal/_t.units:1,Oe=ge(Ae,E,ke,te*Ce);this.#t.applyEdit({id:t,work:$e(Oe)},{writeBack:!0,event:A}),this.#ht(te>0?this.#u("gantt.a11y.hoursSet",{name:_t.name,hours:Rt(te,M.decimals),date:Xt}):this.#u("gantt.a11y.hoursCleared",{name:_t.name,date:Xt}),{repeat:!0}),this.draw()}#zs(t){const e=new Map,n=new Map;for(const A of this.#t.dependencies){const M=String(A.from),F=String(A.to);(n.get(M)||n.set(M,[]).get(M)).push(F),(e.get(F)||e.set(F,[]).get(F)).push(M)}const c=A=>{const M=new Set([t]),F=[t];for(;F.length;){const E=F.pop();for(const rt of A.get(E)||[])M.has(rt)||(M.add(rt),F.push(rt))}return M.delete(t),M};return{preds:c(e),succs:c(n)}}#Hs(){this.#I=on({doc:this.#e,t:this.#u,ns:s,onSelect:e=>this.#Ws(e),onFix:(e,n)=>this.#Gs(e,n)}),this.#a.appendChild(this.#I.element);const t=typeof this.#t.schedulingConflicts<"u"?this.#t.schedulingConflicts:[];this.#I.update(t||[]),this.#_t=this.#t.on("schedulingConflict",e=>{this.#I&&this.#I.update(e&&e.conflicts||[])})}getIssuesPanelState(){return this.#I?{open:this.#I.isOpen()}:null}setIssuesPanelState(t){this.#I&&t&&typeof t.open=="boolean"&&this.#I.setOpen(t.open)}#Ws(t){const e=t.tasks&&t.tasks.length?t.tasks[0]:null;e!=null&&this.scrollToTask(e),this.#Us(t)}#Us(t){if(!this.#a)return;this.#mn();const e=new Set((t.tasks||[]).map(String));for(const A of e){const M=this.#c&&this.#c.querySelector(`.${s}__row[data-task="${A}"]`);M&&M.classList.add(`${s}__row--chain`)}const n=this.#r;if(!n)return;const c=new Set((t.links||[]).map(A=>`${A.from}>${A.to}`));for(const A of n.querySelectorAll(`.${s}__link`)){const M=`${A.getAttribute("data-from")}>${A.getAttribute("data-to")}`;c.has(M)&&A.classList.add(`${s}__link--chain`)}for(const A of e){const M=n.querySelector(`.${s}__barrow[data-task="${A}"]`);if(!M)continue;const F=M.querySelector(`.${s}__bar`)||M.querySelector(`.${s}__milestone`)||M.querySelector(`.${s}__summary-bar`);if(!F)continue;const E=F.getAttribute("class")||"";E.includes(`${s}__milestone`)?F.classList.add(`${s}__milestone--chain`):E.includes(`${s}__summary-bar`)?F.classList.add(`${s}__summary-bar--chain`):F.classList.add(`${s}__bar--chain`)}}#Gs(t,e){const n=t.tasks&&t.tasks.length?t.tasks[0]:null;if(e==="removeLink"){const c=(t.links||[])[0];if(!c)return;const A=String(c.from),M=String(c.to),F=this.#t.dependencies.find(E=>String(E.from)===A&&String(E.to)===M);F&&this.#t.deleteDependency(F);return}n!=null&&(e==="asap"?this.#t.applyEdit({id:n,constraint:{type:"ASAP"}}):e==="unlock"?this.#t.applyEdit({id:n,locked:!1}):e==="clearDeadline"&&this.#t.applyEdit({id:n,deadline:null}))}#Ks(t){if(!this.#a)return;this.#mn();const{preds:e,succs:n}=this.#zs(t),c=M=>M===t?"hover":e.has(M)?"pred":"succ";for(const M of[...e,...n,t]){const F=this.#c&&this.#c.querySelector(`.${s}__row[data-task="${M}"]`);F&&F.classList.add(`${s}__row--chain-${c(M)}`)}const A=this.#r;if(A){for(const M of A.querySelectorAll(`.${s}__link`)){const F=M.getAttribute("data-from"),E=M.getAttribute("data-to");if(!(F!=null&&E!=null&&(e.has(F)||n.has(F)||F===t)&&(e.has(E)||n.has(E)||E===t)))continue;const _t=E===t||e.has(E)?"pred":"succ";M.classList.add(`${s}__link--chain-${_t}`);const ut=M.parentNode&&M.parentNode.querySelector?M.parentNode.querySelector(`.${s}__arrowhead`):null;ut&&ut.classList.add(`${s}__arrowhead--chain-${_t}`)}for(const M of[...e,...n,t]){const F=A.querySelector(`.${s}__barrow[data-task="${M}"]`);if(!F)continue;const E=F.querySelector(`.${s}__bar`)||F.querySelector(`.${s}__milestone`)||F.querySelector(`.${s}__summary-bar`);if(!E)continue;const rt=E.getAttribute("class")||"",_t=rt.includes(`${s}__milestone`)?"milestone":rt.includes(`${s}__summary-bar`)?"summary-bar":"bar";E.classList.add(`${s}__${_t}--chain-${c(M)}`)}this.#Vs(t,e.size,n.size)}}#Vs(t,e,n){const c=this.#r&&this.#r.querySelector(`.${s}__barrow[data-task="${t}"]`);c&&(this.#kt=this.#u("gantt.a11y.chain",{preds:String(e),succs:String(n)}),this.#pt=c,this.#Fn(c))}#Fn(t){if(t!==this.#pt||!this.#kt)return;const e=t.getAttribute("aria-description");e&&e.endsWith(this.#kt)||(this.#$t=e,t.setAttribute("aria-description",[e,this.#kt].filter(Boolean).join(" ")))}#Ys(){if(!this.#pt)return;const t=this.#pt;this.#pt=null,this.#kt=null,this.#$t!=null?this.#$t?t.setAttribute("aria-description",this.#$t):t.removeAttribute("aria-description"):et(t),this.#$t=null}#mn(){if(!this.#a)return;const t=[];for(const e of["row","link","arrowhead","bar","milestone","summary-bar"]){t.push(`${s}__${e}--chain`);for(const n of["hover","pred","succ"])t.push(`${s}__${e}--chain-${n}`)}for(const e of t)for(const n of this.#a.querySelectorAll(`.${e}`))n.classList.remove(e);this.#Ys()}#Zs(t){if(this.#rt||this.#F&&this.#F.dragging)return;const e=t.target,n=e&&e.closest?e.closest(`.${s}__row`)||e.closest(`.${s}__barrow`):null,c=n?n.getAttribute("data-task"):null;c?this.#Ks(c):this.#mn()}toSVG(t={}){if(!this.#M)return"";const e=this.#e&&this.#e.defaultView||globalThis;return ln(this.#M,{...t,el:this.#a,view:e})}[Ri](){return this.#M?en({controller:this.#t,exportModel:this.#M,nonWorking:this.#pe(),element:this.#a,messages:this.#n.messages||this.#t.grid&&this.#t.grid.messages||null}):null}#Xs(t){const e=ei();if(!e)return null;const n=this.#e.createElement("div");n.setAttribute("class",`${s}__zoom ${s}__pdf`);const c=this.#e.createElement("button");c.setAttribute("type","button"),c.setAttribute("class",`${s}__zoom-btn`),c.setAttribute("data-action","pdf");const A={messages:this.#n.messages||this.#t.grid&&this.#t.grid.messages||null};return c.textContent=e.label(A,"gantt.exportPdf"),c.addEventListener("click",()=>{const M=this.#t;M&&M.export&&M.export.pdf&&M.export.pdf({download:!0,fileName:"gantt.pdf"})}),n.appendChild(c),t.appendChild(n),c}async toPNG(t={}){const e=this.toSVG(t);if(!e)return null;const n=/width="(\d+)" height="(\d+)"/.exec(e),c=n?Number(n[1]):0,A=n?Number(n[2]):0;if(!c||!A)return null;const M=this.#e&&this.#e.defaultView||globalThis,F=t.scale||M.devicePixelRatio||1,E="background"in t?t.background:Ge(M,this.#a,"--lattice-background")||null;return ne(this.#e,e,c,A,F,E)}print(t={}){if(!this.#M)return me("gantt-print-not-drawn","[lattice] gantt: print() called before anything was drawn; nothing to print."),!1;const e=this.#t.grid,n=e&&e.messages,c=n&&n.locale||void 0,A=this.#e&&this.#e.defaultView||globalThis,M=pn(this.#M,{...t,title:t.title===!1?!1:t.title||this.#M.title||this.#t.title||null,locale:c,t:this.#u,el:this.#a,view:A});return xe(this.#e,M)}#qs(){const t=this.#to(),e=di(this.#n.columns,t,["name","start","end","duration","assignee","progress"],"name");this.#Sn=new Map;for(const M of e){if(M.dateFormat!=null){const E=jn(M.dateFormat);E&&(M.format=E)}delete M.dateFormat;const F=M.editField||(Qe[M.id]&&t.has(M.id)?Qe[M.id]:M.field??M.id);F&&this.#Sn.set(M.id,String(F)),delete M.editField,this.#Js(M)}const n=k(this.#e,"div",`${s}__lgrid ${s}__lgrid--tasks`);this.#a.appendChild(n);const c=new ui({createGrid:this.#dt,host:n,columns:e,rowHeight:Number(this.#n.rowHeight)||34,headerHeight:this.#n.headerHeight,config:this.#bn({edit:!!this.#n.editable,...this.#Bn()?{contextMenu:!1}:{}},"tasks","multiple"),keepAncestors:!0,ancestorClass:`${s}__row--ancestor`,treeSort:!0});this.#C=c,this.#Ze=fi(n,this.#f,this.#n.headerHeight),this.#Ye.push(this.#Ze),c.lockScroll(this.#r);const A=()=>{this.#Tt||this.draw()};c.on("sort:changed",A),c.on("filter:changed",A),c.on("selection:changed",M=>{this.#T||this.#t.noteGridSelection(Array.isArray(M&&M.keys)?M.keys:[])}),c.on("cell:changed",M=>this.#lo(M)),c.on("cell:clicked",M=>this.#Qs(M)),c.on("column:resized",M=>{M&&M.colId!=null&&this.#me(String(M.colId),M.width)}),this.#Bn()&&c.on("cell:contextmenu",M=>{const F=M&&M.event,E=F?null:this.#e.activeElement||null;this.#Yi(M&&M.key!=null?M.key:M&&M.row?M.row.key:null,F||null,E)}),this.#Ve=new ot({controller:this.#t,table:c,view:()=>this}),this.#Ve.attach(n),this.#ve("task",c)}#Js(t){if(typeof t.render!="function"||t.cell&&typeof t.cell.render<"u")return;const e=t.render;delete t.render,t.cell={...t.cell||{},render:n=>{const c=n&&n.row&&n.row.data||{},A=String(c.__key),M=this.#Ot(A),F=this.#t.taskById&&this.#t.taskById(A)||{};return e(M,{rawTask:F,depth:Number(c.__depth)||0})}}}#Qs(t){if(!t||t.key==null||t.colId==null)return;const e=t.event,n=e&&e.target,c=n&&typeof n.closest=="function"?n.closest(".lat-cell"):null;typeof this.#t.emitCellClick=="function"&&this.#t.emitCellClick({task:this.#t.taskById(String(t.key)),columnKey:String(t.colId),element:c})}#to(){const t=!!this.#n.editable,e=this.#u,n=new Map,c=F=>this.#so(F);this.#fe.add(c),n.set("name",{id:"name",field:"name",title:e("gantt.col.name"),layout:{flex:1,min:be,movable:!1},edit:{enabled:t},cell:{render:c}});for(const F of["start","end"])n.set(F,{id:F,field:F,title:e(`gantt.col.${F}`),type:"date",format:this.#Rn(),layout:{width:96},edit:{enabled:t,editor:bn}});n.set("deadline",{id:"deadline",field:"deadline",title:e("gantt.col.deadline"),type:"date",format:this.#Rn(),layout:{width:96},edit:{enabled:t,editor:bn}}),n.set("duration",{id:"duration",field:"duration",title:e("gantt.col.duration"),type:"number",layout:{width:84},edit:{enabled:t}}),n.set("wbs",{id:"wbs",field:"wbs",title:e("gantt.col.wbs"),type:"text",value:{compare:Si},layout:{width:64},edit:{enabled:!1}});const A=F=>this.#oo(F);this.#fe.add(A),n.set("assignee",{id:"assignee",field:"assignee",title:e("gantt.col.assignee"),layout:{width:96},edit:{enabled:!1},cell:{render:A}});const M=F=>this.#ao(F);this.#fe.add(M),n.set("progress",{id:"progress",field:"percentComplete",title:e("gantt.col.progress"),type:"number",layout:{width:56},edit:{enabled:t},validation:{min:0,max:100},cell:{render:M}}),n.set("effort",{id:"effort",field:"effort",title:e("gantt.col.effort"),type:"number",layout:{width:76},edit:{enabled:t}}),n.set("units",{id:"units",field:"units",title:e("gantt.col.units"),type:"number",layout:{width:76},edit:{enabled:t}}),n.set("unscheduled",{id:"unscheduled",field:"__unscheduled",title:e("gantt.col.unscheduled"),type:"boolean",layout:{width:96},edit:{enabled:!1}}),n.set("inactive",{id:"inactive",field:"inactive",title:e("gantt.col.inactive"),type:"boolean",layout:{width:90},edit:{enabled:t}});for(const[F,E]of Un({t:e,editable:t,dateFormat:this.#Rn(),dateEditor:bn}))n.set(F,E);for(const[F,E]of Ke({t:e,editable:t}))n.set(F,E);if(this.#n.dirtyMarks)for(const[F,E]of n)this.#eo(F,E);return n}#eo(t,e){const n=bi[t]||e.field;n&&(e.cell={...e.cell||{},classWhen:{...e.cell&&e.cell.classWhen||{},[Fn]:c=>{const A=c&&c.row&&c.row.data&&c.row.data.__dirty;return!!(A&&A.has(n))}}})}#Rn(){const t=jn(this.#n.dateFormat);return t||(this.#be()?{type:"date",dateStyle:"short"}:{type:"date",pattern:"yyyy-MM-dd"})}#bn(t,e,n){const c=this.#be();return{...Ji(this.#n.gridConfig,e,t,n),...c?{locale:c}:{}}}#no(t,e,n){const c=t.rec;return{...e,__key:t.id,__depth:t.depth,__hasChildren:t.hasChildren,__summary:!!c.isSummary,__unscheduled:!!c.unscheduled,id:e.id!=null?e.id:t.id,name:c.name,wbs:c.wbs,start:o(c.es)??c.es,end:o(c.ef)??c.ef,duration:c.duration==null?null:d(c.duration),inactive:!!c.inactive,deadline:c.deadline!=null?o(c.deadline)??c.deadline:e.deadline??null,percentComplete:c.percentComplete==null?null:c.percentComplete,effort:c.isSummary||!(c.effort>0)?null:d(c.effort),units:c.isSummary||!(c.units>0)?null:Math.round(c.units*100),...cn(c,e,n)}}#io(t,e){const n=this.#C,c=new Map(this.#t.tasks.map(Gt=>[String(this.#t.readId(Gt)),Gt])),A=this.#n.dirtyMarks&&typeof this.#t.changes=="function"?ze(this.#t.changes(),Gt=>String(this.#t.readId(Gt))):null,M=e&&e.ok&&n.grid.columns.visible().some(Gt=>Gt.id in mn)?zn(e.tasks):null,F=M?this.#t.dependencies:[],E=(Gt,re)=>{const Xt=new Map(this.#Xn(Gt).map(Qt=>[Qt.id,Qt.height]));this.#Tt=!0;try{const Qt=Gt.map((ee,ke)=>({...this.#no(ee,c.get(ee.id)||{},ke+1),predecessors:M?Yn(ee.id,"predecessors",F,M.byId):"",successors:M?Yn(ee.id,"successors",F,M.byId):"",__keep:re.has(ee.id)?"1":"",__ancestor:re.has(ee.id),__dirty:A?A.get(ee.id):void 0}));if(n.setRows(Qt,Xt),n.grid.columns.visible().some(ee=>ee.id==="sequence")){const ee=new Map(n.displayedKeys().map((ke,pe)=>[ke,pe+1]));if(Qt.some(ke=>ee.has(ke.__key)&&ee.get(ke.__key)!==ke.sequence)){for(const ke of Qt)ee.has(ke.__key)&&(ke.sequence=ee.get(ke.__key));n.setRows(Qt,Xt)}}}finally{this.#Tt=!1}},rt=Gt=>{const re=new Map(Gt.map(Xt=>[Xt.id,Xt]));return n.displayedKeys().map(Xt=>re.get(Xt)).filter(Boolean)};if(this.#y=new Set,this.#D=new Set,!n.isFiltering())return E(t,this.#y),rt(t);const _t=this.#xn(e,!0);E(_t,this.#y);const ut=new Set(rt(_t).map(Gt=>Gt.id)),Nt=new Map(_t.map(Gt=>[Gt.id,Gt.rec.parent==null?null:String(Gt.rec.parent)])),Wt=vi(ut,Nt);for(const Gt of _t)!ut.has(Gt.id)&&!Wt.has(Gt.id)&&this.#D.add(Gt.id);const te=Gt=>{for(let re=Nt.get(Gt);re!=null;re=Nt.get(re))if(this.#m.has(re))return!0;return!1},ue=_t.filter(Gt=>!this.#D.has(Gt.id)&&!te(Gt.id));return this.#y=new Set(ue.filter(Gt=>Wt.has(Gt.id)).map(Gt=>Gt.id)),E(ue,this.#y),rt(ue)}#ro(){const t=this.#C.host;t.style.width=`${this.#X()}px`;const e=(this.#R&&this.#R.offsetHeight||0)+(this.#j&&this.#j.offsetHeight||0)+(this.#o?this.#o.height():0)+(this.#d?this.#d.height():0);t.style.bottom=`${e}px`;for(const n of[this.#f,this.#c])if(n)for(;n.firstChild;)n.removeChild(n.firstChild);this.#f&&(this.#f.style.height=`${this.#n.headerHeight}px`),this.#Ze&&this.#Ze.apply()}#so(t){const e=t&&t.row&&t.row.data||{},n=k(this.#e,"span",`${s}__lgrid-name`);n.style.paddingLeft=`${(e.__depth||0)*(this.#n.indent||16)}px`;const c=this.#e.createElement("button");c.setAttribute("class",`${s}__chevron`),c.setAttribute("type","button");const A=String(e.__key);if(e.__hasChildren){const F=this.#m.has(A);u(c,F?"▸":"▾"),c.setAttribute("aria-label",this.#u(F?"gantt.row.expand":"gantt.row.collapse",{name:e.name})),c.setAttribute("aria-expanded",F?"false":"true"),c.addEventListener("click",E=>{E&&E.stopPropagation&&E.stopPropagation(),this.toggle(A,{event:E})}),c.addEventListener("keydown",E=>{E&&(E.key==="Enter"||E.key===" "||E.key==="Spacebar")&&(E.preventDefault&&E.preventDefault(),E.stopPropagation&&E.stopPropagation(),this.toggle(A,{event:E}))})}else c.setAttribute("aria-hidden","true");n.appendChild(c);const M=k(this.#e,"span",`${s}__name-text${e.__summary?` ${s}__name-text--summary`:""}`);return u(M,t&&t.text!=null?String(t.text):String(e.name??"")),n.appendChild(M),e.__unscheduled&&n.appendChild(Hn(this.#e,s,this.#u)),n}#oo(t){const e=t&&t.row&&t.row.data||{},n=String(e.__key),c=k(this.#e,"span",`${s}__lgrid-name`),A=this.#Ot(n);return this.#si(c,this.#t.taskById(n)||{},A?{id:n,rec:A}:null),c}#ao(t){const e=t&&t.row&&t.row.data||{},n=k(this.#e,"span",`${s}__lgrid-name`),c=this.#Ot(String(e.__key));return c&&this.#ai(n,c),n}#lo(t){if(this.#Tt||!t||t.key==null)return;const e=this.#Sn.get(String(t.colId));if(!e)return;const n=String(t.key);if(mn[e]&&e===String(t.colId)){this.#co(n,e,t.value);return}const c=this.#Ot(n);if(!c||c.isSummary&&e!=="name"){Promise.resolve().then(()=>this.draw());return}let A=t.value;if(e==="start"||e==="end"||e==="deadline"||e==="constraintDate"){const F=A instanceof Date?p(A):this.#Ln(A);A=Number.isFinite(F)?o(F)??String(F):A==null||A===""?null:A}const M=e==="percentComplete"||e==="duration"||Be.has(e);Promise.resolve().then(()=>{if(!this.#Ct)if(De.has(e)||M||e==="name")this.#Ri(n,e,A==null?"":String(A),M);else{const F=Wi.includes(String(t.colId))&&e===String(t.colId)?Zn(this.#t.taskById(n)||{},e,A):{[e]:A};this.#t.applyEdit({id:n,...F},{writeBack:!0}),this.draw()}})}#co(t,e,n){Promise.resolve().then(()=>{if(this.#Ct)return;const c=this.#t.schedule;let A=null;if(c&&c.ok){const M=Sn({id:t,column:e,text:n==null?"":String(n),dependencies:this.#t.dependencies,refs:zn(c.tasks)});M.ok?M.next&&this.#t.setDependencies(M.next,{gateRemoved:!0}):A=this.#u(M.key,{token:M.token})}this.draw(),A&&this.#ht(A,{repeat:!0})})}#ve(t,e){const n=this.#Gn;if(n&&n[t]){const c=t==="workload"?this.#$i(n[t]):n[t];e.setState(c),delete n[t]}}#uo(){const t=this.#t;return{doc:this.#e,ns:s,t:(e,n)=>this.#u(e,n),createGrid:()=>this.#dt,gridConfig:()=>this.#bn({},"band"),gridWidth:()=>this.#X(),locale:()=>this.#be(),indent:()=>this.#n.indent||16,editable:()=>!!this.#n.editable,syncScroll:e=>this.#Et(e),timeScrollLeft:()=>this.#r?this.#r.scrollLeft:0,toggleTask:(e,n)=>this.toggle(e,{event:n}),emitResize:(e,n)=>this.#me(e,n),redraw:()=>this.draw(),view:()=>this,rawTask:e=>this.#Yn(String(e)),writeSeries:(e,n,c)=>t.writeDataBandSeries(e,n,c),setEditing:e=>{this.#rt=!!e},gateEdit:(e,n)=>t.gateDataBandEdit(e,n),emitChange:e=>t.emitDataBandChange(e)}}#do(){return{doc:this.#e,ns:s,t:(t,e)=>this.#u(t,e),locale:()=>this.#be(),formatDate:t=>this.#pi(t),gridWidth:()=>this.#X(),syncScroll:t=>this.#Et(t),timeScrollLeft:()=>this.#r?this.#r.scrollLeft:0,redraw:()=>this.draw()}}getDataBandState(){return this.#o?this.#o.getState():null}setDataBandState(t){this.#o&&(this.#o.setState(t),this.draw())}toggleDataBand(t,e){const n=this.#o?this.#o.get(t):null;return n?(n.setCollapsed(e===void 0?!n.collapsed:!!e),n.collapsed):!1}getDataBandTable(t){const e=this.#o?this.#o.get(t):null;return e?e.toTable():null}getChartBandState(){return this.#d?this.#d.getState():null}setChartBandState(t){this.#d&&(this.#d.setState(t),this.draw())}toggleChartBand(t,e){const n=this.#d?this.#d.get(t):null;return n?(n.setCollapsed(e===void 0?!n.collapsed:!!e),n.collapsed):!1}getChartBandData(t){const e=this.#d?this.#d.get(t):null;return e?e.data():null}getTableStates(){return this.#dt?{task:this.#C?this.#C.getState():null,workload:this.#$?this.#$.getState():null,histogram:this.#G?this.#G.getState():null}:null}setTableStates(t){!this.#dt||!t||typeof t!="object"||(this.#Gn={...t},this.#C&&this.#ve("task",this.#C),this.#$&&this.#ve("workload",this.#$),this.#G&&this.#ve("histogram",this.#G),this.draw())}get grids(){const t={};if(this.#o)for(const e of this.#o.bands)e.grid&&(t[e.cfg.id]=e.grid);return{tasks:this.#C?this.#C.grid:null,workload:this.#$?this.#$.grid:null,histogram:this.#G?this.#G.grid:null,dataBands:t}}#ho(t){if(t==null)return null;const e=String(t);for(const n of this.#t.tasks)if(String(this.#t.readId(n))===e)return n;return null}#Vi(t,e){if(e==="keydown"&&!this.#go(t))return;const n=t&&t.target;if(!n||typeof n.closest!="function")return;const c=n.closest("[data-task]");if(!c)return;t&&typeof t.preventDefault=="function"&&t.preventDefault();const A=c.getAttribute("data-task");if(this.#wt){const M=this.#t.schedule,F=M&&M.ok?M.tasks.get(A):null,E=e!=="keydown"&&ft(n,s)||st(F);if(!this.#wt.gateContextMenu(A,E,t))return}this.#Yi(A,e==="keydown"?null:t,c)}#fo(t){const e=t&&t.target;if(!e||typeof e.closest!="function")return;const n=e.closest("[data-task]");if(!n||!this.#wt)return;const c=n.getAttribute("data-task"),A=this.#t.schedule,M=A&&A.ok?A.tasks.get(c):null,F=ft(e,s)||st(M);!this.#wt.gateContextMenu(c,F,t)&&t.preventDefault&&t.preventDefault()}#Bn(){const t=this.#n.contextMenu;return typeof t=="function"||t===!0}#go(t){return!!t&&(t.key==="ContextMenu"||t.key==="F10"&&t.shiftKey)}#Yi(t,e,n){const c=this.#ho(t);if(!c)return;e&&typeof e.preventDefault=="function"&&e.preventDefault();const A=Fi(this.#t,c,(E,rt)=>this.#u(E,rt)),M=typeof this.#n.contextMenu=="function"?this.#n.contextMenu(c,e,A):A;if(!M||Array.isArray(M)&&!M.length)return;const F={items:M,ctx:{task:c,event:e,view:this}};e&&Number.isFinite(e.clientX)&&Number.isFinite(e.clientY)?(F.x=e.clientX,F.y=e.clientY):n&&typeof n.getBoundingClientRect=="function"&&(F.anchor=n,F.placement="below",F.returnFocus=n),this.#Se.show(F)}destroy(){if(!this.#Ct){this.#Ct=!0,this.#kn.fail(new Error("lattice-grid: the gantt split view was destroyed before it became ready.")),this.#t.emitViewDestroy({view:this,element:this.#a}),this.#zt&&this.#zt.close(),this.#M=null,this.#Z&&this.#Z.dispose(),this.#Z=null,this.#at&&this.#at.dispose(),this.#at=null,this.#tt&&this.#tt.release(),this.#tt=null,this.#ft&&this.#ft.release(),this.#ft=null,this.#ti(),this.#Zt=null,this.#Xe&&this.#bt&&this.#bt.removeEventListener("pointerdown",this.#Xe),this.#qe&&this.#bt&&this.#bt.removeEventListener("keydown",this.#qe),this.#Xe=null,this.#qe=null,this.#bt=null,this.#jt&&this.#r&&this.#r.removeEventListener("scroll",this.#jt),this.#jt=null,this.#Nt&&this.#c&&this.#c.removeEventListener("scroll",this.#Nt),this.#Nt=null,this.#Ce&&this.#v&&this.#v.removeEventListener("scroll",this.#Ce),this.#Ce=null,this.#Me&&this.#v&&this.#v.removeEventListener("dblclick",this.#Me),this.#Me=null,this.#Ae&&this.#v&&this.#v.removeEventListener("click",this.#Ae),this.#Ae=null,this.#ae&&this.#ae(),this.#ae=null,this.#on=null,this.#an=null,this.#ln=null,this.#cn=null,this.#un=null,this.#dn=null,this.#hn=null,this.#Un=null,this.#le&&this.#le.dispose(),this.#le=null,this.#Te&&this.#v&&this.#v.removeEventListener("contextmenu",this.#Te),this.#Te=null,this.#Ee&&this.#v&&this.#v.removeEventListener("pointerover",this.#Ee),this.#Ee=null,this.#Oe&&this.#v&&this.#v.removeEventListener("pointerout",this.#Oe),this.#Oe=null,this.#De&&this.#v&&this.#v.removeEventListener("focusin",this.#De),this.#De=null,this.#Pe&&this.#v&&this.#v.removeEventListener("focusout",this.#Pe),this.#Pe=null,this.#je&&this.#At&&this.#At.removeEventListener("click",this.#je),this.#je=null,this.#W=null,this.#Ht=null,this.#B=null,this.#_&&(this.#Le&&this.#_.removeEventListener("scroll",this.#Le),this.#Ie&&this.#_.removeEventListener("pointerover",this.#Ie),this.#Fe&&this.#_.removeEventListener("pointermove",this.#Fe),this.#Re&&this.#_.removeEventListener("pointerleave",this.#Re),this.#Be&&this.#_.removeEventListener("focus",this.#Be,!0),this.#ze&&this.#_.removeEventListener("blur",this.#ze,!0),this.#He&&this.#_.removeEventListener("keydown",this.#He),this.#We&&this.#_.removeEventListener("click",this.#We),this.#Ue&&this.#_.removeEventListener("dblclick",this.#Ue),this.#Ge&&this.#_.removeEventListener("contextmenu",this.#Ge)),this.#Le=this.#Ie=this.#Fe=this.#Re=null,this.#Be=this.#ze=this.#He=null,this.#We=this.#Ue=this.#Ge=null,this.#vt=null,this.#ut=null,this.#U=null,this.#rn.clear(),this.#gt&&(this.#c&&(this.#c.removeEventListener("pointerover",this.#gt),this.#c.removeEventListener("pointerleave",this.#yt)),this.#r&&(this.#r.removeEventListener("pointerover",this.#gt),this.#r.removeEventListener("pointerleave",this.#yt))),this.#gt=this.#yt=null,this.#Xt&&this.#c&&this.#c.removeEventListener("dblclick",this.#Xt),this.#Xt=null,this.#r&&(this.#qt&&this.#r.removeEventListener("pointerdown",this.#qt),this.#Jt&&this.#r.removeEventListener("keydown",this.#Jt),this.#N&&this.#r.removeEventListener("click",this.#N),this.#E&&this.#r.removeEventListener("keydown",this.#E)),this.#x&&this.#c&&this.#c.removeEventListener("click",this.#x),this.#$e&&this.#c&&this.#c.removeEventListener("keydown",this.#$e),this.#$e=null,this.#ri(),this.#Gt&&this.#a&&this.#a.removeEventListener("keydown",this.#Gt),this.#Qt&&this.#a&&this.#a.removeEventListener("paste",this.#Qt),this.#Qt=null,this.#qt=this.#Jt=this.#Gt=null,this.#N=this.#E=this.#x=null,this.#r&&(this.#Ft&&this.#r.removeEventListener("pointermove",this.#Ft),this.#Rt&&(this.#r.removeEventListener("pointerleave",this.#Rt),this.#r.removeEventListener("blur",this.#Rt,!0)),this.#ne&&this.#r.removeEventListener("focus",this.#ne,!0),this.#ie&&this.#r.removeEventListener("keydown",this.#ie)),this.#Ft=this.#Rt=this.#ne=this.#ie=null,this.#H=this.#it=this.#xt=this.#de=null,this.#pt=null,this.#kt=this.#$t=null,this.#re&&(this.#c&&this.#c.removeEventListener("contextmenu",this.#re),this.#r&&this.#r.removeEventListener("contextmenu",this.#re)),this.#se&&(this.#c&&this.#c.removeEventListener("keydown",this.#se),this.#r&&this.#r.removeEventListener("keydown",this.#se)),this.#re=this.#se=null,this.#It&&(this.#c&&this.#c.removeEventListener("contextmenu",this.#It),this.#r&&this.#r.removeEventListener("contextmenu",this.#It)),this.#It=null,this.#Se&&(this.#Se.destroy(),this.#Se=null),this.#F&&(this.#F.destroy(),this.#F=null),this.#p&&(this.#p(),this.#p=null),this.#_t&&(this.#_t(),this.#_t=null),this.#I&&(this.#I.destroy(),this.#I=null),this.#wt&&(this.#wt.destroy(),this.#wt=null),this.#Lt&&(this.#Lt.destroy(),this.#Lt=null),this.#Ve&&(this.#Ve.destroy(),this.#Ve=null);for(const t of[this.#C,this.#$,this.#G])t&&t.destroy();for(const t of this.#Ye)t.dispose();this.#Ye=[],this.#Ze=null,this.#C=this.#$=this.#G=null,this.#Bt=null,this.#Y&&this.#Y(),this.#Y=null,this.#nt&&this.#nt(),this.#nt=null,this.#J&&this.#J(),this.#Q&&this.#Q(),this.#J=this.#Q=null,this.#l&&(this.#l(),this.#l=null),this.#o&&(this.#o.destroy(),this.#o=null),this.#d&&(this.#d.destroy(),this.#d=null),this.#i&&this.#i.__latticeGantt===this&&(this.#i.__latticeGantt=null),this.#q&&(this.#q(),this.#q=null),this.#a&&this.#a.parentNode&&this.#a.parentNode.removeChild(this.#a),this.#a=null,this.#f=this.#c=this.#b=this.#r=null,this.#R=this.#mt=this.#At=this.#v=null,this.#j=this.#Mt=this.#Yt=this.#_=null}}}function hr(it,t,e={}){return new lr(it,t,e)}}),ae("packages/modules/gantt/scurve.js",function(g,V){"use strict";Object.defineProperty(g,"SCURVE_NS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(g,"computeSCurve",{enumerable:!0,get:function(){return j}}),Object.defineProperty(g,"GanttSCurveView",{enumerable:!0,get:function(){return at}});const St=V("packages/modules/charts/svg.js"),U=St.svg,K=St.el,Y=St.setText,H=St.path,l=St.round,L=V("packages/modules/charts/scale.js"),v=L.linearScale,m=L.measureDomain,w=V("packages/modules/gantt/time.js"),k=w.toDayNumber,u=w.toISODate,f=w.fromDayNumber,S=V("packages/modules/gantt/schedule.js").taskIdReader,C=V("packages/modules/gantt/earned-value.js").computeEarnedValue,o=V("packages/modules/gantt/messages.js").createTranslator,p=1e-9,$="lat-gantt-scurve",h="data-lat-gantt-scurve-styles",y=Object.freeze({width:640,height:220,bucket:"day",statusDate:null,costField:"cost",actualCostField:"actualCost"});function i(ct){if(ct==null||ct==="")return null;const kt=typeof ct=="number"?ct:Number(ct);return Number.isFinite(kt)?kt:null}function r(ct,kt,Tt){return Tt-kt<=p?ct>=Tt?1:0:ct<=kt?0:ct>=Tt?1:(ct-kt)/(Tt-kt)}function b(ct,kt,Tt){if(ct.pct>=1){const Ft=Math.min(ct.rec.ef,Tt);return kt>=Ft?ct.bac:0}return ct.pct>0&&kt>=Tt?ct.bac*ct.pct:0}function T(ct,kt,Tt){const Ft=[];if(!(Tt>kt))return Ft;if(ct==="day"){for(let x=kt;x<Tt;x+=1)Ft.push({start:x,end:x+1});return Ft}if(ct==="week"){for(let x=kt;x<Tt;x+=7)Ft.push({start:x,end:Math.min(Tt,x+7)});return Ft}const D=f(kt);if(!D)return Ft;let P=Date.UTC(D.getUTCFullYear(),D.getUTCMonth(),1)/864e5;for(;P<Tt;){const x=f(P),R=Date.UTC(x.getUTCFullYear(),x.getUTCMonth()+1,1)/864e5;Ft.push({start:P,end:Math.min(Tt,R)}),P=R}return Ft}function j(ct,kt,Tt={}){if(!kt||!kt.ok||!kt.tasks||!kt.order)return[];const Ft=Tt.costField||"cost",D=Tt.actualCostField||"actualCost",P=Tt.bucket==="week"||Tt.bucket==="month"?Tt.bucket:"day",x=Tt.statusDate==null?kt.projectFinish:k(Tt.statusDate)??kt.projectFinish,R=Tt.rateCosts instanceof Map?Tt.rateCosts:null,N=S(Tt.fields),X=new Map;for(const st of Array.isArray(ct)?ct:[]){const ht=N(st);ht!=null&&X.set(String(ht),st)}const G=[];for(const st of kt.order){const ht=kt.tasks.get(st);if(!ht||ht.isSummary||ht.unscheduled)continue;const Pt=X.get(st),wt=Pt?i(Pt[Ft]):null,Jt=R?R.get(st):null,dt=wt??(Jt&&Jt.hasRate?Jt.cost:ht.duration),nt=Pt?i(Pt[D]):null,ot=ht.percentComplete==null?0:Math.max(0,Math.min(100,ht.percentComplete))/100,vt=ht.baselineStart!=null?ht.baselineStart:ht.es,pt=ht.baselineEnd!=null?ht.baselineEnd:ht.ef;G.push({rec:ht,bac:dt,pct:ot,ac:nt,bStart:vt,bEnd:pt})}const J=Math.floor(kt.projectStart),tt=Math.ceil(kt.projectFinish),ft=[];for(const st of T(P,J,tt)){const ht=st.end;let Pt=0,wt=0,Jt=0;for(const dt of G)Pt+=dt.bac*r(ht,dt.bStart,dt.bEnd),wt+=b(dt,ht,x),dt.ac!=null&&ht>=x&&(Jt+=dt.ac);ft.push({date:ht,pv:Pt,ev:wt,ac:Jt})}return ft}function I(){const ct=$;return`
|
|
909
|
-
.${
|
|
910
|
-
.${
|
|
911
|
-
.${
|
|
912
|
-
.${
|
|
913
|
-
.${
|
|
914
|
-
.${
|
|
915
|
-
.${
|
|
916
|
-
.${
|
|
917
|
-
.${
|
|
918
|
-
.${
|
|
919
|
-
.${
|
|
920
|
-
.${
|
|
921
|
-
.${
|
|
922
|
-
.${
|
|
923
|
-
.${
|
|
924
|
-
.${
|
|
925
|
-
.${
|
|
926
|
-
.${
|
|
927
|
-
.${
|
|
928
|
-
@scope ([data-theme="dark"]){:scope.${
|
|
929
|
-
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${
|
|
930
|
-
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${
|
|
931
|
-
`.trim()}function O(ct){const kt=ct.documentElement;if(!kt||kt.getAttribute(h))return;kt.setAttribute(h,"1");const Tt=ct.createElement("style");Tt.textContent=I(),(ct.head||ct.body||kt).appendChild(Tt)}function z(ct){const kt=Number.isFinite(ct)?ct:0,Tt=Math.abs(kt-Math.round(kt))<1e-9?Math.round(kt):l(kt);return String(Tt).replace(/\B(?=(\d{3})+(?!\d))/g,",")}function W(ct){return u(ct)??String(ct)}function B(ct){return ct==null||!Number.isFinite(ct)?"—":ct.toFixed(2)}class at{#t;#i;#e;#n;#s=null;#o=null;#l=!1;#d;constructor(kt,Tt,Ft={}){this.#t=kt,this.#i=Tt,this.#e=Tt.ownerDocument,this.#n={...y,...Ft},this.#d=o(kt,()=>this.#n.messages),O(this.#e),this.#s=K(this.#e,"div",$),this.#i.appendChild(this.#s),this.#o=kt.on("schedule",()=>this.draw()),this.draw()}get element(){return this.#s}get options(){return{...this.#n}}#g(){if(this.#n.statusDate!=null){const Tt=k(this.#n.statusDate);if(Number.isFinite(Tt))return Tt}const kt=this.#t.schedule;return kt&&kt.ok?kt.projectFinish:0}draw(){if(this.#l||!this.#s)return;for(;this.#s.firstChild;)this.#s.removeChild(this.#s.firstChild);const kt=this.#t.schedule;if(!kt||!kt.ok)return;const Tt=Math.max(80,Number(this.#n.width)||640),Ft=Math.max(80,Number(this.#n.height)||220),D={top:16,right:16,bottom:26,left:48},P=this.#g(),x=j(this.#t.tasks,kt,{statusDate:P,bucket:this.#n.bucket,costField:this.#n.costField,actualCostField:this.#n.actualCostField}),R=U(this.#e,"svg",{class:`${$}__plot`,width:Tt,height:Ft,viewBox:`0 0 ${Tt} ${Ft}`,role:"img","aria-label":"S-curve: cumulative planned value, earned value and actual cost"});if(this.#s.appendChild(R),!x.length)return;const N={min:Math.floor(kt.projectStart),max:Math.ceil(kt.projectFinish)},X=v(N,[D.left,Tt-D.right]),G=m(x.flatMap(wt=>[wt.pv,wt.ev,wt.ac]),{zero:!0}),J=v(G,[Ft-D.bottom,D.top]),tt=Tt-D.left-D.right;for(const wt of J.ticks(5)){const Jt=l(J.of(wt));R.appendChild(U(this.#e,"line",{class:`${$}__grid`,x1:D.left,y1:Jt,x2:Tt-D.right,y2:Jt}));const dt=U(this.#e,"text",{class:`${$}__ticklabel`,x:D.left-6,y:Jt+3,"text-anchor":"end"});Y(dt,z(wt)),R.appendChild(dt)}const ft=X.ticks(Math.max(2,Math.min(8,Math.floor(tt/60))));for(const wt of ft){const Jt=l(X.of(wt)),dt=U(this.#e,"text",{class:`${$}__ticklabel`,x:Jt,y:Ft-D.bottom+14,"text-anchor":"middle"});Y(dt,W(wt)),R.appendChild(dt)}R.appendChild(U(this.#e,"line",{class:`${$}__axis`,x1:D.left,y1:Ft-D.bottom,x2:Tt-D.right,y2:Ft-D.bottom})),R.appendChild(U(this.#e,"line",{class:`${$}__axis`,x1:D.left,y1:D.top,x2:D.left,y2:Ft-D.bottom}));for(const wt of["pv","ev","ac"]){const Jt=[];for(const nt of x)Jt.push(Jt.length?"L":"M",l(X.of(nt.date)),l(J.of(nt[wt])));const dt=U(this.#e,"path",{class:`${$}__series ${$}__series--${wt}`,d:H(Jt),"data-series":wt});R.appendChild(dt)}if(P>=N.min&&P<=N.max){const wt=l(X.of(P));R.appendChild(U(this.#e,"line",{class:`${$}__status`,x1:wt,y1:D.top,x2:wt,y2:Ft-D.bottom,"data-status":String(P)}))}const st=C(this.#t.tasks,kt,{statusDate:P,costField:this.#n.costField,actualCostField:this.#n.actualCostField}),ht=K(this.#e,"div",`${$}__legend`);for(const[wt,Jt]of[["pv","PV"],["ev","EV"],["ac","AC"]]){const dt=K(this.#e,"span",`${$}__legend-item`),nt=K(this.#e,"span",`${$}__swatch ${$}__swatch--${wt}`);nt.setAttribute("aria-hidden","true"),dt.appendChild(nt),dt.appendChild(this.#e.createTextNode(Jt)),ht.appendChild(dt)}const Pt=K(this.#e,"span",`${$}__index`);Y(Pt,`${this.#d("gantt.scurve.spi",{index:B(st.project.spi)})} · ${this.#d("gantt.scurve.cpi",{index:B(st.project.cpi)})}`),ht.appendChild(Pt),this.#s.appendChild(ht),this.#s.appendChild(this.#p(x))}#p(kt){const Tt=K(this.#e,"table",`${$}__table`),Ft=K(this.#e,"thead",""),D=K(this.#e,"tr","");for(const x of["Date","PV","EV","AC"]){const R=K(this.#e,"th","");Y(R,x),D.appendChild(R)}Ft.appendChild(D),Tt.appendChild(Ft);const P=K(this.#e,"tbody","");for(const x of kt){const R=K(this.#e,"tr","");for(const N of[W(x.date),z(x.pv),z(x.ev),z(x.ac)]){const X=K(this.#e,"td","");Y(X,N),R.appendChild(X)}P.appendChild(R)}return Tt.appendChild(P),Tt}refresh(){this.draw()}destroy(){this.#l||(this.#l=!0,this.#o&&this.#o(),this.#o=null,this.#s&&this.#s.parentNode&&this.#s.parentNode.removeChild(this.#s),this.#s=null)}}}),ae("packages/modules/gantt/selection.js",function(g,V){"use strict";Object.defineProperty(g,"GanttSelection",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"rangeBetween",{enumerable:!0,get:function(){return U}}),Object.defineProperty(g,"toggleId",{enumerable:!0,get:function(){return K}}),Object.defineProperty(g,"stepInOrder",{enumerable:!0,get:function(){return Y}});class St{#t=[];#i=new Set;#e=null;#n=null;ids(){return this.#t.slice()}get size(){return this.#t.length}has(l){return this.#i.has(String(l))}get anchor(){return this.#e}setAnchor(l){this.#e=l==null?null:String(l)}replace(l){const L=[],v=new Set;for(const k of l){const u=String(k);v.has(u)||(v.add(u),L.push(u))}const m=L.filter(k=>!this.#i.has(k)),w=this.#t.filter(k=>!v.has(k));return this.#t=L,this.#i=v,this.#e!=null&&!v.has(this.#e)&&(this.#e=null),{added:m,removed:w}}noteVisible(l){this.#n=l==null?null:new Set([...l].map(String))}hidden(){if(!this.#n)return[];const l=this.#n;return this.#t.filter(L=>!l.has(L))}}function U(H,l,L){const v=String(l);if(H==null)return[v];const m=L.indexOf(String(H)),w=L.indexOf(v);if(m<0||w<0)return[v];const[k,u]=m<=w?[m,w]:[w,m];return L.slice(k,u+1)}function K(H,l){const L=String(l);return H.some(v=>String(v)===L)?H.filter(v=>String(v)!==L):[...H.map(String),L]}function Y(H,l,L){if(!L.length)return null;if(H==null)return l>0?L[0]:L[L.length-1];const v=L.indexOf(String(H));if(v<0)return l>0?L[0]:L[L.length-1];const m=Math.min(L.length-1,Math.max(0,v+l));return L[m]}}),ae("packages/modules/gantt/conflicts.js",function(g,V){"use strict";Object.defineProperty(g,"CONFLICT_CONSTRAINT_CODES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(g,"conflictKey",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"deriveConflicts",{enumerable:!0,get:function(){return k}}),Object.defineProperty(g,"diffConflicts",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"publicConflict",{enumerable:!0,get:function(){return f}});const St=V("packages/modules/gantt/time.js"),U=St.toDayNumber,K=St.toISODate,Y=Object.freeze(["MSO","MFO","SNET","SNLT","FNET","FNLT"]);function H(d){const S=(d.tasks||[]).map(String).slice().sort().join(","),_=(d.links||[]).map(C=>`${C.from}>${C.to}`).slice().sort().join("|");return`${d.kind}#${S}#${_}`}function l(d){return d.key=H(d),d}function L(d,S,_){const C=d.map(String),a=[];for(let $=0;$<C.length-1;$+=1)a.push({from:C[$],to:C[$+1]});const o=[...new Set(C)],p=C.map($=>_($)).join(" → ");return l({kind:"cycle",tasks:o,links:a,message:S("gantt.issues.cycle",{tasks:p})})}function v(d,S,_){const C=String(d.id);return l({kind:"constraint",tasks:[C],links:[],message:S("gantt.issues.constraint",{task:_(C),constraint:d.type,date:K(d.date)})})}function m(d,S,_){const C=String(d.id),a=d.from!==void 0?[{from:String(d.from),to:String(d.to)}]:[];return l({kind:"lock",tasks:[C],links:a,message:S("gantt.issues.lock",{task:_(C)})})}function w(d,S,_,C){return l({kind:"deadline",tasks:[d],links:[],message:_("gantt.issues.deadline",{task:C(d),date:K(S)})})}function k(d,S){const _=[];if(!d)return _;const{t:C,nameOf:a}=S;if(d.ok===!1){const p=d.error;return p&&p.code==="cycle"&&Array.isArray(p.cycle)&&p.cycle.length&&_.push(L(p.cycle,C,a)),_}const o=Array.isArray(d.conflicts)?d.conflicts:[];for(const p of o)p.type==="LOCKED"?_.push(m(p,C,a)):Y.includes(p.type)&&_.push(v(p,C,a));return typeof S.deadlineOf=="function"&&d.tasks&&typeof d.tasks.forEach=="function"&&d.tasks.forEach((p,$)=>{if(!p||p.isSummary)return;const h=S.rawById(String($)),y=h?U(S.deadlineOf(h)):null;y!=null&&p.ef>y+1e-9&&_.push(w(String($),y,C,a))}),_}function u(d,S){const _=new Map((d||[]).map(p=>[p.key||H(p),p])),C=new Map((S||[]).map(p=>[p.key||H(p),p])),a=[],o=[];for(const[p,$]of C)_.has(p)||a.push($);for(const[p,$]of _)C.has(p)||o.push($);return{added:a,resolved:o}}function f(d){return{kind:d.kind,tasks:d.tasks.slice(),links:d.links.map(S=>({...S})),message:d.message}}}),ae("packages/modules/gantt/read-only.js",function(g,V){"use strict";Object.defineProperty(g,"isTaskReadOnly",{enumerable:!0,get:function(){return St}});function St(U,K){if(!U)return!1;if(U.readOnly===!0)return!0;if(typeof K=="function")try{return!!K(U)}catch{return!1}return!1}}),ae("packages/core/src/registry/free-tier-notice.js",function(g,V){"use strict";Object.defineProperty(g,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return St}}),Object.defineProperty(g,"WATERMARK_TEXT",{enumerable:!0,get:function(){return U}});const St="Free for non-commercial use: latticegrid.dev/free",U="Unlicensed: Lattice Grid trial"}),ae("packages/core/src/registry/licence.js",function(g,V){"use strict";Object.defineProperty(g,"PRODUCT",{enumerable:!0,get:function(){return H}}),Object.defineProperty(g,"LICENCE_VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(g,"PUBLIC_KEY",{enumerable:!0,get:function(){return m}}),Object.defineProperty(g,"fromBase64Url",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"toBase64Url",{enumerable:!0,get:function(){return f}}),Object.defineProperty(g,"asciiBytes",{enumerable:!0,get:function(){return d}}),Object.defineProperty(g,"parseLicence",{enumerable:!0,get:function(){return _}}),Object.defineProperty(g,"hasEd25519",{enumerable:!0,get:function(){return i}}),Object.defineProperty(g,"verifyLicence",{enumerable:!0,get:function(){return r}}),Object.defineProperty(g,"isLocalHost",{enumerable:!0,get:function(){return b}}),Object.defineProperty(g,"currentHost",{enumerable:!0,get:function(){return T}}),Object.defineProperty(g,"matchesDomain",{enumerable:!0,get:function(){return j}}),Object.defineProperty(g,"LicenceHolder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(g,"setLicence",{enumerable:!0,get:function(){return at}}),Object.defineProperty(g,"licenceInfo",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(g,"watermark",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(g,"licenceState",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(g,"sharedLicence",{enumerable:!0,get:function(){return Ft}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/core/src/registry/free-tier-notice.js"),Y=K.FREE_TIER_NOTICE;Object.defineProperty(g,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return K.FREE_TIER_NOTICE}});const H="lattice-grid",l=1,L="LG1",v=64,m="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",k=(()=>{const D=new Int16Array(128).fill(-1);for(let P=0;P<w.length;P++)D[w.charCodeAt(P)]=P;return D[43]=62,D[47]=63,D})();function u(D){if(typeof D!="string")return null;let P="";for(let J=0;J<D.length;J++){const tt=D.charCodeAt(J);if(tt!==61){if(tt>127||k[tt]<0)return null;P+=D[J]}}const x=P.length;if(x%4===1)return null;const R=new Uint8Array(Math.floor(x*3/4));let N=0,X=0,G=0;for(let J=0;J<x;J++)N=N<<6|k[P.charCodeAt(J)],X+=6,X>=8&&(X-=8,R[G++]=N>>X&255);return G===R.length?R:R.subarray(0,G)}function f(D){let P="",x=0;for(;x+2<D.length;x+=3){const N=D[x]<<16|D[x+1]<<8|D[x+2];P+=w[N>>18&63]+w[N>>12&63]+w[N>>6&63]+w[N&63]}const R=D.length-x;if(R===1){const N=D[x]<<16;P+=w[N>>18&63]+w[N>>12&63]}else if(R===2){const N=D[x]<<16|D[x+1]<<8;P+=w[N>>18&63]+w[N>>12&63]+w[N>>6&63]}return P}function d(D){const P=new Uint8Array(D.length);for(let x=0;x<D.length;x++)P[x]=D.charCodeAt(x)&127;return P}function S(D){if(typeof TextDecoder=="function")return new TextDecoder().decode(D);let P="";for(let x=0;x<D.length;x++)P+=String.fromCharCode(D[x]);return P}function _(D){const P={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof D=="string"?D:""};if(typeof D!="string"||D.length===0)return{...P,reason:"missing"};const x=D.trim(),R=x.split(".");if(R.length!==3)return P;const[N,X,G]=R;if(N!==L)return{...P,reason:"prefix"};const J=u(X),tt=u(G);if(!J||!tt)return P;let ft;try{ft=JSON.parse(S(J))}catch{return P}return ft===null||typeof ft!="object"?P:{ok:!0,reason:null,product:typeof ft.p=="string"?ft.p:null,issuedTo:typeof ft.t=="string"?ft.t:null,expires:typeof ft.e=="string"?ft.e:null,terms:typeof ft.terms=="string"?ft.terms:null,features:Array.isArray(ft.f)?ft.f.slice():[],deployments:Array.isArray(ft.d)?ft.d.slice():[],version:typeof ft.v=="number"?ft.v:0,message:d(X),signature:tt,raw:x}}function C(D,P){if(!D)return!1;const x=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(D)?`${D}T23:59:59.999Z`:D);return Number.isNaN(x)?!0:P>x}function a(D){return D==="non-commercial"?"non-commercial":"commercial"}let o=null,p=null,$=null;function h(){const D=globalThis.crypto;return D&&D.subtle?D.subtle:null}async function y(D){if(o&&p===D)return o;const P=h();if(!P)return null;const x=u(D);if(!x)return null;try{const R=await P.importKey("raw",x,{name:"Ed25519"},!1,["verify"]);return o=R,p=D,R}catch{return null}}async function i(){return $!==null||($=await y(m)!==null),$}async function r(D,P={}){const x=P.warn!==!1,R=P.product||H,N=P.publicKey||m,X=P.now??Date.now(),G=P.host??T(),J=b(G)?"":` ${Y}`,tt=_(D);if(!tt.ok){const wt=tt.reason==="missing"?"missing":"malformed";return x&&U(`licence.${wt}`,wt==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${J}`:`licence key could not be read. The grid will render with a watermark.${J}`),{valid:!1,reason:wt,terms:"commercial"}}const ft={product:tt.product||void 0,issuedTo:tt.issuedTo||void 0,expires:tt.expires||void 0,terms:a(tt.terms)};if(tt.product!==R)return x&&U("licence.product",`licence key is for '${tt.product}', not '${R}'. The grid will render with a watermark.`),{valid:!1,...ft,reason:"product"};if(C(tt.expires,X))return x&&U("licence.expired",`licence expired on ${tt.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...ft,reason:"expired"};const st=tt.deployments||[];if(st.length&&G&&!b(G)&&!j(G,st))return x&&U("licence.domain",`licence key is not valid for ${G}; it covers ${st.join(", ")}. The grid will render with a watermark.`),{valid:!1,...ft,reason:"domain"};const ht=await y(N);if(!ht){const wt=!!tt.signature&&tt.signature.length===v;return x&&U("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),wt?{valid:!0,...ft,reason:"unverified"}:{valid:!1,...ft,reason:"signature"}}let Pt=!1;try{Pt=await h().verify({name:"Ed25519"},ht,tt.signature,tt.message)}catch{Pt=!1}return Pt?{valid:!0,...ft}:(x&&U("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...ft,reason:"signature"})}function b(D){const P=String(D??T()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!P||P==="localhost"||P.endsWith(".localhost")||P==="::1"||P==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(P)}function T(){const D=globalThis.location;return D&&typeof D.hostname=="string"?D.hostname:null}function j(D,P){const x=I(D);return!x||!Array.isArray(P)?!1:P.some(R=>{const N=I(R);if(!N)return!1;if(N==="*")return!0;if(N.startsWith("*.")){const X=N.slice(2);return x===X||x.endsWith(`.${X}`)}return x===N})}function I(D){return String(D??"").trim().toLowerCase().replace(/\.$/,"")}class O{#t="";#i={valid:!1,reason:"missing",terms:"commercial"};#e=null;#n=null;#s;#o=new Set;constructor(P={}){this.#s=P}set(P){this.#t=typeof P=="string"?P.trim():"";const x=_(this.#t);return this.#i=x.ok?{valid:!C(x.expires,Date.now())&&x.product===(this.#s.product||H),product:x.product||void 0,issuedTo:x.issuedTo||void 0,expires:x.expires||void 0,terms:a(x.terms),reason:"pending"}:{valid:!1,reason:x.reason||"malformed",terms:"commercial"},this.#e=null,this.#t&&this.verify(),this.#i}verify(){if(this.#e)return this.#e;const P=this.#t;return this.#e=r(P,this.#s).then(x=>{if(this.#t===P){this.#i=x;for(const R of this.#o)R(x)}return x}),this.#e}onSettled(P){return this.#o.add(P),()=>this.#o.delete(P)}info(){return{...this.#i}}watermark(){return this.#i.valid?!1:!b(this.#n)}setHost(P){this.#n=P}state(){return this.#i.valid?"licensed":b(this.#n)?"localhost":"trial"}reset(){this.#t="",this.#i={valid:!1,reason:"missing",terms:"commercial"},this.#e=null,this.#o.clear()}}const z=Symbol.for("lattice-grid/licence/holder");function W(){const D=globalThis,P=D&&D[z];if(P&&typeof P.set=="function"&&typeof P.watermark=="function")return P;const x=new O;if(D)try{D[z]=x}catch{}return x}const B=W();function at(D){return B.set(D)}function ct(){return B.info()}function kt(){return B.watermark()}function Tt(){return B.state()}function Ft(){return B}}),ae("packages/dom/src/watermark.js",function(g,V){"use strict";Object.defineProperty(g,"WATERMARK_CLASS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(g,"WATERMARK_LAYER_CLASS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(g,"Watermark",{enumerable:!0,get:function(){return h}}),Object.defineProperty(g,"viewLicenceHost",{enumerable:!0,get:function(){return y}}),Object.defineProperty(g,"mountViewWatermark",{enumerable:!0,get:function(){return r}}),Object.defineProperty(g,"default",{enumerable:!0,get:function(){return b}});const U=V("packages/core/src/internal/predicates.js").isFunction,K=V("packages/core/src/registry/free-tier-notice.js"),Y=K.FREE_TIER_NOTICE,H=K.WATERMARK_TEXT,l=V("packages/core/src/registry/licence.js"),L=l.watermark,v=l.setLicence,m=Object.freeze({t:T=>T==="licence.watermark.free"?Y:H});function w(T,j,I={}){const O=T.createElement(j);if(I.class)for(const z of I.class.split(/\s+/))z&&O.classList.add(z);if(I.text!==void 0&&(O.textContent=I.text),I.attrs)for(const[z,W]of Object.entries(I.attrs))O.setAttribute(z,W);if(I.children)for(const z of I.children)O.appendChild(z);return O}function k(T,j,I){return T.addEventListener(j,I),()=>T.removeEventListener(j,I)}const u="lat-watermark",f="https://www.latticegrid.dev",d=["br","bl","tl","tr"],S=4e3,_={header:"lat-header",stickyTop:"lat-sticky-top",stickyBottom:"lat-sticky-bottom",statusBar:"lat-status-bar"},C=Symbol.for("lattice-grid/licence/holder"),a="data-lat-watermark-owner",o="lat-watermark-layer",p="lat-watermark-style",$=`
|
|
917
|
+
`.trim()}function yi(it){const t=it.documentElement;if(!t||t.getAttribute(Z))return;t.setAttribute(Z,"1");const e=it.createElement("style");e.textContent=v(Oi()),(it.head||it.body||t).appendChild(e)}function Di(){return[{key:"name",title:"Task name",width:0,kind:"name"},{key:"start",title:"Start",width:96,kind:"start"},{key:"end",title:"Finish",width:96,kind:"end"},{key:"duration",title:"Duration",width:84,kind:"duration"},{key:"assignee",title:"Assignee",width:96,kind:"assignee"},{key:"progress",title:"%",width:56,kind:"progress"}]}function dr(it){if(!Array.isArray(it)||!it.length)return Di();const t=new Map(Di().map(n=>[n.key,n]));t.set("effort",{key:"effort",title:null,width:76,kind:"effort"}),t.set("units",{key:"units",title:null,width:76,kind:"units"}),t.set("unscheduled",{key:"unscheduled",title:null,width:96,kind:"unscheduled"}),t.set("slack",{key:"slack",title:null,width:76,kind:"slack"}),t.set("deadline",{key:"deadline",title:null,width:96,kind:"deadline"}),t.set("wbs",{key:"wbs",title:null,width:64,kind:"wbs"});const e=it.map(n=>typeof n=="string"?t.get(n):n).filter(Boolean);return e.length?e:Di()}class lr{#t;#i;#e;#n;#s;#o=null;#l=null;#h=null;#f="custom";#p=null;#g=null;#a=null;#d=null;#c=null;#y=null;#r=null;#m=new Set;#w=new Set;#E=new Set;#P=[];#k=[];#M=!1;#D=null;#j=null;#x=null;#U=new Set;#q=new Set;#O=new Set;#X=null;#C=null;#F=[];#V=null;#J=null;#rt=null;#Q=null;#dt=null;#N=null;#ht=null;#Kt;#tt=null;#st=null;#Y=null;#ft=!1;#et=null;#Lt=null;#xt=null;#Ct=null;#kt=!1;#wt=null;#At=null;#ot=null;#vt=null;#_t=null;#It=null;#Mt=null;#Ft=null;#Vt=null;#Jt=null;#Qt=null;#te=null;#L=null;#St=null;#Rt=null;#Bt=null;#ee=null;#Se=0;#rn=null;#gt=null;#z=null;#ne=null;#pt=null;#H=null;#ie=null;#mt=null;#he=null;#re=null;#zt=null;#$e=null;#xe=null;#Ce=null;#se=null;#oe=null;#u=null;#Ht=null;#wn="";#at=null;#Yt=null;#Ae=null;#ae=1;#nt=!1;#Wt=null;#Me=null;#Zt=null;#Tt=!1;#vn=Fe();get ready(){return this.#vn.promise}#b=null;#R=null;#bt=null;#Et=null;#v=null;#Te=null;#Ee=null;#Oe=null;#De=null;#Pe=null;#je=null;#Ne=null;#Le=null;#Ie=null;#Wn=null;#W=null;#Ut=null;#_n=new Map;#fe=new Set;#Fe=new Set;#B=null;#Sn=!1;#sn=null;#S=null;#I=null;#Ot=null;#Xt=null;#_=null;#Re=null;#lt=null;#G=null;#Be=null;#ze=null;#He=null;#We=null;#Ue=null;#Ge=null;#Ke=null;#Ve=null;#Ye=null;#$t=null;#on=new Map;#T=null;#an=new Map;#$n=null;#qt=null;#Ze=null;#ct=null;#A=null;#Xe=null;#qe=[];#Je=null;#Un={};#ge=new Set;#xn=new Map;#$=null;#pe=new Map;#Gn=null;#Kn=null;#le=null;#ln=null;#cn=null;#un=null;#dn=null;#hn=null;#fn=null;#gn=null;#ce=null;#K=null;#Dt=!1;#Vn=null;#yt=null;#Qe=null;#tn=null;constructor(t,e,n={}){this.#t=t,this.#i=e,this.#e=e.ownerDocument,this.#n={...ci,...n},this.#s=dr(n.columns),this.#f=typeof this.#n.zoom=="string"&&Kn[this.#n.zoom]?this.#n.zoom:"custom",this.#F=Pe(this.#n.markers,0),yi(this.#e),this.#u=B(t,()=>this.#n.messages),this.#a=k(this.#e,"div",s),this.#J=W(this.#a,this.#i),this.#a.setAttribute("role","table"),this.#ft=Number.isFinite(Qn(this.#i)),this.#ki(),this.#a.style.setProperty("--lattice-gantt-row-height",`${Number(this.#n.rowHeight)||34}px`),this.#n.resourceOnly&&this.#a.classList.add(`${s}--resource-only`);const c=k(this.#e,"div",`${s}__head`);this.#d=k(this.#e,"div",`${s}__grid-head`),this.#d.style.width=`${this.#Z()}px`,this.#y=k(this.#e,"div",`${s}__time-head`),c.appendChild(this.#d),c.appendChild(k(this.#e,"div",`${s}__divider`)),c.appendChild(this.#y);const A=k(this.#e,"div",`${s}__body`);this.#c=k(this.#e,"div",`${s}__grid-body`),this.#c.style.width=`${this.#Z()}px`,this.#r=k(this.#e,"div",`${s}__time-body`),A.appendChild(this.#c),this.#yt=k(this.#e,"div",`${s}__divider ${s}__divider--resize`),this.#yt.setAttribute("tabindex","0"),this.#yt.setAttribute("role","separator"),this.#yt.setAttribute("aria-orientation","vertical"),this.#Qe=E=>this.#ei(E,"grid"),this.#tn=E=>this.#ii(E,"grid"),this.#yt.addEventListener("pointerdown",this.#Qe),this.#yt.addEventListener("keydown",this.#tn),A.appendChild(this.#yt),A.appendChild(this.#r),this.#a.appendChild(c),this.#a.appendChild(A),this.#g=this.#Qi(c),this.#Js(c),this.#b=this.#Yr(),this.#S=this.#Zr(),this.#b&&this.#S&&(this.#S.unit=this.#b.unit,this.#S.thresholds=this.#b.thresholds),this.#wi(),this.#b&&this.#es(),this.#S&&this.#ms();const T=typeof n.createGrid=="function"?$n(this.#n.dataBands):[];T.length&&(this.#o=new tr(this.#ho(),T),this.#o.build(this.#a));const F=In(this.#n.chartBands);if(F.length&&(this.#h=new ti(this.#fo(),F),this.#h.build(this.#a)),this.#n.issuesPanel&&this.#Us(),this.#i.appendChild(this.#a),this.#i.__latticeGantt||(this.#i.__latticeGantt=this),this.#ct=typeof n.createGrid=="function"?n.createGrid:null,this.#ct&&!this.#n.resourceOnly&&this.#Qs(),this.#xt=()=>{this.#Pt(this.#r),this.#mn(this.#r),this.#hi()},this.#r.addEventListener("scroll",this.#xt),this.#Ct=()=>{this.#mn(this.#c),this.#ns(this.#c),this.#hi()},this.#c.addEventListener("scroll",this.#Ct),this.#tt=Ii(E=>t.emitVisibleRangeChange(E),()=>{const E=this.#r,rt=le(this.#T,E?E.scrollLeft:0,E?E.clientWidth:0);return rt?{view:this,start:o(rt.start),end:o(rt.end),zoom:this.#Qn().level}:null}),this.#Y=Jn({targets:[this.#r],read:()=>({width:An(this.#r)}),apply:()=>{this.#z&&this.draw(),this.#tt.note()}}),this.#Xr(),this.#st=fe(E=>t.emitScroll(E),()=>{const E=this.#r;return E?{view:this,top:E.scrollTop,left:E.scrollLeft}:null}),this.#n.hoverChain&&(this.#wt=E=>this.#qs(E),this.#At=()=>this.#yn(),this.#c.addEventListener("pointerover",this.#wt),this.#c.addEventListener("pointerleave",this.#At),this.#r.addEventListener("pointerover",this.#wt),this.#r.addEventListener("pointerleave",this.#At)),this.#n.editable&&(this.#It=E=>this.#Es(E),this.#c.addEventListener("dblclick",this.#It)),this.#Ht=k(this.#e,"div",`${s}__live`),this.#Ht.setAttribute("role","status"),this.#Ht.setAttribute("aria-live","polite"),this.#a.appendChild(this.#Ht),this.#n.tooltip&&(this.#H=k(this.#e,"div",`${s}__tooltip`),this.#H.setAttribute("hidden",""),this.#ie=k(this.#e,"div",`${s}__tip-arrow`),this.#H.appendChild(this.#ie),this.#a.appendChild(this.#H),A.addEventListener("scroll",()=>this.#de()),this.#r.addEventListener("scroll",()=>this.#de())),this.#L=new R({doc:this.#e,controller:t,options:()=>this.#n,plot:()=>this.#r?this.#r.querySelector(`.${s}__plot`):null,rowOf:E=>E&&E.closest?E.closest(`.${s}__barrow`):null,barOf:E=>E.querySelector(`.${s}__bar`)||E.querySelector(`.${s}__milestone`),pxPerDay:()=>this.#ae,announce:E=>this.#ut(E,{repeat:!0}),t:(E,rt)=>this.#u(E,rt),iso:E=>o(E),redraw:()=>this.draw(),previewDrag:E=>this.#Ms(E),focusTask:E=>{this.#at=E},editing:()=>this.#nt,connectorOf:E=>E&&E.closest?E.closest(`.${s}__connector`):null,linkOf:E=>E&&E.closest?E.closest(`.${s}__linkgroup`):null,milestoneOf:E=>E&&E.closest?E.closest(`.${s}__milestone`):null,showLinkPreview:(E,rt,_t,ut)=>this.#Er(E,rt,_t,ut),hideLinkPreview:()=>this.#Or(),openLinkEditor:(E,rt,_t)=>this.#Tr(E,rt,_t),view:()=>this,progressOf:E=>E&&E.closest?E.closest(`.${s}__progresshandle`):null,resizeStartOf:E=>E&&E.closest?E.closest(`.${s}__resizehandle`):null,nsOf:()=>s,scrollers:()=>this.#r?[this.#r]:[]}),this.#St=new G({controller:t,ns:s,view:()=>this,rowOf:E=>E&&E.closest?E.closest(`.${s}__barrow`):null,dayAt:E=>this.#ir(E),date:E=>o(E),dragging:()=>!!(this.#L&&this.#L.dragging),consumeDragRelease:()=>!!(this.#L&&this.#L.consumeDragRelease()),keyboard:!!this.#n.keyboard}),this.#St.attach(this.#r),this.#Rt=new lt({controller:t,view:()=>this,linkOf:E=>E&&E.closest?E.closest(`.${s}__linkgroup`):null}),this.#Rt.attach(this.#r),this.#n.editable&&(this.#Mt=E=>this.#L.onPointerDown(E),this.#r.addEventListener("pointerdown",this.#Mt),this.#L.attachTouch(this.#r),this.#Ft=E=>this.#L.hoverCursor(E),this.#r.addEventListener("pointermove",this.#Ft),this.#Vt=()=>this.#L.clearHoverCursor(),this.#r.addEventListener("pointerleave",this.#Vt)),this.#p=gi({pane:this.#r,enabled:()=>this.#n.pinchZoom!==!1,model:()=>this.#T,zoom:()=>this.#n.zoom,setZoom:(E,rt)=>this.setZoom(E,rt),scrollTo:E=>{this.#r.scrollLeft=E,this.#Pt(this.#r)}}),this.#n.keyboard){this.#Jt=_t=>this.#L.onKey(_t),this.#r.addEventListener("keydown",this.#Jt);const E=Ln({controller:t,focused:()=>this.#at,editing:()=>this.#nt,announce:_t=>this.#ut(_t,{repeat:!0}),t:(_t,ut)=>this.#u(_t,ut)}),rt=Xi({controller:t,focused:()=>this.#at,editing:()=>this.#nt,focusTask:_t=>{this.#at=_t},announce:_t=>this.#ut(_t,{repeat:!0}),t:(_t,ut)=>this.#u(_t,ut)});this.#Qt=_t=>{this.#L.onHistoryKey(_t),E.onKey(_t),rt.onKey(_t)},this.#a.addEventListener("keydown",this.#Qt),this.#te=E.onPaste,this.#a.addEventListener("paste",this.#te)}this.#n.tooltip&&(this.#re=E=>this.#Hr(E),this.#zt=()=>this.#de(),this.#r.addEventListener("pointermove",this.#re),this.#r.addEventListener("pointerleave",this.#zt),this.#$e=E=>this.#Ur(E),this.#r.addEventListener("focus",this.#$e,!0),this.#r.addEventListener("blur",this.#zt,!0),this.#xe=E=>{E.key==="Escape"&&this.#de()},this.#r.addEventListener("keydown",this.#xe)),this.#D=E=>this.#qn(E),this.#r.addEventListener("click",this.#D),!this.#A&&this.#c&&(this.#x=E=>this.#qn(E),this.#c.addEventListener("click",this.#x)),this.#n.keyboard&&(this.#j=E=>this.#rr(E),this.#r.addEventListener("keydown",this.#j)),this.#n.keyboard&&!this.#A&&this.#c&&(this.#Ae=E=>this.#Cr(E),this.#c.addEventListener("keydown",this.#Ae)),this.#Hn()?(this.#Ce=new Ci({document:this.#e,host:this.#a}),this.#se=E=>this.#Zi(E,"contextmenu"),this.#oe=E=>this.#Zi(E,"keydown"),this.#c.addEventListener("contextmenu",this.#se),this.#r.addEventListener("contextmenu",this.#se),this.#c.addEventListener("keydown",this.#oe),this.#r.addEventListener("keydown",this.#oe)):(this.#Bt=E=>this.#po(E),this.#c.addEventListener("contextmenu",this.#Bt),this.#r.addEventListener("contextmenu",this.#Bt)),this.#V=t.on("schedule",()=>this.draw()),this.#o&&(this.#o.noteSpans(t.schedule),this.#l=t.on("datesChanged",E=>{this.#o&&this.#o.onDatesChanged(E,this.#t.schedule)&&this.draw()})),this.#n.dirtyMarks&&(this.#rt=t.on("dirtyChange",()=>this.draw())),this.#Q=t.on("rowMove",E=>this.#Ar(E)),this.#dt=t.on("rowMove:cancelled",()=>{this.#ut(this.#u("gantt.a11y.rowMoveCancelled"),{repeat:!0})}),this.#Kt=Xn(E=>t.emitDraw(E)),this.draw(),this.#tt.note(),t.emitViewMount({view:this,element:this.#a}),this.#vn.settleAfterFrames()}get element(){return this.#a}get options(){return{...this.#n}}get scroller(){return this.#a?this.#a.querySelector(`.${s}__time-body`):null}get zoomControl(){return this.#g?this.#g.element:null}#qi(t){if(!this.#r||!this.#T)return;const e=String(t),n=this.#T.rows.find(F=>String(F.id)===e);if(!n)return;this.#Cn(this.#r,"scrollTop","clientHeight",n.top,n.height,()=>this.#mn(this.#r));const c=n.rec||{};if(!Number.isFinite(c.es)||!Number.isFinite(this.#T.pxPerDay)||this.#T.pxPerDay<=0)return;const A=(c.es-this.#T.domainMin)*this.#T.pxPerDay,T=(c.ef-this.#T.domainMin)*this.#T.pxPerDay;this.#Cn(this.#r,"scrollLeft","clientWidth",A,Math.max(0,T-A),()=>this.#Pt(this.#r))}#Cn(t,e,n,c,A,T){const F=t[e],E=t[n]||0;let rt=F;c<F?rt=c:c+A>F+E&&(rt=c+A-E),rt!==F&&(t[e]=Math.max(0,Math.round(rt)),T())}scrollToDate(t){const e=this.#r,n=this.#T;if(!e||!n||!Number.isFinite(n.pxPerDay)||n.pxPerDay<=0)return;const c=m(t);Number.isFinite(c)&&this.#Yn((c-n.domainMin)*n.pxPerDay)}#Yn(t){const e=this.#r,n=Math.max(0,Math.round(t-(e.clientWidth||0)/2));n!==e.scrollLeft&&(e.scrollLeft=n,this.#Pt(e))}setZoom(t,e="api"){const n=this.#f,c=this.#r,A=this.#T;let T=null;c&&A&&Number.isFinite(A.pxPerDay)&&A.pxPerDay>0&&(T=A.domainMin+(c.scrollLeft+(c.clientWidth||0)/2)/A.pxPerDay),this.#n.zoom=t,this.#f=typeof t=="string"&&Kn[t]?t:"custom",this.draw(),T!=null&&c&&this.#T&&Number.isFinite(this.#T.pxPerDay)&&this.#Yn((T-this.#T.domainMin)*this.#T.pxPerDay),this.#t.emitZoomChange({view:this,from:n,to:this.#f,cause:e,pxPerDay:this.#ae}),this.#tt.note()}fitZoom(t="api"){const e=this.#f,n=this.#r,c=this.#T,A=c&&Number.isFinite(c.domainMin)&&Number.isFinite(c.domainMax)?c.domainMax-c.domainMin:0,T=n?n.clientWidth:0;this.#f="fit",this.#n.zoom=A>0&&T>0?T/A:Kn.day.px,this.draw(),n&&(n.scrollLeft=0,this.#Pt(n)),this.#t.emitZoomChange({view:this,from:e,to:this.#f,cause:t,pxPerDay:this.#ae}),this.#tt.note()}visibleRange(){const t=this.#r,e=le(this.#T,t?t.scrollLeft:0,t?t.clientWidth:0);return e?{start:o(e.start),end:o(e.end)}:null}#Ji(){const t=this.#n.zoomControl;if(!t)return null;const e=t===!0?{}:t&&typeof t=="object"?t:{},n=e.position==="toolbar"?"toolbar":"header",c=Array.isArray(e.levels)?e.levels:[...Ki];return{position:n,levels:c}}#Qi(t){const e=this.#Ji();if(!e)return null;const n=Vi({doc:this.#e,view:this,t:this.#u,levels:e.levels,ns:s});return e.position==="header"&&t.appendChild(n.element),n}#Z(){return Math.max(80,Number(this.#n.gridWidth)||620)}#Zn(t){const e=t&&Number.isFinite(Number(t.labelWidth))?Number(t.labelWidth):0;return e>0?Math.max(Kt,e):nn}#tr(){const t=`${this.#Z()}px`;this.#d&&(this.#d.style.width=t),this.#c&&(this.#c.style.width=t),this.#Et&&(this.#Et.style.width=t),this.#Xt&&(this.#Xt.style.width=t)}rowGeometry(){return this.#P.map(t=>({...t}))}get collapsed(){return new Set(this.#m)}toggle(t,e={}){const n=String(t),c=!this.#m.has(n),A=new Set(this.#m);c?A.add(n):A.delete(n);const T=this.#t.schedule,F=T&&T.ok?T.tasks.get(n):null;this.#t.emitTaskToggle(c,{id:n,expandedIds:this.#nr(A),rawTask:this.#Xn(n),task:F||null,view:this,event:e.event||null},()=>{c?this.#m.add(n):this.#m.delete(n),this.draw()})}#er(){const t=this.#t.schedule;if(!t||!t.ok)return[];const e=new Map;for(const c of t.order){const A=t.tasks.get(c),T=A.parent==null?"__root__":String(A.parent);e.has(T)||e.set(T,[]),e.get(T).push(c)}const n=[];for(const c of t.order)t.tasks.get(c).isSummary&&(e.get(String(c))||[]).length>0&&n.push(String(c));return n}#nr(t){return this.#er().filter(e=>!t.has(e))}#Xn(t){const e=String(t);return this.#t.tasks.find(n=>String(this.#t.readId(n))===e)||null}#ir(t){const e=this.#r?this.#r.querySelector(`.${s}__plot`):null;if(!e||!e.getBoundingClientRect||!(this.#ae>0))return null;const n=e.getBoundingClientRect().left||0;return((t.clientX||0)-n-this.#Se)/this.#ae}#qn(t){if(!t||t.target&&t.target.closest&&t.target.closest("button"))return;const e=t.target&&t.target.closest?t.target.closest("[data-task]"):null,n=e?e.getAttribute("data-task"):null;n!=null&&this.#t.selectAt(String(n),{toggle:!!(t.ctrlKey||t.metaKey),range:!!t.shiftKey,order:this.#k.slice(),cause:"pointer",event:t})}#rr(t){if(!t||t.key!=="ArrowUp"&&t.key!=="ArrowDown")return;const e=t.key==="ArrowDown"?1:-1,n=this.#t.selectStep(e,{order:this.#k.slice(),event:t});if(n!=null&&(t.preventDefault&&t.preventDefault(),this.#at=n,this.#sr(n),this.#r)){const c=this.#r.querySelector(`.${s}__barrow[data-task="${n}"]`);c&&c.focus&&c.focus()}}#sr(t){if(!this.#r)return;const e=String(t),n=this.#P.find(c=>c.id===e);n&&(this.#Cn(this.#r,"scrollTop","clientHeight",n.top,n.height,()=>this.#mn(this.#r)),this.#Pn())}reflectSelection(){if(this.#Tt)return;const t=new Set(this.#t.selected());if(this.#r)for(const e of this.#r.querySelectorAll(`.${s}__barrow`)){const n=e.getAttribute("data-task"),c=n!=null&&t.has(String(n));e.classList.toggle(`${s}__barrow--selected`,c),c?e.setAttribute("aria-selected","true"):e.removeAttribute("aria-selected")}if(this.#A&&this.#A.grid&&this.#A.grid.selection){const e=new Set(this.#k),n=this.#t.selected().filter(T=>e.has(T)),c=this.#A.grid.selection.keys?this.#A.grid.selection.keys().slice().sort():null,A=n.slice().sort();if(!c||c.length!==A.length||c.some((T,F)=>T!==A[F])){this.#M=!0;try{this.#A.grid.selection.set(n)}finally{this.#M=!1}}}else if(this.#c)for(const e of this.#c.querySelectorAll("[data-task]")){const n=e.getAttribute("data-task");e.classList.toggle(`${s}__row--selected`,n!=null&&t.has(String(n)))}}setShowCritical(t){this.#n.showCritical=!!t,this.draw()}scrollToTask(t){const e=String(t);if(this.#Tt)return!1;if(this.#E.has(e))return typeof this.#t.emitTaskFiltered=="function"&&this.#t.emitTaskFiltered({id:e}),!1;const n=this.#t.schedule,c=n&&n.tasks?n.tasks.get(e):null;if(!c)return!1;let A=!1;for(let F=c.parent;F!=null;F=n.tasks.get(String(F)).parent)this.#m.delete(String(F))&&(A=!0);return A&&this.draw(),this.#P.find(F=>F.id===e)?(this.#qi(e),!0):!1}draw(){if(this.#Tt)return;const t=this.#t.schedule;if(!t||!t.ok)return;this.#tr();const e=t.overAllocations||[];if(this.#U=new Set(e.map(Te=>Te.resource)),this.#q=new Set(e.flatMap(Te=>Te.taskIds)),this.#O=new Set((t.conflicts||[]).map(Te=>Te.id)),this.#he=this.#n.tooltip?new Map(this.#t.tasks.map(Te=>[String(this.#t.readId(Te)),Te])):null,this.#X=null,this.#n.evm){const Te=this.#n.evm===!0?{}:this.#n.evm,Ie=Te.statusDate!=null?Te.statusDate:Number.isFinite(this.#n.today)?this.#n.today:void 0,Ue=this.#t.earnedValue({...Te,statusDate:Ie});Ue&&Ue.ok&&(this.#X=Ue.byTask)}this.#C=this.#or(t);let n=this.#An(t);this.#A&&(n=this.#so(n,t));const c=this.#Jn(n);this.#P=c,this.#k=n.map(Te=>Te.id),this.#t.noteVisibleTasks(this.#k);const A=c.length?c[c.length-1].top+c[c.length-1].height:0,T=this.#Qn(),F=t.projectStart,E=t.projectFinish,rt=this.#n.resourceOnly?[]:[F,E];Number.isFinite(this.#n.today)&&rt.push(this.#n.today);for(const Te of this.#F)Te.date!=null?rt.push(Te.date):rt.push(Te.from,Te.to);if(this.#n.resourceOnly&&this.#b)for(const Te of this.#b.external||[])Number.isFinite(Te.start)&&rt.push(Te.start),Number.isFinite(Te.end)&&rt.push(Te.end);rt.length||rt.push(F,E);const _t=Math.floor(Math.min(...rt)),ut=Math.ceil(Math.max(...rt)),Nt=Math.max(1,Math.round((ut-_t)*.04)),Wt=_t-Nt,te=ut+Nt,ue=T.px,se=!Number.isFinite(this.#n.height)&&!this.#ft&&this.#r?this.#r.offsetWidth:0,qt=se>0?se:An(this.#r),Qt=this.#Ts(n,Wt,ue),ee=Math.round((te-Wt)*ue);let ke=ee;Number.isFinite(qt)&&(ke=Math.max(ke,qt)),Number.isFinite(qt)&&ee<qt&&Qt>0&&(ke=Math.max(ke,Qt+Xe));const ge=ke>ee?Math.ceil(Wt+ke/ue):te,Ae=Math.max(1,Math.round((ge-Wt)*ue)),Ce=_({min:Wt,max:ge},[0,Ae]);this.#ae=Ce.of(1)-Ce.of(0),this.#Se=Ce.of(0);const Oe=Te=>d(Ce.of(Te));if(this.#A)this.#oo();else if(this.#ar(),this.#pr(t,n,c),this.#at&&this.#c){const Te=this.#c.querySelector(`.${s}__row[data-task="${this.#at}"]`);Te&&Te.focus&&Te.focus()}if(this.#Pr(T,Wt,ge,Oe,Ae),this.#z={schedule:t,rows:n,geometry:c,x:Oe,width:Ae,totalHeight:A,min:Wt,max:ge},this.#zr(t,n,c,Oe,Ae,A,Wt,ge),this.#sn){const Te=this.getWorkloadUnit();this.#sn.setAttribute("aria-pressed",Te==="hours"?"false":"true"),this.#sn.setAttribute("data-unit",Te)}if(this.#g&&this.#g.update(this.#f),this.#b&&this.#is(t,T,Wt,te,ge,Oe,Ae),this.#S&&this.#ys(t,T,Wt,ge,Oe,Ae),this.#o){let Te=null;this.#o.render({rows:n,allRows:this.#An(t,!0),rawById:new Map(this.#t.tasks.map(Ie=>[String(this.#t.readId(Ie)),Ie])),buckets:ai(T.level,Math.floor(Wt),Math.ceil(ge),this.#ue()),zoom:T.level,x:Oe,width:Ae,collapsedIds:this.#m,costByTask:()=>{if(Te==null){const Ie=this.#t.costByBucket(Math.floor(Wt),Math.ceil(ge),{zoom:T.level,by:"task",weekStartDay:this.#ue()});Te=Ie.ok?Ie.byTask:null}return Te}})}this.#h&&this.#h.render({buckets:ai(T.level,Math.floor(Wt),Math.ceil(ge),this.#ue()),zoom:T.level,x:Oe,width:Ae}),this.#ts(),this.#qr();const $e=new Map(this.#t.tasks.map(Te=>[String(Te.id),Te]));let Ye=this.#s,Je=this.#en(),tn=null;if(this.#A){const Te=this.#A.grid,Ie=this.#En(Te,"name");Ye=Ie.columns,Je=Ie.columnWidths,tn=n.map((Ue,Pi)=>Ie.visible.map(ki=>this.#Tn(Te,String(Ue.id),ki,Pi)))}this.#T={columns:Ye,columnWidths:Je,cellTexts:tn,rows:n.map(Te=>({id:Te.id,rec:Te.rec,depth:Te.depth,...c.find(Ie=>Ie.id===Te.id)})),rawById:$e,totalHeight:A,domainMin:Wt,domainMax:te,pxPerDay:this.#ae,zoomLevel:T.level,today:Number.isFinite(this.#n.today)?this.#n.today:null,rowHeight:this.#n.rowHeight,title:this.#n.title||null,workload:this.#b?{cfg:this.#b,data:this.#B}:null,histogram:this.#S?{cfg:this.#S,data:this.#lt}:null,dataBands:this.#o?this.#o.exportModels():null,chartBands:this.#h?this.#h.exportModels():null},this.reflectSelection(),this.#Kt({view:this,element:this.#a,range:{start:Wt,end:ge},zoom:T.level})}#or(t){const e=this.#n.progressLine;if(e&&typeof e=="object"&&e.statusDate!=null){const n=m(e.statusDate);if(Number.isFinite(n))return n}if(this.#n.evm&&this.#n.evm!==!0&&this.#n.evm.statusDate!=null){const n=m(this.#n.evm.statusDate);if(Number.isFinite(n))return n}return Number.isFinite(this.#n.today)?this.#n.today:Number.isFinite(t.projectFinish)?t.projectFinish:null}#An(t,e=!1){const n=new Map;for(const T of t.order){const F=t.tasks.get(T),E=F.parent==null?"__root__":String(F.parent);n.has(E)||n.set(E,[]),n.get(E).push(T)}const c=[],A=(T,F)=>{for(const E of n.get(T)||[]){const rt=t.tasks.get(E),_t=!!rt.isSummary&&(n.get(E)||[]).length>0;c.push({id:E,rec:rt,depth:F,hasChildren:_t}),_t&&(e||!this.#m.has(E))&&A(E,F+1)}};return A("__root__",0),c}#Jn(t){const e=Number(this.#n.rowHeight)||34,n=new Map(this.#t.tasks.map(rt=>[String(this.#t.readId(rt)),rt])),c=this.#s.find(rt=>rt.kind==="name"),A=!!this.#ct||!!this.#n.wrapNames,T=A?c&&c.width?c.width:this.#Z()-this.#s.filter(rt=>rt.kind!=="name").reduce((rt,_t)=>rt+(_t.width||0),0):0,F=[];let E=0;for(const rt of t){const _t=n.get(rt.id)||{};let ut=e;if(Number.isFinite(_t.height))ut=Math.max(e,Number(_t.height));else if(A){const Nt=Math.max(24,T-rt.depth*(this.#n.indent||16)-28),Wt=Math.max(4,Math.floor(Nt/7)),te=Math.max(1,Math.ceil(String(rt.rec.name||"").length/Wt));te>1&&(ut=Math.max(e,te*18+12))}F.push({id:rt.id,top:E,height:ut}),E+=ut}return F}#Qn(){const t=this.#n.zoom;return Number.isFinite(t)?{px:Number(t),step:1,level:"custom"}:typeof t=="string"&&Kn[t]?Kn[t]:Kn.day}#me(){if(this.#n.calendar){const t=i(this.#n.calendar,0);if(t)return e=>!t.isWorking(e)}return this.#n.nonWorking==="weekends"?t=>{const e=a(t),n=e?e.getUTCDay():0;return n===0||n===6}:typeof this.#n.nonWorking=="function"?this.#n.nonWorking:null}#ar(){const t=this.#d;for(;t.firstChild;)t.removeChild(t.firstChild);t.style.height=`${this.#n.headerHeight}px`;const e=this.#en();if(this.#s.forEach((n,c)=>{const A=k(this.#e,"div",`${s}__colhead`);A.style.width=`${e[c]}px`,A.style.flex=`0 0 ${e[c]}px`,u(A,n.title||(Pn.has(n.kind)?this.#u(`gantt.col.${n.kind}`):n.key)),n.resizable!==!1&&A.appendChild(this.#lr(n)),t.appendChild(A)}),this.#$n){const n=t.querySelector(`.${s}__colresize[data-resize-key="${this.#$n}"]`);n&&n.focus&&n.focus()}}#lr(t){const e=k(this.#e,"div",`${s}__colresize`);return e.setAttribute("data-resize-key",t.key),e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical"),e.addEventListener("pointerdown",n=>this.#ei(n,t.key)),e.addEventListener("keydown",n=>this.#ii(n,t.key)),e}#en(){const t=this.#Z(),e=this.#s.findIndex(c=>c.kind==="name"),n=this.#s.map((c,A)=>this.#an.has(c.key)?this.#an.get(c.key):A===e?null:c.width||80);if(e>=0&&n[e]==null){const c=n.reduce((A,T,F)=>F===e?A:A+T,0);n[e]=Math.max(this.#pn(this.#s[e]),t-c)}return n}#pn(t){return Number.isFinite(t.minWidth)?Math.max(1,Number(t.minWidth)):t.kind==="name"?ce:Kt}#ti(t){return Number.isFinite(t.maxWidth)?Math.max(this.#pn(t),Number(t.maxWidth)):1/0}#Mn(t){return`${t.isTotal?"__total__":t.key}\0${t.taskId??""}`}#cr(t,e){const n=ut=>{const Nt=ut&&ut.layout;return typeof Nt=="number"?{width:Nt}:Nt||{}},c=ut=>{if(typeof ut=="number")return ut>0?ut:0;if(typeof ut!="string")return 0;const Nt=ut.trim();if(!Nt.endsWith("%")){const te=Number(Nt);return Number.isFinite(te)&&te>0?te:0}const Wt=Number(Nt.slice(0,-1));return!Number.isFinite(Wt)||Wt<=0?0:e>0?e*Wt/100:0},A=(ut,Nt)=>Math.min(Math.max(ut,Nt.min>0?Nt.min:xn),Nt.max>0?Nt.max:1/0),T=new Array(t.length),F=[];let E=0;for(let ut=0;ut<t.length;ut++){const Nt=n(t[ut]);if(Nt.flex>0)F.push(ut),T[ut]=0;else{const Wt=c(Nt.width);T[ut]=A(Wt>0?Wt:Dn,Nt),E+=T[ut]}}if(!F.length)return T;let rt=Math.max(0,e-E),_t=F.slice();for(let ut=0;ut<=F.length&&_t.length>0;ut++){let Nt=0;for(const ue of _t)Nt+=n(t[ue]).flex;if(Nt<=0)break;const Wt=[];let te=!1;for(const ue of _t){const Gt=n(t[ue]),se=rt*Gt.flex/Nt,qt=A(se,Gt);T[ue]=qt,Math.abs(qt-se)>.5?(rt-=qt,te=!0):Wt.push(ue)}if(!te)break;_t=Wt}return T}#Tn(t,e,n,c){const A=t.rows.text(e,n.id),T=n.cell&&n.cell.render;if(typeof T!="function")return A;const F=t.messages&&typeof t.messages.t=="function"?t.messages.t:(_t=>_t);let E;try{const _t=t.rows.byKey(e);E={value:t.rows.value(e,n.id),text:A,data:_t?_t.data:null,row:_t,column:n,colId:n.id,grid:t,index:c,t:F,context:t.context,props:n.cell.props}}catch{return A}let rt;try{rt=T(E)}catch{return A}return typeof rt=="string"?rt:this.#ge.has(T)?A:rt&&rt.nodeType!=null&&typeof rt.textContent=="string"?rt.textContent:A}#En(t,e){const n=t.columns.visible();return{columns:n.map(A=>({id:A.id,title:A.title??A.id,kind:e&&A.id===e?e:null})),columnWidths:this.#cr(n,this.#Z()),visible:n}}#ur(){const t=this.#a&&Number.isFinite(this.#a.clientWidth)?this.#a.clientWidth:0;return t>0?Math.max(ye,t-Le):1/0}#On(t){if(t==="grid")return this.#Z();const e=this.#s.findIndex(n=>n.key===t);return e<0?0:this.#en()[e]}#dr(t){if(t==="grid")return"The table/timeline divider";const e=this.#s.find(n=>n.key===t);return e?e.title||e.key:t}#Dn(t,e){if(t==="grid"){const A=Math.round(Math.max(ye,Math.min(this.#ur(),e)));return this.#n.gridWidth=A,this.draw(),A}const n=this.#s.find(A=>A.key===t);if(!n||n.resizable===!1)return this.#On(t);const c=Math.round(Math.max(this.#pn(n),Math.min(this.#ti(n),e)));return this.#an.set(t,c),this.draw(),c}#hr(){return{grid:this.#Z(),...this.getColumnWidths()}}#be(t,e){typeof this.#t.emitColumnResize=="function"&&this.#t.emitColumnResize({key:t,width:e,widths:this.#hr()})}#ei(t,e){if(t&&t.button!=null&&t.button!==0)return;this.#qt={key:e,startX:t&&t.clientX||0,startWidth:this.#On(e)},t&&t.preventDefault&&t.preventDefault();const n=A=>this.#fr(A),c=A=>this.#gr(A);this.#Ze={move:n,up:c},this.#e.addEventListener("pointermove",n),this.#e.addEventListener("pointerup",c)}#fr(t){if(!this.#qt)return;const e=(t&&t.clientX||0)-this.#qt.startX;this.#Dn(this.#qt.key,this.#qt.startWidth+e)}#gr(t){const e=this.#qt;if(this.#ni(),this.#qt=null,!e)return;const n=(t&&t.clientX||0)-e.startX,c=this.#Dn(e.key,e.startWidth+n);c!==e.startWidth&&this.#be(e.key,c)}#ni(){this.#Ze&&(this.#e.removeEventListener("pointermove",this.#Ze.move),this.#e.removeEventListener("pointerup",this.#Ze.up),this.#Ze=null)}#ii(t,e){if(!(t.key==="ArrowLeft"||t.key==="ArrowRight"))return;t.preventDefault&&t.preventDefault();const c=t.shiftKey?At:xt,A=t.key==="ArrowRight"?c:-c,T=this.#On(e);this.#$n=e;const F=this.#Dn(e,T+A),E=this.#dr(e);F!==T?(this.#ut(`${E} resized to ${F}px`,{repeat:!0}),this.#be(e,F)):this.#ut(`${E} is already at its ${A<0?"minimum":"maximum"} width`,{repeat:!0})}getColumnWidths(){const t={};if(this.#A)Object.assign(t,this.#A.widths());else if(!this.#n.resourceOnly){const e=this.#en();this.#s.forEach((n,c)=>{t[n.key]=e[c]})}for(const[e,n]of this.#ri())for(const[c,A]of Object.entries(n.widths()))t[`${e==="workload"?"band":"histogram"}:${c}`]=A;return t}#ri(){const t=[];return this.#$&&t.push(["workload",this.#$]),this.#K&&t.push(["histogram",this.#K]),t}setColumnWidths(t){if(!(!t||typeof t!="object")){for(const[e,n]of this.#ri()){const c=e==="workload"?"band:":"histogram:";n.freezeColumns();for(const[A,T]of Object.entries(t)){const F=A.startsWith(c)?A.slice(c.length):null;if(F==null||!Number.isFinite(T))continue;const E=n.grid.columns.get(F);E&&E.layout&&E.layout.resizable!==!1&&n.grid.columns.resize(F,T)}}if(this.#A){const e=this.#A.grid;this.#A.freezeColumns();for(const[n,c]of Object.entries(t)){if(n==="grid"||!Number.isFinite(c))continue;const A=e.columns.get(n);A&&A.layout&&A.layout.resizable!==!1&&e.columns.resize(n,c)}this.draw();return}if(this.#n.resourceOnly){this.draw();return}for(const e of this.#s){const n=t[e.key];!Number.isFinite(n)||e.resizable===!1||this.#an.set(e.key,Math.round(Math.max(this.#pn(e),Math.min(this.#ti(e),n))))}this.draw()}}#pr(t,e,n){const c=this.#c;for(;c.firstChild;)c.removeChild(c.firstChild);const A=new Map(this.#t.tasks.map(E=>[String(this.#t.readId(E)),E])),T=this.#en(),F=T.reduce((E,rt)=>E+(rt||0),0);e.forEach((E,rt)=>{const _t=n[rt],ut=k(this.#e,"div",`${s}__row${E.rec.isSummary?` ${s}__row--summary`:""}${E.rec.late?` ${s}__row--late`:""}`);ut.style.width=`${F}px`,ut.style.height=`${_t.height}px`,ut.setAttribute("role","row"),ut.setAttribute("data-task",E.id),ut.setAttribute("data-row-top",String(_t.top)),ut.setAttribute("data-row-height",String(_t.height)),(this.#n.contextMenu||this.#n.keyboard)&&ut.setAttribute("tabindex","0"),this.#s.forEach((Nt,Wt)=>{const te=this.#n.editable&&!E.rec.isSummary&&this.#Ri(Nt)!=null,ue=k(this.#e,"div",`${s}__cell${Nt.kind==="name"?` ${s}__cell--name`:""}${te?` ${s}__cell--editable`:""}`);ue.style.width=`${T[Wt]}px`,ue.style.flex=`0 0 ${T[Wt]}px`,ue.setAttribute("data-col",String(Wt)),this.#mr(ue,Nt,E,A.get(E.id)||{}),ut.appendChild(ue)}),c.appendChild(ut)})}#mr(t,e,n,c){if(typeof e.render=="function"){const T=e.render(n.rec,{rawTask:c,depth:n.depth});T&&typeof T=="object"&&typeof T.nodeType=="number"?t.appendChild(T):T!=null&&u(t,String(T));return}if(e.kind==="name"){this.#vr(t,n);return}if(e.kind==="assignee"){this.#ai(t,c,n);return}if(Be.has(e.kind)){u(t,this.#li(e.kind,n.rec));return}if(e.kind==="progress"){this.#ci(t,n.rec);return}if(e.kind==="evm"){this.#br(t,e,n);return}if(e.kind==="plannedPercentComplete"){this.#yr(t,n);return}if(e.kind==="unscheduled"){n.rec.unscheduled&&t.appendChild(Hn(this.#e,s,this.#u));return}if(e.kind==="inactive"){this.#_r(t,n);return}if(e.kind==="slack"){u(t,this.#Dr(n.rec));return}if(e.kind==="deadline"){u(t,this.#Bi(n.rec));return}if(e.kind==="wbs"){u(t,n.rec.wbs||"");return}if(De.has(e.kind)){u(t,this.#In(e.kind,n.rec));return}const A=c[e.key];u(t,A==null?"":String(A))}#br(t,e,n){const c=e.metric||"spi",A=this.#X?this.#X.get(n.id):null,T=A?A[c]:null;if(T==null||!Number.isFinite(T)){u(t,"—");return}const F=c==="spi"||c==="cpi"?2:Number.isFinite(e.digits)?e.digits:0;u(t,T.toFixed(F))}#yr(t,e){const n=this.#kr(e.rec);if(n==null){u(t,"—");return}u(t,String(Math.round(n)))}#kr(t){if(t.isSummary||t.unscheduled||t.inactive||!Number.isFinite(this.#C))return null;const e=t.baselineStart!=null?t.baselineStart:t.es,n=t.baselineEnd!=null?t.baselineEnd:t.ef;return Wn(this.#C,e,n)*100}#wr(t,e){const n=t.percentComplete==null?0:Math.max(0,Math.min(100,t.percentComplete))/100;return e?e.dayOf(e.indexOf(t.es)+n*t.duration):t.es+n*t.duration}#vr(t,e){if(t.style.paddingLeft=`${8+e.depth*(this.#n.indent||16)}px`,this.#n.editable){const T=this.#e.createElement("button");T.setAttribute("class",`${s}__drag-handle`),T.setAttribute("type","button"),T.setAttribute("aria-hidden","true"),T.setAttribute("tabindex","-1"),T.setAttribute("aria-label",this.#u("gantt.row.moveHandle",{name:e.rec.name})),u(T,"⠿"),T.addEventListener("pointerdown",F=>this.#Sr(F,e.id)),t.appendChild(T)}const n=this.#e.createElement("button");if(n.setAttribute("class",`${s}__chevron`),n.setAttribute("type","button"),e.hasChildren){const T=this.#m.has(e.id);u(n,T?"▸":"▾"),n.setAttribute("aria-label",this.#u(T?"gantt.row.expand":"gantt.row.collapse",{name:e.rec.name})),n.setAttribute("aria-expanded",T?"false":"true"),n.addEventListener("click",F=>this.toggle(e.id,{event:F})),n.addEventListener("keydown",F=>{F&&(F.key==="Enter"||F.key===" "||F.key==="Spacebar")&&(F.preventDefault&&F.preventDefault(),this.toggle(e.id,{event:F}))})}else n.setAttribute("aria-hidden","true");t.appendChild(n);const c=k(this.#e,"span",`${s}__name-text${e.rec.isSummary?` ${s}__name-text--summary`:""}${this.#n.wrapNames?"":` ${s}__name-text--nowrap`}`);u(c,e.rec.name);const A=String(e.rec.name||"");c.setAttribute("title",A),c.setAttribute("aria-label",A),t.appendChild(c),e.rec.inactive?t.appendChild(xi(this.#e,s,this.#u)):e.rec.unscheduled&&t.appendChild(Hn(this.#e,s,this.#u))}#_r(t,e){if(e.rec.isSummary)return;const n=typeof this.#t.isTaskReadOnly=="function"&&this.#t.isTaskReadOnly(e.id),c=this.#e.createElement("input");c.setAttribute("type","checkbox"),c.setAttribute("class",`${s}__inactive-check`),c.setAttribute("aria-label",this.#u("gantt.col.inactive")),c.checked=!!e.rec.inactive,c.disabled=!this.#n.editable||n,c.addEventListener("change",A=>{this.#t.applyEdit({id:e.id,inactive:c.checked},{writeBack:!0,event:A}),this.draw()}),t.appendChild(c)}#nn(t){const e=this.#t.schedule;return!e||!e.ok?[]:e.order.filter(n=>{const c=e.tasks.get(n);return(c&&c.parent!=null?String(c.parent):null)===t})}#Sr(t,e){if(!t||this.#Yt||this.#Tt)return;t.preventDefault&&t.preventDefault();const n=A=>this.#$r(A),c=A=>this.#xr(A);this.#Yt={id:e,onMove:n,onUp:c,target:null},this.#e.addEventListener("pointermove",n),this.#e.addEventListener("pointerup",c)}#$r(t){const e=this.#Yt;if(!e||!this.#c||!t)return;this.#si();const n=this.#e.elementFromPoint?this.#e.elementFromPoint(t.clientX,t.clientY):null,c=n&&n.closest?n.closest(`.${s}__row`):null,A=c?c.getAttribute("data-task"):null;if(!c||A==null||A===e.id){e.target=null;return}const T=this.#t.schedule,F=T&&T.ok?T.tasks.get(A):null;if(!F){e.target=null;return}const E=c.getBoundingClientRect(),rt=E.height?(t.clientY-E.top)/E.height:.5,_t=F.parent!=null?String(F.parent):null;let ut,Nt;rt<.25?(ut="before",Nt={parent:_t,index:this.#nn(_t).indexOf(A),position:"before",target:A}):rt>.75?(ut="after",Nt={parent:_t,index:this.#nn(_t).indexOf(A)+1,position:"after",target:A}):(ut="child",Nt={parent:A,index:void 0,position:"inside",target:A}),e.target=Nt,c.classList.add(`${s}__row--drop-${ut}`)}#si(){if(this.#c)for(const t of["before","after","child"]){const e=this.#c.querySelector(`.${s}__row--drop-${t}`);e&&e.classList.remove(`${s}__row--drop-${t}`)}}#xr(t){const e=this.#Yt;this.#oi(),!(!e||!e.target)&&(this.#at=e.id,this.#t.moveRow(e.id,{...e.target,event:t||null}))}#oi(){this.#Yt&&(this.#e.removeEventListener("pointermove",this.#Yt.onMove),this.#e.removeEventListener("pointerup",this.#Yt.onUp)),this.#Yt=null,this.#si()}#Cr(t){if(!t)return;const e=t.target&&t.target.closest?t.target.closest("[data-task]"):null,n=e?e.getAttribute("data-task"):null;if(n==null)return;const c=this.#t.schedule;if(!c||!c.ok)return;const A=c.tasks.get(n);if(!A)return;const T=A.parent!=null?String(A.parent):null;if(t.altKey&&(t.key==="ArrowUp"||t.key==="ArrowDown")){const F=this.#nn(T),E=F.indexOf(n),rt=E+(t.key==="ArrowUp"?-1:1);t.preventDefault&&t.preventDefault(),this.#at=n;const _t=t.key==="ArrowUp"?F[E-1]:F[E+1];this.#t.moveRow(n,{parent:T,index:rt,position:t.key==="ArrowUp"?"before":"after",target:_t||null,event:t});return}if(t.key==="Tab"&&!t.shiftKey){const F=this.#nn(T),E=F.indexOf(n),rt=E>0?F[E-1]:null;if(!rt)return;t.preventDefault&&t.preventDefault(),this.#at=n,this.#t.moveRow(n,{parent:rt,position:"inside",target:rt,event:t});return}if(t.key==="Tab"&&t.shiftKey){if(T==null)return;const F=c.tasks.get(T),E=F&&F.parent!=null?String(F.parent):null,_t=this.#nn(E).indexOf(T);t.preventDefault&&t.preventDefault(),this.#at=n,this.#t.moveRow(n,{parent:E,index:_t+1,position:"after",target:T,event:t})}}#Ar(t){const e=this.#t.schedule,n=e&&e.ok?e.tasks.get(t.id):null,c=n?n.name:t.id;if(t.newParent===t.oldParent){this.#ut(this.#u("gantt.a11y.rowMoved",{name:c}),{repeat:!0});return}if(t.newParent==null){this.#ut(this.#u("gantt.a11y.rowPromoted",{name:c}),{repeat:!0});return}const A=e&&e.ok?e.tasks.get(t.newParent):null;this.#ut(this.#u("gantt.a11y.rowReparented",{name:c,parent:A?A.name:t.newParent}),{repeat:!0})}#it(t){return this.#t.resourceNames.get(t)??t}#ai(t,e,n){const c=Tt(e).map(F=>F.resource);let A=t;if(this.#n.editable&&n&&!n.rec.isSummary){const F=k(this.#e,"button",`${s}__picker-trigger`);F.setAttribute("type","button"),F.setAttribute("data-picker-for",n.id),F.setAttribute("aria-haspopup","dialog"),F.setAttribute("aria-label",this.#u("gantt.picker.open",{name:n.rec.name})),F.addEventListener("click",()=>this.#Mr(n.id,F)),t.appendChild(F),A=F,c.length||u(F,"+")}if(!c.length)return;const T=k(this.#e,"div",`${s}__avatars`);for(const F of c.slice(0,3)){const E=this.#it(F),rt=this.#U.has(F);T.appendChild(P(this.#e,{name:E,avatar:this.#t.resourceAvatars.get(F),over:rt,title:rt?this.#u("gantt.resource.over",{name:E}):E}))}A.appendChild(T)}#Mr(t,e){this.#nt||(this.#Wt&&this.#Wt.close(),this.#Wt=new q(this.#t,this.#e,this.#u,t,e,()=>{this.#Wt=null,this.draw()}),this.#Wt.open())}#Tr(t,e,n=null){this.#nt||this.#Rt&&n&&!this.#Rt.gateDblClick(t.from,t.to,t.type,n)||(this.#Wt&&this.#Wt.close(),this.#Me&&this.#Me.close(),this.#Me=new Et(this.#t,this.#e,this.#u,t,e,()=>{this.#Me=null}),this.#Me.open())}#Er(t,e,n,c){const A=this.#r?this.#r.querySelector(`.${s}__plot`):null;A&&((!this.#Zt||!this.#Zt.isConnected)&&(this.#Zt=w(this.#e,"path",{class:`${s}__linkpreview`}),A.appendChild(this.#Zt)),this.#Zt.setAttribute("d",g(["M",d(t),d(e),"L",d(n),d(c)])))}#Or(){this.#Zt&&(this.#Zt.remove(),this.#Zt=null)}#li(t,e){return e.isSummary?"":t==="effort"?e.effort!=null&&e.effort>0?String(d(e.effort)):"":e.units>0?`${Math.round(e.units*100)}%`:""}#Dr(t){return t.isSummary||t.unscheduled||t.inactive?"":String(d(t.totalFloat))}#ci(t,e){const n=e.percentComplete==null?null:Math.max(0,Math.min(100,e.percentComplete));if(n==null)return;const c=26,A=10,T=2*Math.PI*A,F=w(this.#e,"svg",{class:`${s}__ring`,width:c,height:c,viewBox:`0 0 ${c} ${c}`});F.appendChild(w(this.#e,"circle",{class:`${s}__ring-track`,cx:c/2,cy:c/2,r:A,fill:"none","stroke-width":3})),F.appendChild(w(this.#e,"circle",{class:`${s}__ring-progress${n>=100?` ${s}__ring-progress--complete`:""}`,cx:c/2,cy:c/2,r:A,fill:"none","stroke-width":3,"stroke-dasharray":`${d(T*n/100)} ${d(T)}`,"stroke-linecap":"round",transform:`rotate(-90 ${c/2} ${c/2})`}));const E=w(this.#e,"text",{class:`${s}__ring-label`,x:c/2,y:c/2+3,"text-anchor":"middle"});u(E,String(Math.round(n))),F.appendChild(E),t.appendChild(F)}#Pr(t,e,n,c,A){const T=this.#y;for(;T.firstChild;)T.removeChild(T.firstChild);T.style.height=`${this.#n.headerHeight}px`;const F=this.#n.headerHeight,E=t.level==="day"?Math.round(F*.55):F,rt=w(this.#e,"svg",{class:`${s}__plot`,width:A,height:F,viewBox:`0 0 ${A} ${F}`});rt.setAttribute("data-role","time-head");const _t=Math.floor(e),ut=Math.ceil(n),Nt=this.#me(),Wt=An(T),te=Wt==null?null:Math.max(0,Wt-_n),ue=t.level==="month"||t.level==="quarter"?null:7;if(ue){const Gt=[];let se=On(_t,this.#ue());for(;se<ut;se+=ue){const qt=c(se);rt.appendChild(w(this.#e,"line",{class:`${s}__bandsep`,x1:qt,y1:0,x2:qt,y2:F}));const Qt=a(se);Qt&&Gt.push({at:qt,text:`${Vn[Qt.getUTCDay()]} ${String(Qt.getUTCDate()).padStart(2,"0")} ${ii[Qt.getUTCMonth()]} ${Qt.getUTCFullYear()}`})}for(const qt of U(Gt,{fontSize:Ti,bold:!0}).kept){if(!this.#ui(qt,te))continue;const Qt=w(this.#e,"text",{class:`${s}__band`,x:qt.at+4,y:Math.round(E*.62)});u(Qt,qt.text),rt.appendChild(Qt)}}else{let Gt=a(_t);if(Gt){const se=[];let qt=Date.UTC(Gt.getUTCFullYear(),Gt.getUTCMonth(),1)/864e5;for(;qt<ut;){const Qt=a(qt),ee=c(qt);rt.appendChild(w(this.#e,"line",{class:`${s}__bandsep`,x1:ee,y1:0,x2:ee,y2:F})),se.push({at:ee,text:`${ii[Qt.getUTCMonth()]} ${Qt.getUTCFullYear()}`}),qt=Date.UTC(Qt.getUTCFullYear(),Qt.getUTCMonth()+1,1)/864e5}for(const Qt of U(se,{fontSize:Ti,bold:!0}).kept){if(!this.#ui(Qt,te))continue;const ee=w(this.#e,"text",{class:`${s}__band`,x:Qt.at+4,y:Math.round(F*.6)});u(ee,Qt.text),rt.appendChild(ee)}}}if(t.level==="day"){rt.appendChild(w(this.#e,"line",{class:`${s}__bandsep`,x1:0,y1:E,x2:A,y2:E}));for(let Gt=_t;Gt<ut;Gt+=1){const se=a(Gt);if(!se)continue;const qt=(c(Gt)+c(Gt+1))/2;if(te!=null&&(qt-dn<0||qt+dn>te))continue;const Qt=w(this.#e,"text",{class:`${s}__dayletter${Nt&&Nt(Gt)?` ${s}__dayletter--nonwork`:""}`,x:d(qt),y:E+Math.round((F-E)*.62)});u(Qt,Ei[se.getUTCDay()]),rt.appendChild(Qt)}}this.#jr(rt,c,F),T.appendChild(rt),T.scrollLeft=this.#r?this.#r.scrollLeft:0}#ui(t,e){return e==null?!0:t.at+4>=0&&t.at+4+t.width<=e}#jr(t,e,n){for(const c of this.#F){if(!c.label)continue;const A=c.date!=null?c.date:(c.from+c.to)/2,T=w(this.#e,"text",{class:`${s}__marker-label`,x:d(e(A)+3),y:Math.max(4,n-4),"data-marker":String(c.index)});c.colour&&T.setAttribute("fill",c.colour),u(T,c.label),t.appendChild(T)}}#Nr(t,e,n){if(!this.#F.length)return;const c=w(this.#e,"g",{class:`${s}__markers`});for(const A of this.#F){if(A.from==null)continue;const T=e(A.from),F=e(A.to);if(F<=T)continue;const E=w(this.#e,"rect",{class:`${s}__marker-range`,x:T,y:0,width:d(F-T),height:n,"data-marker":String(A.index),"data-from":String(A.from),"data-to":String(A.to)});A.colour&&E.setAttribute("fill",A.colour),c.appendChild(E)}t.appendChild(c)}#Lr(t,e,n){if(!this.#F.length)return;const c=w(this.#e,"g",{class:`${s}__markers`});for(const A of this.#F){const T=A.date!=null?[A.date]:[A.from,A.to];for(const F of T){const E=e(F),rt=w(this.#e,"line",{class:`${s}__marker`,x1:E,y1:0,x2:E,y2:n,"data-marker":String(A.index),"data-date":String(F)});A.colour&&rt.setAttribute("stroke",A.colour),A.dashed&&rt.setAttribute("stroke-dasharray","4 3"),c.appendChild(rt)}}t.appendChild(c)}#di(t,e,n,c){const A=t.length;if(A===0)return{first:0,last:-1};const T={first:0,last:A-1};if(!(n>0)||e<=n)return T;const F=c-Ve,E=c+n+Ve,rt=this.#Ir(t,F),_t=this.#Fr(t,E);return rt>_t?{first:Math.min(rt,A-1),last:Math.min(rt,A-1)}:{first:rt,last:_t}}#Ir(t,e){let n=0,c=t.length-1,A=t.length-1;for(;n<=c;){const T=n+c>>1;t[T].top+t[T].height>e?(A=T,c=T-1):n=T+1}return A}#Fr(t,e){let n=0,c=t.length-1,A=0;for(;n<=c;){const T=n+c>>1;t[T].top<e?(A=T,n=T+1):c=T-1}return A}#hi(){if(this.#Tt||!this.#z)return;const t=this.#e.defaultView||globalThis;if(typeof t.requestAnimationFrame!="function"){this.#Pn();return}this.#pt==null&&(this.#pt=t.requestAnimationFrame(()=>{this.#pt=null,this.#Pn()}))}#Pn(){if(this.#Tt||!this.#z)return;const t=this.#z,e=this.#r;if(!e||!t.plot)return;const n=t.geometry,c=t.clientHeight||e.clientHeight;if(this.#gt&&n.length&&c>0){const E=n[this.#gt.first].top,rt=n[this.#gt.last],_t=rt.top+rt.height,ut=e.scrollTop,Nt=e.scrollTop+c,Wt=this.#gt.first===0||ut>=E+Re,te=this.#gt.last===n.length-1||Nt<=_t-Re;if(Wt&&te)return}const A=this.#di(n,t.totalHeight,c,e.scrollTop);this.#gt=A;const{first:T,last:F}=A;t.perRow&&this.#fi(t.plot,t.schedule,t.rows,n,t.x,t.totalHeight,t.min,t.max,t.perRow,null,T,F),this.#Rr(T,F),this.#Br(),this.#n.progressLine&&Number.isFinite(this.#C)&&this.#yi(t.plot,t.schedule,t.rows,n,t.x,T,F),this.reflectSelection()}#Rr(t,e){const n=this.#z;for(const[c,A]of n.barEls){const T=n.rowIndex.get(c);(T==null||T<t||T>e)&&(A.remove(),n.barEls.delete(c))}for(let c=t;c<=e;c+=1){const A=n.rows[c].id;if(n.barEls.has(A))continue;const T=this.#gi(n.rows,n.geometry,n.x,n.width,c);n.barEls.set(A,T),n.bars.appendChild(T)}}#Br(){const t=this.#z,e=t.plot.querySelector(`.${s}__links`);if(!this.#n.showArrows||!e)return;const n=this.#gt||{first:0,last:Math.max(0,t.rows.length-1)},c=new Set((t.schedule.conflicts||[]).filter(T=>T.type==="LOCKED"&&T.from!=null&&T.to!=null).map(T=>`${T.from}:${T.to}`)),A=new Set;for(const T of this.#t.dependencies){const F=String(T.from),E=String(T.to),rt=t.rowIndex.get(F),_t=t.rowIndex.get(E);rt==null||_t==null||Math.max(rt,_t)<n.first||Math.min(rt,_t)>n.last||A.add(`${F}:${E}:${T.type?String(T.type).toUpperCase():"FS"}`)}for(const[T,F]of t.linkEls)A.has(T)||(F.remove(),t.linkEls.delete(T));for(const T of this.#t.dependencies){const F=String(T.from),E=String(T.to),rt=t.rowIndex.get(F),_t=t.rowIndex.get(E);if(rt==null||_t==null||Math.max(rt,_t)<n.first||Math.min(rt,_t)>n.last)continue;const ut=T.type?String(T.type).toUpperCase():"FS",Nt=`${F}:${E}:${ut}`;if(t.linkEls.has(Nt))continue;const Wt=this.#Di(t.schedule,t.rowIndex,t.geometry,t.x,T,c);Wt&&(t.linkEls.set(Nt,Wt),e.appendChild(Wt))}}#zr(t,e,n,c,A,T,F,E){const rt=this.#r,_t=Array.from(rt.childNodes),ut=w(this.#e,"svg",{class:`${s}__plot`,width:A,height:T,viewBox:`0 0 ${A} ${T}`,role:"img","aria-label":"Gantt timeline"}),Nt=this.#di(n,T,rt.clientHeight,rt.scrollTop);this.#gt=Nt;const{first:Wt,last:te}=Nt,ue=this.#me(),Gt=f(t,e,ue);this.#fi(ut,t,e,n,c,T,F,E,Gt,ue,Wt,te),this.#Nr(ut,c,T);const se=new Map(e.map((ee,ke)=>[ee.id,ke])),qt=w(this.#e,"g",{class:`${s}__bars`});for(let ee=Wt;ee<=te;ee+=1)qt.appendChild(this.#gi(e,n,c,A,ee));if(ut.appendChild(qt),this.#rn={plot:ut,schedule:t,rows:e,rowIndex:se,geometry:n,x:c},this.#n.showArrows&&this.#Oi(ut,t,e,se,n,c),Number.isFinite(this.#n.today)){const ee=c(this.#n.today);ut.appendChild(w(this.#e,"line",{class:`${s}__today`,x1:ee,y1:0,x2:ee,y2:T,"data-today":String(this.#n.today)}))}this.#Lr(ut,c,T),this.#n.progressLine&&Number.isFinite(this.#C)&&(this.#Vr(ut,c,T),this.#yi(ut,t,e,n,c,Wt,te)),rt.appendChild(ut);for(const ee of _t)rt.removeChild(ee);this.#z.plot=ut,this.#z.rowIndex=se,this.#z.perRow=Gt,this.#z.bars=qt,this.#z.barEls=new Map,this.#z.linkEls=new Map,this.#z.clientHeight=rt.clientHeight;for(const ee of qt.childNodes)this.#z.barEls.set(ee.getAttribute("data-task"),ee);const Qt=ut.querySelector(`.${s}__links`);if(Qt)for(const ee of Qt.childNodes)this.#z.linkEls.set(`${ee.getAttribute("data-from")}:${ee.getAttribute("data-to")}:${ee.getAttribute("data-type")}`,ee);if(this.#at){const ee=ut.querySelector(`.${s}__barrow[data-task="${this.#at}"]`);ee&&ee.focus&&ee.focus()}}#fi(t,e,n,c,A,T,F,E,rt,_t,ut,Nt){const Wt=E-F<=3660,te=w(this.#e,"g",{class:`${s}__shading`});if(Wt&&rt)for(let Gt=ut;Gt<=Nt;Gt+=1){const se=rt[Gt];if(se)for(let qt=Math.floor(F);qt<Math.ceil(E);qt+=1){if(!se(qt))continue;const Qt=A(qt),ee=A(qt+1);te.appendChild(w(this.#e,"rect",{class:`${s}__shade`,"data-task":n[Gt].id,"data-day":String(qt),x:Qt,y:c[Gt].top,width:d(Math.max(0,ee-Qt)),height:c[Gt].height}))}}else if(Wt&&_t)for(let Gt=Math.floor(F);Gt<Math.ceil(E);Gt+=1){if(!_t(Gt))continue;const se=A(Gt),qt=A(Gt+1);te.appendChild(w(this.#e,"rect",{class:`${s}__shade`,x:se,y:0,width:d(Math.max(0,qt-se)),height:T}))}const ue=t.querySelector(`.${s}__shading`);ue?t.replaceChild(te,ue):t.appendChild(te)}#gi(t,e,n,c,A){const T=t[A],F=e[A],E=T.rec,rt=this.#n.showProgress,_t=this.#n.showBaseline,ut=Math.min(18,F.height-12),Nt=F.top+(F.height-ut)/2,Wt=F.top+F.height/2,te=E.late===!0,ue=typeof this.#t.isTaskReadOnly=="function"&&this.#t.isTaskReadOnly(T.id),Gt=w(this.#e,"g",{class:`${s}__barrow${this.#w.has(T.id)?` ${s}__row--ancestor`:""}${te?` ${s}__barrow--late`:""}${ue?` ${s}__barrow--readonly`:""}`});Gt.setAttribute("data-task",T.id),Gt.setAttribute("data-y",String(F.top)),Gt.setAttribute("data-row-height",String(F.height)),te&&Gt.setAttribute("data-late","true"),Gt.setAttribute("tabindex",this.#n.keyboard?"0":"-1"),Gt.setAttribute("role",E.isSummary?"group":"button"),Gt.setAttribute("aria-label",N(E,{iso:Qt=>o(Qt),unscheduled:this.#u("gantt.unscheduled"),inactive:this.#u("gantt.inactive")})),E.inactive&&Gt.setAttribute("data-inactive","true");const se=[];if(this.#w.has(T.id)&&se.push(this.#u("gantt.row.ancestor")),ue&&se.push(this.#u("gantt.a11y.readOnly")),Pt(Gt,se.join(" ")),Gt.appendChild(w(this.#e,"rect",{class:`${s}__rowbg`,x:0,y:d(F.top),width:c,height:d(F.height),fill:"transparent"})),Gt.appendChild(w(this.#e,"line",{class:`${s}__rowsep`,x1:0,y1:d(F.top+F.height),x2:c,y2:d(F.top+F.height)})),_t&&E.baselineStart!=null&&E.baselineEnd!=null){const Qt=n(E.baselineStart),ee=Math.max(1,n(E.baselineEnd)-Qt);Gt.appendChild(w(this.#e,"rect",{class:`${s}__baseline`,x:Qt,y:d(Nt+ut),width:d(ee),height:4,rx:2}))}const qt=E.inactive?null:z(E,this.#n.barColour);if(E.unscheduled||E.inactive&&E.es==null)E.unscheduled&&Gt.setAttribute("data-unscheduled","true");else if(E.isMilestone){const Qt=n(E.es),ee=ut/2,ke=w(this.#e,"path",{class:`${s}__milestone${E.inactive?` ${s}__milestone--inactive`:""}${ue?` ${s}__milestone--readonly`:""}`,d:g(["M",d(Qt-ee),d(Wt),"L",d(Qt),d(Wt-ee),"L",d(Qt+ee),d(Wt),"L",d(Qt),d(Wt+ee),"Z"])});qt&&(ke.style.fill=qt),Gt.appendChild(ke)}else if(E.isSummary){const Qt=n(E.es),ee=Math.max(2,n(E.ef)-Qt),ke=this.#Ni(E,ee),ge=`${s}__summary-bar${E.inactive?` ${s}__summary-bar--inactive`:""}`;if(ke&&ke.inside){const Ae=w(this.#e,"rect",{class:ge,x:Qt,y:d(Nt),width:d(ee),height:d(ut),rx:3});qt&&(Ae.style.fill=qt),Gt.appendChild(Ae)}else{const Ae=w(this.#e,"rect",{class:ge,x:Qt,y:d(Nt+ut/3),width:d(ee),height:d(ut/3),rx:1}),Ce=w(this.#e,"path",{class:ge,d:g(["M",d(Qt),d(Nt+ut/3),"L",d(Qt),d(Nt+ut),"L",d(Qt+5),d(Nt+ut/3),"Z"])}),Oe=w(this.#e,"path",{class:ge,d:g(["M",d(Qt+ee),d(Nt+ut/3),"L",d(Qt+ee),d(Nt+ut),"L",d(Qt+ee-5),d(Nt+ut/3),"Z"])});qt&&(Ae.style.fill=qt,Ce.style.fill=qt,Oe.style.fill=qt),Gt.appendChild(Ae),Gt.appendChild(Ce),Gt.appendChild(Oe)}this.#Li(Gt,ke,Qt,ee,Wt,Nt,ut,!0,qt)}else{const Qt=n(E.es),ee=Math.max(1,n(E.ef)-Qt),ge=this.#n.showCritical&&E.critical?this.#n.criticalStyle==="outline"?`${s}__bar--critical-outline`:`${s}__bar--critical`:"",Ae=this.#q.has(String(E.id)),Ce=this.#O.has(String(E.id)),Oe=w(this.#e,"rect",{class:`${s}__bar${ge?` ${ge}`:""}${Ae?` ${s}__bar--overalloc`:""}${Ce?` ${s}__bar--conflict`:""}${te?` ${s}__bar--late`:""}${E.inactive?` ${s}__bar--inactive`:""}${ue?` ${s}__bar--readonly`:""}`,x:Qt,y:d(Nt),width:d(ee),height:d(ut),rx:3});if(qt&&(Oe.style.fill=qt),Gt.appendChild(Oe),rt&&E.percentComplete!=null&&E.percentComplete>0){const $e=w(this.#e,"rect",{class:`${s}__progress`,x:Qt,y:d(Nt),width:d(ee*Math.min(1,E.percentComplete/100)),height:d(ut),rx:3});qt&&($e.style.fill=at(qt)),Gt.appendChild($e)}this.#Li(Gt,this.#Ni(E,ee),Qt,ee,Wt,Nt,ut,!1,qt),this.#n.editable&&(ue||Pt(Gt,[Gt.getAttribute("aria-description"),this.#u("gantt.a11y.startEdge")].filter(Boolean).join(" ")),Gt.appendChild(gt(this.#e,{ns:s,id:T.id,x0:Qt,barY:Nt,barH:ut,title:this.#u("gantt.resize.startHandle",{name:E.name})})),Gt.appendChild(J(this.#e,{ns:s,id:T.id,x0:Qt,w:ee,barY:Nt,barH:ut,percent:E.percentComplete||0,title:this.#u("gantt.progress.handle",{name:E.name})})))}if(this.#n.editable&&!E.isSummary&&!E.unscheduled){const Qt=E.isMilestone?n(E.es)-ut/2-2:n(E.es)-2,ee=E.isMilestone?n(E.es)+ut/2+2:n(E.ef)+2;Gt.appendChild(this.#pi(Qt,Wt,T.id,"start")),Gt.appendChild(this.#pi(ee,Wt,T.id,"finish"))}if(E.deadline!=null&&Number.isFinite(E.deadline)){const Qt=n(E.deadline),ee=F.top+2,ke=Nt+ut;Gt.appendChild(w(this.#e,"line",{class:`${s}__deadline`,x1:Qt,y1:ee,x2:Qt,y2:ke,"data-deadline":String(E.deadline)}));const ge=3;Gt.appendChild(w(this.#e,"path",{class:`${s}__deadline-glyph`,d:g(["M",d(Qt-ge),d(ee),"L",d(Qt+ge),d(ee),"L",d(Qt),d(ee+ge*1.6),"Z"])}))}return Gt}#pi(t,e,n,c){const A=w(this.#e,"g",{class:`${s}__connector`,"data-task":n,"data-end":c,cx:d(t),cy:d(e),"aria-hidden":"true"});return A.appendChild(w(this.#e,"circle",{class:`${s}__connector-hit`,cx:d(t),cy:d(e),r:3,fill:"transparent"})),A.appendChild(w(this.#e,"circle",{class:`${s}__connector-dot`,cx:d(t),cy:d(e),r:3})),A}#Hr(t){if(this.#L.dragging||!this.#H)return;const e=t.target,n=e&&e.closest?e.closest(`.${s}__barrow`):null,c=n?n.getAttribute("data-task"):null,A=this.#t.schedule,T=c&&A&&A.ok?A.tasks.get(c):null;if(!T||!this.#Wr(e)){this.#de();return}this.#mi(n,T,t)}#Wr(t){return!t||typeof t.closest!="function"?!1:!!(t.closest(`.${s}__bar`)||t.closest(`.${s}__progress`)||t.closest(`.${s}__milestone`)||t.closest(`.${s}__summary-bar`))}#Ur(t){if(this.#L.dragging||!this.#H)return;const e=t.target,n=e&&e.closest?e.closest(`.${s}__barrow`):null,c=n?n.getAttribute("data-task"):null,A=this.#t.schedule,T=c&&A&&A.ok?A.tasks.get(c):null;T&&this.#mi(n,T,t)}#mi(t,e,n=null){const c=this.#he&&this.#he.get(String(e.id))||null,A=_e(this.#e,s,e,c,this.#n.tooltip,this.#Gr());if(!A){this.#de();return}if(this.#ee!==e.id){if(!ht(this.#t,this,e.id,A.text,n)){this.#de();return}this.#ee=e.id}for(const T of[...this.#H.children])T!==this.#ie&&this.#H.removeChild(T);if(A.node)this.#H.appendChild(A.node);else{const T=k(this.#e,"div",`${s}__tip-card`);u(T,A.text),this.#H.appendChild(T)}this.#H.removeAttribute("hidden"),this.#H.setAttribute("data-task",e.id),this.#mt&&this.#mt!==t&&et(this.#mt),t.setAttribute("aria-description",A.text),this.#mt=t,t===this.#ot&&this.#Bn(t),this.#Kr(t)}#Gr(){const t=this.#t.resourceNames;return{t:this.#u,formatDate:e=>this.#bi(e),dateAxis:!0,resourceName:e=>t.get(e)??e}}#bi(t){const e=a(t);if(!e)return"";try{return new Intl.DateTimeFormat(this.#ye(),{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(e)}catch{return o(t)||""}}#ye(){if(typeof this.#n.locale=="string"&&this.#n.locale)return this.#n.locale;const t=this.#n.gridConfig;if(t&&typeof t.locale=="string"&&t.locale)return t.locale;const e=this.#t.grid,n=e&&e.messages;return n&&n.locale||void 0}#ue(){const t=Zi(this.#n.weekStartDay)??this.#t[Nn];return Yi(t,this.#ye())}#Kr(t){if(!this.#H||!this.#a)return;const e=t.querySelector(`.${s}__bar`)||t.querySelector(`.${s}__milestone`)||t.querySelector(`.${s}__summary-bar`);if(!e||typeof e.getBoundingClientRect!="function")return;const n=e.getBoundingClientRect(),c=this.#a.getBoundingClientRect(),A=this.#e.defaultView||globalThis,T=Number.isFinite(A.innerWidth)?A.innerWidth:1/0,F=Number.isFinite(A.innerHeight)?A.innerHeight:1/0,E={left:Math.max(0,c.left),top:Math.max(0,c.top),right:Math.min(T,c.right),bottom:Math.min(F,c.bottom)};Me(this.#H,this.#ie,n,E,c)}#de(){if(this.#H){if(this.#H.setAttribute("hidden",""),this.#mt){const t=this.#mt;et(t),this.#mt=null,t===this.#ot&&this.#Bn(t)}if(this.#ee!=null){const t=this.#ee;this.#ee=null,Ot(this.#t,this,t,null)}}}#Vr(t,e,n){const c=this.#C,A=e(c);t.appendChild(w(this.#e,"line",{class:`${s}__progressline`,x1:d(A),y1:0,x2:d(A),y2:d(n),"data-status":String(c),"data-status-x":d(A)}))}#yi(t,e,n,c,A,T,F){const E=w(this.#e,"g",{class:`${s}__progressjogs`}),rt=this.#C,_t=A(rt),ut=this.#n.calendar?i(this.#n.calendar,e.projectStart):null;for(let Wt=T;Wt<=F;Wt+=1){const te=n[Wt];if(te.rec.isSummary||te.rec.unscheduled||te.rec.es==null)continue;const ue=c[Wt],Gt=ue.top+ue.height/2,se=A(this.#wr(te.rec,ut));E.appendChild(w(this.#e,"line",{class:`${s}__progressline`,x1:d(_t),y1:d(Gt),x2:d(se),y2:d(Gt),"data-task":te.id,"data-status-x":d(_t),"data-progress-x":d(se)})),E.appendChild(w(this.#e,"circle",{class:`${s}__progressline--dot`,cx:d(se),cy:d(Gt),r:2.5,"data-task":te.id,"data-progress-x":d(se)}))}const Nt=t.querySelector(`.${s}__progressjogs`);Nt?t.replaceChild(E,Nt):t.appendChild(E)}#ut(t,e){if(!this.#Ht||!t)return;if(!!!(e&&e.repeat)){if(t===this.#wn)return;this.#wn=t,u(this.#Ht,t);return}this.#wn=t,u(this.#Ht,""),u(this.#Ht,t)}#Yr(){const t=this.#n.workload;if(t==null||t===!1)return null;const e=t&&typeof t=="object"?t:{},n={...yt,...e},c=Number(this.#t.hoursPerDay),A=Number.isFinite(c)&&c>0?c:yt.hoursPerDay;return n.hoursPerDay=e.hoursPerDay!=null&&Number.isFinite(Number(e.hoursPerDay))&&Number(e.hoursPerDay)>0?Number(e.hoursPerDay):A,n.rowHeight=Math.max(16,Number(n.rowHeight)||yt.rowHeight),n.height=Math.max(n.rowHeight,Number(n.height)||yt.height),n.maxHeight=Number.isFinite(Number(e.maxHeight))&&Number(e.maxHeight)>0?Number(e.maxHeight):null,n.totals=n.totals!==!1,n.unit=ni.has(e.unit)?e.unit:"hours",n.thresholds=Lt(e.thresholds),n.showUnassigned=e.showUnassigned!==!1,n.external=Zt(e.external,0),n.labelWidth=Number.isFinite(Number(e.labelWidth))&&Number(e.labelWidth)>0?Number(e.labelWidth):null,n.tooltip=e.tooltip===void 0?!0:e.tooltip,n.groupBy=Dt(e.groupBy),n}#Zr(){const t=this.#n.histogram;if(t==null||t===!1)return null;const e=t&&typeof t=="object"?t:{},n={...tt,...e};return n.resources=Array.isArray(n.resources)&&n.resources.length?n.resources.map(c=>String(c)):null,n.unit=ni.has(n.unit)?n.unit:"hours",n.stacked=n.stacked==="task"?"task":!1,n.rowHeight=Math.max(16,Number(n.rowHeight)||tt.rowHeight),n.height=Math.max(n.rowHeight,Number(n.height)||tt.height),n.collapsed=!1,n.maxHeight=Number.isFinite(Number(e.maxHeight))&&Number(e.maxHeight)>0?Number(e.maxHeight):null,n.labelWidth=Number.isFinite(Number(e.labelWidth))&&Number(e.labelWidth)>0?Number(e.labelWidth):null,n}#ki(){const t=this.#n.height;if(Number.isFinite(t)){this.#et=Number(t),this.#a.style.height=`${this.#et}px`,this.#a.style.maxHeight="";return}if(this.#ft){const e=Qn(this.#i);this.#et=Number.isFinite(e)?Math.round(e):null,this.#a.style.height=this.#et==null?"100%":`${this.#et}px`,this.#a.style.maxHeight=""}else this.#et=null,this.#a.style.height="",this.#a.style.maxHeight=`${un}px`}#Xr(){Number.isFinite(this.#n.height)||this.#ft&&(this.#Lt=oi({targets:[this.#i],read:()=>Qn(this.#i),apply:()=>{this.#ki(),this.#wi(),this.#z&&this.draw()}}))}#qr(){if(Number.isFinite(this.#n.height)||this.#ft)return;const t=this.#r;if(!t)return;this.#a.style.height="";const e=t.offsetHeight,n=t.scrollHeight;e>n&&(this.#a.style.height=`${this.#a.offsetHeight-(e-n)}px`)}#wi(){if(this.#n.resourceOnly)return;const t=this.#et;if(!Number.isFinite(t))return;const e=this.#b?this.#b.height:0,n=this.#S?this.#S.height:0,c=e+n;if(c<=0)return;const A=Math.max(0,Math.floor(t-t*li)-4);if(c<=A)return;const T=A/c;let F=Math.round(e*T),E=Math.round(n*T);const rt=this.#S?this.#S.rowHeight+Mi:0;if(this.#S&&E<rt){const _t=Math.ceil((e+rt)/(1-li));me("gantt-histogram-squeeze",`[lattice] gantt: the histogram band needs the split view at least ${_t}px tall to show its bars alongside the workload band (it is ${t}px); showing its header only until there is room.`),this.#S.collapsed=!0,E=this.#S.rowHeight,F=Math.min(e,Math.max(0,A-E))}this.#b&&(this.#b.height=Math.max(this.#b.rowHeight,F)),this.#S&&(this.#S.height=Math.max(this.#S.rowHeight,E))}#Jr(){return this.#b?this.#b.hoursPerDay:yt.hoursPerDay}#Qr(){return this.#b?this.#b.external:[]}#vi(t){if(!t)return 0;if(t.collapsed)return t.rowHeight;if(t.maxHeight!=null){const e=Number.isFinite(t.contentHeight)?t.contentHeight:t.height;return Math.min(Math.max(e,t.rowHeight),t.maxHeight)}return t.height}#ts(){if(this.#n.resourceOnly)return;const t=this.#et;if(!Number.isFinite(t))return;const e=this.#b,n=this.#S;if(!(e&&e.maxHeight!=null||n&&n.maxHeight!=null))return;const c=Math.max(0,Math.floor(t-t*li)-4),A=e?this.#vi(e):0,T=n?this.#vi(n):0,F=A+T;let E=A,rt=T;if(F>c){const _t=c/F;E=Math.round(A*_t),rt=Math.round(T*_t)}e&&(e.height=Math.max(e.rowHeight,E),this.#R&&(this.#R.style.flex=`0 0 ${e.height}px`)),n&&(n.height=Math.max(n.rowHeight,rt),this.#I&&(this.#I.style.flex=`0 0 ${n.height}px`))}#es(){const t=this.#b;this.#R=k(this.#e,"div",`${s}__wl`),this.#R.style.flex=this.#n.resourceOnly?"1 1 auto":`0 0 ${t.height}px`,this.#R.setAttribute("role","table"),this.#R.setAttribute("aria-label",this.#u("gantt.workload.title")),this.#bt=k(this.#e,"div",`${s}__wl-head`),this.#bt.style.height=`${t.rowHeight}px`,this.#bt.appendChild(k(this.#e,"div",`${s}__wl-cell ${s}__wl-cell--name`)),t.totals&&this.#bt.appendChild(k(this.#e,"div",`${s}__wl-cell ${s}__wl-cell--total`)),this.#bt.appendChild(k(this.#e,"div",`${s}__divider`));const e=k(this.#e,"div",`${s}__wl-head-spacer`);if(e.appendChild(this.#Si()),this.#bt.appendChild(e),this.#R.appendChild(this.#bt),this.#ct){this.#a.appendChild(this.#R);return}const n=k(this.#e,"div",`${s}__wl-body`);this.#Et=k(this.#e,"div",`${s}__wl-grid`),this.#Et.style.width=`${this.#Z()}px`,this.#v=k(this.#e,"div",`${s}__wl-time`),n.appendChild(this.#Et),n.appendChild(k(this.#e,"div",`${s}__divider`)),n.appendChild(this.#v),this.#R.appendChild(n),this.#a.appendChild(this.#R),this.#Te=()=>this.#Pt(this.#v),this.#v.addEventListener("scroll",this.#Te),this.#W=k(this.#e,"div",`${s}__wl-tooltip`),this.#W.setAttribute("hidden",""),this.#R.appendChild(this.#W),this.#Oe=c=>this.#Ds(c),this.#v.addEventListener("dblclick",this.#Oe),this.#Ee=c=>this.#Ps(c),this.#v.addEventListener("click",this.#Ee),this.#De=c=>this.#Rs(c),this.#v.addEventListener("contextmenu",this.#De),this.#Pe=c=>this.#Gi(c),this.#v.addEventListener("pointerover",this.#Pe),this.#je=c=>this.#Ki(c),this.#v.addEventListener("pointerout",this.#je),this.#Ne=c=>this.#Gi(c),this.#v.addEventListener("focusin",this.#Ne),this.#Le=c=>this.#Ki(c),this.#v.addEventListener("focusout",this.#Le),this.#Wn=c=>this.#Bs(c),this.#v.addEventListener("keydown",this.#Wn),this.#Ie=c=>this.#zs(c),this.#Et.addEventListener("click",this.#Ie)}#Pt(t){if(this.#Sn||!t)return;this.#Sn=!0;const e=t.scrollLeft,n=this.#$?this.#$.viewport():this.#v;for(const c of[this.#y,this.#r,n,this.#_,...this.#o?this.#o.panes():[],...this.#h?this.#h.panes():[]])c&&c!==t&&c.scrollLeft!==e&&(c.scrollLeft=e);this.#Sn=!1,this.#tt&&this.#tt.note(),this.#st&&this.#st.note()}#mn(t){if(this.#kt||!t)return;this.#kt=!0;const e=t.scrollTop;for(const n of[this.#c,this.#r])n&&n!==t&&n.scrollTop!==e&&(n.scrollTop=e);this.#kt=!1,this.#st&&this.#st.note()}#ns(t){!t||!this.#d||this.#d.scrollLeft!==t.scrollLeft&&(this.#d.scrollLeft=t.scrollLeft)}#_i(){const t=new Map,e=this.#t.resourceModels;if(e instanceof Map)for(const[c,A]of e)A&&Number.isFinite(A.capacityUnits)&&A.capacityUnits>0&&t.set(c,A.capacityUnits);const n=this.#t.resourceLoad;if(n&&n.byResource instanceof Map)for(const[c,A]of n.byResource)A&&Number.isFinite(A.capacity)&&t.set(c,A.capacity);return t}#Si(){const t=this.#e.createElement("button");t.setAttribute("type","button"),t.setAttribute("class",`${s}__unit-toggle`);const e=this.getWorkloadUnit();return t.setAttribute("aria-pressed",e==="hours"?"false":"true"),t.setAttribute("data-unit",e),u(t,this.#u("gantt.workload.unitToggle")),t.addEventListener("click",()=>this.setWorkloadUnit(Bi[this.getWorkloadUnit()])),this.#sn=t,t}#is(t,e,n,c,A,T,F){const E=this.#b;if(!E||!this.#bt)return;const rt=this.#me(),_t=It(e.level,Math.floor(n),Math.ceil(c),this.#ue()),ut=this.#t.resourceModels,Nt=Mt(this.#t.tasks,t,{buckets:_t,hoursPerDay:E.hoursPerDay,isWorking:rt?Ce=>!rt(Ce):null,capacities:this.#_i(),resourceModels:ut,resourceRates:this.#t.resourceRates,external:E.external}),Wt=this.#Zn(E),te=Math.max(0,this.#Z()-Wt),ue=this.#bt.querySelectorAll(`.${s}__wl-cell`);ue[0]&&(ue[0].style.width=`${Wt}px`,ue[0].style.flex=`0 0 ${Wt}px`,u(ue[0],this.#u("gantt.workload.resource"))),ue[1]&&(ue[1].style.width=`${te}px`,ue[1].style.flex=`0 0 ${te}px`,u(ue[1],this.#u("gantt.workload.total")));const Gt=E.showUnassigned?Nt.rows.slice():Nt.rows.filter(Ce=>Ce.resource!=null),se=It(e.level,Math.floor(n),Math.ceil(A),this.#ue()).map(Ce=>({...Ce,workingDays:0}));this.#B={buckets:se,rows:Gt};const qt=[],Qt=!!E.groupBy,ee=Ce=>{const Oe=Ce.resource==null?"":Ce.resource,$e=Ce.resource==null?this.#u("gantt.workload.unassigned"):this.#it(Ce.resource),Ye=this.#n.resourceOnly?oe(Ce.tasks||[]):Ce.tasks||[],Je=this.#fe.has(Oe);if(qt.push({key:Oe,label:$e,cells:Ce.cells,over:Ce.over,capacity:Ce.capacity,available:Ce.available,availableTotal:Ce.availableTotal,total:Ce.total,costCells:Ce.costCells,costTotal:Ce.costTotal,isTotal:!1,taskId:null,toggle:Ye.length?{expanded:Je,name:$e}:null,depth:Qt?1:null,src:Ce}),!!Je)for(const tn of Ye){const Te=tn.name!=null?tn.name:this.#u("gantt.workload.external");qt.push({key:Oe,label:tn.loadOnly&&!this.#n.resourceOnly?this.#u("gantt.workload.otherProjectLabel",{name:Te}):Te,cells:tn.cells,over:tn.cells.map(()=>!1),capacity:null,available:Ce.available,availableTotal:Ce.availableTotal,total:tn.total,costCells:null,costTotal:null,isTotal:!1,taskId:String(tn.id),toggle:null,loadOnly:!!tn.loadOnly,external:!!tn.external,group:tn.group??null,depth:Qt?2:null,src:Ce,sub:tn})}};if(Qt){const Ce=this.#t.resourceSpecs,Oe=Ut(Gt,$e=>$e==null?null:zt(E.groupBy,{...Ce.get($e)||{},key:$e,name:this.#it($e)}));for(const $e of Oe){const Ye=$e.value==null?this.#u("gantt.workload.ungrouped"):$e.value,Je=!this.#Fe.has($e.key);qt.push({key:$e.key,label:Ye,cells:$e.cells,over:$e.over,capacity:null,available:$e.available,availableTotal:$e.availableTotal,total:$e.total,costCells:$e.costCells,costTotal:$e.costTotal,isTotal:!1,isGroup:!0,taskId:null,toggle:{expanded:Je,name:Ye},depth:0}),Je&&$e.rows.forEach(ee)}}else Gt.forEach(ee);if(E.totals&&qt.push({key:"__total__",label:this.#u("gantt.workload.total"),cells:Nt.totals,over:Nt.totals.map(()=>!1),capacity:null,available:Nt.totalsAvailable,availableTotal:Nt.grandAvailableTotal,total:Nt.grandTotal,costCells:Nt.totalsCost,costTotal:Nt.grandCostTotal,isTotal:!0,taskId:null,toggle:null,depth:Qt?0:null}),E.contentHeight=(qt.length+1)*E.rowHeight,this.#ct){const Ce=this.#fs(qt,E,Wt,se,T),Oe=this.#$.grid,$e=this.#En(Oe,null),Ye=new Set(se.map(Ie=>o(Ie.start))),Je=[],tn=[],Te=[];$e.visible.forEach((Ie,Ue)=>{Ye.has(String(Ie.id))||(Je.push(Ue),tn.push($e.columns[Ue]),Te.push($e.columnWidths[Ue]))}),this.#B.grid={columns:tn,columnWidths:Te,rows:Ce.map((Ie,Ue)=>({label:Ie.label,cells:Ie.cells,over:Ie.over,taskId:Ie.taskId,texts:Je.map(Pi=>this.#Tn(Oe,this.#Mn(Ie),$e.visible[Pi],Ue))}))};return}const ke=this.#Et,ge=this.#v;for(;ke.firstChild;)ke.removeChild(ke.firstChild);for(;ge.firstChild;)ge.removeChild(ge.firstChild);const Ae=k(this.#e,"div",`${s}__wl-plot`);Ae.style.width=`${F}px`,Ae.style.height=`${qt.length*E.rowHeight}px`;for(const Ce of qt)this.#ps(ke,Ae,Ce,se,T,Wt,te,E);ge.appendChild(Ae),this.#r&&(ge.scrollLeft=this.#r.scrollLeft)}#rs(t,e){if(!e.totals)return"";if(e.unit==="percent"&&t.availableTotal!=null){const n=Xt(t.total,t.availableTotal,e.decimals);return n==="–"?n:`${n}%`}return e.unit==="cost"&&t.costTotal!=null?Vt(t.costTotal,e.decimals):Rt(t.total,e.decimals)}#ss(t,e){const n=new Map,c=A=>this.#as(A);return this.#ge.add(c),n.set("resource",{id:"resource",field:"resource",title:this.#u("gantt.workload.resource"),layout:{width:e,min:Kt,movable:!1},edit:{enabled:!1},cell:{render:c}}),t.totals&&n.set("total",{id:"total",field:"total",title:this.#u("gantt.workload.total"),type:"number",layout:{flex:1},edit:{enabled:!1},cell:{render:A=>String((A&&A.row&&A.row.data||{}).__totalText??"")}}),n}#os(t,e,n){const c=o(t.start);return _i({id:c,width:e,cell:{align:"right",class:A=>this.#jn(A&&A.row&&A.row.data||{},c).classes,style:A=>this.#jn(A&&A.row&&A.row.data||{},c).style,render:A=>this.#jn(A&&A.row&&A.row.data||{},c).text},edit:null})}#jn(t,e){const n=t&&t.__wl?t.__wl:null,c=this.#b,A=[`${s}__wl-bucket`],T={};if(!n||!c)return{text:"",classes:A,style:T};const F=this.#pe?this.#pe.get(String(e)):null;if(F==null)return{text:"",classes:A,style:T};const E=n.taskId!=null&&!!this.#n.editable&&!n.loadOnly,rt=Array.isArray(n.cells)?n.cells[F]:null,_t=Array.isArray(n.available)?n.available[F]:null,ut=Array.isArray(n.costCells)?n.costCells[F]:null;c.unit!=="cost"&&Array.isArray(n.over)&&n.over[F]&&A.push(`${s}__wl-bucket--over`),E&&A.push(`${s}__wl-bucket--editable`),n.loadOnly&&A.push(`${s}__wl-bucket--loadonly`);const Wt=ne(c.thresholds,_t!=null?(rt??0)/_t:null);Wt&&(Wt.className&&A.push(Wt.className),Wt.colour&&(T.backgroundColor=Wt.colour));const te=c.unit==="percent"&&_t!=null,ue=c.unit==="cost"&&n.costCells!=null,Gt=rt==null&&!(te&&!(_t>0));return{text:te?Gt?"":(()=>{const qt=Xt(rt,_t,c.decimals);return qt==="–"?qt:`${qt}%`})():ue?Vt(ut,c.decimals):Rt(rt,c.decimals),classes:A,style:T}}#as(t){const e=t&&t.row&&t.row.data||{},n=k(this.#e,"span",`${s}__lgrid-name`),c=e.__depth!=null?Math.max(0,Number(e.__depth)||0):e.__taskId!=null?1:0;c&&(n.style.paddingLeft=`${c*(this.#n.indent||16)}px`);const A=String(e.resource??"");if(!e.__isTotal&&!e.__isGroup&&e.__taskId==null&&e.__resourceKey&&n.appendChild(P(this.#e,{name:A,avatar:this.#t.resourceAvatars.get(e.__resourceKey),cssGlyph:!0})),e.__toggle){const F=this.#e.createElement("button");F.setAttribute("class",`${s}__wl-toggle`),F.setAttribute("type","button"),F.setAttribute("aria-expanded",e.__toggle.expanded?"true":"false");const E=e.__toggle.expanded?"collapse":"expand";F.setAttribute("aria-label",this.#u(`gantt.workload.${E}${e.__isGroup?"Group":""}`,{name:e.__toggle.name})),F.addEventListener("click",rt=>{rt&&rt.stopPropagation&&rt.stopPropagation(),this.toggleResource(e.__resourceKey,{event:rt})}),n.appendChild(F)}const T=k(this.#e,"span",`${s}__wl-name-text${e.__isGroup?` ${s}__wl-group-name`:""}`);return u(T,A),T.setAttribute("title",A),n.appendChild(T),n}#$i(t,e){const n=[];return this.#Un[e]=n,Array.isArray(t)?t.map(c=>{if(!c||typeof c!="object"||Array.isArray(c))return c;const A=typeof c.value=="function",T=typeof c.render=="function",{value:F,render:E,subRows:rt,align:_t,...ut}=c,Nt={...ut.cell&&typeof ut.cell=="object"?ut.cell:{},..._t!=null?{align:_t}:{}};if(!A&&!T)return{...ut,...F!==void 0?{value:F}:{},...E!==void 0?{render:E}:{},cell:Nt};const Wt=String(ut.id??ut.key);return n.push({id:Wt,value:A?F:null,subRows:rt??"blank"}),{...ut,id:Wt,field:Wt,cell:T?{...Nt,render:te=>this.#cs(te,E,rt==="inherit")}:Nt}}):t}#ls(t){return{...t==null?{}:this.#t.resourceSpecs.get(t)||{},key:t??"",name:t==null?this.#u("gantt.workload.unassigned"):this.#it(t)}}#xi(t,e,n,c){const A=this.#Un[t]||[],T={};if(!e)return T;const F=e.resource==null?null:e.resource,E=Array.isArray(e.over)?e.over:[],rt={band:t,unit:c.unit,capacity:e.capacity??null,total:e.total,cost:e.costTotal??null,available:e.availableTotal??null,cells:e.cells,over:E,overCount:E.filter(Boolean).length,tasks:e.tasks||[],task:n},_t=this.#ls(F);T.__ctx={resource:_t,ctx:rt};for(const ut of A){let Nt=null;try{n==null||ut.subRows==="inherit"?Nt=ut.value?ut.value(_t,rt):null:typeof ut.subRows=="function"&&(Nt=ut.subRows(n,_t,rt))}catch{Nt=null}T[ut.id]=Nt===void 0?null:Nt}return T}#cs(t,e,n){const c=t&&t.row&&t.row.data||{},A=c.__ctx;if(!A||c.__taskId!=null&&!n){const F=t&&t.value;return F==null?"":String(F)}let T=null;try{T=e(A.resource,A.ctx)}catch{T=null}return T==null?"":typeof T=="object"?T:String(T)}#us(t){const e=t&&t.row&&t.row.data||{},n=k(this.#e,"span",`${s}__hg-name-text`),c=String(e.resource??"");return u(n,c),n.setAttribute("title",c),n}#ds(t,e,n,c,A,T=!1){const F=k(this.#e,"div",`${s}__lgrid ${s}__lgrid--${A}`);F.style.bottom="0px",t.appendChild(F);const E=new ui({createGrid:this.#ct,host:F,columns:n,rowHeight:c.rowHeight,headerHeight:c.headerHeight||c.rowHeight,config:this.#kn({},"band"),treeSort:T});this.#qe.push(fi(F,A==="workload"?this.#bt:this.#Ot,c.rowHeight));const rt=t.querySelector(`.${e}`);rt&&E.lockScroll(rt);const _t=()=>{this.#Dt||this.draw()};return E.on("sort:changed",_t),E.on("filter:changed",_t),E.on("column:resized",ut=>{ut&&ut.colId!=null&&this.#be(`${A==="workload"?"band":"histogram"}:${ut.colId}`,ut.width)}),this.#_e(A,E),E}#Ci(t){if(!t||typeof t!="object")return t;const e=this.#pe,n=A=>!!(e&&A!=null&&e.has(String(A))),c={...t};return Array.isArray(c.columns)&&(c.columns=c.columns.filter(A=>!(A&&n(A.id)))),Array.isArray(c.columnOrder)&&(c.columnOrder=c.columnOrder.filter(A=>!n(A))),c}#hs(t,e){const n=this.#$?this.#$.getState():null;this.#$&&(this.#$.destroy(),this.#$=null),this.#le&&(this.#le(),this.#le=null),this.#ce&&(this.#ce.dispose(),this.#ce=null),this.#ln=null,this.#cn=null,this.#un=null,this.#dn=null,this.#hn=null,this.#fn=null,this.#gn=null;const c=k(this.#e,"div",`${s}__lgrid ${s}__lgrid--workload`);c.style.bottom="0px",c.style.width="100%",this.#R.appendChild(c),this.#Kn=c;const A=this.#kn({},"band"),T=A.rowClass;A.rowClass=rt=>{const _t=typeof T=="function"?T(rt):T||[],ut=Array.isArray(_t)?_t.slice():[_t],Nt=rt&&rt.data||{};return Nt.__isTotal?ut.push(`${s}__wl-row--total`):Nt.__isGroup?ut.push(`${s}__wl-row--group`):Nt.__taskId!=null&&ut.push(`${s}__wl-row--task`),Nt.__wl&&Nt.__wl.loadOnly&&ut.push(`${s}__wl-row--loadonly`),ut.filter(Boolean)},this.#$=new ui({createGrid:this.#ct,host:c,columns:t,rowHeight:e.rowHeight,headerHeight:e.headerHeight||e.rowHeight,config:A,treeSort:!0}),this.#qe.push(this.#ce=fi(c,this.#bt,e.rowHeight));const F=this.#$.viewport();if(F){const rt=()=>this.#Pt(F);F.addEventListener("scroll",rt),this.#le=()=>F.removeEventListener("scroll",rt)}this.#ln=rt=>this.#Ns(rt),this.#cn=rt=>this.#Ls(rt),this.#un=rt=>this.#Is(rt),this.#dn=rt=>this.#Hi(rt),this.#hn=rt=>this.#Wi(rt),this.#fn=rt=>this.#Hi(rt),this.#gn=rt=>this.#Wi(rt),c.addEventListener("click",this.#ln,!0),c.addEventListener("dblclick",this.#cn,!0),c.addEventListener("contextmenu",this.#un,!0),c.addEventListener("pointerover",this.#dn,!0),c.addEventListener("pointerout",this.#hn,!0),c.addEventListener("focusin",this.#fn,!0),c.addEventListener("focusout",this.#gn,!0);const E=()=>{this.#Dt||this.draw()};this.#$.on("sort:changed",E),this.#$.on("filter:changed",E),this.#$.on("column:resized",rt=>{rt&&rt.colId!=null&&this.#be(`band:${rt.colId}`,rt.width)}),n?this.#$.setState(this.#Ci(n)):this.#_e("workload",this.#$)}#fs(t,e,n,c,A){const T=`${this.#Z()}|${c.length}|${c.length?c[0].start:0}|${c.length?c[c.length-1].start:0}`;if(!this.#$||T!==this.#Gn){const ut=di(this.#$i(e.columns,"workload"),this.#ss(e,n),e.totals?["resource","total"]:["resource"],"resource");Ni(ut,this.#Z(),e.totals?"total":"resource",{minFill:Kt,floor:Kt,defaultWidth:()=>Dn}),this.#pe=new Map(c.map((te,ue)=>[o(te.start),ue]));const Nt=ji(c,A),Wt=c.map((te,ue)=>this.#os(te,Nt[ue],e));this.#Gn=T,this.#hs([...ut,...Wt],e)}this.#$.host.style.width="100%";const F=new Map,E=t.map(ut=>{const Nt=this.#Mn(ut);F.set(Nt,e.rowHeight);const Wt={__key:Nt,__resourceKey:ut.key,__taskId:ut.taskId,__toggle:ut.toggle,__isTotal:ut.isTotal,__isGroup:!!ut.isGroup,...ut.depth!=null?{__depth:ut.depth}:{},__pinLast:!!ut.isTotal,__totalText:this.#rs(ut,e),__wl:ut,resource:ut.label,total:ut.total,capacity:ut.capacity,cost:ut.costTotal,...this.#xi("workload",ut.isTotal?null:ut.src,ut.sub||null,e)};for(let te=0;te<c.length;te++)Wt[o(c[te].start)]=ut.cells?ut.cells[te]:null;return Wt});this.#Dt=!0;try{this.#$.setRows(E,F)}finally{this.#Dt=!1}const rt=new Map(t.map(ut=>[this.#Mn(ut),ut])),_t=this.#$.displayedKeys().map(ut=>rt.get(ut)).filter(Boolean);return[..._t.filter(ut=>!ut.isTotal),..._t.filter(ut=>ut.isTotal)]}#gs(t,e,n,c){if(!this.#K){const E=ut=>this.#us(ut);this.#ge.add(E);const rt=new Map([["resource",{id:"resource",field:"resource",title:this.#u("gantt.histogram.resource"),layout:{width:c,min:Kt,movable:!1},edit:{enabled:!1},cell:{render:E}}]]),_t=di(this.#$i(n.columns,"histogram"),rt,["resource"],"resource");this.#K=this.#ds(this.#I,`${s}__hg-body`,_t,n,"histogram")}this.#K.host.style.width=`${this.#Z()}px`;const A=new Map,T=t.map(E=>{const rt=E??"",_t=e.get(rt)||{};return A.set(rt,n.rowHeight),{__key:rt,resource:E==null?this.#u("gantt.workload.unassigned"):this.#it(E),total:_t.total,capacity:_t.capacity,...this.#xi("histogram",_t.resource===void 0?{..._t,resource:E}:_t,null,n)}});this.#Dt=!0;try{this.#K.setRows(T,A)}finally{this.#Dt=!1}const F=new Map(t.map(E=>[E??"",E]));return this.#K.displayedKeys().filter(E=>F.has(E)).map(E=>F.get(E))}#ps(t,e,n,c,A,T,F,E){const rt=n.taskId!=null,_t=rt&&!!this.#n.editable&&!n.loadOnly,ut=k(this.#e,"div",`${s}__wl-row${n.isTotal?` ${s}__wl-row--total`:""}${n.isGroup?` ${s}__wl-row--group`:""}${rt?` ${s}__wl-row--task`:""}${n.loadOnly?` ${s}__wl-row--loadonly`:""}`);ut.style.height=`${E.rowHeight}px`,ut.setAttribute("role","row"),ut.setAttribute("data-resource",n.key),rt&&ut.setAttribute("data-task",n.taskId),!rt&&!n.isTotal&&!n.isGroup&&n.key&&ut.appendChild(P(this.#e,{name:n.label,avatar:this.#t.resourceAvatars.get(n.key),cssGlyph:!0}));const Nt=k(this.#e,"div",`${s}__wl-cell ${s}__wl-cell--name`);if(Nt.style.width=`${T}px`,Nt.style.flex=`0 0 ${T}px`,Nt.setAttribute("role","rowheader"),n.depth===1&&(Nt.style.paddingLeft=`${8+(this.#n.indent||16)}px`),n.toggle){const se=this.#e.createElement("button");se.setAttribute("class",`${s}__wl-toggle`),se.setAttribute("type","button"),se.setAttribute("aria-expanded",n.toggle.expanded?"true":"false"),se.setAttribute("aria-label",this.#u(`gantt.workload.${n.toggle.expanded?"collapse":"expand"}${n.isGroup?"Group":""}`,{name:n.toggle.name})),se.addEventListener("click",qt=>this.toggleResource(n.key,{event:qt})),Nt.appendChild(se)}const Wt=k(this.#e,"span",`${s}__wl-name-text${n.isGroup?` ${s}__wl-group-name`:""}`);if(u(Wt,n.label),Wt.setAttribute("title",n.label),Nt.appendChild(Wt),ut.appendChild(Nt),E.totals){const se=k(this.#e,"div",`${s}__wl-cell ${s}__wl-cell--total`);if(se.style.width=`${F}px`,se.style.flex=`0 0 ${F}px`,se.setAttribute("role","cell"),E.unit==="percent"&&n.availableTotal!=null){const qt=Xt(n.total,n.availableTotal,E.decimals);u(se,qt==="–"?qt:`${qt}%`)}else E.unit==="cost"&&n.costTotal!=null?u(se,Vt(n.costTotal,E.decimals)):u(se,Rt(n.total,E.decimals));ut.appendChild(se)}t&&t.appendChild(ut);const te=k(this.#e,"div",`${s}__wl-timerow${n.isTotal?` ${s}__wl-timerow--total`:""}${n.isGroup?` ${s}__wl-timerow--group`:""}${rt?` ${s}__wl-timerow--task`:""}${n.loadOnly?` ${s}__wl-timerow--loadonly`:""}`);te.style.height=`${E.rowHeight}px`,te.setAttribute("role","row"),te.setAttribute("data-resource",n.key),rt&&te.setAttribute("data-task",n.taskId);const ue=`${n.key}${n.taskId??""}`,Gt=this.#_n.has(ue)?this.#_n.get(ue):0;c.forEach((se,qt)=>{const Qt=A(se.start),ee=A(se.end),ke=E.unit!=="cost"&&!!n.over[qt],ge=k(this.#e,"div",`${s}__wl-bucket${ke?` ${s}__wl-bucket--over`:""}${_t?` ${s}__wl-bucket--editable`:""}${n.loadOnly?` ${s}__wl-bucket--loadonly`:""}`);ge.style.left=`${d(Qt)}px`,ge.style.width=`${d(Math.max(0,ee-Qt))}px`,ge.setAttribute("role","cell");const Ae=o(se.start)??String(se.start);ge.setAttribute("data-bucket",Ae),n.isTotal||ge.setAttribute("tabindex",qt===Gt?"0":"-1"),_t&&ge.setAttribute("data-bucket-index",String(qt));const Ce=n.cells[qt],Oe=n.available?n.available[qt]:null,$e=n.costCells?n.costCells[qt]:null,Ye=ne(E.thresholds,Oe!=null?(Ce??0)/Oe:null);Ye&&(Ye.className&&ge.classList.add(Ye.className),Ye.colour&&(ge.style.backgroundColor=Ye.colour));const Je=E.unit==="percent"&&Oe!=null,tn=E.unit==="cost"&&n.costCells!=null,Te=Ce==null&&!(Je&&!(Oe>0)),Ie=Je?Te?"":(()=>{const Ue=Xt(Ce,Oe,E.decimals);return Ue==="–"?Ue:`${Ue}%`})():tn?Vt($e,E.decimals):Rt(Ce,E.decimals);if(Ie!=="")if(u(ge,Ie),ge.setAttribute("data-hours",String(Ce)),Je)ge.setAttribute("aria-label",Ie==="–"?this.#u("gantt.workload.cellNoCapacity",{date:Ae}):this.#u(ke?"gantt.workload.overPercent":"gantt.workload.cellPercent",{percent:Ie.slice(0,-1),date:Ae}));else if(tn)ge.setAttribute("aria-label",this.#u("gantt.workload.cellCost",{cost:Ie,date:Ae}));else{const Ue={hours:Ie,date:Ae};ge.setAttribute("aria-label",ke?this.#u("gantt.workload.over",{...Ue,capacity:Rt(Oe,E.decimals)}):this.#u("gantt.workload.cell",Ue))}else(_t||!n.isTotal)&&ge.setAttribute("aria-label",Je?this.#u("gantt.workload.cellPercent",{percent:"0",date:Ae}):this.#u("gantt.workload.cell",{hours:"0",date:Ae}));te.appendChild(ge)}),e.appendChild(te)}#ms(){const t=this.#S;this.#I=k(this.#e,"div",`${s}__hg${t.collapsed?` ${s}__hg--collapsed`:""}`),this.#I.style.flex=`0 0 ${t.height}px`,this.#I.setAttribute("role","table"),this.#I.setAttribute("aria-label",this.#u("gantt.histogram.title")),this.#Ot=k(this.#e,"div",`${s}__hg-head`),this.#Ot.style.height=`${t.rowHeight}px`,this.#Ot.appendChild(k(this.#e,"div",`${s}__hg-cell ${s}__hg-cell--name`)),this.#Ot.appendChild(k(this.#e,"div",`${s}__divider`));const e=k(this.#e,"div",`${s}__hg-head-spacer`);this.#b||e.appendChild(this.#Si()),this.#Ot.appendChild(e),this.#I.appendChild(this.#Ot);const n=k(this.#e,"div",`${s}__hg-body`);this.#Xt=k(this.#e,"div",`${s}__hg-grid`),this.#Xt.style.width=`${this.#Z()}px`,this.#_=k(this.#e,"div",`${s}__hg-time`),n.appendChild(this.#Xt),n.appendChild(k(this.#e,"div",`${s}__divider`)),n.appendChild(this.#_),this.#I.appendChild(n),this.#a.appendChild(this.#I),this.#Re=()=>this.#Pt(this.#_),this.#_.addEventListener("scroll",this.#Re),this.#G=k(this.#e,"div",`${s}__hg-tooltip`),this.#G.setAttribute("hidden",""),this.#I.appendChild(this.#G),this.#Be=c=>this.#vs(c),this.#ze=c=>this.#Mi(c),this.#He=c=>this.#Ti(c),this.#_.addEventListener("pointerover",this.#Be),this.#_.addEventListener("pointermove",this.#ze),this.#_.addEventListener("pointerleave",this.#He),this.#We=c=>this.#_s(c),this.#Ue=c=>this.#Ti(c),this.#_.addEventListener("focus",this.#We,!0),this.#_.addEventListener("blur",this.#Ue,!0),this.#Ge=c=>this.#Cs(c),this.#_.addEventListener("keydown",this.#Ge),this.#Ke=c=>this.#Ss(c),this.#_.addEventListener("click",this.#Ke),this.#Ve=c=>this.#$s(c),this.#_.addEventListener("dblclick",this.#Ve),this.#Ye=c=>this.#xs(c),this.#_.addEventListener("contextmenu",this.#Ye)}#bs(t){const e=this.#S;if(!e.resources)return t.rows.map(c=>c.resource);const n=new Map(t.rows.map(c=>[c.resource==null?"":c.resource,c]));return e.resources.filter(c=>n.has(c))}#ys(t,e,n,c,A,T){const F=this.#S;if(!F||!this.#Xt||!this.#_||!this.#Ot)return;const E=this.#me(),rt=It(e.level,Math.floor(n),Math.ceil(c),this.#ue()),_t=this.#Jr(),ut=Mt(this.#t.tasks,t,{buckets:rt,hoursPerDay:_t,isWorking:E?Ae=>!E(Ae):null,capacities:this.#_i(),resourceModels:this.#t.resourceModels,resourceRates:this.#t.resourceRates,external:this.#Qr()}),Nt=this.#Zn(F),Wt=this.#Ot.querySelectorAll(`.${s}__hg-cell`);Wt[0]&&(Wt[0].style.width=`${Nt}px`,Wt[0].style.flex=`0 0 ${Nt}px`,u(Wt[0],this.#u("gantt.histogram.resource")));const te=ut.ok?ut.buckets:rt.map(Ae=>({...Ae,workingDays:0})),ue=ut.ok?this.#bs(ut):[],Gt=new Map(ut.rows.map(Ae=>[Ae.resource==null?"":Ae.resource,Ae]));this.#lt={resources:ue,buckets:te,rows:ut.rows,hoursPerDay:_t};const se=this.#Xt,qt=this.#_;for(;se.firstChild;)se.removeChild(se.firstChild);for(;qt.firstChild;)qt.removeChild(qt.firstChild);const Qt=Math.max(1,ue.length*F.rowHeight);F.contentHeight=(ue.length+1)*F.rowHeight;const ee=w(this.#e,"svg",{class:`${s}__hg-plot`,width:T,height:Qt,viewBox:`0 0 ${T} ${Qt}`,role:"img","aria-label":this.#u("gantt.histogram.title")}),ke=this.#ct?this.#gs(ue,Gt,F,Nt):ue;if(this.#ct&&this.#K){const Ae=this.#K.grid,Ce=this.#En(Ae,null);this.#lt.grid={columns:Ce.columns,columnWidths:Ce.columnWidths,rows:ke.map((Oe,$e)=>{const Ye=Oe??"",Je=Gt.get(Ye);return{label:Oe==null?this.#u("gantt.workload.unassigned"):this.#it(Oe),cells:Je?Je.cells:null,over:Je?Je.over:null,taskId:null,texts:Ce.visible.map(tn=>this.#Tn(Ae,Ye,tn,$e))}})}}const ge=this.#K?k(this.#e,"div"):se;ke.forEach((Ae,Ce)=>{const Oe=Ae??"",$e=Gt.get(Oe),Ye=Ae==null?this.#u("gantt.workload.unassigned"):this.#it(Ae);this.#ws(ge,ee,$e,Oe,Ye,te,A,Nt,F,Ce,T)}),qt.appendChild(ee),this.#r&&(qt.scrollLeft=this.#r.scrollLeft),this.#As(ue,Gt,te,F)}#ks(t,e,n){const c=t.reduce((F,E)=>Math.max(F,E||0),0),A=e!=null?Math.max(e,c):c,T=Math.max(A*1.15,A>0?A:1);return _({min:0,max:T},[n,0])}#ws(t,e,n,c,A,T,F,E,rt,_t,ut){const Nt=k(this.#e,"div",`${s}__hg-row`);Nt.style.height=`${rt.rowHeight}px`,Nt.setAttribute("role","row"),Nt.setAttribute("data-resource",c);const Wt=k(this.#e,"div",`${s}__hg-cell ${s}__hg-cell--name`);Wt.style.width=`${E}px`,Wt.style.flex=`0 0 ${E}px`,Wt.setAttribute("role","rowheader");const te=k(this.#e,"span",`${s}__hg-name-text`);u(te,A),te.setAttribute("title",A),Wt.appendChild(te),Nt.appendChild(Wt),t.appendChild(Nt);const ue=rt.unit==="cost"&&n&&n.costCells!=null,Gt=T.map((ke,ge)=>n&&(ue?n.costCells[ge]:n.cells[ge])||0),se=!ue&&n&&n.available&&n.available.some(ke=>ke!=null)?n.available:null,qt=se?se.reduce((ke,ge)=>Math.max(ke,ge),0):null,Qt=this.#ks(Gt,qt,rt.rowHeight),ee=w(this.#e,"g",{class:`${s}__hg-plotrow`,transform:`translate(0, ${d(_t*rt.rowHeight)})`});if(ee.setAttribute("data-resource",c),ee.setAttribute("data-row-top",String(_t*rt.rowHeight)),ee.setAttribute("data-row-height",String(rt.rowHeight)),ee.setAttribute("role","row"),T.forEach((ke,ge)=>{const Ae=F(ke.start),Ce=F(ke.end),Oe=Gt[ge],$e=se?se[ge]:null,Ye=$e!=null&&Oe>$e,Je=$e!=null?Math.min(Oe,$e):Oe,tn=n?n.cells[ge]??0:0,Te=n&&n.available?n.available[ge]:null,Ie=ne(rt.thresholds,Te!=null?tn/Te:null),Ue=w(this.#e,"g",{class:`${s}__hg-bargroup`});Ue.setAttribute("data-resource",c),Ue.setAttribute("data-bucket",o(ke.start)??String(ke.start)),Ue.setAttribute("data-bucket-index",String(ge));const Pi=this.#on.has(c)?this.#on.get(c):0;Ue.setAttribute("tabindex",ge===Pi?"0":"-1"),Ue.setAttribute("role","button"),Ue.setAttribute("aria-label",this.#Ai(A,ke,Oe,$e,Ye,n,ge,rt));const ki=d(Ae),zi=d(Math.max(0,Ce-Ae));if(rt.stacked==="task"&&!ue&&n&&n.tasks&&n.tasks.length){let Bn=0;for(const er of n.tasks){const nr=er.cells[ge]||0;if(!(nr>0))continue;const cr=Math.min(Bn,Je),ir=Math.min(Bn+nr,Je);if(Bn+=nr,ir<=cr)continue;const wi=w(this.#e,"rect",{class:`${s}__hg-bar`,x:ki,y:d(Qt.of(ir)),width:zi,height:d(Qt.of(cr)-Qt.of(ir)),fill:j(String(er.id))});wi.setAttribute("data-resource",c),wi.setAttribute("data-bucket",o(ke.start)??String(ke.start)),wi.setAttribute("data-task",String(er.id)),Ie&&(Ie.colour&&(wi.style.fill=Ie.colour),Ie.className&&wi.classList.add(Ie.className)),Ue.appendChild(wi)}}else if(Je>0){const Bn=w(this.#e,"rect",{class:`${s}__hg-bar`,x:ki,y:d(Qt.of(Je)),width:zi,height:d(Qt.of(0)-Qt.of(Je))});Ie&&(Ie.colour&&(Bn.style.fill=Ie.colour),Ie.className&&Bn.classList.add(Ie.className)),Ue.appendChild(Bn)}if(Ye){const Bn=w(this.#e,"rect",{class:`${s}__hg-bar ${s}__hg-bar--overalloc`,x:ki,y:d(Qt.of(Oe)),width:zi,height:d(Qt.of(Je)-Qt.of(Oe))});Bn.setAttribute("data-resource",c),Bn.setAttribute("data-bucket",o(ke.start)??String(ke.start)),Ue.appendChild(Bn)}const fr=w(this.#e,"rect",{x:ki,y:0,width:zi,height:rt.rowHeight,fill:"transparent"});Ue.insertBefore(fr,Ue.firstChild),ee.appendChild(Ue)}),qt!=null){const ke=d(Qt.of(qt)),ge=w(this.#e,"line",{class:`${s}__hg-cap`,x1:0,y1:ke,x2:ut,y2:ke});ge.setAttribute("data-resource",c),ge.setAttribute("data-capacity",String(qt)),ee.appendChild(ge)}e.appendChild(ee)}#Ai(t,e,n,c,A,T,F,E){const rt=o(e.start)??String(e.start),_t=o(e.end-1)??String(e.end-1);let ut;if(E.unit==="cost"&&T&&T.costCells!=null)ut=this.#u("gantt.histogram.tipCost",{cost:Vt(n,2)});else if(E.unit!=="percent"||c==null)ut=this.#u("gantt.histogram.tipHours",{hours:Rt(n,1)});else{const Gt=Xt(n,c,0);ut=Gt==="–"?this.#u("gantt.histogram.tipNoCapacity"):this.#u("gantt.histogram.tipPercent",{percent:Gt})}const Nt=c!=null?this.#u("gantt.histogram.tipCapacity",{hours:Rt(c,1)}):"",Wt=T&&T.tasks?T.tasks.filter(Gt=>(Gt.cells[F]||0)>0).map(Gt=>Gt.name):[],te=Wt.length?this.#u("gantt.histogram.tipTasks",{tasks:Wt.join(", ")}):"",ue=A?this.#u("gantt.histogram.tipOver"):"";return this.#u("gantt.histogram.tip",{name:t,from:rt,to:_t,value:ut,capacity:`${Nt}${ue}`,tasks:te})}#vs(t){const e=this.#ke(t),n=e&&e.cell;if(!e||!n||!this.#G){this.#Nn();return}const c=n.getAttribute("aria-label");if(!c){this.#Nn();return}(!this.#$t||this.#$t.key!==e.key||this.#$t.index!==e.index)&&(this.#Ln(t),this.#$t={key:e.key,index:e.index},Ee(this.#t,"workloadCellHover",this.#we(e,t))),u(this.#G,c),this.#G.removeAttribute("hidden"),this.#Mi(t)}#Mi(t){if(!this.#G||this.#G.hasAttribute("hidden")||!this.#I)return;const e=this.#I.getBoundingClientRect?this.#I.getBoundingClientRect():{left:0,top:0},n=Number.isFinite(t.clientX)?t.clientX:0,c=Number.isFinite(t.clientY)?t.clientY:0;this.#G.style.left=`${n-e.left+12}px`,this.#G.style.top=`${c-e.top-28}px`}#_s(t){const e=this.#ke(t),n=e&&e.cell;if(!e||!n||!this.#G)return;const c=n.getAttribute("aria-label");if(!c||((!this.#$t||this.#$t.key!==e.key||this.#$t.index!==e.index)&&(this.#Ln(t),this.#$t={key:e.key,index:e.index},Ee(this.#t,"workloadCellHover",this.#we(e,t))),u(this.#G,c),this.#G.removeAttribute("hidden"),!this.#I||!n.getBoundingClientRect))return;const A=this.#I.getBoundingClientRect(),T=n.getBoundingClientRect();this.#G.style.left=`${T.left-A.left}px`,this.#G.style.top=`${T.top-A.top-28}px`}#Nn(){this.#G&&this.#G.setAttribute("hidden","")}#ke(t){const e=t&&t.target,n=e&&e.closest?e.closest(`.${s}__hg-bargroup`):null;if(!n)return null;const c=n.getAttribute("data-resource")||"",A=Number(n.getAttribute("data-bucket-index")),T=this.#lt;if(!T||!Array.isArray(T.rows)||!Array.isArray(T.buckets)||!Number.isFinite(A))return null;const F=T.rows.find(rt=>(rt.resource==null?"":rt.resource)===c),E=T.buckets[A];return!F||!E?null:{cell:n,key:c,index:A,row:F,bucket:E,resourceName:F.resource==null?this.#u("gantt.workload.unassigned"):this.#it(F.resource)}}#we(t,e){return!t||!this.#lt?null:qe({view:this,unit:this.getWorkloadUnit(),resourceName:t.resourceName,rows:this.#lt.rows,buckets:this.#lt.buckets,rowKey:t.key,index:t.index,sub:null,rec:null,event:e})}#Ti(t){this.#Ln(t),this.#Nn()}#Ln(t){const e=this.#$t;if(this.#$t=null,!e||!this.#lt)return;const n=this.#lt.rows.find(A=>(A.resource==null?"":A.resource)===e.key),c=this.#lt.buckets[e.index];!n||!c||Ee(this.#t,"workloadCellHoverEnd",qe({view:this,unit:this.getWorkloadUnit(),resourceName:n.resource==null?this.#u("gantt.workload.unassigned"):this.#it(n.resource),rows:this.#lt.rows,buckets:this.#lt.buckets,rowKey:e.key,index:e.index,sub:null,rec:null,event:t}))}#Ss(t){const e=this.#ke(t);e&&Ee(this.#t,"workloadCellClick",this.#we(e,t))}#$s(t){const e=this.#ke(t);if(!e)return;!Se(this.#t,"workloadCellDblClick",this.#we(e,t))&&t.preventDefault&&t.preventDefault()}#xs(t){const e=this.#ke(t);if(!e)return;!Se(this.#t,"workloadCellContextMenu",this.#we(e,t))&&t.preventDefault&&t.preventDefault()}#Cs(t){const e=t.key;if(e==="Enter"||e===" "){if(t.ctrlKey||t.metaKey||t.altKey)return;const F=this.#ke(t);if(!F)return;t.preventDefault&&t.preventDefault(),Ee(this.#t,"workloadCellClick",this.#we(F,t));return}if(e!=="ArrowLeft"&&e!=="ArrowRight"&&e!=="ArrowUp"&&e!=="ArrowDown")return;const n=t.target&&t.target.closest?t.target.closest(`.${s}__hg-bargroup`):null;if(!n)return;const c=n.getAttribute("data-resource")||"",A=Number(n.getAttribute("data-bucket-index")),T=this.#_;if(T){if(e==="ArrowLeft"||e==="ArrowRight"){const F=e==="ArrowRight"?1:-1,rt=[...T.querySelectorAll(`.${s}__hg-bargroup[data-resource="${c}"]`)].sort((_t,ut)=>Number(_t.getAttribute("data-bucket-index"))-Number(ut.getAttribute("data-bucket-index"))).find(_t=>Number(_t.getAttribute("data-bucket-index"))===A+F);rt&&this.#Ei(c,A+F,rt)}else{const F=[...new Set([...T.querySelectorAll(`.${s}__hg-bargroup`)].map(Nt=>Nt.getAttribute("data-resource")))],E=F.indexOf(c),_t=F[E+(e==="ArrowDown"?1:-1)];if(_t==null)return;const ut=T.querySelector(`.${s}__hg-bargroup[data-resource="${_t}"][data-bucket-index="${A}"]`);ut&&this.#Ei(_t,A,ut)}t.preventDefault&&t.preventDefault()}}#Ei(t,e,n){this.#on.set(t,e);const c=this.#_;if(c)for(const A of c.querySelectorAll(`.${s}__hg-bargroup[data-resource="${t}"]`))A.setAttribute("tabindex",A===n?"0":"-1");n.focus&&n.focus()}#As(t,e,n,c){if(!this.#I)return;const A=this.#I.querySelector(`.${s}__hg-table`);A&&A.parentNode&&A.parentNode.removeChild(A);const T=k(this.#e,"div",`${s}__hg-table`),F=this.#e.createElement("table"),E=this.#e.createElement("caption");u(E,this.#u("gantt.histogram.tableTitle")),F.appendChild(E);const rt=this.#e.createElement("tr"),_t=c.unit==="percent"?"gantt.histogram.percent":c.unit==="cost"?"gantt.histogram.cost":"gantt.histogram.hours";for(const ut of["gantt.histogram.resource","gantt.histogram.period",_t,"gantt.histogram.capacity","gantt.histogram.overAllocated"]){const Nt=this.#e.createElement("th");u(Nt,this.#u(ut)),rt.appendChild(Nt)}F.appendChild(rt);for(const ut of t){const Nt=ut??"",Wt=ut==null?this.#u("gantt.workload.unassigned"):this.#it(ut),te=e.get(Nt),ue=c.unit==="cost"&&te&&te.costCells!=null;n.forEach((Gt,se)=>{const qt=te&&(ue?te.costCells[se]:te.cells[se])||0,Qt=!ue&&te&&te.available?te.available[se]:null,ee=Qt!=null&&qt>Qt,ke=this.#e.createElement("tr"),ge=this.#e.createElement("th");u(ge,Wt),ke.appendChild(ge);const Ae=this.#e.createElement("td");u(Ae,`${o(Gt.start)??Gt.start} – ${o(Gt.end-1)??Gt.end-1}`),ke.appendChild(Ae);const Ce=this.#e.createElement("td");if(c.unit==="percent"&&Qt!=null){const Ye=Xt(qt,Qt,0);u(Ce,Ye==="–"?Ye:`${Ye}%`)}else ue?u(Ce,Vt(qt,2)):u(Ce,Rt(qt,1));ke.appendChild(Ce);const Oe=this.#e.createElement("td");u(Oe,Qt!=null?Rt(Qt,1):""),ke.appendChild(Oe);const $e=this.#e.createElement("td");u($e,this.#u(ee?"gantt.histogram.yes":"gantt.histogram.no")),ke.appendChild($e),F.appendChild(ke)})}T.appendChild(F),this.#I.appendChild(T)}toggleResource(t,e={}){const n=String(t);if(Ct(n)){this.toggleWorkloadGroup(n.slice(bt.length));return}const c=this.#fe.has(n);c?this.#fe.delete(n):this.#fe.add(n),this.draw(),this.#t.emitResourceToggle(c,{resource:n,expandedResources:[...this.#fe],view:this,event:e.event||null})}toggleWorkloadGroup(t){const e=`${bt}${t==null?"":String(t)}`;this.#Fe.has(e)?this.#Fe.delete(e):this.#Fe.add(e),this.draw()}get collapsedWorkloadGroups(){return[...this.#Fe].map(t=>t.slice(bt.length))}getWorkloadUnit(){return this.#b?this.#b.unit:this.#S?this.#S.unit:yt.unit}setWorkloadUnit(t){const e=ni.has(t)?t:"hours";if(e===this.getWorkloadUnit()&&!(this.#b&&this.#S&&this.#b.unit!==this.#S.unit)||(this.#b&&(this.#b.unit=e),this.#S&&(this.#S.unit=e),!this.#b&&!this.#S))return;this.draw();const n=e==="percent"?"gantt.workload.unitPercent":e==="cost"?"gantt.workload.unitCost":"gantt.workload.unitHours";this.#ut(this.#u(n),{repeat:!0})}setWorkloadBookings(t){this.#b&&(this.#b.external=Zt(t,0),this.draw())}get expandedResources(){return new Set(this.#fe)}#Oi(t,e,n,c,A,T){const F=w(this.#e,"g",{class:`${s}__links`}),E=this.#gt||{first:0,last:Math.max(0,n.length-1)},rt=new Set((e.conflicts||[]).filter(ut=>ut.type==="LOCKED"&&ut.from!=null&&ut.to!=null).map(ut=>`${ut.from}:${ut.to}`));for(const ut of this.#t.dependencies){const Nt=String(ut.from),Wt=String(ut.to);if(!c.has(Nt)||!c.has(Wt))continue;const te=c.get(Nt),ue=c.get(Wt);if(Math.max(te,ue)<E.first||Math.min(te,ue)>E.last)continue;const Gt=this.#Di(e,c,A,T,ut,rt);Gt&&F.appendChild(Gt)}const _t=t.querySelector(`.${s}__links`);_t?t.replaceChild(F,_t):t.appendChild(F)}#Di(t,e,n,c,A,T){const F=String(A.from),E=String(A.to),rt=t.tasks.get(F),_t=t.tasks.get(E);if(!rt||!_t||rt.unscheduled||_t.unscheduled||rt.es==null||rt.ef==null||_t.es==null||_t.ef==null)return null;const ut=Ce=>{const Oe=n[e.get(Ce)];return Oe.top+Oe.height/2},Nt=A.type?String(A.type).toUpperCase():"FS",Wt=Nt==="FS"||Nt==="FF"?rt.ef:rt.es,te=Nt==="FF"||Nt==="SF"?_t.ef:_t.es,ue=c(Wt),Gt=ut(F),se=c(te),qt=ut(E),Qt=this.#n.showCritical&&rt.critical&&_t.critical,ee=T.has(`${F}:${E}`),ke=D({sx:ue,sy:Gt,ex:se,ey:qt,type:Nt,elbow:10,rowGap:n[e.get(F)].height/2}),ge=w(this.#e,"g",{class:`${s}__linkgroup`});ge.setAttribute("data-from",F),ge.setAttribute("data-to",E),ge.setAttribute("data-type",Nt),ge.setAttribute("tabindex",this.#n.keyboard?"0":"-1"),ge.setAttribute("role","button"),ge.setAttribute("aria-label",this.#u("gantt.a11y.linkLabel",{from:rt.name,to:_t.name,type:Nt}));const Ae=w(this.#e,"path",{class:`${s}__link${Qt?` ${s}__link--critical`:""}${ee?` ${s}__link--conflict`:""}`,d:ke.d});return Ae.setAttribute("data-from",F),Ae.setAttribute("data-to",E),Ae.setAttribute("data-type",Nt),Ae.setAttribute("data-route",ke.route),ee&&Ae.setAttribute("data-conflict","true"),ge.appendChild(Ae),ge.appendChild(w(this.#e,"path",{class:`${s}__arrowhead${Qt?` ${s}__arrowhead--critical`:""}${ee?` ${s}__arrowhead--conflict`:""}`,d:I(se,qt,ke.arrowDir)})),ge}#Ms(t){const e=this.#rn;if(!e||!t||!this.#n.showArrows)return;this.#Oi(e.plot,t,e.rows,e.rowIndex,e.geometry,e.x);const n=this.#gt||{first:0,last:Math.max(0,e.rows.length-1)};for(let c=n.first;c<=n.last;c+=1){const A=e.rows[c],T=t.tasks.get(A.id),F=e.plot.querySelector(`.${s}__barrow[data-task="${A.id}"]`);if(!T||!F||this.#L&&this.#L.draggedId===A.id||T.unscheduled||A.rec.unscheduled)continue;const E=e.x(T.es)-e.x(A.rec.es);E?F.setAttribute("transform",`translate(${E} 0)`):F.removeAttribute("transform")}}#Pi(t){const e=this.#n.barLabel;if(typeof e=="function")return String(e(t)??"");switch(e){case"none":return"";case"percent":return t.percentComplete==null?"":`${Math.round(t.percentComplete)}%`;case"dates":return`${this.#Fi(t.es)} – ${this.#Fi(t.ef)}`;default:return t.name}}#ji(t){const e=String(t.id);if(!this.#ne)return this.#Pi(t);if(this.#ne.has(e))return this.#ne.get(e);const n=this.#Pi(t);return this.#ne.set(e,n),n}#Ni(t,e){const n=this.#ji(t);return n?{text:n,inside:this.#Ii(e,n)==="inside"}:null}#Ts(t,e,n){this.#ne=new Map;let c=0;for(const A of t){const T=A.rec;if(!T||T.unscheduled||T.inactive&&T.es==null||T.isMilestone||!Number.isFinite(T.es)||!Number.isFinite(T.ef))continue;const F=this.#ji(T);if(!F)continue;const E=Math.round((T.es-e)*n),rt=Math.max(T.isSummary?2:1,Math.round((T.ef-e)*n)-E);if(this.#Ii(rt,F)==="inside")continue;const _t=E+rt+Cn+K(F,gn);_t>c&&(c=_t)}return c}#Li(t,e,n,c,A,T,F,E=!1,rt=null){if(!e)return;let _t=`${s}__barlabel`;e.inside&&(_t+=` ${s}__barlabel--inside`,E&&(_t+=` ${s}__barlabel--summary`));const ut=w(this.#e,"text",{class:_t,x:e.inside?d(n+c/2):d(n+c+Cn),y:d(A)});if(e.inside){if(ut.setAttribute("text-anchor","middle"),ut.setAttribute("data-inside","true"),rt){const te=dt(rt);te&&(ut.style.fill=te)}const Nt=`${s}__barlabel-clip-${++Rn}`,Wt=w(this.#e,"clipPath",{id:Nt});Wt.appendChild(w(this.#e,"rect",{x:d(n),y:d(T),width:d(c),height:d(F)})),t.appendChild(Wt),ut.setAttribute("clip-path",`url(#${Nt})`)}u(ut,e.text),t.appendChild(ut)}#Ii(t,e){if(this.#n.barLabelPosition==="right")return"right";const c=K(e,gn);return t>=c+2*wn?"inside":"right"}#Fi(t){const e=a(t);return e?`${String(e.getUTCDate()).padStart(2,"0")} ${ii[e.getUTCMonth()]}`:o(t)??String(t)}#Ri(t){return!t||t.editable===!1?null:t.editField?String(t.editField):t.kind==="name"?"name":t.kind==="progress"?"percentComplete":t.kind==="deadline"?"deadline":De.has(t.kind)||Be.has(t.kind)?t.kind:t.editable===!0?t.key:null}#In(t,e){if(e.unscheduled)return"";if(t==="duration")return e.duration==null?"":String(d(e.duration));const n=t==="start"?e.es:e.ef;return n==null?"":o(n)??String(d(n))}#Bi(t){return t.deadline==null?"":o(t.deadline)??String(d(t.deadline))}#jt(t){const e=this.#t.schedule;return e&&e.ok&&e.tasks.get(String(t))||null}#Fn(t){const e=String(t??"").trim();if(e==="")return null;if(/^-?\d+(\.\d+)?$/.test(e))return Number(e);const n=m(e);return Number.isFinite(n)?n:null}#Es(t){if(this.#nt)return;const e=t.target,n=e&&e.closest?e.closest(`.${s}__cell`):null;if(!n)return;const c=n.closest(`.${s}__row`);if(!c)return;const A=c.getAttribute("data-task"),T=this.#s[Number(n.getAttribute("data-col"))],F=this.#Ri(T);if(!A||!F)return;const E=this.#t.schedule&&this.#t.schedule.ok?this.#t.schedule.tasks.get(A):null;E&&E.isSummary||this.#Os(n,A,F,T)}#Os(t,e,n,c){const A=this.#t.taskById(e)||{},T=this.#jt(e),F=n==="percentComplete"||n==="duration"||Be.has(n)||c.kind==="progress"||c.kind==="number";let E;for(n==="duration"&&T?E=T.unscheduled?"":d(T.duration):Be.has(n)&&T?E=this.#li(n,T).replace("%",""):n==="start"&&T?E=this.#In("start",T):n==="end"&&T?E=this.#In("end",T):n==="deadline"&&T?E=this.#Bi(T):n==="percentComplete"&&T&&T.percentComplete!=null?E=T.percentComplete:E=A[n]==null?"":A[n];t.firstChild;)t.removeChild(t.firstChild);const rt=this.#e.createElement("input");rt.setAttribute("class",`${s}__editor`);const _t=/^\d{4}-\d{2}-\d{2}$/.test(String(E));rt.setAttribute("type",F?"number":_t?"date":"text"),rt.value=String(E),t.appendChild(rt),this.#nt=!0,rt.focus&&rt.focus();let ut=!1;const Nt=(Wt,te)=>{ut||(ut=!0,this.#nt=!1,Wt?this.#zi(e,n,rt.value,F,te):this.draw())};rt.addEventListener("keydown",Wt=>{Wt.key==="Enter"?(Wt.preventDefault&&Wt.preventDefault(),Nt(!0,Wt)):Wt.key==="Escape"&&(Wt.preventDefault&&Wt.preventDefault(),Nt(!1))}),rt.addEventListener("blur",Wt=>Nt(!0,Wt))}#zi(t,e,n,c,A=null){if(e==="start"||e==="end"){const F=this.#Fn(n),E=this.#jt(t);if(F==null||!E){this.draw();return}e==="start"||E.unscheduled?this.#t.applyEdit({id:t,[e]:F},{writeBack:!0,event:A}):this.#t.applyEdit({id:t,duration:Math.max(0,E.duration+(F-E.ef))},{writeBack:!0,event:A}),this.draw();return}if(e==="deadline"){const F=String(n??"").trim();if(F==="")this.#t.applyEdit({id:t,deadline:null},{writeBack:!0,event:A});else{const E=this.#Fn(F);this.#t.applyEdit({id:t,deadline:Number.isFinite(E)?o(E)??E:F},{writeBack:!0,event:A})}this.draw();return}let T=n;if(c){const F=Number(n);if(!Number.isFinite(F)){this.draw();return}e==="percentComplete"?T=Math.max(0,Math.min(100,F)):e==="duration"||e==="effort"?T=Math.max(0,F):e==="units"?T=Math.max(0,F)/100:T=F}this.#t.applyEdit({id:t,[e]:T},{writeBack:!0,event:A}),this.draw()}#ve(t){const e=t&&t.target,n=e&&e.closest?e.closest(`.${s}__wl-bucket`):null;if(!n)return null;const c=n.closest(`.${s}__wl-timerow`),A=c&&c.getAttribute("data-resource")||"",T=c&&c.getAttribute("data-task")||null,F=this.#B;if(!F||!Array.isArray(F.rows)||!Array.isArray(F.buckets))return null;const E=n.getAttribute("data-bucket"),rt=F.buckets.findIndex(ue=>(o(ue.start)??String(ue.start))===E);if(rt<0)return null;const _t=F.rows.find(ue=>(ue.resource==null?"":ue.resource)===A),ut=F.buckets[rt];if(!_t||!ut)return null;const Nt=T!=null&&Array.isArray(_t.tasks)&&_t.tasks.find(ue=>String(ue.id)===String(T))||null,Wt=T!=null?this.#jt(T):null,te=_t.resource==null?this.#u("gantt.workload.unassigned"):this.#it(_t.resource);return{cell:n,rowKey:A,taskId:T,index:rt,row:_t,bucket:ut,sub:Nt,rec:Wt,resourceName:te}}#Nt(t,e){return t?qe({view:this,unit:this.getWorkloadUnit(),resourceName:t.resourceName,rows:this.#B?this.#B.rows:[],buckets:this.#B?this.#B.buckets:[],rowKey:t.rowKey,index:t.index,sub:t.sub,rec:t.rec,event:e}):null}#Ds(t){const e=this.#ve(t);if(!e)return;const n=this.#Nt(e,t);if(!Se(this.#t,"workloadCellDblClick",n)){t.preventDefault&&t.preventDefault();return}this.#nt||!this.#n.editable||!e.taskId||this.#Yi(e.cell,e.taskId,e.rowKey,e.index)}#Ps(t){const e=this.#ve(t);if(!e)return;const{row:n,bucket:c,index:A}=e,T=n.cells[A]??0,F=n.available?n.available[A]??null:null,E=(n.tasks||[]).filter(rt=>(rt.cells[A]??0)>0).map(rt=>({id:rt.id,name:rt.name,hours:rt.cells[A]}));typeof this.#t.emitWorkloadClick=="function"&&this.#t.emitWorkloadClick({resource:n.resource,bucketStart:o(c.start)??String(c.start),bucketEnd:o(c.end)??String(c.end),booked:T,available:F,tasks:E}),Ee(this.#t,"workloadCellClick",this.#Nt(e,t))}#js(t){const e=t&&typeof t.closest=="function"?t.closest('[role="gridcell"]'):null;if(!e)return null;const n=e.closest("[data-key]"),c=n&&n.getAttribute("data-key")||"",A=c.indexOf("\0");return{cell:e,resource:A<0?c:c.slice(0,A),taskId:A<0?null:c.slice(A+1),colId:e.getAttribute("data-col")}}#in(t){const e=this.#js(t);if(!e||!e.colId)return null;const n=this.#B;if(!n||!Array.isArray(n.rows)||!Array.isArray(n.buckets))return null;const c=this.#pe?this.#pe.get(String(e.colId)):null;if(c==null)return null;const A=n.rows.find(ut=>(ut.resource==null?"":ut.resource)===e.resource),T=n.buckets[c];if(!A||!T)return null;const F=e.taskId||null,E=F!=null&&Array.isArray(A.tasks)&&A.tasks.find(ut=>String(ut.id)===String(F))||null,rt=F!=null?this.#jt(F):null,_t=A.resource==null?this.#u("gantt.workload.unassigned"):this.#it(A.resource);return{cell:e.cell,rowKey:e.resource,taskId:F,index:c,row:A,bucket:T,sub:E,rec:rt,resourceName:_t}}#Ns(t){const e=this.#in(t&&t.target);e&&(this.#Fs(e.rowKey,o(e.bucket.start)??String(e.bucket.start)),Ee(this.#t,"workloadCellClick",this.#Nt(e,t)))}#Ls(t){const e=this.#in(t&&t.target);if(!e)return;const n=this.#Nt(e,t);if(!Se(this.#t,"workloadCellDblClick",n)){t.preventDefault&&t.preventDefault();return}this.#nt||!this.#n.editable||!e.taskId||this.#Yi(e.cell,e.taskId,e.rowKey,e.index)}#Is(t){const e=this.#in(t&&t.target);if(!e)return;!Se(this.#t,"workloadCellContextMenu",this.#Nt(e,t))&&t.preventDefault&&t.preventDefault()}#Hi(t){const e=this.#in(t&&t.target);if(!e){this.#Gt();return}const n=this.#Ut;if(n&&n.key===e.rowKey&&n.index===e.index&&(n.taskId??null)===e.taskId){this.#Rn(e,t);return}n&&this.#bn(t),this.#Ut={key:e.rowKey,index:e.index,taskId:e.taskId},Ee(this.#t,"workloadCellHover",this.#Nt(e,t)),this.#Vi(e,t)}#Wi(t){const e=this.#Ut;if(!e){this.#Gt();return}const n=t&&t.relatedTarget?this.#in(t.relatedTarget):null;n&&n.rowKey===e.key&&n.index===e.index&&(n.taskId??null)===e.taskId||(this.#bn(t),this.#Gt())}#Fs(t,e){const n=this.#B;if(!n||!Array.isArray(n.rows)||!Array.isArray(n.buckets)||!e)return;const c=n.buckets.findIndex(_t=>(o(_t.start)??String(_t.start))===e);if(c<0)return;const A=n.rows.find(_t=>(_t.resource==null?"":_t.resource)===t),T=n.buckets[c];if(!A||!T)return;const F=A.cells[c]??0,E=A.available?A.available[c]??null:null,rt=(A.tasks||[]).filter(_t=>(_t.cells[c]??0)>0).map(_t=>({id:_t.id,name:_t.name,hours:_t.cells[c]}));typeof this.#t.emitWorkloadClick=="function"&&this.#t.emitWorkloadClick({resource:A.resource,bucketStart:o(T.start)??String(T.start),bucketEnd:o(T.end)??String(T.end),booked:F,available:E,tasks:rt})}#Rs(t){const e=this.#ve(t);if(!e)return;!Se(this.#t,"workloadCellContextMenu",this.#Nt(e,t))&&t.preventDefault&&t.preventDefault()}#Bs(t){const e=t.key;if(e==="Enter"||e===" "){if(t.ctrlKey||t.metaKey||t.altKey)return;const F=this.#ve(t);if(!F)return;t.preventDefault&&t.preventDefault(),Ee(this.#t,"workloadCellClick",this.#Nt(F,t));return}if(e!=="ArrowLeft"&&e!=="ArrowRight"&&e!=="ArrowUp"&&e!=="ArrowDown")return;const n=t.target&&t.target.closest?t.target.closest(`.${s}__wl-bucket`):null;if(!n)return;const c=n.closest(`.${s}__wl-timerow`);if(!c||!this.#v)return;const A=[...c.querySelectorAll(`.${s}__wl-bucket`)],T=A.indexOf(n);if(e==="ArrowLeft"||e==="ArrowRight"){const F=e==="ArrowRight"?1:-1,E=A[T+F];E&&this.#Ui(c,T+F,E)}else{const F=[...this.#v.querySelectorAll(`.${s}__wl-timerow`)],E=e==="ArrowDown"?1:-1;let rt=F[F.indexOf(c)+E];for(;rt&&rt.classList.contains(`${s}__wl-timerow--total`);)rt=F[F.indexOf(rt)+E];if(!rt)return;const _t=rt.querySelectorAll(`.${s}__wl-bucket`)[T];_t&&this.#Ui(rt,T,_t)}t.preventDefault&&t.preventDefault()}#Ui(t,e,n){const c=t.getAttribute("data-resource")||"",A=t.getAttribute("data-task");this.#_n.set(`${c}${A??""}`,e),[...t.querySelectorAll(`.${s}__wl-bucket`)].forEach((T,F)=>{T.setAttribute("tabindex",F===e?"0":"-1")}),n.focus&&n.focus()}#Gi(t){const e=this.#ve(t);if(!e){this.#Gt();return}const n=this.#Ut;if(n&&n.key===e.rowKey&&n.index===e.index&&(n.taskId??null)===e.taskId){this.#Rn(e,t);return}n&&this.#bn(t),this.#Ut={key:e.rowKey,index:e.index,taskId:e.taskId},Ee(this.#t,"workloadCellHover",this.#Nt(e,t)),this.#Vi(e,t)}#Ki(t){const e=this.#Ut;if(!e){this.#Gt();return}const n=t&&t.relatedTarget?this.#ve({target:t.relatedTarget}):null;n&&n.rowKey===e.key&&n.index===e.index&&(n.taskId??null)===e.taskId||(this.#bn(t),this.#Gt())}#bn(t){const e=this.#Ut;if(this.#Ut=null,!e)return;const n=this.#B,c=n&&Array.isArray(n.rows)?n.rows.find(E=>(E.resource==null?"":E.resource)===e.key):null,A=n&&Array.isArray(n.buckets)?n.buckets[e.index]:null;if(!c||!A)return;const T=e.taskId!=null&&Array.isArray(c.tasks)&&c.tasks.find(E=>String(E.id)===String(e.taskId))||null,F=e.taskId!=null?this.#jt(e.taskId):null;Ee(this.#t,"workloadCellHoverEnd",qe({view:this,unit:this.getWorkloadUnit(),resourceName:c.resource==null?this.#u("gantt.workload.unassigned"):this.#it(c.resource),rows:n.rows,buckets:n.buckets,rowKey:e.key,index:e.index,sub:T,rec:F,event:t}))}#zs(t){const e=t&&t.target;if(!e||!e.closest||e.closest(`.${s}__wl-toggle`))return;const n=e.closest(`.${s}__wl-row`);if(!n||n.getAttribute("data-task"))return;const c=n.getAttribute("data-resource")||"",A=this.#B,T=A&&Array.isArray(A.rows)?A.rows.find(F=>(F.resource==null?"":F.resource)===c):null;T&&Ee(this.#t,"workloadResourceClick",{resource:T.resource,resourceName:T.resource==null?this.#u("gantt.workload.unassigned"):this.#it(T.resource),view:this,event:t})}#Vi(t,e){if(!this.#W)return;const n=this.#Nt(t,e);if(!n){this.#Gt();return}const c=this.#b?this.#b.tooltip:!0;if(c===!1){this.#Gt();return}let A;if(typeof c=="function"){try{A=c(n)}catch{A=null}if(A==null||A===""){this.#Gt();return}}else A=this.#Ai(t.resourceName,t.bucket,n.booked,n.available,n.over,t.row,t.index,this.#b);for(;this.#W.firstChild;)this.#W.removeChild(this.#W.firstChild);typeof A=="string"?u(this.#W,A):A&&A.appendChild&&this.#W.appendChild(A),this.#W.removeAttribute("hidden"),this.#Rn(t,e)}#Rn(t,e){if(!this.#W||this.#W.hasAttribute("hidden")||!this.#R)return;const n=this.#R.getBoundingClientRect?this.#R.getBoundingClientRect():{left:0,top:0,width:0,height:0},c=e&&(e.type==="focusin"||e.type==="focus");let A,T;if(!c&&Number.isFinite(e&&e.clientX)&&Number.isFinite(e&&e.clientY)&&(e.clientX!==0||e.clientY!==0))A=e.clientX-n.left+12,T=e.clientY-n.top-28;else if(t&&t.cell&&t.cell.getBoundingClientRect){const ut=t.cell.getBoundingClientRect();A=ut.left-n.left,T=ut.top-n.top-28}else return;const F=this.#W.offsetWidth||0,E=this.#W.offsetHeight||0,rt=n.width||this.#R.clientWidth||0,_t=n.height||this.#R.clientHeight||0;A=Math.min(Math.max(0,A),Math.max(0,rt-F-4)),T=Math.min(Math.max(0,T),Math.max(0,_t-E)),this.#W.style.left=`${d(A)}px`,this.#W.style.top=`${d(T)}px`}#Gt(){this.#W&&this.#W.setAttribute("hidden","")}#Yi(t,e,n,c){let A=t.getAttribute("data-hours");if(A==null){const ut=this.#B&&this.#B.rows?this.#B.rows.find(Wt=>(Wt.resource==null?"":Wt.resource)===n):null,Nt=ut&&ut.tasks?ut.tasks.find(Wt=>String(Wt.id)===String(e)):null;Nt&&Array.isArray(Nt.cells)&&Nt.cells[c]!=null&&(A=String(Nt.cells[c]))}const T=this.#b;for(;t.firstChild;)t.removeChild(t.firstChild);const F=this.#e.createElement("input");F.setAttribute("class",`${s}__wl-editor`),F.setAttribute("type","number");let E=null;if(T.unit==="percent"){const ut=this.#B&&this.#B.rows?this.#B.rows.find(Nt=>(Nt.resource==null?"":Nt.resource)===n):null;E=ut&&ut.available?ut.available[c]:null}F.value=A==null?"":E!=null&&E>0?Xt(Number(A),E,T.decimals):Rt(Number(A),T.decimals),t.appendChild(F),this.#nt=!0,F.focus&&F.focus();let rt=!1;const _t=(ut,Nt)=>{rt||(rt=!0,this.#nt=!1,ut?this.#Hs(e,n,c,F.value,Nt):this.draw())};F.addEventListener("keydown",ut=>{ut.key==="Enter"?(ut.preventDefault&&ut.preventDefault(),_t(!0,ut)):ut.key==="Escape"&&(ut.preventDefault&&ut.preventDefault(),_t(!1))}),F.addEventListener("blur",ut=>_t(!0,ut))}#Hs(t,e,n,c,A=null){const T=this.#b,F=this.#B,E=F&&F.buckets?F.buckets[n]:null,rt=F&&F.rows?F.rows.find($e=>($e.resource==null?"":$e.resource)===e):null,_t=rt&&rt.tasks?rt.tasks.find($e=>String($e.id)===String(t)):null,ut=this.#jt(t);if(!T||!E||!_t||!ut){this.draw();return}const Nt=String(c??"").trim(),Wt=Nt===""?0:Number(Nt);if(!Number.isFinite(Wt)||Wt<0){this.draw();return}let te=Wt;if(T.unit==="percent"){const $e=rt.available?rt.available[n]:null;$e!=null&&$e>0&&(te=Wt/100*$e)}const ue=this.#me(),Gt=ue?$e=>!ue($e):null,se=[];for(let $e=Math.floor(E.start);$e<Math.ceil(E.end);$e+=1)(!Gt||Gt($e))&&se.push($e);const qt=o(E.start)??String(E.start);if(!se.length){this.#ut(this.#u("gantt.a11y.hoursRefused",{name:_t.name,date:qt}),{repeat:!0}),this.draw();return}const Qt=re(ut,Gt),ee=se.filter($e=>Qt.includes($e)),ke=ee.length?ee:se,ge=_t.raw||{};let Ae=Bt(ge);if(!Ae){const $e=$t(ge),Ye=$e??Qt.length*T.hoursPerDay*_t.unitsTotal;Ae=Yt(Qt,Ye)}const Ce=_t.units>0?_t.unitsTotal/_t.units:1,Oe=pe(Ae,E,ke,te*Ce);this.#t.applyEdit({id:t,work:we(Oe)},{writeBack:!0,event:A}),this.#ut(te>0?this.#u("gantt.a11y.hoursSet",{name:_t.name,hours:Rt(te,T.decimals),date:qt}):this.#u("gantt.a11y.hoursCleared",{name:_t.name,date:qt}),{repeat:!0}),this.draw()}#Ws(t){const e=new Map,n=new Map;for(const A of this.#t.dependencies){const T=String(A.from),F=String(A.to);(n.get(T)||n.set(T,[]).get(T)).push(F),(e.get(F)||e.set(F,[]).get(F)).push(T)}const c=A=>{const T=new Set([t]),F=[t];for(;F.length;){const E=F.pop();for(const rt of A.get(E)||[])T.has(rt)||(T.add(rt),F.push(rt))}return T.delete(t),T};return{preds:c(e),succs:c(n)}}#Us(){this.#N=on({doc:this.#e,t:this.#u,ns:s,onSelect:e=>this.#Gs(e),onFix:(e,n)=>this.#Vs(e,n)}),this.#a.appendChild(this.#N.element);const t=typeof this.#t.schedulingConflicts<"u"?this.#t.schedulingConflicts:[];this.#N.update(t||[]),this.#ht=this.#t.on("schedulingConflict",e=>{this.#N&&this.#N.update(e&&e.conflicts||[])})}getIssuesPanelState(){return this.#N?{open:this.#N.isOpen()}:null}setIssuesPanelState(t){this.#N&&t&&typeof t.open=="boolean"&&this.#N.setOpen(t.open)}#Gs(t){const e=t.tasks&&t.tasks.length?t.tasks[0]:null;e!=null&&this.scrollToTask(e),this.#Ks(t)}#Ks(t){if(!this.#a)return;this.#yn();const e=new Set((t.tasks||[]).map(String));for(const A of e){const T=this.#c&&this.#c.querySelector(`.${s}__row[data-task="${A}"]`);T&&T.classList.add(`${s}__row--chain`)}const n=this.#r;if(!n)return;const c=new Set((t.links||[]).map(A=>`${A.from}>${A.to}`));for(const A of n.querySelectorAll(`.${s}__link`)){const T=`${A.getAttribute("data-from")}>${A.getAttribute("data-to")}`;c.has(T)&&A.classList.add(`${s}__link--chain`)}for(const A of e){const T=n.querySelector(`.${s}__barrow[data-task="${A}"]`);if(!T)continue;const F=T.querySelector(`.${s}__bar`)||T.querySelector(`.${s}__milestone`)||T.querySelector(`.${s}__summary-bar`);if(!F)continue;const E=F.getAttribute("class")||"";E.includes(`${s}__milestone`)?F.classList.add(`${s}__milestone--chain`):E.includes(`${s}__summary-bar`)?F.classList.add(`${s}__summary-bar--chain`):F.classList.add(`${s}__bar--chain`)}}#Vs(t,e){const n=t.tasks&&t.tasks.length?t.tasks[0]:null;if(e==="removeLink"){const c=(t.links||[])[0];if(!c)return;const A=String(c.from),T=String(c.to),F=this.#t.dependencies.find(E=>String(E.from)===A&&String(E.to)===T);F&&this.#t.deleteDependency(F);return}n!=null&&(e==="asap"?this.#t.applyEdit({id:n,constraint:{type:"ASAP"}}):e==="unlock"?this.#t.applyEdit({id:n,locked:!1}):e==="clearDeadline"&&this.#t.applyEdit({id:n,deadline:null}))}#Ys(t){if(!this.#a)return;this.#yn();const{preds:e,succs:n}=this.#Ws(t),c=T=>T===t?"hover":e.has(T)?"pred":"succ";for(const T of[...e,...n,t]){const F=this.#c&&this.#c.querySelector(`.${s}__row[data-task="${T}"]`);F&&F.classList.add(`${s}__row--chain-${c(T)}`)}const A=this.#r;if(A){for(const T of A.querySelectorAll(`.${s}__link`)){const F=T.getAttribute("data-from"),E=T.getAttribute("data-to");if(!(F!=null&&E!=null&&(e.has(F)||n.has(F)||F===t)&&(e.has(E)||n.has(E)||E===t)))continue;const _t=E===t||e.has(E)?"pred":"succ";T.classList.add(`${s}__link--chain-${_t}`);const ut=T.parentNode&&T.parentNode.querySelector?T.parentNode.querySelector(`.${s}__arrowhead`):null;ut&&ut.classList.add(`${s}__arrowhead--chain-${_t}`)}for(const T of[...e,...n,t]){const F=A.querySelector(`.${s}__barrow[data-task="${T}"]`);if(!F)continue;const E=F.querySelector(`.${s}__bar`)||F.querySelector(`.${s}__milestone`)||F.querySelector(`.${s}__summary-bar`);if(!E)continue;const rt=E.getAttribute("class")||"",_t=rt.includes(`${s}__milestone`)?"milestone":rt.includes(`${s}__summary-bar`)?"summary-bar":"bar";E.classList.add(`${s}__${_t}--chain-${c(T)}`)}this.#Zs(t,e.size,n.size)}}#Zs(t,e,n){const c=this.#r&&this.#r.querySelector(`.${s}__barrow[data-task="${t}"]`);c&&(this.#vt=this.#u("gantt.a11y.chain",{preds:String(e),succs:String(n)}),this.#ot=c,this.#Bn(c))}#Bn(t){if(t!==this.#ot||!this.#vt)return;const e=t.getAttribute("aria-description");e&&e.endsWith(this.#vt)||(this.#_t=e,t.setAttribute("aria-description",[e,this.#vt].filter(Boolean).join(" ")))}#Xs(){if(!this.#ot)return;const t=this.#ot;this.#ot=null,this.#vt=null,this.#_t!=null?this.#_t?t.setAttribute("aria-description",this.#_t):t.removeAttribute("aria-description"):et(t),this.#_t=null}#yn(){if(!this.#a)return;const t=[];for(const e of["row","link","arrowhead","bar","milestone","summary-bar"]){t.push(`${s}__${e}--chain`);for(const n of["hover","pred","succ"])t.push(`${s}__${e}--chain-${n}`)}for(const e of t)for(const n of this.#a.querySelectorAll(`.${e}`))n.classList.remove(e);this.#Xs()}#qs(t){if(this.#nt||this.#L&&this.#L.dragging)return;const e=t.target,n=e&&e.closest?e.closest(`.${s}__row`)||e.closest(`.${s}__barrow`):null,c=n?n.getAttribute("data-task"):null;c?this.#Ys(c):this.#yn()}toSVG(t={}){if(!this.#T)return"";const e=this.#e&&this.#e.defaultView||globalThis;return ln(this.#T,{...t,el:this.#a,view:e})}[Ri](){return this.#T?en({controller:this.#t,exportModel:this.#T,nonWorking:this.#me(),element:this.#a,messages:this.#n.messages||this.#t.grid&&this.#t.grid.messages||null}):null}#Js(t){const e=ei();if(!e)return null;const n=this.#e.createElement("div");n.setAttribute("class",`${s}__zoom ${s}__pdf`);const c=this.#e.createElement("button");c.setAttribute("type","button"),c.setAttribute("class",`${s}__zoom-btn`),c.setAttribute("data-action","pdf");const A={messages:this.#n.messages||this.#t.grid&&this.#t.grid.messages||null};return c.textContent=e.label(A,"gantt.exportPdf"),c.addEventListener("click",()=>{const T=this.#t;T&&T.export&&T.export.pdf&&T.export.pdf({download:!0,fileName:"gantt.pdf"})}),n.appendChild(c),t.appendChild(n),c}async toPNG(t={}){const e=this.toSVG(t);if(!e)return null;const n=/width="(\d+)" height="(\d+)"/.exec(e),c=n?Number(n[1]):0,A=n?Number(n[2]):0;if(!c||!A)return null;const T=this.#e&&this.#e.defaultView||globalThis,F=t.scale||T.devicePixelRatio||1,E="background"in t?t.background:Ge(T,this.#a,"--lattice-background")||null;return ie(this.#e,e,c,A,F,E)}print(t={}){if(!this.#T)return me("gantt-print-not-drawn","[lattice] gantt: print() called before anything was drawn; nothing to print."),!1;const e=this.#t.grid,n=e&&e.messages,c=n&&n.locale||void 0,A=this.#e&&this.#e.defaultView||globalThis,T=pn(this.#T,{...t,title:t.title===!1?!1:t.title||this.#T.title||this.#t.title||null,locale:c,t:this.#u,el:this.#a,view:A});return xe(this.#e,T)}#Qs(){const t=this.#no(),e=di(this.#n.columns,t,["name","start","end","duration","assignee","progress"],"name");this.#xn=new Map;for(const T of e){if(T.dateFormat!=null){const E=jn(T.dateFormat);E&&(T.format=E)}delete T.dateFormat;const F=T.editField||(Qe[T.id]&&t.has(T.id)?Qe[T.id]:T.field??T.id);F&&this.#xn.set(T.id,String(F)),delete T.editField,this.#to(T)}const n=k(this.#e,"div",`${s}__lgrid ${s}__lgrid--tasks`);this.#a.appendChild(n);const c=new ui({createGrid:this.#ct,host:n,columns:e,rowHeight:Number(this.#n.rowHeight)||34,headerHeight:this.#n.headerHeight,config:this.#kn({edit:!!this.#n.editable,...this.#Hn()?{contextMenu:!1}:{}},"tasks","multiple"),keepAncestors:!0,ancestorClass:`${s}__row--ancestor`,treeSort:!0});this.#A=c,this.#Je=fi(n,this.#d,this.#n.headerHeight),this.#qe.push(this.#Je),c.lockScroll(this.#r);const A=()=>{this.#Dt||this.draw()};c.on("sort:changed",A),c.on("filter:changed",A),c.on("selection:changed",T=>{this.#M||this.#t.noteGridSelection(Array.isArray(T&&T.keys)?T.keys:[])}),c.on("cell:changed",T=>this.#uo(T)),c.on("cell:clicked",T=>this.#eo(T)),c.on("column:resized",T=>{T&&T.colId!=null&&this.#be(String(T.colId),T.width)}),this.#Hn()&&c.on("cell:contextmenu",T=>{const F=T&&T.event,E=F?null:this.#e.activeElement||null;this.#Xi(T&&T.key!=null?T.key:T&&T.row?T.row.key:null,F||null,E)}),this.#Xe=new ot({controller:this.#t,table:c,view:()=>this}),this.#Xe.attach(n),this.#_e("task",c)}#to(t){if(typeof t.render!="function"||t.cell&&typeof t.cell.render<"u")return;const e=t.render;delete t.render,t.cell={...t.cell||{},render:n=>{const c=n&&n.row&&n.row.data||{},A=String(c.__key),T=this.#jt(A),F=this.#t.taskById&&this.#t.taskById(A)||{};return e(T,{rawTask:F,depth:Number(c.__depth)||0})}}}#eo(t){if(!t||t.key==null||t.colId==null)return;const e=t.event,n=e&&e.target,c=n&&typeof n.closest=="function"?n.closest(".lat-cell"):null;typeof this.#t.emitCellClick=="function"&&this.#t.emitCellClick({task:this.#t.taskById(String(t.key)),columnKey:String(t.colId),element:c})}#no(){const t=!!this.#n.editable,e=this.#u,n=new Map,c=F=>this.#ao(F);this.#ge.add(c),n.set("name",{id:"name",field:"name",title:e("gantt.col.name"),layout:{flex:1,min:be,movable:!1},edit:{enabled:t},cell:{render:c}});for(const F of["start","end"])n.set(F,{id:F,field:F,title:e(`gantt.col.${F}`),type:"date",format:this.#zn(),layout:{width:96},edit:{enabled:t,editor:bn}});n.set("deadline",{id:"deadline",field:"deadline",title:e("gantt.col.deadline"),type:"date",format:this.#zn(),layout:{width:96},edit:{enabled:t,editor:bn}}),n.set("duration",{id:"duration",field:"duration",title:e("gantt.col.duration"),type:"number",layout:{width:84},edit:{enabled:t}}),n.set("wbs",{id:"wbs",field:"wbs",title:e("gantt.col.wbs"),type:"text",value:{compare:Si},layout:{width:64},edit:{enabled:!1}});const A=F=>this.#lo(F);this.#ge.add(A),n.set("assignee",{id:"assignee",field:"assignee",title:e("gantt.col.assignee"),layout:{width:96},edit:{enabled:!1},cell:{render:A}});const T=F=>this.#co(F);this.#ge.add(T),n.set("progress",{id:"progress",field:"percentComplete",title:e("gantt.col.progress"),type:"number",layout:{width:56},edit:{enabled:t},validation:{min:0,max:100},cell:{render:T}}),n.set("effort",{id:"effort",field:"effort",title:e("gantt.col.effort"),type:"number",layout:{width:76},edit:{enabled:t}}),n.set("units",{id:"units",field:"units",title:e("gantt.col.units"),type:"number",layout:{width:76},edit:{enabled:t}}),n.set("unscheduled",{id:"unscheduled",field:"__unscheduled",title:e("gantt.col.unscheduled"),type:"boolean",layout:{width:96},edit:{enabled:!1}}),n.set("inactive",{id:"inactive",field:"inactive",title:e("gantt.col.inactive"),type:"boolean",layout:{width:90},edit:{enabled:t}});for(const[F,E]of Un({t:e,editable:t,dateFormat:this.#zn(),dateEditor:bn}))n.set(F,E);for(const[F,E]of Ke({t:e,editable:t}))n.set(F,E);if(this.#n.dirtyMarks)for(const[F,E]of n)this.#io(F,E);return n}#io(t,e){const n=bi[t]||e.field;n&&(e.cell={...e.cell||{},classWhen:{...e.cell&&e.cell.classWhen||{},[Fn]:c=>{const A=c&&c.row&&c.row.data&&c.row.data.__dirty;return!!(A&&A.has(n))}}})}#zn(){const t=jn(this.#n.dateFormat);return t||(this.#ye()?{type:"date",dateStyle:"short"}:{type:"date",pattern:"yyyy-MM-dd"})}#kn(t,e,n){const c=this.#ye();return{...Ji(this.#n.gridConfig,e,t,n),...c?{locale:c}:{}}}#ro(t,e,n){const c=t.rec;return{...e,__key:t.id,__depth:t.depth,__hasChildren:t.hasChildren,__summary:!!c.isSummary,__unscheduled:!!c.unscheduled,id:e.id!=null?e.id:t.id,name:c.name,wbs:c.wbs,start:o(c.es)??c.es,end:o(c.ef)??c.ef,duration:c.duration==null?null:d(c.duration),inactive:!!c.inactive,deadline:c.deadline!=null?o(c.deadline)??c.deadline:e.deadline??null,percentComplete:c.percentComplete==null?null:c.percentComplete,effort:c.isSummary||!(c.effort>0)?null:d(c.effort),units:c.isSummary||!(c.units>0)?null:Math.round(c.units*100),...cn(c,e,n)}}#so(t,e){const n=this.#A,c=new Map(this.#t.tasks.map(Gt=>[String(this.#t.readId(Gt)),Gt])),A=this.#n.dirtyMarks&&typeof this.#t.changes=="function"?ze(this.#t.changes(),Gt=>String(this.#t.readId(Gt))):null,T=e&&e.ok&&n.grid.columns.visible().some(Gt=>Gt.id in mn)?zn(e.tasks):null,F=T?this.#t.dependencies:[],E=(Gt,se)=>{const qt=new Map(this.#Jn(Gt).map(Qt=>[Qt.id,Qt.height]));this.#Dt=!0;try{const Qt=Gt.map((ee,ke)=>({...this.#ro(ee,c.get(ee.id)||{},ke+1),predecessors:T?Yn(ee.id,"predecessors",F,T.byId):"",successors:T?Yn(ee.id,"successors",F,T.byId):"",__keep:se.has(ee.id)?"1":"",__ancestor:se.has(ee.id),__dirty:A?A.get(ee.id):void 0}));if(n.setRows(Qt,qt),n.grid.columns.visible().some(ee=>ee.id==="sequence")){const ee=new Map(n.displayedKeys().map((ke,ge)=>[ke,ge+1]));if(Qt.some(ke=>ee.has(ke.__key)&&ee.get(ke.__key)!==ke.sequence)){for(const ke of Qt)ee.has(ke.__key)&&(ke.sequence=ee.get(ke.__key));n.setRows(Qt,qt)}}}finally{this.#Dt=!1}},rt=Gt=>{const se=new Map(Gt.map(qt=>[qt.id,qt]));return n.displayedKeys().map(qt=>se.get(qt)).filter(Boolean)};if(this.#w=new Set,this.#E=new Set,!n.isFiltering())return E(t,this.#w),rt(t);const _t=this.#An(e,!0);E(_t,this.#w);const ut=new Set(rt(_t).map(Gt=>Gt.id)),Nt=new Map(_t.map(Gt=>[Gt.id,Gt.rec.parent==null?null:String(Gt.rec.parent)])),Wt=vi(ut,Nt);for(const Gt of _t)!ut.has(Gt.id)&&!Wt.has(Gt.id)&&this.#E.add(Gt.id);const te=Gt=>{for(let se=Nt.get(Gt);se!=null;se=Nt.get(se))if(this.#m.has(se))return!0;return!1},ue=_t.filter(Gt=>!this.#E.has(Gt.id)&&!te(Gt.id));return this.#w=new Set(ue.filter(Gt=>Wt.has(Gt.id)).map(Gt=>Gt.id)),E(ue,this.#w),rt(ue)}#oo(){const t=this.#A.host;t.style.width=`${this.#Z()}px`;const e=(this.#R&&this.#R.offsetHeight||0)+(this.#I&&this.#I.offsetHeight||0)+(this.#o?this.#o.height():0)+(this.#h?this.#h.height():0);t.style.bottom=`${e}px`;for(const n of[this.#d,this.#c])if(n)for(;n.firstChild;)n.removeChild(n.firstChild);this.#d&&(this.#d.style.height=`${this.#n.headerHeight}px`),this.#Je&&this.#Je.apply()}#ao(t){const e=t&&t.row&&t.row.data||{},n=k(this.#e,"span",`${s}__lgrid-name`);n.style.paddingLeft=`${(e.__depth||0)*(this.#n.indent||16)}px`;const c=this.#e.createElement("button");c.setAttribute("class",`${s}__chevron`),c.setAttribute("type","button");const A=String(e.__key);if(e.__hasChildren){const F=this.#m.has(A);u(c,F?"▸":"▾"),c.setAttribute("aria-label",this.#u(F?"gantt.row.expand":"gantt.row.collapse",{name:e.name})),c.setAttribute("aria-expanded",F?"false":"true"),c.addEventListener("click",E=>{E&&E.stopPropagation&&E.stopPropagation(),this.toggle(A,{event:E})}),c.addEventListener("keydown",E=>{E&&(E.key==="Enter"||E.key===" "||E.key==="Spacebar")&&(E.preventDefault&&E.preventDefault(),E.stopPropagation&&E.stopPropagation(),this.toggle(A,{event:E}))})}else c.setAttribute("aria-hidden","true");n.appendChild(c);const T=k(this.#e,"span",`${s}__name-text${e.__summary?` ${s}__name-text--summary`:""}`);return u(T,t&&t.text!=null?String(t.text):String(e.name??"")),n.appendChild(T),e.__unscheduled&&n.appendChild(Hn(this.#e,s,this.#u)),n}#lo(t){const e=t&&t.row&&t.row.data||{},n=String(e.__key),c=k(this.#e,"span",`${s}__lgrid-name`),A=this.#jt(n);return this.#ai(c,this.#t.taskById(n)||{},A?{id:n,rec:A}:null),c}#co(t){const e=t&&t.row&&t.row.data||{},n=k(this.#e,"span",`${s}__lgrid-name`),c=this.#jt(String(e.__key));return c&&this.#ci(n,c),n}#uo(t){if(this.#Dt||!t||t.key==null)return;const e=this.#xn.get(String(t.colId));if(!e)return;const n=String(t.key);if(mn[e]&&e===String(t.colId)){this.#do(n,e,t.value);return}const c=this.#jt(n);if(!c||c.isSummary&&e!=="name"){Promise.resolve().then(()=>this.draw());return}let A=t.value;if(e==="start"||e==="end"||e==="deadline"||e==="constraintDate"){const F=A instanceof Date?m(A):this.#Fn(A);A=Number.isFinite(F)?o(F)??String(F):A==null||A===""?null:A}const T=e==="percentComplete"||e==="duration"||Be.has(e);Promise.resolve().then(()=>{if(!this.#Tt)if(De.has(e)||T||e==="name")this.#zi(n,e,A==null?"":String(A),T);else{const F=Wi.includes(String(t.colId))&&e===String(t.colId)?Zn(this.#t.taskById(n)||{},e,A):{[e]:A};this.#t.applyEdit({id:n,...F},{writeBack:!0}),this.draw()}})}#do(t,e,n){Promise.resolve().then(()=>{if(this.#Tt)return;const c=this.#t.schedule;let A=null;if(c&&c.ok){const T=Sn({id:t,column:e,text:n==null?"":String(n),dependencies:this.#t.dependencies,refs:zn(c.tasks)});T.ok?T.next&&this.#t.setDependencies(T.next,{gateRemoved:!0}):A=this.#u(T.key,{token:T.token})}this.draw(),A&&this.#ut(A,{repeat:!0})})}#_e(t,e){const n=this.#Vn;if(n&&n[t]){const c=t==="workload"?this.#Ci(n[t]):n[t];e.setState(c),delete n[t]}}#ho(){const t=this.#t;return{doc:this.#e,ns:s,t:(e,n)=>this.#u(e,n),createGrid:()=>this.#ct,gridConfig:()=>this.#kn({},"band"),gridWidth:()=>this.#Z(),locale:()=>this.#ye(),indent:()=>this.#n.indent||16,editable:()=>!!this.#n.editable,syncScroll:e=>this.#Pt(e),timeScrollLeft:()=>this.#r?this.#r.scrollLeft:0,toggleTask:(e,n)=>this.toggle(e,{event:n}),emitResize:(e,n)=>this.#be(e,n),redraw:()=>this.draw(),view:()=>this,rawTask:e=>this.#Xn(String(e)),writeSeries:(e,n,c)=>t.writeDataBandSeries(e,n,c),setEditing:e=>{this.#nt=!!e},gateEdit:(e,n)=>t.gateDataBandEdit(e,n),emitChange:e=>t.emitDataBandChange(e)}}#fo(){return{doc:this.#e,ns:s,t:(t,e)=>this.#u(t,e),locale:()=>this.#ye(),formatDate:t=>this.#bi(t),gridWidth:()=>this.#Z(),syncScroll:t=>this.#Pt(t),timeScrollLeft:()=>this.#r?this.#r.scrollLeft:0,redraw:()=>this.draw()}}getDataBandState(){return this.#o?this.#o.getState():null}setDataBandState(t){this.#o&&(this.#o.setState(t),this.draw())}toggleDataBand(t,e){const n=this.#o?this.#o.get(t):null;return n?(n.setCollapsed(e===void 0?!n.collapsed:!!e),n.collapsed):!1}getDataBandTable(t){const e=this.#o?this.#o.get(t):null;return e?e.toTable():null}getChartBandState(){return this.#h?this.#h.getState():null}setChartBandState(t){this.#h&&(this.#h.setState(t),this.draw())}toggleChartBand(t,e){const n=this.#h?this.#h.get(t):null;return n?(n.setCollapsed(e===void 0?!n.collapsed:!!e),n.collapsed):!1}getChartBandData(t){const e=this.#h?this.#h.get(t):null;return e?e.data():null}getTableStates(){return this.#ct?{task:this.#A?this.#A.getState():null,workload:this.#$?this.#$.getState():null,histogram:this.#K?this.#K.getState():null}:null}setTableStates(t){!this.#ct||!t||typeof t!="object"||(this.#Vn={...t},this.#A&&this.#_e("task",this.#A),this.#$&&this.#_e("workload",this.#$),this.#K&&this.#_e("histogram",this.#K),this.draw())}get grids(){const t={};if(this.#o)for(const e of this.#o.bands)e.grid&&(t[e.cfg.id]=e.grid);return{tasks:this.#A?this.#A.grid:null,workload:this.#$?this.#$.grid:null,histogram:this.#K?this.#K.grid:null,dataBands:t}}#go(t){if(t==null)return null;const e=String(t);for(const n of this.#t.tasks)if(String(this.#t.readId(n))===e)return n;return null}#Zi(t,e){if(e==="keydown"&&!this.#mo(t))return;const n=t&&t.target;if(!n||typeof n.closest!="function")return;const c=n.closest("[data-task]");if(!c)return;t&&typeof t.preventDefault=="function"&&t.preventDefault();const A=c.getAttribute("data-task");if(this.#St){const T=this.#t.schedule,F=T&&T.ok?T.tasks.get(A):null,E=e!=="keydown"&&pt(n,s)||st(F);if(!this.#St.gateContextMenu(A,E,t))return}this.#Xi(A,e==="keydown"?null:t,c)}#po(t){const e=t&&t.target;if(!e||typeof e.closest!="function")return;const n=e.closest("[data-task]");if(!n||!this.#St)return;const c=n.getAttribute("data-task"),A=this.#t.schedule,T=A&&A.ok?A.tasks.get(c):null,F=pt(e,s)||st(T);!this.#St.gateContextMenu(c,F,t)&&t.preventDefault&&t.preventDefault()}#Hn(){const t=this.#n.contextMenu;return typeof t=="function"||t===!0}#mo(t){return!!t&&(t.key==="ContextMenu"||t.key==="F10"&&t.shiftKey)}#Xi(t,e,n){const c=this.#go(t);if(!c)return;e&&typeof e.preventDefault=="function"&&e.preventDefault();const A=Fi(this.#t,c,(E,rt)=>this.#u(E,rt)),T=typeof this.#n.contextMenu=="function"?this.#n.contextMenu(c,e,A):A;if(!T||Array.isArray(T)&&!T.length)return;const F={items:T,ctx:{task:c,event:e,view:this}};e&&Number.isFinite(e.clientX)&&Number.isFinite(e.clientY)?(F.x=e.clientX,F.y=e.clientY):n&&typeof n.getBoundingClientRect=="function"&&(F.anchor=n,F.placement="below",F.returnFocus=n),this.#Ce.show(F)}destroy(){if(!this.#Tt){this.#Tt=!0,this.#vn.fail(new Error("lattice-grid: the gantt split view was destroyed before it became ready.")),this.#t.emitViewDestroy({view:this,element:this.#a}),this.#Wt&&this.#Wt.close(),this.#T=null,this.#tt&&this.#tt.dispose(),this.#tt=null,this.#st&&this.#st.dispose(),this.#st=null,this.#Y&&this.#Y.release(),this.#Y=null,this.#Lt&&this.#Lt.release(),this.#Lt=null,this.#ni(),this.#qt=null,this.#Qe&&this.#yt&&this.#yt.removeEventListener("pointerdown",this.#Qe),this.#tn&&this.#yt&&this.#yt.removeEventListener("keydown",this.#tn),this.#Qe=null,this.#tn=null,this.#yt=null,this.#xt&&this.#r&&this.#r.removeEventListener("scroll",this.#xt),this.#xt=null,this.#Ct&&this.#c&&this.#c.removeEventListener("scroll",this.#Ct),this.#Ct=null,this.#Te&&this.#v&&this.#v.removeEventListener("scroll",this.#Te),this.#Te=null,this.#Oe&&this.#v&&this.#v.removeEventListener("dblclick",this.#Oe),this.#Oe=null,this.#Ee&&this.#v&&this.#v.removeEventListener("click",this.#Ee),this.#Ee=null,this.#le&&this.#le(),this.#le=null,this.#ln=null,this.#cn=null,this.#un=null,this.#dn=null,this.#hn=null,this.#fn=null,this.#gn=null,this.#Kn=null,this.#ce&&this.#ce.dispose(),this.#ce=null,this.#De&&this.#v&&this.#v.removeEventListener("contextmenu",this.#De),this.#De=null,this.#Pe&&this.#v&&this.#v.removeEventListener("pointerover",this.#Pe),this.#Pe=null,this.#je&&this.#v&&this.#v.removeEventListener("pointerout",this.#je),this.#je=null,this.#Ne&&this.#v&&this.#v.removeEventListener("focusin",this.#Ne),this.#Ne=null,this.#Le&&this.#v&&this.#v.removeEventListener("focusout",this.#Le),this.#Le=null,this.#Ie&&this.#Et&&this.#Et.removeEventListener("click",this.#Ie),this.#Ie=null,this.#W=null,this.#Ut=null,this.#B=null,this.#_&&(this.#Re&&this.#_.removeEventListener("scroll",this.#Re),this.#Be&&this.#_.removeEventListener("pointerover",this.#Be),this.#ze&&this.#_.removeEventListener("pointermove",this.#ze),this.#He&&this.#_.removeEventListener("pointerleave",this.#He),this.#We&&this.#_.removeEventListener("focus",this.#We,!0),this.#Ue&&this.#_.removeEventListener("blur",this.#Ue,!0),this.#Ge&&this.#_.removeEventListener("keydown",this.#Ge),this.#Ke&&this.#_.removeEventListener("click",this.#Ke),this.#Ve&&this.#_.removeEventListener("dblclick",this.#Ve),this.#Ye&&this.#_.removeEventListener("contextmenu",this.#Ye)),this.#Re=this.#Be=this.#ze=this.#He=null,this.#We=this.#Ue=this.#Ge=null,this.#Ke=this.#Ve=this.#Ye=null,this.#$t=null,this.#lt=null,this.#G=null,this.#on.clear(),this.#wt&&(this.#c&&(this.#c.removeEventListener("pointerover",this.#wt),this.#c.removeEventListener("pointerleave",this.#At)),this.#r&&(this.#r.removeEventListener("pointerover",this.#wt),this.#r.removeEventListener("pointerleave",this.#At))),this.#wt=this.#At=null,this.#It&&this.#c&&this.#c.removeEventListener("dblclick",this.#It),this.#It=null,this.#r&&(this.#Mt&&this.#r.removeEventListener("pointerdown",this.#Mt),this.#Ft&&this.#r.removeEventListener("pointermove",this.#Ft),this.#Vt&&this.#r.removeEventListener("pointerleave",this.#Vt),this.#Jt&&this.#r.removeEventListener("keydown",this.#Jt),this.#D&&this.#r.removeEventListener("click",this.#D),this.#j&&this.#r.removeEventListener("keydown",this.#j)),this.#Ft=this.#Vt=null,this.#x&&this.#c&&this.#c.removeEventListener("click",this.#x),this.#Ae&&this.#c&&this.#c.removeEventListener("keydown",this.#Ae),this.#Ae=null,this.#oi(),this.#Qt&&this.#a&&this.#a.removeEventListener("keydown",this.#Qt),this.#te&&this.#a&&this.#a.removeEventListener("paste",this.#te),this.#te=null,this.#Mt=this.#Jt=this.#Qt=null,this.#D=this.#j=this.#x=null,this.#r&&(this.#re&&this.#r.removeEventListener("pointermove",this.#re),this.#zt&&(this.#r.removeEventListener("pointerleave",this.#zt),this.#r.removeEventListener("blur",this.#zt,!0)),this.#$e&&this.#r.removeEventListener("focus",this.#$e,!0),this.#xe&&this.#r.removeEventListener("keydown",this.#xe)),this.#re=this.#zt=this.#$e=this.#xe=null,this.#H=this.#ie=this.#mt=this.#he=null,this.#ot=null,this.#vt=this.#_t=null,this.#se&&(this.#c&&this.#c.removeEventListener("contextmenu",this.#se),this.#r&&this.#r.removeEventListener("contextmenu",this.#se)),this.#oe&&(this.#c&&this.#c.removeEventListener("keydown",this.#oe),this.#r&&this.#r.removeEventListener("keydown",this.#oe)),this.#se=this.#oe=null,this.#Bt&&(this.#c&&this.#c.removeEventListener("contextmenu",this.#Bt),this.#r&&this.#r.removeEventListener("contextmenu",this.#Bt)),this.#Bt=null,this.#Ce&&(this.#Ce.destroy(),this.#Ce=null),this.#L&&(this.#L.destroy(),this.#L=null),this.#p&&(this.#p(),this.#p=null),this.#ht&&(this.#ht(),this.#ht=null),this.#N&&(this.#N.destroy(),this.#N=null),this.#St&&(this.#St.destroy(),this.#St=null),this.#Rt&&(this.#Rt.destroy(),this.#Rt=null),this.#Xe&&(this.#Xe.destroy(),this.#Xe=null);for(const t of[this.#A,this.#$,this.#K])t&&t.destroy();for(const t of this.#qe)t.dispose();this.#qe=[],this.#Je=null,this.#A=this.#$=this.#K=null,this.#Ht=null,this.#V&&this.#V(),this.#V=null,this.#rt&&this.#rt(),this.#rt=null,this.#Q&&this.#Q(),this.#dt&&this.#dt(),this.#Q=this.#dt=null,this.#l&&(this.#l(),this.#l=null),this.#o&&(this.#o.destroy(),this.#o=null),this.#h&&(this.#h.destroy(),this.#h=null),this.#i&&this.#i.__latticeGantt===this&&(this.#i.__latticeGantt=null),this.#J&&(this.#J(),this.#J=null),this.#a&&this.#a.parentNode&&this.#a.parentNode.removeChild(this.#a),this.#a=null,this.#d=this.#c=this.#y=this.#r=null,this.#R=this.#bt=this.#Et=this.#v=null,this.#I=this.#Ot=this.#Xt=this.#_=null}}}function hr(it,t,e={}){return new lr(it,t,e)}}),ae("packages/modules/gantt/scurve.js",function(p,V){"use strict";Object.defineProperty(p,"SCURVE_NS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(p,"computeSCurve",{enumerable:!0,get:function(){return D}}),Object.defineProperty(p,"GanttSCurveView",{enumerable:!0,get:function(){return at}});const St=V("packages/modules/charts/svg.js"),U=St.svg,K=St.el,Y=St.setText,W=St.path,l=St.round,L=V("packages/modules/charts/scale.js"),v=L.linearScale,b=L.measureDomain,w=V("packages/modules/gantt/time.js"),k=w.toDayNumber,u=w.toISODate,g=w.fromDayNumber,S=V("packages/modules/gantt/schedule.js").taskIdReader,C=V("packages/modules/gantt/earned-value.js").computeEarnedValue,o=V("packages/modules/gantt/messages.js").createTranslator,m=1e-9,$="lat-gantt-scurve",h="data-lat-gantt-scurve-styles",y=Object.freeze({width:640,height:220,bucket:"day",statusDate:null,costField:"cost",actualCostField:"actualCost"});function i(dt){if(dt==null||dt==="")return null;const kt=typeof dt=="number"?dt:Number(dt);return Number.isFinite(kt)?kt:null}function r(dt,kt,Tt){return Tt-kt<=m?dt>=Tt?1:0:dt<=kt?0:dt>=Tt?1:(dt-kt)/(Tt-kt)}function f(dt,kt,Tt){if(dt.pct>=1){const Ft=Math.min(dt.rec.ef,Tt);return kt>=Ft?dt.bac:0}return dt.pct>0&&kt>=Tt?dt.bac*dt.pct:0}function M(dt,kt,Tt){const Ft=[];if(!(Tt>kt))return Ft;if(dt==="day"){for(let x=kt;x<Tt;x+=1)Ft.push({start:x,end:x+1});return Ft}if(dt==="week"){for(let x=kt;x<Tt;x+=7)Ft.push({start:x,end:Math.min(Tt,x+7)});return Ft}const P=g(kt);if(!P)return Ft;let j=Date.UTC(P.getUTCFullYear(),P.getUTCMonth(),1)/864e5;for(;j<Tt;){const x=g(j),R=Date.UTC(x.getUTCFullYear(),x.getUTCMonth()+1,1)/864e5;Ft.push({start:j,end:Math.min(Tt,R)}),j=R}return Ft}function D(dt,kt,Tt={}){if(!kt||!kt.ok||!kt.tasks||!kt.order)return[];const Ft=Tt.costField||"cost",P=Tt.actualCostField||"actualCost",j=Tt.bucket==="week"||Tt.bucket==="month"?Tt.bucket:"day",x=Tt.statusDate==null?kt.projectFinish:k(Tt.statusDate)??kt.projectFinish,R=Tt.rateCosts instanceof Map?Tt.rateCosts:null,N=S(Tt.fields),X=new Map;for(const st of Array.isArray(dt)?dt:[]){const ht=N(st);ht!=null&&X.set(String(ht),st)}const G=[];for(const st of kt.order){const ht=kt.tasks.get(st);if(!ht||ht.isSummary||ht.unscheduled)continue;const Ot=X.get(st),wt=Ot?i(Ot[Ft]):null,Jt=R?R.get(st):null,lt=wt??(Jt&&Jt.hasRate?Jt.cost:ht.duration),nt=Ot?i(Ot[P]):null,ot=ht.percentComplete==null?0:Math.max(0,Math.min(100,ht.percentComplete))/100,vt=ht.baselineStart!=null?ht.baselineStart:ht.es,gt=ht.baselineEnd!=null?ht.baselineEnd:ht.ef;G.push({rec:ht,bac:lt,pct:ot,ac:nt,bStart:vt,bEnd:gt})}const J=Math.floor(kt.projectStart),Q=Math.ceil(kt.projectFinish),pt=[];for(const st of M(j,J,Q)){const ht=st.end;let Ot=0,wt=0,Jt=0;for(const lt of G)Ot+=lt.bac*r(ht,lt.bStart,lt.bEnd),wt+=f(lt,ht,x),lt.ac!=null&&ht>=x&&(Jt+=lt.ac);pt.push({date:ht,pv:Ot,ev:wt,ac:Jt})}return pt}function I(){const dt=$;return`
|
|
918
|
+
.${dt}{font:var(--lattice-font-size)/var(--lattice-line-height) var(--lattice-font-family);color:var(--lattice-foreground);box-sizing:border-box;border:1px solid var(--lattice-border-color);border-radius:var(--lattice-radius);padding:8px;background:var(--lattice-background)}
|
|
919
|
+
.${dt} *{box-sizing:border-box}
|
|
920
|
+
.${dt}__plot{display:block;max-width:100%}
|
|
921
|
+
.${dt}__axis{stroke:var(--lattice-border-strong);stroke-width:1}
|
|
922
|
+
.${dt}__grid{stroke:var(--lattice-border-color);stroke-width:1}
|
|
923
|
+
.${dt}__ticklabel{fill:var(--lattice-foreground-muted);font-size:var(--lattice-font-size-sm)}
|
|
924
|
+
.${dt}__series{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
|
|
925
|
+
.${dt}__series--pv{stroke:var(--lattice-accent)}
|
|
926
|
+
.${dt}__series--ev{stroke:var(--lattice-success)}
|
|
927
|
+
.${dt}__series--ac{stroke:var(--lattice-variant-danger-solid)}
|
|
928
|
+
.${dt}__status{stroke:var(--lattice-foreground-muted);stroke-width:1.5;stroke-dasharray:4 3}
|
|
929
|
+
.${dt}__legend{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:6px}
|
|
930
|
+
.${dt}__legend-item{white-space:nowrap}
|
|
931
|
+
.${dt}__swatch{display:inline-block;width:10px;height:10px;border-radius:var(--lattice-radius-sm);margin-right:4px;vertical-align:middle}
|
|
932
|
+
.${dt}__swatch--pv{background:var(--lattice-accent)}
|
|
933
|
+
.${dt}__swatch--ev{background:var(--lattice-success)}
|
|
934
|
+
.${dt}__swatch--ac{background:var(--lattice-variant-danger-solid)}
|
|
935
|
+
.${dt}__index{color:var(--lattice-foreground-muted)}
|
|
936
|
+
.${dt}__table{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
|
|
937
|
+
@scope ([data-theme="dark"]){:scope.${dt},.${dt}{color-scheme:dark}}
|
|
938
|
+
@scope ([data-theme="light"],[data-theme="auto"]){:scope.${dt},.${dt}{color-scheme:light}}
|
|
939
|
+
@media (prefers-color-scheme:dark){@scope ([data-theme="auto"]){:scope.${dt},.${dt}{color-scheme:dark}}}
|
|
940
|
+
`.trim()}function O(dt){const kt=dt.documentElement;if(!kt||kt.getAttribute(h))return;kt.setAttribute(h,"1");const Tt=dt.createElement("style");Tt.textContent=I(),(dt.head||dt.body||kt).appendChild(Tt)}function B(dt){const kt=Number.isFinite(dt)?dt:0,Tt=Math.abs(kt-Math.round(kt))<1e-9?Math.round(kt):l(kt);return String(Tt).replace(/\B(?=(\d{3})+(?!\d))/g,",")}function H(dt){return u(dt)??String(dt)}function z(dt){return dt==null||!Number.isFinite(dt)?"—":dt.toFixed(2)}class at{#t;#i;#e;#n;#s=null;#o=null;#l=!1;#h;constructor(kt,Tt,Ft={}){this.#t=kt,this.#i=Tt,this.#e=Tt.ownerDocument,this.#n={...y,...Ft},this.#h=o(kt,()=>this.#n.messages),O(this.#e),this.#s=K(this.#e,"div",$),this.#i.appendChild(this.#s),this.#o=kt.on("schedule",()=>this.draw()),this.draw()}get element(){return this.#s}get options(){return{...this.#n}}#f(){if(this.#n.statusDate!=null){const Tt=k(this.#n.statusDate);if(Number.isFinite(Tt))return Tt}const kt=this.#t.schedule;return kt&&kt.ok?kt.projectFinish:0}draw(){if(this.#l||!this.#s)return;for(;this.#s.firstChild;)this.#s.removeChild(this.#s.firstChild);const kt=this.#t.schedule;if(!kt||!kt.ok)return;const Tt=Math.max(80,Number(this.#n.width)||640),Ft=Math.max(80,Number(this.#n.height)||220),P={top:16,right:16,bottom:26,left:48},j=this.#f(),x=D(this.#t.tasks,kt,{statusDate:j,bucket:this.#n.bucket,costField:this.#n.costField,actualCostField:this.#n.actualCostField}),R=U(this.#e,"svg",{class:`${$}__plot`,width:Tt,height:Ft,viewBox:`0 0 ${Tt} ${Ft}`,role:"img","aria-label":"S-curve: cumulative planned value, earned value and actual cost"});if(this.#s.appendChild(R),!x.length)return;const N={min:Math.floor(kt.projectStart),max:Math.ceil(kt.projectFinish)},X=v(N,[P.left,Tt-P.right]),G=b(x.flatMap(wt=>[wt.pv,wt.ev,wt.ac]),{zero:!0}),J=v(G,[Ft-P.bottom,P.top]),Q=Tt-P.left-P.right;for(const wt of J.ticks(5)){const Jt=l(J.of(wt));R.appendChild(U(this.#e,"line",{class:`${$}__grid`,x1:P.left,y1:Jt,x2:Tt-P.right,y2:Jt}));const lt=U(this.#e,"text",{class:`${$}__ticklabel`,x:P.left-6,y:Jt+3,"text-anchor":"end"});Y(lt,B(wt)),R.appendChild(lt)}const pt=X.ticks(Math.max(2,Math.min(8,Math.floor(Q/60))));for(const wt of pt){const Jt=l(X.of(wt)),lt=U(this.#e,"text",{class:`${$}__ticklabel`,x:Jt,y:Ft-P.bottom+14,"text-anchor":"middle"});Y(lt,H(wt)),R.appendChild(lt)}R.appendChild(U(this.#e,"line",{class:`${$}__axis`,x1:P.left,y1:Ft-P.bottom,x2:Tt-P.right,y2:Ft-P.bottom})),R.appendChild(U(this.#e,"line",{class:`${$}__axis`,x1:P.left,y1:P.top,x2:P.left,y2:Ft-P.bottom}));for(const wt of["pv","ev","ac"]){const Jt=[];for(const nt of x)Jt.push(Jt.length?"L":"M",l(X.of(nt.date)),l(J.of(nt[wt])));const lt=U(this.#e,"path",{class:`${$}__series ${$}__series--${wt}`,d:W(Jt),"data-series":wt});R.appendChild(lt)}if(j>=N.min&&j<=N.max){const wt=l(X.of(j));R.appendChild(U(this.#e,"line",{class:`${$}__status`,x1:wt,y1:P.top,x2:wt,y2:Ft-P.bottom,"data-status":String(j)}))}const st=C(this.#t.tasks,kt,{statusDate:j,costField:this.#n.costField,actualCostField:this.#n.actualCostField}),ht=K(this.#e,"div",`${$}__legend`);for(const[wt,Jt]of[["pv","PV"],["ev","EV"],["ac","AC"]]){const lt=K(this.#e,"span",`${$}__legend-item`),nt=K(this.#e,"span",`${$}__swatch ${$}__swatch--${wt}`);nt.setAttribute("aria-hidden","true"),lt.appendChild(nt),lt.appendChild(this.#e.createTextNode(Jt)),ht.appendChild(lt)}const Ot=K(this.#e,"span",`${$}__index`);Y(Ot,`${this.#h("gantt.scurve.spi",{index:z(st.project.spi)})} · ${this.#h("gantt.scurve.cpi",{index:z(st.project.cpi)})}`),ht.appendChild(Ot),this.#s.appendChild(ht),this.#s.appendChild(this.#p(x))}#p(kt){const Tt=K(this.#e,"table",`${$}__table`),Ft=K(this.#e,"thead",""),P=K(this.#e,"tr","");for(const x of["Date","PV","EV","AC"]){const R=K(this.#e,"th","");Y(R,x),P.appendChild(R)}Ft.appendChild(P),Tt.appendChild(Ft);const j=K(this.#e,"tbody","");for(const x of kt){const R=K(this.#e,"tr","");for(const N of[H(x.date),B(x.pv),B(x.ev),B(x.ac)]){const X=K(this.#e,"td","");Y(X,N),R.appendChild(X)}j.appendChild(R)}return Tt.appendChild(j),Tt}refresh(){this.draw()}destroy(){this.#l||(this.#l=!0,this.#o&&this.#o(),this.#o=null,this.#s&&this.#s.parentNode&&this.#s.parentNode.removeChild(this.#s),this.#s=null)}}}),ae("packages/modules/gantt/selection.js",function(p,V){"use strict";Object.defineProperty(p,"GanttSelection",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"rangeBetween",{enumerable:!0,get:function(){return U}}),Object.defineProperty(p,"toggleId",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"stepInOrder",{enumerable:!0,get:function(){return Y}});class St{#t=[];#i=new Set;#e=null;#n=null;ids(){return this.#t.slice()}get size(){return this.#t.length}has(l){return this.#i.has(String(l))}get anchor(){return this.#e}setAnchor(l){this.#e=l==null?null:String(l)}replace(l){const L=[],v=new Set;for(const k of l){const u=String(k);v.has(u)||(v.add(u),L.push(u))}const b=L.filter(k=>!this.#i.has(k)),w=this.#t.filter(k=>!v.has(k));return this.#t=L,this.#i=v,this.#e!=null&&!v.has(this.#e)&&(this.#e=null),{added:b,removed:w}}noteVisible(l){this.#n=l==null?null:new Set([...l].map(String))}hidden(){if(!this.#n)return[];const l=this.#n;return this.#t.filter(L=>!l.has(L))}}function U(W,l,L){const v=String(l);if(W==null)return[v];const b=L.indexOf(String(W)),w=L.indexOf(v);if(b<0||w<0)return[v];const[k,u]=b<=w?[b,w]:[w,b];return L.slice(k,u+1)}function K(W,l){const L=String(l);return W.some(v=>String(v)===L)?W.filter(v=>String(v)!==L):[...W.map(String),L]}function Y(W,l,L){if(!L.length)return null;if(W==null)return l>0?L[0]:L[L.length-1];const v=L.indexOf(String(W));if(v<0)return l>0?L[0]:L[L.length-1];const b=Math.min(L.length-1,Math.max(0,v+l));return L[b]}}),ae("packages/modules/gantt/conflicts.js",function(p,V){"use strict";Object.defineProperty(p,"CONFLICT_CONSTRAINT_CODES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(p,"conflictKey",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"deriveConflicts",{enumerable:!0,get:function(){return k}}),Object.defineProperty(p,"diffConflicts",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"publicConflict",{enumerable:!0,get:function(){return g}});const St=V("packages/modules/gantt/time.js"),U=St.toDayNumber,K=St.toISODate,Y=Object.freeze(["MSO","MFO","SNET","SNLT","FNET","FNLT"]);function W(d){const S=(d.tasks||[]).map(String).slice().sort().join(","),_=(d.links||[]).map(C=>`${C.from}>${C.to}`).slice().sort().join("|");return`${d.kind}#${S}#${_}`}function l(d){return d.key=W(d),d}function L(d,S,_){const C=d.map(String),a=[];for(let $=0;$<C.length-1;$+=1)a.push({from:C[$],to:C[$+1]});const o=[...new Set(C)],m=C.map($=>_($)).join(" → ");return l({kind:"cycle",tasks:o,links:a,message:S("gantt.issues.cycle",{tasks:m})})}function v(d,S,_){const C=String(d.id);return l({kind:"constraint",tasks:[C],links:[],message:S("gantt.issues.constraint",{task:_(C),constraint:d.type,date:K(d.date)})})}function b(d,S,_){const C=String(d.id),a=d.from!==void 0?[{from:String(d.from),to:String(d.to)}]:[];return l({kind:"lock",tasks:[C],links:a,message:S("gantt.issues.lock",{task:_(C)})})}function w(d,S,_,C){return l({kind:"deadline",tasks:[d],links:[],message:_("gantt.issues.deadline",{task:C(d),date:K(S)})})}function k(d,S){const _=[];if(!d)return _;const{t:C,nameOf:a}=S;if(d.ok===!1){const m=d.error;return m&&m.code==="cycle"&&Array.isArray(m.cycle)&&m.cycle.length&&_.push(L(m.cycle,C,a)),_}const o=Array.isArray(d.conflicts)?d.conflicts:[];for(const m of o)m.type==="LOCKED"?_.push(b(m,C,a)):Y.includes(m.type)&&_.push(v(m,C,a));return typeof S.deadlineOf=="function"&&d.tasks&&typeof d.tasks.forEach=="function"&&d.tasks.forEach((m,$)=>{if(!m||m.isSummary)return;const h=S.rawById(String($)),y=h?U(S.deadlineOf(h)):null;y!=null&&m.ef>y+1e-9&&_.push(w(String($),y,C,a))}),_}function u(d,S){const _=new Map((d||[]).map(m=>[m.key||W(m),m])),C=new Map((S||[]).map(m=>[m.key||W(m),m])),a=[],o=[];for(const[m,$]of C)_.has(m)||a.push($);for(const[m,$]of _)C.has(m)||o.push($);return{added:a,resolved:o}}function g(d){return{kind:d.kind,tasks:d.tasks.slice(),links:d.links.map(S=>({...S})),message:d.message}}}),ae("packages/modules/gantt/read-only.js",function(p,V){"use strict";Object.defineProperty(p,"isTaskReadOnly",{enumerable:!0,get:function(){return St}});function St(U,K){if(!U)return!1;if(U.readOnly===!0)return!0;if(typeof K=="function")try{return!!K(U)}catch{return!1}return!1}}),ae("packages/core/src/registry/free-tier-notice.js",function(p,V){"use strict";Object.defineProperty(p,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"WATERMARK_TEXT",{enumerable:!0,get:function(){return U}});const St="Free for non-commercial use: latticegrid.dev/free",U="Unlicensed: Lattice Grid trial"}),ae("packages/core/src/registry/licence.js",function(p,V){"use strict";Object.defineProperty(p,"PRODUCT",{enumerable:!0,get:function(){return W}}),Object.defineProperty(p,"LICENCE_VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(p,"PUBLIC_KEY",{enumerable:!0,get:function(){return b}}),Object.defineProperty(p,"fromBase64Url",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"toBase64Url",{enumerable:!0,get:function(){return g}}),Object.defineProperty(p,"asciiBytes",{enumerable:!0,get:function(){return d}}),Object.defineProperty(p,"parseLicence",{enumerable:!0,get:function(){return _}}),Object.defineProperty(p,"hasEd25519",{enumerable:!0,get:function(){return i}}),Object.defineProperty(p,"verifyLicence",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"isLocalHost",{enumerable:!0,get:function(){return f}}),Object.defineProperty(p,"currentHost",{enumerable:!0,get:function(){return M}}),Object.defineProperty(p,"matchesDomain",{enumerable:!0,get:function(){return D}}),Object.defineProperty(p,"LicenceHolder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(p,"setLicence",{enumerable:!0,get:function(){return at}}),Object.defineProperty(p,"licenceInfo",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(p,"watermark",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(p,"licenceState",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(p,"sharedLicence",{enumerable:!0,get:function(){return Ft}});const U=V("packages/core/src/internal/warn.js").warnOnce,K=V("packages/core/src/registry/free-tier-notice.js"),Y=K.FREE_TIER_NOTICE;Object.defineProperty(p,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return K.FREE_TIER_NOTICE}});const W="lattice-grid",l=1,L="LG1",v=64,b="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",k=(()=>{const P=new Int16Array(128).fill(-1);for(let j=0;j<w.length;j++)P[w.charCodeAt(j)]=j;return P[43]=62,P[47]=63,P})();function u(P){if(typeof P!="string")return null;let j="";for(let J=0;J<P.length;J++){const Q=P.charCodeAt(J);if(Q!==61){if(Q>127||k[Q]<0)return null;j+=P[J]}}const x=j.length;if(x%4===1)return null;const R=new Uint8Array(Math.floor(x*3/4));let N=0,X=0,G=0;for(let J=0;J<x;J++)N=N<<6|k[j.charCodeAt(J)],X+=6,X>=8&&(X-=8,R[G++]=N>>X&255);return G===R.length?R:R.subarray(0,G)}function g(P){let j="",x=0;for(;x+2<P.length;x+=3){const N=P[x]<<16|P[x+1]<<8|P[x+2];j+=w[N>>18&63]+w[N>>12&63]+w[N>>6&63]+w[N&63]}const R=P.length-x;if(R===1){const N=P[x]<<16;j+=w[N>>18&63]+w[N>>12&63]}else if(R===2){const N=P[x]<<16|P[x+1]<<8;j+=w[N>>18&63]+w[N>>12&63]+w[N>>6&63]}return j}function d(P){const j=new Uint8Array(P.length);for(let x=0;x<P.length;x++)j[x]=P.charCodeAt(x)&127;return j}function S(P){if(typeof TextDecoder=="function")return new TextDecoder().decode(P);let j="";for(let x=0;x<P.length;x++)j+=String.fromCharCode(P[x]);return j}function _(P){const j={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof P=="string"?P:""};if(typeof P!="string"||P.length===0)return{...j,reason:"missing"};const x=P.trim(),R=x.split(".");if(R.length!==3)return j;const[N,X,G]=R;if(N!==L)return{...j,reason:"prefix"};const J=u(X),Q=u(G);if(!J||!Q)return j;let pt;try{pt=JSON.parse(S(J))}catch{return j}return pt===null||typeof pt!="object"?j:{ok:!0,reason:null,product:typeof pt.p=="string"?pt.p:null,issuedTo:typeof pt.t=="string"?pt.t:null,expires:typeof pt.e=="string"?pt.e:null,terms:typeof pt.terms=="string"?pt.terms:null,features:Array.isArray(pt.f)?pt.f.slice():[],deployments:Array.isArray(pt.d)?pt.d.slice():[],version:typeof pt.v=="number"?pt.v:0,message:d(X),signature:Q,raw:x}}function C(P,j){if(!P)return!1;const x=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(P)?`${P}T23:59:59.999Z`:P);return Number.isNaN(x)?!0:j>x}function a(P){return P==="non-commercial"?"non-commercial":"commercial"}let o=null,m=null,$=null;function h(){const P=globalThis.crypto;return P&&P.subtle?P.subtle:null}async function y(P){if(o&&m===P)return o;const j=h();if(!j)return null;const x=u(P);if(!x)return null;try{const R=await j.importKey("raw",x,{name:"Ed25519"},!1,["verify"]);return o=R,m=P,R}catch{return null}}async function i(){return $!==null||($=await y(b)!==null),$}async function r(P,j={}){const x=j.warn!==!1,R=j.product||W,N=j.publicKey||b,X=j.now??Date.now(),G=j.host??M(),J=f(G)?"":` ${Y}`,Q=_(P);if(!Q.ok){const wt=Q.reason==="missing"?"missing":"malformed";return x&&U(`licence.${wt}`,wt==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${J}`:`licence key could not be read. The grid will render with a watermark.${J}`),{valid:!1,reason:wt,terms:"commercial"}}const pt={product:Q.product||void 0,issuedTo:Q.issuedTo||void 0,expires:Q.expires||void 0,terms:a(Q.terms)};if(Q.product!==R)return x&&U("licence.product",`licence key is for '${Q.product}', not '${R}'. The grid will render with a watermark.`),{valid:!1,...pt,reason:"product"};if(C(Q.expires,X))return x&&U("licence.expired",`licence expired on ${Q.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...pt,reason:"expired"};const st=Q.deployments||[];if(st.length&&G&&!f(G)&&!D(G,st))return x&&U("licence.domain",`licence key is not valid for ${G}; it covers ${st.join(", ")}. The grid will render with a watermark.`),{valid:!1,...pt,reason:"domain"};const ht=await y(N);if(!ht){const wt=!!Q.signature&&Q.signature.length===v;return x&&U("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),wt?{valid:!0,...pt,reason:"unverified"}:{valid:!1,...pt,reason:"signature"}}let Ot=!1;try{Ot=await h().verify({name:"Ed25519"},ht,Q.signature,Q.message)}catch{Ot=!1}return Ot?{valid:!0,...pt}:(x&&U("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...pt,reason:"signature"})}function f(P){const j=String(P??M()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!j||j==="localhost"||j.endsWith(".localhost")||j==="::1"||j==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(j)}function M(){const P=globalThis.location;return P&&typeof P.hostname=="string"?P.hostname:null}function D(P,j){const x=I(P);return!x||!Array.isArray(j)?!1:j.some(R=>{const N=I(R);if(!N)return!1;if(N==="*")return!0;if(N.startsWith("*.")){const X=N.slice(2);return x===X||x.endsWith(`.${X}`)}return x===N})}function I(P){return String(P??"").trim().toLowerCase().replace(/\.$/,"")}class O{#t="";#i={valid:!1,reason:"missing",terms:"commercial"};#e=null;#n=null;#s;#o=new Set;constructor(j={}){this.#s=j}set(j){this.#t=typeof j=="string"?j.trim():"";const x=_(this.#t);return this.#i=x.ok?{valid:!C(x.expires,Date.now())&&x.product===(this.#s.product||W),product:x.product||void 0,issuedTo:x.issuedTo||void 0,expires:x.expires||void 0,terms:a(x.terms),reason:"pending"}:{valid:!1,reason:x.reason||"malformed",terms:"commercial"},this.#e=null,this.#t&&this.verify(),this.#i}verify(){if(this.#e)return this.#e;const j=this.#t;return this.#e=r(j,this.#s).then(x=>{if(this.#t===j){this.#i=x;for(const R of this.#o)R(x)}return x}),this.#e}onSettled(j){return this.#o.add(j),()=>this.#o.delete(j)}info(){return{...this.#i}}watermark(){return this.#i.valid?!1:!f(this.#n)}setHost(j){this.#n=j}state(){return this.#i.valid?"licensed":f(this.#n)?"localhost":"trial"}reset(){this.#t="",this.#i={valid:!1,reason:"missing",terms:"commercial"},this.#e=null,this.#o.clear()}}const B=Symbol.for("lattice-grid/licence/holder");function H(){const P=globalThis,j=P&&P[B];if(j&&typeof j.set=="function"&&typeof j.watermark=="function")return j;const x=new O;if(P)try{P[B]=x}catch{}return x}const z=H();function at(P){return z.set(P)}function dt(){return z.info()}function kt(){return z.watermark()}function Tt(){return z.state()}function Ft(){return z}}),ae("packages/dom/src/watermark.js",function(p,V){"use strict";Object.defineProperty(p,"WATERMARK_CLASS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(p,"WATERMARK_LAYER_CLASS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(p,"Watermark",{enumerable:!0,get:function(){return h}}),Object.defineProperty(p,"viewLicenceHost",{enumerable:!0,get:function(){return y}}),Object.defineProperty(p,"mountViewWatermark",{enumerable:!0,get:function(){return r}}),Object.defineProperty(p,"default",{enumerable:!0,get:function(){return f}});const U=V("packages/core/src/internal/predicates.js").isFunction,K=V("packages/core/src/registry/free-tier-notice.js"),Y=K.FREE_TIER_NOTICE,W=K.WATERMARK_TEXT,l=V("packages/core/src/registry/licence.js"),L=l.watermark,v=l.setLicence,b=Object.freeze({t:M=>M==="licence.watermark.free"?Y:W});function w(M,D,I={}){const O=M.createElement(D);if(I.class)for(const B of I.class.split(/\s+/))B&&O.classList.add(B);if(I.text!==void 0&&(O.textContent=I.text),I.attrs)for(const[B,H]of Object.entries(I.attrs))O.setAttribute(B,H);if(I.children)for(const B of I.children)O.appendChild(B);return O}function k(M,D,I){return M.addEventListener(D,I),()=>M.removeEventListener(D,I)}const u="lat-watermark",g="https://www.latticegrid.dev",d=["br","bl","tl","tr"],S=4e3,_={header:"lat-header",stickyTop:"lat-sticky-top",stickyBottom:"lat-sticky-bottom",statusBar:"lat-status-bar"},C=Symbol.for("lattice-grid/licence/holder"),a="data-lat-watermark-owner",o="lat-watermark-layer",m="lat-watermark-style",$=`
|
|
932
941
|
.${o}{position:absolute;inset:0;pointer-events:none;z-index:2147483000;overflow:hidden}
|
|
933
942
|
.${o} .${u}{position:absolute;z-index:6;padding:10px 18px;border-radius:var(--lattice-radius-sm,4px);background:var(--lattice-accent,#2563eb);box-shadow:0 2px 10px rgb(0 0 0 / 25%);color:var(--lattice-accent-contrast,#fff);font:700 15px/1.3 system-ui,sans-serif;letter-spacing:.02em;white-space:nowrap;pointer-events:none;opacity:.94}
|
|
934
943
|
.${o} .${u}--br{inset-inline-end:0;bottom:0}
|
|
@@ -938,7 +947,7 @@ ${an(it)}
|
|
|
938
947
|
.${o} .${u}__link{color:inherit;pointer-events:auto;text-decoration:underline;text-underline-offset:2px}
|
|
939
948
|
.${o} .${u}__free{display:block;margin-top:2px;font-size:12px;font-weight:500;letter-spacing:0;opacity:.92}
|
|
940
949
|
@media print{.${o} .${u}{opacity:1}}
|
|
941
|
-
`;class h{#t;#i;#e;#n=null;#s=[];#o;#l=0;#d=null;#g=null;#p=!1;#h=null;#a=null;#f=null;constructor(j){this.#g=j.owner||null;const I=j.area;I&&!U(I)&&U(I.getBoundingClientRect)&&(this.#a=I),U(I)?this.#f=I:I&&U(I.getBoundingClientRect)&&(this.#f=()=>I.getBoundingClientRect()),this.#g&&U(this.#g.setAttribute)&&this.#g.setAttribute(a,""),this.#t=j.grid,this.#i=j.document,this.#e=j.element,this.#o=j.window||(typeof globalThis>"u"?{}:globalThis)}mount(){this.refresh(),U(this.#t.on)&&this.#s.push(this.#t.on("licence:changed",()=>this.refresh()));const j=this.#t.licence&&this.#t.licence.ready;j&&U(j.then)&&j.then(()=>this.refresh(),()=>this.refresh())}refresh(){const j=this.#y()&&!this.#c();j&&!this.#n?(this.#w(),this.#r()):!j&&this.#n&&(this.#T(),this.#m())}#c(){const j=this.#e;let I=j&&j.parentNode;for(this.#g&&I===this.#g&&(I=I.parentNode);I&&I.nodeType===1;){if(U(I.hasAttribute)&&I.hasAttribute(a))return!0;I=I.parentNode}return!1}#b(){const j=this.#o;if(!j||!U(j.matchMedia))return!1;try{return!!j.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}#r(){this.#m(),U(this.#o.setTimeout)&&(this.#b()||(this.#d=this.#o.setTimeout(()=>{if(this.#d=null,!this.#y()||this.#c()){this.#T();return}this.#l=(this.#l+1)%d.length,this.#T(),this.#w(),this.#r()},S)))}#m(){this.#d!==null&&U(this.#o.clearTimeout)&&this.#o.clearTimeout(this.#d),this.#d=null}#y(){const j=this.#t.licence;return!!(j&&U(j.watermark)&&j.watermark())}#D(){const j=this.#e;if(!j||!U(j.getBoundingClientRect)||!j.parentNode||!j.parentNode.children)return null;const I=j.parentNode,O=j.getBoundingClientRect();if(this.#f){const Ft=this.#f();if(Ft&&(Ft.width>0||Ft.height>0)){const D=Math.max(O.top,Ft.top);return{top:D,bottom:Math.max(D,Math.min(O.bottom,Ft.bottom)),layerTop:O.top,layerBottom:O.bottom}}return null}const z=Ft=>{const D=Array.from(I.children).find(x=>x.classList&&U(x.classList.contains)&&x.classList.contains(Ft));if(!D||!U(D.getBoundingClientRect))return null;const P=D.getBoundingClientRect();return P.width>0||P.height>0?P:null},W=z(_.header),B=z(_.stickyTop),at=z(_.stickyBottom),ct=z(_.statusBar),kt=Math.max(O.top,W?W.bottom:-1/0,B?B.bottom:-1/0),Tt=Math.min(O.bottom,at?at.top:1/0,ct?ct.top:1/0);return{top:kt,bottom:Math.max(kt,Tt),layerTop:O.top,layerBottom:O.bottom}}#P(){const j=this.#n;if(!j||!U(j.getBoundingClientRect))return;const I=this.#D();if(!I)return;const O=d[this.#l],z=j.getBoundingClientRect().height,W=I.bottom-I.top,ct=(O==="tl"||O==="tr")&&W<z*2?O==="tl"?"bl":"br":O;ct!==O&&(j.classList.remove(`${u}--${O}`),j.classList.add(`${u}--${ct}`)),ct==="tl"||ct==="tr"?(j.style.top=`${Math.max(0,I.top-I.layerTop)}px`,j.style.bottom=""):(j.style.bottom=`${Math.max(0,I.layerBottom-I.bottom)}px`,j.style.top="")}#w(){const j=this.#t.messages&&U(this.#t.messages.t)?this.#t.messages:m,I=w(this.#i,"a",{class:`${u}__link`,text:j.t("licence.watermark"),attrs:{href:f,target:"_blank",rel:"noopener noreferrer"}}),O=w(this.#i,"span",{class:`${u}__free`,text:j.t("licence.watermark.free")});this.#n=w(this.#i,"div",{class:`${u} ${u}--${d[this.#l]}`,attrs:{role:"note",title:"This grid is unlicensed for this domain. Visit latticegrid.dev for a licence."},children:[I,O]}),this.#s.push(k(this.#n,"pointerdown",W=>{U(W.stopPropagation)&&W.stopPropagation()})),this.#e&&U(this.#e.appendChild)&&this.#e.appendChild(this.#n),this.#P();const z=this.#o&&this.#o.ResizeObserver;if(U(z)){this.#h=new z(()=>{this.#n&&this.#P()}),U(this.#h.observe)&&this.#e&&this.#h.observe(this.#e);const W=this.#a;W&&U(this.#h.observe)&&this.#h.observe(W)}typeof queueMicrotask=="function"&&!this.#p&&(this.#p=!0,queueMicrotask(()=>{this.#p=!1,this.#n&&this.#c()&&(this.#T(),this.#m())}))}#T(){this.#h&&(U(this.#h.disconnect)&&this.#h.disconnect(),this.#h=null),this.#n&&U(this.#n.remove)&&this.#n.remove(),this.#n=null}destroy(){this.#m(),this.#g&&U(this.#g.removeAttribute)&&this.#g.removeAttribute(a);for(const j of this.#s)j();this.#s=[],this.#T()}}function y(T={},j=void 0){const I=globalThis[C],O=!T.licence&&j&&U(j.querySelector)?j.querySelector('meta[name="lattice-license"]')?.getAttribute("content"):null,z=T.licence||O;return z&&v(z),{licence:{watermark:()=>L(),get ready(){return I?I.verify():Promise.resolve()}},on:(W,B)=>W==="licence:changed"&&I?I.onSettled(()=>B()):()=>{}}}function i(T,j){return()=>{let I=1/0,O=-1/0,z=0;for(const W of T.querySelectorAll(j)){const B=W.getBoundingClientRect();B.width===0&&B.height===0||(I=Math.min(I,B.top),O=Math.max(O,B.bottom),z=Math.max(z,B.width))}return I===1/0?null:{top:I,bottom:O,width:z,height:O-I}}}function r(T,j={},I=null){const O=T&&T.ownerDocument;if(!O||!U(O.createElement))return{destroy(){},refresh(){}};const z=O.defaultView||void 0,W=y(j,O),B=typeof I=="string"?i(T,I):I;let at=null,ct=null,kt=null,Tt=!1;const Ft=()=>{if(!O.getElementById(p)&&O.head){const x=O.createElement("style");x.id=p,x.textContent=$,O.head.appendChild(x)}z&&U(z.getComputedStyle)&&z.getComputedStyle(T).position==="static"&&(T.style.position="relative"),at=O.createElement("div"),at.className=o,T.appendChild(at),ct=new h({grid:W,document:O,element:at,window:z,owner:T,area:B}),ct.mount(),z&&U(z.MutationObserver)&&(kt=new z.MutationObserver(()=>{!Tt&&at&&at.parentNode!==T&&T.appendChild(at)}),kt.observe(T,{childList:!0}))},D=()=>{Tt||(ct?ct.refresh():W.licence.watermark()&&Ft())};D();const P=W.on("licence:changed",D);return W.licence.ready,{refresh:D,destroy(){Tt||(Tt=!0,P(),kt&&kt.disconnect(),ct&&ct.destroy(),at&&at.parentNode&&at.parentNode.removeChild(at))}}}const b=h}),ae("packages/modules/gantt/resource-view.js",function(g,V){"use strict";Object.defineProperty(g,"makeCreateResourceView",{enumerable:!0,get:function(){return Y}});const St=220;function U(H,l){const L={external:Array.isArray(l)?l:[]};for(const v of["unit","thresholds","columns","labelWidth","showUnassigned","decimals","totals","hoursPerDay","groupBy"])H[v]!==void 0&&(L[v]=H[v]);return L.labelWidth===void 0&&(L.labelWidth=St),L}function K(H,l,L){if(!H||!H.ownerDocument)return null;const v=Array.isArray(l.resources)?l.resources:[];let m=Array.isArray(l.bookings)?l.bookings:[];const w=L({tasks:[],resources:v,hoursPerDay:l.hoursPerDay,calendar:l.calendar,weekStartDay:l.weekStartDay,fields:l.fields,messages:l.messages}),k=w.mountSplit(H,{resourceOnly:!0,editable:!1,workload:U(l,m),histogram:l.histogram??null,createGrid:l.createGrid,gridConfig:l.gridConfig,gridWidth:l.gridWidth,rowHeight:l.rowHeight,height:l.height,zoom:l.zoom,today:l.today,weekStartDay:l.weekStartDay,messages:l.messages});return{gantt:w,view:k,get grid(){return k?k.grids.workload:null},setBookings(u){m=Array.isArray(u)?u:[],k&&k.setWorkloadBookings(m)},setZoom(u){k&&k.setZoom(u)},setUnit(u){k&&k.setWorkloadUnit(u)},getUnit(){return k?k.getWorkloadUnit():"hours"},toggleResource(u,f){k&&k.toggleResource(u,f)},toggleGroup(u){k&&k.toggleWorkloadGroup(u)},getColumnWidths(){return k?k.getColumnWidths():{}},setColumnWidths(u){k&&k.setColumnWidths(u)},toSVG(u){return k?k.toSVG(u):""},on(u,f){w.on(u,f)},off(u,f){w.off(u,f)},destroy(){k&&k.destroy(),w.destroy()}}}function Y(H){return function(L,v={}){return K(L,v||{},H)}}}),ae("packages/modules/gantt/index.js",function(g,V){"use strict";Object.defineProperty(g,"GANTT_STATE_VERSION",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(g,"createResourceView",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(g,"createGantt",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(g,"default",{enumerable:!0,get:function(){return Le}});const U=V("packages/core/src/internal/warn.js").warnOnce,Y=V("packages/core/src/internal/predicates.js").isObject,l=V("packages/modules/shared/emitter.js").Emitter,v=V("packages/core/src/model/history.js").HistoryModel,m=V("packages/modules/gantt/schedule.js"),w=m.computeSchedule,k=m.findViolations,u=m.normalizeLinkSpec,f=m.taskIdReader,d=m.taskFieldWriters,S=m.resolveSchedulingMode,_=m.reconcileEffort,C=m.isTaskLocked,a=m.wouldCreateCycle,o=V("packages/modules/gantt/resources.js"),p=o.computeResourceLoad,$=o.levelResources,h=o.normalizeResources,y=o.resourceDailyHours,i=o.parseAssignments,r=o.normalizeResourceRates,b=o.resourceDisplayNames,T=o.resourceSpecsByKey,j=o.resourceAvatars,I=V("packages/modules/gantt/cost.js"),O=I.computeCost,z=I.computeCostByBucket,W=V("packages/modules/gantt/earned-value.js"),B=W.computeEarnedValue,at=V("packages/modules/gantt/mspdi.js"),ct=at.importMSPDI,kt=at.exportMSPDI,Ft=V("packages/modules/gantt/wbs.js").deriveWbs,D=V("packages/modules/gantt/time.js"),P=D.toISODate,x=D.toDayNumber,N=V("packages/modules/gantt/calendar.js").createCalendar,X=V("packages/modules/gantt/week.js"),G=X.EXPLICIT_WEEK_START_DAY,J=X.resolveWeekStartDay,tt=X.validWeekStartDay,ft=V("packages/modules/gantt/workload.js"),st=ft.taskContour,ht=ft.contourSpan,Pt=ft.spanDuration,wt=ft.retimeContour,Jt=ft.recordWorkingDays,dt=ft.serializeContour,ot=V("packages/modules/gantt/render.js").GanttView,pt=V("packages/modules/gantt/split.js").GanttSplitView,Ot=V("packages/modules/gantt/events-pointer.js").GESTURE_EVENTS,gt=V("packages/modules/gantt/workload-events.js").WORKLOAD_CELL_EVENTS,jt=V("packages/modules/gantt/events-table.js").TABLE_EVENTS,mt=V("packages/modules/gantt/unscheduled.js").completeUnscheduledPatch,yt=V("packages/modules/gantt/scurve.js"),Q=yt.GanttSCurveView,Mt=yt.computeSCurve,Rt=V("packages/modules/gantt/change-events.js").createGanttChangeEvents,Vt=V("packages/modules/gantt/dirty-tracking.js").createGanttDirtyTracking,xt=V("packages/modules/gantt/selection.js"),Ht=xt.GanttSelection,ge=xt.rangeBetween,$e=xt.toggleId,qt=xt.stepInOrder,It=V("packages/modules/gantt/messages.js").createTranslator,Yt=V("packages/modules/gantt/paste.js").createPasteApi,bt=V("packages/modules/gantt/task-actions.js").createTaskActions,Ct=V("packages/modules/gantt/conflicts.js"),Dt=Ct.deriveConflicts,Bt=Ct.diffConflicts,Ut=Ct.publicConflict,de=V("packages/modules/gantt/read-only.js").isTaskReadOnly,we=V("packages/dom/src/watermark.js").mountViewWatermark,Fe=V("packages/modules/gantt/print.js"),Pe=Fe.ganttPrintModel,Ee=Fe.PDF_MODEL_KEY,_e=Fe.pdfModule,He=V("packages/modules/gantt/resource-view.js").makeCreateResourceView;Object.defineProperty(g,"computeSchedule",{enumerable:!0,get:function(){return m.computeSchedule}}),Object.defineProperty(g,"findViolations",{enumerable:!0,get:function(){return m.findViolations}}),Object.defineProperty(g,"normalizeTasks",{enumerable:!0,get:function(){return m.normalizeTasks}}),Object.defineProperty(g,"normalizeDependencies",{enumerable:!0,get:function(){return m.normalizeDependencies}}),Object.defineProperty(g,"topoOrder",{enumerable:!0,get:function(){return m.topoOrder}}),Object.defineProperty(g,"LINK_TYPES",{enumerable:!0,get:function(){return m.LINK_TYPES}}),Object.defineProperty(g,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return m.SCHEDULE_ERROR}}),Object.defineProperty(g,"EPS",{enumerable:!0,get:function(){return m.EPS}}),Object.defineProperty(g,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return m.CONSTRAINT_TYPES}}),Object.defineProperty(g,"SCHEDULING_MODES",{enumerable:!0,get:function(){return m.SCHEDULING_MODES}}),Object.defineProperty(g,"resolveSchedulingMode",{enumerable:!0,get:function(){return m.resolveSchedulingMode}}),Object.defineProperty(g,"reconcileEffort",{enumerable:!0,get:function(){return m.reconcileEffort}}),Object.defineProperty(g,"isTaskLocked",{enumerable:!0,get:function(){return m.isTaskLocked}}),Object.defineProperty(g,"toDayNumber",{enumerable:!0,get:function(){return D.toDayNumber}}),Object.defineProperty(g,"fromDayNumber",{enumerable:!0,get:function(){return D.fromDayNumber}}),Object.defineProperty(g,"toISODate",{enumerable:!0,get:function(){return D.toISODate}}),Object.defineProperty(g,"importMSPDI",{enumerable:!0,get:function(){return at.importMSPDI}}),Object.defineProperty(g,"exportMSPDI",{enumerable:!0,get:function(){return at.exportMSPDI}}),Object.defineProperty(g,"computeEarnedValue",{enumerable:!0,get:function(){return W.computeEarnedValue}}),Object.defineProperty(g,"computeCost",{enumerable:!0,get:function(){return I.computeCost}}),Object.defineProperty(g,"computeCostByBucket",{enumerable:!0,get:function(){return I.computeCostByBucket}}),Object.defineProperty(g,"computeSCurve",{enumerable:!0,get:function(){return yt.computeSCurve}});const ln=1,pn=He(Ge);function ne(ve){return Array.isArray(ve)?"array":ve===null?"null":typeof ve}function xe(ve){return Me=>{const Ze=ve(Me);if(typeof Ze=="string"||typeof Ze=="number"&&Number.isFinite(Ze))return Ze;throw new Error(`lattice-gantt: rowKey function must return a string or number; got ${ne(Ze)}.`)}}function Ge(ve={}){const Me=new l("gantt");let Ze=null;const We=(s,Z)=>{const $t=s;if(!$t||!$t.ownerDocument)return;Ze=we($t,Z||{},()=>{const Kt=$t.getBoundingClientRect(),be=$t.querySelector(".lat-gantt-split__body");let ce=null;if(be)ce=be.getBoundingClientRect().top;else{const ye=$t.querySelector(".lat-gantt svg"),Ne=Number((Z||{}).axisHeight);ye&&(ce=ye.getBoundingClientRect().top+(Number.isFinite(Ne)?Ne:22))}return ce===null?null:{top:ce,bottom:Kt.bottom,width:Kt.width,height:Kt.bottom-ce}}).destroy},je=()=>{Ze&&(Ze(),Ze=null)};let he=Array.isArray(ve.tasks)?ve.tasks.map(s=>({...s})):[],Ke=Array.isArray(ve.dependencies)?ve.dependencies.map(u):[];const zn=ve.projectStart,Yn=ve.deadline,Sn=ve.calendar??null,mn=Y(ve.calendars)?{...ve.calendars}:null,ri=N(Sn,x(zn)??0),Un=ri?s=>ri.isWorking(s):null,cn=ve.resources??null,Zn=ve.defaultCapacity,Wi=typeof ve.title=="string"?ve.title:null,hn=Number.isFinite(Number(ve.hoursPerDay))&&Number(ve.hoursPerDay)>0?Number(ve.hoursPerDay):8,ui=S(ve.schedulingMode)||"fixedDuration",di=!!ve.effortDriven,vi=typeof ve.lockWhen=="function"?ve.lockWhen:void 0,si=s=>{C(s.task,vi)&&s.preventDefault("locked")};Me.on("beforeTaskMove",si),Me.on("beforeTaskResize",si),Me.on("beforeMilestoneMove",si);const _i=typeof ve.readOnlyWhen=="function"?ve.readOnlyWhen:void 0,ji=!!ve.autoSchedule,Ni=!!ve.honourDates,rn=ve.grid??null,Si=tt(ve.weekStartDay),Li=Si??J(void 0,rn&&rn.messages?rn.messages.locale:void 0),bn=ve.columns&&typeof ve.columns=="object"?{...ve.columns}:null,sn=Y(ve.fields)?{...ve.fields}:{};if(ve.rowKey!==void 0&&typeof ve.rowKey!="function"&&!(typeof ve.rowKey=="string"&&ve.rowKey.length>0))throw new Error("lattice-gantt: rowKey must be a property name or a function; composite keys are not supported on tasks.");const Xn=typeof ve.rowKey=="function"?xe(ve.rowKey):ve.rowKey??(typeof sn.id=="string"?sn.id:"id"),qn=s=>String(typeof Xn=="function"?Xn(s):s[Xn]);sn.id===void 0&&(sn.id=s=>s&&s.id!=null?s.id:s?typeof Xn=="function"?Xn(s):s[Xn]:null);const on=f(sn),Ui=d(sn),yn=s=>Ui[s]||s,Ii=new Map;if(bn)for(const s of["start","end","duration","percentComplete","name"])bn[s]&&Ii.set(bn[s],s);let le=null,fn=!1,fe=null,Tn=null,Jn=null,oi=null,An=null;const Qn=new Set,kn=new Ht,Hn=[];function $i(s){return!!(s&&s.loadOnly===!0)}function xi(s,Z){const $t=new Set;for(const ce of s){if(!$i(ce))continue;const ye=on(ce);ye!=null&&$t.add(String(ye))}if(!$t.size)return{planTasks:s,planDeps:Z};const At=s.filter(ce=>!$i(ce)),Kt=Array.isArray(Z)?Z:[],be=Kt.filter(ce=>!$t.has(String(ce.from))&&!$t.has(String(ce.to)));return be.length!==Kt.length&&U("gantt-loadonly-dependency","[lattice] gantt: a dependency naming a load-only task is ignored; load-only bookings take no part in scheduling."),{planTasks:At,planDeps:be}}function Gi(){const s=y(cn,Zn,{calendar:Sn,calendars:mn,hoursPerDay:hn});return{projectStart:zn,deadline:Yn,calendar:Sn,calendars:mn,fields:sn,resources:Array.isArray(cn)?cn:void 0,honourDates:Ni,schedulingMode:ve.schedulingMode!=null?ui:void 0,effortDriven:ve.effortDriven!=null?di:void 0,hoursPerDay:hn,resourceHours:s,lockWhen:vi}}let Ci=[];function Ai(s){const Z=String(s);if(le&&le.ok&&le.tasks.has(Z)){const At=le.tasks.get(Z);if(At&&At.name!=null)return String(At.name)}const $t=ze(Z);return $t>=0&&he[$t]&&he[$t].name!=null?String(he[$t].name):Z}const Ki=It({grid:rn},()=>ve.messages);function Vi(s,Z){const $t=Dt(s,{t:Ki,nameOf:Ai,rawById:be=>{const ce=ze(be);return ce<0?null:he[ce]},deadlineOf:be=>be?be.deadline:null}),{added:At,resolved:Kt}=Bt(Ci,$t);Ci=$t,!(Z||!At.length&&!Kt.length)&&Me.emit("schedulingConflict",{conflicts:$t.map(Ut),added:At.map(Ut),resolved:Kt.map(Ut)})}function an(s){const{planTasks:Z,planDeps:$t}=xi(he,Ke),At=w(Z,$t,Gi());if(At.ok){Ni&&Array.isArray(At.dependencies)&&(Ke=At.dependencies.map(ce=>({...ce})));const Kt=Ft(At.order,ce=>{const ye=At.tasks.get(ce);return ye?ye.parent:null},ce=>{const ye=ze(ce),Ne=ye<0?null:he[ye].wbs;return typeof Ne=="string"&&Ne.trim()!==""?Ne.trim():null});for(const[ce,ye]of Kt){const Ne=At.tasks.get(ce);Ne&&(Ne.wbs=ye)}const be=p(he,At,{resources:cn,defaultCapacity:Zn,calendar:Sn,calendars:mn,fields:sn,hoursPerDay:hn});At.resourceLoad=be,At.overAllocations=be.overAllocations,le=At,Me.emit("schedule",At),Ri||(Ri=!0,Promise.resolve().then(()=>{fn||en.ready()}))}else Me.emit("error",At.error);return Vi(At,!!(s&&s.fromLoad)),At}function En(s,Z,$t,At,Kt){const be=ye=>{Me.emit(Z,{...$t,reason:ye})},ce=Me.emitBefore(s,$t);return ce===!0?At():ce===!1?be($t.reason||"prevented"):ce.then(ye=>ye?typeof Kt=="function"&&!Kt()?be("stale"):At():be($t.reason||"prevented"))}function ze(s){return he.findIndex(Z=>String(on(Z))===s)}function Gn(s,Z){return s?Z.some($t=>{const At=ze($t);return At>=0&&de(he[At],_i)}):!1}function Nn(s,Z,$t=null,At={}){const Kt=kn.replace(s);return Object.prototype.hasOwnProperty.call(At,"anchor")&&kn.setAnchor(At.anchor),!Kt.added.length&&!Kt.removed.length||(fe&&typeof fe.reflectSelection=="function"&&fe.reflectSelection(),Me.emit("selectionChange",{selectedIds:kn.ids(),added:Kt.added,removed:Kt.removed,cause:Z,event:$t})),Kt}function Yi(s,Z,$t){return En(s?"beforeTaskCollapse":"beforeTaskExpand",s?"taskCollapse:cancelled":"taskExpand:cancelled",Z,()=>{$t();const be={id:Z.id,expandedIds:Z.expandedIds,rawTask:Z.rawTask,task:Z.task,view:Z.view,event:Z.event};s?Me.emit("taskCollapse",be):Me.emit("taskExpand",be)})}function Zi(s,Z){const $t={resource:Z.resource,expandedResources:Z.expandedResources,view:Z.view,event:Z.event};s?Me.emit("resourceCollapse",$t):Me.emit("resourceExpand",$t)}function On(s){return`${String(s.from)}${String(s.to)}${s.type?String(s.type).toUpperCase():"FS"}`}function vn(s,Z,$t){const At=ze(s);if(At<0)return;const Kt={...he[At],[yn(Z)]:$t};he=he.slice(),he[At]=Kt}function Ln(s,Z){return he[s][yn(Z)]}function hi(s){const Z=le&&le.ok?le.tasks.get(s):null;if(Z)return!Z.isSummary&&!Z.isMilestone&&Z.duration!=null?Z.duration:null;const $t=ze(s),At=$t>=0?Number(Ln($t,"duration")):NaN;return Number.isFinite(At)?At:null}function Fi(s,Z){const $t=x(s),At=x(Z);return $t!=null&&At!=null?Math.max(0,At-$t):null}function Xi(s,Z){const $t={...s,...Z},At=yn("start"),Kt=yn("end"),be=yn("duration"),ce=Object.prototype.hasOwnProperty.call(Z,At),ye=Object.prototype.hasOwnProperty.call(Z,Kt);if(Object.prototype.hasOwnProperty.call(Z,be)||!ce&&!ye)return $t;if(ye){const Re=Fi(ce?Z[At]:s[At],Z[Kt]);return Re!=null&&($t[be]=Re),$t}const Ve=hi(String(on(s)));return Ve!=null&&($t[be]=Ve),$t}function qi(s){const Z=new Map;for(const $t of Array.isArray(s)?s:[]){const At=String(($t&&typeof $t=="object"?$t.resource??$t.name??$t.id:$t)??"");if(At==="")continue;const Kt=$t&&typeof $t=="object"&&$t.units!=null?Number($t.units):1;Z.set(At,{resource:At,units:Number.isFinite(Kt)&&Kt>=0?Kt:1})}return[...Z.values()]}function Ji(s){const Z=ze(s),$t=Z>=0?he[Z]:{},At=le&&le.ok?le.tasks.get(s):null,Kt=i($t),be=At&&At.schedulingMode||S($t.schedulingMode??$t.taskType)||ui,ce=At&&At.effortDriven!=null?!!At.effortDriven:$t.effortDriven!=null?!!$t.effortDriven:di,ye=At&&At.units!=null?At.units:Kt.reduce((Re,nn)=>Re+nn.units,0)||1,Ne=At&&At.duration!=null?At.duration:Number($t.duration)||0,Ve=At&&At.effort!=null&&At.duration>0&&ye>0?At.effort/(At.duration*ye):hn;return{mode:be,effortDriven:ce,duration:Ne,units:ye,hoursPerDay:Ve,assignments:Kt}}function ar(s,Z,$t){if(!Z.length)return;const At=Z.reduce((Kt,be)=>Kt+be.units,0)||1;vn(s,"assignments",Z.map(Kt=>({resource:Kt.resource,units:Kt.units*$t/At})))}function fi(s){if(!rn||!rn.edit||typeof rn.edit.setCells!="function"||!bn||!le||!le.ok)return 0;const Z=[];for(const $t of s){const At=le.tasks.get($t);!At||At.isSummary||At.unscheduled||(bn.start&&Z.push({key:$t,colId:bn.start,value:At.es}),bn.end&&Z.push({key:$t,colId:bn.end,value:At.ef}),bn.duration&&Z.push({key:$t,colId:bn.duration,value:At.duration}))}if(!Z.length)return 0;for(const $t of Z)Qn.add([$t.key,$t.colId].join(""));return rn.edit.setCells(Z,"cell")}function Qi(s,Z,$t={}){if(!rn||!rn.edit||typeof rn.edit.setCells!="function"||!bn)return 0;const At=ze(s);if(At<0)return 0;const Kt=[];for(const be of Z){if(!bn[be])continue;const ce=be in $t?$t[be]:Ln(At,be);ce!==void 0&&Kt.push({key:s,colId:bn[be],value:ce})}if(!Kt.length)return 0;for(const be of Kt)Qn.add([be.key,be.colId].join(""));return rn.edit.setCells(Kt,"cell")}function gi(s,Z){const $t=Ii.get(Z.colId);if(!$t)return;const At=[Z.key,Z.colId].join(""),Kt=Qn.delete(At),be=String(Z.key);s==="confirmed"?Z.value!==void 0&&pi(be,$t,Z.value)&&an():s==="reverted"&&Kt&&Z.restored!==void 0?pi(be,$t,Z.restored)&&an():s==="conflict"&&Kt&&Z.value!==void 0&&pi(be,$t,Z.value)&&an()}function pi(s,Z,$t){const At=ze(s);if(At<0)return!1;const Kt=Ln(At,Z);return Kt===$t||String(Kt)===String($t)?!1:(vn(s,Z,$t),!0)}rn&&typeof rn.on=="function"&&(Hn.push(rn.on("cell:changed",s=>gi("confirmed",s))),Hn.push(rn.on("cell:confirmed",s=>gi("confirmed",s))),Hn.push(rn.on("cell:reverted",s=>gi("reverted",s))),Hn.push(rn.on("cell:conflict",s=>gi("conflict",s))));const tr=Number.isFinite(Number(ve.historyDepth))&&Number(ve.historyDepth)>=0?Math.floor(Number(ve.historyDepth)):100,$n=new v({depth:tr,apply:s=>{s&&Array.isArray(s.tasks)&&(he=s.tasks.map(Z=>({...Z}))),s&&Array.isArray(s.dependencies)&&(Ke=s.dependencies.map(Z=>({...Z}))),an()}});function Mn(){return{tasks:he.slice(),dependencies:Ke.slice()}}function ti(s){Me.emit("history",{canUndo:$n.canUndo(),canRedo:$n.canRedo(),label:s??null})}function In(s,Z,$t,At,Kt){if($n.replaying)return;const be=$n.push({type:s,label:Z,target:$t==null?null:String($t),before:At,after:Mn(),coalesce:!!Kt});be&&ti(be.label)}const ai=!!(Y(ve.events)&&ve.events.loads),mi=new Set(["start","end","duration"].map(yn)),en=Rt({emit:(s,Z)=>Me.emit(s,Z),tasks:()=>he.map(s=>({...s})),dependencies:()=>Ke.map(s=>({...s})),schedule:()=>le,taskId:s=>String(on(s)),depKey:On,dateProps:mi,view:()=>fe});let Ri=!1;an({fromLoad:!0});const ei=Vt({emit:(s,Z)=>Me.emit(s,Z),tasks:()=>he.map(s=>({...s})),dependencies:()=>Ke.map(s=>({...s})),schedule:()=>le,taskId:s=>String(on(s)),depKey:On,dateProps:mi});Me.on("change",()=>ei.recheck());const Mi=Yt({getTasks:()=>he,setTasks:s=>{he=s},getDeps:()=>Ke,setDeps:s=>{Ke=s},readId:on,writeProp:yn,getSchedule:()=>le,compute:()=>an(),planSlice:Mn,recordHistory:In,changes:en,gateBefore:En,bus:Me,selected:()=>kn.ids(),select:(s,Z)=>{Nn(s,Z,null,{anchor:s.length?s[s.length-1]:null})},has:s=>ze(s)>=0,warnOnce:U,destroyed:()=>fn}),li=bt({getTasks:()=>he,setTasks:s=>{he=s},getDeps:()=>Ke,setDeps:s=>{Ke=s},readId:on,writeProp:yn,getSchedule:()=>le,projectStart:()=>zn,compute:()=>an(),planSlice:Mn,recordHistory:In,changes:en,gateBefore:En,bus:Me,select:(s,Z)=>{Nn(s,Z,null,{anchor:s.length?s[s.length-1]:null})},has:s=>ze(s)>=0,isReadOnly:s=>{const Z=ze(s);return Z>=0&&de(he[Z],_i)},t:(s,Z)=>It(un,()=>null)(s,Z),warnOnce:U,destroyed:()=>fn}),un={get tasks(){return he.map(s=>({...s}))},get dependencies(){return Ke.map(s=>({...s}))},readId(s){return on(s)},taskById(s){const Z=ze(s);return Z<0?null:{...he[Z]}},taskByWbs(s){if(!le||!le.ok||s==null)return null;const Z=String(s);for(const[$t,At]of le.tasks)if(At.wbs===Z)return un.taskById($t);return null},get schedule(){return le},get schedulingConflicts(){return Ci.map(Ut)},get hoursPerDay(){return hn},get weekStartDay(){return Li},get critical(){return le&&le.ok?le.critical:[]},get conflicts(){return le&&le.ok?le.conflicts||[]:[]},get autoSchedule(){return ji},get resourceLoad(){return le&&le.ok&&le.resourceLoad||null},get resourceModels(){return h(cn,Zn,{calendar:Sn,calendars:mn,hoursPerDay:hn})},get resourceRates(){return r(cn)},get resourceNames(){return b(cn)},get resourceSpecs(){return T(cn)},get resourceAvatars(){return j(cn)},get overAllocations(){return le&&le.ok?le.overAllocations||[]:[]},setTasks(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: setTasks on a destroyed controller ignored."),le;const $t=ai?en.begin():null;he=Array.isArray(s)?s.map(Kt=>({...Kt})):[],$n.clear(),ti(null);const At=an({fromLoad:!ai});return ei.resetForLoad(!!Z.keepChanges),$t&&en.commit($t,{origin:"api",promoteAll:!0}),At},setDependencies(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: setDependencies on a destroyed controller ignored."),le;const $t=Array.isArray(s)?s.map(u):[],At=new Set(Ke.map(On)),Kt=new Set($t.map(On)),be=$t.filter(Ve=>!At.has(On(Ve))),ce=Ke.filter(Ve=>!Kt.has(On(Ve))),ye=()=>{const Ve=Mn(),Re=en.begin();Ke=$t;const nn=an();return In("link","link",null,Ve,!1),(be.length||ce.length)&&Me.emit("dependencies",{added:be,removed:ce,dependencies:$t,origin:"user"}),en.commit(Re,{origin:"user",primary:new Set,event:Z&&Z.event}),nn};if(Z&&Z.gateRemoved&&ce.length){const Ve=Re=>Re>=ce.length?Ne():En("beforeDependencyDelete","dependencyDelete:cancelled",{removed:[ce[Re]],dependencies:$t,origin:"user"},()=>Ve(Re+1));return Ve(0)}return Ne();function Ne(){if(!be.length)return ye();if(Gn(Z&&Z.event,be.flatMap(Ve=>[String(Ve.from),String(Ve.to)]))){Me.emit("dependencyCreate:cancelled",{added:be,dependencies:$t,origin:"user",reason:"readOnly"});return}return En("beforeDependencyCreate","dependencyCreate:cancelled",{added:be,dependencies:$t,origin:"user"},ye)}},deleteDependency(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: deleteDependency on a destroyed controller ignored."),le;const $t=On(u(s||{})),At=Ke.filter(ce=>On(ce)===$t);if(!At.length)return;const Kt=Ke.filter(ce=>On(ce)!==$t),be=()=>{const ce=Mn(),ye=en.begin();Ke=Kt;const Ne=an();return In("unlink","unlink",null,ce,!1),Me.emit("dependencies",{added:[],removed:At,dependencies:Kt,origin:"user"}),en.commit(ye,{origin:"user",primary:new Set,event:Z&&Z.event}),Ne};if(Gn(Z&&Z.event,At.flatMap(ce=>[String(ce.from),String(ce.to)]))){Me.emit("dependencyDelete:cancelled",{removed:At,dependencies:Kt,origin:"user",reason:"readOnly"});return}return En("beforeDependencyDelete","dependencyDelete:cancelled",{removed:At,dependencies:Kt,origin:"user"},be,()=>Ke.some(ce=>On(ce)===$t))},previewEdit(s){if(fn||!s)return null;const Z=ze(String(s.id));if(Z<0)return null;const $t={...he[Z]};if(s.start!==void 0&&($t[yn("start")]=s.start),s.duration!==void 0)$t[yn("duration")]=s.duration;else if(s.start!==void 0){const Kt=hi(String(s.id));Kt!=null&&($t[yn("duration")]=Kt)}const At=he.slice();At[Z]=$t;try{const{planTasks:Kt,planDeps:be}=xi(At,Ke),ce=w(Kt,be,Gi());return ce.ok?ce:null}catch{return null}},applyEdit(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: applyEdit on a destroyed controller ignored."),le;const $t=Y(ve.fields)?["start","end","duration","percentComplete","name"].filter(dn=>typeof ve.fields[dn]=="function"):[];$t.length&&U("gantt-edit-mapped-field",`[lattice] gantt: this plan reads ${$t.join(", ")} through a \`fields\` FUNCTION, which has no inverse, so applyEdit writes the canonical property name and the edit will not be read back. Map those fields to a field NAME instead, or edit the host row through your own writer and feed the result in with rows.apply.`);const At=s&&s.id!=null?String(s.id):null,Kt=ze(At);if(Kt<0)return U(`gantt-edit-unknown-${At}`,`[lattice] gantt: applyEdit for unknown task "${At}" ignored.`),le;if($i(he[Kt]))return U(`gantt-edit-loadonly-${At}`,`[lattice] gantt: applyEdit on load-only task "${At}" ignored; load-only bookings are not editable.`),le;s=mt(s,le&&le.ok?le.tasks.get(At):null);const be=Object.keys(s).filter(dn=>dn!=="id"&&s[dn]!==void 0),ce=be.filter(dn=>dn!=="start"&&dn!=="end"&&dn!=="duration"),ye={...he[ze(At)]},Ne=le&&le.ok?le.tasks.get(At):null,Ve=Ne?!!Ne.isMilestone:!!ye.milestone,Re=s.start!==void 0||s.end!==void 0,nn=s.duration!==void 0,Dn=s.percentComplete!==void 0;let xn="beforeTaskEdit",Fn="taskEdit:cancelled";Ve&&Re?(xn="beforeMilestoneMove",Fn="milestoneMove:cancelled"):Dn?(xn="beforeProgressChange",Fn="progressChange:cancelled"):nn?(xn="beforeTaskResize",Fn="taskResize:cancelled"):Re&&(xn="beforeTaskMove",Fn="taskMove:cancelled");const bi=Ln(ze(At),"start"),ci={id:At,task:ye,patch:{...s},origin:"user",from:bi??(Ne?Ne.es:void 0),to:s.start,duration:s.duration,value:Dn?s.percentComplete:void 0,oldValue:Dn?Ln(ze(At),"percentComplete"):void 0};if(Gn(Z&&Z.event,[At])){Me.emit(Fn,{...ci,reason:"readOnly"});return}return En(xn,Fn,ci,()=>{const dn=Mn(),_n=en.begin(),gn=le&&le.ok?new Map([...le.tasks].map(([De,Be])=>[De,Be.es])):new Map,wn=s.work===void 0&&(Re||nn)&&Ne&&!Ne.isSummary?st(he[ze(At)]):null,Cn=wn&&wn.length?Jt(Ne,Un):null,Xe=Ji(At),Rn=s.effort!==void 0||s.units!==void 0||s.addResource!==void 0||s.removeResource!==void 0||s.assignments!==void 0||s.duration!==void 0&&Xe.mode==="fixedEffort",ni=[];if(Rn){ni.push("effort","units","addResource","removeResource","assignments","duration");let De;if(s.assignments!==void 0){let Be=qi(s.assignments);const Qe=Be.length===Xe.assignments.length&&Be.every(jn=>Xe.assignments.some(Wn=>Wn.resource===jn.resource)),Pn=Be.reduce((jn,Wn)=>jn+Wn.units,0);De={duration:Xe.duration,units:Xe.units,effort:void 0},Be.length&&(De=_({...Xe},{field:"units",value:Pn}),Xe.mode==="fixedDuration"&&Xe.effortDriven&&!Qe&&(Be=Be.map(jn=>({resource:jn.resource,units:jn.units*Xe.units/(Pn||1)})),De=_({...Xe},{field:"units",value:Xe.units}))),vn(At,"assignments",Be)}else if(s.addResource!==void 0||s.removeResource!==void 0){const Be=s.addResource!==void 0,Qe=Be?s.addResource:s.removeResource,Pn=String((Qe&&typeof Qe=="object"?Qe.resource??Qe.name??Qe.id:Qe)??""),jn=Qe&&typeof Qe=="object"&&Number.isFinite(Number(Qe.units))?Number(Qe.units):1;De=_({...Xe},{field:Be?"addResource":"removeResource",units:jn});let Wn=Be?[...Xe.assignments,{resource:Pn,units:jn}]:Xe.assignments.filter(Oi=>Oi.resource!==Pn);if(Xe.mode==="fixedDuration"&&Xe.effortDriven){const Oi=Wn.reduce((yi,Di)=>yi+Di.units,0)||1;Wn=Wn.map(yi=>({resource:yi.resource,units:yi.units*De.units/Oi}))}vn(At,"assignments",Wn)}else{const Be=s.units!==void 0?"units":s.effort!==void 0?"effort":"duration",Qe=s.units!==void 0?s.units:s.effort!==void 0?s.effort:s.duration;De=_({...Xe},{field:Be,value:Number(Qe)}),Math.abs(De.units-Xe.units)>1e-9&&ar(At,Xe.assignments,De.units)}De.duration!=null&&Number.isFinite(De.duration)&&vn(At,"duration",De.duration),De.effort!=null&&Number.isFinite(De.effort)&&vn(At,"effort",De.effort)}if(!Rn&&!ni.includes("duration")&&s.duration===void 0&&!Ve&&!(Ne&&Ne.isSummary)&&(s.start!==void 0||s.end!==void 0))if(s.end!==void 0){const De=s.start!==void 0?s.start:Ln(Kt,"start"),Be=Fi(De,s.end);Be!=null&&vn(At,"duration",Be)}else{const De=hi(At);De!=null&&vn(At,"duration",De)}for(const De of be)ni.includes(De)||vn(At,De,s[De]);const Bi=Array.isArray(s.work)?st({work:s.work}):null;if(Bi&&s.start===void 0&&s.end===void 0&&s.duration===void 0){const De=ht(Bi);De&&(vn(At,"start",De.first),vn(At,"duration",Pt(De.first,De.last,Un)))}an();let Kn=!1;if(Cn&&Cn.length&&le.ok){const De=le.tasks.get(At),Be=De&&!De.isSummary?Jt(De,Un):[];Be.length&&(vn(At,"work",dt(wt(wn,Cn,Be))),Kn=!0,an())}const Ei=[At];if(ji&&le.ok){for(const De of le.order){if(De===At)continue;const Be=le.tasks.get(De);Be.isSummary||gn.get(De)!==Be.es&&(!Be.isMilestone&&Be.duration!=null&&vn(De,"duration",Be.duration),vn(De,"start",Be.es),Ei.push(De))}Ei.length>1&&an()}if(Z.writeBack){fi(Ei);const De=Rn?ce.filter(Qe=>!ni.includes(Qe)):ce,Be=Kn&&!De.includes("work")?[...De,"work"]:De;if(Be.length&&Qi(At,Be),Rn&&le.ok){const Qe=le.tasks.get(At),Pn=ze(At);Qi(At,["assignments","effort","units"],{assignments:Pn>=0?Ln(Pn,"assignments"):void 0,effort:Qe&&Qe.effort!=null?Qe.effort:Pn>=0?Ln(Pn,"effort"):void 0,units:Qe?Qe.units:void 0})}}let Vn="field",ii=!1;return s.work!==void 0?(Vn="workload",ii=!0):Rn?Vn="assignment":xn==="beforeTaskMove"||xn==="beforeMilestoneMove"?(Vn="move",ii=!0):xn==="beforeTaskResize"?(Vn="resize",ii=!0):xn==="beforeProgressChange"&&(Vn="progress"),In(Vn,Vn,At,dn,ii),en.commit(_n,{origin:"user",primary:new Set([At]),event:Z&&Z.event}),le},()=>ze(At)>=0)},deleteTask(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: deleteTask on a destroyed controller ignored."),le;const $t=s!=null?String(s):null;if(ze($t)<0)return U(`gantt-delete-unknown-${$t}`,`[lattice] gantt: deleteTask for unknown task "${$t}" ignored.`),le;const At={...he[ze($t)]};if(Z&&(Z.event||Z.interactive)&&Gn(!0,[$t])){Me.emit("taskDelete:cancelled",{id:$t,task:At,origin:"user",reason:"readOnly"});return}return En("beforeTaskDelete","taskDelete:cancelled",{id:$t,task:At,origin:"user"},()=>{const be=Mn(),ce=en.begin();he=he.filter(Ne=>String(on(Ne))!==$t),Ke=Ke.filter(Ne=>String(Ne.from)!==$t&&String(Ne.to)!==$t);const ye=an();return In("delete","delete",$t,be,!1),en.commit(ce,{origin:"user",primary:new Set([$t]),event:Z&&Z.event}),ye},()=>ze($t)>=0)},moveRow(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: moveRow on a destroyed controller ignored."),le;const $t=s!=null?String(s):null,At=ze($t);if(At<0)return U(`gantt-move-unknown-${$t}`,`[lattice] gantt: moveRow for unknown task "${$t}" ignored.`),le;if($i(he[At]))return U(`gantt-move-loadonly-${$t}`,`[lattice] gantt: moveRow on load-only task "${$t}" ignored; load-only bookings are not editable.`),le;const Kt=Z&&Z.parent!=null?String(Z.parent):null;if(Kt!=null&&ze(Kt)<0)return U(`gantt-move-unknown-parent-${$t}`,`[lattice] gantt: moveRow for "${$t}" names unknown parent "${Kt}", ignored.`),le;const be=dn=>{let _n=dn;const gn=new Set;for(;_n!=null;){if(_n===$t)return!0;if(gn.has(_n))return!1;gn.add(_n);const wn=he.find(Xe=>String(on(Xe))===_n),Cn=wn?wn[yn("parent")]:null;_n=Cn!=null?String(Cn):null}return!1};if(Kt!=null&&be(Kt))return U(`gantt-move-cycle-${$t}`,`[lattice] gantt: moveRow refused — "${Kt}" is "${$t}"'s own descendant.`),le;const ce=Ln(At,"parent"),ye=ce!=null?String(ce):null,Ne=(dn,_n)=>he.filter(gn=>{const wn=String(on(gn));if(_n!=null&&wn===_n)return!1;const Cn=gn[yn("parent")];return(Cn!=null?String(Cn):null)===dn}).map(gn=>String(on(gn))),Ve=Ne(ye,null).indexOf($t),Re=Ne(Kt,$t),nn=Number.isFinite(Z.index)?Math.trunc(Z.index):Re.length,Dn=Math.max(0,Math.min(Re.length,nn));if(ye===Kt&&Ve===Dn)return le;const xn={id:$t,oldParent:ye,newParent:Kt,oldIndex:Ve,newIndex:Dn,origin:"user",event:Z.event||null},Fn=Z.position==="before"||Z.position==="after"||Z.position==="inside"?Z.position:Kt!==ye?"inside":"after",bi=Z.target!=null?String(Z.target):Fn==="inside"?Kt:null,ci={id:$t,rawTask:{...he[At]},task:le&&le.ok?le.tasks.get($t):null,view:fe,oldParent:ye,newParent:Kt,oldIndex:Ve,newIndex:Dn,position:Fn,target:bi,origin:"user",event:Z.event||null},Ti=()=>{const dn=Mn(),_n={...he[ze($t)],[yn("parent")]:Kt},gn=he.filter(Xe=>String(on(Xe))!==$t);let wn;if(Dn<Re.length){const Xe=Re[Dn];wn=gn.findIndex(Rn=>String(on(Rn))===Xe)}else if(Re.length>0){const Xe=Re[Re.length-1];wn=gn.findIndex(Rn=>String(on(Rn))===Xe)+1}else wn=gn.length;he=[...gn.slice(0,wn),_n,...gn.slice(wn)];const Cn=an();return In("rowMove","rowMove",$t,dn,!1),Me.emit("rowMove",xn),Me.emit("rowDrop",ci),Cn};return En("beforeRowDrop","rowDrop:cancelled",ci,()=>En("beforeRowMove","rowMove:cancelled",xn,Ti,()=>ze($t)>=0),()=>ze($t)>=0)},compute:an,rows:{apply(s,Z={}){if(fn||!s)return{added:[],updated:[],removed:[]};const $t=Mn(),At=ai?en.begin():null,Kt=new Map;he.forEach((Re,nn)=>Kt.set(qn(Re),nn));const be=he.slice(),ce=[],ye=[],Ne=[];for(const Re of[...s.add||[],...s.update||[]]){const nn=qn(Re);Kt.has(nn)?(be[Kt.get(nn)]=Xi(be[Kt.get(nn)],Re),ye.push(Re)):(Kt.set(nn,be.length),be.push({...Re}),ce.push(Re))}for(const Re of s.remove||[]){const nn=Re&&typeof Re=="object"?qn(Re):String(Re);Kt.has(nn)&&(be[Kt.get(nn)]=null,Ne.push(nn))}he=be.filter(Boolean),an({fromLoad:!ai}),ei.resetForLoad(!!Z.keepChanges);const Ve=ce.length&&!ye.length&&!Ne.length;if(In(Ve?"add":"change",Ve?"add":"change",ce.length===1&&!ye.length&&!Ne.length?qn(ce[0]):null,$t,!1),At){const Re=new Set([...ce,...ye].map(nn=>String(on(nn))));en.commit(At,{origin:"api",primary:Re})}return{added:ce,updated:ye,removed:Ne}},forEach(s){if(typeof s=="function")for(const Z of he)s(Z,qn(Z))},get count(){return he.length}},toCSV(s={}){if(!le||!le.ok)return"";const Z=!!s.dates,$t=ce=>ce==null?"":Z?P(ce)??String(ce):String(ce),At=ce=>{const ye=ce==null?"":String(ce);return/[",\n]/.test(ye)?`"${ye.replace(/"/g,'""')}"`:ye},be=[["id","name","start","end","duration","percentComplete","totalFloat","critical"].join(",")];for(const ce of le.order){const ye=le.tasks.get(ce);be.push([ye.id,ye.name,$t(ye.es),$t(ye.ef),ye.duration,ye.percentComplete==null?"":ye.percentComplete,ye.totalFloat,ye.critical].map(At).join(","))}return be.join(`
|
|
942
|
-
`)},toMSPDI(s={}){return kt({tasks:he,dependencies:Ke,resources:cn,projectStart:zn,calendar:Sn,calendars:mn,schedule:le,fields:sn,weekStartDay:Li},{hoursPerDay:hn,...s})},findViolations(){return k(he,le,sn)},resources(s={}){return p(he,le,{resources:s.resources??cn,defaultCapacity:s.defaultCapacity??Zn,calendar:Sn,calendars:mn,fields:sn,hoursPerDay:hn})},previewAssignments(s,Z){const $t=ze(String(s)),At=he.slice();return $t>=0&&(At[$t]={...he[$t],assignments:qi(Z)}),p(At,le,{resources:cn,defaultCapacity:Zn,calendar:Sn,calendars:mn,fields:sn,hoursPerDay:hn})},level(s={}){if(fn)return U("gantt-destroyed","[lattice] gantt: level on a destroyed controller ignored."),{ok:!1};if(Y(ve.fields)&&ve.fields.start!==void 0)return U("gantt-level-mapped-start","[lattice] gantt: level() is not available on a plan that maps `fields.start`, because leveling has to write a new start back and a field mapping only says how to READ one. Level the plan with its own `start` field, or apply the returned moves yourself."),{ok:!1,error:{code:"mapped-start",message:"level() cannot write back through fields.start"}};const{planTasks:Z,planDeps:$t}=xi(he,Ke),At=$(Z,$t,{projectStart:zn,deadline:Yn,calendar:Sn,calendars:mn,fields:sn,hoursPerDay:hn,resources:s.resources??cn,defaultCapacity:s.defaultCapacity??Zn,priorityField:s.priorityField,maxIterations:s.maxIterations});if(!At.ok||s.dryRun)return At;const Kt=Mn(),be=en.begin(),ce=new Map(At.tasks.map(ye=>[String(on(ye)),{...ye}]));return he=he.map(ye=>ce.get(String(on(ye)))??{...ye}),an(),In("level","level",null,Kt,!1),en.commit(be,{origin:"api",promoteAll:!0}),s.writeBack&&At.moves&&At.moves.length&&fi(At.moves.map(ye=>ye.id)),{...At,schedule:le}},on(s,Z){return Me.on(s,Z)},off(s,Z){Me.off(s,Z)},emitColumnResize(s){Me.emit("columnResize",s)},emitWorkloadClick(s){Me.emit("workload:click",s)},emitDataBandChange(s){Me.emit("dataBand:change",s)},gateDataBandEdit(s,Z){return En("beforeDataBandEdit","dataBandEdit:cancelled",s,Z)},writeDataBandSeries(s,Z,$t){const At=ze(String(s));return At<0?null:(he=he.slice(),he[At]={...he[At],[Z]:$t},{...he[At]})},emitCellClick(s){Me.emit("cell:click",s)},emitGesture(s,Z){if(!Ot.includes(s)&&!jt.includes(s))throw new Error(`lattice gantt: unknown gesture event ${s}`);Me.emit(s,Z)},gateGesture(s,Z,$t){if(!Ot.includes(s)&&!jt.includes(s))throw new Error(`lattice gantt: unknown gesture event ${s}`);const At=Me.emitBefore(s,$t);if(At===!0)return!0;const Kt=At===!1?$t.reason||"prevented":"deferred";return Z&&Me.emit(Z,{...$t,reason:Kt}),!1},emitWorkloadCell(s,Z){if(!gt.includes(s))throw new Error(`lattice gantt: unknown workload cell event ${s}`);Me.emit(s,Z)},gateWorkloadCell(s,Z){if(!gt.includes(s))throw new Error(`lattice gantt: unknown workload cell event ${s}`);return Me.emitBefore(s,Z)===!0},isTaskLocked(s){const Z=ze(String(s));return Z>=0&&C(he[Z],vi)},isTaskReadOnly(s){const Z=ze(String(s));return Z>=0&&de(he[Z],_i)},emitTaskFiltered(s){Me.emit("task:filtered",s)},scrollToTask(s){return!!(fe&&typeof fe.scrollToTask=="function"&&fe.scrollToTask(s))},emitDraw(s){Me.emit("draw",s)},emitZoomChange(s){Me.emit("zoomChange",s)},emitVisibleRangeChange(s){Me.emit("visibleRangeChange",s)},emitScroll(s){Me.emit("scroll",s)},emitViewMount(s){Me.emit("viewMount",s)},emitViewDestroy(s){Me.emit("viewDestroy",s)},emitTaskToggle(s,Z,$t){return Yi(s,Z,$t)},emitResourceToggle(s,Z){Zi(s,Z)},selectAt(s,Z={}){const $t=String(s),At=Array.isArray(Z.order)?Z.order.map(String):[],Kt=Z.cause==="keyboard"?"keyboard":"pointer";Z.range&&kn.anchor!=null?Nn(ge(kn.anchor,$t,At),Kt,Z.event||null):Z.toggle?Nn($e(kn.ids(),$t),Kt,Z.event||null,{anchor:$t}):Nn([$t],Kt,Z.event||null,{anchor:$t})},selectStep(s,Z={}){const $t=Array.isArray(Z.order)?Z.order.map(String):[],At=Z.from!=null?String(Z.from):kn.anchor,Kt=qt(At,s,$t);return Kt==null?null:(Nn([Kt],"keyboard",Z.event||null,{anchor:Kt}),Kt)},noteGridSelection(s){Nn(s,"pointer",null)},noteVisibleTasks(s){kn.noteVisible(s)},select(s){const Z=(Array.isArray(s)?s:[s]).map(String),$t=Z.length?Z[Z.length-1]:void 0;return Nn([...kn.ids(),...Z],"api",null,$t===void 0?{}:{anchor:$t}),kn.ids()},deselect(s){const Z=new Set((Array.isArray(s)?s:[s]).map(String));return Nn(kn.ids().filter($t=>!Z.has($t)),"api",null),kn.ids()},selected(){return kn.ids()},selectedHidden(){return kn.hidden()},copyTasks(s){return Mi.copyTasks(s)},cutTasks(s){return Mi.cutTasks(s)},pasteTasks(s){return Mi.pasteTasks(s)},addTask(s,Z){return li.addTask(s,Z)},convertToMilestone(s,Z){return li.convertToMilestone(s,Z)},convertToTask(s,Z){return li.convertToTask(s,Z)},undo(){const s=en.begin(),Z=$n.undo();return Z?(ti(Z.label),en.commit(s,{origin:"undo",promoteAll:!0}),!0):!1},redo(){const s=en.begin(),Z=$n.redo();return Z?(ti(Z.label),en.commit(s,{origin:"redo",promoteAll:!0}),!0):!1},canUndo(){return $n.canUndo()},canRedo(){return $n.canRedo()},clearHistory(){$n.clear(),ti(null)},changes(){return ei.changes()},get hasChanges(){return ei.hasChanges},commit(){ei.commit()},get grid(){return rn},get view(){return fe},get ready(){return fe?fe.ready:Promise.resolve()},get title(){return Wi},[Ee](){if(An==="split"&&fe&&typeof fe[Ee]=="function"){const s=fe[Ee]();if(s)return s}return Pe({controller:un,element:fe&&fe.element?fe.element:null})},get export(){const s=_e();return s?{pdf:(Z={})=>Z&&Z.download?s.downloadPdf(un,Z):s.exportPdf(un,Z)}:{}},toSVG(s){return fe&&typeof fe.toSVG=="function"?fe.toSVG(s):""},toPNG(s){return fe&&typeof fe.toPNG=="function"?fe.toPNG(s):Promise.resolve(null)},print(s){return fn?(U("gantt-destroyed","[lattice] gantt: print on a destroyed controller ignored."),!1):An!=="split"||!fe||typeof fe.print!="function"?(U("gantt-print-no-split","[lattice] gantt: print() needs a mounted split view (mountSplit); the plain view has no table or bands to print."),!1):fe.print(s)},mount(s,Z={}){return fn?(U("gantt-destroyed","[lattice] gantt: mount on a destroyed controller ignored."),null):(fe&&fe.destroy(),je(),We(s,Z),fe=new ot(un,s,Z),Jn=s,oi={...Z},An="plain",fe)},mountSplit(s,Z={}){return fn?(U("gantt-destroyed","[lattice] gantt: mountSplit on a destroyed controller ignored."),null):(fe&&(fe.destroy(),fe=null),je(),We(s,Z),fe=new pt(un,s,Z),Jn=s,oi={...Z},An="split",fe)},captureBaseline(){if(!le||!le.ok)return[];const s=[];for(const Z of le.order){const $t=le.tasks.get(Z);$t.isSummary||$t.unscheduled||s.push({id:$t.id,baselineStart:$t.es,baselineEnd:$t.ef,baselineDuration:$t.ef-$t.es})}return s},cost(s={}){return O(he,le,{resources:cn,hoursPerDay:hn,isWorking:Un,fields:sn,costField:s.costField})},costByBucket(s,Z,$t={}){return z(he,le,{...$t,from:s,to:Z,resources:cn,hoursPerDay:hn,isWorking:Un,fields:sn,weekStartDay:$t.weekStartDay!=null?$t.weekStartDay:Li})},earnedValue(s={}){const Z=O(he,le,{resources:cn,hoursPerDay:hn,isWorking:Un,fields:sn,costField:s.costField});return B(he,le,{...s,fields:sn,rateCosts:Z.ok?Z.byTask:null})},sCurve(s={}){const Z=O(he,le,{resources:cn,hoursPerDay:hn,isWorking:Un,fields:sn,costField:s.costField});return Mt(he,le,{...s,fields:sn,rateCosts:Z.ok?Z.byTask:null})},mountSCurve(s,Z={}){return fn?(U("gantt-destroyed","[lattice] gantt: mountSCurve on a destroyed controller ignored."),null):(Tn&&Tn.destroy(),Tn=new Q(un,s,Z),Tn)},getState(){const s=An,Z=fe?fe.options:{},$t=typeof Z.zoom=="string"||Number.isFinite(Z.zoom)?Z.zoom:null,At=Z.calendar==null||typeof Z.calendar=="string"||Y(Z.calendar)?Z.calendar??null:null;return{version:ln,mounted:s,zoom:$t,showArrows:Z.showArrows===void 0?!0:!!Z.showArrows,showProgress:Z.showProgress===void 0?!0:!!Z.showProgress,showBaseline:s==="split"?!!Z.showBaseline:null,calendar:At,nonWorking:typeof Z.nonWorking=="string"?Z.nonWorking:null,groupBy:s==="plain"&&typeof Z.groupBy=="string"?Z.groupBy:null,gridWidth:s==="split"&&Number.isFinite(Z.gridWidth)?Z.gridWidth:null,columnWidths:s==="split"&&fe&&typeof fe.getColumnWidths=="function"?fe.getColumnWidths():null,collapsed:s==="split"&&fe?[...fe.collapsed]:[],tables:s==="split"&&fe&&typeof fe.getTableStates=="function"?fe.getTableStates():null,workloadUnit:s==="split"&&fe&&typeof fe.getWorkloadUnit=="function"?fe.getWorkloadUnit():null,issuesPanel:s==="split"&&fe&&typeof fe.getIssuesPanelState=="function"?fe.getIssuesPanelState():null,dataBands:s==="split"&&fe&&typeof fe.getDataBandState=="function"?fe.getDataBandState():null,chartBands:s==="split"&&fe&&typeof fe.getChartBandState=="function"?fe.getChartBandState():null}},setState(s){$n.clear(),ti(null);const Z=Y(s)?s:{};typeof Z.version=="number"&&Z.version>ln&&U("gantt-state-version",`[lattice] gantt: setState received a state from a newer version (${Z.version} > ${ln}); unrecognised fields are ignored.`);const At=Z.mounted==="plain"||Z.mounted==="split"||Z.mounted===null?Z.mounted:An;if(At!=="plain"&&At!=="split")return fe&&un.unmount(),un;if(!Jn)return U("gantt-state-no-container","[lattice] gantt: setState was asked to show a view but no container is known yet; call mount()/mountSplit() at least once first."),un;const Kt={};(typeof Z.zoom=="string"||Number.isFinite(Z.zoom))&&(Kt.zoom=Z.zoom),typeof Z.showArrows=="boolean"&&(Kt.showArrows=Z.showArrows),typeof Z.showProgress=="boolean"&&(Kt.showProgress=Z.showProgress),At==="split"&&typeof Z.showBaseline=="boolean"&&(Kt.showBaseline=Z.showBaseline),(Z.calendar===null||typeof Z.calendar=="string"||Y(Z.calendar))&&(Kt.calendar=Z.calendar),typeof Z.nonWorking=="string"&&(Kt.nonWorking=Z.nonWorking),At==="plain"&&typeof Z.groupBy=="string"&&(Kt.groupBy=Z.groupBy),At==="split"&&Number.isFinite(Z.gridWidth)&&(Kt.gridWidth=Z.gridWidth);const ce={...An===At&&oi?oi:{},...Kt};if(At==="split"?un.mountSplit(Jn,ce):un.mount(Jn,ce),At==="split"&&Array.isArray(Z.collapsed)&&fe)for(const ye of new Set(Z.collapsed.map(String)))fe.toggle(ye);return At==="split"&&fe&&typeof fe.setWorkloadUnit=="function"&&(Z.workloadUnit==="hours"||Z.workloadUnit==="percent"||Z.workloadUnit==="cost")&&fe.setWorkloadUnit(Z.workloadUnit),At==="split"&&fe&&typeof fe.setColumnWidths=="function"&&Y(Z.columnWidths)&&fe.setColumnWidths(Z.columnWidths),At==="split"&&fe&&typeof fe.setTableStates=="function"&&Y(Z.tables)&&fe.setTableStates(Z.tables),At==="split"&&fe&&typeof fe.setIssuesPanelState=="function"&&Y(Z.issuesPanel)&&fe.setIssuesPanelState(Z.issuesPanel),At==="split"&&fe&&typeof fe.setDataBandState=="function"&&Y(Z.dataBands)&&fe.setDataBandState(Z.dataBands),At==="split"&&fe&&typeof fe.setChartBandState=="function"&&Y(Z.chartBands)&&fe.setChartBandState(Z.chartBands),un},unmount(){fe&&(fe.destroy(),fe=null),je(),An=null},destroy(){fn=!0,fe&&(fe.destroy(),fe=null),je(),Tn&&(Tn.destroy(),Tn=null),Jn=null,oi=null,An=null;for(const s of Hn)s();Hn.length=0,Qn.clear(),$n.destroy(),Me.clear()}};return un[G]=Si,ve.element&&un.mount(ve.element,ve.render||{}),un}const Le=Ge});var Hi=or("packages/modules/gantt/index.js");typeof module=="object"&&module.exports?module.exports=Hi:typeof define=="function"&&define.amd?define(function(){return Hi}):ur.LatticeGridGantt=Hi})(typeof globalThis<"u"?globalThis:this);
|
|
950
|
+
`;class h{#t;#i;#e;#n=null;#s=[];#o;#l=0;#h=null;#f=null;#p=!1;#g=null;#a=null;#d=null;constructor(D){this.#f=D.owner||null;const I=D.area;I&&!U(I)&&U(I.getBoundingClientRect)&&(this.#a=I),U(I)?this.#d=I:I&&U(I.getBoundingClientRect)&&(this.#d=()=>I.getBoundingClientRect()),this.#f&&U(this.#f.setAttribute)&&this.#f.setAttribute(a,""),this.#t=D.grid,this.#i=D.document,this.#e=D.element,this.#o=D.window||(typeof globalThis>"u"?{}:globalThis)}mount(){this.refresh(),U(this.#t.on)&&this.#s.push(this.#t.on("licence:changed",()=>this.refresh()));const D=this.#t.licence&&this.#t.licence.ready;D&&U(D.then)&&D.then(()=>this.refresh(),()=>this.refresh())}refresh(){const D=this.#w()&&!this.#c();D&&!this.#n?(this.#k(),this.#r()):!D&&this.#n&&(this.#M(),this.#m())}#c(){const D=this.#e;let I=D&&D.parentNode;for(this.#f&&I===this.#f&&(I=I.parentNode);I&&I.nodeType===1;){if(U(I.hasAttribute)&&I.hasAttribute(a))return!0;I=I.parentNode}return!1}#y(){const D=this.#o;if(!D||!U(D.matchMedia))return!1;try{return!!D.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}#r(){this.#m(),U(this.#o.setTimeout)&&(this.#y()||(this.#h=this.#o.setTimeout(()=>{if(this.#h=null,!this.#w()||this.#c()){this.#M();return}this.#l=(this.#l+1)%d.length,this.#M(),this.#k(),this.#r()},S)))}#m(){this.#h!==null&&U(this.#o.clearTimeout)&&this.#o.clearTimeout(this.#h),this.#h=null}#w(){const D=this.#t.licence;return!!(D&&U(D.watermark)&&D.watermark())}#E(){const D=this.#e;if(!D||!U(D.getBoundingClientRect)||!D.parentNode||!D.parentNode.children)return null;const I=D.parentNode,O=D.getBoundingClientRect();if(this.#d){const Ft=this.#d();if(Ft&&(Ft.width>0||Ft.height>0)){const P=Math.max(O.top,Ft.top);return{top:P,bottom:Math.max(P,Math.min(O.bottom,Ft.bottom)),layerTop:O.top,layerBottom:O.bottom}}return null}const B=Ft=>{const P=Array.from(I.children).find(x=>x.classList&&U(x.classList.contains)&&x.classList.contains(Ft));if(!P||!U(P.getBoundingClientRect))return null;const j=P.getBoundingClientRect();return j.width>0||j.height>0?j:null},H=B(_.header),z=B(_.stickyTop),at=B(_.stickyBottom),dt=B(_.statusBar),kt=Math.max(O.top,H?H.bottom:-1/0,z?z.bottom:-1/0),Tt=Math.min(O.bottom,at?at.top:1/0,dt?dt.top:1/0);return{top:kt,bottom:Math.max(kt,Tt),layerTop:O.top,layerBottom:O.bottom}}#P(){const D=this.#n;if(!D||!U(D.getBoundingClientRect))return;const I=this.#E();if(!I)return;const O=d[this.#l],B=D.getBoundingClientRect().height,H=I.bottom-I.top,dt=(O==="tl"||O==="tr")&&H<B*2?O==="tl"?"bl":"br":O;dt!==O&&(D.classList.remove(`${u}--${O}`),D.classList.add(`${u}--${dt}`)),dt==="tl"||dt==="tr"?(D.style.top=`${Math.max(0,I.top-I.layerTop)}px`,D.style.bottom=""):(D.style.bottom=`${Math.max(0,I.layerBottom-I.bottom)}px`,D.style.top="")}#k(){const D=this.#t.messages&&U(this.#t.messages.t)?this.#t.messages:b,I=w(this.#i,"a",{class:`${u}__link`,text:D.t("licence.watermark"),attrs:{href:g,target:"_blank",rel:"noopener noreferrer"}}),O=w(this.#i,"span",{class:`${u}__free`,text:D.t("licence.watermark.free")});this.#n=w(this.#i,"div",{class:`${u} ${u}--${d[this.#l]}`,attrs:{role:"note",title:"This grid is unlicensed for this domain. Visit latticegrid.dev for a licence."},children:[I,O]}),this.#s.push(k(this.#n,"pointerdown",H=>{U(H.stopPropagation)&&H.stopPropagation()})),this.#e&&U(this.#e.appendChild)&&this.#e.appendChild(this.#n),this.#P();const B=this.#o&&this.#o.ResizeObserver;if(U(B)){this.#g=new B(()=>{this.#n&&this.#P()}),U(this.#g.observe)&&this.#e&&this.#g.observe(this.#e);const H=this.#a;H&&U(this.#g.observe)&&this.#g.observe(H)}typeof queueMicrotask=="function"&&!this.#p&&(this.#p=!0,queueMicrotask(()=>{this.#p=!1,this.#n&&this.#c()&&(this.#M(),this.#m())}))}#M(){this.#g&&(U(this.#g.disconnect)&&this.#g.disconnect(),this.#g=null),this.#n&&U(this.#n.remove)&&this.#n.remove(),this.#n=null}destroy(){this.#m(),this.#f&&U(this.#f.removeAttribute)&&this.#f.removeAttribute(a);for(const D of this.#s)D();this.#s=[],this.#M()}}function y(M={},D=void 0){const I=globalThis[C],O=!M.licence&&D&&U(D.querySelector)?D.querySelector('meta[name="lattice-license"]')?.getAttribute("content"):null,B=M.licence||O;return B&&v(B),{licence:{watermark:()=>L(),get ready(){return I?I.verify():Promise.resolve()}},on:(H,z)=>H==="licence:changed"&&I?I.onSettled(()=>z()):()=>{}}}function i(M,D){return()=>{let I=1/0,O=-1/0,B=0;for(const H of M.querySelectorAll(D)){const z=H.getBoundingClientRect();z.width===0&&z.height===0||(I=Math.min(I,z.top),O=Math.max(O,z.bottom),B=Math.max(B,z.width))}return I===1/0?null:{top:I,bottom:O,width:B,height:O-I}}}function r(M,D={},I=null){const O=M&&M.ownerDocument;if(!O||!U(O.createElement))return{destroy(){},refresh(){}};const B=O.defaultView||void 0,H=y(D,O),z=typeof I=="string"?i(M,I):I;let at=null,dt=null,kt=null,Tt=!1;const Ft=()=>{if(!O.getElementById(m)&&O.head){const x=O.createElement("style");x.id=m,x.textContent=$,O.head.appendChild(x)}B&&U(B.getComputedStyle)&&B.getComputedStyle(M).position==="static"&&(M.style.position="relative"),at=O.createElement("div"),at.className=o,M.appendChild(at),dt=new h({grid:H,document:O,element:at,window:B,owner:M,area:z}),dt.mount(),B&&U(B.MutationObserver)&&(kt=new B.MutationObserver(()=>{!Tt&&at&&at.parentNode!==M&&M.appendChild(at)}),kt.observe(M,{childList:!0}))},P=()=>{Tt||(dt?dt.refresh():H.licence.watermark()&&Ft())};P();const j=H.on("licence:changed",P);return H.licence.ready,{refresh:P,destroy(){Tt||(Tt=!0,j(),kt&&kt.disconnect(),dt&&dt.destroy(),at&&at.parentNode&&at.parentNode.removeChild(at))}}}const f=h}),ae("packages/modules/gantt/resource-view.js",function(p,V){"use strict";Object.defineProperty(p,"makeCreateResourceView",{enumerable:!0,get:function(){return Y}});const St=220;function U(W,l){const L={external:Array.isArray(l)?l:[]};for(const v of["unit","thresholds","columns","labelWidth","showUnassigned","decimals","totals","hoursPerDay","groupBy"])W[v]!==void 0&&(L[v]=W[v]);return L.labelWidth===void 0&&(L.labelWidth=St),L}function K(W,l,L){if(!W||!W.ownerDocument)return null;const v=Array.isArray(l.resources)?l.resources:[];let b=Array.isArray(l.bookings)?l.bookings:[];const w=L({tasks:[],resources:v,hoursPerDay:l.hoursPerDay,calendar:l.calendar,weekStartDay:l.weekStartDay,fields:l.fields,messages:l.messages}),k=w.mountSplit(W,{resourceOnly:!0,editable:!1,workload:U(l,b),histogram:l.histogram??null,createGrid:l.createGrid,gridConfig:l.gridConfig,gridWidth:l.gridWidth,rowHeight:l.rowHeight,height:l.height,zoom:l.zoom,today:l.today,weekStartDay:l.weekStartDay,messages:l.messages});return{gantt:w,view:k,get grid(){return k?k.grids.workload:null},setBookings(u){b=Array.isArray(u)?u:[],k&&k.setWorkloadBookings(b)},setZoom(u){k&&k.setZoom(u)},setUnit(u){k&&k.setWorkloadUnit(u)},getUnit(){return k?k.getWorkloadUnit():"hours"},toggleResource(u,g){k&&k.toggleResource(u,g)},toggleGroup(u){k&&k.toggleWorkloadGroup(u)},getColumnWidths(){return k?k.getColumnWidths():{}},setColumnWidths(u){k&&k.setColumnWidths(u)},toSVG(u){return k?k.toSVG(u):""},on(u,g){w.on(u,g)},off(u,g){w.off(u,g)},destroy(){k&&k.destroy(),w.destroy()}}}function Y(W){return function(L,v={}){return K(L,v||{},W)}}}),ae("packages/modules/gantt/index.js",function(p,V){"use strict";Object.defineProperty(p,"GANTT_STATE_VERSION",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(p,"createResourceView",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(p,"createGantt",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(p,"default",{enumerable:!0,get:function(){return Ne}});const U=V("packages/core/src/internal/warn.js").warnOnce,Y=V("packages/core/src/internal/predicates.js").isObject,l=V("packages/modules/shared/emitter.js").Emitter,v=V("packages/core/src/model/history.js").HistoryModel,b=V("packages/modules/gantt/schedule.js"),w=b.computeSchedule,k=b.findViolations,u=b.normalizeLinkSpec,g=b.taskIdReader,d=b.taskFieldWriters,S=b.resolveSchedulingMode,_=b.reconcileEffort,C=b.isTaskLocked,a=b.wouldCreateCycle,o=V("packages/modules/gantt/resources.js"),m=o.computeResourceLoad,$=o.levelResources,h=o.normalizeResources,y=o.resourceDailyHours,i=o.parseAssignments,r=o.normalizeResourceRates,f=o.resourceDisplayNames,M=o.resourceSpecsByKey,D=o.resourceAvatars,I=V("packages/modules/gantt/cost.js"),O=I.computeCost,B=I.computeCostByBucket,H=V("packages/modules/gantt/earned-value.js"),z=H.computeEarnedValue,at=V("packages/modules/gantt/mspdi.js"),dt=at.importMSPDI,kt=at.exportMSPDI,Ft=V("packages/modules/gantt/wbs.js").deriveWbs,P=V("packages/modules/gantt/time.js"),j=P.toISODate,x=P.toDayNumber,N=V("packages/modules/gantt/calendar.js").createCalendar,X=V("packages/modules/gantt/week.js"),G=X.EXPLICIT_WEEK_START_DAY,J=X.resolveWeekStartDay,Q=X.validWeekStartDay,pt=V("packages/modules/gantt/workload.js"),st=pt.taskContour,ht=pt.contourSpan,Ot=pt.spanDuration,wt=pt.retimeContour,Jt=pt.recordWorkingDays,lt=pt.serializeContour,ot=V("packages/modules/gantt/render.js").GanttView,gt=V("packages/modules/gantt/split.js").GanttSplitView,Pt=V("packages/modules/gantt/events-pointer.js").GESTURE_EVENTS,ft=V("packages/modules/gantt/workload-events.js").WORKLOAD_CELL_EVENTS,jt=V("packages/modules/gantt/events-table.js").TABLE_EVENTS,mt=V("packages/modules/gantt/unscheduled.js").completeUnscheduledPatch,yt=V("packages/modules/gantt/scurve.js"),tt=yt.GanttSCurveView,Mt=yt.computeSCurve,Rt=V("packages/modules/gantt/change-events.js").createGanttChangeEvents,Vt=V("packages/modules/gantt/dirty-tracking.js").createGanttDirtyTracking,$t=V("packages/modules/gantt/selection.js"),Bt=$t.GanttSelection,pe=$t.rangeBetween,we=$t.toggleId,Yt=$t.stepInOrder,Lt=V("packages/modules/gantt/messages.js").createTranslator,Zt=V("packages/modules/gantt/paste.js").createPasteApi,bt=V("packages/modules/gantt/task-actions.js").createTaskActions,Ct=V("packages/modules/gantt/conflicts.js"),Dt=Ct.deriveConflicts,zt=Ct.diffConflicts,Ut=Ct.publicConflict,de=V("packages/modules/gantt/read-only.js").isTaskReadOnly,ve=V("packages/dom/src/watermark.js").mountViewWatermark,Fe=V("packages/modules/gantt/print.js"),je=Fe.ganttPrintModel,Ee=Fe.PDF_MODEL_KEY,Se=Fe.pdfModule,He=V("packages/modules/gantt/resource-view.js").makeCreateResourceView;Object.defineProperty(p,"computeSchedule",{enumerable:!0,get:function(){return b.computeSchedule}}),Object.defineProperty(p,"findViolations",{enumerable:!0,get:function(){return b.findViolations}}),Object.defineProperty(p,"normalizeTasks",{enumerable:!0,get:function(){return b.normalizeTasks}}),Object.defineProperty(p,"normalizeDependencies",{enumerable:!0,get:function(){return b.normalizeDependencies}}),Object.defineProperty(p,"topoOrder",{enumerable:!0,get:function(){return b.topoOrder}}),Object.defineProperty(p,"LINK_TYPES",{enumerable:!0,get:function(){return b.LINK_TYPES}}),Object.defineProperty(p,"SCHEDULE_ERROR",{enumerable:!0,get:function(){return b.SCHEDULE_ERROR}}),Object.defineProperty(p,"EPS",{enumerable:!0,get:function(){return b.EPS}}),Object.defineProperty(p,"CONSTRAINT_TYPES",{enumerable:!0,get:function(){return b.CONSTRAINT_TYPES}}),Object.defineProperty(p,"SCHEDULING_MODES",{enumerable:!0,get:function(){return b.SCHEDULING_MODES}}),Object.defineProperty(p,"resolveSchedulingMode",{enumerable:!0,get:function(){return b.resolveSchedulingMode}}),Object.defineProperty(p,"reconcileEffort",{enumerable:!0,get:function(){return b.reconcileEffort}}),Object.defineProperty(p,"isTaskLocked",{enumerable:!0,get:function(){return b.isTaskLocked}}),Object.defineProperty(p,"toDayNumber",{enumerable:!0,get:function(){return P.toDayNumber}}),Object.defineProperty(p,"fromDayNumber",{enumerable:!0,get:function(){return P.fromDayNumber}}),Object.defineProperty(p,"toISODate",{enumerable:!0,get:function(){return P.toISODate}}),Object.defineProperty(p,"importMSPDI",{enumerable:!0,get:function(){return at.importMSPDI}}),Object.defineProperty(p,"exportMSPDI",{enumerable:!0,get:function(){return at.exportMSPDI}}),Object.defineProperty(p,"computeEarnedValue",{enumerable:!0,get:function(){return H.computeEarnedValue}}),Object.defineProperty(p,"computeCost",{enumerable:!0,get:function(){return I.computeCost}}),Object.defineProperty(p,"computeCostByBucket",{enumerable:!0,get:function(){return I.computeCostByBucket}}),Object.defineProperty(p,"computeSCurve",{enumerable:!0,get:function(){return yt.computeSCurve}});const ln=1,pn=He(Ge);function ie(_e){return Array.isArray(_e)?"array":_e===null?"null":typeof _e}function xe(_e){return Me=>{const Ze=_e(Me);if(typeof Ze=="string"||typeof Ze=="number"&&Number.isFinite(Ze))return Ze;throw new Error(`lattice-gantt: rowKey function must return a string or number; got ${ie(Ze)}.`)}}function Ge(_e={}){const Me=new l("gantt");let Ze=null;const We=(s,Z)=>{const xt=s;if(!xt||!xt.ownerDocument)return;Ze=ve(xt,Z||{},()=>{const Kt=xt.getBoundingClientRect(),be=xt.querySelector(".lat-gantt-split__body");let ce=null;if(be)ce=be.getBoundingClientRect().top;else{const ye=xt.querySelector(".lat-gantt svg"),Le=Number((Z||{}).axisHeight);ye&&(ce=ye.getBoundingClientRect().top+(Number.isFinite(Le)?Le:22))}return ce===null?null:{top:ce,bottom:Kt.bottom,width:Kt.width,height:Kt.bottom-ce}}).destroy},Pe=()=>{Ze&&(Ze(),Ze=null)};let he=Array.isArray(_e.tasks)?_e.tasks.map(s=>({...s})):[],Ke=Array.isArray(_e.dependencies)?_e.dependencies.map(u):[];const zn=_e.projectStart,Yn=_e.deadline,Sn=_e.calendar??null,mn=Y(_e.calendars)?{..._e.calendars}:null,ri=N(Sn,x(zn)??0),Un=ri?s=>ri.isWorking(s):null,cn=_e.resources??null,Zn=_e.defaultCapacity,Wi=typeof _e.title=="string"?_e.title:null,hn=Number.isFinite(Number(_e.hoursPerDay))&&Number(_e.hoursPerDay)>0?Number(_e.hoursPerDay):8,ui=S(_e.schedulingMode)||"fixedDuration",di=!!_e.effortDriven,vi=typeof _e.lockWhen=="function"?_e.lockWhen:void 0,si=s=>{C(s.task,vi)&&s.preventDefault("locked")};Me.on("beforeTaskMove",si),Me.on("beforeTaskResize",si),Me.on("beforeMilestoneMove",si);const _i=typeof _e.readOnlyWhen=="function"?_e.readOnlyWhen:void 0,ji=!!_e.autoSchedule,Ni=!!_e.honourDates,rn=_e.grid??null,Si=Q(_e.weekStartDay),Li=Si??J(void 0,rn&&rn.messages?rn.messages.locale:void 0),bn=_e.columns&&typeof _e.columns=="object"?{..._e.columns}:null,sn=Y(_e.fields)?{..._e.fields}:{};if(_e.rowKey!==void 0&&typeof _e.rowKey!="function"&&!(typeof _e.rowKey=="string"&&_e.rowKey.length>0))throw new Error("lattice-gantt: rowKey must be a property name or a function; composite keys are not supported on tasks.");const Xn=typeof _e.rowKey=="function"?xe(_e.rowKey):_e.rowKey??(typeof sn.id=="string"?sn.id:"id"),qn=s=>String(typeof Xn=="function"?Xn(s):s[Xn]);sn.id===void 0&&(sn.id=s=>s&&s.id!=null?s.id:s?typeof Xn=="function"?Xn(s):s[Xn]:null);const on=g(sn),Ui=d(sn),yn=s=>Ui[s]||s,Ii=new Map;if(bn)for(const s of["start","end","duration","percentComplete","name"])bn[s]&&Ii.set(bn[s],s);let le=null,fn=!1,fe=null,Tn=null,Jn=null,oi=null,An=null;const Qn=new Set,kn=new Bt,Hn=[];function $i(s){return!!(s&&s.loadOnly===!0)}function xi(s,Z){const xt=new Set;for(const ce of s){if(!$i(ce))continue;const ye=on(ce);ye!=null&&xt.add(String(ye))}if(!xt.size)return{planTasks:s,planDeps:Z};const At=s.filter(ce=>!$i(ce)),Kt=Array.isArray(Z)?Z:[],be=Kt.filter(ce=>!xt.has(String(ce.from))&&!xt.has(String(ce.to)));return be.length!==Kt.length&&U("gantt-loadonly-dependency","[lattice] gantt: a dependency naming a load-only task is ignored; load-only bookings take no part in scheduling."),{planTasks:At,planDeps:be}}function Gi(){const s=y(cn,Zn,{calendar:Sn,calendars:mn,hoursPerDay:hn});return{projectStart:zn,deadline:Yn,calendar:Sn,calendars:mn,fields:sn,resources:Array.isArray(cn)?cn:void 0,honourDates:Ni,schedulingMode:_e.schedulingMode!=null?ui:void 0,effortDriven:_e.effortDriven!=null?di:void 0,hoursPerDay:hn,resourceHours:s,lockWhen:vi}}let Ci=[];function Ai(s){const Z=String(s);if(le&&le.ok&&le.tasks.has(Z)){const At=le.tasks.get(Z);if(At&&At.name!=null)return String(At.name)}const xt=ze(Z);return xt>=0&&he[xt]&&he[xt].name!=null?String(he[xt].name):Z}const Ki=Lt({grid:rn},()=>_e.messages);function Vi(s,Z){const xt=Dt(s,{t:Ki,nameOf:Ai,rawById:be=>{const ce=ze(be);return ce<0?null:he[ce]},deadlineOf:be=>be?be.deadline:null}),{added:At,resolved:Kt}=zt(Ci,xt);Ci=xt,!(Z||!At.length&&!Kt.length)&&Me.emit("schedulingConflict",{conflicts:xt.map(Ut),added:At.map(Ut),resolved:Kt.map(Ut)})}function an(s){const{planTasks:Z,planDeps:xt}=xi(he,Ke),At=w(Z,xt,Gi());if(At.ok){Ni&&Array.isArray(At.dependencies)&&(Ke=At.dependencies.map(ce=>({...ce})));const Kt=Ft(At.order,ce=>{const ye=At.tasks.get(ce);return ye?ye.parent:null},ce=>{const ye=ze(ce),Le=ye<0?null:he[ye].wbs;return typeof Le=="string"&&Le.trim()!==""?Le.trim():null});for(const[ce,ye]of Kt){const Le=At.tasks.get(ce);Le&&(Le.wbs=ye)}const be=m(he,At,{resources:cn,defaultCapacity:Zn,calendar:Sn,calendars:mn,fields:sn,hoursPerDay:hn});At.resourceLoad=be,At.overAllocations=be.overAllocations,le=At,Me.emit("schedule",At),Ri||(Ri=!0,Promise.resolve().then(()=>{fn||en.ready()}))}else Me.emit("error",At.error);return Vi(At,!!(s&&s.fromLoad)),At}function En(s,Z,xt,At,Kt){const be=ye=>{Me.emit(Z,{...xt,reason:ye})},ce=Me.emitBefore(s,xt);return ce===!0?At():ce===!1?be(xt.reason||"prevented"):ce.then(ye=>ye?typeof Kt=="function"&&!Kt()?be("stale"):At():be(xt.reason||"prevented"))}function ze(s){return he.findIndex(Z=>String(on(Z))===s)}function Gn(s,Z){return s?Z.some(xt=>{const At=ze(xt);return At>=0&&de(he[At],_i)}):!1}function Nn(s,Z,xt=null,At={}){const Kt=kn.replace(s);return Object.prototype.hasOwnProperty.call(At,"anchor")&&kn.setAnchor(At.anchor),!Kt.added.length&&!Kt.removed.length||(fe&&typeof fe.reflectSelection=="function"&&fe.reflectSelection(),Me.emit("selectionChange",{selectedIds:kn.ids(),added:Kt.added,removed:Kt.removed,cause:Z,event:xt})),Kt}function Yi(s,Z,xt){return En(s?"beforeTaskCollapse":"beforeTaskExpand",s?"taskCollapse:cancelled":"taskExpand:cancelled",Z,()=>{xt();const be={id:Z.id,expandedIds:Z.expandedIds,rawTask:Z.rawTask,task:Z.task,view:Z.view,event:Z.event};s?Me.emit("taskCollapse",be):Me.emit("taskExpand",be)})}function Zi(s,Z){const xt={resource:Z.resource,expandedResources:Z.expandedResources,view:Z.view,event:Z.event};s?Me.emit("resourceCollapse",xt):Me.emit("resourceExpand",xt)}function On(s){return`${String(s.from)}${String(s.to)}${s.type?String(s.type).toUpperCase():"FS"}`}function vn(s,Z,xt){const At=ze(s);if(At<0)return;const Kt={...he[At],[yn(Z)]:xt};he=he.slice(),he[At]=Kt}function Ln(s,Z){return he[s][yn(Z)]}function hi(s){const Z=le&&le.ok?le.tasks.get(s):null;if(Z)return!Z.isSummary&&!Z.isMilestone&&Z.duration!=null?Z.duration:null;const xt=ze(s),At=xt>=0?Number(Ln(xt,"duration")):NaN;return Number.isFinite(At)?At:null}function Fi(s,Z){const xt=x(s),At=x(Z);return xt!=null&&At!=null?Math.max(0,At-xt):null}function Xi(s,Z){const xt={...s,...Z},At=yn("start"),Kt=yn("end"),be=yn("duration"),ce=Object.prototype.hasOwnProperty.call(Z,At),ye=Object.prototype.hasOwnProperty.call(Z,Kt);if(Object.prototype.hasOwnProperty.call(Z,be)||!ce&&!ye)return xt;if(ye){const Re=Fi(ce?Z[At]:s[At],Z[Kt]);return Re!=null&&(xt[be]=Re),xt}const Ve=hi(String(on(s)));return Ve!=null&&(xt[be]=Ve),xt}function qi(s){const Z=new Map;for(const xt of Array.isArray(s)?s:[]){const At=String((xt&&typeof xt=="object"?xt.resource??xt.name??xt.id:xt)??"");if(At==="")continue;const Kt=xt&&typeof xt=="object"&&xt.units!=null?Number(xt.units):1;Z.set(At,{resource:At,units:Number.isFinite(Kt)&&Kt>=0?Kt:1})}return[...Z.values()]}function Ji(s){const Z=ze(s),xt=Z>=0?he[Z]:{},At=le&&le.ok?le.tasks.get(s):null,Kt=i(xt),be=At&&At.schedulingMode||S(xt.schedulingMode??xt.taskType)||ui,ce=At&&At.effortDriven!=null?!!At.effortDriven:xt.effortDriven!=null?!!xt.effortDriven:di,ye=At&&At.units!=null?At.units:Kt.reduce((Re,nn)=>Re+nn.units,0)||1,Le=At&&At.duration!=null?At.duration:Number(xt.duration)||0,Ve=At&&At.effort!=null&&At.duration>0&&ye>0?At.effort/(At.duration*ye):hn;return{mode:be,effortDriven:ce,duration:Le,units:ye,hoursPerDay:Ve,assignments:Kt}}function ar(s,Z,xt){if(!Z.length)return;const At=Z.reduce((Kt,be)=>Kt+be.units,0)||1;vn(s,"assignments",Z.map(Kt=>({resource:Kt.resource,units:Kt.units*xt/At})))}function fi(s){if(!rn||!rn.edit||typeof rn.edit.setCells!="function"||!bn||!le||!le.ok)return 0;const Z=[];for(const xt of s){const At=le.tasks.get(xt);!At||At.isSummary||At.unscheduled||(bn.start&&Z.push({key:xt,colId:bn.start,value:At.es}),bn.end&&Z.push({key:xt,colId:bn.end,value:At.ef}),bn.duration&&Z.push({key:xt,colId:bn.duration,value:At.duration}))}if(!Z.length)return 0;for(const xt of Z)Qn.add([xt.key,xt.colId].join(""));return rn.edit.setCells(Z,"cell")}function Qi(s,Z,xt={}){if(!rn||!rn.edit||typeof rn.edit.setCells!="function"||!bn)return 0;const At=ze(s);if(At<0)return 0;const Kt=[];for(const be of Z){if(!bn[be])continue;const ce=be in xt?xt[be]:Ln(At,be);ce!==void 0&&Kt.push({key:s,colId:bn[be],value:ce})}if(!Kt.length)return 0;for(const be of Kt)Qn.add([be.key,be.colId].join(""));return rn.edit.setCells(Kt,"cell")}function gi(s,Z){const xt=Ii.get(Z.colId);if(!xt)return;const At=[Z.key,Z.colId].join(""),Kt=Qn.delete(At),be=String(Z.key);s==="confirmed"?Z.value!==void 0&&pi(be,xt,Z.value)&&an():s==="reverted"&&Kt&&Z.restored!==void 0?pi(be,xt,Z.restored)&&an():s==="conflict"&&Kt&&Z.value!==void 0&&pi(be,xt,Z.value)&&an()}function pi(s,Z,xt){const At=ze(s);if(At<0)return!1;const Kt=Ln(At,Z);return Kt===xt||String(Kt)===String(xt)?!1:(vn(s,Z,xt),!0)}rn&&typeof rn.on=="function"&&(Hn.push(rn.on("cell:changed",s=>gi("confirmed",s))),Hn.push(rn.on("cell:confirmed",s=>gi("confirmed",s))),Hn.push(rn.on("cell:reverted",s=>gi("reverted",s))),Hn.push(rn.on("cell:conflict",s=>gi("conflict",s))));const tr=Number.isFinite(Number(_e.historyDepth))&&Number(_e.historyDepth)>=0?Math.floor(Number(_e.historyDepth)):100,$n=new v({depth:tr,apply:s=>{s&&Array.isArray(s.tasks)&&(he=s.tasks.map(Z=>({...Z}))),s&&Array.isArray(s.dependencies)&&(Ke=s.dependencies.map(Z=>({...Z}))),an()}});function Mn(){return{tasks:he.slice(),dependencies:Ke.slice()}}function ti(s){Me.emit("history",{canUndo:$n.canUndo(),canRedo:$n.canRedo(),label:s??null})}function In(s,Z,xt,At,Kt){if($n.replaying)return;const be=$n.push({type:s,label:Z,target:xt==null?null:String(xt),before:At,after:Mn(),coalesce:!!Kt});be&&ti(be.label)}const ai=!!(Y(_e.events)&&_e.events.loads),mi=new Set(["start","end","duration"].map(yn)),en=Rt({emit:(s,Z)=>Me.emit(s,Z),tasks:()=>he.map(s=>({...s})),dependencies:()=>Ke.map(s=>({...s})),schedule:()=>le,taskId:s=>String(on(s)),depKey:On,dateProps:mi,view:()=>fe});let Ri=!1;an({fromLoad:!0});const ei=Vt({emit:(s,Z)=>Me.emit(s,Z),tasks:()=>he.map(s=>({...s})),dependencies:()=>Ke.map(s=>({...s})),schedule:()=>le,taskId:s=>String(on(s)),depKey:On,dateProps:mi});Me.on("change",()=>ei.recheck());const Mi=Zt({getTasks:()=>he,setTasks:s=>{he=s},getDeps:()=>Ke,setDeps:s=>{Ke=s},readId:on,writeProp:yn,getSchedule:()=>le,compute:()=>an(),planSlice:Mn,recordHistory:In,changes:en,gateBefore:En,bus:Me,selected:()=>kn.ids(),select:(s,Z)=>{Nn(s,Z,null,{anchor:s.length?s[s.length-1]:null})},has:s=>ze(s)>=0,warnOnce:U,destroyed:()=>fn}),li=bt({getTasks:()=>he,setTasks:s=>{he=s},getDeps:()=>Ke,setDeps:s=>{Ke=s},readId:on,writeProp:yn,getSchedule:()=>le,projectStart:()=>zn,compute:()=>an(),planSlice:Mn,recordHistory:In,changes:en,gateBefore:En,bus:Me,select:(s,Z)=>{Nn(s,Z,null,{anchor:s.length?s[s.length-1]:null})},has:s=>ze(s)>=0,isReadOnly:s=>{const Z=ze(s);return Z>=0&&de(he[Z],_i)},t:(s,Z)=>Lt(un,()=>null)(s,Z),warnOnce:U,destroyed:()=>fn}),un={get tasks(){return he.map(s=>({...s}))},get dependencies(){return Ke.map(s=>({...s}))},readId(s){return on(s)},taskById(s){const Z=ze(s);return Z<0?null:{...he[Z]}},taskByWbs(s){if(!le||!le.ok||s==null)return null;const Z=String(s);for(const[xt,At]of le.tasks)if(At.wbs===Z)return un.taskById(xt);return null},get schedule(){return le},get schedulingConflicts(){return Ci.map(Ut)},get hoursPerDay(){return hn},get weekStartDay(){return Li},get critical(){return le&&le.ok?le.critical:[]},get conflicts(){return le&&le.ok?le.conflicts||[]:[]},get autoSchedule(){return ji},get resourceLoad(){return le&&le.ok&&le.resourceLoad||null},get resourceModels(){return h(cn,Zn,{calendar:Sn,calendars:mn,hoursPerDay:hn})},get resourceRates(){return r(cn)},get resourceNames(){return f(cn)},get resourceSpecs(){return M(cn)},get resourceAvatars(){return D(cn)},get overAllocations(){return le&&le.ok?le.overAllocations||[]:[]},setTasks(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: setTasks on a destroyed controller ignored."),le;const xt=ai?en.begin():null;he=Array.isArray(s)?s.map(Kt=>({...Kt})):[],$n.clear(),ti(null);const At=an({fromLoad:!ai});return ei.resetForLoad(!!Z.keepChanges),xt&&en.commit(xt,{origin:"api",promoteAll:!0}),At},setDependencies(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: setDependencies on a destroyed controller ignored."),le;const xt=Array.isArray(s)?s.map(u):[],At=new Set(Ke.map(On)),Kt=new Set(xt.map(On)),be=xt.filter(Ve=>!At.has(On(Ve))),ce=Ke.filter(Ve=>!Kt.has(On(Ve))),ye=()=>{const Ve=Mn(),Re=en.begin();Ke=xt;const nn=an();return In("link","link",null,Ve,!1),(be.length||ce.length)&&Me.emit("dependencies",{added:be,removed:ce,dependencies:xt,origin:"user"}),en.commit(Re,{origin:"user",primary:new Set,event:Z&&Z.event}),nn};if(Z&&Z.gateRemoved&&ce.length){const Ve=Re=>Re>=ce.length?Le():En("beforeDependencyDelete","dependencyDelete:cancelled",{removed:[ce[Re]],dependencies:xt,origin:"user"},()=>Ve(Re+1));return Ve(0)}return Le();function Le(){if(!be.length)return ye();if(Gn(Z&&Z.event,be.flatMap(Ve=>[String(Ve.from),String(Ve.to)]))){Me.emit("dependencyCreate:cancelled",{added:be,dependencies:xt,origin:"user",reason:"readOnly"});return}return En("beforeDependencyCreate","dependencyCreate:cancelled",{added:be,dependencies:xt,origin:"user"},ye)}},deleteDependency(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: deleteDependency on a destroyed controller ignored."),le;const xt=On(u(s||{})),At=Ke.filter(ce=>On(ce)===xt);if(!At.length)return;const Kt=Ke.filter(ce=>On(ce)!==xt),be=()=>{const ce=Mn(),ye=en.begin();Ke=Kt;const Le=an();return In("unlink","unlink",null,ce,!1),Me.emit("dependencies",{added:[],removed:At,dependencies:Kt,origin:"user"}),en.commit(ye,{origin:"user",primary:new Set,event:Z&&Z.event}),Le};if(Gn(Z&&Z.event,At.flatMap(ce=>[String(ce.from),String(ce.to)]))){Me.emit("dependencyDelete:cancelled",{removed:At,dependencies:Kt,origin:"user",reason:"readOnly"});return}return En("beforeDependencyDelete","dependencyDelete:cancelled",{removed:At,dependencies:Kt,origin:"user"},be,()=>Ke.some(ce=>On(ce)===xt))},previewEdit(s){if(fn||!s)return null;const Z=ze(String(s.id));if(Z<0)return null;const xt={...he[Z]};if(s.start!==void 0&&(xt[yn("start")]=s.start),s.duration!==void 0)xt[yn("duration")]=s.duration;else if(s.start!==void 0){const Kt=hi(String(s.id));Kt!=null&&(xt[yn("duration")]=Kt)}const At=he.slice();At[Z]=xt;try{const{planTasks:Kt,planDeps:be}=xi(At,Ke),ce=w(Kt,be,Gi());return ce.ok?ce:null}catch{return null}},applyEdit(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: applyEdit on a destroyed controller ignored."),le;const xt=Y(_e.fields)?["start","end","duration","percentComplete","name"].filter(dn=>typeof _e.fields[dn]=="function"):[];xt.length&&U("gantt-edit-mapped-field",`[lattice] gantt: this plan reads ${xt.join(", ")} through a \`fields\` FUNCTION, which has no inverse, so applyEdit writes the canonical property name and the edit will not be read back. Map those fields to a field NAME instead, or edit the host row through your own writer and feed the result in with rows.apply.`);const At=s&&s.id!=null?String(s.id):null,Kt=ze(At);if(Kt<0)return U(`gantt-edit-unknown-${At}`,`[lattice] gantt: applyEdit for unknown task "${At}" ignored.`),le;if($i(he[Kt]))return U(`gantt-edit-loadonly-${At}`,`[lattice] gantt: applyEdit on load-only task "${At}" ignored; load-only bookings are not editable.`),le;s=mt(s,le&&le.ok?le.tasks.get(At):null);const be=Object.keys(s).filter(dn=>dn!=="id"&&s[dn]!==void 0),ce=be.filter(dn=>dn!=="start"&&dn!=="end"&&dn!=="duration"),ye={...he[ze(At)]},Le=le&&le.ok?le.tasks.get(At):null,Ve=Le?!!Le.isMilestone:!!ye.milestone,Re=s.start!==void 0||s.end!==void 0,nn=s.duration!==void 0,Dn=s.percentComplete!==void 0;let xn="beforeTaskEdit",Fn="taskEdit:cancelled";Ve&&Re?(xn="beforeMilestoneMove",Fn="milestoneMove:cancelled"):Dn?(xn="beforeProgressChange",Fn="progressChange:cancelled"):nn?(xn="beforeTaskResize",Fn="taskResize:cancelled"):Re&&(xn="beforeTaskMove",Fn="taskMove:cancelled");const bi=Ln(ze(At),"start"),ci={id:At,task:ye,patch:{...s},origin:"user",from:bi??(Le?Le.es:void 0),to:s.start,duration:s.duration,value:Dn?s.percentComplete:void 0,oldValue:Dn?Ln(ze(At),"percentComplete"):void 0};if(Gn(Z&&Z.event,[At])){Me.emit(Fn,{...ci,reason:"readOnly"});return}return En(xn,Fn,ci,()=>{const dn=Mn(),_n=en.begin(),gn=le&&le.ok?new Map([...le.tasks].map(([De,Be])=>[De,Be.es])):new Map,wn=s.work===void 0&&(Re||nn)&&Le&&!Le.isSummary?st(he[ze(At)]):null,Cn=wn&&wn.length?Jt(Le,Un):null,Xe=Ji(At),Rn=s.effort!==void 0||s.units!==void 0||s.addResource!==void 0||s.removeResource!==void 0||s.assignments!==void 0||s.duration!==void 0&&Xe.mode==="fixedEffort",ni=[];if(Rn){ni.push("effort","units","addResource","removeResource","assignments","duration");let De;if(s.assignments!==void 0){let Be=qi(s.assignments);const Qe=Be.length===Xe.assignments.length&&Be.every(jn=>Xe.assignments.some(Wn=>Wn.resource===jn.resource)),Pn=Be.reduce((jn,Wn)=>jn+Wn.units,0);De={duration:Xe.duration,units:Xe.units,effort:void 0},Be.length&&(De=_({...Xe},{field:"units",value:Pn}),Xe.mode==="fixedDuration"&&Xe.effortDriven&&!Qe&&(Be=Be.map(jn=>({resource:jn.resource,units:jn.units*Xe.units/(Pn||1)})),De=_({...Xe},{field:"units",value:Xe.units}))),vn(At,"assignments",Be)}else if(s.addResource!==void 0||s.removeResource!==void 0){const Be=s.addResource!==void 0,Qe=Be?s.addResource:s.removeResource,Pn=String((Qe&&typeof Qe=="object"?Qe.resource??Qe.name??Qe.id:Qe)??""),jn=Qe&&typeof Qe=="object"&&Number.isFinite(Number(Qe.units))?Number(Qe.units):1;De=_({...Xe},{field:Be?"addResource":"removeResource",units:jn});let Wn=Be?[...Xe.assignments,{resource:Pn,units:jn}]:Xe.assignments.filter(Oi=>Oi.resource!==Pn);if(Xe.mode==="fixedDuration"&&Xe.effortDriven){const Oi=Wn.reduce((yi,Di)=>yi+Di.units,0)||1;Wn=Wn.map(yi=>({resource:yi.resource,units:yi.units*De.units/Oi}))}vn(At,"assignments",Wn)}else{const Be=s.units!==void 0?"units":s.effort!==void 0?"effort":"duration",Qe=s.units!==void 0?s.units:s.effort!==void 0?s.effort:s.duration;De=_({...Xe},{field:Be,value:Number(Qe)}),Math.abs(De.units-Xe.units)>1e-9&&ar(At,Xe.assignments,De.units)}De.duration!=null&&Number.isFinite(De.duration)&&vn(At,"duration",De.duration),De.effort!=null&&Number.isFinite(De.effort)&&vn(At,"effort",De.effort)}if(!Rn&&!ni.includes("duration")&&s.duration===void 0&&!Ve&&!(Le&&Le.isSummary)&&(s.start!==void 0||s.end!==void 0))if(s.end!==void 0){const De=s.start!==void 0?s.start:Ln(Kt,"start"),Be=Fi(De,s.end);Be!=null&&vn(At,"duration",Be)}else{const De=hi(At);De!=null&&vn(At,"duration",De)}for(const De of be)ni.includes(De)||vn(At,De,s[De]);const Bi=Array.isArray(s.work)?st({work:s.work}):null;if(Bi&&s.start===void 0&&s.end===void 0&&s.duration===void 0){const De=ht(Bi);De&&(vn(At,"start",De.first),vn(At,"duration",Ot(De.first,De.last,Un)))}an();let Kn=!1;if(Cn&&Cn.length&&le.ok){const De=le.tasks.get(At),Be=De&&!De.isSummary?Jt(De,Un):[];Be.length&&(vn(At,"work",lt(wt(wn,Cn,Be))),Kn=!0,an())}const Ei=[At];if(ji&&le.ok){for(const De of le.order){if(De===At)continue;const Be=le.tasks.get(De);Be.isSummary||gn.get(De)!==Be.es&&(!Be.isMilestone&&Be.duration!=null&&vn(De,"duration",Be.duration),vn(De,"start",Be.es),Ei.push(De))}Ei.length>1&&an()}if(Z.writeBack){fi(Ei);const De=Rn?ce.filter(Qe=>!ni.includes(Qe)):ce,Be=Kn&&!De.includes("work")?[...De,"work"]:De;if(Be.length&&Qi(At,Be),Rn&&le.ok){const Qe=le.tasks.get(At),Pn=ze(At);Qi(At,["assignments","effort","units"],{assignments:Pn>=0?Ln(Pn,"assignments"):void 0,effort:Qe&&Qe.effort!=null?Qe.effort:Pn>=0?Ln(Pn,"effort"):void 0,units:Qe?Qe.units:void 0})}}let Vn="field",ii=!1;return s.work!==void 0?(Vn="workload",ii=!0):Rn?Vn="assignment":xn==="beforeTaskMove"||xn==="beforeMilestoneMove"?(Vn="move",ii=!0):xn==="beforeTaskResize"?(Vn="resize",ii=!0):xn==="beforeProgressChange"&&(Vn="progress"),In(Vn,Vn,At,dn,ii),en.commit(_n,{origin:"user",primary:new Set([At]),event:Z&&Z.event}),le},()=>ze(At)>=0)},deleteTask(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: deleteTask on a destroyed controller ignored."),le;const xt=s!=null?String(s):null;if(ze(xt)<0)return U(`gantt-delete-unknown-${xt}`,`[lattice] gantt: deleteTask for unknown task "${xt}" ignored.`),le;const At={...he[ze(xt)]};if(Z&&(Z.event||Z.interactive)&&Gn(!0,[xt])){Me.emit("taskDelete:cancelled",{id:xt,task:At,origin:"user",reason:"readOnly"});return}return En("beforeTaskDelete","taskDelete:cancelled",{id:xt,task:At,origin:"user"},()=>{const be=Mn(),ce=en.begin();he=he.filter(Le=>String(on(Le))!==xt),Ke=Ke.filter(Le=>String(Le.from)!==xt&&String(Le.to)!==xt);const ye=an();return In("delete","delete",xt,be,!1),en.commit(ce,{origin:"user",primary:new Set([xt]),event:Z&&Z.event}),ye},()=>ze(xt)>=0)},moveRow(s,Z={}){if(fn)return U("gantt-destroyed","[lattice] gantt: moveRow on a destroyed controller ignored."),le;const xt=s!=null?String(s):null,At=ze(xt);if(At<0)return U(`gantt-move-unknown-${xt}`,`[lattice] gantt: moveRow for unknown task "${xt}" ignored.`),le;if($i(he[At]))return U(`gantt-move-loadonly-${xt}`,`[lattice] gantt: moveRow on load-only task "${xt}" ignored; load-only bookings are not editable.`),le;const Kt=Z&&Z.parent!=null?String(Z.parent):null;if(Kt!=null&&ze(Kt)<0)return U(`gantt-move-unknown-parent-${xt}`,`[lattice] gantt: moveRow for "${xt}" names unknown parent "${Kt}", ignored.`),le;const be=dn=>{let _n=dn;const gn=new Set;for(;_n!=null;){if(_n===xt)return!0;if(gn.has(_n))return!1;gn.add(_n);const wn=he.find(Xe=>String(on(Xe))===_n),Cn=wn?wn[yn("parent")]:null;_n=Cn!=null?String(Cn):null}return!1};if(Kt!=null&&be(Kt))return U(`gantt-move-cycle-${xt}`,`[lattice] gantt: moveRow refused — "${Kt}" is "${xt}"'s own descendant.`),le;const ce=Ln(At,"parent"),ye=ce!=null?String(ce):null,Le=(dn,_n)=>he.filter(gn=>{const wn=String(on(gn));if(_n!=null&&wn===_n)return!1;const Cn=gn[yn("parent")];return(Cn!=null?String(Cn):null)===dn}).map(gn=>String(on(gn))),Ve=Le(ye,null).indexOf(xt),Re=Le(Kt,xt),nn=Number.isFinite(Z.index)?Math.trunc(Z.index):Re.length,Dn=Math.max(0,Math.min(Re.length,nn));if(ye===Kt&&Ve===Dn)return le;const xn={id:xt,oldParent:ye,newParent:Kt,oldIndex:Ve,newIndex:Dn,origin:"user",event:Z.event||null},Fn=Z.position==="before"||Z.position==="after"||Z.position==="inside"?Z.position:Kt!==ye?"inside":"after",bi=Z.target!=null?String(Z.target):Fn==="inside"?Kt:null,ci={id:xt,rawTask:{...he[At]},task:le&&le.ok?le.tasks.get(xt):null,view:fe,oldParent:ye,newParent:Kt,oldIndex:Ve,newIndex:Dn,position:Fn,target:bi,origin:"user",event:Z.event||null},Ti=()=>{const dn=Mn(),_n={...he[ze(xt)],[yn("parent")]:Kt},gn=he.filter(Xe=>String(on(Xe))!==xt);let wn;if(Dn<Re.length){const Xe=Re[Dn];wn=gn.findIndex(Rn=>String(on(Rn))===Xe)}else if(Re.length>0){const Xe=Re[Re.length-1];wn=gn.findIndex(Rn=>String(on(Rn))===Xe)+1}else wn=gn.length;he=[...gn.slice(0,wn),_n,...gn.slice(wn)];const Cn=an();return In("rowMove","rowMove",xt,dn,!1),Me.emit("rowMove",xn),Me.emit("rowDrop",ci),Cn};return En("beforeRowDrop","rowDrop:cancelled",ci,()=>En("beforeRowMove","rowMove:cancelled",xn,Ti,()=>ze(xt)>=0),()=>ze(xt)>=0)},compute:an,rows:{apply(s,Z={}){if(fn||!s)return{added:[],updated:[],removed:[]};const xt=Mn(),At=ai?en.begin():null,Kt=new Map;he.forEach((Re,nn)=>Kt.set(qn(Re),nn));const be=he.slice(),ce=[],ye=[],Le=[];for(const Re of[...s.add||[],...s.update||[]]){const nn=qn(Re);Kt.has(nn)?(be[Kt.get(nn)]=Xi(be[Kt.get(nn)],Re),ye.push(Re)):(Kt.set(nn,be.length),be.push({...Re}),ce.push(Re))}for(const Re of s.remove||[]){const nn=Re&&typeof Re=="object"?qn(Re):String(Re);Kt.has(nn)&&(be[Kt.get(nn)]=null,Le.push(nn))}he=be.filter(Boolean),an({fromLoad:!ai}),ei.resetForLoad(!!Z.keepChanges);const Ve=ce.length&&!ye.length&&!Le.length;if(In(Ve?"add":"change",Ve?"add":"change",ce.length===1&&!ye.length&&!Le.length?qn(ce[0]):null,xt,!1),At){const Re=new Set([...ce,...ye].map(nn=>String(on(nn))));en.commit(At,{origin:"api",primary:Re})}return{added:ce,updated:ye,removed:Le}},forEach(s){if(typeof s=="function")for(const Z of he)s(Z,qn(Z))},get count(){return he.length}},toCSV(s={}){if(!le||!le.ok)return"";const Z=!!s.dates,xt=ce=>ce==null?"":Z?j(ce)??String(ce):String(ce),At=ce=>{const ye=ce==null?"":String(ce);return/[",\n]/.test(ye)?`"${ye.replace(/"/g,'""')}"`:ye},be=[["id","name","start","end","duration","percentComplete","totalFloat","critical"].join(",")];for(const ce of le.order){const ye=le.tasks.get(ce);be.push([ye.id,ye.name,xt(ye.es),xt(ye.ef),ye.duration,ye.percentComplete==null?"":ye.percentComplete,ye.totalFloat,ye.critical].map(At).join(","))}return be.join(`
|
|
951
|
+
`)},toMSPDI(s={}){return kt({tasks:he,dependencies:Ke,resources:cn,projectStart:zn,calendar:Sn,calendars:mn,schedule:le,fields:sn,weekStartDay:Li},{hoursPerDay:hn,...s})},findViolations(){return k(he,le,sn)},resources(s={}){return m(he,le,{resources:s.resources??cn,defaultCapacity:s.defaultCapacity??Zn,calendar:Sn,calendars:mn,fields:sn,hoursPerDay:hn})},previewAssignments(s,Z){const xt=ze(String(s)),At=he.slice();return xt>=0&&(At[xt]={...he[xt],assignments:qi(Z)}),m(At,le,{resources:cn,defaultCapacity:Zn,calendar:Sn,calendars:mn,fields:sn,hoursPerDay:hn})},level(s={}){if(fn)return U("gantt-destroyed","[lattice] gantt: level on a destroyed controller ignored."),{ok:!1};if(Y(_e.fields)&&_e.fields.start!==void 0)return U("gantt-level-mapped-start","[lattice] gantt: level() is not available on a plan that maps `fields.start`, because leveling has to write a new start back and a field mapping only says how to READ one. Level the plan with its own `start` field, or apply the returned moves yourself."),{ok:!1,error:{code:"mapped-start",message:"level() cannot write back through fields.start"}};const{planTasks:Z,planDeps:xt}=xi(he,Ke),At=$(Z,xt,{projectStart:zn,deadline:Yn,calendar:Sn,calendars:mn,fields:sn,hoursPerDay:hn,resources:s.resources??cn,defaultCapacity:s.defaultCapacity??Zn,priorityField:s.priorityField,maxIterations:s.maxIterations});if(!At.ok||s.dryRun)return At;const Kt=Mn(),be=en.begin(),ce=new Map(At.tasks.map(ye=>[String(on(ye)),{...ye}]));return he=he.map(ye=>ce.get(String(on(ye)))??{...ye}),an(),In("level","level",null,Kt,!1),en.commit(be,{origin:"api",promoteAll:!0}),s.writeBack&&At.moves&&At.moves.length&&fi(At.moves.map(ye=>ye.id)),{...At,schedule:le}},on(s,Z){return Me.on(s,Z)},off(s,Z){Me.off(s,Z)},emitColumnResize(s){Me.emit("columnResize",s)},emitWorkloadClick(s){Me.emit("workload:click",s)},emitDataBandChange(s){Me.emit("dataBand:change",s)},gateDataBandEdit(s,Z){return En("beforeDataBandEdit","dataBandEdit:cancelled",s,Z)},writeDataBandSeries(s,Z,xt){const At=ze(String(s));return At<0?null:(he=he.slice(),he[At]={...he[At],[Z]:xt},{...he[At]})},emitCellClick(s){Me.emit("cell:click",s)},emitGesture(s,Z){if(!Pt.includes(s)&&!jt.includes(s))throw new Error(`lattice gantt: unknown gesture event ${s}`);Me.emit(s,Z)},gateGesture(s,Z,xt){if(!Pt.includes(s)&&!jt.includes(s))throw new Error(`lattice gantt: unknown gesture event ${s}`);const At=Me.emitBefore(s,xt);if(At===!0)return!0;const Kt=At===!1?xt.reason||"prevented":"deferred";return Z&&Me.emit(Z,{...xt,reason:Kt}),!1},emitWorkloadCell(s,Z){if(!ft.includes(s))throw new Error(`lattice gantt: unknown workload cell event ${s}`);Me.emit(s,Z)},gateWorkloadCell(s,Z){if(!ft.includes(s))throw new Error(`lattice gantt: unknown workload cell event ${s}`);return Me.emitBefore(s,Z)===!0},isTaskLocked(s){const Z=ze(String(s));return Z>=0&&C(he[Z],vi)},isTaskReadOnly(s){const Z=ze(String(s));return Z>=0&&de(he[Z],_i)},emitTaskFiltered(s){Me.emit("task:filtered",s)},scrollToTask(s){return!!(fe&&typeof fe.scrollToTask=="function"&&fe.scrollToTask(s))},emitDraw(s){Me.emit("draw",s)},emitZoomChange(s){Me.emit("zoomChange",s)},emitVisibleRangeChange(s){Me.emit("visibleRangeChange",s)},emitScroll(s){Me.emit("scroll",s)},emitViewMount(s){Me.emit("viewMount",s)},emitViewDestroy(s){Me.emit("viewDestroy",s)},emitTaskToggle(s,Z,xt){return Yi(s,Z,xt)},emitResourceToggle(s,Z){Zi(s,Z)},selectAt(s,Z={}){const xt=String(s),At=Array.isArray(Z.order)?Z.order.map(String):[],Kt=Z.cause==="keyboard"?"keyboard":"pointer";Z.range&&kn.anchor!=null?Nn(pe(kn.anchor,xt,At),Kt,Z.event||null):Z.toggle?Nn(we(kn.ids(),xt),Kt,Z.event||null,{anchor:xt}):Nn([xt],Kt,Z.event||null,{anchor:xt})},selectStep(s,Z={}){const xt=Array.isArray(Z.order)?Z.order.map(String):[],At=Z.from!=null?String(Z.from):kn.anchor,Kt=Yt(At,s,xt);return Kt==null?null:(Nn([Kt],"keyboard",Z.event||null,{anchor:Kt}),Kt)},noteGridSelection(s){Nn(s,"pointer",null)},noteVisibleTasks(s){kn.noteVisible(s)},select(s){const Z=(Array.isArray(s)?s:[s]).map(String),xt=Z.length?Z[Z.length-1]:void 0;return Nn([...kn.ids(),...Z],"api",null,xt===void 0?{}:{anchor:xt}),kn.ids()},deselect(s){const Z=new Set((Array.isArray(s)?s:[s]).map(String));return Nn(kn.ids().filter(xt=>!Z.has(xt)),"api",null),kn.ids()},selected(){return kn.ids()},selectedHidden(){return kn.hidden()},copyTasks(s){return Mi.copyTasks(s)},cutTasks(s){return Mi.cutTasks(s)},pasteTasks(s){return Mi.pasteTasks(s)},addTask(s,Z){return li.addTask(s,Z)},convertToMilestone(s,Z){return li.convertToMilestone(s,Z)},convertToTask(s,Z){return li.convertToTask(s,Z)},undo(){const s=en.begin(),Z=$n.undo();return Z?(ti(Z.label),en.commit(s,{origin:"undo",promoteAll:!0}),!0):!1},redo(){const s=en.begin(),Z=$n.redo();return Z?(ti(Z.label),en.commit(s,{origin:"redo",promoteAll:!0}),!0):!1},canUndo(){return $n.canUndo()},canRedo(){return $n.canRedo()},clearHistory(){$n.clear(),ti(null)},changes(){return ei.changes()},get hasChanges(){return ei.hasChanges},commit(){ei.commit()},get grid(){return rn},get view(){return fe},get ready(){return fe?fe.ready:Promise.resolve()},get title(){return Wi},[Ee](){if(An==="split"&&fe&&typeof fe[Ee]=="function"){const s=fe[Ee]();if(s)return s}return je({controller:un,element:fe&&fe.element?fe.element:null})},get export(){const s=Se();return s?{pdf:(Z={})=>Z&&Z.download?s.downloadPdf(un,Z):s.exportPdf(un,Z)}:{}},toSVG(s){return fe&&typeof fe.toSVG=="function"?fe.toSVG(s):""},toPNG(s){return fe&&typeof fe.toPNG=="function"?fe.toPNG(s):Promise.resolve(null)},print(s){return fn?(U("gantt-destroyed","[lattice] gantt: print on a destroyed controller ignored."),!1):An!=="split"||!fe||typeof fe.print!="function"?(U("gantt-print-no-split","[lattice] gantt: print() needs a mounted split view (mountSplit); the plain view has no table or bands to print."),!1):fe.print(s)},mount(s,Z={}){return fn?(U("gantt-destroyed","[lattice] gantt: mount on a destroyed controller ignored."),null):(fe&&fe.destroy(),Pe(),We(s,Z),fe=new ot(un,s,Z),Jn=s,oi={...Z},An="plain",fe)},mountSplit(s,Z={}){return fn?(U("gantt-destroyed","[lattice] gantt: mountSplit on a destroyed controller ignored."),null):(fe&&(fe.destroy(),fe=null),Pe(),We(s,Z),fe=new gt(un,s,Z),Jn=s,oi={...Z},An="split",fe)},captureBaseline(){if(!le||!le.ok)return[];const s=[];for(const Z of le.order){const xt=le.tasks.get(Z);xt.isSummary||xt.unscheduled||s.push({id:xt.id,baselineStart:xt.es,baselineEnd:xt.ef,baselineDuration:xt.ef-xt.es})}return s},cost(s={}){return O(he,le,{resources:cn,hoursPerDay:hn,isWorking:Un,fields:sn,costField:s.costField})},costByBucket(s,Z,xt={}){return B(he,le,{...xt,from:s,to:Z,resources:cn,hoursPerDay:hn,isWorking:Un,fields:sn,weekStartDay:xt.weekStartDay!=null?xt.weekStartDay:Li})},earnedValue(s={}){const Z=O(he,le,{resources:cn,hoursPerDay:hn,isWorking:Un,fields:sn,costField:s.costField});return z(he,le,{...s,fields:sn,rateCosts:Z.ok?Z.byTask:null})},sCurve(s={}){const Z=O(he,le,{resources:cn,hoursPerDay:hn,isWorking:Un,fields:sn,costField:s.costField});return Mt(he,le,{...s,fields:sn,rateCosts:Z.ok?Z.byTask:null})},mountSCurve(s,Z={}){return fn?(U("gantt-destroyed","[lattice] gantt: mountSCurve on a destroyed controller ignored."),null):(Tn&&Tn.destroy(),Tn=new tt(un,s,Z),Tn)},getState(){const s=An,Z=fe?fe.options:{},xt=typeof Z.zoom=="string"||Number.isFinite(Z.zoom)?Z.zoom:null,At=Z.calendar==null||typeof Z.calendar=="string"||Y(Z.calendar)?Z.calendar??null:null;return{version:ln,mounted:s,zoom:xt,showArrows:Z.showArrows===void 0?!0:!!Z.showArrows,showProgress:Z.showProgress===void 0?!0:!!Z.showProgress,showBaseline:s==="split"?!!Z.showBaseline:null,calendar:At,nonWorking:typeof Z.nonWorking=="string"?Z.nonWorking:null,groupBy:s==="plain"&&typeof Z.groupBy=="string"?Z.groupBy:null,gridWidth:s==="split"&&Number.isFinite(Z.gridWidth)?Z.gridWidth:null,columnWidths:s==="split"&&fe&&typeof fe.getColumnWidths=="function"?fe.getColumnWidths():null,collapsed:s==="split"&&fe?[...fe.collapsed]:[],tables:s==="split"&&fe&&typeof fe.getTableStates=="function"?fe.getTableStates():null,workloadUnit:s==="split"&&fe&&typeof fe.getWorkloadUnit=="function"?fe.getWorkloadUnit():null,issuesPanel:s==="split"&&fe&&typeof fe.getIssuesPanelState=="function"?fe.getIssuesPanelState():null,dataBands:s==="split"&&fe&&typeof fe.getDataBandState=="function"?fe.getDataBandState():null,chartBands:s==="split"&&fe&&typeof fe.getChartBandState=="function"?fe.getChartBandState():null}},setState(s){$n.clear(),ti(null);const Z=Y(s)?s:{};typeof Z.version=="number"&&Z.version>ln&&U("gantt-state-version",`[lattice] gantt: setState received a state from a newer version (${Z.version} > ${ln}); unrecognised fields are ignored.`);const At=Z.mounted==="plain"||Z.mounted==="split"||Z.mounted===null?Z.mounted:An;if(At!=="plain"&&At!=="split")return fe&&un.unmount(),un;if(!Jn)return U("gantt-state-no-container","[lattice] gantt: setState was asked to show a view but no container is known yet; call mount()/mountSplit() at least once first."),un;const Kt={};(typeof Z.zoom=="string"||Number.isFinite(Z.zoom))&&(Kt.zoom=Z.zoom),typeof Z.showArrows=="boolean"&&(Kt.showArrows=Z.showArrows),typeof Z.showProgress=="boolean"&&(Kt.showProgress=Z.showProgress),At==="split"&&typeof Z.showBaseline=="boolean"&&(Kt.showBaseline=Z.showBaseline),(Z.calendar===null||typeof Z.calendar=="string"||Y(Z.calendar))&&(Kt.calendar=Z.calendar),typeof Z.nonWorking=="string"&&(Kt.nonWorking=Z.nonWorking),At==="plain"&&typeof Z.groupBy=="string"&&(Kt.groupBy=Z.groupBy),At==="split"&&Number.isFinite(Z.gridWidth)&&(Kt.gridWidth=Z.gridWidth);const ce={...An===At&&oi?oi:{},...Kt};if(At==="split"?un.mountSplit(Jn,ce):un.mount(Jn,ce),At==="split"&&Array.isArray(Z.collapsed)&&fe)for(const ye of new Set(Z.collapsed.map(String)))fe.toggle(ye);return At==="split"&&fe&&typeof fe.setWorkloadUnit=="function"&&(Z.workloadUnit==="hours"||Z.workloadUnit==="percent"||Z.workloadUnit==="cost")&&fe.setWorkloadUnit(Z.workloadUnit),At==="split"&&fe&&typeof fe.setColumnWidths=="function"&&Y(Z.columnWidths)&&fe.setColumnWidths(Z.columnWidths),At==="split"&&fe&&typeof fe.setTableStates=="function"&&Y(Z.tables)&&fe.setTableStates(Z.tables),At==="split"&&fe&&typeof fe.setIssuesPanelState=="function"&&Y(Z.issuesPanel)&&fe.setIssuesPanelState(Z.issuesPanel),At==="split"&&fe&&typeof fe.setDataBandState=="function"&&Y(Z.dataBands)&&fe.setDataBandState(Z.dataBands),At==="split"&&fe&&typeof fe.setChartBandState=="function"&&Y(Z.chartBands)&&fe.setChartBandState(Z.chartBands),un},unmount(){fe&&(fe.destroy(),fe=null),Pe(),An=null},destroy(){fn=!0,fe&&(fe.destroy(),fe=null),Pe(),Tn&&(Tn.destroy(),Tn=null),Jn=null,oi=null,An=null;for(const s of Hn)s();Hn.length=0,Qn.clear(),$n.destroy(),Me.clear()}};return un[G]=Si,_e.element&&un.mount(_e.element,_e.render||{}),un}const Ne=Ge});var Hi=or("packages/modules/gantt/index.js");typeof module=="object"&&module.exports?module.exports=Hi:typeof define=="function"&&define.amd?define(function(){return Hi}):ur.LatticeGridGantt=Hi})(typeof globalThis<"u"?globalThis:this);
|
|
943
952
|
|
|
944
953
|
//# sourceMappingURL=gantt.min.js.map
|