@object-ui/plugin-dashboard 3.1.3 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +29 -12
- package/CHANGELOG.md +9 -0
- package/dist/index.css +2 -1
- package/dist/index.js +5408 -5890
- package/dist/index.umd.cjs +6 -5
- package/dist/src/ObjectDataTable.d.ts +15 -0
- package/dist/src/ObjectDataTable.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/ObjectDataTable.tsx +36 -1
- package/src/__tests__/ObjectDataTable.test.tsx +90 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`@object-ui/react`),require(`@object-ui/components`),require(`react`),require(`lucide-react`),require(`clsx`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`@object-ui/react`,`@object-ui/components`,`react`,`lucide-react`,`clsx`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginDashboard={},e.ObjectUICore,e.ObjectUIReact,e.ObjectUIComponents,e.React,e.lucide_react,e.clsx))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=Object.create,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=u(t),a=0,o=i.length,s;a<o;a++)s=i[a],!f.call(e,s)&&s!==n&&c(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=l(t,s))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:s(d(e)),m(t||!e||!e.__esModule?c(n,`default`,{value:e,enumerable:!0}):n,e));i=h(i),a=h(a),o=h(o);function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.provider===`object`}var _=p((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),v=p((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D: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 g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!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)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[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?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),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:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}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 f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,I[p+o]||(m=0<m.length?`{`+m.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} />`,k,A,H,A),T[A+k]=!0)}if(A=null,I!==void 0&&(r(I),A=""+I),o(_)&&(r(_.key),A=""+_.key),"key"in _){I={};for(var $ in _)$!=="key"&&(I[$]=_[$])}else I=_;return A&&f(I,typeof y=="function"?y.displayName||y.name||"Unknown":y),v(y,A,I,a(),Y,M)}function h(y){j(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===D&&(y._payload.status==="fulfilled"?j(y._payload.value)&&y._payload.value._store&&(y._payload.value._store.validated=1):y._store&&(y._store.validated=1))}function j(y){return typeof y=="object"&&y!==null&&y.$$typeof===R}var O=C,R=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),E=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),P=Symbol.for("react.client.reference"),q=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,L=Array.isArray,X=console.createTask?console.createTask:function(){return null};O={react_stack_bottom_frame:function(y){return y()}};var U,J={},Q=O.react_stack_bottom_frame.bind(O,s)(),pe=X(n(s)),T={};dt.Fragment=i,dt.jsx=function(y,_,I){var k=1e4>q.recentlyCreatedOwnerStacks++;return g(y,_,I,!1,k?Error("react-stack-top-frame"):Q,k?X(n(y)):pe)},dt.jsxs=function(y,_,I){var k=1e4>q.recentlyCreatedOwnerStacks++;return g(y,_,I,!0,k?Error("react-stack-top-frame"):Q,k?X(n(y)):pe)}})()),dt}var Fr;function ra(){return Fr||(Fr=1,process.env.NODE_ENV==="production"?Ct.exports=ea():Ct.exports=ta()),Ct.exports}var p=ra();function nt(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&e.provider==="object"}function Et(e){if(e!=null)return typeof e=="string"?e:e.defaultValue||e.key}const tr=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],Pt=C.forwardRef(({schema:e,className:t,dataSource:r,onRefresh:n,recordCount:a,userActions:s,designMode:o,selectedWidgetId:f,onWidgetClick:u,...v},g)=>{const h=e.columns||4,j=e.gap||4,[O,R]=C.useState(!1),[x,i]=C.useState(!1),l=C.useRef(null);C.useEffect(()=>{const P=()=>i(window.innerWidth<768);return P(),window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const b=C.useCallback(()=>{n&&(R(!0),n(),setTimeout(()=>R(!1),600))},[n]);C.useEffect(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!n))return l.current=setInterval(b,e.refreshInterval*1e3),()=>{l.current&&clearInterval(l.current)}},[e.refreshInterval,n,b]);const S=C.useCallback((P,q)=>{!o||!u||!q||(P.stopPropagation(),u(q))},[o,u]),E=C.useCallback((P,q,z)=>{if(!o||!u)return;const L=e.widgets||[];if(P.key==="Enter"||P.key===" ")P.preventDefault(),u(q??null);else if(P.key==="ArrowRight"||P.key==="ArrowDown"){P.preventDefault();const X=z+1<L.length?L[z+1]:null;X?.id&&u(X.id)}else if(P.key==="ArrowLeft"||P.key==="ArrowUp"){P.preventDefault();const X=z-1>=0?L[z-1]:null;X?.id&&u(X.id)}else P.key==="Escape"&&(P.preventDefault(),u(null))},[o,u,e.widgets]),c=C.useCallback(P=>{!o||!u||P.target===P.currentTarget&&u(null)},[o,u]),w=(P,q,z)=>{const L=P.layout?{...P.layout,w:Math.min(P.layout.w,h)}:void 0,U=(()=>{if(P.component)return P.component;const k=P.type,Y=P.options||{};if(k==="bar"||k==="line"||k==="area"||k==="pie"||k==="donut"||k==="scatter"){const M=P.data||Y.data,A=P.categoryField||Y.xField||"name",H=P.valueField||Y.yField||"value";if(nt(M)){const B=M.aggregate,G=B?{field:P.valueField||B.field,function:P.aggregate||B.function,groupBy:P.categoryField||B.groupBy}:void 0,N=G?.field||H;return{type:"object-chart",chartType:k,objectName:P.object||M.object,aggregate:G,xAxisKey:A,series:[{dataKey:N}],colors:tr,className:"h-[200px] sm:h-[250px] md:h-[300px]"}}if(!M&&P.object){const B=P.aggregate?{field:P.valueField||"value",function:P.aggregate,groupBy:P.categoryField||"name"}:void 0;return{type:"object-chart",chartType:k,objectName:P.object,aggregate:B,xAxisKey:A,series:[{dataKey:P.valueField||"value"}],colors:tr,className:"h-[200px] sm:h-[250px] md:h-[300px]"}}const $=Array.isArray(M)?M:M?.items||[];return{type:"chart",chartType:k,data:$,xAxisKey:A,series:[{dataKey:H}],colors:tr,className:"h-[200px] sm:h-[250px] md:h-[300px]"}}if(k==="table"){const M=P.data||Y.data;if(nt(M)){const{data:A,...H}=Y;return{type:"object-data-table",...H,objectName:P.object||M.object,dataProvider:M,filter:M.filter||P.filter,searchable:P.searchable??!1,pagination:P.pagination??!1,className:"border-0"}}return!M&&P.object?{type:"object-data-table",...Y,objectName:P.object,filter:P.filter,searchable:P.searchable??!1,pagination:P.pagination??!1,className:"border-0"}:{type:"data-table",...Y,data:M?.items||[],searchable:!1,pagination:!1,className:"border-0"}}if(k==="pivot"){const M=P.data||Y.data;if(nt(M)){const{data:A,...H}=Y;return{type:"object-pivot",...H,objectName:P.object||M.object,dataProvider:M,filter:M.filter||P.filter}}return!M&&P.object?{type:"object-pivot",...Y,objectName:P.object,filter:P.filter}:{type:"pivot",...Y,data:Array.isArray(M)?M:M?.items||[]}}return{...P,...Y}})(),J=P.type==="metric",Q=Et(P.title),pe=Et(P.description),T=P.id||Q||`widget-${q}`,y=o&&f===P.id,_=o?{"data-testid":`dashboard-preview-widget-${P.id}`,"data-widget-id":P.id,role:"button",tabIndex:0,"aria-selected":y,"aria-label":`Widget: ${Q||`Widget ${q+1}`}`,onClick:k=>S(k,P.id),onKeyDown:k=>E(k,P.id,q)}:{},I=o?W.cn("cursor-pointer rounded-lg transition-all outline-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",y?"ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10":"hover:ring-2 hover:ring-primary/40 hover:shadow-sm"):void 0;return J?p.jsxs("div",{className:W.cn("h-full w-full",o&&"relative",I),style:!x&&L?{gridColumn:`span ${L.w}`,gridRow:`span ${L.h}`}:void 0,..._,children:[p.jsx(ze.SchemaRenderer,{schema:U,className:W.cn("h-full w-full",o&&"pointer-events-none")}),o&&p.jsx("div",{className:"absolute inset-0 z-10","aria-hidden":"true","data-testid":"widget-click-overlay"})]},T):p.jsxs(W.Card,{className:W.cn("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md","bg-card/50 backdrop-blur-sm",z&&"w-full",o&&"relative",I),style:!x&&L?{gridColumn:`span ${L.w}`,gridRow:`span ${L.h}`}:void 0,..._,children:[Q&&p.jsxs(W.CardHeader,{className:"pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",children:[p.jsx(W.CardTitle,{className:"text-sm sm:text-base font-medium tracking-tight truncate",title:Q,children:Q}),pe&&p.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:pe})]}),p.jsx(W.CardContent,{className:"p-0",children:p.jsx("div",{className:W.cn("h-full w-full","p-3 sm:p-4 md:p-6",o&&"pointer-events-none"),children:p.jsx(ze.SchemaRenderer,{schema:U})})}),o&&p.jsx("div",{className:"absolute inset-0 z-10","aria-hidden":"true","data-testid":"widget-click-overlay"})]},T)},d=e.header&&p.jsxs("div",{className:"col-span-full mb-4",children:[e.header.showTitle!==!1&&e.title&&p.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:Et(e.title)}),e.header.showDescription!==!1&&e.description&&p.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Et(e.description)}),e.header.actions&&e.header.actions.length>0&&p.jsx("div",{className:"flex gap-2 mt-3",children:e.header.actions.map((P,q)=>p.jsx(W.Button,{variant:"outline",size:"sm",children:P.label},q))})]}),m=a!==void 0&&p.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.toLocaleString()," records"]}),D=s?JSON.stringify(s):void 0,F=n&&p.jsxs("div",{className:W.cn("flex items-center justify-end gap-3 mb-2",!x&&"col-span-full"),children:[m,p.jsxs(W.Button,{variant:"outline",size:"sm",onClick:b,disabled:O,"aria-label":"Refresh dashboard",children:[p.jsx(je.RefreshCw,{className:W.cn("h-4 w-4 mr-2",O&&"animate-spin")}),O?"Refreshing…":"Refresh All"]})]});if(x){const P=e.widgets?.filter(z=>z.type==="metric")||[],q=e.widgets?.filter(z=>z.type!=="metric")||[];return p.jsxs("div",{ref:g,className:W.cn("flex flex-col gap-4 px-4",t),"data-user-actions":D,onClick:c,...v,children:[d,F,P.length>0&&p.jsx("div",{className:"grid grid-cols-2 gap-3",onClick:c,children:P.map((z,L)=>w(z,L))}),q.length>0&&p.jsx("div",{className:"flex flex-col gap-4",onClick:c,children:q.map((z,L)=>w(z,L,!0))})]})}return p.jsxs("div",{ref:g,className:W.cn("grid auto-rows-min","grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",t),style:{...h>4&&{gridTemplateColumns:`repeat(${h}, minmax(0, 1fr))`},gap:`${j*.25}rem`},"data-user-actions":D,onClick:c,...v,children:[d,F,e.widgets?.map((P,q)=>w(P,q))]})});function at(e){const{margin:t,containerPadding:r,containerWidth:n,cols:a}=e;return(n-t[0]*(a-1)-r[0]*2)/a}function ot(e,t,r){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*r):e}function pt(e,t,r,n,a,s,o){const{margin:f,containerPadding:u,rowHeight:v}=e,g=at(e);let h,j,O,R;if(o?(h=Math.round(o.width),j=Math.round(o.height)):(h=ot(n,g,f[0]),j=ot(a,v,f[1])),s?(O=Math.round(s.top),R=Math.round(s.left)):o?(O=Math.round(o.top),R=Math.round(o.left)):(O=Math.round((v+f[1])*r+u[1]),R=Math.round((g+f[0])*t+u[0])),!s&&!o){if(Number.isFinite(n)){const i=Math.round((g+f[0])*(t+n)+u[0])-R-h;i!==f[0]&&(h+=i-f[0])}if(Number.isFinite(a)){const i=Math.round((v+f[1])*(r+a)+u[1])-O-j;i!==f[1]&&(j+=i-f[1])}}return{top:O,left:R,width:h,height:j}}function na(e,t,r,n,a){const{margin:s,containerPadding:o,cols:f,rowHeight:u,maxRows:v}=e,g=at(e);let h=Math.round((r-o[0])/(g+s[0])),j=Math.round((t-o[1])/(u+s[1]));return h=Dt(h,0,f-n),j=Dt(j,0,v-a),{x:h,y:j}}function Ot(e,t,r){const{margin:n,containerPadding:a,rowHeight:s}=e,o=at(e),f=Math.round((r-a[0])/(o+n[0])),u=Math.round((t-a[1])/(s+n[1]));return{x:f,y:u}}function aa(e,t,r){const{margin:n,rowHeight:a}=e,s=at(e),o=Math.max(1,Math.round((t+n[0])/(s+n[0]))),f=Math.max(1,Math.round((r+n[1])/(a+n[1])));return{w:o,h:f}}function Dt(e,t,r){return Math.max(Math.min(e,r),t)}function rr(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 Qe(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(n!==void 0&&rr(n,t))return n}}function qr(e,t){return e.filter(r=>rr(r,t))}function oa(e,t){return t==="horizontal"?$r(e):t==="vertical"||t==="wrap"?nr(e):[...e]}function nr(e){return[...e].sort((t,r)=>t.y!==r.y?t.y-r.y:t.x-r.x)}function $r(e){return[...e].sort((t,r)=>t.x!==r.x?t.x-r.x:t.y-r.y)}function Tt(e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];if(n!==void 0){const a=n.y+n.h;a>t&&(t=a)}}return t}function et(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(n!==void 0&&n.i===t)return n}}function Rt(e){return e.filter(t=>t.static===!0)}function tt(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 Be(e){const t=new Array(e.length);for(let r=0;r<e.length;r++){const n=e[r];n!==void 0&&(t[r]=tt(n))}return t}function sa(e,t){const r=new Array(e.length);for(let n=0;n<e.length;n++){const a=e[n];a!==void 0&&(t.i===a.i?r[n]=t:r[n]=a)}return r}function ia(e,t,r){let n=et(e,t);return n?(n=r(tt(n)),[sa(e,n),n]):[[...e],null]}function ar(e,t){const r=Rt(e);for(let n=0;n<e.length;n++){const a=e[n];if(a!==void 0)if(a.x+a.w>t.cols&&(a.x=t.cols-a.w),a.x<0&&(a.x=0,a.w=t.cols),!a.static)r.push(a);else for(;Qe(r,a);)a.y++}return e}function rt(e,t,r,n,a,s,o,f,u){if(t.static&&t.isDraggable!==!0)return[...e];if(t.y===n&&t.x===r)return[...e];const v=t.x,g=t.y;typeof r=="number"&&(t.x=r),typeof n=="number"&&(t.y=n),t.moved=!0;let h=oa(e,o);(o==="vertical"&&typeof n=="number"?g>=n:o==="horizontal"&&typeof r=="number"&&v>=r)&&(h=h.reverse());const O=qr(h,t),R=O.length>0;if(R&&u)return Be(e);if(R&&s)return t.x=v,t.y=g,t.moved=!1,e;let x=[...e];for(let i=0;i<O.length;i++){const l=O[i];l!==void 0&&(l.moved||(l.static?x=Hr(x,l,t,a,o):x=Hr(x,t,l,a,o)))}return x}function Hr(e,t,r,n,a,s){const o=a==="horizontal",f=a==="vertical",u=t.static;if(n){n=!1;const h={x:o?Math.max(t.x-r.w,0):r.x,y:f?Math.max(t.y-r.h,0):r.y,w:r.w,h:r.h,i:"-1"},j=Qe(e,h),O=j!==void 0&&j.y+j.h>t.y,R=j!==void 0&&t.x+t.w>j.x;if(!j)return rt(e,r,o?h.x:void 0,f?h.y:void 0,n,u,a);if(O&&f)return rt(e,r,void 0,r.y+1,n,u,a);if(O&&a===null)return t.y=r.y,r.y=r.y+r.h,[...e];if(R&&o)return rt(e,t,r.x,void 0,n,u,a)}const v=o?r.x+1:void 0,g=f?r.y+1:void 0;return v===void 0&&g===void 0?[...e]:rt(e,r,v,g,n,u,a)}function st(e,t,r){return Math.max(t,Math.min(r,e))}var la={name:"gridBounds",constrainPosition(e,t,r,{cols:n,maxRows:a}){return{x:st(t,0,Math.max(0,n-e.w)),y:st(r,0,Math.max(0,a-e.h))}},constrainSize(e,t,r,n,{cols:a,maxRows:s}){const o=n==="w"||n==="nw"||n==="sw"?e.x+e.w:a-e.x,f=n==="n"||n==="nw"||n==="ne"?e.y+e.h:s-e.y;return{w:st(t,1,Math.max(1,o)),h:st(r,1,Math.max(1,f))}}},ua={name:"minMaxSize",constrainSize(e,t,r){return{w:st(t,e.minW??1,e.maxW??1/0),h:st(r,e.minH??1,e.maxH??1/0)}}},Yr=[la,ua];function _t(e,t,r,n,a){let s={x:r,y:n};for(const o of e)o.constrainPosition&&(s=o.constrainPosition(t,s.x,s.y,a));if(t.constraints)for(const o of t.constraints)o.constrainPosition&&(s=o.constrainPosition(t,s.x,s.y,a));return s}function ca(e,t,r,n,a,s){let o={w:r,h:n};for(const f of e)f.constrainSize&&(o=f.constrainSize(t,o.w,o.h,a,s));if(t.constraints)for(const f of t.constraints)f.constrainSize&&(o=f.constrainSize(t,o.w,o.h,a,s));return o}function Br({top:e,left:t,width:r,height:n}){const a=`translate(${t}px,${e}px)`;return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:`${r}px`,height:`${n}px`,position:"absolute"}}function fa({top:e,left:t,width:r,height:n}){return{top:`${e}px`,left:`${t}px`,width:`${r}px`,height:`${n}px`,position:"absolute"}}function Vr(e){return e*100+"%"}function da(e,t,r,n){return e+r>n?t:r}function Ur(e,t,r){return e<0?t:r}function pa(e){return Math.max(0,e)}function Nt(e){return Math.max(0,e)}var or=(e,t,r)=>{const{left:n,height:a,width:s}=t,o=e.top-(a-e.height);return{left:n,width:s,height:Ur(o,e.height,a),top:Nt(o)}},sr=(e,t,r)=>{const{top:n,left:a,height:s,width:o}=t;return{top:n,height:s,width:da(e.left,e.width,o,r),left:pa(a)}},ir=(e,t,r)=>{const{top:n,height:a,width:s}=t,o=e.left+e.width-s;return o<0?{height:a,width:e.left+e.width,top:Nt(n),left:0}:{height:a,width:s,top:Nt(n),left:o}},lr=(e,t,r)=>{const{top:n,left:a,height:s,width:o}=t;return{width:o,left:a,height:Ur(n,e.height,s),top:Nt(n)}},ha=(e,t,r)=>or(e,sr(e,t,r)),ga=(e,t,r)=>or(e,ir(e,t)),ma=(e,t,r)=>lr(e,sr(e,t,r)),ya=(e,t,r)=>lr(e,ir(e,t)),ba={n:or,ne:ha,e:sr,se:ma,s:lr,sw:ya,w:ir,nw:ga};function va(e,t,r,n){const a=ba[e];return a?a(t,{...t,...r},n):r}var xa={type:"transform",scale:1,calcStyle(e){return Br(e)}},wa=xa,Sa={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},ja={enabled:!0,bounded:!1,threshold:3},Ca={enabled:!0,handles:["se"]},Ea={enabled:!1,defaultItem:{w:1,h:1}};function ur(e,t,r,n,a){const s=n==="x"?"w":"h";t[n]+=1;const o=e.findIndex(u=>u.i===t.i),f=a??Rt(e).length>0;for(let u=o+1;u<e.length;u++){const v=e[u];if(v!==void 0&&!v.static){if(!f&&v.y>t.y+t.h)break;rr(t,v)&&ur(e,v,r+t[s],n,f)}}t[n]=r}function Pa(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&&!Qe(e,t);)t.y--;let a;for(;(a=Qe(e,t))!==void 0;)ur(r,t,a.y+a.h,"y");return t.y=Math.max(t.y,0),t}function Oa(e,t,r,n){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!Qe(e,t);)t.x--;let a;for(;(a=Qe(e,t))!==void 0;)if(ur(n,t,a.x+a.w,"x"),t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Qe(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Xr={type:"vertical",allowOverlap:!1,compact(e,t){const r=Rt(e);let n=Tt(r);const a=nr(e),s=new Array(e.length);for(let o=0;o<a.length;o++){const f=a[o];if(f===void 0)continue;let u=tt(f);u.static||(u=Pa(r,u,a,n),n=Math.max(n,u.y+u.h),r.push(u));const v=e.indexOf(f);s[v]=u,u.moved=!1}return s}},Gr={type:"horizontal",allowOverlap:!1,compact(e,t){const r=Rt(e),n=$r(e),a=new Array(e.length);for(let s=0;s<n.length;s++){const o=n[s];if(o===void 0)continue;let f=tt(o);f.static||(f=Oa(r,f,t,n),r.push(f));const u=e.indexOf(o);a[u]=f,f.moved=!1}return a}},Kr={type:null,allowOverlap:!1,compact(e,t){return Be(e)}},Da={...Xr,allowOverlap:!0,compact(e,t){return Be(e)}},Ta={...Gr,allowOverlap:!0,compact(e,t){return Be(e)}},Ra={...Kr,allowOverlap:!0};function cr(e,t=!1,r=!1){let n;return t?e==="vertical"?n=Da:e==="horizontal"?n=Ta:n=Ra:e==="vertical"?n=Xr:e==="horizontal"?n=Gr:n=Kr,r?{...n,preventCollision:r}:n}function Jr(e){return Object.keys(e).sort((r,n)=>e[r]-e[n])}function Zr(e,t){const r=Jr(e);let n=r[0];if(n===void 0)throw new Error("No breakpoints defined");for(let a=1;a<r.length;a++){const s=r[a];if(s===void 0)continue;const o=e[s];t>o&&(n=s)}return n}function Qr(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 fr(e,t,r,n,a,s){const o=e[r];if(o)return Be(o);let f=e[n];const u=Jr(t),v=u.slice(u.indexOf(r));for(let O=0;O<v.length;O++){const R=v[O];if(R===void 0)continue;const x=e[R];if(x){f=x;break}}const g=Be(f||[]),h=ar(g,{cols:a});return(typeof s=="object"&&s!==null?s:cr(s)).compact(h,a)}function kt(e,t){if(Array.isArray(e))return e;const r=e,n=r[t];if(n!==void 0)return n;const a=Object.keys(r);for(const s of a){const o=r[s];if(o!==void 0)return o}return[10,10]}function en(e){return function(r,n,a,s,o,f,u){return e(r,n,u)}}function Mt(e){return function(r,n,a,s){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,a,s);var o=s.get(r),f=s.get(n);if(o&&f)return o===n&&f===r;s.set(r,n),s.set(n,r);var u=e(r,n,a,s);return s.delete(r),s.delete(n),u}}function tn(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 rn(e){return e.constructor===Object||e.constructor==null}function nn(e){return typeof e.then=="function"}function At(e,t){return e===t||e!==e&&t!==t}var _a="[object Arguments]",Na="[object Boolean]",ka="[object Date]",Ma="[object RegExp]",Aa="[object Map]",za="[object Number]",La="[object Object]",Wa="[object Set]",Ia="[object String]",an=Object.prototype.toString;function zt(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areMapsEqual,a=e.areObjectsEqual,s=e.areRegExpsEqual,o=e.areSetsEqual,f=e.createIsNestedEqual,u=f(v);function v(g,h,j){if(g===h)return!0;if(!g||!h||typeof g!="object"||typeof h!="object")return g!==g&&h!==h;if(rn(g)&&rn(h))return a(g,h,u,j);var O=Array.isArray(g),R=Array.isArray(h);if(O||R)return O===R&&t(g,h,u,j);var x=an.call(g);return x!==an.call(h)?!1:x===ka?r(g,h,u,j):x===Ma?s(g,h,u,j):x===Aa?n(g,h,u,j):x===Wa?o(g,h,u,j):x===La||x===_a?nn(g)||nn(h)?!1:a(g,h,u,j):x===Na||x===za||x===Ia?At(g.valueOf(),h.valueOf()):!1}return v}function on(e,t,r,n){var a=e.length;if(t.length!==a)return!1;for(;a-- >0;)if(!r(e[a],t[a],a,a,e,t,n))return!1;return!0}var Fa=Mt(on);function sn(e,t){return At(e.valueOf(),t.valueOf())}function ln(e,t,r,n){var a=e.size===t.size;if(!a)return!1;if(!e.size)return!0;var s={},o=0;return e.forEach(function(f,u){if(a){var v=!1,g=0;t.forEach(function(h,j){!v&&!s[g]&&(v=r(u,j,o,g,e,t,n)&&r(f,h,u,j,e,t,n))&&(s[g]=!0),g++}),o++,a=v}}),a}var qa=Mt(ln),$a="_owner",Ha=Object.prototype.hasOwnProperty;function un(e,t,r,n){var a=Object.keys(e),s=a.length;if(Object.keys(t).length!==s)return!1;for(var o;s-- >0;){if(o=a[s],o===$a){var f=!!e.$$typeof,u=!!t.$$typeof;if((f||u)&&f!==u)return!1}if(!Ha.call(t,o)||!r(e[o],t[o],o,o,e,t,n))return!1}return!0}var Ya=Mt(un);function cn(e,t){return e.source===t.source&&e.flags===t.flags}function fn(e,t,r,n){var a=e.size===t.size;if(!a)return!1;if(!e.size)return!0;var s={};return e.forEach(function(o,f){if(a){var u=!1,v=0;t.forEach(function(g,h){!u&&!s[v]&&(u=r(o,g,f,h,e,t,n))&&(s[v]=!0),v++}),a=u}}),a}var Ba=Mt(fn),dn=Object.freeze({areArraysEqual:on,areDatesEqual:sn,areMapsEqual:ln,areObjectsEqual:un,areRegExpsEqual:cn,areSetsEqual:fn,createIsNestedEqual:en}),pn=Object.freeze({areArraysEqual:Fa,areDatesEqual:sn,areMapsEqual:qa,areObjectsEqual:Ya,areRegExpsEqual:cn,areSetsEqual:Ba,createIsNestedEqual:en}),Va=zt(dn);function $e(e,t){return Va(e,t,void 0)}zt(tn(dn,{createIsNestedEqual:function(){return At}})),zt(pn),zt(tn(pn,{createIsNestedEqual:function(){return At}}));function Ua(e={}){const{measureBeforeMount:t=!1,initialWidth:r=1280}=e,[n,a]=C.useState(r),[s,o]=C.useState(!t),f=C.useRef(null),u=C.useRef(null),v=C.useCallback(()=>{const g=f.current;if(g){const h=g.offsetWidth;a(h),s||o(!0)}},[s]);return C.useEffect(()=>{const g=f.current;if(g)return v(),typeof ResizeObserver<"u"&&(u.current=new ResizeObserver(h=>{const j=h[0];if(j){const O=j.contentRect.width;a(O)}}),u.current.observe(g)),()=>{u.current&&(u.current.disconnect(),u.current=null)}},[v]),{width:n,mounted:s,containerRef:f,measureWidth:v}}var ht={exports:{}},dr={},Lt={exports:{}},Wt={exports:{}},te={};var hn;function Xa(){if(hn)return te;hn=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,a=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,o=e?Symbol.for("react.provider"):60109,f=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,v=e?Symbol.for("react.concurrent_mode"):60111,g=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,j=e?Symbol.for("react.suspense_list"):60120,O=e?Symbol.for("react.memo"):60115,R=e?Symbol.for("react.lazy"):60116,x=e?Symbol.for("react.block"):60121,i=e?Symbol.for("react.fundamental"):60117,l=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function S(c){if(typeof c=="object"&&c!==null){var w=c.$$typeof;switch(w){case t:switch(c=c.type,c){case u:case v:case n:case s:case a:case h:return c;default:switch(c=c&&c.$$typeof,c){case f:case g:case R:case O:case o:return c;default:return w}}case r:return w}}}function E(c){return S(c)===v}return te.AsyncMode=u,te.ConcurrentMode=v,te.ContextConsumer=f,te.ContextProvider=o,te.Element=t,te.ForwardRef=g,te.Fragment=n,te.Lazy=R,te.Memo=O,te.Portal=r,te.Profiler=s,te.StrictMode=a,te.Suspense=h,te.isAsyncMode=function(c){return E(c)||S(c)===u},te.isConcurrentMode=E,te.isContextConsumer=function(c){return S(c)===f},te.isContextProvider=function(c){return S(c)===o},te.isElement=function(c){return typeof c=="object"&&c!==null&&c.$$typeof===t},te.isForwardRef=function(c){return S(c)===g},te.isFragment=function(c){return S(c)===n},te.isLazy=function(c){return S(c)===R},te.isMemo=function(c){return S(c)===O},te.isPortal=function(c){return S(c)===r},te.isProfiler=function(c){return S(c)===s},te.isStrictMode=function(c){return S(c)===a},te.isSuspense=function(c){return S(c)===h},te.isValidElementType=function(c){return typeof c=="string"||typeof c=="function"||c===n||c===v||c===s||c===a||c===h||c===j||typeof c=="object"&&c!==null&&(c.$$typeof===R||c.$$typeof===O||c.$$typeof===o||c.$$typeof===f||c.$$typeof===g||c.$$typeof===i||c.$$typeof===l||c.$$typeof===b||c.$$typeof===x)},te.typeOf=S,te}var re={};var gn;function Ga(){return gn||(gn=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,a=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,o=e?Symbol.for("react.provider"):60109,f=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,v=e?Symbol.for("react.concurrent_mode"):60111,g=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,j=e?Symbol.for("react.suspense_list"):60120,O=e?Symbol.for("react.memo"):60115,R=e?Symbol.for("react.lazy"):60116,x=e?Symbol.for("react.block"):60121,i=e?Symbol.for("react.fundamental"):60117,l=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function S(N){return typeof N=="string"||typeof N=="function"||N===n||N===v||N===s||N===a||N===h||N===j||typeof N=="object"&&N!==null&&(N.$$typeof===R||N.$$typeof===O||N.$$typeof===o||N.$$typeof===f||N.$$typeof===g||N.$$typeof===i||N.$$typeof===l||N.$$typeof===b||N.$$typeof===x)}function E(N){if(typeof N=="object"&&N!==null){var se=N.$$typeof;switch(se){case t:var Ne=N.type;switch(Ne){case u:case v:case n:case s:case a:case h:return Ne;default:var Te=Ne&&Ne.$$typeof;switch(Te){case f:case g:case R:case O:case o:return Te;default:return se}}case r:return se}}}var c=u,w=v,d=f,m=o,D=t,F=g,P=n,q=R,z=O,L=r,X=s,U=a,J=h,Q=!1;function pe(N){return Q||(Q=!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.")),T(N)||E(N)===u}function T(N){return E(N)===v}function y(N){return E(N)===f}function _(N){return E(N)===o}function I(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function k(N){return E(N)===g}function Y(N){return E(N)===n}function M(N){return E(N)===R}function A(N){return E(N)===O}function H(N){return E(N)===r}function $(N){return E(N)===s}function B(N){return E(N)===a}function G(N){return E(N)===h}re.AsyncMode=c,re.ConcurrentMode=w,re.ContextConsumer=d,re.ContextProvider=m,re.Element=D,re.ForwardRef=F,re.Fragment=P,re.Lazy=q,re.Memo=z,re.Portal=L,re.Profiler=X,re.StrictMode=U,re.Suspense=J,re.isAsyncMode=pe,re.isConcurrentMode=T,re.isContextConsumer=y,re.isContextProvider=_,re.isElement=I,re.isForwardRef=k,re.isFragment=Y,re.isLazy=M,re.isMemo=A,re.isPortal=H,re.isProfiler=$,re.isStrictMode=B,re.isSuspense=G,re.isValidElementType=S,re.typeOf=E})()),re}var mn;function yn(){return mn||(mn=1,process.env.NODE_ENV==="production"?Wt.exports=Xa():Wt.exports=Ga()),Wt.exports}var pr,bn;function Ka(){if(bn)return pr;bn=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function a(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},f=0;f<10;f++)o["_"+String.fromCharCode(f)]=f;var u=Object.getOwnPropertyNames(o).map(function(g){return o[g]});if(u.join("")!=="0123456789")return!1;var v={};return"abcdefghijklmnopqrst".split("").forEach(function(g){v[g]=g}),Object.keys(Object.assign({},v)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return pr=a()?Object.assign:function(s,o){for(var f,u=n(s),v,g=1;g<arguments.length;g++){f=Object(arguments[g]);for(var h in f)t.call(f,h)&&(u[h]=f[h]);if(e){v=e(f);for(var j=0;j<v.length;j++)r.call(f,v[j])&&(u[v[j]]=f[v[j]])}}return u},pr}var hr,vn;function gr(){if(vn)return hr;vn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return hr=e,hr}var mr,xn;function wn(){return xn||(xn=1,mr=Function.call.bind(Object.prototype.hasOwnProperty)),mr}var yr,Sn;function Ja(){if(Sn)return yr;Sn=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=gr(),r={},n=wn();e=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function a(s,o,f,u,v){if(process.env.NODE_ENV!=="production"){for(var g in s)if(n(s,g)){var h;try{if(typeof s[g]!="function"){var j=Error((u||"React class")+": "+f+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw j.name="Invariant Violation",j}h=s[g](o,g,u,f,null,t)}catch(R){h=R}if(h&&!(h instanceof Error)&&e((u||"React class")+": type specification of "+f+" `"+g+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in r)){r[h.message]=!0;var O=v?v():"";e("Failed "+f+" type: "+h.message+(O??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},yr=a,yr}var br,jn;function Za(){if(jn)return br;jn=1;var e=yn(),t=Ka(),r=gr(),n=wn(),a=Ja(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(f){var u="Warning: "+f;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function o(){return null}return br=function(f,u){var v=typeof Symbol=="function"&&Symbol.iterator,g="@@iterator";function h(T){var y=T&&(v&&T[v]||T[g]);if(typeof y=="function")return y}var j="<<anonymous>>",O={array:l("array"),bigint:l("bigint"),bool:l("boolean"),func:l("function"),number:l("number"),object:l("object"),string:l("string"),symbol:l("symbol"),any:b(),arrayOf:S,element:E(),elementType:c(),instanceOf:w,node:F(),objectOf:m,oneOf:d,oneOfType:D,shape:q,exact:z};function R(T,y){return T===y?T!==0||1/T===1/y:T!==T&&y!==y}function x(T,y){this.message=T,this.data=y&&typeof y=="object"?y:{},this.stack=""}x.prototype=Error.prototype;function i(T){if(process.env.NODE_ENV!=="production")var y={},_=0;function I(Y,M,A,H,$,B,G){if(H=H||j,B=B||A,G!==r){if(u){var N=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 N.name="Invariant Violation",N}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var se=H+":"+A;!y[se]&&_<3&&(s("You are manually calling a React.PropTypes validation function for the `"+B+"` prop on `"+H+"`. 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."),y[se]=!0,_++)}}return M[A]==null?Y?M[A]===null?new x("The "+$+" `"+B+"` is marked as required "+("in `"+H+"`, but its value is `null`.")):new x("The "+$+" `"+B+"` is marked as required in "+("`"+H+"`, but its value is `undefined`.")):null:T(M,A,H,$,B)}var k=I.bind(null,!1);return k.isRequired=I.bind(null,!0),k}function l(T){function y(_,I,k,Y,M,A){var H=_[I],$=U(H);if($!==T){var B=J(H);return new x("Invalid "+Y+" `"+M+"` of type "+("`"+B+"` supplied to `"+k+"`, expected ")+("`"+T+"`."),{expectedType:T})}return null}return i(y)}function b(){return i(o)}function S(T){function y(_,I,k,Y,M){if(typeof T!="function")return new x("Property `"+M+"` of component `"+k+"` has invalid PropType notation inside arrayOf.");var A=_[I];if(!Array.isArray(A)){var H=U(A);return new x("Invalid "+Y+" `"+M+"` of type "+("`"+H+"` supplied to `"+k+"`, expected an array."))}for(var $=0;$<A.length;$++){var B=T(A,$,k,Y,M+"["+$+"]",r);if(B instanceof Error)return B}return null}return i(y)}function E(){function T(y,_,I,k,Y){var M=y[_];if(!f(M)){var A=U(M);return new x("Invalid "+k+" `"+Y+"` of type "+("`"+A+"` supplied to `"+I+"`, expected a single ReactElement."))}return null}return i(T)}function c(){function T(y,_,I,k,Y){var M=y[_];if(!e.isValidElementType(M)){var A=U(M);return new x("Invalid "+k+" `"+Y+"` of type "+("`"+A+"` supplied to `"+I+"`, expected a single ReactElement type."))}return null}return i(T)}function w(T){function y(_,I,k,Y,M){if(!(_[I]instanceof T)){var A=T.name||j,H=pe(_[I]);return new x("Invalid "+Y+" `"+M+"` of type "+("`"+H+"` supplied to `"+k+"`, expected ")+("instance of `"+A+"`."))}return null}return i(y)}function d(T){if(!Array.isArray(T))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("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])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function y(_,I,k,Y,M){for(var A=_[I],H=0;H<T.length;H++)if(R(A,T[H]))return null;var $=JSON.stringify(T,function(G,N){var se=J(N);return se==="symbol"?String(N):N});return new x("Invalid "+Y+" `"+M+"` of value `"+String(A)+"` "+("supplied to `"+k+"`, expected one of "+$+"."))}return i(y)}function m(T){function y(_,I,k,Y,M){if(typeof T!="function")return new x("Property `"+M+"` of component `"+k+"` has invalid PropType notation inside objectOf.");var A=_[I],H=U(A);if(H!=="object")return new x("Invalid "+Y+" `"+M+"` of type "+("`"+H+"` supplied to `"+k+"`, expected an object."));for(var $ in A)if(n(A,$)){var B=T(A,$,k,Y,M+"."+$,r);if(B instanceof Error)return B}return null}return i(y)}function D(T){if(!Array.isArray(T))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var y=0;y<T.length;y++){var _=T[y];if(typeof _!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Q(_)+" at index "+y+"."),o}function I(k,Y,M,A,H){for(var $=[],B=0;B<T.length;B++){var G=T[B],N=G(k,Y,M,A,H,r);if(N==null)return null;N.data&&n(N.data,"expectedType")&&$.push(N.data.expectedType)}var se=$.length>0?", expected one of type ["+$.join(", ")+"]":"";return new x("Invalid "+A+" `"+H+"` supplied to "+("`"+M+"`"+se+"."))}return i(I)}function F(){function T(y,_,I,k,Y){return L(y[_])?null:new x("Invalid "+k+" `"+Y+"` supplied to "+("`"+I+"`, expected a ReactNode."))}return i(T)}function P(T,y,_,I,k){return new x((T||"React class")+": "+y+" type `"+_+"."+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+k+"`.")}function q(T){function y(_,I,k,Y,M){var A=_[I],H=U(A);if(H!=="object")return new x("Invalid "+Y+" `"+M+"` of type `"+H+"` "+("supplied to `"+k+"`, expected `object`."));for(var $ in T){var B=T[$];if(typeof B!="function")return P(k,Y,M,$,J(B));var G=B(A,$,k,Y,M+"."+$,r);if(G)return G}return null}return i(y)}function z(T){function y(_,I,k,Y,M){var A=_[I],H=U(A);if(H!=="object")return new x("Invalid "+Y+" `"+M+"` of type `"+H+"` "+("supplied to `"+k+"`, expected `object`."));var $=t({},_[I],T);for(var B in $){var G=T[B];if(n(T,B)&&typeof G!="function")return P(k,Y,M,B,J(G));if(!G)return new x("Invalid "+Y+" `"+M+"` key `"+B+"` supplied to `"+k+"`.\nBad object: "+JSON.stringify(_[I],null," ")+`
|
|
7
|
-
|
|
8
|
-
`,m.innerHTML
|
|
9
|
-
`,d.getElementsByTagName("head")[0].appendChild(m)),d.body&&c(d.body,"react-draggable-transparent-selection")}function S(d){window.requestAnimationFrame?window.requestAnimationFrame(()=>{E(d)}):E(d)}function E(d){if(d)try{if(d.body&&w(d.body,"react-draggable-transparent-selection"),d.selection)d.selection.empty();else{const m=(d.defaultView||window).getSelection();m&&m.type!=="Caret"&&m.removeAllRanges()}}catch{}}function c(d,m){d.classList?d.classList.add(m):d.className.match(new RegExp(`(?:^|\\s)${m}(?!\\S)`))||(d.className+=` ${m}`)}function w(d,m){d.classList?d.classList.remove(m):d.className=d.className.replace(new RegExp(`(?:^|\\s)${m}(?!\\S)`,"g"),"")}return ye}var Ie={},Tn;function Rn(){if(Tn)return Ie;Tn=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.canDragX=a,Ie.canDragY=s,Ie.createCoreData=f,Ie.createDraggableData=u,Ie.getBoundPosition=r,Ie.getControlPosition=o,Ie.snapToGrid=n;var e=Ft(),t=xr();function r(h,j,O){if(!h.props.bounds)return[j,O];let{bounds:R}=h.props;R=typeof R=="string"?R:v(R);const x=g(h);if(typeof R=="string"){const{ownerDocument:i}=x,l=i.defaultView;let b;if(R==="parent"?b=x.parentNode:b=x.getRootNode().querySelector(R),!(b instanceof l.HTMLElement))throw new Error('Bounds selector "'+R+'" could not find an element.');const S=b,E=l.getComputedStyle(x),c=l.getComputedStyle(S);R={left:-x.offsetLeft+(0,e.int)(c.paddingLeft)+(0,e.int)(E.marginLeft),top:-x.offsetTop+(0,e.int)(c.paddingTop)+(0,e.int)(E.marginTop),right:(0,t.innerWidth)(S)-(0,t.outerWidth)(x)-x.offsetLeft+(0,e.int)(c.paddingRight)-(0,e.int)(E.marginRight),bottom:(0,t.innerHeight)(S)-(0,t.outerHeight)(x)-x.offsetTop+(0,e.int)(c.paddingBottom)-(0,e.int)(E.marginBottom)}}return(0,e.isNum)(R.right)&&(j=Math.min(j,R.right)),(0,e.isNum)(R.bottom)&&(O=Math.min(O,R.bottom)),(0,e.isNum)(R.left)&&(j=Math.max(j,R.left)),(0,e.isNum)(R.top)&&(O=Math.max(O,R.top)),[j,O]}function n(h,j,O){const R=Math.round(j/h[0])*h[0],x=Math.round(O/h[1])*h[1];return[R,x]}function a(h){return h.props.axis==="both"||h.props.axis==="x"}function s(h){return h.props.axis==="both"||h.props.axis==="y"}function o(h,j,O){const R=typeof j=="number"?(0,t.getTouch)(h,j):null;if(typeof j=="number"&&!R)return null;const x=g(O),i=O.props.offsetParent||x.offsetParent||x.ownerDocument.body;return(0,t.offsetXYFromParent)(R||h,i,O.props.scale)}function f(h,j,O){const R=!(0,e.isNum)(h.lastX),x=g(h);return R?{node:x,deltaX:0,deltaY:0,lastX:j,lastY:O,x:j,y:O}:{node:x,deltaX:j-h.lastX,deltaY:O-h.lastY,lastX:h.lastX,lastY:h.lastY,x:j,y:O}}function u(h,j){const O=h.props.scale;return{node:j.node,x:h.state.x+j.deltaX/O,y:h.state.y+j.deltaY/O,deltaX:j.deltaX/O,deltaY:j.deltaY/O,lastX:h.state.x,lastY:h.state.y}}function v(h){return{left:h.left,top:h.top,right:h.right,bottom:h.bottom}}function g(h){const j=h.findDOMNode();if(!j)throw new Error("<DraggableCore>: Unmounted during event!");return j}return Ie}var gt={},qt={},_n;function Nn(){if(_n)return qt;_n=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=e;function e(){}return qt}var kn;function to(){if(kn)return gt;kn=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.default=void 0;var e=u(C),t=f(It()),r=f(Ar),n=xr(),a=Rn(),s=Ft(),o=f(Nn());function f(x){return x&&x.__esModule?x:{default:x}}function u(x,i){if(typeof WeakMap=="function")var l=new WeakMap,b=new WeakMap;return(u=function(S,E){if(!E&&S&&S.__esModule)return S;var c,w,d={__proto__:null,default:S};if(S===null||typeof S!="object"&&typeof S!="function")return d;if(c=E?b:l){if(c.has(S))return c.get(S);c.set(S,d)}for(const m in S)m!=="default"&&{}.hasOwnProperty.call(S,m)&&((w=(c=Object.defineProperty)&&Object.getOwnPropertyDescriptor(S,m))&&(w.get||w.set)?c(d,m,w):d[m]=S[m]);return d})(x,i)}function v(x,i,l){return(i=g(i))in x?Object.defineProperty(x,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):x[i]=l,x}function g(x){var i=h(x,"string");return typeof i=="symbol"?i:i+""}function h(x,i){if(typeof x!="object"||!x)return x;var l=x[Symbol.toPrimitive];if(l!==void 0){var b=l.call(x,i);if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(x)}const j={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let O=j.mouse,R=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",i=>{if(this.props.onMouseDown(i),!this.props.allowAnyClick&&typeof i.button=="number"&&i.button!==0)return!1;const l=this.findDOMNode();if(!l||!l.ownerDocument||!l.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:b}=l;if(this.props.disabled||!(i.target instanceof b.defaultView.Node)||this.props.handle&&!(0,n.matchesSelectorAndParentsTo)(i.target,this.props.handle,l)||this.props.cancel&&(0,n.matchesSelectorAndParentsTo)(i.target,this.props.cancel,l))return;i.type==="touchstart"&&!this.props.allowMobileScroll&&i.preventDefault();const S=(0,n.getTouchIdentifier)(i);this.touchIdentifier=S;const E=(0,a.getControlPosition)(i,S,this);if(E==null)return;const{x:c,y:w}=E,d=(0,a.createCoreData)(this,c,w);(0,o.default)("DraggableCore: handleDragStart: %j",d),(0,o.default)("calling",this.props.onStart),!(this.props.onStart(i,d)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,n.addUserSelectStyles)(b),this.dragging=!0,this.lastX=c,this.lastY=w,(0,n.addEvent)(b,O.move,this.handleDrag),(0,n.addEvent)(b,O.stop,this.handleDragStop))}),v(this,"handleDrag",i=>{const l=(0,a.getControlPosition)(i,this.touchIdentifier,this);if(l==null)return;let{x:b,y:S}=l;if(Array.isArray(this.props.grid)){let w=b-this.lastX,d=S-this.lastY;if([w,d]=(0,a.snapToGrid)(this.props.grid,w,d),!w&&!d)return;b=this.lastX+w,S=this.lastY+d}const E=(0,a.createCoreData)(this,b,S);if((0,o.default)("DraggableCore: handleDrag: %j",E),this.props.onDrag(i,E)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const d=document.createEvent("MouseEvents");d.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(d)}return}this.lastX=b,this.lastY=S}),v(this,"handleDragStop",i=>{if(!this.dragging)return;const l=(0,a.getControlPosition)(i,this.touchIdentifier,this);if(l==null)return;let{x:b,y:S}=l;if(Array.isArray(this.props.grid)){let d=b-this.lastX||0,m=S-this.lastY||0;[d,m]=(0,a.snapToGrid)(this.props.grid,d,m),b=this.lastX+d,S=this.lastY+m}const E=(0,a.createCoreData)(this,b,S);if(this.props.onStop(i,E)===!1||this.mounted===!1)return!1;const w=this.findDOMNode();w&&this.props.enableUserSelectHack&&(0,n.scheduleRemoveUserSelectStyles)(w.ownerDocument),(0,o.default)("DraggableCore: handleDragStop: %j",E),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,w&&((0,o.default)("DraggableCore: Removing handlers"),(0,n.removeEvent)(w.ownerDocument,O.move,this.handleDrag),(0,n.removeEvent)(w.ownerDocument,O.stop,this.handleDragStop))}),v(this,"onMouseDown",i=>(O=j.mouse,this.handleDragStart(i))),v(this,"onMouseUp",i=>(O=j.mouse,this.handleDragStop(i))),v(this,"onTouchStart",i=>(O=j.touch,this.handleDragStart(i))),v(this,"onTouchEnd",i=>(O=j.touch,this.handleDragStop(i)))}componentDidMount(){this.mounted=!0;const i=this.findDOMNode();i&&(0,n.addEvent)(i,j.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const i=this.findDOMNode();if(i){const{ownerDocument:l}=i;(0,n.removeEvent)(l,j.mouse.move,this.handleDrag),(0,n.removeEvent)(l,j.touch.move,this.handleDrag),(0,n.removeEvent)(l,j.mouse.stop,this.handleDragStop),(0,n.removeEvent)(l,j.touch.stop,this.handleDragStop),(0,n.removeEvent)(i,j.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,n.scheduleRemoveUserSelectStyles)(l)}}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 gt.default=R,v(R,"displayName","DraggableCore"),v(R,"propTypes",{allowAnyClick:t.default.bool,allowMobileScroll:t.default.bool,children:t.default.node.isRequired,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:function(x,i){if(x[i]&&x[i].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:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),v(R,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),gt}var Mn;function ro(){return Mn||(Mn=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return u.default}}),e.default=void 0;var t=h(C),r=g(It()),n=g(Ar),a=er,s=xr(),o=Rn(),f=Ft(),u=g(to()),v=g(Nn());function g(l){return l&&l.__esModule?l:{default:l}}function h(l,b){if(typeof WeakMap=="function")var S=new WeakMap,E=new WeakMap;return(h=function(c,w){if(!w&&c&&c.__esModule)return c;var d,m,D={__proto__:null,default:c};if(c===null||typeof c!="object"&&typeof c!="function")return D;if(d=w?E:S){if(d.has(c))return d.get(c);d.set(c,D)}for(const F in c)F!=="default"&&{}.hasOwnProperty.call(c,F)&&((m=(d=Object.defineProperty)&&Object.getOwnPropertyDescriptor(c,F))&&(m.get||m.set)?d(D,F,m):D[F]=c[F]);return D})(l,b)}function j(){return j=Object.assign?Object.assign.bind():function(l){for(var b=1;b<arguments.length;b++){var S=arguments[b];for(var E in S)({}).hasOwnProperty.call(S,E)&&(l[E]=S[E])}return l},j.apply(null,arguments)}function O(l,b,S){return(b=R(b))in l?Object.defineProperty(l,b,{value:S,enumerable:!0,configurable:!0,writable:!0}):l[b]=S,l}function R(l){var b=x(l,"string");return typeof b=="symbol"?b:b+""}function x(l,b){if(typeof l!="object"||!l)return l;var S=l[Symbol.toPrimitive];if(S!==void 0){var E=S.call(l,b);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return(b==="string"?String:Number)(l)}class i extends t.Component{static getDerivedStateFromProps(b,S){let{position:E}=b,{prevPropsPosition:c}=S;return E&&(!c||E.x!==c.x||E.y!==c.y)?((0,v.default)("Draggable: getDerivedStateFromProps %j",{position:E,prevPropsPosition:c}),{x:E.x,y:E.y,prevPropsPosition:{...E}}):null}constructor(b){super(b),O(this,"onDragStart",(S,E)=>{if((0,v.default)("Draggable: onDragStart: %j",E),this.props.onStart(S,(0,o.createDraggableData)(this,E))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),O(this,"onDrag",(S,E)=>{if(!this.state.dragging)return!1;(0,v.default)("Draggable: onDrag: %j",E);const c=(0,o.createDraggableData)(this,E),w={x:c.x,y:c.y,slackX:0,slackY:0};if(this.props.bounds){const{x:m,y:D}=w;w.x+=this.state.slackX,w.y+=this.state.slackY;const[F,P]=(0,o.getBoundPosition)(this,w.x,w.y);w.x=F,w.y=P,w.slackX=this.state.slackX+(m-w.x),w.slackY=this.state.slackY+(D-w.y),c.x=w.x,c.y=w.y,c.deltaX=w.x-this.state.x,c.deltaY=w.y-this.state.y}if(this.props.onDrag(S,c)===!1)return!1;this.setState(w)}),O(this,"onDragStop",(S,E)=>{if(!this.state.dragging||this.props.onStop(S,(0,o.createDraggableData)(this,E))===!1)return!1;(0,v.default)("Draggable: onDragStop: %j",E);const w={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:m,y:D}=this.props.position;w.x=m,w.y=D}this.setState(w)}),this.state={dragging:!1,dragged:!1,x:b.position?b.position.x:b.defaultPosition.x,y:b.position?b.position.y:b.defaultPosition.y,prevPropsPosition:{...b.position},slackX:0,slackY:0,isElementSVG:!1},b.position&&!(b.onDrag||b.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:b,bounds:S,children:E,defaultPosition:c,defaultClassName:w,defaultClassNameDragging:d,defaultClassNameDragged:m,position:D,positionOffset:F,scale:P,...q}=this.props;let z={},L=null;const U=!!!D||this.state.dragging,J=D||c,Q={x:(0,o.canDragX)(this)&&U?this.state.x:J.x,y:(0,o.canDragY)(this)&&U?this.state.y:J.y};this.state.isElementSVG?L=(0,s.createSVGTransform)(Q,F):z=(0,s.createCSSTransform)(Q,F);const pe=(0,a.clsx)(E.props.className||"",w,{[d]:this.state.dragging,[m]:this.state.dragged});return t.createElement(u.default,j({},q,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(E),{className:pe,style:{...E.props.style,...z},transform:L}))}}e.default=i,O(i,"displayName","Draggable"),O(i,"propTypes",{...u.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:f.dontSetMe,style:f.dontSetMe,transform:f.dontSetMe}),O(i,"defaultProps",{...u.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(dr)),dr}var An;function wr(){if(An)return ht.exports;An=1;const{default:e,DraggableCore:t}=ro();return ht.exports=e,ht.exports.default=e,ht.exports.DraggableCore=t,ht.exports}var no=wr(),mt={exports:{}},yt={},$t={},zn;function ao(){if(zn)return $t;zn=1,$t.__esModule=!0,$t.cloneElement=f;var e=t(C);function t(u){return u&&u.__esModule?u:{default:u}}function r(u,v){var g=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);v&&(h=h.filter(function(j){return Object.getOwnPropertyDescriptor(u,j).enumerable})),g.push.apply(g,h)}return g}function n(u){for(var v=1;v<arguments.length;v++){var g=arguments[v]!=null?arguments[v]:{};v%2?r(Object(g),!0).forEach(function(h){a(u,h,g[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(g)):r(Object(g)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(g,h))})}return u}function a(u,v,g){return(v=s(v))in u?Object.defineProperty(u,v,{value:g,enumerable:!0,configurable:!0,writable:!0}):u[v]=g,u}function s(u){var v=o(u,"string");return typeof v=="symbol"?v:v+""}function o(u,v){if(typeof u!="object"||!u)return u;var g=u[Symbol.toPrimitive];if(g!==void 0){var h=g.call(u,v);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(v==="string"?String:Number)(u)}function f(u,v){return v.style&&u.props.style&&(v.style=n(n({},u.props.style),v.style)),v.className&&u.props.className&&(v.className=`${u.props.className} ${v.className}`),e.default.cloneElement(u,v)}return $t}var bt={},Ln;function Wn(){if(Ln)return bt;Ln=1,bt.__esModule=!0,bt.resizableProps=void 0;var e=t(It());wr();function t(r){return r&&r.__esModule?r:{default:r}}return bt.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),a=0;a<r;a++)n[a]=arguments[a];const[s]=n;return s.axis==="both"||s.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),a=0;a<r;a++)n[a]=arguments[a];const[s]=n;return s.axis==="both"||s.axis==="x"?e.default.number.isRequired(...n):e.default.number(...n)}},bt}var In;function Fn(){if(In)return yt;In=1,yt.__esModule=!0,yt.default=void 0;var e=s(C),t=wr(),r=ao(),n=Wn();const a=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function s(x,i){if(typeof WeakMap=="function")var l=new WeakMap,b=new WeakMap;return(s=function(S,E){if(!E&&S&&S.__esModule)return S;var c,w,d={__proto__:null,default:S};if(S===null||typeof S!="object"&&typeof S!="function")return d;if(c=E?b:l){if(c.has(S))return c.get(S);c.set(S,d)}for(const m in S)m!=="default"&&{}.hasOwnProperty.call(S,m)&&((w=(c=Object.defineProperty)&&Object.getOwnPropertyDescriptor(S,m))&&(w.get||w.set)?c(d,m,w):d[m]=S[m]);return d})(x,i)}function o(){return o=Object.assign?Object.assign.bind():function(x){for(var i=1;i<arguments.length;i++){var l=arguments[i];for(var b in l)({}).hasOwnProperty.call(l,b)&&(x[b]=l[b])}return x},o.apply(null,arguments)}function f(x,i){if(x==null)return{};var l,b,S=u(x,i);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(x);for(b=0;b<E.length;b++)l=E[b],i.indexOf(l)===-1&&{}.propertyIsEnumerable.call(x,l)&&(S[l]=x[l])}return S}function u(x,i){if(x==null)return{};var l={};for(var b in x)if({}.hasOwnProperty.call(x,b)){if(i.indexOf(b)!==-1)continue;l[b]=x[b]}return l}function v(x,i){var l=Object.keys(x);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(x);i&&(b=b.filter(function(S){return Object.getOwnPropertyDescriptor(x,S).enumerable})),l.push.apply(l,b)}return l}function g(x){for(var i=1;i<arguments.length;i++){var l=arguments[i]!=null?arguments[i]:{};i%2?v(Object(l),!0).forEach(function(b){h(x,b,l[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(l)):v(Object(l)).forEach(function(b){Object.defineProperty(x,b,Object.getOwnPropertyDescriptor(l,b))})}return x}function h(x,i,l){return(i=j(i))in x?Object.defineProperty(x,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):x[i]=l,x}function j(x){var i=O(x,"string");return typeof i=="symbol"?i:i+""}function O(x,i){if(typeof x!="object"||!x)return x;var l=x[Symbol.toPrimitive];if(l!==void 0){var b=l.call(x,i);if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(x)}let R=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(i,l){const{minConstraints:b,maxConstraints:S,lockAspectRatio:E}=this.props;if(!b&&!S&&!E)return[i,l];if(E){const D=this.props.width/this.props.height,F=i-this.props.width,P=l-this.props.height;Math.abs(F)>Math.abs(P*D)?l=i/D:i=l*D}const[c,w]=[i,l];let[d,m]=this.slack||[0,0];return i+=d,l+=m,b&&(i=Math.max(b[0],i),l=Math.max(b[1],l)),S&&(i=Math.min(S[0],i),l=Math.min(S[1],l)),this.slack=[d+(c-i),m+(w-l)],[i,l]}resizeHandler(i,l){return(b,S)=>{let{node:E,deltaX:c,deltaY:w}=S;i==="onResizeStart"&&this.resetData();const d=(this.props.axis==="both"||this.props.axis==="x")&&l!=="n"&&l!=="s",m=(this.props.axis==="both"||this.props.axis==="y")&&l!=="e"&&l!=="w";if(!d&&!m)return;const D=l[0],F=l[l.length-1],P=E.getBoundingClientRect();if(this.lastHandleRect!=null){if(F==="w"){const J=P.left-this.lastHandleRect.left;c+=J}if(D==="n"){const J=P.top-this.lastHandleRect.top;w+=J}}this.lastHandleRect=P,F==="w"&&(c=-c),D==="n"&&(w=-w);let q=this.props.width+(d?c/this.props.transformScale:0),z=this.props.height+(m?w/this.props.transformScale:0);[q,z]=this.runConstraints(q,z),i==="onResizeStop"&&this.lastSize&&({width:q,height:z}=this.lastSize);const L=q!==this.props.width||z!==this.props.height;i!=="onResizeStop"&&(this.lastSize={width:q,height:z});const X=typeof this.props[i]=="function"?this.props[i]:null;X&&!(i==="onResize"&&!L)&&(b.persist?.(),X(b,{node:E,size:{width:q,height:z},handle:l})),i==="onResizeStop"&&this.resetData()}}renderResizeHandle(i,l){const{handle:b}=this.props;if(!b)return e.createElement("span",{className:`react-resizable-handle react-resizable-handle-${i}`,ref:l});if(typeof b=="function")return b(i,l);const S=typeof b.type=="string",E=g({ref:l},S?{}:{handleAxis:i});return e.cloneElement(b,E)}render(){const i=this.props,{children:l,className:b,draggableOpts:S,width:E,height:c,handle:w,handleSize:d,lockAspectRatio:m,axis:D,minConstraints:F,maxConstraints:P,onResize:q,onResizeStop:z,onResizeStart:L,resizeHandles:X,transformScale:U}=i,J=f(i,a);return(0,r.cloneElement)(l,g(g({},J),{},{className:`${b?`${b} `:""}react-resizable`,children:[...e.Children.toArray(l.props.children),...X.map(Q=>{const pe=this.handleRefs[Q]??(this.handleRefs[Q]=e.createRef());return e.createElement(t.DraggableCore,o({},S,{nodeRef:pe,key:`resizableHandle-${Q}`,onStop:this.resizeHandler("onResizeStop",Q),onStart:this.resizeHandler("onResizeStart",Q),onDrag:this.resizeHandler("onResize",Q)}),this.renderResizeHandle(Q,pe))})]}))}};return yt.default=R,R.propTypes=n.resizableProps,R.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},yt}var vt={},qn;function oo(){if(qn)return vt;qn=1,vt.__esModule=!0,vt.default=void 0;var e=o(C),t=s(It()),r=s(Fn()),n=Wn();const a=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function s(i){return i&&i.__esModule?i:{default:i}}function o(i,l){if(typeof WeakMap=="function")var b=new WeakMap,S=new WeakMap;return(o=function(E,c){if(!c&&E&&E.__esModule)return E;var w,d,m={__proto__:null,default:E};if(E===null||typeof E!="object"&&typeof E!="function")return m;if(w=c?S:b){if(w.has(E))return w.get(E);w.set(E,m)}for(const D in E)D!=="default"&&{}.hasOwnProperty.call(E,D)&&((d=(w=Object.defineProperty)&&Object.getOwnPropertyDescriptor(E,D))&&(d.get||d.set)?w(m,D,d):m[D]=E[D]);return m})(i,l)}function f(){return f=Object.assign?Object.assign.bind():function(i){for(var l=1;l<arguments.length;l++){var b=arguments[l];for(var S in b)({}).hasOwnProperty.call(b,S)&&(i[S]=b[S])}return i},f.apply(null,arguments)}function u(i,l){var b=Object.keys(i);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(i);l&&(S=S.filter(function(E){return Object.getOwnPropertyDescriptor(i,E).enumerable})),b.push.apply(b,S)}return b}function v(i){for(var l=1;l<arguments.length;l++){var b=arguments[l]!=null?arguments[l]:{};l%2?u(Object(b),!0).forEach(function(S){g(i,S,b[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(b)):u(Object(b)).forEach(function(S){Object.defineProperty(i,S,Object.getOwnPropertyDescriptor(b,S))})}return i}function g(i,l,b){return(l=h(l))in i?Object.defineProperty(i,l,{value:b,enumerable:!0,configurable:!0,writable:!0}):i[l]=b,i}function h(i){var l=j(i,"string");return typeof l=="symbol"?l:l+""}function j(i,l){if(typeof i!="object"||!i)return i;var b=i[Symbol.toPrimitive];if(b!==void 0){var S=b.call(i,l);if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(i)}function O(i,l){if(i==null)return{};var b,S,E=R(i,l);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(i);for(S=0;S<c.length;S++)b=c[S],l.indexOf(b)===-1&&{}.propertyIsEnumerable.call(i,b)&&(E[b]=i[b])}return E}function R(i,l){if(i==null)return{};var b={};for(var S in i)if({}.hasOwnProperty.call(i,S)){if(l.indexOf(S)!==-1)continue;b[S]=i[S]}return b}let x=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=(l,b)=>{const{size:S}=b;this.props.onResize?(l.persist?.(),this.setState(S,()=>this.props.onResize&&this.props.onResize(l,b))):this.setState(S)}}static getDerivedStateFromProps(l,b){return b.propsWidth!==l.width||b.propsHeight!==l.height?{width:l.width,height:l.height,propsWidth:l.width,propsHeight:l.height}:null}render(){const l=this.props,{handle:b,handleSize:S,onResize:E,onResizeStart:c,onResizeStop:w,draggableOpts:d,minConstraints:m,maxConstraints:D,lockAspectRatio:F,axis:P,width:q,height:z,resizeHandles:L,style:X,transformScale:U}=l,J=O(l,a);return e.createElement(r.default,{axis:P,draggableOpts:d,handle:b,handleSize:S,height:this.state.height,lockAspectRatio:F,maxConstraints:D,minConstraints:m,onResizeStart:c,onResize:this.onResize,onResizeStop:w,resizeHandles:L,transformScale:U,width:this.state.width},e.createElement("div",f({},J,{style:v(v({},X),{},{width:this.state.width+"px",height:this.state.height+"px"})})))}};return vt.default=x,x.propTypes=v(v({},n.resizableProps),{},{children:t.default.element}),vt}var $n;function so(){return $n||($n=1,mt.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},mt.exports.Resizable=Fn().default,mt.exports.ResizableBox=oo().default),mt.exports}var io=so();function Hn(e){const{children:t,cols:r,containerWidth:n,margin:a,containerPadding:s,rowHeight:o,maxRows:f,isDraggable:u,isResizable:v,isBounded:g,static:h,useCSSTransforms:j=!0,usePercentages:O=!1,transformScale:R=1,positionStrategy:x,dragThreshold:i=0,droppingPosition:l,className:b="",style:S,handle:E="",cancel:c="",x:w,y:d,w:m,h:D,minW:F=1,maxW:P=1/0,minH:q=1,maxH:z=1/0,i:L,resizeHandles:X,resizeHandle:U,constraints:J=Yr,layoutItem:Q,layout:pe=[],onDragStart:T,onDrag:y,onDragStop:_,onResizeStart:I,onResize:k,onResizeStop:Y}=e,[M,A]=C.useState(!1),[H,$]=C.useState(!1),B=C.useRef(null),G=C.useRef({left:0,top:0}),N=C.useRef({top:0,left:0,width:0,height:0}),se=C.useRef(void 0),Ne=C.useRef(pe);Ne.current=pe;const Te=C.useRef(null),be=C.useRef(null),Ce=C.useRef(!1),it=C.useRef({x:0,y:0}),he=C.useRef(!1),ue=C.useMemo(()=>({cols:r,containerPadding:s,containerWidth:n,margin:a,maxRows:f,rowHeight:o}),[r,s,n,a,f,o]),Ee=C.useMemo(()=>({cols:r,maxRows:f,containerWidth:n,containerHeight:0,rowHeight:o,margin:a,layout:[]}),[r,f,n,o,a]),we=C.useCallback(()=>({...Ee,layout:Ne.current}),[Ee]),Le=C.useMemo(()=>Q??{i:L,x:w,y:d,w:m,h:D,minW:F,maxW:P,minH:q,maxH:z},[Q,L,w,d,m,D,F,P,q,z]),Bt=C.useCallback(ne=>{if(x?.calcStyle)return x.calcStyle(ne);if(j)return Br(ne);const ae=fa(ne);return O?{...ae,left:Vr(ne.left/n),width:Vr(ne.width/n)}:ae},[x,j,O,n]),Fe=C.useCallback((ne,{node:ae})=>{if(!T)return;const{offsetParent:me}=ae;if(!me)return;const ie=me.getBoundingClientRect(),ve=ae.getBoundingClientRect(),Pe=ve.left/R,Re=ie.left/R,Oe=ve.top/R,Me=ie.top/R;let Ae;if(x?.calcDragPosition){const Z=ne;Ae=x.calcDragPosition(Z.clientX,Z.clientY,Z.clientX-ve.left,Z.clientY-ve.top)}else Ae={left:Pe-Re+me.scrollLeft,top:Oe-Me+me.scrollTop};if(G.current=Ae,i>0){const Z=ne;it.current={x:Z.clientX,y:Z.clientY},Ce.current=!0,he.current=!1,A(!0);return}A(!0);const Je=Ot(ue,Ae.top,Ae.left),{x:Ze,y:V}=_t(J,Le,Je.x,Je.y,we());T(L,Ze,V,{e:ne,node:ae,newPosition:Ae})},[T,R,ue,x,i,J,Le,we,L]),lt=C.useCallback((ne,{node:ae,deltaX:me,deltaY:ie})=>{if(!y||!M)return;const ve=ne;if(Ce.current&&!he.current){const Ze=ve.clientX-it.current.x,V=ve.clientY-it.current.y;if(Math.hypot(Ze,V)<i)return;if(he.current=!0,Ce.current=!1,T){const K=Ot(ue,G.current.top,G.current.left),{x:ee,y:le}=_t(J,Le,K.x,K.y,we());T(L,ee,le,{e:ne,node:ae,newPosition:G.current})}}let Pe=G.current.top+ie,Re=G.current.left+me;if(g){const{offsetParent:Ze}=ae;if(Ze){const V=Ze.clientHeight-ot(D,o,a[1]);Pe=Dt(Pe,0,V);const Z=at(ue),K=n-ot(m,Z,a[0]);Re=Dt(Re,0,K)}}const Oe={top:Pe,left:Re};G.current=Oe;const Me=Ot(ue,Pe,Re),{x:Ae,y:Je}=_t(J,Le,Me.x,Me.y,we());y(L,Ae,Je,{e:ne,node:ae,newPosition:Oe})},[y,T,M,i,g,D,o,a,ue,n,m,L,J,Le,we]),Xe=C.useCallback((ne,{node:ae})=>{if(!_||!M)return;const me=Ce.current;if(Ce.current=!1,he.current=!1,it.current={x:0,y:0},me){A(!1),G.current={left:0,top:0};return}const{left:ie,top:ve}=G.current,Pe={top:ve,left:ie};A(!1),G.current={left:0,top:0};const Re=Ot(ue,ve,ie),{x:Oe,y:Me}=_t(J,Le,Re.x,Re.y,we());_(L,Oe,Me,{e:ne,node:ae,newPosition:Pe})},[_,M,ue,J,Le,we,L]);Te.current=Fe,be.current=lt;const We=C.useCallback((ne,{node:ae,size:me,handle:ie},ve,Pe)=>{const Re=Pe==="onResizeStart"?I:Pe==="onResize"?k:Y;if(!Re)return;let Oe;ae?Oe=va(ie,ve,me,n):Oe={...me,top:ve.top,left:ve.left},N.current=Oe;const Me=aa(ue,Oe.width,Oe.height),{w:Ae,h:Je}=ca(J,Le,Me.w,Me.h,ie,we());Re(L,Ae,Je,{e:ne.nativeEvent,node:ae,size:Oe,handle:ie})},[I,k,Y,n,ue,L,J,Le,we]),ut=C.useCallback((ne,ae)=>{$(!0);const me=pt(ue,w,d,m,D),ie={...ae,handle:ae.handle};We(ne,ie,me,"onResizeStart")},[We,ue,w,d,m,D]),ct=C.useCallback((ne,ae)=>{const me=pt(ue,w,d,m,D),ie={...ae,handle:ae.handle};We(ne,ie,me,"onResize")},[We,ue,w,d,m,D]),Ge=C.useCallback((ne,ae)=>{$(!1),N.current={top:0,left:0,width:0,height:0};const me=pt(ue,w,d,m,D),ie={...ae,handle:ae.handle};We(ne,ie,me,"onResizeStop")},[We,ue,w,d,m,D]);C.useEffect(()=>{if(!l)return;const ne=B.current;if(!ne)return;const ae=se.current||{left:0,top:0},me=M&&(l.left!==ae.left||l.top!==ae.top);if(M){if(me){const ie=l.left-G.current.left,ve=l.top-G.current.top,Pe={node:ne,deltaX:ie,deltaY:ve,lastX:G.current.left,lastY:G.current.top,x:l.left,y:l.top};be.current?.(l.e,Pe)}}else{const ie={node:ne,deltaX:l.left,deltaY:l.top,lastX:0,lastY:0,x:l.left,y:l.top};Te.current?.(l.e,ie)}se.current=l},[l,M,L]);const qe=pt(ue,w,d,m,D,M?G.current:null,H?N.current:null),wt=C.Children.only(t),St=pt(ue,0,0,1,1),Vt=[St.width,St.height],Ut=[1/0,1/0],ke=wt.props,Nr=ke.className,Xt=ke.style;let Ke=C.cloneElement(wt,{ref:B,className:er("react-grid-item",Nr,b,{static:h,resizing:H,"react-draggable":u,"react-draggable-dragging":M,dropping:!!l,cssTransforms:j}),style:{...S,...Xt,...Bt(qe)}});const Gt=U;return Ke=p.jsx(io.Resizable,{draggableOpts:{disabled:!v},className:v?void 0:"react-resizable-hide",width:qe.width,height:qe.height,minConstraints:Vt,maxConstraints:Ut,onResizeStart:ut,onResize:ct,onResizeStop:Ge,transformScale:R,resizeHandles:X,handle:Gt,children:Ke}),Ke=p.jsx(no.DraggableCore,{disabled:!u,onStart:Fe,onDrag:lt,onStop:Xe,handle:E,cancel:".react-resizable-handle"+(c?","+c:""),scale:R,nodeRef:B,children:Ke}),Ke}var He=()=>{},Yn="react-grid-layout",Bn=!1;try{Bn=/firefox/i.test(navigator.userAgent)}catch{}function lo(e,t){const r=C.Children.toArray(e),n=C.Children.toArray(t);if(r.length!==n.length)return!1;for(let a=0;a<r.length;a++){const s=r[a],o=n[a];if(s?.key!==o?.key)return!1}return!0}function Vn(e,t,r,n){const a=[],s=new Set;C.Children.forEach(t,f=>{if(!C.isValidElement(f)||f.key===null)return;const u=String(f.key);s.add(u);const v=e.find(g=>g.i===u);if(v)a.push(tt(v));else{const h=f.props["data-grid"];h?a.push({i:u,x:h.x??0,y:h.y??0,w:h.w??1,h:h.h??1,minW:h.minW,maxW:h.maxW,minH:h.minH,maxH:h.maxH,static:h.static,isDraggable:h.isDraggable,isResizable:h.isResizable,resizeHandles:h.resizeHandles,isBounded:h.isBounded}):a.push({i:u,x:0,y:Tt(a),w:1,h:1})}});const o=ar(a,{cols:r});return n.compact(o,r)}function uo(e){const{children:t,width:r,gridConfig:n,dragConfig:a,resizeConfig:s,dropConfig:o,positionStrategy:f=wa,compactor:u,constraints:v=Yr,layout:g=[],droppingItem:h,autoSize:j=!0,className:O="",style:R={},innerRef:x,onLayoutChange:i=He,onDragStart:l=He,onDrag:b=He,onDragStop:S=He,onResizeStart:E=He,onResize:c=He,onResizeStop:w=He,onDrop:d=He,onDropDragOver:m=He}=e,D=C.useMemo(()=>({...Sa,...n}),[n]),F=C.useMemo(()=>({...ja,...a}),[a]),P=C.useMemo(()=>({...Ca,...s}),[s]),q=C.useMemo(()=>({...Ea,...o}),[o]),{cols:z,rowHeight:L,maxRows:X,margin:U,containerPadding:J}=D,{enabled:Q,bounded:pe,handle:T,cancel:y,threshold:_}=F,{enabled:I,handles:k,handleComponent:Y}=P,{enabled:M,defaultItem:A,onDragOver:H}=q,$=u??cr("vertical"),B=$.type,G=$.allowOverlap,N=$.preventCollision??!1,se=C.useMemo(()=>h??{i:"__dropping-elem__",...A},[h,A]),Ne=f.type==="transform",Te=f.scale,be=J??U,[Ce,it]=C.useState(!1),[he,ue]=C.useState(()=>Vn(g,t,z,$)),[Ee,we]=C.useState(null),[Le,Bt]=C.useState(!1),[Fe,lt]=C.useState(null),[Xe,We]=C.useState(),ut=C.useRef(null),ct=C.useRef(null),Ge=C.useRef(null),qe=C.useRef(0),wt=C.useRef(he),St=C.useRef(g),Vt=C.useRef(t),Ut=C.useRef(B),ke=C.useRef(he);ke.current=he,C.useEffect(()=>{it(!0),$e(he,g)||i(he)},[]),C.useEffect(()=>{if(Ee||Fe)return;const V=!$e(g,St.current),Z=!lo(t,Vt.current),K=B!==Ut.current;if(V||Z||K){const le=Vn(V?g:he,t,z,$);$e(le,he)||ue(le)}St.current=g,Vt.current=t,Ut.current=B},[g,t,z,B,$,Ee,Fe,he]),C.useEffect(()=>{if(!Ee&&!$e(he,wt.current)){wt.current=he;const V=he.filter(Z=>Z.i!==se.i);i(V)}},[he,Ee,i,se.i]);const Nr=C.useMemo(()=>{if(!j)return;const V=Tt(he),Z=be[1];return V*L+(V-1)*U[1]+Z*2+"px"},[j,he,L,U,be]),Xt=C.useCallback((V,Z,K,ee)=>{const le=ke.current,oe=et(le,V);if(!oe)return;const ce={w:oe.w,h:oe.h,x:oe.x,y:oe.y,i:V};ut.current=tt(oe),Ge.current=le,we(ce),l(le,oe,oe,null,ee.e,ee.node)},[l]),Ke=C.useCallback((V,Z,K,ee)=>{const le=ke.current,oe=ut.current,ce=et(le,V);if(!ce)return;const xe={w:ce.w,h:ce.h,x:ce.x,y:ce.y,i:V},fe=rt(le,ce,Z,K,!0,N,B,z,G);b(fe,oe,ce,xe,ee.e,ee.node),ue($.compact(fe,z)),we(xe)},[N,B,z,G,$,b]),Gt=C.useCallback((V,Z,K,ee)=>{if(!Ee)return;const le=ke.current,oe=ut.current,ce=et(le,V);if(!ce)return;const xe=rt(le,ce,Z,K,!0,N,B,z,G),fe=$.compact(xe,z);S(fe,oe,ce,null,ee.e,ee.node);const Se=Ge.current;ut.current=null,Ge.current=null,we(null),ue(fe),Se&&!$e(Se,fe)&&i(fe)},[Ee,N,B,z,G,$,S,i]),ne=C.useCallback((V,Z,K,ee)=>{const le=ke.current,oe=et(le,V);oe&&(ct.current=tt(oe),Ge.current=le,Bt(!0),E(le,oe,oe,null,ee.e,ee.node))},[E]),ae=C.useCallback((V,Z,K,ee)=>{const le=ke.current,oe=ct.current,{handle:ce}=ee;let xe=!1,fe,Se;const[Kt,Ye]=ia(le,V,ge=>(fe=ge.x,Se=ge.y,["sw","w","nw","n","ne"].includes(ce)&&(["sw","nw","w"].includes(ce)&&(fe=ge.x+(ge.w-Z),Z=ge.x!==fe&&fe<0?ge.w:Z,fe=fe<0?0:fe),["ne","n","nw"].includes(ce)&&(Se=ge.y+(ge.h-K),K=ge.y!==Se&&Se<0?ge.h:K,Se=Se<0?0:Se),xe=!0),N&&!G&&qr(le,{...ge,w:Z,h:K,x:fe??ge.x,y:Se??ge.y}).filter(Zt=>Zt.i!==ge.i).length>0&&(Se=ge.y,K=ge.h,fe=ge.x,Z=ge.w,xe=!1),ge.w=Z,ge.h=K,ge));if(!Ye)return;let jt=Kt;xe&&fe!==void 0&&Se!==void 0&&(jt=rt(Kt,Ye,fe,Se,!0,N,B,z,G));const Jt={w:Ye.w,h:Ye.h,x:Ye.x,y:Ye.y,i:V,static:!0};c(jt,oe,Ye,Jt,ee.e,ee.node),ue($.compact(jt,z)),we(Jt)},[N,B,z,G,$,c]),me=C.useCallback((V,Z,K,ee)=>{const le=ke.current,oe=ct.current,ce=et(le,V),xe=$.compact(le,z);w(xe,oe,ce??null,null,ee.e,ee.node);const fe=Ge.current;ct.current=null,Ge.current=null,we(null),Bt(!1),ue(xe),fe&&!$e(fe,xe)&&i(xe)},[z,$,w,i]),ie=C.useCallback(()=>{const V=ke.current;if(!V.some(ee=>ee.i===se.i)){lt(null),we(null),We(void 0);return}const K=$.compact(V.filter(ee=>ee.i!==se.i),z);ue(K),lt(null),we(null),We(void 0)},[se.i,z,$]),ve=C.useCallback(V=>{if(V.preventDefault(),V.stopPropagation(),Bn&&!V.nativeEvent.target?.classList.contains(Yn))return!1;const Z=H?H(V.nativeEvent):m(V);if(Z===!1)return Fe&&ie(),!1;const{dragOffsetX:K=0,dragOffsetY:ee=0,...le}=Z??{},oe={...se,...le},ce=V.currentTarget.getBoundingClientRect(),xe={cols:z,margin:U,maxRows:X,rowHeight:L,containerWidth:r,containerPadding:be},fe=at(xe),Se=ot(oe.w,fe,U[0]),Kt=ot(oe.h,L,U[1]),Ye=Se/2,jt=Kt/2,Jt=V.clientX-ce.left+K-Ye,ge=V.clientY-ce.top+ee-jt,kr=Math.max(0,Jt),Zt=Math.max(0,ge),Qt={left:kr/Te,top:Zt/Te,e:V.nativeEvent};if(Fe)Xe&&(Xe.left!==Qt.left||Xe.top!==Qt.top)&&We(Qt);else{const Mr=na(xe,Zt,kr,oe.w,oe.h);lt(p.jsx("div",{},oe.i)),We(Qt),ue([...ke.current,{...oe,x:Mr.x,y:Mr.y,static:!1,isDraggable:!0}])}},[Fe,Xe,se,H,m,ie,Te,z,U,X,L,r,be]),Pe=C.useCallback(V=>{V.preventDefault(),V.stopPropagation(),qe.current--,qe.current<0&&(qe.current=0),qe.current===0&&ie()},[ie]),Re=C.useCallback(V=>{V.preventDefault(),V.stopPropagation(),qe.current++},[]),Oe=C.useCallback(V=>{V.preventDefault(),V.stopPropagation();const Z=ke.current,K=Z.find(ee=>ee.i===se.i);qe.current=0,ie(),d(Z,K,V.nativeEvent)},[se.i,ie,d]),Me=C.useCallback((V,Z)=>{if(!V||!V.key)return null;const K=et(he,String(V.key));if(!K)return null;const ee=typeof K.isDraggable=="boolean"?K.isDraggable:!K.static&&Q,le=typeof K.isResizable=="boolean"?K.isResizable:!K.static&&I,oe=K.resizeHandles||[...k],ce=ee&&pe&&K.isBounded!==!1,xe=Y;return p.jsx(Hn,{containerWidth:r,cols:z,margin:U,containerPadding:be,maxRows:X,rowHeight:L,cancel:y,handle:T,onDragStart:Xt,onDrag:Ke,onDragStop:Gt,onResizeStart:ne,onResize:ae,onResizeStop:me,isDraggable:ee,isResizable:le,isBounded:ce,useCSSTransforms:Ne&&Ce,usePercentages:!Ce,transformScale:Te,positionStrategy:f,dragThreshold:_,w:K.w,h:K.h,x:K.x,y:K.y,i:K.i,minH:K.minH,minW:K.minW,maxH:K.maxH,maxW:K.maxW,static:K.static,droppingPosition:Z?Xe:void 0,resizeHandles:oe,resizeHandle:xe,constraints:v,layoutItem:K,layout:he,children:V},K.i)},[he,r,z,U,be,X,L,y,T,Xt,Ke,Gt,ne,ae,me,Q,I,pe,Ne,Ce,Te,f,_,Xe,k,Y,v]),Ae=()=>Ee?p.jsx(Hn,{w:Ee.w,h:Ee.h,x:Ee.x,y:Ee.y,i:Ee.i,className:`react-grid-placeholder ${Le?"placeholder-resizing":""}`,containerWidth:r,cols:z,margin:U,containerPadding:be,maxRows:X,rowHeight:L,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:Ne,transformScale:Te,constraints:v,layout:he,children:p.jsx("div",{})}):null,Je=er(Yn,O),Ze={height:Nr,...R};return p.jsxs("div",{ref:x,className:Je,style:Ze,onDrop:M?Oe:void 0,onDragLeave:M?Pe:void 0,onDragEnter:M?Re:void 0,onDragOver:M?ve:void 0,children:[C.Children.map(t,V=>C.isValidElement(V)?Me(V):null),M&&Fe&&Me(Fe,!0),Ae()]})}var co={lg:1200,md:996,sm:768,xs:480,xxs:0},fo={lg:12,md:10,sm:6,xs:4,xxs:2},Sr=()=>{};function po(e,t,r,n){const a=[];C.Children.forEach(t,o=>{if(!C.isValidElement(o)||o.key===null)return;const f=String(o.key),u=e.find(v=>v.i===f);if(u)a.push({...u,i:f});else{const g=o.props["data-grid"];g?a.push({i:f,x:g.x??0,y:g.y??0,w:g.w??1,h:g.h??1,minW:g.minW,maxW:g.maxW,minH:g.minH,maxH:g.maxH,static:g.static,isDraggable:g.isDraggable,isResizable:g.isResizable,resizeHandles:g.resizeHandles,isBounded:g.isBounded}):a.push({i:f,x:0,y:Tt(a),w:1,h:1})}});const s=ar(a,{cols:r});return n.compact(s,r)}function ho(e){const{children:t,width:r,breakpoint:n,breakpoints:a=co,cols:s=fo,layouts:o={},rowHeight:f=150,maxRows:u=1/0,margin:v=[10,10],containerPadding:g=null,compactor:h,onBreakpointChange:j=Sr,onLayoutChange:O=Sr,onWidthChange:R=Sr,...x}=e,i=h??cr("vertical"),l=i.type,b=i.allowOverlap,S=C.useMemo(()=>n??Zr(a,r),[]),E=C.useMemo(()=>Qr(S,s),[S,s]),c=C.useMemo(()=>fr(o,a,S,S,E,l),[]),[w,d]=C.useState(S),[m,D]=C.useState(E),[F,P]=C.useState(c),[q,z]=C.useState(o),L=C.useRef(r),X=C.useRef(n),U=C.useRef(a),J=C.useRef(s),Q=C.useRef(o),pe=C.useRef(l),T=C.useRef(q);C.useEffect(()=>{T.current=q},[q]);const y=C.useMemo(()=>$e(o,Q.current)?null:fr(o,a,w,w,m,i),[o,a,w,m,i]),_=y??F;C.useEffect(()=>{y!==null&&(P(y),z(o),T.current=o,Q.current=o)},[y,o]),C.useEffect(()=>{if(l!==pe.current){const A=i.compact(Be(_),m),H={...T.current,[w]:A};P(A),z(H),T.current=H,O(A,H),pe.current=l}},[l,i,_,m,b,w,O]),C.useEffect(()=>{const A=r!==L.current,H=n!==X.current,$=!$e(a,U.current),B=!$e(s,J.current);if(A||H||$||B){const G=n??Zr(a,r),N=Qr(G,s),se=w;if(se!==G||$||B){const be={...T.current};be[se]||(be[se]=Be(F));let Ce=fr(be,a,G,se,N,i);Ce=po(Ce,t,N,i),be[G]=Ce,d(G),D(N),P(Ce),z(be),T.current=be,j(G,N),O(Ce,be)}const Ne=kt(v,G),Te=g?kt(g,G):null;R(r,Ne,N,Te),L.current=r,X.current=n,U.current=a,J.current=s}},[r,n,a,s,w,m,F,t,i,l,b,v,g,j,O,R]);const I=C.useCallback(A=>{const $={...T.current,[w]:A};P(A),z($),T.current=$,O(A,$)},[w,O]),k=C.useMemo(()=>kt(v,w),[v,w]),Y=C.useMemo(()=>g===null?null:kt(g,w),[g,w]),M=C.useMemo(()=>({cols:m,rowHeight:f,maxRows:u,margin:k,containerPadding:Y}),[m,f,u,k,Y]);return p.jsx(uo,{...x,width:r,gridConfig:M,compactor:i,onLayoutChange:I,layout:_,children:t})}function go({editMode:e}){const t=ze.useDnd();return De.useEffect(()=>{if(e)return t.startDrag({id:"dashboard-layout",type:"dashboard-widget",data:{}}),()=>{t.endDrag()};t.endDrag("dashboard")},[e,t]),null}const jr=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],Cr=({schema:e,className:t,onLayoutChange:r,persistLayoutKey:n="dashboard-layout",onRefresh:a})=>{const{width:s,containerRef:o,mounted:f}=Ua(),[u,v]=De.useState(!1),[g,h]=De.useState(!1),j=ze.useHasDndProvider(),O=De.useRef(null),R=De.useCallback(()=>{a&&(h(!0),a(),setTimeout(()=>h(!1),600))},[a]);De.useEffect(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!a))return O.current=setInterval(R,e.refreshInterval*1e3),()=>{O.current&&clearInterval(O.current)}},[e.refreshInterval,a,R]);const[x,i]=De.useState(()=>{if(typeof window<"u"&&n){const c=localStorage.getItem(n);if(c)try{return JSON.parse(c)}catch(w){console.error("Failed to parse saved layout:",w)}}return{lg:e.widgets?.map((c,w)=>({i:c.id||`widget-${w}`,x:c.layout?.x||w%4*3,y:c.layout?.y||Math.floor(w/4)*4,w:c.layout?.w||3,h:c.layout?.h||4}))||[]}}),l=De.useCallback((c,w)=>{i(w),r?.(c)},[r]),b=De.useCallback(()=>{typeof window<"u"&&n&&localStorage.setItem(n,JSON.stringify(x)),v(!1)},[x,n]),S=De.useCallback(()=>{const c={lg:e.widgets?.map((w,d)=>({i:w.id||`widget-${d}`,x:w.layout?.x||d%4*3,y:w.layout?.y||Math.floor(d/4)*4,w:w.layout?.w||3,h:w.layout?.h||4}))||[]};i(c),typeof window<"u"&&n&&localStorage.removeItem(n)},[e.widgets,n]),E=De.useCallback(c=>{if(c.component)return c.component;const w=c.type,d=c.options||{};if(w==="bar"||w==="line"||w==="area"||w==="pie"||w==="donut"||w==="scatter"){const m=c.data||d.data,D=c.categoryField||d.xField||"name",F=c.valueField||d.yField||"value";if(nt(m)){const q=m.aggregate,z=q?{field:c.valueField||q.field,function:c.aggregate||q.function,groupBy:c.categoryField||q.groupBy}:void 0,L=z?.field||F;return{type:"object-chart",chartType:w,objectName:c.object||m.object,aggregate:z,xAxisKey:D,series:[{dataKey:L}],colors:jr,className:"h-full"}}if(!m&&c.object){const q=c.aggregate?{field:c.valueField||"value",function:c.aggregate,groupBy:c.categoryField||"name"}:void 0;return{type:"object-chart",chartType:w,objectName:c.object,aggregate:q,xAxisKey:D,series:[{dataKey:c.valueField||"value"}],colors:jr,className:"h-full"}}const P=Array.isArray(m)?m:m?.items||[];return{type:"chart",chartType:w,data:P,xAxisKey:D,series:[{dataKey:F}],colors:jr,className:"h-full"}}if(w==="table"){const m=c.data||d.data;if(nt(m)){const{data:D,...F}=d;return{type:"data-table",...F,objectName:c.object||m.object,dataProvider:m,data:[],searchable:!1,pagination:!1,className:"border-0"}}return!m&&c.object?{type:"data-table",...d,objectName:c.object,data:[],searchable:!1,pagination:!1,className:"border-0"}:{type:"data-table",...d,data:m?.items||[],searchable:!1,pagination:!1,className:"border-0"}}if(w==="pivot"){const m=c.data||d.data;if(nt(m)){const{data:D,...F}=d;return{type:"pivot",...F,objectName:c.object||m.object,dataProvider:m,data:[]}}return{type:"pivot",...d,data:Array.isArray(m)?m:m?.items||[]}}return{...c,...d}},[]);return p.jsxs("div",{ref:o,className:W.cn("w-full",t),"data-testid":"grid-layout",children:[j&&p.jsx(go,{editMode:u}),p.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[p.jsx("h2",{className:"text-2xl font-bold",children:e.title||"Dashboard"}),p.jsx("div",{className:"flex gap-2",children:u?p.jsxs(p.Fragment,{children:[p.jsxs(W.Button,{onClick:b,size:"sm",variant:"default",children:[p.jsx(je.Save,{className:"h-4 w-4 mr-2"}),"Save Layout"]}),p.jsxs(W.Button,{onClick:S,size:"sm",variant:"outline",children:[p.jsx(je.X,{className:"h-4 w-4 mr-2"}),"Reset"]}),p.jsx(W.Button,{onClick:()=>v(!1),size:"sm",variant:"ghost",children:"Cancel"})]}):p.jsxs(p.Fragment,{children:[a&&p.jsxs(W.Button,{onClick:R,size:"sm",variant:"outline",disabled:g,"aria-label":"Refresh dashboard",children:[p.jsx(je.RefreshCw,{className:W.cn("h-4 w-4 mr-2",g&&"animate-spin")}),g?"Refreshing…":"Refresh All"]}),p.jsxs(W.Button,{onClick:()=>v(!0),size:"sm",variant:"outline",children:[p.jsx(je.Edit,{className:"h-4 w-4 mr-2"}),"Edit Layout"]})]})})]}),f&&p.jsx(ho,{className:"layout",width:s,layouts:x,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:l,children:e.widgets?.map((c,w)=>{const d=c.id||`widget-${w}`,m=E(c),D=c.type==="metric";return p.jsx("div",{className:"h-full",children:D?p.jsxs("div",{className:"h-full w-full relative",children:[u&&p.jsx("div",{className:"drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",children:p.jsx(je.GripVertical,{className:"h-4 w-4"})}),p.jsx(ze.SchemaRenderer,{schema:m,className:"h-full w-full"})]}):p.jsxs(W.Card,{className:W.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&&p.jsxs(W.CardHeader,{className:"pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",children:[p.jsx(W.CardTitle,{className:"text-base font-medium tracking-tight truncate",title:c.title,children:c.title}),u&&p.jsx("div",{className:"drag-handle cursor-move p-1 hover:bg-muted/40 rounded",children:p.jsx(je.GripVertical,{className:"h-4 w-4"})})]}),p.jsx(W.CardContent,{className:"p-0 h-full",children:p.jsx("div",{className:W.cn("h-full w-full overflow-auto p-4"),children:p.jsx(ze.SchemaRenderer,{schema:m})})})]})},d)})})]})};function Er(e){if(e!=null)return typeof e=="string"?e:e.defaultValue||e.key}const Pr=({label:e,value:t,trend:r,icon:n,className:a,description:s,...o})=>{const f=C.useMemo(()=>{if(typeof n=="string"){const u=Lr[n];return u?p.jsx(u,{className:"h-4 w-4 text-muted-foreground"}):null}return n},[n]);return p.jsxs(W.Card,{className:W.cn("h-full overflow-hidden",a),...o,children:[p.jsxs(W.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[p.jsx(W.CardTitle,{className:"text-sm font-medium truncate",children:Er(e)}),f&&p.jsx("div",{className:"h-4 w-4 text-muted-foreground shrink-0",children:f})]}),p.jsxs(W.CardContent,{children:[p.jsx("div",{className:"text-2xl font-bold truncate",children:t}),(r||s)&&p.jsxs("p",{className:"text-xs text-muted-foreground flex items-center mt-1 truncate",children:[r&&p.jsxs("span",{className:W.cn("flex items-center mr-2 shrink-0",r.direction==="up"&&"text-green-500",r.direction==="down"&&"text-red-500",r.direction==="neutral"&&"text-yellow-500"),children:[r.direction==="up"&&p.jsx(je.ArrowUpIcon,{className:"h-3 w-3 mr-1"}),r.direction==="down"&&p.jsx(je.ArrowDownIcon,{className:"h-3 w-3 mr-1"}),r.direction==="neutral"&&p.jsx(je.MinusIcon,{className:"h-3 w-3 mr-1"}),r.value,"%"]}),p.jsx("span",{className:"truncate",children:Er(s)||Er(r?.label)})]})]})]})};function Un(e){if(e!=null)return typeof e=="string"?e:e.defaultValue||e.key}const Or=({title:e,value:t,icon:r,trend:n,trendValue:a,description:s,className:o,...f})=>{const u=r&&Lr[r];return p.jsxs(W.Card,{className:W.cn("h-full",o),...f,children:[p.jsxs(W.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[p.jsx(W.CardTitle,{className:"text-sm font-medium",children:Un(e)}),u&&p.jsx(u,{className:"h-4 w-4 text-muted-foreground"})]}),p.jsxs(W.CardContent,{children:[p.jsx("div",{className:"text-2xl font-bold",children:t}),(n||a||s)&&p.jsxs("p",{className:"text-xs text-muted-foreground flex items-center mt-1",children:[n&&a&&p.jsxs("span",{className:W.cn("flex items-center mr-2",n==="up"&&"text-green-500",n==="down"&&"text-red-500",n==="neutral"&&"text-yellow-500"),children:[n==="up"&&p.jsx(je.ArrowUpIcon,{className:"h-3 w-3 mr-1"}),n==="down"&&p.jsx(je.ArrowDownIcon,{className:"h-3 w-3 mr-1"}),n==="neutral"&&p.jsx(je.MinusIcon,{className:"h-3 w-3 mr-1"}),a]}),Un(s)]})]})]})};function mo(e,t){if(!t)return String(e);let r="",n="",a=!1,s,o=t;const f=o.match(/^([^0-9.,#]*)/);if(f&&f[1]){const g=f[1];r=g.replace(",",""),g.includes(",")&&(a=!0),o=o.slice(f[1].length)}o.includes(",")&&(a=!0,o=o.replace(/,/g,""));const u=o.match(/\.(\d+)f?/);u&&(s=Number(u[1]),o=o.slice(u[0].length)),n=o.replace(/[0-9#.f]/g,"");const v=s!==void 0?e.toFixed(s):String(e);if(a){const[g,h]=v.split("."),j=g.replace(/\B(?=(\d{3})+(?!\d))/g,",");return r+(h!==void 0?`${j}.${h}`:j)+n}return r+v+n}function Ht(e,t){if(e.length===0)return 0;switch(t){case"sum":return e.reduce((r,n)=>r+n,0);case"count":return e.length;case"avg":return e.reduce((r,n)=>r+n,0)/e.length;case"min":return Math.min(...e);case"max":return Math.max(...e);default:return e.reduce((r,n)=>r+n,0)}}const Yt=({schema:e,className:t})=>{const{title:r,rowField:n,columnField:a,valueField:s,aggregation:o="sum",data:f=[],showRowTotals:u=!1,showColumnTotals:v=!1,format:g,columnColors:h}=e,j=Array.isArray(f)?f:[],{rowKeys:O,colKeys:R,matrix:x,rowTotals:i,colTotals:l,grandTotal:b}=C.useMemo(()=>{const E=new Map,c=new Map,w={};for(const L of j){const X=String(L[n]??""),U=String(L[a]??""),J=Number(L[s])||0;E.set(X,!0),c.set(U,!0),w[X]||(w[X]={}),w[X][U]||(w[X][U]=[]),w[X][U].push(J)}const d=Array.from(E.keys()),m=Array.from(c.keys()),D={},F={},P={};for(const L of d){D[L]={};const X=[];for(const U of m){const J=w[L]?.[U]??[],Q=Ht(J,o);D[L][U]=Q,X.push(...J),!P[U]&&P[U]}F[L]=Ht(X,o)}for(const L of m){const X=[];for(const U of d){const J=w[U]?.[L]??[];X.push(...J)}P[L]=Ht(X,o)}const q=[];for(const L of j)q.push(Number(L[s])||0);const z=Ht(q,o);return{rowKeys:d,colKeys:m,matrix:D,rowTotals:F,colTotals:P,grandTotal:z}},[j,n,a,s,o]),S=E=>mo(E,g);return j.length===0?p.jsxs("div",{className:W.cn("overflow-auto",t),children:[r&&p.jsx("h3",{className:"text-sm font-semibold mb-2",children:r}),p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground","data-testid":"pivot-empty-state",children:[p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 mb-2 opacity-40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),p.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),p.jsx("rect",{x:"3",y:"14",width:"7",height:"7"}),p.jsx("rect",{x:"14",y:"14",width:"7",height:"7"})]}),p.jsx("p",{className:"text-xs",children:"No data available"})]})]}):p.jsxs("div",{className:W.cn("overflow-auto",t),children:[r&&p.jsx("h3",{className:"text-sm font-semibold mb-2",children:r}),p.jsxs("table",{className:"w-full text-sm border-collapse",role:"table",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"border-b border-border",children:[p.jsx("th",{className:"text-left p-2 font-medium text-muted-foreground",children:n}),R.map(E=>p.jsx("th",{className:W.cn("text-right p-2 font-medium",h?.[E]??"text-muted-foreground"),children:E},E)),u&&p.jsx("th",{className:"text-right p-2 font-semibold text-muted-foreground bg-muted/20",children:"Total"})]})}),p.jsx("tbody",{children:O.map(E=>p.jsxs("tr",{className:"border-b border-border/50 hover:bg-muted/30",children:[p.jsx("td",{className:"p-2 font-medium",children:E}),R.map(c=>p.jsx("td",{className:W.cn("text-right p-2 tabular-nums",h?.[c]),children:S(x[E]?.[c]??0)},c)),u&&p.jsx("td",{className:"text-right p-2 font-semibold tabular-nums bg-muted/20",children:S(i[E]??0)})]},E))}),v&&p.jsx("tfoot",{children:p.jsxs("tr",{className:"border-t-2 border-border font-semibold bg-muted/40",children:[p.jsx("td",{className:"p-2",children:"Total"}),R.map(E=>p.jsx("td",{className:"text-right p-2 tabular-nums",children:S(l[E]??0)},E)),u&&p.jsx("td",{className:"text-right p-2 tabular-nums font-bold",children:S(b)})]})})]})]})},Dr=({schema:e,dataSource:t,className:r})=>{const n=C.useContext(ze.SchemaRendererContext),a=t||n?.dataSource,s=ze.useDataScope(e.bind),[o,f]=C.useState([]),[u,v]=C.useState(!1),[g,h]=C.useState(null);C.useEffect(()=>{let x=!0;const i=async()=>{if(!(!a||!e.objectName)){x&&(v(!0),h(null));try{let l;if(typeof a.find=="function"){const b=await a.find(e.objectName,{$filter:e.filter});l=_e.extractRecords(b)}else return;x&&f(l)}catch(l){console.error("[ObjectPivotTable] Fetch error:",l),x&&h(l instanceof Error?l.message:"Failed to load data")}finally{x&&v(!1)}}};return e.objectName&&!s&&(!e.data||e.data.length===0)&&i(),()=>{x=!1}},[e.objectName,a,s,e.data,e.filter]);const j=s||e.data||o,O=Array.isArray(j)?j:[];if(u&&O.length===0)return p.jsxs("div",{className:W.cn("overflow-auto",r),"data-testid":"pivot-loading",children:[e.title&&p.jsx("h3",{className:"text-sm font-semibold mb-2",children:e.title}),p.jsxs("div",{className:"space-y-2 p-2",children:[p.jsxs("div",{className:"flex gap-2",children:[p.jsx(W.Skeleton,{className:"h-6 w-24"}),p.jsx(W.Skeleton,{className:"h-6 w-20"}),p.jsx(W.Skeleton,{className:"h-6 w-20"}),p.jsx(W.Skeleton,{className:"h-6 w-20"})]}),[1,2,3].map(x=>p.jsxs("div",{className:"flex gap-2",children:[p.jsx(W.Skeleton,{className:"h-5 w-24"}),p.jsx(W.Skeleton,{className:"h-5 w-20"}),p.jsx(W.Skeleton,{className:"h-5 w-20"}),p.jsx(W.Skeleton,{className:"h-5 w-20"})]},x))]})]});if(g)return p.jsxs("div",{className:W.cn("overflow-auto",r),"data-testid":"pivot-error",children:[e.title&&p.jsx("h3",{className:"text-sm font-semibold mb-2",children:e.title}),p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-destructive","data-testid":"pivot-error-message",children:[p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 mb-2 opacity-60",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),p.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),p.jsx("p",{className:"text-xs",children:g})]})]});if(!a&&e.objectName&&O.length===0)return p.jsxs("div",{className:W.cn("overflow-auto",r),children:[e.title&&p.jsx("h3",{className:"text-sm font-semibold mb-2",children:e.title}),p.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:p.jsxs("p",{className:"text-xs",children:["No data source available for “",e.objectName,"”"]})})]});const R={...e,data:O};return p.jsx(Yt,{schema:R,className:r})},Tr=({schema:e,dataSource:t,className:r})=>{const n=C.useContext(ze.SchemaRendererContext),a=t||n?.dataSource,s=ze.useDataScope(e.bind),[o,f]=C.useState([]),[u,v]=C.useState(!1),[g,h]=C.useState(null);C.useEffect(()=>{let i=!0;const l=async()=>{if(!(!a||!e.objectName)){i&&(v(!0),h(null));try{let b;if(typeof a.find=="function"){const S=await a.find(e.objectName,{$filter:e.filter});b=_e.extractRecords(S)}else return;i&&f(b)}catch(b){console.error("[ObjectDataTable] Fetch error:",b),i&&h(b instanceof Error?b.message:"Failed to load data")}finally{i&&v(!1)}}};return e.objectName&&!s&&(!e.data||e.data.length===0)&&l(),()=>{i=!1}},[e.objectName,a,s,e.data,e.filter]);const j=s||e.data||o,O=Array.isArray(j)?j:[],R=C.useMemo(()=>e.columns&&e.columns.length>0?e.columns:O.length===0?[]:Object.keys(O[0]).filter(l=>!l.startsWith("_")).map(l=>({header:l.charAt(0).toUpperCase()+l.slice(1).replace(/([A-Z])/g," $1"),accessorKey:l})),[e.columns,O]);if(u&&O.length===0)return p.jsx("div",{className:W.cn("overflow-auto",r),"data-testid":"table-loading",children:p.jsxs("div",{className:"space-y-2 p-2",children:[p.jsxs("div",{className:"flex gap-2",children:[p.jsx(W.Skeleton,{className:"h-6 w-1/4"}),p.jsx(W.Skeleton,{className:"h-6 w-1/4"}),p.jsx(W.Skeleton,{className:"h-6 w-1/4"}),p.jsx(W.Skeleton,{className:"h-6 w-1/4"})]}),[1,2,3,4].map(i=>p.jsxs("div",{className:"flex gap-2",children:[p.jsx(W.Skeleton,{className:"h-5 w-1/4"}),p.jsx(W.Skeleton,{className:"h-5 w-1/4"}),p.jsx(W.Skeleton,{className:"h-5 w-1/4"}),p.jsx(W.Skeleton,{className:"h-5 w-1/4"})]},i))]})});if(g)return p.jsx("div",{className:W.cn("overflow-auto",r),"data-testid":"table-error",children:p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-destructive","data-testid":"table-error-message",children:[p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 mb-2 opacity-60",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),p.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),p.jsx("p",{className:"text-xs",children:g})]})});if(!a&&e.objectName&&O.length===0)return p.jsx("div",{className:W.cn("overflow-auto",r),children:p.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:p.jsxs("p",{className:"text-xs",children:["No data source available for “",e.objectName,"”"]})})});if(O.length===0)return p.jsx("div",{className:W.cn("overflow-auto",r),"data-testid":"table-empty-state",children:p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 mb-2 opacity-40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),p.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),p.jsx("line",{x1:"9",y1:"21",x2:"9",y2:"9"})]}),p.jsx("p",{className:"text-xs",children:"No data available"})]})});const x={...e,type:"data-table",data:O,columns:R};return p.jsx(ze.SchemaRenderer,{schema:x,className:r})},yo={breadcrumb:["Dashboard","Configuration"],sections:[{key:"layout",title:"Layout",fields:[{key:"columns",label:"Columns",type:"slider",defaultValue:3,min:1,max:12,step:1},{key:"gap",label:"Gap",type:"slider",defaultValue:4,min:0,max:16,step:1},{key:"rowHeight",label:"Row height",type:"input",defaultValue:"120",placeholder:"e.g. 120"}]},{key:"data",title:"Data",collapsible:!0,fields:[{key:"refreshInterval",label:"Refresh interval",type:"select",defaultValue:"0",options:[{value:"0",label:"Manual"},{value:"30",label:"30s"},{value:"60",label:"1 min"},{value:"300",label:"5 min"}]}]},{key:"appearance",title:"Appearance",collapsible:!0,defaultCollapsed:!0,fields:[{key:"title",label:"Title",type:"input",placeholder:"Dashboard title"},{key:"showDescription",label:"Show description",type:"switch",defaultValue:!0},{key:"theme",label:"Theme",type:"select",defaultValue:"auto",options:[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"auto",label:"Auto"}]}]}]};function Rr({open:e,onClose:t,config:r,onSave:n,onFieldChange:a}){const{draft:s,isDirty:o,updateField:f,discard:u}=W.useConfigDraft(r,{onUpdate:a});return p.jsx(W.ConfigPanelRenderer,{open:e,onClose:t,schema:yo,draft:s,isDirty:o,onFieldChange:f,onSave:()=>n(s),onDiscard:u})}const bo=[{value:"metric",label:"Metric"},{value:"bar",label:"Bar Chart"},{value:"line",label:"Line Chart"},{value:"pie",label:"Pie Chart"},{value:"donut",label:"Donut Chart"},{value:"area",label:"Area Chart"},{value:"scatter",label:"Scatter Plot"},{value:"table",label:"Table"},{value:"pivot",label:"Pivot Table"},{value:"list",label:"List"},{value:"custom",label:"Custom"}],vo=[{value:"default",label:"Default"},{value:"blue",label:"Blue"},{value:"teal",label:"Teal"},{value:"orange",label:"Orange"},{value:"purple",label:"Purple"},{value:"success",label:"Success"},{value:"warning",label:"Warning"},{value:"danger",label:"Danger"}],Xn=[{value:"count",label:"Count"},{value:"sum",label:"Sum"},{value:"avg",label:"Average"},{value:"min",label:"Min"},{value:"max",label:"Max"}],xo=["bar","line","area","pie","donut","scatter"];function Gn(e){return!!e&&xo.includes(e)}const Kn=[{value:"group",label:"Group"},{value:"value",label:"Value"}],Jn=[{value:"asc",label:"↑"},{value:"desc",label:"↓"}];function xt(e,t,r,n){return{key:e,label:t,type:"custom",render:(a,s,o)=>p.jsx(W.ConfigRow,{label:t,children:p.jsx("div",{"data-testid":`config-field-${e}`,children:p.jsx(W.Combobox,{options:n??[],value:a??"",onValueChange:s,placeholder:r,searchPlaceholder:"Search fields…",emptyText:"No fields found.",className:"h-7 w-32 text-xs",disabled:!o.object})})})}}function wo(e,t,r){const n=e&&e.length>0,a=n?{key:"object",label:"Data source",type:"custom",render:(j,O)=>p.jsx(W.ConfigRow,{label:"Data source",children:p.jsx("div",{"data-testid":"config-field-object",children:p.jsx(W.Combobox,{options:e,value:j??"",onValueChange:O,placeholder:"Select object…",searchPlaceholder:"Search objects…",emptyText:"No objects found.",className:"h-7 w-32 text-xs"})})})}:{key:"object",label:"Data source",type:"input",placeholder:"Object name"},s=n?xt("categoryField","Category field","Select field…",t):{key:"categoryField",label:"Category field",type:"input",placeholder:"e.g. status"},o=n?xt("valueField","Value field","Select field…",t):{key:"valueField",label:"Value field",type:"input",placeholder:"e.g. amount"},f=n?xt("rowField","Field","Select row field…",t):{key:"rowField",label:"Field",type:"input",placeholder:"e.g. owner"},u=n?xt("columnField","Field","Select column field…",t):{key:"columnField",label:"Field",type:"input",placeholder:"e.g. stage"},v=n?xt("pivotValueField","Field","Select value field…",t):{key:"pivotValueField",label:"Field",type:"input",placeholder:"e.g. amount"};return{breadcrumb:["Dashboard",{pivot:"Pivot table",table:"Table"}[r??""]??(Gn(r)?"Chart":"Widget")],sections:[{key:"general",title:"General",fields:[{key:"title",label:"Title",type:"input",placeholder:"Widget title"},{key:"description",label:"Description",type:"input",placeholder:"Widget description"},{key:"type",label:"Widget type",type:"select",options:bo,defaultValue:"metric"}]},{key:"data",title:"Data Binding",collapsible:!0,visibleWhen:j=>j.type!=="pivot",fields:[a,s,o,{key:"aggregate",label:"Aggregation",type:"select",options:Xn,defaultValue:"count"}]},{key:"pivot-data",title:"Data",collapsible:!0,visibleWhen:j=>j.type==="pivot",fields:[a]},{key:"pivot-rows",title:"Rows",collapsible:!0,visibleWhen:j=>j.type==="pivot",fields:[f,{key:"rowSortBy",label:"Sort by",type:"icon-group",options:Kn,defaultValue:"group"},{key:"rowSortOrder",label:"Sort order",type:"icon-group",options:Jn,defaultValue:"asc"},{key:"showRowLabels",label:"Show label",type:"switch",defaultValue:!0},{key:"showRowTotals",label:"Show totals",type:"switch",defaultValue:!1}]},{key:"pivot-columns",title:"Columns",collapsible:!0,visibleWhen:j=>j.type==="pivot",fields:[u,{key:"columnSortBy",label:"Sort by",type:"icon-group",options:Kn,defaultValue:"group"},{key:"columnSortOrder",label:"Sort order",type:"icon-group",options:Jn,defaultValue:"asc"},{key:"showColumnLabels",label:"Show label",type:"switch",defaultValue:!0},{key:"showColumnTotals",label:"Show totals",type:"switch",defaultValue:!1}]},{key:"pivot-values",title:"Values",collapsible:!0,visibleWhen:j=>j.type==="pivot",fields:[v,{key:"aggregation",label:"Aggregation",type:"select",options:Xn,defaultValue:"sum"},{key:"format",label:"Number format",type:"input",placeholder:"e.g. $,.2f"}]},{key:"chart-axis",title:"Axis & Series",collapsible:!0,visibleWhen:j=>Gn(j.type),fields:[{key:"xAxisLabel",label:"X-axis label",type:"input",placeholder:"e.g. Month"},{key:"yAxisLabel",label:"Y-axis label",type:"input",placeholder:"e.g. Revenue"},{key:"showLegend",label:"Show legend",type:"switch",defaultValue:!0}]},{key:"table-columns",title:"Columns",collapsible:!0,visibleWhen:j=>j.type==="table",fields:[{key:"searchable",label:"Searchable",type:"switch",defaultValue:!1},{key:"pagination",label:"Pagination",type:"switch",defaultValue:!1}]},{key:"layout",title:"Layout",collapsible:!0,fields:[{key:"layoutW",label:"Width (columns)",type:"slider",min:1,max:12,step:1,defaultValue:1},{key:"layoutH",label:"Height (rows)",type:"slider",min:1,max:6,step:1,defaultValue:1}]},{key:"appearance",title:"Appearance",collapsible:!0,defaultCollapsed:!0,fields:[{key:"colorVariant",label:"Color variant",type:"select",options:vo,defaultValue:"default"},{key:"actionUrl",label:"Action URL",type:"input",placeholder:"https://..."}]}]}}function Zn(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){const t=e;return t.defaultValue||t.key||""}return String(e)}function _r({open:e,onClose:t,config:r,onSave:n,onFieldChange:a,headerExtra:s,availableObjects:o,availableFields:f}){const u=De.useMemo(()=>({...r,title:typeof r.title=="object"?Zn(r.title):r.title,description:typeof r.description=="object"?Zn(r.description):r.description}),[r]),{draft:v,isDirty:g,updateField:h,discard:j}=W.useConfigDraft(u,{onUpdate:a}),O=De.useMemo(()=>wo(o,f,v.type),[o,f,v.type]);return p.jsx(W.ConfigPanelRenderer,{open:e,onClose:t,schema:O,draft:v,isDirty:g,onFieldChange:h,onSave:()=>n(v),onDiscard:j,headerExtra:s})}function Qn({schema:e,config:t,onConfigSave:r,onWidgetSave:n,onRefresh:a,recordCount:s,defaultConfigOpen:o=!1,className:f}){const[u,v]=C.useState(o),[g,h]=C.useState(null),[j,O]=C.useState(e),[R,x]=C.useState(0);C.useEffect(()=>{O(e),x(w=>w+1)},[e]);const i=De.useMemo(()=>{if(!g||!j.widgets)return null;const w=j.widgets.find(d=>(d.id||d.title)===g);return w?{id:w.id??"",title:w.title??"",description:w.description??"",type:w.type??"",object:w.object??"",categoryField:w.categoryField??"",valueField:w.valueField??"",aggregate:w.aggregate??"",colorVariant:w.colorVariant??"default",actionUrl:w.actionUrl??"",layoutW:w.layout?.w??1,layoutH:w.layout?.h??1}:null},[g,R]),l=C.useCallback(w=>{h(w),v(!0)},[]),b=C.useCallback(()=>{h(null)},[]),S=C.useCallback((w,d)=>{g&&O(m=>m.widgets?{...m,widgets:m.widgets.map(D=>(D.id||D.title)!==g?D:w==="layoutW"?{...D,layout:{...D.layout||{},w:d}}:w==="layoutH"?{...D,layout:{...D.layout||{},h:d}}:{...D,[w]:d})}:m)},[g]),E=C.useCallback(w=>{g&&n&&n(g,w),h(null),x(d=>d+1)},[g,n]),c=C.useCallback(()=>{v(w=>!w),h(null)},[]);return p.jsxs("div",{className:W.cn("flex h-full w-full",f),"data-testid":"dashboard-with-config",children:[p.jsxs("div",{className:"flex-1 min-w-0 overflow-auto relative",children:[p.jsx("div",{className:"absolute top-2 right-2 z-10",children:p.jsxs(W.Button,{size:"sm",variant:u?"default":"outline",onClick:c,"data-testid":"dashboard-config-toggle",children:[p.jsx(je.Settings,{className:"h-3.5 w-3.5 mr-1"}),"Settings"]})}),p.jsx(Pt,{schema:j,onRefresh:a,recordCount:s,designMode:u,selectedWidgetId:g,onWidgetClick:l})]}),u&&p.jsx("div",{className:"relative shrink-0",children:g&&i?p.jsx(_r,{open:!0,onClose:b,config:i,onSave:E,onFieldChange:S}):p.jsx(Rr,{open:!0,onClose:()=>v(!1),config:t,onSave:r})})]})}_e.ComponentRegistry.register("dashboard",Pt,{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:[]}}),_e.ComponentRegistry.register("metric",Pr,{namespace:"plugin-dashboard",label:"Metric Widget",category:"Dashboard",inputs:[{name:"label",type:"string",label:"Label"},{name:"value",type:"string",label:"Value"}]}),_e.ComponentRegistry.register("metric-card",Or,{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"}}),_e.ComponentRegistry.register("pivot",Yt,{namespace:"plugin-dashboard",label:"Pivot Table",category:"Dashboard",icon:"table-2",inputs:[{name:"title",type:"string",label:"Title"},{name:"rowField",type:"string",label:"Row Field",required:!0},{name:"columnField",type:"string",label:"Column Field",required:!0},{name:"valueField",type:"string",label:"Value Field",required:!0},{name:"aggregation",type:"enum",label:"Aggregation",enum:[{label:"Sum",value:"sum"},{label:"Count",value:"count"},{label:"Average",value:"avg"},{label:"Min",value:"min"},{label:"Max",value:"max"}]},{name:"showRowTotals",type:"boolean",label:"Show Row Totals"},{name:"showColumnTotals",type:"boolean",label:"Show Column Totals"},{name:"format",type:"string",label:"Number Format"}],defaultProps:{rowField:"",columnField:"",valueField:"",aggregation:"sum",data:[]}}),_e.ComponentRegistry.register("object-pivot",Dr,{namespace:"plugin-dashboard",label:"Object Pivot Table",category:"Dashboard",icon:"table-2",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"title",type:"string",label:"Title"},{name:"rowField",type:"string",label:"Row Field",required:!0},{name:"columnField",type:"string",label:"Column Field",required:!0},{name:"valueField",type:"string",label:"Value Field",required:!0},{name:"aggregation",type:"enum",label:"Aggregation",enum:[{label:"Sum",value:"sum"},{label:"Count",value:"count"},{label:"Average",value:"avg"},{label:"Min",value:"min"},{label:"Max",value:"max"}]},{name:"showRowTotals",type:"boolean",label:"Show Row Totals"},{name:"showColumnTotals",type:"boolean",label:"Show Column Totals"},{name:"filter",type:"array",label:"Filter"},{name:"format",type:"string",label:"Number Format"}],defaultProps:{rowField:"",columnField:"",valueField:"",aggregation:"sum"}}),_e.ComponentRegistry.register("dashboard-grid",Cr,{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"}}),_e.ComponentRegistry.register("object-data-table",Tr,{namespace:"plugin-dashboard",label:"Object Data Table",category:"Dashboard",icon:"table",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"},{name:"filter",type:"array",label:"Filter"},{name:"searchable",type:"boolean",label:"Searchable"},{name:"pagination",type:"boolean",label:"Pagination"}],defaultProps:{searchable:!1,pagination:!1}});const So={DashboardRenderer:Pt,DashboardGridLayout:Cr,MetricWidget:Pr,MetricCard:Or,PivotTable:Yt,ObjectPivotTable:Dr,ObjectDataTable:Tr,DashboardConfigPanel:Rr,WidgetConfigPanel:_r,DashboardWithConfig:Qn};de.DashboardConfigPanel=Rr,de.DashboardGridLayout=Cr,de.DashboardRenderer=Pt,de.DashboardWithConfig=Qn,de.MetricCard=Or,de.MetricWidget=Pr,de.ObjectDataTable=Tr,de.ObjectPivotTable=Dr,de.PivotTable=Yt,de.WidgetConfigPanel=_r,de.dashboardComponents=So,Object.defineProperty(de,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,o,p,m,p),I[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),ee=M(i(o)),I={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):ee)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):ee)}})()})),y=p(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=_():t.exports=v()}))();function b(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var x=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],S=(0,i.forwardRef)(({schema:e,className:t,dataSource:o,onRefresh:s,recordCount:c,userActions:l,designMode:u,selectedWidgetId:d,onWidgetClick:f,...p},m)=>{let h=e.columns||4,_=e.gap||4,[v,S]=(0,i.useState)(!1),[C,w]=(0,i.useState)(!1),T=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=()=>w(window.innerWidth<768);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let E=(0,i.useCallback)(()=>{s&&(S(!0),s(),setTimeout(()=>S(!1),600))},[s]);(0,i.useEffect)(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!s))return T.current=setInterval(E,e.refreshInterval*1e3),()=>{T.current&&clearInterval(T.current)}},[e.refreshInterval,s,E]);let D=(0,i.useCallback)((e,t)=>{!u||!f||!t||(e.stopPropagation(),f(t))},[u,f]),O=(0,i.useCallback)((t,n,r)=>{if(!u||!f)return;let i=e.widgets||[];if(t.key===`Enter`||t.key===` `)t.preventDefault(),f(n??null);else if(t.key===`ArrowRight`||t.key===`ArrowDown`){t.preventDefault();let e=r+1<i.length?i[r+1]:null;e?.id&&f(e.id)}else if(t.key===`ArrowLeft`||t.key===`ArrowUp`){t.preventDefault();let e=r-1>=0?i[r-1]:null;e?.id&&f(e.id)}else t.key===`Escape`&&(t.preventDefault(),f(null))},[u,f,e.widgets]),k=(0,i.useCallback)(e=>{!u||!f||e.target===e.currentTarget&&f(null)},[u,f]),A=(e,t,i)=>{let a=e.layout?{...e.layout,w:Math.min(e.layout.w,h)}:void 0,o=(()=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`bar`||t===`line`||t===`area`||t===`pie`||t===`donut`||t===`scatter`){let r=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(g(r)){let n=r.aggregate,o=n?{field:e.valueField||n.field,function:e.aggregate||n.function,groupBy:e.categoryField||n.groupBy}:void 0,s=o?.field||a;return{type:`object-chart`,chartType:t,objectName:e.object||r.object,aggregate:o,xAxisKey:i,series:[{dataKey:s}],colors:x,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(!r&&e.object){let n=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`name`}:void 0;return{type:`object-chart`,chartType:t,objectName:e.object,aggregate:n,xAxisKey:i,series:[{dataKey:e.valueField||`value`}],colors:x,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}return{type:`chart`,chartType:t,data:Array.isArray(r)?r:r?.items||[],xAxisKey:i,series:[{dataKey:a}],colors:x,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(t===`table`){let t=e.data||n.data;if(g(t)){let{data:r,...i}=n;return{type:`object-data-table`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter,searchable:e.searchable??!1,pagination:e.pagination??!1,className:`border-0`}}return!t&&e.object?{type:`object-data-table`,...n,objectName:e.object,filter:e.filter,searchable:e.searchable??!1,pagination:e.pagination??!1,className:`border-0`}:{type:`data-table`,...n,data:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}if(t===`pivot`){let t=e.data||n.data;if(g(t)){let{data:r,...i}=n;return{type:`object-pivot`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter}}return!t&&e.object?{type:`object-pivot`,...n,objectName:e.object,filter:e.filter}:{type:`pivot`,...n,data:Array.isArray(t)?t:t?.items||[]}}return{...e,...n}})(),s=e.type===`metric`,c=b(e.title),l=b(e.description),f=e.id||c||`widget-${t}`,p=u&&d===e.id,m=u?{"data-testid":`dashboard-preview-widget-${e.id}`,"data-widget-id":e.id,role:`button`,tabIndex:0,"aria-selected":p,"aria-label":`Widget: ${c||`Widget ${t+1}`}`,onClick:t=>D(t,e.id),onKeyDown:n=>O(n,e.id,t)}:{},_=u?(0,r.cn)(`cursor-pointer rounded-lg transition-all outline-none`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,p?`ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10`:`hover:ring-2 hover:ring-primary/40 hover:shadow-sm`):void 0;return s?(0,y.jsxs)(`div`,{className:(0,r.cn)(`h-full w-full`,u&&`relative`,_),style:!C&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...m,children:[(0,y.jsx)(n.SchemaRenderer,{schema:o,className:(0,r.cn)(`h-full w-full`,u&&`pointer-events-none`)}),u&&(0,y.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},f):(0,y.jsxs)(r.Card,{className:(0,r.cn)(`overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md`,`bg-card/50 backdrop-blur-sm`,i&&`w-full`,u&&`relative`,_),style:!C&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...m,children:[c&&(0,y.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm sm:text-base font-medium tracking-tight truncate`,title:c,children:c}),l&&(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:l})]}),(0,y.jsx)(r.CardContent,{className:`p-0`,children:(0,y.jsx)(`div`,{className:(0,r.cn)(`h-full w-full`,`p-3 sm:p-4 md:p-6`,u&&`pointer-events-none`),children:(0,y.jsx)(n.SchemaRenderer,{schema:o})})}),u&&(0,y.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},f)},j=e.header&&(0,y.jsxs)(`div`,{className:`col-span-full mb-4`,children:[e.header.showTitle!==!1&&e.title&&(0,y.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:b(e.title)}),e.header.showDescription!==!1&&e.description&&(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:b(e.description)}),e.header.actions&&e.header.actions.length>0&&(0,y.jsx)(`div`,{className:`flex gap-2 mt-3`,children:e.header.actions.map((e,t)=>(0,y.jsx)(r.Button,{variant:`outline`,size:`sm`,children:e.label},t))})]}),M=c!==void 0&&(0,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[c.toLocaleString(),` records`]}),N=l?JSON.stringify(l):void 0,P=s&&(0,y.jsxs)(`div`,{className:(0,r.cn)(`flex items-center justify-end gap-3 mb-2`,!C&&`col-span-full`),children:[M,(0,y.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:E,disabled:v,"aria-label":`Refresh dashboard`,children:[(0,y.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,v&&`animate-spin`)}),v?`Refreshing…`:`Refresh All`]})]});if(C){let n=e.widgets?.filter(e=>e.type===`metric`)||[],i=e.widgets?.filter(e=>e.type!==`metric`)||[];return(0,y.jsxs)(`div`,{ref:m,className:(0,r.cn)(`flex flex-col gap-4 px-4`,t),"data-user-actions":N,onClick:k,...p,children:[j,P,n.length>0&&(0,y.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,onClick:k,children:n.map((e,t)=>A(e,t))}),i.length>0&&(0,y.jsx)(`div`,{className:`flex flex-col gap-4`,onClick:k,children:i.map((e,t)=>A(e,t,!0))})]})}return(0,y.jsxs)(`div`,{ref:m,className:(0,r.cn)(`grid auto-rows-min`,`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,t),style:{...h>4&&{gridTemplateColumns:`repeat(${h}, minmax(0, 1fr))`},gap:`${_*.25}rem`},"data-user-actions":N,onClick:k,...p,children:[j,P,e.widgets?.map((e,t)=>A(e,t))]})});function C(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function w(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function T(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=C(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=w(r,u,s[0]),f=w(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function E(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=C(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=k(d,0,s-r),f=k(f,0,l-i),{x:d,y:f}}function D(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=C(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function O(e,t,n){let{margin:r,rowHeight:i}=e,a=C(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function k(e,t,n){return Math.max(Math.min(e,n),t)}function A(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 j(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&A(r,t))return r}}function M(e,t){return e.filter(e=>A(e,t))}function N(e,t){return t===`horizontal`?F(e):t===`vertical`||t===`wrap`?P(e):[...e]}function P(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function F(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function ee(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=r.y+r.h;e>t&&(t=e)}}return t}function I(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0&&r.i===t)return r}}function L(e){return e.filter(e=>e.static===!0)}function R(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 z(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t[n]=R(r))}return t}function te(e,t){let n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r];i!==void 0&&(t.i===i.i?n[r]=t:n[r]=i)}return n}function ne(e,t,n){let r=I(e,t);return r?(r=n(R(r)),[te(e,r),r]):[[...e],null]}function B(e,t){let n=L(e);for(let r=0;r<e.length;r++){let i=e[r];if(i!==void 0)if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;j(n,i);)i.y++}return e}function re(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=N(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=M(d,t),p=f.length>0;if(p&&c)return z(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;e<f.length;e++){let n=f[e];n!==void 0&&(n.moved||(m=n.static?ie(m,n,t,i,o):ie(m,t,n,i,o)))}return m}function ie(e,t,n,r,i,a){let o=i===`horizontal`,s=i===`vertical`,c=t.static;if(r){r=!1;let a={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:`-1`},l=j(e,a),u=l!==void 0&&l.y+l.h>t.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return re(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return re(e,n,void 0,n.y+1,r,c,i);if(u&&i===null)return t.y=n.y,n.y+=n.h,[...e];if(d&&o)return re(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:re(e,n,l,u,r,c,i)}function V(e,t,n){return Math.max(t,Math.min(n,e))}var ae=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:V(t,0,Math.max(0,r-e.w)),y:V(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:V(t,1,Math.max(1,o)),h:V(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:V(t,e.minW??1,e.maxW??1/0),h:V(n,e.minH??1,e.maxH??1/0)}}}];function oe(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function se(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function ce({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function le({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function ue(e){return e*100+`%`}function de(e,t,n,r){return e+n>r?t:n}function fe(e,t,n){return e<0?t:n}function pe(e){return Math.max(0,e)}function me(e){return Math.max(0,e)}var H=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:fe(o,e.height,i),top:me(o)}},U=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:de(e.left,e.width,o,n),left:pe(i)}},W=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:me(r),left:0}:{height:i,width:a,top:me(r),left:o}},G=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:fe(r,e.height,a),top:me(r)}},he={n:H,ne:(e,t,n)=>H(e,U(e,t,n)),e:U,se:(e,t,n)=>G(e,U(e,t,n)),s:G,sw:(e,t,n)=>G(e,W(e,t)),w:W,nw:(e,t,n)=>H(e,W(e,t))};function ge(e,t,n,r){let i=he[e];return i?i(t,{...t,...n},r):n}var K={type:`transform`,scale:1,calcStyle(e){return ce(e)}},_e={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},ve={enabled:!0,bounded:!1,threshold:3},ye={enabled:!0,handles:[`se`]},be={enabled:!1,defaultItem:{w:1,h:1}};function xe(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??L(e).length>0;for(let i=o+1;i<e.length;i++){let o=e[i];if(o!==void 0&&!o.static){if(!s&&o.y>t.y+t.h)break;A(t,o)&&xe(e,o,n+t[a],r,s)}}t[r]=n}function q(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!j(e,t);)t.y--;let i;for(;(i=j(e,t))!==void 0;)xe(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Se(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!j(e,t);)t.x--;let i;for(;(i=j(e,t))!==void 0;)if(xe(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!j(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Ce={type:`vertical`,allowOverlap:!1,compact(e,t){let n=L(e),r=ee(n),i=P(e),a=Array(e.length);for(let t=0;t<i.length;t++){let o=i[t];if(o===void 0)continue;let s=R(o);s.static||(s=q(n,s,i,r),r=Math.max(r,s.y+s.h),n.push(s));let c=e.indexOf(o);a[c]=s,s.moved=!1}return a}},J={type:`horizontal`,allowOverlap:!1,compact(e,t){let n=L(e),r=F(e),i=Array(e.length);for(let a=0;a<r.length;a++){let o=r[a];if(o===void 0)continue;let s=R(o);s.static||(s=Se(n,s,t,r),n.push(s));let c=e.indexOf(o);i[c]=s,s.moved=!1}return i}},Y={type:null,allowOverlap:!1,compact(e,t){return z(e)}},X={...Ce,allowOverlap:!0,compact(e,t){return z(e)}},Z={...J,allowOverlap:!0,compact(e,t){return z(e)}},we={...Y,allowOverlap:!0};function Te(e,t=!1,n=!1){let r;return r=t?e===`vertical`?X:e===`horizontal`?Z:we:e===`vertical`?Ce:e===`horizontal`?J:Y,n?{...r,preventCollision:n}:r}function Ee(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function De(e,t){let n=Ee(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;i<n.length;i++){let a=n[i];a!==void 0&&t>e[a]&&(r=a)}return r}function Q(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Oe(e,t,n,r,i,a){let o=e[n];if(o)return z(o);let s=e[r],c=Ee(t),l=c.slice(c.indexOf(n));for(let t=0;t<l.length;t++){let n=l[t];if(n===void 0)continue;let r=e[n];if(r){s=r;break}}let u=B(z(s||[]),{cols:i});return(typeof a==`object`&&a?a:Te(a)).compact(u,i)}function ke(e,t){if(Array.isArray(e))return e;let n=e,r=n[t];if(r!==void 0)return r;let i=Object.keys(n);for(let e of i){let t=n[e];if(t!==void 0)return t}return[10,10]}var Ae=p(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(e,(function(e){"use strict";function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=`[object Arguments]`,c=`[object Boolean]`,l=`[object Date]`,u=`[object RegExp]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object Set]`,h=`[object String]`,g=Object.prototype.toString;function _(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,_=e.areObjectsEqual,v=e.areRegExpsEqual,y=e.areSetsEqual,b=e.createIsNestedEqual,x=b(S);function S(e,b,S){if(e===b)return!0;if(!e||!b||typeof e!=`object`||typeof b!=`object`)return e!==e&&b!==b;if(i(e)&&i(b))return _(e,b,x,S);var C=Array.isArray(e),w=Array.isArray(b);if(C||w)return C===w&&t(e,b,x,S);var T=g.call(e);return T===g.call(b)?T===l?n(e,b,x,S):T===u?v(e,b,x,S):T===d?r(e,b,x,S):T===m?y(e,b,x,S):T===p||T===s?a(e)||a(b)?!1:_(e,b,x,S):T===c||T===f||T===h?o(e.valueOf(),b.valueOf()):!1:!1}return S}function v(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-- >0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var y=n(v);function b(e,t){return o(e.valueOf(),t.valueOf())}function x(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var S=n(x),C=`_owner`,w=Object.prototype.hasOwnProperty;function T(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-- >0;){if(o=i[a],o===C){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!w.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var E=n(T);function D(e,t){return e.source===t.source&&e.flags===t.flags}function O(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var k=n(O),A=Object.freeze({areArraysEqual:v,areDatesEqual:b,areMapsEqual:x,areObjectsEqual:T,areRegExpsEqual:D,areSetsEqual:O,createIsNestedEqual:t}),j=Object.freeze({areArraysEqual:y,areDatesEqual:b,areMapsEqual:S,areObjectsEqual:E,areRegExpsEqual:D,areSetsEqual:k,createIsNestedEqual:t}),M=_(A);function N(e,t){return M(e,t,void 0)}var P=_(r(A,{createIsNestedEqual:function(){return o}}));function F(e,t){return P(e,t,void 0)}var ee=_(j);function I(e,t){return ee(e,t,new WeakMap)}var L=_(r(j,{createIsNestedEqual:function(){return o}}));function R(e,t){return L(e,t,new WeakMap)}function z(e){return _(r(A,e(A)))}function te(e){var t=_(r(j,e(j)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=I,e.circularShallowEqual=R,e.createCustomCircularEqual=te,e.createCustomEqual=z,e.deepEqual=N,e.sameValueZeroEqual=o,e.shallowEqual=F,Object.defineProperty(e,`__esModule`,{value:!0})}))}));function je(e={}){let{measureBeforeMount:t=!1,initialWidth:n=1280}=e,[r,a]=(0,i.useState)(n),[o,s]=(0,i.useState)(!t),c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useCallback)(()=>{let e=c.current;if(e){let t=e.offsetWidth;a(t),o||s(!0)}},[o]);return(0,i.useEffect)(()=>{let e=c.current;if(e)return u(),typeof ResizeObserver<`u`&&(l.current=new ResizeObserver(e=>{let t=e[0];if(t){let e=t.contentRect.width;a(e)}}),l.current.observe(e)),()=>{l.current&&=(l.current.disconnect(),null)}},[u]),{width:r,mounted:o,containerRef:c,measureWidth:u}}var Me=p((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),Ne=p((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,D=d,O=i,k=h,A=m,j=r,M=o,N=a,P=f,F=!1;function ee(e){return F||(F=!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.`)),I(e)||x(e)===l}function I(e){return x(e)===u}function L(e){return x(e)===c}function R(e){return x(e)===s}function z(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function te(e){return x(e)===d}function ne(e){return x(e)===i}function B(e){return x(e)===h}function re(e){return x(e)===m}function ie(e){return x(e)===r}function V(e){return x(e)===o}function ae(e){return x(e)===a}function oe(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=D,e.Fragment=O,e.Lazy=k,e.Memo=A,e.Portal=j,e.Profiler=M,e.StrictMode=N,e.Suspense=P,e.isAsyncMode=ee,e.isConcurrentMode=I,e.isContextConsumer=L,e.isContextProvider=R,e.isElement=z,e.isForwardRef=te,e.isFragment=ne,e.isLazy=B,e.isMemo=re,e.isPortal=ie,e.isProfiler=V,e.isStrictMode=ae,e.isSuspense=oe,e.isValidElementType=b,e.typeOf=x})()})),Pe=p(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Me():t.exports=Ne()})),Fe=p(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),Ie=p(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Le=p(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),Re=p(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=Ie(),i={},a=Le();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),$=p(((e,t)=>{var n=Pe(),r=Fe(),i=Ie(),a=Le(),o=Re(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:E(),objectOf:w,oneOf:C,oneOfType:T,shape:O,exact:k};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=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 m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. 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."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(M(s)!==e){var c=N(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=M(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=M(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=F(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`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]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return N(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=M(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+P(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function E(){function e(e,t,n,r,i){return A(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function D(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function O(e){function t(t,n,r,a,o){var s=t[n],c=M(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return D(r,a,o,l,N(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function k(e){function t(t,n,o,s,c){var l=t[n],u=M(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return D(o,s,c,d,N(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
|
|
7
|
+
Bad object: `+JSON.stringify(t[n],null,` `)+`
|
|
8
|
+
Valid keys: `+JSON.stringify(Object.keys(e),null,` `));var p=f(l,d,o,s,c+`.`+d,i);if(p)return p}return null}return g(t)}function A(t){switch(typeof t){case`number`:case`string`:case`undefined`:return!0;case`boolean`:return!t;case`object`:if(Array.isArray(t))return t.every(A);if(t===null||e(t))return!0;var n=d(t);if(n){var r=n.call(t),i;if(n!==t.entries){for(;!(i=r.next()).done;)if(!A(i.value))return!1}else for(;!(i=r.next()).done;){var a=i.value;if(a&&!A(a[1]))return!1}}else return!1;return!0;default:return!1}}function j(e,t){return e===`symbol`?!0:t?t[`@@toStringTag`]===`Symbol`||typeof Symbol==`function`&&t instanceof Symbol:!1}function M(e){var t=typeof e;return Array.isArray(e)?`array`:e instanceof RegExp?`object`:j(t,e)?`symbol`:t}function N(e){if(e==null)return``+e;var t=M(e);if(t===`object`){if(e instanceof Date)return`date`;if(e instanceof RegExp)return`regexp`}return t}function P(e){var t=N(e);switch(t){case`array`:case`object`:return`an `+t;case`boolean`:case`date`:case`regexp`:return`a `+t;default:return t}}function F(e){return!e.constructor||!e.constructor.name?f:e.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p}})),ze=p(((e,t)=>{var n=Ie();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=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 s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Be=p(((e,t)=>{if(process.env.NODE_ENV!==`production`){var n=Pe();t.exports=$()(n.isElement,!0)}else t.exports=ze()()})),Ve=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.dontSetMe=a,e.findInArray=t,e.int=i,e.isFunction=n,e.isNum=r;function t(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function n(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function r(e){return typeof e==`number`&&!isNaN(e)}function i(e){return parseInt(e,10)}function a(e,t,n){if(e[t])return Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}})),He=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.browserPrefixToKey=r,e.browserPrefixToStyle=i,e.default=void 0,e.getPrefix=n;var t=[`Moz`,`Webkit`,`O`,`ms`];function n(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`transform`;if(typeof window>`u`)return``;let n=window.document?.documentElement?.style;if(!n||e in n)return``;for(let i=0;i<t.length;i++)if(r(e,t[i])in n)return t[i];return``}function r(e,t){return t?`${t}${a(e)}`:e}function i(e,t){return t?`-${t.toLowerCase()}-${e}`:e}function a(e){let t=``,n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]===`-`?n=!0:t+=e[r];return t}e.default=n()})),Ue=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.addClassName=S,e.addEvent=s,e.addUserSelectStyles=y,e.createCSSTransform=m,e.createSVGTransform=h,e.getTouch=_,e.getTouchIdentifier=v,e.getTranslation=g,e.innerHeight=d,e.innerWidth=f,e.matchesSelector=a,e.matchesSelectorAndParentsTo=o,e.offsetXYFromParent=p,e.outerHeight=l,e.outerWidth=u,e.removeClassName=C,e.removeEvent=c,e.scheduleRemoveUserSelectStyles=b;var t=Ve(),n=r(He());function r(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,i=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(r=t?i:n){if(r.has(e))return r.get(e);r.set(e,o)}for(let t in e)t!==`default`&&{}.hasOwnProperty.call(e,t)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?r(o,t,a):o[t]=e[t]);return o})(e,t)}var i=``;function a(e,n){return i||=(0,t.findInArray)([`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`],function(n){return(0,t.isFunction)(e[n])}),(0,t.isFunction)(e[i])?e[i](n):!1}function o(e,t,n){let r=e;do{if(a(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function s(e,t,n,r){if(!e)return;let i={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,i):e.attachEvent?e.attachEvent(`on`+t,n):e[`on`+t]=n}function c(e,t,n,r){if(!e)return;let i={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent?e.detachEvent(`on`+t,n):e[`on`+t]=null}function l(e){let n=e.clientHeight,r=e.ownerDocument.defaultView.getComputedStyle(e);return n+=(0,t.int)(r.borderTopWidth),n+=(0,t.int)(r.borderBottomWidth),n}function u(e){let n=e.clientWidth,r=e.ownerDocument.defaultView.getComputedStyle(e);return n+=(0,t.int)(r.borderLeftWidth),n+=(0,t.int)(r.borderRightWidth),n}function d(e){let n=e.clientHeight,r=e.ownerDocument.defaultView.getComputedStyle(e);return n-=(0,t.int)(r.paddingTop),n-=(0,t.int)(r.paddingBottom),n}function f(e){let n=e.clientWidth,r=e.ownerDocument.defaultView.getComputedStyle(e);return n-=(0,t.int)(r.paddingLeft),n-=(0,t.int)(r.paddingRight),n}function p(e,t,n){let r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect();return{x:(e.clientX+t.scrollLeft-r.left)/n,y:(e.clientY+t.scrollTop-r.top)/n}}function m(e,t){let r=g(e,t,`px`);return{[(0,n.browserPrefixToKey)(`transform`,n.default)]:r}}function h(e,t){return g(e,t,``)}function g(e,t,n){let{x:r,y:i}=e,a=`translate(${r}${n},${i}${n})`;return t&&(a=`translate(${`${typeof t.x==`string`?t.x:t.x+n}`}, ${`${typeof t.y==`string`?t.y:t.y+n}`})`+a),a}function _(e,n){return e.targetTouches&&(0,t.findInArray)(e.targetTouches,e=>n===e.identifier)||e.changedTouches&&(0,t.findInArray)(e.changedTouches,e=>n===e.identifier)}function v(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function y(e){if(!e)return;let t=e.getElementById(`react-draggable-style-el`);t||(t=e.createElement(`style`),t.type=`text/css`,t.id=`react-draggable-style-el`,t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
9
|
+
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
10
|
+
`,e.getElementsByTagName(`head`)[0].appendChild(t)),e.body&&S(e.body,`react-draggable-transparent-selection`)}function b(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{x(e)}):x(e)}function x(e){if(e)try{if(e.body&&C(e.body,`react-draggable-transparent-selection`),e.selection)e.selection.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function S(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function C(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}})),We=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.canDragX=a,e.canDragY=o,e.createCoreData=c,e.createDraggableData=l,e.getBoundPosition=r,e.getControlPosition=s,e.snapToGrid=i;var t=Ve(),n=Ue();function r(e,r,i){if(!e.props.bounds)return[r,i];let{bounds:a}=e.props;a=typeof a==`string`?a:u(a);let o=d(e);if(typeof a==`string`){let{ownerDocument:e}=o,r=e.defaultView,i;if(i=a===`parent`?o.parentNode:o.getRootNode().querySelector(a),!(i instanceof r.HTMLElement))throw Error(`Bounds selector "`+a+`" could not find an element.`);let s=i,c=r.getComputedStyle(o),l=r.getComputedStyle(s);a={left:-o.offsetLeft+(0,t.int)(l.paddingLeft)+(0,t.int)(c.marginLeft),top:-o.offsetTop+(0,t.int)(l.paddingTop)+(0,t.int)(c.marginTop),right:(0,n.innerWidth)(s)-(0,n.outerWidth)(o)-o.offsetLeft+(0,t.int)(l.paddingRight)-(0,t.int)(c.marginRight),bottom:(0,n.innerHeight)(s)-(0,n.outerHeight)(o)-o.offsetTop+(0,t.int)(l.paddingBottom)-(0,t.int)(c.marginBottom)}}return(0,t.isNum)(a.right)&&(r=Math.min(r,a.right)),(0,t.isNum)(a.bottom)&&(i=Math.min(i,a.bottom)),(0,t.isNum)(a.left)&&(r=Math.max(r,a.left)),(0,t.isNum)(a.top)&&(i=Math.max(i,a.top)),[r,i]}function i(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function a(e){return e.props.axis===`both`||e.props.axis===`x`}function o(e){return e.props.axis===`both`||e.props.axis===`y`}function s(e,t,r){let i=typeof t==`number`?(0,n.getTouch)(e,t):null;if(typeof t==`number`&&!i)return null;let a=d(r),o=r.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,n.offsetXYFromParent)(i||e,o,r.props.scale)}function c(e,n,r){let i=!(0,t.isNum)(e.lastX),a=d(e);return i?{node:a,deltaX:0,deltaY:0,lastX:n,lastY:r,x:n,y:r}:{node:a,deltaX:n-e.lastX,deltaY:r-e.lastY,lastX:e.lastX,lastY:e.lastY,x:n,y:r}}function l(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function u(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function d(e){let t=e.findDOMNode();if(!t)throw Error(`<DraggableCore>: Unmounted during event!`);return t}})),Ge=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=t;function t(){}})),Ke=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var t=l(require(`react`)),n=c(Be()),r=c(require(`react-dom`)),i=Ue(),a=We(),o=Ve(),s=c(Ge());function c(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(l=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!==`default`&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function u(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){var t=f(e,`string`);return typeof t==`symbol`?t:t+``}function f(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var p={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},m=p.mouse,h=class extends t.Component{constructor(){super(...arguments),u(this,`dragging`,!1),u(this,`lastX`,NaN),u(this,`lastY`,NaN),u(this,`touchIdentifier`,null),u(this,`mounted`,!1),u(this,`handleDragStart`,e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button==`number`&&e.button!==0)return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(`<DraggableCore> not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!(0,i.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,i.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=(0,i.getTouchIdentifier)(e);this.touchIdentifier=r;let o=(0,a.getControlPosition)(e,r,this);if(o==null)return;let{x:c,y:l}=o,u=(0,a.createCoreData)(this,c,l);(0,s.default)(`DraggableCore: handleDragStart: %j`,u),(0,s.default)(`calling`,this.props.onStart),!(this.props.onStart(e,u)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,i.addUserSelectStyles)(n),this.dragging=!0,this.lastX=c,this.lastY=l,(0,i.addEvent)(n,m.move,this.handleDrag),(0,i.addEvent)(n,m.stop,this.handleDragStop))}),u(this,`handleDrag`,e=>{let t=(0,a.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=(0,a.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=(0,a.createCoreData)(this,n,r);if((0,s.default)(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r}),u(this,`handleDragStop`,e=>{if(!this.dragging)return;let t=(0,a.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=(0,a.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let o=(0,a.createCoreData)(this,n,r);if(this.props.onStop(e,o)===!1||this.mounted===!1)return!1;let c=this.findDOMNode();c&&this.props.enableUserSelectHack&&(0,i.scheduleRemoveUserSelectStyles)(c.ownerDocument),(0,s.default)(`DraggableCore: handleDragStop: %j`,o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,c&&((0,s.default)(`DraggableCore: Removing handlers`),(0,i.removeEvent)(c.ownerDocument,m.move,this.handleDrag),(0,i.removeEvent)(c.ownerDocument,m.stop,this.handleDragStop))}),u(this,`onMouseDown`,e=>(m=p.mouse,this.handleDragStart(e))),u(this,`onMouseUp`,e=>(m=p.mouse,this.handleDragStop(e))),u(this,`onTouchStart`,e=>(m=p.touch,this.handleDragStart(e))),u(this,`onTouchEnd`,e=>(m=p.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&(0,i.addEvent)(e,p.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;(0,i.removeEvent)(t,p.mouse.move,this.handleDrag),(0,i.removeEvent)(t,p.touch.move,this.handleDrag),(0,i.removeEvent)(t,p.mouse.stop,this.handleDragStop),(0,i.removeEvent)(t,p.touch.stop,this.handleDragStop),(0,i.removeEvent)(e,p.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,i.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:r.default.findDOMNode(this)}render(){return t.cloneElement(t.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};e.default=h,u(h,`displayName`,`DraggableCore`),u(h,`propTypes`,{allowAnyClick:n.default.bool,allowMobileScroll:n.default.bool,children:n.default.node.isRequired,disabled:n.default.bool,enableUserSelectHack:n.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:n.default.arrayOf(n.default.number),handle:n.default.string,cancel:n.default.string,nodeRef:n.default.object,onStart:n.default.func,onDrag:n.default.func,onStop:n.default.func,onMouseDown:n.default.func,scale:n.default.number,className:o.dontSetMe,style:o.dontSetMe,transform:o.dontSetMe}),u(h,`defaultProps`,{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})})),qe=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),Object.defineProperty(e,`DraggableCore`,{enumerable:!0,get:function(){return c.default}}),e.default=void 0;var t=d(require(`react`)),n=u(Be()),r=u(require(`react-dom`)),i=require(`clsx`),a=Ue(),o=We(),s=Ve(),c=u(Ke()),l=u(Ge());function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(d=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!==`default`&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(null,arguments)}function p(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=h(e,`string`);return typeof t==`symbol`?t:t+``}function h(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var g=class extends t.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:r}=t;return n&&(!r||n.x!==r.x||n.y!==r.y)?((0,l.default)(`Draggable: getDerivedStateFromProps %j`,{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:{...n}}):null}constructor(e){super(e),p(this,`onDragStart`,(e,t)=>{if((0,l.default)(`Draggable: onDragStart: %j`,t),this.props.onStart(e,(0,o.createDraggableData)(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,`onDrag`,(e,t)=>{if(!this.state.dragging)return!1;(0,l.default)(`Draggable: onDrag: %j`,t);let n=(0,o.createDraggableData)(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=(0,o.getBoundPosition)(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)}),p(this,`onDragStop`,(e,t)=>{if(!this.state.dragging||this.props.onStop(e,(0,o.createDraggableData)(this,t))===!1)return!1;(0,l.default)(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)}),this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.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(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??r.default.findDOMNode(this)}render(){let{axis:e,bounds:n,children:r,defaultPosition:s,defaultClassName:l,defaultClassNameDragging:u,defaultClassNameDragged:d,position:p,positionOffset:m,scale:h,...g}=this.props,_={},v=null,y=!p||this.state.dragging,b=p||s,x={x:(0,o.canDragX)(this)&&y?this.state.x:b.x,y:(0,o.canDragY)(this)&&y?this.state.y:b.y};this.state.isElementSVG?v=(0,a.createSVGTransform)(x,m):_=(0,a.createCSSTransform)(x,m);let S=(0,i.clsx)(r.props.className||``,l,{[u]:this.state.dragging,[d]:this.state.dragged});return t.createElement(c.default,f({},g,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(r),{className:S,style:{...r.props.style,..._},transform:v}))}};e.default=g,p(g,`displayName`,`Draggable`),p(g,`propTypes`,{...c.default.propTypes,axis:n.default.oneOf([`both`,`x`,`y`,`none`]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),p(g,`defaultProps`,{...c.default.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1})})),Je=p(((e,t)=>{var{default:n,DraggableCore:r}=qe();t.exports=n,t.exports.default=n,t.exports.DraggableCore=r})),Ye=p((e=>{e.__esModule=!0,e.cloneElement=c;var t=n(require(`react`));function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?r(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){var t=s(e,`string`);return typeof t==`symbol`?t:t+``}function s(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function c(e,n){return n.style&&e.props.style&&(n.style=i(i({},e.props.style),n.style)),n.className&&e.props.className&&(n.className=`${e.props.className} ${n.className}`),t.default.cloneElement(e,n)}})),Xe=p((e=>{e.__esModule=!0,e.resizableProps=void 0;var t=n(Be());Je();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle: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}),height:function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];let[i]=n;return i.axis===`both`||i.axis===`y`?t.default.number.isRequired(...n):t.default.number(...n)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];let[i]=n;return i.axis===`both`||i.axis===`x`?t.default.number.isRequired(...n):t.default.number(...n)}}})),Ze=p((e=>{e.__esModule=!0,e.default=void 0;var t=o(require(`react`)),n=Je(),r=Ye(),i=Xe(),a=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function o(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(o=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!==`default`&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(null,arguments)}function c(e,t){if(e==null)return{};var n,r,i=l(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function l(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=m(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var h=class extends t.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(e,t){let{minConstraints:n,maxConstraints:r,lockAspectRatio:i}=this.props;if(!n&&!r&&!i)return[e,t];if(i){let n=this.props.width/this.props.height,r=e-this.props.width,i=t-this.props.height;Math.abs(r)>Math.abs(i*n)?t=e/n:e=t*n}let[a,o]=[e,t],[s,c]=this.slack||[0,0];return e+=s,t+=c,n&&(e=Math.max(n[0],e),t=Math.max(n[1],t)),r&&(e=Math.min(r[0],e),t=Math.min(r[1],t)),this.slack=[s+(a-e),c+(o-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let{node:i,deltaX:a,deltaY:o}=r;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.props.width+(s?a/this.props.transformScale:0),p=this.props.height+(c?o/this.props.transformScale:0);[f,p]=this.runConstraints(f,p),e===`onResizeStop`&&this.lastSize&&({width:f,height:p}=this.lastSize);let m=f!==this.props.width||p!==this.props.height;e!==`onResizeStop`&&(this.lastSize={width:f,height:p});let h=typeof this.props[e]==`function`?this.props[e]:null;h&&!(e===`onResize`&&!m)&&(n.persist?.(),h(n,{node:i,size:{width:f,height:p},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,n){let{handle:r}=this.props;if(!r)return t.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-${e}`,ref:n});if(typeof r==`function`)return r(e,n);let i=typeof r.type==`string`,a=d({ref:n},i?{}:{handleAxis:e});return t.cloneElement(r,a)}render(){let e=this.props,{children:i,className:o,draggableOpts:l,width:u,height:f,handle:p,handleSize:m,lockAspectRatio:h,axis:g,minConstraints:_,maxConstraints:v,onResize:y,onResizeStop:b,onResizeStart:x,resizeHandles:S,transformScale:C}=e,w=c(e,a);return(0,r.cloneElement)(i,d(d({},w),{},{className:`${o?`${o} `:``}react-resizable`,children:[...t.Children.toArray(i.props.children),...S.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,s({},l,{nodeRef:r,key:`resizableHandle-${e}`,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,r))})]}))}};e.default=h,h.propTypes=i.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Qe=p((e=>{e.__esModule=!0,e.default=void 0;var t=s(require(`react`)),n=o(Be()),r=o(Ze()),i=Xe(),a=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!==`default`&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(null,arguments)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?l(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){var t=p(e,`string`);return typeof t==`symbol`?t:t+``}function p(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function m(e,t){if(e==null)return{};var n,r,i=h(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function h(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var g=class extends t.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(e,t)=>{let{size:n}=t;this.props.onResize?(e.persist?.(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,{handle:n,handleSize:i,onResize:o,onResizeStart:s,onResizeStop:l,draggableOpts:d,minConstraints:f,maxConstraints:p,lockAspectRatio:h,axis:g,width:_,height:v,resizeHandles:y,style:b,transformScale:x}=e,S=m(e,a);return t.createElement(r.default,{axis:g,draggableOpts:d,handle:n,handleSize:i,height:this.state.height,lockAspectRatio:h,maxConstraints:p,minConstraints:f,onResizeStart:s,onResize:this.onResize,onResizeStop:l,resizeHandles:y,transformScale:x,width:this.state.width},t.createElement(`div`,c({},S,{style:u(u({},b),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=u(u({},i.resizableProps),{},{children:n.default.element})})),$e=p(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Ze().default,t.exports.ResizableBox=Qe().default})),et=Je(),tt=$e(),nt=Ae();function rt(e){let{children:t,cols:n,containerWidth:r,margin:a,containerPadding:s,rowHeight:c,maxRows:l,isDraggable:u,isResizable:d,isBounded:f,static:p,useCSSTransforms:m=!0,usePercentages:h=!1,transformScale:g=1,positionStrategy:_,dragThreshold:v=0,droppingPosition:b,className:x=``,style:S,handle:E=``,cancel:A=``,x:j,y:M,w:N,h:P,minW:F=1,maxW:ee=1/0,minH:I=1,maxH:L=1/0,i:R,resizeHandles:z,resizeHandle:te,constraints:ne=ae,layoutItem:B,layout:re=[],onDragStart:ie,onDrag:V,onDragStop:de,onResizeStart:fe,onResize:pe,onResizeStop:me}=e,[H,U]=(0,i.useState)(!1),[W,G]=(0,i.useState)(!1),he=(0,i.useRef)(null),K=(0,i.useRef)({left:0,top:0}),_e=(0,i.useRef)({top:0,left:0,width:0,height:0}),ve=(0,i.useRef)(void 0),ye=(0,i.useRef)(re);ye.current=re;let be=(0,i.useRef)(null),xe=(0,i.useRef)(null),q=(0,i.useRef)(!1),Se=(0,i.useRef)({x:0,y:0}),Ce=(0,i.useRef)(!1),J=(0,i.useMemo)(()=>({cols:n,containerPadding:s,containerWidth:r,margin:a,maxRows:l,rowHeight:c}),[n,s,r,a,l,c]),Y=(0,i.useMemo)(()=>({cols:n,maxRows:l,containerWidth:r,containerHeight:0,rowHeight:c,margin:a,layout:[]}),[n,l,r,c,a]),X=(0,i.useCallback)(()=>({...Y,layout:ye.current}),[Y]),Z=(0,i.useMemo)(()=>B??{i:R,x:j,y:M,w:N,h:P,minW:F,maxW:ee,minH:I,maxH:L},[B,R,j,M,N,P,F,ee,I,L]),we=(0,i.useCallback)(e=>{if(_?.calcStyle)return _.calcStyle(e);if(m)return ce(e);let t=le(e);return h?{...t,left:ue(e.left/r),width:ue(e.width/r)}:t},[_,m,h,r]),Te=(0,i.useCallback)((e,{node:t})=>{if(!ie)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/g,o=r.left/g,s=i.top/g,c=r.top/g,l;if(_?.calcDragPosition){let t=e;l=_.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(K.current=l,v>0){let t=e;Se.current={x:t.clientX,y:t.clientY},q.current=!0,Ce.current=!1,U(!0);return}U(!0);let u=D(J,l.top,l.left),{x:d,y:f}=oe(ne,Z,u.x,u.y,X());ie(R,d,f,{e,node:t,newPosition:l})},[ie,g,J,_,v,ne,Z,X,R]),Ee=(0,i.useCallback)((e,{node:t,deltaX:n,deltaY:i})=>{if(!V||!H)return;let o=e;if(q.current&&!Ce.current){let n=o.clientX-Se.current.x,r=o.clientY-Se.current.y;if(Math.hypot(n,r)<v)return;if(Ce.current=!0,q.current=!1,ie){let n=D(J,K.current.top,K.current.left),{x:r,y:i}=oe(ne,Z,n.x,n.y,X());ie(R,r,i,{e,node:t,newPosition:K.current})}}let s=K.current.top+i,l=K.current.left+n;if(f){let{offsetParent:e}=t;if(e){let t=e.clientHeight-w(P,c,a[1]);s=k(s,0,t);let n=r-w(N,C(J),a[0]);l=k(l,0,n)}}let u={top:s,left:l};K.current=u;let d=D(J,s,l),{x:p,y:m}=oe(ne,Z,d.x,d.y,X());V(R,p,m,{e,node:t,newPosition:u})},[V,ie,H,v,f,P,c,a,J,r,N,R,ne,Z,X]),De=(0,i.useCallback)((e,{node:t})=>{if(!de||!H)return;let n=q.current;if(q.current=!1,Ce.current=!1,Se.current={x:0,y:0},n){U(!1),K.current={left:0,top:0};return}let{left:r,top:i}=K.current,a={top:i,left:r};U(!1),K.current={left:0,top:0};let o=D(J,i,r),{x:s,y:c}=oe(ne,Z,o.x,o.y,X());de(R,s,c,{e,node:t,newPosition:a})},[de,H,J,ne,Z,X,R]);be.current=Te,xe.current=Ee;let Q=(0,i.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?fe:o===`onResize`?pe:me;if(!s)return;let c;c=t?ge(i,a,n,r):{...n,top:a.top,left:a.left},_e.current=c;let l=O(J,c.width,c.height),{w:u,h:d}=se(ne,Z,l.w,l.h,i,X());s(R,u,d,{e:e.nativeEvent,node:t,size:c,handle:i})},[fe,pe,me,r,J,R,ne,Z,X]),Oe=(0,i.useCallback)((e,t)=>{G(!0);let n=T(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResizeStart`)},[Q,J,j,M,N,P]),ke=(0,i.useCallback)((e,t)=>{let n=T(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResize`)},[Q,J,j,M,N,P]),Ae=(0,i.useCallback)((e,t)=>{G(!1),_e.current={top:0,left:0,width:0,height:0};let n=T(J,j,M,N,P);Q(e,{...t,handle:t.handle},n,`onResizeStop`)},[Q,J,j,M,N,P]);(0,i.useEffect)(()=>{if(!b)return;let e=he.current;if(!e)return;let t=ve.current||{left:0,top:0},n=H&&(b.left!==t.left||b.top!==t.top);if(!H){let t={node:e,deltaX:b.left,deltaY:b.top,lastX:0,lastY:0,x:b.left,y:b.top};be.current?.(b.e,t)}else if(n){let t={node:e,deltaX:b.left-K.current.left,deltaY:b.top-K.current.top,lastX:K.current.left,lastY:K.current.top,x:b.left,y:b.top};xe.current?.(b.e,t)}ve.current=b},[b,H,R]);let je=T(J,j,M,N,P,H?K.current:null,W?_e.current:null),Me=i.default.Children.only(t),Ne=T(J,0,0,1,1),Pe=[Ne.width,Ne.height],Fe=[1/0,1/0],Ie=Me.props,Le=Ie.className,Re=Ie.style,$=i.default.cloneElement(Me,{ref:he,className:(0,o.default)(`react-grid-item`,Le,x,{static:p,resizing:W,"react-draggable":u,"react-draggable-dragging":H,dropping:!!b,cssTransforms:m}),style:{...S,...Re,...we(je)}}),ze=te;return $=(0,y.jsx)(tt.Resizable,{draggableOpts:{disabled:!d},className:d?void 0:`react-resizable-hide`,width:je.width,height:je.height,minConstraints:Pe,maxConstraints:Fe,onResizeStart:Oe,onResize:ke,onResizeStop:Ae,transformScale:g,resizeHandles:z,handle:ze,children:$}),$=(0,y.jsx)(et.DraggableCore,{disabled:!u,onStart:Te,onDrag:Ee,onStop:De,handle:E,cancel:`.react-resizable-handle`+(A?`,`+A:``),scale:g,nodeRef:he,children:$}),$}var it=()=>{},at=`react-grid-layout`,ot=!1;try{ot=/firefox/i.test(navigator.userAgent)}catch{}function st(e,t){let n=i.default.Children.toArray(e),r=i.default.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t?.key!==i?.key)return!1}return!0}function ct(e,t,n,r){let a=[],o=new Set;i.default.Children.forEach(t,t=>{if(!i.default.isValidElement(t)||t.key===null)return;let n=String(t.key);o.add(n);let r=e.find(e=>e.i===n);if(r)a.push(R(r));else{let e=t.props[`data-grid`];e?a.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):a.push({i:n,x:0,y:ee(a),w:1,h:1})}});let s=B(a,{cols:n});return r.compact(s,n)}function lt(e){let{children:t,width:n,gridConfig:r,dragConfig:a,resizeConfig:s,dropConfig:c,positionStrategy:l=K,compactor:u,constraints:d=ae,layout:f=[],droppingItem:p,autoSize:m=!0,className:h=``,style:g={},innerRef:_,onLayoutChange:v=it,onDragStart:b=it,onDrag:x=it,onDragStop:S=it,onResizeStart:T=it,onResize:D=it,onResizeStop:O=it,onDrop:k=it,onDropDragOver:A=it}=e,j=(0,i.useMemo)(()=>({..._e,...r}),[r]),N=(0,i.useMemo)(()=>({...ve,...a}),[a]),P=(0,i.useMemo)(()=>({...ye,...s}),[s]),F=(0,i.useMemo)(()=>({...be,...c}),[c]),{cols:L,rowHeight:z,maxRows:te,margin:B,containerPadding:ie}=j,{enabled:V,bounded:oe,handle:se,cancel:ce,threshold:le}=N,{enabled:ue,handles:de,handleComponent:fe}=P,{enabled:pe,defaultItem:me,onDragOver:H}=F,U=u??Te(`vertical`),W=U.type,G=U.allowOverlap,he=U.preventCollision??!1,ge=(0,i.useMemo)(()=>p??{i:`__dropping-elem__`,...me},[p,me]),xe=l.type===`transform`,q=l.scale,Se=ie??B,[Ce,J]=(0,i.useState)(!1),[Y,X]=(0,i.useState)(()=>ct(f,t,L,U)),[Z,we]=(0,i.useState)(null),[Ee,De]=(0,i.useState)(!1),[Q,Oe]=(0,i.useState)(null),[ke,Ae]=(0,i.useState)(),je=(0,i.useRef)(null),Me=(0,i.useRef)(null),Ne=(0,i.useRef)(null),Pe=(0,i.useRef)(0),Fe=(0,i.useRef)(Y),Ie=(0,i.useRef)(f),Le=(0,i.useRef)(t),Re=(0,i.useRef)(W),$=(0,i.useRef)(Y);$.current=Y,(0,i.useEffect)(()=>{J(!0),(0,nt.deepEqual)(Y,f)||v(Y)},[]),(0,i.useEffect)(()=>{if(Z||Q)return;let e=!(0,nt.deepEqual)(f,Ie.current),n=!st(t,Le.current),r=W!==Re.current;if(e||n||r){let n=ct(e?f:Y,t,L,U);(0,nt.deepEqual)(n,Y)||X(n)}Ie.current=f,Le.current=t,Re.current=W},[f,t,L,W,U,Z,Q,Y]),(0,i.useEffect)(()=>{!Z&&!(0,nt.deepEqual)(Y,Fe.current)&&(Fe.current=Y,v(Y.filter(e=>e.i!==ge.i)))},[Y,Z,v,ge.i]);let ze=(0,i.useMemo)(()=>{if(!m)return;let e=ee(Y),t=Se[1];return e*z+(e-1)*B[1]+t*2+`px`},[m,Y,z,B,Se]),Be=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=I(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};je.current=R(a),Ne.current=i,we(o),b(i,a,a,null,r.e,r.node)},[b]),Ve=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=je.current,o=I(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=re(i,o,t,n,!0,he,W,L,G);x(c,a,o,s,r.e,r.node),X(U.compact(c,L)),we(s)},[he,W,L,G,U,x]),He=(0,i.useCallback)((e,t,n,r)=>{if(!Z)return;let i=$.current,a=je.current,o=I(i,e);if(!o)return;let s=re(i,o,t,n,!0,he,W,L,G),c=U.compact(s,L);S(c,a,o,null,r.e,r.node);let l=Ne.current;je.current=null,Ne.current=null,we(null),X(c),l&&!(0,nt.deepEqual)(l,c)&&v(c)},[Z,he,W,L,G,U,S,v]),Ue=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=I(i,e);a&&(Me.current=R(a),Ne.current=i,De(!0),T(i,a,a,null,r.e,r.node))},[T]),We=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=Me.current,{handle:o}=r,s=!1,c,l,[u,d]=ne(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),he&&!G&&M(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=re(u,d,c,l,!0,he,W,L,G));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};D(f,a,d,p,r.e,r.node),X(U.compact(f,L)),we(p)},[he,W,L,G,U,D]),Ge=(0,i.useCallback)((e,t,n,r)=>{let i=$.current,a=Me.current,o=I(i,e),s=U.compact(i,L);O(s,a,o??null,null,r.e,r.node);let c=Ne.current;Me.current=null,Ne.current=null,we(null),De(!1),X(s),c&&!(0,nt.deepEqual)(c,s)&&v(s)},[L,U,O,v]),Ke=(0,i.useCallback)(()=>{let e=$.current;if(!e.some(e=>e.i===ge.i)){Oe(null),we(null),Ae(void 0);return}X(U.compact(e.filter(e=>e.i!==ge.i),L)),Oe(null),we(null),Ae(void 0)},[ge.i,L,U]),qe=(0,i.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),ot&&!e.nativeEvent.target?.classList.contains(at))return!1;let t=H?H(e.nativeEvent):A(e);if(t===!1)return Q&&Ke(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...ge,...a},s=e.currentTarget.getBoundingClientRect(),c={cols:L,margin:B,maxRows:te,rowHeight:z,containerWidth:n,containerPadding:Se},l=C(c),u=w(o.w,l,B[0]),d=w(o.h,z,B[1]),f=u/2,p=d/2,m=e.clientX-s.left+r-f,h=e.clientY-s.top+i-p,g=Math.max(0,m),_=Math.max(0,h),v={left:g/q,top:_/q,e:e.nativeEvent};if(Q)ke&&(ke.left!==v.left||ke.top!==v.top)&&Ae(v);else{let e=E(c,_,g,o.w,o.h);Oe((0,y.jsx)(`div`,{},o.i)),Ae(v),X([...$.current,{...o,x:e.x,y:e.y,static:!1,isDraggable:!0}])}},[Q,ke,ge,H,A,Ke,q,L,B,te,z,n,Se]),Je=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Pe.current--,Pe.current<0&&(Pe.current=0),Pe.current===0&&Ke()},[Ke]),Ye=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Pe.current++},[]),Xe=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=$.current,n=t.find(e=>e.i===ge.i);Pe.current=0,Ke(),k(t,n,e.nativeEvent)},[ge.i,Ke,k]),Ze=(0,i.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=I(Y,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&V,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ue,o=r.resizeHandles||[...de],s=i&&oe&&r.isBounded!==!1,c=fe;return(0,y.jsx)(rt,{containerWidth:n,cols:L,margin:B,containerPadding:Se,maxRows:te,rowHeight:z,cancel:ce,handle:se,onDragStart:Be,onDrag:Ve,onDragStop:He,onResizeStart:Ue,onResize:We,onResizeStop:Ge,isDraggable:i,isResizable:a,isBounded:s,useCSSTransforms:xe&&Ce,usePercentages:!Ce,transformScale:q,positionStrategy:l,dragThreshold:le,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?ke:void 0,resizeHandles:o,resizeHandle:c,constraints:d,layoutItem:r,layout:Y,children:e},r.i)},[Y,n,L,B,Se,te,z,ce,se,Be,Ve,He,Ue,We,Ge,V,ue,oe,xe,Ce,q,l,le,ke,de,fe,d]),Qe=()=>Z?(0,y.jsx)(rt,{w:Z.w,h:Z.h,x:Z.x,y:Z.y,i:Z.i,className:`react-grid-placeholder ${Ee?`placeholder-resizing`:``}`,containerWidth:n,cols:L,margin:B,containerPadding:Se,maxRows:te,rowHeight:z,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:xe,transformScale:q,constraints:d,layout:Y,children:(0,y.jsx)(`div`,{})}):null;return(0,y.jsxs)(`div`,{ref:_,className:(0,o.default)(at,h),style:{height:ze,...g},onDrop:pe?Xe:void 0,onDragLeave:pe?Je:void 0,onDragEnter:pe?Ye:void 0,onDragOver:pe?qe:void 0,children:[i.default.Children.map(t,e=>i.default.isValidElement(e)?Ze(e):null),pe&&Q&&Ze(Q,!0),Qe()]})}var ut={lg:1200,md:996,sm:768,xs:480,xxs:0},dt={lg:12,md:10,sm:6,xs:4,xxs:2},ft=()=>{};function pt(e,t,n,r){let a=[];i.default.Children.forEach(t,t=>{if(!i.default.isValidElement(t)||t.key===null)return;let n=String(t.key),r=e.find(e=>e.i===n);if(r)a.push({...r,i:n});else{let e=t.props[`data-grid`];e?a.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):a.push({i:n,x:0,y:ee(a),w:1,h:1})}});let o=B(a,{cols:n});return r.compact(o,n)}function mt(e){let{children:t,width:n,breakpoint:r,breakpoints:a=ut,cols:o=dt,layouts:s={},rowHeight:c=150,maxRows:l=1/0,margin:u=[10,10],containerPadding:d=null,compactor:f,onBreakpointChange:p=ft,onLayoutChange:m=ft,onWidthChange:h=ft,...g}=e,_=f??Te(`vertical`),v=_.type,b=_.allowOverlap,x=(0,i.useMemo)(()=>r??De(a,n),[]),S=(0,i.useMemo)(()=>Q(x,o),[x,o]),C=(0,i.useMemo)(()=>Oe(s,a,x,x,S,v),[]),[w,T]=(0,i.useState)(x),[E,D]=(0,i.useState)(S),[O,k]=(0,i.useState)(C),[A,j]=(0,i.useState)(s),M=(0,i.useRef)(n),N=(0,i.useRef)(r),P=(0,i.useRef)(a),F=(0,i.useRef)(o),ee=(0,i.useRef)(s),I=(0,i.useRef)(v),L=(0,i.useRef)(A);(0,i.useEffect)(()=>{L.current=A},[A]);let R=(0,i.useMemo)(()=>(0,nt.deepEqual)(s,ee.current)?null:Oe(s,a,w,w,E,_),[s,a,w,E,_]),te=R??O;(0,i.useEffect)(()=>{R!==null&&(k(R),j(s),L.current=s,ee.current=s)},[R,s]),(0,i.useEffect)(()=>{if(v!==I.current){let e=_.compact(z(te),E),t={...L.current,[w]:e};k(e),j(t),L.current=t,m(e,t),I.current=v}},[v,_,te,E,b,w,m]),(0,i.useEffect)(()=>{let e=n!==M.current,i=r!==N.current,s=!(0,nt.deepEqual)(a,P.current),c=!(0,nt.deepEqual)(o,F.current);if(e||i||s||c){let e=r??De(a,n),i=Q(e,o),l=w;if(l!==e||s||c){let n={...L.current};n[l]||(n[l]=z(O));let r=Oe(n,a,e,l,i,_);r=pt(r,t,i,_),n[e]=r,T(e),D(i),k(r),j(n),L.current=n,p(e,i),m(r,n)}h(n,ke(u,e),i,d?ke(d,e):null),M.current=n,N.current=r,P.current=a,F.current=o}},[n,r,a,o,w,E,O,t,_,v,b,u,d,p,m,h]);let ne=(0,i.useCallback)(e=>{let t={...L.current,[w]:e};k(e),j(t),L.current=t,m(e,t)},[w,m]),B=(0,i.useMemo)(()=>ke(u,w),[u,w]),re=(0,i.useMemo)(()=>d===null?null:ke(d,w),[d,w]),ie=(0,i.useMemo)(()=>({cols:E,rowHeight:c,maxRows:l,margin:B,containerPadding:re}),[E,c,l,B,re]);return(0,y.jsx)(lt,{...g,width:n,gridConfig:ie,compactor:_,onLayoutChange:ne,layout:te,children:t})}function ht({editMode:e}){let t=(0,n.useDnd)();return i.useEffect(()=>{if(e)return t.startDrag({id:`dashboard-layout`,type:`dashboard-widget`,data:{}}),()=>{t.endDrag()};t.endDrag(`dashboard`)},[e,t]),null}var gt=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],_t=({schema:e,className:t,onLayoutChange:o,persistLayoutKey:s=`dashboard-layout`,onRefresh:c})=>{let{width:l,containerRef:u,mounted:d}=je(),[f,p]=i.useState(!1),[m,h]=i.useState(!1),_=(0,n.useHasDndProvider)(),v=i.useRef(null),b=i.useCallback(()=>{c&&(h(!0),c(),setTimeout(()=>h(!1),600))},[c]);i.useEffect(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!c))return v.current=setInterval(b,e.refreshInterval*1e3),()=>{v.current&&clearInterval(v.current)}},[e.refreshInterval,c,b]);let[x,S]=i.useState(()=>{if(typeof window<`u`&&s){let e=localStorage.getItem(s);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse saved layout:`,e)}}return{lg:e.widgets?.map((e,t)=>({i:e.id||`widget-${t}`,x:e.layout?.x||t%4*3,y:e.layout?.y||Math.floor(t/4)*4,w:e.layout?.w||3,h:e.layout?.h||4}))||[]}}),C=i.useCallback((e,t)=>{S(t),o?.(e)},[o]),w=i.useCallback(()=>{typeof window<`u`&&s&&localStorage.setItem(s,JSON.stringify(x)),p(!1)},[x,s]),T=i.useCallback(()=>{S({lg:e.widgets?.map((e,t)=>({i:e.id||`widget-${t}`,x:e.layout?.x||t%4*3,y:e.layout?.y||Math.floor(t/4)*4,w:e.layout?.w||3,h:e.layout?.h||4}))||[]}),typeof window<`u`&&s&&localStorage.removeItem(s)},[e.widgets,s]),E=i.useCallback(e=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`bar`||t===`line`||t===`area`||t===`pie`||t===`donut`||t===`scatter`){let r=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(g(r)){let n=r.aggregate,o=n?{field:e.valueField||n.field,function:e.aggregate||n.function,groupBy:e.categoryField||n.groupBy}:void 0,s=o?.field||a;return{type:`object-chart`,chartType:t,objectName:e.object||r.object,aggregate:o,xAxisKey:i,series:[{dataKey:s}],colors:gt,className:`h-full`}}if(!r&&e.object){let n=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`name`}:void 0;return{type:`object-chart`,chartType:t,objectName:e.object,aggregate:n,xAxisKey:i,series:[{dataKey:e.valueField||`value`}],colors:gt,className:`h-full`}}return{type:`chart`,chartType:t,data:Array.isArray(r)?r:r?.items||[],xAxisKey:i,series:[{dataKey:a}],colors:gt,className:`h-full`}}if(t===`table`){let t=e.data||n.data;if(g(t)){let{data:r,...i}=n;return{type:`data-table`,...i,objectName:e.object||t.object,dataProvider:t,data:[],searchable:!1,pagination:!1,className:`border-0`}}return!t&&e.object?{type:`data-table`,...n,objectName:e.object,data:[],searchable:!1,pagination:!1,className:`border-0`}:{type:`data-table`,...n,data:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}if(t===`pivot`){let t=e.data||n.data;if(g(t)){let{data:r,...i}=n;return{type:`pivot`,...i,objectName:e.object||t.object,dataProvider:t,data:[]}}return{type:`pivot`,...n,data:Array.isArray(t)?t:t?.items||[]}}return{...e,...n}},[]);return(0,y.jsxs)(`div`,{ref:u,className:(0,r.cn)(`w-full`,t),"data-testid":`grid-layout`,children:[_&&(0,y.jsx)(ht,{editMode:f}),(0,y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,y.jsx)(`h2`,{className:`text-2xl font-bold`,children:e.title||`Dashboard`}),(0,y.jsx)(`div`,{className:`flex gap-2`,children:f?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(r.Button,{onClick:w,size:`sm`,variant:`default`,children:[(0,y.jsx)(a.Save,{className:`h-4 w-4 mr-2`}),`Save Layout`]}),(0,y.jsxs)(r.Button,{onClick:T,size:`sm`,variant:`outline`,children:[(0,y.jsx)(a.X,{className:`h-4 w-4 mr-2`}),`Reset`]}),(0,y.jsx)(r.Button,{onClick:()=>p(!1),size:`sm`,variant:`ghost`,children:`Cancel`})]}):(0,y.jsxs)(y.Fragment,{children:[c&&(0,y.jsxs)(r.Button,{onClick:b,size:`sm`,variant:`outline`,disabled:m,"aria-label":`Refresh dashboard`,children:[(0,y.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,m&&`animate-spin`)}),m?`Refreshing…`:`Refresh All`]}),(0,y.jsxs)(r.Button,{onClick:()=>p(!0),size:`sm`,variant:`outline`,children:[(0,y.jsx)(a.Edit,{className:`h-4 w-4 mr-2`}),`Edit Layout`]})]})})]}),d&&(0,y.jsx)(mt,{className:`layout`,width:l,layouts:x,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:f,handle:`.drag-handle`},resizeConfig:{enabled:f},onLayoutChange:C,children:e.widgets?.map((e,t)=>{let i=e.id||`widget-${t}`,o=E(e);return(0,y.jsx)(`div`,{className:`h-full`,children:e.type===`metric`?(0,y.jsxs)(`div`,{className:`h-full w-full relative`,children:[f&&(0,y.jsx)(`div`,{className:`drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border`,children:(0,y.jsx)(a.GripVertical,{className:`h-4 w-4`})}),(0,y.jsx)(n.SchemaRenderer,{schema:o,className:`h-full w-full`})]}):(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden border-border/50 shadow-sm transition-all`,`bg-card/50 backdrop-blur-sm`,f&&`ring-2 ring-primary/20`),children:[e.title&&(0,y.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between`,children:[(0,y.jsx)(r.CardTitle,{className:`text-base font-medium tracking-tight truncate`,title:e.title,children:e.title}),f&&(0,y.jsx)(`div`,{className:`drag-handle cursor-move p-1 hover:bg-muted/40 rounded`,children:(0,y.jsx)(a.GripVertical,{className:`h-4 w-4`})})]}),(0,y.jsx)(r.CardContent,{className:`p-0 h-full`,children:(0,y.jsx)(`div`,{className:(0,r.cn)(`h-full w-full overflow-auto p-4`),children:(0,y.jsx)(n.SchemaRenderer,{schema:o})})})]})},i)})})]})};function vt(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var yt=({label:e,value:t,trend:n,icon:o,className:s,description:c,...l})=>{let u=(0,i.useMemo)(()=>{if(typeof o==`string`){let e=a[o];return e?(0,y.jsx)(e,{className:`h-4 w-4 text-muted-foreground`}):null}return o},[o]);return(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden`,s),...l,children:[(0,y.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm font-medium truncate`,children:vt(e)}),u&&(0,y.jsx)(`div`,{className:`h-4 w-4 text-muted-foreground shrink-0`,children:u})]}),(0,y.jsxs)(r.CardContent,{children:[(0,y.jsx)(`div`,{className:`text-2xl font-bold truncate`,children:t}),(n||c)&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1 truncate`,children:[n&&(0,y.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2 shrink-0`,n.direction===`up`&&`text-green-500`,n.direction===`down`&&`text-red-500`,n.direction===`neutral`&&`text-yellow-500`),children:[n.direction===`up`&&(0,y.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),n.direction===`down`&&(0,y.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),n.direction===`neutral`&&(0,y.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),n.value,`%`]}),(0,y.jsx)(`span`,{className:`truncate`,children:vt(c)||vt(n?.label)})]})]})]})};function bt(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var xt=({title:e,value:t,icon:n,trend:i,trendValue:o,description:s,className:c,...l})=>{let u=n&&a[n];return(0,y.jsxs)(r.Card,{className:(0,r.cn)(`h-full`,c),...l,children:[(0,y.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,y.jsx)(r.CardTitle,{className:`text-sm font-medium`,children:bt(e)}),u&&(0,y.jsx)(u,{className:`h-4 w-4 text-muted-foreground`})]}),(0,y.jsxs)(r.CardContent,{children:[(0,y.jsx)(`div`,{className:`text-2xl font-bold`,children:t}),(i||o||s)&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1`,children:[i&&o&&(0,y.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2`,i===`up`&&`text-green-500`,i===`down`&&`text-red-500`,i===`neutral`&&`text-yellow-500`),children:[i===`up`&&(0,y.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),i===`down`&&(0,y.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),i===`neutral`&&(0,y.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),o]}),bt(s)]})]})]})};function St(e,t){if(!t)return String(e);let n=``,r=``,i=!1,a,o=t,s=o.match(/^([^0-9.,#]*)/);if(s&&s[1]){let e=s[1];n=e.replace(`,`,``),e.includes(`,`)&&(i=!0),o=o.slice(s[1].length)}o.includes(`,`)&&(i=!0,o=o.replace(/,/g,``));let c=o.match(/\.(\d+)f?/);c&&(a=Number(c[1]),o=o.slice(c[0].length)),r=o.replace(/[0-9#.f]/g,``);let l=a===void 0?String(e):e.toFixed(a);if(i){let[e,t]=l.split(`.`),i=e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`);return n+(t===void 0?i:`${i}.${t}`)+r}return n+l+r}function Ct(e,t){if(e.length===0)return 0;switch(t){case`sum`:return e.reduce((e,t)=>e+t,0);case`count`:return e.length;case`avg`:return e.reduce((e,t)=>e+t,0)/e.length;case`min`:return Math.min(...e);case`max`:return Math.max(...e);default:return e.reduce((e,t)=>e+t,0)}}var wt=({schema:e,className:t})=>{let{title:n,rowField:a,columnField:o,valueField:s,aggregation:c=`sum`,data:l=[],showRowTotals:u=!1,showColumnTotals:d=!1,format:f,columnColors:p}=e,m=Array.isArray(l)?l:[],{rowKeys:h,colKeys:g,matrix:_,rowTotals:v,colTotals:b,grandTotal:x}=(0,i.useMemo)(()=>{let e=new Map,t=new Map,n={};for(let r of m){let i=String(r[a]??``),c=String(r[o]??``),l=Number(r[s])||0;e.set(i,!0),t.set(c,!0),n[i]||(n[i]={}),n[i][c]||(n[i][c]=[]),n[i][c].push(l)}let r=Array.from(e.keys()),i=Array.from(t.keys()),l={},u={},d={};for(let e of r){l[e]={};let t=[];for(let r of i){let i=n[e]?.[r]??[],a=Ct(i,c);l[e][r]=a,t.push(...i),!d[r]&&d[r]}u[e]=Ct(t,c)}for(let e of i){let t=[];for(let i of r){let r=n[i]?.[e]??[];t.push(...r)}d[e]=Ct(t,c)}let f=[];for(let e of m)f.push(Number(e[s])||0);return{rowKeys:r,colKeys:i,matrix:l,rowTotals:u,colTotals:d,grandTotal:Ct(f,c)}},[m,a,o,s,c]),S=e=>St(e,f);return m.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,t),children:[n&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:n}),(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,"data-testid":`pivot-empty-state`,children:[(0,y.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-40`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,y.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`}),(0,y.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})]}):(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,t),children:[n&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:n}),(0,y.jsxs)(`table`,{className:`w-full text-sm border-collapse`,role:`table`,children:[(0,y.jsx)(`thead`,{children:(0,y.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,y.jsx)(`th`,{className:`text-left p-2 font-medium text-muted-foreground`,children:a}),g.map(e=>(0,y.jsx)(`th`,{className:(0,r.cn)(`text-right p-2 font-medium`,p?.[e]??`text-muted-foreground`),children:e},e)),u&&(0,y.jsx)(`th`,{className:`text-right p-2 font-semibold text-muted-foreground bg-muted/20`,children:`Total`})]})}),(0,y.jsx)(`tbody`,{children:h.map(e=>(0,y.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/30`,children:[(0,y.jsx)(`td`,{className:`p-2 font-medium`,children:e}),g.map(t=>(0,y.jsx)(`td`,{className:(0,r.cn)(`text-right p-2 tabular-nums`,p?.[t]),children:S(_[e]?.[t]??0)},t)),u&&(0,y.jsx)(`td`,{className:`text-right p-2 font-semibold tabular-nums bg-muted/20`,children:S(v[e]??0)})]},e))}),d&&(0,y.jsx)(`tfoot`,{children:(0,y.jsxs)(`tr`,{className:`border-t-2 border-border font-semibold bg-muted/40`,children:[(0,y.jsx)(`td`,{className:`p-2`,children:`Total`}),g.map(e=>(0,y.jsx)(`td`,{className:`text-right p-2 tabular-nums`,children:S(b[e]??0)},e)),u&&(0,y.jsx)(`td`,{className:`text-right p-2 tabular-nums font-bold`,children:S(x)})]})})]})]})},Tt=({schema:e,dataSource:a,className:o})=>{let s=(0,i.useContext)(n.SchemaRendererContext),c=a||s?.dataSource,l=(0,n.useDataScope)(e.bind),[u,d]=(0,i.useState)([]),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!l&&(!e.data||e.data.length===0)&&(async()=>{if(!(!c||!e.objectName)){n&&(p(!0),h(null));try{let r;if(typeof c.find==`function`)r=(0,t.extractRecords)(await c.find(e.objectName,{$filter:e.filter}));else return;n&&d(r)}catch(e){console.error(`[ObjectPivotTable] Fetch error:`,e),n&&h(e instanceof Error?e.message:`Failed to load data`)}finally{n&&p(!1)}}})(),()=>{n=!1}},[e.objectName,c,l,e.data,e.filter]);let g=l||e.data||u,_=Array.isArray(g)?g:[];return f&&_.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`pivot-loading`,children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-6 w-24`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-20`})]}),[1,2,3].map(e=>(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-5 w-24`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-20`})]},e))]})]}):m?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`pivot-error`,children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`pivot-error-message`,children:[(0,y.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-60`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,y.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,y.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:m})]})]}):!c&&e.objectName&&_.length===0?(0,y.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,o),children:[e.title&&(0,y.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,y.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,y.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})]}):(0,y.jsx)(wt,{schema:{...e,data:_},className:o})};function Et(e){return e.map(e=>typeof e==`string`?{header:e.replace(/_/g,` `).replace(/([A-Z])/g,` $1`).trim().replace(/\b\w/g,e=>e.toUpperCase()),accessorKey:e}:e)}var Dt=({schema:e,dataSource:a,className:o})=>{let s=(0,i.useContext)(n.SchemaRendererContext),c=a||s?.dataSource,l=(0,n.useDataScope)(e.bind),[u,d]=(0,i.useState)([]),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!l&&(!e.data||e.data.length===0)&&(async()=>{if(!(!c||!e.objectName)){n&&(p(!0),h(null));try{let r;if(typeof c.find==`function`)r=(0,t.extractRecords)(await c.find(e.objectName,{$filter:e.filter}));else return;n&&d(r)}catch(e){console.error(`[ObjectDataTable] Fetch error:`,e),n&&h(e instanceof Error?e.message:`Failed to load data`)}finally{n&&p(!1)}}})(),()=>{n=!1}},[e.objectName,c,l,e.data,e.filter]);let g=l||e.data||u,_=Array.isArray(g)?g:[],v=(0,i.useMemo)(()=>e.columns&&e.columns.length>0?Et(e.columns):_.length===0?[]:Object.keys(_[0]).filter(e=>!e.startsWith(`_`)).map(e=>({header:e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g,` $1`),accessorKey:e})),[e.columns,_]);return f&&_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-loading`,children:(0,y.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-6 w-1/4`})]}),[1,2,3,4].map(e=>(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,y.jsx)(r.Skeleton,{className:`h-5 w-1/4`})]},e))]})}):m?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-error`,children:(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`table-error-message`,children:[(0,y.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-60`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,y.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,y.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:m})]})}):!c&&e.objectName&&_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),children:(0,y.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,y.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})}):_.length===0?(0,y.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,o),"data-testid":`table-empty-state`,children:(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:[(0,y.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-40`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,y.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,y.jsx)(`line`,{x1:`3`,y1:`9`,x2:`21`,y2:`9`}),(0,y.jsx)(`line`,{x1:`9`,y1:`21`,x2:`9`,y2:`9`})]}),(0,y.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})}):(0,y.jsx)(n.SchemaRenderer,{schema:{...e,type:`data-table`,data:_,columns:v},className:o})},Ot={breadcrumb:[`Dashboard`,`Configuration`],sections:[{key:`layout`,title:`Layout`,fields:[{key:`columns`,label:`Columns`,type:`slider`,defaultValue:3,min:1,max:12,step:1},{key:`gap`,label:`Gap`,type:`slider`,defaultValue:4,min:0,max:16,step:1},{key:`rowHeight`,label:`Row height`,type:`input`,defaultValue:`120`,placeholder:`e.g. 120`}]},{key:`data`,title:`Data`,collapsible:!0,fields:[{key:`refreshInterval`,label:`Refresh interval`,type:`select`,defaultValue:`0`,options:[{value:`0`,label:`Manual`},{value:`30`,label:`30s`},{value:`60`,label:`1 min`},{value:`300`,label:`5 min`}]}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Dashboard title`},{key:`showDescription`,label:`Show description`,type:`switch`,defaultValue:!0},{key:`theme`,label:`Theme`,type:`select`,defaultValue:`auto`,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`auto`,label:`Auto`}]}]}]};function kt({open:e,onClose:t,config:n,onSave:i,onFieldChange:a}){let{draft:o,isDirty:s,updateField:c,discard:l}=(0,r.useConfigDraft)(n,{onUpdate:a});return(0,y.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:Ot,draft:o,isDirty:s,onFieldChange:c,onSave:()=>i(o),onDiscard:l})}var At=[{value:`metric`,label:`Metric`},{value:`bar`,label:`Bar Chart`},{value:`line`,label:`Line Chart`},{value:`pie`,label:`Pie Chart`},{value:`donut`,label:`Donut Chart`},{value:`area`,label:`Area Chart`},{value:`scatter`,label:`Scatter Plot`},{value:`table`,label:`Table`},{value:`pivot`,label:`Pivot Table`},{value:`list`,label:`List`},{value:`custom`,label:`Custom`}],jt=[{value:`default`,label:`Default`},{value:`blue`,label:`Blue`},{value:`teal`,label:`Teal`},{value:`orange`,label:`Orange`},{value:`purple`,label:`Purple`},{value:`success`,label:`Success`},{value:`warning`,label:`Warning`},{value:`danger`,label:`Danger`}],Mt=[{value:`count`,label:`Count`},{value:`sum`,label:`Sum`},{value:`avg`,label:`Average`},{value:`min`,label:`Min`},{value:`max`,label:`Max`}],Nt=[`bar`,`line`,`area`,`pie`,`donut`,`scatter`];function Pt(e){return!!e&&Nt.includes(e)}var Ft=[{value:`group`,label:`Group`},{value:`value`,label:`Value`}],It=[{value:`asc`,label:`↑`},{value:`desc`,label:`↓`}];function Lt(e,t,n,i){return{key:e,label:t,type:`custom`,render:(a,o,s)=>(0,y.jsx)(r.ConfigRow,{label:t,children:(0,y.jsx)(`div`,{"data-testid":`config-field-${e}`,children:(0,y.jsx)(r.Combobox,{options:i??[],value:a??``,onValueChange:o,placeholder:n,searchPlaceholder:`Search fields…`,emptyText:`No fields found.`,className:`h-7 w-32 text-xs`,disabled:!s.object})})})}}function Rt(e,t,n){let i=e&&e.length>0,a=i?{key:`object`,label:`Data source`,type:`custom`,render:(t,n)=>(0,y.jsx)(r.ConfigRow,{label:`Data source`,children:(0,y.jsx)(`div`,{"data-testid":`config-field-object`,children:(0,y.jsx)(r.Combobox,{options:e,value:t??``,onValueChange:n,placeholder:`Select object…`,searchPlaceholder:`Search objects…`,emptyText:`No objects found.`,className:`h-7 w-32 text-xs`})})})}:{key:`object`,label:`Data source`,type:`input`,placeholder:`Object name`},o=i?Lt(`categoryField`,`Category field`,`Select field…`,t):{key:`categoryField`,label:`Category field`,type:`input`,placeholder:`e.g. status`},s=i?Lt(`valueField`,`Value field`,`Select field…`,t):{key:`valueField`,label:`Value field`,type:`input`,placeholder:`e.g. amount`},c=i?Lt(`rowField`,`Field`,`Select row field…`,t):{key:`rowField`,label:`Field`,type:`input`,placeholder:`e.g. owner`},l=i?Lt(`columnField`,`Field`,`Select column field…`,t):{key:`columnField`,label:`Field`,type:`input`,placeholder:`e.g. stage`},u=i?Lt(`pivotValueField`,`Field`,`Select value field…`,t):{key:`pivotValueField`,label:`Field`,type:`input`,placeholder:`e.g. amount`};return{breadcrumb:[`Dashboard`,{pivot:`Pivot table`,table:`Table`}[n??``]??(Pt(n)?`Chart`:`Widget`)],sections:[{key:`general`,title:`General`,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Widget title`},{key:`description`,label:`Description`,type:`input`,placeholder:`Widget description`},{key:`type`,label:`Widget type`,type:`select`,options:At,defaultValue:`metric`}]},{key:`data`,title:`Data Binding`,collapsible:!0,visibleWhen:e=>e.type!==`pivot`,fields:[a,o,s,{key:`aggregate`,label:`Aggregation`,type:`select`,options:Mt,defaultValue:`count`}]},{key:`pivot-data`,title:`Data`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[a]},{key:`pivot-rows`,title:`Rows`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[c,{key:`rowSortBy`,label:`Sort by`,type:`icon-group`,options:Ft,defaultValue:`group`},{key:`rowSortOrder`,label:`Sort order`,type:`icon-group`,options:It,defaultValue:`asc`},{key:`showRowLabels`,label:`Show label`,type:`switch`,defaultValue:!0},{key:`showRowTotals`,label:`Show totals`,type:`switch`,defaultValue:!1}]},{key:`pivot-columns`,title:`Columns`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[l,{key:`columnSortBy`,label:`Sort by`,type:`icon-group`,options:Ft,defaultValue:`group`},{key:`columnSortOrder`,label:`Sort order`,type:`icon-group`,options:It,defaultValue:`asc`},{key:`showColumnLabels`,label:`Show label`,type:`switch`,defaultValue:!0},{key:`showColumnTotals`,label:`Show totals`,type:`switch`,defaultValue:!1}]},{key:`pivot-values`,title:`Values`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[u,{key:`aggregation`,label:`Aggregation`,type:`select`,options:Mt,defaultValue:`sum`},{key:`format`,label:`Number format`,type:`input`,placeholder:`e.g. $,.2f`}]},{key:`chart-axis`,title:`Axis & Series`,collapsible:!0,visibleWhen:e=>Pt(e.type),fields:[{key:`xAxisLabel`,label:`X-axis label`,type:`input`,placeholder:`e.g. Month`},{key:`yAxisLabel`,label:`Y-axis label`,type:`input`,placeholder:`e.g. Revenue`},{key:`showLegend`,label:`Show legend`,type:`switch`,defaultValue:!0}]},{key:`table-columns`,title:`Columns`,collapsible:!0,visibleWhen:e=>e.type===`table`,fields:[{key:`searchable`,label:`Searchable`,type:`switch`,defaultValue:!1},{key:`pagination`,label:`Pagination`,type:`switch`,defaultValue:!1}]},{key:`layout`,title:`Layout`,collapsible:!0,fields:[{key:`layoutW`,label:`Width (columns)`,type:`slider`,min:1,max:12,step:1,defaultValue:1},{key:`layoutH`,label:`Height (rows)`,type:`slider`,min:1,max:6,step:1,defaultValue:1}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`colorVariant`,label:`Color variant`,type:`select`,options:jt,defaultValue:`default`},{key:`actionUrl`,label:`Action URL`,type:`input`,placeholder:`https://...`}]}]}}function zt(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`object`){let t=e;return t.defaultValue||t.key||``}return String(e)}function Bt({open:e,onClose:t,config:n,onSave:a,onFieldChange:o,headerExtra:s,availableObjects:c,availableFields:l}){let{draft:u,isDirty:d,updateField:f,discard:p}=(0,r.useConfigDraft)(i.useMemo(()=>({...n,title:typeof n.title==`object`?zt(n.title):n.title,description:typeof n.description==`object`?zt(n.description):n.description}),[n]),{onUpdate:o});return(0,y.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:i.useMemo(()=>Rt(c,l,u.type),[c,l,u.type]),draft:u,isDirty:d,onFieldChange:f,onSave:()=>a(u),onDiscard:p,headerExtra:s})}function Vt({schema:e,config:t,onConfigSave:n,onWidgetSave:o,onRefresh:s,recordCount:c,defaultConfigOpen:l=!1,className:u}){let[d,f]=(0,i.useState)(l),[p,m]=(0,i.useState)(null),[h,g]=(0,i.useState)(e),[_,v]=(0,i.useState)(0);(0,i.useEffect)(()=>{g(e),v(e=>e+1)},[e]);let b=i.useMemo(()=>{if(!p||!h.widgets)return null;let e=h.widgets.find(e=>(e.id||e.title)===p);return e?{id:e.id??``,title:e.title??``,description:e.description??``,type:e.type??``,object:e.object??``,categoryField:e.categoryField??``,valueField:e.valueField??``,aggregate:e.aggregate??``,colorVariant:e.colorVariant??`default`,actionUrl:e.actionUrl??``,layoutW:e.layout?.w??1,layoutH:e.layout?.h??1}:null},[p,_]),x=(0,i.useCallback)(e=>{m(e),f(!0)},[]),C=(0,i.useCallback)(()=>{m(null)},[]),w=(0,i.useCallback)((e,t)=>{p&&g(n=>n.widgets?{...n,widgets:n.widgets.map(n=>(n.id||n.title)===p?e===`layoutW`?{...n,layout:{...n.layout||{},w:t}}:e===`layoutH`?{...n,layout:{...n.layout||{},h:t}}:{...n,[e]:t}:n)}:n)},[p]),T=(0,i.useCallback)(e=>{p&&o&&o(p,e),m(null),v(e=>e+1)},[p,o]),E=(0,i.useCallback)(()=>{f(e=>!e),m(null)},[]);return(0,y.jsxs)(`div`,{className:(0,r.cn)(`flex h-full w-full`,u),"data-testid":`dashboard-with-config`,children:[(0,y.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto relative`,children:[(0,y.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,y.jsxs)(r.Button,{size:`sm`,variant:d?`default`:`outline`,onClick:E,"data-testid":`dashboard-config-toggle`,children:[(0,y.jsx)(a.Settings,{className:`h-3.5 w-3.5 mr-1`}),`Settings`]})}),(0,y.jsx)(S,{schema:h,onRefresh:s,recordCount:c,designMode:d,selectedWidgetId:p,onWidgetClick:x})]}),d&&(0,y.jsx)(`div`,{className:`relative shrink-0`,children:p&&b?(0,y.jsx)(Bt,{open:!0,onClose:C,config:b,onSave:T,onFieldChange:w}):(0,y.jsx)(kt,{open:!0,onClose:()=>f(!1),config:t,onSave:n})})]})}t.ComponentRegistry.register(`dashboard`,S,{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:[]}}),t.ComponentRegistry.register(`metric`,yt,{namespace:`plugin-dashboard`,label:`Metric Widget`,category:`Dashboard`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`}]}),t.ComponentRegistry.register(`metric-card`,xt,{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`}}),t.ComponentRegistry.register(`pivot`,wt,{namespace:`plugin-dashboard`,label:`Pivot Table`,category:`Dashboard`,icon:`table-2`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`rowField`,type:`string`,label:`Row Field`,required:!0},{name:`columnField`,type:`string`,label:`Column Field`,required:!0},{name:`valueField`,type:`string`,label:`Value Field`,required:!0},{name:`aggregation`,type:`enum`,label:`Aggregation`,enum:[{label:`Sum`,value:`sum`},{label:`Count`,value:`count`},{label:`Average`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{name:`showRowTotals`,type:`boolean`,label:`Show Row Totals`},{name:`showColumnTotals`,type:`boolean`,label:`Show Column Totals`},{name:`format`,type:`string`,label:`Number Format`}],defaultProps:{rowField:``,columnField:``,valueField:``,aggregation:`sum`,data:[]}}),t.ComponentRegistry.register(`object-pivot`,Tt,{namespace:`plugin-dashboard`,label:`Object Pivot Table`,category:`Dashboard`,icon:`table-2`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`title`,type:`string`,label:`Title`},{name:`rowField`,type:`string`,label:`Row Field`,required:!0},{name:`columnField`,type:`string`,label:`Column Field`,required:!0},{name:`valueField`,type:`string`,label:`Value Field`,required:!0},{name:`aggregation`,type:`enum`,label:`Aggregation`,enum:[{label:`Sum`,value:`sum`},{label:`Count`,value:`count`},{label:`Average`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{name:`showRowTotals`,type:`boolean`,label:`Show Row Totals`},{name:`showColumnTotals`,type:`boolean`,label:`Show Column Totals`},{name:`filter`,type:`array`,label:`Filter`},{name:`format`,type:`string`,label:`Number Format`}],defaultProps:{rowField:``,columnField:``,valueField:``,aggregation:`sum`}}),t.ComponentRegistry.register(`dashboard-grid`,_t,{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`}}),t.ComponentRegistry.register(`object-data-table`,Dt,{namespace:`plugin-dashboard`,label:`Object Data Table`,category:`Dashboard`,icon:`table`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`columns`,type:`array`,label:`Columns`},{name:`filter`,type:`array`,label:`Filter`},{name:`searchable`,type:`boolean`,label:`Searchable`},{name:`pagination`,type:`boolean`,label:`Pagination`}],defaultProps:{searchable:!1,pagination:!1}});var Ht={DashboardRenderer:S,DashboardGridLayout:_t,MetricWidget:yt,MetricCard:xt,PivotTable:wt,ObjectPivotTable:Tt,ObjectDataTable:Dt,DashboardConfigPanel:kt,WidgetConfigPanel:Bt,DashboardWithConfig:Vt};e.DashboardConfigPanel=kt,e.DashboardGridLayout=_t,e.DashboardRenderer=S,e.DashboardWithConfig=Vt,e.MetricCard=xt,e.MetricWidget=yt,e.ObjectDataTable=Dt,e.ObjectPivotTable=Tt,e.PivotTable=wt,e.WidgetConfigPanel=Bt,e.dashboardComponents=Ht});
|