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.cjs
CHANGED
|
@@ -7652,9 +7652,9 @@ var init_ref_text = __esm({
|
|
|
7652
7652
|
});
|
|
7653
7653
|
|
|
7654
7654
|
// xlsx/formula/shift-formula.ts
|
|
7655
|
-
function remember(text,
|
|
7655
|
+
function remember(text, template2) {
|
|
7656
7656
|
if (templates.size >= MAX_TEMPLATES) templates.clear();
|
|
7657
|
-
templates.set(text,
|
|
7657
|
+
templates.set(text, template2);
|
|
7658
7658
|
}
|
|
7659
7659
|
function mergeSpacedAreas(tokens2) {
|
|
7660
7660
|
const out = [];
|
|
@@ -7685,16 +7685,16 @@ function templateOf(formula2) {
|
|
|
7685
7685
|
const cached = templates.get(formula2);
|
|
7686
7686
|
if (cached !== void 0) return cached;
|
|
7687
7687
|
const raw2 = safeTokens(formula2);
|
|
7688
|
-
let
|
|
7688
|
+
let template2 = null;
|
|
7689
7689
|
if (raw2) {
|
|
7690
|
-
|
|
7690
|
+
template2 = [];
|
|
7691
7691
|
let literal2 = "";
|
|
7692
7692
|
for (const token2 of mergeSpacedAreas(raw2)) {
|
|
7693
7693
|
if (token2.kind !== "ref" && !(token2.kind === "name" && token2.prefix)) {
|
|
7694
7694
|
literal2 += token2.text;
|
|
7695
7695
|
continue;
|
|
7696
7696
|
}
|
|
7697
|
-
if (literal2)
|
|
7697
|
+
if (literal2) template2.push(literal2);
|
|
7698
7698
|
literal2 = "";
|
|
7699
7699
|
const part = { kind: token2.kind, text: token2.text };
|
|
7700
7700
|
if (token2.prefix) {
|
|
@@ -7703,23 +7703,23 @@ function templateOf(formula2) {
|
|
|
7703
7703
|
}
|
|
7704
7704
|
if (token2.ref) part.ref = token2.ref;
|
|
7705
7705
|
if (token2.spill) part.spill = true;
|
|
7706
|
-
|
|
7706
|
+
template2.push(part);
|
|
7707
7707
|
}
|
|
7708
|
-
if (literal2)
|
|
7708
|
+
if (literal2) template2.push(literal2);
|
|
7709
7709
|
}
|
|
7710
|
-
remember(formula2,
|
|
7711
|
-
return
|
|
7710
|
+
remember(formula2, template2);
|
|
7711
|
+
return template2;
|
|
7712
7712
|
}
|
|
7713
7713
|
function rewriteTemplate(formula2, rewrite2) {
|
|
7714
|
-
const
|
|
7715
|
-
if (!
|
|
7714
|
+
const template2 = templateOf(formula2);
|
|
7715
|
+
if (!template2) return formula2;
|
|
7716
7716
|
let next;
|
|
7717
|
-
for (let i = 0; i <
|
|
7718
|
-
const part =
|
|
7717
|
+
for (let i = 0; i < template2.length; i++) {
|
|
7718
|
+
const part = template2[i];
|
|
7719
7719
|
if (typeof part === "string") continue;
|
|
7720
7720
|
const changed = rewrite2(part);
|
|
7721
7721
|
if (!changed) continue;
|
|
7722
|
-
next ??=
|
|
7722
|
+
next ??= template2.slice();
|
|
7723
7723
|
next[i] = changed;
|
|
7724
7724
|
}
|
|
7725
7725
|
if (!next) return formula2;
|
|
@@ -17493,7 +17493,8 @@ var init_preset_shape_definitions_table = __esm({
|
|
|
17493
17493
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
17494
17494
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
17495
17495
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
17496
|
-
gd16("
|
|
17496
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
17497
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
17497
17498
|
gd16("stx", "cos wd2 stAng"),
|
|
17498
17499
|
gd16("sty", "sin hd2 stAng"),
|
|
17499
17500
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -17538,7 +17539,8 @@ var init_preset_shape_definitions_table = __esm({
|
|
|
17538
17539
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
17539
17540
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
17540
17541
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
17541
|
-
gd16("
|
|
17542
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
17543
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
17542
17544
|
gd16("stx", "cos wd2 stAng"),
|
|
17543
17545
|
gd16("sty", "sin hd2 stAng"),
|
|
17544
17546
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -17562,7 +17564,8 @@ var init_preset_shape_definitions_table = __esm({
|
|
|
17562
17564
|
gd16("stAng", "pin 0 adj1 21599999"),
|
|
17563
17565
|
gd16("endAng", "pin 0 adj2 21599999"),
|
|
17564
17566
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
17565
|
-
gd16("
|
|
17567
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
17568
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
17566
17569
|
gd16("stx", "cos wd2 stAng"),
|
|
17567
17570
|
gd16("sty", "sin hd2 stAng"),
|
|
17568
17571
|
gd16("x1", "+- hc stx 0"),
|
|
@@ -17657,7 +17660,8 @@ var init_preset_shape_definitions_table = __esm({
|
|
|
17657
17660
|
gd16("iwd2", "+- wd2 0 thw"),
|
|
17658
17661
|
gd16("ihd2", "+- hd2 0 thh2"),
|
|
17659
17662
|
gd16("swAng", "+- endAng 0 stAng"),
|
|
17660
|
-
gd16("
|
|
17663
|
+
gd16("swAngWrap", "+- swAng 21600000 0"),
|
|
17664
|
+
gd16("swAng2", "?: swAng swAng swAngWrap"),
|
|
17661
17665
|
gd16("mswAng", "+- 0 0 swAng2"),
|
|
17662
17666
|
gd16("stx", "cos wd2 stAng"),
|
|
17663
17667
|
gd16("sty", "sin hd2 stAng"),
|
|
@@ -28106,8 +28110,8 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
28106
28110
|
);
|
|
28107
28111
|
const direct = model2.nodes.find((node2) => node2.modelId === shape2.sourceNodeId);
|
|
28108
28112
|
const fillIndex = shape2.style?.fill?.index;
|
|
28109
|
-
const
|
|
28110
|
-
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!
|
|
28113
|
+
const template2 = fillIndex ? input.formatScheme?.fillStyles[fillIndex - 1]?.fill : void 0;
|
|
28114
|
+
if (!direct?.fill && shape2.fill?.kind === "solid" && shape2.fill.color.kind === "srgb" && (!template2 || template2.kind === "solid" && template2.color.kind === "scheme" && template2.color.value === "phClr")) {
|
|
28111
28115
|
const original = themed.get(`#${shape2.fill.color.value}`.toUpperCase());
|
|
28112
28116
|
if (original)
|
|
28113
28117
|
shape2.fill.color = {
|
|
@@ -28115,9 +28119,9 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
28115
28119
|
transforms: [...original.transforms, ...shape2.fill.color.transforms]
|
|
28116
28120
|
};
|
|
28117
28121
|
}
|
|
28118
|
-
if (!direct?.fill && shape2.fill?.kind === "gradient" &&
|
|
28122
|
+
if (!direct?.fill && shape2.fill?.kind === "gradient" && template2?.kind === "gradient") {
|
|
28119
28123
|
shape2.fill.stops.forEach((stop, index2) => {
|
|
28120
|
-
const authored =
|
|
28124
|
+
const authored = template2.stops[index2]?.color;
|
|
28121
28125
|
if (authored?.kind === "scheme" && authored.value === "phClr" && stop.color.kind === "srgb") {
|
|
28122
28126
|
const original = themed.get(`#${stop.color.value}`.toUpperCase());
|
|
28123
28127
|
if (original)
|
|
@@ -29805,12 +29809,12 @@ function reanchor(xml, anchor) {
|
|
|
29805
29809
|
).documentElement;
|
|
29806
29810
|
for (const candidate2 of Array.from(holder.childNodes)) {
|
|
29807
29811
|
if (candidate2.nodeType !== 1) continue;
|
|
29808
|
-
const
|
|
29809
|
-
const original = first(old,
|
|
29810
|
-
const position = original ? original.cloneNode(true) : doc.importNode(
|
|
29811
|
-
for (const attribute2 of Array.from(
|
|
29812
|
+
const template2 = candidate2;
|
|
29813
|
+
const original = first(old, template2.localName, NS.xdr);
|
|
29814
|
+
const position = original ? original.cloneNode(true) : doc.importNode(template2, true);
|
|
29815
|
+
for (const attribute2 of Array.from(template2.attributes))
|
|
29812
29816
|
position.setAttribute(attribute2.name, attribute2.value);
|
|
29813
|
-
for (const value of Array.from(
|
|
29817
|
+
for (const value of Array.from(template2.childNodes)) {
|
|
29814
29818
|
if (value.nodeType !== 1) continue;
|
|
29815
29819
|
const item2 = value;
|
|
29816
29820
|
const existing = first(position, item2.localName, NS.xdr);
|
|
@@ -32733,14 +32737,14 @@ function linearFit(xs, ys) {
|
|
|
32733
32737
|
return { slope, intercept: my - slope * mx };
|
|
32734
32738
|
}
|
|
32735
32739
|
function rank2(values2, x, ascending, average) {
|
|
32736
|
-
let
|
|
32740
|
+
let better2 = 0;
|
|
32737
32741
|
let ties = 0;
|
|
32738
32742
|
for (const v of values2) {
|
|
32739
32743
|
if (v === x) ties++;
|
|
32740
|
-
else if (ascending ? v < x : v > x)
|
|
32744
|
+
else if (ascending ? v < x : v > x) better2++;
|
|
32741
32745
|
}
|
|
32742
32746
|
if (ties === 0) fail(ERR.NA);
|
|
32743
|
-
return average ?
|
|
32747
|
+
return average ? better2 + (ties + 1) / 2 : better2 + 1;
|
|
32744
32748
|
}
|
|
32745
32749
|
function gamma(z) {
|
|
32746
32750
|
if (z < 0.5) return Math.PI / (Math.sin(Math.PI * z) * gamma(1 - z));
|
|
@@ -37945,11 +37949,11 @@ function binomDist(k, n, p, cumulative2) {
|
|
|
37945
37949
|
for (let i = 0; i <= kk; i++) total2 += binomPmf(i, nn, p);
|
|
37946
37950
|
return Math.min(1, total2);
|
|
37947
37951
|
}
|
|
37948
|
-
function poisson(k,
|
|
37952
|
+
function poisson(k, mean9, cumulative2) {
|
|
37949
37953
|
const kk = Math.trunc(k);
|
|
37950
|
-
if (kk < 0 ||
|
|
37951
|
-
if (cumulative2) return 1 - gammaP(kk + 1,
|
|
37952
|
-
return Math.exp(kk * Math.log(
|
|
37954
|
+
if (kk < 0 || mean9 < 0) fail(ERR.NUM);
|
|
37955
|
+
if (cumulative2) return 1 - gammaP(kk + 1, mean9);
|
|
37956
|
+
return Math.exp(kk * Math.log(mean9) - mean9 - gammaLn(kk + 1));
|
|
37953
37957
|
}
|
|
37954
37958
|
var EPS, erf, normCdf, normPdf, tCdf, tPdf, chiCdf, positive2, probability, normDist;
|
|
37955
37959
|
var init_dist_core = __esm({
|
|
@@ -37984,11 +37988,307 @@ var init_dist_core = __esm({
|
|
|
37984
37988
|
}
|
|
37985
37989
|
});
|
|
37986
37990
|
|
|
37991
|
+
// xlsx/formula/functions/ets-init-three.ts
|
|
37992
|
+
function slopeOf(v) {
|
|
37993
|
+
const k = v.length;
|
|
37994
|
+
const mx = (k - 1) / 2;
|
|
37995
|
+
const my = mean2(v);
|
|
37996
|
+
let sxy = 0;
|
|
37997
|
+
let sxx = 0;
|
|
37998
|
+
for (let i = 0; i < k; i++) {
|
|
37999
|
+
sxy += (i - mx) * (v[i] - my);
|
|
38000
|
+
sxx += (i - mx) * (i - mx);
|
|
38001
|
+
}
|
|
38002
|
+
return sxx === 0 ? 0 : sxy / sxx;
|
|
38003
|
+
}
|
|
38004
|
+
function positionSlopes(y, m) {
|
|
38005
|
+
return Array.from({ length: m }, (_v, c2) => {
|
|
38006
|
+
const vals = [];
|
|
38007
|
+
for (let t = c2; t < y.length; t += m) vals.push(y[t]);
|
|
38008
|
+
return slopeOf(vals) / m;
|
|
38009
|
+
});
|
|
38010
|
+
}
|
|
38011
|
+
function isThreeSeasonLength(n, m) {
|
|
38012
|
+
return m >= 4 && n >= 3 * m && n <= 3 * m + Math.ceil(m / 2) + 1;
|
|
38013
|
+
}
|
|
38014
|
+
function threeSeasonSeasonals(y, m, slopeSumOverride) {
|
|
38015
|
+
const n = y.length;
|
|
38016
|
+
const extra = n - 3 * m;
|
|
38017
|
+
const j0 = Math.floor(m / 2);
|
|
38018
|
+
const at = (t) => y[t];
|
|
38019
|
+
const slope = (j) => (at(j + 2 * m) - at(j)) / (2 * m);
|
|
38020
|
+
const B = (j) => j + 2 * m < n ? slope(j) : slope(j % m);
|
|
38021
|
+
const e = (t) => at(t) - at(t - 1) - B(t - j0);
|
|
38022
|
+
const slopeSum = slopeSumOverride ?? positionSlopes(y, m).reduce((a2, b) => a2 + b, 0);
|
|
38023
|
+
const out = [0];
|
|
38024
|
+
for (let k = 1; k < m; k++) {
|
|
38025
|
+
let back = 0;
|
|
38026
|
+
for (let t = k + 1; t <= m; t++) back -= e(t);
|
|
38027
|
+
let fwd = 0;
|
|
38028
|
+
for (let t = m + 1; t <= m + k; t++) fwd += e(t);
|
|
38029
|
+
if (k < j0 - 1) {
|
|
38030
|
+
out.push(fwd);
|
|
38031
|
+
continue;
|
|
38032
|
+
}
|
|
38033
|
+
if (k === m - 1 && extra <= Math.ceil(m / 2)) {
|
|
38034
|
+
out.push(back);
|
|
38035
|
+
continue;
|
|
38036
|
+
}
|
|
38037
|
+
const wrapped = Math.max(0, k - j0 + 1 - extra);
|
|
38038
|
+
let corner4 = 0;
|
|
38039
|
+
for (let i = extra; i <= k - j0; i++)
|
|
38040
|
+
corner4 += (at(i + m) + at(i + 2 * m) - 2 * at(i)) / (4 * m);
|
|
38041
|
+
const level4 = (at(k) + at(m + k)) / 2 - at(m);
|
|
38042
|
+
const bb = back - (at(k) - at(m));
|
|
38043
|
+
const ff = fwd - (at(m + k) - at(m));
|
|
38044
|
+
out.push(level4 + (bb + ff) / 2 - 3 * wrapped / (4 * m) * slopeSum + corner4);
|
|
38045
|
+
}
|
|
38046
|
+
return out;
|
|
38047
|
+
}
|
|
38048
|
+
function padThreeSeasons(y, m, slopeMean = mean2(positionSlopes(y, m))) {
|
|
38049
|
+
const n = y.length;
|
|
38050
|
+
const total2 = Math.max(3 * m + Math.ceil(m / 2), n);
|
|
38051
|
+
const ext = [...y];
|
|
38052
|
+
for (let t = n; t < total2; t++) ext.push(y[t - 3 * m] + 3 * m * slopeMean);
|
|
38053
|
+
return ext;
|
|
38054
|
+
}
|
|
38055
|
+
function threeSeasonTrend(y, m, rel, slopeMean) {
|
|
38056
|
+
const ext = padThreeSeasons(y, m, slopeMean);
|
|
38057
|
+
const total2 = ext.length;
|
|
38058
|
+
const mx = (total2 - 1) / 2;
|
|
38059
|
+
let sxx = 0;
|
|
38060
|
+
let sxy = 0;
|
|
38061
|
+
for (let t = 0; t < total2; t++) {
|
|
38062
|
+
sxx += (t - mx) * (t - mx);
|
|
38063
|
+
sxy += (t - mx) * (ext[t] - rel[t % m]);
|
|
38064
|
+
}
|
|
38065
|
+
return sxy / sxx;
|
|
38066
|
+
}
|
|
38067
|
+
function isTwoSeasonLength(n, m) {
|
|
38068
|
+
return m >= 4 && n === 2 * m;
|
|
38069
|
+
}
|
|
38070
|
+
function isTwoPlusLength(n, m) {
|
|
38071
|
+
return m >= 4 && n > 2 * m && n < 3 * m;
|
|
38072
|
+
}
|
|
38073
|
+
function slopeSumOf(y, m) {
|
|
38074
|
+
return positionSlopes(y, m).reduce((a2, c2) => a2 + c2, 0);
|
|
38075
|
+
}
|
|
38076
|
+
function extendTwoSeasons(y, m) {
|
|
38077
|
+
const b = mean2(positionSlopes(y, m));
|
|
38078
|
+
const out = [...y];
|
|
38079
|
+
for (let t = y.length; t < 3 * m; t++) out.push(y[t - 2 * m] + 2 * m * b);
|
|
38080
|
+
return out;
|
|
38081
|
+
}
|
|
38082
|
+
function paddedSearchSeries(y, m) {
|
|
38083
|
+
if (isTwoSeasonLength(y.length, m) || isTwoPlusLength(y.length, m))
|
|
38084
|
+
return padThreeSeasons(extendTwoSeasons(y, m), m, slopeSumOf(y, m) / m);
|
|
38085
|
+
if (isThreeSeasonLength(y.length, m)) return padThreeSeasons(y, m);
|
|
38086
|
+
return void 0;
|
|
38087
|
+
}
|
|
38088
|
+
var mean2;
|
|
38089
|
+
var init_ets_init_three = __esm({
|
|
38090
|
+
"xlsx/formula/functions/ets-init-three.ts"() {
|
|
38091
|
+
mean2 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38092
|
+
}
|
|
38093
|
+
});
|
|
38094
|
+
|
|
38095
|
+
// xlsx/formula/functions/ets-init-states.ts
|
|
38096
|
+
function chainStates(y, m, seasons) {
|
|
38097
|
+
const h = Math.floor(seasons / 2);
|
|
38098
|
+
const first2 = seasons - h;
|
|
38099
|
+
const at = (t) => y[t];
|
|
38100
|
+
const meanFirst = (t) => mean3(Array.from({ length: first2 }, (_v, c2) => at(t + c2 * m)));
|
|
38101
|
+
const slope = (j) => {
|
|
38102
|
+
const early = mean3(Array.from({ length: h }, (_v, c2) => at(j + c2 * m)));
|
|
38103
|
+
const late = mean3(Array.from({ length: h }, (_v, c2) => at(j + (seasons - h + c2) * m)));
|
|
38104
|
+
return (late - early) / ((seasons - h) * m);
|
|
38105
|
+
};
|
|
38106
|
+
const j0 = Math.floor(m / 2);
|
|
38107
|
+
const state = /* @__PURE__ */ new Map([[j0 - 1, 0]]);
|
|
38108
|
+
for (let t = j0; t <= j0 + m - 2; t++)
|
|
38109
|
+
state.set(t, state.get(t - 1) + meanFirst(t) - meanFirst(t - 1) - slope(t - j0));
|
|
38110
|
+
const byPosition = new Array(m).fill(0);
|
|
38111
|
+
for (const [t, s] of state) byPosition[t % m] = s;
|
|
38112
|
+
return byPosition;
|
|
38113
|
+
}
|
|
38114
|
+
function chainSeasonals(y, m, seasons) {
|
|
38115
|
+
const byPosition = chainStates(y, m, seasons);
|
|
38116
|
+
const origin = byPosition[0];
|
|
38117
|
+
return byPosition.map((s) => s - origin);
|
|
38118
|
+
}
|
|
38119
|
+
var mean3;
|
|
38120
|
+
var init_ets_init_states = __esm({
|
|
38121
|
+
"xlsx/formula/functions/ets-init-states.ts"() {
|
|
38122
|
+
mean3 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38123
|
+
}
|
|
38124
|
+
});
|
|
38125
|
+
|
|
38126
|
+
// xlsx/formula/functions/ets-init-four.ts
|
|
38127
|
+
function template(w, m, a2) {
|
|
38128
|
+
const block = (c2) => mean4(w.slice(c2 * m, (c2 + 1) * m));
|
|
38129
|
+
const at = (i) => w[i];
|
|
38130
|
+
return (block(0) - block(2)) / 12 + (block(1) - block(3)) / 6 - (at(a2) + at(a2 + m) - 2 * at(a2 + 2 * m)) / 6;
|
|
38131
|
+
}
|
|
38132
|
+
function fourSeasonPlusSeasonals(y, m) {
|
|
38133
|
+
const r = y.length - 4 * m;
|
|
38134
|
+
const a2 = Math.floor(m / 2) - 1;
|
|
38135
|
+
const states = chainStates(y.slice(0, 4 * m), m, 4);
|
|
38136
|
+
for (let q = 0; q < r; q++) {
|
|
38137
|
+
const pos = (a2 + q) % m;
|
|
38138
|
+
states[pos] = states[pos] + template(y.slice(q, q + 4 * m), m, a2);
|
|
38139
|
+
}
|
|
38140
|
+
const origin = states[0];
|
|
38141
|
+
return states.map((s) => s - origin);
|
|
38142
|
+
}
|
|
38143
|
+
var mean4;
|
|
38144
|
+
var init_ets_init_four = __esm({
|
|
38145
|
+
"xlsx/formula/functions/ets-init-four.ts"() {
|
|
38146
|
+
init_ets_init_states();
|
|
38147
|
+
mean4 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38148
|
+
}
|
|
38149
|
+
});
|
|
38150
|
+
|
|
38151
|
+
// xlsx/formula/functions/ets-init-threeplus.ts
|
|
38152
|
+
function isThreePlusLength(n, m) {
|
|
38153
|
+
return m >= 4 && n >= 3 * m + Math.ceil(m / 2) + 2 && n < 4 * m;
|
|
38154
|
+
}
|
|
38155
|
+
function shift2(y, m, k) {
|
|
38156
|
+
const a2 = Math.ceil(m / 2) + 1;
|
|
38157
|
+
const at = (i) => y[i];
|
|
38158
|
+
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;
|
|
38159
|
+
}
|
|
38160
|
+
function isLowThreeLength(n, m) {
|
|
38161
|
+
return m === 2 && n >= 5 && n < 8 || m === 3 && n >= 6 && n < 12;
|
|
38162
|
+
}
|
|
38163
|
+
function lowSeasonSeasonals(y, m, slopeSum) {
|
|
38164
|
+
const base = threeSeasonSeasonals(y, m, slopeSum);
|
|
38165
|
+
const d = -shift2(y, m, -m);
|
|
38166
|
+
return base.map((s, k) => k === 0 ? 0 : s + d);
|
|
38167
|
+
}
|
|
38168
|
+
function threePlusSeasonals(y, m) {
|
|
38169
|
+
const base = threeSeasonSeasonals(y, m);
|
|
38170
|
+
const moved = y.length - 3 * m - Math.ceil(m / 2) - 1;
|
|
38171
|
+
const z = base.map((s, k) => k < moved ? s - shift2(y, m, k) : s);
|
|
38172
|
+
const origin = z[0];
|
|
38173
|
+
return z.map((s) => s - origin);
|
|
38174
|
+
}
|
|
38175
|
+
var mean5;
|
|
38176
|
+
var init_ets_init_threeplus = __esm({
|
|
38177
|
+
"xlsx/formula/functions/ets-init-threeplus.ts"() {
|
|
38178
|
+
init_ets_init_three();
|
|
38179
|
+
mean5 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38180
|
+
}
|
|
38181
|
+
});
|
|
38182
|
+
|
|
38183
|
+
// xlsx/formula/functions/ets-init-short.ts
|
|
38184
|
+
function seasonStart(m) {
|
|
38185
|
+
return Math.ceil(10 * (m + 1) / 7);
|
|
38186
|
+
}
|
|
38187
|
+
function isShortSeasonLength(n, m) {
|
|
38188
|
+
return m >= 5 && n >= seasonStart(m) && n < 2 * m;
|
|
38189
|
+
}
|
|
38190
|
+
function padTwoSeasons(y, m) {
|
|
38191
|
+
const p = [...y];
|
|
38192
|
+
for (let t = y.length; t < 2 * m; t++) p.push(p[t - m]);
|
|
38193
|
+
return p;
|
|
38194
|
+
}
|
|
38195
|
+
function trendShift(m, n) {
|
|
38196
|
+
const j0 = Math.floor(m / 2);
|
|
38197
|
+
const u = 2 * m - 1 - n;
|
|
38198
|
+
return (u * u - (j0 - 2) * u + 2 * (j0 - 1)) / 4;
|
|
38199
|
+
}
|
|
38200
|
+
function shortSeasonStart(y, m) {
|
|
38201
|
+
const n = y.length;
|
|
38202
|
+
const p = padTwoSeasons(y, m);
|
|
38203
|
+
const ss = slopeSumOf(p, m);
|
|
38204
|
+
const ext = extendTwoSeasons(p, m);
|
|
38205
|
+
const base = threeSeasonSeasonals(ext, m, ss);
|
|
38206
|
+
const total2 = 3 * m + Math.ceil(m / 2);
|
|
38207
|
+
const sxx = total2 * (total2 * total2 - 1) / 12;
|
|
38208
|
+
const trend = threeSeasonTrend(ext, m, base, ss / m) + trendShift(m, n) * ss / sxx;
|
|
38209
|
+
const rel = base.map((s, k) => k >= n - m && k <= m - 2 ? s + ss / 2 : s);
|
|
38210
|
+
return { rel, trend };
|
|
38211
|
+
}
|
|
38212
|
+
function shortSearchSeries(y, m) {
|
|
38213
|
+
const p = padTwoSeasons(y, m);
|
|
38214
|
+
return padThreeSeasons(extendTwoSeasons(p, m), m, slopeSumOf(p, m) / m);
|
|
38215
|
+
}
|
|
38216
|
+
var init_ets_init_short = __esm({
|
|
38217
|
+
"xlsx/formula/functions/ets-init-short.ts"() {
|
|
38218
|
+
init_ets_init_three();
|
|
38219
|
+
}
|
|
38220
|
+
});
|
|
38221
|
+
|
|
38222
|
+
// xlsx/formula/functions/ets-init-chain.ts
|
|
38223
|
+
function isExactLength(n, m) {
|
|
38224
|
+
const whole = Math.floor(n / m);
|
|
38225
|
+
return whole >= MAX_SEASONS || whole === 4 || isThreeSeasonLength(n, m) || isThreePlusLength(n, m) || isLowThreeLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m) || isShortSeasonLength(n, m);
|
|
38226
|
+
}
|
|
38227
|
+
function fromRelative(y0, rel, trend) {
|
|
38228
|
+
const combined = rel.map((s) => y0 + s - trend);
|
|
38229
|
+
const level4 = mean6(combined);
|
|
38230
|
+
return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
|
|
38231
|
+
}
|
|
38232
|
+
function chainStart(y, m) {
|
|
38233
|
+
const n = y.length;
|
|
38234
|
+
const whole = Math.floor(n / m);
|
|
38235
|
+
if (isShortSeasonLength(n, m)) {
|
|
38236
|
+
const { rel: rel2, trend } = shortSeasonStart(y, m);
|
|
38237
|
+
return fromRelative(y[0], rel2, trend);
|
|
38238
|
+
}
|
|
38239
|
+
if (isThreeSeasonLength(n, m) || isTwoSeasonLength(n, m) || isTwoPlusLength(n, m)) {
|
|
38240
|
+
const short = isTwoSeasonLength(n, m) || isTwoPlusLength(n, m);
|
|
38241
|
+
const series = short ? extendTwoSeasons(y, m) : y;
|
|
38242
|
+
const rel2 = threeSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
|
|
38243
|
+
return fromRelative(
|
|
38244
|
+
y[0],
|
|
38245
|
+
rel2,
|
|
38246
|
+
threeSeasonTrend(series, m, rel2, short ? slopeSumOf(y, m) / m : void 0)
|
|
38247
|
+
);
|
|
38248
|
+
}
|
|
38249
|
+
if (isLowThreeLength(n, m)) {
|
|
38250
|
+
const short = n < 3 * m;
|
|
38251
|
+
const series = short ? extendTwoSeasons(y, m) : y;
|
|
38252
|
+
const rel2 = lowSeasonSeasonals(series, m, short ? slopeSumOf(y, m) : void 0);
|
|
38253
|
+
const pad7 = short ? slopeSumOf(y, m) / m : void 0;
|
|
38254
|
+
return fromRelative(y[0], rel2, threeSeasonTrend(series, m, rel2, pad7));
|
|
38255
|
+
}
|
|
38256
|
+
if (isThreePlusLength(n, m)) {
|
|
38257
|
+
const rel2 = threePlusSeasonals(y, m);
|
|
38258
|
+
return fromRelative(y[0], rel2, threeSeasonTrend(y, m, rel2));
|
|
38259
|
+
}
|
|
38260
|
+
if (m < 2 || whole < 4) return void 0;
|
|
38261
|
+
const partial = whole < MAX_SEASONS && n % m !== 0;
|
|
38262
|
+
const rel = partial ? fourSeasonPlusSeasonals(y, m) : chainSeasonals(y, m, Math.min(whole, MAX_SEASONS));
|
|
38263
|
+
const mx = (n - 1) / 2;
|
|
38264
|
+
let sxy = 0;
|
|
38265
|
+
let sxx = 0;
|
|
38266
|
+
const my = mean6(y.map((v, t) => v - rel[t % m]));
|
|
38267
|
+
for (let t = 0; t < n; t++) {
|
|
38268
|
+
const d = y[t] - rel[t % m] - my;
|
|
38269
|
+
sxy += (t - mx) * d;
|
|
38270
|
+
sxx += (t - mx) * (t - mx);
|
|
38271
|
+
}
|
|
38272
|
+
return fromRelative(y[0], rel, sxy / sxx);
|
|
38273
|
+
}
|
|
38274
|
+
var MAX_SEASONS, mean6;
|
|
38275
|
+
var init_ets_init_chain = __esm({
|
|
38276
|
+
"xlsx/formula/functions/ets-init-chain.ts"() {
|
|
38277
|
+
init_ets_init_three();
|
|
38278
|
+
init_ets_init_four();
|
|
38279
|
+
init_ets_init_threeplus();
|
|
38280
|
+
init_ets_init_short();
|
|
38281
|
+
init_ets_init_states();
|
|
38282
|
+
MAX_SEASONS = 5;
|
|
38283
|
+
mean6 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38284
|
+
}
|
|
38285
|
+
});
|
|
38286
|
+
|
|
37987
38287
|
// xlsx/formula/functions/ets-init.ts
|
|
37988
38288
|
function olsSlope(y) {
|
|
37989
38289
|
const n = y.length;
|
|
37990
38290
|
const mx = (n - 1) / 2;
|
|
37991
|
-
const my =
|
|
38291
|
+
const my = mean7(y);
|
|
37992
38292
|
let sxy = 0;
|
|
37993
38293
|
let sxx = 0;
|
|
37994
38294
|
for (let i = 0; i < n; i++) {
|
|
@@ -37997,12 +38297,18 @@ function olsSlope(y) {
|
|
|
37997
38297
|
}
|
|
37998
38298
|
return sxx === 0 ? 0 : sxy / sxx;
|
|
37999
38299
|
}
|
|
38300
|
+
function shortSeriesTrend(y) {
|
|
38301
|
+
const pads = PADS[y.length];
|
|
38302
|
+
if (!pads) return olsSlope(y);
|
|
38303
|
+
const slope = olsSlope(y);
|
|
38304
|
+
return olsSlope([...y, ...pads.map(([src, lag]) => y[src] + lag * slope)]);
|
|
38305
|
+
}
|
|
38000
38306
|
function split(trend, combined) {
|
|
38001
|
-
const level4 =
|
|
38307
|
+
const level4 = mean7(combined);
|
|
38002
38308
|
return { level: level4, trend, season: combined.map((c2) => c2 - level4) };
|
|
38003
38309
|
}
|
|
38004
38310
|
function heuristicStates(y, m) {
|
|
38005
|
-
const trend = (
|
|
38311
|
+
const trend = (mean7(y.slice(m, 2 * m)) - mean7(y.slice(0, m))) / m;
|
|
38006
38312
|
return split(
|
|
38007
38313
|
trend,
|
|
38008
38314
|
Array.from({ length: m }, (_v, k) => y[k] - trend * (k + 1))
|
|
@@ -38039,9 +38345,11 @@ function solveSystem(a2, b) {
|
|
|
38039
38345
|
function initialStates(y, m, p, run2) {
|
|
38040
38346
|
const y0 = y[0];
|
|
38041
38347
|
if (m < 2) {
|
|
38042
|
-
const trend2 =
|
|
38348
|
+
const trend2 = shortSeriesTrend(y);
|
|
38043
38349
|
return { level: y0 - trend2, trend: trend2, season: [] };
|
|
38044
38350
|
}
|
|
38351
|
+
const exact = chainStart(y, m);
|
|
38352
|
+
if (exact) return exact;
|
|
38045
38353
|
if (m > MAX_EXACT_SEASON) return heuristicStates(y, m);
|
|
38046
38354
|
const zeros = new Array(y.length).fill(0);
|
|
38047
38355
|
const unit = (trend2, season) => run2(zeros, m, { level: 0, trend: trend2, season }, p).fitted;
|
|
@@ -38060,11 +38368,238 @@ function initialStates(y, m, p, run2) {
|
|
|
38060
38368
|
const trend = u[0];
|
|
38061
38369
|
return split(trend, [y0 - trend, ...u.slice(1)]);
|
|
38062
38370
|
}
|
|
38063
|
-
var MAX_EXACT_SEASON,
|
|
38371
|
+
var MAX_EXACT_SEASON, mean7, PADS;
|
|
38064
38372
|
var init_ets_init = __esm({
|
|
38065
38373
|
"xlsx/formula/functions/ets-init.ts"() {
|
|
38374
|
+
init_ets_init_chain();
|
|
38066
38375
|
MAX_EXACT_SEASON = 24;
|
|
38067
|
-
|
|
38376
|
+
mean7 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38377
|
+
PADS = {
|
|
38378
|
+
6: [[0, 6]],
|
|
38379
|
+
5: [
|
|
38380
|
+
[1, 4],
|
|
38381
|
+
[0, 6]
|
|
38382
|
+
],
|
|
38383
|
+
4: [
|
|
38384
|
+
[0, 4],
|
|
38385
|
+
[1, 4],
|
|
38386
|
+
[0, 6]
|
|
38387
|
+
]
|
|
38388
|
+
};
|
|
38389
|
+
}
|
|
38390
|
+
});
|
|
38391
|
+
|
|
38392
|
+
// xlsx/formula/functions/ets-search-map.ts
|
|
38393
|
+
function trendShape(y, h) {
|
|
38394
|
+
const n = y.length;
|
|
38395
|
+
const hold = h > 0 ? h : Math.max(1, Math.round(0.3 * n));
|
|
38396
|
+
const mx = (n - 1) / 2;
|
|
38397
|
+
let my = 0;
|
|
38398
|
+
for (const v of y) my += v;
|
|
38399
|
+
my /= n;
|
|
38400
|
+
let sxy = 0;
|
|
38401
|
+
let sxx = 0;
|
|
38402
|
+
let syy = 0;
|
|
38403
|
+
for (let i = 0; i < n; i++) {
|
|
38404
|
+
const dy = y[i] - my;
|
|
38405
|
+
sxy += (i - mx) * dy;
|
|
38406
|
+
sxx += (i - mx) * (i - mx);
|
|
38407
|
+
syy += dy * dy;
|
|
38408
|
+
}
|
|
38409
|
+
if (syy === 0 || sxx === 0 || n < 3) return { shift: 0, t: 0 };
|
|
38410
|
+
const slope = sxy / sxx;
|
|
38411
|
+
const resid = syy - slope * sxy;
|
|
38412
|
+
const se = Math.sqrt(Math.max(resid, 0) / (n - 2) / sxx);
|
|
38413
|
+
let tail = 0;
|
|
38414
|
+
for (let i = n - hold; i < n; i++) tail += y[i];
|
|
38415
|
+
let head = 0;
|
|
38416
|
+
for (let i = 0; i < n - hold; i++) head += y[i];
|
|
38417
|
+
const shift3 = Math.abs(tail / hold - head / (n - hold)) / Math.sqrt(syy / n);
|
|
38418
|
+
return { shift: shift3, t: se === 0 ? Number.POSITIVE_INFINITY : Math.abs(slope / se) };
|
|
38419
|
+
}
|
|
38420
|
+
function reportedFor(alpha, beta, shape2) {
|
|
38421
|
+
const key = `${alpha}/${beta}`;
|
|
38422
|
+
let drift;
|
|
38423
|
+
if (beta === LOW) drift = false;
|
|
38424
|
+
else if (ALWAYS_DRIFT.has(key)) drift = true;
|
|
38425
|
+
else if (NEVER_DRIFT.has(key)) drift = false;
|
|
38426
|
+
else drift = shape2.shift <= DRIFT_SHIFT && shape2.t <= DRIFT_T;
|
|
38427
|
+
return { alpha, beta: drift ? LOW : beta, fit: [alpha, beta], drift };
|
|
38428
|
+
}
|
|
38429
|
+
var LOW, DRIFT_SHIFT, DRIFT_T, CANDIDATES, ALWAYS_DRIFT, NEVER_DRIFT;
|
|
38430
|
+
var init_ets_search_map = __esm({
|
|
38431
|
+
"xlsx/formula/functions/ets-search-map.ts"() {
|
|
38432
|
+
LOW = 1e-3;
|
|
38433
|
+
DRIFT_SHIFT = 1.5;
|
|
38434
|
+
DRIFT_T = 9.3;
|
|
38435
|
+
CANDIDATES = [
|
|
38436
|
+
...[2e-3, 0.1, 0.126, 0.25, 0.5, 0.75, 0.9].map((a2) => [a2, LOW]),
|
|
38437
|
+
[0.1, 0.099],
|
|
38438
|
+
[0.126, 0.125],
|
|
38439
|
+
[0.25, 0.249],
|
|
38440
|
+
[0.333333, 0.166667],
|
|
38441
|
+
[0.5, 0.25],
|
|
38442
|
+
[0.5, 0.499],
|
|
38443
|
+
[0.666667, 0.166667],
|
|
38444
|
+
[0.666667, 0.5],
|
|
38445
|
+
[0.75, 0.749],
|
|
38446
|
+
[0.833333, 0.75],
|
|
38447
|
+
[0.9, 0.899],
|
|
38448
|
+
[0.998, 0.099],
|
|
38449
|
+
[0.998, 0.249],
|
|
38450
|
+
[0.998, 0.499],
|
|
38451
|
+
[0.998, 0.749],
|
|
38452
|
+
[0.998, 0.899],
|
|
38453
|
+
[0.166667, 0.0833333],
|
|
38454
|
+
[0.833333, 0.0833333]
|
|
38455
|
+
];
|
|
38456
|
+
ALWAYS_DRIFT = /* @__PURE__ */ new Set([
|
|
38457
|
+
"0.1/0.099",
|
|
38458
|
+
"0.998/0.899",
|
|
38459
|
+
"0.998/0.749",
|
|
38460
|
+
"0.166667/0.0833333",
|
|
38461
|
+
"0.25/0.249",
|
|
38462
|
+
"0.9/0.899",
|
|
38463
|
+
"0.666667/0.5",
|
|
38464
|
+
"0.75/0.749"
|
|
38465
|
+
]);
|
|
38466
|
+
NEVER_DRIFT = /* @__PURE__ */ new Set(["0.333333/0.166667"]);
|
|
38467
|
+
}
|
|
38468
|
+
});
|
|
38469
|
+
|
|
38470
|
+
// xlsx/formula/functions/ets-search.ts
|
|
38471
|
+
function better(c2, best) {
|
|
38472
|
+
return c2 < best * (1 - 1e-6) && c2 < best - 1e-12;
|
|
38473
|
+
}
|
|
38474
|
+
function searchSeasonalLattice(cost, extra = []) {
|
|
38475
|
+
let best = { alpha: 0.126, beta: LOW2, gamma: LOW2 };
|
|
38476
|
+
let bestCost = cost(best);
|
|
38477
|
+
for (const [alpha, beta, gamma2] of [...SEASONAL_TRIPLES, ...extra]) {
|
|
38478
|
+
const c2 = cost({ alpha, beta, gamma: gamma2 });
|
|
38479
|
+
if (better(c2, bestCost)) {
|
|
38480
|
+
bestCost = c2;
|
|
38481
|
+
best = { alpha, beta, gamma: gamma2 };
|
|
38482
|
+
}
|
|
38483
|
+
}
|
|
38484
|
+
return { ...best, drift: false };
|
|
38485
|
+
}
|
|
38486
|
+
function searchSeasonal(n, cost) {
|
|
38487
|
+
let best = { alpha: 0.9, beta: LOW2, gamma: LOW2 };
|
|
38488
|
+
let bestCost = cost(best);
|
|
38489
|
+
for (const a2 of SEASON_ALPHAS)
|
|
38490
|
+
for (const b of n >= 7 && n <= SHORT_SERIES ? [LOW2, a2 - LOW2] : [LOW2])
|
|
38491
|
+
for (const g of [...SEASON_STEPS, 1 - a2 - LOW2]) {
|
|
38492
|
+
if (b < LOW2 || g > 1 - a2 - LOW2 + 1e-9) continue;
|
|
38493
|
+
const c2 = cost({ alpha: a2, beta: b, gamma: g });
|
|
38494
|
+
if (better(c2, bestCost)) {
|
|
38495
|
+
bestCost = c2;
|
|
38496
|
+
best = { alpha: a2, beta: b, gamma: g };
|
|
38497
|
+
}
|
|
38498
|
+
}
|
|
38499
|
+
return { ...best, drift: false };
|
|
38500
|
+
}
|
|
38501
|
+
function searchLattice(shape2, cost) {
|
|
38502
|
+
let best = [0.9, LOW2];
|
|
38503
|
+
let bestCost = cost({ alpha: 0.9, beta: LOW2, gamma: LOW2 });
|
|
38504
|
+
for (const [alpha, beta] of CANDIDATES) {
|
|
38505
|
+
const c2 = cost({ alpha, beta, gamma: LOW2 });
|
|
38506
|
+
if (better(c2, bestCost)) {
|
|
38507
|
+
bestCost = c2;
|
|
38508
|
+
best = [alpha, beta];
|
|
38509
|
+
}
|
|
38510
|
+
}
|
|
38511
|
+
const out = reportedFor(best[0], best[1], shape2);
|
|
38512
|
+
const [fa, fb] = out.fit;
|
|
38513
|
+
const same8 = fa === out.alpha && fb === out.beta;
|
|
38514
|
+
return {
|
|
38515
|
+
alpha: out.alpha,
|
|
38516
|
+
beta: out.beta,
|
|
38517
|
+
gamma: LOW2,
|
|
38518
|
+
drift: out.drift,
|
|
38519
|
+
...same8 ? {} : { fit: { alpha: fa, beta: fb, gamma: LOW2 } }
|
|
38520
|
+
};
|
|
38521
|
+
}
|
|
38522
|
+
function chooseSmoothing(n, m, cost, shape2 = { shift: 9, t: 99 }) {
|
|
38523
|
+
if (m >= 2 && isShortSeasonLength(n, m)) return searchSeasonalLattice(cost, SHORT_EXTRA_TRIPLES);
|
|
38524
|
+
if (m >= 2) return isExactLength(n, m) ? searchSeasonalLattice(cost) : searchSeasonal(n, cost);
|
|
38525
|
+
if (n < MIN_SEARCH_POINTS) return THREE_POINTS;
|
|
38526
|
+
return searchLattice(shape2, cost);
|
|
38527
|
+
}
|
|
38528
|
+
var LOW2, MIN_SEARCH_POINTS, THREE_POINTS, SEASON_ALPHAS, SEASON_STEPS, SHORT_SERIES, SEASONAL_TRIPLES, SHORT_EXTRA_TRIPLES;
|
|
38529
|
+
var init_ets_search = __esm({
|
|
38530
|
+
"xlsx/formula/functions/ets-search.ts"() {
|
|
38531
|
+
init_ets_init_chain();
|
|
38532
|
+
init_ets_init_short();
|
|
38533
|
+
init_ets_search_map();
|
|
38534
|
+
LOW2 = 1e-3;
|
|
38535
|
+
MIN_SEARCH_POINTS = 4;
|
|
38536
|
+
THREE_POINTS = { alpha: 0.1, beta: 0.099, gamma: LOW2, drift: false };
|
|
38537
|
+
SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
|
|
38538
|
+
SEASON_STEPS = [LOW2, 0.125, 0.25, 0.5, 0.75, 0.9];
|
|
38539
|
+
SHORT_SERIES = 16;
|
|
38540
|
+
SEASONAL_TRIPLES = [
|
|
38541
|
+
[0.126, LOW2, LOW2],
|
|
38542
|
+
[0.251, LOW2, LOW2],
|
|
38543
|
+
[0.501, LOW2, LOW2],
|
|
38544
|
+
[0.751, LOW2, LOW2],
|
|
38545
|
+
[2e-3, LOW2, 0.125],
|
|
38546
|
+
[2e-3, LOW2, 0.25],
|
|
38547
|
+
[2e-3, LOW2, 0.5],
|
|
38548
|
+
[2e-3, LOW2, 0.75],
|
|
38549
|
+
[0.251, LOW2, 0.25],
|
|
38550
|
+
[0.75, LOW2, 0.249],
|
|
38551
|
+
[0.9, LOW2, 0.099],
|
|
38552
|
+
[0.251, 0.25, LOW2],
|
|
38553
|
+
[0.1, LOW2, 0.899],
|
|
38554
|
+
[0.126, 0.125, LOW2],
|
|
38555
|
+
[0.998, 0.099, LOW2],
|
|
38556
|
+
[0.25, LOW2, 0.749],
|
|
38557
|
+
[0.5, LOW2, 0.499],
|
|
38558
|
+
[0.5, 0.25, LOW2],
|
|
38559
|
+
[0.251, 0.25, 0.25],
|
|
38560
|
+
[0.501, 0.5, LOW2]
|
|
38561
|
+
];
|
|
38562
|
+
SHORT_EXTRA_TRIPLES = [
|
|
38563
|
+
[1 / 6, 1 / 12, 1 / 12],
|
|
38564
|
+
[1 / 3, 1 / 6, 1 / 6],
|
|
38565
|
+
[1 / 6, 1 / 12, 0.75],
|
|
38566
|
+
[1 / 3, 1 / 6, 0.5],
|
|
38567
|
+
[5 / 6, 1 / 12, 1 / 12]
|
|
38568
|
+
];
|
|
38569
|
+
}
|
|
38570
|
+
});
|
|
38571
|
+
|
|
38572
|
+
// xlsx/formula/functions/ets-validate.ts
|
|
38573
|
+
function etsSearchSeries(y) {
|
|
38574
|
+
const pads = PADS[y.length];
|
|
38575
|
+
if (!pads) return y;
|
|
38576
|
+
const slope = olsSlope(y);
|
|
38577
|
+
return [...y, ...pads.map(([src, lag]) => y[src] + lag * slope)];
|
|
38578
|
+
}
|
|
38579
|
+
function etsValidationCost(y, m, init, p, holdout) {
|
|
38580
|
+
const n = y.length;
|
|
38581
|
+
const train = n - holdout;
|
|
38582
|
+
let { level: level4, trend } = init;
|
|
38583
|
+
const season = [...init.season];
|
|
38584
|
+
let sse = 0;
|
|
38585
|
+
for (let t = 0; t < train; t++) {
|
|
38586
|
+
const k = m >= 2 ? t % m : 0;
|
|
38587
|
+
const e = y[t] - (level4 + trend + (m >= 2 ? season[k] ?? 0 : 0));
|
|
38588
|
+
sse += e * e;
|
|
38589
|
+
level4 += trend + p.alpha * e;
|
|
38590
|
+
trend += p.beta * e;
|
|
38591
|
+
if (m >= 2) season[k] = (season[k] ?? 0) + p.gamma * e;
|
|
38592
|
+
}
|
|
38593
|
+
for (let j = 1; j <= holdout; j++) {
|
|
38594
|
+
const t = train + j - 1;
|
|
38595
|
+
const e = y[t] - (level4 + j * trend + (m >= 2 ? season[t % m] ?? 0 : 0));
|
|
38596
|
+
sse += e * e;
|
|
38597
|
+
}
|
|
38598
|
+
return sse;
|
|
38599
|
+
}
|
|
38600
|
+
var init_ets_validate = __esm({
|
|
38601
|
+
"xlsx/formula/functions/ets-validate.ts"() {
|
|
38602
|
+
init_ets_init();
|
|
38068
38603
|
}
|
|
38069
38604
|
});
|
|
38070
38605
|
|
|
@@ -38089,27 +38624,32 @@ function etsRun(y, m, init, p) {
|
|
|
38089
38624
|
function fitEts(y, seasonLength) {
|
|
38090
38625
|
const n = y.length;
|
|
38091
38626
|
if (n < 2) fail(ERR.NUM);
|
|
38092
|
-
const m = seasonLength >= 2 && n >=
|
|
38627
|
+
const m = seasonLength >= 2 && n >= seasonStart(seasonLength) ? seasonLength : 0;
|
|
38093
38628
|
const solve2 = (p) => {
|
|
38094
38629
|
const init = initialStates(y, m, p, etsRun);
|
|
38095
38630
|
return { init, run: etsRun(y, m, init, p) };
|
|
38096
38631
|
};
|
|
38097
|
-
const
|
|
38098
|
-
|
|
38099
|
-
|
|
38100
|
-
|
|
38101
|
-
|
|
38102
|
-
|
|
38103
|
-
|
|
38104
|
-
|
|
38105
|
-
|
|
38106
|
-
|
|
38107
|
-
|
|
38108
|
-
|
|
38109
|
-
|
|
38110
|
-
|
|
38111
|
-
|
|
38112
|
-
|
|
38632
|
+
const exact = m < 2 || isExactLength(n, m);
|
|
38633
|
+
const padded = m >= 2 && exact ? isShortSeasonLength(n, m) ? shortSearchSeries(y, m) : paddedSearchSeries(y, m) : void 0;
|
|
38634
|
+
const searched = padded ?? (m >= 2 ? y : etsSearchSeries(y));
|
|
38635
|
+
const holdout = m >= 2 && !exact ? 0 : etsHoldout(padded && !(m >= 2 && isShortSeasonLength(n, m)) ? padded.length : n, m);
|
|
38636
|
+
const { drift, fit, ...chosen } = chooseSmoothing(
|
|
38637
|
+
n,
|
|
38638
|
+
m,
|
|
38639
|
+
(p) => etsValidationCost(searched, m, solve2(p).init, p, holdout),
|
|
38640
|
+
trendShape(y, holdout)
|
|
38641
|
+
);
|
|
38642
|
+
const { run: run2 } = solve2(fit ?? chosen);
|
|
38643
|
+
const state = drift ? solve2({ alpha: 1, beta: 0, gamma: chosen.gamma }).run : run2;
|
|
38644
|
+
return {
|
|
38645
|
+
...chosen,
|
|
38646
|
+
gamma: m >= 2 ? chosen.gamma : NO_SEASON_GAMMA,
|
|
38647
|
+
m,
|
|
38648
|
+
n,
|
|
38649
|
+
...run2,
|
|
38650
|
+
level: state.level,
|
|
38651
|
+
trend: state.trend
|
|
38652
|
+
};
|
|
38113
38653
|
}
|
|
38114
38654
|
function etsHoldout(n, m) {
|
|
38115
38655
|
if (n < 11) return 0;
|
|
@@ -38130,17 +38670,18 @@ function etsErrorSd(fit, h) {
|
|
|
38130
38670
|
}
|
|
38131
38671
|
return Math.sqrt(sigma2 * v);
|
|
38132
38672
|
}
|
|
38133
|
-
var
|
|
38673
|
+
var NO_SEASON_GAMMA;
|
|
38134
38674
|
var init_ets_core = __esm({
|
|
38135
38675
|
"xlsx/formula/functions/ets-core.ts"() {
|
|
38136
38676
|
init_values();
|
|
38137
38677
|
init_ets_init();
|
|
38138
|
-
|
|
38139
|
-
|
|
38678
|
+
init_ets_init_chain();
|
|
38679
|
+
init_ets_init_short();
|
|
38680
|
+
init_ets_init_three();
|
|
38681
|
+
init_ets_search();
|
|
38682
|
+
init_ets_search_map();
|
|
38683
|
+
init_ets_validate();
|
|
38140
38684
|
NO_SEASON_GAMMA = Number.EPSILON;
|
|
38141
|
-
ALPHAS = [2e-3, 0.1, 0.126, 0.25, 0.5, 2 / 3, 0.75, 0.9];
|
|
38142
|
-
SEASON_ALPHAS = [2e-3, 0.126, 0.251, 0.501, 2 / 3, 0.75, 0.9];
|
|
38143
|
-
SEASON_STEPS = [LOW, 0.125, 0.25, 0.5, 0.75, 0.9];
|
|
38144
38685
|
}
|
|
38145
38686
|
});
|
|
38146
38687
|
|
|
@@ -38148,7 +38689,7 @@ var init_ets_core = __esm({
|
|
|
38148
38689
|
function detrend(y) {
|
|
38149
38690
|
const n = y.length;
|
|
38150
38691
|
const mx = (n - 1) / 2;
|
|
38151
|
-
const my =
|
|
38692
|
+
const my = mean8(y);
|
|
38152
38693
|
let sxy = 0;
|
|
38153
38694
|
let sxx = 0;
|
|
38154
38695
|
for (let i = 0; i < n; i++) {
|
|
@@ -38165,42 +38706,31 @@ function detectSeasonality(series) {
|
|
|
38165
38706
|
const r = detrend(y);
|
|
38166
38707
|
const scale2 = Math.max(...y.map(Math.abs), 1);
|
|
38167
38708
|
if (r.every((v) => Math.abs(v) <= 1e-12 * scale2)) return 0;
|
|
38168
|
-
const
|
|
38169
|
-
|
|
38170
|
-
for (
|
|
38171
|
-
|
|
38172
|
-
|
|
38709
|
+
const maxLag = Math.floor(n / MIN_CYCLES);
|
|
38710
|
+
let energy = 0;
|
|
38711
|
+
for (const v of r) energy += v * v;
|
|
38712
|
+
const acf = (lag) => {
|
|
38713
|
+
let s = 0;
|
|
38714
|
+
for (let t = 0; t + lag < n; t++) s += r[t] * r[t + lag];
|
|
38715
|
+
return s / energy;
|
|
38716
|
+
};
|
|
38717
|
+
let prev = acf(1);
|
|
38718
|
+
let cur = acf(2);
|
|
38719
|
+
for (let lag = 2; lag <= maxLag; lag++) {
|
|
38720
|
+
const next = acf(lag + 1);
|
|
38721
|
+
if (cur >= prev && cur >= next && cur >= MIN_ACF) return lag;
|
|
38722
|
+
prev = cur;
|
|
38723
|
+
cur = next;
|
|
38173
38724
|
}
|
|
38174
|
-
|
|
38175
|
-
|
|
38176
|
-
|
|
38177
|
-
for (let k = 1; k <= Math.floor(n / 2); k++) {
|
|
38178
|
-
let re = 0;
|
|
38179
|
-
let im = 0;
|
|
38180
|
-
for (let t = 0; t < n; t++) {
|
|
38181
|
-
const j = k * t % n;
|
|
38182
|
-
const v = r[t];
|
|
38183
|
-
re += v * cos2[j];
|
|
38184
|
-
im -= v * sin2[j];
|
|
38185
|
-
}
|
|
38186
|
-
const power2 = re * re + im * im;
|
|
38187
|
-
total2 += power2;
|
|
38188
|
-
if (k >= MIN_CYCLES && power2 > best) {
|
|
38189
|
-
best = power2;
|
|
38190
|
-
bestK = k;
|
|
38191
|
-
}
|
|
38192
|
-
}
|
|
38193
|
-
if (bestK === 0 || !(best / total2 >= MIN_SHARE)) return 0;
|
|
38194
|
-
const period = Math.round(n / bestK);
|
|
38195
|
-
return period >= 2 ? period : 0;
|
|
38196
|
-
}
|
|
38197
|
-
var MAX_POINTS, MIN_CYCLES, MIN_SHARE, mean3;
|
|
38725
|
+
return 0;
|
|
38726
|
+
}
|
|
38727
|
+
var MAX_POINTS, MIN_CYCLES, MIN_ACF, mean8;
|
|
38198
38728
|
var init_ets_season = __esm({
|
|
38199
38729
|
"xlsx/formula/functions/ets-season.ts"() {
|
|
38200
38730
|
MAX_POINTS = 8192;
|
|
38201
38731
|
MIN_CYCLES = 3;
|
|
38202
|
-
|
|
38203
|
-
|
|
38732
|
+
MIN_ACF = 0.3;
|
|
38733
|
+
mean8 = (xs) => xs.reduce((a2, b) => a2 + b, 0) / (xs.length || 1);
|
|
38204
38734
|
}
|
|
38205
38735
|
});
|
|
38206
38736
|
|
|
@@ -38274,9 +38804,9 @@ function aggregate2(code, xs) {
|
|
|
38274
38804
|
case 4:
|
|
38275
38805
|
return Math.max(...xs);
|
|
38276
38806
|
case 5:
|
|
38277
|
-
return Math.min(...xs);
|
|
38278
|
-
case 6:
|
|
38279
38807
|
return median2(xs);
|
|
38808
|
+
case 6:
|
|
38809
|
+
return Math.min(...xs);
|
|
38280
38810
|
default:
|
|
38281
38811
|
return xs.reduce((a2, b) => a2 + b, 0);
|
|
38282
38812
|
}
|
|
@@ -40975,7 +41505,7 @@ var init_captions = __esm({
|
|
|
40975
41505
|
functions: FUNCTIONS,
|
|
40976
41506
|
aggregates: aggregateNames()
|
|
40977
41507
|
};
|
|
40978
|
-
fillCaption = (
|
|
41508
|
+
fillCaption = (template2, ...args) => template2.replace(/\{(\d)\}/g, (_match, at) => args[Number(at)] ?? "");
|
|
40979
41509
|
}
|
|
40980
41510
|
});
|
|
40981
41511
|
|
|
@@ -41560,8 +42090,8 @@ var init_data2 = __esm({
|
|
|
41560
42090
|
function variance2(numbers3, sample) {
|
|
41561
42091
|
const n = numbers3.length;
|
|
41562
42092
|
if (n < (sample ? 2 : 1)) return DIV0;
|
|
41563
|
-
const
|
|
41564
|
-
const squares = numbers3.reduce((total2, value) => total2 + (value -
|
|
42093
|
+
const mean9 = numbers3.reduce((total2, value) => total2 + value, 0) / n;
|
|
42094
|
+
const squares = numbers3.reduce((total2, value) => total2 + (value - mean9) ** 2, 0);
|
|
41565
42095
|
return squares / (sample ? n - 1 : n);
|
|
41566
42096
|
}
|
|
41567
42097
|
function aggregateValues(records, field, type) {
|
|
@@ -42827,9 +43357,9 @@ var init_deps = __esm({
|
|
|
42827
43357
|
});
|
|
42828
43358
|
|
|
42829
43359
|
// xlsx/edit/range-math.ts
|
|
42830
|
-
function shiftSpan(start, end,
|
|
42831
|
-
const { at, count: count2 } =
|
|
42832
|
-
const max = axisMax(
|
|
43360
|
+
function shiftSpan(start, end, shift3) {
|
|
43361
|
+
const { at, count: count2 } = shift3;
|
|
43362
|
+
const max = axisMax(shift3.axis);
|
|
42833
43363
|
if (count2 > 0) {
|
|
42834
43364
|
if (start >= at) {
|
|
42835
43365
|
if (start + count2 > max) return void 0;
|
|
@@ -42845,24 +43375,24 @@ function shiftSpan(start, end, shift2) {
|
|
|
42845
43375
|
const e = end >= max ? max : end < at ? end : end > last ? end - n : at - 1;
|
|
42846
43376
|
return s > e ? void 0 : { start: s, end: e };
|
|
42847
43377
|
}
|
|
42848
|
-
function shiftRange(range,
|
|
42849
|
-
if (
|
|
42850
|
-
const span3 = shiftSpan(range.start.row, range.end.row,
|
|
43378
|
+
function shiftRange(range, shift3) {
|
|
43379
|
+
if (shift3.axis === "row") {
|
|
43380
|
+
const span3 = shiftSpan(range.start.row, range.end.row, shift3);
|
|
42851
43381
|
return span3 && {
|
|
42852
43382
|
start: { row: span3.start, col: range.start.col },
|
|
42853
43383
|
end: { row: span3.end, col: range.end.col }
|
|
42854
43384
|
};
|
|
42855
43385
|
}
|
|
42856
|
-
const span2 = shiftSpan(range.start.col, range.end.col,
|
|
43386
|
+
const span2 = shiftSpan(range.start.col, range.end.col, shift3);
|
|
42857
43387
|
return span2 && {
|
|
42858
43388
|
start: { row: range.start.row, col: span2.start },
|
|
42859
43389
|
end: { row: range.end.row, col: span2.end }
|
|
42860
43390
|
};
|
|
42861
43391
|
}
|
|
42862
|
-
function shiftRangeInBand(range,
|
|
42863
|
-
const other =
|
|
43392
|
+
function shiftRangeInBand(range, shift3, lo, hi) {
|
|
43393
|
+
const other = shift3.axis === "row" ? "col" : "row";
|
|
42864
43394
|
if (range.end[other] < lo || range.start[other] > hi) return range;
|
|
42865
|
-
if (range.start[other] >= lo && range.end[other] <= hi) return shiftRange(range,
|
|
43395
|
+
if (range.start[other] >= lo && range.end[other] <= hi) return shiftRange(range, shift3);
|
|
42866
43396
|
return range;
|
|
42867
43397
|
}
|
|
42868
43398
|
var axisMax, sameRange;
|
|
@@ -42880,7 +43410,7 @@ function pointsAt(token2, formulaSheet, sheet) {
|
|
|
42880
43410
|
if (!prefix) return formulaSheet.toLowerCase() === sheet.toLowerCase();
|
|
42881
43411
|
return prefix.book === void 0 && prefix.sheet2 === void 0 && prefix.sheet.toLowerCase() === sheet.toLowerCase();
|
|
42882
43412
|
}
|
|
42883
|
-
function shiftFormulaInBand(formula2, formulaSheet, sheet,
|
|
43413
|
+
function shiftFormulaInBand(formula2, formulaSheet, sheet, shift3, band) {
|
|
42884
43414
|
let tokens2;
|
|
42885
43415
|
try {
|
|
42886
43416
|
tokens2 = tokenize(formula2);
|
|
@@ -42901,7 +43431,7 @@ function shiftFormulaInBand(formula2, formulaSheet, sheet, shift2, band) {
|
|
|
42901
43431
|
},
|
|
42902
43432
|
end: { row: Math.max(ref.start.row, ref.end.row), col: Math.max(ref.start.col, ref.end.col) }
|
|
42903
43433
|
};
|
|
42904
|
-
const moved = shiftRangeInBand(range,
|
|
43434
|
+
const moved = shiftRangeInBand(range, shift3, band.lo, band.hi);
|
|
42905
43435
|
if (moved && sameRange(moved, range)) continue;
|
|
42906
43436
|
const prefix = token2.prefix?.text ?? "";
|
|
42907
43437
|
if (!moved) {
|
|
@@ -42945,14 +43475,14 @@ function carriedRefEdits(sourceSheets, currentSheets, shiftsOf = () => []) {
|
|
|
42945
43475
|
edits.deleted.push(source3.name);
|
|
42946
43476
|
continue;
|
|
42947
43477
|
}
|
|
42948
|
-
for (const
|
|
43478
|
+
for (const shift3 of shiftsOf(current)) edits.shifts.push({ sheet: source3.name, shift: shift3 });
|
|
42949
43479
|
if (current.name !== source3.name) edits.renamed.push([source3.name, current.name]);
|
|
42950
43480
|
}
|
|
42951
43481
|
return edits;
|
|
42952
43482
|
}
|
|
42953
|
-
function shiftOne(formula2, formulaSheet, sheet,
|
|
42954
|
-
if (
|
|
42955
|
-
const spec2 = { sheet, axis:
|
|
43483
|
+
function shiftOne(formula2, formulaSheet, sheet, shift3) {
|
|
43484
|
+
if (shift3.band) return shiftFormulaInBand(formula2, formulaSheet, sheet, shift3, shift3.band);
|
|
43485
|
+
const spec2 = { sheet, axis: shift3.axis, at: shift3.at, count: shift3.count };
|
|
42956
43486
|
return shiftFormula(formula2, formulaSheet, spec2);
|
|
42957
43487
|
}
|
|
42958
43488
|
function renameAll(formula2, renamed, taken) {
|
|
@@ -42970,7 +43500,7 @@ function renameAll(formula2, renamed, taken) {
|
|
|
42970
43500
|
}
|
|
42971
43501
|
function patchCarriedFormula(formula2, formulaSheet, edits) {
|
|
42972
43502
|
let out = formula2;
|
|
42973
|
-
for (const { sheet, shift:
|
|
43503
|
+
for (const { sheet, shift: shift3 } of edits.shifts) out = shiftOne(out, formulaSheet, sheet, shift3);
|
|
42974
43504
|
for (const sheet of edits.deleted) out = deleteSheetInFormula(out, sheet);
|
|
42975
43505
|
return renameAll(out, edits.renamed, takenNames(edits));
|
|
42976
43506
|
}
|
|
@@ -44931,7 +45461,7 @@ function addChartSeries(space, input) {
|
|
|
44931
45461
|
const group = groups.find((_, i) => i === (input.groupIndex ?? groups.length - 1));
|
|
44932
45462
|
if (!group) throw new RangeError("The chart has no chart group to add a series to");
|
|
44933
45463
|
const all2 = chartSpaceSeries(draft);
|
|
44934
|
-
const
|
|
45464
|
+
const template2 = all2[0];
|
|
44935
45465
|
const series = {
|
|
44936
45466
|
index: nextNumber(all2.map((item2) => item2.index)),
|
|
44937
45467
|
order: nextNumber(all2.map((item2) => item2.order)),
|
|
@@ -44948,7 +45478,7 @@ function addChartSeries(space, input) {
|
|
|
44948
45478
|
};
|
|
44949
45479
|
else if (input.name !== void 0) series.tx = { value: input.name, text: input.name };
|
|
44950
45480
|
if (input.spPr) series.spPr = structuredClone(input.spPr);
|
|
44951
|
-
const templateCategories =
|
|
45481
|
+
const templateCategories = template2?.categories ?? template2?.xValues;
|
|
44952
45482
|
if (input.categories !== void 0)
|
|
44953
45483
|
series[categoryKey(group)] = categorySource(
|
|
44954
45484
|
input.categories,
|
|
@@ -49086,6 +49616,7 @@ function createChatRooms(options) {
|
|
|
49086
49616
|
}
|
|
49087
49617
|
|
|
49088
49618
|
// teams/presence.ts
|
|
49619
|
+
var activityFromWire = (raw2) => raw2.activity === "meeting" && statusFromWire(raw2) === "busy" ? "meeting" : void 0;
|
|
49089
49620
|
var PRESENCE_STATUSES = [
|
|
49090
49621
|
"available",
|
|
49091
49622
|
"busy",
|
|
@@ -49132,6 +49663,30 @@ function statusFromWire(raw2) {
|
|
|
49132
49663
|
if (isPresenceStatus(raw2.status)) return raw2.status;
|
|
49133
49664
|
return raw2.availability === "busy" || raw2.availability === "away" ? raw2.availability : "available";
|
|
49134
49665
|
}
|
|
49666
|
+
var PRESENCE_RANK = {
|
|
49667
|
+
dnd: 0,
|
|
49668
|
+
busy: 1,
|
|
49669
|
+
available: 2,
|
|
49670
|
+
brb: 3,
|
|
49671
|
+
away: 4,
|
|
49672
|
+
offline: 5
|
|
49673
|
+
};
|
|
49674
|
+
function comparePresence(a2, b) {
|
|
49675
|
+
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);
|
|
49676
|
+
}
|
|
49677
|
+
function combinePresence(clients) {
|
|
49678
|
+
let best = null;
|
|
49679
|
+
for (const c2 of clients) if (!best || comparePresence(c2, best) < 0) best = c2;
|
|
49680
|
+
return best;
|
|
49681
|
+
}
|
|
49682
|
+
function clientPresenceFromWire(raw2) {
|
|
49683
|
+
const activity = activityFromWire(raw2);
|
|
49684
|
+
return {
|
|
49685
|
+
status: statusFromWire(raw2),
|
|
49686
|
+
message: sanitizeStatusMessage(raw2.statusMessage),
|
|
49687
|
+
...activity ? { activity } : {}
|
|
49688
|
+
};
|
|
49689
|
+
}
|
|
49135
49690
|
function sanitizeStatusMessage(text) {
|
|
49136
49691
|
if (typeof text !== "string") return "";
|
|
49137
49692
|
return stripHtmlTags(text).replace(/[\u0000-\u001f\u007f]/gu, " ").replace(/\s+/gu, " ").trim().slice(0, MAX_STATUS_MESSAGE_CHARS);
|
|
@@ -49177,10 +49732,13 @@ function applyExpiry(setting, now) {
|
|
|
49177
49732
|
function isIdle(lastActivityAt, now, idleMinutes) {
|
|
49178
49733
|
return idleMinutes > 0 && now - lastActivityAt >= idleMinutes * 6e4;
|
|
49179
49734
|
}
|
|
49180
|
-
function
|
|
49735
|
+
function effectivePresence(setting, idle, now, inMeeting = false) {
|
|
49181
49736
|
const { status } = applyExpiry(setting, now);
|
|
49182
|
-
|
|
49737
|
+
if (status !== "available") return { status };
|
|
49738
|
+
if (inMeeting) return { status: "busy", activity: "meeting" };
|
|
49739
|
+
return { status: idle ? "away" : "available" };
|
|
49183
49740
|
}
|
|
49741
|
+
var effectiveStatus = (setting, idle, now, inMeeting = false) => effectivePresence(setting, idle, now, inMeeting).status;
|
|
49184
49742
|
function nextExpiry(setting) {
|
|
49185
49743
|
const times = [setting.statusExpiresAt, setting.messageExpiresAt].filter(
|
|
49186
49744
|
(t) => t !== null
|
|
@@ -49241,6 +49799,7 @@ function peopleViews(self, peers) {
|
|
|
49241
49799
|
color: p.userColor,
|
|
49242
49800
|
self: false,
|
|
49243
49801
|
availability: statusFromWire(p),
|
|
49802
|
+
...activityFromWire(p) ? { activity: activityFromWire(p) } : {},
|
|
49244
49803
|
statusMessage: p.statusMessage ?? "",
|
|
49245
49804
|
inCall: Boolean(p.callRoom)
|
|
49246
49805
|
}))
|
|
@@ -49284,10 +49843,21 @@ function searchMessages(channels, messagesOf, query, limit2 = 50) {
|
|
|
49284
49843
|
}
|
|
49285
49844
|
|
|
49286
49845
|
// teams/chat-view.ts
|
|
49846
|
+
function peerPresenceOf(userId, peers) {
|
|
49847
|
+
return combinePresence(
|
|
49848
|
+
peers.filter((p) => p.userId === userId).map((p) => clientPresenceFromWire(p))
|
|
49849
|
+
);
|
|
49850
|
+
}
|
|
49287
49851
|
function memberPresence(userId, selfId, selfStatus, peers) {
|
|
49288
49852
|
if (userId === selfId) return selfStatus;
|
|
49289
|
-
|
|
49290
|
-
|
|
49853
|
+
return peerPresenceOf(userId, peers)?.status ?? "offline";
|
|
49854
|
+
}
|
|
49855
|
+
function memberShown(userId, selfId, self, peers) {
|
|
49856
|
+
const shown = userId === selfId ? { status: self.status, activity: self.activity } : peerPresenceOf(userId, peers) ?? { status: "offline", activity: void 0 };
|
|
49857
|
+
return {
|
|
49858
|
+
availability: shown.status,
|
|
49859
|
+
...shown.activity ? { activity: shown.activity } : {}
|
|
49860
|
+
};
|
|
49291
49861
|
}
|
|
49292
49862
|
function chatViews(input) {
|
|
49293
49863
|
const { chats, messagesOf, selfId, selfStatus, lastRead, peers, workspaceId, selectedId } = input;
|
|
@@ -49305,7 +49875,7 @@ function chatViews(input) {
|
|
|
49305
49875
|
id: m.id,
|
|
49306
49876
|
name: m.name,
|
|
49307
49877
|
self: m.id === selfId,
|
|
49308
|
-
|
|
49878
|
+
...memberShown(m.id, selfId, { status: selfStatus, activity: input.selfActivity }, peers)
|
|
49309
49879
|
})),
|
|
49310
49880
|
unread: chat.id === selectedId ? 0 : messages.filter((m) => !m.system && m.authorId !== selfId && m.ts > read).length,
|
|
49311
49881
|
lastMessage: last ? {
|
|
@@ -49327,7 +49897,7 @@ function contactViews(roster, selfId, peers) {
|
|
|
49327
49897
|
return roster.filter((r) => r.id !== selfId).map((r) => ({
|
|
49328
49898
|
id: r.id,
|
|
49329
49899
|
name: r.name,
|
|
49330
|
-
|
|
49900
|
+
...memberShown(r.id, selfId, { status: "available" }, peers)
|
|
49331
49901
|
})).sort((a2, b) => rank3(a2.availability) - rank3(b.availability) || a2.name.localeCompare(b.name));
|
|
49332
49902
|
}
|
|
49333
49903
|
|
|
@@ -50002,31 +50572,70 @@ function createNotificationSettings(storage, key) {
|
|
|
50002
50572
|
};
|
|
50003
50573
|
}
|
|
50004
50574
|
|
|
50575
|
+
// teams/presence-meetings.ts
|
|
50576
|
+
var MEETING_WINDOW_HORIZON_MS = 48 * 60 * MINUTE_MS;
|
|
50577
|
+
var attendsMeeting = (meeting, userId) => meetingVisibleTo(meeting, userId) && (meeting.organizerId === userId || meeting.attendees.some((a2) => a2.id === userId));
|
|
50578
|
+
function meetingWindows(meetings, userId, now, horizon = MEETING_WINDOW_HORIZON_MS) {
|
|
50579
|
+
const spans = [];
|
|
50580
|
+
for (const meeting of meetings) {
|
|
50581
|
+
if (!attendsMeeting(meeting, userId)) continue;
|
|
50582
|
+
for (const o of occurrencesBetween(meeting, now, now + horizon))
|
|
50583
|
+
if (o.end > o.start) spans.push({ start: o.start, end: o.end });
|
|
50584
|
+
}
|
|
50585
|
+
spans.sort((a2, b) => a2.start - b.start || a2.end - b.end);
|
|
50586
|
+
const merged = [];
|
|
50587
|
+
for (const span2 of spans) {
|
|
50588
|
+
const last = merged[merged.length - 1];
|
|
50589
|
+
if (last && span2.start <= last.end) last.end = Math.max(last.end, span2.end);
|
|
50590
|
+
else merged.push({ ...span2 });
|
|
50591
|
+
}
|
|
50592
|
+
return merged;
|
|
50593
|
+
}
|
|
50594
|
+
var inMeetingAt = (windows, now) => windows.some((w) => w.start <= now && now < w.end);
|
|
50595
|
+
function nextMeetingBoundary(windows, now) {
|
|
50596
|
+
let next = null;
|
|
50597
|
+
for (const w of windows)
|
|
50598
|
+
for (const t of [w.start, w.end]) if (t > now && (next === null || t < next)) next = t;
|
|
50599
|
+
return next;
|
|
50600
|
+
}
|
|
50601
|
+
var sameWindows = (a2, b) => a2.length === b.length && a2.every((w, i) => w.start === b[i].start && w.end === b[i].end);
|
|
50602
|
+
|
|
50005
50603
|
// teams/presence-controller.ts
|
|
50006
50604
|
var MAX_TIMER_MS = 2 ** 31 - 1;
|
|
50605
|
+
var sameSetting = (a2, b) => a2.status === b.status && a2.statusExpiresAt === b.statusExpiresAt && a2.message === b.message && a2.messageExpiresAt === b.messageExpiresAt;
|
|
50007
50606
|
function createPresenceController(options) {
|
|
50008
50607
|
const now = options.now ?? Date.now;
|
|
50009
50608
|
const { storage, storageKey } = options;
|
|
50010
|
-
|
|
50011
|
-
|
|
50012
|
-
|
|
50013
|
-
|
|
50014
|
-
|
|
50015
|
-
|
|
50016
|
-
|
|
50017
|
-
|
|
50018
|
-
|
|
50609
|
+
const readStored = () => {
|
|
50610
|
+
let read = {
|
|
50611
|
+
setting: defaultPresenceSetting(),
|
|
50612
|
+
idleMinutes: normalizeIdleMinutes(options.idleMinutes)
|
|
50613
|
+
};
|
|
50614
|
+
try {
|
|
50615
|
+
const stored = JSON.parse(storage?.getItem(storageKey) ?? "null");
|
|
50616
|
+
read = { ...read, setting: parsePresenceSetting(stored) };
|
|
50617
|
+
if (stored && options.idleMinutes === void 0 && "idleMinutes" in stored)
|
|
50618
|
+
read.idleMinutes = normalizeIdleMinutes(stored.idleMinutes);
|
|
50619
|
+
} catch {
|
|
50620
|
+
}
|
|
50621
|
+
return read;
|
|
50622
|
+
};
|
|
50623
|
+
let { setting, idleMinutes } = readStored();
|
|
50019
50624
|
let lastActivity = now();
|
|
50020
50625
|
let idle = false;
|
|
50021
50626
|
let timer;
|
|
50022
50627
|
let destroyed = false;
|
|
50023
50628
|
let published = "";
|
|
50024
|
-
|
|
50629
|
+
let meetingWindows2 = [];
|
|
50630
|
+
let inMeeting = false;
|
|
50025
50631
|
const view = () => {
|
|
50026
|
-
const
|
|
50632
|
+
const t = now();
|
|
50633
|
+
const current = applyExpiry(setting, t);
|
|
50634
|
+
const shown = effectivePresence(setting, idle, t, inMeetingAt(meetingWindows2, t));
|
|
50027
50635
|
return {
|
|
50028
50636
|
status: current.status,
|
|
50029
|
-
effective:
|
|
50637
|
+
effective: shown.status,
|
|
50638
|
+
...shown.activity ? { activity: shown.activity } : {},
|
|
50030
50639
|
statusExpiresAt: current.statusExpiresAt,
|
|
50031
50640
|
message: current.message,
|
|
50032
50641
|
messageExpiresAt: current.messageExpiresAt,
|
|
@@ -50047,6 +50656,8 @@ function createPresenceController(options) {
|
|
|
50047
50656
|
const expiry = nextExpiry(setting);
|
|
50048
50657
|
if (expiry !== null) times.push(expiry);
|
|
50049
50658
|
if (!idle && idleMinutes > 0) times.push(lastActivity + idleMinutes * 6e4);
|
|
50659
|
+
const boundary2 = nextMeetingBoundary(meetingWindows2, now());
|
|
50660
|
+
if (boundary2 !== null) times.push(boundary2);
|
|
50050
50661
|
if (!times.length) return;
|
|
50051
50662
|
const wait = Math.max(0, Math.min(...times) - now());
|
|
50052
50663
|
timer = setTimeout(evaluate, Math.min(wait, MAX_TIMER_MS));
|
|
@@ -50060,17 +50671,31 @@ function createPresenceController(options) {
|
|
|
50060
50671
|
const nowIdle = isIdle(lastActivity, t, idleMinutes);
|
|
50061
50672
|
const idleChanged = nowIdle !== idle;
|
|
50062
50673
|
idle = nowIdle;
|
|
50674
|
+
const nowInMeeting = inMeetingAt(meetingWindows2, t);
|
|
50675
|
+
const meetingChanged = nowInMeeting !== inMeeting;
|
|
50676
|
+
inMeeting = nowInMeeting;
|
|
50063
50677
|
if (expired) save();
|
|
50064
50678
|
const current = view();
|
|
50065
|
-
const key = `${current.effective}|${current.message}`;
|
|
50679
|
+
const key = `${current.effective}|${current.message}|${current.activity ?? ""}`;
|
|
50066
50680
|
if (key !== published) {
|
|
50067
50681
|
published = key;
|
|
50068
|
-
options.publish(current.effective, current.message);
|
|
50682
|
+
options.publish(current.effective, current.message, current.activity);
|
|
50069
50683
|
}
|
|
50070
|
-
if (expired || idleChanged) options.changed();
|
|
50684
|
+
if (expired || idleChanged || meetingChanged) options.changed();
|
|
50071
50685
|
schedule();
|
|
50072
50686
|
};
|
|
50073
50687
|
evaluate();
|
|
50688
|
+
const reload = () => {
|
|
50689
|
+
if (destroyed) return;
|
|
50690
|
+
const next = readStored();
|
|
50691
|
+
const same8 = next.idleMinutes === idleMinutes && sameSetting(next.setting, setting);
|
|
50692
|
+
if (same8) return;
|
|
50693
|
+
setting = next.setting;
|
|
50694
|
+
idleMinutes = next.idleMinutes;
|
|
50695
|
+
evaluate();
|
|
50696
|
+
options.changed();
|
|
50697
|
+
};
|
|
50698
|
+
const unsubscribe = options.subscribe?.(reload);
|
|
50074
50699
|
return {
|
|
50075
50700
|
view,
|
|
50076
50701
|
setStatus(status, duration2 = "never") {
|
|
@@ -50105,6 +50730,11 @@ function createPresenceController(options) {
|
|
|
50105
50730
|
evaluate();
|
|
50106
50731
|
options.changed();
|
|
50107
50732
|
},
|
|
50733
|
+
setMeetingWindows(windows) {
|
|
50734
|
+
if (destroyed || sameWindows(windows, meetingWindows2)) return;
|
|
50735
|
+
meetingWindows2 = windows.map((w) => ({ start: w.start, end: w.end }));
|
|
50736
|
+
evaluate();
|
|
50737
|
+
},
|
|
50108
50738
|
noteActivity() {
|
|
50109
50739
|
lastActivity = now();
|
|
50110
50740
|
if (idle) evaluate();
|
|
@@ -50112,6 +50742,7 @@ function createPresenceController(options) {
|
|
|
50112
50742
|
destroy() {
|
|
50113
50743
|
destroyed = true;
|
|
50114
50744
|
clearTimeout(timer);
|
|
50745
|
+
unsubscribe?.();
|
|
50115
50746
|
}
|
|
50116
50747
|
};
|
|
50117
50748
|
}
|
|
@@ -52222,6 +52853,8 @@ function sanitizePresence(raw2) {
|
|
|
52222
52853
|
if (isValidId(raw2.userId)) out.userId = raw2.userId;
|
|
52223
52854
|
out.status = statusFromWire(raw2);
|
|
52224
52855
|
out.availability = legacyAvailability(out.status);
|
|
52856
|
+
const activity = activityFromWire(raw2);
|
|
52857
|
+
if (activity) out.activity = activity;
|
|
52225
52858
|
const statusMessage = sanitizeStatusMessage(raw2.statusMessage);
|
|
52226
52859
|
if (statusMessage) out.statusMessage = statusMessage;
|
|
52227
52860
|
return out;
|
|
@@ -52355,7 +52988,11 @@ function createTeamsWorkspace(options) {
|
|
|
52355
52988
|
},
|
|
52356
52989
|
setActiveChannel: (channelId) => session.updatePresence({ channelId: channelId ?? "" }),
|
|
52357
52990
|
setTyping: (channelId) => session.updatePresence({ typingIn: channelId ?? "" }),
|
|
52358
|
-
setAvailability: (status) => session.updatePresence({
|
|
52991
|
+
setAvailability: (status, activity) => session.updatePresence({
|
|
52992
|
+
status,
|
|
52993
|
+
availability: legacyAvailability(status),
|
|
52994
|
+
activity: activity ?? ""
|
|
52995
|
+
}),
|
|
52359
52996
|
setStatusMessage: (message) => session.updatePresence({ statusMessage: sanitizeStatusMessage(message) }),
|
|
52360
52997
|
destroy() {
|
|
52361
52998
|
for (const c2 of calls.values()) c2.leave();
|
|
@@ -52489,6 +53126,7 @@ function createTeamsClient(options) {
|
|
|
52489
53126
|
name: ws.user.name,
|
|
52490
53127
|
color: ws.session.identity.userColor,
|
|
52491
53128
|
availability: presenceView().effective,
|
|
53129
|
+
...presenceView().activity ? { activity: presenceView().activity } : {},
|
|
52492
53130
|
statusMessage: presenceView().message,
|
|
52493
53131
|
inCall: call?.phase === "connected"
|
|
52494
53132
|
},
|
|
@@ -52526,6 +53164,7 @@ function createTeamsClient(options) {
|
|
|
52526
53164
|
messagesOf,
|
|
52527
53165
|
selfId: ws.user.id,
|
|
52528
53166
|
selfStatus: presenceView().effective,
|
|
53167
|
+
...presenceView().activity ? { selfActivity: presenceView().activity } : {},
|
|
52529
53168
|
lastRead,
|
|
52530
53169
|
peers: p,
|
|
52531
53170
|
workspaceId,
|
|
@@ -52588,12 +53227,14 @@ function createTeamsClient(options) {
|
|
|
52588
53227
|
};
|
|
52589
53228
|
let state = compute();
|
|
52590
53229
|
let queued = false;
|
|
53230
|
+
const syncMeetingPresence = () => presence?.setMeetingWindows(meetingWindows(ws.meetings.list(), ws.user.id, now()));
|
|
52591
53231
|
const refresh = () => {
|
|
52592
53232
|
if (queued || destroyed) return;
|
|
52593
53233
|
queued = true;
|
|
52594
53234
|
queueMicrotask(() => {
|
|
52595
53235
|
queued = false;
|
|
52596
53236
|
if (destroyed) return;
|
|
53237
|
+
syncMeetingPresence();
|
|
52597
53238
|
state = compute();
|
|
52598
53239
|
for (const l of [...listeners]) l();
|
|
52599
53240
|
for (const item2 of feed.drain()) notices.emit("notification", item2);
|
|
@@ -52621,16 +53262,24 @@ function createTeamsClient(options) {
|
|
|
52621
53262
|
};
|
|
52622
53263
|
doc.on("update", scheduleSave);
|
|
52623
53264
|
onChatDocUpdate = scheduleSave;
|
|
53265
|
+
const presenceKey = `teams:presence:${encodeURIComponent(workspaceId)}:${encodeURIComponent(ws.user.id)}`;
|
|
52624
53266
|
presence = createPresenceController({
|
|
52625
53267
|
storage,
|
|
52626
|
-
storageKey:
|
|
53268
|
+
storageKey: presenceKey,
|
|
53269
|
+
...storage?.subscribe ? {
|
|
53270
|
+
// A status chosen in another tab of this person reaches this one.
|
|
53271
|
+
subscribe: (onChange) => storage.subscribe((key) => {
|
|
53272
|
+
if (key === null || key === presenceKey) onChange();
|
|
53273
|
+
})
|
|
53274
|
+
} : {},
|
|
52627
53275
|
idleMinutes: options.idleMinutes,
|
|
52628
|
-
publish: (status, message) => {
|
|
52629
|
-
ws.setAvailability(status);
|
|
53276
|
+
publish: (status, message, activity) => {
|
|
53277
|
+
ws.setAvailability(status, activity);
|
|
52630
53278
|
ws.setStatusMessage(message);
|
|
52631
53279
|
},
|
|
52632
53280
|
changed: refresh
|
|
52633
53281
|
});
|
|
53282
|
+
syncMeetingPresence();
|
|
52634
53283
|
state = compute();
|
|
52635
53284
|
const unsubs = [
|
|
52636
53285
|
ws.chat.observe(refresh),
|
|
@@ -52757,6 +53406,7 @@ function createTeamsClient(options) {
|
|
|
52757
53406
|
});
|
|
52758
53407
|
const checkReminders = () => {
|
|
52759
53408
|
if (destroyed) return;
|
|
53409
|
+
syncMeetingPresence();
|
|
52760
53410
|
const settings = feed.settings.get();
|
|
52761
53411
|
const status = presenceView().effective;
|
|
52762
53412
|
const due = reminders.due(
|
|
@@ -53461,6 +54111,7 @@ exports.MAX_SHARED_CHAT_TITLE_CHARS = MAX_SHARED_CHAT_TITLE_CHARS;
|
|
|
53461
54111
|
exports.MAX_SIGNAL_CHARS = MAX_SIGNAL_CHARS;
|
|
53462
54112
|
exports.MAX_STATUS_MESSAGE_CHARS = MAX_STATUS_MESSAGE_CHARS;
|
|
53463
54113
|
exports.MEETING_REPEATS = MEETING_REPEATS;
|
|
54114
|
+
exports.MEETING_WINDOW_HORIZON_MS = MEETING_WINDOW_HORIZON_MS;
|
|
53464
54115
|
exports.META_MAP = META_MAP;
|
|
53465
54116
|
exports.MIGRATIONS = MIGRATIONS;
|
|
53466
54117
|
exports.MIGRATION_ORIGIN = MIGRATION_ORIGIN;
|
|
@@ -53478,10 +54129,12 @@ exports.STATUS_DURATION_LABELS = STATUS_DURATION_LABELS;
|
|
|
53478
54129
|
exports.TEAMS_SUBPROTOCOL = TEAMS_SUBPROTOCOL;
|
|
53479
54130
|
exports.TeamsSignInError = TeamsSignInError;
|
|
53480
54131
|
exports.WEEKDAY_ORDINALS = WEEKDAY_ORDINALS;
|
|
54132
|
+
exports.activityFromWire = activityFromWire;
|
|
53481
54133
|
exports.activityPreview = activityPreview;
|
|
53482
54134
|
exports.addDays = addDays;
|
|
53483
54135
|
exports.allFilesOf = allFilesOf;
|
|
53484
54136
|
exports.applyExpiry = applyExpiry;
|
|
54137
|
+
exports.attendsMeeting = attendsMeeting;
|
|
53485
54138
|
exports.calendarSlots = calendarSlots;
|
|
53486
54139
|
exports.callRoomId = callRoomId;
|
|
53487
54140
|
exports.channelThreads = channelThreads;
|
|
@@ -53492,6 +54145,8 @@ exports.chatViews = chatViews;
|
|
|
53492
54145
|
exports.checkSchema = checkSchema;
|
|
53493
54146
|
exports.checkTeamsSession = checkTeamsSession;
|
|
53494
54147
|
exports.classifyRoom = classifyRoom;
|
|
54148
|
+
exports.clientPresenceFromWire = clientPresenceFromWire;
|
|
54149
|
+
exports.combinePresence = combinePresence;
|
|
53495
54150
|
exports.connectionAuth = connectionAuth;
|
|
53496
54151
|
exports.contactViews = contactViews;
|
|
53497
54152
|
exports.contentUrl = contentUrl;
|
|
@@ -53523,6 +54178,7 @@ exports.describeActivity = describeActivity;
|
|
|
53523
54178
|
exports.detectContentKind = detectContentKind;
|
|
53524
54179
|
exports.detectOfficeKind = detectOfficeKind;
|
|
53525
54180
|
exports.directChatId = directChatId;
|
|
54181
|
+
exports.effectivePresence = effectivePresence;
|
|
53526
54182
|
exports.effectiveStatus = effectiveStatus;
|
|
53527
54183
|
exports.endpointUrl = endpointUrl;
|
|
53528
54184
|
exports.ensureSchema = ensureSchema;
|
|
@@ -53540,6 +54196,7 @@ exports.icsFold = icsFold;
|
|
|
53540
54196
|
exports.icsLocal = icsLocal;
|
|
53541
54197
|
exports.icsOffset = icsOffset;
|
|
53542
54198
|
exports.icsUtc = icsUtc;
|
|
54199
|
+
exports.inMeetingAt = inMeetingAt;
|
|
53543
54200
|
exports.insertMention = insertMention;
|
|
53544
54201
|
exports.isCalendarRepeat = isCalendarRepeat;
|
|
53545
54202
|
exports.isChatMember = isChatMember;
|
|
@@ -53561,6 +54218,7 @@ exports.meetingCallKey = meetingCallKey;
|
|
|
53561
54218
|
exports.meetingChatId = meetingChatId;
|
|
53562
54219
|
exports.meetingToIcs = meetingToIcs;
|
|
53563
54220
|
exports.meetingVisibleTo = meetingVisibleTo;
|
|
54221
|
+
exports.meetingWindows = meetingWindows;
|
|
53564
54222
|
exports.memberPresence = memberPresence;
|
|
53565
54223
|
exports.mentionDisplayText = mentionDisplayText;
|
|
53566
54224
|
exports.mentionQueryAt = mentionQueryAt;
|
|
@@ -53569,6 +54227,7 @@ exports.mentionTargetsFor = mentionTargetsFor;
|
|
|
53569
54227
|
exports.mentionsUser = mentionsUser;
|
|
53570
54228
|
exports.minuteOfDay = minuteOfDay;
|
|
53571
54229
|
exports.nextExpiry = nextExpiry;
|
|
54230
|
+
exports.nextMeetingBoundary = nextMeetingBoundary;
|
|
53572
54231
|
exports.normalizeIdleMinutes = normalizeIdleMinutes;
|
|
53573
54232
|
exports.nthWeekdayOfMonth = nthWeekdayOfMonth;
|
|
53574
54233
|
exports.occurrenceAt = occurrenceAt;
|
|
@@ -53578,6 +54237,7 @@ exports.ordinalOfDay = ordinalOfDay;
|
|
|
53578
54237
|
exports.parsePresenceSetting = parsePresenceSetting;
|
|
53579
54238
|
exports.parseServerConfig = parseServerConfig;
|
|
53580
54239
|
exports.parseSignal = parseSignal;
|
|
54240
|
+
exports.peerPresenceOf = peerPresenceOf;
|
|
53581
54241
|
exports.peopleViews = peopleViews;
|
|
53582
54242
|
exports.probeTeamsAccounts = probeTeamsAccounts;
|
|
53583
54243
|
exports.promoteMentions = promoteMentions;
|
|
@@ -53590,6 +54250,7 @@ exports.remindersDue = remindersDue;
|
|
|
53590
54250
|
exports.repeatChoices = repeatChoices;
|
|
53591
54251
|
exports.requestTeamsSession = requestTeamsSession;
|
|
53592
54252
|
exports.resolveMentions = resolveMentions;
|
|
54253
|
+
exports.sameWindows = sameWindows;
|
|
53593
54254
|
exports.sanitizeAttachment = sanitizeAttachment;
|
|
53594
54255
|
exports.sanitizeAttachments = sanitizeAttachments;
|
|
53595
54256
|
exports.sanitizeChannelName = sanitizeChannelName;
|