dhx-react-suite 1.0.4 → 1.0.5

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.
@@ -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(n)}const R={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function ee({children:n,variant:c="primary",size:u="md",icon:l,disabled:x,onClick:h,style:f,className:r=""}){return g.useEffect(E,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${c} ${r}`,style:{...R[u],...f},disabled:x,onClick:h,children:[l&&e.jsx("span",{style:{fontSize:16},children:l}),n]})}function te({items:n=[],style:c}){g.useEffect(E,[]);const u=(l,x)=>{var f;if(l.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},x);if(l.type==="spacer")return e.jsx("div",{style:{flex:1}},x);if(l.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[l.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:l.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:l.width||140,height:28},placeholder:l.placeholder,defaultValue:l.value,onChange:r=>{var p;return(p=l.onChange)==null?void 0:p.call(l,r.target.value)}})]},x);if(l.type==="select")return e.jsx("select",{className:"dhx dhx-input",style:{width:l.width||100,height:28,cursor:"pointer"},defaultValue:l.value,onChange:r=>{var p;return(p=l.onChange)==null?void 0:p.call(l,r.target.value)},children:(f=l.options)==null?void 0:f.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))},x);const h=l.active;return e.jsxs("button",{className:`dhx dhx-btn ${h?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:32,gap:4,...l.twoState&&h?{background:t.primaryLt,color:t.primary,borderColor:`${t.primary}66`}:{}},disabled:l.disabled,onClick:()=>{var r;return(r=l.onClick)==null?void 0:r.call(l,l)},children:[l.icon&&e.jsx("span",{style:{fontSize:16},children:l.icon}),l.text&&e.jsx("span",{children:l.text})]},x)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...c},children:n.map(u)})}function re({items:n=[],width:c=240,collapsed:u,onSelect:l,header:x,footer:h,style:f}){const[r,p]=g.useState(u??!1),[y,i]=g.useState(null),[k,$]=g.useState({});g.useEffect(E,[]);const v=r?56:c,o=w=>{i(w.id),l==null||l(w)},S=(w,T=0)=>{var b;if(w.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},w.id);if(w.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:w.html||""}},w.id);const z=(((b=w.items)==null?void 0:b.length)??0)>0,m=k[w.id],d=y===w.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{z&&$(N=>({...N,[w.id]:!N[w.id]})),o(w)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${r?"0px":`${12+T*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:r?"center":"flex-start",transition:"all .15s",background:d?t.primaryLt:"transparent",color:d?t.primary:t.text,userSelect:"none"},onMouseEnter:N=>!d&&(N.currentTarget.style.background=t.bg),onMouseLeave:N=>!d&&(N.currentTarget.style.background="transparent"),children:[w.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:w.icon}),!r&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:d?600:400},children:w.value}),!r&&w.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:w.count}),!r&&z&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:m?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),z&&m&&!r&&w.items.map(N=>S(N,T+1))]},w.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",...f},children:[x&&!r&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:x}),e.jsx("button",{onClick:()=>p(w=>!w),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:r?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:r?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:n.map(w=>S(w))}),h&&!r&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:h})]})}function ne({config:n}){const[c,u]=g.useState(!1),l={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...n.width?{width:n.width,minWidth:n.width}:{flex:1},...n.height?{height:n.height,minHeight:n.height}:{minHeight:40},...c?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:l,children:[n.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:n.header}),n.collapsable&&e.jsx("button",{onClick:()=>u(x=>!x),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:c?"▼":"▲"})]}),!c&&e.jsxs("div",{style:{padding:n.padding||0,height:n.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[n.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:n.html}}):n.content,(n.rows||n.cols)&&e.jsx(_,{rows:n.rows,cols:n.cols,style:{height:"100%"}})]})]})}function _({rows:n,cols:c,type:u="line",style:l,children:x}){g.useEffect(E,[]);const h=u==="space"?12:u==="wide"?8:1,f=n||c,r=!!n;return f?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:r?"column":"row",gap:h,width:"100%",height:"100%",...l},children:f.map((p,y)=>e.jsx(ne,{config:p},p.id||y))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...l},children:x})}function oe({views:n=[],mode:c="top",tabAlign:u="left",closable:l=[],disabled:x=[],defaultActive:h,onBeforeChange:f,onChange:r,style:p}){var d;const[y,i]=g.useState(h||((d=n[0])==null?void 0:d.id)),[k,$]=g.useState(n.map(b=>b.id));g.useEffect(E,[]);const v=(b,N)=>{b.stopPropagation(),$(a=>a.filter(M=>M!==N)),y===N&&i(k.find(a=>a!==N)??"")},o=b=>{x.includes(b)||f&&f(b)===!1||(i(b),r==null||r(b))},S=c==="left"||c==="right",w=n.filter(b=>k.includes(b.id)),T=e.jsx("div",{style:{display:"flex",flexDirection:S?"column":"row",justifyContent:u==="center"?"center":u==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!S&&c!=="bottom"?`2px solid ${t.border}`:"none",borderTop:c==="bottom"?`2px solid ${t.border}`:"none",borderRight:c==="left"?`2px solid ${t.border}`:"none",borderLeft:c==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:w.map(b=>{const N=y===b.id,a=x.includes(b.id),M=c==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:S?{color:t.primary,fontWeight:600,background:t.primaryLt,[c==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>o(b.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:a?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:S?120:"auto",...N?M:{color:a?t.textMut:t.textSec}},children:[b.icon&&e.jsx("span",{style:{fontSize:16},children:b.icon}),e.jsx("span",{children:b.tab}),l.includes(b.id)&&e.jsx("span",{onClick:s=>v(s,b.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},b.id)})}),z=w.find(b=>b.id===y),m=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:c==="top"?"column":c==="bottom"?"column-reverse":c==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...p},children:[T,m]})}function se({columns:n,data:c=[],height:u=400,rowHeight:l=40,sortable:x=!0,resizable:h=!0,selection:f,multiselect:r,onSelect:p,style:y}){const[i,k]=g.useState(null),[$,v]=g.useState("asc"),[o,S]=g.useState({}),[w,T]=g.useState(new Set),[z,m]=g.useState(n.map(s=>s.width||s.minWidth||140));g.useEffect(E,[]);const d=g.useMemo(()=>{let s=c.filter(C=>Object.entries(o).every(([W,D])=>!D||String(C[W]??"").toLowerCase().includes(D.toLowerCase())));return i&&(s=[...s].sort((C,W)=>{const D=C[i],L=W[i];return D==null?1:L==null?-1:$==="asc"?D<L?-1:D>L?1:0:D>L?-1:D<L?1:0})),s},[c,i,$,o]),b=s=>{!x||s.sortable===!1||(v(C=>i===s.id&&C==="asc"?"desc":"asc"),k(s.id))},N=(s,C)=>{if(!f)return;const W=s.id??C;T(D=>{const L=r?new Set(D):new Set;return L.has(W)?L.delete(W):L.add(W),L}),p==null||p(s)},a=(s,C)=>{const W=s.clientX,D=z[C],L=Ce=>m(Te=>{const Z=[...Te];return Z[C]=Math.max(60,D+Ce.clientX-W),Z}),j=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",j)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",j),s.preventDefault()},M=n.some(s=>s.filterable!==!1);return e.jsx("div",{className:"dhx",style:{width:"100%",height:u,display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...y},children:e.jsx("div",{style:{overflowX:"auto",flex:1,display:"flex",flexDirection:"column"},children:e.jsxs("div",{style:{minWidth:z.reduce((s,C)=>s+C,0)+"px",display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:`1px solid ${t.border}`,position:"sticky",top:0,zIndex:2},children:n.map((s,C)=>{var W;return e.jsxs("div",{style:{width:z[C],minWidth:z[C],position:"relative",padding:"0 10px",height:40,display:"flex",alignItems:"center",fontSize:12,fontWeight:600,color:t.textSec,cursor:x&&s.sortable!==!1?"pointer":"default",userSelect:"none",gap:4},onClick:()=>b(s),children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(s.header)?(W=s.header[0])==null?void 0:W.text:s.header||s.id}),x&&s.sortable!==!1&&e.jsx("span",{style:{opacity:i===s.id?1:.25,fontSize:10},children:i===s.id?$==="asc"?"▲":"▼":"⇅"}),h&&C<n.length-1&&e.jsx("div",{onMouseDown:D=>a(D,C),style:{position:"absolute",right:0,top:4,bottom:4,width:4,cursor:"col-resize",background:"transparent"},onMouseEnter:D=>D.currentTarget.style.background=t.border,onMouseLeave:D=>D.currentTarget.style.background="transparent"})]},s.id)})}),M&&e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${t.border}`,background:t.surface},children:n.map((s,C)=>e.jsx("div",{style:{width:z[C],minWidth:z[C],padding:"4px 6px"},children:s.filterable!==!1&&e.jsx("input",{className:"dhx dhx-input",style:{height:24,fontSize:12},placeholder:"🔍",value:o[s.id]||"",onChange:W=>S(D=>({...D,[s.id]:W.target.value}))})},s.id))}),e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto"},children:[d.map((s,C)=>{const W=s.id??C,D=w.has(W);return e.jsx("div",{onClick:()=>N(s,C),style:{display:"flex",height:l,alignItems:"center",borderBottom:`1px solid ${t.border}`,cursor:f?"pointer":"default",background:D?t.primaryLt:C%2===0?t.surface:t.bg,transition:"background .1s"},onMouseEnter:L=>!D&&(L.currentTarget.style.background="#f0f8ff"),onMouseLeave:L=>!D&&(L.currentTarget.style.background=C%2===0?t.surface:t.bg),children:n.map((L,j)=>e.jsx("div",{style:{width:z[j],minWidth:z[j],padding:"0 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:L.align||"left"},children:L.template?L.template(s[L.id],s):String(s[L.id]??"")},L.id))},String(W))}),d.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut},children:"No data"})]})]})})})}const H=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function le({type:n="bar",data:c=[],series:u=[],scales:l={},legend:x,height:h=280,style:f}){var S,w,T,z,m;g.useEffect(E,[]);const r=((S=l.bottom)==null?void 0:S.text)||c[0]&&Object.keys(c[0])[0]||"x",p=e.jsx(A.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),y=x?e.jsx(A.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:x.valign,align:x.halign}):null,i=e.jsx(A.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),k=e.jsx(A.XAxis,{dataKey:r,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1}),$=e.jsx(A.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((w=l.left)==null?void 0:w.min)??"auto",((T=l.left)==null?void 0:T.max)??"auto"]}),v={data:c,margin:{top:10,right:20,left:0,bottom:0}};let o;if(n==="bar")o=e.jsxs(A.BarChart,{...v,children:[i,k,$,p,y,u.map((d,b)=>e.jsx(A.Bar,{dataKey:d.value||d.id,name:d.label||d.id,fill:d.fill||H[b%H.length],radius:[3,3,0,0]},d.id))]});else if(n==="line")o=e.jsxs(A.LineChart,{...v,children:[i,k,$,p,y,u.map((d,b)=>e.jsx(A.Line,{type:"monotone",dataKey:d.value||d.id,name:d.label||d.id,stroke:d.color||H[b%H.length],strokeWidth:2,dot:{r:3,fill:d.color||H[b%H.length]}},d.id))]});else if(n==="area")o=e.jsxs(A.AreaChart,{...v,children:[i,k,$,p,y,u.map((d,b)=>e.jsx(A.Area,{type:"monotone",dataKey:d.value||d.id,name:d.label||d.id,stroke:d.color||H[b%H.length],fill:(d.fill||H[b%H.length])+"33",strokeWidth:2},d.id))]});else if(n==="pie"||n==="donut"){const d=c[0]||{},b=Object.keys(d).find(a=>typeof d[a]=="number")||"value",N=Object.keys(d).find(a=>typeof d[a]=="string")||"x";o=e.jsxs(A.PieChart,{children:[e.jsx(A.Pie,{data:c,cx:"50%",cy:"50%",outerRadius:n==="donut"?"70%":"80%",innerRadius:n==="donut"?"40%":0,dataKey:b,nameKey:N,label:({name:a,percent:M})=>`${a??""} ${((M??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:c.map((a,M)=>e.jsx(A.Cell,{fill:H[M%H.length]},M))}),p,y]})}else n==="radar"?o=e.jsxs(A.RadarChart,{...v,cx:"50%",cy:"50%",children:[e.jsx(A.PolarGrid,{}),e.jsx(A.PolarAngleAxis,{dataKey:r,tick:{fontSize:11}}),u.map((d,b)=>e.jsx(A.Radar,{dataKey:d.value||d.id,name:d.label||d.id,stroke:d.color||H[b],fill:(d.fill||H[b])+"44"},d.id)),p,y]}):n==="scatter"&&(o=e.jsxs(A.ScatterChart,{...v,children:[i,e.jsx(A.XAxis,{dataKey:((z=u[0])==null?void 0:z.xValue)||"x",type:"number",tick:{fontSize:11,fill:t.textSec}}),e.jsx(A.YAxis,{dataKey:((m=u[0])==null?void 0:m.yValue)||"y",tick:{fontSize:11,fill:t.textSec}}),p,u.map((d,b)=>e.jsx(A.Scatter,{data:d.data||c,name:d.label||d.id,fill:d.color||H[b]},d.id))]}));return e.jsx("div",{className:"dhx",style:{width:"100%",height:h,padding:12,background:t.surface,borderRadius:t.rMd,...f},children:e.jsx(A.ResponsiveContainer,{width:"100%",height:"100%",children:o})})}const ae=["January","February","March","April","May","June","July","August","September","October","November","December"],de=["Su","Mo","Tu","We","Th","Fr","Sa"];function ie({value:n,range:c=!1,timepicker:u=!1,onChange:l,style:x}){const h=new Date,f=n?new Date(Array.isArray(n)?n[0]:n):h,[r,p]=g.useState(f),[y,i]=g.useState(n??(c?[null,null]:null)),[k,$]=g.useState(null),[v,o]=g.useState({h:0,m:0});g.useEffect(E,[]);const S=r.getFullYear(),w=r.getMonth(),T=new Date(S,w,1).getDay(),z=new Date(S,w+1,0).getDate(),m=[];for(let a=0;a<T;a++)m.push(null);for(let a=1;a<=z;a++)m.push(new Date(S,w,a));const d=a=>a.toDateString()===h.toDateString(),b=a=>{if(!y)return!1;if(c&&Array.isArray(y)){const[M,s]=y;if(!M)return!1;const C=a.getTime();return s?C>=M.getTime()&&C<=s.getTime():a.toDateString()===M.toDateString()}return a.toDateString()===y.toDateString()},N=a=>{if(c){const[M,s]=Array.isArray(y)?y:[null,null];if(!M||s)i([a,null]);else{const C=a<M?[a,M]:[M,a];i(C),l==null||l(C)}}else i(a),l==null||l(a)};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,...x},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>p(a=>new Date(a.getFullYear(),a.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:[ae[w]," ",S]}),e.jsx("button",{onClick:()=>p(a=>new Date(a.getFullYear(),a.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:[de.map(a=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:a},a)),m.map((a,M)=>{const s=a?b(a):!1,C=a&&k&&a.toDateString()===k.toDateString();return e.jsx("div",{onClick:()=>a&&N(a),onMouseEnter:()=>a&&$(a),onMouseLeave:()=>$(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:a?"pointer":"default",fontSize:12,fontWeight:a&&d(a)?700:400,background:s?t.primary:C?t.bg:"transparent",color:s?"#fff":a&&d(a)?t.primary:a?t.text:"transparent",border:a&&d(a)&&!s?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:a==null?void 0:a.getDate()},M)})]}),u&&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:a=>o(M=>({...M,h:+a.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:a=>o(M=>({...M,m:+a.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function V({value:n,onChange:c,timeFormat:u=12,controls:l=!1,minuteStep:x=5,style:h}){const[f,r]=g.useState((n==null?void 0:n.h)??(u===24?0:12)),[p,y]=g.useState((n==null?void 0:n.m)??0),[i,k]=g.useState((n==null?void 0:n.ampm)??"AM"),[$,v]=g.useState(null);g.useEffect(E,[]);const o=u===24?Array.from({length:24},(d,b)=>b):Array.from({length:12},(d,b)=>b+1),S=Array.from({length:Math.ceil(60/x)},(d,b)=>b*x),w=(d,b,N)=>{const a=u===24?{h:d,m:b}:{h:d,m:b,ampm:N};l?v(a):c==null||c(a)},T=()=>{v(null),r((n==null?void 0:n.h)??(u===24?0:12)),y((n==null?void 0:n.m)??0),k((n==null?void 0:n.ampm)??"AM")},z={display:"flex",flexDirection:"column",alignItems:"center",gap:4},m=d=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:d?700:400,background:d?t.primaryLt:"transparent",color:d?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,...h},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:o.map(d=>e.jsx("div",{onClick:()=>{r(d),w(d,p,i)},style:m(f===d),onMouseEnter:b=>f!==d&&(b.currentTarget.style.background=t.bg),onMouseLeave:b=>f!==d&&(b.currentTarget.style.background="transparent"),children:String(d).padStart(2,"0")},d))})]}),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:S.map(d=>e.jsx("div",{onClick:()=>{y(d),w(f,d,i)},style:m(p===d),onMouseEnter:b=>p!==d&&(b.currentTarget.style.background=t.bg),onMouseLeave:b=>p!==d&&(b.currentTarget.style.background="transparent"),children:String(d).padStart(2,"0")},d))})]}),u===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(d=>e.jsx("div",{onClick:()=>{k(d),w(f,p,d)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:i===d?700:400,background:i===d?t.primary:t.surface,color:i===d?"#fff":t.text},children:d},d))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(f).padStart(2,"0"),":",String(p).padStart(2,"0"),u===12?` ${i}`:""]}),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:T,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>$&&(c==null?void 0:c($)),children:"Apply"})]})]})}function B(n,c){g.useEffect(()=>{const u=l=>{n.current&&!n.current.contains(l.target)&&c(l)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n,c])}function q(n){const c=g.useRef(!1),u=g.useRef({x:0,y:0,ox:0,oy:0});return g.useCallback((l,x=0,h=0)=>{c.current=!0,u.current={x:l.clientX,y:l.clientY,ox:x,oy:h};const f=p=>{if(!c.current)return;const{x:y,y:i,ox:k,oy:$}=u.current;n(k+p.clientX-y,$+p.clientY-i)},r=()=>{c.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",r),l.preventDefault()},[n])}const ce=({open:n})=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{flexShrink:0,transition:"transform .15s",transform:n?"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 O({data:n=[],value:c,placeholder:u="Select or type...",multiselection:l=!1,label:x,onChange:h,style:f}){var N;const[r,p]=g.useState(!1),[y,i]=g.useState(""),[k,$]=g.useState(l?c?[].concat(c):[]:c||null),v=g.useRef(null),o=g.useRef(null);g.useEffect(E,[]),B(v,g.useCallback(()=>{p(!1),i("")},[]));const S=g.useMemo(()=>n.filter(a=>!y||a.value.toLowerCase().includes(y.toLowerCase())),[n,y]),w=a=>l?(k||[]).includes(a):k===a,T=a=>{const M=a.id||a.value;if(l){const s=w(M)?k.filter(C=>C!==M):[...k||[],M];$(s),h==null||h(s)}else $(M),i(""),p(!1),h==null||h(M)},z=a=>{const M=k.filter(s=>s!==a);$(M),h==null||h(M)},m=()=>{p(!0),setTimeout(()=>{var a;return(a=o.current)==null?void 0:a.focus()},0)},d=((N=n.find(a=>(a.id||a.value)===k))==null?void 0:N.value)||"",b=l?k||[]:[];return e.jsxs("div",{ref:v,className:"dhx",style:{position:"relative",...f},children:[x&&e.jsx("label",{className:"dhx dhx-label",children:x}),e.jsxs("div",{onClick:m,style:{display:"flex",alignItems:"center",flexWrap:l?"wrap":"nowrap",border:`1px solid ${r?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:r?`0 0 0 3px ${t.primary}22`:"none"},children:[l&&e.jsxs(e.Fragment,{children:[b.map(a=>{var M;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,background:t.primaryLt,color:t.primary,borderRadius:3,padding:"2px 6px",fontSize:12,lineHeight:1.4},children:[((M=n.find(s=>(s.id||s.value)===a))==null?void 0:M.value)||a,e.jsx("span",{onClick:s=>{s.stopPropagation(),z(a)},style:{cursor:"pointer",fontSize:14,lineHeight:1,opacity:.7},children:"×"})]},a)}),e.jsx("input",{ref:o,value:y,onChange:a=>{i(a.target.value),p(!0)},onFocus:()=>p(!0),onClick:a=>a.stopPropagation(),placeholder:b.length?"":u,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!l&&e.jsx("input",{ref:o,value:r?y:d,onChange:a=>{i(a.target.value),p(!0)},onFocus:()=>{p(!0),i("")},onClick:a=>a.stopPropagation(),placeholder:u,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(ce,{open:r})]}),r&&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:[S.map(a=>{const M=a.id||a.value,s=w(M);return e.jsxs("div",{onClick:()=>T(a),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:s?t.primaryLt:"transparent",color:s?t.primary:t.text},onMouseEnter:C=>!s&&(C.currentTarget.style.background=t.bg),onMouseLeave:C=>!s&&(C.currentTarget.style.background="transparent"),children:[l&&e.jsx("span",{style:{width:14,height:14,flexShrink:0,border:`2px solid ${s?t.primary:t.borderDk}`,borderRadius:3,display:"flex",alignItems:"center",justifyContent:"center",background:s?t.primary:"transparent"},children:s&&e.jsx("span",{style:{color:"#fff",fontSize:9,lineHeight:1},children:"✓"})}),e.jsx("span",{style:{flex:1},children:a.value}),!l&&s&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),a.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",a.count,")"]})]},M)}),S.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function Y({min:n=0,max:c=100,step:u=1,value:l,range:x=!1,label:h,tick:f,disabled:r=!1,onChange:p,style:y}){const[i,k]=g.useState(l??(x?[n,c]:n));g.useEffect(E,[]);const $=(T,z)=>{if(!r)if(x){const m=[...i];m[T]=z,k(m),p==null||p(m)}else k(z),p==null||p(z)},v=T=>(T-n)/(c-n)*100,o=x?i:[i],S=x?{left:`${v(o[0])}%`,width:`${v(o[1])-v(o[0])}%`}:{left:0,width:`${v(o[0])}%`},w=r?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:r?.5:1,...y},children:[h&&e.jsx("label",{className:"dhx dhx-label",children:h}),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",...S,height:"100%",background:w,borderRadius:2}}),o.map((T,z)=>e.jsx("input",{type:"range",min:n,max:c,step:u,value:T,disabled:r,onChange:m=>{const d=+m.target.value;x&&z===0&&d>=i[1]||x&&z===1&&d<=i[0]||$(z,d)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:r?"not-allowed":"pointer",top:0,left:0,margin:0}},z)),o.map((T,z)=>e.jsx("div",{style:{position:"absolute",left:`${v(T)}%`,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:r?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:T})},z))]})}),f&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[n,Math.round((c+n)/2),c].map(T=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:T},T))})]})}const pe=["#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 K(n){const c=parseInt(n.slice(1,3),16)/255,u=parseInt(n.slice(3,5),16)/255,l=parseInt(n.slice(5,7),16)/255,x=Math.max(c,u,l),h=Math.min(c,u,l);let f=0,r=0;const p=(x+h)/2;if(x!==h){const y=x-h;r=p>.5?y/(2-x-h):y/(x+h),f=x===c?((u-l)/y+(u<l?6:0))/6:x===u?((l-c)/y+2)/6:((c-u)/y+4)/6}return[Math.round(f*360),Math.round(r*100),Math.round(p*100)]}function G(n,c,u){c/=100,u/=100;const l=c*Math.min(u,1-u),x=h=>{const f=(h+n/30)%12,r=u-l*Math.max(Math.min(f-3,9-f,1),-1);return Math.round(255*r).toString(16).padStart(2,"0")};return"#"+x(0)+x(8)+x(4)}function he({value:n="#0288d1",onChange:c,style:u}){const[l,x]=g.useState(()=>K(n)),h=G(...l);g.useEffect(E,[]);const f=r=>{x(r),c==null||c(G(...r))};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,...u},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(([r,p,y,i],k)=>e.jsxs("div",{style:{marginBottom:k<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[r,k>0?` (${i}%)`:""]}),e.jsx("input",{type:"range",min:p,max:y,value:i,onChange:$=>{const v=[...l];v[k]=+$.target.value,f(v)},style:{width:"100%",accentColor:t.primary}})]},r)),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:h,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:h,onChange:r=>{try{f(K(r.target.value)),c==null||c(r.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:pe.map(r=>e.jsx("div",{onClick:()=>{x(K(r)),c==null||c(r)},style:{width:14,height:14,borderRadius:2,background:r,cursor:"pointer",border:h===r?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:p=>p.currentTarget.style.transform="scale(1.3)",onMouseLeave:p=>p.currentTarget.style.transform="scale(1)"},r))})]})}function P({items:n,onSelect:c,style:u}){const[l,x]=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",...u},children:n.map((h,f)=>{var p,y;if(h.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},f);const r=l===f;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>x(f),onMouseLeave:()=>x(null),children:[e.jsxs("div",{onClick:()=>{var i;return!h.disabled&&!((i=h.items)!=null&&i.length)&&c(h)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:h.disabled?"not-allowed":"pointer",fontSize:13,color:h.disabled?t.textMut:t.text,background:r&&!h.disabled?t.bg:"transparent",opacity:h.disabled?.5:1},children:[h.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:h.icon}),e.jsx("span",{style:{flex:1},children:h.value||h.id}),h.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:h.hotkey}),(p=h.items)!=null&&p.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),r&&((y=h.items)!=null&&y.length)?e.jsx(P,{items:h.items,onSelect:c,style:{position:"absolute",left:"100%",top:-4}}):null]},h.id||f)})})}function ue({items:n=[],label:c="Menu",onSelect:u,style:l}){const[x,h]=g.useState(!1),f=g.useRef(null);return g.useEffect(E,[]),B(f,g.useCallback(()=>h(!1),[])),e.jsxs("div",{ref:f,className:"dhx",style:{position:"relative",display:"inline-block",...l},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>h(r=>!r),children:[c," ",e.jsx("span",{style:{fontSize:10},children:x?"▲":"▼"})]}),x&&e.jsx(P,{items:n,onSelect:r=>{u==null||u(r),h(!1)}})]})}function fe({items:n=[],onSelect:c,children:u}){const[l,x]=g.useState(null),h=g.useRef(null);g.useEffect(E,[]),B(h,g.useCallback(()=>x(null),[]));const f=r=>{r.preventDefault(),x({x:r.clientX,y:r.clientY})};return e.jsxs("div",{ref:h,onContextMenu:f,style:{position:"relative",display:"contents"},children:[u,l&&e.jsx("div",{style:{position:"fixed",left:l.x,top:l.y,zIndex:9999},children:e.jsx(P,{items:n,onSelect:r=>{c==null||c(r),x(null)}})})]})}function xe({trigger:n,children:c,placement:u="bottom-start",style:l}){const[x,h]=g.useState(!1),[f,r]=g.useState({top:"100%",left:0}),p=g.useRef(null),y=g.useRef(null);g.useEffect(E,[]),B(p,g.useCallback(()=>h(!1),[]));const i=()=>{h(k=>{if(!k&&y.current){const $=y.current.getBoundingClientRect(),v={"bottom-start":{top:$.height+4,left:0},"bottom-end":{top:$.height+4,right:0,left:"auto"},"top-start":{bottom:$.height+4,top:"auto",left:0}};r(v[u]||v["bottom-start"])}return!k})};return e.jsxs("div",{ref:p,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:y,onClick:i,children:n}),x&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...f,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...l},children:c})]})}function ge({title:n,children:c,width:u=480,height:l,closable:x=!0,movable:h=!0,modal:f=!1,defaultOpen:r=!0,footer:p,onClose:y,style:i}){const[k,$]=g.useState(r),[v,o]=g.useState({x:0,y:0});g.useEffect(E,[]);const S=q(g.useCallback((T,z)=>h&&o({x:T,y:z}),[h])),w=()=>{$(!1),y==null||y()};return k?e.jsxs(e.Fragment,{children:[f&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:x?w:void 0}),e.jsxs("div",{className:"dhx",style:{position:f?"fixed":"absolute",left:f?"50%":`calc(50% + ${v.x}px)`,top:f?"50%":`calc(50% + ${v.y}px)`,transform:`translate(calc(-50% + ${v.x}px), calc(-50% + ${v.y}px))`,width:u,...l?{height:l}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...i},children:[e.jsxs("div",{onMouseDown:T=>S(T,v.x,v.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:h?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:n}),x&&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:T=>T.currentTarget.style.background=t.border,onMouseLeave:T=>T.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:c}),p&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:p})]})]}):null}const F=g.createContext(null),ye={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},J={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function be({children:n}){const[c,u]=g.useState([]);g.useEffect(E,[]);const l=g.useCallback(f=>u(r=>r.filter(p=>p.id!==f)),[]),x=g.useCallback(f=>{const r=Date.now();return u(p=>[...p,{id:r,...f}]),f.duration!==0&&setTimeout(()=>l(r),f.duration||4e3),r},[l]),h={message:x,alert:(f,r)=>x({type:"info",title:f,...r}),confirm:(f,r,p)=>x({type:"warning",title:f,confirm:r,...p})};return e.jsxs(F.Provider,{value:h,children:[n,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:c.map(f=>{const r=f.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${J[r]}`,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:J[r],lineHeight:1},children:ye[r]}),e.jsxs("div",{style:{flex:1},children:[f.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:f.text?3:0},children:f.title}),f.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:f.text}),f.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:()=>{f.confirm(!0),l(f.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{f.confirm(!1),l(f.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>l(f.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},f.id)})})]})}function ve(){const n=g.useContext(F);if(!n)throw new Error("useMessage must be used inside <MessageProvider>");return n}function Se({data:n=[],template:c,keyNavigation:u=!0,multiselection:l=!1,editable:x=!1,height:h=400,onSelect:f,onEdit:r,style:p}){const[y,i]=g.useState(new Set),[k,$]=g.useState(null),[v,o]=g.useState(""),[S,w]=g.useState(null);g.useEffect(E,[]);const T=(m,d)=>{const b=m.id??d;i(N=>{const a=l?new Set(N):new Set;return a.has(b)?a.delete(b):a.add(b),a}),w(d),f==null||f(m)},z=(m,d)=>{r==null||r({...m,value:v},d),$(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:h,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...p},tabIndex:0,onKeyDown:m=>{u&&(m.key==="ArrowDown"&&w(d=>Math.min((d??-1)+1,n.length-1)),m.key==="ArrowUp"&&w(d=>Math.max((d??1)-1,0)))},children:[n.map((m,d)=>{const b=m.id??d,N=y.has(b),a=S===d;return e.jsx("div",{onClick:()=>T(m,d),onDoubleClick:()=>x&&($(d),o(String(m.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:N?t.primaryLt:a?t.bg:t.surface,color:N?t.primary:t.text,outline:a?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:k===d?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:v,onChange:M=>o(M.target.value),onBlur:()=>z(m,d),onKeyDown:M=>{M.key==="Enter"&&z(m,d),M.key==="Escape"&&$(null)},onClick:M=>M.stopPropagation()}):c?e.jsx("div",{dangerouslySetInnerHTML:{__html:c(m)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(m.value??"")})},String(b))}),n.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function ke({data:n=[],template:c,itemsInRow:u=3,gap:l=12,multiselection:x=!1,onSelect:h,style:f}){const[r,p]=g.useState(new Set);g.useEffect(E,[]);const y=i=>{const k=i.id??String(i.title);p($=>{const v=x?new Set($):new Set;return v.has(k)?v.delete(k):v.add(k),v}),h==null||h(i)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,gap:l,padding:l,...f},children:n.map((i,k)=>{const $=i.id??k,v=r.has($);return e.jsx("div",{onClick:()=>y(i),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:o=>{o.currentTarget.style.boxShadow=t.shadowLg,o.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:o=>{o.currentTarget.style.boxShadow=v?`0 0 0 3px ${t.primary}33`:t.shadow,o.currentTarget.style.transform=v?"translateY(-2px)":"none"},children:c?e.jsx("div",{dangerouslySetInnerHTML:{__html:c(i)}}):e.jsxs("div",{style:{padding:16},children:[i.img&&e.jsx("img",{src:i.img,alt:i.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:i.title||i.value}),i.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:i.subtitle})]})},String($))})})}function we({data:n=[],checkbox:c=!1,editable:u=!1,onSelect:l,onCheck:x,style:h}){const[f,r]=g.useState({}),[p,y]=g.useState(null),[i,k]=g.useState({}),[$,v]=g.useState(null),[o,S]=g.useState("");g.useEffect(E,[]);const w=m=>r(d=>({...d,[m]:!d[m]})),T=(m,d)=>{k(b=>({...b,[m]:d})),x==null||x(m,d)},z=(m,d=0)=>{var M;const b=(((M=m.items)==null?void 0:M.length)??0)>0,N=f[m.id],a=p===m.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{y(m.id),l==null||l(m),b&&w(m.id)},onDoubleClick:()=>{u&&(v(m.id),S(m.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+d*18}px`,cursor:"pointer",borderRadius:t.r,margin:"1px 4px",background:a?t.primaryLt:"transparent",color:a?t.primary:t.text,userSelect:"none",fontSize:13},onMouseEnter:s=>!a&&(s.currentTarget.style.background=t.bg),onMouseLeave:s=>!a&&(s.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},children:b?N?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:b?N?"📂":"📁":"📄"}),c&&e.jsx("input",{type:"checkbox",checked:!!i[m.id],onChange:s=>{s.stopPropagation(),T(m.id,s.target.checked)},style:{cursor:"pointer",accentColor:t.primary},onClick:s=>s.stopPropagation()}),$===m.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:o,onChange:s=>S(s.target.value),onBlur:()=>v(null),onKeyDown:s=>s.key==="Enter"&&v(null),onClick:s=>s.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,")"]})]}),b&&N&&e.jsx("div",{children:m.items.map(s=>z(s,d+1))})]},m.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...h},children:n.map(m=>z(m))})}function me({total:n,pageSize:c=10,page:u,onChange:l,style:x}){const[h,f]=g.useState(u||1),r=Math.ceil(n/c);g.useEffect(E,[]);const p=i=>{const k=Math.min(Math.max(1,i),r);f(k),l==null||l(k)},y=g.useMemo(()=>{const i=[];for(let $=Math.max(1,h-2);$<=Math.min(r,h+2);$++)i.push($);return i[0]>1&&(i[0]>2&&i.unshift("..."),i.unshift(1)),i[i.length-1]<r&&(i[i.length-1]<r-1&&i.push("..."),i.push(r)),i},[h,r]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...x},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(h-1)*c+1,"–",Math.min(h*c,n)," of ",n]}),[["«",1],["‹",h-1]].map(([i,k])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:h===1,onClick:()=>p(k),children:i},i)),y.map((i,k)=>e.jsx("button",{onClick:()=>typeof i=="number"&&p(i),className:`dhx dhx-btn ${i===h?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:i==="...",children:i},k)),[["›",h+1],["»",r]].map(([i,k])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:h===r,onClick:()=>p(k),children:i},i))]})}function Me({config:n={},defaultValues:c={},onSubmit:u,style:l}){const[x,h]=g.useState(c),[f,r]=g.useState({}),[p,y]=g.useState(null);g.useEffect(E,[]);const i=(o,S)=>{h(w=>({...w,[o]:S})),r(w=>({...w,[o]:null}))},k=()=>{const o={};return(n.rows||[]).flat().forEach(S=>{S&&typeof S=="object"&&"name"in S&&S.required&&!x[S.name]&&(o[S.name]=`${S.label||S.name} is required`)}),r(o),Object.keys(o).length===0},$=o=>{const S=x[o.name]??o.value??"",w=f[o.name],T=o.labelWidth??n.labelWidth,z=T!==void 0||o.labelPosition==="left";if(o.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:o.label}),(o.rows||[]).map(s=>$(s))]},o.name);if(o.type==="spacer")return e.jsx("div",{style:{height:o.height||16}},o.name);const m=T?{minWidth:T,width:T,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},d=o.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...m},children:[o.label,o.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,b=w?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:w}):null,N=o.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",o.helpMessage]}):null,a={key:o.name,className:"dhx-form-group"},M=s=>z?e.jsxs("div",{...a,style:{display:"flex",alignItems:"flex-start",gap:8},children:[d,e.jsxs("div",{style:{flex:1,minWidth:0},children:[s,b,N]})]}):e.jsxs("div",{...a,children:[d,s,b,N]});if(!o.type||o.type==="input")return M(e.jsxs("div",{className:"dhx-input-wrap",children:[o.icon&&e.jsx("span",{className:"dhx-input-icon",children:o.icon}),e.jsx("input",{className:`dhx dhx-input${o.icon?" dhx-input--with-icon":""}`,style:{borderColor:w?t.danger:void 0},type:o.inputType||"text",placeholder:o.placeholder,value:S,onChange:s=>i(o.name,s.target.value),disabled:o.disabled})]}));if(o.type==="textarea")return M(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:o.placeholder,value:S,onChange:s=>i(o.name,s.target.value)}));if(o.type==="select")return M(e.jsxs("select",{className:"dhx dhx-input",value:S,onChange:s=>i(o.name,s.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(o.options||[]).map(s=>e.jsx("option",{value:s.value,children:s.label||s.value},s.value))]}));if(o.type==="datepicker")return M(e.jsx("input",{type:"date",className:"dhx dhx-input",value:S,onChange:s=>i(o.name,s.target.value)}));if(o.type==="timepicker"){const s=x[o.name]??{h:12,m:0,ampm:"AM"},C=!!x[o.name],W=C?`${String(s.h).padStart(2,"0")}:${String(s.m).padStart(2,"0")}${s.ampm?" "+s.ampm:""}`:o.placeholder||"Click to select",D=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:()=>y(p===o.name?null:o.name),children:[e.jsx("span",{style:{color:C?t.text:t.textMut},children:W}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),p===o.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx(V,{value:s,controls:!0,onChange:L=>{i(o.name,L),y(null)}})})]});return M(D)}if(o.type==="colorpicker")return M(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:S||"#000000",onChange:s=>i(o.name,s.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:S||"#000000"})]}));if(o.type==="text")return M(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:o.value}));if(o.type==="checkbox")return e.jsxs("div",{...a,children:[z?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[T&&e.jsx("div",{style:{width:T,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!S,onChange:s=>i(o.name,s.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]})]}):e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!S,onChange:s=>i(o.name,s.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]}),N]});if(o.type==="radio"){const s=(o.options||[]).map(C=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:o.name,value:C.value,checked:S===C.value,onChange:()=>i(o.name,C.value),style:{accentColor:t.primary,cursor:"pointer"}}),C.label||C.value]},C.value));return M(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:s}))}if(o.type==="slider")return z?e.jsxs("div",{...a,style:{display:"flex",alignItems:"flex-start",gap:8},children:[d,e.jsxs("div",{style:{flex:1},children:[e.jsx(Y,{min:o.min,max:o.max,step:o.step,value:S||o.min,range:o.range,onChange:s=>i(o.name,s)}),N]})]}):e.jsxs("div",{...a,children:[e.jsx(Y,{label:o.label,min:o.min,max:o.max,step:o.step,value:S||o.min,range:o.range,onChange:s=>i(o.name,s)}),N]});if(o.type==="combo")return z?e.jsxs("div",{...a,style:{display:"flex",alignItems:"flex-start",gap:8},children:[d,e.jsxs("div",{style:{flex:1},children:[e.jsx(O,{data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:S||(o.multiselection?[]:null),onChange:s=>i(o.name,s)}),b,N]})]}):e.jsxs("div",{...a,children:[e.jsx(O,{label:o.label,data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:S||(o.multiselection?[]:null),onChange:s=>i(o.name,s)}),b,N]});if(o.type==="toggle"){const s=!!S,C=s?o.icon:o.offIcon||o.icon,W=s?o.text||o.label:o.offText||o.text||o.label;return e.jsxs("div",{...a,children:[z&&T&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:T,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(U,{on:s,onClick:()=>i(o.name,!S)}),C&&e.jsx("span",{style:{fontSize:16},children:C}),W&&e.jsx("span",{style:{fontSize:13},children:W})]})]}),!z&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(U,{on:s,onClick:()=>i(o.name,!S)}),C&&e.jsx("span",{style:{fontSize:16},children:C}),W&&e.jsx("span",{style:{fontSize:13},children:W})]}),N]})}return null},v=o=>o.map((S,w)=>Array.isArray(S)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:S.map($)},w):$(S));return e.jsxs("div",{className:"dhx",style:{padding:n.padding||0,width:n.width||"100%",...l},children:[v(n.rows||[]),(n.buttons||u)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:n.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>k()&&(u==null?void 0:u(x)),children:n.submitText||"Submit"}),n.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{h(c),r({})},children:n.resetText||"Reset"})]})]})}function U({on:n,onClick:c}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:c,children:[e.jsx("div",{style:{width:40,height:22,borderRadius:11,background:n?t.primary:t.border,transition:"background 0.2s"}}),e.jsx("div",{style:{position:"absolute",top:3,left:n?21:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,.3)"}})]})}function Q(n){const c=[];for(const u of n)"type"in u&&u.type==="block"?c.push(...u.items||[]):c.push(u);return c}function $e({items:n=[],onAction:c,style:u}){g.useEffect(E,[]);const[l,x]=g.useState(()=>{const r={};for(const p of Q(n))p.id&&(r[p.id]=!!p.active);return r}),h=r=>{var p;if(r.id)if(r.group){const y=Q(n).filter(i=>i.group===r.group&&i.id);x(i=>{const k={...i};for(const $ of y)k[$.id]=!1;return k[r.id]=!0,k})}else r.twoState&&x(y=>({...y,[r.id]:!y[r.id]}));(p=r.onClick)==null||p.call(r,r),r.id&&(c==null||c(r.id,r))},f=(r,p)=>{var k,$;if("type"in r&&(r.type==="separator"||r.type==="sep"))return e.jsx("div",{style:{width:1,background:t.border,margin:"8px 4px",alignSelf:"stretch"}},p);if("type"in r&&r.type==="input"){const v=r;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"4px 6px",gap:4},children:[v.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:v.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:v.width||110,height:26,fontSize:12},placeholder:v.placeholder,defaultValue:v.value,onChange:o=>{var S;return(S=v.onChange)==null?void 0:S.call(v,o.target.value)}})]},p)}if("type"in r&&r.type==="block"){const v=r;return e.jsxs("div",{style:{display:"flex",flexDirection:v.direction==="col"?"column":"row",alignItems:"center",gap:4,padding:"4px 8px",borderRight:`1px solid ${t.border}`,minHeight:64},children:[e.jsx("div",{style:{display:"flex",gap:2},children:(k=v.items)==null?void 0:k.map((o,S)=>f(o,S))}),v.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut,marginTop:2},children:v.label})]},p)}if("type"in r&&r.type==="selectButton"){const v=r;return e.jsx("select",{className:"dhx dhx-input",style:{height:28,fontSize:12,cursor:"pointer",margin:2},defaultValue:v.value,onChange:o=>{var S;return(S=v.onChange)==null?void 0:S.call(v,o.target.value)},children:($=v.items)==null?void 0:$.map(o=>e.jsx("option",{value:o.value,children:o.value},o.value))},p)}const y=r,i=y.id!==void 0?l[y.id]??!!y.active:!!y.active;return e.jsxs("button",{title:y.tooltip,className:`dhx dhx-btn ${i?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{flexDirection:"column",minHeight:48,padding:"4px 8px",gap:4,fontSize:12},disabled:y.disabled,onClick:()=>h(y),children:[y.icon&&e.jsx("span",{style:{fontSize:y.size==="large"?24:18},children:y.icon}),y.text&&e.jsx("span",{style:{fontSize:10,maxWidth:60,textAlign:"center",lineHeight:1.2,whiteSpace:"normal"},children:y.text})]},p)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.bg,borderBottom:`1px solid ${t.border}`,padding:"4px 0",overflowX:"auto",gap:0,...u},children:n.map(f)})}function ze({logo:n,items:c=[],vertical:u=!1,style:l}){const[x,h]=g.useState(null),f=g.useRef(null);g.useEffect(E,[]),B(f,g.useCallback(()=>h(null),[]));const r=(p,y)=>{var i;return p.type==="separator"?e.jsx("div",{style:{[u?"height":"width"]:1,background:t.border,margin:u?"4px 8px":"0 6px",alignSelf:"stretch"}},y):p.type==="spacer"?e.jsx("div",{style:{flex:1}},y):p.type==="input"?e.jsx("input",{className:"dhx dhx-input",style:{width:p.width||200,height:28,margin:"0 4px"},placeholder:p.placeholder},y):p.type==="menuItem"&&((i=p.items)!=null&&i.length)?e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:36,color:t.text},onClick:()=>h(x===y?null:y),children:[p.icon&&e.jsx("span",{children:p.icon}),p.value," ",e.jsx("span",{style:{fontSize:9},children:"▼"})]}),x===y&&e.jsx(P,{items:p.items,onSelect:()=>h(null),style:{top:"100%"}})]},y):e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:36,gap:6,color:t.text},onClick:()=>{var k;return(k=p.onClick)==null?void 0:k.call(p)},children:[p.icon&&e.jsx("span",{style:{fontSize:16},children:p.icon}),p.value&&e.jsx("span",{style:{fontSize:13},children:p.value})]},y)};return e.jsxs("nav",{ref:f,className:"dhx",style:{display:"flex",flexDirection:u?"column":"row",alignItems:u?"stretch":"center",background:t.surface,borderBottom:u?"none":`1px solid ${t.border}`,borderRight:u?`1px solid ${t.border}`:"none",padding:u?"12px 0":"0 12px",minHeight:u?void 0:48,gap:2,...l},children:[n&&e.jsx("div",{style:{color:t.text,fontWeight:800,fontSize:16,padding:u?"8px 16px":"0 12px 0 4px",borderRight:u?"none":`1px solid ${t.border}`,marginRight:u?0:8},children:n}),c.map(r)]})}I.Button=ee,I.Calendar=ie,I.Chart=le,I.Colorpicker=he,I.Combobox=O,I.ContextMenu=fe,I.DataView=ke,I.Form=Me,I.Grid=se,I.Layout=_,I.List=Se,I.Menu=ue,I.MenuDropdown=P,I.MessageContext=F,I.MessageProvider=be,I.Navbar=ze,I.Pagination=me,I.Popup=xe,I.Ribbon=$e,I.Sidebar=re,I.Slider=Y,I.Tabbar=oe,I.Timepicker=V,I.Toolbar=te,I.Tree=we,I.Window=ge,I.tokens=t,I.useClickOutside=B,I.useDrag=q,I.useMessage=ve,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
41
+ `,document.head.appendChild(n)}const R={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function ee({children:n,variant:c="primary",size:u="md",icon:l,disabled:x,onClick:h,style:f,className:r=""}){return g.useEffect(E,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${c} ${r}`,style:{...R[u],...f},disabled:x,onClick:h,children:[l&&e.jsx("span",{style:{fontSize:16},children:l}),n]})}function te({items:n=[],style:c}){g.useEffect(E,[]);const u=(l,x)=>{var f;if(l.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},x);if(l.type==="spacer")return e.jsx("div",{style:{flex:1}},x);if(l.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[l.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:l.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:l.width||140,height:28},placeholder:l.placeholder,defaultValue:l.value,onChange:r=>{var p;return(p=l.onChange)==null?void 0:p.call(l,r.target.value)}})]},x);if(l.type==="select")return e.jsx("select",{className:"dhx dhx-input",style:{width:l.width||100,height:28,cursor:"pointer"},defaultValue:l.value,onChange:r=>{var p;return(p=l.onChange)==null?void 0:p.call(l,r.target.value)},children:(f=l.options)==null?void 0:f.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))},x);const h=l.active;return e.jsxs("button",{className:`dhx dhx-btn ${h?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:32,gap:4,...l.twoState&&h?{background:t.primaryLt,color:t.primary,borderColor:`${t.primary}66`}:{}},disabled:l.disabled,onClick:()=>{var r;return(r=l.onClick)==null?void 0:r.call(l,l)},children:[l.icon&&e.jsx("span",{style:{fontSize:16},children:l.icon}),l.text&&e.jsx("span",{children:l.text})]},x)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...c},children:n.map(u)})}function re({items:n=[],width:c=240,collapsed:u,onSelect:l,header:x,footer:h,style:f}){const[r,p]=g.useState(u??!1),[y,i]=g.useState(null),[k,$]=g.useState({});g.useEffect(E,[]);const v=r?56:c,o=w=>{i(w.id),l==null||l(w)},S=(w,T=0)=>{var b;if(w.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},w.id);if(w.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:w.html||""}},w.id);const z=(((b=w.items)==null?void 0:b.length)??0)>0,m=k[w.id],d=y===w.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{z&&$(N=>({...N,[w.id]:!N[w.id]})),o(w)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${r?"0px":`${12+T*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:r?"center":"flex-start",transition:"all .15s",background:d?t.primaryLt:"transparent",color:d?t.primary:t.text,userSelect:"none"},onMouseEnter:N=>!d&&(N.currentTarget.style.background=t.bg),onMouseLeave:N=>!d&&(N.currentTarget.style.background="transparent"),children:[w.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:w.icon}),!r&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:d?600:400},children:w.value}),!r&&w.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:w.count}),!r&&z&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:m?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),z&&m&&!r&&w.items.map(N=>S(N,T+1))]},w.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",...f},children:[x&&!r&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:x}),e.jsx("button",{onClick:()=>p(w=>!w),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:r?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:r?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:n.map(w=>S(w))}),h&&!r&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:h})]})}function ne({config:n}){const[c,u]=g.useState(!1),l={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...n.width?{width:n.width,minWidth:n.width}:{flex:1},...n.height?{height:n.height,minHeight:n.height}:{minHeight:40},...c?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:l,children:[n.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:n.header}),n.collapsable&&e.jsx("button",{onClick:()=>u(x=>!x),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:c?"▼":"▲"})]}),!c&&e.jsxs("div",{style:{padding:n.padding||0,height:n.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[n.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:n.html}}):n.content,(n.rows||n.cols)&&e.jsx(_,{rows:n.rows,cols:n.cols,style:{height:"100%"}})]})]})}function _({rows:n,cols:c,type:u="line",style:l,children:x}){g.useEffect(E,[]);const h=u==="space"?12:u==="wide"?8:1,f=n||c,r=!!n;return f?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:r?"column":"row",gap:h,width:"100%",height:"100%",...l},children:f.map((p,y)=>e.jsx(ne,{config:p},p.id||y))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...l},children:x})}function oe({views:n=[],mode:c="top",tabAlign:u="left",closable:l=[],disabled:x=[],defaultActive:h,onBeforeChange:f,onChange:r,style:p}){var d;const[y,i]=g.useState(h||((d=n[0])==null?void 0:d.id)),[k,$]=g.useState(n.map(b=>b.id));g.useEffect(E,[]);const v=(b,N)=>{b.stopPropagation(),$(a=>a.filter(M=>M!==N)),y===N&&i(k.find(a=>a!==N)??"")},o=b=>{x.includes(b)||f&&f(b)===!1||(i(b),r==null||r(b))},S=c==="left"||c==="right",w=n.filter(b=>k.includes(b.id)),T=e.jsx("div",{style:{display:"flex",flexDirection:S?"column":"row",justifyContent:u==="center"?"center":u==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!S&&c!=="bottom"?`2px solid ${t.border}`:"none",borderTop:c==="bottom"?`2px solid ${t.border}`:"none",borderRight:c==="left"?`2px solid ${t.border}`:"none",borderLeft:c==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:w.map(b=>{const N=y===b.id,a=x.includes(b.id),M=c==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:S?{color:t.primary,fontWeight:600,background:t.primaryLt,[c==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>o(b.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:a?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:S?120:"auto",...N?M:{color:a?t.textMut:t.textSec}},children:[b.icon&&e.jsx("span",{style:{fontSize:16},children:b.icon}),e.jsx("span",{children:b.tab}),l.includes(b.id)&&e.jsx("span",{onClick:s=>v(s,b.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},b.id)})}),z=w.find(b=>b.id===y),m=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:c==="top"?"column":c==="bottom"?"column-reverse":c==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...p},children:[T,m]})}function se({columns:n,data:c=[],height:u=400,rowHeight:l=40,sortable:x=!0,resizable:h=!0,selection:f,multiselect:r,onSelect:p,style:y}){const[i,k]=g.useState(null),[$,v]=g.useState("asc"),[o,S]=g.useState({}),[w,T]=g.useState(new Set),[z,m]=g.useState(n.map(s=>s.width||s.minWidth||140));g.useEffect(E,[]);const d=g.useMemo(()=>{let s=c.filter(C=>Object.entries(o).every(([W,D])=>!D||String(C[W]??"").toLowerCase().includes(D.toLowerCase())));return i&&(s=[...s].sort((C,W)=>{const D=C[i],L=W[i];return D==null?1:L==null?-1:$==="asc"?D<L?-1:D>L?1:0:D>L?-1:D<L?1:0})),s},[c,i,$,o]),b=s=>{!x||s.sortable===!1||(v(C=>i===s.id&&C==="asc"?"desc":"asc"),k(s.id))},N=(s,C)=>{if(!f)return;const W=s.id??C;T(D=>{const L=r?new Set(D):new Set;return L.has(W)?L.delete(W):L.add(W),L}),p==null||p(s)},a=(s,C)=>{const W=s.clientX,D=z[C],L=Ce=>m(Te=>{const Z=[...Te];return Z[C]=Math.max(60,D+Ce.clientX-W),Z}),j=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",j)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",j),s.preventDefault()},M=n.some(s=>s.filterable!==!1);return e.jsx("div",{className:"dhx",style:{width:"100%",height:u,display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...y},children:e.jsx("div",{style:{overflowX:"auto",flex:1,display:"flex",flexDirection:"column"},children:e.jsxs("div",{style:{minWidth:z.reduce((s,C)=>s+C,0)+"px",display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:`1px solid ${t.border}`,position:"sticky",top:0,zIndex:2},children:n.map((s,C)=>{var W;return e.jsxs("div",{style:{width:z[C],minWidth:z[C],position:"relative",padding:"0 10px",height:40,display:"flex",alignItems:"center",fontSize:12,fontWeight:600,color:t.textSec,cursor:x&&s.sortable!==!1?"pointer":"default",userSelect:"none",gap:4},onClick:()=>b(s),children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(s.header)?(W=s.header[0])==null?void 0:W.text:s.header||s.id}),x&&s.sortable!==!1&&e.jsx("span",{style:{opacity:i===s.id?1:.25,fontSize:10},children:i===s.id?$==="asc"?"▲":"▼":"⇅"}),h&&C<n.length-1&&e.jsx("div",{onMouseDown:D=>a(D,C),style:{position:"absolute",right:0,top:4,bottom:4,width:4,cursor:"col-resize",background:"transparent"},onMouseEnter:D=>D.currentTarget.style.background=t.border,onMouseLeave:D=>D.currentTarget.style.background="transparent"})]},s.id)})}),M&&e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${t.border}`,background:t.surface},children:n.map((s,C)=>e.jsx("div",{style:{width:z[C],minWidth:z[C],padding:"4px 6px"},children:s.filterable!==!1&&e.jsx("input",{className:"dhx dhx-input",style:{height:24,fontSize:12},placeholder:"🔍",value:o[s.id]||"",onChange:W=>S(D=>({...D,[s.id]:W.target.value}))})},s.id))}),e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto"},children:[d.map((s,C)=>{const W=s.id??C,D=w.has(W);return e.jsx("div",{onClick:()=>N(s,C),style:{display:"flex",height:l,alignItems:"center",borderBottom:`1px solid ${t.border}`,cursor:f?"pointer":"default",background:D?t.primaryLt:C%2===0?t.surface:t.bg,transition:"background .1s"},onMouseEnter:L=>!D&&(L.currentTarget.style.background="#f0f8ff"),onMouseLeave:L=>!D&&(L.currentTarget.style.background=C%2===0?t.surface:t.bg),children:n.map((L,j)=>e.jsx("div",{style:{width:z[j],minWidth:z[j],padding:"0 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:L.align||"left"},children:L.template?L.template(s[L.id],s):String(s[L.id]??"")},L.id))},String(W))}),d.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut},children:"No data"})]})]})})})}const H=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function le({type:n="bar",data:c=[],series:u=[],scales:l={},legend:x,height:h=280,style:f}){var S,w,T,z,m;g.useEffect(E,[]);const r=((S=l.bottom)==null?void 0:S.text)||c[0]&&Object.keys(c[0])[0]||"x",p=e.jsx(A.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),y=x?e.jsx(A.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:x.valign,align:x.halign}):null,i=e.jsx(A.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),k=e.jsx(A.XAxis,{dataKey:r,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1}),$=e.jsx(A.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((w=l.left)==null?void 0:w.min)??"auto",((T=l.left)==null?void 0:T.max)??"auto"]}),v={data:c,margin:{top:10,right:20,left:0,bottom:0}};let o;if(n==="bar")o=e.jsxs(A.BarChart,{...v,children:[i,k,$,p,y,u.map((d,b)=>e.jsx(A.Bar,{dataKey:d.value||d.id,name:d.label||d.id,fill:d.fill||H[b%H.length],radius:[3,3,0,0]},d.id))]});else if(n==="line")o=e.jsxs(A.LineChart,{...v,children:[i,k,$,p,y,u.map((d,b)=>e.jsx(A.Line,{type:"monotone",dataKey:d.value||d.id,name:d.label||d.id,stroke:d.color||H[b%H.length],strokeWidth:2,dot:{r:3,fill:d.color||H[b%H.length]}},d.id))]});else if(n==="area")o=e.jsxs(A.AreaChart,{...v,children:[i,k,$,p,y,u.map((d,b)=>e.jsx(A.Area,{type:"monotone",dataKey:d.value||d.id,name:d.label||d.id,stroke:d.color||H[b%H.length],fill:(d.fill||H[b%H.length])+"33",strokeWidth:2},d.id))]});else if(n==="pie"||n==="donut"){const d=c[0]||{},b=Object.keys(d).find(a=>typeof d[a]=="number")||"value",N=Object.keys(d).find(a=>typeof d[a]=="string")||"x";o=e.jsxs(A.PieChart,{children:[e.jsx(A.Pie,{data:c,cx:"50%",cy:"50%",outerRadius:n==="donut"?"70%":"80%",innerRadius:n==="donut"?"40%":0,dataKey:b,nameKey:N,label:({name:a,percent:M})=>`${a??""} ${((M??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:c.map((a,M)=>e.jsx(A.Cell,{fill:H[M%H.length]},M))}),p,y]})}else n==="radar"?o=e.jsxs(A.RadarChart,{...v,cx:"50%",cy:"50%",children:[e.jsx(A.PolarGrid,{}),e.jsx(A.PolarAngleAxis,{dataKey:r,tick:{fontSize:11}}),u.map((d,b)=>e.jsx(A.Radar,{dataKey:d.value||d.id,name:d.label||d.id,stroke:d.color||H[b],fill:(d.fill||H[b])+"44"},d.id)),p,y]}):n==="scatter"&&(o=e.jsxs(A.ScatterChart,{...v,children:[i,e.jsx(A.XAxis,{dataKey:((z=u[0])==null?void 0:z.xValue)||"x",type:"number",tick:{fontSize:11,fill:t.textSec}}),e.jsx(A.YAxis,{dataKey:((m=u[0])==null?void 0:m.yValue)||"y",tick:{fontSize:11,fill:t.textSec}}),p,u.map((d,b)=>e.jsx(A.Scatter,{data:d.data||c,name:d.label||d.id,fill:d.color||H[b]},d.id))]}));return e.jsx("div",{className:"dhx",style:{width:"100%",height:h,padding:12,background:t.surface,borderRadius:t.rMd,...f},children:e.jsx(A.ResponsiveContainer,{width:"100%",height:"100%",children:o})})}const ae=["January","February","March","April","May","June","July","August","September","October","November","December"],de=["Su","Mo","Tu","We","Th","Fr","Sa"];function ie({value:n,range:c=!1,timepicker:u=!1,onChange:l,style:x}){const h=new Date,f=n?new Date(Array.isArray(n)?n[0]:n):h,[r,p]=g.useState(f),[y,i]=g.useState(n??(c?[null,null]:null)),[k,$]=g.useState(null),[v,o]=g.useState({h:0,m:0});g.useEffect(E,[]);const S=r.getFullYear(),w=r.getMonth(),T=new Date(S,w,1).getDay(),z=new Date(S,w+1,0).getDate(),m=[];for(let a=0;a<T;a++)m.push(null);for(let a=1;a<=z;a++)m.push(new Date(S,w,a));const d=a=>a.toDateString()===h.toDateString(),b=a=>{if(!y)return!1;if(c&&Array.isArray(y)){const[M,s]=y;if(!M)return!1;const C=a.getTime();return s?C>=M.getTime()&&C<=s.getTime():a.toDateString()===M.toDateString()}return a.toDateString()===y.toDateString()},N=a=>{if(c){const[M,s]=Array.isArray(y)?y:[null,null];if(!M||s)i([a,null]);else{const C=a<M?[a,M]:[M,a];i(C),l==null||l(C)}}else i(a),l==null||l(a)};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,...x},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>p(a=>new Date(a.getFullYear(),a.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:[ae[w]," ",S]}),e.jsx("button",{onClick:()=>p(a=>new Date(a.getFullYear(),a.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:[de.map(a=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:a},a)),m.map((a,M)=>{const s=a?b(a):!1,C=a&&k&&a.toDateString()===k.toDateString();return e.jsx("div",{onClick:()=>a&&N(a),onMouseEnter:()=>a&&$(a),onMouseLeave:()=>$(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:a?"pointer":"default",fontSize:12,fontWeight:a&&d(a)?700:400,background:s?t.primary:C?t.bg:"transparent",color:s?"#fff":a&&d(a)?t.primary:a?t.text:"transparent",border:a&&d(a)&&!s?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:a==null?void 0:a.getDate()},M)})]}),u&&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:a=>o(M=>({...M,h:+a.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:a=>o(M=>({...M,m:+a.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function V({value:n,onChange:c,timeFormat:u=12,controls:l=!1,minuteStep:x=5,style:h}){const[f,r]=g.useState((n==null?void 0:n.h)??(u===24?0:12)),[p,y]=g.useState((n==null?void 0:n.m)??0),[i,k]=g.useState((n==null?void 0:n.ampm)??"AM"),[$,v]=g.useState(null);g.useEffect(E,[]);const o=u===24?Array.from({length:24},(d,b)=>b):Array.from({length:12},(d,b)=>b+1),S=Array.from({length:Math.ceil(60/x)},(d,b)=>b*x),w=(d,b,N)=>{const a=u===24?{h:d,m:b}:{h:d,m:b,ampm:N};l?v(a):c==null||c(a)},T=()=>{v(null),r((n==null?void 0:n.h)??(u===24?0:12)),y((n==null?void 0:n.m)??0),k((n==null?void 0:n.ampm)??"AM")},z={display:"flex",flexDirection:"column",alignItems:"center",gap:4},m=d=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:d?700:400,background:d?t.primaryLt:"transparent",color:d?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,...h},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:o.map(d=>e.jsx("div",{onClick:()=>{r(d),w(d,p,i)},style:m(f===d),onMouseEnter:b=>f!==d&&(b.currentTarget.style.background=t.bg),onMouseLeave:b=>f!==d&&(b.currentTarget.style.background="transparent"),children:String(d).padStart(2,"0")},d))})]}),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:S.map(d=>e.jsx("div",{onClick:()=>{y(d),w(f,d,i)},style:m(p===d),onMouseEnter:b=>p!==d&&(b.currentTarget.style.background=t.bg),onMouseLeave:b=>p!==d&&(b.currentTarget.style.background="transparent"),children:String(d).padStart(2,"0")},d))})]}),u===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(d=>e.jsx("div",{onClick:()=>{k(d),w(f,p,d)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:i===d?700:400,background:i===d?t.primary:t.surface,color:i===d?"#fff":t.text},children:d},d))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(f).padStart(2,"0"),":",String(p).padStart(2,"0"),u===12?` ${i}`:""]}),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:T,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>$&&(c==null?void 0:c($)),children:"Apply"})]})]})}function B(n,c){g.useEffect(()=>{const u=l=>{n.current&&!n.current.contains(l.target)&&c(l)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n,c])}function q(n){const c=g.useRef(!1),u=g.useRef({x:0,y:0,ox:0,oy:0});return g.useCallback((l,x=0,h=0)=>{c.current=!0,u.current={x:l.clientX,y:l.clientY,ox:x,oy:h};const f=p=>{if(!c.current)return;const{x:y,y:i,ox:k,oy:$}=u.current;n(k+p.clientX-y,$+p.clientY-i)},r=()=>{c.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",r),l.preventDefault()},[n])}const ce=({open:n})=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{flexShrink:0,transition:"transform .15s",transform:n?"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 O({data:n=[],value:c,placeholder:u="Select or type...",multiselection:l=!1,label:x,onChange:h,style:f}){var N;const[r,p]=g.useState(!1),[y,i]=g.useState(""),[k,$]=g.useState(l?c?[].concat(c):[]:c||null),v=g.useRef(null),o=g.useRef(null);g.useEffect(E,[]),B(v,g.useCallback(()=>{p(!1),i("")},[]));const S=g.useMemo(()=>n.filter(a=>!y||a.value.toLowerCase().includes(y.toLowerCase())),[n,y]),w=a=>l?(k||[]).includes(a):k===a,T=a=>{const M=a.id||a.value;if(l){const s=w(M)?k.filter(C=>C!==M):[...k||[],M];$(s),h==null||h(s)}else $(M),i(""),p(!1),h==null||h(M)},z=a=>{const M=k.filter(s=>s!==a);$(M),h==null||h(M)},m=()=>{p(!0),setTimeout(()=>{var a;return(a=o.current)==null?void 0:a.focus()},0)},d=((N=n.find(a=>(a.id||a.value)===k))==null?void 0:N.value)||"",b=l?k||[]:[];return e.jsxs("div",{ref:v,className:"dhx",style:{position:"relative",...f},children:[x&&e.jsx("label",{className:"dhx dhx-label",children:x}),e.jsxs("div",{onClick:m,style:{display:"flex",alignItems:"center",flexWrap:l?"wrap":"nowrap",border:`1px solid ${r?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:r?`0 0 0 3px ${t.primary}22`:"none"},children:[l&&e.jsxs(e.Fragment,{children:[b.map(a=>{var M;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:[((M=n.find(s=>(s.id||s.value)===a))==null?void 0:M.value)||a,e.jsx("span",{onClick:s=>{s.stopPropagation(),z(a)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},a)}),e.jsx("input",{ref:o,value:y,onChange:a=>{i(a.target.value),p(!0)},onFocus:()=>p(!0),onClick:a=>a.stopPropagation(),placeholder:b.length?"":u,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!l&&e.jsx("input",{ref:o,value:r?y:d,onChange:a=>{i(a.target.value),p(!0)},onFocus:()=>{p(!0),i("")},onClick:a=>a.stopPropagation(),placeholder:u,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(ce,{open:r})]}),r&&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:[S.map(a=>{const M=a.id||a.value,s=w(M);return e.jsxs("div",{onClick:()=>T(a),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:s?t.primaryLt:"transparent",color:s?t.primary:t.text},onMouseEnter:C=>!s&&(C.currentTarget.style.background=t.bg),onMouseLeave:C=>!s&&(C.currentTarget.style.background="transparent"),children:[l&&e.jsx("span",{style:{width:14,height:14,flexShrink:0,border:`2px solid ${s?t.primary:t.borderDk}`,borderRadius:3,display:"flex",alignItems:"center",justifyContent:"center",background:s?t.primary:"transparent"},children:s&&e.jsx("span",{style:{color:"#fff",fontSize:9,lineHeight:1},children:"✓"})}),e.jsx("span",{style:{flex:1},children:a.value}),!l&&s&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),a.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",a.count,")"]})]},M)}),S.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function Y({min:n=0,max:c=100,step:u=1,value:l,range:x=!1,label:h,tick:f,disabled:r=!1,onChange:p,style:y}){const[i,k]=g.useState(l??(x?[n,c]:n));g.useEffect(E,[]);const $=(T,z)=>{if(!r)if(x){const m=[...i];m[T]=z,k(m),p==null||p(m)}else k(z),p==null||p(z)},v=T=>(T-n)/(c-n)*100,o=x?i:[i],S=x?{left:`${v(o[0])}%`,width:`${v(o[1])-v(o[0])}%`}:{left:0,width:`${v(o[0])}%`},w=r?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:r?.5:1,...y},children:[h&&e.jsx("label",{className:"dhx dhx-label",children:h}),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",...S,height:"100%",background:w,borderRadius:2}}),o.map((T,z)=>e.jsx("input",{type:"range",min:n,max:c,step:u,value:T,disabled:r,onChange:m=>{const d=+m.target.value;x&&z===0&&d>=i[1]||x&&z===1&&d<=i[0]||$(z,d)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:r?"not-allowed":"pointer",top:0,left:0,margin:0}},z)),o.map((T,z)=>e.jsx("div",{style:{position:"absolute",left:`${v(T)}%`,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:r?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:T})},z))]})}),f&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[n,Math.round((c+n)/2),c].map(T=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:T},T))})]})}const pe=["#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 K(n){const c=parseInt(n.slice(1,3),16)/255,u=parseInt(n.slice(3,5),16)/255,l=parseInt(n.slice(5,7),16)/255,x=Math.max(c,u,l),h=Math.min(c,u,l);let f=0,r=0;const p=(x+h)/2;if(x!==h){const y=x-h;r=p>.5?y/(2-x-h):y/(x+h),f=x===c?((u-l)/y+(u<l?6:0))/6:x===u?((l-c)/y+2)/6:((c-u)/y+4)/6}return[Math.round(f*360),Math.round(r*100),Math.round(p*100)]}function G(n,c,u){c/=100,u/=100;const l=c*Math.min(u,1-u),x=h=>{const f=(h+n/30)%12,r=u-l*Math.max(Math.min(f-3,9-f,1),-1);return Math.round(255*r).toString(16).padStart(2,"0")};return"#"+x(0)+x(8)+x(4)}function he({value:n="#0288d1",onChange:c,style:u}){const[l,x]=g.useState(()=>K(n)),h=G(...l);g.useEffect(E,[]);const f=r=>{x(r),c==null||c(G(...r))};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,...u},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(([r,p,y,i],k)=>e.jsxs("div",{style:{marginBottom:k<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[r,k>0?` (${i}%)`:""]}),e.jsx("input",{type:"range",min:p,max:y,value:i,onChange:$=>{const v=[...l];v[k]=+$.target.value,f(v)},style:{width:"100%",accentColor:t.primary}})]},r)),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:h,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:h,onChange:r=>{try{f(K(r.target.value)),c==null||c(r.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:pe.map(r=>e.jsx("div",{onClick:()=>{x(K(r)),c==null||c(r)},style:{width:14,height:14,borderRadius:2,background:r,cursor:"pointer",border:h===r?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:p=>p.currentTarget.style.transform="scale(1.3)",onMouseLeave:p=>p.currentTarget.style.transform="scale(1)"},r))})]})}function P({items:n,onSelect:c,style:u}){const[l,x]=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",...u},children:n.map((h,f)=>{var p,y;if(h.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},f);const r=l===f;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>x(f),onMouseLeave:()=>x(null),children:[e.jsxs("div",{onClick:()=>{var i;return!h.disabled&&!((i=h.items)!=null&&i.length)&&c(h)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:h.disabled?"not-allowed":"pointer",fontSize:13,color:h.disabled?t.textMut:t.text,background:r&&!h.disabled?t.bg:"transparent",opacity:h.disabled?.5:1},children:[h.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:h.icon}),e.jsx("span",{style:{flex:1},children:h.value||h.id}),h.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:h.hotkey}),(p=h.items)!=null&&p.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),r&&((y=h.items)!=null&&y.length)?e.jsx(P,{items:h.items,onSelect:c,style:{position:"absolute",left:"100%",top:-4}}):null]},h.id||f)})})}function ue({items:n=[],label:c="Menu",onSelect:u,style:l}){const[x,h]=g.useState(!1),f=g.useRef(null);return g.useEffect(E,[]),B(f,g.useCallback(()=>h(!1),[])),e.jsxs("div",{ref:f,className:"dhx",style:{position:"relative",display:"inline-block",...l},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>h(r=>!r),children:[c," ",e.jsx("span",{style:{fontSize:10},children:x?"▲":"▼"})]}),x&&e.jsx(P,{items:n,onSelect:r=>{u==null||u(r),h(!1)}})]})}function fe({items:n=[],onSelect:c,children:u}){const[l,x]=g.useState(null),h=g.useRef(null);g.useEffect(E,[]),B(h,g.useCallback(()=>x(null),[]));const f=r=>{r.preventDefault(),x({x:r.clientX,y:r.clientY})};return e.jsxs("div",{ref:h,onContextMenu:f,style:{position:"relative",display:"contents"},children:[u,l&&e.jsx("div",{style:{position:"fixed",left:l.x,top:l.y,zIndex:9999},children:e.jsx(P,{items:n,onSelect:r=>{c==null||c(r),x(null)}})})]})}function xe({trigger:n,children:c,placement:u="bottom-start",style:l}){const[x,h]=g.useState(!1),[f,r]=g.useState({top:"100%",left:0}),p=g.useRef(null),y=g.useRef(null);g.useEffect(E,[]),B(p,g.useCallback(()=>h(!1),[]));const i=()=>{h(k=>{if(!k&&y.current){const $=y.current.getBoundingClientRect(),v={"bottom-start":{top:$.height+4,left:0},"bottom-end":{top:$.height+4,right:0,left:"auto"},"top-start":{bottom:$.height+4,top:"auto",left:0}};r(v[u]||v["bottom-start"])}return!k})};return e.jsxs("div",{ref:p,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:y,onClick:i,children:n}),x&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...f,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...l},children:c})]})}function ge({title:n,children:c,width:u=480,height:l,closable:x=!0,movable:h=!0,modal:f=!1,defaultOpen:r=!0,footer:p,onClose:y,style:i}){const[k,$]=g.useState(r),[v,o]=g.useState({x:0,y:0});g.useEffect(E,[]);const S=q(g.useCallback((T,z)=>h&&o({x:T,y:z}),[h])),w=()=>{$(!1),y==null||y()};return k?e.jsxs(e.Fragment,{children:[f&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:x?w:void 0}),e.jsxs("div",{className:"dhx",style:{position:f?"fixed":"absolute",left:f?"50%":`calc(50% + ${v.x}px)`,top:f?"50%":`calc(50% + ${v.y}px)`,transform:`translate(calc(-50% + ${v.x}px), calc(-50% + ${v.y}px))`,width:u,...l?{height:l}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...i},children:[e.jsxs("div",{onMouseDown:T=>S(T,v.x,v.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:h?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:n}),x&&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:T=>T.currentTarget.style.background=t.border,onMouseLeave:T=>T.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:c}),p&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:p})]})]}):null}const F=g.createContext(null),ye={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},J={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function be({children:n}){const[c,u]=g.useState([]);g.useEffect(E,[]);const l=g.useCallback(f=>u(r=>r.filter(p=>p.id!==f)),[]),x=g.useCallback(f=>{const r=Date.now();return u(p=>[...p,{id:r,...f}]),f.duration!==0&&setTimeout(()=>l(r),f.duration||4e3),r},[l]),h={message:x,alert:(f,r)=>x({type:"info",title:f,...r}),confirm:(f,r,p)=>x({type:"warning",title:f,confirm:r,...p})};return e.jsxs(F.Provider,{value:h,children:[n,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:c.map(f=>{const r=f.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${J[r]}`,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:J[r],lineHeight:1},children:ye[r]}),e.jsxs("div",{style:{flex:1},children:[f.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:f.text?3:0},children:f.title}),f.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:f.text}),f.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:()=>{f.confirm(!0),l(f.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{f.confirm(!1),l(f.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>l(f.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},f.id)})})]})}function ve(){const n=g.useContext(F);if(!n)throw new Error("useMessage must be used inside <MessageProvider>");return n}function Se({data:n=[],template:c,keyNavigation:u=!0,multiselection:l=!1,editable:x=!1,height:h=400,onSelect:f,onEdit:r,style:p}){const[y,i]=g.useState(new Set),[k,$]=g.useState(null),[v,o]=g.useState(""),[S,w]=g.useState(null);g.useEffect(E,[]);const T=(m,d)=>{const b=m.id??d;i(N=>{const a=l?new Set(N):new Set;return a.has(b)?a.delete(b):a.add(b),a}),w(d),f==null||f(m)},z=(m,d)=>{r==null||r({...m,value:v},d),$(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:h,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...p},tabIndex:0,onKeyDown:m=>{u&&(m.key==="ArrowDown"&&w(d=>Math.min((d??-1)+1,n.length-1)),m.key==="ArrowUp"&&w(d=>Math.max((d??1)-1,0)))},children:[n.map((m,d)=>{const b=m.id??d,N=y.has(b),a=S===d;return e.jsx("div",{onClick:()=>T(m,d),onDoubleClick:()=>x&&($(d),o(String(m.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:N?t.primaryLt:a?t.bg:t.surface,color:N?t.primary:t.text,outline:a?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:k===d?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:v,onChange:M=>o(M.target.value),onBlur:()=>z(m,d),onKeyDown:M=>{M.key==="Enter"&&z(m,d),M.key==="Escape"&&$(null)},onClick:M=>M.stopPropagation()}):c?e.jsx("div",{dangerouslySetInnerHTML:{__html:c(m)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(m.value??"")})},String(b))}),n.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function ke({data:n=[],template:c,itemsInRow:u=3,gap:l=12,multiselection:x=!1,onSelect:h,style:f}){const[r,p]=g.useState(new Set);g.useEffect(E,[]);const y=i=>{const k=i.id??String(i.title);p($=>{const v=x?new Set($):new Set;return v.has(k)?v.delete(k):v.add(k),v}),h==null||h(i)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,gap:l,padding:l,...f},children:n.map((i,k)=>{const $=i.id??k,v=r.has($);return e.jsx("div",{onClick:()=>y(i),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:o=>{o.currentTarget.style.boxShadow=t.shadowLg,o.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:o=>{o.currentTarget.style.boxShadow=v?`0 0 0 3px ${t.primary}33`:t.shadow,o.currentTarget.style.transform=v?"translateY(-2px)":"none"},children:c?e.jsx("div",{dangerouslySetInnerHTML:{__html:c(i)}}):e.jsxs("div",{style:{padding:16},children:[i.img&&e.jsx("img",{src:i.img,alt:i.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:i.title||i.value}),i.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:i.subtitle})]})},String($))})})}function we({data:n=[],checkbox:c=!1,editable:u=!1,onSelect:l,onCheck:x,style:h}){const[f,r]=g.useState({}),[p,y]=g.useState(null),[i,k]=g.useState({}),[$,v]=g.useState(null),[o,S]=g.useState("");g.useEffect(E,[]);const w=m=>r(d=>({...d,[m]:!d[m]})),T=(m,d)=>{k(b=>({...b,[m]:d})),x==null||x(m,d)},z=(m,d=0)=>{var M;const b=(((M=m.items)==null?void 0:M.length)??0)>0,N=f[m.id],a=p===m.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{y(m.id),l==null||l(m),b&&w(m.id)},onDoubleClick:()=>{u&&(v(m.id),S(m.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+d*18}px`,cursor:"pointer",borderRadius:t.r,margin:"1px 4px",background:a?t.primaryLt:"transparent",color:a?t.primary:t.text,userSelect:"none",fontSize:13},onMouseEnter:s=>!a&&(s.currentTarget.style.background=t.bg),onMouseLeave:s=>!a&&(s.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},children:b?N?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:b?N?"📂":"📁":"📄"}),c&&e.jsx("input",{type:"checkbox",checked:!!i[m.id],onChange:s=>{s.stopPropagation(),T(m.id,s.target.checked)},style:{cursor:"pointer",accentColor:t.primary},onClick:s=>s.stopPropagation()}),$===m.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:o,onChange:s=>S(s.target.value),onBlur:()=>v(null),onKeyDown:s=>s.key==="Enter"&&v(null),onClick:s=>s.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,")"]})]}),b&&N&&e.jsx("div",{children:m.items.map(s=>z(s,d+1))})]},m.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...h},children:n.map(m=>z(m))})}function me({total:n,pageSize:c=10,page:u,onChange:l,style:x}){const[h,f]=g.useState(u||1),r=Math.ceil(n/c);g.useEffect(E,[]);const p=i=>{const k=Math.min(Math.max(1,i),r);f(k),l==null||l(k)},y=g.useMemo(()=>{const i=[];for(let $=Math.max(1,h-2);$<=Math.min(r,h+2);$++)i.push($);return i[0]>1&&(i[0]>2&&i.unshift("..."),i.unshift(1)),i[i.length-1]<r&&(i[i.length-1]<r-1&&i.push("..."),i.push(r)),i},[h,r]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...x},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(h-1)*c+1,"–",Math.min(h*c,n)," of ",n]}),[["«",1],["‹",h-1]].map(([i,k])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:h===1,onClick:()=>p(k),children:i},i)),y.map((i,k)=>e.jsx("button",{onClick:()=>typeof i=="number"&&p(i),className:`dhx dhx-btn ${i===h?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:i==="...",children:i},k)),[["›",h+1],["»",r]].map(([i,k])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:h===r,onClick:()=>p(k),children:i},i))]})}function Me({config:n={},defaultValues:c={},onSubmit:u,style:l}){const[x,h]=g.useState(c),[f,r]=g.useState({}),[p,y]=g.useState(null);g.useEffect(E,[]);const i=(o,S)=>{h(w=>({...w,[o]:S})),r(w=>({...w,[o]:null}))},k=()=>{const o={};return(n.rows||[]).flat().forEach(S=>{S&&typeof S=="object"&&"name"in S&&S.required&&!x[S.name]&&(o[S.name]=`${S.label||S.name} is required`)}),r(o),Object.keys(o).length===0},$=o=>{const S=x[o.name]??o.value??"",w=f[o.name],T=o.labelWidth??n.labelWidth,z=T!==void 0||o.labelPosition==="left";if(o.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:o.label}),(o.rows||[]).map(s=>$(s))]},o.name);if(o.type==="spacer")return e.jsx("div",{style:{height:o.height||16}},o.name);const m=T?{minWidth:T,width:T,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},d=o.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...m},children:[o.label,o.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,b=w?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:w}):null,N=o.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",o.helpMessage]}):null,a={key:o.name,className:"dhx-form-group"},M=s=>z?e.jsxs("div",{...a,style:{display:"flex",alignItems:"flex-start",gap:8},children:[d,e.jsxs("div",{style:{flex:1,minWidth:0},children:[s,b,N]})]}):e.jsxs("div",{...a,children:[d,s,b,N]});if(!o.type||o.type==="input")return M(e.jsxs("div",{className:"dhx-input-wrap",children:[o.icon&&e.jsx("span",{className:"dhx-input-icon",children:o.icon}),e.jsx("input",{className:`dhx dhx-input${o.icon?" dhx-input--with-icon":""}`,style:{borderColor:w?t.danger:void 0},type:o.inputType||"text",placeholder:o.placeholder,value:S,onChange:s=>i(o.name,s.target.value),disabled:o.disabled})]}));if(o.type==="textarea")return M(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:o.placeholder,value:S,onChange:s=>i(o.name,s.target.value)}));if(o.type==="select")return M(e.jsxs("select",{className:"dhx dhx-input",value:S,onChange:s=>i(o.name,s.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(o.options||[]).map(s=>e.jsx("option",{value:s.value,children:s.label||s.value},s.value))]}));if(o.type==="datepicker")return M(e.jsx("input",{type:"date",className:"dhx dhx-input",value:S,onChange:s=>i(o.name,s.target.value)}));if(o.type==="timepicker"){const s=x[o.name]??{h:12,m:0,ampm:"AM"},C=!!x[o.name],W=C?`${String(s.h).padStart(2,"0")}:${String(s.m).padStart(2,"0")}${s.ampm?" "+s.ampm:""}`:o.placeholder||"Click to select",D=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:()=>y(p===o.name?null:o.name),children:[e.jsx("span",{style:{color:C?t.text:t.textMut},children:W}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),p===o.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx(V,{value:s,controls:!0,onChange:L=>{i(o.name,L),y(null)}})})]});return M(D)}if(o.type==="colorpicker")return M(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:S||"#000000",onChange:s=>i(o.name,s.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:S||"#000000"})]}));if(o.type==="text")return M(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:o.value}));if(o.type==="checkbox")return e.jsxs("div",{...a,children:[z?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[T&&e.jsx("div",{style:{width:T,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!S,onChange:s=>i(o.name,s.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]})]}):e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!S,onChange:s=>i(o.name,s.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]}),N]});if(o.type==="radio"){const s=(o.options||[]).map(C=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:o.name,value:C.value,checked:S===C.value,onChange:()=>i(o.name,C.value),style:{accentColor:t.primary,cursor:"pointer"}}),C.label||C.value]},C.value));return M(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:s}))}if(o.type==="slider")return z?e.jsxs("div",{...a,style:{display:"flex",alignItems:"flex-start",gap:8},children:[d,e.jsxs("div",{style:{flex:1},children:[e.jsx(Y,{min:o.min,max:o.max,step:o.step,value:S||o.min,range:o.range,onChange:s=>i(o.name,s)}),N]})]}):e.jsxs("div",{...a,children:[e.jsx(Y,{label:o.label,min:o.min,max:o.max,step:o.step,value:S||o.min,range:o.range,onChange:s=>i(o.name,s)}),N]});if(o.type==="combo")return z?e.jsxs("div",{...a,style:{display:"flex",alignItems:"flex-start",gap:8},children:[d,e.jsxs("div",{style:{flex:1},children:[e.jsx(O,{data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:S||(o.multiselection?[]:null),onChange:s=>i(o.name,s)}),b,N]})]}):e.jsxs("div",{...a,children:[e.jsx(O,{label:o.label,data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:S||(o.multiselection?[]:null),onChange:s=>i(o.name,s)}),b,N]});if(o.type==="toggle"){const s=!!S,C=s?o.icon:o.offIcon||o.icon,W=s?o.text||o.label:o.offText||o.text||o.label;return e.jsxs("div",{...a,children:[z&&T&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:T,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(U,{on:s,onClick:()=>i(o.name,!S)}),C&&e.jsx("span",{style:{fontSize:16},children:C}),W&&e.jsx("span",{style:{fontSize:13},children:W})]})]}),!z&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(U,{on:s,onClick:()=>i(o.name,!S)}),C&&e.jsx("span",{style:{fontSize:16},children:C}),W&&e.jsx("span",{style:{fontSize:13},children:W})]}),N]})}return null},v=o=>o.map((S,w)=>Array.isArray(S)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:S.map($)},w):$(S));return e.jsxs("div",{className:"dhx",style:{padding:n.padding||0,width:n.width||"100%",...l},children:[v(n.rows||[]),(n.buttons||u)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:n.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>k()&&(u==null?void 0:u(x)),children:n.submitText||"Submit"}),n.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{h(c),r({})},children:n.resetText||"Reset"})]})]})}function U({on:n,onClick:c}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:c,children:[e.jsx("div",{style:{width:40,height:22,borderRadius:11,background:n?t.primary:t.border,transition:"background 0.2s"}}),e.jsx("div",{style:{position:"absolute",top:3,left:n?21:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,.3)"}})]})}function Q(n){const c=[];for(const u of n)"type"in u&&u.type==="block"?c.push(...u.items||[]):c.push(u);return c}function $e({items:n=[],onAction:c,style:u}){g.useEffect(E,[]);const[l,x]=g.useState(()=>{const r={};for(const p of Q(n))p.id&&(r[p.id]=!!p.active);return r}),h=r=>{var p;if(r.id)if(r.group){const y=Q(n).filter(i=>i.group===r.group&&i.id);x(i=>{const k={...i};for(const $ of y)k[$.id]=!1;return k[r.id]=!0,k})}else r.twoState&&x(y=>({...y,[r.id]:!y[r.id]}));(p=r.onClick)==null||p.call(r,r),r.id&&(c==null||c(r.id,r))},f=(r,p)=>{var k,$;if("type"in r&&(r.type==="separator"||r.type==="sep"))return e.jsx("div",{style:{width:1,background:t.border,margin:"8px 4px",alignSelf:"stretch"}},p);if("type"in r&&r.type==="input"){const v=r;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"4px 6px",gap:4},children:[v.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:v.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:v.width||110,height:26,fontSize:12},placeholder:v.placeholder,defaultValue:v.value,onChange:o=>{var S;return(S=v.onChange)==null?void 0:S.call(v,o.target.value)}})]},p)}if("type"in r&&r.type==="block"){const v=r;return e.jsxs("div",{style:{display:"flex",flexDirection:v.direction==="col"?"column":"row",alignItems:"center",gap:4,padding:"4px 8px",borderRight:`1px solid ${t.border}`,minHeight:64},children:[e.jsx("div",{style:{display:"flex",gap:2},children:(k=v.items)==null?void 0:k.map((o,S)=>f(o,S))}),v.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut,marginTop:2},children:v.label})]},p)}if("type"in r&&r.type==="selectButton"){const v=r;return e.jsx("select",{className:"dhx dhx-input",style:{height:28,fontSize:12,cursor:"pointer",margin:2},defaultValue:v.value,onChange:o=>{var S;return(S=v.onChange)==null?void 0:S.call(v,o.target.value)},children:($=v.items)==null?void 0:$.map(o=>e.jsx("option",{value:o.value,children:o.value},o.value))},p)}const y=r,i=y.id!==void 0?l[y.id]??!!y.active:!!y.active;return e.jsxs("button",{title:y.tooltip,className:`dhx dhx-btn ${i?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{flexDirection:"column",minHeight:48,padding:"4px 8px",gap:4,fontSize:12},disabled:y.disabled,onClick:()=>h(y),children:[y.icon&&e.jsx("span",{style:{fontSize:y.size==="large"?24:18},children:y.icon}),y.text&&e.jsx("span",{style:{fontSize:10,maxWidth:60,textAlign:"center",lineHeight:1.2,whiteSpace:"normal"},children:y.text})]},p)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.bg,borderBottom:`1px solid ${t.border}`,padding:"4px 0",overflowX:"auto",gap:0,...u},children:n.map(f)})}function ze({logo:n,items:c=[],vertical:u=!1,style:l}){const[x,h]=g.useState(null),f=g.useRef(null);g.useEffect(E,[]),B(f,g.useCallback(()=>h(null),[]));const r=(p,y)=>{var i;return p.type==="separator"?e.jsx("div",{style:{[u?"height":"width"]:1,background:t.border,margin:u?"4px 8px":"0 6px",alignSelf:"stretch"}},y):p.type==="spacer"?e.jsx("div",{style:{flex:1}},y):p.type==="input"?e.jsx("input",{className:"dhx dhx-input",style:{width:p.width||200,height:28,margin:"0 4px"},placeholder:p.placeholder},y):p.type==="menuItem"&&((i=p.items)!=null&&i.length)?e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:36,color:t.text},onClick:()=>h(x===y?null:y),children:[p.icon&&e.jsx("span",{children:p.icon}),p.value," ",e.jsx("span",{style:{fontSize:9},children:"▼"})]}),x===y&&e.jsx(P,{items:p.items,onSelect:()=>h(null),style:{top:"100%"}})]},y):e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:36,gap:6,color:t.text},onClick:()=>{var k;return(k=p.onClick)==null?void 0:k.call(p)},children:[p.icon&&e.jsx("span",{style:{fontSize:16},children:p.icon}),p.value&&e.jsx("span",{style:{fontSize:13},children:p.value})]},y)};return e.jsxs("nav",{ref:f,className:"dhx",style:{display:"flex",flexDirection:u?"column":"row",alignItems:u?"stretch":"center",background:t.surface,borderBottom:u?"none":`1px solid ${t.border}`,borderRight:u?`1px solid ${t.border}`:"none",padding:u?"12px 0":"0 12px",minHeight:u?void 0:48,gap:2,...l},children:[n&&e.jsx("div",{style:{color:t.text,fontWeight:800,fontSize:16,padding:u?"8px 16px":"0 12px 0 4px",borderRight:u?"none":`1px solid ${t.border}`,marginRight:u?0:8},children:n}),c.map(r)]})}I.Button=ee,I.Calendar=ie,I.Chart=le,I.Colorpicker=he,I.Combobox=O,I.ContextMenu=fe,I.DataView=ke,I.Form=Me,I.Grid=se,I.Layout=_,I.List=Se,I.Menu=ue,I.MenuDropdown=P,I.MessageContext=F,I.MessageProvider=be,I.Navbar=ze,I.Pagination=me,I.Popup=xe,I.Ribbon=$e,I.Sidebar=re,I.Slider=Y,I.Tabbar=oe,I.Timepicker=V,I.Toolbar=te,I.Tree=we,I.Window=ge,I.tokens=t,I.useClickOutside=B,I.useDrag=q,I.useMessage=ve,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
42
42
  //# sourceMappingURL=dhx-react-suite.umd.cjs.map