@kanunilabs/pivotgrid 1.6.6 → 1.6.8
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.js +3 -3
- package/dist/pivotgrid.umd.js +9 -9
- package/dist/styles.css +31 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var pivotgridCore=require('@kanunilabs/pivotgrid-core');var pn={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 a=e??"en",l={...pivotgridCore.en,...pn[a]??{},...t??{}};return {locale:a,rtl:n!==void 0?n:a==="ar",dictionary:l,t:i=>l[i]||i}}var un={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)"},st=new Set;function ct(e){for(let t of Object.keys(e)){let n=un[t];!n||st.has(t)||(st.add(t),console.warn(`[pivotgrid] config key "${t}" is React-only and ignored \u2014 ${n}`));}}var fn=[["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 pt(e,t){for(let[n,a]of fn){let l=t?typeof n=="function"?n(t):t[n]:void 0;typeof l=="string"&&l?e.style.setProperty(a,l):e.style.removeProperty(a);}t?.id?e.setAttribute("data-theme",t.id):e.removeAttribute("data-theme");}var Ue=(e,t)=>(e.areaIndex||0)-(t.areaIndex||0);function vt(e,t){let n=pivotgridCore.shownFields(e.fields),a=e.layout,l=n.filter(r=>r.area==="row").sort(Ue),i=n.filter(r=>r.area==="column").sort(Ue),s=n.filter(r=>r.area==="data").sort(Ue),x=e.engineResult,L=e.expandedPaths.has("*"),k=e.expandedColPaths.has("*"),F=a.rowHeaderLayout==="tree"?1:l.length||1,m=a.dataFieldPosition==="rows"&&s.length>1,u=m?1:s.length;if(!x)return {rowFields:l,colFields:i,dataFields:s,colHeaders:[],virtualRows:[],leafColHashes:[],cellLookup:new Map,fieldRanges:{},engineResult:null,layout:a,maxRowDepth:F,showDataInRows:m,dfsPerLeaf:u,totalDataCols:0,dataColOffset:F+(m?1:0)};let[b,f]=a.hideEmptySummaryCells?pivotgridCore.filterEmptySummaryTree(x):[x.rowTree,x.colTree],p=pivotgridCore.buildColumnHeaders(f,s,a,e.expandedColPaths,k,t,i.length),C=a.rowHeaderLayout==="tree"?pivotgridCore.flattenRowTreeTree(b,e.expandedPaths,L,l.length||1,a.showRowTotals??true,a.totalsPosition??"bottom",a.showTotalsForSingleValues!==false):pivotgridCore.flattenRowTreeTabular(b,e.expandedPaths,L,F,a.showRowTotals??true,a.totalsPosition??"bottom",a.showTotalsForSingleValues!==false),d=[];for(let r of C)if(m&&!r.isSubtotal&&!r.hasChildren)for(let g=0;g<s.length;g++)d.push({flatRow:r,dfIndex:g,isDataRow:true,isGrandTotal:false});else d.push({flatRow:r,dfIndex:0,isDataRow:false,isGrandTotal:false});if(pivotgridCore.grandTotalShown(a,"row",b))if(m)for(let r=0;r<s.length;r++)d.push({flatRow:null,dfIndex:r,isDataRow:true,isGrandTotal:true});else d.push({flatRow:null,dfIndex:0,isDataRow:false,isGrandTotal:true});let T=pivotgridCore.columnSlotOptions(a),y=[];for(let r of pivotgridCore.getVisibleColSlots(f,e.expandedColPaths,k,T))y.push({hash:r.node.key,isGrandTotal:!!r.node.isTotal,isSubtotal:r.isSubtotal});(pivotgridCore.grandTotalShown(a,"column",f)||y.length===0)&&y.push({hash:"",isGrandTotal:true});let E=new Map,o=x.cellMatrix.keys;for(let r=0;r<o.length;r++)E.set(o[r],r);let c=s.some(pivotgridCore.fieldNeedsRange)?pivotgridCore.computeFieldRanges(x,s):{};return {rowFields:l,colFields:i,dataFields:s,colHeaders:p,virtualRows:d,leafColHashes:y,cellLookup:E,fieldRanges:c,engineResult:x,layout:a,maxRowDepth:F,showDataInRows:m,dfsPerLeaf:u,totalDataCols:y.length*u,dataColOffset:F+(m?1:0)}}function Ye(e,t,n,a,l){let i=e.engineResult,s=i.rowIndexMap[t]??-1,x=i.columnIndexMap[n]??-1;if(s===-1||x===-1)return null;let L=e.cellLookup.get(s*pivotgridCore.MAX_C+x);if(L===void 0)return null;let k=e.dataFields.length,F=i.cellMatrix.sums,m=i.cellMatrix.displaySums,u={};for(let b=0;b<k;b++)u[e.dataFields[b].id]=F[L*k+b],m&&(u[`${e.dataFields[b].id}_display`]=m[L*k+b]);return {values:u,rowPath:pivotgridCore.pathParts(t),colPath:pivotgridCore.pathParts(n),isTotalCell:s===0||x===0||a||l}}function mt(e,t,n){if(!e.engineResult||n<e.dataColOffset)return null;let a=n-e.dataColOffset,l=Math.floor(a/e.dfsPerLeaf),i=a%e.dfsPerLeaf;if(l>=e.leafColHashes.length)return null;let s=e.virtualRows[t];if(!s)return null;let x=s.isGrandTotal?"":s.flatRow?.key;if(x===void 0)return null;let L=e.leafColHashes[l]?.hash;if(L===void 0)return null;let k=e.engineResult.rowIndexMap[x],F=e.engineResult.columnIndexMap[L];if(k===void 0||F===void 0)return null;let m=e.cellLookup.get(k*pivotgridCore.MAX_C+F);if(m===void 0)return null;let u=e.showDataInRows?s.dfIndex:i,f=e.engineResult.cellMatrix.sums[m*e.dataFields.length+u];return typeof f=="number"?f:null}function Ze(e,t,n){let a=e.virtualRows[t];if(!a||a.isGrandTotal||!a.flatRow)return null;let l=a.flatRow,i=e.layout.rowHeaderLayout==="tree",s=n,x=i?l.depth:s,L=x===l.depth,k=x<l.depth,F=L?l.hasChildren:k,m=L?l.isExpanded:k,u=i?l.key:pivotgridCore.pathKey(l.pathValues.slice(0,s+1));return {hasChildren:F,isExpanded:m,cellHashStr:u,depth:x,dIdx:s,flatRow:l}}function gt(e,t,n){if(n<e.dataColOffset||!e.engineResult)return null;let a=n-e.dataColOffset,l=Math.floor(a/e.dfsPerLeaf),i=a%e.dfsPerLeaf;if(l>=e.leafColHashes.length)return null;let s=e.virtualRows[t];if(!s)return null;let x=s.isGrandTotal?"":s.flatRow?.key;if(x===void 0)return null;let L=e.leafColHashes[l],k=Ye(e,x,L.hash,!!s.flatRow?.isSubtotal,L.isGrandTotal);if(!k)return null;let F=e.showDataInRows?s.dfIndex:i,m=e.dataFields[F],u=k.values[`${m?.id}_display`]??k.values[m?.id],b=!!s.flatRow?.isSubtotal||L.isGrandTotal||k.isTotalCell;return {cell:{isTotalCell:k.isTotalCell,rowPath:k.rowPath,colPath:k.colPath,values:k.values},val:u,isTotal:b}}function Ne(e){let t=new Map;return (n,a)=>{if(n==null||Number.isNaN(n))return "";if(a.format&&typeof n=="number"){if(typeof a.format=="function")return a.format(n);try{let l=a.format,i=t.get(l);i||(i=new Intl.NumberFormat(e,l),t.set(l,i));let s=i.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,a,e)||String(n)}}var Ie=null;function We(e,t,n){if(!e)return false;let a=Math.min(e.startR,e.endR),l=Math.max(e.startR,e.endR),i=Math.min(e.startC,e.endC),s=Math.max(e.startC,e.endC);return t>=a&&t<=l&&n>=i&&n<=s}function bt(e){let{scroller:t,shared:n}=e,a={},l="",i=null,s=false;function x(){for(let b of t.querySelectorAll("td[data-r][data-c]")){let f=Number(b.getAttribute("data-r")),p=Number(b.getAttribute("data-c"));b.classList.toggle("kanuni-pivot-cell-selected",We(n.selection,f,p));}}function L(){let b=n.selection;if(e.onStats){if(!b||b.mode!=="data"){i&&(clearTimeout(i),i=null),s&&(s=false,e.onStats(null));return}i&&clearTimeout(i),i=setTimeout(()=>{i=null;let f=n.selection;if(!f||f.mode!=="data")return;let p=Math.min(f.startR,f.endR),C=Math.max(f.startR,f.endR),d=Math.min(f.startC,f.endC),T=Math.max(f.startC,f.endC),y=0,E=0,o=1/0,c=-1/0,r=e.getVM();if(r){for(let g=p;g<=C;g++)for(let h=d;h<=T;h++){let w=mt(r,g,h);w===null||isNaN(w)||(y+=w,E++,w<o&&(o=w),w>c&&(c=w));}s=E>0,e.onStats(E>0?{sum:y,count:E,avg:y/E,min:o,max:c}:null);}},10);}}n.selectByKey=(b,f,p,C)=>{let d=e.getVM();if(!d)return;let T=f<d.dataColOffset?"row":"data",y=n.selection;if(Ie=a,l="",p&&y&&y.mode===T){if(y.endR===b&&y.endC===f&&!y.isSelecting)return;n.selection={...y,endR:b,endC:f,isSelecting:false};}else if(p){let o=(C.c<d.dataColOffset?"row":"data")===T?C:{r:b,c:f};n.selection={startR:o.r,startC:o.c,endR:b,endC:f,isSelecting:false,mode:T};}else {if(y&&y.mode===T&&!y.isSelecting&&y.startR===b&&y.startC===f&&y.endR===b&&y.endC===f)return;n.selection={startR:b,startC:f,endR:b,endC:f,isSelecting:false,mode:T};}x(),L();};let k=b=>{if(b.button!==0||n.isResizing||b.target.closest?.(".kanuni-pivot-resize-handle"))return;let f=b.target.closest?.("td[data-r][data-c]");if(!f)return;let p=e.getVM();if(!p)return;let C=Number(f.getAttribute("data-r")),d=Number(f.getAttribute("data-c")),T=d<p.dataColOffset?"row":"data";Ie=a,l="",n.selection={startR:C,startC:d,endR:C,endC:d,isSelecting:true,mode:T},x(),L();},F=b=>{let f=n.selection;if(!f||!f.isSelecting)return;let p=b.target.closest?.("td[data-r][data-c]");if(!p)return;let C=Number(p.getAttribute("data-r")),d=Number(p.getAttribute("data-c")),T=`${C},${d}`;if(T===l)return;l=T;let y=e.getVM();!y||(d<y.dataColOffset?"row":"data")!==f.mode||C===f.endR&&d===f.endC||(f.endR=C,f.endC=d,x(),L());},m=()=>{n.selection&&(n.selection.isSelecting=false);},u=b=>{if(!(b.ctrlKey||b.metaKey)||b.key!=="c"||Ie!==null&&Ie!==a)return;let f=n.selection;if(!f)return;let p=Math.min(f.startR,f.endR),C=Math.max(f.startR,f.endR),d=Math.min(f.startC,f.endC),T=Math.max(f.startC,f.endC),y="";for(let E=p;E<=C;E++){let o=[];for(let c=d;c<=T;c++){let r=t.querySelector(`[data-r="${E}"][data-c="${c}"]`);o.push(r?(r.innerText??r.textContent??"").trim().replace(/\n/g," "):"");}y+=o.join(" ")+`
|
|
2
|
-
`;}y&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(y).catch(()=>{});};return t.addEventListener("mousedown",k),t.addEventListener("mouseover",F),document.addEventListener("mouseup",m),document.addEventListener("keydown",u),{destroy(){t.removeEventListener("mousedown",k),t.removeEventListener("mouseover",F),document.removeEventListener("mouseup",m),document.removeEventListener("keydown",u),i&&clearTimeout(i),Ie===a&&(Ie=null),n.selectByKey=void 0;}}}var yt={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 xt="http://www.w3.org/2000/svg";function X(e,t=15,n){let a=document.createElementNS(xt,"svg");a.setAttribute("width",String(t)),a.setAttribute("height",String(t)),a.setAttribute("viewBox","0 0 24 24"),a.setAttribute("fill","none"),a.setAttribute("stroke","currentColor"),a.setAttribute("stroke-width","2"),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),n&&(a.style.color=n);for(let[l,i]of yt[e]??[]){let s=document.createElementNS(xt,l);for(let[x,L]of Object.entries(i))s.setAttribute(x,String(L));a.appendChild(s);}return a}function Ve(e,t=15,n){let a=X(e,t,n);return a.setAttribute("fill","currentColor"),a}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 Pn(e,t,n){let a=e.filter(l=>l.area===t);return t==="filter"?Ct(a,n):a.sort((l,i)=>(l.areaIndex||0)-(i.areaIndex||0))}var Rn={row:"rowArea",column:"columnArea",data:"dataArea",filter:"filterArea"};function Ge(e,t){let{t:n,locale:a,rtl:l}=t.getI18n(),i=ue("kanuni-pivot-field-chip");i.setAttribute("data-drop-id",e.id),i.setAttribute("data-touch-hold",""),i.style.position="relative",i.style.cursor="pointer",i.setAttribute("role","button"),i.tabIndex=0;let s=t.getFields?Pn(t.getFields(),e.area,a):[e],x=Math.max(0,s.findIndex(d=>d.id===e.id)),L=n(Rn[e.area??""]??"rowArea");i.setAttribute("aria-label",n("fieldChipLabel").replace("{0}",e.caption||e.id).replace("{1}",L).replace("{2}",String(x+1)).replace("{3}",String(s.length))),i.setAttribute("aria-keyshortcuts","Control+ArrowLeft Control+ArrowRight Control+Home Control+End Delete Alt+ArrowDown Shift+F10"),i.setAttribute("aria-description",n("fieldChipKeys"));let k=()=>{if(!t.onSort)return;let d=e.sortOrder==="asc"?"desc":e.sortOrder==="desc"?void 0:"asc";t.onSort(e.id,d);},F=d=>{if(!d)return;(i.closest(".kanuni-pivot-root")??document.body).querySelector(`.kanuni-pivot-field-chip[data-drop-id="${d}"]`)?.focus({preventScroll:true});};i.addEventListener("keydown",d=>{let T=d.ctrlKey||d.metaKey,y=l?"ArrowRight":"ArrowLeft",E=l?"ArrowLeft":"ArrowRight",o=!!t.onMove&&e.area!=="filter",c=true;if(d.key==="Enter"||d.key===" ")k();else if(T&&o&&(d.key===y||d.key==="ArrowUp"))x>0&&t.onMove(e.id,"left");else if(T&&o&&(d.key===E||d.key==="ArrowDown"))x<s.length-1&&t.onMove(e.id,"right");else if(T&&o&&d.key==="Home")x>0&&t.onMove(e.id,"start");else if(T&&o&&d.key==="End")x<s.length-1&&t.onMove(e.id,"end");else if(!T&&(d.key===y||d.key===E)){let r=d.key===y?-1:1;F(s[x+r]?.id);}else if(d.key==="Delete"||d.key==="Backspace"){let r=s[x+1]??s[x-1];t.requestFocus?.(r?.id??null),t.onRemove(e.id);}else if(d.altKey&&d.key==="ArrowDown"){let r=i.getBoundingClientRect();t.onFilterClick(l?r.right:r.left,r.bottom,e.id);}else if(d.key==="F10"&&d.shiftKey||d.key==="ContextMenu"){if(!t.onContextMenu)return;let r=i.getBoundingClientRect();t.onContextMenu(l?r.right:r.left,r.bottom,e.id,void 0,true);}else c=false;c&&(d.preventDefault(),d.stopPropagation());});let m=ue("pivot-truncate","span");Object.assign(m.style,{maxWidth:"var(--pivot-chip-max-width, 120px)",userSelect:"none"}),m.title=e.caption||e.id,m.textContent=e.caption||e.id,i.appendChild(m),e.sortOrder==="asc"&&i.appendChild(X("arrow-up",12,"var(--pivot-primary)")),e.sortOrder==="desc"&&i.appendChild(X("arrow-down",12,"var(--pivot-primary)"));let u=e.area==="data"&&e.summaryType?pivotgridCore.summaryTypeLabel(String(e.summaryType),n):"";if(u){let d=ue("kanuni-pivot-chip-badge","span");Object.assign(d.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"}),d.textContent=u,i.appendChild(d);}let b=!!e.filterValues&&e.filterValues.size>0||!!e.valueFilter||!!e.labelFilter,f=ue(`kanuni-pivot-field-chip-actions${b?" is-filtered":""}`);f.setAttribute("aria-hidden","true");let p=ue("kanuni-pivot-chip-btn","span");p.title=n("filterField"),p.style.color=b?"var(--pivot-danger)":"inherit",p.appendChild(X("filter",12)),p.addEventListener("pointerdown",d=>d.stopPropagation()),p.addEventListener("click",d=>{d.stopPropagation(),t.onFilterClick(d.clientX,d.clientY,e.id);});let C=ue("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger kanuni-pivot-chip-remove","span");if(C.title=n("removeField"),C.appendChild(X("x",12)),C.addEventListener("pointerdown",d=>d.stopPropagation()),C.addEventListener("click",d=>{d.stopPropagation(),t.onRemove(e.id);}),f.append(p,C),i.appendChild(f),t.onContextMenu){i.setAttribute("data-chip-menu","");let d=ue(`kanuni-pivot-chip-more${b?" is-filtered":""}`,"span");if(d.setAttribute("aria-hidden","true"),d.addEventListener("pointerdown",T=>T.stopPropagation()),d.addEventListener("click",T=>{T.stopPropagation();let y=d.getBoundingClientRect();t.onContextMenu(l?y.right:y.left,y.bottom,e.id,void 0);}),i.appendChild(d),b){let T=X("filter",10);T.classList.add("kanuni-pivot-chip-filtered-mark"),T.setAttribute("aria-hidden","true"),i.appendChild(T);}}return i.addEventListener("click",d=>{d.stopPropagation(),k();}),i.addEventListener("contextmenu",d=>{if(d.stopPropagation(),t.onContextMenu){d.preventDefault();let T=i.getBoundingClientRect(),y=Number.isFinite(d.clientX)?d.clientX:l?T.right:T.left,E=Number.isFinite(d.clientY)?d.clientY:T.bottom;t.onContextMenu(y,E,e.id,void 0);}}),i}function je(e,t,n,a,l){let{t:i}=l.getI18n(),s=ue("kanuni-pivot-area-dropzone");s.setAttribute("data-drop-id",e),s.tabIndex=-1;let x=ue("kanuni-pivot-area-header");x.appendChild(X(n,13)),x.appendChild(document.createTextNode(t)),s.appendChild(x);let L=ue("kanuni-pivot-area-content");if(a.length===0){let F=ue("pivot-text-xs pivot-text-muted","span");Object.assign(F.style,{fontStyle:"italic",padding:"0 8px"}),F.textContent=i("dropHere"),L.appendChild(F);}for(let F of a)L.appendChild(Ge(F,l));let k=ue("kanuni-pivot-ghost-end");return k.setAttribute("data-drop-id",`${e}-ghost-end`),k.setAttribute("data-ghost-populated",a.length>0?"1":"0"),Object.assign(k.style,{flex:"1",minWidth:"40px",minHeight:"24px",borderRadius:"var(--pivot-border-radius-sm)",transition:"background-color 0.2s"}),L.appendChild(k),s.appendChild(L),s}function Ct(e,t){let n=new Map;return e.map(l=>{let i=l.caption||l.id||"";if(n.has(i)){let s=n.get(i)+1;return n.set(i,s),{...l,caption:`${i} (${s})`}}return n.set(i,1),l}).sort((l,i)=>(l.caption||"").toLowerCase().localeCompare((i.caption||"").toLowerCase(),t||"en"))}function wt(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=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 a(l,i,s){let{t:x}=e.getI18n(),L=l.querySelector(".kanuni-pivot-area-header"),k=l.querySelector(".kanuni-pivot-area-content"),F=s.collapsed===true;if(F&&l.setAttribute("data-collapsed",""),L&&F){let b=pivotgridCore.countFilteredFields(i);if(b>0){let f=ue("kanuni-pivot-area-filtered-count","span");f.textContent=x("filteredFieldCount").replace("{0}",String(b)),L.appendChild(f);}}if(L&&e.onToggleCollapsed&&i.length>0){let b=ue("kanuni-pivot-area-collapse","button");b.type="button";let f=x(F?"expandFilterArea":"collapseFilterArea");b.setAttribute("aria-expanded",String(!F)),b.setAttribute("aria-label",f),b.title=f;let p=X("chevron-down",14);F||(p.style.transform="rotate(180deg)"),b.appendChild(p),b.addEventListener("click",C=>{C.stopPropagation(),e.onToggleCollapsed();}),L.appendChild(b);}let m=pivotgridCore.filterAreaRows({filterAreaMaxRows:s.maxRows,filterAreaCollapsed:F,filterAreaCollapsedRows:s.collapsedRows});if(!k||m===null)return;if(m===0){k.style.display="none";return}let u=k.querySelector(".kanuni-pivot-field-chip");k.style.maxHeight=`${pivotgridCore.filterAreaMaxHeight(m,u?.offsetHeight||28)}px`,k.style.overflowY=F?"hidden":"auto";}return {element:t,paint(l,i,s={}){t.style.display=i?"":"none";let x=Je(t);if(t.textContent="",!i)return;let L=ue("pivot-flex");L.style.width="100%";let{t:k,locale:F}=e.getI18n(),m=je("filter",k("filterArea"),"filter",Ct(l,F),e);L.appendChild(m),t.appendChild(L),a(m,l,s),Qe(t,x);},destroy(){t.removeEventListener("contextmenu",n),t.remove();}}}var Et="kanuni-pivot-drop-indicator";function An(e){let t=ue(Et);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 a=ue("");Object.assign(a.style,{position:"absolute",bottom:"0",width:"0",height:"0",borderBottom:"5px solid var(--pivot-primary)"}),a.style.setProperty("inset-inline-start","-4px"),a.style.setProperty("border-inline-start","4px solid transparent"),a.style.setProperty("border-inline-end","4px solid transparent");let l=ue("");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,a,l),t}function Tt(e,t){for(let n of e){for(let a of n.querySelectorAll(`.${Et}`))a.remove();for(let a of n.querySelectorAll('[data-drop-id$="-ghost-end"]'))a.style.backgroundColor="transparent",a.style.boxShadow="none",a.textContent="";for(let a of n.querySelectorAll(".pivot-area-strip--over"))a.classList.remove("pivot-area-strip--over");for(let a of n.querySelectorAll('[data-drop-kind="list"]'))a.style.backgroundColor="transparent",a.style.boxShadow="none";}if(t.intent==="before"||t.intent==="after"){if(!t.targetId)return;for(let n of e){let a=n.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${t.targetId}"]`)??n.querySelector(`[data-drop-id="${t.targetId}"]`)??n.querySelector(`[data-drop-id="chooser-${t.targetId}"]`);if(a){a.appendChild(An(t.intent));return}}}else if(t.intent==="append"&&t.targetArea)for(let n of e){let a=n.querySelector(`[data-drop-id="${t.targetArea}-ghost-end"]`)??n.querySelector(`[data-drop-id="chooser-${t.targetArea}-ghost-end"]`);if(a&&(a.style.backgroundColor="color-mix(in srgb, var(--pivot-primary) 10%, transparent)",a.style.boxShadow="inset 0 0 0 1px color-mix(in srgb, var(--pivot-primary) 50%, transparent)",a.getAttribute("data-ghost-populated")==="1")){let s=ue("");Object.assign(s.style,{width:"4px",height:"100%",backgroundColor:"var(--pivot-primary)",borderRadius:"2px",marginLeft:"4px"}),a.appendChild(s);}n.querySelector(`[data-drop-id="${t.targetArea}"]`)?.classList.add("pivot-area-strip--over");let i=n.querySelector(`[data-drop-id="chooser-${t.targetArea}"][data-drop-kind="list"]`);i&&(i.style.backgroundColor="color-mix(in srgb, var(--pivot-primary) 5%, transparent)",i.style.boxShadow="inset 0 0 0 1px color-mix(in srgb, var(--pivot-primary) 50%, transparent)");}}var Vn={style:{}},zn=28,Mt=5,$n=10,Lt=40,St=8,et=100;function J(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function te(e,t){for(let[n,a]of Object.entries(t)){if(a==null)continue;let l=n.replace(/[A-Z]/g,i=>"-"+i.toLowerCase());e.style.setProperty(l,typeof a=="number"&&a!==0&&!/z-?index|font-?weight|opacity/i.test(n)?`${a}px`:String(a));}}function Ke(e,t,n,a){let l=J("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(a,"-3px"),l}function ze(e,t){e.textContent="",t!=null&&(typeof t=="string"||typeof t=="number"?e.textContent=String(t):e.appendChild(t));}function Me(e,t){e.classList.add("kanuni-pivot-rh-sticky"),e.style.setProperty("inset-inline-start",t);}function Pt(e){let{host:t,getI18n:n}=e,a=e.columnWidthDefaults??pivotgridCore.resolveColumnWidthDefaults(),l=e.rowHeight??(()=>zn),i=e.shared?.cellId??((P,R)=>`pivot-cell-${P}-${R}`),s=J("datagrid-table-wrapper custom-scrollbar pivot-right-pane");te(s,{overflow:"auto",flex:"1 1 auto",minHeight:0,position:"relative",outline:"none"}),s.tabIndex=0,s.setAttribute("role","grid");let x=J("");te(x,{width:"max-content",position:"relative",minWidth:"100%"});let L=J("kanuni-pivot-table","table");L.setAttribute("role","presentation"),te(L,{borderCollapse:"separate",borderSpacing:0,width:0,minWidth:"100%",tableLayout:"fixed"});let k=document.createElement("colgroup"),F=J("","thead");F.setAttribute("role","rowgroup"),te(F,{position:"sticky",top:0,zIndex:50,backgroundColor:"var(--pivot-surface-header)"});let m=J("","tbody");m.setAttribute("role","rowgroup"),L.append(k,F,m),x.appendChild(L),s.appendChild(x),t.appendChild(s);let u=null,b=Ne(n().locale),f=n().locale,p={start:-1,end:-1},C={start:0,end:Number.MAX_SAFE_INTEGER},d={},T=new Set,y=false,E=()=>u?Math.max(u.colHeaders.length,1)*l()+(e.chipDeps?42:0):0,o=P=>d[`row-${P}`]??a.rowHeader,c=()=>d[`row-${u.maxRowDepth}`]??et,r=P=>d[`leaf-${P}`]??a.data;function g(){if(!u||u.totalDataCols<=Lt){C={start:0,end:Number.MAX_SAFE_INTEGER};return}let P=Math.abs(s.scrollLeft),R=w().total,B=P-R,W=0,Y=0;for(;W<u.totalDataCols&&Y+r(W)<=B;)Y+=r(W),W++;W=Math.max(0,W-St);let se=s.clientWidth||0,fe=W,Q=0;for(;fe<u.totalDataCols&&Q<=se;)Q+=r(fe),fe++;C={start:W,end:Math.min(u.totalDataCols,fe+St)};}function h(){if(!u)return {start:0,end:0};let P=Math.max(0,s.scrollTop-E()),R=Math.max(0,Math.floor(P/l())-Mt),B=Math.ceil((s.clientHeight||600)/l())+$n;return {start:R,end:Math.min(u.virtualRows.length,R+B+Mt)}}function w(){let P=[];for(let R=0;R<u.maxRowDepth;R++)P.push(o(R));return u.showDataInRows&&P.push(c()),pivotgridCore.computeRowHeaderWidths(P,S(P.length)?0:s.clientWidth)}function S(P){let R=u.layout.rowHeaderOverflow;return R==="scroll"||pivotgridCore.rowHeadersUnpinned(P,s.clientWidth,R)}function M(){s.classList.toggle("kanuni-pivot-rowheaders-scroll",S(u.maxRowDepth+(u.showDataInRows?1:0)));let{widths:P,total:R}=w(),B=0;for(let W=0;W<P.length;W++)s.style.setProperty(`--row-header-left-${W}`,`${B}px`),s.style.setProperty(`--col-width-row-${W}`,`${P[W]}px`),T.add(`--col-width-row-${W}`),B+=P[W];s.style.setProperty("--row-header-total-width",`${R}px`);}function V(){k.textContent="";for(let P=0;P<u.maxRowDepth;P++){let R=document.createElement("col");R.style.width=`var(--col-width-row-${P}, ${a.rowHeader}px)`,k.appendChild(R);}if(u.showDataInRows){let P=document.createElement("col");P.style.width=`var(--col-width-row-${u.maxRowDepth}, ${et}px)`,k.appendChild(P);}for(let P=0;P<Math.max(u.totalDataCols,1);P++){let R=document.createElement("col");R.style.width=`var(--col-width-data-${P}, ${a.data}px)`,k.appendChild(R);}}function D(){let{colHeaders:P,rowFields:R,colFields:B,dataFields:W,maxRowDepth:Y,showDataInRows:se,layout:fe,dataColOffset:Q}=u,{t:A,locale:$}=n(),N=Je(F);F.textContent="";let U=Math.max(P.length,1),v=e.chipDeps;if(v){let I=J("","tr");I.setAttribute("role","row"),te(I,{height:42});let O=J("","th");O.setAttribute("role","columnheader"),O.colSpan=Math.max(Q,1),te(O,{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)"}),O.style.setProperty("inset-inline-start","0px"),O.appendChild(je("data",A("dataArea"),"bar-chart-3",W,v)),I.appendChild(O);let K=J("","th");K.setAttribute("role","columnheader"),K.colSpan=Math.max(u.totalDataCols,1),te(K,{borderBottom:"1px solid var(--pivot-border)",padding:0,verticalAlign:"top",zIndex:1,backgroundColor:"var(--pivot-surface-header)"});let G=J("");te(G,{position:"sticky",width:"max-content",maxWidth:"100%"}),G.style.setProperty("inset-inline-start","var(--row-header-total-width, 0px)"),G.appendChild(je("column",A("columnArea"),"columns3",B,v)),K.appendChild(G),I.appendChild(K),F.appendChild(I);}for(let I=0;I<U;I++){let O=J("","tr");if(O.setAttribute("role","row"),te(O,{height:l()}),I===0){let G=j=>({position:"sticky",top:0,zIndex:60,backgroundColor:"var(--pivot-surface-header)",borderBottom:"1px solid var(--pivot-border)",borderInlineEnd:j?"1px solid var(--pivot-border)":"none",verticalAlign:"bottom",padding:"4px 8px",color:"var(--pivot-text-header)"});if(R.length===0){let j=J("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");j.setAttribute("data-drop-id","row"),j.setAttribute("data-row-header-idx","0"),j.rowSpan=U,j.colSpan=Math.max(Q,1),te(j,{...G(true),padding:"8px",color:"color-mix(in srgb, var(--pivot-text-header, var(--pivot-text)) 70%, transparent)"}),Me(j,"var(--row-header-left-0, 0px)"),j.textContent=A("dropHere"),O.appendChild(j);}else if(fe.rowHeaderLayout==="tree"){let j=J("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");if(j.setAttribute("data-row-header-idx","0"),j.rowSpan=U,te(j,G(!se)),Me(j,"var(--row-header-left-0, 0px)"),v){let Z=J("");te(Z,{display:"flex",flexWrap:"wrap",gap:4});for(let ie of R)Z.appendChild(Ge(ie,v));j.appendChild(Z);}else ze(j,R.map(Z=>Z.caption).join(", "));O.appendChild(j);}else for(let j=0;j<Y;j++){let Z=J("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");Z.setAttribute("data-row-header-idx",String(j)),Z.rowSpan=U,te(Z,G(j===Y-1&&!se)),Me(Z,`var(--row-header-left-${j}, 0px)`);let ie=R[j];ie&&v&&Z.setAttribute("data-drop-id",ie.id),ie&&v?Z.appendChild(Ge(ie,v)):ze(Z,ie?.caption??""),O.appendChild(Z);}if(se&&R.length>0){let j=J("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");j.setAttribute("data-row-header-idx",String(Y)),j.rowSpan=U,te(j,G(true)),Me(j,`var(--row-header-left-${Y}, 0px)`);let Z=J("");te(Z,{fontSize:10,fontWeight:600,textTransform:"uppercase",textAlign:"center",color:"color-mix(in srgb, var(--pivot-text-header, var(--pivot-text)) 80%, transparent)"}),Z.style.letterSpacing="0.05em",Z.textContent=A("dataArea"),j.appendChild(Z),O.appendChild(j);}}let K=P[I]??[];for(let G of K){let j=G.fieldId?B.find(le=>le.id===G.fieldId):void 0,Z=!!j?.filterValues&&j.filterValues.size>0,ie=G.leafStart,ce=j&&!G.isTotal?pivotgridCore.formatDimensionValue(G.caption,j,"grid",$):G.caption,ve={text:typeof j?.cellTemplate=="function"?j.cellTemplate({value:G.caption,displayValue:ce,field:j})??null:String(ce??""),style:{textAlign:"left",fontWeight:G.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:j?"pointer":"context-menu",position:"relative",zIndex:1,padding:"4px 6px"},className:`kanuni-pivot-header-cell group ${G.isTotal?"kanuni-pivot-header-total":""}`};e.onCellPrepared?.({area:"column",cell:null,rowIndex:I,columnIndex:ie,cellConfig:ve}),ve.style.fontWeight=G.isTotal?pivotgridCore.paintedFontWeight(ve.style.fontWeight,600,"--pivot-font-weight-header-total"):pivotgridCore.paintedFontWeight(ve.style.fontWeight,500,"--pivot-font-weight-header");let ee=J(ve.className,"th");ee.setAttribute("role","columnheader"),G.hasChildren&&ee.setAttribute("aria-expanded",String(!!G.isExpanded)),ee.colSpan=G.colSpan,ee.rowSpan=G.rowSpan,te(ee,ve.style);let ye=J("pivot-flex pivot-items-center");if(te(ye,{gap:4}),G.hasChildren){let le=J("kanuni-pivot-expand-icon","span");le.textContent=G.isExpanded?"\u2212":"+",le.setAttribute("aria-hidden","true"),le.setAttribute("data-col-expand",G.colPath??""),te(le,{cursor:"pointer",marginRight:4,flexShrink:0}),ye.appendChild(le);}let ge=J("select-none","span");ze(ge,ve.text),ye.appendChild(ge);let de=u.rowFields.find(le=>le.sortBySummaryField===G.fieldId&&(le.sortBySummaryPath||"")===(G.colPath||""));if(de){let le=J("pivot-text-primary kanuni-pivot-sort-arrow","span");le.appendChild(X(de.sortOrder==="asc"?"arrow-up":"arrow-down",12)),ye.appendChild(le);}if(G.fieldId){let le=J(`kanuni-pivot-head-filter cursor-pointer transition-opacity ${Z?"opacity-100 pivot-text-danger":"opacity-0 group-hover:opacity-70"}`,"span");le.setAttribute("data-filter-field",G.fieldId),le.appendChild(Z?Ve("filter",10):X("filter",10)),ye.appendChild(le);}ee.appendChild(ye),G.fieldId&&ee.setAttribute("data-header-field",G.fieldId),G.colPath!==void 0&&ee.setAttribute("data-header-col-path",G.colPath),ee.setAttribute("data-header-depth",String(I)),ee.appendChild(Ke(`leaf-${ie}-${G.colSpan}`,a.data,G.colSpan,"right")),O.appendChild(ee);}F.appendChild(O);}Qe(F,N);}function H(P,R,B,W){let Y=R.flatRow,{rowFields:se,layout:fe,maxRowDepth:Q,virtualRows:A}=u,{locale:$}=n(),N=fe.rowHeaderLayout==="tree",U=N?Y.depth:W,v=Y.pathValues[U],I=Y.rowSpans[W]>0&&R.dfIndex===0,O=se[U],K=O&&v!==null&&v!==void 0?pivotgridCore.formatDimensionValue(v,O,"grid",$):v,G=U===Y.depth,j=U<Y.depth,Z=G?Y.hasChildren:j,ie=G?Y.isExpanded:j,ce=A[B+1],ke=!N&&ce&&!ce.isGrandTotal&&ce.flatRow&&!ce.flatRow.isSubtotal&&(ce.flatRow.rowSpans[W]===0||ce.dfIndex>0)&&ce.flatRow.pathValues[W]===v,ve=pivotgridCore.rowHeaderGroupEnd(A,B,W,N),ee=fe.rowHeaderGroupLines===true,ye=K!=null?String(K):null;typeof O?.cellTemplate=="function"&&ye!==null&&(ye=O.cellTemplate({value:K,displayValue:K,field:O})??ye);let ge={text:ye,style:{position:"sticky",backgroundColor:"var(--pivot-surface)",zIndex:40,cursor:Z?"pointer":"default",fontWeight:K&&U<Y.depth?600:400,verticalAlign:"middle",padding:0,borderBottom:ee?ve?"1px solid var(--pivot-border)":"none":ke?"none":"1px solid var(--pivot-border)",height:l()},className:`kanuni-pivot-cell kanuni-pivot-row-header ${Z?"kanuni-pivot-row-expandable":""}${e.shared?.focused?.r===B&&e.shared?.focused?.c===W?" kanuni-pivot-cell-focused":""}${We(e.shared?.selection??null,B,W)?" kanuni-pivot-cell-selected":""}`};e.onCellPrepared?.({area:"row",cell:null,rowIndex:B,columnIndex:W,cellConfig:ge}),K&&U<Y.depth&&(ge.style.fontWeight=pivotgridCore.paintedFontWeight(ge.style.fontWeight,600,"--pivot-font-weight-group"));let de=J(ge.className,"td");if(de.id=i(B,W),de.setAttribute("role","rowheader"),Z&&de.setAttribute("aria-expanded",String(ie)),de.setAttribute("data-r",String(B)),de.setAttribute("data-c",String(W)),ve&&de.setAttribute("data-group-end",""),te(de,ge.style),Me(de,`var(--row-header-left-${W}, 0px)`),!N&&W>=Y.depth&&W<Q-1&&de.style.setProperty("border-inline-end","none"),!I&&!N){ee||(de.style.borderBottom="none"),de.appendChild(Ke(`row-${W}`,a.rowHeader,1,n().rtl?"left":"right")),P.appendChild(de);return}de.setAttribute("data-group-start","");let le=N?Y.depth*20:0,Se=J("");if(te(Se,{display:"flex",alignItems:"center",gap:4,padding:"0 8px",height:"100%",position:"relative"}),Se.style.setProperty("padding-inline-start",`${8+le}px`),N&&Y.depth>0){let Le=J("kanuni-pivot-tree-line");te(Le,{position:"absolute",left:le,top:-l()/2,width:12,height:l(),borderLeft:"1px dotted var(--pivot-border)",borderBottom:"1px dotted var(--pivot-border)"}),Se.appendChild(Le);}if(ge.text!==null&&ge.text!==void 0){if(Z){let Te=J("kanuni-pivot-expand-icon","span");Te.textContent=ie?"\u2212":"+",Te.setAttribute("aria-hidden","true"),te(Te,{flexShrink:0,position:"relative",zIndex:2}),Se.appendChild(Te);}else {let Te=J("","span");te(Te,{width:14,flexShrink:0}),Se.appendChild(Te);}let Le=J("truncate","span");ze(Le,ge.text),fe.textOverflow==="clip"&&(typeof ge.text=="string"||typeof ge.text=="number")&&(Le.title=String(ge.text)),Se.appendChild(Le);}de.appendChild(Se),de.appendChild(Ke(`row-${W}`,a.rowHeader,1,n().rtl?"left":"right")),P.appendChild(de);}function z(P,R,B,W,Y){let{dataFields:se,leafColHashes:fe,dfsPerLeaf:Q,dataColOffset:A,showDataInRows:$,totalDataCols:N}=u,U=N>Lt,v=e.registry?e.registry.getPluginsByType("cellRender"):null;fe.forEach((I,O)=>{let K=O*Q,G=$?[se[B]]:se,j=U&&(K+Q<=C.start||K>=C.end),Z=j?null:Ye(u,R,I.hash,W,I.isGrandTotal);G.forEach((ie,ce)=>{let ke=K+ce,ve=A+ke,ee=J("kanuni-pivot-cell","td");if(ee.id=i(Y,ve),ee.setAttribute("role","gridcell"),ee.setAttribute("data-r",String(Y)),ee.setAttribute("data-c",String(ve)),j||U&&(ke<C.start||ke>=C.end)){P.appendChild(ee);return}let ye=Z?.values[`${ie.id}_display`]??Z?.values[ie.id],ge=b(ye,ie),de=W||I.isGrandTotal||!!Z?.isTotalCell,le=ie.conditionalFormatting?pivotgridCore.resolveConditionalVisual(Z?.values[ie.id],ie,Z??null,u.fieldRanges[ie.id]):Vn,Se=le.style,Le=ge;if(typeof ie.cellTemplate=="function")Le=ie.cellTemplate({value:ye,displayValue:ge,cell:Z,field:ie})??null;else if(v){for(let Pe of v)if(Pe.renderCell){let Xe=Pe.renderCell(ye,ge,Z,ie);if(Xe!=null){Le=Xe;break}}}let Te={text:Le,style:{textAlign:ie.dataType==="number"?"right":"left",fontWeight:de?600:400,backgroundColor:de?"var(--pivot-bg)":"transparent",cursor:e.hasCellClick?.()&&Z?"pointer":"default",...Se},className:`kanuni-pivot-cell ${de?"kanuni-pivot-cell-total":""}${e.shared?.focused?.r===Y&&e.shared?.focused?.c===ve?" kanuni-pivot-cell-focused":""}${We(e.shared?.selection??null,Y,ve)?" kanuni-pivot-cell-selected":""}`};if(e.onCellPrepared?.({area:"data",cell:Z,rowIndex:Y,columnIndex:ve,cellConfig:Te}),de&&(Te.style.fontWeight=pivotgridCore.paintedFontWeight(Te.style.fontWeight,600,"--pivot-font-weight-total")),ee.className=Te.className,te(ee,Te.style),ee.setAttribute("data-val",typeof ye=="number"?String(ye):""),ze(ee,Te.text),le.dataBar){let Pe=Math.round(le.dataBar.ratio*100);ee.style.setProperty("background-image",`linear-gradient(to ${n().rtl?"left":"right"}, ${le.dataBar.color} ${Pe}%, transparent ${Pe}%)`),ee.style.setProperty("background-repeat","no-repeat");}if(le.icon){let Pe=X(le.icon,12);Pe.style.setProperty("margin-inline-end","4px"),Pe.style.setProperty("vertical-align","middle"),ee.insertBefore(Pe,ee.firstChild);}P.appendChild(ee);});});}let q=(P,R)=>e.shared?.focused?.r===P&&e.shared?.focused?.c===R?" kanuni-pivot-cell-focused":"";function pe(P){let R=P.flatRow;return P.isGrandTotal||!R?{level:1}:R.isSubtotal||!R.hasChildren?{level:R.depth+1}:{level:R.depth+1,expanded:!!R.isExpanded}}function ae(P,R){let{t:B}=n(),{maxRowDepth:W,showDataInRows:Y,dataFields:se,layout:fe}=u,Q=J("kanuni-pivot-row","tr");if(Q.setAttribute("role","row"),Q.setAttribute("aria-rowindex",String(R+1)),te(Q,{height:l()}),fe.rowHeaderLayout==="tree"){let $=pe(P);Q.setAttribute("aria-level",String($.level)),$.expanded!==void 0&&Q.setAttribute("aria-expanded",String($.expanded));}if(P.isGrandTotal){Q.classList.add("kanuni-pivot-grand-total-row");for(let $=0;$<W;$++){let N=$===0,U=J("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(R,$),"td");U.id=i(R,$),U.setAttribute("role",N?"rowheader":"presentation"),te(U,{position:"sticky",zIndex:40,fontWeight:"var(--pivot-font-weight-grand-total, 700)",backgroundColor:"var(--pivot-surface)",paddingLeft:N?8:0,paddingRight:0,borderRight:$===W-1?"1px solid var(--pivot-border)":"none",whiteSpace:N?"nowrap":"normal",overflow:N?"visible":"hidden"}),Me(U,`var(--row-header-left-${$}, 0px)`),N&&(U.textContent=`${B("grandTotal")}${Y?` \u2014 ${se[P.dfIndex]?.caption??""}`:""}`),Q.appendChild(U);}if(Y){let $=J("kanuni-pivot-cell kanuni-pivot-cell-total"+q(R,W),"td");$.id=i(R,W),$.setAttribute("role","gridcell"),te($,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),Me($,`var(--row-header-left-${W}, 0px)`),$.textContent=String(se[P.dfIndex]?.caption??""),Q.appendChild($);}return z(Q,"",P.dfIndex,true,R),Q}let A=P.flatRow;if(A.isSubtotal){Q.classList.add("kanuni-pivot-subtotal-row");let $=`${B("subTotal")}: ${A.pathValues[A.depth]}`;if(fe.rowHeaderLayout==="tree"){let N=J("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(R,0),"td");N.id=i(R,0),N.setAttribute("role","rowheader"),te(N,{position:"sticky",zIndex:40,fontWeight:"var(--pivot-font-weight-total, 600)",backgroundColor:"var(--pivot-surface)",paddingLeft:8+A.depth*20}),Me(N,"var(--row-header-left-0, 0px)"),N.textContent=$,Q.appendChild(N);}else for(let N=0;N<W;N++){if(N<A.depth){H(Q,P,R,N);continue}let U=N===A.depth,v=J("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(R,N),"td");v.id=i(R,N),v.setAttribute("role",U?"rowheader":"presentation"),te(v,{position:"sticky",zIndex:40,fontWeight:"var(--pivot-font-weight-total, 600)",backgroundColor:"var(--pivot-surface)",paddingLeft:U?8:0,paddingRight:0,borderRight:N===W-1?"1px solid var(--pivot-border)":"none",whiteSpace:U?"nowrap":"normal",overflow:U?"visible":"hidden"}),Me(v,`var(--row-header-left-${N}, 0px)`),U&&(v.textContent=$),Q.appendChild(v);}if(Y){let N=J("kanuni-pivot-cell kanuni-pivot-cell-total"+q(R,W),"td");N.id=i(R,W),N.setAttribute("role","gridcell"),te(N,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),Me(N,`var(--row-header-left-${W}, 0px)`),N.textContent=String(se[P.dfIndex]?.caption??""),Q.appendChild(N);}return z(Q,A.key,P.dfIndex,true,R),Q}for(let $=0;$<W;$++)H(Q,P,R,$);if(Y){let $=J("kanuni-pivot-cell kanuni-pivot-row-header"+q(R,W),"td");if($.id=i(R,W),$.setAttribute("role","rowheader"),te($,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),Me($,`var(--row-header-left-${W}, 0px)`),P.isDataRow){let N=J("","span");te(N,{color:"var(--pivot-text-muted)",paddingLeft:8}),N.textContent=String(se[P.dfIndex]?.caption??""),$.appendChild(N);}$.appendChild(Ke(`row-${W}`,et,1,n().rtl?"left":"right")),Q.appendChild($);}return z(Q,A.key,P.dfIndex,false,R),Q}function re(){if(y||!u)return;let P=h();if(g(),p=P,m.textContent="",P.start>0){let R=J("","tr");te(R,{height:P.start*l()});let B=J("","td");B.colSpan=u.dataColOffset+Math.max(u.totalDataCols,1),te(B,{padding:0,border:"none"}),R.appendChild(B),m.appendChild(R);}for(let R=P.start;R<P.end;R++)m.appendChild(ae(u.virtualRows[R],R));te(x,{height:E()+u.virtualRows.length*l()});}function we(P){if(y)return;let R=n();R.locale!==f&&(f=R.locale,b=Ne(R.locale)),d=P.columnWidths??{},u=vt(P,{grandTotal:R.t("grandTotal"),subTotal:R.t("subTotal")}),s.setAttribute("role",u.layout.rowHeaderLayout==="tree"?"treegrid":"grid"),s.setAttribute("aria-rowcount",String(u.virtualRows.length+u.colHeaders.length+(e.chipDeps?1:0))),s.setAttribute("aria-colcount",String(u.dataColOffset+u.totalDataCols)),s.setAttribute("aria-label",R.t("pivotView"));let B=e.shared?.focused;B?s.setAttribute("aria-activedescendant",i(B.r,B.c)):s.removeAttribute("aria-activedescendant");for(let W of T)s.style.removeProperty(W);T.clear(),M();for(let[W,Y]of Object.entries(d)){if(!W.startsWith("leaf-"))continue;let se=`--col-width-data-${W.slice(5)}`;s.style.setProperty(se,`${Y}px`),T.add(se);}V(),D(),p={start:-1,end:-1},re();}let xe=()=>{if(y||!u)return;let P=h(),R=C.start;g(),(P.start!==p.start||P.end!==p.end||C.start!==R)&&re();};s.addEventListener("scroll",xe,{passive:true});let be=()=>{if(y||!u)return;M();let P=h(),R=C.start,B=C.end;g(),(P.start!==p.start||P.end!==p.end||C.start!==R||C.end!==B)&&re();},_=typeof ResizeObserver<"u"?new ResizeObserver(()=>be()):null;return _?.observe(s),{getVM:()=>u,getTheadHeight:E,paintStructural:we,paintWindow:re,refreshWindow:be,rowHeaderLayout(){let P=[];if(u){for(let R=0;R<u.maxRowDepth;R++)P.push(o(R));u.showDataInRows&&P.push(c());}return {configured:P,viewport:u&&S(P.length)?0:s.clientWidth}},scroller:s,destroy(){y=true,_?.disconnect(),s.removeEventListener("scroll",xe),s.remove();}}}var Nn=0;function Rt(){let e=`kp${++Nn}-`;return {lastResizeTime:0,isResizing:false,focused:null,selection:null,cellId:(t,n)=>`${e}pivot-cell-${t}-${n}`}}function At(e){let{scroller:t,controller:n,getVM:a,shared:l}=e,i=o=>o?.closest?.("td[data-r][data-c]")??null;function s(o,c){let r=l.focused;l.focused={r:o,c},r&&t.querySelector(`td[id="${l.cellId(r.r,r.c)}"]`)?.classList.remove("kanuni-pivot-cell-focused"),t.querySelector(`td[id="${l.cellId(o,c)}"]`)?.classList.add("kanuni-pivot-cell-focused"),t.setAttribute("aria-activedescendant",l.cellId(o,c));}function x(o,c,r){if(!e.onCellClick)return;let g=a();if(!g)return;let h=gt(g,c,r);if(!h)return;let w={event:o,cellType:h.isTotal?"grandTotal":"data",value:h.val,rowPath:h.cell.rowPath,colPath:h.cell.colPath};e.onCellClick(e.resolveCellClick?e.resolveCellClick(w):w);}let L=o=>{let c=o.target,r=c.closest("[data-col-expand]");if(r){n.toggleColExpanded(r.getAttribute("data-col-expand")??"");return}if(c.closest(".kanuni-pivot-resize-handle"))return;let g=c.closest("[data-filter-field]");if(g){e.onFilterClick?.(o.clientX,o.clientY,g.getAttribute("data-filter-field")??"");return}let h=c.closest("th[data-header-field]");if(h){if(Date.now()-l.lastResizeTime<100)return;let D=a();if(!D)return;let H=h.getAttribute("data-header-field")??"",z=h.getAttribute("data-header-col-path")??"",q=D.rowFields.find(pe=>pe.sortBySummaryField===H&&(pe.sortBySummaryPath||"")===z);q&&n.sortField(q.id,q.sortOrder==="asc"?"desc":"asc");return}let w=i(c);if(!w)return;let S=Number(w.getAttribute("data-r")),M=Number(w.getAttribute("data-c")),V=a();if(V){if(t.focus({preventScroll:true}),s(S,M),M<V.dataColOffset){if(Date.now()-l.lastResizeTime<100)return;let D=Ze(V,S,M);D?.hasChildren&&n.toggleExpanded(D.cellHashStr);return}x(o,S,M);}},k=o=>{if(o.target.closest?.(".kanuni-pivot-resize-handle"))return;let c=i(o.target);if(!c)return;let r=Number(c.getAttribute("data-r")),g=Number(c.getAttribute("data-c")),h=a();!h||g<h.dataColOffset||x(o,r,g);},F=o=>{let c=o.target.closest?.("th[data-header-field]");if(c){o.preventDefault(),c.hasAttribute("aria-expanded")?e.onNodeContextMenu?.({x:o.clientX,y:o.clientY,path:c.getAttribute("data-header-col-path")??"",isExpanded:c.getAttribute("aria-expanded")==="true",depth:Number(c.getAttribute("data-header-depth")??0),type:"col"}):e.onHeaderContextMenu&&e.onHeaderContextMenu(o.clientX,o.clientY,c.getAttribute("data-header-field")??"",c.getAttribute("data-header-col-path")??void 0);return}let r=i(o.target);if(!r)return;let g=Number(r.getAttribute("data-r")),h=Number(r.getAttribute("data-c")),w=a();if(w){if(h<w.dataColOffset){let S=Ze(w,g,h);if(S){let{flatRow:M,hasChildren:V,cellHashStr:D,isExpanded:H,depth:z,dIdx:q}=S,pe=w.layout.rowHeaderLayout==="tree",ae=q>M.depth,re=ae?M.hasChildren:V;if(re&&e.onNodeContextMenu){o.preventDefault(),e.onNodeContextMenu({x:o.clientX,y:o.clientY,path:ae?pe?M.key:pivotgridCore.pathKey(M.pathValues.slice(0,M.depth+1)):D,isExpanded:ae?M.isExpanded:H,depth:ae?M.depth:z,type:"row"});return}if(re)return}}e.onGlobalContextMenu&&(o.preventDefault(),e.onGlobalContextMenu(o.clientX,o.clientY));}},m=e.keyboardEnabled!==false;function u(){let o=l.focused;l.focused=null,o&&t.querySelector(`td[id="${l.cellId(o.r,o.c)}"]`)?.classList.remove("kanuni-pivot-cell-focused"),t.removeAttribute("aria-activedescendant");}let b=new Set(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),f=o=>{if(o.target!==t)return;let c=a();if(!c)return;if(!l.focused){if(!b.has(o.key)||c.virtualRows.length===0)return;o.preventDefault(),s(0,0),(o.shiftKey||!(o.ctrlKey||o.metaKey))&&l.selectByKey?.(0,0,false,{r:0,c:0});return}let{r,c:g}=l.focused,h={r,c:g},w=o.ctrlKey||o.metaKey,S=c.dataColOffset+c.totalDataCols,M=e.rowHeight?.()??28,V=e.getTheadHeight?.()??c.colHeaders.length*M,D=Math.max(1,Math.ceil(((t.clientHeight||600)-V)/M));switch(o.key){case "ArrowDown":o.preventDefault(),r=Math.min(c.virtualRows.length-1,r+1);break;case "ArrowUp":o.preventDefault(),r=Math.max(0,r-1);break;case "ArrowRight":o.preventDefault(),g=Math.min(S-1,g+1);break;case "ArrowLeft":o.preventDefault(),g=Math.max(0,g-1);break;case "Home":o.preventDefault(),(o.ctrlKey||o.metaKey)&&(r=0),g=0;break;case "End":o.preventDefault(),(o.ctrlKey||o.metaKey)&&(r=c.virtualRows.length-1),g=S-1;break;case "PageDown":o.preventDefault(),r=Math.min(c.virtualRows.length-1,r+D-1);break;case "PageUp":o.preventDefault(),r=Math.max(0,r-D+1);break;case "Escape":o.preventDefault(),u();return;case " ":case "Enter":{o.preventDefault(),o.key===" "&&l.selectByKey?.(r,g,o.shiftKey,h);let q=t.querySelector(`td[id="${l.cellId(r,g)}"]`);q&&(o.key===" "?q.click():q.dispatchEvent(new MouseEvent("dblclick",{bubbles:true})));return}default:return}let H=V+r*M,z=t.clientHeight||600;H<t.scrollTop+V?(t.scrollTop=H-V,t.dispatchEvent(new Event("scroll"))):H+M>t.scrollTop+z&&(t.scrollTop=H+M-z,t.dispatchEvent(new Event("scroll"))),s(r,g),(o.shiftKey||!w)&&l.selectByKey?.(r,g,o.shiftKey,h),g>=c.dataColOffset&&p(r,g,c.dataColOffset);};function p(o,c,r){let g=t.querySelector(`td[id="${l.cellId(o,c)}"]`)??t.querySelector(`td[data-c="${c}"]`);if(!g)return;let h=t.getBoundingClientRect(),w=getComputedStyle(t).direction==="rtl",S=t.querySelector(`td[data-c="${r-1}"]`)?.getBoundingClientRect(),M=g.getBoundingClientRect(),V=w?h.right-t.clientWidth:h.left,D=w?V:S?S.right:V,H=w&&S?S.left:V+t.clientWidth,z=0;M.left<D?z=M.left-D:M.right>H&&(z=Math.min(M.right-H,M.left-D)),z!==0&&(t.scrollLeft+=z,t.dispatchEvent(new Event("scroll")));}let C=o=>{if(o.button!==0)return;let c=i(o.target);if(!c)return;let r=Number(c.getAttribute("data-r")),g=Number(c.getAttribute("data-c"));l.focused?.r===r&&l.focused.c===g||s(r,g);},d=false,T=()=>{d=true,setTimeout(()=>{d=false;},0);},y=o=>{let c=a();c&&!l.focused&&!d&&o.target===t&&c.virtualRows.length>0&&s(0,0);},E=o=>{o.relatedTarget&&t.contains(o.relatedTarget)||u();};return t.addEventListener("mousedown",T,true),t.addEventListener("pointerdown",T,true),t.addEventListener("click",L),m&&t.addEventListener("mouseup",C),t.addEventListener("dblclick",k),t.addEventListener("contextmenu",F),m?(t.addEventListener("keydown",f),t.addEventListener("focus",y),t.addEventListener("blur",E)):t.removeAttribute("tabindex"),{destroy(){t.removeEventListener("click",L),t.removeEventListener("mouseup",C),t.removeEventListener("dblclick",k),t.removeEventListener("contextmenu",F),t.removeEventListener("mousedown",T,true),t.removeEventListener("pointerdown",T,true),m&&(t.removeEventListener("keydown",f),t.removeEventListener("focus",y),t.removeEventListener("blur",E));}}}function Ht(e){let{host:t,scroller:n,shared:a}=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 i=null,s=1,x=0,L=1,k=0,F=[],m={},u=null,b=-1,f=y=>{l.style.display="block",l.style.transform=`translateX(${pivotgridCore.resizeLineX(y,t)}px)`;},p=y=>{a.isResizing&&f(y.clientX);},C=y=>{if(!a.isResizing||!i)return;l.style.display="none";let E=(y.clientX-x)/L,o=e.isRtl()?-E:E;if(i.startsWith("row-")){let c=Math.max(20,k+o);m[i]=u?pivotgridCore.invertRowHeaderWidth(u.configured,b,c,u.viewport):c;}else if(i.startsWith("leaf-")){let c=i.split("-"),r=parseInt(c[1],10),h=Math.max(s*20,k+o)/k;for(let w=0;w<s;w++)m[`leaf-${r+w}`]=Math.max(20,F[w]*h);}a.isResizing=false,a.lastResizeTime=Date.now(),i=null,document.body.style.cursor="",document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",C),e.commit({...m});},d=y=>{let E=y.target.closest?.(".kanuni-pivot-resize-handle");if(!E||(y.preventDefault(),y.stopPropagation(),i=E.getAttribute("data-resize-id"),!i))return;let o=Number(E.getAttribute("data-resize-default")||150);if(s=Number(E.getAttribute("data-resize-span")||1),x=y.clientX,L=pivotgridCore.cssZoomOf(t),m={...e.getWidths()},i.startsWith("row-"))b=parseInt(i.slice(4),10),u=e.rowHeaderLayout(),k=pivotgridCore.computeRowHeaderWidths(u.configured,u.viewport).widths[b]??m[i]??o;else if(i.startsWith("leaf-")){let c=parseInt(i.split("-")[1],10);F=[],k=0;for(let r=0;r<s;r++){let g=m[`leaf-${c+r}`]||o;F.push(g),k+=g;}}a.isResizing=true,f(y.clientX),document.body.style.cursor="col-resize",document.addEventListener("mousemove",p),document.addEventListener("mouseup",C);},T=y=>{let E=y.target.closest?.(".kanuni-pivot-resize-handle"),o=E?.getAttribute("data-resize-id");if(!E||!o||a.isResizing)return;y.preventDefault(),y.stopPropagation();let c={...e.getWidths()},r=E.closest("th,td");if(o.startsWith("row-")){let g=o.slice(4),h=pivotgridCore.measureFitWidth(Array.from(n.querySelectorAll(`td[data-c="${g}"], th[data-row-header-idx="${g}"]`)),t);if(!h)return;let w=e.rowHeaderLayout();c[o]=pivotgridCore.invertRowHeaderWidth(w.configured,parseInt(g,10),Math.max(pivotgridCore.ROW_HEADER_MIN_COL_WIDTH,h),w.viewport);}else if(o.startsWith("leaf-")){let g=Number(E.getAttribute("data-resize-span")||1),h=parseInt(o.split("-")[1],10),w=e.dataColOffset?.()??0,S=[];for(let D=0;D<g;D++){let H=Array.from(n.querySelectorAll(`td[data-c="${w+h+D}"]`));g===1&&r&&H.unshift(r);let z=pivotgridCore.measureFitWidth(H,t);S.push(z?Math.max(20,z):c[`leaf-${h+D}`]||Number(E.getAttribute("data-resize-default")||95));}let M=S.reduce((D,H)=>D+H,0),V=g>1&&r?pivotgridCore.measureFitWidth([r],t):0;V>M&&(S=S.map(D=>D*V/M)),S.forEach((D,H)=>{c[`leaf-${h+H}`]=D;});}else return;a.lastResizeTime=Date.now(),e.commit(c);};return n.addEventListener("mousedown",d),n.addEventListener("dblclick",T),{destroy(){n.removeEventListener("mousedown",d),n.removeEventListener("dblclick",T),a.isResizing&&(a.isResizing=false,document.body.style.cursor=""),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",C),l.remove();}}}function Dt(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function De(e){let t=Dt("kanuni-pivot-root kanuni-pivot-portal-container");Ot(t,e);let n=nt.get(e);return n||nt.set(e,n=new Set),n.add(t),t}var nt=new WeakMap,It=new WeakMap;function Ot(e,t){for(let i of It.get(e)??[])e.classList.remove(i);let n=Array.from(t.classList).filter(i=>i.startsWith("kanuni-pivot-")&&i!=="kanuni-pivot-root");for(let i of n)e.classList.add(i);It.set(e,n);let a=e.style.getPropertyValue("zoom");e.setAttribute("style",t.getAttribute("style")??"");for(let i of ["position","inset","z-index","width","height"])e.style.removeProperty(i);a&&e.style.setProperty("zoom",a);let l=t.getAttribute("data-theme");l?e.setAttribute("data-theme",l):e.removeAttribute("data-theme"),e.setAttribute("dir",t.getAttribute("dir")??"ltr");}function Vt(e){let t=nt.get(e);if(t)for(let n of Array.from(t)){if(!n.isConnected){t.delete(n);continue}Ot(n,e);}}function Oe(e){e.style.removeProperty("zoom");let t=pivotgridCore.cssZoomOf(e);Math.abs(t-1)>.01&&e.style.setProperty("zoom",String(1/t));}function $e(){let e=document,t=e.fullscreenElement??e.webkitFullscreenElement??null;return t||(document.querySelector(".pivot-is-fullscreen")??document.body)}function ot(e){let t=null,n=null;function a(){n?.(),n=null,t?.remove(),t=null;}function l(i){a(),t=De(e);let s=Dt("kanuni-pivot-portal-root");t.appendChild(s),$e().appendChild(t),Oe(t);let x=i(s),L=t,k=m=>{L.contains(m.target)||a();},F=m=>{m.key==="Escape"&&a();};return document.addEventListener("pointerdown",k,true),document.addEventListener("keydown",F,true),n=()=>{document.removeEventListener("pointerdown",k,true),document.removeEventListener("keydown",F,true),x?.();},s}return {openPopup:l,closePopup:a,isOpen:()=>t!==null,destroy:a}}var zt=new Map,$t=new Map;function Bt(e,t,n,a="(Blanks)"){if(e==null)return a;if(t.format&&typeof e=="number")try{let l=t.format,i=JSON.stringify(l)+"_"+n,s=$t.get(i);s||(s=new Intl.NumberFormat(n,l),$t.set(i,s));let x=s.format(e);return l.isCustom&&(l.prefix||l.suffix)?`${l.prefix||""}${x}${l.suffix||""}`:x}catch{return String(e)}return String(e)}var Re=28;function me(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var eo="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 to(){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",eo),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","1.5"),t.setAttribute("stroke-linecap","round"),e.appendChild(t),e}function Nt(e){let{portal:t}=e;function n(a,l,i){let s=e.getField(i);if(!s)return;let{t:x,rtl:L,locale:k}=e.getI18n(),F=true,m=[],u="",b=new Set,f=0,p=220,C=false,d=[];t.openPopup(T=>{let y=me("kanuni-pivot-popup pivot-animate-zoom-in"),E=pivotgridCore.popupViewport(),o=pivotgridCore.placePopup({x:a,y:l},{width:250,height:350},{margin:10,viewport:E});y.setAttribute("role","dialog"),y.setAttribute("aria-label",x("columnFilter")),y.setAttribute("data-datagrid-keyboard-scope","modal"),y.tabIndex=-1,Object.assign(y.style,{left:`${o.left}px`,top:`${o.top}px`,width:"250px",height:`${Math.min(350,o.maxHeight)}px`,minWidth:"200px",minHeight:`${Math.min(250,o.maxHeight)}px`,maxWidth:`${Math.min(600,E.width-20)}px`,maxHeight:`${Math.min(350,o.maxHeight)}px`,resize:"both",direction:L?"rtl":"ltr"});let c=me("kanuni-pivot-popup-header"),r=me("kanuni-pivot-popup-search");r.appendChild(to());let g=me("kanuni-pivot-popup-search-input","input");g.type="text",g.placeholder=x("search"),g.setAttribute("aria-controls","pivot-filter-options"),r.appendChild(g),c.appendChild(r);let h=me("kanuni-pivot-popup-actions"),w=me("kanuni-pivot-popup-action-btn kanuni-pivot-popup-action-btn--primary","button");w.textContent=x("selectAll");let S=me("kanuni-pivot-popup-action-btn kanuni-pivot-popup-action-btn--danger","button");S.textContent=x("clearAll"),h.append(w,S),c.appendChild(h);let M=me("kanuni-pivot-popup-list pivot-custom-scrollbar");M.id="pivot-filter-options";let V=me("");V.style.position="relative",M.appendChild(V);let D=me("kanuni-pivot-popup-footer"),H=me("kanuni-pivot-btn kanuni-pivot-btn--outline","button");H.textContent=x("cancel");let z=me("kanuni-pivot-btn kanuni-pivot-btn--primary","button");z.textContent=x("ok");for(let A of [H,z])Object.assign(A.style,{height:"28px",padding:"0 12px",fontSize:"12px"});if(D.append(H,z),e.openCondition&&(s.area==="row"||s.area==="column")){let A=me("kanuni-pivot-btn kanuni-pivot-btn--outline","button");A.type="button",A.setAttribute("data-condition-filter",""),A.title=x("conditionFilter")+"\u2026",A.setAttribute("aria-label",A.title),Object.assign(A.style,{height:"28px",padding:"0 7px",marginInlineEnd:"auto"}),(s.valueFilter||s.labelFilter)&&(A.style.color="var(--pivot-danger)"),A.appendChild(X("settings-2",14)),A.addEventListener("click",()=>{t.closePopup(),e.openCondition(s.id);}),D.prepend(A);}y.append(c,M,D),T.appendChild(y);let q=()=>{if(!u)return m;let A=u.toLowerCase(),$=A.replace(/,/g,"."),N=A.replace(/\./g,","),U=A.replace(/[.,\s]/g,"");return m.filter(v=>{let I=v.label.toLowerCase(),O=I.replace(/[.,\s]/g,"");return I.includes(A)||I.includes($)||I.includes(N)||!!U&&O.includes(U)})},pe=()=>b.size===m.length,ae=()=>!u,re=()=>q().length+(ae()?1:0),we=()=>re()===0?-1:Math.min(f,re()-1),xe=A=>{if(ae()&&A===0)return "select-all";let $=ae()?A-1:A;return `value:${q()[$]?.rawStr}`},be=new Map;function _(){if(C)return;let A=document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains("kanuni-pivot-popup-item");if(z.disabled=!F&&m.length>0&&b.size===0,V.textContent="",be.clear(),F){V.style.height="";let O=me("pivot-flex pivot-items-center pivot-justify-center pivot-h-full"),K=me("");Object.assign(K.style,{width:"24px",height:"24px",border:"2px solid var(--pivot-border)",borderTopColor:"var(--pivot-primary)",borderRadius:"50%",animation:"spin 1s linear infinite"}),O.appendChild(K),V.appendChild(O);return}let $=q(),N=re();V.style.height=`${N*Re}px`;let U=Math.max(0,Math.floor(M.scrollTop/Re)-2),v=Math.min(N,U+Math.ceil(p/Re)+4),I=we();for(let O=U;O<v;O++){let K,G,j,Z,ie;if(ae()&&O===0)K="select-all",G=`(${x("selectAll")})`,j=pe(),Z=true,ie=R;else {let ee=$[ae()?O-1:O];if(!ee)continue;K=`value:${ee.rawStr}`,G=ee.label,j=b.has(ee.rawStr),Z=false,ie=()=>B(ee.rawStr);}let ce=me(`kanuni-pivot-popup-item${j?" kanuni-pivot-popup-item--checked":""}${O===I?" kanuni-pivot-popup-item--active":""}`);ce.id=K,ce.setAttribute("role","checkbox"),ce.setAttribute("aria-checked",String(j)),ce.tabIndex=0,Object.assign(ce.style,{position:"absolute",top:`${O*Re}px`,insetInlineStart:"0",insetInlineEnd:"0",height:`${Re}px`,fontWeight:Z?"600":"400"});let ke=me("kanuni-pivot-checkbox","input");ke.type="checkbox",ke.checked=j,ke.readOnly=true,ke.tabIndex=-1;let ve=me("pivot-truncate","span");ve.textContent=G,ce.append(ke,ve),ce.addEventListener("click",ie),ce.addEventListener("focus",()=>{f=O;}),V.appendChild(ce),be.set(O,ce);}if($.length===0){let O=me("");Object.assign(O.style,{padding:"12px",textAlign:"center",fontSize:"12px",color:"var(--pivot-text-muted)"}),O.textContent=x("noItems"),V.appendChild(O);}g.setAttribute("aria-activedescendant",I>=0?xe(I):""),A&&be.get(I)?.focus();}function P(A){b=new Set(b);for(let $ of q())A?b.add($.rawStr):b.delete($.rawStr);_();}function R(){P(!q().every(A=>b.has(A.rawStr)));}function B(A){b.has(A)?b.delete(A):b.add(A),_();}function W(){if(z.disabled)return;let A=pivotgridCore.headerFilterWrite(m,b,s);A.kind==="clear"?e.clear(s.id):A.kind==="apply"&&e.apply(s.id,A.values,A.filterType),t.closePopup();}function Y(A){f=Math.max(0,Math.min(re()-1,A));let $=f*Re;$<M.scrollTop?M.scrollTop=$:$+Re>M.scrollTop+p&&(M.scrollTop=$+Re-p),_(),be.get(f)?.focus();}let se=A=>{if(A.key==="ArrowDown"||A.key==="ArrowUp"){if(A.preventDefault(),re()===0)return;Y(we()+(A.key==="ArrowDown"?1:-1));return}if(A.key==="Home"&&re()>0){A.preventDefault(),Y(0);return}if(A.key==="End"&&re()>0){A.preventDefault(),Y(re()-1);return}if(A.key==="Backspace"&&A.target!==g){A.preventDefault(),g.focus(),u=u.slice(0,-1),g.value=u,f=0,_();return}if(A.key===" "||A.code==="Space"){if(A.target===g)return;A.preventDefault();let $=we();if(re()>0&&$>=0)if(ae()&&$===0)R();else {let N=q()[ae()?$-1:$];N&&B(N.rawStr);}return}if(A.key==="Enter"){A.preventDefault(),W();return}if(A.key==="Escape"){A.stopPropagation(),t.closePopup();return}A.key.length===1&&!A.ctrlKey&&!A.metaKey&&!A.altKey&&A.target!==g&&(A.preventDefault(),g.focus(),u+=A.key,g.value=u,f=0,_());},fe=A=>{se(A),A.defaultPrevented&&A.stopPropagation();};document.addEventListener("keydown",fe,true),y.addEventListener("click",A=>A.stopPropagation()),g.addEventListener("input",()=>{u=g.value,f=0,_();}),w.addEventListener("click",R),S.addEventListener("click",()=>P(false)),H.addEventListener("click",()=>t.closePopup()),z.addEventListener("click",W),M.addEventListener("scroll",()=>{zt.set(s.id,M.scrollTop),_();});let Q=typeof ResizeObserver<"u"?new ResizeObserver(A=>{for(let $ of A)p=$.contentRect.height;}):null;return Q?.observe(M),_(),g.focus(),d.push(setTimeout(()=>{if(C)return;if(!s.dataField&&!s.isCalculated){m=[],F=false,_();return}let A=pivotgridCore.getFieldDistinctValues(s.id,e.gridId);if(A)m=A.map(N=>({rawStr:N.rawStr==="null"||N.rawStr==="undefined"?x("blanks"):N.rawStr,rawVal:N.rawVal,label:Bt(N.rawVal,s,k,x("blanks"))}));else {let N=new Map,U=e.getData();for(let I=0;I<U.length;I++){let O=pivotgridCore.extractGroupValue(U[I],s);if(O==="(Blank)"&&s.calculateSummaryExpression)continue;let K=O==null?x("blanks"):String(O);N.has(K)||N.set(K,O);}let v=Array.from(N.values());if(s.dataType==="number")v.sort((I,O)=>Number(I)-Number(O));else {let I=pivotgridCore.collatorFor().compare;v.sort((O,K)=>I(String(O),String(K)));}m=v.map(I=>({rawStr:I==null?x("blanks"):String(I),rawVal:I,label:Bt(I,s,k,x("blanks"))}));}b=pivotgridCore.headerFilterShown(m,s),F=false,_();let $=zt.get(s.id)||0;$>0&&d.push(setTimeout(()=>{C||(M.scrollTop=$,_());},50)),d.push(setTimeout(()=>{C||g.focus();},50));},10)),()=>{C=true,document.removeEventListener("keydown",fe,true);for(let A of d)clearTimeout(A);Q?.disconnect();}});}return {open:n,close:()=>t.closePopup()}}function Ce(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Wt(e){let t=Ce("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,a=null,l=null,i=null;function s(){n=null,a?.remove(),a=null,l?.classList.remove("kanuni-pivot-footer-btn--active"),l=null;}let x=y=>{e.onGlobalContextMenu&&(y.preventDefault(),e.onGlobalContextMenu(y.clientX,y.clientY));};t.addEventListener("contextmenu",x);let L=y=>{!n||y.target?.closest?.("[data-footer-menu]")?.getAttribute("data-footer-menu")===n||s();};document.addEventListener("mousedown",L);let k=Ce("kanuni-pivot-search","input");k.type="search";let F,m=()=>{clearTimeout(F),e.onSearch?.(k.value);};k.addEventListener("input",()=>{clearTimeout(F),F=setTimeout(m,250);}),k.addEventListener("keydown",y=>{y.stopPropagation(),y.key==="Enter"?m():y.key==="Escape"&&(k.value="",m());});function u(y,E,o=false){let c=Ce(`kanuni-pivot-footer-btn${o?" kanuni-pivot-footer-btn--active":""}`,"button");return c.title=E,c.setAttribute("aria-label",E),c.type="button",c.appendChild(X(y,15)),c}let b=()=>Ce("kanuni-pivot-footer-divider");function f(y,E,o,c,r,g={}){let h=Ce("kanuni-pivot-dropdown-item pivot-flex","button");h.type="button",h.style.gap="12px",g.locked&&(h.style.opacity="0.6",h.style.cursor=g.canUpgrade?"pointer":"not-allowed",g.canUpgrade||(h.disabled=true),g.hint&&(h.title=g.hint)),h.appendChild(X(y,16,E));let w=Ce(""),S=Ce("pivot-font-medium pivot-flex pivot-items-center");if(S.style.gap="6px",S.appendChild(document.createTextNode(o)),g.locked&&g.badge){let M=Ce("","span");Object.assign(M.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)"}),M.textContent=g.badge,S.appendChild(M);}if(w.appendChild(S),c!==null){let M=Ce("pivot-text-xs pivot-text-muted");M.textContent=c,w.appendChild(M);}return h.appendChild(w),r&&h.addEventListener("click",r),h}function p(y,E=false){let o=Ce("kanuni-pivot-report-section-title");return E&&(o.style.marginTop="4px",o.style.borderTop="1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"),o.textContent=y,o}function C(){let y=Ce("kanuni-pivot-dropdown-menu pivot-animate-slide-up pivot-custom-scrollbar");return Object.assign(y.style,{bottom:"100%",left:"0",marginBottom:"4px",width:"256px",maxHeight:"384px",overflowY:"auto"}),y}function d(y){n=null,i&&T(i),e.onExport(y);}function T(y){i=y;let{t:E,locale:o}=e.getI18n(),c=e.toolbar??{},r=document.activeElement===k;if(t.textContent="",a=null,l=null,c.showSaveReport!==false&&e.mountReportMenu){let h=Ce("pivot-relative");e.mountReportMenu(h),h.childNodes.length>0&&(t.appendChild(h),t.appendChild(b()));}if(c.showFieldChooserToggle!==false){let h=u("settings",E("showFieldList"),e.fieldChooserOpen());h.addEventListener("click",e.onToggleFieldChooser),t.appendChild(h);}if(e.onOpenPrefilter){let h=u("filter",E("filterBuilder"));h.addEventListener("click",e.onOpenPrefilter),t.appendChild(h);}if(e.onToggleChart){let h=u("bar-chart",E("chartToggle"));h.addEventListener("click",e.onToggleChart),t.appendChild(h);}if(c.showCalculatedFields!==false&&e.onAddCalculatedField){let h=u("calculator",E("calculatedMeasureDesigner"));h.addEventListener("click",e.onAddCalculatedField),t.appendChild(h);}if(t.appendChild(b()),c.showExpandCollapseAll!==false){let h=u("maximize2",E("expandAll"));h.addEventListener("click",e.onExpandAll);let w=u("minimize2",E("collapseAll"));w.addEventListener("click",e.onCollapseAll),t.append(h,w);}if(c.showRefreshButton!==false&&e.onRefresh){t.appendChild(b());let h=u("refresh-cw",E("refreshData"));h.addEventListener("click",e.onRefresh),t.appendChild(h);}if(c.showFullscreenToggle!==false&&e.onToggleFullscreen){t.appendChild(b());let h=e.isFullscreen(),w=u(h?"shrink":"fullscreen",E(h?"exitFullscreen":"enterFullscreen"),h);h&&Object.assign(w.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)"}),w.addEventListener("click",e.onToggleFullscreen),t.appendChild(w);}if(t.appendChild(b()),c.showExportButton!==false){let h=Ce("pivot-relative");h.setAttribute("data-footer-menu","export");let w=u("download",E("export"),n==="export");if(w.addEventListener("click",()=>{n=n==="export"?null:"export",T(y);}),h.appendChild(w),n==="export"){let S=C(),M=H=>{let z=!e.advancedExport;return {locked:z,canUpgrade:z&&!!e.upgradeUrl,badge:E("enterpriseBadge"),hint:z&&e.upgradeUrl?E("enterpriseUpgradeHint"):void 0}},V=(H,z)=>{if(!(!e.advancedExport))return ()=>d(H);if(e.upgradeUrl)return ()=>{n=null,T(y),window.open(e.upgradeUrl,"_blank","noopener,noreferrer");}},D=e.registry?.getPluginsByType("exporter")??[];if(D.length>0){S.appendChild(p(E("customExports")));for(let H of D)S.appendChild(f("database","var(--pivot-primary)",`${H.id.replace("exporter-","").toUpperCase()} ${E("export")}`,E("customPlugin"),()=>d(H.id)));S.appendChild(Ce("kanuni-pivot-dropdown-divider"));}S.appendChild(p(E("excelExport"))),S.appendChild(f("file-spreadsheet","var(--pivot-success)",E("pivotView"),E("preservesGridLayout"),V("excel-pivot"),M())),S.appendChild(f("file-spreadsheet","var(--pivot-success)",E("listView"),E("rawFlatData"),V("excel-list"),M())),S.appendChild(p(E("document"),true)),S.appendChild(f("file-text","var(--pivot-danger)",E("pdfDocument"),E("printReadyLayout"),V("pdf"),M())),S.appendChild(f("printer","var(--pivot-info)",E("print"),E("sendToPrinter"),()=>d("print"))),S.appendChild(f("copy","var(--pivot-primary)",E("copyToClipboard"),E("tabSeparatedValues"),()=>d("clipboard"))),S.appendChild(f("file-json","var(--pivot-success)",E("fullSnapshot"),E("saveSessionState"),()=>d("json-snapshot"))),S.appendChild(p(E("rawDataFormats"),true)),S.appendChild(f("file","var(--pivot-info)","CSV",null,()=>d("csv"))),S.appendChild(f("file-json","var(--pivot-warning)","JSON (Tree)",null,()=>d("json-pivot"))),S.appendChild(f("file-json","var(--pivot-warning)","JSON (List)",null,()=>d("json"))),S.appendChild(f("database","var(--pivot-text-muted)","XML",null,()=>d("xml"))),h.appendChild(S),a=S,l=w;}t.appendChild(h);}if(e.onSearch){let h=E("search").replace(/[.\u2026]+$/,"");k.placeholder=E("search"),k.setAttribute("aria-label",h),t.appendChild(b()),t.appendChild(k),r&&k.focus();}let g=y.selectionStats;if(g){let h=new Intl.NumberFormat(o,{minimumFractionDigits:2,maximumFractionDigits:2}),w=Ce("kanuni-pivot-selection-stats pivot-text-muted pivot-font-medium pivot-flex pivot-items-center");Object.assign(w.style,{marginLeft:"auto",fontSize:"11px",gap:"8px",paddingRight:"8px",userSelect:"none"});let S=[[E("count"),String(g.count)],[E("sum"),h.format(g.sum)],[E("avg"),h.format(g.avg)],[E("min"),h.format(g.min)],[E("max"),h.format(g.max)]];for(let[M,V]of S){let D=Ce("","span");D.textContent=`(${M}: ${V})`,w.appendChild(D);}t.appendChild(w);}}return {element:t,paint:T,syncSearch(y){document.activeElement!==k&&(k.value=y);},destroy(){clearTimeout(F),t.removeEventListener("contextmenu",x),document.removeEventListener("mousedown",L),t.remove();}}}var Gt=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];function jt(e,t){let n=false,a=()=>{let L=document;return L.fullscreenElement??L.webkitFullscreenElement??L.mozFullScreenElement??L.msFullscreenElement??null},l=()=>n||a()===e;function i(L){if(n=L,e.classList.toggle("pivot-is-fullscreen",L),L)Object.assign(e.style,{position:"fixed",inset:"0",zIndex:"9990",width:"auto",height:"auto"});else for(let k of ["position","inset","z-index","width","height"])e.style.removeProperty(k);}let s=()=>{let L=l();e.classList.toggle("pivot-is-fullscreen",a()===e||n),t(L);};for(let L of Gt)document.addEventListener(L,s);function x(){let L=document;if(l()){if(n){i(false),t(false);return}L.exitFullscreen?L.exitFullscreen():L.webkitExitFullscreen?L.webkitExitFullscreen():L.mozCancelFullScreen?L.mozCancelFullScreen():L.msExitFullscreen?L.msExitFullscreen():t(false);return}let k=e;k.requestFullscreen?k.requestFullscreen().then(()=>{e.classList.add("pivot-is-fullscreen");},()=>{i(true),t(true);}):k.webkitRequestFullscreen?k.webkitRequestFullscreen():k.mozRequestFullScreen?k.mozRequestFullScreen():k.msRequestFullscreen?k.msRequestFullscreen():(i(true),t(true));}return {isFullscreen:l,toggle:x,destroy(){for(let L of Gt)document.removeEventListener(L,s);n&&i(false);}}}var rt=["row","column","data","filter","chooser"];function qt(e){let t={activeId:null,targetId:null,targetArea:null,intent:null};function n(r,g,h){t.targetId===r&&t.targetArea===g&&t.intent===h||(t.targetId=r,t.targetArea=g,t.intent=h,e.controller.setDragIntent(r,g,h),e.onIntentChange({...t}));}let a=null,l=null,i=null,s=null;function x(r,g,h){i=De(e.gridRoot),i.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 w=document.createElement("span");w.className="pivot-truncate",Object.assign(w.style,{maxWidth:"150px",color:"var(--pivot-text)"});let S=e.getFields().find(M=>M.id===r);w.textContent=S?.caption||S?.id||"Field",s.appendChild(w),i.appendChild(s),document.body.appendChild(i),Oe(i),L(g,h);}function L(r,g){s&&(s.style.transform=`translate3d(${r+6}px, ${g+6}px, 0) scale(1.05)`);}function k(){i?.remove(),i=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 F(r){let g=l;if(k(),l=null,a?.holdTimer&&clearTimeout(a.holdTimer),a=null,document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",C),document.removeEventListener("pointercancel",T),document.removeEventListener("keydown",y,true),!g)return;let h=t.activeId??g.dropId.replace("chooser-","");t.activeId=null,t.targetId=null,t.targetArea=null,t.intent=null,e.onIntentChange({...t}),r===null?e.controller.resetDrag():e.controller.commitDrag(h,r);}function m(){if(!a)return;let{el:r,dropId:g,pointerId:h,startX:w,startY:S}=a;l={el:r,dropId:g,pointerId:h,startX:w,startY:S},a=null;let M=g.replace("chooser-","");t.activeId=M,e.controller.setDragActive(M),r.classList.add("is-dragging"),r.style.pointerEvents="none",r.style.cursor="grabbing",x(M,w,S),window.getSelection?.()?.removeAllRanges?.(),document.body.style.userSelect="none",e.onIntentChange({...t});}function u(r,g){let h=null,w=null,S=null,M=typeof document.elementFromPoint=="function"?document.elementFromPoint(r,g):null;for(let V of e.roots())for(let D of V.querySelectorAll("[data-drop-id]")){if(l&&D===l.el||M&&!D.contains(M)||D.classList.contains("kanuni-pivot-field-chip")&&D.closest('[data-drop-id="chooser-chooser"]'))continue;let H=D.getBoundingClientRect();if(H.width===0&&H.height===0||r<H.left||r>H.right||g<H.top||g>H.bottom)continue;let z=D.getAttribute("data-drop-id"),q=z.replace("chooser-","");if(q.endsWith("-ghost-end"))w={id:z,el:D};else if(rt.includes(q))S=S??{id:z,el:D};else {let pe=H.width*H.height;(!h||pe<h.size)&&(h={id:z,el:D,size:pe});}}return h??w??S}function b(r,g){let h=u(r,g);if(!h)return n(null,null,null),{overId:null};let w=h.id.replace("chooser-",""),S=e.getFields().find(D=>D.id===w),M=rt.includes(w)||w.endsWith("-ghost-end")?w.replace("-ghost-end",""):S?.area,V=!!(t.activeId&&M&&e.controller.canMoveFieldTo&&!e.controller.canMoveFieldTo(t.activeId,M));if(s?.classList.toggle("is-drop-denied",V),s&&(s.style.borderColor=V?"var(--pivot-danger)":"var(--pivot-primary)"),V)return n(null,null,null),{overId:null};if(rt.includes(w)||w.endsWith("-ghost-end"))return n(null,M,"append"),{overId:h.id};if(S){let D=S.area==="chooser"?"vertical":"horizontal",H=h.el.getBoundingClientRect(),z=e.controller.calculateDropIntent(r,g,{top:H.top,left:H.left,width:H.width,height:H.height},t.intent,false,D);return n(w,S.area??null,z),{overId:h.id}}return {overId:h.id}}let f=null,p=r=>{if(!(a&&r.pointerId!==a.pointerId)&&!(l&&r.pointerId!==l.pointerId)){if(a){let g=r.clientX-a.startX,h=r.clientY-a.startY,w=Math.hypot(g,h);if(a.isTouch){if(!a.held&&w>8){a.holdTimer&&clearTimeout(a.holdTimer),a=null;return}if(!a.held)return}else if(w<8)return;m();}l&&(r.preventDefault(),L(r.clientX,r.clientY),f=b(r.clientX,r.clientY).overId);}},C=r=>{if(!(a&&r.pointerId!==a.pointerId)&&!(l&&r.pointerId!==l.pointerId)){if(a){a.holdTimer&&clearTimeout(a.holdTimer),a=null,document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",C),document.removeEventListener("pointercancel",T),document.removeEventListener("keydown",y,true);return}l&&F(b(r.clientX,r.clientY).overId??f);}},d=r=>{(l||a?.held)&&r.cancelable&&r.preventDefault();},T=()=>F(null),y=r=>{r.key==="Escape"&&l&&(r.stopPropagation(),F(null));},E=r=>{if(e.disabled?.()||a||l||r.button!==0&&r.pointerType==="mouse")return;let g=r.target;if(g.closest("button, input, .kanuni-pivot-chip-btn"))return;let h=g.closest(".kanuni-pivot-field-chip[data-drop-id]");if(!h||h.getAttribute("data-drag-scope")==="grip"&&!g.closest("[data-drag-grip]"))return;let w=h.getAttribute("data-drop-id"),S=r.pointerType==="touch";a={el:h,dropId:w,pointerId:r.pointerId,startX:r.clientX,startY:r.clientY,isTouch:S,held:false,holdTimer:S?setTimeout(()=>{a&&(a.held=true,m());},Math.max(0,e.touchDragDelay?.()??200)):null},document.addEventListener("pointermove",p),document.addEventListener("pointerup",C),document.addEventListener("pointercancel",T),document.addEventListener("keydown",y,true);},o=new Set;function c(){for(let r of o)r.isConnected||(r.removeEventListener("pointerdown",E),o.delete(r));for(let r of e.roots())o.has(r)||(o.add(r),r.addEventListener("pointerdown",E));}return c(),document.addEventListener("touchmove",d,{passive:false}),{getState:()=>({...t}),refreshRoots:c,rootCount:()=>o.size,destroy(){l&&F(null),a?.holdTimer&&clearTimeout(a.holdTimer),a=null;for(let r of o)r.removeEventListener("pointerdown",E);o.clear(),document.removeEventListener("touchmove",d),document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",C),document.removeEventListener("pointercancel",T),document.removeEventListener("keydown",y,true);}}}function he(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Kt(e){let{portal:t}=e;function n(m,u,b,f=false){let p=he(`${f?"kanuni-pivot-dropdown-item-danger":"kanuni-pivot-dropdown-item"} pivot-flex pivot-items-center`,"button");return p.type="button",m&&p.appendChild(X(m,16)),p.appendChild(document.createTextNode(" "+u)),p.addEventListener("click",()=>{t.closePopup(),b();}),p}function a(m,u,b){let f=()=>window.visualViewport?.removeEventListener("resize",p),p=()=>{if(!m.isConnected){f();return}let C=m.offsetWidth,d=m.scrollHeight||m.offsetHeight;if(C===0&&d===0)return;let T=pivotgridCore.placePopup({x:u,y:b},{width:C,height:d});m.style.top=`${T.top}px`,m.style.left=`${T.left}px`,m.style.maxHeight=`${T.maxHeight}px`;};return p(),window.visualViewport?.addEventListener("resize",p),f}let l=null;function i(m,u,b){let f=null,p=null,C=()=>{f?.remove(),f=null,l===C&&(l=null);},d=()=>{if(f)return;l&&l(),l=C,f=he("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");let o=m.getBoundingClientRect(),c=pivotgridCore.placePopup({x:o.right+4,y:o.top},{width:160,height:0},{altX:o.left-4});if(Object.assign(f.style,{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,minWidth:"160px",zIndex:"10000"}),f.addEventListener("contextmenu",r=>r.preventDefault()),f.addEventListener("mouseenter",()=>{p&&clearTimeout(p);}),f.addEventListener("mouseleave",()=>{p=setTimeout(C,200);}),b(f),u.appendChild(f),f.offsetHeight){let r=pivotgridCore.placePopup({x:o.right+4,y:o.top},{width:f.offsetWidth,height:f.scrollHeight},{altX:o.left-4});Object.assign(f.style,{top:`${r.top}px`,left:`${r.left}px`,maxHeight:`${r.maxHeight}px`,overflowY:"auto"});}},T=0,y=false,E=()=>Date.now()-T<1e3;m.addEventListener("pointerdown",o=>{o.pointerType!=="mouse"&&(T=Date.now());}),m.addEventListener("mouseenter",()=>{p&&clearTimeout(p),!E()&&(f||(y=true),d());}),m.addEventListener("mouseleave",()=>{E()||(p=setTimeout(C,200));}),m.addEventListener("click",o=>{if(o.detail>0&&y&&f){y=false;return}y=false,f?C():d();});}function s(m,u,b){let f=he("kanuni-pivot-dropdown-item pivot-flex pivot-items-center pivot-justify-between","button");f.type="button";let p=he("pivot-flex pivot-items-center pivot-gap-2","span");return p.appendChild(X(m,16)),p.appendChild(document.createTextNode(" "+u)),f.appendChild(p),f.appendChild(X(b?"chevron-left":"chevron-right",14)),f}function x(m){m.addEventListener("keydown",u=>{let b=[...m.querySelectorAll("button:not([disabled])")];if(b.length===0)return;let f=b.indexOf(document.activeElement),p=-1;u.key==="ArrowDown"?p=f<0?0:(f+1)%b.length:u.key==="ArrowUp"?p=f<0?b.length-1:(f-1+b.length)%b.length:u.key==="Home"?p=0:u.key==="End"&&(p=b.length-1),!(p<0)&&(u.preventDefault(),b[p].focus());});}function L(m,u,b,f,p){let C=e.getFields().find(o=>o.id===b);if(!C)return;let{t:d,rtl:T}=e.getI18n(),y=e.getFields().filter(o=>o.area==="row").sort((o,c)=>(o.areaIndex||0)-(c.areaIndex||0)),E=f!==void 0&&y.length>0&&C.area==="data";t.openPopup(o=>{let c=he("kanuni-pivot-dropdown-menu pivot-animate-zoom-in pivot-flex-col");Object.assign(c.style,{position:"fixed",top:`${u}px`,left:`${m}px`,maxHeight:`${Math.max(0,pivotgridCore.popupViewport().height-16)}px`,overflowY:"auto",overflowX:"hidden",width:"220px",zIndex:"9999"}),c.addEventListener("contextmenu",h=>h.preventDefault());let r=he("kanuni-pivot-report-section-title");if(Object.assign(r.style,{position:"sticky",top:"0",zIndex:"10"}),r.textContent=C.caption??C.id,c.appendChild(r),E){let h=he("kanuni-pivot-report-section-title");h.style.marginTop="4px",h.textContent=d("sortByThisColumn"),c.appendChild(h);for(let w of y)c.appendChild(n("arrow-down-a-z",d("sortFieldByThisColumn").replace("{0}",w.caption||w.id),()=>e.controller.sortFieldBySummary(w.id,C.id,f)));c.appendChild(he("kanuni-pivot-divider")),c.appendChild(n("x",d("removeAllSorting"),()=>e.controller.clearAllSorting(),true));}else {c.appendChild(n("arrow-down-a-z",d("sortAsc"),()=>e.controller.sortField(C.id,"asc"))),c.appendChild(n("arrow-up-z-a",d("sortDesc"),()=>e.controller.sortField(C.id,"desc"))),C.sortOrder&&c.appendChild(n("x",d("clearSort"),()=>e.controller.sortField(C.id,void 0),true)),e.openFilter&&C.area!=="data"&&c.appendChild(n("filter",d("filterField"),()=>e.openFilter(C.id,m,u))),e.openCondition&&(C.area==="row"||C.area==="column")&&c.appendChild(n("filter",d("conditionFilter")+"\u2026",()=>e.openCondition(C.id))),c.appendChild(he("kanuni-pivot-divider"));let h=s("list",d("order"),T);c.appendChild(h),i(h,o,M=>{let V=[["start",d("moveToStart"),"chevrons-left"],["left",d("moveToLeft"),"chevron-left"],["right",d("moveToRight"),"chevron-right"],["end",d("moveToEnd"),"chevrons-right"]];for(let[D,H,z]of V)M.appendChild(n(z,H,()=>e.controller.moveField(C.id,D)));});let w=[["row",d("rowArea"),"rows-3"],["column",d("columnArea"),"columns-3"],["data",d("dataArea"),"bar-chart-3"],["filter",d("filterArea"),"filter"]].filter(([M])=>M!==C.area);if(w.length>0){let M=s("move",d("moveToArea"),T);c.appendChild(M),i(M,o,V=>{for(let[D,H,z]of w){let q=n(z,H,()=>e.controller.changeFieldArea(C.id,D));e.controller.canMoveFieldTo(C.id,D)||(q.disabled=true),V.appendChild(q);}});}e.openFieldChooser&&c.appendChild(n("list",d("showFieldList"),e.openFieldChooser)),c.appendChild(n("eye-off",d("hide"),()=>e.controller.removeField(C.id)));let S=e.customContextMenuItems?.(C);if(S&&S.length>0){c.appendChild(he("kanuni-pivot-divider"));for(let M of S){let V=n(null,M.label,M.action);M.icon&&V.insertBefore(M.icon(),V.firstChild),c.appendChild(V);}}c.appendChild(he("kanuni-pivot-divider")),C.isCalculated&&e.onEditCalculatedField&&c.appendChild(n("calculator",d("editCalculation"),()=>e.onEditCalculatedField(C))),c.appendChild(n("settings",d("fieldSettings"),()=>e.openSettings(C.id)));}o.appendChild(c);let g=a(c,m,u);return p?(x(o),c.querySelector("button")?.focus(),()=>{g(),e.gridRoot?.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${b}"]`)?.focus({preventScroll:true});}):g});}function k(m,u){let{t:b}=e.getI18n();t.openPopup(f=>{let p=he("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");Object.assign(p.style,{position:"fixed",zIndex:"301",width:"224px",fontSize:"14px",left:`${m}px`,top:`${u}px`}),p.addEventListener("contextmenu",y=>y.preventDefault());let C=he("kanuni-pivot-report-section-title");C.textContent=b("viewOptions"),p.appendChild(C);let d=e.getLayout(),T=(y,E,o)=>{let c=he("pivot-w-full pivot-flex pivot-items-center pivot-justify-between","button");c.type="button",Object.assign(c.style,{padding:"6px 12px",textAlign:"left"}),c.addEventListener("mouseenter",()=>{c.style.backgroundColor="var(--pivot-surface-hover)";}),c.addEventListener("mouseleave",()=>{c.style.backgroundColor="transparent";});let r=he("","span");r.textContent=y;let g=he("pivot-text-xs pivot-text-muted pivot-font-medium","span");return g.textContent=b(E?"show":"hide"),c.append(r,g),c.addEventListener("click",()=>{o(),t.closePopup();}),c};return p.appendChild(T(b("filterArea"),d.showFilterArea===false,()=>e.controller.setLayout({showFilterArea:d.showFilterArea===false}))),p.appendChild(T(b("footerArea"),d.showFooter===false,()=>e.controller.setLayout({showFooter:d.showFooter===false}))),f.appendChild(p),a(p,m,u)});}function F(m){let{t:u}=e.getI18n(),b=()=>{let f=e.getEngineTrees();if(!f)return [];let p=[],C=(d,T)=>{if(d)for(let y of d)T>=m.depth&&p.push(y.key),y.children&&C(y.children,T+1);};return C(m.type==="row"?f.rowTree:f.colTree,0),p};t.openPopup(f=>{let p=he("");Object.assign(p.style,{position:"fixed",inset:"0",zIndex:"9998"}),p.addEventListener("click",()=>t.closePopup()),p.addEventListener("contextmenu",T=>{T.preventDefault(),t.closePopup();});let C=he("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");Object.assign(C.style,{position:"fixed",left:`${m.x}px`,top:`${m.y}px`,zIndex:"9999",minWidth:"160px"}),C.addEventListener("contextmenu",T=>T.preventDefault());let d=(T,y)=>{let E=he("kanuni-pivot-dropdown-item pivot-state-hover","button");return E.type="button",Object.assign(E.style,{paddingLeft:"32px",paddingRight:"24px"}),E.textContent=T,E.addEventListener("click",o=>{o.stopPropagation(),t.closePopup(),y();}),E};return C.appendChild(d(m.isExpanded?u("collapse"):u("expand"),()=>{m.type==="row"?e.controller.toggleExpanded(m.path):e.controller.toggleColExpanded(m.path);})),C.appendChild(he("kanuni-pivot-dropdown-divider")),C.appendChild(d(u("expandAll"),()=>{let T=b();m.type==="row"?e.controller.expandPaths(T):e.controller.expandColPaths(T);})),C.appendChild(d(u("collapseAll"),()=>{let T=b();m.type==="row"?e.controller.collapsePaths(T):e.controller.collapseColPaths(T);})),f.append(p,C),a(C,m.x,m.y)});}return {openFieldMenu:L,openGlobalMenu:k,openNodeMenu:F,close:()=>t.closePopup()}}function Ee(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var Ae=(e,...t)=>{let n=Ee("kanuni-pivot-form-group"),a=Ee("kanuni-pivot-form-label","label");return a.textContent=e,n.append(a,...t),n},Fe=(e,t)=>{let n=Ee("kanuni-pivot-select","select");for(let[a,l]of e){let i=document.createElement("option");i.value=a,i.textContent=l,n.appendChild(i);}return n.value=t,n},_e=(e,t)=>{let n=Ee("kanuni-pivot-input","input");return n.type=e,n.value=t,n},_t=(...e)=>{let t=Ee("");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},oo=[["equals","opEquals"],["notEquals","opNotEquals"],["contains","opContains"],["notContains","opNotContains"],["startsWith","opStartsWith"],["endsWith","opEndsWith"]],ro=[[">","opGreater"],[">=","opGreaterOrEqual"],["<","opLess"],["<=","opLessOrEqual"],["=","opEquals"],["!=","opNotEquals"],["between","opBetween"],["notBetween","opNotBetween"]];function Xt(e){function t(l,i,s,x){let{t:L}=e.getI18n();e.portal.openPopup(k=>{let F=Ee("kanuni-pivot-modal-overlay pivot-animate-fade-in");F.addEventListener("click",()=>e.portal.closePopup());let m=Ee("kanuni-pivot-modal pivot-animate-zoom-in");m.style.width="400px",m.setAttribute("role","dialog"),m.setAttribute("aria-modal","true"),m.setAttribute("aria-label",l);let u=Ee("kanuni-pivot-modal-header"),b=Ee("kanuni-pivot-modal-title","h2");b.textContent=l;let f=Ee("kanuni-pivot-modal-close","button");f.type="button",f.setAttribute("aria-label",L("cancel")),f.appendChild(X("x",20)),f.addEventListener("click",()=>e.portal.closePopup()),u.append(b,f);let p=Ee("kanuni-pivot-modal-footer"),C=Ee("kanuni-pivot-btn kanuni-pivot-btn--outline","button");C.type="button",C.textContent=L("cancel"),C.addEventListener("click",()=>e.portal.closePopup());let d=Ee("kanuni-pivot-btn kanuni-pivot-btn--primary","button");d.type="button",d.appendChild(X("check",16)),d.appendChild(document.createTextNode(" "+L("ok"))),d.addEventListener("click",()=>{s()!==false&&e.portal.closePopup();}),p.append(C,d),m.append(u,i,p),k.append(F,m),x.focus();});}function n(l){let i=e.getFields().find(C=>C.id===l);if(!i)return;let{t:s}=e.getI18n(),x=Ee("kanuni-pivot-modal-body pivot-custom-scrollbar"),L=_e("text",i.caption??"");x.appendChild(Ae(s("caption"),L));let k=i.area==="data"||i.area==="chooser",F=i.area==="row"||i.area==="column"||i.area==="filter"||i.area==="chooser",m=null,u=null,b=null,f=(...C)=>C.map(d=>[d,s(d)]),p=(...C)=>{let d=i.summaryType;return f(...d&&!C.includes(d)?[d,...C]:C)};k&&i.dataType&&i.dataType!=="number"&&(m=Fe(p("count","distinct"),String(i.summaryType||"count")),x.appendChild(Ae(s("summaryType"),m))),k&&i.dataType==="number"&&(m=Fe(p("sum","count","avg","min","max","distinct"),String(i.summaryType||"sum")),x.appendChild(Ae(s("summaryType"),m)),u=Fe([["absolute",s("absoluteValue")],...f("percentOfTotal","percentOfColumnTotal","percentOfRowTotal","percentOfParentRowTotal","percentOfParentColumnTotal","runningTotal","difference","percentDifference")],String(i.summaryDisplayMode||"absolute")),x.appendChild(Ae(s("displayMode"),u))),F&&i.dataType==="date"&&(b=Fe([["",s("none")],...f("year","quarter","month","week","day")],String(i.groupInterval||"")),x.appendChild(Ae(s("groupInterval"),b))),t(s("fieldSettings"),x,()=>{e.save({...i,caption:L.value,summaryType:m?.value||i.summaryType,summaryDisplayMode:u?.value??i.summaryDisplayMode,groupInterval:b?b.value||void 0:i.groupInterval});},L);}function a(l){let i=e.getFields(),s=i.find(o=>o.id===l);if(!s)return;let{t:x}=e.getI18n(),L=Ee("kanuni-pivot-modal-body pivot-custom-scrollbar"),k=o=>[["",x("none")],...o.map(([c,r])=>[c,x(r)])],F=s.labelFilter,m=Fe(k(oo),F?.operator??"");m.setAttribute("data-condition-label-op",""),m.setAttribute("aria-label",x("caption"));let u=_e("text",F?.value??"");u.setAttribute("data-condition-label-value",""),u.placeholder=x("builderValuePlaceholder"),u.setAttribute("aria-label",x("builderValuePlaceholder")),L.appendChild(Ae(x("caption"),_t(m,u)));let b=i.filter(o=>o.area==="data").sort((o,c)=>(o.areaIndex||0)-(c.areaIndex||0)),f=s.valueFilter,p=Fe(b.map(o=>[o.id,o.caption||o.id]),b.some(o=>o.id===f?.dataField)?f.dataField:b[0]?.id??"");p.setAttribute("data-condition-value-field",""),p.setAttribute("aria-label",x("dataArea"));let C=Fe(k(ro),f?.operator??"");C.setAttribute("data-condition-value-op",""),C.setAttribute("aria-label",x("dataArea"));let d=_e("number",f?String(f.value):"");d.setAttribute("data-condition-value","");let T=_e("number",f?.value2!==void 0?String(f.value2):"");T.setAttribute("data-condition-value2","");for(let o of [d,T])o.setAttribute("aria-label",x("builderValuePlaceholder"));b.length>0&&L.appendChild(Ae(x("dataArea"),p,_t(C,d,T)));let y=()=>{u.disabled=m.value==="",d.disabled=C.value==="",T.style.display=C.value==="between"||C.value==="notBetween"?"":"none";};m.addEventListener("change",y),C.addEventListener("change",y),y();let E=o=>(o.setAttribute("aria-invalid","true"),o.focus(),false);t(`${x("conditionFilter")}: ${s.caption||s.id}`,L,()=>{for(let r of [u,d,T])r.removeAttribute("aria-invalid");let o;if(m.value){if(u.value==="")return E(u);o={operator:m.value,value:u.value,...F?.caseSensitive?{caseSensitive:true}:{}};}let c=b.length>0?void 0:f;if(C.value&&b.length>0){let r=T.style.display!=="none",g=d.value===""?NaN:Number(d.value),h=T.value===""?NaN:Number(T.value);if(!Number.isFinite(g))return E(d);if(r&&!Number.isFinite(h))return E(T);c={dataField:p.value,operator:C.value,value:g,...r?{value2:h}:{}};}e.save({...s,labelFilter:o,valueFilter:c});},m);}return {open:n,openCondition:a}}function ne(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function ao(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 Ut(e){let t=null,n=null,a=null,l="",i={x:0,y:0},s={width:700,height:550},x=()=>window.innerWidth<=768,L=["fullscreenchange","webkitfullscreenchange"],k=()=>{if(!t)return;let o=$e();t.parentElement!==o&&o.appendChild(t);},F=()=>{n&&(m(),x()||(i={x:Math.min(i.x,Math.max(0,window.innerWidth-s.width)),y:Math.min(i.y,Math.max(0,window.innerHeight-s.height))},m()));};function m(){n&&(x()?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:`${i.x}px`,top:`${i.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 u(o,c){let{t:r}=e.getI18n(),g=ne("kanuni-pivot-field-chip");g.setAttribute("data-drop-id",`chooser-${o.id}`),g.setAttribute("data-drag-scope","grip"),g.style.position="relative";let h=ne("");if(h.setAttribute("data-drag-grip",""),Object.assign(h.style,{color:"var(--pivot-text-muted)",cursor:"grab",flexShrink:"0",opacity:"0.5"}),h.appendChild(X("grip-vertical",14)),g.appendChild(h),c){let H=ne("kanuni-pivot-checkbox","input");H.type="checkbox",H.checked=o.area!=="chooser",H.style.flexShrink="0",H.addEventListener("change",()=>{H.checked?e.controller.showFields([o.id]):e.controller.removeField(o.id);}),g.appendChild(H);}g.appendChild(ao(o));let w=ne("pivot-truncate","span");Object.assign(w.style,{flex:"1",color:"var(--pivot-text)",textAlign:"left"}),w.textContent=o.caption??o.id;let S=o.area==="data"&&o.summaryType?pivotgridCore.summaryTypeLabel(String(o.summaryType),r):"";if(S){let H=ne("","span");Object.assign(H.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"}),H.textContent=S,w.appendChild(H);}g.appendChild(w);let M=!!o.filterValues&&o.filterValues.size>0,V=ne(`kanuni-pivot-field-chip-actions${M?" is-filtered":""}`);if(o.area!=="data"){let H=ne("kanuni-pivot-chip-btn","button");H.type="button",H.title=r("filterField"),M&&Object.assign(H.style,{color:"var(--pivot-danger)",backgroundColor:"color-mix(in srgb, var(--pivot-danger) 10%, transparent)"}),H.appendChild(X("filter",12)),H.addEventListener("click",z=>{z.stopPropagation(),e.onFilterClick(z.clientX,z.clientY,o.id);}),V.appendChild(H);}if(o.isCalculated){let H=ne("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","button");H.type="button",H.title=r("deletePermanently"),H.appendChild(X("trash",12)),H.addEventListener("click",z=>{z.stopPropagation(),e.controller.deleteField(o.id);}),V.appendChild(H);}let D=ne("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","button");return D.type="button",D.title=r("removeFromArea"),D.appendChild(X("x",12)),D.addEventListener("click",H=>{H.stopPropagation(),e.controller.removeField(o.id);}),V.appendChild(D),g.appendChild(V),g}function b(o,c,r,g,h){let w=ne("");if(Object.assign(w.style,{height:"100%",display:"flex",flexDirection:"column",transition:"background-color 0.2s"}),r!==null){let V=ne("");Object.assign(V.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)"}),V.textContent=r,w.appendChild(V);}let S=ne("pivot-custom-scrollbar");if(S.setAttribute("data-drop-id",`chooser-${o}`),S.setAttribute("data-drop-kind","list"),Object.assign(S.style,{maxHeight:x()?"none":"100%",flex:"1",padding:"8px",minHeight:"80px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"6px",alignItems:c.length===0?"center":"stretch",justifyContent:c.length===0?"center":"flex-start"}),c.length===0){let V=ne("");Object.assign(V.style,{fontSize:"12px",color:"color-mix(in srgb, var(--pivot-text-muted) 70%, transparent)",fontStyle:"italic",textAlign:"center",width:"100%"}),V.textContent=g,S.appendChild(V);}for(let V of c)S.appendChild(u(V,h));let M=ne("");return M.setAttribute("data-drop-id",`chooser-${o}-ghost-end`),M.setAttribute("data-ghost-populated",c.length>0?"1":"0"),Object.assign(M.style,{width:"100%",minHeight:"24px",transition:"background-color 0.2s",borderRadius:"var(--pivot-border-radius-sm)"}),S.appendChild(M),w.appendChild(S),w}function f(){let o=new Map;return e.getFields().map(c=>{let r=c.caption||c.id||"";if(o.has(r)){let g=o.get(r)+1;return o.set(r,g),{...c,caption:`${r} (${g})`}}return o.set(r,1),c})}function p(){let{locale:o}=e.getI18n(),c=[...f()].sort((g,h)=>(g.caption||"").toLowerCase().localeCompare((h.caption||"").toLowerCase(),o||"en"));if(!l)return c;let r=l.toLowerCase();return c.filter(g=>(g.caption||"").toLowerCase().includes(r))}function C(){let o=p().filter(c=>c.area==="chooser").map(c=>c.id);o.length!==0&&e.controller.showFields(o);}function d(){if(!a)return;let{t:o,locale:c}=e.getI18n(),r=new Map;for(let _ of a.querySelectorAll('[data-drop-kind="list"]')){let P=_.getAttribute("data-drop-id");P&&_.scrollTop>0&&r.set(P,_.scrollTop);}let g=f(),h=p(),w=_=>g.filter(P=>P.area===_).sort((P,R)=>(P.areaIndex||0)-(R.areaIndex||0));a.textContent="";let S=x(),M=ne(S?"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");S&&(M.style.flexShrink="0");let V=ne("p-3 border-b border-border/60 bg-surface/80"),D=ne("relative"),H=X("search",16);H.setAttribute("class","text-muted-fg opacity-60"),Object.assign(H.style,{position:"absolute",top:"50%",transform:"translateY(-50%)",pointerEvents:"none"}),H.style.setProperty("inset-inline-start","10px");let z=ne("w-full bg-surface-hover/50 border-border rounded-md text-[13px] kanuni-pivot-input","input");z.type="text",z.placeholder=o("search"),z.value=l,z.style.setProperty("padding-inline-start","34px"),z.addEventListener("input",()=>{l=z.value,d();let _=a?.querySelector('input[type="text"]');_?.focus(),_?.setSelectionRange(_.value.length,_.value.length);}),D.append(H,z),V.appendChild(D),M.appendChild(V);let q=ne(S?"p-2":"flex-1 overflow-hidden p-2"),pe=ne("");Object.assign(pe.style,{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"});let ae=ne("text-[11px] font-bold uppercase tracking-wider text-muted-fg/80 mb-2 px-1");ae.textContent=o("allFields");let re=ne("kanuni-pivot-popup-action-btn kanuni-pivot-chooser-select-all","button");re.type="button",re.textContent=o("selectAll"),re.style.color="var(--pivot-primary)",re.disabled=h.every(_=>_.area!=="chooser"),re.addEventListener("click",C),pe.append(ae,re),q.appendChild(pe),q.appendChild(b("chooser",h,null,o("noItems"),true)),M.appendChild(q);let we=ne(S?"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");S&&(we.style.flexShrink="0");let xe=ne(S?"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"),be=[["filter",o("filterArea")],["column",o("columnArea")],["row",o("rowArea")],["data",o("dataArea")]];for(let[_,P]of be){let R=ne("border border-border/80 rounded-md shadow-sm bg-surface overflow-hidden flex flex-col transition-colors");S&&(R.style.minHeight="140px"),R.appendChild(b(_,w(_),P,o("dropHere"),false)),xe.appendChild(R);}we.appendChild(xe),a.append(M,we);for(let[_,P]of r){let R=a.querySelector(`[data-drop-id="${_}"][data-drop-kind="list"]`);R&&(R.scrollTop=P);}}function T(){if(t)return;let{t:o}=e.getI18n();t=De(e.gridRoot);let c=ne("fixed inset-0 z-[100] kanuni-pivot-chooser-backdrop overflow-auto pointer-events-auto");c.addEventListener("click",y),n=ne("flex flex-col bg-surface shadow-2xl border border-border overflow-hidden rounded-lg kanuni-pivot-field-chooser"),n.addEventListener("click",M=>M.stopPropagation()),x()||(s={width:Math.min(700,window.innerWidth-32),height:Math.min(550,window.innerHeight-32)},i={x:Math.max(0,(window.innerWidth-s.width)/2),y:Math.max(0,(window.innerHeight-s.height)/2)}),m();let r=ne("pivot-field-chooser__header flex items-center justify-between p-3 border-b border-border bg-surface-header/90");x()||(r.style.cursor="move");let g=ne("text-[15px] font-semibold m-0 flex items-center gap-2 select-none","h3");g.appendChild(X("grip-horizontal",18,"var(--pivot-text-muted)")),g.appendChild(document.createTextNode(o("allFields")));let h=ne("btn-icon rounded-full p-1.5 kanuni-pivot-chip-btn","button");h.type="button",h.setAttribute("aria-label",o("cancel")),h.appendChild(X("x",18)),h.addEventListener("pointerdown",M=>M.stopPropagation()),h.addEventListener("click",y),r.append(g,h);let w=null;r.addEventListener("pointerdown",M=>{x()||M.target.closest(".kanuni-pivot-field-chip, button, input")||(w={px:M.clientX,py:M.clientY,x:i.x,y:i.y},r.setPointerCapture?.(M.pointerId));}),r.addEventListener("pointermove",M=>{w&&(i={x:Math.max(0,w.x+M.clientX-w.px),y:Math.max(0,w.y+M.clientY-w.py)},m());});let S=M=>{w=null,r.releasePointerCapture?.(M.pointerId);};if(r.addEventListener("pointerup",S),r.addEventListener("pointercancel",S),a=ne(x()?"flex flex-1 flex-col bg-surface-sunken/30":"flex flex-1 overflow-hidden flex-col md:flex-row bg-surface-sunken/30"),x()&&(a.setAttribute("data-chooser-scroll",""),Object.assign(a.style,{minHeight:"0",overflowY:"auto",touchAction:"pan-y",overscrollBehavior:"contain"})),d(),n.append(r,a),!x()){let M=[["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[V,D,H]of M){let z=ne("kanuni-pivot-chooser-resize");z.setAttribute("data-resize-dir",V),Object.assign(z.style,{position:"absolute",zIndex:V.length===2?"51":"50",cursor:D},H);let q=null;z.addEventListener("pointerdown",ae=>{ae.stopPropagation(),q={px:ae.clientX,py:ae.clientY,w:s.width,h:s.height,x:i.x,y:i.y},z.setPointerCapture?.(ae.pointerId);}),z.addEventListener("pointermove",ae=>{if(!q)return;let re=ae.clientX-q.px,we=ae.clientY-q.py,xe=q.w,be=q.h,_=q.x,P=q.y;V.includes("e")&&(xe=q.w+re),V.includes("s")&&(be=q.h+we),V.includes("w")&&(xe=q.w-re,xe>=400&&(_=q.x+re)),V.includes("n")&&(be=q.h-we,be>=400&&(P=q.y+we)),s={width:Math.max(400,xe),height:Math.max(400,be)},i={x:Math.max(0,_),y:Math.max(0,P)},m();});let pe=ae=>{q=null,z.releasePointerCapture?.(ae.pointerId);};z.addEventListener("pointerup",pe),z.addEventListener("pointercancel",pe),n.appendChild(z);}}c.appendChild(n),t.appendChild(c),$e().appendChild(t),Oe(t),window.addEventListener("resize",F);for(let M of L)document.addEventListener(M,k);e.onOpenChanged?.(true);}function y(){if(t){window.removeEventListener("resize",F);for(let o of L)document.removeEventListener(o,k);t.remove(),t=null,n=null,a=null,l="",e.onOpenChanged?.(false);}}function E(){if(!t)return;let o={...i},c={...s};y(),T(),i=o,s=c,m();}return {open:T,close:y,toggle:()=>t?y():T(),isOpen:()=>t!==null,repaint:d,relocalize:E,getHost:()=>t,destroy:y}}function oe(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Yt(e){let t=false,n=null,a=s=>{t&&n&&!n.contains(s.target)&&(t=false,e.requestRepaint());};document.addEventListener("mousedown",a);function l(s,x){let{t:L}=e.getI18n();e.portal.openPopup(k=>{let F=oe("kanuni-pivot-modal-overlay");F.addEventListener("click",()=>e.portal.closePopup());let m=oe("kanuni-pivot-modal pivot-animate-zoom-in");Object.assign(m.style,{display:"flex",flexDirection:"column",gap:"16px",padding:"24px"});let u=oe("pivot-flex pivot-flex-col");u.style.gap="6px";let b=oe("pivot-flex pivot-items-center pivot-justify-between"),f=oe("kanuni-pivot-modal-title","h3");f.textContent=s;let p=oe("kanuni-pivot-modal-close","button");p.type="button",p.setAttribute("aria-label",L("close")),p.style.padding="6px",p.appendChild(X("x",16)),p.addEventListener("click",()=>e.portal.closePopup()),b.append(f,p);let C=oe("kanuni-pivot-modal-description","p");C.textContent=L("saveReportDescription"),u.append(b,C);let d=oe("pivot-flex pivot-flex-col pivot-gap-4","form"),T=oe("pivot-flex pivot-flex-col pivot-gap-2"),y=oe("kanuni-pivot-form-label","label");y.textContent=L("reportName");let E=oe("kanuni-pivot-input","input");E.type="text",E.placeholder=L("reportNamePlaceholder"),E.required=true,E.value=x,T.append(y,E);let o=oe("pivot-flex pivot-items-center pivot-gap-2"),c=oe("kanuni-pivot-input","input");c.type="checkbox",Object.assign(c.style,{width:"16px",height:"16px"});let r=oe("kanuni-pivot-form-label","label");Object.assign(r.style,{margin:"0",cursor:"pointer"}),r.textContent=L("setAsDefault"),r.addEventListener("click",()=>{c.checked=!c.checked;}),o.append(c,r);let g=oe("kanuni-pivot-modal-footer");Object.assign(g.style,{marginTop:"8px",paddingTop:"16px",borderTop:"1px solid var(--pivot-border)",display:"flex",justifyContent:"flex-end",gap:"8px"});let h=oe("kanuni-pivot-btn kanuni-pivot-btn--outline","button");h.type="button",h.textContent=L("cancel"),h.addEventListener("click",()=>e.portal.closePopup());let w=oe("kanuni-pivot-btn kanuni-pivot-btn--primary","button");w.type="submit",w.disabled=!x.trim(),w.appendChild(X("save",16)),w.appendChild(document.createTextNode(" "+L("save"))),E.addEventListener("input",()=>{w.disabled=!E.value.trim();}),g.append(h,w),d.addEventListener("submit",S=>{S.preventDefault();let M=E.value.trim();M&&(e.controller.saveReport(M,c.checked),e.portal.closePopup());}),d.append(T,o,g),m.append(u,d),k.append(F,m),E.focus();});}function i(s){let{t:x}=e.getI18n();n=s;let L=e.getReports(),k=e.getActiveReportId(),F=L.find(C=>C.id===k),m=oe(`kanuni-pivot-report-btn ${t?"kanuni-pivot-report-btn--open":k?"kanuni-pivot-report-btn--active":"kanuni-pivot-report-btn--default"}`,"button");m.type="button",m.title=x("viewsAndReports"),m.appendChild(X("bookmark",15));let u=oe("pivot-truncate","span");if(u.style.maxWidth="120px",u.textContent=F?F.name:x("views"),m.appendChild(u),m.addEventListener("click",()=>{t=!t,e.requestRepaint();}),s.appendChild(m),!t)return;let b=oe("kanuni-pivot-report-dropdown pivot-animate-slide-up"),f=(C,d=false)=>{let T=oe("kanuni-pivot-report-section-title");return d&&(T.style.marginTop="8px",T.style.borderTop="1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"),T.textContent=C,T},p=(C,d,T,y)=>{let E=oe("kanuni-pivot-report-item","button");E.type="button",E.appendChild(X(C,16,d));let o=oe(""),c=oe("pivot-font-medium");return c.textContent=T,o.appendChild(c),E.appendChild(o),E.addEventListener("click",()=>{t=false,e.requestRepaint(),y();}),E};if(b.appendChild(f(x("actions"))),b.appendChild(p("save","var(--pivot-success)",x("saveNewView"),()=>l(x("saveNewView"),""))),k&&(b.appendChild(p("save-all","var(--pivot-warning)",x("saveChangesOverwrite"),()=>e.controller.updateCurrentReport())),b.appendChild(p("copy","var(--pivot-info)",x("saveAsCopy"),()=>l(x("saveAsView"),`${F?.name??""} (Copy)`)))),L.length>0){b.appendChild(f(x("savedViews"),true));let C=oe("kanuni-pivot-report-list pivot-custom-scrollbar");for(let d of L){let T=oe(`kanuni-pivot-report-list-item${d.id===k?" kanuni-pivot-report-list-item--active":""}`),y=oe("kanuni-pivot-report-list-btn","button");y.type="button",y.appendChild(X(d.id===k?"check":"folder-open",14,d.id===k?"var(--pivot-primary)":"var(--pivot-text-muted)"));let E=oe("pivot-text-sm pivot-truncate","span");E.style.color=d.id===k?"var(--pivot-primary)":"var(--pivot-text)",d.id===k&&E.classList.add("pivot-font-medium"),E.textContent=d.name,y.appendChild(E),d.isDefault&&y.appendChild(Ve("star",12,"var(--pivot-warning)")),y.addEventListener("click",()=>{t=false,e.requestRepaint(),e.controller.loadReport(d.id);}),T.appendChild(y);let o=oe("kanuni-pivot-report-actions");if(!d.isDefault){let r=oe("kanuni-pivot-action-btn kanuni-pivot-action-btn--warning","button");r.type="button",r.title=x("makeDefault"),r.setAttribute("aria-label",r.title),r.appendChild(X("star",14)),r.addEventListener("click",g=>{g.stopPropagation(),e.controller.setDefaultReport(d.id);}),o.appendChild(r);}let c=oe("kanuni-pivot-action-btn kanuni-pivot-action-btn--danger","button");c.type="button",c.title=x("deleteReport"),c.setAttribute("aria-label",c.title),c.appendChild(X("trash",14)),c.addEventListener("click",r=>{r.stopPropagation(),window.confirm(x("deleteReportConfirm").replace("{0}",d.name))&&(e.controller.deleteReport(d.id),d.id===k&&(t=false,e.requestRepaint()));}),o.appendChild(c),T.appendChild(o),C.appendChild(T);}b.appendChild(C);}s.appendChild(b);}return {mount:i,destroy(){document.removeEventListener("mousedown",a);}}}var so={chartData:[],chartSeries:[]};function at(e,t,n,a){let l=null,i,s,x,L=false;function k(){if(L)return;let u=e.getState();if(!u.engineResult||!u.engineResult.cellMatrix||!n.transformer){a(so);return}a(n.transformer(u.engineResult,pivotgridCore.shownFields(u.fields),u.expandedPaths,t(),n));}function F(){let u=e.getState(),b=t();u.engineResult===i&&u.expandedPaths===s&&b===x||(i=u.engineResult,s=u.expandedPaths,x=b,l&&clearTimeout(l),l=setTimeout(k,150));}let m=e.subscribe(F);return F(),{refresh:F,stop(){L=true,l&&clearTimeout(l),m();}}}function He(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var lt=new Set;function xo(){let e="default-pivot-grid";for(let t=2;lt.has(e);t++)e=`default-pivot-grid-${t}`;return lt.add(e),e}function Co(e,t){if(!e||!(e instanceof HTMLElement))throw new Error("[pivotgrid] createPivotGrid needs a container HTMLElement");ct(t);let n=Be(t.locale,t.dictionary,t.rtl),a=t.gridId||t.stateStoring?.storageKey,l=a||xo();!a&&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 i=He("kanuni-pivot-root"+(t.className?" "+t.className:""));i.style.width="100%",i.style.height="100%",pt(i,pivotgridCore.pivotSchemeTheme(t.theme,t.palette,t.dark)),i.setAttribute("dir",n.rtl?"rtl":"ltr");let s=He("kanuni-pivot-wrapper pivot-flex pivot-flex-col");s.style.width="100%",s.style.height="100%";let x=He("pivot-grid pivot-flex-1 pivot-flex pivot-flex-col pivot-relative");x.style.minHeight="0",x.style.overflow="hidden",x.style.backgroundColor="var(--pivot-bg)",x.style.border="1px solid var(--pivot-border)",x.style.borderRadius="var(--pivot-radius-md)",x.style.userSelect="none",t.striped&&i.classList.add("kanuni-pivot-striped");let L=t.density,k=()=>pivotgridCore.pivotDensityClass(L),F=()=>pivotgridCore.pivotRowHeight(L);k()&&i.classList.add(k());let m=He("pivot-flex-1 pivot-flex pivot-flex-col pivot-relative");m.style.minHeight="0";let u=He("pivot-text-muted pivot-text-sm");u.style.padding="8px",u.style.position="absolute",u.style.inset="0",u.style.display="none",u.style.zIndex="70",u.style.backgroundColor="var(--pivot-bg)",u.setAttribute("data-pivot-status",""),x.appendChild(m),x.appendChild(u),s.appendChild(x),i.appendChild(s);let b=He("kanuni-pivot-live");b.setAttribute("role","status"),b.setAttribute("aria-live","polite"),b.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap",i.appendChild(b),e.appendChild(i);let f={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,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},p=new pivotgridCore.PivotController(f),C=pivotgridCore.bindPivotScrollMemory(i,p),d=pivotgridCore.watchShortPivot(s),T=()=>pivotgridCore.shownFields(p.getState().fields),y=ot(i),E=Nt({portal:y,getI18n:()=>n,gridId:l,getField:v=>T().find(I=>I.id===v),getData:()=>p.getRawData(),apply:(v,I,O)=>p.applyFilter(v,I,O),clear:v=>p.clearFilter(v),openCondition:v=>o.openCondition(v)}),o=Xt({portal:y,getI18n:()=>n,getFields:T,save:v=>p.updateField(v)}),c=Kt({portal:y,gridRoot:i,getI18n:()=>n,getFields:T,getLayout:()=>p.getState().layout,controller:p,getEngineTrees:()=>{let v=p.getState().engineResult;return v?{rowTree:v.rowTree,colTree:v.colTree}:null},openSettings:v=>o.open(v),openCondition:v=>o.openCondition(v),openFilter:(v,I,O)=>{w()||E.open(I,O,v);},openFieldChooser:()=>r.open(),onEditCalculatedField:t.onEditCalculatedField?v=>{w()||t.onEditCalculatedField(v);}:void 0,customContextMenuItems:t.customContextMenuItems}),r=Ut({gridRoot:i,getI18n:()=>n,getFields:T,controller:p,onFilterClick:(v,I,O)=>E.open(v,I,O),onOpenChanged:()=>{P||(pe.refreshRoots(),_.paint(p.getState()));}}),g=(v,I)=>{t.onGlobalContextMenu?t.onGlobalContextMenu(v,I):c.openGlobalMenu(v,I);},h=Rt(),w=()=>t.disabled===true,S,M,V={getI18n:()=>n,onRemove:v=>{w()||p.removeField(v);},onFilterClick:(v,I,O)=>{w()||E.open(v,I,O);},onSort:(v,I)=>{w()||p.sortField(v,I);},onContextMenu:(v,I,O,K,G)=>{w()||c.openFieldMenu(v,I,O,K,G);},getFields:T,onMove:(v,I)=>{w()||p.moveField(v,I);},requestFocus:v=>{S=v;let O=document.activeElement?.closest?.("[data-drop-id]")?.getAttribute("data-drop-id");M=O?T().find(K=>K.id===O)?.area:void 0;}},D=Pt({host:m,getI18n:()=>n,onCellPrepared:t.onCellPrepared,registry:t.registry,shared:h,chipDeps:V,hasCellClick:()=>!!t.onCellClick&&!w(),columnWidthDefaults:pivotgridCore.resolveColumnWidthDefaults(t.defaultColumnWidths),rowHeight:F}),H=wt({...V,host:x,onGlobalContextMenu:g,onToggleCollapsed:()=>{w()||p.setLayout({filterAreaCollapsed:p.getState().layout.filterAreaCollapsed!==true});}});x.insertBefore(H.element,m);let z=He("kanuni-pivot-notice");z.setAttribute("role","status"),z.style.display="none",x.insertBefore(z,m);let q=()=>{let v=r.getHost();return v?[i,v]:[i]},pe=qt({gridRoot:i,roots:q,controller:p,getFields:T,onIntentChange:v=>Tt(q(),v),disabled:w,touchDragDelay:()=>t.touchDragDelay}),ae=At({scroller:D.scroller,controller:{toggleExpanded:v=>{w()||p.toggleExpanded(v);},toggleColExpanded:v=>{w()||p.toggleColExpanded(v);},sortField:(v,I)=>{w()||p.sortField(v,I);}},getVM:D.getVM,getTheadHeight:D.getTheadHeight,rowHeight:F,shared:h,onCellClick:t.disabled===true?void 0:t.onCellClick,resolveCellClick:v=>p.resolveCellClick(v),onGlobalContextMenu:(v,I)=>{w()||g(v,I);},onFilterClick:(v,I,O)=>{w()||E.open(v,I,O);},onHeaderContextMenu:(v,I,O,K)=>{w()||c.openFieldMenu(v,I,O,K);},onNodeContextMenu:v=>{w()||c.openNodeMenu(v);},keyboardEnabled:t.keyboardNavigation?.enabled!==false}),re=bt({scroller:D.scroller,shared:h,getVM:D.getVM,onStats:v=>p.setSelectionStats(v)}),we=Ht({host:m,scroller:D.scroller,shared:h,isRtl:()=>n.rtl,getWidths:()=>p.getState().columnWidths??{},rowHeaderLayout:()=>D.rowHeaderLayout(),dataColOffset:()=>D.getVM()?.dataColOffset??0,commit:v=>{w()||p.setColumnWidths(v);}}),xe=jt(i,()=>{_.paint(p.getState()),D.refreshWindow();}),be=Yt({portal:y,getI18n:()=>n,controller:p,getReports:()=>p.getState().reports??[],getActiveReportId:()=>p.getState().activeReportId??null,requestRepaint:()=>_.paint(p.getState())}),_=Wt({host:s,getI18n:()=>n,toolbar:t.toolbar,advancedExport:t.advancedExport===true,upgradeUrl:t.upgradeUrl,registry:t.registry,onToggleFieldChooser:()=>r.toggle(),fieldChooserOpen:()=>r.isOpen(),onRefresh:t.onRefresh,onExport:v=>{p.exportData(v,{applyFilters:true}).catch(I=>{let O=I instanceof Error?I:new Error(String(I));O.name!=="AbortError"&&(t.onError?t.onError(O):console.error(O));});},onExpandAll:()=>p.expandAll({allLevels:true}),onCollapseAll:()=>p.collapseAll(),onAddCalculatedField:t.onAddCalculatedField?()=>{w()||t.onAddCalculatedField();}:void 0,onOpenPrefilter:t.onOpenPrefilter?()=>{w()||t.onOpenPrefilter();}:void 0,onToggleChart:t.onToggleChart?()=>{w()||t.onToggleChart();}:void 0,onToggleFullscreen:()=>xe.toggle(),isFullscreen:()=>xe.isFullscreen(),onGlobalContextMenu:g,mountReportMenu:v=>be.mount(v),onSearch:t.search?v=>p.setSearchText(v):void 0}),P=false,R=false,B=null,W=0;function Y(){P||R||(R=true,queueMicrotask(Q));}let se="";function fe(v){let I=pivotgridCore.pivotChipView(v);if(se!==I.className){for(let K of se.split(" "))K&&i.classList.remove(K);for(let K of I.className.split(" "))K&&i.classList.add(K);se=I.className;}let O=I.style["--pivot-chip-max-width"];O?i.style.setProperty("--pivot-chip-max-width",O):i.style.removeProperty("--pivot-chip-max-width"),Vt(i);}function Q(){if(R=false,P)return;let v=p.getState(),I=!B||B.engineResult!==v.engineResult||B.fields!==v.fields||B.layout!==v.layout||B.expandedPaths!==v.expandedPaths||B.expandedColPaths!==v.expandedColPaths||B.columnWidths!==v.columnWidths;(!B||B.layout!==v.layout)&&fe(v.layout);let O=!B||B.isBuilding!==v.isBuilding||B.buildProgress!==v.buildProgress||B.engineError!==v.engineError||B.engineResult!==v.engineResult||B.noData!==v.noData,K=!B||B.selectionStats!==v.selectionStats||B.reports!==v.reports||B.activeReportId!==v.activeReportId||B.layout!==v.layout;if(I&&(H.paint(pivotgridCore.shownFields(v.fields).filter(G=>G.area==="filter"),v.layout.showFilterArea!==false,{maxRows:v.layout.filterAreaMaxRows,collapsed:v.layout.filterAreaCollapsed===true,collapsedRows:v.layout.filterAreaCollapsedRows}),r.isOpen()&&r.repaint()),I&&v.engineResult&&D.paintStructural(v),S!==void 0&&(((S?i.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${S}"]`):M?i.querySelector(`[data-drop-id="${M}"]`):null)??D.scroller).focus({preventScroll:true}),S=void 0,M=void 0),O&&A(v),!B||B.engineResult!==v.engineResult){let G=v.engineResult?.columnsTruncated;z.style.display=G?"":"none";let j=new Intl.NumberFormat(n.locale);z.textContent=G?n.t("columnsTruncated").replace("{shown}",j.format(G.shown)).replace("{total}",j.format(G.total)):"";}if(B&&B.searchText!==v.searchText&&_.syncSearch(v.searchText??""),B&&B.fields!==v.fields){let G=pivotgridCore.pivotChangeAnnouncement(B.fields,v.fields,n.t);G&&(b.textContent=pivotgridCore.nextLiveText(b.textContent??"",G));}K&&(_.element.style.display=v.layout.showFooter===false?"none":"",_.paint(v)),B=v,W++;}function A(v){if(v.engineError){u.style.display="block",u.textContent=`${n.t("error")}: ${v.engineError.message}`;return}if(v.isBuilding&&!v.engineResult){u.style.display="block",u.textContent=`${n.t("initializing")} ${Math.round(v.buildProgress??0)}%`;return}if(!v.engineResult){u.style.display="block",u.textContent=n.t(v.noData?"emptyData":"loading");return}u.style.display="none",u.textContent="";}let $=t.onChartSync?at(p,()=>n.locale,t.chartIntegrationOptions??{},t.onChartSync):null,N=p.subscribe(Y);Q();let U={controller:p,element:i,setData(v){P||p.setData(v);},applyTransaction(v){return p.applyTransaction(v)},applyTransactionAsync(v,I){p.applyTransactionAsync(v,I);},flushAsyncTransactions(){p.flushAsyncTransactions();},setLoading(v){p.setLoading(v);},undoLayout:()=>pivotgridCore.keepFocusAcross(i,p,()=>p.undoLayout()),redoLayout:()=>pivotgridCore.keepFocusAcross(i,p,()=>p.redoLayout()),canUndoLayout:()=>p.canUndoLayout(),canRedoLayout:()=>p.canRedoLayout(),clearLayoutHistory:()=>p.clearLayoutHistory(),setFields(v){P||p.setFields(v);},setSearchText(v){p.setSearchText(v);},setLocale(v,I,O){P||(n=Be(v,I??t.dictionary,O??t.rtl),i.setAttribute("dir",n.rtl?"rtl":"ltr"),p.updateOptions({locale:n.locale,dictionary:n.dictionary}),B=null,Y(),r.relocalize(),$?.refresh());},openFieldChooser:()=>r.open(),closeFieldChooser:()=>r.close(),clearAllFilters:()=>p.clearAllFilters(),setDensity(v){P||(k()&&i.classList.remove(k()),L=v,k()&&i.classList.add(k()),B=null,Y());},destroy(){P||(P=true,N(),C(),d(),$?.stop(),r.destroy(),pe.destroy(),ae.destroy(),re.destroy(),we.destroy(),H.destroy(),be.destroy(),_.destroy(),xe.destroy(),y.destroy(),D.destroy(),p.dispose(),i.remove(),a||lt.delete(l));}};return Object.defineProperty(U,"__flushCount",{get:()=>W}),Object.defineProperty(U,"__shared",{get:()=>h}),Object.defineProperty(U,"__dragRootCount",{get:()=>pe.rootCount()}),U}
|
|
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=at;exports.createPivotGrid=
|
|
1
|
+
'use strict';var pivotgridCore=require('@kanunilabs/pivotgrid-core');var pn={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 a=e??"en",l={...pivotgridCore.en,...pn[a]??{},...t??{}};return {locale:a,rtl:n!==void 0?n:a==="ar",dictionary:l,t:i=>l[i]||i}}var un={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)"},st=new Set;function ct(e){for(let t of Object.keys(e)){let n=un[t];!n||st.has(t)||(st.add(t),console.warn(`[pivotgrid] config key "${t}" is React-only and ignored \u2014 ${n}`));}}var fn=[["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 pt(e,t){for(let[n,a]of fn){let l=t?typeof n=="function"?n(t):t[n]:void 0;typeof l=="string"&&l?e.style.setProperty(a,l):e.style.removeProperty(a);}t?.id?e.setAttribute("data-theme",t.id):e.removeAttribute("data-theme");}var Ue=(e,t)=>(e.areaIndex||0)-(t.areaIndex||0);function vt(e,t){let n=pivotgridCore.shownFields(e.fields),a=e.layout,l=n.filter(r=>r.area==="row").sort(Ue),i=n.filter(r=>r.area==="column").sort(Ue),d=n.filter(r=>r.area==="data").sort(Ue),b=e.engineResult,M=e.expandedPaths.has("*"),T=e.expandedColPaths.has("*"),F=a.rowHeaderLayout==="tree"?1:l.length||1,m=a.dataFieldPosition==="rows"&&d.length>1,f=m?1:d.length;if(!b)return {rowFields:l,colFields:i,dataFields:d,colHeaders:[],virtualRows:[],leafColHashes:[],cellLookup:new Map,fieldRanges:{},engineResult:null,layout:a,maxRowDepth:F,showDataInRows:m,dfsPerLeaf:f,totalDataCols:0,dataColOffset:F+(m?1:0)};let[g,h]=a.hideEmptySummaryCells?pivotgridCore.filterEmptySummaryTree(b):[b.rowTree,b.colTree],p=pivotgridCore.buildColumnHeaders(h,d,a,e.expandedColPaths,T,t,i.length),w=a.rowHeaderLayout==="tree"?pivotgridCore.flattenRowTreeTree(g,e.expandedPaths,M,l.length||1,a.showRowTotals??true,a.totalsPosition??"bottom",a.showTotalsForSingleValues!==false):pivotgridCore.flattenRowTreeTabular(g,e.expandedPaths,M,F,a.showRowTotals??true,a.totalsPosition??"bottom",a.showTotalsForSingleValues!==false),s=[];for(let r of w)if(m&&!r.isSubtotal&&!r.hasChildren)for(let x=0;x<d.length;x++)s.push({flatRow:r,dfIndex:x,isDataRow:true,isGrandTotal:false});else s.push({flatRow:r,dfIndex:0,isDataRow:false,isGrandTotal:false});if(pivotgridCore.grandTotalShown(a,"row",g))if(m)for(let r=0;r<d.length;r++)s.push({flatRow:null,dfIndex:r,isDataRow:true,isGrandTotal:true});else s.push({flatRow:null,dfIndex:0,isDataRow:false,isGrandTotal:true});let k=pivotgridCore.columnSlotOptions(a),y=[];for(let r of pivotgridCore.getVisibleColSlots(h,e.expandedColPaths,T,k))y.push({hash:r.node.key,isGrandTotal:!!r.node.isTotal,isSubtotal:r.isSubtotal});(pivotgridCore.grandTotalShown(a,"column",h)||y.length===0)&&y.push({hash:"",isGrandTotal:true});let C=new Map,o=b.cellMatrix.keys;for(let r=0;r<o.length;r++)C.set(o[r],r);let c=d.some(pivotgridCore.fieldNeedsRange)?pivotgridCore.computeFieldRanges(b,d):{};return {rowFields:l,colFields:i,dataFields:d,colHeaders:p,virtualRows:s,leafColHashes:y,cellLookup:C,fieldRanges:c,engineResult:b,layout:a,maxRowDepth:F,showDataInRows:m,dfsPerLeaf:f,totalDataCols:y.length*f,dataColOffset:F+(m?1:0)}}function Ye(e,t,n,a,l){let i=e.engineResult,d=i.rowIndexMap[t]??-1,b=i.columnIndexMap[n]??-1;if(d===-1||b===-1)return null;let M=e.cellLookup.get(d*pivotgridCore.MAX_C+b);if(M===void 0)return null;let T=e.dataFields.length,F=i.cellMatrix.sums,m=i.cellMatrix.displaySums,f={};for(let g=0;g<T;g++)f[e.dataFields[g].id]=F[M*T+g],m&&(f[`${e.dataFields[g].id}_display`]=m[M*T+g]);return {values:f,rowPath:pivotgridCore.pathParts(t),colPath:pivotgridCore.pathParts(n),isTotalCell:d===0||b===0||a||l}}function mt(e,t,n){if(!e.engineResult||n<e.dataColOffset)return null;let a=n-e.dataColOffset,l=Math.floor(a/e.dfsPerLeaf),i=a%e.dfsPerLeaf;if(l>=e.leafColHashes.length)return null;let d=e.virtualRows[t];if(!d)return null;let b=d.isGrandTotal?"":d.flatRow?.key;if(b===void 0)return null;let M=e.leafColHashes[l]?.hash;if(M===void 0)return null;let T=e.engineResult.rowIndexMap[b],F=e.engineResult.columnIndexMap[M];if(T===void 0||F===void 0)return null;let m=e.cellLookup.get(T*pivotgridCore.MAX_C+F);if(m===void 0)return null;let f=e.showDataInRows?d.dfIndex:i,h=e.engineResult.cellMatrix.sums[m*e.dataFields.length+f];return typeof h=="number"?h:null}function Ze(e,t,n){let a=e.virtualRows[t];if(!a||a.isGrandTotal||!a.flatRow)return null;let l=a.flatRow,i=e.layout.rowHeaderLayout==="tree",d=n,b=i?l.depth:d,M=b===l.depth,T=b<l.depth,F=M?l.hasChildren:T,m=M?l.isExpanded:T,f=i?l.key:pivotgridCore.pathKey(l.pathValues.slice(0,d+1));return {hasChildren:F,isExpanded:m,cellHashStr:f,depth:b,dIdx:d,flatRow:l}}function gt(e,t,n){if(n<e.dataColOffset||!e.engineResult)return null;let a=n-e.dataColOffset,l=Math.floor(a/e.dfsPerLeaf),i=a%e.dfsPerLeaf;if(l>=e.leafColHashes.length)return null;let d=e.virtualRows[t];if(!d)return null;let b=d.isGrandTotal?"":d.flatRow?.key;if(b===void 0)return null;let M=e.leafColHashes[l],T=Ye(e,b,M.hash,!!d.flatRow?.isSubtotal,M.isGrandTotal);if(!T)return null;let F=e.showDataInRows?d.dfIndex:i,m=e.dataFields[F],f=T.values[`${m?.id}_display`]??T.values[m?.id],g=!!d.flatRow?.isSubtotal||M.isGrandTotal||T.isTotalCell;return {cell:{isTotalCell:T.isTotalCell,rowPath:T.rowPath,colPath:T.colPath,values:T.values},val:f,isTotal:g}}function Ne(e){let t=new Map;return (n,a)=>{if(n==null||Number.isNaN(n))return "";if(a.format&&typeof n=="number"){if(typeof a.format=="function")return a.format(n);try{let l=a.format,i=t.get(l);i||(i=new Intl.NumberFormat(e,l),t.set(l,i));let d=i.format(n);return l.isCustom&&(l.prefix||l.suffix)?`${l.prefix||""}${d}${l.suffix||""}`:d}catch{return String(n)}}return typeof n=="number"&&pivotgridCore.percentModeText(n,a,e)||String(n)}}var Ie=null;function We(e,t,n){if(!e)return false;let a=Math.min(e.startR,e.endR),l=Math.max(e.startR,e.endR),i=Math.min(e.startC,e.endC),d=Math.max(e.startC,e.endC);return t>=a&&t<=l&&n>=i&&n<=d}function bt(e){let{scroller:t,shared:n}=e,a={},l="",i=null,d=false;function b(){for(let g of t.querySelectorAll("td[data-r][data-c]")){let h=Number(g.getAttribute("data-r")),p=Number(g.getAttribute("data-c"));g.classList.toggle("kanuni-pivot-cell-selected",We(n.selection,h,p));}}function M(){let g=n.selection;if(e.onStats){if(!g||g.mode!=="data"){i&&(clearTimeout(i),i=null),d&&(d=false,e.onStats(null));return}i&&clearTimeout(i),i=setTimeout(()=>{i=null;let h=n.selection;if(!h||h.mode!=="data")return;let p=Math.min(h.startR,h.endR),w=Math.max(h.startR,h.endR),s=Math.min(h.startC,h.endC),k=Math.max(h.startC,h.endC),y=0,C=0,o=1/0,c=-1/0,r=e.getVM();if(r){for(let x=p;x<=w;x++)for(let u=s;u<=k;u++){let E=mt(r,x,u);E===null||isNaN(E)||(y+=E,C++,E<o&&(o=E),E>c&&(c=E));}d=C>0,e.onStats(C>0?{sum:y,count:C,avg:y/C,min:o,max:c}:null);}},10);}}n.selectByKey=(g,h,p,w)=>{let s=e.getVM();if(!s)return;let k=h<s.dataColOffset?"row":"data",y=n.selection;if(Ie=a,l="",p&&y&&y.mode===k){if(y.endR===g&&y.endC===h&&!y.isSelecting)return;n.selection={...y,endR:g,endC:h,isSelecting:false};}else if(p){let o=(w.c<s.dataColOffset?"row":"data")===k?w:{r:g,c:h};n.selection={startR:o.r,startC:o.c,endR:g,endC:h,isSelecting:false,mode:k};}else {if(y&&y.mode===k&&!y.isSelecting&&y.startR===g&&y.startC===h&&y.endR===g&&y.endC===h)return;n.selection={startR:g,startC:h,endR:g,endC:h,isSelecting:false,mode:k};}b(),M();};let T=g=>{if(g.button!==0||n.isResizing||g.target.closest?.(".kanuni-pivot-resize-handle"))return;let h=g.target.closest?.("td[data-r][data-c]");if(!h)return;let p=e.getVM();if(!p)return;let w=Number(h.getAttribute("data-r")),s=Number(h.getAttribute("data-c")),k=s<p.dataColOffset?"row":"data";Ie=a,l="",n.selection={startR:w,startC:s,endR:w,endC:s,isSelecting:true,mode:k},b(),M();},F=g=>{let h=n.selection;if(!h||!h.isSelecting)return;let p=g.target.closest?.("td[data-r][data-c]");if(!p)return;let w=Number(p.getAttribute("data-r")),s=Number(p.getAttribute("data-c")),k=`${w},${s}`;if(k===l)return;l=k;let y=e.getVM();!y||(s<y.dataColOffset?"row":"data")!==h.mode||w===h.endR&&s===h.endC||(h.endR=w,h.endC=s,b(),M());},m=()=>{n.selection&&(n.selection.isSelecting=false);},f=g=>{if(!(g.ctrlKey||g.metaKey)||g.key!=="c"||Ie!==null&&Ie!==a)return;let h=n.selection;if(!h)return;let p=Math.min(h.startR,h.endR),w=Math.max(h.startR,h.endR),s=Math.min(h.startC,h.endC),k=Math.max(h.startC,h.endC),y="";for(let C=p;C<=w;C++){let o=[];for(let c=s;c<=k;c++){let r=t.querySelector(`[data-r="${C}"][data-c="${c}"]`);o.push(r?(r.innerText??r.textContent??"").trim().replace(/\n/g," "):"");}y+=o.join(" ")+`
|
|
2
|
+
`;}y&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(y).catch(()=>{});};return t.addEventListener("mousedown",T),t.addEventListener("mouseover",F),document.addEventListener("mouseup",m),document.addEventListener("keydown",f),{destroy(){t.removeEventListener("mousedown",T),t.removeEventListener("mouseover",F),document.removeEventListener("mouseup",m),document.removeEventListener("keydown",f),i&&clearTimeout(i),Ie===a&&(Ie=null),n.selectByKey=void 0;}}}var yt={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 xt="http://www.w3.org/2000/svg";function X(e,t=15,n){let a=document.createElementNS(xt,"svg");a.setAttribute("width",String(t)),a.setAttribute("height",String(t)),a.setAttribute("viewBox","0 0 24 24"),a.setAttribute("fill","none"),a.setAttribute("stroke","currentColor"),a.setAttribute("stroke-width","2"),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),n&&(a.style.color=n);for(let[l,i]of yt[e]??[]){let d=document.createElementNS(xt,l);for(let[b,M]of Object.entries(i))d.setAttribute(b,String(M));a.appendChild(d);}return a}function Ve(e,t=15,n){let a=X(e,t,n);return a.setAttribute("fill","currentColor"),a}function he(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 Pn(e,t,n){let a=e.filter(l=>l.area===t);return t==="filter"?Ct(a,n):a.sort((l,i)=>(l.areaIndex||0)-(i.areaIndex||0))}var Rn={row:"rowArea",column:"columnArea",data:"dataArea",filter:"filterArea"};function Ge(e,t){let{t:n,locale:a,rtl:l}=t.getI18n(),i=he("kanuni-pivot-field-chip");i.setAttribute("data-drop-id",e.id),i.setAttribute("data-touch-hold",""),i.style.position="relative",i.style.cursor="pointer",i.setAttribute("role","button"),i.tabIndex=0;let d=t.getFields?Pn(t.getFields(),e.area,a):[e],b=Math.max(0,d.findIndex(s=>s.id===e.id)),M=n(Rn[e.area??""]??"rowArea");i.setAttribute("aria-label",n("fieldChipLabel").replace("{0}",e.caption||e.id).replace("{1}",M).replace("{2}",String(b+1)).replace("{3}",String(d.length))),i.setAttribute("aria-keyshortcuts","Control+ArrowLeft Control+ArrowRight Control+Home Control+End Delete Alt+ArrowDown Shift+F10"),i.setAttribute("aria-description",n("fieldChipKeys"));let T=()=>{if(!t.onSort)return;let s=e.sortOrder==="asc"?"desc":e.sortOrder==="desc"?void 0:"asc";t.onSort(e.id,s);},F=s=>{if(!s)return;(i.closest(".kanuni-pivot-root")??document.body).querySelector(`.kanuni-pivot-field-chip[data-drop-id="${s}"]`)?.focus({preventScroll:true});};i.addEventListener("keydown",s=>{let k=s.ctrlKey||s.metaKey,y=l?"ArrowRight":"ArrowLeft",C=l?"ArrowLeft":"ArrowRight",o=!!t.onMove&&e.area!=="filter",c=true;if(s.key==="Enter"||s.key===" ")T();else if(k&&o&&(s.key===y||s.key==="ArrowUp"))b>0&&t.onMove(e.id,"left");else if(k&&o&&(s.key===C||s.key==="ArrowDown"))b<d.length-1&&t.onMove(e.id,"right");else if(k&&o&&s.key==="Home")b>0&&t.onMove(e.id,"start");else if(k&&o&&s.key==="End")b<d.length-1&&t.onMove(e.id,"end");else if(!k&&(s.key===y||s.key===C)){let r=s.key===y?-1:1;F(d[b+r]?.id);}else if(s.key==="Delete"||s.key==="Backspace"){let r=d[b+1]??d[b-1];t.requestFocus?.(r?.id??null),t.onRemove(e.id);}else if(s.altKey&&s.key==="ArrowDown"){let r=i.getBoundingClientRect();t.onFilterClick(l?r.right:r.left,r.bottom,e.id);}else if(s.key==="F10"&&s.shiftKey||s.key==="ContextMenu"){if(!t.onContextMenu)return;let r=i.getBoundingClientRect();t.onContextMenu(l?r.right:r.left,r.bottom,e.id,void 0,true);}else c=false;c&&(s.preventDefault(),s.stopPropagation());});let m=he("pivot-truncate","span");Object.assign(m.style,{maxWidth:"var(--pivot-chip-max-width, 120px)",userSelect:"none"}),m.title=e.caption||e.id,m.textContent=e.caption||e.id,i.appendChild(m),e.sortOrder==="asc"&&i.appendChild(X("arrow-up",12,"var(--pivot-primary)")),e.sortOrder==="desc"&&i.appendChild(X("arrow-down",12,"var(--pivot-primary)"));let f=e.area==="data"&&e.summaryType?pivotgridCore.summaryTypeLabel(String(e.summaryType),n):"";if(f){let s=he("kanuni-pivot-chip-badge","span");Object.assign(s.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"}),s.textContent=f,i.appendChild(s);}let g=!!e.filterValues&&e.filterValues.size>0||!!e.valueFilter||!!e.labelFilter,h=he(`kanuni-pivot-field-chip-actions${g?" is-filtered":""}`);h.setAttribute("aria-hidden","true");let p=he("kanuni-pivot-chip-btn","span");p.title=n("filterField"),p.style.color=g?"var(--pivot-danger)":"inherit",p.appendChild(X("filter",12)),p.addEventListener("pointerdown",s=>s.stopPropagation()),p.addEventListener("click",s=>{s.stopPropagation(),t.onFilterClick(s.clientX,s.clientY,e.id);});let w=he("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",s=>s.stopPropagation()),w.addEventListener("click",s=>{s.stopPropagation(),t.onRemove(e.id);}),h.append(p,w),i.appendChild(h),t.onContextMenu){i.setAttribute("data-chip-menu","");let s=he(`kanuni-pivot-chip-more${g?" is-filtered":""}`,"span");if(s.setAttribute("aria-hidden","true"),s.addEventListener("pointerdown",k=>k.stopPropagation()),s.addEventListener("click",k=>{k.stopPropagation();let y=s.getBoundingClientRect();t.onContextMenu(l?y.right:y.left,y.bottom,e.id,void 0);}),i.appendChild(s),g){let k=X("filter",10);k.classList.add("kanuni-pivot-chip-filtered-mark"),k.setAttribute("aria-hidden","true"),i.appendChild(k);}}return i.addEventListener("click",s=>{s.stopPropagation(),T();}),i.addEventListener("contextmenu",s=>{if(s.stopPropagation(),t.onContextMenu){s.preventDefault();let k=i.getBoundingClientRect(),y=Number.isFinite(s.clientX)?s.clientX:l?k.right:k.left,C=Number.isFinite(s.clientY)?s.clientY:k.bottom;t.onContextMenu(y,C,e.id,void 0);}}),i}function je(e,t,n,a,l){let{t:i}=l.getI18n(),d=he("kanuni-pivot-area-dropzone");d.setAttribute("data-drop-id",e),d.tabIndex=-1;let b=he("kanuni-pivot-area-header");b.appendChild(X(n,13)),b.appendChild(document.createTextNode(t)),d.appendChild(b);let M=he("kanuni-pivot-area-content");if(a.length===0){let F=he("pivot-text-xs pivot-text-muted","span");Object.assign(F.style,{fontStyle:"italic",padding:"0 8px"}),F.textContent=i("dropHere"),M.appendChild(F);}for(let F of a)M.appendChild(Ge(F,l));let T=he("kanuni-pivot-ghost-end");return T.setAttribute("data-drop-id",`${e}-ghost-end`),T.setAttribute("data-ghost-populated",a.length>0?"1":"0"),Object.assign(T.style,{flex:"1",minWidth:"40px",minHeight:"24px",borderRadius:"var(--pivot-border-radius-sm)",transition:"background-color 0.2s"}),M.appendChild(T),d.appendChild(M),d}function Ct(e,t){let n=new Map;return e.map(l=>{let i=l.caption||l.id||"";if(n.has(i)){let d=n.get(i)+1;return n.set(i,d),{...l,caption:`${i} (${d})`}}return n.set(i,1),l}).sort((l,i)=>(l.caption||"").toLowerCase().localeCompare((i.caption||"").toLowerCase(),t||"en"))}function wt(e){let t=he("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 a(l,i,d){let{t:b}=e.getI18n(),M=l.querySelector(".kanuni-pivot-area-header"),T=l.querySelector(".kanuni-pivot-area-content"),F=d.collapsed===true;if(F&&l.setAttribute("data-collapsed",""),M&&F){let g=pivotgridCore.countFilteredFields(i);if(g>0){let h=he("kanuni-pivot-area-filtered-count","span");h.textContent=b("filteredFieldCount").replace("{0}",String(g)),M.appendChild(h);}}if(M&&e.onToggleCollapsed&&i.length>0){let g=he("kanuni-pivot-area-collapse","button");g.type="button";let h=b(F?"expandFilterArea":"collapseFilterArea");g.setAttribute("aria-expanded",String(!F)),g.setAttribute("aria-label",h),g.title=h;let p=X("chevron-down",14);F||(p.style.transform="rotate(180deg)"),g.appendChild(p),g.addEventListener("click",w=>{w.stopPropagation(),e.onToggleCollapsed();}),M.appendChild(g);}let m=pivotgridCore.filterAreaRows({filterAreaMaxRows:d.maxRows,filterAreaCollapsed:F,filterAreaCollapsedRows:d.collapsedRows});if(!T||m===null)return;if(m===0){T.style.display="none";return}let f=T.querySelector(".kanuni-pivot-field-chip");T.style.maxHeight=`${pivotgridCore.filterAreaMaxHeight(m,f?.offsetHeight||28)}px`,T.style.overflowY=F?"hidden":"auto";}return {element:t,paint(l,i,d={}){t.style.display=i?"":"none";let b=Je(t);if(t.textContent="",!i)return;let M=he("pivot-flex");M.style.width="100%";let{t:T,locale:F}=e.getI18n(),m=je("filter",T("filterArea"),"filter",Ct(l,F),e);M.appendChild(m),t.appendChild(M),a(m,l,d),Qe(t,b);},destroy(){t.removeEventListener("contextmenu",n),t.remove();}}}var Et="kanuni-pivot-drop-indicator";function An(e){let t=he(Et);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=he("");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 a=he("");Object.assign(a.style,{position:"absolute",bottom:"0",width:"0",height:"0",borderBottom:"5px solid var(--pivot-primary)"}),a.style.setProperty("inset-inline-start","-4px"),a.style.setProperty("border-inline-start","4px solid transparent"),a.style.setProperty("border-inline-end","4px solid transparent");let l=he("");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,a,l),t}function kt(e,t){for(let n of e){for(let a of n.querySelectorAll(`.${Et}`))a.remove();for(let a of n.querySelectorAll('[data-drop-id$="-ghost-end"]'))a.style.backgroundColor="transparent",a.style.boxShadow="none",a.textContent="";for(let a of n.querySelectorAll(".pivot-area-strip--over"))a.classList.remove("pivot-area-strip--over");for(let a of n.querySelectorAll('[data-drop-kind="list"]'))a.style.backgroundColor="transparent",a.style.boxShadow="none";}if(t.intent==="before"||t.intent==="after"){if(!t.targetId)return;for(let n of e){let a=n.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${t.targetId}"]`)??n.querySelector(`[data-drop-id="${t.targetId}"]`)??n.querySelector(`[data-drop-id="chooser-${t.targetId}"]`);if(a){a.appendChild(An(t.intent));return}}}else if(t.intent==="append"&&t.targetArea)for(let n of e){let a=n.querySelector(`[data-drop-id="${t.targetArea}-ghost-end"]`)??n.querySelector(`[data-drop-id="chooser-${t.targetArea}-ghost-end"]`);if(a&&(a.style.backgroundColor="color-mix(in srgb, var(--pivot-primary) 10%, transparent)",a.style.boxShadow="inset 0 0 0 1px color-mix(in srgb, var(--pivot-primary) 50%, transparent)",a.getAttribute("data-ghost-populated")==="1")){let d=he("");Object.assign(d.style,{width:"4px",height:"100%",backgroundColor:"var(--pivot-primary)",borderRadius:"2px",marginLeft:"4px"}),a.appendChild(d);}n.querySelector(`[data-drop-id="${t.targetArea}"]`)?.classList.add("pivot-area-strip--over");let i=n.querySelector(`[data-drop-id="chooser-${t.targetArea}"][data-drop-kind="list"]`);i&&(i.style.backgroundColor="color-mix(in srgb, var(--pivot-primary) 5%, transparent)",i.style.boxShadow="inset 0 0 0 1px color-mix(in srgb, var(--pivot-primary) 50%, transparent)");}}var Vn={style:{}},zn=28,Mt=5,$n=10,Lt=40,St=8,et=100;function Y(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function ee(e,t){for(let[n,a]of Object.entries(t)){if(a==null)continue;let l=n.replace(/[A-Z]/g,i=>"-"+i.toLowerCase());e.style.setProperty(l,typeof a=="number"&&a!==0&&!/z-?index|font-?weight|opacity/i.test(n)?`${a}px`:String(a));}}function Ke(e,t,n,a){let l=Y("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(a,"-3px"),l}function ze(e,t){e.textContent="",t!=null&&(typeof t=="string"||typeof t=="number"?e.textContent=String(t):e.appendChild(t));}function Te(e,t){e.classList.add("kanuni-pivot-rh-sticky"),e.style.setProperty("inset-inline-start",t);}function Pt(e){let{host:t,getI18n:n}=e,a=e.columnWidthDefaults??pivotgridCore.resolveColumnWidthDefaults(),l=e.rowHeight??(()=>zn),i=e.shared?.cellId??((S,A)=>`pivot-cell-${S}-${A}`),d=Y("datagrid-table-wrapper custom-scrollbar pivot-right-pane");ee(d,{overflow:"auto",flex:"1 1 auto",minHeight:0,position:"relative",outline:"none"}),d.tabIndex=0,d.setAttribute("role","grid");let b=Y("");ee(b,{width:"max-content",position:"relative",minWidth:"100%"});let M=Y("kanuni-pivot-table","table");M.setAttribute("role","presentation"),ee(M,{borderCollapse:"separate",borderSpacing:0,width:0,minWidth:"100%",tableLayout:"fixed"});let T=document.createElement("colgroup"),F=Y("","thead");F.setAttribute("role","rowgroup"),ee(F,{position:"sticky",top:0,zIndex:50,backgroundColor:"var(--pivot-surface-header)"});let m=Y("","tbody");m.setAttribute("role","rowgroup"),M.append(T,F,m),b.appendChild(M),d.appendChild(b),t.appendChild(d);let f=null,g=Ne(n().locale),h=n().locale,p={start:-1,end:-1},w={start:0,end:Number.MAX_SAFE_INTEGER},s={},k=new Set,y=false,C=()=>f?Math.max(f.colHeaders.length,1)*l()+(e.chipDeps?42:0):0,o=S=>s[`row-${S}`]??a.rowHeader,c=()=>s[`row-${f.maxRowDepth}`]??et,r=S=>s[`leaf-${S}`]??a.data;function x(){if(!f||f.totalDataCols<=Lt){w={start:0,end:Number.MAX_SAFE_INTEGER};return}let S=Math.abs(d.scrollLeft),A=E().total,B=S-A,W=0,U=0;for(;W<f.totalDataCols&&U+r(W)<=B;)U+=r(W),W++;W=Math.max(0,W-St);let de=d.clientWidth||0,ge=W,Z=0;for(;ge<f.totalDataCols&&Z<=de;)Z+=r(ge),ge++;w={start:W,end:Math.min(f.totalDataCols,ge+St)};}function u(){if(!f)return {start:0,end:0};let S=Math.max(0,d.scrollTop-C()),A=Math.max(0,Math.floor(S/l())-Mt),B=Math.ceil((d.clientHeight||600)/l())+$n;return {start:A,end:Math.min(f.virtualRows.length,A+B+Mt)}}function E(){let S=[];for(let A=0;A<f.maxRowDepth;A++)S.push(o(A));return f.showDataInRows&&S.push(c()),pivotgridCore.computeRowHeaderWidths(S,R(S.length)?0:d.clientWidth)}function R(S){let A=f.layout.rowHeaderOverflow;return A==="scroll"||pivotgridCore.rowHeadersUnpinned(S,d.clientWidth,A)}function P(){d.classList.toggle("kanuni-pivot-rowheaders-scroll",R(f.maxRowDepth+(f.showDataInRows?1:0)));let{widths:S,total:A}=E(),B=0;for(let W=0;W<S.length;W++)d.style.setProperty(`--row-header-left-${W}`,`${B}px`),d.style.setProperty(`--col-width-row-${W}`,`${S[W]}px`),k.add(`--col-width-row-${W}`),B+=S[W];d.style.setProperty("--row-header-total-width",`${A}px`);}function D(){T.textContent="";for(let S=0;S<f.maxRowDepth;S++){let A=document.createElement("col");A.style.width=`var(--col-width-row-${S}, ${a.rowHeader}px)`,T.appendChild(A);}if(f.showDataInRows){let S=document.createElement("col");S.style.width=`var(--col-width-row-${f.maxRowDepth}, ${et}px)`,T.appendChild(S);}for(let S=0;S<Math.max(f.totalDataCols,1);S++){let A=document.createElement("col");A.style.width=`var(--col-width-data-${S}, ${a.data}px)`,T.appendChild(A);}}function I(){let{colHeaders:S,rowFields:A,colFields:B,dataFields:W,maxRowDepth:U,showDataInRows:de,layout:ge,dataColOffset:Z}=f,{t:ue,locale:L}=n(),$=Je(F);F.textContent="";let K=Math.max(S.length,1),v=e.chipDeps;if(v){let z=Y("","tr");z.setAttribute("role","row"),ee(z,{height:42});let O=Y("","th");O.setAttribute("role","columnheader"),O.colSpan=Math.max(Z,1),ee(O,{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)"}),O.style.setProperty("inset-inline-start","0px"),O.appendChild(je("data",ue("dataArea"),"bar-chart-3",W,v)),z.appendChild(O);let G=Y("","th");G.setAttribute("role","columnheader"),G.colSpan=Math.max(f.totalDataCols,1),ee(G,{borderBottom:"1px solid var(--pivot-border)",padding:0,verticalAlign:"top",zIndex:1,backgroundColor:"var(--pivot-surface-header)"});let N=Y("");ee(N,{position:"sticky",width:"max-content",maxWidth:"100%"}),N.style.setProperty("inset-inline-start","var(--row-header-total-width, 0px)"),N.appendChild(je("column",ue("columnArea"),"columns3",B,v)),G.appendChild(N),z.appendChild(G),F.appendChild(z);}for(let z=0;z<K;z++){let O=Y("","tr");if(O.setAttribute("role","row"),ee(O,{height:l()}),z===0){let N=j=>({position:"sticky",top:0,zIndex:60,backgroundColor:"var(--pivot-surface-header)",borderBottom:"1px solid var(--pivot-border)",borderInlineEnd:j?"1px solid var(--pivot-border)":"none",verticalAlign:"bottom",padding:"4px 8px",color:"var(--pivot-text-header)"});if(A.length===0){let j=Y("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");j.setAttribute("data-drop-id","row"),j.setAttribute("data-row-header-idx","0"),j.rowSpan=K,j.colSpan=Math.max(Z,1),ee(j,{...N(true),padding:"8px",color:"color-mix(in srgb, var(--pivot-text-header, var(--pivot-text)) 70%, transparent)"}),Te(j,"var(--row-header-left-0, 0px)"),j.textContent=ue("dropHere"),O.appendChild(j);}else if(ge.rowHeaderLayout==="tree"){let j=Y("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");if(j.setAttribute("data-row-header-idx","0"),j.rowSpan=K,ee(j,N(!de)),Te(j,"var(--row-header-left-0, 0px)"),v){let _=Y("");ee(_,{display:"flex",flexWrap:"wrap",gap:4});for(let oe of A)_.appendChild(Ge(oe,v));j.appendChild(_);}else ze(j,A.map(_=>_.caption).join(", "));O.appendChild(j);}else for(let j=0;j<U;j++){let _=Y("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");_.setAttribute("data-row-header-idx",String(j)),_.rowSpan=K,ee(_,N(j===U-1&&!de)),Te(_,`var(--row-header-left-${j}, 0px)`);let oe=A[j];oe&&v&&_.setAttribute("data-drop-id",oe.id),oe&&v?_.appendChild(Ge(oe,v)):ze(_,oe?.caption??""),O.appendChild(_);}if(de&&A.length>0){let j=Y("kanuni-pivot-header-cell kanuni-pivot-header-corner","th");j.setAttribute("data-row-header-idx",String(U)),j.rowSpan=K,ee(j,N(true)),Te(j,`var(--row-header-left-${U}, 0px)`);let _=Y("");ee(_,{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=ue("dataArea"),j.appendChild(_),O.appendChild(j);}}let G=S[z]??[];for(let N of G){let j=N.fieldId?B.find(se=>se.id===N.fieldId):void 0,_=!!j?.filterValues&&j.filterValues.size>0,oe=N.leafStart,xe=j&&!N.isTotal?pivotgridCore.formatDimensionValue(N.caption,j,"grid",L):N.caption,ae={text:typeof j?.cellTemplate=="function"?j.cellTemplate({value:N.caption,displayValue:xe,field:j})??null:String(xe??""),style:{textAlign:"left",fontWeight:N.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:j?"pointer":"context-menu",position:"relative",zIndex:1,padding:"4px 6px"},className:`kanuni-pivot-header-cell group ${N.isTotal?"kanuni-pivot-header-total":""}`};e.onCellPrepared?.({area:"column",cell:null,rowIndex:z,columnIndex:oe,cellConfig:ae}),ae.style.fontWeight=N.isTotal?pivotgridCore.paintedFontWeight(ae.style.fontWeight,600,"--pivot-font-weight-header-total"):pivotgridCore.paintedFontWeight(ae.style.fontWeight,500,"--pivot-font-weight-header");let Q=Y(ae.className,"th");Q.setAttribute("role","columnheader"),N.hasChildren&&Q.setAttribute("aria-expanded",String(!!N.isExpanded)),Q.colSpan=N.colSpan,Q.rowSpan=N.rowSpan,ee(Q,ae.style);let ve=Y("pivot-flex pivot-items-center");if(ee(ve,{gap:4}),N.hasChildren){let se=Y("kanuni-pivot-expand-icon","span");se.textContent=N.isExpanded?"\u2212":"+",se.setAttribute("aria-hidden","true"),se.setAttribute("data-col-expand",N.colPath??""),ee(se,{cursor:"pointer",marginRight:4,flexShrink:0}),ve.appendChild(se);}let ce=Y("select-none","span");ze(ce,ae.text),ve.appendChild(ce);let le=f.rowFields.find(se=>se.sortBySummaryField===N.fieldId&&(se.sortBySummaryPath||"")===(N.colPath||""));if(le){let se=Y("pivot-text-primary kanuni-pivot-sort-arrow","span");se.appendChild(X(le.sortOrder==="asc"?"arrow-up":"arrow-down",12)),ve.appendChild(se);}if(N.fieldId){let se=Y(`kanuni-pivot-head-filter cursor-pointer transition-opacity ${_?"opacity-100 pivot-text-danger":"opacity-0 group-hover:opacity-70"}`,"span");se.setAttribute("data-filter-field",N.fieldId),se.appendChild(_?Ve("filter",10):X("filter",10)),ve.appendChild(se);}Q.appendChild(ve),N.fieldId&&Q.setAttribute("data-header-field",N.fieldId),N.colPath!==void 0&&Q.setAttribute("data-header-col-path",N.colPath),Q.setAttribute("data-header-depth",String(z)),Q.appendChild(Ke(`leaf-${oe}-${N.colSpan}`,a.data,N.colSpan,"right")),O.appendChild(Q);}F.appendChild(O);}Qe(F,$);}function H(S,A,B,W){let U=A.flatRow,{rowFields:de,layout:ge,maxRowDepth:Z,virtualRows:ue}=f,{locale:L}=n(),$=ge.rowHeaderLayout==="tree",K=$?U.depth:W,v=U.pathValues[K],z=U.rowSpans[W]>0&&A.dfIndex===0,O=de[K],G=O&&v!==null&&v!==void 0?pivotgridCore.formatDimensionValue(v,O,"grid",L):v,N=K===U.depth,j=K<U.depth,_=N?U.hasChildren:j,oe=N?U.isExpanded:j,xe=ue[B+1],Me=!$&&xe&&!xe.isGrandTotal&&xe.flatRow&&!xe.flatRow.isSubtotal&&(xe.flatRow.rowSpans[W]===0||xe.dfIndex>0)&&xe.flatRow.pathValues[W]===v,ae=pivotgridCore.rowHeaderGroupEnd(ue,B,W,$),Q=ge.rowHeaderGroupLines===true,ve=G!=null?String(G):null;typeof O?.cellTemplate=="function"&&ve!==null&&(ve=O.cellTemplate({value:G,displayValue:G,field:O})??ve);let ce={text:ve,style:{position:"sticky",backgroundColor:"var(--pivot-surface)",zIndex:40,cursor:_?"pointer":"default",fontWeight:G&&K<U.depth?600:400,verticalAlign:"middle",padding:0,borderBottom:Q?ae?"1px solid var(--pivot-border)":"none":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===B&&e.shared?.focused?.c===W?" kanuni-pivot-cell-focused":""}${We(e.shared?.selection??null,B,W)?" kanuni-pivot-cell-selected":""}`};e.onCellPrepared?.({area:"row",cell:null,rowIndex:B,columnIndex:W,cellConfig:ce}),G&&K<U.depth&&(ce.style.fontWeight=pivotgridCore.paintedFontWeight(ce.style.fontWeight,600,"--pivot-font-weight-group"));let le=Y(ce.className,"td");if(le.id=i(B,W),le.setAttribute("role","rowheader"),_&&le.setAttribute("aria-expanded",String(oe)),le.setAttribute("data-r",String(B)),le.setAttribute("data-c",String(W)),ae&&le.setAttribute("data-group-end",""),ee(le,ce.style),Te(le,`var(--row-header-left-${W}, 0px)`),!$&&W>=U.depth&&W<Z-1&&le.style.setProperty("border-inline-end","none"),!z&&!$){Q||(le.style.borderBottom="none"),le.appendChild(Ke(`row-${W}`,a.rowHeader,1,n().rtl?"left":"right")),S.appendChild(le);return}le.setAttribute("data-group-start","");let se=$?U.depth*20:0,Se=Y("");if(ee(Se,{display:"flex",alignItems:"center",gap:4,padding:"0 8px",height:"100%",position:"relative"}),Se.style.setProperty("padding-inline-start",`${8+se}px`),$&&U.depth>0){let Le=Y("kanuni-pivot-tree-line");ee(Le,{position:"absolute",left:se,top:-l()/2,width:12,height:l(),borderLeft:"1px dotted var(--pivot-border)",borderBottom:"1px dotted var(--pivot-border)"}),Se.appendChild(Le);}if(ce.text!==null&&ce.text!==void 0){if(_){let ke=Y("kanuni-pivot-expand-icon","span");ke.textContent=oe?"\u2212":"+",ke.setAttribute("aria-hidden","true"),ee(ke,{flexShrink:0,position:"relative",zIndex:2}),Se.appendChild(ke);}else {let ke=Y("","span");ee(ke,{width:14,flexShrink:0}),Se.appendChild(ke);}let Le=Y("truncate","span");ze(Le,ce.text),ge.textOverflow==="clip"&&(typeof ce.text=="string"||typeof ce.text=="number")&&(Le.title=String(ce.text)),Se.appendChild(Le);}le.appendChild(Se),le.appendChild(Ke(`row-${W}`,a.rowHeader,1,n().rtl?"left":"right")),S.appendChild(le);}function V(S,A,B,W,U){let{dataFields:de,leafColHashes:ge,dfsPerLeaf:Z,dataColOffset:ue,showDataInRows:L,totalDataCols:$}=f,K=$>Lt,v=e.registry?e.registry.getPluginsByType("cellRender"):null;ge.forEach((z,O)=>{let G=O*Z,N=L?[de[B]]:de,j=K&&(G+Z<=w.start||G>=w.end),_=j?null:Ye(f,A,z.hash,W,z.isGrandTotal);N.forEach((oe,xe)=>{let Me=G+xe,ae=ue+Me,Q=Y("kanuni-pivot-cell","td");if(Q.id=i(U,ae),Q.setAttribute("role","gridcell"),Q.setAttribute("data-r",String(U)),Q.setAttribute("data-c",String(ae)),j||K&&(Me<w.start||Me>=w.end)){S.appendChild(Q);return}let ve=_?.values[`${oe.id}_display`]??_?.values[oe.id],ce=g(ve,oe),le=W||z.isGrandTotal||!!_?.isTotalCell,se=oe.conditionalFormatting?pivotgridCore.resolveConditionalVisual(_?.values[oe.id],oe,_??null,f.fieldRanges[oe.id]):Vn,Se=se.style,Le=ce;if(typeof oe.cellTemplate=="function")Le=oe.cellTemplate({value:ve,displayValue:ce,cell:_,field:oe})??null;else if(v){for(let Pe of v)if(Pe.renderCell){let Xe=Pe.renderCell(ve,ce,_,oe);if(Xe!=null){Le=Xe;break}}}let ke={text:Le,style:{textAlign:oe.dataType==="number"?"right":"left",fontWeight:le?600:400,backgroundColor:le?"var(--pivot-bg)":"transparent",cursor:e.hasCellClick?.()&&_?"pointer":"default",...Se},className:`kanuni-pivot-cell ${le?"kanuni-pivot-cell-total":""}${e.shared?.focused?.r===U&&e.shared?.focused?.c===ae?" kanuni-pivot-cell-focused":""}${We(e.shared?.selection??null,U,ae)?" kanuni-pivot-cell-selected":""}`};if(e.onCellPrepared?.({area:"data",cell:_,rowIndex:U,columnIndex:ae,cellConfig:ke}),le&&(ke.style.fontWeight=pivotgridCore.paintedFontWeight(ke.style.fontWeight,600,"--pivot-font-weight-total")),Q.className=ke.className,ee(Q,ke.style),Q.setAttribute("data-val",typeof ve=="number"?String(ve):""),ze(Q,ke.text),se.dataBar){let Pe=Math.round(se.dataBar.ratio*100);Q.style.setProperty("background-image",`linear-gradient(to ${n().rtl?"left":"right"}, ${se.dataBar.color} ${Pe}%, transparent ${Pe}%)`),Q.style.setProperty("background-repeat","no-repeat");}if(se.icon){let Pe=X(se.icon,12);Pe.style.setProperty("margin-inline-end","4px"),Pe.style.setProperty("vertical-align","middle"),Q.insertBefore(Pe,Q.firstChild);}S.appendChild(Q);});});}let q=(S,A)=>e.shared?.focused?.r===S&&e.shared?.focused?.c===A?" kanuni-pivot-cell-focused":"";function ie(S){let A=S.flatRow;return S.isGrandTotal||!A?{level:1}:A.isSubtotal||!A.hasChildren?{level:A.depth+1}:{level:A.depth+1,expanded:!!A.isExpanded}}function pe(S,A){let{t:B}=n(),{maxRowDepth:W,showDataInRows:U,dataFields:de,layout:ge}=f,Z=Y("kanuni-pivot-row","tr");if(Z.setAttribute("role","row"),Z.setAttribute("aria-rowindex",String(A+1)),ee(Z,{height:l()}),ge.rowHeaderLayout==="tree"){let L=ie(S);Z.setAttribute("aria-level",String(L.level)),L.expanded!==void 0&&Z.setAttribute("aria-expanded",String(L.expanded));}if(S.isGrandTotal){Z.classList.add("kanuni-pivot-grand-total-row");for(let L=0;L<W;L++){let $=L===0,K=Y("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(A,L),"td");K.id=i(A,L),K.setAttribute("role",$?"rowheader":"presentation"),ee(K,{position:"sticky",zIndex:40,fontWeight:"var(--pivot-font-weight-grand-total, 700)",backgroundColor:"var(--pivot-surface)",paddingLeft:$?8:0,paddingRight:0,borderRight:L===W-1?"1px solid var(--pivot-border)":"none",whiteSpace:$?"nowrap":"normal",overflow:$?"visible":"hidden"}),Te(K,`var(--row-header-left-${L}, 0px)`),$&&(K.textContent=`${B("grandTotal")}${U?` \u2014 ${de[S.dfIndex]?.caption??""}`:""}`),Z.appendChild(K);}if(U){let L=Y("kanuni-pivot-cell kanuni-pivot-cell-total"+q(A,W),"td");L.id=i(A,W),L.setAttribute("role","gridcell"),ee(L,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),Te(L,`var(--row-header-left-${W}, 0px)`),L.textContent=String(de[S.dfIndex]?.caption??""),Z.appendChild(L);}return V(Z,"",S.dfIndex,true,A),Z}let ue=S.flatRow;if(ue.isSubtotal){Z.classList.add("kanuni-pivot-subtotal-row");let L=`${B("subTotal")}: ${ue.pathValues[ue.depth]}`;if(ge.rowHeaderLayout==="tree"){let $=Y("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(A,0),"td");$.id=i(A,0),$.setAttribute("role","rowheader"),ee($,{position:"sticky",zIndex:40,fontWeight:"var(--pivot-font-weight-total, 600)",backgroundColor:"var(--pivot-surface)",paddingLeft:8+ue.depth*20}),Te($,"var(--row-header-left-0, 0px)"),$.textContent=L,Z.appendChild($);}else for(let $=0;$<W;$++){if($<ue.depth){H(Z,S,A,$);continue}let K=$===ue.depth,v=Y("kanuni-pivot-cell kanuni-pivot-row-header kanuni-pivot-cell-total"+q(A,$),"td");v.id=i(A,$),v.setAttribute("role",K?"rowheader":"presentation"),ee(v,{position:"sticky",zIndex:40,fontWeight:"var(--pivot-font-weight-total, 600)",backgroundColor:"var(--pivot-surface)",paddingLeft:K?8:0,paddingRight:0,borderRight:$===W-1?"1px solid var(--pivot-border)":"none",whiteSpace:K?"nowrap":"normal",overflow:K?"visible":"hidden"}),Te(v,`var(--row-header-left-${$}, 0px)`),K&&(v.textContent=L),Z.appendChild(v);}if(U){let $=Y("kanuni-pivot-cell kanuni-pivot-cell-total"+q(A,W),"td");$.id=i(A,W),$.setAttribute("role","gridcell"),ee($,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),Te($,`var(--row-header-left-${W}, 0px)`),$.textContent=String(de[S.dfIndex]?.caption??""),Z.appendChild($);}return V(Z,ue.key,S.dfIndex,true,A),Z}for(let L=0;L<W;L++)H(Z,S,A,L);if(U){let L=Y("kanuni-pivot-cell kanuni-pivot-row-header"+q(A,W),"td");if(L.id=i(A,W),L.setAttribute("role","rowheader"),ee(L,{position:"sticky",zIndex:40,backgroundColor:"var(--pivot-surface)"}),Te(L,`var(--row-header-left-${W}, 0px)`),S.isDataRow){let $=Y("","span");ee($,{color:"var(--pivot-text-muted)",paddingLeft:8}),$.textContent=String(de[S.dfIndex]?.caption??""),L.appendChild($);}L.appendChild(Ke(`row-${W}`,et,1,n().rtl?"left":"right")),Z.appendChild(L);}return V(Z,ue.key,S.dfIndex,false,A),Z}function re(){if(y||!f)return;let S=u();if(x(),p=S,m.textContent="",S.start>0){let A=Y("","tr");ee(A,{height:S.start*l()});let B=Y("","td");B.colSpan=f.dataColOffset+Math.max(f.totalDataCols,1),ee(B,{padding:0,border:"none"}),A.appendChild(B),m.appendChild(A);}for(let A=S.start;A<S.end;A++)m.appendChild(pe(f.virtualRows[A],A));ee(b,{height:C()+f.virtualRows.length*l()});}function fe(S){if(y)return;let A=n();A.locale!==h&&(h=A.locale,g=Ne(A.locale)),s=S.columnWidths??{},f=vt(S,{grandTotal:A.t("grandTotal"),subTotal:A.t("subTotal")}),d.setAttribute("role",f.layout.rowHeaderLayout==="tree"?"treegrid":"grid"),d.setAttribute("aria-rowcount",String(f.virtualRows.length+f.colHeaders.length+(e.chipDeps?1:0))),d.setAttribute("aria-colcount",String(f.dataColOffset+f.totalDataCols)),d.setAttribute("aria-label",A.t("pivotView"));let B=e.shared?.focused;B?d.setAttribute("aria-activedescendant",i(B.r,B.c)):d.removeAttribute("aria-activedescendant");for(let W of k)d.style.removeProperty(W);k.clear(),P();for(let[W,U]of Object.entries(s)){if(!W.startsWith("leaf-"))continue;let de=`--col-width-data-${W.slice(5)}`;d.style.setProperty(de,`${U}px`),k.add(de);}D(),I(),p={start:-1,end:-1},re();}let ye=()=>{if(y||!f)return;let S=u(),A=w.start;x(),(S.start!==p.start||S.end!==p.end||w.start!==A)&&re();};d.addEventListener("scroll",ye,{passive:true});let Ee=()=>{if(y||!f)return;P();let S=u(),A=w.start,B=w.end;x(),(S.start!==p.start||S.end!==p.end||w.start!==A||w.end!==B)&&re();},J=typeof ResizeObserver<"u"?new ResizeObserver(()=>Ee()):null;return J?.observe(d),{getVM:()=>f,getTheadHeight:C,paintStructural:fe,paintWindow:re,refreshWindow:Ee,rowHeaderLayout(){let S=[];if(f){for(let A=0;A<f.maxRowDepth;A++)S.push(o(A));f.showDataInRows&&S.push(c());}return {configured:S,viewport:f&&R(S.length)?0:d.clientWidth}},scroller:d,destroy(){y=true,J?.disconnect(),d.removeEventListener("scroll",ye),d.remove();}}}var Nn=0;function Rt(){let e=`kp${++Nn}-`;return {lastResizeTime:0,isResizing:false,focused:null,selection:null,cellId:(t,n)=>`${e}pivot-cell-${t}-${n}`}}function At(e){let{scroller:t,controller:n,getVM:a,shared:l}=e,i=o=>o?.closest?.("td[data-r][data-c]")??null;function d(o,c){let r=l.focused;l.focused={r:o,c},r&&t.querySelector(`td[id="${l.cellId(r.r,r.c)}"]`)?.classList.remove("kanuni-pivot-cell-focused"),t.querySelector(`td[id="${l.cellId(o,c)}"]`)?.classList.add("kanuni-pivot-cell-focused"),t.setAttribute("aria-activedescendant",l.cellId(o,c));}function b(o,c,r){if(!e.onCellClick)return;let x=a();if(!x)return;let u=gt(x,c,r);if(!u)return;let E={event:o,cellType:u.isTotal?"grandTotal":"data",value:u.val,rowPath:u.cell.rowPath,colPath:u.cell.colPath};e.onCellClick(e.resolveCellClick?e.resolveCellClick(E):E);}let M=o=>{let c=o.target,r=c.closest("[data-col-expand]");if(r){n.toggleColExpanded(r.getAttribute("data-col-expand")??"");return}if(c.closest(".kanuni-pivot-resize-handle"))return;let x=c.closest("[data-filter-field]");if(x){e.onFilterClick?.(o.clientX,o.clientY,x.getAttribute("data-filter-field")??"");return}let u=c.closest("th[data-header-field]");if(u){if(Date.now()-l.lastResizeTime<100)return;let I=a();if(!I)return;let H=u.getAttribute("data-header-field")??"",V=u.getAttribute("data-header-col-path")??"",q=I.rowFields.find(ie=>ie.sortBySummaryField===H&&(ie.sortBySummaryPath||"")===V);q&&n.sortField(q.id,q.sortOrder==="asc"?"desc":"asc");return}let E=i(c);if(!E)return;let R=Number(E.getAttribute("data-r")),P=Number(E.getAttribute("data-c")),D=a();if(D){if(t.focus({preventScroll:true}),d(R,P),P<D.dataColOffset){if(Date.now()-l.lastResizeTime<100)return;let I=Ze(D,R,P);I?.hasChildren&&n.toggleExpanded(I.cellHashStr);return}b(o,R,P);}},T=o=>{if(o.target.closest?.(".kanuni-pivot-resize-handle"))return;let c=i(o.target);if(!c)return;let r=Number(c.getAttribute("data-r")),x=Number(c.getAttribute("data-c")),u=a();!u||x<u.dataColOffset||b(o,r,x);},F=o=>{let c=o.target.closest?.("th[data-header-field]");if(c){o.preventDefault(),c.hasAttribute("aria-expanded")?e.onNodeContextMenu?.({x:o.clientX,y:o.clientY,path:c.getAttribute("data-header-col-path")??"",isExpanded:c.getAttribute("aria-expanded")==="true",depth:Number(c.getAttribute("data-header-depth")??0),type:"col"}):e.onHeaderContextMenu&&e.onHeaderContextMenu(o.clientX,o.clientY,c.getAttribute("data-header-field")??"",c.getAttribute("data-header-col-path")??void 0);return}let r=i(o.target);if(!r)return;let x=Number(r.getAttribute("data-r")),u=Number(r.getAttribute("data-c")),E=a();if(E){if(u<E.dataColOffset){let R=Ze(E,x,u);if(R){let{flatRow:P,hasChildren:D,cellHashStr:I,isExpanded:H,depth:V,dIdx:q}=R,ie=E.layout.rowHeaderLayout==="tree",pe=q>P.depth,re=pe?P.hasChildren:D;if(re&&e.onNodeContextMenu){o.preventDefault(),e.onNodeContextMenu({x:o.clientX,y:o.clientY,path:pe?ie?P.key:pivotgridCore.pathKey(P.pathValues.slice(0,P.depth+1)):I,isExpanded:pe?P.isExpanded:H,depth:pe?P.depth:V,type:"row"});return}if(re)return}}e.onGlobalContextMenu&&(o.preventDefault(),e.onGlobalContextMenu(o.clientX,o.clientY));}},m=e.keyboardEnabled!==false;function f(){let o=l.focused;l.focused=null,o&&t.querySelector(`td[id="${l.cellId(o.r,o.c)}"]`)?.classList.remove("kanuni-pivot-cell-focused"),t.removeAttribute("aria-activedescendant");}let g=new Set(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),h=o=>{if(o.target!==t)return;let c=a();if(!c)return;if(!l.focused){if(!g.has(o.key)||c.virtualRows.length===0)return;o.preventDefault(),d(0,0),(o.shiftKey||!(o.ctrlKey||o.metaKey))&&l.selectByKey?.(0,0,false,{r:0,c:0});return}let{r,c:x}=l.focused,u={r,c:x},E=o.ctrlKey||o.metaKey,R=c.dataColOffset+c.totalDataCols,P=e.rowHeight?.()??28,D=e.getTheadHeight?.()??c.colHeaders.length*P,I=Math.max(1,Math.ceil(((t.clientHeight||600)-D)/P));switch(o.key){case "ArrowDown":o.preventDefault(),r=Math.min(c.virtualRows.length-1,r+1);break;case "ArrowUp":o.preventDefault(),r=Math.max(0,r-1);break;case "ArrowRight":o.preventDefault(),x=Math.min(R-1,x+1);break;case "ArrowLeft":o.preventDefault(),x=Math.max(0,x-1);break;case "Home":o.preventDefault(),(o.ctrlKey||o.metaKey)&&(r=0),x=0;break;case "End":o.preventDefault(),(o.ctrlKey||o.metaKey)&&(r=c.virtualRows.length-1),x=R-1;break;case "PageDown":o.preventDefault(),r=Math.min(c.virtualRows.length-1,r+I-1);break;case "PageUp":o.preventDefault(),r=Math.max(0,r-I+1);break;case "Escape":o.preventDefault(),f();return;case " ":case "Enter":{o.preventDefault(),o.key===" "&&l.selectByKey?.(r,x,o.shiftKey,u);let q=t.querySelector(`td[id="${l.cellId(r,x)}"]`);q&&(o.key===" "?q.click():q.dispatchEvent(new MouseEvent("dblclick",{bubbles:true})));return}default:return}let H=D+r*P,V=t.clientHeight||600;H<t.scrollTop+D?(t.scrollTop=H-D,t.dispatchEvent(new Event("scroll"))):H+P>t.scrollTop+V&&(t.scrollTop=H+P-V,t.dispatchEvent(new Event("scroll"))),d(r,x),(o.shiftKey||!E)&&l.selectByKey?.(r,x,o.shiftKey,u),x>=c.dataColOffset&&p(r,x,c.dataColOffset);};function p(o,c,r){let x=t.querySelector(`td[id="${l.cellId(o,c)}"]`)??t.querySelector(`td[data-c="${c}"]`);if(!x)return;let u=t.getBoundingClientRect(),E=getComputedStyle(t).direction==="rtl",R=t.querySelector(`td[data-c="${r-1}"]`)?.getBoundingClientRect(),P=x.getBoundingClientRect(),D=E?u.right-t.clientWidth:u.left,I=E?D:R?R.right:D,H=E&&R?R.left:D+t.clientWidth,V=0;P.left<I?V=P.left-I:P.right>H&&(V=Math.min(P.right-H,P.left-I)),V!==0&&(t.scrollLeft+=V,t.dispatchEvent(new Event("scroll")));}let w=o=>{if(o.button!==0)return;let c=i(o.target);if(!c)return;let r=Number(c.getAttribute("data-r")),x=Number(c.getAttribute("data-c"));l.focused?.r===r&&l.focused.c===x||d(r,x);},s=false,k=()=>{s=true,setTimeout(()=>{s=false;},0);},y=o=>{let c=a();c&&!l.focused&&!s&&o.target===t&&c.virtualRows.length>0&&d(0,0);},C=o=>{o.relatedTarget&&t.contains(o.relatedTarget)||f();};return t.addEventListener("mousedown",k,true),t.addEventListener("pointerdown",k,true),t.addEventListener("click",M),m&&t.addEventListener("mouseup",w),t.addEventListener("dblclick",T),t.addEventListener("contextmenu",F),m?(t.addEventListener("keydown",h),t.addEventListener("focus",y),t.addEventListener("blur",C)):t.removeAttribute("tabindex"),{destroy(){t.removeEventListener("click",M),t.removeEventListener("mouseup",w),t.removeEventListener("dblclick",T),t.removeEventListener("contextmenu",F),t.removeEventListener("mousedown",k,true),t.removeEventListener("pointerdown",k,true),m&&(t.removeEventListener("keydown",h),t.removeEventListener("focus",y),t.removeEventListener("blur",C));}}}function Ht(e){let{host:t,scroller:n,shared:a}=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 i=null,d=1,b=0,M=1,T=0,F=[],m={},f=null,g=-1,h=y=>{l.style.display="block",l.style.transform=`translateX(${pivotgridCore.resizeLineX(y,t)}px)`;},p=y=>{a.isResizing&&h(y.clientX);},w=y=>{if(!a.isResizing||!i)return;l.style.display="none";let C=(y.clientX-b)/M,o=e.isRtl()?-C:C;if(i.startsWith("row-")){let c=Math.max(20,T+o);m[i]=f?pivotgridCore.invertRowHeaderWidth(f.configured,g,c,f.viewport):c;}else if(i.startsWith("leaf-")){let c=i.split("-"),r=parseInt(c[1],10),u=Math.max(d*20,T+o)/T;for(let E=0;E<d;E++)m[`leaf-${r+E}`]=Math.max(20,F[E]*u);}a.isResizing=false,a.lastResizeTime=Date.now(),i=null,document.body.style.cursor="",document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",w),e.commit({...m});},s=y=>{let C=y.target.closest?.(".kanuni-pivot-resize-handle");if(!C||(y.preventDefault(),y.stopPropagation(),i=C.getAttribute("data-resize-id"),!i))return;let o=Number(C.getAttribute("data-resize-default")||150);if(d=Number(C.getAttribute("data-resize-span")||1),b=y.clientX,M=pivotgridCore.cssZoomOf(t),m={...e.getWidths()},i.startsWith("row-"))g=parseInt(i.slice(4),10),f=e.rowHeaderLayout(),T=pivotgridCore.computeRowHeaderWidths(f.configured,f.viewport).widths[g]??m[i]??o;else if(i.startsWith("leaf-")){let c=parseInt(i.split("-")[1],10);F=[],T=0;for(let r=0;r<d;r++){let x=m[`leaf-${c+r}`]||o;F.push(x),T+=x;}}a.isResizing=true,h(y.clientX),document.body.style.cursor="col-resize",document.addEventListener("mousemove",p),document.addEventListener("mouseup",w);},k=y=>{let C=y.target.closest?.(".kanuni-pivot-resize-handle"),o=C?.getAttribute("data-resize-id");if(!C||!o||a.isResizing)return;y.preventDefault(),y.stopPropagation();let c={...e.getWidths()},r=C.closest("th,td");if(o.startsWith("row-")){let x=o.slice(4),u=pivotgridCore.measureFitWidth(Array.from(n.querySelectorAll(`td[data-c="${x}"], th[data-row-header-idx="${x}"]`)),t);if(!u)return;let E=e.rowHeaderLayout();c[o]=pivotgridCore.invertRowHeaderWidth(E.configured,parseInt(x,10),Math.max(pivotgridCore.ROW_HEADER_MIN_COL_WIDTH,u),E.viewport);}else if(o.startsWith("leaf-")){let x=Number(C.getAttribute("data-resize-span")||1),u=parseInt(o.split("-")[1],10),E=e.dataColOffset?.()??0,R=[];for(let I=0;I<x;I++){let H=Array.from(n.querySelectorAll(`td[data-c="${E+u+I}"]`));x===1&&r&&H.unshift(r);let V=pivotgridCore.measureFitWidth(H,t);R.push(V?Math.max(20,V):c[`leaf-${u+I}`]||Number(C.getAttribute("data-resize-default")||95));}let P=R.reduce((I,H)=>I+H,0),D=x>1&&r?pivotgridCore.measureFitWidth([r],t):0;D>P&&(R=R.map(I=>I*D/P)),R.forEach((I,H)=>{c[`leaf-${u+H}`]=I;});}else return;a.lastResizeTime=Date.now(),e.commit(c);};return n.addEventListener("mousedown",s),n.addEventListener("dblclick",k),{destroy(){n.removeEventListener("mousedown",s),n.removeEventListener("dblclick",k),a.isResizing&&(a.isResizing=false,document.body.style.cursor=""),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",w),l.remove();}}}function Dt(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function De(e){let t=Dt("kanuni-pivot-root kanuni-pivot-portal-container");Ot(t,e);let n=nt.get(e);return n||nt.set(e,n=new Set),n.add(t),t}var nt=new WeakMap,It=new WeakMap;function Ot(e,t){for(let i of It.get(e)??[])e.classList.remove(i);let n=Array.from(t.classList).filter(i=>i.startsWith("kanuni-pivot-")&&i!=="kanuni-pivot-root");for(let i of n)e.classList.add(i);It.set(e,n);let a=e.style.getPropertyValue("zoom");e.setAttribute("style",t.getAttribute("style")??"");for(let i of ["position","inset","z-index","width","height"])e.style.removeProperty(i);a&&e.style.setProperty("zoom",a);let l=t.getAttribute("data-theme");l?e.setAttribute("data-theme",l):e.removeAttribute("data-theme"),e.setAttribute("dir",t.getAttribute("dir")??"ltr");}function Vt(e){let t=nt.get(e);if(t)for(let n of Array.from(t)){if(!n.isConnected){t.delete(n);continue}Ot(n,e);}}function Oe(e){e.style.removeProperty("zoom");let t=pivotgridCore.cssZoomOf(e);Math.abs(t-1)>.01&&e.style.setProperty("zoom",String(1/t));}function $e(){let e=document,t=e.fullscreenElement??e.webkitFullscreenElement??null;return t||(document.querySelector(".pivot-is-fullscreen")??document.body)}function ot(e){let t=null,n=null;function a(){n?.(),n=null,t?.remove(),t=null;}function l(i){a(),t=De(e);let d=Dt("kanuni-pivot-portal-root");t.appendChild(d),$e().appendChild(t),Oe(t);let b=i(d),M=t,T=m=>{M.contains(m.target)||a();},F=m=>{m.key==="Escape"&&a();};return document.addEventListener("pointerdown",T,true),document.addEventListener("keydown",F,true),n=()=>{document.removeEventListener("pointerdown",T,true),document.removeEventListener("keydown",F,true),b?.();},d}return {openPopup:l,closePopup:a,isOpen:()=>t!==null,destroy:a}}var $t=new Map;function Bt(e,t,n,a="(Blanks)"){return pivotgridCore.formatHeaderFilterLabel(e,t,n,a)}var Re=28;function be(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var ro="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 io(){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",ro),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","1.5"),t.setAttribute("stroke-linecap","round"),e.appendChild(t),e}function Nt(e){let{portal:t}=e;function n(a,l,i){let d=e.getField(i);if(!d)return;let{t:b,rtl:M,locale:T}=e.getI18n(),F=true,m=[],f=[],g="",h=new Set,p=0,w=220,s=false,k=[];t.openPopup(y=>{let C=be("kanuni-pivot-popup pivot-animate-zoom-in"),o=pivotgridCore.popupViewport(),c=pivotgridCore.placePopup({x:a,y:l},{width:250,height:350},{margin:10,viewport:o});C.setAttribute("role","dialog"),C.setAttribute("aria-label",b("columnFilter")),C.setAttribute("data-datagrid-keyboard-scope","modal"),C.tabIndex=-1,Object.assign(C.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,o.width-20)}px`,maxHeight:`${Math.min(350,c.maxHeight)}px`,resize:"both",direction:M?"rtl":"ltr"});let r=be("kanuni-pivot-popup-header"),x=be("kanuni-pivot-popup-search");x.appendChild(io());let u=be("kanuni-pivot-popup-search-input","input");u.type="text",u.placeholder=b("search"),u.setAttribute("aria-controls","pivot-filter-options"),x.appendChild(u),r.appendChild(x);let E=be("kanuni-pivot-popup-actions"),R=be("kanuni-pivot-popup-action-btn kanuni-pivot-popup-action-btn--primary","button");R.textContent=b("selectAll");let P=be("kanuni-pivot-popup-action-btn kanuni-pivot-popup-action-btn--danger","button");P.textContent=b("clearAll"),E.append(R,P),r.appendChild(E);let D=be("kanuni-pivot-popup-list pivot-custom-scrollbar");D.id="pivot-filter-options";let I=be("");I.style.position="relative",D.appendChild(I);let H=be("kanuni-pivot-popup-footer"),V=be("kanuni-pivot-btn kanuni-pivot-btn--outline","button");V.textContent=b("cancel");let q=be("kanuni-pivot-btn kanuni-pivot-btn--primary","button");q.textContent=b("ok");for(let L of [V,q])Object.assign(L.style,{height:"28px",padding:"0 12px",fontSize:"12px"});if(H.append(V,q),e.openCondition&&(d.area==="row"||d.area==="column")){let L=be("kanuni-pivot-btn kanuni-pivot-btn--outline","button");L.type="button",L.setAttribute("data-condition-filter",""),L.title=b("conditionFilter")+"\u2026",L.setAttribute("aria-label",L.title),Object.assign(L.style,{height:"28px",padding:"0 7px",marginInlineEnd:"auto"}),(d.valueFilter||d.labelFilter)&&(L.style.color="var(--pivot-danger)"),L.appendChild(X("settings-2",14)),L.addEventListener("click",()=>{t.closePopup(),e.openCondition(d.id);}),H.prepend(L);}C.append(r,D,H),y.appendChild(C);let ie=()=>{if(!g)return f;let L=g.toLowerCase(),$=L.replace(/,/g,"."),K=L.replace(/\./g,","),v=L.replace(/[.,\s]/g,"");return f.filter(z=>{let O=z.label.toLowerCase(),G=O.replace(/[.,\s]/g,"");return O.includes(L)||O.includes($)||O.includes(K)||!!v&&G.includes(v)})},pe=()=>h.size===m.length,re=()=>!g,fe=()=>ie().length+(re()?1:0),ye=()=>fe()===0?-1:Math.min(p,fe()-1),Ee=L=>{if(re()&&L===0)return "select-all";let $=re()?L-1:L;return `value:${ie()[$]?.key}`},J=new Map;function S(){if(s)return;let L=document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains("kanuni-pivot-popup-item");if(q.disabled=!F&&m.length>0&&h.size===0,I.textContent="",J.clear(),F){I.style.height="";let G=be("pivot-flex pivot-items-center pivot-justify-center pivot-h-full"),N=be("");Object.assign(N.style,{width:"24px",height:"24px",border:"2px solid var(--pivot-border)",borderTopColor:"var(--pivot-primary)",borderRadius:"50%",animation:"spin 1s linear infinite"}),G.appendChild(N),I.appendChild(G);return}let $=ie(),K=fe();I.style.height=`${K*Re}px`;let v=Math.max(0,Math.floor(D.scrollTop/Re)-2),z=Math.min(K,v+Math.ceil(w/Re)+4),O=ye();for(let G=v;G<z;G++){let N,j,_,oe,xe,Me=false;if(re()&&G===0)N="select-all",j=`(${b("selectAll")})`,_=pe(),oe=true,xe=B;else {let ce=$[re()?G-1:G];if(!ce)continue;let le=pivotgridCore.headerFilterGroupTick(ce,h);N=`value:${ce.key}`,j=ce.label,_=le==="all",Me=le==="some",oe=false,xe=()=>W(ce);}let ae=be(`kanuni-pivot-popup-item${_?" kanuni-pivot-popup-item--checked":""}${G===O?" kanuni-pivot-popup-item--active":""}`);ae.id=N,ae.setAttribute("role","checkbox"),ae.setAttribute("aria-checked",Me?"mixed":String(_)),ae.tabIndex=0,Object.assign(ae.style,{position:"absolute",top:`${G*Re}px`,insetInlineStart:"0",insetInlineEnd:"0",height:`${Re}px`,fontWeight:oe?"600":"400"});let Q=be("kanuni-pivot-checkbox","input");Q.type="checkbox",Q.checked=_,Q.indeterminate=Me,Q.readOnly=true,Q.tabIndex=-1;let ve=be("pivot-truncate","span");ve.textContent=j,ae.append(Q,ve),ae.addEventListener("click",xe),ae.addEventListener("focus",()=>{p=G;}),I.appendChild(ae),J.set(G,ae);}if($.length===0){let G=be("");Object.assign(G.style,{padding:"12px",textAlign:"center",fontSize:"12px",color:"var(--pivot-text-muted)"}),G.textContent=b("noItems"),I.appendChild(G);}u.setAttribute("aria-activedescendant",O>=0?Ee(O):""),L&&J.get(O)?.focus();}function A(L){h=pivotgridCore.setHeaderFilterGroups(h,ie(),L),S();}function B(){A(!ie().every(L=>pivotgridCore.headerFilterGroupTick(L,h)==="all"));}function W(L){h=pivotgridCore.toggleHeaderFilterGroup(h,L),S();}function U(){if(q.disabled)return;let L=pivotgridCore.headerFilterWrite(m,h,d);L.kind==="clear"?e.clear(d.id):L.kind==="apply"&&e.apply(d.id,L.values,L.filterType),t.closePopup();}function de(L){p=Math.max(0,Math.min(fe()-1,L));let $=p*Re;$<D.scrollTop?D.scrollTop=$:$+Re>D.scrollTop+w&&(D.scrollTop=$+Re-w),S(),J.get(p)?.focus();}let ge=L=>{if(L.key==="ArrowDown"||L.key==="ArrowUp"){if(L.preventDefault(),fe()===0)return;de(ye()+(L.key==="ArrowDown"?1:-1));return}if(L.key==="Home"&&fe()>0){L.preventDefault(),de(0);return}if(L.key==="End"&&fe()>0){L.preventDefault(),de(fe()-1);return}if(L.key==="Backspace"&&L.target!==u){L.preventDefault(),u.focus(),g=g.slice(0,-1),u.value=g,p=0,S();return}if(L.key===" "||L.code==="Space"){if(L.target===u)return;L.preventDefault();let $=ye();if(fe()>0&&$>=0)if(re()&&$===0)B();else {let K=ie()[re()?$-1:$];K&&W(K);}return}if(L.key==="Enter"){L.preventDefault(),U();return}if(L.key==="Escape"){L.stopPropagation(),t.closePopup();return}L.key.length===1&&!L.ctrlKey&&!L.metaKey&&!L.altKey&&L.target!==u&&(L.preventDefault(),u.focus(),g+=L.key,u.value=g,p=0,S());},Z=L=>{ge(L),L.defaultPrevented&&L.stopPropagation();};document.addEventListener("keydown",Z,true),C.addEventListener("click",L=>L.stopPropagation()),u.addEventListener("input",()=>{g=u.value,p=0,S();}),R.addEventListener("click",B),P.addEventListener("click",()=>A(false)),V.addEventListener("click",()=>t.closePopup()),q.addEventListener("click",U),D.addEventListener("scroll",()=>{$t.set(d.id,D.scrollTop),S();});let ue=typeof ResizeObserver<"u"?new ResizeObserver(L=>{for(let $ of L)w=$.contentRect.height;}):null;return ue?.observe(D),S(),u.focus(),k.push(setTimeout(()=>{if(s)return;if(!d.dataField&&!d.isCalculated){m=[],F=false,S();return}let L=pivotgridCore.getFieldDistinctValues(d.id,e.gridId);if(L)m=L.map(K=>({rawStr:K.rawStr==="null"||K.rawStr==="undefined"?b("blanks"):K.rawStr,rawVal:K.rawVal,label:Bt(K.rawVal,d,T,b("blanks"))}));else {let K=new Map,v=e.getData();for(let O=0;O<v.length;O++){let G=pivotgridCore.extractGroupValue(v[O],d);if(G==="(Blank)"&&d.calculateSummaryExpression)continue;let N=G==null?b("blanks"):String(G);K.has(N)||K.set(N,G);}let z=Array.from(K.values());if(d.dataType==="number")z.sort((O,G)=>Number(O)-Number(G));else {let O=pivotgridCore.collatorFor().compare;z.sort((G,N)=>O(String(G),String(N)));}m=z.map(O=>({rawStr:O==null?b("blanks"):String(O),rawVal:O,label:Bt(O,d,T,b("blanks"))}));}f=pivotgridCore.groupHeaderFilterOptions(m),h=pivotgridCore.headerFilterShown(m,d),F=false,S();let $=$t.get(d.id)||0;$>0&&k.push(setTimeout(()=>{s||(D.scrollTop=$,S());},50)),k.push(setTimeout(()=>{s||u.focus();},50));},10)),()=>{s=true,document.removeEventListener("keydown",Z,true);for(let L of k)clearTimeout(L);ue?.disconnect();}});}return {open:n,close:()=>t.closePopup()}}function Ce(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Wt(e){let t=Ce("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,a=null,l=null,i=null;function d(){n=null,a?.remove(),a=null,l?.classList.remove("kanuni-pivot-footer-btn--active"),l=null;}let b=y=>{e.onGlobalContextMenu&&(y.preventDefault(),e.onGlobalContextMenu(y.clientX,y.clientY));};t.addEventListener("contextmenu",b);let M=y=>{!n||y.target?.closest?.("[data-footer-menu]")?.getAttribute("data-footer-menu")===n||d();};document.addEventListener("mousedown",M);let T=Ce("kanuni-pivot-search","input");T.type="search";let F,m=()=>{clearTimeout(F),e.onSearch?.(T.value);};T.addEventListener("input",()=>{clearTimeout(F),F=setTimeout(m,250);}),T.addEventListener("keydown",y=>{y.stopPropagation(),y.key==="Enter"?m():y.key==="Escape"&&(T.value="",m());});function f(y,C,o=false){let c=Ce(`kanuni-pivot-footer-btn${o?" kanuni-pivot-footer-btn--active":""}`,"button");return c.title=C,c.setAttribute("aria-label",C),c.type="button",c.appendChild(X(y,15)),c}let g=()=>Ce("kanuni-pivot-footer-divider");function h(y,C,o,c,r,x={}){let u=Ce("kanuni-pivot-dropdown-item pivot-flex","button");u.type="button",u.style.gap="12px",x.locked&&(u.style.opacity="0.6",u.style.cursor=x.canUpgrade?"pointer":"not-allowed",x.canUpgrade||(u.disabled=true),x.hint&&(u.title=x.hint)),u.appendChild(X(y,16,C));let E=Ce(""),R=Ce("pivot-font-medium pivot-flex pivot-items-center");if(R.style.gap="6px",R.appendChild(document.createTextNode(o)),x.locked&&x.badge){let P=Ce("","span");Object.assign(P.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)"}),P.textContent=x.badge,R.appendChild(P);}if(E.appendChild(R),c!==null){let P=Ce("pivot-text-xs pivot-text-muted");P.textContent=c,E.appendChild(P);}return u.appendChild(E),r&&u.addEventListener("click",r),u}function p(y,C=false){let o=Ce("kanuni-pivot-report-section-title");return C&&(o.style.marginTop="4px",o.style.borderTop="1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"),o.textContent=y,o}function w(){let y=Ce("kanuni-pivot-dropdown-menu pivot-animate-slide-up pivot-custom-scrollbar");return Object.assign(y.style,{bottom:"100%",left:"0",marginBottom:"4px",width:"256px",maxHeight:"384px",overflowY:"auto"}),y}function s(y){n=null,i&&k(i),e.onExport(y);}function k(y){i=y;let{t:C,locale:o}=e.getI18n(),c=e.toolbar??{},r=document.activeElement===T;if(t.textContent="",a=null,l=null,c.showSaveReport!==false&&e.mountReportMenu){let u=Ce("pivot-relative");e.mountReportMenu(u),u.childNodes.length>0&&(t.appendChild(u),t.appendChild(g()));}if(c.showFieldChooserToggle!==false){let u=f("settings",C("showFieldList"),e.fieldChooserOpen());u.addEventListener("click",e.onToggleFieldChooser),t.appendChild(u);}if(e.onOpenPrefilter){let u=f("filter",C("filterBuilder"));u.addEventListener("click",e.onOpenPrefilter),t.appendChild(u);}if(e.onToggleChart){let u=f("bar-chart",C("chartToggle"));u.addEventListener("click",e.onToggleChart),t.appendChild(u);}if(c.showCalculatedFields!==false&&e.onAddCalculatedField){let u=f("calculator",C("calculatedMeasureDesigner"));u.addEventListener("click",e.onAddCalculatedField),t.appendChild(u);}if(t.appendChild(g()),c.showExpandCollapseAll!==false){let u=f("maximize2",C("expandAll"));u.addEventListener("click",e.onExpandAll);let E=f("minimize2",C("collapseAll"));E.addEventListener("click",e.onCollapseAll),t.append(u,E);}if(c.showRefreshButton!==false&&e.onRefresh){t.appendChild(g());let u=f("refresh-cw",C("refreshData"));u.addEventListener("click",e.onRefresh),t.appendChild(u);}if(c.showFullscreenToggle!==false&&e.onToggleFullscreen){t.appendChild(g());let u=e.isFullscreen(),E=f(u?"shrink":"fullscreen",C(u?"exitFullscreen":"enterFullscreen"),u);u&&Object.assign(E.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)"}),E.addEventListener("click",e.onToggleFullscreen),t.appendChild(E);}if(t.appendChild(g()),c.showExportButton!==false){let u=Ce("pivot-relative");u.setAttribute("data-footer-menu","export");let E=f("download",C("export"),n==="export");if(E.addEventListener("click",()=>{n=n==="export"?null:"export",k(y);}),u.appendChild(E),n==="export"){let R=w(),P=H=>{let V=!e.advancedExport;return {locked:V,canUpgrade:V&&!!e.upgradeUrl,badge:C("enterpriseBadge"),hint:V&&e.upgradeUrl?C("enterpriseUpgradeHint"):void 0}},D=(H,V)=>{if(!(!e.advancedExport))return ()=>s(H);if(e.upgradeUrl)return ()=>{n=null,k(y),window.open(e.upgradeUrl,"_blank","noopener,noreferrer");}},I=e.registry?.getPluginsByType("exporter")??[];if(I.length>0){R.appendChild(p(C("customExports")));for(let H of I)R.appendChild(h("database","var(--pivot-primary)",`${H.id.replace("exporter-","").toUpperCase()} ${C("export")}`,C("customPlugin"),()=>s(H.id)));R.appendChild(Ce("kanuni-pivot-dropdown-divider"));}R.appendChild(p(C("excelExport"))),R.appendChild(h("file-spreadsheet","var(--pivot-success)",C("pivotView"),C("preservesGridLayout"),D("excel-pivot"),P())),R.appendChild(h("file-spreadsheet","var(--pivot-success)",C("listView"),C("rawFlatData"),D("excel-list"),P())),R.appendChild(p(C("document"),true)),R.appendChild(h("file-text","var(--pivot-danger)",C("pdfDocument"),C("printReadyLayout"),D("pdf"),P())),R.appendChild(h("printer","var(--pivot-info)",C("print"),C("sendToPrinter"),()=>s("print"))),R.appendChild(h("copy","var(--pivot-primary)",C("copyToClipboard"),C("tabSeparatedValues"),()=>s("clipboard"))),R.appendChild(h("file-json","var(--pivot-success)",C("fullSnapshot"),C("saveSessionState"),()=>s("json-snapshot"))),R.appendChild(p(C("rawDataFormats"),true)),R.appendChild(h("file","var(--pivot-info)","CSV",null,()=>s("csv"))),R.appendChild(h("file-json","var(--pivot-warning)","JSON (Tree)",null,()=>s("json-pivot"))),R.appendChild(h("file-json","var(--pivot-warning)","JSON (List)",null,()=>s("json"))),R.appendChild(h("database","var(--pivot-text-muted)","XML",null,()=>s("xml"))),u.appendChild(R),a=R,l=E;}t.appendChild(u);}if(e.onSearch){let u=C("search").replace(/[.\u2026]+$/,"");T.placeholder=C("search"),T.setAttribute("aria-label",u),t.appendChild(g()),t.appendChild(T),r&&T.focus();}let x=y.selectionStats;if(x){let u=new Intl.NumberFormat(o,{minimumFractionDigits:2,maximumFractionDigits:2}),E=Ce("kanuni-pivot-selection-stats pivot-text-muted pivot-font-medium pivot-flex pivot-items-center");Object.assign(E.style,{marginLeft:"auto",fontSize:"11px",gap:"8px",paddingRight:"8px",userSelect:"none"});let R=[[C("count"),String(x.count)],[C("sum"),u.format(x.sum)],[C("avg"),u.format(x.avg)],[C("min"),u.format(x.min)],[C("max"),u.format(x.max)]];for(let[P,D]of R){let I=Ce("","span");I.textContent=`(${P}: ${D})`,E.appendChild(I);}t.appendChild(E);}}return {element:t,paint:k,syncSearch(y){document.activeElement!==T&&(T.value=y);},destroy(){clearTimeout(F),t.removeEventListener("contextmenu",b),document.removeEventListener("mousedown",M),t.remove();}}}var Gt=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"];function jt(e,t){let n=false,a=()=>{let M=document;return M.fullscreenElement??M.webkitFullscreenElement??M.mozFullScreenElement??M.msFullscreenElement??null},l=()=>n||a()===e;function i(M){if(n=M,e.classList.toggle("pivot-is-fullscreen",M),M)Object.assign(e.style,{position:"fixed",inset:"0",zIndex:"9990",width:"auto",height:"auto"});else for(let T of ["position","inset","z-index","width","height"])e.style.removeProperty(T);}let d=()=>{let M=l();e.classList.toggle("pivot-is-fullscreen",a()===e||n),t(M);};for(let M of Gt)document.addEventListener(M,d);function b(){let M=document;if(l()){if(n){i(false),t(false);return}M.exitFullscreen?M.exitFullscreen():M.webkitExitFullscreen?M.webkitExitFullscreen():M.mozCancelFullScreen?M.mozCancelFullScreen():M.msExitFullscreen?M.msExitFullscreen():t(false);return}let T=e;T.requestFullscreen?T.requestFullscreen().then(()=>{e.classList.add("pivot-is-fullscreen");},()=>{i(true),t(true);}):T.webkitRequestFullscreen?T.webkitRequestFullscreen():T.mozRequestFullScreen?T.mozRequestFullScreen():T.msRequestFullscreen?T.msRequestFullscreen():(i(true),t(true));}return {isFullscreen:l,toggle:b,destroy(){for(let M of Gt)document.removeEventListener(M,d);n&&i(false);}}}var rt=["row","column","data","filter","chooser"];function qt(e){let t={activeId:null,targetId:null,targetArea:null,intent:null};function n(r,x,u){t.targetId===r&&t.targetArea===x&&t.intent===u||(t.targetId=r,t.targetArea=x,t.intent=u,e.controller.setDragIntent(r,x,u),e.onIntentChange({...t}));}let a=null,l=null,i=null,d=null;function b(r,x,u){i=De(e.gridRoot),i.style.pointerEvents="none",d=document.createElement("div"),d.className="kanuni-pivot-drag-overlay pivot-flex pivot-items-center pivot-gap-2 pivot-font-semibold pivot-truncate",Object.assign(d.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 E=document.createElement("span");E.className="pivot-truncate",Object.assign(E.style,{maxWidth:"150px",color:"var(--pivot-text)"});let R=e.getFields().find(P=>P.id===r);E.textContent=R?.caption||R?.id||"Field",d.appendChild(E),i.appendChild(d),document.body.appendChild(i),Oe(i),M(x,u);}function M(r,x){d&&(d.style.transform=`translate3d(${r+6}px, ${x+6}px, 0) scale(1.05)`);}function T(){i?.remove(),i=null,d=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 F(r){let x=l;if(T(),l=null,a?.holdTimer&&clearTimeout(a.holdTimer),a=null,document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",k),document.removeEventListener("keydown",y,true),!x)return;let u=t.activeId??x.dropId.replace("chooser-","");t.activeId=null,t.targetId=null,t.targetArea=null,t.intent=null,e.onIntentChange({...t}),r===null?e.controller.resetDrag():e.controller.commitDrag(u,r);}function m(){if(!a)return;let{el:r,dropId:x,pointerId:u,startX:E,startY:R}=a;l={el:r,dropId:x,pointerId:u,startX:E,startY:R},a=null;let P=x.replace("chooser-","");t.activeId=P,e.controller.setDragActive(P),r.classList.add("is-dragging"),r.style.pointerEvents="none",r.style.cursor="grabbing",b(P,E,R),window.getSelection?.()?.removeAllRanges?.(),document.body.style.userSelect="none",e.onIntentChange({...t});}function f(r,x){let u=null,E=null,R=null,P=typeof document.elementFromPoint=="function"?document.elementFromPoint(r,x):null;for(let D of e.roots())for(let I of D.querySelectorAll("[data-drop-id]")){if(l&&I===l.el||P&&!I.contains(P)||I.classList.contains("kanuni-pivot-field-chip")&&I.closest('[data-drop-id="chooser-chooser"]'))continue;let H=I.getBoundingClientRect();if(H.width===0&&H.height===0||r<H.left||r>H.right||x<H.top||x>H.bottom)continue;let V=I.getAttribute("data-drop-id"),q=V.replace("chooser-","");if(q.endsWith("-ghost-end"))E={id:V,el:I};else if(rt.includes(q))R=R??{id:V,el:I};else {let ie=H.width*H.height;(!u||ie<u.size)&&(u={id:V,el:I,size:ie});}}return u??E??R}function g(r,x){let u=f(r,x);if(!u)return n(null,null,null),{overId:null};let E=u.id.replace("chooser-",""),R=e.getFields().find(I=>I.id===E),P=rt.includes(E)||E.endsWith("-ghost-end")?E.replace("-ghost-end",""):R?.area,D=!!(t.activeId&&P&&e.controller.canMoveFieldTo&&!e.controller.canMoveFieldTo(t.activeId,P));if(d?.classList.toggle("is-drop-denied",D),d&&(d.style.borderColor=D?"var(--pivot-danger)":"var(--pivot-primary)"),D)return n(null,null,null),{overId:null};if(rt.includes(E)||E.endsWith("-ghost-end"))return n(null,P,"append"),{overId:u.id};if(R){let I=R.area==="chooser"?"vertical":"horizontal",H=u.el.getBoundingClientRect(),V=e.controller.calculateDropIntent(r,x,{top:H.top,left:H.left,width:H.width,height:H.height},t.intent,false,I);return n(E,R.area??null,V),{overId:u.id}}return {overId:u.id}}let h=null,p=r=>{if(!(a&&r.pointerId!==a.pointerId)&&!(l&&r.pointerId!==l.pointerId)){if(a){let x=r.clientX-a.startX,u=r.clientY-a.startY,E=Math.hypot(x,u);if(a.isTouch){if(!a.held&&E>8){a.holdTimer&&clearTimeout(a.holdTimer),a=null;return}if(!a.held)return}else if(E<8)return;m();}l&&(r.preventDefault(),M(r.clientX,r.clientY),h=g(r.clientX,r.clientY).overId);}},w=r=>{if(!(a&&r.pointerId!==a.pointerId)&&!(l&&r.pointerId!==l.pointerId)){if(a){a.holdTimer&&clearTimeout(a.holdTimer),a=null,document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",k),document.removeEventListener("keydown",y,true);return}l&&F(g(r.clientX,r.clientY).overId??h);}},s=r=>{(l||a?.held)&&r.cancelable&&r.preventDefault();},k=()=>F(null),y=r=>{r.key==="Escape"&&l&&(r.stopPropagation(),F(null));},C=r=>{if(e.disabled?.()||a||l||r.button!==0&&r.pointerType==="mouse")return;let x=r.target;if(x.closest("button, input, .kanuni-pivot-chip-btn"))return;let u=x.closest(".kanuni-pivot-field-chip[data-drop-id]");if(!u||u.getAttribute("data-drag-scope")==="grip"&&!x.closest("[data-drag-grip]"))return;let E=u.getAttribute("data-drop-id"),R=r.pointerType==="touch";a={el:u,dropId:E,pointerId:r.pointerId,startX:r.clientX,startY:r.clientY,isTouch:R,held:false,holdTimer:R?setTimeout(()=>{a&&(a.held=true,m());},Math.max(0,e.touchDragDelay?.()??200)):null},document.addEventListener("pointermove",p),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",k),document.addEventListener("keydown",y,true);},o=new Set;function c(){for(let r of o)r.isConnected||(r.removeEventListener("pointerdown",C),o.delete(r));for(let r of e.roots())o.has(r)||(o.add(r),r.addEventListener("pointerdown",C));}return c(),document.addEventListener("touchmove",s,{passive:false}),{getState:()=>({...t}),refreshRoots:c,rootCount:()=>o.size,destroy(){l&&F(null),a?.holdTimer&&clearTimeout(a.holdTimer),a=null;for(let r of o)r.removeEventListener("pointerdown",C);o.clear(),document.removeEventListener("touchmove",s),document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",k),document.removeEventListener("keydown",y,true);}}}function me(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Kt(e){let{portal:t}=e;function n(m,f,g,h=false){let p=me(`${h?"kanuni-pivot-dropdown-item-danger":"kanuni-pivot-dropdown-item"} pivot-flex pivot-items-center`,"button");return p.type="button",m&&p.appendChild(X(m,16)),p.appendChild(document.createTextNode(" "+f)),p.addEventListener("click",()=>{t.closePopup(),g();}),p}function a(m,f,g){let h=()=>window.visualViewport?.removeEventListener("resize",p),p=()=>{if(!m.isConnected){h();return}let w=m.offsetWidth,s=m.scrollHeight||m.offsetHeight;if(w===0&&s===0)return;let k=pivotgridCore.placePopup({x:f,y:g},{width:w,height:s});m.style.top=`${k.top}px`,m.style.left=`${k.left}px`,m.style.maxHeight=`${k.maxHeight}px`;};return p(),window.visualViewport?.addEventListener("resize",p),h}let l=null;function i(m,f,g){let h=null,p=null,w=()=>{h?.remove(),h=null,l===w&&(l=null);},s=()=>{if(h)return;l&&l(),l=w,h=me("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");let o=m.getBoundingClientRect(),c=pivotgridCore.placePopup({x:o.right+4,y:o.top},{width:160,height:0},{altX:o.left-4});if(Object.assign(h.style,{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,minWidth:"160px",zIndex:"10000"}),h.addEventListener("contextmenu",r=>r.preventDefault()),h.addEventListener("mouseenter",()=>{p&&clearTimeout(p);}),h.addEventListener("mouseleave",()=>{p=setTimeout(w,200);}),g(h),f.appendChild(h),h.offsetHeight){let r=pivotgridCore.placePopup({x:o.right+4,y:o.top},{width:h.offsetWidth,height:h.scrollHeight},{altX:o.left-4});Object.assign(h.style,{top:`${r.top}px`,left:`${r.left}px`,maxHeight:`${r.maxHeight}px`,overflowY:"auto"});}},k=0,y=false,C=()=>Date.now()-k<1e3;m.addEventListener("pointerdown",o=>{o.pointerType!=="mouse"&&(k=Date.now());}),m.addEventListener("mouseenter",()=>{p&&clearTimeout(p),!C()&&(h||(y=true),s());}),m.addEventListener("mouseleave",()=>{C()||(p=setTimeout(w,200));}),m.addEventListener("click",o=>{if(o.detail>0&&y&&h){y=false;return}y=false,h?w():s();});}function d(m,f,g){let h=me("kanuni-pivot-dropdown-item pivot-flex pivot-items-center pivot-justify-between","button");h.type="button";let p=me("pivot-flex pivot-items-center pivot-gap-2","span");return p.appendChild(X(m,16)),p.appendChild(document.createTextNode(" "+f)),h.appendChild(p),h.appendChild(X(g?"chevron-left":"chevron-right",14)),h}function b(m){m.addEventListener("keydown",f=>{let g=[...m.querySelectorAll("button:not([disabled])")];if(g.length===0)return;let h=g.indexOf(document.activeElement),p=-1;f.key==="ArrowDown"?p=h<0?0:(h+1)%g.length:f.key==="ArrowUp"?p=h<0?g.length-1:(h-1+g.length)%g.length:f.key==="Home"?p=0:f.key==="End"&&(p=g.length-1),!(p<0)&&(f.preventDefault(),g[p].focus());});}function M(m,f,g,h,p){let w=e.getFields().find(o=>o.id===g);if(!w)return;let{t:s,rtl:k}=e.getI18n(),y=e.getFields().filter(o=>o.area==="row").sort((o,c)=>(o.areaIndex||0)-(c.areaIndex||0)),C=h!==void 0&&y.length>0&&w.area==="data";t.openPopup(o=>{let c=me("kanuni-pivot-dropdown-menu pivot-animate-zoom-in pivot-flex-col");Object.assign(c.style,{position:"fixed",top:`${f}px`,left:`${m}px`,maxHeight:`${Math.max(0,pivotgridCore.popupViewport().height-16)}px`,overflowY:"auto",overflowX:"hidden",width:"220px",zIndex:"9999"}),c.addEventListener("contextmenu",u=>u.preventDefault());let r=me("kanuni-pivot-report-section-title");if(Object.assign(r.style,{position:"sticky",top:"0",zIndex:"10"}),r.textContent=w.caption??w.id,c.appendChild(r),C){let u=me("kanuni-pivot-report-section-title");u.style.marginTop="4px",u.textContent=s("sortByThisColumn"),c.appendChild(u);for(let E of y)c.appendChild(n("arrow-down-a-z",s("sortFieldByThisColumn").replace("{0}",E.caption||E.id),()=>e.controller.sortFieldBySummary(E.id,w.id,h)));c.appendChild(me("kanuni-pivot-divider")),c.appendChild(n("x",s("removeAllSorting"),()=>e.controller.clearAllSorting(),true));}else {c.appendChild(n("arrow-down-a-z",s("sortAsc"),()=>e.controller.sortField(w.id,"asc"))),c.appendChild(n("arrow-up-z-a",s("sortDesc"),()=>e.controller.sortField(w.id,"desc"))),w.sortOrder&&c.appendChild(n("x",s("clearSort"),()=>e.controller.sortField(w.id,void 0),true)),e.openFilter&&w.area!=="data"&&c.appendChild(n("filter",s("filterField"),()=>e.openFilter(w.id,m,f))),e.openCondition&&(w.area==="row"||w.area==="column")&&c.appendChild(n("filter",s("conditionFilter")+"\u2026",()=>e.openCondition(w.id))),c.appendChild(me("kanuni-pivot-divider"));let u=d("list",s("order"),k);c.appendChild(u),i(u,o,P=>{let D=[["start",s("moveToStart"),"chevrons-left"],["left",s("moveToLeft"),"chevron-left"],["right",s("moveToRight"),"chevron-right"],["end",s("moveToEnd"),"chevrons-right"]];for(let[I,H,V]of D)P.appendChild(n(V,H,()=>e.controller.moveField(w.id,I)));});let E=[["row",s("rowArea"),"rows-3"],["column",s("columnArea"),"columns-3"],["data",s("dataArea"),"bar-chart-3"],["filter",s("filterArea"),"filter"]].filter(([P])=>P!==w.area);if(E.length>0){let P=d("move",s("moveToArea"),k);c.appendChild(P),i(P,o,D=>{for(let[I,H,V]of E){let q=n(V,H,()=>e.controller.changeFieldArea(w.id,I));e.controller.canMoveFieldTo(w.id,I)||(q.disabled=true),D.appendChild(q);}});}e.openFieldChooser&&c.appendChild(n("list",s("showFieldList"),e.openFieldChooser)),c.appendChild(n("eye-off",s("hide"),()=>e.controller.removeField(w.id)));let R=e.customContextMenuItems?.(w);if(R&&R.length>0){c.appendChild(me("kanuni-pivot-divider"));for(let P of R){let D=n(null,P.label,P.action);P.icon&&D.insertBefore(P.icon(),D.firstChild),c.appendChild(D);}}c.appendChild(me("kanuni-pivot-divider")),w.isCalculated&&e.onEditCalculatedField&&c.appendChild(n("calculator",s("editCalculation"),()=>e.onEditCalculatedField(w))),c.appendChild(n("settings",s("fieldSettings"),()=>e.openSettings(w.id)));}o.appendChild(c);let x=a(c,m,f);return p?(b(o),c.querySelector("button")?.focus(),()=>{x(),e.gridRoot?.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${g}"]`)?.focus({preventScroll:true});}):x});}function T(m,f){let{t:g}=e.getI18n();t.openPopup(h=>{let p=me("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");Object.assign(p.style,{position:"fixed",zIndex:"301",width:"224px",fontSize:"14px",left:`${m}px`,top:`${f}px`}),p.addEventListener("contextmenu",y=>y.preventDefault());let w=me("kanuni-pivot-report-section-title");w.textContent=g("viewOptions"),p.appendChild(w);let s=e.getLayout(),k=(y,C,o)=>{let c=me("pivot-w-full pivot-flex pivot-items-center pivot-justify-between","button");c.type="button",Object.assign(c.style,{padding:"6px 12px",textAlign:"left"}),c.addEventListener("mouseenter",()=>{c.style.backgroundColor="var(--pivot-surface-hover)";}),c.addEventListener("mouseleave",()=>{c.style.backgroundColor="transparent";});let r=me("","span");r.textContent=y;let x=me("pivot-text-xs pivot-text-muted pivot-font-medium","span");return x.textContent=g(C?"show":"hide"),c.append(r,x),c.addEventListener("click",()=>{o(),t.closePopup();}),c};return p.appendChild(k(g("filterArea"),s.showFilterArea===false,()=>e.controller.setLayout({showFilterArea:s.showFilterArea===false}))),p.appendChild(k(g("footerArea"),s.showFooter===false,()=>e.controller.setLayout({showFooter:s.showFooter===false}))),h.appendChild(p),a(p,m,f)});}function F(m){let{t:f}=e.getI18n(),g=()=>{let h=e.getEngineTrees();if(!h)return [];let p=[],w=(s,k)=>{if(s)for(let y of s)k>=m.depth&&p.push(y.key),y.children&&w(y.children,k+1);};return w(m.type==="row"?h.rowTree:h.colTree,0),p};t.openPopup(h=>{let p=me("");Object.assign(p.style,{position:"fixed",inset:"0",zIndex:"9998"}),p.addEventListener("click",()=>t.closePopup()),p.addEventListener("contextmenu",k=>{k.preventDefault(),t.closePopup();});let w=me("kanuni-pivot-dropdown-menu pivot-animate-zoom-in");Object.assign(w.style,{position:"fixed",left:`${m.x}px`,top:`${m.y}px`,zIndex:"9999",minWidth:"160px"}),w.addEventListener("contextmenu",k=>k.preventDefault());let s=(k,y)=>{let C=me("kanuni-pivot-dropdown-item pivot-state-hover","button");return C.type="button",Object.assign(C.style,{paddingLeft:"32px",paddingRight:"24px"}),C.textContent=k,C.addEventListener("click",o=>{o.stopPropagation(),t.closePopup(),y();}),C};return w.appendChild(s(m.isExpanded?f("collapse"):f("expand"),()=>{m.type==="row"?e.controller.toggleExpanded(m.path):e.controller.toggleColExpanded(m.path);})),w.appendChild(me("kanuni-pivot-dropdown-divider")),w.appendChild(s(f("expandAll"),()=>{let k=g();m.type==="row"?e.controller.expandPaths(k):e.controller.expandColPaths(k);})),w.appendChild(s(f("collapseAll"),()=>{let k=g();m.type==="row"?e.controller.collapsePaths(k):e.controller.collapseColPaths(k);})),h.append(p,w),a(w,m.x,m.y)});}return {openFieldMenu:M,openGlobalMenu:T,openNodeMenu:F,close:()=>t.closePopup()}}function we(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var Ae=(e,...t)=>{let n=we("kanuni-pivot-form-group"),a=we("kanuni-pivot-form-label","label");return a.textContent=e,n.append(a,...t),n},Fe=(e,t)=>{let n=we("kanuni-pivot-select","select");for(let[a,l]of e){let i=document.createElement("option");i.value=a,i.textContent=l,n.appendChild(i);}return n.value=t,n},_e=(e,t)=>{let n=we("kanuni-pivot-input","input");return n.type=e,n.value=t,n},_t=(...e)=>{let t=we("");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},lo=[["equals","opEquals"],["notEquals","opNotEquals"],["contains","opContains"],["notContains","opNotContains"],["startsWith","opStartsWith"],["endsWith","opEndsWith"]],so=[[">","opGreater"],[">=","opGreaterOrEqual"],["<","opLess"],["<=","opLessOrEqual"],["=","opEquals"],["!=","opNotEquals"],["between","opBetween"],["notBetween","opNotBetween"]];function Xt(e){function t(l,i,d,b){let{t:M}=e.getI18n();e.portal.openPopup(T=>{let F=we("kanuni-pivot-modal-overlay pivot-animate-fade-in");F.addEventListener("click",()=>e.portal.closePopup());let m=we("kanuni-pivot-modal pivot-animate-zoom-in");m.style.width="400px",m.setAttribute("role","dialog"),m.setAttribute("aria-modal","true"),m.setAttribute("aria-label",l);let f=we("kanuni-pivot-modal-header"),g=we("kanuni-pivot-modal-title","h2");g.textContent=l;let h=we("kanuni-pivot-modal-close","button");h.type="button",h.setAttribute("aria-label",M("cancel")),h.appendChild(X("x",20)),h.addEventListener("click",()=>e.portal.closePopup()),f.append(g,h);let p=we("kanuni-pivot-modal-footer"),w=we("kanuni-pivot-btn kanuni-pivot-btn--outline","button");w.type="button",w.textContent=M("cancel"),w.addEventListener("click",()=>e.portal.closePopup());let s=we("kanuni-pivot-btn kanuni-pivot-btn--primary","button");s.type="button",s.appendChild(X("check",16)),s.appendChild(document.createTextNode(" "+M("ok"))),s.addEventListener("click",()=>{d()!==false&&e.portal.closePopup();}),p.append(w,s),m.append(f,i,p),T.append(F,m),b.focus();});}function n(l){let i=e.getFields().find(w=>w.id===l);if(!i)return;let{t:d}=e.getI18n(),b=we("kanuni-pivot-modal-body pivot-custom-scrollbar"),M=_e("text",i.caption??"");b.appendChild(Ae(d("caption"),M));let T=i.area==="data"||i.area==="chooser",F=i.area==="row"||i.area==="column"||i.area==="filter"||i.area==="chooser",m=null,f=null,g=null,h=(...w)=>w.map(s=>[s,d(s)]),p=(...w)=>{let s=i.summaryType;return h(...s&&!w.includes(s)?[s,...w]:w)};T&&i.dataType&&i.dataType!=="number"&&(m=Fe(p("count","distinct"),String(i.summaryType||"count")),b.appendChild(Ae(d("summaryType"),m))),T&&i.dataType==="number"&&(m=Fe(p("sum","count","avg","min","max","distinct"),String(i.summaryType||"sum")),b.appendChild(Ae(d("summaryType"),m)),f=Fe([["absolute",d("absoluteValue")],...h("percentOfTotal","percentOfColumnTotal","percentOfRowTotal","percentOfParentRowTotal","percentOfParentColumnTotal","runningTotal","difference","percentDifference")],String(i.summaryDisplayMode||"absolute")),b.appendChild(Ae(d("displayMode"),f))),F&&i.dataType==="date"&&(g=Fe([["",d("none")],...h("year","quarter","month","week","day")],String(i.groupInterval||"")),b.appendChild(Ae(d("groupInterval"),g))),t(d("fieldSettings"),b,()=>{e.save({...i,caption:M.value,summaryType:m?.value||i.summaryType,summaryDisplayMode:f?.value??i.summaryDisplayMode,groupInterval:g?g.value||void 0:i.groupInterval});},M);}function a(l){let i=e.getFields(),d=i.find(o=>o.id===l);if(!d)return;let{t:b}=e.getI18n(),M=we("kanuni-pivot-modal-body pivot-custom-scrollbar"),T=o=>[["",b("none")],...o.map(([c,r])=>[c,b(r)])],F=d.labelFilter,m=Fe(T(lo),F?.operator??"");m.setAttribute("data-condition-label-op",""),m.setAttribute("aria-label",b("caption"));let f=_e("text",F?.value??"");f.setAttribute("data-condition-label-value",""),f.placeholder=b("builderValuePlaceholder"),f.setAttribute("aria-label",b("builderValuePlaceholder")),M.appendChild(Ae(b("caption"),_t(m,f)));let g=i.filter(o=>o.area==="data").sort((o,c)=>(o.areaIndex||0)-(c.areaIndex||0)),h=d.valueFilter,p=Fe(g.map(o=>[o.id,o.caption||o.id]),g.some(o=>o.id===h?.dataField)?h.dataField:g[0]?.id??"");p.setAttribute("data-condition-value-field",""),p.setAttribute("aria-label",b("dataArea"));let w=Fe(T(so),h?.operator??"");w.setAttribute("data-condition-value-op",""),w.setAttribute("aria-label",b("dataArea"));let s=_e("number",h?String(h.value):"");s.setAttribute("data-condition-value","");let k=_e("number",h?.value2!==void 0?String(h.value2):"");k.setAttribute("data-condition-value2","");for(let o of [s,k])o.setAttribute("aria-label",b("builderValuePlaceholder"));g.length>0&&M.appendChild(Ae(b("dataArea"),p,_t(w,s,k)));let y=()=>{f.disabled=m.value==="",s.disabled=w.value==="",k.style.display=w.value==="between"||w.value==="notBetween"?"":"none";};m.addEventListener("change",y),w.addEventListener("change",y),y();let C=o=>(o.setAttribute("aria-invalid","true"),o.focus(),false);t(`${b("conditionFilter")}: ${d.caption||d.id}`,M,()=>{for(let r of [f,s,k])r.removeAttribute("aria-invalid");let o;if(m.value){if(f.value==="")return C(f);o={operator:m.value,value:f.value,...F?.caseSensitive?{caseSensitive:true}:{}};}let c=g.length>0?void 0:h;if(w.value&&g.length>0){let r=k.style.display!=="none",x=s.value===""?NaN:Number(s.value),u=k.value===""?NaN:Number(k.value);if(!Number.isFinite(x))return C(s);if(r&&!Number.isFinite(u))return C(k);c={dataField:p.value,operator:w.value,value:x,...r?{value2:u}:{}};}e.save({...d,labelFilter:o,valueFilter:c});},m);}return {open:n,openCondition:a}}function te(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function po(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 Ut(e){let t=null,n=null,a=null,l="",i={x:0,y:0},d={width:700,height:550},b=()=>window.innerWidth<=768,M=["fullscreenchange","webkitfullscreenchange"],T=()=>{if(!t)return;let o=$e();t.parentElement!==o&&o.appendChild(t);},F=()=>{n&&(m(),b()||(i={x:Math.min(i.x,Math.max(0,window.innerWidth-d.width)),y:Math.min(i.y,Math.max(0,window.innerHeight-d.height))},m()));};function m(){n&&(b()?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:`${i.x}px`,top:`${i.y}px`,width:`${d.width}px`,height:`${d.height}px`,maxWidth:"95vw",maxHeight:"95vh",transform:"none",padding:"0",zIndex:"100",boxShadow:"var(--pivot-shadow-lg)",borderRadius:""}));}function f(o,c){let{t:r}=e.getI18n(),x=te("kanuni-pivot-field-chip");x.setAttribute("data-drop-id",`chooser-${o.id}`),x.setAttribute("data-drag-scope","grip"),x.style.position="relative";let u=te("");if(u.setAttribute("data-drag-grip",""),Object.assign(u.style,{color:"var(--pivot-text-muted)",cursor:"grab",flexShrink:"0",opacity:"0.5"}),u.appendChild(X("grip-vertical",14)),x.appendChild(u),c){let H=te("kanuni-pivot-checkbox","input");H.type="checkbox",H.checked=o.area!=="chooser",H.style.flexShrink="0",H.addEventListener("change",()=>{H.checked?e.controller.showFields([o.id]):e.controller.removeField(o.id);}),x.appendChild(H);}x.appendChild(po(o));let E=te("pivot-truncate","span");Object.assign(E.style,{flex:"1",color:"var(--pivot-text)",textAlign:"left"}),E.textContent=o.caption??o.id;let R=o.area==="data"&&o.summaryType?pivotgridCore.summaryTypeLabel(String(o.summaryType),r):"";if(R){let H=te("","span");Object.assign(H.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"}),H.textContent=R,E.appendChild(H);}x.appendChild(E);let P=!!o.filterValues&&o.filterValues.size>0,D=te(`kanuni-pivot-field-chip-actions${P?" is-filtered":""}`);if(o.area!=="data"){let H=te("kanuni-pivot-chip-btn","button");H.type="button",H.title=r("filterField"),P&&Object.assign(H.style,{color:"var(--pivot-danger)",backgroundColor:"color-mix(in srgb, var(--pivot-danger) 10%, transparent)"}),H.appendChild(X("filter",12)),H.addEventListener("click",V=>{V.stopPropagation(),e.onFilterClick(V.clientX,V.clientY,o.id);}),D.appendChild(H);}if(o.isCalculated){let H=te("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","button");H.type="button",H.title=r("deletePermanently"),H.appendChild(X("trash",12)),H.addEventListener("click",V=>{V.stopPropagation(),e.controller.deleteField(o.id);}),D.appendChild(H);}let I=te("kanuni-pivot-chip-btn kanuni-pivot-chip-btn--danger","button");return I.type="button",I.title=r("removeFromArea"),I.appendChild(X("x",12)),I.addEventListener("click",H=>{H.stopPropagation(),e.controller.removeField(o.id);}),D.appendChild(I),x.appendChild(D),x}function g(o,c,r,x,u){let E=te("");if(Object.assign(E.style,{height:"100%",display:"flex",flexDirection:"column",transition:"background-color 0.2s"}),r!==null){let D=te("");Object.assign(D.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)"}),D.textContent=r,E.appendChild(D);}let R=te("pivot-custom-scrollbar");if(R.setAttribute("data-drop-id",`chooser-${o}`),R.setAttribute("data-drop-kind","list"),Object.assign(R.style,{maxHeight:b()?"none":"100%",flex:"1",padding:"8px",minHeight:"80px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"6px",alignItems:c.length===0?"center":"stretch",justifyContent:c.length===0?"center":"flex-start"}),c.length===0){let D=te("");Object.assign(D.style,{fontSize:"12px",color:"color-mix(in srgb, var(--pivot-text-muted) 70%, transparent)",fontStyle:"italic",textAlign:"center",width:"100%"}),D.textContent=x,R.appendChild(D);}for(let D of c)R.appendChild(f(D,u));let P=te("");return P.setAttribute("data-drop-id",`chooser-${o}-ghost-end`),P.setAttribute("data-ghost-populated",c.length>0?"1":"0"),Object.assign(P.style,{width:"100%",minHeight:"24px",transition:"background-color 0.2s",borderRadius:"var(--pivot-border-radius-sm)"}),R.appendChild(P),E.appendChild(R),E}function h(){let o=new Map;return e.getFields().map(c=>{let r=c.caption||c.id||"";if(o.has(r)){let x=o.get(r)+1;return o.set(r,x),{...c,caption:`${r} (${x})`}}return o.set(r,1),c})}function p(){let{locale:o}=e.getI18n(),c=[...h()].sort((x,u)=>(x.caption||"").toLowerCase().localeCompare((u.caption||"").toLowerCase(),o||"en"));if(!l)return c;let r=l.toLowerCase();return c.filter(x=>(x.caption||"").toLowerCase().includes(r))}function w(){let o=p().filter(c=>c.area==="chooser").map(c=>c.id);o.length!==0&&e.controller.showFields(o);}function s(){if(!a)return;let{t:o,locale:c}=e.getI18n(),r=new Map;for(let J of a.querySelectorAll('[data-drop-kind="list"]')){let S=J.getAttribute("data-drop-id");S&&J.scrollTop>0&&r.set(S,J.scrollTop);}let x=h(),u=p(),E=J=>x.filter(S=>S.area===J).sort((S,A)=>(S.areaIndex||0)-(A.areaIndex||0));a.textContent="";let R=b(),P=te(R?"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");R&&(P.style.flexShrink="0");let D=te("p-3 border-b border-border/60 bg-surface/80"),I=te("relative"),H=X("search",16);H.setAttribute("class","text-muted-fg opacity-60"),Object.assign(H.style,{position:"absolute",top:"50%",transform:"translateY(-50%)",pointerEvents:"none"}),H.style.setProperty("inset-inline-start","10px");let V=te("w-full bg-surface-hover/50 border-border rounded-md text-[13px] kanuni-pivot-input","input");V.type="text",V.placeholder=o("search"),V.value=l,V.style.setProperty("padding-inline-start","34px"),V.addEventListener("input",()=>{l=V.value,s();let J=a?.querySelector('input[type="text"]');J?.focus(),J?.setSelectionRange(J.value.length,J.value.length);}),I.append(H,V),D.appendChild(I),P.appendChild(D);let q=te(R?"p-2":"flex-1 overflow-hidden p-2"),ie=te("");Object.assign(ie.style,{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"});let pe=te("text-[11px] font-bold uppercase tracking-wider text-muted-fg/80 mb-2 px-1");pe.textContent=o("allFields");let re=te("kanuni-pivot-popup-action-btn kanuni-pivot-chooser-select-all","button");re.type="button",re.textContent=o("selectAll"),re.style.color="var(--pivot-primary)",re.disabled=u.every(J=>J.area!=="chooser"),re.addEventListener("click",w),ie.append(pe,re),q.appendChild(ie),q.appendChild(g("chooser",u,null,o("noItems"),true)),P.appendChild(q);let fe=te(R?"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");R&&(fe.style.flexShrink="0");let ye=te(R?"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"),Ee=[["filter",o("filterArea")],["column",o("columnArea")],["row",o("rowArea")],["data",o("dataArea")]];for(let[J,S]of Ee){let A=te("border border-border/80 rounded-md shadow-sm bg-surface overflow-hidden flex flex-col transition-colors");R&&(A.style.minHeight="140px"),A.appendChild(g(J,E(J),S,o("dropHere"),false)),ye.appendChild(A);}fe.appendChild(ye),a.append(P,fe);for(let[J,S]of r){let A=a.querySelector(`[data-drop-id="${J}"][data-drop-kind="list"]`);A&&(A.scrollTop=S);}}function k(){if(t)return;let{t:o}=e.getI18n();t=De(e.gridRoot);let c=te("fixed inset-0 z-[100] kanuni-pivot-chooser-backdrop overflow-auto pointer-events-auto");c.addEventListener("click",y),n=te("flex flex-col bg-surface shadow-2xl border border-border overflow-hidden rounded-lg kanuni-pivot-field-chooser"),n.addEventListener("click",P=>P.stopPropagation()),b()||(d={width:Math.min(700,window.innerWidth-32),height:Math.min(550,window.innerHeight-32)},i={x:Math.max(0,(window.innerWidth-d.width)/2),y:Math.max(0,(window.innerHeight-d.height)/2)}),m();let r=te("pivot-field-chooser__header flex items-center justify-between p-3 border-b border-border bg-surface-header/90");b()||(r.style.cursor="move");let x=te("text-[15px] font-semibold m-0 flex items-center gap-2 select-none","h3");x.appendChild(X("grip-horizontal",18,"var(--pivot-text-muted)")),x.appendChild(document.createTextNode(o("allFields")));let u=te("btn-icon rounded-full p-1.5 kanuni-pivot-chip-btn","button");u.type="button",u.setAttribute("aria-label",o("cancel")),u.appendChild(X("x",18)),u.addEventListener("pointerdown",P=>P.stopPropagation()),u.addEventListener("click",y),r.append(x,u);let E=null;r.addEventListener("pointerdown",P=>{b()||P.target.closest(".kanuni-pivot-field-chip, button, input")||(E={px:P.clientX,py:P.clientY,x:i.x,y:i.y},r.setPointerCapture?.(P.pointerId));}),r.addEventListener("pointermove",P=>{E&&(i={x:Math.max(0,E.x+P.clientX-E.px),y:Math.max(0,E.y+P.clientY-E.py)},m());});let R=P=>{E=null,r.releasePointerCapture?.(P.pointerId);};if(r.addEventListener("pointerup",R),r.addEventListener("pointercancel",R),a=te(b()?"flex flex-1 flex-col bg-surface-sunken/30":"flex flex-1 overflow-hidden flex-col md:flex-row bg-surface-sunken/30"),b()&&(a.setAttribute("data-chooser-scroll",""),Object.assign(a.style,{minHeight:"0",overflowY:"auto",touchAction:"pan-y",overscrollBehavior:"contain"})),s(),n.append(r,a),!b()){let P=[["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[D,I,H]of P){let V=te("kanuni-pivot-chooser-resize");V.setAttribute("data-resize-dir",D),Object.assign(V.style,{position:"absolute",zIndex:D.length===2?"51":"50",cursor:I},H);let q=null;V.addEventListener("pointerdown",pe=>{pe.stopPropagation(),q={px:pe.clientX,py:pe.clientY,w:d.width,h:d.height,x:i.x,y:i.y},V.setPointerCapture?.(pe.pointerId);}),V.addEventListener("pointermove",pe=>{if(!q)return;let re=pe.clientX-q.px,fe=pe.clientY-q.py,ye=q.w,Ee=q.h,J=q.x,S=q.y;D.includes("e")&&(ye=q.w+re),D.includes("s")&&(Ee=q.h+fe),D.includes("w")&&(ye=q.w-re,ye>=400&&(J=q.x+re)),D.includes("n")&&(Ee=q.h-fe,Ee>=400&&(S=q.y+fe)),d={width:Math.max(400,ye),height:Math.max(400,Ee)},i={x:Math.max(0,J),y:Math.max(0,S)},m();});let ie=pe=>{q=null,V.releasePointerCapture?.(pe.pointerId);};V.addEventListener("pointerup",ie),V.addEventListener("pointercancel",ie),n.appendChild(V);}}c.appendChild(n),t.appendChild(c),$e().appendChild(t),Oe(t),window.addEventListener("resize",F);for(let P of M)document.addEventListener(P,T);e.onOpenChanged?.(true);}function y(){if(t){window.removeEventListener("resize",F);for(let o of M)document.removeEventListener(o,T);t.remove(),t=null,n=null,a=null,l="",e.onOpenChanged?.(false);}}function C(){if(!t)return;let o={...i},c={...d};y(),k(),i=o,d=c,m();}return {open:k,close:y,toggle:()=>t?y():k(),isOpen:()=>t!==null,repaint:s,relocalize:C,getHost:()=>t,destroy:y}}function ne(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}function Yt(e){let t=false,n=null,a=d=>{t&&n&&!n.contains(d.target)&&(t=false,e.requestRepaint());};document.addEventListener("mousedown",a);function l(d,b){let{t:M}=e.getI18n();e.portal.openPopup(T=>{let F=ne("kanuni-pivot-modal-overlay");F.addEventListener("click",()=>e.portal.closePopup());let m=ne("kanuni-pivot-modal pivot-animate-zoom-in");Object.assign(m.style,{display:"flex",flexDirection:"column",gap:"16px",padding:"24px"});let f=ne("pivot-flex pivot-flex-col");f.style.gap="6px";let g=ne("pivot-flex pivot-items-center pivot-justify-between"),h=ne("kanuni-pivot-modal-title","h3");h.textContent=d;let p=ne("kanuni-pivot-modal-close","button");p.type="button",p.setAttribute("aria-label",M("close")),p.style.padding="6px",p.appendChild(X("x",16)),p.addEventListener("click",()=>e.portal.closePopup()),g.append(h,p);let w=ne("kanuni-pivot-modal-description","p");w.textContent=M("saveReportDescription"),f.append(g,w);let s=ne("pivot-flex pivot-flex-col pivot-gap-4","form"),k=ne("pivot-flex pivot-flex-col pivot-gap-2"),y=ne("kanuni-pivot-form-label","label");y.textContent=M("reportName");let C=ne("kanuni-pivot-input","input");C.type="text",C.placeholder=M("reportNamePlaceholder"),C.required=true,C.value=b,k.append(y,C);let o=ne("pivot-flex pivot-items-center pivot-gap-2"),c=ne("kanuni-pivot-input","input");c.type="checkbox",Object.assign(c.style,{width:"16px",height:"16px"});let r=ne("kanuni-pivot-form-label","label");Object.assign(r.style,{margin:"0",cursor:"pointer"}),r.textContent=M("setAsDefault"),r.addEventListener("click",()=>{c.checked=!c.checked;}),o.append(c,r);let x=ne("kanuni-pivot-modal-footer");Object.assign(x.style,{marginTop:"8px",paddingTop:"16px",borderTop:"1px solid var(--pivot-border)",display:"flex",justifyContent:"flex-end",gap:"8px"});let u=ne("kanuni-pivot-btn kanuni-pivot-btn--outline","button");u.type="button",u.textContent=M("cancel"),u.addEventListener("click",()=>e.portal.closePopup());let E=ne("kanuni-pivot-btn kanuni-pivot-btn--primary","button");E.type="submit",E.disabled=!b.trim(),E.appendChild(X("save",16)),E.appendChild(document.createTextNode(" "+M("save"))),C.addEventListener("input",()=>{E.disabled=!C.value.trim();}),x.append(u,E),s.addEventListener("submit",R=>{R.preventDefault();let P=C.value.trim();P&&(e.controller.saveReport(P,c.checked),e.portal.closePopup());}),s.append(k,o,x),m.append(f,s),T.append(F,m),C.focus();});}function i(d){let{t:b}=e.getI18n();n=d;let M=e.getReports(),T=e.getActiveReportId(),F=M.find(w=>w.id===T),m=ne(`kanuni-pivot-report-btn ${t?"kanuni-pivot-report-btn--open":T?"kanuni-pivot-report-btn--active":"kanuni-pivot-report-btn--default"}`,"button");m.type="button",m.title=b("viewsAndReports"),m.appendChild(X("bookmark",15));let f=ne("pivot-truncate","span");if(f.style.maxWidth="120px",f.textContent=F?F.name:b("views"),m.appendChild(f),m.addEventListener("click",()=>{t=!t,e.requestRepaint();}),d.appendChild(m),!t)return;let g=ne("kanuni-pivot-report-dropdown pivot-animate-slide-up"),h=(w,s=false)=>{let k=ne("kanuni-pivot-report-section-title");return s&&(k.style.marginTop="8px",k.style.borderTop="1px solid color-mix(in srgb, var(--pivot-border) 50%, transparent)"),k.textContent=w,k},p=(w,s,k,y)=>{let C=ne("kanuni-pivot-report-item","button");C.type="button",C.appendChild(X(w,16,s));let o=ne(""),c=ne("pivot-font-medium");return c.textContent=k,o.appendChild(c),C.appendChild(o),C.addEventListener("click",()=>{t=false,e.requestRepaint(),y();}),C};if(g.appendChild(h(b("actions"))),g.appendChild(p("save","var(--pivot-success)",b("saveNewView"),()=>l(b("saveNewView"),""))),T&&(g.appendChild(p("save-all","var(--pivot-warning)",b("saveChangesOverwrite"),()=>e.controller.updateCurrentReport())),g.appendChild(p("copy","var(--pivot-info)",b("saveAsCopy"),()=>l(b("saveAsView"),`${F?.name??""} (Copy)`)))),M.length>0){g.appendChild(h(b("savedViews"),true));let w=ne("kanuni-pivot-report-list pivot-custom-scrollbar");for(let s of M){let k=ne(`kanuni-pivot-report-list-item${s.id===T?" kanuni-pivot-report-list-item--active":""}`),y=ne("kanuni-pivot-report-list-btn","button");y.type="button",y.appendChild(X(s.id===T?"check":"folder-open",14,s.id===T?"var(--pivot-primary)":"var(--pivot-text-muted)"));let C=ne("pivot-text-sm pivot-truncate","span");C.style.color=s.id===T?"var(--pivot-primary)":"var(--pivot-text)",s.id===T&&C.classList.add("pivot-font-medium"),C.textContent=s.name,y.appendChild(C),s.isDefault&&y.appendChild(Ve("star",12,"var(--pivot-warning)")),y.addEventListener("click",()=>{t=false,e.requestRepaint(),e.controller.loadReport(s.id);}),k.appendChild(y);let o=ne("kanuni-pivot-report-actions");if(!s.isDefault){let r=ne("kanuni-pivot-action-btn kanuni-pivot-action-btn--warning","button");r.type="button",r.title=b("makeDefault"),r.setAttribute("aria-label",r.title),r.appendChild(X("star",14)),r.addEventListener("click",x=>{x.stopPropagation(),e.controller.setDefaultReport(s.id);}),o.appendChild(r);}let c=ne("kanuni-pivot-action-btn kanuni-pivot-action-btn--danger","button");c.type="button",c.title=b("deleteReport"),c.setAttribute("aria-label",c.title),c.appendChild(X("trash",14)),c.addEventListener("click",r=>{r.stopPropagation(),window.confirm(b("deleteReportConfirm").replace("{0}",s.name))&&(e.controller.deleteReport(s.id),s.id===T&&(t=false,e.requestRepaint()));}),o.appendChild(c),k.appendChild(o),w.appendChild(k);}g.appendChild(w);}d.appendChild(g);}return {mount:i,destroy(){document.removeEventListener("mousedown",a);}}}var fo={chartData:[],chartSeries:[]};function at(e,t,n,a){let l=null,i,d,b,M=false;function T(){if(M)return;let f=e.getState();if(!f.engineResult||!f.engineResult.cellMatrix||!n.transformer){a(fo);return}a(n.transformer(f.engineResult,pivotgridCore.shownFields(f.fields),f.expandedPaths,t(),n));}function F(){let f=e.getState(),g=t();f.engineResult===i&&f.expandedPaths===d&&g===b||(i=f.engineResult,d=f.expandedPaths,b=g,l&&clearTimeout(l),l=setTimeout(T,150));}let m=e.subscribe(F);return F(),{refresh:F,stop(){M=true,l&&clearTimeout(l),m();}}}function He(e,t="div"){let n=document.createElement(t);return e&&(n.className=e),n}var lt=new Set;function ko(){let e="default-pivot-grid";for(let t=2;lt.has(e);t++)e=`default-pivot-grid-${t}`;return lt.add(e),e}function To(e,t){if(!e||!(e instanceof HTMLElement))throw new Error("[pivotgrid] createPivotGrid needs a container HTMLElement");ct(t);let n=Be(t.locale,t.dictionary,t.rtl),a=t.gridId||t.stateStoring?.storageKey,l=a||ko();!a&&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 i=He("kanuni-pivot-root"+(t.className?" "+t.className:""));i.style.width="100%",i.style.height="100%",pt(i,pivotgridCore.pivotSchemeTheme(t.theme,t.palette,t.dark)),i.setAttribute("dir",n.rtl?"rtl":"ltr");let d=He("kanuni-pivot-wrapper pivot-flex pivot-flex-col");d.style.width="100%",d.style.height="100%";let b=He("pivot-grid pivot-flex-1 pivot-flex pivot-flex-col pivot-relative");b.style.minHeight="0",b.style.overflow="hidden",b.style.backgroundColor="var(--pivot-bg)",b.style.border="1px solid var(--pivot-border)",b.style.borderRadius="var(--pivot-radius-md)",b.style.userSelect="none",t.striped&&i.classList.add("kanuni-pivot-striped");let M=t.density,T=()=>pivotgridCore.pivotDensityClass(M),F=()=>pivotgridCore.pivotRowHeight(M);T()&&i.classList.add(T());let m=He("pivot-flex-1 pivot-flex pivot-flex-col pivot-relative");m.style.minHeight="0";let f=He("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",""),b.appendChild(m),b.appendChild(f),d.appendChild(b),i.appendChild(d);let g=He("kanuni-pivot-live");g.setAttribute("role","status"),g.setAttribute("aria-live","polite"),g.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap",i.appendChild(g),e.appendChild(i);let h={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,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},p=new pivotgridCore.PivotController(h),w=pivotgridCore.bindPivotScrollMemory(i,p),s=pivotgridCore.watchShortPivot(d),k=()=>pivotgridCore.shownFields(p.getState().fields),y=ot(i),C=Nt({portal:y,getI18n:()=>n,gridId:l,getField:v=>k().find(z=>z.id===v),getData:()=>p.getRawData(),apply:(v,z,O)=>p.applyFilter(v,z,O),clear:v=>p.clearFilter(v),openCondition:v=>o.openCondition(v)}),o=Xt({portal:y,getI18n:()=>n,getFields:k,save:v=>p.updateField(v)}),c=Kt({portal:y,gridRoot:i,getI18n:()=>n,getFields:k,getLayout:()=>p.getState().layout,controller:p,getEngineTrees:()=>{let v=p.getState().engineResult;return v?{rowTree:v.rowTree,colTree:v.colTree}:null},openSettings:v=>o.open(v),openCondition:v=>o.openCondition(v),openFilter:(v,z,O)=>{E()||C.open(z,O,v);},openFieldChooser:()=>r.open(),onEditCalculatedField:t.onEditCalculatedField?v=>{E()||t.onEditCalculatedField(v);}:void 0,customContextMenuItems:t.customContextMenuItems}),r=Ut({gridRoot:i,getI18n:()=>n,getFields:k,controller:p,onFilterClick:(v,z,O)=>C.open(v,z,O),onOpenChanged:()=>{S||(ie.refreshRoots(),J.paint(p.getState()));}}),x=(v,z)=>{t.onGlobalContextMenu?t.onGlobalContextMenu(v,z):c.openGlobalMenu(v,z);},u=Rt(),E=()=>t.disabled===true,R,P,D={getI18n:()=>n,onRemove:v=>{E()||p.removeField(v);},onFilterClick:(v,z,O)=>{E()||C.open(v,z,O);},onSort:(v,z)=>{E()||p.sortField(v,z);},onContextMenu:(v,z,O,G,N)=>{E()||c.openFieldMenu(v,z,O,G,N);},getFields:k,onMove:(v,z)=>{E()||p.moveField(v,z);},requestFocus:v=>{R=v;let O=document.activeElement?.closest?.("[data-drop-id]")?.getAttribute("data-drop-id");P=O?k().find(G=>G.id===O)?.area:void 0;}},I=Pt({host:m,getI18n:()=>n,onCellPrepared:t.onCellPrepared,registry:t.registry,shared:u,chipDeps:D,hasCellClick:()=>!!t.onCellClick&&!E(),columnWidthDefaults:pivotgridCore.resolveColumnWidthDefaults(t.defaultColumnWidths),rowHeight:F}),H=wt({...D,host:b,onGlobalContextMenu:x,onToggleCollapsed:()=>{E()||p.setLayout({filterAreaCollapsed:p.getState().layout.filterAreaCollapsed!==true});}});b.insertBefore(H.element,m);let V=He("kanuni-pivot-notice");V.setAttribute("role","status"),V.style.display="none",b.insertBefore(V,m);let q=()=>{let v=r.getHost();return v?[i,v]:[i]},ie=qt({gridRoot:i,roots:q,controller:p,getFields:k,onIntentChange:v=>kt(q(),v),disabled:E,touchDragDelay:()=>t.touchDragDelay}),pe=At({scroller:I.scroller,controller:{toggleExpanded:v=>{E()||p.toggleExpanded(v);},toggleColExpanded:v=>{E()||p.toggleColExpanded(v);},sortField:(v,z)=>{E()||p.sortField(v,z);}},getVM:I.getVM,getTheadHeight:I.getTheadHeight,rowHeight:F,shared:u,onCellClick:t.disabled===true?void 0:t.onCellClick,resolveCellClick:v=>p.resolveCellClick(v),onGlobalContextMenu:(v,z)=>{E()||x(v,z);},onFilterClick:(v,z,O)=>{E()||C.open(v,z,O);},onHeaderContextMenu:(v,z,O,G)=>{E()||c.openFieldMenu(v,z,O,G);},onNodeContextMenu:v=>{E()||c.openNodeMenu(v);},keyboardEnabled:t.keyboardNavigation?.enabled!==false}),re=bt({scroller:I.scroller,shared:u,getVM:I.getVM,onStats:v=>p.setSelectionStats(v)}),fe=Ht({host:m,scroller:I.scroller,shared:u,isRtl:()=>n.rtl,getWidths:()=>p.getState().columnWidths??{},rowHeaderLayout:()=>I.rowHeaderLayout(),dataColOffset:()=>I.getVM()?.dataColOffset??0,commit:v=>{E()||p.setColumnWidths(v);}}),ye=jt(i,()=>{J.paint(p.getState()),I.refreshWindow();}),Ee=Yt({portal:y,getI18n:()=>n,controller:p,getReports:()=>p.getState().reports??[],getActiveReportId:()=>p.getState().activeReportId??null,requestRepaint:()=>J.paint(p.getState())}),J=Wt({host:d,getI18n:()=>n,toolbar:t.toolbar,advancedExport:t.advancedExport===true,upgradeUrl:t.upgradeUrl,registry:t.registry,onToggleFieldChooser:()=>r.toggle(),fieldChooserOpen:()=>r.isOpen(),onRefresh:t.onRefresh,onExport:v=>{p.exportData(v,{applyFilters:true}).catch(z=>{let O=z instanceof Error?z:new Error(String(z));O.name!=="AbortError"&&(t.onError?t.onError(O):console.error(O));});},onExpandAll:()=>p.expandAll({allLevels:true}),onCollapseAll:()=>p.collapseAll(),onAddCalculatedField:t.onAddCalculatedField?()=>{E()||t.onAddCalculatedField();}:void 0,onOpenPrefilter:t.onOpenPrefilter?()=>{E()||t.onOpenPrefilter();}:void 0,onToggleChart:t.onToggleChart?()=>{E()||t.onToggleChart();}:void 0,onToggleFullscreen:()=>ye.toggle(),isFullscreen:()=>ye.isFullscreen(),onGlobalContextMenu:x,mountReportMenu:v=>Ee.mount(v),onSearch:t.search?v=>p.setSearchText(v):void 0}),S=false,A=false,B=null,W=0;function U(){S||A||(A=true,queueMicrotask(Z));}let de="";function ge(v){let z=pivotgridCore.pivotChipView(v);if(de!==z.className){for(let G of de.split(" "))G&&i.classList.remove(G);for(let G of z.className.split(" "))G&&i.classList.add(G);de=z.className;}let O=z.style["--pivot-chip-max-width"];O?i.style.setProperty("--pivot-chip-max-width",O):i.style.removeProperty("--pivot-chip-max-width"),Vt(i);}function Z(){if(A=false,S)return;let v=p.getState(),z=!B||B.engineResult!==v.engineResult||B.fields!==v.fields||B.layout!==v.layout||B.expandedPaths!==v.expandedPaths||B.expandedColPaths!==v.expandedColPaths||B.columnWidths!==v.columnWidths;(!B||B.layout!==v.layout)&&ge(v.layout);let O=!B||B.isBuilding!==v.isBuilding||B.buildProgress!==v.buildProgress||B.engineError!==v.engineError||B.engineResult!==v.engineResult||B.noData!==v.noData,G=!B||B.selectionStats!==v.selectionStats||B.reports!==v.reports||B.activeReportId!==v.activeReportId||B.layout!==v.layout;if(z&&(H.paint(pivotgridCore.shownFields(v.fields).filter(N=>N.area==="filter"),v.layout.showFilterArea!==false,{maxRows:v.layout.filterAreaMaxRows,collapsed:v.layout.filterAreaCollapsed===true,collapsedRows:v.layout.filterAreaCollapsedRows}),r.isOpen()&&r.repaint()),z&&v.engineResult&&I.paintStructural(v),R!==void 0&&(((R?i.querySelector(`.kanuni-pivot-field-chip[data-drop-id="${R}"]`):P?i.querySelector(`[data-drop-id="${P}"]`):null)??I.scroller).focus({preventScroll:true}),R=void 0,P=void 0),O&&ue(v),!B||B.engineResult!==v.engineResult){let N=v.engineResult?.columnsTruncated;V.style.display=N?"":"none";let j=new Intl.NumberFormat(n.locale);V.textContent=N?n.t("columnsTruncated").replace("{shown}",j.format(N.shown)).replace("{total}",j.format(N.total)):"";}if(B&&B.searchText!==v.searchText&&J.syncSearch(v.searchText??""),B&&B.fields!==v.fields){let N=pivotgridCore.pivotChangeAnnouncement(B.fields,v.fields,n.t);N&&(g.textContent=pivotgridCore.nextLiveText(g.textContent??"",N));}G&&(J.element.style.display=v.layout.showFooter===false?"none":"",J.paint(v)),B=v,W++;}function ue(v){if(v.engineError){f.style.display="block",f.textContent=`${n.t("error")}: ${v.engineError.message}`;return}if(v.isBuilding&&!v.engineResult){f.style.display="block",f.textContent=`${n.t("initializing")} ${Math.round(v.buildProgress??0)}%`;return}if(!v.engineResult){f.style.display="block",f.textContent=n.t(v.noData?"emptyData":"loading");return}f.style.display="none",f.textContent="";}let L=t.onChartSync?at(p,()=>n.locale,t.chartIntegrationOptions??{},t.onChartSync):null,$=p.subscribe(U);Z();let K={controller:p,element:i,setData(v){S||p.setData(v);},applyTransaction(v){return p.applyTransaction(v)},applyTransactionAsync(v,z){p.applyTransactionAsync(v,z);},flushAsyncTransactions(){p.flushAsyncTransactions();},setLoading(v){p.setLoading(v);},undoLayout:()=>pivotgridCore.keepFocusAcross(i,p,()=>p.undoLayout()),redoLayout:()=>pivotgridCore.keepFocusAcross(i,p,()=>p.redoLayout()),canUndoLayout:()=>p.canUndoLayout(),canRedoLayout:()=>p.canRedoLayout(),clearLayoutHistory:()=>p.clearLayoutHistory(),setFields(v){S||p.setFields(v);},setSearchText(v){p.setSearchText(v);},setLocale(v,z,O){S||(n=Be(v,z??t.dictionary,O??t.rtl),i.setAttribute("dir",n.rtl?"rtl":"ltr"),p.updateOptions({locale:n.locale,dictionary:n.dictionary}),B=null,U(),r.relocalize(),L?.refresh());},openFieldChooser:()=>r.open(),closeFieldChooser:()=>r.close(),clearAllFilters:()=>p.clearAllFilters(),setDensity(v){S||(T()&&i.classList.remove(T()),M=v,T()&&i.classList.add(T()),B=null,U());},destroy(){S||(S=true,$(),w(),s(),L?.stop(),r.destroy(),ie.destroy(),pe.destroy(),re.destroy(),fe.destroy(),H.destroy(),Ee.destroy(),J.destroy(),ye.destroy(),y.destroy(),I.destroy(),p.dispose(),i.remove(),a||lt.delete(l));}};return Object.defineProperty(K,"__flushCount",{get:()=>W}),Object.defineProperty(K,"__shared",{get:()=>u}),Object.defineProperty(K,"__dragRootCount",{get:()=>ie.rootCount()}),K}
|
|
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=at;exports.createPivotGrid=To;exports.createPortalLayer=ot;exports.createThemedHost=De;exports.createValueFormatter=Ne;exports.filledIcon=Ve;exports.fitPortalZoom=Oe;exports.icon=X;exports.portalParent=$e;exports.resolveI18n=Be;
|