@juki-team/base-ui 1.5.24 → 1.5.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/esm/{BarChart-rnKCGMQd.js → BarChart-CD4sPF3z.js} +1 -1
- package/dist/esm/{CartesianChart-Dvjpj90J.js → CartesianChart-COvhGQyG.js} +1 -1
- package/dist/esm/{ChangePasswordModal-Bh9Sghzd.js → ChangePasswordModal-Bk0dMV_1.js} +1 -1
- package/dist/esm/{CodeEditor-Duw5SfUT.js → CodeEditor-BIZnfHEb.js} +1 -1
- package/dist/esm/{CodeViewer-3L1yBCiq.js → CodeViewer-MgsGJhm_.js} +1 -1
- package/dist/esm/{Collapse--_LykD9C.js → Collapse-5BKMrZu4.js} +1 -1
- package/dist/esm/{DataViewer-D1dHtA0t.js → DataViewer-DJ7HihIq.js} +1 -1
- package/dist/esm/{DrawerView-CwWfnWLi.js → DrawerView-CQivnAE7.js} +1 -1
- package/dist/esm/{ExcalidrawButton-C_0b7G1W.js → ExcalidrawButton-IWnxAUMA.js} +1 -1
- package/dist/esm/{GraphvizViewer-BfMacqRe.js → GraphvizViewer-fNBonwLb.js} +1 -1
- package/dist/esm/{ImageLoaderCropper-DTUW7gfc.js → ImageLoaderCropper-CJurK_5q.js} +1 -1
- package/dist/esm/{InputCellPhoneNumber-Clg8uE_f.js → InputCellPhoneNumber-DxYNbjzN.js} +1 -1
- package/dist/esm/{InputColor-R-WCu1j6.js → InputColor-C-6Zdrb1.js} +1 -1
- package/dist/esm/{LineChart-Cis4BCPT.js → LineChart-DQhgz1U1.js} +1 -1
- package/dist/esm/{MdMath-DLeak1_N.js → MdMath-HzhYb2R6.js} +1 -1
- package/dist/esm/{MdMathEditor-BG6rI0DT.js → MdMathEditor-CqN5ECmG.js} +1 -1
- package/dist/esm/{Popover-CpOKnJkx.js → Popover-DLlj7_5D.js} +1 -1
- package/dist/esm/{SlideDeck-uAy3WDbv.js → SlideDeck-DQ79QTDw.js} +1 -1
- package/dist/esm/{TableOfContents-C6yZSaSD.js → TableOfContents-vGBwoALc.js} +1 -1
- package/dist/esm/{Tooltip-8kM3mqHL.js → Tooltip-CFPePKBn.js} +1 -1
- package/dist/esm/{UserCodeEditor-BhYAs-Az.js → UserCodeEditor-fuTzFEMZ.js} +2 -2
- package/dist/esm/{VirtualizedRowsFixed-DTqKnPfn.js → VirtualizedRowsFixed-BmN2Zrgw.js} +1 -1
- package/dist/esm/{WorksheetAsSlides-Cf2VDzyg.js → WorksheetAsSlides-B6YjuGiX.js} +1 -1
- package/dist/esm/{WorksheetBodies-CwL6I1LR.js → WorksheetBodies-bHCPQj4q.js} +1 -1
- package/dist/esm/{WorksheetContents-AqcyoA6-.js → WorksheetContents-D3T-gmSz.js} +1 -1
- package/dist/esm/{WorksheetEditor-BF8EQVw5.js → WorksheetEditor-C8vzZrxI.js} +1 -1
- package/dist/esm/{WorksheetNode-vLI23gI5.js → WorksheetNode-IU4crmPx.js} +1 -1
- package/dist/esm/{WorksheetViewer-Dj7ffrAT.js → WorksheetViewer-BqIYVsGq.js} +1 -1
- package/dist/esm/{abnfDiagram-WEYOIA3C-ZoMqWR68.js → abnfDiagram-WEYOIA3C-DE2UDPMY.js} +1 -1
- package/dist/esm/{arc-D1qQo7Rq.js → arc-D_zk661m.js} +1 -1
- package/dist/esm/{architectureDiagram-ZHVYKT53-DyQfRK7X.js → architectureDiagram-ZHVYKT53-ke3klsKe.js} +1 -1
- package/dist/esm/{blockDiagram-RJAE7QA3-25yUZ_JH.js → blockDiagram-RJAE7QA3-AgAD4gZY.js} +1 -1
- package/dist/esm/{c4Diagram-XDPPPE54-Tds8Ecy5.js → c4Diagram-XDPPPE54-P3k9eGYF.js} +1 -1
- package/dist/esm/channel-qDrbUxXp.js +1 -0
- package/dist/esm/{chunk-2E7WHVMD-CrEKxARX.js → chunk-2E7WHVMD-9AUNuIol.js} +1 -1
- package/dist/esm/{chunk-2Q5K7J3B-xxqB63pM.js → chunk-2Q5K7J3B-Dp-_SPkL.js} +1 -1
- package/dist/esm/{chunk-4EMNKR2T-DpATbGaG.js → chunk-4EMNKR2T-DdiB_KIs.js} +1 -1
- package/dist/esm/{chunk-55XCU76K-B8gXqG-k.js → chunk-55XCU76K-BdhlVz8i.js} +1 -1
- package/dist/esm/{chunk-5VM5RSS4-ChaTLA5E.js → chunk-5VM5RSS4-DLP0y3Jh.js} +1 -1
- package/dist/esm/{chunk-JWPE2WC7-D8efNL_z.js → chunk-JWPE2WC7-CqqF5Sk5.js} +1 -1
- package/dist/esm/{chunk-NQOKRVIF-gVbLpTMV.js → chunk-NQOKRVIF-B29QMc4a.js} +1 -1
- package/dist/esm/{chunk-VQ5W62QI-YnIRgGsh.js → chunk-VQ5W62QI-k5ZY7kON.js} +1 -1
- package/dist/esm/{chunk-XXDRQBXY-DyBSx2uJ.js → chunk-XXDRQBXY-BW8q8_pu.js} +1 -1
- package/dist/esm/{chunk-ZCHMQSOR-UYQbyi-v.js → chunk-ZCHMQSOR-8f5kEpMY.js} +1 -1
- package/dist/esm/{classDiagram-v2-4MYWR3UA-PaDxy7Bb.js → classDiagram-v2-4MYWR3UA-DsLcYSTy.js} +1 -1
- package/dist/esm/{cose-bilkent-JH36ORCC-BCLUFgmF.js → cose-bilkent-JH36ORCC-CTkdO8yq.js} +1 -1
- package/dist/esm/{cynefinDiagram-WF24UDRP-Dw54Invm.js → cynefinDiagram-WF24UDRP-Bt_I0B8d.js} +1 -1
- package/dist/esm/{dagre-NK4GIZVX-DszaMPSv.js → dagre-NK4GIZVX-D1kBjptK.js} +1 -1
- package/dist/esm/{diagram-CBK3MWTC-D3i6P0ln.js → diagram-CBK3MWTC-Cj_QAg4K.js} +1 -1
- package/dist/esm/{diagram-I5XIIV2D-DEUcJjIJ.js → diagram-I5XIIV2D-j57QWztk.js} +1 -1
- package/dist/esm/{diagram-ODIL2UCW-DxLnEJOT.js → diagram-ODIL2UCW-LC6xpsAm.js} +1 -1
- package/dist/esm/{diagram-PFBEJUXE-ByMV092C.js → diagram-PFBEJUXE-CilL_weO.js} +1 -1
- package/dist/esm/{diagram-RJA3I4VV-C84l8Azx.js → diagram-RJA3I4VV-OcSD3nzK.js} +1 -1
- package/dist/esm/{diagram-TYUNFSNR-BtCvPXJ2.js → diagram-TYUNFSNR-DvfFSJV8.js} +1 -1
- package/dist/esm/{ebnfDiagram-V4P3TTPT-C2vtqr71.js → ebnfDiagram-V4P3TTPT-B02CKEcd.js} +1 -1
- package/dist/esm/{elk-QONTBCTQ-CJiLNhJN.js → elk-QONTBCTQ-Dd3vXBUp.js} +1 -1
- package/dist/esm/{erDiagram-KYQIGQAA-COiQX-A9.js → erDiagram-KYQIGQAA-CKmmbtRp.js} +1 -1
- package/dist/esm/flowDiagram-IUGLLWBU--0aDZYd-.js +1 -0
- package/dist/esm/{ganttDiagram-R7GPNTJY-DplmDkby.js → ganttDiagram-R7GPNTJY-ByEqXgs3.js} +1 -1
- package/dist/esm/{gitGraphDiagram-PDYL7XHY-DTPYXyjC.js → gitGraphDiagram-PDYL7XHY-D_1Na4NK.js} +1 -1
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/{index-BdXh2wq-.js → index-B6QpR9Kv.js} +1 -1
- package/dist/esm/{index-DpobNvg5.js → index-B8CE4gNp.js} +1 -1
- package/dist/esm/{index-DjHFXv3v.js → index-Bz4iycQ-.js} +1 -1
- package/dist/esm/{infoDiagram-MVDRKAX5-B4R01JSI.js → infoDiagram-MVDRKAX5-CzpZVWBA.js} +1 -1
- package/dist/esm/{ishikawaDiagram-HPEHV2GE-Dv9Qg5NY.js → ishikawaDiagram-HPEHV2GE-BNnhoU1s.js} +1 -1
- package/dist/esm/{journeyDiagram-BOSHW7O7-Co3cxhxL.js → journeyDiagram-BOSHW7O7-hAMCNbFR.js} +1 -1
- package/dist/esm/{kanban-definition-FNSA4HC5-q3pjKpqB.js → kanban-definition-FNSA4HC5-BTV-6n2K.js} +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/{mermaid.core-DErPnTKR.js → mermaid.core-DJgsyjxa.js} +2 -2
- package/dist/esm/{mindmap-definition-6OY57UG3-B_LUFop9.js → mindmap-definition-6OY57UG3-Y3IkI2Vo.js} +1 -1
- package/dist/esm/{pegDiagram-ECIUJNBX-DlVeoxxt.js → pegDiagram-ECIUJNBX-B9gCTKq-.js} +1 -1
- package/dist/esm/{pieDiagram-GNMPY74T-BOP-ezbh.js → pieDiagram-GNMPY74T-BkAZ_G2Q.js} +1 -1
- package/dist/esm/{quadrantDiagram-D57K4MC3-DMyyReF0.js → quadrantDiagram-D57K4MC3-Dumxe1DF.js} +1 -1
- package/dist/esm/{railroadDiagram-Y72NRBL7-Dtk4Z37c.js → railroadDiagram-Y72NRBL7-CYpAqRND.js} +1 -1
- package/dist/esm/{requirementDiagram-EQYSW5RA-CiUa5IeO.js → requirementDiagram-EQYSW5RA-BmjZ6r45.js} +1 -1
- package/dist/esm/{sankeyDiagram-SY24JHO5-CuTPSkWV.js → sankeyDiagram-SY24JHO5-buQ8hvkh.js} +1 -1
- package/dist/esm/{sequenceDiagram-BLEHNHQU-Do3-nvhd.js → sequenceDiagram-BLEHNHQU-DD5ZDi-2.js} +1 -1
- package/dist/esm/settings.js +1 -1
- package/dist/esm/{sizeCapture-INFHLROL-C423dcz5.js → sizeCapture-INFHLROL-4TQugI_E.js} +1 -1
- package/dist/esm/{stateDiagram-v2-A6IESKWZ-c4ZBvhhc.js → stateDiagram-v2-A6IESKWZ-Dod5-fXI.js} +1 -1
- package/dist/esm/{swimlanes-B3ENRKFQ-zszd6wqm.js → swimlanes-B3ENRKFQ-DD9U9TAi.js} +1 -1
- package/dist/esm/{swimlanesDiagram-AYQRV4AK-BlMvbjy2.js → swimlanesDiagram-AYQRV4AK-DO778YIq.js} +1 -1
- package/dist/esm/{timeline-definition-JXYKGLGB-C0ru0xk2.js → timeline-definition-JXYKGLGB-d12vyI2E.js} +1 -1
- package/dist/esm/{types-Cb2rrWcY.js → types-BTstSY92.js} +1 -1
- package/dist/esm/{usecaseDiagram-WPOLBNNX-BgdkDQLR.js → usecaseDiagram-WPOLBNNX-CeJUo-5g.js} +1 -1
- package/dist/esm/{vennDiagram-Q3Y3IDCW-BqrOHtxN.js → vennDiagram-Q3Y3IDCW-Ca8R0GgR.js} +1 -1
- package/dist/esm/{wardleyDiagram-IVAIDKWA-Ci0p6FBo.js → wardleyDiagram-IVAIDKWA-PB-NmRqH.js} +1 -1
- package/dist/esm/{websocket-KESFarc3.js → websocket-B8ybpDXk.js} +1 -1
- package/dist/esm/{xychartDiagram-4URNHDU4-zz1Z-rVz.js → xychartDiagram-4URNHDU4-DmPETRfG.js} +1 -1
- package/dist/module-types/src/settings/AppRoutes.d.ts +2 -1
- package/package.json +1 -1
- package/dist/esm/channel-DYeSxlgx.js +0 -1
- package/dist/esm/flowDiagram-IUGLLWBU-Bboof2sT.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,Fragment as o,jsx as e}from"react/jsx-runtime";import{AnimatePresence as i,motion as r}from"motion/react";import"react";import"./settings-DzQM72QE.js";import"./enums.js";import{r as s}from"./websocket-
|
|
1
|
+
import{jsxs as t,Fragment as o,jsx as e}from"react/jsx-runtime";import{AnimatePresence as i,motion as r}from"motion/react";import"react";import"./settings-DzQM72QE.js";import"./enums.js";import{r as s}from"./websocket-B8ybpDXk.js";import"./index-Zvckkvpn.js";import{u as a}from"./index-Bz4iycQ-.js";import{E as n,a as m}from"./LoaderLayer-CWElgcGs.js";import"./index-B8CE4gNp.js";import"./commons-C-9EFvh4.js";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";function c(c){const{children:p,header:l,className:d,showContent:h,onChangeShowContent:w,startsShowing:j=!1,direction:g="column"}=c,[f,u]=a(j,h,w),b=()=>u(!0),y=()=>u(!1),x=()=>u(t=>!t);return t(o,{children:[s(l,{isOpen:f,close:y,open:b,toggle:x,icon:e(f?n:m,{}),Icon:f?n:m}),e(i,{initial:!1,children:f&&e(r.div,{initial:"row"===g?{width:0}:{height:0},animate:"row"===g?{width:"auto"}:{height:"auto"},exit:"row"===g?{width:0}:{height:0},style:{overflow:"hidden"},className:d,children:s(p,{isOpen:f,close:y,open:b,toggle:x})},"content")})]})}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{memo as i,useRef as r,useState as s,useMemo as n,useCallback as o,useEffect as l,useId as d,Children as c}from"react";import{S as h,D as p,P as m,E as u}from"./index-Zvckkvpn.js";import{K as g,N as f,O as y,Q as w,R as v,S as b,U as k,V as x,X as N,Y as R,Z as j,_ as S,$ as D,a0 as C,a1 as F,a2 as O,a3 as I,a4 as T,a5 as z,a6 as P,a7 as L,a8 as E,a9 as V,aa as M,ab as W,B as H,T as A,ac as K,w as $,ad as B,a as J,l as Q,ae as Y,f as q,af as U,p as _,ag as G,ah as X,ai as Z,aj as ee,J as te,e as ae,ak as ie,al as re,am as se,an as ne,ao as oe,ap as le,aq as de,ar as ce,as as he,at as pe}from"./index-DjHFXv3v.js";import{c as me,i as ue,f as ge}from"./commons-C-9EFvh4.js";import{r as fe,H as ye,B as we,I as ve,f as be,D as ke}from"./websocket-KESFarc3.js";import{e as xe,j as Ne,S as Re,i as je,c as Se}from"./settings-DzQM72QE.js";import{TriggerAction as De}from"./enums.js";import{e as Ce,S as Fe,R as Oe,f as Ie,g as Te,L as ze}from"./LoaderLayer-CWElgcGs.js";import{motion as Pe,LayoutGroup as Le}from"motion/react";import"react-dom";import{u as Ee}from"./index-CKBtKrj5.js";import{A as Ve,S as Me}from"./index-B--41Rgp.js";import{F as We,T as He,C as Ae,M as Ke}from"./TableEyeIcon-cEB6wzrG.js";import"swr";import"./index-DpobNvg5.js";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";const $e=[["top","topLeft","top","topRight"],["upper","upperLeft","upper","upperRight"],["center","centerLeft","center","centerRight"],["lower","lowerLeft","lower","lowerRight"],["bottom","bottomLeft","bottom","bottomRight"]],Be=i(a=>{const{cardWidth:i,index:r,data:s,sections:n,fake:o,getRecordStyle:l,getRecordClassName:d,onRecordClick:c,onRecordHover:h}=a;if(o)return e("div",{className:"jk-list-card",style:{width:i,opacity:0}});const p=s[r],m=({index:t,Field:a})=>e("div",{children:p&&e(a,{record:p,columnIndex:t,recordIndex:r,isCard:!0})},t);return e("div",{className:me("jk-list-card jk-br",d?.({data:s,index:r,isCard:!0,isStickySection:!1})||""),style:{...l?.({data:s,index:r,isCard:!0,isStickySection:!1})||{},width:i},onClick:c?()=>c({data:s,index:r,isCard:!0}):void 0,onMouseEnter:h?()=>h({data:s,index:r,isCard:!0}):void 0,children:$e.map(([a,i,r,s])=>{const o=n[i],l=n[r],d=n[s];return o?.length||l?.length||d?.length?t("div",{className:me(`${a}-container`,{"no-middle":"top"===a||!l?.length}),children:[e("div",{className:`${i.replace(/([A-Z])/g,"-$1").toLowerCase()} jk-col stretch`,children:o?.map(m)}),e("div",{className:`${a} jk-col stretch`,children:l?.map(m)}),e("div",{className:`${s.replace(/([A-Z])/g,"-$1").toLowerCase()} jk-col stretch`,children:d?.map(m)})]},a):null})})}),Je=t=>{const{headers:a,data:i,cardHeight:l,cardWidth:d,rowWidth:c,getRecordStyle:h,onRecordClick:p,onRecordHover:m,getRecordClassName:u,expandedCards:g}=t,f=r(null),[y,w]=s(!1),[v,b]=s(!1),k=n(()=>(e=>{const t={};for(const a of e){const e=a.cardPosition||"center";(t[e]??(t[e]=[])).push(a)}return t})(a),[a]),x=Math.max(Math.floor((c-16)/(d+16)),1),N=Ee({count:Math.ceil(i.length/x),getScrollElement:o(()=>f.current,[]),estimateSize:o(()=>l+40,[l]),overscan:2});let R=Math.min(d,c-16-16);return g&&(R=(c-16*(x+1))/x),e("div",{ref:f,className:me("jk-list-card-rows-container",{"scroll-on-top":!y,"scroll-on-bottom":!v}),onScroll:({currentTarget:e})=>{const t=e.scrollTop||0;b(!!(e.scrollHeight-e.clientHeight-t)),w(!!t)},children:e("div",{className:"jk-list-card-rows-box",style:{height:`${N.getTotalSize()}px`,zIndex:0},children:N.getVirtualItems().map(t=>e("div",{style:{height:`${t.size}px`,transform:`translateY(${t.start}px)`},className:"jk-row jk-list-card-row",children:Array.from({length:x},(a,r)=>{const s=t.index*x+r;return e(Be,{fake:s>=i.length,cardWidth:R,sections:k,data:i,index:s,getRecordClassName:u,getRecordStyle:h,onRecordClick:p,onRecordHover:m},s)})},t.index))})})},Qe=e=>e.minWidth||100,Ye=e=>`var(--jk-col-w-${e})`,qe=e=>`var(--jk-col-l-${e})`,Ue="var(--jk-table-w)",_e=(e,t)=>{const a=[];let i=0,r=0;return t.forEach((t,s)=>{a.push(i),i+=t,e[s]?.sticky&&(r+=t)}),{widths:t,lefts:a,total:i,stickyWidth:r}},Ge=e=>[["--jk-table-w",`${e.total}px`],...e.widths.map((e,t)=>[`--jk-col-w-${t}`,`${e}px`]),...e.lefts.map((e,t)=>[`--jk-col-l-${t}`,`${e}px`])],Xe="text",Ze="text-auto",et="select",tt="select-auto",at="date",it="date-auto",rt="date-range",st="date-range-auto",nt=e=>!("object"!=typeof e||!e?.compareFn),ot=e=>!0===e,lt=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===Xe,dt=e=>!!e?.hasOwnProperty("callbackFn")&&e?.type===Xe,ct=e=>e?.type===Ze,ht=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===et,pt=e=>!!e?.hasOwnProperty("callbackFn")&&e?.type===et,mt=e=>e?.type===tt,ut=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===at,gt=e=>!!e?.hasOwnProperty("callbackFn")&&e?.type===at,ft=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===it,yt=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===rt,wt=e=>!!e?.hasOwnProperty("callbackFn")&&e?.type===rt,vt=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===st,bt=e=>e?.type===Xe,kt=e=>e?.type===et,xt=e=>e?.type===at,Nt=e=>e?.type===rt,Rt=({header:t,columnIndex:a,className:i})=>"string"==typeof t.head?e(f,{text:t.head,className:i}):t.head?fe(t.head,{header:t,data:[]}):e(f,{text:a,className:i}),jt=e=>t=>({year:!!e&&N(t,e),month:!!e&&x(t,e),day:!!e&&k(t,e),hours:!!e&&b(t,e),minutes:!!e&&v(t,e),seconds:!!e&&w(t,e),milliseconds:!!e&&y(t,e)}),St=(e,t)=>a=>({year:!!e&&!!t&&(N(a,e)||N(a,t)||R(a,{start:e,end:t})),month:!!e&&!!t&&(x(a,e)||x(a,t)||R(a,{start:e,end:t})),day:!!e&&!!t&&(k(a,e)||k(a,t)||R(a,{start:e,end:t})),hours:!!e&&!!t&&(b(a,e)||b(a,t)||R(a,{start:e,end:t})),minutes:!!e&&!!t&&(v(a,e)||v(a,t)||R(a,{start:e,end:t})),seconds:!!e&&!!t&&(w(a,e)||w(a,t)||R(a,{start:e,end:t})),milliseconds:!!e&&!!t&&(y(a,e)||y(a,t)||R(a,{start:e,end:t}))}),Dt=e=>t=>({year:!!e&&M(t,e),month:!!e&&V(t,e),day:!!e&&E(t,e),hours:!!e&&L(t,e),minutes:!!e&&P(t,e),seconds:!!e&&z(t,e),milliseconds:!!e&&T(t,e)}),Ct=(e,t)=>a=>{const i=e(a),r=t(a);return{year:i.year||r.year,month:i.month||r.month,day:i.day||r.day,hours:i.hours||r.hours,minutes:i.minutes||r.minutes,seconds:i.seconds||r.seconds,milliseconds:i.milliseconds||r.milliseconds}},Ft=e=>t=>({year:!!e&&I(t,e),month:!!e&&O(t,e),day:!!e&&F(t,e),hours:!!e&&C(t,e),minutes:!!e&&D(t,e),seconds:!!e&&S(t,e),milliseconds:!!e&&j(t,e)}),Ot=e=>{let t=!1;const a={};return e.forEach(({index:e,filter:i})=>{if(bt(i))i.getFilter?.()&&(a[e]=i.getFilter(),t=!0);else if(kt(i))i.getFilter?.()?.length&&(a[e]=i.getFilter(),t=!0);else if(xt(i))g(i.getFilter?.())&&(a[e]=i.getFilter(),t=!0);else if(Nt(i)){const r=i.getFilter?.();g(r?.[0])&&g(r?.[1])&&(a[e]=r,t=!0)}}),{filtered:t,values:a}},It=e=>e?e+".page":"page",Tt=e=>e?e+".pageSize":"pageSize",zt=e=>e?e+".sort":"sort",Pt=e=>e?e+".filter":"filter",Lt=e=>e?e+".viewMode":"viewMode",Et=e=>e?e+".showFilterDrawer":"showFilterDrawer",Vt=e=>e?e+".visibles":"visibles",Mt=new Map;function Wt(e,t){const a=`${e}-${t}`;if(Mt.has(a))return Mt.get(a);if("undefined"!=typeof document){const i=(Wt.canvas||(Wt.canvas=document.createElement("canvas"))).getContext("2d");if(i){i.font=t;const r=i.measureText(e).width;return Mt.set(a,r),r}}return 0}const Ht="year-month-day-hours-minutes-seconds",At=e=>!!Object.values(e).filter(e=>!!e&&(!Array.isArray(e)||e.length)).length,Kt=(e,t,a,i)=>()=>{const r={...t.current};r[e]="",At(r)?a(JSON.stringify(r)):i()},$t=(e,t,a,i,r)=>{const s={...a.current};JSON.stringify(s[e])!==JSON.stringify(t)&&(s[e]=t,At(s)?i(JSON.stringify(s)):r())},Bt=a=>{const{onFilter:i,onReset:n,isDisabled:o,columnIndex:d,initialSelectedDate:c,pickerType:h,visible:p,baseDate:m}=a,[u,f]=s(c),R=r(null);return l(()=>{p&&R.current?.focus()},[p]),t("div",{className:"jk-col gap jk-table-head-cell-filter-date jk-pg-sm",children:[e(W,{type:h,date:u,onDatePick:e=>f(e),onDateClean:()=>f(null),inline:!0,isDisabled:o,isSelected:e=>({year:!!u&&N(e,u),month:!!u&&x(e,u),date:!!u&&k(e,u),hours:!!u&&b(e,u),minutes:!!u&&v(e,u),seconds:!!u&&w(e,u),milliseconds:!!u&&y(e,u)}),baseDate:m,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===h||"year-month-day-hours-minutes-seconds"===h||"year-month-day-hours-minutes"===h||"year-month-day-hours"===h}),t("div",{className:"jk-row right gap buttons wh-100",children:[e(H,{size:"tiny",type:"secondary",onClick:n,disabled:!g(c),children:e(A,{className:"tt-se",children:"reset"})}),e(H,{size:"tiny",onClick:()=>u&&i({columnIndex:d,selectedDate:u}),disabled:!g(u),ref:R,children:e(A,{className:"tt-se",children:"filter"})})]})]})},Jt=a=>{const{onFilter:i,onReset:n,isDisabled:o,columnIndex:d,initialStartSelectedDate:c,initialEndSelectedDate:h,pickerType:p,visible:m,baseStartDate:u,baseEndDate:f}=a,[y,w]=s(c),[v,b]=s(h),k=r(null);return l(()=>{m&&k.current?.focus()},[m]),t("div",{className:"jk-col gap jk-table-head-cell-filter-date-range jk-pg-sm",children:[t("div",{className:"jk-row gap date-range nowrap",children:[t("div",{children:[t("div",{className:"jk-row center fw-bd",children:[e(A,{className:"tt-se",children:"from"})," :"]}),e(W,{type:p,date:y,onDatePick:w,onDateClean:()=>w(null),inline:!0,isDisabled:Ct(o,Ft(v)),isSelected:Ct(jt(y),St(y,v)),baseDate:u,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===p||"year-month-day-hours-minutes-seconds"===p||"year-month-day-hours-minutes"===p||"year-month-day-hours"===p})]}),t("div",{children:[t("div",{className:"jk-row center fw-bd",children:[e(A,{className:"tt-se",children:"to"})," :"]}),e(W,{type:p,date:v,onDatePick:b,onDateClean:()=>b(null),inline:!0,isDisabled:Ct(o,Dt(y)),isSelected:Ct(jt(v),St(y,v)),baseDate:f,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===p||"year-month-day-hours-minutes-seconds"===p||"year-month-day-hours-minutes"===p||"year-month-day-hours"===p})]})]}),t("div",{className:"jk-row gap right buttons wh-100",children:[e(H,{size:"tiny",type:"secondary",onClick:n,disabled:!(c&&h&&g(c)&&g(h)),children:e(A,{className:"tt-se",children:"reset"})}),e(H,{size:"tiny",onClick:()=>y&&v&&g(y)&&g(v)&&i({columnIndex:d,startSelectedDate:y,endSelectedDate:v}),disabled:!(y&&v&&g(y)&&g(v)),ref:k,children:e(A,{className:"tt-se",children:"filter"})})]})]})},Qt=a=>{const{onFilter:i,onReset:n,columnIndex:o,options:d,initialSelectedOptions:c,visible:h}=a,[p,m]=s(c),u=r(null);return l(()=>{h&&u.current?.focus(),m(c)},[c,h]),t("div",{className:"jk-col gap stretch jk-table-head-cell-filter-select jk-pg-sm",children:[e("div",{className:"checkbox-list",children:e(K,{options:d.map(t=>({...t,label:"string"==typeof t.label?e(A,{className:"tt-se",children:t.label}):t.label})),selectedOptions:p,onSelectOptions:m})}),t("div",{className:"jk-row right gap",children:[e(H,{size:"tiny",type:"secondary",onClick:n,disabled:!c.length,children:e(A,{className:"tt-se",children:"reset"})}),e(H,{size:"tiny",onClick:()=>i({columnIndex:o,selectedOptions:p}),disabled:JSON.stringify(c.map(({value:e})=>e))===JSON.stringify(p.map(({value:e})=>e)),ref:u,children:e(A,{className:"tt-se",children:"filter"})})]})]})},Yt=a=>{const{onFilter:i,onReset:n,columnIndex:o,initialText:d,visible:c}=a,[h,p]=s(d),m=r(null);return l(()=>{c&&m.current?.focus()},[c]),t("div",{className:"jk-col gap stretch jk-table-head-cell-filter-text jk-pg-sm",onKeyDown:e=>{"Enter"===e.code&&(e.preventDefault(),i({columnIndex:o,text:h}))},children:[e($,{onChange:e=>p(e),value:h,expand:!0,autoFocus:!0,ref:m}),t("div",{className:"jk-row right gap",children:[e(H,{size:"tiny",type:"secondary",onClick:n,disabled:""===d,children:e(A,{className:"tt-se",children:"reset"})}),e(H,{size:"tiny",onClick:()=>i({columnIndex:o,text:h}),disabled:d===h,children:e(A,{className:"tt-se",children:"filter"})})]})]})},qt=({filter:t,columnIndex:a})=>{const[i,r]=s(!1),n=bt(t)?!!t.getFilter():kt(t)?!!t.getFilter().length:xt(t)?!!g(t.getFilter()):!!Nt(t)&&(!!g(t.getFilter()?.[0])&&!!g(t.getFilter()?.[1]));return e(B,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",onOpenChange:r,content:({isOpen:i})=>{const s=()=>{t?.onReset(),r(!1)};return bt(t)?e(Yt,{columnIndex:a,initialText:t.getFilter(),onFilter:e=>{t.onFilter(e),r(!1)},onReset:s,visible:i}):kt(t)?e(Qt,{visible:i,columnIndex:a,options:t.options,initialSelectedOptions:t.getFilter(),onFilter:e=>{t.onFilter(e),r(!1)},onReset:s}):xt(t)?e(Bt,{visible:i,pickerType:t.pickerType,columnIndex:a,isDisabled:t.isDisabled,initialSelectedDate:t.getFilter(),onFilter:e=>{t.onFilter(e),r(!1)},onReset:s,baseDate:t.baseDate}):Nt(t)?e(Jt,{visible:i,pickerType:t.pickerType,columnIndex:a,isDisabled:t.isDisabled,initialStartSelectedDate:t.getFilter()[0],initialEndSelectedDate:t.getFilter()[1],onFilter:e=>{t.onFilter(e),r(!1)},onReset:s,baseStartDate:t.baseStartDate,baseEndDate:t.baseEndDate}):e("div",{children:"FILTER"})},placement:"bottom",triggerOn:De.CLICK,offset:4,children:e("div",{className:me("tool jk-row jk-br-ie",{"bc-at-lt cr-at-it active":n,"cr-hd":!n,visible:i}),children:e(We,{size:"small"})})})},Ut=a=>{const{header:i,width:r,left:s,position:n,onResizeStart:o,loading:l,withTools:d,withRightBorder:c,borderTopLeftRadius:h,borderTopRightRadius:p,borderBottomLeftRadius:m,borderBottomRightRadius:u}=a,{index:g,filter:f,sort:y,sticky:w,headClassName:v}=i,{onSort:b,getOrder:k}=y||{},x=k?.();return e("div",{style:{width:r,minWidth:r,left:w?s:void 0,top:0,zIndex:w?3:2,borderTopLeftRadius:h?"var(--border-radius-inline)":void 0,borderTopRightRadius:p?"var(--border-radius-inline)":void 0,borderBottomLeftRadius:m?"var(--border-radius-inline)":void 0,borderBottomRightRadius:u?"var(--border-radius-inline)":void 0},className:me({"with-right-border":c},"sticky jk-table-row-head"),"data-testid":g+"_head",children:t("div",{className:me("jk-row nowrap jk-table-head-cell jk-pg-sm",{"with-sort":!!y,"with-filter":!!f?.onFilter,sticky:!!w}),style:{width:r,...i.style},children:[e("div",{className:"jk-table-head-field flex-1 ht-100",children:Rt({header:i,columnIndex:g,className:v})}),d&&t("div",{className:"jk-row jk-table-head-tools",children:[y&&e("div",{className:me("tool jk-row jk-br-ie",{"bc-at-lt cr-at-it active":!!x,"cr-hd":!x}),onClick:()=>b({columnIndex:g}),children:x?e(x>0?Ve:Ce,{size:"small"}):e(Me,{up:!0,down:!0,size:"small"})}),f?.onFilter&&e(qt,{columnIndex:g,filter:f,disabled:l})]}),d&&o&&e("div",{className:"jk-table-head-drag",onMouseDown:e=>{e.preventDefault(),o(n,e.clientX)},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e("div",{})})]})})},_t=i(a=>{const{columns:i,topHeaders:r,rightBorders:s,loading:n,gap:o,hasScrollTop:l,onResizeStart:d}=a,c=!!s.length;return t("div",{className:"jk-table-head-container",style:{paddingBottom:o},children:[c&&e("div",{className:me("jk-table-head",{"elevation-1":l}),style:{width:Ue},children:r.map(({header:t,positions:a},i)=>e(Ut,{header:t,width:1===a.length?Ye(a[0]):`calc(${a.map(Ye).join(" + ")})`,left:qe(a[0]),position:a[0],loading:n,withTools:!1,withRightBorder:!(""===t.head&&""===r[i+1]?.header.head)&&i!==r.length-1,borderTopLeftRadius:0===i,borderTopRightRadius:i===r.length-1},t.headIndex))}),e("div",{className:me("jk-table-head jk-br-ie",{"elevation-1":l}),style:{width:Ue},children:i.map((t,a)=>e(Ut,{header:t,width:Ye(a),left:qe(a),position:a,onResizeStart:d,loading:n,withTools:!0,withRightBorder:!1,borderTopLeftRadius:!c&&0===a,borderTopRightRadius:!c&&a===r.length-1,borderBottomLeftRadius:0===a,borderBottomRightRadius:a===i.length-1},t.headIndex))})]})});const Gt=i(function(t){const{data:a,index:i,rowKey:r,start:s,size:n,gap:o,columns:l,rightBorders:d,getRecordStyle:c,getRecordClassName:h,onRecordClick:p,onRecordHover:m,animate:u}=t,g=a[i],f={...c?.({data:a,index:i,isCard:!1,isStickySection:!1})||{},position:"absolute",top:s+o,left:0,width:Ue,height:n-2*o+"px"},y=me("jk-table-row",h?.({data:a,index:i,isCard:!1,isStickySection:!0})||""),w=p?()=>p({data:a,index:i,isCard:!1}):void 0,v=m?()=>m({data:a,index:i,isCard:!1}):void 0,b=l.map(({Field:t,index:a,sticky:s},n)=>e("div",{style:{width:Ye(n),minWidth:Ye(n),left:s?qe(n):void 0},className:me({sticky:!!s,"with-right-border":d.has(n)},"jk-table-row-field bc-sf-md"),"data-testid":r+"_"+a,children:g&&e(t,{record:g,columnIndex:a,recordIndex:i,isCard:!1})},a));return u?e(Pe.div,{"jk-data-virtual-row-key":r,layoutId:String(r),layoutDependency:a,style:f,className:y,onClick:w,onMouseEnter:v,children:b}):e("div",{"jk-data-virtual-row-key":r,style:f,className:y,onClick:w,onMouseEnter:v,children:b})}),Xt={top:!1,bottom:!1,left:!1,right:!1};const Zt=a=>{const{data:i,headers:c,rowHeight:h,getRecordStyle:p,getRecordClassName:m,getRecordKey:u,onRecordClick:g,onRecordHover:f,gap:y,loading:w,availableWidth:v,groups:b,virtualizerOverscan:k,focusRowKey:x}=a,N=r(null),R=d(),j=!!u,S=J(i),D=J(u),C=Ee({count:i.length,estimateSize:o(()=>h+2*y,[h,y]),overscan:k,getScrollElement:o(()=>N.current,[]),getItemKey:o(e=>{const t=D.current;return t?t({data:S.current,index:e}):e},[S,D])}),F=n(()=>c.filter(e=>e.visible?.getVisible?.()),[c]);l(()=>{const e=D.current;if(!x||!e)return;const t=S.current.findIndex((t,a)=>e({data:S.current,index:a})===x);t<0||C.scrollToIndex(t,{align:"center",behavior:"smooth"})},[S,x,D,C]);const O=C.getTotalSize(),I=C.getVirtualItems(),{topHeaders:T,rightBorders:z}=n(()=>{const e=new Map(b.map(e=>[e.value,e])),t=[],a=[];return F.forEach((i,r)=>{var s;const n=void 0!==i.group?e.get(i.group):void 0,o=t[t.length-1];n?(o?.header.group===n.value?(o.positions.push(r),(s=o.header).sticky&&(s.sticky=i.sticky)):(a.length&&""!==o?.header.head||a.push(r-1),a.push(r),t.push({header:{...i,head:n.label,style:n.style},positions:[r]})),a[a.length-1]=r):t.push({header:{...i,head:"",style:{}},positions:[r]})}),{topHeaders:t,rightBorders:a}},[b,F]),[P,L]=s({}),E=n(()=>((e,t,a)=>{const i=e.reduce((e,t)=>e+Qe(t),0),r=t>i?t-i:0,s=e.map(e=>{const t=a[e.index];if(void 0!==t)return t;const s=Qe(e);return Math.floor(s+(i?r*(s/i):0))});return _e(e,s)})(F,v,P),[F,v,P]),V=n(()=>(e=>Object.fromEntries(Ge(e)))(E),[E]),M=E.total,W=E.stickyWidth,H=J(E),A=J(F),K=o((e,t)=>{const a=N.current,i=A.current[e];if(!a||!i)return;const r=H.current,s=A.current,n=Qe(i);let o=r;const l=i=>{const l=Math.max((r.widths[e]??n)+i.clientX-t,n);l!==o.widths[e]&&(o=((e,t,a,i)=>{const r=[...e.widths];return r[a]=i,_e(t,r)})(r,s,e,l),((e,t)=>{for(const[a,i]of Ge(t))e.style.setProperty(a,i)})(a,o))},d=()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",d),o!==r&&L(t=>({...t,[i.index]:o.widths[e]}))};window.addEventListener("mousemove",l),window.addEventListener("mouseup",d)},[H,A]),$=n(()=>new Set(z),[z]),{top:B,bottom:Q,left:Y,right:q}=function(e,t){const[a,i]=s(Xt);return l(()=>{const t=e.current;if(!t)return;let a=0;const r=()=>{a=0;const{scrollTop:e,scrollLeft:r,clientHeight:s,clientWidth:n,scrollHeight:o,scrollWidth:l}=t,d={top:e>0,bottom:e+s<o-1,left:r>0,right:l-n-r>1};i(e=>e.top===d.top&&e.bottom===d.bottom&&e.left===d.left&&e.right===d.right?e:d)},s=()=>{a||(a=requestAnimationFrame(r))};s(),t.addEventListener("scroll",s,{passive:!0});const n="undefined"!=typeof ResizeObserver?new ResizeObserver(s):null;return n?.observe(t),()=>{t.removeEventListener("scroll",s),n?.disconnect(),a&&cancelAnimationFrame(a)}},[e,...t]),a}(N,[O,M]),U=B||Q;return t("div",{ref:N,style:{...V,height:"100%",overflow:"scroll"},className:"jk-table-rows-container",children:[e(_t,{columns:F,topHeaders:T,rightBorders:z,loading:w,gap:y,hasScrollTop:B,onResizeStart:K}),Y&&e("div",{className:"expand-absolute pe-ne",style:{width:W,zIndex:3,background:"transparent",boxShadow:"0 0px 4px 0 var(--cr-ht), 0 0px 4px 1px var(--cr-ht)"}}),q&&e("div",{className:"expand-absolute pe-ne",style:{width:U?16:2,left:"unset",right:U?-8:-1,zIndex:3,background:"transparent",boxShadow:"0 0px 4px 0 var(--cr-ht), 0 0px 4px 1px var(--cr-ht)"}}),Q&&e("div",{className:"expand-absolute pe-ne",style:{height:1,top:"unset",bottom:-1,zIndex:3,background:"transparent",boxShadow:"0 0px 4px 0 var(--cr-ht), 0 0px 4px 1px var(--cr-ht)"}}),t("div",{className:"jk-table-rows-box",style:{height:O},children:[!i.length&&e("div",{style:{position:"absolute",top:0,left:0,width:M,height:"1px",transform:"translateY(0px)"},className:"jk-table-row",children:F.map(({index:t,sticky:a},i)=>e("div",{style:{width:Ye(i),minWidth:Ye(i)},className:me({sticky:!!a})},t))}),e(Le,{id:R,children:I.map(t=>e(Gt,{rowKey:t.key,data:i,index:t.index,start:t.start,size:t.size,gap:y,columns:F,rightBorders:$,getRecordStyle:p,getRecordClassName:m,onRecordClick:g,onRecordHover:f,animate:j},t.key))})]})]})},ea=t=>{const{headers:a,viewContainerWidth:i,rowHeight:r,loading:s,data:n,getRecordKey:o,getRecordStyle:l,getRecordClassName:d,onRecordClick:c,onRecordHover:p,groups:m,virtualizerOverscan:u,focusRowKey:g}=t;return e(Zt,{data:n,headers:a,rowHeight:r,getRecordKey:o,getRecordClassName:d,getRecordStyle:l,onRecordClick:c,onRecordHover:p,gap:4,loading:s,availableWidth:Math.max((i||0)-h,0),groups:m,virtualizerOverscan:u,focusRowKey:g})},ta=({header:a,columnIndex:i,onSort:r,order:s})=>t("div",{className:"jk-row space-between",children:[e("div",{className:"jk-row gap",children:e("div",{className:"fw-bd",children:Rt({header:a,columnIndex:i})})}),r?t("div",{className:me("jk-row nowrap jk-tag tx-s cr-pr",{"bc-at-lt cr-at-it":!!s,"bc-ht-lt":!s}),onClick:()=>r({columnIndex:i}),children:[e(A,{className:"tt-se",children:"sort"})," ",e(0===s?Me:s>0?Ve:Ce,{})]}):e("div",{})]}),aa=i=>{const{headers:r,isOpen:n,onClose:o,onFilter:d,onResetFilters:c}=i,[h,p]=s({}),[m,u]=s({}),[f,y]=s(!1),w=e=>Object.values(e).map(e=>Array.isArray(e)?e.map(e=>e?.value||e):e);l(()=>{if(!n)return;const{filtered:e,values:t}=Ot(r);p(w(t)),u(t),y(e)},[r,n]);const v=Q(e=>e.i18n.t);return e(Y,{isOpen:n,onClose:o,closeWhenKeyEscape:!0,closeWhenClickOutside:!0,children:t("div",{className:"jk-drawer-filters jk-col nowrap extend stretch",children:[t("div",{className:"jk-row left gap title cr-tx-ht jk-pg-sm",children:[e("div",{className:me({active:!0},"jk-row"),children:e(We,{})}),e(A,{children:"order and filters"})]}),e("div",{className:"jk-col top nowrap stretch space-between filter-drawer-columns flex-1",children:r.map((i,r)=>{const{index:s,filter:n,sort:{onSort:o,getOrder:l=()=>0}={}}=i;let d=null;if(bt(n))d=e($,{onChange:e=>u(t=>({...t,[s]:e})),value:m[s]||"",expand:!0,placeholder:ye(v("search..."))});else if(kt(n))d=e(K,{options:n.options,selectedOptions:m[s]||[],onSelectOptions:e=>u(t=>({...t,[s]:e}))});else if(xt(n))d=e(W,{type:n.pickerType,date:g(m[s])?m[s]:null,onDatePick:e=>u(t=>({...t,[s]:e})),onDateClean:()=>u(e=>({...e,[s]:""})),isDisabled:n.isDisabled,isSelected:jt(m[s]),baseDate:n.baseDate,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===n.pickerType||"year-month-day-hours-minutes-seconds"===n.pickerType||"year-month-day-hours-minutes"===n.pickerType||"year-month-day-hours"===n.pickerType});else if(Nt(n)){const[i,r]=Array.isArray(m?.[s])?m?.[s]:[null,null];d=t(a,{children:[t("div",{children:[t("div",{className:"jk-row left fw-bd",children:[e(A,{className:"tt-se",children:"from"})," :"]}),e(W,{type:n.pickerType,date:i,onDatePick:e=>{r&&g(r)?u(t=>({...t,[s]:[e,r]})):u(t=>({...t,[s]:[e,e]}))},onDateClean:()=>u(e=>({...e,[s]:""})),isDisabled:Ct(n.isDisabled,Ft(r)),isSelected:Ct(jt(i),St(i,r)),baseDate:n.baseStartDate,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===n.pickerType||"year-month-day-hours-minutes-seconds"===n.pickerType||"year-month-day-hours-minutes"===n.pickerType||"year-month-day-hours"===n.pickerType})]}),t("div",{children:[t("div",{className:"jk-row left fw-bd",children:[e(A,{className:"tt-se",children:"to"})," :"]}),e(W,{type:n.pickerType,date:r,onDatePick:e=>{i&&g(i)?u(t=>({...t,[s]:[i,e]})):u(t=>({...t,[s]:[e,e]}))},onDateClean:()=>u(e=>({...e,[s]:""})),isDisabled:Ct(n.isDisabled,Dt(i)),isSelected:Ct(jt(r),St(i,r)),baseDate:n.baseEndDate,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===n.pickerType||"year-month-day-hours-minutes-seconds"===n.pickerType||"year-month-day-hours-minutes"===n.pickerType||"year-month-day-hours"===n.pickerType})]})]})}return t("div",{className:"jk-col gap stretch jk-pg-sm-trl jk-pg-b",style:r?{borderTop:"1px solid var(--cr-ht)"}:{},children:[e(ta,{header:i,columnIndex:s,onSort:o,order:l()}),d]},s)})}),t("div",{className:"jk-row-col space-between gap block jk-pg-sm filter-drawer-buttons",children:[e(H,{type:"secondary",size:"small",onClick:()=>{c(),o()},disabled:!f,children:e(A,{className:"tt-se",children:"reset all filters"})}),e(H,{size:"small",onClick:()=>{d(m),o()},disabled:JSON.stringify(w(m))===JSON.stringify(h),children:e(A,{className:"tt-se",children:"apply filters"})})]})]})})},ia=e=>me({"bc-at-lt cr-at-it":e,"bc-sf-md":!e,active:e},"jk-row jk-data-viewer-tools-filter jk-br-ie cr-pr jk-row nowrap"),ra=({Icon:a,active:i,onClick:r,tooltipContent:s,className:n="",children:o,rotate:l,disabled:d=!1})=>t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":s,className:me(ia(!!i),n,{disabled:d}),onClick:r,children:[e(a,{className:"jk-br-ie",size:"small",rotate:l}),o]}),sa=i(i=>{const{extraNodes:n,setViewMode:d,headers:c,toolbarRef:h,viewMode:m,dataLength:u,rowsView:g,cardsView:f,loading:y,initializing:w,onReload:v,onAllFilters:b,pagination:k,extraNodesFloating:x,showFilterDrawerKey:N,filterKey:R,filters:j,downloads:S,requestProps:D}=i,{filtered:C,values:F}=Ot(c),[O,I]=s(!1),T=q(e=>e.viewPort.isSmallScreen),{notifyResponse:z}=U(),P=_(e=>e.searchParams.get(N)),L=r(void 0),[E,V]=G(N,"open"===P?"open":"close"),M=o(e=>{V(e?"open":"close")},[V]),W=!(T&&(!g||!f)),H=!!c.filter(e=>e.filter||e.sort).length;l(()=>{y?L.current?.(Re.LOADING):L.current?.(Re.NONE)},[y]);const A="open"===E,[K,$]=s(A);A&&!K&&$(!0);new URL(ue()&&window.location?.href||"").searchParams.set(R,JSON.stringify(j));const J=c.filter(e=>e.visible?.getVisible()).length;return t("div",{className:me("jk-data-viewer-toolbar with-vertical-scroll pn-re jk-row space-between nowrap jk-br-ie jk-pg-xsm-rl",m.toLowerCase()),ref:h,children:[K&&e(aa,{isOpen:A,headers:c,onClose:()=>M(!1),onFilter:e=>b(e),onResetFilters:()=>b({})}),!T&&e("div",{className:"jk-table-view-extra-nodes jk-row left gap",children:n.map(we)}),t("div",{className:"jk-table-view-tools jk-br-ie jk-pg-xsm-tb jk-row-col gap stretch",children:[t("div",{className:"jk-row nowrap gap",children:[v&&e(ra,{Icon:y?Fe:Oe,tooltipContent:y?"reloading data":"reload data",active:y,onClick:v,className:"jk-input-select"},"reload-button-icon"),k.withPagination&&e(X,{dataLength:u,loading:y,initializing:w,pageSizeOptions:T?[20]:k.pageSizeOptions,total:k.total,page:k.page,pageSize:k.pageSize,jumpToPage:k.jumpToPage,onPageSizeChange:k.onPageSizeChange,isOnToolbar:!0},"first-row-pagination")]}),t("div",{className:"jk-row nowrap gap",children:[H&&e(ra,{Icon:We,tooltipContent:"open filters",onClick:()=>M(!0),active:C,className:"jk-input-select",children:!!Object.values(F).length&&t(a,{children:[" ",e("span",{className:"bc-ht-lt jk-br-ie",style:{lineHeight:1,padding:"0 4px"},children:Object.values(F).length})," "]})}),!!S.length&&e(Z,{options:S,onChange:async({value:e})=>{I(!0);const t=S.find(t=>e===t.value),a=t?.getUrl(D)??"",i=t?.getFilename(D)??"",r=ve(await be(a));r.success&&(await ge(r.content.urlExportedFile,i),z(r)),I(!1)},selectedOption:{value:""},style:{width:"auto"},children:e(ra,{Icon:O?Fe:Ie,tooltipContent:O?"downloading":"download",className:"jk-input-select",onClick:O?e=>e.stopPropagation():void 0})}),e(ee,{options:c.map(e=>({label:Rt({header:e,columnIndex:e.index}),value:e.index})),selectedOptions:c.filter(({visible:e})=>e?.getVisible?.()).map(({index:e})=>({value:e})),containerWidth:"child",onChange:(e,t)=>{const a=c.find(e=>e.index===t?.value);a?.visible.onToggle()},className:"bc-sf-md",children:e(ra,{Icon:He,tooltipContent:"visibility of columns",className:"jk-input-select",active:J!==c.length,children:t(a,{children:[" ",t("span",{className:"bc-ht-lt jk-br-ie ws-np",style:{lineHeight:1,padding:"0 4px"},children:[J," / ",c.length]})," "]})})}),W&&(g||f)&&t(a,{children:[e("div",{className:"jk-divider horizontal"}),t("div",{className:me("jk-row nowrap jk-table-view-tools-view-mode",{rowsView:g,cardsView:f}),children:[g&&e(ra,{Icon:Ae,tooltipContent:"list view",className:"rows",active:m===p.ROWS,onClick:()=>d(p.ROWS,!0),rotate:90}),f&&e(ra,{Icon:Te,tooltipContent:"cards view","data-tooltip-place":"top-end",className:"cards",active:m===p.CARDS,onClick:()=>d(p.CARDS,!0)})]})]}),!!n.length&&T&&!x&&t(a,{children:[e("div",{className:"jk-divider horizontal"}),e("div",{children:e(B,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:e("div",{className:"jk-pg-sm jk-col stretch gap",children:n.map(we)}),triggerOn:De.CLICK,placement:"bottom",children:e("div",{className:"jk-row",children:e(Ke,{})})})})]})]})]})]})}),na=a=>{const{viewPortSize:i,cards:{height:s=300,width:n=256,expanded:o=!1}={height:300,width:256,expanded:!1},cardsView:l,data:d,extraNodes:m,headers:u,loading:g,initializing:f,onAllFilters:y,onReload:w,rows:{height:v=56}={height:56},rowsView:b,viewMode:k,setViewMode:x,getRecordKey:N,pagination:R,getRecordStyle:j,getRecordClassName:S,onRecordClick:D,onRecordHover:C,extraNodesFloating:F=!1,showFilterDrawerKey:O,filterKey:I,filters:T,groups:z,downloads:P,requestProps:L,virtualizerOverscan:E,focusRowKey:V}=a,{width:M,ref:W}=te(),H=r(null),{height:K=0}=te({targetRef:H}),$="sm"===i;return t("div",{className:"jk-data-viewer-content jk-br-ie",style:{"--jk-table-toolbar-height":K+"px",position:"relative"},children:[e(sa,{setViewMode:x,extraNodes:m,headers:u,toolbarRef:H,dataLength:d.length,viewMode:k,rowsView:b,cardsView:l,loading:g,initializing:f,onReload:w,onAllFilters:y,pagination:R,extraNodesFloating:F,showFilterDrawerKey:O,filterKey:I,filters:T,downloads:P,requestProps:L}),F&&$&&e("div",{className:"jk-col gap nowrap",style:{position:"absolute",bottom:"var(--pad-t)",right:"var(--pad-t)",zIndex:1},children:c.toArray(m.map((e,t)=>we(e,t)))}),t("div",{className:me("jk-view-container",k.toLowerCase()),ref:W,children:[d.length>0&&g&&e(ze,{}),t("div",{className:me("jk-data-viewer-body",k.toLowerCase()),style:{width:M||0},children:[0===d.length&&g&&e("div",{className:"jk-row center expand-absolute pe-ne",style:{height:"100%"},children:t("div",{className:"jk-row",style:{alignItems:"baseline"},children:[e(A,{className:"tt-se",children:"loading data"})," ",e("div",{className:"dot-flashing"})]})}),k===p.ROWS?e(ea,{headers:u,viewContainerWidth:M||0,rowHeight:v,data:d,loading:g,getRecordKey:N,getRecordStyle:j,getRecordClassName:S,onRecordClick:D,onRecordHover:C,groups:z,virtualizerOverscan:E,focusRowKey:V}):e(Je,{headers:u,data:d,cardHeight:s,cardWidth:n,rowWidth:(M||0)-h,getRecordClassName:S,getRecordStyle:j,onRecordClick:D,onRecordHover:C,expandedCards:o})]})]})]})},oa=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function la(t){const{cards:a,cardsView:i=!0,className:d="",data:c,extraNodes:h,headers:f,initialViewMode:j,name:S="",requestRef:D,rows:C,rowsView:F=!0,totalData:O,pageSizeOptions:I,getRecordKey:T,getPageQueryParam:z=It,getPageSizeQueryParam:P=Tt,getSortQueryParam:L=zt,getFilterQueryParam:E=Pt,getViewModeQueryParam:V=Lt,getShowFilterDrawerQueryParam:M=Et,getVisiblesQueryParam:W=Vt,getRecordStyle:H,getRecordClassName:A,onRecordClick:K,onRecordHover:$,extraNodesFloating:B,setLoaderStatusRef:Y,setDataTableRef:U,initializing:X=!1,downloads:Z,groups:ee,deps:te=[],virtualizerOverscan:ue=4,focusRowKey:ge}=t,fe=q(e=>e.viewPort.screen),ye=ae(e=>e.user.settings[m.DATA_VIEW_MODE]),we=Q(e=>e.i18n.t),ve=z(S),be=P(S),De=L(S),Ce=E(S),Fe=V(S),Oe=M(S),Ie=W(S),Te=_(e=>e.searchParams.get(De)),ze=_(e=>e.searchParams.get(Ie)),Pe=_(e=>e.searchParams.get(Ce)),Le=_(e=>e.searchParams.get(ve)),Ee=_(e=>e.searchParams.get(be)),Ve=_(e=>e.searchParams.get(Fe)),Me=!!I,[We,He]=s(Re.LOADING),Ae=We===Re.LOADING||X,Ke=Te,[$e,Be,Je]=G(De,Ke),Qe=J($e),[Ye,qe]=G(Ie,ze,Ne(f.map(({index:e})=>e))),Ue=Pe||"",[_e,Ge,bt]=G(Ce,je(Ue)?Ue:null),kt=n(()=>{const e=je(_e)?JSON.parse(_e):{},t={};for(const a of f)t[a.index]=e[a.index];return t},[_e,f]),xt=J(kt),Nt=JSON.stringify(I??[25,50,100]),Rt=n(()=>JSON.parse(Nt),[Nt]),[jt,St]=G(ve,Le),Dt=+jt||1,[Ct,Ft]=G(be,Ee),Ot=+Ct||Rt[0],Mt=n(()=>{const e={},t=f.find(({index:e})=>e===$e||"-"+e===$e);return t?.sort&&(e[t.index]=t.index===$e?1:-1),JSON.stringify({sort:e,filter:kt,pagination:Me?{page:Dt,pageSize:Ot}:{page:0,pageSize:0}})},[kt,f,Dt,Ot,$e,Me]),Bt=n(()=>JSON.parse(Mt),[Mt]),Jt=JSON.stringify(te),Qt=J(D),Yt=o(()=>Qt.current?.(Bt),[Qt,Bt]);l(()=>{Yt()},[Yt,Jt]);const qt=n(()=>((e,t,a,i)=>{let r=[...e];for(const e of t){const t=e.index;if(a[t]){const i=e.index;if(dt(e?.filter))r=r.filter(e.filter.callbackFn({columnIndex:e.index,text:a[t]}));else if(ct(e?.filter)){const s=new RegExp(oa(a[t]),"i");r=r.filter(t=>{if(ct(e?.filter)){const a=e.filter.getValue?e.filter.getValue({record:t}):i in t?t[i]:null;return"string"==typeof a&&s.test(a)}return!1})}else if(pt(e?.filter)){const i=xe(a[t]).map(t=>{if(pt(e?.filter))return e.filter.options.find(({value:e})=>e===t)}).filter(Boolean);r=r.filter(e.filter.callbackFn({columnIndex:e.index,selectedOptions:i}))}else if(mt(e?.filter)){const s=xe(a[t]).map(t=>{if(mt(e?.filter))return e.filter.options.find(({value:e})=>e===t)}).filter(Boolean);r=r.filter(t=>{if(mt(e?.filter)){const a=e.filter.getValue?e.filter.getValue({record:t}):i in t?t[i]:null;return!!s.find(e=>e.value===a)}return!1})}else if(gt(e?.filter))r=r.filter(e.filter.callbackFn({columnIndex:e.index,selectedDate:new Date(+a[t])}));else if(ft(e?.filter)){const{showYears:s,showMonths:n,showDays:o,showHours:l,showMinutes:d,showSeconds:c,showMilliseconds:h}=ke(e.filter.pickerType||Ht);if(a[t]&&g(new Date(+a[t]))){const p=new Date(+a[t]);r=r.filter(t=>{if(ft(e?.filter)){const a=e.filter.getValue?e.filter.getValue({record:t}):i in t?t[i]:null;if(a instanceof Date&&g(a)){if(h)return y(p,a);if(c)return w(p,a);if(d)return v(p,a);if(l)return b(p,a);if(o)return k(p,a);if(n)return x(p,a);if(s)return N(p,a)}else Se("datum no filtered",{datum:t,searchDate:p,index:e.index,head:e})}return!0})}else Se("data no filtered, filter not a valid time date",{search:a[t],searchFilter:a})}else if(wt(e?.filter)){const[i,s]=xe(a[t]);i&&g(new Date(+i))&&s&&g(new Date(+s))?r=r.filter(e.filter.callbackFn({columnIndex:e.index,startSelectedDate:new Date(+i),endSelectedDate:new Date(+s)})):Se("data no filtered, filter not a valid range times date",{search:a[t],searchFilter:a})}else if(vt(e?.filter)){const[s,n]=xe(a[t]);if(s&&g(new Date(+s))&&n&&g(new Date(+n))){const t=new Date(+s),a=new Date(+n),{showMonths:o,showDays:l,showHours:d,showMinutes:c,showSeconds:h,showMilliseconds:p}=ke(e.filter.pickerType||Ht);r=r.filter(r=>{if(vt(e?.filter)){const s=e.filter.getValue?e.filter.getValue({record:r}):i in r?r[i]:null;if(s instanceof Date&&g(s)){let e=t.getFullYear()<=s.getFullYear()&&s.getFullYear()<=a.getFullYear();return o&&(e=e&&R(s,{start:re(t),end:ie(a)})),l&&(e=e&&R(s,{start:ne(t),end:se(a)})),d&&(e=e&&R(s,{start:le(t),end:oe(a)})),c&&(e=e&&R(s,{start:ce(t),end:de(a)})),h&&(e=e&&R(s,{start:pe(t),end:he(a)})),p&&(e=R(s,{start:t,end:a})),e}Se("datum no filtered",{datum:r,startSelectedDate:t,endSelectedDate:a,index:e.index,head:e})}return!0})}else Se("data no filtered, filter not a valid range times date",{search:a[t],searchFilter:a})}}}const s=r.length!==e.length;let n=!1;for(const e of xe(i)){const a=t.find(({index:t})=>t===e||"-"+t===e);a?.sort&&nt(a?.sort)&&(a.index===e?(r.sort(a.sort.compareFn({columnIndex:a.index})),n=!0):"-"+a.index===e&&(r.sort((e,t)=>nt(a?.sort)?-1*a.sort.compareFn({columnIndex:a.index})(e,t):0),n=!0))}return s||n?r:e})(c,f,kt,$e),[c,f,kt,$e]),Ut=J(U);l(()=>{Ut.current?.(qt)},[qt,Ut]);const _t=J(Y);l(()=>{_t.current?.(e=>{He("function"==typeof e?t=>e(t):e)})},[_t]);const Gt=n(()=>((e,t,a,i,r,s,n,o,l,d)=>(e=>{let t=0;const a=[...e];return e.forEach((e,i)=>{e.visible?.getVisible()&&(a[i]={...e,accumulatedWidth:t},t+=e.width)}),a})(e.map(({sort:e,filter:c,...h},p)=>{const m=()=>xe(t).includes(h.index),u={...h,minWidth:h.minWidth??0,width:0,accumulatedWidth:0,headIndex:p,visible:{getVisible:m,onToggle(){const e=m();s(Ne(e?xe(t).filter(e=>e!==h.index):[...xe(t),h.index]))}}},f=h.index;let y=c?28:0;if(e){y+=28;const t=h.index,a="-"+h.index,i=()=>xe(r.current).includes(t)?1:xe(r.current).includes(a)?-1:0;u.sort={getOrder:i,onSort:()=>{const e=1===i()?a:-1===i()?"":t;e?n(e):o()},online:ot(e)}}c?.type===Xe||c?.type===Ze?u.filter={type:Xe,onFilter:({text:e})=>$t(f,e,i,l,d),onReset:Kt(f,i,l,d),getFilter:()=>i.current[f]||"",online:lt(c)}:c?.type===et||c?.type===tt?u.filter={type:et,onFilter:({selectedOptions:e})=>{$t(f,Ne(e.filter(({value:e})=>!!c.options.find(t=>t.value===e)).map(({value:e})=>e)),i,l,d)},onReset:Kt(f,i,l,d),options:c.options,getFilter:()=>i.current[f]?xe(i.current[f]).map(e=>({value:e,label:""})):[],online:ht(c)}:c?.type===at||c?.type===it?u.filter={type:at,pickerType:c.pickerType||Ht,onFilter:({selectedDate:e})=>$t(f,e.getTime()+"",i,l,d),isDisabled:c.isDisabled||(()=>({})),onReset:Kt(f,i,l,d),getFilter:()=>i.current[f]&&g(new Date(+i.current[f]))?new Date(+i.current[f]):null,baseDate:c.baseDate||new Date,online:ut(c)}:c?.type!==rt&&c?.type!==st||(u.filter={type:rt,pickerType:c.pickerType||Ht,onFilter:({startSelectedDate:e,endSelectedDate:t})=>$t(f,Ne([e.getTime()+"",t.getTime()+""]),i,l,d),onReset:Kt(f,i,l,d),isDisabled:c.isDisabled||(()=>({})),getFilter:()=>{const[e,t]=i.current[f]?xe(i.current[f]):[];return[e&&g(new Date(+e))?new Date(+e):null,t&&g(new Date(+t))?new Date(+t):null]},baseStartDate:c.baseStartDate||new Date,baseEndDate:c.baseEndDate||new Date,online:yt(c)});const w=h.head||h.index;if("string"==typeof w){const e=Math.ceil(Wt(a(w.toUpperCase()),"400 14px / 14px Inter, sans-serif"))+4;u.minWidth=Math.max(h.minWidth||0,y+e+16+4)}return u})))(f,Ye,we,xt,Qe,qe,Be,Je,Ge,bt),[bt,Je,f,Ge,Be,we,xt,Qe,qe,Ye,$e,_e]),Xt=o(e=>{const t={...kt};f.forEach(({filter:a,index:i})=>{const r=e[i];if(a?.type===Xe||a?.type===Ze)t[i]=r;else if(a?.type===et||a?.type===tt)t[i]=Ne((e[i]||[]).filter(({value:e})=>!!a.options.find(t=>t.value===e)).map(({value:e})=>e));else if(a?.type===at||a?.type===it)e[i]instanceof Date?t[i]=e[i].getTime()+"":t[i]="";else if(a?.type===rt||a?.type===st){const[a,r]=e[i]?e[i]:[null,null];g(a)&&g(r)?t[i]=Ne([a.getTime()+"",r.getTime()+""]):t[i]=""}}),At(t)?Ge(JSON.stringify(t)):bt()},[bt,f,kt,Ge]),Zt=j||(ye===p.CARDS?p.CARDS:p.ROWS),[ea,ta]=G(Fe,Ve?Ve.toUpperCase()===p.CARDS?p.CARDS:p.ROWS:Zt);l(()=>{!i&&F?ta(p.ROWS):!F&&i&&ta(p.CARDS)},[i,F,ta]);const aa=r("");l(()=>{aa.current!==fe&&i&&"sm"===fe&&ta(p.CARDS),aa.current=fe},[fe,i,F,ta]);const ia=O??c.length,ra=n(()=>({withPagination:Me,total:ia,pageSizeOptions:Rt,page:Dt,pageSize:Ot,jumpToPage:St,onPageSizeChange:Ft}),[Me,ia,Rt,Dt,Ot,St,Ft]),sa=n(()=>(h||[]).filter(Boolean),[h]);return e("div",{className:me(d,"jk-data-viewer-layout ht-100",{"with-pagination":Me}),children:e(na,{viewPortSize:fe,cards:a,data:qt,extraNodes:sa,extraNodesFloating:B,headers:Gt,groups:ee||u,loading:We===Re.LOADING,initializing:Ae,onAllFilters:Xt,onReload:Qt.current?Yt:null,rows:C,showFilterDrawerKey:Oe,rowsView:F,cardsView:i,setViewMode:ta,viewMode:ea,getRecordKey:T,getRecordStyle:H,getRecordClassName:A,onRecordClick:K,onRecordHover:$,pagination:ra,filterKey:Ce,filters:kt,downloads:Z??u,requestProps:Bt,virtualizerOverscan:ue,focusRowKey:ge})})}export{la as default};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{memo as i,useRef as r,useState as s,useMemo as n,useCallback as o,useEffect as l,useId as d,Children as c}from"react";import{S as h,D as p,P as m,E as u}from"./index-Zvckkvpn.js";import{K as g,N as f,O as y,Q as w,R as v,S as b,U as k,V as x,X as N,Y as R,Z as j,_ as S,$ as D,a0 as C,a1 as F,a2 as O,a3 as I,a4 as T,a5 as z,a6 as P,a7 as L,a8 as E,a9 as V,aa as M,ab as W,B as H,T as A,ac as K,w as $,ad as B,a as J,l as Q,ae as Y,f as q,af as U,p as _,ag as G,ah as X,ai as Z,aj as ee,J as te,e as ae,ak as ie,al as re,am as se,an as ne,ao as oe,ap as le,aq as de,ar as ce,as as he,at as pe}from"./index-Bz4iycQ-.js";import{c as me,i as ue,f as ge}from"./commons-C-9EFvh4.js";import{r as fe,H as ye,B as we,I as ve,f as be,D as ke}from"./websocket-B8ybpDXk.js";import{e as xe,j as Ne,S as Re,i as je,c as Se}from"./settings-DzQM72QE.js";import{TriggerAction as De}from"./enums.js";import{e as Ce,S as Fe,R as Oe,f as Ie,g as Te,L as ze}from"./LoaderLayer-CWElgcGs.js";import{motion as Pe,LayoutGroup as Le}from"motion/react";import"react-dom";import{u as Ee}from"./index-CKBtKrj5.js";import{A as Ve,S as Me}from"./index-B--41Rgp.js";import{F as We,T as He,C as Ae,M as Ke}from"./TableEyeIcon-cEB6wzrG.js";import"swr";import"./index-B8CE4gNp.js";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";const $e=[["top","topLeft","top","topRight"],["upper","upperLeft","upper","upperRight"],["center","centerLeft","center","centerRight"],["lower","lowerLeft","lower","lowerRight"],["bottom","bottomLeft","bottom","bottomRight"]],Be=i(a=>{const{cardWidth:i,index:r,data:s,sections:n,fake:o,getRecordStyle:l,getRecordClassName:d,onRecordClick:c,onRecordHover:h}=a;if(o)return e("div",{className:"jk-list-card",style:{width:i,opacity:0}});const p=s[r],m=({index:t,Field:a})=>e("div",{children:p&&e(a,{record:p,columnIndex:t,recordIndex:r,isCard:!0})},t);return e("div",{className:me("jk-list-card jk-br",d?.({data:s,index:r,isCard:!0,isStickySection:!1})||""),style:{...l?.({data:s,index:r,isCard:!0,isStickySection:!1})||{},width:i},onClick:c?()=>c({data:s,index:r,isCard:!0}):void 0,onMouseEnter:h?()=>h({data:s,index:r,isCard:!0}):void 0,children:$e.map(([a,i,r,s])=>{const o=n[i],l=n[r],d=n[s];return o?.length||l?.length||d?.length?t("div",{className:me(`${a}-container`,{"no-middle":"top"===a||!l?.length}),children:[e("div",{className:`${i.replace(/([A-Z])/g,"-$1").toLowerCase()} jk-col stretch`,children:o?.map(m)}),e("div",{className:`${a} jk-col stretch`,children:l?.map(m)}),e("div",{className:`${s.replace(/([A-Z])/g,"-$1").toLowerCase()} jk-col stretch`,children:d?.map(m)})]},a):null})})}),Je=t=>{const{headers:a,data:i,cardHeight:l,cardWidth:d,rowWidth:c,getRecordStyle:h,onRecordClick:p,onRecordHover:m,getRecordClassName:u,expandedCards:g}=t,f=r(null),[y,w]=s(!1),[v,b]=s(!1),k=n(()=>(e=>{const t={};for(const a of e){const e=a.cardPosition||"center";(t[e]??(t[e]=[])).push(a)}return t})(a),[a]),x=Math.max(Math.floor((c-16)/(d+16)),1),N=Ee({count:Math.ceil(i.length/x),getScrollElement:o(()=>f.current,[]),estimateSize:o(()=>l+40,[l]),overscan:2});let R=Math.min(d,c-16-16);return g&&(R=(c-16*(x+1))/x),e("div",{ref:f,className:me("jk-list-card-rows-container",{"scroll-on-top":!y,"scroll-on-bottom":!v}),onScroll:({currentTarget:e})=>{const t=e.scrollTop||0;b(!!(e.scrollHeight-e.clientHeight-t)),w(!!t)},children:e("div",{className:"jk-list-card-rows-box",style:{height:`${N.getTotalSize()}px`,zIndex:0},children:N.getVirtualItems().map(t=>e("div",{style:{height:`${t.size}px`,transform:`translateY(${t.start}px)`},className:"jk-row jk-list-card-row",children:Array.from({length:x},(a,r)=>{const s=t.index*x+r;return e(Be,{fake:s>=i.length,cardWidth:R,sections:k,data:i,index:s,getRecordClassName:u,getRecordStyle:h,onRecordClick:p,onRecordHover:m},s)})},t.index))})})},Qe=e=>e.minWidth||100,Ye=e=>`var(--jk-col-w-${e})`,qe=e=>`var(--jk-col-l-${e})`,Ue="var(--jk-table-w)",_e=(e,t)=>{const a=[];let i=0,r=0;return t.forEach((t,s)=>{a.push(i),i+=t,e[s]?.sticky&&(r+=t)}),{widths:t,lefts:a,total:i,stickyWidth:r}},Ge=e=>[["--jk-table-w",`${e.total}px`],...e.widths.map((e,t)=>[`--jk-col-w-${t}`,`${e}px`]),...e.lefts.map((e,t)=>[`--jk-col-l-${t}`,`${e}px`])],Xe="text",Ze="text-auto",et="select",tt="select-auto",at="date",it="date-auto",rt="date-range",st="date-range-auto",nt=e=>!("object"!=typeof e||!e?.compareFn),ot=e=>!0===e,lt=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===Xe,dt=e=>!!e?.hasOwnProperty("callbackFn")&&e?.type===Xe,ct=e=>e?.type===Ze,ht=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===et,pt=e=>!!e?.hasOwnProperty("callbackFn")&&e?.type===et,mt=e=>e?.type===tt,ut=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===at,gt=e=>!!e?.hasOwnProperty("callbackFn")&&e?.type===at,ft=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===it,yt=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===rt,wt=e=>!!e?.hasOwnProperty("callbackFn")&&e?.type===rt,vt=e=>!e?.hasOwnProperty("callbackFn")&&e?.type===st,bt=e=>e?.type===Xe,kt=e=>e?.type===et,xt=e=>e?.type===at,Nt=e=>e?.type===rt,Rt=({header:t,columnIndex:a,className:i})=>"string"==typeof t.head?e(f,{text:t.head,className:i}):t.head?fe(t.head,{header:t,data:[]}):e(f,{text:a,className:i}),jt=e=>t=>({year:!!e&&N(t,e),month:!!e&&x(t,e),day:!!e&&k(t,e),hours:!!e&&b(t,e),minutes:!!e&&v(t,e),seconds:!!e&&w(t,e),milliseconds:!!e&&y(t,e)}),St=(e,t)=>a=>({year:!!e&&!!t&&(N(a,e)||N(a,t)||R(a,{start:e,end:t})),month:!!e&&!!t&&(x(a,e)||x(a,t)||R(a,{start:e,end:t})),day:!!e&&!!t&&(k(a,e)||k(a,t)||R(a,{start:e,end:t})),hours:!!e&&!!t&&(b(a,e)||b(a,t)||R(a,{start:e,end:t})),minutes:!!e&&!!t&&(v(a,e)||v(a,t)||R(a,{start:e,end:t})),seconds:!!e&&!!t&&(w(a,e)||w(a,t)||R(a,{start:e,end:t})),milliseconds:!!e&&!!t&&(y(a,e)||y(a,t)||R(a,{start:e,end:t}))}),Dt=e=>t=>({year:!!e&&M(t,e),month:!!e&&V(t,e),day:!!e&&E(t,e),hours:!!e&&L(t,e),minutes:!!e&&P(t,e),seconds:!!e&&z(t,e),milliseconds:!!e&&T(t,e)}),Ct=(e,t)=>a=>{const i=e(a),r=t(a);return{year:i.year||r.year,month:i.month||r.month,day:i.day||r.day,hours:i.hours||r.hours,minutes:i.minutes||r.minutes,seconds:i.seconds||r.seconds,milliseconds:i.milliseconds||r.milliseconds}},Ft=e=>t=>({year:!!e&&I(t,e),month:!!e&&O(t,e),day:!!e&&F(t,e),hours:!!e&&C(t,e),minutes:!!e&&D(t,e),seconds:!!e&&S(t,e),milliseconds:!!e&&j(t,e)}),Ot=e=>{let t=!1;const a={};return e.forEach(({index:e,filter:i})=>{if(bt(i))i.getFilter?.()&&(a[e]=i.getFilter(),t=!0);else if(kt(i))i.getFilter?.()?.length&&(a[e]=i.getFilter(),t=!0);else if(xt(i))g(i.getFilter?.())&&(a[e]=i.getFilter(),t=!0);else if(Nt(i)){const r=i.getFilter?.();g(r?.[0])&&g(r?.[1])&&(a[e]=r,t=!0)}}),{filtered:t,values:a}},It=e=>e?e+".page":"page",Tt=e=>e?e+".pageSize":"pageSize",zt=e=>e?e+".sort":"sort",Pt=e=>e?e+".filter":"filter",Lt=e=>e?e+".viewMode":"viewMode",Et=e=>e?e+".showFilterDrawer":"showFilterDrawer",Vt=e=>e?e+".visibles":"visibles",Mt=new Map;function Wt(e,t){const a=`${e}-${t}`;if(Mt.has(a))return Mt.get(a);if("undefined"!=typeof document){const i=(Wt.canvas||(Wt.canvas=document.createElement("canvas"))).getContext("2d");if(i){i.font=t;const r=i.measureText(e).width;return Mt.set(a,r),r}}return 0}const Ht="year-month-day-hours-minutes-seconds",At=e=>!!Object.values(e).filter(e=>!!e&&(!Array.isArray(e)||e.length)).length,Kt=(e,t,a,i)=>()=>{const r={...t.current};r[e]="",At(r)?a(JSON.stringify(r)):i()},$t=(e,t,a,i,r)=>{const s={...a.current};JSON.stringify(s[e])!==JSON.stringify(t)&&(s[e]=t,At(s)?i(JSON.stringify(s)):r())},Bt=a=>{const{onFilter:i,onReset:n,isDisabled:o,columnIndex:d,initialSelectedDate:c,pickerType:h,visible:p,baseDate:m}=a,[u,f]=s(c),R=r(null);return l(()=>{p&&R.current?.focus()},[p]),t("div",{className:"jk-col gap jk-table-head-cell-filter-date jk-pg-sm",children:[e(W,{type:h,date:u,onDatePick:e=>f(e),onDateClean:()=>f(null),inline:!0,isDisabled:o,isSelected:e=>({year:!!u&&N(e,u),month:!!u&&x(e,u),date:!!u&&k(e,u),hours:!!u&&b(e,u),minutes:!!u&&v(e,u),seconds:!!u&&w(e,u),milliseconds:!!u&&y(e,u)}),baseDate:m,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===h||"year-month-day-hours-minutes-seconds"===h||"year-month-day-hours-minutes"===h||"year-month-day-hours"===h}),t("div",{className:"jk-row right gap buttons wh-100",children:[e(H,{size:"tiny",type:"secondary",onClick:n,disabled:!g(c),children:e(A,{className:"tt-se",children:"reset"})}),e(H,{size:"tiny",onClick:()=>u&&i({columnIndex:d,selectedDate:u}),disabled:!g(u),ref:R,children:e(A,{className:"tt-se",children:"filter"})})]})]})},Jt=a=>{const{onFilter:i,onReset:n,isDisabled:o,columnIndex:d,initialStartSelectedDate:c,initialEndSelectedDate:h,pickerType:p,visible:m,baseStartDate:u,baseEndDate:f}=a,[y,w]=s(c),[v,b]=s(h),k=r(null);return l(()=>{m&&k.current?.focus()},[m]),t("div",{className:"jk-col gap jk-table-head-cell-filter-date-range jk-pg-sm",children:[t("div",{className:"jk-row gap date-range nowrap",children:[t("div",{children:[t("div",{className:"jk-row center fw-bd",children:[e(A,{className:"tt-se",children:"from"})," :"]}),e(W,{type:p,date:y,onDatePick:w,onDateClean:()=>w(null),inline:!0,isDisabled:Ct(o,Ft(v)),isSelected:Ct(jt(y),St(y,v)),baseDate:u,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===p||"year-month-day-hours-minutes-seconds"===p||"year-month-day-hours-minutes"===p||"year-month-day-hours"===p})]}),t("div",{children:[t("div",{className:"jk-row center fw-bd",children:[e(A,{className:"tt-se",children:"to"})," :"]}),e(W,{type:p,date:v,onDatePick:b,onDateClean:()=>b(null),inline:!0,isDisabled:Ct(o,Dt(y)),isSelected:Ct(jt(v),St(y,v)),baseDate:f,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===p||"year-month-day-hours-minutes-seconds"===p||"year-month-day-hours-minutes"===p||"year-month-day-hours"===p})]})]}),t("div",{className:"jk-row gap right buttons wh-100",children:[e(H,{size:"tiny",type:"secondary",onClick:n,disabled:!(c&&h&&g(c)&&g(h)),children:e(A,{className:"tt-se",children:"reset"})}),e(H,{size:"tiny",onClick:()=>y&&v&&g(y)&&g(v)&&i({columnIndex:d,startSelectedDate:y,endSelectedDate:v}),disabled:!(y&&v&&g(y)&&g(v)),ref:k,children:e(A,{className:"tt-se",children:"filter"})})]})]})},Qt=a=>{const{onFilter:i,onReset:n,columnIndex:o,options:d,initialSelectedOptions:c,visible:h}=a,[p,m]=s(c),u=r(null);return l(()=>{h&&u.current?.focus(),m(c)},[c,h]),t("div",{className:"jk-col gap stretch jk-table-head-cell-filter-select jk-pg-sm",children:[e("div",{className:"checkbox-list",children:e(K,{options:d.map(t=>({...t,label:"string"==typeof t.label?e(A,{className:"tt-se",children:t.label}):t.label})),selectedOptions:p,onSelectOptions:m})}),t("div",{className:"jk-row right gap",children:[e(H,{size:"tiny",type:"secondary",onClick:n,disabled:!c.length,children:e(A,{className:"tt-se",children:"reset"})}),e(H,{size:"tiny",onClick:()=>i({columnIndex:o,selectedOptions:p}),disabled:JSON.stringify(c.map(({value:e})=>e))===JSON.stringify(p.map(({value:e})=>e)),ref:u,children:e(A,{className:"tt-se",children:"filter"})})]})]})},Yt=a=>{const{onFilter:i,onReset:n,columnIndex:o,initialText:d,visible:c}=a,[h,p]=s(d),m=r(null);return l(()=>{c&&m.current?.focus()},[c]),t("div",{className:"jk-col gap stretch jk-table-head-cell-filter-text jk-pg-sm",onKeyDown:e=>{"Enter"===e.code&&(e.preventDefault(),i({columnIndex:o,text:h}))},children:[e($,{onChange:e=>p(e),value:h,expand:!0,autoFocus:!0,ref:m}),t("div",{className:"jk-row right gap",children:[e(H,{size:"tiny",type:"secondary",onClick:n,disabled:""===d,children:e(A,{className:"tt-se",children:"reset"})}),e(H,{size:"tiny",onClick:()=>i({columnIndex:o,text:h}),disabled:d===h,children:e(A,{className:"tt-se",children:"filter"})})]})]})},qt=({filter:t,columnIndex:a})=>{const[i,r]=s(!1),n=bt(t)?!!t.getFilter():kt(t)?!!t.getFilter().length:xt(t)?!!g(t.getFilter()):!!Nt(t)&&(!!g(t.getFilter()?.[0])&&!!g(t.getFilter()?.[1]));return e(B,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",onOpenChange:r,content:({isOpen:i})=>{const s=()=>{t?.onReset(),r(!1)};return bt(t)?e(Yt,{columnIndex:a,initialText:t.getFilter(),onFilter:e=>{t.onFilter(e),r(!1)},onReset:s,visible:i}):kt(t)?e(Qt,{visible:i,columnIndex:a,options:t.options,initialSelectedOptions:t.getFilter(),onFilter:e=>{t.onFilter(e),r(!1)},onReset:s}):xt(t)?e(Bt,{visible:i,pickerType:t.pickerType,columnIndex:a,isDisabled:t.isDisabled,initialSelectedDate:t.getFilter(),onFilter:e=>{t.onFilter(e),r(!1)},onReset:s,baseDate:t.baseDate}):Nt(t)?e(Jt,{visible:i,pickerType:t.pickerType,columnIndex:a,isDisabled:t.isDisabled,initialStartSelectedDate:t.getFilter()[0],initialEndSelectedDate:t.getFilter()[1],onFilter:e=>{t.onFilter(e),r(!1)},onReset:s,baseStartDate:t.baseStartDate,baseEndDate:t.baseEndDate}):e("div",{children:"FILTER"})},placement:"bottom",triggerOn:De.CLICK,offset:4,children:e("div",{className:me("tool jk-row jk-br-ie",{"bc-at-lt cr-at-it active":n,"cr-hd":!n,visible:i}),children:e(We,{size:"small"})})})},Ut=a=>{const{header:i,width:r,left:s,position:n,onResizeStart:o,loading:l,withTools:d,withRightBorder:c,borderTopLeftRadius:h,borderTopRightRadius:p,borderBottomLeftRadius:m,borderBottomRightRadius:u}=a,{index:g,filter:f,sort:y,sticky:w,headClassName:v}=i,{onSort:b,getOrder:k}=y||{},x=k?.();return e("div",{style:{width:r,minWidth:r,left:w?s:void 0,top:0,zIndex:w?3:2,borderTopLeftRadius:h?"var(--border-radius-inline)":void 0,borderTopRightRadius:p?"var(--border-radius-inline)":void 0,borderBottomLeftRadius:m?"var(--border-radius-inline)":void 0,borderBottomRightRadius:u?"var(--border-radius-inline)":void 0},className:me({"with-right-border":c},"sticky jk-table-row-head"),"data-testid":g+"_head",children:t("div",{className:me("jk-row nowrap jk-table-head-cell jk-pg-sm",{"with-sort":!!y,"with-filter":!!f?.onFilter,sticky:!!w}),style:{width:r,...i.style},children:[e("div",{className:"jk-table-head-field flex-1 ht-100",children:Rt({header:i,columnIndex:g,className:v})}),d&&t("div",{className:"jk-row jk-table-head-tools",children:[y&&e("div",{className:me("tool jk-row jk-br-ie",{"bc-at-lt cr-at-it active":!!x,"cr-hd":!x}),onClick:()=>b({columnIndex:g}),children:x?e(x>0?Ve:Ce,{size:"small"}):e(Me,{up:!0,down:!0,size:"small"})}),f?.onFilter&&e(qt,{columnIndex:g,filter:f,disabled:l})]}),d&&o&&e("div",{className:"jk-table-head-drag",onMouseDown:e=>{e.preventDefault(),o(n,e.clientX)},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e("div",{})})]})})},_t=i(a=>{const{columns:i,topHeaders:r,rightBorders:s,loading:n,gap:o,hasScrollTop:l,onResizeStart:d}=a,c=!!s.length;return t("div",{className:"jk-table-head-container",style:{paddingBottom:o},children:[c&&e("div",{className:me("jk-table-head",{"elevation-1":l}),style:{width:Ue},children:r.map(({header:t,positions:a},i)=>e(Ut,{header:t,width:1===a.length?Ye(a[0]):`calc(${a.map(Ye).join(" + ")})`,left:qe(a[0]),position:a[0],loading:n,withTools:!1,withRightBorder:!(""===t.head&&""===r[i+1]?.header.head)&&i!==r.length-1,borderTopLeftRadius:0===i,borderTopRightRadius:i===r.length-1},t.headIndex))}),e("div",{className:me("jk-table-head jk-br-ie",{"elevation-1":l}),style:{width:Ue},children:i.map((t,a)=>e(Ut,{header:t,width:Ye(a),left:qe(a),position:a,onResizeStart:d,loading:n,withTools:!0,withRightBorder:!1,borderTopLeftRadius:!c&&0===a,borderTopRightRadius:!c&&a===r.length-1,borderBottomLeftRadius:0===a,borderBottomRightRadius:a===i.length-1},t.headIndex))})]})});const Gt=i(function(t){const{data:a,index:i,rowKey:r,start:s,size:n,gap:o,columns:l,rightBorders:d,getRecordStyle:c,getRecordClassName:h,onRecordClick:p,onRecordHover:m,animate:u}=t,g=a[i],f={...c?.({data:a,index:i,isCard:!1,isStickySection:!1})||{},position:"absolute",top:s+o,left:0,width:Ue,height:n-2*o+"px"},y=me("jk-table-row",h?.({data:a,index:i,isCard:!1,isStickySection:!0})||""),w=p?()=>p({data:a,index:i,isCard:!1}):void 0,v=m?()=>m({data:a,index:i,isCard:!1}):void 0,b=l.map(({Field:t,index:a,sticky:s},n)=>e("div",{style:{width:Ye(n),minWidth:Ye(n),left:s?qe(n):void 0},className:me({sticky:!!s,"with-right-border":d.has(n)},"jk-table-row-field bc-sf-md"),"data-testid":r+"_"+a,children:g&&e(t,{record:g,columnIndex:a,recordIndex:i,isCard:!1})},a));return u?e(Pe.div,{"jk-data-virtual-row-key":r,layoutId:String(r),layoutDependency:a,style:f,className:y,onClick:w,onMouseEnter:v,children:b}):e("div",{"jk-data-virtual-row-key":r,style:f,className:y,onClick:w,onMouseEnter:v,children:b})}),Xt={top:!1,bottom:!1,left:!1,right:!1};const Zt=a=>{const{data:i,headers:c,rowHeight:h,getRecordStyle:p,getRecordClassName:m,getRecordKey:u,onRecordClick:g,onRecordHover:f,gap:y,loading:w,availableWidth:v,groups:b,virtualizerOverscan:k,focusRowKey:x}=a,N=r(null),R=d(),j=!!u,S=J(i),D=J(u),C=Ee({count:i.length,estimateSize:o(()=>h+2*y,[h,y]),overscan:k,getScrollElement:o(()=>N.current,[]),getItemKey:o(e=>{const t=D.current;return t?t({data:S.current,index:e}):e},[S,D])}),F=n(()=>c.filter(e=>e.visible?.getVisible?.()),[c]);l(()=>{const e=D.current;if(!x||!e)return;const t=S.current.findIndex((t,a)=>e({data:S.current,index:a})===x);t<0||C.scrollToIndex(t,{align:"center",behavior:"smooth"})},[S,x,D,C]);const O=C.getTotalSize(),I=C.getVirtualItems(),{topHeaders:T,rightBorders:z}=n(()=>{const e=new Map(b.map(e=>[e.value,e])),t=[],a=[];return F.forEach((i,r)=>{var s;const n=void 0!==i.group?e.get(i.group):void 0,o=t[t.length-1];n?(o?.header.group===n.value?(o.positions.push(r),(s=o.header).sticky&&(s.sticky=i.sticky)):(a.length&&""!==o?.header.head||a.push(r-1),a.push(r),t.push({header:{...i,head:n.label,style:n.style},positions:[r]})),a[a.length-1]=r):t.push({header:{...i,head:"",style:{}},positions:[r]})}),{topHeaders:t,rightBorders:a}},[b,F]),[P,L]=s({}),E=n(()=>((e,t,a)=>{const i=e.reduce((e,t)=>e+Qe(t),0),r=t>i?t-i:0,s=e.map(e=>{const t=a[e.index];if(void 0!==t)return t;const s=Qe(e);return Math.floor(s+(i?r*(s/i):0))});return _e(e,s)})(F,v,P),[F,v,P]),V=n(()=>(e=>Object.fromEntries(Ge(e)))(E),[E]),M=E.total,W=E.stickyWidth,H=J(E),A=J(F),K=o((e,t)=>{const a=N.current,i=A.current[e];if(!a||!i)return;const r=H.current,s=A.current,n=Qe(i);let o=r;const l=i=>{const l=Math.max((r.widths[e]??n)+i.clientX-t,n);l!==o.widths[e]&&(o=((e,t,a,i)=>{const r=[...e.widths];return r[a]=i,_e(t,r)})(r,s,e,l),((e,t)=>{for(const[a,i]of Ge(t))e.style.setProperty(a,i)})(a,o))},d=()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",d),o!==r&&L(t=>({...t,[i.index]:o.widths[e]}))};window.addEventListener("mousemove",l),window.addEventListener("mouseup",d)},[H,A]),$=n(()=>new Set(z),[z]),{top:B,bottom:Q,left:Y,right:q}=function(e,t){const[a,i]=s(Xt);return l(()=>{const t=e.current;if(!t)return;let a=0;const r=()=>{a=0;const{scrollTop:e,scrollLeft:r,clientHeight:s,clientWidth:n,scrollHeight:o,scrollWidth:l}=t,d={top:e>0,bottom:e+s<o-1,left:r>0,right:l-n-r>1};i(e=>e.top===d.top&&e.bottom===d.bottom&&e.left===d.left&&e.right===d.right?e:d)},s=()=>{a||(a=requestAnimationFrame(r))};s(),t.addEventListener("scroll",s,{passive:!0});const n="undefined"!=typeof ResizeObserver?new ResizeObserver(s):null;return n?.observe(t),()=>{t.removeEventListener("scroll",s),n?.disconnect(),a&&cancelAnimationFrame(a)}},[e,...t]),a}(N,[O,M]),U=B||Q;return t("div",{ref:N,style:{...V,height:"100%",overflow:"scroll"},className:"jk-table-rows-container",children:[e(_t,{columns:F,topHeaders:T,rightBorders:z,loading:w,gap:y,hasScrollTop:B,onResizeStart:K}),Y&&e("div",{className:"expand-absolute pe-ne",style:{width:W,zIndex:3,background:"transparent",boxShadow:"0 0px 4px 0 var(--cr-ht), 0 0px 4px 1px var(--cr-ht)"}}),q&&e("div",{className:"expand-absolute pe-ne",style:{width:U?16:2,left:"unset",right:U?-8:-1,zIndex:3,background:"transparent",boxShadow:"0 0px 4px 0 var(--cr-ht), 0 0px 4px 1px var(--cr-ht)"}}),Q&&e("div",{className:"expand-absolute pe-ne",style:{height:1,top:"unset",bottom:-1,zIndex:3,background:"transparent",boxShadow:"0 0px 4px 0 var(--cr-ht), 0 0px 4px 1px var(--cr-ht)"}}),t("div",{className:"jk-table-rows-box",style:{height:O},children:[!i.length&&e("div",{style:{position:"absolute",top:0,left:0,width:M,height:"1px",transform:"translateY(0px)"},className:"jk-table-row",children:F.map(({index:t,sticky:a},i)=>e("div",{style:{width:Ye(i),minWidth:Ye(i)},className:me({sticky:!!a})},t))}),e(Le,{id:R,children:I.map(t=>e(Gt,{rowKey:t.key,data:i,index:t.index,start:t.start,size:t.size,gap:y,columns:F,rightBorders:$,getRecordStyle:p,getRecordClassName:m,onRecordClick:g,onRecordHover:f,animate:j},t.key))})]})]})},ea=t=>{const{headers:a,viewContainerWidth:i,rowHeight:r,loading:s,data:n,getRecordKey:o,getRecordStyle:l,getRecordClassName:d,onRecordClick:c,onRecordHover:p,groups:m,virtualizerOverscan:u,focusRowKey:g}=t;return e(Zt,{data:n,headers:a,rowHeight:r,getRecordKey:o,getRecordClassName:d,getRecordStyle:l,onRecordClick:c,onRecordHover:p,gap:4,loading:s,availableWidth:Math.max((i||0)-h,0),groups:m,virtualizerOverscan:u,focusRowKey:g})},ta=({header:a,columnIndex:i,onSort:r,order:s})=>t("div",{className:"jk-row space-between",children:[e("div",{className:"jk-row gap",children:e("div",{className:"fw-bd",children:Rt({header:a,columnIndex:i})})}),r?t("div",{className:me("jk-row nowrap jk-tag tx-s cr-pr",{"bc-at-lt cr-at-it":!!s,"bc-ht-lt":!s}),onClick:()=>r({columnIndex:i}),children:[e(A,{className:"tt-se",children:"sort"})," ",e(0===s?Me:s>0?Ve:Ce,{})]}):e("div",{})]}),aa=i=>{const{headers:r,isOpen:n,onClose:o,onFilter:d,onResetFilters:c}=i,[h,p]=s({}),[m,u]=s({}),[f,y]=s(!1),w=e=>Object.values(e).map(e=>Array.isArray(e)?e.map(e=>e?.value||e):e);l(()=>{if(!n)return;const{filtered:e,values:t}=Ot(r);p(w(t)),u(t),y(e)},[r,n]);const v=Q(e=>e.i18n.t);return e(Y,{isOpen:n,onClose:o,closeWhenKeyEscape:!0,closeWhenClickOutside:!0,children:t("div",{className:"jk-drawer-filters jk-col nowrap extend stretch",children:[t("div",{className:"jk-row left gap title cr-tx-ht jk-pg-sm",children:[e("div",{className:me({active:!0},"jk-row"),children:e(We,{})}),e(A,{children:"order and filters"})]}),e("div",{className:"jk-col top nowrap stretch space-between filter-drawer-columns flex-1",children:r.map((i,r)=>{const{index:s,filter:n,sort:{onSort:o,getOrder:l=()=>0}={}}=i;let d=null;if(bt(n))d=e($,{onChange:e=>u(t=>({...t,[s]:e})),value:m[s]||"",expand:!0,placeholder:ye(v("search..."))});else if(kt(n))d=e(K,{options:n.options,selectedOptions:m[s]||[],onSelectOptions:e=>u(t=>({...t,[s]:e}))});else if(xt(n))d=e(W,{type:n.pickerType,date:g(m[s])?m[s]:null,onDatePick:e=>u(t=>({...t,[s]:e})),onDateClean:()=>u(e=>({...e,[s]:""})),isDisabled:n.isDisabled,isSelected:jt(m[s]),baseDate:n.baseDate,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===n.pickerType||"year-month-day-hours-minutes-seconds"===n.pickerType||"year-month-day-hours-minutes"===n.pickerType||"year-month-day-hours"===n.pickerType});else if(Nt(n)){const[i,r]=Array.isArray(m?.[s])?m?.[s]:[null,null];d=t(a,{children:[t("div",{children:[t("div",{className:"jk-row left fw-bd",children:[e(A,{className:"tt-se",children:"from"})," :"]}),e(W,{type:n.pickerType,date:i,onDatePick:e=>{r&&g(r)?u(t=>({...t,[s]:[e,r]})):u(t=>({...t,[s]:[e,e]}))},onDateClean:()=>u(e=>({...e,[s]:""})),isDisabled:Ct(n.isDisabled,Ft(r)),isSelected:Ct(jt(i),St(i,r)),baseDate:n.baseStartDate,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===n.pickerType||"year-month-day-hours-minutes-seconds"===n.pickerType||"year-month-day-hours-minutes"===n.pickerType||"year-month-day-hours"===n.pickerType})]}),t("div",{children:[t("div",{className:"jk-row left fw-bd",children:[e(A,{className:"tt-se",children:"to"})," :"]}),e(W,{type:n.pickerType,date:r,onDatePick:e=>{i&&g(i)?u(t=>({...t,[s]:[i,e]})):u(t=>({...t,[s]:[e,e]}))},onDateClean:()=>u(e=>({...e,[s]:""})),isDisabled:Ct(n.isDisabled,Dt(i)),isSelected:Ct(jt(r),St(i,r)),baseDate:n.baseEndDate,twoLines:"year-month-day-hours-minutes-seconds-milliseconds"===n.pickerType||"year-month-day-hours-minutes-seconds"===n.pickerType||"year-month-day-hours-minutes"===n.pickerType||"year-month-day-hours"===n.pickerType})]})]})}return t("div",{className:"jk-col gap stretch jk-pg-sm-trl jk-pg-b",style:r?{borderTop:"1px solid var(--cr-ht)"}:{},children:[e(ta,{header:i,columnIndex:s,onSort:o,order:l()}),d]},s)})}),t("div",{className:"jk-row-col space-between gap block jk-pg-sm filter-drawer-buttons",children:[e(H,{type:"secondary",size:"small",onClick:()=>{c(),o()},disabled:!f,children:e(A,{className:"tt-se",children:"reset all filters"})}),e(H,{size:"small",onClick:()=>{d(m),o()},disabled:JSON.stringify(w(m))===JSON.stringify(h),children:e(A,{className:"tt-se",children:"apply filters"})})]})]})})},ia=e=>me({"bc-at-lt cr-at-it":e,"bc-sf-md":!e,active:e},"jk-row jk-data-viewer-tools-filter jk-br-ie cr-pr jk-row nowrap"),ra=({Icon:a,active:i,onClick:r,tooltipContent:s,className:n="",children:o,rotate:l,disabled:d=!1})=>t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":s,className:me(ia(!!i),n,{disabled:d}),onClick:r,children:[e(a,{className:"jk-br-ie",size:"small",rotate:l}),o]}),sa=i(i=>{const{extraNodes:n,setViewMode:d,headers:c,toolbarRef:h,viewMode:m,dataLength:u,rowsView:g,cardsView:f,loading:y,initializing:w,onReload:v,onAllFilters:b,pagination:k,extraNodesFloating:x,showFilterDrawerKey:N,filterKey:R,filters:j,downloads:S,requestProps:D}=i,{filtered:C,values:F}=Ot(c),[O,I]=s(!1),T=q(e=>e.viewPort.isSmallScreen),{notifyResponse:z}=U(),P=_(e=>e.searchParams.get(N)),L=r(void 0),[E,V]=G(N,"open"===P?"open":"close"),M=o(e=>{V(e?"open":"close")},[V]),W=!(T&&(!g||!f)),H=!!c.filter(e=>e.filter||e.sort).length;l(()=>{y?L.current?.(Re.LOADING):L.current?.(Re.NONE)},[y]);const A="open"===E,[K,$]=s(A);A&&!K&&$(!0);new URL(ue()&&window.location?.href||"").searchParams.set(R,JSON.stringify(j));const J=c.filter(e=>e.visible?.getVisible()).length;return t("div",{className:me("jk-data-viewer-toolbar with-vertical-scroll pn-re jk-row space-between nowrap jk-br-ie jk-pg-xsm-rl",m.toLowerCase()),ref:h,children:[K&&e(aa,{isOpen:A,headers:c,onClose:()=>M(!1),onFilter:e=>b(e),onResetFilters:()=>b({})}),!T&&e("div",{className:"jk-table-view-extra-nodes jk-row left gap",children:n.map(we)}),t("div",{className:"jk-table-view-tools jk-br-ie jk-pg-xsm-tb jk-row-col gap stretch",children:[t("div",{className:"jk-row nowrap gap",children:[v&&e(ra,{Icon:y?Fe:Oe,tooltipContent:y?"reloading data":"reload data",active:y,onClick:v,className:"jk-input-select"},"reload-button-icon"),k.withPagination&&e(X,{dataLength:u,loading:y,initializing:w,pageSizeOptions:T?[20]:k.pageSizeOptions,total:k.total,page:k.page,pageSize:k.pageSize,jumpToPage:k.jumpToPage,onPageSizeChange:k.onPageSizeChange,isOnToolbar:!0},"first-row-pagination")]}),t("div",{className:"jk-row nowrap gap",children:[H&&e(ra,{Icon:We,tooltipContent:"open filters",onClick:()=>M(!0),active:C,className:"jk-input-select",children:!!Object.values(F).length&&t(a,{children:[" ",e("span",{className:"bc-ht-lt jk-br-ie",style:{lineHeight:1,padding:"0 4px"},children:Object.values(F).length})," "]})}),!!S.length&&e(Z,{options:S,onChange:async({value:e})=>{I(!0);const t=S.find(t=>e===t.value),a=t?.getUrl(D)??"",i=t?.getFilename(D)??"",r=ve(await be(a));r.success&&(await ge(r.content.urlExportedFile,i),z(r)),I(!1)},selectedOption:{value:""},style:{width:"auto"},children:e(ra,{Icon:O?Fe:Ie,tooltipContent:O?"downloading":"download",className:"jk-input-select",onClick:O?e=>e.stopPropagation():void 0})}),e(ee,{options:c.map(e=>({label:Rt({header:e,columnIndex:e.index}),value:e.index})),selectedOptions:c.filter(({visible:e})=>e?.getVisible?.()).map(({index:e})=>({value:e})),containerWidth:"child",onChange:(e,t)=>{const a=c.find(e=>e.index===t?.value);a?.visible.onToggle()},className:"bc-sf-md",children:e(ra,{Icon:He,tooltipContent:"visibility of columns",className:"jk-input-select",active:J!==c.length,children:t(a,{children:[" ",t("span",{className:"bc-ht-lt jk-br-ie ws-np",style:{lineHeight:1,padding:"0 4px"},children:[J," / ",c.length]})," "]})})}),W&&(g||f)&&t(a,{children:[e("div",{className:"jk-divider horizontal"}),t("div",{className:me("jk-row nowrap jk-table-view-tools-view-mode",{rowsView:g,cardsView:f}),children:[g&&e(ra,{Icon:Ae,tooltipContent:"list view",className:"rows",active:m===p.ROWS,onClick:()=>d(p.ROWS,!0),rotate:90}),f&&e(ra,{Icon:Te,tooltipContent:"cards view","data-tooltip-place":"top-end",className:"cards",active:m===p.CARDS,onClick:()=>d(p.CARDS,!0)})]})]}),!!n.length&&T&&!x&&t(a,{children:[e("div",{className:"jk-divider horizontal"}),e("div",{children:e(B,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:e("div",{className:"jk-pg-sm jk-col stretch gap",children:n.map(we)}),triggerOn:De.CLICK,placement:"bottom",children:e("div",{className:"jk-row",children:e(Ke,{})})})})]})]})]})]})}),na=a=>{const{viewPortSize:i,cards:{height:s=300,width:n=256,expanded:o=!1}={height:300,width:256,expanded:!1},cardsView:l,data:d,extraNodes:m,headers:u,loading:g,initializing:f,onAllFilters:y,onReload:w,rows:{height:v=56}={height:56},rowsView:b,viewMode:k,setViewMode:x,getRecordKey:N,pagination:R,getRecordStyle:j,getRecordClassName:S,onRecordClick:D,onRecordHover:C,extraNodesFloating:F=!1,showFilterDrawerKey:O,filterKey:I,filters:T,groups:z,downloads:P,requestProps:L,virtualizerOverscan:E,focusRowKey:V}=a,{width:M,ref:W}=te(),H=r(null),{height:K=0}=te({targetRef:H}),$="sm"===i;return t("div",{className:"jk-data-viewer-content jk-br-ie",style:{"--jk-table-toolbar-height":K+"px",position:"relative"},children:[e(sa,{setViewMode:x,extraNodes:m,headers:u,toolbarRef:H,dataLength:d.length,viewMode:k,rowsView:b,cardsView:l,loading:g,initializing:f,onReload:w,onAllFilters:y,pagination:R,extraNodesFloating:F,showFilterDrawerKey:O,filterKey:I,filters:T,downloads:P,requestProps:L}),F&&$&&e("div",{className:"jk-col gap nowrap",style:{position:"absolute",bottom:"var(--pad-t)",right:"var(--pad-t)",zIndex:1},children:c.toArray(m.map((e,t)=>we(e,t)))}),t("div",{className:me("jk-view-container",k.toLowerCase()),ref:W,children:[d.length>0&&g&&e(ze,{}),t("div",{className:me("jk-data-viewer-body",k.toLowerCase()),style:{width:M||0},children:[0===d.length&&g&&e("div",{className:"jk-row center expand-absolute pe-ne",style:{height:"100%"},children:t("div",{className:"jk-row",style:{alignItems:"baseline"},children:[e(A,{className:"tt-se",children:"loading data"})," ",e("div",{className:"dot-flashing"})]})}),k===p.ROWS?e(ea,{headers:u,viewContainerWidth:M||0,rowHeight:v,data:d,loading:g,getRecordKey:N,getRecordStyle:j,getRecordClassName:S,onRecordClick:D,onRecordHover:C,groups:z,virtualizerOverscan:E,focusRowKey:V}):e(Je,{headers:u,data:d,cardHeight:s,cardWidth:n,rowWidth:(M||0)-h,getRecordClassName:S,getRecordStyle:j,onRecordClick:D,onRecordHover:C,expandedCards:o})]})]})]})},oa=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function la(t){const{cards:a,cardsView:i=!0,className:d="",data:c,extraNodes:h,headers:f,initialViewMode:j,name:S="",requestRef:D,rows:C,rowsView:F=!0,totalData:O,pageSizeOptions:I,getRecordKey:T,getPageQueryParam:z=It,getPageSizeQueryParam:P=Tt,getSortQueryParam:L=zt,getFilterQueryParam:E=Pt,getViewModeQueryParam:V=Lt,getShowFilterDrawerQueryParam:M=Et,getVisiblesQueryParam:W=Vt,getRecordStyle:H,getRecordClassName:A,onRecordClick:K,onRecordHover:$,extraNodesFloating:B,setLoaderStatusRef:Y,setDataTableRef:U,initializing:X=!1,downloads:Z,groups:ee,deps:te=[],virtualizerOverscan:ue=4,focusRowKey:ge}=t,fe=q(e=>e.viewPort.screen),ye=ae(e=>e.user.settings[m.DATA_VIEW_MODE]),we=Q(e=>e.i18n.t),ve=z(S),be=P(S),De=L(S),Ce=E(S),Fe=V(S),Oe=M(S),Ie=W(S),Te=_(e=>e.searchParams.get(De)),ze=_(e=>e.searchParams.get(Ie)),Pe=_(e=>e.searchParams.get(Ce)),Le=_(e=>e.searchParams.get(ve)),Ee=_(e=>e.searchParams.get(be)),Ve=_(e=>e.searchParams.get(Fe)),Me=!!I,[We,He]=s(Re.LOADING),Ae=We===Re.LOADING||X,Ke=Te,[$e,Be,Je]=G(De,Ke),Qe=J($e),[Ye,qe]=G(Ie,ze,Ne(f.map(({index:e})=>e))),Ue=Pe||"",[_e,Ge,bt]=G(Ce,je(Ue)?Ue:null),kt=n(()=>{const e=je(_e)?JSON.parse(_e):{},t={};for(const a of f)t[a.index]=e[a.index];return t},[_e,f]),xt=J(kt),Nt=JSON.stringify(I??[25,50,100]),Rt=n(()=>JSON.parse(Nt),[Nt]),[jt,St]=G(ve,Le),Dt=+jt||1,[Ct,Ft]=G(be,Ee),Ot=+Ct||Rt[0],Mt=n(()=>{const e={},t=f.find(({index:e})=>e===$e||"-"+e===$e);return t?.sort&&(e[t.index]=t.index===$e?1:-1),JSON.stringify({sort:e,filter:kt,pagination:Me?{page:Dt,pageSize:Ot}:{page:0,pageSize:0}})},[kt,f,Dt,Ot,$e,Me]),Bt=n(()=>JSON.parse(Mt),[Mt]),Jt=JSON.stringify(te),Qt=J(D),Yt=o(()=>Qt.current?.(Bt),[Qt,Bt]);l(()=>{Yt()},[Yt,Jt]);const qt=n(()=>((e,t,a,i)=>{let r=[...e];for(const e of t){const t=e.index;if(a[t]){const i=e.index;if(dt(e?.filter))r=r.filter(e.filter.callbackFn({columnIndex:e.index,text:a[t]}));else if(ct(e?.filter)){const s=new RegExp(oa(a[t]),"i");r=r.filter(t=>{if(ct(e?.filter)){const a=e.filter.getValue?e.filter.getValue({record:t}):i in t?t[i]:null;return"string"==typeof a&&s.test(a)}return!1})}else if(pt(e?.filter)){const i=xe(a[t]).map(t=>{if(pt(e?.filter))return e.filter.options.find(({value:e})=>e===t)}).filter(Boolean);r=r.filter(e.filter.callbackFn({columnIndex:e.index,selectedOptions:i}))}else if(mt(e?.filter)){const s=xe(a[t]).map(t=>{if(mt(e?.filter))return e.filter.options.find(({value:e})=>e===t)}).filter(Boolean);r=r.filter(t=>{if(mt(e?.filter)){const a=e.filter.getValue?e.filter.getValue({record:t}):i in t?t[i]:null;return!!s.find(e=>e.value===a)}return!1})}else if(gt(e?.filter))r=r.filter(e.filter.callbackFn({columnIndex:e.index,selectedDate:new Date(+a[t])}));else if(ft(e?.filter)){const{showYears:s,showMonths:n,showDays:o,showHours:l,showMinutes:d,showSeconds:c,showMilliseconds:h}=ke(e.filter.pickerType||Ht);if(a[t]&&g(new Date(+a[t]))){const p=new Date(+a[t]);r=r.filter(t=>{if(ft(e?.filter)){const a=e.filter.getValue?e.filter.getValue({record:t}):i in t?t[i]:null;if(a instanceof Date&&g(a)){if(h)return y(p,a);if(c)return w(p,a);if(d)return v(p,a);if(l)return b(p,a);if(o)return k(p,a);if(n)return x(p,a);if(s)return N(p,a)}else Se("datum no filtered",{datum:t,searchDate:p,index:e.index,head:e})}return!0})}else Se("data no filtered, filter not a valid time date",{search:a[t],searchFilter:a})}else if(wt(e?.filter)){const[i,s]=xe(a[t]);i&&g(new Date(+i))&&s&&g(new Date(+s))?r=r.filter(e.filter.callbackFn({columnIndex:e.index,startSelectedDate:new Date(+i),endSelectedDate:new Date(+s)})):Se("data no filtered, filter not a valid range times date",{search:a[t],searchFilter:a})}else if(vt(e?.filter)){const[s,n]=xe(a[t]);if(s&&g(new Date(+s))&&n&&g(new Date(+n))){const t=new Date(+s),a=new Date(+n),{showMonths:o,showDays:l,showHours:d,showMinutes:c,showSeconds:h,showMilliseconds:p}=ke(e.filter.pickerType||Ht);r=r.filter(r=>{if(vt(e?.filter)){const s=e.filter.getValue?e.filter.getValue({record:r}):i in r?r[i]:null;if(s instanceof Date&&g(s)){let e=t.getFullYear()<=s.getFullYear()&&s.getFullYear()<=a.getFullYear();return o&&(e=e&&R(s,{start:re(t),end:ie(a)})),l&&(e=e&&R(s,{start:ne(t),end:se(a)})),d&&(e=e&&R(s,{start:le(t),end:oe(a)})),c&&(e=e&&R(s,{start:ce(t),end:de(a)})),h&&(e=e&&R(s,{start:pe(t),end:he(a)})),p&&(e=R(s,{start:t,end:a})),e}Se("datum no filtered",{datum:r,startSelectedDate:t,endSelectedDate:a,index:e.index,head:e})}return!0})}else Se("data no filtered, filter not a valid range times date",{search:a[t],searchFilter:a})}}}const s=r.length!==e.length;let n=!1;for(const e of xe(i)){const a=t.find(({index:t})=>t===e||"-"+t===e);a?.sort&&nt(a?.sort)&&(a.index===e?(r.sort(a.sort.compareFn({columnIndex:a.index})),n=!0):"-"+a.index===e&&(r.sort((e,t)=>nt(a?.sort)?-1*a.sort.compareFn({columnIndex:a.index})(e,t):0),n=!0))}return s||n?r:e})(c,f,kt,$e),[c,f,kt,$e]),Ut=J(U);l(()=>{Ut.current?.(qt)},[qt,Ut]);const _t=J(Y);l(()=>{_t.current?.(e=>{He("function"==typeof e?t=>e(t):e)})},[_t]);const Gt=n(()=>((e,t,a,i,r,s,n,o,l,d)=>(e=>{let t=0;const a=[...e];return e.forEach((e,i)=>{e.visible?.getVisible()&&(a[i]={...e,accumulatedWidth:t},t+=e.width)}),a})(e.map(({sort:e,filter:c,...h},p)=>{const m=()=>xe(t).includes(h.index),u={...h,minWidth:h.minWidth??0,width:0,accumulatedWidth:0,headIndex:p,visible:{getVisible:m,onToggle(){const e=m();s(Ne(e?xe(t).filter(e=>e!==h.index):[...xe(t),h.index]))}}},f=h.index;let y=c?28:0;if(e){y+=28;const t=h.index,a="-"+h.index,i=()=>xe(r.current).includes(t)?1:xe(r.current).includes(a)?-1:0;u.sort={getOrder:i,onSort:()=>{const e=1===i()?a:-1===i()?"":t;e?n(e):o()},online:ot(e)}}c?.type===Xe||c?.type===Ze?u.filter={type:Xe,onFilter:({text:e})=>$t(f,e,i,l,d),onReset:Kt(f,i,l,d),getFilter:()=>i.current[f]||"",online:lt(c)}:c?.type===et||c?.type===tt?u.filter={type:et,onFilter:({selectedOptions:e})=>{$t(f,Ne(e.filter(({value:e})=>!!c.options.find(t=>t.value===e)).map(({value:e})=>e)),i,l,d)},onReset:Kt(f,i,l,d),options:c.options,getFilter:()=>i.current[f]?xe(i.current[f]).map(e=>({value:e,label:""})):[],online:ht(c)}:c?.type===at||c?.type===it?u.filter={type:at,pickerType:c.pickerType||Ht,onFilter:({selectedDate:e})=>$t(f,e.getTime()+"",i,l,d),isDisabled:c.isDisabled||(()=>({})),onReset:Kt(f,i,l,d),getFilter:()=>i.current[f]&&g(new Date(+i.current[f]))?new Date(+i.current[f]):null,baseDate:c.baseDate||new Date,online:ut(c)}:c?.type!==rt&&c?.type!==st||(u.filter={type:rt,pickerType:c.pickerType||Ht,onFilter:({startSelectedDate:e,endSelectedDate:t})=>$t(f,Ne([e.getTime()+"",t.getTime()+""]),i,l,d),onReset:Kt(f,i,l,d),isDisabled:c.isDisabled||(()=>({})),getFilter:()=>{const[e,t]=i.current[f]?xe(i.current[f]):[];return[e&&g(new Date(+e))?new Date(+e):null,t&&g(new Date(+t))?new Date(+t):null]},baseStartDate:c.baseStartDate||new Date,baseEndDate:c.baseEndDate||new Date,online:yt(c)});const w=h.head||h.index;if("string"==typeof w){const e=Math.ceil(Wt(a(w.toUpperCase()),"400 14px / 14px Inter, sans-serif"))+4;u.minWidth=Math.max(h.minWidth||0,y+e+16+4)}return u})))(f,Ye,we,xt,Qe,qe,Be,Je,Ge,bt),[bt,Je,f,Ge,Be,we,xt,Qe,qe,Ye,$e,_e]),Xt=o(e=>{const t={...kt};f.forEach(({filter:a,index:i})=>{const r=e[i];if(a?.type===Xe||a?.type===Ze)t[i]=r;else if(a?.type===et||a?.type===tt)t[i]=Ne((e[i]||[]).filter(({value:e})=>!!a.options.find(t=>t.value===e)).map(({value:e})=>e));else if(a?.type===at||a?.type===it)e[i]instanceof Date?t[i]=e[i].getTime()+"":t[i]="";else if(a?.type===rt||a?.type===st){const[a,r]=e[i]?e[i]:[null,null];g(a)&&g(r)?t[i]=Ne([a.getTime()+"",r.getTime()+""]):t[i]=""}}),At(t)?Ge(JSON.stringify(t)):bt()},[bt,f,kt,Ge]),Zt=j||(ye===p.CARDS?p.CARDS:p.ROWS),[ea,ta]=G(Fe,Ve?Ve.toUpperCase()===p.CARDS?p.CARDS:p.ROWS:Zt);l(()=>{!i&&F?ta(p.ROWS):!F&&i&&ta(p.CARDS)},[i,F,ta]);const aa=r("");l(()=>{aa.current!==fe&&i&&"sm"===fe&&ta(p.CARDS),aa.current=fe},[fe,i,F,ta]);const ia=O??c.length,ra=n(()=>({withPagination:Me,total:ia,pageSizeOptions:Rt,page:Dt,pageSize:Ot,jumpToPage:St,onPageSizeChange:Ft}),[Me,ia,Rt,Dt,Ot,St,Ft]),sa=n(()=>(h||[]).filter(Boolean),[h]);return e("div",{className:me(d,"jk-data-viewer-layout ht-100",{"with-pagination":Me}),children:e(na,{viewPortSize:fe,cards:a,data:qt,extraNodes:sa,extraNodesFloating:B,headers:Gt,groups:ee||u,loading:We===Re.LOADING,initializing:Ae,onAllFilters:Xt,onReload:Qt.current?Yt:null,rows:C,showFilterDrawerKey:Oe,rowsView:F,cardsView:i,setViewMode:ta,viewMode:ea,getRecordKey:T,getRecordStyle:H,getRecordClassName:A,onRecordClick:K,onRecordHover:$,pagination:ra,filterKey:Ce,filters:kt,downloads:Z??u,requestProps:Bt,virtualizerOverscan:ue,focusRowKey:ge})})}export{la as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i}from"react/jsx-runtime";import{AnimatePresence as o,motion as r}from"motion/react";import{memo as s,useRef as t}from"react";import{b as a,P as c,B as n}from"./index-
|
|
1
|
+
import{jsxs as e,jsx as i}from"react/jsx-runtime";import{AnimatePresence as o,motion as r}from"motion/react";import{memo as s,useRef as t}from"react";import{b as a,P as c,B as n}from"./index-Bz4iycQ-.js";import{c as m}from"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./enums.js";import{r as l}from"./websocket-B8ybpDXk.js";import"./index-Zvckkvpn.js";import{C as p}from"./LoaderLayer-CWElgcGs.js";import"./index-B8CE4gNp.js";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";const d=s(function(s){const{children:d,position:j="right",isOpen:y,onClose:f,closeWhenKeyEscape:v,closeWhenClickOutside:b,closeIcon:h}=s,k=t(null),u=()=>{y&&f?.(!1)};return a(e=>{v&&y&&"Escape"===e.code&&u()}),e(c,{children:[i(o,{children:y&&i(r.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"jk-drawer-overlay",onClick:b?u:void 0},"jk-drawer-overlay")}),i(o,{children:y&&e(r.div,{initial:{x:"100vw"},animate:{x:0,transition:{stiffness:0}},exit:{x:"100vw"},ref:k,className:m("jk-drawer-layout elevation-2",j,{open:y}),children:[void 0===h?i("div",{className:"jk-drawer-close-button",onClick:u,children:i(n,{icon:i(p,{}),type:"secondary"})}):l(h,{isOpen:y,close:u}),i("div",{className:"jk-drawer-body",children:d})]},"jk-drawer-layout")})]})},({isOpen:e},{isOpen:i})=>e===i&&!e);export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e,Fragment as a}from"react/jsx-runtime";import{Excalidraw as r,MainMenu as i}from"@excalidraw/excalidraw";import{useState as o,useEffect as n}from"react";import{T as s,r as c,s as l,B as d,P as p}from"./index-
|
|
1
|
+
import{jsxs as t,jsx as e,Fragment as a}from"react/jsx-runtime";import{Excalidraw as r,MainMenu as i}from"@excalidraw/excalidraw";import{useState as o,useEffect as n}from"react";import{T as s,r as c,s as l,B as d,P as p}from"./index-Bz4iycQ-.js";import"./settings-DzQM72QE.js";import"./enums.js";import"./index-Zvckkvpn.js";import{b as m}from"./LoaderLayer-CWElgcGs.js";import"motion/react";import"swr";import"./commons-C-9EFvh4.js";import"./websocket-B8ybpDXk.js";import"./index-B8CE4gNp.js";import"react-dom";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";const g="jk-excalidraw-data";function h(){const[h,b]=o(!1),[x,u]=o((()=>{const t=sessionStorage.getItem(g);if(t)try{const e=JSON.parse(t);return e?.viewBackgroundColor||"transparent"}catch(t){console.error("Failed to parse Excalidraw data:",t)}return"transparent"})()),[k,w]=o({elements:[],appState:{viewBackgroundColor:"transparent"}}),[y,f]=o(null);n(()=>{const t=sessionStorage.getItem(g);if(t)try{const e=JSON.parse(t);w({appState:{...e?.appState,collaborators:void 0},elements:e?.elements??[]})}catch(t){console.error("Failed to parse Excalidraw data:",t)}},[h]),n(()=>{y?.updateScene({appState:{viewBackgroundColor:x}})},[y,x]);const v=t("div",{className:"jk-col gap bc-sf-hi elevation-1 jk-br-ie",style:{padding:2},children:[e(s,{className:"tt-se tx-t",children:"background"}),e(c,{size:"tiny",leftLabel:e("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"white","data-tooltip-place":"bottom-end",className:"br-50-pc br-hl",style:{background:"white",width:12,height:12}}),rightLabel:e("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"transparent","data-tooltip-place":"bottom-end",className:"br-50-pc br-hl",style:{background:"white",width:12,height:12,backgroundImage:"linear-gradient(45deg, #ccc 25%, transparent 25%),linear-gradient(-45deg, #ccc 25%, transparent 25%),linear-gradient(45deg, transparent 75%, #ccc 75%),linear-gradient(-45deg, transparent 75%, #ccc 75%)",backgroundSize:"6px 6px",backgroundPosition:"0 0, 0 3px, 3px -3px, -3px 0px"}}),checked:"transparent"===x,onChange:()=>{u("transparent"===x?"#FFFFFF":"transparent")}})]});return t(a,{children:[h?e(l,{offset:8,className:"is-active right",icon:e(m,{}),size:"tiny",buttons:[{icon:e(m,{}),label:e(s,{className:"tt-se",children:"exit"}),size:"tiny",onClick:()=>b(!1)},{children:v}]}):e("div",{className:"jk-row right",children:e(d,{tooltipContent:"active excalidraw",type:"secondary",size:"tiny",icon:e(m,{}),onClick:()=>b(!0)})}),e(p,{children:h&&e("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",pointerEvents:h?void 0:"none",opacity:h?1:0,zIndex:"var(--zi-excalidraw)"},children:e(r,{excalidrawAPI:t=>f(t),initialData:k,onChange:(t,e)=>{const a={elements:t,appState:e,viewBackgroundColor:x};sessionStorage.setItem(g,JSON.stringify(a))},renderTopRightUI:()=>t("div",{className:"jk-row gap",style:{marginRight:16},children:[v,e(d,{size:"tiny",onClick:()=>b(!1),children:e(s,{className:"tt-se",children:"exit"})})]}),children:t(i,{children:[e(i.DefaultItems.Export,{}),e(i.DefaultItems.SaveAsImage,{}),e(i.DefaultItems.ToggleTheme,{})]})})})})]})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{i as r}from"./viz-BmmZnl4P.js";import{useRef as t,useEffect as i}from"react";import{k as o,l as s}from"./index-
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{i as r}from"./viz-BmmZnl4P.js";import{useRef as t,useEffect as i}from"react";import{k as o,l as s}from"./index-Bz4iycQ-.js";import{c as n}from"./commons-C-9EFvh4.js";import{c as a}from"./settings-DzQM72QE.js";import"./enums.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-B8ybpDXk.js";import"./index-B8CE4gNp.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";const m=o(e=>({shouldRerender:0,triggerRerender:()=>e(()=>({shouldRerender:Date.now()}))}));function c({dot:o,className:c}){const p=t(null),d=s(e=>e.i18n.t),l=m(e=>e.shouldRerender);return i(()=>{const e=p.current;e&&r().then(r=>{const t=e.getBoundingClientRect().height;e.innerHTML="",e.style.minHeight=t?`${t}px`:"";try{const t=r.renderSVGElement(o,{});e.appendChild(t),e.style.minHeight=""}catch(r){a("error on drawing Graphviz",r),e.innerHTML="",e.style.minHeight="";const t=document.createElement("div");t.textContent=d("error rendering graph")+`: ${r?.message||String(r)}`,t.style.color="red",t.style.whiteSpace="pre-wrap",e.appendChild(t)}})},[o,l,d]),e("div",{className:n("jk-graphviz-viewer-container",c),children:e("div",{className:"jk-graphviz-viewer",ref:p})})}export{c as default,m as useGraphvizStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import i,{PureComponent as n,createRef as r,useState as a,useRef as o,useEffect as h}from"react";import{u as s,v as d,w as l,T as c}from"./index-DjHFXv3v.js";import"./settings-DzQM72QE.js";import"./enums.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"motion/react";import"react-dom";import{i as p}from"./commons-C-9EFvh4.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.js";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";var w={x:0,y:0,width:0,height:0,unit:"px"},g=(e,t,i)=>Math.min(Math.max(e,t),i),m=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function u(e,t,i){return"%"===e.unit?{...w,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/i*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/i*100:0}}function y(e,t,i){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*i/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*i/100:0}:{...w,...e,unit:"px"}}function x(e,t,i,n,r,a=0,o=0,h=n,s=r){let d={...e},l=Math.min(a,n),c=Math.min(o,r),p=Math.min(h,n),w=Math.min(s,r);t&&(t>1?(l=o?o*t:l,c=l/t,p=h*t):(c=a?a/t:c,l=c*t,w=s/t)),d.y<0&&(d.height=Math.max(d.height+d.y,c),d.y=0),d.x<0&&(d.width=Math.max(d.width+d.x,l),d.x=0);let g=n-(d.x+d.width);g<0&&(d.x=Math.min(d.x,n-l),d.width+=g);let m=r-(d.y+d.height);if(m<0&&(d.y=Math.min(d.y,r-c),d.height+=m),d.width<l&&(("sw"===i||"nw"==i)&&(d.x-=l-d.width),d.width=l),d.height<c&&(("nw"===i||"ne"==i)&&(d.y-=c-d.height),d.height=c),d.width>p&&(("sw"===i||"nw"==i)&&(d.x-=p-d.width),d.width=p),d.height>w&&(("nw"===i||"ne"==i)&&(d.y-=w-d.height),d.height=w),t){let e=d.width/d.height;if(e<t){let e=Math.max(d.width/t,c);("nw"===i||"ne"==i)&&(d.y-=e-d.height),d.height=e}else if(e>t){let e=Math.max(d.height*t,l);("sw"===i||"nw"==i)&&(d.x-=e-d.width),d.width=e}}return d}var C={capture:!0,passive:!1},v=0,f=class e extends n{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=r();mediaRef=r();resizeObserver;initChangeCalled=!1;instanceId="rc-"+v++;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:i,width:n,height:r}=e.getBoundingClientRect();return{x:t,y:i,width:n,height:r}}componentDidUpdate(e){let{crop:t,onComplete:i}=this.props;if(i&&!e.crop&&t){let{width:e,height:n}=this.getBox();e&&n&&i(y(t,e,n),u(t,e,n))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,C),this.document.addEventListener("pointerup",this.onDocPointerDone,C),this.document.addEventListener("pointercancel",this.onDocPointerDone,C),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,C),this.document.removeEventListener("pointerup",this.onDocPointerDone,C),this.document.removeEventListener("pointercancel",this.onDocPointerDone,C),!1)}onCropPointerDown=e=>{let{crop:t,disabled:i}=this.props,n=this.getBox();if(!t)return;let r=y(t,n.width,n.height);if(i)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let a=e.target.dataset.ord,o=!!a,h=e.clientX,s=e.clientY,d=r.x,l=r.y;if(a){let t=e.clientX-n.x,i=e.clientY-n.y,o=0,c=0;"ne"===a||"e"==a?(o=t-(r.x+r.width),c=i-r.y,d=r.x,l=r.y+r.height):"se"===a||"s"===a?(o=t-(r.x+r.width),c=i-(r.y+r.height),d=r.x,l=r.y):"sw"===a||"w"==a?(o=t-r.x,c=i-(r.y+r.height),d=r.x+r.width,l=r.y):("nw"===a||"n"==a)&&(o=t-r.x,c=i-r.y,d=r.x+r.width,l=r.y+r.height),h=d+n.x+o,s=l+n.y+c}this.evData={startClientX:h,startClientY:s,startCropX:d,startCropY:l,clientX:e.clientX,clientY:e.clientY,isResize:o,ord:a},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:i,locked:n,keepSelection:r,onChange:a}=this.props,o=this.getBox();if(i||n||r&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.clientX-o.x,s=e.clientY-o.y,d={unit:"px",x:h,y:s,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:s,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,a(y(d,o.width,o.height),u(d,o.width,o.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let{crop:t,disabled:i,onChange:n,onDragStart:r}=this.props,a=this.getBox();if(i||!t||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,r&&r(e));let o,{evData:h}=this;h.clientX=e.clientX,h.clientY=e.clientY,o=h.isResize?this.resizeCrop():this.dragCrop(),m(t,o)||n(y(o,a.width,a.height),u(o,a.width,a.height))};onComponentKeyDown=t=>{let{crop:i,disabled:n,onChange:r,onComplete:a}=this.props;if(n)return;let o=t.key,h=!1;if(!i)return;let s=this.getBox(),d=this.makePixelCrop(s),l=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===o?(d.x-=l,h=!0):"ArrowRight"===o?(d.x+=l,h=!0):"ArrowUp"===o?(d.y-=l,h=!0):"ArrowDown"===o&&(d.y+=l,h=!0),h){t.cancelable&&t.preventDefault(),d.x=g(d.x,0,s.width-d.width),d.y=g(d.y,0,s.height-d.height);let e=y(d,s.width,s.height),i=u(d,s.width,s.height);r(e,i),a&&a(e,i)}};onHandlerKeyDown=(t,i)=>{let{aspect:n=0,crop:r,disabled:a,minWidth:o=0,minHeight:h=0,maxWidth:s,maxHeight:d,onChange:l,onComplete:c}=this.props,p=this.getBox();if(a||!r)return;if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let w=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,g=x(function(e,t,i,n){let r={...e};return"ArrowLeft"===t?"nw"===n?(r.x-=i,r.y-=i,r.width+=i,r.height+=i):"w"===n?(r.x-=i,r.width+=i):"sw"===n?(r.x-=i,r.width+=i,r.height+=i):"ne"===n?(r.y+=i,r.width-=i,r.height-=i):"e"===n?r.width-=i:"se"===n&&(r.width-=i,r.height-=i):"ArrowRight"===t&&("nw"===n?(r.x+=i,r.y+=i,r.width-=i,r.height-=i):"w"===n?(r.x+=i,r.width-=i):"sw"===n?(r.x+=i,r.width-=i,r.height-=i):"ne"===n?(r.y-=i,r.width+=i,r.height+=i):"e"===n?r.width+=i:"se"===n&&(r.width+=i,r.height+=i)),"ArrowUp"===t?"nw"===n?(r.x-=i,r.y-=i,r.width+=i,r.height+=i):"n"===n?(r.y-=i,r.height+=i):"ne"===n?(r.y-=i,r.width+=i,r.height+=i):"sw"===n?(r.x+=i,r.width-=i,r.height-=i):"s"===n?r.height-=i:"se"===n&&(r.width-=i,r.height-=i):"ArrowDown"===t&&("nw"===n?(r.x+=i,r.y+=i,r.width-=i,r.height-=i):"n"===n?(r.y+=i,r.height-=i):"ne"===n?(r.y+=i,r.width-=i,r.height-=i):"sw"===n?(r.x-=i,r.width+=i,r.height+=i):"s"===n?r.height+=i:"se"===n&&(r.width+=i,r.height+=i)),r}(y(r,p.width,p.height),t.key,w,i),n,i,p.width,p.height,o,h,s,d);if(!m(r,g)){let e=u(g,p.width,p.height);l(g,e),c&&c(g,e)}};onDocPointerDone=e=>{let{crop:t,disabled:i,onComplete:n,onDragEnd:r}=this.props,a=this.getBox();this.unbindDocMove(),!i&&t&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,r&&r(e),n&&n(y(t,a.width,a.height),u(t,a.width,a.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),i=this.makePixelCrop(t),n=e.clientX-e.startClientX,r=e.clientY-e.startClientY;return i.x=g(e.startCropX+n,0,t.width-i.width),i.y=g(e.startCropY+r,0,t.height-i.height),i}getPointRegion(e,t,i,n){let r,a,{evData:o}=this,h=o.clientX-e.x,s=o.clientY-e.y;return r=n&&t?"nw"===t||"n"===t||"ne"===t:s<o.startCropY,a=i&&t?"nw"===t||"w"===t||"sw"===t:h<o.startCropX,a?r?"nw":"sw":r?"ne":"se"}resolveMinDimensions(e,t,i=0,n=0){let r=Math.min(i,e.width),a=Math.min(n,e.height);return t&&(r||a)?t>1?r?[r,r/t]:[a*t,a]:a?[a*t,a]:[r,r/t]:[r,a]}resizeCrop(){let{evData:t}=this,{aspect:i=0,maxWidth:n,maxHeight:r}=this.props,a=this.getBox(),[o,h]=this.resolveMinDimensions(a,i,this.props.minWidth,this.props.minHeight),s=this.makePixelCrop(a),d=this.getPointRegion(a,t.ord,o,h),l=t.ord||d,c=t.clientX-t.startClientX,p=t.clientY-t.startClientY;(o&&"nw"===l||"w"===l||"sw"===l)&&(c=Math.min(c,-o)),(h&&"nw"===l||"n"===l||"ne"===l)&&(p=Math.min(p,-h));let w={unit:"px",x:0,y:0,width:0,height:0};"ne"===d?(w.x=t.startCropX,w.width=c,i?(w.height=w.width/i,w.y=t.startCropY-w.height):(w.height=Math.abs(p),w.y=t.startCropY-w.height)):"se"===d?(w.x=t.startCropX,w.y=t.startCropY,w.width=c,w.height=i?w.width/i:p):"sw"===d?(w.x=t.startCropX+c,w.y=t.startCropY,w.width=Math.abs(c),w.height=i?w.width/i:p):"nw"===d&&(w.x=t.startCropX+c,w.width=Math.abs(c),i?(w.height=w.width/i,w.y=t.startCropY-w.height):(w.height=Math.abs(p),w.y=t.startCropY+p));let m=x(w,i,d,a.width,a.height,o,h,n,r);return i||e.xyOrds.indexOf(l)>-1?s=m:e.xOrds.indexOf(l)>-1?(s.x=m.x,s.width=m.width):e.yOrds.indexOf(l)>-1&&(s.y=m.y,s.height=m.height),s.x=g(s.x,0,a.width-s.width),s.y=g(s.y,0,a.height-s.height),s}renderCropSelection(){let{ariaLabels:t=e.defaultProps.ariaLabels,disabled:n,locked:r,renderSelectionAddon:a,ruleOfThirds:o,crop:h}=this.props,s=this.getCropStyle();if(h)return i.createElement("div",{style:s,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!r&&i.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},i.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),i.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),i.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),i.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&i.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},a(this.state)),o&&i.createElement(i.Fragment,null,i.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),i.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return y({...w,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:t,circularCrop:n,className:r,crop:a,disabled:o,locked:h,style:s,ruleOfThirds:d}=this.props,{cropIsActive:l,newCropIsBeingDrawn:c}=this.state,p=a?this.renderCropSelection():null,w=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",r,l&&"ReactCrop--active",o&&"ReactCrop--disabled",h&&"ReactCrop--locked",c&&"ReactCrop--new-crop",a&&e&&"ReactCrop--fixed-aspect",a&&n&&"ReactCrop--circular-crop",a&&d&&"ReactCrop--rule-of-thirds",!this.dragStarted&&a&&!a.width&&!a.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return i.createElement("div",{ref:this.componentRef,className:w,style:s},i.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},t),a?i.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},i.createElement("defs",null,i.createElement("mask",{id:`hole-${this.instanceId}`},i.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?i.createElement("ellipse",{cx:`${a.x+a.width/2}${a.unit}`,cy:`${a.y+a.height/2}${a.unit}`,rx:`${a.width/2}${a.unit}`,ry:`${a.height/2}${a.unit}`,fill:"black"}):i.createElement("rect",{x:`${a.x}${a.unit}`,y:`${a.y}${a.unit}`,width:`${a.width}${a.unit}`,height:`${a.height}${a.unit}`,fill:"black"}))),i.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,p)}};const D=Math.PI/180;function b(e,t,i){return function(e,t,i){let n=y(e,t,i);return n.x=(t-n.width)/2,n.y=(i-n.height)/2,"%"===e.unit?u(n,t,i):n}(function(e,t,i,n){let r=y(e,i,n);return e.width&&(r.height=r.width/t),e.height&&(r.width=r.height*t),r.y+r.height>n&&(r.height=n-r.y,r.width=r.height*t),r.x+r.width>i&&(r.width=i-r.x,r.height=r.width/t),"%"===e.unit?u(r,i,n):r}({unit:"%",width:90},i,e,t),e,t)}function R(i){const{defaultCrop:n,onCropChange:r,aspect:w,scale:g,rotate:m,circularCrop:x,withAspect:C,withRotate:v,withScale:R}=i,[M,_]=a(""),E=o(null),k=o(null),[H,P]=a(n),[N,Y]=a(),[S,X]=s(1,g),[$,K]=s(0,m),[I,A]=a(w||void 0),[O,L]=a((I||"")+""),B=e=>{if(e){if(k.current){const{width:t,height:i}=k.current;A(e);const n=b(t,i,e);P(n),Y(y(n,t,i))}}else A(void 0)};return h(()=>{B(w),L((w||"")+"")},[w]),h(()=>B(I),[I]),d(async()=>{N?.width&&N?.height&&k.current&&E.current&&await async function(e,t,i,n=1,r=0){const a=t.getContext("2d");if(!a)throw new Error("No 2d context");const o=e.naturalWidth/e.width,h=e.naturalHeight/e.height,s=p()?window.devicePixelRatio:1;t.width=Math.floor(i.width*o*s),t.height=Math.floor(i.height*h*s),a.scale(s,s),a.imageSmoothingQuality="high";const d=i.x*o,l=i.y*h,c=r*D,w=e.naturalWidth/2,g=e.naturalHeight/2;a.save(),a.translate(-d,-l),a.translate(w,g),a.rotate(c),a.scale(n,n),a.translate(-w,-g),a.drawImage(e,0,0,e.naturalWidth,e.naturalHeight,0,0,e.naturalWidth,e.naturalHeight),a.globalCompositeOperation="destination-in",a.beginPath(),a.restore()}(k.current,E.current,N,S,$)},100,[N,S,$]),h(()=>{if(E.current&&N&&k.current){const{width:e,height:t}=k.current;r?.({percentCrop:u(N,e,t),pixelCrop:N,previewCanvasRef:E,scale:S,rotate:$,circularCrop:!!x,aspect:I})}},[N,S,$,r,x,I]),e("div",{className:"image-loader-cropper-layout jk-col gap",children:[e("div",{className:"jk-row space-between gap nowrap",children:[t(l,{type:"file",accept:"image/*",onChange:function(e){if(e?.length>0&&e[0]){P(void 0);const t=new FileReader;t.addEventListener("load",()=>_(t.result?.toString()||"")),t.readAsDataURL(e[0])}}}),R&&t(l,{labelPlacement:"left",label:t(c,{className:"tt-se",children:"scale"}),type:"number",step:.1,value:S,disabled:!M,size:"auto",onChange:X}),v&&t(l,{labelPlacement:"left",label:t(c,{className:"tt-se",children:"rotate"}),type:"number",value:$,disabled:!M,size:"auto",onChange:e=>K(Math.min(180,Math.max(-180,e)))}),C&&t(l,{labelPlacement:"left",label:t(c,{className:"tt-se",children:"aspect"}),type:"text",value:O,disabled:!M,size:"auto",onChange:e=>{L(e);const t=e?.split("/"),i=+(t[0]??0)/+(t[1]??1);Number.isNaN(i)||A(i)}})]}),Boolean(M)&&t(f,{crop:H,onChange:(e,t)=>P(t),onComplete:e=>Y(e),aspect:I,circularCrop:x,children:t("img",{ref:k,alt:"Crop me",src:M,style:{transform:`scale(${S}) rotate(${$}deg)`},onLoad:function(e){const{width:t,height:i}=e.currentTarget;P(I?b(t,i,I):{width:100,height:100,y:0,x:0,unit:"%"})}})}),t("div",{style:{display:"none"},children:!!N&&t("canvas",{ref:E})})]})}export{R as default};
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import i,{PureComponent as n,createRef as r,useState as a,useRef as o,useEffect as h}from"react";import{u as s,v as d,w as l,T as c}from"./index-Bz4iycQ-.js";import"./settings-DzQM72QE.js";import"./enums.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"motion/react";import"react-dom";import{i as p}from"./commons-C-9EFvh4.js";import"./websocket-B8ybpDXk.js";import"./index-B8CE4gNp.js";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";var w={x:0,y:0,width:0,height:0,unit:"px"},g=(e,t,i)=>Math.min(Math.max(e,t),i),m=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function u(e,t,i){return"%"===e.unit?{...w,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/i*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/i*100:0}}function y(e,t,i){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*i/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*i/100:0}:{...w,...e,unit:"px"}}function x(e,t,i,n,r,a=0,o=0,h=n,s=r){let d={...e},l=Math.min(a,n),c=Math.min(o,r),p=Math.min(h,n),w=Math.min(s,r);t&&(t>1?(l=o?o*t:l,c=l/t,p=h*t):(c=a?a/t:c,l=c*t,w=s/t)),d.y<0&&(d.height=Math.max(d.height+d.y,c),d.y=0),d.x<0&&(d.width=Math.max(d.width+d.x,l),d.x=0);let g=n-(d.x+d.width);g<0&&(d.x=Math.min(d.x,n-l),d.width+=g);let m=r-(d.y+d.height);if(m<0&&(d.y=Math.min(d.y,r-c),d.height+=m),d.width<l&&(("sw"===i||"nw"==i)&&(d.x-=l-d.width),d.width=l),d.height<c&&(("nw"===i||"ne"==i)&&(d.y-=c-d.height),d.height=c),d.width>p&&(("sw"===i||"nw"==i)&&(d.x-=p-d.width),d.width=p),d.height>w&&(("nw"===i||"ne"==i)&&(d.y-=w-d.height),d.height=w),t){let e=d.width/d.height;if(e<t){let e=Math.max(d.width/t,c);("nw"===i||"ne"==i)&&(d.y-=e-d.height),d.height=e}else if(e>t){let e=Math.max(d.height*t,l);("sw"===i||"nw"==i)&&(d.x-=e-d.width),d.width=e}}return d}var C={capture:!0,passive:!1},v=0,f=class e extends n{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=r();mediaRef=r();resizeObserver;initChangeCalled=!1;instanceId="rc-"+v++;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:i,width:n,height:r}=e.getBoundingClientRect();return{x:t,y:i,width:n,height:r}}componentDidUpdate(e){let{crop:t,onComplete:i}=this.props;if(i&&!e.crop&&t){let{width:e,height:n}=this.getBox();e&&n&&i(y(t,e,n),u(t,e,n))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,C),this.document.addEventListener("pointerup",this.onDocPointerDone,C),this.document.addEventListener("pointercancel",this.onDocPointerDone,C),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,C),this.document.removeEventListener("pointerup",this.onDocPointerDone,C),this.document.removeEventListener("pointercancel",this.onDocPointerDone,C),!1)}onCropPointerDown=e=>{let{crop:t,disabled:i}=this.props,n=this.getBox();if(!t)return;let r=y(t,n.width,n.height);if(i)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let a=e.target.dataset.ord,o=!!a,h=e.clientX,s=e.clientY,d=r.x,l=r.y;if(a){let t=e.clientX-n.x,i=e.clientY-n.y,o=0,c=0;"ne"===a||"e"==a?(o=t-(r.x+r.width),c=i-r.y,d=r.x,l=r.y+r.height):"se"===a||"s"===a?(o=t-(r.x+r.width),c=i-(r.y+r.height),d=r.x,l=r.y):"sw"===a||"w"==a?(o=t-r.x,c=i-(r.y+r.height),d=r.x+r.width,l=r.y):("nw"===a||"n"==a)&&(o=t-r.x,c=i-r.y,d=r.x+r.width,l=r.y+r.height),h=d+n.x+o,s=l+n.y+c}this.evData={startClientX:h,startClientY:s,startCropX:d,startCropY:l,clientX:e.clientX,clientY:e.clientY,isResize:o,ord:a},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:i,locked:n,keepSelection:r,onChange:a}=this.props,o=this.getBox();if(i||n||r&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let h=e.clientX-o.x,s=e.clientY-o.y,d={unit:"px",x:h,y:s,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:s,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,a(y(d,o.width,o.height),u(d,o.width,o.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let{crop:t,disabled:i,onChange:n,onDragStart:r}=this.props,a=this.getBox();if(i||!t||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,r&&r(e));let o,{evData:h}=this;h.clientX=e.clientX,h.clientY=e.clientY,o=h.isResize?this.resizeCrop():this.dragCrop(),m(t,o)||n(y(o,a.width,a.height),u(o,a.width,a.height))};onComponentKeyDown=t=>{let{crop:i,disabled:n,onChange:r,onComplete:a}=this.props;if(n)return;let o=t.key,h=!1;if(!i)return;let s=this.getBox(),d=this.makePixelCrop(s),l=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===o?(d.x-=l,h=!0):"ArrowRight"===o?(d.x+=l,h=!0):"ArrowUp"===o?(d.y-=l,h=!0):"ArrowDown"===o&&(d.y+=l,h=!0),h){t.cancelable&&t.preventDefault(),d.x=g(d.x,0,s.width-d.width),d.y=g(d.y,0,s.height-d.height);let e=y(d,s.width,s.height),i=u(d,s.width,s.height);r(e,i),a&&a(e,i)}};onHandlerKeyDown=(t,i)=>{let{aspect:n=0,crop:r,disabled:a,minWidth:o=0,minHeight:h=0,maxWidth:s,maxHeight:d,onChange:l,onComplete:c}=this.props,p=this.getBox();if(a||!r)return;if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let w=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,g=x(function(e,t,i,n){let r={...e};return"ArrowLeft"===t?"nw"===n?(r.x-=i,r.y-=i,r.width+=i,r.height+=i):"w"===n?(r.x-=i,r.width+=i):"sw"===n?(r.x-=i,r.width+=i,r.height+=i):"ne"===n?(r.y+=i,r.width-=i,r.height-=i):"e"===n?r.width-=i:"se"===n&&(r.width-=i,r.height-=i):"ArrowRight"===t&&("nw"===n?(r.x+=i,r.y+=i,r.width-=i,r.height-=i):"w"===n?(r.x+=i,r.width-=i):"sw"===n?(r.x+=i,r.width-=i,r.height-=i):"ne"===n?(r.y-=i,r.width+=i,r.height+=i):"e"===n?r.width+=i:"se"===n&&(r.width+=i,r.height+=i)),"ArrowUp"===t?"nw"===n?(r.x-=i,r.y-=i,r.width+=i,r.height+=i):"n"===n?(r.y-=i,r.height+=i):"ne"===n?(r.y-=i,r.width+=i,r.height+=i):"sw"===n?(r.x+=i,r.width-=i,r.height-=i):"s"===n?r.height-=i:"se"===n&&(r.width-=i,r.height-=i):"ArrowDown"===t&&("nw"===n?(r.x+=i,r.y+=i,r.width-=i,r.height-=i):"n"===n?(r.y+=i,r.height-=i):"ne"===n?(r.y+=i,r.width-=i,r.height-=i):"sw"===n?(r.x-=i,r.width+=i,r.height+=i):"s"===n?r.height+=i:"se"===n&&(r.width+=i,r.height+=i)),r}(y(r,p.width,p.height),t.key,w,i),n,i,p.width,p.height,o,h,s,d);if(!m(r,g)){let e=u(g,p.width,p.height);l(g,e),c&&c(g,e)}};onDocPointerDone=e=>{let{crop:t,disabled:i,onComplete:n,onDragEnd:r}=this.props,a=this.getBox();this.unbindDocMove(),!i&&t&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,r&&r(e),n&&n(y(t,a.width,a.height),u(t,a.width,a.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),i=this.makePixelCrop(t),n=e.clientX-e.startClientX,r=e.clientY-e.startClientY;return i.x=g(e.startCropX+n,0,t.width-i.width),i.y=g(e.startCropY+r,0,t.height-i.height),i}getPointRegion(e,t,i,n){let r,a,{evData:o}=this,h=o.clientX-e.x,s=o.clientY-e.y;return r=n&&t?"nw"===t||"n"===t||"ne"===t:s<o.startCropY,a=i&&t?"nw"===t||"w"===t||"sw"===t:h<o.startCropX,a?r?"nw":"sw":r?"ne":"se"}resolveMinDimensions(e,t,i=0,n=0){let r=Math.min(i,e.width),a=Math.min(n,e.height);return t&&(r||a)?t>1?r?[r,r/t]:[a*t,a]:a?[a*t,a]:[r,r/t]:[r,a]}resizeCrop(){let{evData:t}=this,{aspect:i=0,maxWidth:n,maxHeight:r}=this.props,a=this.getBox(),[o,h]=this.resolveMinDimensions(a,i,this.props.minWidth,this.props.minHeight),s=this.makePixelCrop(a),d=this.getPointRegion(a,t.ord,o,h),l=t.ord||d,c=t.clientX-t.startClientX,p=t.clientY-t.startClientY;(o&&"nw"===l||"w"===l||"sw"===l)&&(c=Math.min(c,-o)),(h&&"nw"===l||"n"===l||"ne"===l)&&(p=Math.min(p,-h));let w={unit:"px",x:0,y:0,width:0,height:0};"ne"===d?(w.x=t.startCropX,w.width=c,i?(w.height=w.width/i,w.y=t.startCropY-w.height):(w.height=Math.abs(p),w.y=t.startCropY-w.height)):"se"===d?(w.x=t.startCropX,w.y=t.startCropY,w.width=c,w.height=i?w.width/i:p):"sw"===d?(w.x=t.startCropX+c,w.y=t.startCropY,w.width=Math.abs(c),w.height=i?w.width/i:p):"nw"===d&&(w.x=t.startCropX+c,w.width=Math.abs(c),i?(w.height=w.width/i,w.y=t.startCropY-w.height):(w.height=Math.abs(p),w.y=t.startCropY+p));let m=x(w,i,d,a.width,a.height,o,h,n,r);return i||e.xyOrds.indexOf(l)>-1?s=m:e.xOrds.indexOf(l)>-1?(s.x=m.x,s.width=m.width):e.yOrds.indexOf(l)>-1&&(s.y=m.y,s.height=m.height),s.x=g(s.x,0,a.width-s.width),s.y=g(s.y,0,a.height-s.height),s}renderCropSelection(){let{ariaLabels:t=e.defaultProps.ariaLabels,disabled:n,locked:r,renderSelectionAddon:a,ruleOfThirds:o,crop:h}=this.props,s=this.getCropStyle();if(h)return i.createElement("div",{style:s,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!r&&i.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},i.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),i.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),i.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),i.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),i.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&i.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},a(this.state)),o&&i.createElement(i.Fragment,null,i.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),i.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return y({...w,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:t,circularCrop:n,className:r,crop:a,disabled:o,locked:h,style:s,ruleOfThirds:d}=this.props,{cropIsActive:l,newCropIsBeingDrawn:c}=this.state,p=a?this.renderCropSelection():null,w=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",r,l&&"ReactCrop--active",o&&"ReactCrop--disabled",h&&"ReactCrop--locked",c&&"ReactCrop--new-crop",a&&e&&"ReactCrop--fixed-aspect",a&&n&&"ReactCrop--circular-crop",a&&d&&"ReactCrop--rule-of-thirds",!this.dragStarted&&a&&!a.width&&!a.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return i.createElement("div",{ref:this.componentRef,className:w,style:s},i.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},t),a?i.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},i.createElement("defs",null,i.createElement("mask",{id:`hole-${this.instanceId}`},i.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?i.createElement("ellipse",{cx:`${a.x+a.width/2}${a.unit}`,cy:`${a.y+a.height/2}${a.unit}`,rx:`${a.width/2}${a.unit}`,ry:`${a.height/2}${a.unit}`,fill:"black"}):i.createElement("rect",{x:`${a.x}${a.unit}`,y:`${a.y}${a.unit}`,width:`${a.width}${a.unit}`,height:`${a.height}${a.unit}`,fill:"black"}))),i.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,p)}};const D=Math.PI/180;function b(e,t,i){return function(e,t,i){let n=y(e,t,i);return n.x=(t-n.width)/2,n.y=(i-n.height)/2,"%"===e.unit?u(n,t,i):n}(function(e,t,i,n){let r=y(e,i,n);return e.width&&(r.height=r.width/t),e.height&&(r.width=r.height*t),r.y+r.height>n&&(r.height=n-r.y,r.width=r.height*t),r.x+r.width>i&&(r.width=i-r.x,r.height=r.width/t),"%"===e.unit?u(r,i,n):r}({unit:"%",width:90},i,e,t),e,t)}function R(i){const{defaultCrop:n,onCropChange:r,aspect:w,scale:g,rotate:m,circularCrop:x,withAspect:C,withRotate:v,withScale:R}=i,[M,_]=a(""),E=o(null),k=o(null),[H,P]=a(n),[N,Y]=a(),[S,X]=s(1,g),[$,K]=s(0,m),[I,A]=a(w||void 0),[O,L]=a((I||"")+""),B=e=>{if(e){if(k.current){const{width:t,height:i}=k.current;A(e);const n=b(t,i,e);P(n),Y(y(n,t,i))}}else A(void 0)};return h(()=>{B(w),L((w||"")+"")},[w]),h(()=>B(I),[I]),d(async()=>{N?.width&&N?.height&&k.current&&E.current&&await async function(e,t,i,n=1,r=0){const a=t.getContext("2d");if(!a)throw new Error("No 2d context");const o=e.naturalWidth/e.width,h=e.naturalHeight/e.height,s=p()?window.devicePixelRatio:1;t.width=Math.floor(i.width*o*s),t.height=Math.floor(i.height*h*s),a.scale(s,s),a.imageSmoothingQuality="high";const d=i.x*o,l=i.y*h,c=r*D,w=e.naturalWidth/2,g=e.naturalHeight/2;a.save(),a.translate(-d,-l),a.translate(w,g),a.rotate(c),a.scale(n,n),a.translate(-w,-g),a.drawImage(e,0,0,e.naturalWidth,e.naturalHeight,0,0,e.naturalWidth,e.naturalHeight),a.globalCompositeOperation="destination-in",a.beginPath(),a.restore()}(k.current,E.current,N,S,$)},100,[N,S,$]),h(()=>{if(E.current&&N&&k.current){const{width:e,height:t}=k.current;r?.({percentCrop:u(N,e,t),pixelCrop:N,previewCanvasRef:E,scale:S,rotate:$,circularCrop:!!x,aspect:I})}},[N,S,$,r,x,I]),e("div",{className:"image-loader-cropper-layout jk-col gap",children:[e("div",{className:"jk-row space-between gap nowrap",children:[t(l,{type:"file",accept:"image/*",onChange:function(e){if(e?.length>0&&e[0]){P(void 0);const t=new FileReader;t.addEventListener("load",()=>_(t.result?.toString()||"")),t.readAsDataURL(e[0])}}}),R&&t(l,{labelPlacement:"left",label:t(c,{className:"tt-se",children:"scale"}),type:"number",step:.1,value:S,disabled:!M,size:"auto",onChange:X}),v&&t(l,{labelPlacement:"left",label:t(c,{className:"tt-se",children:"rotate"}),type:"number",value:$,disabled:!M,size:"auto",onChange:e=>K(Math.min(180,Math.max(-180,e)))}),C&&t(l,{labelPlacement:"left",label:t(c,{className:"tt-se",children:"aspect"}),type:"text",value:O,disabled:!M,size:"auto",onChange:e=>{L(e);const t=e?.split("/"),i=+(t[0]??0)/+(t[1]??1);Number.isNaN(i)||A(i)}})]}),Boolean(M)&&t(f,{crop:H,onChange:(e,t)=>P(t),onComplete:e=>Y(e),aspect:I,circularCrop:x,children:t("img",{ref:k,alt:"Crop me",src:M,style:{transform:`scale(${S}) rotate(${$}deg)`},onLoad:function(e){const{width:t,height:i}=e.currentTarget;P(I?b(t,i,I):{width:100,height:100,y:0,x:0,unit:"%"})}})}),t("div",{style:{display:"none"},children:!!N&&t("canvas",{ref:E})})]})}export{R as default};
|