@kanunilabs/pivotgrid 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +3 -3
- package/dist/pivotgrid.umd.js +10 -10
- package/dist/styles.css +66 -17
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var pivotgridCore=require('@kanunilabs/pivotgrid-core');var en={tr:pivotgridCore.tr,en:pivotgridCore.en,ar:pivotgridCore.ar,de:pivotgridCore.de,fr:pivotgridCore.fr,es:pivotgridCore.es,it:pivotgridCore.it,pt:pivotgridCore.pt,ru:pivotgridCore.ru,"zh-CN":pivotgridCore.zhCN,ja:pivotgridCore.ja,ko:pivotgridCore.ko};function Ve(e,t,n){let r=e??"en",l={...pivotgridCore.en,...en[r]??{},...t??{}};return {locale:r,rtl:n!==void 0?n:r==="ar",dictionary:l,t:a=>l[a]||a}}var tn={renderCalculatedFieldModal:"render props do not exist here; pass onAddCalculatedField/onEditCalculatedField, or use @kanunilabs/pivotgrid-enterprise which fills the socket",renderPrefilterBuilder:"render props do not exist here; pass onOpenPrefilter, or use @kanunilabs/pivotgrid-enterprise which fills the socket",renderNodeContextMenu:"render props do not exist here; the node menu is built in (Community since #192)",onOpenFullScreenChart:"dead even in React (never fires); use chartIntegrationOptions",children:"this is not a React component",ref:"the object returned by createPivotGrid IS the imperative handle",touchChipTap:"a tap on a field chip sorts it here, as a click does; a long press does not open its menu (B.35)",fieldChooserMode:"the field list here always opens over the pivot; the side panel is React only (B.37)"},nt=new Set;function rt(e){for(let t of Object.keys(e)){let n=tn[t];!n||nt.has(t)||(nt.add(t),console.warn(`[pivotgrid] config key "${t}" is React-only and ignored \u2014 ${n}`));}}var nn=[["background","--pivot-bg"],["surface","--pivot-surface"],["surfaceHover","--pivot-surface-hover"],["surfaceHeader","--pivot-surface-header"],[e=>e.headerBackground||e.surfaceHeader,"--pivot-header-bg"],["headerText","--pivot-header-text"],["border","--pivot-border"],["text","--pivot-text"],["textMuted","--pivot-text-muted"],["textHeader","--pivot-text-header"],["primary","--pivot-primary"],["primaryForeground","--pivot-primary-foreground"],["success","--pivot-success"],["danger","--pivot-danger"],["warning","--pivot-warning"],["info","--pivot-info"],["totalBackground","--pivot-total-bg"],["stripeBackground","--pivot-stripe-bg"],["groupBorder","--pivot-group-border"],["iconActive","--pivot-icon-active"]];function it(e,t){for(let[n,r]of nn){let l=t?typeof n=="function"?n(t):t[n]:void 0;typeof l=="string"&&l?e.style.setProperty(r,l):e.style.removeProperty(r);}t?.id?e.setAttribute("data-theme",t.id):e.removeAttribute("data-theme");}var Ke=(e,t)=>(e.areaIndex||0)-(t.areaIndex||0);function dt(e,t){let n=pivotgridCore.shownFields(e.fields),r=e.layout,l=n.filter(m=>m.area==="row").sort(Ke),a=n.filter(m=>m.area==="column").sort(Ke),s=n.filter(m=>m.area==="data").sort(Ke),C=e.engineResult,k=e.expandedPaths.has("*"),M=e.expandedColPaths.has("*"),R=r.rowHeaderLayout==="tree"?1:l.length||1,y=r.dataFieldPosition==="rows"&&s.length>1,f=y?1:s.length;if(!C)return {rowFields:l,colFields:a,dataFields:s,colHeaders:[],virtualRows:[],leafColHashes:[],cellLookup:new Map,fieldRanges:{},engineResult:null,layout:r,maxRowDepth:R,showDataInRows:y,dfsPerLeaf:f,totalDataCols:0,dataColOffset:R+(y?1:0)};let[x,g]=r.hideEmptySummaryCells?pivotgridCore.filterEmptySummaryTree(C):[C.rowTree,C.colTree],h=pivotgridCore.buildColumnHeaders(g,s,r,e.expandedColPaths,M,t),w=r.rowHeaderLayout==="tree"?pivotgridCore.flattenRowTreeTree(x,e.expandedPaths,k,l.length||1,r.showRowTotals??true,r.totalsPosition??"bottom",r.showTotalsForSingleValues!==false):pivotgridCore.flattenRowTreeTabular(x,e.expandedPaths,k,R,r.showRowTotals??true,r.totalsPosition??"bottom",r.showTotalsForSingleValues!==false),i=[];for(let m of w)if(y&&!m.isSubtotal&&!m.hasChildren)for(let E=0;E<s.length;E++)i.push({flatRow:m,dfIndex:E,isDataRow:true,isGrandTotal:false});else i.push({flatRow:m,dfIndex:0,isDataRow:false,isGrandTotal:false});if(pivotgridCore.grandTotalShown(r,"row",x))if(y)for(let m=0;m<s.length;m++)i.push({flatRow:null,dfIndex:m,isDataRow:true,isGrandTotal:true});else i.push({flatRow:null,dfIndex:0,isDataRow:false,isGrandTotal:true});let p=pivotgridCore.columnSlotOptions(r),u=[];for(let m of pivotgridCore.getVisibleColSlots(g,e.expandedColPaths,M,p))u.push({hash:m.node.key,isGrandTotal:!!m.node.isTotal,isSubtotal:m.isSubtotal});(pivotgridCore.grandTotalShown(r,"column",g)||u.length===0)&&u.push({hash:"",isGrandTotal:true});let v=new Map,c=C.cellMatrix.keys;for(let m=0;m<c.length;m++)v.set(c[m],m);let o=s.some(pivotgridCore.fieldNeedsRange)?pivotgridCore.computeFieldRanges(C,s):{};return {rowFields:l,colFields:a,dataFields:s,colHeaders:h,virtualRows:i,leafColHashes:u,cellLookup:v,fieldRanges:o,engineResult:C,layout:r,maxRowDepth:R,showDataInRows:y,dfsPerLeaf:f,totalDataCols:u.length*f,dataColOffset:R+(y?1:0)}}function _e(e,t,n,r,l){let a=e.engineResult,s=a.rowIndexMap[t]??-1,C=a.columnIndexMap[n]??-1;if(s===-1||C===-1)return null;let k=e.cellLookup.get(s*pivotgridCore.MAX_C+C);if(k===void 0)return null;let M=e.dataFields.length,R=a.cellMatrix.sums,y=a.cellMatrix.displaySums,f={};for(let x=0;x<M;x++)f[e.dataFields[x].id]=R[k*M+x],y&&(f[`${e.dataFields[x].id}_display`]=y[k*M+x]);return {values:f,rowPath:pivotgridCore.pathParts(t),colPath:pivotgridCore.pathParts(n),isTotalCell:s===0||C===0||r||l}}function ct(e,t,n){if(!e.engineResult||n<e.dataColOffset)return null;let r=n-e.dataColOffset,l=Math.floor(r/e.dfsPerLeaf),a=r%e.dfsPerLeaf;if(l>=e.leafColHashes.length)return null;let s=e.virtualRows[t];if(!s)return null;let C=s.isGrandTotal?"":s.flatRow?.key;if(C===void 0)return null;let k=e.leafColHashes[l]?.hash;if(k===void 0)return null;let M=e.engineResult.rowIndexMap[C],R=e.engineResult.columnIndexMap[k];if(M===void 0||R===void 0)return null;let y=e.cellLookup.get(M*pivotgridCore.MAX_C+R);if(y===void 0)return null;let f=e.showDataInRows?s.dfIndex:a,g=e.engineResult.cellMatrix.sums[y*e.dataFields.length+f];return typeof g=="number"?g:null}function Xe(e,t,n){let r=e.virtualRows[t];if(!r||r.isGrandTotal||!r.flatRow)return null;let l=r.flatRow,a=e.layout.rowHeaderLayout==="tree",s=n,C=a?l.depth:s,k=C===l.depth,M=C<l.depth,R=k?l.hasChildren:M,y=k?l.isExpanded:M,f=a?l.key:pivotgridCore.pathKey(l.pathValues.slice(0,s+1));return {hasChildren:R,isExpanded:y,cellHashStr:f,depth:C,dIdx:s,flatRow:l}}function pt(e,t,n){if(n<e.dataColOffset||!e.engineResult)return null;let r=n-e.dataColOffset,l=Math.floor(r/e.dfsPerLeaf),a=r%e.dfsPerLeaf;if(l>=e.leafColHashes.length)return null;let s=e.virtualRows[t];if(!s)return null;let C=s.isGrandTotal?"":s.flatRow?.key;if(C===void 0)return null;let k=e.leafColHashes[l],M=_e(e,C,k.hash,!!s.flatRow?.isSubtotal,k.isGrandTotal);if(!M)return null;let R=e.showDataInRows?s.dfIndex:a,y=e.dataFields[R],f=M.values[`${y?.id}_display`]??M.values[y?.id],x=!!s.flatRow?.isSubtotal||k.isGrandTotal||M.isTotalCell;return {cell:{isTotalCell:M.isTotalCell,rowPath:M.rowPath,colPath:M.colPath,values:M.values},val:f,isTotal:x}}function ze(e){let t=new Map;return (n,r)=>{if(n==null||Number.isNaN(n))return "";if(r.format&&typeof n=="number"){if(typeof r.format=="function")return r.format(n);try{let l=r.format,a=t.get(l);a||(a=new Intl.NumberFormat(e,l),t.set(l,a));let s=a.format(n);return l.isCustom&&(l.prefix||l.suffix)?`${l.prefix||""}${s}${l.suffix||""}`:s}catch{return String(n)}}return typeof n=="number"&&pivotgridCore.percentModeText(n,r,e)||String(n)}}var Re=null;function $e(e,t,n){if(!e)return false;let r=Math.min(e.startR,e.endR),l=Math.max(e.startR,e.endR),a=Math.min(e.startC,e.endC),s=Math.max(e.startC,e.endC);return t>=r&&t<=l&&n>=a&&n<=s}function ut(e){let{scroller:t,shared:n}=e,r={},l="",a=null,s=false;function C(){for(let x of t.querySelectorAll("td[data-r][data-c]")){let g=Number(x.getAttribute("data-r")),h=Number(x.getAttribute("data-c"));x.classList.toggle("kanuni-pivot-cell-selected",$e(n.selection,g,h));}}function k(){let x=n.selection;if(e.onStats){if(!x||x.mode!=="data"){a&&(clearTimeout(a),a=null),s&&(s=false,e.onStats(null));return}a&&clearTimeout(a),a=setTimeout(()=>{a=null;let g=n.selection;if(!g||g.mode!=="data")return;let h=Math.min(g.startR,g.endR),w=Math.max(g.startR,g.endR),i=Math.min(g.startC,g.endC),p=Math.max(g.startC,g.endC),u=0,v=0,c=1/0,o=-1/0,m=e.getVM();if(m){for(let E=h;E<=w;E++)for(let b=i;b<=p;b++){let S=ct(m,E,b);S===null||isNaN(S)||(u+=S,v++,S<c&&(c=S),S>o&&(o=S));}s=v>0,e.onStats(v>0?{sum:u,count:v,avg:u/v,min:c,max:o}:null);}},10);}}n.selectByKey=(x,g,h,w)=>{let i=e.getVM();if(!i)return;let p=g<i.dataColOffset?"row":"data",u=n.selection;if(Re=r,l="",h&&u&&u.mode===p){if(u.endR===x&&u.endC===g&&!u.isSelecting)return;n.selection={...u,endR:x,endC:g,isSelecting:false};}else if(h){let c=(w.c<i.dataColOffset?"row":"data")===p?w:{r:x,c:g};n.selection={startR:c.r,startC:c.c,endR:x,endC:g,isSelecting:false,mode:p};}else {if(u&&u.mode===p&&!u.isSelecting&&u.startR===x&&u.startC===g&&u.endR===x&&u.endC===g)return;n.selection={startR:x,startC:g,endR:x,endC:g,isSelecting:false,mode:p};}C(),k();};let M=x=>{if(x.button!==0||n.isResizing||x.target.closest?.(".kanuni-pivot-resize-handle"))return;let g=x.target.closest?.("td[data-r][data-c]");if(!g)return;let h=e.getVM();if(!h)return;let w=Number(g.getAttribute("data-r")),i=Number(g.getAttribute("data-c")),p=i<h.dataColOffset?"row":"data";Re=r,l="",n.selection={startR:w,startC:i,endR:w,endC:i,isSelecting:true,mode:p},C(),k();},R=x=>{let g=n.selection;if(!g||!g.isSelecting)return;let h=x.target.closest?.("td[data-r][data-c]");if(!h)return;let w=Number(h.getAttribute("data-r")),i=Number(h.getAttribute("data-c")),p=`${w},${i}`;if(p===l)return;l=p;let u=e.getVM();!u||(i<u.dataColOffset?"row":"data")!==g.mode||w===g.endR&&i===g.endC||(g.endR=w,g.endC=i,C(),k());},y=()=>{n.selection&&(n.selection.isSelecting=false);},f=x=>{if(!(x.ctrlKey||x.metaKey)||x.key!=="c"||Re!==null&&Re!==r)return;let g=n.selection;if(!g)return;let h=Math.min(g.startR,g.endR),w=Math.max(g.startR,g.endR),i=Math.min(g.startC,g.endC),p=Math.max(g.startC,g.endC),u="";for(let v=h;v<=w;v++){let c=[];for(let o=i;o<=p;o++){let m=t.querySelector(`[data-r="${v}"][data-c="${o}"]`);c.push(m?(m.innerText??m.textContent??"").trim().replace(/\n/g," "):"");}u+=c.join(" ")+`
|
|
2
|
-
`;}u&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(u).catch(()=>{});};return t.addEventListener("mousedown",M),t.addEventListener("mouseover",R),document.addEventListener("mouseup",y),document.addEventListener("keydown",f),{destroy(){t.removeEventListener("mousedown",M),t.removeEventListener("mouseover",R),document.removeEventListener("mouseup",y),document.removeEventListener("keydown",f),a&&clearTimeout(a),Re===r&&(Re=null),n.selectByKey=void 0;}}}var ht={settings:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]],"settings-2":[["path",{d:"M14 17H5"}],["path",{d:"M19 7h-9"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]],download:[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]],"refresh-cw":[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]],maximize2:[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]],minimize2:[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]],fullscreen:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1"}]],shrink:[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3"}]],"file-spreadsheet":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 13h2"}],["path",{d:"M14 13h2"}],["path",{d:"M8 17h2"}],["path",{d:"M14 17h2"}]],"file-text":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]],"file-json":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"}]],file:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]],database:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}],["path",{d:"M3 12A9 3 0 0 0 21 12"}]],calculator:[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18"}],["path",{d:"M16 10h.01"}],["path",{d:"M12 10h.01"}],["path",{d:"M8 10h.01"}],["path",{d:"M12 14h.01"}],["path",{d:"M8 14h.01"}],["path",{d:"M12 18h.01"}],["path",{d:"M8 18h.01"}]],filter:[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"}]],"bar-chart":[["path",{d:"M5 21v-6"}],["path",{d:"M12 21V9"}],["path",{d:"M19 21V3"}]],"bar-chart-3":[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M18 17V9"}],["path",{d:"M13 17V5"}],["path",{d:"M8 17v-3"}]],"line-chart":[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"m19 9-5 5-4-4-3 3"}]],"area-chart":[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"}]],"pie-chart":[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83"}]],"scatter-chart":[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}]],"dot-plot":[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]],"bubble-chart":[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"12",r:"1"}]],"donut-chart":[["path",{d:"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3"}],["circle",{cx:"12",cy:"12",r:"3"}]],"waterfall-chart":[["path",{d:"M13 17V9"}],["path",{d:"M18 17v-3"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M8 17V5"}]],"funnel-chart":[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"}]],"treemap-chart":[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1"}]],"heatmap-chart":[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]],"range-chart":[["path",{d:"M9 5v4"}],["rect",{width:"4",height:"6",x:"7",y:"9",rx:"1"}],["path",{d:"M9 15v2"}],["path",{d:"M17 3v2"}],["rect",{width:"4",height:"8",x:"15",y:"5",rx:"1"}],["path",{d:"M17 13v3"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}]],"sunburst-chart":[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M12 2v2"}],["path",{d:"M12 20v2"}],["path",{d:"m4.93 4.93 1.41 1.41"}],["path",{d:"m17.66 17.66 1.41 1.41"}],["path",{d:"M2 12h2"}],["path",{d:"M20 12h2"}],["path",{d:"m6.34 17.66-1.41 1.41"}],["path",{d:"m19.07 4.93-1.41 1.41"}]],"histogram-chart":[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1"}]],radar:[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34"}],["path",{d:"M4 6h.01"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67"}],["path",{d:"M12 18h.01"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67"}],["circle",{cx:"12",cy:"12",r:"2"}],["path",{d:"m13.41 10.59 5.66-5.66"}]],printer:[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1"}]],copy:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]],save:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7"}]],"save-all":[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z"}]],bookmark:[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z"}]],"folder-open":[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]],check:[["path",{d:"M20 6 9 17l-5-5"}]],"check-circle":[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}],["path",{d:"m9 11 3 3L22 4"}]],star:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"}]],trash:[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]],x:[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]],search:[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]],"grip-vertical":[["circle",{cx:"9",cy:"12",r:"1"}],["circle",{cx:"9",cy:"5",r:"1"}],["circle",{cx:"9",cy:"19",r:"1"}],["circle",{cx:"15",cy:"12",r:"1"}],["circle",{cx:"15",cy:"5",r:"1"}],["circle",{cx:"15",cy:"19",r:"1"}]],"grip-horizontal":[["circle",{cx:"12",cy:"9",r:"1"}],["circle",{cx:"19",cy:"9",r:"1"}],["circle",{cx:"5",cy:"9",r:"1"}],["circle",{cx:"12",cy:"15",r:"1"}],["circle",{cx:"19",cy:"15",r:"1"}],["circle",{cx:"5",cy:"15",r:"1"}]],"chevron-down":[["path",{d:"m6 9 6 6 6-6"}]],"chevron-left":[["path",{d:"m15 18-6-6 6-6"}]],"chevron-right":[["path",{d:"m9 18 6-6-6-6"}]],"chevrons-left":[["path",{d:"m11 17-5-5 5-5"}],["path",{d:"m18 17-5-5 5-5"}]],"chevrons-right":[["path",{d:"m6 17 5-5-5-5"}],["path",{d:"m13 17 5-5-5-5"}]],"arrow-up":[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]],"arrow-down":[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]],"arrow-down-a-z":[["path",{d:"m3 16 4 4 4-4"}],["path",{d:"M7 20V4"}],["path",{d:"M20 8h-5"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10"}],["path",{d:"M15 14h5l-5 6h5"}]],"arrow-up-z-a":[["path",{d:"m3 8 4-4 4 4"}],["path",{d:"M7 4v16"}],["path",{d:"M15 4h5l-5 6h5"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20"}],["path",{d:"M20 18h-5"}]],"eye-off":[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]],list:[["path",{d:"M3 5h.01"}],["path",{d:"M3 12h.01"}],["path",{d:"M3 19h.01"}],["path",{d:"M8 5h13"}],["path",{d:"M8 12h13"}],["path",{d:"M8 19h13"}]],columns3:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]],hash:[["line",{x1:"4",x2:"20",y1:"9",y2:"9"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21"}]],calendar:[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}]],type:[["path",{d:"M12 4v16"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}],["path",{d:"M9 20h6"}]],plus:[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]],"alert-circle":[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]],move:[["path",{d:"M12 2v20"}],["path",{d:"m15 19-3 3-3-3"}],["path",{d:"m19 9 3 3-3 3"}],["path",{d:"M2 12h20"}],["path",{d:"m5 9-3 3 3 3"}],["path",{d:"m9 5 3-3 3 3"}]]};var ft="http://www.w3.org/2000/svg";function q(e,t=15,n){let r=document.createElementNS(ft,"svg");r.setAttribute("width",String(t)),r.setAttribute("height",String(t)),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false"),n&&(r.style.color=n);for(let[l,a]of ht[e]??[]){let s=document.createElementNS(ft,l);for(let[C,k]of Object.entries(a))s.setAttribute(C,String(k));r.appendChild(s);}return r}function Fe(e,t=15,n){let r=q(e,t,n);return r.setAttribute("fill","currentColor"),r}function pe(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Ye(e){let t=document.activeElement;return !t||!e.contains(t)?null:t.closest(".kanuni-pivot-field-chip")?.getAttribute("data-drop-id")??null}function Ue(e,t){if(!t)return;let n=e.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${t}"]`);n&&n!==document.activeElement&&n.focus({preventScroll:true});}function yn(e,t,n){let r=e.filter(l=>l.area===t);return t==="filter"?vt(r,n):r.sort((l,a)=>(l.areaIndex||0)-(a.areaIndex||0))}var xn={row:"rowArea",column:"columnArea",data:"dataArea",filter:"filterArea"};function Be(e,t){let{t:n,locale:r,rtl:l}=t.getI18n(),a=pe("kanuni-pivot-field-chip");a.setAttribute("data-drop-id",e.id),a.style.position="relative",a.style.cursor="pointer",a.setAttribute("role","button"),a.tabIndex=0;let s=t.getFields?yn(t.getFields(),e.area,r):[e],C=Math.max(0,s.findIndex(i=>i.id===e.id)),k=n(xn[e.area??""]??"rowArea");a.setAttribute("aria-label",n("fieldChipLabel").replace("{0}",e.caption||e.id).replace("{1}",k).replace("{2}",String(C+1)).replace("{3}",String(s.length))),a.setAttribute("aria-keyshortcuts","Control+ArrowLeft Control+ArrowRight Control+Home Control+End Delete Alt+ArrowDown Shift+F10"),a.setAttribute("aria-description",n("fieldChipKeys"));let M=()=>{if(!t.onSort)return;let i=e.sortOrder==="asc"?"desc":e.sortOrder==="desc"?void 0:"asc";t.onSort(e.id,i);},R=i=>{if(!i)return;(a.closest(".kanuni-pivot-root")??document.body).querySelector(`.kanuni-pivot-field-chip[data-drop-id="${i}"]`)?.focus({preventScroll:true});};a.addEventListener("keydown",i=>{let p=i.ctrlKey||i.metaKey,u=l?"ArrowRight":"ArrowLeft",v=l?"ArrowLeft":"ArrowRight",c=!!t.onMove&&e.area!=="filter",o=true;if(i.key==="Enter"||i.key===" ")M();else if(p&&c&&(i.key===u||i.key==="ArrowUp"))C>0&&t.onMove(e.id,"left");else if(p&&c&&(i.key===v||i.key==="ArrowDown"))C<s.length-1&&t.onMove(e.id,"right");else if(p&&c&&i.key==="Home")C>0&&t.onMove(e.id,"start");else if(p&&c&&i.key==="End")C<s.length-1&&t.onMove(e.id,"end");else if(!p&&(i.key===u||i.key===v)){let m=i.key===u?-1:1;R(s[C+m]?.id);}else if(i.key==="Delete"||i.key==="Backspace"){let m=s[C+1]??s[C-1];t.requestFocus?.(m?.id??null),t.onRemove(e.id);}else if(i.altKey&&i.key==="ArrowDown"){let m=a.getBoundingClientRect();t.onFilterClick(l?m.right:m.left,m.bottom,e.id);}else if(i.key==="F10"&&i.shiftKey||i.key==="ContextMenu"){if(!t.onContextMenu)return;let m=a.getBoundingClientRect();t.onContextMenu(l?m.right:m.left,m.bottom,e.id,void 0,true);}else o=false;o&&(i.preventDefault(),i.stopPropagation());});let y=pe("pivot-truncate","span");Object.assign(y.style,{maxWidth:"120px",userSelect:"none"}),y.textContent=e.caption||e.id,a.appendChild(y),e.sortOrder==="asc"&&a.appendChild(q("arrow-up",12,"var(--pivot-primary)")),e.sortOrder==="desc"&&a.appendChild(q("arrow-down",12,"var(--pivot-primary)"));let f=e.area==="data"&&e.summaryType?pivotgridCore.summaryTypeLabel(String(e.summaryType),n):"";if(f){let i=pe("","span");Object.assign(i.style,{fontSize:"10px",backgroundColor:"color-mix(in srgb, var(--pivot-primary) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--pivot-primary) 45%, transparent)",color:"var(--pivot-text)",padding:"0 4px",borderRadius:"4px",fontWeight:"700"}),i.textContent=f,a.appendChild(i);}let x=!!e.filterValues&&e.filterValues.size>0||!!e.valueFilter||!!e.labelFilter,g=pe(`kanuni-pivot-field-chip-actions${x?" is-filtered":""}`);g.setAttribute("aria-hidden","true");let h=pe("kanuni-pivot-chip-btn","span");h.title=n("filterField"),h.style.color=x?"var(--pivot-danger)":"inherit",h.appendChild(q("filter",12)),h.addEventListener("pointerdown",i=>i.stopPropagation()),h.addEventListener("click",i=>{i.stopPropagation(),t.onFilterClick(i.clientX,i.clientY,e.id);});let w=pe("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","span");if(w.title=n("removeField"),w.appendChild(q("x",12)),w.addEventListener("pointerdown",i=>i.stopPropagation()),w.addEventListener("click",i=>{i.stopPropagation(),t.onRemove(e.id);}),g.append(h,w),a.appendChild(g),t.onContextMenu){a.setAttribute("data-chip-menu","");let i=pe(`kanuni-pivot-chip-more${x?" is-filtered":""}`,"span");if(i.setAttribute("aria-hidden","true"),i.addEventListener("pointerdown",p=>p.stopPropagation()),i.addEventListener("click",p=>{p.stopPropagation();let u=i.getBoundingClientRect();t.onContextMenu(l?u.right:u.left,u.bottom,e.id,void 0);}),a.appendChild(i),x){let p=q("filter",10);p.classList.add("kanuni-pivot-chip-filtered-mark"),p.setAttribute("aria-hidden","true"),a.appendChild(p);}}return a.addEventListener("click",i=>{i.stopPropagation(),M();}),a.addEventListener("contextmenu",i=>{if(i.stopPropagation(),t.onContextMenu){i.preventDefault();let p=a.getBoundingClientRect(),u=Number.isFinite(i.clientX)?i.clientX:l?p.right:p.left,v=Number.isFinite(i.clientY)?i.clientY:p.bottom;t.onContextMenu(u,v,e.id,void 0);}}),a}function Ne(e,t,n,r,l){let{t:a}=l.getI18n(),s=pe("kanuni-pivot-area-dropzone");s.setAttribute("data-drop-id",e),s.tabIndex=-1;let C=pe("kanuni-pivot-area-header");C.appendChild(q(n,13)),C.appendChild(document.createTextNode(t)),s.appendChild(C);let k=pe("kanuni-pivot-area-content");if(r.length===0){let R=pe("pivot-text-xs pivot-text-muted","span");Object.assign(R.style,{fontStyle:"italic",padding:"0 8px"}),R.textContent=a("dropHere"),k.appendChild(R);}for(let R of r)k.appendChild(Be(R,l));let M=pe("kanuni-pivot-ghost-end");return M.setAttribute("data-drop-id",`${e}-ghost-end`),M.setAttribute("data-ghost-populated",r.length>0?"1":"0"),Object.assign(M.style,{flex:"1",minWidth:"40px",minHeight:"24px",borderRadius:"var(--pivot-border-radius-sm)",transition:"background-color 0.2s"}),k.appendChild(M),s.appendChild(k),s}function vt(e,t){let n=new Map;return e.map(l=>{let a=l.caption||l.id||"";if(n.has(a)){let s=n.get(a)+1;return n.set(a,s),{...l,caption:`${a} (${s})`}}return n.set(a,1),l}).sort((l,a)=>(l.caption||"").toLowerCase().localeCompare((a.caption||"").toLowerCase(),t||"en"))}function mt(e){let t=pe("kanuni-pivot-filter-strip pivot-flex pivot-flex-col");Object.assign(t.style,{padding:"8px",borderBottom:"1px solid var(--pivot-border)",backgroundColor:"color-mix(in srgb, var(--pivot-surface-header) 30%, transparent)",flex:"0 0 auto"});let n=l=>{e.onGlobalContextMenu&&(l.target.closest(".kanuni-pivot-field-chip")||(l.preventDefault(),e.onGlobalContextMenu(l.clientX,l.clientY)));};t.addEventListener("contextmenu",n),e.host.appendChild(t);function r(l,a,s){let{t:C}=e.getI18n(),k=l.querySelector(".kanuni-pivot-area-header"),M=l.querySelector(".kanuni-pivot-area-content"),R=s.collapsed===true;if(R&&l.setAttribute("data-collapsed",""),k&&R){let x=pivotgridCore.countFilteredFields(a);if(x>0){let g=pe("kanuni-pivot-area-filtered-count","span");g.textContent=C("filteredFieldCount").replace("{0}",String(x)),k.appendChild(g);}}if(k&&e.onToggleCollapsed&&a.length>0){let x=pe("kanuni-pivot-area-collapse","button");x.type="button";let g=C(R?"expandFilterArea":"collapseFilterArea");x.setAttribute("aria-expanded",String(!R)),x.setAttribute("aria-label",g),x.title=g;let h=q("chevron-down",14);R||(h.style.transform="rotate(180deg)"),x.appendChild(h),x.addEventListener("click",w=>{w.stopPropagation(),e.onToggleCollapsed();}),k.appendChild(x);}let y=pivotgridCore.filterAreaRows({filterAreaMaxRows:s.maxRows,filterAreaCollapsed:R});if(!M||y===null)return;let f=M.querySelector(".kanuni-pivot-field-chip");M.style.maxHeight=`${pivotgridCore.filterAreaMaxHeight(y,f?.offsetHeight||28)}px`,M.style.overflowY=R?"hidden":"auto";}return {element:t,paint(l,a,s={}){t.style.display=a?"":"none";let C=Ye(t);if(t.textContent="",!a)return;let k=pe("pivot-flex");k.style.width="100%";let{t:M,locale:R}=e.getI18n(),y=Ne("filter",M("filterArea"),"filter",vt(l,R),e);k.appendChild(y),t.appendChild(k),r(y,l,s),Ue(t,C);},destroy(){t.removeEventListener("contextmenu",n),t.remove();}}}var gt="kanuni-pivot-drop-indicator";function Cn(e){let t=pe(gt);Object.assign(t.style,{position:"absolute",zIndex:"100",pointerEvents:"none",top:"-4px",bottom:"-4px",width:"0"}),t.style.setProperty(e==="before"?"inset-inline-start":"inset-inline-end","-4px");let n=pe("");Object.assign(n.style,{position:"absolute",top:"0",width:"0",height:"0",borderTop:"5px solid var(--pivot-primary)"}),n.style.setProperty("inset-inline-start","-4px"),n.style.setProperty("border-inline-start","4px solid transparent"),n.style.setProperty("border-inline-end","4px solid transparent");let r=pe("");Object.assign(r.style,{position:"absolute",bottom:"0",width:"0",height:"0",borderBottom:"5px solid var(--pivot-primary)"}),r.style.setProperty("inset-inline-start","-4px"),r.style.setProperty("border-inline-start","4px solid transparent"),r.style.setProperty("border-inline-end","4px solid transparent");let l=pe("");return Object.assign(l.style,{position:"absolute",top:"0",bottom:"0",width:"2px",backgroundColor:"var(--pivot-primary)"}),l.style.setProperty("inset-inline-start","-1px"),t.append(n,r,l),t}function bt(e,t){for(let n of e){for(let r of n.querySelectorAll(`.${gt}`))r.remove();for(let r of n.querySelectorAll('[data-drop-id$="-ghost-end"]'))r.style.backgroundColor="transparent",r.style.boxShadow="none",r.textContent="";for(let r of n.querySelectorAll(".pivot-area-strip--over"))r.classList.remove("pivot-area-strip--over");for(let r of n.querySelectorAll('[data-drop-kind="list"]'))r.style.backgroundColor="transparent",r.style.boxShadow="none";}if(t.intent==="before"||t.intent==="after"){if(!t.targetId)return;for(let n of e){let r=n.querySelector(`[data-drop-id="${t.targetId}"]`)??n.querySelector(`[data-drop-id="chooser-${t.targetId}"]`);if(r){r.appendChild(Cn(t.intent));return}}}else if(t.intent==="append"&&t.targetArea)for(let n of e){let r=n.querySelector(`[data-drop-id="${t.targetArea}-ghost-end"]`)??n.querySelector(`[data-drop-id="chooser-${t.targetArea}-ghost-end"]`);if(r&&(r.style.backgroundColor="color-mix(in srgb, var(--pivot-primary) 10%, transparent)",r.style.boxShadow="inset 0 0 0 1px color-mix(in srgb, var(--pivot-primary) 50%, transparent)",r.getAttribute("data-ghost-populated")==="1")){let s=pe("");Object.assign(s.style,{width:"4px",height:"100%",backgroundColor:"var(--pivot-primary)",borderRadius:"2px",marginLeft:"4px"}),r.appendChild(s);}n.querySelector(`[data-drop-id="${t.targetArea}"]`)?.classList.add("pivot-area-strip--over");let a=n.querySelector(`[data-drop-id="chooser-${t.targetArea}"][data-drop-kind="list"]`);a&&(a.style.backgroundColor="color-mix(in srgb, var(--pivot-primary) 5%, transparent)",a.style.boxShadow="inset 0 0 0 1px color-mix(in srgb, var(--pivot-primary) 50%, transparent)");}}var Tn={style:{}},Mn=28,xt=5,Ln=10,Ct=40,wt=8,Ze=100;function X(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function J(e,t){for(let[n,r]of Object.entries(t)){if(r==null)continue;let l=n.replace(/[A-Z]/g,a=>"-"+a.toLowerCase());e.style.setProperty(l,typeof r=="number"&&r!==0&&!/z-?index|font-?weight|opacity/i.test(n)?`${r}px`:String(r));}}function We(e,t,n,r){let l=X("kanuni-pivot-resize-handle");return l.setAttribute("data-resize-id",e),l.setAttribute("data-resize-default",String(t)),n>1&&l.setAttribute("data-resize-span",String(n)),l.style.setProperty(r,"-3px"),l}function He(e,t){e.textContent="",t!=null&&(typeof t=="string"||typeof t=="number"?e.textContent=String(t):e.appendChild(t));}function Et(e){let{host:t,getI18n:n}=e,r=e.columnWidthDefaults??pivotgridCore.resolveColumnWidthDefaults(),l=e.rowHeight??(()=>Mn),a=e.shared?.cellId??((L,P)=>`pivot-cell-${L}-${P}`),s=X("datagrid-table-wrapper custom-scrollbar pivot-right-pane");J(s,{overflow:"auto",flex:"1 1 auto",minHeight:0,position:"relative",outline:"none"}),s.tabIndex=0,s.setAttribute("role","grid");let C=X("");J(C,{width:"max-content",position:"relative",minWidth:"100%"});let k=X("kanuni-pivot-table","table");k.setAttribute("role","presentation"),J(k,{borderCollapse:"separate",borderSpacing:0,width:0,minWidth:"100%",tableLayout:"fixed"});let M=document.createElement("colgroup"),R=X("","thead");R.setAttribute("role","rowgroup"),J(R,{position:"sticky",top:0,zIndex:50,backgroundColor:"var(--pivot-surface-header)"});let y=X("","tbody");y.setAttribute("role","rowgroup"),k.append(M,R,y),C.appendChild(k),s.appendChild(C),t.appendChild(s);let f=null,x=ze(n().locale),g=n().locale,h={start:-1,end:-1},w={start:0,end:Number.MAX_SAFE_INTEGER},i={},p=new Set,u=false,v=()=>f?Math.max(f.colHeaders.length,1)*l()+(e.chipDeps?42:0):0,c=L=>i[`row-${L}`]??r.rowHeader,o=()=>i[`row-${f.maxRowDepth}`]??Ze,m=L=>i[`leaf-${L}`]??r.data;function E(){if(!f||f.totalDataCols<=Ct){w={start:0,end:Number.MAX_SAFE_INTEGER};return}let L=Math.abs(s.scrollLeft),P=S().total,D=L-P,V=0,Y=0;for(;V<f.totalDataCols&&Y+m(V)<=D;)Y+=m(V),V++;V=Math.max(0,V-wt);let ae=s.clientWidth||0,ve=V,U=0;for(;ve<f.totalDataCols&&U<=ae;)U+=m(ve),ve++;w={start:V,end:Math.min(f.totalDataCols,ve+wt)};}function b(){if(!f)return {start:0,end:0};let L=Math.max(0,s.scrollTop-v()),P=Math.max(0,Math.floor(L/l())-xt),D=Math.ceil((s.clientHeight||600)/l())+Ln;return {start:P,end:Math.min(f.virtualRows.length,P+D+xt)}}function S(){let L=[];for(let P=0;P<f.maxRowDepth;P++)L.push(c(P));return f.showDataInRows&&L.push(o()),pivotgridCore.computeRowHeaderWidths(L,s.clientWidth)}function F(){let{widths:L,total:P}=S(),D=0;for(let V=0;V<L.length;V++)s.style.setProperty(`--row-header-left-${V}`,`${D}px`),s.style.setProperty(`--col-width-row-${V}`,`${L[V]}px`),p.add(`--col-width-row-${V}`),D+=L[V];s.style.setProperty("--row-header-total-width",`${P}px`);}function A(){M.textContent="";for(let L=0;L<f.maxRowDepth;L++){let P=document.createElement("col");P.style.width=`var(--col-width-row-${L}, ${r.rowHeader}px)`,M.appendChild(P);}if(f.showDataInRows){let L=document.createElement("col");L.style.width=`var(--col-width-row-${f.maxRowDepth}, ${Ze}px)`,M.appendChild(L);}for(let L=0;L<Math.max(f.totalDataCols,1);L++){let P=document.createElement("col");P.style.width=`var(--col-width-data-${L}, ${r.data}px)`,M.appendChild(P);}}function H(){let{colHeaders:L,rowFields:P,colFields:D,dataFields:V,maxRowDepth:Y,showDataInRows:ae,layout:ve,dataColOffset:U}=f,{t:de,locale:T}=n(),d=Ye(R);R.textContent="";let I=Math.max(L.length,1),B=e.chipDeps;if(B){let Q=X("","tr");Q.setAttribute("role","row"),J(Q,{height:42});let z=X("","th");z.setAttribute("role","columnheader"),z.colSpan=Math.max(U,1),J(z,{position:"sticky",zIndex:61,borderBottom:"1px solid var(--pivot-border)",borderInlineEnd:"1px solid var(--pivot-border)",padding:0,verticalAlign:"top",minWidth:50,backgroundColor:"var(--pivot-surface-header)"}),z.style.setProperty("inset-inline-start","0px"),z.appendChild(Ne("data",de("dataArea"),"bar-chart-3",V,B)),Q.appendChild(z);let j=X("","th");j.setAttribute("role","columnheader"),j.colSpan=Math.max(f.totalDataCols,1),J(j,{borderBottom:"1px solid var(--pivot-border)",padding:0,verticalAlign:"top",zIndex:1,backgroundColor:"var(--pivot-surface-header)"});let W=X("");J(W,{position:"sticky",width:"max-content",maxWidth:"100%"}),W.style.setProperty("inset-inline-start","var(--row-header-total-width, 0px)"),W.appendChild(Ne("column",de("columnArea"),"columns3",D,B)),j.appendChild(W),Q.appendChild(j),R.appendChild(Q);}for(let Q=0;Q<I;Q++){let z=X("","tr");if(z.setAttribute("role","row"),J(z,{height:l()}),Q===0){let W=G=>({position:"sticky",top:0,zIndex:60,backgroundColor:"var(--pivot-surface-header)",borderBottom:"1px solid var(--pivot-border)",borderInlineEnd:G?"1px solid var(--pivot-border)":"none",verticalAlign:"bottom",padding:"4px 8px",color:"var(--pivot-text-header)"});if(P.length===0){let G=X("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");G.setAttribute("data-drop-id","row"),G.setAttribute("data-row-header-idx","0"),G.rowSpan=I,G.colSpan=Math.max(U,1),J(G,{...W(true),padding:"8px",color:"color-mix(in srgb, var(--pivot-text-header, var(--pivot-text)) 70%, transparent)"}),G.style.setProperty("inset-inline-start","var(--row-header-left-0, 0px)"),G.textContent=de("dropHere"),z.appendChild(G);}else if(ve.rowHeaderLayout==="tree"){let G=X("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");if(G.setAttribute("data-row-header-idx","0"),G.rowSpan=I,J(G,W(!ae)),G.style.setProperty("inset-inline-start","var(--row-header-left-0, 0px)"),B){let _=X("");J(_,{display:"flex",flexWrap:"wrap",gap:4});for(let re of P)_.appendChild(Be(re,B));G.appendChild(_);}else He(G,P.map(_=>_.caption).join(", "));z.appendChild(G);}else for(let G=0;G<Y;G++){let _=X("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");_.setAttribute("data-row-header-idx",String(G)),_.rowSpan=I,J(_,W(G===Y-1&&!ae)),_.style.setProperty("inset-inline-start",`var(--row-header-left-${G}, 0px)`);let re=P[G];re&&B?_.appendChild(Be(re,B)):He(_,re?.caption??""),z.appendChild(_);}if(ae&&P.length>0){let G=X("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");G.setAttribute("data-row-header-idx",String(Y)),G.rowSpan=I,J(G,W(true)),G.style.setProperty("inset-inline-start",`var(--row-header-left-${Y}, 0px)`);let _=X("");J(_,{fontSize:10,fontWeight:600,textTransform:"uppercase",textAlign:"center",color:"color-mix(in srgb, var(--pivot-text-header, var(--pivot-text)) 80%, transparent)"}),_.style.letterSpacing="0.05em",_.textContent=de("dataArea"),G.appendChild(_),z.appendChild(G);}}let j=L[Q]??[];for(let W of j){let G=W.fieldId?D.find(oe=>oe.id===W.fieldId):void 0,_=!!G?.filterValues&&G.filterValues.size>0,re=W.leafStart,ge=G&&!W.isTotal?pivotgridCore.formatDimensionValue(W.caption,G,"grid",T):W.caption,ce={text:typeof G?.cellTemplate=="function"?G.cellTemplate({value:W.caption,displayValue:ge,field:G})??null:String(ge??""),style:{textAlign:"left",fontWeight:W.isTotal?600:500,borderBottom:"1px solid var(--pivot-border)",borderRight:"1px solid var(--pivot-border)",color:"var(--pivot-text-header, inherit)",backgroundColor:"var(--pivot-surface-header)",cursor:G?"pointer":"context-menu",position:"relative",zIndex:1,padding:"4px 6px"},className:`kanuni-pivot-header-cell group ${W.isTotal?"kanuni-pivot-header-total":""}`};e.onCellPrepared?.({area:"column",cell:null,rowIndex:Q,columnIndex:re,cellConfig:ce});let Z=X(ce.className,"th");Z.setAttribute("role","columnheader"),W.hasChildren&&Z.setAttribute("aria-expanded",String(!!W.isExpanded)),Z.colSpan=W.colSpan,Z.rowSpan=W.rowSpan,J(Z,ce.style);let ee=X("pivot-flex pivot-items-center");if(J(ee,{gap:4}),W.hasChildren){let oe=X("kanuni-pivot-expand-icon","span");oe.textContent=W.isExpanded?"\u2212":"+",oe.setAttribute("aria-hidden","true"),oe.setAttribute("data-col-expand",W.colPath??""),J(oe,{cursor:"pointer",marginRight:4,flexShrink:0}),ee.appendChild(oe);}let Ee=X("select-none","span");He(Ee,ce.text),ee.appendChild(Ee);let Ce=f.rowFields.find(oe=>oe.sortBySummaryField===W.fieldId&&(oe.sortBySummaryPath||"")===(W.colPath||""));if(Ce){let oe=X("pivot-text-primary kanuni-pivot-sort-arrow","span");oe.appendChild(q(Ce.sortOrder==="asc"?"arrow-up":"arrow-down",12)),ee.appendChild(oe);}if(W.fieldId){let oe=X(`kanuni-pivot-head-filter cursor-pointer transition-opacity ${_?"opacity-100 pivot-text-danger":"opacity-0 group-hover:opacity-70"}`,"span");oe.setAttribute("data-filter-field",W.fieldId),oe.appendChild(_?Fe("filter",10):q("filter",10)),ee.appendChild(oe);}Z.appendChild(ee),W.fieldId&&Z.setAttribute("data-header-field",W.fieldId),W.colPath!==void 0&&Z.setAttribute("data-header-col-path",W.colPath),Z.setAttribute("data-header-depth",String(Q)),Z.appendChild(We(`leaf-${re}-${W.colSpan}`,r.data,W.colSpan,"right")),z.appendChild(Z);}R.appendChild(z);}Ue(R,d);}function N(L,P,D,V){let Y=P.flatRow,{rowFields:ae,layout:ve,maxRowDepth:U,virtualRows:de}=f,{locale:T}=n(),d=ve.rowHeaderLayout==="tree",I=d?Y.depth:V,B=Y.pathValues[I],Q=Y.rowSpans[V]>0&&P.dfIndex===0,z=ae[I],j=z&&B!==null&&B!==void 0?pivotgridCore.formatDimensionValue(B,z,"grid",T):B,W=I===Y.depth,G=I<Y.depth,_=W?Y.hasChildren:G,re=W?Y.isExpanded:G,ge=de[D+1],me=!d&&ge&&!ge.isGrandTotal&&ge.flatRow&&!ge.flatRow.isSubtotal&&(ge.flatRow.rowSpans[V]===0||ge.dfIndex>0)&&ge.flatRow.pathValues[V]===B,ce=j!=null?String(j):null;typeof z?.cellTemplate=="function"&&ce!==null&&(ce=z.cellTemplate({value:j,displayValue:j,field:z})??ce);let Z={text:ce,style:{position:"sticky",backgroundColor:"var(--pivot-surface)",zIndex:40,cursor:_?"pointer":"default",fontWeight:j&&I<Y.depth?600:400,verticalAlign:"middle",padding:0,borderBottom:me?"none":"1px solid var(--pivot-border)",height:l()},className:`kanuni-pivot-cell kanuni-pivot-row-header ${_?"kanuni-pivot-row-expandable":""}${e.shared?.focused?.r===D&&e.shared?.focused?.c===V?" kanuni-pivot-cell-focused":""}${$e(e.shared?.selection??null,D,V)?" kanuni-pivot-cell-selected":""}`};e.onCellPrepared?.({area:"row",cell:null,rowIndex:D,columnIndex:V,cellConfig:Z});let ee=X(Z.className,"td");if(ee.id=a(D,V),ee.setAttribute("role","rowheader"),_&&ee.setAttribute("aria-expanded",String(re)),ee.setAttribute("data-r",String(D)),ee.setAttribute("data-c",String(V)),J(ee,Z.style),ee.style.setProperty("inset-inline-start",`var(--row-header-left-${V}, 0px)`),!d&&V>=Y.depth&&V<U-1&&ee.style.setProperty("border-inline-end","none"),!Q&&!d){ee.style.borderBottom="none",ee.appendChild(We(`row-${V}`,r.rowHeader,1,n().rtl?"left":"right")),L.appendChild(ee);return}let Ee=d?Y.depth*20:0,Ce=X("");if(J(Ce,{display:"flex",alignItems:"center",gap:4,padding:"0 8px",height:"100%",position:"relative"}),Ce.style.setProperty("padding-inline-start",`${8+Ee}px`),d&&Y.depth>0){let oe=X("kanuni-pivot-tree-line");J(oe,{position:"absolute",left:Ee,top:-l()/2,width:12,height:l(),borderLeft:"1px dotted var(--pivot-border)",borderBottom:"1px dotted var(--pivot-border)"}),Ce.appendChild(oe);}if(Z.text!==null&&Z.text!==void 0){if(_){let ke=X("kanuni-pivot-expand-icon","span");ke.textContent=re?"\u2212":"+",ke.setAttribute("aria-hidden","true"),J(ke,{flexShrink:0,position:"relative",zIndex:2}),Ce.appendChild(ke);}else {let ke=X("","span");J(ke,{width:14,flexShrink:0}),Ce.appendChild(ke);}let oe=X("truncate","span");He(oe,Z.text),Ce.appendChild(oe);}ee.appendChild(Ce),ee.appendChild(We(`row-${V}`,r.rowHeader,1,n().rtl?"left":"right")),L.appendChild(ee);}function O(L,P,D,V,Y){let{dataFields:ae,leafColHashes:ve,dfsPerLeaf:U,dataColOffset:de,showDataInRows:T,totalDataCols:d}=f,I=d>Ct,B=e.registry?e.registry.getPluginsByType("cellRender"):null;ve.forEach((Q,z)=>{let j=z*U,W=T?[ae[D]]:ae,G=I&&(j+U<=w.start||j>=w.end),_=G?null:_e(f,P,Q.hash,V,Q.isGrandTotal);W.forEach((re,ge)=>{let me=j+ge,ce=de+me,Z=X("kanuni-pivot-cell","td");if(Z.id=a(Y,ce),Z.setAttribute("role","gridcell"),Z.setAttribute("data-r",String(Y)),Z.setAttribute("data-c",String(ce)),G||I&&(me<w.start||me>=w.end)){L.appendChild(Z);return}let ee=_?.values[`${re.id}_display`]??_?.values[re.id],Ee=x(ee,re),Ce=V||Q.isGrandTotal||!!_?.isTotalCell,oe=re.conditionalFormatting?pivotgridCore.resolveConditionalVisual(_?.values[re.id],re,_??null,f.fieldRanges[re.id]):Tn,ke=oe.style,je=Ee;if(typeof re.cellTemplate=="function")je=re.cellTemplate({value:ee,displayValue:Ee,cell:_,field:re})??null;else if(B){for(let Te of B)if(Te.renderCell){let qe=Te.renderCell(ee,Ee,_,re);if(qe!=null){je=qe;break}}}let Oe={text:je,style:{textAlign:re.dataType==="number"?"right":"left",fontWeight:Ce?600:400,backgroundColor:Ce?"var(--pivot-bg)":"transparent",cursor:e.hasCellClick?.()&&_?"pointer":"default",...ke},className:`kanuni-pivot-cell ${Ce?"kanuni-pivot-cell-total":""}${e.shared?.focused?.r===Y&&e.shared?.focused?.c===ce?" kanuni-pivot-cell-focused":""}${$e(e.shared?.selection??null,Y,ce)?" kanuni-pivot-cell-selected":""}`};if(e.onCellPrepared?.({area:"data",cell:_,rowIndex:Y,columnIndex:ce,cellConfig:Oe}),Z.className=Oe.className,J(Z,Oe.style),Z.setAttribute("data-val",typeof ee=="number"?String(ee):""),He(Z,Oe.text),oe.dataBar){let Te=Math.round(oe.dataBar.ratio*100);Z.style.setProperty("background-image",`linear-gradient(to ${n().rtl?"left":"right"}, ${oe.dataBar.color} ${Te}%, transparent ${Te}%)`),Z.style.setProperty("background-repeat","no-repeat");}if(oe.icon){let Te=q(oe.icon,12);Te.style.setProperty("margin-inline-end","4px"),Te.style.setProperty("vertical-align","middle"),Z.insertBefore(Te,Z.firstChild);}L.appendChild(Z);});});}let $=(L,P)=>e.shared?.focused?.r===L&&e.shared?.focused?.c===P?" kanuni-pivot-cell-focused":"";function K(L){let P=L.flatRow;return L.isGrandTotal||!P?{level:1}:P.isSubtotal||!P.hasChildren?{level:P.depth+1}:{level:P.depth+1,expanded:!!P.isExpanded}}function we(L,P){let{t:D}=n(),{maxRowDepth:V,showDataInRows:Y,dataFields:ae,layout:ve}=f,U=X("kanuni-pivot-row","tr");if(U.setAttribute("role","row"),U.setAttribute("aria-rowindex",String(P+1)),J(U,{height:l()}),ve.rowHeaderLayout==="tree"){let T=K(L);U.setAttribute("aria-level",String(T.level)),T.expanded!==void 0&&U.setAttribute("aria-expanded",String(T.expanded));}if(L.isGrandTotal){U.classList.add("kanuni-pivot-grand-total-row");for(let T=0;T<V;T++){let d=T===0,I=X("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+$(P,T),"td");I.id=a(P,T),I.setAttribute("role",d?"rowheader":"presentation"),J(I,{position:"sticky",zIndex:40,fontWeight:700,backgroundColor:"var(--pivot-surface)",paddingLeft:d?8:0,paddingRight:0,borderRight:T===V-1?"1px solid var(--pivot-border)":"none",whiteSpace:d?"nowrap":"normal",overflow:d?"visible":"hidden"}),I.style.setProperty("inset-inline-start",`var(--row-header-left-${T}, 0px)`),d&&(I.textContent=`${D("grandTotal")}${Y?` \u2014 ${ae[L.dfIndex]?.caption??""}`:""}`),U.appendChild(I);}if(Y){let T=X("kanuni-pivot-cell kanuni-pivot-cell-total"+$(P,V),"td");T.id=a(P,V),T.setAttribute("role","gridcell"),J(T,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),T.style.setProperty("inset-inline-start",`var(--row-header-left-${V}, 0px)`),T.textContent=String(ae[L.dfIndex]?.caption??""),U.appendChild(T);}return O(U,"",L.dfIndex,true,P),U}let de=L.flatRow;if(de.isSubtotal){U.classList.add("kanuni-pivot-subtotal-row");let T=`${D("subTotal")}: ${de.pathValues[de.depth]}`;if(ve.rowHeaderLayout==="tree"){let d=X("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+$(P,0),"td");d.id=a(P,0),d.setAttribute("role","rowheader"),J(d,{position:"sticky",zIndex:40,fontWeight:600,backgroundColor:"var(--pivot-surface)",paddingLeft:8+de.depth*20}),d.style.setProperty("inset-inline-start","var(--row-header-left-0, 0px)"),d.textContent=T,U.appendChild(d);}else for(let d=0;d<V;d++){if(d<de.depth){N(U,L,P,d);continue}let I=d===de.depth,B=X("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+$(P,d),"td");B.id=a(P,d),B.setAttribute("role",I?"rowheader":"presentation"),J(B,{position:"sticky",zIndex:40,fontWeight:600,backgroundColor:"var(--pivot-surface)",paddingLeft:I?8:0,paddingRight:0,borderRight:d===V-1?"1px solid var(--pivot-border)":"none",whiteSpace:I?"nowrap":"normal",overflow:I?"visible":"hidden"}),B.style.setProperty("inset-inline-start",`var(--row-header-left-${d}, 0px)`),I&&(B.textContent=T),U.appendChild(B);}if(Y){let d=X("kanuni-pivot-cell kanuni-pivot-cell-total"+$(P,V),"td");d.id=a(P,V),d.setAttribute("role","gridcell"),J(d,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),d.style.setProperty("inset-inline-start",`var(--row-header-left-${V}, 0px)`),d.textContent=String(ae[L.dfIndex]?.caption??""),U.appendChild(d);}return O(U,de.key,L.dfIndex,true,P),U}for(let T=0;T<V;T++)N(U,L,P,T);if(Y){let T=X("kanuni-pivot-cell kanuni-pivot-row-header"+$(P,V),"td");if(T.id=a(P,V),T.setAttribute("role","rowheader"),J(T,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),T.style.setProperty("inset-inline-start",`var(--row-header-left-${V}, 0px)`),L.isDataRow){let d=X("","span");J(d,{color:"var(--pivot-text-muted)",paddingLeft:8}),d.textContent=String(ae[L.dfIndex]?.caption??""),T.appendChild(d);}T.appendChild(We(`row-${V}`,Ze,1,n().rtl?"left":"right")),U.appendChild(T);}return O(U,de.key,L.dfIndex,false,P),U}function ie(){if(u||!f)return;let L=b();if(E(),h=L,y.textContent="",L.start>0){let P=X("","tr");J(P,{height:L.start*l()});let D=X("","td");D.colSpan=f.dataColOffset+Math.max(f.totalDataCols,1),J(D,{padding:0,border:"none"}),P.appendChild(D),y.appendChild(P);}for(let P=L.start;P<L.end;P++)y.appendChild(we(f.virtualRows[P],P));J(C,{height:v()+f.virtualRows.length*l()});}function le(L){if(u)return;let P=n();P.locale!==g&&(g=P.locale,x=ze(P.locale)),i=L.columnWidths??{},f=dt(L,{grandTotal:P.t("grandTotal"),subTotal:P.t("subTotal")}),s.setAttribute("role",f.layout.rowHeaderLayout==="tree"?"treegrid":"grid"),s.setAttribute("aria-rowcount",String(f.virtualRows.length+f.colHeaders.length+(e.chipDeps?1:0))),s.setAttribute("aria-colcount",String(f.dataColOffset+f.totalDataCols)),s.setAttribute("aria-label",P.t("pivotView"));let D=e.shared?.focused;D?s.setAttribute("aria-activedescendant",a(D.r,D.c)):s.removeAttribute("aria-activedescendant");for(let V of p)s.style.removeProperty(V);p.clear(),F();for(let[V,Y]of Object.entries(i)){if(!V.startsWith("leaf-"))continue;let ae=`--col-width-data-${V.slice(5)}`;s.style.setProperty(ae,`${Y}px`),p.add(ae);}A(),H(),h={start:-1,end:-1},ie();}let fe=()=>{if(u||!f)return;let L=b(),P=w.start;E(),(L.start!==h.start||L.end!==h.end||w.start!==P)&&ie();};s.addEventListener("scroll",fe,{passive:true});let ye=()=>{if(u||!f)return;F();let L=b(),P=w.start,D=w.end;E(),(L.start!==h.start||L.end!==h.end||w.start!==P||w.end!==D)&&ie();},se=typeof ResizeObserver<"u"?new ResizeObserver(()=>ye()):null;return se?.observe(s),{getVM:()=>f,getTheadHeight:v,paintStructural:le,paintWindow:ie,refreshWindow:ye,rowHeaderLayout(){let L=[];if(f){for(let P=0;P<f.maxRowDepth;P++)L.push(c(P));f.showDataInRows&&L.push(o());}return {configured:L,viewport:s.clientWidth}},scroller:s,destroy(){u=true,se?.disconnect(),s.removeEventListener("scroll",fe),s.remove();}}}var Pn=0;function kt(){let e=`kp${++Pn}-`;return {lastResizeTime:0,isResizing:false,focused:null,selection:null,cellId:(t,n)=>`${e}pivot-cell-${t}-${n}`}}function Tt(e){let{scroller:t,controller:n,getVM:r,shared:l}=e,a=p=>p?.closest?.("td[data-r][data-c]")??null;function s(p,u){let v=l.focused;l.focused={r:p,c:u},v&&t.querySelector(`td[id="${l.cellId(v.r,v.c)}"]`)?.classList.remove("kanuni-pivot-cell-focused"),t.querySelector(`td[id="${l.cellId(p,u)}"]`)?.classList.add("kanuni-pivot-cell-focused"),t.setAttribute("aria-activedescendant",l.cellId(p,u));}function C(p,u,v){if(!e.onCellClick)return;let c=r();if(!c)return;let o=pt(c,u,v);if(!o)return;let m={event:p,cellType:o.isTotal?"grandTotal":"data",value:o.val,rowPath:o.cell.rowPath,colPath:o.cell.colPath};e.onCellClick(e.resolveCellClick?e.resolveCellClick(m):m);}let k=p=>{let u=p.target,v=u.closest("[data-col-expand]");if(v){n.toggleColExpanded(v.getAttribute("data-col-expand")??"");return}if(u.closest(".kanuni-pivot-resize-handle"))return;let c=u.closest("[data-filter-field]");if(c){e.onFilterClick?.(p.clientX,p.clientY,c.getAttribute("data-filter-field")??"");return}let o=u.closest("th[data-header-field]");if(o){if(Date.now()-l.lastResizeTime<100)return;let F=r();if(!F)return;let A=o.getAttribute("data-header-field")??"",H=o.getAttribute("data-header-col-path")??"",N=F.rowFields.find(O=>O.sortBySummaryField===A&&(O.sortBySummaryPath||"")===H);N&&n.sortField(N.id,N.sortOrder==="asc"?"desc":"asc");return}let m=a(u);if(!m)return;let E=Number(m.getAttribute("data-r")),b=Number(m.getAttribute("data-c")),S=r();if(S){if(t.focus({preventScroll:true}),s(E,b),b<S.dataColOffset){if(Date.now()-l.lastResizeTime<100)return;let F=Xe(S,E,b);F?.hasChildren&&n.toggleExpanded(F.cellHashStr);return}C(p,E,b);}},M=p=>{let u=a(p.target);if(!u)return;let v=Number(u.getAttribute("data-r")),c=Number(u.getAttribute("data-c")),o=r();!o||c<o.dataColOffset||C(p,v,c);},R=p=>{let u=p.target.closest?.("th[data-header-field]");if(u){p.preventDefault(),u.hasAttribute("aria-expanded")?e.onNodeContextMenu?.({x:p.clientX,y:p.clientY,path:u.getAttribute("data-header-col-path")??"",isExpanded:u.getAttribute("aria-expanded")==="true",depth:Number(u.getAttribute("data-header-depth")??0),type:"col"}):e.onHeaderContextMenu&&e.onHeaderContextMenu(p.clientX,p.clientY,u.getAttribute("data-header-field")??"",u.getAttribute("data-header-col-path")??void 0);return}let v=a(p.target);if(!v)return;let c=Number(v.getAttribute("data-r")),o=Number(v.getAttribute("data-c")),m=r();if(m){if(o<m.dataColOffset){let E=Xe(m,c,o);if(E){let{flatRow:b,hasChildren:S,cellHashStr:F,isExpanded:A,depth:H,dIdx:N}=E,O=m.layout.rowHeaderLayout==="tree",$=N>b.depth,K=$?b.hasChildren:S;if(K&&e.onNodeContextMenu){p.preventDefault(),e.onNodeContextMenu({x:p.clientX,y:p.clientY,path:$?O?b.key:pivotgridCore.pathKey(b.pathValues.slice(0,b.depth+1)):F,isExpanded:$?b.isExpanded:A,depth:$?b.depth:H,type:"row"});return}if(K)return}}e.onGlobalContextMenu&&(p.preventDefault(),e.onGlobalContextMenu(p.clientX,p.clientY));}},y=e.keyboardEnabled!==false;function f(){let p=l.focused;l.focused=null,p&&t.querySelector(`td[id="${l.cellId(p.r,p.c)}"]`)?.classList.remove("kanuni-pivot-cell-focused"),t.removeAttribute("aria-activedescendant");}let x=p=>{if(p.target!==t||!l.focused)return;let u=r();if(!u)return;let{r:v,c}=l.focused,o={r:v,c},m=p.ctrlKey||p.metaKey,E=u.dataColOffset+u.totalDataCols,b=e.rowHeight?.()??28,S=e.getTheadHeight?.()??u.colHeaders.length*b,F=Math.max(1,Math.ceil(((t.clientHeight||600)-S)/b));switch(p.key){case "ArrowDown":p.preventDefault(),v=Math.min(u.virtualRows.length-1,v+1);break;case "ArrowUp":p.preventDefault(),v=Math.max(0,v-1);break;case "ArrowRight":p.preventDefault(),c=Math.min(E-1,c+1);break;case "ArrowLeft":p.preventDefault(),c=Math.max(0,c-1);break;case "Home":p.preventDefault(),(p.ctrlKey||p.metaKey)&&(v=0),c=0;break;case "End":p.preventDefault(),(p.ctrlKey||p.metaKey)&&(v=u.virtualRows.length-1),c=E-1;break;case "PageDown":p.preventDefault(),v=Math.min(u.virtualRows.length-1,v+F-1);break;case "PageUp":p.preventDefault(),v=Math.max(0,v-F+1);break;case "Escape":p.preventDefault(),f();return;case " ":case "Enter":{p.preventDefault(),p.key===" "&&l.selectByKey?.(v,c,p.shiftKey,o);let N=t.querySelector(`td[id="${l.cellId(v,c)}"]`);N&&(p.key===" "?N.click():N.dispatchEvent(new MouseEvent("dblclick",{bubbles:true})));return}default:return}let A=S+v*b,H=t.clientHeight||600;A<t.scrollTop+S?(t.scrollTop=A-S,t.dispatchEvent(new Event("scroll"))):A+b>t.scrollTop+H&&(t.scrollTop=A+b-H,t.dispatchEvent(new Event("scroll"))),s(v,c),(p.shiftKey||!m)&&l.selectByKey?.(v,c,p.shiftKey,o),c>=u.dataColOffset&&g(v,c,u.dataColOffset);};function g(p,u,v){let c=t.querySelector(`td[id="${l.cellId(p,u)}"]`)??t.querySelector(`td[data-c="${u}"]`);if(!c)return;let o=t.getBoundingClientRect(),m=getComputedStyle(t).direction==="rtl",E=t.querySelector(`td[data-c="${v-1}"]`)?.getBoundingClientRect(),b=c.getBoundingClientRect(),S=m?o.right-t.clientWidth:o.left,F=m?S:E?E.right:S,A=m&&E?E.left:S+t.clientWidth,H=0;b.left<F?H=b.left-F:b.right>A&&(H=Math.min(b.right-A,b.left-F)),H!==0&&(t.scrollLeft+=H,t.dispatchEvent(new Event("scroll")));}let h=p=>{if(p.button!==0)return;let u=a(p.target);if(!u)return;let v=Number(u.getAttribute("data-r")),c=Number(u.getAttribute("data-c"));l.focused?.r===v&&l.focused.c===c||s(v,c);},w=p=>{let u=r();u&&!l.focused&&p.target===t&&u.virtualRows.length>0&&s(0,0);},i=p=>{p.relatedTarget&&t.contains(p.relatedTarget)||f();};return t.addEventListener("click",k),y&&t.addEventListener("mouseup",h),t.addEventListener("dblclick",M),t.addEventListener("contextmenu",R),y?(t.addEventListener("keydown",x),t.addEventListener("focus",w),t.addEventListener("blur",i)):t.removeAttribute("tabindex"),{destroy(){t.removeEventListener("click",k),t.removeEventListener("mouseup",h),t.removeEventListener("dblclick",M),t.removeEventListener("contextmenu",R),y&&(t.removeEventListener("keydown",x),t.removeEventListener("focus",w),t.removeEventListener("blur",i));}}}function Mt(e){let{host:t,scroller:n,shared:r}=e,l=document.createElement("div");l.className="kanuni-pivot-drag-line",Object.assign(l.style,{position:"absolute",top:"0",bottom:"0",left:"0",width:"2px",backgroundColor:"var(--pivot-primary)",zIndex:"100",display:"none",pointerEvents:"none"}),t.appendChild(l);let a=null,s=1,C=0,k=0,M=[],R={},y=null,f=-1,x=i=>{let p=t.getBoundingClientRect();l.style.display="block",l.style.transform=`translateX(${i-p.left}px)`;},g=i=>{r.isResizing&&x(i.clientX);},h=i=>{if(!r.isResizing||!a)return;l.style.display="none";let p=i.clientX-C,u=e.isRtl()?-p:p;if(a.startsWith("row-")){let v=Math.max(20,k+u);R[a]=y?pivotgridCore.invertRowHeaderWidth(y.configured,f,v,y.viewport):v;}else if(a.startsWith("leaf-")){let v=a.split("-"),c=parseInt(v[1],10),m=Math.max(s*20,k+u)/k;for(let E=0;E<s;E++)R[`leaf-${c+E}`]=Math.max(20,M[E]*m);}r.isResizing=false,r.lastResizeTime=Date.now(),a=null,document.body.style.cursor="",document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",h),e.commit({...R});},w=i=>{let p=i.target.closest?.(".kanuni-pivot-resize-handle");if(!p||(i.preventDefault(),i.stopPropagation(),a=p.getAttribute("data-resize-id"),!a))return;let u=Number(p.getAttribute("data-resize-default")||150);if(s=Number(p.getAttribute("data-resize-span")||1),C=i.clientX,R={...e.getWidths()},a.startsWith("row-"))f=parseInt(a.slice(4),10),y=e.rowHeaderLayout(),k=pivotgridCore.computeRowHeaderWidths(y.configured,y.viewport).widths[f]??R[a]??u;else if(a.startsWith("leaf-")){let v=parseInt(a.split("-")[1],10);M=[],k=0;for(let c=0;c<s;c++){let o=R[`leaf-${v+c}`]||u;M.push(o),k+=o;}}r.isResizing=true,x(i.clientX),document.body.style.cursor="col-resize",document.addEventListener("mousemove",g),document.addEventListener("mouseup",h);};return n.addEventListener("mousedown",w),{destroy(){n.removeEventListener("mousedown",w),r.isResizing&&(r.isResizing=false,document.body.style.cursor=""),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",h),l.remove();}}}function Lt(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Ae(e){let t=Lt("kanuni-pivot-root kanuni-pivot-portal-container");e.classList.contains("kanuni-pivot-striped")&&t.classList.add("kanuni-pivot-striped"),t.setAttribute("style",e.getAttribute("style")??"");for(let r of ["position","inset","z-index","width","height"])t.style.removeProperty(r);let n=e.getAttribute("data-theme");return n&&t.setAttribute("data-theme",n),t.setAttribute("dir",e.getAttribute("dir")??"ltr"),t}function Ie(){let e=document,t=e.fullscreenElement??e.webkitFullscreenElement??null;return t||(document.querySelector(".pivot-is-fullscreen")??document.body)}function Je(e){let t=null,n=null;function r(){n?.(),n=null,t?.remove(),t=null;}function l(a){r(),t=Ae(e);let s=Lt("kanuni-pivot-portal-root");t.appendChild(s),Ie().appendChild(t);let C=a(s),k=t,M=y=>{k.contains(y.target)||r();},R=y=>{y.key==="Escape"&&r();};return document.addEventListener("pointerdown",M,true),document.addEventListener("keydown",R,true),n=()=>{document.removeEventListener("pointerdown",M,true),document.removeEventListener("keydown",R,true),C?.();},s}return {openPopup:l,closePopup:r,isOpen:()=>t!==null,destroy:r}}var St=new Map,Pt=new Map;function Rt(e,t,n,r="(Blanks)"){if(e==null)return r;if(t.format&&typeof e=="number")try{let l=t.format,a=JSON.stringify(l)+"_"+n,s=Pt.get(a);s||(s=new Intl.NumberFormat(n,l),Pt.set(a,s));let C=s.format(e);return l.isCustom&&(l.prefix||l.suffix)?`${l.prefix||""}${C}${l.suffix||""}`:C}catch{return String(e)}return String(e)}var Me=28;function he(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var $n="M11 11l3.5 3.5M12.5 7a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z";function Bn(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("class","kanuni-pivot-popup-search-icon"),e.setAttribute("width","14"),e.setAttribute("height","14"),e.setAttribute("viewBox","0 0 16 16"),e.setAttribute("fill","none");let t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",$n),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","1.5"),t.setAttribute("stroke-linecap","round"),e.appendChild(t),e}function At(e){let{portal:t}=e;function n(r,l,a){let s=e.getField(a);if(!s)return;let{t:C,rtl:k,locale:M}=e.getI18n(),R=true,y=[],f="",x=new Set,g=0,h=220,w=false,i=[];t.openPopup(p=>{let u=he("kanuni-pivot-popup pivot-animate-zoom-in"),v=pivotgridCore.popupViewport(),c=pivotgridCore.placePopup({x:r,y:l},{width:250,height:350},{margin:10,viewport:v});u.setAttribute("role","dialog"),u.setAttribute("aria-label",C("columnFilter")),u.setAttribute("data-datagrid-keyboard-scope","modal"),u.tabIndex=-1,Object.assign(u.style,{left:`${c.left}px`,top:`${c.top}px`,width:"250px",height:`${Math.min(350,c.maxHeight)}px`,minWidth:"200px",minHeight:`${Math.min(250,c.maxHeight)}px`,maxWidth:`${Math.min(600,v.width-20)}px`,maxHeight:`${Math.min(350,c.maxHeight)}px`,resize:"both",direction:k?"rtl":"ltr"});let o=he("kanuni-pivot-popup-header"),m=he("kanuni-pivot-popup-search");m.appendChild(Bn());let E=he("kanuni-pivot-popup-search-input","input");E.type="text",E.placeholder=C("search"),E.setAttribute("aria-controls","pivot-filter-options"),m.appendChild(E),o.appendChild(m);let b=he("kanuni-pivot-popup-actions"),S=he("kanuni-pivot-popup-action-btn kanuni-pivot-popup-action-btn--primary","button");S.textContent=C("selectAll");let F=he("kanuni-pivot-popup-action-btn kanuni-pivot-popup-action-btn--danger","button");F.textContent=C("clearAll"),b.append(S,F),o.appendChild(b);let A=he("kanuni-pivot-popup-list pivot-custom-scrollbar");A.id="pivot-filter-options";let H=he("");H.style.position="relative",A.appendChild(H);let N=he("kanuni-pivot-popup-footer"),O=he("kanuni-pivot-btn kanuni-pivot-btn--outline","button");O.textContent=C("cancel");let $=he("kanuni-pivot-btn kanuni-pivot-btn--primary","button");$.textContent=C("ok");for(let T of [O,$])Object.assign(T.style,{height:"28px",padding:"0 12px",fontSize:"12px"});if(N.append(O,$),e.openCondition&&(s.area==="row"||s.area==="column")){let T=he("kanuni-pivot-btn kanuni-pivot-btn--outline","button");T.type="button",T.setAttribute("data-condition-filter",""),T.title=C("conditionFilter")+"\u2026",T.setAttribute("aria-label",T.title),Object.assign(T.style,{height:"28px",padding:"0 7px",marginInlineEnd:"auto"}),(s.valueFilter||s.labelFilter)&&(T.style.color="var(--pivot-danger)"),T.appendChild(q("settings-2",14)),T.addEventListener("click",()=>{t.closePopup(),e.openCondition(s.id);}),N.prepend(T);}u.append(o,A,N),p.appendChild(u);let K=()=>{if(!f)return y;let T=f.toLowerCase(),d=T.replace(/,/g,"."),I=T.replace(/\./g,","),B=T.replace(/[.,\s]/g,"");return y.filter(Q=>{let z=Q.label.toLowerCase(),j=z.replace(/[.,\s]/g,"");return z.includes(T)||z.includes(d)||z.includes(I)||!!B&&j.includes(B)})},we=()=>x.size===y.length,ie=()=>!f,le=()=>K().length+(ie()?1:0),fe=()=>le()===0?-1:Math.min(g,le()-1),ye=T=>{if(ie()&&T===0)return "select-all";let d=ie()?T-1:T;return `value:${K()[d]?.rawStr}`},se=new Map;function L(){if(w)return;let T=document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains("kanuni-pivot-popup-item");if($.disabled=!R&&y.length>0&&x.size===0,H.textContent="",se.clear(),R){H.style.height="";let j=he("pivot-flex pivot-items-center pivot-justify-center pivot-h-full"),W=he("");Object.assign(W.style,{width:"24px",height:"24px",border:"2px solid var(--pivot-border)",borderTopColor:"var(--pivot-primary)",borderRadius:"50%",animation:"spin 1s linear infinite"}),j.appendChild(W),H.appendChild(j);return}let d=K(),I=le();H.style.height=`${I*Me}px`;let B=Math.max(0,Math.floor(A.scrollTop/Me)-2),Q=Math.min(I,B+Math.ceil(h/Me)+4),z=fe();for(let j=B;j<Q;j++){let W,G,_,re,ge;if(ie()&&j===0)W="select-all",G=`(${C("selectAll")})`,_=we(),re=true,ge=D;else {let ee=d[ie()?j-1:j];if(!ee)continue;W=`value:${ee.rawStr}`,G=ee.label,_=x.has(ee.rawStr),re=false,ge=()=>V(ee.rawStr);}let me=he(`kanuni-pivot-popup-item${_?" kanuni-pivot-popup-item--checked":""}${j===z?" kanuni-pivot-popup-item--active":""}`);me.id=W,me.setAttribute("role","checkbox"),me.setAttribute("aria-checked",String(_)),me.tabIndex=0,Object.assign(me.style,{position:"absolute",top:`${j*Me}px`,insetInlineStart:"0",insetInlineEnd:"0",height:`${Me}px`,fontWeight:re?"600":"400"});let ce=he("kanuni-pivot-checkbox","input");ce.type="checkbox",ce.checked=_,ce.readOnly=true,ce.tabIndex=-1;let Z=he("pivot-truncate","span");Z.textContent=G,me.append(ce,Z),me.addEventListener("click",ge),me.addEventListener("focus",()=>{g=j;}),H.appendChild(me),se.set(j,me);}if(d.length===0){let j=he("");Object.assign(j.style,{padding:"12px",textAlign:"center",fontSize:"12px",color:"var(--pivot-text-muted)"}),j.textContent=C("noItems"),H.appendChild(j);}E.setAttribute("aria-activedescendant",z>=0?ye(z):""),T&&se.get(z)?.focus();}function P(T){x=new Set(x);for(let d of K())T?x.add(d.rawStr):x.delete(d.rawStr);L();}function D(){P(!K().every(T=>x.has(T.rawStr)));}function V(T){x.has(T)?x.delete(T):x.add(T),L();}function Y(){if($.disabled)return;let T=pivotgridCore.headerFilterWrite(y,x,s);T.kind==="clear"?e.clear(s.id):T.kind==="apply"&&e.apply(s.id,T.values,T.filterType),t.closePopup();}function ae(T){g=Math.max(0,Math.min(le()-1,T));let d=g*Me;d<A.scrollTop?A.scrollTop=d:d+Me>A.scrollTop+h&&(A.scrollTop=d+Me-h),L(),se.get(g)?.focus();}let ve=T=>{if(T.key==="ArrowDown"||T.key==="ArrowUp"){if(T.preventDefault(),le()===0)return;ae(fe()+(T.key==="ArrowDown"?1:-1));return}if(T.key==="Home"&&le()>0){T.preventDefault(),ae(0);return}if(T.key==="End"&&le()>0){T.preventDefault(),ae(le()-1);return}if(T.key==="Backspace"&&T.target!==E){T.preventDefault(),E.focus(),f=f.slice(0,-1),E.value=f,g=0,L();return}if(T.key===" "||T.code==="Space"){if(T.target===E)return;T.preventDefault();let d=fe();if(le()>0&&d>=0)if(ie()&&d===0)D();else {let I=K()[ie()?d-1:d];I&&V(I.rawStr);}return}if(T.key==="Enter"){T.preventDefault(),Y();return}if(T.key==="Escape"){T.stopPropagation(),t.closePopup();return}T.key.length===1&&!T.ctrlKey&&!T.metaKey&&!T.altKey&&T.target!==E&&(T.preventDefault(),E.focus(),f+=T.key,E.value=f,g=0,L());},U=T=>{ve(T),T.defaultPrevented&&T.stopPropagation();};document.addEventListener("keydown",U,true),u.addEventListener("click",T=>T.stopPropagation()),E.addEventListener("input",()=>{f=E.value,g=0,L();}),S.addEventListener("click",D),F.addEventListener("click",()=>P(false)),O.addEventListener("click",()=>t.closePopup()),$.addEventListener("click",Y),A.addEventListener("scroll",()=>{St.set(s.id,A.scrollTop),L();});let de=typeof ResizeObserver<"u"?new ResizeObserver(T=>{for(let d of T)h=d.contentRect.height;}):null;return de?.observe(A),L(),E.focus(),i.push(setTimeout(()=>{if(w)return;if(!s.dataField&&!s.isCalculated){y=[],R=false,L();return}let T=pivotgridCore.getFieldDistinctValues(s.id,e.gridId);if(T)y=T.map(I=>({rawStr:I.rawStr==="null"||I.rawStr==="undefined"?C("blanks"):I.rawStr,rawVal:I.rawVal,label:Rt(I.rawVal,s,M,C("blanks"))}));else {let I=new Map,B=e.getData();for(let z=0;z<B.length;z++){let j=pivotgridCore.extractGroupValue(B[z],s);if(j==="(Blank)"&&s.calculateSummaryExpression)continue;let W=j==null?C("blanks"):String(j);I.has(W)||I.set(W,j);}let Q=Array.from(I.values());if(s.dataType==="number")Q.sort((z,j)=>Number(z)-Number(j));else {let z=pivotgridCore.collatorFor().compare;Q.sort((j,W)=>z(String(j),String(W)));}y=Q.map(z=>({rawStr:z==null?C("blanks"):String(z),rawVal:z,label:Rt(z,s,M,C("blanks"))}));}x=pivotgridCore.headerFilterShown(y,s),R=false,L();let d=St.get(s.id)||0;d>0&&i.push(setTimeout(()=>{w||(A.scrollTop=d,L());},50)),i.push(setTimeout(()=>{w||E.focus();},50));},10)),()=>{w=true,document.removeEventListener("keydown",U,true);for(let T of i)clearTimeout(T);de?.disconnect();}});}return {open:n,close:()=>t.closePopup()}}function be(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Ft(e){let t=be("kanuni-pivot-footer pivot-flex pivot-items-center pivot-justify-start");Object.assign(t.style,{padding:"4px 8px",backgroundColor:"color-mix(in srgb, var(--pivot-surface-header) 50%, var(--pivot-surface))",borderTop:"1px solid var(--pivot-border)",gap:"4px",flex:"0 0 auto"}),e.host.appendChild(t);let n=null,r=null,l=null,a=null;function s(){n=null,r?.remove(),r=null,l?.classList.remove("kanuni-pivot-footer-btn--active"),l=null;}let C=u=>{e.onGlobalContextMenu&&(u.preventDefault(),e.onGlobalContextMenu(u.clientX,u.clientY));};t.addEventListener("contextmenu",C);let k=u=>{!n||u.target?.closest?.("[data-footer-menu]")?.getAttribute("data-footer-menu")===n||s();};document.addEventListener("mousedown",k);let M=be("kanuni-pivot-search","input");M.type="search";let R,y=()=>{clearTimeout(R),e.onSearch?.(M.value);};M.addEventListener("input",()=>{clearTimeout(R),R=setTimeout(y,250);}),M.addEventListener("keydown",u=>{u.stopPropagation(),u.key==="Enter"?y():u.key==="Escape"&&(M.value="",y());});function f(u,v,c=false){let o=be(`kanuni-pivot-footer-btn${c?" kanuni-pivot-footer-btn--active":""}`,"button");return o.title=v,o.setAttribute("aria-label",v),o.type="button",o.appendChild(q(u,15)),o}let x=()=>be("kanuni-pivot-footer-divider");function g(u,v,c,o,m,E={}){let b=be("kanuni-pivot-dropdown-item pivot-flex","button");b.type="button",b.style.gap="12px",E.locked&&(b.style.opacity="0.6",b.style.cursor=E.canUpgrade?"pointer":"not-allowed",E.canUpgrade||(b.disabled=true),E.hint&&(b.title=E.hint)),b.appendChild(q(u,16,v));let S=be(""),F=be("pivot-font-medium pivot-flex pivot-items-center");if(F.style.gap="6px",F.appendChild(document.createTextNode(c)),E.locked&&E.badge){let A=be("","span");Object.assign(A.style,{fontSize:"9px",fontWeight:"700",textTransform:"uppercase",letterSpacing:"0.04em",padding:"1px 5px",borderRadius:"9999px",backgroundColor:"color-mix(in srgb, var(--pivot-warning) 18%, transparent)",color:"var(--pivot-warning)"}),A.textContent=E.badge,F.appendChild(A);}if(S.appendChild(F),o!==null){let A=be("pivot-text-xs pivot-text-muted");A.textContent=o,S.appendChild(A);}return b.appendChild(S),m&&b.addEventListener("click",m),b}function h(u,v=false){let c=be("kanuni-pivot-report-section-title");return v&&(c.style.marginTop="4px",c.style.borderTop="1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"),c.textContent=u,c}function w(){let u=be("kanuni-pivot-dropdown-menu pivot-animate-slide-up pivot-custom-scrollbar");return Object.assign(u.style,{bottom:"100%",left:"0",marginBottom:"4px",width:"256px",maxHeight:"384px",overflowY:"auto"}),u}function i(u){n=null,a&&p(a),e.onExport(u);}function p(u){a=u;let{t:v,locale:c}=e.getI18n(),o=e.toolbar??{},m=document.activeElement===M;if(t.textContent="",r=null,l=null,o.showSaveReport!==false&&e.mountReportMenu){let b=be("pivot-relative");e.mountReportMenu(b),b.childNodes.length>0&&(t.appendChild(b),t.appendChild(x()));}if(o.showFieldChooserToggle!==false){let b=f("settings",v("showFieldList"),e.fieldChooserOpen());b.addEventListener("click",e.onToggleFieldChooser),t.appendChild(b);}if(e.onOpenPrefilter){let b=f("filter",v("filterBuilder"));b.addEventListener("click",e.onOpenPrefilter),t.appendChild(b);}if(e.onToggleChart){let b=f("bar-chart",v("chartToggle"));b.addEventListener("click",e.onToggleChart),t.appendChild(b);}if(o.showCalculatedFields!==false&&e.onAddCalculatedField){let b=f("calculator",v("calculatedMeasureDesigner"));b.addEventListener("click",e.onAddCalculatedField),t.appendChild(b);}if(t.appendChild(x()),o.showExpandCollapseAll!==false){let b=f("maximize2",v("expandAll"));b.addEventListener("click",e.onExpandAll);let S=f("minimize2",v("collapseAll"));S.addEventListener("click",e.onCollapseAll),t.append(b,S);}if(o.showRefreshButton!==false&&e.onRefresh){t.appendChild(x());let b=f("refresh-cw",v("refreshData"));b.addEventListener("click",e.onRefresh),t.appendChild(b);}if(o.showFullscreenToggle!==false&&e.onToggleFullscreen){t.appendChild(x());let b=e.isFullscreen(),S=f(b?"shrink":"fullscreen",v(b?"exitFullscreen":"enterFullscreen"),b);b&&Object.assign(S.style,{backgroundColor:"color-mix(in srgb, var(--pivot-primary) 10%, transparent)",color:"var(--pivot-primary)",border:"1px solid color-mix(in srgb, var(--pivot-primary) 30%, transparent)"}),S.addEventListener("click",e.onToggleFullscreen),t.appendChild(S);}if(t.appendChild(x()),o.showExportButton!==false){let b=be("pivot-relative");b.setAttribute("data-footer-menu","export");let S=f("download",v("export"),n==="export");if(S.addEventListener("click",()=>{n=n==="export"?null:"export",p(u);}),b.appendChild(S),n==="export"){let F=w(),A=O=>{let $=!e.advancedExport;return {locked:$,canUpgrade:$&&!!e.upgradeUrl,badge:v("enterpriseBadge"),hint:$&&e.upgradeUrl?v("enterpriseUpgradeHint"):void 0}},H=(O,$)=>{if(!(!e.advancedExport))return ()=>i(O);if(e.upgradeUrl)return ()=>{n=null,p(u),window.open(e.upgradeUrl,"_blank","noopener,noreferrer");}},N=e.registry?.getPluginsByType("exporter")??[];if(N.length>0){F.appendChild(h(v("customExports")));for(let O of N)F.appendChild(g("database","var(--pivot-primary)",`${O.id.replace("exporter-","").toUpperCase()} ${v("export")}`,v("customPlugin"),()=>i(O.id)));F.appendChild(be("kanuni-pivot-dropdown-divider"));}F.appendChild(h(v("excelExport"))),F.appendChild(g("file-spreadsheet","var(--pivot-success)",v("pivotView"),v("preservesGridLayout"),H("excel-pivot"),A())),F.appendChild(g("file-spreadsheet","var(--pivot-success)",v("listView"),v("rawFlatData"),H("excel-list"),A())),F.appendChild(h(v("document"),true)),F.appendChild(g("file-text","var(--pivot-danger)",v("pdfDocument"),v("printReadyLayout"),H("pdf"),A())),F.appendChild(g("printer","var(--pivot-info)",v("print"),v("sendToPrinter"),()=>i("print"))),F.appendChild(g("copy","var(--pivot-primary)",v("copyToClipboard"),v("tabSeparatedValues"),()=>i("clipboard"))),F.appendChild(g("file-json","var(--pivot-success)",v("fullSnapshot"),v("saveSessionState"),()=>i("json-snapshot"))),F.appendChild(h(v("rawDataFormats"),true)),F.appendChild(g("file","var(--pivot-info)","CSV",null,()=>i("csv"))),F.appendChild(g("file-json","var(--pivot-warning)","JSON (Tree)",null,()=>i("json-pivot"))),F.appendChild(g("file-json","var(--pivot-warning)","JSON (List)",null,()=>i("json"))),F.appendChild(g("database","var(--pivot-text-muted)","XML",null,()=>i("xml"))),b.appendChild(F),r=F,l=S;}t.appendChild(b);}if(e.onSearch){let b=v("search").replace(/[.\u2026]+$/,"");M.placeholder=v("search"),M.setAttribute("aria-label",b),t.appendChild(x()),t.appendChild(M),m&&M.focus();}let E=u.selectionStats;if(E){let b=new Intl.NumberFormat(c,{minimumFractionDigits:2,maximumFractionDigits:2}),S=be("kanuni-pivot-selection-stats pivot-text-muted pivot-font-medium pivot-flex pivot-items-center");Object.assign(S.style,{marginLeft:"auto",fontSize:"11px",gap:"8px",paddingRight:"8px",userSelect:"none"});let F=[[v("count"),String(E.count)],[v("sum"),b.format(E.sum)],[v("avg"),b.format(E.avg)],[v("min"),b.format(E.min)],[v("max"),b.format(E.max)]];for(let[A,H]of F){let N=be("","span");N.textContent=`(${A}: ${H})`,S.appendChild(N);}t.appendChild(S);}}return {element:t,paint:p,syncSearch(u){document.activeElement!==M&&(M.value=u);},destroy(){clearTimeout(R),t.removeEventListener("contextmenu",C),document.removeEventListener("mousedown",k),t.remove();}}}var Ht=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];function It(e,t){let n=false,r=()=>{let k=document;return k.fullscreenElement??k.webkitFullscreenElement??k.mozFullScreenElement??k.msFullscreenElement??null},l=()=>n||r()===e;function a(k){if(n=k,e.classList.toggle("pivot-is-fullscreen",k),k)Object.assign(e.style,{position:"fixed",inset:"0",zIndex:"9990",width:"auto",height:"auto"});else for(let M of ["position","inset","z-index","width","height"])e.style.removeProperty(M);}let s=()=>{let k=l();e.classList.toggle("pivot-is-fullscreen",r()===e||n),t(k);};for(let k of Ht)document.addEventListener(k,s);function C(){let k=document;if(l()){if(n){a(false),t(false);return}k.exitFullscreen?k.exitFullscreen():k.webkitExitFullscreen?k.webkitExitFullscreen():k.mozCancelFullScreen?k.mozCancelFullScreen():k.msExitFullscreen?k.msExitFullscreen():t(false);return}let M=e;M.requestFullscreen?M.requestFullscreen().then(()=>{e.classList.add("pivot-is-fullscreen");},()=>{a(true),t(true);}):M.webkitRequestFullscreen?M.webkitRequestFullscreen():M.mozRequestFullScreen?M.mozRequestFullScreen():M.msRequestFullscreen?M.msRequestFullscreen():(a(true),t(true));}return {isFullscreen:l,toggle:C,destroy(){for(let k of Ht)document.removeEventListener(k,s);n&&a(false);}}}var Qe=["row","column","data","filter","chooser"];function Dt(e){let t={activeId:null,targetId:null,targetArea:null,intent:null};function n(o,m,E){t.targetId===o&&t.targetArea===m&&t.intent===E||(t.targetId=o,t.targetArea=m,t.intent=E,e.controller.setDragIntent(o,m,E),e.onIntentChange({...t}));}let r=null,l=null,a=null,s=null;function C(o,m,E){a=Ae(e.gridRoot),a.style.pointerEvents="none",s=document.createElement("div"),s.className="kanuni-pivot-drag-overlay pivot-flex pivot-items-center pivot-gap-2 pivot-font-semibold pivot-truncate",Object.assign(s.style,{position:"fixed",left:"0",top:"0",padding:"8px 12px",backgroundColor:"var(--pivot-surface)",border:"2px solid var(--pivot-primary)",boxShadow:"var(--pivot-shadow-xl)",borderRadius:"var(--pivot-border-radius)",fontSize:"14px",opacity:"0.9",cursor:"grabbing",transformOrigin:"0 0",pointerEvents:"none",zIndex:"100000"});let b=document.createElement("span");b.className="pivot-truncate",Object.assign(b.style,{maxWidth:"150px",color:"var(--pivot-text)"});let S=e.getFields().find(F=>F.id===o);b.textContent=S?.caption||S?.id||"Field",s.appendChild(b),a.appendChild(s),document.body.appendChild(a),k(m,E);}function k(o,m){s&&(s.style.transform=`translate3d(${o+6}px, ${m+6}px, 0) scale(1.05)`);}function M(){a?.remove(),a=null,s=null,l&&(l.el.classList.remove("is-dragging"),l.el.style.removeProperty("pointer-events"),l.el.style.removeProperty("cursor"),document.body.style.removeProperty("user-select"));}function R(o){let m=l;if(M(),l=null,r?.holdTimer&&clearTimeout(r.holdTimer),r=null,document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",i),document.removeEventListener("keydown",p,true),!m)return;let E=t.activeId??m.dropId.replace("chooser-","");t.activeId=null,t.targetId=null,t.targetArea=null,t.intent=null,e.onIntentChange({...t}),o===null?e.controller.resetDrag():e.controller.commitDrag(E,o);}function y(){if(!r)return;let{el:o,dropId:m,pointerId:E,startX:b,startY:S}=r;l={el:o,dropId:m,pointerId:E,startX:b,startY:S},r=null;let F=m.replace("chooser-","");t.activeId=F,e.controller.setDragActive(F),o.classList.add("is-dragging"),o.style.pointerEvents="none",o.style.cursor="grabbing",C(F,b,S),window.getSelection?.()?.removeAllRanges?.(),document.body.style.userSelect="none",e.onIntentChange({...t});}function f(o,m){let E=null,b=null,S=null,F=typeof document.elementFromPoint=="function"?document.elementFromPoint(o,m):null;for(let A of e.roots())for(let H of A.querySelectorAll("[data-drop-id]")){if(l&&H===l.el||F&&!H.contains(F)||H.classList.contains("kanuni-pivot-field-chip")&&H.closest('[data-drop-id="chooser-chooser"]'))continue;let N=H.getBoundingClientRect();if(N.width===0&&N.height===0||o<N.left||o>N.right||m<N.top||m>N.bottom)continue;let O=H.getAttribute("data-drop-id"),$=O.replace("chooser-","");if($.endsWith("-ghost-end"))b={id:O,el:H};else if(Qe.includes($))S=S??{id:O,el:H};else {let K=N.width*N.height;(!E||K<E.size)&&(E={id:O,el:H,size:K});}}return E??b??S}function x(o,m){let E=f(o,m);if(!E)return n(null,null,null),{overId:null};let b=E.id.replace("chooser-",""),S=e.getFields().find(H=>H.id===b),F=Qe.includes(b)||b.endsWith("-ghost-end")?b.replace("-ghost-end",""):S?.area,A=!!(t.activeId&&F&&e.controller.canMoveFieldTo&&!e.controller.canMoveFieldTo(t.activeId,F));if(s?.classList.toggle("is-drop-denied",A),s&&(s.style.borderColor=A?"var(--pivot-danger)":"var(--pivot-primary)"),A)return n(null,null,null),{overId:null};if(Qe.includes(b)||b.endsWith("-ghost-end"))return n(null,F,"append"),{overId:E.id};if(S){let H=S.area==="chooser"?"vertical":"horizontal",N=E.el.getBoundingClientRect(),O=e.controller.calculateDropIntent(o,m,{top:N.top,left:N.left,width:N.width,height:N.height},t.intent,false,H);return n(b,S.area??null,O),{overId:E.id}}return {overId:E.id}}let g=null,h=o=>{if(!(r&&o.pointerId!==r.pointerId)&&!(l&&o.pointerId!==l.pointerId)){if(r){let m=o.clientX-r.startX,E=o.clientY-r.startY,b=Math.hypot(m,E);if(r.isTouch){if(!r.held&&b>8){r.holdTimer&&clearTimeout(r.holdTimer),r=null;return}if(!r.held)return}else if(b<8)return;y();}l&&(o.preventDefault(),k(o.clientX,o.clientY),g=x(o.clientX,o.clientY).overId);}},w=o=>{if(!(r&&o.pointerId!==r.pointerId)&&!(l&&o.pointerId!==l.pointerId)){if(r){r.holdTimer&&clearTimeout(r.holdTimer),r=null,document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",i),document.removeEventListener("keydown",p,true);return}l&&R(x(o.clientX,o.clientY).overId??g);}},i=()=>R(null),p=o=>{o.key==="Escape"&&l&&(o.stopPropagation(),R(null));},u=o=>{if(e.disabled?.()||r||l||o.button!==0&&o.pointerType==="mouse")return;let m=o.target;if(m.closest("button, input, .kanuni-pivot-chip-btn"))return;let E=m.closest(".kanuni-pivot-field-chip[data-drop-id]");if(!E||E.getAttribute("data-drag-scope")==="grip"&&!m.closest("[data-drag-grip]"))return;let b=E.getAttribute("data-drop-id"),S=o.pointerType==="touch";r={el:E,dropId:b,pointerId:o.pointerId,startX:o.clientX,startY:o.clientY,isTouch:S,held:false,holdTimer:S?setTimeout(()=>{r&&(r.held=true,y());},Math.max(0,e.touchDragDelay?.()??200)):null},document.addEventListener("pointermove",h),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",i),document.addEventListener("keydown",p,true);},v=new Set;function c(){for(let o of v)o.isConnected||(o.removeEventListener("pointerdown",u),v.delete(o));for(let o of e.roots())v.has(o)||(v.add(o),o.addEventListener("pointerdown",u));}return c(),{getState:()=>({...t}),refreshRoots:c,rootCount:()=>v.size,destroy(){l&&R(null),r?.holdTimer&&clearTimeout(r.holdTimer),r=null;for(let o of v)o.removeEventListener("pointerdown",u);v.clear(),document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",i),document.removeEventListener("keydown",p,true);}}}function ue(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Ot(e){let{portal:t}=e;function n(y,f,x,g=false){let h=ue(`${g?"kanuni-pivot-dropdown-item-danger":"kanuni-pivot-dropdown-item"} pivot-flex pivot-items-center`,"button");return h.type="button",y&&h.appendChild(q(y,16)),h.appendChild(document.createTextNode(" "+f)),h.addEventListener("click",()=>{t.closePopup(),x();}),h}function r(y,f,x){let g=()=>window.visualViewport?.removeEventListener("resize",h),h=()=>{if(!y.isConnected){g();return}let w=y.offsetWidth,i=y.scrollHeight||y.offsetHeight;if(w===0&&i===0)return;let p=pivotgridCore.placePopup({x:f,y:x},{width:w,height:i});y.style.top=`${p.top}px`,y.style.left=`${p.left}px`,y.style.maxHeight=`${p.maxHeight}px`;};return h(),window.visualViewport?.addEventListener("resize",h),g}let l=null;function a(y,f,x){let g=null,h=null,w=()=>{g?.remove(),g=null,l===w&&(l=null);},i=()=>{if(g)return;l&&l(),l=w,g=ue("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");let c=y.getBoundingClientRect(),o=pivotgridCore.placePopup({x:c.right+4,y:c.top},{width:160,height:0},{altX:c.left-4});if(Object.assign(g.style,{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,minWidth:"160px",zIndex:"10000"}),g.addEventListener("contextmenu",m=>m.preventDefault()),g.addEventListener("mouseenter",()=>{h&&clearTimeout(h);}),g.addEventListener("mouseleave",()=>{h=setTimeout(w,200);}),x(g),f.appendChild(g),g.offsetHeight){let m=pivotgridCore.placePopup({x:c.right+4,y:c.top},{width:g.offsetWidth,height:g.scrollHeight},{altX:c.left-4});Object.assign(g.style,{top:`${m.top}px`,left:`${m.left}px`,maxHeight:`${m.maxHeight}px`,overflowY:"auto"});}},p=0,u=false,v=()=>Date.now()-p<1e3;y.addEventListener("pointerdown",c=>{c.pointerType!=="mouse"&&(p=Date.now());}),y.addEventListener("mouseenter",()=>{h&&clearTimeout(h),!v()&&(g||(u=true),i());}),y.addEventListener("mouseleave",()=>{v()||(h=setTimeout(w,200));}),y.addEventListener("click",c=>{if(c.detail>0&&u&&g){u=false;return}u=false,g?w():i();});}function s(y,f,x){let g=ue("kanuni-pivot-dropdown-item pivot-flex pivot-items-center pivot-justify-between","button");g.type="button";let h=ue("pivot-flex pivot-items-center pivot-gap-2","span");return h.appendChild(q(y,16)),h.appendChild(document.createTextNode(" "+f)),g.appendChild(h),g.appendChild(q(x?"chevron-left":"chevron-right",14)),g}function C(y){y.addEventListener("keydown",f=>{let x=[...y.querySelectorAll("button:not([disabled])")];if(x.length===0)return;let g=x.indexOf(document.activeElement),h=-1;f.key==="ArrowDown"?h=g<0?0:(g+1)%x.length:f.key==="ArrowUp"?h=g<0?x.length-1:(g-1+x.length)%x.length:f.key==="Home"?h=0:f.key==="End"&&(h=x.length-1),!(h<0)&&(f.preventDefault(),x[h].focus());});}function k(y,f,x,g,h){let w=e.getFields().find(c=>c.id===x);if(!w)return;let{t:i,rtl:p}=e.getI18n(),u=e.getFields().filter(c=>c.area==="row").sort((c,o)=>(c.areaIndex||0)-(o.areaIndex||0)),v=g!==void 0&&u.length>0&&w.area==="data";t.openPopup(c=>{let o=ue("kanuni-pivot-dropdown-menu pivot-animate-zoom-in pivot-flex-col");Object.assign(o.style,{position:"fixed",top:`${f}px`,left:`${y}px`,maxHeight:`${Math.max(0,pivotgridCore.popupViewport().height-16)}px`,overflowY:"auto",overflowX:"hidden",width:"220px",zIndex:"9999"}),o.addEventListener("contextmenu",b=>b.preventDefault());let m=ue("kanuni-pivot-report-section-title");if(Object.assign(m.style,{position:"sticky",top:"0",zIndex:"10"}),m.textContent=w.caption??w.id,o.appendChild(m),v){let b=ue("kanuni-pivot-report-section-title");b.style.marginTop="4px",b.textContent=i("sortByThisColumn"),o.appendChild(b);for(let S of u)o.appendChild(n("arrow-down-a-z",i("sortFieldByThisColumn").replace("{0}",S.caption||S.id),()=>e.controller.sortFieldBySummary(S.id,w.id,g)));o.appendChild(ue("kanuni-pivot-divider")),o.appendChild(n("x",i("removeAllSorting"),()=>e.controller.clearAllSorting(),true));}else {o.appendChild(n("arrow-down-a-z",i("sortAsc"),()=>e.controller.sortField(w.id,"asc"))),o.appendChild(n("arrow-up-z-a",i("sortDesc"),()=>e.controller.sortField(w.id,"desc"))),w.sortOrder&&o.appendChild(n("x",i("clearSort"),()=>e.controller.sortField(w.id,void 0),true)),e.openFilter&&w.area!=="data"&&o.appendChild(n("filter",i("filterField"),()=>e.openFilter(w.id,y,f))),e.openCondition&&(w.area==="row"||w.area==="column")&&o.appendChild(n("filter",i("conditionFilter")+"\u2026",()=>e.openCondition(w.id))),o.appendChild(ue("kanuni-pivot-divider"));let b=s("list",i("order"),p);o.appendChild(b),a(b,c,A=>{let H=[["start",i("moveToStart"),"chevrons-left"],["left",i("moveToLeft"),"chevron-left"],["right",i("moveToRight"),"chevron-right"],["end",i("moveToEnd"),"chevrons-right"]];for(let[N,O,$]of H)A.appendChild(n($,O,()=>e.controller.moveField(w.id,N)));});let S=[["row",i("rowArea"),"rows-3"],["column",i("columnArea"),"columns-3"],["data",i("dataArea"),"bar-chart-3"],["filter",i("filterArea"),"filter"]].filter(([A])=>A!==w.area);if(S.length>0){let A=s("move",i("moveToArea"),p);o.appendChild(A),a(A,c,H=>{for(let[N,O,$]of S){let K=n($,O,()=>e.controller.changeFieldArea(w.id,N));e.controller.canMoveFieldTo(w.id,N)||(K.disabled=true),H.appendChild(K);}});}e.openFieldChooser&&o.appendChild(n("list",i("showFieldList"),e.openFieldChooser)),o.appendChild(n("eye-off",i("hide"),()=>e.controller.removeField(w.id)));let F=e.customContextMenuItems?.(w);if(F&&F.length>0){o.appendChild(ue("kanuni-pivot-divider"));for(let A of F){let H=n(null,A.label,A.action);A.icon&&H.insertBefore(A.icon(),H.firstChild),o.appendChild(H);}}o.appendChild(ue("kanuni-pivot-divider")),w.isCalculated&&e.onEditCalculatedField&&o.appendChild(n("calculator",i("editCalculation"),()=>e.onEditCalculatedField(w))),o.appendChild(n("settings",i("fieldSettings"),()=>e.openSettings(w.id)));}c.appendChild(o);let E=r(o,y,f);return h?(C(c),o.querySelector("button")?.focus(),()=>{E(),e.gridRoot?.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${x}"]`)?.focus({preventScroll:true});}):E});}function M(y,f){let{t:x}=e.getI18n();t.openPopup(g=>{let h=ue("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");Object.assign(h.style,{position:"fixed",zIndex:"301",width:"224px",fontSize:"14px",left:`${pivotgridCore.placePopup({x:y,y:f},{width:224,height:120}).left}px`,top:`${pivotgridCore.placePopup({x:y,y:f},{width:224,height:120}).top}px`}),h.addEventListener("contextmenu",u=>u.preventDefault());let w=ue("kanuni-pivot-report-section-title");w.textContent=x("viewOptions"),h.appendChild(w);let i=e.getLayout(),p=(u,v,c)=>{let o=ue("pivot-w-full pivot-flex pivot-items-center pivot-justify-between","button");o.type="button",Object.assign(o.style,{padding:"6px 12px",textAlign:"left"}),o.addEventListener("mouseenter",()=>{o.style.backgroundColor="var(--pivot-surface-hover)";}),o.addEventListener("mouseleave",()=>{o.style.backgroundColor="transparent";});let m=ue("","span");m.textContent=u;let E=ue("pivot-text-xs pivot-text-muted pivot-font-medium","span");return E.textContent=x(v?"show":"hide"),o.append(m,E),o.addEventListener("click",()=>{c(),t.closePopup();}),o};h.appendChild(p(x("filterArea"),i.showFilterArea===false,()=>e.controller.setLayout({showFilterArea:i.showFilterArea===false}))),h.appendChild(p(x("footerArea"),i.showFooter===false,()=>e.controller.setLayout({showFooter:i.showFooter===false}))),g.appendChild(h);});}function R(y){let{t:f}=e.getI18n(),x=()=>{let g=e.getEngineTrees();if(!g)return [];let h=[],w=(i,p)=>{if(i)for(let u of i)p>=y.depth&&h.push(u.key),u.children&&w(u.children,p+1);};return w(y.type==="row"?g.rowTree:g.colTree,0),h};t.openPopup(g=>{let h=ue("");Object.assign(h.style,{position:"fixed",inset:"0",zIndex:"9998"}),h.addEventListener("click",()=>t.closePopup()),h.addEventListener("contextmenu",p=>{p.preventDefault(),t.closePopup();});let w=ue("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");Object.assign(w.style,{position:"fixed",left:`${Math.min(y.x,window.innerWidth-180)}px`,top:`${Math.min(y.y,window.innerHeight-200)}px`,zIndex:"9999",minWidth:"160px"}),w.addEventListener("contextmenu",p=>p.preventDefault());let i=(p,u)=>{let v=ue("kanuni-pivot-dropdown-item pivot-state-hover","button");return v.type="button",Object.assign(v.style,{paddingLeft:"32px",paddingRight:"24px"}),v.textContent=p,v.addEventListener("click",c=>{c.stopPropagation(),t.closePopup(),u();}),v};w.appendChild(i(y.isExpanded?f("collapse"):f("expand"),()=>{y.type==="row"?e.controller.toggleExpanded(y.path):e.controller.toggleColExpanded(y.path);})),w.appendChild(ue("kanuni-pivot-dropdown-divider")),w.appendChild(i(f("expandAll"),()=>{let p=x();y.type==="row"?e.controller.expandPaths(p):e.controller.expandColPaths(p);})),w.appendChild(i(f("collapseAll"),()=>{let p=x();y.type==="row"?e.controller.collapsePaths(p):e.controller.collapseColPaths(p);})),g.append(h,w);});}return {openFieldMenu:k,openGlobalMenu:M,openNodeMenu:R,close:()=>t.closePopup()}}function xe(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var Le=(e,...t)=>{let n=xe("kanuni-pivot-form-group"),r=xe("kanuni-pivot-form-label","label");return r.textContent=e,n.append(r,...t),n},Se=(e,t)=>{let n=xe("kanuni-pivot-select","select");for(let[r,l]of e){let a=document.createElement("option");a.value=r,a.textContent=l,n.appendChild(a);}return n.value=t,n},Ge=(e,t)=>{let n=xe("kanuni-pivot-input","input");return n.type=e,n.value=t,n},Vt=(...e)=>{let t=xe("");Object.assign(t.style,{display:"flex",gap:"8px",marginTop:"6px"});for(let n of e)Object.assign(n.style,{flex:"1 1 0",minWidth:"0"});return t.append(...e),t},Wn=[["equals","opEquals"],["notEquals","opNotEquals"],["contains","opContains"],["notContains","opNotContains"],["startsWith","opStartsWith"],["endsWith","opEndsWith"]],Gn=[[">","opGreater"],[">=","opGreaterOrEqual"],["<","opLess"],["<=","opLessOrEqual"],["=","opEquals"],["!=","opNotEquals"],["between","opBetween"],["notBetween","opNotBetween"]];function zt(e){function t(l,a,s,C){let{t:k}=e.getI18n();e.portal.openPopup(M=>{let R=xe("kanuni-pivot-modal-overlay pivot-animate-fade-in");R.addEventListener("click",()=>e.portal.closePopup());let y=xe("kanuni-pivot-modal pivot-animate-zoom-in");y.style.width="400px",y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",l);let f=xe("kanuni-pivot-modal-header"),x=xe("kanuni-pivot-modal-title","h2");x.textContent=l;let g=xe("kanuni-pivot-modal-close","button");g.type="button",g.setAttribute("aria-label",k("cancel")),g.appendChild(q("x",20)),g.addEventListener("click",()=>e.portal.closePopup()),f.append(x,g);let h=xe("kanuni-pivot-modal-footer"),w=xe("kanuni-pivot-btn kanuni-pivot-btn--outline","button");w.type="button",w.textContent=k("cancel"),w.addEventListener("click",()=>e.portal.closePopup());let i=xe("kanuni-pivot-btn kanuni-pivot-btn--primary","button");i.type="button",i.appendChild(q("check",16)),i.appendChild(document.createTextNode(" "+k("ok"))),i.addEventListener("click",()=>{s()!==false&&e.portal.closePopup();}),h.append(w,i),y.append(f,a,h),M.append(R,y),C.focus();});}function n(l){let a=e.getFields().find(w=>w.id===l);if(!a)return;let{t:s}=e.getI18n(),C=xe("kanuni-pivot-modal-body pivot-custom-scrollbar"),k=Ge("text",a.caption??"");C.appendChild(Le(s("caption"),k));let M=a.area==="data"||a.area==="chooser",R=a.area==="row"||a.area==="column"||a.area==="filter"||a.area==="chooser",y=null,f=null,x=null,g=(...w)=>w.map(i=>[i,s(i)]),h=(...w)=>{let i=a.summaryType;return g(...i&&!w.includes(i)?[i,...w]:w)};M&&a.dataType&&a.dataType!=="number"&&(y=Se(h("count","distinct"),String(a.summaryType||"count")),C.appendChild(Le(s("summaryType"),y))),M&&a.dataType==="number"&&(y=Se(h("sum","count","avg","min","max","distinct"),String(a.summaryType||"sum")),C.appendChild(Le(s("summaryType"),y)),f=Se([["absolute",s("absoluteValue")],...g("percentOfTotal","percentOfColumnTotal","percentOfRowTotal","percentOfParentRowTotal","percentOfParentColumnTotal","runningTotal","difference","percentDifference")],String(a.summaryDisplayMode||"absolute")),C.appendChild(Le(s("displayMode"),f))),R&&a.dataType==="date"&&(x=Se([["",s("none")],...g("year","quarter","month","week","day")],String(a.groupInterval||"")),C.appendChild(Le(s("groupInterval"),x))),t(s("fieldSettings"),C,()=>{e.save({...a,caption:k.value,summaryType:y?.value||a.summaryType,summaryDisplayMode:f?.value??a.summaryDisplayMode,groupInterval:x?x.value||void 0:a.groupInterval});},k);}function r(l){let a=e.getFields(),s=a.find(c=>c.id===l);if(!s)return;let{t:C}=e.getI18n(),k=xe("kanuni-pivot-modal-body pivot-custom-scrollbar"),M=c=>[["",C("none")],...c.map(([o,m])=>[o,C(m)])],R=s.labelFilter,y=Se(M(Wn),R?.operator??"");y.setAttribute("data-condition-label-op",""),y.setAttribute("aria-label",C("caption"));let f=Ge("text",R?.value??"");f.setAttribute("data-condition-label-value",""),f.placeholder=C("builderValuePlaceholder"),f.setAttribute("aria-label",C("builderValuePlaceholder")),k.appendChild(Le(C("caption"),Vt(y,f)));let x=a.filter(c=>c.area==="data").sort((c,o)=>(c.areaIndex||0)-(o.areaIndex||0)),g=s.valueFilter,h=Se(x.map(c=>[c.id,c.caption||c.id]),x.some(c=>c.id===g?.dataField)?g.dataField:x[0]?.id??"");h.setAttribute("data-condition-value-field",""),h.setAttribute("aria-label",C("dataArea"));let w=Se(M(Gn),g?.operator??"");w.setAttribute("data-condition-value-op",""),w.setAttribute("aria-label",C("dataArea"));let i=Ge("number",g?String(g.value):"");i.setAttribute("data-condition-value","");let p=Ge("number",g?.value2!==void 0?String(g.value2):"");p.setAttribute("data-condition-value2","");for(let c of [i,p])c.setAttribute("aria-label",C("builderValuePlaceholder"));x.length>0&&k.appendChild(Le(C("dataArea"),h,Vt(w,i,p)));let u=()=>{f.disabled=y.value==="",i.disabled=w.value==="",p.style.display=w.value==="between"||w.value==="notBetween"?"":"none";};y.addEventListener("change",u),w.addEventListener("change",u),u();let v=c=>(c.setAttribute("aria-invalid","true"),c.focus(),false);t(`${C("conditionFilter")}: ${s.caption||s.id}`,k,()=>{for(let m of [f,i,p])m.removeAttribute("aria-invalid");let c;if(y.value){if(f.value==="")return v(f);c={operator:y.value,value:f.value,...R?.caseSensitive?{caseSensitive:true}:{}};}let o=x.length>0?void 0:g;if(w.value&&x.length>0){let m=p.style.display!=="none",E=i.value===""?NaN:Number(i.value),b=p.value===""?NaN:Number(p.value);if(!Number.isFinite(E))return v(i);if(m&&!Number.isFinite(b))return v(p);o={dataField:h.value,operator:w.value,value:E,...m?{value2:b}:{}};}e.save({...s,labelFilter:c,valueFilter:o});},y);}return {open:n,openCondition:r}}function te(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function qn(e){let t=e.isCalculated?"settings-2":e.dataType==="number"?"hash":e.dataType==="date"?"calendar":e.dataType==="boolean"?"filter":"type";return q(t,12,"var(--pivot-primary)")}function $t(e){let t=null,n=null,r=null,l="",a={x:0,y:0},s={width:700,height:550},C=()=>window.innerWidth<=768,k=["fullscreenchange","webkitfullscreenchange"],M=()=>{if(!t)return;let c=Ie();t.parentElement!==c&&c.appendChild(t);},R=()=>{n&&(y(),C()||(a={x:Math.min(a.x,Math.max(0,window.innerWidth-s.width)),y:Math.min(a.y,Math.max(0,window.innerHeight-s.height))},y()));};function y(){n&&(C()?Object.assign(n.style,{position:"fixed",inset:"0",width:"100%",height:"100%",left:"",top:"",borderRadius:"0",zIndex:"100",transform:"none",padding:"0"}):Object.assign(n.style,{position:"fixed",inset:"",left:`${a.x}px`,top:`${a.y}px`,width:`${s.width}px`,height:`${s.height}px`,maxWidth:"95vw",maxHeight:"95vh",transform:"none",padding:"0",zIndex:"100",boxShadow:"var(--pivot-shadow-lg)",borderRadius:""}));}function f(c,o){let{t:m}=e.getI18n(),E=te("kanuni-pivot-field-chip");E.setAttribute("data-drop-id",`chooser-${c.id}`),E.setAttribute("data-drag-scope","grip"),E.style.position="relative";let b=te("");if(b.setAttribute("data-drag-grip",""),Object.assign(b.style,{color:"var(--pivot-text-muted)",cursor:"grab",flexShrink:"0",opacity:"0.5"}),b.appendChild(q("grip-vertical",14)),E.appendChild(b),o){let O=te("kanuni-pivot-checkbox","input");O.type="checkbox",O.checked=c.area!=="chooser",O.style.flexShrink="0",O.addEventListener("change",()=>{O.checked?e.controller.showFields([c.id]):e.controller.removeField(c.id);}),E.appendChild(O);}E.appendChild(qn(c));let S=te("pivot-truncate","span");Object.assign(S.style,{flex:"1",color:"var(--pivot-text)",textAlign:"left"}),S.textContent=c.caption??c.id;let F=c.area==="data"&&c.summaryType?pivotgridCore.summaryTypeLabel(String(c.summaryType),m):"";if(F){let O=te("","span");Object.assign(O.style,{fontSize:"10px",marginLeft:"4px",backgroundColor:"color-mix(in srgb, var(--pivot-primary) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--pivot-primary) 45%, transparent)",color:"var(--pivot-text)",padding:"0 4px",borderRadius:"4px",fontWeight:"700"}),O.textContent=F,S.appendChild(O);}E.appendChild(S);let A=!!c.filterValues&&c.filterValues.size>0,H=te(`kanuni-pivot-field-chip-actions${A?" is-filtered":""}`);if(c.area!=="data"){let O=te("kanuni-pivot-chip-btn","button");O.type="button",O.title=m("filterField"),A&&Object.assign(O.style,{color:"var(--pivot-danger)",backgroundColor:"color-mix(in srgb, var(--pivot-danger) 10%, transparent)"}),O.appendChild(q("filter",12)),O.addEventListener("click",$=>{$.stopPropagation(),e.onFilterClick($.clientX,$.clientY,c.id);}),H.appendChild(O);}if(c.isCalculated){let O=te("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","button");O.type="button",O.title=m("deletePermanently"),O.appendChild(q("trash",12)),O.addEventListener("click",$=>{$.stopPropagation(),e.controller.deleteField(c.id);}),H.appendChild(O);}let N=te("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","button");return N.type="button",N.title=m("removeFromArea"),N.appendChild(q("x",12)),N.addEventListener("click",O=>{O.stopPropagation(),e.controller.removeField(c.id);}),H.appendChild(N),E.appendChild(H),E}function x(c,o,m,E,b){let S=te("");if(Object.assign(S.style,{height:"100%",display:"flex",flexDirection:"column",transition:"background-color 0.2s"}),m!==null){let H=te("");Object.assign(H.style,{fontSize:"12px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--pivot-text-muted)",backgroundColor:"color-mix(in srgb, var(--pivot-surface-header) 30%, transparent)",padding:"8px 12px",borderBottom:"1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"}),H.textContent=m,S.appendChild(H);}let F=te("pivot-custom-scrollbar");if(F.setAttribute("data-drop-id",`chooser-${c}`),F.setAttribute("data-drop-kind","list"),Object.assign(F.style,{maxHeight:C()?"none":"100%",flex:"1",padding:"8px",minHeight:"80px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"6px",alignItems:o.length===0?"center":"stretch",justifyContent:o.length===0?"center":"flex-start"}),o.length===0){let H=te("");Object.assign(H.style,{fontSize:"12px",color:"color-mix(in srgb, var(--pivot-text-muted) 70%, transparent)",fontStyle:"italic",textAlign:"center",width:"100%"}),H.textContent=E,F.appendChild(H);}for(let H of o)F.appendChild(f(H,b));let A=te("");return A.setAttribute("data-drop-id",`chooser-${c}-ghost-end`),A.setAttribute("data-ghost-populated",o.length>0?"1":"0"),Object.assign(A.style,{width:"100%",minHeight:"24px",transition:"background-color 0.2s",borderRadius:"var(--pivot-border-radius-sm)"}),F.appendChild(A),S.appendChild(F),S}function g(){let c=new Map;return e.getFields().map(o=>{let m=o.caption||o.id||"";if(c.has(m)){let E=c.get(m)+1;return c.set(m,E),{...o,caption:`${m} (${E})`}}return c.set(m,1),o})}function h(){let{locale:c}=e.getI18n(),o=[...g()].sort((E,b)=>(E.caption||"").toLowerCase().localeCompare((b.caption||"").toLowerCase(),c||"en"));if(!l)return o;let m=l.toLowerCase();return o.filter(E=>(E.caption||"").toLowerCase().includes(m))}function w(){let c=h().filter(o=>o.area==="chooser").map(o=>o.id);c.length!==0&&e.controller.showFields(c);}function i(){if(!r)return;let{t:c,locale:o}=e.getI18n(),m=new Map;for(let L of r.querySelectorAll('[data-drop-kind="list"]')){let P=L.getAttribute("data-drop-id");P&&L.scrollTop>0&&m.set(P,L.scrollTop);}let E=g(),b=h(),S=L=>E.filter(P=>P.area===L).sort((P,D)=>(P.areaIndex||0)-(D.areaIndex||0));r.textContent="";let F=C(),A=te(F?"w-full flex flex-col border-b border-border bg-surface":"w-full md:w-[40%] flex flex-col border-b md:border-b-0 md:border-r border-border bg-surface");F&&(A.style.flexShrink="0");let H=te("p-3 border-b border-border/60 bg-surface/80"),N=te("relative"),O=q("search",16);O.setAttribute("class","text-muted-fg opacity-60"),Object.assign(O.style,{position:"absolute",top:"50%",transform:"translateY(-50%)",pointerEvents:"none"}),O.style.setProperty("inset-inline-start","10px");let $=te("w-full bg-surface-hover/50 border-border rounded-md text-[13px] kanuni-pivot-input","input");$.type="text",$.placeholder=c("search"),$.value=l,$.style.setProperty("padding-inline-start","34px"),$.addEventListener("input",()=>{l=$.value,i();let L=r?.querySelector('input[type="text"]');L?.focus(),L?.setSelectionRange(L.value.length,L.value.length);}),N.append(O,$),H.appendChild(N),A.appendChild(H);let K=te(F?"p-2":"flex-1 overflow-hidden p-2"),we=te("");Object.assign(we.style,{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"});let ie=te("text-[11px] font-bold uppercase tracking-wider text-muted-fg/80 mb-2 px-1");ie.textContent=c("allFields");let le=te("kanuni-pivot-popup-action-btn kanuni-pivot-chooser-select-all","button");le.type="button",le.textContent=c("selectAll"),le.style.color="var(--pivot-primary)",le.disabled=b.every(L=>L.area!=="chooser"),le.addEventListener("click",w),we.append(ie,le),K.appendChild(we),K.appendChild(x("chooser",b,null,c("noItems"),true)),A.appendChild(K);let fe=te(F?"w-full p-3 bg-surface-sunken/30":"w-full md:w-[60%] flex-1 overflow-y-auto custom-scrollbar p-3 bg-surface-sunken/30");F&&(fe.style.flexShrink="0");let ye=te(F?"grid grid-cols-1 sm:grid-cols-2 gap-3":"grid grid-cols-1 sm:grid-cols-2 gap-3 h-full auto-rows-fr"),se=[["filter",c("filterArea")],["column",c("columnArea")],["row",c("rowArea")],["data",c("dataArea")]];for(let[L,P]of se){let D=te("border border-border/80 rounded-md shadow-sm bg-surface overflow-hidden flex flex-col transition-colors");F&&(D.style.minHeight="140px"),D.appendChild(x(L,S(L),P,c("dropHere"),false)),ye.appendChild(D);}fe.appendChild(ye),r.append(A,fe);for(let[L,P]of m){let D=r.querySelector(`[data-drop-id="${L}"][data-drop-kind="list"]`);D&&(D.scrollTop=P);}}function p(){if(t)return;let{t:c}=e.getI18n();t=Ae(e.gridRoot);let o=te("fixed inset-0 z-[100] kanuni-pivot-chooser-backdrop overflow-auto pointer-events-auto");o.addEventListener("click",u),n=te("flex flex-col bg-surface shadow-2xl border border-border overflow-hidden rounded-lg kanuni-pivot-field-chooser"),n.addEventListener("click",A=>A.stopPropagation()),C()||(s={width:Math.min(700,window.innerWidth-32),height:Math.min(550,window.innerHeight-32)},a={x:Math.max(0,(window.innerWidth-s.width)/2),y:Math.max(0,(window.innerHeight-s.height)/2)}),y();let m=te("pivot-field-chooser__header flex items-center justify-between p-3 border-b border-border bg-surface-header/90");C()||(m.style.cursor="move");let E=te("text-[15px] font-semibold m-0 flex items-center gap-2 select-none","h3");E.appendChild(q("grip-horizontal",18,"var(--pivot-text-muted)")),E.appendChild(document.createTextNode(c("allFields")));let b=te("btn-icon rounded-full p-1.5 kanuni-pivot-chip-btn","button");b.type="button",b.setAttribute("aria-label",c("cancel")),b.appendChild(q("x",18)),b.addEventListener("pointerdown",A=>A.stopPropagation()),b.addEventListener("click",u),m.append(E,b);let S=null;m.addEventListener("pointerdown",A=>{C()||A.target.closest(".kanuni-pivot-field-chip, button, input")||(S={px:A.clientX,py:A.clientY,x:a.x,y:a.y},m.setPointerCapture?.(A.pointerId));}),m.addEventListener("pointermove",A=>{S&&(a={x:Math.max(0,S.x+A.clientX-S.px),y:Math.max(0,S.y+A.clientY-S.py)},y());});let F=A=>{S=null,m.releasePointerCapture?.(A.pointerId);};if(m.addEventListener("pointerup",F),m.addEventListener("pointercancel",F),r=te(C()?"flex flex-1 flex-col bg-surface-sunken/30":"flex flex-1 overflow-hidden flex-col md:flex-row bg-surface-sunken/30"),C()&&(r.setAttribute("data-chooser-scroll",""),Object.assign(r.style,{minHeight:"0",overflowY:"auto",touchAction:"pan-y",overscrollBehavior:"contain"})),i(),n.append(m,r),!C()){let A=[["n","n-resize",{top:"0",left:"0",right:"0",height:"6px"}],["s","s-resize",{bottom:"0",left:"0",right:"0",height:"6px"}],["w","w-resize",{top:"0",bottom:"0",left:"0",width:"6px"}],["e","e-resize",{top:"0",bottom:"0",right:"0",width:"6px"}],["nw","nw-resize",{top:"0",left:"0",width:"12px",height:"12px"}],["ne","ne-resize",{top:"0",right:"0",width:"12px",height:"12px"}],["sw","sw-resize",{bottom:"0",left:"0",width:"12px",height:"12px"}],["se","se-resize",{bottom:"0",right:"0",width:"12px",height:"12px"}]];for(let[H,N,O]of A){let $=te("kanuni-pivot-chooser-resize");$.setAttribute("data-resize-dir",H),Object.assign($.style,{position:"absolute",zIndex:H.length===2?"51":"50",cursor:N},O);let K=null;$.addEventListener("pointerdown",ie=>{ie.stopPropagation(),K={px:ie.clientX,py:ie.clientY,w:s.width,h:s.height,x:a.x,y:a.y},$.setPointerCapture?.(ie.pointerId);}),$.addEventListener("pointermove",ie=>{if(!K)return;let le=ie.clientX-K.px,fe=ie.clientY-K.py,ye=K.w,se=K.h,L=K.x,P=K.y;H.includes("e")&&(ye=K.w+le),H.includes("s")&&(se=K.h+fe),H.includes("w")&&(ye=K.w-le,ye>=400&&(L=K.x+le)),H.includes("n")&&(se=K.h-fe,se>=400&&(P=K.y+fe)),s={width:Math.max(400,ye),height:Math.max(400,se)},a={x:Math.max(0,L),y:Math.max(0,P)},y();});let we=ie=>{K=null,$.releasePointerCapture?.(ie.pointerId);};$.addEventListener("pointerup",we),$.addEventListener("pointercancel",we),n.appendChild($);}}o.appendChild(n),t.appendChild(o),Ie().appendChild(t),window.addEventListener("resize",R);for(let A of k)document.addEventListener(A,M);e.onOpenChanged?.(true);}function u(){if(t){window.removeEventListener("resize",R);for(let c of k)document.removeEventListener(c,M);t.remove(),t=null,n=null,r=null,l="",e.onOpenChanged?.(false);}}function v(){if(!t)return;let c={...a},o={...s};u(),p(),a=c,s=o,y();}return {open:p,close:u,toggle:()=>t?u():p(),isOpen:()=>t!==null,repaint:i,relocalize:v,getHost:()=>t,destroy:u}}function ne(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Bt(e){let t=false,n=null,r=s=>{t&&n&&!n.contains(s.target)&&(t=false,e.requestRepaint());};document.addEventListener("mousedown",r);function l(s,C){let{t:k}=e.getI18n();e.portal.openPopup(M=>{let R=ne("kanuni-pivot-modal-overlay");R.addEventListener("click",()=>e.portal.closePopup());let y=ne("kanuni-pivot-modal pivot-animate-zoom-in");Object.assign(y.style,{display:"flex",flexDirection:"column",gap:"16px",padding:"24px"});let f=ne("pivot-flex pivot-flex-col");f.style.gap="6px";let x=ne("pivot-flex pivot-items-center pivot-justify-between"),g=ne("kanuni-pivot-modal-title","h3");g.textContent=s;let h=ne("kanuni-pivot-modal-close","button");h.type="button",h.setAttribute("aria-label",k("close")),h.style.padding="6px",h.appendChild(q("x",16)),h.addEventListener("click",()=>e.portal.closePopup()),x.append(g,h);let w=ne("kanuni-pivot-modal-description","p");w.textContent=k("saveReportDescription"),f.append(x,w);let i=ne("pivot-flex pivot-flex-col pivot-gap-4","form"),p=ne("pivot-flex pivot-flex-col pivot-gap-2"),u=ne("kanuni-pivot-form-label","label");u.textContent=k("reportName");let v=ne("kanuni-pivot-input","input");v.type="text",v.placeholder=k("reportNamePlaceholder"),v.required=true,v.value=C,p.append(u,v);let c=ne("pivot-flex pivot-items-center pivot-gap-2"),o=ne("kanuni-pivot-input","input");o.type="checkbox",Object.assign(o.style,{width:"16px",height:"16px"});let m=ne("kanuni-pivot-form-label","label");Object.assign(m.style,{margin:"0",cursor:"pointer"}),m.textContent=k("setAsDefault"),m.addEventListener("click",()=>{o.checked=!o.checked;}),c.append(o,m);let E=ne("kanuni-pivot-modal-footer");Object.assign(E.style,{marginTop:"8px",paddingTop:"16px",borderTop:"1px solid var(--pivot-border)",display:"flex",justifyContent:"flex-end",gap:"8px"});let b=ne("kanuni-pivot-btn kanuni-pivot-btn--outline","button");b.type="button",b.textContent=k("cancel"),b.addEventListener("click",()=>e.portal.closePopup());let S=ne("kanuni-pivot-btn kanuni-pivot-btn--primary","button");S.type="submit",S.disabled=!C.trim(),S.appendChild(q("save",16)),S.appendChild(document.createTextNode(" "+k("save"))),v.addEventListener("input",()=>{S.disabled=!v.value.trim();}),E.append(b,S),i.addEventListener("submit",F=>{F.preventDefault();let A=v.value.trim();A&&(e.controller.saveReport(A,o.checked),e.portal.closePopup());}),i.append(p,c,E),y.append(f,i),M.append(R,y),v.focus();});}function a(s){let{t:C}=e.getI18n();n=s;let k=e.getReports(),M=e.getActiveReportId(),R=k.find(w=>w.id===M),y=ne(`kanuni-pivot-report-btn ${t?"kanuni-pivot-report-btn--open":M?"kanuni-pivot-report-btn--active":"kanuni-pivot-report-btn--default"}`,"button");y.type="button",y.title=C("viewsAndReports"),y.appendChild(q("bookmark",15));let f=ne("pivot-truncate","span");if(f.style.maxWidth="120px",f.textContent=R?R.name:C("views"),y.appendChild(f),y.addEventListener("click",()=>{t=!t,e.requestRepaint();}),s.appendChild(y),!t)return;let x=ne("kanuni-pivot-report-dropdown pivot-animate-slide-up"),g=(w,i=false)=>{let p=ne("kanuni-pivot-report-section-title");return i&&(p.style.marginTop="8px",p.style.borderTop="1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"),p.textContent=w,p},h=(w,i,p,u)=>{let v=ne("kanuni-pivot-report-item","button");v.type="button",v.appendChild(q(w,16,i));let c=ne(""),o=ne("pivot-font-medium");return o.textContent=p,c.appendChild(o),v.appendChild(c),v.addEventListener("click",()=>{t=false,e.requestRepaint(),u();}),v};if(x.appendChild(g(C("actions"))),x.appendChild(h("save","var(--pivot-success)",C("saveNewView"),()=>l(C("saveNewView"),""))),M&&(x.appendChild(h("save-all","var(--pivot-warning)",C("saveChangesOverwrite"),()=>e.controller.updateCurrentReport())),x.appendChild(h("copy","var(--pivot-info)",C("saveAsCopy"),()=>l(C("saveAsView"),`${R?.name??""} (Copy)`)))),k.length>0){x.appendChild(g(C("savedViews"),true));let w=ne("kanuni-pivot-report-list pivot-custom-scrollbar");for(let i of k){let p=ne(`kanuni-pivot-report-list-item${i.id===M?" kanuni-pivot-report-list-item--active":""}`),u=ne("kanuni-pivot-report-list-btn","button");u.type="button",u.appendChild(q(i.id===M?"check":"folder-open",14,i.id===M?"var(--pivot-primary)":"var(--pivot-text-muted)"));let v=ne("pivot-text-sm pivot-truncate","span");v.style.color=i.id===M?"var(--pivot-primary)":"var(--pivot-text)",i.id===M&&v.classList.add("pivot-font-medium"),v.textContent=i.name,u.appendChild(v),i.isDefault&&u.appendChild(Fe("star",12,"var(--pivot-warning)")),u.addEventListener("click",()=>{t=false,e.requestRepaint(),e.controller.loadReport(i.id);}),p.appendChild(u);let c=ne("kanuni-pivot-report-actions");if(!i.isDefault){let m=ne("kanuni-pivot-action-btn kanuni-pivot-action-btn--warning","button");m.type="button",m.title=C("makeDefault"),m.setAttribute("aria-label",m.title),m.appendChild(q("star",14)),m.addEventListener("click",E=>{E.stopPropagation(),e.controller.setDefaultReport(i.id);}),c.appendChild(m);}let o=ne("kanuni-pivot-action-btn kanuni-pivot-action-btn--danger","button");o.type="button",o.title=C("deleteReport"),o.setAttribute("aria-label",o.title),o.appendChild(q("trash",14)),o.addEventListener("click",m=>{m.stopPropagation(),window.confirm(C("deleteReportConfirm").replace("{0}",i.name))&&(e.controller.deleteReport(i.id),i.id===M&&(t=false,e.requestRepaint()));}),c.appendChild(o),p.appendChild(c),w.appendChild(p);}x.appendChild(w);}s.appendChild(x);}return {mount:a,destroy(){document.removeEventListener("mousedown",r);}}}var _n={chartData:[],chartSeries:[]};function et(e,t,n,r){let l=null,a,s,C,k=false;function M(){if(k)return;let f=e.getState();if(!f.engineResult||!f.engineResult.cellMatrix||!n.transformer){r(_n);return}r(n.transformer(f.engineResult,pivotgridCore.shownFields(f.fields),f.expandedPaths,t(),n));}function R(){let f=e.getState(),x=t();f.engineResult===a&&f.expandedPaths===s&&x===C||(a=f.engineResult,s=f.expandedPaths,C=x,l&&clearTimeout(l),l=setTimeout(M,150));}let y=e.subscribe(R);return R(),{refresh:R,stop(){k=true,l&&clearTimeout(l),y();}}}function Pe(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var tt=new Set;function no(){let e="default-pivot-grid";for(let t=2;tt.has(e);t++)e=`default-pivot-grid-${t}`;return tt.add(e),e}function oo(e,t){if(!e||!(e instanceof HTMLElement))throw new Error("[pivotgrid] createPivotGrid needs a container HTMLElement");rt(t);let n=Ve(t.locale,t.dictionary,t.rtl),r=t.gridId||t.stateStoring?.storageKey,l=r||no();!r&&l!=="default-pivot-grid"&&console.warn(`[pivotgrid] multiple grids without gridId on this page \u2014 this one got '${l}'. Give each grid an explicit gridId for stable state persistence.`);let a=Pe("kanuni-pivot-root"+(t.className?" "+t.className:""));a.style.width="100%",a.style.height="100%",it(a,pivotgridCore.pivotSchemeTheme(t.theme,t.palette,t.dark)),a.setAttribute("dir",n.rtl?"rtl":"ltr");let s=Pe("kanuni-pivot-wrapper pivot-flex pivot-flex-col");s.style.width="100%",s.style.height="100%";let C=Pe("pivot-grid pivot-flex-1 pivot-flex pivot-flex-col pivot-relative");C.style.minHeight="0",C.style.overflow="hidden",C.style.backgroundColor="var(--pivot-bg)",C.style.border="1px solid var(--pivot-border)",C.style.borderRadius="var(--pivot-radius-md)",C.style.userSelect="none",t.striped&&a.classList.add("kanuni-pivot-striped");let k=t.density,M=()=>pivotgridCore.pivotDensityClass(k),R=()=>pivotgridCore.pivotRowHeight(k);M()&&a.classList.add(M());let y=Pe("pivot-flex-1 pivot-flex pivot-flex-col pivot-relative");y.style.minHeight="0";let f=Pe("pivot-text-muted pivot-text-sm");f.style.padding="8px",f.style.position="absolute",f.style.inset="0",f.style.display="none",f.style.zIndex="70",f.style.backgroundColor="var(--pivot-bg)",f.setAttribute("data-pivot-status",""),C.appendChild(y),C.appendChild(f),s.appendChild(C),a.appendChild(s);let x=Pe("kanuni-pivot-live");x.setAttribute("role","status"),x.setAttribute("aria-live","polite"),x.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap",a.appendChild(x),e.appendChild(a);let g={gridId:l,data:t.data??[],rowKey:t.rowKey,asyncTransactionWait:t.asyncTransactionWait,loading:t.loading,maxColumns:t.maxColumns,initialFields:t.initialFields??t.fields??[],controlledFields:t.fields,controlledLayout:t.layout,stateStoring:t.stateStoring,workerUrl:t.workerUrl,registry:t.registry,serverSource:t.serverSource,locale:n.locale,enterpriseEdition:t.advancedExport===true,onRefresh:t.onRefresh,onFieldsChange:t.onFieldsChange,onLayoutChange:t.onLayoutChange,onFieldMove:t.onFieldMove,onBeforePivotCalculate:t.onBeforePivotCalculate,onAfterPivotCalculate:t.onAfterPivotCalculate,onExporting:t.onExporting,onLargeExport:t.onLargeExport,onComputingChange:t.onComputingChange,onError:t.onError,onChartStateLoaded:t.onChartStateLoaded},h=new pivotgridCore.PivotController(g),w=pivotgridCore.bindPivotScrollMemory(a,h),i=()=>pivotgridCore.shownFields(h.getState().fields),p=Je(a),u=At({portal:p,getI18n:()=>n,gridId:l,getField:d=>i().find(I=>I.id===d),getData:()=>h.getRawData(),apply:(d,I,B)=>h.applyFilter(d,I,B),clear:d=>h.clearFilter(d),openCondition:d=>v.openCondition(d)}),v=zt({portal:p,getI18n:()=>n,getFields:i,save:d=>h.updateField(d)}),c=Ot({portal:p,gridRoot:a,getI18n:()=>n,getFields:i,getLayout:()=>h.getState().layout,controller:h,getEngineTrees:()=>{let d=h.getState().engineResult;return d?{rowTree:d.rowTree,colTree:d.colTree}:null},openSettings:d=>v.open(d),openCondition:d=>v.openCondition(d),openFilter:(d,I,B)=>{b()||u.open(I,B,d);},openFieldChooser:()=>o.open(),onEditCalculatedField:t.onEditCalculatedField?d=>{b()||t.onEditCalculatedField(d);}:void 0,customContextMenuItems:t.customContextMenuItems}),o=$t({gridRoot:a,getI18n:()=>n,getFields:i,controller:h,onFilterClick:(d,I,B)=>u.open(d,I,B),onOpenChanged:()=>{L||(K.refreshRoots(),se.paint(h.getState()));}}),m=(d,I)=>{t.onGlobalContextMenu?t.onGlobalContextMenu(d,I):c.openGlobalMenu(d,I);},E=kt(),b=()=>t.disabled===true,S,F,A={getI18n:()=>n,onRemove:d=>{b()||h.removeField(d);},onFilterClick:(d,I,B)=>{b()||u.open(d,I,B);},onSort:(d,I)=>{b()||h.sortField(d,I);},onContextMenu:(d,I,B,Q,z)=>{b()||c.openFieldMenu(d,I,B,Q,z);},getFields:i,onMove:(d,I)=>{b()||h.moveField(d,I);},requestFocus:d=>{S=d;let B=document.activeElement?.closest?.("[data-drop-id]")?.getAttribute("data-drop-id");F=B?i().find(Q=>Q.id===B)?.area:void 0;}},H=Et({host:y,getI18n:()=>n,onCellPrepared:t.onCellPrepared,registry:t.registry,shared:E,chipDeps:A,hasCellClick:()=>!!t.onCellClick&&!b(),columnWidthDefaults:pivotgridCore.resolveColumnWidthDefaults(t.defaultColumnWidths),rowHeight:R}),N=mt({...A,host:C,onGlobalContextMenu:m,onToggleCollapsed:()=>{b()||h.setLayout({filterAreaCollapsed:h.getState().layout.filterAreaCollapsed!==true});}});C.insertBefore(N.element,y);let O=Pe("kanuni-pivot-notice");O.setAttribute("role","status"),O.style.display="none",C.insertBefore(O,y);let $=()=>{let d=o.getHost();return d?[a,d]:[a]},K=Dt({gridRoot:a,roots:$,controller:h,getFields:i,onIntentChange:d=>bt($(),d),disabled:b,touchDragDelay:()=>t.touchDragDelay}),we=Tt({scroller:H.scroller,controller:{toggleExpanded:d=>{b()||h.toggleExpanded(d);},toggleColExpanded:d=>{b()||h.toggleColExpanded(d);},sortField:(d,I)=>{b()||h.sortField(d,I);}},getVM:H.getVM,getTheadHeight:H.getTheadHeight,rowHeight:R,shared:E,onCellClick:t.disabled===true?void 0:t.onCellClick,resolveCellClick:d=>h.resolveCellClick(d),onGlobalContextMenu:(d,I)=>{b()||m(d,I);},onFilterClick:(d,I,B)=>{b()||u.open(d,I,B);},onHeaderContextMenu:(d,I,B,Q)=>{b()||c.openFieldMenu(d,I,B,Q);},onNodeContextMenu:d=>{b()||c.openNodeMenu(d);},keyboardEnabled:t.keyboardNavigation?.enabled!==false}),ie=ut({scroller:H.scroller,shared:E,getVM:H.getVM,onStats:d=>h.setSelectionStats(d)}),le=Mt({host:y,scroller:H.scroller,shared:E,isRtl:()=>n.rtl,getWidths:()=>h.getState().columnWidths??{},rowHeaderLayout:()=>H.rowHeaderLayout(),commit:d=>{b()||h.setColumnWidths(d);}}),fe=It(a,()=>{se.paint(h.getState()),H.refreshWindow();}),ye=Bt({portal:p,getI18n:()=>n,controller:h,getReports:()=>h.getState().reports??[],getActiveReportId:()=>h.getState().activeReportId??null,requestRepaint:()=>se.paint(h.getState())}),se=Ft({host:s,getI18n:()=>n,toolbar:t.toolbar,advancedExport:t.advancedExport===true,upgradeUrl:t.upgradeUrl,registry:t.registry,onToggleFieldChooser:()=>o.toggle(),fieldChooserOpen:()=>o.isOpen(),onRefresh:t.onRefresh,onExport:d=>{h.exportData(d,{applyFilters:true}).catch(I=>{let B=I instanceof Error?I:new Error(String(I));B.name!=="AbortError"&&(t.onError?t.onError(B):console.error(B));});},onExpandAll:()=>h.expandAll({allLevels:true}),onCollapseAll:()=>h.collapseAll(),onAddCalculatedField:t.onAddCalculatedField?()=>{b()||t.onAddCalculatedField();}:void 0,onOpenPrefilter:t.onOpenPrefilter?()=>{b()||t.onOpenPrefilter();}:void 0,onToggleChart:t.onToggleChart?()=>{b()||t.onToggleChart();}:void 0,onToggleFullscreen:()=>fe.toggle(),isFullscreen:()=>fe.isFullscreen(),onGlobalContextMenu:m,mountReportMenu:d=>ye.mount(d),onSearch:t.search?d=>h.setSearchText(d):void 0}),L=false,P=false,D=null,V=0;function Y(){L||P||(P=true,queueMicrotask(ae));}function ae(){if(P=false,L)return;let d=h.getState(),I=!D||D.engineResult!==d.engineResult||D.fields!==d.fields||D.layout!==d.layout||D.expandedPaths!==d.expandedPaths||D.expandedColPaths!==d.expandedColPaths||D.columnWidths!==d.columnWidths,B=!D||D.isBuilding!==d.isBuilding||D.buildProgress!==d.buildProgress||D.engineError!==d.engineError||D.engineResult!==d.engineResult||D.noData!==d.noData,Q=!D||D.selectionStats!==d.selectionStats||D.reports!==d.reports||D.activeReportId!==d.activeReportId||D.layout!==d.layout;if(I&&(N.paint(pivotgridCore.shownFields(d.fields).filter(z=>z.area==="filter"),d.layout.showFilterArea!==false,{maxRows:d.layout.filterAreaMaxRows,collapsed:d.layout.filterAreaCollapsed===true}),o.isOpen()&&o.repaint()),I&&d.engineResult&&H.paintStructural(d),S!==void 0&&(((S?a.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${S}"]`):F?a.querySelector(`[data-drop-id="${F}"]`):null)??H.scroller).focus({preventScroll:true}),S=void 0,F=void 0),B&&ve(d),!D||D.engineResult!==d.engineResult){let z=d.engineResult?.columnsTruncated;O.style.display=z?"":"none";let j=new Intl.NumberFormat(n.locale);O.textContent=z?n.t("columnsTruncated").replace("{shown}",j.format(z.shown)).replace("{total}",j.format(z.total)):"";}if(D&&D.searchText!==d.searchText&&se.syncSearch(d.searchText??""),D&&D.fields!==d.fields){let z=pivotgridCore.pivotChangeAnnouncement(D.fields,d.fields,n.t);z&&(x.textContent=pivotgridCore.nextLiveText(x.textContent??"",z));}Q&&(se.element.style.display=d.layout.showFooter===false?"none":"",se.paint(d)),D=d,V++;}function ve(d){if(d.engineError){f.style.display="block",f.textContent=`${n.t("error")}: ${d.engineError.message}`;return}if(d.isBuilding&&!d.engineResult){f.style.display="block",f.textContent=`${n.t("initializing")} ${Math.round(d.buildProgress??0)}%`;return}if(!d.engineResult){f.style.display="block",f.textContent=n.t(d.noData?"emptyData":"loading");return}f.style.display="none",f.textContent="";}let U=t.onChartSync?et(h,()=>n.locale,t.chartIntegrationOptions??{},t.onChartSync):null,de=h.subscribe(Y);ae();let T={controller:h,element:a,setData(d){L||h.setData(d);},applyTransaction(d){return h.applyTransaction(d)},applyTransactionAsync(d,I){h.applyTransactionAsync(d,I);},flushAsyncTransactions(){h.flushAsyncTransactions();},setLoading(d){h.setLoading(d);},undoLayout:()=>pivotgridCore.keepFocusAcross(a,h,()=>h.undoLayout()),redoLayout:()=>pivotgridCore.keepFocusAcross(a,h,()=>h.redoLayout()),canUndoLayout:()=>h.canUndoLayout(),canRedoLayout:()=>h.canRedoLayout(),clearLayoutHistory:()=>h.clearLayoutHistory(),setFields(d){L||h.setFields(d);},setSearchText(d){h.setSearchText(d);},setLocale(d,I,B){L||(n=Ve(d,I??t.dictionary,B??t.rtl),a.setAttribute("dir",n.rtl?"rtl":"ltr"),h.updateOptions({locale:n.locale}),D=null,Y(),o.relocalize(),U?.refresh());},openFieldChooser:()=>o.open(),closeFieldChooser:()=>o.close(),clearAllFilters:()=>h.clearAllFilters(),setDensity(d){L||(M()&&a.classList.remove(M()),k=d,M()&&a.classList.add(M()),D=null,Y());},destroy(){L||(L=true,de(),w(),U?.stop(),o.destroy(),K.destroy(),we.destroy(),ie.destroy(),le.destroy(),N.destroy(),ye.destroy(),se.destroy(),fe.destroy(),p.destroy(),H.destroy(),h.dispose(),a.remove(),r||tt.delete(l));}};return Object.defineProperty(T,"__flushCount",{get:()=>V}),Object.defineProperty(T,"__shared",{get:()=>E}),Object.defineProperty(T,"__dragRootCount",{get:()=>K.rootCount()}),T}
|
|
3
|
-
Object.defineProperty(exports,"PivotController",{enumerable:true,get:function(){return pivotgridCore.PivotController}});Object.defineProperty(exports,"defaultPivotLayout",{enumerable:true,get:function(){return pivotgridCore.defaultPivotLayout}});Object.defineProperty(exports,"getAdvancedExporter",{enumerable:true,get:function(){return pivotgridCore.getAdvancedExporter}});Object.defineProperty(exports,"registerAdvancedExporter",{enumerable:true,get:function(){return pivotgridCore.registerAdvancedExporter}});exports.createChartSync=
|
|
1
|
+
'use strict';var pivotgridCore=require('@kanunilabs/pivotgrid-core');var on={tr:pivotgridCore.tr,en:pivotgridCore.en,ar:pivotgridCore.ar,de:pivotgridCore.de,fr:pivotgridCore.fr,es:pivotgridCore.es,it:pivotgridCore.it,pt:pivotgridCore.pt,ru:pivotgridCore.ru,"zh-CN":pivotgridCore.zhCN,ja:pivotgridCore.ja,ko:pivotgridCore.ko};function Be(e,t,n){let i=e??"en",a={...pivotgridCore.en,...on[i]??{},...t??{}};return {locale:i,rtl:n!==void 0?n:i==="ar",dictionary:a,t:o=>a[o]||o}}var rn={renderCalculatedFieldModal:"render props do not exist here; pass onAddCalculatedField/onEditCalculatedField, or use @kanunilabs/pivotgrid-enterprise which fills the socket",renderPrefilterBuilder:"render props do not exist here; pass onOpenPrefilter, or use @kanunilabs/pivotgrid-enterprise which fills the socket",renderNodeContextMenu:"render props do not exist here; the node menu is built in (Community since #192)",onOpenFullScreenChart:"dead even in React (never fires); use chartIntegrationOptions",children:"this is not a React component",ref:"the object returned by createPivotGrid IS the imperative handle",touchChipTap:"a tap on a field chip sorts it here, as a click does; a long press does not open its menu (B.35)",fieldChooserMode:"the field list here always opens over the pivot; the side panel is React only (B.37)"},rt=new Set;function lt(e){for(let t of Object.keys(e)){let n=rn[t];!n||rt.has(t)||(rt.add(t),console.warn(`[pivotgrid] config key "${t}" is React-only and ignored \u2014 ${n}`));}}var an=[["background","--pivot-bg"],["surface","--pivot-surface"],["surfaceHover","--pivot-surface-hover"],["surfaceHeader","--pivot-surface-header"],[e=>e.headerBackground||e.surfaceHeader,"--pivot-header-bg"],["headerText","--pivot-header-text"],["border","--pivot-border"],["text","--pivot-text"],["textMuted","--pivot-text-muted"],["textHeader","--pivot-text-header"],["primary","--pivot-primary"],["primaryForeground","--pivot-primary-foreground"],["success","--pivot-success"],["danger","--pivot-danger"],["warning","--pivot-warning"],["info","--pivot-info"],["totalBackground","--pivot-total-bg"],["stripeBackground","--pivot-stripe-bg"],["groupBorder","--pivot-group-border"],["iconActive","--pivot-icon-active"]];function st(e,t){for(let[n,i]of an){let a=t?typeof n=="function"?n(t):t[n]:void 0;typeof a=="string"&&a?e.style.setProperty(i,a):e.style.removeProperty(i);}t?.id?e.setAttribute("data-theme",t.id):e.removeAttribute("data-theme");}var Ye=(e,t)=>(e.areaIndex||0)-(t.areaIndex||0);function ut(e,t){let n=pivotgridCore.shownFields(e.fields),i=e.layout,a=n.filter(s=>s.area==="row").sort(Ye),o=n.filter(s=>s.area==="column").sort(Ye),l=n.filter(s=>s.area==="data").sort(Ye),C=e.engineResult,T=e.expandedPaths.has("*"),M=e.expandedColPaths.has("*"),P=i.rowHeaderLayout==="tree"?1:a.length||1,y=i.dataFieldPosition==="rows"&&l.length>1,h=y?1:l.length;if(!C)return {rowFields:a,colFields:o,dataFields:l,colHeaders:[],virtualRows:[],leafColHashes:[],cellLookup:new Map,fieldRanges:{},engineResult:null,layout:i,maxRowDepth:P,showDataInRows:y,dfsPerLeaf:h,totalDataCols:0,dataColOffset:P+(y?1:0)};let[x,m]=i.hideEmptySummaryCells?pivotgridCore.filterEmptySummaryTree(C):[C.rowTree,C.colTree],u=pivotgridCore.buildColumnHeaders(m,l,i,e.expandedColPaths,M,t,o.length),w=i.rowHeaderLayout==="tree"?pivotgridCore.flattenRowTreeTree(x,e.expandedPaths,T,a.length||1,i.showRowTotals??true,i.totalsPosition??"bottom",i.showTotalsForSingleValues!==false):pivotgridCore.flattenRowTreeTabular(x,e.expandedPaths,T,P,i.showRowTotals??true,i.totalsPosition??"bottom",i.showTotalsForSingleValues!==false),r=[];for(let s of w)if(y&&!s.isSubtotal&&!s.hasChildren)for(let E=0;E<l.length;E++)r.push({flatRow:s,dfIndex:E,isDataRow:true,isGrandTotal:false});else r.push({flatRow:s,dfIndex:0,isDataRow:false,isGrandTotal:false});if(pivotgridCore.grandTotalShown(i,"row",x))if(y)for(let s=0;s<l.length;s++)r.push({flatRow:null,dfIndex:s,isDataRow:true,isGrandTotal:true});else r.push({flatRow:null,dfIndex:0,isDataRow:false,isGrandTotal:true});let c=pivotgridCore.columnSlotOptions(i),p=[];for(let s of pivotgridCore.getVisibleColSlots(m,e.expandedColPaths,M,c))p.push({hash:s.node.key,isGrandTotal:!!s.node.isTotal,isSubtotal:s.isSubtotal});(pivotgridCore.grandTotalShown(i,"column",m)||p.length===0)&&p.push({hash:"",isGrandTotal:true});let b=new Map,d=C.cellMatrix.keys;for(let s=0;s<d.length;s++)b.set(d[s],s);let v=l.some(pivotgridCore.fieldNeedsRange)?pivotgridCore.computeFieldRanges(C,l):{};return {rowFields:a,colFields:o,dataFields:l,colHeaders:u,virtualRows:r,leafColHashes:p,cellLookup:b,fieldRanges:v,engineResult:C,layout:i,maxRowDepth:P,showDataInRows:y,dfsPerLeaf:h,totalDataCols:p.length*h,dataColOffset:P+(y?1:0)}}function Ue(e,t,n,i,a){let o=e.engineResult,l=o.rowIndexMap[t]??-1,C=o.columnIndexMap[n]??-1;if(l===-1||C===-1)return null;let T=e.cellLookup.get(l*pivotgridCore.MAX_C+C);if(T===void 0)return null;let M=e.dataFields.length,P=o.cellMatrix.sums,y=o.cellMatrix.displaySums,h={};for(let x=0;x<M;x++)h[e.dataFields[x].id]=P[T*M+x],y&&(h[`${e.dataFields[x].id}_display`]=y[T*M+x]);return {values:h,rowPath:pivotgridCore.pathParts(t),colPath:pivotgridCore.pathParts(n),isTotalCell:l===0||C===0||i||a}}function ht(e,t,n){if(!e.engineResult||n<e.dataColOffset)return null;let i=n-e.dataColOffset,a=Math.floor(i/e.dfsPerLeaf),o=i%e.dfsPerLeaf;if(a>=e.leafColHashes.length)return null;let l=e.virtualRows[t];if(!l)return null;let C=l.isGrandTotal?"":l.flatRow?.key;if(C===void 0)return null;let T=e.leafColHashes[a]?.hash;if(T===void 0)return null;let M=e.engineResult.rowIndexMap[C],P=e.engineResult.columnIndexMap[T];if(M===void 0||P===void 0)return null;let y=e.cellLookup.get(M*pivotgridCore.MAX_C+P);if(y===void 0)return null;let h=e.showDataInRows?l.dfIndex:o,m=e.engineResult.cellMatrix.sums[y*e.dataFields.length+h];return typeof m=="number"?m:null}function Ze(e,t,n){let i=e.virtualRows[t];if(!i||i.isGrandTotal||!i.flatRow)return null;let a=i.flatRow,o=e.layout.rowHeaderLayout==="tree",l=n,C=o?a.depth:l,T=C===a.depth,M=C<a.depth,P=T?a.hasChildren:M,y=T?a.isExpanded:M,h=o?a.key:pivotgridCore.pathKey(a.pathValues.slice(0,l+1));return {hasChildren:P,isExpanded:y,cellHashStr:h,depth:C,dIdx:l,flatRow:a}}function ft(e,t,n){if(n<e.dataColOffset||!e.engineResult)return null;let i=n-e.dataColOffset,a=Math.floor(i/e.dfsPerLeaf),o=i%e.dfsPerLeaf;if(a>=e.leafColHashes.length)return null;let l=e.virtualRows[t];if(!l)return null;let C=l.isGrandTotal?"":l.flatRow?.key;if(C===void 0)return null;let T=e.leafColHashes[a],M=Ue(e,C,T.hash,!!l.flatRow?.isSubtotal,T.isGrandTotal);if(!M)return null;let P=e.showDataInRows?l.dfIndex:o,y=e.dataFields[P],h=M.values[`${y?.id}_display`]??M.values[y?.id],x=!!l.flatRow?.isSubtotal||T.isGrandTotal||M.isTotalCell;return {cell:{isTotalCell:M.isTotalCell,rowPath:M.rowPath,colPath:M.colPath,values:M.values},val:h,isTotal:x}}function Ne(e){let t=new Map;return (n,i)=>{if(n==null||Number.isNaN(n))return "";if(i.format&&typeof n=="number"){if(typeof i.format=="function")return i.format(n);try{let a=i.format,o=t.get(a);o||(o=new Intl.NumberFormat(e,a),t.set(a,o));let l=o.format(n);return a.isCustom&&(a.prefix||a.suffix)?`${a.prefix||""}${l}${a.suffix||""}`:l}catch{return String(n)}}return typeof n=="number"&&pivotgridCore.percentModeText(n,i,e)||String(n)}}var Fe=null;function We(e,t,n){if(!e)return false;let i=Math.min(e.startR,e.endR),a=Math.max(e.startR,e.endR),o=Math.min(e.startC,e.endC),l=Math.max(e.startC,e.endC);return t>=i&&t<=a&&n>=o&&n<=l}function vt(e){let{scroller:t,shared:n}=e,i={},a="",o=null,l=false;function C(){for(let x of t.querySelectorAll("td[data-r][data-c]")){let m=Number(x.getAttribute("data-r")),u=Number(x.getAttribute("data-c"));x.classList.toggle("kanuni-pivot-cell-selected",We(n.selection,m,u));}}function T(){let x=n.selection;if(e.onStats){if(!x||x.mode!=="data"){o&&(clearTimeout(o),o=null),l&&(l=false,e.onStats(null));return}o&&clearTimeout(o),o=setTimeout(()=>{o=null;let m=n.selection;if(!m||m.mode!=="data")return;let u=Math.min(m.startR,m.endR),w=Math.max(m.startR,m.endR),r=Math.min(m.startC,m.endC),c=Math.max(m.startC,m.endC),p=0,b=0,d=1/0,v=-1/0,s=e.getVM();if(s){for(let E=u;E<=w;E++)for(let f=r;f<=c;f++){let L=ht(s,E,f);L===null||isNaN(L)||(p+=L,b++,L<d&&(d=L),L>v&&(v=L));}l=b>0,e.onStats(b>0?{sum:p,count:b,avg:p/b,min:d,max:v}:null);}},10);}}n.selectByKey=(x,m,u,w)=>{let r=e.getVM();if(!r)return;let c=m<r.dataColOffset?"row":"data",p=n.selection;if(Fe=i,a="",u&&p&&p.mode===c){if(p.endR===x&&p.endC===m&&!p.isSelecting)return;n.selection={...p,endR:x,endC:m,isSelecting:false};}else if(u){let d=(w.c<r.dataColOffset?"row":"data")===c?w:{r:x,c:m};n.selection={startR:d.r,startC:d.c,endR:x,endC:m,isSelecting:false,mode:c};}else {if(p&&p.mode===c&&!p.isSelecting&&p.startR===x&&p.startC===m&&p.endR===x&&p.endC===m)return;n.selection={startR:x,startC:m,endR:x,endC:m,isSelecting:false,mode:c};}C(),T();};let M=x=>{if(x.button!==0||n.isResizing||x.target.closest?.(".kanuni-pivot-resize-handle"))return;let m=x.target.closest?.("td[data-r][data-c]");if(!m)return;let u=e.getVM();if(!u)return;let w=Number(m.getAttribute("data-r")),r=Number(m.getAttribute("data-c")),c=r<u.dataColOffset?"row":"data";Fe=i,a="",n.selection={startR:w,startC:r,endR:w,endC:r,isSelecting:true,mode:c},C(),T();},P=x=>{let m=n.selection;if(!m||!m.isSelecting)return;let u=x.target.closest?.("td[data-r][data-c]");if(!u)return;let w=Number(u.getAttribute("data-r")),r=Number(u.getAttribute("data-c")),c=`${w},${r}`;if(c===a)return;a=c;let p=e.getVM();!p||(r<p.dataColOffset?"row":"data")!==m.mode||w===m.endR&&r===m.endC||(m.endR=w,m.endC=r,C(),T());},y=()=>{n.selection&&(n.selection.isSelecting=false);},h=x=>{if(!(x.ctrlKey||x.metaKey)||x.key!=="c"||Fe!==null&&Fe!==i)return;let m=n.selection;if(!m)return;let u=Math.min(m.startR,m.endR),w=Math.max(m.startR,m.endR),r=Math.min(m.startC,m.endC),c=Math.max(m.startC,m.endC),p="";for(let b=u;b<=w;b++){let d=[];for(let v=r;v<=c;v++){let s=t.querySelector(`[data-r="${b}"][data-c="${v}"]`);d.push(s?(s.innerText??s.textContent??"").trim().replace(/\n/g," "):"");}p+=d.join(" ")+`
|
|
2
|
+
`;}p&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(p).catch(()=>{});};return t.addEventListener("mousedown",M),t.addEventListener("mouseover",P),document.addEventListener("mouseup",y),document.addEventListener("keydown",h),{destroy(){t.removeEventListener("mousedown",M),t.removeEventListener("mouseover",P),document.removeEventListener("mouseup",y),document.removeEventListener("keydown",h),o&&clearTimeout(o),Fe===i&&(Fe=null),n.selectByKey=void 0;}}}var mt={settings:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]],"settings-2":[["path",{d:"M14 17H5"}],["path",{d:"M19 7h-9"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]],download:[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]],"refresh-cw":[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]],maximize2:[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]],minimize2:[["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]],fullscreen:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1"}]],shrink:[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3"}]],"file-spreadsheet":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 13h2"}],["path",{d:"M14 13h2"}],["path",{d:"M8 17h2"}],["path",{d:"M14 17h2"}]],"file-text":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]],"file-json":[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"}]],file:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]],database:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}],["path",{d:"M3 12A9 3 0 0 0 21 12"}]],calculator:[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18"}],["path",{d:"M16 10h.01"}],["path",{d:"M12 10h.01"}],["path",{d:"M8 10h.01"}],["path",{d:"M12 14h.01"}],["path",{d:"M8 14h.01"}],["path",{d:"M12 18h.01"}],["path",{d:"M8 18h.01"}]],filter:[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"}]],"bar-chart":[["path",{d:"M5 21v-6"}],["path",{d:"M12 21V9"}],["path",{d:"M19 21V3"}]],"bar-chart-3":[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M18 17V9"}],["path",{d:"M13 17V5"}],["path",{d:"M8 17v-3"}]],"line-chart":[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"m19 9-5 5-4-4-3 3"}]],"area-chart":[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"}]],"pie-chart":[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83"}]],"scatter-chart":[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}]],"dot-plot":[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]],"bubble-chart":[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"12",r:"1"}]],"donut-chart":[["path",{d:"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3"}],["circle",{cx:"12",cy:"12",r:"3"}]],"waterfall-chart":[["path",{d:"M13 17V9"}],["path",{d:"M18 17v-3"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M8 17V5"}]],"funnel-chart":[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"}]],"treemap-chart":[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1"}]],"heatmap-chart":[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M3 15h18"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]],"range-chart":[["path",{d:"M9 5v4"}],["rect",{width:"4",height:"6",x:"7",y:"9",rx:"1"}],["path",{d:"M9 15v2"}],["path",{d:"M17 3v2"}],["rect",{width:"4",height:"8",x:"15",y:"5",rx:"1"}],["path",{d:"M17 13v3"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}]],"sunburst-chart":[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M12 2v2"}],["path",{d:"M12 20v2"}],["path",{d:"m4.93 4.93 1.41 1.41"}],["path",{d:"m17.66 17.66 1.41 1.41"}],["path",{d:"M2 12h2"}],["path",{d:"M20 12h2"}],["path",{d:"m6.34 17.66-1.41 1.41"}],["path",{d:"m19.07 4.93-1.41 1.41"}]],"histogram-chart":[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1"}]],radar:[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34"}],["path",{d:"M4 6h.01"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67"}],["path",{d:"M12 18h.01"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67"}],["circle",{cx:"12",cy:"12",r:"2"}],["path",{d:"m13.41 10.59 5.66-5.66"}]],printer:[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1"}]],copy:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]],save:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7"}]],"save-all":[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z"}]],bookmark:[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z"}]],"folder-open":[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]],check:[["path",{d:"M20 6 9 17l-5-5"}]],"check-circle":[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}],["path",{d:"m9 11 3 3L22 4"}]],star:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"}]],trash:[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]],x:[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]],search:[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]],"grip-vertical":[["circle",{cx:"9",cy:"12",r:"1"}],["circle",{cx:"9",cy:"5",r:"1"}],["circle",{cx:"9",cy:"19",r:"1"}],["circle",{cx:"15",cy:"12",r:"1"}],["circle",{cx:"15",cy:"5",r:"1"}],["circle",{cx:"15",cy:"19",r:"1"}]],"grip-horizontal":[["circle",{cx:"12",cy:"9",r:"1"}],["circle",{cx:"19",cy:"9",r:"1"}],["circle",{cx:"5",cy:"9",r:"1"}],["circle",{cx:"12",cy:"15",r:"1"}],["circle",{cx:"19",cy:"15",r:"1"}],["circle",{cx:"5",cy:"15",r:"1"}]],"chevron-down":[["path",{d:"m6 9 6 6 6-6"}]],"chevron-left":[["path",{d:"m15 18-6-6 6-6"}]],"chevron-right":[["path",{d:"m9 18 6-6-6-6"}]],"chevrons-left":[["path",{d:"m11 17-5-5 5-5"}],["path",{d:"m18 17-5-5 5-5"}]],"chevrons-right":[["path",{d:"m6 17 5-5-5-5"}],["path",{d:"m13 17 5-5-5-5"}]],"arrow-up":[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]],"arrow-down":[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]],"arrow-down-a-z":[["path",{d:"m3 16 4 4 4-4"}],["path",{d:"M7 20V4"}],["path",{d:"M20 8h-5"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10"}],["path",{d:"M15 14h5l-5 6h5"}]],"arrow-up-z-a":[["path",{d:"m3 8 4-4 4 4"}],["path",{d:"M7 4v16"}],["path",{d:"M15 4h5l-5 6h5"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20"}],["path",{d:"M20 18h-5"}]],"eye-off":[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]],list:[["path",{d:"M3 5h.01"}],["path",{d:"M3 12h.01"}],["path",{d:"M3 19h.01"}],["path",{d:"M8 5h13"}],["path",{d:"M8 12h13"}],["path",{d:"M8 19h13"}]],columns3:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M9 3v18"}],["path",{d:"M15 3v18"}]],hash:[["line",{x1:"4",x2:"20",y1:"9",y2:"9"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21"}]],calendar:[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}]],type:[["path",{d:"M12 4v16"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}],["path",{d:"M9 20h6"}]],plus:[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]],"alert-circle":[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]],move:[["path",{d:"M12 2v20"}],["path",{d:"m15 19-3 3-3-3"}],["path",{d:"m19 9 3 3-3 3"}],["path",{d:"M2 12h20"}],["path",{d:"m5 9-3 3 3 3"}],["path",{d:"m9 5 3-3 3 3"}]]};var gt="http://www.w3.org/2000/svg";function X(e,t=15,n){let i=document.createElementNS(gt,"svg");i.setAttribute("width",String(t)),i.setAttribute("height",String(t)),i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),i.setAttribute("stroke-linejoin","round"),i.setAttribute("aria-hidden","true"),i.setAttribute("focusable","false"),n&&(i.style.color=n);for(let[a,o]of mt[e]??[]){let l=document.createElementNS(gt,a);for(let[C,T]of Object.entries(o))l.setAttribute(C,String(T));i.appendChild(l);}return i}function De(e,t=15,n){let i=X(e,t,n);return i.setAttribute("fill","currentColor"),i}function ue(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Je(e){let t=document.activeElement;return !t||!e.contains(t)?null:t.closest(".kanuni-pivot-field-chip")?.getAttribute("data-drop-id")??null}function Qe(e,t){if(!t)return;let n=e.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${t}"]`);n&&n!==document.activeElement&&n.focus({preventScroll:true});}function wn(e,t,n){let i=e.filter(a=>a.area===t);return t==="filter"?bt(i,n):i.sort((a,o)=>(a.areaIndex||0)-(o.areaIndex||0))}var En={row:"rowArea",column:"columnArea",data:"dataArea",filter:"filterArea"};function Ge(e,t){let{t:n,locale:i,rtl:a}=t.getI18n(),o=ue("kanuni-pivot-field-chip");o.setAttribute("data-drop-id",e.id),o.setAttribute("data-touch-hold",""),o.style.position="relative",o.style.cursor="pointer",o.setAttribute("role","button"),o.tabIndex=0;let l=t.getFields?wn(t.getFields(),e.area,i):[e],C=Math.max(0,l.findIndex(r=>r.id===e.id)),T=n(En[e.area??""]??"rowArea");o.setAttribute("aria-label",n("fieldChipLabel").replace("{0}",e.caption||e.id).replace("{1}",T).replace("{2}",String(C+1)).replace("{3}",String(l.length))),o.setAttribute("aria-keyshortcuts","Control+ArrowLeft Control+ArrowRight Control+Home Control+End Delete Alt+ArrowDown Shift+F10"),o.setAttribute("aria-description",n("fieldChipKeys"));let M=()=>{if(!t.onSort)return;let r=e.sortOrder==="asc"?"desc":e.sortOrder==="desc"?void 0:"asc";t.onSort(e.id,r);},P=r=>{if(!r)return;(o.closest(".kanuni-pivot-root")??document.body).querySelector(`.kanuni-pivot-field-chip[data-drop-id="${r}"]`)?.focus({preventScroll:true});};o.addEventListener("keydown",r=>{let c=r.ctrlKey||r.metaKey,p=a?"ArrowRight":"ArrowLeft",b=a?"ArrowLeft":"ArrowRight",d=!!t.onMove&&e.area!=="filter",v=true;if(r.key==="Enter"||r.key===" ")M();else if(c&&d&&(r.key===p||r.key==="ArrowUp"))C>0&&t.onMove(e.id,"left");else if(c&&d&&(r.key===b||r.key==="ArrowDown"))C<l.length-1&&t.onMove(e.id,"right");else if(c&&d&&r.key==="Home")C>0&&t.onMove(e.id,"start");else if(c&&d&&r.key==="End")C<l.length-1&&t.onMove(e.id,"end");else if(!c&&(r.key===p||r.key===b)){let s=r.key===p?-1:1;P(l[C+s]?.id);}else if(r.key==="Delete"||r.key==="Backspace"){let s=l[C+1]??l[C-1];t.requestFocus?.(s?.id??null),t.onRemove(e.id);}else if(r.altKey&&r.key==="ArrowDown"){let s=o.getBoundingClientRect();t.onFilterClick(a?s.right:s.left,s.bottom,e.id);}else if(r.key==="F10"&&r.shiftKey||r.key==="ContextMenu"){if(!t.onContextMenu)return;let s=o.getBoundingClientRect();t.onContextMenu(a?s.right:s.left,s.bottom,e.id,void 0,true);}else v=false;v&&(r.preventDefault(),r.stopPropagation());});let y=ue("pivot-truncate","span");Object.assign(y.style,{maxWidth:"var(--pivot-chip-max-width, 120px)",userSelect:"none"}),y.title=e.caption||e.id,y.textContent=e.caption||e.id,o.appendChild(y),e.sortOrder==="asc"&&o.appendChild(X("arrow-up",12,"var(--pivot-primary)")),e.sortOrder==="desc"&&o.appendChild(X("arrow-down",12,"var(--pivot-primary)"));let h=e.area==="data"&&e.summaryType?pivotgridCore.summaryTypeLabel(String(e.summaryType),n):"";if(h){let r=ue("kanuni-pivot-chip-badge","span");Object.assign(r.style,{fontSize:"10px",backgroundColor:"color-mix(in srgb, var(--pivot-primary) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--pivot-primary) 45%, transparent)",color:"var(--pivot-text)",padding:"0 4px",borderRadius:"4px",fontWeight:"700"}),r.textContent=h,o.appendChild(r);}let x=!!e.filterValues&&e.filterValues.size>0||!!e.valueFilter||!!e.labelFilter,m=ue(`kanuni-pivot-field-chip-actions${x?" is-filtered":""}`);m.setAttribute("aria-hidden","true");let u=ue("kanuni-pivot-chip-btn","span");u.title=n("filterField"),u.style.color=x?"var(--pivot-danger)":"inherit",u.appendChild(X("filter",12)),u.addEventListener("pointerdown",r=>r.stopPropagation()),u.addEventListener("click",r=>{r.stopPropagation(),t.onFilterClick(r.clientX,r.clientY,e.id);});let w=ue("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger kanuni-pivot-chip-remove","span");if(w.title=n("removeField"),w.appendChild(X("x",12)),w.addEventListener("pointerdown",r=>r.stopPropagation()),w.addEventListener("click",r=>{r.stopPropagation(),t.onRemove(e.id);}),m.append(u,w),o.appendChild(m),t.onContextMenu){o.setAttribute("data-chip-menu","");let r=ue(`kanuni-pivot-chip-more${x?" is-filtered":""}`,"span");if(r.setAttribute("aria-hidden","true"),r.addEventListener("pointerdown",c=>c.stopPropagation()),r.addEventListener("click",c=>{c.stopPropagation();let p=r.getBoundingClientRect();t.onContextMenu(a?p.right:p.left,p.bottom,e.id,void 0);}),o.appendChild(r),x){let c=X("filter",10);c.classList.add("kanuni-pivot-chip-filtered-mark"),c.setAttribute("aria-hidden","true"),o.appendChild(c);}}return o.addEventListener("click",r=>{r.stopPropagation(),M();}),o.addEventListener("contextmenu",r=>{if(r.stopPropagation(),t.onContextMenu){r.preventDefault();let c=o.getBoundingClientRect(),p=Number.isFinite(r.clientX)?r.clientX:a?c.right:c.left,b=Number.isFinite(r.clientY)?r.clientY:c.bottom;t.onContextMenu(p,b,e.id,void 0);}}),o}function je(e,t,n,i,a){let{t:o}=a.getI18n(),l=ue("kanuni-pivot-area-dropzone");l.setAttribute("data-drop-id",e),l.tabIndex=-1;let C=ue("kanuni-pivot-area-header");C.appendChild(X(n,13)),C.appendChild(document.createTextNode(t)),l.appendChild(C);let T=ue("kanuni-pivot-area-content");if(i.length===0){let P=ue("pivot-text-xs pivot-text-muted","span");Object.assign(P.style,{fontStyle:"italic",padding:"0 8px"}),P.textContent=o("dropHere"),T.appendChild(P);}for(let P of i)T.appendChild(Ge(P,a));let M=ue("kanuni-pivot-ghost-end");return M.setAttribute("data-drop-id",`${e}-ghost-end`),M.setAttribute("data-ghost-populated",i.length>0?"1":"0"),Object.assign(M.style,{flex:"1",minWidth:"40px",minHeight:"24px",borderRadius:"var(--pivot-border-radius-sm)",transition:"background-color 0.2s"}),T.appendChild(M),l.appendChild(T),l}function bt(e,t){let n=new Map;return e.map(a=>{let o=a.caption||a.id||"";if(n.has(o)){let l=n.get(o)+1;return n.set(o,l),{...a,caption:`${o} (${l})`}}return n.set(o,1),a}).sort((a,o)=>(a.caption||"").toLowerCase().localeCompare((o.caption||"").toLowerCase(),t||"en"))}function yt(e){let t=ue("kanuni-pivot-filter-strip pivot-flex pivot-flex-col");Object.assign(t.style,{padding:"8px",borderBottom:"1px solid var(--pivot-border)",backgroundColor:"color-mix(in srgb, var(--pivot-surface-header) 30%, transparent)",flex:"0 0 auto"});let n=a=>{e.onGlobalContextMenu&&(a.target.closest(".kanuni-pivot-field-chip")||(a.preventDefault(),e.onGlobalContextMenu(a.clientX,a.clientY)));};t.addEventListener("contextmenu",n),e.host.appendChild(t);function i(a,o,l){let{t:C}=e.getI18n(),T=a.querySelector(".kanuni-pivot-area-header"),M=a.querySelector(".kanuni-pivot-area-content"),P=l.collapsed===true;if(P&&a.setAttribute("data-collapsed",""),T&&P){let x=pivotgridCore.countFilteredFields(o);if(x>0){let m=ue("kanuni-pivot-area-filtered-count","span");m.textContent=C("filteredFieldCount").replace("{0}",String(x)),T.appendChild(m);}}if(T&&e.onToggleCollapsed&&o.length>0){let x=ue("kanuni-pivot-area-collapse","button");x.type="button";let m=C(P?"expandFilterArea":"collapseFilterArea");x.setAttribute("aria-expanded",String(!P)),x.setAttribute("aria-label",m),x.title=m;let u=X("chevron-down",14);P||(u.style.transform="rotate(180deg)"),x.appendChild(u),x.addEventListener("click",w=>{w.stopPropagation(),e.onToggleCollapsed();}),T.appendChild(x);}let y=pivotgridCore.filterAreaRows({filterAreaMaxRows:l.maxRows,filterAreaCollapsed:P,filterAreaCollapsedRows:l.collapsedRows});if(!M||y===null)return;if(y===0){M.style.display="none";return}let h=M.querySelector(".kanuni-pivot-field-chip");M.style.maxHeight=`${pivotgridCore.filterAreaMaxHeight(y,h?.offsetHeight||28)}px`,M.style.overflowY=P?"hidden":"auto";}return {element:t,paint(a,o,l={}){t.style.display=o?"":"none";let C=Je(t);if(t.textContent="",!o)return;let T=ue("pivot-flex");T.style.width="100%";let{t:M,locale:P}=e.getI18n(),y=je("filter",M("filterArea"),"filter",bt(a,P),e);T.appendChild(y),t.appendChild(T),i(y,a,l),Qe(t,C);},destroy(){t.removeEventListener("contextmenu",n),t.remove();}}}var xt="kanuni-pivot-drop-indicator";function kn(e){let t=ue(xt);Object.assign(t.style,{position:"absolute",zIndex:"100",pointerEvents:"none",top:"-4px",bottom:"-4px",width:"0"}),t.style.setProperty(e==="before"?"inset-inline-start":"inset-inline-end","-4px");let n=ue("");Object.assign(n.style,{position:"absolute",top:"0",width:"0",height:"0",borderTop:"5px solid var(--pivot-primary)"}),n.style.setProperty("inset-inline-start","-4px"),n.style.setProperty("border-inline-start","4px solid transparent"),n.style.setProperty("border-inline-end","4px solid transparent");let i=ue("");Object.assign(i.style,{position:"absolute",bottom:"0",width:"0",height:"0",borderBottom:"5px solid var(--pivot-primary)"}),i.style.setProperty("inset-inline-start","-4px"),i.style.setProperty("border-inline-start","4px solid transparent"),i.style.setProperty("border-inline-end","4px solid transparent");let a=ue("");return Object.assign(a.style,{position:"absolute",top:"0",bottom:"0",width:"2px",backgroundColor:"var(--pivot-primary)"}),a.style.setProperty("inset-inline-start","-1px"),t.append(n,i,a),t}function Ct(e,t){for(let n of e){for(let i of n.querySelectorAll(`.${xt}`))i.remove();for(let i of n.querySelectorAll('[data-drop-id$="-ghost-end"]'))i.style.backgroundColor="transparent",i.style.boxShadow="none",i.textContent="";for(let i of n.querySelectorAll(".pivot-area-strip--over"))i.classList.remove("pivot-area-strip--over");for(let i of n.querySelectorAll('[data-drop-kind="list"]'))i.style.backgroundColor="transparent",i.style.boxShadow="none";}if(t.intent==="before"||t.intent==="after"){if(!t.targetId)return;for(let n of e){let i=n.querySelector(`[data-drop-id="${t.targetId}"]`)??n.querySelector(`[data-drop-id="chooser-${t.targetId}"]`);if(i){i.appendChild(kn(t.intent));return}}}else if(t.intent==="append"&&t.targetArea)for(let n of e){let i=n.querySelector(`[data-drop-id="${t.targetArea}-ghost-end"]`)??n.querySelector(`[data-drop-id="chooser-${t.targetArea}-ghost-end"]`);if(i&&(i.style.backgroundColor="color-mix(in srgb, var(--pivot-primary) 10%, transparent)",i.style.boxShadow="inset 0 0 0 1px color-mix(in srgb, var(--pivot-primary) 50%, transparent)",i.getAttribute("data-ghost-populated")==="1")){let l=ue("");Object.assign(l.style,{width:"4px",height:"100%",backgroundColor:"var(--pivot-primary)",borderRadius:"2px",marginLeft:"4px"}),i.appendChild(l);}n.querySelector(`[data-drop-id="${t.targetArea}"]`)?.classList.add("pivot-area-strip--over");let o=n.querySelector(`[data-drop-id="chooser-${t.targetArea}"][data-drop-kind="list"]`);o&&(o.style.backgroundColor="color-mix(in srgb, var(--pivot-primary) 5%, transparent)",o.style.boxShadow="inset 0 0 0 1px color-mix(in srgb, var(--pivot-primary) 50%, transparent)");}}var Pn={style:{}},Rn=28,Et=5,An=10,kt=40,Tt=8,et=100;function Z(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function te(e,t){for(let[n,i]of Object.entries(t)){if(i==null)continue;let a=n.replace(/[A-Z]/g,o=>"-"+o.toLowerCase());e.style.setProperty(a,typeof i=="number"&&i!==0&&!/z-?index|font-?weight|opacity/i.test(n)?`${i}px`:String(i));}}function qe(e,t,n,i){let a=Z("kanuni-pivot-resize-handle");return a.setAttribute("data-resize-id",e),a.setAttribute("data-resize-default",String(t)),n>1&&a.setAttribute("data-resize-span",String(n)),a.style.setProperty(i,"-3px"),a}function Oe(e,t){e.textContent="",t!=null&&(typeof t=="string"||typeof t=="number"?e.textContent=String(t):e.appendChild(t));}function ke(e,t){e.classList.add("kanuni-pivot-rh-sticky"),e.style.setProperty("inset-inline-start",t);}function Mt(e){let{host:t,getI18n:n}=e,i=e.columnWidthDefaults??pivotgridCore.resolveColumnWidthDefaults(),a=e.rowHeight??(()=>Rn),o=e.shared?.cellId??((R,k)=>`pivot-cell-${R}-${k}`),l=Z("datagrid-table-wrapper custom-scrollbar pivot-right-pane");te(l,{overflow:"auto",flex:"1 1 auto",minHeight:0,position:"relative",outline:"none"}),l.tabIndex=0,l.setAttribute("role","grid");let C=Z("");te(C,{width:"max-content",position:"relative",minWidth:"100%"});let T=Z("kanuni-pivot-table","table");T.setAttribute("role","presentation"),te(T,{borderCollapse:"separate",borderSpacing:0,width:0,minWidth:"100%",tableLayout:"fixed"});let M=document.createElement("colgroup"),P=Z("","thead");P.setAttribute("role","rowgroup"),te(P,{position:"sticky",top:0,zIndex:50,backgroundColor:"var(--pivot-surface-header)"});let y=Z("","tbody");y.setAttribute("role","rowgroup"),T.append(M,P,y),C.appendChild(T),l.appendChild(C),t.appendChild(l);let h=null,x=Ne(n().locale),m=n().locale,u={start:-1,end:-1},w={start:0,end:Number.MAX_SAFE_INTEGER},r={},c=new Set,p=false,b=()=>h?Math.max(h.colHeaders.length,1)*a()+(e.chipDeps?42:0):0,d=R=>r[`row-${R}`]??i.rowHeader,v=()=>r[`row-${h.maxRowDepth}`]??et,s=R=>r[`leaf-${R}`]??i.data;function E(){if(!h||h.totalDataCols<=kt){w={start:0,end:Number.MAX_SAFE_INTEGER};return}let R=Math.abs(l.scrollLeft),k=L().total,Q=R-k,B=0,Y=0;for(;B<h.totalDataCols&&Y+s(B)<=Q;)Y+=s(B),B++;B=Math.max(0,B-Tt);let pe=l.clientWidth||0,fe=B,ee=0;for(;fe<h.totalDataCols&&ee<=pe;)ee+=s(fe),fe++;w={start:B,end:Math.min(h.totalDataCols,fe+Tt)};}function f(){if(!h)return {start:0,end:0};let R=Math.max(0,l.scrollTop-b()),k=Math.max(0,Math.floor(R/a())-Et),Q=Math.ceil((l.clientHeight||600)/a())+An;return {start:k,end:Math.min(h.virtualRows.length,k+Q+Et)}}function L(){let R=[];for(let k=0;k<h.maxRowDepth;k++)R.push(d(k));return h.showDataInRows&&R.push(v()),pivotgridCore.computeRowHeaderWidths(R,A(R.length)?0:l.clientWidth)}function A(R){let k=h.layout.rowHeaderOverflow;return k==="scroll"||pivotgridCore.rowHeadersUnpinned(R,l.clientWidth,k)}function S(){l.classList.toggle("kanuni-pivot-rowheaders-scroll",A(h.maxRowDepth+(h.showDataInRows?1:0)));let{widths:R,total:k}=L(),Q=0;for(let B=0;B<R.length;B++)l.style.setProperty(`--row-header-left-${B}`,`${Q}px`),l.style.setProperty(`--col-width-row-${B}`,`${R[B]}px`),c.add(`--col-width-row-${B}`),Q+=R[B];l.style.setProperty("--row-header-total-width",`${k}px`);}function H(){M.textContent="";for(let R=0;R<h.maxRowDepth;R++){let k=document.createElement("col");k.style.width=`var(--col-width-row-${R}, ${i.rowHeader}px)`,M.appendChild(k);}if(h.showDataInRows){let R=document.createElement("col");R.style.width=`var(--col-width-row-${h.maxRowDepth}, ${et}px)`,M.appendChild(R);}for(let R=0;R<Math.max(h.totalDataCols,1);R++){let k=document.createElement("col");k.style.width=`var(--col-width-data-${R}, ${i.data}px)`,M.appendChild(k);}}function W(){let{colHeaders:R,rowFields:k,colFields:Q,dataFields:B,maxRowDepth:Y,showDataInRows:pe,layout:fe,dataColOffset:ee}=h,{t:F,locale:z}=n(),V=Je(P);P.textContent="";let g=Math.max(R.length,1),D=e.chipDeps;if(D){let O=Z("","tr");O.setAttribute("role","row"),te(O,{height:42});let $=Z("","th");$.setAttribute("role","columnheader"),$.colSpan=Math.max(ee,1),te($,{position:"sticky",zIndex:61,borderBottom:"1px solid var(--pivot-border)",borderInlineEnd:"1px solid var(--pivot-border)",padding:0,verticalAlign:"top",minWidth:50,backgroundColor:"var(--pivot-surface-header)"}),$.style.setProperty("inset-inline-start","0px"),$.appendChild(je("data",F("dataArea"),"bar-chart-3",B,D)),O.appendChild($);let _=Z("","th");_.setAttribute("role","columnheader"),_.colSpan=Math.max(h.totalDataCols,1),te(_,{borderBottom:"1px solid var(--pivot-border)",padding:0,verticalAlign:"top",zIndex:1,backgroundColor:"var(--pivot-surface-header)"});let j=Z("");te(j,{position:"sticky",width:"max-content",maxWidth:"100%"}),j.style.setProperty("inset-inline-start","var(--row-header-total-width, 0px)"),j.appendChild(je("column",F("columnArea"),"columns3",Q,D)),_.appendChild(j),O.appendChild(_),P.appendChild(O);}for(let O=0;O<g;O++){let $=Z("","tr");if($.setAttribute("role","row"),te($,{height:a()}),O===0){let j=G=>({position:"sticky",top:0,zIndex:60,backgroundColor:"var(--pivot-surface-header)",borderBottom:"1px solid var(--pivot-border)",borderInlineEnd:G?"1px solid var(--pivot-border)":"none",verticalAlign:"bottom",padding:"4px 8px",color:"var(--pivot-text-header)"});if(k.length===0){let G=Z("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");G.setAttribute("data-drop-id","row"),G.setAttribute("data-row-header-idx","0"),G.rowSpan=g,G.colSpan=Math.max(ee,1),te(G,{...j(true),padding:"8px",color:"color-mix(in srgb, var(--pivot-text-header, var(--pivot-text)) 70%, transparent)"}),ke(G,"var(--row-header-left-0, 0px)"),G.textContent=F("dropHere"),$.appendChild(G);}else if(fe.rowHeaderLayout==="tree"){let G=Z("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");if(G.setAttribute("data-row-header-idx","0"),G.rowSpan=g,te(G,j(!pe)),ke(G,"var(--row-header-left-0, 0px)"),D){let U=Z("");te(U,{display:"flex",flexWrap:"wrap",gap:4});for(let re of k)U.appendChild(Ge(re,D));G.appendChild(U);}else Oe(G,k.map(U=>U.caption).join(", "));$.appendChild(G);}else for(let G=0;G<Y;G++){let U=Z("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");U.setAttribute("data-row-header-idx",String(G)),U.rowSpan=g,te(U,j(G===Y-1&&!pe)),ke(U,`var(--row-header-left-${G}, 0px)`);let re=k[G];re&&D?U.appendChild(Ge(re,D)):Oe(U,re?.caption??""),$.appendChild(U);}if(pe&&k.length>0){let G=Z("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");G.setAttribute("data-row-header-idx",String(Y)),G.rowSpan=g,te(G,j(true)),ke(G,`var(--row-header-left-${Y}, 0px)`);let U=Z("");te(U,{fontSize:10,fontWeight:600,textTransform:"uppercase",textAlign:"center",color:"color-mix(in srgb, var(--pivot-text-header, var(--pivot-text)) 80%, transparent)"}),U.style.letterSpacing="0.05em",U.textContent=F("dataArea"),G.appendChild(U),$.appendChild(G);}}let _=R[O]??[];for(let j of _){let G=j.fieldId?Q.find(ie=>ie.id===j.fieldId):void 0,U=!!G?.filterValues&&G.filterValues.size>0,re=j.leafStart,de=G&&!j.isTotal?pivotgridCore.formatDimensionValue(j.caption,G,"grid",z):j.caption,me={text:typeof G?.cellTemplate=="function"?G.cellTemplate({value:j.caption,displayValue:de,field:G})??null:String(de??""),style:{textAlign:"left",fontWeight:j.isTotal?600:500,borderBottom:"1px solid var(--pivot-border)",borderRight:"1px solid var(--pivot-border)",color:"var(--pivot-text-header, inherit)",backgroundColor:"var(--pivot-surface-header)",cursor:G?"pointer":"context-menu",position:"relative",zIndex:1,padding:"4px 6px"},className:`kanuni-pivot-header-cell group ${j.isTotal?"kanuni-pivot-header-total":""}`};e.onCellPrepared?.({area:"column",cell:null,rowIndex:O,columnIndex:re,cellConfig:me});let J=Z(me.className,"th");J.setAttribute("role","columnheader"),j.hasChildren&&J.setAttribute("aria-expanded",String(!!j.isExpanded)),J.colSpan=j.colSpan,J.rowSpan=j.rowSpan,te(J,me.style);let le=Z("pivot-flex pivot-items-center");if(te(le,{gap:4}),j.hasChildren){let ie=Z("kanuni-pivot-expand-icon","span");ie.textContent=j.isExpanded?"\u2212":"+",ie.setAttribute("aria-hidden","true"),ie.setAttribute("data-col-expand",j.colPath??""),te(ie,{cursor:"pointer",marginRight:4,flexShrink:0}),le.appendChild(ie);}let Te=Z("select-none","span");Oe(Te,me.text),le.appendChild(Te);let we=h.rowFields.find(ie=>ie.sortBySummaryField===j.fieldId&&(ie.sortBySummaryPath||"")===(j.colPath||""));if(we){let ie=Z("pivot-text-primary kanuni-pivot-sort-arrow","span");ie.appendChild(X(we.sortOrder==="asc"?"arrow-up":"arrow-down",12)),le.appendChild(ie);}if(j.fieldId){let ie=Z(`kanuni-pivot-head-filter cursor-pointer transition-opacity ${U?"opacity-100 pivot-text-danger":"opacity-0 group-hover:opacity-70"}`,"span");ie.setAttribute("data-filter-field",j.fieldId),ie.appendChild(U?De("filter",10):X("filter",10)),le.appendChild(ie);}J.appendChild(le),j.fieldId&&J.setAttribute("data-header-field",j.fieldId),j.colPath!==void 0&&J.setAttribute("data-header-col-path",j.colPath),J.setAttribute("data-header-depth",String(O)),J.appendChild(qe(`leaf-${re}-${j.colSpan}`,i.data,j.colSpan,"right")),$.appendChild(J);}P.appendChild($);}Qe(P,V);}function I(R,k,Q,B){let Y=k.flatRow,{rowFields:pe,layout:fe,maxRowDepth:ee,virtualRows:F}=h,{locale:z}=n(),V=fe.rowHeaderLayout==="tree",g=V?Y.depth:B,D=Y.pathValues[g],O=Y.rowSpans[B]>0&&k.dfIndex===0,$=pe[g],_=$&&D!==null&&D!==void 0?pivotgridCore.formatDimensionValue(D,$,"grid",z):D,j=g===Y.depth,G=g<Y.depth,U=j?Y.hasChildren:G,re=j?Y.isExpanded:G,de=F[Q+1],Ee=!V&&de&&!de.isGrandTotal&&de.flatRow&&!de.flatRow.isSubtotal&&(de.flatRow.rowSpans[B]===0||de.dfIndex>0)&&de.flatRow.pathValues[B]===D,me=_!=null?String(_):null;typeof $?.cellTemplate=="function"&&me!==null&&(me=$.cellTemplate({value:_,displayValue:_,field:$})??me);let J={text:me,style:{position:"sticky",backgroundColor:"var(--pivot-surface)",zIndex:40,cursor:U?"pointer":"default",fontWeight:_&&g<Y.depth?600:400,verticalAlign:"middle",padding:0,borderBottom:Ee?"none":"1px solid var(--pivot-border)",height:a()},className:`kanuni-pivot-cell kanuni-pivot-row-header ${U?"kanuni-pivot-row-expandable":""}${e.shared?.focused?.r===Q&&e.shared?.focused?.c===B?" kanuni-pivot-cell-focused":""}${We(e.shared?.selection??null,Q,B)?" kanuni-pivot-cell-selected":""}`};e.onCellPrepared?.({area:"row",cell:null,rowIndex:Q,columnIndex:B,cellConfig:J});let le=Z(J.className,"td");if(le.id=o(Q,B),le.setAttribute("role","rowheader"),U&&le.setAttribute("aria-expanded",String(re)),le.setAttribute("data-r",String(Q)),le.setAttribute("data-c",String(B)),te(le,J.style),ke(le,`var(--row-header-left-${B}, 0px)`),!V&&B>=Y.depth&&B<ee-1&&le.style.setProperty("border-inline-end","none"),!O&&!V){le.style.borderBottom="none",le.appendChild(qe(`row-${B}`,i.rowHeader,1,n().rtl?"left":"right")),R.appendChild(le);return}let Te=V?Y.depth*20:0,we=Z("");if(te(we,{display:"flex",alignItems:"center",gap:4,padding:"0 8px",height:"100%",position:"relative"}),we.style.setProperty("padding-inline-start",`${8+Te}px`),V&&Y.depth>0){let ie=Z("kanuni-pivot-tree-line");te(ie,{position:"absolute",left:Te,top:-a()/2,width:12,height:a(),borderLeft:"1px dotted var(--pivot-border)",borderBottom:"1px dotted var(--pivot-border)"}),we.appendChild(ie);}if(J.text!==null&&J.text!==void 0){if(U){let Me=Z("kanuni-pivot-expand-icon","span");Me.textContent=re?"\u2212":"+",Me.setAttribute("aria-hidden","true"),te(Me,{flexShrink:0,position:"relative",zIndex:2}),we.appendChild(Me);}else {let Me=Z("","span");te(Me,{width:14,flexShrink:0}),we.appendChild(Me);}let ie=Z("truncate","span");Oe(ie,J.text),we.appendChild(ie);}le.appendChild(we),le.appendChild(qe(`row-${B}`,i.rowHeader,1,n().rtl?"left":"right")),R.appendChild(le);}function N(R,k,Q,B,Y){let{dataFields:pe,leafColHashes:fe,dfsPerLeaf:ee,dataColOffset:F,showDataInRows:z,totalDataCols:V}=h,g=V>kt,D=e.registry?e.registry.getPluginsByType("cellRender"):null;fe.forEach((O,$)=>{let _=$*ee,j=z?[pe[Q]]:pe,G=g&&(_+ee<=w.start||_>=w.end),U=G?null:Ue(h,k,O.hash,B,O.isGrandTotal);j.forEach((re,de)=>{let Ee=_+de,me=F+Ee,J=Z("kanuni-pivot-cell","td");if(J.id=o(Y,me),J.setAttribute("role","gridcell"),J.setAttribute("data-r",String(Y)),J.setAttribute("data-c",String(me)),G||g&&(Ee<w.start||Ee>=w.end)){R.appendChild(J);return}let le=U?.values[`${re.id}_display`]??U?.values[re.id],Te=x(le,re),we=B||O.isGrandTotal||!!U?.isTotalCell,ie=re.conditionalFormatting?pivotgridCore.resolveConditionalVisual(U?.values[re.id],re,U??null,h.fieldRanges[re.id]):Pn,Me=ie.style,_e=Te;if(typeof re.cellTemplate=="function")_e=re.cellTemplate({value:le,displayValue:Te,cell:U,field:re})??null;else if(D){for(let Le of D)if(Le.renderCell){let Xe=Le.renderCell(le,Te,U,re);if(Xe!=null){_e=Xe;break}}}let $e={text:_e,style:{textAlign:re.dataType==="number"?"right":"left",fontWeight:we?600:400,backgroundColor:we?"var(--pivot-bg)":"transparent",cursor:e.hasCellClick?.()&&U?"pointer":"default",...Me},className:`kanuni-pivot-cell ${we?"kanuni-pivot-cell-total":""}${e.shared?.focused?.r===Y&&e.shared?.focused?.c===me?" kanuni-pivot-cell-focused":""}${We(e.shared?.selection??null,Y,me)?" kanuni-pivot-cell-selected":""}`};if(e.onCellPrepared?.({area:"data",cell:U,rowIndex:Y,columnIndex:me,cellConfig:$e}),J.className=$e.className,te(J,$e.style),J.setAttribute("data-val",typeof le=="number"?String(le):""),Oe(J,$e.text),ie.dataBar){let Le=Math.round(ie.dataBar.ratio*100);J.style.setProperty("background-image",`linear-gradient(to ${n().rtl?"left":"right"}, ${ie.dataBar.color} ${Le}%, transparent ${Le}%)`),J.style.setProperty("background-repeat","no-repeat");}if(ie.icon){let Le=X(ie.icon,12);Le.style.setProperty("margin-inline-end","4px"),Le.style.setProperty("vertical-align","middle"),J.insertBefore(Le,J.firstChild);}R.appendChild(J);});});}let q=(R,k)=>e.shared?.focused?.r===R&&e.shared?.focused?.c===k?" kanuni-pivot-cell-focused":"";function ye(R){let k=R.flatRow;return R.isGrandTotal||!k?{level:1}:k.isSubtotal||!k.hasChildren?{level:k.depth+1}:{level:k.depth+1,expanded:!!k.isExpanded}}function se(R,k){let{t:Q}=n(),{maxRowDepth:B,showDataInRows:Y,dataFields:pe,layout:fe}=h,ee=Z("kanuni-pivot-row","tr");if(ee.setAttribute("role","row"),ee.setAttribute("aria-rowindex",String(k+1)),te(ee,{height:a()}),fe.rowHeaderLayout==="tree"){let z=ye(R);ee.setAttribute("aria-level",String(z.level)),z.expanded!==void 0&&ee.setAttribute("aria-expanded",String(z.expanded));}if(R.isGrandTotal){ee.classList.add("kanuni-pivot-grand-total-row");for(let z=0;z<B;z++){let V=z===0,g=Z("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(k,z),"td");g.id=o(k,z),g.setAttribute("role",V?"rowheader":"presentation"),te(g,{position:"sticky",zIndex:40,fontWeight:700,backgroundColor:"var(--pivot-surface)",paddingLeft:V?8:0,paddingRight:0,borderRight:z===B-1?"1px solid var(--pivot-border)":"none",whiteSpace:V?"nowrap":"normal",overflow:V?"visible":"hidden"}),ke(g,`var(--row-header-left-${z}, 0px)`),V&&(g.textContent=`${Q("grandTotal")}${Y?` \u2014 ${pe[R.dfIndex]?.caption??""}`:""}`),ee.appendChild(g);}if(Y){let z=Z("kanuni-pivot-cell kanuni-pivot-cell-total"+q(k,B),"td");z.id=o(k,B),z.setAttribute("role","gridcell"),te(z,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),ke(z,`var(--row-header-left-${B}, 0px)`),z.textContent=String(pe[R.dfIndex]?.caption??""),ee.appendChild(z);}return N(ee,"",R.dfIndex,true,k),ee}let F=R.flatRow;if(F.isSubtotal){ee.classList.add("kanuni-pivot-subtotal-row");let z=`${Q("subTotal")}: ${F.pathValues[F.depth]}`;if(fe.rowHeaderLayout==="tree"){let V=Z("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(k,0),"td");V.id=o(k,0),V.setAttribute("role","rowheader"),te(V,{position:"sticky",zIndex:40,fontWeight:600,backgroundColor:"var(--pivot-surface)",paddingLeft:8+F.depth*20}),ke(V,"var(--row-header-left-0, 0px)"),V.textContent=z,ee.appendChild(V);}else for(let V=0;V<B;V++){if(V<F.depth){I(ee,R,k,V);continue}let g=V===F.depth,D=Z("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(k,V),"td");D.id=o(k,V),D.setAttribute("role",g?"rowheader":"presentation"),te(D,{position:"sticky",zIndex:40,fontWeight:600,backgroundColor:"var(--pivot-surface)",paddingLeft:g?8:0,paddingRight:0,borderRight:V===B-1?"1px solid var(--pivot-border)":"none",whiteSpace:g?"nowrap":"normal",overflow:g?"visible":"hidden"}),ke(D,`var(--row-header-left-${V}, 0px)`),g&&(D.textContent=z),ee.appendChild(D);}if(Y){let V=Z("kanuni-pivot-cell kanuni-pivot-cell-total"+q(k,B),"td");V.id=o(k,B),V.setAttribute("role","gridcell"),te(V,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),ke(V,`var(--row-header-left-${B}, 0px)`),V.textContent=String(pe[R.dfIndex]?.caption??""),ee.appendChild(V);}return N(ee,F.key,R.dfIndex,true,k),ee}for(let z=0;z<B;z++)I(ee,R,k,z);if(Y){let z=Z("kanuni-pivot-cell kanuni-pivot-row-header"+q(k,B),"td");if(z.id=o(k,B),z.setAttribute("role","rowheader"),te(z,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),ke(z,`var(--row-header-left-${B}, 0px)`),R.isDataRow){let V=Z("","span");te(V,{color:"var(--pivot-text-muted)",paddingLeft:8}),V.textContent=String(pe[R.dfIndex]?.caption??""),z.appendChild(V);}z.appendChild(qe(`row-${B}`,et,1,n().rtl?"left":"right")),ee.appendChild(z);}return N(ee,F.key,R.dfIndex,false,k),ee}function ae(){if(p||!h)return;let R=f();if(E(),u=R,y.textContent="",R.start>0){let k=Z("","tr");te(k,{height:R.start*a()});let Q=Z("","td");Q.colSpan=h.dataColOffset+Math.max(h.totalDataCols,1),te(Q,{padding:0,border:"none"}),k.appendChild(Q),y.appendChild(k);}for(let k=R.start;k<R.end;k++)y.appendChild(se(h.virtualRows[k],k));te(C,{height:b()+h.virtualRows.length*a()});}function ge(R){if(p)return;let k=n();k.locale!==m&&(m=k.locale,x=Ne(k.locale)),r=R.columnWidths??{},h=ut(R,{grandTotal:k.t("grandTotal"),subTotal:k.t("subTotal")}),l.setAttribute("role",h.layout.rowHeaderLayout==="tree"?"treegrid":"grid"),l.setAttribute("aria-rowcount",String(h.virtualRows.length+h.colHeaders.length+(e.chipDeps?1:0))),l.setAttribute("aria-colcount",String(h.dataColOffset+h.totalDataCols)),l.setAttribute("aria-label",k.t("pivotView"));let Q=e.shared?.focused;Q?l.setAttribute("aria-activedescendant",o(Q.r,Q.c)):l.removeAttribute("aria-activedescendant");for(let B of c)l.style.removeProperty(B);c.clear(),S();for(let[B,Y]of Object.entries(r)){if(!B.startsWith("leaf-"))continue;let pe=`--col-width-data-${B.slice(5)}`;l.style.setProperty(pe,`${Y}px`),c.add(pe);}H(),W(),u={start:-1,end:-1},ae();}let xe=()=>{if(p||!h)return;let R=f(),k=w.start;E(),(R.start!==u.start||R.end!==u.end||w.start!==k)&&ae();};l.addEventListener("scroll",xe,{passive:true});let ce=()=>{if(p||!h)return;S();let R=f(),k=w.start,Q=w.end;E(),(R.start!==u.start||R.end!==u.end||w.start!==k||w.end!==Q)&&ae();},K=typeof ResizeObserver<"u"?new ResizeObserver(()=>ce()):null;return K?.observe(l),{getVM:()=>h,getTheadHeight:b,paintStructural:ge,paintWindow:ae,refreshWindow:ce,rowHeaderLayout(){let R=[];if(h){for(let k=0;k<h.maxRowDepth;k++)R.push(d(k));h.showDataInRows&&R.push(v());}return {configured:R,viewport:h&&A(R.length)?0:l.clientWidth}},scroller:l,destroy(){p=true,K?.disconnect(),l.removeEventListener("scroll",xe),l.remove();}}}var Hn=0;function Lt(){let e=`kp${++Hn}-`;return {lastResizeTime:0,isResizing:false,focused:null,selection:null,cellId:(t,n)=>`${e}pivot-cell-${t}-${n}`}}function St(e){let{scroller:t,controller:n,getVM:i,shared:a}=e,o=c=>c?.closest?.("td[data-r][data-c]")??null;function l(c,p){let b=a.focused;a.focused={r:c,c:p},b&&t.querySelector(`td[id="${a.cellId(b.r,b.c)}"]`)?.classList.remove("kanuni-pivot-cell-focused"),t.querySelector(`td[id="${a.cellId(c,p)}"]`)?.classList.add("kanuni-pivot-cell-focused"),t.setAttribute("aria-activedescendant",a.cellId(c,p));}function C(c,p,b){if(!e.onCellClick)return;let d=i();if(!d)return;let v=ft(d,p,b);if(!v)return;let s={event:c,cellType:v.isTotal?"grandTotal":"data",value:v.val,rowPath:v.cell.rowPath,colPath:v.cell.colPath};e.onCellClick(e.resolveCellClick?e.resolveCellClick(s):s);}let T=c=>{let p=c.target,b=p.closest("[data-col-expand]");if(b){n.toggleColExpanded(b.getAttribute("data-col-expand")??"");return}if(p.closest(".kanuni-pivot-resize-handle"))return;let d=p.closest("[data-filter-field]");if(d){e.onFilterClick?.(c.clientX,c.clientY,d.getAttribute("data-filter-field")??"");return}let v=p.closest("th[data-header-field]");if(v){if(Date.now()-a.lastResizeTime<100)return;let A=i();if(!A)return;let S=v.getAttribute("data-header-field")??"",H=v.getAttribute("data-header-col-path")??"",W=A.rowFields.find(I=>I.sortBySummaryField===S&&(I.sortBySummaryPath||"")===H);W&&n.sortField(W.id,W.sortOrder==="asc"?"desc":"asc");return}let s=o(p);if(!s)return;let E=Number(s.getAttribute("data-r")),f=Number(s.getAttribute("data-c")),L=i();if(L){if(t.focus({preventScroll:true}),l(E,f),f<L.dataColOffset){if(Date.now()-a.lastResizeTime<100)return;let A=Ze(L,E,f);A?.hasChildren&&n.toggleExpanded(A.cellHashStr);return}C(c,E,f);}},M=c=>{let p=o(c.target);if(!p)return;let b=Number(p.getAttribute("data-r")),d=Number(p.getAttribute("data-c")),v=i();!v||d<v.dataColOffset||C(c,b,d);},P=c=>{let p=c.target.closest?.("th[data-header-field]");if(p){c.preventDefault(),p.hasAttribute("aria-expanded")?e.onNodeContextMenu?.({x:c.clientX,y:c.clientY,path:p.getAttribute("data-header-col-path")??"",isExpanded:p.getAttribute("aria-expanded")==="true",depth:Number(p.getAttribute("data-header-depth")??0),type:"col"}):e.onHeaderContextMenu&&e.onHeaderContextMenu(c.clientX,c.clientY,p.getAttribute("data-header-field")??"",p.getAttribute("data-header-col-path")??void 0);return}let b=o(c.target);if(!b)return;let d=Number(b.getAttribute("data-r")),v=Number(b.getAttribute("data-c")),s=i();if(s){if(v<s.dataColOffset){let E=Ze(s,d,v);if(E){let{flatRow:f,hasChildren:L,cellHashStr:A,isExpanded:S,depth:H,dIdx:W}=E,I=s.layout.rowHeaderLayout==="tree",N=W>f.depth,q=N?f.hasChildren:L;if(q&&e.onNodeContextMenu){c.preventDefault(),e.onNodeContextMenu({x:c.clientX,y:c.clientY,path:N?I?f.key:pivotgridCore.pathKey(f.pathValues.slice(0,f.depth+1)):A,isExpanded:N?f.isExpanded:S,depth:N?f.depth:H,type:"row"});return}if(q)return}}e.onGlobalContextMenu&&(c.preventDefault(),e.onGlobalContextMenu(c.clientX,c.clientY));}},y=e.keyboardEnabled!==false;function h(){let c=a.focused;a.focused=null,c&&t.querySelector(`td[id="${a.cellId(c.r,c.c)}"]`)?.classList.remove("kanuni-pivot-cell-focused"),t.removeAttribute("aria-activedescendant");}let x=c=>{if(c.target!==t||!a.focused)return;let p=i();if(!p)return;let{r:b,c:d}=a.focused,v={r:b,c:d},s=c.ctrlKey||c.metaKey,E=p.dataColOffset+p.totalDataCols,f=e.rowHeight?.()??28,L=e.getTheadHeight?.()??p.colHeaders.length*f,A=Math.max(1,Math.ceil(((t.clientHeight||600)-L)/f));switch(c.key){case "ArrowDown":c.preventDefault(),b=Math.min(p.virtualRows.length-1,b+1);break;case "ArrowUp":c.preventDefault(),b=Math.max(0,b-1);break;case "ArrowRight":c.preventDefault(),d=Math.min(E-1,d+1);break;case "ArrowLeft":c.preventDefault(),d=Math.max(0,d-1);break;case "Home":c.preventDefault(),(c.ctrlKey||c.metaKey)&&(b=0),d=0;break;case "End":c.preventDefault(),(c.ctrlKey||c.metaKey)&&(b=p.virtualRows.length-1),d=E-1;break;case "PageDown":c.preventDefault(),b=Math.min(p.virtualRows.length-1,b+A-1);break;case "PageUp":c.preventDefault(),b=Math.max(0,b-A+1);break;case "Escape":c.preventDefault(),h();return;case " ":case "Enter":{c.preventDefault(),c.key===" "&&a.selectByKey?.(b,d,c.shiftKey,v);let W=t.querySelector(`td[id="${a.cellId(b,d)}"]`);W&&(c.key===" "?W.click():W.dispatchEvent(new MouseEvent("dblclick",{bubbles:true})));return}default:return}let S=L+b*f,H=t.clientHeight||600;S<t.scrollTop+L?(t.scrollTop=S-L,t.dispatchEvent(new Event("scroll"))):S+f>t.scrollTop+H&&(t.scrollTop=S+f-H,t.dispatchEvent(new Event("scroll"))),l(b,d),(c.shiftKey||!s)&&a.selectByKey?.(b,d,c.shiftKey,v),d>=p.dataColOffset&&m(b,d,p.dataColOffset);};function m(c,p,b){let d=t.querySelector(`td[id="${a.cellId(c,p)}"]`)??t.querySelector(`td[data-c="${p}"]`);if(!d)return;let v=t.getBoundingClientRect(),s=getComputedStyle(t).direction==="rtl",E=t.querySelector(`td[data-c="${b-1}"]`)?.getBoundingClientRect(),f=d.getBoundingClientRect(),L=s?v.right-t.clientWidth:v.left,A=s?L:E?E.right:L,S=s&&E?E.left:L+t.clientWidth,H=0;f.left<A?H=f.left-A:f.right>S&&(H=Math.min(f.right-S,f.left-A)),H!==0&&(t.scrollLeft+=H,t.dispatchEvent(new Event("scroll")));}let u=c=>{if(c.button!==0)return;let p=o(c.target);if(!p)return;let b=Number(p.getAttribute("data-r")),d=Number(p.getAttribute("data-c"));a.focused?.r===b&&a.focused.c===d||l(b,d);},w=c=>{let p=i();p&&!a.focused&&c.target===t&&p.virtualRows.length>0&&l(0,0);},r=c=>{c.relatedTarget&&t.contains(c.relatedTarget)||h();};return t.addEventListener("click",T),y&&t.addEventListener("mouseup",u),t.addEventListener("dblclick",M),t.addEventListener("contextmenu",P),y?(t.addEventListener("keydown",x),t.addEventListener("focus",w),t.addEventListener("blur",r)):t.removeAttribute("tabindex"),{destroy(){t.removeEventListener("click",T),t.removeEventListener("mouseup",u),t.removeEventListener("dblclick",M),t.removeEventListener("contextmenu",P),y&&(t.removeEventListener("keydown",x),t.removeEventListener("focus",w),t.removeEventListener("blur",r));}}}function Pt(e){let{host:t,scroller:n,shared:i}=e,a=document.createElement("div");a.className="kanuni-pivot-drag-line",Object.assign(a.style,{position:"absolute",top:"0",bottom:"0",left:"0",width:"2px",backgroundColor:"var(--pivot-primary)",zIndex:"100",display:"none",pointerEvents:"none"}),t.appendChild(a);let o=null,l=1,C=0,T=0,M=[],P={},y=null,h=-1,x=r=>{let c=t.getBoundingClientRect();a.style.display="block",a.style.transform=`translateX(${r-c.left}px)`;},m=r=>{i.isResizing&&x(r.clientX);},u=r=>{if(!i.isResizing||!o)return;a.style.display="none";let c=r.clientX-C,p=e.isRtl()?-c:c;if(o.startsWith("row-")){let b=Math.max(20,T+p);P[o]=y?pivotgridCore.invertRowHeaderWidth(y.configured,h,b,y.viewport):b;}else if(o.startsWith("leaf-")){let b=o.split("-"),d=parseInt(b[1],10),s=Math.max(l*20,T+p)/T;for(let E=0;E<l;E++)P[`leaf-${d+E}`]=Math.max(20,M[E]*s);}i.isResizing=false,i.lastResizeTime=Date.now(),o=null,document.body.style.cursor="",document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",u),e.commit({...P});},w=r=>{let c=r.target.closest?.(".kanuni-pivot-resize-handle");if(!c||(r.preventDefault(),r.stopPropagation(),o=c.getAttribute("data-resize-id"),!o))return;let p=Number(c.getAttribute("data-resize-default")||150);if(l=Number(c.getAttribute("data-resize-span")||1),C=r.clientX,P={...e.getWidths()},o.startsWith("row-"))h=parseInt(o.slice(4),10),y=e.rowHeaderLayout(),T=pivotgridCore.computeRowHeaderWidths(y.configured,y.viewport).widths[h]??P[o]??p;else if(o.startsWith("leaf-")){let b=parseInt(o.split("-")[1],10);M=[],T=0;for(let d=0;d<l;d++){let v=P[`leaf-${b+d}`]||p;M.push(v),T+=v;}}i.isResizing=true,x(r.clientX),document.body.style.cursor="col-resize",document.addEventListener("mousemove",m),document.addEventListener("mouseup",u);};return n.addEventListener("mousedown",w),{destroy(){n.removeEventListener("mousedown",w),i.isResizing&&(i.isResizing=false,document.body.style.cursor=""),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",u),a.remove();}}}function Rt(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function He(e){let t=Rt("kanuni-pivot-root kanuni-pivot-portal-container");e.classList.contains("kanuni-pivot-striped")&&t.classList.add("kanuni-pivot-striped"),t.setAttribute("style",e.getAttribute("style")??"");for(let i of ["position","inset","z-index","width","height"])t.style.removeProperty(i);let n=e.getAttribute("data-theme");return n&&t.setAttribute("data-theme",n),t.setAttribute("dir",e.getAttribute("dir")??"ltr"),t}function Ie(e){e.style.removeProperty("zoom");let t=pivotgridCore.cssZoomOf(e);Math.abs(t-1)>.01&&e.style.setProperty("zoom",String(1/t));}function Ve(){let e=document,t=e.fullscreenElement??e.webkitFullscreenElement??null;return t||(document.querySelector(".pivot-is-fullscreen")??document.body)}function tt(e){let t=null,n=null;function i(){n?.(),n=null,t?.remove(),t=null;}function a(o){i(),t=He(e);let l=Rt("kanuni-pivot-portal-root");t.appendChild(l),Ve().appendChild(t),Ie(t);let C=o(l),T=t,M=y=>{T.contains(y.target)||i();},P=y=>{y.key==="Escape"&&i();};return document.addEventListener("pointerdown",M,true),document.addEventListener("keydown",P,true),n=()=>{document.removeEventListener("pointerdown",M,true),document.removeEventListener("keydown",P,true),C?.();},l}return {openPopup:a,closePopup:i,isOpen:()=>t!==null,destroy:i}}var At=new Map,Ft=new Map;function Ht(e,t,n,i="(Blanks)"){if(e==null)return i;if(t.format&&typeof e=="number")try{let a=t.format,o=JSON.stringify(a)+"_"+n,l=Ft.get(o);l||(l=new Intl.NumberFormat(n,a),Ft.set(o,l));let C=l.format(e);return a.isCustom&&(a.prefix||a.suffix)?`${a.prefix||""}${C}${a.suffix||""}`:C}catch{return String(e)}return String(e)}var Se=28;function ve(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var jn="M11 11l3.5 3.5M12.5 7a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z";function qn(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("class","kanuni-pivot-popup-search-icon"),e.setAttribute("width","14"),e.setAttribute("height","14"),e.setAttribute("viewBox","0 0 16 16"),e.setAttribute("fill","none");let t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",jn),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","1.5"),t.setAttribute("stroke-linecap","round"),e.appendChild(t),e}function It(e){let{portal:t}=e;function n(i,a,o){let l=e.getField(o);if(!l)return;let{t:C,rtl:T,locale:M}=e.getI18n(),P=true,y=[],h="",x=new Set,m=0,u=220,w=false,r=[];t.openPopup(c=>{let p=ve("kanuni-pivot-popup pivot-animate-zoom-in"),b=pivotgridCore.popupViewport(),d=pivotgridCore.placePopup({x:i,y:a},{width:250,height:350},{margin:10,viewport:b});p.setAttribute("role","dialog"),p.setAttribute("aria-label",C("columnFilter")),p.setAttribute("data-datagrid-keyboard-scope","modal"),p.tabIndex=-1,Object.assign(p.style,{left:`${d.left}px`,top:`${d.top}px`,width:"250px",height:`${Math.min(350,d.maxHeight)}px`,minWidth:"200px",minHeight:`${Math.min(250,d.maxHeight)}px`,maxWidth:`${Math.min(600,b.width-20)}px`,maxHeight:`${Math.min(350,d.maxHeight)}px`,resize:"both",direction:T?"rtl":"ltr"});let v=ve("kanuni-pivot-popup-header"),s=ve("kanuni-pivot-popup-search");s.appendChild(qn());let E=ve("kanuni-pivot-popup-search-input","input");E.type="text",E.placeholder=C("search"),E.setAttribute("aria-controls","pivot-filter-options"),s.appendChild(E),v.appendChild(s);let f=ve("kanuni-pivot-popup-actions"),L=ve("kanuni-pivot-popup-action-btn kanuni-pivot-popup-action-btn--primary","button");L.textContent=C("selectAll");let A=ve("kanuni-pivot-popup-action-btn kanuni-pivot-popup-action-btn--danger","button");A.textContent=C("clearAll"),f.append(L,A),v.appendChild(f);let S=ve("kanuni-pivot-popup-list pivot-custom-scrollbar");S.id="pivot-filter-options";let H=ve("");H.style.position="relative",S.appendChild(H);let W=ve("kanuni-pivot-popup-footer"),I=ve("kanuni-pivot-btn kanuni-pivot-btn--outline","button");I.textContent=C("cancel");let N=ve("kanuni-pivot-btn kanuni-pivot-btn--primary","button");N.textContent=C("ok");for(let F of [I,N])Object.assign(F.style,{height:"28px",padding:"0 12px",fontSize:"12px"});if(W.append(I,N),e.openCondition&&(l.area==="row"||l.area==="column")){let F=ve("kanuni-pivot-btn kanuni-pivot-btn--outline","button");F.type="button",F.setAttribute("data-condition-filter",""),F.title=C("conditionFilter")+"\u2026",F.setAttribute("aria-label",F.title),Object.assign(F.style,{height:"28px",padding:"0 7px",marginInlineEnd:"auto"}),(l.valueFilter||l.labelFilter)&&(F.style.color="var(--pivot-danger)"),F.appendChild(X("settings-2",14)),F.addEventListener("click",()=>{t.closePopup(),e.openCondition(l.id);}),W.prepend(F);}p.append(v,S,W),c.appendChild(p);let q=()=>{if(!h)return y;let F=h.toLowerCase(),z=F.replace(/,/g,"."),V=F.replace(/\./g,","),g=F.replace(/[.,\s]/g,"");return y.filter(D=>{let O=D.label.toLowerCase(),$=O.replace(/[.,\s]/g,"");return O.includes(F)||O.includes(z)||O.includes(V)||!!g&&$.includes(g)})},ye=()=>x.size===y.length,se=()=>!h,ae=()=>q().length+(se()?1:0),ge=()=>ae()===0?-1:Math.min(m,ae()-1),xe=F=>{if(se()&&F===0)return "select-all";let z=se()?F-1:F;return `value:${q()[z]?.rawStr}`},ce=new Map;function K(){if(w)return;let F=document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains("kanuni-pivot-popup-item");if(N.disabled=!P&&y.length>0&&x.size===0,H.textContent="",ce.clear(),P){H.style.height="";let $=ve("pivot-flex pivot-items-center pivot-justify-center pivot-h-full"),_=ve("");Object.assign(_.style,{width:"24px",height:"24px",border:"2px solid var(--pivot-border)",borderTopColor:"var(--pivot-primary)",borderRadius:"50%",animation:"spin 1s linear infinite"}),$.appendChild(_),H.appendChild($);return}let z=q(),V=ae();H.style.height=`${V*Se}px`;let g=Math.max(0,Math.floor(S.scrollTop/Se)-2),D=Math.min(V,g+Math.ceil(u/Se)+4),O=ge();for(let $=g;$<D;$++){let _,j,G,U,re;if(se()&&$===0)_="select-all",j=`(${C("selectAll")})`,G=ye(),U=true,re=k;else {let J=z[se()?$-1:$];if(!J)continue;_=`value:${J.rawStr}`,j=J.label,G=x.has(J.rawStr),U=false,re=()=>Q(J.rawStr);}let de=ve(`kanuni-pivot-popup-item${G?" kanuni-pivot-popup-item--checked":""}${$===O?" kanuni-pivot-popup-item--active":""}`);de.id=_,de.setAttribute("role","checkbox"),de.setAttribute("aria-checked",String(G)),de.tabIndex=0,Object.assign(de.style,{position:"absolute",top:`${$*Se}px`,insetInlineStart:"0",insetInlineEnd:"0",height:`${Se}px`,fontWeight:U?"600":"400"});let Ee=ve("kanuni-pivot-checkbox","input");Ee.type="checkbox",Ee.checked=G,Ee.readOnly=true,Ee.tabIndex=-1;let me=ve("pivot-truncate","span");me.textContent=j,de.append(Ee,me),de.addEventListener("click",re),de.addEventListener("focus",()=>{m=$;}),H.appendChild(de),ce.set($,de);}if(z.length===0){let $=ve("");Object.assign($.style,{padding:"12px",textAlign:"center",fontSize:"12px",color:"var(--pivot-text-muted)"}),$.textContent=C("noItems"),H.appendChild($);}E.setAttribute("aria-activedescendant",O>=0?xe(O):""),F&&ce.get(O)?.focus();}function R(F){x=new Set(x);for(let z of q())F?x.add(z.rawStr):x.delete(z.rawStr);K();}function k(){R(!q().every(F=>x.has(F.rawStr)));}function Q(F){x.has(F)?x.delete(F):x.add(F),K();}function B(){if(N.disabled)return;let F=pivotgridCore.headerFilterWrite(y,x,l);F.kind==="clear"?e.clear(l.id):F.kind==="apply"&&e.apply(l.id,F.values,F.filterType),t.closePopup();}function Y(F){m=Math.max(0,Math.min(ae()-1,F));let z=m*Se;z<S.scrollTop?S.scrollTop=z:z+Se>S.scrollTop+u&&(S.scrollTop=z+Se-u),K(),ce.get(m)?.focus();}let pe=F=>{if(F.key==="ArrowDown"||F.key==="ArrowUp"){if(F.preventDefault(),ae()===0)return;Y(ge()+(F.key==="ArrowDown"?1:-1));return}if(F.key==="Home"&&ae()>0){F.preventDefault(),Y(0);return}if(F.key==="End"&&ae()>0){F.preventDefault(),Y(ae()-1);return}if(F.key==="Backspace"&&F.target!==E){F.preventDefault(),E.focus(),h=h.slice(0,-1),E.value=h,m=0,K();return}if(F.key===" "||F.code==="Space"){if(F.target===E)return;F.preventDefault();let z=ge();if(ae()>0&&z>=0)if(se()&&z===0)k();else {let V=q()[se()?z-1:z];V&&Q(V.rawStr);}return}if(F.key==="Enter"){F.preventDefault(),B();return}if(F.key==="Escape"){F.stopPropagation(),t.closePopup();return}F.key.length===1&&!F.ctrlKey&&!F.metaKey&&!F.altKey&&F.target!==E&&(F.preventDefault(),E.focus(),h+=F.key,E.value=h,m=0,K());},fe=F=>{pe(F),F.defaultPrevented&&F.stopPropagation();};document.addEventListener("keydown",fe,true),p.addEventListener("click",F=>F.stopPropagation()),E.addEventListener("input",()=>{h=E.value,m=0,K();}),L.addEventListener("click",k),A.addEventListener("click",()=>R(false)),I.addEventListener("click",()=>t.closePopup()),N.addEventListener("click",B),S.addEventListener("scroll",()=>{At.set(l.id,S.scrollTop),K();});let ee=typeof ResizeObserver<"u"?new ResizeObserver(F=>{for(let z of F)u=z.contentRect.height;}):null;return ee?.observe(S),K(),E.focus(),r.push(setTimeout(()=>{if(w)return;if(!l.dataField&&!l.isCalculated){y=[],P=false,K();return}let F=pivotgridCore.getFieldDistinctValues(l.id,e.gridId);if(F)y=F.map(V=>({rawStr:V.rawStr==="null"||V.rawStr==="undefined"?C("blanks"):V.rawStr,rawVal:V.rawVal,label:Ht(V.rawVal,l,M,C("blanks"))}));else {let V=new Map,g=e.getData();for(let O=0;O<g.length;O++){let $=pivotgridCore.extractGroupValue(g[O],l);if($==="(Blank)"&&l.calculateSummaryExpression)continue;let _=$==null?C("blanks"):String($);V.has(_)||V.set(_,$);}let D=Array.from(V.values());if(l.dataType==="number")D.sort((O,$)=>Number(O)-Number($));else {let O=pivotgridCore.collatorFor().compare;D.sort(($,_)=>O(String($),String(_)));}y=D.map(O=>({rawStr:O==null?C("blanks"):String(O),rawVal:O,label:Ht(O,l,M,C("blanks"))}));}x=pivotgridCore.headerFilterShown(y,l),P=false,K();let z=At.get(l.id)||0;z>0&&r.push(setTimeout(()=>{w||(S.scrollTop=z,K());},50)),r.push(setTimeout(()=>{w||E.focus();},50));},10)),()=>{w=true,document.removeEventListener("keydown",fe,true);for(let F of r)clearTimeout(F);ee?.disconnect();}});}return {open:n,close:()=>t.closePopup()}}function be(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Dt(e){let t=be("kanuni-pivot-footer pivot-flex pivot-items-center pivot-justify-start");Object.assign(t.style,{padding:"4px 8px",backgroundColor:"color-mix(in srgb, var(--pivot-surface-header) 50%, var(--pivot-surface))",borderTop:"1px solid var(--pivot-border)",gap:"4px",flex:"0 0 auto"}),e.host.appendChild(t);let n=null,i=null,a=null,o=null;function l(){n=null,i?.remove(),i=null,a?.classList.remove("kanuni-pivot-footer-btn--active"),a=null;}let C=p=>{e.onGlobalContextMenu&&(p.preventDefault(),e.onGlobalContextMenu(p.clientX,p.clientY));};t.addEventListener("contextmenu",C);let T=p=>{!n||p.target?.closest?.("[data-footer-menu]")?.getAttribute("data-footer-menu")===n||l();};document.addEventListener("mousedown",T);let M=be("kanuni-pivot-search","input");M.type="search";let P,y=()=>{clearTimeout(P),e.onSearch?.(M.value);};M.addEventListener("input",()=>{clearTimeout(P),P=setTimeout(y,250);}),M.addEventListener("keydown",p=>{p.stopPropagation(),p.key==="Enter"?y():p.key==="Escape"&&(M.value="",y());});function h(p,b,d=false){let v=be(`kanuni-pivot-footer-btn${d?" kanuni-pivot-footer-btn--active":""}`,"button");return v.title=b,v.setAttribute("aria-label",b),v.type="button",v.appendChild(X(p,15)),v}let x=()=>be("kanuni-pivot-footer-divider");function m(p,b,d,v,s,E={}){let f=be("kanuni-pivot-dropdown-item pivot-flex","button");f.type="button",f.style.gap="12px",E.locked&&(f.style.opacity="0.6",f.style.cursor=E.canUpgrade?"pointer":"not-allowed",E.canUpgrade||(f.disabled=true),E.hint&&(f.title=E.hint)),f.appendChild(X(p,16,b));let L=be(""),A=be("pivot-font-medium pivot-flex pivot-items-center");if(A.style.gap="6px",A.appendChild(document.createTextNode(d)),E.locked&&E.badge){let S=be("","span");Object.assign(S.style,{fontSize:"9px",fontWeight:"700",textTransform:"uppercase",letterSpacing:"0.04em",padding:"1px 5px",borderRadius:"9999px",backgroundColor:"color-mix(in srgb, var(--pivot-warning) 18%, transparent)",color:"var(--pivot-warning)"}),S.textContent=E.badge,A.appendChild(S);}if(L.appendChild(A),v!==null){let S=be("pivot-text-xs pivot-text-muted");S.textContent=v,L.appendChild(S);}return f.appendChild(L),s&&f.addEventListener("click",s),f}function u(p,b=false){let d=be("kanuni-pivot-report-section-title");return b&&(d.style.marginTop="4px",d.style.borderTop="1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"),d.textContent=p,d}function w(){let p=be("kanuni-pivot-dropdown-menu pivot-animate-slide-up pivot-custom-scrollbar");return Object.assign(p.style,{bottom:"100%",left:"0",marginBottom:"4px",width:"256px",maxHeight:"384px",overflowY:"auto"}),p}function r(p){n=null,o&&c(o),e.onExport(p);}function c(p){o=p;let{t:b,locale:d}=e.getI18n(),v=e.toolbar??{},s=document.activeElement===M;if(t.textContent="",i=null,a=null,v.showSaveReport!==false&&e.mountReportMenu){let f=be("pivot-relative");e.mountReportMenu(f),f.childNodes.length>0&&(t.appendChild(f),t.appendChild(x()));}if(v.showFieldChooserToggle!==false){let f=h("settings",b("showFieldList"),e.fieldChooserOpen());f.addEventListener("click",e.onToggleFieldChooser),t.appendChild(f);}if(e.onOpenPrefilter){let f=h("filter",b("filterBuilder"));f.addEventListener("click",e.onOpenPrefilter),t.appendChild(f);}if(e.onToggleChart){let f=h("bar-chart",b("chartToggle"));f.addEventListener("click",e.onToggleChart),t.appendChild(f);}if(v.showCalculatedFields!==false&&e.onAddCalculatedField){let f=h("calculator",b("calculatedMeasureDesigner"));f.addEventListener("click",e.onAddCalculatedField),t.appendChild(f);}if(t.appendChild(x()),v.showExpandCollapseAll!==false){let f=h("maximize2",b("expandAll"));f.addEventListener("click",e.onExpandAll);let L=h("minimize2",b("collapseAll"));L.addEventListener("click",e.onCollapseAll),t.append(f,L);}if(v.showRefreshButton!==false&&e.onRefresh){t.appendChild(x());let f=h("refresh-cw",b("refreshData"));f.addEventListener("click",e.onRefresh),t.appendChild(f);}if(v.showFullscreenToggle!==false&&e.onToggleFullscreen){t.appendChild(x());let f=e.isFullscreen(),L=h(f?"shrink":"fullscreen",b(f?"exitFullscreen":"enterFullscreen"),f);f&&Object.assign(L.style,{backgroundColor:"color-mix(in srgb, var(--pivot-primary) 10%, transparent)",color:"var(--pivot-primary)",border:"1px solid color-mix(in srgb, var(--pivot-primary) 30%, transparent)"}),L.addEventListener("click",e.onToggleFullscreen),t.appendChild(L);}if(t.appendChild(x()),v.showExportButton!==false){let f=be("pivot-relative");f.setAttribute("data-footer-menu","export");let L=h("download",b("export"),n==="export");if(L.addEventListener("click",()=>{n=n==="export"?null:"export",c(p);}),f.appendChild(L),n==="export"){let A=w(),S=I=>{let N=!e.advancedExport;return {locked:N,canUpgrade:N&&!!e.upgradeUrl,badge:b("enterpriseBadge"),hint:N&&e.upgradeUrl?b("enterpriseUpgradeHint"):void 0}},H=(I,N)=>{if(!(!e.advancedExport))return ()=>r(I);if(e.upgradeUrl)return ()=>{n=null,c(p),window.open(e.upgradeUrl,"_blank","noopener,noreferrer");}},W=e.registry?.getPluginsByType("exporter")??[];if(W.length>0){A.appendChild(u(b("customExports")));for(let I of W)A.appendChild(m("database","var(--pivot-primary)",`${I.id.replace("exporter-","").toUpperCase()} ${b("export")}`,b("customPlugin"),()=>r(I.id)));A.appendChild(be("kanuni-pivot-dropdown-divider"));}A.appendChild(u(b("excelExport"))),A.appendChild(m("file-spreadsheet","var(--pivot-success)",b("pivotView"),b("preservesGridLayout"),H("excel-pivot"),S())),A.appendChild(m("file-spreadsheet","var(--pivot-success)",b("listView"),b("rawFlatData"),H("excel-list"),S())),A.appendChild(u(b("document"),true)),A.appendChild(m("file-text","var(--pivot-danger)",b("pdfDocument"),b("printReadyLayout"),H("pdf"),S())),A.appendChild(m("printer","var(--pivot-info)",b("print"),b("sendToPrinter"),()=>r("print"))),A.appendChild(m("copy","var(--pivot-primary)",b("copyToClipboard"),b("tabSeparatedValues"),()=>r("clipboard"))),A.appendChild(m("file-json","var(--pivot-success)",b("fullSnapshot"),b("saveSessionState"),()=>r("json-snapshot"))),A.appendChild(u(b("rawDataFormats"),true)),A.appendChild(m("file","var(--pivot-info)","CSV",null,()=>r("csv"))),A.appendChild(m("file-json","var(--pivot-warning)","JSON (Tree)",null,()=>r("json-pivot"))),A.appendChild(m("file-json","var(--pivot-warning)","JSON (List)",null,()=>r("json"))),A.appendChild(m("database","var(--pivot-text-muted)","XML",null,()=>r("xml"))),f.appendChild(A),i=A,a=L;}t.appendChild(f);}if(e.onSearch){let f=b("search").replace(/[.\u2026]+$/,"");M.placeholder=b("search"),M.setAttribute("aria-label",f),t.appendChild(x()),t.appendChild(M),s&&M.focus();}let E=p.selectionStats;if(E){let f=new Intl.NumberFormat(d,{minimumFractionDigits:2,maximumFractionDigits:2}),L=be("kanuni-pivot-selection-stats pivot-text-muted pivot-font-medium pivot-flex pivot-items-center");Object.assign(L.style,{marginLeft:"auto",fontSize:"11px",gap:"8px",paddingRight:"8px",userSelect:"none"});let A=[[b("count"),String(E.count)],[b("sum"),f.format(E.sum)],[b("avg"),f.format(E.avg)],[b("min"),f.format(E.min)],[b("max"),f.format(E.max)]];for(let[S,H]of A){let W=be("","span");W.textContent=`(${S}: ${H})`,L.appendChild(W);}t.appendChild(L);}}return {element:t,paint:c,syncSearch(p){document.activeElement!==M&&(M.value=p);},destroy(){clearTimeout(P),t.removeEventListener("contextmenu",C),document.removeEventListener("mousedown",T),t.remove();}}}var Ot=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];function Vt(e,t){let n=false,i=()=>{let T=document;return T.fullscreenElement??T.webkitFullscreenElement??T.mozFullScreenElement??T.msFullscreenElement??null},a=()=>n||i()===e;function o(T){if(n=T,e.classList.toggle("pivot-is-fullscreen",T),T)Object.assign(e.style,{position:"fixed",inset:"0",zIndex:"9990",width:"auto",height:"auto"});else for(let M of ["position","inset","z-index","width","height"])e.style.removeProperty(M);}let l=()=>{let T=a();e.classList.toggle("pivot-is-fullscreen",i()===e||n),t(T);};for(let T of Ot)document.addEventListener(T,l);function C(){let T=document;if(a()){if(n){o(false),t(false);return}T.exitFullscreen?T.exitFullscreen():T.webkitExitFullscreen?T.webkitExitFullscreen():T.mozCancelFullScreen?T.mozCancelFullScreen():T.msExitFullscreen?T.msExitFullscreen():t(false);return}let M=e;M.requestFullscreen?M.requestFullscreen().then(()=>{e.classList.add("pivot-is-fullscreen");},()=>{o(true),t(true);}):M.webkitRequestFullscreen?M.webkitRequestFullscreen():M.mozRequestFullScreen?M.mozRequestFullScreen():M.msRequestFullscreen?M.msRequestFullscreen():(o(true),t(true));}return {isFullscreen:a,toggle:C,destroy(){for(let T of Ot)document.removeEventListener(T,l);n&&o(false);}}}var nt=["row","column","data","filter","chooser"];function zt(e){let t={activeId:null,targetId:null,targetArea:null,intent:null};function n(s,E,f){t.targetId===s&&t.targetArea===E&&t.intent===f||(t.targetId=s,t.targetArea=E,t.intent=f,e.controller.setDragIntent(s,E,f),e.onIntentChange({...t}));}let i=null,a=null,o=null,l=null;function C(s,E,f){o=He(e.gridRoot),o.style.pointerEvents="none",l=document.createElement("div"),l.className="kanuni-pivot-drag-overlay pivot-flex pivot-items-center pivot-gap-2 pivot-font-semibold pivot-truncate",Object.assign(l.style,{position:"fixed",left:"0",top:"0",padding:"8px 12px",backgroundColor:"var(--pivot-surface)",border:"2px solid var(--pivot-primary)",boxShadow:"var(--pivot-shadow-xl)",borderRadius:"var(--pivot-border-radius)",fontSize:"14px",opacity:"0.9",cursor:"grabbing",transformOrigin:"0 0",pointerEvents:"none",zIndex:"100000"});let L=document.createElement("span");L.className="pivot-truncate",Object.assign(L.style,{maxWidth:"150px",color:"var(--pivot-text)"});let A=e.getFields().find(S=>S.id===s);L.textContent=A?.caption||A?.id||"Field",l.appendChild(L),o.appendChild(l),document.body.appendChild(o),Ie(o),T(E,f);}function T(s,E){l&&(l.style.transform=`translate3d(${s+6}px, ${E+6}px, 0) scale(1.05)`);}function M(){o?.remove(),o=null,l=null,a&&(a.el.classList.remove("is-dragging"),a.el.style.removeProperty("pointer-events"),a.el.style.removeProperty("cursor"),document.body.style.removeProperty("user-select"));}function P(s){let E=a;if(M(),a=null,i?.holdTimer&&clearTimeout(i.holdTimer),i=null,document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",c),document.removeEventListener("keydown",p,true),!E)return;let f=t.activeId??E.dropId.replace("chooser-","");t.activeId=null,t.targetId=null,t.targetArea=null,t.intent=null,e.onIntentChange({...t}),s===null?e.controller.resetDrag():e.controller.commitDrag(f,s);}function y(){if(!i)return;let{el:s,dropId:E,pointerId:f,startX:L,startY:A}=i;a={el:s,dropId:E,pointerId:f,startX:L,startY:A},i=null;let S=E.replace("chooser-","");t.activeId=S,e.controller.setDragActive(S),s.classList.add("is-dragging"),s.style.pointerEvents="none",s.style.cursor="grabbing",C(S,L,A),window.getSelection?.()?.removeAllRanges?.(),document.body.style.userSelect="none",e.onIntentChange({...t});}function h(s,E){let f=null,L=null,A=null,S=typeof document.elementFromPoint=="function"?document.elementFromPoint(s,E):null;for(let H of e.roots())for(let W of H.querySelectorAll("[data-drop-id]")){if(a&&W===a.el||S&&!W.contains(S)||W.classList.contains("kanuni-pivot-field-chip")&&W.closest('[data-drop-id="chooser-chooser"]'))continue;let I=W.getBoundingClientRect();if(I.width===0&&I.height===0||s<I.left||s>I.right||E<I.top||E>I.bottom)continue;let N=W.getAttribute("data-drop-id"),q=N.replace("chooser-","");if(q.endsWith("-ghost-end"))L={id:N,el:W};else if(nt.includes(q))A=A??{id:N,el:W};else {let ye=I.width*I.height;(!f||ye<f.size)&&(f={id:N,el:W,size:ye});}}return f??L??A}function x(s,E){let f=h(s,E);if(!f)return n(null,null,null),{overId:null};let L=f.id.replace("chooser-",""),A=e.getFields().find(W=>W.id===L),S=nt.includes(L)||L.endsWith("-ghost-end")?L.replace("-ghost-end",""):A?.area,H=!!(t.activeId&&S&&e.controller.canMoveFieldTo&&!e.controller.canMoveFieldTo(t.activeId,S));if(l?.classList.toggle("is-drop-denied",H),l&&(l.style.borderColor=H?"var(--pivot-danger)":"var(--pivot-primary)"),H)return n(null,null,null),{overId:null};if(nt.includes(L)||L.endsWith("-ghost-end"))return n(null,S,"append"),{overId:f.id};if(A){let W=A.area==="chooser"?"vertical":"horizontal",I=f.el.getBoundingClientRect(),N=e.controller.calculateDropIntent(s,E,{top:I.top,left:I.left,width:I.width,height:I.height},t.intent,false,W);return n(L,A.area??null,N),{overId:f.id}}return {overId:f.id}}let m=null,u=s=>{if(!(i&&s.pointerId!==i.pointerId)&&!(a&&s.pointerId!==a.pointerId)){if(i){let E=s.clientX-i.startX,f=s.clientY-i.startY,L=Math.hypot(E,f);if(i.isTouch){if(!i.held&&L>8){i.holdTimer&&clearTimeout(i.holdTimer),i=null;return}if(!i.held)return}else if(L<8)return;y();}a&&(s.preventDefault(),T(s.clientX,s.clientY),m=x(s.clientX,s.clientY).overId);}},w=s=>{if(!(i&&s.pointerId!==i.pointerId)&&!(a&&s.pointerId!==a.pointerId)){if(i){i.holdTimer&&clearTimeout(i.holdTimer),i=null,document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",c),document.removeEventListener("keydown",p,true);return}a&&P(x(s.clientX,s.clientY).overId??m);}},r=s=>{(a||i?.held)&&s.cancelable&&s.preventDefault();},c=()=>P(null),p=s=>{s.key==="Escape"&&a&&(s.stopPropagation(),P(null));},b=s=>{if(e.disabled?.()||i||a||s.button!==0&&s.pointerType==="mouse")return;let E=s.target;if(E.closest("button, input, .kanuni-pivot-chip-btn"))return;let f=E.closest(".kanuni-pivot-field-chip[data-drop-id]");if(!f||f.getAttribute("data-drag-scope")==="grip"&&!E.closest("[data-drag-grip]"))return;let L=f.getAttribute("data-drop-id"),A=s.pointerType==="touch";i={el:f,dropId:L,pointerId:s.pointerId,startX:s.clientX,startY:s.clientY,isTouch:A,held:false,holdTimer:A?setTimeout(()=>{i&&(i.held=true,y());},Math.max(0,e.touchDragDelay?.()??200)):null},document.addEventListener("pointermove",u),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",c),document.addEventListener("keydown",p,true);},d=new Set;function v(){for(let s of d)s.isConnected||(s.removeEventListener("pointerdown",b),d.delete(s));for(let s of e.roots())d.has(s)||(d.add(s),s.addEventListener("pointerdown",b));}return v(),document.addEventListener("touchmove",r,{passive:false}),{getState:()=>({...t}),refreshRoots:v,rootCount:()=>d.size,destroy(){a&&P(null),i?.holdTimer&&clearTimeout(i.holdTimer),i=null;for(let s of d)s.removeEventListener("pointerdown",b);d.clear(),document.removeEventListener("touchmove",r),document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",c),document.removeEventListener("keydown",p,true);}}}function he(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function $t(e){let{portal:t}=e;function n(y,h,x,m=false){let u=he(`${m?"kanuni-pivot-dropdown-item-danger":"kanuni-pivot-dropdown-item"} pivot-flex pivot-items-center`,"button");return u.type="button",y&&u.appendChild(X(y,16)),u.appendChild(document.createTextNode(" "+h)),u.addEventListener("click",()=>{t.closePopup(),x();}),u}function i(y,h,x){let m=()=>window.visualViewport?.removeEventListener("resize",u),u=()=>{if(!y.isConnected){m();return}let w=y.offsetWidth,r=y.scrollHeight||y.offsetHeight;if(w===0&&r===0)return;let c=pivotgridCore.placePopup({x:h,y:x},{width:w,height:r});y.style.top=`${c.top}px`,y.style.left=`${c.left}px`,y.style.maxHeight=`${c.maxHeight}px`;};return u(),window.visualViewport?.addEventListener("resize",u),m}let a=null;function o(y,h,x){let m=null,u=null,w=()=>{m?.remove(),m=null,a===w&&(a=null);},r=()=>{if(m)return;a&&a(),a=w,m=he("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");let d=y.getBoundingClientRect(),v=pivotgridCore.placePopup({x:d.right+4,y:d.top},{width:160,height:0},{altX:d.left-4});if(Object.assign(m.style,{position:"fixed",top:`${v.top}px`,left:`${v.left}px`,minWidth:"160px",zIndex:"10000"}),m.addEventListener("contextmenu",s=>s.preventDefault()),m.addEventListener("mouseenter",()=>{u&&clearTimeout(u);}),m.addEventListener("mouseleave",()=>{u=setTimeout(w,200);}),x(m),h.appendChild(m),m.offsetHeight){let s=pivotgridCore.placePopup({x:d.right+4,y:d.top},{width:m.offsetWidth,height:m.scrollHeight},{altX:d.left-4});Object.assign(m.style,{top:`${s.top}px`,left:`${s.left}px`,maxHeight:`${s.maxHeight}px`,overflowY:"auto"});}},c=0,p=false,b=()=>Date.now()-c<1e3;y.addEventListener("pointerdown",d=>{d.pointerType!=="mouse"&&(c=Date.now());}),y.addEventListener("mouseenter",()=>{u&&clearTimeout(u),!b()&&(m||(p=true),r());}),y.addEventListener("mouseleave",()=>{b()||(u=setTimeout(w,200));}),y.addEventListener("click",d=>{if(d.detail>0&&p&&m){p=false;return}p=false,m?w():r();});}function l(y,h,x){let m=he("kanuni-pivot-dropdown-item pivot-flex pivot-items-center pivot-justify-between","button");m.type="button";let u=he("pivot-flex pivot-items-center pivot-gap-2","span");return u.appendChild(X(y,16)),u.appendChild(document.createTextNode(" "+h)),m.appendChild(u),m.appendChild(X(x?"chevron-left":"chevron-right",14)),m}function C(y){y.addEventListener("keydown",h=>{let x=[...y.querySelectorAll("button:not([disabled])")];if(x.length===0)return;let m=x.indexOf(document.activeElement),u=-1;h.key==="ArrowDown"?u=m<0?0:(m+1)%x.length:h.key==="ArrowUp"?u=m<0?x.length-1:(m-1+x.length)%x.length:h.key==="Home"?u=0:h.key==="End"&&(u=x.length-1),!(u<0)&&(h.preventDefault(),x[u].focus());});}function T(y,h,x,m,u){let w=e.getFields().find(d=>d.id===x);if(!w)return;let{t:r,rtl:c}=e.getI18n(),p=e.getFields().filter(d=>d.area==="row").sort((d,v)=>(d.areaIndex||0)-(v.areaIndex||0)),b=m!==void 0&&p.length>0&&w.area==="data";t.openPopup(d=>{let v=he("kanuni-pivot-dropdown-menu pivot-animate-zoom-in pivot-flex-col");Object.assign(v.style,{position:"fixed",top:`${h}px`,left:`${y}px`,maxHeight:`${Math.max(0,pivotgridCore.popupViewport().height-16)}px`,overflowY:"auto",overflowX:"hidden",width:"220px",zIndex:"9999"}),v.addEventListener("contextmenu",f=>f.preventDefault());let s=he("kanuni-pivot-report-section-title");if(Object.assign(s.style,{position:"sticky",top:"0",zIndex:"10"}),s.textContent=w.caption??w.id,v.appendChild(s),b){let f=he("kanuni-pivot-report-section-title");f.style.marginTop="4px",f.textContent=r("sortByThisColumn"),v.appendChild(f);for(let L of p)v.appendChild(n("arrow-down-a-z",r("sortFieldByThisColumn").replace("{0}",L.caption||L.id),()=>e.controller.sortFieldBySummary(L.id,w.id,m)));v.appendChild(he("kanuni-pivot-divider")),v.appendChild(n("x",r("removeAllSorting"),()=>e.controller.clearAllSorting(),true));}else {v.appendChild(n("arrow-down-a-z",r("sortAsc"),()=>e.controller.sortField(w.id,"asc"))),v.appendChild(n("arrow-up-z-a",r("sortDesc"),()=>e.controller.sortField(w.id,"desc"))),w.sortOrder&&v.appendChild(n("x",r("clearSort"),()=>e.controller.sortField(w.id,void 0),true)),e.openFilter&&w.area!=="data"&&v.appendChild(n("filter",r("filterField"),()=>e.openFilter(w.id,y,h))),e.openCondition&&(w.area==="row"||w.area==="column")&&v.appendChild(n("filter",r("conditionFilter")+"\u2026",()=>e.openCondition(w.id))),v.appendChild(he("kanuni-pivot-divider"));let f=l("list",r("order"),c);v.appendChild(f),o(f,d,S=>{let H=[["start",r("moveToStart"),"chevrons-left"],["left",r("moveToLeft"),"chevron-left"],["right",r("moveToRight"),"chevron-right"],["end",r("moveToEnd"),"chevrons-right"]];for(let[W,I,N]of H)S.appendChild(n(N,I,()=>e.controller.moveField(w.id,W)));});let L=[["row",r("rowArea"),"rows-3"],["column",r("columnArea"),"columns-3"],["data",r("dataArea"),"bar-chart-3"],["filter",r("filterArea"),"filter"]].filter(([S])=>S!==w.area);if(L.length>0){let S=l("move",r("moveToArea"),c);v.appendChild(S),o(S,d,H=>{for(let[W,I,N]of L){let q=n(N,I,()=>e.controller.changeFieldArea(w.id,W));e.controller.canMoveFieldTo(w.id,W)||(q.disabled=true),H.appendChild(q);}});}e.openFieldChooser&&v.appendChild(n("list",r("showFieldList"),e.openFieldChooser)),v.appendChild(n("eye-off",r("hide"),()=>e.controller.removeField(w.id)));let A=e.customContextMenuItems?.(w);if(A&&A.length>0){v.appendChild(he("kanuni-pivot-divider"));for(let S of A){let H=n(null,S.label,S.action);S.icon&&H.insertBefore(S.icon(),H.firstChild),v.appendChild(H);}}v.appendChild(he("kanuni-pivot-divider")),w.isCalculated&&e.onEditCalculatedField&&v.appendChild(n("calculator",r("editCalculation"),()=>e.onEditCalculatedField(w))),v.appendChild(n("settings",r("fieldSettings"),()=>e.openSettings(w.id)));}d.appendChild(v);let E=i(v,y,h);return u?(C(d),v.querySelector("button")?.focus(),()=>{E(),e.gridRoot?.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${x}"]`)?.focus({preventScroll:true});}):E});}function M(y,h){let{t:x}=e.getI18n();t.openPopup(m=>{let u=he("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");Object.assign(u.style,{position:"fixed",zIndex:"301",width:"224px",fontSize:"14px",left:`${pivotgridCore.placePopup({x:y,y:h},{width:224,height:120}).left}px`,top:`${pivotgridCore.placePopup({x:y,y:h},{width:224,height:120}).top}px`}),u.addEventListener("contextmenu",p=>p.preventDefault());let w=he("kanuni-pivot-report-section-title");w.textContent=x("viewOptions"),u.appendChild(w);let r=e.getLayout(),c=(p,b,d)=>{let v=he("pivot-w-full pivot-flex pivot-items-center pivot-justify-between","button");v.type="button",Object.assign(v.style,{padding:"6px 12px",textAlign:"left"}),v.addEventListener("mouseenter",()=>{v.style.backgroundColor="var(--pivot-surface-hover)";}),v.addEventListener("mouseleave",()=>{v.style.backgroundColor="transparent";});let s=he("","span");s.textContent=p;let E=he("pivot-text-xs pivot-text-muted pivot-font-medium","span");return E.textContent=x(b?"show":"hide"),v.append(s,E),v.addEventListener("click",()=>{d(),t.closePopup();}),v};u.appendChild(c(x("filterArea"),r.showFilterArea===false,()=>e.controller.setLayout({showFilterArea:r.showFilterArea===false}))),u.appendChild(c(x("footerArea"),r.showFooter===false,()=>e.controller.setLayout({showFooter:r.showFooter===false}))),m.appendChild(u);});}function P(y){let{t:h}=e.getI18n(),x=()=>{let m=e.getEngineTrees();if(!m)return [];let u=[],w=(r,c)=>{if(r)for(let p of r)c>=y.depth&&u.push(p.key),p.children&&w(p.children,c+1);};return w(y.type==="row"?m.rowTree:m.colTree,0),u};t.openPopup(m=>{let u=he("");Object.assign(u.style,{position:"fixed",inset:"0",zIndex:"9998"}),u.addEventListener("click",()=>t.closePopup()),u.addEventListener("contextmenu",c=>{c.preventDefault(),t.closePopup();});let w=he("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");Object.assign(w.style,{position:"fixed",left:`${Math.min(y.x,window.innerWidth-180)}px`,top:`${Math.min(y.y,window.innerHeight-200)}px`,zIndex:"9999",minWidth:"160px"}),w.addEventListener("contextmenu",c=>c.preventDefault());let r=(c,p)=>{let b=he("kanuni-pivot-dropdown-item pivot-state-hover","button");return b.type="button",Object.assign(b.style,{paddingLeft:"32px",paddingRight:"24px"}),b.textContent=c,b.addEventListener("click",d=>{d.stopPropagation(),t.closePopup(),p();}),b};w.appendChild(r(y.isExpanded?h("collapse"):h("expand"),()=>{y.type==="row"?e.controller.toggleExpanded(y.path):e.controller.toggleColExpanded(y.path);})),w.appendChild(he("kanuni-pivot-dropdown-divider")),w.appendChild(r(h("expandAll"),()=>{let c=x();y.type==="row"?e.controller.expandPaths(c):e.controller.expandColPaths(c);})),w.appendChild(r(h("collapseAll"),()=>{let c=x();y.type==="row"?e.controller.collapsePaths(c):e.controller.collapseColPaths(c);})),m.append(u,w);});}return {openFieldMenu:T,openGlobalMenu:M,openNodeMenu:P,close:()=>t.closePopup()}}function Ce(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var Pe=(e,...t)=>{let n=Ce("kanuni-pivot-form-group"),i=Ce("kanuni-pivot-form-label","label");return i.textContent=e,n.append(i,...t),n},Re=(e,t)=>{let n=Ce("kanuni-pivot-select","select");for(let[i,a]of e){let o=document.createElement("option");o.value=i,o.textContent=a,n.appendChild(o);}return n.value=t,n},Ke=(e,t)=>{let n=Ce("kanuni-pivot-input","input");return n.type=e,n.value=t,n},Bt=(...e)=>{let t=Ce("");Object.assign(t.style,{display:"flex",gap:"8px",marginTop:"6px"});for(let n of e)Object.assign(n.style,{flex:"1 1 0",minWidth:"0"});return t.append(...e),t},_n=[["equals","opEquals"],["notEquals","opNotEquals"],["contains","opContains"],["notContains","opNotContains"],["startsWith","opStartsWith"],["endsWith","opEndsWith"]],Xn=[[">","opGreater"],[">=","opGreaterOrEqual"],["<","opLess"],["<=","opLessOrEqual"],["=","opEquals"],["!=","opNotEquals"],["between","opBetween"],["notBetween","opNotBetween"]];function Nt(e){function t(a,o,l,C){let{t:T}=e.getI18n();e.portal.openPopup(M=>{let P=Ce("kanuni-pivot-modal-overlay pivot-animate-fade-in");P.addEventListener("click",()=>e.portal.closePopup());let y=Ce("kanuni-pivot-modal pivot-animate-zoom-in");y.style.width="400px",y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",a);let h=Ce("kanuni-pivot-modal-header"),x=Ce("kanuni-pivot-modal-title","h2");x.textContent=a;let m=Ce("kanuni-pivot-modal-close","button");m.type="button",m.setAttribute("aria-label",T("cancel")),m.appendChild(X("x",20)),m.addEventListener("click",()=>e.portal.closePopup()),h.append(x,m);let u=Ce("kanuni-pivot-modal-footer"),w=Ce("kanuni-pivot-btn kanuni-pivot-btn--outline","button");w.type="button",w.textContent=T("cancel"),w.addEventListener("click",()=>e.portal.closePopup());let r=Ce("kanuni-pivot-btn kanuni-pivot-btn--primary","button");r.type="button",r.appendChild(X("check",16)),r.appendChild(document.createTextNode(" "+T("ok"))),r.addEventListener("click",()=>{l()!==false&&e.portal.closePopup();}),u.append(w,r),y.append(h,o,u),M.append(P,y),C.focus();});}function n(a){let o=e.getFields().find(w=>w.id===a);if(!o)return;let{t:l}=e.getI18n(),C=Ce("kanuni-pivot-modal-body pivot-custom-scrollbar"),T=Ke("text",o.caption??"");C.appendChild(Pe(l("caption"),T));let M=o.area==="data"||o.area==="chooser",P=o.area==="row"||o.area==="column"||o.area==="filter"||o.area==="chooser",y=null,h=null,x=null,m=(...w)=>w.map(r=>[r,l(r)]),u=(...w)=>{let r=o.summaryType;return m(...r&&!w.includes(r)?[r,...w]:w)};M&&o.dataType&&o.dataType!=="number"&&(y=Re(u("count","distinct"),String(o.summaryType||"count")),C.appendChild(Pe(l("summaryType"),y))),M&&o.dataType==="number"&&(y=Re(u("sum","count","avg","min","max","distinct"),String(o.summaryType||"sum")),C.appendChild(Pe(l("summaryType"),y)),h=Re([["absolute",l("absoluteValue")],...m("percentOfTotal","percentOfColumnTotal","percentOfRowTotal","percentOfParentRowTotal","percentOfParentColumnTotal","runningTotal","difference","percentDifference")],String(o.summaryDisplayMode||"absolute")),C.appendChild(Pe(l("displayMode"),h))),P&&o.dataType==="date"&&(x=Re([["",l("none")],...m("year","quarter","month","week","day")],String(o.groupInterval||"")),C.appendChild(Pe(l("groupInterval"),x))),t(l("fieldSettings"),C,()=>{e.save({...o,caption:T.value,summaryType:y?.value||o.summaryType,summaryDisplayMode:h?.value??o.summaryDisplayMode,groupInterval:x?x.value||void 0:o.groupInterval});},T);}function i(a){let o=e.getFields(),l=o.find(d=>d.id===a);if(!l)return;let{t:C}=e.getI18n(),T=Ce("kanuni-pivot-modal-body pivot-custom-scrollbar"),M=d=>[["",C("none")],...d.map(([v,s])=>[v,C(s)])],P=l.labelFilter,y=Re(M(_n),P?.operator??"");y.setAttribute("data-condition-label-op",""),y.setAttribute("aria-label",C("caption"));let h=Ke("text",P?.value??"");h.setAttribute("data-condition-label-value",""),h.placeholder=C("builderValuePlaceholder"),h.setAttribute("aria-label",C("builderValuePlaceholder")),T.appendChild(Pe(C("caption"),Bt(y,h)));let x=o.filter(d=>d.area==="data").sort((d,v)=>(d.areaIndex||0)-(v.areaIndex||0)),m=l.valueFilter,u=Re(x.map(d=>[d.id,d.caption||d.id]),x.some(d=>d.id===m?.dataField)?m.dataField:x[0]?.id??"");u.setAttribute("data-condition-value-field",""),u.setAttribute("aria-label",C("dataArea"));let w=Re(M(Xn),m?.operator??"");w.setAttribute("data-condition-value-op",""),w.setAttribute("aria-label",C("dataArea"));let r=Ke("number",m?String(m.value):"");r.setAttribute("data-condition-value","");let c=Ke("number",m?.value2!==void 0?String(m.value2):"");c.setAttribute("data-condition-value2","");for(let d of [r,c])d.setAttribute("aria-label",C("builderValuePlaceholder"));x.length>0&&T.appendChild(Pe(C("dataArea"),u,Bt(w,r,c)));let p=()=>{h.disabled=y.value==="",r.disabled=w.value==="",c.style.display=w.value==="between"||w.value==="notBetween"?"":"none";};y.addEventListener("change",p),w.addEventListener("change",p),p();let b=d=>(d.setAttribute("aria-invalid","true"),d.focus(),false);t(`${C("conditionFilter")}: ${l.caption||l.id}`,T,()=>{for(let s of [h,r,c])s.removeAttribute("aria-invalid");let d;if(y.value){if(h.value==="")return b(h);d={operator:y.value,value:h.value,...P?.caseSensitive?{caseSensitive:true}:{}};}let v=x.length>0?void 0:m;if(w.value&&x.length>0){let s=c.style.display!=="none",E=r.value===""?NaN:Number(r.value),f=c.value===""?NaN:Number(c.value);if(!Number.isFinite(E))return b(r);if(s&&!Number.isFinite(f))return b(c);v={dataField:u.value,operator:w.value,value:E,...s?{value2:f}:{}};}e.save({...l,labelFilter:d,valueFilter:v});},y);}return {open:n,openCondition:i}}function ne(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Un(e){let t=e.isCalculated?"settings-2":e.dataType==="number"?"hash":e.dataType==="date"?"calendar":e.dataType==="boolean"?"filter":"type";return X(t,12,"var(--pivot-primary)")}function Wt(e){let t=null,n=null,i=null,a="",o={x:0,y:0},l={width:700,height:550},C=()=>window.innerWidth<=768,T=["fullscreenchange","webkitfullscreenchange"],M=()=>{if(!t)return;let d=Ve();t.parentElement!==d&&d.appendChild(t);},P=()=>{n&&(y(),C()||(o={x:Math.min(o.x,Math.max(0,window.innerWidth-l.width)),y:Math.min(o.y,Math.max(0,window.innerHeight-l.height))},y()));};function y(){n&&(C()?Object.assign(n.style,{position:"fixed",inset:"0",width:"100%",height:"100%",left:"",top:"",borderRadius:"0",zIndex:"100",transform:"none",padding:"0"}):Object.assign(n.style,{position:"fixed",inset:"",left:`${o.x}px`,top:`${o.y}px`,width:`${l.width}px`,height:`${l.height}px`,maxWidth:"95vw",maxHeight:"95vh",transform:"none",padding:"0",zIndex:"100",boxShadow:"var(--pivot-shadow-lg)",borderRadius:""}));}function h(d,v){let{t:s}=e.getI18n(),E=ne("kanuni-pivot-field-chip");E.setAttribute("data-drop-id",`chooser-${d.id}`),E.setAttribute("data-drag-scope","grip"),E.style.position="relative";let f=ne("");if(f.setAttribute("data-drag-grip",""),Object.assign(f.style,{color:"var(--pivot-text-muted)",cursor:"grab",flexShrink:"0",opacity:"0.5"}),f.appendChild(X("grip-vertical",14)),E.appendChild(f),v){let I=ne("kanuni-pivot-checkbox","input");I.type="checkbox",I.checked=d.area!=="chooser",I.style.flexShrink="0",I.addEventListener("change",()=>{I.checked?e.controller.showFields([d.id]):e.controller.removeField(d.id);}),E.appendChild(I);}E.appendChild(Un(d));let L=ne("pivot-truncate","span");Object.assign(L.style,{flex:"1",color:"var(--pivot-text)",textAlign:"left"}),L.textContent=d.caption??d.id;let A=d.area==="data"&&d.summaryType?pivotgridCore.summaryTypeLabel(String(d.summaryType),s):"";if(A){let I=ne("","span");Object.assign(I.style,{fontSize:"10px",marginLeft:"4px",backgroundColor:"color-mix(in srgb, var(--pivot-primary) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--pivot-primary) 45%, transparent)",color:"var(--pivot-text)",padding:"0 4px",borderRadius:"4px",fontWeight:"700"}),I.textContent=A,L.appendChild(I);}E.appendChild(L);let S=!!d.filterValues&&d.filterValues.size>0,H=ne(`kanuni-pivot-field-chip-actions${S?" is-filtered":""}`);if(d.area!=="data"){let I=ne("kanuni-pivot-chip-btn","button");I.type="button",I.title=s("filterField"),S&&Object.assign(I.style,{color:"var(--pivot-danger)",backgroundColor:"color-mix(in srgb, var(--pivot-danger) 10%, transparent)"}),I.appendChild(X("filter",12)),I.addEventListener("click",N=>{N.stopPropagation(),e.onFilterClick(N.clientX,N.clientY,d.id);}),H.appendChild(I);}if(d.isCalculated){let I=ne("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","button");I.type="button",I.title=s("deletePermanently"),I.appendChild(X("trash",12)),I.addEventListener("click",N=>{N.stopPropagation(),e.controller.deleteField(d.id);}),H.appendChild(I);}let W=ne("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","button");return W.type="button",W.title=s("removeFromArea"),W.appendChild(X("x",12)),W.addEventListener("click",I=>{I.stopPropagation(),e.controller.removeField(d.id);}),H.appendChild(W),E.appendChild(H),E}function x(d,v,s,E,f){let L=ne("");if(Object.assign(L.style,{height:"100%",display:"flex",flexDirection:"column",transition:"background-color 0.2s"}),s!==null){let H=ne("");Object.assign(H.style,{fontSize:"12px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--pivot-text-muted)",backgroundColor:"color-mix(in srgb, var(--pivot-surface-header) 30%, transparent)",padding:"8px 12px",borderBottom:"1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"}),H.textContent=s,L.appendChild(H);}let A=ne("pivot-custom-scrollbar");if(A.setAttribute("data-drop-id",`chooser-${d}`),A.setAttribute("data-drop-kind","list"),Object.assign(A.style,{maxHeight:C()?"none":"100%",flex:"1",padding:"8px",minHeight:"80px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"6px",alignItems:v.length===0?"center":"stretch",justifyContent:v.length===0?"center":"flex-start"}),v.length===0){let H=ne("");Object.assign(H.style,{fontSize:"12px",color:"color-mix(in srgb, var(--pivot-text-muted) 70%, transparent)",fontStyle:"italic",textAlign:"center",width:"100%"}),H.textContent=E,A.appendChild(H);}for(let H of v)A.appendChild(h(H,f));let S=ne("");return S.setAttribute("data-drop-id",`chooser-${d}-ghost-end`),S.setAttribute("data-ghost-populated",v.length>0?"1":"0"),Object.assign(S.style,{width:"100%",minHeight:"24px",transition:"background-color 0.2s",borderRadius:"var(--pivot-border-radius-sm)"}),A.appendChild(S),L.appendChild(A),L}function m(){let d=new Map;return e.getFields().map(v=>{let s=v.caption||v.id||"";if(d.has(s)){let E=d.get(s)+1;return d.set(s,E),{...v,caption:`${s} (${E})`}}return d.set(s,1),v})}function u(){let{locale:d}=e.getI18n(),v=[...m()].sort((E,f)=>(E.caption||"").toLowerCase().localeCompare((f.caption||"").toLowerCase(),d||"en"));if(!a)return v;let s=a.toLowerCase();return v.filter(E=>(E.caption||"").toLowerCase().includes(s))}function w(){let d=u().filter(v=>v.area==="chooser").map(v=>v.id);d.length!==0&&e.controller.showFields(d);}function r(){if(!i)return;let{t:d,locale:v}=e.getI18n(),s=new Map;for(let K of i.querySelectorAll('[data-drop-kind="list"]')){let R=K.getAttribute("data-drop-id");R&&K.scrollTop>0&&s.set(R,K.scrollTop);}let E=m(),f=u(),L=K=>E.filter(R=>R.area===K).sort((R,k)=>(R.areaIndex||0)-(k.areaIndex||0));i.textContent="";let A=C(),S=ne(A?"w-full flex flex-col border-b border-border bg-surface":"w-full md:w-[40%] flex flex-col border-b md:border-b-0 md:border-r border-border bg-surface");A&&(S.style.flexShrink="0");let H=ne("p-3 border-b border-border/60 bg-surface/80"),W=ne("relative"),I=X("search",16);I.setAttribute("class","text-muted-fg opacity-60"),Object.assign(I.style,{position:"absolute",top:"50%",transform:"translateY(-50%)",pointerEvents:"none"}),I.style.setProperty("inset-inline-start","10px");let N=ne("w-full bg-surface-hover/50 border-border rounded-md text-[13px] kanuni-pivot-input","input");N.type="text",N.placeholder=d("search"),N.value=a,N.style.setProperty("padding-inline-start","34px"),N.addEventListener("input",()=>{a=N.value,r();let K=i?.querySelector('input[type="text"]');K?.focus(),K?.setSelectionRange(K.value.length,K.value.length);}),W.append(I,N),H.appendChild(W),S.appendChild(H);let q=ne(A?"p-2":"flex-1 overflow-hidden p-2"),ye=ne("");Object.assign(ye.style,{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"});let se=ne("text-[11px] font-bold uppercase tracking-wider text-muted-fg/80 mb-2 px-1");se.textContent=d("allFields");let ae=ne("kanuni-pivot-popup-action-btn kanuni-pivot-chooser-select-all","button");ae.type="button",ae.textContent=d("selectAll"),ae.style.color="var(--pivot-primary)",ae.disabled=f.every(K=>K.area!=="chooser"),ae.addEventListener("click",w),ye.append(se,ae),q.appendChild(ye),q.appendChild(x("chooser",f,null,d("noItems"),true)),S.appendChild(q);let ge=ne(A?"w-full p-3 bg-surface-sunken/30":"w-full md:w-[60%] flex-1 overflow-y-auto custom-scrollbar p-3 bg-surface-sunken/30");A&&(ge.style.flexShrink="0");let xe=ne(A?"grid grid-cols-1 sm:grid-cols-2 gap-3":"grid grid-cols-1 sm:grid-cols-2 gap-3 h-full auto-rows-fr"),ce=[["filter",d("filterArea")],["column",d("columnArea")],["row",d("rowArea")],["data",d("dataArea")]];for(let[K,R]of ce){let k=ne("border border-border/80 rounded-md shadow-sm bg-surface overflow-hidden flex flex-col transition-colors");A&&(k.style.minHeight="140px"),k.appendChild(x(K,L(K),R,d("dropHere"),false)),xe.appendChild(k);}ge.appendChild(xe),i.append(S,ge);for(let[K,R]of s){let k=i.querySelector(`[data-drop-id="${K}"][data-drop-kind="list"]`);k&&(k.scrollTop=R);}}function c(){if(t)return;let{t:d}=e.getI18n();t=He(e.gridRoot);let v=ne("fixed inset-0 z-[100] kanuni-pivot-chooser-backdrop overflow-auto pointer-events-auto");v.addEventListener("click",p),n=ne("flex flex-col bg-surface shadow-2xl border border-border overflow-hidden rounded-lg kanuni-pivot-field-chooser"),n.addEventListener("click",S=>S.stopPropagation()),C()||(l={width:Math.min(700,window.innerWidth-32),height:Math.min(550,window.innerHeight-32)},o={x:Math.max(0,(window.innerWidth-l.width)/2),y:Math.max(0,(window.innerHeight-l.height)/2)}),y();let s=ne("pivot-field-chooser__header flex items-center justify-between p-3 border-b border-border bg-surface-header/90");C()||(s.style.cursor="move");let E=ne("text-[15px] font-semibold m-0 flex items-center gap-2 select-none","h3");E.appendChild(X("grip-horizontal",18,"var(--pivot-text-muted)")),E.appendChild(document.createTextNode(d("allFields")));let f=ne("btn-icon rounded-full p-1.5 kanuni-pivot-chip-btn","button");f.type="button",f.setAttribute("aria-label",d("cancel")),f.appendChild(X("x",18)),f.addEventListener("pointerdown",S=>S.stopPropagation()),f.addEventListener("click",p),s.append(E,f);let L=null;s.addEventListener("pointerdown",S=>{C()||S.target.closest(".kanuni-pivot-field-chip, button, input")||(L={px:S.clientX,py:S.clientY,x:o.x,y:o.y},s.setPointerCapture?.(S.pointerId));}),s.addEventListener("pointermove",S=>{L&&(o={x:Math.max(0,L.x+S.clientX-L.px),y:Math.max(0,L.y+S.clientY-L.py)},y());});let A=S=>{L=null,s.releasePointerCapture?.(S.pointerId);};if(s.addEventListener("pointerup",A),s.addEventListener("pointercancel",A),i=ne(C()?"flex flex-1 flex-col bg-surface-sunken/30":"flex flex-1 overflow-hidden flex-col md:flex-row bg-surface-sunken/30"),C()&&(i.setAttribute("data-chooser-scroll",""),Object.assign(i.style,{minHeight:"0",overflowY:"auto",touchAction:"pan-y",overscrollBehavior:"contain"})),r(),n.append(s,i),!C()){let S=[["n","n-resize",{top:"0",left:"0",right:"0",height:"6px"}],["s","s-resize",{bottom:"0",left:"0",right:"0",height:"6px"}],["w","w-resize",{top:"0",bottom:"0",left:"0",width:"6px"}],["e","e-resize",{top:"0",bottom:"0",right:"0",width:"6px"}],["nw","nw-resize",{top:"0",left:"0",width:"12px",height:"12px"}],["ne","ne-resize",{top:"0",right:"0",width:"12px",height:"12px"}],["sw","sw-resize",{bottom:"0",left:"0",width:"12px",height:"12px"}],["se","se-resize",{bottom:"0",right:"0",width:"12px",height:"12px"}]];for(let[H,W,I]of S){let N=ne("kanuni-pivot-chooser-resize");N.setAttribute("data-resize-dir",H),Object.assign(N.style,{position:"absolute",zIndex:H.length===2?"51":"50",cursor:W},I);let q=null;N.addEventListener("pointerdown",se=>{se.stopPropagation(),q={px:se.clientX,py:se.clientY,w:l.width,h:l.height,x:o.x,y:o.y},N.setPointerCapture?.(se.pointerId);}),N.addEventListener("pointermove",se=>{if(!q)return;let ae=se.clientX-q.px,ge=se.clientY-q.py,xe=q.w,ce=q.h,K=q.x,R=q.y;H.includes("e")&&(xe=q.w+ae),H.includes("s")&&(ce=q.h+ge),H.includes("w")&&(xe=q.w-ae,xe>=400&&(K=q.x+ae)),H.includes("n")&&(ce=q.h-ge,ce>=400&&(R=q.y+ge)),l={width:Math.max(400,xe),height:Math.max(400,ce)},o={x:Math.max(0,K),y:Math.max(0,R)},y();});let ye=se=>{q=null,N.releasePointerCapture?.(se.pointerId);};N.addEventListener("pointerup",ye),N.addEventListener("pointercancel",ye),n.appendChild(N);}}v.appendChild(n),t.appendChild(v),Ve().appendChild(t),Ie(t),window.addEventListener("resize",P);for(let S of T)document.addEventListener(S,M);e.onOpenChanged?.(true);}function p(){if(t){window.removeEventListener("resize",P);for(let d of T)document.removeEventListener(d,M);t.remove(),t=null,n=null,i=null,a="",e.onOpenChanged?.(false);}}function b(){if(!t)return;let d={...o},v={...l};p(),c(),o=d,l=v,y();}return {open:c,close:p,toggle:()=>t?p():c(),isOpen:()=>t!==null,repaint:r,relocalize:b,getHost:()=>t,destroy:p}}function oe(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Gt(e){let t=false,n=null,i=l=>{t&&n&&!n.contains(l.target)&&(t=false,e.requestRepaint());};document.addEventListener("mousedown",i);function a(l,C){let{t:T}=e.getI18n();e.portal.openPopup(M=>{let P=oe("kanuni-pivot-modal-overlay");P.addEventListener("click",()=>e.portal.closePopup());let y=oe("kanuni-pivot-modal pivot-animate-zoom-in");Object.assign(y.style,{display:"flex",flexDirection:"column",gap:"16px",padding:"24px"});let h=oe("pivot-flex pivot-flex-col");h.style.gap="6px";let x=oe("pivot-flex pivot-items-center pivot-justify-between"),m=oe("kanuni-pivot-modal-title","h3");m.textContent=l;let u=oe("kanuni-pivot-modal-close","button");u.type="button",u.setAttribute("aria-label",T("close")),u.style.padding="6px",u.appendChild(X("x",16)),u.addEventListener("click",()=>e.portal.closePopup()),x.append(m,u);let w=oe("kanuni-pivot-modal-description","p");w.textContent=T("saveReportDescription"),h.append(x,w);let r=oe("pivot-flex pivot-flex-col pivot-gap-4","form"),c=oe("pivot-flex pivot-flex-col pivot-gap-2"),p=oe("kanuni-pivot-form-label","label");p.textContent=T("reportName");let b=oe("kanuni-pivot-input","input");b.type="text",b.placeholder=T("reportNamePlaceholder"),b.required=true,b.value=C,c.append(p,b);let d=oe("pivot-flex pivot-items-center pivot-gap-2"),v=oe("kanuni-pivot-input","input");v.type="checkbox",Object.assign(v.style,{width:"16px",height:"16px"});let s=oe("kanuni-pivot-form-label","label");Object.assign(s.style,{margin:"0",cursor:"pointer"}),s.textContent=T("setAsDefault"),s.addEventListener("click",()=>{v.checked=!v.checked;}),d.append(v,s);let E=oe("kanuni-pivot-modal-footer");Object.assign(E.style,{marginTop:"8px",paddingTop:"16px",borderTop:"1px solid var(--pivot-border)",display:"flex",justifyContent:"flex-end",gap:"8px"});let f=oe("kanuni-pivot-btn kanuni-pivot-btn--outline","button");f.type="button",f.textContent=T("cancel"),f.addEventListener("click",()=>e.portal.closePopup());let L=oe("kanuni-pivot-btn kanuni-pivot-btn--primary","button");L.type="submit",L.disabled=!C.trim(),L.appendChild(X("save",16)),L.appendChild(document.createTextNode(" "+T("save"))),b.addEventListener("input",()=>{L.disabled=!b.value.trim();}),E.append(f,L),r.addEventListener("submit",A=>{A.preventDefault();let S=b.value.trim();S&&(e.controller.saveReport(S,v.checked),e.portal.closePopup());}),r.append(c,d,E),y.append(h,r),M.append(P,y),b.focus();});}function o(l){let{t:C}=e.getI18n();n=l;let T=e.getReports(),M=e.getActiveReportId(),P=T.find(w=>w.id===M),y=oe(`kanuni-pivot-report-btn ${t?"kanuni-pivot-report-btn--open":M?"kanuni-pivot-report-btn--active":"kanuni-pivot-report-btn--default"}`,"button");y.type="button",y.title=C("viewsAndReports"),y.appendChild(X("bookmark",15));let h=oe("pivot-truncate","span");if(h.style.maxWidth="120px",h.textContent=P?P.name:C("views"),y.appendChild(h),y.addEventListener("click",()=>{t=!t,e.requestRepaint();}),l.appendChild(y),!t)return;let x=oe("kanuni-pivot-report-dropdown pivot-animate-slide-up"),m=(w,r=false)=>{let c=oe("kanuni-pivot-report-section-title");return r&&(c.style.marginTop="8px",c.style.borderTop="1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"),c.textContent=w,c},u=(w,r,c,p)=>{let b=oe("kanuni-pivot-report-item","button");b.type="button",b.appendChild(X(w,16,r));let d=oe(""),v=oe("pivot-font-medium");return v.textContent=c,d.appendChild(v),b.appendChild(d),b.addEventListener("click",()=>{t=false,e.requestRepaint(),p();}),b};if(x.appendChild(m(C("actions"))),x.appendChild(u("save","var(--pivot-success)",C("saveNewView"),()=>a(C("saveNewView"),""))),M&&(x.appendChild(u("save-all","var(--pivot-warning)",C("saveChangesOverwrite"),()=>e.controller.updateCurrentReport())),x.appendChild(u("copy","var(--pivot-info)",C("saveAsCopy"),()=>a(C("saveAsView"),`${P?.name??""} (Copy)`)))),T.length>0){x.appendChild(m(C("savedViews"),true));let w=oe("kanuni-pivot-report-list pivot-custom-scrollbar");for(let r of T){let c=oe(`kanuni-pivot-report-list-item${r.id===M?" kanuni-pivot-report-list-item--active":""}`),p=oe("kanuni-pivot-report-list-btn","button");p.type="button",p.appendChild(X(r.id===M?"check":"folder-open",14,r.id===M?"var(--pivot-primary)":"var(--pivot-text-muted)"));let b=oe("pivot-text-sm pivot-truncate","span");b.style.color=r.id===M?"var(--pivot-primary)":"var(--pivot-text)",r.id===M&&b.classList.add("pivot-font-medium"),b.textContent=r.name,p.appendChild(b),r.isDefault&&p.appendChild(De("star",12,"var(--pivot-warning)")),p.addEventListener("click",()=>{t=false,e.requestRepaint(),e.controller.loadReport(r.id);}),c.appendChild(p);let d=oe("kanuni-pivot-report-actions");if(!r.isDefault){let s=oe("kanuni-pivot-action-btn kanuni-pivot-action-btn--warning","button");s.type="button",s.title=C("makeDefault"),s.setAttribute("aria-label",s.title),s.appendChild(X("star",14)),s.addEventListener("click",E=>{E.stopPropagation(),e.controller.setDefaultReport(r.id);}),d.appendChild(s);}let v=oe("kanuni-pivot-action-btn kanuni-pivot-action-btn--danger","button");v.type="button",v.title=C("deleteReport"),v.setAttribute("aria-label",v.title),v.appendChild(X("trash",14)),v.addEventListener("click",s=>{s.stopPropagation(),window.confirm(C("deleteReportConfirm").replace("{0}",r.name))&&(e.controller.deleteReport(r.id),r.id===M&&(t=false,e.requestRepaint()));}),d.appendChild(v),c.appendChild(d),w.appendChild(c);}x.appendChild(w);}l.appendChild(x);}return {mount:o,destroy(){document.removeEventListener("mousedown",i);}}}var Jn={chartData:[],chartSeries:[]};function ot(e,t,n,i){let a=null,o,l,C,T=false;function M(){if(T)return;let h=e.getState();if(!h.engineResult||!h.engineResult.cellMatrix||!n.transformer){i(Jn);return}i(n.transformer(h.engineResult,pivotgridCore.shownFields(h.fields),h.expandedPaths,t(),n));}function P(){let h=e.getState(),x=t();h.engineResult===o&&h.expandedPaths===l&&x===C||(o=h.engineResult,l=h.expandedPaths,C=x,a&&clearTimeout(a),a=setTimeout(M,150));}let y=e.subscribe(P);return P(),{refresh:P,stop(){T=true,a&&clearTimeout(a),y();}}}function Ae(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var it=new Set;function so(){let e="default-pivot-grid";for(let t=2;it.has(e);t++)e=`default-pivot-grid-${t}`;return it.add(e),e}function co(e,t){if(!e||!(e instanceof HTMLElement))throw new Error("[pivotgrid] createPivotGrid needs a container HTMLElement");lt(t);let n=Be(t.locale,t.dictionary,t.rtl),i=t.gridId||t.stateStoring?.storageKey,a=i||so();!i&&a!=="default-pivot-grid"&&console.warn(`[pivotgrid] multiple grids without gridId on this page \u2014 this one got '${a}'. Give each grid an explicit gridId for stable state persistence.`);let o=Ae("kanuni-pivot-root"+(t.className?" "+t.className:""));o.style.width="100%",o.style.height="100%",st(o,pivotgridCore.pivotSchemeTheme(t.theme,t.palette,t.dark)),o.setAttribute("dir",n.rtl?"rtl":"ltr");let l=Ae("kanuni-pivot-wrapper pivot-flex pivot-flex-col");l.style.width="100%",l.style.height="100%";let C=Ae("pivot-grid pivot-flex-1 pivot-flex pivot-flex-col pivot-relative");C.style.minHeight="0",C.style.overflow="hidden",C.style.backgroundColor="var(--pivot-bg)",C.style.border="1px solid var(--pivot-border)",C.style.borderRadius="var(--pivot-radius-md)",C.style.userSelect="none",t.striped&&o.classList.add("kanuni-pivot-striped");let T=t.density,M=()=>pivotgridCore.pivotDensityClass(T),P=()=>pivotgridCore.pivotRowHeight(T);M()&&o.classList.add(M());let y=Ae("pivot-flex-1 pivot-flex pivot-flex-col pivot-relative");y.style.minHeight="0";let h=Ae("pivot-text-muted pivot-text-sm");h.style.padding="8px",h.style.position="absolute",h.style.inset="0",h.style.display="none",h.style.zIndex="70",h.style.backgroundColor="var(--pivot-bg)",h.setAttribute("data-pivot-status",""),C.appendChild(y),C.appendChild(h),l.appendChild(C),o.appendChild(l);let x=Ae("kanuni-pivot-live");x.setAttribute("role","status"),x.setAttribute("aria-live","polite"),x.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap",o.appendChild(x),e.appendChild(o);let m={gridId:a,data:t.data??[],rowKey:t.rowKey,asyncTransactionWait:t.asyncTransactionWait,loading:t.loading,maxColumns:t.maxColumns,initialFields:t.initialFields??t.fields??[],controlledFields:t.fields,controlledLayout:t.layout,stateStoring:t.stateStoring,workerUrl:t.workerUrl,registry:t.registry,serverSource:t.serverSource,locale:n.locale,dictionary:n.dictionary,enterpriseEdition:t.advancedExport===true,onRefresh:t.onRefresh,onFieldsChange:t.onFieldsChange,onLayoutChange:t.onLayoutChange,onFieldMove:t.onFieldMove,onBeforePivotCalculate:t.onBeforePivotCalculate,onAfterPivotCalculate:t.onAfterPivotCalculate,onExporting:t.onExporting,onLargeExport:t.onLargeExport,onComputingChange:t.onComputingChange,onError:t.onError,onChartStateLoaded:t.onChartStateLoaded},u=new pivotgridCore.PivotController(m),w=pivotgridCore.bindPivotScrollMemory(o,u),r=()=>pivotgridCore.shownFields(u.getState().fields),c=tt(o),p=It({portal:c,getI18n:()=>n,gridId:a,getField:g=>r().find(D=>D.id===g),getData:()=>u.getRawData(),apply:(g,D,O)=>u.applyFilter(g,D,O),clear:g=>u.clearFilter(g),openCondition:g=>b.openCondition(g)}),b=Nt({portal:c,getI18n:()=>n,getFields:r,save:g=>u.updateField(g)}),d=$t({portal:c,gridRoot:o,getI18n:()=>n,getFields:r,getLayout:()=>u.getState().layout,controller:u,getEngineTrees:()=>{let g=u.getState().engineResult;return g?{rowTree:g.rowTree,colTree:g.colTree}:null},openSettings:g=>b.open(g),openCondition:g=>b.openCondition(g),openFilter:(g,D,O)=>{f()||p.open(D,O,g);},openFieldChooser:()=>v.open(),onEditCalculatedField:t.onEditCalculatedField?g=>{f()||t.onEditCalculatedField(g);}:void 0,customContextMenuItems:t.customContextMenuItems}),v=Wt({gridRoot:o,getI18n:()=>n,getFields:r,controller:u,onFilterClick:(g,D,O)=>p.open(g,D,O),onOpenChanged:()=>{K||(q.refreshRoots(),ce.paint(u.getState()));}}),s=(g,D)=>{t.onGlobalContextMenu?t.onGlobalContextMenu(g,D):d.openGlobalMenu(g,D);},E=Lt(),f=()=>t.disabled===true,L,A,S={getI18n:()=>n,onRemove:g=>{f()||u.removeField(g);},onFilterClick:(g,D,O)=>{f()||p.open(g,D,O);},onSort:(g,D)=>{f()||u.sortField(g,D);},onContextMenu:(g,D,O,$,_)=>{f()||d.openFieldMenu(g,D,O,$,_);},getFields:r,onMove:(g,D)=>{f()||u.moveField(g,D);},requestFocus:g=>{L=g;let O=document.activeElement?.closest?.("[data-drop-id]")?.getAttribute("data-drop-id");A=O?r().find($=>$.id===O)?.area:void 0;}},H=Mt({host:y,getI18n:()=>n,onCellPrepared:t.onCellPrepared,registry:t.registry,shared:E,chipDeps:S,hasCellClick:()=>!!t.onCellClick&&!f(),columnWidthDefaults:pivotgridCore.resolveColumnWidthDefaults(t.defaultColumnWidths),rowHeight:P}),W=yt({...S,host:C,onGlobalContextMenu:s,onToggleCollapsed:()=>{f()||u.setLayout({filterAreaCollapsed:u.getState().layout.filterAreaCollapsed!==true});}});C.insertBefore(W.element,y);let I=Ae("kanuni-pivot-notice");I.setAttribute("role","status"),I.style.display="none",C.insertBefore(I,y);let N=()=>{let g=v.getHost();return g?[o,g]:[o]},q=zt({gridRoot:o,roots:N,controller:u,getFields:r,onIntentChange:g=>Ct(N(),g),disabled:f,touchDragDelay:()=>t.touchDragDelay}),ye=St({scroller:H.scroller,controller:{toggleExpanded:g=>{f()||u.toggleExpanded(g);},toggleColExpanded:g=>{f()||u.toggleColExpanded(g);},sortField:(g,D)=>{f()||u.sortField(g,D);}},getVM:H.getVM,getTheadHeight:H.getTheadHeight,rowHeight:P,shared:E,onCellClick:t.disabled===true?void 0:t.onCellClick,resolveCellClick:g=>u.resolveCellClick(g),onGlobalContextMenu:(g,D)=>{f()||s(g,D);},onFilterClick:(g,D,O)=>{f()||p.open(g,D,O);},onHeaderContextMenu:(g,D,O,$)=>{f()||d.openFieldMenu(g,D,O,$);},onNodeContextMenu:g=>{f()||d.openNodeMenu(g);},keyboardEnabled:t.keyboardNavigation?.enabled!==false}),se=vt({scroller:H.scroller,shared:E,getVM:H.getVM,onStats:g=>u.setSelectionStats(g)}),ae=Pt({host:y,scroller:H.scroller,shared:E,isRtl:()=>n.rtl,getWidths:()=>u.getState().columnWidths??{},rowHeaderLayout:()=>H.rowHeaderLayout(),commit:g=>{f()||u.setColumnWidths(g);}}),ge=Vt(o,()=>{ce.paint(u.getState()),H.refreshWindow();}),xe=Gt({portal:c,getI18n:()=>n,controller:u,getReports:()=>u.getState().reports??[],getActiveReportId:()=>u.getState().activeReportId??null,requestRepaint:()=>ce.paint(u.getState())}),ce=Dt({host:l,getI18n:()=>n,toolbar:t.toolbar,advancedExport:t.advancedExport===true,upgradeUrl:t.upgradeUrl,registry:t.registry,onToggleFieldChooser:()=>v.toggle(),fieldChooserOpen:()=>v.isOpen(),onRefresh:t.onRefresh,onExport:g=>{u.exportData(g,{applyFilters:true}).catch(D=>{let O=D instanceof Error?D:new Error(String(D));O.name!=="AbortError"&&(t.onError?t.onError(O):console.error(O));});},onExpandAll:()=>u.expandAll({allLevels:true}),onCollapseAll:()=>u.collapseAll(),onAddCalculatedField:t.onAddCalculatedField?()=>{f()||t.onAddCalculatedField();}:void 0,onOpenPrefilter:t.onOpenPrefilter?()=>{f()||t.onOpenPrefilter();}:void 0,onToggleChart:t.onToggleChart?()=>{f()||t.onToggleChart();}:void 0,onToggleFullscreen:()=>ge.toggle(),isFullscreen:()=>ge.isFullscreen(),onGlobalContextMenu:s,mountReportMenu:g=>xe.mount(g),onSearch:t.search?g=>u.setSearchText(g):void 0}),K=false,R=false,k=null,Q=0;function B(){K||R||(R=true,queueMicrotask(fe));}let Y="";function pe(g){let D=pivotgridCore.pivotChipView(g);if(Y!==D.className){for(let $ of Y.split(" "))$&&o.classList.remove($);for(let $ of D.className.split(" "))$&&o.classList.add($);Y=D.className;}let O=D.style["--pivot-chip-max-width"];O?o.style.setProperty("--pivot-chip-max-width",O):o.style.removeProperty("--pivot-chip-max-width");}function fe(){if(R=false,K)return;let g=u.getState(),D=!k||k.engineResult!==g.engineResult||k.fields!==g.fields||k.layout!==g.layout||k.expandedPaths!==g.expandedPaths||k.expandedColPaths!==g.expandedColPaths||k.columnWidths!==g.columnWidths;(!k||k.layout!==g.layout)&&pe(g.layout);let O=!k||k.isBuilding!==g.isBuilding||k.buildProgress!==g.buildProgress||k.engineError!==g.engineError||k.engineResult!==g.engineResult||k.noData!==g.noData,$=!k||k.selectionStats!==g.selectionStats||k.reports!==g.reports||k.activeReportId!==g.activeReportId||k.layout!==g.layout;if(D&&(W.paint(pivotgridCore.shownFields(g.fields).filter(_=>_.area==="filter"),g.layout.showFilterArea!==false,{maxRows:g.layout.filterAreaMaxRows,collapsed:g.layout.filterAreaCollapsed===true,collapsedRows:g.layout.filterAreaCollapsedRows}),v.isOpen()&&v.repaint()),D&&g.engineResult&&H.paintStructural(g),L!==void 0&&(((L?o.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${L}"]`):A?o.querySelector(`[data-drop-id="${A}"]`):null)??H.scroller).focus({preventScroll:true}),L=void 0,A=void 0),O&&ee(g),!k||k.engineResult!==g.engineResult){let _=g.engineResult?.columnsTruncated;I.style.display=_?"":"none";let j=new Intl.NumberFormat(n.locale);I.textContent=_?n.t("columnsTruncated").replace("{shown}",j.format(_.shown)).replace("{total}",j.format(_.total)):"";}if(k&&k.searchText!==g.searchText&&ce.syncSearch(g.searchText??""),k&&k.fields!==g.fields){let _=pivotgridCore.pivotChangeAnnouncement(k.fields,g.fields,n.t);_&&(x.textContent=pivotgridCore.nextLiveText(x.textContent??"",_));}$&&(ce.element.style.display=g.layout.showFooter===false?"none":"",ce.paint(g)),k=g,Q++;}function ee(g){if(g.engineError){h.style.display="block",h.textContent=`${n.t("error")}: ${g.engineError.message}`;return}if(g.isBuilding&&!g.engineResult){h.style.display="block",h.textContent=`${n.t("initializing")} ${Math.round(g.buildProgress??0)}%`;return}if(!g.engineResult){h.style.display="block",h.textContent=n.t(g.noData?"emptyData":"loading");return}h.style.display="none",h.textContent="";}let F=t.onChartSync?ot(u,()=>n.locale,t.chartIntegrationOptions??{},t.onChartSync):null,z=u.subscribe(B);fe();let V={controller:u,element:o,setData(g){K||u.setData(g);},applyTransaction(g){return u.applyTransaction(g)},applyTransactionAsync(g,D){u.applyTransactionAsync(g,D);},flushAsyncTransactions(){u.flushAsyncTransactions();},setLoading(g){u.setLoading(g);},undoLayout:()=>pivotgridCore.keepFocusAcross(o,u,()=>u.undoLayout()),redoLayout:()=>pivotgridCore.keepFocusAcross(o,u,()=>u.redoLayout()),canUndoLayout:()=>u.canUndoLayout(),canRedoLayout:()=>u.canRedoLayout(),clearLayoutHistory:()=>u.clearLayoutHistory(),setFields(g){K||u.setFields(g);},setSearchText(g){u.setSearchText(g);},setLocale(g,D,O){K||(n=Be(g,D??t.dictionary,O??t.rtl),o.setAttribute("dir",n.rtl?"rtl":"ltr"),u.updateOptions({locale:n.locale,dictionary:n.dictionary}),k=null,B(),v.relocalize(),F?.refresh());},openFieldChooser:()=>v.open(),closeFieldChooser:()=>v.close(),clearAllFilters:()=>u.clearAllFilters(),setDensity(g){K||(M()&&o.classList.remove(M()),T=g,M()&&o.classList.add(M()),k=null,B());},destroy(){K||(K=true,z(),w(),F?.stop(),v.destroy(),q.destroy(),ye.destroy(),se.destroy(),ae.destroy(),W.destroy(),xe.destroy(),ce.destroy(),ge.destroy(),c.destroy(),H.destroy(),u.dispose(),o.remove(),i||it.delete(a));}};return Object.defineProperty(V,"__flushCount",{get:()=>Q}),Object.defineProperty(V,"__shared",{get:()=>E}),Object.defineProperty(V,"__dragRootCount",{get:()=>q.rootCount()}),V}
|
|
3
|
+
Object.defineProperty(exports,"PivotController",{enumerable:true,get:function(){return pivotgridCore.PivotController}});Object.defineProperty(exports,"defaultPivotLayout",{enumerable:true,get:function(){return pivotgridCore.defaultPivotLayout}});Object.defineProperty(exports,"getAdvancedExporter",{enumerable:true,get:function(){return pivotgridCore.getAdvancedExporter}});Object.defineProperty(exports,"registerAdvancedExporter",{enumerable:true,get:function(){return pivotgridCore.registerAdvancedExporter}});exports.createChartSync=ot;exports.createPivotGrid=co;exports.createPortalLayer=tt;exports.createThemedHost=He;exports.createValueFormatter=Ne;exports.filledIcon=De;exports.fitPortalZoom=Ie;exports.icon=X;exports.portalParent=Ve;exports.resolveI18n=Be;
|