pivotkit-element 0.4.0 → 0.6.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 +114 -1
- package/README.md +1 -0
- package/dist/THIRD_PARTY_LICENSES.txt +2 -2
- package/dist/chunks/chunk-5QXN3X2Q.js +1 -0
- package/dist/chunks/{chunk-VMHRXWK7.js → chunk-65G326ME.js} +1 -1
- package/dist/chunks/chunk-7V4PAOK7.js +1 -0
- package/dist/chunks/chunk-CHSIHYYE.js +2 -0
- package/dist/chunks/chunk-CXSW4YRL.js +13 -0
- package/dist/chunks/chunk-HFUBAP3D.js +1 -0
- package/dist/chunks/chunk-KO3EKDH5.js +1 -0
- package/dist/chunks/chunk-NSPPM3IJ.js +16 -0
- package/dist/chunks/chunk-NXZQI5LC.js +6 -0
- package/dist/chunks/chunk-OHKPNELV.js +1 -0
- package/dist/chunks/chunk-R6GXMVRO.js +1 -0
- package/dist/chunks/chunk-WKVC2RPA.js +1 -0
- package/dist/chunks/chunk-XR4CMFGN.js +1 -0
- package/dist/chunks/chunk-YMLEL3SK.js +8 -0
- package/dist/chunks/echarts-4DC3BQOK.js +5 -0
- package/dist/chunks/export-O6XO33DV.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-SZTWEYHK.js +1 -0
- package/dist/chunks/link-7K6I4SJS.js +1 -0
- package/dist/chunks/menu-texts-de-CRJ5OIVT.js +1 -0
- package/dist/chunks/menus-F36OYGXV.js +2 -0
- package/dist/chunks/report-run-BZBFOMPF-T26ENZEM.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 +32 -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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import{c as Ct,d as Nt,e as Rt}from"./chunk-CXSW4YRL.js";import"./chunk-UTPKLCNX.js";import{b as wt,c as xt,d as bt,e as Tt,f as Et,h as Ot}from"./chunk-HFUBAP3D.js";import{b as mt,f as X,k as gt,m as kt}from"./chunk-OHKPNELV.js";import{h as St}from"./chunk-CHSIHYYE.js";import{L as B,ga as ut,m as dt}from"./chunk-KO3EKDH5.js";import{a as _,h as ft}from"./chunk-XR4CMFGN.js";import{Zd as $t,ce as vt,ee as yt}from"./chunk-NSPPM3IJ.js";import{a as F}from"./chunk-5QXN3X2Q.js";import"./chunk-DCANE7XH.js";var Bt="default-src 'none'; style-src 'unsafe-inline'; img-src data:; base-uri 'none'; form-action 'none'",_t=`<!doctype html>
|
|
2
|
+
<html lang="{{lang}}" dir="{{dir}}">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Security-Policy" content="${Bt}">
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
+
<meta name="generator" content="pivotkit">
|
|
8
|
+
<meta name="description" content="{{summary}}">
|
|
9
|
+
<title>{{title}}</title>
|
|
10
|
+
{{style}}
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<main class="pk-report">
|
|
14
|
+
<header>
|
|
15
|
+
<h1>{{title}}</h1>
|
|
16
|
+
<p class="pk-report-description">{{description}}</p>
|
|
17
|
+
</header>
|
|
18
|
+
{{chart}}
|
|
19
|
+
{{table}}
|
|
20
|
+
{{details}}
|
|
21
|
+
</main>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
24
|
+
`;var I=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,tt=Object.freeze({en:Object.freeze({untitled:"Report",source:"Source",rows:"Rows",rowsCount:"{count} rows",generated:"Generated",filters:"Filters",noFilters:"None",chart:"Chart",tableCut:"The table shows the first {shown} of {count} rows. Export it as Excel or CSV for all of them.",chartCut:"The chart shows the first {shown} of {count} categories.",chartUnavailable:"The chart is left out: ECharts is not available."}),de:Object.freeze({untitled:"Bericht",source:"Quelle",rows:"Zeilen",rowsCount:"{count} Zeilen",generated:"Erstellt",filters:"Filter",noFilters:"Keine",chart:"Diagramm",tableCut:"Die Tabelle zeigt die ersten {shown} von {count} Zeilen. F\xFCr alle als Excel oder CSV exportieren.",chartCut:"Das Diagramm zeigt die ersten {shown} von {count} Kategorien.",chartUnavailable:"Das Diagramm fehlt: ECharts ist nicht verf\xFCgbar."})});function et(t,a={}){let e=String(t).split("-")[0].toLowerCase(),n=Object.hasOwn(tt,e)?tt[e]:tt.en,r={...n};for(let[m,h]of Object.entries(a??{}))Object.hasOwn(n,m)&&typeof h=="string"&&(r[m]=h);return r}var L=(t,a)=>t.replace(/\{(\w+)\}/g,(e,n)=>Object.hasOwn(a,n)?String(a[n]):e);var H=262144,rt=Object.freeze({title:"text",description:"text",source:"text",generated:"text",rows:"text",filters:"text",summary:"text",lang:"text",dir:"text",style:"markup",chart:"markup",table:"markup",details:"markup"}),At=Object.freeze(["lang","dir","title","alt","class","aria-label","aria-description"]),jt=new Set(["script","style","xmp","iframe","noembed","noframes","noscript","plaintext","template"]),Xt=new Set(["title","textarea"]),P="\\t\\n\\f\\r ",Jt=new RegExp(`^<(/?)([a-zA-Z][^${P}/>]*)`),Qt=new RegExp(`[${P}/]`),Yt=new RegExp(`^[^${P}/>=]+`),It=new RegExp(`^[${P}]*`),te=new RegExp(`^[^${P}>]*`);function v(t){return String(t).replace(I,"").replace(/[&<>"']/g,a=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[a])}function z(t,a,e={}){return new _("INVALID_TEMPLATE",`template: ${a}`,{reason:t,...e})}var C=(t,a)=>t.slice(0,a).split(`
|
|
25
|
+
`).length;function Lt(t){if(typeof t!="string")throw new _("INVALID_ARGUMENT","parseTemplate(source): source must be a string");if(t.length>H)throw new _("LIMIT_EXCEEDED",`the template has ${t.length.toLocaleString("en-US")} characters, more than the limit of ${H.toLocaleString("en-US")}`,{limit:"template",value:t.length,max:H});if(t.includes("\0"))throw z("nul","the template holds a NUL character");let a=[],e=new Set,n="",r=0,m=t.length,h=(i,S,d,u)=>{let b=t.indexOf("{{",i);if(b!==-1&&b<S){let o=/^\{\{\s*([^}\s]*)/.exec(t.slice(b,b+64))?.[1]??"";throw z(d,`a placeholder ${o?`{{${o}}} `:""}is not allowed ${u} (line ${C(t,b)})`,{placeholder:o,line:C(t,b)})}},x=(i,S,d)=>{let u=t.indexOf("}}",i+2),b=t.indexOf("{{",i+2);if(u===-1||b!==-1&&b<u)throw z("unclosed",`"{{" without "}}" (line ${C(t,i)})`,{line:C(t,i)});let o=t.slice(i+2,u).trim();if(!Object.hasOwn(rt,o)){let p=/^[\w-]{1,64}$/.test(o)?B(o,Object.keys(rt)):null;throw z("unknownPlaceholder",`unknown placeholder {{${o.slice(0,64)}}} (line ${C(t,i)})${p?`; did you mean {{${p}}}?`:""}`,{placeholder:o.slice(0,64),line:C(t,i),...p?{suggestion:p}:{}})}let c=rt[o];if(c==="markup"&&!S)throw z("markupInText",`{{${o}}} is markup and is allowed in the document's text only, not ${d} (line ${C(t,i)})`,{placeholder:o,line:C(t,i)});return{slot:{name:o,kind:c},end:u+2}},k=()=>{n&&(a.push(n),n="")},T=i=>{k(),a.push(i),e.add(i.name)};for(;r<m;){if(t.startsWith("{{",r)){if(/<\/?$/.test(t.slice(Math.max(0,r-2),r)))throw z("tagName",`a placeholder is not allowed where a tag's name starts (line ${C(t,r)})`,{line:C(t,r)});let{slot:s,end:g}=x(r,!0,"here");T(s),r=g;continue}if(t[r]!=="<"){n+=t[r++];continue}if(t.startsWith("<!--",r)){let s=t.indexOf("-->",r+4),g=s===-1?m:s+3;h(r,g,"comment","in a comment"),n+=t.slice(r,g),r=g;continue}if(t[r+1]==="!"||t[r+1]==="?"){let s=t.indexOf(">",r),g=s===-1?m:s+1;h(r,g,"markup","in a doctype or declaration"),n+=t.slice(r,g),r=g;continue}let i=Jt.exec(t.slice(r,r+256));if(!i){n+=t[r++];continue}let S=i[1]==="/",d=i[2].toLowerCase();k(),h(r,r+i[0].length,"tagName","in a tag's name"),n+=i[0],r+=i[0].length;let u=[],b=[];for(;r<m&&t[r]!==">";){if(Qt.test(t[r])){n+=t[r++];continue}let s=Yt.exec(t.slice(r,r+1024))?.[0]??t[r];h(r,r+s.length,"attributeName","in an attribute's name"),n+=s,r+=s.length;let g=It.exec(t.slice(r))?.[0]??"";if(t[r+g.length]!=="="){u.push({name:s.toLowerCase(),value:null});continue}n+=g+"=",r+=g.length+1,g=It.exec(t.slice(r))?.[0]??"",n+=g,r+=g.length;let E=t[r];if(E==='"'||E==="'"){let l=t.indexOf(E,r+1),O=l===-1?m:l;b.push({attr:s.toLowerCase(),start:r+1,end:O,quote:E}),u.push({name:s.toLowerCase(),value:t.slice(r+1,O)}),r=Math.min(m,O+1),n+="\0"+(b.length-1)+"\0";continue}let $=te.exec(t.slice(r))?.[0]??"";h(r,r+$.length,"unquoted",`in an unquoted attribute value (${s})`),u.push({name:s.toLowerCase(),value:$}),n+=$,r+=$.length}let o=d==="meta"&&u.some(s=>s.name==="name"&&(s.value??"").trim().toLowerCase()==="description")&&!u.some(s=>s.name==="http-equiv"),c=n;n="";let p=/\u0000(\d+)\u0000/g,f=0,w;for(;w=p.exec(c);){n+=c.slice(f,w.index),f=w.index+w[0].length;let s=b[Number(w[1])];At.includes(s.attr)||o&&s.attr==="content"||h(s.start,s.end,"attribute",`in the attribute "${s.attr}" (only ${At.join(", ")} and the content of <meta name="description"> without http-equiv)`),n+=s.quote;let E=s.start;for(;E<s.end;)if(t.startsWith("{{",E)){let{slot:$,end:l}=x(E,!1,"in an attribute");T($),E=l}else n+=t[E++];n+=s.quote}if(n+=c.slice(f),r<m&&(n+=">",r++),!S&&(jt.has(d)||Xt.has(d))){let s=new RegExp(`</${d}[${P}/>]`,"i"),g=t.slice(r),E=s.exec(g),$=E&&d!=="plaintext"?r+E.index:m;if(d==="script"&&t.slice(r,$).includes("<!--")&&h(r,m,"scriptComment",'after a <script> that holds "<!--"'),jt.has(d))h(r,$,"rawText",`inside <${d}>`),n+=t.slice(r,$);else{let l=r;for(;l<$;)if(t.startsWith("{{",l)){let{slot:O,end:A}=x(l,!1,`inside <${d}>`);T(O),l=A}else n+=t[l++]}r=$}}return k(),{parts:a,names:[...e]}}function zt(t,a){return t.parts.map(e=>{if(typeof e=="string")return e;let n=Object.hasOwn(a,e.name)?a[e.name]??"":"";return e.kind==="text"?v(n):n}).join("")}var K=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,nt=t=>t===2?" pk-grand":t===1?" pk-sub":"";function Pt(t,{maxCells:a,caption:e,colorScale:n=[...F.colorScale],dataBar:r=F.dataBar}){let m=Math.max(1,t.columnCount),h=t.rows.length-t.headerRows,x=Math.max(0,Math.min(h,Math.floor(a/m)-t.headerRows)),k=[],T=0,i=o=>{if(!o)return"";if(o.bar!==void 0){let c=o.color&&K.test(o.color)?o.color:r,p=Math.round(Math.max(0,Math.min(1,o.bar))*1e3)/10,f=`pk-c${T++}`;return k.push(`.${f}{--pk-bar:${p}%;--pk-bar-color:${K.test(c)?c:F.dataBar}}`),` pk-has-bar ${f}`}if(o.scale!==void 0){let c=Math.max(0,Math.min(1,o.scale)),p=o.color&&K.test(o.color)?o.color:gt(n.filter(w=>K.test(w)).length>=2?n.filter(w=>K.test(w)):[...F.colorScale],c),f=`pk-c${T++}`;return k.push(`.${f}{--pk-cell-bg:${p}}`),` pk-has-scale ${f}`}return""},S=o=>`${(o.colSpan??1)>1?` colspan="${o.colSpan}"`:""}${(o.rowSpan??1)>1?` rowspan="${o.rowSpan}"`:""}`,d=[];for(let o=0;o<t.headerRows;o++){let c=t.rows[o].map(p=>p?`<th scope="col" class="pk-th${p.kind==="corner"?" pk-corner":""}${nt(p.total)}"${S(p)}>${v(p.text)}</th>`:"").join("");d.push(`<tr>${c}</tr>`)}let u=[];for(let o=t.headerRows;o<t.headerRows+x;o++){let c=t.rows[o].map(p=>{if(!p)return"";let f=Math.min(p.rowSpan??1,t.headerRows+x-o),w=S({...p,rowSpan:f});if(p.kind==="rowHeader"){let g=p.toggle?.collapsed?" pk-collapsed":"";return`<th scope="row" class="pk-th pk-row${nt(p.total)}${g}"${w}>${v(p.text)}</th>`}return`<td class="pk-td${p.valueType==="text"?" pk-text":" pk-num"}${nt(p.total)}${i(p.style)}"${w}>${v(p.text)}</td>`}).join("");u.push(`<tr>${c}</tr>`)}return{html:`<table class="pk-table">${e?`<caption>${v(e)}</caption>`:""}<thead>${d.join("")}</thead><tbody>${u.join("")}</tbody></table>`,css:k.join(`
|
|
26
|
+
`),cut:x<h?{rows:x,of:h}:null}}var N=Object.freeze({"--pk-surface":"#ffffff","--pk-surface-2":"#f6f7f9","--pk-surface-raised":"#ffffff","--pk-text":"#1a1d23","--pk-muted":"#5a6270","--pk-border":"#dde1e7","--pk-border-strong":"#c3c9d2","--pk-grid":"#edf0f3","--pk-total":"#eef1f5","--pk-total-strong":"#e9edf3","--pk-shadow":"0 1px 2px rgb(16 24 40 / 0.06), 0 4px 12px rgb(16 24 40 / 0.08)","--pk-heat-low":"#eaf1fb","--pk-heat-high":"#2a78d6","--pk-scale-low":"var(--pk-heat-low)","--pk-scale-high":"var(--pk-heat-high)","--pk-chart-1":"#2a78d6","--pk-chart-2":"#eb6834","--pk-chart-3":"#1baf7a","--pk-chart-4":"#eda100","--pk-chart-5":"#e87ba4","--pk-chart-6":"#008300","--pk-chart-7":"#6250d6","--pk-chart-8":"#e34948"}),at=Object.freeze({"--pk-surface":"#16181d","--pk-surface-2":"#1c1f25","--pk-surface-raised":"#22262d","--pk-text":"#e8eaef","--pk-muted":"#a3aab7","--pk-border":"#2f343e","--pk-border-strong":"#454c58","--pk-grid":"#23272e","--pk-total":"#21252d","--pk-total-strong":"#252a33","--pk-shadow":"0 1px 2px rgb(0 0 0 / 0.4), 0 4px 12px rgb(0 0 0 / 0.3)","--pk-heat-low":"#1d2735","--pk-heat-high":"#3987e5","--pk-scale-low":"var(--pk-heat-low)","--pk-scale-high":"var(--pk-heat-high)","--pk-chart-1":"#3987e5","--pk-chart-2":"#d95926","--pk-chart-3":"#199e70","--pk-chart-4":"#c98500","--pk-chart-5":"#d55181","--pk-chart-6":"#008300","--pk-chart-7":"#9085e9","--pk-chart-8":"#e66767"}),D=Object.freeze({"--pk-weight-normal":"400","--pk-weight-medium":"500","--pk-weight-strong":"600","--pk-weight-bold":"700"}),M=Object.freeze({"--pk-radius-card":"8px"}),U=Object.freeze({"--pk-font-size":"14px","--pk-small":"max(14px, 0.93em)","--pk-report-title-size":"calc(var(--pk-font-size) * 10 / 7)","--pk-print-size":"10pt","--pk-print-small":"7pt"}),ot="system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif",ee=/^(?![\s\S]*(\/\*|\*\/))[#\w\s.,%()/*+-]*$/,re=new Set(["rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color","color-mix","light-dark","calc","min","max","clamp","var"]);function ne(t){if(/[\n\r\f]|url\(/i.test(t))return!1;let a=t.replace(/"[^"\\<>{};]*"/g,"");return ee.test(a)&&[...a.matchAll(/([\w-]*)\(/g)].every(e=>re.has(e[1].toLowerCase()))}function Dt(t={}){let a={...N,...D,...M,...U,"font-family":ot,...J(t)};return a["font-family"]=a["font-family"].replace(/["']/g,""),{getPropertyValue:e=>Object.hasOwn(a,e)?a[e]:""}}function J(t){let a={};for(let[e,n]of Object.entries(t??{}))(/^--pk-[a-z0-9-]+$/.test(e)||e==="font-family")&&typeof n=="string"&&n.length<=200&&ne(n)&&(a[e]=n.trim());return a}var ae=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;function st(t={}){let a={...N,...J(t)},e=(x,k=0)=>{let T=Object.hasOwn(a,x)?a[x]:"",i=/^var\((--pk-[a-z0-9-]+)\)$/.exec(T);return i&&k<4?e(i[1],k+1):ae.test(T)?T:null},[n,r,m,h]=["--pk-scale-low","--pk-scale-mid","--pk-scale-high","--pk-chart-1"].map(x=>e(x));return{...n&&m?{colorScale:r?[n,r,m]:[n,m]}:{},...h?{dataBar:h}:{}}}var it=t=>Object.entries(t).filter(([a])=>a.startsWith("--pk-")).map(([a,e])=>`${a}:${e}`).join(";");var Mt=Object.freeze({landscape:8,small:16});function Ut({columns:t,tokens:a={},extra:e=""}){let n=a["font-family"]??ot,r=it({...N,...D,...M,...U,...a}),m={...N,...a}["--pk-surface"],h=t>Mt.landscape?"size:landscape;":"";return`:root{${r};color-scheme:light dark}
|
|
27
|
+
@media screen and (prefers-color-scheme:dark){:root{${it(at)}}}
|
|
28
|
+
*{box-sizing:border-box}
|
|
29
|
+
body{margin:0;background:var(--pk-surface);color:var(--pk-text);font:var(--pk-font-size)/1.45 ${n}}
|
|
30
|
+
.pk-report{padding:24px}
|
|
31
|
+
.pk-report h1{font-size:var(--pk-report-title-size);font-weight:var(--pk-weight-bold);line-height:1.3;margin:0 0 4px}
|
|
32
|
+
.pk-report-description{margin:0 0 12px;color:var(--pk-muted)}
|
|
33
|
+
.pk-report-description:empty{display:none}
|
|
34
|
+
.pk-report-chart{margin:12px 0 16px;padding:8px;background:${m};border:1px solid var(--pk-border);border-radius:var(--pk-radius-card);break-inside:avoid;width:max-content;max-width:100%}
|
|
35
|
+
.pk-report-chart img,.pk-report-chart svg{display:block;max-width:100%;height:auto}
|
|
36
|
+
.pk-table{border-collapse:collapse;font-variant-numeric:tabular-nums;margin:12px 0 0}
|
|
37
|
+
.pk-table th,.pk-table td{border:1px solid var(--pk-border);padding:4px 8px;vertical-align:top}
|
|
38
|
+
.pk-th{background:var(--pk-surface-2);text-align:left;font-weight:var(--pk-weight-strong)}
|
|
39
|
+
.pk-th.pk-row{font-weight:var(--pk-weight-normal);background:var(--pk-surface)}
|
|
40
|
+
.pk-num{text-align:right;white-space:nowrap}
|
|
41
|
+
.pk-table .pk-sub{background:var(--pk-total);font-weight:var(--pk-weight-strong)}
|
|
42
|
+
.pk-table .pk-grand{background:var(--pk-total-strong);font-weight:var(--pk-weight-bold)}
|
|
43
|
+
.pk-collapsed::before{content:"+ ";color:var(--pk-muted)}
|
|
44
|
+
.pk-td.pk-has-scale{background:color-mix(in srgb,var(--pk-cell-bg) 48%,var(--pk-surface))}
|
|
45
|
+
.pk-td.pk-has-bar{background-image:linear-gradient(90deg,color-mix(in srgb,var(--pk-bar-color,var(--pk-chart-1)) 32%,transparent) var(--pk-bar),transparent var(--pk-bar));background-repeat:no-repeat;background-size:100% 64%;background-position:left center}
|
|
46
|
+
.pk-report-note{color:var(--pk-muted);margin:8px 0}
|
|
47
|
+
.pk-report-details{display:grid;grid-template-columns:max-content 1fr;gap:2px 12px;margin:16px 0 0;color:var(--pk-muted);font-size:var(--pk-small)}
|
|
48
|
+
.pk-report-details dt{font-weight:var(--pk-weight-strong)}
|
|
49
|
+
.pk-report-details dd{margin:0}
|
|
50
|
+
@page{margin:12mm;${h}}
|
|
51
|
+
@media print{
|
|
52
|
+
body{font-size:var(--pk-print-size);-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
53
|
+
.pk-report{padding:0}
|
|
54
|
+
.pk-report-chart{border:none;padding:0}
|
|
55
|
+
thead{display:table-header-group}
|
|
56
|
+
tr{break-inside:avoid}
|
|
57
|
+
.pk-table th,.pk-table td{padding:2px 6px}
|
|
58
|
+
${t>Mt.small?".pk-table{font-size:var(--pk-print-small)}":""}
|
|
59
|
+
}
|
|
60
|
+
${e}`}var oe=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","font-size","font-family","font-weight","font-style","text-anchor","dominant-baseline","paint-order","visibility"]),se=new Set(["svg","g","rect","path","text","tspan","circle","ellipse","line","polyline","polygon","defs","clipPath","linearGradient","radialGradient","stop","pattern","image","title","desc"]),Ft=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,ie=t=>t===9||t===10||t===13||t>=32&&t<=55295&&t!==127||t>=57344&&t<=65533||t>=65536&&t<=1114111,le=t=>ie(t)&&!Number.isNaN(t)&&!String.fromCodePoint(t).match(I),ce=/^[A-Za-z_][\w:.-]*$/,pe=Object.freeze({xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),he=t=>t.replace(/&(quot|#39|apos|lt|gt|amp);/g,(a,e)=>({quot:'"',"#39":"'",apos:"'",lt:"<",gt:">",amp:"&"})[e]),Ht=t=>t.replace(/[&<>"]/g,a=>({"&":"&","<":"<",">":">",'"':"""})[a]),R=t=>new _("INVALID_ARGUMENT",`the chart's SVG was refused: ${t}`,{reason:t});function fe(t){let a=[],e=/<(\/?)([a-zA-Z][\w:-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'))?)*)\s*(\/?)>/y,n=/\s+([^\s=>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'))?/g,r=t.startsWith("<?xml")?t.indexOf("?>")+2:0,m=0;for(;r<t.length;){let h=t.indexOf("<",r),x=t.slice(r,h===-1?t.length:h);if(/[<>]/.test(x)||/&(?!(?:amp|lt|gt|quot|apos|#\d+|#x[0-9a-fA-F]+);)/.test(x))throw R("text that is not escaped");if(a.push(x.replace(Ft,"").replace(I,"").replace(/&#(x[0-9a-fA-F]+|\d+);/g,(o,c)=>le(c[0]==="x"?parseInt(c.slice(1),16):Number(c))?o:"")),h===-1)break;if(/^<style[\s>]/i.test(t.slice(h,h+7))){let o=t.search(/<\/style\s*>/i);if(o===-1||o<h)throw R("a <style> element that is not closed");r=t.indexOf(">",o)+1;continue}if(t.startsWith("<!--",h)){let o=t.indexOf("-->",h);r=o===-1?t.length:o+3;continue}e.lastIndex=h;let k=e.exec(t);if(!k)throw R("markup that is not a plain element");let[,T,i,S,d]=k;if(!se.has(i))throw R(`the element <${i}>`);let u=`<${T}${i}`,b=new Map;for(let[,o,c,p]of S.matchAll(n)){let f=he(c??p??"").replace(Ft,"").replace(I,""),w=o.toLowerCase();if(!ce.test(o))throw R("an attribute name that is not a plain name");if((w==="xmlns"||w.startsWith("xmlns:"))&&pe[w]!==f)throw R(`the namespace ${o}`);if(w.startsWith("on"))throw R(`the event attribute ${o}`);if((w==="href"||w==="xlink:href"||w==="src")&&!(/^#[\w-]+$/.test(f)||/^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/=]*$/.test(f)))throw R(`a link in ${o}`);if(w==="style"){for(let s of f.split(";")){let g=s.indexOf(":"),E=s.slice(0,g).trim().toLowerCase(),$=s.slice(g+1).trim();g>0&&oe.has(E)&&!/url\s*\(|expression\s*\(/i.test($)&&b.set(E,$)}continue}if(/url\s*\(\s*['"]?\s*(?!#)/i.test(f))throw R(`an address in ${o}`);u+=` ${o}="${Ht(f)}"`}for(let[o,c]of b)new RegExp(`\\s${o}=`).test(u)||(u+=` ${o}="${Ht(c)}"`);u+=`${d}>`,a.push(u),i==="svg"&&(m+=T?-1:d?0:1),r=e.lastIndex}if(m!==0)throw R("an <svg> element that is not closed");return a.join("")}function Kt(t,{echarts:a,style:e,width:n,height:r,locale:m,labels:h,limits:x,now:k,maxCategories:T}){let i=t.view,S=bt(i,t.encoded),d=S.swap?X(t.encoded,Tt(i),{locale:m,limits:x,...k!==void 0?{now:k}:{}}):t,u=wt(d,{labels:h,limits:x,maxCategories:T}),b=xt(d,{theme:Et(e),locale:m,labels:h,limits:x,maxCategories:T,series:u,chart:S.chart}),o=yt(b,e,{width:n,height:r,categoryNames:u.categories,axisLabels:i.chart.axisLabels}),c=e.getPropertyValue("--pk-surface").trim()||N["--pk-surface"],p=a.init(null,null,{renderer:"svg",ssr:!0,width:n,height:r}),f;try{let{axisEvery:w,...s}=o;p.setOption({...s,backgroundColor:c,animation:!1}),f=p.renderToSVGString()}finally{p.dispose()}return{svg:fe(f),categories:u.categories.length,of:u.categoryCount}}var me="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",Q=Object.freeze({json:Object.freeze({mediaType:"application/json",extension:"json",text:!0}),csv:Object.freeze({mediaType:"text/csv;charset=utf-8",extension:"csv",text:!0}),xlsx:Object.freeze({mediaType:me,extension:"xlsx",text:!1}),svg:Object.freeze({mediaType:"image/svg+xml",extension:"svg",text:!0}),html:Object.freeze({mediaType:"text/html;charset=utf-8",extension:"html",text:!0})}),G=Object.freeze({template:H,chartWidth:8e3,chartHeight:8e3,tableCells:2e5,categories:50}),pt=Object.freeze({width:800,height:480}),de=Object.freeze(["chartUnavailable","tableCut","chartCut","viewFile"]),ue=new Set(["ar","he","fa","ur","ps","sd","ug","yi","dv","ckb"]),ge=Object.freeze({chart:[!0,!1,"auto"],chartEmbed:["image","inline"],bom:[!0,!1],strict:[!0,!1],trusted:[!0,!1]}),Gt=Object.freeze(["format","locale","timeZone","now","limits","trusted","strict","labels","texts","tokens","title","description","source","template","chart","chartEmbed","echarts","size","tableCells","bom"]),j=(t,a)=>new _("INVALID_OPTION",`render: ${a}`,{option:t}),lt=(t,a,e={})=>({path:"",code:t,message:a,severity:"warning",params:e});function ke(t,a){if(Array.isArray(t)||t&&typeof t=="object"&&Array.isArray(t.columns)&&Array.isArray(t.data)){let e=t;return mt(Array.isArray(t)?t:{columns:e.columns,types:e.types,data:e.data},{timeZone:a.timeZone??"UTC",...a.limits?{limits:a.limits}:{}})}if(t&&typeof t=="object"&&typeof t.column=="function")return t;throw new _("INVALID_ARGUMENT","render(view, data): data must be rows, columnar data ({ columns, types, data }) or encode()'s result")}function we(t){let a=t?.width??pt.width,e=t?.height??pt.height;for(let[n,r,m]of[["width",a,G.chartWidth],["height",e,G.chartHeight]])if(!Number.isInteger(r)||r<100||r>m)throw j("size",`size.${n} must be a whole number from 100 to ${m}`);return{width:a,height:e}}function Vt(t,a,e){let n=t===void 0?new Date:new Date(t);if(Number.isNaN(n.getTime()))throw j("now","now must be a date, a time in ms or an ISO text");return new Intl.DateTimeFormat(a,{dateStyle:"medium",timeStyle:"short",timeZone:e}).format(n)}async function Wt(t,a,e={}){if(e===null||typeof e!="object"||Array.isArray(e))throw j("options","options must be an object");for(let l of Object.keys(e))if(!Gt.includes(l)){let O=B(l,Gt);throw j(l,`unknown option ${JSON.stringify(l.slice(0,40))}${O?`; did you mean ${JSON.stringify(O)}?`:""}`)}let n=e.format??"html";if(!Object.hasOwn(Q,n))throw j("format",`unknown format ${JSON.stringify(String(n)).slice(0,40)}; one of ${Object.keys(Q).join(", ")}`);let r=Q[n],m={format:n,mediaType:r.mediaType,extension:r.extension},h=n==="html"?Lt(e.template??_t):null,x=n==="svg"||n==="html"?we(e.size):null;for(let[l,O]of Object.entries(ge)){let A=e[l];if(A!==void 0&&!O.includes(A))throw j(l,`${l} takes ${O.map(V=>JSON.stringify(V)).join(", ")}, not ${JSON.stringify(String(A)).slice(0,40)}`)}if((n==="svg"||n==="html"&&e.chart===!0)&&typeof e.echarts?.init!="function")throw j("echarts",`${n==="svg"?"an SVG":"a report with chart: true"} needs ECharts: pass the echarts module (with its SVG renderer) as options.echarts`);e.now!==void 0&&Vt(e.now,"en-US","UTC");let k=[],T=St(typeof t=="string"?t:JSON.stringify(t??null));T.failed&&k.push({path:"",code:"viewFile",message:`not a view: ${T.issues.at(-1)?.message??T.failed}`,severity:"error",params:{value:T.failed}});let i=ke(a,e),S=e.trusted?e.limits:ft(e.limits),d=ut(T.view??{},i,{...S?{limits:S}:{}});k.push(...d.issues);let u={locale:e.locale??"en-US",...e.limits?{limits:e.limits}:{},...e.now!==void 0?{now:e.now}:{}},b=X(i,d.view,u);for(let l of b.issues)k.some(O=>O.code===l.code&&O.path===l.path)||k.push(l);let o=!k.some(l=>l.severity==="error");if(!o&&e.strict)return{...m,body:null,issues:k,ok:o,summary:null,view:d.view};let c=kt(b,{labels:e.labels??dt(b.locale??u.locale),...e.limits?{limits:e.limits}:{}}),p={rows:c.bodyRows.length,columns:c.columnCount,sourceRows:i.length,keptRows:b.rows.length,truncated:!1},f=et(c.locale,e.texts),w=(e.title??(T.name||d.view.chart.title||f.untitled)).trim()||f.untitled,s=()=>Kt(b,{echarts:e.echarts,style:Dt(e.tokens),...x,locale:c.locale,labels:e.labels,limits:e.limits,now:e.now,maxCategories:G.categories}),g=l=>{l.categories<l.of&&(p.truncated=!0,k.push(lt("chartCut",L(ct.chartCut,{shown:l.categories,count:l.of}),{value:String(l.categories),max:l.of})))},E;if(n==="json")E=new TextEncoder().encode(Ct(c));else if(n==="csv")E=Nt(c,{bom:e.bom!==!1});else if(n==="xlsx")E=Rt(c,{sheetName:w,theme:st(e.tokens)});else if(n==="svg"){let l=s();g(l),E=new TextEncoder().encode(l.svg)}else{let l=new Intl.NumberFormat(c.locale),O=Pt(c,{maxCells:e.tableCells??G.tableCells,...st(e.tokens)}),A="";O.cut&&(p.truncated=!0,k.push(lt("tableCut",L(ct.tableCut,{shown:O.cut.rows,count:O.cut.of}),{value:String(O.cut.rows),max:O.cut.of})),A=`<p class="pk-report-note">${v(L(f.tableCut,{shown:l.format(O.cut.rows),count:l.format(O.cut.of)}))}</p>`);let V=e.chart===!0||(e.chart??"auto")==="auto"&&d.view.display==="chart",ht="";if(V&&typeof e.echarts?.init!="function")k.push(lt("chartUnavailable",ct.chartUnavailable));else if(V){let y=s();g(y);let q=y.categories<y.of?`<figcaption class="pk-report-note">${v(L(f.chartCut,{shown:l.format(y.categories),count:l.format(y.of)}))}</figcaption>`:"";ht=`<figure class="pk-report-chart">${e.chartEmbed==="inline"?y.svg:`<img alt="${v(`${f.chart}: ${w}`)}" width="${x?.width}" height="${x?.height}" src="data:image/svg+xml;base64,${xe(new TextEncoder().encode(y.svg))}">`}${q}</figure>`}let Y=Ot(d.view,i,{...S?{limits:S}:{}}),Zt=e.timeZone??c.timeZone??"UTC",W={title:w,description:e.description??T.description??"",source:e.source??"",generated:Vt(e.now,c.locale,Zt),rows:L(f.rowsCount,{count:l.format(i.length)}),filters:Y.filters.length?Y.filters.map(y=>y.text).join("; "):f.noFilters,summary:Y.text,lang:c.locale,dir:ue.has(c.locale.split("-")[0].toLowerCase())?"rtl":"ltr"},Z=(y,q)=>q?`<dt>${v(y)}</dt><dd>${v(q)}</dd>`:"",qt={style:`<style>${Ut({columns:c.columnCount,tokens:J(e.tokens??{}),extra:O.css})}</style>`,chart:ht,table:O.html+A,details:`<dl class="pk-report-details">${Z(f.source,W.source)}${Z(f.rows,l.format(i.length))}${Z(f.filters,W.filters)}${Z(f.generated,W.generated)}</dl>`};E=new TextEncoder().encode(zt(h,{...W,...qt}))}let $={...m,body:E,issues:k,ok:o,summary:p,view:d.view};return r.text?{...$,text:new TextDecoder().decode(E)}:$}var ct=et("en");function xe(t){let a="";for(let e=0;e<t.length;e+=32768)a+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(a)}$t([vt]);var tr=Object.freeze([...Object.keys(D),...Object.keys(M),...Object.keys(N),"--pk-scale-mid"]),er=Object.freeze(Object.keys(U));export{er as REPORT_LENGTHS,tr as REPORT_TOKENS,Wt as render};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DCANE7XH.js";var k={item:"{subject}: {text}",quote:"\u201C{key}\u201D",position:"{subject} (no. {n} in {part})",view:"The view",sections:{sort:"Sorting",derived:"Groupings",totals:"Totals",collapsed:"Collapsed groups",display:"Table or chart",chart:"Chart",formatting:"Formatting"},settings:{display:"display",type:"chart type",valueLabels:"value labels",legend:"legend position",axisLabels:"axis labels",groupLabels:"group labels",labelPosition:"label position",other:"setting"},dropped:{rows:"it is left out of Rows",cols:"it is left out of Columns",values:"this value is left out",filters:"this filter is left out",sort:"the usual order is used",derived:"this grouping is left out",other:"it is left out"},codes:{notView:"this is not a pivotkit view - the report starts empty",notJson:"this is not valid JSON - the report starts empty",tooLarge:"the view is too large - the report starts empty",badVersion:"the view has an unknown version - the report starts empty",newerVersion:"the view comes from a newer pivotkit - the report starts empty; update pivotkit to open it",noMigration:"the view cannot be brought to this version - the report starts empty",unknownKey:"this setting is unknown here - it is ignored",notList:"this is not a list - nothing of it is used",tooMany:"more than {max} entries - only the first {max} are used",tooManyItems:"more than {max} items - only the first {max} are used",itemType:"the item \u201C{value}\u201D does not fit a {type} field - it is left out",itemTooLong:"an item is longer than {max} characters - it is left out",itemCase:"the data has no item \u201C{value}\u201D, but \u201C{suggestion}\u201D - the filter keeps the item as written",unknownField:"the data has no field \u201C{field}\u201D - {dropped}",unknownFieldHere:"the data has no field of this name - {dropped}",placedTwice:"the field is in Rows or Columns twice - only its first place is used",groupingNoName:"the grouping has no name - it is left out",groupingNameTaken:"the data already has a field of this name - the grouping is left out",groupingNoSource:"the data has no field \u201C{field}\u201D to group - the grouping is left out",groupingUnknown:"the grouping \u201C{value}\u201D is unknown - it is left out",binsNeedNumber:"ranges need a number field, \u201C{field}\u201D is not one - the grouping is left out",groupingNeedsDate:"a date grouping needs a date field, \u201C{field}\u201D is not one - the grouping is left out",binSize:"ranges need a size above zero - the grouping is left out",notValueRef:"this is not a value - {dropped}",unknownAggregator:"the calculation \u201C{value}\u201D is unknown - {dropped}",aggregatorNeedsField:"{agg} needs a field - {dropped}",aggregatorType:"{agg} does not work on \u201C{field}\u201D ({type}) - {dropped}",unknownFormat:"the number format \u201C{value}\u201D is unknown - the usual format is used",badLabel:"the name is empty or longer than {max} characters - the usual name is used",unknownShowAs:"\u201CShow as\u201D \u201C{value}\u201D is unknown - the plain value is shown",showAsNotAdditive:"this \u201CShow as\u201D needs a sum or a count, not {agg} - the plain value is shown",showAsNotNumber:"{agg} gives no number to show as a share - the plain value is shown",unknownConditional:"the colour format \u201C{value}\u201D is unknown - the value is shown without colours",conditionalNotNumber:"colours need a number value - the value is shown without colours",colorScaleColors:"the colour scale needs two or three colours - the default colours are used",dataBarColor:"the bar colour is not a colour - the default colour is used",unknownFilterType:"the filter type \u201C{value}\u201D is unknown - this filter is left out",filterNoItems:"the filter lists no items - it is left out",filterFieldType:"a filter of the type \u201C{value}\u201D does not work on \u201C{field}\u201D ({type}) - this filter is left out",filterTextOp:"the text condition \u201C{value}\u201D is unknown - this filter is left out",filterMatch:"the text matching is unknown - case and spaces are ignored",filterNot:"\u201Cnot\u201D must be true or false - the filter is not inverted",filterBlanks:"what happens to blank items is unknown (\u201C{value}\u201D) - blank items are left out",blanksUnspecified:"the filter does not say what happens to blank items - they are left out",filterEmpty:"the filter lists no items and keeps no blanks - it keeps nothing",filterText:"the text condition has no text, or more than {max} characters - this filter is left out",filterNotNumber:"{agg} gives no number to filter by - this filter is left out",filterTies:"the ties \u201C{value}\u201D are unknown (first or all) - the first in the data are kept",filterPrecision:"the precision \u201C{value}\u201D is unknown or not for this field (year, quarter, month, day or hour of a date) - days are compared",filterCount:"Top needs a whole number from 1 to {max} - this filter is left out",filterValue:"the condition needs a comparison and a number - this filter is left out",filterValue2:"\u201C{value}\u201D needs a second number - this filter is left out",filterCompareValue:"the comparison needs an operator and a number or a date (2022-03-01) that fits the field - this filter is left out",filterRelativeDirection:"the direction \u201C{value}\u201D is unknown (last, next, this or before) - this filter is left out",filterRelativeUnit:"the unit \u201C{value}\u201D is unknown (hours, days, weeks, months, quarters or years) - this filter is left out",filterRelativeCount:"the range needs a whole number from 1 to {max} - this filter is left out",filterRelativeAnchor:"the range can count from \u201Ctoday\u201D, \u201Clatest\u201D (the latest record), \u201Cfirst\u201D (the first record) or a date, not from \u201C{value}\u201D - this filter is left out",sortNoItems:"the custom order lists no items - the usual order is used",sortedTwice:"the field is sorted twice - only its first sort is used",badTotals:"the totals cannot be read - the usual totals are shown",collapsedPath:"a collapsed group does not fit the fields - it is shown expanded",unknownSetting:"the {setting} \u201C{value}\u201D is unknown - the default is used",badTitle:"the title is empty or longer than {max} characters - the chart has no title",unknownLocale:"the language \u201C{value}\u201D is unknown - the report's language is used",unknownTimeZone:"the time zone \u201C{value}\u201D is unknown - the data's time zone is used",timeZoneMismatch:"the view was made for the time zone {value}, the data is in {zone} - times are read in {zone}",tooManyIssues:"{value} more problems are not listed - fix the ones above and load the view again to see them"},other:"this part could not be used - it is left out"},f=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),s=(e,r)=>f(e)&&Object.hasOwn(e,r)?e[r]:void 0,p=e=>typeof e=="string"&&e.trim()!==""?e.trim():null,g=/^(rows|cols|values|filters|sort|derived)\[(\d+)\]/;function C(e,r){let i=p(s(e,"label"));if(i)return i;let n=s(e,"agg");if(typeof n!="string")return null;let o=s(e,"field");return r.value({field:typeof o=="string"?o:null,agg:n,label:null,showAs:null})}function D(e,r,i,n){if(e.code==="unknownKey")return n.fill(i.quote,{key:e.path.split(".").pop()??e.path});let o=g.exec(e.path);if(o){let u=s(r,o[1]),l=Array.isArray(u)?u[Number(o[2])]:void 0,h=o[1]==="values"?C(l,n):p(o[1]==="rows"||o[1]==="cols"?l:o[1]==="derived"?s(l,"name"):s(l,"field"));if(h)return o[1]==="values"||o[1]==="derived"?h:n.field(h)}let t=/^[a-z]*/i.exec(e.path)?.[0]??"";return s(n.labels.zones,t)??s(i.sections,t)??i.view}function m(e,r,i,n){let{labels:o,fill:t}=n,u=/^[a-z]*/i.exec(e.path)?.[0]??"",l=typeof e.code=="string"?e.code:"",h=l==="unknownField"&&/^(rows|cols|filters|sort)\[\d+\]$/.test(e.path)?"unknownFieldHere":l,c=l?s(i.codes,h)??i.other:"{message}",a=f(e.params)?e.params:{},w=o.core,v={dropped:s(i.dropped,u)??i.dropped.other,setting:s(i.settings,e.path.split(".").pop()??"")??i.settings.other,field:typeof a.field=="string"?n.field(a.field):"",value:a.value??"",agg:typeof a.agg=="string"?s(w.aggregators,a.agg)??a.agg:"",type:typeof a.type=="string"?s(o.types,a.type)??a.type:"",max:typeof a.max=="number"?a.max.toLocaleString(o.lang):"",zone:a.zone??"",suggestion:a.suggestion??"",message:e.message},[b,y=""]=i.item.split("{subject}"),d={text:t(c,v)};return{pre:t(b,d),subject:D(e,r,i,n),post:t(y,d)}}function N(e,r,i){let n=e.map(t=>({...m(t.issue,t.raw,r,i),at:g.exec(t.issue.path)})),o=new Map;for(let t of n){let u=o.get(t.subject)??new Set;u.add(t.at?t.at[0]:""),o.set(t.subject,u)}return n.map(({at:t,...u})=>{if(!t||o.get(u.subject).size<2)return u;let l=s(i.labels.zones,t[1])??s(r.sections,t[1])??t[1];return{...u,subject:i.fill(r.position,{subject:u.subject,n:Number(t[2])+1,part:l})}})}export{k as en,m as unusedItem,N as unusedItems};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DCANE7XH.js";var e={item:"{subject}: {text}",quote:"\u201E{key}\u201C",position:"{subject} (Nr. {n}, {part})",view:"Die Ansicht",sections:{sort:"Sortierung",derived:"Gruppierungen",totals:"Summen",collapsed:"Zugeklappte Gruppen",display:"Tabelle oder Diagramm",chart:"Diagramm",formatting:"Formatierung"},settings:{display:"Darstellung",type:"Diagrammtyp",valueLabels:"Wertbeschriftung",legend:"Legendenposition",axisLabels:"Achsenbeschriftung",groupLabels:"Gruppenbeschriftung",labelPosition:"Beschriftungsposition",other:"Einstellung"},dropped:{rows:"es wird in Zeilen weggelassen",cols:"es wird in Spalten weggelassen",values:"dieser Wert wird weggelassen",filters:"dieser Filter wird weggelassen",sort:"die \xFCbliche Reihenfolge gilt",derived:"diese Gruppierung wird weggelassen",other:"es wird weggelassen"},codes:{notView:"das ist keine pivotkit-Ansicht - der Bericht beginnt leer",notJson:"das ist kein g\xFCltiges JSON - der Bericht beginnt leer",tooLarge:"die Ansicht ist zu gro\xDF - der Bericht beginnt leer",badVersion:"die Ansicht hat eine unbekannte Version - der Bericht beginnt leer",newerVersion:"die Ansicht stammt aus einem neueren pivotkit - der Bericht beginnt leer; aktualisieren Sie pivotkit, um sie zu \xF6ffnen",noMigration:"die Ansicht l\xE4sst sich nicht auf diese Version bringen - der Bericht beginnt leer",unknownKey:"diese Einstellung ist hier unbekannt - sie wird ignoriert",notList:"das ist keine Liste - nichts davon wird verwendet",tooMany:"mehr als {max} Eintr\xE4ge - nur die ersten {max} werden verwendet",tooManyItems:"mehr als {max} Eintr\xE4ge - nur die ersten {max} werden verwendet",itemType:"der Eintrag \u201E{value}\u201C passt nicht zu einem Feld vom Typ {type} - er wird weggelassen",itemTooLong:"ein Eintrag ist l\xE4nger als {max} Zeichen - er wird weggelassen",itemCase:"die Daten haben keinen Eintrag \u201E{value}\u201C, aber \u201E{suggestion}\u201C - der Filter beh\xE4lt den Eintrag, wie er geschrieben ist",unknownField:"die Daten haben kein Feld \u201E{field}\u201C - {dropped}",unknownFieldHere:"die Daten haben kein Feld mit diesem Namen - {dropped}",placedTwice:"das Feld steht zweimal in Zeilen oder Spalten - nur sein erster Platz gilt",groupingNoName:"die Gruppierung hat keinen Namen - sie wird weggelassen",groupingNameTaken:"die Daten haben schon ein Feld mit diesem Namen - die Gruppierung wird weggelassen",groupingNoSource:"die Daten haben kein Feld \u201E{field}\u201C zum Gruppieren - die Gruppierung wird weggelassen",groupingUnknown:"die Gruppierung \u201E{value}\u201C ist unbekannt - sie wird weggelassen",binsNeedNumber:"Bereiche brauchen ein Zahlenfeld, \u201E{field}\u201C ist keines - die Gruppierung wird weggelassen",groupingNeedsDate:"eine Datumsgruppierung braucht ein Datumsfeld, \u201E{field}\u201C ist keines - die Gruppierung wird weggelassen",binSize:"Bereiche brauchen eine Gr\xF6\xDFe \xFCber null - die Gruppierung wird weggelassen",notValueRef:"das ist kein Wert - {dropped}",unknownAggregator:"die Berechnung \u201E{value}\u201C ist unbekannt - {dropped}",aggregatorNeedsField:"{agg} braucht ein Feld - {dropped}",aggregatorType:"{agg} geht nicht mit \u201E{field}\u201C ({type}) - {dropped}",unknownFormat:"das Zahlenformat \u201E{value}\u201C ist unbekannt - das \xFCbliche Format gilt",badLabel:"der Name ist leer oder l\xE4nger als {max} Zeichen - der \xFCbliche Name gilt",unknownShowAs:"\u201EAnzeigen als\u201C \u201E{value}\u201C ist unbekannt - der Wert wird ohne Berechnung gezeigt",showAsNotAdditive:"dieses \u201EAnzeigen als\u201C braucht eine Summe oder Anzahl, nicht {agg} - der Wert wird ohne Berechnung gezeigt",showAsNotNumber:"{agg} ergibt keine Zahl f\xFCr einen Anteil - der Wert wird ohne Berechnung gezeigt",unknownConditional:"die Farbformatierung \u201E{value}\u201C ist unbekannt - der Wert wird ohne Farben gezeigt",conditionalNotNumber:"Farben brauchen einen Zahlenwert - der Wert wird ohne Farben gezeigt",colorScaleColors:"die Farbskala braucht zwei oder drei Farben - die Standardfarben werden verwendet",dataBarColor:"die Balkenfarbe ist keine Farbe - die Standardfarbe wird verwendet",unknownFilterType:"die Filterart \u201E{value}\u201C ist unbekannt - dieser Filter wird weggelassen",filterNoItems:"der Filter nennt keine Eintr\xE4ge - er wird weggelassen",filterFieldType:"ein Filter vom Typ \u201E{value}\u201C funktioniert nicht mit \u201E{field}\u201C ({type}) - dieser Filter wird weggelassen",filterTextOp:"die Textbedingung \u201E{value}\u201C ist unbekannt - dieser Filter wird weggelassen",filterMatch:"der Textvergleich ist unbekannt - Gro\xDF- und Kleinschreibung und Leerzeichen z\xE4hlen nicht",filterNot:"\u201Enot\u201C muss true oder false sein - der Filter wird nicht umgekehrt",filterBlanks:"was mit leeren Eintr\xE4gen geschieht, ist unbekannt (\u201E{value}\u201C) - leere Eintr\xE4ge werden weggelassen",blanksUnspecified:"der Filter sagt nicht, was mit leeren Eintr\xE4gen geschieht - sie werden weggelassen",filterEmpty:"der Filter nennt keine Eintr\xE4ge und beh\xE4lt keine leeren - er beh\xE4lt nichts",filterText:"die Textbedingung hat keinen Text oder mehr als {max} Zeichen - dieser Filter wird weggelassen",filterNotNumber:"{agg} ergibt keine Zahl zum Filtern - dieser Filter wird weggelassen",filterTies:"die Gleichst\xE4nde \u201E{value}\u201C sind unbekannt (first oder all) - die ersten in den Daten werden behalten",filterPrecision:"die Genauigkeit \u201E{value}\u201C ist unbekannt oder passt nicht zum Feld (Jahr, Quartal, Monat, Tag oder Stunde eines Datums) - Tage werden verglichen",filterCount:"\u201EOberste\u201C braucht eine ganze Zahl von 1 bis {max} - dieser Filter wird weggelassen",filterValue:"die Bedingung braucht einen Vergleich und eine Zahl - dieser Filter wird weggelassen",filterValue2:"\u201E{value}\u201C braucht eine zweite Zahl - dieser Filter wird weggelassen",filterCompareValue:"der Vergleich braucht einen Operator und eine Zahl oder ein Datum (2022-03-01), das zum Feld passt - dieser Filter wird weggelassen",filterRelativeDirection:"die Richtung \u201E{value}\u201C ist unbekannt (last, next, this oder before) - dieser Filter wird weggelassen",filterRelativeUnit:"die Einheit \u201E{value}\u201C ist unbekannt (Stunden, Tage, Wochen, Monate, Quartale oder Jahre) - dieser Filter wird weggelassen",filterRelativeCount:"der Zeitraum braucht eine ganze Zahl von 1 bis {max} - dieser Filter wird weggelassen",filterRelativeAnchor:"der Zeitraum kann ab \u201Etoday\u201C (heute), \u201Elatest\u201C (letzter Eintrag), \u201Efirst\u201C (erster Eintrag) oder einem Datum z\xE4hlen, nicht ab \u201E{value}\u201C - dieser Filter wird weggelassen",sortNoItems:"die eigene Reihenfolge nennt keine Eintr\xE4ge - die \xFCbliche Reihenfolge gilt",sortedTwice:"das Feld wird zweimal sortiert - nur seine erste Sortierung gilt",badTotals:"die Summen lassen sich nicht lesen - die \xFCblichen Summen werden gezeigt",collapsedPath:"eine zugeklappte Gruppe passt nicht zu den Feldern - sie wird aufgeklappt gezeigt",unknownSetting:"{setting} \u201E{value}\u201C ist unbekannt - die Voreinstellung gilt",badTitle:"der Titel ist leer oder l\xE4nger als {max} Zeichen - das Diagramm hat keinen Titel",unknownLocale:"die Sprache \u201E{value}\u201C ist unbekannt - die Sprache des Berichts gilt",unknownTimeZone:"die Zeitzone \u201E{value}\u201C ist unbekannt - die Zeitzone der Daten gilt",timeZoneMismatch:"die Ansicht wurde f\xFCr die Zeitzone {value} gemacht, die Daten sind in {zone} - Zeiten gelten in {zone}",tooManyIssues:"{value} weitere Probleme sind nicht aufgef\xFChrt - beheben Sie die obigen und laden Sie die Ansicht erneut, um sie zu sehen"},other:"dieser Teil konnte nicht verwendet werden - er wird weggelassen"};export{e as de};
|
package/dist/element.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunks/chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunks/chunk-NXZQI5LC.js";import"./chunks/chunk-7V4PAOK7.js";import"./chunks/chunk-YMLEL3SK.js";import"./chunks/chunk-HFUBAP3D.js";import"./chunks/chunk-OHKPNELV.js";import"./chunks/chunk-CHSIHYYE.js";import"./chunks/chunk-KO3EKDH5.js";import"./chunks/chunk-XR4CMFGN.js";import"./chunks/chunk-5QXN3X2Q.js";import"./chunks/chunk-DCANE7XH.js";export{a as EVENTS,c as PivotReportElement,b as TAG,d as define};
|
package/dist/import-worker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Ie=Object.defineProperty;var _=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var ae=(e,t)=>{for(var n in t)Ie(e,n,{get:t[n],enumerable:!0})};var E,$=_(()=>{E=class extends Error{constructor(t,n,r={}){super(n),this.name="PivotkitError",this.code=t,this.details=r}}});function P(e){let t=e&&e.limits;if(t==null)return K;if(typeof t!="object")throw new E("INVALID_OPTION","options.limits must be an object");let n={...K};for(let r of Object.keys(t)){let o=t[r];if(!Object.hasOwn(K,r))throw new E("INVALID_OPTION",`unknown limit "${r}"`);if(!Number.isInteger(o)||o<1)throw new E("INVALID_OPTION",`limits.${r} must be a whole number of 1 or more`);if(Object.hasOwn(Q,r)&&o>Q[r])throw new E("INVALID_OPTION",`limits.${r} must be at most ${Q[r]}`);n[r]=o}return Object.freeze(n)}var K,Q,q=_(()=>{$();K=Object.freeze({json:5e6,name:256,axisFields:8,values:16,filters:128,items:1e5,derived:64,sort:64,collapsed:1e4,topCount:1e6,rows:1e6,groups:5e5,pivotCells:2e6,work:1e8,cells:2e6,cacheEntries:16,fileBytes:104857600,columns:1e3,importCells:1e7,textLength:32767,archiveEntries:1e4,unpackedBytes:524288e3}),Q=Object.freeze({groups:2**27})});function Le(e,t,n,r=0,o=0,a=0,l=0){if(e>=100)return Date.UTC(e,t-1,n,r,o,a,l);let s=new Date(Date.UTC(2e3,t-1,n,r,o,a,l));return s.setUTCFullYear(e),s.getTime()}function R(e){let t=Ce.exec(e.trim());if(!t)return null;let n=t[8],r=+t[1],o=+t[2],a=+t[3],l=t[4]===void 0?0:+t[4],s=t[5]===void 0?0:+t[5],i=t[6]===void 0?0:+t[6],f=t[7];if(o<1||o>12||a<1||l>23||s>59||i>59)return null;let c=Le(r,o,a,l,s,i,f?Math.round(+`0.${f}`*1e3):0);if(new Date(c).getUTCDate()!==a)return null;let m=null;if(n)if(n==="Z")m=0;else{let w=n.slice(1).replace(":",""),g=Number(w.slice(0,2)),d=Number(w.slice(2)||0);if(g>23||d>59)return null;m=(n[0]==="-"?-1:1)*(g*60+d)}return{ms:c,offsetMinutes:m}}var Ce,le=_(()=>{Ce=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}(?::?\d{2})?)?)?$/});function N(e,t,n,r={}){return new E("INVALID_FILE",`"${t}": ${n}`,{reason:e,file:t,...r})}function C(e,t,n,r,o){let a=l=>l.toLocaleString("en-US");return new E("LIMIT_EXCEEDED",`"${r}" has more than ${a(n)} ${o} (limits.${e}): load a smaller extract of it, or a host can raise limits.${e}`,{limit:e,value:t,max:n,file:r})}function A(e,t,n,r,o){if(t>n)throw C(e,t,n,r,o)}function x(e,t){let n=e&&typeof e=="object"&&typeof e.name=="string"?e.name:"";return ke(String(t?.name??n??"")).slice(0,256)||"file"}async function F(e,t,n){if(e instanceof Uint8Array)return A("fileBytes",e.byteLength,t.fileBytes,n,"bytes"),e;if(e instanceof ArrayBuffer)return A("fileBytes",e.byteLength,t.fileBytes,n,"bytes"),new Uint8Array(e);if(typeof Blob<"u"&&e instanceof Blob)return A("fileBytes",e.size,t.fileBytes,n,"bytes"),new Uint8Array(await e.arrayBuffer());throw new E("INVALID_ARGUMENT","read(file): file must be a File, a Blob, an ArrayBuffer or a Uint8Array")}function B(e){let t=e??{};if(typeof t!="object")throw new E("INVALID_OPTION","read(file, options): options must be an object");return{...t,limits:P(t)}}function Pe(e,t){let n=r=>typeof r=="number"?r.toLocaleString("en-US"):r;switch(e){case"ENCODING":return`Read as ${t.encoding}.`;case"SEPARATOR":return`Values separated by ${t.name}.`;case"LINES_SKIPPED":return`${n(t.count)} line(s) above the column names were skipped (a title block).`;case"COLUMN_RENAMED":return t.from===""?`Column ${n(t.position)} has no name; it is named "${t.to}".`:`Column "${t.from}" is named "${t.to}".`;case"COLUMNS_RENAMED_MORE":return`${n(t.count)} more columns were renamed.`;case"COLUMN_DROPPED":return`Column ${n(t.position)} has no name and no values and was left out.`;case"COLUMNS_ADDED":return`${n(t.rows)} row(s) have more values than there are column names; the extra values are in ${n(t.count)} column(s) named "Column \u2026".`;case"ROWS_EMPTY":return`${n(t.count)} empty row(s) were left out.`;case"TEXT_CUT":return`${n(t.count)} value(s) longer than ${n(t.max)} characters were cut.`;case"CHARACTERS_REMOVED":return`Control or text direction characters were removed from ${n(t.count)} value(s).`;case"DATE_ORDER":return`Dates in "${t.column}" were read as ${t.order==="mdy"?"month/day/year":"day/month/year"}; the values fit both.`;case"VALUES_NOT_CONVERTED":return`${n(t.count)} value(s) in "${t.column}" are no ${t.type} and are empty.`;case"JSON_PROPERTY":return`The rows were read from "${t.property}".`;case"JSON_FLATTENED":return`Nested values became columns named with a dot ("${t.example}").`;case"SHEET":return Number(t.count)>1?`Read sheet "${t.sheet}" of ${n(t.count)} sheets.`:`Read sheet "${t.sheet}".`;case"USED_RANGE":return`The sheet's used range reaches row ${n(t.usedRow)}; values end at row ${n(t.lastRow)}, the empty rows below were skipped.`;case"ERROR_CELLS":return`${n(t.count)} cell(s) hold an Excel error (such as #N/A) and are empty.`;default:return e}}function T(e,t={}){let n={};for(let[r,o]of Object.entries(t))n[r]=typeof o=="string"?o.replace(v,"").slice(0,256):o;return{code:e,params:n,message:Pe(e,n)}}function ke(e){return e.replace(v,"").replace(fe," ").trim()}function ee(e,t,n,r,o,a){if(t<1||t>12||n<1||r>23||o>59||a>59)return null;let l=new Date(Date.UTC(2e3,t-1,n));if(l.setUTCFullYear(e),l.getUTCDate()!==n)return null;let s=`${String(e).padStart(4,"0")}-${I(t)}-${I(n)}`;return r===0&&o===0&&a===0?s:`${s}T${I(r)}:${I(o)}:${I(a)}`}function ce(e){return[+e[1],+e[2],+e[3],e[4]===void 0?0:+e[4],e[5]===void 0?0:+e[5],e[6]===void 0?0:+e[6]]}function ne(e,t){if(e.length>40)return null;if(R(e)!==null)return e;let n=de.exec(e);if(n){let[r,o,a,l,s,i]=ce(n);return ee(a,o,r,l,s,i)}if(n=me.exec(e),n){let[r,o,a,l,s,i]=ce(n);return t==="mdy"?ee(a,r,o,l,s,i):ee(a,o,r,l,s,i)}return null}function ze(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=48&&r<=57&&t++}return t}function V(e,t){if(e.length>40||!(t===","?Ve:Ue).test(e))return null;let n=Number(t===","?e.replaceAll(".","").replace(",","."):e);return Number.isFinite(n)?n:null}function Ge(e){return je.test(e)?!0:/^[+-]?\d+$/.test(e)&&ze(e)>ve}function pe(e){let t=e.toLowerCase();return Fe.has(t)?!0:Be.has(t)?!1:null}function k(e){let t=e.getTime();if(!Number.isFinite(t)||Math.abs(t)>864e13)return null;let n=Math.round(t/1e3)*1e3;Math.abs(t-n)<=2&&(t=n);let r=new Date(t).toISOString();return t%he===0?r.slice(0,10):t%1e3===0?r.slice(0,19):r.slice(0,23)}function He(e,t,n){if(t==="string"&&e.every(l=>l===null||typeof l=="string"))return{values:e,failed:0};let r=Je[t],o=new Array(e.length),a=0;for(let l=0;l<e.length;l++){let s=e[l];if(s===null){o[l]=null;continue}let i=r(s,n);i===void 0?(o[l]=null,a++):o[l]=i}return{values:o,failed:a}}function We(e,t){let n=0,r=0,o=0,a=0;for(let s of e)s!==null&&(typeof s=="number"?n++:typeof s=="boolean"?r++:s instanceof Date?o++:a++);let l=n+r+o+a;return l===0?{type:"string"}:a===0?n===l?{type:"number"}:r===l?{type:"boolean"}:o===l?{type:"date"}:{type:"string"}:a!==l?n===0&&r===0&&e.every(s=>s===null||s instanceof Date||typeof s=="string"&&R(s)!==null)?{type:"date"}:{type:"string"}:t.textNumbers===!1?{type:e.every(s=>s===null||R(s)!==null)?"date":"string"}:Xe(e,t)}function Xe(e,t){let n=!0,r=!0,o=!0,a=!0,l=!1,s=!1,i=!0,f=!0;for(let c of e)if(c!==null){if(n&&pe(c)===null&&(n=!1),r&&R(c)===null&&(r=!1),o&&(!de.test(c)||ne(c,"dmy")===null)&&(o=!1),a){let m=c.length<=40?me.exec(c):null;m?(+m[1]>12&&(l=!0),+m[2]>12&&(s=!0)):a=!1}if((i||f)&&(Ge(c)?(i=!1,f=!1):(i&&V(c,".")===null&&(i=!1),f&&V(c,",")===null&&(f=!1))),!n&&!r&&!o&&!a&&!i&&!f)return{type:"string"}}if(n)return{type:"boolean"};if(r||o)return{type:"date"};if(a&&!(l&&s)){let c=l?"dmy":s?"mdy":t.dateOrder;if(e.every(w=>w===null||ne(w,c)!==null))return{type:"date",dateOrder:c,ambiguousOrder:!l&&!s}}return i&&f?{type:"number",decimal:t.decimal}:i?{type:"number",decimal:"."}:f?{type:"number",decimal:","}:{type:"string"}}function te(e,t,n){if(e==null)return null;switch(typeof e){case"string":return ue(e,t,n);case"number":return Number.isFinite(e)?e:null;case"boolean":return e;case"bigint":return Number.isSafeInteger(Number(e))?Number(e):String(e);case"object":if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;try{return ue(JSON.stringify(e)??"",t,n)}catch{return null}default:return null}}function ue(e,t,n){let r=e;return $e.test(r)&&(r=r.replace(v,""),n.removed++),r=r.replace(fe," ").trim(),r.length>t&&(r=r.slice(0,t),n.cut++),r===""?null:r}function G(e){let{file:t,limits:n}=e,r={decimal:e.hints?.decimal??".",dateOrder:e.hints?.dateOrder??(!e.locale||/^en-US$/i.test(e.locale)?"mdy":"dmy"),...e.hints?.serialDates?{serialDates:!0}:{},...e.hints?.textNumbers===!1?{textNumbers:!1}:{}},o=[],a={removed:0,cut:0,empty:0,extraRows:0},l=[],s=null,i=0,f=0,c=[],m=()=>{A("columns",l.length+1,n.columns,t,"columns"),l.push(new Array(f).fill(null))},w=u=>{let p=0,y=new Array(u.length);for(let h=0;h<u.length;h++){let b=te(u[h],n.textLength,a);y[h]=b,b!==null&&(p=h+1)}if(p===0){a.empty++;return}for(p>i&&a.extraRows++,p>l.length&&(A("columns",p,n.columns,t,"columns"),A("importCells",(f+1)*p,n.importCells,t,"values (rows x columns)"));l.length<p;)m();f++,A("rows",f,n.rows,t,"rows"),A("importCells",f*l.length,n.importCells,t,"values (rows x columns)");for(let h=0;h<l.length;h++)l[h].push(h<p?y[h]:null)},g=u=>{s=u.map(p=>{let y=te(p,n.name,{removed:0,cut:0});return y===null?null:y instanceof Date?k(y):String(y)}),i=s.length,A("columns",i,n.columns,t,"columns");for(let p=0;p<i;p++)l.push([])},d=()=>{let u=c??[];if(c=null,s===null){let p=0,y=u.map(O=>{let ie=0;for(let Re of O)te(Re,n.textLength,{removed:0,cut:0})!==null&&ie++;return ie});for(let O of y)p=Math.max(p,O);let h=y.findIndex(O=>O>0&&O*2>=p);h<0&&(h=u.length),y.slice(0,h).filter(O=>O>0).length>0&&o.push(T("LINES_SKIPPED",{count:h})),g(h<u.length?u[h]:[]),u.splice(0,h+1)}for(let p of u)w(p)};return{header(u){g(u)},row(u){if(c!==null&&s===null){c.push(u),c.length>=Me&&d();return}c!==null&&d(),w(u)},get rowCount(){return f+(c?.length??0)},note(u,p){o.push(T(u,p))},finish(u){return c!==null&&d(),Qe({header:s??[],columns:l,rowCount:f,notes:o,counts:a,hints:r,limits:n,types:u})}}}function Ke(e,t,n){let r=[],o=new Set,a=0,l=(i,f,c)=>{a++,a<=Z&&n.push(T("COLUMN_RENAMED",{position:i,from:f,to:c}))},s=i=>{let f=i;for(let c=2;o.has(f.toLowerCase());c++)f=`${i} (${c})`;return f};for(let i=0;i<t;i++){let f=i<e.length?e[i]:null,c;f===null||f===""?(c=s(`Column ${i+1}`),i<e.length&&l(i+1,"",c)):(c=s(f),c!==f&&l(i+1,f,c)),o.add(c.toLowerCase()),r.push(c)}return a>Z&&n.push(T("COLUMNS_RENAMED_MORE",{count:a-Z})),r}function Qe({header:e,columns:t,rowCount:n,notes:r,counts:o,hints:a,limits:l,types:s}){let i=[];for(let u=0;u<t.length;u++){if(!(u<e.length&&e[u]!==null&&e[u]!=="")&&t[u].every(y=>y===null)){u<e.length&&r.push(T("COLUMN_DROPPED",{position:u+1}));continue}i.push(u)}let f=i.map(u=>u<e.length?e[u]:null),c=Ke(f,i.length,r),m=i.map(u=>t[u]),w=i.filter(u=>u>=e.length).length;o.extraRows>0&&w>0&&r.push(T("COLUMNS_ADDED",{rows:o.extraRows,count:w})),o.empty>0&&r.push(T("ROWS_EMPTY",{count:o.empty})),o.cut>0&&r.push(T("TEXT_CUT",{count:o.cut,max:l.textLength})),o.removed>0&&r.push(T("CHARACTERS_REMOVED",{count:o.removed}));let g={columns:c,types:[],data:[],raw:m,detected:[],rowCount:n,notes:r,hints:a},d=m.map(u=>We(u,a));return g.detected=d.map(u=>u.type),d.forEach((u,p)=>{u.ambiguousOrder&&r.push(T("DATE_ORDER",{column:c[p],order:u.dateOrder}))}),qe(g,s,d)}function qe(e,t,n){let r=Ze(e.columns,t),o=e.notes.filter(s=>s.code!=="VALUES_NOT_CONVERTED"),a=[],l=[];for(let s=0;s<e.columns.length;s++){let i=n?.[s],f=r[s]??e.detected[s],c=i&&i.type===f?{...e.hints,...i.decimal?{decimal:i.decimal}:{},...i.dateOrder?{dateOrder:i.dateOrder}:{}}:e.hints;if(e.types[s]===f&&e.data[s]!==void 0){a.push(f),l.push(e.data[s]);let g=e.notes.find(d=>d.code==="VALUES_NOT_CONVERTED"&&d.params.column===e.columns[s]);g&&o.push(g);continue}let{values:m,failed:w}=He(e.raw[s],f,c);w>0&&o.push(T("VALUES_NOT_CONVERTED",{column:e.columns[s],type:f,count:w})),a.push(f),l.push(m)}return{...e,types:a,data:l,notes:o}}function Ze(e,t){let n=new Array(e.length).fill(void 0);if(Array.isArray(t))for(let r=0;r<e.length;r++)U.includes(t[r])&&(n[r]=t[r]);else if(t&&typeof t=="object"){let r=new Map;for(let o of Object.keys(t))U.includes(t[o])&&r.set(o.toLowerCase(),t[o]);e.forEach((o,a)=>{n[a]=r.get(o.toLowerCase())})}return n}var U,St,Z,Me,j,v,$e,fe,z,Ue,Ve,je,ve,de,me,Fe,Be,I,he,Ye,Je,L=_(()=>{$();q();le();U=Object.freeze(["string","number","date","boolean"]),St=Object.freeze(["ENCODING","SEPARATOR","LINES_SKIPPED","COLUMN_RENAMED","COLUMNS_RENAMED_MORE","COLUMN_DROPPED","COLUMNS_ADDED","ROWS_EMPTY","TEXT_CUT","CHARACTERS_REMOVED","DATE_ORDER","VALUES_NOT_CONVERTED","JSON_PROPERTY","JSON_FLATTENED","SHEET","USED_RANGE","ERROR_CELLS"]),Z=20,Me=50,j=16384,v=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u061c\u180e\u200b\u200e-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u206f\ufeff\u{E0000}-\u{E007F}]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/gu,$e=new RegExp(v.source,"u"),fe=/[\t\r\n\u2028\u2029]+/g;z=()=>new Promise(e=>setTimeout(e,0));Ue=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/,Ve=/^[+-]?(?:\d{1,3}(?:\.\d{3})+|\d+)(?:,\d+)?$/,je=/^[+-]?0\d/,ve=15,de=/^(\d{1,2})\.(\d{1,2})\.(\d{4})(?:[ T,]+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/,me=/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:[ T,]+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/,Fe=new Set(["true","wahr"]),Be=new Set(["false","falsch"]),I=e=>String(e).padStart(2,"0");he=864e5,Ye=Date.UTC(1899,11,30);Je={string(e){return typeof e=="string"?e:e instanceof Date?k(e)??void 0:String(e)},number(e,t){if(typeof e=="number")return e;if(typeof e=="boolean")return e?1:0;if(typeof e=="string")return V(e,t.decimal)??V(e,t.decimal===","?".":",")??void 0},date(e,t){if(e instanceof Date)return k(e)??void 0;if(typeof e=="string")return ne(e,t.dateOrder)??void 0;if(typeof e=="number"&&t.serialDates&&e>0&&e<2958466)return k(new Date(Math.round((Ye+e*he)/1e3)*1e3))??void 0},boolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return e===1?!0:e===0?!1:void 0;if(typeof e=="string"){let t=pe(e);if(t!==null)return t;let n=e.toLowerCase();if(n==="yes"||n==="1")return!0;if(n==="no"||n==="0")return!1}}}});function tt(e){let t=Math.min(e.length,4096)&-2;if(t<8)return!1;let n=0;for(let r=1;r<t;r+=2)e[r]===0&&e[r-1]!==0&&n++;return n>t/2*.9}function J(e,t){for(let s of et)if(Y(e,s.bytes))throw N("WRONG_TYPE",t,`this is ${s.what}, not text.`);let n,r=0;Y(e,[239,187,191])?(n="utf-8",r=3):Y(e,[255,254])?(n="utf-16le",r=2):Y(e,[254,255])?(n="utf-16be",r=2):tt(e)&&(n="utf-16le");let o=e.subarray(r),a;if(n)a=new TextDecoder(n,{fatal:!1,ignoreBOM:!0}).decode(o);else try{a=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(o),n="utf-8"}catch{a=new TextDecoder("windows-1252",{ignoreBOM:!0}).decode(o),n="windows-1252"}let l=a.indexOf("\0");if(l!==-1&&l<a.length-1)throw N("BINARY",t,"this file holds binary data, not text.");return{text:l===-1?a:a.slice(0,l),encoding:nt[n]}}var et,Y,nt,re=_(()=>{L();et=[{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"}],Y=(e,t)=>t.every((n,r)=>e[r]===n);nt={"utf-8":"UTF-8","utf-16le":"UTF-16 (little endian)","utf-16be":"UTF-16 (big endian)","windows-1252":"Windows-1252"}});var Ee={};ae(Ee,{detectSeparator:()=>ge,read:()=>lt,splitRows:()=>oe});function oe(e,t,n,r,o={}){let a=t.charCodeAt(0),l=e.length,s=n,i=o.line??1;for(;s<l;){let f=i,c=[];for(;;){let m;if(e.charCodeAt(s)===we){let g=i,d=s+1,u="";for(;;){let y=e.indexOf('"',d);if(y===-1){if(o.sample)return l;throw N("UNCLOSED_QUOTE",o.file??"file",`the quote that opens a value in line ${g} is never closed.`,{line:g})}if(i+=it(e,d,y),u+=e.slice(d,y),e.charCodeAt(y+1)===we){u+='"',d=y+2;continue}s=y+1;break}let p=s;for(;p<l;){let y=e.charCodeAt(p);if(y===a||y===D||y===H)break;p++}m=p>s?u+e.slice(s,p):u,s=p}else{let g=s;for(;g<l;){let d=e.charCodeAt(g);if(d===a||d===D||d===H)break;g++}m=e.slice(s,g),s=g}if(c.push(m),o.maxFields!==void 0&&c.length>o.maxFields)throw C("columns",c.length,o.maxFields,o.file??"file","columns");let w=s<l?e.charCodeAt(s):-1;if(w===a){s++;continue}w===H?(s+=e.charCodeAt(s+1)===D?2:1,i++):w===D&&(s++,i++);break}if(r(c,f))break}return o.line=i,s}function it(e,t,n){let r=0;for(let o=t;o<n;o++){let a=e.charCodeAt(o);(a===D||a===H&&e.charCodeAt(o+1)!==D)&&r++}return r}function ge(e,t,n){let r=e.slice(t,t+ot),o={sep:n??",",score:-1,width:1},a=n?[n,...ye.filter(l=>l!==n)]:ye;for(let l of a){let s=new Map,i=0;oe(r,l,0,m=>(m.length===1&&m[0]===""||(s.set(m.length,(s.get(m.length)??0)+1),i++),i>=st),{sample:!0});let f=1,c=0;for(let[m,w]of s)m>1&&(w>c||w===c&&m>f)&&(f=m,c=w);f>1&&(c>o.score||c===o.score&&f>o.width)&&(o={sep:l,score:c,width:f})}return o.sep}function at(e){if(!e)return".";try{return new Intl.NumberFormat(e).formatToParts(1.5).find(n=>n.type==="decimal")?.value===","?",":"."}catch{return"."}}async function lt(e,t){let n=B(t),r=x(e,n);n.signal?.throwIfAborted();let o=await F(e,n.limits,r);n.onProgress?.({phase:"read",done:o.length,total:o.length});let{text:a,encoding:l}=J(o,r);n.signal?.throwIfAborted();let s=0,i=typeof n.separator=="string"&&n.separator.length===1?n.separator:null,f=/^sep=(.)\r?\n/i.exec(a.slice(0,8));f&&(s=f[0].length,i??=f[1]),i??=ge(a,s,/\.tsv$/i.test(r)?" ":void 0);let c=G({file:r,limits:n.limits,locale:n.locale,hints:{decimal:i===";"?",":at(n.locale)}});c.note("ENCODING",{encoding:l}),c.note("SEPARATOR",{separator:i,name:rt[i]??`"${i}"`});let m=s,w={file:r,line:s>0?2:1,maxFields:n.limits.columns};for(;m<a.length;){let g=0;m=oe(a,i,m,d=>(c.row(d),++g>=j),w),n.onProgress?.({phase:"parse",done:m,total:a.length}),m<a.length&&(await z(),n.signal?.throwIfAborted())}return n.signal?.throwIfAborted(),c.finish(n.types)}var ye,rt,ot,st,we,D,H,Ae=_(()=>{L();re();ye=[",",";"," ","|"],rt={",":"commas",";":"semicolons"," ":"tabs","|":"vertical bars"},ot=65536,st=100,we=34,D=10,H=13});var be={};ae(be,{read:()=>ut});function Ne(e){if(Array.isArray(e)){let t=e.find(n=>n!=null);return t===void 0?{kind:"objects",rows:[]}:Array.isArray(t)&&e.every(n=>n===null||Array.isArray(n))?{kind:"arrays",rows:e}:S(t)&&e.every(n=>n===null||S(n))?{kind:"objects",rows:e}:null}return S(e)?Array.isArray(e.columns)&&Array.isArray(e.data)&&e.data.every(t=>Array.isArray(t))?{kind:"columnar",columns:e.columns,data:e.data}:Array.isArray(e.columns)&&Array.isArray(e.rows)?{kind:e.rows.every(t=>t===null||Array.isArray(t))?"header":"objects",columns:e.columns,rows:e.rows}:null:null}function ct(e){let t=Ne(e);if(t)return{shape:t,property:null};if(!S(e))return null;let n=null;for(let r of Object.keys(e)){let o=Ne(e[r]);if(o&&(o.kind!=="objects"||o.rows.length>0)){let a=o.rows?.length??o.data?.[0]?.length??0;(!n||a>n.size)&&(n={shape:o,property:r,size:a})}}return n}function Oe(e,t,n,r,o,a){for(let l of Object.keys(e)){let s=t+l,i=e[l];S(i)&&n<Te&&Object.keys(i).length>0?Oe(i,`${s}.`,n+1,r,o,a):r.has(s)||(n>0&&(a.nested??=s),o(),r.set(s,r.size))}}function _e(e,t,n,r,o){for(let a of Object.keys(e)){let l=t+a,s=e[a];if(S(s)&&n<Te&&Object.keys(s).length>0)_e(s,`${l}.`,n+1,r,o);else{let i=r.get(l);i!==void 0&&(o[i]=s)}}}async function ut(e,t){let n=B(t),r=x(e,n);n.signal?.throwIfAborted();let o=await F(e,n.limits,r);n.onProgress?.({phase:"read",done:o.length,total:o.length});let{text:a}=J(o,r),l;try{l=JSON.parse(a)}catch(d){throw N("INVALID_JSON",r,`this is no valid JSON (${String(d.message).slice(0,200)}).`)}n.signal?.throwIfAborted();let s=ct(l);if(!s)throw N("NO_TABLE",r,"no table found: the JSON must be an array of objects, an array of arrays, { columns, rows } or { columns, data }, or an object with one of these under a property.");let{shape:i,property:f}=s,c=G({file:r,limits:n.limits,locale:n.locale,hints:{textNumbers:!1}});f!==null&&c.note("JSON_PROPERTY",{property:f});let m=n.limits,w=0,g=async d=>{++w%j===0&&(n.onProgress?.({phase:"parse",done:w,total:d}),await z(),n.signal?.throwIfAborted())};if(i.kind==="columnar"){let d=i.data[0]?.length??0;if(i.columns.length!==i.data.length)throw N("NO_TABLE",r,`"columns" names ${i.columns.length} columns, but "data" holds ${i.data.length} arrays.`);if(!i.data.every(u=>u.length===d))throw N("NO_TABLE",r,'the arrays in "data" have different lengths.');A("columns",i.columns.length,m.columns,r,"columns"),A("rows",d,m.rows,r,"rows"),c.header(i.columns);for(let u=0;u<d;u++)c.row(i.data.map(p=>p[u])),await g(d)}else if(i.kind==="arrays"||i.kind==="header"){let d=i.rows;A("rows",d.length,m.rows+1,r,"rows");let u=0;for(i.kind==="header"?c.header(i.columns):(c.header(d[0]??[]),u=1);u<d.length;u++)c.row(d[u]??[]),await g(d.length)}else{let d=i.rows;A("rows",d.length,m.rows,r,"rows");let u=new Map;if(Array.isArray(i.columns))for(let h of i.columns)typeof h=="string"&&!u.has(h)&&u.set(h,u.size);let p=()=>A("columns",u.size+1,m.columns,r,"columns"),y={nested:null};for(let h of d)h&&Oe(h,"",0,u,p,y);y.nested&&c.note("JSON_FLATTENED",{example:y.nested}),c.header([...u.keys()]);for(let h of d){let b=new Array(u.size).fill(null);h&&_e(h,"",0,u,b),c.row(b),await g(d.length)}}return n.signal?.throwIfAborted(),c.finish(n.types)}var Te,S,xe=_(()=>{L();re();Te=4,S=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)});$();q();L();var W=1,ft=/^[a-z0-9][a-z0-9-]{0,63}$/,dt=/^\.[a-z0-9]{1,16}$/,mt=/^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/,De=["reader"];function X(e){let t=e,n=r=>{throw new E("INVALID_ARGUMENT",`plugin ${typeof t?.name=="string"?`"${t.name.slice(0,64)}" `:""}${r}`)};return(t===null||typeof t!="object"||Array.isArray(t))&&n("must be an object"),t.apiVersion!==W&&n(`uses plugin API version ${JSON.stringify(t.apiVersion)}; this pivotkit-core supports version ${W}. Use a version of the plugin made for API ${W}, or update pivotkit.`),De.includes(t.kind)||n(`has kind ${JSON.stringify(t.kind)}; API ${W} knows ${De.map(r=>`"${r}"`).join(", ")}`),(typeof t.name!="string"||!ft.test(t.name))&&n('needs a name of lower-case letters, digits and "-"'),(typeof t.label!="string"||t.label.trim()===""||t.label.length>100)&&n("needs a label of 1 to 100 characters"),(!Array.isArray(t.accept)||t.accept.length===0||!t.accept.every(r=>typeof r=="string"&&(dt.test(r)||mt.test(r))))&&n('needs accept: file name extensions (".xlsx") and media types ("text/csv"), in lower case'),typeof t.load!="function"&&n("needs load(): a function that imports the reader"),Object.freeze({apiVersion:t.apiVersion,kind:t.kind,name:t.name,label:t.label,accept:[...t.accept],load:t.load})}var pt=X({apiVersion:1,kind:"reader",name:"csv",label:"CSV or text",accept:[".csv",".tsv",".txt",".tab","text/csv","text/tab-separated-values","text/plain"],load:()=>Promise.resolve().then(()=>(Ae(),Ee))}),ht=X({apiVersion:1,kind:"reader",name:"json",label:"JSON",accept:[".json","application/json"],load:()=>Promise.resolve().then(()=>(xe(),be))}),yt=Object.freeze([pt,ht]);function wt(e,t=[]){for(let s of t)X(s);let n=[...t,...yt],r=typeof e?.name=="string"?e.name.toLowerCase():"",o=r.lastIndexOf("."),a=o===-1?"":r.slice(o);if(a){let s=n.find(i=>i.accept.includes(a));if(s)return s}let l=typeof e?.type=="string"?e.type.toLowerCase().split(";")[0].trim():"";return l?n.find(s=>s.accept.includes(l)):void 0}var se=new WeakMap;async function gt(e){let t=X(e),n=se.get(e);return n||(n=Promise.resolve(t.load()).then(r=>{let o=r,a=o?.default&&typeof o.read!="function"?o.default:o;if(!a||typeof a.read!="function")throw new E("INVALID_ARGUMENT",`plugin "${t.name}": its load() must give a module with read(file, options)`);if(a.sheets!==void 0&&typeof a.sheets!="function")throw new E("INVALID_ARGUMENT",`plugin "${t.name}": sheets must be a function when given`);return a}),n.catch(()=>se.delete(e)),se.set(e,n)),n}async function Se(e,t={}){let n=x(e,t),r=P(t);if(e&&typeof e=="object"&&typeof e.size=="number"&&e.size>r.fileBytes)throw C("fileBytes",e.size,r.fileBytes,n,"bytes");let o=t.reader??wt(e,t.plugins);if(!o)throw N("NO_READER",n,"no reader for this kind of file.");let a=await gt(o),l={...t};return delete l.plugins,delete l.reader,Et(await a.read(e,l),o.name)}function Et(e,t){let n=o=>{throw new E("INVALID_ARGUMENT",`plugin "${t}": read() must return a table of pivotkit-core/import (createTable().finish()); ${o}`)};(!e||typeof e!="object"||!Array.isArray(e.columns)||!Array.isArray(e.types)||!Array.isArray(e.data)||!Array.isArray(e.notes))&&n("it needs columns, types, data and notes");let r=e.data[0]?.length??0;return(e.types.length!==e.columns.length||e.data.length!==e.columns.length)&&n("columns, types and data differ in length"),e.columns.every(o=>typeof o=="string")||n("a column name is no string"),e.types.every(o=>U.includes(o))||n("a type is none of string, number, date, boolean"),e.data.every(o=>Array.isArray(o)&&o.length===r)||n("the columns differ in length"),e}var M=globalThis;M.onmessage=async e=>{let{file:t,options:n}=e.data??{};try{let r=await Se(t,{...n,plugins:[],onProgress:o=>M.postMessage({type:"progress",progress:o})});M.postMessage({type:"done",table:r})}catch(r){let o=r;M.postMessage({type:"error",error:{code:typeof o?.code=="string"?o.code:void 0,message:String(o?.message??o),details:o?.details&&typeof o.details=="object"?{...o.details}:{}}})}};M.postMessage({type:"ready"});
|
|
1
|
+
var Re=Object.defineProperty;var _=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var ae=(e,t)=>{for(var n in t)Re(e,n,{get:t[n],enumerable:!0})};var E,$=_(()=>{E=class extends Error{constructor(t,n,r={}){super(n),this.name="PivotkitError",this.code=t,this.details=r}}});function P(e){let t=e&&e.limits;if(t==null)return K;if(typeof t!="object"||Array.isArray(t))throw new E("INVALID_OPTION","options.limits must be an object");let n={...K};for(let r of Object.keys(t)){let o=t[r];if(!Object.hasOwn(K,r))throw new E("INVALID_OPTION",`unknown limit "${r}"`);if(!Number.isInteger(o)||o<1)throw new E("INVALID_OPTION",`limits.${r} must be a whole number of 1 or more`);if(Object.hasOwn(Q,r)&&o>Q[r])throw new E("INVALID_OPTION",`limits.${r} must be at most ${Q[r]}`);n[r]=o}return Object.freeze(n)}var K,Q,Tt,_t,q=_(()=>{$();K=Object.freeze({json:5e6,name:256,axisFields:8,values:16,filters:128,items:1e5,derived:64,sort:64,collapsed:1e4,topCount:1e6,textValue:1e3,srcParams:16,srcParamLength:256,rows:1e6,groups:5e5,pivotCells:2e6,work:1e8,cells:2e6,cacheEntries:16,fileBytes:104857600,columns:1e3,importCells:1e7,textLength:32767,archiveEntries:1e4,unpackedBytes:524288e3}),Q=Object.freeze({groups:2**27}),Tt=Object.freeze({filters:50,json:1e6}),_t=Object.freeze({perCode:100,total:1e3})});function Le(e,t,n,r=0,o=0,a=0,l=0){if(e>=100)return Date.UTC(e,t-1,n,r,o,a,l);let s=new Date(Date.UTC(2e3,t-1,n,r,o,a,l));return s.setUTCFullYear(e),s.getTime()}function I(e){let t=Ce.exec(e.trim());if(!t)return null;let n=t[8],r=+t[1],o=+t[2],a=+t[3],l=t[4]===void 0?0:+t[4],s=t[5]===void 0?0:+t[5],i=t[6]===void 0?0:+t[6],f=t[7];if(o<1||o>12||a<1||l>23||s>59||i>59)return null;let c=Le(r,o,a,l,s,i,f?Math.round(+`0.${f}`*1e3):0);if(new Date(c).getUTCDate()!==a)return null;let m=null;if(n)if(n==="Z")m=0;else{let w=n.slice(1).replace(":",""),g=Number(w.slice(0,2)),d=Number(w.slice(2)||0);if(g>23||d>59)return null;m=(n[0]==="-"?-1:1)*(g*60+d)}return{ms:c,offsetMinutes:m}}var Ce,le=_(()=>{Ce=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}(?::?\d{2})?)?)?$/});function N(e,t,n,r={}){return new E("INVALID_FILE",`"${t}": ${n}`,{reason:e,file:t,...r})}function C(e,t,n,r,o){let a=l=>l.toLocaleString("en-US");return new E("LIMIT_EXCEEDED",`"${r}" has more than ${a(n)} ${o} (limits.${e}): load a smaller extract of it, or a host can raise this limit`,{limit:e,value:t,max:n,file:r})}function A(e,t,n,r,o){if(t>n)throw C(e,t,n,r,o)}function x(e,t){let n=e&&typeof e=="object"&&typeof e.name=="string"?e.name:"",r=ke(String(t?.name??n??"")).slice(0,256);return(new RegExp("\\p{Surrogate}$","u").test(r)?r.slice(0,-1):r)||"file"}async function F(e,t,n){if(e instanceof Uint8Array)return A("fileBytes",e.byteLength,t.fileBytes,n,"bytes"),e;if(e instanceof ArrayBuffer)return A("fileBytes",e.byteLength,t.fileBytes,n,"bytes"),new Uint8Array(e);if(typeof Blob<"u"&&e instanceof Blob)return A("fileBytes",e.size,t.fileBytes,n,"bytes"),new Uint8Array(await e.arrayBuffer());throw new E("INVALID_ARGUMENT","read(file): file must be a File, a Blob, an ArrayBuffer or a Uint8Array")}function z(e){let t=e??{};if(typeof t!="object")throw new E("INVALID_OPTION","read(file, options): options must be an object");return{...t,limits:P(t)}}function Pe(e,t){let n=r=>typeof r=="number"?r.toLocaleString("en-US"):r;switch(e){case"ENCODING":return`Read as ${t.encoding}.`;case"SEPARATOR":return`Values separated by ${t.name}.`;case"LINES_SKIPPED":return`${n(t.count)} line(s) above the column names were skipped (a title block).`;case"COLUMN_RENAMED":return t.from===""?`Column ${n(t.position)} has no name; it is named "${t.to}".`:`Column "${t.from}" is named "${t.to}".`;case"COLUMNS_RENAMED_MORE":return`${n(t.count)} more columns were renamed.`;case"COLUMN_DROPPED":return`Column ${n(t.position)} has no name and no values and was left out.`;case"COLUMNS_ADDED":return`${n(t.rows)} row(s) have more values than there are column names; the extra values are in ${n(t.count)} column(s) named "Column \u2026".`;case"ROWS_EMPTY":return`${n(t.count)} empty row(s) were left out.`;case"TEXT_CUT":return`${n(t.count)} value(s) longer than ${n(t.max)} characters were cut.`;case"CHARACTERS_REMOVED":return`Control or text direction characters were removed from ${n(t.count)} value(s).`;case"DATE_ORDER":return`Dates in "${t.column}" were read as ${t.order==="mdy"?"month/day/year":"day/month/year"}; the values fit both.`;case"VALUES_NOT_CONVERTED":return`${n(t.count)} value(s) in "${t.column}" are no ${t.type} and are empty.`;case"JSON_PROPERTY":return`The rows were read from "${t.property}".`;case"JSON_FLATTENED":return`Nested values became columns named with a dot ("${t.example}").`;case"SHEET":return Number(t.count)>1?`Read sheet "${t.sheet}" of ${n(t.count)} sheets.`:`Read sheet "${t.sheet}".`;case"USED_RANGE":return`The sheet's used range reaches row ${n(t.usedRow)}; values end at row ${n(t.lastRow)}, the empty rows below were skipped.`;case"ERROR_CELLS":return`${n(t.count)} cell(s) hold an Excel error (such as #N/A) and are empty.`;default:return e}}function O(e,t={}){let n={};for(let[r,o]of Object.entries(t))n[r]=typeof o=="string"?o.replace(v,"").slice(0,256):o;return{code:e,params:n,message:Pe(e,n)}}function ke(e){return e.replace(v,"").replace(fe," ").trim()}function ee(e,t,n,r,o,a){if(t<1||t>12||n<1||r>23||o>59||a>59)return null;let l=new Date(Date.UTC(2e3,t-1,n));if(l.setUTCFullYear(e),l.getUTCDate()!==n)return null;let s=`${String(e).padStart(4,"0")}-${R(t)}-${R(n)}`;return r===0&&o===0&&a===0?s:`${s}T${R(r)}:${R(o)}:${R(a)}`}function ce(e){return[+e[1],+e[2],+e[3],e[4]===void 0?0:+e[4],e[5]===void 0?0:+e[5],e[6]===void 0?0:+e[6]]}function ne(e,t){if(e.length>40)return null;if(I(e)!==null)return e;let n=de.exec(e);if(n){let[r,o,a,l,s,i]=ce(n);return ee(a,o,r,l,s,i)}if(n=me.exec(e),n){let[r,o,a,l,s,i]=ce(n);return t==="mdy"?ee(a,r,o,l,s,i):ee(a,o,r,l,s,i)}return null}function Be(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=48&&r<=57&&t++}return t}function j(e,t){if(e.length>40||!(t===","?je:Ue).test(e))return null;let n=Number(t===","?e.replaceAll(".","").replace(",","."):e);return Number.isFinite(n)?n:null}function Ge(e){return Ve.test(e)?!0:/^[+-]?\d+$/.test(e)&&Be(e)>ve}function pe(e){let t=e.toLowerCase();return Fe.has(t)?!0:ze.has(t)?!1:null}function k(e){let t=e.getTime();if(!Number.isFinite(t)||Math.abs(t)>864e13)return null;let n=Math.round(t/1e3)*1e3;Math.abs(t-n)<=2&&(t=n);let r=new Date(t).toISOString();return t%he===0?r.slice(0,10):t%1e3===0?r.slice(0,19):r.slice(0,23)}function Je(e,t,n){if(t==="string"&&e.every(l=>l===null||typeof l=="string"))return{values:e,failed:0};let r=He[t],o=new Array(e.length),a=0;for(let l=0;l<e.length;l++){let s=e[l];if(s===null){o[l]=null;continue}let i=r(s,n);i===void 0?(o[l]=null,a++):o[l]=i}return{values:o,failed:a}}function We(e,t){let n=0,r=0,o=0,a=0;for(let s of e)s!==null&&(typeof s=="number"?n++:typeof s=="boolean"?r++:s instanceof Date?o++:a++);let l=n+r+o+a;return l===0?{type:"string"}:a===0?n===l?{type:"number"}:r===l?{type:"boolean"}:o===l?{type:"date"}:{type:"string"}:a!==l?n===0&&r===0&&e.every(s=>s===null||s instanceof Date||typeof s=="string"&&I(s)!==null)?{type:"date"}:{type:"string"}:t.textNumbers===!1?{type:e.every(s=>s===null||I(s)!==null)?"date":"string"}:Xe(e,t)}function Xe(e,t){let n=!0,r=!0,o=!0,a=!0,l=!1,s=!1,i=!0,f=!0;for(let c of e)if(c!==null){if(n&&pe(c)===null&&(n=!1),r&&I(c)===null&&(r=!1),o&&(!de.test(c)||ne(c,"dmy")===null)&&(o=!1),a){let m=c.length<=40?me.exec(c):null;m?(+m[1]>12&&(l=!0),+m[2]>12&&(s=!0)):a=!1}if((i||f)&&(Ge(c)?(i=!1,f=!1):(i&&j(c,".")===null&&(i=!1),f&&j(c,",")===null&&(f=!1))),!n&&!r&&!o&&!a&&!i&&!f)return{type:"string"}}if(n)return{type:"boolean"};if(r||o)return{type:"date"};if(a&&!(l&&s)){let c=l?"dmy":s?"mdy":t.dateOrder;if(e.every(w=>w===null||ne(w,c)!==null))return{type:"date",dateOrder:c,ambiguousOrder:!l&&!s}}return i&&f?{type:"number",decimal:t.decimal}:i?{type:"number",decimal:"."}:f?{type:"number",decimal:","}:{type:"string"}}function te(e,t,n){if(e==null)return null;switch(typeof e){case"string":return ue(e,t,n);case"number":return Number.isFinite(e)?e:null;case"boolean":return e;case"bigint":return Number.isSafeInteger(Number(e))?Number(e):String(e);case"object":if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;try{return ue(JSON.stringify(e)??"",t,n)}catch{return null}default:return null}}function ue(e,t,n){let r=e;return $e.test(r)&&(r=r.replace(v,""),n.removed++),r=r.replace(fe," ").trim(),r.length>t&&(r=r.slice(0,t),n.cut++),r===""?null:r}function G(e){let{file:t,limits:n}=e,r={decimal:e.hints?.decimal??".",dateOrder:e.hints?.dateOrder??(!e.locale||/^en-US$/i.test(e.locale)?"mdy":"dmy"),...e.hints?.serialDates?{serialDates:!0}:{},...e.hints?.textNumbers===!1?{textNumbers:!1}:{}},o=[],a={removed:0,cut:0,empty:0,extraRows:0},l=[],s=null,i=0,f=0,c=[],m=()=>{A("columns",l.length+1,n.columns,t,"columns"),l.push(new Array(f).fill(null))},w=u=>{let p=0,y=new Array(u.length);for(let h=0;h<u.length;h++){let b=te(u[h],n.textLength,a);y[h]=b,b!==null&&(p=h+1)}if(p===0){a.empty++;return}for(p>i&&a.extraRows++,p>l.length&&(A("columns",p,n.columns,t,"columns"),A("importCells",(f+1)*p,n.importCells,t,"values (rows x columns)"));l.length<p;)m();f++,A("rows",f,n.rows,t,"rows"),A("importCells",f*l.length,n.importCells,t,"values (rows x columns)");for(let h=0;h<l.length;h++)l[h].push(h<p?y[h]:null)},g=u=>{s=u.map(p=>{let y=te(p,n.name,{removed:0,cut:0});return y===null?null:y instanceof Date?k(y):String(y)}),i=s.length,A("columns",i,n.columns,t,"columns");for(let p=0;p<i;p++)l.push([])},d=()=>{let u=c??[];if(c=null,s===null){let p=0,y=u.map(T=>{let ie=0;for(let Ie of T)te(Ie,n.textLength,{removed:0,cut:0})!==null&&ie++;return ie});for(let T of y)p=Math.max(p,T);let h=y.findIndex(T=>T>0&&T*2>=p);h<0&&(h=u.length),y.slice(0,h).filter(T=>T>0).length>0&&o.push(O("LINES_SKIPPED",{count:h})),g(h<u.length?u[h]:[]),u.splice(0,h+1)}for(let p of u)w(p)};return{header(u){g(u)},row(u){if(c!==null&&s===null){c.push(u),c.length>=Me&&d();return}c!==null&&d(),w(u)},get rowCount(){return f+(c?.length??0)},note(u,p){o.push(O(u,p))},finish(u){return c!==null&&d(),Qe({header:s??[],columns:l,rowCount:f,notes:o,counts:a,hints:r,limits:n,types:u})}}}function Ke(e,t,n){let r=[],o=new Set,a=0,l=(i,f,c)=>{a++,a<=Z&&n.push(O("COLUMN_RENAMED",{position:i,from:f,to:c}))},s=i=>{let f=i;for(let c=2;o.has(f.toLowerCase());c++)f=`${i} (${c})`;return f};for(let i=0;i<t;i++){let f=i<e.length?e[i]:null,c;f===null||f===""?(c=s(`Column ${i+1}`),i<e.length&&l(i+1,"",c)):(c=s(f),c!==f&&l(i+1,f,c)),o.add(c.toLowerCase()),r.push(c)}return a>Z&&n.push(O("COLUMNS_RENAMED_MORE",{count:a-Z})),r}function Qe({header:e,columns:t,rowCount:n,notes:r,counts:o,hints:a,limits:l,types:s}){let i=[];for(let u=0;u<t.length;u++){if(!(u<e.length&&e[u]!==null&&e[u]!=="")&&t[u].every(y=>y===null)){u<e.length&&r.push(O("COLUMN_DROPPED",{position:u+1}));continue}i.push(u)}let f=i.map(u=>u<e.length?e[u]:null),c=Ke(f,i.length,r),m=i.map(u=>t[u]),w=i.filter(u=>u>=e.length).length;o.extraRows>0&&w>0&&r.push(O("COLUMNS_ADDED",{rows:o.extraRows,count:w})),o.empty>0&&r.push(O("ROWS_EMPTY",{count:o.empty})),o.cut>0&&r.push(O("TEXT_CUT",{count:o.cut,max:l.textLength})),o.removed>0&&r.push(O("CHARACTERS_REMOVED",{count:o.removed}));let g={columns:c,types:[],data:[],raw:m,detected:[],rowCount:n,notes:r,hints:a},d=m.map(u=>We(u,a));return g.detected=d.map(u=>u.type),d.forEach((u,p)=>{u.ambiguousOrder&&r.push(O("DATE_ORDER",{column:c[p],order:u.dateOrder}))}),qe(g,s,d)}function qe(e,t,n){let r=Ze(e.columns,t),o=e.notes.filter(s=>s.code!=="VALUES_NOT_CONVERTED"),a=[],l=[];for(let s=0;s<e.columns.length;s++){let i=n?.[s],f=r[s]??e.detected[s],c=i&&i.type===f?{...e.hints,...i.decimal?{decimal:i.decimal}:{},...i.dateOrder?{dateOrder:i.dateOrder}:{}}:e.hints;if(e.types[s]===f&&e.data[s]!==void 0){a.push(f),l.push(e.data[s]);let g=e.notes.find(d=>d.code==="VALUES_NOT_CONVERTED"&&d.params.column===e.columns[s]);g&&o.push(g);continue}let{values:m,failed:w}=Je(e.raw[s],f,c);w>0&&o.push(O("VALUES_NOT_CONVERTED",{column:e.columns[s],type:f,count:w})),a.push(f),l.push(m)}return{...e,types:a,data:l,notes:o}}function Ze(e,t){let n=new Array(e.length).fill(void 0);if(Array.isArray(t))for(let r=0;r<e.length;r++)U.includes(t[r])&&(n[r]=t[r]);else if(t&&typeof t=="object"){let r=new Map;for(let o of Object.keys(t))U.includes(t[o])&&r.set(o.toLowerCase(),t[o]);e.forEach((o,a)=>{n[a]=r.get(o.toLowerCase())})}return n}var U,Rt,Z,Me,V,v,$e,fe,B,Ue,je,Ve,ve,de,me,Fe,ze,R,he,Ye,He,L=_(()=>{$();q();le();U=Object.freeze(["string","number","date","boolean"]),Rt=Object.freeze(["ENCODING","SEPARATOR","LINES_SKIPPED","COLUMN_RENAMED","COLUMNS_RENAMED_MORE","COLUMN_DROPPED","COLUMNS_ADDED","ROWS_EMPTY","TEXT_CUT","CHARACTERS_REMOVED","DATE_ORDER","VALUES_NOT_CONVERTED","JSON_PROPERTY","JSON_FLATTENED","SHEET","USED_RANGE","ERROR_CELLS"]),Z=20,Me=50,V=16384,v=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u061c\u180e\u200b\u200e-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u206f\ufeff\u{E0000}-\u{E007F}]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/gu,$e=new RegExp(v.source,"u"),fe=/[\t\r\n\u2028\u2029]+/g;B=()=>new Promise(e=>setTimeout(e,0));Ue=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/,je=/^[+-]?(?:\d{1,3}(?:\.\d{3})+|\d+)(?:,\d+)?$/,Ve=/^[+-]?0\d/,ve=15,de=/^(\d{1,2})\.(\d{1,2})\.(\d{4})(?:[ T,]+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/,me=/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:[ T,]+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/,Fe=new Set(["true","wahr"]),ze=new Set(["false","falsch"]),R=e=>String(e).padStart(2,"0");he=864e5,Ye=Date.UTC(1899,11,30);He={string(e){return typeof e=="string"?e:e instanceof Date?k(e)??void 0:String(e)},number(e,t){if(typeof e=="number")return e;if(typeof e=="boolean")return e?1:0;if(typeof e=="string")return j(e,t.decimal)??j(e,t.decimal===","?".":",")??void 0},date(e,t){if(e instanceof Date)return k(e)??void 0;if(typeof e=="string")return ne(e,t.dateOrder)??void 0;if(typeof e=="number"&&t.serialDates&&e>0&&e<2958466)return k(new Date(Math.round((Ye+e*he)/1e3)*1e3))??void 0},boolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return e===1?!0:e===0?!1:void 0;if(typeof e=="string"){let t=pe(e);if(t!==null)return t;let n=e.toLowerCase();if(n==="yes"||n==="1")return!0;if(n==="no"||n==="0")return!1}}}});function tt(e){let t=Math.min(e.length,4096)&-2;if(t<8)return!1;let n=0;for(let r=1;r<t;r+=2)e[r]===0&&e[r-1]!==0&&n++;return n>t/2*.9}function H(e,t){for(let s of et)if(Y(e,s.bytes))throw N("WRONG_TYPE",t,`this is ${s.what}, not text.`);let n,r=0;Y(e,[239,187,191])?(n="utf-8",r=3):Y(e,[255,254])?(n="utf-16le",r=2):Y(e,[254,255])?(n="utf-16be",r=2):tt(e)&&(n="utf-16le");let o=e.subarray(r),a;if(n)a=new TextDecoder(n,{fatal:!1,ignoreBOM:!0}).decode(o);else try{a=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(o),n="utf-8"}catch{a=new TextDecoder("windows-1252",{ignoreBOM:!0}).decode(o),n="windows-1252"}let l=a.indexOf("\0");if(l!==-1&&l<a.length-1)throw N("BINARY",t,"this file holds binary data, not text.");return{text:l===-1?a:a.slice(0,l),encoding:nt[n]}}var et,Y,nt,re=_(()=>{L();et=[{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"}],Y=(e,t)=>t.every((n,r)=>e[r]===n);nt={"utf-8":"UTF-8","utf-16le":"UTF-16 (little endian)","utf-16be":"UTF-16 (big endian)","windows-1252":"Windows-1252"}});var Ee={};ae(Ee,{detectSeparator:()=>ge,read:()=>lt,splitRows:()=>oe});function oe(e,t,n,r,o={}){let a=t.charCodeAt(0),l=e.length,s=n,i=o.line??1;for(;s<l;){let f=i,c=[];for(;;){let m;if(e.charCodeAt(s)===we){let g=i,d=s+1,u="";for(;;){let y=e.indexOf('"',d);if(y===-1){if(o.sample)return l;throw N("UNCLOSED_QUOTE",o.file??"file",`the quote that opens a value in line ${g} is never closed.`,{line:g})}if(i+=it(e,d,y),u+=e.slice(d,y),e.charCodeAt(y+1)===we){u+='"',d=y+2;continue}s=y+1;break}let p=s;for(;p<l;){let y=e.charCodeAt(p);if(y===a||y===D||y===J)break;p++}m=p>s?u+e.slice(s,p):u,s=p}else{let g=s;for(;g<l;){let d=e.charCodeAt(g);if(d===a||d===D||d===J)break;g++}m=e.slice(s,g),s=g}if(c.push(m),o.maxFields!==void 0&&c.length>o.maxFields)throw C("columns",c.length,o.maxFields,o.file??"file","columns");let w=s<l?e.charCodeAt(s):-1;if(w===a){s++;continue}w===J?(s+=e.charCodeAt(s+1)===D?2:1,i++):w===D&&(s++,i++);break}if(r(c,f))break}return o.line=i,s}function it(e,t,n){let r=0;for(let o=t;o<n;o++){let a=e.charCodeAt(o);(a===D||a===J&&e.charCodeAt(o+1)!==D)&&r++}return r}function ge(e,t,n){let r=e.slice(t,t+ot),o={sep:n??",",score:-1,width:1},a=n?[n,...ye.filter(l=>l!==n)]:ye;for(let l of a){let s=new Map,i=0;oe(r,l,0,m=>(m.length===1&&m[0]===""||(s.set(m.length,(s.get(m.length)??0)+1),i++),i>=st),{sample:!0});let f=1,c=0;for(let[m,w]of s)m>1&&(w>c||w===c&&m>f)&&(f=m,c=w);f>1&&(c>o.score||c===o.score&&f>o.width)&&(o={sep:l,score:c,width:f})}return o.sep}function at(e){if(!e)return".";try{return new Intl.NumberFormat(e).formatToParts(1.5).find(n=>n.type==="decimal")?.value===","?",":"."}catch{return"."}}async function lt(e,t){let n=z(t),r=x(e,n);n.signal?.throwIfAborted();let o=await F(e,n.limits,r);n.onProgress?.({phase:"read",done:o.length,total:o.length});let{text:a,encoding:l}=H(o,r);n.signal?.throwIfAborted();let s=0,i=typeof n.separator=="string"&&n.separator.length===1?n.separator:null,f=/^sep=(.)\r?\n/i.exec(a.slice(0,8));f&&(s=f[0].length,i??=f[1]),i??=ge(a,s,/\.tsv$/i.test(r)?" ":void 0);let c=G({file:r,limits:n.limits,locale:n.locale,hints:{decimal:i===";"?",":at(n.locale)}});c.note("ENCODING",{encoding:l}),c.note("SEPARATOR",{separator:i,name:rt[i]??`"${i}"`});let m=s,w={file:r,line:s>0?2:1,maxFields:n.limits.columns};for(;m<a.length;){let g=0;m=oe(a,i,m,d=>(c.row(d),++g>=V),w),n.onProgress?.({phase:"parse",done:m,total:a.length}),m<a.length&&(await B(),n.signal?.throwIfAborted())}return n.signal?.throwIfAborted(),c.finish(n.types)}var ye,rt,ot,st,we,D,J,Ae=_(()=>{L();re();ye=[",",";"," ","|"],rt={",":"commas",";":"semicolons"," ":"tabs","|":"vertical bars"},ot=65536,st=100,we=34,D=10,J=13});var be={};ae(be,{read:()=>ut});function Ne(e){if(Array.isArray(e)){let t=e.find(n=>n!=null);return t===void 0?{kind:"objects",rows:[]}:Array.isArray(t)&&e.every(n=>n===null||Array.isArray(n))?{kind:"arrays",rows:e}:S(t)&&e.every(n=>n===null||S(n))?{kind:"objects",rows:e}:null}return S(e)?Array.isArray(e.columns)&&Array.isArray(e.data)&&e.data.every(t=>Array.isArray(t))?{kind:"columnar",columns:e.columns,data:e.data}:Array.isArray(e.columns)&&Array.isArray(e.rows)?{kind:e.rows.every(t=>t===null||Array.isArray(t))?"header":"objects",columns:e.columns,rows:e.rows}:null:null}function ct(e){let t=Ne(e);if(t)return{shape:t,property:null};if(!S(e))return null;let n=null;for(let r of Object.keys(e)){let o=Ne(e[r]);if(o&&(o.kind!=="objects"||o.rows.length>0)){let a=o.rows?.length??o.data?.[0]?.length??0;(!n||a>n.size)&&(n={shape:o,property:r,size:a})}}return n}function Te(e,t,n,r,o,a){for(let l of Object.keys(e)){let s=t+l,i=e[l];S(i)&&n<Oe&&Object.keys(i).length>0?Te(i,`${s}.`,n+1,r,o,a):r.has(s)||(n>0&&(a.nested??=s),o(),r.set(s,r.size))}}function _e(e,t,n,r,o){for(let a of Object.keys(e)){let l=t+a,s=e[a];if(S(s)&&n<Oe&&Object.keys(s).length>0)_e(s,`${l}.`,n+1,r,o);else{let i=r.get(l);i!==void 0&&(o[i]=s)}}}async function ut(e,t){let n=z(t),r=x(e,n);n.signal?.throwIfAborted();let o=await F(e,n.limits,r);n.onProgress?.({phase:"read",done:o.length,total:o.length});let{text:a}=H(o,r),l;try{l=JSON.parse(a)}catch(d){throw N("INVALID_JSON",r,`this is no valid JSON (${String(d.message).slice(0,200)}).`)}n.signal?.throwIfAborted();let s=ct(l);if(!s)throw N("NO_TABLE",r,"no table found: the JSON must be an array of objects, an array of arrays, { columns, rows } or { columns, data }, or an object with one of these under a property.");let{shape:i,property:f}=s,c=G({file:r,limits:n.limits,locale:n.locale,hints:{textNumbers:!1}});f!==null&&c.note("JSON_PROPERTY",{property:f});let m=n.limits,w=0,g=async d=>{++w%V===0&&(n.onProgress?.({phase:"parse",done:w,total:d}),await B(),n.signal?.throwIfAborted())};if(i.kind==="columnar"){let d=i.data[0]?.length??0;if(i.columns.length!==i.data.length)throw N("NO_TABLE",r,`"columns" names ${i.columns.length} columns, but "data" holds ${i.data.length} arrays.`);if(!i.data.every(u=>u.length===d))throw N("NO_TABLE",r,'the arrays in "data" have different lengths.');A("columns",i.columns.length,m.columns,r,"columns"),A("rows",d,m.rows,r,"rows"),c.header(i.columns);for(let u=0;u<d;u++)c.row(i.data.map(p=>p[u])),await g(d)}else if(i.kind==="arrays"||i.kind==="header"){let d=i.rows;A("rows",d.length,m.rows+1,r,"rows");let u=0;for(i.kind==="header"?c.header(i.columns):(c.header(d[0]??[]),u=1);u<d.length;u++)c.row(d[u]??[]),await g(d.length)}else{let d=i.rows;A("rows",d.length,m.rows,r,"rows");let u=new Map;if(Array.isArray(i.columns))for(let h of i.columns)typeof h=="string"&&!u.has(h)&&u.set(h,u.size);let p=()=>A("columns",u.size+1,m.columns,r,"columns"),y={nested:null};for(let h of d)h&&Te(h,"",0,u,p,y);y.nested&&c.note("JSON_FLATTENED",{example:y.nested}),c.header([...u.keys()]);for(let h of d){let b=new Array(u.size).fill(null);h&&_e(h,"",0,u,b),c.row(b),await g(d.length)}}return n.signal?.throwIfAborted(),c.finish(n.types)}var Oe,S,xe=_(()=>{L();re();Oe=4,S=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)});$();q();L();var W=1,ft=/^[a-z0-9][a-z0-9-]{0,63}$/,dt=/^\.[a-z0-9]{1,16}$/,mt=/^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/,De=["reader"];function X(e){let t=e,n=r=>{throw new E("INVALID_ARGUMENT",`plugin ${typeof t?.name=="string"?`"${t.name.slice(0,64)}" `:""}${r}`)};return(t===null||typeof t!="object"||Array.isArray(t))&&n("must be an object"),t.apiVersion!==W&&n(`uses plugin API version ${JSON.stringify(t.apiVersion)}; this pivotkit-core supports version ${W}. Use a version of the plugin made for API ${W}, or update pivotkit.`),De.includes(t.kind)||n(`has kind ${JSON.stringify(t.kind)}; API ${W} knows ${De.map(r=>`"${r}"`).join(", ")}`),(typeof t.name!="string"||!ft.test(t.name))&&n('needs a name of lower-case letters, digits and "-"'),(typeof t.label!="string"||t.label.trim()===""||t.label.length>100)&&n("needs a label of 1 to 100 characters"),(!Array.isArray(t.accept)||t.accept.length===0||!t.accept.every(r=>typeof r=="string"&&(dt.test(r)||mt.test(r))))&&n('needs accept: file name extensions (".xlsx") and media types ("text/csv"), in lower case'),typeof t.load!="function"&&n("needs load(): a function that imports the reader"),Object.freeze({apiVersion:t.apiVersion,kind:t.kind,name:t.name,label:t.label,accept:[...t.accept],load:t.load})}var pt=X({apiVersion:1,kind:"reader",name:"csv",label:"CSV or text",accept:[".csv",".tsv",".txt",".tab","text/csv","text/tab-separated-values","text/plain"],load:()=>Promise.resolve().then(()=>(Ae(),Ee))}),ht=X({apiVersion:1,kind:"reader",name:"json",label:"JSON",accept:[".json","application/json"],load:()=>Promise.resolve().then(()=>(xe(),be))}),yt=Object.freeze([pt,ht]);function wt(e,t=[]){for(let s of t)X(s);let n=[...t,...yt],r=typeof e?.name=="string"?e.name.toLowerCase():"",o=r.lastIndexOf("."),a=o===-1?"":r.slice(o);if(a){let s=n.find(i=>i.accept.includes(a));if(s)return s}let l=typeof e?.type=="string"?e.type.toLowerCase().split(";")[0].trim():"";return l?n.find(s=>s.accept.includes(l)):void 0}var se=new WeakMap;async function gt(e){let t=X(e),n=se.get(e);return n||(n=Promise.resolve(t.load()).then(r=>{let o=r,a=o?.default&&typeof o.read!="function"?o.default:o;if(!a||typeof a.read!="function")throw new E("INVALID_ARGUMENT",`plugin "${t.name}": its load() must give a module with read(file, options)`);if(a.sheets!==void 0&&typeof a.sheets!="function")throw new E("INVALID_ARGUMENT",`plugin "${t.name}": sheets must be a function when given`);return a}),n.catch(()=>se.delete(e)),se.set(e,n)),n}async function Se(e,t={}){let n=x(e,t),r=P(t);if(e&&typeof e=="object"&&typeof e.size=="number"&&e.size>r.fileBytes)throw C("fileBytes",e.size,r.fileBytes,n,"bytes");let o=t.reader??wt(e,t.plugins);if(!o)throw N("NO_READER",n,"no reader for this kind of file.");let a=await gt(o),l={...t};return delete l.plugins,delete l.reader,Et(await a.read(e,l),o.name)}function Et(e,t){let n=o=>{throw new E("INVALID_ARGUMENT",`plugin "${t}": read() must return a table of pivotkit-core/import (createTable().finish()); ${o}`)};(!e||typeof e!="object"||!Array.isArray(e.columns)||!Array.isArray(e.types)||!Array.isArray(e.data)||!Array.isArray(e.notes))&&n("it needs columns, types, data and notes");let r=e.data[0]?.length??0;return(e.types.length!==e.columns.length||e.data.length!==e.columns.length)&&n("columns, types and data differ in length"),e.columns.every(o=>typeof o=="string")||n("a column name is no string"),e.types.every(o=>U.includes(o))||n("a type is none of string, number, date, boolean"),e.data.every(o=>Array.isArray(o)&&o.length===r)||n("the columns differ in length"),e}var M=globalThis;M.onmessage=async e=>{let{file:t,options:n}=e.data??{};try{let r=await Se(t,{...n,plugins:[],onProgress:o=>M.postMessage({type:"progress",progress:o})});M.postMessage({type:"done",table:r})}catch(r){let o=r;M.postMessage({type:"error",error:{code:typeof o?.code=="string"?o.code:void 0,message:String(o?.message??o),details:o?.details&&typeof o.details=="object"?{...o.details}:{}}})}};M.postMessage({type:"ready"});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as t,d as e}from"./chunks/chunk-
|
|
1
|
+
import{a as o,b as r,c as t,d as e}from"./chunks/chunk-NXZQI5LC.js";import"./chunks/chunk-7V4PAOK7.js";import"./chunks/chunk-YMLEL3SK.js";import"./chunks/chunk-HFUBAP3D.js";import"./chunks/chunk-OHKPNELV.js";import"./chunks/chunk-CHSIHYYE.js";import"./chunks/chunk-KO3EKDH5.js";import"./chunks/chunk-XR4CMFGN.js";import"./chunks/chunk-5QXN3X2Q.js";import"./chunks/chunk-DCANE7XH.js";e();export{o as EVENTS,t as PivotReportElement,r as TAG,e as define};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pivotkit-element",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The pivot report builder of pivotkit as the web component <pivot-report>, with its own React: for Angular, PHP and plain HTML pages without React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "eizedev <oss@eize.dev>",
|
|
@@ -18,11 +18,16 @@
|
|
|
18
18
|
"custom-element",
|
|
19
19
|
"reporting",
|
|
20
20
|
"echarts",
|
|
21
|
-
"self-service-bi"
|
|
21
|
+
"self-service-bi",
|
|
22
|
+
"pivot-grid",
|
|
23
|
+
"pivottable",
|
|
24
|
+
"angular",
|
|
25
|
+
"excel-export"
|
|
22
26
|
],
|
|
23
27
|
"type": "module",
|
|
24
28
|
"sideEffects": [
|
|
25
|
-
"./dist/index.js"
|
|
29
|
+
"./dist/index.js",
|
|
30
|
+
"./dist/chunks/*.js"
|
|
26
31
|
],
|
|
27
32
|
"exports": {
|
|
28
33
|
".": {
|
|
@@ -62,8 +67,9 @@
|
|
|
62
67
|
"@dnd-kit/core": "6.3.1",
|
|
63
68
|
"@dnd-kit/sortable": "10.0.0",
|
|
64
69
|
"echarts": "6.1.0",
|
|
65
|
-
"pivotkit-core": "0.
|
|
66
|
-
"pivotkit-react": "0.
|
|
70
|
+
"pivotkit-core": "0.6.0",
|
|
71
|
+
"pivotkit-react": "0.6.0",
|
|
72
|
+
"pivotkit-report": "0.2.0",
|
|
67
73
|
"react": "18.3.1",
|
|
68
74
|
"react-dom": "18.3.1"
|
|
69
75
|
},
|
package/types/element.d.ts
CHANGED
|
@@ -106,10 +106,12 @@ export type CellClick = {
|
|
|
106
106
|
};
|
|
107
107
|
export type ExportFile = {
|
|
108
108
|
/**
|
|
109
|
-
* "
|
|
110
|
-
*
|
|
109
|
+
* "html": the HTML report; "svg": the chart as SVG; "print": the HTML report before it is printed
|
|
110
|
+
* (respondWith(false) prints nothing); "json": the view file (Views, "Download view"); "data-csv",
|
|
111
|
+
* "data-json": Export → Source data, every row of the data shown as it is; "copy-table",
|
|
112
|
+
* "copy-json": Export → Copy table, Copy data as JSON; "drill-*": the drill-down panel's Export menu
|
|
111
113
|
*/
|
|
112
|
-
kind: "xlsx" | "csv" | "png" | "json" | "copy-table" | "copy-json" | "drill-copy" | "drill-json" | "drill-csv" | "drill-xlsx";
|
|
114
|
+
kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "json" | "data-csv" | "data-json" | "copy-table" | "copy-json" | "drill-copy" | "drill-json" | "drill-csv" | "drill-xlsx";
|
|
113
115
|
/**
|
|
114
116
|
* with the extension ("pivot.xlsx"); for a copy the name it would have as a file
|
|
115
117
|
*/
|
|
@@ -137,6 +139,15 @@ export type TemplateSave = {
|
|
|
137
139
|
* where it goes: "user", the user's own views
|
|
138
140
|
*/
|
|
139
141
|
scope: "shared" | "user";
|
|
142
|
+
/**
|
|
143
|
+
* the data
|
|
144
|
+
* shown, as a view file names it (a loaded workbook's sheet in `params.sheet`); null without a source id
|
|
145
|
+
*/
|
|
146
|
+
source: {
|
|
147
|
+
id: string;
|
|
148
|
+
name?: string;
|
|
149
|
+
params?: Record<string, string>;
|
|
150
|
+
} | null;
|
|
140
151
|
/**
|
|
141
152
|
* call it in the listener with the promise of the
|
|
142
153
|
* host's save: "Saved" shows when it resolves, the error's message when it rejects
|
|
@@ -161,6 +172,14 @@ export type TemplatePublish = {
|
|
|
161
172
|
* the user's view to publish as a shared view
|
|
162
173
|
*/
|
|
163
174
|
view: PivotView;
|
|
175
|
+
/**
|
|
176
|
+
* the data shown, as for pivot-template-save
|
|
177
|
+
*/
|
|
178
|
+
source: {
|
|
179
|
+
id: string;
|
|
180
|
+
name?: string;
|
|
181
|
+
params?: Record<string, string>;
|
|
182
|
+
} | null;
|
|
164
183
|
/**
|
|
165
184
|
* as for pivot-template-save: "Published" shows
|
|
166
185
|
* when the promise resolves (the host then sets `templates` with the new shared entry)
|
|
@@ -274,6 +293,9 @@ export declare class PivotReportElement extends Base {
|
|
|
274
293
|
/** The panel with the rows behind a clicked value (default true; attribute drill-down="false"). */
|
|
275
294
|
get drillDown(): boolean;
|
|
276
295
|
set drillDown(value: boolean);
|
|
296
|
+
/** Export → Source data: every row of the data as a CSV or JSON file (default false; boolean attribute export-data). */
|
|
297
|
+
get exportData(): boolean;
|
|
298
|
+
set exportData(value: boolean);
|
|
277
299
|
/** Rows passed to the panel and to pivot-cell-click (default 1000). */
|
|
278
300
|
get drillDownLimit(): number | undefined;
|
|
279
301
|
set drillDownLimit(value: number | undefined);
|
|
@@ -394,9 +416,15 @@ export declare class PivotReportElement extends Base {
|
|
|
394
416
|
*/
|
|
395
417
|
get plugins(): ReaderPlugin[] | undefined;
|
|
396
418
|
set plugins(value: ReaderPlugin[] | undefined);
|
|
397
|
-
/** pivotkit-core's limits (rows, cells, ...). */
|
|
419
|
+
/** pivotkit-core's limits (rows, cells, ...) for the host's data. */
|
|
398
420
|
get limits(): Record<string, number> | undefined;
|
|
399
421
|
set limits(value: Record<string, number> | undefined);
|
|
422
|
+
/**
|
|
423
|
+
* The limits a file loaded with allow-import is read and shown with, merged key by key over
|
|
424
|
+
* `limits` (default: `limits`), so uploads can be kept small without capping the host's data.
|
|
425
|
+
*/
|
|
426
|
+
get importLimits(): Record<string, number> | undefined;
|
|
427
|
+
set importLimits(value: Record<string, number> | undefined);
|
|
400
428
|
}
|
|
401
429
|
/**
|
|
402
430
|
* Defines the element under a tag name (default "pivot-report"). A name that is already defined is
|
package/types/jsx.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { DetailedHTMLProps, HTMLAttributes } from "react";
|
|
|
8
8
|
import type { PivotReportElement } from "./element.js";
|
|
9
9
|
import type { PivotReportEventMap } from "./global.js";
|
|
10
10
|
|
|
11
|
-
type Settable = "data" | "dataKey" | "view" | "defaultView" | "templates" | "labels" | "fieldDefaults" | "limits" | "locale" | "theme" | "height" | "timeZone" | "fileName" | "label" | "drillDown" | "drillDownLimit" | "saveTemplates" | "templateStore" | "canPublish" | "tips" | "storageKey" | "dismissedTips" | "chartOptions" | "shareLink" | "persistView" | "loading" | "fieldInfo" | "zoneInfo" | "settingInfo" | "sourceId" | "sourceName" | "sources" | "schemaUrl" | "grow" | "fieldList" | "allowImport" | "plugins";
|
|
11
|
+
type Settable = "data" | "dataKey" | "view" | "defaultView" | "templates" | "labels" | "fieldDefaults" | "limits" | "importLimits" | "locale" | "theme" | "height" | "timeZone" | "fileName" | "label" | "drillDown" | "drillDownLimit" | "exportData" | "saveTemplates" | "templateStore" | "canPublish" | "tips" | "storageKey" | "dismissedTips" | "chartOptions" | "shareLink" | "persistView" | "loading" | "fieldInfo" | "zoneInfo" | "settingInfo" | "sourceId" | "sourceName" | "sources" | "schemaUrl" | "grow" | "fieldList" | "allowImport" | "plugins";
|
|
12
12
|
|
|
13
13
|
/** The props of <pivot-report> in JSX. */
|
|
14
14
|
export type PivotReportJsxProps = DetailedHTMLProps<HTMLAttributes<PivotReportElement>, PivotReportElement> &
|