adminizer 5.0.0-build.21 → 5.0.0-build.22

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.
Files changed (83) hide show
  1. package/assets/{abnfDiagram-VCTEODGH-CkmsvdDi.js → abnfDiagram-VCTEODGH-CPNt0_3y.js} +1 -1
  2. package/assets/{add-CESPH_aI.js → add-CbF4WtRH.js} +1 -1
  3. package/assets/{add-group-CQ4Xm8Ru.js → add-group-BbYlTucj.js} +1 -1
  4. package/assets/{add-user-B-QNjR4B.js → add-user-D6-GHJ4c.js} +1 -1
  5. package/assets/app-DaEtIZDm.js +138 -0
  6. package/assets/{arc-B-Dt8YNl.js → arc-DXNFGXT5.js} +1 -1
  7. package/assets/{architectureDiagram-5GKGNRK7-Ca58kq-l.js → architectureDiagram-5GKGNRK7-fGAG2a-R.js} +1 -1
  8. package/assets/{blockDiagram-NRAW4CY4-CuqE52IG.js → blockDiagram-NRAW4CY4-DFyQTcKb.js} +1 -1
  9. package/assets/{c4Diagram-UCG6FXSJ-Cx8z-0Bw.js → c4Diagram-UCG6FXSJ-CbEudKF4.js} +1 -1
  10. package/assets/{catalog-CkSbxvx0.js → catalog-i6yf1v3U.js} +1 -1
  11. package/assets/channel-q6uxCSN1.js +1 -0
  12. package/assets/{chunk-2Q5K7J3B-CXISVKTC.js → chunk-2Q5K7J3B-DhDm2aKu.js} +1 -1
  13. package/assets/{chunk-5VM5RSS4-DYGeeVYe.js → chunk-5VM5RSS4-B7gYKZNS.js} +1 -1
  14. package/assets/{chunk-F27PBJKO-BeY-dbKj.js → chunk-F27PBJKO-DJjFRRAy.js} +1 -1
  15. package/assets/{chunk-G27WJ6UU-DeX_eH7C.js → chunk-G27WJ6UU-DnTbAlkb.js} +1 -1
  16. package/assets/{chunk-JWPE2WC7-DaxI9q0u.js → chunk-JWPE2WC7-BHmglG6w.js} +1 -1
  17. package/assets/{chunk-LCL6LL3I-B7PkaEz_.js → chunk-LCL6LL3I-CTBDNhhN.js} +1 -1
  18. package/assets/{chunk-POPQ4Y6H-lwu6ZpsN.js → chunk-POPQ4Y6H-DYEL3odJ.js} +1 -1
  19. package/assets/{chunk-SVP7TREG-CVFllgl1.js → chunk-SVP7TREG-B1rjBbM2.js} +1 -1
  20. package/assets/{chunk-XXDRQBXY-DDLN0rcg.js → chunk-XXDRQBXY-CiLRj8bc.js} +1 -1
  21. package/assets/classDiagram-DTDB5LWJ-C7b06fbo.js +1 -0
  22. package/assets/classDiagram-v2-JRS7N3AN-C7b06fbo.js +1 -0
  23. package/assets/{cose-bilkent-JH36ORCC-CWRyUkhQ.js → cose-bilkent-JH36ORCC-dzBUAjm2.js} +1 -1
  24. package/assets/{cynefin-OW5HDTMX-B1iLDXCC.js → cynefin-OW5HDTMX-BvM8uIjp.js} +1 -1
  25. package/assets/{cynefinDiagram-5FMLGOSQ-DaXQHr3l.js → cynefinDiagram-5FMLGOSQ-Cv93hSj0.js} +1 -1
  26. package/assets/{dagre-3AP2YEHR-DFORa4Hz.js → dagre-3AP2YEHR-Dc_9ctCA.js} +1 -1
  27. package/assets/{dashboard-Ssa1_Of3.js → dashboard-C4r2hkgK.js} +1 -1
  28. package/assets/{diagram-S7CK7UJ4-CgP6KBo0.js → diagram-S7CK7UJ4-CmfsCr4D.js} +1 -1
  29. package/assets/{diagram-UQ7AKVKN-oYfQe6w0.js → diagram-UQ7AKVKN-BiYKQm60.js} +1 -1
  30. package/assets/{diagram-VSXAHHWV-DfCU5wgt.js → diagram-VSXAHHWV-DAOWubh1.js} +1 -1
  31. package/assets/{diagram-VX7I27RA-BITJVrNY.js → diagram-VX7I27RA-CNi7oGdR.js} +1 -1
  32. package/assets/{diagram-Z3DM3KII-D8J9Ssjy.js → diagram-Z3DM3KII-HzHW1qt3.js} +1 -1
  33. package/assets/{docs-DHMt_Rq1.js → docs-ChTsRktp.js} +1 -1
  34. package/assets/{ebnfDiagram-PWID7BFC-qpNmoYgx.js → ebnfDiagram-PWID7BFC-CbJQokDS.js} +1 -1
  35. package/assets/{erDiagram-SSCWMZ5O-DDF-Y0zs.js → erDiagram-SSCWMZ5O-CFjNrmGC.js} +1 -1
  36. package/assets/{flowDiagram-A5DVABFB-CjKVkR9T.js → flowDiagram-A5DVABFB-Bz_tS1zO.js} +1 -1
  37. package/assets/{ganttDiagram-EL5Y4UJY-BXGQ53w6.js → ganttDiagram-EL5Y4UJY-THKk94H7.js} +1 -1
  38. package/assets/{gitGraphDiagram-WWUBYQGX-BLMevdLh.js → gitGraphDiagram-WWUBYQGX-RqhkqLLZ.js} +1 -1
  39. package/assets/{history-tBOo2gd5.js → history-KLwstErf.js} +1 -1
  40. package/assets/{infoDiagram-RXCK75RN-BAnPdnyw.js → infoDiagram-RXCK75RN-BosD7pqj.js} +1 -1
  41. package/assets/{init-user-DrNUHa6r.js → init-user-BmE4YOJV.js} +1 -1
  42. package/assets/{ishikawaDiagram-5VMMS53U-PnL0Z4Li.js → ishikawaDiagram-5VMMS53U-CNZH2Iky.js} +1 -1
  43. package/assets/{journeyDiagram-EYS64GPL-CLcsCSwF.js → journeyDiagram-EYS64GPL-BYtGTMh9.js} +1 -1
  44. package/assets/{kanban-definition-3QL26DDD-C2eU3uBE.js → kanban-definition-3QL26DDD-C7aGsHDF.js} +1 -1
  45. package/assets/{layout-BXoYdHdx.js → layout-DVI-fobv.js} +1 -1
  46. package/assets/{linear-BSzrP0oP.js → linear-Vii4ezoN.js} +1 -1
  47. package/assets/{list-CLg6xeIK.js → list-c8JKFUOC.js} +1 -1
  48. package/assets/{login-Ce7o3-o_.js → login-D3cPsF9W.js} +1 -1
  49. package/assets/manifest.json +276 -276
  50. package/assets/{media-manager-D7G1P3fz.js → media-manager-BCK314Jk.js} +1 -1
  51. package/assets/{mermaid.core-aKMJHeEk.js → mermaid.core-CKoUtEwH.js} +5 -5
  52. package/assets/{mindmap-definition-FBJOCRG2-Dzbz5ghA.js → mindmap-definition-FBJOCRG2-CyWHnBRR.js} +1 -1
  53. package/assets/{module-BsXph_pA.js → module-DPNn7VMP.js} +1 -1
  54. package/assets/{notification-D-Zz1gF_.js → notification-B-SixWir.js} +1 -1
  55. package/assets/{pegDiagram-XKGWAZYB-BTdWkU0Y.js → pegDiagram-XKGWAZYB-CrPxDU6-.js} +1 -1
  56. package/assets/{pieDiagram-E7YTZNPT-Dnw8-TB-.js → pieDiagram-E7YTZNPT-BxLtrE6y.js} +1 -1
  57. package/assets/{quadrantDiagram-AXDQQJYC-CALzLlg9.js → quadrantDiagram-AXDQQJYC-CYRnEdpR.js} +1 -1
  58. package/assets/{railroadDiagram-O6MQD6OU-CTA1vzcv.js → railroadDiagram-O6MQD6OU-di0lwhaD.js} +1 -1
  59. package/assets/{register-CNnBkzej.js → register-LEWWwgHt.js} +1 -1
  60. package/assets/{requirementDiagram-EFPCY7ZU-UX2CF5HA.js → requirementDiagram-EFPCY7ZU-y7x6_MLB.js} +1 -1
  61. package/assets/{ru-CoNgAwFK.js → ru-BTMMskhw.js} +1 -1
  62. package/assets/{sankeyDiagram-P5KCCOFB-4aPp3ATV.js → sankeyDiagram-P5KCCOFB-CEWZPc0s.js} +1 -1
  63. package/assets/{sequenceDiagram-WJ2MYXX4--kltkwJw.js → sequenceDiagram-WJ2MYXX4-D42rL7FG.js} +1 -1
  64. package/assets/{sizeCapture-X5ZJPWSS-Ca9-g5QY.js → sizeCapture-X5ZJPWSS-DrLiQduN.js} +1 -1
  65. package/assets/{stateDiagram-HBIQ2CUA-Diaf5Q7I.js → stateDiagram-HBIQ2CUA-DkdnkfVg.js} +1 -1
  66. package/assets/stateDiagram-v2-4QOOHH4V-DqeFw2rp.js +1 -0
  67. package/assets/{swimlanes-XN3QIQJK-DhqX_myE.js → swimlanes-XN3QIQJK-BXzkv8_Y.js} +1 -1
  68. package/assets/swimlanesDiagram-VK2B7HYN-B5HOWgIq.js +8 -0
  69. package/assets/{timeline-definition-24CTP7MA-CwkJQbhq.js → timeline-definition-24CTP7MA-DybJfe82.js} +1 -1
  70. package/assets/{use-appearance-DC-DESKB.js → use-appearance-D34fLQSc.js} +1 -1
  71. package/assets/{user-filters-list-W47DTBp2.js → user-filters-list-CvvYFH5e.js} +1 -1
  72. package/assets/{vennDiagram-4TSXK5OY-BNM3_cVS.js → vennDiagram-4TSXK5OY-DXJlmfAC.js} +1 -1
  73. package/assets/{wardleyDiagram-VM6X3IG4-BODb1NP8.js → wardleyDiagram-VM6X3IG4-DMa6WXEy.js} +1 -1
  74. package/assets/{welcome-BeBm6NIi.js → welcome-IgwJ4gMJ.js} +1 -1
  75. package/assets/{with-app-layout-B90DtzYC.js → with-app-layout-BQuPyvlC.js} +9 -9
  76. package/assets/{xychartDiagram-S5SC5T6Z-DthqEh3g.js → xychartDiagram-S5SC5T6Z-CIo8gKFS.js} +1 -1
  77. package/package.json +1 -1
  78. package/assets/app-Ca5yUSBv.js +0 -138
  79. package/assets/channel-C9z6Pi_j.js +0 -1
  80. package/assets/classDiagram-DTDB5LWJ-BKtCIC3B.js +0 -1
  81. package/assets/classDiagram-v2-JRS7N3AN-BKtCIC3B.js +0 -1
  82. package/assets/stateDiagram-v2-4QOOHH4V-C6FlRp7u.js +0 -1
  83. package/assets/swimlanesDiagram-VK2B7HYN-i_3LTEBk.js +0 -8
@@ -1,4 +1,4 @@
1
- import{r as v,j as n,I as U,d as E,H as ce,S as Bn,s as Es,v as _n,w as ot,x as In,y as Ms,z as Pn,aA as ct,aB as dt,aC as qt,aD as gt,aE as ks,aF as qn,aG as Vs,a as Un,aH as As,aI as Ds,aJ as Oe,aK as Nt,aL as zs,aM as Ls,q as ee,t as de,aN as En,J as qe,aO as Hs,aP as Ts,aQ as Os,u as en,b as tn,aR as Ut,E as ke,U as Re,G as Kt,D as mt,aS as Kn,aT as nn,aU as Wn,c as ue,X as Le,i as Ve,k as Ae,l as De,m as ze,n as ve,R as Pe,V as Ee,aV as Rt,W as Me,aW as bt,aX as Ft,aY as $t,aZ as _t,a_ as It,a$ as Pt,b0 as Et,b1 as Gs,b2 as Bs,b3 as qs,b4 as Mn,b5 as Mt,b6 as kt,b7 as Vt,b8 as Us,b9 as Ks,ba as Ws,f as Xs,bb as Ys,bc as Js,C as Qs,bd as kn,be as Vn,bf as Zs,p as Ue,bg as er,bh as An,bi as tr,bj as Wt,bk as be,bl as Xn,bm as nr,au as sr,T as rr}from"./app-Ca5yUSBv.js";import{c as Ce,w as or}from"./with-app-layout-B90DtzYC.js";import{r as At}from"./ru-CoNgAwFK.js";import"./use-appearance-DC-DESKB.js";function we(e,r){return typeof e=="function"?e(r):e}function te(e,r){return t=>{r.setState(s=>({...s,[e]:we(t,s[e])}))}}function ft(e){return e instanceof Function}function lr(e){return Array.isArray(e)&&e.every(r=>typeof r=="number")}function ir(e,r){const t=[],s=o=>{o.forEach(a=>{t.push(a);const u=r(a);u!=null&&u.length&&s(u)})};return s(e),t}function M(e,r,t){let s=[],o;return a=>{let u;t.key&&t.debug&&(u=Date.now());const c=e(a);if(!(c.length!==s.length||c.some((l,C)=>s[C]!==l)))return o;s=c;let d;if(t.key&&t.debug&&(d=Date.now()),o=r(...c),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){const l=Math.round((Date.now()-u)*100)/100,C=Math.round((Date.now()-d)*100)/100,w=C/16,h=(y,x)=>{for(y=String(y);y.length<x;)y=" "+y;return y};console.info(`%c⏱ ${h(C,5)} /${h(l,5)} ms`,`
1
+ import{r as v,j as n,I as U,d as E,H as ce,S as Bn,s as Es,v as _n,w as ot,x as In,y as Ms,z as Pn,aA as ct,aB as dt,aC as qt,aD as gt,aE as ks,aF as qn,aG as Vs,a as Un,aH as As,aI as Ds,aJ as Oe,aK as Nt,aL as zs,aM as Ls,q as ee,t as de,aN as En,J as qe,aO as Hs,aP as Ts,aQ as Os,u as en,b as tn,aR as Ut,E as ke,U as Re,G as Kt,D as mt,aS as Kn,aT as nn,aU as Wn,c as ue,X as Le,i as Ve,k as Ae,l as De,m as ze,n as ve,R as Pe,V as Ee,aV as Rt,W as Me,aW as bt,aX as Ft,aY as $t,aZ as _t,a_ as It,a$ as Pt,b0 as Et,b1 as Gs,b2 as Bs,b3 as qs,b4 as Mn,b5 as Mt,b6 as kt,b7 as Vt,b8 as Us,b9 as Ks,ba as Ws,f as Xs,bb as Ys,bc as Js,C as Qs,bd as kn,be as Vn,bf as Zs,p as Ue,bg as er,bh as An,bi as tr,bj as Wt,bk as be,bl as Xn,bm as nr,au as sr,T as rr}from"./app-DaEtIZDm.js";import{c as Ce,w as or}from"./with-app-layout-BQuPyvlC.js";import{r as At}from"./ru-BTMMskhw.js";import"./use-appearance-D34fLQSc.js";function we(e,r){return typeof e=="function"?e(r):e}function te(e,r){return t=>{r.setState(s=>({...s,[e]:we(t,s[e])}))}}function ft(e){return e instanceof Function}function lr(e){return Array.isArray(e)&&e.every(r=>typeof r=="number")}function ir(e,r){const t=[],s=o=>{o.forEach(a=>{t.push(a);const u=r(a);u!=null&&u.length&&s(u)})};return s(e),t}function M(e,r,t){let s=[],o;return a=>{let u;t.key&&t.debug&&(u=Date.now());const c=e(a);if(!(c.length!==s.length||c.some((l,C)=>s[C]!==l)))return o;s=c;let d;if(t.key&&t.debug&&(d=Date.now()),o=r(...c),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){const l=Math.round((Date.now()-u)*100)/100,C=Math.round((Date.now()-d)*100)/100,w=C/16,h=(y,x)=>{for(y=String(y);y.length<x;)y=" "+y;return y};console.info(`%c⏱ ${h(C,5)} /${h(l,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,t?.key)}return o}}function k(e,r,t,s){return{debug:()=>{var o;return(o=e?.debugAll)!=null?o:e[r]},key:!1,onChange:s}}function ar(e,r,t,s){const o=()=>{var u;return(u=a.getValue())!=null?u:e.options.renderFallbackValue},a={id:`${r.id}_${t.id}`,row:r,column:t,getValue:()=>r.getValue(s),renderValue:o,getContext:M(()=>[e,t,r,a],(u,c,m,d)=>({table:u,column:c,row:m,cell:d,getValue:d.getValue,renderValue:d.renderValue}),k(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(a,t,r,e)},{}),a}function ur(e,r,t,s){var o,a;const c={...e._getDefaultColumnDef(),...r},m=c.accessorKey;let d=(o=(a=c.id)!=null?a:m?typeof String.prototype.replaceAll=="function"?m.replaceAll(".","_"):m.replace(/\./g,"_"):void 0)!=null?o:typeof c.header=="string"?c.header:void 0,l;if(c.accessorFn?l=c.accessorFn:m&&(m.includes(".")?l=w=>{let h=w;for(const x of m.split(".")){var y;h=(y=h)==null?void 0:y[x]}return h}:l=w=>w[c.accessorKey]),!d)throw new Error;let C={id:`${String(d)}`,accessorFn:l,parent:s,depth:t,columnDef:c,columns:[],getFlatColumns:M(()=>[!0],()=>{var w;return[C,...(w=C.columns)==null?void 0:w.flatMap(h=>h.getFlatColumns())]},k(e.options,"debugColumns")),getLeafColumns:M(()=>[e._getOrderColumnsFn()],w=>{var h;if((h=C.columns)!=null&&h.length){let y=C.columns.flatMap(x=>x.getLeafColumns());return w(y)}return[C]},k(e.options,"debugColumns"))};for(const w of e._features)w.createColumn==null||w.createColumn(C,e);return C}const Z="debugHeaders";function Dn(e,r,t){var s;let a={id:(s=t.id)!=null?s:r.id,column:r,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const u=[],c=m=>{m.subHeaders&&m.subHeaders.length&&m.subHeaders.map(c),u.push(m)};return c(a),u},getContext:()=>({table:e,header:a,column:r})};return e._features.forEach(u=>{u.createHeader==null||u.createHeader(a,e)}),a}const cr={createTable:e=>{e.getHeaderGroups=M(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s,o)=>{var a,u;const c=(a=s?.map(C=>t.find(w=>w.id===C)).filter(Boolean))!=null?a:[],m=(u=o?.map(C=>t.find(w=>w.id===C)).filter(Boolean))!=null?u:[],d=t.filter(C=>!(s!=null&&s.includes(C.id))&&!(o!=null&&o.includes(C.id)));return lt(r,[...c,...d,...m],e)},k(e.options,Z)),e.getCenterHeaderGroups=M(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s,o)=>(t=t.filter(a=>!(s!=null&&s.includes(a.id))&&!(o!=null&&o.includes(a.id))),lt(r,t,e,"center")),k(e.options,Z)),e.getLeftHeaderGroups=M(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(r,t,s)=>{var o;const a=(o=s?.map(u=>t.find(c=>c.id===u)).filter(Boolean))!=null?o:[];return lt(r,a,e,"left")},k(e.options,Z)),e.getRightHeaderGroups=M(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(r,t,s)=>{var o;const a=(o=s?.map(u=>t.find(c=>c.id===u)).filter(Boolean))!=null?o:[];return lt(r,a,e,"right")},k(e.options,Z)),e.getFooterGroups=M(()=>[e.getHeaderGroups()],r=>[...r].reverse(),k(e.options,Z)),e.getLeftFooterGroups=M(()=>[e.getLeftHeaderGroups()],r=>[...r].reverse(),k(e.options,Z)),e.getCenterFooterGroups=M(()=>[e.getCenterHeaderGroups()],r=>[...r].reverse(),k(e.options,Z)),e.getRightFooterGroups=M(()=>[e.getRightHeaderGroups()],r=>[...r].reverse(),k(e.options,Z)),e.getFlatHeaders=M(()=>[e.getHeaderGroups()],r=>r.map(t=>t.headers).flat(),k(e.options,Z)),e.getLeftFlatHeaders=M(()=>[e.getLeftHeaderGroups()],r=>r.map(t=>t.headers).flat(),k(e.options,Z)),e.getCenterFlatHeaders=M(()=>[e.getCenterHeaderGroups()],r=>r.map(t=>t.headers).flat(),k(e.options,Z)),e.getRightFlatHeaders=M(()=>[e.getRightHeaderGroups()],r=>r.map(t=>t.headers).flat(),k(e.options,Z)),e.getCenterLeafHeaders=M(()=>[e.getCenterFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),k(e.options,Z)),e.getLeftLeafHeaders=M(()=>[e.getLeftFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),k(e.options,Z)),e.getRightLeafHeaders=M(()=>[e.getRightFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),k(e.options,Z)),e.getLeafHeaders=M(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(r,t,s)=>{var o,a,u,c,m,d;return[...(o=(a=r[0])==null?void 0:a.headers)!=null?o:[],...(u=(c=t[0])==null?void 0:c.headers)!=null?u:[],...(m=(d=s[0])==null?void 0:d.headers)!=null?m:[]].map(l=>l.getLeafHeaders()).flat()},k(e.options,Z))}};function lt(e,r,t,s){var o,a;let u=0;const c=function(w,h){h===void 0&&(h=1),u=Math.max(u,h),w.filter(y=>y.getIsVisible()).forEach(y=>{var x;(x=y.columns)!=null&&x.length&&c(y.columns,h+1)},0)};c(e);let m=[];const d=(w,h)=>{const y={depth:h,id:[s,`${h}`].filter(Boolean).join("_"),headers:[]},x=[];w.forEach(N=>{const p=[...x].reverse()[0],R=N.column.depth===y.depth;let j,_=!1;if(R&&N.column.parent?j=N.column.parent:(j=N.column,_=!0),p&&p?.column===j)p.subHeaders.push(N);else{const $=Dn(t,j,{id:[s,h,j.id,N?.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${x.filter(b=>b.column===j).length}`:void 0,depth:h,index:x.length});$.subHeaders.push(N),x.push($)}y.headers.push(N),N.headerGroup=y}),m.push(y),h>0&&d(x,h-1)},l=r.map((w,h)=>Dn(t,w,{depth:u,index:h}));d(l,u-1),m.reverse();const C=w=>w.filter(y=>y.column.getIsVisible()).map(y=>{let x=0,N=0,p=[0];y.subHeaders&&y.subHeaders.length?(p=[],C(y.subHeaders).forEach(j=>{let{colSpan:_,rowSpan:$}=j;x+=_,p.push($)})):x=1;const R=Math.min(...p);return N=N+R,y.colSpan=x,y.rowSpan=N,{colSpan:x,rowSpan:N}});return C((o=(a=m[0])==null?void 0:a.headers)!=null?o:[]),m}const dr=(e,r,t,s,o,a,u)=>{let c={id:r,index:s,original:t,depth:o,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:m=>{if(c._valuesCache.hasOwnProperty(m))return c._valuesCache[m];const d=e.getColumn(m);if(d!=null&&d.accessorFn)return c._valuesCache[m]=d.accessorFn(c.original,s),c._valuesCache[m]},getUniqueValues:m=>{if(c._uniqueValuesCache.hasOwnProperty(m))return c._uniqueValuesCache[m];const d=e.getColumn(m);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(c._uniqueValuesCache[m]=d.columnDef.getUniqueValues(c.original,s),c._uniqueValuesCache[m]):(c._uniqueValuesCache[m]=[c.getValue(m)],c._uniqueValuesCache[m])},renderValue:m=>{var d;return(d=c.getValue(m))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>ir(c.subRows,m=>m.subRows),getParentRow:()=>c.parentId?e.getRow(c.parentId,!0):void 0,getParentRows:()=>{let m=[],d=c;for(;;){const l=d.getParentRow();if(!l)break;m.push(l),d=l}return m.reverse()},getAllCells:M(()=>[e.getAllLeafColumns()],m=>m.map(d=>ar(e,c,d,d.id)),k(e.options,"debugRows")),_getAllCellsByColumnId:M(()=>[c.getAllCells()],m=>m.reduce((d,l)=>(d[l.column.id]=l,d),{}),k(e.options,"debugRows"))};for(let m=0;m<e._features.length;m++){const d=e._features[m];d==null||d.createRow==null||d.createRow(c,e)}return c},gr={createColumn:(e,r)=>{e._getFacetedRowModel=r.options.getFacetedRowModel&&r.options.getFacetedRowModel(r,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():r.getPreFilteredRowModel(),e._getFacetedUniqueValues=r.options.getFacetedUniqueValues&&r.options.getFacetedUniqueValues(r,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=r.options.getFacetedMinMaxValues&&r.options.getFacetedMinMaxValues(r,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Yn=(e,r,t)=>{var s,o;const a=t==null||(s=t.toString())==null?void 0:s.toLowerCase();return!!(!((o=e.getValue(r))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(a))};Yn.autoRemove=e=>ie(e);const Jn=(e,r,t)=>{var s;return!!(!((s=e.getValue(r))==null||(s=s.toString())==null)&&s.includes(t))};Jn.autoRemove=e=>ie(e);const Qn=(e,r,t)=>{var s;return((s=e.getValue(r))==null||(s=s.toString())==null?void 0:s.toLowerCase())===t?.toLowerCase()};Qn.autoRemove=e=>ie(e);const Zn=(e,r,t)=>{var s;return(s=e.getValue(r))==null?void 0:s.includes(t)};Zn.autoRemove=e=>ie(e);const es=(e,r,t)=>!t.some(s=>{var o;return!((o=e.getValue(r))!=null&&o.includes(s))});es.autoRemove=e=>ie(e)||!(e!=null&&e.length);const ts=(e,r,t)=>t.some(s=>{var o;return(o=e.getValue(r))==null?void 0:o.includes(s)});ts.autoRemove=e=>ie(e)||!(e!=null&&e.length);const ns=(e,r,t)=>e.getValue(r)===t;ns.autoRemove=e=>ie(e);const ss=(e,r,t)=>e.getValue(r)==t;ss.autoRemove=e=>ie(e);const sn=(e,r,t)=>{let[s,o]=t;const a=e.getValue(r);return a>=s&&a<=o};sn.resolveFilterValue=e=>{let[r,t]=e,s=typeof r!="number"?parseFloat(r):r,o=typeof t!="number"?parseFloat(t):t,a=r===null||Number.isNaN(s)?-1/0:s,u=t===null||Number.isNaN(o)?1/0:o;if(a>u){const c=a;a=u,u=c}return[a,u]};sn.autoRemove=e=>ie(e)||ie(e[0])&&ie(e[1]);const fe={includesString:Yn,includesStringSensitive:Jn,equalsString:Qn,arrIncludes:Zn,arrIncludesAll:es,arrIncludesSome:ts,equals:ns,weakEquals:ss,inNumberRange:sn};function ie(e){return e==null||e===""}const mr={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:te("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,r)=>{e.getAutoFilterFn=()=>{const t=r.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);return typeof s=="string"?fe.includesString:typeof s=="number"?fe.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?fe.equals:Array.isArray(s)?fe.arrIncludes:fe.weakEquals},e.getFilterFn=()=>{var t,s;return ft(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(s=r.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?t:fe[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,s,o;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((s=r.options.enableColumnFilters)!=null?s:!0)&&((o=r.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=r.getState().columnFilters)==null||(t=t.find(s=>s.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,s;return(t=(s=r.getState().columnFilters)==null?void 0:s.findIndex(o=>o.id===e.id))!=null?t:-1},e.setFilterValue=t=>{r.setColumnFilters(s=>{const o=e.getFilterFn(),a=s?.find(l=>l.id===e.id),u=we(t,a?a.value:void 0);if(zn(o,u,e)){var c;return(c=s?.filter(l=>l.id!==e.id))!=null?c:[]}const m={id:e.id,value:u};if(a){var d;return(d=s?.map(l=>l.id===e.id?m:l))!=null?d:[]}return s!=null&&s.length?[...s,m]:[m]})}},createRow:(e,r)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=r=>{const t=e.getAllLeafColumns(),s=o=>{var a;return(a=we(r,o))==null?void 0:a.filter(u=>{const c=t.find(m=>m.id===u.id);if(c){const m=c.getFilterFn();if(zn(m,u.value,c))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=r=>{var t,s;e.setColumnFilters(r?[]:(t=(s=e.initialState)==null?void 0:s.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function zn(e,r,t){return(e&&e.autoRemove?e.autoRemove(r,t):!1)||typeof r>"u"||typeof r=="string"&&!r}const fr=(e,r,t)=>t.reduce((s,o)=>{const a=o.getValue(e);return s+(typeof a=="number"?a:0)},0),pr=(e,r,t)=>{let s;return t.forEach(o=>{const a=o.getValue(e);a!=null&&(s>a||s===void 0&&a>=a)&&(s=a)}),s},hr=(e,r,t)=>{let s;return t.forEach(o=>{const a=o.getValue(e);a!=null&&(s<a||s===void 0&&a>=a)&&(s=a)}),s},xr=(e,r,t)=>{let s,o;return t.forEach(a=>{const u=a.getValue(e);u!=null&&(s===void 0?u>=u&&(s=o=u):(s>u&&(s=u),o<u&&(o=u)))}),[s,o]},vr=(e,r)=>{let t=0,s=0;if(r.forEach(o=>{let a=o.getValue(e);a!=null&&(a=+a)>=a&&(++t,s+=a)}),t)return s/t},wr=(e,r)=>{if(!r.length)return;const t=r.map(a=>a.getValue(e));if(!lr(t))return;if(t.length===1)return t[0];const s=Math.floor(t.length/2),o=t.sort((a,u)=>a-u);return t.length%2!==0?o[s]:(o[s-1]+o[s])/2},Cr=(e,r)=>Array.from(new Set(r.map(t=>t.getValue(e))).values()),Sr=(e,r)=>new Set(r.map(t=>t.getValue(e))).size,yr=(e,r)=>r.length,Dt={sum:fr,min:pr,max:hr,extent:xr,mean:vr,median:wr,unique:Cr,uniqueCount:Sr,count:yr},jr={getDefaultColumnDef:()=>({aggregatedCell:e=>{var r,t;return(r=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?r:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:te("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,r)=>{e.toggleGrouping=()=>{r.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(s=>s!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,s;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((s=r.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=r.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=r.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=r.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);if(typeof s=="number")return Dt.sum;if(Object.prototype.toString.call(s)==="[object Date]")return Dt.extent},e.getAggregationFn=()=>{var t,s;if(!e)throw new Error;return ft(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(s=r.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?t:Dt[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=r=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(r),e.resetGrouping=r=>{var t,s;e.setGrouping(r?[]:(t=(s=e.initialState)==null?void 0:s.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,r)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const s=r.getColumn(t);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[t]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,r,t,s)=>{e.getIsGrouped=()=>r.getIsGrouped()&&r.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&r.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}}};function Nr(e,r,t){if(!(r!=null&&r.length)||!t)return e;const s=e.filter(a=>!r.includes(a.id));return t==="remove"?s:[...r.map(a=>e.find(u=>u.id===a)).filter(Boolean),...s]}const Rr={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:te("columnOrder",e)}),createColumn:(e,r)=>{e.getIndex=M(t=>[Ke(r,t)],t=>t.findIndex(s=>s.id===e.id),k(r.options,"debugColumns")),e.getIsFirstColumn=t=>{var s;return((s=Ke(r,t)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=t=>{var s;const o=Ke(r,t);return((s=o[o.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=r=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(r),e.resetColumnOrder=r=>{var t;e.setColumnOrder(r?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=M(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(r,t,s)=>o=>{let a=[];if(!(r!=null&&r.length))a=o;else{const u=[...r],c=[...o];for(;c.length&&u.length;){const m=u.shift(),d=c.findIndex(l=>l.id===m);d>-1&&a.push(c.splice(d,1)[0])}a=[...a,...c]}return Nr(a,t,s)},k(e.options,"debugTable"))}},zt=()=>({left:[],right:[]}),br={getInitialState:e=>({columnPinning:zt(),...e}),getDefaultOptions:e=>({onColumnPinningChange:te("columnPinning",e)}),createColumn:(e,r)=>{e.pin=t=>{const s=e.getLeafColumns().map(o=>o.id).filter(Boolean);r.setColumnPinning(o=>{var a,u;if(t==="right"){var c,m;return{left:((c=o?.left)!=null?c:[]).filter(C=>!(s!=null&&s.includes(C))),right:[...((m=o?.right)!=null?m:[]).filter(C=>!(s!=null&&s.includes(C))),...s]}}if(t==="left"){var d,l;return{left:[...((d=o?.left)!=null?d:[]).filter(C=>!(s!=null&&s.includes(C))),...s],right:((l=o?.right)!=null?l:[]).filter(C=>!(s!=null&&s.includes(C)))}}return{left:((a=o?.left)!=null?a:[]).filter(C=>!(s!=null&&s.includes(C))),right:((u=o?.right)!=null?u:[]).filter(C=>!(s!=null&&s.includes(C)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var o,a,u;return((o=s.columnDef.enablePinning)!=null?o:!0)&&((a=(u=r.options.enableColumnPinning)!=null?u:r.options.enablePinning)!=null?a:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(c=>c.id),{left:s,right:o}=r.getState().columnPinning,a=t.some(c=>s?.includes(c)),u=t.some(c=>o?.includes(c));return a?"left":u?"right":!1},e.getPinnedIndex=()=>{var t,s;const o=e.getIsPinned();return o?(t=(s=r.getState().columnPinning)==null||(s=s[o])==null?void 0:s.indexOf(e.id))!=null?t:-1:0}},createRow:(e,r)=>{e.getCenterVisibleCells=M(()=>[e._getAllVisibleCells(),r.getState().columnPinning.left,r.getState().columnPinning.right],(t,s,o)=>{const a=[...s??[],...o??[]];return t.filter(u=>!a.includes(u.column.id))},k(r.options,"debugRows")),e.getLeftVisibleCells=M(()=>[e._getAllVisibleCells(),r.getState().columnPinning.left],(t,s)=>(s??[]).map(a=>t.find(u=>u.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),k(r.options,"debugRows")),e.getRightVisibleCells=M(()=>[e._getAllVisibleCells(),r.getState().columnPinning.right],(t,s)=>(s??[]).map(a=>t.find(u=>u.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),k(r.options,"debugRows"))},createTable:e=>{e.setColumnPinning=r=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(r),e.resetColumnPinning=r=>{var t,s;return e.setColumnPinning(r?zt():(t=(s=e.initialState)==null?void 0:s.columnPinning)!=null?t:zt())},e.getIsSomeColumnsPinned=r=>{var t;const s=e.getState().columnPinning;if(!r){var o,a;return!!((o=s.left)!=null&&o.length||(a=s.right)!=null&&a.length)}return!!((t=s[r])!=null&&t.length)},e.getLeftLeafColumns=M(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(r,t)=>(t??[]).map(s=>r.find(o=>o.id===s)).filter(Boolean),k(e.options,"debugColumns")),e.getRightLeafColumns=M(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(r,t)=>(t??[]).map(s=>r.find(o=>o.id===s)).filter(Boolean),k(e.options,"debugColumns")),e.getCenterLeafColumns=M(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s)=>{const o=[...t??[],...s??[]];return r.filter(a=>!o.includes(a.id))},k(e.options,"debugColumns"))}};function Fr(e){return e||(typeof document<"u"?document:null)}const it={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Lt=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),$r={getDefaultColumnDef:()=>it,getInitialState:e=>({columnSizing:{},columnSizingInfo:Lt(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:te("columnSizing",e),onColumnSizingInfoChange:te("columnSizingInfo",e)}),createColumn:(e,r)=>{e.getSize=()=>{var t,s,o;const a=r.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:it.minSize,(s=a??e.columnDef.size)!=null?s:it.size),(o=e.columnDef.maxSize)!=null?o:it.maxSize)},e.getStart=M(t=>[t,Ke(r,t),r.getState().columnSizing],(t,s)=>s.slice(0,e.getIndex(t)).reduce((o,a)=>o+a.getSize(),0),k(r.options,"debugColumns")),e.getAfter=M(t=>[t,Ke(r,t),r.getState().columnSizing],(t,s)=>s.slice(e.getIndex(t)+1).reduce((o,a)=>o+a.getSize(),0),k(r.options,"debugColumns")),e.resetSize=()=>{r.setColumnSizing(t=>{let{[e.id]:s,...o}=t;return o})},e.getCanResize=()=>{var t,s;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((s=r.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>r.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,r)=>{e.getSize=()=>{let t=0;const s=o=>{if(o.subHeaders.length)o.subHeaders.forEach(s);else{var a;t+=(a=o.column.getSize())!=null?a:0}};return s(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const s=r.getColumn(e.column.id),o=s?.getCanResize();return a=>{if(!s||!o||(a.persist==null||a.persist(),Ht(a)&&a.touches&&a.touches.length>1))return;const u=e.getSize(),c=e?e.getLeafHeaders().map(p=>[p.column.id,p.column.getSize()]):[[s.id,s.getSize()]],m=Ht(a)?Math.round(a.touches[0].clientX):a.clientX,d={},l=(p,R)=>{typeof R=="number"&&(r.setColumnSizingInfo(j=>{var _,$;const b=r.options.columnResizeDirection==="rtl"?-1:1,z=(R-((_=j?.startOffset)!=null?_:0))*b,V=Math.max(z/(($=j?.startSize)!=null?$:0),-.999999);return j.columnSizingStart.forEach(A=>{let[W,J]=A;d[W]=Math.round(Math.max(J+J*V,0)*100)/100}),{...j,deltaOffset:z,deltaPercentage:V}}),(r.options.columnResizeMode==="onChange"||p==="end")&&r.setColumnSizing(j=>({...j,...d})))},C=p=>l("move",p),w=p=>{l("end",p),r.setColumnSizingInfo(R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},h=Fr(t),y={moveHandler:p=>C(p.clientX),upHandler:p=>{h?.removeEventListener("mousemove",y.moveHandler),h?.removeEventListener("mouseup",y.upHandler),w(p.clientX)}},x={moveHandler:p=>(p.cancelable&&(p.preventDefault(),p.stopPropagation()),C(p.touches[0].clientX),!1),upHandler:p=>{var R;h?.removeEventListener("touchmove",x.moveHandler),h?.removeEventListener("touchend",x.upHandler),p.cancelable&&(p.preventDefault(),p.stopPropagation()),w((R=p.touches[0])==null?void 0:R.clientX)}},N=_r()?{passive:!1}:!1;Ht(a)?(h?.addEventListener("touchmove",x.moveHandler,N),h?.addEventListener("touchend",x.upHandler,N)):(h?.addEventListener("mousemove",y.moveHandler,N),h?.addEventListener("mouseup",y.upHandler,N)),r.setColumnSizingInfo(p=>({...p,startOffset:m,startSize:u,deltaOffset:0,deltaPercentage:0,columnSizingStart:c,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=r=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(r),e.setColumnSizingInfo=r=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(r),e.resetColumnSizing=r=>{var t;e.setColumnSizing(r?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=r=>{var t;e.setColumnSizingInfo(r?Lt():(t=e.initialState.columnSizingInfo)!=null?t:Lt())},e.getTotalSize=()=>{var r,t;return(r=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getLeftTotalSize=()=>{var r,t;return(r=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getCenterTotalSize=()=>{var r,t;return(r=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getRightTotalSize=()=>{var r,t;return(r=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0}}};let at=null;function _r(){if(typeof at=="boolean")return at;let e=!1;try{const r={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,r),window.removeEventListener("test",t)}catch{e=!1}return at=e,at}function Ht(e){return e.type==="touchstart"}const Ir={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:te("columnVisibility",e)}),createColumn:(e,r)=>{e.toggleVisibility=t=>{e.getCanHide()&&r.setColumnVisibility(s=>({...s,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,s;const o=e.columns;return(t=o.length?o.some(a=>a.getIsVisible()):(s=r.getState().columnVisibility)==null?void 0:s[e.id])!=null?t:!0},e.getCanHide=()=>{var t,s;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((s=r.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,r)=>{e._getAllVisibleCells=M(()=>[e.getAllCells(),r.getState().columnVisibility],t=>t.filter(s=>s.column.getIsVisible()),k(r.options,"debugRows")),e.getVisibleCells=M(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,s,o)=>[...t,...s,...o],k(r.options,"debugRows"))},createTable:e=>{const r=(t,s)=>M(()=>[s(),s().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),k(e.options,"debugColumns"));e.getVisibleFlatColumns=r("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=r("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=r("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=r("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=r("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var s;e.setColumnVisibility(t?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=t=>{var s;t=(s=t)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,a)=>({...o,[a.id]:t||!(a.getCanHide!=null&&a.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var s;e.toggleAllColumnsVisible((s=t.target)==null?void 0:s.checked)}}};function Ke(e,r){return r?r==="center"?e.getCenterVisibleLeafColumns():r==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Pr={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Er={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:te("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:r=>{var t;const s=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[r.id])==null?void 0:t.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,r)=>{e.getCanGlobalFilter=()=>{var t,s,o,a;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((s=r.options.enableGlobalFilter)!=null?s:!0)&&((o=r.options.enableFilters)!=null?o:!0)&&((a=r.options.getColumnCanGlobalFilter==null?void 0:r.options.getColumnCanGlobalFilter(e))!=null?a:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>fe.includesString,e.getGlobalFilterFn=()=>{var r,t;const{globalFilterFn:s}=e.options;return ft(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(r=(t=e.options.filterFns)==null?void 0:t[s])!=null?r:fe[s]},e.setGlobalFilter=r=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(r)},e.resetGlobalFilter=r=>{e.setGlobalFilter(r?void 0:e.initialState.globalFilter)}}},Mr={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:te("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let r=!1,t=!1;e._autoResetExpanded=()=>{var s,o;if(!r){e._queue(()=>{r=!0});return}if((s=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var o,a;e.setExpanded(s?{}:(o=(a=e.initialState)==null?void 0:a.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{const u=a.split(".");s=Math.max(s,u.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,r)=>{e.toggleExpanded=t=>{r.setExpanded(s=>{var o;const a=s===!0?!0:!!(s!=null&&s[e.id]);let u={};if(s===!0?Object.keys(r.getRowModel().rowsById).forEach(c=>{u[c]=!0}):u=s,t=(o=t)!=null?o:!a,!a&&t)return{...u,[e.id]:!0};if(a&&!t){const{[e.id]:c,...m}=u;return m}return s})},e.getIsExpanded=()=>{var t;const s=r.getState().expanded;return!!((t=r.options.getIsRowExpanded==null?void 0:r.options.getIsRowExpanded(e))!=null?t:s===!0||s?.[e.id])},e.getCanExpand=()=>{var t,s,o;return(t=r.options.getRowCanExpand==null?void 0:r.options.getRowCanExpand(e))!=null?t:((s=r.options.enableExpanding)!=null?s:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let t=!0,s=e;for(;t&&s.parentId;)s=r.getRow(s.parentId,!0),t=s.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Xt=0,Yt=10,Tt=()=>({pageIndex:Xt,pageSize:Yt}),kr={getInitialState:e=>({...e,pagination:{...Tt(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:te("pagination",e)}),createTable:e=>{let r=!1,t=!1;e._autoResetPageIndex=()=>{var s,o;if(!r){e._queue(()=>{r=!0});return}if((s=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=s=>{const o=a=>we(s,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=s=>{var o;e.setPagination(s?Tt():(o=e.initialState.pagination)!=null?o:Tt())},e.setPageIndex=s=>{e.setPagination(o=>{let a=we(s,o.pageIndex);const u=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.max(0,Math.min(a,u)),{...o,pageIndex:a}})},e.resetPageIndex=s=>{var o,a;e.setPageIndex(s?Xt:(o=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?o:Xt)},e.resetPageSize=s=>{var o,a;e.setPageSize(s?Yt:(o=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?o:Yt)},e.setPageSize=s=>{e.setPagination(o=>{const a=Math.max(1,we(s,o.pageSize)),u=o.pageSize*o.pageIndex,c=Math.floor(u/a);return{...o,pageIndex:c,pageSize:a}})},e.setPageCount=s=>e.setPagination(o=>{var a;let u=we(s,(a=e.options.pageCount)!=null?a:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...o,pageCount:u}}),e.getPageOptions=M(()=>[e.getPageCount()],s=>{let o=[];return s&&s>0&&(o=[...new Array(s)].fill(null).map((a,u)=>u)),o},k(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:s<o-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},Ot=()=>({top:[],bottom:[]}),Vr={getInitialState:e=>({rowPinning:Ot(),...e}),getDefaultOptions:e=>({onRowPinningChange:te("rowPinning",e)}),createRow:(e,r)=>{e.pin=(t,s,o)=>{const a=s?e.getLeafRows().map(m=>{let{id:d}=m;return d}):[],u=o?e.getParentRows().map(m=>{let{id:d}=m;return d}):[],c=new Set([...u,e.id,...a]);r.setRowPinning(m=>{var d,l;if(t==="bottom"){var C,w;return{top:((C=m?.top)!=null?C:[]).filter(x=>!(c!=null&&c.has(x))),bottom:[...((w=m?.bottom)!=null?w:[]).filter(x=>!(c!=null&&c.has(x))),...Array.from(c)]}}if(t==="top"){var h,y;return{top:[...((h=m?.top)!=null?h:[]).filter(x=>!(c!=null&&c.has(x))),...Array.from(c)],bottom:((y=m?.bottom)!=null?y:[]).filter(x=>!(c!=null&&c.has(x)))}}return{top:((d=m?.top)!=null?d:[]).filter(x=>!(c!=null&&c.has(x))),bottom:((l=m?.bottom)!=null?l:[]).filter(x=>!(c!=null&&c.has(x)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:s,enablePinning:o}=r.options;return typeof s=="function"?s(e):(t=s??o)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:s,bottom:o}=r.getState().rowPinning,a=t.some(c=>s?.includes(c)),u=t.some(c=>o?.includes(c));return a?"top":u?"bottom":!1},e.getPinnedIndex=()=>{var t,s;const o=e.getIsPinned();if(!o)return-1;const a=(t=o==="top"?r.getTopRows():r.getBottomRows())==null?void 0:t.map(u=>{let{id:c}=u;return c});return(s=a?.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=r=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(r),e.resetRowPinning=r=>{var t,s;return e.setRowPinning(r?Ot():(t=(s=e.initialState)==null?void 0:s.rowPinning)!=null?t:Ot())},e.getIsSomeRowsPinned=r=>{var t;const s=e.getState().rowPinning;if(!r){var o,a;return!!((o=s.top)!=null&&o.length||(a=s.bottom)!=null&&a.length)}return!!((t=s[r])!=null&&t.length)},e._getPinnedRows=(r,t,s)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(t??[]).map(u=>{const c=e.getRow(u,!0);return c.getIsAllParentsExpanded()?c:null}):(t??[]).map(u=>r.find(c=>c.id===u))).filter(Boolean).map(u=>({...u,position:s}))},e.getTopRows=M(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(r,t)=>e._getPinnedRows(r,t,"top"),k(e.options,"debugRows")),e.getBottomRows=M(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(r,t)=>e._getPinnedRows(r,t,"bottom"),k(e.options,"debugRows")),e.getCenterRows=M(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(r,t,s)=>{const o=new Set([...t??[],...s??[]]);return r.filter(a=>!o.has(a.id))},k(e.options,"debugRows"))}},Ar={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:te("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=r=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(r),e.resetRowSelection=r=>{var t;return e.setRowSelection(r?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=r=>{e.setRowSelection(t=>{r=typeof r<"u"?r:!e.getIsAllRowsSelected();const s={...t},o=e.getPreGroupedRowModel().flatRows;return r?o.forEach(a=>{a.getCanSelect()&&(s[a.id]=!0)}):o.forEach(a=>{delete s[a.id]}),s})},e.toggleAllPageRowsSelected=r=>e.setRowSelection(t=>{const s=typeof r<"u"?r:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(a=>{Jt(o,a.id,s,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=M(()=>[e.getState().rowSelection,e.getCoreRowModel()],(r,t)=>Object.keys(r).length?Gt(e,t):{rows:[],flatRows:[],rowsById:{}},k(e.options,"debugTable")),e.getFilteredSelectedRowModel=M(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(r,t)=>Object.keys(r).length?Gt(e,t):{rows:[],flatRows:[],rowsById:{}},k(e.options,"debugTable")),e.getGroupedSelectedRowModel=M(()=>[e.getState().rowSelection,e.getSortedRowModel()],(r,t)=>Object.keys(r).length?Gt(e,t):{rows:[],flatRows:[],rowsById:{}},k(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const r=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let s=!!(r.length&&Object.keys(t).length);return s&&r.some(o=>o.getCanSelect()&&!t[o.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const r=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:t}=e.getState();let s=!!r.length;return s&&r.some(o=>!t[o.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var r;const t=Object.keys((r=e.getState().rowSelection)!=null?r:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const r=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:r.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>r=>{e.toggleAllRowsSelected(r.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>r=>{e.toggleAllPageRowsSelected(r.target.checked)}},createRow:(e,r)=>{e.toggleSelected=(t,s)=>{const o=e.getIsSelected();r.setRowSelection(a=>{var u;if(t=typeof t<"u"?t:!o,e.getCanSelect()&&o===t)return a;const c={...a};return Jt(c,e.id,t,(u=s?.selectChildren)!=null?u:!0,r),c})},e.getIsSelected=()=>{const{rowSelection:t}=r.getState();return rn(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=r.getState();return Qt(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=r.getState();return Qt(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof r.options.enableRowSelection=="function"?r.options.enableRowSelection(e):(t=r.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof r.options.enableSubRowSelection=="function"?r.options.enableSubRowSelection(e):(t=r.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof r.options.enableMultiRowSelection=="function"?r.options.enableMultiRowSelection(e):(t=r.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return s=>{var o;t&&e.toggleSelected((o=s.target)==null?void 0:o.checked)}}}},Jt=(e,r,t,s,o)=>{var a;const u=o.getRow(r,!0);t?(u.getCanMultiSelect()||Object.keys(e).forEach(c=>delete e[c]),u.getCanSelect()&&(e[r]=!0)):delete e[r],s&&(a=u.subRows)!=null&&a.length&&u.getCanSelectSubRows()&&u.subRows.forEach(c=>Jt(e,c.id,t,s,o))};function Gt(e,r){const t=e.getState().rowSelection,s=[],o={},a=function(u,c){return u.map(m=>{var d;const l=rn(m,t);if(l&&(s.push(m),o[m.id]=m),(d=m.subRows)!=null&&d.length&&(m={...m,subRows:a(m.subRows)}),l)return m}).filter(Boolean)};return{rows:a(r.rows),flatRows:s,rowsById:o}}function rn(e,r){var t;return(t=r[e.id])!=null?t:!1}function Qt(e,r,t){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let o=!0,a=!1;return e.subRows.forEach(u=>{if(!(a&&!o)&&(u.getCanSelect()&&(rn(u,r)?a=!0:o=!1),u.subRows&&u.subRows.length)){const c=Qt(u,r);c==="all"?a=!0:(c==="some"&&(a=!0),o=!1)}}),o?"all":a?"some":!1}const Zt=/([0-9]+)/gm,Dr=(e,r,t)=>rs(Se(e.getValue(t)).toLowerCase(),Se(r.getValue(t)).toLowerCase()),zr=(e,r,t)=>rs(Se(e.getValue(t)),Se(r.getValue(t))),Lr=(e,r,t)=>on(Se(e.getValue(t)).toLowerCase(),Se(r.getValue(t)).toLowerCase()),Hr=(e,r,t)=>on(Se(e.getValue(t)),Se(r.getValue(t))),Tr=(e,r,t)=>{const s=e.getValue(t),o=r.getValue(t);return s>o?1:s<o?-1:0},Or=(e,r,t)=>on(e.getValue(t),r.getValue(t));function on(e,r){return e===r?0:e>r?1:-1}function Se(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function rs(e,r){const t=e.split(Zt).filter(Boolean),s=r.split(Zt).filter(Boolean);for(;t.length&&s.length;){const o=t.shift(),a=s.shift(),u=parseInt(o,10),c=parseInt(a,10),m=[u,c].sort();if(isNaN(m[0])){if(o>a)return 1;if(a>o)return-1;continue}if(isNaN(m[1]))return isNaN(u)?-1:1;if(u>c)return 1;if(c>u)return-1}return t.length-s.length}const Ge={alphanumeric:Dr,alphanumericCaseSensitive:zr,text:Lr,textCaseSensitive:Hr,datetime:Tr,basic:Or},Gr={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:te("sorting",e),isMultiSortEvent:r=>r.shiftKey}),createColumn:(e,r)=>{e.getAutoSortingFn=()=>{const t=r.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const o of t){const a=o?.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return Ge.datetime;if(typeof a=="string"&&(s=!0,a.split(Zt).length>1))return Ge.alphanumeric}return s?Ge.text:Ge.basic},e.getAutoSortDir=()=>{const t=r.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,s;if(!e)throw new Error;return ft(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(s=r.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?t:Ge[e.columnDef.sortingFn]},e.toggleSorting=(t,s)=>{const o=e.getNextSortingOrder(),a=typeof t<"u"&&t!==null;r.setSorting(u=>{const c=u?.find(h=>h.id===e.id),m=u?.findIndex(h=>h.id===e.id);let d=[],l,C=a?t:o==="desc";if(u!=null&&u.length&&e.getCanMultiSort()&&s?c?l="toggle":l="add":u!=null&&u.length&&m!==u.length-1?l="replace":c?l="toggle":l="replace",l==="toggle"&&(a||o||(l="remove")),l==="add"){var w;d=[...u,{id:e.id,desc:C}],d.splice(0,d.length-((w=r.options.maxMultiSortColCount)!=null?w:Number.MAX_SAFE_INTEGER))}else l==="toggle"?d=u.map(h=>h.id===e.id?{...h,desc:C}:h):l==="remove"?d=u.filter(h=>h.id!==e.id):d=[{id:e.id,desc:C}];return d})},e.getFirstSortDir=()=>{var t,s;return((t=(s=e.columnDef.sortDescFirst)!=null?s:r.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var s,o;const a=e.getFirstSortDir(),u=e.getIsSorted();return u?u!==a&&((s=r.options.enableSortingRemoval)==null||s)&&(!(t&&(o=r.options.enableMultiRemove)!=null)||o)?!1:u==="desc"?"asc":"desc":a},e.getCanSort=()=>{var t,s;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((s=r.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,s;return(t=(s=e.columnDef.enableMultiSort)!=null?s:r.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const s=(t=r.getState().sorting)==null?void 0:t.find(o=>o.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,s;return(t=(s=r.getState().sorting)==null?void 0:s.findIndex(o=>o.id===e.id))!=null?t:-1},e.clearSorting=()=>{r.setSorting(t=>t!=null&&t.length?t.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return s=>{t&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?r.options.isMultiSortEvent==null?void 0:r.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=r=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(r),e.resetSorting=r=>{var t,s;e.setSorting(r?[]:(t=(s=e.initialState)==null?void 0:s.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Br=[cr,Ir,Rr,br,gr,mr,Pr,Er,Gr,jr,Mr,kr,Vr,Ar,$r];function qr(e){var r,t;const s=[...Br,...(r=e._features)!=null?r:[]];let o={_features:s};const a=o._features.reduce((w,h)=>Object.assign(w,h.getDefaultOptions==null?void 0:h.getDefaultOptions(o)),{}),u=w=>o.options.mergeOptions?o.options.mergeOptions(a,w):{...a,...w};let m={...{},...(t=e.initialState)!=null?t:{}};o._features.forEach(w=>{var h;m=(h=w.getInitialState==null?void 0:w.getInitialState(m))!=null?h:m});const d=[];let l=!1;const C={_features:s,options:{...a,...e},initialState:m,_queue:w=>{d.push(w),l||(l=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();l=!1}).catch(h=>setTimeout(()=>{throw h})))},reset:()=>{o.setState(o.initialState)},setOptions:w=>{const h=we(w,o.options);o.options=u(h)},getState:()=>o.options.state,setState:w=>{o.options.onStateChange==null||o.options.onStateChange(w)},_getRowId:(w,h,y)=>{var x;return(x=o.options.getRowId==null?void 0:o.options.getRowId(w,h,y))!=null?x:`${y?[y.id,h].join("."):h}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(w,h)=>{let y=(h?o.getPrePaginationRowModel():o.getRowModel()).rowsById[w];if(!y&&(y=o.getCoreRowModel().rowsById[w],!y))throw new Error;return y},_getDefaultColumnDef:M(()=>[o.options.defaultColumn],w=>{var h;return w=(h=w)!=null?h:{},{header:y=>{const x=y.header.column.columnDef;return x.accessorKey?x.accessorKey:x.accessorFn?x.id:null},cell:y=>{var x,N;return(x=(N=y.renderValue())==null||N.toString==null?void 0:N.toString())!=null?x:null},...o._features.reduce((y,x)=>Object.assign(y,x.getDefaultColumnDef==null?void 0:x.getDefaultColumnDef()),{}),...w}},k(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:M(()=>[o._getColumnDefs()],w=>{const h=function(y,x,N){return N===void 0&&(N=0),y.map(p=>{const R=ur(o,p,N,x),j=p;return R.columns=j.columns?h(j.columns,R,N+1):[],R})};return h(w)},k(e,"debugColumns")),getAllFlatColumns:M(()=>[o.getAllColumns()],w=>w.flatMap(h=>h.getFlatColumns()),k(e,"debugColumns")),_getAllFlatColumnsById:M(()=>[o.getAllFlatColumns()],w=>w.reduce((h,y)=>(h[y.id]=y,h),{}),k(e,"debugColumns")),getAllLeafColumns:M(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(w,h)=>{let y=w.flatMap(x=>x.getLeafColumns());return h(y)},k(e,"debugColumns")),getColumn:w=>o._getAllFlatColumnsById()[w]};Object.assign(o,C);for(let w=0;w<o._features.length;w++){const h=o._features[w];h==null||h.createTable==null||h.createTable(o)}return o}function Ur(){return e=>M(()=>[e.options.data],r=>{const t={rows:[],flatRows:[],rowsById:{}},s=function(o,a,u){a===void 0&&(a=0);const c=[];for(let d=0;d<o.length;d++){const l=dr(e,e._getRowId(o[d],d,u),o[d],d,a,void 0,u?.id);if(t.flatRows.push(l),t.rowsById[l.id]=l,c.push(l),e.options.getSubRows){var m;l.originalSubRows=e.options.getSubRows(o[d],d),(m=l.originalSubRows)!=null&&m.length&&(l.subRows=s(l.originalSubRows,a+1,l))}}return c};return t.rows=s(r),t},k(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Kr(e){const r=[],t=s=>{var o;r.push(s),(o=s.subRows)!=null&&o.length&&s.getIsExpanded()&&s.subRows.forEach(t)};return e.rows.forEach(t),{rows:r,flatRows:e.flatRows,rowsById:e.rowsById}}function Wr(e){return r=>M(()=>[r.getState().pagination,r.getPrePaginationRowModel(),r.options.paginateExpandedRows?void 0:r.getState().expanded],(t,s)=>{if(!s.rows.length)return s;const{pageSize:o,pageIndex:a}=t;let{rows:u,flatRows:c,rowsById:m}=s;const d=o*a,l=d+o;u=u.slice(d,l);let C;r.options.paginateExpandedRows?C={rows:u,flatRows:c,rowsById:m}:C=Kr({rows:u,flatRows:c,rowsById:m}),C.flatRows=[];const w=h=>{C.flatRows.push(h),h.subRows.length&&h.subRows.forEach(w)};return C.rows.forEach(w),C},k(r.options,"debugTable"))}function Xr(){return e=>M(()=>[e.getState().sorting,e.getPreSortedRowModel()],(r,t)=>{if(!t.rows.length||!(r!=null&&r.length))return t;const s=e.getState().sorting,o=[],a=s.filter(m=>{var d;return(d=e.getColumn(m.id))==null?void 0:d.getCanSort()}),u={};a.forEach(m=>{const d=e.getColumn(m.id);d&&(u[m.id]={sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortingFn:d.getSortingFn()})});const c=m=>{const d=m.map(l=>({...l}));return d.sort((l,C)=>{for(let h=0;h<a.length;h+=1){var w;const y=a[h],x=u[y.id],N=x.sortUndefined,p=(w=y?.desc)!=null?w:!1;let R=0;if(N){const j=l.getValue(y.id),_=C.getValue(y.id),$=j===void 0,b=_===void 0;if($||b){if(N==="first")return $?-1:1;if(N==="last")return $?1:-1;R=$&&b?0:$?N:-N}}if(R===0&&(R=x.sortingFn(l,C,y.id)),R!==0)return p&&(R*=-1),x.invertSorting&&(R*=-1),R}return l.index-C.index}),d.forEach(l=>{var C;o.push(l),(C=l.subRows)!=null&&C.length&&(l.subRows=c(l.subRows))}),d};return{rows:c(t.rows),flatRows:o,rowsById:t.rowsById}},k(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Bt(e,r){return e?Yr(e)?v.createElement(e,r):e:null}function Yr(e){return Jr(e)||typeof e=="function"||Qr(e)}function Jr(e){return typeof e=="function"&&(()=>{const r=Object.getPrototypeOf(e);return r.prototype&&r.prototype.isReactComponent})()}function Qr(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Zr(e){const r={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=v.useState(()=>({current:qr(r)})),[s,o]=v.useState(()=>t.current.initialState);return t.current.setOptions(a=>({...a,...e,state:{...s,...e.state},onStateChange:u=>{o(u),e.onStateChange==null||e.onStateChange(u)}})),t.current}const eo={visible:!1,top:0,left:0,width:0,tableWidth:0,headerHeight:0,scrollLeft:0,columnWidths:[]};function to(e){let r=e?.parentElement??null;for(;r;){const t=window.getComputedStyle(r).overflowY;if((t==="auto"||t==="scroll")&&r.scrollHeight>r.clientHeight)return r;r=r.parentElement}return null}function no(e,r){return e.visible===r.visible&&e.top===r.top&&e.left===r.left&&e.width===r.width&&e.tableWidth===r.tableWidth&&e.headerHeight===r.headerHeight&&e.scrollLeft===r.scrollLeft&&e.columnWidths.length===r.columnWidths.length&&e.columnWidths.every((t,s)=>t===r.columnWidths[s])}function so({columns:e,data:r,notFoundContent:t,globalSearch:s=!1,onGlobalSearch:o,searchValue:a,handleSearch:u,searchTxt:c,columnVisibility:m,onColumnVisibilityChange:d,columnVisibilityLabel:l,footer:C}){const w=v.useRef(null),h=v.useRef(null),y=v.useRef(null),[x,N]=v.useState(eo),p=Zr({data:r,columns:e,state:{columnVisibility:m},onColumnVisibilityChange:d,getCoreRowModel:Ur(),getPaginationRowModel:Wr(),getSortedRowModel:Xr(),enableSorting:!1,manualPagination:!0});v.useEffect(()=>{const j=w.current,_=h.current;if(!j||!_)return;const $=j.querySelector('table[data-slot="table"]'),b=to(j),z=()=>{if(!$)return;const W=_.getBoundingClientRect(),J=$.getBoundingClientRect(),D=j.getBoundingClientRect(),B=b?.getBoundingClientRect().top??0,X=b?.getBoundingClientRect().bottom??window.innerHeight,G=W.height,O={visible:W.top<B&&J.bottom>B+G&&J.top<X,top:Math.max(B,0),left:D.left,width:D.width,tableWidth:$.getBoundingClientRect().width,headerHeight:G,scrollLeft:j.scrollLeft,columnWidths:Array.from(_.querySelectorAll("th")).map(q=>q.getBoundingClientRect().width)};N(q=>no(q,O)?q:O)},V=()=>{y.current!==null&&window.cancelAnimationFrame(y.current),y.current=window.requestAnimationFrame(z)};z(),b?.addEventListener("scroll",V,{passive:!0}),j.addEventListener("scroll",V,{passive:!0}),window.addEventListener("scroll",V,{passive:!0}),window.addEventListener("resize",V);const A=new ResizeObserver(V);return A.observe(j),A.observe(_),A.observe($),()=>{y.current!==null&&window.cancelAnimationFrame(y.current),b?.removeEventListener("scroll",V),j.removeEventListener("scroll",V),window.removeEventListener("scroll",V),window.removeEventListener("resize",V),A.disconnect()}},[e,r,m]);const R=({display:j="label",align:_="start",side:$="bottom"}={})=>n.jsxs(ct,{children:[n.jsx(dt,{asChild:!0,children:n.jsxs(E,{variant:"outline",size:j==="icon"?"icon":"sm",title:l,children:[n.jsx(ce,{iconNode:qt,className:j==="icon"?"size-5":"size-4"}),j==="label"&&l]})}),n.jsxs(gt,{align:_,side:$,className:"w-56",children:[n.jsx(ks,{children:l}),n.jsx(qn,{}),p.getAllLeafColumns().filter(b=>b.getCanHide()).map(b=>n.jsx(Vs,{className:"capitalize",checked:b.getIsVisible(),onCheckedChange:z=>b.toggleVisibility(!!z),children:String(b.columnDef.meta??b.id)},b.id))]})]});return n.jsxs("div",{className:"flex flex-1 flex-col",children:[n.jsxs("div",{className:"flex flex-none flex-col",children:[s&&o&&n.jsxs("div",{className:"flex gap-2 p-2",children:[!C&&R({display:"icon"}),n.jsx(U,{type:"text",value:a,placeholder:c,className:"w-full max-w-[200px] p-2 border rounded",onChange:j=>{o(j.target.value)},onKeyDown:j=>{j.key==="Enter"&&u&&u()}}),n.jsx(E,{variant:"outline",size:"icon",onClick:u,children:n.jsx(ce,{iconNode:Bn,className:"size-5"})})]}),!s&&!C&&n.jsx("div",{className:"flex justify-start p-2",children:R()}),n.jsxs("div",{className:"relative min-h-full flex-1 overflow-hidden rounded-md border bg-background",children:[n.jsxs(Es,{className:"border-separate border-spacing-0",wrapperHeight:"min-h-full flex-1",ref:w,children:[n.jsx(_n,{ref:h,className:"bg-background shadow",children:p.getHeaderGroups().map(j=>n.jsx(ot,{className:"transition-none hover:bg-transparent",children:j.headers.map((_,$)=>{const b=[$===0?"rounded-tl-md":"",$===j.headers.length-1?"rounded-tr-md":""].filter(Boolean).join(" ");return n.jsx(In,{className:`bg-background ${b}`,children:_.isPlaceholder?null:Bt(_.column.columnDef.header,_.getContext())},_.id)})},j.id))}),n.jsx(Ms,{children:p.getRowModel().rows?.length?p.getRowModel().rows.map((j,_)=>n.jsx(ot,{"data-state":j.getIsSelected()&&"selected",children:j.getVisibleCells().map(($,b)=>{const z=j.getVisibleCells(),V=_===p.getRowModel().rows.length-1,A=[V&&b===0?"rounded-bl-md":"",V&&b===z.length-1?"rounded-br-md":""].filter(Boolean).join(" "),W=A?"bg-background":"";return n.jsx(Pn,{className:`${$.column.getIndex()===0?"sticky left-0 bg-background":""} ${A} ${W}`,children:Bt($.column.columnDef.cell,$.getContext())},$.id)})},j.id)):n.jsx(ot,{children:n.jsx(Pn,{colSpan:p.getVisibleLeafColumns().length||e.length,className:"h-24 rounded-b-md bg-background text-center",children:t})})})]}),n.jsx("div",{className:"pointer-events-none absolute inset-x-0 z-20 h-px bg-border shadow-[0_1px_0_0_var(--border)]",style:{top:h.current?.getBoundingClientRect().height??void 0}})]}),x.visible&&n.jsx("div",{className:"fixed z-50 overflow-hidden bg-background shadow-md transition-none",style:{top:x.top,left:x.left,width:x.width,height:x.headerHeight},children:n.jsx("div",{className:"transition-none",style:{width:x.tableWidth,transform:`translateX(${-x.scrollLeft}px)`},children:n.jsxs("table",{className:"caption-bottom border-separate border-spacing-0 text-sm transition-none",style:{width:x.tableWidth},children:[n.jsx("colgroup",{children:x.columnWidths.map((j,_)=>n.jsx("col",{style:{width:j}},_))}),n.jsx(_n,{className:"bg-background",children:p.getHeaderGroups().map(j=>n.jsx(ot,{className:"transition-none hover:bg-transparent",children:j.headers.map(_=>n.jsx(In,{className:"border-b bg-background shadow-[0_2px_0_0_var(--border)] transition-none",children:_.isPlaceholder?null:Bt(_.column.columnDef.header,_.getContext())},_.id))},j.id))})]})})})]}),C?.(R)]})}function ro(e,r,t,s){const o=Math.ceil(e/r),a=(t-1)*r+1,u=Math.min(t*r,e),c=[];c.push({label:"Previous",active:!1});let m=Math.max(1,t-Math.floor(s/2)),d=Math.min(o,m+s-1);d-m+1<s&&(m=Math.max(1,d-s+1));for(let l=m;l<=d;l++)c.push({label:l.toString(),active:l===t});return c.push({label:"Next",active:!1}),{total:e,per_page:r,current_page:t,last_page:o,next_page_url:t<o?!0:null,prev_page_url:t>1?!0:null,from:a,to:u,links:c,showPages:s}}const oo=({pagination:e,pageChange:r,currentPage:t})=>{const{t:s}=Un(),o=s("First"),a=s("Last"),u=s("Previous"),c=s("Next"),m=t!==1&&e.last_page>1,d=t!==e.last_page&&e.last_page>1;return n.jsx(As,{children:n.jsxs(Ds,{className:"flex-wrap",children:[n.jsx(Oe,{className:`${m?"":"opacity-40 pointer-events-none"}`,children:n.jsx(Nt,{className:"px-4 w-fit cursor-pointer bg-secondary hover:bg-muted-foreground/15",onClick:l=>{l.preventDefault(),r(1)},children:o})}),n.jsx(Oe,{children:n.jsx(zs,{label:u,className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${e.prev_page_url?"":"opacity-50 pointer-events-none"}`,onClick:l=>{l.preventDefault(),e.prev_page_url&&r(t-1)}})}),e.links.map((l,C)=>l.label==="Previous"||l.label==="Next"||l.label===u||l.label===c?null:n.jsx(Oe,{children:n.jsx(Nt,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${l.active?"!bg-primary dark:!bg-muted-foreground !text-primary-foreground dark:!text-ring":""}`,onClick:w=>{w.preventDefault();const h=parseInt(l.label);r(h)},isActive:l.active,children:l.label})},C)),n.jsx(Oe,{children:n.jsx(Ls,{label:c,className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${e.next_page_url?"":"opacity-50 pointer-events-none"}`,onClick:l=>{l.preventDefault(),e.next_page_url&&r(t+1)}})}),n.jsx(Oe,{className:`${d?"":"opacity-40 pointer-events-none"}`,children:n.jsx(Nt,{className:"px-4 w-fit cursor-pointer bg-secondary hover:bg-muted-foreground/15",onClick:l=>{l.preventDefault(),r(e.last_page)},children:a})})]})})};function lo({value:e,fieldName:r,recordId:t,modelName:s,fieldType:o,fieldConfig:a,hasDisplayModifier:u,onUpdateRecord:c}){const[m,d]=v.useState(!1),[l,C]=v.useState(e),[w,h]=v.useState(!1),y=v.useRef(null),N=["string","integer","number","range","boolean","float","email"].includes(o?.toLowerCase()||""),p=a.inlineEditable!==!1,j=new Set(["id","createdAt","updatedAt"]).has(r),_=p&&!j&&!u&&N;v.useEffect(()=>{m&&y.current&&(y.current.focus(),o!=="boolean"&&y.current instanceof HTMLInputElement&&y.current.select())},[m,o]),v.useEffect(()=>{m&&C(e)},[m,e]);const $=v.useCallback(()=>{_&&d(!0)},[_]),b=v.useCallback(async()=>{if(!(!_||w)){if(l===e){d(!1);return}h(!0);try{const D=await ee.patch(`${window.routePrefix}/model/${s}/inline/${t}`,{field:r,value:l});D.data.success&&(c(t,r,D.data.data.value),de.success("Field updated successfully"),d(!1))}catch(D){const B=D.response?.data?.error||"Failed to update field";de.error(B),C(e),d(!1)}finally{h(!1)}}},[_,w,l,e,s,t,r,c]),z=v.useCallback(()=>{C(e),d(!1)},[e]),V=v.useCallback(D=>{D.key==="Enter"?(D.preventDefault(),b()):D.key==="Escape"&&(D.preventDefault(),z())},[b,z]),A=v.useCallback(()=>{setTimeout(()=>{m&&b()},100)},[m,b]);if(!_){const D=En(e?.toString()??"");return n.jsx("div",{className:"text-center max-w-[300px] overflow-hidden text-ellipsis",dangerouslySetInnerHTML:{__html:D}})}if(o==="boolean")return m?n.jsx("div",{className:"flex items-center justify-center gap-2",children:n.jsx(qe,{checked:!!l,onCheckedChange:D=>C(!!D),onKeyDown:V,onBlur:A,disabled:w,autoFocus:!0})}):n.jsx("div",{className:"text-center max-w-[300px] overflow-hidden text-ellipsis cursor-pointer hover:bg-muted/50 rounded transition-colors",onDoubleClick:$,title:"Double-click to edit",children:e?"✓":"✗"});if(m){const D=io(o),B=ao(a);return n.jsx("div",{className:"flex items-center gap-1",children:n.jsx(U,{ref:y,type:D,value:l??"",onChange:X=>C(X.target.value),onKeyDown:V,onBlur:A,disabled:w,min:B.min,max:B.max,step:D==="number"?"any":void 0,className:"h-8 text-sm",autoFocus:!0})})}const W=e?.toString()??"",J=En(W);return n.jsx("div",{className:"text-center max-w-[300px] overflow-hidden text-ellipsis cursor-pointer hover:bg-muted/50 rounded px-1 py-0.5 transition-colors",onDoubleClick:$,title:"Double-click to edit",dangerouslySetInnerHTML:{__html:J}})}function io(e){switch(e){case"integer":case"number":case"float":return"number";case"range":return"number";case"email":return"email";default:return"text"}}function ao(e){const r=e.options;if(r&&typeof r=="object")return{min:r.min,max:r.max};const t=e.inlineValidation;return t?{min:t.min,max:t.max}:{}}function uo(e,r,t,s,o,a,u){return v.useMemo(()=>Object.entries(e).map(([c,m])=>({accessorKey:c,meta:m.title,header:()=>n.jsxs("div",{className:`flex flex-col gap-1 text-center max-w-[300px] ${m.direction?"text-chart-1":""}`,children:[n.jsxs(E,{variant:"ghost",className:"cursor-pointer hover:text-inherit",onClick:()=>{if(s){const d=m.direction==="asc"?"desc":"asc";s(m.data,d)}},children:[n.jsx("span",{className:"overflow-hidden text-ellipsis",children:m.title}),m.direction?n.jsx(ce,{iconNode:m.direction==="asc"?Hs:Ts,className:"size-3"}):n.jsx(ce,{iconNode:Os,className:"size-3"})]}),u&&o&&n.jsx("input",{type:"text",defaultValue:m.searchColumnValue,"data-column-index":c,className:"text-xs p-1 border rounded mb-2 text-foreground",onChange:d=>{o(m.data,d.target.value)},onKeyDown:d=>{d.key==="Enter"&&a&&a()}})]}),cell:({row:d})=>{const l=d.getValue(c),C=d.original?.id,w=m.type,h=m.hasDisplayModifier||!1;return n.jsx(lo,{value:l,fieldName:c,recordId:C,modelName:r,fieldType:w,fieldConfig:m,hasDisplayModifier:h,onUpdateRecord:t})}})),[e,r,t,s,u,o])}function co({header:e,initialCount:r=String(e.defaultPageSize)}){en();const t=v.useMemo(()=>e.pageSizeOptions.map(String),[e.pageSizeOptions]),s=v.useCallback(P=>P&&t.includes(P)?P:r,[t,r]),[o,a]=v.useState(!1),[u,c]=v.useState(""),[m,d]=v.useState(!1),[l,C]=v.useState(1),[w,h]=v.useState(r),[y,x]=v.useState("1"),[N,p]=v.useState("desc"),R=v.useRef([]),j=v.useRef(null),[_,$]=v.useState(0);v.useEffect(()=>{const P=new URLSearchParams(window.location.search);c(P.get("globalSearch")||""),d(!!P.get("globalSearch")),C(parseInt(P.get("page")||"1")),h(s(P.get("count"))),x(P.get("column")||"1"),p(P.get("direction")||"desc");const O=P.getAll("searchColumn"),q=P.getAll("searchColumnValue");R.current=O.map((le,pe)=>({key:le,value:q[pe]}))},[s]),v.useEffect(()=>{document.body.removeAttribute("style")},[]),v.useEffect(()=>{j.current&&setTimeout(()=>{if(j.current?.type==="column"&&j.current.columnIndex){const P=document.querySelector(`input[data-column-index="${j.current.columnIndex}"]`);P&&(P.focus(),P.select())}else if(j.current?.type==="global"){const P=document.querySelector(".flex.gap-2.p-2");if(P){const O=P.querySelector("input");O&&(O.focus(),O.select())}}j.current=null},100)},[_]);const b=v.useCallback((P,O=["data","columns","header"])=>{if(document.activeElement instanceof HTMLElement){const q=document.activeElement.getAttribute("data-column-index");q?j.current={type:"column",columnIndex:q}:document.activeElement.tagName==="INPUT"&&document.activeElement.hasAttribute("placeholder")&&(j.current={type:"global"})}a(!0),tn.visit(`${e.modelResource.uri}?${P}`,{preserveState:!0,only:O,onSuccess:()=>{a(!1),$(q=>q+1)}})},[e.modelResource.uri]),z=v.useCallback((P,O,q,le)=>{const pe=P!==void 0?P:l,ge=O!==void 0?O:N,Xe=q!==void 0?q:y,Ye=le!==void 0?le:u,ye=new URLSearchParams(window.location.search).get("filterId"),he=ye?`&filterId=${ye}`:"",ae=Xe!=="1"||ge!=="desc"?`&column=${Xe}&direction=${ge}`:"",Je=`count=${w}&page=${pe}`,Qe=Ye?`&globalSearch=${Ye}`:"",Q=R.current.map(K=>`&searchColumn=${K.key}&searchColumnValue=${K.value}`).join("");return`${Je}${ae}${Qe}${Q}${he}`},[w,l,y,N,u]),V=v.useCallback(P=>{const O=s(P);h(O),C(1);const le=new URLSearchParams(window.location.search).get("filterId"),pe=le?`&filterId=${le}`:"";b(`count=${O}&page=1${pe}`)},[b,s]),A=v.useCallback(P=>{C(P),b(z(P))},[z,b]),W=v.useCallback((P,O)=>{x(P),p(O),b(z(void 0,O,P))},[z,b]),J=v.useCallback(P=>{c(P),C(1)},[]),D=v.useCallback(()=>{b(z(1))},[z,b]),B=v.useCallback((P,O)=>{C(1);const q=R.current.findIndex(le=>le.key===P);q>=0&&R.current.splice(q,1),O&&R.current.push({key:P,value:O})},[]),X=v.useCallback(()=>{d(!1),c(""),R.current=[],C(1),x("1"),p("desc"),b(`count=${w}&page=1`)},[w,b]),G=v.useCallback(()=>{m?X():d(!0)},[m,X]);return{loading:o,searchValue:u,showSearch:m,currentPage:l,count:w,sortColumn:y,sortDirection:N,queryColumnsRef:R,changeCount:V,handlePageChange:A,handleCustomSort:W,handleGlobalSearch:J,handleSearch:D,handleColumnSearch:B,resetForm:X,toggleSearch:G,setSearchValue:c,setShowSearch:d,setCurrentPage:C,setCount:h,buildQueryString:z}}function We(e){const{t:r}=Un();return{t:r,loading:!1}}function go({modelName:e,onApplyFilter:r,onEditFilter:t,onDeleteFilter:s,activeFilterId:o,user:a}){const[u,c]=v.useState([]),[m,d]=v.useState(!1),{t:l}=We();v.useEffect(()=>{C();const p=()=>{C()};return window.addEventListener("adminizer:filterChanged",p),()=>{window.removeEventListener("adminizer:filterChanged",p)}},[e]);const C=async()=>{d(!0);try{const p=await ee.get(`${window.routePrefix}/model/${e}/saved-filters`);c(p.data.filters||[])}catch(p){if(console.error("Error loading saved filters:",p),p.response?.status===401){console.error("Session expired, redirecting to login..."),window.location.href=`${window.routePrefix}/model/User/login`;return}}finally{d(!1)}},w=p=>{r?.(p)},h=async p=>{try{await ee.delete(`${window.routePrefix}/model/${e}/filter/${p.id}`),s?.(p.id),C()}catch(R){if(console.error("Error deleting filter:",R),R.response?.status===401){console.error("Session expired, redirecting to login..."),window.location.href=`${window.routePrefix}/model/User/login`;return}if(R.response?.status===403){alert(l("No permission to delete filter"));return}}},y=async p=>{try{const _=((await ee.get(`${window.routePrefix}/model/${e}/saved-filters`)).data?.filters||[]).find($=>String($.id)===String(p.id));t?.(_||p)}catch(R){console.error("Error loading fresh filter for edit:",R),t?.(p)}},x=p=>!!(a?.isAdministrator||p.ownerId&&a?.id&&p.ownerId===a.id||p.owner&&a?.id&&p.owner.id===a.id||p.ownerInfo&&a?.id&&p.ownerInfo.id===a.id),N=p=>!!p&&/^[a-z0-9_]+$/i.test(p);return m?n.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:l("Loading filters...")}):u.length===0?n.jsxs("div",{className:"py-4 text-center text-sm text-muted-foreground",children:[n.jsx(Ut,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),n.jsx("p",{children:l("No saved filters")}),n.jsx("p",{className:"text-xs mt-1",children:l("Save current filter for quick access")})]}):n.jsx("div",{className:"space-y-2 py-2",children:u.map(p=>{const R=x(p),j=p.ownerId===a?.id||p.owner?.id===a?.id||p.ownerInfo?.id===a?.id;return n.jsxs("div",{className:ue("flex items-center gap-2 p-2 rounded-md border transition-colors","hover:bg-accent/50",o===p.id&&"bg-accent/70 border-accent"),children:[n.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 cursor-pointer",onClick:()=>w(p),children:[p.icon&&n.jsx("span",{className:"h-6 w-6 flex items-center justify-center text-muted-foreground",children:N(p.icon)?n.jsx(Ce,{name:p.icon,className:"!text-[18px]"}):n.jsx("span",{className:"text-lg leading-none",children:p.icon})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"font-medium text-sm truncate",children:p.name}),p.visibility==="private"&&n.jsx("span",{title:j?l("Private filter"):`${l("Someone else's private filter (owner:")} ${p.ownerInfo?.fullName||p.ownerInfo?.login||l("unknown)")}`,children:n.jsx(ke,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"})}),p.visibility==="groups"&&n.jsx("span",{title:l("For groups"),children:n.jsx(Re,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"})}),p.visibility==="public"&&n.jsx("span",{title:l("Public filter"),children:n.jsx(Kt,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"})})]}),p.description&&n.jsx("div",{className:"text-xs text-muted-foreground truncate",children:p.description}),!j&&p.visibility==="private"&&p.ownerInfo&&n.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[l("Owner"),": ",p.ownerInfo.fullName||p.ownerInfo.login]})]})]}),p.resultCount!==void 0&&p.resultCount>=0&&n.jsx(mt,{variant:"secondary",className:"text-xs",children:p.resultCount}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(E,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:_=>{_.stopPropagation(),w(p)},title:l("Apply filter"),children:n.jsx(Kn,{className:"h-3.5 w-3.5"})}),R&&n.jsxs(n.Fragment,{children:[n.jsx(E,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:_=>{_.stopPropagation(),y(p)},title:l("Edit"),children:n.jsx(nn,{className:"h-3.5 w-3.5"})}),n.jsx(Wn,{btnTitle:"",delModal:{yes:l("Yes"),no:l("No"),text:`${l("Delete filter")} "${p.name}"?`},handleDelete:()=>{h(p)},isLink:!1,variant:"ghost",btnCLass:"h-7 w-7 p-0 text-destructive hover:text-destructive"})]})]})]},p.id)})})}function Ln({groups:e,selectedGroupIds:r,onGroupsChange:t,modelName:s}){const[o,a]=v.useState(!1),{t:u}=We(),c=d=>{r.includes(d)?t(r.filter(l=>l!==d)):t([...r,d])},m=()=>e.filter(d=>r.includes(d.id)).map(d=>d.name);return e.length===0?null:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx(Re,{className:"h-4 w-4"}),n.jsx("span",{children:u("Access for groups")})]}),r.length>0&&n.jsx("div",{className:"flex flex-wrap gap-1.5",children:m().map((d,l)=>n.jsxs(mt,{variant:"secondary",className:"text-xs",children:[d,n.jsx("button",{type:"button",className:"ml-1 hover:text-destructive",onClick:()=>{const C=e.find(w=>w.name===d);C&&c(C.id)},children:n.jsx(Le,{className:"h-3 w-3"})})]},l))}),n.jsx("div",{className:"border rounded-lg p-3 space-y-2",children:e.map(d=>n.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>c(d.id),children:[n.jsx(qe,{checked:r.includes(d.id),onCheckedChange:()=>c(d.id)}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:d.name}),d.description&&n.jsx("div",{className:"text-xs text-muted-foreground",children:d.description})]})]},d.id))})]})}const oe="temporary",mo="manage-group-filter-visibility",fo=(e,r)=>!e||!Array.isArray(e.groups)?!1:e.groups.some(t=>Array.isArray(t?.tokens)&&t.tokens.includes(r)),po=e=>e||(typeof window>"u"?"/":`${window.location.pathname}${window.location.search}`),Hn=e=>{const r=typeof window<"u"?window.location.origin:"http://localhost";return new URL(po(e),r)},ho=e=>{const r=e.split("/"),t=r.findIndex(s=>s==="model");return t!==-1&&t+1<r.length?r[t+1]:""},xo=e=>{if(!(!e||e==="null"||e==="undefined"))return e},vo=e=>{const r=v.useMemo(()=>{const o=Hn(e);return{modelName:ho(o.pathname),activeFilterId:xo(o.searchParams.get("filterId")),pathname:o.pathname,searchParams:o.searchParams}},[e]),t=v.useCallback(o=>{const a=Hn(e);o?a.searchParams.set("filterId",o):a.searchParams.delete("filterId"),tn.get(a.pathname,Object.fromEntries(a.searchParams),{preserveState:!0,preserveScroll:!0})},[e]),s=v.useCallback(()=>{t(void 0)},[t]);return{modelName:r.modelName,activeFilterId:r.activeFilterId,setActiveFilterId:t,clearActiveFilter:s}},ut=e=>!e||typeof e!="object"?null:{name:String(e.name||""),conditionCount:typeof e.conditionCount=="number"?e.conditionCount:Array.isArray(e.conditions)?e.conditions.length:0,isModified:!!e.isModified},Be=e=>`temporaryFilter_${e}`,Tn=["filter_alt","bookmark","star","push_pin","search","bolt","favorite","local_offer","list_alt","tune"];function wo({onApplyFilters:e}){const r=en(),t=r.props?.auth?.user,s=t?.isAdministrator===!0,o=s||fo(t,mo),a=r.props?.activeFilter,{modelName:u,activeFilterId:c,setActiveFilterId:m,clearActiveFilter:d}=vo(r.url),{t:l}=We(),[C,w]=v.useState([]),[h,y]=v.useState([]),[x,N]=v.useState(""),[p,R]=v.useState(null),[j,_]=v.useState("placeholder"),[$,b]=v.useState(!1),[z,V]=v.useState(null),[A,W]=v.useState({name:"",description:"",icon:"bookmark",color:"#3b82f6"}),[J,D]=v.useState(!1),[B,X]=v.useState(!1),[G,P]=v.useState(""),[O,q]=v.useState(void 0),[le,pe]=v.useState(!1),[ge,Xe]=v.useState([]),[Ye,pt]=v.useState(!1),[ye,he]=v.useState([]),[xe,ae]=v.useState([]),[Je,Qe]=v.useState(""),Q=v.useRef(null),[K,He]=v.useState({name:"",description:"",icon:"bookmark",color:"#3b82f6"}),[Ze,ht]=v.useState(!1),[xt,ln]=v.useState(void 0),[me,je]=v.useState("private"),[ne,Ne]=v.useState("private"),[an,un]=v.useState([]),[cn,dn]=v.useState([]),[et,ls]=v.useState([]),[Te,se]=v.useState("edit"),is=async()=>{pt(!0),Qe("");try{const i=p?.id||(c===oe?oe:void 0);let g=`${window.routePrefix}/model/${u}/columns`;i&&(g+=`?filterId=${i}`);const f=await ee.get(g),{availableColumns:S,filterColumns:F,hasFilterConfig:I}=f.data;if(I&&F.length>0){const T=new Map(S.map(Y=>[Y.fieldName,Y])),L=[],re=[],_e=[...F].sort((Y,Ie)=>Y.order-Ie.order);for(const Y of _e){const Ie=T.get(Y.fieldName);Ie&&L.push({...Ie,order:Y.order})}for(const[Y,Ie]of T)L.find(Ps=>Ps.fieldName===Y)||re.push({...Ie,order:L.length+re.length});ae(L),he(re)}else{const T=S.map((L,re)=>({...L,order:re}));ae(T),he([])}}catch(i){console.error("Error loading columns:",i),Qe(i.response?.data?.error||i.message||l("Error loading columns"))}finally{pt(!1)}},gn=()=>{se("columns"),is()},as=()=>{const i=xe.map((g,f)=>({...g,order:f}));Xe(i),se("edit")},us=i=>{he(g=>g.filter(f=>f.fieldName!==i.fieldName)),ae(g=>[...g,{...i,order:g.length}])},cs=i=>{ae(g=>g.filter(f=>f.fieldName!==i.fieldName)),he(g=>[...g,{...i,order:g.length}])},ds=()=>{ae(i=>[...i,...ye.map((g,f)=>({...g,order:i.length+f}))]),he([])},gs=()=>{he(i=>[...i,...xe.map((g,f)=>({...g,order:i.length+f}))]),ae([])},ms=i=>{i!==0&&ae(g=>{const f=[...g];return[f[i-1],f[i]]=[f[i],f[i-1]],f.map((S,F)=>({...S,order:F}))})},fs=i=>{i>=xe.length-1||ae(g=>{const f=[...g];return[f[i],f[i+1]]=[f[i+1],f[i]],f.map((S,F)=>({...S,order:F}))})},[mn,fn]=v.useState(!1),[pn,hn]=v.useState(!1),[xn,vn]=v.useState(!1),wn=v.useRef(null),tt=v.useMemo(()=>new Map(h.map(i=>[i.id,i])),[h]),nt=v.useMemo(()=>new Set(C.map(i=>i.fieldId)),[C]);v.useEffect(()=>{const i=wn.current;i&&(i.modelName!==u||i.activeFilterId!==c)&&(!c||i?.modelName!==u)&&(w([]),N(""),R(null),se("edit")),wn.current={modelName:u,activeFilterId:c}},[c,u]),v.useEffect(()=>{if(!u){b(!1),V(null);return}const i=Be(u),g=sessionStorage.getItem(i);if(!g){const f=c===oe&&a?.id===oe?a:null;if(f){const S=ut(f);b(!!S),V(S),N(S?.name||""),S&&sessionStorage.setItem(i,JSON.stringify(S));return}b(!1),V(null),c===oe&&d();return}try{const f=JSON.parse(g),S=ut(f);if(!S)throw new Error("Invalid temporary filter metadata");V(S),N(S.name),b(!0),Array.isArray(f.conditions)&&sessionStorage.setItem(i,JSON.stringify(S))}catch(f){console.error("Error loading temporary filter:",f),sessionStorage.removeItem(i),b(!1),V(null),c===oe&&d()}},[a,c,d,u]),v.useEffect(()=>{(async()=>{try{if(!u){console.error("Could not find modelResource in URL");return}const f=(await ee.get(`${window.routePrefix}/model/${u}/filter-fields`)).data;y(f.fields||[])}catch(g){console.error("Error loading filter fields:",g)}})()},[u]),v.useEffect(()=>{(async()=>{if(o)try{const g=await ee.get(`${window.routePrefix}/groups`);ls(g.data.groups||[])}catch(g){console.error("Error loading groups:",g)}})()},[o]),v.useEffect(()=>(window.adminizerFilterPanel={openFilterDialog:()=>ps(),openSaveFilterDialog:()=>handleOpenSaveDialog(),openEditCurrentFilter:i=>hs(i),getModelName:()=>u,getActiveFilterId:()=>c,hasTemporaryFilter:()=>$},()=>{delete window.adminizerFilterPanel}),[u,c,$]);const ps=()=>{se("edit"),Q.current?.open()},hs=async i=>{const g=i||c;if(!(!g||!u)){if(g==="temporary"){yn();return}se("edit"),Q.current?.open();try{const F=((await ee.get(`${window.routePrefix}/model/${u}/saved-filters`)).data?.filters||[]).find(I=>String(I.id)===String(g));if(!F)return;Rn(F)}catch(f){console.error("Error loading filter for edit:",f)}}},Cn=()=>c!==oe||a?.id!==oe?null:{name:a.name,conditions:Array.isArray(a.conditions)?a.conditions:[],columns:a.columns},Sn=async()=>{if(!u)return null;try{const g=(await ee.get(`${window.routePrefix}/model/${u}/filter/temporary`)).data?.filter;return g?{name:g.name,conditions:g.conditions||[],columns:g.columns}:Cn()}catch(i){return i.response?.status===404?(sessionStorage.removeItem(Be(u)),b(!1),V(null)):console.error("Error loading temporary filter:",i),Cn()}},yn=async()=>{const i=await Sn();if(i){const g=ut(i);se("edit"),R(null),V(g),N(i.name),$e({conditions:i.conditions}),Q.current?.open(),requestAnimationFrame(()=>{Q.current?.next()})}},xs=()=>{m(oe),Q.current?.close(),window.dispatchEvent(new CustomEvent("adminizer:filterChanged"))},vs=async()=>{if(C.length===0){const i=await Sn();if(i){$e({conditions:i.conditions});const g=ut(i);V(g),N(i.name)}}W({name:"",description:"",icon:"bookmark",color:"#3b82f6"}),je("private"),un([]),D(!1),P(""),se("save"),jn(),Q.current?.next()},jn=async()=>{if(!O)try{const i=await ee.get(`${window.routePrefix}/api/user-key`);q(i.data.apiKey)}catch(i){console.error("Failed to load user API key:",i)}},Nn=async(i,g)=>{try{await navigator.clipboard.writeText(i),de.success(`${g} ${l("copied to clipboard")}`)}catch{de.error(l("Failed to copy"))}},vt=i=>Array.isArray(i)?i.map(g=>vt(g)):i instanceof Date?i.toISOString():i&&typeof i=="object"?Object.fromEntries(Object.entries(i).map(([g,f])=>[g,vt(f)])):i,Fe=v.useCallback(i=>typeof i=="object"&&i!==null&&!Array.isArray(i)&&!(i instanceof Date),[]),st=v.useCallback(i=>i?.customFilterInputConfig?Object.entries(i.customFilterInputConfig).slice(0,3):[],[]),wt=v.useCallback((i,g)=>{const f=st(i);if(f.length===0)return Fe(g)?"":g??"";const S=Fe(g)?g:f.length===1&&g!==void 0&&g!==null?{[f[0][0]]:g}:{};return Object.fromEntries(f.map(([F])=>[F,S[F]??""]))},[st,Fe]),Ct=i=>{const g=vt(i.value);if(i.customHandler&&i.condition==="custom"){const f=tt.get(i.fieldId);return{id:i.id,field:i.fieldId,customHandler:i.customHandler,customHandlerName:f?.customFilterConditionLabel,operator:"custom",value:g}}return{id:i.id,...i.relationField?{relation:i.fieldId,relationField:i.relationField}:{field:i.fieldId},operator:i.condition,value:g}},ws=async()=>{if(!A.name.trim()){P(l("Enter filter name"));return}X(!0),P("");try{const i=C.filter(F=>F.enabled).map(Ct),g={name:A.name.trim(),description:A.description?.trim()||void 0,conditions:i,icon:A.icon||"bookmark",color:A.color||"#3b82f6",visibility:me,groupIds:me==="groups"?an:void 0};ge.length>0&&(g.columns=ge.map((F,I)=>({fieldName:F.fieldName,order:I})));const S=(await ee.post(`${window.routePrefix}/model/${u}/filter`,g)).data.filter;sessionStorage.removeItem(Be(u)),b(!1),V(null),w([]),R(null),N(""),se("edit"),Q.current?.prev(),window.dispatchEvent(new CustomEvent("adminizer:filterChanged")),St({id:String(S.id),name:S.name||A.name.trim(),conditions:S.conditions||i,icon:S.icon,color:S.color})}catch(i){console.error("Error saving filter:",i),P(i.response?.data?.error||l("Error saving filter"))}finally{X(!1)}},Cs=()=>{sessionStorage.removeItem(Be(u)),b(!1),V(null),N(""),w([]),window.dispatchEvent(new CustomEvent("adminizer:filterChanged")),d(),Q.current?.close()},$e=v.useCallback(i=>{const g=I=>{if(!I)return;const T=h.find(re=>re.isCustomFilter&&re.customFilterHandlerId===I);if(T)return T.id;const L=I.split(".");return L[L.length-1]},f=(I,T)=>{const L=h.find(_e=>_e.id===T);return L?L.isRelation?(L.relationFields||[]).find(_e=>_e.id===I.relationField)?.type:L.type:void 0},S=(I,T)=>{const L=I.value;if(L==null)return"";if(I.customHandler)return L;const re=f(I,T);return re==="date"||re==="datetime"?["month","year","monthBetween","yearBetween"].includes(I.operator)?Array.isArray(L)?L.map(Y=>Y==null?"":String(Y)):String(L):Array.isArray(L)?L.map(Y=>typeof Y=="string"&&!isNaN(Date.parse(Y))?new Date(Y):Y):typeof L=="string"&&!isNaN(Date.parse(L))?new Date(L):L:L},F=i.conditions.map(I=>{const T=I.field||I.relation||g(I.customHandler)||"",L=S(I,T);return{id:I.id||`filter-${Date.now()}-${Math.random()}`,fieldId:T,relationField:I.relationField,customHandler:I.customHandler,enabled:!0,condition:I.operator||(I.customHandler?"custom":"eq"),value:L??""}});w(F)},[h]),Ss=async i=>{if(!u){console.error("[FilterPanel] Model name is not set!"),alert(l("Error")+": "+l("Model not found"));return}try{const g=i.filter(I=>I.enabled).map(Ct),f={name:x||l("Temporary filter"),conditions:g};ge.length>0&&(f.columns=ge.map((I,T)=>({fieldName:I.fieldName,order:T}))),(await ee.post(`${window.routePrefix}/model/${u}/filter/apply`,f)).data.success&&(sessionStorage.setItem(Be(u),JSON.stringify({name:f.name,conditionCount:f.conditions.length,isModified:!1})),V({name:f.name,conditionCount:f.conditions.length,isModified:!1}),b(!0),N(f.name),w(i),m(oe),Q.current?.close(),window.dispatchEvent(new CustomEvent("adminizer:filterChanged")))}catch(g){if(console.error("[FilterPanel] Error applying filter:",g),g.response?.status===401){console.error("Session expired, redirecting to login..."),window.location.href=`${window.routePrefix}/model/User/login`;return}alert(l("Error applying filter")+": "+(g.response?.data?.error||g.message))}},ys=async()=>{if(!K.name.trim()){P(l("Enter filter name"));return}X(!0),P("");try{const i=C.filter(F=>F.enabled).map(Ct),g={filterId:p.id,name:K.name.trim(),description:K.description?.trim()||void 0,conditions:i,icon:K.icon||"bookmark",color:K.color||"#3b82f6",visibility:ne,groupIds:ne==="groups"?cn:void 0,sortField:p.sortField,sortDirection:p.sortDirection};ne==="private"&&(g.apiEnabled=Ze,g.regenerateApiKey=Ze&&!xt),ge.length>0&&(g.columns=ge.map((F,I)=>({fieldName:F.fieldName,order:I})));const S=(await ee.post(`${window.routePrefix}/model/${u}/filter`,g)).data.filter;N(S.name),R(null),w([]),se("edit"),Q.current?.prev(),window.dispatchEvent(new CustomEvent("adminizer:filterChanged")),St({id:String(S.id),name:S.name||K.name.trim(),conditions:S.conditions||i,icon:S.icon,color:S.color})}catch(i){console.error("Error updating filter:",i),P(i.response?.data?.error||l("Error saving filter"))}finally{X(!1)}},St=v.useCallback(i=>{m(i.id),N(i.name),$e({conditions:i.conditions}),window.dispatchEvent(new CustomEvent("adminizer:filterChanged"))},[$e,m]),yt=v.useCallback(()=>{w([]),N(""),window.dispatchEvent(new CustomEvent("adminizer:filterChanged")),d()},[d]),Rn=v.useCallback(i=>{R(i),N(i.name),He({name:i.name,description:i.description||"",icon:i.icon||"bookmark",color:i.color||"#3b82f6"});const g=i.visibility||"private";Ne(!s&&g==="public"?"private":g),dn(i.groupIds||[]),ht(i.apiEnabled||!1),ln(i.apiKey||void 0),jn(),$e({conditions:i.conditions}),se("edit"),Q.current?.next()},[s,$e]),js=v.useCallback(i=>{c===i&&yt()},[c,yt]),bn=()=>{const i=new Date,g=String(i.getMonth()+1).padStart(2,"0");return`${i.getFullYear()}-${g}`},Fn=()=>String(new Date().getFullYear()),Ns=(i,g,f)=>{if(i==="custom"&&f?.isCustomFilter)return wt(f,g);if(Fe(g)||i==="isNull"||i==="isNotNull"||i==="today")return"";if(i==="between")return Array.isArray(g)&&g.length===2?g:["",""];if(i==="month")return typeof g=="string"&&/^\d{4}-\d{2}$/.test(g)?g:bn();if(i==="year")return typeof g=="string"&&/^\d{4}$/.test(g)?g:typeof g=="number"?String(g):Fn();if(i==="monthBetween"){if(Array.isArray(g)&&g.length===2&&typeof g[0]=="string"&&/^\d{4}-\d{2}$/.test(g[0])&&typeof g[1]=="string"&&/^\d{4}-\d{2}$/.test(g[1]))return g;const S=bn();return[S,S]}if(i==="yearBetween"){const S=I=>typeof I=="string"&&/^\d{4}$/.test(I)||typeof I=="number";if(Array.isArray(g)&&g.length===2&&S(g[0])&&S(g[1]))return[String(g[0]),String(g[1])];const F=Fn();return[F,F]}return g},H=v.useCallback((i,g)=>{w(f=>f.map(S=>S.id===i?{...S,...g}:S)),$&&V(f=>f&&{...f,isModified:!0})},[$]),Rs=v.useCallback(i=>{if(nt.has(i)){_("placeholder");return}const g=tt.get(i);if(!g)return;const f=g.isCustomFilter?"custom":"eq",S=f==="custom"?wt(g,""):"",F={id:Date.now().toString(),fieldId:i,relationField:g.isRelation?g.relationFields?.[0]?.id:void 0,customHandler:g.isCustomFilter?g.customFilterHandlerId:void 0,enabled:!0,condition:f,value:S},I=[...C,F];w(I),_("placeholder"),$&&V(T=>T&&{...T,conditionCount:I.length,isModified:!0})},[nt,C,tt,wt,$]),bs=v.useCallback(i=>{w(g=>{const f=g.filter(S=>S.id!==i);return $&&V(S=>S&&{...S,conditionCount:f.length,isModified:!0}),f})},[$]),Fs=v.useCallback(()=>{Q.current?.close(),R(null)},[]),$s=v.useCallback((i,g)=>{if(!g.isRelation)return g;if(!g.relationFields||g.relationFields.length===0)return null;const f=g.relationFields.find(S=>S.id===i.relationField)||g.relationFields[0];return{id:f.id,label:f.label,type:f.type,options:f.options,isCustomFilter:!1}},[]),rt=v.useMemo(()=>[{value:"eq",label:l("Equal")},{value:"neq",label:l("Not equal")},{value:"like",label:l("Contains")},{value:"startsWith",label:l("Starts with")},{value:"endsWith",label:l("Ends with")},{value:"isNull",label:l("Is empty")},{value:"isNotNull",label:l("Is not empty")}],[l]),$n=v.useMemo(()=>{const i=new Map;return h.forEach(g=>{if(g.isRelation){i.set(g.id,[{value:"eq",label:l("Equal")},{value:"neq",label:l("Not equal")}]);return}let f=[];switch(g.type){case"number":case"integer":case"float":f=[{value:"eq",label:l("Equal")},{value:"neq",label:l("Not equal")},{value:"gt",label:l("Greater than")},{value:"gte",label:l("Greater or equal")},{value:"lt",label:l("Less than")},{value:"lte",label:l("Less or equal")},{value:"between",label:l("Between")},{value:"isNull",label:l("Is empty")},{value:"isNotNull",label:l("Is not empty")}];break;case"date":case"datetime":f=[{value:"eq",label:l("Equal")},{value:"neq",label:l("Not equal")},{value:"gt",label:l("After")},{value:"gte",label:l("After or equal")},{value:"lt",label:l("Before")},{value:"lte",label:l("Before or equal")},{value:"between",label:l("Between")},{value:"today",label:l("Today")},{value:"month",label:l("Month")},{value:"year",label:l("Year")},{value:"monthBetween",label:l("Month range")},{value:"yearBetween",label:l("Year range")},{value:"isNull",label:l("Is empty")},{value:"isNotNull",label:l("Is not empty")}];break;case"boolean":f=[{value:"eq",label:l("Equal")},{value:"neq",label:l("Not equal")},{value:"isNull",label:l("Is empty")},{value:"isNotNull",label:l("Is not empty")}];break;case"select":case"select-many":case"association":case"association-many":f=[{value:"eq",label:l("Equal")},{value:"neq",label:l("Not equal")},{value:"in",label:l("In list")},{value:"notIn",label:l("Not in list")},{value:"isNull",label:l("Is empty")},{value:"isNotNull",label:l("Is not empty")}];break;case"json":case"jsoneditor":case"object":case"array":f=[{value:"isNull",label:l("Is empty")},{value:"isNotNull",label:l("Is not empty")}];break;default:f=[...rt];break}g.isCustomFilter&&g.customFilterHandlerId&&(f=[...f,{value:"custom",label:g.customFilterConditionLabel||l("Custom filtering")}]),i.set(g.id,f)}),i},[h,rt,l]),_s=v.useCallback(i=>$n.get(i)||rt,[$n,rt]),jt=v.useMemo(()=>h.filter(i=>!nt.has(i.id)),[nt,h]),Is=v.useCallback((i,g)=>{if(g.isCustomFilter&&i.condition==="custom"){const f=st(g);if(f.length>0){const S=Fe(i.value)?i.value:f.length===1&&i.value!==void 0&&i.value!==null?{[f[0][0]]:i.value}:{};return n.jsx("div",{className:"flex gap-1 flex-wrap",children:f.map(([F,I])=>n.jsx(U,{type:I.type||"text",value:String(S[F]??""),onChange:T=>H(i.id,{value:{...S,[F]:T.target.value}}),placeholder:I.placeholder||F,className:"w-full sm:w-[150px] h-9"},F))})}return n.jsx(U,{type:"text",value:String(i.value??""),onChange:S=>H(i.id,{value:S.target.value}),placeholder:l("Value..."),className:"w-full sm:w-[220px] h-9"})}if(i.condition==="isNull"||i.condition==="isNotNull"||i.condition==="today")return null;if(g.type==="boolean")return n.jsxs(Ve,{value:i.value===!0?"true":i.value===!1?"false":"",onValueChange:f=>H(i.id,{value:f==="true"?!0:f==="false"?!1:null}),children:[n.jsx(Ae,{className:"w-full sm:w-[120px] h-9",size:"sm",children:n.jsx(De,{placeholder:l("Select...")})}),n.jsxs(ze,{className:"z-[1100]",children:[n.jsx(ve,{value:"true",children:l("Yes")}),n.jsx(ve,{value:"false",children:l("No")})]})]});if(g.type==="number"||g.type==="integer"||g.type==="float"){if(i.condition==="between"){const f=Array.isArray(i.value)?i.value:["",""];return n.jsxs("div",{className:"flex gap-1 flex-wrap",children:[n.jsx(U,{type:"number",value:f[0],onChange:S=>H(i.id,{value:[parseFloat(S.target.value)||"",f[1]]}),placeholder:l("From..."),className:"w-full sm:w-[120px] h-9"}),n.jsx("span",{className:"flex items-center text-muted-foreground",children:"-"}),n.jsx(U,{type:"number",value:f[1],onChange:S=>H(i.id,{value:[f[0],parseFloat(S.target.value)||""]}),placeholder:l("To..."),className:"w-full sm:w-[120px] h-9"})]})}return n.jsx(U,{type:"number",value:i.value,onChange:f=>H(i.id,{value:parseFloat(f.target.value)||""}),placeholder:l("Value..."),className:"w-full sm:w-[150px] h-9"})}if((g.type==="date"||g.type==="datetime")&&i.condition==="month")return n.jsx(U,{type:"month",value:typeof i.value=="string"?i.value:"",onChange:f=>H(i.id,{value:f.target.value}),className:"w-full sm:w-[160px] h-9"});if((g.type==="date"||g.type==="datetime")&&i.condition==="year")return n.jsx(U,{type:"number",min:1900,max:9999,step:1,value:typeof i.value=="string"||typeof i.value=="number"?i.value:"",onChange:f=>H(i.id,{value:f.target.value}),placeholder:l("Year"),className:"w-full sm:w-[130px] h-9"});if((g.type==="date"||g.type==="datetime")&&i.condition==="monthBetween"){const f=Array.isArray(i.value)?i.value:["",""];return n.jsxs("div",{className:"flex gap-1 flex-wrap",children:[n.jsx(U,{type:"month",value:typeof f[0]=="string"?f[0]:"",onChange:S=>H(i.id,{value:[S.target.value,f[1]]}),className:"w-full sm:w-[160px] h-9"}),n.jsx("span",{className:"flex items-center text-muted-foreground",children:"-"}),n.jsx(U,{type:"month",value:typeof f[1]=="string"?f[1]:"",onChange:S=>H(i.id,{value:[f[0],S.target.value]}),className:"w-full sm:w-[160px] h-9"})]})}if((g.type==="date"||g.type==="datetime")&&i.condition==="yearBetween"){const f=Array.isArray(i.value)?i.value:["",""];return n.jsxs("div",{className:"flex gap-1 flex-wrap",children:[n.jsx(U,{type:"number",min:1900,max:9999,step:1,value:typeof f[0]=="string"||typeof f[0]=="number"?f[0]:"",onChange:S=>H(i.id,{value:[S.target.value,f[1]]}),placeholder:l("From..."),className:"w-full sm:w-[120px] h-9"}),n.jsx("span",{className:"flex items-center text-muted-foreground",children:"-"}),n.jsx(U,{type:"number",min:1900,max:9999,step:1,value:typeof f[1]=="string"||typeof f[1]=="number"?f[1]:"",onChange:S=>H(i.id,{value:[f[0],S.target.value]}),placeholder:l("To..."),className:"w-full sm:w-[120px] h-9"})]})}if(g.type==="date"){if(i.condition==="between"){const f=Array.isArray(i.value)?i.value:["",""],S=f[0],F=f[1];return n.jsxs("div",{className:"flex gap-1 flex-wrap",children:[n.jsxs(Pe,{open:mn,onOpenChange:fn,children:[n.jsx(Ee,{asChild:!0,children:n.jsx(E,{variant:"outline",size:"sm",className:"h-9 w-[140px] justify-start text-left font-normal",children:S&&S instanceof Date?Rt(S,"dd.MM.yyyy",{locale:At}):l("From...")})}),n.jsx(Me,{className:"w-auto p-0",align:"start",children:n.jsx(bt,{mode:"single",selected:S instanceof Date?S:void 0,onSelect:I=>{H(i.id,{value:[I||"",F]}),fn(!1)},initialFocus:!0})})]}),n.jsx("span",{className:"flex items-center text-muted-foreground",children:"-"}),n.jsxs(Pe,{open:pn,onOpenChange:hn,children:[n.jsx(Ee,{asChild:!0,children:n.jsx(E,{variant:"outline",size:"sm",className:"h-9 w-[140px] justify-start text-left font-normal",children:F&&F instanceof Date?Rt(F,"dd.MM.yyyy",{locale:At}):l("To...")})}),n.jsx(Me,{className:"w-auto p-0",align:"start",children:n.jsx(bt,{mode:"single",selected:F instanceof Date?F:void 0,onSelect:I=>{H(i.id,{value:[S,I||""]}),hn(!1)},initialFocus:!0})})]})]})}return n.jsxs(Pe,{open:xn,onOpenChange:vn,children:[n.jsx(Ee,{asChild:!0,children:n.jsx(E,{variant:"outline",size:"sm",className:"h-9 w-[150px] justify-start text-left font-normal",children:i.value&&i.value instanceof Date?Rt(i.value,"dd.MM.yyyy",{locale:At}):l("Date...")})}),n.jsx(Me,{className:"w-auto p-0",align:"start",children:n.jsx(bt,{mode:"single",selected:i.value instanceof Date?i.value:void 0,onSelect:f=>{H(i.id,{value:f||""}),vn(!1)},initialFocus:!0})})]})}if(g.type==="month"||g.type==="week")return n.jsx(U,{type:g.type,value:i.value||"",onChange:f=>H(i.id,{value:f.target.value}),className:"w-full sm:w-[150px] h-9"});if(g.type==="datetime"){if(i.condition==="between"){const f=Array.isArray(i.value)?i.value:["",""];return n.jsxs("div",{className:"flex gap-1 flex-wrap",children:[n.jsx(U,{type:"datetime-local",value:f[0]||"",onChange:S=>H(i.id,{value:[S.target.value,f[1]]}),className:"w-full sm:w-[180px] h-9"}),n.jsx("span",{className:"flex items-center text-muted-foreground",children:"-"}),n.jsx(U,{type:"datetime-local",value:f[1]||"",onChange:S=>H(i.id,{value:[f[0],S.target.value]}),className:"w-full sm:w-[180px] h-9"})]})}return n.jsx(U,{type:"datetime-local",value:i.value||"",onChange:f=>H(i.id,{value:f.target.value}),className:"w-full sm:w-[180px] h-9"})}if(g.type==="time")return n.jsx(U,{type:"time",value:i.value||"",onChange:f=>H(i.id,{value:f.target.value}),className:"w-full sm:w-[150px] h-9"});if(g.type==="select"&&i.condition==="in"){const f=Array.isArray(i.value)?i.value:[i.value].filter(Boolean);return n.jsxs(Pe,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(E,{variant:"outline",size:"sm",className:"h-9 w-[180px] justify-start",children:f.length===0?l("Select..."):`${f.length} ${l("selected")}`})}),n.jsx(Me,{className:"w-[200px] p-0",align:"start",children:n.jsxs(Ft,{children:[n.jsx($t,{placeholder:l("Search..."),className:"h-8"}),n.jsxs(_t,{children:[n.jsx(It,{children:l("No results")}),n.jsx(Pt,{children:g.options?.map(S=>{const F=f.includes(S.value);return n.jsxs(Et,{value:S.value,onSelect:()=>{const I=F?f.filter(T=>T!==S.value):[...f,S.value];H(i.id,{value:I})},children:[n.jsx(qe,{checked:F,className:"mr-2 [&_svg]:!text-primary-foreground"}),S.label]},S.value)})})]})]})})]})}if(g.type==="select-many"&&i.condition==="in"){const f=Array.isArray(i.value)?i.value:[i.value].filter(Boolean);return n.jsxs(Pe,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(E,{variant:"outline",size:"sm",className:"h-9 w-[180px] justify-start",children:f.length===0?l("Select..."):`${f.length} ${l("selected")}`})}),n.jsx(Me,{className:"w-[200px] p-0",align:"start",children:n.jsxs(Ft,{children:[n.jsx($t,{placeholder:l("Search..."),className:"h-8"}),n.jsxs(_t,{children:[n.jsx(It,{children:l("No results")}),n.jsx(Pt,{children:g.options?.map(S=>{const F=f.includes(S.value);return n.jsxs(Et,{value:S.value,onSelect:()=>{const I=F?f.filter(T=>T!==S.value):[...f,S.value];H(i.id,{value:I})},children:[n.jsx(qe,{checked:F,className:"mr-2 [&_svg]:!text-primary-foreground"}),S.label]},S.value)})})]})]})})]})}if(g.type==="select")return n.jsxs(Ve,{value:i.value,onValueChange:f=>H(i.id,{value:f}),children:[n.jsx(Ae,{className:"w-full sm:w-[180px] h-9",size:"sm",children:n.jsx(De,{placeholder:l("Select...")})}),n.jsx(ze,{className:"z-[1100]",children:g.options?.map(f=>n.jsx(ve,{value:f.value,children:f.label},f.value))})]});if(g.type==="select-many"){const f=Array.isArray(i.value)?i.value:[i.value].filter(Boolean);return n.jsxs(Pe,{children:[n.jsx(Ee,{asChild:!0,children:n.jsx(E,{variant:"outline",size:"sm",className:"h-9 w-[180px] justify-start",children:f.length===0?l("Select..."):`${f.length} ${l("selected")}`})}),n.jsx(Me,{className:"w-[200px] p-0",align:"start",children:n.jsxs(Ft,{children:[n.jsx($t,{placeholder:l("Search..."),className:"h-8"}),n.jsxs(_t,{children:[n.jsx(It,{children:l("No results")}),n.jsx(Pt,{children:g.options?.map(S=>{const F=f.includes(S.value);return n.jsxs(Et,{value:S.value,onSelect:()=>{const I=F?f.filter(T=>T!==S.value):[...f,S.value];H(i.id,{value:I})},children:[n.jsx(qe,{checked:F,className:"mr-2 [&_svg]:!text-primary-foreground"}),S.label]},S.value)})})]})]})})]})}return n.jsx(U,{value:String(i.value),onChange:f=>H(i.id,{value:f.target.value}),placeholder:l("Value..."),className:"w-full sm:w-[200px] h-9"})},[xn,mn,st,H,Fe,l,pn]);return n.jsxs(n.Fragment,{children:[n.jsxs(Gs,{ref:Q,children:[n.jsx(Bs,{}),n.jsxs(qs,{children:[n.jsx(Mn,{className:"w-[95vw] sm:w-[90vw] max-w-none",children:n.jsx("div",{className:"relative h-full",children:n.jsxs("div",{className:"h-full overflow-y-auto mt-5 pr-2 sm:pr-5",children:[n.jsxs(Mt,{children:[n.jsx(kt,{children:l("Filters")}),n.jsx(Vt,{children:l(c&&c!==oe?"Select a filter or create a new one":"Select a saved filter or create a new one")})]}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs(E,{onClick:()=>{R(null),w([]),N(l("New filter")),Q.current?.next()},className:"w-full",variant:"outline",children:[n.jsx(Us,{className:"h-4 w-4 mr-2"}),l("Add filter")]}),$&&z&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground px-2",children:l("Active filter")}),n.jsxs("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-2 p-3 rounded-md border bg-accent/50 border-accent",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[n.jsx("span",{className:"text-lg",children:"📝"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"font-medium text-sm truncate",children:z.name}),n.jsxs("div",{className:"text-xs text-muted-foreground",children:[z.conditionCount," ",l("conditions"),z.isModified&&` (${l("modified")})`]})]})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(E,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:xs,title:l("Apply filter"),children:n.jsx(Kn,{className:"h-3.5 w-3.5"})}),n.jsx(E,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:yn,title:l("Edit"),children:n.jsx(nn,{className:"h-3.5 w-3.5"})}),n.jsx(E,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:vs,title:l("Save"),children:n.jsx(Ks,{className:"h-3.5 w-3.5"})}),n.jsx(E,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:Cs,title:l("Reset filter"),children:n.jsx(Ws,{className:"h-3.5 w-3.5"})})]})]})]}),u&&n.jsxs(n.Fragment,{children:[!$&&n.jsx("div",{className:"text-xs font-medium text-muted-foreground px-2",children:l("Saved filters")}),n.jsx(go,{modelName:u,activeFilterId:c,onApplyFilter:St,onEditFilter:Rn,onDeleteFilter:js,user:t})]}),c&&c!==oe&&n.jsx("div",{className:"pt-4 border-t",children:n.jsxs(E,{onClick:yt,variant:"destructive",className:"w-full",children:[n.jsx(Le,{className:"h-4 w-4 mr-2"}),l("Reset filter")]})})]})]})})}),n.jsx(Mn,{className:"w-[95vw] sm:w-[90vw] max-w-none",children:n.jsx("div",{className:"relative h-full",children:n.jsx("div",{className:"h-full overflow-y-auto mt-5 pr-2 sm:pr-5",children:Te==="columns"?n.jsxs(n.Fragment,{children:[n.jsxs(Mt,{children:[n.jsx(kt,{children:l("Columns settings")}),n.jsx(Vt,{children:l("Select and arrange columns to display in the table")})]}),Ye?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:l("Loading columns...")})}):n.jsxs("div",{className:"py-4",children:[n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[n.jsxs("div",{className:"flex flex-col h-[400px]",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:l("Available columns")}),ye.length>0&&n.jsx(E,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:ds,children:l("Add all")})]}),n.jsx("div",{className:"flex-1 border rounded-md overflow-y-auto p-1 bg-muted/10",children:ye.length===0?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:l("No available columns")}):ye.map(i=>n.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 text-sm hover:bg-muted/50 rounded-sm group",children:[n.jsx("span",{className:"truncate",title:i.label,children:i.label}),n.jsx(E,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 shrink-0 opacity-100 lg:opacity-0 lg:group-hover:opacity-100 transition-opacity",onClick:()=>us(i),children:n.jsx(Xs,{className:"h-4 w-4"})})]},i.fieldName))})]}),n.jsxs("div",{className:"flex flex-col h-[400px]",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:l("Visible columns")}),xe.length>0&&n.jsx(E,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:gs,children:l("Hide all")})]}),n.jsx("div",{className:"flex-1 border rounded-md overflow-y-auto p-1 bg-muted/10",children:xe.length===0?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:l("Move columns here")}):xe.map((i,g)=>n.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 text-sm hover:bg-muted/50 rounded-sm group",children:[n.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-shrink-0 gap-0.5",children:[n.jsx(E,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",disabled:g===0,onClick:()=>ms(g),children:n.jsx(Ys,{className:"h-3 w-3"})}),n.jsx(E,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",disabled:g===xe.length-1,onClick:()=>fs(g),children:n.jsx(Js,{className:"h-3 w-3"})})]}),n.jsx("span",{className:"truncate",title:i.label,children:i.label})]}),n.jsx(E,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 shrink-0 opacity-100 lg:opacity-0 lg:group-hover:opacity-100 transition-opacity",onClick:()=>cs(i),children:n.jsx(Qs,{className:"h-4 w-4"})})]},i.fieldName))})]})]}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-3 text-center",children:[l("Use buttons")," ← → ",l("to move and")," ↑ ↓ ",l("to change order")]}),Je&&n.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-2 rounded mt-3",children:Je})]}),n.jsx(kn,{className:"mt-8 pb-4",children:n.jsxs("div",{className:"flex flex-wrap items-center gap-2 w-full",children:[n.jsx(E,{variant:"outline",onClick:()=>se("edit"),children:l("Back")}),n.jsx("div",{className:"flex-1"}),n.jsx(E,{onClick:as,children:l("Save")})]})})]}):n.jsxs(n.Fragment,{children:[n.jsxs(Mt,{children:[n.jsx(kt,{children:Te==="edit"?p?`${l("Edit filter")}: ${x}`:x||l("New filter"):l("Save filter")}),n.jsx(Vt,{children:l(Te==="edit"?p?"Change filter conditions and parameters":"Configure filter conditions":"Specify name and parameters for saving")})]}),Te==="edit"?n.jsxs("div",{className:"space-y-4 py-4",children:[p&&n.jsxs("div",{className:"space-y-4 border-b pb-4",children:[n.jsx("h3",{className:"text-sm font-medium",children:l("Filter parameters")}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-sm font-medium",children:[l("Name")," ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx(U,{value:K.name,onChange:i=>He({...K,name:i.target.value}),placeholder:l("Enter filter name")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:l("Description")}),n.jsx(Vn,{value:K.description,onChange:i=>He({...K,description:i.target.value}),placeholder:l("Description"),rows:2})]}),o?n.jsxs("div",{className:"space-y-3 p-3 border rounded-lg bg-muted/20",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Re,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm font-medium",children:l("Filter visibility")})]}),(()=>{if(!((p?.ownerId||p?.ownerInfo?.id)===t?.id)){const f=p?.ownerInfo?.fullName||p?.ownerInfo?.login||l("Unknown");return n.jsx("div",{className:"p-3 bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-md",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(ke,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:l("Someone else's private filter")}),n.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300 mt-1",children:[l("Owner"),": ",f]}),n.jsx("div",{className:"text-xs text-amber-600 dark:text-amber-400 mt-1",children:l("You cannot change someone else's filter visibility")})]})]})})}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:ue("flex items-center gap-2 p-2 rounded-md cursor-pointer transition-colors",ne==="private"&&"bg-accent"),onClick:()=>Ne("private"),children:[n.jsx("input",{type:"radio",name:"editVisibility",checked:ne==="private",onChange:()=>Ne("private"),className:"h-4 w-4"}),n.jsx(ke,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("Private")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("Only for you")})]})]}),n.jsxs("label",{className:ue("flex items-center gap-2 p-2 rounded-md cursor-pointer transition-colors",ne==="groups"&&"bg-accent"),onClick:()=>Ne("groups"),children:[n.jsx("input",{type:"radio",name:"editVisibility",checked:ne==="groups",onChange:()=>Ne("groups"),className:"h-4 w-4"}),n.jsx(Re,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("For groups")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("For selected groups")})]})]}),s&&n.jsxs("label",{className:ue("flex items-center gap-2 p-2 rounded-md cursor-pointer transition-colors",ne==="public"&&"bg-accent"),onClick:()=>Ne("public"),children:[n.jsx("input",{type:"radio",name:"editVisibility",checked:ne==="public",onChange:()=>Ne("public"),className:"h-4 w-4"}),n.jsx(Kt,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("Public")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("For all users")})]})]})]}),ne==="groups"&&et.length>0&&n.jsx("div",{className:"pt-2 border-t",children:n.jsx(Ln,{groups:et,selectedGroupIds:cn,onGroupsChange:dn,modelName:u})})]})})()]}):ne==="groups"?n.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg bg-muted/20",children:[n.jsx(Re,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("For groups")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("Visible only to your group")})]})]}):n.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg bg-muted/20",children:[n.jsx(ke,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("Private filter")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("Visible only to you")})]})]}),n.jsxs("div",{className:"flex gap-4",children:[n.jsxs("div",{className:"space-y-2 flex-1",children:[n.jsx("label",{className:"text-sm font-medium",children:l("Icon")}),n.jsx("div",{className:"flex gap-1 flex-wrap",children:[...Tn,""].map(i=>n.jsx(E,{variant:K.icon===i?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>He({...K,icon:i}),children:i?n.jsx(Ce,{name:i,className:"!text-[18px]"}):n.jsx(Le,{className:"h-4 w-4"})},i||"none"))})]}),n.jsxs("div",{className:"space-y-2 flex-1",children:[n.jsx("label",{className:"text-sm font-medium",children:l("Color")}),n.jsx("div",{className:"flex gap-1 flex-wrap",children:["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16"].map(i=>n.jsx(E,{variant:K.color===i?"default":"outline",size:"sm",className:"h-8 w-8 p-0 rounded-full",style:{backgroundColor:K.color===i?i:"transparent"},onClick:()=>He({...K,color:i})},i))})]})]}),p&&ne==="private"&&n.jsxs("div",{className:"border rounded-lg p-3 bg-muted/20 mt-4",children:[n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Zs,{checked:Ze,onCheckedChange:i=>{if(i&&!O){pe(!0),ht(!1);return}ht(i),i&&!xt&&ln(crypto.randomUUID())}}),n.jsx("span",{className:"text-sm font-medium",children:l("API access (feed)")})]})}),Ze&&xt&&n.jsxs("div",{className:"flex items-center gap-2 pt-3 border-t mt-3",children:[n.jsx(E,{variant:"outline",size:"sm",onClick:()=>Nn(getEditJsonFeedUrl(),l("JSON URL")),children:"JSON"}),n.jsx(E,{variant:"outline",size:"sm",onClick:()=>Nn(getEditXmlFeedUrl(),l("XML URL")),children:"XML"})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-sm font-medium",children:l(p?"Filter conditions":"Add condition")}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{className:"text-sm text-muted-foreground",children:[l("Add"),":"]}),n.jsx("div",{className:"w-full sm:w-auto",children:n.jsxs(Ve,{value:j,onValueChange:i=>{i!=="placeholder"&&Rs(i)},disabled:jt.length===0,children:[n.jsx(Ae,{className:"w-full sm:w-[200px] h-8",size:"sm",children:n.jsx(De,{placeholder:l("Select field")})}),n.jsxs(ze,{className:"z-[1100]",children:[n.jsx(ve,{value:"placeholder",disabled:!0,className:"text-muted-foreground",children:jt.length===0?l("No results"):l("Select field")}),jt.map(i=>n.jsx(ve,{value:i.id,children:i.label},i.id))]})]})})]}),C.length>0&&n.jsx("div",{className:"space-y-2",children:C.map(i=>{const g=tt.get(i.fieldId);if(!g)return null;const f=_s(i.fieldId),S=$s(i,g);return n.jsxs("div",{className:"flex flex-col items-stretch gap-2 p-2 border rounded-md bg-muted/30 sm:flex-row sm:items-center",children:[n.jsx("span",{className:"text-sm font-medium sm:min-w-[120px] truncate",title:g.label,children:g.label}),g.isRelation&&n.jsxs(Ve,{value:i.relationField||"",onValueChange:F=>H(i.id,{relationField:F,value:""}),children:[n.jsx(Ae,{className:"w-full sm:w-[200px] h-9",size:"sm",children:n.jsx(De,{placeholder:l("Select field")})}),n.jsx(ze,{className:"z-[1100]",children:(g.relationFields||[]).map(F=>n.jsx(ve,{value:F.id,children:F.label},F.id))})]}),n.jsxs(Ve,{value:i.condition,onValueChange:F=>H(i.id,{condition:F,value:Ns(F,i.value,g)}),children:[n.jsx(Ae,{className:"w-full sm:w-[180px] h-9",size:"sm",children:n.jsx(De,{})}),n.jsx(ze,{className:"z-[1100]",children:f.map(F=>n.jsx(ve,{value:F.value,children:F.label},F.value))})]}),n.jsx("div",{className:"w-full sm:flex-1",children:S?Is(i,S):null}),n.jsx(E,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 self-end sm:self-auto sm:ml-auto",onClick:()=>bs(i.id),children:n.jsx(Le,{className:"h-4 w-4"})})]},i.id)})}),C.length===0&&n.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:l("No conditions. Add a condition above.")})]})]}):n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-sm font-medium",children:[l("Name")," ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx(U,{value:A.name,onChange:i=>{W({...A,name:i.target.value}),D(!0)},placeholder:l("Enter filter name"),autoFocus:!0}),G&&!A.name.trim()&&n.jsx("p",{className:"text-xs text-destructive",children:G})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:l("Description")}),n.jsx(Vn,{value:A.description,onChange:i=>W({...A,description:i.target.value}),placeholder:l("Description"),rows:2})]}),o?n.jsxs("div",{className:"space-y-3 p-3 border rounded-lg bg-muted/20",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Re,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm font-medium",children:l("Filter visibility")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:ue("flex items-center gap-2 p-2 rounded-md cursor-pointer transition-colors",me==="private"&&"bg-accent"),onClick:()=>je("private"),children:[n.jsx("input",{type:"radio",name:"saveVisibility",checked:me==="private",onChange:()=>je("private"),className:"h-4 w-4"}),n.jsx(ke,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("Private")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("Only for you")})]})]}),n.jsxs("label",{className:ue("flex items-center gap-2 p-2 rounded-md cursor-pointer transition-colors",me==="groups"&&"bg-accent"),onClick:()=>je("groups"),children:[n.jsx("input",{type:"radio",name:"saveVisibility",checked:me==="groups",onChange:()=>je("groups"),className:"h-4 w-4"}),n.jsx(Re,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("For groups")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("For selected groups")})]})]}),s&&n.jsxs("label",{className:ue("flex items-center gap-2 p-2 rounded-md cursor-pointer transition-colors",me==="public"&&"bg-accent"),onClick:()=>je("public"),children:[n.jsx("input",{type:"radio",name:"saveVisibility",checked:me==="public",onChange:()=>je("public"),className:"h-4 w-4"}),n.jsx(Kt,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("Public")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("For all users")})]})]})]}),me==="groups"&&et.length>0&&n.jsx("div",{className:"pt-2 border-t",children:n.jsx(Ln,{groups:et,selectedGroupIds:an,onGroupsChange:un,modelName:u})})]}):n.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg bg-muted/20",children:[n.jsx(ke,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:l("Private filter")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:l("Visible only to you")})]})]}),n.jsxs("div",{className:"flex gap-4",children:[n.jsxs("div",{className:"space-y-2 flex-1",children:[n.jsx("label",{className:"text-sm font-medium",children:l("Icon")}),n.jsx("div",{className:"flex gap-1 flex-wrap",children:[...Tn,""].map(i=>n.jsx(E,{variant:A.icon===i?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>W({...A,icon:i}),children:i?n.jsx(Ce,{name:i,className:"!text-[18px]"}):n.jsx(Le,{className:"h-4 w-4"})},i||"none"))})]}),n.jsxs("div",{className:"space-y-2 flex-1",children:[n.jsx("label",{className:"text-sm font-medium",children:l("Color")}),n.jsx("div",{className:"flex gap-1 flex-wrap",children:["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16"].map(i=>n.jsx(E,{variant:A.color===i?"default":"outline",size:"sm",className:"h-8 w-8 p-0 rounded-full",style:{backgroundColor:A.color===i?i:"transparent"},onClick:()=>W({...A,color:i})},i))})]})]}),G&&A.name.trim()&&n.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-2 rounded",children:G})]}),n.jsx(kn,{className:"mt-8 pb-4",children:Te==="edit"?n.jsxs("div",{className:"flex flex-wrap items-center gap-2 w-full",children:[n.jsx(E,{variant:"outline",onClick:Fs,disabled:C.length===0,children:l("Cancel")}),n.jsxs(E,{variant:"outline",size:"sm",className:"gap-2",onClick:gn,children:[n.jsx(qt,{className:"h-4 w-4"}),l("Columns")]}),n.jsx("div",{className:"flex-1"}),p?n.jsx(E,{onClick:ys,disabled:B||!K.name.trim(),children:l(B?"Saving...":"Save changes")}):n.jsx(E,{onClick:()=>Ss(C),disabled:C.length===0,children:l("Apply")})]}):n.jsxs("div",{className:"flex flex-wrap items-center gap-2 w-full",children:[n.jsx(E,{variant:"outline",onClick:()=>{se("edit")},disabled:B,children:l("Back")}),n.jsxs(E,{variant:"outline",size:"sm",className:"gap-2",onClick:gn,children:[n.jsx(qt,{className:"h-4 w-4"}),l("Columns")]}),n.jsx("div",{className:"flex-1"}),n.jsx(E,{onClick:ws,disabled:B||!A.name.trim(),children:l(B?"Saving...":"Save")})]})})]})})})})]})]}),le&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:n.jsxs("div",{className:"bg-background rounded-lg shadow-lg max-w-md w-full p-6",children:[n.jsx("h3",{className:"text-lg font-semibold mb-2",children:l("API key is not created")}),n.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l("The key is not created. Create it or contact an administrator.")}),n.jsx("div",{className:"flex justify-end",children:n.jsx(E,{variant:"outline",onClick:()=>pe(!1),children:l("OK")})})]})})]})}function Co({header:e,showSearch:r,onToggleSearch:t}){const s=e.filtersEnabled===!0,o=!!e.activeFilterName,a=new URLSearchParams(window.location.search).get("filterId"),u=o&&!!a,[c,m]=v.useState(!1),{t:d}=We(e.modelResource.name),l=async x=>{if(!c){m(!0);try{const p=new URLSearchParams(window.location.search).get("filterId")||void 0,R=await ee.post(`${e.modelResource.uri}/export`,{format:x,filterId:p},{responseType:"blob"}),j=R.headers["content-type"],_=R.data instanceof Blob?R.data:new Blob([R.data],j?{type:j}:void 0),$=window.URL.createObjectURL(_),b=document.createElement("a");b.href=$;const z=R.headers["content-disposition"];let V=`${e.modelResource.name}_export.${x==="xlsx"?"xlsx":x}`;if(z){const A=z.match(/filename="?(.+?)"?$/);A&&(V=A[1])}b.setAttribute("download",V),document.body.appendChild(b),b.click(),document.body.removeChild(b),window.URL.revokeObjectURL($),de.success(`${d("Export to")} ${x.toUpperCase()} ${d("completed")}`)}catch(N){if(console.error("Export error:",N),N.response?.data instanceof Blob)try{const p=await N.response.data.text(),R=JSON.parse(p);de.error(R.error||R.message||d("Export error"))}catch{de.error(d("Export error"))}else de.error(N.response?.data?.error||N.response?.data?.message||d("Export error"))}finally{m(!1)}}},C=x=>{const N=typeof x.customHandler=="string"?x.customHandler.split(".").pop():"",p=x.fieldName||x.field||N||d("Custom filtering"),R=x.operator,j=x.value,_={eq:"=",neq:"≠",gt:">",gte:"≥",lt:"<",lte:"≤",like:d("Contains"),notLike:d("Not contains"),in:d("In list"),notIn:d("Not in list"),isNull:d("Is null"),isNotNull:d("Is not null"),between:d("Between")},$=R==="custom"?x.customHandlerName||d("Custom filtering"):_[R]||R;let b="";return Array.isArray(j)?b=j.map(V=>typeof V=="string"&&V.includes("T")?V.split("T")[0]:String(V)).join(` ${d("and")} `):j&&typeof j=="object"?b=Object.entries(j).map(([z,V])=>`${z}: ${String(V??"")}`).join(", "):b=typeof j=="string"&&j.includes("T")?j.split("T")[0]:String(j),`${p} ${$} ${b}`},w=()=>{const x=window.adminizerFilterPanel;if(x&&x.openFilterDialog)x.openFilterDialog();else{const N=document.getElementById("filter-panel-trigger");N&&N.click()}},h=()=>{const x=new URLSearchParams(window.location.search);x.delete("filterId"),tn.get(window.location.pathname,Object.fromEntries(x),{preserveState:!0,preserveScroll:!0})},y=()=>{const x=window.adminizerFilterPanel;if(x&&x.openEditCurrentFilter){x.openEditCurrentFilter(a||void 0);return}w()};return n.jsxs("div",{className:"bg-background",children:[s&&n.jsx(wo,{}),n.jsxs("div",{className:"flex flex-wrap gap-2 py-3",children:[e.crudActions?.createTitle&&n.jsx(E,{asChild:!0,children:n.jsxs(Ue,{href:`${e.modelResource.uri}/add`,children:[n.jsx(ce,{iconNode:er}),e.crudActions.createTitle]})}),s&&n.jsxs(E,{variant:"outline",onClick:w,children:[n.jsx(ce,{iconNode:Ut}),d("Filters")]}),o&&n.jsxs(ct,{children:[n.jsx(dt,{asChild:!0,children:n.jsxs(E,{variant:"outline",disabled:c,children:[n.jsx(ce,{iconNode:c?An:tr}),d(c?"Exporting...":"Export")]})}),n.jsx(gt,{align:"start",children:n.jsxs(Wt,{className:"grid gap-1",children:[n.jsx(be,{onClick:()=>l("json"),className:ue("cursor-pointer"),children:n.jsxs("div",{className:"flex items-center gap-4 w-full",children:[n.jsx("span",{className:"font-mono text-xs w-8 shrink-0",children:"JSON"}),n.jsx("span",{className:"text-muted-foreground text-xs",children:d("Data in JSON format")})]})}),n.jsx(be,{onClick:()=>l("csv"),className:ue("cursor-pointer"),children:n.jsxs("div",{className:"flex items-center gap-4 w-full",children:[n.jsx("span",{className:"font-mono text-xs w-8 shrink-0",children:"CSV"}),n.jsx("span",{className:"text-muted-foreground text-xs",children:d("Text format CSV")})]})}),n.jsx(be,{onClick:()=>l("xlsx"),className:ue("cursor-pointer"),children:n.jsxs("div",{className:"flex items-center gap-4 w-full",children:[n.jsx("span",{className:"font-mono text-xs w-8 shrink-0",children:"XLSX"}),n.jsx("span",{className:"text-muted-foreground text-xs",children:d("Excel file")})]})})]})})]}),n.jsxs(E,{className:"transition-none cursor-pointer",variant:r?"destructive":"outline",onClick:t,children:[n.jsx(ce,{iconNode:r?An:Bn}),r?e.resetBtn:e.searchBtn]}),e.actions.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"gap-2 ml-0 sm:ml-6 hidden lg:flex",children:e.actions.map(x=>n.jsx(E,{asChild:!0,variant:"outline",children:x.type==="blank"?n.jsxs("a",{href:x.link,target:"_blank",children:[x.icon&&n.jsx(Ce,{name:x.icon,className:"!text-[18px]"}),x.title]}):n.jsxs(Ue,{href:x.link,children:[x.icon&&n.jsx(Ce,{name:x.icon,className:"!text-[18px]"}),x.title]})},x.id))}),n.jsx("div",{className:"block lg:hidden ml-0 sm:ml-6",children:n.jsxs(ct,{children:[n.jsx(dt,{asChild:!0,children:n.jsx(E,{variant:"outline",size:"icon",children:n.jsx(Xn,{})})}),n.jsx(gt,{className:"w-fit",side:"right",align:"start",children:n.jsx(Wt,{className:"grid gap-2",children:e.actions.map(x=>n.jsx(E,{asChild:!0,variant:"outline",children:n.jsxs("a",{href:x.link,target:"_blank",children:[n.jsx(Ce,{name:x.icon,className:"!text-[18px]"}),x.title]})},x.id))})})]})})]})]}),o&&n.jsx("div",{className:"border-t pt-3 pb-2",children:n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs(mt,{variant:"secondary",className:"gap-1 h-7 max-w-full",children:[n.jsx(Ut,{className:"h-3 w-3"}),n.jsx("span",{className:"font-medium truncate",children:e.activeFilterName})]}),n.jsxs(E,{variant:"ghost",size:"sm",className:"h-7 px-2 text-muted-foreground",onClick:y,title:d("Edit filter"),disabled:!u,children:[n.jsx(nn,{className:"h-4 w-4"}),n.jsx("span",{className:"ml-1",children:d("Edit")})]}),n.jsxs(E,{variant:"ghost",size:"sm",className:"h-7 px-2 text-muted-foreground hover:text-destructive",onClick:h,title:d("Reset filter"),children:[n.jsx(Le,{className:"h-4 w-4"}),n.jsx("span",{className:"ml-1",children:d("Reset")})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{className:"text-sm text-muted-foreground",children:[d("Conditions"),":"]}),e.activeFilterConditions?.map((x,N)=>n.jsx(mt,{variant:"outline",className:"gap-1 text-xs max-w-[250px] truncate",title:C(x),children:n.jsx("span",{className:"truncate",children:C(x)})},N))]})]})})]})}function So({rowId:e,modelResourceUri:r,modelResourceName:t,crudActions:s,inlineActions:o,delModal:a}){return n.jsxs(ct,{children:[n.jsx(dt,{asChild:!0,className:"cursor-pointer",children:n.jsx(E,{variant:"outline",size:"icon",children:n.jsx(Xn,{})})}),n.jsxs(gt,{className:"w-46",side:"right",align:"start",children:[n.jsxs(Wt,{children:[s?.editTitle&&n.jsx(be,{asChild:!0,className:"cursor-pointer",children:n.jsxs(Ue,{href:`${r}/edit/${e}`,onClick:()=>{localStorage.setItem("backUrl",window.location.pathname+window.location.search)},children:[n.jsx(ce,{iconNode:nr}),s.editTitle]})}),s?.viewsTitle&&n.jsx(be,{asChild:!0,className:"cursor-pointer",children:n.jsxs(Ue,{href:`${r}/view/${e}`,children:[n.jsx(ce,{iconNode:sr}),s.viewsTitle]})}),s?.deleteTitle&&n.jsx(be,{asChild:!0,className:"cursor-pointer",children:n.jsx(Wn,{btnTitle:s.deleteTitle,delModal:a,btnCLass:"font-normal text-destructive hover:text-destructive w-full cursor-pointer justify-start",link:`${r}/remove/${e}?referTo=${encodeURIComponent(window.location.search)}`})})]}),o&&o.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(qn,{}),o.map(u=>n.jsx(be,{asChild:!0,className:"cursor-pointer",children:u.type==="blank"?n.jsxs("a",{target:"_blank",href:`${u.link}?id=${e}&modelResourceName=${t}`,children:[u.icon&&n.jsx(Ce,{name:u.icon,className:"!text-[18px] mr-2"}),n.jsx("span",{children:u.title})]}):n.jsxs(Ue,{href:`${u.link}/${e}?id=${e}&modelResourceName=${t}`,children:[u.icon&&n.jsx(Ce,{name:u.icon,className:"!text-[18px] mr-2"}),n.jsx("span",{children:u.title})]})},u.id))]})]})]})}function yo(e){return{id:"actions",accessorKey:"actions",enableHiding:!1,meta:e.thActionsTitle,header:()=>n.jsx("div",{className:"text-center",children:e.thActionsTitle}),cell:({row:r})=>n.jsx("div",{className:"text-center",children:["deleteTitle","viewsTitle","editTitle"].some(t=>e.crudActions?.[t]&&e.crudActions?.[t].trim()!=="")&&n.jsx(So,{rowId:r.original.id,modelResourceUri:e.modelResourceUri,modelResourceName:e.modelResourceName,crudActions:e.crudActions,inlineActions:e.inlineActions,delModal:e.delModal})})}}const jo="v1";function On(e){return typeof e.id=="string"&&e.id.length>0?e.id:typeof e.accessorKey=="string"&&e.accessorKey.length>0?e.accessorKey:null}function os(e,r,t){if(!e||typeof e!="object")return{};const s=e,o={};return Object.entries(s).forEach(([a,u])=>{!r.has(a)||t.has(a)||typeof u=="boolean"&&(o[a]=u)}),o}function Gn(e,r,t){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(e);return s?os(JSON.parse(s),r,t):{}}catch{return{}}}function No(e,r){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(r))}catch{}}function Ro(e,r){const t=v.useMemo(()=>`adminizer:list:${e}:columns:${jo}`,[e]),s=v.useMemo(()=>{const m=new Set;return r.forEach(d=>{const l=On(d);l&&m.add(l)}),m},[r]),o=v.useMemo(()=>{const m=new Set;return r.forEach(d=>{if(d.enableHiding===!1){const l=On(d);l&&m.add(l)}}),m},[r]),[a,u]=v.useState(()=>Gn(t,s,o));v.useEffect(()=>{u(Gn(t,s,o))},[t,s,o]);const c=v.useCallback(m=>{u(d=>{const l=typeof m=="function"?m(d):m,C=os(l,s,o);return No(t,C),C})},[s,o,t]);return{columnVisibility:a,onColumnVisibilityChange:c}}const bo=()=>{const e=en(),r=e.props.data,t=e.props.header,s=e.props.customColumns,{t:o}=We(t.modelResource.name),a=t.pageSizeOptions.map(String),[u,c]=v.useState(r.data);v.useEffect(()=>{c(r.data)},[r.data]);const m=v.useCallback((J,D,B)=>{c(X=>X.map(G=>G.id===J?{...G,[D]:B}:G))},[]),{loading:d,searchValue:l,showSearch:C,currentPage:w,count:h,changeCount:y,handlePageChange:x,handleCustomSort:N,handleGlobalSearch:p,handleSearch:R,handleColumnSearch:j,toggleSearch:_}=co({header:t}),$=r.page||w,b=v.useMemo(()=>ro(r.recordsFiltered,parseInt(h),$,5),[r.recordsFiltered,h,$,l]);v.useEffect(()=>{e.props.flash&&(e.props.flash.success&&de.success(e.props.flash.success),e.props.flash.error&&de.error(e.props.flash.error))},[e.props.flash]);const z=uo(e.props.columns,t.modelResource.name,m,N,j,R,C&&!t.filtersEnabled),V=v.useMemo(()=>{const J=yo({thActionsTitle:t.thActionsTitle,crudActions:t.crudActions,inlineActions:t.inlineActions,modelResourceUri:t.modelResource.uri,modelResourceName:t.modelResource.name,delModal:t.delModal});let D=[J,...z];if(s&&s.length>0){const B=new Map(s.sort((G,P)=>G.order-P.order).map(G=>[G.fieldName,G])),X=z.filter(G=>G.accessorKey==="actions"?!0:B.has(G.accessorKey));X.sort((G,P)=>{const O=B.get(G.accessorKey)?.order??999,q=B.get(P.accessorKey)?.order??999;return O-q}),D=[J,...X]}return D},[t.thActionsTitle,t.crudActions,t.inlineActions,t.modelResource.uri,t.modelResource.name,t.delModal,z,s]),{columnVisibility:A,onColumnVisibilityChange:W}=Ro(t.modelResource.name,V);return n.jsxs(n.Fragment,{children:[n.jsx(rr,{position:"top-center",richColors:!0,closeButton:!0}),n.jsxs("div",{className:`flex h-full min-h-0 flex-1 flex-col gap-4 rounded-xl p-4 ${d?"opacity-50":""}`,children:[n.jsx(Co,{header:t,showSearch:C,onToggleSearch:_}),n.jsx(so,{columns:V,data:u,columnVisibility:A,onColumnVisibilityChange:W,searchValue:l,searchTxt:t.searchBtn,notFoundContent:t.notFoundContent,globalSearch:C,onGlobalSearch:p,handleSearch:R,columnVisibilityLabel:o("Columns"),footer:J=>n.jsxs("div",{className:"mt-4 mb-4 flex flex-wrap justify-center md:justify-between gap-4 items-end",children:[n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-1 gap-4 items-center justify-items-center md:justify-items-normal",children:[n.jsxs("p",{className:"text-sm text-foreground/70",children:["Show ",b.from," - ",b.to," of ",b.total]}),n.jsxs("div",{className:"flex flex-wrap items-center justify-center md:justify-start gap-2",children:[J({display:"icon",side:"top"}),n.jsx("div",{className:"max-w-fit",children:n.jsxs(Ve,{onValueChange:D=>y(D),value:h,children:[n.jsx(Ae,{className:"w-full cursor-pointer",children:n.jsx(De,{placeholder:h})}),n.jsx(ze,{children:a.map(D=>n.jsx(ve,{value:D,children:D},D))})]})})]})]}),n.jsx("div",{children:u.length>0&&n.jsx(oo,{pagination:b,pageChange:x,currentPage:$})})]})})]})]})},Fo=[],$o=()=>n.jsx(bo,{}),Mo=or($o,{breadcrumbs:Fo,className:"overflow-auto h-[calc(100svh-16px)]"});export{Mo as default};
@@ -1 +1 @@
1
- import{bL as ue,r as L,u as fe,g as ge,j as i,T as he,h as z,L as V,H as M,bM as pe,I as q,E as ye,bN as me,au as we,d as X,p as Y,o as xe,t as J}from"./app-Ca5yUSBv.js";import{i as be}from"./use-appearance-DC-DESKB.js";function j(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function H(e){return e.slice().buffer}function p(e){return(typeof e=="string"?e:e.name).toUpperCase()}let Q;function _e(){return typeof crypto>"u"||crypto.subtle?Promise.resolve():(Q??=ve(),Q)}async function ve(){const{SHA256:e,PBKDF2_HMAC_SHA256:r,AES_GCM:n}=await ue(async()=>{const{SHA256:t,PBKDF2_HMAC_SHA256:c,AES_GCM:o}=await import("./asmcrypto-DZeQH0LC.js");return{SHA256:t,PBKDF2_HMAC_SHA256:c,AES_GCM:o}},[],import.meta.url),s={async digest(t,c){if(p(t)!=="SHA-256")throw new Error(`Unsupported digest algorithm: ${p(t)}`);return H(e.bytes(j(c)))},async importKey(t,c,o,a,l){if(t!=="raw")throw new Error(`Unsupported key format: ${t}`);return{__raw:j(c).slice(),algorithm:{name:p(o)},usages:l,type:"secret",extractable:!1}},async deriveBits(t,c,o){if(p(t)!=="PBKDF2"||p(t.hash)!=="SHA-256")throw new Error(`Unsupported deriveBits params: ${p(t)}/${p(t.hash)}`);return H(r.bytes(c.__raw,j(t.salt),t.iterations,o/8))},async encrypt(t,c,o){if(p(t)!=="AES-GCM")throw new Error(`Unsupported encrypt algorithm: ${p(t)}`);return H(n.encrypt(j(o),c.__raw,j(t.iv),void 0,(t.tagLength??128)/8))},async decrypt(t,c,o){if(p(t)!=="AES-GCM")throw new Error(`Unsupported decrypt algorithm: ${p(t)}`);return H(n.decrypt(j(o),c.__raw,j(t.iv),void 0,(t.tagLength??128)/8))}};Object.defineProperty(crypto,"subtle",{value:s,configurable:!0})}const Z=(e,r,n)=>{let s=1n,t=e%n;for(;r;)r&1n&&(s=s*t%n),t=t*t%n,r=r>>1n;return s};function F(e,r,n){return typeof e=="bigint"&&typeof r=="bigint"&&typeof n=="bigint"?Z(e,r,n):Number(Z(BigInt(e),BigInt(r),BigInt(n)))}const _=crypto,ke=new TextEncoder,Ae=new TextDecoder("utf-8",{ignoreBOM:!0}),U={encode:e=>ke.encode(e),decode:e=>Ae.decode(e)},oe=(()=>{const r=[..."0123456789abcdef"],n=new Array(256);for(let s=0;s<256;s++)n[s]=`${r[s>>>4&15]}${r[s&15]}`;return n})(),Ce=(()=>{const e={};for(let r=0;r<256;r++){const n=oe[r],s=n[0],t=s.toUpperCase(),c=n[1],o=c.toUpperCase();e[n]=r,e[`${s}${o}`]=r,e[`${t}${c}`]=r,e[`${t}${o}`]=r}return e})(),Se=e=>!(e.length%2||!/^[a-fA-F0-9]*$/.test(e)),K={encode:e=>{let r="";for(let n=0,s=e.length;n<s;n++)r+=oe[e[n]];return r},encodeStr:e=>K.encode(U.encode(e)),decode:e=>{const r=e.length/2,n=new Uint8Array(r);for(let s=0;s<r;s++)n[s]=Ce[e.slice(s*2,s*2+2)];return n},decodeStr:e=>U.decode(K.decode(e)),is:Se},ce=e=>K.encode(e),ee=new TextEncoder,$=e=>{const r=async o=>o instanceof Uint8Array?_.subtle.importKey("raw",o,{name:"PBKDF2"},!1,["deriveBits"]):typeof o=="string"?r(ee.encode(o.normalize())):o,n=(o,a,l,d)=>(a=typeof a=="string"?ee.encode(a):a,_.subtle.deriveBits({name:"PBKDF2",salt:a,iterations:l,hash:{name:e}},o,d)),s=async(o,a,l,d)=>{const f=await r(o);return await n(f,a,l,d*8)},t=async(o,a,l,d)=>new Uint8Array(await s(o,a,l,d)),c=async(o,a,l,d)=>ce(await t(o,a,l,d));return c.buffer=s,c.hex=c,c.uint8=t,c},ie={sha1:$("SHA-1"),sha256:$("SHA-256"),sha384:$("SHA-384"),sha512:$("SHA-512")},W=e=>{const r=new Uint8Array(e);return _.getRandomValues(r),r},je=new TextEncoder,R=e=>{const r=t=>(t=typeof t=="string"?je.encode(t):t,_.subtle.digest(e,t)),n=async t=>new Uint8Array(await r(t)),s=async t=>ce(await n(t));return s.buffer=r,s.hex=s,s.uint8=n,s};R("SHA-1");const ae=R("SHA-256");R("SHA-384");R("SHA-512");const x={encode:e=>{if(e!==e>>0)throw new Error("Invalid 32-bit integer");const r=e>>24&255,n=e>>16&255,s=e>>8&255,t=e>>0&255;return new Uint8Array([r,n,s,t])},decode:e=>{if(e.length!==4)throw new Error("Invalid 32-bit integer");const r=e[0],n=e[1],s=e[2],t=e[3];return(r<<24)+(n<<16)+(s<<8)+(t<<0)}},le=e=>{const r=e.reduce((s,t)=>s+t.byteLength,0),n=new Uint8Array(r);for(let s=0,t=0,c=e.length;t<c;t++)n.set(e[t],s),s+=e[t].byteLength;return n},Ee=async(e,r,n,s)=>{e=typeof e=="string"?U.encode(e):e,n=typeof n=="string"?U.encode(n):n||W(32),n=n.length===32?n:await ae.uint8(n);const t=new Uint8Array([1]),c=Math.max(1,s||0),o=await ie.sha256.uint8(r,n,c,32),a=await _.subtle.importKey("raw",o,"AES-GCM",!1,["encrypt"]),l=W(16),d=await _.subtle.encrypt({name:"AES-GCM",iv:l,length:256,tagLength:128},a,e),f=new Uint8Array(d);return le([t,n,x.encode(c),l,f])},Be=async(e,r)=>{if(e[0]!==1)throw new Error("Unsupported encrypted archive version");const s=e.subarray(1,33),t=x.decode(e.subarray(33,37)),c=e.subarray(37,53),o=e.subarray(53),a=await ie.sha256.uint8(r,s,t,32),l=await _.subtle.importKey("raw",a,"AES-GCM",!1,["decrypt"]),d=await _.subtle.decrypt({name:"AES-GCM",iv:c,length:256,tagLength:128},l,o);return new Uint8Array(d)},ne=Object.freeze(Object.defineProperty({__proto__:null,decrypt:Be,encrypt:Ee},Symbol.toStringTag,{value:"Module"}));function P(e){let r,n=0;return()=>((!r||n===r.length)&&(r=new e(65536/(e.BYTES_PER_ELEMENT*8)),n=0,_.getRandomValues(r)),r[n++])}function Ne(e,r){let n=0,s=r;return()=>(s===r&&(n=e(),s=0),n&1<<s++?1:0)}const T={get1:Ne(P(Uint8Array),8),get8:P(Uint8Array),get16:P(Uint16Array),get32:P(Uint32Array),get64:P(BigUint64Array)},Ie=Object.assign(()=>BigInt(T.get1()),{BITS:1}),Le=Object.assign(()=>BigInt(T.get8()),{BITS:8}),Pe=Object.assign(()=>BigInt(T.get16()),{BITS:16}),Ue=Object.assign(()=>BigInt(T.get32()),{BITS:32}),Te=Object.assign(()=>T.get64(),{BITS:64}),u=e=>{const r=e<=1?Ie:e<=8?Le:e<=16?Pe:e<=32?Ue:Te,n=r.BITS;if(e===n)return r();if(e===128)return r()<<64n|r();if(e===160)return u(128)<<32n|u(32);if(e===192)return u(128)<<64n|u(64);if(e===224)return u(160)<<64n|u(64);if(e===256)return u(128)<<128n|u(128);if(e===384)return u(256)<<128n|u(128);if(e===512)return u(256)<<256n|u(256);if(e===1024)return u(512)<<512n|u(512);if(e===2048)return u(1024)<<1024n|u(1024);let s=0,t=0n;for(;s<e;){const c=Math.min(n,e-s),o=2n**BigInt(c)-1n,l=r()&o;if(e===c)return l;t=s?t|l<<BigInt(s):l,s+=c}return t},de=(e,r)=>{if(e=BigInt(e),r=BigInt(r),e<0n||r<0n)throw new Error("Negative ranges are not supported");if(r<=e)throw new Error('"max" must be at least equal to "min" plus 1');const n=r-e-1n,s=n.toString(2).length;for(;;){const t=u(s);if(!(t>n))return t+e}},te=[2n,3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n,257n,263n,269n,271n,277n,281n,283n,293n,307n,311n,313n,317n,331n,337n,347n,349n,353n,359n,367n,373n,379n,383n,389n,397n,401n,409n,419n,421n,431n,433n,439n,443n,449n,457n,461n,463n,467n,479n,487n,491n,499n,503n,509n,521n,523n,541n,547n,557n,563n,569n,571n,577n,587n,593n,599n,601n,607n,613n,617n,619n,631n,641n,643n,647n,653n,659n,661n,673n,677n,683n,691n,701n,709n,719n,727n,733n,739n,743n,751n,757n,761n,769n,773n,787n,797n,809n,811n,821n,823n,827n,829n,839n,853n,857n,859n,863n,877n,881n,883n,887n,907n,911n,919n,929n,937n,941n,947n,953n,967n,971n,977n,983n,991n,997n],Me=(e,r=8)=>{if(e<=1n)return!1;for(let t=0,c=te.length;t<c;t++){const o=te[t];if(e%o===0n)return e===o}if(e<=1000n)return!1;let n=0n,s=e-1n;for(;(s&1n)===0n;)n+=1n,s>>=1n;for(let t=0;t<r;t++){const c=de(2n,e-2n);let o=F(c,s,e),a=0n;for(let l=0;l<n;l++){if(a=F(o,2n,e),a===1n&&o!==1n&&o!==e-1n)return!1;o=a}if(a!==1n)return!1}return!0},re=(e,r=8)=>{let n=u(e);for((n&1n)===0n&&(n+=1n);;){if(Me(n,r))return n;n+=2n}},b={encode:e=>{let r=0n;for(let n=0,s=e.length;n<s;n++)r|=BigInt(e[n])<<(BigInt(s)-BigInt(n)-1n)*8n;return r},decode:e=>{if(e<0n)throw new Error("Negative BigInts are not supported");const r=[];for(;e;)r.push(Number(e&0xffn)),e>>=8n;return new Uint8Array(r.reverse())}},se={archive:e=>{const[r,n,s,t,c]=e,o=b.decode(r),a=x.encode(o.length),l=b.decode(n),d=x.encode(l.length),f=b.decode(s),y=x.encode(f.length),g=b.decode(t),m=x.encode(g.length);return le([a,o,d,l,y,f,m,g,c])},unarchive:e=>{const n=e.slice(0,4),s=x.decode(n),t=4,c=e.slice(t,t+s),o=b.encode(c),a=t+s,l=e.slice(a,a+4),d=x.decode(l),f=a+4,y=e.slice(f,f+d),g=b.encode(y),m=f+d,v=e.slice(m,m+4),E=x.decode(v),h=m+4,B=e.slice(h,h+E),N=b.encode(B),k=h+E,w=e.slice(k,k+4),I=x.decode(w),S=k+4,A=e.slice(S,S+I),O=b.encode(A),D=S+I,C=e.slice(D);return[o,g,N,O,C]}},He=(e,r,n)=>{let s=e%n;if(r<=BigInt(Number.MAX_SAFE_INTEGER))for(let t=Number(r);t>0;t--)s=s*s%n;else for(let t=r;t>0n;t--)s=s*s%n;return s%n},$e={generate:async e=>{const r=e.primeBits??100,n=e.primeRounds??20,s=e.opsPerSecond??33e5,t=e.duration??1e3,c=e.message,o=re(r,n),a=re(r,n),l=o*a,d=(o-1n)*(a-1n),f=s,y=t,g=BigInt(Math.round(Math.max(1,f/1e3)*y)),m=await ae.uint8(W(32)),v=c,E=await ne.encrypt(v,m),h=de(1n,l-1n),B=F(2n,g,d),N=F(h,B,l),k=b.encode(m)+N;return se.archive([l,h,g,k,E])},solve:async e=>{const[r,n,s,t,c]=se.unarchive(e),o=He(n,s,r),a=b.decode(t-o),l=await ne.decrypt(c,a);return U.decode(l)}};function Oe(){const[e,r]=L.useState(!1);L.useEffect(()=>{be()},[]);const n=fe(),s=Array.isArray(n.props.captchaTask)&&n.props.captchaTask.length>0,t=n.props.captchaMessages||{},[c,o]=L.useState(t.initial||"I'm not a robot"),[a,l]=L.useState(!1),[d,f]=L.useState(!1),{post:y,data:g,setData:m,processing:v,transform:E,errors:h,clearErrors:B}=ge({login:"",password:"",captchaSolution:"",redirectTo:n.props.redirectTo??""}),N=w=>{if(w.preventDefault(),!s){y(n.props.submitLink,{onError:S=>{for(const A of Object.keys(S))J.error(S[A])}});return}r(!0),o(t.solving||"Solving CAPTCHA..."),l(!1),(async()=>{try{let A=function(C){return new Promise(G=>setTimeout(G,C))};var S=A;await A(100),await _e();const O=new Uint8Array(n.props.captchaTask),D=await $e.solve(O);o(t.success||"Verification complete!"),r(!1),l(!0),E(C=>({...C,captchaSolution:D})),y(n.props.submitLink,{onError:C=>{for(const G of Object.keys(C))J.error(C[G])}})}catch(A){console.error("Error solving CAPTCHA:",A),o(t.error||"Error solving CAPTCHA. Try again.")}})()},k=(w,I)=>{B(),m(w,I)};return i.jsxs("div",{className:"bg-sidebar flex min-h-svh w-full justify-center",children:[i.jsx(he,{position:"top-center",richColors:!0,closeButton:!0}),i.jsxs("div",{className:"rounded-xl border bg-card text-card-foreground shadow p-6 max-w-sm w-full h-fit mt-[15%]",children:[i.jsx("h1",{className:"font-medium mb-6 text-xl",children:n.props.title}),n.props.description&&i.jsx("p",{className:"font-thin mb-6 text-xs pb-10",children:n.props.description}),i.jsxs("form",{onSubmit:N,children:[g.redirectTo&&i.jsx("input",{type:"hidden",name:"redirectTo",value:g.redirectTo}),i.jsxs("div",{className:"grid gap-5",children:[s&&i.jsx(z,{message:h.captchaSolution}),i.jsxs("div",{className:"grid gap-4",children:[i.jsx(V,{htmlFor:"login",children:n.props.login}),i.jsxs("div",{className:"relative",children:[i.jsx(M,{iconNode:pe,className:"size-5 absolute inset-2 text-muted-foreground"}),i.jsx(q,{id:"login",className:`pl-10 ${h.login?"border-red-500":""}`,type:"text",required:!0,tabIndex:1,autoComplete:"username",value:g.login,disabled:v||e,onChange:w=>{k("login",w.target.value)},placeholder:n.props.login}),i.jsx(z,{message:h.login})]})]}),i.jsxs("div",{className:"grid gap-4",children:[i.jsx(V,{htmlFor:"password",children:n.props.password}),i.jsxs("div",{className:"relative",children:[i.jsx(M,{iconNode:ye,className:"size-5 absolute inset-2 text-muted-foreground"}),i.jsx(q,{id:"password",className:`pl-10 pr-10 ${h.password?"border-red-500":""}`,type:d?"text":"password",required:!0,disabled:v||e,tabIndex:1,autoComplete:"current-password",value:g.password,onChange:w=>{k("password",w.target.value)},placeholder:n.props.password}),i.jsx("button",{type:"button",onClick:()=>f(!d),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:i.jsx(M,{iconNode:d?me:we,className:"size-5"})}),i.jsx(z,{message:h.password})]})]}),i.jsxs("div",{className:"flex gap-4",children:[i.jsx(X,{type:"submit",className:"w-fit",disabled:v||e,children:n.props.submitButton}),n.props.registerLink&&i.jsx(X,{asChild:!0,variant:"outline",children:i.jsx(Y,{href:n.props.registerLink.link,className:`${v||e} ? 'pointer-events-none opacity-50' : ''`,children:n.props.registerLink.title})})]})]}),s&&i.jsxs("div",{className:"bg-card border rounded-lg shadow-lg p-4 mt-6 flex items-center space-x-4",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"w-10 h-10 bg-primary/10 rounded-full flex items-center justify-center",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.27 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z"})})}),i.jsx("div",{className:`${e?"":"hidden"}`,children:i.jsx(M,{iconNode:xe,className:"animate-spin size-6 absolute inset-0 m-auto text-muted-foreground"})})]}),i.jsx("div",{className:"text-foreground font-semibold",children:c}),i.jsx("div",{className:`transition-opacity ${a?"opacity-100 visible":"opacity-0 invisible"}`,children:i.jsx("svg",{id:"checkmark",xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-green-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:i.jsx("path",{className:"checkmark",strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})]})]}),n.props.addishinalLoginPage&&i.jsx("div",{className:"mt-6 text-center",children:i.jsx(Y,{href:n.props.addishinalLoginPage.link,className:"text-sm underline",target:n.props.addishinalLoginPage.link.startsWith("http://")||n.props.addishinalLoginPage.link.startsWith("https://")?"_blank":void 0,rel:n.props.addishinalLoginPage.link.startsWith("http://")||n.props.addishinalLoginPage.link.startsWith("https://")?"noopener noreferrer":void 0,children:n.props.addishinalLoginPage.title})})]})]})}export{Oe as default};
1
+ import{bL as ue,r as L,u as fe,g as ge,j as i,T as he,h as z,L as V,H as M,bM as pe,I as q,E as ye,bN as me,au as we,d as X,p as Y,o as xe,t as J}from"./app-DaEtIZDm.js";import{i as be}from"./use-appearance-D34fLQSc.js";function j(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function H(e){return e.slice().buffer}function p(e){return(typeof e=="string"?e:e.name).toUpperCase()}let Q;function _e(){return typeof crypto>"u"||crypto.subtle?Promise.resolve():(Q??=ve(),Q)}async function ve(){const{SHA256:e,PBKDF2_HMAC_SHA256:r,AES_GCM:n}=await ue(async()=>{const{SHA256:t,PBKDF2_HMAC_SHA256:c,AES_GCM:o}=await import("./asmcrypto-DZeQH0LC.js");return{SHA256:t,PBKDF2_HMAC_SHA256:c,AES_GCM:o}},[],import.meta.url),s={async digest(t,c){if(p(t)!=="SHA-256")throw new Error(`Unsupported digest algorithm: ${p(t)}`);return H(e.bytes(j(c)))},async importKey(t,c,o,a,l){if(t!=="raw")throw new Error(`Unsupported key format: ${t}`);return{__raw:j(c).slice(),algorithm:{name:p(o)},usages:l,type:"secret",extractable:!1}},async deriveBits(t,c,o){if(p(t)!=="PBKDF2"||p(t.hash)!=="SHA-256")throw new Error(`Unsupported deriveBits params: ${p(t)}/${p(t.hash)}`);return H(r.bytes(c.__raw,j(t.salt),t.iterations,o/8))},async encrypt(t,c,o){if(p(t)!=="AES-GCM")throw new Error(`Unsupported encrypt algorithm: ${p(t)}`);return H(n.encrypt(j(o),c.__raw,j(t.iv),void 0,(t.tagLength??128)/8))},async decrypt(t,c,o){if(p(t)!=="AES-GCM")throw new Error(`Unsupported decrypt algorithm: ${p(t)}`);return H(n.decrypt(j(o),c.__raw,j(t.iv),void 0,(t.tagLength??128)/8))}};Object.defineProperty(crypto,"subtle",{value:s,configurable:!0})}const Z=(e,r,n)=>{let s=1n,t=e%n;for(;r;)r&1n&&(s=s*t%n),t=t*t%n,r=r>>1n;return s};function F(e,r,n){return typeof e=="bigint"&&typeof r=="bigint"&&typeof n=="bigint"?Z(e,r,n):Number(Z(BigInt(e),BigInt(r),BigInt(n)))}const _=crypto,ke=new TextEncoder,Ae=new TextDecoder("utf-8",{ignoreBOM:!0}),U={encode:e=>ke.encode(e),decode:e=>Ae.decode(e)},oe=(()=>{const r=[..."0123456789abcdef"],n=new Array(256);for(let s=0;s<256;s++)n[s]=`${r[s>>>4&15]}${r[s&15]}`;return n})(),Ce=(()=>{const e={};for(let r=0;r<256;r++){const n=oe[r],s=n[0],t=s.toUpperCase(),c=n[1],o=c.toUpperCase();e[n]=r,e[`${s}${o}`]=r,e[`${t}${c}`]=r,e[`${t}${o}`]=r}return e})(),Se=e=>!(e.length%2||!/^[a-fA-F0-9]*$/.test(e)),K={encode:e=>{let r="";for(let n=0,s=e.length;n<s;n++)r+=oe[e[n]];return r},encodeStr:e=>K.encode(U.encode(e)),decode:e=>{const r=e.length/2,n=new Uint8Array(r);for(let s=0;s<r;s++)n[s]=Ce[e.slice(s*2,s*2+2)];return n},decodeStr:e=>U.decode(K.decode(e)),is:Se},ce=e=>K.encode(e),ee=new TextEncoder,$=e=>{const r=async o=>o instanceof Uint8Array?_.subtle.importKey("raw",o,{name:"PBKDF2"},!1,["deriveBits"]):typeof o=="string"?r(ee.encode(o.normalize())):o,n=(o,a,l,d)=>(a=typeof a=="string"?ee.encode(a):a,_.subtle.deriveBits({name:"PBKDF2",salt:a,iterations:l,hash:{name:e}},o,d)),s=async(o,a,l,d)=>{const f=await r(o);return await n(f,a,l,d*8)},t=async(o,a,l,d)=>new Uint8Array(await s(o,a,l,d)),c=async(o,a,l,d)=>ce(await t(o,a,l,d));return c.buffer=s,c.hex=c,c.uint8=t,c},ie={sha1:$("SHA-1"),sha256:$("SHA-256"),sha384:$("SHA-384"),sha512:$("SHA-512")},W=e=>{const r=new Uint8Array(e);return _.getRandomValues(r),r},je=new TextEncoder,R=e=>{const r=t=>(t=typeof t=="string"?je.encode(t):t,_.subtle.digest(e,t)),n=async t=>new Uint8Array(await r(t)),s=async t=>ce(await n(t));return s.buffer=r,s.hex=s,s.uint8=n,s};R("SHA-1");const ae=R("SHA-256");R("SHA-384");R("SHA-512");const x={encode:e=>{if(e!==e>>0)throw new Error("Invalid 32-bit integer");const r=e>>24&255,n=e>>16&255,s=e>>8&255,t=e>>0&255;return new Uint8Array([r,n,s,t])},decode:e=>{if(e.length!==4)throw new Error("Invalid 32-bit integer");const r=e[0],n=e[1],s=e[2],t=e[3];return(r<<24)+(n<<16)+(s<<8)+(t<<0)}},le=e=>{const r=e.reduce((s,t)=>s+t.byteLength,0),n=new Uint8Array(r);for(let s=0,t=0,c=e.length;t<c;t++)n.set(e[t],s),s+=e[t].byteLength;return n},Ee=async(e,r,n,s)=>{e=typeof e=="string"?U.encode(e):e,n=typeof n=="string"?U.encode(n):n||W(32),n=n.length===32?n:await ae.uint8(n);const t=new Uint8Array([1]),c=Math.max(1,s||0),o=await ie.sha256.uint8(r,n,c,32),a=await _.subtle.importKey("raw",o,"AES-GCM",!1,["encrypt"]),l=W(16),d=await _.subtle.encrypt({name:"AES-GCM",iv:l,length:256,tagLength:128},a,e),f=new Uint8Array(d);return le([t,n,x.encode(c),l,f])},Be=async(e,r)=>{if(e[0]!==1)throw new Error("Unsupported encrypted archive version");const s=e.subarray(1,33),t=x.decode(e.subarray(33,37)),c=e.subarray(37,53),o=e.subarray(53),a=await ie.sha256.uint8(r,s,t,32),l=await _.subtle.importKey("raw",a,"AES-GCM",!1,["decrypt"]),d=await _.subtle.decrypt({name:"AES-GCM",iv:c,length:256,tagLength:128},l,o);return new Uint8Array(d)},ne=Object.freeze(Object.defineProperty({__proto__:null,decrypt:Be,encrypt:Ee},Symbol.toStringTag,{value:"Module"}));function P(e){let r,n=0;return()=>((!r||n===r.length)&&(r=new e(65536/(e.BYTES_PER_ELEMENT*8)),n=0,_.getRandomValues(r)),r[n++])}function Ne(e,r){let n=0,s=r;return()=>(s===r&&(n=e(),s=0),n&1<<s++?1:0)}const T={get1:Ne(P(Uint8Array),8),get8:P(Uint8Array),get16:P(Uint16Array),get32:P(Uint32Array),get64:P(BigUint64Array)},Ie=Object.assign(()=>BigInt(T.get1()),{BITS:1}),Le=Object.assign(()=>BigInt(T.get8()),{BITS:8}),Pe=Object.assign(()=>BigInt(T.get16()),{BITS:16}),Ue=Object.assign(()=>BigInt(T.get32()),{BITS:32}),Te=Object.assign(()=>T.get64(),{BITS:64}),u=e=>{const r=e<=1?Ie:e<=8?Le:e<=16?Pe:e<=32?Ue:Te,n=r.BITS;if(e===n)return r();if(e===128)return r()<<64n|r();if(e===160)return u(128)<<32n|u(32);if(e===192)return u(128)<<64n|u(64);if(e===224)return u(160)<<64n|u(64);if(e===256)return u(128)<<128n|u(128);if(e===384)return u(256)<<128n|u(128);if(e===512)return u(256)<<256n|u(256);if(e===1024)return u(512)<<512n|u(512);if(e===2048)return u(1024)<<1024n|u(1024);let s=0,t=0n;for(;s<e;){const c=Math.min(n,e-s),o=2n**BigInt(c)-1n,l=r()&o;if(e===c)return l;t=s?t|l<<BigInt(s):l,s+=c}return t},de=(e,r)=>{if(e=BigInt(e),r=BigInt(r),e<0n||r<0n)throw new Error("Negative ranges are not supported");if(r<=e)throw new Error('"max" must be at least equal to "min" plus 1');const n=r-e-1n,s=n.toString(2).length;for(;;){const t=u(s);if(!(t>n))return t+e}},te=[2n,3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n,257n,263n,269n,271n,277n,281n,283n,293n,307n,311n,313n,317n,331n,337n,347n,349n,353n,359n,367n,373n,379n,383n,389n,397n,401n,409n,419n,421n,431n,433n,439n,443n,449n,457n,461n,463n,467n,479n,487n,491n,499n,503n,509n,521n,523n,541n,547n,557n,563n,569n,571n,577n,587n,593n,599n,601n,607n,613n,617n,619n,631n,641n,643n,647n,653n,659n,661n,673n,677n,683n,691n,701n,709n,719n,727n,733n,739n,743n,751n,757n,761n,769n,773n,787n,797n,809n,811n,821n,823n,827n,829n,839n,853n,857n,859n,863n,877n,881n,883n,887n,907n,911n,919n,929n,937n,941n,947n,953n,967n,971n,977n,983n,991n,997n],Me=(e,r=8)=>{if(e<=1n)return!1;for(let t=0,c=te.length;t<c;t++){const o=te[t];if(e%o===0n)return e===o}if(e<=1000n)return!1;let n=0n,s=e-1n;for(;(s&1n)===0n;)n+=1n,s>>=1n;for(let t=0;t<r;t++){const c=de(2n,e-2n);let o=F(c,s,e),a=0n;for(let l=0;l<n;l++){if(a=F(o,2n,e),a===1n&&o!==1n&&o!==e-1n)return!1;o=a}if(a!==1n)return!1}return!0},re=(e,r=8)=>{let n=u(e);for((n&1n)===0n&&(n+=1n);;){if(Me(n,r))return n;n+=2n}},b={encode:e=>{let r=0n;for(let n=0,s=e.length;n<s;n++)r|=BigInt(e[n])<<(BigInt(s)-BigInt(n)-1n)*8n;return r},decode:e=>{if(e<0n)throw new Error("Negative BigInts are not supported");const r=[];for(;e;)r.push(Number(e&0xffn)),e>>=8n;return new Uint8Array(r.reverse())}},se={archive:e=>{const[r,n,s,t,c]=e,o=b.decode(r),a=x.encode(o.length),l=b.decode(n),d=x.encode(l.length),f=b.decode(s),y=x.encode(f.length),g=b.decode(t),m=x.encode(g.length);return le([a,o,d,l,y,f,m,g,c])},unarchive:e=>{const n=e.slice(0,4),s=x.decode(n),t=4,c=e.slice(t,t+s),o=b.encode(c),a=t+s,l=e.slice(a,a+4),d=x.decode(l),f=a+4,y=e.slice(f,f+d),g=b.encode(y),m=f+d,v=e.slice(m,m+4),E=x.decode(v),h=m+4,B=e.slice(h,h+E),N=b.encode(B),k=h+E,w=e.slice(k,k+4),I=x.decode(w),S=k+4,A=e.slice(S,S+I),O=b.encode(A),D=S+I,C=e.slice(D);return[o,g,N,O,C]}},He=(e,r,n)=>{let s=e%n;if(r<=BigInt(Number.MAX_SAFE_INTEGER))for(let t=Number(r);t>0;t--)s=s*s%n;else for(let t=r;t>0n;t--)s=s*s%n;return s%n},$e={generate:async e=>{const r=e.primeBits??100,n=e.primeRounds??20,s=e.opsPerSecond??33e5,t=e.duration??1e3,c=e.message,o=re(r,n),a=re(r,n),l=o*a,d=(o-1n)*(a-1n),f=s,y=t,g=BigInt(Math.round(Math.max(1,f/1e3)*y)),m=await ae.uint8(W(32)),v=c,E=await ne.encrypt(v,m),h=de(1n,l-1n),B=F(2n,g,d),N=F(h,B,l),k=b.encode(m)+N;return se.archive([l,h,g,k,E])},solve:async e=>{const[r,n,s,t,c]=se.unarchive(e),o=He(n,s,r),a=b.decode(t-o),l=await ne.decrypt(c,a);return U.decode(l)}};function Oe(){const[e,r]=L.useState(!1);L.useEffect(()=>{be()},[]);const n=fe(),s=Array.isArray(n.props.captchaTask)&&n.props.captchaTask.length>0,t=n.props.captchaMessages||{},[c,o]=L.useState(t.initial||"I'm not a robot"),[a,l]=L.useState(!1),[d,f]=L.useState(!1),{post:y,data:g,setData:m,processing:v,transform:E,errors:h,clearErrors:B}=ge({login:"",password:"",captchaSolution:"",redirectTo:n.props.redirectTo??""}),N=w=>{if(w.preventDefault(),!s){y(n.props.submitLink,{onError:S=>{for(const A of Object.keys(S))J.error(S[A])}});return}r(!0),o(t.solving||"Solving CAPTCHA..."),l(!1),(async()=>{try{let A=function(C){return new Promise(G=>setTimeout(G,C))};var S=A;await A(100),await _e();const O=new Uint8Array(n.props.captchaTask),D=await $e.solve(O);o(t.success||"Verification complete!"),r(!1),l(!0),E(C=>({...C,captchaSolution:D})),y(n.props.submitLink,{onError:C=>{for(const G of Object.keys(C))J.error(C[G])}})}catch(A){console.error("Error solving CAPTCHA:",A),o(t.error||"Error solving CAPTCHA. Try again.")}})()},k=(w,I)=>{B(),m(w,I)};return i.jsxs("div",{className:"bg-sidebar flex min-h-svh w-full justify-center",children:[i.jsx(he,{position:"top-center",richColors:!0,closeButton:!0}),i.jsxs("div",{className:"rounded-xl border bg-card text-card-foreground shadow p-6 max-w-sm w-full h-fit mt-[15%]",children:[i.jsx("h1",{className:"font-medium mb-6 text-xl",children:n.props.title}),n.props.description&&i.jsx("p",{className:"font-thin mb-6 text-xs pb-10",children:n.props.description}),i.jsxs("form",{onSubmit:N,children:[g.redirectTo&&i.jsx("input",{type:"hidden",name:"redirectTo",value:g.redirectTo}),i.jsxs("div",{className:"grid gap-5",children:[s&&i.jsx(z,{message:h.captchaSolution}),i.jsxs("div",{className:"grid gap-4",children:[i.jsx(V,{htmlFor:"login",children:n.props.login}),i.jsxs("div",{className:"relative",children:[i.jsx(M,{iconNode:pe,className:"size-5 absolute inset-2 text-muted-foreground"}),i.jsx(q,{id:"login",className:`pl-10 ${h.login?"border-red-500":""}`,type:"text",required:!0,tabIndex:1,autoComplete:"username",value:g.login,disabled:v||e,onChange:w=>{k("login",w.target.value)},placeholder:n.props.login}),i.jsx(z,{message:h.login})]})]}),i.jsxs("div",{className:"grid gap-4",children:[i.jsx(V,{htmlFor:"password",children:n.props.password}),i.jsxs("div",{className:"relative",children:[i.jsx(M,{iconNode:ye,className:"size-5 absolute inset-2 text-muted-foreground"}),i.jsx(q,{id:"password",className:`pl-10 pr-10 ${h.password?"border-red-500":""}`,type:d?"text":"password",required:!0,disabled:v||e,tabIndex:1,autoComplete:"current-password",value:g.password,onChange:w=>{k("password",w.target.value)},placeholder:n.props.password}),i.jsx("button",{type:"button",onClick:()=>f(!d),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:i.jsx(M,{iconNode:d?me:we,className:"size-5"})}),i.jsx(z,{message:h.password})]})]}),i.jsxs("div",{className:"flex gap-4",children:[i.jsx(X,{type:"submit",className:"w-fit",disabled:v||e,children:n.props.submitButton}),n.props.registerLink&&i.jsx(X,{asChild:!0,variant:"outline",children:i.jsx(Y,{href:n.props.registerLink.link,className:`${v||e} ? 'pointer-events-none opacity-50' : ''`,children:n.props.registerLink.title})})]})]}),s&&i.jsxs("div",{className:"bg-card border rounded-lg shadow-lg p-4 mt-6 flex items-center space-x-4",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"w-10 h-10 bg-primary/10 rounded-full flex items-center justify-center",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.27 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z"})})}),i.jsx("div",{className:`${e?"":"hidden"}`,children:i.jsx(M,{iconNode:xe,className:"animate-spin size-6 absolute inset-0 m-auto text-muted-foreground"})})]}),i.jsx("div",{className:"text-foreground font-semibold",children:c}),i.jsx("div",{className:`transition-opacity ${a?"opacity-100 visible":"opacity-0 invisible"}`,children:i.jsx("svg",{id:"checkmark",xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-green-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:i.jsx("path",{className:"checkmark",strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})]})]}),n.props.addishinalLoginPage&&i.jsx("div",{className:"mt-6 text-center",children:i.jsx(Y,{href:n.props.addishinalLoginPage.link,className:"text-sm underline",target:n.props.addishinalLoginPage.link.startsWith("http://")||n.props.addishinalLoginPage.link.startsWith("https://")?"_blank":void 0,rel:n.props.addishinalLoginPage.link.startsWith("http://")||n.props.addishinalLoginPage.link.startsWith("https://")?"noopener noreferrer":void 0,children:n.props.addishinalLoginPage.title})})]})]})}export{Oe as default};