react-semaphor 0.1.474 → 0.1.475
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/briefings/index.js +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-BjCkA5vw.cjs → dashboard-briefing-launcher-B6tm7M3_.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-B0f28WrK.js → dashboard-briefing-launcher-BZOpMkdj.js} +4 -4
- package/dist/chunks/{dashboard-controls-CMJqSLgo.js → dashboard-controls-CHn88-1Q.js} +4 -4
- package/dist/chunks/{dashboard-controls-BRclCQEX.cjs → dashboard-controls-CyoY0IC_.cjs} +1 -1
- package/dist/chunks/{dashboard-json-DmtGHdDq.cjs → dashboard-json-BOsyKwip.cjs} +1 -1
- package/dist/chunks/{dashboard-json-1ohpjO_q.js → dashboard-json-Dh3UKm8Y.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-D9oKtOo6.js → edit-dashboard-visual-BCz0oRoM.js} +3 -3
- package/dist/chunks/{edit-dashboard-visual-DNqJHdHE.cjs → edit-dashboard-visual-DK--eIEf.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-DwI3FcSw.cjs → editor-action-buttons-D7JDG5pX.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-C_B8Wzkf.js → editor-action-buttons-Dp-j9gS6.js} +2 -2
- package/dist/chunks/{index-DsvIlrI-.js → index-DodDy3sE.js} +4 -4
- package/dist/chunks/{index-B6zSYUN4.cjs → index-DpbiVs0_.cjs} +222 -222
- package/dist/chunks/{index-DalKzjEZ.js → index-Dw2nLjUn.js} +28439 -28113
- package/dist/chunks/{pivot-header-presentation-Be3FyR0N.js → pivot-header-presentation-BBiJU_57.js} +143 -127
- package/dist/chunks/pivot-header-presentation-BMyOXlXL.cjs +4 -0
- package/dist/chunks/{report-preferences-dialog-DGMd-eTT.cjs → report-preferences-dialog-B9JUV3Gr.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-C9mJffNQ.js → report-preferences-dialog-Di8MmnqB.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +1 -1
- package/dist/format-utils/index.cjs +3 -3
- package/dist/format-utils/index.js +89 -80
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/pdf-export-policy/index.cjs +1 -0
- package/dist/pdf-export-policy/index.js +32 -0
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/format-utils.d.ts +39 -0
- package/dist/types/pdf-export-policy.d.ts +28 -0
- package/package.json +6 -1
- package/dist/chunks/pivot-header-presentation-Cr6pU5JL.cjs +0 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const t = Object.freeze({
|
|
2
|
+
maxRows: 5e3,
|
|
3
|
+
maxRequestBytes: 2621440,
|
|
4
|
+
// 2.5 MiB
|
|
5
|
+
maxPages: 100,
|
|
6
|
+
maxOutputBytes: 52428800
|
|
7
|
+
// 50 MiB
|
|
8
|
+
}), s = "PDF_SAFETY_LIMIT_EXCEEDED";
|
|
9
|
+
function i(e) {
|
|
10
|
+
return new TextEncoder().encode(e).byteLength;
|
|
11
|
+
}
|
|
12
|
+
function u(e) {
|
|
13
|
+
return Number.isInteger(e) && e > 0 && e <= t.maxRows;
|
|
14
|
+
}
|
|
15
|
+
function n(e) {
|
|
16
|
+
return Number.isInteger(e) && e >= 0 && e <= t.maxRequestBytes;
|
|
17
|
+
}
|
|
18
|
+
function r(e) {
|
|
19
|
+
return Number.isInteger(e) && e > 0 && e <= t.maxPages;
|
|
20
|
+
}
|
|
21
|
+
function E(e) {
|
|
22
|
+
return Number.isInteger(e) && e > 0 && e <= t.maxOutputBytes;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
t as FAST_PDF_POLICY,
|
|
26
|
+
s as PDF_SAFETY_LIMIT_EXCEEDED,
|
|
27
|
+
i as getUtf8ByteLength,
|
|
28
|
+
E as isFastPdfOutputSizeEligible,
|
|
29
|
+
r as isFastPdfPageCountEligible,
|
|
30
|
+
n as isFastPdfRequestSizeEligible,
|
|
31
|
+
u as isFastPdfRowCountEligible
|
|
32
|
+
};
|
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DpbiVs0_.cjs"),r=require("../chunks/common-types-C1IM7gao.cjs"),o=require("../chunks/report-preferences-dialog-B9JUV3Gr.cjs");exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.Surfboard=e.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=r.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;exports.ReportPreferencesDialog=o.ReportPreferencesDialog;
|
package/dist/surfboard/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as a, a as o } from "../chunks/index-
|
|
1
|
+
import { b as a, a as o } from "../chunks/index-Dw2nLjUn.js";
|
|
2
2
|
import { C as f, E } from "../chunks/common-types-BLPy5_E0.js";
|
|
3
|
-
import { R as t } from "../chunks/report-preferences-dialog-
|
|
3
|
+
import { R as t } from "../chunks/report-preferences-dialog-Di8MmnqB.js";
|
|
4
4
|
export {
|
|
5
5
|
f as CONTROL_CARD_DEFAULT_VALUE,
|
|
6
6
|
a as DisplayFormatPreferencesFields,
|
|
@@ -297,6 +297,20 @@ export declare interface ExportFormattingConfig {
|
|
|
297
297
|
visibleColumns: string[];
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
/**
|
|
301
|
+
* Shared structured Fast PDF routing and safety policy.
|
|
302
|
+
*
|
|
303
|
+
* These values are product policy, not deployment configuration. Keep this
|
|
304
|
+
* module React-free so browser, app, and renderer adapters can enforce the
|
|
305
|
+
* same limits at their trust boundaries.
|
|
306
|
+
*/
|
|
307
|
+
export declare const FAST_PDF_POLICY: Readonly<{
|
|
308
|
+
maxRows: 5000;
|
|
309
|
+
maxRequestBytes: 2621440;
|
|
310
|
+
maxPages: 100;
|
|
311
|
+
maxOutputBytes: 52428800;
|
|
312
|
+
}>;
|
|
313
|
+
|
|
300
314
|
export declare function findResolvedNumericFormat(input: {
|
|
301
315
|
snapshot: PresentationExecutionSnapshot;
|
|
302
316
|
scope: PresentationScope;
|
|
@@ -533,6 +547,9 @@ export declare function getTimezoneAbbreviation(timezone: string, date?: Date):
|
|
|
533
547
|
*/
|
|
534
548
|
export declare function getTimezoneName(timezone: string): string;
|
|
535
549
|
|
|
550
|
+
/** Exact UTF-8 bytes used by the structured POST body. */
|
|
551
|
+
export declare function getUtf8ByteLength(value: string): number;
|
|
552
|
+
|
|
536
553
|
export declare interface GroupByField {
|
|
537
554
|
name: string;
|
|
538
555
|
alias: string;
|
|
@@ -547,6 +564,14 @@ declare type IdentifiedMetricField = IdentifiedField & MetricResultAliasInput;
|
|
|
547
564
|
|
|
548
565
|
export declare function isAggregateTotalMemberMarker(value: unknown): value is typeof AGGREGATE_TOTAL_MEMBER_MARKER;
|
|
549
566
|
|
|
567
|
+
export declare function isFastPdfOutputSizeEligible(byteLength: number): boolean;
|
|
568
|
+
|
|
569
|
+
export declare function isFastPdfPageCountEligible(pageCount: number): boolean;
|
|
570
|
+
|
|
571
|
+
export declare function isFastPdfRequestSizeEligible(byteLength: number): boolean;
|
|
572
|
+
|
|
573
|
+
export declare function isFastPdfRowCountEligible(rowCount: number): boolean;
|
|
574
|
+
|
|
550
575
|
export declare function isNumericCanonicalFormat(format: unknown): format is NumericCanonicalFormat;
|
|
551
576
|
|
|
552
577
|
export declare function isPivotEmptyTupleAllowed(input: {
|
|
@@ -723,6 +748,8 @@ export declare function parseTemporalBucketValue(value: TemporalBucketValue, met
|
|
|
723
748
|
*/
|
|
724
749
|
export declare function parseWithSourceTimezone(dateString: string, sourceTimezone?: string): Date;
|
|
725
750
|
|
|
751
|
+
export declare const PDF_SAFETY_LIMIT_EXCEEDED: "PDF_SAFETY_LIMIT_EXCEEDED";
|
|
752
|
+
|
|
726
753
|
export declare interface PivotByColumn {
|
|
727
754
|
name: string;
|
|
728
755
|
alias: string;
|
|
@@ -1304,6 +1331,18 @@ declare type SemaphorSourceRef = {
|
|
|
1304
1331
|
|
|
1305
1332
|
declare type SemaphorTimeGrain = (typeof SEMAPHOR_TIME_GRAINS)[number];
|
|
1306
1333
|
|
|
1334
|
+
/**
|
|
1335
|
+
* Returns whether an aggregate group value starts a new visible group at its
|
|
1336
|
+
* hierarchy level. A nested value repeats only when its complete parent prefix
|
|
1337
|
+
* also repeats. Subtotals and grand totals are presentation boundaries.
|
|
1338
|
+
*/
|
|
1339
|
+
export declare function shouldPresentAggregateGroupValue(input: {
|
|
1340
|
+
row: Record<string, unknown>;
|
|
1341
|
+
previousRow?: Record<string, unknown>;
|
|
1342
|
+
context: AggregateTablePresentationContext;
|
|
1343
|
+
columnKey: string;
|
|
1344
|
+
}): boolean;
|
|
1345
|
+
|
|
1307
1346
|
export declare type SqlTemporalColumnClassification = {
|
|
1308
1347
|
status: 'empty';
|
|
1309
1348
|
} | {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared structured Fast PDF routing and safety policy.
|
|
3
|
+
*
|
|
4
|
+
* These values are product policy, not deployment configuration. Keep this
|
|
5
|
+
* module React-free so browser, app, and renderer adapters can enforce the
|
|
6
|
+
* same limits at their trust boundaries.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FAST_PDF_POLICY: Readonly<{
|
|
9
|
+
maxRows: 5000;
|
|
10
|
+
maxRequestBytes: 2621440;
|
|
11
|
+
maxPages: 100;
|
|
12
|
+
maxOutputBytes: 52428800;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
/** Exact UTF-8 bytes used by the structured POST body. */
|
|
16
|
+
export declare function getUtf8ByteLength(value: string): number;
|
|
17
|
+
|
|
18
|
+
export declare function isFastPdfOutputSizeEligible(byteLength: number): boolean;
|
|
19
|
+
|
|
20
|
+
export declare function isFastPdfPageCountEligible(pageCount: number): boolean;
|
|
21
|
+
|
|
22
|
+
export declare function isFastPdfRequestSizeEligible(byteLength: number): boolean;
|
|
23
|
+
|
|
24
|
+
export declare function isFastPdfRowCountEligible(rowCount: number): boolean;
|
|
25
|
+
|
|
26
|
+
export declare const PDF_SAFETY_LIMIT_EXCEEDED: "PDF_SAFETY_LIMIT_EXCEEDED";
|
|
27
|
+
|
|
28
|
+
export { }
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "support@semaphor.cloud"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.475",
|
|
9
9
|
"description": "Fully interactive and customizable dashboards for your apps.",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"react",
|
|
@@ -127,6 +127,11 @@
|
|
|
127
127
|
"import": "./dist/format-utils/index.js",
|
|
128
128
|
"require": "./dist/format-utils/index.cjs"
|
|
129
129
|
},
|
|
130
|
+
"./format-utils/pdf-export-policy": {
|
|
131
|
+
"types": "./dist/types/pdf-export-policy.d.ts",
|
|
132
|
+
"import": "./dist/pdf-export-policy/index.js",
|
|
133
|
+
"require": "./dist/pdf-export-policy/index.cjs"
|
|
134
|
+
},
|
|
130
135
|
"./value-format-preferences": {
|
|
131
136
|
"types": "./dist/types/value-format-preferences.d.ts",
|
|
132
137
|
"import": "./dist/value-format-preferences/index.js",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";var Z=Object.defineProperty;var G=(e,t,n)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var x=(e,t,n)=>G(e,typeof t!="symbol"?t+"":t,n);const l=require("./format-types-PSZZ7hG8.cjs"),M=require("./pivot-result-lifecycle-DJgO2P0H.cjs"),B=require("./index-F25jnH0p.cjs"),j=require("./temporal-bucket-9Wz9Ds6H.cjs");function y(e,t){const n=l.toDate(e),o=l.toDate(t),r=n.getTime()-o.getTime();return r<0?-1:r>0?1:r}function H(e){return l.constructFrom(e,Date.now())}function Y(e,t){const n=l.toDate(e),o=l.toDate(t),r=n.getFullYear()-o.getFullYear(),a=n.getMonth()-o.getMonth();return r*12+a}function W(e){return t=>{const o=(e?Math[e]:Math.trunc)(t);return o===0?0:o}}function q(e,t){return+l.toDate(e)-+l.toDate(t)}function K(e){const t=l.toDate(e);return t.setHours(23,59,59,999),t}function J(e){const t=l.toDate(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Q(e){const t=l.toDate(e);return+K(t)==+J(t)}function z(e,t){const n=l.toDate(e),o=l.toDate(t),r=y(n,o),a=Math.abs(Y(n,o));let i;if(a<1)i=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*a);let s=y(n,o)===-r;Q(l.toDate(e))&&a===1&&y(e,o)===1&&(s=!1),i=r*(a-Number(s))}return i===0?0:i}function ee(e,t,n){const o=q(e,t)/1e3;return W(n==null?void 0:n.roundingMethod)(o)}function te(e,t,n){const o=l.getDefaultOptions(),r=(n==null?void 0:n.locale)??o.locale??l.enUS,a=2520,i=y(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const s=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:i});let c,u;i>0?(c=l.toDate(t),u=l.toDate(e)):(c=l.toDate(e),u=l.toDate(t));const g=ee(u,c),m=(l.getTimezoneOffsetInMilliseconds(u)-l.getTimezoneOffsetInMilliseconds(c))/1e3,f=Math.round((g-m)/60);let h;if(f<2)return n!=null&&n.includeSeconds?g<5?r.formatDistance("lessThanXSeconds",5,s):g<10?r.formatDistance("lessThanXSeconds",10,s):g<20?r.formatDistance("lessThanXSeconds",20,s):g<40?r.formatDistance("halfAMinute",0,s):g<60?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",1,s):f===0?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",f,s);if(f<45)return r.formatDistance("xMinutes",f,s);if(f<90)return r.formatDistance("aboutXHours",1,s);if(f<l.minutesInDay){const d=Math.round(f/60);return r.formatDistance("aboutXHours",d,s)}else{if(f<a)return r.formatDistance("xDays",1,s);if(f<l.minutesInMonth){const d=Math.round(f/l.minutesInDay);return r.formatDistance("xDays",d,s)}else if(f<l.minutesInMonth*2)return h=Math.round(f/l.minutesInMonth),r.formatDistance("aboutXMonths",h,s)}if(h=z(u,c),h<12){const d=Math.round(f/l.minutesInMonth);return r.formatDistance("xMonths",d,s)}else{const d=h%12,T=Math.trunc(h/12);return d<3?r.formatDistance("aboutXYears",T,s):d<9?r.formatDistance("overXYears",T,s):r.formatDistance("almostXYears",T+1,s)}}function v(e,t){return te(e,H(e),t)}const E=["day","hour","minute","second","millisecond"],L={day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},ne={day:"d",hour:"hr",minute:"min",second:"s",millisecond:"ms"},re={day:["day","days"],hour:["hour","hours"],minute:["minute","minutes"],second:["second","seconds"],millisecond:["millisecond","milliseconds"]};function oe(e){return e==="day"||e==="hour"||e==="minute"||e==="second"||e==="millisecond"}function R(e,t){return oe(e)?e:t}function S(e,t){return E.indexOf(R(e,t))}function ae(e,t){const n=S(e,"day"),o=S(t,"second"),r=Math.min(n,o),a=Math.max(n,o);return E.slice(r,a+1)}function se(e,t){return e*L[R(t,"second")]}function ie(e,t){const n=ae(t.largestUnit,t.smallestUnit),o=n[n.length-1],r=L[o];let a=Math.round(e/r)*r;return n.map(i=>{const s=L[i],c=Math.floor(a/s);return a-=c*s,{unit:i,value:c}})}function ce(e,t){const n=e.filter(a=>a.value!==0),o=n.length>0?n:[e[e.length-1]],r=typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.trunc(t)):o.length;return o.slice(0,r).map(a=>`${a.value}${ne[a.unit]}`).join(" ")}function le(e,t){const n=e.filter(a=>a.value!==0),o=n.length>0?n:[e[e.length-1]],r=typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.trunc(t)):o.length;return o.slice(0,r).map(a=>{const[i,s]=re[a.unit];return`${a.value} ${a.value===1?i:s}`}).join(" ")}function ue(e){const t=e.some(c=>c.unit==="day"&&c.value!==0),n=e.some(c=>c.unit==="millisecond"),o=e.findIndex(c=>c.value!==0),r=Math.max(0,e.length-2),a=t?0:o===-1?r:Math.min(o,r),i=o===-1?e.slice(r):e.slice(a);if(i.length===0)return"0";const s=i.map((c,u)=>c.unit==="millisecond"?String(c.value).padStart(3,"0"):u===0?String(c.value):String(c.value).padStart(2,"0")).join(":");return n?s.replace(/:(\d{3})$/,".$1"):s}function fe(e,t,n){const o=`${n.prefix||""}${e}${n.suffix||""}`;return t?n.negativeInParentheses?`(${o})`:`-${o}`:o}function V(e,t={}){if(e==null)return"";const n=typeof e=="number"?e:typeof e=="string"&&e.trim()?Number(e):NaN;if(!Number.isFinite(n))return"";const o=t.inputUnit||"second",r=t.outputStyle==="digital"||t.outputStyle==="long"?t.outputStyle:"compact",a=n<0,i=Math.abs(se(n,o)),s=ie(i,t),c=r==="digital"?ue(s):r==="long"?le(s,t.maxUnits):ce(s,t.maxUnits);return fe(c,a,t)}function me(e,t,n){const o={...t,locale:t.locale??n};if(o.type==="number")return M.formatNumericCanonical(e,o);const{prefix:r,suffix:a,...i}=o;return`${r??""}${M.formatNumericCanonical(e,{...i,negativeStyle:o.type==="currency"?o.negativeStyle:"minus"})}${a??""}`}function w(e,t,n){return e===null?{value:e,text:null}:!t||!l.isNumericCanonicalFormat(t)&&t.type!=="duration"?{value:e,text:M.formatNumericCanonical(e,{type:"number",locale:n})}:t.type==="duration"?{value:e,text:V(e,{inputUnit:t.inputUnit,outputStyle:t.outputStyle,largestUnit:t.largestUnit,smallestUnit:t.smallestUnit,maxUnits:t.maxUnits,prefix:t.prefix,suffix:t.suffix,negativeInParentheses:t.negativeStyle==="parentheses"})}:{value:e,text:me(e,t,n)}}function C(e,t,n,o){return e===null?{value:e,text:null}:o==="percent"?{value:e,text:M.formatNumericCanonical(e,{type:"percent",locale:n,minimumFractionDigits:t,maximumFractionDigits:t,percentValueMode:"fraction"})}:{value:e,text:M.formatNumericCanonical(e,{type:"number",locale:n,minimumFractionDigits:t,maximumFractionDigits:t,suffix:"×"})}}function _(e,t){if(e===void 0)return t;if(!Number.isInteger(e)||e<0||e>6)throw new RangeError("Comparison precision must be an integer from 0 to 6.");return e}function ge(e,t){const n={mode:t.displayMode,current:w(e.currentValue,t.metricFormat,t.locale),comparison:w(e.comparisonValue,t.metricFormat,t.locale)};return(t.displayMode==="difference"||t.displayMode==="both")&&(n.difference=w(e.delta,t.metricFormat,t.locale)),(t.displayMode==="percent_change"||t.displayMode==="both")&&(n.percentChange=C(e.percentChange,_(t.precision,1),t.locale,"percent")),t.displayMode==="ratio"&&(n.ratio=C(e.ratio,_(t.precision,2),t.locale,"ratio")),n}function de(e,t){return e&&e!=="auto"?e:t}function he(e,t=new Date){try{const n={timeZone:e,timeZoneName:"short"},r=new Intl.DateTimeFormat("en-US",n).formatToParts(t).find(a=>a.type==="timeZoneName");return(r==null?void 0:r.value)||e}catch{return e}}function Me(e){try{const t={timeZone:e,timeZoneName:"long"},o=new Intl.DateTimeFormat("en-US",t).formatToParts(new Date).find(r=>r.type==="timeZoneName");return(o==null?void 0:o.value)||e}catch{return e}}function p(e,t="auto"){if(!e)return new Date(NaN);const n=e.endsWith("Z"),o=/[+-]\d{2}:?\d{2}$/.test(e),r=/\([A-Z]{3,4}\)$/.test(e);if(t==="auto")return n||o||r?new Date(e):new Date(e+"Z");if(t==="local"){if(n||o){const a=e.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(a)}return new Date(e)}else return t==="UTC"?n?new Date(e):o?new Date(e):new Date(e+"Z"):n||o||r?new Date(e):B.fromZonedTime(e,t)}const ye="MM/dd/yyyy",De=(e,t,n,o="auto")=>{if(!e)return"";try{const r=p(e,o);if(isNaN(r.getTime()))return e;const i=(t&&t.trim()?t:ye).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return n&&n!=="auto"?l.formatInTimeZone(r,n,i):l.format(r,i)}catch(r){return console.error("Date formatting error:",r),e}},be=(e,t="auto")=>{if(!e)return"";try{const n=p(e,t);return isNaN(n.getTime())?e:v(n,{addSuffix:!0})}catch(n){return console.error("Relative time formatting error:",n),e}};function I(e,t=","){if(e==null)return"";const n=String(e);return n.includes(t)||n.includes('"')||n.includes(`
|
|
2
|
-
`)||n.includes("\r")?`"${n.replace(/"/g,'""')}"`:n}function N(e,t=","){return e.map(n=>I(n,t)).join(t)}function O(e,t={}){const{delimiter:n=",",lineEnding:o=`
|
|
3
|
-
`}=t;return e.map(r=>N(r,n)).join(o)}function Te(e,t={}){if(e.length===0)return"";const{delimiter:n=",",lineEnding:o=`
|
|
4
|
-
`,includeHeaders:r=!0,columns:a}=t,i=a||Object.keys(e[0]),s=[];r&&s.push(i);for(const c of e){const u=i.map(g=>{const m=c[g];return m==null?"":String(m)});s.push(u)}return O(s,{delimiter:n,lineEnding:o})}const $=1e4,we=1e6;function Le(e){return e>$}const P="__TOTAL__";function D(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function b(e){return e===P}function pe(e){const t=new Map,n=(e.groupByColumns??[]).map((r,a)=>{var u,g,m;if(!D(r))throw new Error(`Aggregate groupByColumns[${a}] is invalid`);const i=typeof r.id=="string"&&r.id.length>0?r.id:void 0,s=i?(m=(g=(u=e.columnKeyMap)==null?void 0:u.byRole)==null?void 0:g.groupby)==null?void 0:m[i]:void 0,c=(s==null?void 0:s.outputKey)||(s==null?void 0:s.rawKey)||(typeof r.alias=="string"&&r.alias.length>0?r.alias:typeof r.name=="string"&&r.name.length>0?r.name:void 0);if(!c)throw new Error(`Aggregate groupByColumns[${a}] has no output key`);return[i,r.alias,r.name,c].forEach(f=>{typeof f=="string"&&f.length>0&&t.set(f,c)}),c}),o=(e.rowAggregates??[]).flatMap(r=>!D(r)||typeof r.function!="string"||typeof r.groupLevel!="string"?[]:[{function:r.function,groupLevel:r.groupLevel==="ALL"?"ALL":t.get(r.groupLevel)||r.groupLevel,...typeof r.label=="string"?{label:r.label}:{}}]);return{groupColumnKeys:n,rowAggregates:o}}function F(e){return e==="SUM"?"Total":e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function U(e){var n;if(e.customLabel)return e.customLabel;const t=F(e.aggregateFunction);if(e.levelValue!==void 0&&!b(e.levelValue)){if(e.levelValue===null){const r=(n=e.formatValue)==null?void 0:n.call(e,null);return r?`Subtotal ${r}`:`Subtotal ${t}`}const o=e.formatValue?e.formatValue(e.levelValue):String(e.levelValue);if(o)return`Subtotal (${o})`}return`Subtotal ${t}`}function k(e,t){return t||`Grand ${F(e)}`}function A(e){var o,r;const t=e.context.groupColumnKeys,n=typeof e.row.aggregate=="string"?e.row.aggregate:"SUM";if(e.row.isGrandTotal===!0){const a=(o=e.context.rowAggregates.find(i=>i.groupLevel==="ALL"))==null?void 0:o.label;return{kind:"grand-total",cells:t.map((i,s)=>({columnKey:i,text:s===0?k(n,a):"",placement:s===0?"label":"empty",colSpan:s===0?t.length:1}))}}if(e.row.isSubtotal===!0){if(typeof e.row.subtotalLevel!="string")throw new Error("Aggregate subtotal row is missing subtotalLevel");const a=t.indexOf(e.row.subtotalLevel);if(a<0)throw new Error(`Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`);const i=D(e.row.subtotalContext)?e.row.subtotalContext:void 0,s=D(i==null?void 0:i.groupByValues)?i.groupByValues:{},c=(r=e.context.rowAggregates.find(u=>u.groupLevel===e.row.subtotalLevel&&u.function===n))==null?void 0:r.label;return{kind:"subtotal",cells:t.map((u,g)=>{if(g>a)return{columnKey:u,text:"",placement:"empty",colSpan:1};if(g<a){const m=e.row[u];return{columnKey:u,text:m===void 0||b(m)?"":e.formatValue(m,u),placement:"value",colSpan:1}}return{columnKey:u,text:U({aggregateFunction:n,customLabel:c,levelValue:s[u],formatValue:m=>e.formatLabelValue?e.formatLabelValue(m,u):String(e.formatValue(m,u)??"")}),placement:"label",colSpan:t.length-a}})}}return{kind:"data",cells:t.map(a=>{const i=e.row[a];return{columnKey:a,text:i===void 0||b(i)?"":e.formatValue(i,a),placement:"value",colSpan:1}})}}function Ae(e){const t=A(e).cells.find(n=>n.columnKey===e.columnKey);if(!t)throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);return t.text}function xe(e){return A(e).cells.map(t=>t.text)}class X extends Error{constructor(n,o){super(`${n}: ${o}`);x(this,"deliveryBlocking",!0);this.code=n,this.name="PivotHeaderPresentationError"}}function Se(e){var r;const t=e.mode??"formatted",n=e.members.map(a=>{var s;if(t==="canonical"||!a.temporalBucket)return a.value===null?"":String(a.value);const i=(s=e.resolveTemporalFormat)==null?void 0:s.call(e,a.fieldId);if(!i)throw new X("missing_resolved_temporal_format",`Missing resolved temporal presentation for pivot field "${a.fieldId}"`);return j.formatTemporalBucket({value:a.value,metadata:a.temporalBucket,format:i})}),o=((r=e.metricLabel)==null?void 0:r.trim())||void 0;return{memberLabels:n,...o?{metricLabel:o}:{},flattenedLabel:[...n,...o?[o]:[]].join(" / ")}}exports.AGGREGATE_TOTAL_MEMBER_MARKER=P;exports.DIRECT_CSV_EXPORT_MAX_ROWS=$;exports.FULL_DATASET_CSV_EXPORT_MAX_ROWS=we;exports.PivotHeaderPresentationError=X;exports.arrayToCSV=O;exports.arrayToCSVRow=N;exports.escapeCSVValue=I;exports.formatAggregateGrandTotalLabel=k;exports.formatAggregateGroupCell=Ae;exports.formatAggregateGroupRow=xe;exports.formatAggregateSubtotalLabel=U;exports.formatDate=De;exports.formatDistanceToNow=v;exports.formatDuration=V;exports.formatMetricComparison=ge;exports.formatRelativeTime=be;exports.getTimezoneAbbreviation=he;exports.getTimezoneName=Me;exports.isAggregateTotalMemberMarker=b;exports.objectsToCSV=Te;exports.parseWithSourceTimezone=p;exports.presentAggregateGroupRow=A;exports.presentPivotHeader=Se;exports.requiresChunkedCsvExport=Le;exports.resolveAggregateTablePresentationContext=pe;exports.resolveTimezone=de;
|