react-semaphor 0.1.516 → 0.1.518

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 (77) hide show
  1. package/dist/brand-studio/index.cjs +1 -1
  2. package/dist/brand-studio/index.js +2 -2
  3. package/dist/briefings/index.cjs +1 -1
  4. package/dist/briefings/index.js +3 -3
  5. package/dist/chunks/{calculated-field-identity-DzJBs2J8.js → calculated-field-identity-Dy_WpDdo.js} +1 -1
  6. package/dist/chunks/{card-config-utils-Cxnq2R6z.js → card-config-utils-CAyjC5Tp.js} +2 -2
  7. package/dist/chunks/{dashboard-briefing-launcher-BCEHJ_eD.js → dashboard-briefing-launcher-D5HGRwtb.js} +7 -7
  8. package/dist/chunks/{dashboard-briefing-launcher-CjZ4aE34.cjs → dashboard-briefing-launcher-RpT4b0d5.cjs} +1 -1
  9. package/dist/chunks/{dashboard-controls-DFfit5KH.js → dashboard-controls-C0Aw74JP.js} +9 -9
  10. package/dist/chunks/{dashboard-controls-f9aJ70Zu.cjs → dashboard-controls-DidqEx0U.cjs} +1 -1
  11. package/dist/chunks/{dashboard-json-DVtcA02f.js → dashboard-json-B5LLO49G.js} +5 -5
  12. package/dist/chunks/{dashboard-json-deqQC-UR.cjs → dashboard-json-rY4lTftA.cjs} +1 -1
  13. package/dist/chunks/{edit-dashboard-visual-lJ6rDH3w.js → edit-dashboard-visual-D3TrgFMg.js} +364 -361
  14. package/dist/chunks/{edit-dashboard-visual-DK6lSC_p.cjs → edit-dashboard-visual-NABO8NBr.cjs} +3 -3
  15. package/dist/chunks/{editor-action-buttons-Bnxxa439.js → editor-action-buttons-BfWg6DdZ.js} +4 -4
  16. package/dist/chunks/{editor-action-buttons-CmDaQbPN.cjs → editor-action-buttons-xQ5aj-0q.cjs} +1 -1
  17. package/dist/chunks/{field-aggregations-Dl2A3rbV.js → field-aggregations-BQjogiI1.js} +1 -1
  18. package/dist/chunks/{index-ylOpKRDu.js → index-B0KwXM6P.js} +117 -116
  19. package/dist/chunks/index-CapO5Uw9.cjs +4 -0
  20. package/dist/chunks/{index-UNKSfi7s.cjs → index-Dgv9vzT0.cjs} +230 -230
  21. package/dist/chunks/{index-BVVl2JDK.js → index-DqTelnri.js} +27499 -27198
  22. package/dist/chunks/{matrix-control-sources-KbZe1gj_.js → matrix-control-sources-B1K7x0SL.js} +2 -2
  23. package/dist/chunks/matrix-formatter-Qk8xsR05.cjs +1 -0
  24. package/dist/chunks/{matrix-formatter-CCXNRt3s.js → matrix-formatter-WBgtebUT.js} +8 -8
  25. package/dist/chunks/numeric-presentation-VhMUHfrJ.js +537 -0
  26. package/dist/chunks/numeric-presentation-mY6wJMdB.cjs +1 -0
  27. package/dist/chunks/{pivot-header-presentation-BSZhB1g-.js → pivot-header-presentation-CGtudHo7.js} +4 -4
  28. package/dist/chunks/{pivot-header-presentation-EoUS5ze5.cjs → pivot-header-presentation-DV2aBB6p.cjs} +2 -2
  29. package/dist/chunks/{pivot-result-lifecycle-kRhiJkzg.js → pivot-result-lifecycle-BFO354lk.js} +7 -7
  30. package/dist/chunks/pivot-result-lifecycle-OXAgoIYm.cjs +1 -0
  31. package/dist/chunks/raw-temporal-7bFbXd2a.js +930 -0
  32. package/dist/chunks/raw-temporal-CYdOOyR5.cjs +1 -0
  33. package/dist/chunks/{report-preferences-dialog-CHXPEl7v.js → report-preferences-dialog-BzxqfcF8.js} +3 -3
  34. package/dist/chunks/{report-preferences-dialog-Cto0vDwI.cjs → report-preferences-dialog-DLnhOXXg.cjs} +1 -1
  35. package/dist/chunks/{semantic-format-DwqGYx4V.js → semantic-format-Baqp8kD_.js} +1 -1
  36. package/dist/chunks/semantic-format-Bd7HmLG_.cjs +1 -0
  37. package/dist/chunks/{switch-DNbWXEOP.cjs → switch-C0520nRt.cjs} +24 -24
  38. package/dist/chunks/{switch-DNv-hVmt.js → switch-evlnTA4t.js} +3180 -3092
  39. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-PcLFSYWX.js} +6 -6
  40. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +222 -0
  41. package/dist/chunks/temporal-input-presentation-BIOSVWCL.cjs +1 -0
  42. package/dist/dashboard/index.cjs +1 -1
  43. package/dist/dashboard/index.js +1 -1
  44. package/dist/dashboard-authoring/index.js +6 -6
  45. package/dist/data-app-builder/index.cjs +1 -1
  46. package/dist/data-app-builder/index.js +2 -2
  47. package/dist/data-app-sdk/index.cjs +1 -1
  48. package/dist/data-app-sdk/index.js +1 -1
  49. package/dist/format-utils/index.cjs +3 -3
  50. package/dist/format-utils/index.js +77 -73
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.js +10 -10
  53. package/dist/style.css +1 -1
  54. package/dist/surfboard/index.cjs +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/components/editor/editor-main/dashboard-variable-node.d.ts +7 -3
  57. package/dist/types/components/editor/editor-main/text-card-rich-editor.d.ts +4 -1
  58. package/dist/types/lib/charts/chart-availability.d.ts +6 -0
  59. package/dist/types/lib/dashboard-inputs/dashboard-input-display.d.ts +11 -0
  60. package/dist/types/lib/dashboard-inputs/dashboard-input-text.d.ts +2 -1
  61. package/dist/types/lib/dashboard-inputs/text-card-rich-content.d.ts +3 -2
  62. package/dist/types/lib/dashboard-inputs/text-variable-options.d.ts +5 -4
  63. package/dist/types/lib/document/document-variables.d.ts +8 -4
  64. package/dist/types/lib/text-variables/temporal-input-text.d.ts +28 -0
  65. package/dist/types/lib/text-variables/text-variable-types.d.ts +17 -1
  66. package/dist/types/lib/types/common-types.d.ts +11 -1
  67. package/dist/types/shared/format-utils/index.d.ts +1 -0
  68. package/dist/types/shared/format-utils/temporal-input-presentation.d.ts +46 -0
  69. package/package.json +1 -1
  70. package/dist/chunks/index-C8w91oj4.js +0 -328
  71. package/dist/chunks/index-Cw2ypaFl.cjs +0 -1
  72. package/dist/chunks/index-DfqMtR9S.cjs +0 -4
  73. package/dist/chunks/matrix-formatter-BJTO8ky9.cjs +0 -1
  74. package/dist/chunks/pivot-result-lifecycle-gl9cBfB-.cjs +0 -1
  75. package/dist/chunks/raw-temporal-BqOfk-xN.js +0 -1137
  76. package/dist/chunks/raw-temporal-eJXecCyJ.cjs +0 -1
  77. package/dist/chunks/semantic-format-mVI32OJH.cjs +0 -1
@@ -4,8 +4,8 @@ var x = (e, t, o) => re(e, typeof t != "symbol" ? t + "" : t, o);
4
4
  import { h as oe, f as ne, U as ie, F as ae, a$ as G, G as se, an as P, al as ce, u as j, a0 as le } from "./validators-CsdOtZI6.js";
5
5
  import { C as A } from "./common-types-C6cAQgyh.js";
6
6
  import "./matrix-operation-contract-D32U2CSw.js";
7
- import { v as de, y as ue } from "./calculated-field-identity-DzJBs2J8.js";
8
- import { B as ge } from "./field-aggregations-Dl2A3rbV.js";
7
+ import { v as de, y as ue } from "./calculated-field-identity-Dy_WpDdo.js";
8
+ import { B as ge } from "./field-aggregations-BQjogiI1.js";
9
9
  import { ZodError as fe } from "zod";
10
10
  import { a as H } from "./matrix-card-CIlz0Dnp.js";
11
11
  import { m as Y, a as Z } from "./constants-DeLIHVAW.js";
@@ -0,0 +1 @@
1
+ "use strict";const y=require("./validators-DFeDcdpA.cjs");require("./matrix-operation-contract-0RxoU_M3.cjs");const l=require("./semantic-format-Bd7HmLG_.cjs"),b=require("./raw-temporal-CYdOOyR5.cjs"),p=require("./numeric-presentation-mY6wJMdB.cjs"),T=require("./constants-B00YUv89.cjs"),v=require("./temporal-bucket-4YEPEKlJ.cjs");function d(t,e){const n=l.toDate(t),s=l.toDate(e),r=n.getTime()-s.getTime();return r<0?-1:r>0?1:r}function R(t){return l.constructFrom(t,Date.now())}function z(t,e){const n=l.toDate(t),s=l.toDate(e),r=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return r*12+o}function O(t){return e=>{const s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function S(t,e){return+l.toDate(t)-+l.toDate(e)}function Z(t){const e=l.toDate(t);return e.setHours(23,59,59,999),e}function k(t){const e=l.toDate(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function V(t){const e=l.toDate(t);return+Z(e)==+k(e)}function X(t,e){const n=l.toDate(t),s=l.toDate(e),r=d(n,s),o=Math.abs(z(n,s));let f;if(o<1)f=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*o);let a=d(n,s)===-r;V(l.toDate(t))&&o===1&&d(t,s)===1&&(a=!1),f=r*(o-Number(a))}return f===0?0:f}function q(t,e,n){const s=S(t,e)/1e3;return O(n==null?void 0:n.roundingMethod)(s)}function P(t,e,n){const s=l.getDefaultOptions(),r=(n==null?void 0:n.locale)??s.locale??l.enUS,o=2520,f=d(t,e);if(isNaN(f))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:f});let D,i;f>0?(D=l.toDate(e),i=l.toDate(t)):(D=l.toDate(t),i=l.toDate(e));const m=q(i,D),c=(l.getTimezoneOffsetInMilliseconds(i)-l.getTimezoneOffsetInMilliseconds(D))/1e3,u=Math.round((m-c)/60);let h;if(u<2)return n!=null&&n.includeSeconds?m<5?r.formatDistance("lessThanXSeconds",5,a):m<10?r.formatDistance("lessThanXSeconds",10,a):m<20?r.formatDistance("lessThanXSeconds",20,a):m<40?r.formatDistance("halfAMinute",0,a):m<60?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",1,a):u===0?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",u,a);if(u<45)return r.formatDistance("xMinutes",u,a);if(u<90)return r.formatDistance("aboutXHours",1,a);if(u<T.minutesInDay){const M=Math.round(u/60);return r.formatDistance("aboutXHours",M,a)}else{if(u<o)return r.formatDistance("xDays",1,a);if(u<T.minutesInMonth){const M=Math.round(u/T.minutesInDay);return r.formatDistance("xDays",M,a)}else if(u<T.minutesInMonth*2)return h=Math.round(u/T.minutesInMonth),r.formatDistance("aboutXMonths",h,a)}if(h=X(i,D),h<12){const M=Math.round(u/T.minutesInMonth);return r.formatDistance("xMonths",M,a)}else{const M=h%12,g=Math.trunc(h/12);return M<3?r.formatDistance("aboutXYears",g,a):M<9?r.formatDistance("overXYears",g,a):r.formatDistance("almostXYears",g+1,a)}}function L(t,e){return P(t,R(t),e)}function E(t,e){return t&&t!=="auto"?t:e}function $(t,e=new Date){try{const n={timeZone:t,timeZoneName:"short"},r=new Intl.DateTimeFormat("en-US",n).formatToParts(e).find(o=>o.type==="timeZoneName");return(r==null?void 0:r.value)||t}catch{return t}}function Y(t){try{const e={timeZone:t,timeZoneName:"long"},s=new Intl.DateTimeFormat("en-US",e).formatToParts(new Date).find(r=>r.type==="timeZoneName");return(s==null?void 0:s.value)||t}catch{return t}}function x(t,e="auto"){if(!t)return new Date(NaN);const n=t.endsWith("Z"),s=/[+-]\d{2}:?\d{2}$/.test(t),r=/\([A-Z]{3,4}\)$/.test(t);if(e==="auto")return n||s||r?new Date(t):new Date(t+"Z");if(e==="local"){if(n||s){const o=t.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(o)}return new Date(t)}else return e==="UTC"?n?new Date(t):s?new Date(t):new Date(t+"Z"):n||s||r?new Date(t):b.fromZonedTime(t,e)}const B="MM/dd/yyyy",N=(t,e,n,s="auto")=>{if(!t)return"";try{const r=x(t,s);if(isNaN(r.getTime()))return t;const f=(e&&e.trim()?e:B).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return n&&n!=="auto"?l.formatInTimeZone(r,n,f):l.format(r,f)}catch(r){return console.error("Date formatting error:",r),t}},I=(t,e="auto")=>{if(!t)return"";try{const n=x(t,e);return isNaN(n.getTime())?t:L(n,{addSuffix:!0})}catch(n){return console.error("Relative time formatting error:",n),t}};function j(t,e,n,s){const r=t instanceof Date?t.toISOString():String(t),o=(s==null?void 0:s.browserTimezone)||n,f=(s==null?void 0:s.isSqlCard)??!1;if(e!=null&&e.useRelativeTime)return I(r,(e==null?void 0:e.sourceTimezone)||"auto");const a=e!=null&&e.useCustomFormat&&(e!=null&&e.customFormat)?e.customFormat:(e==null?void 0:e.format)||"MM/dd/yyyy";return N(r,a,e!=null&&e.timezone&&(e==null?void 0:e.timezone)!=="auto"?e.timezone:f?o:n,(e==null?void 0:e.sourceTimezone)||"auto")}function w(t,e,n){var f,a;if(t==null)return t===null?((f=n.absence)==null?void 0:f.nullText)??"":((a=n.absence)==null?void 0:a.emptyText)??"";const s=y.isExactNumericValue(t)?t:void 0,r=s?s.value:t,o=s??(typeof t=="number"?t:void 0);if(!n.useFormattedValues||!e)return String(r);switch(e.type){case"number":return o!==void 0?p.formatNumberWithColumnSettings(o,e.numberFormat,n.locale):String(r);case"date":return j(r,e.dateFormat,n.timezone,{browserTimezone:n.browserTimezone,isSqlCard:n.isSqlCard});case"progress":return o!==void 0?`${r}%`:String(r);case"badge":case"link":case"text":case"none":default:return String(r)}}function H(t,e){return e.visibleColumns.map(n=>{const s=t[n],r=e.columnSettings[n];return w(s,r,{useFormattedValues:e.useFormattedValues,timezone:e.timezone,locale:e.locale})})}function _(t,e){var r;const n=t[t.length-1];if(!n)return"";if(n.member.kind==="others")return"Others";const s=n.member.value;return s===null?"(Blank)":((r=e==null?void 0:e.get(n.levelId))==null?void 0:r(s))??(typeof s=="object"?s.value:String(s))}function A(t,e,n){return t==="grand_total"?n??"Grand Total":t==="subtotal"?(n==null?void 0:n.split(y.MATRIX_TOTAL_MEMBER_PLACEHOLDER).join(e))??`${e} Total`:e}function U(t,e,n,s){var f;const r=t[t.length-1],o=e==="grand_total"?n.grand.label:r?(f=n.levels[r.levelId])==null?void 0:f.label:void 0;return A(e,_(t,s),o)}function W(t,e,n){return t.kind==="value"?(e==null?void 0:e(t.value))??"":t.kind==="null"?n.nullText:n.emptyText}function K(t){const{path:e,previousPath:n,role:s,repeatLabels:r,levelCount:o}=t;return Array.from({length:o},(f,a)=>{const D=e.slice(0,a+1),i=s==="grand_total"?a===0:s==="subtotal"&&a===e.length-1,m=n&&n.length>a&&y.matrixPathKey(n.slice(0,a+1))===y.matrixPathKey(D);return{path:D,total:i,visible:i||e.length>a&&(r||!m||a===e.length-1)}})}function C(t,e){return l.fromSemanticFormat(t??e,{preserveOmittedProperties:!0,numericInput:"canonical"})}function F(t,e,n){const s=new Map,r=(o,f)=>{const a=(f==="levels"?e.levelFormats:e.measureFormats)[o.id],D=o.semanticFormat,i=C(a,D);f==="measures"&&s.set(o.id,{isNumeric:y.normalizeAnalyticsCatalogDataType(o.column.dataType)==="number",hasTextAffixes:!!i&&!!("prefix"in i&&i.prefix||"suffix"in i&&i.suffix)});const m=c=>w(c,void 0,{useFormattedValues:!0,timezone:n.calendar.tz,locale:n.valueFormat.locale,absence:e.absence});if(o.column.temporalBucket){const c=o.column.temporalBucket,u=v.resolveTemporalBucketPresentation({metadata:c,cardFormat:(a==null?void 0:a.type)==="temporal_bucket"?a:void 0,semanticFormat:(D==null?void 0:D.type)==="temporal_bucket"?{granularity:c.granularity,format:D}:void 0,locale:n.valueFormat.locale,styles:{dateStyle:n.valueFormat.dateStyle,dateTime:n.valueFormat.dateTime}});return h=>typeof h=="string"?v.formatTemporalBucket({value:h,metadata:c,format:u.format}):m(h)}if(o.column.rawTemporal){const c=b.prepareRawTemporalFormatter({metadata:o.column.rawTemporal,format:b.resolveRawTemporalFormat({format:(i==null?void 0:i.type)==="date"?{type:"raw_temporal",timezone:i.timezone,sourceTimezone:i.sourceTimezone,presentation:i.pattern?{mode:"pattern",dialect:"semaphor_tokens",pattern:i.pattern}:{mode:"auto"}}:void 0,preferences:n.valueFormat,calendar:n.calendar})});return u=>{if(typeof u!="string")return m(u);const h=c(u);return h.ok?h.text:m(u)}}if(b.isNumericCanonicalFormat(i)){const c=p.resolveNumericPresentation(i,n.valueFormat);return u=>typeof u=="number"||typeof u=="object"&&u!==null?p.formatNumericCanonical(u,c):m(u)}return(i==null?void 0:i.type)==="duration"?c=>typeof c=="number"||typeof c=="string"||typeof c=="object"&&c!==null?p.formatDuration(typeof c=="object"?c.value:c,i):m(c):(i==null?void 0:i.type)==="string"?c=>c===null?m(c):`${i.prefix??""}${m(c)}${i.suffix??""}`:m};return{levels:new Map(t.levels.map(o=>[o.id,r(o,"levels")])),measures:new Map(t.measures.map(o=>[o.id,r(o,"measures")])),measureSemantics:s}}exports.formatCellValue=w;exports.formatDate=N;exports.formatDistanceToNow=L;exports.formatRelativeTime=I;exports.formatRowForExport=H;exports.getTimezoneAbbreviation=$;exports.getTimezoneName=Y;exports.matrixAxisLabel=U;exports.matrixCellText=W;exports.matrixLevelLabels=K;exports.matrixMemberLabel=_;exports.matrixTotalLabel=A;exports.parseWithSourceTimezone=x;exports.prepareMatrixFormatting=F;exports.resolveMatrixValueFormat=C;exports.resolveTimezone=E;
@@ -1,10 +1,10 @@
1
1
  import { b5 as v, S as p, al as N, W as _ } from "./validators-CsdOtZI6.js";
2
2
  import "./matrix-operation-contract-D32U2CSw.js";
3
- import { t as m, c as L, g as I, e as A, a as d, b as C, d as O, f as R } from "./semantic-format-DwqGYx4V.js";
4
- import { f as S, i as Z } from "./index-C8w91oj4.js";
5
- import { f as k, w as z, n as X, l as V, g as E, i as P } from "./raw-temporal-BqOfk-xN.js";
3
+ import { t as m, c as L, g as I, e as A, a as d, b as C, d as O, f as R } from "./semantic-format-Baqp8kD_.js";
4
+ import { f as S, h as Z, r as k, i as z } from "./raw-temporal-7bFbXd2a.js";
5
+ import { f as X, l as V, g as E, i as P } from "./numeric-presentation-VhMUHfrJ.js";
6
6
  import { b as g, c as y } from "./constants-DeLIHVAW.js";
7
- import { c as $, f as Y } from "./temporal-bucket-DlFuhCnT.js";
7
+ import { r as $, f as Y } from "./temporal-bucket-PcLFSYWX.js";
8
8
  function T(t, e) {
9
9
  const n = m(t), s = m(e), r = n.getTime() - s.getTime();
10
10
  return r < 0 ? -1 : r > 0 ? 1 : r;
@@ -183,7 +183,7 @@ function x(t, e, n) {
183
183
  return String(r);
184
184
  switch (e.type) {
185
185
  case "number":
186
- return o !== void 0 ? k(
186
+ return o !== void 0 ? X(
187
187
  o,
188
188
  e.numberFormat,
189
189
  n.locale
@@ -279,9 +279,9 @@ function ge(t, e, n) {
279
279
  return (M) => typeof M == "string" ? Y({ value: M, metadata: c, format: i.format }) : f(M);
280
280
  }
281
281
  if (o.column.rawTemporal) {
282
- const c = z({
282
+ const c = Z({
283
283
  metadata: o.column.rawTemporal,
284
- format: X({
284
+ format: k({
285
285
  format: (u == null ? void 0 : u.type) === "date" ? {
286
286
  type: "raw_temporal",
287
287
  timezone: u.timezone,
@@ -302,7 +302,7 @@ function ge(t, e, n) {
302
302
  return M.ok ? M.text : f(i);
303
303
  };
304
304
  }
305
- if (Z(u)) {
305
+ if (z(u)) {
306
306
  const c = V(u, n.valueFormat);
307
307
  return (i) => typeof i == "number" || typeof i == "object" && i !== null ? E(i, c) : f(i);
308
308
  }
@@ -0,0 +1,537 @@
1
+ import { b9 as C, ba as O } from "./validators-CsdOtZI6.js";
2
+ import { canonicalizeSupportedLocale as E, canonicalizeSupportedCurrencyCode as h } from "../value-format-preferences/index.js";
3
+ import { i as _ } from "./temporal-bucket-PcLFSYWX.js";
4
+ const U = [
5
+ "day",
6
+ "hour",
7
+ "minute",
8
+ "second",
9
+ "millisecond"
10
+ ], D = {
11
+ day: 864e5,
12
+ hour: 36e5,
13
+ minute: 6e4,
14
+ second: 1e3,
15
+ millisecond: 1
16
+ }, b = {
17
+ day: "d",
18
+ hour: "hr",
19
+ minute: "min",
20
+ second: "s",
21
+ millisecond: "ms"
22
+ }, T = {
23
+ day: ["day", "days"],
24
+ hour: ["hour", "hours"],
25
+ minute: ["minute", "minutes"],
26
+ second: ["second", "seconds"],
27
+ millisecond: ["millisecond", "milliseconds"]
28
+ };
29
+ function j(i) {
30
+ return i === "day" || i === "hour" || i === "minute" || i === "second" || i === "millisecond";
31
+ }
32
+ function k(i, e) {
33
+ return j(i) ? i : e;
34
+ }
35
+ function M(i, e) {
36
+ return U.indexOf(k(i, e));
37
+ }
38
+ function A(i, e) {
39
+ const c = M(i, "day"), r = M(e, "second"), a = Math.min(c, r), t = Math.max(c, r);
40
+ return U.slice(a, t + 1);
41
+ }
42
+ function K(i, e) {
43
+ return i * D[k(e, "second")];
44
+ }
45
+ function W(i, e) {
46
+ const c = A(e.largestUnit, e.smallestUnit), r = c[c.length - 1], a = D[r];
47
+ let t = Math.round(i / a) * a;
48
+ return c.map((n) => {
49
+ const u = D[n], s = Math.floor(t / u);
50
+ return t -= s * u, { unit: n, value: s };
51
+ });
52
+ }
53
+ function q(i, e) {
54
+ const c = i.filter((t) => t.value !== 0), r = c.length > 0 ? c : [i[i.length - 1]], a = typeof e == "number" && Number.isFinite(e) ? Math.max(1, Math.trunc(e)) : r.length;
55
+ return r.slice(0, a).map((t) => `${t.value}${b[t.unit]}`).join(" ");
56
+ }
57
+ function Z(i, e) {
58
+ const c = i.filter((t) => t.value !== 0), r = c.length > 0 ? c : [i[i.length - 1]], a = typeof e == "number" && Number.isFinite(e) ? Math.max(1, Math.trunc(e)) : r.length;
59
+ return r.slice(0, a).map((t) => {
60
+ const [n, u] = T[t.unit];
61
+ return `${t.value} ${t.value === 1 ? n : u}`;
62
+ }).join(" ");
63
+ }
64
+ function z(i) {
65
+ const e = i.some(
66
+ (s) => s.unit === "day" && s.value !== 0
67
+ ), c = i.some((s) => s.unit === "millisecond"), r = i.findIndex((s) => s.value !== 0), a = Math.max(0, i.length - 2), t = e ? 0 : r === -1 ? a : Math.min(r, a), n = r === -1 ? i.slice(a) : i.slice(t);
68
+ if (n.length === 0)
69
+ return "0";
70
+ const u = n.map((s, l) => s.unit === "millisecond" ? String(s.value).padStart(3, "0") : l === 0 ? String(s.value) : String(s.value).padStart(2, "0")).join(":");
71
+ return c ? u.replace(/:(\d{3})$/, ".$1") : u;
72
+ }
73
+ function J(i, e, c) {
74
+ const r = `${c.prefix || ""}${i}${c.suffix || ""}`;
75
+ return e ? c.negativeInParentheses ? `(${r})` : `-${r}` : r;
76
+ }
77
+ function Y(i, e = {}) {
78
+ if (i == null)
79
+ return "";
80
+ const c = typeof i == "number" ? i : typeof i == "string" && i.trim() ? Number(i) : NaN;
81
+ if (!Number.isFinite(c))
82
+ return "";
83
+ const r = e.inputUnit || "second", a = e.outputStyle === "digital" || e.outputStyle === "long" ? e.outputStyle : "compact", t = c < 0, n = Math.abs(K(c, r)), u = W(n, e), s = a === "digital" ? z(u) : a === "long" ? Z(u, e.maxUnits) : q(u, e.maxUnits);
84
+ return J(s, t, e);
85
+ }
86
+ function G(i, e) {
87
+ return Y(
88
+ i !== null && typeof i == "object" ? i.value : i,
89
+ {
90
+ inputUnit: e.inputUnit,
91
+ outputStyle: e.outputStyle,
92
+ largestUnit: e.largestUnit,
93
+ smallestUnit: e.smallestUnit,
94
+ maxUnits: e.maxUnits,
95
+ prefix: e.prefix,
96
+ suffix: e.suffix,
97
+ negativeInParentheses: e.negativeStyle === "parentheses"
98
+ }
99
+ );
100
+ }
101
+ let $;
102
+ function F(i, e) {
103
+ const c = i.format;
104
+ return c(e);
105
+ }
106
+ function H(i, e) {
107
+ if ($ ?? ($ = F(
108
+ new Intl.NumberFormat("en-US", { useGrouping: !1, maximumFractionDigits: 6 }),
109
+ "9007199254740993.000009"
110
+ ) === "9007199254740993.000009"), !$)
111
+ throw new RangeError("This runtime cannot format exact decimal strings.");
112
+ const c = Number(i);
113
+ if (!Number.isFinite(c) || c === 0 && i !== "0")
114
+ throw new RangeError("Exact value is outside the Intl formatting range; use raw text.");
115
+ return F(e, i);
116
+ }
117
+ function x(i) {
118
+ return typeof i == "number" ? i < 0 : i.value.startsWith("-");
119
+ }
120
+ function d(i) {
121
+ return typeof i == "number" ? Math.abs(i) : x(i) ? { ...i, value: i.value.slice(1) } : i;
122
+ }
123
+ function V(i, e) {
124
+ return typeof i == "number" ? i * e : {
125
+ kind: "exact_number",
126
+ type: "decimal",
127
+ value: C(i.value, e)
128
+ };
129
+ }
130
+ function y(i, e) {
131
+ return e === 0 ? i : typeof i == "number" ? i / 10 ** e : {
132
+ kind: "exact_number",
133
+ type: "decimal",
134
+ value: C(i.value, `1e-${e}`)
135
+ };
136
+ }
137
+ function f(i, e) {
138
+ return typeof i == "number" ? e.format(i) : H(i.value, e);
139
+ }
140
+ function I(i) {
141
+ if (!i) return !1;
142
+ const e = i.toLowerCase().replace("_", "-");
143
+ return e === "en-in" || e.startsWith("en-in-");
144
+ }
145
+ function P(i, e) {
146
+ const c = d(i), r = (a) => typeof c == "number" ? c >= a : O(c.value, String(a)) >= 0;
147
+ return r(1e12) ? { power: 12, suffix: "T" } : r(1e9) ? { power: 9, suffix: "B" } : I(e) && r(1e7) ? { power: 7, suffix: "Cr" } : r(1e6) ? { power: 6, suffix: "M" } : I(e) && r(1e5) ? { power: 5, suffix: "L" } : r(1e3) ? { power: 3, suffix: "K" } : { power: 0, suffix: "" };
148
+ }
149
+ function S(i, e) {
150
+ try {
151
+ const c = g(e);
152
+ return P(i, c);
153
+ } catch {
154
+ return P(i, "en-US");
155
+ }
156
+ }
157
+ function Q(i) {
158
+ try {
159
+ return new Intl.NumberFormat(i), !0;
160
+ } catch {
161
+ return !1;
162
+ }
163
+ }
164
+ function g(i) {
165
+ return i && Q(i) ? i : "en-US";
166
+ }
167
+ function v(i, e) {
168
+ if (i == null || Number.isNaN(i))
169
+ return "";
170
+ const c = g(e == null ? void 0 : e.locale);
171
+ let r = i;
172
+ if (e != null && e.multiplyBy && (r = V(r, e.multiplyBy)), e != null && e.useSuffix) {
173
+ const { power: t, suffix: n } = S(r, c);
174
+ r = y(r, t);
175
+ const u = f(r, new Intl.NumberFormat(c, {
176
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
177
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
178
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
179
+ }));
180
+ return `${(e == null ? void 0 : e.prefix) ?? ""}${u}${n}${(e == null ? void 0 : e.suffix) ?? ""}`;
181
+ }
182
+ const a = f(r, new Intl.NumberFormat(c, {
183
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
184
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
185
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
186
+ }));
187
+ if (e != null && e.negativeInParentheses && x(r)) {
188
+ const t = a.replace("-", "");
189
+ return `(${(e == null ? void 0 : e.prefix) ?? ""}${t}${(e == null ? void 0 : e.suffix) ?? ""})`;
190
+ }
191
+ return `${(e == null ? void 0 : e.prefix) ?? ""}${a}${(e == null ? void 0 : e.suffix) ?? ""}`;
192
+ }
193
+ function o(i, e) {
194
+ if (i == null || Number.isNaN(i))
195
+ return "";
196
+ const c = g(e == null ? void 0 : e.locale), r = (e == null ? void 0 : e.currency) || "USD", a = x(i), t = !!(e != null && e.negativeInParentheses && a), n = t ? d(i) : i;
197
+ try {
198
+ if (e != null && e.useSuffix) {
199
+ const { power: s, suffix: l } = S(n, c), m = y(n, s), w = `${f(m, new Intl.NumberFormat(c, {
200
+ style: "currency",
201
+ currency: r,
202
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
203
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
204
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
205
+ }))}${l}`;
206
+ return t ? `(${w})` : w;
207
+ }
208
+ const u = f(n, new Intl.NumberFormat(c, {
209
+ style: "currency",
210
+ currency: r,
211
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
212
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
213
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
214
+ }));
215
+ return t ? `(${u})` : u;
216
+ } catch {
217
+ const u = d(i), s = e != null && e.useSuffix ? S(u, c) : { power: 0, suffix: "" }, l = v(
218
+ y(u, s.power),
219
+ {
220
+ locale: c,
221
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
222
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
223
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
224
+ }
225
+ ), m = `${r} ${l}${s.suffix}`;
226
+ return a ? e != null && e.negativeInParentheses ? `(${m})` : `-${m}` : m;
227
+ }
228
+ }
229
+ function L(i, e) {
230
+ if (i == null || Number.isNaN(i))
231
+ return "";
232
+ const c = g(e == null ? void 0 : e.locale), a = (e == null ? void 0 : e.alreadyPercent) ?? (e == null ? void 0 : e.percentValueMode) === "whole" ? y(i, 2) : i;
233
+ return f(a, new Intl.NumberFormat(c, {
234
+ style: "percent",
235
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
236
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
237
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
238
+ }));
239
+ }
240
+ function R(i, e) {
241
+ if (i == null || Number.isNaN(i))
242
+ return "";
243
+ const c = g(e == null ? void 0 : e.locale);
244
+ return f(i, new Intl.NumberFormat(c, {
245
+ notation: "scientific",
246
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
247
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
248
+ }));
249
+ }
250
+ function B(i, e) {
251
+ if (i == null || Number.isNaN(i))
252
+ return "";
253
+ const c = e.scale === void 0 ? i : V(i, e.scale), r = e.negativeStyle === "parentheses" && x(c), a = r ? d(c) : c, t = {
254
+ style: e.type === "number" ? "decimal" : e.type,
255
+ locale: e.locale,
256
+ currency: e.currency,
257
+ minimumFractionDigits: e.minimumFractionDigits,
258
+ maximumFractionDigits: e.maximumFractionDigits,
259
+ useGrouping: e.useGrouping,
260
+ percentValueMode: e.percentValueMode,
261
+ useSuffix: e.compact
262
+ };
263
+ let n;
264
+ switch (e.type) {
265
+ case "currency":
266
+ n = o(a, t);
267
+ break;
268
+ case "percent":
269
+ n = L(a, t);
270
+ break;
271
+ case "scientific":
272
+ n = R(a, t);
273
+ break;
274
+ default:
275
+ n = v(a, t);
276
+ break;
277
+ }
278
+ const u = `${e.prefix ?? ""}${n}${e.suffix ?? ""}`;
279
+ return r ? `(${u})` : u;
280
+ }
281
+ function ae(i, e) {
282
+ return e.type === "duration" ? i == null ? "" : G(i, e) : B(i, e);
283
+ }
284
+ function ne(i, e, c = "en-US") {
285
+ if (i == null || typeof i == "number" && isNaN(i))
286
+ return "";
287
+ if ((e == null ? void 0 : e.style) === "duration")
288
+ return G(i, {
289
+ ...e.duration,
290
+ prefix: e.prefix,
291
+ suffix: e.suffix,
292
+ negativeStyle: e.negativeStyle
293
+ });
294
+ const r = g((e == null ? void 0 : e.locale) || c), a = (e == null ? void 0 : e.style) || "decimal", t = a === "decimal" ? "number" : a;
295
+ return t === "currency" && new Intl.NumberFormat(r, {
296
+ style: "currency",
297
+ currency: (e == null ? void 0 : e.currency) || "USD"
298
+ }), B(i, {
299
+ type: t,
300
+ locale: r,
301
+ currency: t === "currency" ? (e == null ? void 0 : e.currency) || "USD" : void 0,
302
+ minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
303
+ maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
304
+ useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0,
305
+ percentValueMode: t === "percent" ? (e == null ? void 0 : e.percentValueMode) ?? "whole" : void 0,
306
+ scale: e == null ? void 0 : e.scale,
307
+ compact: e == null ? void 0 : e.compact,
308
+ negativeStyle: e == null ? void 0 : e.negativeStyle,
309
+ prefix: e == null ? void 0 : e.prefix,
310
+ suffix: e == null ? void 0 : e.suffix
311
+ });
312
+ }
313
+ function ue(i, e, c) {
314
+ const r = {
315
+ style: e === "currency" ? "currency" : e === "percent" ? "percent" : "decimal",
316
+ locale: c == null ? void 0 : c.locale,
317
+ currency: c == null ? void 0 : c.currency,
318
+ minimumFractionDigits: c == null ? void 0 : c.decimalPlaces,
319
+ maximumFractionDigits: c == null ? void 0 : c.decimalPlaces,
320
+ useSuffix: c == null ? void 0 : c.useSuffix,
321
+ prefix: c == null ? void 0 : c.prefix,
322
+ suffix: c == null ? void 0 : c.suffix,
323
+ negativeInParentheses: c == null ? void 0 : c.negativeInParentheses,
324
+ multiplyBy: c == null ? void 0 : c.multiplyBy
325
+ };
326
+ switch (e) {
327
+ case "currency":
328
+ return o(i, r);
329
+ case "percent":
330
+ return L(i, r);
331
+ case "scientific":
332
+ return R(i, r);
333
+ default:
334
+ return v(i, r);
335
+ }
336
+ }
337
+ const X = [
338
+ "type",
339
+ "locale",
340
+ "minimumFractionDigits",
341
+ "maximumFractionDigits",
342
+ "useGrouping",
343
+ "prefix",
344
+ "suffix",
345
+ "negativeStyle",
346
+ "compact",
347
+ "scale",
348
+ "currency",
349
+ "percentValueMode"
350
+ ];
351
+ function p(i) {
352
+ if (!_(i))
353
+ return {
354
+ ok: !1,
355
+ issues: [{ path: "$", message: "Numeric format must be an object." }]
356
+ };
357
+ const e = [], c = new Set(X);
358
+ Object.keys(i).filter((t) => !c.has(t)).forEach(
359
+ (t) => e.push({ path: t, message: `Unknown property "${t}".` })
360
+ ), i.type !== "number" && i.type !== "currency" && i.type !== "percent" && i.type !== "scientific" && e.push({
361
+ path: "type",
362
+ message: "Expected number, currency, percent, or scientific."
363
+ });
364
+ const r = i.locale === void 0 ? void 0 : E(i.locale);
365
+ i.locale !== void 0 && !r && e.push({ path: "locale", message: "Expected a supported BCP 47 locale." });
366
+ const a = i.currency === void 0 ? void 0 : h(i.currency);
367
+ i.currency !== void 0 && !a && e.push({
368
+ path: "currency",
369
+ message: "Expected a supported ISO 4217 currency code."
370
+ });
371
+ for (const t of ["minimumFractionDigits", "maximumFractionDigits"]) {
372
+ const n = i[t];
373
+ n !== void 0 && (!Number.isInteger(n) || typeof n != "number" || n < 0 || n > 20) && e.push({
374
+ path: t,
375
+ message: "Expected an integer from 0 to 20."
376
+ });
377
+ }
378
+ typeof i.minimumFractionDigits == "number" && typeof i.maximumFractionDigits == "number" && i.minimumFractionDigits > i.maximumFractionDigits && e.push({
379
+ path: "maximumFractionDigits",
380
+ message: "Must be greater than or equal to minimumFractionDigits."
381
+ });
382
+ for (const t of ["useGrouping", "compact"])
383
+ i[t] !== void 0 && typeof i[t] != "boolean" && e.push({ path: t, message: "Expected a boolean." });
384
+ for (const t of ["prefix", "suffix"])
385
+ i[t] !== void 0 && typeof i[t] != "string" && e.push({ path: t, message: "Expected a string." });
386
+ return i.negativeStyle !== void 0 && i.negativeStyle !== "minus" && i.negativeStyle !== "parentheses" && e.push({
387
+ path: "negativeStyle",
388
+ message: "Expected minus or parentheses."
389
+ }), i.percentValueMode !== void 0 && i.percentValueMode !== "fraction" && i.percentValueMode !== "whole" && e.push({
390
+ path: "percentValueMode",
391
+ message: "Expected fraction or whole."
392
+ }), i.scale !== void 0 && (typeof i.scale != "number" || !Number.isFinite(i.scale)) && e.push({ path: "scale", message: "Expected a finite number." }), e.length > 0 ? { ok: !1, issues: e } : {
393
+ ok: !0,
394
+ value: {
395
+ type: i.type,
396
+ ...r ? { locale: r } : {},
397
+ ...i.minimumFractionDigits !== void 0 ? { minimumFractionDigits: i.minimumFractionDigits } : {},
398
+ ...i.maximumFractionDigits !== void 0 ? { maximumFractionDigits: i.maximumFractionDigits } : {},
399
+ ...i.useGrouping !== void 0 ? { useGrouping: i.useGrouping } : {},
400
+ ...i.prefix !== void 0 ? { prefix: i.prefix } : {},
401
+ ...i.suffix !== void 0 ? { suffix: i.suffix } : {},
402
+ ...i.negativeStyle !== void 0 ? {
403
+ negativeStyle: i.negativeStyle
404
+ } : {},
405
+ ...i.compact !== void 0 ? { compact: i.compact } : {},
406
+ ...i.scale !== void 0 ? { scale: i.scale } : {},
407
+ ...a ? { currency: a } : {},
408
+ ...i.percentValueMode !== void 0 ? {
409
+ percentValueMode: i.percentValueMode
410
+ } : {}
411
+ }
412
+ };
413
+ }
414
+ function se(i) {
415
+ const e = p(i);
416
+ if (!e.ok)
417
+ return e;
418
+ const c = [];
419
+ return e.value.locale || c.push({
420
+ path: "locale",
421
+ message: "Resolved numeric formats require an explicit locale."
422
+ }), e.value.minimumFractionDigits === void 0 && c.push({
423
+ path: "minimumFractionDigits",
424
+ message: "Resolved numeric formats require minimumFractionDigits."
425
+ }), e.value.maximumFractionDigits === void 0 && c.push({
426
+ path: "maximumFractionDigits",
427
+ message: "Resolved numeric formats require maximumFractionDigits."
428
+ }), e.value.type === "currency" && !e.value.currency && c.push({
429
+ path: "currency",
430
+ message: "Resolved currency formats require an explicit currency."
431
+ }), c.length > 0 ? { ok: !1, issues: c } : e;
432
+ }
433
+ function me(i) {
434
+ var r;
435
+ const e = /* @__PURE__ */ new Set();
436
+ if (i.snapshot.resolvedFormats.forEach((a, t) => {
437
+ if (a.format.type !== "temporal_bucket") {
438
+ if (a.scope.attachmentIndex !== void 0)
439
+ throw new Error(
440
+ `resolvedFormats.${t}.scope.attachmentIndex is not valid for a card export`
441
+ );
442
+ if (a.scope.dashboardId !== i.expectedScope.dashboardId || a.scope.cardId !== i.expectedScope.cardId)
443
+ throw new Error(
444
+ `resolvedFormats.${t}.scope must match the executing dashboard/card`
445
+ );
446
+ if (a.target.kind !== "column")
447
+ throw new Error(
448
+ `resolvedFormats.${t}.target must identify an export column`
449
+ );
450
+ if (e.has(a.target.columnKey))
451
+ throw new Error(
452
+ `resolvedFormats.${t} duplicates export column "${a.target.columnKey}"`
453
+ );
454
+ e.add(a.target.columnKey);
455
+ }
456
+ }), !i.useFormattedValues)
457
+ return;
458
+ if (!((r = i.visibleColumns) != null && r.length))
459
+ throw new Error(
460
+ "visibleColumns must identify every formatted export column"
461
+ );
462
+ const c = i.visibleColumns.find(
463
+ (a) => !e.has(a)
464
+ );
465
+ if (c)
466
+ throw new Error(
467
+ `resolvedFormats is missing visible export column "${c}"`
468
+ );
469
+ }
470
+ function ee(i, e) {
471
+ const c = new Intl.NumberFormat(i, {
472
+ style: "currency",
473
+ currency: e
474
+ }).resolvedOptions();
475
+ return {
476
+ minimumFractionDigits: c.minimumFractionDigits,
477
+ maximumFractionDigits: c.maximumFractionDigits
478
+ };
479
+ }
480
+ function ie(i) {
481
+ if (i.minimumFractionDigits !== void 0 || i.maximumFractionDigits !== void 0) {
482
+ const c = i.minimumFractionDigits ?? 0;
483
+ return {
484
+ minimumFractionDigits: c,
485
+ maximumFractionDigits: i.maximumFractionDigits ?? Math.max(c, 2)
486
+ };
487
+ }
488
+ const e = i.type === "percent" ? 1 : i.type === "scientific" ? 2 : 0;
489
+ return {
490
+ minimumFractionDigits: e,
491
+ maximumFractionDigits: e
492
+ };
493
+ }
494
+ function le(i, e, c) {
495
+ const r = E(i.locale) ?? e.locale, a = i.type === "number" || i.type === "currency" ? h(c) : void 0;
496
+ if (!(i.type === "currency" || a !== void 0))
497
+ return {
498
+ ...i,
499
+ locale: r,
500
+ ...ie(i)
501
+ };
502
+ const n = a ?? h(i.currency) ?? e.defaultCurrency, u = ee(
503
+ r,
504
+ n
505
+ ), s = u.minimumFractionDigits ?? 0, l = u.maximumFractionDigits ?? s, m = i.minimumFractionDigits ?? Math.min(
506
+ s,
507
+ i.maximumFractionDigits ?? s
508
+ ), N = i.maximumFractionDigits ?? Math.max(
509
+ m,
510
+ l
511
+ );
512
+ return {
513
+ ...i,
514
+ type: "currency",
515
+ locale: r,
516
+ currency: n,
517
+ minimumFractionDigits: m,
518
+ maximumFractionDigits: N
519
+ };
520
+ }
521
+ export {
522
+ ae as a,
523
+ v as b,
524
+ o as c,
525
+ L as d,
526
+ R as e,
527
+ ne as f,
528
+ B as g,
529
+ ue as h,
530
+ Y as i,
531
+ G as j,
532
+ se as k,
533
+ le as l,
534
+ p,
535
+ ee as r,
536
+ me as v
537
+ };
@@ -0,0 +1 @@
1
+ "use strict";const N=require("./validators-DFeDcdpA.cjs"),d=require("../value-format-preferences/index.cjs"),b=require("./temporal-bucket-4YEPEKlJ.cjs"),V=["day","hour","minute","second","millisecond"],S={day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},q={day:"d",hour:"hr",minute:"min",second:"s",millisecond:"ms"},T={day:["day","days"],hour:["hour","hours"],minute:["minute","minutes"],second:["second","seconds"],millisecond:["millisecond","milliseconds"]};function A(i){return i==="day"||i==="hour"||i==="minute"||i==="second"||i==="millisecond"}function L(i,e){return A(i)?i:e}function P(i,e){return V.indexOf(L(i,e))}function W(i,e){const r=P(i,"day"),c=P(e,"second"),n=Math.min(r,c),t=Math.max(r,c);return V.slice(n,t+1)}function j(i,e){return i*S[L(e,"second")]}function z(i,e){const r=W(e.largestUnit,e.smallestUnit),c=r[r.length-1],n=S[c];let t=Math.round(i/n)*n;return r.map(a=>{const u=S[a],s=Math.floor(t/u);return t-=s*u,{unit:a,value:s}})}function K(i,e){const r=i.filter(t=>t.value!==0),c=r.length>0?r:[i[i.length-1]],n=typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.trunc(e)):c.length;return c.slice(0,n).map(t=>`${t.value}${q[t.unit]}`).join(" ")}function Z(i,e){const r=i.filter(t=>t.value!==0),c=r.length>0?r:[i[i.length-1]],n=typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.trunc(e)):c.length;return c.slice(0,n).map(t=>{const[a,u]=T[t.unit];return`${t.value} ${t.value===1?a:u}`}).join(" ")}function J(i){const e=i.some(s=>s.unit==="day"&&s.value!==0),r=i.some(s=>s.unit==="millisecond"),c=i.findIndex(s=>s.value!==0),n=Math.max(0,i.length-2),t=e?0:c===-1?n:Math.min(c,n),a=c===-1?i.slice(n):i.slice(t);if(a.length===0)return"0";const u=a.map((s,l)=>s.unit==="millisecond"?String(s.value).padStart(3,"0"):l===0?String(s.value):String(s.value).padStart(2,"0")).join(":");return r?u.replace(/:(\d{3})$/,".$1"):u}function Y(i,e,r){const c=`${r.prefix||""}${i}${r.suffix||""}`;return e?r.negativeInParentheses?`(${c})`:`-${c}`:c}function R(i,e={}){if(i==null)return"";const r=typeof i=="number"?i:typeof i=="string"&&i.trim()?Number(i):NaN;if(!Number.isFinite(r))return"";const c=e.inputUnit||"second",n=e.outputStyle==="digital"||e.outputStyle==="long"?e.outputStyle:"compact",t=r<0,a=Math.abs(j(r,c)),u=z(a,e),s=n==="digital"?J(u):n==="long"?Z(u,e.maxUnits):K(u,e.maxUnits);return Y(s,t,e)}function o(i,e){return R(i!==null&&typeof i=="object"?i.value:i,{inputUnit:e.inputUnit,outputStyle:e.outputStyle,largestUnit:e.largestUnit,smallestUnit:e.smallestUnit,maxUnits:e.maxUnits,prefix:e.prefix,suffix:e.suffix,negativeInParentheses:e.negativeStyle==="parentheses"})}let E;function U(i,e){const r=i.format;return r(e)}function H(i,e){if(E??(E=U(new Intl.NumberFormat("en-US",{useGrouping:!1,maximumFractionDigits:6}),"9007199254740993.000009")==="9007199254740993.000009"),!E)throw new RangeError("This runtime cannot format exact decimal strings.");const r=Number(i);if(!Number.isFinite(r)||r===0&&i!=="0")throw new RangeError("Exact value is outside the Intl formatting range; use raw text.");return U(e,i)}function h(i){return typeof i=="number"?i<0:i.value.startsWith("-")}function y(i){return typeof i=="number"?Math.abs(i):h(i)?{...i,value:i.value.slice(1)}:i}function B(i,e){return typeof i=="number"?i*e:{kind:"exact_number",type:"decimal",value:N.scaleExactDecimal(i.value,e)}}function x(i,e){return e===0?i:typeof i=="number"?i/10**e:{kind:"exact_number",type:"decimal",value:N.scaleExactDecimal(i.value,`1e-${e}`)}}function f(i,e){return typeof i=="number"?e.format(i):H(i.value,e)}function k(i){if(!i)return!1;const e=i.toLowerCase().replace("_","-");return e==="en-in"||e.startsWith("en-in-")}function G(i,e){const r=y(i),c=n=>typeof r=="number"?r>=n:N.compareExactDecimal(r.value,String(n))>=0;return c(1e12)?{power:12,suffix:"T"}:c(1e9)?{power:9,suffix:"B"}:k(e)&&c(1e7)?{power:7,suffix:"Cr"}:c(1e6)?{power:6,suffix:"M"}:k(e)&&c(1e5)?{power:5,suffix:"L"}:c(1e3)?{power:3,suffix:"K"}:{power:0,suffix:""}}function v(i,e){try{const r=g(e);return G(i,r)}catch{return G(i,"en-US")}}function Q(i){try{return new Intl.NumberFormat(i),!0}catch{return!1}}function g(i){return i&&Q(i)?i:"en-US"}function D(i,e){if(i==null||Number.isNaN(i))return"";const r=g(e==null?void 0:e.locale);let c=i;if(e!=null&&e.multiplyBy&&(c=B(c,e.multiplyBy)),e!=null&&e.useSuffix){const{power:t,suffix:a}=v(c,r);c=x(c,t);const u=f(c,new Intl.NumberFormat(r,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}));return`${(e==null?void 0:e.prefix)??""}${u}${a}${(e==null?void 0:e.suffix)??""}`}const n=f(c,new Intl.NumberFormat(r,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}));if(e!=null&&e.negativeInParentheses&&h(c)){const t=n.replace("-","");return`(${(e==null?void 0:e.prefix)??""}${t}${(e==null?void 0:e.suffix)??""})`}return`${(e==null?void 0:e.prefix)??""}${n}${(e==null?void 0:e.suffix)??""}`}function w(i,e){if(i==null||Number.isNaN(i))return"";const r=g(e==null?void 0:e.locale),c=(e==null?void 0:e.currency)||"USD",n=h(i),t=!!(e!=null&&e.negativeInParentheses&&n),a=t?y(i):i;try{if(e!=null&&e.useSuffix){const{power:s,suffix:l}=v(a,r),m=x(a,s),I=`${f(m,new Intl.NumberFormat(r,{style:"currency",currency:c,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}))}${l}`;return t?`(${I})`:I}const u=f(a,new Intl.NumberFormat(r,{style:"currency",currency:c,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}));return t?`(${u})`:u}catch{const u=y(i),s=e!=null&&e.useSuffix?v(u,r):{power:0,suffix:""},l=D(x(u,s.power),{locale:r,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}),m=`${c} ${l}${s.suffix}`;return n?e!=null&&e.negativeInParentheses?`(${m})`:`-${m}`:m}}function M(i,e){if(i==null||Number.isNaN(i))return"";const r=g(e==null?void 0:e.locale),n=(e==null?void 0:e.alreadyPercent)??(e==null?void 0:e.percentValueMode)==="whole"?x(i,2):i;return f(n,new Intl.NumberFormat(r,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}))}function C(i,e){if(i==null||Number.isNaN(i))return"";const r=g(e==null?void 0:e.locale);return f(i,new Intl.NumberFormat(r,{notation:"scientific",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}))}function F(i,e){if(i==null||Number.isNaN(i))return"";const r=e.scale===void 0?i:B(i,e.scale),c=e.negativeStyle==="parentheses"&&h(r),n=c?y(r):r,t={style:e.type==="number"?"decimal":e.type,locale:e.locale,currency:e.currency,minimumFractionDigits:e.minimumFractionDigits,maximumFractionDigits:e.maximumFractionDigits,useGrouping:e.useGrouping,percentValueMode:e.percentValueMode,useSuffix:e.compact};let a;switch(e.type){case"currency":a=w(n,t);break;case"percent":a=M(n,t);break;case"scientific":a=C(n,t);break;default:a=D(n,t);break}const u=`${e.prefix??""}${a}${e.suffix??""}`;return c?`(${u})`:u}function X(i,e){return e.type==="duration"?i==null?"":o(i,e):F(i,e)}function p(i,e,r="en-US"){if(i==null||typeof i=="number"&&isNaN(i))return"";if((e==null?void 0:e.style)==="duration")return o(i,{...e.duration,prefix:e.prefix,suffix:e.suffix,negativeStyle:e.negativeStyle});const c=g((e==null?void 0:e.locale)||r),n=(e==null?void 0:e.style)||"decimal",t=n==="decimal"?"number":n;return t==="currency"&&new Intl.NumberFormat(c,{style:"currency",currency:(e==null?void 0:e.currency)||"USD"}),F(i,{type:t,locale:c,currency:t==="currency"?(e==null?void 0:e.currency)||"USD":void 0,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0,percentValueMode:t==="percent"?(e==null?void 0:e.percentValueMode)??"whole":void 0,scale:e==null?void 0:e.scale,compact:e==null?void 0:e.compact,negativeStyle:e==null?void 0:e.negativeStyle,prefix:e==null?void 0:e.prefix,suffix:e==null?void 0:e.suffix})}function ee(i,e,r){const c={style:e==="currency"?"currency":e==="percent"?"percent":"decimal",locale:r==null?void 0:r.locale,currency:r==null?void 0:r.currency,minimumFractionDigits:r==null?void 0:r.decimalPlaces,maximumFractionDigits:r==null?void 0:r.decimalPlaces,useSuffix:r==null?void 0:r.useSuffix,prefix:r==null?void 0:r.prefix,suffix:r==null?void 0:r.suffix,negativeInParentheses:r==null?void 0:r.negativeInParentheses,multiplyBy:r==null?void 0:r.multiplyBy};switch(e){case"currency":return w(i,c);case"percent":return M(i,c);case"scientific":return C(i,c);default:return D(i,c)}}const ie=["type","locale","minimumFractionDigits","maximumFractionDigits","useGrouping","prefix","suffix","negativeStyle","compact","scale","currency","percentValueMode"];function O(i){if(!b.isPlainJsonRecord(i))return{ok:!1,issues:[{path:"$",message:"Numeric format must be an object."}]};const e=[],r=new Set(ie);Object.keys(i).filter(t=>!r.has(t)).forEach(t=>e.push({path:t,message:`Unknown property "${t}".`})),i.type!=="number"&&i.type!=="currency"&&i.type!=="percent"&&i.type!=="scientific"&&e.push({path:"type",message:"Expected number, currency, percent, or scientific."});const c=i.locale===void 0?void 0:d.canonicalizeSupportedLocale(i.locale);i.locale!==void 0&&!c&&e.push({path:"locale",message:"Expected a supported BCP 47 locale."});const n=i.currency===void 0?void 0:d.canonicalizeSupportedCurrencyCode(i.currency);i.currency!==void 0&&!n&&e.push({path:"currency",message:"Expected a supported ISO 4217 currency code."});for(const t of["minimumFractionDigits","maximumFractionDigits"]){const a=i[t];a!==void 0&&(!Number.isInteger(a)||typeof a!="number"||a<0||a>20)&&e.push({path:t,message:"Expected an integer from 0 to 20."})}typeof i.minimumFractionDigits=="number"&&typeof i.maximumFractionDigits=="number"&&i.minimumFractionDigits>i.maximumFractionDigits&&e.push({path:"maximumFractionDigits",message:"Must be greater than or equal to minimumFractionDigits."});for(const t of["useGrouping","compact"])i[t]!==void 0&&typeof i[t]!="boolean"&&e.push({path:t,message:"Expected a boolean."});for(const t of["prefix","suffix"])i[t]!==void 0&&typeof i[t]!="string"&&e.push({path:t,message:"Expected a string."});return i.negativeStyle!==void 0&&i.negativeStyle!=="minus"&&i.negativeStyle!=="parentheses"&&e.push({path:"negativeStyle",message:"Expected minus or parentheses."}),i.percentValueMode!==void 0&&i.percentValueMode!=="fraction"&&i.percentValueMode!=="whole"&&e.push({path:"percentValueMode",message:"Expected fraction or whole."}),i.scale!==void 0&&(typeof i.scale!="number"||!Number.isFinite(i.scale))&&e.push({path:"scale",message:"Expected a finite number."}),e.length>0?{ok:!1,issues:e}:{ok:!0,value:{type:i.type,...c?{locale:c}:{},...i.minimumFractionDigits!==void 0?{minimumFractionDigits:i.minimumFractionDigits}:{},...i.maximumFractionDigits!==void 0?{maximumFractionDigits:i.maximumFractionDigits}:{},...i.useGrouping!==void 0?{useGrouping:i.useGrouping}:{},...i.prefix!==void 0?{prefix:i.prefix}:{},...i.suffix!==void 0?{suffix:i.suffix}:{},...i.negativeStyle!==void 0?{negativeStyle:i.negativeStyle}:{},...i.compact!==void 0?{compact:i.compact}:{},...i.scale!==void 0?{scale:i.scale}:{},...n?{currency:n}:{},...i.percentValueMode!==void 0?{percentValueMode:i.percentValueMode}:{}}}}function re(i){const e=O(i);if(!e.ok)return e;const r=[];return e.value.locale||r.push({path:"locale",message:"Resolved numeric formats require an explicit locale."}),e.value.minimumFractionDigits===void 0&&r.push({path:"minimumFractionDigits",message:"Resolved numeric formats require minimumFractionDigits."}),e.value.maximumFractionDigits===void 0&&r.push({path:"maximumFractionDigits",message:"Resolved numeric formats require maximumFractionDigits."}),e.value.type==="currency"&&!e.value.currency&&r.push({path:"currency",message:"Resolved currency formats require an explicit currency."}),r.length>0?{ok:!1,issues:r}:e}function ce(i){var c;const e=new Set;if(i.snapshot.resolvedFormats.forEach((n,t)=>{if(n.format.type!=="temporal_bucket"){if(n.scope.attachmentIndex!==void 0)throw new Error(`resolvedFormats.${t}.scope.attachmentIndex is not valid for a card export`);if(n.scope.dashboardId!==i.expectedScope.dashboardId||n.scope.cardId!==i.expectedScope.cardId)throw new Error(`resolvedFormats.${t}.scope must match the executing dashboard/card`);if(n.target.kind!=="column")throw new Error(`resolvedFormats.${t}.target must identify an export column`);if(e.has(n.target.columnKey))throw new Error(`resolvedFormats.${t} duplicates export column "${n.target.columnKey}"`);e.add(n.target.columnKey)}}),!i.useFormattedValues)return;if(!((c=i.visibleColumns)!=null&&c.length))throw new Error("visibleColumns must identify every formatted export column");const r=i.visibleColumns.find(n=>!e.has(n));if(r)throw new Error(`resolvedFormats is missing visible export column "${r}"`)}function _(i,e){const r=new Intl.NumberFormat(i,{style:"currency",currency:e}).resolvedOptions();return{minimumFractionDigits:r.minimumFractionDigits,maximumFractionDigits:r.maximumFractionDigits}}function te(i){if(i.minimumFractionDigits!==void 0||i.maximumFractionDigits!==void 0){const r=i.minimumFractionDigits??0;return{minimumFractionDigits:r,maximumFractionDigits:i.maximumFractionDigits??Math.max(r,2)}}const e=i.type==="percent"?1:i.type==="scientific"?2:0;return{minimumFractionDigits:e,maximumFractionDigits:e}}function ne(i,e,r){const c=d.canonicalizeSupportedLocale(i.locale)??e.locale,n=i.type==="number"||i.type==="currency"?d.canonicalizeSupportedCurrencyCode(r):void 0;if(!(i.type==="currency"||n!==void 0))return{...i,locale:c,...te(i)};const a=n??d.canonicalizeSupportedCurrencyCode(i.currency)??e.defaultCurrency,u=_(c,a),s=u.minimumFractionDigits??0,l=u.maximumFractionDigits??s,m=i.minimumFractionDigits??Math.min(s,i.maximumFractionDigits??s),$=i.maximumFractionDigits??Math.max(m,l);return{...i,type:"currency",locale:c,currency:a,minimumFractionDigits:m,maximumFractionDigits:$}}exports.formatCurrency=w;exports.formatDuration=R;exports.formatDurationCanonical=o;exports.formatMeasureCanonical=X;exports.formatNumber=D;exports.formatNumberCustom=ee;exports.formatNumberWithColumnSettings=p;exports.formatNumericCanonical=F;exports.formatPercent=M;exports.formatScientific=C;exports.parseNumericCanonicalFormat=O;exports.parseResolvedNumericCanonicalFormat=re;exports.resolveCurrencyFractionDigits=_;exports.resolveNumericPresentation=ne;exports.validateCardExportNumericPresentationSnapshot=ce;
@@ -1,14 +1,14 @@
1
1
  var U = Object.defineProperty;
2
2
  var j = (e, r, t) => r in e ? U(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
3
  var A = (e, r, t) => j(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { i as X } from "./index-C8w91oj4.js";
5
- import { g as L, i as H } from "./raw-temporal-BqOfk-xN.js";
6
- import { e as F, m as I, h as O, i as K, j as z } from "./matrix-formatter-CCXNRt3s.js";
4
+ import { i as X } from "./raw-temporal-7bFbXd2a.js";
5
+ import { g as L, i as H } from "./numeric-presentation-VhMUHfrJ.js";
6
+ import { e as F, m as I, h as O, i as K, j as z } from "./matrix-formatter-WBgtebUT.js";
7
7
  import { al as W, b5 as k, S } from "./validators-CsdOtZI6.js";
8
8
  import "./matrix-operation-contract-D32U2CSw.js";
9
9
  import { g as D } from "./matrix-definition-E5gXXSTZ.js";
10
10
  import { PDF_SAFETY_LIMIT_EXCEEDED as $, getUtf8ByteLength as Y, FAST_PDF_POLICY as q } from "../pdf-export-policy/index.js";
11
- import { f as J } from "./temporal-bucket-DlFuhCnT.js";
11
+ import { f as J } from "./temporal-bucket-PcLFSYWX.js";
12
12
  function Z(e, r, t) {
13
13
  const n = {
14
14
  ...r,