@object-ui/plugin-dashboard 0.1.1 → 2.0.0

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.
@@ -1,6 +1,9 @@
1
- (function(f,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("@object-ui/core"),require("react"),require("@object-ui/react"),require("@object-ui/components"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","@object-ui/core","react","@object-ui/react","@object-ui/components","lucide-react"],p):(f=typeof globalThis<"u"?globalThis:f||self,p(f.ObjectUIPluginDashboard={},f.ObjectUICore,f.React,f.ObjectUIReact,f.ObjectUIComponents,f.lucideReact))})(this,(function(f,p,N,z,m,h){"use strict";var x={exports:{}},E={};var A;function G(){if(A)return E;A=1;var i=Symbol.for("react.transitional.element"),b=Symbol.for("react.fragment");function o(d,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),"key"in l){c={};for(var v in l)v!=="key"&&(c[v]=l[v])}else c=l;return l=c.ref,{$$typeof:i,type:d,key:u,ref:l!==void 0?l:null,props:c}}return E.Fragment=b,E.jsx=o,E.jsxs=o,E}var R={};var P;function X(){return P||(P=1,process.env.NODE_ENV!=="production"&&(function(){function i(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case ee:return"Profiler";case K:return"StrictMode";case ne:return"Suspense";case oe:return"SuspenseList";case le:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Q:return"Portal";case te:return e.displayName||"Context";case re:return(e._context.displayName||"Context")+".Consumer";case ae:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return r=e.displayName||null,r!==null?r:i(e.type)||"Memo";case g:r=e._payload,e=e._init;try{return i(e(r))}catch{}}return null}function b(e){return""+e}function o(e){try{b(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,a=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",a),b(e)}}function d(e){if(e===y)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===g)return"<...>";try{var r=i(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function l(){var e=w.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function u(e){if(F.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function v(e,r){function t(){W||(W=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function B(){var e=i(this.type);return L[e]||(L[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Z(e,r,t,a,j,k){var n=t.ref;return e={$$typeof:U,type:e,key:r,props:t,_owner:a},(n!==void 0?n:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:B}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:j}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:k}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function D(e,r,t,a,j,k){var n=r.children;if(n!==void 0)if(a)if(ue(n)){for(a=0;a<n.length;a++)$(n[a]);Object.freeze&&Object.freeze(n)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else $(n);if(F.call(r,"key")){n=i(e);var _=Object.keys(r).filter(function(ie){return ie!=="key"});a=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",J[n+a]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(xe,Ye){typeof exports=="object"&&typeof module<"u"?Ye(exports,require("@object-ui/core"),require("react"),require("@object-ui/react"),require("@object-ui/components"),require("lucide-react"),require("react-dom"),require("clsx")):typeof define=="function"&&define.amd?define(["exports","@object-ui/core","react","@object-ui/react","@object-ui/components","lucide-react","react-dom","clsx"],Ye):(xe=typeof globalThis<"u"?globalThis:xe||self,Ye(xe.ObjectUIPluginDashboard={},xe.ObjectUICore,xe.React,xe.ObjectUIReact,xe.ObjectUIComponents,xe.LucideIcons,xe.ReactDOM,xe.clsx))})(this,(function(xe,Ye,C,wt,Q,Te,Cr,Gt){"use strict";function Er(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const tt=Er(C),Pr=Er(Te);var St={exports:{}},ut={};var Or;function Nn(){if(Or)return ut;Or=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,o,i){var l=null;if(i!==void 0&&(l=""+i),o.key!==void 0&&(l=""+o.key),"key"in o){i={};for(var u in o)u!=="key"&&(i[u]=o[u])}else i=o;return o=i.ref,{$$typeof:e,type:n,key:l,ref:o!==void 0?o:null,props:i}}return ut.Fragment=t,ut.jsx=r,ut.jsxs=r,ut}var ct={};var Rr;function An(){return Rr||(Rr=1,process.env.NODE_ENV!=="production"&&(function(){function e(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===q?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case a:return"Fragment";case h:return"Profiler";case s:return"StrictMode";case E:return"Suspense";case g:return"SuspenseList";case Y:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case c:return"Portal";case S:return f.displayName||"Context";case y:return(f._context.displayName||"Context")+".Consumer";case b:var j=f.render;return f=f.displayName,f||(f=j.displayName||j.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case x:return j=f.displayName||null,j!==null?j:e(f.type)||"Memo";case R:j=f._payload,f=f._init;try{return e(f(j))}catch{}}return null}function t(f){return""+f}function r(f){try{t(f);var j=!1}catch{j=!0}if(j){j=console;var k=j.error,M=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return k.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",M),t(f)}}function n(f){if(f===a)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===R)return"<...>";try{var j=e(f);return j?"<"+j+">":"<...>"}catch{return"<...>"}}function o(){var f=V.A;return f===null?null:f.getOwner()}function i(){return Error("react-stack-top-frame")}function l(f){if(A.call(f,"key")){var j=Object.getOwnPropertyDescriptor(f,"key").get;if(j&&j.isReactWarning)return!1}return f.key!==void 0}function u(f,j){function k(){U||(U=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",j))}k.isReactWarning=!0,Object.defineProperty(f,"key",{get:k,configurable:!0})}function d(){var f=e(this.type);return J[f]||(J[f]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),f=this.props.ref,f!==void 0?f:null}function v(f,j,k,M,X,I){var T=k.ref;return f={$$typeof:_,type:f,key:j,props:k,_owner:M},(T!==void 0?T:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:d}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function m(f,j,k,M,X,I){var T=j.children;if(T!==void 0)if(M)if($(T)){for(M=0;M<T.length;M++)p(T[M]);Object.freeze&&Object.freeze(T)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(T);if(A.call(j,"key")){T=e(f);var W=Object.keys(j).filter(function(H){return H!=="key"});M=0<W.length?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}",P[T+M]||(W=0<W.length?"{"+W.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,a,n,_,n),J[n+a]=!0)}if(n=null,t!==void 0&&(o(t),n=""+t),u(r)&&(o(r.key),n=""+r.key),"key"in r){t={};for(var S in r)S!=="key"&&(t[S]=r[S])}else t=r;return n&&v(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),Z(e,n,t,l(),j,k)}function $(e){M(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===g&&(e._payload.status==="fulfilled"?M(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function M(e){return typeof e=="object"&&e!==null&&e.$$typeof===U}var T=N,U=Symbol.for("react.transitional.element"),Q=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),ee=Symbol.for("react.profiler"),re=Symbol.for("react.consumer"),te=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),w=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,ue=Array.isArray,O=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(e){return e()}};var W,L={},q=T.react_stack_bottom_frame.bind(T,c)(),V=O(d(c)),J={};R.Fragment=y,R.jsx=function(e,r,t){var a=1e4>w.recentlyCreatedOwnerStacks++;return D(e,r,t,!1,a?Error("react-stack-top-frame"):q,a?O(d(e)):V)},R.jsxs=function(e,r,t){var a=1e4>w.recentlyCreatedOwnerStacks++;return D(e,r,t,!0,a?Error("react-stack-top-frame"):q,a?O(d(e)):V)}})()),R}var C;function H(){return C||(C=1,process.env.NODE_ENV==="production"?x.exports=G():x.exports=X()),x.exports}var s=H();const I=N.forwardRef(({schema:i,className:b,...o},d)=>{const l=i.columns||3,c=i.gap||4;return s.jsx("div",{ref:d,className:m.cn("grid",b),style:{gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gap:`${c*.25}rem`},...o,children:i.widgets?.map(u=>s.jsxs("div",{className:m.cn("border rounded-lg p-4 bg-card text-card-foreground shadow-sm"),style:u.layout?{gridColumn:`span ${u.layout.w}`,gridRow:`span ${u.layout.h}`}:void 0,children:[u.title&&s.jsx("h3",{className:"font-semibold mb-2",children:u.title}),s.jsx(z.SchemaRenderer,{schema:u.component})]},u.id))})}),Y=({label:i,value:b,trend:o,icon:d,className:l,description:c,...u})=>s.jsxs(m.Card,{className:m.cn("h-full",l),...u,children:[s.jsxs(m.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(m.CardTitle,{className:"text-sm font-medium",children:i}),d&&s.jsx("div",{className:"h-4 w-4 text-muted-foreground",children:d})]}),s.jsxs(m.CardContent,{children:[s.jsx("div",{className:"text-2xl font-bold",children:b}),(o||c)&&s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center mt-1",children:[o&&s.jsxs("span",{className:m.cn("flex items-center mr-2",o.direction==="up"&&"text-green-500",o.direction==="down"&&"text-red-500",o.direction==="neutral"&&"text-yellow-500"),children:[o.direction==="up"&&s.jsx(h.ArrowUpIcon,{className:"h-3 w-3 mr-1"}),o.direction==="down"&&s.jsx(h.ArrowDownIcon,{className:"h-3 w-3 mr-1"}),o.direction==="neutral"&&s.jsx(h.MinusIcon,{className:"h-3 w-3 mr-1"}),o.value,"%"]}),c||o?.label]})]})]});p.ComponentRegistry.register("dashboard",I,{label:"Dashboard",category:"Complex",icon:"layout-dashboard",inputs:[{name:"columns",type:"number",label:"Columns",defaultValue:3},{name:"gap",type:"number",label:"Gap",defaultValue:4},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:3,widgets:[]}}),p.ComponentRegistry.register("metric",Y,{label:"Metric Card",category:"Dashboard",inputs:[{name:"label",type:"string",label:"Label"},{name:"value",type:"string",label:"Value"}]}),f.DashboardRenderer=I,f.MetricWidget=Y,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}));
6
+ <%s key={someKey} {...props} />`,M,T,W,T),P[T+M]=!0)}if(T=null,k!==void 0&&(r(k),T=""+k),l(j)&&(r(j.key),T=""+j.key),"key"in j){k={};for(var N in j)N!=="key"&&(k[N]=j[N])}else k=j;return T&&u(k,typeof f=="function"?f.displayName||f.name||"Unknown":f),v(f,T,k,o(),X,I)}function p(f){w(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===R&&(f._payload.status==="fulfilled"?w(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function w(f){return typeof f=="object"&&f!==null&&f.$$typeof===_}var O=C,_=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),S=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),q=Symbol.for("react.client.reference"),V=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,$=Array.isArray,K=console.createTask?console.createTask:function(){return null};O={react_stack_bottom_frame:function(f){return f()}};var U,J={},le=O.react_stack_bottom_frame.bind(O,i)(),me=K(n(i)),P={};ct.Fragment=a,ct.jsx=function(f,j,k){var M=1e4>V.recentlyCreatedOwnerStacks++;return m(f,j,k,!1,M?Error("react-stack-top-frame"):le,M?K(n(f)):me)},ct.jsxs=function(f,j,k){var M=1e4>V.recentlyCreatedOwnerStacks++;return m(f,j,k,!0,M?Error("react-stack-top-frame"):le,M?K(n(f)):me)}})()),ct}var _r;function In(){return _r||(_r=1,process.env.NODE_ENV==="production"?St.exports=Nn():St.exports=An()),St.exports}var z=In();const Ln=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],Vt=C.forwardRef(({schema:e,className:t,dataSource:r,...n},o)=>{const i=e.columns||4,l=e.gap||4;return z.jsx("div",{ref:o,className:Q.cn("grid auto-rows-min",t),style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`,gap:`${l*.25}rem`},...n,children:e.widgets?.map(u=>{const v=(()=>{if(u.component)return u.component;const p=u.type;if(p==="bar"||p==="line"||p==="area"||p==="pie"||p==="donut"){const w=Array.isArray(u.data)?u.data:u.data?.items||[],O=u.options||{},_=O.xField||"name",c=O.yField||"value";return{type:"chart",chartType:p,data:w,xAxisKey:_,series:[{dataKey:c}],colors:Ln,className:"h-[300px]"}}return p==="table"?{type:"data-table",...u.options,data:u.data?.items||[],searchable:!1,pagination:!1,className:"border-0"}:{...u,...u.options||{}}})();return u.type==="metric"?z.jsx("div",{className:"h-full w-full",style:u.layout?{gridColumn:`span ${u.layout.w}`,gridRow:`span ${u.layout.h}`}:void 0,children:z.jsx(wt.SchemaRenderer,{schema:v,className:"h-full w-full"})},u.id||u.title):z.jsxs(Q.Card,{className:Q.cn("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md","bg-card/50 backdrop-blur-sm"),style:u.layout?{gridColumn:`span ${u.layout.w}`,gridRow:`span ${u.layout.h}`}:void 0,children:[u.title&&z.jsx(Q.CardHeader,{className:"pb-2 border-b border-border/40 bg-muted/20",children:z.jsx(Q.CardTitle,{className:"text-base font-medium tracking-tight truncate",title:u.title,children:u.title})}),z.jsx(Q.CardContent,{className:"p-0",children:z.jsx("div",{className:Q.cn("h-full w-full",(u.title,"p-4")),children:z.jsx(wt.SchemaRenderer,{schema:v})})})]},u.id||u.title)})})});function rt(e){const{margin:t,containerPadding:r,containerWidth:n,cols:o}=e;return(n-t[0]*(o-1)-r[0]*2)/o}function nt(e,t,r){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*r):e}function ft(e,t,r,n,o,i,l){const{margin:u,containerPadding:d,rowHeight:v}=e,m=rt(e);let p,w,O,_;if(l?(p=Math.round(l.width),w=Math.round(l.height)):(p=nt(n,m,u[0]),w=nt(o,v,u[1])),i?(O=Math.round(i.top),_=Math.round(i.left)):l?(O=Math.round(l.top),_=Math.round(l.left)):(O=Math.round((v+u[1])*r+d[1]),_=Math.round((m+u[0])*t+d[0])),!i&&!l){if(Number.isFinite(n)){const a=Math.round((m+u[0])*(t+n)+d[0])-_-p;a!==u[0]&&(p+=a-u[0])}if(Number.isFinite(o)){const a=Math.round((v+u[1])*(r+o)+d[1])-O-w;a!==u[1]&&(w+=a-u[1])}}return{top:O,left:_,width:p,height:w}}function Wn(e,t,r,n,o){const{margin:i,containerPadding:l,cols:u,rowHeight:d,maxRows:v}=e,m=rt(e);let p=Math.round((r-l[0])/(m+i[0])),w=Math.round((t-l[1])/(d+i[1]));return p=Et(p,0,u-n),w=Et(w,0,v-o),{x:p,y:w}}function Ct(e,t,r){const{margin:n,containerPadding:o,rowHeight:i}=e,l=rt(e),u=Math.round((r-o[0])/(l+n[0])),d=Math.round((t-o[1])/(i+n[1]));return{x:u,y:d}}function qn(e,t,r){const{margin:n,rowHeight:o}=e,i=rt(e),l=Math.max(1,Math.round((t+n[0])/(i+n[0]))),u=Math.max(1,Math.round((r+n[1])/(o+n[1])));return{w:l,h:u}}function Et(e,t,r){return Math.max(Math.min(e,r),t)}function Jt(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Ke(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(n!==void 0&&Jt(n,t))return n}}function Dr(e,t){return e.filter(r=>Jt(r,t))}function Hn(e,t){return t==="horizontal"?jr(e):t==="vertical"||t==="wrap"?Kt(e):[...e]}function Kt(e){return[...e].sort((t,r)=>t.y!==r.y?t.y-r.y:t.x-r.x)}function jr(e){return[...e].sort((t,r)=>t.x!==r.x?t.x-r.x:t.y-r.y)}function Pt(e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];if(n!==void 0){const o=n.y+n.h;o>t&&(t=o)}}return t}function Ze(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(n!==void 0&&n.i===t)return n}}function Ot(e){return e.filter(t=>t.static===!0)}function Qe(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function $e(e){const t=new Array(e.length);for(let r=0;r<e.length;r++){const n=e[r];n!==void 0&&(t[r]=Qe(n))}return t}function Yn(e,t){const r=new Array(e.length);for(let n=0;n<e.length;n++){const o=e[n];o!==void 0&&(t.i===o.i?r[n]=t:r[n]=o)}return r}function $n(e,t,r){let n=Ze(e,t);return n?(n=r(Qe(n)),[Yn(e,n),n]):[[...e],null]}function Zt(e,t){const r=Ot(e);for(let n=0;n<e.length;n++){const o=e[n];if(o!==void 0)if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),!o.static)r.push(o);else for(;Ke(r,o);)o.y++}return e}function et(e,t,r,n,o,i,l,u,d){if(t.static&&t.isDraggable!==!0)return[...e];if(t.y===n&&t.x===r)return[...e];const v=t.x,m=t.y;typeof r=="number"&&(t.x=r),typeof n=="number"&&(t.y=n),t.moved=!0;let p=Hn(e,l);(l==="vertical"&&typeof n=="number"?m>=n:l==="horizontal"&&typeof r=="number"&&v>=r)&&(p=p.reverse());const O=Dr(p,t),_=O.length>0;if(_&&d)return $e(e);if(_&&i)return t.x=v,t.y=m,t.moved=!1,e;let c=[...e];for(let a=0;a<O.length;a++){const s=O[a];s!==void 0&&(s.moved||(s.static?c=Tr(c,s,t,o,l):c=Tr(c,t,s,o,l)))}return c}function Tr(e,t,r,n,o,i){const l=o==="horizontal",u=o==="vertical",d=t.static;if(n){n=!1;const p={x:l?Math.max(t.x-r.w,0):r.x,y:u?Math.max(t.y-r.h,0):r.y,w:r.w,h:r.h,i:"-1"},w=Ke(e,p),O=w!==void 0&&w.y+w.h>t.y,_=w!==void 0&&t.x+t.w>w.x;if(!w)return et(e,r,l?p.x:void 0,u?p.y:void 0,n,d,o);if(O&&u)return et(e,r,void 0,r.y+1,n,d,o);if(O&&o===null)return t.y=r.y,r.y=r.y+r.h,[...e];if(_&&l)return et(e,t,r.x,void 0,n,d,o)}const v=l?r.x+1:void 0,m=u?r.y+1:void 0;return v===void 0&&m===void 0?[...e]:et(e,r,v,m,n,d,o)}function ot(e,t,r){return Math.max(t,Math.min(r,e))}var Bn={name:"gridBounds",constrainPosition(e,t,r,{cols:n,maxRows:o}){return{x:ot(t,0,Math.max(0,n-e.w)),y:ot(r,0,Math.max(0,o-e.h))}},constrainSize(e,t,r,n,{cols:o,maxRows:i}){const l=n==="w"||n==="nw"||n==="sw"?e.x+e.w:o-e.x,u=n==="n"||n==="nw"||n==="ne"?e.y+e.h:i-e.y;return{w:ot(t,1,Math.max(1,l)),h:ot(r,1,Math.max(1,u))}}},Fn={name:"minMaxSize",constrainSize(e,t,r){return{w:ot(t,e.minW??1,e.maxW??1/0),h:ot(r,e.minH??1,e.maxH??1/0)}}},Mr=[Bn,Fn];function Rt(e,t,r,n,o){let i={x:r,y:n};for(const l of e)l.constrainPosition&&(i=l.constrainPosition(t,i.x,i.y,o));if(t.constraints)for(const l of t.constraints)l.constrainPosition&&(i=l.constrainPosition(t,i.x,i.y,o));return i}function Xn(e,t,r,n,o,i){let l={w:r,h:n};for(const u of e)u.constrainSize&&(l=u.constrainSize(t,l.w,l.h,o,i));if(t.constraints)for(const u of t.constraints)u.constrainSize&&(l=u.constrainSize(t,l.w,l.h,o,i));return l}function zr({top:e,left:t,width:r,height:n}){const o=`translate(${t}px,${e}px)`;return{transform:o,WebkitTransform:o,MozTransform:o,msTransform:o,OTransform:o,width:`${r}px`,height:`${n}px`,position:"absolute"}}function Un({top:e,left:t,width:r,height:n}){return{top:`${e}px`,left:`${t}px`,width:`${r}px`,height:`${n}px`,position:"absolute"}}function kr(e){return e*100+"%"}function Gn(e,t,r,n){return e+r>n?t:r}function Nr(e,t,r){return e<0?t:r}function Vn(e){return Math.max(0,e)}function _t(e){return Math.max(0,e)}var Qt=(e,t,r)=>{const{left:n,height:o,width:i}=t,l=e.top-(o-e.height);return{left:n,width:i,height:Nr(l,e.height,o),top:_t(l)}},er=(e,t,r)=>{const{top:n,left:o,height:i,width:l}=t;return{top:n,height:i,width:Gn(e.left,e.width,l,r),left:Vn(o)}},tr=(e,t,r)=>{const{top:n,height:o,width:i}=t,l=e.left+e.width-i;return l<0?{height:o,width:e.left+e.width,top:_t(n),left:0}:{height:o,width:i,top:_t(n),left:l}},rr=(e,t,r)=>{const{top:n,left:o,height:i,width:l}=t;return{width:l,left:o,height:Nr(n,e.height,i),top:_t(n)}},Jn=(e,t,r)=>Qt(e,er(e,t,r)),Kn=(e,t,r)=>Qt(e,tr(e,t)),Zn=(e,t,r)=>rr(e,er(e,t,r)),Qn=(e,t,r)=>rr(e,tr(e,t)),eo={n:Qt,ne:Jn,e:er,se:Zn,s:rr,sw:Qn,w:tr,nw:Kn};function to(e,t,r,n){const o=eo[e];return o?o(t,{...t,...r},n):r}var ro={type:"transform",scale:1,calcStyle(e){return zr(e)}},no=ro,oo={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},ao={enabled:!0,bounded:!1,threshold:3},so={enabled:!0,handles:["se"]},io={enabled:!1,defaultItem:{w:1,h:1}};function nr(e,t,r,n,o){const i=n==="x"?"w":"h";t[n]+=1;const l=e.findIndex(d=>d.i===t.i),u=o??Ot(e).length>0;for(let d=l+1;d<e.length;d++){const v=e[d];if(v!==void 0&&!v.static){if(!u&&v.y>t.y+t.h)break;Jt(t,v)&&nr(e,v,r+t[i],n,u)}}t[n]=r}function lo(e,t,r,n){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(n,t.y);t.y>0&&!Ke(e,t);)t.y--;let o;for(;(o=Ke(e,t))!==void 0;)nr(r,t,o.y+o.h,"y");return t.y=Math.max(t.y,0),t}function uo(e,t,r,n){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!Ke(e,t);)t.x--;let o;for(;(o=Ke(e,t))!==void 0;)if(nr(n,t,o.x+o.w,"x"),t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Ke(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Ar={type:"vertical",allowOverlap:!1,compact(e,t){const r=Ot(e);let n=Pt(r);const o=Kt(e),i=new Array(e.length);for(let l=0;l<o.length;l++){const u=o[l];if(u===void 0)continue;let d=Qe(u);d.static||(d=lo(r,d,o,n),n=Math.max(n,d.y+d.h),r.push(d));const v=e.indexOf(u);i[v]=d,d.moved=!1}return i}},Ir={type:"horizontal",allowOverlap:!1,compact(e,t){const r=Ot(e),n=jr(e),o=new Array(e.length);for(let i=0;i<n.length;i++){const l=n[i];if(l===void 0)continue;let u=Qe(l);u.static||(u=uo(r,u,t,n),r.push(u));const d=e.indexOf(l);o[d]=u,u.moved=!1}return o}},Lr={type:null,allowOverlap:!1,compact(e,t){return $e(e)}},co={...Ar,allowOverlap:!0,compact(e,t){return $e(e)}},fo={...Ir,allowOverlap:!0,compact(e,t){return $e(e)}},po={...Lr,allowOverlap:!0};function or(e,t=!1,r=!1){let n;return t?e==="vertical"?n=co:e==="horizontal"?n=fo:n=po:e==="vertical"?n=Ar:e==="horizontal"?n=Ir:n=Lr,r?{...n,preventCollision:r}:n}function Wr(e){return Object.keys(e).sort((r,n)=>e[r]-e[n])}function qr(e,t){const r=Wr(e);let n=r[0];if(n===void 0)throw new Error("No breakpoints defined");for(let o=1;o<r.length;o++){const i=r[o];if(i===void 0)continue;const l=e[i];t>l&&(n=i)}return n}function Hr(e,t){const r=t[e];if(r===void 0)throw new Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return r}function ar(e,t,r,n,o,i){const l=e[r];if(l)return $e(l);let u=e[n];const d=Wr(t),v=d.slice(d.indexOf(r));for(let O=0;O<v.length;O++){const _=v[O];if(_===void 0)continue;const c=e[_];if(c){u=c;break}}const m=$e(u||[]),p=Zt(m,{cols:o});return(typeof i=="object"&&i!==null?i:or(i)).compact(p,o)}function Dt(e,t){if(Array.isArray(e))return e;const r=e,n=r[t];if(n!==void 0)return n;const o=Object.keys(r);for(const i of o){const l=r[i];if(l!==void 0)return l}return[10,10]}function Yr(e){return function(r,n,o,i,l,u,d){return e(r,n,d)}}function jt(e){return function(r,n,o,i){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o,i);var l=i.get(r),u=i.get(n);if(l&&u)return l===n&&u===r;i.set(r,n),i.set(n,r);var d=e(r,n,o,i);return i.delete(r),i.delete(n),d}}function $r(e,t){var r={};for(var n in e)r[n]=e[n];for(var n in t)r[n]=t[n];return r}function Br(e){return e.constructor===Object||e.constructor==null}function Fr(e){return typeof e.then=="function"}function Tt(e,t){return e===t||e!==e&&t!==t}var ho="[object Arguments]",go="[object Boolean]",mo="[object Date]",yo="[object RegExp]",vo="[object Map]",bo="[object Number]",xo="[object Object]",wo="[object Set]",So="[object String]",Xr=Object.prototype.toString;function Mt(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areMapsEqual,o=e.areObjectsEqual,i=e.areRegExpsEqual,l=e.areSetsEqual,u=e.createIsNestedEqual,d=u(v);function v(m,p,w){if(m===p)return!0;if(!m||!p||typeof m!="object"||typeof p!="object")return m!==m&&p!==p;if(Br(m)&&Br(p))return o(m,p,d,w);var O=Array.isArray(m),_=Array.isArray(p);if(O||_)return O===_&&t(m,p,d,w);var c=Xr.call(m);return c!==Xr.call(p)?!1:c===mo?r(m,p,d,w):c===yo?i(m,p,d,w):c===vo?n(m,p,d,w):c===wo?l(m,p,d,w):c===xo||c===ho?Fr(m)||Fr(p)?!1:o(m,p,d,w):c===go||c===bo||c===So?Tt(m.valueOf(),p.valueOf()):!1}return v}function Ur(e,t,r,n){var o=e.length;if(t.length!==o)return!1;for(;o-- >0;)if(!r(e[o],t[o],o,o,e,t,n))return!1;return!0}var Co=jt(Ur);function Gr(e,t){return Tt(e.valueOf(),t.valueOf())}function Vr(e,t,r,n){var o=e.size===t.size;if(!o)return!1;if(!e.size)return!0;var i={},l=0;return e.forEach(function(u,d){if(o){var v=!1,m=0;t.forEach(function(p,w){!v&&!i[m]&&(v=r(d,w,l,m,e,t,n)&&r(u,p,d,w,e,t,n))&&(i[m]=!0),m++}),l++,o=v}}),o}var Eo=jt(Vr),Po="_owner",Oo=Object.prototype.hasOwnProperty;function Jr(e,t,r,n){var o=Object.keys(e),i=o.length;if(Object.keys(t).length!==i)return!1;for(var l;i-- >0;){if(l=o[i],l===Po){var u=!!e.$$typeof,d=!!t.$$typeof;if((u||d)&&u!==d)return!1}if(!Oo.call(t,l)||!r(e[l],t[l],l,l,e,t,n))return!1}return!0}var Ro=jt(Jr);function Kr(e,t){return e.source===t.source&&e.flags===t.flags}function Zr(e,t,r,n){var o=e.size===t.size;if(!o)return!1;if(!e.size)return!0;var i={};return e.forEach(function(l,u){if(o){var d=!1,v=0;t.forEach(function(m,p){!d&&!i[v]&&(d=r(l,m,u,p,e,t,n))&&(i[v]=!0),v++}),o=d}}),o}var _o=jt(Zr),Qr=Object.freeze({areArraysEqual:Ur,areDatesEqual:Gr,areMapsEqual:Vr,areObjectsEqual:Jr,areRegExpsEqual:Kr,areSetsEqual:Zr,createIsNestedEqual:Yr}),en=Object.freeze({areArraysEqual:Co,areDatesEqual:Gr,areMapsEqual:Eo,areObjectsEqual:Ro,areRegExpsEqual:Kr,areSetsEqual:_o,createIsNestedEqual:Yr}),Do=Mt(Qr);function We(e,t){return Do(e,t,void 0)}Mt($r(Qr,{createIsNestedEqual:function(){return Tt}})),Mt(en),Mt($r(en,{createIsNestedEqual:function(){return Tt}}));function jo(e={}){const{measureBeforeMount:t=!1,initialWidth:r=1280}=e,[n,o]=C.useState(r),[i,l]=C.useState(!t),u=C.useRef(null),d=C.useRef(null),v=C.useCallback(()=>{const m=u.current;if(m){const p=m.offsetWidth;o(p),i||l(!0)}},[i]);return C.useEffect(()=>{const m=u.current;if(m)return v(),typeof ResizeObserver<"u"&&(d.current=new ResizeObserver(p=>{const w=p[0];if(w){const O=w.contentRect.width;o(O)}}),d.current.observe(m)),()=>{d.current&&(d.current.disconnect(),d.current=null)}},[v]),{width:n,mounted:i,containerRef:u,measureWidth:v}}var dt={exports:{}},sr={},zt={exports:{}},kt={exports:{}},ee={};var tn;function To(){if(tn)return ee;tn=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,d=e?Symbol.for("react.async_mode"):60111,v=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,w=e?Symbol.for("react.suspense_list"):60120,O=e?Symbol.for("react.memo"):60115,_=e?Symbol.for("react.lazy"):60116,c=e?Symbol.for("react.block"):60121,a=e?Symbol.for("react.fundamental"):60117,s=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function y(b){if(typeof b=="object"&&b!==null){var E=b.$$typeof;switch(E){case t:switch(b=b.type,b){case d:case v:case n:case i:case o:case p:return b;default:switch(b=b&&b.$$typeof,b){case u:case m:case _:case O:case l:return b;default:return E}}case r:return E}}}function S(b){return y(b)===v}return ee.AsyncMode=d,ee.ConcurrentMode=v,ee.ContextConsumer=u,ee.ContextProvider=l,ee.Element=t,ee.ForwardRef=m,ee.Fragment=n,ee.Lazy=_,ee.Memo=O,ee.Portal=r,ee.Profiler=i,ee.StrictMode=o,ee.Suspense=p,ee.isAsyncMode=function(b){return S(b)||y(b)===d},ee.isConcurrentMode=S,ee.isContextConsumer=function(b){return y(b)===u},ee.isContextProvider=function(b){return y(b)===l},ee.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===t},ee.isForwardRef=function(b){return y(b)===m},ee.isFragment=function(b){return y(b)===n},ee.isLazy=function(b){return y(b)===_},ee.isMemo=function(b){return y(b)===O},ee.isPortal=function(b){return y(b)===r},ee.isProfiler=function(b){return y(b)===i},ee.isStrictMode=function(b){return y(b)===o},ee.isSuspense=function(b){return y(b)===p},ee.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===n||b===v||b===i||b===o||b===p||b===w||typeof b=="object"&&b!==null&&(b.$$typeof===_||b.$$typeof===O||b.$$typeof===l||b.$$typeof===u||b.$$typeof===m||b.$$typeof===a||b.$$typeof===s||b.$$typeof===h||b.$$typeof===c)},ee.typeOf=y,ee}var te={};var rn;function Mo(){return rn||(rn=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,d=e?Symbol.for("react.async_mode"):60111,v=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,w=e?Symbol.for("react.suspense_list"):60120,O=e?Symbol.for("react.memo"):60115,_=e?Symbol.for("react.lazy"):60116,c=e?Symbol.for("react.block"):60121,a=e?Symbol.for("react.fundamental"):60117,s=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function y(D){return typeof D=="string"||typeof D=="function"||D===n||D===v||D===i||D===o||D===p||D===w||typeof D=="object"&&D!==null&&(D.$$typeof===_||D.$$typeof===O||D.$$typeof===l||D.$$typeof===u||D.$$typeof===m||D.$$typeof===a||D.$$typeof===s||D.$$typeof===h||D.$$typeof===c)}function S(D){if(typeof D=="object"&&D!==null){var ae=D.$$typeof;switch(ae){case t:var De=D.type;switch(De){case d:case v:case n:case i:case o:case p:return De;default:var Re=De&&De.$$typeof;switch(Re){case u:case m:case _:case O:case l:return Re;default:return ae}}case r:return ae}}}var b=d,E=v,g=u,x=l,R=t,Y=m,q=n,V=_,A=O,$=r,K=i,U=o,J=p,le=!1;function me(D){return le||(le=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(D)||S(D)===d}function P(D){return S(D)===v}function f(D){return S(D)===u}function j(D){return S(D)===l}function k(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function M(D){return S(D)===m}function X(D){return S(D)===n}function I(D){return S(D)===_}function T(D){return S(D)===O}function W(D){return S(D)===r}function N(D){return S(D)===i}function H(D){return S(D)===o}function F(D){return S(D)===p}te.AsyncMode=b,te.ConcurrentMode=E,te.ContextConsumer=g,te.ContextProvider=x,te.Element=R,te.ForwardRef=Y,te.Fragment=q,te.Lazy=V,te.Memo=A,te.Portal=$,te.Profiler=K,te.StrictMode=U,te.Suspense=J,te.isAsyncMode=me,te.isConcurrentMode=P,te.isContextConsumer=f,te.isContextProvider=j,te.isElement=k,te.isForwardRef=M,te.isFragment=X,te.isLazy=I,te.isMemo=T,te.isPortal=W,te.isProfiler=N,te.isStrictMode=H,te.isSuspense=F,te.isValidElementType=y,te.typeOf=S})()),te}var nn;function on(){return nn||(nn=1,process.env.NODE_ENV==="production"?kt.exports=To():kt.exports=Mo()),kt.exports}var ir,an;function zo(){if(an)return ir;an=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var l={},u=0;u<10;u++)l["_"+String.fromCharCode(u)]=u;var d=Object.getOwnPropertyNames(l).map(function(m){return l[m]});if(d.join("")!=="0123456789")return!1;var v={};return"abcdefghijklmnopqrst".split("").forEach(function(m){v[m]=m}),Object.keys(Object.assign({},v)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ir=o()?Object.assign:function(i,l){for(var u,d=n(i),v,m=1;m<arguments.length;m++){u=Object(arguments[m]);for(var p in u)t.call(u,p)&&(d[p]=u[p]);if(e){v=e(u);for(var w=0;w<v.length;w++)r.call(u,v[w])&&(d[v[w]]=u[v[w]])}}return d},ir}var lr,sn;function ur(){if(sn)return lr;sn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return lr=e,lr}var cr,ln;function un(){return ln||(ln=1,cr=Function.call.bind(Object.prototype.hasOwnProperty)),cr}var fr,cn;function ko(){if(cn)return fr;cn=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=ur(),r={},n=un();e=function(i){var l="Warning: "+i;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}}}function o(i,l,u,d,v){if(process.env.NODE_ENV!=="production"){for(var m in i)if(n(i,m)){var p;try{if(typeof i[m]!="function"){var w=Error((d||"React class")+": "+u+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw w.name="Invariant Violation",w}p=i[m](l,m,d,u,null,t)}catch(_){p=_}if(p&&!(p instanceof Error)&&e((d||"React class")+": type specification of "+u+" `"+m+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof p+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),p instanceof Error&&!(p.message in r)){r[p.message]=!0;var O=v?v():"";e("Failed "+u+" type: "+p.message+(O??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},fr=o,fr}var dr,fn;function No(){if(fn)return dr;fn=1;var e=on(),t=zo(),r=ur(),n=un(),o=ko(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(u){var d="Warning: "+u;typeof console<"u"&&console.error(d);try{throw new Error(d)}catch{}});function l(){return null}return dr=function(u,d){var v=typeof Symbol=="function"&&Symbol.iterator,m="@@iterator";function p(P){var f=P&&(v&&P[v]||P[m]);if(typeof f=="function")return f}var w="<<anonymous>>",O={array:s("array"),bigint:s("bigint"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:h(),arrayOf:y,element:S(),elementType:b(),instanceOf:E,node:Y(),objectOf:x,oneOf:g,oneOfType:R,shape:V,exact:A};function _(P,f){return P===f?P!==0||1/P===1/f:P!==P&&f!==f}function c(P,f){this.message=P,this.data=f&&typeof f=="object"?f:{},this.stack=""}c.prototype=Error.prototype;function a(P){if(process.env.NODE_ENV!=="production")var f={},j=0;function k(X,I,T,W,N,H,F){if(W=W||w,H=H||T,F!==r){if(d){var D=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw D.name="Invariant Violation",D}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ae=W+":"+T;!f[ae]&&j<3&&(i("You are manually calling a React.PropTypes validation function for the `"+H+"` prop on `"+W+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),f[ae]=!0,j++)}}return I[T]==null?X?I[T]===null?new c("The "+N+" `"+H+"` is marked as required "+("in `"+W+"`, but its value is `null`.")):new c("The "+N+" `"+H+"` is marked as required in "+("`"+W+"`, but its value is `undefined`.")):null:P(I,T,W,N,H)}var M=k.bind(null,!1);return M.isRequired=k.bind(null,!0),M}function s(P){function f(j,k,M,X,I,T){var W=j[k],N=U(W);if(N!==P){var H=J(W);return new c("Invalid "+X+" `"+I+"` of type "+("`"+H+"` supplied to `"+M+"`, expected ")+("`"+P+"`."),{expectedType:P})}return null}return a(f)}function h(){return a(l)}function y(P){function f(j,k,M,X,I){if(typeof P!="function")return new c("Property `"+I+"` of component `"+M+"` has invalid PropType notation inside arrayOf.");var T=j[k];if(!Array.isArray(T)){var W=U(T);return new c("Invalid "+X+" `"+I+"` of type "+("`"+W+"` supplied to `"+M+"`, expected an array."))}for(var N=0;N<T.length;N++){var H=P(T,N,M,X,I+"["+N+"]",r);if(H instanceof Error)return H}return null}return a(f)}function S(){function P(f,j,k,M,X){var I=f[j];if(!u(I)){var T=U(I);return new c("Invalid "+M+" `"+X+"` of type "+("`"+T+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return a(P)}function b(){function P(f,j,k,M,X){var I=f[j];if(!e.isValidElementType(I)){var T=U(I);return new c("Invalid "+M+" `"+X+"` of type "+("`"+T+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return a(P)}function E(P){function f(j,k,M,X,I){if(!(j[k]instanceof P)){var T=P.name||w,W=me(j[k]);return new c("Invalid "+X+" `"+I+"` of type "+("`"+W+"` supplied to `"+M+"`, expected ")+("instance of `"+T+"`."))}return null}return a(f)}function g(P){if(!Array.isArray(P))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),l;function f(j,k,M,X,I){for(var T=j[k],W=0;W<P.length;W++)if(_(T,P[W]))return null;var N=JSON.stringify(P,function(F,D){var ae=J(D);return ae==="symbol"?String(D):D});return new c("Invalid "+X+" `"+I+"` of value `"+String(T)+"` "+("supplied to `"+M+"`, expected one of "+N+"."))}return a(f)}function x(P){function f(j,k,M,X,I){if(typeof P!="function")return new c("Property `"+I+"` of component `"+M+"` has invalid PropType notation inside objectOf.");var T=j[k],W=U(T);if(W!=="object")return new c("Invalid "+X+" `"+I+"` of type "+("`"+W+"` supplied to `"+M+"`, expected an object."));for(var N in T)if(n(T,N)){var H=P(T,N,M,X,I+"."+N,r);if(H instanceof Error)return H}return null}return a(f)}function R(P){if(!Array.isArray(P))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var f=0;f<P.length;f++){var j=P[f];if(typeof j!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+le(j)+" at index "+f+"."),l}function k(M,X,I,T,W){for(var N=[],H=0;H<P.length;H++){var F=P[H],D=F(M,X,I,T,W,r);if(D==null)return null;D.data&&n(D.data,"expectedType")&&N.push(D.data.expectedType)}var ae=N.length>0?", expected one of type ["+N.join(", ")+"]":"";return new c("Invalid "+T+" `"+W+"` supplied to "+("`"+I+"`"+ae+"."))}return a(k)}function Y(){function P(f,j,k,M,X){return $(f[j])?null:new c("Invalid "+M+" `"+X+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return a(P)}function q(P,f,j,k,M){return new c((P||"React class")+": "+f+" type `"+j+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+M+"`.")}function V(P){function f(j,k,M,X,I){var T=j[k],W=U(T);if(W!=="object")return new c("Invalid "+X+" `"+I+"` of type `"+W+"` "+("supplied to `"+M+"`, expected `object`."));for(var N in P){var H=P[N];if(typeof H!="function")return q(M,X,I,N,J(H));var F=H(T,N,M,X,I+"."+N,r);if(F)return F}return null}return a(f)}function A(P){function f(j,k,M,X,I){var T=j[k],W=U(T);if(W!=="object")return new c("Invalid "+X+" `"+I+"` of type `"+W+"` "+("supplied to `"+M+"`, expected `object`."));var N=t({},j[k],P);for(var H in N){var F=P[H];if(n(P,H)&&typeof F!="function")return q(M,X,I,H,J(F));if(!F)return new c("Invalid "+X+" `"+I+"` key `"+H+"` supplied to `"+M+"`.\nBad object: "+JSON.stringify(j[k],null," ")+`
7
+ Valid keys: `+JSON.stringify(Object.keys(P),null," "));var D=F(T,H,M,X,I+"."+H,r);if(D)return D}return null}return a(f)}function $(P){switch(typeof P){case"number":case"string":case"undefined":return!0;case"boolean":return!P;case"object":if(Array.isArray(P))return P.every($);if(P===null||u(P))return!0;var f=p(P);if(f){var j=f.call(P),k;if(f!==P.entries){for(;!(k=j.next()).done;)if(!$(k.value))return!1}else for(;!(k=j.next()).done;){var M=k.value;if(M&&!$(M[1]))return!1}}else return!1;return!0;default:return!1}}function K(P,f){return P==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function U(P){var f=typeof P;return Array.isArray(P)?"array":P instanceof RegExp?"object":K(f,P)?"symbol":f}function J(P){if(typeof P>"u"||P===null)return""+P;var f=U(P);if(f==="object"){if(P instanceof Date)return"date";if(P instanceof RegExp)return"regexp"}return f}function le(P){var f=J(P);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function me(P){return!P.constructor||!P.constructor.name?w:P.constructor.name}return O.checkPropTypes=o,O.resetWarningCache=o.resetWarningCache,O.PropTypes=O,O},dr}var pr,dn;function Ao(){if(dn)return pr;dn=1;var e=ur();function t(){}function r(){}return r.resetWarningCache=t,pr=function(){function n(l,u,d,v,m,p){if(p!==e){var w=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw w.name="Invariant Violation",w}}n.isRequired=n;function o(){return n}var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i},pr}var pn;function Nt(){if(pn)return zt.exports;if(pn=1,process.env.NODE_ENV!=="production"){var e=on(),t=!0;zt.exports=No()(e.isElement,t)}else zt.exports=Ao()();return zt.exports}var ge={},Be={},hn;function At(){if(hn)return Be;hn=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.dontSetMe=o,Be.findInArray=e,Be.int=n,Be.isFunction=t,Be.isNum=r;function e(i,l){for(let u=0,d=i.length;u<d;u++)if(l.apply(l,[i[u],u,i]))return i[u]}function t(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Function]"}function r(i){return typeof i=="number"&&!isNaN(i)}function n(i){return parseInt(i,10)}function o(i,l,u){if(i[l])return new Error(`Invalid prop ${l} passed to ${u} - do not set this, set it on the child.`)}return Be}var Fe={},gn;function Io(){if(gn)return Fe;gn=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.browserPrefixToKey=r,Fe.browserPrefixToStyle=n,Fe.default=void 0,Fe.getPrefix=t;const e=["Moz","Webkit","O","ms"];function t(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const l=window.document?.documentElement?.style;if(!l||i in l)return"";for(let u=0;u<e.length;u++)if(r(i,e[u])in l)return e[u];return""}function r(i,l){return l?`${l}${o(i)}`:i}function n(i,l){return l?`-${l.toLowerCase()}-${i}`:i}function o(i){let l="",u=!0;for(let d=0;d<i.length;d++)u?(l+=i[d].toUpperCase(),u=!1):i[d]==="-"?u=!0:l+=i[d];return l}return Fe.default=t(),Fe}var mn;function hr(){if(mn)return ge;mn=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.addClassName=b,ge.addEvent=l,ge.addUserSelectStyles=h,ge.createCSSTransform=O,ge.createSVGTransform=_,ge.getTouch=a,ge.getTouchIdentifier=s,ge.getTranslation=c,ge.innerHeight=m,ge.innerWidth=p,ge.matchesSelector=o,ge.matchesSelectorAndParentsTo=i,ge.offsetXYFromParent=w,ge.outerHeight=d,ge.outerWidth=v,ge.removeClassName=E,ge.removeEvent=u,ge.scheduleRemoveUserSelectStyles=y;var e=At(),t=r(Io());function r(g,x){if(typeof WeakMap=="function")var R=new WeakMap,Y=new WeakMap;return(r=function(q,V){if(!V&&q&&q.__esModule)return q;var A,$,K={__proto__:null,default:q};if(q===null||typeof q!="object"&&typeof q!="function")return K;if(A=V?Y:R){if(A.has(q))return A.get(q);A.set(q,K)}for(const U in q)U!=="default"&&{}.hasOwnProperty.call(q,U)&&(($=(A=Object.defineProperty)&&Object.getOwnPropertyDescriptor(q,U))&&($.get||$.set)?A(K,U,$):K[U]=q[U]);return K})(g,x)}let n="";function o(g,x){return n||(n=(0,e.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(R){return(0,e.isFunction)(g[R])})),(0,e.isFunction)(g[n])?g[n](x):!1}function i(g,x,R){let Y=g;do{if(o(Y,x))return!0;if(Y===R)return!1;Y=Y.parentNode}while(Y);return!1}function l(g,x,R,Y){if(!g)return;const q={capture:!0,...Y};g.addEventListener?g.addEventListener(x,R,q):g.attachEvent?g.attachEvent("on"+x,R):g["on"+x]=R}function u(g,x,R,Y){if(!g)return;const q={capture:!0,...Y};g.removeEventListener?g.removeEventListener(x,R,q):g.detachEvent?g.detachEvent("on"+x,R):g["on"+x]=null}function d(g){let x=g.clientHeight;const R=g.ownerDocument.defaultView.getComputedStyle(g);return x+=(0,e.int)(R.borderTopWidth),x+=(0,e.int)(R.borderBottomWidth),x}function v(g){let x=g.clientWidth;const R=g.ownerDocument.defaultView.getComputedStyle(g);return x+=(0,e.int)(R.borderLeftWidth),x+=(0,e.int)(R.borderRightWidth),x}function m(g){let x=g.clientHeight;const R=g.ownerDocument.defaultView.getComputedStyle(g);return x-=(0,e.int)(R.paddingTop),x-=(0,e.int)(R.paddingBottom),x}function p(g){let x=g.clientWidth;const R=g.ownerDocument.defaultView.getComputedStyle(g);return x-=(0,e.int)(R.paddingLeft),x-=(0,e.int)(R.paddingRight),x}function w(g,x,R){const q=x===x.ownerDocument.body?{left:0,top:0}:x.getBoundingClientRect(),V=(g.clientX+x.scrollLeft-q.left)/R,A=(g.clientY+x.scrollTop-q.top)/R;return{x:V,y:A}}function O(g,x){const R=c(g,x,"px");return{[(0,t.browserPrefixToKey)("transform",t.default)]:R}}function _(g,x){return c(g,x,"")}function c(g,x,R){let{x:Y,y:q}=g,V=`translate(${Y}${R},${q}${R})`;if(x){const A=`${typeof x.x=="string"?x.x:x.x+R}`,$=`${typeof x.y=="string"?x.y:x.y+R}`;V=`translate(${A}, ${$})`+V}return V}function a(g,x){return g.targetTouches&&(0,e.findInArray)(g.targetTouches,R=>x===R.identifier)||g.changedTouches&&(0,e.findInArray)(g.changedTouches,R=>x===R.identifier)}function s(g){if(g.targetTouches&&g.targetTouches[0])return g.targetTouches[0].identifier;if(g.changedTouches&&g.changedTouches[0])return g.changedTouches[0].identifier}function h(g){if(!g)return;let x=g.getElementById("react-draggable-style-el");x||(x=g.createElement("style"),x.type="text/css",x.id="react-draggable-style-el",x.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
8
+ `,x.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
9
+ `,g.getElementsByTagName("head")[0].appendChild(x)),g.body&&b(g.body,"react-draggable-transparent-selection")}function y(g){window.requestAnimationFrame?window.requestAnimationFrame(()=>{S(g)}):S(g)}function S(g){if(g)try{if(g.body&&E(g.body,"react-draggable-transparent-selection"),g.selection)g.selection.empty();else{const x=(g.defaultView||window).getSelection();x&&x.type!=="Caret"&&x.removeAllRanges()}}catch{}}function b(g,x){g.classList?g.classList.add(x):g.className.match(new RegExp(`(?:^|\\s)${x}(?!\\S)`))||(g.className+=` ${x}`)}function E(g,x){g.classList?g.classList.remove(x):g.className=g.className.replace(new RegExp(`(?:^|\\s)${x}(?!\\S)`,"g"),"")}return ge}var Ae={},yn;function vn(){if(yn)return Ae;yn=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.canDragX=o,Ae.canDragY=i,Ae.createCoreData=u,Ae.createDraggableData=d,Ae.getBoundPosition=r,Ae.getControlPosition=l,Ae.snapToGrid=n;var e=At(),t=hr();function r(p,w,O){if(!p.props.bounds)return[w,O];let{bounds:_}=p.props;_=typeof _=="string"?_:v(_);const c=m(p);if(typeof _=="string"){const{ownerDocument:a}=c,s=a.defaultView;let h;if(_==="parent"?h=c.parentNode:h=c.getRootNode().querySelector(_),!(h instanceof s.HTMLElement))throw new Error('Bounds selector "'+_+'" could not find an element.');const y=h,S=s.getComputedStyle(c),b=s.getComputedStyle(y);_={left:-c.offsetLeft+(0,e.int)(b.paddingLeft)+(0,e.int)(S.marginLeft),top:-c.offsetTop+(0,e.int)(b.paddingTop)+(0,e.int)(S.marginTop),right:(0,t.innerWidth)(y)-(0,t.outerWidth)(c)-c.offsetLeft+(0,e.int)(b.paddingRight)-(0,e.int)(S.marginRight),bottom:(0,t.innerHeight)(y)-(0,t.outerHeight)(c)-c.offsetTop+(0,e.int)(b.paddingBottom)-(0,e.int)(S.marginBottom)}}return(0,e.isNum)(_.right)&&(w=Math.min(w,_.right)),(0,e.isNum)(_.bottom)&&(O=Math.min(O,_.bottom)),(0,e.isNum)(_.left)&&(w=Math.max(w,_.left)),(0,e.isNum)(_.top)&&(O=Math.max(O,_.top)),[w,O]}function n(p,w,O){const _=Math.round(w/p[0])*p[0],c=Math.round(O/p[1])*p[1];return[_,c]}function o(p){return p.props.axis==="both"||p.props.axis==="x"}function i(p){return p.props.axis==="both"||p.props.axis==="y"}function l(p,w,O){const _=typeof w=="number"?(0,t.getTouch)(p,w):null;if(typeof w=="number"&&!_)return null;const c=m(O),a=O.props.offsetParent||c.offsetParent||c.ownerDocument.body;return(0,t.offsetXYFromParent)(_||p,a,O.props.scale)}function u(p,w,O){const _=!(0,e.isNum)(p.lastX),c=m(p);return _?{node:c,deltaX:0,deltaY:0,lastX:w,lastY:O,x:w,y:O}:{node:c,deltaX:w-p.lastX,deltaY:O-p.lastY,lastX:p.lastX,lastY:p.lastY,x:w,y:O}}function d(p,w){const O=p.props.scale;return{node:w.node,x:p.state.x+w.deltaX/O,y:p.state.y+w.deltaY/O,deltaX:w.deltaX/O,deltaY:w.deltaY/O,lastX:p.state.x,lastY:p.state.y}}function v(p){return{left:p.left,top:p.top,right:p.right,bottom:p.bottom}}function m(p){const w=p.findDOMNode();if(!w)throw new Error("<DraggableCore>: Unmounted during event!");return w}return Ae}var pt={},It={},bn;function xn(){if(bn)return It;bn=1,Object.defineProperty(It,"__esModule",{value:!0}),It.default=e;function e(){}return It}var wn;function Lo(){if(wn)return pt;wn=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.default=void 0;var e=d(C),t=u(Nt()),r=u(Cr),n=hr(),o=vn(),i=At(),l=u(xn());function u(c){return c&&c.__esModule?c:{default:c}}function d(c,a){if(typeof WeakMap=="function")var s=new WeakMap,h=new WeakMap;return(d=function(y,S){if(!S&&y&&y.__esModule)return y;var b,E,g={__proto__:null,default:y};if(y===null||typeof y!="object"&&typeof y!="function")return g;if(b=S?h:s){if(b.has(y))return b.get(y);b.set(y,g)}for(const x in y)x!=="default"&&{}.hasOwnProperty.call(y,x)&&((E=(b=Object.defineProperty)&&Object.getOwnPropertyDescriptor(y,x))&&(E.get||E.set)?b(g,x,E):g[x]=y[x]);return g})(c,a)}function v(c,a,s){return(a=m(a))in c?Object.defineProperty(c,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):c[a]=s,c}function m(c){var a=p(c,"string");return typeof a=="symbol"?a:a+""}function p(c,a){if(typeof c!="object"||!c)return c;var s=c[Symbol.toPrimitive];if(s!==void 0){var h=s.call(c,a);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(c)}const w={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let O=w.mouse,_=class extends e.Component{constructor(){super(...arguments),v(this,"dragging",!1),v(this,"lastX",NaN),v(this,"lastY",NaN),v(this,"touchIdentifier",null),v(this,"mounted",!1),v(this,"handleDragStart",a=>{if(this.props.onMouseDown(a),!this.props.allowAnyClick&&typeof a.button=="number"&&a.button!==0)return!1;const s=this.findDOMNode();if(!s||!s.ownerDocument||!s.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:h}=s;if(this.props.disabled||!(a.target instanceof h.defaultView.Node)||this.props.handle&&!(0,n.matchesSelectorAndParentsTo)(a.target,this.props.handle,s)||this.props.cancel&&(0,n.matchesSelectorAndParentsTo)(a.target,this.props.cancel,s))return;a.type==="touchstart"&&!this.props.allowMobileScroll&&a.preventDefault();const y=(0,n.getTouchIdentifier)(a);this.touchIdentifier=y;const S=(0,o.getControlPosition)(a,y,this);if(S==null)return;const{x:b,y:E}=S,g=(0,o.createCoreData)(this,b,E);(0,l.default)("DraggableCore: handleDragStart: %j",g),(0,l.default)("calling",this.props.onStart),!(this.props.onStart(a,g)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,n.addUserSelectStyles)(h),this.dragging=!0,this.lastX=b,this.lastY=E,(0,n.addEvent)(h,O.move,this.handleDrag),(0,n.addEvent)(h,O.stop,this.handleDragStop))}),v(this,"handleDrag",a=>{const s=(0,o.getControlPosition)(a,this.touchIdentifier,this);if(s==null)return;let{x:h,y}=s;if(Array.isArray(this.props.grid)){let E=h-this.lastX,g=y-this.lastY;if([E,g]=(0,o.snapToGrid)(this.props.grid,E,g),!E&&!g)return;h=this.lastX+E,y=this.lastY+g}const S=(0,o.createCoreData)(this,h,y);if((0,l.default)("DraggableCore: handleDrag: %j",S),this.props.onDrag(a,S)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const g=document.createEvent("MouseEvents");g.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(g)}return}this.lastX=h,this.lastY=y}),v(this,"handleDragStop",a=>{if(!this.dragging)return;const s=(0,o.getControlPosition)(a,this.touchIdentifier,this);if(s==null)return;let{x:h,y}=s;if(Array.isArray(this.props.grid)){let g=h-this.lastX||0,x=y-this.lastY||0;[g,x]=(0,o.snapToGrid)(this.props.grid,g,x),h=this.lastX+g,y=this.lastY+x}const S=(0,o.createCoreData)(this,h,y);if(this.props.onStop(a,S)===!1||this.mounted===!1)return!1;const E=this.findDOMNode();E&&this.props.enableUserSelectHack&&(0,n.scheduleRemoveUserSelectStyles)(E.ownerDocument),(0,l.default)("DraggableCore: handleDragStop: %j",S),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,E&&((0,l.default)("DraggableCore: Removing handlers"),(0,n.removeEvent)(E.ownerDocument,O.move,this.handleDrag),(0,n.removeEvent)(E.ownerDocument,O.stop,this.handleDragStop))}),v(this,"onMouseDown",a=>(O=w.mouse,this.handleDragStart(a))),v(this,"onMouseUp",a=>(O=w.mouse,this.handleDragStop(a))),v(this,"onTouchStart",a=>(O=w.touch,this.handleDragStart(a))),v(this,"onTouchEnd",a=>(O=w.touch,this.handleDragStop(a)))}componentDidMount(){this.mounted=!0;const a=this.findDOMNode();a&&(0,n.addEvent)(a,w.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const a=this.findDOMNode();if(a){const{ownerDocument:s}=a;(0,n.removeEvent)(s,w.mouse.move,this.handleDrag),(0,n.removeEvent)(s,w.touch.move,this.handleDrag),(0,n.removeEvent)(s,w.mouse.stop,this.handleDragStop),(0,n.removeEvent)(s,w.touch.stop,this.handleDragStop),(0,n.removeEvent)(a,w.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,n.scheduleRemoveUserSelectStyles)(s)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:r.default.findDOMNode(this)}render(){return e.cloneElement(e.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return pt.default=_,v(_,"displayName","DraggableCore"),v(_,"propTypes",{allowAnyClick:t.default.bool,allowMobileScroll:t.default.bool,children:t.default.node.isRequired,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:function(c,a){if(c[a]&&c[a].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:t.default.arrayOf(t.default.number),handle:t.default.string,cancel:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number,className:i.dontSetMe,style:i.dontSetMe,transform:i.dontSetMe}),v(_,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),pt}var Sn;function Wo(){return Sn||(Sn=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return d.default}}),e.default=void 0;var t=p(C),r=m(Nt()),n=m(Cr),o=Gt,i=hr(),l=vn(),u=At(),d=m(Lo()),v=m(xn());function m(s){return s&&s.__esModule?s:{default:s}}function p(s,h){if(typeof WeakMap=="function")var y=new WeakMap,S=new WeakMap;return(p=function(b,E){if(!E&&b&&b.__esModule)return b;var g,x,R={__proto__:null,default:b};if(b===null||typeof b!="object"&&typeof b!="function")return R;if(g=E?S:y){if(g.has(b))return g.get(b);g.set(b,R)}for(const Y in b)Y!=="default"&&{}.hasOwnProperty.call(b,Y)&&((x=(g=Object.defineProperty)&&Object.getOwnPropertyDescriptor(b,Y))&&(x.get||x.set)?g(R,Y,x):R[Y]=b[Y]);return R})(s,h)}function w(){return w=Object.assign?Object.assign.bind():function(s){for(var h=1;h<arguments.length;h++){var y=arguments[h];for(var S in y)({}).hasOwnProperty.call(y,S)&&(s[S]=y[S])}return s},w.apply(null,arguments)}function O(s,h,y){return(h=_(h))in s?Object.defineProperty(s,h,{value:y,enumerable:!0,configurable:!0,writable:!0}):s[h]=y,s}function _(s){var h=c(s,"string");return typeof h=="symbol"?h:h+""}function c(s,h){if(typeof s!="object"||!s)return s;var y=s[Symbol.toPrimitive];if(y!==void 0){var S=y.call(s,h);if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(s)}class a extends t.Component{static getDerivedStateFromProps(h,y){let{position:S}=h,{prevPropsPosition:b}=y;return S&&(!b||S.x!==b.x||S.y!==b.y)?((0,v.default)("Draggable: getDerivedStateFromProps %j",{position:S,prevPropsPosition:b}),{x:S.x,y:S.y,prevPropsPosition:{...S}}):null}constructor(h){super(h),O(this,"onDragStart",(y,S)=>{if((0,v.default)("Draggable: onDragStart: %j",S),this.props.onStart(y,(0,l.createDraggableData)(this,S))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),O(this,"onDrag",(y,S)=>{if(!this.state.dragging)return!1;(0,v.default)("Draggable: onDrag: %j",S);const b=(0,l.createDraggableData)(this,S),E={x:b.x,y:b.y,slackX:0,slackY:0};if(this.props.bounds){const{x,y:R}=E;E.x+=this.state.slackX,E.y+=this.state.slackY;const[Y,q]=(0,l.getBoundPosition)(this,E.x,E.y);E.x=Y,E.y=q,E.slackX=this.state.slackX+(x-E.x),E.slackY=this.state.slackY+(R-E.y),b.x=E.x,b.y=E.y,b.deltaX=E.x-this.state.x,b.deltaY=E.y-this.state.y}if(this.props.onDrag(y,b)===!1)return!1;this.setState(E)}),O(this,"onDragStop",(y,S)=>{if(!this.state.dragging||this.props.onStop(y,(0,l.createDraggableData)(this,S))===!1)return!1;(0,v.default)("Draggable: onDragStop: %j",S);const E={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x,y:R}=this.props.position;E.x=x,E.y=R}this.setState(E)}),this.state={dragging:!1,dragged:!1,x:h.position?h.position.x:h.defaultPosition.x,y:h.position?h.position.y:h.defaultPosition.y,prevPropsPosition:{...h.position},slackX:0,slackY:0,isElementSVG:!1},h.position&&!(h.onDrag||h.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??n.default.findDOMNode(this)}render(){const{axis:h,bounds:y,children:S,defaultPosition:b,defaultClassName:E,defaultClassNameDragging:g,defaultClassNameDragged:x,position:R,positionOffset:Y,scale:q,...V}=this.props;let A={},$=null;const U=!!!R||this.state.dragging,J=R||b,le={x:(0,l.canDragX)(this)&&U?this.state.x:J.x,y:(0,l.canDragY)(this)&&U?this.state.y:J.y};this.state.isElementSVG?$=(0,i.createSVGTransform)(le,Y):A=(0,i.createCSSTransform)(le,Y);const me=(0,o.clsx)(S.props.className||"",E,{[g]:this.state.dragging,[x]:this.state.dragged});return t.createElement(d.default,w({},V,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(S),{className:me,style:{...S.props.style,...A},transform:$}))}}e.default=a,O(a,"displayName","Draggable"),O(a,"propTypes",{...d.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:u.dontSetMe,style:u.dontSetMe,transform:u.dontSetMe}),O(a,"defaultProps",{...d.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(sr)),sr}var Cn;function gr(){if(Cn)return dt.exports;Cn=1;const{default:e,DraggableCore:t}=Wo();return dt.exports=e,dt.exports.default=e,dt.exports.DraggableCore=t,dt.exports}var qo=gr(),ht={exports:{}},gt={},Lt={},En;function Ho(){if(En)return Lt;En=1,Lt.__esModule=!0,Lt.cloneElement=u;var e=t(C);function t(d){return d&&d.__esModule?d:{default:d}}function r(d,v){var m=Object.keys(d);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(d);v&&(p=p.filter(function(w){return Object.getOwnPropertyDescriptor(d,w).enumerable})),m.push.apply(m,p)}return m}function n(d){for(var v=1;v<arguments.length;v++){var m=arguments[v]!=null?arguments[v]:{};v%2?r(Object(m),!0).forEach(function(p){o(d,p,m[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(m)):r(Object(m)).forEach(function(p){Object.defineProperty(d,p,Object.getOwnPropertyDescriptor(m,p))})}return d}function o(d,v,m){return(v=i(v))in d?Object.defineProperty(d,v,{value:m,enumerable:!0,configurable:!0,writable:!0}):d[v]=m,d}function i(d){var v=l(d,"string");return typeof v=="symbol"?v:v+""}function l(d,v){if(typeof d!="object"||!d)return d;var m=d[Symbol.toPrimitive];if(m!==void 0){var p=m.call(d,v);if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(v==="string"?String:Number)(d)}function u(d,v){return v.style&&d.props.style&&(v.style=n(n({},d.props.style),v.style)),v.className&&d.props.className&&(v.className=`${d.props.className} ${v.className}`),e.default.cloneElement(d,v)}return Lt}var mt={},Pn;function On(){if(Pn)return mt;Pn=1,mt.__esModule=!0,mt.resizableProps=void 0;var e=t(Nt());gr();function t(r){return r&&r.__esModule?r:{default:r}}return mt.resizableProps={axis:e.default.oneOf(["both","x","y","none"]),className:e.default.string,children:e.default.element.isRequired,draggableOpts:e.default.shape({allowAnyClick:e.default.bool,cancel:e.default.string,children:e.default.node,disabled:e.default.bool,enableUserSelectHack:e.default.bool,offsetParent:typeof Element<"u"?e.default.instanceOf(Element):e.default.any,grid:e.default.arrayOf(e.default.number),handle:e.default.string,nodeRef:e.default.object,onStart:e.default.func,onDrag:e.default.func,onStop:e.default.func,onMouseDown:e.default.func,scale:e.default.number}),height:function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];const[i]=n;return i.axis==="both"||i.axis==="y"?e.default.number.isRequired(...n):e.default.number(...n)},handle:e.default.oneOfType([e.default.node,e.default.func]),handleSize:e.default.arrayOf(e.default.number),lockAspectRatio:e.default.bool,maxConstraints:e.default.arrayOf(e.default.number),minConstraints:e.default.arrayOf(e.default.number),onResizeStop:e.default.func,onResizeStart:e.default.func,onResize:e.default.func,resizeHandles:e.default.arrayOf(e.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:e.default.number,width:function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];const[i]=n;return i.axis==="both"||i.axis==="x"?e.default.number.isRequired(...n):e.default.number(...n)}},mt}var Rn;function _n(){if(Rn)return gt;Rn=1,gt.__esModule=!0,gt.default=void 0;var e=i(C),t=gr(),r=Ho(),n=On();const o=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function i(c,a){if(typeof WeakMap=="function")var s=new WeakMap,h=new WeakMap;return(i=function(y,S){if(!S&&y&&y.__esModule)return y;var b,E,g={__proto__:null,default:y};if(y===null||typeof y!="object"&&typeof y!="function")return g;if(b=S?h:s){if(b.has(y))return b.get(y);b.set(y,g)}for(const x in y)x!=="default"&&{}.hasOwnProperty.call(y,x)&&((E=(b=Object.defineProperty)&&Object.getOwnPropertyDescriptor(y,x))&&(E.get||E.set)?b(g,x,E):g[x]=y[x]);return g})(c,a)}function l(){return l=Object.assign?Object.assign.bind():function(c){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var h in s)({}).hasOwnProperty.call(s,h)&&(c[h]=s[h])}return c},l.apply(null,arguments)}function u(c,a){if(c==null)return{};var s,h,y=d(c,a);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(c);for(h=0;h<S.length;h++)s=S[h],a.indexOf(s)===-1&&{}.propertyIsEnumerable.call(c,s)&&(y[s]=c[s])}return y}function d(c,a){if(c==null)return{};var s={};for(var h in c)if({}.hasOwnProperty.call(c,h)){if(a.indexOf(h)!==-1)continue;s[h]=c[h]}return s}function v(c,a){var s=Object.keys(c);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(c);a&&(h=h.filter(function(y){return Object.getOwnPropertyDescriptor(c,y).enumerable})),s.push.apply(s,h)}return s}function m(c){for(var a=1;a<arguments.length;a++){var s=arguments[a]!=null?arguments[a]:{};a%2?v(Object(s),!0).forEach(function(h){p(c,h,s[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(s)):v(Object(s)).forEach(function(h){Object.defineProperty(c,h,Object.getOwnPropertyDescriptor(s,h))})}return c}function p(c,a,s){return(a=w(a))in c?Object.defineProperty(c,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):c[a]=s,c}function w(c){var a=O(c,"string");return typeof a=="symbol"?a:a+""}function O(c,a){if(typeof c!="object"||!c)return c;var s=c[Symbol.toPrimitive];if(s!==void 0){var h=s.call(c,a);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(c)}let _=class extends e.Component{constructor(){super(...arguments),this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints(a,s){const{minConstraints:h,maxConstraints:y,lockAspectRatio:S}=this.props;if(!h&&!y&&!S)return[a,s];if(S){const R=this.props.width/this.props.height,Y=a-this.props.width,q=s-this.props.height;Math.abs(Y)>Math.abs(q*R)?s=a/R:a=s*R}const[b,E]=[a,s];let[g,x]=this.slack||[0,0];return a+=g,s+=x,h&&(a=Math.max(h[0],a),s=Math.max(h[1],s)),y&&(a=Math.min(y[0],a),s=Math.min(y[1],s)),this.slack=[g+(b-a),x+(E-s)],[a,s]}resizeHandler(a,s){return(h,y)=>{let{node:S,deltaX:b,deltaY:E}=y;a==="onResizeStart"&&this.resetData();const g=(this.props.axis==="both"||this.props.axis==="x")&&s!=="n"&&s!=="s",x=(this.props.axis==="both"||this.props.axis==="y")&&s!=="e"&&s!=="w";if(!g&&!x)return;const R=s[0],Y=s[s.length-1],q=S.getBoundingClientRect();if(this.lastHandleRect!=null){if(Y==="w"){const J=q.left-this.lastHandleRect.left;b+=J}if(R==="n"){const J=q.top-this.lastHandleRect.top;E+=J}}this.lastHandleRect=q,Y==="w"&&(b=-b),R==="n"&&(E=-E);let V=this.props.width+(g?b/this.props.transformScale:0),A=this.props.height+(x?E/this.props.transformScale:0);[V,A]=this.runConstraints(V,A),a==="onResizeStop"&&this.lastSize&&({width:V,height:A}=this.lastSize);const $=V!==this.props.width||A!==this.props.height;a!=="onResizeStop"&&(this.lastSize={width:V,height:A});const K=typeof this.props[a]=="function"?this.props[a]:null;K&&!(a==="onResize"&&!$)&&(h.persist?.(),K(h,{node:S,size:{width:V,height:A},handle:s})),a==="onResizeStop"&&this.resetData()}}renderResizeHandle(a,s){const{handle:h}=this.props;if(!h)return e.createElement("span",{className:`react-resizable-handle react-resizable-handle-${a}`,ref:s});if(typeof h=="function")return h(a,s);const y=typeof h.type=="string",S=m({ref:s},y?{}:{handleAxis:a});return e.cloneElement(h,S)}render(){const a=this.props,{children:s,className:h,draggableOpts:y,width:S,height:b,handle:E,handleSize:g,lockAspectRatio:x,axis:R,minConstraints:Y,maxConstraints:q,onResize:V,onResizeStop:A,onResizeStart:$,resizeHandles:K,transformScale:U}=a,J=u(a,o);return(0,r.cloneElement)(s,m(m({},J),{},{className:`${h?`${h} `:""}react-resizable`,children:[...e.Children.toArray(s.props.children),...K.map(le=>{const me=this.handleRefs[le]??(this.handleRefs[le]=e.createRef());return e.createElement(t.DraggableCore,l({},y,{nodeRef:me,key:`resizableHandle-${le}`,onStop:this.resizeHandler("onResizeStop",le),onStart:this.resizeHandler("onResizeStart",le),onDrag:this.resizeHandler("onResize",le)}),this.renderResizeHandle(le,me))})]}))}};return gt.default=_,_.propTypes=n.resizableProps,_.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},gt}var yt={},Dn;function Yo(){if(Dn)return yt;Dn=1,yt.__esModule=!0,yt.default=void 0;var e=l(C),t=i(Nt()),r=i(_n()),n=On();const o=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function i(a){return a&&a.__esModule?a:{default:a}}function l(a,s){if(typeof WeakMap=="function")var h=new WeakMap,y=new WeakMap;return(l=function(S,b){if(!b&&S&&S.__esModule)return S;var E,g,x={__proto__:null,default:S};if(S===null||typeof S!="object"&&typeof S!="function")return x;if(E=b?y:h){if(E.has(S))return E.get(S);E.set(S,x)}for(const R in S)R!=="default"&&{}.hasOwnProperty.call(S,R)&&((g=(E=Object.defineProperty)&&Object.getOwnPropertyDescriptor(S,R))&&(g.get||g.set)?E(x,R,g):x[R]=S[R]);return x})(a,s)}function u(){return u=Object.assign?Object.assign.bind():function(a){for(var s=1;s<arguments.length;s++){var h=arguments[s];for(var y in h)({}).hasOwnProperty.call(h,y)&&(a[y]=h[y])}return a},u.apply(null,arguments)}function d(a,s){var h=Object.keys(a);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(a);s&&(y=y.filter(function(S){return Object.getOwnPropertyDescriptor(a,S).enumerable})),h.push.apply(h,y)}return h}function v(a){for(var s=1;s<arguments.length;s++){var h=arguments[s]!=null?arguments[s]:{};s%2?d(Object(h),!0).forEach(function(y){m(a,y,h[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(h)):d(Object(h)).forEach(function(y){Object.defineProperty(a,y,Object.getOwnPropertyDescriptor(h,y))})}return a}function m(a,s,h){return(s=p(s))in a?Object.defineProperty(a,s,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[s]=h,a}function p(a){var s=w(a,"string");return typeof s=="symbol"?s:s+""}function w(a,s){if(typeof a!="object"||!a)return a;var h=a[Symbol.toPrimitive];if(h!==void 0){var y=h.call(a,s);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}function O(a,s){if(a==null)return{};var h,y,S=_(a,s);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(a);for(y=0;y<b.length;y++)h=b[y],s.indexOf(h)===-1&&{}.propertyIsEnumerable.call(a,h)&&(S[h]=a[h])}return S}function _(a,s){if(a==null)return{};var h={};for(var y in a)if({}.hasOwnProperty.call(a,y)){if(s.indexOf(y)!==-1)continue;h[y]=a[y]}return h}let c=class extends e.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(s,h)=>{const{size:y}=h;this.props.onResize?(s.persist?.(),this.setState(y,()=>this.props.onResize&&this.props.onResize(s,h))):this.setState(y)}}static getDerivedStateFromProps(s,h){return h.propsWidth!==s.width||h.propsHeight!==s.height?{width:s.width,height:s.height,propsWidth:s.width,propsHeight:s.height}:null}render(){const s=this.props,{handle:h,handleSize:y,onResize:S,onResizeStart:b,onResizeStop:E,draggableOpts:g,minConstraints:x,maxConstraints:R,lockAspectRatio:Y,axis:q,width:V,height:A,resizeHandles:$,style:K,transformScale:U}=s,J=O(s,o);return e.createElement(r.default,{axis:q,draggableOpts:g,handle:h,handleSize:y,height:this.state.height,lockAspectRatio:Y,maxConstraints:R,minConstraints:x,onResizeStart:b,onResize:this.onResize,onResizeStop:E,resizeHandles:$,transformScale:U,width:this.state.width},e.createElement("div",u({},J,{style:v(v({},K),{},{width:this.state.width+"px",height:this.state.height+"px"})})))}};return yt.default=c,c.propTypes=v(v({},n.resizableProps),{},{children:t.default.element}),yt}var jn;function $o(){return jn||(jn=1,ht.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},ht.exports.Resizable=_n().default,ht.exports.ResizableBox=Yo().default),ht.exports}var Bo=$o();function Tn(e){const{children:t,cols:r,containerWidth:n,margin:o,containerPadding:i,rowHeight:l,maxRows:u,isDraggable:d,isResizable:v,isBounded:m,static:p,useCSSTransforms:w=!0,usePercentages:O=!1,transformScale:_=1,positionStrategy:c,dragThreshold:a=0,droppingPosition:s,className:h="",style:y,handle:S="",cancel:b="",x:E,y:g,w:x,h:R,minW:Y=1,maxW:q=1/0,minH:V=1,maxH:A=1/0,i:$,resizeHandles:K,resizeHandle:U,constraints:J=Mr,layoutItem:le,layout:me=[],onDragStart:P,onDrag:f,onDragStop:j,onResizeStart:k,onResize:M,onResizeStop:X}=e,[I,T]=C.useState(!1),[W,N]=C.useState(!1),H=C.useRef(null),F=C.useRef({left:0,top:0}),D=C.useRef({top:0,left:0,width:0,height:0}),ae=C.useRef(void 0),De=C.useRef(me);De.current=me;const Re=C.useRef(null),ye=C.useRef(null),Ce=C.useRef(!1),at=C.useRef({x:0,y:0}),de=C.useRef(!1),ue=C.useMemo(()=>({cols:r,containerPadding:i,containerWidth:n,margin:o,maxRows:u,rowHeight:l}),[r,i,n,o,u,l]),Ee=C.useMemo(()=>({cols:r,maxRows:u,containerWidth:n,containerHeight:0,rowHeight:l,margin:o,layout:[]}),[r,u,n,l,o]),we=C.useCallback(()=>({...Ee,layout:De.current}),[Ee]),ke=C.useMemo(()=>le??{i:$,x:E,y:g,w:x,h:R,minW:Y,maxW:q,minH:V,maxH:A},[le,$,E,g,x,R,Y,q,V,A]),Wt=C.useCallback(re=>{if(c?.calcStyle)return c.calcStyle(re);if(w)return zr(re);const ne=Un(re);return O?{...ne,left:kr(re.left/n),width:kr(re.width/n)}:ne},[c,w,O,n]),Ie=C.useCallback((re,{node:ne})=>{if(!P)return;const{offsetParent:he}=ne;if(!he)return;const se=he.getBoundingClientRect(),ve=ne.getBoundingClientRect(),Pe=ve.left/_,_e=se.left/_,Oe=ve.top/_,Me=se.top/_;let ze;if(c?.calcDragPosition){const G=re;ze=c.calcDragPosition(G.clientX,G.clientY,G.clientX-ve.left,G.clientY-ve.top)}else ze={left:Pe-_e+he.scrollLeft,top:Oe-Me+he.scrollTop};if(F.current=ze,a>0){const G=re;at.current={x:G.clientX,y:G.clientY},Ce.current=!0,de.current=!1,T(!0);return}T(!0);const Ve=Ct(ue,ze.top,ze.left),{x:Je,y:L}=Rt(J,ke,Ve.x,Ve.y,we());P($,Je,L,{e:re,node:ne,newPosition:ze})},[P,_,ue,c,a,J,ke,we,$]),st=C.useCallback((re,{node:ne,deltaX:he,deltaY:se})=>{if(!f||!I)return;const ve=re;if(Ce.current&&!de.current){const Je=ve.clientX-at.current.x,L=ve.clientY-at.current.y;if(Math.hypot(Je,L)<a)return;if(de.current=!0,Ce.current=!1,P){const B=Ct(ue,F.current.top,F.current.left),{x:Z,y:ie}=Rt(J,ke,B.x,B.y,we());P($,Z,ie,{e:re,node:ne,newPosition:F.current})}}let Pe=F.current.top+se,_e=F.current.left+he;if(m){const{offsetParent:Je}=ne;if(Je){const L=Je.clientHeight-nt(R,l,o[1]);Pe=Et(Pe,0,L);const G=rt(ue),B=n-nt(x,G,o[0]);_e=Et(_e,0,B)}}const Oe={top:Pe,left:_e};F.current=Oe;const Me=Ct(ue,Pe,_e),{x:ze,y:Ve}=Rt(J,ke,Me.x,Me.y,we());f($,ze,Ve,{e:re,node:ne,newPosition:Oe})},[f,P,I,a,m,R,l,o,ue,n,x,$,J,ke,we]),Xe=C.useCallback((re,{node:ne})=>{if(!j||!I)return;const he=Ce.current;if(Ce.current=!1,de.current=!1,at.current={x:0,y:0},he){T(!1),F.current={left:0,top:0};return}const{left:se,top:ve}=F.current,Pe={top:ve,left:se};T(!1),F.current={left:0,top:0};const _e=Ct(ue,ve,se),{x:Oe,y:Me}=Rt(J,ke,_e.x,_e.y,we());j($,Oe,Me,{e:re,node:ne,newPosition:Pe})},[j,I,ue,J,ke,we,$]);Re.current=Ie,ye.current=st;const Ne=C.useCallback((re,{node:ne,size:he,handle:se},ve,Pe)=>{const _e=Pe==="onResizeStart"?k:Pe==="onResize"?M:X;if(!_e)return;let Oe;ne?Oe=to(se,ve,he,n):Oe={...he,top:ve.top,left:ve.left},D.current=Oe;const Me=qn(ue,Oe.width,Oe.height),{w:ze,h:Ve}=Xn(J,ke,Me.w,Me.h,se,we());_e($,ze,Ve,{e:re.nativeEvent,node:ne,size:Oe,handle:se})},[k,M,X,n,ue,$,J,ke,we]),it=C.useCallback((re,ne)=>{N(!0);const he=ft(ue,E,g,x,R),se={...ne,handle:ne.handle};Ne(re,se,he,"onResizeStart")},[Ne,ue,E,g,x,R]),lt=C.useCallback((re,ne)=>{const he=ft(ue,E,g,x,R),se={...ne,handle:ne.handle};Ne(re,se,he,"onResize")},[Ne,ue,E,g,x,R]),Ue=C.useCallback((re,ne)=>{N(!1),D.current={top:0,left:0,width:0,height:0};const he=ft(ue,E,g,x,R),se={...ne,handle:ne.handle};Ne(re,se,he,"onResizeStop")},[Ne,ue,E,g,x,R]);C.useEffect(()=>{if(!s)return;const re=H.current;if(!re)return;const ne=ae.current||{left:0,top:0},he=I&&(s.left!==ne.left||s.top!==ne.top);if(I){if(he){const se=s.left-F.current.left,ve=s.top-F.current.top,Pe={node:re,deltaX:se,deltaY:ve,lastX:F.current.left,lastY:F.current.top,x:s.left,y:s.top};ye.current?.(s.e,Pe)}}else{const se={node:re,deltaX:s.left,deltaY:s.top,lastX:0,lastY:0,x:s.left,y:s.top};Re.current?.(s.e,se)}ae.current=s},[s,I,$]);const Le=ft(ue,E,g,x,R,I?F.current:null,W?D.current:null),vt=C.Children.only(t),bt=ft(ue,0,0,1,1),qt=[bt.width,bt.height],Ht=[1/0,1/0],je=vt.props,xr=je.className,Yt=je.style;let Ge=C.cloneElement(vt,{ref:H,className:Gt("react-grid-item",xr,h,{static:p,resizing:W,"react-draggable":d,"react-draggable-dragging":I,dropping:!!s,cssTransforms:w}),style:{...y,...Yt,...Wt(Le)}});const $t=U;return Ge=z.jsx(Bo.Resizable,{draggableOpts:{disabled:!v},className:v?void 0:"react-resizable-hide",width:Le.width,height:Le.height,minConstraints:qt,maxConstraints:Ht,onResizeStart:it,onResize:lt,onResizeStop:Ue,transformScale:_,resizeHandles:K,handle:$t,children:Ge}),Ge=z.jsx(qo.DraggableCore,{disabled:!d,onStart:Ie,onDrag:st,onStop:Xe,handle:S,cancel:".react-resizable-handle"+(b?","+b:""),scale:_,nodeRef:H,children:Ge}),Ge}var qe=()=>{},Mn="react-grid-layout",zn=!1;try{zn=/firefox/i.test(navigator.userAgent)}catch{}function Fo(e,t){const r=C.Children.toArray(e),n=C.Children.toArray(t);if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){const i=r[o],l=n[o];if(i?.key!==l?.key)return!1}return!0}function kn(e,t,r,n){const o=[],i=new Set;C.Children.forEach(t,u=>{if(!C.isValidElement(u)||u.key===null)return;const d=String(u.key);i.add(d);const v=e.find(m=>m.i===d);if(v)o.push(Qe(v));else{const p=u.props["data-grid"];p?o.push({i:d,x:p.x??0,y:p.y??0,w:p.w??1,h:p.h??1,minW:p.minW,maxW:p.maxW,minH:p.minH,maxH:p.maxH,static:p.static,isDraggable:p.isDraggable,isResizable:p.isResizable,resizeHandles:p.resizeHandles,isBounded:p.isBounded}):o.push({i:d,x:0,y:Pt(o),w:1,h:1})}});const l=Zt(o,{cols:r});return n.compact(l,r)}function Xo(e){const{children:t,width:r,gridConfig:n,dragConfig:o,resizeConfig:i,dropConfig:l,positionStrategy:u=no,compactor:d,constraints:v=Mr,layout:m=[],droppingItem:p,autoSize:w=!0,className:O="",style:_={},innerRef:c,onLayoutChange:a=qe,onDragStart:s=qe,onDrag:h=qe,onDragStop:y=qe,onResizeStart:S=qe,onResize:b=qe,onResizeStop:E=qe,onDrop:g=qe,onDropDragOver:x=qe}=e,R=C.useMemo(()=>({...oo,...n}),[n]),Y=C.useMemo(()=>({...ao,...o}),[o]),q=C.useMemo(()=>({...so,...i}),[i]),V=C.useMemo(()=>({...io,...l}),[l]),{cols:A,rowHeight:$,maxRows:K,margin:U,containerPadding:J}=R,{enabled:le,bounded:me,handle:P,cancel:f,threshold:j}=Y,{enabled:k,handles:M,handleComponent:X}=q,{enabled:I,defaultItem:T,onDragOver:W}=V,N=d??or("vertical"),H=N.type,F=N.allowOverlap,D=N.preventCollision??!1,ae=C.useMemo(()=>p??{i:"__dropping-elem__",...T},[p,T]),De=u.type==="transform",Re=u.scale,ye=J??U,[Ce,at]=C.useState(!1),[de,ue]=C.useState(()=>kn(m,t,A,N)),[Ee,we]=C.useState(null),[ke,Wt]=C.useState(!1),[Ie,st]=C.useState(null),[Xe,Ne]=C.useState(),it=C.useRef(null),lt=C.useRef(null),Ue=C.useRef(null),Le=C.useRef(0),vt=C.useRef(de),bt=C.useRef(m),qt=C.useRef(t),Ht=C.useRef(H),je=C.useRef(de);je.current=de,C.useEffect(()=>{at(!0),We(de,m)||a(de)},[]),C.useEffect(()=>{if(Ee||Ie)return;const L=!We(m,bt.current),G=!Fo(t,qt.current),B=H!==Ht.current;if(L||G||B){const ie=kn(L?m:de,t,A,N);We(ie,de)||ue(ie)}bt.current=m,qt.current=t,Ht.current=H},[m,t,A,H,N,Ee,Ie,de]),C.useEffect(()=>{if(!Ee&&!We(de,vt.current)){vt.current=de;const L=de.filter(G=>G.i!==ae.i);a(L)}},[de,Ee,a,ae.i]);const xr=C.useMemo(()=>{if(!w)return;const L=Pt(de),G=ye[1];return L*$+(L-1)*U[1]+G*2+"px"},[w,de,$,U,ye]),Yt=C.useCallback((L,G,B,Z)=>{const ie=je.current,oe=Ze(ie,L);if(!oe)return;const ce={w:oe.w,h:oe.h,x:oe.x,y:oe.y,i:L};it.current=Qe(oe),Ue.current=ie,we(ce),s(ie,oe,oe,null,Z.e,Z.node)},[s]),Ge=C.useCallback((L,G,B,Z)=>{const ie=je.current,oe=it.current,ce=Ze(ie,L);if(!ce)return;const be={w:ce.w,h:ce.h,x:ce.x,y:ce.y,i:L},fe=et(ie,ce,G,B,!0,D,H,A,F);h(fe,oe,ce,be,Z.e,Z.node),ue(N.compact(fe,A)),we(be)},[D,H,A,F,N,h]),$t=C.useCallback((L,G,B,Z)=>{if(!Ee)return;const ie=je.current,oe=it.current,ce=Ze(ie,L);if(!ce)return;const be=et(ie,ce,G,B,!0,D,H,A,F),fe=N.compact(be,A);y(fe,oe,ce,null,Z.e,Z.node);const Se=Ue.current;it.current=null,Ue.current=null,we(null),ue(fe),Se&&!We(Se,fe)&&a(fe)},[Ee,D,H,A,F,N,y,a]),re=C.useCallback((L,G,B,Z)=>{const ie=je.current,oe=Ze(ie,L);oe&&(lt.current=Qe(oe),Ue.current=ie,Wt(!0),S(ie,oe,oe,null,Z.e,Z.node))},[S]),ne=C.useCallback((L,G,B,Z)=>{const ie=je.current,oe=lt.current,{handle:ce}=Z;let be=!1,fe,Se;const[Bt,He]=$n(ie,L,pe=>(fe=pe.x,Se=pe.y,["sw","w","nw","n","ne"].includes(ce)&&(["sw","nw","w"].includes(ce)&&(fe=pe.x+(pe.w-G),G=pe.x!==fe&&fe<0?pe.w:G,fe=fe<0?0:fe),["ne","n","nw"].includes(ce)&&(Se=pe.y+(pe.h-B),B=pe.y!==Se&&Se<0?pe.h:B,Se=Se<0?0:Se),be=!0),D&&!F&&Dr(ie,{...pe,w:G,h:B,x:fe??pe.x,y:Se??pe.y}).filter(Xt=>Xt.i!==pe.i).length>0&&(Se=pe.y,B=pe.h,fe=pe.x,G=pe.w,be=!1),pe.w=G,pe.h=B,pe));if(!He)return;let xt=Bt;be&&fe!==void 0&&Se!==void 0&&(xt=et(Bt,He,fe,Se,!0,D,H,A,F));const Ft={w:He.w,h:He.h,x:He.x,y:He.y,i:L,static:!0};b(xt,oe,He,Ft,Z.e,Z.node),ue(N.compact(xt,A)),we(Ft)},[D,H,A,F,N,b]),he=C.useCallback((L,G,B,Z)=>{const ie=je.current,oe=lt.current,ce=Ze(ie,L),be=N.compact(ie,A);E(be,oe,ce??null,null,Z.e,Z.node);const fe=Ue.current;lt.current=null,Ue.current=null,we(null),Wt(!1),ue(be),fe&&!We(fe,be)&&a(be)},[A,N,E,a]),se=C.useCallback(()=>{const L=je.current;if(!L.some(Z=>Z.i===ae.i)){st(null),we(null),Ne(void 0);return}const B=N.compact(L.filter(Z=>Z.i!==ae.i),A);ue(B),st(null),we(null),Ne(void 0)},[ae.i,A,N]),ve=C.useCallback(L=>{if(L.preventDefault(),L.stopPropagation(),zn&&!L.nativeEvent.target?.classList.contains(Mn))return!1;const G=W?W(L.nativeEvent):x(L);if(G===!1)return Ie&&se(),!1;const{dragOffsetX:B=0,dragOffsetY:Z=0,...ie}=G??{},oe={...ae,...ie},ce=L.currentTarget.getBoundingClientRect(),be={cols:A,margin:U,maxRows:K,rowHeight:$,containerWidth:r,containerPadding:ye},fe=rt(be),Se=nt(oe.w,fe,U[0]),Bt=nt(oe.h,$,U[1]),He=Se/2,xt=Bt/2,Ft=L.clientX-ce.left+B-He,pe=L.clientY-ce.top+Z-xt,wr=Math.max(0,Ft),Xt=Math.max(0,pe),Ut={left:wr/Re,top:Xt/Re,e:L.nativeEvent};if(Ie)Xe&&(Xe.left!==Ut.left||Xe.top!==Ut.top)&&Ne(Ut);else{const Sr=Wn(be,Xt,wr,oe.w,oe.h);st(z.jsx("div",{},oe.i)),Ne(Ut),ue([...je.current,{...oe,x:Sr.x,y:Sr.y,static:!1,isDraggable:!0}])}},[Ie,Xe,ae,W,x,se,Re,A,U,K,$,r,ye]),Pe=C.useCallback(L=>{L.preventDefault(),L.stopPropagation(),Le.current--,Le.current<0&&(Le.current=0),Le.current===0&&se()},[se]),_e=C.useCallback(L=>{L.preventDefault(),L.stopPropagation(),Le.current++},[]),Oe=C.useCallback(L=>{L.preventDefault(),L.stopPropagation();const G=je.current,B=G.find(Z=>Z.i===ae.i);Le.current=0,se(),g(G,B,L.nativeEvent)},[ae.i,se,g]),Me=C.useCallback((L,G)=>{if(!L||!L.key)return null;const B=Ze(de,String(L.key));if(!B)return null;const Z=typeof B.isDraggable=="boolean"?B.isDraggable:!B.static&&le,ie=typeof B.isResizable=="boolean"?B.isResizable:!B.static&&k,oe=B.resizeHandles||[...M],ce=Z&&me&&B.isBounded!==!1,be=X;return z.jsx(Tn,{containerWidth:r,cols:A,margin:U,containerPadding:ye,maxRows:K,rowHeight:$,cancel:f,handle:P,onDragStart:Yt,onDrag:Ge,onDragStop:$t,onResizeStart:re,onResize:ne,onResizeStop:he,isDraggable:Z,isResizable:ie,isBounded:ce,useCSSTransforms:De&&Ce,usePercentages:!Ce,transformScale:Re,positionStrategy:u,dragThreshold:j,w:B.w,h:B.h,x:B.x,y:B.y,i:B.i,minH:B.minH,minW:B.minW,maxH:B.maxH,maxW:B.maxW,static:B.static,droppingPosition:G?Xe:void 0,resizeHandles:oe,resizeHandle:be,constraints:v,layoutItem:B,layout:de,children:L},B.i)},[de,r,A,U,ye,K,$,f,P,Yt,Ge,$t,re,ne,he,le,k,me,De,Ce,Re,u,j,Xe,M,X,v]),ze=()=>Ee?z.jsx(Tn,{w:Ee.w,h:Ee.h,x:Ee.x,y:Ee.y,i:Ee.i,className:`react-grid-placeholder ${ke?"placeholder-resizing":""}`,containerWidth:r,cols:A,margin:U,containerPadding:ye,maxRows:K,rowHeight:$,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:De,transformScale:Re,constraints:v,layout:de,children:z.jsx("div",{})}):null,Ve=Gt(Mn,O),Je={height:xr,..._};return z.jsxs("div",{ref:c,className:Ve,style:Je,onDrop:I?Oe:void 0,onDragLeave:I?Pe:void 0,onDragEnter:I?_e:void 0,onDragOver:I?ve:void 0,children:[C.Children.map(t,L=>C.isValidElement(L)?Me(L):null),I&&Ie&&Me(Ie,!0),ze()]})}var Uo={lg:1200,md:996,sm:768,xs:480,xxs:0},Go={lg:12,md:10,sm:6,xs:4,xxs:2},mr=()=>{};function Vo(e,t,r,n){const o=[];C.Children.forEach(t,l=>{if(!C.isValidElement(l)||l.key===null)return;const u=String(l.key),d=e.find(v=>v.i===u);if(d)o.push({...d,i:u});else{const m=l.props["data-grid"];m?o.push({i:u,x:m.x??0,y:m.y??0,w:m.w??1,h:m.h??1,minW:m.minW,maxW:m.maxW,minH:m.minH,maxH:m.maxH,static:m.static,isDraggable:m.isDraggable,isResizable:m.isResizable,resizeHandles:m.resizeHandles,isBounded:m.isBounded}):o.push({i:u,x:0,y:Pt(o),w:1,h:1})}});const i=Zt(o,{cols:r});return n.compact(i,r)}function Jo(e){const{children:t,width:r,breakpoint:n,breakpoints:o=Uo,cols:i=Go,layouts:l={},rowHeight:u=150,maxRows:d=1/0,margin:v=[10,10],containerPadding:m=null,compactor:p,onBreakpointChange:w=mr,onLayoutChange:O=mr,onWidthChange:_=mr,...c}=e,a=p??or("vertical"),s=a.type,h=a.allowOverlap,y=C.useMemo(()=>n??qr(o,r),[]),S=C.useMemo(()=>Hr(y,i),[y,i]),b=C.useMemo(()=>ar(l,o,y,y,S,s),[]),[E,g]=C.useState(y),[x,R]=C.useState(S),[Y,q]=C.useState(b),[V,A]=C.useState(l),$=C.useRef(r),K=C.useRef(n),U=C.useRef(o),J=C.useRef(i),le=C.useRef(l),me=C.useRef(s),P=C.useRef(V);C.useEffect(()=>{P.current=V},[V]);const f=C.useMemo(()=>We(l,le.current)?null:ar(l,o,E,E,x,a),[l,o,E,x,a]),j=f??Y;C.useEffect(()=>{f!==null&&(q(f),A(l),P.current=l,le.current=l)},[f,l]),C.useEffect(()=>{if(s!==me.current){const T=a.compact($e(j),x),W={...P.current,[E]:T};q(T),A(W),P.current=W,O(T,W),me.current=s}},[s,a,j,x,h,E,O]),C.useEffect(()=>{const T=r!==$.current,W=n!==K.current,N=!We(o,U.current),H=!We(i,J.current);if(T||W||N||H){const F=n??qr(o,r),D=Hr(F,i),ae=E;if(ae!==F||N||H){const ye={...P.current};ye[ae]||(ye[ae]=$e(Y));let Ce=ar(ye,o,F,ae,D,a);Ce=Vo(Ce,t,D,a),ye[F]=Ce,g(F),R(D),q(Ce),A(ye),P.current=ye,w(F,D),O(Ce,ye)}const De=Dt(v,F),Re=m?Dt(m,F):null;_(r,De,D,Re),$.current=r,K.current=n,U.current=o,J.current=i}},[r,n,o,i,E,x,Y,t,a,s,h,v,m,w,O,_]);const k=C.useCallback(T=>{const N={...P.current,[E]:T};q(T),A(N),P.current=N,O(T,N)},[E,O]),M=C.useMemo(()=>Dt(v,E),[v,E]),X=C.useMemo(()=>m===null?null:Dt(m,E),[m,E]),I=C.useMemo(()=>({cols:x,rowHeight:u,maxRows:d,margin:M,containerPadding:X}),[x,u,d,M,X]);return z.jsx(Xo,{...c,width:r,gridConfig:I,compactor:a,onLayoutChange:k,layout:j,children:t})}const Ko=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],yr=({schema:e,className:t,onLayoutChange:r,persistLayoutKey:n="dashboard-layout"})=>{const{width:o,containerRef:i,mounted:l}=jo(),[u,d]=tt.useState(!1),[v,m]=tt.useState(()=>{if(typeof window<"u"&&n){const c=localStorage.getItem(n);if(c)try{return JSON.parse(c)}catch(a){console.error("Failed to parse saved layout:",a)}}return{lg:e.widgets?.map((c,a)=>({i:c.id||`widget-${a}`,x:c.layout?.x||a%4*3,y:c.layout?.y||Math.floor(a/4)*4,w:c.layout?.w||3,h:c.layout?.h||4}))||[]}}),p=tt.useCallback((c,a)=>{m(a),r?.(c)},[r]),w=tt.useCallback(()=>{typeof window<"u"&&n&&localStorage.setItem(n,JSON.stringify(v)),d(!1)},[v,n]),O=tt.useCallback(()=>{const c={lg:e.widgets?.map((a,s)=>({i:a.id||`widget-${s}`,x:a.layout?.x||s%4*3,y:a.layout?.y||Math.floor(s/4)*4,w:a.layout?.w||3,h:a.layout?.h||4}))||[]};m(c),typeof window<"u"&&n&&localStorage.removeItem(n)},[e.widgets,n]),_=tt.useCallback(c=>{if(c.component)return c.component;const a=c.type;if(a==="bar"||a==="line"||a==="area"||a==="pie"||a==="donut"){const s=Array.isArray(c.data)?c.data:c.data?.items||[],h=c.options||{},y=h.xField||"name",S=h.yField||"value";return{type:"chart",chartType:a,data:s,xAxisKey:y,series:[{dataKey:S}],colors:Ko,className:"h-full"}}return a==="table"?{type:"data-table",...c.options,data:c.data?.items||[],searchable:!1,pagination:!1,className:"border-0"}:c},[]);return z.jsxs("div",{ref:i,className:Q.cn("w-full",t),"data-testid":"grid-layout",children:[z.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[z.jsx("h2",{className:"text-2xl font-bold",children:e.title||"Dashboard"}),z.jsx("div",{className:"flex gap-2",children:u?z.jsxs(z.Fragment,{children:[z.jsxs(Q.Button,{onClick:w,size:"sm",variant:"default",children:[z.jsx(Te.Save,{className:"h-4 w-4 mr-2"}),"Save Layout"]}),z.jsxs(Q.Button,{onClick:O,size:"sm",variant:"outline",children:[z.jsx(Te.X,{className:"h-4 w-4 mr-2"}),"Reset"]}),z.jsx(Q.Button,{onClick:()=>d(!1),size:"sm",variant:"ghost",children:"Cancel"})]}):z.jsxs(Q.Button,{onClick:()=>d(!0),size:"sm",variant:"outline",children:[z.jsx(Te.Edit,{className:"h-4 w-4 mr-2"}),"Edit Layout"]})})]}),l&&z.jsx(Jo,{className:"layout",width:o,layouts:v,breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},rowHeight:60,dragConfig:{enabled:u,handle:".drag-handle"},resizeConfig:{enabled:u},onLayoutChange:p,children:e.widgets?.map((c,a)=>{const s=c.id||`widget-${a}`,h=_(c),y=c.type==="metric";return z.jsx("div",{className:"h-full",children:y?z.jsxs("div",{className:"h-full w-full relative",children:[u&&z.jsx("div",{className:"drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",children:z.jsx(Te.GripVertical,{className:"h-4 w-4"})}),z.jsx(wt.SchemaRenderer,{schema:h,className:"h-full w-full"})]}):z.jsxs(Q.Card,{className:Q.cn("h-full overflow-hidden border-border/50 shadow-sm transition-all","bg-card/50 backdrop-blur-sm",u&&"ring-2 ring-primary/20"),children:[c.title&&z.jsxs(Q.CardHeader,{className:"pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",children:[z.jsx(Q.CardTitle,{className:"text-base font-medium tracking-tight truncate",title:c.title,children:c.title}),u&&z.jsx("div",{className:"drag-handle cursor-move p-1 hover:bg-muted/40 rounded",children:z.jsx(Te.GripVertical,{className:"h-4 w-4"})})]}),z.jsx(Q.CardContent,{className:"p-0 h-full",children:z.jsx("div",{className:Q.cn("h-full w-full overflow-auto p-4"),children:z.jsx(wt.SchemaRenderer,{schema:h})})})]})},s)})})]})},vr=({label:e,value:t,trend:r,icon:n,className:o,description:i,...l})=>{const u=C.useMemo(()=>{if(typeof n=="string"){const d=Pr[n];return d?z.jsx(d,{className:"h-4 w-4 text-muted-foreground"}):null}return n},[n]);return z.jsxs(Q.Card,{className:Q.cn("h-full",o),...l,children:[z.jsxs(Q.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[z.jsx(Q.CardTitle,{className:"text-sm font-medium",children:e}),u&&z.jsx("div",{className:"h-4 w-4 text-muted-foreground",children:u})]}),z.jsxs(Q.CardContent,{children:[z.jsx("div",{className:"text-2xl font-bold",children:t}),(r||i)&&z.jsxs("p",{className:"text-xs text-muted-foreground flex items-center mt-1",children:[r&&z.jsxs("span",{className:Q.cn("flex items-center mr-2",r.direction==="up"&&"text-green-500",r.direction==="down"&&"text-red-500",r.direction==="neutral"&&"text-yellow-500"),children:[r.direction==="up"&&z.jsx(Te.ArrowUpIcon,{className:"h-3 w-3 mr-1"}),r.direction==="down"&&z.jsx(Te.ArrowDownIcon,{className:"h-3 w-3 mr-1"}),r.direction==="neutral"&&z.jsx(Te.MinusIcon,{className:"h-3 w-3 mr-1"}),r.value,"%"]}),i||r?.label]})]})]})},br=({title:e,value:t,icon:r,trend:n,trendValue:o,description:i,className:l,...u})=>{const d=r&&Pr[r];return z.jsxs(Q.Card,{className:Q.cn("h-full",l),...u,children:[z.jsxs(Q.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[z.jsx(Q.CardTitle,{className:"text-sm font-medium",children:e}),d&&z.jsx(d,{className:"h-4 w-4 text-muted-foreground"})]}),z.jsxs(Q.CardContent,{children:[z.jsx("div",{className:"text-2xl font-bold",children:t}),(n||o||i)&&z.jsxs("p",{className:"text-xs text-muted-foreground flex items-center mt-1",children:[n&&o&&z.jsxs("span",{className:Q.cn("flex items-center mr-2",n==="up"&&"text-green-500",n==="down"&&"text-red-500",n==="neutral"&&"text-yellow-500"),children:[n==="up"&&z.jsx(Te.ArrowUpIcon,{className:"h-3 w-3 mr-1"}),n==="down"&&z.jsx(Te.ArrowDownIcon,{className:"h-3 w-3 mr-1"}),n==="neutral"&&z.jsx(Te.MinusIcon,{className:"h-3 w-3 mr-1"}),o]}),i]})]})]})};Ye.ComponentRegistry.register("dashboard",Vt,{namespace:"view",label:"Dashboard",category:"Complex",icon:"layout-dashboard",inputs:[{name:"columns",type:"number",label:"Columns",defaultValue:3},{name:"gap",type:"number",label:"Gap",defaultValue:4},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:3,widgets:[]}}),Ye.ComponentRegistry.register("metric",vr,{namespace:"plugin-dashboard",label:"Metric Widget",category:"Dashboard",inputs:[{name:"label",type:"string",label:"Label"},{name:"value",type:"string",label:"Value"}]}),Ye.ComponentRegistry.register("metric-card",br,{namespace:"plugin-dashboard",label:"Metric Card",category:"Dashboard",inputs:[{name:"title",type:"string",label:"Title"},{name:"value",type:"string",label:"Value",required:!0},{name:"icon",type:"string",label:"Icon (Lucide name)"},{name:"trend",type:"enum",label:"Trend",enum:[{label:"Up",value:"up"},{label:"Down",value:"down"},{label:"Neutral",value:"neutral"}]},{name:"trendValue",type:"string",label:"Trend Value (e.g., +12%)"},{name:"description",type:"string",label:"Description"}],defaultProps:{title:"Metric",value:"0"}}),Ye.ComponentRegistry.register("dashboard-grid",yr,{namespace:"plugin-dashboard",label:"Dashboard Grid (Editable)",category:"Complex",icon:"layout-grid",inputs:[{name:"title",type:"string",label:"Title"},{name:"persistLayoutKey",type:"string",label:"Layout Storage Key",defaultValue:"dashboard-layout"},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{title:"Dashboard",widgets:[],persistLayoutKey:"dashboard-layout"}});const Zo={DashboardRenderer:Vt,DashboardGridLayout:yr,MetricWidget:vr,MetricCard:br};xe.DashboardGridLayout=yr,xe.DashboardRenderer=Vt,xe.MetricCard=br,xe.MetricWidget=vr,xe.dashboardComponents=Zo,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,11 @@
1
+ import { LayoutItem as RGLLayout } from 'react-grid-layout';
2
+ import { DashboardSchema } from '../../types/src';
3
+ import * as React from 'react';
4
+ export interface DashboardGridLayoutProps {
5
+ schema: DashboardSchema;
6
+ className?: string;
7
+ onLayoutChange?: (layout: RGLLayout[]) => void;
8
+ persistLayoutKey?: string;
9
+ }
10
+ export declare const DashboardGridLayout: React.FC<DashboardGridLayoutProps>;
11
+ //# sourceMappingURL=DashboardGridLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardGridLayout.d.ts","sourceRoot":"","sources":["../../src/DashboardGridLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAA2C,KAAK,UAAU,IAAI,SAAS,EAAuC,MAAM,mBAAmB,CAAC;AAC/I,OAAO,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAU/E,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA2LlE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { DashboardSchema } from '@object-ui/types';
1
+ import { DashboardSchema } from '../../types/src';
2
2
  export declare const DashboardRenderer: import('react').ForwardRefExoticComponent<Omit<{
3
3
  [key: string]: any;
4
4
  schema: DashboardSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardRenderer.d.ts","sourceRoot":"","sources":["../../src/DashboardRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAK/E,eAAO,MAAM,iBAAiB;;YAAwC,eAAe;gBAAc,MAAM;0DAkCxG,CAAC"}
1
+ {"version":3,"file":"DashboardRenderer.d.ts","sourceRoot":"","sources":["../../src/DashboardRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAc/E,eAAO,MAAM,iBAAiB;;YAAwC,eAAe;gBAAc,MAAM;0DAkHxG,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ export interface MetricCardProps {
3
+ title?: string;
4
+ value: string | number;
5
+ icon?: string;
6
+ trend?: 'up' | 'down' | 'neutral';
7
+ trendValue?: string;
8
+ description?: string;
9
+ className?: string;
10
+ }
11
+ /**
12
+ * MetricCard - Standalone metric card component for dashboard KPIs
13
+ * Displays a metric value with optional icon, trend indicator, and description
14
+ */
15
+ export declare const MetricCard: React.FC<MetricCardProps>;
16
+ //# sourceMappingURL=MetricCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetricCard.d.ts","sourceRoot":"","sources":["../../src/MetricCard.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA8ChD,CAAC"}
@@ -7,7 +7,7 @@ export interface MetricWidgetProps {
7
7
  label?: string;
8
8
  direction?: 'up' | 'down' | 'neutral';
9
9
  };
10
- icon?: React.ReactNode;
10
+ icon?: React.ReactNode | string;
11
11
  className?: string;
12
12
  description?: string;
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MetricWidget.d.ts","sourceRoot":"","sources":["../../src/MetricWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;IACF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,GAAI,iEAQ1B,iBAAiB,4CAgCnB,CAAC"}
1
+ {"version":3,"file":"MetricWidget.d.ts","sourceRoot":"","sources":["../../src/MetricWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;IACF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,GAAI,iEAQ1B,iBAAiB,4CAyCnB,CAAC"}
@@ -1,4 +1,16 @@
1
1
  import { DashboardRenderer } from './DashboardRenderer';
2
+ import { DashboardGridLayout } from './DashboardGridLayout';
2
3
  import { MetricWidget } from './MetricWidget';
3
- export { DashboardRenderer, MetricWidget };
4
+ import { MetricCard } from './MetricCard';
5
+ export { DashboardRenderer, DashboardGridLayout, MetricWidget, MetricCard };
6
+ export declare const dashboardComponents: {
7
+ DashboardRenderer: import('react').ForwardRefExoticComponent<Omit<{
8
+ [key: string]: any;
9
+ schema: import('../../types/src').DashboardSchema;
10
+ className?: string;
11
+ }, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
12
+ DashboardGridLayout: import('react').FC<import('./DashboardGridLayout').DashboardGridLayoutProps>;
13
+ MetricWidget: ({ label, value, trend, icon, className, description, ...props }: import('./MetricWidget').MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
14
+ MetricCard: import('react').FC<import('./MetricCard').MetricCardProps>;
15
+ };
4
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AAwF5E,eAAO,MAAM,mBAAmB;;;;;;;;;CAK/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-dashboard",
3
- "version": "0.1.1",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Dashboard plugin for Object UI",
@@ -17,20 +17,22 @@
17
17
  "dependencies": {
18
18
  "clsx": "^2.1.0",
19
19
  "lucide-react": "^0.563.0",
20
- "react": "^18.2.0",
21
- "react-dom": "^18.2.0",
20
+ "react": "^19.2.4",
21
+ "react-dom": "^19.2.4",
22
+ "react-grid-layout": "^2.2.2",
22
23
  "tailwind-merge": "^2.2.1",
23
- "@object-ui/components": "0.3.1",
24
- "@object-ui/core": "0.3.1",
25
- "@object-ui/react": "0.3.1",
26
- "@object-ui/types": "0.3.1"
24
+ "@object-ui/components": "2.0.0",
25
+ "@object-ui/core": "2.0.0",
26
+ "@object-ui/react": "2.0.0",
27
+ "@object-ui/types": "2.0.0"
27
28
  },
28
29
  "peerDependencies": {
29
30
  "react": "^18.0.0",
30
31
  "react-dom": "^18.0.0"
31
32
  },
32
33
  "devDependencies": {
33
- "@vitejs/plugin-react": "^4.7.0",
34
+ "@types/react-grid-layout": "^2.1.0",
35
+ "@vitejs/plugin-react": "^5.1.3",
34
36
  "typescript": "^5.9.3",
35
37
  "vite": "^7.3.1",
36
38
  "vite-plugin-dts": "^4.5.4"
@@ -0,0 +1,211 @@
1
+ import * as React from 'react';
2
+ import { ResponsiveGridLayout, useContainerWidth, type LayoutItem as RGLLayout, type Layout, type ResponsiveLayouts } from 'react-grid-layout';
3
+ import 'react-grid-layout/css/styles.css';
4
+ import { cn, Card, CardHeader, CardTitle, CardContent, Button } from '@object-ui/components';
5
+ import { Edit, GripVertical, Save, X } from 'lucide-react';
6
+ import { SchemaRenderer } from '@object-ui/react';
7
+ import type { DashboardSchema, DashboardWidgetSchema } from '@object-ui/types';
8
+
9
+ const CHART_COLORS = [
10
+ 'hsl(var(--chart-1))',
11
+ 'hsl(var(--chart-2))',
12
+ 'hsl(var(--chart-3))',
13
+ 'hsl(var(--chart-4))',
14
+ 'hsl(var(--chart-5))',
15
+ ];
16
+
17
+ export interface DashboardGridLayoutProps {
18
+ schema: DashboardSchema;
19
+ className?: string;
20
+ onLayoutChange?: (layout: RGLLayout[]) => void;
21
+ persistLayoutKey?: string;
22
+ }
23
+
24
+ export const DashboardGridLayout: React.FC<DashboardGridLayoutProps> = ({
25
+ schema,
26
+ className,
27
+ onLayoutChange,
28
+ persistLayoutKey = 'dashboard-layout',
29
+ }) => {
30
+ const { width, containerRef, mounted } = useContainerWidth();
31
+ const [editMode, setEditMode] = React.useState(false);
32
+ const [layouts, setLayouts] = React.useState<{ lg: RGLLayout[] }>(() => {
33
+ // Try to load saved layout
34
+ if (typeof window !== 'undefined' && persistLayoutKey) {
35
+ const saved = localStorage.getItem(persistLayoutKey);
36
+ if (saved) {
37
+ try {
38
+ return JSON.parse(saved);
39
+ } catch (e) {
40
+ console.error('Failed to parse saved layout:', e);
41
+ }
42
+ }
43
+ }
44
+
45
+ // Default layout from schema
46
+ return {
47
+ lg: schema.widgets?.map((widget: DashboardWidgetSchema, index: number) => ({
48
+ i: widget.id || `widget-${index}`,
49
+ x: widget.layout?.x || (index % 4) * 3,
50
+ y: widget.layout?.y || Math.floor(index / 4) * 4,
51
+ w: widget.layout?.w || 3,
52
+ h: widget.layout?.h || 4,
53
+ })) || [],
54
+ };
55
+ });
56
+
57
+ const handleLayoutChange = React.useCallback(
58
+ (layout: Layout, allLayouts: ResponsiveLayouts) => {
59
+ setLayouts(allLayouts as { lg: RGLLayout[] });
60
+ onLayoutChange?.(layout as RGLLayout[]);
61
+ },
62
+ [onLayoutChange]
63
+ );
64
+
65
+ const handleSaveLayout = React.useCallback(() => {
66
+ if (typeof window !== 'undefined' && persistLayoutKey) {
67
+ localStorage.setItem(persistLayoutKey, JSON.stringify(layouts));
68
+ }
69
+ setEditMode(false);
70
+ }, [layouts, persistLayoutKey]);
71
+
72
+ const handleResetLayout = React.useCallback(() => {
73
+ const defaultLayouts = {
74
+ lg: schema.widgets?.map((widget: DashboardWidgetSchema, index: number) => ({
75
+ i: widget.id || `widget-${index}`,
76
+ x: widget.layout?.x || (index % 4) * 3,
77
+ y: widget.layout?.y || Math.floor(index / 4) * 4,
78
+ w: widget.layout?.w || 3,
79
+ h: widget.layout?.h || 4,
80
+ })) || [],
81
+ };
82
+ setLayouts(defaultLayouts);
83
+ if (typeof window !== 'undefined' && persistLayoutKey) {
84
+ localStorage.removeItem(persistLayoutKey);
85
+ }
86
+ }, [schema.widgets, persistLayoutKey]);
87
+
88
+ const getComponentSchema = React.useCallback((widget: DashboardWidgetSchema) => {
89
+ if (widget.component) return widget.component;
90
+
91
+ const widgetType = (widget as any).type;
92
+ if (widgetType === 'bar' || widgetType === 'line' || widgetType === 'area' || widgetType === 'pie' || widgetType === 'donut') {
93
+ const dataItems = Array.isArray((widget as any).data) ? (widget as any).data : (widget as any).data?.items || [];
94
+ const options = (widget as any).options || {};
95
+ const xAxisKey = options.xField || 'name';
96
+ const yField = options.yField || 'value';
97
+
98
+ return {
99
+ type: 'chart',
100
+ chartType: widgetType,
101
+ data: dataItems,
102
+ xAxisKey: xAxisKey,
103
+ series: [{ dataKey: yField }],
104
+ colors: CHART_COLORS,
105
+ className: "h-full"
106
+ };
107
+ }
108
+
109
+ if (widgetType === 'table') {
110
+ return {
111
+ type: 'data-table',
112
+ ...(widget as any).options,
113
+ data: (widget as any).data?.items || [],
114
+ searchable: false,
115
+ pagination: false,
116
+ className: "border-0"
117
+ };
118
+ }
119
+
120
+ return widget;
121
+ }, []);
122
+
123
+ return (
124
+ <div ref={containerRef} className={cn("w-full", className)} data-testid="grid-layout">
125
+ <div className="mb-4 flex items-center justify-between">
126
+ <h2 className="text-2xl font-bold">{schema.title || 'Dashboard'}</h2>
127
+ <div className="flex gap-2">
128
+ {editMode ? (
129
+ <>
130
+ <Button onClick={handleSaveLayout} size="sm" variant="default">
131
+ <Save className="h-4 w-4 mr-2" />
132
+ Save Layout
133
+ </Button>
134
+ <Button onClick={handleResetLayout} size="sm" variant="outline">
135
+ <X className="h-4 w-4 mr-2" />
136
+ Reset
137
+ </Button>
138
+ <Button onClick={() => setEditMode(false)} size="sm" variant="ghost">
139
+ Cancel
140
+ </Button>
141
+ </>
142
+ ) : (
143
+ <Button onClick={() => setEditMode(true)} size="sm" variant="outline">
144
+ <Edit className="h-4 w-4 mr-2" />
145
+ Edit Layout
146
+ </Button>
147
+ )}
148
+ </div>
149
+ </div>
150
+
151
+ {mounted && (
152
+ <ResponsiveGridLayout
153
+ className="layout"
154
+ width={width}
155
+ layouts={layouts}
156
+ breakpoints={{ lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }}
157
+ cols={{ lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }}
158
+ rowHeight={60}
159
+ dragConfig={{ enabled: editMode, handle: ".drag-handle" }}
160
+ resizeConfig={{ enabled: editMode }}
161
+ onLayoutChange={handleLayoutChange}
162
+ >
163
+ {schema.widgets?.map((widget, index) => {
164
+ const widgetId = widget.id || `widget-${index}`;
165
+ const componentSchema = getComponentSchema(widget);
166
+ const isSelfContained = (widget as any).type === 'metric';
167
+
168
+ return (
169
+ <div key={widgetId} className="h-full">
170
+ {isSelfContained ? (
171
+ <div className="h-full w-full relative">
172
+ {editMode && (
173
+ <div className="drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border">
174
+ <GripVertical className="h-4 w-4" />
175
+ </div>
176
+ )}
177
+ <SchemaRenderer schema={componentSchema} className="h-full w-full" />
178
+ </div>
179
+ ) : (
180
+ <Card className={cn(
181
+ "h-full overflow-hidden border-border/50 shadow-sm transition-all",
182
+ "bg-card/50 backdrop-blur-sm",
183
+ editMode && "ring-2 ring-primary/20"
184
+ )}>
185
+ {widget.title && (
186
+ <CardHeader className="pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between">
187
+ <CardTitle className="text-base font-medium tracking-tight truncate" title={widget.title}>
188
+ {widget.title}
189
+ </CardTitle>
190
+ {editMode && (
191
+ <div className="drag-handle cursor-move p-1 hover:bg-muted/40 rounded">
192
+ <GripVertical className="h-4 w-4" />
193
+ </div>
194
+ )}
195
+ </CardHeader>
196
+ )}
197
+ <CardContent className="p-0 h-full">
198
+ <div className={cn("h-full w-full overflow-auto p-4")}>
199
+ <SchemaRenderer schema={componentSchema} />
200
+ </div>
201
+ </CardContent>
202
+ </Card>
203
+ )}
204
+ </div>
205
+ );
206
+ })}
207
+ </ResponsiveGridLayout>
208
+ )}
209
+ </div>
210
+ );
211
+ };