@nice2dev/ui-enterprise 1.0.23 → 1.0.25
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/NiceForm-BrBaLUkv-RLFZ6sNy.cjs +339 -0
- package/dist/NiceForm-BrBaLUkv-k8Fo7mj4.js +7210 -0
- package/dist/NicePinCodeInput-xSuOVhE8-DmxfaSND.cjs +696 -0
- package/dist/NicePinCodeInput-xSuOVhE8-DqfYMQYV.js +11887 -0
- package/dist/NiceSavedQueryPanel-Mz4jAsGJ-DIXgTEaO.js +7057 -0
- package/dist/NiceSavedQueryPanel-Mz4jAsGJ-eGU3lTtO.cjs +596 -0
- package/dist/charts-DNQXBPGB-B0r21QJH.cjs +546 -0
- package/dist/charts-DNQXBPGB-BbRP6IEh.js +3880 -0
- package/dist/index-BkLJ4tzy-DcKCJ5PU.cjs +4950 -0
- package/dist/index-BkLJ4tzy-NDXBaHs9.js +44930 -0
- package/dist/index-DYmRgxid.cjs +91 -0
- package/dist/index-iTK9Q_Fp.js +17762 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),ye=require("./index-DYmRgxid.cjs"),t=require("react"),Fe=require("./NiceForm-BrBaLUkv-RLFZ6sNy.cjs"),ta=require("react-dom"),Yt=({open:n,onClose:a,title:r,size:l="md",children:s,footer:u,closeOnOverlay:g=!0,closeOnEscape:c=!0,fullscreenable:x,zIndex:k,className:S,style:L,displayStyle:y})=>{const{t:D}=ye.ce(),O=t.useContext(ye.Er),W=t.useRef(null),[w,o]=t.useState(!1),M=ye.rl("modal",y),p=ye.ol("modal",y);if(ye.vl(W,n),t.useEffect(()=>{if(!n||!c)return;const K=ie=>{ie.key==="Escape"&&a()};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[n,c,a]),t.useEffect(()=>(n?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[n]),!n||typeof document>"u")return null;const E=e.jsx("div",{className:"nice-modal-overlay",style:k?{zIndex:k}:void 0,onClick:g?a:void 0,children:e.jsxs("div",{ref:W,className:`nice-modal nice-modal--${w?"full":l} nice-modal--ds-${p} ${S||""}`,style:{...M,...L},role:"dialog","aria-modal":"true","aria-label":r,onClick:K=>K.stopPropagation(),children:[r&&e.jsxs("div",{className:"nice-modal__header",children:[e.jsx("h2",{className:"nice-modal__title",children:r}),e.jsxs("div",{className:"nice-modal__header-actions",children:[x&&e.jsx("button",{type:"button",className:"nice-modal__fullscreen",onClick:()=>o(K=>!K),"aria-label":w?"Exit fullscreen":"Fullscreen",children:w?"⇲":"⇱"}),e.jsx("button",{type:"button",className:"nice-modal__close",onClick:a,"aria-label":D("controls.close","Close"),children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})})})]})]}),e.jsx("div",{className:"nice-modal__body",children:s}),u&&e.jsx("div",{className:"nice-modal__footer",children:u})]})});return ta.createPortal(E,(O==null?void 0:O.portalTarget)??document.body)};function ia(n,a,r){const l=[];if(a<=1)return a===1&&l.push(1),l;const s=Math.max(2,n-r),u=Math.min(a-1,n+r);l.push(1),s>2&&l.push("dots");for(let g=s;g<=u;g++)l.push(g);return u<a-1&&l.push("dots"),l.push(a),l}const Ni=({page:n,totalPages:a,onChange:r,showInfo:l,siblingCount:s=1,size:u="md",showFirstLast:g,showJumpInput:c,jumpInputLabel:x,showPageSize:k,pageSizeOptions:S,pageSize:L,onPageSizeChange:y,disabled:D,className:O,style:W})=>{const w=ia(n,a,s);return e.jsxs("nav",{className:`nice-pagination nice-pagination--${u} ${O||""}`,style:W,"aria-label":"Pagination",children:[g&&e.jsx("button",{className:"nice-pagination__btn",disabled:D||n<=1,onClick:()=>r(1),"aria-label":"First page",title:"First page",children:"⏮"}),e.jsx("button",{className:"nice-pagination__btn",disabled:D||n<=1,onClick:()=>r(n-1),"aria-label":"Previous",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})})}),w.map((o,M)=>o==="dots"?e.jsx("span",{className:"nice-pagination__ellipsis",children:"…"},`dots-${M}`):e.jsx("button",{className:`nice-pagination__btn ${o===n?"nice-pagination__btn--active":""}`,disabled:D,onClick:()=>r(o),"aria-current":o===n?"page":void 0,children:o},o)),e.jsx("button",{className:"nice-pagination__btn",disabled:D||n>=a,onClick:()=>r(n+1),"aria-label":"Next",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})})}),g&&e.jsx("button",{className:"nice-pagination__btn",disabled:D||n>=a,onClick:()=>r(a),"aria-label":"Last page",title:"Last page",children:"⏭"}),l&&e.jsxs("span",{className:"nice-pagination__info",children:[n," / ",a]}),c&&e.jsxs("span",{className:"nice-pagination__jump",style:{display:"inline-flex",alignItems:"center",gap:6,marginLeft:8},children:[e.jsx("span",{style:{fontSize:"0.85rem",color:"var(--text-secondary)"},children:x??"Go to"}),e.jsx(Fe.Qe,{size:u==="lg"?"md":"sm",min:1,max:a,step:1,value:n,disabled:D,onChange:o=>{const M=typeof o=="number"?o:Number(o);if(!Number.isNaN(M)){const p=Math.max(1,Math.min(a,Math.floor(M)));r(p)}}})]}),k&&S&&S.length>0&&e.jsx("select",{className:"nice-pagination__size",value:L??S[0],disabled:D,onChange:o=>y==null?void 0:y(Number(o.target.value)),style:{marginLeft:8,padding:"4px 8px",border:"1px solid var(--border-color)",borderRadius:6,background:"var(--bg-primary)",color:"var(--text-primary)",font:"inherit",fontSize:"0.85rem"},"aria-label":"Rows per page",children:S.map(o=>e.jsxs("option",{value:o,children:[o," / page"]},o))})]})};function Ci({columns:n,data:a,striped:r,compact:l,emptyText:s,className:u,style:g,accessMode:c,id:x,displayStyle:k}){const S=ye.Nl(c,x)==="hidden",L=ye.rl("table",k),y=ye.ol("table",k),[D,O]=t.useState(null),W=t.useMemo(()=>D?[...a].sort((o,M)=>{const p=o[D.field]??"",E=M[D.field]??"",K=typeof p=="number"?p-E:String(p).localeCompare(String(E));return D.dir==="desc"?-K:K}):a,[a,D]),w=o=>{O(M=>(M==null?void 0:M.field)===o?M.dir==="asc"?{field:o,dir:"desc"}:null:{field:o,dir:"asc"})};return S?null:e.jsx("div",{className:`nice-table-wrapper ${u||""}`,style:{...L,...g},children:e.jsxs("table",{className:`nice-table nice-table--ds-${y} ${r?"nice-table--striped":""} ${l?"nice-table--compact":""}`,"aria-rowcount":W.length,"aria-colcount":n.length,children:[e.jsx("thead",{children:e.jsx("tr",{children:n.map(o=>{const M=o.sortable?(D==null?void 0:D.field)===o.field?D.dir==="asc"?"ascending":"descending":"none":void 0;return e.jsxs("th",{style:{width:o.width,textAlign:o.align},className:o.sortable?"th--sortable":void 0,onClick:()=>o.sortable&&w(o.field),scope:"col","aria-sort":M,children:[o.header,o.sortable&&(D==null?void 0:D.field)===o.field&&e.jsx("span",{className:"nice-table__sort-icon","aria-hidden":"true",children:D.dir==="asc"?"↑":"↓"})]},o.field)})})}),e.jsx("tbody",{children:W.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:n.length,className:"nice-table__empty",children:s||"No data"})}):W.map((o,M)=>e.jsx("tr",{children:n.map(p=>e.jsx("td",{style:{textAlign:p.align},children:p.render?p.render(o[p.field],o):String(o[p.field]??"")},p.field))},M))})]})})}const aa=[{target:".nice-filterbuilder",titleKey:"tutorial.filterBuilder.intro.title",title:"Filter builder",contentKey:"tutorial.filterBuilder.intro.content",content:"Build complex AND/OR filter trees: add conditions and nested groups, choose fields and operators, and save reusable presets.",placement:"auto"}],ra=[{value:"=",label:"Equals"},{value:"<>",label:"Not Equals"},{value:"<",label:"Less Than"},{value:"<=",label:"Less or Equal"},{value:">",label:"Greater Than"},{value:">=",label:"Greater or Equal"},{value:"contains",label:"Contains"},{value:"notcontains",label:"Not Contains"},{value:"startswith",label:"Starts With"},{value:"endswith",label:"Ends With"},{value:"isblank",label:"Is Blank"},{value:"isnotblank",label:"Is Not Blank"}],la=({condition:n,fields:a,onChange:r,onRemove:l})=>{const s=a.find(c=>c.field===n.field),u=n.operator==="isblank"||n.operator==="isnotblank",g=(s==null?void 0:s.operators)||ra;return e.jsxs("div",{className:"nice-filterbuilder__condition",children:[e.jsx("select",{className:"nice-filterbuilder__select",value:n.field,onChange:c=>r({...n,field:c.target.value,value:""}),children:a.map(c=>e.jsx("option",{value:c.field,children:c.label},c.field))}),e.jsx("select",{className:"nice-filterbuilder__select",value:n.operator,onChange:c=>r({...n,operator:c.target.value}),children:g.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))}),!u&&(s!=null&&s.options?e.jsxs("select",{className:"nice-filterbuilder__select",value:String(n.value??""),onChange:c=>r({...n,value:c.target.value}),children:[e.jsx("option",{value:"",children:"--"}),s.options.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))]}):(s==null?void 0:s.type)==="boolean"?e.jsxs("select",{className:"nice-filterbuilder__select",value:String(n.value??""),onChange:c=>r({...n,value:c.target.value==="true"}),children:[e.jsx("option",{value:"true",children:"True"}),e.jsx("option",{value:"false",children:"False"})]}):e.jsx("input",{className:"nice-filterbuilder__input",type:(s==null?void 0:s.type)==="number"?"number":(s==null?void 0:s.type)==="date"?"date":"text",value:String(n.value??""),onChange:c=>r({...n,value:(s==null?void 0:s.type)==="number"?Number(c.target.value):c.target.value})})),e.jsx("button",{className:"nice-filterbuilder__remove",onClick:l,children:"×"})]})},Si=({group:n,fields:a,onChange:r,onRemove:l,depth:s,maxDepth:u})=>{const g=()=>r({...n,logic:n.logic==="and"?"or":"and"}),c=()=>{var y;const L={type:"condition",field:((y=a[0])==null?void 0:y.field)||"",operator:"=",value:""};r({...n,items:[...n.items,L]})},x=()=>{if(s>=u)return;const L={type:"group",logic:"and",items:[]};r({...n,items:[...n.items,L]})},k=(L,y)=>{const D=[...n.items];D[L]=y,r({...n,items:D})},S=L=>{r({...n,items:n.items.filter((y,D)=>D!==L)})};return e.jsxs("div",{className:`nice-filterbuilder__group nice-filterbuilder__group--depth-${Math.min(s,3)}`,children:[e.jsxs("div",{className:"nice-filterbuilder__group-header",children:[e.jsx("button",{className:"nice-filterbuilder__logic",onClick:g,children:n.logic.toUpperCase()}),e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:c,children:"+ Condition"}),s<u&&e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:x,children:"+ Group"}),l&&e.jsx("button",{className:"nice-filterbuilder__remove",onClick:l,children:"×"})]}),e.jsx("div",{className:"nice-filterbuilder__group-body",children:n.items.map((L,y)=>e.jsx(t.Fragment,{children:L.type==="condition"?e.jsx(la,{condition:L,fields:a,onChange:D=>k(y,D),onRemove:()=>S(y)}):e.jsx(Si,{group:L,fields:a,onChange:D=>k(y,D),onRemove:()=>S(y),depth:s+1,maxDepth:u})},y))})]})},At=({fields:n,value:a,onChange:r,maxDepth:l=3,presets:s,onSavePreset:u,onDeletePreset:g,tutorial:c,className:x,style:k})=>{const[S,L]=t.useState(""),y=t.useCallback(O=>{const W=s==null?void 0:s.find(w=>w.name===O);W&&r(structuredClone(W.filter))},[s,r]),D=t.useCallback(()=>{!S.trim()||!u||(u({name:S.trim(),filter:structuredClone(a)}),L(""))},[S,a,u]);return e.jsxs("div",{className:`nice-filterbuilder ${x||""}`,style:{position:"relative",...k},children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(ye.Ud,{steps:ye.Kd(c,aa)})}),((s==null?void 0:s.length)||u)&&e.jsxs("div",{className:"nice-filterbuilder__presets",children:[s&&s.length>0&&e.jsx("div",{className:"nice-filterbuilder__preset-list",children:s.map(O=>e.jsxs("span",{className:"nice-filterbuilder__preset-tag",children:[e.jsx("button",{type:"button",className:"nice-filterbuilder__preset-btn",onClick:()=>y(O.name),children:O.name}),g&&e.jsx("button",{type:"button",className:"nice-filterbuilder__preset-del",onClick:()=>g(O.name),children:"×"})]},O.name))}),u&&e.jsxs("div",{className:"nice-filterbuilder__preset-save",children:[e.jsx("input",{className:"nice-filterbuilder__input",value:S,onChange:O=>L(O.target.value),placeholder:"Preset name..."}),e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:D,disabled:!S.trim(),children:"Save"})]})]}),e.jsx(Si,{group:a,fields:n,onChange:r,depth:0,maxDepth:l})]})};At.displayName="NiceFilterBuilder";function Mi(n,a,r){const l=n.map(s=>s[a]).filter(s=>typeof s=="number");if(l.length===0)return r==="count"?"0":"";switch(r){case"sum":return l.reduce((s,u)=>s+u,0).toLocaleString();case"avg":return(l.reduce((s,u)=>s+u,0)/l.length).toLocaleString(void 0,{maximumFractionDigits:2});case"count":return String(n.length);case"min":return Math.min(...l).toLocaleString();case"max":return Math.max(...l).toLocaleString()}}function kt(n){return n.includes(",")||n.includes('"')||n.includes(`
|
|
2
|
+
`)?`"${n.replace(/"/g,'""')}"`:n}const nt={width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},sa=()=>e.jsx("svg",{...nt,children:e.jsx("polyline",{points:"6 15 12 9 18 15"})}),wt=()=>e.jsx("svg",{...nt,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),ca=()=>e.jsxs("svg",{...nt,style:{opacity:.55},children:[e.jsx("polyline",{points:"6 10 12 5 18 10"}),e.jsx("polyline",{points:"6 14 12 19 18 14"})]}),Tt=()=>e.jsx("svg",{...nt,children:e.jsx("polyline",{points:"9 6 15 12 9 18"})}),oa=()=>e.jsxs("svg",{...nt,children:[e.jsx("polyline",{points:"3 17 9 11 13 15 21 7"}),e.jsx("polyline",{points:"14 7 21 7 21 14"})]}),da=()=>e.jsxs("svg",{...nt,children:[e.jsx("polyline",{points:"3 7 9 13 13 9 21 17"}),e.jsx("polyline",{points:"14 17 21 17 21 10"})]}),ua=()=>e.jsx("svg",{...nt,children:e.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})});function ma(n){return typeof n=="boolean"?n?e.jsx("svg",{className:"nice-datagrid__bool-icon nice-datagrid__bool-icon--true",width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"true",role:"img",children:e.jsx("path",{d:"M4 10.5l4 4L16 6"})}):e.jsx("svg",{className:"nice-datagrid__bool-icon nice-datagrid__bool-icon--false",width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"false",role:"img",children:e.jsx("path",{d:"M5 5l10 10M15 5L5 15"})}):String(n??"")}function Ct({columns:n,data:a,keyField:r="id",dataSource:l,sortable:s=!0,sortField:u,sortDirection:g,onSort:c,showAdvancedFilter:x,advancedFilter:k,onAdvancedFilterChange:S,filterFields:L,filterPresets:y,onSaveFilterPreset:D,onDeleteFilterPreset:O,selectable:W,selectedKeys:w,onSelectionChange:o,pagination:M,pageSize:p=10,page:E,onPageChange:K,totalRows:ie,autoPagination:se=!1,stickyHeader:$e=!0,stickyFooter:$=!0,searchable:oe,searchPlaceholder:xe,virtualScroll:de,rowHeight:H=40,groupBy:Z,groupRender:R,onCellEdit:F,editMode:b="inline",formItems:je,formColumns:pe=2,editFormTitle:G,formProps:ne,onRowEdit:U,onRowAdd:X,onRowDelete:ge,bulkActions:we,onBulkDelete:Ae,exportCsv:Ke,exportFilename:Ge="export",detailRow:Se,expandedRowKeys:Ue,onExpandedRowChange:Ee,columnReorder:Xe,onColumnReorder:te,columnResize:ve,rowDraggable:he,onRowReorder:z,striped:ue,compact:Q,loading:fe,emptyText:A,toolbar:ce,onRowClick:P,pinnedTopKeys:ze,pinnedBottomKeys:Ie,colSpan:ee,showStatusBar:Je,contextMenuItems:en,onContextMenuAction:ke,printFriendly:An,keyboardNavigation:bn,focusedCell:Pn,onFocusedCellChange:Nn,cellRangeSelection:I,selectedCellRange:ae,onCellRangeChange:me,clipboard:be,clipboardFormat:ln="text",onBeforeCopy:De,onCopy:Le,onPaste:Ye,quickFilters:Ne,activeQuickFilters:nn,onQuickFilterChange:dn,columnGroups:pt,stateStorageKey:Cn,initialState:tt,onStateChange:On,flashRowKeys:Wn,flashDuration:sn=500,autoFitColumns:Pt,showColumnStats:St,rowIndicator:qn,frozenRows:it,className:Sn,style:gt,accessMode:at,id:rt,displayStyle:Bn}){var bi,_i;const Kn=ye.Nl(at,rt),lt=Kn==="hidden",m=Kn==="readOnly"||Kn==="disabled",{t:d}=ye.ce();ye.rl("table",Bn),ye.ol("table",Bn);const _=ye.Cc(l??null,{autoLoad:!!l,defaultPageSize:p}),T=!!l,q=T?_.data:a??[],N=T?_.loading:fe,[B,Y]=t.useState({field:"",dir:null}),[Pe,Oe]=t.useState(1),[re,Ze]=t.useState(new Set),[tn,un]=t.useState(""),[an,mn]=t.useState({type:"group",logic:"and",items:[]}),[ft,Un]=t.useState(!1),cn=k??an,st=i=>{S?S(i):mn(i)},Gn=t.useMemo(()=>L??n.filter(i=>i.filterable!==!1&&i.field).map(i=>({field:String(i.field),label:String(i.header??i.field)})),[L,n]),xt=cn.items.length,[Mn,Ot]=t.useState(p),[hn,bt]=t.useState(null),[ct,Xn]=t.useState(null),[pn,In]=t.useState(null),[ot,Mt]=t.useState(new Set),[Dt,_t]=t.useState(0),yt=t.useRef(null),[Wt,Bt]=t.useState(new Set),dt=Ue??Wt,[Dn,Hn]=t.useState({}),[Qn,Vn]=t.useState(null),[Jn,ut]=t.useState(null),[v,_e]=t.useState(null),[Me,Te]=t.useState(null),[gn,$n]=t.useState([]),[Rn,fn]=t.useState(null),[Kt,ti]=t.useState(new Set),[dr,ur]=t.useState(null),Ut=t.useRef(null),[Pi,Oi]=t.useState(p);t.useEffect(()=>{if(!se)return;const i=yt.current;if(!i||typeof ResizeObserver>"u")return;const h=()=>{const j=i.clientHeight;if(j<=0)return;const C=Math.max(1,Math.floor(j/H)-1);Oi(J=>J===C?J:C),T&&_.setPageSize(C)};h();const f=new ResizeObserver(h);return f.observe(i),()=>f.disconnect()},[se,H,T]);const rn=Pn??v,on=ae??Me,Fn=nn??gn;t.useEffect(()=>{if(!Cn)return;const i=localStorage.getItem(`nice-datagrid-${Cn}`);if(i&&!tt)try{const h=JSON.parse(i);h.columnWidths&&Hn(h.columnWidths),h.expandedGroups&&Mt(new Set(h.expandedGroups))}catch{}},[Cn,tt]),t.useEffect(()=>{if(!(Wn!=null&&Wn.size))return;ti(new Set(Wn));const i=setTimeout(()=>ti(new Set),sn);return()=>clearTimeout(i)},[Wn,sn]),t.useEffect(()=>{if(!Jn)return;const i=()=>ut(null);return document.addEventListener("click",i),()=>document.removeEventListener("click",i)},[Jn]);const Wi=t.useCallback((i,h)=>{en!=null&&en.length&&(i.preventDefault(),ut({x:i.clientX,y:i.clientY,row:h}))},[en]),ii=t.useCallback(i=>{const h=new Set(dt);h.has(i)?h.delete(i):h.add(i),Ee?Ee(h):Bt(h)},[dt,Ee]),ai=t.useCallback((i,h)=>{var le;if(!ve)return;h.preventDefault();const f=h.clientX,j=((le=h.target.closest("th"))==null?void 0:le.offsetWidth)??100,C=V=>{const Ce=Math.max(40,j+V.clientX-f);Hn(Be=>({...Be,[i]:Ce}))},J=()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",J)};document.addEventListener("mousemove",C),document.addEventListener("mouseup",J)},[ve]),En=T?((bi=_.sort[0])==null?void 0:bi.field)??"":u??B.field,kn=T?((_i=_.sort[0])==null?void 0:_i.direction)??null:g??B.dir,vt=T?_.page:E??Pe,qe=w??re;t.useCallback(()=>{if(!Cn)return;const i={columnWidths:Dn,sortField:En||void 0,sortDirection:kn,pageSize:Mn,expandedGroups:Array.from(ot)};localStorage.setItem(`nice-datagrid-${Cn}`,JSON.stringify(i)),On==null||On(i)},[Cn,Dn,En,kn,Mn,ot,On]);const _n=t.useMemo(()=>n.filter(i=>!i.hidden),[n]),Gt=t.useMemo(()=>_n.filter(i=>i.pinned==="left"),[_n]),Xt=t.useMemo(()=>_n.filter(i=>i.pinned==="right"),[_n]),ri=t.useMemo(()=>_n.filter(i=>!i.pinned),[_n]),We=t.useMemo(()=>[...Gt,...ri,...Xt],[Gt,ri,Xt]),Bi=t.useMemo(()=>_n.some(i=>i.aggregate),[_n]),jt=Gt.length>0||Xt.length>0,li=t.useCallback(i=>{const h=En===i?kn==="asc"?"desc":kn==="desc"?null:"asc":"asc";T?h?_.setSortField(i,h):_.setSort([]):c?c(i,h):Y({field:i,dir:h})},[En,kn,T,_,c]),yn=t.useMemo(()=>{if(T)return q;let i=[...q];if(tn){const h=tn.toLowerCase();i=i.filter(f=>_n.some(j=>String(f[j.field]??"").toLowerCase().includes(h)))}return cn.items.length>0&&(i=i.filter(h=>ye.Na(h,cn))),!c&&En&&kn&&i.sort((h,f)=>{const j=h[En]??"",C=f[En]??"",J=typeof j=="number"?j-C:String(j).localeCompare(String(C));return kn==="desc"?-J:J}),i},[q,tn,cn,_n,En,kn,c,T]),$t=T?_.totalCount:ie??yn.length,et=se?Pi:T?_.pageSize:Mn,Ki=Math.max(1,Math.ceil($t/et)),zn=T?yn:M&&!ie?yn.slice((vt-1)*et,vt*et):yn,zt=t.useCallback(i=>{T?_.setPage(i):K?K(i):Oe(i)},[T,_,K]),mt=t.useMemo(()=>zn.map(i=>String(i[r])),[zn,r]),ht=mt.length>0&&mt.every(i=>qe.has(i)),si=mt.some(i=>qe.has(i)),ci=t.useCallback(()=>{const i=new Set(qe);ht?mt.forEach(h=>i.delete(h)):mt.forEach(h=>i.add(h)),o?o(i):Ze(i)},[ht,mt,qe,o]),oi=t.useCallback(i=>{const h=new Set(qe);h.has(i)?h.delete(i):h.add(i),o?o(h):Ze(h)},[qe,o]),di=({field:i})=>En!==i||!kn?e.jsx("span",{className:"nice-table__sort-icon",children:e.jsx(ca,{})}):e.jsx("span",{className:"nice-table__sort-icon",children:kn==="asc"?e.jsx(sa,{}):e.jsx(wt,{})}),vn=t.useMemo(()=>{if(!Z)return zn.map((f,j)=>({type:"data",row:f,key:String(f[r]??j)}));const i=new Map;zn.forEach(f=>{const j=f[Z];i.has(j)||i.set(j,[]),i.get(j).push(f)});const h=[];return i.forEach((f,j)=>{const C=`__group_${String(j)}`,J=ot.has(C);h.push({type:"group",value:j,rows:f,expanded:J,key:C}),J&&f.forEach((le,V)=>h.push({type:"data",row:le,key:String(le[r]??`${C}_${V}`)}))}),h},[zn,Z,r,ot]),{pinnedTopRows:Ui,pinnedBottomRows:Gi,normalRows:Xi}=t.useMemo(()=>{if(!(ze!=null&&ze.size)&&!(Ie!=null&&Ie.size))return{pinnedTopRows:[],pinnedBottomRows:[],normalRows:vn};const i=[],h=[],f=[];for(const j of vn){if(j.type==="data"){const C=j.key;if(ze!=null&&ze.has(C)){i.push(j);continue}if(Ie!=null&&Ie.has(C)){h.push(j);continue}}f.push(j)}return{pinnedTopRows:i,pinnedBottomRows:h,normalRows:f}},[vn,ze,Ie]),ui=t.useCallback(i=>{Mt(h=>{const f=new Set(h);return f.has(i)?f.delete(i):f.add(i),f})},[]),Hi=t.useMemo(()=>{var C;if(!de)return vn;const i=((C=yt.current)==null?void 0:C.clientHeight)??400,h=Math.ceil(i/H),f=Math.max(0,Math.floor(Dt/H)-3),j=Math.min(vn.length-1,f+h+6);return vn.slice(f,j+1).map((J,le)=>({...J,_vIdx:f+le}))},[de,vn,Dt,H]),It=t.useCallback((i,h,f)=>{!F||m||(bt({rowKey:i,field:h}),Xn(f))},[F]),mi=t.useCallback(()=>{hn&&F&&F(hn.rowKey,hn.field,ct),bt(null),Xn(null)},[hn,ct,F]),Qi=t.useCallback(()=>{bt(null),Xn(null)},[]),Vi=t.useCallback(()=>{const i=_n,h=i.map(V=>kt(V.header)).join(","),f=yn.map(V=>i.map(Ce=>kt(String(V[Ce.field]??""))).join(",")),j=[h,...f].join(`
|
|
3
|
+
`),C=new Blob(["\uFEFF"+j],{type:"text/csv;charset=utf-8;"}),J=URL.createObjectURL(C),le=document.createElement("a");le.href=J,le.download=`${Ge}.csv`,le.click(),URL.revokeObjectURL(J)},[_n,yn,Ge]),Rt=t.useCallback(i=>{Nn?Nn(i):_e(i)},[Nn]),Ft=t.useCallback(i=>{me?me(i):Te(i)},[me]),jn=t.useMemo(()=>vn.filter(i=>i.type==="data").map(i=>i.key),[vn]),Ji=t.useCallback(i=>{if(!bn||hn||!rn)return;const h=jn.indexOf(rn.rowKey),f=We.findIndex(le=>le.field===rn.field);if(h<0||f<0)return;let j=h,C=f;switch(i.key){case"ArrowUp":j=Math.max(0,h-1);break;case"ArrowDown":j=Math.min(jn.length-1,h+1);break;case"ArrowLeft":C=Math.max(0,f-1);break;case"ArrowRight":C=Math.min(We.length-1,f+1);break;case"Tab":i.preventDefault(),i.shiftKey?C=Math.max(0,f-1):C=Math.min(We.length-1,f+1);break;case"Enter":{const le=We[f];if(le.editable&&F){const V=zn.find(Ce=>String(Ce[r])===rn.rowKey);V&&It(rn.rowKey,le.field,V[le.field])}return}case"Escape":Rt(null),Ft(null);return;case"Home":i.ctrlKey&&(j=0),C=0;break;case"End":i.ctrlKey&&(j=jn.length-1),C=We.length-1;break;case"PageUp":j=Math.max(0,h-Mn);break;case"PageDown":j=Math.min(jn.length-1,h+Mn);break;default:return}i.preventDefault();const J={rowKey:jn[j],field:We[C].field};if(Rt(J),i.shiftKey&&I){const le=(on==null?void 0:on.start)??rn;Ft({start:le,end:J})}else Ft(null)},[bn,hn,rn,jn,We,I,on,Rt,Ft,F,zn,r,It,Mn]),hi=t.useCallback(()=>{let i=[],h=[];if(on){const f=jn.indexOf(on.start.rowKey),j=jn.indexOf(on.end.rowKey),C=Math.min(f,j),J=Math.max(f,j),le=We.findIndex(He=>He.field===on.start.field),V=We.findIndex(He=>He.field===on.end.field),Ce=Math.min(le,V),Be=Math.max(le,V);h=We.slice(Ce,Be+1).map(He=>He.field),i=zn.filter(He=>{const Yn=jn.indexOf(String(He[r]));return Yn>=C&&Yn<=J})}else qe.size>0&&(i=zn.filter(f=>qe.has(String(f[r]))),h=We.map(f=>f.field));return{rows:i,fields:h}},[on,jn,We,zn,r,qe]),pi=t.useCallback((i,h,f)=>{const j=We.filter(C=>h.includes(C.field));switch(f){case"json":return JSON.stringify(i.map(C=>Object.fromEntries(h.map(J=>[J,C[J]]))),null,2);case"csv":{const C=j.map(le=>kt(le.header)).join(","),J=i.map(le=>j.map(V=>kt(String(le[V.field]??""))).join(",")).join(`
|
|
4
|
+
`);return C+`
|
|
5
|
+
`+J}case"html":{const C=j.map(le=>`<th>${le.header}</th>`).join(""),J=i.map(le=>`<tr>${j.map(V=>`<td>${le[V.field]??""}</td>`).join("")}</tr>`).join("");return`<table><thead><tr>${C}</tr></thead><tbody>${J}</tbody></table>`}case"markdown":{const C="| "+j.map(V=>V.header).join(" | ")+" |",J="| "+j.map(()=>"---").join(" | ")+" |",le=i.map(V=>"| "+j.map(Ce=>V[Ce.field]??"").join(" | ")+" |").join(`
|
|
6
|
+
`);return C+`
|
|
7
|
+
`+J+`
|
|
8
|
+
`+le}default:return i.map(C=>j.map(J=>C[J.field]??"").join(" ")).join(`
|
|
9
|
+
`)}},[We]),Ht=t.useCallback(async()=>{if(!be)return;const{rows:i,fields:h}=hi();if(!i.length||(De==null?void 0:De(i,h))===!1)return;const f=pi(i,h,ln);await navigator.clipboard.writeText(f),Le==null||Le(i,h,ln)},[be,hi,De,pi,ln,Le]),gi=t.useCallback(async()=>{if(!be||!rn||!Ye)return;const i=(await navigator.clipboard.readText()).split(`
|
|
10
|
+
`).map(h=>h.split(" "));Ye(i,rn)},[be,rn,Ye]);t.useEffect(()=>{if(!be||!Ut.current)return;const i=h=>{var f;(f=Ut.current)!=null&&f.contains(document.activeElement)&&(h.type==="copy"&&(h.preventDefault(),Ht()),h.type==="paste"&&(h.preventDefault(),gi()))};return document.addEventListener("copy",i),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",i)}},[be,Ht,gi]);const Yi=t.useCallback(i=>{const h=Fn.includes(i)?Fn.filter(f=>f!==i):[...Fn,i];dn?dn(h):$n(h)},[Fn,dn]),Zi=t.useMemo(()=>{if(!(Ne!=null&&Ne.length)||!Fn.length)return yn;const i=Ne.filter(h=>Fn.includes(h.key));return yn.filter(h=>i.every(f=>f.filter(h)))},[yn,Ne,Fn]),fi=Ne!=null&&Ne.length?Zi:yn;t.useCallback(i=>{const h=yn.map(Ce=>Ce[i]).filter(Ce=>Ce!=null),f=h.filter(Ce=>typeof Ce=="number");if(f.length===0){const Ce=new Set(h).size;return{count:h.length,unique:Ce,type:"text"}}const j=f.reduce((Ce,Be)=>Ce+Be,0),C=j/f.length,J=Math.min(...f),le=Math.max(...f),V=Math.sqrt(f.reduce((Ce,Be)=>Ce+(Be-C)**2,0)/f.length);return{count:f.length,sum:j,avg:C,min:J,max:le,stdDev:V,type:"numeric"}},[yn]);const qi=t.useCallback((i,h,f)=>{if(!i.cellVisualization)return null;const j=Number(h);if(isNaN(j))return null;const C=i.visualMin??0,J=i.visualMax??100,le=Math.max(0,Math.min(100,(j-C)/(J-C)*100));switch(i.cellVisualization){case"progress":return e.jsxs("div",{className:"nice-datagrid__cell-progress",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{flex:1,height:6,background:"var(--border-color)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${le}%`,height:"100%",background:le>80?"var(--color-success)":le>50?"var(--color-primary)":"var(--color-warning)",transition:"width 0.3s ease"}})}),e.jsxs("span",{style:{fontSize:"0.75rem",minWidth:32,textAlign:"right"},children:[Math.round(le),"%"]})]});case"rating":{const V=Math.round(j/J*5);return e.jsx("div",{className:"nice-datagrid__cell-rating",children:[1,2,3,4,5].map(Ce=>e.jsx("span",{style:{color:Ce<=V?"var(--color-warning)":"var(--text-muted)",fontSize:"0.95rem",lineHeight:1},"aria-hidden":"true",children:"★"},Ce))})}case"trend":{const V=i.visualMin??j,Ce=j-V,Be=Ce>0?oa:Ce<0?da:ua,He=Ce>0?"var(--color-success)":Ce<0?"var(--color-danger)":"var(--text-muted)";return e.jsxs("span",{style:{color:He,fontWeight:500,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(Be,{})," ",Math.abs(Ce).toFixed(1),"%"]})}case"heatmap":{const V=le/100,Ce=`rgba(${Math.round(255*V)}, ${Math.round(100*(1-V))}, ${Math.round(50*(1-V))}, 0.6)`;return e.jsx("span",{style:{background:Ce,padding:"2px 8px",borderRadius:4},children:j})}default:return null}},[]),ea=t.useCallback((i,h,f)=>{var j;if(!((j=i.conditionalFormats)!=null&&j.length))return{};for(const C of i.conditionalFormats)if(C.when(h,f,i.field))return{className:C.className,style:{...C.style,backgroundColor:C.backgroundColor,color:C.color}};return{}},[]),Qt=t.useCallback((i,h)=>{if(!jt||!i.pinned)return{};const f={position:"sticky",zIndex:2,background:"var(--bg-primary, #fff)"};if(i.pinned==="left"){let j=0;for(let C=0;C<h;C++){const J=We[C];J.pinned==="left"&&(j+=typeof J.width=="number"?J.width:parseInt(String(J.width)||"100",10))}W&&h===0&&(j=36),f.left=j}else{let j=0;for(let C=We.length-1;C>h;C--){const J=We[C];J.pinned==="right"&&(j+=typeof J.width=="number"?J.width:parseInt(String(J.width)||"100",10))}f.right=j}return f},[jt,We,W]),xi=(i,h,f,j)=>(hn==null?void 0:hn.rowKey)===f&&(hn==null?void 0:hn.field)===i.field?i.editor?i.editor(ct,h,J=>Xn(J)):e.jsx("input",{className:"nice-datagrid__edit-input",autoFocus:!0,value:ct??"",onChange:J=>Xn(J.target.value),onBlur:mi,onKeyDown:J=>{J.key==="Enter"&&mi(),J.key==="Escape"&&Qi()}}):qi(i,h[i.field],h)||(i.render?i.render(h[i.field],h,j):ma(h[i.field])),na=(i,h,f,j)=>{const C=(rn==null?void 0:rn.rowKey)===f&&(rn==null?void 0:rn.field)===i.field,J=on&&(()=>{const V=jn.indexOf(on.start.rowKey),Ce=jn.indexOf(on.end.rowKey),Be=jn.indexOf(f),He=We.findIndex(Zn=>Zn.field===on.start.field),Yn=We.findIndex(Zn=>Zn.field===on.end.field);return Be>=Math.min(V,Ce)&&Be<=Math.max(V,Ce)&&j>=Math.min(He,Yn)&&j<=Math.max(He,Yn)})(),le=ea(i,h[i.field],h);return{className:[le.className,C&&"nice-datagrid__cell--focused",J&&"nice-datagrid__cell--in-range"].filter(Boolean).join(" "),style:{...Qt(i,j),textAlign:i.align,...le.style,...C?{outline:"2px solid var(--color-primary)",outlineOffset:-2}:{},...J?{background:"var(--color-primary-light, rgba(59,130,246,0.15))"}:{}}}},Et=We.length+(W?1:0)+(Se?1:0)+(he?1:0)+(qn?1:0),Vt=(i,h,f)=>{const{row:j,key:C}=i,J=qe.has(C),le=dt.has(C),V=Kt.has(C),Ce=[J&&"nice-datagrid__row--selected",Qn===h&&"nice-datagrid__row--dragging",f&&"nice-datagrid__row--pinned",V&&"nice-datagrid__row--flash"].filter(Boolean).join(" ");return e.jsxs(t.Fragment,{children:[e.jsxs("tr",{className:Ce,onClick:()=>P==null?void 0:P(j),onDoubleClick:b==="popup"&&(U||F)?()=>In({key:C,data:{...j}}):void 0,onContextMenu:Be=>Wi(Be,j),style:P||b==="popup"?{cursor:"pointer"}:void 0,draggable:he,onDragStart:he?()=>Vn(h):void 0,onDragOver:he?Be=>Be.preventDefault():void 0,onDrop:he&&z&&Qn!=null?()=>{z(Qn,h),Vn(null)}:void 0,onDragEnd:he?()=>Vn(null):void 0,children:[qn&&e.jsx("td",{className:"nice-datagrid__row-indicator",style:{width:32,padding:"0 4px"},children:qn(j)}),Se&&e.jsx("td",{className:"nice-datagrid__expand-col",onClick:Be=>{Be.stopPropagation(),ii(C)},children:e.jsx("span",{className:"nice-datagrid__expand-btn","data-expanded":le,children:le?e.jsx(wt,{}):e.jsx(Tt,{})})}),he&&e.jsx("td",{className:"nice-datagrid__drag-handle",style:{cursor:"grab",textAlign:"center",color:"var(--text-muted)"},children:"?"}),W&&e.jsx("td",{className:"nice-datagrid__checkbox",onClick:Be=>Be.stopPropagation(),style:jt?{position:"sticky",left:0,zIndex:1,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:J,onChange:()=>oi(C),"aria-label":`Select row ${C}`})}),(()=>{let Be=0;return We.map((He,Yn)=>{if(Be>0)return Be--,null;const Zn=ee?ee(j,He,Yn):void 0;Zn&&Zn>1&&(Be=Zn-1);const yi=na(He,j,C,Yn);return e.jsx("td",{colSpan:Zn,className:yi.className,style:yi.style,onClick:bn?()=>Rt({rowKey:C,field:He.field}):void 0,onDoubleClick:He.editable&&F?()=>It(C,He.field,j[He.field]):void 0,children:xi(He,j,C,h)},He.field)})})()]}),Se&&le&&e.jsx("tr",{className:"nice-datagrid__detail-row",children:e.jsx("td",{colSpan:Et,children:Se(j)})})]},C)};return lt?null:e.jsxs("div",{ref:Ut,className:`nice-datagrid ${An?"nice-datagrid--print":""} ${$e?"nice-datagrid--sticky-header":""} ${$?"nice-datagrid--sticky-footer":""} ${se?"nice-datagrid--auto-pagination":""} ${Sn||""}`,style:gt,role:"grid","aria-label":d("datagrid.title","Data Grid"),"aria-rowcount":vn.length,"aria-colcount":_n.length,"aria-busy":N||void 0,tabIndex:bn?0:void 0,onKeyDown:bn?Ji:void 0,children:[(oe||ce||Ke||(Ne==null?void 0:Ne.length)||X||x)&&e.jsxs("div",{className:"nice-datagrid__toolbar",children:[oe&&e.jsx("div",{className:"nice-datagrid__search",children:e.jsx("input",{type:"text",value:T?_.search:tn,"aria-label":d("controls.search","Search"),onChange:i=>{T?_.setSearch(i.target.value):(un(i.target.value),zt(1))},placeholder:xe||d("controls.search","Search...")})}),x&&e.jsxs("button",{type:"button",className:`nice-datagrid__filter-toggle ${xt>0?"nice-datagrid__filter-toggle--active":""}`,"aria-expanded":ft,onClick:()=>Un(i=>!i),children:[d("controls.filter","Filter"),xt>0?` (${xt})`:""]}),Ne&&Ne.length>0&&e.jsx("div",{className:"nice-datagrid__quick-filters",style:{display:"flex",gap:6,flexWrap:"wrap"},children:Ne.map(i=>e.jsxs("button",{className:`nice-datagrid__quick-filter ${Fn.includes(i.key)?"nice-datagrid__quick-filter--active":""}`,onClick:()=>Yi(i.key),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",fontSize:"0.75rem",border:"1px solid var(--border-color)",borderRadius:12,background:Fn.includes(i.key)?`var(--color-${i.color||"primary"})`:"var(--bg-primary)",color:Fn.includes(i.key)?"var(--bg-primary, #fff)":"inherit",cursor:"pointer",transition:"all 0.15s ease"},children:[i.icon&&e.jsx("span",{children:i.icon}),i.label]},i.key))}),be&&e.jsx("button",{className:"nice-btn nice-btn--sm nice-btn--ghost",onClick:Ht,title:d("controls.copy","Copy selected"),style:{marginLeft:4},children:"??"}),Ke&&e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:Vi,title:d("controls.exportCsv","Export CSV"),children:"CSV ?"}),X&&e.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm nice-btn--primary",onClick:()=>In({key:null,data:{}}),title:d("datagrid.addRow","Add row"),children:["+ ",d("datagrid.add","Add")]}),ce]}),x&&ft&&e.jsx("div",{className:"nice-datagrid__filter-panel",style:{padding:"8px 12px",borderBottom:"1px solid var(--border-color)"},children:e.jsx(At,{fields:Gn,value:cn,onChange:i=>{st(i),zt(1)},presets:y,onSavePreset:D,onDeletePreset:O})}),W&&qe.size>0&&((we==null?void 0:we.length)||Ae)&&e.jsxs("div",{className:"nice-datagrid__bulk-toolbar",role:"toolbar","aria-label":d("datagrid.bulkActions","Bulk actions"),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--bg-tertiary, #f1f5f9)",borderBottom:"1px solid var(--border-color)",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:"0.85rem",color:"var(--text-secondary)"},children:d("datagrid.selectedCount","{count} selected").replace("{count}",String(qe.size))}),(we||[]).map(i=>{var C;const h=Array.from(qe),f=fi.filter(J=>qe.has(String(J[r]))),j=((C=i.disabled)==null?void 0:C.call(i,h,f))||!1;return e.jsxs("button",{type:"button",className:`nice-btn nice-btn--sm nice-btn--${i.variant||"secondary"}`,disabled:j,onClick:()=>i.onClick(h,f),children:[i.icon,i.icon&&" ",i.label]},i.key)}),Ae&&!(we!=null&&we.length)&&e.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm nice-btn--danger",onClick:()=>{const i=Array.from(qe),h=fi.filter(f=>qe.has(String(f[r])));Ae(i,h)},children:["?? ",d("datagrid.deleteSelected","Delete selected")]}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--xs nice-btn--ghost",onClick:()=>{const i=new Set;w===void 0&&Ze(i),o==null||o(i)},style:{marginLeft:"auto"},children:d("datagrid.clearSelection","Clear")})]}),e.jsxs("div",{ref:yt,className:`nice-datagrid__table-wrap ${de?"nice-datagrid__table-wrap--virtual":""}`,style:de?{maxHeight:Math.min(vn.length*H,600),overflowY:"auto"}:void 0,onScroll:de?i=>_t(i.currentTarget.scrollTop):void 0,children:[de&&e.jsxs("div",{style:{height:vn.length*H,position:"relative"},children:[e.jsx("table",{className:`${ue?"nice-table--striped":""} ${Q?"nice-table--compact":""}`,style:{position:"sticky",top:0,zIndex:3},children:e.jsx("thead",{children:e.jsxs("tr",{children:[Se&&e.jsx("th",{className:"nice-datagrid__expand-col",style:{width:36}}),he&&e.jsx("th",{style:{width:28}}),W&&e.jsx("th",{className:"nice-datagrid__checkbox",style:jt?{position:"sticky",left:0,zIndex:3,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:ht,ref:i=>{i&&(i.indeterminate=si&&!ht)},onChange:ci,"aria-label":d("controls.selectAll","Select all")})}),We.map((i,h)=>e.jsxs("th",{style:{width:Dn[i.field]||i.width,minWidth:i.minWidth,textAlign:i.align,position:"relative",...Qt(i,h)},className:s&&i.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>s&&i.sortable!==!1&&li(i.field),children:[i.header,s&&i.sortable!==!1&&e.jsx(di,{field:i.field}),ve&&e.jsx("span",{className:"nice-datagrid__resize-handle",onMouseDown:f=>{f.stopPropagation(),ai(i.field,f)}})]},i.field))]})})}),Hi.map((i,h)=>{const f=i._vIdx??0;if(i.type==="group"){const V=i;return e.jsxs("div",{className:"nice-datagrid__group-row",style:{position:"absolute",top:f*H,height:H,left:0,right:0},onClick:()=>ui(V.key),children:[e.jsx("span",{className:"nice-datagrid__group-toggle",children:V.expanded?e.jsx(wt,{}):e.jsx(Tt,{})}),R?R(V.value,V.rows):e.jsxs(e.Fragment,{children:[String(V.value)," (",V.rows.length,")"]})]},V.key)}const{row:j,key:C}=i,J=qe.has(C),le=dt.has(C);return e.jsxs(t.Fragment,{children:[e.jsxs("div",{className:`nice-datagrid__vrow ${J?"nice-datagrid__row--selected":""} ${Qn===h?"nice-datagrid__row--dragging":""}`,style:{position:"absolute",top:f*H,height:H,left:0,right:0,display:"flex",alignItems:"center"},onClick:()=>P==null?void 0:P(j),onDoubleClick:b==="popup"&&(U||F)?()=>In({key:C,data:{...j}}):void 0,draggable:he,onDragStart:he?()=>Vn(h):void 0,onDragOver:he?V=>V.preventDefault():void 0,onDrop:he&&z&&Qn!=null?()=>{z(Qn,h),Vn(null)}:void 0,onDragEnd:he?()=>Vn(null):void 0,children:[Se&&e.jsx("div",{className:"nice-datagrid__expand-col",style:{width:36,flexShrink:0,textAlign:"center",cursor:"pointer"},onClick:V=>{V.stopPropagation(),ii(C)},children:e.jsx("span",{className:"nice-datagrid__expand-btn","data-expanded":le,children:le?e.jsx(wt,{}):e.jsx(Tt,{})})}),he&&e.jsx("div",{style:{width:28,flexShrink:0,cursor:"grab",textAlign:"center",color:"var(--text-muted)"},children:"?"}),W&&e.jsx("div",{className:"nice-datagrid__checkbox",style:{width:36,flexShrink:0},onClick:V=>V.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:J,onChange:()=>oi(C)})}),We.map(V=>e.jsx("div",{className:"nice-datagrid__vcell",style:{width:Dn[V.field]||V.width||"auto",flex:Dn[V.field]||V.width?`0 0 ${typeof(Dn[V.field]||V.width)=="number"?(Dn[V.field]||V.width)+"px":Dn[V.field]||V.width}`:1,textAlign:V.align,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"0 8px"},onDoubleClick:V.editable&&F?()=>It(C,V.field,j[V.field]):void 0,children:xi(V,j,C,f)},V.field))]}),Se&&le&&e.jsx("div",{className:"nice-datagrid__detail-row",style:{position:"absolute",top:(f+1)*H,left:0,right:0,padding:"8px 12px",background:"var(--bg-secondary, #f8f8f8)"},children:Se(j)})]},C)})]}),!de&&e.jsxs("table",{className:`${ue?"nice-table--striped":""} ${Q?"nice-table--compact":""}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[Se&&e.jsx("th",{className:"nice-datagrid__expand-col",style:{width:36}}),he&&e.jsx("th",{style:{width:28}}),W&&e.jsx("th",{className:"nice-datagrid__checkbox",style:jt?{position:"sticky",left:0,zIndex:3,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:ht,ref:i=>{i&&(i.indeterminate=si&&!ht)},onChange:ci,"aria-label":d("controls.selectAll","Select all")})}),We.map((i,h)=>{const f=s&&i.sortable!==!1,j=f?En===i.field?kn==="asc"?"ascending":kn==="desc"?"descending":"none":"none":void 0;return e.jsxs("th",{style:{width:Dn[i.field]||i.width,minWidth:i.minWidth,textAlign:i.align,position:"relative",...Qt(i,h)},className:f?"nice-datagrid__th--sortable":void 0,onClick:()=>f&&li(i.field),"aria-sort":j,scope:"col",children:[i.header,f&&e.jsx(di,{field:i.field}),ve&&e.jsx("span",{className:"nice-datagrid__resize-handle",onMouseDown:C=>{C.stopPropagation(),ai(i.field,C)}})]},i.field)})]})}),e.jsx("tbody",{children:N?e.jsx("tr",{children:e.jsx("td",{colSpan:Et,className:"nice-datagrid__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):vn.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:Et,className:"nice-datagrid__empty",children:A||d("controls.noData","No data available")})}):e.jsxs(e.Fragment,{children:[Ui.map((i,h)=>i.type==="data"&&Vt(i,h,"top")),Xi.map((i,h)=>{if(i.type==="group"){const f=i;return e.jsx("tr",{className:"nice-datagrid__group-row",onClick:()=>ui(f.key),children:e.jsxs("td",{colSpan:Et,className:"nice-datagrid__group-cell",children:[e.jsx("span",{className:"nice-datagrid__group-toggle",children:f.expanded?e.jsx(wt,{}):e.jsx(Tt,{})}),R?R(f.value,f.rows):e.jsxs(e.Fragment,{children:[String(f.value)," (",f.rows.length,")"]})]})},f.key)}return Vt(i,h)}),Gi.map((i,h)=>i.type==="data"&&Vt(i,h,"bottom"))]})}),Bi&&!N&&zn.length>0&&e.jsx("tfoot",{children:e.jsxs("tr",{className:"nice-datagrid__aggregate-row",children:[W&&e.jsx("td",{}),We.map(i=>e.jsx("td",{style:{textAlign:i.align,fontWeight:600},children:i.aggregate?(i.aggregateLabel||i.aggregate.toUpperCase())+": "+Mi(yn,i.field,i.aggregate):""},i.field))]})})]})]}),M&&e.jsxs("div",{className:"nice-datagrid__footer",children:[e.jsxs("span",{className:"nice-datagrid__footer-info",children:[d("controls.showing","Showing")," ",(vt-1)*et+1,"–",Math.min(vt*et,$t)," ",d("controls.of","of")," ",$t,se&&e.jsxs("span",{className:"nice-datagrid__page-size-label",children:[" · ",et," ",d("controls.perPage","/ page")]})]}),e.jsx(Ni,{page:vt,totalPages:Ki,onChange:zt,showInfo:!0,pageSize:et,showPageSize:!se,pageSizeOptions:[5,10,25,50,100],onPageSizeChange:i=>{T?_.setPageSize(i):(Ot(i),zt(1))},showFirstLast:!0})]}),Je&&!N&&e.jsxs("div",{className:"nice-datagrid__status-bar",children:[e.jsxs("span",{children:[d("controls.totalRows","Total rows"),": ",$t]}),W&&qe.size>0&&e.jsxs("span",{children:[d("controls.selected","Selected"),": ",qe.size]})]}),Jn&&en&&e.jsx("div",{className:"nice-datagrid__context-menu",style:{position:"fixed",left:Jn.x,top:Jn.y,zIndex:9999},onClick:i=>i.stopPropagation(),children:en.map(i=>e.jsxs("button",{className:"nice-datagrid__context-item",disabled:i.disabled,onClick:()=>{ke==null||ke(i.key,Jn.row),ut(null)},children:[i.icon&&e.jsx("span",{className:"nice-datagrid__context-icon",children:i.icon}),i.label]},i.key))}),(b==="popup"||X)&&pn&&(()=>{const i=pn.key===null,h=je??n.filter(f=>!f.hidden&&f.field!==r).map(f=>{var C;let j="text";return f.dataType==="number"||f.dataType==="currency"||f.dataType==="percent"?j="number":f.dataType==="boolean"?j="checkbox":f.dataType==="date"&&(j="date"),{field:f.field,label:f.header,type:j,required:(C=f.validation)==null?void 0:C.required}});return e.jsx(Yt,{open:!0,onClose:()=>In(null),title:G??(i?d("datagrid.addRow","Add row"):d("datagrid.editRow","Edit row")),size:"lg",children:e.jsx(Fe.Ga,{items:h,data:pn.data,columns:pe,showActions:!0,submitLabel:i?d("controls.add","Add"):d("controls.save","Save"),cancelLabel:d("controls.cancel","Cancel"),onCancel:()=>In(null),...ne,onFieldChange:(f,j)=>In(C=>C&&{...C,data:{...C.data,[f]:j}}),onSubmit:f=>{i?X==null||X(f):pn.key&&(U?U(pn.key,f):F&&Object.keys(f).forEach(j=>{F(pn.key,j,f[j])})),In(null)}})})})()]})}Ct.displayName="NiceDataGrid";const ha=Object.freeze(Object.defineProperty({__proto__:null,NiceDataGrid:Ct},Symbol.toStringTag,{value:"Module"}));function pa(n,a){return n.filter(r=>a.every(l=>{const s=r[l.field],u=l.value;switch(l.operator){case"eq":return s===u;case"ne":return s!==u;case"gt":return typeof s=="number"&&typeof u=="number"&&s>u;case"gte":return typeof s=="number"&&typeof u=="number"&&s>=u;case"lt":return typeof s=="number"&&typeof u=="number"&&s<u;case"lte":return typeof s=="number"&&typeof u=="number"&&s<=u;case"contains":return String(s).toLowerCase().includes(String(u).toLowerCase());case"startsWith":return String(s).toLowerCase().startsWith(String(u).toLowerCase());case"endsWith":return String(s).toLowerCase().endsWith(String(u).toLowerCase());default:return!0}}))}function ga(n){return n.map(a=>({field:a.field,type:a.dataType||"string",label:typeof a.header=="string"?a.header:a.field}))}function fa(n,a){const{enableAI:r=!0,aiModel:l,enableNLSearch:s=!0,enableInsights:u=!0,nlPlaceholder:g,onAIFilter:c,onInsights:x,showAISearchBar:k=!0,exampleQueries:S=["Show items from last week","Filter by status = active","Orders over $1000",'Names starting with "A"'],columns:L,data:y,...D}=n,[O,W]=t.useState(""),[w,o]=t.useState([]),[M,p]=t.useState([]),[E,K]=t.useState(!1),[ie,se]=t.useState(null),$e=t.useRef(null),{t:$}=ye.ce(),oe=ye.ge(),{parseFilter:xe,isLoading:de}=ye.rc(),H=r&&oe.isConfigured,Z=w.length>0?pa(y||[],w):y,R=t.useCallback(async ne=>{if(!H||!s||!ne.trim())return;se(ne);const U=ga(L);try{const X=await xe(ne,U);o(X),c==null||c(ne,X)}catch{o([])}},[H,s,L,xe,c]),F=t.useCallback(()=>{o([]),se(null),W("")},[]),b=t.useCallback(()=>w,[w]),je=t.useCallback(async()=>{if(!H||!u||!(y!=null&&y.length))return[];try{const ne=await oe.complete([{role:"user",content:`Analyze this data and provide 3-5 key insights. Data sample (${y.length} total rows): ${JSON.stringify(y.slice(0,20))}
|
|
11
|
+
|
|
12
|
+
Columns: ${L.map(U=>U.field).join(", ")}
|
|
13
|
+
|
|
14
|
+
Return a JSON array of insight strings. Be specific with numbers and trends.`}],{temperature:.3,maxTokens:500});try{const U=JSON.parse(ne.content),X=Array.isArray(U)?U:[];return p(X),x==null||x(X),X}catch{return[]}}catch{return[]}},[H,u,y,L,oe,x]),pe=ne=>{ne.preventDefault(),O.trim()&&R(O)},G=ne=>{W(ne),R(ne)};return t.useImperativeHandle(a,()=>({applyNLFilter:R,clearAIFilters:F,getAIFilters:b,generateInsights:je})),e.jsxs("div",{className:"nice-data-grid-ai","data-testid":n["data-testid"],children:[k&&H&&s&&e.jsxs("div",{className:"nice-data-grid-ai__search-bar",children:[e.jsx("div",{className:"nice-data-grid-ai__search-left",children:e.jsx("span",{className:"nice-data-grid-ai__badge",children:"AI"})}),e.jsxs("form",{onSubmit:pe,className:"nice-data-grid-ai__search-form",children:[e.jsxs("div",{className:"nice-data-grid-ai__input-wrapper",children:[e.jsx("span",{className:"nice-data-grid-ai__search-icon",children:"🔍"}),e.jsx("input",{ref:$e,type:"text",value:O,onChange:ne=>W(ne.target.value),placeholder:g||$("dataGridAI.searchPlaceholder","Search with natural language..."),className:"nice-data-grid-ai__input",disabled:de}),de&&e.jsx("span",{className:"nice-data-grid-ai__loading-spinner"}),O&&!de&&e.jsx("button",{type:"button",className:"nice-data-grid-ai__clear-input",onClick:()=>W(""),children:"✕"})]}),e.jsx("button",{type:"submit",className:"nice-data-grid-ai__search-btn",disabled:de||!O.trim(),children:de?$("dataGridAI.searching","Searching..."):$("dataGridAI.search","Search")})]}),u&&e.jsxs("button",{type:"button",className:"nice-data-grid-ai__insights-btn",onClick:()=>{je(),K(!0)},disabled:de||!(y!=null&&y.length),title:$("dataGridAI.generateInsights","Generate AI Insights"),children:["💡 ",$("dataGridAI.insights","Insights")]})]}),k&&H&&s&&!ie&&S.length>0&&e.jsxs("div",{className:"nice-data-grid-ai__examples",children:[e.jsx("span",{className:"nice-data-grid-ai__examples-label",children:$("dataGridAI.tryAsking","Try asking:")}),e.jsx("div",{className:"nice-data-grid-ai__examples-list",children:S.slice(0,4).map((ne,U)=>e.jsxs("button",{type:"button",className:"nice-data-grid-ai__example",onClick:()=>G(ne),children:['"',ne,'"']},U))})]}),ie&&w.length>0&&e.jsxs("div",{className:"nice-data-grid-ai__active-filter",children:[e.jsxs("div",{className:"nice-data-grid-ai__filter-info",children:[e.jsx("span",{className:"nice-data-grid-ai__filter-icon",children:"🎯"}),e.jsxs("span",{className:"nice-data-grid-ai__filter-query",children:['"',ie,'"']}),e.jsxs("span",{className:"nice-data-grid-ai__filter-count",children:["(",(Z==null?void 0:Z.length)||0," ",$("dataGridAI.results","results"),")"]})]}),e.jsx("div",{className:"nice-data-grid-ai__filter-badges",children:w.map((ne,U)=>e.jsxs("span",{className:"nice-data-grid-ai__filter-badge",children:[ne.field," ",ne.operator," ",String(ne.value)]},U))}),e.jsxs("button",{type:"button",className:"nice-data-grid-ai__clear-filter",onClick:F,children:["✕ ",$("dataGridAI.clearFilter","Clear")]})]}),e.jsx("div",{className:"nice-data-grid-ai__grid-wrapper",children:e.jsx(Ct,{columns:L,data:Z,...D})}),E&&e.jsxs("div",{className:"nice-data-grid-ai__insights-panel",children:[e.jsxs("div",{className:"nice-data-grid-ai__insights-header",children:[e.jsxs("h4",{children:["💡 ",$("dataGridAI.aiInsights","AI Insights")]}),e.jsx("button",{type:"button",className:"nice-data-grid-ai__insights-close",onClick:()=>K(!1),children:"✕"})]}),e.jsx("div",{className:"nice-data-grid-ai__insights-body",children:de?e.jsx("div",{className:"nice-data-grid-ai__insights-loading",children:$("dataGridAI.analyzing","Analyzing data...")}):M.length>0?e.jsx("ul",{className:"nice-data-grid-ai__insights-list",children:M.map((ne,U)=>e.jsxs("li",{className:"nice-data-grid-ai__insight",children:[e.jsx("span",{className:"nice-data-grid-ai__insight-bullet",children:"•"}),ne]},U))}):e.jsx("div",{className:"nice-data-grid-ai__insights-empty",children:$("dataGridAI.noInsights","Click to generate insights from your data")})}),e.jsx("div",{className:"nice-data-grid-ai__insights-footer",children:e.jsxs("button",{type:"button",className:"nice-data-grid-ai__refresh-insights",onClick:()=>je(),disabled:de,children:["🔄 ",$("dataGridAI.refresh","Refresh")]})})]})]})}t.forwardRef(fa);const Di=({items:n,selectedKeys:a=[],onSelectionChange:r,selectionMode:l="none",searchable:s,searchPlaceholder:u,grouped:g,groupField:c="group",reorderable:x,onReorder:k,onItemClick:S,renderItem:L,showCheckboxes:y,loading:D,emptyText:O,size:W="md",bordered:w=!0,swipeActions:o,className:M,style:p,accessMode:E,id:K})=>{const ie=ye.Nl(E,K)==="hidden",{t:se}=ye.ce(),[$e,$]=t.useState(""),[oe,xe]=t.useState(null),[de,H]=t.useState(null),Z=t.useRef(null),R=t.useMemo(()=>{if(!$e)return n;const G=$e.toLowerCase();return n.filter(ne=>ne.text.toLowerCase().includes(G))},[n,$e]),F=t.useMemo(()=>{if(!g)return null;const G=new Map;return R.forEach(ne=>{const U=String(ne[c]??"");G.has(U)||G.set(U,[]),G.get(U).push(ne)}),G},[R,g,c]),b=t.useCallback(G=>{r&&(l==="single"?r(a.includes(G)?[]:[G]):l==="multiple"&&r(a.includes(G)?a.filter(ne=>ne!==G):[...a,G]))},[a,l,r]),je=t.useCallback(G=>{oe!==null&&oe!==G&&k&&k(oe,G),xe(null)},[oe,k]),pe=(G,ne)=>{const U=a.includes(G.key),X=de===G.key;return e.jsxs("li",{className:`nice-list__item ${U?"nice-list__item--selected":""} ${G.disabled?"nice-list__item--disabled":""} ${X?"nice-list__item--swiped":""}`,onClick:()=>{G.disabled||(b(G.key),S==null||S(G))},draggable:x,onDragStart:()=>xe(ne),onDragOver:ge=>ge.preventDefault(),onDrop:()=>je(ne),onTouchStart:o!=null&&o.length?ge=>{Z.current={x:ge.touches[0].clientX,key:G.key}}:void 0,onTouchEnd:o!=null&&o.length?ge=>{if(!Z.current)return;const we=ge.changedTouches[0].clientX-Z.current.x;we<-50&&Z.current.key===G.key?H(G.key):we>50&&H(null),Z.current=null}:void 0,role:l!=="none"?"option":void 0,"aria-selected":l!=="none"?U:void 0,children:[e.jsxs("div",{className:"nice-list__item-content",children:[y&&l!=="none"&&e.jsx("input",{type:"checkbox",checked:U,readOnly:!0,tabIndex:-1,className:"nice-list__checkbox"}),L?L(G):e.jsxs(e.Fragment,{children:[G.icon&&e.jsx("span",{className:"nice-list__icon",children:G.icon}),e.jsx("span",{className:"nice-list__text",children:G.text}),G.badge&&e.jsx("span",{className:"nice-list__badge",children:G.badge})]})]}),o&&X&&e.jsx("div",{className:"nice-list__swipe-actions",children:o.map(ge=>e.jsx("button",{className:"nice-list__swipe-btn",style:ge.color?{backgroundColor:ge.color}:void 0,onClick:we=>{we.stopPropagation(),ge.onClick(G),H(null)},children:ge.label},ge.key))})]},G.key)};return ie?null:e.jsxs("div",{className:`nice-list nice-list--${W} ${w?"nice-list--bordered":""} ${M||""}`,style:p,children:[s&&e.jsx("div",{className:"nice-list__search",children:e.jsx("input",{type:"text",value:$e,onChange:G=>$(G.target.value),placeholder:u||se("controls.search","Search...")})}),D?e.jsx("div",{className:"nice-list__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--sm"})}):R.length===0?e.jsx("div",{className:"nice-list__empty",children:O||se("controls.noData","No data available")}):F?e.jsx("div",{role:"listbox",children:Array.from(F.entries()).map(([G,ne])=>e.jsxs("div",{className:"nice-list__group",children:[e.jsx("div",{className:"nice-list__group-header",children:G}),e.jsx("ul",{className:"nice-list__items",children:ne.map((U,X)=>pe(U,X))})]},G))}):e.jsx("ul",{className:"nice-list__items",role:"listbox",children:R.map((G,ne)=>pe(G,ne))})]})};function $i(n){const a=[];if(n.children)for(const r of n.children)a.push(r.key),a.push(...$i(r));return a}function Jt(n,a){if(!n.children||n.children.length===0)return a.has(n.key)?"checked":"unchecked";let r=!0,l=a.has(n.key);for(const s of n.children){const u=Jt(s,a);u==="checked"?l=!0:(u==="indeterminate"&&(l=!0),r=!1)}return r&&l?"checked":l?"indeterminate":"unchecked"}const zi=({nodes:n,selectedKeys:a=[],expandedKeys:r,onSelectionChange:l,onExpandedChange:s,selectionMode:u="none",showCheckboxes:g,searchable:c,searchPlaceholder:x,onNodeClick:k,renderNode:S,showLines:L,loading:y,className:D,style:O,accessMode:W,id:w,draggable:o,onNodeDrop:M,onLoadChildren:p,contextMenuItems:E,onContextMenuAction:K,editable:ie,onNodeEdit:se,maxDepth:$e})=>{const $=ye.Nl(W,w)==="hidden",{t:oe}=ye.ce(),[xe,de]=t.useState([]),[H,Z]=t.useState(""),[R,F]=t.useState(new Set),[b,je]=t.useState(new Map),[pe,G]=t.useState(null),[ne,U]=t.useState(null),[X,ge]=t.useState(null),[we,Ae]=t.useState(""),Ke=t.useRef(null),Ge=r??xe,Se=t.useMemo(()=>new Set(a),[a]),Ue=t.useCallback(async(z,ue)=>{var A;const Q=!Ge.includes(z),fe=Q?[...Ge,z]:Ge.filter(ce=>ce!==z);if(s?s(fe):de(fe),Q&&p&&!((A=ue.children)!=null&&A.length)&&ue.leaf!==!0&&!b.has(z)){F(P=>new Set(P).add(z));const ce=await p(ue);je(P=>new Map(P).set(z,ce)),F(P=>{const ze=new Set(P);return ze.delete(z),ze})}},[Ge,s,p,b]),Ee=t.useCallback((z,ue)=>{var Q;if(l){if(u==="single")l(a.includes(z)?[]:[z]);else if(u==="multiple")if(g&&((Q=ue.children)!=null&&Q.length)){const fe=$i(ue),A=[z,...fe];if(Jt(ue,Se)==="checked")l(a.filter(ce=>!A.includes(ce)));else{const ce=new Set([...a,...A]);l(Array.from(ce))}}else l(a.includes(z)?a.filter(fe=>fe!==z):[...a,z])}},[a,u,l,g,Se]),Xe=t.useCallback(z=>{var Q;if(!H)return!0;const ue=H.toLowerCase();return z.text.toLowerCase().includes(ue)?!0:((Q=b.get(z.key)??z.children)==null?void 0:Q.some(fe=>Xe(fe)))??!1},[H,b]),te=t.useCallback((z,ue)=>{E!=null&&E.length&&(z.preventDefault(),U({x:z.clientX,y:z.clientY,node:ue}))},[E]),ve=t.useCallback(()=>{X&&se&&se(X,we),ge(null)},[X,we,se]),he=(z,ue)=>{if(H&&!Xe(z))return null;const Q=typeof $e=="number"?Math.min(10,Math.max(1,$e)):1/0,fe=ue+1>=Q,A=fe?void 0:b.get(z.key)??z.children,ce=!fe&&(A&&A.length>0||z.leaf!==!0&&p&&!(A!=null&&A.length)),P=Ge.includes(z.key),ze=Se.has(z.key),Ie=R.has(z.key),ee=g&&u==="multiple"&&(A!=null&&A.length)?Jt(z,Se):ze?"checked":"unchecked",Je=Math.min(ue+1,10),en={paddingLeft:ue*20+4,"--nice-row-bg":`var(--nice-tree-level-${Je}-bg, transparent)`,"--nice-row-text":`var(--nice-tree-level-${Je}-text, inherit)`,"--nice-row-border":`var(--nice-tree-level-${Je}-border, transparent)`,"--nice-row-hover-bg":`var(--nice-tree-level-${Je}-hover-bg, var(--hover-bg, color-mix(in srgb, var(--text-primary) 6%, transparent)))`,"--nice-row-active-bg":`var(--nice-tree-level-${Je}-active-bg, color-mix(in srgb, var(--color-primary) 14%, transparent))`};return e.jsxs("li",{className:"nice-tree__node",role:"treeitem","aria-expanded":ce?P:void 0,"data-nice-depth":Je,draggable:o&&!z.disabled,onDragStart:o?ke=>{ke.stopPropagation(),G(z.key)}:void 0,onDragOver:o?ke=>{ke.preventDefault(),ke.stopPropagation()}:void 0,onDrop:o&&pe?ke=>{ke.stopPropagation(),M==null||M(pe,z.key,"inside"),G(null)}:void 0,onDragEnd:o?()=>G(null):void 0,children:[e.jsxs("div",{className:`nice-tree__row ${ze?"nice-tree__row--selected":""} ${z.disabled?"nice-tree__row--disabled":""} ${pe===z.key?"nice-tree__row--dragging":""}`,style:en,onClick:()=>{z.disabled||(Ee(z.key,z),k==null||k(z))},onContextMenu:ke=>te(ke,z),onDoubleClick:ie&&!z.disabled?()=>{ge(z.key),Ae(z.text)}:void 0,children:[e.jsx("span",{className:`nice-tree__toggle ${ce?P?"nice-tree__toggle--expanded":"":"nice-tree__toggle--leaf"}`,onClick:ke=>{ke.stopPropagation(),ce&&Ue(z.key,z)},children:Ie?e.jsx("span",{className:"nice-spinner nice-spinner--xs"}):ce?P?"▾":"▸":""}),g&&u!=="none"&&e.jsx("input",{type:"checkbox",checked:ee==="checked",ref:ke=>{ke&&(ke.indeterminate=ee==="indeterminate")},onChange:()=>Ee(z.key,z),onClick:ke=>ke.stopPropagation(),tabIndex:-1,className:"nice-tree__checkbox"}),X===z.key?e.jsx("input",{type:"text",className:"nice-tree__edit-input",value:we,onChange:ke=>Ae(ke.target.value),onBlur:ve,onKeyDown:ke=>{ke.key==="Enter"&&ve(),ke.key==="Escape"&&ge(null)},autoFocus:!0,onClick:ke=>ke.stopPropagation()}):S?S(z):e.jsxs(e.Fragment,{children:[z.icon&&e.jsx("span",{className:"nice-tree__icon",children:z.icon}),e.jsx("span",{className:"nice-tree__text",children:z.text})]})]}),A&&A.length>0&&P&&e.jsx("ul",{className:"nice-tree__children",role:"group",children:A.map(ke=>he(ke,ue+1))})]},z.key)};return $?null:e.jsxs("div",{className:`nice-tree ${L?"nice-tree--lines":""} ${D||""}`,style:O,ref:Ke,onClick:()=>U(null),children:[c&&e.jsx("div",{className:"nice-tree__search",children:e.jsx("input",{type:"text",value:H,onChange:z=>Z(z.target.value),placeholder:x||oe("controls.search","Search..."),"aria-label":x||oe("controls.search","Search tree")})}),y?e.jsx("div",{className:"nice-tree__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--sm"})}):e.jsx("ul",{className:"nice-tree__root",role:"tree",children:n.map(z=>he(z,0))}),ne&&E&&e.jsx("div",{className:"nice-tree__context-menu",style:{position:"fixed",top:ne.y,left:ne.x,zIndex:9999},children:E.map(z=>e.jsxs("div",{className:`nice-tree__context-item ${z.disabled?"nice-tree__context-item--disabled":""}`,onClick:()=>{z.disabled||(K==null||K(z.key,ne.node),U(null))},children:[z.icon&&e.jsx("span",{children:z.icon}),z.label]},z.key))})]})};function xa(n,a,r){const l=new Map,s=[];return n.forEach(u=>{const g={...u,children:[]};l.set(String(g[a]),g)}),n.forEach(u=>{const g=u[r];g!=null&&l.has(String(g))?l.get(String(g)).children.push(l.get(String(u[a]))):s.push(l.get(String(u[a])))}),s}function Ii({columns:n,data:a,keyField:r="key",parentKeyField:l="parentKey",expandedKeys:s,onExpandedChange:u,selectedKeys:g=[],onSelectionChange:c,selectable:x,loading:k,emptyText:S,className:L,style:y,accessMode:D,id:O}){const W=ye.Nl(D,O)==="hidden",{t:w}=ye.ce(),[o,M]=t.useState([]),p=s??o,E=t.useMemo(()=>xa(a,r,l),[a,r,l]),K=t.useMemo(()=>n.filter($=>!$.hidden),[n]),ie=t.useCallback($=>{const oe=p.includes($)?p.filter(xe=>xe!==$):[...p,$];u?u(oe):M(oe)},[p,u]),se=t.useCallback($=>{c&&c(g.includes($)?g.filter(oe=>oe!==$):[...g,$])},[g,c]),$e=($,oe)=>{const xe=String($[r]),de=$.children&&$.children.length>0,H=p.includes(xe),Z=g.includes(xe);return e.jsxs(t.Fragment,{children:[e.jsxs("tr",{className:Z?"nice-treelist__row--selected":"",children:[x&&e.jsx("td",{className:"nice-treelist__checkbox",children:e.jsx("input",{type:"checkbox",checked:Z,onChange:()=>se(xe)})}),K.map((R,F)=>e.jsxs("td",{style:{textAlign:R.align},children:[F===0&&e.jsx("span",{style:{display:"inline-block",width:oe*20}}),F===0&&e.jsx("span",{className:"nice-treelist__toggle",onClick:()=>de&&ie(xe),style:{cursor:de?"pointer":"default",width:20,display:"inline-block"},children:de?H?"▾":"▸":""}),R.render?R.render($[R.field],$,0):String($[R.field]??"")]},R.field))]}),de&&H&&$.children.map(R=>$e(R,oe+1))]},xe)};return W?null:e.jsx("div",{className:`nice-treelist ${L||""}`,style:y,children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[x&&e.jsx("th",{className:"nice-treelist__checkbox"}),K.map($=>e.jsx("th",{style:{width:$.width,minWidth:$.minWidth,textAlign:$.align},children:$.header},$.field))]})}),e.jsx("tbody",{children:k?e.jsx("tr",{children:e.jsx("td",{colSpan:K.length+(x?1:0),className:"nice-treelist__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):E.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:K.length+(x?1:0),className:"nice-treelist__empty",children:S||w("controls.noData","No data available")})}):E.map($=>$e($,0))})]})})}function Ri({items:n,renderCard:a,columns:r=3,gap:l=16,searchable:s,searchField:u="text",searchPlaceholder:g,loading:c,emptyText:x,onCardClick:k,className:S,style:L,accessMode:y,id:D}){const O=ye.Nl(y,D)==="hidden",{t:W}=ye.ce(),[w,o]=t.useState(""),M=t.useMemo(()=>{if(!w)return n;const p=w.toLowerCase();return n.filter(E=>String(E[u]??"").toLowerCase().includes(p))},[n,w,u]);return O?null:e.jsxs("div",{className:`nice-cardview ${S||""}`,style:L,children:[s&&e.jsx("div",{className:"nice-cardview__search",children:e.jsx("input",{type:"text",value:w,onChange:p=>o(p.target.value),placeholder:g||W("controls.search","Search...")})}),c?e.jsx("div",{className:"nice-cardview__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):M.length===0?e.jsx("div",{className:"nice-cardview__empty",children:x||W("controls.noData","No data available")}):e.jsx("div",{className:"nice-cardview__grid",style:{display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gap:l},children:M.map(p=>e.jsx("div",{className:"nice-cardview__card",onClick:()=>k==null?void 0:k(p),style:k?{cursor:"pointer"}:void 0,children:a(p)},p.key))})]})}function Fi({items:n,tileWidth:a=180,tileHeight:r=180,direction:l="horizontal",renderTile:s,onTileClick:u,loading:g,emptyText:c,className:x,style:k}){const{t:S}=ye.ce();return e.jsx("div",{className:`nice-tileview nice-tileview--${l} ${x||""}`,style:k,children:g?e.jsx("div",{className:"nice-tileview__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):n.length===0?e.jsx("div",{className:"nice-tileview__empty",children:c||S("controls.noData","No data available")}):e.jsx("div",{className:"nice-tileview__container",style:{display:"flex",flexWrap:"wrap",gap:8,flexDirection:l==="vertical"?"column":"row"},children:n.map(L=>e.jsx("div",{className:"nice-tileview__tile",style:{width:a,height:r,cursor:u?"pointer":void 0},onClick:()=>u==null?void 0:u(L),children:s?s(L):e.jsxs(e.Fragment,{children:[L.image&&e.jsx("img",{src:L.image,alt:L.text||"",className:"nice-tileview__image"}),L.text&&e.jsx("div",{className:"nice-tileview__label",children:L.text})]})},L.key))})})}const vi=[{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],Zt=({fields:n,onChange:a,className:r,style:l})=>{const s=n.filter(c=>!c.area),u=(c,x)=>{a(n.map(k=>k.field===c?{...k,area:x}:k))},g=c=>{a(n.map(x=>x.field===c?{...x,area:void 0}:x))};return e.jsx("div",{className:`nice-field-chooser ${r||""}`,style:l,children:e.jsxs("div",{className:"nice-field-chooser__panel",children:[e.jsxs("div",{className:"nice-field-chooser__section",children:[e.jsx("h4",{children:"Available Fields"}),e.jsx("ul",{children:s.map(c=>e.jsxs("li",{className:"nice-field-chooser__item",children:[e.jsx("span",{children:c.caption}),e.jsx("div",{className:"nice-field-chooser__actions",children:vi.map(x=>e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--sm",onClick:()=>u(c.field,x.key),children:x.label},x.key))})]},c.field))})]}),vi.map(c=>{const x=n.filter(k=>k.area===c.key);return e.jsxs("div",{className:"nice-field-chooser__section",children:[e.jsx("h4",{children:c.label}),e.jsx("ul",{children:x.map(k=>e.jsxs("li",{className:"nice-field-chooser__item",children:[e.jsx("span",{children:k.caption}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--sm",onClick:()=>g(k.field),children:"✕"})]},k.field))})]},c.key)})]})})};function ba(n,a){if(n.length===0)return 0;switch(a){case"sum":return n.reduce((r,l)=>r+l,0);case"count":return n.length;case"avg":return n.reduce((r,l)=>r+l,0)/n.length;case"min":return Math.min(...n);case"max":return Math.max(...n);default:return n.reduce((r,l)=>r+l,0)}}function ji(n,a){return[...new Set(n.map(r=>String(r[a]??"")))].sort()}const qt=({data:n,fields:a,onFieldsChange:r,showFieldChooser:l,loading:s,emptyText:u,exportCsv:g,exportFilename:c="pivot-export",onDrillThrough:x,className:k,style:S,accessMode:L,id:y})=>{const D=ye.Nl(L,y)==="hidden",{t:O}=ye.ce(),[W,w]=t.useState(a),[o,M]=t.useState(!1),p=t.useMemo(()=>W.filter(H=>H.area==="row"),[W]),E=t.useMemo(()=>W.filter(H=>H.area==="column"),[W]),K=t.useMemo(()=>W.filter(H=>H.area==="data"),[W]),ie=t.useMemo(()=>p.length===0?["Total"]:ji(n,p[0].field),[n,p]),se=t.useMemo(()=>E.length===0?["Total"]:ji(n,E[0].field),[n,E]),$e=t.useCallback((H,Z,R)=>{let F=n;p.length>0&&(F=F.filter(pe=>String(pe[p[0].field])===H)),E.length>0&&(F=F.filter(pe=>String(pe[E[0].field])===Z));const b=F.map(pe=>Number(pe[R.field])||0),je=ba(b,R.summaryType||"sum");return R.format?R.format(je):je},[n,p,E]),$=t.useCallback(H=>{w(H),r==null||r(H)},[r]),oe=t.useCallback((H,Z)=>{let R=n;return p.length>0&&(R=R.filter(F=>String(F[p[0].field])===H)),E.length>0&&(R=R.filter(F=>String(F[E[0].field])===Z)),R},[n,p,E]),xe=t.useCallback((H,Z)=>{x&&x(H,Z,oe(H,Z))},[x,oe]),de=t.useCallback(()=>{const H=["",...se.flatMap(pe=>K.length>0?K.map(G=>`${pe} - ${G.caption}`):[pe])],Z=ie.map(pe=>{const G=se.flatMap(ne=>K.length>0?K.map(U=>String($e(pe,ne,U))):["—"]);return[pe,...G]}),R=[H,...Z].map(pe=>pe.map(G=>`"${String(G).replace(/"/g,'""')}"`).join(",")).join(`
|
|
15
|
+
`),F=new Blob(["\uFEFF"+R],{type:"text/csv;charset=utf-8;"}),b=URL.createObjectURL(F),je=document.createElement("a");je.href=b,je.download=`${c}.csv`,je.click(),URL.revokeObjectURL(b)},[se,ie,K,$e,c]);return D?null:e.jsxs("div",{className:`nice-pivotgrid ${k||""}`,style:S,children:[(l||g)&&e.jsxs("div",{className:"nice-pivotgrid__toolbar",children:[l&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm",onClick:()=>M(!o),children:O("controls.fieldChooser","Field Chooser")}),g&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:de,children:"CSV ↓"})]}),o&&e.jsx(Zt,{fields:W,onChange:$}),s?e.jsx("div",{className:"nice-pivotgrid__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):e.jsx("div",{className:"nice-pivotgrid__table-wrap",children:e.jsxs("table",{className:"nice-pivotgrid__table",children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{children:p.map(H=>H.caption).join(" / ")||""}),se.map(H=>e.jsx("th",{colSpan:K.length||1,children:H},H))]}),K.length>1&&e.jsxs("tr",{children:[e.jsx("th",{}),se.map(H=>K.map(Z=>e.jsx("th",{children:Z.caption},`${H}-${Z.field}`)))]})]}),e.jsx("tbody",{children:ie.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:1+se.length*Math.max(K.length,1),className:"nice-pivotgrid__empty",children:u||O("controls.noData","No data available")})}):ie.map(H=>e.jsxs("tr",{children:[e.jsx("td",{className:"nice-pivotgrid__row-header",children:H}),se.map(Z=>K.length>0?K.map(R=>e.jsx("td",{className:`nice-pivotgrid__cell ${x?"nice-pivotgrid__cell--clickable":""}`,onClick:x?()=>xe(H,Z):void 0,children:$e(H,Z,R)},`${Z}-${R.field}`)):e.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},Z))]},H))})]})})]})},_a=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:qt},Symbol.toStringTag,{value:"Module"}));function ya({open:n}){return e.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transition:"transform 160ms ease",transform:n?"rotate(0deg)":"rotate(-90deg)"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}function va(){return e.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}const ja=[{target:".nice-kanban",titleKey:"tutorial.kanbanBoard.intro.title",title:"Kanban board",contentKey:"tutorial.kanbanBoard.intro.content",content:'Drag cards between columns to change their status, add cards with the "+" button, and click a card to edit its details.',placement:"auto"}],ei=t.forwardRef(({columns:n,cards:a,onCardMove:r,onCardClick:l,renderCard:s,onAddCard:u,disabled:g=!1,size:c="md",collapsible:x=!1,layoutMode:k="scroll",viewMode:S,onViewModeChange:L,collapsedColumns:y,onCollapsedColumnsChange:D,formItems:O,formColumns:W=1,formProps:w,editCardTitle:o,newCardTitle:M,onCardEdit:p,onCardCreate:E,onCardDelete:K,tutorial:ie,cookies:se=!1,localStorage:$e=!0,sessionStorage:$=!1,storageMode:oe,storageKey:xe,className:de,style:H,id:Z,...R},F)=>{const{t:b}=ye.ce(),[je,pe]=t.useState(null),[G,ne]=t.useState(null),[U,X]=t.useState(null),ge=!!O&&(!!p||!!E),we=t.useCallback(A=>{if(ge&&p){X({key:A.key,data:{...A},column:A.column});return}l==null||l(A)},[ge,l,p]),Ae=t.useCallback(A=>{if(ge&&E){X({key:null,data:{title:"",description:""},column:A});return}u==null||u(A)},[ge,u,E]),Ke=ye.ht(xe??"nice-kanban"),[Ge,Se]=t.useState(()=>Ke.get("state")??{collapsedColumns:[],viewMode:"default"}),Ue=y??Ge.collapsedColumns??[],Ee=S??Ge.viewMode??"default",Xe=t.useCallback(A=>{Se(ce=>{const P={...ce,...A};return Ke.set("state",P),P})},[Ke]),te=t.useCallback(A=>{const ce=Ue.includes(A)?Ue.filter(P=>P!==A):[...Ue,A];D?D(ce):Xe({collapsedColumns:ce})},[Ue,D,Xe]);t.useCallback(A=>{L?L(A):Xe({viewMode:A})},[L,Xe]);const ve=t.useCallback(A=>a.filter(ce=>ce.column===A).sort((ce,P)=>(ce.order??0)-(P.order??0)),[a]),he=t.useCallback((A,ce)=>{g||(A.dataTransfer.effectAllowed="move",A.dataTransfer.setData("text/plain",String(ce.key)),pe({cardKey:ce.key,fromColumn:ce.column}))},[g]),z=t.useCallback((A,ce)=>{A.preventDefault(),A.dataTransfer.dropEffect="move",ne({column:ce})},[]),ue=t.useCallback(()=>{ne(null)},[]),Q=t.useCallback((A,ce)=>{if(A.preventDefault(),ne(null),!je||g)return;const P=ve(ce);r==null||r(je.cardKey,ce,P.length),pe(null)},[je,g,ve,r]),fe=t.useCallback(()=>{pe(null),ne(null)},[]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:F,id:Z,className:`nice-kanban nice-kanban--${c} nice-kanban--${Ee} nice-kanban--layout-${k} ${g?"nice-kanban--disabled":""} ${de||""}`,style:{position:"relative",...H},...R,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(ye.Ud,{steps:ye.Kd(ie,ja)})}),n.map(A=>{const ce=ve(A.key),P=(G==null?void 0:G.column)===A.key,ze=A.limit!=null&&ce.length>=A.limit,Ie=x&&Ue.includes(A.key);return e.jsxs("div",{className:`nice-kanban__column ${P?"nice-kanban__column--dragover":""} ${Ie?"nice-kanban__column--collapsed":""}`,onDragOver:ee=>!Ie&&z(ee,A.key),onDragLeave:ue,onDrop:ee=>!Ie&&Q(ee,A.key),children:[e.jsxs("div",{className:"nice-kanban__column-header",style:A.color?{borderTopColor:A.color}:void 0,onClick:x?()=>te(A.key):void 0,role:x?"button":void 0,tabIndex:x?0:void 0,onKeyDown:x?ee=>{(ee.key==="Enter"||ee.key===" ")&&te(A.key)}:void 0,children:[x&&e.jsx("span",{className:"nice-kanban__collapse-icon","aria-hidden":"true",children:e.jsx(ya,{open:!Ie})}),e.jsx("span",{className:"nice-kanban__column-title",children:A.title}),e.jsxs("span",{className:"nice-kanban__column-count",children:[ce.length,A.limit!=null&&` / ${A.limit}`]})]}),!Ie&&e.jsxs("div",{className:"nice-kanban__column-body",children:[ce.map(ee=>e.jsx("div",{className:`nice-kanban__card nice-kanban__card--${Ee} ${(je==null?void 0:je.cardKey)===ee.key?"nice-kanban__card--dragging":""}`,draggable:!g,onDragStart:Je=>he(Je,ee),onDragEnd:fe,onClick:()=>we(ee),role:"article",children:s?s(ee):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-kanban__card-title",children:ee.title}),Ee!=="compact"&&ee.description&&e.jsx("div",{className:"nice-kanban__card-desc",children:ee.description})]})},ee.key)),ce.length===0&&e.jsx("div",{className:"nice-kanban__empty",children:b("kanban.empty","No cards")})]}),!Ie&&(u||ge&&E)&&!ze&&e.jsxs("button",{type:"button",className:"nice-kanban__add",onClick:()=>Ae(A.key),disabled:g,children:[e.jsx(va,{})," ",b("kanban.addCard","Add card")]})]},A.key)})]}),ge&&U&&e.jsxs(Yt,{open:!0,onClose:()=>X(null),title:U.key==null?M||b("kanban.newCard","New card"):o||b("kanban.editCard","Edit card"),children:[e.jsx(Fe.Ga,{items:O,data:U.data,columns:W,...w,onFieldChange:(A,ce)=>X(P=>P&&{...P,data:{...P.data,[A]:ce}})}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16,flexWrap:"wrap"},children:[U.key!=null&&K&&e.jsx(Fe.hn,{type:"button",size:"sm",variant:"error",style:{marginRight:"auto"},onClick:()=>{K(U.key),X(null)},children:b("controls.delete","Delete")}),e.jsx(Fe.hn,{type:"button",size:"sm",variant:"secondary",onClick:()=>X(null),children:b("controls.cancel","Cancel")}),e.jsx(Fe.hn,{type:"button",size:"sm",variant:"primary",onClick:()=>{if(U.key==null){const A={key:`card-${Date.now()}`,title:"",column:U.column,...U.data};E==null||E(A)}else p==null||p(U.key,{...U.data,key:U.key,column:U.column});X(null)},children:b("controls.save","Save")})]})]})]})});ei.displayName="NiceKanbanBoard";function Ln(...n){return n.filter(Boolean).map(a=>typeof a=="object"?Object.entries(a).filter(([,r])=>r).map(([r])=>r).join(" "):a).join(" ")}const wa=50,ka=[10,25,50,100,200],Na=40,Ca=10,Sa=768,Ma=500,Da=10;function wn(n,a){return a.split(".").reduce((r,l)=>r==null?void 0:r[l],n)}function Nt(n,a,r="pl-PL"){var l,s,u;if(n==null)return"—";switch(a.type){case"number":return new Intl.NumberFormat(r,{minimumFractionDigits:(l=a.format)!=null&&l.includes(".")?a.format.split(".")[1].length:0}).format(n);case"currency":return new Intl.NumberFormat(r,{style:"currency",currency:a.currencyCode||"PLN"}).format(n);case"percent":return new Intl.NumberFormat(r,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2}).format(n/100);case"date":return new Intl.DateTimeFormat(r,{dateStyle:"short"}).format(new Date(n));case"datetime":return new Intl.DateTimeFormat(r,{dateStyle:"short",timeStyle:"short"}).format(new Date(n));case"boolean":return n?"✓":"✗";case"enum":return((u=(s=a.enumOptions)==null?void 0:s.find(g=>g.value===n))==null?void 0:u.label)||String(n);default:return String(n)}}function $a(n,a,r,l){const[s,u]=t.useState(0),{startIndex:g,endIndex:c,totalHeight:x,offsetY:k}=t.useMemo(()=>{const y=n.length*r,D=Math.ceil(a/r),O=Math.max(0,Math.floor(s/r)-l),W=Math.min(n.length,Math.ceil(s/r)+D+l),w=O*r;return{startIndex:O,endIndex:W,totalHeight:y,offsetY:w}},[n.length,a,r,s,l]),S=t.useMemo(()=>n.slice(g,c),[n,g,c]),L=t.useCallback(y=>{u(y.currentTarget.scrollTop)},[]);return{visibleData:S,totalHeight:x,offsetY:k,handleScroll:L,startIndex:g}}function za(n,a){const[r,l]=t.useState(()=>{if(n&&typeof window<"u"){const u=localStorage.getItem(`nice-module-grid-${n}`);if(u)return JSON.parse(u)}return a||{}}),s=t.useCallback(u=>{l(g=>{const c={...g,...u};return n&&typeof window<"u"&&localStorage.setItem(`nice-module-grid-${n}`,JSON.stringify(c)),c})},[n]);return[r,s]}function Ia(n){const[a,r]=t.useState(typeof window<"u"&&window.innerWidth<n);return t.useEffect(()=>{if(typeof window>"u")return;const l=()=>r(window.innerWidth<n);return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[n]),a}function Ra({column:n,sort:a,onSort:r,onResize:l,resizable:s,t:u}){const g=t.useRef(null),[c,x]=t.useState(!1),k=t.useCallback(y=>{if(!s||!l)return;y.preventDefault(),x(!0);const D=y.clientX,O=n.width||150,W=o=>{const M=o.clientX-D,p=Math.max(n.minWidth||50,O+M);l(n.field,Math.min(p,n.maxWidth||1/0))},w=()=>{x(!1),document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",w)};document.addEventListener("mousemove",W),document.addEventListener("mouseup",w)},[n,s,l]),S=a==null?void 0:a.direction,L=S==="asc"?"↑":S==="desc"?"↓":null;return e.jsxs("div",{className:Ln("nice-module-grid__header-cell",n.sortable&&"nice-module-grid__header-cell--sortable",c&&"nice-module-grid__header-cell--resizing"),style:{width:n.width==="auto"?"auto":n.width||150,minWidth:n.minWidth,maxWidth:n.maxWidth,textAlign:n.align},onClick:()=>n.sortable&&(r==null?void 0:r(n.field)),role:"columnheader","aria-sort":S==="asc"?"ascending":S==="desc"?"descending":"none",title:n.headerTooltip,children:[e.jsx("span",{className:"nice-module-grid__header-text",children:n.header}),L&&e.jsx("span",{className:"nice-module-grid__sort-indicator",children:L}),s&&e.jsx("div",{ref:g,className:"nice-module-grid__resize-handle",onMouseDown:k})]})}function Fa({column:n,row:a,rowIndex:r,value:l,locale:s="pl-PL",onClick:u}){const g=ye.Yl({onClick:u}),c=u?g:{};if(n.render)return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:n.render(l,a,r)});if(n.type==="enum"&&n.enumOptions){const x=n.enumOptions.find(k=>k.value===l);if(x)return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:e.jsxs("span",{className:Ln("nice-module-grid__badge",`nice-module-grid__badge--${x.color||"default"}`),children:[x.icon&&e.jsx("span",{className:"nice-module-grid__badge-icon",children:x.icon}),x.label]})})}if(n.type==="progress"){const x=Math.min(100,Math.max(0,Number(l)||0));return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:e.jsxs("div",{className:"nice-module-grid__progress",children:[e.jsx("div",{className:Ln("nice-module-grid__progress-bar",`nice-module-grid__progress-bar--${n.progressColor||"primary"}`),style:{width:`${x}%`}}),e.jsxs("span",{className:"nice-module-grid__progress-text",children:[x,"%"]})]})})}if(n.type==="rating"){const x=n.maxRating||5,k=Number(l)||0;return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:e.jsx("span",{className:"nice-module-grid__rating","aria-label":`${k} out of ${x} stars`,children:Array.from({length:x},(S,L)=>e.jsx("span",{className:Ln("nice-module-grid__star",L<k&&"nice-module-grid__star--filled"),children:"★"},L))})})}if(n.type==="link"&&n.linkTemplate){const x=n.linkTemplate.replace(/\{\{(\w+)\}\}/g,(k,S)=>String(wn(a,S)??""));return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:e.jsx("a",{href:x,target:n.linkNewTab?"_blank":void 0,rel:n.linkNewTab?"noopener noreferrer":void 0,className:"nice-module-grid__link",children:Nt(l,n,s)})})}if(n.type==="image"){const x={xs:24,sm:32,md:48,lg:64}[n.imageSize||"sm"];return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:l?e.jsx("img",{src:String(l),alt:"",className:"nice-module-grid__image",style:{width:x,height:x}}):e.jsx("div",{className:"nice-module-grid__image-placeholder",style:{width:x,height:x}})})}return n.type==="avatar"?e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:l?e.jsx("img",{src:String(l),alt:"",className:"nice-module-grid__avatar"}):e.jsx("div",{className:"nice-module-grid__avatar-placeholder",children:"?"})}):n.type==="color"?e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:e.jsx("span",{className:"nice-module-grid__color-swatch",style:{backgroundColor:l||"transparent"},title:l})}):n.type==="boolean"?e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align||"center"},...c,children:e.jsx("span",{className:Ln("nice-module-grid__boolean",!!l&&"nice-module-grid__boolean--true"),children:l?"✓":"✗"})}):e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:n.align},...c,children:Nt(l,n,s)})}function Ea({row:n,index:a,columns:r,primaryField:l,secondaryField:s,customRender:u,selected:g,onClick:c,locale:x="pl-PL",t:k}){if(u)return e.jsx("div",{className:Ln("nice-module-grid__mobile-card",g&&"nice-module-grid__mobile-card--selected"),onClick:c,children:u(n,a)});const S=r.find(y=>y.field===l)||r[0],L=r.find(y=>y.field===s)||r[1];return e.jsxs("div",{className:Ln("nice-module-grid__mobile-card",g&&"nice-module-grid__mobile-card--selected"),onClick:c,role:"row","aria-selected":g,children:[e.jsxs("div",{className:"nice-module-grid__mobile-card-header",children:[e.jsx("div",{className:"nice-module-grid__mobile-card-title",children:Nt(wn(n,(S==null?void 0:S.field)||""),S,x)}),L&&e.jsx("div",{className:"nice-module-grid__mobile-card-subtitle",children:Nt(wn(n,L.field),L,x)})]}),e.jsx("div",{className:"nice-module-grid__mobile-card-body",children:r.filter(y=>!y.hidden&&y.field!==l&&y.field!==s).slice(0,4).map(y=>e.jsxs("div",{className:"nice-module-grid__mobile-card-field",children:[e.jsx("span",{className:"nice-module-grid__mobile-card-label",children:y.header}),e.jsx("span",{className:"nice-module-grid__mobile-card-value",children:Nt(wn(n,y.field),y,x)})]},y.field))})]})}function Ta({page:n,pageSize:a,totalRows:r,pageSizeOptions:l,onPageChange:s,t:u}){const g=Math.ceil(r/a),c=(n-1)*a+1,x=Math.min(n*a,r);return e.jsxs("div",{className:"nice-module-grid__pagination",role:"navigation","aria-label":u("pagination.ariaLabel","Pagination"),children:[e.jsxs("div",{className:"nice-module-grid__pagination-info",children:[u("pagination.showing","Showing")," ",c,"–",x," ",u("pagination.of","of")," ",r]}),e.jsxs("div",{className:"nice-module-grid__pagination-controls",children:[e.jsx("select",{className:"nice-module-grid__page-size-select",value:a,onChange:k=>s(1,Number(k.target.value)),"aria-label":u("pagination.rowsPerPage","Rows per page"),children:l.map(k=>e.jsx("option",{value:k,children:k},k))}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>s(1,a),disabled:n===1,"aria-label":u("pagination.first","First"),children:"««"}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>s(n-1,a),disabled:n===1,"aria-label":u("pagination.previous","Previous"),children:"«"}),e.jsxs("span",{className:"nice-module-grid__pagination-page",children:[n," / ",g]}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>s(n+1,a),disabled:n>=g,"aria-label":u("pagination.next","Next"),children:"»"}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>s(g,a),disabled:n>=g,"aria-label":u("pagination.last","Last"),children:"»»"})]})]})}function La({columns:n}){return e.jsx("div",{className:"nice-module-grid__row nice-module-grid__row--skeleton",role:"row",children:n.filter(a=>!a.hidden).map(a=>e.jsx("div",{className:"nice-module-grid__cell nice-module-grid__cell--skeleton",style:{width:a.width==="auto"?"auto":a.width||150},children:e.jsx("div",{className:"nice-module-grid__skeleton-bar"})},a.field))})}function Aa(n,a){var ut;const{columns:r,data:l,keyField:s="id",dataSource:u,onFetch:g,sortable:c=!0,sort:x,onSortChange:k,multiSort:S=!1,filterable:L=!1,filter:y,onFilterChange:D,searchText:O,onSearchChange:W,searchPlaceholder:w="moduleGrid.searchPlaceholder",pagination:o=!0,page:M,pageSize:p,pageSizeOptions:E=ka,totalRows:K,onPageChange:ie,virtualScroll:se=!0,rowHeight:$e=Na,overscan:$=Ca,selectionMode:oe="none",selectedKeys:xe,onSelectionChange:de,columnReorder:H=!0,onColumnOrderChange:Z,columnResize:R=!0,onColumnWidthChange:F,groupBy:b,onGroupByChange:je,groupRowRender:pe,expandAllGroups:G=!1,editable:ne=!1,onCellEdit:U,onRowEdit:X,editMode:ge="cell",contextMenuItems:we,onContextMenuAction:Ae,exportable:Ke=!0,exportFormats:Ge=["csv","excel"],onExport:Se,preferencesKey:Ue,initialPreferences:Ee,onPreferencesChange:Xe,density:te="normal",striped:ve=!0,bordered:he=!1,hoverable:z=!0,loading:ue=!1,emptyState:Q,toolbar:fe,onRowClick:A,onRowDoubleClick:ce,rowClassName:P,rowStyle:ze,mobileCardView:Ie=!0,mobileBreakpoint:ee=Sa,mobileCardRender:Je,mobilePrimaryField:en,mobileSecondaryField:ke,moduleId:An,permissions:bn,size:Pn="medium",skeletonLoading:Nn=!0,skeletonRows:I=Da,"aria-label":ae,"aria-labelledby":me,"aria-describedby":be,className:ln,style:De,id:Le,testId:Ye}=n,{t:Ne}=ye.ce();ye.Nl(),ye.rl("table");const nn=Ia(ee),[dn,pt]=za(Ue,Ee),Cn=t.useRef(null),tt=t.useRef(null),[On,Wn]=t.useState([]),[sn,Pt]=t.useState(),[St,qn]=t.useState(""),[it,Sn]=t.useState(1),[gt,at]=t.useState(p||wa),[rt,Bn]=t.useState(new Set),[Kn,lt]=t.useState([]),[m,d]=t.useState(0),[_,T]=t.useState(!1),[q,N]=t.useState(new Set),[B,Y]=t.useState(null),[Pe,Oe]=t.useState({}),re=x??On,Ze=y??sn,tn=O??St,un=M??it,an=p??gt,mn=xe??rt,ft=K??m??(l==null?void 0:l.length)??0,Un=!!(g||u),cn=t.useMemo(()=>{const v=new Set(dn.hiddenColumns||[]);return r.filter(_e=>!_e.hidden&&!v.has(_e.field))},[r,dn.hiddenColumns]),st=t.useMemo(()=>{if(Un)return Kn;if(!l)return[];let v=[...l];if(tn){const _e=tn.toLowerCase(),Me=r.filter(Te=>Te.searchable!==!1).map(Te=>Te.field);v=v.filter(Te=>Me.some(gn=>{const $n=wn(Te,gn);return String($n??"").toLowerCase().includes(_e)}))}return re.length>0&&v.sort((_e,Me)=>{for(const Te of re){const gn=wn(_e,Te.field),$n=wn(Me,Te.field),Rn=gn<$n?-1:gn>$n?1:0;if(Rn!==0)return Te.direction==="asc"?Rn:-Rn}return 0}),v},[Un,Kn,l,tn,re,r]),Gn=t.useMemo(()=>{if(Un||!o)return st;const v=(un-1)*an;return st.slice(v,v+an)},[Un,st,o,un,an]),xt=((ut=Cn.current)==null?void 0:ut.clientHeight)||400,Mn=se&&Gn.length>Ma,{visibleData:Ot,totalHeight:hn,offsetY:bt,handleScroll:ct,startIndex:Xn}=$a(Gn,xt,$e,$),pn=Mn?Ot:Gn,In=t.useCallback(async()=>{if(g){T(!0);try{const v=await g({page:un,pageSize:an,sort:re,filter:Ze,search:tn});lt(v.data),d(v.total)}catch(v){console.error("NiceModuleGrid fetch error:",v)}finally{T(!1)}}},[g,un,an,re,Ze,tn]);t.useEffect(()=>{Un&&In()},[Un,In]);const ot=t.useCallback(v=>{const _e=re.find(Te=>Te.field===v);let Me;_e?_e.direction==="asc"?Me=re.map(Te=>Te.field===v?{...Te,direction:"desc"}:Te):Me=re.filter(Te=>Te.field!==v):Me=S?[...re,{field:v,direction:"asc"}]:[{field:v,direction:"asc"}],k?k(Me):Wn(Me)},[re,S,k]),Mt=t.useCallback((v,_e)=>{ie?ie(v,_e):(Sn(v),at(_e))},[ie]),Dt=t.useCallback(v=>{W?W(v):qn(v),ie||Sn(1)},[W,ie]),_t=t.useCallback((v,_e)=>{const Me=new Set(mn);if(oe==="single"?(Me.clear(),Me.add(v)):(oe==="multiple"||oe==="checkbox")&&(Me.has(v)?Me.delete(v):Me.add(v)),de){const Te=Gn.filter(gn=>Me.has(String(wn(gn,s))));de(Me,Te)}else Bn(Me)},[mn,oe,de,Gn,s]),yt=t.useCallback((v,_e)=>{Oe(Me=>({...Me,[v]:_e})),F==null||F(v,_e),pt({columnWidths:{...dn.columnWidths,[v]:_e}})},[F,pt,dn.columnWidths]),Wt=t.useCallback((v,_e)=>{we!=null&&we.length&&(v.preventDefault(),Y({x:v.clientX,y:v.clientY,row:_e}))},[we]),Bt=t.useCallback(v=>{B&&(Ae==null||Ae(v,B.row)),Y(null)},[B,Ae]),dt=t.useCallback(async v=>{if(Se)await Se(v,{selectedOnly:mn.size>0,columns:cn.map(_e=>_e.field)});else if(v==="csv"){const _e=cn.map(fn=>fn.header).join(","),Me=Gn.map(fn=>cn.map(Kt=>JSON.stringify(wn(fn,Kt.field)??"")).join(",")),Te=[_e,...Me].join(`
|
|
16
|
+
`),gn=new Blob([Te],{type:"text/csv;charset=utf-8;"}),$n=URL.createObjectURL(gn),Rn=document.createElement("a");Rn.href=$n,Rn.download=`export-${new Date().toISOString().slice(0,10)}.csv`,Rn.click(),URL.revokeObjectURL($n)}},[Se,mn,cn,Gn,Ne]);t.useEffect(()=>{if(!B)return;const v=()=>Y(null);return document.addEventListener("click",v),()=>document.removeEventListener("click",v)},[B]);const Dn=t.useCallback(v=>{v.key==="Escape"&&Y(null)},[]),Hn=ue||_,Qn=!Hn&&pn.length===0,Vn=nn&&Ie,Jn=Ln("nice-module-grid",`nice-module-grid--${te}`,`nice-module-grid--${Pn}`,ve&&"nice-module-grid--striped",he&&"nice-module-grid--bordered",z&&"nice-module-grid--hoverable",Hn&&"nice-module-grid--loading",Vn&&"nice-module-grid--mobile",ln);return e.jsxs("div",{ref:a,id:Le,"data-testid":Ye,className:Jn,style:De,onKeyDown:Dn,role:"grid","aria-label":ae,"aria-labelledby":me,"aria-describedby":be,"aria-rowcount":ft,"aria-colcount":cn.length,"aria-busy":Hn,children:[e.jsxs("div",{className:"nice-module-grid__toolbar",children:[e.jsx("div",{className:"nice-module-grid__toolbar-search",children:e.jsx("input",{type:"search",className:"nice-module-grid__search-input",placeholder:w,value:tn,onChange:v=>Dt(v.target.value),"aria-label":Ne("moduleGrid.searchAriaLabel","Search")})}),fe,Ke&&e.jsx("div",{className:"nice-module-grid__toolbar-export",children:Ge.map(v=>e.jsx("button",{className:"nice-module-grid__export-btn",onClick:()=>dt(v),"aria-label":Ne(`moduleGrid.export.${v}`,`Export to ${v.toUpperCase()}`),children:v.toUpperCase()},v))})]}),e.jsx("div",{ref:Cn,className:"nice-module-grid__container",onScroll:Mn?ct:void 0,children:Vn?e.jsx("div",{className:"nice-module-grid__mobile-list",children:Hn&&Nn?Array.from({length:I},(v,_e)=>e.jsxs("div",{className:"nice-module-grid__mobile-card nice-module-grid__mobile-card--skeleton",children:[e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"60%",height:20}}),e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"40%",height:14}}),e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"80%",height:14}})]},_e)):Qn?e.jsxs("div",{className:"nice-module-grid__empty",children:[(Q==null?void 0:Q.icon)&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:Q.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:(Q==null?void 0:Q.title)||Ne("moduleGrid.noData","No data")}),(Q==null?void 0:Q.description)&&e.jsx("div",{className:"nice-module-grid__empty-description",children:Q.description}),(Q==null?void 0:Q.action)&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:Q.action.onClick,children:[Q.action.icon,Q.action.label]})]}):pn.map((v,_e)=>{const Me=String(wn(v,s));return e.jsx(Ea,{row:v,index:Xn+_e,columns:cn,primaryField:en,secondaryField:ke,customRender:Je,selected:mn.has(Me),onClick:()=>{oe!=="none"&&_t(Me,v),A==null||A(v,Xn+_e)},t:Ne},Me)})}):e.jsxs("div",{ref:tt,className:"nice-module-grid__table",children:[e.jsxs("div",{className:"nice-module-grid__header",role:"row",children:[oe==="checkbox"&&e.jsx("div",{className:"nice-module-grid__header-cell nice-module-grid__header-cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:mn.size>0&&mn.size===pn.length,onChange:()=>{if(mn.size===pn.length)de==null||de(new Set,[]),Bn(new Set);else{const v=new Set(pn.map(_e=>String(wn(_e,s))));de==null||de(v,pn),Bn(v)}},"aria-label":Ne("moduleGrid.selectAll","Select all")})}),cn.map(v=>e.jsx(Ra,{column:{...v,width:Pe[v.field]||v.width},sort:re.find(_e=>_e.field===v.field),onSort:c?ot:void 0,onResize:R?yt:void 0,resizable:R,t:Ne},v.field))]}),e.jsx("div",{className:"nice-module-grid__body",style:Mn?{height:hn,position:"relative"}:void 0,children:Hn&&Nn?Array.from({length:I},(v,_e)=>e.jsx(La,{columns:cn},_e)):Qn?e.jsxs("div",{className:"nice-module-grid__empty",children:[(Q==null?void 0:Q.icon)&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:Q.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:(Q==null?void 0:Q.title)||Ne("moduleGrid.noData","No data")}),(Q==null?void 0:Q.description)&&e.jsx("div",{className:"nice-module-grid__empty-description",children:Q.description}),(Q==null?void 0:Q.action)&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:Q.action.onClick,children:[Q.action.icon,Q.action.label]})]}):e.jsx("div",{style:Mn?{transform:`translateY(${bt}px)`}:void 0,children:pn.map((v,_e)=>{const Me=String(wn(v,s)),Te=Xn+_e,gn=mn.has(Me),$n=typeof P=="function"?P(v,Te):P,Rn=typeof ze=="function"?ze(v,Te):ze;return e.jsxs("div",{className:Ln("nice-module-grid__row",gn&&"nice-module-grid__row--selected",$n),style:{...Rn,height:$e},role:"row","aria-rowindex":Te+1,"aria-selected":gn,onClick:()=>{oe!=="none"&&_t(Me,v),A==null||A(v,Te)},onDoubleClick:()=>ce==null?void 0:ce(v,Te),onContextMenu:fn=>Wt(fn,v),children:[oe==="checkbox"&&e.jsx("div",{className:"nice-module-grid__cell nice-module-grid__cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:gn,onChange:()=>_t(Me,v),onClick:fn=>fn.stopPropagation(),"aria-label":Ne("moduleGrid.selectRow","Select row")})}),cn.map(fn=>e.jsx(Fa,{column:{...fn,width:Pe[fn.field]||fn.width},row:v,rowIndex:Te,value:wn(v,fn.field)},fn.field))]},Me)})})})]})}),o&&ft>0&&e.jsx(Ta,{page:un,pageSize:an,totalRows:Un?m:st.length,pageSizeOptions:E,onPageChange:Mt,t:Ne}),B&&we&&e.jsx("div",{className:"nice-module-grid__context-menu",style:{left:B.x,top:B.y},role:"menu",children:we.filter(v=>typeof v.hidden=="function"?!v.hidden(B.row):!v.hidden).map(v=>{if(v.divider)return e.jsx("div",{className:"nice-module-grid__context-menu-divider"},v.key);const _e=typeof v.disabled=="function"?v.disabled(B.row):v.disabled;return e.jsxs("button",{className:Ln("nice-module-grid__context-menu-item",v.danger&&"nice-module-grid__context-menu-item--danger",_e&&"nice-module-grid__context-menu-item--disabled"),onClick:()=>{var Me;_e||((Me=v.onClick)==null||Me.call(v,B.row),Bt(v.key))},disabled:_e,role:"menuitem",children:[v.icon&&e.jsx("span",{className:"nice-module-grid__context-menu-icon",children:v.icon}),v.label]},v.key)})}),Hn&&!Nn&&e.jsx("div",{className:"nice-module-grid__loading-overlay",children:e.jsx("div",{className:"nice-module-grid__spinner","aria-label":Ne("moduleGrid.loading","Loading")})})]})}t.forwardRef(Aa);const Pa=`
|
|
17
|
+
.nice-reconciliation {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
height: 100%;
|
|
21
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
22
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
23
|
+
border-radius: var(--nice-radius-lg, 0.5rem);
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.nice-reconciliation__toolbar {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: 0.75rem;
|
|
31
|
+
padding: 0.75rem 1rem;
|
|
32
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
33
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.nice-reconciliation__toolbar-group {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.nice-reconciliation__toolbar-group--end {
|
|
44
|
+
margin-inline-start: auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.nice-reconciliation__btn {
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 0.375rem;
|
|
51
|
+
padding: 0.375rem 0.75rem;
|
|
52
|
+
font-size: 0.8125rem;
|
|
53
|
+
font-weight: 500;
|
|
54
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
transition: all 0.15s ease;
|
|
57
|
+
border: 1px solid var(--nice-border-color, #d1d5db);
|
|
58
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
59
|
+
color: var(--nice-text-primary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.nice-reconciliation__btn:hover {
|
|
63
|
+
background: var(--nice-bg-hover, #f3f4f6);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.nice-reconciliation__btn--primary {
|
|
67
|
+
background: var(--nice-primary, #3b82f6);
|
|
68
|
+
border-color: var(--nice-primary, #3b82f6);
|
|
69
|
+
color: white;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.nice-reconciliation__btn--primary:hover {
|
|
73
|
+
background: var(--nice-primary-dark, #2563eb);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.nice-reconciliation__btn--success {
|
|
77
|
+
background: var(--nice-success, #10b981);
|
|
78
|
+
border-color: var(--nice-success, #10b981);
|
|
79
|
+
color: white;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.nice-reconciliation__btn:disabled {
|
|
83
|
+
opacity: 0.5;
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.nice-reconciliation__content {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex: 1;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.nice-reconciliation--vertical .nice-reconciliation__content {
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.nice-reconciliation__panel {
|
|
98
|
+
flex: 1;
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
min-width: 0;
|
|
102
|
+
min-height: 0;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.nice-reconciliation__panel--statements {
|
|
107
|
+
border-inline-end: 1px solid var(--nice-border-color, #e5e7eb);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.nice-reconciliation--vertical .nice-reconciliation__panel--statements {
|
|
111
|
+
border-inline-end: none;
|
|
112
|
+
border-block-end: 1px solid var(--nice-border-color, #e5e7eb);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.nice-reconciliation__panel-header {
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
padding: 0.75rem 1rem;
|
|
120
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
121
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nice-reconciliation__panel-title {
|
|
125
|
+
font-weight: 600;
|
|
126
|
+
font-size: 0.875rem;
|
|
127
|
+
color: var(--nice-text-primary);
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
gap: 0.5rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.nice-reconciliation__panel-badge {
|
|
134
|
+
font-size: 0.75rem;
|
|
135
|
+
font-weight: 500;
|
|
136
|
+
padding: 0.125rem 0.5rem;
|
|
137
|
+
border-radius: var(--nice-radius-full, 9999px);
|
|
138
|
+
background: var(--nice-bg-tertiary, #e5e7eb);
|
|
139
|
+
color: var(--nice-text-secondary);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.nice-reconciliation__panel-content {
|
|
143
|
+
flex: 1;
|
|
144
|
+
overflow: auto;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.nice-reconciliation__row {
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: 0.75rem;
|
|
151
|
+
padding: 0.625rem 1rem;
|
|
152
|
+
border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
user-select: none;
|
|
155
|
+
transition: background 0.1s ease;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.nice-reconciliation__row:hover {
|
|
159
|
+
background: var(--nice-bg-hover, rgba(0, 0, 0, 0.02));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.nice-reconciliation__row--selected {
|
|
163
|
+
background: var(--nice-primary-light, rgba(59, 130, 246, 0.1));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.nice-reconciliation__row--dragging {
|
|
167
|
+
opacity: 0.6;
|
|
168
|
+
background: var(--nice-primary-light, rgba(59, 130, 246, 0.15));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.nice-reconciliation__row--drop-target {
|
|
172
|
+
background: var(--nice-success-light, rgba(16, 185, 129, 0.15));
|
|
173
|
+
box-shadow: inset 0 0 0 2px var(--nice-success, #10b981);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.nice-reconciliation__row--matched {
|
|
177
|
+
background: var(--nice-success-light, rgba(16, 185, 129, 0.08));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.nice-reconciliation__row--partial {
|
|
181
|
+
background: var(--nice-warning-light, rgba(245, 158, 11, 0.08));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.nice-reconciliation__row--unmatched {
|
|
185
|
+
background: transparent;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.nice-reconciliation__row--excluded {
|
|
189
|
+
opacity: 0.5;
|
|
190
|
+
background: var(--nice-bg-disabled, #f3f4f6);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.nice-reconciliation__status {
|
|
194
|
+
width: 0.5rem;
|
|
195
|
+
height: 0.5rem;
|
|
196
|
+
border-radius: var(--nice-radius-full, 50%);
|
|
197
|
+
flex-shrink: 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.nice-reconciliation__status--matched {
|
|
201
|
+
background: var(--nice-success, #10b981);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.nice-reconciliation__status--partial {
|
|
205
|
+
background: var(--nice-warning, #f59e0b);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.nice-reconciliation__status--unmatched {
|
|
209
|
+
background: var(--nice-danger, #ef4444);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.nice-reconciliation__status--excluded {
|
|
213
|
+
background: var(--nice-text-disabled, #9ca3af);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.nice-reconciliation__row-main {
|
|
217
|
+
flex: 1;
|
|
218
|
+
min-width: 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.nice-reconciliation__row-date {
|
|
222
|
+
font-size: 0.75rem;
|
|
223
|
+
color: var(--nice-text-secondary);
|
|
224
|
+
margin-bottom: 0.125rem;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.nice-reconciliation__row-description {
|
|
228
|
+
font-size: 0.8125rem;
|
|
229
|
+
color: var(--nice-text-primary);
|
|
230
|
+
white-space: nowrap;
|
|
231
|
+
overflow: hidden;
|
|
232
|
+
text-overflow: ellipsis;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.nice-reconciliation__row-counterparty {
|
|
236
|
+
font-size: 0.75rem;
|
|
237
|
+
color: var(--nice-text-tertiary);
|
|
238
|
+
white-space: nowrap;
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
text-overflow: ellipsis;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.nice-reconciliation__row-amount {
|
|
244
|
+
font-size: 0.875rem;
|
|
245
|
+
font-weight: 600;
|
|
246
|
+
font-variant-numeric: tabular-nums;
|
|
247
|
+
white-space: nowrap;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.nice-reconciliation__row-amount--positive {
|
|
251
|
+
color: var(--nice-success, #10b981);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.nice-reconciliation__row-amount--negative {
|
|
255
|
+
color: var(--nice-danger, #ef4444);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.nice-reconciliation__confidence {
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
gap: 0.25rem;
|
|
262
|
+
font-size: 0.6875rem;
|
|
263
|
+
padding: 0.125rem 0.375rem;
|
|
264
|
+
border-radius: var(--nice-radius-sm, 0.25rem);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.nice-reconciliation__confidence--high {
|
|
268
|
+
background: var(--nice-success-light, rgba(16, 185, 129, 0.15));
|
|
269
|
+
color: var(--nice-success-dark, #059669);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.nice-reconciliation__confidence--medium {
|
|
273
|
+
background: var(--nice-warning-light, rgba(245, 158, 11, 0.15));
|
|
274
|
+
color: var(--nice-warning-dark, #d97706);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.nice-reconciliation__confidence--low {
|
|
278
|
+
background: var(--nice-danger-light, rgba(239, 68, 68, 0.15));
|
|
279
|
+
color: var(--nice-danger-dark, #dc2626);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.nice-reconciliation__empty {
|
|
283
|
+
display: flex;
|
|
284
|
+
flex-direction: column;
|
|
285
|
+
align-items: center;
|
|
286
|
+
justify-content: center;
|
|
287
|
+
padding: 3rem 1rem;
|
|
288
|
+
color: var(--nice-text-secondary);
|
|
289
|
+
text-align: center;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.nice-reconciliation__empty-icon {
|
|
293
|
+
font-size: 2.5rem;
|
|
294
|
+
margin-bottom: 0.75rem;
|
|
295
|
+
opacity: 0.5;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.nice-reconciliation__summary {
|
|
299
|
+
display: flex;
|
|
300
|
+
align-items: center;
|
|
301
|
+
gap: 1.5rem;
|
|
302
|
+
padding: 0.75rem 1rem;
|
|
303
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
304
|
+
border-top: 1px solid var(--nice-border-color, #e5e7eb);
|
|
305
|
+
font-size: 0.8125rem;
|
|
306
|
+
flex-wrap: wrap;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.nice-reconciliation__summary-item {
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
gap: 0.375rem;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.nice-reconciliation__summary-label {
|
|
316
|
+
color: var(--nice-text-secondary);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.nice-reconciliation__summary-value {
|
|
320
|
+
font-weight: 600;
|
|
321
|
+
color: var(--nice-text-primary);
|
|
322
|
+
font-variant-numeric: tabular-nums;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.nice-reconciliation__summary-value--success {
|
|
326
|
+
color: var(--nice-success, #10b981);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.nice-reconciliation__summary-value--warning {
|
|
330
|
+
color: var(--nice-warning, #f59e0b);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.nice-reconciliation__summary-value--danger {
|
|
334
|
+
color: var(--nice-danger, #ef4444);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.nice-reconciliation__resizer {
|
|
338
|
+
width: 4px;
|
|
339
|
+
background: var(--nice-border-color, #e5e7eb);
|
|
340
|
+
cursor: col-resize;
|
|
341
|
+
transition: background 0.15s ease;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.nice-reconciliation__resizer:hover {
|
|
345
|
+
background: var(--nice-primary, #3b82f6);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.nice-reconciliation--vertical .nice-reconciliation__resizer {
|
|
349
|
+
width: 100%;
|
|
350
|
+
height: 4px;
|
|
351
|
+
cursor: row-resize;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.nice-reconciliation__suggestions {
|
|
355
|
+
padding: 0.75rem 1rem;
|
|
356
|
+
background: var(--nice-info-light, rgba(59, 130, 246, 0.08));
|
|
357
|
+
border-bottom: 1px solid var(--nice-info, #3b82f6);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.nice-reconciliation__suggestion {
|
|
361
|
+
display: flex;
|
|
362
|
+
align-items: center;
|
|
363
|
+
gap: 0.75rem;
|
|
364
|
+
padding: 0.5rem;
|
|
365
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
366
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
367
|
+
margin-bottom: 0.5rem;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.nice-reconciliation__suggestion:last-child {
|
|
371
|
+
margin-bottom: 0;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/* Dark mode */
|
|
375
|
+
.dark .nice-reconciliation {
|
|
376
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
377
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.dark .nice-reconciliation__toolbar,
|
|
381
|
+
.dark .nice-reconciliation__panel-header,
|
|
382
|
+
.dark .nice-reconciliation__summary {
|
|
383
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
384
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.dark .nice-reconciliation__row--selected {
|
|
388
|
+
background: var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/* RTL support */
|
|
392
|
+
[dir="rtl"] .nice-reconciliation__row-amount {
|
|
393
|
+
direction: ltr;
|
|
394
|
+
text-align: left;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* Detail Panel */
|
|
398
|
+
.nice-reconciliation__detail-panel {
|
|
399
|
+
position: fixed;
|
|
400
|
+
inset-inline-end: 0;
|
|
401
|
+
top: 0;
|
|
402
|
+
bottom: 0;
|
|
403
|
+
width: 420px;
|
|
404
|
+
max-width: 90vw;
|
|
405
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
406
|
+
box-shadow: -4px 0 24px var(--nice-overlay-15, rgba(0, 0, 0, 0.15));
|
|
407
|
+
z-index: 1000;
|
|
408
|
+
display: flex;
|
|
409
|
+
flex-direction: column;
|
|
410
|
+
transform: translateX(100%);
|
|
411
|
+
transition: transform 0.25s ease-out;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.nice-reconciliation__detail-panel--open {
|
|
415
|
+
transform: translateX(0);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.nice-reconciliation__detail-header {
|
|
419
|
+
display: flex;
|
|
420
|
+
align-items: center;
|
|
421
|
+
justify-content: space-between;
|
|
422
|
+
padding: 1rem;
|
|
423
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
424
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.nice-reconciliation__detail-title {
|
|
428
|
+
font-weight: 600;
|
|
429
|
+
font-size: 1rem;
|
|
430
|
+
color: var(--nice-text-primary);
|
|
431
|
+
display: flex;
|
|
432
|
+
align-items: center;
|
|
433
|
+
gap: 0.5rem;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.nice-reconciliation__detail-close {
|
|
437
|
+
width: 2rem;
|
|
438
|
+
height: 2rem;
|
|
439
|
+
display: flex;
|
|
440
|
+
align-items: center;
|
|
441
|
+
justify-content: center;
|
|
442
|
+
background: transparent;
|
|
443
|
+
border: none;
|
|
444
|
+
cursor: pointer;
|
|
445
|
+
font-size: 1.25rem;
|
|
446
|
+
color: var(--nice-text-secondary);
|
|
447
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
448
|
+
transition: all 0.15s ease;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.nice-reconciliation__detail-close:hover {
|
|
452
|
+
background: var(--nice-bg-hover, #f3f4f6);
|
|
453
|
+
color: var(--nice-text-primary);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.nice-reconciliation__detail-content {
|
|
457
|
+
flex: 1;
|
|
458
|
+
overflow: auto;
|
|
459
|
+
padding: 1rem;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.nice-reconciliation__detail-section {
|
|
463
|
+
margin-bottom: 1.5rem;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.nice-reconciliation__detail-section-title {
|
|
467
|
+
font-weight: 600;
|
|
468
|
+
font-size: 0.875rem;
|
|
469
|
+
color: var(--nice-text-primary);
|
|
470
|
+
margin-bottom: 0.75rem;
|
|
471
|
+
display: flex;
|
|
472
|
+
align-items: center;
|
|
473
|
+
gap: 0.375rem;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.nice-reconciliation__detail-row {
|
|
477
|
+
display: flex;
|
|
478
|
+
justify-content: space-between;
|
|
479
|
+
align-items: flex-start;
|
|
480
|
+
padding: 0.5rem 0;
|
|
481
|
+
border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.nice-reconciliation__detail-row:last-child {
|
|
485
|
+
border-bottom: none;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.nice-reconciliation__detail-label {
|
|
489
|
+
font-size: 0.8125rem;
|
|
490
|
+
color: var(--nice-text-secondary);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.nice-reconciliation__detail-value {
|
|
494
|
+
font-size: 0.8125rem;
|
|
495
|
+
font-weight: 500;
|
|
496
|
+
color: var(--nice-text-primary);
|
|
497
|
+
text-align: end;
|
|
498
|
+
max-width: 60%;
|
|
499
|
+
word-break: break-word;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.nice-reconciliation__detail-divider {
|
|
503
|
+
height: 1px;
|
|
504
|
+
background: var(--nice-border-color, #e5e7eb);
|
|
505
|
+
margin: 1rem 0;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.nice-reconciliation__detail-match-info {
|
|
509
|
+
padding: 0.75rem;
|
|
510
|
+
background: var(--nice-success-light, rgba(16, 185, 129, 0.08));
|
|
511
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
512
|
+
margin-bottom: 1rem;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.nice-reconciliation__detail-match-header {
|
|
516
|
+
display: flex;
|
|
517
|
+
align-items: center;
|
|
518
|
+
gap: 0.5rem;
|
|
519
|
+
font-weight: 600;
|
|
520
|
+
font-size: 0.8125rem;
|
|
521
|
+
color: var(--nice-success-dark, #059669);
|
|
522
|
+
margin-bottom: 0.5rem;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.nice-reconciliation__detail-match-detail {
|
|
526
|
+
font-size: 0.75rem;
|
|
527
|
+
color: var(--nice-text-secondary);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.nice-reconciliation__detail-side-by-side {
|
|
531
|
+
display: grid;
|
|
532
|
+
grid-template-columns: 1fr 1fr;
|
|
533
|
+
gap: 1rem;
|
|
534
|
+
padding: 0.75rem;
|
|
535
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
536
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
537
|
+
margin-top: 0.75rem;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.nice-reconciliation__detail-side-item {
|
|
541
|
+
padding: 0.5rem;
|
|
542
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
543
|
+
border-radius: var(--nice-radius-sm, 0.25rem);
|
|
544
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.nice-reconciliation__detail-side-label {
|
|
548
|
+
font-size: 0.6875rem;
|
|
549
|
+
font-weight: 500;
|
|
550
|
+
text-transform: uppercase;
|
|
551
|
+
color: var(--nice-text-tertiary);
|
|
552
|
+
margin-bottom: 0.375rem;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.nice-reconciliation__detail-side-amount {
|
|
556
|
+
font-size: 1.125rem;
|
|
557
|
+
font-weight: 600;
|
|
558
|
+
font-variant-numeric: tabular-nums;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.nice-reconciliation__detail-backdrop {
|
|
562
|
+
position: fixed;
|
|
563
|
+
inset: 0;
|
|
564
|
+
background: var(--nice-overlay-30, rgba(0, 0, 0, 0.3));
|
|
565
|
+
z-index: 999;
|
|
566
|
+
opacity: 0;
|
|
567
|
+
pointer-events: none;
|
|
568
|
+
transition: opacity 0.2s ease;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.nice-reconciliation__detail-backdrop--visible {
|
|
572
|
+
opacity: 1;
|
|
573
|
+
pointer-events: auto;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.dark .nice-reconciliation__detail-panel {
|
|
577
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
578
|
+
box-shadow: -4px 0 24px var(--nice-overlay-40, rgba(0, 0, 0, 0.4));
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.dark .nice-reconciliation__detail-header {
|
|
582
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
583
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.dark .nice-reconciliation__detail-side-by-side {
|
|
587
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.dark .nice-reconciliation__detail-side-item {
|
|
591
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
592
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
593
|
+
}
|
|
594
|
+
`;function Tn(n,a="PLN",r="pl-PL"){return new Intl.NumberFormat(r,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(n)}function Lt(n,a="pl-PL"){return n?(typeof n=="string"?new Date(n):n).toLocaleDateString(a,{year:"numeric",month:"2-digit",day:"2-digit"}):"-"}function Oa(n){return n>=80?"high":n>=50?"medium":"low"}function Wa(){return`match-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Ba({item:n,isSelected:a,isDragging:r,isDropTarget:l,suggestion:s,currency:u,locale:g,onSelect:c,onDoubleClick:x,onDragStart:k,onDragEnd:S,onDrop:L,disabled:y}){const D=n.status??"unmatched",O=(s==null?void 0:s.confidence)??n.confidence,W=o=>{o.dataTransfer.setData("text/plain",n.id),o.dataTransfer.setData("source","statement"),o.dataTransfer.effectAllowed="move",k()},w=o=>{o.dataTransfer.types.includes("source")&&o.dataTransfer.getData("source")!=="statement"&&o.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${D} ${a?"nice-reconciliation__row--selected":""} ${r?"nice-reconciliation__row--dragging":""} ${l?"nice-reconciliation__row--drop-target":""}`,draggable:!y&&D!=="matched",onDragStart:W,onDragEnd:S,onDragOver:w,onDrop:L,onClick:c,onDoubleClick:x,role:"row","aria-selected":a,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${D}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsx("div",{className:"nice-reconciliation__row-date",children:Lt(n.date,g)}),e.jsx("div",{className:"nice-reconciliation__row-description",title:n.description,children:n.description}),n.counterparty&&e.jsx("div",{className:"nice-reconciliation__row-counterparty",children:n.counterparty})]}),O!=null&&e.jsxs("span",{className:`nice-reconciliation__confidence nice-reconciliation__confidence--${Oa(O)}`,children:[O,"%"]}),e.jsx("span",{className:`nice-reconciliation__row-amount ${n.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tn(n.amount,u,g)})]})}function Ka({item:n,isSelected:a,isDragging:r,isDropTarget:l,currency:s,locale:u,onSelect:g,onDoubleClick:c,onDragStart:x,onDragEnd:k,onDrop:S,disabled:L}){const y=n.status??"unmatched",D=W=>{W.dataTransfer.setData("text/plain",n.id),W.dataTransfer.setData("source","entry"),W.dataTransfer.effectAllowed="move",x()},O=W=>{W.dataTransfer.types.includes("source")&&W.dataTransfer.getData("source")!=="entry"&&W.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${y} ${a?"nice-reconciliation__row--selected":""} ${r?"nice-reconciliation__row--dragging":""} ${l?"nice-reconciliation__row--drop-target":""}`,draggable:!L&&y!=="matched",onDragStart:D,onDragEnd:k,onDragOver:O,onDrop:S,onClick:g,onDoubleClick:c,role:"row","aria-selected":a,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${y}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsxs("div",{className:"nice-reconciliation__row-date",children:[Lt(n.date,u),n.documentNumber&&e.jsxs("span",{children:[" · ",n.documentNumber]})]}),e.jsx("div",{className:"nice-reconciliation__row-description",title:n.description,children:n.description}),n.partyName&&e.jsx("div",{className:"nice-reconciliation__row-counterparty",children:n.partyName})]}),e.jsx("span",{className:`nice-reconciliation__row-amount ${n.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tn(n.amount,s,u)})]})}t.forwardRef(function(n,a){const{statements:r,bankTransactions:l,entries:s,accountingEntries:u,matches:g,defaultMatches:c=[],suggestions:x=[],config:k={},currency:S,showConfidence:L,statementPanelConfig:y,entryPanelConfig:D,onMatch:O,onAutoMatch:W,onUnmatch:w,onBatchAction:o,onFilterChange:M,onRequestSuggestions:p,onSelectionChange:E,onComplete:K,size:ie="medium",showToolbar:se=!0,showFilters:$e=!0,showSummary:$=!0,showSuggestions:oe=!0,layout:xe="horizontal",enableDragDrop:de=!0,enableKeyboard:H=!0,enableDetailPanel:Z=!0,loading:R=!1,disabled:F=!1,readOnly:b=!1,locale:je="pl-PL",labels:pe={},className:G,style:ne}=n,U=r??l??[],X=s??u??[],ge=S??k.currency??"PLN",[we,Ae]=t.useState(c),[Ke,Ge]=t.useState(new Set),[Se,Ue]=t.useState(new Set),[Ee,Xe]=t.useState(null),[te,ve]=t.useState(null),[he,z]=t.useState({}),[ue,Q]=t.useState(null),fe=g??we,A=t.useRef(null),ce=t.useRef(null);t.useEffect(()=>{const I="nice-reconciliation-styles";if(!document.getElementById(I)){const ae=document.createElement("style");ae.id=I,ae.textContent=Pa,document.head.appendChild(ae)}},[]);const P=t.useMemo(()=>{const I=new Set;return fe.forEach(ae=>ae.statementIds.forEach(me=>I.add(me))),I},[fe]),ze=t.useMemo(()=>{const I=new Set;return fe.forEach(ae=>ae.entryIds.forEach(me=>I.add(me))),I},[fe]),Ie=t.useMemo(()=>{const I=U.filter(De=>!P.has(De.id)),ae=X.filter(De=>!ze.has(De.id)),me=U.reduce((De,Le)=>De+Le.amount,0),be=X.reduce((De,Le)=>De+Le.amount,0),ln=U.filter(De=>P.has(De.id)).reduce((De,Le)=>De+Le.amount,0);return{totalStatements:U.length,totalEntries:X.length,matchedStatements:U.length-I.length,matchedEntries:X.length-ae.length,unmatchedStatements:I.length,unmatchedEntries:ae.length,statementTotal:me,entryTotal:be,matchedAmount:ln,unmatchedStatementAmount:I.reduce((De,Le)=>De+Le.amount,0),unmatchedEntryAmount:ae.reduce((De,Le)=>De+Le.amount,0),difference:me-be,matchPercentage:U.length>0?Math.round((U.length-I.length)/U.length*100):0,matchCount:fe.length,partialMatchCount:fe.filter(De=>De.status==="partial").length,pendingSuggestions:x.length}},[U,X,fe,x,P,ze]),ee=t.useCallback((I,ae)=>{const me=U.filter(nn=>I.includes(nn.id)),be=X.filter(nn=>ae.includes(nn.id));if(me.length===0||be.length===0)return null;const ln=me.reduce((nn,dn)=>nn+dn.amount,0),De=be.reduce((nn,dn)=>nn+dn.amount,0),Le=Math.abs(ln-De),Ye=k.amountTolerance??.01,Ne={id:Wa(),statementIds:I,entryIds:ae,status:Le<=Ye?"matched":"partial",statementTotal:ln,entryTotal:De,difference:Le,confidence:Le<=Ye?100:Math.max(0,100-Le/Math.max(Math.abs(ln),1)*100),matchedBy:"user",matchedAt:new Date};return g||Ae(nn=>[...nn,Ne]),O==null||O(Ne,me,be),Ge(new Set),Ue(new Set),Ne},[U,X,k.amountTolerance,g,O]),Je=t.useCallback(I=>{const ae=fe.find(me=>me.id===I);ae&&(g||Ae(me=>me.filter(be=>be.id!==I)),w==null||w(I,ae.statementIds,ae.entryIds))},[fe,g,w]),en=t.useCallback(async()=>{const I=[],ae=new Set(P),me=new Set(ze),be=k.amountTolerance??.01,ln=k.dateTolerance??3;for(const De of U){if(ae.has(De.id))continue;const Le=X.filter(Ye=>{if(me.has(Ye.id)||Math.abs(De.amount-Ye.amount)>be)return!1;const Ne=new Date(De.date),nn=new Date(Ye.date);return!(Math.abs(Ne.getTime()-nn.getTime())/(1e3*60*60*24)>ln)});if(Le.length===1){const Ye=Le[0],Ne=ee([De.id],[Ye.id]);Ne&&(I.push(Ne),ae.add(De.id),me.add(Ye.id))}}return o==null||o("autoMatch",I),I},[U,X,P,ze,k,ee,o]),ke=t.useCallback((I,ae,me,be)=>{be!==ae&&(be==="statement"?ee([me],[I]):ee([I],[me]),Xe(null),ve(null))},[ee]),An=t.useCallback(()=>{const I=Array.from(Ke),ae=Array.from(Se);I.length>0&&ae.length>0&&ee(I,ae)},[Ke,Se,ee]);t.useEffect(()=>{E==null||E(Array.from(Ke),Array.from(Se))},[Ke,Se,E]),t.useImperativeHandle(a,()=>({getMatches:()=>fe,getUnmatchedStatements:()=>U.filter(I=>!P.has(I.id)),getUnmatchedEntries:()=>X.filter(I=>!ze.has(I.id)),createMatch:ee,removeMatch:Je,autoMatch:en,getSuggestions:async I=>p?p(I??U.filter(ae=>!P.has(ae.id)).map(ae=>ae.id)):[],applySuggestion:I=>ee([I.statementId],I.entryIds),approveAll:()=>{o==null||o("approveAll",fe)},clearAll:()=>{g||Ae([]),o==null||o("clearAll",[])},exportMatched:I=>{o==null||o("exportMatched",fe)},getSummary:()=>Ie,reset:()=>{g||Ae([]),Ge(new Set),Ue(new Set),z({})},focusStatements:()=>{var I;return(I=A.current)==null?void 0:I.focus()},focusEntries:()=>{var I;return(I=ce.current)==null?void 0:I.focus()}}),[fe,U,X,P,ze,ee,Je,en,p,o,g,Ie]);const bn=t.useMemo(()=>U.filter(I=>{var ae,me;if(he.status&&he.status.length>0){const be=P.has(I.id)?"matched":"unmatched";if(!he.status.includes(be))return!1}if(he.searchText){const be=he.searchText.toLowerCase();if(!((ae=I.description)!=null&&ae.toLowerCase().includes(be))&&!((me=I.counterparty)!=null&&me.toLowerCase().includes(be)))return!1}return!0}),[U,he,P]),Pn=t.useMemo(()=>X.filter(I=>{var ae,me;if(he.status&&he.status.length>0){const be=ze.has(I.id)?"matched":"unmatched";if(!he.status.includes(be))return!1}if(he.searchText){const be=he.searchText.toLowerCase();if(!((ae=I.description)!=null&&ae.toLowerCase().includes(be))&&!((me=I.partyName)!=null&&me.toLowerCase().includes(be)))return!1}return!0}),[X,he,ze]),Nn=Ke.size>0&&Se.size>0&&!b&&!F;return e.jsxs("div",{className:`nice-reconciliation nice-reconciliation--${xe} ${G??""}`,style:ne,children:[se&&e.jsxs("div",{className:"nice-reconciliation__toolbar",children:[e.jsxs("div",{className:"nice-reconciliation__toolbar-group",children:[e.jsxs("button",{type:"button",className:"nice-reconciliation__btn nice-reconciliation__btn--primary",onClick:en,disabled:F||b||R,children:["⚡ ",pe.autoMatch??"Auto-match"]}),e.jsx("button",{type:"button",className:"nice-reconciliation__btn nice-reconciliation__btn--success",onClick:An,disabled:!Nn||R,children:"🔗 Match Selected"})]}),e.jsxs("div",{className:"nice-reconciliation__toolbar-group nice-reconciliation__toolbar-group--end",children:[e.jsxs("button",{type:"button",className:"nice-reconciliation__btn",onClick:()=>o==null?void 0:o("approveAll",fe),disabled:fe.length===0||F||R,children:["✓ ",pe.approveAll??"Approve All"]}),e.jsxs("button",{type:"button",className:"nice-reconciliation__btn",onClick:()=>{g||Ae([]),o==null||o("clearAll",[])},disabled:fe.length===0||F||b||R,children:["✕ ",pe.clearAll??"Clear All"]})]})]}),e.jsxs("div",{className:"nice-reconciliation__content",children:[e.jsxs("div",{className:"nice-reconciliation__panel nice-reconciliation__panel--statements",children:[e.jsx("div",{className:"nice-reconciliation__panel-header",children:e.jsxs("span",{className:"nice-reconciliation__panel-title",children:["📄 ",pe.statementPanelTitle??"Bank Statement",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:bn.length})]})}),e.jsx("div",{ref:A,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:bn.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:"📋"}),pe.noStatements??"No statement items"]}):bn.map(I=>e.jsx(Ba,{item:{...I,status:P.has(I.id)?"matched":"unmatched"},isSelected:Ke.has(I.id),isDragging:Ee===I.id,isDropTarget:te===I.id,suggestion:x.find(ae=>ae.statementId===I.id),currency:ge,locale:je,onSelect:()=>{F||Ge(ae=>{const me=new Set(ae);return me.has(I.id)?me.delete(I.id):me.add(I.id),me})},onDoubleClick:()=>Z&&Q({type:"statement",id:I.id}),onDragStart:()=>Xe(I.id),onDragEnd:()=>{Xe(null),ve(null)},onDrop:()=>{Ee&&Ee!==I.id&&ke(I.id,"statement",Ee,"entry")},disabled:F||b||!de},I.id))})]}),e.jsxs("div",{className:"nice-reconciliation__panel nice-reconciliation__panel--entries",children:[e.jsx("div",{className:"nice-reconciliation__panel-header",children:e.jsxs("span",{className:"nice-reconciliation__panel-title",children:["📒 ",pe.entryPanelTitle??"Book Entries",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:Pn.length})]})}),e.jsx("div",{ref:ce,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:Pn.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:"📚"}),pe.noEntries??"No book entries"]}):Pn.map(I=>e.jsx(Ka,{item:{...I,status:ze.has(I.id)?"matched":"unmatched"},isSelected:Se.has(I.id),isDragging:Ee===I.id,isDropTarget:te===I.id,currency:ge,locale:je,onSelect:()=>{F||Ue(ae=>{const me=new Set(ae);return me.has(I.id)?me.delete(I.id):me.add(I.id),me})},onDoubleClick:()=>Z&&Q({type:"entry",id:I.id}),onDragStart:()=>Xe(I.id),onDragEnd:()=>{Xe(null),ve(null)},onDrop:()=>{Ee&&Ee!==I.id&&ke(I.id,"entry",Ee,"statement")},disabled:F||b||!de},I.id))})]})]}),$&&e.jsxs("div",{className:"nice-reconciliation__summary",children:[e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Matched:"}),e.jsxs("span",{className:"nice-reconciliation__summary-value nice-reconciliation__summary-value--success",children:[Ie.matchedStatements,"/",Ie.totalStatements," (",Ie.matchPercentage,"%)"]})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Matched Amount:"}),e.jsx("span",{className:"nice-reconciliation__summary-value",children:Tn(Ie.matchedAmount,ge,je)})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Unmatched:"}),e.jsx("span",{className:"nice-reconciliation__summary-value nice-reconciliation__summary-value--warning",children:Tn(Ie.unmatchedStatementAmount,ge,je)})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Difference:"}),e.jsx("span",{className:`nice-reconciliation__summary-value ${Math.abs(Ie.difference)<.01?"nice-reconciliation__summary-value--success":"nice-reconciliation__summary-value--danger"}`,children:Tn(Ie.difference,ge,je)})]})]}),Z&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`nice-reconciliation__detail-backdrop ${ue?"nice-reconciliation__detail-backdrop--visible":""}`,onClick:()=>Q(null)}),e.jsx("div",{className:`nice-reconciliation__detail-panel ${ue?"nice-reconciliation__detail-panel--open":""}`,children:ue&&e.jsx(Ua,{type:ue.type,id:ue.id,statements:U,entries:X,matches:fe,currency:ge,locale:je,labels:pe,onClose:()=>Q(null)})})]})]})});function Ua({type:n,id:a,statements:r,entries:l,matches:s,currency:u,locale:g,labels:c,onClose:x}){var W;const k=n==="statement"?r.find(w=>w.id===a):l.find(w=>w.id===a),S=n==="statement"?s.find(w=>w.statementIds.includes(a)):s.find(w=>w.entryIds.includes(a)),L=S?n==="statement"?l.filter(w=>S.entryIds.includes(w.id)):r.filter(w=>S.statementIds.includes(w.id)):[];if(!k)return null;const y=n==="statement",D=y?k:null,O=y?null:k;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-reconciliation__detail-header",children:[e.jsxs("span",{className:"nice-reconciliation__detail-title",children:[y?"📄":"📒"," ",y?c.statementDetails??"Transaction Details":c.entryDetails??"Entry Details"]}),e.jsx("button",{type:"button",className:"nice-reconciliation__detail-close",onClick:x,"aria-label":"Close",children:"✕"})]}),e.jsxs("div",{className:"nice-reconciliation__detail-content",children:[S&&e.jsxs("div",{className:"nice-reconciliation__detail-match-info",children:[e.jsxs("div",{className:"nice-reconciliation__detail-match-header",children:["✓ ",c.matchedWith??"Matched"," (",((W=S.confidence)==null?void 0:W.toFixed(0))??100,"% confidence)"]}),e.jsx("div",{className:"nice-reconciliation__detail-match-detail",children:S.matchedBy==="ai"?c.matchedByAI??"Matched automatically by AI":c.matchedManually??"Matched manually"}),e.jsxs("div",{className:"nice-reconciliation__detail-side-by-side",children:[e.jsxs("div",{className:"nice-reconciliation__detail-side-item",children:[e.jsx("div",{className:"nice-reconciliation__detail-side-label",children:c.statementTotal??"Statement"}),e.jsx("div",{className:`nice-reconciliation__detail-side-amount ${S.statementTotal>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tn(S.statementTotal,u,g)})]}),e.jsxs("div",{className:"nice-reconciliation__detail-side-item",children:[e.jsx("div",{className:"nice-reconciliation__detail-side-label",children:c.entryTotal??"Book Entry"}),e.jsx("div",{className:`nice-reconciliation__detail-side-amount ${S.entryTotal>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tn(S.entryTotal,u,g)})]})]}),S.difference>.01&&e.jsxs("div",{className:"nice-reconciliation__detail-row",style:{marginTop:"0.5rem",borderBottom:"none"},children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.difference??"Difference",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",style:{color:"var(--nice-warning, #f59e0b)"},children:Tn(S.difference,u,g)})]})]}),e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:["📋"," ",y?c.transactionInfo??"Transaction Information":c.entryInfo??"Entry Information"]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.date??"Date",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:Lt(k.date,g)})]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.description??"Description",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:k.description})]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.amount??"Amount",":"]}),e.jsx("span",{className:`nice-reconciliation__detail-value ${k.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tn(k.amount,u,g)})]}),y&&(D==null?void 0:D.counterparty)&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.counterparty??"Counterparty",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:D.counterparty})]}),y&&(D==null?void 0:D.counterpartyAccount)&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.accountNumber??"Account",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",style:{fontFamily:"monospace",fontSize:"0.75rem"},children:D.counterpartyAccount})]}),!y&&(O==null?void 0:O.partyName)&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.party??"Party",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:O.partyName})]}),!y&&(O==null?void 0:O.documentNumber)&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.documentRef??"Document Ref",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:O.documentNumber})]}),y&&(D==null?void 0:D.referenceNumber)&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.reference??"Reference",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:D.referenceNumber})]})]}),L.length>0&&e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:["🔗"," ",y?c.matchedEntries??"Matched Entries":c.matchedStatements??"Matched Statements"]}),L.map(w=>e.jsxs("div",{style:{padding:"0.5rem",background:"var(--nice-bg-secondary, #f9fafb)",borderRadius:"0.25rem",marginBottom:"0.5rem",fontSize:"0.8125rem"},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"0.25rem"},children:w.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"var(--nice-text-secondary)"},children:[e.jsx("span",{children:Lt(w.date,g)}),e.jsx("span",{style:{fontWeight:600,color:w.amount>=0?"var(--nice-success)":"var(--nice-danger)"},children:Tn(w.amount,u,g)})]})]},w.id))]})]})]})}function Ga(n,a,r){const l=new Map,s=[];n.forEach(g=>l.set(String(g[a]),{data:g,children:[],key:String(g[a]),depth:0})),n.forEach(g=>{const c=g[r],x=l.get(String(g[a]));if(c!=null&&c!==""&&l.has(String(c))){const k=l.get(String(c));x.depth=k.depth+1,k.children.push(x)}else s.push(x)});const u=(g,c)=>{g.forEach(x=>{x.depth=c,u(x.children,c+1)})};return u(s,0),s}function Ei(n,a,r,l=0){return n.map(s=>({data:s,key:String(s[r]),depth:l,children:Array.isArray(s[a])?Ei(s[a],a,r,l+1):[]}))}function Xa(n){const a=[],r=l=>{l.forEach(s=>{a.push(s.key),r(s.children)})};return r(n),a}function Ha(n,a){const r=[],l=s=>{s.forEach(u=>{r.push(u),u.children.length>0&&a.has(u.key)&&l(u.children)})};return l(n),r}function Ti(n,a,r){return!a||!r?n:[...n].sort((l,s)=>{const u=l.data[a]??"",g=s.data[a]??"",c=typeof u=="number"&&typeof g=="number"?u-g:String(u).localeCompare(String(g));return r==="desc"?-c:c}).map(l=>({...l,children:Ti(l.children,a,r)}))}function Li({columns:n,data:a,keyField:r="id",parentKeyField:l="parentId",nested:s=!1,childrenField:u="children",expandedKeys:g,onExpandedChange:c,defaultExpandAll:x=!1,sortable:k=!0,sortField:S,sortDirection:L,onSort:y,selectable:D,selectedKeys:O,onSelectionChange:W,searchable:w,searchPlaceholder:o,striped:M,compact:p,loading:E,emptyText:K,toolbar:ie,onRowClick:se,className:$e,style:$}){const{t:oe}=ye.ce(),xe=t.useMemo(()=>s?Ei(a,u,r):Ga(a,r,l),[a,r,l,s,u]),de=t.useMemo(()=>Xa(xe),[xe]),[H,Z]=t.useState(()=>x?new Set(de):new Set),R=g?new Set(g):H,[F,b]=t.useState({field:"",dir:null}),[je,pe]=t.useState(new Set),[G,ne]=t.useState(""),U=S??F.field,X=L??F.dir,ge=O??je,we=t.useMemo(()=>n.filter(te=>!te.hidden),[n]),Ae=t.useCallback(te=>{const ve=U===te?X==="asc"?"desc":X==="desc"?null:"asc":"asc";y?y(te,ve):b({field:te,dir:ve})},[U,X,y]),Ke=t.useCallback(te=>{const ve=new Set(R);ve.has(te)?ve.delete(te):ve.add(te),c?c([...ve]):Z(ve)},[R,c]),Ge=t.useCallback(te=>{const ve=new Set(ge);ve.has(te)?ve.delete(te):ve.add(te),W?W(ve):pe(ve)},[ge,W]),Se=t.useMemo(()=>{if(!G)return xe;const te=G.toLowerCase(),ve=he=>he.reduce((z,ue)=>{const Q=ve(ue.children);return(we.some(fe=>String(ue.data[fe.field]??"").toLowerCase().includes(te))||Q.length>0)&&z.push({...ue,children:Q}),z},[]);return ve(xe)},[xe,G,we]),Ue=t.useMemo(()=>Ti(Se,U,X),[Se,U,X]),Ee=t.useMemo(()=>Ha(Ue,R),[Ue,R]),Xe=({field:te})=>U!==te||!X?e.jsx("span",{className:"nice-table__sort-icon",style:{opacity:.3},children:"↕"}):e.jsx("span",{className:"nice-table__sort-icon",children:X==="asc"?"↑":"↓"});return e.jsxs("div",{className:`nice-treegrid nice-datagrid ${$e||""}`,style:$,children:[(w||ie)&&e.jsxs("div",{className:"nice-datagrid__toolbar",children:[w&&e.jsx("div",{className:"nice-datagrid__search",children:e.jsx("input",{type:"text",value:G,onChange:te=>ne(te.target.value),placeholder:o||oe("controls.search","Search...")})}),ie]}),e.jsx("div",{className:"nice-datagrid__table-wrap",children:e.jsxs("table",{className:`${M?"nice-table--striped":""} ${p?"nice-table--compact":""}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[D&&e.jsx("th",{className:"nice-datagrid__checkbox",style:{width:36}}),we.map(te=>e.jsxs("th",{style:{width:te.width,minWidth:te.minWidth,textAlign:te.align},className:k&&te.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>k&&te.sortable!==!1&&Ae(te.field),children:[te.header,k&&te.sortable!==!1&&e.jsx(Xe,{field:te.field})]},te.field))]})}),e.jsx("tbody",{children:E?e.jsx("tr",{children:e.jsx("td",{colSpan:we.length+(D?1:0),className:"nice-datagrid__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):Ee.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:we.length+(D?1:0),className:"nice-datagrid__empty",children:K||oe("controls.noData","No data available")})}):Ee.map((te,ve)=>{const he=ge.has(te.key),z=te.children.length>0,ue=R.has(te.key);return e.jsxs("tr",{className:he?"nice-datagrid__row--selected":void 0,onClick:()=>se==null?void 0:se(te.data),style:se?{cursor:"pointer"}:void 0,children:[D&&e.jsx("td",{className:"nice-datagrid__checkbox",onClick:Q=>Q.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:he,onChange:()=>Ge(te.key),"aria-label":`Select row ${te.key}`})}),we.map((Q,fe)=>e.jsxs("td",{style:{textAlign:Q.align},children:[fe===0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{display:"inline-block",width:te.depth*20}}),e.jsx("button",{className:`nice-treegrid__toggle ${z?"":"nice-treegrid__toggle--leaf"}`,onClick:A=>{A.stopPropagation(),z&&Ke(te.key)},tabIndex:z?0:-1,"aria-expanded":z?ue:void 0,"aria-label":z?ue?"Collapse":"Expand":void 0,children:z?ue?"▾":"▸":""})]}),Q.render?Q.render(te.data[Q.field],te.data,ve):String(te.data[Q.field]??"")]},Q.field))]},te.key)})})]})})]})}const xn={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},Qa=()=>e.jsxs("svg",{...xn,children:[e.jsx("path",{d:"M3 7v6h6"}),e.jsx("path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13"})]}),Va=()=>e.jsxs("svg",{...xn,children:[e.jsx("path",{d:"M21 7v6h-6"}),e.jsx("path",{d:"M3 17a9 9 0 0 1 15-6.7L21 13"})]}),Ja=()=>e.jsxs("svg",{...xn,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"15",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"18",y2:"18"})]}),Ya=()=>e.jsxs("svg",{...xn,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"6",y1:"12",x2:"18",y2:"12"}),e.jsx("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),Za=()=>e.jsxs("svg",{...xn,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"6",y1:"18",x2:"21",y2:"18"})]}),qa=()=>e.jsxs("svg",{...xn,children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"6",rx:"1"}),e.jsx("rect",{x:"3",y:"14",width:"18",height:"6",rx:"1"}),e.jsx("line",{x1:"12",y1:"11",x2:"12",y2:"13"})]}),er=()=>e.jsxs("svg",{...xn,children:[e.jsx("rect",{x:"4",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("line",{x1:"11",y1:"12",x2:"13",y2:"12"})]}),nr=()=>e.jsxs("svg",{...xn,children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"6",rx:"1"}),e.jsx("line",{x1:"6",y1:"17",x2:"18",y2:"17"})]}),tr=()=>e.jsxs("svg",{...xn,children:[e.jsx("rect",{x:"4",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("line",{x1:"14",y1:"12",x2:"20",y2:"12"})]}),ir=()=>e.jsx("svg",{...xn,children:e.jsx("polyline",{points:"6 9 12 4 18 9"})}),ar=()=>e.jsx("svg",{...xn,children:e.jsx("polyline",{points:"6 15 12 20 18 15"})}),rr=()=>e.jsxs("svg",{...xn,style:{opacity:.55},children:[e.jsx("polyline",{points:"6 9 12 4 18 9"}),e.jsx("polyline",{points:"6 15 12 20 18 15"})]}),lr=()=>e.jsxs("svg",{...xn,children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),sr=()=>e.jsxs("svg",{...xn,children:[e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),e.jsx("line",{x1:"6",y1:"18",x2:"18",y2:"6"})]});function Ai(n){let a="",r=n;for(;r>=0;)a=String.fromCharCode(65+r%26)+a,r=Math.floor(r/26)-1;return a}function Re(n,a){return`${Ai(a)}${n+1}`}function Ve(n){const a=n.match(/^([A-Z]+)(\d+)$/);if(!a)return null;let r=0;for(let l=0;l<a[1].length;l++)r=r*26+(a[1].charCodeAt(l)-64);return{row:parseInt(a[2],10)-1,col:r-1}}function cr(n,a,r=new Set){const l=n.startsWith("=")?n.slice(1).trim():n,s=(w,o)=>{if(!w||!o)return[];const M=[];for(let p=w.row;p<=o.row;p++)for(let E=w.col;E<=o.col;E++){const K=Qe(Re(p,E),a,new Set(r));typeof K=="number"&&M.push(K)}return M},u=(w,o)=>{if(!w||!o)return[];const M=[];for(let p=w.row;p<=o.row;p++)for(let E=w.col;E<=o.col;E++)M.push(Qe(Re(p,E),a,new Set(r)));return M},g=l.match(/^(\w+)\(([A-Z]+\d+):([A-Z]+\d+)\)$/i);if(g){const w=g[1].toUpperCase(),o=Ve(g[2].toUpperCase()),M=Ve(g[3].toUpperCase());switch(w){case"SUM":return s(o,M).reduce((p,E)=>p+E,0);case"AVG":case"AVERAGE":{const p=s(o,M);return p.length>0?p.reduce((E,K)=>E+K,0)/p.length:0}case"COUNT":return s(o,M).length;case"COUNTA":return u(o,M).filter(p=>p!==null&&p!=="").length;case"COUNTBLANK":return u(o,M).filter(p=>p===null||p==="").length;case"MIN":{const p=s(o,M);return p.length?Math.min(...p):0}case"MAX":{const p=s(o,M);return p.length?Math.max(...p):0}case"MEDIAN":{const p=s(o,M).sort((K,ie)=>K-ie);if(!p.length)return 0;const E=Math.floor(p.length/2);return p.length%2?p[E]:(p[E-1]+p[E])/2}case"STDEV":{const p=s(o,M);if(p.length<2)return 0;const E=p.reduce((K,ie)=>K+ie,0)/p.length;return Math.sqrt(p.reduce((K,ie)=>K+(ie-E)**2,0)/(p.length-1))}case"PRODUCT":{const p=s(o,M);return p.length?p.reduce((E,K)=>E*K,1):0}}}const c=l.match(/^(SUMIF|COUNTIF)\(([A-Z]+\d+):([A-Z]+\d+)\s*,\s*"?([^"]*)"?\)$/i);if(c){const w=c[1].toUpperCase(),o=Ve(c[2].toUpperCase()),M=Ve(c[3].toUpperCase()),p=c[4];if(o&&M){let E=0;for(let K=o.row;K<=M.row;K++)for(let ie=o.col;ie<=M.col;ie++){const se=Qe(Re(K,ie),a,new Set(r));(p.startsWith(">")?Number(se)>Number(p.slice(1)):p.startsWith("<")?Number(se)<Number(p.slice(1)):String(se)===p||typeof se=="number"&&se===Number(p))&&(E+=w==="SUMIF"?typeof se=="number"?se:0:1)}return E}}const x=l.match(/^IF\(([^,]+),\s*([^,]+),\s*([^)]+)\)$/i);if(x){const w=x[1].trim(),o=x[2].trim(),M=x[3].trim(),p=w.match(/^([A-Z]+\d+)\s*([><=!]+)\s*(\S+)$/i);let E=!1;if(p){const se=Qe(p[1].toUpperCase(),a,new Set(r)),$e=isNaN(Number(p[3]))?p[3].replace(/^"|"$/g,""):Number(p[3]),$=p[2],oe=typeof se=="number"?se:Number(se)||0,xe=typeof $e=="number"?$e:Number($e)||0;switch($){case">":E=oe>xe;break;case"<":E=oe<xe;break;case">=":E=oe>=xe;break;case"<=":E=oe<=xe;break;case"=":case"==":E=oe===xe;break;case"<>":case"!=":E=oe!==xe;break}}const K=E?o:M;if(Ve(K.toUpperCase()))return Qe(K.toUpperCase(),a,new Set(r));const ie=Number(K);return isNaN(ie)?K.replace(/^"|"$/g,""):ie}const k=l.match(/^CONCAT\((.+)\)$/i);if(k)return k[1].split(",").map(w=>w.trim()).map(w=>{if(w.startsWith('"')&&w.endsWith('"'))return w.slice(1,-1);if(Ve(w.toUpperCase())){const o=Qe(w.toUpperCase(),a,new Set(r));return o!==null?String(o):""}return w}).join("");const S=l.match(/^VLOOKUP\(([^,]+),\s*([A-Z]+\d+):([A-Z]+\d+),\s*(\d+)\)$/i);if(S){let w;Ve(S[1].trim().toUpperCase())?w=Qe(S[1].trim().toUpperCase(),a,new Set(r)):w=isNaN(Number(S[1]))?S[1].replace(/^"|"$/g,""):Number(S[1]);const o=Ve(S[2].toUpperCase()),M=Ve(S[3].toUpperCase()),p=parseInt(S[4])-1;if(o&&M)for(let E=o.row;E<=M.row;E++){const K=Qe(Re(E,o.col),a,new Set(r));if(String(K)===String(w))return Qe(Re(E,o.col+p),a,new Set(r))}return null}const L=l.match(/^(ABS|ROUND|FLOOR|CEIL|CEILING|SQRT|LEN|UPPER|LOWER|TRIM|INT)\(([^)]+)\)$/i);if(L){const w=L[1].toUpperCase(),o=L[2].trim();let M;switch(Ve(o.toUpperCase())?M=Qe(o.toUpperCase(),a,new Set(r)):M=isNaN(Number(o))?o.replace(/^"|"$/g,""):Number(o),w){case"ABS":return Math.abs(Number(M)||0);case"ROUND":return Math.round(Number(M)||0);case"FLOOR":return Math.floor(Number(M)||0);case"CEIL":case"CEILING":return Math.ceil(Number(M)||0);case"SQRT":return Math.sqrt(Number(M)||0);case"INT":return Math.trunc(Number(M)||0);case"LEN":return String(M??"").length;case"UPPER":return String(M??"").toUpperCase();case"LOWER":return String(M??"").toLowerCase();case"TRIM":return String(M??"").trim()}}const y=l.match(/^POWER\(([^,]+),\s*([^)]+)\)$/i);if(y){const w=Number(Ve(y[1].trim().toUpperCase())?Qe(y[1].trim().toUpperCase(),a,new Set(r)):y[1].trim())||0,o=Number(Ve(y[2].trim().toUpperCase())?Qe(y[2].trim().toUpperCase(),a,new Set(r)):y[2].trim())||0;return Math.pow(w,o)}if(/^NOW\(\)$/i.test(l))return new Date().toISOString();if(/^TODAY\(\)$/i.test(l))return new Date().toISOString().split("T")[0];if(/^PI\(\)$/i.test(l))return Math.PI;const D=l.match(/^([A-Z]+\d+)$/i);if(D)return Qe(D[1].toUpperCase(),a,r);const O=l.match(/^([A-Z]+\d+)\s*([+\-*/])\s*([A-Z]+\d+|\d+\.?\d*)$/i);if(O){const w=O[1].toUpperCase(),o=O[2],M=O[3],p=Qe(w,a,r),E=Ve(M.toUpperCase())?Qe(M.toUpperCase(),a,r):parseFloat(M),K=typeof p=="number"?p:0,ie=typeof E=="number"?E:0;switch(o){case"+":return K+ie;case"-":return K-ie;case"*":return K*ie;case"/":return ie!==0?K/ie:null}}const W=parseFloat(l);return isNaN(W)?l:W}function Qe(n,a,r){if(r.has(n))return null;r.add(n);const l=a[n];return l?l.formula?cr(l.formula,a,r):l.value:null}function wi(n,a){return n==null?"":a==="percent"&&typeof n=="number"?`${(n*100).toFixed(1)}%`:a==="currency"&&typeof n=="number"?`$${n.toFixed(2)}`:String(n)}function ki(n){return{name:n,data:{}}}const ni=t.forwardRef(({sheets:n,activeSheet:a,rows:r=50,cols:l=26,showToolbar:s=!0,showFormulaBar:u=!0,showSheetTabs:g=!0,readOnly:c=!1,onChange:x,onActiveSheetChange:k,onCellSelect:S,onCopy:L,onPaste:y,onInsert:D,onRemove:O,maxUndo:W=50,sortable:w=!1,filterable:o=!1,rangeSelection:M=!0,className:p,style:E,id:K,...ie},se)=>{var at,rt,Bn,Kn,lt;const $e=ye.hl(K),{t:$}=ye.ce(),[oe,xe]=t.useState(()=>n??[ki($("spreadsheet.sheet","Sheet")+" 1")]),[de,H]=t.useState(0),Z=n??oe,R=a??de,F=Z[R]??Z[0],[b,je]=t.useState(null),[pe,G]=t.useState(null),[ne,U]=t.useState(!1),[X,ge]=t.useState(null),[we,Ae]=t.useState(""),Ke=t.useRef(null),Ge=t.useRef(null),[Se,Ue]=t.useState([]),[Ee,Xe]=t.useState([]),[te,ve]=t.useState(null),he=t.useRef({x:0,width:80}),[z,ue]=t.useState(null),[Q,fe]=t.useState(null),[A,ce]=t.useState("");t.useEffect(()=>{X&&Ke.current&&Ke.current.focus()},[X]);const P=t.useMemo(()=>{if(!b)return null;const m=pe??b;return{startRow:Math.min(b.row,m.row),startCol:Math.min(b.col,m.col),endRow:Math.max(b.row,m.row),endCol:Math.max(b.col,m.col)}},[b,pe]),ze=t.useCallback((m,d)=>P?m>=P.startRow&&m<=P.endRow&&d>=P.startCol&&d<=P.endCol:!1,[P]),Ie=t.useCallback(m=>{Ue(d=>{const _=[...d,m.map(T=>({...T,data:{...T.data}}))];return _.length>W?_.slice(-W):_}),Xe([])},[W]),ee=t.useCallback((m,d=!0)=>{d&&Ie(Z);const _=m(Z);n||xe(_),x==null||x(_)},[Z,n,x,Ie]),Je=t.useCallback(()=>{if(Se.length===0)return;const m=Se[Se.length-1];Xe(d=>[...d,Z.map(_=>({..._,data:{..._.data}}))]),Ue(d=>d.slice(0,-1)),n||xe(m),x==null||x(m)},[Se,Z,n,x]),en=t.useCallback(()=>{if(Ee.length===0)return;const m=Ee[Ee.length-1];Ue(d=>[...d,Z.map(_=>({..._,data:{..._.data}}))]),Xe(d=>d.slice(0,-1)),n||xe(m),x==null||x(m)},[Ee,Z,n,x]),ke=t.useCallback(m=>{a||H(m),k==null||k(m),je(null),G(null),ge(null)},[a,k]),An=t.useCallback((m,d,_)=>{const T=Re(m,d);ee(q=>{const N=q.map((Y,Pe)=>Pe===R?{...Y,data:{...Y.data}}:Y),B=_.startsWith("=");return N[R].data[T]={...N[R].data[T]??{value:null},formula:B?_:void 0,value:B?null:isNaN(Number(_))?_:Number(_)},N})},[R,ee]),bn=t.useCallback((m,d,_)=>{_!=null&&_.shiftKey&&M&&b?G({row:m,col:d}):(je({row:m,col:d}),G(null)),ge(null),S==null||S(R,m,d)},[R,S,M,b]),Pn=t.useCallback((m,d,_)=>{_.button===0&&(bn(m,d,_),M&&!_.shiftKey&&U(!0))},[bn,M]),Nn=t.useCallback((m,d)=>{ne&&G({row:m,col:d})},[ne]);t.useEffect(()=>{if(!ne)return;const m=()=>U(!1);return document.addEventListener("mouseup",m),()=>document.removeEventListener("mouseup",m)},[ne]);const I=t.useCallback((m,d)=>{if(c)return;const _=Re(m,d),T=F.data[_];T!=null&&T.readOnly||(ge({row:m,col:d}),Ae((T==null?void 0:T.formula)??((T==null?void 0:T.value)!=null?String(T.value):"")))},[c,F.data]),ae=t.useCallback(()=>{X&&(An(X.row,X.col,we),ge(null))},[X,we,An]),me=t.useCallback(m=>{if(m.key==="Enter")ae();else if(m.key==="Escape")ge(null);else if(m.key==="Tab"&&(m.preventDefault(),ae(),b)){const d=m.shiftKey?Math.max(0,b.col-1):Math.min(l-1,b.col+1);je({row:b.row,col:d})}},[ae,b,l]),be=t.useCallback((m,d)=>{if(!b)return;const _=P??{startRow:b.row,startCol:b.col,endRow:b.row,endCol:b.col};ee(T=>{const q=T.map((N,B)=>B===R?{...N,data:{...N.data}}:N);for(let N=_.startRow;N<=_.endRow;N++)for(let B=_.startCol;B<=_.endCol;B++){const Y=Re(N,B);q[R].data[Y]={...q[R].data[Y]??{value:null},[m]:d}}return q})},[b,P,R,ee]),ln=t.useCallback(m=>{if(!P||(L==null?void 0:L(P))===!1)return;const{startRow:d,startCol:_,endRow:T,endCol:q}=P,N=[];for(let B=d;B<=T;B++){const Y=[];for(let Pe=_;Pe<=q;Pe++){const Oe=Re(B,Pe),re=F.data[Oe],Ze=re?Qe(Oe,F.data,new Set):null;Y.push(wi(Ze,re==null?void 0:re.format))}N.push(Y.join(" "))}m.clipboardData.setData("text/plain",N.join(`
|
|
595
|
+
`)),m.preventDefault()},[P,F.data,L]),De=t.useCallback(m=>{if(c||!b)return;const d=m.clipboardData.getData("text/plain");if(!d)return;const _=d.split(`
|
|
596
|
+
`).map(T=>T.split(" "));(y==null?void 0:y(_,b.row,b.col))!==!1&&(ee(T=>{const q=T.map((N,B)=>B===R?{...N,data:{...N.data}}:N);return _.forEach((N,B)=>{N.forEach((Y,Pe)=>{const Oe=Re(b.row+B,b.col+Pe),re=Y.startsWith("=");q[R].data[Oe]={...q[R].data[Oe]??{value:null},formula:re?Y:void 0,value:re?null:isNaN(Number(Y))?Y:Number(Y)}})}),q}),m.preventDefault())},[c,b,R,ee,y]),Le=t.useCallback(m=>{ee(d=>d.map((_,T)=>{if(T!==R)return _;const q={};for(const[N,B]of Object.entries(_.data)){const Y=Ve(N);Y&&(Y.row>m?q[Re(Y.row+1,Y.col)]=B:q[N]=B)}return{..._,data:q}})),D==null||D("row",m)},[R,ee,D]),Ye=t.useCallback(m=>{ee(d=>d.map((_,T)=>{if(T!==R)return _;const q={};for(const[N,B]of Object.entries(_.data)){const Y=Ve(N);Y&&(Y.col>m?q[Re(Y.row,Y.col+1)]=B:q[N]=B)}return{..._,data:q}})),D==null||D("column",m)},[R,ee,D]),Ne=t.useCallback(m=>{ee(d=>d.map((_,T)=>{if(T!==R)return _;const q={};for(const[N,B]of Object.entries(_.data)){const Y=Ve(N);Y&&Y.row!==m&&(Y.row>m?q[Re(Y.row-1,Y.col)]=B:q[N]=B)}return{..._,data:q}})),O==null||O("row",m)},[R,ee,O]),nn=t.useCallback(m=>{ee(d=>d.map((_,T)=>{if(T!==R)return _;const q={};for(const[N,B]of Object.entries(_.data)){const Y=Ve(N);Y&&Y.col!==m&&(Y.col>m?q[Re(Y.row,Y.col-1)]=B:q[N]=B)}return{..._,data:q}})),O==null||O("column",m)},[R,ee,O]),dn=t.useCallback((m,d)=>{ee(_=>_.map((T,q)=>{if(q!==R)return T;const N=new Map;for(const[Pe,Oe]of Object.entries(T.data)){const re=Ve(Pe);re&&(N.has(re.row)||N.set(re.row,{}),N.get(re.row)[re.col]=Oe)}const B=Array.from(N.entries()).sort((Pe,Oe)=>{const re=Qe(Re(Pe[0],m),T.data,new Set),Ze=Qe(Re(Oe[0],m),T.data,new Set),tn=typeof re=="number"?re:Number(re),un=typeof Ze=="number"?Ze:Number(Ze);if(!isNaN(tn)&&!isNaN(un))return d==="asc"?tn-un:un-tn;const an=String(re??""),mn=String(Ze??"");return d==="asc"?an.localeCompare(mn):mn.localeCompare(an)}),Y={};return B.forEach(([,Pe],Oe)=>{for(const[re,Ze]of Object.entries(Pe))Y[Re(Oe,Number(re))]=Ze}),{...T,data:Y,sortColumn:m,sortDirection:d}}))},[R,ee]),pt=t.useCallback((m,d)=>{const _=F.conditionalFormats;if(!(_!=null&&_.length))return;const T=Re(m,d),q=Qe(T,F.data,new Set),N=typeof q=="number"?q:Number(q);for(const B of _){const Y=B.range.match(/^([A-Z]+\d+):([A-Z]+\d+)$/i);if(!Y)continue;const Pe=Ve(Y[1].toUpperCase()),Oe=Ve(Y[2].toUpperCase());if(!Pe||!Oe||m<Pe.row||m>Oe.row||d<Pe.col||d>Oe.col)continue;let re=!1;switch(B.type){case"greaterThan":re=!isNaN(N)&&N>Number(B.value);break;case"lessThan":re=!isNaN(N)&&N<Number(B.value);break;case"equalTo":re=String(q)===String(B.value);break;case"between":re=!isNaN(N)&&N>=Number(B.value)&&N<=Number(B.value2);break;case"textContains":re=String(q).includes(String(B.value));break;case"isEmpty":re=q===null||q==="";break;case"isNotEmpty":re=q!==null&&q!=="";break}if(re)return{backgroundColor:B.style.bgColor,color:B.style.color,fontWeight:B.style.bold?"bold":void 0,fontStyle:B.style.italic?"italic":void 0}}},[F.conditionalFormats,F.data]),Cn=t.useCallback(()=>{const m=`${$("spreadsheet.sheet","Sheet")} ${Z.length+1}`;ee(d=>[...d,ki(m)]),ke(Z.length)},[Z.length,ee,ke,$]),tt=t.useCallback(()=>{Z.length<=1||(ee(m=>m.filter((d,_)=>_!==R)),ke(Math.max(0,R-1)))},[Z.length,R,ee,ke]),On=t.useCallback((m,d)=>{d.trim()&&(ee(_=>_.map((T,q)=>q===m?{...T,name:d.trim()}:T),!1),fe(null))},[ee]),Wn=t.useMemo(()=>{if(!b)return"";const m=Re(b.row,b.col),d=F.data[m];return(d==null?void 0:d.formula)??((d==null?void 0:d.value)!=null?String(d.value):"")},[b,F.data]),sn=t.useMemo(()=>{if(!P)return null;const{startRow:m,startCol:d,endRow:_,endCol:T}=P;if(m===_&&d===T)return null;const q=[];let N=0;for(let B=m;B<=_;B++)for(let Y=d;Y<=T;Y++){const Pe=Re(B,Y),Oe=Qe(Pe,F.data,new Set);Oe!==null&&Oe!==""&&N++,typeof Oe=="number"&&q.push(Oe)}return q.length===0?{count:N}:{count:N,sum:q.reduce((B,Y)=>B+Y,0),avg:q.reduce((B,Y)=>B+Y,0)/q.length,min:Math.min(...q),max:Math.max(...q)}},[P,F.data]),Pt=t.useCallback((m,d)=>{var _;d.preventDefault(),d.stopPropagation(),ve(m),he.current={x:d.clientX,width:((_=F.colWidths)==null?void 0:_[m])??80}},[F.colWidths]);t.useEffect(()=>{if(te===null)return;const m=_=>{const T=_.clientX-he.current.x,q=Math.max(30,he.current.width+T);ee(N=>N.map((B,Y)=>Y===R?{...B,colWidths:{...B.colWidths,[te]:q}}:B),!1)},d=()=>ve(null);return document.addEventListener("mousemove",m),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",d)}},[te,R,ee]);const St=t.useCallback((m,d,_)=>{m.preventDefault(),je({row:d,col:_}),ue({x:m.clientX,y:m.clientY})},[]);t.useEffect(()=>{if(!z)return;const m=()=>ue(null);return document.addEventListener("click",m),()=>document.removeEventListener("click",m)},[z]);const qn=t.useCallback(m=>{if((m.ctrlKey||m.metaKey)&&!X){if(m.key==="z"){m.preventDefault(),Je();return}if(m.key==="y"){m.preventDefault(),en();return}}if(X||!b)return;let{row:d,col:_}=b;switch(m.key){case"ArrowUp":d=Math.max(0,d-1);break;case"ArrowDown":d=Math.min(r-1,d+1);break;case"ArrowLeft":_=Math.max(0,_-1);break;case"ArrowRight":_=Math.min(l-1,_+1);break;case"Enter":I(d,_);return;case"Delete":case"Backspace":c||(P&&(P.startRow!==P.endRow||P.startCol!==P.endCol)?ee(T=>{const q=T.map((N,B)=>B===R?{...N,data:{...N.data}}:N);for(let N=P.startRow;N<=P.endRow;N++)for(let B=P.startCol;B<=P.endCol;B++)delete q[R].data[Re(N,B)];return q}):An(d,_,""));return;default:if(m.key.length===1&&!m.ctrlKey&&!m.metaKey&&!c){ge({row:d,col:_}),Ae(m.key);return}return}m.preventDefault(),m.shiftKey&&M?G({row:d,col:_}):(je({row:d,col:_}),G(null)),S==null||S(R,d,_)},[X,b,r,l,c,I,An,R,S,Je,en,P,ee,M]),it=F.frozenRows??0,Sn=F.frozenCols??0,gt=[{value:"text",label:$("spreadsheet.formatText","Text")},{value:"number",label:$("spreadsheet.formatNumber","Number")},{value:"percent",label:$("spreadsheet.formatPercent","Percent")},{value:"currency",label:$("spreadsheet.formatCurrency","Currency")},{value:"date",label:$("spreadsheet.formatDate","Date")}];return e.jsxs("div",{ref:se,id:$e,className:`nice-spreadsheet ${c?"nice-spreadsheet--readonly":""} ${p??""}`,style:E,onKeyDown:qn,onCopy:ln,onPaste:De,tabIndex:0,role:"application","aria-label":$("spreadsheet.label","Spreadsheet"),...ie,children:[s&&!c&&e.jsxs("div",{className:"nice-spreadsheet__toolbar",role:"toolbar",children:[e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:Je,disabled:Se.length===0,title:$("spreadsheet.undo","Undo"),children:e.jsx(Qa,{})}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:en,disabled:Ee.length===0,title:$("spreadsheet.redo","Redo"),children:e.jsx(Va,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Fe.hn,{variant:(at=F.data[b?Re(b.row,b.col):""])!=null&&at.bold?"primary":"ghost",size:"sm",onClick:()=>{var m;return be("bold",!((m=F.data[b?Re(b.row,b.col):""])!=null&&m.bold))},title:$("spreadsheet.bold","Bold"),children:e.jsx("strong",{children:"B"})}),e.jsx(Fe.hn,{variant:(rt=F.data[b?Re(b.row,b.col):""])!=null&&rt.italic?"primary":"ghost",size:"sm",onClick:()=>{var m;return be("italic",!((m=F.data[b?Re(b.row,b.col):""])!=null&&m.italic))},title:$("spreadsheet.italic","Italic"),children:e.jsx("em",{children:"I"})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>be("align","left"),title:$("spreadsheet.alignLeft","Align left"),children:e.jsx(Ja,{})}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>be("align","center"),title:$("spreadsheet.alignCenter","Center"),children:e.jsx(Ya,{})}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>be("align","right"),title:$("spreadsheet.alignRight","Align right"),children:e.jsx(Za,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Fe.Xe,{value:((Bn=F.data[b?Re(b.row,b.col):""])==null?void 0:Bn.bgColor)??"var(--bg-primary, #ffffff)",onChange:m=>be("bgColor",m),title:$("spreadsheet.bgColor","Background color"),showInput:!1,showRandom:!1}),e.jsx(Fe.Xe,{value:((Kn=F.data[b?Re(b.row,b.col):""])==null?void 0:Kn.color)??"var(--text-primary, #000000)",onChange:m=>be("color",m),title:$("spreadsheet.textColor","Text color"),showInput:!1,showRandom:!1}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Fe.Ze,{size:"sm",value:((lt=F.data[b?Re(b.row,b.col):""])==null?void 0:lt.format)??"text",onChange:m=>be("format",m),options:gt,"aria-label":$("spreadsheet.format","Cell format")}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>b&&Le(b.row),title:$("spreadsheet.insertRow","Insert row"),children:e.jsx(qa,{})}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>b&&Ye(b.col),title:$("spreadsheet.insertCol","Insert column"),children:e.jsx(er,{})}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>b&&Ne(b.row),title:$("spreadsheet.deleteRow","Delete row"),children:e.jsx(nr,{})}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>b&&nn(b.col),title:$("spreadsheet.deleteCol","Delete column"),children:e.jsx(tr,{})})]}),u&&e.jsxs("div",{className:"nice-spreadsheet__formula-bar",children:[e.jsxs("span",{className:"nice-spreadsheet__cell-label",children:[b?Re(b.row,b.col):"",P&&P.startRow!==P.endRow||P&&P.startCol!==P.endCol?`:${Re(P.endRow,P.endCol)}`:""]}),e.jsx(Fe.Pe,{className:"nice-spreadsheet__formula-input",value:X?we:Wn,onChange:m=>{X?Ae(m):b&&(ge(b),Ae(m))},onKeyDown:me,readOnly:c,"aria-label":$("spreadsheet.formulaBar","Formula bar")})]}),e.jsx("div",{className:"nice-spreadsheet__grid",ref:Ge,children:e.jsxs("table",{role:"grid","aria-label":F.name,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"nice-spreadsheet__corner"}),Array.from({length:l},(m,d)=>{var _;return e.jsxs("th",{className:`nice-spreadsheet__col-header ${d<Sn?"nice-spreadsheet__col-header--frozen":""}`,style:{width:((_=F.colWidths)==null?void 0:_[d])??80,position:d<Sn?"sticky":void 0,left:d<Sn?d*80+40:void 0,zIndex:d<Sn?3:void 0},children:[e.jsx("span",{children:Ai(d)}),w&&e.jsx("span",{className:"nice-spreadsheet__sort-trigger",onClick:()=>dn(d,F.sortColumn===d&&F.sortDirection==="asc"?"desc":"asc"),title:$("spreadsheet.sort","Sort"),children:F.sortColumn===d?F.sortDirection==="asc"?e.jsx(ir,{}):e.jsx(ar,{}):e.jsx(rr,{})}),!c&&e.jsx("span",{className:"nice-spreadsheet__col-resize",onMouseDown:T=>Pt(d,T)})]},d)})]})}),e.jsx("tbody",{children:Array.from({length:r},(m,d)=>e.jsxs("tr",{className:d<it?"nice-spreadsheet__row--frozen":"",style:d<it?{position:"sticky",top:d*24,zIndex:2}:void 0,children:[e.jsx("td",{className:"nice-spreadsheet__row-header",children:d+1}),Array.from({length:l},(_,T)=>{var tn,un;const q=Re(d,T),N=F.data[q];if(N!=null&&N.mergedInto)return null;const B=(b==null?void 0:b.row)===d&&(b==null?void 0:b.col)===T,Y=ze(d,T),Pe=(X==null?void 0:X.row)===d&&(X==null?void 0:X.col)===T,Oe=N?Qe(q,F.data,new Set):null,re=pt(d,T),Ze=d<it||T<Sn;return e.jsxs("td",{className:`nice-spreadsheet__cell ${B?"nice-spreadsheet__cell--selected":""} ${Y&&!B?"nice-spreadsheet__cell--in-range":""} ${N!=null&&N.readOnly?"nice-spreadsheet__cell--readonly":""} ${Ze?"nice-spreadsheet__cell--frozen":""}`,style:{textAlign:N==null?void 0:N.align,fontWeight:N!=null&&N.bold?"bold":void 0,fontStyle:N!=null&&N.italic?"italic":void 0,backgroundColor:(re==null?void 0:re.backgroundColor)??(N==null?void 0:N.bgColor),color:(re==null?void 0:re.color)??(N==null?void 0:N.color),width:(tn=F.colWidths)==null?void 0:tn[T],height:(un=F.rowHeights)==null?void 0:un[d],position:Ze?"sticky":void 0,left:T<Sn?T*80+40:void 0,zIndex:Ze?1:void 0,...re},colSpan:N==null?void 0:N.colSpan,rowSpan:N==null?void 0:N.rowSpan,onMouseDown:an=>Pn(d,T,an),onMouseEnter:()=>Nn(d,T),onDoubleClick:()=>I(d,T),onContextMenu:an=>St(an,d,T),role:"gridcell","aria-selected":B,title:N==null?void 0:N.comment,children:[(N==null?void 0:N.comment)&&e.jsx("span",{className:"nice-spreadsheet__comment-indicator"}),Pe?e.jsx("input",{ref:Ke,className:"nice-spreadsheet__cell-editor",value:we,onChange:an=>Ae(an.target.value),onKeyDown:me,onBlur:ae}):wi(Oe,N==null?void 0:N.format)]},T)})]},d))})]})}),z&&!c&&b&&e.jsxs("div",{className:"nice-spreadsheet__context-menu",style:{position:"fixed",left:z.x,top:z.y,zIndex:1e3},children:[e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>{Le(b.row),ue(null)},children:$("spreadsheet.insertRowAbove","Insert row above")}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>{Le(b.row+1),ue(null)},children:$("spreadsheet.insertRowBelow","Insert row below")}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>{Ye(b.col),ue(null)},children:$("spreadsheet.insertColLeft","Insert column left")}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>{Ye(b.col+1),ue(null)},children:$("spreadsheet.insertColRight","Insert column right")}),e.jsx("hr",{className:"nice-spreadsheet__context-sep"}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>{Ne(b.row),ue(null)},children:$("spreadsheet.deleteRow","Delete row")}),e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:()=>{nn(b.col),ue(null)},children:$("spreadsheet.deleteCol","Delete column")})]}),sn&&e.jsxs("div",{className:"nice-spreadsheet__status-bar",children:[e.jsxs("span",{children:[$("spreadsheet.count","Count"),": ",sn.count]}),sn.sum!==void 0&&e.jsxs("span",{children:[$("spreadsheet.sum","Sum"),": ",sn.sum.toFixed(2)]}),sn.avg!==void 0&&e.jsxs("span",{children:[$("spreadsheet.avg","Avg"),": ",sn.avg.toFixed(2)]}),sn.min!==void 0&&e.jsxs("span",{children:[$("spreadsheet.min","Min"),": ",sn.min]}),sn.max!==void 0&&e.jsxs("span",{children:[$("spreadsheet.max","Max"),": ",sn.max]})]}),g&&e.jsxs("div",{className:"nice-spreadsheet__tabs",role:"tablist",children:[Z.map((m,d)=>e.jsx("span",{className:"nice-spreadsheet__tab-wrapper",children:Q===d?e.jsx(Fe.Pe,{className:"nice-spreadsheet__tab-rename",value:A,onChange:_=>ce(_),onBlur:()=>On(d,A),onKeyDown:_=>{_.key==="Enter"&&On(d,A),_.key==="Escape"&&fe(null)},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>{c||(fe(d),ce(m.name))},children:e.jsx(Fe.hn,{variant:d===R?"primary":"ghost",size:"sm",onClick:()=>ke(d),children:m.name})})},d)),!c&&e.jsxs(e.Fragment,{children:[e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:Cn,title:$("spreadsheet.addSheet","Add sheet"),children:e.jsx(lr,{})}),Z.length>1&&e.jsx(Fe.hn,{variant:"ghost",size:"sm",onClick:tt,title:$("spreadsheet.removeSheet","Remove sheet"),children:e.jsx(sr,{})})]})]})]})});ni.displayName="NiceSpreadsheet";const or=Object.freeze(Object.defineProperty({__proto__:null,N:Ri,a:Ct,c:ei,d:Di,f:qt,g:Zt,j:ni,k:Ci,l:Fi,m:Li,n:Ii,o:zi,p:Mi,q:kt,r:At,s:ha,t:_a},Symbol.toStringTag,{value:"Module"}));exports.$a=ei;exports.Da=Zt;exports.L=Ni;exports.Li=At;exports.Lr=zi;exports.Ma=qt;exports.NiceSavedQueryPanelMz4jAsGJ=or;exports.Or=Fi;exports.Pr=Ri;exports.Rr=Ci;exports.Tr=Ii;exports.ai=Ct;exports.jr=Li;exports.yr=ni;exports.z=Yt;exports.zr=Di;
|