react-semaphor 0.1.423 → 0.1.425

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +243 -91
  3. package/dist/appearance/index.cjs +1 -1
  4. package/dist/appearance/index.js +1 -1
  5. package/dist/brand-studio/index.cjs +2 -2
  6. package/dist/brand-studio/index.js +8 -8
  7. package/dist/chunks/{analyze-result-contract-D7pjjYPy.js → analyze-result-contract-DnfF8kBb.js} +434 -427
  8. package/dist/chunks/analyze-result-contract-ege_u6Nl.js +1 -0
  9. package/dist/chunks/{braces-8TRlDwDw.js → braces-BdbUk_r9.js} +1 -1
  10. package/dist/chunks/{braces-D2tStQjF.js → braces-CbO-aIwH.js} +1 -1
  11. package/dist/chunks/calendar-preferences-dialog-BLaSWhLl.js +1 -0
  12. package/dist/chunks/{calendar-preferences-dialog-t5ET6MON.js → calendar-preferences-dialog-DJwV0aqn.js} +4 -4
  13. package/dist/chunks/{catalog-field-grounding-CJKAqtiC.js → catalog-field-grounding-DcxPLns0.js} +10 -10
  14. package/dist/chunks/{switch-2bh3Hka1.js → code-editor-Bkk7s8hI.js} +7382 -6809
  15. package/dist/chunks/code-editor-CkXyNgYc.js +138 -0
  16. package/dist/chunks/{common-types-4bjoIgvm.js → common-types-ClkOI-3O.js} +4 -4
  17. package/dist/chunks/comparison-document-migration-CQJ0DZlL.js +414 -0
  18. package/dist/chunks/comparison-document-migration-Db64RWYD.js +1 -0
  19. package/dist/chunks/{index-yHe0SeLO.js → dashboard-5agU0G_D.js} +56752 -55440
  20. package/dist/chunks/dashboard-MKIqgGDp.js +1402 -0
  21. package/dist/chunks/{dashboard-briefing-launcher-S2akO-ub.js → dashboard-briefing-launcher-CII8-4qo.js} +11 -6
  22. package/dist/chunks/{dashboard-briefing-launcher-Cavd0QJb.js → dashboard-briefing-launcher-qyEVfuOm.js} +226 -209
  23. package/dist/chunks/dashboard-controls-PJpeYZHw.js +36 -0
  24. package/dist/chunks/dashboard-controls-aJY0FNPP.js +2196 -0
  25. package/dist/chunks/dashboard-input-contract-BFpERluO.js +18 -0
  26. package/dist/chunks/dashboard-input-contract-DV3cshjz.js +1 -0
  27. package/dist/chunks/{dashboard-json-Do2-pdPZ.js → dashboard-json-CzHSP6Fa.js} +16 -15
  28. package/dist/chunks/dashboard-json-DtmR5yCf.js +1 -0
  29. package/dist/chunks/date-formatter-BTTYdAik.js +1 -0
  30. package/dist/chunks/date-formatter-D-89jTjG.js +514 -0
  31. package/dist/chunks/{edit-dashboard-visual-Cw6bq4_w.js → edit-dashboard-visual-AkZzwBCV.js} +8892 -8996
  32. package/dist/chunks/edit-dashboard-visual-Cif6uDqN.js +182 -0
  33. package/dist/chunks/{index-CjzRe2su.js → index-CnujJ3fa.js} +3 -3
  34. package/dist/chunks/{index-DRlMUglg.js → index-Dpm_VET4.js} +2 -2
  35. package/dist/chunks/{index-CJdxSyQq.js → index-If0wlXGi.js} +308 -308
  36. package/dist/chunks/index-jSrCwPQz.js +31 -0
  37. package/dist/chunks/{x-CXDkqdur.js → index-xHCrHprY.js} +59 -59
  38. package/dist/chunks/{layout-grid-C0OI-MRn.js → layout-grid-B08pP7v6.js} +1 -1
  39. package/dist/chunks/{layout-grid-CiubineE.js → layout-grid-D5tYJg1-.js} +1 -1
  40. package/dist/chunks/metric-comparison-4oA4ouU9.js +354 -0
  41. package/dist/chunks/metric-comparison-nQKquVnx.js +1 -0
  42. package/dist/chunks/{palette-C4KTXOug.js → palette-C0yjT5Tv.js} +1 -1
  43. package/dist/chunks/{palette-Cp1hqZtm.js → palette-jqaAcwiQ.js} +1 -1
  44. package/dist/chunks/{save-DgMfP0j8.js → save-HCJjjzdX.js} +1 -1
  45. package/dist/chunks/{save-C__QggEE.js → save-Xdc4pnys.js} +1 -1
  46. package/dist/chunks/{search-BHsQIWBV.js → search-DHZCro8B.js} +1 -1
  47. package/dist/chunks/{search-DNCejM7Z.js → search-Dcud9ajy.js} +1 -1
  48. package/dist/chunks/{update-policy-C1pmhLz9.js → update-policy-BgONreNd.js} +1 -1
  49. package/dist/chunks/{update-policy-BCJc0oI5.js → update-policy-CY2k-pJP.js} +9 -9
  50. package/dist/chunks/{use-create-flow-overlay-state-5MDbZcs1.js → use-create-flow-overlay-state-ByOKVV2K.js} +62 -62
  51. package/dist/chunks/{use-create-flow-overlay-state-BNczg9Gj.js → use-create-flow-overlay-state-DmuReEnk.js} +2 -2
  52. package/dist/chunks/validators-B4VMLX3_.js +1 -0
  53. package/dist/chunks/{validators-PXkij33j.js → validators-Cz-XuORM.js} +123 -119
  54. package/dist/dashboard/index.cjs +1 -1
  55. package/dist/dashboard/index.js +2 -2
  56. package/dist/dashboard-authoring/index.cjs +2 -2
  57. package/dist/dashboard-authoring/index.js +6 -4
  58. package/dist/data-app-builder/index.cjs +6 -6
  59. package/dist/data-app-builder/index.js +5 -5
  60. package/dist/data-app-codegen/index.cjs +1 -1
  61. package/dist/data-app-codegen/index.js +2 -2
  62. package/dist/data-app-codegen-node/index.cjs +1 -1
  63. package/dist/data-app-codegen-node/index.js +3 -3
  64. package/dist/data-app-sdk/index.cjs +1 -1
  65. package/dist/data-app-sdk/index.js +6 -6
  66. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  67. package/dist/data-app-sdk-adapters/index.js +1 -1
  68. package/dist/data-app-sdk-validation/index.cjs +1 -1
  69. package/dist/data-app-sdk-validation/index.js +65 -68
  70. package/dist/format-utils/index.cjs +2 -2
  71. package/dist/format-utils/index.js +59 -58
  72. package/dist/index.cjs +1 -1
  73. package/dist/index.js +19 -19
  74. package/dist/style.css +1 -1
  75. package/dist/surfboard/index.cjs +1 -1
  76. package/dist/surfboard/index.js +3 -3
  77. package/dist/types/analytics-protocol.d.ts +299 -3
  78. package/dist/types/brand-studio.d.ts +2 -2
  79. package/dist/types/briefings.d.ts +65 -41
  80. package/dist/types/dashboard-assistant.d.ts +28 -7
  81. package/dist/types/dashboard-authoring.d.ts +123 -43
  82. package/dist/types/dashboard.d.ts +97 -48
  83. package/dist/types/data-app-builder.d.ts +2 -2
  84. package/dist/types/data-app-sdk.d.ts +1 -1
  85. package/dist/types/format-utils.d.ts +98 -10
  86. package/dist/types/index.js +1 -1
  87. package/dist/types/main.d.ts +229 -95
  88. package/dist/types/shared.d.ts +84 -43
  89. package/dist/types/surfboard.d.ts +99 -49
  90. package/dist/types/types.d.ts +110 -50
  91. package/package.json +2 -1
  92. package/dist/chunks/analyze-result-contract-DpDcImgk.js +0 -1
  93. package/dist/chunks/calendar-preferences-dialog-CTmeASaM.js +0 -1
  94. package/dist/chunks/contracts-CoCOpd_i.js +0 -11
  95. package/dist/chunks/contracts-CtB2VONT.js +0 -1
  96. package/dist/chunks/dashboard-controls-BJLrErjW.js +0 -2322
  97. package/dist/chunks/dashboard-controls-DzbP8AXA.js +0 -52
  98. package/dist/chunks/dashboard-json-5tWb5KD6.js +0 -1
  99. package/dist/chunks/date-formatter-B4EBSe9C.js +0 -1
  100. package/dist/chunks/date-formatter-BlhBftA9.js +0 -416
  101. package/dist/chunks/edit-dashboard-visual-Yh5YFgMF.js +0 -178
  102. package/dist/chunks/index-BPM3gDRw.js +0 -1406
  103. package/dist/chunks/switch-DMT7qf_R.js +0 -138
  104. package/dist/chunks/validators-DMlVbd1p.js +0 -1
  105. package/dist/chunks/x-B6ghREd2.js +0 -31
@@ -0,0 +1,31 @@
1
+ "use strict";const s=require("react");/**
2
+ * @license lucide-react v0.453.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const f=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),d=(...t)=>t.filter((e,r,o)=>!!e&&o.indexOf(e)===r).join(" ");/**
7
+ * @license lucide-react v0.453.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */var g={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
12
+ * @license lucide-react v0.453.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const m=s.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:a="",children:n,iconNode:l,...u},p)=>s.createElement("svg",{ref:p,...g,width:e,height:e,stroke:t,strokeWidth:o?Number(r)*24/Number(e):r,className:d("lucide",a),...u},[...l.map(([h,w])=>s.createElement(h,w)),...Array.isArray(n)?n:[n]]));/**
17
+ * @license lucide-react v0.453.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const i=(t,e)=>{const r=s.forwardRef(({className:o,...a},n)=>s.createElement(m,{ref:n,iconNode:e,className:d(`lucide-${f(t)}`,o),...a}));return r.displayName=`${t}`,r};/**
22
+ * @license lucide-react v0.453.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const b=i("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
27
+ * @license lucide-react v0.453.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const k=i("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class c extends Error{}c.prototype.name="InvalidTokenError";function v(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let o=r.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function y(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return v(e)}catch{return atob(e)}}function C(t,e){if(typeof t!="string")throw new c("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,o=t.split(".")[r];if(typeof o!="string")throw new c(`Invalid token specified: missing part #${r+1}`);let a;try{a=y(o)}catch(n){throw new c(`Invalid token specified: invalid base64 for part #${r+1} (${n.message})`)}try{return JSON.parse(a)}catch(n){throw new c(`Invalid token specified: invalid json for part #${r+1} (${n.message})`)}}exports.ChevronDown=b;exports.X=k;exports.createLucideIcon=i;exports.jwtDecode=C;
@@ -1,66 +1,18 @@
1
1
  import { forwardRef as i, createElement as c } from "react";
2
- class s extends Error {
3
- }
4
- s.prototype.name = "InvalidTokenError";
5
- function g(t) {
6
- return decodeURIComponent(atob(t).replace(/(.)/g, (e, r) => {
7
- let o = r.charCodeAt(0).toString(16).toUpperCase();
8
- return o.length < 2 && (o = "0" + o), "%" + o;
9
- }));
10
- }
11
- function m(t) {
12
- let e = t.replace(/-/g, "+").replace(/_/g, "/");
13
- switch (e.length % 4) {
14
- case 0:
15
- break;
16
- case 2:
17
- e += "==";
18
- break;
19
- case 3:
20
- e += "=";
21
- break;
22
- default:
23
- throw new Error("base64 string is not of the correct length");
24
- }
25
- try {
26
- return g(e);
27
- } catch {
28
- return atob(e);
29
- }
30
- }
31
- function C(t, e) {
32
- if (typeof t != "string")
33
- throw new s("Invalid token specified: must be a string");
34
- e || (e = {});
35
- const r = e.header === !0 ? 0 : 1, o = t.split(".")[r];
36
- if (typeof o != "string")
37
- throw new s(`Invalid token specified: missing part #${r + 1}`);
38
- let a;
39
- try {
40
- a = m(o);
41
- } catch (n) {
42
- throw new s(`Invalid token specified: invalid base64 for part #${r + 1} (${n.message})`);
43
- }
44
- try {
45
- return JSON.parse(a);
46
- } catch (n) {
47
- throw new s(`Invalid token specified: invalid json for part #${r + 1} (${n.message})`);
48
- }
49
- }
50
2
  /**
51
3
  * @license lucide-react v0.453.0 - ISC
52
4
  *
53
5
  * This source code is licensed under the ISC license.
54
6
  * See the LICENSE file in the root directory of this source tree.
55
7
  */
56
- const b = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), d = (...t) => t.filter((e, r, o) => !!e && o.indexOf(e) === r).join(" ");
8
+ const g = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), d = (...t) => t.filter((e, r, o) => !!e && o.indexOf(e) === r).join(" ");
57
9
  /**
58
10
  * @license lucide-react v0.453.0 - ISC
59
11
  *
60
12
  * This source code is licensed under the ISC license.
61
13
  * See the LICENSE file in the root directory of this source tree.
62
14
  */
63
- var k = {
15
+ var m = {
64
16
  xmlns: "http://www.w3.org/2000/svg",
65
17
  width: 24,
66
18
  height: 24,
@@ -77,7 +29,7 @@ var k = {
77
29
  * This source code is licensed under the ISC license.
78
30
  * See the LICENSE file in the root directory of this source tree.
79
31
  */
80
- const v = i(
32
+ const b = i(
81
33
  ({
82
34
  color: t = "currentColor",
83
35
  size: e = 24,
@@ -91,7 +43,7 @@ const v = i(
91
43
  "svg",
92
44
  {
93
45
  ref: h,
94
- ...k,
46
+ ...m,
95
47
  width: e,
96
48
  height: e,
97
49
  stroke: t,
@@ -113,10 +65,10 @@ const v = i(
113
65
  */
114
66
  const l = (t, e) => {
115
67
  const r = i(
116
- ({ className: o, ...a }, n) => c(v, {
68
+ ({ className: o, ...a }, n) => c(b, {
117
69
  ref: n,
118
70
  iconNode: e,
119
- className: d(`lucide-${b(t)}`, o),
71
+ className: d(`lucide-${g(t)}`, o),
120
72
  ...a
121
73
  })
122
74
  );
@@ -128,7 +80,7 @@ const l = (t, e) => {
128
80
  * This source code is licensed under the ISC license.
129
81
  * See the LICENSE file in the root directory of this source tree.
130
82
  */
131
- const I = l("ChevronDown", [
83
+ const C = l("ChevronDown", [
132
84
  ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
133
85
  ]);
134
86
  /**
@@ -137,13 +89,61 @@ const I = l("ChevronDown", [
137
89
  * This source code is licensed under the ISC license.
138
90
  * See the LICENSE file in the root directory of this source tree.
139
91
  */
140
- const $ = l("X", [
92
+ const I = l("X", [
141
93
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
142
94
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
143
95
  ]);
96
+ class s extends Error {
97
+ }
98
+ s.prototype.name = "InvalidTokenError";
99
+ function k(t) {
100
+ return decodeURIComponent(atob(t).replace(/(.)/g, (e, r) => {
101
+ let o = r.charCodeAt(0).toString(16).toUpperCase();
102
+ return o.length < 2 && (o = "0" + o), "%" + o;
103
+ }));
104
+ }
105
+ function v(t) {
106
+ let e = t.replace(/-/g, "+").replace(/_/g, "/");
107
+ switch (e.length % 4) {
108
+ case 0:
109
+ break;
110
+ case 2:
111
+ e += "==";
112
+ break;
113
+ case 3:
114
+ e += "=";
115
+ break;
116
+ default:
117
+ throw new Error("base64 string is not of the correct length");
118
+ }
119
+ try {
120
+ return k(e);
121
+ } catch {
122
+ return atob(e);
123
+ }
124
+ }
125
+ function $(t, e) {
126
+ if (typeof t != "string")
127
+ throw new s("Invalid token specified: must be a string");
128
+ e || (e = {});
129
+ const r = e.header === !0 ? 0 : 1, o = t.split(".")[r];
130
+ if (typeof o != "string")
131
+ throw new s(`Invalid token specified: missing part #${r + 1}`);
132
+ let a;
133
+ try {
134
+ a = v(o);
135
+ } catch (n) {
136
+ throw new s(`Invalid token specified: invalid base64 for part #${r + 1} (${n.message})`);
137
+ }
138
+ try {
139
+ return JSON.parse(a);
140
+ } catch (n) {
141
+ throw new s(`Invalid token specified: invalid json for part #${r + 1} (${n.message})`);
142
+ }
143
+ }
144
144
  export {
145
- I as C,
146
- $ as X,
145
+ C,
146
+ I as X,
147
147
  l as c,
148
- C as j
148
+ $ as j
149
149
  };
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./x-B6ghREd2.js");/**
1
+ "use strict";const t=require("./index-jSrCwPQz.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import { c as t } from "./x-CXDkqdur.js";
1
+ import { c as t } from "./index-xHCrHprY.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -0,0 +1,354 @@
1
+ import { p as _ } from "./validators-Cz-XuORM.js";
2
+ const u = "higher_is_better", D = {
3
+ displayMode: "difference",
4
+ showComparison: !0,
5
+ indicatorStyle: "arrow_badge",
6
+ showColor: !0,
7
+ conditionalLabel: !1
8
+ };
9
+ function g(e) {
10
+ return _(e) !== null;
11
+ }
12
+ function N(e) {
13
+ var n, o, s;
14
+ if (((n = e.metricComparison) == null ? void 0 : n.mode) !== "off") {
15
+ if (((o = e.metricComparison) == null ? void 0 : o.mode) === "explicit")
16
+ return { source: "explicit", spec: e.metricComparison.spec };
17
+ if (!(e.inheritGlobalComparison === !1 || !e.isGlobalDateApplicable || ((s = e.globalSelection) == null ? void 0 : s.mode) !== "period"))
18
+ return { source: "inherited", spec: e.globalSelection.spec };
19
+ }
20
+ }
21
+ function S(e) {
22
+ if (e.alias) return e.alias;
23
+ const n = e.entityName && e.entityName !== "SEMAPHOR_CALCULATED_FIELD" ? e.entityName : void 0, o = n && n !== e.name ? `${n}_` : "";
24
+ if (e.role !== "metric") return `${o}${e.name}`;
25
+ let s = e.aggregate || "metric";
26
+ if (e.expression) {
27
+ const t = e.expression.match(
28
+ /^(COUNT|SUM|AVG|MIN|MAX|MEDIAN|DISTINCT)\s*\(/i
29
+ );
30
+ s = t ? t[1].toLowerCase() : "expr";
31
+ } else
32
+ s = s.toLowerCase();
33
+ return `${o}${e.name}_${s}`;
34
+ }
35
+ function r(e, n, o) {
36
+ return o ? { code: e, message: n, path: o } : { code: e, message: n };
37
+ }
38
+ function p(e) {
39
+ return !!e && typeof e == "object" && !Array.isArray(e);
40
+ }
41
+ function l(e, n, o, s) {
42
+ Object.keys(e).forEach((t) => {
43
+ n.includes(t) || s.push(
44
+ r(
45
+ "invalid_comparison_spec",
46
+ `Comparison kind does not accept field "${t}".`,
47
+ `${o}.${t}`
48
+ )
49
+ );
50
+ });
51
+ }
52
+ function f(e, n, o) {
53
+ e.alignment !== void 0 && e.alignment !== "calendar" && e.alignment !== "weekday" && o.push(
54
+ r(
55
+ "invalid_comparison_spec",
56
+ 'Comparison alignment must be "calendar" or "weekday".',
57
+ `${n}.alignment`
58
+ )
59
+ ), e.toDate !== void 0 && typeof e.toDate != "boolean" && o.push(
60
+ r(
61
+ "invalid_comparison_spec",
62
+ "Comparison toDate must be a boolean.",
63
+ `${n}.toDate`
64
+ )
65
+ );
66
+ }
67
+ function d(e, n, o) {
68
+ e !== void 0 && (typeof e != "number" || !Number.isSafeInteger(e) || e <= 0) && o.push(
69
+ r(
70
+ "invalid_comparison_spec",
71
+ "Comparison offset must be a positive safe integer.",
72
+ n
73
+ )
74
+ );
75
+ }
76
+ function b(e, n = "comparison") {
77
+ const o = [];
78
+ return p(e) ? (e.kind === "previous_period" ? (l(
79
+ e,
80
+ ["kind", "offsetPeriods", "alignment", "toDate"],
81
+ n,
82
+ o
83
+ ), d(e.offsetPeriods, `${n}.offsetPeriods`, o), f(e, n, o)) : e.kind === "previous_year" ? (l(
84
+ e,
85
+ ["kind", "offsetYears", "alignment", "toDate"],
86
+ n,
87
+ o
88
+ ), d(e.offsetYears, `${n}.offsetYears`, o), f(e, n, o)) : e.kind === "target" ? (l(e, ["kind", "targetValue"], n, o), (typeof e.targetValue != "number" || !Number.isFinite(e.targetValue)) && o.push(
89
+ r(
90
+ "invalid_comparison_spec",
91
+ "Target comparison requires a finite targetValue.",
92
+ `${n}.targetValue`
93
+ )
94
+ )) : o.push(
95
+ r(
96
+ "invalid_comparison_spec",
97
+ "Comparison kind must be previous_period, previous_year, or target.",
98
+ `${n}.kind`
99
+ )
100
+ ), { ok: o.length === 0, errors: o, warnings: [] }) : {
101
+ ok: !1,
102
+ errors: [
103
+ r(
104
+ "invalid_comparison_spec",
105
+ "Comparison spec must be an object.",
106
+ n
107
+ )
108
+ ],
109
+ warnings: []
110
+ };
111
+ }
112
+ function y(e, n = "comparison") {
113
+ if (!p(e))
114
+ return {
115
+ ok: !1,
116
+ errors: [
117
+ r(
118
+ "invalid_comparison_config",
119
+ "Comparison config must be an object.",
120
+ n
121
+ )
122
+ ],
123
+ warnings: []
124
+ };
125
+ const o = [];
126
+ return e.mode === "off" ? l(e, ["mode"], n, o) : e.mode === "explicit" ? (l(e, ["mode", "spec"], n, o), o.push(...b(e.spec, `${n}.spec`).errors)) : o.push(
127
+ r(
128
+ "invalid_comparison_config",
129
+ "Comparison mode must be off or explicit.",
130
+ `${n}.mode`
131
+ )
132
+ ), { ok: o.length === 0, errors: o, warnings: [] };
133
+ }
134
+ function C(e, n = "comparisonSelection") {
135
+ if (!p(e))
136
+ return {
137
+ ok: !1,
138
+ errors: [
139
+ r(
140
+ "invalid_global_date_comparison",
141
+ "Global Date comparison selection must be an object.",
142
+ n
143
+ )
144
+ ],
145
+ warnings: []
146
+ };
147
+ const o = [];
148
+ if (e.mode === "off")
149
+ l(e, ["mode"], n, o);
150
+ else if (e.mode === "period") {
151
+ l(e, ["mode", "spec"], n, o);
152
+ const s = b(e.spec, `${n}.spec`);
153
+ o.push(...s.errors), p(e.spec) && e.spec.kind === "target" && o.push(
154
+ r(
155
+ "invalid_global_date_comparison",
156
+ "Global Date comparison supports previous_period or previous_year, not target.",
157
+ `${n}.spec.kind`
158
+ )
159
+ );
160
+ } else
161
+ o.push(
162
+ r(
163
+ "invalid_global_date_comparison",
164
+ "Global Date comparison mode must be off or period.",
165
+ `${n}.mode`
166
+ )
167
+ );
168
+ return { ok: o.length === 0, errors: o, warnings: [] };
169
+ }
170
+ function I(e, n = "globalDateComparison") {
171
+ if (!p(e))
172
+ return {
173
+ ok: !1,
174
+ errors: [
175
+ r(
176
+ "invalid_global_date_comparison",
177
+ "Global Date comparison context must be an object.",
178
+ n
179
+ )
180
+ ],
181
+ warnings: []
182
+ };
183
+ const o = [];
184
+ return l(
185
+ e,
186
+ ["selection", "inheritGlobalComparison", "referenceTime"],
187
+ n,
188
+ o
189
+ ), o.push(
190
+ ...C(
191
+ e.selection,
192
+ `${n}.selection`
193
+ ).errors
194
+ ), e.inheritGlobalComparison !== void 0 && e.inheritGlobalComparison !== !1 && o.push(
195
+ r(
196
+ "invalid_global_date_comparison",
197
+ "inheritGlobalComparison may only be false when present.",
198
+ `${n}.inheritGlobalComparison`
199
+ )
200
+ ), e.referenceTime !== void 0 && (typeof e.referenceTime != "string" || !g(e.referenceTime)) && o.push(
201
+ r(
202
+ "invalid_global_date_comparison",
203
+ "referenceTime must be a valid ISO date-time string when present.",
204
+ `${n}.referenceTime`
205
+ )
206
+ ), { ok: o.length === 0, errors: o, warnings: [] };
207
+ }
208
+ function M(e, n = "comparisonPolarity") {
209
+ return e === "higher_is_better" || e === "lower_is_better" || e === "neutral" ? { ok: !0, errors: [], warnings: [] } : {
210
+ ok: !1,
211
+ errors: [
212
+ r(
213
+ "invalid_comparison_polarity",
214
+ "Comparison polarity must be higher_is_better, lower_is_better, or neutral.",
215
+ n
216
+ )
217
+ ],
218
+ warnings: []
219
+ };
220
+ }
221
+ function T(e, n = "comparisonPresentation") {
222
+ if (!p(e))
223
+ return {
224
+ ok: !1,
225
+ errors: [
226
+ r(
227
+ "invalid_comparison_presentation",
228
+ "Comparison presentation must be an object.",
229
+ n
230
+ )
231
+ ],
232
+ warnings: []
233
+ };
234
+ const o = [], s = [
235
+ "displayMode",
236
+ "showComparison",
237
+ "precision",
238
+ "indicatorStyle",
239
+ "showColor",
240
+ "position",
241
+ "conditionalLabel",
242
+ "labelName",
243
+ "conditionalLabels",
244
+ "colors"
245
+ ];
246
+ return Object.keys(e).forEach((i) => {
247
+ s.includes(i) || o.push(
248
+ r(
249
+ "invalid_comparison_presentation",
250
+ `Comparison presentation does not accept field "${i}".`,
251
+ `${n}.${i}`
252
+ )
253
+ );
254
+ }), [
255
+ ["displayMode", ["difference", "percent_change", "both", "ratio"]],
256
+ ["indicatorStyle", ["arrow_badge", "arrow", "badge", "none"]],
257
+ ["position", ["left", "right", "top"]]
258
+ ].forEach(([i, a]) => {
259
+ e[i] !== void 0 && !a.includes(e[i]) && o.push(
260
+ r(
261
+ "invalid_comparison_presentation",
262
+ `Comparison presentation ${i} is invalid.`,
263
+ `${n}.${i}`
264
+ )
265
+ );
266
+ }), ["showComparison", "showColor", "conditionalLabel"].forEach((i) => {
267
+ e[i] !== void 0 && typeof e[i] != "boolean" && o.push(
268
+ r(
269
+ "invalid_comparison_presentation",
270
+ `Comparison presentation ${i} must be a boolean.`,
271
+ `${n}.${i}`
272
+ )
273
+ );
274
+ }), e.precision !== void 0 && (typeof e.precision != "number" || !Number.isInteger(e.precision) || e.precision < 0 || e.precision > 6) && o.push(
275
+ r(
276
+ "invalid_comparison_presentation",
277
+ "Comparison presentation precision must be an integer from 0 through 6.",
278
+ `${n}.precision`
279
+ )
280
+ ), e.labelName !== void 0 && typeof e.labelName != "string" && o.push(
281
+ r(
282
+ "invalid_comparison_presentation",
283
+ "Comparison presentation labelName must be a string.",
284
+ `${n}.labelName`
285
+ )
286
+ ), ["conditionalLabels", "colors"].forEach((i) => {
287
+ const a = e[i];
288
+ if (a !== void 0) {
289
+ if (!p(a)) {
290
+ o.push(
291
+ r(
292
+ "invalid_comparison_presentation",
293
+ `Comparison presentation ${i} must be an object.`,
294
+ `${n}.${i}`
295
+ )
296
+ );
297
+ return;
298
+ }
299
+ Object.keys(a).forEach((c) => {
300
+ ["increase", "decrease", "neutral"].includes(c) || o.push(
301
+ r(
302
+ "invalid_comparison_presentation",
303
+ `Comparison presentation ${i} does not accept field "${c}".`,
304
+ `${n}.${i}.${c}`
305
+ )
306
+ );
307
+ }), Object.entries(a).forEach(([c, m]) => {
308
+ m !== void 0 && typeof m != "string" && o.push(
309
+ r(
310
+ "invalid_comparison_presentation",
311
+ `Comparison presentation ${i}.${c} must be a string.`,
312
+ `${n}.${i}.${c}`
313
+ )
314
+ );
315
+ });
316
+ }
317
+ }), { ok: o.length === 0, errors: o, warnings: [] };
318
+ }
319
+ function $(e) {
320
+ return e === null ? "unknown" : e > 0 ? "increase" : e < 0 ? "decrease" : "no_change";
321
+ }
322
+ function h(e, n) {
323
+ return e === "unknown" || e === "no_change" || n === "neutral" ? "neutral" : n === "higher_is_better" && e === "increase" || n === "lower_is_better" && e === "decrease" ? "favorable" : "unfavorable";
324
+ }
325
+ function A(e) {
326
+ const {
327
+ currentValue: n,
328
+ comparisonValue: o,
329
+ polarity: s = u
330
+ } = e, i = n !== null && o !== null ? n - o : null, a = i !== null && o !== null && o !== 0 ? i / Math.abs(o) : null, c = n !== null && o !== null && o !== 0 ? n / o : null, m = $(i);
331
+ return {
332
+ status: o === null ? "insufficient_history" : "available",
333
+ currentValue: n,
334
+ comparisonValue: o,
335
+ delta: i,
336
+ percentChange: a,
337
+ ratio: c,
338
+ direction: m,
339
+ sentiment: h(m, s)
340
+ };
341
+ }
342
+ export {
343
+ D as C,
344
+ u as D,
345
+ S as a,
346
+ I as b,
347
+ C as c,
348
+ y as d,
349
+ A as e,
350
+ M as f,
351
+ b as g,
352
+ N as r,
353
+ T as v
354
+ };
@@ -0,0 +1 @@
1
+ "use strict";const g=require("./validators-B4VMLX3_.js"),u="higher_is_better",C={displayMode:"difference",showComparison:!0,indicatorStyle:"arrow_badge",showColor:!0,conditionalLabel:!1};function $(e){return g.parseSemaphorIsoInstant(e)!==null}function h(e){var i,o,s;if(((i=e.metricComparison)==null?void 0:i.mode)!=="off"){if(((o=e.metricComparison)==null?void 0:o.mode)==="explicit")return{source:"explicit",spec:e.metricComparison.spec};if(!(e.inheritGlobalComparison===!1||!e.isGlobalDateApplicable||((s=e.globalSelection)==null?void 0:s.mode)!=="period"))return{source:"inherited",spec:e.globalSelection.spec}}}function w(e){if(e.alias)return e.alias;const i=e.entityName&&e.entityName!=="SEMAPHOR_CALCULATED_FIELD"?e.entityName:void 0,o=i&&i!==e.name?`${i}_`:"";if(e.role!=="metric")return`${o}${e.name}`;let s=e.aggregate||"metric";if(e.expression){const t=e.expression.match(/^(COUNT|SUM|AVG|MIN|MAX|MEDIAN|DISTINCT)\s*\(/i);s=t?t[1].toLowerCase():"expr"}else s=s.toLowerCase();return`${o}${e.name}_${s}`}function r(e,i,o){return o?{code:e,message:i,path:o}:{code:e,message:i}}function p(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function c(e,i,o,s){Object.keys(e).forEach(t=>{i.includes(t)||s.push(r("invalid_comparison_spec",`Comparison kind does not accept field "${t}".`,`${o}.${t}`))})}function d(e,i,o){e.alignment!==void 0&&e.alignment!=="calendar"&&e.alignment!=="weekday"&&o.push(r("invalid_comparison_spec",'Comparison alignment must be "calendar" or "weekday".',`${i}.alignment`)),e.toDate!==void 0&&typeof e.toDate!="boolean"&&o.push(r("invalid_comparison_spec","Comparison toDate must be a boolean.",`${i}.toDate`))}function _(e,i,o){e!==void 0&&(typeof e!="number"||!Number.isSafeInteger(e)||e<=0)&&o.push(r("invalid_comparison_spec","Comparison offset must be a positive safe integer.",i))}function f(e,i="comparison"){const o=[];return p(e)?(e.kind==="previous_period"?(c(e,["kind","offsetPeriods","alignment","toDate"],i,o),_(e.offsetPeriods,`${i}.offsetPeriods`,o),d(e,i,o)):e.kind==="previous_year"?(c(e,["kind","offsetYears","alignment","toDate"],i,o),_(e.offsetYears,`${i}.offsetYears`,o),d(e,i,o)):e.kind==="target"?(c(e,["kind","targetValue"],i,o),(typeof e.targetValue!="number"||!Number.isFinite(e.targetValue))&&o.push(r("invalid_comparison_spec","Target comparison requires a finite targetValue.",`${i}.targetValue`))):o.push(r("invalid_comparison_spec","Comparison kind must be previous_period, previous_year, or target.",`${i}.kind`)),{ok:o.length===0,errors:o,warnings:[]}):{ok:!1,errors:[r("invalid_comparison_spec","Comparison spec must be an object.",i)],warnings:[]}}function M(e,i="comparison"){if(!p(e))return{ok:!1,errors:[r("invalid_comparison_config","Comparison config must be an object.",i)],warnings:[]};const o=[];return e.mode==="off"?c(e,["mode"],i,o):e.mode==="explicit"?(c(e,["mode","spec"],i,o),o.push(...f(e.spec,`${i}.spec`).errors)):o.push(r("invalid_comparison_config","Comparison mode must be off or explicit.",`${i}.mode`)),{ok:o.length===0,errors:o,warnings:[]}}function b(e,i="comparisonSelection"){if(!p(e))return{ok:!1,errors:[r("invalid_global_date_comparison","Global Date comparison selection must be an object.",i)],warnings:[]};const o=[];if(e.mode==="off")c(e,["mode"],i,o);else if(e.mode==="period"){c(e,["mode","spec"],i,o);const s=f(e.spec,`${i}.spec`);o.push(...s.errors),p(e.spec)&&e.spec.kind==="target"&&o.push(r("invalid_global_date_comparison","Global Date comparison supports previous_period or previous_year, not target.",`${i}.spec.kind`))}else o.push(r("invalid_global_date_comparison","Global Date comparison mode must be off or period.",`${i}.mode`));return{ok:o.length===0,errors:o,warnings:[]}}function S(e,i="globalDateComparison"){if(!p(e))return{ok:!1,errors:[r("invalid_global_date_comparison","Global Date comparison context must be an object.",i)],warnings:[]};const o=[];return c(e,["selection","inheritGlobalComparison","referenceTime"],i,o),o.push(...b(e.selection,`${i}.selection`).errors),e.inheritGlobalComparison!==void 0&&e.inheritGlobalComparison!==!1&&o.push(r("invalid_global_date_comparison","inheritGlobalComparison may only be false when present.",`${i}.inheritGlobalComparison`)),e.referenceTime!==void 0&&(typeof e.referenceTime!="string"||!$(e.referenceTime))&&o.push(r("invalid_global_date_comparison","referenceTime must be a valid ISO date-time string when present.",`${i}.referenceTime`)),{ok:o.length===0,errors:o,warnings:[]}}function v(e,i="comparisonPolarity"){return e==="higher_is_better"||e==="lower_is_better"||e==="neutral"?{ok:!0,errors:[],warnings:[]}:{ok:!1,errors:[r("invalid_comparison_polarity","Comparison polarity must be higher_is_better, lower_is_better, or neutral.",i)],warnings:[]}}function D(e,i="comparisonPresentation"){if(!p(e))return{ok:!1,errors:[r("invalid_comparison_presentation","Comparison presentation must be an object.",i)],warnings:[]};const o=[],s=["displayMode","showComparison","precision","indicatorStyle","showColor","position","conditionalLabel","labelName","conditionalLabels","colors"];return Object.keys(e).forEach(n=>{s.includes(n)||o.push(r("invalid_comparison_presentation",`Comparison presentation does not accept field "${n}".`,`${i}.${n}`))}),[["displayMode",["difference","percent_change","both","ratio"]],["indicatorStyle",["arrow_badge","arrow","badge","none"]],["position",["left","right","top"]]].forEach(([n,a])=>{e[n]!==void 0&&!a.includes(e[n])&&o.push(r("invalid_comparison_presentation",`Comparison presentation ${n} is invalid.`,`${i}.${n}`))}),["showComparison","showColor","conditionalLabel"].forEach(n=>{e[n]!==void 0&&typeof e[n]!="boolean"&&o.push(r("invalid_comparison_presentation",`Comparison presentation ${n} must be a boolean.`,`${i}.${n}`))}),e.precision!==void 0&&(typeof e.precision!="number"||!Number.isInteger(e.precision)||e.precision<0||e.precision>6)&&o.push(r("invalid_comparison_presentation","Comparison presentation precision must be an integer from 0 through 6.",`${i}.precision`)),e.labelName!==void 0&&typeof e.labelName!="string"&&o.push(r("invalid_comparison_presentation","Comparison presentation labelName must be a string.",`${i}.labelName`)),["conditionalLabels","colors"].forEach(n=>{const a=e[n];if(a!==void 0){if(!p(a)){o.push(r("invalid_comparison_presentation",`Comparison presentation ${n} must be an object.`,`${i}.${n}`));return}Object.keys(a).forEach(l=>{["increase","decrease","neutral"].includes(l)||o.push(r("invalid_comparison_presentation",`Comparison presentation ${n} does not accept field "${l}".`,`${i}.${n}.${l}`))}),Object.entries(a).forEach(([l,m])=>{m!==void 0&&typeof m!="string"&&o.push(r("invalid_comparison_presentation",`Comparison presentation ${n}.${l} must be a string.`,`${i}.${n}.${l}`))})}}),{ok:o.length===0,errors:o,warnings:[]}}function A(e){return e===null?"unknown":e>0?"increase":e<0?"decrease":"no_change"}function N(e,i){return e==="unknown"||e==="no_change"||i==="neutral"?"neutral":i==="higher_is_better"&&e==="increase"||i==="lower_is_better"&&e==="decrease"?"favorable":"unfavorable"}function T(e){const{currentValue:i,comparisonValue:o,polarity:s=u}=e,n=i!==null&&o!==null?i-o:null,a=n!==null&&o!==null&&o!==0?n/Math.abs(o):null,l=i!==null&&o!==null&&o!==0?i/o:null,m=A(n);return{status:o===null?"insufficient_history":"available",currentValue:i,comparisonValue:o,delta:n,percentChange:a,ratio:l,direction:m,sentiment:N(m,s)}}exports.COMPARISON_PRESENTATION_DEFAULTS=C;exports.DEFAULT_METRIC_COMPARISON_POLARITY=u;exports.evaluateMetricComparison=T;exports.resolveMetricComparisonRequest=h;exports.resolveMetricResultAlias=w;exports.validateComparisonPresentationSpec=D;exports.validateGlobalDateComparisonContext=S;exports.validateGlobalDateComparisonSelection=b;exports.validateMetricComparisonConfig=M;exports.validateMetricComparisonPolarity=v;exports.validateMetricComparisonSpec=f;
@@ -1,4 +1,4 @@
1
- "use strict";const c=require("./x-B6ghREd2.js");/**
1
+ "use strict";const c=require("./index-jSrCwPQz.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import { c } from "./x-CXDkqdur.js";
1
+ import { c } from "./index-xHCrHprY.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import { c as a } from "./x-CXDkqdur.js";
1
+ import { c as a } from "./index-xHCrHprY.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./x-B6ghREd2.js");/**
1
+ "use strict";const a=require("./index-jSrCwPQz.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import { c as e } from "./x-CXDkqdur.js";
1
+ import { c as e } from "./index-xHCrHprY.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./x-B6ghREd2.js");/**
1
+ "use strict";const e=require("./index-jSrCwPQz.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.