dhx-react-suite 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dhx-react-suite.js +1798 -1415
- package/dist/dhx-react-suite.js.map +1 -1
- package/dist/dhx-react-suite.umd.cjs +2 -2
- package/dist/dhx-react-suite.umd.cjs.map +1 -1
- package/dist/index.d.ts +56 -15
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(V,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("recharts")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","recharts"],e):(V=typeof globalThis<"u"?globalThis:V||self,e(V.DhxReactSuite={},V.ReactJSXRuntime,V.React,V.Recharts))})(this,function(V,e,g,Q){"use strict";const t={primary:"#0288d1",primaryDk:"#01579b",primaryLt:"#e1f5fe",success:"#43a047",danger:"#e53935",warning:"#fb8c00",bg:"#f5f7fa",surface:"#ffffff",border:"#dde3ea",borderDk:"#b0bec5",text:"#3d4a5c",textSec:"#6b7a8d",textMut:"#9aa5b1",shadow:"0 2px 8px rgba(0,0,0,.10)",shadowLg:"0 8px 28px rgba(0,0,0,.14)",r:"4px",rMd:"8px",font:"'Segoe UI', system-ui, -apple-system, sans-serif"},De="dhx-react-styles";function Z(){if(typeof document>"u"||document.getElementById(De))return;const r=document.createElement("style");r.id=De,r.textContent=`
|
|
2
2
|
*,*::before,*::after{box-sizing:border-box}
|
|
3
3
|
.dhx{font-family:${t.font};font-size:14px;color:${t.text}}
|
|
4
4
|
.dhx *{box-sizing:border-box}
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
.dhx-tag-success{background:#e8f5e9;color:#1b5e20}
|
|
39
39
|
.dhx-tag-danger{background:#ffebee;color:#b71c1c}
|
|
40
40
|
.dhx-tag-warning{background:#fff3e0;color:#e65100}
|
|
41
|
-
`,document.head.appendChild(r)}const Ke={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function _e({children:r,variant:o="primary",size:d="md",icon:i,disabled:g,onClick:a,style:u,className:p=""}){return f.useEffect(V,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${o} ${p}`,style:{...Ke[d],...u},disabled:g,onClick:a,children:[i&&e.jsx("span",{style:{fontSize:16},children:i}),r]})}function le(r,o){f.useEffect(()=>{const d=i=>{r.current&&!r.current.contains(i.target)&&o(i)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r,o])}function $e(r){const o=f.useRef(!1),d=f.useRef({x:0,y:0,ox:0,oy:0});return f.useCallback((i,g=0,a=0)=>{o.current=!0,d.current={x:i.clientX,y:i.clientY,ox:g,oy:a};const u=y=>{if(!o.current)return;const{x:w,y:n,ox:s,oy:c}=d.current;r(s+y.clientX-w,c+y.clientY-n)},p=()=>{o.current=!1,document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",p),i.preventDefault()},[r])}function de({items:r,onSelect:o,style:d}){const[i,g]=f.useState(null);return e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:200,padding:"4px 0",...d},children:r.map((a,u)=>{var y,w;if(a.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},u);const p=i===u;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>g(u),onMouseLeave:()=>g(null),children:[e.jsxs("div",{onClick:()=>{var n;return!a.disabled&&!((n=a.items)!=null&&n.length)&&o(a)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:a.disabled?"not-allowed":"pointer",fontSize:13,color:a.disabled?t.textMut:t.text,background:p&&!a.disabled?t.bg:"transparent",opacity:a.disabled?.5:1},children:[a.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:a.icon}),e.jsx("span",{style:{flex:1},children:a.value||a.id}),a.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:a.hotkey}),(y=a.items)!=null&&y.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),p&&((w=a.items)!=null&&w.length)?e.jsx(de,{items:a.items,onSelect:o,style:{position:"absolute",left:"100%",top:-4}}):null]},a.id||u)})})}function Ve({items:r=[],label:o="Menu",onSelect:d,style:i}){const[g,a]=f.useState(!1),u=f.useRef(null);return f.useEffect(V,[]),le(u,f.useCallback(()=>a(!1),[])),e.jsxs("div",{ref:u,className:"dhx",style:{position:"relative",display:"inline-block",...i},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>a(p=>!p),children:[o," ",e.jsx("span",{style:{fontSize:10},children:g?"▲":"▼"})]}),g&&e.jsx(de,{items:r,onSelect:p=>{d==null||d(p),a(!1)}})]})}function Xe({items:r=[],onSelect:o,children:d}){const[i,g]=f.useState(null),a=f.useRef(null);f.useEffect(V,[]),le(a,f.useCallback(()=>g(null),[]));const u=p=>{p.preventDefault(),g({x:p.clientX,y:p.clientY})};return e.jsxs("div",{ref:a,onContextMenu:u,style:{position:"relative",display:"contents"},children:[d,i&&e.jsx("div",{style:{position:"fixed",left:i.x,top:i.y,zIndex:9999},children:e.jsx(de,{items:r,onSelect:p=>{o==null||o(p),g(null)}})})]})}function De({count:r}){return e.jsx("span",{style:{position:"absolute",top:2,right:2,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function qe({items:r=[],onAction:o,style:d}){const[i,g]=f.useState(null),[a,u]=f.useState(()=>{const n={};return r.forEach(s=>{s.id&&(s.twoState||s.group)&&s.active&&(n[s.id]=!0)}),n}),p=f.useRef(null);f.useEffect(V,[]),le(p,f.useCallback(()=>g(null),[]));const y=(n,s)=>{var c,v;if(!n.disabled){if(n.twoState&&n.id&&u(S=>({...S,[n.id]:!S[n.id]})),n.group&&n.id&&u(S=>{const l={...S};return r.forEach(x=>{x.group===n.group&&x.id&&(l[x.id]=!1)}),l[n.id]=!0,l}),(c=n.items)!=null&&c.length){g(S=>S===s?null:s);return}(v=n.onClick)==null||v.call(n,n.id||""),o==null||o(n.id||"")}},w=(n,s)=>{var l,x;if(n.hidden)return null;if(n.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},s);if(n.type==="spacer")return e.jsx("div",{style:{flex:1}},s);if(n.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:n.label}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[n.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:n.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:n.width||140,height:28,paddingLeft:n.icon?30:void 0},placeholder:n.placeholder,defaultValue:n.value,onChange:m=>{var z;return(z=n.onChange)==null?void 0:z.call(n,m.target.value)}})]})]},s);if(n.type==="select")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:n.label}),e.jsx("select",{className:"dhx dhx-input",style:{width:n.width||100,height:28,cursor:"pointer"},defaultValue:n.value,onChange:m=>{var z;return(z=n.onChange)==null?void 0:z.call(n,m.target.value)},children:(l=n.options)==null?void 0:l.map(m=>e.jsx("option",{value:m.value,children:m.label},m.value))})]},s);if(n.type==="imageButton")return e.jsxs("button",{title:n.tooltip,disabled:n.disabled,style:{position:"relative",width:32,height:32,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:n.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>y(n,s),children:[n.src&&e.jsx("img",{src:n.src,alt:n.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),n.count!==void 0&&e.jsx(De,{count:n.count})]},s);const c=!!(n.id&&a[n.id]),v=n.value??n.text,S=!!((x=n.items)!=null&&x.length);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:n.tooltip,disabled:n.disabled,style:{height:32,gap:4,position:"relative",background:c?t.primaryLt:"transparent",color:c?t.primary:n.disabled?t.textMut:t.text,opacity:n.disabled?.55:1,cursor:n.disabled?"not-allowed":"pointer"},onClick:()=>y(n,s),children:[n.icon&&e.jsx("span",{style:{fontSize:16},children:n.icon}),v&&e.jsx("span",{style:{fontSize:13},children:v}),S&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),n.count!==void 0&&e.jsx(De,{count:n.count})]}),S&&i===s&&e.jsx(de,{items:n.items,onSelect:()=>g(null),style:{top:"100%",left:0}})]},s)};return e.jsx("div",{ref:p,className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...d},children:r.map(w)})}function Ge({items:r=[],width:o=240,collapsed:d,onSelect:i,header:g,footer:a,style:u}){const[p,y]=f.useState(d??!1),[w,n]=f.useState(null),[s,c]=f.useState({});f.useEffect(V,[]);const v=p?56:o,S=x=>{n(x.id),i==null||i(x)},l=(x,m=0)=>{var C;if(x.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},x.id);if(x.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:x.html||""}},x.id);const z=(((C=x.items)==null?void 0:C.length)??0)>0,T=s[x.id],k=w===x.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{z&&c(W=>({...W,[x.id]:!W[x.id]})),S(x)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${p?"0px":`${12+m*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:p?"center":"flex-start",transition:"all .15s",background:k?t.primaryLt:"transparent",color:k?t.primary:t.text,userSelect:"none"},onMouseEnter:W=>!k&&(W.currentTarget.style.background=t.bg),onMouseLeave:W=>!k&&(W.currentTarget.style.background="transparent"),children:[x.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:x.icon}),!p&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:k?600:400},children:x.value}),!p&&x.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:x.count}),!p&&z&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:T?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),z&&T&&!p&&x.items.map(W=>l(W,m+1))]},x.id)};return e.jsxs("div",{className:"dhx",style:{width:v,minWidth:v,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease",overflow:"hidden",...u},children:[g&&!p&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:g}),e.jsx("button",{onClick:()=>y(x=>!x),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:p?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:p?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:r.map(x=>l(x))}),a&&!p&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:a})]})}function Je({config:r}){const[o,d]=f.useState(!1),i={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...r.width?{width:r.width,minWidth:r.width}:{flex:1},...r.height?{height:r.height,minHeight:r.height}:{minHeight:40},...o?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:i,children:[r.header&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:t.bg,borderBottom:`1px solid ${t.border}`,fontSize:12,fontWeight:600,color:t.textSec,userSelect:"none"},children:[e.jsx("span",{children:r.header}),r.collapsable&&e.jsx("button",{onClick:()=>d(g=>!g),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:o?"▼":"▲"})]}),!o&&e.jsxs("div",{style:{padding:r.padding||0,height:r.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[r.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:r.html}}):r.content,(r.rows||r.cols)&&e.jsx(Ee,{rows:r.rows,cols:r.cols,style:{height:"100%"}})]})]})}function Ee({rows:r,cols:o,type:d="line",style:i,children:g}){f.useEffect(V,[]);const a=d==="space"?12:d==="wide"?8:1,u=r||o,p=!!r;return u?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:p?"column":"row",gap:a,width:"100%",height:"100%",...i},children:u.map((y,w)=>e.jsx(Je,{config:y},y.id||w))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...i},children:g})}function Ue({views:r=[],mode:o="top",tabAlign:d="left",closable:i=[],disabled:g=[],defaultActive:a,onBeforeChange:u,onChange:p,style:y}){var k;const[w,n]=f.useState(a||((k=r[0])==null?void 0:k.id)),[s,c]=f.useState(r.map(C=>C.id));f.useEffect(V,[]);const v=(C,W)=>{C.stopPropagation(),c(h=>h.filter(L=>L!==W)),w===W&&n(s.find(h=>h!==W)??"")},S=C=>{g.includes(C)||u&&u(C)===!1||(n(C),p==null||p(C))},l=o==="left"||o==="right",x=r.filter(C=>s.includes(C.id)),m=e.jsx("div",{style:{display:"flex",flexDirection:l?"column":"row",justifyContent:d==="center"?"center":d==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!l&&o!=="bottom"?`2px solid ${t.border}`:"none",borderTop:o==="bottom"?`2px solid ${t.border}`:"none",borderRight:o==="left"?`2px solid ${t.border}`:"none",borderLeft:o==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:x.map(C=>{const W=w===C.id,h=g.includes(C.id),L=o==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:l?{color:t.primary,fontWeight:600,background:t.primaryLt,[o==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>S(C.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:h?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:l?120:"auto",...W?L:{color:h?t.textMut:t.textSec}},children:[C.icon&&e.jsx("span",{style:{fontSize:16},children:C.icon}),e.jsx("span",{children:C.tab}),i.includes(C.id)&&e.jsx("span",{onClick:N=>v(N,C.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},C.id)})}),z=x.find(C=>C.id===w),T=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[z==null?void 0:z.content,(z==null?void 0:z.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:z.html},style:{padding:16}})]});return e.jsxs("div",{className:"dhx",style:{display:"flex",flexDirection:o==="top"?"column":o==="bottom"?"column-reverse":o==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...y},children:[m,T]})}const ie=`1px solid ${t.border}`;function Qe({active:r,dir:o}){return e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",gap:1,flexShrink:0,marginLeft:4},children:[e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 0L7 4H0z",fill:r&&o==="asc"?t.primary:t.borderDk})}),e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 4L0 0H7z",fill:r&&o==="desc"?t.primary:t.borderDk})})]})}function Ze({options:r,value:o,onChange:d,onCommit:i,onCancel:g}){const[a,u]=f.useState(o),[p,y]=f.useState(!0),w=f.useRef(null);f.useEffect(()=>{const s=c=>{w.current&&!w.current.contains(c.target)&&i()};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[i]);const n=r.filter(s=>!a||s.toLowerCase().includes(a.toLowerCase()));return e.jsxs("div",{ref:w,style:{width:"100%",position:"relative"},children:[e.jsx("input",{autoFocus:!0,value:a,onChange:s=>{u(s.target.value),d(s.target.value),y(!0)},onKeyDown:s=>{s.key==="Enter"&&i(),s.key==="Escape"&&g()},onClick:s=>s.stopPropagation(),style:{width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text}}),p&&n.length>0&&e.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:50,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,maxHeight:160,overflowY:"auto"},children:n.map(s=>e.jsx("div",{onMouseDown:c=>{c.preventDefault(),d(s),u(s),y(!1),i()},style:{padding:"6px 10px",cursor:"pointer",fontSize:13,color:t.text},onMouseEnter:c=>c.currentTarget.style.background=t.bg,onMouseLeave:c=>c.currentTarget.style.background=t.surface,children:s},s))})]})}function Re(r,o){if(r==null)return"";if(o==="number")return typeof r=="number"?r.toLocaleString():String(r);if(o==="date"){const d=r instanceof Date?r:new Date(String(r));return isNaN(d.getTime())?String(r):d.toLocaleDateString()}return String(r)}function et(r,o,d){return r==null?1:o==null?-1:d==="date"?new Date(String(r)).getTime()-new Date(String(o)).getTime():d==="number"?Number(r)-Number(o):String(r)<String(o)?-1:String(r)>String(o)?1:0}function fe(r){var o;return Array.isArray(r.header)&&((o=r.header[1])==null?void 0:o.content)!=null?r.header[1].content:r.filterable?r.filterType==="select"?"selectFilter":"inputFilter":null}function tt(r,o,d,i,g){const a={width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text},u=r.editorType??"input";if(u==="select")return e.jsx("select",{autoFocus:!0,value:o,onChange:y=>d(y.target.value),onBlur:i,onKeyDown:y=>{y.key==="Enter"&&i(),y.key==="Escape"&&g()},onClick:y=>y.stopPropagation(),style:{...a,cursor:"pointer"},children:(r.options??[]).map(y=>e.jsx("option",{value:y,children:y},y))});if(u==="combobox")return e.jsx(Ze,{options:r.options??[],value:o,onChange:d,onCommit:i,onCancel:g});const p=r.type==="number"?"number":r.type==="date"?"date":"text";return e.jsx("input",{autoFocus:!0,type:p,value:o,onChange:y=>d(y.target.value),onBlur:i,onKeyDown:y=>{y.key==="Enter"&&i(),y.key==="Escape"&&g()},onClick:y=>y.stopPropagation(),style:a})}function rt({columns:r,data:o=[],height:d=400,rowHeight:i=40,headerRowHeight:g=40,footerRowHeight:a=40,sortable:u=!0,resizable:p=!0,editable:y=!1,stripe:w=!1,autoWidth:n=!1,keyNavigation:s=!1,selection:c,multiselect:v,leftSplit:S=0,onSelect:l,onChange:x,style:m}){var Pe;const[z,T]=f.useState(null),[k,C]=f.useState("asc"),[W,h]=f.useState({}),[L,N]=f.useState(new Set),[D,q]=f.useState(-1),[J,oe]=f.useState(()=>Object.fromEntries(r.map(b=>[b.id,b.width??b.minWidth??150]))),[Z,ne]=f.useState(null),[I,M]=f.useState(""),[H,j]=f.useState({}),K=f.useRef(null),[_,re]=f.useState(0);f.useEffect(V,[]),f.useEffect(()=>{if(!n||!K.current)return;const b=new ResizeObserver(()=>{var $;return re((($=K.current)==null?void 0:$.offsetWidth)??0)});return b.observe(K.current),()=>b.disconnect()},[n]);const X=f.useMemo(()=>r.map(b=>b.summary&&(!b.footer||b.footer.length===0)?{...b,footer:[{summary:b.summary}]}:b),[r]),G=f.useMemo(()=>X.filter(b=>!b.hidden),[X]),te=f.useMemo(()=>{if(!n||_===0)return J;const b=G.reduce((E,A)=>E+(J[A.id]??150),0);if(_<=b)return J;const $=(_-b)/G.length;return Object.fromEntries(G.map(E=>[E.id,(J[E.id]??150)+$]))},[n,_,J,G]),R=f.useMemo(()=>{let b=o.map(($,E)=>{const A=String($.id??E);return H[A]?{...$,...H[A]}:$}).filter($=>Object.entries(W).every(([E,A])=>!A||String($[E]??"").toLowerCase().includes(A.toLowerCase())));if(z){const $=X.find(E=>E.id===z);b=[...b].sort((E,A)=>{const O=et(E[z],A[z],$==null?void 0:$.type);return k==="asc"?O:-O})}return b},[o,z,k,W,H,X]),ue=f.useMemo(()=>{const b={};return X.forEach($=>{var E;if((E=$.footer)!=null&&E.some(A=>A.summary)){const A=R.map(B=>Number(B[$.id])).filter(B=>!isNaN(B)),O=A.reduce((B,U)=>B+U,0);b[$.id]={sum:O,avg:A.length?O/A.length:0,count:R.length,min:A.length?Math.min(...A):0,max:A.length?Math.max(...A):0}}}),b},[R,X]),ce=f.useMemo(()=>{const b={};return G.filter($=>{const E=fe($);return E==="selectFilter"||E==="comboFilter"}).forEach($=>{b[$.id]=[...new Set(o.map(E=>String(E[$.id]??"")))].sort()}),b},[o,G]),F=G.some(b=>fe(b)!==null),ae=X.some(b=>{var $;return($=b.footer)==null?void 0:$.length}),Mt=G.reduce((b,$)=>b+(te[$.id]??150),0),pe=f.useMemo(()=>{if(!S)return{};let b=0;const $={};return G.forEach((E,A)=>{A<S&&($[E.id]=b,b+=te[E.id]??150)}),$},[S,G,te]),He=S>0?(Pe=G[S-1])==null?void 0:Pe.id:null,me=(b,$)=>b.id??$,Ct=b=>{!u||b.sortable===!1||(C($=>z===b.id&&$==="asc"?"desc":"asc"),T(b.id))},ze=(b,$)=>{if(!c)return;const E=me(b,$);q($),N(A=>{const O=v?new Set(A):new Set;return O.has(E)?O.delete(E):O.add(E),O}),l==null||l(b)},$t=()=>{if(!Z)return;const{key:b,colId:$}=Z;j(A=>({...A,[String(b)]:{...A[String(b)]||{},[$]:I}}));const E=R.find((A,O)=>me(A,O)===b);E&&(x==null||x(E,$,I)),ne(null)},Dt=b=>{if(Z&&b.key==="Escape"){ne(null);return}if(!(!s||!c)){if(b.key==="ArrowDown"){b.preventDefault();const $=Math.min(D+1,R.length-1);$>=0&&ze(R[$],$)}else if(b.key==="ArrowUp"){b.preventDefault();const $=Math.max(D-1,0);$>=0&&ze(R[$],$)}}},Et=(b,$)=>{b.preventDefault(),b.stopPropagation();const E=b.clientX,A=J[$]??150,O=r.find(Q=>Q.id===$),B=Q=>oe(se=>({...se,[$]:Math.max((O==null?void 0:O.minWidth)||50,A+Q.clientX-E)})),U=()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",U)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",U)},Me=(b,$,E,A,O,B="hidden")=>{const U=b in pe;return{width:$,minWidth:$,flexShrink:0,boxSizing:"border-box",padding:"0 12px",height:O,display:"flex",alignItems:"center",overflow:B,textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:E,justifyContent:E==="center"?"center":E==="right"?"flex-end":"flex-start",borderLeft:A?"none":ie,position:U?"sticky":"relative",...U?{left:pe[b],zIndex:1,boxShadow:b===He?"2px 0 6px rgba(0,0,0,0.1)":void 0}:{}}};return e.jsx("div",{ref:K,className:"dhx",tabIndex:s?0:void 0,onKeyDown:Dt,style:{width:"100%",height:d,display:"flex",flexDirection:"column",border:ie,borderRadius:t.r,overflow:"hidden",outline:"none",...m},children:e.jsx("div",{className:"dhx-scroll",style:{overflow:"auto",flex:1},children:e.jsxs("div",{style:{minWidth:Mt,display:"flex",flexDirection:"column",minHeight:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:ie,flexShrink:0,position:"sticky",top:0,zIndex:3},children:G.map((b,$)=>{const E=Array.isArray(b.header)?b.header[0]:null,A=(E==null?void 0:E.text)??(typeof b.header=="string"?b.header:b.id),O=(E==null?void 0:E.align)??b.align,B=te[b.id]??150,U=b.id in pe;return e.jsxs("div",{onClick:()=>Ct(b),style:{...Me(b.id,B,O,$===0,g),fontWeight:500,color:t.text,background:t.bg,cursor:u&&b.sortable!==!1?"pointer":"default",userSelect:"none",...U?{zIndex:4}:{}},children:[E!=null&&E.htmlEnable?e.jsx("span",{style:{flex:1,overflow:"hidden"},dangerouslySetInnerHTML:{__html:A}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A}),u&&b.sortable!==!1&&e.jsx(Qe,{active:z===b.id,dir:k}),p&&b.resizable!==!1&&$<G.length-1&&e.jsx("div",{onMouseDown:Q=>Et(Q,b.id),onClick:Q=>Q.stopPropagation(),style:{position:"absolute",right:0,top:0,bottom:0,width:4,cursor:"col-resize",zIndex:1},onMouseEnter:Q=>Q.currentTarget.style.background=t.primary+"55",onMouseLeave:Q=>Q.currentTarget.style.background="transparent"})]},b.id)})}),F&&e.jsx("div",{style:{display:"flex",borderBottom:ie,background:t.surface,flexShrink:0,...S?{position:"sticky",top:g,zIndex:3}:{}},children:G.map((b,$)=>{const E=fe(b),A=te[b.id]??150,O=b.id in pe;return e.jsx("div",{style:{width:A,minWidth:A,flexShrink:0,padding:"4px 6px",boxSizing:"border-box",borderLeft:$===0?"none":ie,background:t.surface,...O?{position:"sticky",left:pe[b.id],zIndex:4,boxShadow:b.id===He?"2px 0 6px rgba(0,0,0,0.1)":void 0}:{}},children:E==="selectFilter"||E==="comboFilter"?e.jsxs("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,padding:"0 4px"},value:W[b.id]||"",onChange:B=>h(U=>({...U,[b.id]:B.target.value})),children:[e.jsx("option",{value:"",children:"All"}),(ce[b.id]||[]).map(B=>e.jsx("option",{value:B,children:B},B))]}):E==="inputFilter"?e.jsx("input",{className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Filter...",value:W[b.id]||"",onChange:B=>h(U=>({...U,[b.id]:B.target.value}))}):null},b.id)})}),e.jsxs("div",{style:{flex:1},children:[R.map((b,$)=>{const E=me(b,$),A=L.has(E),O=A?t.primaryLt:w&&$%2!==0?t.bg:t.surface;return e.jsx("div",{style:{display:"flex",height:i,borderBottom:ie,flexShrink:0,background:O,transition:"background .1s",cursor:c?"pointer":"default"},onMouseEnter:B=>!A&&(B.currentTarget.style.background=t.primaryLt+"80"),onMouseLeave:B=>!A&&(B.currentTarget.style.background=O),children:G.map((B,U)=>{const Q=(Z==null?void 0:Z.key)===E&&(Z==null?void 0:Z.colId)===B.id,se=b[B.id],Lt=te[B.id]??150,Fe=(y||B.editable)&&B.editable!==!1;let he;return Q?he=tt(B,I,M,$t,()=>ne(null)):B.template?he=B.template(se,b):B.htmlEnable?he=e.jsx("span",{dangerouslySetInnerHTML:{__html:String(se??"")}}):B.type==="boolean"?he=e.jsx("input",{type:"checkbox",readOnly:!0,checked:!!se,style:{width:16,height:16,accentColor:t.primary,cursor:Fe?"pointer":"default"}}):he=Re(se,B.type),e.jsx("div",{onClick:()=>{if(ze(b,$),!!Fe)if(B.type==="boolean"){const je=!se,Oe=String(E);j(Ye=>({...Ye,[Oe]:{...Ye[Oe]||{},[B.id]:je}})),x==null||x(b,B.id,je)}else ne({key:E,colId:B.id}),M(String(se??""))},style:{...Me(B.id,Lt,B.align,U===0,i,Q?"visible":"hidden"),background:O},children:he},B.id)})},String(E))}),R.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut,fontSize:13},children:"No data"})]}),ae&&e.jsx("div",{style:{display:"flex",borderTop:ie,background:t.bg,flexShrink:0,position:"sticky",bottom:0,zIndex:2},children:G.map((b,$)=>{var Q;const E=(Q=b.footer)==null?void 0:Q[0],A=ue[b.id]??{sum:0,avg:0,count:0,min:0,max:0};let O="";E&&(typeof E.text=="function"?O=E.text(A):E.text?O=E.text:E.summary&&(O=String(Math.round(A[E.summary]*100)/100)));const B=te[b.id]??150,U=b.id in pe;return e.jsx("div",{style:{...Me(b.id,B,b.align,$===0,a),fontWeight:600,color:t.text,background:t.bg,...U?{zIndex:3}:{}},children:O},b.id)})})]})})})}const ee=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function nt(r,o,d){const i=r.filter(a=>!a.parent),g=r.filter(a=>!!a.parent);return i.map(a=>({name:a[d],children:g.filter(u=>u.parent===a.id).map(u=>({name:u[d],value:Number(u[o]??0)}))}))}function ot({type:r="bar",data:o=[],series:d=[],scales:i={},legend:g,height:a=280,style:u}){var x,m,z,T,k,C,W,h,L,N,D,q,J,oe,Z,ne;f.useEffect(V,[]);const p=((x=i.bottom)==null?void 0:x.text)||o[0]&&Object.keys(o[0])[0]||"x",y=e.jsx(Y.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),w=g?e.jsx(Y.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:g.valign==="bottom"?"bottom":g.valign==="middle"?"middle":"top",align:g.halign??"center"}):null,n=e.jsx(Y.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),s=e.jsx(Y.XAxis,{dataKey:p,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1,label:(m=i.bottom)!=null&&m.title?{value:i.bottom.title,position:"insideBottom",offset:-4,fontSize:11}:void 0}),c=e.jsx(Y.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((z=i.left)==null?void 0:z.min)??"auto",((T=i.left)==null?void 0:T.max)??"auto"],tickCount:(k=i.left)==null?void 0:k.maxTicks,label:(C=i.left)!=null&&C.title?{value:i.left.title,angle:-90,position:"insideLeft",fontSize:11}:void 0}),v={top:10,right:20,left:0,bottom:(W=i.bottom)!=null&&W.title?20:0},S={data:o,margin:v};let l;if(r==="bar")l=e.jsxs(Y.BarChart,{...S,children:[n,s,c,y,w,d.map((I,M)=>e.jsx(Y.Bar,{dataKey:I.value||I.id||"",name:I.label||I.id,fill:I.fill||I.color||ee[M%ee.length],radius:[3,3,0,0]},I.id??M))]});else if(r==="line")l=e.jsxs(Y.LineChart,{...S,children:[n,s,c,y,w,d.map((I,M)=>{const H=I.color||ee[M%ee.length];return e.jsx(Y.Line,{type:"monotone",dataKey:I.value||I.id||"",name:I.label||I.id,stroke:H,strokeWidth:I.strokeWidth??2,dot:{r:3,fill:H}},I.id??M)})]});else if(r==="area")l=e.jsxs(Y.AreaChart,{...S,children:[n,s,c,y,w,d.map((I,M)=>{const H=I.color||ee[M%ee.length];return e.jsx(Y.Area,{type:"monotone",dataKey:I.value||I.id||"",name:I.label||I.id,stroke:H,fill:(I.fill||H)+"33",strokeWidth:I.strokeWidth??2},I.id??M)})]});else if(r==="pie"||r==="donut"){const I=d[0]||{},M=I.value||"value",H=I.text||"name",j=I.color&&o[0]&&I.color in o[0]?I.color:null;l=e.jsxs(Y.PieChart,{children:[e.jsx(Y.Pie,{data:o,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:M,nameKey:H,stroke:I.stroke||"none",strokeWidth:I.strokeWidth??0,label:({name:K,percent:_})=>`${K??""} ${((_??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:o.map((K,_)=>e.jsx(Y.Cell,{fill:j?K[j]:ee[_%ee.length]},_))}),y,w]})}else if(r==="radar"){const I=((h=i.radial)==null?void 0:h.value)||p;l=e.jsxs(Y.RadarChart,{...S,cx:"50%",cy:"50%",children:[e.jsx(Y.PolarGrid,{}),e.jsx(Y.PolarAngleAxis,{dataKey:I,tick:{fontSize:11}}),e.jsx(Y.PolarRadiusAxis,{tick:{fontSize:9,fill:t.textMut},axisLine:!1}),d.map((M,H)=>{const j=M.color||M.pointColor||ee[H%ee.length];return e.jsx(Y.Radar,{dataKey:M.value||M.id||"",name:M.label||M.id,stroke:j,fill:j+"44"},M.id??H)}),y,w]})}else if(r==="scatter")l=e.jsxs(Y.ScatterChart,{margin:v,children:[n,e.jsx(Y.XAxis,{type:"number",dataKey:"x",name:((L=i.bottom)==null?void 0:L.title)||"x",tick:{fontSize:11,fill:t.textSec},tickLine:!1,domain:[((N=i.bottom)==null?void 0:N.min)??"auto",((D=i.bottom)==null?void 0:D.max)??"auto"],label:(q=i.bottom)!=null&&q.title?{value:i.bottom.title,position:"insideBottom",offset:-4,fontSize:11}:void 0}),e.jsx(Y.YAxis,{type:"number",dataKey:"y",name:((J=i.left)==null?void 0:J.title)||"y",tick:{fontSize:11,fill:t.textSec},tickLine:!1,axisLine:!1,domain:[((oe=i.left)==null?void 0:oe.min)??"auto",((Z=i.left)==null?void 0:Z.max)??"auto"],label:(ne=i.left)!=null&&ne.title?{value:i.left.title,angle:-90,position:"insideLeft",fontSize:11}:void 0}),y,w,d.map((I,M)=>{const H=I.value||"x",j=I.valueY||"y",K=(I.data||o).map(_=>({x:_[H],y:_[j]}));return e.jsx(Y.Scatter,{data:K,name:I.label||I.id,fill:I.color||ee[M%ee.length]},I.id??M)})]});else if(r==="treeMap"){const I=d[0]||{},M=I.value||"value",H=I.text||"name",j=nt(o,M,H),K=I.stroke||t.surface,_=I.strokeWidth??2;l=e.jsx(Y.Treemap,{data:j,dataKey:"value",aspectRatio:4/3,stroke:K,content:re=>{const{x:X,y:G,width:te,height:R,depth:ue,index:ce,name:F}=re;if(ue===0)return null;const ae=ee[ce%ee.length];return e.jsxs("g",{children:[e.jsx("rect",{x:X,y:G,width:te,height:R,fill:ae,stroke:K,strokeWidth:_,style:{borderRadius:3}}),te>40&&R>20&&e.jsx("text",{x:X+te/2,y:G+R/2,textAnchor:"middle",dominantBaseline:"middle",fill:"#fff",fontSize:11,pointerEvents:"none",children:F})]})}})}return e.jsx("div",{className:"dhx",style:{width:"100%",height:a,padding:12,background:t.surface,borderRadius:t.rMd,...u},children:e.jsx(Y.ResponsiveContainer,{width:"100%",height:"100%",children:l})})}const st=["January","February","March","April","May","June","July","August","September","October","November","December"],lt=["Su","Mo","Tu","We","Th","Fr","Sa"];function it({value:r,range:o=!1,timepicker:d=!1,onChange:i,style:g}){const a=new Date,u=r?new Date(Array.isArray(r)?r[0]:r):a,[p,y]=f.useState(u),[w,n]=f.useState(r??(o?[null,null]:null)),[s,c]=f.useState(null),[v,S]=f.useState({h:0,m:0});f.useEffect(V,[]);const l=p.getFullYear(),x=p.getMonth(),m=new Date(l,x,1).getDay(),z=new Date(l,x+1,0).getDate(),T=[];for(let h=0;h<m;h++)T.push(null);for(let h=1;h<=z;h++)T.push(new Date(l,x,h));const k=h=>h.toDateString()===a.toDateString(),C=h=>{if(!w)return!1;if(o&&Array.isArray(w)){const[L,N]=w;if(!L)return!1;const D=h.getTime();return N?D>=L.getTime()&&D<=N.getTime():h.toDateString()===L.toDateString()}return h.toDateString()===w.toDateString()},W=h=>{if(o){const[L,N]=Array.isArray(w)?w:[null,null];if(!L||N)n([h,null]);else{const D=h<L?[h,L]:[L,h];n(D),i==null||i(D)}}else n(h),i==null||i(h)};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...g},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>y(h=>new Date(h.getFullYear(),h.getMonth()-1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"‹"}),e.jsxs("div",{style:{fontWeight:700,fontSize:14},children:[st[x]," ",l]}),e.jsx("button",{onClick:()=>y(h=>new Date(h.getFullYear(),h.getMonth()+1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"›"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 32px)",gap:2},children:[lt.map(h=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:h},h)),T.map((h,L)=>{const N=h?C(h):!1,D=h&&s&&h.toDateString()===s.toDateString();return e.jsx("div",{onClick:()=>h&&W(h),onMouseEnter:()=>h&&c(h),onMouseLeave:()=>c(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:h?"pointer":"default",fontSize:12,fontWeight:h&&k(h)?700:400,background:N?t.primary:D?t.bg:"transparent",color:N?"#fff":h&&k(h)?t.primary:h?t.text:"transparent",border:h&&k(h)&&!N?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:h==null?void 0:h.getDate()},L)})]}),d&&e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,marginTop:12,paddingTop:12,display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("input",{type:"number",min:0,max:23,value:v.h,onChange:h=>S(L=>({...L,h:+h.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}}),e.jsx("span",{style:{fontWeight:700,color:t.textSec},children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:v.m,onChange:h=>S(L=>({...L,m:+h.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function Le({value:r,onChange:o,timeFormat:d=12,controls:i=!1,minuteStep:g=5,style:a}){const[u,p]=f.useState((r==null?void 0:r.h)??(d===24?0:12)),[y,w]=f.useState((r==null?void 0:r.m)??0),[n,s]=f.useState((r==null?void 0:r.ampm)??"AM"),[c,v]=f.useState(null);f.useEffect(V,[]);const S=d===24?Array.from({length:24},(k,C)=>C):Array.from({length:12},(k,C)=>C+1),l=Array.from({length:Math.ceil(60/g)},(k,C)=>C*g),x=(k,C,W)=>{const h=d===24?{h:k,m:C}:{h:k,m:C,ampm:W};i?v(h):o==null||o(h)},m=()=>{v(null),p((r==null?void 0:r.h)??(d===24?0:12)),w((r==null?void 0:r.m)??0),s((r==null?void 0:r.ampm)??"AM")},z={display:"flex",flexDirection:"column",alignItems:"center",gap:4},T=k=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:k?700:400,background:k?t.primaryLt:"transparent",color:k?t.primary:t.text});return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...a},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"stretch"},children:[e.jsxs("div",{style:z,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Hours"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:S.map(k=>e.jsx("div",{onClick:()=>{p(k),x(k,y,n)},style:T(u===k),onMouseEnter:C=>u!==k&&(C.currentTarget.style.background=t.bg),onMouseLeave:C=>u!==k&&(C.currentTarget.style.background="transparent"),children:String(k).padStart(2,"0")},k))})]}),e.jsxs("div",{style:z,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Minutes"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:l.map(k=>e.jsx("div",{onClick:()=>{w(k),x(u,k,n)},style:T(y===k),onMouseEnter:C=>y!==k&&(C.currentTarget.style.background=t.bg),onMouseLeave:C=>y!==k&&(C.currentTarget.style.background="transparent"),children:String(k).padStart(2,"0")},k))})]}),d===12&&e.jsxs("div",{style:z,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"AM/PM"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden"},children:["AM","PM"].map(k=>e.jsx("div",{onClick:()=>{s(k),x(u,y,k)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:n===k?700:400,background:n===k?t.primary:t.surface,color:n===k?"#fff":t.text},children:k},k))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(u).padStart(2,"0"),":",String(y).padStart(2,"0"),d===12?` ${n}`:""]}),i&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:12},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:m,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>{const k=c??(d===24?{h:u,m:y}:{h:u,m:y,ampm:n});o==null||o(k)},children:"Apply"})]})]})}const at=({open:r})=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{flexShrink:0,transition:"transform .15s",transform:r?"rotate(180deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M2 4l4 4 4-4",stroke:t.textMut,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})});function ge({data:r=[],value:o,placeholder:d="Select or type...",multiselection:i=!1,label:g,onChange:a,style:u}){var W;const[p,y]=f.useState(!1),[w,n]=f.useState(""),[s,c]=f.useState(i?o?[].concat(o):[]:o||null),v=f.useRef(null),S=f.useRef(null);f.useEffect(V,[]),le(v,f.useCallback(()=>{y(!1),n("")},[]));const l=f.useMemo(()=>r.filter(h=>!w||h.value.toLowerCase().includes(w.toLowerCase())),[r,w]),x=h=>i?(s||[]).includes(h):s===h,m=h=>{const L=h.id||h.value;if(i){const N=x(L)?s.filter(D=>D!==L):[...s||[],L];c(N),a==null||a(N)}else c(L),n(""),y(!1),a==null||a(L)},z=h=>{const L=s.filter(N=>N!==h);c(L),a==null||a(L)},T=()=>{y(!0),setTimeout(()=>{var h;return(h=S.current)==null?void 0:h.focus()},0)},k=((W=r.find(h=>(h.id||h.value)===s))==null?void 0:W.value)||"",C=i?s||[]:[];return e.jsxs("div",{ref:v,className:"dhx",style:{position:"relative",...u},children:[g&&e.jsx("label",{className:"dhx dhx-label",children:g}),e.jsxs("div",{onClick:T,style:{display:"flex",alignItems:"center",flexWrap:i?"wrap":"nowrap",border:`1px solid ${p?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:p?`0 0 0 3px ${t.primary}22`:"none"},children:[i&&e.jsxs(e.Fragment,{children:[C.map(h=>{var L;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:t.primary,color:"#fff",borderRadius:12,padding:"2px 10px 2px 8px",fontSize:12,lineHeight:1.5,whiteSpace:"nowrap"},children:[((L=r.find(N=>(N.id||N.value)===h))==null?void 0:L.value)||h,e.jsx("span",{onClick:N=>{N.stopPropagation(),z(h)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},h)}),e.jsx("input",{ref:S,value:w,onChange:h=>{n(h.target.value),y(!0)},onFocus:()=>y(!0),onClick:h=>h.stopPropagation(),placeholder:C.length?"":d,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!i&&e.jsx("input",{ref:S,value:p?w:k,onChange:h=>{n(h.target.value),y(!0)},onFocus:()=>{y(!0),n("")},onClick:h=>h.stopPropagation(),placeholder:d,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(at,{open:p})]}),p&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:100},children:e.jsxs("div",{className:"dhx-scroll",style:{maxHeight:220,overflowY:"auto"},children:[l.map(h=>{const L=h.id||h.value,N=x(L);return e.jsxs("div",{onClick:()=>m(h),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:N?t.primaryLt:"transparent",color:N?t.primary:t.text},onMouseEnter:D=>!N&&(D.currentTarget.style.background=t.bg),onMouseLeave:D=>!N&&(D.currentTarget.style.background="transparent"),children:[i&&e.jsx("span",{style:{width:14,height:14,flexShrink:0,border:`2px solid ${N?t.primary:t.borderDk}`,borderRadius:3,display:"flex",alignItems:"center",justifyContent:"center",background:N?t.primary:"transparent"},children:N&&e.jsx("span",{style:{color:"#fff",fontSize:9,lineHeight:1},children:"✓"})}),e.jsx("span",{style:{flex:1},children:h.value}),!i&&N&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),h.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",h.count,")"]})]},L)}),l.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function xe({min:r=0,max:o=100,step:d=1,value:i,range:g=!1,label:a,tick:u,disabled:p=!1,onChange:y,style:w}){const[n,s]=f.useState(i??(g?[r,o]:r));f.useEffect(V,[]);const c=(m,z)=>{if(!p)if(g){const T=[...n];T[m]=z,s(T),y==null||y(T)}else s(z),y==null||y(z)},v=m=>(m-r)/(o-r)*100,S=g?n:[n],l=g?{left:`${v(S[0])}%`,width:`${v(S[1])-v(S[0])}%`}:{left:0,width:`${v(S[0])}%`},x=p?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:p?.5:1,...w},children:[a&&e.jsx("label",{className:"dhx dhx-label",children:a}),e.jsx("div",{style:{position:"relative",height:36,display:"flex",alignItems:"center"},children:e.jsxs("div",{style:{position:"relative",flex:1,height:4,background:t.border,borderRadius:2},children:[e.jsx("div",{style:{position:"absolute",...l,height:"100%",background:x,borderRadius:2}}),S.map((m,z)=>e.jsx("input",{type:"range",min:r,max:o,step:d,value:m,disabled:p,onChange:T=>{const k=+T.target.value;g&&z===0&&k>=n[1]||g&&z===1&&k<=n[0]||c(z,k)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:p?"not-allowed":"pointer",top:0,left:0,margin:0}},z)),S.map((m,z)=>e.jsx("div",{style:{position:"absolute",left:`${v(m)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${x}`,boxShadow:"0 1px 4px rgba(0,0,0,.2)",pointerEvents:"none"},children:e.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:p?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:m})},z))]})}),u&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((o+r)/2),o].map(m=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:m},m))})]})}const dt=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#607d8b","#9e9e9e","#000000","#ffffff","#0288d1","#01579b","#43a047","#e53935","#f57c00"];function ye(r){const o=parseInt(r.slice(1,3),16)/255,d=parseInt(r.slice(3,5),16)/255,i=parseInt(r.slice(5,7),16)/255,g=Math.max(o,d,i),a=Math.min(o,d,i);let u=0,p=0;const y=(g+a)/2;if(g!==a){const w=g-a;p=y>.5?w/(2-g-a):w/(g+a),u=g===o?((d-i)/w+(d<i?6:0))/6:g===d?((i-o)/w+2)/6:((o-d)/w+4)/6}return[Math.round(u*360),Math.round(p*100),Math.round(y*100)]}function Te(r,o,d){o/=100,d/=100;const i=o*Math.min(d,1-d),g=a=>{const u=(a+r/30)%12,p=d-i*Math.max(Math.min(u-3,9-u,1),-1);return Math.round(255*p).toString(16).padStart(2,"0")};return"#"+g(0)+g(8)+g(4)}function ct({value:r="#0288d1",onChange:o,style:d}){const[i,g]=f.useState(()=>ye(r)),a=Te(...i);f.useEffect(V,[]);const u=p=>{g(p),o==null||o(Te(...p))};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...d},children:[e.jsx("div",{style:{width:200,height:120,borderRadius:t.r,marginBottom:12,background:`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, hsl(${i[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,i[0]],["Saturation",0,100,i[1]],["Lightness",0,100,i[2]]].map(([p,y,w,n],s)=>e.jsxs("div",{style:{marginBottom:s<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[p,s>0?` (${n}%)`:""]}),e.jsx("input",{type:"range",min:y,max:w,value:n,onChange:c=>{const v=[...i];v[s]=+c.target.value,u(v)},style:{width:"100%",accentColor:t.primary}})]},p)),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:t.r,background:a,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:a,onChange:p=>{try{u(ye(p.target.value)),o==null||o(p.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:dt.map(p=>e.jsx("div",{onClick:()=>{g(ye(p)),o==null||o(p)},style:{width:14,height:14,borderRadius:2,background:p,cursor:"pointer",border:a===p?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:y=>y.currentTarget.style.transform="scale(1.3)",onMouseLeave:y=>y.currentTarget.style.transform="scale(1)"},p))})]})}function pt({trigger:r,children:o,placement:d="bottom-start",style:i}){const[g,a]=f.useState(!1),[u,p]=f.useState({top:"100%",left:0}),y=f.useRef(null),w=f.useRef(null);f.useEffect(V,[]),le(y,f.useCallback(()=>a(!1),[]));const n=()=>{a(s=>{if(!s&&w.current){const c=w.current.getBoundingClientRect(),v={"bottom-start":{top:c.height+4,left:0},"bottom-end":{top:c.height+4,right:0,left:"auto"},"top-start":{bottom:c.height+4,top:"auto",left:0}};p(v[d]||v["bottom-start"])}return!s})};return e.jsxs("div",{ref:y,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:w,onClick:n,children:r}),g&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...u,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...i},children:o})]})}function ht({title:r,children:o,width:d=480,height:i,closable:g=!0,movable:a=!0,modal:u=!1,defaultOpen:p=!0,footer:y,onClose:w,style:n}){const[s,c]=f.useState(p),[v,S]=f.useState({x:0,y:0});f.useEffect(V,[]);const l=$e(f.useCallback((m,z)=>a&&S({x:m,y:z}),[a])),x=()=>{c(!1),w==null||w()};return s?e.jsxs(e.Fragment,{children:[u&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:g?x:void 0}),e.jsxs("div",{className:"dhx",style:{position:u?"fixed":"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${v.x}px), calc(-50% + ${v.y}px))`,width:d,...i?{height:i}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...n},children:[e.jsxs("div",{onMouseDown:m=>l(m,v.x,v.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:a?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:r}),g&&e.jsx("button",{onClick:x,style:{background:"none",border:"none",cursor:"pointer",width:28,height:28,borderRadius:t.r,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18,color:t.textSec},onMouseEnter:m=>m.currentTarget.style.background=t.border,onMouseLeave:m=>m.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:o}),y&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:y})]})]}):null}const be=f.createContext(null),ut={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},Ie={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function ft({children:r}){const[o,d]=f.useState([]);f.useEffect(V,[]);const i=f.useCallback(u=>d(p=>p.filter(y=>y.id!==u)),[]),g=f.useCallback(u=>{const p=Date.now();return d(y=>[...y,{id:p,...u}]),u.duration!==0&&setTimeout(()=>i(p),u.duration||4e3),p},[i]),a={message:g,alert:(u,p)=>g({type:"info",title:u,...p}),confirm:(u,p,y)=>g({type:"warning",title:u,confirm:p,...y})};return e.jsxs(be.Provider,{value:a,children:[r,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:o.map(u=>{const p=u.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${Ie[p]}`,borderRadius:t.r,boxShadow:t.shadowLg,padding:"12px 16px",minWidth:280,maxWidth:380,pointerEvents:"all",display:"flex",gap:10,alignItems:"flex-start",animation:"dhx-toast .3s ease"},children:[e.jsx("span",{style:{fontSize:18,color:Ie[p],lineHeight:1},children:ut[p]}),e.jsxs("div",{style:{flex:1},children:[u.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:u.text?3:0},children:u.title}),u.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:u.text}),u.confirm&&e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",style:{height:26,fontSize:12},onClick:()=>{u.confirm(!0),i(u.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{u.confirm(!1),i(u.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>i(u.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},u.id)})})]})}function gt(){const r=f.useContext(be);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function xt({data:r=[],template:o,keyNavigation:d=!0,multiselection:i=!1,editable:g=!1,height:a=400,onSelect:u,onEdit:p,style:y}){const[w,n]=f.useState(new Set),[s,c]=f.useState(null),[v,S]=f.useState(""),[l,x]=f.useState(null);f.useEffect(V,[]);const m=(T,k)=>{const C=T.id??k;n(W=>{const h=i?new Set(W):new Set;return h.has(C)?h.delete(C):h.add(C),h}),x(k),u==null||u(T)},z=(T,k)=>{p==null||p({...T,value:v},k),c(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:a,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...y},tabIndex:0,onKeyDown:T=>{d&&(T.key==="ArrowDown"&&x(k=>Math.min((k??-1)+1,r.length-1)),T.key==="ArrowUp"&&x(k=>Math.max((k??1)-1,0)))},children:[r.map((T,k)=>{const C=T.id??k,W=w.has(C),h=l===k;return e.jsx("div",{onClick:()=>m(T,k),onDoubleClick:()=>g&&(c(k),S(String(T.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:W?t.primaryLt:h?t.bg:t.surface,color:W?t.primary:t.text,outline:h?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:s===k?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:v,onChange:L=>S(L.target.value),onBlur:()=>z(T,k),onKeyDown:L=>{L.key==="Enter"&&z(T,k),L.key==="Escape"&&c(null)},onClick:L=>L.stopPropagation()}):o?e.jsx("div",{dangerouslySetInnerHTML:{__html:o(T)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(T.value??"")})},String(C))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function yt({data:r=[],template:o,itemsInRow:d=3,gap:i=12,multiselection:g=!1,onSelect:a,style:u}){const[p,y]=f.useState(new Set);f.useEffect(V,[]);const w=n=>{const s=n.id??String(n.title);y(c=>{const v=g?new Set(c):new Set;return v.has(s)?v.delete(s):v.add(s),v}),a==null||a(n)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${d}, 1fr)`,gap:i,padding:i,...u},children:r.map((n,s)=>{const c=n.id??s,v=p.has(c);return e.jsx("div",{onClick:()=>w(n),style:{background:t.surface,border:`2px solid ${v?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:v?`0 0 0 3px ${t.primary}33`:t.shadow,transform:v?"translateY(-2px)":"none"},onMouseEnter:S=>{S.currentTarget.style.boxShadow=t.shadowLg,S.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:S=>{S.currentTarget.style.boxShadow=v?`0 0 0 3px ${t.primary}33`:t.shadow,S.currentTarget.style.transform=v?"translateY(-2px)":"none"},children:o?e.jsx("div",{dangerouslySetInnerHTML:{__html:o(n)}}):e.jsxs("div",{style:{padding:16},children:[n.img&&e.jsx("img",{src:n.img,alt:n.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:n.title||n.value}),n.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:n.subtitle})]})},String(c))})})}function ve(r){return r.map(o=>({...o,items:o.items?ve(o.items):void 0}))}function Se(r,o={}){return r.forEach(d=>{d.opened&&(o[d.id]=!0),d.items&&Se(d.items,o)}),o}function Ne(r,o){let d=null;return[r.filter(g=>g.id===o?(d=g,!1):!0).map(g=>{if(g.items){const[a,u]=Ne(g.items,o);return u&&(d=u),{...g,items:a}}return g}),d]}function ke(r,o,d,i){if(i==="inside")return r.map(a=>a.id===o?{...a,items:[...a.items||[],d]}:a.items?{...a,items:ke(a.items,o,d,i)}:a);if(r.some(a=>a.id===o)){const a=[];for(const u of r)u.id===o?i==="before"?(a.push(d),a.push(u)):(a.push(u),a.push(d)):a.push(u);return a}return r.map(a=>a.items?{...a,items:ke(a.items,o,d,i)}:a)}function bt(r,o,d){function i(g){var a,u;if(g.id===o){const p=y=>{var w;return y.id===d||(((w=y.items)==null?void 0:w.some(p))??!1)};return((a=g.items)==null?void 0:a.some(p))??!1}return((u=g.items)==null?void 0:u.some(i))??!1}return r.some(i)}function We(r,o,d){return r.map(i=>i.id===o?{...i,value:d}:{...i,items:i.items?We(i.items,o,d):void 0})}function vt(r,o){var a;let d=0,i=0;const g=u=>{var p;d++,o[u.id]&&i++,(p=u.items)==null||p.forEach(g)};return(a=r.items)==null||a.forEach(g),{total:d,checkedCount:i}}function St({data:r=[],checkbox:o=!1,editable:d=!1,dragMode:i,tooltip:g,onSelect:a,onCheck:u,onChange:p,style:y}){const[w,n]=f.useState(()=>ve(r)),[s,c]=f.useState(()=>Se(r)),[v,S]=f.useState(null),[l,x]=f.useState({}),[m,z]=f.useState(null),[T,k]=f.useState(""),[C,W]=f.useState(null),[h,L]=f.useState(null);f.useEffect(V,[]),f.useEffect(()=>{n(ve(r)),c(M=>({...Se(r),...M}))},[r]);const N=M=>c(H=>({...H,[M]:!H[M]})),D=(M,H)=>{x(j=>({...j,[M]:H})),u==null||u(M,H)},q=()=>{if(!m)return;const M=m,H=T;z(null),n(j=>{const K=We(j,M,H);return p==null||p(K),K})},J=(M,H)=>{M.dataTransfer.effectAllowed="move",W(H)},oe=(M,H)=>{if(!C||C===H||bt(w,C,H))return;M.preventDefault();const j=M.currentTarget.getBoundingClientRect(),K=M.clientY-j.top,_=j.height,re=K<_*.25?"before":K>_*.75?"after":"inside";L(X=>(X==null?void 0:X.id)===H&&(X==null?void 0:X.pos)===re?X:{id:H,pos:re})},Z=(M,H)=>{if(M.preventDefault(),!C||!h||C===H){L(null),W(null);return}n(j=>{const[K,_]=Ne(j,C);if(!_)return j;const re=ke(K,H,_,h.pos);return p==null||p(re),re}),h.pos==="inside"&&c(j=>({...j,[H]:!0})),L(null),W(null)},ne=()=>{W(null),L(null)},I=(M,H=0)=>{var ce;const j=(((ce=M.items)==null?void 0:ce.length)??0)>0,K=s[M.id],_=v===M.id,re=C===M.id,X=(h==null?void 0:h.id)===M.id;let G=!!l[M.id],te=!1;if(o&&j){const{total:F,checkedCount:ae}=vt(M,l);ae>0&&ae<F?te=!0:F>0&&ae===F&&(G=!0)}const R=X&&h.pos!=="inside"?{boxShadow:h.pos==="before"?`inset 0 2px 0 0 ${t.primary}`:`inset 0 -2px 0 0 ${t.primary}`}:{},ue=X&&h.pos==="inside"||_?t.primaryLt:"transparent";return e.jsxs("div",{style:{opacity:re?.4:1},children:[e.jsxs("div",{draggable:!!i,onDragStart:i?F=>J(F,M.id):void 0,onDragOver:i?F=>oe(F,M.id):void 0,onDrop:i?F=>Z(F,M.id):void 0,onDragEnd:i?ne:void 0,title:g==null?void 0:g(M),onClick:()=>{S(M.id),a==null||a(M),j&&N(M.id)},onDoubleClick:()=>{d&&(z(M.id),k(M.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+H*18}px`,cursor:i?"grab":"pointer",borderRadius:t.r,margin:"1px 4px",background:ue,color:_?t.primary:t.text,userSelect:"none",fontSize:13,...R},onMouseEnter:F=>!_&&!X&&(F.currentTarget.style.background=t.bg),onMouseLeave:F=>!_&&!X&&(F.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},onClick:F=>{F.stopPropagation(),j&&N(M.id)},children:j?K?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:j?K?"📂":"📁":"📄"}),o&&e.jsx("input",{ref:F=>{F&&(F.indeterminate=te)},type:"checkbox",checked:G,onChange:F=>{F.stopPropagation(),D(M.id,F.target.checked)},style:{cursor:"pointer",accentColor:t.primary,flexShrink:0},onClick:F=>F.stopPropagation()}),m===M.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:T,onChange:F=>k(F.target.value),onBlur:q,onKeyDown:F=>{F.key==="Enter"&&q(),F.key==="Escape"&&z(null)},onClick:F=>F.stopPropagation()}):e.jsx("span",{style:{flex:1},children:M.value}),M.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",M.count,")"]})]}),j&&K&&e.jsx("div",{children:M.items.map(F=>I(F,H+1))})]},M.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...y},onDragOver:i?M=>M.preventDefault():void 0,onDrop:i?M=>{M.preventDefault(),L(null),W(null)}:void 0,children:w.map(M=>I(M))})}function kt({total:r,pageSize:o=10,page:d,onChange:i,style:g}){const[a,u]=f.useState(d||1),p=Math.ceil(r/o);f.useEffect(V,[]);const y=n=>{const s=Math.min(Math.max(1,n),p);u(s),i==null||i(s)},w=f.useMemo(()=>{const n=[];for(let c=Math.max(1,a-2);c<=Math.min(p,a+2);c++)n.push(c);return n[0]>1&&(n[0]>2&&n.unshift("..."),n.unshift(1)),n[n.length-1]<p&&(n[n.length-1]<p-1&&n.push("..."),n.push(p)),n},[a,p]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...g},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(a-1)*o+1,"–",Math.min(a*o,r)," of ",r]}),[["«",1],["‹",a-1]].map(([n,s])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===1,onClick:()=>y(s),children:n},n)),w.map((n,s)=>e.jsx("button",{onClick:()=>typeof n=="number"&&y(n),className:`dhx dhx-btn ${n===a?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:n==="...",children:n},s)),[["›",a+1],["»",p]].map(([n,s])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===p,onClick:()=>y(s),children:n},n))]})}function wt({config:r={},defaultValues:o={},onSubmit:d,style:i}){const[g,a]=f.useState(o),[u,p]=f.useState({}),[y,w]=f.useState(null);f.useEffect(V,[]);const n=(l,x)=>{a(m=>({...m,[l]:x})),p(m=>({...m,[l]:null}))},s=l=>{const x=[];return l.flat().forEach(m=>{!m||typeof m!="object"||!("name"in m)||(x.push(m),m.type==="fieldset"&&m.rows&&x.push(...s(m.rows)))}),x},c=()=>{const l={};return s(r.rows||[]).forEach(x=>{x.required&&!g[x.name]&&(l[x.name]=`${x.label||x.name} is required`)}),p(l),Object.keys(l).length===0},v=l=>{const x=g[l.name]??l.value??"",m=u[l.name],z=l.labelWidth??r.labelWidth,T=z!==void 0||l.labelPosition==="left";if(l.type==="fieldset")return e.jsxs("fieldset",{style:{border:`1px solid ${t.border}`,borderRadius:t.r,padding:"12px 16px",marginBottom:14},children:[e.jsx("legend",{style:{fontSize:12,fontWeight:700,color:t.textSec,padding:"0 6px"},children:l.label}),(l.rows||[]).map(D=>v(D))]},l.name);if(l.type==="spacer")return e.jsx("div",{style:{height:l.height||16}},l.name);const k=z?{minWidth:z,width:z,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},C=l.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...k},children:[l.label,l.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,W=m?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:m}):null,h=l.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",l.helpMessage]}):null,L={key:l.name,className:"dhx-form-group"},N=D=>T?e.jsxs("div",{...L,style:{display:"flex",alignItems:"flex-start",gap:8},children:[C,e.jsxs("div",{style:{flex:1,minWidth:0},children:[D,W,h]})]}):e.jsxs("div",{...L,children:[C,D,W,h]});if(!l.type||l.type==="input")return N(e.jsxs("div",{className:"dhx-input-wrap",children:[l.icon&&e.jsx("span",{className:"dhx-input-icon",children:l.icon}),e.jsx("input",{className:`dhx dhx-input${l.icon?" dhx-input--with-icon":""}`,style:{borderColor:m?t.danger:void 0},type:l.inputType||"text",placeholder:l.placeholder,value:x,onChange:D=>n(l.name,D.target.value),disabled:l.disabled})]}));if(l.type==="textarea")return N(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:l.placeholder,value:x,onChange:D=>n(l.name,D.target.value)}));if(l.type==="select")return N(e.jsxs("select",{className:"dhx dhx-input",value:x,onChange:D=>n(l.name,D.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(l.options||[]).map(D=>e.jsx("option",{value:D.value,children:D.label||D.value},D.value))]}));if(l.type==="datepicker")return N(e.jsx("input",{type:"date",className:"dhx dhx-input",value:x,onChange:D=>n(l.name,D.target.value)}));if(l.type==="timepicker"){const D=g[l.name]??{h:12,m:0,ampm:"AM"},q=!!g[l.name],J=q?`${String(D.h).padStart(2,"0")}:${String(D.m).padStart(2,"0")}${D.ampm?" "+D.ampm:""}`:l.placeholder||"Click to select",oe=e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{className:"dhx dhx-input",style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},onClick:()=>w(y===l.name?null:l.name),children:[e.jsx("span",{style:{color:q?t.text:t.textMut},children:J}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),y===l.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx(Le,{value:D,controls:!0,onChange:Z=>{n(l.name,Z),w(null)}})})]});return N(oe)}if(l.type==="colorpicker")return N(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:x||"#000000",onChange:D=>n(l.name,D.target.value),style:{width:36,height:36,padding:2,border:`1px solid ${t.border}`,borderRadius:t.r,cursor:"pointer",background:"none"}}),e.jsx("span",{style:{fontSize:12,color:t.textSec,fontFamily:"monospace"},children:x||"#000000"})]}));if(l.type==="text")return N(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:l.value}));if(l.type==="checkbox")return e.jsxs("div",{...L,children:[T?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[z&&e.jsx("div",{style:{width:z,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!x,onChange:D=>n(l.name,D.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:l.label})]})]}):e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!x,onChange:D=>n(l.name,D.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:l.label})]}),h]});if(l.type==="radio"){const D=(l.options||[]).map(q=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:l.name,value:q.value,checked:x===q.value,onChange:()=>n(l.name,q.value),style:{accentColor:t.primary,cursor:"pointer"}}),q.label||q.value]},q.value));return N(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:D}))}if(l.type==="slider")return T?e.jsxs("div",{...L,style:{display:"flex",alignItems:"flex-start",gap:8},children:[C,e.jsxs("div",{style:{flex:1},children:[e.jsx(xe,{min:l.min,max:l.max,step:l.step,value:x||l.min,range:l.range,onChange:D=>n(l.name,D)}),h]})]}):e.jsxs("div",{...L,children:[e.jsx(xe,{label:l.label,min:l.min,max:l.max,step:l.step,value:x||l.min,range:l.range,onChange:D=>n(l.name,D)}),h]});if(l.type==="combo")return T?e.jsxs("div",{...L,style:{display:"flex",alignItems:"flex-start",gap:8},children:[C,e.jsxs("div",{style:{flex:1},children:[e.jsx(ge,{data:l.data||[],multiselection:l.multiselection,placeholder:l.placeholder||"Select...",value:x||(l.multiselection?[]:null),onChange:D=>n(l.name,D)}),W,h]})]}):e.jsxs("div",{...L,children:[e.jsx(ge,{label:l.label,data:l.data||[],multiselection:l.multiselection,placeholder:l.placeholder||"Select...",value:x||(l.multiselection?[]:null),onChange:D=>n(l.name,D)}),W,h]});if(l.type==="toggle"){const D=!!x,q=D?l.icon:l.offIcon||l.icon,J=D?l.text||l.label:l.offText||l.text||l.label;return e.jsxs("div",{...L,children:[T&&z&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:z,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(Ae,{on:D,onClick:()=>n(l.name,!x)}),q&&e.jsx("span",{style:{fontSize:16},children:q}),J&&e.jsx("span",{style:{fontSize:13},children:J})]})]}),!T&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(Ae,{on:D,onClick:()=>n(l.name,!x)}),q&&e.jsx("span",{style:{fontSize:16},children:q}),J&&e.jsx("span",{style:{fontSize:13},children:J})]}),h]})}return null},S=l=>l.map((x,m)=>Array.isArray(x)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:x.map(v)},m):v(x));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...i},children:[S(r.rows||[]),(r.buttons||d)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:r.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>c()&&(d==null?void 0:d(g)),children:r.submitText||"Submit"}),r.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{a(o),p({})},children:r.resetText||"Reset"})]})]})}function Ae({on:r,onClick:o}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:o,children:[e.jsx("div",{style:{width:40,height:22,borderRadius:11,background:r?t.primary:t.border,transition:"background 0.2s"}}),e.jsx("div",{style:{position:"absolute",top:3,left:r?21:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,.3)"}})]})}function we(r){const o=[];for(const d of r)d.type==="block"?o.push(...we(d.items||[])):o.push(d);return o}function mt({items:r=[],onAction:o,style:d}){f.useEffect(V,[]);const[i,g]=f.useState(()=>{const s={};for(const c of we(r))c.id&&(s[c.id]=!!c.active);return s}),a=we(r),u=s=>{var c;if(!s.disabled){if(s.id)if(s.group){const v=a.filter(S=>S.group===s.group&&S.id);g(S=>{const l={...S};for(const x of v)l[x.id]=!1;return l[s.id]=!0,l})}else s.twoState&&g(v=>({...v,[s.id]:!v[s.id]}));(c=s.onClick)==null||c.call(s,s),s.id&&(o==null||o(s.id,s))}},p=(s,c)=>{var x;if(s.hidden)return null;const v=s.value??s.text,S=s.size==="auto",l=s.id!==void 0?i[s.id]??!!s.active:!!s.active;return s.type==="separator"||s.type==="sep"?e.jsx("div",{style:{width:1,background:t.border,margin:"4px 2px",alignSelf:"stretch"}},c):s.type==="input"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",padding:"2px 4px",gap:2},children:[s.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:s.label}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[s.icon&&e.jsx("span",{style:{position:"absolute",left:6,fontSize:13,color:t.textMut,pointerEvents:"none",zIndex:1},children:s.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:s.width||110,height:26,fontSize:12,paddingLeft:s.icon?24:void 0},placeholder:s.placeholder,defaultValue:s.value,onChange:m=>{var z;return(z=s.onChange)==null?void 0:z.call(s,m.target.value)}})]})]},c):s.type==="selectButton"?e.jsx("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,cursor:"pointer",margin:2,width:s.width},defaultValue:s.value,onChange:m=>{var z;return(z=s.onChange)==null?void 0:z.call(s,m.target.value)},children:(x=s.items)==null?void 0:x.map(m=>e.jsx("option",{value:m.value,children:m.value},m.value))},c):e.jsxs("button",{title:s.tooltip,disabled:s.disabled,className:"dhx dhx-btn dhx-btn-ghost",style:{flexDirection:S?"column":"row",alignSelf:S?"stretch":"center",justifyContent:"center",minHeight:S?48:26,padding:S?"6px 10px":"0 8px",gap:S?4:5,position:"relative",background:l?t.primaryLt:"transparent",color:l?t.primary:s.disabled?t.textMut:t.text,opacity:s.disabled?.55:1,cursor:s.disabled?"not-allowed":"pointer"},onClick:()=>u(s),children:[s.icon&&e.jsx("span",{style:{fontSize:S?22:15,lineHeight:1,flexShrink:0},children:s.icon}),v&&e.jsx("span",{style:{fontSize:10,maxWidth:S?64:void 0,textAlign:S?"center":"left",lineHeight:1.2,whiteSpace:S?"normal":"nowrap"},children:v}),s.count!==void 0&&e.jsx("span",{style:{position:"absolute",top:2,right:2,minWidth:14,height:14,background:t.danger,color:"#fff",borderRadius:7,fontSize:9,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 2px",pointerEvents:"none"},children:s.count})]},c)},y=(s,c)=>{var v;return e.jsx("div",{style:{display:"flex",flexDirection:s.direction==="col"?"column":"row",alignItems:s.direction==="col"?"flex-start":"center",gap:2},children:(v=s.items)==null?void 0:v.map((S,l)=>S.type==="block"?y(S,`${c}-${l}`):p(S,`${c}-${l}`))},c)},w=(s,c)=>{var S;const v=s.title||s.label;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",borderRight:`1px solid ${t.border}`,padding:"4px 6px 0",minWidth:40},children:[e.jsx("div",{style:{display:"flex",flexDirection:s.direction==="col"?"column":"row",alignItems:s.direction==="col"?"stretch":"center",gap:2,flex:1},children:(S=s.items)==null?void 0:S.map((l,x)=>l.type==="block"?y(l,x):p(l,x))}),v&&e.jsx("div",{style:{fontSize:10,color:t.textMut,textAlign:"center",padding:"3px 0 4px",marginTop:2,borderTop:`1px solid ${t.border}`},children:v})]},c)},n=(s,c)=>s.type==="block"?w(s,c):p(s,c);return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.surface,borderBottom:`1px solid ${t.border}`,overflowX:"auto",gap:0,minHeight:72,...d},children:r.map(n)})}function Be({count:r}){return e.jsx("span",{style:{position:"absolute",top:3,right:3,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function zt({logo:r,items:o=[],vertical:d=!1,onAction:i,style:g}){const[a,u]=f.useState(null),[p,y]=f.useState(()=>{const c={};return o.forEach(v=>{v.id&&v.twoState&&v.active&&(c[v.id]=!0)}),c}),w=f.useRef(null);f.useEffect(V,[]),le(w,f.useCallback(()=>u(null),[]));const n=(c,v)=>{var S,l;if(!c.disabled){if(c.twoState&&c.id&&y(x=>({...x,[c.id]:!x[c.id]})),(S=c.items)!=null&&S.length){u(x=>x===v?null:v);return}(l=c.onClick)==null||l.call(c,c.id||""),i==null||i(c.id||"")}},s=(c,v)=>{var m;if(c.hidden)return null;if(c.type==="separator")return e.jsx("div",{style:{[d?"height":"width"]:1,background:t.border,margin:d?"4px 8px":"0 6px",alignSelf:"stretch"}},v);if(c.type==="spacer")return e.jsx("div",{style:{flex:1}},v);if(c.type==="input")return e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",margin:"0 4px"},children:[c.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:c.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:c.width||200,height:28,paddingLeft:c.icon?30:void 0},placeholder:c.placeholder,onChange:z=>{var T;return(T=c.onChange)==null?void 0:T.call(c,z.target.value)}})]},v);if(c.type==="imageButton")return e.jsxs("button",{title:c.tooltip,disabled:c.disabled,style:{position:"relative",width:36,height:36,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:c.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>n(c,v),children:[c.src&&e.jsx("img",{src:c.src,alt:c.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),c.count!==void 0&&e.jsx(Be,{count:c.count})]},v);const S=!!(c.twoState&&c.id&&p[c.id]),l=!!((m=c.items)!=null&&m.length),x={position:"relative",height:d?40:36,gap:6,background:S?t.primaryLt:"transparent",color:S?t.primary:c.disabled?t.textMut:t.text,opacity:c.disabled?.55:1,cursor:c.disabled?"not-allowed":"pointer",...d?{width:"100%",justifyContent:"flex-start",padding:"0 16px",borderRadius:0}:{}};return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:c.tooltip,disabled:c.disabled,style:x,onClick:()=>n(c,v),children:[c.icon&&e.jsx("span",{style:{fontSize:16,flexShrink:0},children:c.icon}),c.value&&e.jsx("span",{style:{fontSize:13},children:c.value}),l&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),c.count!==void 0&&e.jsx(Be,{count:c.count})]}),l&&a===v&&e.jsx(de,{items:c.items,onSelect:z=>{var T;u(null),z.id&&((T=c.onClick)==null||T.call(c,z.id),i==null||i(z.id))},style:d?{left:"100%",top:0}:{top:"100%"}})]},v)};return e.jsxs("nav",{ref:w,className:"dhx",style:{display:"flex",flexDirection:d?"column":"row",alignItems:d?"stretch":"center",background:t.surface,borderBottom:d?"none":`1px solid ${t.border}`,borderRight:d?`1px solid ${t.border}`:"none",padding:d?"8px 0":"0 12px",minHeight:d?void 0:48,gap:2,...g},children:[r&&e.jsx("div",{style:{color:t.text,fontWeight:800,fontSize:16,padding:d?"8px 16px 12px":"0 12px 0 4px",borderBottom:d?`1px solid ${t.border}`:"none",borderRight:d?"none":`1px solid ${t.border}`,marginRight:d?0:8,marginBottom:d?4:0,flexShrink:0},children:r}),o.map(s)]})}P.Button=_e,P.Calendar=it,P.Chart=ot,P.Colorpicker=ct,P.Combobox=ge,P.ContextMenu=Xe,P.DataView=yt,P.Form=wt,P.Grid=rt,P.Layout=Ee,P.List=xt,P.Menu=Ve,P.MenuDropdown=de,P.MessageContext=be,P.MessageProvider=ft,P.Navbar=zt,P.Pagination=kt,P.Popup=pt,P.Ribbon=mt,P.Sidebar=Ge,P.Slider=xe,P.Tabbar=Ue,P.Timepicker=Le,P.Toolbar=qe,P.Tree=St,P.Window=ht,P.tokens=t,P.useClickOutside=le,P.useDrag=$e,P.useMessage=gt,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
|
|
41
|
+
`,document.head.appendChild(r)}const _e={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function Ve({children:r,variant:s="primary",size:d="md",icon:l,disabled:p,onClick:i,style:u,className:h=""}){return g.useEffect(Z,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${s} ${h}`,style:{..._e[d],...u},disabled:p,onClick:i,children:[l&&e.jsx("span",{style:{fontSize:16},children:l}),r]})}function de(r,s){g.useEffect(()=>{const d=l=>{r.current&&!r.current.contains(l.target)&&s(l)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r,s])}function Le(r){const s=g.useRef(!1),d=g.useRef({x:0,y:0,ox:0,oy:0});return g.useCallback((l,p=0,i=0)=>{s.current=!0,d.current={x:l.clientX,y:l.clientY,ox:p,oy:i};const u=x=>{if(!s.current)return;const{x:z,y:n,ox:b,oy:f}=d.current;r(b+x.clientX-z,f+x.clientY-n)},h=()=>{s.current=!1,document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",h)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",h),l.preventDefault()},[r])}function ce({items:r,onSelect:s,style:d}){const[l,p]=g.useState(null);return e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:200,padding:"4px 0",...d},children:r.map((i,u)=>{var x,z;if(i.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},u);const h=l===u;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>p(u),onMouseLeave:()=>p(null),children:[e.jsxs("div",{onClick:()=>{var n;return!i.disabled&&!((n=i.items)!=null&&n.length)&&s(i)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:i.disabled?"not-allowed":"pointer",fontSize:13,color:i.disabled?t.textMut:t.text,background:h&&!i.disabled?t.bg:"transparent",opacity:i.disabled?.5:1},children:[i.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:i.icon}),e.jsx("span",{style:{flex:1},children:i.value||i.id}),i.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:i.hotkey}),(x=i.items)!=null&&x.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),h&&((z=i.items)!=null&&z.length)?e.jsx(ce,{items:i.items,onSelect:s,style:{position:"absolute",left:"100%",top:-4}}):null]},i.id||u)})})}function Xe({items:r=[],label:s="Menu",onSelect:d,style:l}){const[p,i]=g.useState(!1),u=g.useRef(null);return g.useEffect(Z,[]),de(u,g.useCallback(()=>i(!1),[])),e.jsxs("div",{ref:u,className:"dhx",style:{position:"relative",display:"inline-block",...l},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>i(h=>!h),children:[s," ",e.jsx("span",{style:{fontSize:10},children:p?"▲":"▼"})]}),p&&e.jsx(ce,{items:r,onSelect:h=>{d==null||d(h),i(!1)}})]})}function qe({items:r=[],onSelect:s,children:d}){const[l,p]=g.useState(null),i=g.useRef(null);g.useEffect(Z,[]),de(i,g.useCallback(()=>p(null),[]));const u=h=>{h.preventDefault(),p({x:h.clientX,y:h.clientY})};return e.jsxs("div",{ref:i,onContextMenu:u,style:{position:"relative",display:"contents"},children:[d,l&&e.jsx("div",{style:{position:"fixed",left:l.x,top:l.y,zIndex:9999},children:e.jsx(ce,{items:r,onSelect:h=>{s==null||s(h),p(null)}})})]})}function Te({count:r}){return e.jsx("span",{style:{position:"absolute",top:2,right:2,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function Ge({items:r=[],onAction:s,style:d}){const[l,p]=g.useState(null),[i,u]=g.useState(()=>{const n={};return r.forEach(b=>{b.id&&(b.twoState||b.group)&&b.active&&(n[b.id]=!0)}),n}),h=g.useRef(null);g.useEffect(Z,[]),de(h,g.useCallback(()=>p(null),[]));const x=(n,b)=>{var f,M;if(!n.disabled){if(n.twoState&&n.id&&u(I=>({...I,[n.id]:!I[n.id]})),n.group&&n.id&&u(I=>{const a={...I};return r.forEach(w=>{w.group===n.group&&w.id&&(a[w.id]=!1)}),a[n.id]=!0,a}),(f=n.items)!=null&&f.length){p(I=>I===b?null:b);return}(M=n.onClick)==null||M.call(n,n.id||""),s==null||s(n.id||"")}},z=(n,b)=>{var a,w;if(n.hidden)return null;if(n.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},b);if(n.type==="spacer")return e.jsx("div",{style:{flex:1}},b);if(n.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:n.label}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[n.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:n.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:n.width||140,height:28,paddingLeft:n.icon?30:void 0},placeholder:n.placeholder,defaultValue:n.value,onChange:$=>{var L;return(L=n.onChange)==null?void 0:L.call(n,$.target.value)}})]})]},b);if(n.type==="select")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[n.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:n.label}),e.jsx("select",{className:"dhx dhx-input",style:{width:n.width||100,height:28,cursor:"pointer"},defaultValue:n.value,onChange:$=>{var L;return(L=n.onChange)==null?void 0:L.call(n,$.target.value)},children:(a=n.options)==null?void 0:a.map($=>e.jsx("option",{value:$.value,children:$.label},$.value))})]},b);if(n.type==="imageButton")return e.jsxs("button",{title:n.tooltip,disabled:n.disabled,style:{position:"relative",width:32,height:32,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:n.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>x(n,b),children:[n.src&&e.jsx("img",{src:n.src,alt:n.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),n.count!==void 0&&e.jsx(Te,{count:n.count})]},b);const f=!!(n.id&&i[n.id]),M=n.value??n.text,I=!!((w=n.items)!=null&&w.length);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:n.tooltip,disabled:n.disabled,style:{height:32,gap:4,position:"relative",background:f?t.primaryLt:"transparent",color:f?t.primary:n.disabled?t.textMut:t.text,opacity:n.disabled?.55:1,cursor:n.disabled?"not-allowed":"pointer"},onClick:()=>x(n,b),children:[n.icon&&e.jsx("span",{style:{fontSize:16},children:n.icon}),M&&e.jsx("span",{style:{fontSize:13},children:M}),I&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),n.count!==void 0&&e.jsx(Te,{count:n.count})]}),I&&l===b&&e.jsx(ce,{items:n.items,onSelect:()=>p(null),style:{top:"100%",left:0}})]},b)};return e.jsx("div",{ref:h,className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...d},children:r.map(z)})}function Je(r){return r==="primary"?t.primary:r==="success"?"#43a047":r==="secondary"?"#9e9e9e":"#e53935"}function Ue(r,s){const d=[],l=p=>{var i;p.id&&p.group===s&&d.push(p.id),(i=p.items)==null||i.forEach(l)};return r.forEach(l),d}function Qe(r){const s={},d=l=>{var p;l.id&&l.twoState&&l.active&&(s[l.id]=!0),(p=l.items)==null||p.forEach(d)};return r.forEach(d),s}function Ze({items:r=[],width:s=240,minWidth:d=64,header:l,footer:p,collapsed:i,defaultCollapsed:u,selected:h,defaultSelected:x,onSelect:z,onCollapse:n,onExpand:b,onBeforeCollapse:f,onBeforeExpand:M,onToggleItem:I,style:a}){const w=i!==void 0,$=h!==void 0,[L,A]=g.useState(u??!1),[C,D]=g.useState(x??null),[K,c]=g.useState({}),[N,H]=g.useState(()=>Qe(r));g.useEffect(Z,[]);const k=w?i:L,U=$?h??null:C,R=k?d:s,o=()=>{if(k){if((M==null?void 0:M())===!1)return;w||A(!1),b==null||b()}else{if((f==null?void 0:f())===!1)return;w||A(!0),n==null||n()}},W=v=>{$||D(v.id??null),z==null||z(v),v.id&&v.onClick&&v.onClick(v.id)},_=v=>{if(!v.id)return;const j=!N[v.id];let Y={...N,[v.id]:j};v.group&&j&&Ue(r,v.group).forEach(J=>{J!==v.id&&(Y[J]=!1)}),H(Y),I==null||I(v.id,j)},m=(v,j)=>{if(v.count===void 0)return null;const Y=Je(v.countColor),J=v.count>99?"99+":String(v.count);return j?e.jsx("span",{style:{position:"absolute",top:1,right:1,background:Y,color:"#fff",borderRadius:8,fontSize:9,fontWeight:700,padding:"0 3px",minWidth:14,textAlign:"center",lineHeight:"14px",pointerEvents:"none"},children:J}):e.jsx("span",{style:{background:Y,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700,flexShrink:0},children:J})},S=(v,j,Y)=>{var ae;if(v.hidden)return null;const J=v.id??`${v.type??"navItem"}-${j}-${Y}`,X=v.type??"navItem";if(X==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px",flexShrink:0}},J);if(X==="spacer")return e.jsx("div",{style:{flex:1}},J);if(X==="title")return k?null:e.jsx("div",{style:{padding:"10px 14px 4px",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:1,color:t.textMut,flexShrink:0},children:v.value},J);if(X==="customHTML")return e.jsx("div",{dangerouslySetInnerHTML:{__html:v.html??""},style:{padding:"8px 12px",flexShrink:0}},J);const G=(((ae=v.items)==null?void 0:ae.length)??0)>0,ee=!!K[v.id??""],te=v.twoState?!!N[v.id??""]:!1,re=!v.twoState&&U===v.id||te,P=!!v.disabled,ie=k?0:12+j*16,Me=()=>{P||(v.twoState?(_(v),W(v)):(G&&c(le=>({...le,[v.id??""]:!le[v.id??""]})),W(v)))};return e.jsxs("div",{style:{flexShrink:0},children:[e.jsxs("div",{title:v.tooltip,onClick:Me,style:{display:"flex",alignItems:"center",gap:k?0:8,justifyContent:k?"center":"flex-start",paddingTop:8,paddingBottom:8,paddingLeft:k?0:ie,paddingRight:k?0:10,borderRadius:t.r,margin:"1px 6px",cursor:P?"not-allowed":"pointer",userSelect:"none",transition:"background .15s",background:re?t.primaryLt:"transparent",color:P?t.textMut:re?t.primary:t.text,opacity:P?.55:1},onMouseEnter:le=>{!re&&!P&&(le.currentTarget.style.background=t.bg)},onMouseLeave:le=>{!re&&!P&&(le.currentTarget.style.background="transparent")},children:[e.jsxs("span",{style:{position:"relative",minWidth:22,textAlign:"center",fontSize:18,flexShrink:0,lineHeight:1},children:[v.icon??(v.value&&!v.icon,null),k&&m(v,!0)]}),!k&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:re?600:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.value}),!k&&m(v,!1),!k&&v.twoState&&e.jsx("span",{style:{width:14,height:14,borderRadius:2,border:`2px solid ${re?t.primary:t.borderDk}`,background:re?t.primary:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:re&&e.jsx("span",{style:{color:"#fff",fontSize:8,fontWeight:700,lineHeight:1},children:"✓"})}),!k&&G&&!v.twoState&&e.jsx("span",{style:{fontSize:11,color:t.textMut,flexShrink:0,transition:"transform .2s",transform:ee?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"})]}),G&&ee&&!k&&e.jsx("div",{children:v.items.map((le,ge)=>S(le,j+1,ge))})]},J)},T=e.jsxs("div",{onClick:o,style:{display:"flex",alignItems:"center",justifyContent:k?"center":"flex-start",gap:8,padding:k?"8px 0":"8px 14px",margin:"4px 6px",borderRadius:t.r,cursor:"pointer",color:t.textMut,fontSize:13,userSelect:"none",transition:"background .15s",flexShrink:0},onMouseEnter:v=>v.currentTarget.style.background=t.bg,onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[e.jsx("span",{style:{fontSize:16,fontWeight:700,lineHeight:1},children:k?"›":"‹"}),!k&&e.jsx("span",{children:"Collapse"})]});return e.jsxs("div",{className:"dhx",style:{width:R,minWidth:R,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease, min-width .2s ease",overflow:"hidden",...a},children:[l&&e.jsx("div",{style:{padding:k?"12px 0":"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15,display:"flex",alignItems:"center",justifyContent:k?"center":"flex-start",overflow:"hidden",flexShrink:0},children:l}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},children:r.map((v,j)=>S(v,0,j))}),T,p&&!k&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`,flexShrink:0},children:p})]})}function Re({config:r}){const[s,d]=g.useState(!1),l={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...r.width?{width:r.width,minWidth:r.width}:{flex:1},...r.height?{height:r.height,minHeight:r.height}:{minHeight:40},...s?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:l,children:[r.header&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:t.bg,borderBottom:`1px solid ${t.border}`,fontSize:12,fontWeight:600,color:t.textSec,userSelect:"none"},children:[e.jsx("span",{children:r.header}),r.collapsable&&e.jsx("button",{onClick:()=>d(p=>!p),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:s?"▼":"▲"})]}),!s&&e.jsxs("div",{style:{padding:r.padding||0,height:r.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[r.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:r.html}}):r.content,(r.rows||r.cols)&&e.jsx(Ee,{rows:r.rows,cols:r.cols,style:{height:"100%"}})]})]})}function Ee({rows:r,cols:s,type:d="line",style:l,children:p}){g.useEffect(Z,[]);const i=d==="space"?12:d==="wide"?8:1,u=r||s,h=!!r;return u?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:h?"column":"row",gap:i,width:"100%",height:"100%",...l},children:u.map((x,z)=>e.jsx(Re,{config:x},x.id||z))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...l},children:p})}function et({views:r=[],mode:s="top",tabAlign:d="left",closable:l=[],disabled:p=[],defaultActive:i,onBeforeChange:u,onChange:h,style:x}){var C;const[z,n]=g.useState(i||((C=r[0])==null?void 0:C.id)),[b,f]=g.useState(r.map(D=>D.id));g.useEffect(Z,[]);const M=(D,K)=>{D.stopPropagation(),f(c=>c.filter(N=>N!==K)),z===K&&n(b.find(c=>c!==K)??"")},I=D=>{p.includes(D)||u&&u(D)===!1||(n(D),h==null||h(D))},a=s==="left"||s==="right",w=r.filter(D=>b.includes(D.id)),$=e.jsx("div",{style:{display:"flex",flexDirection:a?"column":"row",justifyContent:d==="center"?"center":d==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!a&&s!=="bottom"?`2px solid ${t.border}`:"none",borderTop:s==="bottom"?`2px solid ${t.border}`:"none",borderRight:s==="left"?`2px solid ${t.border}`:"none",borderLeft:s==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:w.map(D=>{const K=z===D.id,c=p.includes(D.id),N=s==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:a?{color:t.primary,fontWeight:600,background:t.primaryLt,[s==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>I(D.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:c?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:a?120:"auto",...K?N:{color:c?t.textMut:t.textSec}},children:[D.icon&&e.jsx("span",{style:{fontSize:16},children:D.icon}),e.jsx("span",{children:D.tab}),l.includes(D.id)&&e.jsx("span",{onClick:H=>M(H,D.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},D.id)})}),L=w.find(D=>D.id===z),A=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[L==null?void 0:L.content,(L==null?void 0:L.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:L.html},style:{padding:16}})]});return e.jsxs("div",{className:"dhx",style:{display:"flex",flexDirection:s==="top"?"column":s==="bottom"?"column-reverse":s==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...x},children:[$,A]})}const ue=`1px solid ${t.border}`;function tt({active:r,dir:s}){return e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",gap:1,flexShrink:0,marginLeft:4},children:[e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 0L7 4H0z",fill:r&&s==="asc"?t.primary:t.borderDk})}),e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 4L0 0H7z",fill:r&&s==="desc"?t.primary:t.borderDk})})]})}function rt({options:r,value:s,onChange:d,onCommit:l,onCancel:p}){const[i,u]=g.useState(s),[h,x]=g.useState(!0),z=g.useRef(null);g.useEffect(()=>{const b=f=>{z.current&&!z.current.contains(f.target)&&l()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]);const n=r.filter(b=>!i||b.toLowerCase().includes(i.toLowerCase()));return e.jsxs("div",{ref:z,style:{width:"100%",position:"relative"},children:[e.jsx("input",{autoFocus:!0,value:i,onChange:b=>{u(b.target.value),d(b.target.value),x(!0)},onKeyDown:b=>{b.key==="Enter"&&l(),b.key==="Escape"&&p()},onClick:b=>b.stopPropagation(),style:{width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text}}),h&&n.length>0&&e.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:50,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,maxHeight:160,overflowY:"auto"},children:n.map(b=>e.jsx("div",{onMouseDown:f=>{f.preventDefault(),d(b),u(b),x(!1),l()},style:{padding:"6px 10px",cursor:"pointer",fontSize:13,color:t.text},onMouseEnter:f=>f.currentTarget.style.background=t.bg,onMouseLeave:f=>f.currentTarget.style.background=t.surface,children:b},b))})]})}function nt(r,s){if(r==null)return"";if(s==="number")return typeof r=="number"?r.toLocaleString():String(r);if(s==="date"){const d=r instanceof Date?r:new Date(String(r));return isNaN(d.getTime())?String(r):d.toLocaleDateString()}return String(r)}function ot(r,s,d){return r==null?1:s==null?-1:d==="date"?new Date(String(r)).getTime()-new Date(String(s)).getTime():d==="number"?Number(r)-Number(s):String(r)<String(s)?-1:String(r)>String(s)?1:0}function ye(r){var s;return Array.isArray(r.header)&&((s=r.header[1])==null?void 0:s.content)!=null?r.header[1].content:r.filterable?r.filterType==="select"?"selectFilter":"inputFilter":null}function st(r,s,d,l,p){const i={width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text},u=r.editorType??"input";if(u==="select")return e.jsx("select",{autoFocus:!0,value:s,onChange:x=>d(x.target.value),onBlur:l,onKeyDown:x=>{x.key==="Enter"&&l(),x.key==="Escape"&&p()},onClick:x=>x.stopPropagation(),style:{...i,cursor:"pointer"},children:(r.options??[]).map(x=>e.jsx("option",{value:x,children:x},x))});if(u==="combobox")return e.jsx(rt,{options:r.options??[],value:s,onChange:d,onCommit:l,onCancel:p});const h=r.type==="number"?"number":r.type==="date"?"date":"text";return e.jsx("input",{autoFocus:!0,type:h,value:s,onChange:x=>d(x.target.value),onBlur:l,onKeyDown:x=>{x.key==="Enter"&&l(),x.key==="Escape"&&p()},onClick:x=>x.stopPropagation(),style:i})}function lt({columns:r,data:s=[],height:d=400,rowHeight:l=40,headerRowHeight:p=40,footerRowHeight:i=40,sortable:u=!0,resizable:h=!0,editable:x=!1,stripe:z=!1,autoWidth:n=!1,keyNavigation:b=!1,selection:f,multiselect:M,leftSplit:I=0,onSelect:a,onChange:w,style:$}){var Pe;const[L,A]=g.useState(null),[C,D]=g.useState("asc"),[K,c]=g.useState({}),[N,H]=g.useState(new Set),[k,U]=g.useState(-1),[R,o]=g.useState(()=>Object.fromEntries(r.map(y=>[y.id,y.width??y.minWidth??150]))),[W,_]=g.useState(null),[m,S]=g.useState(""),[T,v]=g.useState({}),j=g.useRef(null),[Y,J]=g.useState(0);g.useEffect(Z,[]),g.useEffect(()=>{if(!n||!j.current)return;const y=new ResizeObserver(()=>{var E;return J(((E=j.current)==null?void 0:E.offsetWidth)??0)});return y.observe(j.current),()=>y.disconnect()},[n]);const X=g.useMemo(()=>r.map(y=>y.summary&&(!y.footer||y.footer.length===0)?{...y,footer:[{summary:y.summary}]}:y),[r]),G=g.useMemo(()=>X.filter(y=>!y.hidden),[X]),ee=g.useMemo(()=>{if(!n||Y===0)return R;const y=G.reduce((B,F)=>B+(R[F.id]??150),0);if(Y<=y)return R;const E=(Y-y)/G.length;return Object.fromEntries(G.map(B=>[B.id,(R[B.id]??150)+E]))},[n,Y,R,G]),te=g.useMemo(()=>{let y=s.map((E,B)=>{const F=String(E.id??B);return T[F]?{...E,...T[F]}:E}).filter(E=>Object.entries(K).every(([B,F])=>!F||String(E[B]??"").toLowerCase().includes(F.toLowerCase())));if(L){const E=X.find(B=>B.id===L);y=[...y].sort((B,F)=>{const q=ot(B[L],F[L],E==null?void 0:E.type);return C==="asc"?q:-q})}return y},[s,L,C,K,T,X]),pe=g.useMemo(()=>{const y={};return X.forEach(E=>{var B;if((B=E.footer)!=null&&B.some(F=>F.summary)){const F=te.map(O=>Number(O[E.id])).filter(O=>!isNaN(O)),q=F.reduce((O,ne)=>O+ne,0);y[E.id]={sum:q,avg:F.length?q/F.length:0,count:te.length,min:F.length?Math.min(...F):0,max:F.length?Math.max(...F):0}}}),y},[te,X]),re=g.useMemo(()=>{const y={};return G.filter(E=>{const B=ye(E);return B==="selectFilter"||B==="comboFilter"}).forEach(E=>{y[E.id]=[...new Set(s.map(B=>String(B[E.id]??"")))].sort()}),y},[s,G]),P=G.some(y=>ye(y)!==null),ie=X.some(y=>{var E;return(E=y.footer)==null?void 0:E.length}),Me=G.reduce((y,E)=>y+(ee[E.id]??150),0),ae=g.useMemo(()=>{if(!I)return{};let y=0;const E={};return G.forEach((B,F)=>{F<I&&(E[B.id]=y,y+=ee[B.id]??150)}),E},[I,G,ee]),le=I>0?(Pe=G[I-1])==null?void 0:Pe.id:null,ge=(y,E)=>y.id??E,Et=y=>{!u||y.sortable===!1||(D(E=>L===y.id&&E==="asc"?"desc":"asc"),A(y.id))},Ce=(y,E)=>{if(!f)return;const B=ge(y,E);U(E),H(F=>{const q=M?new Set(F):new Set;return q.has(B)?q.delete(B):q.add(B),q}),a==null||a(y)},It=()=>{if(!W)return;const{key:y,colId:E}=W;v(F=>({...F,[String(y)]:{...F[String(y)]||{},[E]:m}}));const B=te.find((F,q)=>ge(F,q)===y);B&&(w==null||w(B,E,m)),_(null)},Nt=y=>{if(W&&y.key==="Escape"){_(null);return}if(!(!b||!f)){if(y.key==="ArrowDown"){y.preventDefault();const E=Math.min(k+1,te.length-1);E>=0&&Ce(te[E],E)}else if(y.key==="ArrowUp"){y.preventDefault();const E=Math.max(k-1,0);E>=0&&Ce(te[E],E)}}},Wt=(y,E)=>{y.preventDefault(),y.stopPropagation();const B=y.clientX,F=R[E]??150,q=r.find(oe=>oe.id===E),O=oe=>o(he=>({...he,[E]:Math.max((q==null?void 0:q.minWidth)||50,F+oe.clientX-B)})),ne=()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",ne)};document.addEventListener("mousemove",O),document.addEventListener("mouseup",ne)},$e=(y,E,B,F,q,O="hidden")=>{const ne=y in ae;return{width:E,minWidth:E,flexShrink:0,boxSizing:"border-box",padding:"0 12px",height:q,display:"flex",alignItems:"center",overflow:O,textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:B,justifyContent:B==="center"?"center":B==="right"?"flex-end":"flex-start",borderLeft:F?"none":ue,position:ne?"sticky":"relative",...ne?{left:ae[y],zIndex:1,boxShadow:y===le?"2px 0 6px rgba(0,0,0,0.1)":void 0}:{}}};return e.jsx("div",{ref:j,className:"dhx",tabIndex:b?0:void 0,onKeyDown:Nt,style:{width:"100%",height:d,display:"flex",flexDirection:"column",border:ue,borderRadius:t.r,overflow:"hidden",outline:"none",...$},children:e.jsx("div",{className:"dhx-scroll",style:{overflow:"auto",flex:1},children:e.jsxs("div",{style:{minWidth:Me,display:"flex",flexDirection:"column",minHeight:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:ue,flexShrink:0,position:"sticky",top:0,zIndex:3},children:G.map((y,E)=>{const B=Array.isArray(y.header)?y.header[0]:null,F=(B==null?void 0:B.text)??(typeof y.header=="string"?y.header:y.id),q=(B==null?void 0:B.align)??y.align,O=ee[y.id]??150,ne=y.id in ae;return e.jsxs("div",{onClick:()=>Et(y),style:{...$e(y.id,O,q,E===0,p),fontWeight:500,color:t.text,background:t.bg,cursor:u&&y.sortable!==!1?"pointer":"default",userSelect:"none",...ne?{zIndex:4}:{}},children:[B!=null&&B.htmlEnable?e.jsx("span",{style:{flex:1,overflow:"hidden"},dangerouslySetInnerHTML:{__html:F}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F}),u&&y.sortable!==!1&&e.jsx(tt,{active:L===y.id,dir:C}),h&&y.resizable!==!1&&E<G.length-1&&e.jsx("div",{onMouseDown:oe=>Wt(oe,y.id),onClick:oe=>oe.stopPropagation(),style:{position:"absolute",right:0,top:0,bottom:0,width:4,cursor:"col-resize",zIndex:1},onMouseEnter:oe=>oe.currentTarget.style.background=t.primary+"55",onMouseLeave:oe=>oe.currentTarget.style.background="transparent"})]},y.id)})}),P&&e.jsx("div",{style:{display:"flex",borderBottom:ue,background:t.surface,flexShrink:0,...I?{position:"sticky",top:p,zIndex:3}:{}},children:G.map((y,E)=>{const B=ye(y),F=ee[y.id]??150,q=y.id in ae;return e.jsx("div",{style:{width:F,minWidth:F,flexShrink:0,padding:"4px 6px",boxSizing:"border-box",borderLeft:E===0?"none":ue,background:t.surface,...q?{position:"sticky",left:ae[y.id],zIndex:4,boxShadow:y.id===le?"2px 0 6px rgba(0,0,0,0.1)":void 0}:{}},children:B==="selectFilter"||B==="comboFilter"?e.jsxs("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,padding:"0 4px"},value:K[y.id]||"",onChange:O=>c(ne=>({...ne,[y.id]:O.target.value})),children:[e.jsx("option",{value:"",children:"All"}),(re[y.id]||[]).map(O=>e.jsx("option",{value:O,children:O},O))]}):B==="inputFilter"?e.jsx("input",{className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Filter...",value:K[y.id]||"",onChange:O=>c(ne=>({...ne,[y.id]:O.target.value}))}):null},y.id)})}),e.jsxs("div",{style:{flex:1},children:[te.map((y,E)=>{const B=ge(y,E),F=N.has(B),q=F?t.primaryLt:z&&E%2!==0?t.bg:t.surface;return e.jsx("div",{style:{display:"flex",height:l,borderBottom:ue,flexShrink:0,background:q,transition:"background .1s",cursor:f?"pointer":"default"},onMouseEnter:O=>!F&&(O.currentTarget.style.background=t.primaryLt+"80"),onMouseLeave:O=>!F&&(O.currentTarget.style.background=q),children:G.map((O,ne)=>{const oe=(W==null?void 0:W.key)===B&&(W==null?void 0:W.colId)===O.id,he=y[O.id],Bt=ee[O.id]??150,Fe=(x||O.editable)&&O.editable!==!1;let fe;return oe?fe=st(O,m,S,It,()=>_(null)):O.template?fe=O.template(he,y):O.htmlEnable?fe=e.jsx("span",{dangerouslySetInnerHTML:{__html:String(he??"")}}):O.type==="boolean"?fe=e.jsx("input",{type:"checkbox",readOnly:!0,checked:!!he,style:{width:16,height:16,accentColor:t.primary,cursor:Fe?"pointer":"default"}}):fe=nt(he,O.type),e.jsx("div",{onClick:()=>{if(Ce(y,E),!!Fe)if(O.type==="boolean"){const Oe=!he,Ye=String(B);v(Ke=>({...Ke,[Ye]:{...Ke[Ye]||{},[O.id]:Oe}})),w==null||w(y,O.id,Oe)}else _({key:B,colId:O.id}),S(String(he??""))},style:{...$e(O.id,Bt,O.align,ne===0,l,oe?"visible":"hidden"),background:q},children:fe},O.id)})},String(B))}),te.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut,fontSize:13},children:"No data"})]}),ie&&e.jsx("div",{style:{display:"flex",borderTop:ue,background:t.bg,flexShrink:0,position:"sticky",bottom:0,zIndex:2},children:G.map((y,E)=>{var oe;const B=(oe=y.footer)==null?void 0:oe[0],F=pe[y.id]??{sum:0,avg:0,count:0,min:0,max:0};let q="";B&&(typeof B.text=="function"?q=B.text(F):B.text?q=B.text:B.summary&&(q=String(Math.round(F[B.summary]*100)/100)));const O=ee[y.id]??150,ne=y.id in ae;return e.jsx("div",{style:{...$e(y.id,O,y.align,E===0,i),fontWeight:600,color:t.text,background:t.bg,...ne?{zIndex:3}:{}},children:q},y.id)})})]})})})}const se=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function it(r,s,d){const l=r.filter(i=>!i.parent),p=r.filter(i=>!!i.parent);return l.map(i=>({name:i[d],children:p.filter(u=>u.parent===i.id).map(u=>({name:u[d],value:Number(u[s]??0)}))}))}function at({type:r="bar",data:s=[],series:d=[],scales:l={},legend:p,height:i=280,style:u}){var w,$,L,A,C,D,K,c,N,H,k,U,R,o,W,_;g.useEffect(Z,[]);const h=((w=l.bottom)==null?void 0:w.text)||s[0]&&Object.keys(s[0])[0]||"x",x=e.jsx(Q.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),z=p?e.jsx(Q.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:p.valign==="bottom"?"bottom":p.valign==="middle"?"middle":"top",align:p.halign??"center"}):null,n=e.jsx(Q.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),b=e.jsx(Q.XAxis,{dataKey:h,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1,label:($=l.bottom)!=null&&$.title?{value:l.bottom.title,position:"insideBottom",offset:-4,fontSize:11}:void 0}),f=e.jsx(Q.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((L=l.left)==null?void 0:L.min)??"auto",((A=l.left)==null?void 0:A.max)??"auto"],tickCount:(C=l.left)==null?void 0:C.maxTicks,label:(D=l.left)!=null&&D.title?{value:l.left.title,angle:-90,position:"insideLeft",fontSize:11}:void 0}),M={top:10,right:20,left:0,bottom:(K=l.bottom)!=null&&K.title?20:0},I={data:s,margin:M};let a;if(r==="bar")a=e.jsxs(Q.BarChart,{...I,children:[n,b,f,x,z,d.map((m,S)=>e.jsx(Q.Bar,{dataKey:m.value||m.id||"",name:m.label||m.id,fill:m.fill||m.color||se[S%se.length],radius:[3,3,0,0]},m.id??S))]});else if(r==="line")a=e.jsxs(Q.LineChart,{...I,children:[n,b,f,x,z,d.map((m,S)=>{const T=m.color||se[S%se.length];return e.jsx(Q.Line,{type:"monotone",dataKey:m.value||m.id||"",name:m.label||m.id,stroke:T,strokeWidth:m.strokeWidth??2,dot:{r:3,fill:T}},m.id??S)})]});else if(r==="area")a=e.jsxs(Q.AreaChart,{...I,children:[n,b,f,x,z,d.map((m,S)=>{const T=m.color||se[S%se.length];return e.jsx(Q.Area,{type:"monotone",dataKey:m.value||m.id||"",name:m.label||m.id,stroke:T,fill:(m.fill||T)+"33",strokeWidth:m.strokeWidth??2},m.id??S)})]});else if(r==="pie"||r==="donut"){const m=d[0]||{},S=m.value||"value",T=m.text||"name",v=m.color&&s[0]&&m.color in s[0]?m.color:null;a=e.jsxs(Q.PieChart,{children:[e.jsx(Q.Pie,{data:s,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:S,nameKey:T,stroke:m.stroke||"none",strokeWidth:m.strokeWidth??0,label:({name:j,percent:Y})=>`${j??""} ${((Y??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:s.map((j,Y)=>e.jsx(Q.Cell,{fill:v?j[v]:se[Y%se.length]},Y))}),x,z]})}else if(r==="radar"){const m=((c=l.radial)==null?void 0:c.value)||h;a=e.jsxs(Q.RadarChart,{...I,cx:"50%",cy:"50%",children:[e.jsx(Q.PolarGrid,{}),e.jsx(Q.PolarAngleAxis,{dataKey:m,tick:{fontSize:11}}),e.jsx(Q.PolarRadiusAxis,{tick:{fontSize:9,fill:t.textMut},axisLine:!1}),d.map((S,T)=>{const v=S.color||S.pointColor||se[T%se.length];return e.jsx(Q.Radar,{dataKey:S.value||S.id||"",name:S.label||S.id,stroke:v,fill:v+"44"},S.id??T)}),x,z]})}else if(r==="scatter")a=e.jsxs(Q.ScatterChart,{margin:M,children:[n,e.jsx(Q.XAxis,{type:"number",dataKey:"x",name:((N=l.bottom)==null?void 0:N.title)||"x",tick:{fontSize:11,fill:t.textSec},tickLine:!1,domain:[((H=l.bottom)==null?void 0:H.min)??"auto",((k=l.bottom)==null?void 0:k.max)??"auto"],label:(U=l.bottom)!=null&&U.title?{value:l.bottom.title,position:"insideBottom",offset:-4,fontSize:11}:void 0}),e.jsx(Q.YAxis,{type:"number",dataKey:"y",name:((R=l.left)==null?void 0:R.title)||"y",tick:{fontSize:11,fill:t.textSec},tickLine:!1,axisLine:!1,domain:[((o=l.left)==null?void 0:o.min)??"auto",((W=l.left)==null?void 0:W.max)??"auto"],label:(_=l.left)!=null&&_.title?{value:l.left.title,angle:-90,position:"insideLeft",fontSize:11}:void 0}),x,z,d.map((m,S)=>{const T=m.value||"x",v=m.valueY||"y",j=(m.data||s).map(Y=>({x:Y[T],y:Y[v]}));return e.jsx(Q.Scatter,{data:j,name:m.label||m.id,fill:m.color||se[S%se.length]},m.id??S)})]});else if(r==="treeMap"){const m=d[0]||{},S=m.value||"value",T=m.text||"name",v=it(s,S,T),j=m.stroke||t.surface,Y=m.strokeWidth??2;a=e.jsx(Q.Treemap,{data:v,dataKey:"value",aspectRatio:4/3,stroke:j,content:J=>{const{x:X,y:G,width:ee,height:te,depth:pe,index:re,name:P}=J;if(pe===0)return null;const ie=se[re%se.length];return e.jsxs("g",{children:[e.jsx("rect",{x:X,y:G,width:ee,height:te,fill:ie,stroke:j,strokeWidth:Y,style:{borderRadius:3}}),ee>40&&te>20&&e.jsx("text",{x:X+ee/2,y:G+te/2,textAnchor:"middle",dominantBaseline:"middle",fill:"#fff",fontSize:11,pointerEvents:"none",children:P})]})}})}return e.jsx("div",{className:"dhx",style:{width:"100%",height:i,padding:12,background:t.surface,borderRadius:t.rMd,...u},children:e.jsx(Q.ResponsiveContainer,{width:"100%",height:"100%",children:a})})}const dt=["January","February","March","April","May","June","July","August","September","October","November","December"],ct=["Su","Mo","Tu","We","Th","Fr","Sa"];function pt({value:r,range:s=!1,timepicker:d=!1,onChange:l,style:p}){const i=new Date,u=r?new Date(Array.isArray(r)?r[0]:r):i,[h,x]=g.useState(u),[z,n]=g.useState(r??(s?[null,null]:null)),[b,f]=g.useState(null),[M,I]=g.useState({h:0,m:0});g.useEffect(Z,[]);const a=h.getFullYear(),w=h.getMonth(),$=new Date(a,w,1).getDay(),L=new Date(a,w+1,0).getDate(),A=[];for(let c=0;c<$;c++)A.push(null);for(let c=1;c<=L;c++)A.push(new Date(a,w,c));const C=c=>c.toDateString()===i.toDateString(),D=c=>{if(!z)return!1;if(s&&Array.isArray(z)){const[N,H]=z;if(!N)return!1;const k=c.getTime();return H?k>=N.getTime()&&k<=H.getTime():c.toDateString()===N.toDateString()}return c.toDateString()===z.toDateString()},K=c=>{if(s){const[N,H]=Array.isArray(z)?z:[null,null];if(!N||H)n([c,null]);else{const k=c<N?[c,N]:[N,c];n(k),l==null||l(k)}}else n(c),l==null||l(c)};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...p},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>x(c=>new Date(c.getFullYear(),c.getMonth()-1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"‹"}),e.jsxs("div",{style:{fontWeight:700,fontSize:14},children:[dt[w]," ",a]}),e.jsx("button",{onClick:()=>x(c=>new Date(c.getFullYear(),c.getMonth()+1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"›"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 32px)",gap:2},children:[ct.map(c=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:c},c)),A.map((c,N)=>{const H=c?D(c):!1,k=c&&b&&c.toDateString()===b.toDateString();return e.jsx("div",{onClick:()=>c&&K(c),onMouseEnter:()=>c&&f(c),onMouseLeave:()=>f(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:c?"pointer":"default",fontSize:12,fontWeight:c&&C(c)?700:400,background:H?t.primary:k?t.bg:"transparent",color:H?"#fff":c&&C(c)?t.primary:c?t.text:"transparent",border:c&&C(c)&&!H?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:c==null?void 0:c.getDate()},N)})]}),d&&e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,marginTop:12,paddingTop:12,display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("input",{type:"number",min:0,max:23,value:M.h,onChange:c=>I(N=>({...N,h:+c.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}}),e.jsx("span",{style:{fontWeight:700,color:t.textSec},children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:M.m,onChange:c=>I(N=>({...N,m:+c.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function Ie({value:r,onChange:s,timeFormat:d=12,controls:l=!1,minuteStep:p=5,style:i}){const[u,h]=g.useState((r==null?void 0:r.h)??(d===24?0:12)),[x,z]=g.useState((r==null?void 0:r.m)??0),[n,b]=g.useState((r==null?void 0:r.ampm)??"AM"),[f,M]=g.useState(null);g.useEffect(Z,[]);const I=d===24?Array.from({length:24},(C,D)=>D):Array.from({length:12},(C,D)=>D+1),a=Array.from({length:Math.ceil(60/p)},(C,D)=>D*p),w=(C,D,K)=>{const c=d===24?{h:C,m:D}:{h:C,m:D,ampm:K};l?M(c):s==null||s(c)},$=()=>{M(null),h((r==null?void 0:r.h)??(d===24?0:12)),z((r==null?void 0:r.m)??0),b((r==null?void 0:r.ampm)??"AM")},L={display:"flex",flexDirection:"column",alignItems:"center",gap:4},A=C=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:C?700:400,background:C?t.primaryLt:"transparent",color:C?t.primary:t.text});return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...i},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"stretch"},children:[e.jsxs("div",{style:L,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Hours"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:I.map(C=>e.jsx("div",{onClick:()=>{h(C),w(C,x,n)},style:A(u===C),onMouseEnter:D=>u!==C&&(D.currentTarget.style.background=t.bg),onMouseLeave:D=>u!==C&&(D.currentTarget.style.background="transparent"),children:String(C).padStart(2,"0")},C))})]}),e.jsxs("div",{style:L,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Minutes"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:a.map(C=>e.jsx("div",{onClick:()=>{z(C),w(u,C,n)},style:A(x===C),onMouseEnter:D=>x!==C&&(D.currentTarget.style.background=t.bg),onMouseLeave:D=>x!==C&&(D.currentTarget.style.background="transparent"),children:String(C).padStart(2,"0")},C))})]}),d===12&&e.jsxs("div",{style:L,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"AM/PM"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden"},children:["AM","PM"].map(C=>e.jsx("div",{onClick:()=>{b(C),w(u,x,C)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:n===C?700:400,background:n===C?t.primary:t.surface,color:n===C?"#fff":t.text},children:C},C))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(u).padStart(2,"0"),":",String(x).padStart(2,"0"),d===12?` ${n}`:""]}),l&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:12},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:$,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>{const C=f??(d===24?{h:u,m:x}:{h:u,m:x,ampm:n});s==null||s(C)},children:"Apply"})]})]})}const ht=({open:r})=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{flexShrink:0,transition:"transform .15s",transform:r?"rotate(180deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M2 4l4 4 4-4",stroke:t.textMut,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})});function be({data:r=[],value:s,placeholder:d="Select or type...",multiselection:l=!1,label:p,onChange:i,style:u}){var K;const[h,x]=g.useState(!1),[z,n]=g.useState(""),[b,f]=g.useState(l?s?[].concat(s):[]:s||null),M=g.useRef(null),I=g.useRef(null);g.useEffect(Z,[]),de(M,g.useCallback(()=>{x(!1),n("")},[]));const a=g.useMemo(()=>r.filter(c=>!z||c.value.toLowerCase().includes(z.toLowerCase())),[r,z]),w=c=>l?(b||[]).includes(c):b===c,$=c=>{const N=c.id||c.value;if(l){const H=w(N)?b.filter(k=>k!==N):[...b||[],N];f(H),i==null||i(H)}else f(N),n(""),x(!1),i==null||i(N)},L=c=>{const N=b.filter(H=>H!==c);f(N),i==null||i(N)},A=()=>{x(!0),setTimeout(()=>{var c;return(c=I.current)==null?void 0:c.focus()},0)},C=((K=r.find(c=>(c.id||c.value)===b))==null?void 0:K.value)||"",D=l?b||[]:[];return e.jsxs("div",{ref:M,className:"dhx",style:{position:"relative",...u},children:[p&&e.jsx("label",{className:"dhx dhx-label",children:p}),e.jsxs("div",{onClick:A,style:{display:"flex",alignItems:"center",flexWrap:l?"wrap":"nowrap",border:`1px solid ${h?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:h?`0 0 0 3px ${t.primary}22`:"none"},children:[l&&e.jsxs(e.Fragment,{children:[D.map(c=>{var N;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:t.primary,color:"#fff",borderRadius:12,padding:"2px 10px 2px 8px",fontSize:12,lineHeight:1.5,whiteSpace:"nowrap"},children:[((N=r.find(H=>(H.id||H.value)===c))==null?void 0:N.value)||c,e.jsx("span",{onClick:H=>{H.stopPropagation(),L(c)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},c)}),e.jsx("input",{ref:I,value:z,onChange:c=>{n(c.target.value),x(!0)},onFocus:()=>x(!0),onClick:c=>c.stopPropagation(),placeholder:D.length?"":d,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!l&&e.jsx("input",{ref:I,value:h?z:C,onChange:c=>{n(c.target.value),x(!0)},onFocus:()=>{x(!0),n("")},onClick:c=>c.stopPropagation(),placeholder:d,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(ht,{open:h})]}),h&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:100},children:e.jsxs("div",{className:"dhx-scroll",style:{maxHeight:220,overflowY:"auto"},children:[a.map(c=>{const N=c.id||c.value,H=w(N);return e.jsxs("div",{onClick:()=>$(c),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:H?t.primaryLt:"transparent",color:H?t.primary:t.text},onMouseEnter:k=>!H&&(k.currentTarget.style.background=t.bg),onMouseLeave:k=>!H&&(k.currentTarget.style.background="transparent"),children:[l&&e.jsx("span",{style:{width:14,height:14,flexShrink:0,border:`2px solid ${H?t.primary:t.borderDk}`,borderRadius:3,display:"flex",alignItems:"center",justifyContent:"center",background:H?t.primary:"transparent"},children:H&&e.jsx("span",{style:{color:"#fff",fontSize:9,lineHeight:1},children:"✓"})}),e.jsx("span",{style:{flex:1},children:c.value}),!l&&H&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),c.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",c.count,")"]})]},N)}),a.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function ve({min:r=0,max:s=100,step:d=1,value:l,range:p=!1,label:i,tick:u,disabled:h=!1,onChange:x,style:z}){const[n,b]=g.useState(l??(p?[r,s]:r));g.useEffect(Z,[]);const f=($,L)=>{if(!h)if(p){const A=[...n];A[$]=L,b(A),x==null||x(A)}else b(L),x==null||x(L)},M=$=>($-r)/(s-r)*100,I=p?n:[n],a=p?{left:`${M(I[0])}%`,width:`${M(I[1])-M(I[0])}%`}:{left:0,width:`${M(I[0])}%`},w=h?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:h?.5:1,...z},children:[i&&e.jsx("label",{className:"dhx dhx-label",children:i}),e.jsx("div",{style:{position:"relative",height:36,display:"flex",alignItems:"center"},children:e.jsxs("div",{style:{position:"relative",flex:1,height:4,background:t.border,borderRadius:2},children:[e.jsx("div",{style:{position:"absolute",...a,height:"100%",background:w,borderRadius:2}}),I.map(($,L)=>e.jsx("input",{type:"range",min:r,max:s,step:d,value:$,disabled:h,onChange:A=>{const C=+A.target.value;p&&L===0&&C>=n[1]||p&&L===1&&C<=n[0]||f(L,C)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:h?"not-allowed":"pointer",top:0,left:0,margin:0}},L)),I.map(($,L)=>e.jsx("div",{style:{position:"absolute",left:`${M($)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${w}`,boxShadow:"0 1px 4px rgba(0,0,0,.2)",pointerEvents:"none"},children:e.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:h?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:$})},L))]})}),u&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((s+r)/2),s].map($=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:$},$))})]})}const ut=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#607d8b","#9e9e9e","#000000","#ffffff","#0288d1","#01579b","#43a047","#e53935","#f57c00"];function Se(r){const s=parseInt(r.slice(1,3),16)/255,d=parseInt(r.slice(3,5),16)/255,l=parseInt(r.slice(5,7),16)/255,p=Math.max(s,d,l),i=Math.min(s,d,l);let u=0,h=0;const x=(p+i)/2;if(p!==i){const z=p-i;h=x>.5?z/(2-p-i):z/(p+i),u=p===s?((d-l)/z+(d<l?6:0))/6:p===d?((l-s)/z+2)/6:((s-d)/z+4)/6}return[Math.round(u*360),Math.round(h*100),Math.round(x*100)]}function Ne(r,s,d){s/=100,d/=100;const l=s*Math.min(d,1-d),p=i=>{const u=(i+r/30)%12,h=d-l*Math.max(Math.min(u-3,9-u,1),-1);return Math.round(255*h).toString(16).padStart(2,"0")};return"#"+p(0)+p(8)+p(4)}function ft({value:r="#0288d1",onChange:s,style:d}){const[l,p]=g.useState(()=>Se(r)),i=Ne(...l);g.useEffect(Z,[]);const u=h=>{p(h),s==null||s(Ne(...h))};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...d},children:[e.jsx("div",{style:{width:200,height:120,borderRadius:t.r,marginBottom:12,background:`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, hsl(${l[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,l[0]],["Saturation",0,100,l[1]],["Lightness",0,100,l[2]]].map(([h,x,z,n],b)=>e.jsxs("div",{style:{marginBottom:b<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[h,b>0?` (${n}%)`:""]}),e.jsx("input",{type:"range",min:x,max:z,value:n,onChange:f=>{const M=[...l];M[b]=+f.target.value,u(M)},style:{width:"100%",accentColor:t.primary}})]},h)),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:t.r,background:i,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:i,onChange:h=>{try{u(Se(h.target.value)),s==null||s(h.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:ut.map(h=>e.jsx("div",{onClick:()=>{p(Se(h)),s==null||s(h)},style:{width:14,height:14,borderRadius:2,background:h,cursor:"pointer",border:i===h?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:x=>x.currentTarget.style.transform="scale(1.3)",onMouseLeave:x=>x.currentTarget.style.transform="scale(1)"},h))})]})}function gt({trigger:r,children:s,placement:d="bottom-start",style:l}){const[p,i]=g.useState(!1),[u,h]=g.useState({top:"100%",left:0}),x=g.useRef(null),z=g.useRef(null);g.useEffect(Z,[]),de(x,g.useCallback(()=>i(!1),[]));const n=()=>{i(b=>{if(!b&&z.current){const f=z.current.getBoundingClientRect(),M={"bottom-start":{top:f.height+4,left:0},"bottom-end":{top:f.height+4,right:0,left:"auto"},"top-start":{bottom:f.height+4,top:"auto",left:0}};h(M[d]||M["bottom-start"])}return!b})};return e.jsxs("div",{ref:x,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:z,onClick:n,children:r}),p&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...u,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...l},children:s})]})}function xt({title:r,children:s,width:d=480,height:l,closable:p=!0,movable:i=!0,modal:u=!1,defaultOpen:h=!0,footer:x,onClose:z,style:n}){const[b,f]=g.useState(h),[M,I]=g.useState({x:0,y:0});g.useEffect(Z,[]);const a=Le(g.useCallback(($,L)=>i&&I({x:$,y:L}),[i])),w=()=>{f(!1),z==null||z()};return b?e.jsxs(e.Fragment,{children:[u&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:p?w:void 0}),e.jsxs("div",{className:"dhx",style:{position:u?"fixed":"absolute",left:"50%",top:"50%",transform:`translate(calc(-50% + ${M.x}px), calc(-50% + ${M.y}px))`,width:d,...l?{height:l}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...n},children:[e.jsxs("div",{onMouseDown:$=>a($,M.x,M.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:i?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:r}),p&&e.jsx("button",{onClick:w,style:{background:"none",border:"none",cursor:"pointer",width:28,height:28,borderRadius:t.r,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18,color:t.textSec},onMouseEnter:$=>$.currentTarget.style.background=t.border,onMouseLeave:$=>$.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:s}),x&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:x})]})]}):null}const ke=g.createContext(null),yt={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},We={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function bt({children:r}){const[s,d]=g.useState([]);g.useEffect(Z,[]);const l=g.useCallback(u=>d(h=>h.filter(x=>x.id!==u)),[]),p=g.useCallback(u=>{const h=Date.now();return d(x=>[...x,{id:h,...u}]),u.duration!==0&&setTimeout(()=>l(h),u.duration||4e3),h},[l]),i={message:p,alert:(u,h)=>p({type:"info",title:u,...h}),confirm:(u,h,x)=>p({type:"warning",title:u,confirm:h,...x})};return e.jsxs(ke.Provider,{value:i,children:[r,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:s.map(u=>{const h=u.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${We[h]}`,borderRadius:t.r,boxShadow:t.shadowLg,padding:"12px 16px",minWidth:280,maxWidth:380,pointerEvents:"all",display:"flex",gap:10,alignItems:"flex-start",animation:"dhx-toast .3s ease"},children:[e.jsx("span",{style:{fontSize:18,color:We[h],lineHeight:1},children:yt[h]}),e.jsxs("div",{style:{flex:1},children:[u.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:u.text?3:0},children:u.title}),u.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:u.text}),u.confirm&&e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",style:{height:26,fontSize:12},onClick:()=>{u.confirm(!0),l(u.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{u.confirm(!1),l(u.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>l(u.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},u.id)})})]})}function vt(){const r=g.useContext(ke);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function St({data:r=[],template:s,keyNavigation:d=!0,multiselection:l=!1,editable:p=!1,height:i=400,onSelect:u,onEdit:h,style:x}){const[z,n]=g.useState(new Set),[b,f]=g.useState(null),[M,I]=g.useState(""),[a,w]=g.useState(null);g.useEffect(Z,[]);const $=(A,C)=>{const D=A.id??C;n(K=>{const c=l?new Set(K):new Set;return c.has(D)?c.delete(D):c.add(D),c}),w(C),u==null||u(A)},L=(A,C)=>{h==null||h({...A,value:M},C),f(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:i,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...x},tabIndex:0,onKeyDown:A=>{d&&(A.key==="ArrowDown"&&w(C=>Math.min((C??-1)+1,r.length-1)),A.key==="ArrowUp"&&w(C=>Math.max((C??1)-1,0)))},children:[r.map((A,C)=>{const D=A.id??C,K=z.has(D),c=a===C;return e.jsx("div",{onClick:()=>$(A,C),onDoubleClick:()=>p&&(f(C),I(String(A.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:K?t.primaryLt:c?t.bg:t.surface,color:K?t.primary:t.text,outline:c?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:b===C?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:M,onChange:N=>I(N.target.value),onBlur:()=>L(A,C),onKeyDown:N=>{N.key==="Enter"&&L(A,C),N.key==="Escape"&&f(null)},onClick:N=>N.stopPropagation()}):s?e.jsx("div",{dangerouslySetInnerHTML:{__html:s(A)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(A.value??"")})},String(D))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function kt({data:r=[],template:s,itemsInRow:d=3,gap:l=12,multiselection:p=!1,onSelect:i,style:u}){const[h,x]=g.useState(new Set);g.useEffect(Z,[]);const z=n=>{const b=n.id??String(n.title);x(f=>{const M=p?new Set(f):new Set;return M.has(b)?M.delete(b):M.add(b),M}),i==null||i(n)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${d}, 1fr)`,gap:l,padding:l,...u},children:r.map((n,b)=>{const f=n.id??b,M=h.has(f);return e.jsx("div",{onClick:()=>z(n),style:{background:t.surface,border:`2px solid ${M?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:M?`0 0 0 3px ${t.primary}33`:t.shadow,transform:M?"translateY(-2px)":"none"},onMouseEnter:I=>{I.currentTarget.style.boxShadow=t.shadowLg,I.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:I=>{I.currentTarget.style.boxShadow=M?`0 0 0 3px ${t.primary}33`:t.shadow,I.currentTarget.style.transform=M?"translateY(-2px)":"none"},children:s?e.jsx("div",{dangerouslySetInnerHTML:{__html:s(n)}}):e.jsxs("div",{style:{padding:16},children:[n.img&&e.jsx("img",{src:n.img,alt:n.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:n.title||n.value}),n.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:n.subtitle})]})},String(f))})})}function we(r){return r.map(s=>({...s,items:s.items?we(s.items):void 0}))}function me(r,s={}){return r.forEach(d=>{d.opened&&(s[d.id]=!0),d.items&&me(d.items,s)}),s}function Be(r,s){let d=null;return[r.filter(p=>p.id===s?(d=p,!1):!0).map(p=>{if(p.items){const[i,u]=Be(p.items,s);return u&&(d=u),{...p,items:i}}return p}),d]}function ze(r,s,d,l){if(l==="inside")return r.map(i=>i.id===s?{...i,items:[...i.items||[],d]}:i.items?{...i,items:ze(i.items,s,d,l)}:i);if(r.some(i=>i.id===s)){const i=[];for(const u of r)u.id===s?l==="before"?(i.push(d),i.push(u)):(i.push(u),i.push(d)):i.push(u);return i}return r.map(i=>i.items?{...i,items:ze(i.items,s,d,l)}:i)}function wt(r,s,d){function l(p){var i,u;if(p.id===s){const h=x=>{var z;return x.id===d||(((z=x.items)==null?void 0:z.some(h))??!1)};return((i=p.items)==null?void 0:i.some(h))??!1}return((u=p.items)==null?void 0:u.some(l))??!1}return r.some(l)}function Ae(r,s,d){return r.map(l=>l.id===s?{...l,value:d}:{...l,items:l.items?Ae(l.items,s,d):void 0})}function mt(r,s){var i;let d=0,l=0;const p=u=>{var h;d++,s[u.id]&&l++,(h=u.items)==null||h.forEach(p)};return(i=r.items)==null||i.forEach(p),{total:d,checkedCount:l}}function zt({data:r=[],checkbox:s=!1,editable:d=!1,dragMode:l,tooltip:p,onSelect:i,onCheck:u,onChange:h,style:x}){const[z,n]=g.useState(()=>we(r)),[b,f]=g.useState(()=>me(r)),[M,I]=g.useState(null),[a,w]=g.useState({}),[$,L]=g.useState(null),[A,C]=g.useState(""),[D,K]=g.useState(null),[c,N]=g.useState(null);g.useEffect(Z,[]),g.useEffect(()=>{n(we(r)),f(S=>({...me(r),...S}))},[r]);const H=S=>f(T=>({...T,[S]:!T[S]})),k=(S,T)=>{w(v=>({...v,[S]:T})),u==null||u(S,T)},U=()=>{if(!$)return;const S=$,T=A;L(null),n(v=>{const j=Ae(v,S,T);return h==null||h(j),j})},R=(S,T)=>{S.dataTransfer.effectAllowed="move",K(T)},o=(S,T)=>{if(!D||D===T||wt(z,D,T))return;S.preventDefault();const v=S.currentTarget.getBoundingClientRect(),j=S.clientY-v.top,Y=v.height,J=j<Y*.25?"before":j>Y*.75?"after":"inside";N(X=>(X==null?void 0:X.id)===T&&(X==null?void 0:X.pos)===J?X:{id:T,pos:J})},W=(S,T)=>{if(S.preventDefault(),!D||!c||D===T){N(null),K(null);return}n(v=>{const[j,Y]=Be(v,D);if(!Y)return v;const J=ze(j,T,Y,c.pos);return h==null||h(J),J}),c.pos==="inside"&&f(v=>({...v,[T]:!0})),N(null),K(null)},_=()=>{K(null),N(null)},m=(S,T=0)=>{var re;const v=(((re=S.items)==null?void 0:re.length)??0)>0,j=b[S.id],Y=M===S.id,J=D===S.id,X=(c==null?void 0:c.id)===S.id;let G=!!a[S.id],ee=!1;if(s&&v){const{total:P,checkedCount:ie}=mt(S,a);ie>0&&ie<P?ee=!0:P>0&&ie===P&&(G=!0)}const te=X&&c.pos!=="inside"?{boxShadow:c.pos==="before"?`inset 0 2px 0 0 ${t.primary}`:`inset 0 -2px 0 0 ${t.primary}`}:{},pe=X&&c.pos==="inside"||Y?t.primaryLt:"transparent";return e.jsxs("div",{style:{opacity:J?.4:1},children:[e.jsxs("div",{draggable:!!l,onDragStart:l?P=>R(P,S.id):void 0,onDragOver:l?P=>o(P,S.id):void 0,onDrop:l?P=>W(P,S.id):void 0,onDragEnd:l?_:void 0,title:p==null?void 0:p(S),onClick:()=>{I(S.id),i==null||i(S),v&&H(S.id)},onDoubleClick:()=>{d&&(L(S.id),C(S.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+T*18}px`,cursor:l?"grab":"pointer",borderRadius:t.r,margin:"1px 4px",background:pe,color:Y?t.primary:t.text,userSelect:"none",fontSize:13,...te},onMouseEnter:P=>!Y&&!X&&(P.currentTarget.style.background=t.bg),onMouseLeave:P=>!Y&&!X&&(P.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},onClick:P=>{P.stopPropagation(),v&&H(S.id)},children:v?j?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:v?j?"📂":"📁":"📄"}),s&&e.jsx("input",{ref:P=>{P&&(P.indeterminate=ee)},type:"checkbox",checked:G,onChange:P=>{P.stopPropagation(),k(S.id,P.target.checked)},style:{cursor:"pointer",accentColor:t.primary,flexShrink:0},onClick:P=>P.stopPropagation()}),$===S.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:A,onChange:P=>C(P.target.value),onBlur:U,onKeyDown:P=>{P.key==="Enter"&&U(),P.key==="Escape"&&L(null)},onClick:P=>P.stopPropagation()}):e.jsx("span",{style:{flex:1},children:S.value}),S.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",S.count,")"]})]}),v&&j&&e.jsx("div",{children:S.items.map(P=>m(P,T+1))})]},S.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...x},onDragOver:l?S=>S.preventDefault():void 0,onDrop:l?S=>{S.preventDefault(),N(null),K(null)}:void 0,children:z.map(S=>m(S))})}function Mt({total:r,pageSize:s=10,page:d,onChange:l,style:p}){const[i,u]=g.useState(d||1),h=Math.ceil(r/s);g.useEffect(Z,[]);const x=n=>{const b=Math.min(Math.max(1,n),h);u(b),l==null||l(b)},z=g.useMemo(()=>{const n=[];for(let f=Math.max(1,i-2);f<=Math.min(h,i+2);f++)n.push(f);return n[0]>1&&(n[0]>2&&n.unshift("..."),n.unshift(1)),n[n.length-1]<h&&(n[n.length-1]<h-1&&n.push("..."),n.push(h)),n},[i,h]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...p},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(i-1)*s+1,"–",Math.min(i*s,r)," of ",r]}),[["«",1],["‹",i-1]].map(([n,b])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:i===1,onClick:()=>x(b),children:n},n)),z.map((n,b)=>e.jsx("button",{onClick:()=>typeof n=="number"&&x(n),className:`dhx dhx-btn ${n===i?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:n==="...",children:n},b)),[["›",i+1],["»",h]].map(([n,b])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:i===h,onClick:()=>x(b),children:n},n))]})}function Ct({config:r={},defaultValues:s={},onSubmit:d,style:l}){const[p,i]=g.useState(s),[u,h]=g.useState({}),[x,z]=g.useState(null);g.useEffect(Z,[]);const n=(a,w)=>{i($=>({...$,[a]:w})),h($=>({...$,[a]:null}))},b=a=>{const w=[];return a.flat().forEach($=>{!$||typeof $!="object"||!("name"in $)||(w.push($),$.type==="fieldset"&&$.rows&&w.push(...b($.rows)))}),w},f=()=>{const a={};return b(r.rows||[]).forEach(w=>{w.required&&!p[w.name]&&(a[w.name]=`${w.label||w.name} is required`)}),h(a),Object.keys(a).length===0},M=a=>{const w=p[a.name]??a.value??"",$=u[a.name],L=a.labelWidth??r.labelWidth,A=L!==void 0||a.labelPosition==="left";if(a.type==="fieldset")return e.jsxs("fieldset",{style:{border:`1px solid ${t.border}`,borderRadius:t.r,padding:"12px 16px",marginBottom:14},children:[e.jsx("legend",{style:{fontSize:12,fontWeight:700,color:t.textSec,padding:"0 6px"},children:a.label}),(a.rows||[]).map(k=>M(k))]},a.name);if(a.type==="spacer")return e.jsx("div",{style:{height:a.height||16}},a.name);const C=L?{minWidth:L,width:L,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},D=a.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...C},children:[a.label,a.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,K=$?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:$}):null,c=a.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",a.helpMessage]}):null,N={key:a.name,className:"dhx-form-group"},H=k=>A?e.jsxs("div",{...N,style:{display:"flex",alignItems:"flex-start",gap:8},children:[D,e.jsxs("div",{style:{flex:1,minWidth:0},children:[k,K,c]})]}):e.jsxs("div",{...N,children:[D,k,K,c]});if(!a.type||a.type==="input")return H(e.jsxs("div",{className:"dhx-input-wrap",children:[a.icon&&e.jsx("span",{className:"dhx-input-icon",children:a.icon}),e.jsx("input",{className:`dhx dhx-input${a.icon?" dhx-input--with-icon":""}`,style:{borderColor:$?t.danger:void 0},type:a.inputType||"text",placeholder:a.placeholder,value:w,onChange:k=>n(a.name,k.target.value),disabled:a.disabled})]}));if(a.type==="textarea")return H(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:a.placeholder,value:w,onChange:k=>n(a.name,k.target.value)}));if(a.type==="select")return H(e.jsxs("select",{className:"dhx dhx-input",value:w,onChange:k=>n(a.name,k.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(a.options||[]).map(k=>e.jsx("option",{value:k.value,children:k.label||k.value},k.value))]}));if(a.type==="datepicker")return H(e.jsx("input",{type:"date",className:"dhx dhx-input",value:w,onChange:k=>n(a.name,k.target.value)}));if(a.type==="timepicker"){const k=p[a.name]??{h:12,m:0,ampm:"AM"},U=!!p[a.name],R=U?`${String(k.h).padStart(2,"0")}:${String(k.m).padStart(2,"0")}${k.ampm?" "+k.ampm:""}`:a.placeholder||"Click to select",o=e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{className:"dhx dhx-input",style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},onClick:()=>z(x===a.name?null:a.name),children:[e.jsx("span",{style:{color:U?t.text:t.textMut},children:R}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),x===a.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx(Ie,{value:k,controls:!0,onChange:W=>{n(a.name,W),z(null)}})})]});return H(o)}if(a.type==="colorpicker")return H(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:w||"#000000",onChange:k=>n(a.name,k.target.value),style:{width:36,height:36,padding:2,border:`1px solid ${t.border}`,borderRadius:t.r,cursor:"pointer",background:"none"}}),e.jsx("span",{style:{fontSize:12,color:t.textSec,fontFamily:"monospace"},children:w||"#000000"})]}));if(a.type==="text")return H(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:a.value}));if(a.type==="checkbox")return e.jsxs("div",{...N,children:[A?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[L&&e.jsx("div",{style:{width:L,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!w,onChange:k=>n(a.name,k.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:a.label})]})]}):e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!w,onChange:k=>n(a.name,k.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:a.label})]}),c]});if(a.type==="radio"){const k=(a.options||[]).map(U=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:a.name,value:U.value,checked:w===U.value,onChange:()=>n(a.name,U.value),style:{accentColor:t.primary,cursor:"pointer"}}),U.label||U.value]},U.value));return H(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:k}))}if(a.type==="slider")return A?e.jsxs("div",{...N,style:{display:"flex",alignItems:"flex-start",gap:8},children:[D,e.jsxs("div",{style:{flex:1},children:[e.jsx(ve,{min:a.min,max:a.max,step:a.step,value:w||a.min,range:a.range,onChange:k=>n(a.name,k)}),c]})]}):e.jsxs("div",{...N,children:[e.jsx(ve,{label:a.label,min:a.min,max:a.max,step:a.step,value:w||a.min,range:a.range,onChange:k=>n(a.name,k)}),c]});if(a.type==="combo")return A?e.jsxs("div",{...N,style:{display:"flex",alignItems:"flex-start",gap:8},children:[D,e.jsxs("div",{style:{flex:1},children:[e.jsx(be,{data:a.data||[],multiselection:a.multiselection,placeholder:a.placeholder||"Select...",value:w||(a.multiselection?[]:null),onChange:k=>n(a.name,k)}),K,c]})]}):e.jsxs("div",{...N,children:[e.jsx(be,{label:a.label,data:a.data||[],multiselection:a.multiselection,placeholder:a.placeholder||"Select...",value:w||(a.multiselection?[]:null),onChange:k=>n(a.name,k)}),K,c]});if(a.type==="toggle"){const k=!!w,U=k?a.icon:a.offIcon||a.icon,R=k?a.text||a.label:a.offText||a.text||a.label;return e.jsxs("div",{...N,children:[A&&L&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:L,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(He,{on:k,onClick:()=>n(a.name,!w)}),U&&e.jsx("span",{style:{fontSize:16},children:U}),R&&e.jsx("span",{style:{fontSize:13},children:R})]})]}),!A&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(He,{on:k,onClick:()=>n(a.name,!w)}),U&&e.jsx("span",{style:{fontSize:16},children:U}),R&&e.jsx("span",{style:{fontSize:13},children:R})]}),c]})}return null},I=a=>a.map((w,$)=>Array.isArray(w)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:w.map(M)},$):M(w));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...l},children:[I(r.rows||[]),(r.buttons||d)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:r.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>f()&&(d==null?void 0:d(p)),children:r.submitText||"Submit"}),r.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{i(s),h({})},children:r.resetText||"Reset"})]})]})}function He({on:r,onClick:s}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:s,children:[e.jsx("div",{style:{width:40,height:22,borderRadius:11,background:r?t.primary:t.border,transition:"background 0.2s"}}),e.jsx("div",{style:{position:"absolute",top:3,left:r?21:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,.3)"}})]})}function xe(r){const s=[];for(const d of r)d.type==="block"?s.push(...xe(d.items||[])):s.push(d);return s}function $t(r){return r==="primary"?t.primary:r==="success"?t.success:r==="secondary"?t.borderDk:t.danger}function Dt(r,s){switch(r){case"primary":return{background:t.primary,color:"#fff",borderColor:t.primary};case"danger":return{background:t.danger,color:"#fff",borderColor:t.danger};case"success":return{background:t.success,color:"#fff",borderColor:t.success};case"secondary":return{background:t.bg,color:t.text,borderColor:t.border};default:return s?{background:t.primaryLt,color:t.primary}:{}}}function Lt({items:r=[],css:s,menuCss:d,style:l,onAction:p,onInputChange:i,onInputBlur:u,onInputFocus:h,onOpenMenu:x}){g.useEffect(Z,[]);const[z,n]=g.useState(()=>{const o={};for(const W of xe(r))W.id&&(o[W.id]=!!W.active);return o}),[b,f]=g.useState(null),[M,I]=g.useState(()=>{const o={};for(const W of xe(r))W.type==="selectButton"&&W.id&&W.value&&(o[W.id]=W.value);return o}),a=xe(r),w=g.useRef(null);de(w,g.useCallback(()=>f(null),[]));const $=o=>{var W,_;if(!o.disabled){if(o.id){if(o.group){const m=a.filter(S=>S.group===o.group&&S.id);n(S=>{const T={...S};for(const v of m)T[v.id]=!1;return T[o.id]=!0,T})}else o.twoState&&n(m=>({...m,[o.id]:!m[o.id]}));if((W=o.items)!=null&&W.length){const m=o.id;f(S=>S===m?null:m),x==null||x(o.id);return}}(_=o.onClick)==null||_.call(o,o),o.id&&(p==null||p(o.id,o))}},L=({count:o,color:W})=>e.jsx("span",{style:{position:"absolute",top:2,right:2,minWidth:14,height:14,background:$t(W),color:"#fff",borderRadius:7,fontSize:9,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 2px",pointerEvents:"none"},children:o>99?"99+":o}),A=(o,W)=>{var re;const _=o.id!==void 0?z[o.id]??!!o.active:!!o.active,m=o.value??o.text,S=o.size??"medium",T=S==="auto",v=S==="small",j=!!((re=o.items)!=null&&re.length),Y=o.id!==void 0&&b===o.id,J=Dt(o.color,_&&!o.color),X=T?void 0:v?26:32,G=T?22:v?13:16,ee=[o.tooltip,o.hotkey?`(${o.hotkey})`:""].filter(Boolean).join(" "),te=o.circle?{borderRadius:"50%",padding:T?"8px":"0",aspectRatio:"1",justifyContent:"center"}:{},pe=o.view==="link"?{background:"transparent",border:"none",textDecoration:"underline",padding:"0 4px"}:o.view==="flat"?{borderRadius:0}:{};return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsxs("button",{title:ee||void 0,disabled:o.disabled,className:"dhx dhx-btn dhx-btn-ghost",style:{flexDirection:T?"column":"row",alignSelf:T?"stretch":"center",justifyContent:"center",minHeight:T?56:X,height:T?void 0:X,padding:T?"6px 10px":v?"0 6px":"0 8px",gap:4,position:"relative",background:_&&!o.color?t.primaryLt:"transparent",color:_&&!o.color?t.primary:o.disabled?t.textMut:t.text,opacity:o.disabled?.55:1,cursor:o.disabled?"not-allowed":"pointer",borderColor:Y?t.primary:void 0,...J,...te,...pe},onClick:()=>$(o),children:[o.loading?e.jsx("span",{style:{fontSize:G,lineHeight:1,flexShrink:0,display:"inline-block",animation:"dhx-spin 1s linear infinite"},children:"⟳"}):o.icon&&e.jsx("span",{style:{fontSize:G,lineHeight:1,flexShrink:0},children:o.icon}),m&&!o.html&&e.jsx("span",{style:{fontSize:T?10:v?11:12,maxWidth:T?64:void 0,textAlign:T?"center":"left",lineHeight:T?1.2:1,whiteSpace:T?"normal":"nowrap"},children:m}),o.html&&e.jsx("span",{dangerouslySetInnerHTML:{__html:o.html}}),j&&e.jsx("span",{style:{fontSize:8,opacity:.6,marginLeft:1},children:"▼"}),o.hotkey&&T&&e.jsx("span",{style:{fontSize:9,color:t.textMut,lineHeight:1},children:o.hotkey}),o.count!==void 0&&e.jsx(L,{count:o.count,color:o.countColor})]}),j&&Y&&e.jsx(ce,{items:o.items,onSelect:P=>{f(null),P.id&&(p==null||p(String(P.id),o))},style:{top:"100%",left:0,minWidth:160}})]},W)},C=(o,W)=>{const _=o.size??"medium",m=_==="auto"?48:_==="small"?28:36,S=o.id!==void 0?z[o.id]??!!o.active:!!o.active;return e.jsx("div",{style:{position:"relative",display:"flex",alignSelf:"center"},children:e.jsxs("button",{title:o.tooltip,disabled:o.disabled,style:{width:m,height:m,padding:2,border:S?`2px solid ${t.primary}`:"2px solid transparent",borderRadius:"50%",overflow:"hidden",cursor:o.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0,opacity:o.disabled?.55:1},onClick:()=>$(o),children:[o.src&&e.jsx("img",{src:o.src,alt:o.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),o.count!==void 0&&e.jsx(L,{count:o.count,color:o.countColor})]})},W)},D=(o,W)=>{var T,v;const _=o.id!==void 0&&b===`sel:${o.id}`,m=(o.id&&M[o.id])??o.value??((v=(T=o.items)==null?void 0:T[0])==null?void 0:v.value)??"",S=(o.items??[]).map(j=>({id:j.value,value:j.value,icon:j.icon}));return e.jsxs("div",{style:{position:"relative",alignSelf:"center"},children:[e.jsxs("button",{title:o.tooltip,disabled:o.disabled,className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,gap:4,padding:"0 8px",opacity:o.disabled?.55:1,cursor:o.disabled?"not-allowed":"pointer",borderColor:_?t.primary:void 0},onClick:()=>{if(o.disabled||!o.id)return;const j=`sel:${o.id}`;f(Y=>Y===j?null:j)},children:[o.icon&&e.jsx("span",{style:{fontSize:14},children:o.icon}),e.jsx("span",{style:{fontSize:12},children:m}),e.jsx("span",{style:{fontSize:8,opacity:.6},children:"▼"})]}),_&&e.jsx(ce,{items:S,onSelect:j=>{var J;const Y=String(j.value??j.id??"");o.id&&I(X=>({...X,[o.id]:Y})),f(null),(J=o.onChange)==null||J.call(o,Y),o.id&&(p==null||p(o.id,o))},style:{top:"100%",left:0,minWidth:100}})]},W)},K=(o,W)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",padding:"2px 4px",gap:2},children:[o.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:o.label}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[o.icon&&e.jsx("span",{style:{position:"absolute",left:6,fontSize:13,color:t.textMut,pointerEvents:"none",zIndex:1},children:o.icon}),e.jsx("input",{className:"dhx dhx-input",disabled:o.disabled,style:{width:o.width||110,height:26,fontSize:12,paddingLeft:o.icon?24:void 0},placeholder:o.placeholder,defaultValue:o.value,onChange:_=>{var m;(m=o.onChange)==null||m.call(o,_.target.value),o.id&&(i==null||i(o.id,_.target.value))},onBlur:_=>{var m;(m=o.onBlur)==null||m.call(o,_.target.value),o.id&&(u==null||u(o.id,_.target.value))},onFocus:_=>{var m;(m=o.onFocus)==null||m.call(o,_.target.value),o.id&&(h==null||h(o.id,_.target.value))}})]})]},W),c=(o,W)=>o.hidden?null:e.jsx("div",{title:o.tooltip,style:{padding:"2px 6px",fontSize:11,color:o.disabled?t.textMut:t.textSec,display:"flex",alignItems:"center",alignSelf:"center",userSelect:"none",opacity:o.disabled?.5:1},children:o.html?e.jsx("span",{dangerouslySetInnerHTML:{__html:o.html}}):o.value},W),N=(o,W)=>o.hidden?null:e.jsx("div",{style:{display:"flex",alignItems:"center",alignSelf:"center",padding:"0 4px"},dangerouslySetInnerHTML:{__html:o.html??""}},W),H=(o,W)=>o.hidden?null:o.type==="separator"||o.type==="sep"?e.jsx("div",{style:{width:1,background:t.border,margin:"4px 2px",alignSelf:"stretch"}},W):o.type==="spacer"?e.jsx("div",{style:{flex:1}},W):o.type==="title"?c(o,W):o.type==="customHTML"?N(o,W):o.type==="imageButton"?C(o,W):o.type==="input"?K(o,W):o.type==="selectButton"?D(o,W):A(o,W),k=(o,W,_)=>{var S;if(o.hidden)return null;const m=_||o.disabled;return e.jsx("div",{style:{display:"flex",flexDirection:o.direction==="col"?"column":"row",alignItems:o.direction==="col"?"flex-start":"center",gap:2,opacity:o.disabled&&!_?.55:1,pointerEvents:m?"none":void 0},children:(S=o.items)==null?void 0:S.map((T,v)=>T.type==="block"?k(T,`${W}-${v}`,m):H(T,`${W}-${v}`))},W)},U=(o,W)=>{var m;if(o.hidden)return null;const _=o.title||o.label;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",borderRight:`1px solid ${t.border}`,padding:"4px 6px 0",minWidth:40,opacity:o.disabled?.55:1,pointerEvents:o.disabled?"none":void 0},children:[e.jsx("div",{style:{display:"flex",flexDirection:o.direction==="col"?"column":"row",alignItems:o.direction==="col"?"stretch":"center",gap:2,flex:1},children:(m=o.items)==null?void 0:m.map((S,T)=>S.type==="block"?k(S,T,o.disabled):H(S,T))}),_&&e.jsx("div",{style:{fontSize:10,color:t.textMut,textAlign:"center",padding:"3px 0 4px",marginTop:2,borderTop:`1px solid ${t.border}`},children:_})]},W)},R=(o,W)=>o.type==="block"?U(o,W):H(o,W);return e.jsx("div",{ref:w,className:["dhx",s].filter(Boolean).join(" "),style:{display:"flex",alignItems:"stretch",background:t.surface,borderBottom:`1px solid ${t.border}`,overflowX:"auto",gap:0,minHeight:72,...l},children:r.map(R)})}function je({count:r}){return e.jsx("span",{style:{position:"absolute",top:3,right:3,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function Tt({logo:r,items:s=[],vertical:d=!1,onAction:l,style:p}){const[i,u]=g.useState(null),[h,x]=g.useState(()=>{const f={};return s.forEach(M=>{M.id&&M.twoState&&M.active&&(f[M.id]=!0)}),f}),z=g.useRef(null);g.useEffect(Z,[]),de(z,g.useCallback(()=>u(null),[]));const n=(f,M)=>{var I,a;if(!f.disabled){if(f.twoState&&f.id&&x(w=>({...w,[f.id]:!w[f.id]})),(I=f.items)!=null&&I.length){u(w=>w===M?null:M);return}(a=f.onClick)==null||a.call(f,f.id||""),l==null||l(f.id||"")}},b=(f,M)=>{var $;if(f.hidden)return null;if(f.type==="separator")return e.jsx("div",{style:{[d?"height":"width"]:1,background:t.border,margin:d?"4px 8px":"0 6px",alignSelf:"stretch"}},M);if(f.type==="spacer")return e.jsx("div",{style:{flex:1}},M);if(f.type==="input")return e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",margin:"0 4px"},children:[f.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:f.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:f.width||200,height:28,paddingLeft:f.icon?30:void 0},placeholder:f.placeholder,onChange:L=>{var A;return(A=f.onChange)==null?void 0:A.call(f,L.target.value)}})]},M);if(f.type==="imageButton")return e.jsxs("button",{title:f.tooltip,disabled:f.disabled,style:{position:"relative",width:36,height:36,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:f.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>n(f,M),children:[f.src&&e.jsx("img",{src:f.src,alt:f.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),f.count!==void 0&&e.jsx(je,{count:f.count})]},M);const I=!!(f.twoState&&f.id&&h[f.id]),a=!!(($=f.items)!=null&&$.length),w={position:"relative",height:d?40:36,gap:6,background:I?t.primaryLt:"transparent",color:I?t.primary:f.disabled?t.textMut:t.text,opacity:f.disabled?.55:1,cursor:f.disabled?"not-allowed":"pointer",...d?{width:"100%",justifyContent:"flex-start",padding:"0 16px",borderRadius:0}:{}};return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:f.tooltip,disabled:f.disabled,style:w,onClick:()=>n(f,M),children:[f.icon&&e.jsx("span",{style:{fontSize:16,flexShrink:0},children:f.icon}),f.value&&e.jsx("span",{style:{fontSize:13},children:f.value}),a&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),f.count!==void 0&&e.jsx(je,{count:f.count})]}),a&&i===M&&e.jsx(ce,{items:f.items,onSelect:L=>{var A;u(null),L.id&&((A=f.onClick)==null||A.call(f,L.id),l==null||l(L.id))},style:d?{left:"100%",top:0}:{top:"100%"}})]},M)};return e.jsxs("nav",{ref:z,className:"dhx",style:{display:"flex",flexDirection:d?"column":"row",alignItems:d?"stretch":"center",background:t.surface,borderBottom:d?"none":`1px solid ${t.border}`,borderRight:d?`1px solid ${t.border}`:"none",padding:d?"8px 0":"0 12px",minHeight:d?void 0:48,gap:2,...p},children:[r&&e.jsx("div",{style:{color:t.text,fontWeight:800,fontSize:16,padding:d?"8px 16px 12px":"0 12px 0 4px",borderBottom:d?`1px solid ${t.border}`:"none",borderRight:d?"none":`1px solid ${t.border}`,marginRight:d?0:8,marginBottom:d?4:0,flexShrink:0},children:r}),s.map(b)]})}V.Button=Ve,V.Calendar=pt,V.Chart=at,V.Colorpicker=ft,V.Combobox=be,V.ContextMenu=qe,V.DataView=kt,V.Form=Ct,V.Grid=lt,V.Layout=Ee,V.List=St,V.Menu=Xe,V.MenuDropdown=ce,V.MessageContext=ke,V.MessageProvider=bt,V.Navbar=Tt,V.Pagination=Mt,V.Popup=gt,V.Ribbon=Lt,V.Sidebar=Ze,V.Slider=ve,V.Tabbar=et,V.Timepicker=Ie,V.Toolbar=Ge,V.Tree=zt,V.Window=xt,V.tokens=t,V.useClickOutside=de,V.useDrag=Le,V.useMessage=vt,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
|
|
42
42
|
//# sourceMappingURL=dhx-react-suite.umd.cjs.map
|