@object-ui/plugin-kanban 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +20 -0
- package/dist/{KanbanEnhanced-BMreTWOT.js → KanbanEnhanced-BPIKjTDv.js} +7 -7
- package/dist/KanbanImpl-BfOKAnJS.js +194 -0
- package/dist/{index-a4_RI-v7.js → index-CWGTi2xn.js} +241 -220
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +4 -4
- package/dist/{sortable.esm-ZHwgFQIO.js → sortable.esm-CNNHgHk5.js} +1 -0
- package/dist/src/KanbanImpl.d.ts +2 -1
- package/dist/src/KanbanImpl.d.ts.map +1 -1
- package/dist/src/ObjectKanban.EdgeCases.stories.d.ts +26 -0
- package/dist/src/ObjectKanban.EdgeCases.stories.d.ts.map +1 -0
- package/dist/src/ObjectKanban.d.ts +2 -0
- package/dist/src/ObjectKanban.d.ts.map +1 -1
- package/dist/src/ObjectKanban.stories.d.ts +24 -0
- package/dist/src/ObjectKanban.stories.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/KanbanImpl.tsx +82 -20
- package/src/ObjectKanban.EdgeCases.stories.tsx +168 -0
- package/src/ObjectKanban.stories.tsx +152 -0
- package/src/ObjectKanban.tsx +43 -2
- package/src/__tests__/KanbanEnhanced.test.tsx +1 -0
- package/src/__tests__/accessibility.test.tsx +296 -0
- package/src/__tests__/dnd-undo-integration.test.tsx +525 -0
- package/src/__tests__/performance-benchmark.test.tsx +306 -0
- package/src/__tests__/view-states.test.tsx +403 -0
- package/src/index.tsx +2 -0
- package/dist/KanbanImpl--kTNN_B8.js +0 -144
package/dist/index.js
CHANGED
package/dist/index.umd.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(function(G,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react"),require("@object-ui/core"),require("@object-ui/react"),require("@object-ui/components"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@object-ui/core","@object-ui/react","@object-ui/components","react-dom"],c):(G=typeof globalThis<"u"?globalThis:G||self,c(G.ObjectUIPluginKanban={},G.React,G.ObjectUICore,G.ObjectUIReact,G.ObjectUIComponents,G.ReactDOM))})(this,(function(G,c,
|
|
1
|
+
(function(G,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react"),require("@object-ui/core"),require("@object-ui/react"),require("@object-ui/components"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@object-ui/core","@object-ui/react","@object-ui/components","react-dom"],c):(G=typeof globalThis<"u"?globalThis:G||self,c(G.ObjectUIPluginKanban={},G.React,G.ObjectUICore,G.ObjectUIReact,G.ObjectUIComponents,G.ReactDOM))})(this,(function(G,c,Ze,Re,$,Se){"use strict";function rr(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const B=rr(c);var Qe={exports:{}},ze={};var Wt;function sr(){if(Wt)return ze;Wt=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(r,s,i){var a=null;if(i!==void 0&&(a=""+i),s.key!==void 0&&(a=""+s.key),"key"in s){i={};for(var o in s)o!=="key"&&(i[o]=s[o])}else i=s;return s=i.ref,{$$typeof:e,type:r,key:a,ref:s!==void 0?s:null,props:i}}return ze.Fragment=n,ze.jsx=t,ze.jsxs=t,ze}var Le={};var Vt;function ir(){return Vt||(Vt=1,process.env.NODE_ENV!=="production"&&(function(){function e(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===j?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case y:return"Fragment";case v:return"Profiler";case D:return"StrictMode";case E:return"Suspense";case x:return"SuspenseList";case M:return"Activity"}if(typeof h=="object")switch(typeof h.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),h.$$typeof){case w:return"Portal";case S:return h.displayName||"Context";case C:return(h._context.displayName||"Context")+".Consumer";case b:var T=h.render;return h=h.displayName,h||(h=T.displayName||T.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case O:return T=h.displayName||null,T!==null?T:e(h.type)||"Memo";case A:T=h._payload,h=h._init;try{return e(h(T))}catch{}}return null}function n(h){return""+h}function t(h){try{n(h);var T=!1}catch{T=!0}if(T){T=console;var I=T.error,z=typeof Symbol=="function"&&Symbol.toStringTag&&h[Symbol.toStringTag]||h.constructor.name||"Object";return I.call(T,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",z),n(h)}}function r(h){if(h===y)return"<>";if(typeof h=="object"&&h!==null&&h.$$typeof===A)return"<...>";try{var T=e(h);return T?"<"+T+">":"<...>"}catch{return"<...>"}}function s(){var h=L.A;return h===null?null:h.getOwner()}function i(){return Error("react-stack-top-frame")}function a(h){if(R.call(h,"key")){var T=Object.getOwnPropertyDescriptor(h,"key").get;if(T&&T.isReactWarning)return!1}return h.key!==void 0}function o(h,T){function I(){Z||(Z=!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))}I.isReactWarning=!0,Object.defineProperty(h,"key",{get:I,configurable:!0})}function l(){var h=e(this.type);return Y[h]||(Y[h]=!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.")),h=this.props.ref,h!==void 0?h:null}function u(h,T,I,z,le,U){var F=I.ref;return h={$$typeof:N,type:h,key:T,props:I,_owner:z},(F!==void 0?F:null)!==null?Object.defineProperty(h,"ref",{enumerable:!1,get:l}):Object.defineProperty(h,"ref",{enumerable:!1,value:null}),h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(h,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(h,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.defineProperty(h,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h}function d(h,T,I,z,le,U){var F=T.children;if(F!==void 0)if(z)if(P(F)){for(z=0;z<F.length;z++)f(F[z]);Object.freeze&&Object.freeze(F)}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(F);if(R.call(T,"key")){F=e(h);var J=Object.keys(T).filter(function(_){return _!=="key"});z=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",me[F+z]||(J=0<J.length?"{"+J.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} />`,R,L,J,L),me[L+R]=!0)}if(L=null,j!==void 0&&(t(j),L=""+j),i(D)&&(t(D.key),L=""+D.key),"key"in D){j={};for(var Q in D)Q!=="key"&&(j[Q]=D[Q])}else j=D;return L&&a(j,typeof h=="function"?h.displayName||h.name||"Unknown":h),u(h,L,j,s(),le,U)}function f(h){g(h)?h._store&&(h._store.validated=1):typeof h=="object"&&h!==null&&h.$$typeof===A&&(h._payload.status==="fulfilled"?g(h._payload.value)&&h._payload.value._store&&(h._payload.value._store.validated=1):h._store&&(h._store.validated=1))}function g(h){return typeof h=="object"&&h!==null&&h.$$typeof===C}var p=c,C=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),S=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),M=Symbol.for("react.client.reference"),z=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=Object.prototype.hasOwnProperty,V=Array.isArray,H=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(h){return h()}};var Z,K={},Ce=p.react_stack_bottom_frame.bind(p,o)(),se=H(r(o)),me={};ze.Fragment=x,ze.jsx=function(h,D,j){var R=1e4>z.recentlyCreatedOwnerStacks++;return d(h,D,j,!1,R?Error("react-stack-top-frame"):Ce,R?H(r(h)):se)},ze.jsxs=function(h,D,j){var R=1e4>z.recentlyCreatedOwnerStacks++;return d(h,D,j,!0,R?Error("react-stack-top-frame"):Ce,R?H(r(h)):se)}})()),ze}var Vt;function sr(){return Vt||(Vt=1,process.env.NODE_ENV==="production"?Ze.exports=nr():Ze.exports=rr()),Ze.exports}var w=sr();const yt=({schema:e,dataSource:n,className:t,...r})=>{const[s,o]=c.useState([]),[i,a]=c.useState(null),[l,u]=c.useState(!1),[d,f]=c.useState(null),g=Bt.useDataScope(e.bind);c.useEffect(()=>{let y=!0;return(async()=>{if(!(!n||!e.objectName))try{const m=await n.getObjectSchema(e.objectName);y&&a(m)}catch(m){console.warn("Failed to fetch object def",m)}})(),()=>{y=!1}},[e.objectName,n]),c.useEffect(()=>{let y=!0;const v=async()=>{if(!(!n||!e.objectName)){y&&u(!0);try{const m=await n.find(e.objectName,{options:{$top:100},$filter:e.filter});let S=[];Array.isArray(m)?S=m:m&&typeof m=="object"&&(Array.isArray(m.value)?S=m.value:Array.isArray(m.data)&&(S=m.data)),console.log(`[ObjectKanban] Extracted data (length: ${S.length})`),y&&o(S)}catch(m){console.error("[ObjectKanban] Fetch error:",m),y&&f(m)}finally{y&&u(!1)}}};return e.objectName&&!g&&!e.data&&!r.data&&v(),()=>{y=!1}},[e.objectName,n,g,e.data,e.filter,r.data]);const p=r.data||g||e.data||s,C=c.useMemo(()=>{if(!Array.isArray(p))return[];let y=e.cardTitle||e.titleField;if(!y&&i){if(i.titleFormat){const m=/\{(.+?)\}/.exec(i.titleFormat);m&&(y=m[1])}!y&&i.NAME_FIELD_KEY&&(y=i.NAME_FIELD_KEY)}const v=y||"name";return p.map(m=>({...m,id:m.id||m._id,title:m[v]||m.title||"Untitled"}))},[p,e,i]),b=c.useMemo(()=>{if(e.columns&&e.columns.length>0)if(typeof e.columns[0]=="string"){if(!e.groupBy)return e.columns.map(y=>({id:y,title:y}))}else return e.columns;if(e.groupBy&&i?.fields?.[e.groupBy]?.options)return i.fields[e.groupBy].options.map(y=>({id:y.value,title:y.label}));if(e.groupBy&&C.length>0){const y=new Set(C.map(v=>v[e.groupBy]));return Array.from(y).map(v=>({id:String(v),title:String(v)}))}return[]},[e.columns,e.groupBy,C,i]),x={...e,data:C,columns:b,className:t||e.className};return d?w.jsxs("div",{className:"p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive",children:["Error loading kanban data: ",d.message]}):w.jsx(Qe,{schema:x})},or=c.lazy(()=>Promise.resolve().then(()=>Xs)),Yt=c.lazy(()=>Promise.resolve().then(()=>bo)),Qe=({schema:e})=>{const n=c.useMemo(()=>{const{columns:t=[],data:r,groupBy:s}=e;if(r&&s&&Array.isArray(r)){const o={};t.forEach(a=>{a.id&&(o[String(a.id).toLowerCase()]=a.id),a.title&&(o[String(a.title).toLowerCase()]=a.id)});const i=r.reduce((a,l)=>{const u=String(l[s]??""),d=o[u.toLowerCase()]??u;return a[d]||(a[d]=[]),a[d].push(l),a},{});return t.map(a=>({...a,cards:[...a.cards||[],...i[a.id]||[]]}))}return t},[e]);return w.jsx(c.Suspense,{fallback:w.jsx(B.Skeleton,{className:"w-full h-[600px]"}),children:w.jsx(or,{columns:n,onCardMove:e.onCardMove,className:e.className})})};Ge.ComponentRegistry.register("kanban-ui",Qe,{namespace:"plugin-kanban",label:"Kanban Board",icon:"LayoutDashboard",category:"plugin",inputs:[{name:"columns",type:"array",label:"Columns",description:"Array of { id, title, cards, limit, className }",required:!0},{name:"onCardMove",type:"code",label:"On Card Move",description:"Callback when a card is moved",advanced:!0},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:[{id:"todo",title:"To Do",cards:[{id:"card-1",title:"Task 1",description:"This is the first task",badges:[{label:"High Priority",variant:"destructive"},{label:"Feature",variant:"default"}]},{id:"card-2",title:"Task 2",description:"This is the second task",badges:[{label:"Bug",variant:"destructive"}]}]},{id:"in-progress",title:"In Progress",limit:3,cards:[{id:"card-3",title:"Task 3",description:"Currently working on this",badges:[{label:"In Progress",variant:"default"}]}]},{id:"done",title:"Done",cards:[{id:"card-4",title:"Task 4",description:"This task is completed",badges:[{label:"Completed",variant:"outline"}]},{id:"card-5",title:"Task 5",description:"Another completed task",badges:[{label:"Completed",variant:"outline"}]}]}],className:"w-full"}});const ir={kanban:Qe,"kanban-enhanced":Yt,"object-kanban":yt};Ge.ComponentRegistry.register("kanban-enhanced",({schema:e})=>{const n=c.useMemo(()=>{const{columns:t=[],data:r,groupBy:s}=e;if(r&&s&&Array.isArray(r)){const o=r.reduce((i,a)=>{const l=a[s];return i[l]||(i[l]=[]),i[l].push(a),i},{});return t.map(i=>({...i,cards:[...i.cards||[],...o[i.id]||[]]}))}return t},[e]);return w.jsx(c.Suspense,{fallback:w.jsx(B.Skeleton,{className:"w-full h-[600px]"}),children:w.jsx(Yt,{columns:n,onCardMove:e.onCardMove,onColumnToggle:e.onColumnToggle,enableVirtualScrolling:e.enableVirtualScrolling,virtualScrollThreshold:e.virtualScrollThreshold,className:e.className})})},{namespace:"plugin-kanban",label:"Kanban Board (Enhanced)",icon:"LayoutGrid",category:"plugin",inputs:[{name:"columns",type:"array",label:"Columns",required:!0},{name:"enableVirtualScrolling",type:"boolean",label:"Virtual Scrolling",defaultValue:!1},{name:"virtualScrollThreshold",type:"number",label:"Virtual Scroll Threshold",defaultValue:50},{name:"onCardMove",type:"code",label:"On Card Move",advanced:!0},{name:"onColumnToggle",type:"code",label:"On Column Toggle",advanced:!0},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:[],enableVirtualScrolling:!1,virtualScrollThreshold:50,className:"w-full"}});const xt=({schema:e,...n})=>{const{dataSource:t}=Bt.useSchemaContext()||{};return w.jsx(yt,{schema:e,dataSource:t,...n})};Ge.ComponentRegistry.register("object-kanban",xt,{namespace:"plugin-kanban",label:"Object Kanban",category:"view",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"}]}),Ge.ComponentRegistry.register("kanban",xt,{namespace:"view",label:"Kanban Board",category:"view",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"}]});function ar(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return c.useMemo(()=>r=>{n.forEach(s=>s(r))},n)}const et=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ee(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function wt(e){return"nodeType"in e}function X(e){var n,t;return e?Ee(e)?e:wt(e)&&(n=(t=e.ownerDocument)==null?void 0:t.defaultView)!=null?n:window:window}function Ct(e){const{Document:n}=X(e);return e instanceof n}function Le(e){return Ee(e)?!1:e instanceof X(e).HTMLElement}function Kt(e){return e instanceof X(e).SVGElement}function De(e){return e?Ee(e)?e.document:wt(e)?Ct(e)?e:Le(e)||Kt(e)?e.ownerDocument:document:document:document}const ie=et?c.useLayoutEffect:c.useEffect;function tt(e){const n=c.useRef(e);return ie(()=>{n.current=e}),c.useCallback(function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return n.current==null?void 0:n.current(...r)},[])}function lr(){const e=c.useRef(null),n=c.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),t=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,t]}function Pe(e,n){n===void 0&&(n=[e]);const t=c.useRef(e);return ie(()=>{t.current!==e&&(t.current=e)},n),t}function Fe(e,n){const t=c.useRef();return c.useMemo(()=>{const r=e(t.current);return t.current=r,r},[...n])}function nt(e){const n=tt(e),t=c.useRef(null),r=c.useCallback(s=>{s!==t.current&&n?.(s,t.current),t.current=s},[]);return[t,r]}function rt(e){const n=c.useRef();return c.useEffect(()=>{n.current=e},[e]),n.current}let St={};function Be(e,n){return c.useMemo(()=>{if(n)return n;const t=St[e]==null?0:St[e]+1;return St[e]=t,e+"-"+t},[e,n])}function Ut(e){return function(n){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return r.reduce((o,i)=>{const a=Object.entries(i);for(const[l,u]of a){const d=o[l];d!=null&&(o[l]=d+e*u)}return o},{...n})}}const Oe=Ut(1),st=Ut(-1);function cr(e){return"clientX"in e&&"clientY"in e}function ot(e){if(!e)return!1;const{KeyboardEvent:n}=X(e.target);return n&&e instanceof n}function ur(e){if(!e)return!1;const{TouchEvent:n}=X(e.target);return n&&e instanceof n}function it(e){if(ur(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:t}=e.touches[0];return{x:n,y:t}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:t}=e.changedTouches[0];return{x:n,y:t}}}return cr(e)?{x:e.clientX,y:e.clientY}:null}const fe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:t}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:t}=e;return"scaleX("+n+") scaleY("+t+")"}},Transform:{toString(e){if(e)return[fe.Translate.toString(e),fe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:t,easing:r}=e;return n+" "+t+"ms "+r}}}),qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function dr(e){return e.matches(qt)?e:e.querySelector(qt)}const fr={display:"none"};function hr(e){let{id:n,value:t}=e;return c.createElement("div",{id:n,style:fr},t)}function gr(e){let{id:n,announcement:t,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return c.createElement("div",{id:n,style:s,role:"status","aria-live":r,"aria-atomic":!0},t)}function pr(){const[e,n]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&n(r)},[]),announcement:e}}const Xt=c.createContext(null);function mr(e){const n=c.useContext(Xt);c.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function vr(){const[e]=c.useState(()=>new Set),n=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),n]}const br={draggable:`
|
|
6
|
+
<%s key={someKey} {...props} />`,z,F,J,F),me[F+z]=!0)}if(F=null,I!==void 0&&(t(I),F=""+I),a(T)&&(t(T.key),F=""+T.key),"key"in T){I={};for(var Q in T)Q!=="key"&&(I[Q]=T[Q])}else I=T;return F&&o(I,typeof h=="function"?h.displayName||h.name||"Unknown":h),u(h,F,I,s(),le,U)}function f(h){g(h)?h._store&&(h._store.validated=1):typeof h=="object"&&h!==null&&h.$$typeof===A&&(h._payload.status==="fulfilled"?g(h._payload.value)&&h._payload.value._store&&(h._payload.value._store.validated=1):h._store&&(h._store.validated=1))}function g(h){return typeof h=="object"&&h!==null&&h.$$typeof===N}var p=c,N=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),S=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),j=Symbol.for("react.client.reference"),L=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=Object.prototype.hasOwnProperty,P=Array.isArray,H=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(h){return h()}};var Z,Y={},Ce=p.react_stack_bottom_frame.bind(p,i)(),se=H(r(i)),me={};Le.Fragment=y,Le.jsx=function(h,T,I){var z=1e4>L.recentlyCreatedOwnerStacks++;return d(h,T,I,!1,z?Error("react-stack-top-frame"):Ce,z?H(r(h)):se)},Le.jsxs=function(h,T,I){var z=1e4>L.recentlyCreatedOwnerStacks++;return d(h,T,I,!0,z?Error("react-stack-top-frame"):Ce,z?H(r(h)):se)}})()),Le}var Kt;function or(){return Kt||(Kt=1,process.env.NODE_ENV==="production"?Qe.exports=sr():Qe.exports=ir()),Qe.exports}var m=or();const xt=({schema:e,dataSource:n,className:t,onRowClick:r,onCardClick:s,...i})=>{const[a,o]=c.useState([]),[l,u]=c.useState(null),[d,f]=c.useState(!1),[g,p]=c.useState(null),N=Re.useDataScope(e.bind);c.useEffect(()=>{let b=!0;return(async()=>{if(!(!n||!e.objectName))try{const x=await n.getObjectSchema(e.objectName);b&&u(x)}catch(x){console.warn("Failed to fetch object def",x)}})(),()=>{b=!1}},[e.objectName,n]),c.useEffect(()=>{let b=!0;const E=async()=>{if(!(!n||!e.objectName)){b&&f(!0);try{const x=await n.find(e.objectName,{options:{$top:100},$filter:e.filter});let O=[];Array.isArray(x)?O=x:x&&typeof x=="object"&&(Array.isArray(x.value)?O=x.value:Array.isArray(x.data)&&(O=x.data)),console.log(`[ObjectKanban] Extracted data (length: ${O.length})`),b&&o(O)}catch(x){console.error("[ObjectKanban] Fetch error:",x),b&&p(x)}finally{b&&f(!1)}}};return e.objectName&&!N&&!e.data&&!i.data&&E(),()=>{b=!1}},[e.objectName,n,N,e.data,e.filter,i.data]);const w=i.data||N||e.data||a,y=c.useMemo(()=>{if(!Array.isArray(w))return[];let b=e.cardTitle||e.titleField;if(!b&&l){if(l.titleFormat){const x=/\{(.+?)\}/.exec(l.titleFormat);x&&(b=x[1])}!b&&l.NAME_FIELD_KEY&&(b=l.NAME_FIELD_KEY)}const E=b||"name";return w.map(x=>({...x,id:x.id||x._id,title:x[E]||x.title||"Untitled"}))},[w,e,l]),D=c.useMemo(()=>{if(e.columns&&e.columns.length>0)if(typeof e.columns[0]=="string"){if(!e.groupBy)return e.columns.map(b=>({id:b,title:b}))}else return e.columns;if(e.groupBy&&l?.fields?.[e.groupBy]?.options)return l.fields[e.groupBy].options.map(b=>({id:b.value,title:b.label}));if(e.groupBy&&y.length>0){const b=new Set(y.map(E=>E[e.groupBy]));return Array.from(b).map(E=>({id:String(E),title:String(E)}))}return[]},[e.columns,e.groupBy,y,l]),v={...e,data:y,columns:D,className:t||e.className},C=Re.useNavigationOverlay({navigation:e.navigation,objectName:e.objectName,onRowClick:r??s});if(g)return m.jsxs("div",{className:"p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive",children:["Error loading kanban data: ",g.message]});const S=e.objectName?`${e.objectName.charAt(0).toUpperCase()+e.objectName.slice(1).replace(/_/g," ")} Detail`:"Card Details";return m.jsxs(m.Fragment,{children:[m.jsx(et,{schema:{...v,onCardClick:b=>{C.handleClick(b),s?.(b)}}}),C.isOverlay&&m.jsx($.NavigationOverlay,{...C,title:S,children:b=>m.jsx("div",{className:"space-y-3",children:Object.entries(b).map(([E,x])=>m.jsxs("div",{className:"flex flex-col",children:[m.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:E.replace(/_/g," ")}),m.jsx("span",{className:"text-sm",children:String(x??"—")})]},E))})})]})},ar=c.lazy(()=>Promise.resolve().then(()=>Js)),Yt=c.lazy(()=>Promise.resolve().then(()=>yi)),et=({schema:e})=>{const n=c.useMemo(()=>{const{columns:t=[],data:r,groupBy:s}=e;if(r&&s&&Array.isArray(r)){const i={};t.forEach(o=>{o.id&&(i[String(o.id).toLowerCase()]=o.id),o.title&&(i[String(o.title).toLowerCase()]=o.id)});const a=r.reduce((o,l)=>{const u=String(l[s]??""),d=i[u.toLowerCase()]??u;return o[d]||(o[d]=[]),o[d].push(l),o},{});return t.map(o=>({...o,cards:[...o.cards||[],...a[o.id]||[]]}))}return t},[e]);return m.jsx(c.Suspense,{fallback:m.jsx($.Skeleton,{className:"w-full h-[600px]"}),children:m.jsx(ar,{columns:n,onCardMove:e.onCardMove,onCardClick:e.onCardClick,className:e.className})})};Ze.ComponentRegistry.register("kanban-ui",et,{namespace:"plugin-kanban",label:"Kanban Board",icon:"LayoutDashboard",category:"plugin",inputs:[{name:"columns",type:"array",label:"Columns",description:"Array of { id, title, cards, limit, className }",required:!0},{name:"onCardMove",type:"code",label:"On Card Move",description:"Callback when a card is moved",advanced:!0},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:[{id:"todo",title:"To Do",cards:[{id:"card-1",title:"Task 1",description:"This is the first task",badges:[{label:"High Priority",variant:"destructive"},{label:"Feature",variant:"default"}]},{id:"card-2",title:"Task 2",description:"This is the second task",badges:[{label:"Bug",variant:"destructive"}]}]},{id:"in-progress",title:"In Progress",limit:3,cards:[{id:"card-3",title:"Task 3",description:"Currently working on this",badges:[{label:"In Progress",variant:"default"}]}]},{id:"done",title:"Done",cards:[{id:"card-4",title:"Task 4",description:"This task is completed",badges:[{label:"Completed",variant:"outline"}]},{id:"card-5",title:"Task 5",description:"Another completed task",badges:[{label:"Completed",variant:"outline"}]}]}],className:"w-full"}});const lr={kanban:et,"kanban-enhanced":Yt,"object-kanban":xt};Ze.ComponentRegistry.register("kanban-enhanced",({schema:e})=>{const n=c.useMemo(()=>{const{columns:t=[],data:r,groupBy:s}=e;if(r&&s&&Array.isArray(r)){const i=r.reduce((a,o)=>{const l=o[s];return a[l]||(a[l]=[]),a[l].push(o),a},{});return t.map(a=>({...a,cards:[...a.cards||[],...i[a.id]||[]]}))}return t},[e]);return m.jsx(c.Suspense,{fallback:m.jsx($.Skeleton,{className:"w-full h-[600px]"}),children:m.jsx(Yt,{columns:n,onCardMove:e.onCardMove,onColumnToggle:e.onColumnToggle,enableVirtualScrolling:e.enableVirtualScrolling,virtualScrollThreshold:e.virtualScrollThreshold,className:e.className})})},{namespace:"plugin-kanban",label:"Kanban Board (Enhanced)",icon:"LayoutGrid",category:"plugin",inputs:[{name:"columns",type:"array",label:"Columns",required:!0},{name:"enableVirtualScrolling",type:"boolean",label:"Virtual Scrolling",defaultValue:!1},{name:"virtualScrollThreshold",type:"number",label:"Virtual Scroll Threshold",defaultValue:50},{name:"onCardMove",type:"code",label:"On Card Move",advanced:!0},{name:"onColumnToggle",type:"code",label:"On Column Toggle",advanced:!0},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:[],enableVirtualScrolling:!1,virtualScrollThreshold:50,className:"w-full"}});const wt=({schema:e,...n})=>{const{dataSource:t}=Re.useSchemaContext()||{};return m.jsx(xt,{schema:e,dataSource:t,...n})};Ze.ComponentRegistry.register("object-kanban",wt,{namespace:"plugin-kanban",label:"Object Kanban",category:"view",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"}]}),Ze.ComponentRegistry.register("kanban",wt,{namespace:"view",label:"Kanban Board",category:"view",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"}]});function cr(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return c.useMemo(()=>r=>{n.forEach(s=>s(r))},n)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ee(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function Ct(e){return"nodeType"in e}function X(e){var n,t;return e?Ee(e)?e:Ct(e)&&(n=(t=e.ownerDocument)==null?void 0:t.defaultView)!=null?n:window:window}function St(e){const{Document:n}=X(e);return e instanceof n}function Pe(e){return Ee(e)?!1:e instanceof X(e).HTMLElement}function Ut(e){return e instanceof X(e).SVGElement}function De(e){return e?Ee(e)?e.document:Ct(e)?St(e)?e:Pe(e)||Ut(e)?e.ownerDocument:document:document:document}const oe=tt?c.useLayoutEffect:c.useEffect;function nt(e){const n=c.useRef(e);return oe(()=>{n.current=e}),c.useCallback(function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return n.current==null?void 0:n.current(...r)},[])}function ur(){const e=c.useRef(null),n=c.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),t=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,t]}function Fe(e,n){n===void 0&&(n=[e]);const t=c.useRef(e);return oe(()=>{t.current!==e&&(t.current=e)},n),t}function $e(e,n){const t=c.useRef();return c.useMemo(()=>{const r=e(t.current);return t.current=r,r},[...n])}function rt(e){const n=nt(e),t=c.useRef(null),r=c.useCallback(s=>{s!==t.current&&n?.(s,t.current),t.current=s},[]);return[t,r]}function st(e){const n=c.useRef();return c.useEffect(()=>{n.current=e},[e]),n.current}let Et={};function Be(e,n){return c.useMemo(()=>{if(n)return n;const t=Et[e]==null?0:Et[e]+1;return Et[e]=t,e+"-"+t},[e,n])}function qt(e){return function(n){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return r.reduce((i,a)=>{const o=Object.entries(a);for(const[l,u]of o){const d=i[l];d!=null&&(i[l]=d+e*u)}return i},{...n})}}const Oe=qt(1),it=qt(-1);function dr(e){return"clientX"in e&&"clientY"in e}function ot(e){if(!e)return!1;const{KeyboardEvent:n}=X(e.target);return n&&e instanceof n}function fr(e){if(!e)return!1;const{TouchEvent:n}=X(e.target);return n&&e instanceof n}function at(e){if(fr(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:t}=e.touches[0];return{x:n,y:t}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:t}=e.changedTouches[0];return{x:n,y:t}}}return dr(e)?{x:e.clientX,y:e.clientY}:null}const fe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:t}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:t}=e;return"scaleX("+n+") scaleY("+t+")"}},Transform:{toString(e){if(e)return[fe.Translate.toString(e),fe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:t,easing:r}=e;return n+" "+t+"ms "+r}}}),Xt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function hr(e){return e.matches(Xt)?e:e.querySelector(Xt)}const gr={display:"none"};function pr(e){let{id:n,value:t}=e;return c.createElement("div",{id:n,style:gr},t)}function mr(e){let{id:n,announcement:t,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return c.createElement("div",{id:n,style:s,role:"status","aria-live":r,"aria-atomic":!0},t)}function vr(){const[e,n]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&n(r)},[]),announcement:e}}const Ht=c.createContext(null);function br(e){const n=c.useContext(Ht);c.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function yr(){const[e]=c.useState(()=>new Set),n=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:s,event:i}=r;e.forEach(a=>{var o;return(o=a[s])==null?void 0:o.call(a,i)})},[e]),n]}const xr={draggable:`
|
|
7
7
|
To pick up a draggable item, press the space bar.
|
|
8
8
|
While dragging, use the arrow keys to move the item.
|
|
9
9
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
10
|
-
`},yr={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:t}=e;return t?"Draggable item "+n.id+" was moved over droppable area "+t.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:t}=e;return t?"Draggable item "+n.id+" was dropped over droppable area "+t.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function xr(e){let{announcements:n=yr,container:t,hiddenTextDescribedById:r,screenReaderInstructions:s=br}=e;const{announce:o,announcement:i}=pr(),a=Be("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),mr(c.useMemo(()=>({onDragStart(f){let{active:g}=f;o(n.onDragStart({active:g}))},onDragMove(f){let{active:g,over:p}=f;n.onDragMove&&o(n.onDragMove({active:g,over:p}))},onDragOver(f){let{active:g,over:p}=f;o(n.onDragOver({active:g,over:p}))},onDragEnd(f){let{active:g,over:p}=f;o(n.onDragEnd({active:g,over:p}))},onDragCancel(f){let{active:g,over:p}=f;o(n.onDragCancel({active:g,over:p}))}}),[o,n])),!l)return null;const d=c.createElement(c.Fragment,null,c.createElement(hr,{id:r,value:s.draggable}),c.createElement(gr,{id:a,announcement:i}));return t?Se.createPortal(d,t):d}var $;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})($||($={}));function at(){}function Ht(e,n){return c.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function Jt(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return c.useMemo(()=>[...n].filter(r=>r!=null),[...n])}const ae=Object.freeze({x:0,y:0});function wr(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function Cr(e,n){const t=it(e);if(!t)return"0 0";const r={x:(t.x-n.left)/n.width*100,y:(t.y-n.top)/n.height*100};return r.x+"% "+r.y+"%"}function Sr(e,n){let{data:{value:t}}=e,{data:{value:r}}=n;return t-r}function Er(e,n){let{data:{value:t}}=e,{data:{value:r}}=n;return r-t}function Gt(e){let{left:n,top:t,height:r,width:s}=e;return[{x:n,y:t},{x:n+s,y:t},{x:n,y:t+r},{x:n+s,y:t+r}]}function Dr(e,n){if(!e||e.length===0)return null;const[t]=e;return t[n]}const Zt=e=>{let{collisionRect:n,droppableRects:t,droppableContainers:r}=e;const s=Gt(n),o=[];for(const i of r){const{id:a}=i,l=t.get(a);if(l){const u=Gt(l),d=s.reduce((g,p,C)=>g+wr(u[C],p),0),f=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:f}})}}return o.sort(Sr)};function Or(e,n){const t=Math.max(n.top,e.top),r=Math.max(n.left,e.left),s=Math.min(n.left+n.width,e.left+e.width),o=Math.min(n.top+n.height,e.top+e.height),i=s-r,a=o-t;if(r<s&&t<o){const l=n.width*n.height,u=e.width*e.height,d=i*a,f=d/(l+u-d);return Number(f.toFixed(4))}return 0}const Nr=e=>{let{collisionRect:n,droppableRects:t,droppableContainers:r}=e;const s=[];for(const o of r){const{id:i}=o,a=t.get(i);if(a){const l=Or(a,n);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(Er)};function Tr(e,n,t){return{...e,scaleX:n&&t?n.width/t.width:1,scaleY:n&&t?n.height/t.height:1}}function Qt(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:ae}function Ar(e){return function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s.reduce((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...t})}}const Mr=Ar(1);function en(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function Ir(e,n,t){const r=en(n);if(!r)return e;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=e.left-i-(1-s)*parseFloat(t),u=e.top-a-(1-o)*parseFloat(t.slice(t.indexOf(" ")+1)),d=s?e.width/s:e.width,f=o?e.height/o:e.height;return{width:d,height:f,top:u,right:l+d,bottom:u+f,left:l}}const jr={ignoreTransform:!1};function Ne(e,n){n===void 0&&(n=jr);let t=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:u,transformOrigin:d}=X(e).getComputedStyle(e);u&&(t=Ir(t,u,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=t;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function tn(e){return Ne(e,{ignoreTransform:!0})}function kr(e){const n=e.innerWidth,t=e.innerHeight;return{top:0,left:0,right:n,bottom:t,width:n,height:t}}function _r(e,n){return n===void 0&&(n=X(e).getComputedStyle(e)),n.position==="fixed"}function Rr(e,n){n===void 0&&(n=X(e).getComputedStyle(e));const t=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=n[s];return typeof o=="string"?t.test(o):!1})}function Et(e,n){const t=[];function r(s){if(n!=null&&t.length>=n||!s)return t;if(Ct(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!Le(s)||Kt(s)||t.includes(s))return t;const o=X(e).getComputedStyle(s);return s!==e&&Rr(s,o)&&t.push(s),_r(s,o)?t:r(s.parentNode)}return e?r(e):t}function nn(e){const[n]=Et(e,1);return n??null}function Dt(e){return!et||!e?null:Ee(e)?e:wt(e)?Ct(e)||e===De(e).scrollingElement?window:Le(e)?e:null:null}function rn(e){return Ee(e)?e.scrollX:e.scrollLeft}function sn(e){return Ee(e)?e.scrollY:e.scrollTop}function Ot(e){return{x:rn(e),y:sn(e)}}var W;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(W||(W={}));function on(e){return!et||!e?!1:e===document.scrollingElement}function an(e){const n={x:0,y:0},t=on(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-t.width,y:e.scrollHeight-t.height},s=e.scrollTop<=n.y,o=e.scrollLeft<=n.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:n}}const zr={x:.2,y:.2};function Lr(e,n,t,r,s){let{top:o,left:i,right:a,bottom:l}=t;r===void 0&&(r=10),s===void 0&&(s=zr);const{isTop:u,isBottom:d,isLeft:f,isRight:g}=an(e),p={x:0,y:0},C={x:0,y:0},b={height:n.height*s.y,width:n.width*s.x};return!u&&o<=n.top+b.height?(p.y=W.Backward,C.y=r*Math.abs((n.top+b.height-o)/b.height)):!d&&l>=n.bottom-b.height&&(p.y=W.Forward,C.y=r*Math.abs((n.bottom-b.height-l)/b.height)),!g&&a>=n.right-b.width?(p.x=W.Forward,C.x=r*Math.abs((n.right-b.width-a)/b.width)):!f&&i<=n.left+b.width&&(p.x=W.Backward,C.x=r*Math.abs((n.left+b.width-i)/b.width)),{direction:p,speed:C}}function Pr(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:n,left:t,right:r,bottom:s}=e.getBoundingClientRect();return{top:n,left:t,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function ln(e){return e.reduce((n,t)=>Oe(n,Ot(t)),ae)}function Fr(e){return e.reduce((n,t)=>n+rn(t),0)}function Br(e){return e.reduce((n,t)=>n+sn(t),0)}function cn(e,n){if(n===void 0&&(n=Ne),!e)return;const{top:t,left:r,bottom:s,right:o}=n(e);nn(e)&&(s<=0||o<=0||t>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const $r=[["x",["left","right"],Fr],["y",["top","bottom"],Br]];class Nt{constructor(n,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Et(t),s=ln(r);this.rect={...n},this.width=n.width,this.height=n.height;for(const[o,i,a]of $r)for(const l of i)Object.defineProperty(this,l,{get:()=>{const u=a(r),d=s[o]-u;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class $e{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(t=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...t)})},this.target=n}add(n,t,r){var s;(s=this.target)==null||s.addEventListener(n,t,r),this.listeners.push([n,t,r])}}function Wr(e){const{EventTarget:n}=X(e);return e instanceof n?e:De(e)}function Tt(e,n){const t=Math.abs(e.x),r=Math.abs(e.y);return typeof n=="number"?Math.sqrt(t**2+r**2)>n:"x"in n&&"y"in n?t>n.x&&r>n.y:"x"in n?t>n.x:"y"in n?r>n.y:!1}var re;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(re||(re={}));function un(e){e.preventDefault()}function Vr(e){e.stopPropagation()}var k;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(k||(k={}));const dn={start:[k.Space,k.Enter],cancel:[k.Esc],end:[k.Space,k.Enter,k.Tab]},Yr=(e,n)=>{let{currentCoordinates:t}=n;switch(e.code){case k.Right:return{...t,x:t.x+25};case k.Left:return{...t,x:t.x-25};case k.Down:return{...t,y:t.y+25};case k.Up:return{...t,y:t.y-25}}};class fn{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:t}}=n;this.props=n,this.listeners=new $e(De(t)),this.windowListeners=new $e(X(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(re.Resize,this.handleCancel),this.windowListeners.add(re.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(re.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:t}=this.props,r=n.node.current;r&&cn(r),t(ae)}handleKeyDown(n){if(ot(n)){const{active:t,context:r,options:s}=this.props,{keyboardCodes:o=dn,coordinateGetter:i=Yr,scrollBehavior:a="smooth"}=s,{code:l}=n;if(o.end.includes(l)){this.handleEnd(n);return}if(o.cancel.includes(l)){this.handleCancel(n);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:ae;this.referenceCoordinates||(this.referenceCoordinates=d);const f=i(n,{active:t,context:r.current,currentCoordinates:d});if(f){const g=st(f,d),p={x:0,y:0},{scrollableAncestors:C}=r.current;for(const b of C){const x=n.code,{isTop:y,isRight:v,isLeft:m,isBottom:S,maxScroll:E,minScroll:T}=an(b),O=Pr(b),N={x:Math.min(x===k.Right?O.right-O.width/2:O.right,Math.max(x===k.Right?O.left:O.left+O.width/2,f.x)),y:Math.min(x===k.Down?O.bottom-O.height/2:O.bottom,Math.max(x===k.Down?O.top:O.top+O.height/2,f.y))},A=x===k.Right&&!v||x===k.Left&&!m,I=x===k.Down&&!S||x===k.Up&&!y;if(A&&N.x!==f.x){const M=b.scrollLeft+g.x,z=x===k.Right&&M<=E.x||x===k.Left&&M>=T.x;if(z&&!g.y){b.scrollTo({left:M,behavior:a});return}z?p.x=b.scrollLeft-M:p.x=x===k.Right?b.scrollLeft-E.x:b.scrollLeft-T.x,p.x&&b.scrollBy({left:-p.x,behavior:a});break}else if(I&&N.y!==f.y){const M=b.scrollTop+g.y,z=x===k.Down&&M<=E.y||x===k.Up&&M>=T.y;if(z&&!g.x){b.scrollTo({top:M,behavior:a});return}z?p.y=b.scrollTop-M:p.y=x===k.Down?b.scrollTop-E.y:b.scrollTop-T.y,p.y&&b.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(n,Oe(st(f,this.referenceCoordinates),p))}}}handleMove(n,t){const{onMove:r}=this.props;n.preventDefault(),r(t)}handleEnd(n){const{onEnd:t}=this.props;n.preventDefault(),this.detach(),t()}handleCancel(n){const{onCancel:t}=this.props;n.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}fn.activators=[{eventName:"onKeyDown",handler:(e,n,t)=>{let{keyboardCodes:r=dn,onActivation:s}=n,{active:o}=t;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function hn(e){return!!(e&&"distance"in e)}function gn(e){return!!(e&&"delay"in e)}class At{constructor(n,t,r){var s;r===void 0&&(r=Wr(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=t;const{event:o}=n,{target:i}=o;this.props=n,this.events=t,this.document=De(i),this.documentListeners=new $e(this.document),this.listeners=new $e(r),this.windowListeners=new $e(X(i)),this.initialCoordinates=(s=it(o))!=null?s:ae,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(re.Resize,this.handleCancel),this.windowListeners.add(re.DragStart,un),this.windowListeners.add(re.VisibilityChange,this.handleCancel),this.windowListeners.add(re.ContextMenu,un),this.documentListeners.add(re.Keydown,this.handleKeydown),t){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gn(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(hn(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,t){const{active:r,onPending:s}=this.props;s(r,n,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:n}=this,{onStart:t}=this.props;n&&(this.activated=!0,this.documentListeners.add(re.Click,Vr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(re.SelectionChange,this.removeTextSelection),t(n))}handleMove(n){var t;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(t=it(n))!=null?t:ae,u=st(s,l);if(!r&&a){if(hn(a)){if(a.tolerance!=null&&Tt(u,a.tolerance))return this.handleCancel();if(Tt(u,a.distance))return this.handleStart()}if(gn(a)&&Tt(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}n.cancelable&&n.preventDefault(),i(l)}handleEnd(){const{onAbort:n,onEnd:t}=this.props;this.detach(),this.activated||n(this.props.active),t()}handleCancel(){const{onAbort:n,onCancel:t}=this.props;this.detach(),this.activated||n(this.props.active),t()}handleKeydown(n){n.code===k.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const Kr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class lt extends At{constructor(n){const{event:t}=n,r=De(t.target);super(n,Kr,r)}}lt.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;return!t.isPrimary||t.button!==0?!1:(r?.({event:t}),!0)}}];const Ur={move:{name:"mousemove"},end:{name:"mouseup"}};var Mt;(function(e){e[e.RightClick=2]="RightClick"})(Mt||(Mt={}));class qr extends At{constructor(n){super(n,Ur,De(n.event.target))}}qr.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;return t.button===Mt.RightClick?!1:(r?.({event:t}),!0)}}];const It={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Xr extends At{constructor(n){super(n,It)}static setup(){return window.addEventListener(It.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(It.move.name,n)};function n(){}}}Xr.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;const{touches:s}=t;return s.length>1?!1:(r?.({event:t}),!0)}}];var We;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(We||(We={}));var ct;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ct||(ct={}));function Hr(e){let{acceleration:n,activator:t=We.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=ct.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:g}=e;const p=Gr({delta:f,disabled:!o}),[C,b]=lr(),x=c.useRef({x:0,y:0}),y=c.useRef({x:0,y:0}),v=c.useMemo(()=>{switch(t){case We.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case We.DraggableRect:return s}},[t,s,l]),m=c.useRef(null),S=c.useCallback(()=>{const T=m.current;if(!T)return;const O=x.current.x*y.current.x,N=x.current.y*y.current.y;T.scrollBy(O,N)},[]),E=c.useMemo(()=>a===ct.TreeOrder?[...u].reverse():u,[a,u]);c.useEffect(()=>{if(!o||!u.length||!v){b();return}for(const T of E){if(r?.(T)===!1)continue;const O=u.indexOf(T),N=d[O];if(!N)continue;const{direction:A,speed:I}=Lr(T,N,v,n,g);for(const M of["x","y"])p[M][A[M]]||(I[M]=0,A[M]=0);if(I.x>0||I.y>0){b(),m.current=T,C(S,i),x.current=I,y.current=A;return}}x.current={x:0,y:0},y.current={x:0,y:0},b()},[n,S,r,b,o,i,JSON.stringify(v),JSON.stringify(p),C,u,E,d,JSON.stringify(g)])}const Jr={x:{[W.Backward]:!1,[W.Forward]:!1},y:{[W.Backward]:!1,[W.Forward]:!1}};function Gr(e){let{delta:n,disabled:t}=e;const r=rt(n);return Fe(s=>{if(t||!r||!s)return Jr;const o={x:Math.sign(n.x-r.x),y:Math.sign(n.y-r.y)};return{x:{[W.Backward]:s.x[W.Backward]||o.x===-1,[W.Forward]:s.x[W.Forward]||o.x===1},y:{[W.Backward]:s.y[W.Backward]||o.y===-1,[W.Forward]:s.y[W.Forward]||o.y===1}}},[t,n,r])}function Zr(e,n){const t=n!=null?e.get(n):void 0,r=t?t.node.current:null;return Fe(s=>{var o;return n==null?null:(o=r??s)!=null?o:null},[r,n])}function Qr(e,n){return c.useMemo(()=>e.reduce((t,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:n(i.handler,r)}));return[...t,...o]},[]),[e,n])}var Ve;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ve||(Ve={}));var jt;(function(e){e.Optimized="optimized"})(jt||(jt={}));const pn=new Map;function es(e,n){let{dragging:t,dependencies:r,config:s}=n;const[o,i]=c.useState(null),{frequency:a,measure:l,strategy:u}=s,d=c.useRef(e),f=x(),g=Pe(f),p=c.useCallback(function(y){y===void 0&&(y=[]),!g.current&&i(v=>v===null?y:v.concat(y.filter(m=>!v.includes(m))))},[g]),C=c.useRef(null),b=Fe(y=>{if(f&&!t)return pn;if(!y||y===pn||d.current!==e||o!=null){const v=new Map;for(let m of e){if(!m)continue;if(o&&o.length>0&&!o.includes(m.id)&&m.rect.current){v.set(m.id,m.rect.current);continue}const S=m.node.current,E=S?new Nt(l(S),S):null;m.rect.current=E,E&&v.set(m.id,E)}return v}return y},[e,o,t,f,l]);return c.useEffect(()=>{d.current=e},[e]),c.useEffect(()=>{f||p()},[t,f]),c.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),c.useEffect(()=>{f||typeof a!="number"||C.current!==null||(C.current=setTimeout(()=>{p(),C.current=null},a))},[a,f,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:o!=null};function x(){switch(u){case Ve.Always:return!1;case Ve.BeforeDragging:return t;default:return!t}}}function kt(e,n){return Fe(t=>e?t||(typeof n=="function"?n(e):e):null,[n,e])}function ts(e,n){return kt(e,n)}function ns(e){let{callback:n,disabled:t}=e;const r=tt(n),s=c.useMemo(()=>{if(t||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,t]);return c.useEffect(()=>()=>s?.disconnect(),[s]),s}function ut(e){let{callback:n,disabled:t}=e;const r=tt(n),s=c.useMemo(()=>{if(t||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[t]);return c.useEffect(()=>()=>s?.disconnect(),[s]),s}function rs(e){return new Nt(Ne(e),e)}function mn(e,n,t){n===void 0&&(n=rs);const[r,s]=c.useState(null);function o(){s(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??t)!=null?u:null}const d=n(e);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=ns({callback(l){if(e)for(const u of l){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=ut({callback:o});return ie(()=>{o(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function ss(e){const n=kt(e);return Qt(e,n)}const vn=[];function os(e){const n=c.useRef(e),t=Fe(r=>e?r&&r!==vn&&e&&n.current&&e.parentNode===n.current.parentNode?r:Et(e):vn,[e]);return c.useEffect(()=>{n.current=e},[e]),t}function is(e){const[n,t]=c.useState(null),r=c.useRef(e),s=c.useCallback(o=>{const i=Dt(o.target);i&&t(a=>a?(a.set(i,Ot(i)),new Map(a)):null)},[]);return c.useEffect(()=>{const o=r.current;if(e!==o){i(o);const a=e.map(l=>{const u=Dt(l);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,Ot(u)]):null}).filter(l=>l!=null);t(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const u=Dt(l);u?.removeEventListener("scroll",s)})}},[s,e]),c.useMemo(()=>e.length?n?Array.from(n.values()).reduce((o,i)=>Oe(o,i),ae):ln(e):ae,[e,n])}function bn(e,n){n===void 0&&(n=[]);const t=c.useRef(null);return c.useEffect(()=>{t.current=null},n),c.useEffect(()=>{const r=e!==ae;r&&!t.current&&(t.current=e),!r&&t.current&&(t.current=null)},[e]),t.current?st(e,t.current):ae}function as(e){c.useEffect(()=>{if(!et)return;const n=e.map(t=>{let{sensor:r}=t;return r.setup==null?void 0:r.setup()});return()=>{for(const t of n)t?.()}},e.map(n=>{let{sensor:t}=n;return t}))}function ls(e,n){return c.useMemo(()=>e.reduce((t,r)=>{let{eventName:s,handler:o}=r;return t[s]=i=>{o(i,n)},t},{}),[e,n])}function yn(e){return c.useMemo(()=>e?kr(e):null,[e])}const xn=[];function cs(e,n){n===void 0&&(n=Ne);const[t]=e,r=yn(t?X(t):null),[s,o]=c.useState(xn);function i(){o(()=>e.length?e.map(l=>on(l)?r:new Nt(n(l),l)):xn)}const a=ut({callback:i});return ie(()=>{a?.disconnect(),i(),e.forEach(l=>a?.observe(l))},[e]),s}function wn(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return Le(n)?n:e}function us(e){let{measure:n}=e;const[t,r]=c.useState(null),s=c.useCallback(u=>{for(const{target:d}of u)if(Le(d)){r(f=>{const g=n(d);return f?{...f,width:g.width,height:g.height}:g});break}},[n]),o=ut({callback:s}),i=c.useCallback(u=>{const d=wn(u);o?.disconnect(),d&&o?.observe(d),r(d?n(d):null)},[n,o]),[a,l]=nt(i);return c.useMemo(()=>({nodeRef:a,rect:t,setRef:l}),[t,a,l])}const ds=[{sensor:lt,options:{}},{sensor:fn,options:{}}],fs={current:{}},dt={draggable:{measure:tn},droppable:{measure:tn,strategy:Ve.WhileDragging,frequency:jt.Optimized},dragOverlay:{measure:Ne}};class Ye extends Map{get(n){var t;return n!=null&&(t=super.get(n))!=null?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:t}=n;return!t})}getNodeFor(n){var t,r;return(t=(r=this.get(n))==null?void 0:r.node.current)!=null?t:void 0}}const hs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ye,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:at},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:dt,measureDroppableContainers:at,windowRect:null,measuringScheduled:!1},Cn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:at,draggableNodes:new Map,over:null,measureDroppableContainers:at},Ke=c.createContext(Cn),Sn=c.createContext(hs);function gs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ye}}}function ps(e,n){switch(n.type){case $.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case $.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case $.DragEnd:case $.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $.RegisterDroppable:{const{element:t}=n,{id:r}=t,s=new Ye(e.droppable.containers);return s.set(r,t),{...e,droppable:{...e.droppable,containers:s}}}case $.SetDroppableDisabled:{const{id:t,key:r,disabled:s}=n,o=e.droppable.containers.get(t);if(!o||r!==o.key)return e;const i=new Ye(e.droppable.containers);return i.set(t,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case $.UnregisterDroppable:{const{id:t,key:r}=n,s=e.droppable.containers.get(t);if(!s||r!==s.key)return e;const o=new Ye(e.droppable.containers);return o.delete(t),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function ms(e){let{disabled:n}=e;const{active:t,activatorEvent:r,draggableNodes:s}=c.useContext(Ke),o=rt(r),i=rt(t?.id);return c.useEffect(()=>{if(!n&&!r&&o&&i!=null){if(!ot(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[l.current,u.current]){if(!d)continue;const f=dr(d);if(f){f.focus();break}}})}},[r,n,s,i,o]),null}function En(e,n){let{transform:t,...r}=n;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),t):t}function vs(e){return c.useMemo(()=>({draggable:{...dt.draggable,...e?.draggable},droppable:{...dt.droppable,...e?.droppable},dragOverlay:{...dt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function bs(e){let{activeNode:n,measure:t,initialRect:r,config:s=!0}=e;const o=c.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;ie(()=>{if(!i&&!a||!n){o.current=!1;return}if(o.current||!r)return;const u=n?.node.current;if(!u||u.isConnected===!1)return;const d=t(u),f=Qt(d,r);if(i||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=nn(u);g&&g.scrollBy({top:f.y,left:f.x})}},[n,i,a,r,t])}const ft=c.createContext({...ae,scaleX:1,scaleY:1});var pe;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(pe||(pe={}));const Dn=c.memo(function(n){var t,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:u,sensors:d=ds,collisionDetection:f=Nr,measuring:g,modifiers:p,...C}=n;const b=c.useReducer(ps,void 0,gs),[x,y]=b,[v,m]=vr(),[S,E]=c.useState(pe.Uninitialized),T=S===pe.Initialized,{draggable:{active:O,nodes:N,translate:A},droppable:{containers:I}}=x,M=O!=null?N.get(O):null,z=c.useRef({initial:null,translated:null}),P=c.useMemo(()=>{var q;return O!=null?{id:O,data:(q=M?.data)!=null?q:fs,rect:z}:null},[O,M]),V=c.useRef(null),[H,Z]=c.useState(null),[K,Ce]=c.useState(null),se=Pe(C,Object.values(C)),me=Be("DndDescribedBy",i),h=c.useMemo(()=>I.getEnabled(),[I]),D=vs(g),{droppableRects:j,measureDroppableContainers:R,measuringScheduled:le}=es(h,{dragging:T,dependencies:[A.x,A.y],config:D.droppable}),U=Zr(N,O),L=c.useMemo(()=>K?it(K):null,[K]),J=Oo(),Q=ts(U,D.draggable.measure);bs({activeNode:O!=null?N.get(O):null,config:J.layoutShiftCompensation,initialRect:Q,measure:D.draggable.measure});const _=mn(U,D.draggable.measure,Q),Ue=mn(U?U.parentElement:null),ce=c.useRef({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ae=I.getNodeFor((t=ce.current.over)==null?void 0:t.id),he=us({measure:D.dragOverlay.measure}),Me=(r=he.nodeRef.current)!=null?r:U,Ie=T?(s=he.rect)!=null?s:_:null,qn=!!(he.nodeRef.current&&he.rect),Xn=ss(qn?null:_),Lt=yn(Me?X(Me):null),ve=os(T?Ae??U:null),vt=cs(ve),bt=En(p,{transform:{x:A.x-Xn.x,y:A.y-Xn.y,scaleX:1,scaleY:1},activatorEvent:K,active:P,activeNodeRect:_,containerNodeRect:Ue,draggingNodeRect:Ie,over:ce.current.over,overlayNodeRect:he.rect,scrollableAncestors:ve,scrollableAncestorRects:vt,windowRect:Lt}),Hn=L?Oe(L,A):null,Jn=is(ve),yo=bn(Jn),xo=bn(Jn,[_]),je=Oe(bt,yo),ke=Ie?Mr(Ie,bt):null,qe=P&&ke?f({active:P,collisionRect:ke,droppableRects:j,droppableContainers:h,pointerCoordinates:Hn}):null,Gn=Dr(qe,"id"),[be,Zn]=c.useState(null),wo=qn?bt:Oe(bt,xo),Co=Tr(wo,(o=be?.rect)!=null?o:null,_),Pt=c.useRef(null),Qn=c.useCallback((q,ee)=>{let{sensor:te,options:ye}=ee;if(V.current==null)return;const oe=N.get(V.current);if(!oe)return;const ne=q.nativeEvent,ue=new te({active:V.current,activeNode:oe,event:ne,options:ye,context:ce,onAbort(Y){if(!N.get(Y))return;const{onDragAbort:de}=se.current,ge={id:Y};de?.(ge),v({type:"onDragAbort",event:ge})},onPending(Y,xe,de,ge){if(!N.get(Y))return;const{onDragPending:He}=se.current,we={id:Y,constraint:xe,initialCoordinates:de,offset:ge};He?.(we),v({type:"onDragPending",event:we})},onStart(Y){const xe=V.current;if(xe==null)return;const de=N.get(xe);if(!de)return;const{onDragStart:ge}=se.current,Xe={activatorEvent:ne,active:{id:xe,data:de.data,rect:z}};Se.unstable_batchedUpdates(()=>{ge?.(Xe),E(pe.Initializing),y({type:$.DragStart,initialCoordinates:Y,active:xe}),v({type:"onDragStart",event:Xe}),Z(Pt.current),Ce(ne)})},onMove(Y){y({type:$.DragMove,coordinates:Y})},onEnd:_e($.DragEnd),onCancel:_e($.DragCancel)});Pt.current=ue;function _e(Y){return async function(){const{active:de,collisions:ge,over:Xe,scrollAdjustedTranslate:He}=ce.current;let we=null;if(de&&He){const{cancelDrop:Je}=se.current;we={activatorEvent:ne,active:de,collisions:ge,delta:He,over:Xe},Y===$.DragEnd&&typeof Je=="function"&&await Promise.resolve(Je(we))&&(Y=$.DragCancel)}V.current=null,Se.unstable_batchedUpdates(()=>{y({type:Y}),E(pe.Uninitialized),Zn(null),Z(null),Ce(null),Pt.current=null;const Je=Y===$.DragEnd?"onDragEnd":"onDragCancel";if(we){const Ft=se.current[Je];Ft?.(we),v({type:Je,event:we})}})}}},[N]),So=c.useCallback((q,ee)=>(te,ye)=>{const oe=te.nativeEvent,ne=N.get(ye);if(V.current!==null||!ne||oe.dndKit||oe.defaultPrevented)return;const ue={active:ne};q(te,ee.options,ue)===!0&&(oe.dndKit={capturedBy:ee.sensor},V.current=ye,Qn(te,ee))},[N,Qn]),er=Qr(d,So);as(d),ie(()=>{_&&S===pe.Initializing&&E(pe.Initialized)},[_,S]),c.useEffect(()=>{const{onDragMove:q}=se.current,{active:ee,activatorEvent:te,collisions:ye,over:oe}=ce.current;if(!ee||!te)return;const ne={active:ee,activatorEvent:te,collisions:ye,delta:{x:je.x,y:je.y},over:oe};Se.unstable_batchedUpdates(()=>{q?.(ne),v({type:"onDragMove",event:ne})})},[je.x,je.y]),c.useEffect(()=>{const{active:q,activatorEvent:ee,collisions:te,droppableContainers:ye,scrollAdjustedTranslate:oe}=ce.current;if(!q||V.current==null||!ee||!oe)return;const{onDragOver:ne}=se.current,ue=ye.get(Gn),_e=ue&&ue.rect.current?{id:ue.id,rect:ue.rect.current,data:ue.data,disabled:ue.disabled}:null,Y={active:q,activatorEvent:ee,collisions:te,delta:{x:oe.x,y:oe.y},over:_e};Se.unstable_batchedUpdates(()=>{Zn(_e),ne?.(Y),v({type:"onDragOver",event:Y})})},[Gn]),ie(()=>{ce.current={activatorEvent:K,active:P,activeNode:U,collisionRect:ke,collisions:qe,droppableRects:j,draggableNodes:N,draggingNode:Me,draggingNodeRect:Ie,droppableContainers:I,over:be,scrollableAncestors:ve,scrollAdjustedTranslate:je},z.current={initial:Ie,translated:ke}},[P,U,qe,ke,N,Me,Ie,j,I,be,ve,je]),Hr({...J,delta:A,draggingRect:ke,pointerCoordinates:Hn,scrollableAncestors:ve,scrollableAncestorRects:vt});const Eo=c.useMemo(()=>({active:P,activeNode:U,activeNodeRect:_,activatorEvent:K,collisions:qe,containerNodeRect:Ue,dragOverlay:he,draggableNodes:N,droppableContainers:I,droppableRects:j,over:be,measureDroppableContainers:R,scrollableAncestors:ve,scrollableAncestorRects:vt,measuringConfiguration:D,measuringScheduled:le,windowRect:Lt}),[P,U,_,K,qe,Ue,he,N,I,j,be,R,ve,vt,D,le,Lt]),Do=c.useMemo(()=>({activatorEvent:K,activators:er,active:P,activeNodeRect:_,ariaDescribedById:{draggable:me},dispatch:y,draggableNodes:N,over:be,measureDroppableContainers:R}),[K,er,P,_,y,me,N,be,R]);return c.createElement(Xt.Provider,{value:m},c.createElement(Ke.Provider,{value:Do},c.createElement(Sn.Provider,{value:Eo},c.createElement(ft.Provider,{value:Co},u)),c.createElement(ms,{disabled:a?.restoreFocus===!1})),c.createElement(xr,{...a,hiddenTextDescribedById:me}));function Oo(){const q=H?.autoScrollEnabled===!1,ee=typeof l=="object"?l.enabled===!1:l===!1,te=T&&!q&&!ee;return typeof l=="object"?{...l,enabled:te}:{enabled:te}}}),ys=c.createContext(null),On="button",xs="Draggable";function ws(e){let{id:n,data:t,disabled:r=!1,attributes:s}=e;const o=Be(xs),{activators:i,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:g}=c.useContext(Ke),{role:p=On,roleDescription:C="draggable",tabIndex:b=0}=s??{},x=l?.id===n,y=c.useContext(x?ft:ys),[v,m]=nt(),[S,E]=nt(),T=ls(i,n),O=Pe(t);ie(()=>(f.set(n,{id:n,key:o,node:v,activatorNode:S,data:O}),()=>{const A=f.get(n);A&&A.key===o&&f.delete(n)}),[f,n]);const N=c.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":x&&p===On?!0:void 0,"aria-roledescription":C,"aria-describedby":d.draggable}),[r,p,b,x,C,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:N,isDragging:x,listeners:r?void 0:T,node:v,over:g,setNodeRef:m,setActivatorNodeRef:E,transform:y}}function Nn(){return c.useContext(Sn)}const Cs="Droppable",Ss={timeout:25};function Es(e){let{data:n,disabled:t=!1,id:r,resizeObserverConfig:s}=e;const o=Be(Cs),{active:i,dispatch:a,over:l,measureDroppableContainers:u}=c.useContext(Ke),d=c.useRef({disabled:t}),f=c.useRef(!1),g=c.useRef(null),p=c.useRef(null),{disabled:C,updateMeasurementsFor:b,timeout:x}={...Ss,...s},y=Pe(b??r),v=c.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),p.current=null},x)},[x]),m=ut({callback:v,disabled:C||!i}),S=c.useCallback((N,A)=>{m&&(A&&(m.unobserve(A),f.current=!1),N&&m.observe(N))},[m]),[E,T]=nt(S),O=Pe(n);return c.useEffect(()=>{!m||!E.current||(m.disconnect(),f.current=!1,m.observe(E.current))},[E,m]),c.useEffect(()=>(a({type:$.RegisterDroppable,element:{id:r,key:o,disabled:t,node:E,rect:g,data:O}}),()=>a({type:$.UnregisterDroppable,key:o,id:r})),[r]),c.useEffect(()=>{t!==d.current.disabled&&(a({type:$.SetDroppableDisabled,id:r,key:o,disabled:t}),d.current.disabled=t)},[r,o,t,a]),{active:i,rect:g,isOver:l?.id===r,node:E,over:l,setNodeRef:T}}function Ds(e){let{animation:n,children:t}=e;const[r,s]=c.useState(null),[o,i]=c.useState(null),a=rt(t);return!t&&!r&&a&&s(a),ie(()=>{if(!o)return;const l=r?.key,u=r?.props.id;if(l==null||u==null){s(null);return}Promise.resolve(n(u,o)).then(()=>{s(null)})},[n,r,o]),c.createElement(c.Fragment,null,t,r?c.cloneElement(r,{ref:i}):null)}const Os={x:0,y:0,scaleX:1,scaleY:1};function Ns(e){let{children:n}=e;return c.createElement(Ke.Provider,{value:Cn},c.createElement(ft.Provider,{value:Os},n))}const Ts={position:"fixed",touchAction:"none"},As=e=>ot(e)?"transform 250ms ease":void 0,Ms=c.forwardRef((e,n)=>{let{as:t,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:u,transition:d=As}=e;if(!a)return null;const f=s?u:{...u,scaleX:1,scaleY:1},g={...Ts,width:a.width,height:a.height,top:a.top,left:a.left,transform:fe.Transform.toString(f),transformOrigin:s&&r?Cr(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return c.createElement(t,{className:i,style:g,ref:n},o)}),Is={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:n,final:t}}=e;return[{transform:fe.Transform.toString(n)},{transform:fe.Transform.toString(t)}]},sideEffects:(e=>n=>{let{active:t,dragOverlay:r}=n;const s={},{styles:o,className:i}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=t.node.style.getPropertyValue(a),t.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&t.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,u]of Object.entries(s))t.node.style.setProperty(l,u);i!=null&&i.active&&t.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function js(e){let{config:n,draggableNodes:t,droppableContainers:r,measuringConfiguration:s}=e;return tt((o,i)=>{if(n===null)return;const a=t.get(o);if(!a)return;const l=a.node.current;if(!l)return;const u=wn(i);if(!u)return;const{transform:d}=X(i).getComputedStyle(i),f=en(d);if(!f)return;const g=typeof n=="function"?n:ks(n);return cn(l,s.draggable.measure),g({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:t,dragOverlay:{node:i,rect:s.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:s,transform:f})})}function ks(e){const{duration:n,easing:t,sideEffects:r,keyframes:s}={...Is,...e};return o=>{let{active:i,dragOverlay:a,transform:l,...u}=o;if(!n)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},f={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},g={x:l.x-d.x,y:l.y-d.y,...f},p=s({...u,active:i,dragOverlay:a,transform:{initial:l,final:g}}),[C]=p,b=p[p.length-1];if(JSON.stringify(C)===JSON.stringify(b))return;const x=r?.({active:i,dragOverlay:a,...u}),y=a.node.animate(p,{duration:n,easing:t,fill:"forwards"});return new Promise(v=>{y.onfinish=()=>{x?.(),v()}})}}let Tn=0;function _s(e){return c.useMemo(()=>{if(e!=null)return Tn++,Tn},[e])}const An=c.memo(e=>{let{adjustScale:n=!1,children:t,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:g,containerNodeRect:p,draggableNodes:C,droppableContainers:b,dragOverlay:x,over:y,measuringConfiguration:v,scrollableAncestors:m,scrollableAncestorRects:S,windowRect:E}=Nn(),T=c.useContext(ft),O=_s(f?.id),N=En(i,{activatorEvent:d,active:f,activeNodeRect:g,containerNodeRect:p,draggingNodeRect:x.rect,over:y,overlayNodeRect:x.rect,scrollableAncestors:m,scrollableAncestorRects:S,transform:T,windowRect:E}),A=kt(g),I=js({config:r,draggableNodes:C,droppableContainers:b,measuringConfiguration:v}),M=A?x.setRef:void 0;return c.createElement(Ns,null,c.createElement(Ds,{animation:I},f&&O?c.createElement(Ms,{key:O,id:f.id,ref:M,as:a,activatorEvent:d,adjustScale:n,className:l,transition:o,rect:A,style:{zIndex:u,...s},transform:N},t):null))});function ht(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function Rs(e,n){return e.reduce((t,r,s)=>{const o=n.get(r);return o&&(t[s]=o),t},Array(e.length))}function gt(e){return e!==null&&e>=0}function zs(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Ls(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Mn=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const o=ht(n,r,t),i=n[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},pt={scaleX:1,scaleY:1},In=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:o,overIndex:i}=e;const a=(n=o[t])!=null?n:r;if(!a)return null;if(s===t){const u=o[i];return u?{x:0,y:t<i?u.top+u.height-(a.top+a.height):u.top-a.top,...pt}:null}const l=Ps(o,s,t);return s>t&&s<=i?{x:0,y:-a.height-l,...pt}:s<t&&s>=i?{x:0,y:a.height+l,...pt}:{x:0,y:0,...pt}};function Ps(e,n,t){const r=e[n],s=e[n-1],o=e[n+1];return r?t<n?s?r.top-(s.top+s.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const jn="Sortable",kn=c.createContext({activeIndex:-1,containerId:jn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Mn,disabled:{draggable:!1,droppable:!1}});function _n(e){let{children:n,id:t,items:r,strategy:s=Mn,disabled:o=!1}=e;const{active:i,dragOverlay:a,droppableRects:l,over:u,measureDroppableContainers:d}=Nn(),f=Be(jn,t),g=a.rect!==null,p=c.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),C=i!=null,b=i?p.indexOf(i.id):-1,x=u?p.indexOf(u.id):-1,y=c.useRef(p),v=!zs(p,y.current),m=x!==-1&&b===-1||v,S=Ls(o);ie(()=>{v&&C&&d(p)},[v,p,C,d]),c.useEffect(()=>{y.current=p},[p]);const E=c.useMemo(()=>({activeIndex:b,containerId:f,disabled:S,disableTransforms:m,items:p,overIndex:x,useDragOverlay:g,sortedRects:Rs(p,l),strategy:s}),[b,f,S.draggable,S.droppable,m,p,x,l,g,s]);return c.createElement(kn.Provider,{value:E},n)}const Fs=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return ht(t,r,s).indexOf(n)},Bs=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:u}=e;return!u||!r||a!==o&&s===i?!1:t?!0:i!==s&&n===l},$s={duration:200,easing:"ease"},Rn="transform",Ws=fe.Transition.toString({property:Rn,duration:0,easing:"linear"}),Vs={roleDescription:"sortable"};function Ys(e){let{disabled:n,index:t,node:r,rect:s}=e;const[o,i]=c.useState(null),a=c.useRef(t);return ie(()=>{if(!n&&t!==a.current&&r.current){const l=s.current;if(l){const u=Ne(r.current,{ignoreTransform:!0}),d={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(d.x||d.y)&&i(d)}}t!==a.current&&(a.current=t)},[n,t,r,s]),c.useEffect(()=>{o&&i(null)},[o]),o}function mt(e){let{animateLayoutChanges:n=Bs,attributes:t,disabled:r,data:s,getNewIndex:o=Fs,id:i,strategy:a,resizeObserverConfig:l,transition:u=$s}=e;const{items:d,containerId:f,activeIndex:g,disabled:p,disableTransforms:C,sortedRects:b,overIndex:x,useDragOverlay:y,strategy:v}=c.useContext(kn),m=Ks(r,p),S=d.indexOf(i),E=c.useMemo(()=>({sortable:{containerId:f,index:S,items:d},...s}),[f,s,S,d]),T=c.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:O,node:N,isOver:A,setNodeRef:I}=Es({id:i,data:E,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...l}}),{active:M,activatorEvent:z,activeNodeRect:P,attributes:V,setNodeRef:H,listeners:Z,isDragging:K,over:Ce,setActivatorNodeRef:se,transform:me}=ws({id:i,data:E,attributes:{...Vs,...t},disabled:m.draggable}),h=ar(I,H),D=!!M,j=D&&!C&>(g)&>(x),R=!y&&K,le=R&&j?me:null,L=j?le??(a??v)({rects:b,activeNodeRect:P,activeIndex:g,overIndex:x,index:S}):null,J=gt(g)&>(x)?o({id:i,items:d,activeIndex:g,overIndex:x}):S,Q=M?.id,_=c.useRef({activeId:Q,items:d,newIndex:J,containerId:f}),Ue=d!==_.current.items,ce=n({active:M,containerId:f,isDragging:K,isSorting:D,id:i,index:S,items:d,newIndex:_.current.newIndex,previousItems:_.current.items,previousContainerId:_.current.containerId,transition:u,wasDragging:_.current.activeId!=null}),Ae=Ys({disabled:!ce,index:S,node:N,rect:O});return c.useEffect(()=>{D&&_.current.newIndex!==J&&(_.current.newIndex=J),f!==_.current.containerId&&(_.current.containerId=f),d!==_.current.items&&(_.current.items=d)},[D,J,f,d]),c.useEffect(()=>{if(Q===_.current.activeId)return;if(Q!=null&&_.current.activeId==null){_.current.activeId=Q;return}const Me=setTimeout(()=>{_.current.activeId=Q},50);return()=>clearTimeout(Me)},[Q]),{active:M,activeIndex:g,attributes:V,data:E,rect:O,index:S,newIndex:J,items:d,isOver:A,isSorting:D,isDragging:K,listeners:Z,node:N,overIndex:x,over:Ce,setNodeRef:h,setActivatorNodeRef:se,setDroppableNodeRef:I,setDraggableNodeRef:H,transform:Ae??L,transition:he()};function he(){if(Ae||Ue&&_.current.newIndex===S)return Ws;if(!(R&&!ot(z)||!u)&&(D||ce))return fe.Transition.toString({...u,property:Rn})}}function Ks(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}k.Down,k.Right,k.Up,k.Left;const zn=(...e)=>e.filter(Boolean).join(" ");function Ln({card:e}){const{attributes:n,listeners:t,setNodeRef:r,transform:s,transition:o,isDragging:i}=mt({id:e.id}),a={transform:fe.Transform.toString(s),transition:o,opacity:i?.5:void 0};return w.jsx("div",{ref:r,style:a,...n,...t,children:w.jsxs(B.Card,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",children:[w.jsxs(B.CardHeader,{className:"p-4",children:[w.jsx(B.CardTitle,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&w.jsx(B.CardDescription,{className:"text-xs text-muted-foreground font-mono",children:e.description})]}),e.badges&&e.badges.length>0&&w.jsx(B.CardContent,{className:"p-4 pt-0",children:w.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((l,u)=>w.jsx(B.Badge,{variant:l.variant||"default",className:"text-xs",children:l.label},u))})})]})})}function Us({column:e,cards:n}){const t=n||[],{setNodeRef:r}=mt({id:e.id,data:{type:"column"}}),s=e.limit&&t.length>=e.limit;return w.jsxs("div",{ref:r,className:zn("flex flex-col w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl",e.className),children:[w.jsx("div",{className:"p-4 border-b border-border/50 bg-muted/20",children:w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase",children:e.title}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[t.length,e.limit&&` / ${e.limit}`]}),s&&w.jsx(B.Badge,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),w.jsx(B.ScrollArea,{className:"flex-1 p-4",children:w.jsx(_n,{items:t.map(o=>o.id),strategy:In,children:w.jsx("div",{className:"space-y-2",children:t.map(o=>w.jsx(Ln,{card:o},o.id))})})})]})}function qs({columns:e,onCardMove:n,className:t}){const[r,s]=F.useState(null),o=F.useMemo(()=>(e||[]).map(C=>({...C,cards:C.cards||[]})),[e]),[i,a]=F.useState(o);F.useEffect(()=>{a(o)},[o]);const l=Jt(Ht(lt,{activationConstraint:{distance:8}})),u=C=>{const{active:b}=C,x=f(b.id);s(x)},d=C=>{const{active:b,over:x}=C;if(s(null),!x)return;const y=b.id,v=x.id;if(y===v)return;const m=g(y),S=g(v)||p(v);if(!(!m||!S))if(m.id===S.id){const E=[...m.cards],T=E.findIndex(A=>A.id===y),O=E.findIndex(A=>A.id===v),N=ht(E,T,O);a(A=>A.map(I=>I.id===m.id?{...I,cards:N}:I))}else{const E=[...m.cards],T=[...S.cards],O=E.findIndex(M=>M.id===y),A=v===S.id?T.length:T.findIndex(M=>M.id===v),[I]=E.splice(O,1);T.splice(A,0,I),a(M=>M.map(z=>z.id===m.id?{...z,cards:E}:z.id===S.id?{...z,cards:T}:z)),n&&n(y,m.id,S.id,A)}},f=F.useCallback(C=>{for(const b of i){const x=b.cards.find(y=>y.id===C);if(x)return x}return null},[i]),g=F.useCallback(C=>i.find(b=>b.cards.some(x=>x.id===C))||null,[i]),p=F.useCallback(C=>i.find(b=>b.id===C)||null,[i]);return w.jsxs(Dn,{sensors:l,collisionDetection:Zt,onDragStart:u,onDragEnd:d,children:[w.jsx("div",{className:zn("flex gap-4 overflow-x-auto p-4",t),children:i.map(C=>w.jsx(Us,{column:C,cards:C.cards},C.id))}),w.jsx(An,{children:r?w.jsx(Ln,{card:r}):null})]})}const Xs=Object.freeze(Object.defineProperty({__proto__:null,default:qs},Symbol.toStringTag,{value:"Module"}));function Te(e,n,t){let r=t.initialDeps??[],s,o=!0;function i(){var a,l,u;let d;t.key&&((a=t.debug)!=null&&a.call(t))&&(d=Date.now());const f=e();if(!(f.length!==r.length||f.some((C,b)=>r[b]!==C)))return s;r=f;let p;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(p=Date.now()),s=n(...f),t.key&&((u=t.debug)!=null&&u.call(t))){const C=Math.round((Date.now()-d)*100)/100,b=Math.round((Date.now()-p)*100)/100,x=b/16,y=(v,m)=>{for(v=String(v);v.length<m;)v=" "+v;return v};console.info(`%c⏱ ${y(b,5)} /${y(C,5)} ms`,`
|
|
10
|
+
`},wr={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:t}=e;return t?"Draggable item "+n.id+" was moved over droppable area "+t.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:t}=e;return t?"Draggable item "+n.id+" was dropped over droppable area "+t.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function Cr(e){let{announcements:n=wr,container:t,hiddenTextDescribedById:r,screenReaderInstructions:s=xr}=e;const{announce:i,announcement:a}=vr(),o=Be("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),br(c.useMemo(()=>({onDragStart(f){let{active:g}=f;i(n.onDragStart({active:g}))},onDragMove(f){let{active:g,over:p}=f;n.onDragMove&&i(n.onDragMove({active:g,over:p}))},onDragOver(f){let{active:g,over:p}=f;i(n.onDragOver({active:g,over:p}))},onDragEnd(f){let{active:g,over:p}=f;i(n.onDragEnd({active:g,over:p}))},onDragCancel(f){let{active:g,over:p}=f;i(n.onDragCancel({active:g,over:p}))}}),[i,n])),!l)return null;const d=c.createElement(c.Fragment,null,c.createElement(pr,{id:r,value:s.draggable}),c.createElement(mr,{id:o,announcement:a}));return t?Se.createPortal(d,t):d}var W;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(W||(W={}));function lt(){}function Dt(e,n){return c.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function Jt(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return c.useMemo(()=>[...n].filter(r=>r!=null),[...n])}const ae=Object.freeze({x:0,y:0});function Sr(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function Er(e,n){const t=at(e);if(!t)return"0 0";const r={x:(t.x-n.left)/n.width*100,y:(t.y-n.top)/n.height*100};return r.x+"% "+r.y+"%"}function Dr(e,n){let{data:{value:t}}=e,{data:{value:r}}=n;return t-r}function Or(e,n){let{data:{value:t}}=e,{data:{value:r}}=n;return r-t}function Gt(e){let{left:n,top:t,height:r,width:s}=e;return[{x:n,y:t},{x:n+s,y:t},{x:n,y:t+r},{x:n+s,y:t+r}]}function Nr(e,n){if(!e||e.length===0)return null;const[t]=e;return t[n]}const Zt=e=>{let{collisionRect:n,droppableRects:t,droppableContainers:r}=e;const s=Gt(n),i=[];for(const a of r){const{id:o}=a,l=t.get(o);if(l){const u=Gt(l),d=s.reduce((g,p,N)=>g+Sr(u[N],p),0),f=Number((d/4).toFixed(4));i.push({id:o,data:{droppableContainer:a,value:f}})}}return i.sort(Dr)};function Tr(e,n){const t=Math.max(n.top,e.top),r=Math.max(n.left,e.left),s=Math.min(n.left+n.width,e.left+e.width),i=Math.min(n.top+n.height,e.top+e.height),a=s-r,o=i-t;if(r<s&&t<i){const l=n.width*n.height,u=e.width*e.height,d=a*o,f=d/(l+u-d);return Number(f.toFixed(4))}return 0}const jr=e=>{let{collisionRect:n,droppableRects:t,droppableContainers:r}=e;const s=[];for(const i of r){const{id:a}=i,o=t.get(a);if(o){const l=Tr(o,n);l>0&&s.push({id:a,data:{droppableContainer:i,value:l}})}}return s.sort(Or)};function Ar(e,n,t){return{...e,scaleX:n&&t?n.width/t.width:1,scaleY:n&&t?n.height/t.height:1}}function Qt(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:ae}function Mr(e){return function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((a,o)=>({...a,top:a.top+e*o.y,bottom:a.bottom+e*o.y,left:a.left+e*o.x,right:a.right+e*o.x}),{...t})}}const Ir=Mr(1);function en(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function kr(e,n,t){const r=en(n);if(!r)return e;const{scaleX:s,scaleY:i,x:a,y:o}=r,l=e.left-a-(1-s)*parseFloat(t),u=e.top-o-(1-i)*parseFloat(t.slice(t.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:l+d,bottom:u+f,left:l}}const _r={ignoreTransform:!1};function Ne(e,n){n===void 0&&(n=_r);let t=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:u,transformOrigin:d}=X(e).getComputedStyle(e);u&&(t=kr(t,u,d))}const{top:r,left:s,width:i,height:a,bottom:o,right:l}=t;return{top:r,left:s,width:i,height:a,bottom:o,right:l}}function tn(e){return Ne(e,{ignoreTransform:!0})}function Rr(e){const n=e.innerWidth,t=e.innerHeight;return{top:0,left:0,right:n,bottom:t,width:n,height:t}}function zr(e,n){return n===void 0&&(n=X(e).getComputedStyle(e)),n.position==="fixed"}function Lr(e,n){n===void 0&&(n=X(e).getComputedStyle(e));const t=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=n[s];return typeof i=="string"?t.test(i):!1})}function Ot(e,n){const t=[];function r(s){if(n!=null&&t.length>=n||!s)return t;if(St(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!Pe(s)||Ut(s)||t.includes(s))return t;const i=X(e).getComputedStyle(s);return s!==e&&Lr(s,i)&&t.push(s),zr(s,i)?t:r(s.parentNode)}return e?r(e):t}function nn(e){const[n]=Ot(e,1);return n??null}function Nt(e){return!tt||!e?null:Ee(e)?e:Ct(e)?St(e)||e===De(e).scrollingElement?window:Pe(e)?e:null:null}function rn(e){return Ee(e)?e.scrollX:e.scrollLeft}function sn(e){return Ee(e)?e.scrollY:e.scrollTop}function Tt(e){return{x:rn(e),y:sn(e)}}var V;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(V||(V={}));function on(e){return!tt||!e?!1:e===document.scrollingElement}function an(e){const n={x:0,y:0},t=on(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-t.width,y:e.scrollHeight-t.height},s=e.scrollTop<=n.y,i=e.scrollLeft<=n.x,a=e.scrollTop>=r.y,o=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:o,maxScroll:r,minScroll:n}}const Pr={x:.2,y:.2};function Fr(e,n,t,r,s){let{top:i,left:a,right:o,bottom:l}=t;r===void 0&&(r=10),s===void 0&&(s=Pr);const{isTop:u,isBottom:d,isLeft:f,isRight:g}=an(e),p={x:0,y:0},N={x:0,y:0},w={height:n.height*s.y,width:n.width*s.x};return!u&&i<=n.top+w.height?(p.y=V.Backward,N.y=r*Math.abs((n.top+w.height-i)/w.height)):!d&&l>=n.bottom-w.height&&(p.y=V.Forward,N.y=r*Math.abs((n.bottom-w.height-l)/w.height)),!g&&o>=n.right-w.width?(p.x=V.Forward,N.x=r*Math.abs((n.right-w.width-o)/w.width)):!f&&a<=n.left+w.width&&(p.x=V.Backward,N.x=r*Math.abs((n.left+w.width-a)/w.width)),{direction:p,speed:N}}function $r(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:n,left:t,right:r,bottom:s}=e.getBoundingClientRect();return{top:n,left:t,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function ln(e){return e.reduce((n,t)=>Oe(n,Tt(t)),ae)}function Br(e){return e.reduce((n,t)=>n+rn(t),0)}function Wr(e){return e.reduce((n,t)=>n+sn(t),0)}function cn(e,n){if(n===void 0&&(n=Ne),!e)return;const{top:t,left:r,bottom:s,right:i}=n(e);nn(e)&&(s<=0||i<=0||t>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Vr=[["x",["left","right"],Br],["y",["top","bottom"],Wr]];class jt{constructor(n,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ot(t),s=ln(r);this.rect={...n},this.width=n.width,this.height=n.height;for(const[i,a,o]of Vr)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=o(r),d=s[i]-u;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class We{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(t=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...t)})},this.target=n}add(n,t,r){var s;(s=this.target)==null||s.addEventListener(n,t,r),this.listeners.push([n,t,r])}}function Kr(e){const{EventTarget:n}=X(e);return e instanceof n?e:De(e)}function At(e,n){const t=Math.abs(e.x),r=Math.abs(e.y);return typeof n=="number"?Math.sqrt(t**2+r**2)>n:"x"in n&&"y"in n?t>n.x&&r>n.y:"x"in n?t>n.x:"y"in n?r>n.y:!1}var re;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(re||(re={}));function un(e){e.preventDefault()}function Yr(e){e.stopPropagation()}var k;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(k||(k={}));const dn={start:[k.Space,k.Enter],cancel:[k.Esc],end:[k.Space,k.Enter,k.Tab]},Ur=(e,n)=>{let{currentCoordinates:t}=n;switch(e.code){case k.Right:return{...t,x:t.x+25};case k.Left:return{...t,x:t.x-25};case k.Down:return{...t,y:t.y+25};case k.Up:return{...t,y:t.y-25}}};class fn{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:t}}=n;this.props=n,this.listeners=new We(De(t)),this.windowListeners=new We(X(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(re.Resize,this.handleCancel),this.windowListeners.add(re.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(re.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:t}=this.props,r=n.node.current;r&&cn(r),t(ae)}handleKeyDown(n){if(ot(n)){const{active:t,context:r,options:s}=this.props,{keyboardCodes:i=dn,coordinateGetter:a=Ur,scrollBehavior:o="smooth"}=s,{code:l}=n;if(i.end.includes(l)){this.handleEnd(n);return}if(i.cancel.includes(l)){this.handleCancel(n);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:ae;this.referenceCoordinates||(this.referenceCoordinates=d);const f=a(n,{active:t,context:r.current,currentCoordinates:d});if(f){const g=it(f,d),p={x:0,y:0},{scrollableAncestors:N}=r.current;for(const w of N){const y=n.code,{isTop:D,isRight:v,isLeft:C,isBottom:S,maxScroll:b,minScroll:E}=an(w),x=$r(w),O={x:Math.min(y===k.Right?x.right-x.width/2:x.right,Math.max(y===k.Right?x.left:x.left+x.width/2,f.x)),y:Math.min(y===k.Down?x.bottom-x.height/2:x.bottom,Math.max(y===k.Down?x.top:x.top+x.height/2,f.y))},A=y===k.Right&&!v||y===k.Left&&!C,M=y===k.Down&&!S||y===k.Up&&!D;if(A&&O.x!==f.x){const j=w.scrollLeft+g.x,L=y===k.Right&&j<=b.x||y===k.Left&&j>=E.x;if(L&&!g.y){w.scrollTo({left:j,behavior:o});return}L?p.x=w.scrollLeft-j:p.x=y===k.Right?w.scrollLeft-b.x:w.scrollLeft-E.x,p.x&&w.scrollBy({left:-p.x,behavior:o});break}else if(M&&O.y!==f.y){const j=w.scrollTop+g.y,L=y===k.Down&&j<=b.y||y===k.Up&&j>=E.y;if(L&&!g.x){w.scrollTo({top:j,behavior:o});return}L?p.y=w.scrollTop-j:p.y=y===k.Down?w.scrollTop-b.y:w.scrollTop-E.y,p.y&&w.scrollBy({top:-p.y,behavior:o});break}}this.handleMove(n,Oe(it(f,this.referenceCoordinates),p))}}}handleMove(n,t){const{onMove:r}=this.props;n.preventDefault(),r(t)}handleEnd(n){const{onEnd:t}=this.props;n.preventDefault(),this.detach(),t()}handleCancel(n){const{onCancel:t}=this.props;n.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}fn.activators=[{eventName:"onKeyDown",handler:(e,n,t)=>{let{keyboardCodes:r=dn,onActivation:s}=n,{active:i}=t;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const o=i.activatorNode.current;return o&&e.target!==o?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function hn(e){return!!(e&&"distance"in e)}function gn(e){return!!(e&&"delay"in e)}class Mt{constructor(n,t,r){var s;r===void 0&&(r=Kr(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=t;const{event:i}=n,{target:a}=i;this.props=n,this.events=t,this.document=De(a),this.documentListeners=new We(this.document),this.listeners=new We(r),this.windowListeners=new We(X(a)),this.initialCoordinates=(s=at(i))!=null?s:ae,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(re.Resize,this.handleCancel),this.windowListeners.add(re.DragStart,un),this.windowListeners.add(re.VisibilityChange,this.handleCancel),this.windowListeners.add(re.ContextMenu,un),this.documentListeners.add(re.Keydown,this.handleKeydown),t){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gn(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(hn(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,t){const{active:r,onPending:s}=this.props;s(r,n,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:n}=this,{onStart:t}=this.props;n&&(this.activated=!0,this.documentListeners.add(re.Click,Yr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(re.SelectionChange,this.removeTextSelection),t(n))}handleMove(n){var t;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:o}}=i;if(!s)return;const l=(t=at(n))!=null?t:ae,u=it(s,l);if(!r&&o){if(hn(o)){if(o.tolerance!=null&&At(u,o.tolerance))return this.handleCancel();if(At(u,o.distance))return this.handleStart()}if(gn(o)&&At(u,o.tolerance))return this.handleCancel();this.handlePending(o,u);return}n.cancelable&&n.preventDefault(),a(l)}handleEnd(){const{onAbort:n,onEnd:t}=this.props;this.detach(),this.activated||n(this.props.active),t()}handleCancel(){const{onAbort:n,onCancel:t}=this.props;this.detach(),this.activated||n(this.props.active),t()}handleKeydown(n){n.code===k.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const qr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ct extends Mt{constructor(n){const{event:t}=n,r=De(t.target);super(n,qr,r)}}ct.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;return!t.isPrimary||t.button!==0?!1:(r?.({event:t}),!0)}}];const Xr={move:{name:"mousemove"},end:{name:"mouseup"}};var It;(function(e){e[e.RightClick=2]="RightClick"})(It||(It={}));class Hr extends Mt{constructor(n){super(n,Xr,De(n.event.target))}}Hr.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;return t.button===It.RightClick?!1:(r?.({event:t}),!0)}}];const kt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class pn extends Mt{constructor(n){super(n,kt)}static setup(){return window.addEventListener(kt.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(kt.move.name,n)};function n(){}}}pn.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;const{touches:s}=t;return s.length>1?!1:(r?.({event:t}),!0)}}];var Ve;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ve||(Ve={}));var ut;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ut||(ut={}));function Jr(e){let{acceleration:n,activator:t=Ve.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:o=ut.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:g}=e;const p=Zr({delta:f,disabled:!i}),[N,w]=ur(),y=c.useRef({x:0,y:0}),D=c.useRef({x:0,y:0}),v=c.useMemo(()=>{switch(t){case Ve.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ve.DraggableRect:return s}},[t,s,l]),C=c.useRef(null),S=c.useCallback(()=>{const E=C.current;if(!E)return;const x=y.current.x*D.current.x,O=y.current.y*D.current.y;E.scrollBy(x,O)},[]),b=c.useMemo(()=>o===ut.TreeOrder?[...u].reverse():u,[o,u]);c.useEffect(()=>{if(!i||!u.length||!v){w();return}for(const E of b){if(r?.(E)===!1)continue;const x=u.indexOf(E),O=d[x];if(!O)continue;const{direction:A,speed:M}=Fr(E,O,v,n,g);for(const j of["x","y"])p[j][A[j]]||(M[j]=0,A[j]=0);if(M.x>0||M.y>0){w(),C.current=E,N(S,a),y.current=M,D.current=A;return}}y.current={x:0,y:0},D.current={x:0,y:0},w()},[n,S,r,w,i,a,JSON.stringify(v),JSON.stringify(p),N,u,b,d,JSON.stringify(g)])}const Gr={x:{[V.Backward]:!1,[V.Forward]:!1},y:{[V.Backward]:!1,[V.Forward]:!1}};function Zr(e){let{delta:n,disabled:t}=e;const r=st(n);return $e(s=>{if(t||!r||!s)return Gr;const i={x:Math.sign(n.x-r.x),y:Math.sign(n.y-r.y)};return{x:{[V.Backward]:s.x[V.Backward]||i.x===-1,[V.Forward]:s.x[V.Forward]||i.x===1},y:{[V.Backward]:s.y[V.Backward]||i.y===-1,[V.Forward]:s.y[V.Forward]||i.y===1}}},[t,n,r])}function Qr(e,n){const t=n!=null?e.get(n):void 0,r=t?t.node.current:null;return $e(s=>{var i;return n==null?null:(i=r??s)!=null?i:null},[r,n])}function es(e,n){return c.useMemo(()=>e.reduce((t,r)=>{const{sensor:s}=r,i=s.activators.map(a=>({eventName:a.eventName,handler:n(a.handler,r)}));return[...t,...i]},[]),[e,n])}var Ke;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ke||(Ke={}));var _t;(function(e){e.Optimized="optimized"})(_t||(_t={}));const mn=new Map;function ts(e,n){let{dragging:t,dependencies:r,config:s}=n;const[i,a]=c.useState(null),{frequency:o,measure:l,strategy:u}=s,d=c.useRef(e),f=y(),g=Fe(f),p=c.useCallback(function(D){D===void 0&&(D=[]),!g.current&&a(v=>v===null?D:v.concat(D.filter(C=>!v.includes(C))))},[g]),N=c.useRef(null),w=$e(D=>{if(f&&!t)return mn;if(!D||D===mn||d.current!==e||i!=null){const v=new Map;for(let C of e){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){v.set(C.id,C.rect.current);continue}const S=C.node.current,b=S?new jt(l(S),S):null;C.rect.current=b,b&&v.set(C.id,b)}return v}return D},[e,i,t,f,l]);return c.useEffect(()=>{d.current=e},[e]),c.useEffect(()=>{f||p()},[t,f]),c.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),c.useEffect(()=>{f||typeof o!="number"||N.current!==null||(N.current=setTimeout(()=>{p(),N.current=null},o))},[o,f,p,...r]),{droppableRects:w,measureDroppableContainers:p,measuringScheduled:i!=null};function y(){switch(u){case Ke.Always:return!1;case Ke.BeforeDragging:return t;default:return!t}}}function Rt(e,n){return $e(t=>e?t||(typeof n=="function"?n(e):e):null,[n,e])}function ns(e,n){return Rt(e,n)}function rs(e){let{callback:n,disabled:t}=e;const r=nt(n),s=c.useMemo(()=>{if(t||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,t]);return c.useEffect(()=>()=>s?.disconnect(),[s]),s}function dt(e){let{callback:n,disabled:t}=e;const r=nt(n),s=c.useMemo(()=>{if(t||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[t]);return c.useEffect(()=>()=>s?.disconnect(),[s]),s}function ss(e){return new jt(Ne(e),e)}function vn(e,n,t){n===void 0&&(n=ss);const[r,s]=c.useState(null);function i(){s(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??t)!=null?u:null}const d=n(e);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const a=rs({callback(l){if(e)for(const u of l){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),o=dt({callback:i});return oe(()=>{i(),e?(o?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),a?.disconnect())},[e]),r}function is(e){const n=Rt(e);return Qt(e,n)}const bn=[];function os(e){const n=c.useRef(e),t=$e(r=>e?r&&r!==bn&&e&&n.current&&e.parentNode===n.current.parentNode?r:Ot(e):bn,[e]);return c.useEffect(()=>{n.current=e},[e]),t}function as(e){const[n,t]=c.useState(null),r=c.useRef(e),s=c.useCallback(i=>{const a=Nt(i.target);a&&t(o=>o?(o.set(a,Tt(a)),new Map(o)):null)},[]);return c.useEffect(()=>{const i=r.current;if(e!==i){a(i);const o=e.map(l=>{const u=Nt(l);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,Tt(u)]):null}).filter(l=>l!=null);t(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(i)};function a(o){o.forEach(l=>{const u=Nt(l);u?.removeEventListener("scroll",s)})}},[s,e]),c.useMemo(()=>e.length?n?Array.from(n.values()).reduce((i,a)=>Oe(i,a),ae):ln(e):ae,[e,n])}function yn(e,n){n===void 0&&(n=[]);const t=c.useRef(null);return c.useEffect(()=>{t.current=null},n),c.useEffect(()=>{const r=e!==ae;r&&!t.current&&(t.current=e),!r&&t.current&&(t.current=null)},[e]),t.current?it(e,t.current):ae}function ls(e){c.useEffect(()=>{if(!tt)return;const n=e.map(t=>{let{sensor:r}=t;return r.setup==null?void 0:r.setup()});return()=>{for(const t of n)t?.()}},e.map(n=>{let{sensor:t}=n;return t}))}function cs(e,n){return c.useMemo(()=>e.reduce((t,r)=>{let{eventName:s,handler:i}=r;return t[s]=a=>{i(a,n)},t},{}),[e,n])}function xn(e){return c.useMemo(()=>e?Rr(e):null,[e])}const wn=[];function us(e,n){n===void 0&&(n=Ne);const[t]=e,r=xn(t?X(t):null),[s,i]=c.useState(wn);function a(){i(()=>e.length?e.map(l=>on(l)?r:new jt(n(l),l)):wn)}const o=dt({callback:a});return oe(()=>{o?.disconnect(),a(),e.forEach(l=>o?.observe(l))},[e]),s}function Cn(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return Pe(n)?n:e}function ds(e){let{measure:n}=e;const[t,r]=c.useState(null),s=c.useCallback(u=>{for(const{target:d}of u)if(Pe(d)){r(f=>{const g=n(d);return f?{...f,width:g.width,height:g.height}:g});break}},[n]),i=dt({callback:s}),a=c.useCallback(u=>{const d=Cn(u);i?.disconnect(),d&&i?.observe(d),r(d?n(d):null)},[n,i]),[o,l]=rt(a);return c.useMemo(()=>({nodeRef:o,rect:t,setRef:l}),[t,o,l])}const fs=[{sensor:ct,options:{}},{sensor:fn,options:{}}],hs={current:{}},ft={draggable:{measure:tn},droppable:{measure:tn,strategy:Ke.WhileDragging,frequency:_t.Optimized},dragOverlay:{measure:Ne}};class Ye extends Map{get(n){var t;return n!=null&&(t=super.get(n))!=null?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:t}=n;return!t})}getNodeFor(n){var t,r;return(t=(r=this.get(n))==null?void 0:r.node.current)!=null?t:void 0}}const gs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ye,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ft,measureDroppableContainers:lt,windowRect:null,measuringScheduled:!1},Sn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:lt,draggableNodes:new Map,over:null,measureDroppableContainers:lt},Ue=c.createContext(Sn),En=c.createContext(gs);function ps(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ye}}}function ms(e,n){switch(n.type){case W.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case W.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case W.DragEnd:case W.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case W.RegisterDroppable:{const{element:t}=n,{id:r}=t,s=new Ye(e.droppable.containers);return s.set(r,t),{...e,droppable:{...e.droppable,containers:s}}}case W.SetDroppableDisabled:{const{id:t,key:r,disabled:s}=n,i=e.droppable.containers.get(t);if(!i||r!==i.key)return e;const a=new Ye(e.droppable.containers);return a.set(t,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:a}}}case W.UnregisterDroppable:{const{id:t,key:r}=n,s=e.droppable.containers.get(t);if(!s||r!==s.key)return e;const i=new Ye(e.droppable.containers);return i.delete(t),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function vs(e){let{disabled:n}=e;const{active:t,activatorEvent:r,draggableNodes:s}=c.useContext(Ue),i=st(r),a=st(t?.id);return c.useEffect(()=>{if(!n&&!r&&i&&a!=null){if(!ot(i)||document.activeElement===i.target)return;const o=s.get(a);if(!o)return;const{activatorNode:l,node:u}=o;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[l.current,u.current]){if(!d)continue;const f=hr(d);if(f){f.focus();break}}})}},[r,n,s,a,i]),null}function Dn(e,n){let{transform:t,...r}=n;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),t):t}function bs(e){return c.useMemo(()=>({draggable:{...ft.draggable,...e?.draggable},droppable:{...ft.droppable,...e?.droppable},dragOverlay:{...ft.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function ys(e){let{activeNode:n,measure:t,initialRect:r,config:s=!0}=e;const i=c.useRef(!1),{x:a,y:o}=typeof s=="boolean"?{x:s,y:s}:s;oe(()=>{if(!a&&!o||!n){i.current=!1;return}if(i.current||!r)return;const u=n?.node.current;if(!u||u.isConnected===!1)return;const d=t(u),f=Qt(d,r);if(a||(f.x=0),o||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=nn(u);g&&g.scrollBy({top:f.y,left:f.x})}},[n,a,o,r,t])}const ht=c.createContext({...ae,scaleX:1,scaleY:1});var pe;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(pe||(pe={}));const On=c.memo(function(n){var t,r,s,i;let{id:a,accessibility:o,autoScroll:l=!0,children:u,sensors:d=fs,collisionDetection:f=jr,measuring:g,modifiers:p,...N}=n;const w=c.useReducer(ms,void 0,ps),[y,D]=w,[v,C]=yr(),[S,b]=c.useState(pe.Uninitialized),E=S===pe.Initialized,{draggable:{active:x,nodes:O,translate:A},droppable:{containers:M}}=y,j=x!=null?O.get(x):null,L=c.useRef({initial:null,translated:null}),R=c.useMemo(()=>{var q;return x!=null?{id:x,data:(q=j?.data)!=null?q:hs,rect:L}:null},[x,j]),P=c.useRef(null),[H,Z]=c.useState(null),[Y,Ce]=c.useState(null),se=Fe(N,Object.values(N)),me=Be("DndDescribedBy",a),h=c.useMemo(()=>M.getEnabled(),[M]),T=bs(g),{droppableRects:I,measureDroppableContainers:z,measuringScheduled:le}=ts(h,{dragging:E,dependencies:[A.x,A.y],config:T.droppable}),U=Qr(O,x),F=c.useMemo(()=>Y?at(Y):null,[Y]),J=Ni(),Q=ns(U,T.draggable.measure);ys({activeNode:x!=null?O.get(x):null,config:J.layoutShiftCompensation,initialRect:Q,measure:T.draggable.measure});const _=vn(U,T.draggable.measure,Q),qe=vn(U?U.parentElement:null),ce=c.useRef({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=M.getNodeFor((t=ce.current.over)==null?void 0:t.id),he=ds({measure:T.dragOverlay.measure}),Ae=(r=he.nodeRef.current)!=null?r:U,Me=E?(s=he.rect)!=null?s:_:null,Hn=!!(he.nodeRef.current&&he.rect),Jn=is(Hn?null:_),Ft=xn(Ae?X(Ae):null),ve=os(E?je??U:null),bt=us(ve),yt=Dn(p,{transform:{x:A.x-Jn.x,y:A.y-Jn.y,scaleX:1,scaleY:1},activatorEvent:Y,active:R,activeNodeRect:_,containerNodeRect:qe,draggingNodeRect:Me,over:ce.current.over,overlayNodeRect:he.rect,scrollableAncestors:ve,scrollableAncestorRects:bt,windowRect:Ft}),Gn=F?Oe(F,A):null,Zn=as(ve),xi=yn(Zn),wi=yn(Zn,[_]),Ie=Oe(yt,xi),ke=Me?Ir(Me,yt):null,Xe=R&&ke?f({active:R,collisionRect:ke,droppableRects:I,droppableContainers:h,pointerCoordinates:Gn}):null,Qn=Nr(Xe,"id"),[be,er]=c.useState(null),Ci=Hn?yt:Oe(yt,wi),Si=Ar(Ci,(i=be?.rect)!=null?i:null,_),$t=c.useRef(null),tr=c.useCallback((q,ee)=>{let{sensor:te,options:ye}=ee;if(P.current==null)return;const ie=O.get(P.current);if(!ie)return;const ne=q.nativeEvent,ue=new te({active:P.current,activeNode:ie,event:ne,options:ye,context:ce,onAbort(K){if(!O.get(K))return;const{onDragAbort:de}=se.current,ge={id:K};de?.(ge),v({type:"onDragAbort",event:ge})},onPending(K,xe,de,ge){if(!O.get(K))return;const{onDragPending:Je}=se.current,we={id:K,constraint:xe,initialCoordinates:de,offset:ge};Je?.(we),v({type:"onDragPending",event:we})},onStart(K){const xe=P.current;if(xe==null)return;const de=O.get(xe);if(!de)return;const{onDragStart:ge}=se.current,He={activatorEvent:ne,active:{id:xe,data:de.data,rect:L}};Se.unstable_batchedUpdates(()=>{ge?.(He),b(pe.Initializing),D({type:W.DragStart,initialCoordinates:K,active:xe}),v({type:"onDragStart",event:He}),Z($t.current),Ce(ne)})},onMove(K){D({type:W.DragMove,coordinates:K})},onEnd:_e(W.DragEnd),onCancel:_e(W.DragCancel)});$t.current=ue;function _e(K){return async function(){const{active:de,collisions:ge,over:He,scrollAdjustedTranslate:Je}=ce.current;let we=null;if(de&&Je){const{cancelDrop:Ge}=se.current;we={activatorEvent:ne,active:de,collisions:ge,delta:Je,over:He},K===W.DragEnd&&typeof Ge=="function"&&await Promise.resolve(Ge(we))&&(K=W.DragCancel)}P.current=null,Se.unstable_batchedUpdates(()=>{D({type:K}),b(pe.Uninitialized),er(null),Z(null),Ce(null),$t.current=null;const Ge=K===W.DragEnd?"onDragEnd":"onDragCancel";if(we){const Bt=se.current[Ge];Bt?.(we),v({type:Ge,event:we})}})}}},[O]),Ei=c.useCallback((q,ee)=>(te,ye)=>{const ie=te.nativeEvent,ne=O.get(ye);if(P.current!==null||!ne||ie.dndKit||ie.defaultPrevented)return;const ue={active:ne};q(te,ee.options,ue)===!0&&(ie.dndKit={capturedBy:ee.sensor},P.current=ye,tr(te,ee))},[O,tr]),nr=es(d,Ei);ls(d),oe(()=>{_&&S===pe.Initializing&&b(pe.Initialized)},[_,S]),c.useEffect(()=>{const{onDragMove:q}=se.current,{active:ee,activatorEvent:te,collisions:ye,over:ie}=ce.current;if(!ee||!te)return;const ne={active:ee,activatorEvent:te,collisions:ye,delta:{x:Ie.x,y:Ie.y},over:ie};Se.unstable_batchedUpdates(()=>{q?.(ne),v({type:"onDragMove",event:ne})})},[Ie.x,Ie.y]),c.useEffect(()=>{const{active:q,activatorEvent:ee,collisions:te,droppableContainers:ye,scrollAdjustedTranslate:ie}=ce.current;if(!q||P.current==null||!ee||!ie)return;const{onDragOver:ne}=se.current,ue=ye.get(Qn),_e=ue&&ue.rect.current?{id:ue.id,rect:ue.rect.current,data:ue.data,disabled:ue.disabled}:null,K={active:q,activatorEvent:ee,collisions:te,delta:{x:ie.x,y:ie.y},over:_e};Se.unstable_batchedUpdates(()=>{er(_e),ne?.(K),v({type:"onDragOver",event:K})})},[Qn]),oe(()=>{ce.current={activatorEvent:Y,active:R,activeNode:U,collisionRect:ke,collisions:Xe,droppableRects:I,draggableNodes:O,draggingNode:Ae,draggingNodeRect:Me,droppableContainers:M,over:be,scrollableAncestors:ve,scrollAdjustedTranslate:Ie},L.current={initial:Me,translated:ke}},[R,U,Xe,ke,O,Ae,Me,I,M,be,ve,Ie]),Jr({...J,delta:A,draggingRect:ke,pointerCoordinates:Gn,scrollableAncestors:ve,scrollableAncestorRects:bt});const Di=c.useMemo(()=>({active:R,activeNode:U,activeNodeRect:_,activatorEvent:Y,collisions:Xe,containerNodeRect:qe,dragOverlay:he,draggableNodes:O,droppableContainers:M,droppableRects:I,over:be,measureDroppableContainers:z,scrollableAncestors:ve,scrollableAncestorRects:bt,measuringConfiguration:T,measuringScheduled:le,windowRect:Ft}),[R,U,_,Y,Xe,qe,he,O,M,I,be,z,ve,bt,T,le,Ft]),Oi=c.useMemo(()=>({activatorEvent:Y,activators:nr,active:R,activeNodeRect:_,ariaDescribedById:{draggable:me},dispatch:D,draggableNodes:O,over:be,measureDroppableContainers:z}),[Y,nr,R,_,D,me,O,be,z]);return c.createElement(Ht.Provider,{value:C},c.createElement(Ue.Provider,{value:Oi},c.createElement(En.Provider,{value:Di},c.createElement(ht.Provider,{value:Si},u)),c.createElement(vs,{disabled:o?.restoreFocus===!1})),c.createElement(Cr,{...o,hiddenTextDescribedById:me}));function Ni(){const q=H?.autoScrollEnabled===!1,ee=typeof l=="object"?l.enabled===!1:l===!1,te=E&&!q&&!ee;return typeof l=="object"?{...l,enabled:te}:{enabled:te}}}),xs=c.createContext(null),Nn="button",ws="Draggable";function Cs(e){let{id:n,data:t,disabled:r=!1,attributes:s}=e;const i=Be(ws),{activators:a,activatorEvent:o,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:g}=c.useContext(Ue),{role:p=Nn,roleDescription:N="draggable",tabIndex:w=0}=s??{},y=l?.id===n,D=c.useContext(y?ht:xs),[v,C]=rt(),[S,b]=rt(),E=cs(a,n),x=Fe(t);oe(()=>(f.set(n,{id:n,key:i,node:v,activatorNode:S,data:x}),()=>{const A=f.get(n);A&&A.key===i&&f.delete(n)}),[f,n]);const O=c.useMemo(()=>({role:p,tabIndex:w,"aria-disabled":r,"aria-pressed":y&&p===Nn?!0:void 0,"aria-roledescription":N,"aria-describedby":d.draggable}),[r,p,w,y,N,d.draggable]);return{active:l,activatorEvent:o,activeNodeRect:u,attributes:O,isDragging:y,listeners:r?void 0:E,node:v,over:g,setNodeRef:C,setActivatorNodeRef:b,transform:D}}function Tn(){return c.useContext(En)}const Ss="Droppable",Es={timeout:25};function Ds(e){let{data:n,disabled:t=!1,id:r,resizeObserverConfig:s}=e;const i=Be(Ss),{active:a,dispatch:o,over:l,measureDroppableContainers:u}=c.useContext(Ue),d=c.useRef({disabled:t}),f=c.useRef(!1),g=c.useRef(null),p=c.useRef(null),{disabled:N,updateMeasurementsFor:w,timeout:y}={...Es,...s},D=Fe(w??r),v=c.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(D.current)?D.current:[D.current]),p.current=null},y)},[y]),C=dt({callback:v,disabled:N||!a}),S=c.useCallback((O,A)=>{C&&(A&&(C.unobserve(A),f.current=!1),O&&C.observe(O))},[C]),[b,E]=rt(S),x=Fe(n);return c.useEffect(()=>{!C||!b.current||(C.disconnect(),f.current=!1,C.observe(b.current))},[b,C]),c.useEffect(()=>(o({type:W.RegisterDroppable,element:{id:r,key:i,disabled:t,node:b,rect:g,data:x}}),()=>o({type:W.UnregisterDroppable,key:i,id:r})),[r]),c.useEffect(()=>{t!==d.current.disabled&&(o({type:W.SetDroppableDisabled,id:r,key:i,disabled:t}),d.current.disabled=t)},[r,i,t,o]),{active:a,rect:g,isOver:l?.id===r,node:b,over:l,setNodeRef:E}}function Os(e){let{animation:n,children:t}=e;const[r,s]=c.useState(null),[i,a]=c.useState(null),o=st(t);return!t&&!r&&o&&s(o),oe(()=>{if(!i)return;const l=r?.key,u=r?.props.id;if(l==null||u==null){s(null);return}Promise.resolve(n(u,i)).then(()=>{s(null)})},[n,r,i]),c.createElement(c.Fragment,null,t,r?c.cloneElement(r,{ref:a}):null)}const Ns={x:0,y:0,scaleX:1,scaleY:1};function Ts(e){let{children:n}=e;return c.createElement(Ue.Provider,{value:Sn},c.createElement(ht.Provider,{value:Ns},n))}const js={position:"fixed",touchAction:"none"},As=e=>ot(e)?"transform 250ms ease":void 0,Ms=c.forwardRef((e,n)=>{let{as:t,activatorEvent:r,adjustScale:s,children:i,className:a,rect:o,style:l,transform:u,transition:d=As}=e;if(!o)return null;const f=s?u:{...u,scaleX:1,scaleY:1},g={...js,width:o.width,height:o.height,top:o.top,left:o.left,transform:fe.Transform.toString(f),transformOrigin:s&&r?Er(r,o):void 0,transition:typeof d=="function"?d(r):d,...l};return c.createElement(t,{className:a,style:g,ref:n},i)}),Is={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:n,final:t}}=e;return[{transform:fe.Transform.toString(n)},{transform:fe.Transform.toString(t)}]},sideEffects:(e=>n=>{let{active:t,dragOverlay:r}=n;const s={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[o,l]of Object.entries(i.active))l!==void 0&&(s[o]=t.node.style.getPropertyValue(o),t.node.style.setProperty(o,l));if(i!=null&&i.dragOverlay)for(const[o,l]of Object.entries(i.dragOverlay))l!==void 0&&r.node.style.setProperty(o,l);return a!=null&&a.active&&t.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(s))t.node.style.setProperty(l,u);a!=null&&a.active&&t.node.classList.remove(a.active)}})({styles:{active:{opacity:"0"}}})};function ks(e){let{config:n,draggableNodes:t,droppableContainers:r,measuringConfiguration:s}=e;return nt((i,a)=>{if(n===null)return;const o=t.get(i);if(!o)return;const l=o.node.current;if(!l)return;const u=Cn(a);if(!u)return;const{transform:d}=X(a).getComputedStyle(a),f=en(d);if(!f)return;const g=typeof n=="function"?n:_s(n);return cn(l,s.draggable.measure),g({active:{id:i,data:o.data,node:l,rect:s.draggable.measure(l)},draggableNodes:t,dragOverlay:{node:a,rect:s.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:s,transform:f})})}function _s(e){const{duration:n,easing:t,sideEffects:r,keyframes:s}={...Is,...e};return i=>{let{active:a,dragOverlay:o,transform:l,...u}=i;if(!n)return;const d={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},f={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/o.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/o.rect.height:1},g={x:l.x-d.x,y:l.y-d.y,...f},p=s({...u,active:a,dragOverlay:o,transform:{initial:l,final:g}}),[N]=p,w=p[p.length-1];if(JSON.stringify(N)===JSON.stringify(w))return;const y=r?.({active:a,dragOverlay:o,...u}),D=o.node.animate(p,{duration:n,easing:t,fill:"forwards"});return new Promise(v=>{D.onfinish=()=>{y?.(),v()}})}}let jn=0;function Rs(e){return c.useMemo(()=>{if(e!=null)return jn++,jn},[e])}const An=c.memo(e=>{let{adjustScale:n=!1,children:t,dropAnimation:r,style:s,transition:i,modifiers:a,wrapperElement:o="div",className:l,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:g,containerNodeRect:p,draggableNodes:N,droppableContainers:w,dragOverlay:y,over:D,measuringConfiguration:v,scrollableAncestors:C,scrollableAncestorRects:S,windowRect:b}=Tn(),E=c.useContext(ht),x=Rs(f?.id),O=Dn(a,{activatorEvent:d,active:f,activeNodeRect:g,containerNodeRect:p,draggingNodeRect:y.rect,over:D,overlayNodeRect:y.rect,scrollableAncestors:C,scrollableAncestorRects:S,transform:E,windowRect:b}),A=Rt(g),M=ks({config:r,draggableNodes:N,droppableContainers:w,measuringConfiguration:v}),j=A?y.setRef:void 0;return c.createElement(Ts,null,c.createElement(Os,{animation:M},f&&x?c.createElement(Ms,{key:x,id:f.id,ref:j,as:o,activatorEvent:d,adjustScale:n,className:l,transition:i,rect:A,style:{zIndex:u,...s},transform:O},t):null))});function gt(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function zs(e,n){return e.reduce((t,r,s)=>{const i=n.get(r);return i&&(t[s]=i),t},Array(e.length))}function pt(e){return e!==null&&e>=0}function Ls(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Ps(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Mn=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const i=gt(n,r,t),a=n[s],o=i[s];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},mt={scaleX:1,scaleY:1},In=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:i,overIndex:a}=e;const o=(n=i[t])!=null?n:r;if(!o)return null;if(s===t){const u=i[a];return u?{x:0,y:t<a?u.top+u.height-(o.top+o.height):u.top-o.top,...mt}:null}const l=Fs(i,s,t);return s>t&&s<=a?{x:0,y:-o.height-l,...mt}:s<t&&s>=a?{x:0,y:o.height+l,...mt}:{x:0,y:0,...mt}};function Fs(e,n,t){const r=e[n],s=e[n-1],i=e[n+1];return r?t<n?s?r.top-(s.top+s.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const kn="Sortable",_n=c.createContext({activeIndex:-1,containerId:kn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Mn,disabled:{draggable:!1,droppable:!1}});function Rn(e){let{children:n,id:t,items:r,strategy:s=Mn,disabled:i=!1}=e;const{active:a,dragOverlay:o,droppableRects:l,over:u,measureDroppableContainers:d}=Tn(),f=Be(kn,t),g=o.rect!==null,p=c.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),N=a!=null,w=a?p.indexOf(a.id):-1,y=u?p.indexOf(u.id):-1,D=c.useRef(p),v=!Ls(p,D.current),C=y!==-1&&w===-1||v,S=Ps(i);oe(()=>{v&&N&&d(p)},[v,p,N,d]),c.useEffect(()=>{D.current=p},[p]);const b=c.useMemo(()=>({activeIndex:w,containerId:f,disabled:S,disableTransforms:C,items:p,overIndex:y,useDragOverlay:g,sortedRects:zs(p,l),strategy:s}),[w,f,S.draggable,S.droppable,C,p,y,l,g,s]);return c.createElement(_n.Provider,{value:b},n)}const $s=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return gt(t,r,s).indexOf(n)},Bs=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:i,newIndex:a,previousItems:o,previousContainerId:l,transition:u}=e;return!u||!r||o!==i&&s===a?!1:t?!0:a!==s&&n===l},Ws={duration:200,easing:"ease"},zn="transform",Vs=fe.Transition.toString({property:zn,duration:0,easing:"linear"}),Ks={roleDescription:"sortable"};function Ys(e){let{disabled:n,index:t,node:r,rect:s}=e;const[i,a]=c.useState(null),o=c.useRef(t);return oe(()=>{if(!n&&t!==o.current&&r.current){const l=s.current;if(l){const u=Ne(r.current,{ignoreTransform:!0}),d={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(d.x||d.y)&&a(d)}}t!==o.current&&(o.current=t)},[n,t,r,s]),c.useEffect(()=>{i&&a(null)},[i]),i}function vt(e){let{animateLayoutChanges:n=Bs,attributes:t,disabled:r,data:s,getNewIndex:i=$s,id:a,strategy:o,resizeObserverConfig:l,transition:u=Ws}=e;const{items:d,containerId:f,activeIndex:g,disabled:p,disableTransforms:N,sortedRects:w,overIndex:y,useDragOverlay:D,strategy:v}=c.useContext(_n),C=Us(r,p),S=d.indexOf(a),b=c.useMemo(()=>({sortable:{containerId:f,index:S,items:d},...s}),[f,s,S,d]),E=c.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:x,node:O,isOver:A,setNodeRef:M}=Ds({id:a,data:b,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:j,activatorEvent:L,activeNodeRect:R,attributes:P,setNodeRef:H,listeners:Z,isDragging:Y,over:Ce,setActivatorNodeRef:se,transform:me}=Cs({id:a,data:b,attributes:{...Ks,...t},disabled:C.draggable}),h=cr(M,H),T=!!j,I=T&&!N&&pt(g)&&pt(y),z=!D&&Y,le=z&&I?me:null,F=I?le??(o??v)({rects:w,activeNodeRect:R,activeIndex:g,overIndex:y,index:S}):null,J=pt(g)&&pt(y)?i({id:a,items:d,activeIndex:g,overIndex:y}):S,Q=j?.id,_=c.useRef({activeId:Q,items:d,newIndex:J,containerId:f}),qe=d!==_.current.items,ce=n({active:j,containerId:f,isDragging:Y,isSorting:T,id:a,index:S,items:d,newIndex:_.current.newIndex,previousItems:_.current.items,previousContainerId:_.current.containerId,transition:u,wasDragging:_.current.activeId!=null}),je=Ys({disabled:!ce,index:S,node:O,rect:x});return c.useEffect(()=>{T&&_.current.newIndex!==J&&(_.current.newIndex=J),f!==_.current.containerId&&(_.current.containerId=f),d!==_.current.items&&(_.current.items=d)},[T,J,f,d]),c.useEffect(()=>{if(Q===_.current.activeId)return;if(Q!=null&&_.current.activeId==null){_.current.activeId=Q;return}const Ae=setTimeout(()=>{_.current.activeId=Q},50);return()=>clearTimeout(Ae)},[Q]),{active:j,activeIndex:g,attributes:P,data:b,rect:x,index:S,newIndex:J,items:d,isOver:A,isSorting:T,isDragging:Y,listeners:Z,node:O,overIndex:y,over:Ce,setNodeRef:h,setActivatorNodeRef:se,setDroppableNodeRef:M,setDraggableNodeRef:H,transform:je??F,transition:he()};function he(){if(je||qe&&_.current.newIndex===S)return Vs;if(!(z&&!ot(L)||!u)&&(T||ce))return fe.Transition.toString({...u,property:zn})}}function Us(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}k.Down,k.Right,k.Up,k.Left;const Ln=(...e)=>e.filter(Boolean).join(" ");function Pn({card:e,onCardClick:n}){const{attributes:t,listeners:r,setNodeRef:s,transform:i,transition:a,isDragging:o}=vt({id:e.id}),l={transform:fe.Transform.toString(i),transition:a,opacity:o?.5:void 0};return m.jsx("div",{ref:s,style:l,...t,...r,role:"listitem","aria-label":e.title,onClick:()=>n?.(e),children:m.jsxs($.Card,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",children:[m.jsxs($.CardHeader,{className:"p-2 sm:p-4",children:[m.jsx($.CardTitle,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&m.jsx($.CardDescription,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:e.description})]}),e.badges&&e.badges.length>0&&m.jsx($.CardContent,{className:"p-2 sm:p-4 pt-0",children:m.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((u,d)=>m.jsx($.Badge,{variant:u.variant||"default",className:"text-xs",children:u.label},d))})})]})})}function qs({column:e,cards:n,onCardClick:t}){const r=n||[],{setNodeRef:s}=vt({id:e.id,data:{type:"column"}}),i=e.limit&&r.length>=e.limit;return m.jsxs("div",{ref:s,role:"group","aria-label":e.title,className:Ln("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",e.className),children:[m.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/20",children:m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("h3",{id:`kanban-col-${e.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:e.title}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("span",{className:"font-mono text-xs text-muted-foreground","aria-label":`${r.length} cards${e.limit?` of ${e.limit} maximum`:""}`,children:[r.length,e.limit&&` / ${e.limit}`]}),i&&m.jsx($.Badge,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),m.jsx($.ScrollArea,{className:"flex-1 p-4",children:m.jsx(Rn,{items:r.map(a=>a.id),strategy:In,children:m.jsx("div",{className:"space-y-2",role:"list","aria-label":`${e.title} cards`,children:r.map(a=>m.jsx(Pn,{card:a,onCardClick:t},a.id))})})})]})}function Xs({children:e}){const n=Re.useDnd();return m.jsx(m.Fragment,{children:e(n)})}function Hs({columns:e,onCardMove:n,onCardClick:t,className:r}){return Re.useHasDndProvider()?m.jsx(Xs,{children:i=>m.jsx(Fn,{columns:e,onCardMove:n,onCardClick:t,className:r,dnd:i})}):m.jsx(Fn,{columns:e,onCardMove:n,onCardClick:t,className:r,dnd:null})}function Fn({columns:e,onCardMove:n,onCardClick:t,className:r,dnd:s}){const[i,a]=B.useState(null),o=B.useMemo(()=>(e||[]).map(y=>({...y,cards:y.cards||[]})),[e]),[l,u]=B.useState(o);B.useEffect(()=>{u(o)},[o]);const d=Jt(Dt(ct,{activationConstraint:{distance:5}}),Dt(pn,{activationConstraint:{delay:200,tolerance:5}})),f=y=>{const{active:D}=y,v=p(D.id);if(a(v),s&&v){const C=N(v.id);C&&s.startDrag({id:v.id,type:"kanban-card",data:v,sourceId:C.id})}},g=y=>{const{active:D,over:v}=y;if(a(null),!v){s&&s.endDrag();return}const C=D.id,S=v.id;if(C===S){s&&s.endDrag();return}const b=N(C),E=N(S)||w(S);if(!b||!E){s&&s.endDrag();return}if(b.id===E.id){const x=[...b.cards],O=x.findIndex(j=>j.id===C),A=x.findIndex(j=>j.id===S),M=gt(x,O,A);u(j=>j.map(L=>L.id===b.id?{...L,cards:M}:L))}else{const x=[...b.cards],O=[...E.cards],A=x.findIndex(R=>R.id===C),j=S===E.id?O.length:O.findIndex(R=>R.id===S),[L]=x.splice(A,1);O.splice(j,0,L),u(R=>R.map(P=>P.id===b.id?{...P,cards:x}:P.id===E.id?{...P,cards:O}:P)),n&&n(C,b.id,E.id,j)}s&&s.endDrag(E.id)},p=B.useCallback(y=>{for(const D of l){const v=D.cards.find(C=>C.id===y);if(v)return v}return null},[l]),N=B.useCallback(y=>l.find(D=>D.cards.some(v=>v.id===y))||null,[l]),w=B.useCallback(y=>l.find(D=>D.id===y)||null,[l]);return m.jsxs(On,{sensors:d,collisionDetection:Zt,onDragStart:f,onDragEnd:g,children:[m.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[m.jsxs("span",{children:[l.length," columns"]}),m.jsx("span",{children:"← Swipe to navigate →"})]}),m.jsx("div",{className:Ln("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 [-webkit-overflow-scrolling:touch]",r),role:"region","aria-label":"Kanban board",children:l.map(y=>m.jsx(qs,{column:y,cards:y.cards,onCardClick:t},y.id))}),m.jsx(An,{children:m.jsx("div",{"aria-live":"assertive","aria-label":i?`Dragging ${i.title}`:void 0,children:i?m.jsx(Pn,{card:i}):null})})]})}const Js=Object.freeze(Object.defineProperty({__proto__:null,default:Hs},Symbol.toStringTag,{value:"Module"}));function Te(e,n,t){let r=t.initialDeps??[],s,i=!0;function a(){var o,l,u;let d;t.key&&((o=t.debug)!=null&&o.call(t))&&(d=Date.now());const f=e();if(!(f.length!==r.length||f.some((N,w)=>r[w]!==N)))return s;r=f;let p;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(p=Date.now()),s=n(...f),t.key&&((u=t.debug)!=null&&u.call(t))){const N=Math.round((Date.now()-d)*100)/100,w=Math.round((Date.now()-p)*100)/100,y=w/16,D=(v,C)=>{for(v=String(v);v.length<C;)v=" "+v;return v};console.info(`%c⏱ ${D(w,5)} /${D(N,5)} ms`,`
|
|
11
11
|
font-size: .6rem;
|
|
12
12
|
font-weight: bold;
|
|
13
|
-
color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(s),o=!1,s}return i.updateDeps=a=>{r=a},i}function Pn(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Hs=(e,n)=>Math.abs(e-n)<1.01,Js=(e,n,t)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,s),t)}},Fn=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},Gs=e=>e,Zs=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=n;s<=t;s++)r.push(s);return r},Qs=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;const s=i=>{const{width:a,height:l}=i;n({width:Math.round(a),height:Math.round(l)})};if(s(Fn(t)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const a=()=>{const l=i[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(Fn(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Bn={passive:!0},$n=typeof window>"u"?!0:"onscrollend"in window,eo=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;let s=0;const o=e.options.useScrollendEvent&&$n?()=>{}:Js(r,()=>{n(s,!1)},e.options.isScrollingResetDelay),i=d=>()=>{const{horizontal:f,isRtl:g}=e.options;s=f?t.scrollLeft*(g&&-1||1):t.scrollTop,o(),n(s,d)},a=i(!0),l=i(!1);t.addEventListener("scroll",a,Bn);const u=e.options.useScrollendEvent&&$n;return u&&t.addEventListener("scrollend",l,Bn),()=>{t.removeEventListener("scroll",a),u&&t.removeEventListener("scrollend",l)}},to=(e,n,t)=>{if(n?.borderBoxSize){const r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},no=(e,{adjustments:n=0,behavior:t},r)=>{var s,o;const i=e+n;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:t})};class ro{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Gs,rangeExtractor:Zs,onChange:()=>{},measureElement:to,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=Te(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const s=new Map,o=new Map;for(let i=r-1;i>=0;i--){const a=t[i];if(s.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&s.set(a.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Te(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,r,s,o,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=Te(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i,lanes:a},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const g of this.laneAssignments.keys())g>=t&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,u),f=new Array(a).fill(void 0);for(let g=0;g<u;g++){const p=d[g];p&&(f[p.lane]=g)}for(let g=u;g<t;g++){const p=o(g),C=this.laneAssignments.get(g);let b,x;if(C!==void 0&&this.options.lanes>1){b=C;const S=f[b],E=S!==void 0?d[S]:void 0;x=E?E.end+this.options.gap:r+s}else{const S=this.options.lanes===1?d[g-1]:this.getFurthestMeasurement(d,g);x=S?S.end+this.options.gap:r+s,b=S?S.lane:g%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(g,b)}const y=l.get(p),v=typeof y=="number"?y:this.options.estimateSize(g),m=x+v;d[g]={index:g,start:x,size:v,end:m,key:p,lane:b},f[b]=g}return this.measurementsCache=d,d},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Te(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,o)=>this.range=t.length>0&&r>0?so({measurements:t,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Te(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,o,i)=>o===null||i===null?[]:t({startIndex:o,endIndex:i,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{const s=this.indexFromElement(t),o=this.measurementsCache[s];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==t&&(a&&this.observer.unobserve(a),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const s=this.measurementsCache[t];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,i=r-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,i,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=Te(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let o=0,i=t.length;o<i;o++){const a=t[o],l=r[a];s.push(l)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return Pn(r[Wn(0,r.length-1,s=>Pn(r[s]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,r,s=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=t>=i+o?"end":"start"),r==="center"?t+=(s-o)/2:r==="end"&&(t-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.measurementsCache[t];if(!s)return;const o=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(t,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1)),this.currentScrollToIndex=t;let o=0;const i=10,a=u=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(t,u);if(!d){console.warn("Failed to get offset for index:",t);return}const[f,g]=d;this._scrollToOffset(f,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const p=()=>{if(this.currentScrollToIndex!==t)return;const C=this.getScrollOffset(),b=this.getOffsetForIndex(t,g);if(!b){console.warn("Failed to get offset for index:",t);return}Hs(b[0],C)||l(g)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(p):p()})},l=u=>{this.targetWindow&&this.currentScrollToIndex===t&&(o++,o<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",o,i),this.targetWindow.requestAnimationFrame(()=>a(u))):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};a(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&o.some(a=>a===null);){const a=r[i];o[a.lane]===null&&(o[a.lane]=a.end),i--}s=Math.max(...o.filter(a=>a!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(n)}}const Wn=(e,n,t,r)=>{for(;e<=n;){const s=(e+n)/2|0,o=t(s);if(o<r)e=s+1;else if(o>r)n=s-1;else return s}return e>0?e-1:0};function so({measurements:e,outerSize:n,scrollOffset:t,lanes:r}){const s=e.length-1,o=l=>e[l].start;if(e.length<=r)return{startIndex:0,endIndex:s};let i=Wn(0,s,o,t),a=i;if(r===1)for(;a<s&&e[a].end<t+n;)a++;else if(r>1){const l=Array(r).fill(0);for(;a<s&&l.some(d=>d<t+n);){const d=e[a];l[d.lane]=d.end,a++}const u=Array(r).fill(t+n);for(;i>=0&&u.some(d=>d>=t);){const d=e[i];u[d.lane]=d.start,i--}i=Math.max(0,i-i%r),a=Math.min(s,a+(r-1-a%r))}return{startIndex:i,endIndex:a}}const Vn=typeof document<"u"?F.useLayoutEffect:F.useEffect;function oo({useFlushSync:e=!0,...n}){const t=F.useReducer(()=>({}),{})[1],r={...n,onChange:(o,i)=>{var a;e&&i?Se.flushSync(t):t(),(a=n.onChange)==null||a.call(n,o,i)}},[s]=F.useState(()=>new ro(r));return s.setOptions(r),Vn(()=>s._didMount(),[]),Vn(()=>s._willUpdate()),s}function io(e){return oo({observeElementRect:Qs,observeElementOffset:eo,scrollToFn:no,...e})}const Yn=(...e)=>e.filter((n,t,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===t).join(" ").trim();const ao=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const lo=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,t,r)=>r?r.toUpperCase():t.toLowerCase());const Kn=e=>{const n=lo(e);return n.charAt(0).toUpperCase()+n.slice(1)};var co={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const uo=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const fo=c.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...a},l)=>c.createElement("svg",{ref:l,...co,width:n,height:n,stroke:e,strokeWidth:r?Number(t)*24/Number(n):t,className:Yn("lucide",s),...!o&&!uo(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,d])=>c.createElement(u,d)),...Array.isArray(o)?o:[o]]));const _t=(e,n)=>{const t=c.forwardRef(({className:r,...s},o)=>c.createElement(fo,{ref:o,iconNode:n,className:Yn(`lucide-${ao(Kn(e))}`,`lucide-${e}`,r),...s}));return t.displayName=Kn(e),t};const ho=_t("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const go=_t("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const po=_t("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Rt=(...e)=>e.filter(Boolean).join(" ");function zt({card:e}){const{attributes:n,listeners:t,setNodeRef:r,transform:s,transition:o,isDragging:i}=mt({id:e.id}),a={transform:fe.Transform.toString(s),transition:o,opacity:i?.5:void 0};return w.jsx("div",{ref:r,style:a,...n,...t,children:w.jsxs(B.Card,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",children:[w.jsxs(B.CardHeader,{className:"p-4",children:[w.jsx(B.CardTitle,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&w.jsx(B.CardDescription,{className:"text-xs text-muted-foreground font-mono",children:e.description})]}),e.badges&&e.badges.length>0&&w.jsx(B.CardContent,{className:"p-4 pt-0",children:w.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((l,u)=>w.jsx(B.Badge,{variant:l.variant||"default",className:"text-xs",children:l.label},u))})})]})})}function mo({cards:e,parentRef:n}){const t=io({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>120,overscan:5});return w.jsx("div",{style:{height:`${t.getTotalSize()}px`,width:"100%",position:"relative"},children:t.getVirtualItems().map(r=>{const s=e[r.index];return w.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${r.start}px)`},children:w.jsx(zt,{card:s})},s.id)})})}function vo({column:e,cards:n,onToggle:t,enableVirtual:r}){const s=n||[],o=F.useRef(null),{setNodeRef:i}=mt({id:e.id,data:{type:"column"}}),a=e.limit&&s.length>=e.limit,l=e.limit&&s.length>=e.limit*.8;return w.jsxs("div",{ref:i,className:Rt("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",e.collapsed?"w-16":"w-80",e.className),children:[w.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[w.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[w.jsx(B.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>t(!e.collapsed),children:e.collapsed?w.jsx(go,{className:"h-4 w-4"}):w.jsx(ho,{className:"h-4 w-4"})}),!e.collapsed&&w.jsxs(w.Fragment,{children:[w.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:e.title}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsxs("span",{className:Rt("font-mono text-xs",a?"text-destructive":l?"text-yellow-500":"text-muted-foreground"),children:[s.length,e.limit&&` / ${e.limit}`]}),a&&w.jsx(B.Badge,{variant:"destructive",className:"text-xs",children:"Full"}),l&&!a&&w.jsx(po,{className:"h-3 w-3 text-yellow-500"})]})]})]}),e.collapsed&&w.jsxs("div",{className:"flex flex-col items-center gap-1",children:[w.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:e.title}),w.jsx(B.Badge,{variant:"secondary",className:"text-xs",children:s.length})]})]}),!e.collapsed&&w.jsx("div",{ref:o,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:w.jsx(_n,{items:s.map(u=>u.id),strategy:In,children:r?w.jsx(mo,{cards:s,parentRef:o}):w.jsx("div",{className:"space-y-2",children:s.map(u=>w.jsx(zt,{card:u},u.id))})})})]})}function Un({columns:e,onCardMove:n,onColumnToggle:t,enableVirtualScrolling:r=!1,virtualScrollThreshold:s=50,className:o}){const[i,a]=F.useState(null),l=F.useMemo(()=>(e||[]).map(v=>({...v,cards:v.cards||[]})),[e]),[u,d]=F.useState(l);F.useEffect(()=>{d(l)},[l]);const f=Jt(Ht(lt,{activationConstraint:{distance:8}})),g=v=>{const{active:m}=v,S=C(m.id);a(S)},p=v=>{const{active:m,over:S}=v;if(a(null),!S)return;const E=m.id,T=S.id;if(E===T)return;const O=b(E),N=b(T)||x(T);if(!(!O||!N))if(O.id===N.id){const A=[...O.cards],I=A.findIndex(P=>P.id===E),M=A.findIndex(P=>P.id===T),z=ht(A,I,M);d(P=>P.map(V=>V.id===O.id?{...V,cards:z}:V))}else{const A=[...O.cards],I=[...N.cards],M=A.findIndex(H=>H.id===E),P=T===N.id?I.length:I.findIndex(H=>H.id===T),[V]=A.splice(M,1);I.splice(P,0,V),d(H=>H.map(Z=>Z.id===O.id?{...Z,cards:A}:Z.id===N.id?{...Z,cards:I}:Z)),n&&n(E,O.id,N.id,P)}},C=F.useCallback(v=>{for(const m of u){const S=m.cards.find(E=>E.id===v);if(S)return S}return null},[u]),b=F.useCallback(v=>u.find(m=>m.cards.some(S=>S.id===v))||null,[u]),x=F.useCallback(v=>u.find(m=>m.id===v)||null,[u]),y=F.useCallback((v,m)=>{d(S=>S.map(E=>E.id===v?{...E,collapsed:m}:E)),t?.(v,m)},[t]);return w.jsxs(Dn,{sensors:f,collisionDetection:Zt,onDragStart:g,onDragEnd:p,children:[w.jsx("div",{className:Rt("flex gap-4 overflow-x-auto p-4",o),children:u.map(v=>{const m=r&&v.cards.length>s;return w.jsx(vo,{column:v,cards:v.cards,onToggle:S=>y(v.id,S),enableVirtual:m},v.id)})}),w.jsx(An,{children:i?w.jsx(zt,{card:i}):null})]})}const bo=Object.freeze(Object.defineProperty({__proto__:null,KanbanEnhanced:Un,default:Un},Symbol.toStringTag,{value:"Module"}));G.KanbanRenderer=Qe,G.ObjectKanban=yt,G.ObjectKanbanRenderer=xt,G.kanbanComponents=ir,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})}));
|
|
13
|
+
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(s),i=!1,s}return a.updateDeps=o=>{r=o},a}function $n(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Gs=(e,n)=>Math.abs(e-n)<1.01,Zs=(e,n,t)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,s),t)}},Bn=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},Qs=e=>e,ei=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=n;s<=t;s++)r.push(s);return r},ti=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;const s=a=>{const{width:o,height:l}=a;n({width:Math.round(o),height:Math.round(l)})};if(s(Bn(t)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const o=()=>{const l=a[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(Bn(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},Wn={passive:!0},Vn=typeof window>"u"?!0:"onscrollend"in window,ni=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;let s=0;const i=e.options.useScrollendEvent&&Vn?()=>{}:Zs(r,()=>{n(s,!1)},e.options.isScrollingResetDelay),a=d=>()=>{const{horizontal:f,isRtl:g}=e.options;s=f?t.scrollLeft*(g&&-1||1):t.scrollTop,i(),n(s,d)},o=a(!0),l=a(!1);t.addEventListener("scroll",o,Wn);const u=e.options.useScrollendEvent&&Vn;return u&&t.addEventListener("scrollend",l,Wn),()=>{t.removeEventListener("scroll",o),u&&t.removeEventListener("scrollend",l)}},ri=(e,n,t)=>{if(n?.borderBoxSize){const r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},si=(e,{adjustments:n=0,behavior:t},r)=>{var s,i;const a=e+n;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:t})};class ii{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Qs,rangeExtractor:ei,onChange:()=>{},measureElement:ri,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=Te(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const o=t[a];if(s.has(o.lane))continue;const l=i.get(o.lane);if(l==null||o.end>l.end?i.set(o.lane,o):o.end<l.end&&s.set(o.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,o)=>a.end===o.end?a.index-o.index:a.end-o.end)[0]:void 0},this.getMeasurementOptions=Te(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,r,s,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a,lanes:o}),{key:!1}),this.getMeasurements=Te(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a,lanes:o},l)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const g of this.laneAssignments.keys())g>=t&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,u),f=new Array(o).fill(void 0);for(let g=0;g<u;g++){const p=d[g];p&&(f[p.lane]=g)}for(let g=u;g<t;g++){const p=i(g),N=this.laneAssignments.get(g);let w,y;if(N!==void 0&&this.options.lanes>1){w=N;const S=f[w],b=S!==void 0?d[S]:void 0;y=b?b.end+this.options.gap:r+s}else{const S=this.options.lanes===1?d[g-1]:this.getFurthestMeasurement(d,g);y=S?S.end+this.options.gap:r+s,w=S?S.lane:g%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(g,w)}const D=l.get(p),v=typeof D=="number"?D:this.options.estimateSize(g),C=y+v;d[g]={index:g,start:y,size:v,end:C,key:p,lane:w},f[w]=g}return this.measurementsCache=d,d},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Te(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,i)=>this.range=t.length>0&&r>0?oi({measurements:t,outerSize:r,scrollOffset:s,lanes:i}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Te(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,i,a)=>i===null||a===null?[]:t({startIndex:i,endIndex:a,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{const s=this.indexFromElement(t),i=this.measurementsCache[s];if(!i)return;const a=i.key,o=this.elementsCache.get(a);o!==t&&(o&&this.observer.unobserve(o),this.observer.observe(t),this.elementsCache.set(a,t)),t.isConnected&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const s=this.measurementsCache[t];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",a),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=Te(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let i=0,a=t.length;i<a;i++){const o=t[i],l=r[o];s.push(l)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return $n(r[Kn(0,r.length-1,s=>$n(r[s]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,r,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=t>=a+i?"end":"start"),r==="center"?t+=(s-i)/2:r==="end"&&(t-=i);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.measurementsCache[t];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(t,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1)),this.currentScrollToIndex=t;let i=0;const a=10,o=u=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(t,u);if(!d){console.warn("Failed to get offset for index:",t);return}const[f,g]=d;this._scrollToOffset(f,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const p=()=>{if(this.currentScrollToIndex!==t)return;const N=this.getScrollOffset(),w=this.getOffsetForIndex(t,g);if(!w){console.warn("Failed to get offset for index:",t);return}Gs(w[0],N)||l(g)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(p):p()})},l=u=>{this.targetWindow&&this.currentScrollToIndex===t&&(i++,i<a?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",i,a),this.targetWindow.requestAnimationFrame(()=>o(u))):console.warn(`Failed to scroll to index ${t} after ${a} attempts.`))};o(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(o=>o===null);){const o=r[a];i[o.lane]===null&&(i[o.lane]=o.end),a--}s=Math.max(...i.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(n)}}const Kn=(e,n,t,r)=>{for(;e<=n;){const s=(e+n)/2|0,i=t(s);if(i<r)e=s+1;else if(i>r)n=s-1;else return s}return e>0?e-1:0};function oi({measurements:e,outerSize:n,scrollOffset:t,lanes:r}){const s=e.length-1,i=l=>e[l].start;if(e.length<=r)return{startIndex:0,endIndex:s};let a=Kn(0,s,i,t),o=a;if(r===1)for(;o<s&&e[o].end<t+n;)o++;else if(r>1){const l=Array(r).fill(0);for(;o<s&&l.some(d=>d<t+n);){const d=e[o];l[d.lane]=d.end,o++}const u=Array(r).fill(t+n);for(;a>=0&&u.some(d=>d>=t);){const d=e[a];u[d.lane]=d.start,a--}a=Math.max(0,a-a%r),o=Math.min(s,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}const Yn=typeof document<"u"?B.useLayoutEffect:B.useEffect;function ai({useFlushSync:e=!0,...n}){const t=B.useReducer(()=>({}),{})[1],r={...n,onChange:(i,a)=>{var o;e&&a?Se.flushSync(t):t(),(o=n.onChange)==null||o.call(n,i,a)}},[s]=B.useState(()=>new ii(r));return s.setOptions(r),Yn(()=>s._didMount(),[]),Yn(()=>s._willUpdate()),s}function li(e){return ai({observeElementRect:ti,observeElementOffset:ni,scrollToFn:si,...e})}const Un=(...e)=>e.filter((n,t,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===t).join(" ").trim();const ci=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const ui=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,t,r)=>r?r.toUpperCase():t.toLowerCase());const qn=e=>{const n=ui(e);return n.charAt(0).toUpperCase()+n.slice(1)};var di={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const fi=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const hi=c.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...o},l)=>c.createElement("svg",{ref:l,...di,width:n,height:n,stroke:e,strokeWidth:r?Number(t)*24/Number(n):t,className:Un("lucide",s),...!i&&!fi(o)&&{"aria-hidden":"true"},...o},[...a.map(([u,d])=>c.createElement(u,d)),...Array.isArray(i)?i:[i]]));const zt=(e,n)=>{const t=c.forwardRef(({className:r,...s},i)=>c.createElement(hi,{ref:i,iconNode:n,className:Un(`lucide-${ci(qn(e))}`,`lucide-${e}`,r),...s}));return t.displayName=qn(e),t};const gi=zt("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const pi=zt("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const mi=zt("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Lt=(...e)=>e.filter(Boolean).join(" ");function Pt({card:e}){const{attributes:n,listeners:t,setNodeRef:r,transform:s,transition:i,isDragging:a}=vt({id:e.id}),o={transform:fe.Transform.toString(s),transition:i,opacity:a?.5:void 0};return m.jsx("div",{ref:r,style:o,...n,...t,children:m.jsxs($.Card,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",children:[m.jsxs($.CardHeader,{className:"p-4",children:[m.jsx($.CardTitle,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&m.jsx($.CardDescription,{className:"text-xs text-muted-foreground font-mono",children:e.description})]}),e.badges&&e.badges.length>0&&m.jsx($.CardContent,{className:"p-4 pt-0",children:m.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((l,u)=>m.jsx($.Badge,{variant:l.variant||"default",className:"text-xs",children:l.label},u))})})]})})}function vi({cards:e,parentRef:n}){const t=li({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>120,overscan:5});return m.jsx("div",{style:{height:`${t.getTotalSize()}px`,width:"100%",position:"relative"},children:t.getVirtualItems().map(r=>{const s=e[r.index];return m.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${r.start}px)`},children:m.jsx(Pt,{card:s})},s.id)})})}function bi({column:e,cards:n,onToggle:t,enableVirtual:r}){const s=n||[],i=B.useRef(null),{setNodeRef:a}=vt({id:e.id,data:{type:"column"}}),o=e.limit&&s.length>=e.limit,l=e.limit&&s.length>=e.limit*.8;return m.jsxs("div",{ref:a,className:Lt("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",e.collapsed?"w-16":"w-80",e.className),children:[m.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[m.jsx($.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>t(!e.collapsed),children:e.collapsed?m.jsx(pi,{className:"h-4 w-4"}):m.jsx(gi,{className:"h-4 w-4"})}),!e.collapsed&&m.jsxs(m.Fragment,{children:[m.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:e.title}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("span",{className:Lt("font-mono text-xs",o?"text-destructive":l?"text-yellow-500":"text-muted-foreground"),children:[s.length,e.limit&&` / ${e.limit}`]}),o&&m.jsx($.Badge,{variant:"destructive",className:"text-xs",children:"Full"}),l&&!o&&m.jsx(mi,{className:"h-3 w-3 text-yellow-500"})]})]})]}),e.collapsed&&m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:e.title}),m.jsx($.Badge,{variant:"secondary",className:"text-xs",children:s.length})]})]}),!e.collapsed&&m.jsx("div",{ref:i,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:m.jsx(Rn,{items:s.map(u=>u.id),strategy:In,children:r?m.jsx(vi,{cards:s,parentRef:i}):m.jsx("div",{className:"space-y-2",children:s.map(u=>m.jsx(Pt,{card:u},u.id))})})})]})}function Xn({columns:e,onCardMove:n,onColumnToggle:t,enableVirtualScrolling:r=!1,virtualScrollThreshold:s=50,className:i}){const[a,o]=B.useState(null),l=B.useMemo(()=>(e||[]).map(v=>({...v,cards:v.cards||[]})),[e]),[u,d]=B.useState(l);B.useEffect(()=>{d(l)},[l]);const f=Jt(Dt(ct,{activationConstraint:{distance:8}})),g=v=>{const{active:C}=v,S=N(C.id);o(S)},p=v=>{const{active:C,over:S}=v;if(o(null),!S)return;const b=C.id,E=S.id;if(b===E)return;const x=w(b),O=w(E)||y(E);if(!(!x||!O))if(x.id===O.id){const A=[...x.cards],M=A.findIndex(R=>R.id===b),j=A.findIndex(R=>R.id===E),L=gt(A,M,j);d(R=>R.map(P=>P.id===x.id?{...P,cards:L}:P))}else{const A=[...x.cards],M=[...O.cards],j=A.findIndex(H=>H.id===b),R=E===O.id?M.length:M.findIndex(H=>H.id===E),[P]=A.splice(j,1);M.splice(R,0,P),d(H=>H.map(Z=>Z.id===x.id?{...Z,cards:A}:Z.id===O.id?{...Z,cards:M}:Z)),n&&n(b,x.id,O.id,R)}},N=B.useCallback(v=>{for(const C of u){const S=C.cards.find(b=>b.id===v);if(S)return S}return null},[u]),w=B.useCallback(v=>u.find(C=>C.cards.some(S=>S.id===v))||null,[u]),y=B.useCallback(v=>u.find(C=>C.id===v)||null,[u]),D=B.useCallback((v,C)=>{d(S=>S.map(b=>b.id===v?{...b,collapsed:C}:b)),t?.(v,C)},[t]);return m.jsxs(On,{sensors:f,collisionDetection:Zt,onDragStart:g,onDragEnd:p,children:[m.jsx("div",{className:Lt("flex gap-4 overflow-x-auto p-4",i),children:u.map(v=>{const C=r&&v.cards.length>s;return m.jsx(bi,{column:v,cards:v.cards,onToggle:S=>D(v.id,S),enableVirtual:C},v.id)})}),m.jsx(An,{children:a?m.jsx(Pt,{card:a}):null})]})}const yi=Object.freeze(Object.defineProperty({__proto__:null,KanbanEnhanced:Xn,default:Xn},Symbol.toStringTag,{value:"Module"}));G.KanbanRenderer=et,G.ObjectKanban=xt,G.ObjectKanbanRenderer=wt,G.kanbanComponents=lr,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/src/KanbanImpl.d.ts
CHANGED
|
@@ -25,7 +25,8 @@ export interface KanbanColumn {
|
|
|
25
25
|
export interface KanbanBoardProps {
|
|
26
26
|
columns: KanbanColumn[];
|
|
27
27
|
onCardMove?: (cardId: string, fromColumnId: string, toColumnId: string, newIndex: number) => void;
|
|
28
|
+
onCardClick?: (card: KanbanCard) => void;
|
|
28
29
|
className?: string;
|
|
29
30
|
}
|
|
30
|
-
export default function KanbanBoard({ columns, onCardMove, className }: KanbanBoardProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export default function KanbanBoard({ columns, onCardMove, onCardClick, className }: KanbanBoardProps): import("react/jsx-runtime").JSX.Element;
|
|
31
32
|
//# sourceMappingURL=KanbanImpl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KanbanImpl.d.ts","sourceRoot":"","sources":["../../src/KanbanImpl.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"KanbanImpl.d.ts","sourceRoot":"","sources":["../../src/KanbanImpl.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA2BH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAA;KAAE,CAAC,CAAA;IAChG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACjG,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAA;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAkHD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,gBAAgB,2CAYpG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import('react').ForwardRefExoticComponent<Omit<{
|
|
5
|
+
schema: import('../../core/src').SchemaNode;
|
|
6
|
+
} & Record<string, any>, "ref"> & import('react').RefAttributes<any>>;
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
tags: string[];
|
|
11
|
+
argTypes: {
|
|
12
|
+
schema: {
|
|
13
|
+
table: {
|
|
14
|
+
disable: true;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
export declare const EmptyBoard: Story;
|
|
22
|
+
export declare const ColumnsWithNoCards: Story;
|
|
23
|
+
export declare const ColumnAtWipLimit: Story;
|
|
24
|
+
export declare const CardsWithLongTitles: Story;
|
|
25
|
+
export declare const ManyColumns: Story;
|
|
26
|
+
//# sourceMappingURL=ObjectKanban.EdgeCases.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectKanban.EdgeCases.stories.d.ts","sourceRoot":"","sources":["../../src/ObjectKanban.EdgeCases.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIvD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;CAUW,CAAC;AAEtB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAMnC,eAAO,MAAM,UAAU,EAAE,KAQxB,CAAC;AAIF,eAAO,MAAM,kBAAkB,EAAE,KAYhC,CAAC;AAIF,eAAO,MAAM,gBAAgB,EAAE,KAiC9B,CAAC;AAIF,eAAO,MAAM,mBAAmB,EAAE,KAwCjC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,KAmCzB,CAAC"}
|
|
@@ -5,6 +5,8 @@ export interface ObjectKanbanProps {
|
|
|
5
5
|
schema: KanbanSchema;
|
|
6
6
|
dataSource?: DataSource;
|
|
7
7
|
className?: string;
|
|
8
|
+
onRowClick?: (record: any) => void;
|
|
9
|
+
onCardClick?: (record: any) => void;
|
|
8
10
|
}
|
|
9
11
|
export declare const ObjectKanban: React.FC<ObjectKanbanProps>;
|
|
10
12
|
//# sourceMappingURL=ObjectKanban.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectKanban.d.ts","sourceRoot":"","sources":["../../src/ObjectKanban.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectKanban.d.ts","sourceRoot":"","sources":["../../src/ObjectKanban.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA6MpD,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import('react').ForwardRefExoticComponent<Omit<{
|
|
5
|
+
schema: import('../../core/src').SchemaNode;
|
|
6
|
+
} & Record<string, any>, "ref"> & import('react').RefAttributes<any>>;
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
tags: string[];
|
|
11
|
+
argTypes: {
|
|
12
|
+
schema: {
|
|
13
|
+
table: {
|
|
14
|
+
disable: true;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
export declare const Default: Story;
|
|
22
|
+
export declare const SprintBoard: Story;
|
|
23
|
+
export declare const WithColumnLimits: Story;
|
|
24
|
+
//# sourceMappingURL=ObjectKanban.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectKanban.stories.d.ts","sourceRoot":"","sources":["../../src/ObjectKanban.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIvD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;CAUW,CAAC;AAEtB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAInC,eAAO,MAAM,OAAO,EAAE,KAsDrB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAuCzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAiC9B,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAMxD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAMxD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;QAClG,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;KACnC,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgDxD,CAAC;AAqGF,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AA2DF,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAG9E,CAAC"}
|