ooxml-core 1.31.0 → 1.32.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/dist/{PptxHandler-KKLAYUGQ.mjs → PptxHandler-QY5VL3CY.mjs} +2 -2
- package/dist/PptxHandler-SJ5ZUIUX.mjs +4 -0
- package/dist/{PptxHandler-DHQPVTUI.cjs → PptxHandler-TESZUH66.cjs} +3 -3
- package/dist/{PresentationBuilder-YYZYCKTZ.mjs → PresentationBuilder-3CH5TR4W.mjs} +2 -2
- package/dist/{PresentationBuilder-JORMF5CP.cjs → PresentationBuilder-5NFBUP7Y.cjs} +5 -5
- package/dist/{PresentationBuilder-Q2Z33LLM.mjs → PresentationBuilder-S6HXHKEJ.mjs} +2 -2
- package/dist/automation/index.cjs +862 -389
- package/dist/automation/index.mjs +862 -389
- package/dist/{chunk-GJDFCP2T.mjs → chunk-3H5UAJB3.mjs} +258 -155
- package/dist/{chunk-MKDONWNO.mjs → chunk-4R65YYAD.mjs} +32 -14
- package/dist/{chunk-KWJYMAEF.mjs → chunk-IOTGRLJH.mjs} +255 -152
- package/dist/{chunk-6FXOAMNL.mjs → chunk-N6424WKA.mjs} +1 -1
- package/dist/{chunk-WZJ25K7P.mjs → chunk-NAWLWKOJ.mjs} +1 -1
- package/dist/{chunk-DJ3CDTMX.mjs → chunk-O7SVHLD7.mjs} +23 -5
- package/dist/{chunk-CZXM4ZJH.cjs → chunk-Q6NM64J2.cjs} +23 -4
- package/dist/{chunk-FFJBOR2Y.mjs → chunk-UYMSFJQZ.mjs} +76 -4
- package/dist/{chunk-B4LXDHBX.cjs → chunk-X6VNUBES.cjs} +1419 -1316
- package/dist/diagram/index.cjs +8 -4
- package/dist/diagram/index.mjs +8 -4
- package/dist/docx/embedded.cjs +8 -4
- package/dist/docx/embedded.mjs +8 -4
- package/dist/docx/index.cjs +8 -4
- package/dist/docx/index.mjs +8 -4
- package/dist/docx/layout/index.cjs +8 -4
- package/dist/docx/layout/index.mjs +8 -4
- package/dist/docx/load/index.cjs +8 -4
- package/dist/docx/load/index.mjs +8 -4
- package/dist/docx/ui/index.cjs +8 -4
- package/dist/docx/ui/index.mjs +8 -4
- package/dist/geometry/index.cjs +16 -12
- package/dist/geometry/index.mjs +16 -12
- package/dist/geometry/preset-shape-definitions-table.d.ts.map +1 -1
- package/dist/index.cjs +16 -12
- package/dist/index.mjs +16 -12
- package/dist/pptx/automation/index.cjs +294 -157
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-PdM5zpmu.d.ts → index-D-FdgqrP.d.ts} +102 -3
- package/dist/pptx/chunks/index-D-FdgqrP.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BQDcu_0a.d.ts → index-DKybuHPT.d.ts} +51 -3
- package/dist/pptx/chunks/{index-BQDcu_0a.d.ts.map → index-DKybuHPT.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CBV1oHN7.d.ts → index-DnWlmYCy.d.ts} +2 -2
- package/dist/pptx/chunks/{index-CBV1oHN7.d.ts.map → index-DnWlmYCy.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +294 -157
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +8 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +380 -171
- package/dist/pptx/index.d.ts +4 -4
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/teams/chat-view.d.ts +10 -1
- package/dist/teams/chat-view.d.ts.map +1 -1
- package/dist/teams/index.cjs +805 -144
- package/dist/teams/index.d.ts +1 -0
- package/dist/teams/index.d.ts.map +1 -1
- package/dist/teams/index.mjs +795 -145
- package/dist/teams/presence-controller.d.ts +18 -3
- package/dist/teams/presence-controller.d.ts.map +1 -1
- package/dist/teams/presence-meetings.d.ts +21 -0
- package/dist/teams/presence-meetings.d.ts.map +1 -0
- package/dist/teams/presence.d.ts +40 -2
- package/dist/teams/presence.d.ts.map +1 -1
- package/dist/teams/store.d.ts +5 -0
- package/dist/teams/store.d.ts.map +1 -1
- package/dist/teams/view.d.ts +5 -0
- package/dist/teams/view.d.ts.map +1 -1
- package/dist/teams/workspace.d.ts +5 -2
- package/dist/teams/workspace.d.ts.map +1 -1
- package/dist/visio/index.cjs +6 -1
- package/dist/visio/index.mjs +6 -1
- package/dist/visio/ui/index.cjs +6 -1
- package/dist/visio/ui/index.mjs +6 -1
- package/dist/xlsx/formula/ets-drift-compare.d.ts +19 -0
- package/dist/xlsx/formula/ets-drift-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/ets-excel-compare.d.ts +12 -0
- package/dist/xlsx/formula/ets-excel-compare.d.ts.map +1 -1
- package/dist/xlsx/formula/ets-init-compare.d.ts +24 -0
- package/dist/xlsx/formula/ets-init-compare.d.ts.map +1 -0
- package/dist/xlsx/formula/ets-init-maps.d.ts +21 -0
- package/dist/xlsx/formula/ets-init-maps.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-core.d.ts +1 -1
- package/dist/xlsx/formula/functions/ets-core.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/ets-init-chain.d.ts +11 -0
- package/dist/xlsx/formula/functions/ets-init-chain.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-four.d.ts +3 -0
- package/dist/xlsx/formula/functions/ets-init-four.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-short.d.ts +17 -0
- package/dist/xlsx/formula/functions/ets-init-short.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-states.d.ts +5 -0
- package/dist/xlsx/formula/functions/ets-init-states.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-three.d.ts +23 -0
- package/dist/xlsx/formula/functions/ets-init-three.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts +13 -0
- package/dist/xlsx/formula/functions/ets-init-threeplus.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts +18 -0
- package/dist/xlsx/formula/functions/ets-init.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/ets-search-map.d.ts +24 -0
- package/dist/xlsx/formula/functions/ets-search-map.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-search.d.ts +17 -0
- package/dist/xlsx/formula/functions/ets-search.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/ets-season.d.ts +2 -2
- package/dist/xlsx/formula/functions/ets-season.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/ets-validate.d.ts +16 -0
- package/dist/xlsx/formula/functions/ets-validate.d.ts.map +1 -0
- package/dist/xlsx/index.cjs +762 -289
- package/dist/xlsx/index.mjs +762 -289
- package/dist/xlsx/layout/form-control-view.d.ts.map +1 -1
- package/dist/xlsx/layout/shape-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +599 -126
- package/dist/xlsx/load/index.mjs +599 -126
- package/dist/xlsx/read/form-control.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +756 -283
- package/dist/xlsx/ui/index.mjs +756 -283
- package/package.json +1 -1
- package/dist/PptxHandler-E4DDV3FQ.mjs +0 -4
- package/dist/pptx/chunks/index-PdM5zpmu.d.ts.map +0 -1
package/dist/teams/index.mjs
CHANGED
|
@@ -7625,9 +7625,9 @@ var init_ref_text = __esm({
|
|
|
7625
7625
|
});
|
|
7626
7626
|
|
|
7627
7627
|
// xlsx/formula/shift-formula.ts
|
|
7628
|
-
function remember(text,
|
|
7628
|
+
function remember(text, template2) {
|
|
7629
7629
|
if (templates.size >= MAX_TEMPLATES) templates.clear();
|
|
7630
|
-
templates.set(text,
|
|
7630
|
+
templates.set(text, template2);
|
|
7631
7631
|
}
|
|
7632
7632
|
function mergeSpacedAreas(tokens2) {
|
|
7633
7633
|
const out = [];
|
|
@@ -7658,16 +7658,16 @@ function templateOf(formula2) {
|
|
|
7658
7658
|
const cached = templates.get(formula2);
|
|
7659
7659
|
if (cached !== void 0) return cached;
|
|
7660
7660
|
const raw2 = safeTokens(formula2);
|
|
7661
|
-
let
|
|
7661
|
+
let template2 = null;
|
|
7662
7662
|
if (raw2) {
|
|
7663
|
-
|
|
7663
|
+
template2 = [];
|
|
7664
7664
|
let literal2 = "";
|
|
7665
7665
|
for (const token2 of mergeSpacedAreas(raw2)) {
|
|
7666
7666
|
if (token2.kind !== "ref" && !(token2.kind === "name" && token2.prefix)) {
|
|
7667
7667
|
literal2 += token2.text;
|
|
7668
7668
|
continue;
|
|
7669
7669
|
}
|
|
7670
|
-
if (literal2)
|
|
7670
|
+
if (literal2) template2.push(literal2);
|
|
7671
7671
|
literal2 = "";
|
|
7672
7672
|
const part = { kind: token2.kind, text: token2.text };
|
|
7673
7673
|
if (token2.prefix) {
|
|
@@ -7676,23 +7676,23 @@ function templateOf(formula2) {
|
|
|
7676
7676
|
}
|
|
7677
7677
|
if (token2.ref) part.ref = token2.ref;
|
|
7678
7678
|
if (token2.spill) part.spill = true;
|
|
7679
|
-
|
|
7679
|
+
template2.push(part);
|
|
7680
7680
|
}
|
|
7681
|
-
if (literal2)
|
|
7681
|
+
if (literal2) template2.push(literal2);
|
|
7682
7682
|
}
|
|
7683
|
-
remember(formula2,
|
|
7684
|
-
return
|
|
7683
|
+
remember(formula2, template2);
|
|
7684
|
+
return template2;
|
|
7685
7685
|
}
|
|
7686
7686
|
function rewriteTemplate(formula2, rewrite2) {
|
|
7687
|
-
const
|
|
7688
|
-
if (!
|
|
7687
|
+
const template2 = templateOf(formula2);
|
|
7688
|
+
if (!template2) return formula2;
|
|
7689
7689
|
let next;
|
|
7690
|
-
for (let i = 0; i <
|
|
7691
|
-
const part =
|
|
7690
|
+
for (let i = 0; i < template2.length; i++) {
|
|
7691
|
+
const part = template2[i];
|
|
7692
7692
|
if (typeof part === "string") continue;
|
|
7693
7693
|
const changed = rewrite2(part);
|
|
7694
7694
|
if (!changed) continue;
|
|
7695
|
-
next ??=
|
|
7695
|
+
next ??= template2.slice();
|
|
7696
7696
|
next[i] = changed;
|
|
7697
7697
|
}
|
|
7698
7698
|
if (!next) return formula2;
|
|
@@ -17466,7 +17466,8 @@ var init_preset_shape_definitions_table = __esm({
|
|
|
17466
17466
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
17467
17467
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
17468
17468
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
17469
|
-
gd16("
|
|
17469
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
17470
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
17470
17471
|
gd16("stx", "cos wd2 stAng"),
|
|
17471
17472
|
gd16("sty", "sin hd2 stAng"),
|
|
17472
17473
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -17511,7 +17512,8 @@ var init_preset_shape_definitions_table = __esm({
|
|
|
17511
17512
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
17512
17513
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
17513
17514
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
17514
|
-
gd16("
|
|
17515
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
17516
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
17515
17517
|
gd16("stx", "cos wd2 stAng"),
|
|
17516
17518
|
gd16("sty", "sin hd2 stAng"),
|
|
17517
17519
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -17535,7 +17537,8 @@ var init_preset_shape_definitions_table = __esm({
|
|
|
17535
17537
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
17536
17538
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
17537
17539
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
17538
|
-
gd16("
|
|
17540
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
17541
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
17539
17542
|
gd16("stx", "cos wd2 stAng"),
|
|
17540
17543
|
gd16("sty", "sin hd2 stAng"),
|
|
17541
17544
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -17630,7 +17633,8 @@ var init_preset_shape_definitions_table = __esm({
|
|
|
17630
17633
|
gd16("iwd2", "+- wd2 0 thw"),
|
|
17631
17634
|
gd16("ihd2", "+- hd2 0 thh2"),
|
|
17632
17635
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
17633
|
-
gd16("
|
|
17636
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
17637
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
17634
17638
|
gd16("mswAng", "+- 0 0 swAng2"),
|
|
17635
17639
|
gd16("stx", "cos wd2 stAng"),
|
|
17636
17640
|
gd16("sty", "sin hd2 stAng"),
|
|
@@ -28079,8 +28083,8 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
28079
28083
|
);
|
|
28080
28084
|
const direct = model2.nodes.find((node2) => node2.modelId === shape2.sourceNodeId);
|
|
28081
28085
|
const fillIndex = shape2.style?.fill?.index;
|
|
28082
|
-
const
|
|
28083
|
-
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!
|
|
28086
|
+
const template2 = fillIndex ? input.formatScheme?.fillStyles[fillIndex - 1]?.fill : void 0;
|
|
28087
|
+
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!template2 || template2.kind === "solid" && template2.color.kind === "scheme" && template2.color.value === "phClr")) {
|
|
28084
28088
|
const original = themed.get(`#${shape2.fill.color.value}`.toUpperCase());
|
|
28085
28089
|
if (original)
|
|
28086
28090
|
shape2.fill.color = {
|
|
@@ -28088,9 +28092,9 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
28088
28092
|
transforms: [...original.transforms, ...shape2.fill.color.transforms]
|
|
28089
28093
|
};
|
|
28090
28094
|
}
|
|
28091
|
-
if (!direct?.fill && shape2.fill?.kind === "gradient" &&
|
|
28095
|
+
if (!direct?.fill && shape2.fill?.kind === "gradient" && template2?.kind === "gradient") {
|
|
28092
28096
|
shape2.fill.stops.forEach((stop, index2) => {
|
|
28093
|
-
const authored =
|
|
28097
|
+
const authored = template2.stops[index2]?.color;
|
|
28094
28098
|
if (authored?.kind === "scheme" && authored.value === "phClr" && stop.color.kind === "srgb") {
|
|
28095
28099
|
const original = themed.get(`#${stop.color.value}`.toUpperCase());
|
|
28096
28100
|
if (original)
|
|
@@ -29778,12 +29782,12 @@ function reanchor(xml, anchor) {
|
|
|
29778
29782
|
).documentElement;
|
|
29779
29783
|
for (const candidate2 of Array.from(holder.childNodes)) {
|
|
29780
29784
|
if (candidate2.nodeType !== 1) continue;
|
|
29781
|
-
const
|
|
29782
|
-
const original = first(old,
|
|
29783
|
-
const position = original ? original.cloneNode(true) : doc.importNode(
|
|
29784
|
-
for (const attribute2 of Array.from(
|
|
29785
|
+
const template2 = candidate2;
|
|
29786
|
+
const original = first(old, template2.localName, NS.xdr);
|
|
29787
|
+
const position = original ? original.cloneNode(true) : doc.importNode(template2, true);
|
|
29788
|
+
for (const attribute2 of Array.from(template2.attributes))
|
|
29785
29789
|
position.setAttribute(attribute2.name, attribute2.value);
|
|
29786
|
-
for (const value of Array.from(
|
|
29790
|
+
for (const value of Array.from(template2.childNodes)) {
|
|
29787
29791
|
if (value.nodeType !== 1) continue;
|
|
29788
29792
|
const item2 = value;
|
|
29789
29793
|
const existing = first(position, item2.localName, NS.xdr);
|
|
@@ -32706,14 +32710,14 @@ function linearFit(xs, ys) {
|
|
|
32706
32710
|
return { slope, intercept: my - slope * mx };
|
|
32707
32711
|
}
|
|
32708
32712
|
function rank2(values2, x, ascending, average) {
|
|
32709
|
-
let
|
|
32713
|
+
let better2 = 0;
|
|
32710
32714
|
let ties = 0;
|
|
32711
32715
|
for (const v of values2) {
|
|
32712
32716
|
if (v === x) ties++;
|
|
32713
|
-
else if (ascending ? v < x : v > x)
|
|
32717
|
+
else if (ascending ? v < x : v > x) better2++;
|
|
32714
32718
|
}
|
|
32715
32719
|
if (ties === 0) fail(ERR.NA);
|
|
32716
|
-
return average ?
|
|
32720
|
+
return average ? better2 + (ties + 1) / 2 : better2 + 1;
|
|
32717
32721
|
}
|
|
32718
32722
|
function gamma(z) {
|
|
32719
32723
|
if (z < 0.5) return Math.PI / (Math.sin(Math.PI * z) * gamma(1 - z));
|
|
@@ -37918,11 +37922,11 @@ function binomDist(k, n, p, cumulative2) {
|
|
|
37918
37922
|
for (let i = 0; i <= kk; i++) total2 += binomPmf(i, nn, p);
|
|
37919
37923
|
return Math.min(1, total2);
|
|
37920
37924
|
}
|
|
37921
|
-
function poisson(k,
|
|
37925
|
+
function poisson(k, mean9, cumulative2) {
|
|
37922
37926
|
const kk = Math.trunc(k);
|
|
37923
|
-
if (kk < 0 ||
|
|
37924
|
-
if (cumulative2) return 1 - gammaP(kk + 1,
|
|
37925
|
-
return Math.exp(kk * Math.log(
|
|
37927
|
+
if (kk < 0 || mean9 < 0) fail(ERR.NUM);
|
|
37928
|
+
if (cumulative2) return 1 - gammaP(kk + 1, mean9);
|
|
37929
|
+
return Math.exp(kk * Math.log(mean9) - mean9 - gammaLn(kk + 1));
|
|
37926
37930
|
}
|
|
37927
37931
|
var EPS, erf, normCdf, normPdf, tCdf, tPdf, chiCdf, positive2, probability, normDist;
|
|
37928
37932
|
var init_dist_core = __esm({
|
|
@@ -37957,11 +37961,307 @@ var init_dist_core = __esm({
|
|
|
37957
37961
|
}
|
|
37958
37962
|
});
|
|
37959
37963
|
|
|
37964
|
+
// xlsx/formula/functions/ets-init-three.ts
|
|
37965
|
+
function slopeOf(v) {
|
|
37966
|
+
const k = v.length;
|
|
37967
|
+
const mx = (k - 1) / 2;
|
|
37968
|
+
const my = mean2(v);
|
|
37969
|
+
let sxy = 0;
|
|
37970
|
+
let sxx = 0;
|
|
37971
|
+
for (let i = 0; i < k; i++) {
|
|
37972
|
+
sxy += (i - mx) * (v[i] - my);
|
|
37973
|
+
sxx += (i - mx) * (i - mx);
|
|
37974
|
+
}
|
|
37975
|
+
return sxx === 0 ? 0 : sxy / sxx;
|
|
37976
|
+
}
|
|
37977
|
+
function positionSlopes(y, m) {
|
|
37978
|
+
return Array.from({ length: m }, (_v, c2) => {
|
|
37979
|
+
const vals = [];
|
|
37980
|
+
for (let t = c2; t < y.length; t += m) vals.push(y[t]);
|
|
37981
|
+
return slopeOf(vals) / m;
|
|
37982
|
+
});
|
|
37983
|
+
}
|
|
37984
|
+
function isThreeSeasonLength(n, m) {
|
|
37985
|
+
return m >= 4 && n >= 3 * m && n <= 3 * m + Math.ceil(m / 2) + 1;
|
|
37986
|
+
}
|
|
37987
|
+
function threeSeasonSeasonals(y, m, slopeSumOverride) {
|
|
37988
|
+
const n = y.length;
|
|
37989
|
+
const extra = n - 3 * m;
|
|
37990
|
+
const j0 = Math.floor(m / 2);
|
|
37991
|
+
const at = (t) => y[t];
|
|
37992
|
+
const slope = (j) => (at(j + 2 * m) - at(j)) / (2 * m);
|
|
37993
|
+
const B = (j) => j + 2 * m < n ? slope(j) : slope(j % m);
|
|
37994
|
+
const e = (t) => at(t) - at(t - 1) - B(t - j0);
|
|
37995
|
+
const slopeSum = slopeSumOverride ?? positionSlopes(y, m).reduce((a2, b) => a2 + b, 0);
|
|
37996
|
+
const out = [0];
|
|
37997
|
+
for (let k = 1; k < m; k++) {
|
|
37998
|
+
let back = 0;
|
|
37999
|
+
for (let t = k + 1; t <= m; t++) back -= e(t);
|
|
38000
|
+
let fwd = 0;
|
|
38001
|
+
for (let t = m + 1; t <= m + k; t++) fwd += e(t);
|
|
38002
|
+
if (k < j0 - 1) {
|
|
38003
|
+
out.push(fwd);
|
|
38004
|
+
continue;
|
|
38005
|
+
}
|
|
38006
|
+
if (k === m - 1 && extra <= Math.ceil(m / 2)) {
|
|
38007
|
+
out.push(back);
|
|
38008
|
+
continue;
|
|
38009
|
+
}
|
|
38010
|
+
const wrapped = Math.max(0, k - j0 + 1 - extra);
|
|
38011
|
+
let corner4 = 0;
|
|
38012
|
+
for (let i = extra; i <= k - j0; i++)
|
|
38013
|
+
corner4 += (at(i + m) + at(i + 2 * m) - 2 * at(i)) / (4 * m);
|
|
38014
|
+
const level4 = (at(k) + at(m + k)) / 2 - at(m);
|
|
38015
|
+
const bb = back - (at(k) - at(m));
|
|
38016
|
+
const ff = fwd - (at(m + k) - at(m));
|
|
38017
|
+
out.push(level4 + (bb + ff) / 2 - 3 * wrapped / (4 * m) * slopeSum + corner4);
|
|
38018
|
+
}
|
|
38019
|
+
return out;
|
|
38020
|
+
}
|
|
38021
|
+
function padThreeSeasons(y, m, slopeMean = mean2(positionSlopes(y, m))) {
|
|
38022
|
+
const n = y.length;
|
|
38023
|
+
const total2 = Math.max(3 * m + Math.ceil(m / 2), n);
|
|
38024
|
+
const ext = [...y];
|
|
38025
|
+
for (let t = n; t < total2; t++) ext.push(y[t - 3 * m] + 3 * m * slopeMean);
|
|
38026
|
+
return ext;
|
|
38027
|
+
}
|
|
38028
|
+
function threeSeasonTrend(y, m, rel, slopeMean) {
|
|
38029
|
+
const ext = padThreeSeasons(y, m, slopeMean);
|
|
38030
|
+
const total2 = ext.length;
|
|
38031
|
+
const mx = (total2 - 1) / 2;
|
|
38032
|
+
let sxx = 0;
|
|
38033
|
+
let sxy = 0;
|
|
38034
|
+
for (let t = 0; t < total2; t++) {
|
|
38035
|
+
sxx += (t - mx) * (t - mx);
|
|
38036
|
+
sxy += (t - mx) * (ext[t] - rel[t % m]);
|
|
38037
|
+
}
|
|
38038
|
+
return sxy / sxx;
|
|
38039
|
+
}
|
|
38040
|
+
function isTwoSeasonLength(n, m) {
|
|
38041
|
+
return m >= 4 && n === 2 * m;
|
|
38042
|
+
}
|
|
38043
|
+
function isTwoPlusLength(n, m) {
|
|
38044
|
+
return m >= 4 && n > 2 * m && n < 3 * m;
|
|
38045
|
+
}
|
|
38046
|
+
function slopeSumOf(y, m) {
|
|
38047
|
+
return positionSlopes(y, m).reduce((a2, c2) => a2 + c2, 0);
|
|
38048
|
+
}
|
|
38049
|
+
function extendTwoSeasons(y, m) {
|
|
38050
|
+
const b = mean2(positionSlopes(y, m));
|
|
38051
|
+
const out = [...y];
|
|
38052
|
+
for (let t = y.length; t < 3 * m; t++) out.push(y[t - 2 * m] + 2 * m * b);
|
|
38053
|
+
return out;
|
|
38054
|
+
}
|
|
38055
|
+
function paddedSearchSeries(y, m) {
|
|
38056
|
+
if (isTwoSeasonLength(y.length, m) || isTwoPlusLength(y.length, m))
|
|
38057
|
+
return padThreeSeasons(extendTwoSeasons(y, m), m, slopeSumOf(y, m) / m);
|
|
38058
|
+
if (isThreeSeasonLength(y.length, m)) return padThreeSeasons(y, m);
|
|
38059
|
+
return void 0;
|
|
38060
|
+
}
|
|
38061
|
+
var mean2;
|
|
38062
|
+
var init_ets_init_three = __esm({
|
|
38063
|
+
"xlsx/formula/functions/ets-init-three.ts"() {
|
|
38064
|
+
mean2 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38065
|
+
}
|
|
38066
|
+
});
|
|
38067
|
+
|
|
38068
|
+
// xlsx/formula/functions/ets-init-states.ts
|
|
38069
|
+
function chainStates(y, m, seasons) {
|
|
38070
|
+
const h = Math.floor(seasons / 2);
|
|
38071
|
+
const first2 = seasons - h;
|
|
38072
|
+
const at = (t) => y[t];
|
|
38073
|
+
const meanFirst = (t) => mean3(Array.from({ length: first2 }, (_v, c2) => at(t + c2 * m)));
|
|
38074
|
+
const slope = (j) => {
|
|
38075
|
+
const early = mean3(Array.from({ length: h }, (_v, c2) => at(j + c2 * m)));
|
|
38076
|
+
const late = mean3(Array.from({ length: h }, (_v, c2) => at(j + (seasons - h + c2) * m)));
|
|
38077
|
+
return (late - early) / ((seasons - h) * m);
|
|
38078
|
+
};
|
|
38079
|
+
const j0 = Math.floor(m / 2);
|
|
38080
|
+
const state = /* @__PURE__ */ new Map([[j0 - 1, 0]]);
|
|
38081
|
+
for (let t = j0; t <= j0 + m - 2; t++)
|
|
38082
|
+
state.set(t, state.get(t - 1) + meanFirst(t) - meanFirst(t - 1) - slope(t - j0));
|
|
38083
|
+
const byPosition = new Array(m).fill(0);
|
|
38084
|
+
for (const [t, s] of state) byPosition[t % m] = s;
|
|
38085
|
+
return byPosition;
|
|
38086
|
+
}
|
|
38087
|
+
function chainSeasonals(y, m, seasons) {
|
|
38088
|
+
const byPosition = chainStates(y, m, seasons);
|
|
38089
|
+
const origin = byPosition[0];
|
|
38090
|
+
return byPosition.map((s) => s - origin);
|
|
38091
|
+
}
|
|
38092
|
+
var mean3;
|
|
38093
|
+
var init_ets_init_states = __esm({
|
|
38094
|
+
"xlsx/formula/functions/ets-init-states.ts"() {
|
|
38095
|
+
mean3 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38096
|
+
}
|
|
38097
|
+
});
|
|
38098
|
+
|
|
38099
|
+
// xlsx/formula/functions/ets-init-four.ts
|
|
38100
|
+
function template(w, m, a2) {
|
|
38101
|
+
const block = (c2) => mean4(w.slice(c2 * m, (c2 + 1) * m));
|
|
38102
|
+
const at = (i) => w[i];
|
|
38103
|
+
return (block(0) - block(2)) / 12 + (block(1) - block(3)) / 6 - (at(a2) + at(a2 + m) - 2 * at(a2 + 2 * m)) / 6;
|
|
38104
|
+
}
|
|
38105
|
+
function fourSeasonPlusSeasonals(y, m) {
|
|
38106
|
+
const r = y.length - 4 * m;
|
|
38107
|
+
const a2 = Math.floor(m / 2) - 1;
|
|
38108
|
+
const states = chainStates(y.slice(0, 4 * m), m, 4);
|
|
38109
|
+
for (let q = 0; q < r; q++) {
|
|
38110
|
+
const pos = (a2 + q) % m;
|
|
38111
|
+
states[pos] = states[pos] + template(y.slice(q, q + 4 * m), m, a2);
|
|
38112
|
+
}
|
|
38113
|
+
const origin = states[0];
|
|
38114
|
+
return states.map((s) => s - origin);
|
|
38115
|
+
}
|
|
38116
|
+
var mean4;
|
|
38117
|
+
var init_ets_init_four = __esm({
|
|
38118
|
+
"xlsx/formula/functions/ets-init-four.ts"() {
|
|
38119
|
+
init_ets_init_states();
|
|
38120
|
+
mean4 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38121
|
+
}
|
|
38122
|
+
});
|
|
38123
|
+
|
|
38124
|
+
// xlsx/formula/functions/ets-init-threeplus.ts
|
|
38125
|
+
function isThreePlusLength(n, m) {
|
|
38126
|
+
return m >= 4 && n >= 3 * m + Math.ceil(m / 2) + 2 && n < 4 * m;
|
|
38127
|
+
}
|
|
38128
|
+
function shift2(y, m, k) {
|
|
38129
|
+
const a2 = Math.ceil(m / 2) + 1;
|
|
38130
|
+
const at = (i) => y[i];
|
|
38131
|
+
return (at(m + k) - at(2 * m + k)) / 2 - (mean5(y.slice(a2 + k, a2 + k + m)) - mean5(y.slice(a2 + 2 * m + k, a2 + 3 * m + k))) / 4;
|
|
38132
|
+
}
|
|
38133
|
+
function isLowThreeLength(n, m) {
|
|
38134
|
+
return m === 2 && n >= 5 && n < 8 || m === 3 && n >= 6 && n < 12;
|
|
38135
|
+
}
|
|
38136
|
+
function lowSeasonSeasonals(y, m, slopeSum) {
|
|
38137
|
+
const base = threeSeasonSeasonals(y, m, slopeSum);
|
|
38138
|
+
const d = -shift2(y, m, -m);
|
|
38139
|
+
return base.map((s, k) => k === 0 ? 0 : s + d);
|
|
38140
|
+
}
|
|
38141
|
+
function threePlusSeasonals(y, m) {
|
|
38142
|
+
const base = threeSeasonSeasonals(y, m);
|
|
38143
|
+
const moved = y.length - 3 * m - Math.ceil(m / 2) - 1;
|
|
38144
|
+
const z = base.map((s, k) => k < moved ? s - shift2(y, m, k) : s);
|
|
38145
|
+
const origin = z[0];
|
|
38146
|
+
return z.map((s) => s - origin);
|
|
38147
|
+
}
|
|
38148
|
+
var mean5;
|
|
38149
|
+
var init_ets_init_threeplus = __esm({
|
|
38150
|
+
"xlsx/formula/functions/ets-init-threeplus.ts"() {
|
|
38151
|
+
init_ets_init_three();
|
|
38152
|
+
mean5 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38153
|
+
}
|
|
38154
|
+
});
|
|
38155
|
+
|
|
38156
|
+
// xlsx/formula/functions/ets-init-short.ts
|
|
38157
|
+
function seasonStart(m) {
|
|
38158
|
+
return Math.ceil(10 * (m + 1) / 7);
|
|
38159
|
+
}
|
|
38160
|
+
function isShortSeasonLength(n, m) {
|
|
38161
|
+
return m >= 5 && n >= seasonStart(m) && n < 2 * m;
|
|
38162
|
+
}
|
|
38163
|
+
function padTwoSeasons(y, m) {
|
|
38164
|
+
const p = [...y];
|
|
38165
|
+
for (let t = y.length; t < 2 * m; t++) p.push(p[t - m]);
|
|
38166
|
+
return p;
|
|
38167
|
+
}
|
|
38168
|
+
function trendShift(m, n) {
|
|
38169
|
+
const j0 = Math.floor(m / 2);
|
|
38170
|
+
const u = 2 * m - 1 - n;
|
|
38171
|
+
return (u * u - (j0 - 2) * u + 2 * (j0 - 1)) / 4;
|
|
38172
|
+
}
|
|
38173
|
+
function shortSeasonStart(y, m) {
|
|
38174
|
+
const n = y.length;
|
|
38175
|
+
const p = padTwoSeasons(y, m);
|
|
38176
|
+
const ss = slopeSumOf(p, m);
|
|
38177
|
+
const ext = extendTwoSeasons(p, m);
|
|
38178
|
+
const base = threeSeasonSeasonals(ext, m, ss);
|
|
38179
|
+
const total2 = 3 * m + Math.ceil(m / 2);
|
|
38180
|
+
const sxx = total2 * (total2 * total2 - 1) / 12;
|
|
38181
|
+
const trend = threeSeasonTrend(ext, m, base, ss / m) + trendShift(m, n) * ss / sxx;
|
|
38182
|
+
const rel = base.map((s, k) => k >= n - m && k <= m - 2 ? s + ss / 2 : s);
|
|
38183
|
+
return { rel, trend };
|
|
38184
|
+
}
|
|
38185
|
+
function shortSearchSeries(y, m) {
|
|
38186
|
+
const p = padTwoSeasons(y, m);
|
|
38187
|
+
return padThreeSeasons(extendTwoSeasons(p, m), m, slopeSumOf(p, m) / m);
|
|
38188
|
+
}
|
|
38189
|
+
var init_ets_init_short = __esm({
|
|
38190
|
+
"xlsx/formula/functions/ets-init-short.ts"() {
|
|
38191
|
+
init_ets_init_three();
|
|
38192
|
+
}
|
|
38193
|
+
});
|
|
38194
|
+
|
|
38195
|
+
// xlsx/formula/functions/ets-init-chain.ts
|
|
38196
|
+
function isExactLength(n, m) {
|
|
38197
|
+
const whole = Math.floor(n / m);
|
|
38198
|
+
return whole >= MAX_SEASONS || whole === 4 || isThreeSeasonLength(n, m) || isThreePlusLength(n, m) || isLowThreeLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m) || isShortSeasonLength(n, m);
|
|
38199
|
+
}
|
|
38200
|
+
function fromRelative(y0, rel, trend) {
|
|
38201
|
+
const combined = rel.map((s) => y0 + s - trend);
|
|
38202
|
+
const level4 = mean6(combined);
|
|
38203
|
+
return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
|
|
38204
|
+
}
|
|
38205
|
+
function chainStart(y, m) {
|
|
38206
|
+
const n = y.length;
|
|
38207
|
+
const whole = Math.floor(n / m);
|
|
38208
|
+
if (isShortSeasonLength(n, m)) {
|
|
38209
|
+
const { rel: rel2, trend } = shortSeasonStart(y, m);
|
|
38210
|
+
return fromRelative(y[0], rel2, trend);
|
|
38211
|
+
}
|
|
38212
|
+
if (isThreeSeasonLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m)) {
|
|
38213
|
+
const short = isTwoSeasonLength(n, m) || isTwoPlusLength(n, m);
|
|
38214
|
+
const series = short ? extendTwoSeasons(y, m) : y;
|
|
38215
|
+
const rel2 = threeSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
|
|
38216
|
+
return fromRelative(
|
|
38217
|
+
y[0],
|
|
38218
|
+
rel2,
|
|
38219
|
+
threeSeasonTrend(series, m, rel2, short ? slopeSumOf(y, m) / m : void 0)
|
|
38220
|
+
);
|
|
38221
|
+
}
|
|
38222
|
+
if (isLowThreeLength(n, m)) {
|
|
38223
|
+
const short = n < 3 * m;
|
|
38224
|
+
const series = short ? extendTwoSeasons(y, m) : y;
|
|
38225
|
+
const rel2 = lowSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
|
|
38226
|
+
const pad7 = short ? slopeSumOf(y, m) / m : void 0;
|
|
38227
|
+
return fromRelative(y[0], rel2, threeSeasonTrend(series, m, rel2, pad7));
|
|
38228
|
+
}
|
|
38229
|
+
if (isThreePlusLength(n, m)) {
|
|
38230
|
+
const rel2 = threePlusSeasonals(y, m);
|
|
38231
|
+
return fromRelative(y[0], rel2, threeSeasonTrend(y, m, rel2));
|
|
38232
|
+
}
|
|
38233
|
+
if (m < 2 || whole < 4) return void 0;
|
|
38234
|
+
const partial = whole < MAX_SEASONS && n % m !== 0;
|
|
38235
|
+
const rel = partial ? fourSeasonPlusSeasonals(y, m) : chainSeasonals(y, m, Math.min(whole, MAX_SEASONS));
|
|
38236
|
+
const mx = (n - 1) / 2;
|
|
38237
|
+
let sxy = 0;
|
|
38238
|
+
let sxx = 0;
|
|
38239
|
+
const my = mean6(y.map((v, t) => v - rel[t % m]));
|
|
38240
|
+
for (let t = 0; t < n; t++) {
|
|
38241
|
+
const d = y[t] - rel[t % m] - my;
|
|
38242
|
+
sxy += (t - mx) * d;
|
|
38243
|
+
sxx += (t - mx) * (t - mx);
|
|
38244
|
+
}
|
|
38245
|
+
return fromRelative(y[0], rel, sxy / sxx);
|
|
38246
|
+
}
|
|
38247
|
+
var MAX_SEASONS, mean6;
|
|
38248
|
+
var init_ets_init_chain = __esm({
|
|
38249
|
+
"xlsx/formula/functions/ets-init-chain.ts"() {
|
|
38250
|
+
init_ets_init_three();
|
|
38251
|
+
init_ets_init_four();
|
|
38252
|
+
init_ets_init_threeplus();
|
|
38253
|
+
init_ets_init_short();
|
|
38254
|
+
init_ets_init_states();
|
|
38255
|
+
MAX_SEASONS = 5;
|
|
38256
|
+
mean6 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38257
|
+
}
|
|
38258
|
+
});
|
|
38259
|
+
|
|
37960
38260
|
// xlsx/formula/functions/ets-init.ts
|
|
37961
38261
|
function olsSlope(y) {
|
|
37962
38262
|
const n = y.length;
|
|
37963
38263
|
const mx = (n - 1) / 2;
|
|
37964
|
-
const my =
|
|
38264
|
+
const my = mean7(y);
|
|
37965
38265
|
let sxy = 0;
|
|
37966
38266
|
let sxx = 0;
|
|
37967
38267
|
for (let i = 0; i < n; i++) {
|
|
@@ -37970,12 +38270,18 @@ function olsSlope(y) {
|
|
|
37970
38270
|
}
|
|
37971
38271
|
return sxx === 0 ? 0 : sxy / sxx;
|
|
37972
38272
|
}
|
|
38273
|
+
function shortSeriesTrend(y) {
|
|
38274
|
+
const pads = PADS[y.length];
|
|
38275
|
+
if (!pads) return olsSlope(y);
|
|
38276
|
+
const slope = olsSlope(y);
|
|
38277
|
+
return olsSlope([...y, ...pads.map(([src, lag]) => y[src] + lag * slope)]);
|
|
38278
|
+
}
|
|
37973
38279
|
function split(trend, combined) {
|
|
37974
|
-
const level4 =
|
|
38280
|
+
const level4 = mean7(combined);
|
|
37975
38281
|
return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
|
|
37976
38282
|
}
|
|
37977
38283
|
function heuristicStates(y, m) {
|
|
37978
|
-
const trend = (
|
|
38284
|
+
const trend = (mean7(y.slice(m, 2 * m)) - mean7(y.slice(0, m))) / m;
|
|
37979
38285
|
return split(
|
|
37980
38286
|
trend,
|
|
37981
38287
|
Array.from({ length: m }, (_v, k) => y[k] - trend * (k + 1))
|
|
@@ -38012,9 +38318,11 @@ function solveSystem(a2, b) {
|
|
|
38012
38318
|
function initialStates(y, m, p, run2) {
|
|
38013
38319
|
const y0 = y[0];
|
|
38014
38320
|
if (m < 2) {
|
|
38015
|
-
const trend2 =
|
|
38321
|
+
const trend2 = shortSeriesTrend(y);
|
|
38016
38322
|
return { level: y0 - trend2, trend: trend2, season: [] };
|
|
38017
38323
|
}
|
|
38324
|
+
const exact = chainStart(y, m);
|
|
38325
|
+
if (exact) return exact;
|
|
38018
38326
|
if (m > MAX_EXACT_SEASON) return heuristicStates(y, m);
|
|
38019
38327
|
const zeros = new Array(y.length).fill(0);
|
|
38020
38328
|
const unit = (trend2, season) => run2(zeros, m, { level: 0, trend: trend2, season }, p).fitted;
|
|
@@ -38033,11 +38341,238 @@ function initialStates(y, m, p, run2) {
|
|
|
38033
38341
|
const trend = u[0];
|
|
38034
38342
|
return split(trend, [y0 - trend, ...u.slice(1)]);
|
|
38035
38343
|
}
|
|
38036
|
-
var MAX_EXACT_SEASON,
|
|
38344
|
+
var MAX_EXACT_SEASON, mean7, PADS;
|
|
38037
38345
|
var init_ets_init = __esm({
|
|
38038
38346
|
"xlsx/formula/functions/ets-init.ts"() {
|
|
38347
|
+
init_ets_init_chain();
|
|
38039
38348
|
MAX_EXACT_SEASON = 24;
|
|
38040
|
-
|
|
38349
|
+
mean7 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38350
|
+
PADS = {
|
|
38351
|
+
6: [[0, 6]],
|
|
38352
|
+
5: [
|
|
38353
|
+
[1, 4],
|
|
38354
|
+
[0, 6]
|
|
38355
|
+
],
|
|
38356
|
+
4: [
|
|
38357
|
+
[0, 4],
|
|
38358
|
+
[1, 4],
|
|
38359
|
+
[0, 6]
|
|
38360
|
+
]
|
|
38361
|
+
};
|
|
38362
|
+
}
|
|
38363
|
+
});
|
|
38364
|
+
|
|
38365
|
+
// xlsx/formula/functions/ets-search-map.ts
|
|
38366
|
+
function trendShape(y, h) {
|
|
38367
|
+
const n = y.length;
|
|
38368
|
+
const hold = h > 0 ? h : Math.max(1, Math.round(0.3 * n));
|
|
38369
|
+
const mx = (n - 1) / 2;
|
|
38370
|
+
let my = 0;
|
|
38371
|
+
for (const v of y) my += v;
|
|
38372
|
+
my /= n;
|
|
38373
|
+
let sxy = 0;
|
|
38374
|
+
let sxx = 0;
|
|
38375
|
+
let syy = 0;
|
|
38376
|
+
for (let i = 0; i < n; i++) {
|
|
38377
|
+
const dy = y[i] - my;
|
|
38378
|
+
sxy += (i - mx) * dy;
|
|
38379
|
+
sxx += (i - mx) * (i - mx);
|
|
38380
|
+
syy += dy * dy;
|
|
38381
|
+
}
|
|
38382
|
+
if (syy === 0 || sxx === 0 || n < 3) return { shift: 0, t: 0 };
|
|
38383
|
+
const slope = sxy / sxx;
|
|
38384
|
+
const resid = syy - slope * sxy;
|
|
38385
|
+
const se = Math.sqrt(Math.max(resid, 0) / (n - 2) / sxx);
|
|
38386
|
+
let tail = 0;
|
|
38387
|
+
for (let i = n - hold; i < n; i++) tail += y[i];
|
|
38388
|
+
let head = 0;
|
|
38389
|
+
for (let i = 0; i < n - hold; i++) head += y[i];
|
|
38390
|
+
const shift3 = Math.abs(tail / hold - head / (n - hold)) / Math.sqrt(syy / n);
|
|
38391
|
+
return { shift: shift3, t: se === 0 ? Number.POSITIVE_INFINITY : Math.abs(slope / se) };
|
|
38392
|
+
}
|
|
38393
|
+
function reportedFor(alpha, beta, shape2) {
|
|
38394
|
+
const key = `${alpha}/${beta}`;
|
|
38395
|
+
let drift;
|
|
38396
|
+
if (beta === LOW) drift = false;
|
|
38397
|
+
else if (ALWAYS_DRIFT.has(key)) drift = true;
|
|
38398
|
+
else if (NEVER_DRIFT.has(key)) drift = false;
|
|
38399
|
+
else drift = shape2.shift <= DRIFT_SHIFT && shape2.t <= DRIFT_T;
|
|
38400
|
+
return { alpha, beta: drift ? LOW : beta, fit: [alpha, beta], drift };
|
|
38401
|
+
}
|
|
38402
|
+
var LOW, DRIFT_SHIFT, DRIFT_T, CANDIDATES, ALWAYS_DRIFT, NEVER_DRIFT;
|
|
38403
|
+
var init_ets_search_map = __esm({
|
|
38404
|
+
"xlsx/formula/functions/ets-search-map.ts"() {
|
|
38405
|
+
LOW = 1e-3;
|
|
38406
|
+
DRIFT_SHIFT = 1.5;
|
|
38407
|
+
DRIFT_T = 9.3;
|
|
38408
|
+
CANDIDATES = [
|
|
38409
|
+
...[2e-3, 0.1, 0.126, 0.25, 0.5, 0.75, 0.9].map((a2) => [a2, LOW]),
|
|
38410
|
+
[0.1, 0.099],
|
|
38411
|
+
[0.126, 0.125],
|
|
38412
|
+
[0.25, 0.249],
|
|
38413
|
+
[0.333333, 0.166667],
|
|
38414
|
+
[0.5, 0.25],
|
|
38415
|
+
[0.5, 0.499],
|
|
38416
|
+
[0.666667, 0.166667],
|
|
38417
|
+
[0.666667, 0.5],
|
|
38418
|
+
[0.75, 0.749],
|
|
38419
|
+
[0.833333, 0.75],
|
|
38420
|
+
[0.9, 0.899],
|
|
38421
|
+
[0.998, 0.099],
|
|
38422
|
+
[0.998, 0.249],
|
|
38423
|
+
[0.998, 0.499],
|
|
38424
|
+
[0.998, 0.749],
|
|
38425
|
+
[0.998, 0.899],
|
|
38426
|
+
[0.166667, 0.0833333],
|
|
38427
|
+
[0.833333, 0.0833333]
|
|
38428
|
+
];
|
|
38429
|
+
ALWAYS_DRIFT = /* @__PURE__ */ new Set([
|
|
38430
|
+
"0.1/0.099",
|
|
38431
|
+
"0.998/0.899",
|
|
38432
|
+
"0.998/0.749",
|
|
38433
|
+
"0.166667/0.0833333",
|
|
38434
|
+
"0.25/0.249",
|
|
38435
|
+
"0.9/0.899",
|
|
38436
|
+
"0.666667/0.5",
|
|
38437
|
+
"0.75/0.749"
|
|
38438
|
+
]);
|
|
38439
|
+
NEVER_DRIFT = /* @__PURE__ */ new Set(["0.333333/0.166667"]);
|
|
38440
|
+
}
|
|
38441
|
+
});
|
|
38442
|
+
|
|
38443
|
+
// xlsx/formula/functions/ets-search.ts
|
|
38444
|
+
function better(c2, best) {
|
|
38445
|
+
return c2 < best * (1 - 1e-6) && c2 < best - 1e-12;
|
|
38446
|
+
}
|
|
38447
|
+
function searchSeasonalLattice(cost, extra = []) {
|
|
38448
|
+
let best = { alpha: 0.126, beta: LOW2, gamma: LOW2 };
|
|
38449
|
+
let bestCost = cost(best);
|
|
38450
|
+
for (const [alpha, beta, gamma2] of [...SEASONAL_TRIPLES, ...extra]) {
|
|
38451
|
+
const c2 = cost({ alpha, beta, gamma: gamma2 });
|
|
38452
|
+
if (better(c2, bestCost)) {
|
|
38453
|
+
bestCost = c2;
|
|
38454
|
+
best = { alpha, beta, gamma: gamma2 };
|
|
38455
|
+
}
|
|
38456
|
+
}
|
|
38457
|
+
return { ...best, drift: false };
|
|
38458
|
+
}
|
|
38459
|
+
function searchSeasonal(n, cost) {
|
|
38460
|
+
let best = { alpha: 0.9, beta: LOW2, gamma: LOW2 };
|
|
38461
|
+
let bestCost = cost(best);
|
|
38462
|
+
for (const a2 of SEASON_ALPHAS)
|
|
38463
|
+
for (const b of n >= 7 && n <= SHORT_SERIES ? [LOW2, a2 - LOW2] : [LOW2])
|
|
38464
|
+
for (const g of [...SEASON_STEPS, 1 - a2 - LOW2]) {
|
|
38465
|
+
if (b < LOW2 || g > 1 - a2 - LOW2 + 1e-9) continue;
|
|
38466
|
+
const c2 = cost({ alpha: a2, beta: b, gamma: g });
|
|
38467
|
+
if (better(c2, bestCost)) {
|
|
38468
|
+
bestCost = c2;
|
|
38469
|
+
best = { alpha: a2, beta: b, gamma: g };
|
|
38470
|
+
}
|
|
38471
|
+
}
|
|
38472
|
+
return { ...best, drift: false };
|
|
38473
|
+
}
|
|
38474
|
+
function searchLattice(shape2, cost) {
|
|
38475
|
+
let best = [0.9, LOW2];
|
|
38476
|
+
let bestCost = cost({ alpha: 0.9, beta: LOW2, gamma: LOW2 });
|
|
38477
|
+
for (const [alpha, beta] of CANDIDATES) {
|
|
38478
|
+
const c2 = cost({ alpha, beta, gamma: LOW2 });
|
|
38479
|
+
if (better(c2, bestCost)) {
|
|
38480
|
+
bestCost = c2;
|
|
38481
|
+
best = [alpha, beta];
|
|
38482
|
+
}
|
|
38483
|
+
}
|
|
38484
|
+
const out = reportedFor(best[0], best[1], shape2);
|
|
38485
|
+
const [fa, fb] = out.fit;
|
|
38486
|
+
const same8 = fa === out.alpha && fb === out.beta;
|
|
38487
|
+
return {
|
|
38488
|
+
alpha: out.alpha,
|
|
38489
|
+
beta: out.beta,
|
|
38490
|
+
gamma: LOW2,
|
|
38491
|
+
drift: out.drift,
|
|
38492
|
+
...same8 ? {} : { fit: { alpha: fa, beta: fb, gamma: LOW2 } }
|
|
38493
|
+
};
|
|
38494
|
+
}
|
|
38495
|
+
function chooseSmoothing(n, m, cost, shape2 = { shift: 9, t: 99 }) {
|
|
38496
|
+
if (m >= 2 && isShortSeasonLength(n, m)) return searchSeasonalLattice(cost, SHORT_EXTRA_TRIPLES);
|
|
38497
|
+
if (m >= 2) return isExactLength(n, m) ? searchSeasonalLattice(cost) : searchSeasonal(n, cost);
|
|
38498
|
+
if (n < MIN_SEARCH_POINTS) return THREE_POINTS;
|
|
38499
|
+
return searchLattice(shape2, cost);
|
|
38500
|
+
}
|
|
38501
|
+
var LOW2, MIN_SEARCH_POINTS, THREE_POINTS, SEASON_ALPHAS, SEASON_STEPS, SHORT_SERIES, SEASONAL_TRIPLES, SHORT_EXTRA_TRIPLES;
|
|
38502
|
+
var init_ets_search = __esm({
|
|
38503
|
+
"xlsx/formula/functions/ets-search.ts"() {
|
|
38504
|
+
init_ets_init_chain();
|
|
38505
|
+
init_ets_init_short();
|
|
38506
|
+
init_ets_search_map();
|
|
38507
|
+
LOW2 = 1e-3;
|
|
38508
|
+
MIN_SEARCH_POINTS = 4;
|
|
38509
|
+
THREE_POINTS = { alpha: 0.1, beta: 0.099, gamma: LOW2, drift: false };
|
|
38510
|
+
SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
|
|
38511
|
+
SEASON_STEPS = [LOW2, 0.125, 0.25, 0.5, 0.75, 0.9];
|
|
38512
|
+
SHORT_SERIES = 16;
|
|
38513
|
+
SEASONAL_TRIPLES = [
|
|
38514
|
+
[0.126, LOW2, LOW2],
|
|
38515
|
+
[0.251, LOW2, LOW2],
|
|
38516
|
+
[0.501, LOW2, LOW2],
|
|
38517
|
+
[0.751, LOW2, LOW2],
|
|
38518
|
+
[2e-3, LOW2, 0.125],
|
|
38519
|
+
[2e-3, LOW2, 0.25],
|
|
38520
|
+
[2e-3, LOW2, 0.5],
|
|
38521
|
+
[2e-3, LOW2, 0.75],
|
|
38522
|
+
[0.251, LOW2, 0.25],
|
|
38523
|
+
[0.75, LOW2, 0.249],
|
|
38524
|
+
[0.9, LOW2, 0.099],
|
|
38525
|
+
[0.251, 0.25, LOW2],
|
|
38526
|
+
[0.1, LOW2, 0.899],
|
|
38527
|
+
[0.126, 0.125, LOW2],
|
|
38528
|
+
[0.998, 0.099, LOW2],
|
|
38529
|
+
[0.25, LOW2, 0.749],
|
|
38530
|
+
[0.5, LOW2, 0.499],
|
|
38531
|
+
[0.5, 0.25, LOW2],
|
|
38532
|
+
[0.251, 0.25, 0.25],
|
|
38533
|
+
[0.501, 0.5, LOW2]
|
|
38534
|
+
];
|
|
38535
|
+
SHORT_EXTRA_TRIPLES = [
|
|
38536
|
+
[1 / 6, 1 / 12, 1 / 12],
|
|
38537
|
+
[1 / 3, 1 / 6, 1 / 6],
|
|
38538
|
+
[1 / 6, 1 / 12, 0.75],
|
|
38539
|
+
[1 / 3, 1 / 6, 0.5],
|
|
38540
|
+
[5 / 6, 1 / 12, 1 / 12]
|
|
38541
|
+
];
|
|
38542
|
+
}
|
|
38543
|
+
});
|
|
38544
|
+
|
|
38545
|
+
// xlsx/formula/functions/ets-validate.ts
|
|
38546
|
+
function etsSearchSeries(y) {
|
|
38547
|
+
const pads = PADS[y.length];
|
|
38548
|
+
if (!pads) return y;
|
|
38549
|
+
const slope = olsSlope(y);
|
|
38550
|
+
return [...y, ...pads.map(([src, lag]) => y[src] + lag * slope)];
|
|
38551
|
+
}
|
|
38552
|
+
function etsValidationCost(y, m, init, p, holdout) {
|
|
38553
|
+
const n = y.length;
|
|
38554
|
+
const train = n - holdout;
|
|
38555
|
+
let { level: level4, trend } = init;
|
|
38556
|
+
const season = [...init.season];
|
|
38557
|
+
let sse = 0;
|
|
38558
|
+
for (let t = 0; t < train; t++) {
|
|
38559
|
+
const k = m >= 2 ? t % m : 0;
|
|
38560
|
+
const e = y[t] - (level4 + trend + (m >= 2 ? season[k] ?? 0 : 0));
|
|
38561
|
+
sse += e * e;
|
|
38562
|
+
level4 += trend + p.alpha * e;
|
|
38563
|
+
trend += p.beta * e;
|
|
38564
|
+
if (m >= 2) season[k] = (season[k] ?? 0) + p.gamma * e;
|
|
38565
|
+
}
|
|
38566
|
+
for (let j = 1; j <= holdout; j++) {
|
|
38567
|
+
const t = train + j - 1;
|
|
38568
|
+
const e = y[t] - (level4 + j * trend + (m >= 2 ? season[t % m] ?? 0 : 0));
|
|
38569
|
+
sse += e * e;
|
|
38570
|
+
}
|
|
38571
|
+
return sse;
|
|
38572
|
+
}
|
|
38573
|
+
var init_ets_validate = __esm({
|
|
38574
|
+
"xlsx/formula/functions/ets-validate.ts"() {
|
|
38575
|
+
init_ets_init();
|
|
38041
38576
|
}
|
|
38042
38577
|
});
|
|
38043
38578
|
|
|
@@ -38062,27 +38597,32 @@ function etsRun(y, m, init, p) {
|
|
|
38062
38597
|
function fitEts(y, seasonLength) {
|
|
38063
38598
|
const n = y.length;
|
|
38064
38599
|
if (n < 2) fail(ERR.NUM);
|
|
38065
|
-
const m = seasonLength >= 2 && n >=
|
|
38600
|
+
const m = seasonLength >= 2 && n >= seasonStart(seasonLength) ? seasonLength : 0;
|
|
38066
38601
|
const solve2 = (p) => {
|
|
38067
38602
|
const init = initialStates(y, m, p, etsRun);
|
|
38068
38603
|
return { init, run: etsRun(y, m, init, p) };
|
|
38069
38604
|
};
|
|
38070
|
-
const
|
|
38071
|
-
|
|
38072
|
-
|
|
38073
|
-
|
|
38074
|
-
|
|
38075
|
-
|
|
38076
|
-
|
|
38077
|
-
|
|
38078
|
-
|
|
38079
|
-
|
|
38080
|
-
|
|
38081
|
-
|
|
38082
|
-
|
|
38083
|
-
|
|
38084
|
-
|
|
38085
|
-
|
|
38605
|
+
const exact = m < 2 || isExactLength(n, m);
|
|
38606
|
+
const padded = m >= 2 && exact ? isShortSeasonLength(n, m) ? shortSearchSeries(y, m) : paddedSearchSeries(y, m) : void 0;
|
|
38607
|
+
const searched = padded ?? (m >= 2 ? y : etsSearchSeries(y));
|
|
38608
|
+
const holdout = m >= 2 && !exact ? 0 : etsHoldout(padded && !(m >= 2 && isShortSeasonLength(n, m)) ? padded.length : n, m);
|
|
38609
|
+
const { drift, fit, ...chosen } = chooseSmoothing(
|
|
38610
|
+
n,
|
|
38611
|
+
m,
|
|
38612
|
+
(p) => etsValidationCost(searched, m, solve2(p).init, p, holdout),
|
|
38613
|
+
trendShape(y, holdout)
|
|
38614
|
+
);
|
|
38615
|
+
const { run: run2 } = solve2(fit ?? chosen);
|
|
38616
|
+
const state = drift ? solve2({ alpha: 1, beta: 0, gamma: chosen.gamma }).run : run2;
|
|
38617
|
+
return {
|
|
38618
|
+
...chosen,
|
|
38619
|
+
gamma: m >= 2 ? chosen.gamma : NO_SEASON_GAMMA,
|
|
38620
|
+
m,
|
|
38621
|
+
n,
|
|
38622
|
+
...run2,
|
|
38623
|
+
level: state.level,
|
|
38624
|
+
trend: state.trend
|
|
38625
|
+
};
|
|
38086
38626
|
}
|
|
38087
38627
|
function etsHoldout(n, m) {
|
|
38088
38628
|
if (n < 11) return 0;
|
|
@@ -38103,17 +38643,18 @@ function etsErrorSd(fit, h) {
|
|
|
38103
38643
|
}
|
|
38104
38644
|
return Math.sqrt(sigma2 * v);
|
|
38105
38645
|
}
|
|
38106
|
-
var
|
|
38646
|
+
var NO_SEASON_GAMMA;
|
|
38107
38647
|
var init_ets_core = __esm({
|
|
38108
38648
|
"xlsx/formula/functions/ets-core.ts"() {
|
|
38109
38649
|
init_values();
|
|
38110
38650
|
init_ets_init();
|
|
38111
|
-
|
|
38112
|
-
|
|
38651
|
+
init_ets_init_chain();
|
|
38652
|
+
init_ets_init_short();
|
|
38653
|
+
init_ets_init_three();
|
|
38654
|
+
init_ets_search();
|
|
38655
|
+
init_ets_search_map();
|
|
38656
|
+
init_ets_validate();
|
|
38113
38657
|
NO_SEASON_GAMMA = Number.EPSILON;
|
|
38114
|
-
ALPHAS = [2e-3, 0.1, 0.126, 0.25, 0.5, 2 / 3, 0.75, 0.9];
|
|
38115
|
-
SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
|
|
38116
|
-
SEASON_STEPS = [LOW, 0.125, 0.25, 0.5, 0.75, 0.9];
|
|
38117
38658
|
}
|
|
38118
38659
|
});
|
|
38119
38660
|
|
|
@@ -38121,7 +38662,7 @@ var init_ets_core = __esm({
|
|
|
38121
38662
|
function detrend(y) {
|
|
38122
38663
|
const n = y.length;
|
|
38123
38664
|
const mx = (n - 1) / 2;
|
|
38124
|
-
const my =
|
|
38665
|
+
const my = mean8(y);
|
|
38125
38666
|
let sxy = 0;
|
|
38126
38667
|
let sxx = 0;
|
|
38127
38668
|
for (let i = 0; i < n; i++) {
|
|
@@ -38138,42 +38679,31 @@ function detectSeasonality(series) {
|
|
|
38138
38679
|
const r = detrend(y);
|
|
38139
38680
|
const scale2 = Math.max(...y.map(Math.abs), 1);
|
|
38140
38681
|
if (r.every((v) => Math.abs(v) <= 1e-12 * scale2)) return 0;
|
|
38141
|
-
const
|
|
38142
|
-
|
|
38143
|
-
for (
|
|
38144
|
-
|
|
38145
|
-
|
|
38682
|
+
const maxLag = Math.floor(n / MIN_CYCLES);
|
|
38683
|
+
let energy = 0;
|
|
38684
|
+
for (const v of r) energy += v * v;
|
|
38685
|
+
const acf = (lag) => {
|
|
38686
|
+
let s = 0;
|
|
38687
|
+
for (let t = 0; t + lag < n; t++) s += r[t] * r[t + lag];
|
|
38688
|
+
return s / energy;
|
|
38689
|
+
};
|
|
38690
|
+
let prev = acf(1);
|
|
38691
|
+
let cur = acf(2);
|
|
38692
|
+
for (let lag = 2; lag <= maxLag; lag++) {
|
|
38693
|
+
const next = acf(lag + 1);
|
|
38694
|
+
if (cur >= prev && cur >= next && cur >= MIN_ACF) return lag;
|
|
38695
|
+
prev = cur;
|
|
38696
|
+
cur = next;
|
|
38146
38697
|
}
|
|
38147
|
-
|
|
38148
|
-
|
|
38149
|
-
|
|
38150
|
-
for (let k = 1; k <= Math.floor(n / 2); k++) {
|
|
38151
|
-
let re = 0;
|
|
38152
|
-
let im = 0;
|
|
38153
|
-
for (let t = 0; t < n; t++) {
|
|
38154
|
-
const j = k * t % n;
|
|
38155
|
-
const v = r[t];
|
|
38156
|
-
re += v * cos2[j];
|
|
38157
|
-
im -= v * sin2[j];
|
|
38158
|
-
}
|
|
38159
|
-
const power2 = re * re + im * im;
|
|
38160
|
-
total2 += power2;
|
|
38161
|
-
if (k >= MIN_CYCLES && power2 > best) {
|
|
38162
|
-
best = power2;
|
|
38163
|
-
bestK = k;
|
|
38164
|
-
}
|
|
38165
|
-
}
|
|
38166
|
-
if (bestK === 0 || !(best / total2 >= MIN_SHARE)) return 0;
|
|
38167
|
-
const period = Math.round(n / bestK);
|
|
38168
|
-
return period >= 2 ? period : 0;
|
|
38169
|
-
}
|
|
38170
|
-
var MAX_POINTS, MIN_CYCLES, MIN_SHARE, mean3;
|
|
38698
|
+
return 0;
|
|
38699
|
+
}
|
|
38700
|
+
var MAX_POINTS, MIN_CYCLES, MIN_ACF, mean8;
|
|
38171
38701
|
var init_ets_season = __esm({
|
|
38172
38702
|
"xlsx/formula/functions/ets-season.ts"() {
|
|
38173
38703
|
MAX_POINTS = 8192;
|
|
38174
38704
|
MIN_CYCLES = 3;
|
|
38175
|
-
|
|
38176
|
-
|
|
38705
|
+
MIN_ACF = 0.3;
|
|
38706
|
+
mean8 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38177
38707
|
}
|
|
38178
38708
|
});
|
|
38179
38709
|
|
|
@@ -38247,9 +38777,9 @@ function aggregate2(code, xs) {
|
|
|
38247
38777
|
case 4:
|
|
38248
38778
|
return Math.max(...xs);
|
|
38249
38779
|
case 5:
|
|
38250
|
-
return Math.min(...xs);
|
|
38251
|
-
case 6:
|
|
38252
38780
|
return median2(xs);
|
|
38781
|
+
case 6:
|
|
38782
|
+
return Math.min(...xs);
|
|
38253
38783
|
default:
|
|
38254
38784
|
return xs.reduce((a2, b) => a2 + b, 0);
|
|
38255
38785
|
}
|
|
@@ -40948,7 +41478,7 @@ var init_captions = __esm({
|
|
|
40948
41478
|
functions: FUNCTIONS,
|
|
40949
41479
|
aggregates: aggregateNames()
|
|
40950
41480
|
};
|
|
40951
|
-
fillCaption = (
|
|
41481
|
+
fillCaption = (template2, ...args) => template2.replace(/\{(\d)\}/g, (_match, at) => args[Number(at)] ?? "");
|
|
40952
41482
|
}
|
|
40953
41483
|
});
|
|
40954
41484
|
|
|
@@ -41533,8 +42063,8 @@ var init_data2 = __esm({
|
|
|
41533
42063
|
function variance2(numbers3, sample) {
|
|
41534
42064
|
const n = numbers3.length;
|
|
41535
42065
|
if (n < (sample ? 2 : 1)) return DIV0;
|
|
41536
|
-
const
|
|
41537
|
-
const squares = numbers3.reduce((total2, value) => total2 + (value -
|
|
42066
|
+
const mean9 = numbers3.reduce((total2, value) => total2 + value, 0) / n;
|
|
42067
|
+
const squares = numbers3.reduce((total2, value) => total2 + (value - mean9) ** 2, 0);
|
|
41538
42068
|
return squares / (sample ? n - 1 : n);
|
|
41539
42069
|
}
|
|
41540
42070
|
function aggregateValues(records, field, type) {
|
|
@@ -42800,9 +43330,9 @@ var init_deps = __esm({
|
|
|
42800
43330
|
});
|
|
42801
43331
|
|
|
42802
43332
|
// xlsx/edit/range-math.ts
|
|
42803
|
-
function shiftSpan(start, end,
|
|
42804
|
-
const { at, count: count2 } =
|
|
42805
|
-
const max = axisMax(
|
|
43333
|
+
function shiftSpan(start, end, shift3) {
|
|
43334
|
+
const { at, count: count2 } = shift3;
|
|
43335
|
+
const max = axisMax(shift3.axis);
|
|
42806
43336
|
if (count2 > 0) {
|
|
42807
43337
|
if (start >= at) {
|
|
42808
43338
|
if (start + count2 > max) return void 0;
|
|
@@ -42818,24 +43348,24 @@ function shiftSpan(start, end, shift2) {
|
|
|
42818
43348
|
const e = end >= max ? max : end < at ? end : end > last ? end - n : at - 1;
|
|
42819
43349
|
return s > e ? void 0 : { start: s, end: e };
|
|
42820
43350
|
}
|
|
42821
|
-
function shiftRange(range,
|
|
42822
|
-
if (
|
|
42823
|
-
const span3 = shiftSpan(range.start.row, range.end.row,
|
|
43351
|
+
function shiftRange(range, shift3) {
|
|
43352
|
+
if (shift3.axis === "row") {
|
|
43353
|
+
const span3 = shiftSpan(range.start.row, range.end.row, shift3);
|
|
42824
43354
|
return span3 && {
|
|
42825
43355
|
start: { row: span3.start, col: range.start.col },
|
|
42826
43356
|
end: { row: span3.end, col: range.end.col }
|
|
42827
43357
|
};
|
|
42828
43358
|
}
|
|
42829
|
-
const span2 = shiftSpan(range.start.col, range.end.col,
|
|
43359
|
+
const span2 = shiftSpan(range.start.col, range.end.col, shift3);
|
|
42830
43360
|
return span2 && {
|
|
42831
43361
|
start: { row: range.start.row, col: span2.start },
|
|
42832
43362
|
end: { row: range.end.row, col: span2.end }
|
|
42833
43363
|
};
|
|
42834
43364
|
}
|
|
42835
|
-
function shiftRangeInBand(range,
|
|
42836
|
-
const other =
|
|
43365
|
+
function shiftRangeInBand(range, shift3, lo, hi) {
|
|
43366
|
+
const other = shift3.axis === "row" ? "col" : "row";
|
|
42837
43367
|
if (range.end[other] < lo || range.start[other] > hi) return range;
|
|
42838
|
-
if (range.start[other] >= lo && range.end[other] <= hi) return shiftRange(range,
|
|
43368
|
+
if (range.start[other] >= lo && range.end[other] <= hi) return shiftRange(range, shift3);
|
|
42839
43369
|
return range;
|
|
42840
43370
|
}
|
|
42841
43371
|
var axisMax, sameRange;
|
|
@@ -42853,7 +43383,7 @@ function pointsAt(token2, formulaSheet, sheet) {
|
|
|
42853
43383
|
if (!prefix) return formulaSheet.toLowerCase() === sheet.toLowerCase();
|
|
42854
43384
|
return prefix.book === void 0 && prefix.sheet2 === void 0 && prefix.sheet.toLowerCase() === sheet.toLowerCase();
|
|
42855
43385
|
}
|
|
42856
|
-
function shiftFormulaInBand(formula2, formulaSheet, sheet,
|
|
43386
|
+
function shiftFormulaInBand(formula2, formulaSheet, sheet, shift3, band) {
|
|
42857
43387
|
let tokens2;
|
|
42858
43388
|
try {
|
|
42859
43389
|
tokens2 = tokenize(formula2);
|
|
@@ -42874,7 +43404,7 @@ function shiftFormulaInBand(formula2, formulaSheet, sheet, shift2, band) {
|
|
|
42874
43404
|
},
|
|
42875
43405
|
end: { row: Math.max(ref.start.row, ref.end.row), col: Math.max(ref.start.col, ref.end.col) }
|
|
42876
43406
|
};
|
|
42877
|
-
const moved = shiftRangeInBand(range,
|
|
43407
|
+
const moved = shiftRangeInBand(range, shift3, band.lo, band.hi);
|
|
42878
43408
|
if (moved && sameRange(moved, range)) continue;
|
|
42879
43409
|
const prefix = token2.prefix?.text ?? "";
|
|
42880
43410
|
if (!moved) {
|
|
@@ -42918,14 +43448,14 @@ function carriedRefEdits(sourceSheets, currentSheets, shiftsOf = () => []) {
|
|
|
42918
43448
|
edits.deleted.push(source3.name);
|
|
42919
43449
|
continue;
|
|
42920
43450
|
}
|
|
42921
|
-
for (const
|
|
43451
|
+
for (const shift3 of shiftsOf(current)) edits.shifts.push({ sheet: source3.name, shift: shift3 });
|
|
42922
43452
|
if (current.name !== source3.name) edits.renamed.push([source3.name, current.name]);
|
|
42923
43453
|
}
|
|
42924
43454
|
return edits;
|
|
42925
43455
|
}
|
|
42926
|
-
function shiftOne(formula2, formulaSheet, sheet,
|
|
42927
|
-
if (
|
|
42928
|
-
const spec2 = { sheet, axis:
|
|
43456
|
+
function shiftOne(formula2, formulaSheet, sheet, shift3) {
|
|
43457
|
+
if (shift3.band) return shiftFormulaInBand(formula2, formulaSheet, sheet, shift3, shift3.band);
|
|
43458
|
+
const spec2 = { sheet, axis: shift3.axis, at: shift3.at, count: shift3.count };
|
|
42929
43459
|
return shiftFormula(formula2, formulaSheet, spec2);
|
|
42930
43460
|
}
|
|
42931
43461
|
function renameAll(formula2, renamed, taken) {
|
|
@@ -42943,7 +43473,7 @@ function renameAll(formula2, renamed, taken) {
|
|
|
42943
43473
|
}
|
|
42944
43474
|
function patchCarriedFormula(formula2, formulaSheet, edits) {
|
|
42945
43475
|
let out = formula2;
|
|
42946
|
-
for (const { sheet, shift:
|
|
43476
|
+
for (const { sheet, shift: shift3 } of edits.shifts) out = shiftOne(out, formulaSheet, sheet, shift3);
|
|
42947
43477
|
for (const sheet of edits.deleted) out = deleteSheetInFormula(out, sheet);
|
|
42948
43478
|
return renameAll(out, edits.renamed, takenNames(edits));
|
|
42949
43479
|
}
|
|
@@ -44904,7 +45434,7 @@ function addChartSeries(space, input) {
|
|
|
44904
45434
|
const group = groups.find((_, i) => i === (input.groupIndex ?? groups.length - 1));
|
|
44905
45435
|
if (!group) throw new RangeError("The chart has no chart group to add a series to");
|
|
44906
45436
|
const all2 = chartSpaceSeries(draft);
|
|
44907
|
-
const
|
|
45437
|
+
const template2 = all2[0];
|
|
44908
45438
|
const series = {
|
|
44909
45439
|
index: nextNumber(all2.map((item2) => item2.index)),
|
|
44910
45440
|
order: nextNumber(all2.map((item2) => item2.order)),
|
|
@@ -44921,7 +45451,7 @@ function addChartSeries(space, input) {
|
|
|
44921
45451
|
};
|
|
44922
45452
|
else if (input.name !== void 0) series.tx = { value: input.name, text: input.name };
|
|
44923
45453
|
if (input.spPr) series.spPr = structuredClone(input.spPr);
|
|
44924
|
-
const templateCategories =
|
|
45454
|
+
const templateCategories = template2?.categories ?? template2?.xValues;
|
|
44925
45455
|
if (input.categories !== void 0)
|
|
44926
45456
|
series[categoryKey(group)] = categorySource(
|
|
44927
45457
|
input.categories,
|
|
@@ -49059,6 +49589,7 @@ function createChatRooms(options) {
|
|
|
49059
49589
|
}
|
|
49060
49590
|
|
|
49061
49591
|
// teams/presence.ts
|
|
49592
|
+
var activityFromWire = (raw2) => raw2.activity === "meeting" && statusFromWire(raw2) === "busy" ? "meeting" : void 0;
|
|
49062
49593
|
var PRESENCE_STATUSES = [
|
|
49063
49594
|
"available",
|
|
49064
49595
|
"busy",
|
|
@@ -49105,6 +49636,30 @@ function statusFromWire(raw2) {
|
|
|
49105
49636
|
if (isPresenceStatus(raw2.status)) return raw2.status;
|
|
49106
49637
|
return raw2.availability === "busy" || raw2.availability === "away" ? raw2.availability : "available";
|
|
49107
49638
|
}
|
|
49639
|
+
var PRESENCE_RANK = {
|
|
49640
|
+
dnd: 0,
|
|
49641
|
+
busy: 1,
|
|
49642
|
+
available: 2,
|
|
49643
|
+
brb: 3,
|
|
49644
|
+
away: 4,
|
|
49645
|
+
offline: 5
|
|
49646
|
+
};
|
|
49647
|
+
function comparePresence(a2, b) {
|
|
49648
|
+
return PRESENCE_RANK[a2.status] - PRESENCE_RANK[b.status] || Number(b.message !== "") - Number(a2.message !== "") || (a2.message < b.message ? -1 : a2.message > b.message ? 1 : 0) || Number(a2.activity !== void 0) - Number(b.activity !== void 0);
|
|
49649
|
+
}
|
|
49650
|
+
function combinePresence(clients) {
|
|
49651
|
+
let best = null;
|
|
49652
|
+
for (const c2 of clients) if (!best || comparePresence(c2, best) < 0) best = c2;
|
|
49653
|
+
return best;
|
|
49654
|
+
}
|
|
49655
|
+
function clientPresenceFromWire(raw2) {
|
|
49656
|
+
const activity = activityFromWire(raw2);
|
|
49657
|
+
return {
|
|
49658
|
+
status: statusFromWire(raw2),
|
|
49659
|
+
message: sanitizeStatusMessage(raw2.statusMessage),
|
|
49660
|
+
...activity ? { activity } : {}
|
|
49661
|
+
};
|
|
49662
|
+
}
|
|
49108
49663
|
function sanitizeStatusMessage(text) {
|
|
49109
49664
|
if (typeof text !== "string") return "";
|
|
49110
49665
|
return stripHtmlTags(text).replace(/[\u0000-\u001f\u007f]/gu, " ").replace(/\s+/gu, " ").trim().slice(0, MAX_STATUS_MESSAGE_CHARS);
|
|
@@ -49150,10 +49705,13 @@ function applyExpiry(setting, now) {
|
|
|
49150
49705
|
function isIdle(lastActivityAt, now, idleMinutes) {
|
|
49151
49706
|
return idleMinutes > 0 && now - lastActivityAt >= idleMinutes * 6e4;
|
|
49152
49707
|
}
|
|
49153
|
-
function
|
|
49708
|
+
function effectivePresence(setting, idle, now, inMeeting = false) {
|
|
49154
49709
|
const { status } = applyExpiry(setting, now);
|
|
49155
|
-
|
|
49710
|
+
if (status !== "available") return { status };
|
|
49711
|
+
if (inMeeting) return { status: "busy", activity: "meeting" };
|
|
49712
|
+
return { status: idle ? "away" : "available" };
|
|
49156
49713
|
}
|
|
49714
|
+
var effectiveStatus = (setting, idle, now, inMeeting = false) => effectivePresence(setting, idle, now, inMeeting).status;
|
|
49157
49715
|
function nextExpiry(setting) {
|
|
49158
49716
|
const times = [setting.statusExpiresAt, setting.messageExpiresAt].filter(
|
|
49159
49717
|
(t) => t !== null
|
|
@@ -49214,6 +49772,7 @@ function peopleViews(self, peers) {
|
|
|
49214
49772
|
color: p.userColor,
|
|
49215
49773
|
self: false,
|
|
49216
49774
|
availability: statusFromWire(p),
|
|
49775
|
+
...activityFromWire(p) ? { activity: activityFromWire(p) } : {},
|
|
49217
49776
|
statusMessage: p.statusMessage ?? "",
|
|
49218
49777
|
inCall: Boolean(p.callRoom)
|
|
49219
49778
|
}))
|
|
@@ -49257,10 +49816,21 @@ function searchMessages(channels, messagesOf, query, limit2 = 50) {
|
|
|
49257
49816
|
}
|
|
49258
49817
|
|
|
49259
49818
|
// teams/chat-view.ts
|
|
49819
|
+
function peerPresenceOf(userId, peers) {
|
|
49820
|
+
return combinePresence(
|
|
49821
|
+
peers.filter((p) => p.userId === userId).map((p) => clientPresenceFromWire(p))
|
|
49822
|
+
);
|
|
49823
|
+
}
|
|
49260
49824
|
function memberPresence(userId, selfId, selfStatus, peers) {
|
|
49261
49825
|
if (userId === selfId) return selfStatus;
|
|
49262
|
-
|
|
49263
|
-
|
|
49826
|
+
return peerPresenceOf(userId, peers)?.status ?? "offline";
|
|
49827
|
+
}
|
|
49828
|
+
function memberShown(userId, selfId, self, peers) {
|
|
49829
|
+
const shown = userId === selfId ? { status: self.status, activity: self.activity } : peerPresenceOf(userId, peers) ?? { status: "offline", activity: void 0 };
|
|
49830
|
+
return {
|
|
49831
|
+
availability: shown.status,
|
|
49832
|
+
...shown.activity ? { activity: shown.activity } : {}
|
|
49833
|
+
};
|
|
49264
49834
|
}
|
|
49265
49835
|
function chatViews(input) {
|
|
49266
49836
|
const { chats, messagesOf, selfId, selfStatus, lastRead, peers, workspaceId, selectedId } = input;
|
|
@@ -49278,7 +49848,7 @@ function chatViews(input) {
|
|
|
49278
49848
|
id: m.id,
|
|
49279
49849
|
name: m.name,
|
|
49280
49850
|
self: m.id === selfId,
|
|
49281
|
-
|
|
49851
|
+
...memberShown(m.id, selfId, { status: selfStatus, activity: input.selfActivity }, peers)
|
|
49282
49852
|
})),
|
|
49283
49853
|
unread: chat.id === selectedId ? 0 : messages.filter((m) => !m.system && m.authorId !== selfId && m.ts > read).length,
|
|
49284
49854
|
lastMessage: last ? {
|
|
@@ -49300,7 +49870,7 @@ function contactViews(roster, selfId, peers) {
|
|
|
49300
49870
|
return roster.filter((r) => r.id !== selfId).map((r) => ({
|
|
49301
49871
|
id: r.id,
|
|
49302
49872
|
name: r.name,
|
|
49303
|
-
|
|
49873
|
+
...memberShown(r.id, selfId, { status: "available" }, peers)
|
|
49304
49874
|
})).sort((a2, b) => rank3(a2.availability) - rank3(b.availability) || a2.name.localeCompare(b.name));
|
|
49305
49875
|
}
|
|
49306
49876
|
|
|
@@ -49975,31 +50545,70 @@ function createNotificationSettings(storage, key) {
|
|
|
49975
50545
|
};
|
|
49976
50546
|
}
|
|
49977
50547
|
|
|
50548
|
+
// teams/presence-meetings.ts
|
|
50549
|
+
var MEETING_WINDOW_HORIZON_MS = 48 * 60 * MINUTE_MS;
|
|
50550
|
+
var attendsMeeting = (meeting, userId) => meetingVisibleTo(meeting, userId) && (meeting.organizerId === userId || meeting.attendees.some((a2) => a2.id === userId));
|
|
50551
|
+
function meetingWindows(meetings, userId, now, horizon = MEETING_WINDOW_HORIZON_MS) {
|
|
50552
|
+
const spans = [];
|
|
50553
|
+
for (const meeting of meetings) {
|
|
50554
|
+
if (!attendsMeeting(meeting, userId)) continue;
|
|
50555
|
+
for (const o of occurrencesBetween(meeting, now, now + horizon))
|
|
50556
|
+
if (o.end > o.start) spans.push({ start: o.start, end: o.end });
|
|
50557
|
+
}
|
|
50558
|
+
spans.sort((a2, b) => a2.start - b.start || a2.end - b.end);
|
|
50559
|
+
const merged = [];
|
|
50560
|
+
for (const span2 of spans) {
|
|
50561
|
+
const last = merged[merged.length - 1];
|
|
50562
|
+
if (last && span2.start <= last.end) last.end = Math.max(last.end, span2.end);
|
|
50563
|
+
else merged.push({ ...span2 });
|
|
50564
|
+
}
|
|
50565
|
+
return merged;
|
|
50566
|
+
}
|
|
50567
|
+
var inMeetingAt = (windows, now) => windows.some((w) => w.start <= now && now < w.end);
|
|
50568
|
+
function nextMeetingBoundary(windows, now) {
|
|
50569
|
+
let next = null;
|
|
50570
|
+
for (const w of windows)
|
|
50571
|
+
for (const t of [w.start, w.end]) if (t > now && (next === null || t < next)) next = t;
|
|
50572
|
+
return next;
|
|
50573
|
+
}
|
|
50574
|
+
var sameWindows = (a2, b) => a2.length === b.length && a2.every((w, i) => w.start === b[i].start && w.end === b[i].end);
|
|
50575
|
+
|
|
49978
50576
|
// teams/presence-controller.ts
|
|
49979
50577
|
var MAX_TIMER_MS = 2 ** 31 - 1;
|
|
50578
|
+
var sameSetting = (a2, b) => a2.status === b.status && a2.statusExpiresAt === b.statusExpiresAt && a2.message === b.message && a2.messageExpiresAt === b.messageExpiresAt;
|
|
49980
50579
|
function createPresenceController(options) {
|
|
49981
50580
|
const now = options.now ?? Date.now;
|
|
49982
50581
|
const { storage, storageKey } = options;
|
|
49983
|
-
|
|
49984
|
-
|
|
49985
|
-
|
|
49986
|
-
|
|
49987
|
-
|
|
49988
|
-
|
|
49989
|
-
|
|
49990
|
-
|
|
49991
|
-
|
|
50582
|
+
const readStored = () => {
|
|
50583
|
+
let read = {
|
|
50584
|
+
setting: defaultPresenceSetting(),
|
|
50585
|
+
idleMinutes: normalizeIdleMinutes(options.idleMinutes)
|
|
50586
|
+
};
|
|
50587
|
+
try {
|
|
50588
|
+
const stored = JSON.parse(storage?.getItem(storageKey) ?? "null");
|
|
50589
|
+
read = { ...read, setting: parsePresenceSetting(stored) };
|
|
50590
|
+
if (stored && options.idleMinutes === void 0 && "idleMinutes" in stored)
|
|
50591
|
+
read.idleMinutes = normalizeIdleMinutes(stored.idleMinutes);
|
|
50592
|
+
} catch {
|
|
50593
|
+
}
|
|
50594
|
+
return read;
|
|
50595
|
+
};
|
|
50596
|
+
let { setting, idleMinutes } = readStored();
|
|
49992
50597
|
let lastActivity = now();
|
|
49993
50598
|
let idle = false;
|
|
49994
50599
|
let timer;
|
|
49995
50600
|
let destroyed = false;
|
|
49996
50601
|
let published = "";
|
|
49997
|
-
|
|
50602
|
+
let meetingWindows2 = [];
|
|
50603
|
+
let inMeeting = false;
|
|
49998
50604
|
const view = () => {
|
|
49999
|
-
const
|
|
50605
|
+
const t = now();
|
|
50606
|
+
const current = applyExpiry(setting, t);
|
|
50607
|
+
const shown = effectivePresence(setting, idle, t, inMeetingAt(meetingWindows2, t));
|
|
50000
50608
|
return {
|
|
50001
50609
|
status: current.status,
|
|
50002
|
-
effective:
|
|
50610
|
+
effective: shown.status,
|
|
50611
|
+
...shown.activity ? { activity: shown.activity } : {},
|
|
50003
50612
|
statusExpiresAt: current.statusExpiresAt,
|
|
50004
50613
|
message: current.message,
|
|
50005
50614
|
messageExpiresAt: current.messageExpiresAt,
|
|
@@ -50020,6 +50629,8 @@ function createPresenceController(options) {
|
|
|
50020
50629
|
const expiry = nextExpiry(setting);
|
|
50021
50630
|
if (expiry !== null) times.push(expiry);
|
|
50022
50631
|
if (!idle && idleMinutes > 0) times.push(lastActivity + idleMinutes * 6e4);
|
|
50632
|
+
const boundary2 = nextMeetingBoundary(meetingWindows2, now());
|
|
50633
|
+
if (boundary2 !== null) times.push(boundary2);
|
|
50023
50634
|
if (!times.length) return;
|
|
50024
50635
|
const wait = Math.max(0, Math.min(...times) - now());
|
|
50025
50636
|
timer = setTimeout(evaluate, Math.min(wait, MAX_TIMER_MS));
|
|
@@ -50033,17 +50644,31 @@ function createPresenceController(options) {
|
|
|
50033
50644
|
const nowIdle = isIdle(lastActivity, t, idleMinutes);
|
|
50034
50645
|
const idleChanged = nowIdle !== idle;
|
|
50035
50646
|
idle = nowIdle;
|
|
50647
|
+
const nowInMeeting = inMeetingAt(meetingWindows2, t);
|
|
50648
|
+
const meetingChanged = nowInMeeting !== inMeeting;
|
|
50649
|
+
inMeeting = nowInMeeting;
|
|
50036
50650
|
if (expired) save();
|
|
50037
50651
|
const current = view();
|
|
50038
|
-
const key = `${current.effective}|${current.message}`;
|
|
50652
|
+
const key = `${current.effective}|${current.message}|${current.activity ?? ""}`;
|
|
50039
50653
|
if (key !== published) {
|
|
50040
50654
|
published = key;
|
|
50041
|
-
options.publish(current.effective, current.message);
|
|
50655
|
+
options.publish(current.effective, current.message, current.activity);
|
|
50042
50656
|
}
|
|
50043
|
-
if (expired || idleChanged) options.changed();
|
|
50657
|
+
if (expired || idleChanged || meetingChanged) options.changed();
|
|
50044
50658
|
schedule();
|
|
50045
50659
|
};
|
|
50046
50660
|
evaluate();
|
|
50661
|
+
const reload = () => {
|
|
50662
|
+
if (destroyed) return;
|
|
50663
|
+
const next = readStored();
|
|
50664
|
+
const same8 = next.idleMinutes === idleMinutes && sameSetting(next.setting, setting);
|
|
50665
|
+
if (same8) return;
|
|
50666
|
+
setting = next.setting;
|
|
50667
|
+
idleMinutes = next.idleMinutes;
|
|
50668
|
+
evaluate();
|
|
50669
|
+
options.changed();
|
|
50670
|
+
};
|
|
50671
|
+
const unsubscribe = options.subscribe?.(reload);
|
|
50047
50672
|
return {
|
|
50048
50673
|
view,
|
|
50049
50674
|
setStatus(status, duration2 = "never") {
|
|
@@ -50078,6 +50703,11 @@ function createPresenceController(options) {
|
|
|
50078
50703
|
evaluate();
|
|
50079
50704
|
options.changed();
|
|
50080
50705
|
},
|
|
50706
|
+
setMeetingWindows(windows) {
|
|
50707
|
+
if (destroyed || sameWindows(windows, meetingWindows2)) return;
|
|
50708
|
+
meetingWindows2 = windows.map((w) => ({ start: w.start, end: w.end }));
|
|
50709
|
+
evaluate();
|
|
50710
|
+
},
|
|
50081
50711
|
noteActivity() {
|
|
50082
50712
|
lastActivity = now();
|
|
50083
50713
|
if (idle) evaluate();
|
|
@@ -50085,6 +50715,7 @@ function createPresenceController(options) {
|
|
|
50085
50715
|
destroy() {
|
|
50086
50716
|
destroyed = true;
|
|
50087
50717
|
clearTimeout(timer);
|
|
50718
|
+
unsubscribe?.();
|
|
50088
50719
|
}
|
|
50089
50720
|
};
|
|
50090
50721
|
}
|
|
@@ -52195,6 +52826,8 @@ function sanitizePresence(raw2) {
|
|
|
52195
52826
|
if (isValidId(raw2.userId)) out.userId = raw2.userId;
|
|
52196
52827
|
out.status = statusFromWire(raw2);
|
|
52197
52828
|
out.availability = legacyAvailability(out.status);
|
|
52829
|
+
const activity = activityFromWire(raw2);
|
|
52830
|
+
if (activity) out.activity = activity;
|
|
52198
52831
|
const statusMessage = sanitizeStatusMessage(raw2.statusMessage);
|
|
52199
52832
|
if (statusMessage) out.statusMessage = statusMessage;
|
|
52200
52833
|
return out;
|
|
@@ -52328,7 +52961,11 @@ function createTeamsWorkspace(options) {
|
|
|
52328
52961
|
},
|
|
52329
52962
|
setActiveChannel: (channelId) => session.updatePresence({ channelId: channelId ?? "" }),
|
|
52330
52963
|
setTyping: (channelId) => session.updatePresence({ typingIn: channelId ?? "" }),
|
|
52331
|
-
setAvailability: (status) => session.updatePresence({
|
|
52964
|
+
setAvailability: (status, activity) => session.updatePresence({
|
|
52965
|
+
status,
|
|
52966
|
+
availability: legacyAvailability(status),
|
|
52967
|
+
activity: activity ?? ""
|
|
52968
|
+
}),
|
|
52332
52969
|
setStatusMessage: (message) => session.updatePresence({ statusMessage: sanitizeStatusMessage(message) }),
|
|
52333
52970
|
destroy() {
|
|
52334
52971
|
for (const c2 of calls.values()) c2.leave();
|
|
@@ -52462,6 +53099,7 @@ function createTeamsClient(options) {
|
|
|
52462
53099
|
name: ws.user.name,
|
|
52463
53100
|
color: ws.session.identity.userColor,
|
|
52464
53101
|
availability: presenceView().effective,
|
|
53102
|
+
...presenceView().activity ? { activity: presenceView().activity } : {},
|
|
52465
53103
|
statusMessage: presenceView().message,
|
|
52466
53104
|
inCall: call?.phase === "connected"
|
|
52467
53105
|
},
|
|
@@ -52499,6 +53137,7 @@ function createTeamsClient(options) {
|
|
|
52499
53137
|
messagesOf,
|
|
52500
53138
|
selfId: ws.user.id,
|
|
52501
53139
|
selfStatus: presenceView().effective,
|
|
53140
|
+
...presenceView().activity ? { selfActivity: presenceView().activity } : {},
|
|
52502
53141
|
lastRead,
|
|
52503
53142
|
peers: p,
|
|
52504
53143
|
workspaceId,
|
|
@@ -52561,12 +53200,14 @@ function createTeamsClient(options) {
|
|
|
52561
53200
|
};
|
|
52562
53201
|
let state = compute();
|
|
52563
53202
|
let queued = false;
|
|
53203
|
+
const syncMeetingPresence = () => presence?.setMeetingWindows(meetingWindows(ws.meetings.list(), ws.user.id, now()));
|
|
52564
53204
|
const refresh = () => {
|
|
52565
53205
|
if (queued || destroyed) return;
|
|
52566
53206
|
queued = true;
|
|
52567
53207
|
queueMicrotask(() => {
|
|
52568
53208
|
queued = false;
|
|
52569
53209
|
if (destroyed) return;
|
|
53210
|
+
syncMeetingPresence();
|
|
52570
53211
|
state = compute();
|
|
52571
53212
|
for (const l of [...listeners]) l();
|
|
52572
53213
|
for (const item2 of feed.drain()) notices.emit("notification", item2);
|
|
@@ -52594,16 +53235,24 @@ function createTeamsClient(options) {
|
|
|
52594
53235
|
};
|
|
52595
53236
|
doc.on("update", scheduleSave);
|
|
52596
53237
|
onChatDocUpdate = scheduleSave;
|
|
53238
|
+
const presenceKey = `teams:presence:${encodeURIComponent(workspaceId)}:${encodeURIComponent(ws.user.id)}`;
|
|
52597
53239
|
presence = createPresenceController({
|
|
52598
53240
|
storage,
|
|
52599
|
-
storageKey:
|
|
53241
|
+
storageKey: presenceKey,
|
|
53242
|
+
...storage?.subscribe ? {
|
|
53243
|
+
// A status chosen in another tab of this person reaches this one.
|
|
53244
|
+
subscribe: (onChange) => storage.subscribe((key) => {
|
|
53245
|
+
if (key === null || key === presenceKey) onChange();
|
|
53246
|
+
})
|
|
53247
|
+
} : {},
|
|
52600
53248
|
idleMinutes: options.idleMinutes,
|
|
52601
|
-
publish: (status, message) => {
|
|
52602
|
-
ws.setAvailability(status);
|
|
53249
|
+
publish: (status, message, activity) => {
|
|
53250
|
+
ws.setAvailability(status, activity);
|
|
52603
53251
|
ws.setStatusMessage(message);
|
|
52604
53252
|
},
|
|
52605
53253
|
changed: refresh
|
|
52606
53254
|
});
|
|
53255
|
+
syncMeetingPresence();
|
|
52607
53256
|
state = compute();
|
|
52608
53257
|
const unsubs = [
|
|
52609
53258
|
ws.chat.observe(refresh),
|
|
@@ -52730,6 +53379,7 @@ function createTeamsClient(options) {
|
|
|
52730
53379
|
});
|
|
52731
53380
|
const checkReminders = () => {
|
|
52732
53381
|
if (destroyed) return;
|
|
53382
|
+
syncMeetingPresence();
|
|
52733
53383
|
const settings = feed.settings.get();
|
|
52734
53384
|
const status = presenceView().effective;
|
|
52735
53385
|
const due = reminders.due(
|
|
@@ -53402,4 +54052,4 @@ function sortFiles(files, field, direction) {
|
|
|
53402
54052
|
});
|
|
53403
54053
|
}
|
|
53404
54054
|
|
|
53405
|
-
export { ACTIVITY_FILTERS, CALL_ROOM_PATTERN, CHAT_MEMBERS_MAP, CHAT_ROOM_PATTERN, DAY_MS, DEFAULT_ICE_SERVERS, DEFAULT_IDLE_MINUTES, DEFAULT_NOTIFICATION_SETTINGS, DIRECT_CHAT_ID_PATTERN, GROUP_MENTIONS, HOUR_MS, IDLE_MINUTE_CHOICES, MAX_ACTIVITY_ITEMS, MAX_ATTACHMENTS, MAX_CHANNEL_NAME_CHARS, MAX_CHANNEL_TOPIC_CHARS, MAX_CHAT_MEMBERS, MAX_MEETING_DESCRIPTION, MAX_MEETING_HOURS, MAX_MEETING_TITLE, MAX_MENTIONS, MAX_MESSAGE_CHARS, MAX_PINNED_MESSAGES, MAX_RECURRENCE_COUNT, MAX_ROOM_ID_LENGTH, MAX_SDP_CHARS, MAX_SHARED_CHAT_CHARS, MAX_SHARED_CHAT_DATA_CHARS, MAX_SHARED_CHAT_TITLE_CHARS, MAX_SIGNAL_CHARS, MAX_STATUS_MESSAGE_CHARS, MEETING_REPEATS, META_MAP, MIGRATIONS, MIGRATION_ORIGIN, MINUTE_MS, NOTIFICATION_LEVELS, PRESENCE_LABELS, PRESENCE_STATUSES, PROTOCOL_PARAM, PROTOCOL_VERSION, REMINDER_LEAD_MS, SCHEMA_KEY, SCHEMA_VERSION, STATUS_DURATIONS, STATUS_DURATION_LABELS, TEAMS_SUBPROTOCOL, TeamsSignInError, WEEKDAY_ORDINALS, activityPreview, addDays, allFilesOf, applyExpiry, calendarSlots, callRoomId, channelThreads, channelViews, chatRoomId, chatTitle, chatViews, checkSchema, checkTeamsSession, classifyRoom, connectionAuth, contactViews, contentUrl, createBroadcastSignaling, createCallSession, createChatDirectory, createChatRooms, createChatStore, createMeetingStore, createMemorySignalingHub, createNotificationSettings, createPeer, createPinStore, createPresenceController, createRoster, createSharedChat, createSharedChatStore, createSyncTransport, createTabStore, createTeamsClient, createTeamsWorkspace, createWebSocketSignaling, dayKey, dayMatchesOrdinal, daysInMonth, defaultPresenceSetting, deriveActivity, describeActivity, detectContentKind, detectOfficeKind, directChatId, effectiveStatus, endpointUrl, ensureSchema, expiryFor, fileRequestHeaders, filesOf, filterActivity, filterFiles, filterMentionTargets, hasWorkspaceData, icsDateTime, icsEscape, icsFileName, icsFold, icsLocal, icsOffset, icsUtc, insertMention, isCalendarRepeat, isChatMember, isChatUserId, isIdle, isNotificationLevel, isPresenceStatus, isSharedChatRoomId, isStatusDuration, isValidZone, layoutDay, legacyAvailability, localServerConfig, localZone, markdownBlocks, markdownInline, markdownUrl, meetingCallKey, meetingChatId, meetingToIcs, meetingVisibleTo, memberPresence, mentionDisplayText, mentionQueryAt, mentionSegments, mentionTargetsFor, mentionsUser, minuteOfDay, nextExpiry, normalizeIdleMinutes, nthWeekdayOfMonth, occurrenceAt, occurrencesBetween, offsetMinutes, ordinalOfDay, parsePresenceSetting, parseServerConfig, parseSignal, peopleViews, probeTeamsAccounts, promoteMentions, protocolOfUrl, protocolParams, readContent, readOnlyTransport, readSchemaVersion, remindersDue, repeatChoices, requestTeamsSession, resolveMentions, sanitizeAttachment, sanitizeAttachments, sanitizeChannelName, sanitizeChannelTopic, sanitizeEmoji, sanitizeMembers, sanitizeMentionName, sanitizeMentionTarget, sanitizeMentions, sanitizeMessageText, sanitizeStatusMessage, searchMessages, seriesBetween, seriesIndexOf, seriesStart, serverOrigin, sharedChatRoomId, shiftAnchor, shortHash, shouldNotify, signOutTeamsSession, slotAt, slotStart, slotStarting, sortFiles, startOfDay, statusFromWire, tabConversationId, typingNames, uploadTeamsServerFile, validateTeamsSyncMessage, validateTeamsUpdate, viewDays, vtimezoneLines, watchSchema, withinSeries, zoneTransitions, zonedParts, zonedToUtc };
|
|
54055
|
+
export { ACTIVITY_FILTERS, CALL_ROOM_PATTERN, CHAT_MEMBERS_MAP, CHAT_ROOM_PATTERN, DAY_MS, DEFAULT_ICE_SERVERS, DEFAULT_IDLE_MINUTES, DEFAULT_NOTIFICATION_SETTINGS, DIRECT_CHAT_ID_PATTERN, GROUP_MENTIONS, HOUR_MS, IDLE_MINUTE_CHOICES, MAX_ACTIVITY_ITEMS, MAX_ATTACHMENTS, MAX_CHANNEL_NAME_CHARS, MAX_CHANNEL_TOPIC_CHARS, MAX_CHAT_MEMBERS, MAX_MEETING_DESCRIPTION, MAX_MEETING_HOURS, MAX_MEETING_TITLE, MAX_MENTIONS, MAX_MESSAGE_CHARS, MAX_PINNED_MESSAGES, MAX_RECURRENCE_COUNT, MAX_ROOM_ID_LENGTH, MAX_SDP_CHARS, MAX_SHARED_CHAT_CHARS, MAX_SHARED_CHAT_DATA_CHARS, MAX_SHARED_CHAT_TITLE_CHARS, MAX_SIGNAL_CHARS, MAX_STATUS_MESSAGE_CHARS, MEETING_REPEATS, MEETING_WINDOW_HORIZON_MS, META_MAP, MIGRATIONS, MIGRATION_ORIGIN, MINUTE_MS, NOTIFICATION_LEVELS, PRESENCE_LABELS, PRESENCE_STATUSES, PROTOCOL_PARAM, PROTOCOL_VERSION, REMINDER_LEAD_MS, SCHEMA_KEY, SCHEMA_VERSION, STATUS_DURATIONS, STATUS_DURATION_LABELS, TEAMS_SUBPROTOCOL, TeamsSignInError, WEEKDAY_ORDINALS, activityFromWire, activityPreview, addDays, allFilesOf, applyExpiry, attendsMeeting, calendarSlots, callRoomId, channelThreads, channelViews, chatRoomId, chatTitle, chatViews, checkSchema, checkTeamsSession, classifyRoom, clientPresenceFromWire, combinePresence, connectionAuth, contactViews, contentUrl, createBroadcastSignaling, createCallSession, createChatDirectory, createChatRooms, createChatStore, createMeetingStore, createMemorySignalingHub, createNotificationSettings, createPeer, createPinStore, createPresenceController, createRoster, createSharedChat, createSharedChatStore, createSyncTransport, createTabStore, createTeamsClient, createTeamsWorkspace, createWebSocketSignaling, dayKey, dayMatchesOrdinal, daysInMonth, defaultPresenceSetting, deriveActivity, describeActivity, detectContentKind, detectOfficeKind, directChatId, effectivePresence, effectiveStatus, endpointUrl, ensureSchema, expiryFor, fileRequestHeaders, filesOf, filterActivity, filterFiles, filterMentionTargets, hasWorkspaceData, icsDateTime, icsEscape, icsFileName, icsFold, icsLocal, icsOffset, icsUtc, inMeetingAt, insertMention, isCalendarRepeat, isChatMember, isChatUserId, isIdle, isNotificationLevel, isPresenceStatus, isSharedChatRoomId, isStatusDuration, isValidZone, layoutDay, legacyAvailability, localServerConfig, localZone, markdownBlocks, markdownInline, markdownUrl, meetingCallKey, meetingChatId, meetingToIcs, meetingVisibleTo, meetingWindows, memberPresence, mentionDisplayText, mentionQueryAt, mentionSegments, mentionTargetsFor, mentionsUser, minuteOfDay, nextExpiry, nextMeetingBoundary, normalizeIdleMinutes, nthWeekdayOfMonth, occurrenceAt, occurrencesBetween, offsetMinutes, ordinalOfDay, parsePresenceSetting, parseServerConfig, parseSignal, peerPresenceOf, peopleViews, probeTeamsAccounts, promoteMentions, protocolOfUrl, protocolParams, readContent, readOnlyTransport, readSchemaVersion, remindersDue, repeatChoices, requestTeamsSession, resolveMentions, sameWindows, sanitizeAttachment, sanitizeAttachments, sanitizeChannelName, sanitizeChannelTopic, sanitizeEmoji, sanitizeMembers, sanitizeMentionName, sanitizeMentionTarget, sanitizeMentions, sanitizeMessageText, sanitizeStatusMessage, searchMessages, seriesBetween, seriesIndexOf, seriesStart, serverOrigin, sharedChatRoomId, shiftAnchor, shortHash, shouldNotify, signOutTeamsSession, slotAt, slotStart, slotStarting, sortFiles, startOfDay, statusFromWire, tabConversationId, typingNames, uploadTeamsServerFile, validateTeamsSyncMessage, validateTeamsUpdate, viewDays, vtimezoneLines, watchSchema, withinSeries, zoneTransitions, zonedParts, zonedToUtc };
|