pivotkit-element 0.4.0 → 0.5.0
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/CHANGELOG.md +82 -1
- package/dist/THIRD_PARTY_LICENSES.txt +2 -2
- package/dist/chunks/chunk-4PHDW2LB.js +1 -0
- package/dist/chunks/chunk-5QXN3X2Q.js +1 -0
- package/dist/chunks/{chunk-VMHRXWK7.js → chunk-65G326ME.js} +1 -1
- package/dist/chunks/chunk-65O4Z5GI.js +1 -0
- package/dist/chunks/chunk-CCL5TDLA.js +6 -0
- package/dist/chunks/chunk-NSPPM3IJ.js +16 -0
- package/dist/chunks/chunk-PJA6QZ4Y.js +2 -0
- package/dist/chunks/chunk-QOKB5RDG.js +6 -0
- package/dist/chunks/chunk-SB3L4HHW.js +1 -0
- package/dist/chunks/chunk-WKVC2RPA.js +1 -0
- package/dist/chunks/chunk-XETFD6GR.js +1 -0
- package/dist/chunks/chunk-XR4CMFGN.js +1 -0
- package/dist/chunks/chunk-YUY4D5MF.js +8 -0
- package/dist/chunks/echarts-4DC3BQOK.js +5 -0
- package/dist/chunks/export-YHS47KGK.js +1 -0
- package/dist/chunks/import-csv-UCA275TR.js +1 -0
- package/dist/chunks/import-json-W4GCIW36.js +1 -0
- package/dist/chunks/import-ui-7XVUBL2H.js +1 -0
- package/dist/chunks/link-45LOEA7H.js +1 -0
- package/dist/chunks/menu-texts-de-74DWTJDI.js +1 -0
- package/dist/chunks/menus-XBN5D32E.js +2 -0
- package/dist/chunks/report-run-BZBFOMPF-4M6ACMUF.js +60 -0
- package/dist/chunks/unused-texts-Y4R67XSN-VYGDYJND.js +1 -0
- package/dist/chunks/unused-texts-de-6YVPTNVS-FL6CDBZX.js +1 -0
- package/dist/element.js +1 -1
- package/dist/import-worker.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +11 -5
- package/types/element.d.ts +11 -4
- package/types/jsx.d.ts +1 -1
- package/dist/chunks/chunk-D2E6EFC7.js +0 -6
- package/dist/chunks/chunk-FUHQLTFM.js +0 -1
- package/dist/chunks/chunk-IBQE3N74.js +0 -1
- package/dist/chunks/chunk-MB64GADT.js +0 -1
- package/dist/chunks/chunk-O2TTHYGT.js +0 -1
- package/dist/chunks/chunk-WNTTPBZ5.js +0 -9
- package/dist/chunks/chunk-WXBFHMFX.js +0 -1
- package/dist/chunks/echarts-42T6EZ6B.js +0 -18
- package/dist/chunks/export-6ILXDVGS.js +0 -6
- package/dist/chunks/import-csv-TPSP3I44.js +0 -1
- package/dist/chunks/import-json-NCJFIKAC.js +0 -1
- package/dist/chunks/import-ui-YBYWR3Q5.js +0 -1
- package/dist/chunks/link-52SWRX4P.js +0 -1
- package/dist/chunks/menu-texts-de-YZIOIWPD.js +0 -1
- package/dist/chunks/menus-UWW77KFI.js +0 -1
- package/dist/chunks/unused-texts-K3VFH65P-5EAURTYC.js +0 -1
- package/dist/chunks/unused-texts-de-OW4TGIVX-GHETGXFE.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,86 @@ All notable changes to `pivotkit-element` are documented in this file. The forma
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.5.0] - 2026-11-13
|
|
10
|
+
|
|
11
|
+
### Upgrading from 0.4
|
|
12
|
+
|
|
13
|
+
What a host checks; the [upgrade page](https://pivotkit.eize.dev/getting-started/upgrading/) has the details.
|
|
14
|
+
|
|
15
|
+
- **Breaking:** views, view files and links are written in format version 2; pivotkit 0.4 refuses
|
|
16
|
+
them as newer. Version 1 loads with the same result.
|
|
17
|
+
- **Breaking:** dark colours of a host go on `pivot-report[data-pk-theme="dark"]`, not on an attribute
|
|
18
|
+
of the page (`html[data-theme="dark"] pivot-report`): the Excel export and the HTML report read the light
|
|
19
|
+
theme by showing it on the report for a moment, and a rule on the page's attribute would put the
|
|
20
|
+
dark colours into the file.
|
|
21
|
+
- The colour scale's default is blue; red, yellow, green come back with `--pk-scale-low: #f8696b`,
|
|
22
|
+
`--pk-scale-mid: #ffeb84`, `--pk-scale-high: #63be7b` on the element (dark: `#c2413f`, `#b39a2e`,
|
|
23
|
+
`#3f9a5c`). `--pk-scale-mid` is no longer set.
|
|
24
|
+
- The label key `filter` is removed (a host's text for it is ignored).
|
|
25
|
+
- The font weights 550 and 650 are 600 (`--pk-weight-strong`).
|
|
26
|
+
- The chart's text is 14 px, not 12 px.
|
|
27
|
+
- Column subtotals are off by default: a start view or template without `totals.colSubtotals` adds
|
|
28
|
+
`totals: { colSubtotals: true }` to keep them.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- npm keywords `angular` (the Angular example) and `excel-export`.
|
|
33
|
+
- `dist/THIRD_PARTY_LICENSES.txt` is written by the repository's shared licence script, as for
|
|
34
|
+
pivotkit-xlsx; its text is unchanged ([#125](https://github.com/eizedev/pivotkit/issues/125)).
|
|
35
|
+
- The element bundles pivotkit-core's and pivotkit-react's totals ([#155](https://github.com/eizedev/pivotkit/issues/155), [#156](https://github.com/eizedev/pivotkit/issues/156)): column subtotals
|
|
36
|
+
off by default, no empty column or total rows without values, no subtotal for a group of one item,
|
|
37
|
+
the tip on column subtotals. Size budgets ([#198](https://github.com/eizedev/pivotkit/issues/198)): the first load to 170.5 KiB (168.6 measured on
|
|
38
|
+
a Mac, CI about 0.5 more), the link to 7.5 (7.2 measured, 0.1 below its old budget).
|
|
39
|
+
- npm keywords `pivot-grid` and `pivottable`, the terms people search for ([#172](https://github.com/eizedev/pivotkit/issues/172)).
|
|
40
|
+
- The element bundles pivotkit-core with view version 2 and pivotkit-react's filters for it
|
|
41
|
+
([#165](https://github.com/eizedev/pivotkit/issues/165)): views of version 1 load with the same
|
|
42
|
+
result. The first load grows by about 7.5 KiB (gzip), its budget to 169; the plain words of a
|
|
43
|
+
view's unused parts to 5.5.
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- pivotkit-react's `--pk-chart-text-size` (the chart's text, at least 14 px) and the HTML report's
|
|
48
|
+
font size tokens (`--pk-report-title-size`, `--pk-print-size`, `--pk-print-small`), set on the
|
|
49
|
+
element like every `--pk-*` token ([#220](https://github.com/eizedev/pivotkit/issues/220), [#221](https://github.com/eizedev/pivotkit/issues/221)). The first load grows by
|
|
50
|
+
about 0.1 KiB gzip (171.9 KiB measured on a Mac, CI 172.5), its budget to 173.
|
|
51
|
+
- pivotkit-react's tokens for corners, the code font, the focus ring and the chart's title and marks
|
|
52
|
+
([#216](https://github.com/eizedev/pivotkit/issues/216)): `--pk-radius-xs`, `--pk-radius-mark`, `--pk-radius-icon`, `--pk-radius-card`,
|
|
53
|
+
`--pk-radius-chart`, `--pk-font-mono`, `--pk-chart-title-size`, `--pk-focus-width`,
|
|
54
|
+
`--pk-focus-offset`, `--pk-glow-width` and `--pk-ring-width`, set on the element like every `--pk-*`
|
|
55
|
+
token. The first load grows by about 0.5 KiB gzip (171.4 KiB measured on a Mac, CI about 0.6
|
|
56
|
+
more), its budget to 172.5.
|
|
57
|
+
- pivotkit-react's font weight tokens ([#201](https://github.com/eizedev/pivotkit/issues/201)): `--pk-weight-normal`, `--pk-weight-medium`,
|
|
58
|
+
`--pk-weight-strong` and `--pk-weight-bold`, set on the element like every `--pk-*` token.
|
|
59
|
+
- Export → HTML report, Chart image (.svg) and Print or save as PDF (pivotkit-react), loaded as the
|
|
60
|
+
chunk group "report" on first use (19.9 KiB gzip); `pivot-export` has the kinds `html`, `svg` and
|
|
61
|
+
`print` ([#165](https://github.com/eizedev/pivotkit/issues/165)). ECharts' SVG renderer comes with
|
|
62
|
+
the chart chunks (215.8 KiB, budget 222.5) and pivotkit-core's describe module with the first load
|
|
63
|
+
(170.0 KiB, budget 171.5): esbuild puts a module where any importer of its barrel loads it.
|
|
64
|
+
- The property `importLimits` ([#169](https://github.com/eizedev/pivotkit/issues/169)), as
|
|
65
|
+
pivotkit-react's prop: the limits of a file loaded with `allow-import`, merged key by key over
|
|
66
|
+
`limits`; the page's data keeps `limits`. A property only, as `limits`.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- The element bundles pivotkit-core's and pivotkit-report's export fixes: CSV, XLSX, the HTML report
|
|
71
|
+
and the SVG leave out bidi controls, a print template's `<meta http-equiv>` takes no placeholder,
|
|
72
|
+
and a token value with a line break or `url(` is left out. The group "report" grows to 21.0 KiB
|
|
73
|
+
gzip (CI 21.1), its budget to 21.5.
|
|
74
|
+
- A workbook and an HTML report exported while the element shows the dark theme carry the tokens set
|
|
75
|
+
on the element for the light theme, `--pk-scale-mid` too ([#217](https://github.com/eizedev/pivotkit/issues/217)).
|
|
76
|
+
- The element bundles pivotkit-react's fixes: the Excel export in the report's theme colours, the
|
|
77
|
+
default colour scale from light to strong blue, a group's label at the top of its rows in the
|
|
78
|
+
workbook ([#212](https://github.com/eizedev/pivotkit/issues/212)), and an "i" inside a menu explained above the menu ([#213](https://github.com/eizedev/pivotkit/issues/213)).
|
|
79
|
+
- The element bundles pivotkit-react's fix of a hover description that closed while the pointer
|
|
80
|
+
paused between its "i" and it ([#213](https://github.com/eizedev/pivotkit/issues/213)).
|
|
81
|
+
- An app whose bundler reads `sideEffects` (Angular's build) no longer warns about, or may drop,
|
|
82
|
+
the chunks `dist/index.js` imports for their effects: `sideEffects` lists `dist/chunks/*.js` too
|
|
83
|
+
([#174](https://github.com/eizedev/pivotkit/issues/174)).
|
|
84
|
+
- An app that bundles the element (Angular's build) had no `import-worker.js`, so with
|
|
85
|
+
`allow-import` the element read files on the page and Firefox and WebKit logged the failed worker.
|
|
86
|
+
The docs and the Angular example copy `dist/import-worker.js` as an asset (`angular.json`), and the
|
|
87
|
+
example's test reads a CSV file in the worker ([#182](https://github.com/eizedev/pivotkit/issues/182)).
|
|
88
|
+
|
|
9
89
|
## [0.4.0] - 2026-11-11
|
|
10
90
|
|
|
11
91
|
### Added
|
|
@@ -237,7 +317,8 @@ First release.
|
|
|
237
317
|
thousands separators, CSV percentages and calculations as the table shows them, heatmaps without
|
|
238
318
|
grey empty cells.
|
|
239
319
|
|
|
240
|
-
[Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-element@0.
|
|
320
|
+
[Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-element@0.5.0...HEAD
|
|
321
|
+
[0.5.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-element@0.4.0...pivotkit-element@0.5.0
|
|
241
322
|
[0.4.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-element@0.3.0...pivotkit-element@0.4.0
|
|
242
323
|
[0.3.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-element@0.2.0...pivotkit-element@0.3.0
|
|
243
324
|
[0.2.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-element@0.1.0...pivotkit-element@0.2.0
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
pivotkit-element bundles the following packages. Their license texts follow; pivotkit-core
|
|
2
|
-
pivotkit-react are part of pivotkit (MIT, see LICENSE).
|
|
1
|
+
pivotkit-element bundles the following packages. Their license texts follow; pivotkit-core,
|
|
2
|
+
pivotkit-react and pivotkit-report are part of pivotkit (MIT, see LICENSE).
|
|
3
3
|
|
|
4
4
|
==============================================================================
|
|
5
5
|
@dnd-kit/accessibility 3.1.1 (MIT)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as We,B as Ye,C as qe,D as Oe,a as Ve,f as B,g as X,i as Be,j as h,l as Q,m as D,n as k,o as m,p as I,q as p,t as we,u as ee,v as Je,w as He,x as M}from"./chunk-XR4CMFGN.js";var F=()=>"number",zt=()=>"text";function Ut(e,t){let n=new Float64Array(t);if(!e)return{add:r=>{n[r]++},get:r=>n[r]};let o=e.codes;return{add:(r,s)=>{o[s]!==-1&&n[r]++},get:r=>n[r]}}function Ge(e,t){let n=new Array(t),o=e.codes;return{sets:n,add:(r,s)=>{let i=o[s];if(i===-1)return;let a=n[r];a===void 0&&(a=n[r]=new Set),a.add(i)}}}function xt(e,t){let n=new Float64Array(t),o=e.values;return{add:(r,s)=>{let i=o[s];i===i&&(n[r]+=i)},get:r=>n[r]}}function Pt(e,t){let n=new Float64Array(t),o=new Float64Array(t),r=e.values;return{add:(s,i)=>{let a=r[i];a===a&&(n[s]+=a,o[s]++)},get:s=>o[s]>0?n[s]/o[s]:null}}function Ze(e){return(t,n)=>{let o=new Float64Array(n).fill(NaN),r=t.values;return{add:(s,i)=>{let a=r[i];a===a&&!(o[s]*e>=a*e)&&(o[s]=a)},get:s=>Number.isNaN(o[s])?null:o[s]}}}function Vt(e,t){let n=new Array(t),o=e.values;return{add:(r,s)=>{let i=o[s];i===i&&(n[r]??=[]).push(i)},get:r=>{let s=n[r];if(!s||s.length===0)return null;let i=Float64Array.from(s).sort(),a=i.length>>1;return i.length%2?i[a]:(i[a-1]+i[a])/2}}}function te(e,t){return(n,o)=>{let r=new Float64Array(o),s=new Float64Array(o),i=new Float64Array(o),a=n.values;return{add:(u,l)=>{let c=a[l];if(c===c){let f=++r[u],d=c-s[u];s[u]+=d/f,i[u]+=d*(c-s[u])}},get:u=>{let l=r[u],c=e?l-1:l;if(c<=0)return null;let f=Math.max(0,i[u])/c;return t?Math.sqrt(f):f}}}}function Ke(e){return(t,n,o)=>{let r=new Int32Array(n).fill(-1),s=t.codes;return{add:(i,a)=>{let u=s[a];if(u===-1)return;let l=r[i];(l===-1||(e?o[u]>o[l]:o[u]<o[l]))&&(r[i]=u)},get:i=>{let a=r[i];if(a===-1)return null;let u=t.dict[a];return typeof u=="boolean"?String(u):u}}}}var ne=e=>e==="date"?"date":"number",Xe=e=>e==="date"?"date":e==="number"?"number":"text",Te=Object.freeze({count:{numeric:!1,additive:!0,resultType:F,create:Ut},countUnique:{numeric:!1,keepsValues:!0,resultType:F,create:(e,t)=>{let n=Ge(e,t);return{add:n.add,get:o=>n.sets[o]?n.sets[o].size:0}}},listUnique:{numeric:!1,keepsValues:!0,resultType:zt,create:(e,t,n,o)=>{let r=Ge(e,t);return{add:r.add,get:s=>{let i=r.sets[s];return i?[...i].sort((a,u)=>n[a]-n[u]).map(o).join(", "):null}}}},sum:{numeric:!0,additive:!0,resultType:F,create:xt},average:{numeric:!0,dates:!0,resultType:ne,create:Pt},median:{numeric:!0,dates:!0,keepsValues:!0,resultType:ne,create:Vt},min:{numeric:!0,dates:!0,resultType:ne,create:Ze(-1)},max:{numeric:!0,dates:!0,resultType:ne,create:Ze(1)},stdev:{numeric:!0,resultType:F,create:te(!0,!0)},stdevp:{numeric:!0,resultType:F,create:te(!1,!0)},var:{numeric:!0,resultType:F,create:te(!0,!1)},varp:{numeric:!0,resultType:F,create:te(!1,!1)},first:{numeric:!1,resultType:Xe,create:Ke(!1)},last:{numeric:!1,resultType:Xe,create:Ke(!0)}}),Ne=Object.freeze(Object.keys(Te));function J(e){return typeof e=="string"&&Object.hasOwn(Te,e)?Te[e]:null}function Se(e,t){let n=J(e);return n?n.numeric?t==="number"||t==="boolean"||t==="null"||t==="date"&&n.dates===!0:!0:!1}function dr(e){return Ne.filter(t=>Se(t,e))}var ve=ee(128);function S(e,t={}){return ve.getOrSet(`n|${e}|${JSON.stringify(t)}`,()=>new Intl.NumberFormat(e,t))}function A(e,t){return ve.getOrSet(`d|${e}|${JSON.stringify(t)}`,()=>new Intl.DateTimeFormat(e,t))}function Qe(e){return ve.getOrSet(`c|${e}`,()=>new Intl.Collator(e,{numeric:!0,sensitivity:"base"}))}var Bt={dateStyle:"medium",timeZone:"UTC"},Jt={dateStyle:"medium",timeStyle:"short",timeZone:"UTC"},et=Object.freeze({blank:"(blank)",total:"{label} Total",grandTotal:"Grand Total",values:"Values",valueName:"{agg} of {field}",countRows:"Count",true:"true",false:"false",aggregators:Object.freeze({count:"Count",countUnique:"Count Unique",listUnique:"List Unique",sum:"Sum",average:"Average",median:"Median",min:"Min",max:"Max",stdev:"StdDev",stdevp:"StdDevP",var:"Var",varp:"VarP",first:"First",last:"Last"}),showAsName:"{showAs} of {value}",showAs:Object.freeze({percentOfGrandTotal:"% of grand total",percentOfRowTotal:"% of row total",percentOfColumnTotal:"% of column total",percentOfParentRow:"% of parent row",percentOfParentColumn:"% of parent column",differenceFromPrevious:"Difference from previous",percentDifferenceFromPrevious:"% difference from previous",runningTotal:"Running total",percentRunningTotal:"% running total",rankAscending:"Rank (smallest first)",rankDescending:"Rank (largest first)"})});function br(e,t){let n=t&&t.fields;if(!n||typeof n!="object"||typeof e!="string")return e;let o=i=>typeof n[i]=="string"&&n[i].trim()!=="";if(Object.hasOwn(n,e)&&o(e))return n[e];let r=e.toLowerCase(),s=Object.keys(n).find(i=>i.toLowerCase()===r&&o(i));return s===void 0?e:n[s]}function tt(e,t,n,o=et){if(t==null)return o.blank??et.blank;if(e.labeler)return e.labeler(t,n);switch(e.type){case"date":return A(n,e.dateOnly?Bt:Jt).format(new Date(Number(t)));case"boolean":return t?o.true??"true":o.false??"false";default:return String(t)}}function Ht(e,t,n){let o=e==null,r=t==null;if(o||r)return o===r?0:o?1:-1;let s=typeof e=="number"||typeof e=="boolean",i=typeof t=="number"||typeof t=="boolean";return s&&i?Number(e)-Number(t):s!==i?s?-1:1:Qe(n).compare(String(e),String(t))}function hr(e,t,n){return n.getOrSet(`ranks:${e.id}:${t}`,()=>{let o=e.dict.map((s,i)=>i);o.sort((s,i)=>Ht(e.dict[s],e.dict[i],t)||s-i);let r=new Int32Array(o.length);return o.forEach((s,i)=>{r[s]=i}),r})}function wr(e,t){return String(e).replace(/\{(\w+)\}/g,(n,o)=>Object.hasOwn(t,o)?String(t[o]):n)}var _=Object.freeze({case:"insensitive",whitespace:"collapse"}),ke=Object.freeze(["insensitive","sensitive"]),Ae=Object.freeze(["collapse","exact"]),Wt=/\s+/g;function C(e,t=_){let n=typeof e=="string"?e:String(e);return(t.whitespace??_.whitespace)==="collapse"&&(n=n.replace(Wt," ").trim()),(t.case??_.case)==="insensitive"?n.toLowerCase():n}var Ce=1e-9;function nt(e){let t=new Date(e),n=(t.getUTCDay()+6)%7,o=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()-n+3),r=new Date(o).getUTCFullYear(),s=new Date(Date.UTC(r,0,4)),i=s.getTime()+(3-(s.getUTCDay()+6)%7)*h,a=1+Math.round((o-i)/(7*h));return{year:r,week:a}}var Yt=(e,t)=>A(t,{month:"short",timeZone:"UTC"}).format(new Date(Date.UTC(2e3,e-1,1))),qt=(e,t)=>{let n=Math.floor(e/100),o=e-n*100,r=new Date(0);return r.setUTCFullYear(n,o-1,1),A(t,{month:"short",year:"numeric",timeZone:"UTC",era:n<=0?"short":void 0}).format(r)},Gt=(e,t)=>A(t,{weekday:"short",timeZone:"UTC"}).format(new Date(Date.UTC(2024,0,e))),vr=Object.freeze(["year","yearQuarter","yearMonth","yearWeek","day"]),kr=Object.freeze(["quarter","month","week","weekday","hour"]),v=Object.freeze({year:{source:"date",type:"number",value:e=>e.getUTCFullYear(),label:e=>String(e)},quarter:{source:"date",type:"number",value:e=>Math.floor(e.getUTCMonth()/3)+1,label:e=>`Q${e}`},month:{source:"date",type:"number",value:e=>e.getUTCMonth()+1,label:Yt},week:{source:"date",type:"number",value:e=>nt(e.getTime()).week,label:e=>`W${Q(e)}`},day:{source:"date",type:"date",value:e=>Math.floor(e.getTime()/h)*h},hour:{source:"date",type:"number",value:e=>e.getUTCHours(),label:e=>`${Q(e)}:00`},weekday:{source:"date",type:"number",value:e=>(e.getUTCDay()+6)%7+1,label:Gt},yearQuarter:{source:"date",type:"number",value:e=>e.getUTCFullYear()*10+Math.floor(e.getUTCMonth()/3)+1,label:e=>`Q${e-Math.floor(e/10)*10} ${Math.floor(e/10)}`},yearMonth:{source:"date",type:"number",value:e=>e.getUTCFullYear()*100+e.getUTCMonth()+1,label:qt},yearWeek:{source:"date",type:"number",value:e=>{let t=nt(e.getTime());return t.year*100+t.week},label:e=>`${Math.floor(e/100)}-W${Q(e%100)}`},bin:{source:"number",type:"number"}}),Ar=Object.freeze(Object.keys(v)),Zt=Object.freeze([{unit:"day",maxDays:62},{unit:"yearMonth",maxDays:2*366},{unit:"yearQuarter",maxDays:6*366},{unit:"year",maxDays:1/0}]);function Cr(e,t){let n=e.column(t);if(!n||n.type!=="date"||n.derived)return null;let o=1/0,r=-1/0;for(let i of n.dict)typeof i=="number"&&(o=Math.min(o,i),r=Math.max(r,i));let s=(r-o)/h;return s>=1?Zt.find(i=>s<=i.maxDays).unit:null}function Kt(e,t){let n=Math.min(20,Math.max(we(e),we(t))),o=10**n,r=Math.round(e*o),s=Math.round(t*o),i=n<=15&&r>0&&Number.isSafeInteger(r)&&Number.isSafeInteger(s),a=u=>{let l=s+u*r;return i&&Number.isSafeInteger(l)?l/o:t+u*e};return{decimals:n,lowerOf(u){let l=Math.floor((u-t)/e);return Number.isSafeInteger(l)?(u>=a(l+1)?l++:u<a(l)&&l--,a(l)):NaN},upperOf(u){return a(Math.round((u-t)/e)+1)}}}function $r(e,t){let n=e.column(t.field),o=Object.hasOwn(v,t.by)?v[t.by]:null;if(!n||!n.values||!o||n.type!==o.source)return null;let r=`derived:${n.key}:${t.by}:${t.size??""}:${t.origin??""}`,s=e.cache.getOrSet(r,()=>Qt(n,t,o,r));return s.name===t.name?s:{...s,name:t.name,key:t.name.toLowerCase()}}var rt=9999;function Xt(e,t){return e.decimals>0?!1:t.every(n=>Math.abs(n)<=rt&&Math.abs(e.upperOf(n))<=rt)}function Qt(e,t,n,o){let r=e.values.length,s=new Int32Array(r),i=new Float64Array(r),a=[],u=new Map,l=t.by==="bin"?Kt(t.size,t.origin??0):null,c=new Date(0);for(let d=0;d<r;d++){let g=e.values[d],y=NaN;if(Number.isNaN(g)||(l?y=l.lowerOf(g):(c.setTime(g),y=n.value(c))),Number.isNaN(y)){s[d]=-1,i[d]=NaN;continue}let b=u.get(y);b===void 0&&(b=a.length,a.push(y),u.set(y,b)),s[d]=b,i[d]=y}let f={name:t.name,key:t.name.toLowerCase(),id:o,type:n.type,codes:s,dict:a,values:i,derived:!0};if(n.type==="date")f.dateOnly=!0;else if(l){let d=!Xt(l,a);f.labeler=(g,y)=>{let b=S(y,{maximumFractionDigits:l.decimals,signDisplay:"negative",useGrouping:d});return`${b.format(g)} \u2013 ${b.format(l.upperOf(g))}`}}else f.labeler=n.label;return f}var H=Object.freeze(["hour","day","week","month","quarter","year"]),W=Object.freeze(["last","next","this","before"]),U=500,Y=Object.freeze(["today","latest","first"]),L=1,$e=36e5,$=(e,t,n)=>new Date(0).setUTCFullYear(e,t,n);function re(e,t,n=L,o=0){if(e==="hour"){let u=(Math.floor(t/$e)+o)*$e;return M(u)?u:NaN}let r=new Date(t),[s,i,a]=[r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()];switch(e){case"day":return $(s,i,a+o);case"week":return $(s,i,a-((r.getUTCDay()||7)-n+7)%7+7*o);case"month":return $(s,i+o,1);case"quarter":return $(s,i-i%3+3*o,1);default:return $(s+o,0,1)}}function ot(e,t,n){if(e==="hour"||e==="day"||e==="week"){let l=t+n*(e==="hour"?$e:e==="day"?h:7*h);return M(l)?l:NaN}let o=n*(e==="month"?1:e==="quarter"?3:12),r=new Date(t),s=t-$(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i=$(r.getUTCFullYear(),r.getUTCMonth()+o,1);if(Number.isNaN(i))return NaN;let a=new Date(i),u=new Date($(a.getUTCFullYear(),a.getUTCMonth()+1,0)).getUTCDate();return $(a.getUTCFullYear(),a.getUTCMonth(),Math.min(r.getUTCDate(),u))+s}function Ee(e,t,n=L){let{unit:o,calendar:r,includeCurrent:s}=e,i=e.count??1,a=(f,d)=>({from:Number.isNaN(f)?-1/0:f,to:Number.isNaN(d)?1/0:d}),u=f=>re(o,t,n,f);if(e.direction==="this")return a(u(0),u(1));let l=s?0:1;if(e.direction==="next")return r?a(u(l),u(i+l)):a(t,ot(o,t,i)+1);let c=r?a(u(1-i-l),u(1-l)):a(ot(o,t,-i),t+1);return e.direction==="before"?{from:-1/0,to:c.from}:c}var st=Object.freeze(["equals","contains","beginsWith","endsWith"]),en=Object.freeze(["value","label"]),ae=Object.freeze(["=",">",">=","<","<=","between"]),it=Object.freeze(["year","quarter","month","day","hour"]),at=Object.freeze(["first","all"]),Ie=Object.freeze(["exclude","include","only"]),ut=Object.freeze({notEquals:"equals",notContains:"contains","!=":"=",notBetween:"between"}),R=(e,t)=>typeof e=="string"&&t.includes(e)?e:null;function tn(e,t,n,o){let r=C(t,o);switch(e){case"equals":return r===n;case"contains":return r.includes(n);case"beginsWith":return r.startsWith(n);case"endsWith":return r.endsWith(n);default:return!1}}function ct(e,t,n,o){if(typeof t!="number"||Number.isNaN(t))return!1;let r=Math.min(n,o??n),s=Math.max(n,o??n);switch(e){case"=":return t===n;case">":return t>n;case">=":return t>=n;case"<":return t<n;case"<=":return t<=n;case"between":return t>=r&&t<=s;default:return!1}}var nn=e=>Math.floor(e/h)*h,ue=e=>new Date(e).toISOString().slice(0,-14);function Pr(e,t,n){n=D(n,"relativeDateRange");let o=n.direction??"last",r=n.anchor??"today",s=n.weekStart??L,i=o==="this"||Number.isInteger(t)&&t>=1&&t<=U;if(!H.includes(e)||!W.includes(o)||!i||!Number.isInteger(s)||s<1||s>7||ft(r)===null||r==="latest"&&n.latest===void 0||r==="first"&&n.first===void 0)return null;let a=We(n.timeZone),u=r==="latest"?Me(n.latest,a):r==="first"?Me(n.first,a):r==="today"?Me(n.now,a):je(r),l={direction:o,unit:e,count:t,calendar:n.calendar??!0,includeCurrent:n.includeCurrent??!0},{from:c,to:f}=Ee(l,u,s);if(!Number.isFinite(f)||o!=="before"&&!Number.isFinite(c))return null;let d=y=>!Number.isFinite(y)||y%h===0;if(d(c)&&d(f))return{from:Number.isFinite(c)?ue(c):null,to:ue(f-h)};let g=y=>new Date(y).toISOString().slice(0,16);return{from:Number.isFinite(c)?g(c):null,to:g(f-1)}}var je=e=>{let t=typeof e=="string"&&!Y.includes(e)?j("date",e):void 0;return typeof t=="number"?t:NaN};function ft(e){if(typeof e=="string"&&Y.includes(e))return e;let t=je(e);return M(t)?t%h===0?ue(t):new Date(t).toISOString().slice(0,19):null}function Me(e,t){let n=qe(t),o=Oe(e===void 0?Date.now():e,r=>M(r)?n(r):NaN);if(!M(o))throw new Ve("INVALID_OPTION","now must be a Date, epoch milliseconds or an ISO date string");return o}function j(e,t){if(t===null)return null;switch(e){case"number":{let n=typeof t=="number"?t:typeof t=="string"&&t.trim()!==""?Number(t):NaN;return Number.isFinite(n)?n:void 0}case"date":{let n=typeof t=="number"?t:typeof t=="string"?Oe(t,o=>o):NaN;return Number.isFinite(n)?n:void 0}case"boolean":return typeof t=="boolean"?t:t==="true"?!0:t==="false"?!1:void 0;default:return typeof t=="string"&&t.length<=B||typeof t=="number"||typeof t=="boolean"?String(t):void 0}}function Re(e,t,n,o){let r=j(e.type,t);return r===void 0&&(typeof t=="string"&&t.length>B?o.issue(n,`an item longer than ${B} characters`,"itemTooLong",{max:B}):o.issue(n,`item ${JSON.stringify(t)} does not fit the ${e.type} field`,"itemType",{value:p(t),type:e.type})),r}function le(e,t,n,o){let r=m(e,"not");r!==void 0&&typeof r!="boolean"&&o.issue(`${n}.not`,"not must be true or false","filterNot",{value:p(r)});let s=m(e,"blanks");return s===void 0?o.strict&&o.warn(n,'says nothing about blank items; "exclude" is used',"blanksUnspecified"):Ie.includes(s)||o.issue(`${n}.blanks`,`unknown blanks ${JSON.stringify(s)}`,"filterBlanks",{value:p(s),...o.suggest(s,Ie)}),Object.assign(t,{not:r===!0,blanks:Ie.includes(s)?s:"exclude"})}function rn(e,t,n,o,r){let s=m(e,"items");if(!Array.isArray(s))return r.issue(o,"needs a list of items","filterNoItems");s.length>r.limits.items&&r.issue(`${o}.items`,`more than ${r.limits.items} items`,"tooManyItems",{max:r.limits.items}),t.items=[];for(let i of s.slice(0,r.limits.items)){let a=i===null?null:Re(n,i,`${o}.items`,r);a===null?r.issue(`${o}.items`,'null is no item: blank items are kept with blanks: "include" or "only"',"filterBlanks",{value:"null"}):a!==void 0&&(r.itemHint(n,a,`${o}.items`),t.items.push(a))}return le(e,t,o,r),r.strict&&t.items.length===0&&!t.not&&t.blanks==="exclude"&&r.warn(o,"keeps nothing: no items, no blanks","filterEmpty"),t}function on(e,t,n,o,r){let s=m(e,"not");return s!==void 0&&typeof s!="boolean"&&r.issue(`${o}.not`,"not must be true or false","filterNot",{value:p(s)}),Object.assign(t,{not:s===!0})}function sn(e,t,n,o,r){let s=m(e,"op"),i=R(s,st),a=m(e,"value");if(!i){let d=ce(s),g=d?{suggestion:d}:r.suggest(s,st);return r.issue(o,`unknown text operator ${JSON.stringify(s)}${mt(d)}`,"filterTextOp",{value:p(s),...g})}if(typeof a!="string"||a.length>r.limits.textValue)return r.issue(o,`needs a text value of at most ${r.limits.textValue} characters`,"filterText",{max:r.limits.textValue});let u=m(e,"on"),l=u===void 0?"value":R(u,en);if(!l)return r.issue(`${o}.on`,`unknown on ${JSON.stringify(u)}`,"unknownSetting",{value:p(u)});if(l==="value"&&n.type!=="string")return r.issue(o,`compares text: on a ${n.type} field it compares the label (on: "label")`,"filterFieldType",{field:n.name,type:n.type,value:"text",allowed:"string",suggestion:"label"});let c=m(e,"match"),f={..._};if(c!==void 0){let d=m(c,"case"),g=m(c,"whitespace");(!k(c)||d!==void 0&&!ke.includes(d)||g!==void 0&&!Ae.includes(g))&&r.issue(`${o}.match`,'match is { case: "insensitive" | "sensitive", whitespace: "collapse" | "exact" }',"filterMatch",{value:p(d??g??c)}),r.keys(c,an,`${o}.match`),f.case=ke.includes(d)?d:_.case,f.whitespace=Ae.includes(g)?g:_.whitespace}return Object.assign(t,{op:i,value:a,on:l,match:f}),le(e,t,o,r)}var an=Object.freeze(["case","whitespace"]),dt=(e,t)=>e.derived?t.derived.find(n=>n.name===e.name)?.by:void 0,un=e=>typeof e.value=="string";function ln(e,t,n,o,r,s){let i=dt(n,s),a=n.type==="date"||i!==void 0&&v[i].source==="date"&&typeof m(e,"value")=="string"&&j("number",m(e,"value"))===void 0,u=m(e,"precision"),l=u===void 0?"day":R(u,it);if(!a&&u!==void 0)r.issue(`${o}.precision`,"a precision compares dates only","filterPrecision",{value:p(u)});else if(!l)return r.issue(o,`unknown precision ${JSON.stringify(u)}`,"filterPrecision",{value:p(u),...r.suggest(u,it)});let c=T=>{if(!a){let he=T===void 0?void 0:j("number",T);return typeof he=="number"?he:null}let V=T===void 0||n.type!=="date"&&typeof T!="string"?void 0:j("date",T);return typeof V=="number"&&M(V)?cn(V,l):null},f=m(e,"op"),d=R(f,ae);if(ce(f))return gt(f,o,"filterCompareValue",r,{type:n.type});let g=c(m(e,"value")),y=d==="between",b=y?c(m(e,"value2")):null;if(!d||g===null||y&&b===null){let T=d||f===void 0?{}:{value:p(f),...r.suggest(f,ae)};return r.issue(o,`needs an operator and ${y?"two values":"a value"} of the ${n.type} field`,"filterCompareValue",{type:n.type,...T})}return Object.assign(t,{op:d,value:g},y?{value2:b}:{},a?{precision:l}:{}),le(e,t,o,r)}function cn(e,t){let n=re(t,e);return t==="hour"?new Date(n).toISOString().slice(0,-8):ue(Number.isNaN(n)?nn(e):n)}function ce(e){return typeof e=="string"&&Object.hasOwn(ut,e)?ut[e]:null}var mt=e=>e?`; write "${e}" with not: true`:"";function gt(e,t,n,o,r={}){let s=ce(e);return o.issue(t,`unknown operator ${JSON.stringify(e)}${mt(s)}`,n,{...r,value:p(e),suggestion:s})}function fn(e,t,n,o,r){let s=m(e,"direction"),i=s===void 0?"last":R(s,W);if(!i)return r.issue(o,`unknown direction ${JSON.stringify(s)}`,"filterRelativeDirection",{value:p(s),...r.suggest(s,W)});let a=R(m(e,"unit"),H);if(!a)return r.issue(o,`unknown unit ${JSON.stringify(m(e,"unit"))}`,"filterRelativeUnit",{value:p(m(e,"unit")),...r.suggest(m(e,"unit"),H)});let u=m(e,"count"),l=I(u);if(i==="this"?u!==void 0:l===null||!Number.isInteger(l)||l<1||l>U){let g=i==="this"?'"this" is the current unit alone and has no count':`${u===void 0?"count is missing: a":"needs a"} whole count from 1 to ${U}`;return r.issue(o,g,"filterRelativeCount",{max:U,...u===void 0?{}:{value:p(u)}})}let c=g=>{let y=m(e,g);return y!==void 0&&typeof y!="boolean"&&r.issue(`${o}.${g}`,`${g} must be true or false`,"unknownSetting",{value:p(y)}),typeof y=="boolean"?y:!0},f=m(e,"anchor"),d=f===void 0?"today":ft(f);return d?(Object.assign(t,{direction:i,unit:a},i==="this"?{}:{count:l},{calendar:c("calendar"),includeCurrent:c("includeCurrent"),anchor:d}),le(e,t,o,r)):r.issue(o,`unknown anchor ${JSON.stringify(f)}`,"filterRelativeAnchor",{value:p(f),...r.suggest(f,Y)})}function pt(e,t,n,o){let r=m(e,"by"),s=r===void 0?n.defaultRef(o):n.valueRef(r,`${t}.by`);return s&&n.resultType(s)!=="number"?(n.issue(`${t}.by`,`${s.agg} gives no number to filter by`,"filterNotNumber",{agg:s.agg}),null):s}function dn(e,t,n,o,r,s){let i=pt(e,o,r,s);if(!i)return;let a=I(m(e,"count"));if(a===null||a<1||a>r.limits.topCount||!Number.isInteger(a))return r.issue(o,"needs a whole count of 1 or more","filterCount",{max:r.limits.topCount});let u=m(e,"bottom"),l=m(e,"ties"),c=l===void 0?"first":R(l,at);return c||r.issue(`${o}.ties`,`unknown ties ${JSON.stringify(l)}`,"filterTies",{value:p(l),...r.suggest(l,at)}),Object.assign(t,{by:i,count:a,bottom:typeof u=="boolean"?u:!1,ties:c??"first"})}function mn(e,t,n,o,r,s){let i=pt(e,o,r,s);if(!i)return;let a=m(e,"op");if(ce(a))return gt(a,o,"filterValue",r);let u=R(a,ae),l=I(m(e,"value"));if(!u||l===null){let f=u||a===void 0?{}:{value:p(a),...r.suggest(a,ae)};return r.issue(o,"needs an operator and a number","filterValue",f)}let c=m(e,"not");if(c!==void 0&&typeof c!="boolean"&&r.issue(`${o}.not`,"not must be true or false","filterNot",{value:p(c)}),Object.assign(t,{by:i,op:u,value:l,not:c===!0}),u==="between"){let f=I(m(e,"value2"));if(f===null)return r.issue(o,`${u} needs value2`,"filterValue2",{value:u});t.value2=f}return t}function oe(e){return(t,n,o,r,s)=>{let i=e(t,n,o,r,s),a=new Uint8Array(i.length);if(a[0]=n.blanks==="exclude"?0:1,n.blanks!=="only"){let u=n.not?1:0;for(let l=1;l<i.length;l++)a[l]=i[l]^u}return a}}function gn(e,t){let n=new Map(e.dict.map((r,s)=>[r,s])),o=new Uint8Array(e.dict.length+1);for(let r of t.items){let s=n.get(r);s!==void 0&&(o[s+1]=1)}return o}function pn(e,t){let n=new Uint8Array(e.dict.length+1).fill(t.not?1:0);return n[0]=t.not?0:1,n}function yn(e,t,n){let o=C(t.value,t.match),r=new Uint8Array(e.dict.length+1);return e.dict.forEach((s,i)=>{r[i+1]=tn(t.op,t.on==="label"?tt(e,s,n):String(s),o,t.match)?1:0}),r}function bn(e,t){let n=e.type==="date",o=t.precision??"day",r=u=>n?j("date",u):u,[s,i]=[r(t.value),t.value2===void 0?void 0:r(t.value2)],a=new Uint8Array(e.dict.length+1);return e.dict.forEach((u,l)=>{a[l+1]=ct(t.op,n&&typeof u=="number"?re(o,u):u,s,i)?1:0}),a}function hn(e){let t=-1/0;for(let n of e.dict)typeof n=="number"&&n>t&&(t=n);return Number.isFinite(t)?t:null}function wn(e){let t=1/0;for(let n of e.dict)typeof n=="number"&&n<t&&(t=n);return Number.isFinite(t)?t:null}function On(e,t,n,o,r){let s=t.anchor==="today"?o:t.anchor==="latest"?hn(e)??o:t.anchor==="first"?wn(e)??o:je(t.anchor),{from:i,to:a}=Ee(t,s,r);return Uint8Array.from([0,...e.dict],(u,l)=>l>0&&typeof u=="number"&&u>=i&&u<a?1:0)}function Tn(e,t){return Uint8Array.from(t,n=>typeof n=="number"&&!Number.isNaN(n)&&ct(e.op,n,e.value,e.value2)!==e.not?1:0)}function Nn(e,t,n){let o=new Uint8Array(n.length),r=new Map;n.forEach((s,i)=>{let a=s.slice(0,-1).join(",");r.has(a)||r.set(a,[]),r.get(a).push(i)});for(let s of r.values()){let i=s.filter(u=>typeof t[u]=="number").sort((u,l)=>(e.bottom?t[u]-t[l]:t[l]-t[u])||u-l),a=e.ties==="all"&&i.length>e.count?t[i[e.count-1]]:void 0;i.forEach((u,l)=>{(l<e.count||t[u]===a)&&(o[u]=1)})}return o}var w=(...e)=>Object.freeze(["field","type",...e]),ie=(e,t)=>typeof e.source=="function"?e.source(t):!!e.source,q=Object.freeze(["string","number","date","boolean"]),se=Object.freeze(["not","blanks"]),O=Object.freeze({in:{stage:"items",fields:q,keys:w("items",...se),required:w("items"),normalize:rn,allowed:oe(gn)},blank:{stage:"items",fields:q,keys:w("not"),required:w(),normalize:on,allowed:pn},text:{stage:"items",fields:q,keys:w("op","value","on","match",...se),required:w("op","value"),normalize:sn,allowed:oe(yn)},compare:{stage:"items",fields:Object.freeze(["number","date"]),keys:w("op","value","value2","precision",...se),required:w("op","value"),normalize:ln,allowed:oe(bn),source:un},relative:{stage:"items",fields:Object.freeze(["date","dateGrouping"]),keys:w("direction","unit","count","calendar","includeCurrent","anchor",...se),required:w("unit"),normalize:fn,allowed:oe(On),source:!0},top:{stage:"values",fields:q,keys:w("by","count","bottom","ties"),required:w("count"),normalize:dn,keep:Nn},value:{stage:"values",fields:q,keys:w("by","op","value","value2","not"),required:w("op","value"),normalize:mn,keep:Tn}}),Vr=Object.freeze(Object.keys(O)),De=Object.freeze({include:"in",exclude:"in",label:"text"});function yt(e,t){let n=dt(e,t);return n!==void 0&&v[n].source==="date"?[e.type,"dateGrouping"]:[e.type]}var bt=e=>e==="string"?"text":e==="number"||e==="date"?"compare":"in",Sn=Object.freeze(["blank","text","compare","relative"]);function Br(e,t,n,o,r,s){let i=e.filters.filter(d=>d.field.toLowerCase()===t.toLowerCase()&&Sn.includes(d.type));if(!i.length)return null;let a=i.some(d=>d.type==="relative")?s():0,u=d=>O[d.type].allowed(ie(O[d.type],d)?o:n,d,r,a,e.formatting.weekStart),l=i.filter(d=>!ie(O[d.type],d)).map(u),c=i.filter(d=>ie(O[d.type],d)).map(u),f=new Uint8Array(n.dict.length+1);for(let d=0;d<n.codes.length;d++){let g=n.codes[d]+1;!f[g]&&l.every(y=>y[g]===1)&&c.every(y=>y[o.codes[d]+1]===1)&&(f[g]=1)}return f}function lt(e,t){let n=0,o=new Int32Array(e.length);for(let r=0;r<e.length;r++)t(e[r],r)&&(o[n++]=e[r]);return o.slice(0,n)}function Jr(e,t,n){let{view:o,columnOf:r,locale:s,today:i}=e,a=c=>o.derived.find(f=>f.name.toLowerCase()===c.toLowerCase())?.field??c;o.filters.forEach((c,f)=>{let d=O[c.type],g=r(ie(d,c)?a(c.field):c.field);if(d.stage!=="items"||!g)return;let y=d.allowed(g,c,s,i,o.formatting.weekStart),b=g.codes;t=lt(t,T=>y[b[T]+1]===1),n&&(n[f]=t.length)});let u=c=>{let f=o.rows.indexOf(c);if(f!==-1)return{fields:o.rows.slice(0,f+1),order:f};let d=o.cols.indexOf(c);return d!==-1?{fields:o.cols.slice(0,d+1),order:100+d}:{fields:[c],order:200}},l=o.filters.map((c,f)=>({f:c,i:f,...u(c.field)})).filter(({f:c})=>O[c.type].stage==="values").sort((c,f)=>c.order-f.order||c.i-f.i);for(let{f:c,i:f,fields:d}of l){let g=d.map(r);if(g.includes(null))continue;let{groupOf:y,paths:b}=e.groupBy(g,t),T=e.aggregateGroups(c.by,t,y,b.length),V=O[c.type].keep(c,T,b);t=lt(t,(he,Lt)=>V[y[Lt]]===1),n&&(n[f]=t.length)}return t}var Gr=Object.freeze(["number","integer","currency","percent","percent100","compact","bytes","duration","date","datetime","time","text"]),vn=20,Tt={ms:.001,s:1,min:60,h:3600,d:86400},kn=/^(number|integer|currency|percent|percent100|compact|bytes|duration|date|datetime|time|text)(?::([A-Za-z0-9]{1,10}))?$/,Fe=new Set(["number","percent","percent100"]),Nt={date:{dateStyle:"medium",timeZone:"UTC"},datetime:{dateStyle:"medium",timeStyle:"short",timeZone:"UTC"},time:{timeStyle:"short",timeZone:"UTC"}},An={signDisplay:"negative"},fe=null;function Cn(e){return fe===null&&(fe=typeof Intl.supportedValuesOf=="function"?new Set(Intl.supportedValuesOf("currency")):!1),fe?fe.has(e.toUpperCase()):/^[a-z]{3}$/i.test(e)}function me(e){if(typeof e!="string")return null;let t=kn.exec(e.trim().toLowerCase());if(!t)return null;let[,n,o]=t;return o!==void 0&&(n==="currency"&&!Cn(o)||n==="duration"&&!Object.hasOwn(Tt,o)||Fe.has(n)&&!(/^\d{1,2}$/.test(o)&&Number(o)<=vn)||!["currency","duration",...Fe].includes(n))?null:{name:n,arg:o,decimals:Fe.has(n)&&o!==void 0?Number(o):void 0}}function Zr(e,t){let n=me(e)||{name:"number",arg:void 0,decimals:void 0};switch(n.name){case"integer":return 0;case"number":return n.decimals??2;case"percent":case"percent100":return n.decimals??1;case"currency":return S(t,{style:"currency",currency:(n.arg||"EUR").toUpperCase()}).resolvedOptions().maximumFractionDigits??2;default:return null}}function St(e){return me(e)!==null}function G(e){return e==null||e===""?NaN:typeof e=="number"?e:Number(e)}var _e=(e,t)=>e===void 0?{maximumFractionDigits:t}:{minimumFractionDigits:e,maximumFractionDigits:e};function $n(e,t){if(!Number.isFinite(e))return"";let n=e<=-.05?"-":"",o=Math.abs(e);if(o<60)return`${n}${S(t,{maximumFractionDigits:1}).format(o)} s`;let r=[["d",86400],["h",3600],["min",60],["s",1]],s=r.findIndex(([,f])=>o>=f),[i,a]=r[s],u=Math.floor(o/a),l=[`${u} ${i}`],c=r[s+1];if(c){let f=Math.floor((o-u*a)/c[1]);f>0&&l.push(`${f} ${c[0]}`)}return n+l.join(" ")}function En(e,t){if(!Number.isFinite(e))return"";let n=["B","KB","MB","GB","TB","PB"],o=Math.abs(e),r=0;for(;o>=1024&&r<n.length-1;)o/=1024,r++;let s=S(t,{maximumFractionDigits:r===0?0:1}).format(o);return`${e<0&&/[1-9]/.test(s)?"-":""}${s} ${n[r]}`}function Le(e){return e==null?"":String(e)}function In(e,t){let n=me(e)||{name:"number",arg:void 0,decimals:void 0},o=r=>{let s=S(t,{...An,...r});return i=>{let a=G(i);return Number.isNaN(a)?Le(i):s.format(a)}};switch(n.name){case"text":return Le;case"integer":return o({maximumFractionDigits:0});case"currency":return o({style:"currency",currency:(n.arg||"EUR").toUpperCase()});case"percent":return o({style:"percent",..._e(n.decimals,1)});case"percent100":{let r=o({style:"percent",..._e(n.decimals,1)});return s=>r(G(s)/100)}case"compact":return o({notation:"compact",maximumFractionDigits:1});case"bytes":return r=>En(G(r),t);case"duration":{let r=Tt[n.arg||"s"];return s=>$n(G(s)*r,t)}case"date":case"datetime":case"time":{let r=A(t,Nt[n.name]);return s=>{let i=G(s);return Number.isFinite(i)?r.format(new Date(i)):Le(s)}}default:return o(_e(n.decimals,2))}}function Kr(e,t){return t=D(t,"formatter"),In(e,He(null,t.locale))}var ht=ee(64),de=e=>e.replace(/[^ :/-]+/g,t=>`"${t.replace(/"/g,"")}"`),ge=e=>e>0?"."+"0".repeat(e):"";function ze(e,t){if(!Number.isFinite(e)||Math.abs(e)>=1e21)return 0;let n=Math.abs(e).toFixed(t).replace(/0+$/,""),o=n.indexOf(".");return o===-1?0:n.length-o-1}function wt(e,t,n=!0){let o="",r="",s=!1;for(let i of e)i.type==="integer"||i.type==="group"||i.type==="decimal"||i.type==="fraction"||i.type==="minusSign"||i.type==="percentSign"&&n?(o+=de(r),r="",i.type==="minusSign"?o+="-":i.type==="percentSign"?o+="%":s||(o+=t,s=!0)):r+=i.value;return o+de(r)}function vt(e,t,n,o=!0){let r=wt(e.formatToParts(t),n,o),s=wt(e.formatToParts(-t),n,o);return s===`-${r}`?r:`${r};${s}`}function Mn(e,t){let n=S(t,{style:"currency",currency:e});return vt(n,1234.5,`#,##0${ge(n.resolvedOptions().maximumFractionDigits)}`)}function Ot(e,t,n){return vt(S(t,{style:"percent"}),.5,`#,##0${ge(e)}`,n)}function jn(e,t){if(!Number.isFinite(e)||e===0)return"#,##0";let n=S(t,{notation:"compact",maximumFractionDigits:1}).formatToParts(Math.abs(e)),o=n.filter(l=>l.type==="integer").map(l=>l.value).join(""),r=n.filter(l=>l.type==="fraction").map(l=>l.value).join(""),s=+`${o}.${r||0}`,i=s>0?Math.round(Math.log10(Math.abs(e)/s)):0;if(i<0||i%3!==0)return"General";let a=n.findIndex(l=>l.type==="integer"),u=n.slice(a).filter(l=>l.type==="compact"||l.type==="literal").map(l=>l.value).join("");return`#,##0${ge(r.length)}${",".repeat(i/3)}${de(u)}`}function Rn(e,t){return A(t,Nt[e]).formatToParts(new Date(Date.UTC(2026,0,5,3,4))).map(o=>{switch(o.type){case"year":return o.value.length===2?"yy":"yyyy";case"month":return/^\d+$/.test(o.value)?o.value.length===2?"mm":"m":"mmm";case"day":return o.value.length===2?"dd":"d";case"hour":return o.value.length===2?"hh":"h";case"minute":return"mm";case"second":return"ss";case"dayPeriod":return"AM/PM";case"weekday":return"ddd";default:return de(o.value)}}).join("")}function Xr(e,t,n){let o=me(e)||{name:"number",arg:void 0,decimals:void 0};switch(o.name){case"integer":return"#,##0";case"number":return`#,##0${ge(o.decimals??ze(t,2))}`;case"percent":return Ot(o.decimals??ze(t*100,1),n,!0);case"percent100":return Ot(o.decimals??ze(t,1),n,!1);case"currency":return ht.getOrSet(`${e}|${n}`,()=>Mn((o.arg||"EUR").toUpperCase(),n));case"compact":return jn(t,n);case"date":case"datetime":case"time":return ht.getOrSet(`${o.name}|${n}`,()=>Rn(o.name,n));case"text":return"@";default:return"General"}}var pe=Object.freeze({candidates:1e3,length:64,distance:3});function Dn(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let o=[],r=Array.from({length:t.length+1},(i,a)=>a),s=0;for(let i=1;i<=e.length;i++){let a=[i],u=i;for(let l=1;l<=t.length;l++){let c=Math.min(r[l]+1,a[l-1]+1,r[l-1]+(e[i-1]===t[l-1]?0:1));i>1&&l>1&&e[i-1]===t[l-2]&&e[i-2]===t[l-1]&&(c=Math.min(c,o[l-2]+1)),a.push(c),u=Math.min(u,c)}if(u>n&&s>=n)return n+1;s=u,o=r,r=a}return r[t.length]}function kt(e,t){if(typeof e!="string"||e.length>pe.length)return null;let n=C(e);if(n==="")return null;let o=Math.min(pe.distance,Math.max(1,Math.floor(n.length/3))),r=null,s=o+1,i=0;for(let a of t){if(i++>=pe.candidates)break;if(typeof a!="string"||a.length>pe.length)continue;let u=Dn(n,C(a),Math.min(o,s-1));if(u<s&&(r=a,s=u,u===0))break}return r}var z=(e,t)=>e===null||t===null||t===0?null:e/t;function Ue(e){let t=e.axis!=="cols",n=t?e.rowNode:e.colNode;return{node:n,at:r=>t?e.raw(r,e.colNode):e.raw(e.rowNode,r),siblings:n.parent?n.parent.children:[n]}}function At(e){return(t,n)=>{let{node:o,at:r,siblings:s}=Ue(n);if(!o.parent||o.index===0||t===null)return null;let i=r(s[o.index-1])??0;return e?z(t-i,i):t-i}}function Ct(e){return(t,n)=>{let{node:o,at:r,siblings:s}=Ue(n);if(!o.parent)return e?t===null?null:1:t;let i=0;for(let a=0;a<=o.index;a++)i+=r(s[a])??0;return e?z(i,r(o.parent)):i}}function $t(e){return(t,n)=>{let{node:o,at:r,siblings:s}=Ue(n);if(!o.parent||t===null)return null;let i=1;for(let a of s){let u=r(a);u!==null&&(e?u>t:u<t)&&i++}return i}}var ye=Object.freeze({percentOfGrandTotal:{format:"percent",compute:(e,t)=>z(e,t.raw(t.rowRoot,t.colRoot))},percentOfRowTotal:{format:"percent",compute:(e,t)=>z(e,t.raw(t.rowNode,t.colRoot))},percentOfColumnTotal:{format:"percent",compute:(e,t)=>z(e,t.raw(t.rowRoot,t.colNode))},percentOfParentRow:{format:"percent",compute:(e,t)=>z(e,t.raw(t.rowNode.parent??t.rowNode,t.colNode))},percentOfParentColumn:{format:"percent",compute:(e,t)=>z(e,t.raw(t.rowNode,t.colNode.parent??t.colNode))},differenceFromPrevious:{format:"number",alongAxis:!0,compute:At(!1)},percentDifferenceFromPrevious:{format:"percent",alongAxis:!0,compute:At(!0)},runningTotal:{format:"number",alongAxis:!0,additive:!0,compute:Ct(!1)},percentRunningTotal:{format:"percent",alongAxis:!0,additive:!0,compute:Ct(!0)},rankAscending:{format:"integer",alongAxis:!0,compute:$t(!1)},rankDescending:{format:"integer",alongAxis:!0,compute:$t(!0)}}),no=Object.freeze(Object.keys(ye));var Fn="(blank)";function _n(e,t,n){let o=t.toLowerCase(),r=n.toLowerCase();switch(e){case"equals":return o===r;case"notEquals":return o!==r;case"contains":return o.includes(r);case"notContains":return!o.includes(r);case"beginsWith":return o.startsWith(r);case"endsWith":return o.endsWith(r);default:return!1}}var Et=Object.freeze({notEquals:"equals",notContains:"contains","!=":"=",notBetween:"between"}),xe=e=>typeof e=="string"&&Object.hasOwn(Et,e)?{op:Et[e],not:!0}:{},Pe=(e,t)=>m(e,"blanks")===void 0?{blanks:t}:{};function Ln(e){if(!k(e))return e;let t=e,n=m(t,"type"),o=m(t,"op");switch(n){case"include":case"exclude":{let r=m(t,"items"),s=n==="exclude"?{not:!0}:{};if(!Array.isArray(r))return{...t,type:"in",...s};let i=r.includes(null),a=n==="include"?i:!i;return{...t,type:"in",items:r.filter(u=>u!==null),...s,...Pe(t,a?"include":"exclude")}}case"label":{let r=m(t,"value"),s=typeof r=="string"?Pe(t,_n(o,Fn,r)?"include":"exclude"):{};return{...t,type:"text",on:"label",match:{case:"insensitive",whitespace:"exact"},...xe(o),...s}}case"compare":case"relative":return{...t,...xe(o),...Pe(t,"exclude")};case"value":return{...t,...xe(o)};default:return t}}function It(e){let t=m(e,"filters");return Array.isArray(t)?{...e,filters:t.map(Ln)}:e}var Rt=2,Dt=zn({notView:"error schema",notJson:"error",tooLarge:"error",badVersion:"error schema",newerVersion:"error schema",noMigration:"error",unknownKey:"error schema",notList:"error schema",tooMany:"error schema",tooManyItems:"error schema",itemType:"error",itemTooLong:"error schema",itemCase:"warning",unknownField:"error",placedTwice:"error",groupingNoName:"error schema",groupingNameTaken:"error",groupingNoSource:"error",groupingUnknown:"error schema",binsNeedNumber:"error",groupingNeedsDate:"error",binSize:"error schema",notValueRef:"error schema",unknownAggregator:"error schema",aggregatorNeedsField:"error schema",aggregatorType:"error",unknownFormat:"error",badLabel:"error schema",unknownShowAs:"error schema",showAsNotAdditive:"error",showAsNotNumber:"error",unknownConditional:"error schema",conditionalNotNumber:"error",colorScaleColors:"error schema",dataBarColor:"error schema",unknownFilterType:"error schema",filterFieldType:"error",filterNoItems:"error schema",filterTextOp:"error schema",filterText:"error schema",filterMatch:"error schema",filterNot:"error schema",filterBlanks:"error schema",blanksUnspecified:"warning",filterEmpty:"warning",filterNotNumber:"error",filterCount:"error schema",filterTies:"error schema",filterPrecision:"error",filterValue:"error schema",filterValue2:"error schema",filterCompareValue:"error",filterRelativeDirection:"error schema",filterRelativeUnit:"error schema",filterRelativeCount:"error schema",filterRelativeAnchor:"error schema",sortNoItems:"error schema",sortedTwice:"error",badTotals:"error schema",collapsedPath:"error",unknownSetting:"error schema",badTitle:"error schema",unknownLocale:"error",unknownTimeZone:"error",timeZoneMismatch:"error",tooManyIssues:"warning"}),ho=Object.freeze(Object.keys(Dt));function zn(e){let t={};for(let[n,o]of Object.entries(e)){let[r,s]=o.split(" ");t[n]=Object.freeze({severity:r==="warning"?"warning":"error",schema:s==="schema"})}return Object.freeze(t)}function E(e,t,n,o,r=Dt[n].severity){return o?{path:e,message:t,code:n,severity:r,params:o}:{path:e,message:t,code:n,severity:r}}var Un=Object.freeze(["auto","bar","line","area","pie","donut","heatmap"]),wo=Object.freeze(["pie","donut"]),xn=Object.freeze(["table","chart"]),Oo=Object.freeze(["colorScale","dataBar"]),Pn=Object.freeze(["auto","off","value","percent","both"]),Vn=Object.freeze(["outside","inside"]),Bn=Object.freeze(["auto","bottom","right","off"]),Jn=Object.freeze(["auto","all","nth"]),Hn=Object.freeze(["auto","on","off"]),Mt=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function Z(){return{version:Rt,rows:[],cols:[],values:[],filters:[],derived:[],sort:[],totals:{grandTotalRow:!0,grandTotalColumn:!0,rowSubtotals:!0,colSubtotals:!1},collapsed:{rows:[],cols:[]},display:"table",chart:{type:"auto",stacked:!1,horizontal:!1,valueLabels:"auto",legend:"auto",title:null,smooth:!1,axisLabels:"auto",groupLabels:"auto",labelPosition:"outside"},formatting:{locale:null,timeZone:null,weekStart:L}}}var Wn=Object.freeze({1:It});function Yn(e){return qn(e,Wn,Rt)}function qn(e,t,n){let o=[];if(!k(e))return{view:null,issues:[E("","not a view object","notView")]};let r=m(e,"version")??1;if(!Number.isInteger(r)||r<1)return{view:null,issues:[E("version",`unknown version ${JSON.stringify(r)}`,"badVersion",{value:p(r)})]};if(r>n)return{view:null,issues:[E("version",`version ${r} is newer than this pivotkit-core reads (${n}); update pivotkit-core`,"newerVersion",{value:r,max:n})]};let s=e;for(let i=r;i<n;i++){let a=t[i];if(typeof a!="function")return{view:null,issues:[E("version",`no migration from version ${i}`,"noMigration",{value:i})]};s=a(s)}return{view:{...s,version:n},issues:o}}function K(e,t,n){return typeof e=="string"&&t.includes(e)?e:n}function be(e,t){return typeof e=="boolean"?e:t}function Ft(e){return(Array.isArray(e)?e:e&&Array.isArray(e.fields)?e.fields:e&&e.schema?e.schema.fields:[]).filter(n=>n&&typeof n.name=="string").map(n=>({name:n.name,type:typeof n.type=="string"?n.type:"string"}))}function P(e,t,n,o,r){let s=t.split(".").reduce((i,a)=>m(i,a),e);if(s!==void 0){if(!Array.isArray(s)){o.issue(t,"not a list","notList");return}s.slice(0,n).forEach((i,a)=>r(i,`${t}[${a}]`,a)),s.length>n&&o.issue(t,`more than ${n} entries`,"tooMany",{max:n})}}var N=Object.freeze({view:Object.freeze(Object.keys(Z())),derived:Object.freeze(["name","field","by","size","origin"]),value:Object.freeze(["field","agg","format","label","showAs","conditional"]),valueRef:Object.freeze(["field","agg"]),showAs:Object.freeze(["type","axis"]),conditional:Object.freeze({colorScale:Object.freeze(["type","colors"]),dataBar:Object.freeze(["type","color"])}),sort:Object.freeze(["field","by","order","items","value"]),totals:Object.freeze(Object.keys(Z().totals)),collapsed:Object.freeze(["rows","cols"]),chart:Object.freeze(Object.keys(Z().chart)),formatting:Object.freeze(Object.keys(Z().formatting))});function Gn(e,t,n){P(e,"derived",n.limits.derived,n,(o,r)=>{n.keys(o,N.derived,r);let s=n.text(m(o,"name")),i=n.fields.get(String(m(o,"field")??"").toLowerCase()),a=m(o,"by"),u=typeof a=="string"&&Object.hasOwn(v,a)?v[a]:null;if(!s)return n.issue(r,"needs a name","groupingNoName");if(n.fields.has(s.toLowerCase()))return n.issue(r,`name "${s}" is already a field`,"groupingNameTaken",{field:s});if(!i||i.derived)return n.issue(r,"unknown source field","groupingNoSource",{field:p(m(o,"field"))});if(!u)return n.issue(r,"unknown grouping","groupingUnknown",{value:p(a)});if(i.type!==u.source)return u.source==="number"?n.issue(r,"bins need a number field","binsNeedNumber",{field:i.name}):n.issue(r,"date grouping needs a date field","groupingNeedsDate",{field:i.name});let l={name:s,field:i.name,by:a};if(a==="bin"){let c=I(m(o,"size"));if(c===null||c<Ce)return n.issue(r,`bins need a size of at least ${Ce}`,"binSize");l.size=c,l.origin=I(m(o,"origin"))??0}t.derived.push(l),n.fields.set(s.toLowerCase(),{name:s,type:u.type,derived:!0})})}function Zn(e,t,n){let o=new Set;for(let r of["rows","cols"])P(e,r,n.limits.axisFields,n,(s,i)=>{let a=n.resolve(s);if(!a)return n.unknownField(i,s);if(o.has(a.name))return n.issue(i,`"${a.name}" is already placed`,"placedTwice",{field:a.name});o.add(a.name),t[r].push(a.name)})}function Kn(e,t,n){let o=m(e,"type");if((o==="colorScale"||o==="dataBar")&&n.keys(e,N.conditional[o],t),o==="colorScale"){let r=m(e,"colors"),s=Array.isArray(r)?r.filter(i=>typeof i=="string"&&Mt.test(i)).slice(0,3):[];return Array.isArray(r)&&r.length>0&&(s.length!==r.length||s.length<2)&&n.issue(`${t}.colors`,"two or three colours as #rgb or #rrggbb","colorScaleColors"),{type:o,colors:s.length>=2?s:[]}}if(o==="dataBar"){let r=m(e,"color"),s=typeof r=="string"&&Mt.test(r);return r!=null&&!s&&n.issue(`${t}.color`,"a colour as #rgb or #rrggbb","dataBarColor"),{type:o,color:s?r:null}}return n.issue(t,`unknown conditional format ${JSON.stringify(o)}`,"unknownConditional",{value:p(o)}),null}function Xn(e,t,n,o){let r=typeof e=="string"?{type:e}:e;o.keys(r,N.showAs,n);let s=m(r,"type"),i=typeof s=="string"&&Object.hasOwn(ye,s)?ye[s]:null;return i?i.additive&&!J(t.agg).additive?(o.issue(n,`${s} needs an aggregator that adds up (sum or count), not ${t.agg}`,"showAsNotAdditive",{value:s,agg:t.agg}),null):{type:s,axis:K(m(r,"axis"),["rows","cols"],"rows")}:(o.issue(n,`unknown show-as ${JSON.stringify(s)}`,"unknownShowAs",{value:p(s)}),null)}function Qn(e,t,n){P(e,"values",n.limits.values,n,(o,r)=>{let s=n.valueRef(o,r,N.value);if(!s)return;let i=n.resultType(s)==="number",a={...s,format:null,label:null,showAs:null,conditional:null},u=m(o,"format");u!=null&&(St(u)?a.format=u.trim().toLowerCase():n.issue(`${r}.format`,`unknown format ${JSON.stringify(u)}`,"unknownFormat",{value:p(u)}));let l=m(o,"label");l!=null&&(a.label=n.text(l),a.label===null&&n.issue(`${r}.label`,`not a text up to ${n.limits.name} characters`,"badLabel",{max:n.limits.name}));let c=m(o,"showAs");c!=null&&(i?a.showAs=Xn(c,s,`${r}.showAs`,n):n.issue(`${r}.showAs`,`${s.agg} has no number to show as ${JSON.stringify(m(c,"type")??c)}`,"showAsNotNumber",{agg:s.agg}));let f=m(o,"conditional");f!=null&&(i?a.conditional=Kn(f,`${r}.conditional`,n):n.issue(`${r}.conditional`,"conditional formatting needs a number value","conditionalNotNumber",{agg:s.agg})),t.values.push(a)})}function er(e,t,n){P(e,"filters",n.limits.filters,n,(o,r)=>{let s=n.resolve(m(o,"field")),i=m(o,"type"),a=typeof i=="string"&&Object.hasOwn(O,i)?O[i]:null;if(!s)return n.unknownField(r,m(o,"field"));if(!a){let l=typeof i=="string"&&Object.hasOwn(De,i)?{suggestion:De[i]}:x(i,Object.keys(O));return n.issue(r,i===void 0?`a filter needs a type: one of ${Object.keys(O).join(", ")}`:`unknown filter type ${JSON.stringify(i)}`,"unknownFilterType",{value:p(i),...l})}if(n.keys(o,a.keys,r),!yt(s,t).some(l=>a.fields.includes(l)))return n.issue(r,`a ${i} filter does not work on the ${s.type} field "${s.name}"`,"filterFieldType",{field:s.name,type:s.type,value:i,allowed:a.fields.join(", "),suggestion:bt(s.type)});let u=a.normalize(o,{field:s.name,type:i},s,r,n,t);u&&t.filters.push(u)})}var tr=Object.freeze(["label","value","custom"]);function nr(e,t,n,o){if(!Array.isArray(e))return o.issue(n,"a custom order needs a list of items","sortNoItems"),null;e.length>o.limits.items&&o.issue(n,`more than ${o.limits.items} items`,"tooManyItems",{max:o.limits.items});let r=new Set,s=[];for(let i of e.slice(0,o.limits.items)){let a=Re(t,i,n,o);a!==void 0&&!r.has(a)&&(r.add(a),s.push(a))}return s}function rr(e,t,n){let o=new Set;P(e,"sort",n.limits.sort,n,(r,s)=>{n.keys(r,N.sort,s);let i=n.resolve(m(r,"field"));if(!i||o.has(i.name))return i?n.issue(s,`"${i.name}" is sorted twice`,"sortedTwice",{field:i.name}):n.unknownField(s,m(r,"field"));let a=K(m(r,"by"),tr,"label"),u={field:i.name,by:a,order:K(m(r,"order"),["asc","desc"],"asc")};if(a==="custom"){let l=nr(m(r,"items"),i,`${s}.items`,n);if(!l)return;u.items=l}if(a==="value"){let l=m(r,"value")===void 0?n.defaultRef(t):n.valueRef(m(r,"value"),`${s}.value`);if(!l)return;u.value=l}o.add(i.name),t.sort.push(u)})}function or(e,t,n){let o=m(e,"totals");if(o!==void 0){if(!k(o))return n.issue("totals","not an object","badTotals");n.keys(o,N.totals,"totals");for(let r of Object.keys(t.totals))t.totals[r]=be(m(o,r),t.totals[r])}}function sr(e,t,n){n.keys(m(e,"collapsed"),N.collapsed,"collapsed");for(let o of["rows","cols"]){let r=t[o].map(i=>n.fields.get(i.toLowerCase()).type),s=new Set;P(e,`collapsed.${o}`,n.limits.collapsed,n,i=>{if(!Array.isArray(i)||i.length===0||i.length>=r.length)return n.issue(`collapsed.${o}`,`path ${JSON.stringify(i)} does not fit the ${o}`,"collapsedPath");let a=i.map((l,c)=>j(r[c],l));if(a.includes(void 0))return n.issue(`collapsed.${o}`,`path ${JSON.stringify(i)} does not fit the field types`,"collapsedPath");let u=JSON.stringify(a);s.has(u)||(s.add(u),t.collapsed[o].push(a))})}}function ir(e,t,n){let o=m(e,"display");t.display=K(o,xn,t.display),o!==void 0&&t.display!==o&&n.issue("display",`unknown display ${JSON.stringify(o)}`,"unknownSetting",{value:p(o)});let r=m(e,"chart");if(n.keys(r,N.chart,"chart"),r!==void 0){let s=(a,u,l)=>{let c=m(r,a),f=K(c,u,l);return c!==void 0&&f!==c&&n.issue(`chart.${a}`,`unknown ${a} ${JSON.stringify(c)}`,"unknownSetting",{value:p(c)}),f},i=m(r,"title");t.chart={type:s("type",Un,t.chart.type),stacked:be(m(r,"stacked"),!1),horizontal:be(m(r,"horizontal"),!1),valueLabels:s("valueLabels",Pn,"auto"),legend:s("legend",Bn,"auto"),title:i==null?null:n.text(i),smooth:be(m(r,"smooth"),!1),axisLabels:s("axisLabels",Jn,"auto"),groupLabels:s("groupLabels",Hn,"auto"),labelPosition:s("labelPosition",Vn,"outside")},i!=null&&t.chart.title===null&&!(typeof i=="string"&&i.trim()==="")&&n.issue("chart.title",`not a text up to ${n.limits.name} characters`,"badTitle",{max:n.limits.name})}}function ar(e,t,n){let o=m(e,"formatting");n.keys(o,N.formatting,"formatting");let r=m(o,"locale");r!=null&&(t.formatting.locale=Je(r),t.formatting.locale===null&&n.issue("formatting.locale",`unknown locale ${JSON.stringify(r)}`,"unknownLocale",{value:p(r)}));let s=m(o,"weekStart");s!=null&&(Number.isInteger(s)&&s>=1&&s<=7?t.formatting.weekStart=s:n.issue("formatting.weekStart","the first day of a week is 1 (Monday) to 7 (Sunday)","unknownSetting",{value:p(s)}));let i=m(o,"timeZone");i!=null&&(t.formatting.timeZone=Ye(i),t.formatting.timeZone===null&&n.issue("formatting.timeZone",`unknown time zone ${JSON.stringify(i)}`,"unknownTimeZone",{value:p(i)}))}var ur=[Gn,Zn,Qn,er,rr,or,sr,ir,ar],jt=Object.freeze({columns:"cols",column:"cols",measures:"values",measure:"values",aggregations:"values",filter:"filters",sorting:"sort"});function x(e,t){let n=kt(e,t);return n===null?{}:{suggestion:n}}var lr=1e5;function cr(e,t,n,o){let r=new Map(Ft(e).map(u=>[u.name.toLowerCase(),u])),s=new Map,i=u=>{if(!s.has(u)){let l=e,c=l&&!Array.isArray(l)&&typeof l.column=="function"?l.column(u):void 0;s.set(u,c&&c.type==="string"&&c.dict.length<=lr?{exact:new Set(c.dict),byFold:new Map(c.dict.map(f=>[C(f),f]))}:null)}return s.get(u)},a={limits:t,fields:r,strict:o,issue:(u,l,c,f)=>{n(E(u,l,c,f))},warn:(u,l,c,f)=>{n(E(u,l,c,f,"warning"))},suggest:x,unknownField:(u,l)=>a.issue(u,`unknown field ${JSON.stringify(l)}`,"unknownField",{field:p(l),...x(l,[...r.values()].map(c=>c.name))}),keys:(u,l,c)=>{if(k(u))for(let f of Object.keys(u))l.includes(f)||a.warn(`${c}.${f.slice(0,100)}`,"unknown key","unknownKey",{value:p(f),...x(f,l)})},itemHint:(u,l,c)=>{if(typeof l!="string")return;let f=i(u.name),d=f&&!f.exact.has(l)?f.byFold.get(C(l)):void 0;d!==void 0&&a.warn(c,`item ${JSON.stringify(l)} is no item of "${u.name}"; did you mean ${JSON.stringify(d)}?`,"itemCase",{field:u.name,value:p(l),suggestion:d})},text:u=>{if(typeof u!="string")return null;let l=u.trim();return l===""||l.length>t.name?null:l},resolve:u=>typeof u=="string"&&u.length<=t.name?r.get(u.trim().toLowerCase()):void 0,resultType:u=>J(u.agg).resultType(u.field?r.get(u.field.toLowerCase()).type:"number"),defaultRef:u=>u.values.length?{field:u.values[0].field,agg:u.values[0].agg}:{field:null,agg:"count"},valueRef:(u,l,c=N.valueRef)=>{if(!k(u))return a.issue(l,"not a value reference","notValueRef"),null;a.keys(u,c,l);let f=m(u,"agg"),d=m(u,"field"),g=d==null?null:a.resolve(d);return J(f)?g===void 0?(a.unknownField(l,d),null):g===null&&f!=="count"?(a.issue(l,`${f} needs a field`,"aggregatorNeedsField",{agg:f}),null):g&&!Se(f,g.type)?(a.issue(l,`${f} does not work on the ${g.type} field "${g.name}"`,"aggregatorType",{agg:f,type:g.type,field:g.name}),null):{field:g?g.name:null,agg:f}:(a.issue(l,`unknown aggregator ${JSON.stringify(f)}`,"unknownAggregator",{value:p(f),...x(f,Ne)}),null)}};return a}function To(e,t,n){return n=D(n,"normalize"),_t(e,t,n,!1)}function _t(e,t,n,o){let r=Be(n),s=Z(),i=(d,g,y,b)=>({view:s,issues:[E(d,g,y,b)]}),a;try{let d=typeof e=="string"?e:JSON.stringify(e);if(typeof d!="string")return i("","not a view object","notView");if(d.length>r.json)return i("",`larger than ${r.json} characters`,"tooLarge",{max:r.json});a=JSON.parse(d)}catch{return i("","not valid JSON","notJson")}let u=fr(),l=Yn(a);if(l.issues.forEach(u.add),l.view===null)return{view:s,issues:u.done()};let c=l.view;for(let d of Object.keys(c))Object.hasOwn(s,d)||u.add(E(d.slice(0,100),"unknown key","unknownKey",{value:p(d),...Object.hasOwn(jt,d.toLowerCase())?{suggestion:jt[d.toLowerCase()]}:x(d,N.view)}));let f=cr(t,r,u.add,o);for(let d of ur)d(c,s,f);return{view:s,issues:u.done()}}function fr(){let e=[],t=new Map,n=0;return{add:o=>{let r=t.get(o.code)??0;if(r>=X.perCode||e.length>=X.total){n++;return}t.set(o.code,r+1),e.push(o)},done:()=>n===0?e:[...e,E("",`${n} more issues left out`,"tooManyIssues",{value:String(n),max:X.perCode})]}}function No(e,t,n){n=D(n,"validate");let{issues:o}=_t(e,t,n,!0),r=o.filter(s=>s.severity!=="warning");return{valid:r.length===0,errors:r,warnings:o.filter(s=>s.severity==="warning")}}function So(e,t){return Ft(t).concat((e.derived||[]).map(n=>({name:n.name,type:v[n.by].type,derived:!0})))}export{Ne as a,J as b,dr as c,S as d,vr as e,kr as f,Ar as g,Cr as h,$r as i,et as j,br as k,tt as l,hr as m,wr as n,_ as o,ke as p,Ae as q,C as r,H as s,W as t,U as u,Y as v,st as w,en as x,ae as y,it as z,at as A,Ie as B,Pr as C,Me as D,O as E,Vr as F,Br as G,Jr as H,kt as I,Gr as J,me as K,Zr as L,St as M,In as N,Kr as O,ze as P,Xr as Q,ye as R,no as S,Rt as T,E as U,Un as V,wo as W,xn as X,Oo as Y,Pn as Z,Vn as _,Bn as $,Jn as aa,Hn as ba,Z as ca,To as da,No as ea,So as fa};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=Object.freeze({colorScale:Object.freeze(["#eaf1fb","#2a78d6"]),dataBar:"#2a78d6",strongWeight:600,titleSize:16,textSize:14,markRadius:4,cardRadius:8,pieRadius:Object.freeze(["0%","70%"]),donutRadius:Object.freeze(["42%","70%"])});function a(t){let e=/^(\d*\.?\d+)(px)?$/.exec(String(t??"").trim());return e?Number(e[1]):null}export{r as a,a as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as x}from"./chunk-
|
|
1
|
+
import{c as x}from"./chunk-WKVC2RPA.js";var l=[{bytes:[80,75,3,4],what:"a ZIP archive (an Excel workbook .xlsx is one); load it with a spreadsheet reader, or save it as CSV"},{bytes:[208,207,17,224,161,177,26,225],what:"an old Excel workbook (.xls) or a password-protected file; save it as .xlsx or CSV"},{bytes:[37,80,68,70],what:"a PDF document"},{bytes:[31,139],what:"a gzip archive; unpack it first"}],f=(t,r)=>r.every((e,o)=>t[o]===e);function d(t){let r=Math.min(t.length,4096)&-2;if(r<8)return!1;let e=0;for(let o=1;o<r;o+=2)t[o]===0&&t[o-1]!==0&&e++;return e>r/2*.9}function w(t,r){for(let s of l)if(f(t,s.bytes))throw x("WRONG_TYPE",r,`this is ${s.what}, not text.`);let e,o=0;f(t,[239,187,191])?(e="utf-8",o=3):f(t,[255,254])?(e="utf-16le",o=2):f(t,[254,255])?(e="utf-16be",o=2):d(t)&&(e="utf-16le");let a=t.subarray(o),i;if(e)i=new TextDecoder(e,{fatal:!1,ignoreBOM:!0}).decode(a);else try{i=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(a),e="utf-8"}catch{i=new TextDecoder("windows-1252",{ignoreBOM:!0}).decode(a),e="windows-1252"}let n=i.indexOf("\0");if(n!==-1&&n<i.length-1)throw x("BINARY",r,"this file holds binary data, not text.");return{text:n===-1?i:i.slice(0,n),encoding:c[e]}}var c={"utf-8":"UTF-8","utf-16le":"UTF-16 (little endian)","utf-16be":"UTF-16 (big endian)","windows-1252":"Windows-1252"};export{w as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as se,c as ne,g as Q,h as Pe,i as ze,j as Me}from"./chunk-XETFD6GR.js";import{$ as Re,A as we,B as Ae,D as $e,E as Oe,F as X,G as Ee,J as Le,N as W,R as Te,S as q,V as Ie,W as K,X as Ce,Y as ve,Z as _e,_ as ke,a as ie,aa as Ne,ba as Fe,da as z,e as H,ea as Z,f as ae,g as le,i as ce,j as P,l as Y,m as fe,p as me,q as pe,s as ue,t as de,u as he,v as ge,w as be,x as ye,y as Se,z as xe}from"./chunk-4PHDW2LB.js";import{b as E,c as re,i as V,m as v,w as U}from"./chunk-XR4CMFGN.js";import{a as L,b as ee}from"./chunk-5QXN3X2Q.js";function Ze(e,t,o){o=v(o,"fieldItems"),E(ne(e),"fieldItems(data, field): data must come from encode()");let r=V(o),{view:n}=z(o.view??{},e,{limits:o.limits}),s=U(n.formatting.locale,o.locale),i={...P,...o.labels||{}};if(typeof t!="string")return null;let a=n.derived.find(h=>h.name.toLowerCase()===t.trim().toLowerCase()),c=a?ce(e,a):e.column(t.trim());if(!c)return null;let d=new Float64Array(c.dict.length+1);for(let h=0;h<c.codes.length;h++)d[c.codes[h]+1]++;let p=fe(c,s,e.cache),m=Ee(n,c.name,c,a?e.column(a.field)??c:c,s,()=>$e(o.now,e.timeZone)),l=h=>!m||m[h+1]===1,f=[];for(let h=0;h<c.dict.length;h++)d[h+1]>0&&f.push(h);f.sort((h,u)=>p[h]-p[u]);let y=f.map(h=>({value:c.dict[h],label:Y(c,c.dict[h],s,i),count:d[h+1],kept:l(h)}));return d[0]>0&&y.push({value:null,label:Y(c,null,s,i),count:d[0],kept:l(-1)}),{field:c.name,type:c.type,items:y.slice(0,r.items),truncated:y.length>r.items}}function De(e,t){t=v(t,"toSeries"),E(Q(e),"toSeries(result): result must come from computePivot()");let o=V(t),r=e.view,n={...P,...t.labels||{}},s=t.separator??" / ",i=(u,g,S)=>Pe(u,g,S,!1,!1).filter(b=>b.kind!=="grand"),a=i(e.rowRoot,r.rows.length,r.collapsed.rows),c=i(e.colRoot,r.cols.length,r.collapsed.cols);a.length===0&&(a=[{node:e.rowRoot,kind:"leaf"}]);let d=a.length;t.maxCategories!==void 0&&(E(Number.isInteger(t.maxCategories)&&t.maxCategories>0,"toSeries: maxCategories must be a positive whole number"),a=a.slice(0,t.maxCategories)),c.length===0&&(c=[{node:e.colRoot,kind:"leaf"}]);let p=(u,g)=>{let S=[];for(let b=g;b&&b.parent;b=b.parent)S.unshift(e.label(u,b,n));return S},m=(u,g)=>{let S=p(u,g);return S.length?S.join(s):n.grandTotal},l=r.values.filter((u,g)=>e.valueTypes[g]!=="text").length;re("cells",a.length*Math.max(1,c.length*l),o.cells,"chart data points");let f=r.values.map(u=>Me(u,n)),y=u=>typeof u=="number"&&Number.isFinite(u)?u:null,h=[];for(let{node:u}of c)r.values.forEach((g,S)=>{if(e.valueTypes[S]==="text")return;let b=u.parent?m("cols",u):"",F=b&&r.values.length>1?`${b}${s}${f[S]}`:b||f[S];h.push({name:F,valueIndex:S,colPath:u.path,format:ze(e,S),data:a.map(({node:T})=>y(e.display(T,u,S)))})});return{categories:a.map(({node:u})=>m("rows",u)),categoryLevels:a.map(({node:u})=>p("rows",u)),categoryCount:d,categoryPaths:a.map(({node:u})=>u.path),series:h,totals:r.values.map((u,g)=>a.map(({node:S})=>y(e.display(S,e.colRoot,g))))}}var Qe=e=>e+16,et=e=>({top:Math.max(24,e+10),bottom:Math.max(32,e+18),right:160});function tt(e,t,o,r){let n=et(r.fontSize),s=e==="bottom"||e==="right"||e==="off"?e:t?"top":"off";return s==="off"?{legend:null,room:{top:0,bottom:0,right:0}}:s==="right"?{legend:{type:"scroll",orient:"vertical",right:0,top:o+8,bottom:8,textStyle:r},room:{top:0,bottom:0,right:n.right}}:s==="bottom"?{legend:{type:"scroll",bottom:0,textStyle:r},room:{top:0,bottom:n.bottom,right:0}}:{legend:{type:"scroll",top:o,textStyle:r},room:{top:n.top,bottom:0,right:0}}}var je=e=>e+12;function ot(e,t,o,{separator:r,axisLine:n,theme:s}){let i=e.categoryLevels??[];if(o.groupLabels==="off"||t<2||!i.some(f=>f.length>=2))return null;let a=i.map(f=>f[0]??""),c=i.map((f,y)=>f.length>1?f.slice(1).join(r):e.categories[y]),d=a.map((f,y)=>y===0||f!==a[y-1]),p=new Set,m=0,l=a.length;for(let f=1;f<=a.length;f++)(f===a.length||d[f])&&(p.add(Math.floor((m+f-1)/2)),l=Math.min(l,f-m),m=f);return{leaves:c,axis:{type:"category",data:a,position:o.horizontal?"left":"bottom",offset:je(s.textSize??L.textSize),axisLine:{show:!1},axisTick:{show:!0,inside:!0,length:je(s.textSize??L.textSize),interval:f=>f>0&&d[f]===!0,lineStyle:n.lineStyle},axisLabel:{color:s.textColor,fontSize:s.textSize??L.textSize,fontWeight:s.strongWeight??L.strongWeight,interval:f=>p.has(f)},axisPointer:{show:!1},splitLine:{show:!1},groups:!0,groupsAuto:o.groupLabels!=="on",groupSize:l}}}function M(e,t){let o=Array.isArray(e.derived)?e.derived:[],r=n=>{let s=String(n).toLowerCase(),i=o.find(a=>a&&typeof a.name=="string"&&a.name.toLowerCase()===s);return i&&!H.includes(i.by)?!1:t.column(i?i.field:n)?.type==="date"};return(Array.isArray(e.rows)?e.rows:[]).some(r)?"line":"bar"}function rt(e,t){t=v(t,"toEChartsOption"),E(Q(e),"toEChartsOption(result): result must come from computePivot()");let o=t.theme??{},r={...e.view.chart,...t.chart||{}};r.type==="auto"&&(r.type=M(e.view,e.encoded));let n=U(e.view.formatting.locale,t.locale??e.locale),s=t.series??De(e,t);E(s&&Array.isArray(s.series)&&Array.isArray(s.categories),"toEChartsOption: series must come from toSeries()");let i=s.series[0],a=W(i?i.format:"number",n),c=W(i&&/^percent/.test(i.format)?i.format:"compact",n),d={color:o.textColor,fontFamily:o.fontFamily,fontSize:o.textSize??L.textSize},p={color:d.color,fontSize:d.fontSize},m={lineStyle:{color:o.axisColor}},l={backgroundColor:o.backgroundColor??"transparent",textStyle:d,...o.colors&&o.colors.length?{color:o.colors}:{}},f=w=>typeof w=="number"?a(w):"",y=typeof r.title=="string"&&r.title.trim()?{title:{text:r.title.trim(),left:"center",top:0,textStyle:{...d,fontSize:o.titleSize??L.titleSize,fontWeight:o.strongWeight??L.strongWeight}}}:{},h=y.title?Qe(o.titleSize??L.titleSize):0,{legend:u,room:g}=tt(r.legend,K.includes(r.type)||s.series.length>1,h,d),S=u?{legend:u}:{},b=r.valueLabels==="off"||r.valueLabels==="value"||r.valueLabels==="percent"||r.valueLabels==="both"?r.valueLabels:"auto";if(K.includes(r.type)){let w=i?i.valueIndex:0,I=s.categories.map((A,Ke)=>({name:A,value:s.totals[w]?s.totals[w][Ke]:null})).filter(A=>typeof A.value=="number"&&A.value>0),_=A=>W("percent100:1",n)(A.percent),C=r.labelPosition==="inside",$={value:A=>a(A.value),percent:_,both:A=>`${a(A.value)} (${_(A)})`},J=b==="off"?{show:!1}:C?{position:"inside",formatter:$[b==="auto"?"percent":b]}:b==="auto"?{}:{formatter:A=>`${A.name}: ${$[b](A)}`},k=r.type==="donut"?o.donutRadius??L.donutRadius:o.pieRadius??L.pieRadius;return{...l,...y,tooltip:{trigger:"item",valueFormatter:f},...S,series:[{type:"pie",name:i?i.name:"",radius:[...k],top:h+g.top,...g.bottom?{bottom:g.bottom}:{},...g.right?{right:g.right}:{},data:I,...C?{minShowLabelAngle:12,labelLine:{show:!1}}:{},label:{...C?{}:{color:o.textColor},...J}}]}}if(r.type==="heatmap"){let w=s.series.filter($=>$.valueIndex===(i?i.valueIndex:0)),I=[],_=1/0,C=-1/0;return w.forEach(($,J)=>{$.data.forEach((k,A)=>{k!==null&&(I.push([J,A,k]),_=Math.min(_,k),C=Math.max(C,k))})}),{...l,...y,tooltip:{trigger:"item",valueFormatter:f},grid:{top:16+h,bottom:64},xAxis:{type:"category",data:w.map($=>$.name),axisLine:m,axisLabel:{...p,interval:0},splitArea:{show:!1}},yAxis:{type:"category",data:s.categories,axisLine:m,axisLabel:{...p},splitArea:{show:!1}},visualMap:{min:I.length?_:0,max:I.length?C:1,calculable:!0,orient:"horizontal",left:"center",bottom:0,textStyle:d,formatter:$=>typeof $=="number"?a($):String($),...o.heatmapColors?{inRange:{color:o.heatmapColors}}:{}},series:[{type:"heatmap",name:i?i.name:"",data:I,label:{show:b==="auto"?I.length<=200:b!=="off",formatter:$=>a($.value[2])}}]}}let F=r.type==="line"||r.type==="area"?"line":"bar",T=ot(s,e.view.rows.length,r,{separator:t.separator??" / ",axisLine:m,theme:o}),D={type:"category",data:T?T.leaves:s.categories,axisLine:m,axisLabel:{...p}},oe={type:"value",axisLine:m,axisLabel:{...p,formatter:w=>c(w)},splitLine:{lineStyle:{color:o.gridColor}}},Ye=b!=="auto"&&b!=="off",Xe=F==="line"?"top":r.stacked?"inside":r.horizontal?"right":"top",qe=Ye?{label:{show:!0,position:Xe,color:o.textColor,formatter:w=>typeof w.value=="number"?a(w.value):""}}:{};return{...l,...y,...S,tooltip:{trigger:"axis",valueFormatter:f},grid:{top:16+h+g.top,...g.bottom?{bottom:g.bottom+8}:{},...g.right?{right:g.right+8}:{}},xAxis:r.horizontal?oe:T?[D,T.axis]:D,yAxis:r.horizontal?T?[{...D,inverse:!0},{...T.axis,inverse:!0}]:{...D,inverse:!0}:oe,series:s.series.map(w=>({type:F,name:w.name,data:w.data,...r.stacked?{stack:"total"}:{},...r.type==="area"?{areaStyle:{}}:{},...F==="line"?{connectNulls:!1,smooth:!!r.smooth}:{},...qe}))}}function st(e,t){if(e.chart.type!=="auto")return{auto:!1,swap:!1,chart:{type:e.chart.type,stacked:!!e.chart.stacked,horizontal:!!e.chart.horizontal}};let o=M(e,t),r=o==="bar"&&e.cols.length>0&&M({...e,rows:e.cols},t)==="line";return{auto:!0,swap:r,chart:{type:o==="line"||r?"line":"bar",stacked:!1,horizontal:!1}}}var Ve=Object.freeze({percentOfRowTotal:"percentOfColumnTotal",percentOfColumnTotal:"percentOfRowTotal",percentOfParentRow:"percentOfParentColumn",percentOfParentColumn:"percentOfParentRow"});function nt(e){let t=JSON.parse(JSON.stringify(e));[t.rows,t.cols]=[t.cols,t.rows],t.collapsed={rows:t.collapsed.cols,cols:t.collapsed.rows};for(let o of t.values)o.showAs&&o.showAs.axis&&(o.showAs={...o.showAs,axis:o.showAs.axis==="rows"?"cols":"rows"}),o.showAs&&Object.hasOwn(Ve,o.showAs.type)&&(o.showAs={...o.showAs,type:Ve[o.showAs.type]});return t}var Ue=8;function it(e){let t=f=>e.getPropertyValue(f).trim(),o=[];for(let f=1;f<=Ue;f++){let y=t(`--pk-chart-${f}`);y&&o.push(y)}let r={colors:o,textColor:t("--pk-muted")||void 0,axisColor:t("--pk-border")||void 0,gridColor:t("--pk-grid")||t("--pk-border")||void 0,fontFamily:t("font-family")||void 0,backgroundColor:"transparent"},n=Number(t("--pk-weight-strong"));n>=1&&n<=1e3&&(r.strongWeight=n);let s=ee(t("--pk-chart-title-size"));s!==null&&s>=1&&(r.titleSize=s);let i=ee(t("--pk-chart-text-size"));i!==null&&i>=1&&(r.textSize=i);let a=t("--pk-heat-low"),c=t("--pk-heat-high");a&&c&&(r.heatmapColors=[a,c]);let[d,p,m,l]=["--pk-scale-low","--pk-scale-mid","--pk-scale-high","--pk-chart-1"].map(t);return d&&m&&(r.colorScale=p?[d,p,m]:[d,m]),l&&(r.dataBar=l),r}var at=Object.freeze({aggregators:ie,commonAggregators:Object.freeze(["sum","count","average","min","max"]),columnTypes:se,deriveUnits:le,timelineUnits:H,cyclicUnits:ae,filterTypes:X,filterFields:Object.freeze(Object.fromEntries(X.map(e=>[e,Oe[e].fields]))),filterBlanks:Ae,textOps:be,textOn:ye,matchCases:me,matchWhitespace:pe,compareOps:Se,comparePrecisions:xe,topTies:we,relativeUnits:ue,relativeDirections:de,relativeMaxCount:he,relativeAnchors:ge,formats:Le,showAs:q,showAsAlongAxis:Object.freeze(q.filter(e=>Te[e].alongAxis)),chartTypes:Ie,chartValueLabels:_e,chartLegends:Re,chartAxisLabels:Ne,chartGroupLabels:Fe,chartLabelPositions:ke,displayModes:Ce,conditionalTypes:ve});var te=Object.freeze({items:20,text:80});function ct(e,t){if(e==null)return null;if(t==="date"&&typeof e=="number"){let r=new Date(e).toISOString();return r.endsWith("T00:00:00.000Z")?r.slice(0,10):r.slice(0,16)}let o=String(e);return o.length>te.text?`${o.slice(0,te.text-1)}\u2026`:o}var B=e=>e?e.field?`${e.agg} of ${e.field}`:`${e.agg} of rows`:"the first value",ft=e=>{let t=e.slice(0,10).map(o=>typeof o=="string"?JSON.stringify(ct(o,"string")):String(o));return e.length>10?`${t.join(", ")} and ${e.length-10} more`:t.join(", ")},mt=Object.freeze({exclude:"blanks dropped",include:"blanks kept",only:"only blanks"}),He=Object.freeze({"=":"is",">":"is greater than",">=":"is at least","<":"is less than","<=":"is at most",between:"is between"});function pt(e){let t=e.not?"not ":"",o=e.blanks?` (${mt[e.blanks]})`:"",r=(n,s)=>`${JSON.stringify(n)} and ${JSON.stringify(s)}`;switch(e.type){case"in":return`${e.field} is ${t}one of ${ft(e.items??[])||"(no items)"}${o}`;case"blank":return`${e.field} is ${t}blank`;case"text":return`${e.field}${e.on==="label"?" (as shown)":""} ${t?"does not ":""}${e.op==="equals"?t?"equal":"equals":e.op==="contains"?t?"contain":"contains":e.op==="beginsWith"?t?"begin with":"begins with":t?"end with":"ends with"} ${JSON.stringify(e.value)}${e.match?`, case ${e.match.case}, whitespace ${e.match.whitespace}`:""}${o}`;case"compare":return`${e.field} ${t?"is not":"is"} ${He[e.op].replace(/^is /,"")} ${e.op==="between"?r(e.value,e.value2):JSON.stringify(e.value)}${e.precision&&e.precision!=="day"?` (by ${e.precision})`:""}${o}`;case"relative":{let n=e.direction==="this"?`this ${e.unit}`:`${e.direction} ${e.count} ${e.unit}${e.count===1?"":"s"}`,s=[e.calendar===!1?"rolling":null,e.includeCurrent===!1?"current excluded":null,e.anchor&&e.anchor!=="today"?`from ${e.anchor}`:null].filter(Boolean);return`${e.field} ${t?"is not":"is"} in the ${n}${s.length?` (${s.join(", ")})`:""}${o}`}case"top":return`${e.bottom?"bottom":"top"} ${e.count} ${e.field} by ${B(e.by)}${e.ties==="all"?", ties kept":""}`;case"value":return`${e.field} where ${B(e.by)} ${t?"is not":"is"} ${He[e.op].replace(/^is /,"")} ${e.op==="between"?r(e.value,e.value2):JSON.stringify(e.value)}`;default:return`${e.field}: ${e.type}`}}function ut(e,t,o){o=v(o,"describeView");let{valid:r,errors:n,warnings:s}=Z(e,t,o),i=z(e,t,o).view,a=i.values.map(l=>({field:l.field,agg:l.agg,label:l.label,showAs:l.showAs?.type??null,text:l.label??B(l)})),c=i.filters.map(l=>({...l,text:pt(l)})),d=i.derived.map(l=>({...l,text:`${l.name}: ${l.field} by ${l.by}${l.by==="bin"?` of ${l.size}`:""}`})),p=i.sort.map(l=>({...l,text:`${l.field} ${l.by==="value"?`by ${B(l.value)}`:l.by==="custom"?"in a custom order":"by label"}, ${l.order==="desc"?"descending":"ascending"}`})),m=[a.length?a.map(l=>l.text).join(", "):"count of rows",i.rows.length?`by ${i.rows.join(" > ")}`:null,i.cols.length?`across ${i.cols.join(" > ")}`:null,c.length?`where ${c.map(l=>l.text).join("; and ")}`:null,i.display==="chart"?`as a ${i.chart.type==="auto"?"chart":`${i.chart.type} chart`}`:null];return{valid:r,errors:n,warnings:s,rows:{fields:i.rows,text:i.rows.join(" > ")},cols:{fields:i.cols,text:i.cols.join(" > ")},values:a,filters:c,derived:d,sort:p,display:{mode:i.display,chart:i.display==="chart"?i.chart.type:null},text:`${r?"":`(invalid: ${n.length} error${n.length===1?"":"s"}, the parts they name are left out) `}${m.filter(Boolean).join(" ")}`}}var O=Object.freeze({fields:1e3,label:120,description:1e3,order:1e3,href:2e3,depth:32,steps:2e4}),R=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),x=(e,t)=>R(e)&&Object.hasOwn(e,t)?e[t]:void 0,G=(e,...t)=>Object.fromEntries(Object.entries(e).filter(([o])=>!t.includes(o)));function We(e,t){if(typeof e!="string")return;let o=e.slice(0,t*4).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g," ").replace(/[\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/g,"").replace(/\s+/g," ").trim();if(o)return o.length>t?`${o.slice(0,t-1).trimEnd()}\u2026`:o}function dt(e){if(!(typeof e!="string"||e.length>O.href))try{let t=new URL(e.trim());return t.protocol==="https:"&&!t.username&&!t.password?t.href:void 0}catch{return}}function Je(e,t){if(typeof t!="string"||!t.startsWith("#"))return;let o=t.slice(1).split("/").slice(1).map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~")),r=e;for(let n of o)if(r=Array.isArray(r)&&/^\d+$/.test(n)?r[Number(n)]:x(r,n),r===void 0)return;return r}var Be=Symbol("resolving");function j(e,t,o,r=o){let n=`${r}:${t}`;!e.said.has(n)&&e.issues.length<100&&(e.said.add(n),e.issues.push({path:t,message:o}))}function N(e,t,o,r=0){if(!R(t))return;if(r>O.depth){j(e,o,`nested deeper than ${O.depth} levels; not read`,"depth");return}if(e.steps<=0){j(e,"",`stopped after ${O.steps} schema objects; the rest is not read`,"steps");return}e.steps-=1;let n=t,s=x(n,"$ref");if(typeof s=="string"){let a=e.refs.get(s);if(a===Be){j(e,o,`$ref ${s.slice(0,200)} refers to itself; not read`);return}if(!e.refs.has(s)){let c=Je(e.root,s);c===void 0&&j(e,o,s.startsWith("#")?`$ref ${s.slice(0,200)} is not in the document`:`$ref ${s.slice(0,200)} is not local; not fetched`),e.refs.set(s,Be),a=N(e,c,s.slice(0,200),r+1),e.refs.set(s,a)}if(!a)return;n={...a,...G(n,"$ref")}}let i=x(n,"allOf");if(Array.isArray(i)){let a=i.slice(0,O.fields).map((p,m)=>N(e,p,`${o}.allOf[${m}]`,r+1)).filter(Boolean),c={};for(let p of[...a,n]){let m=x(p,"properties");if(R(m))for(let l of Object.keys(m))Object.defineProperty(c,l,{value:m[l],enumerable:!0,writable:!0,configurable:!0})}n={...a.reduce((p,m)=>({...p,...G(m,"properties")}),{}),...G(n,"allOf"),properties:c}}for(let a of["anyOf","oneOf"]){let c=x(n,a);if(Array.isArray(c)){let d=c.slice(0,O.fields).map((p,m)=>N(e,p,`${o}.${a}[${m}]`,r+1)).filter(p=>p&&x(p,"type")!=="null");d.length===1&&(n={...d[0],...G(n,a)})}}return n}function Ge(e){let t=x(e,"type"),o=Array.isArray(t)?t.filter(r=>r!=="null"):[t];return o.length===1&&typeof o[0]=="string"?o[0]:void 0}function ht(e,t,o="fieldDefaultsFromSchema"){return E(typeof t=="string"&&t.trim()!=="",`${o}: an OpenAPI document needs options.schema, the name of a schema or a local $ref`),t.startsWith("#")?Je(e,t):x(x(x(e,"components"),"schemas"),t)??x(x(e,"definitions"),t)}function gt(e,t={}){E(R(e),"fieldDefaultsFromSchema: the schema must be an object"),E(R(t),"fieldDefaultsFromSchema: options must be an object");let o=e,r=x(o,"openapi")!==void 0||x(o,"swagger")!==void 0,n={root:o,steps:O.steps,refs:new Map,issues:[],said:new Set},s=N(n,r||t.schema!==void 0?ht(o,t.schema):o,"");E(s,`fieldDefaultsFromSchema: no schema ${JSON.stringify(String(t.schema??"")).slice(0,80)} in the document`),Ge(s)==="array"&&(s=N(n,x(s,"items"),"items"));let i=x(s,"properties");E(R(i),"fieldDefaultsFromSchema: the schema of a row must have properties");let a={},c=Object.keys(i);c.length>O.fields&&j(n,"properties",`${c.length} fields, more than ${O.fields}: the first ${O.fields} are read`);for(let d of c.slice(0,O.fields)){let p=N(n,i[d],`properties.${d.slice(0,200)}`);if(!p)continue;let m={},l=We(x(p,"title"),O.label);l&&(m.label=l);let f=We(x(p,"description"),O.description);f&&(m.description=f);let y=dt(x(x(p,"externalDocs"),"url"));y&&(m.href=y);let h=Ge(p),u=x(p,"format");h==="integer"||h==="number"?m.type="number":h==="string"&&(u==="date"||u==="date-time")&&(m.type="date");let g=x(p,"enum");if(Array.isArray(g)){let S=g.slice(0,O.order).filter(b=>b===null||["string","number","boolean"].includes(typeof b));S.length>0&&(m.order=S)}Object.keys(m).length>0&&Object.defineProperty(a,d,{value:m,enumerable:!0,writable:!0,configurable:!0})}return{defaults:a,issues:n.issues}}export{Ze as a,De as b,rt as c,st as d,nt as e,it as f,at as g,ut as h,We as i,gt as j};
|