@object-ui/plugin-kanban 0.3.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +20 -0
- package/CHANGELOG.md +14 -0
- package/dist/KanbanEnhanced-BMreTWOT.js +894 -0
- package/dist/KanbanImpl--kTNN_B8.js +144 -0
- package/dist/index-a4_RI-v7.js +579 -0
- package/dist/index.js +6 -3
- package/dist/index.umd.cjs +6 -3
- package/dist/{KanbanImpl-CUWM-JC-.js → sortable.esm-ZHwgFQIO.js} +1053 -1183
- package/dist/src/KanbanEnhanced.d.ts +36 -0
- package/dist/src/KanbanEnhanced.d.ts.map +1 -0
- package/dist/src/ObjectKanban.d.ts +10 -0
- package/dist/src/ObjectKanban.d.ts.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +21 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +11 -8
- package/src/KanbanEnhanced.tsx +394 -0
- package/src/ObjectKanban.msw.test.tsx +91 -0
- package/src/ObjectKanban.tsx +188 -0
- package/src/__tests__/KanbanEnhanced.test.tsx +259 -0
- package/src/index.test.ts +9 -9
- package/src/index.tsx +111 -5
- package/src/registration.test.tsx +26 -0
- package/src/types.ts +25 -0
- package/vite.config.ts +13 -0
- package/vitest.config.ts +12 -0
- package/vitest.setup.ts +1 -0
- package/dist/index-BV3FWhCb.js +0 -395
package/dist/index.umd.cjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
(function(
|
|
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,Ge,Bt,B,Se){"use strict";function tr(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 F=tr(c);var Ze={exports:{}},Re={};var $t;function nr(){if($t)return Re;$t=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var a in s)a!=="key"&&(o[a]=s[a])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:o}}return Re.Fragment=n,Re.jsx=t,Re.jsxs=t,Re}var ze={};var Wt;function rr(){return Wt||(Wt=1,process.env.NODE_ENV!=="production"&&(function(){function e(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===M?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case x:return"Fragment";case v:return"Profiler";case y:return"StrictMode";case T:return"Suspense";case O:return"SuspenseList";case I: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 b:return"Portal";case S:return h.displayName||"Context";case m:return(h._context.displayName||"Context")+".Consumer";case E:var D=h.render;return h=h.displayName,h||(h=D.displayName||D.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case N:return D=h.displayName||null,D!==null?D:e(h.type)||"Memo";case A:D=h._payload,h=h._init;try{return e(h(D))}catch{}}return null}function n(h){return""+h}function t(h){try{n(h);var D=!1}catch{D=!0}if(D){D=console;var j=D.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&h[Symbol.toStringTag]||h.constructor.name||"Object";return j.call(D,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),n(h)}}function r(h){if(h===x)return"<>";if(typeof h=="object"&&h!==null&&h.$$typeof===A)return"<...>";try{var D=e(h);return D?"<"+D+">":"<...>"}catch{return"<...>"}}function s(){var h=z.A;return h===null?null:h.getOwner()}function o(){return Error("react-stack-top-frame")}function i(h){if(P.call(h,"key")){var D=Object.getOwnPropertyDescriptor(h,"key").get;if(D&&D.isReactWarning)return!1}return h.key!==void 0}function a(h,D){function j(){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)",D))}j.isReactWarning=!0,Object.defineProperty(h,"key",{get:j,configurable:!0})}function l(){var h=e(this.type);return K[h]||(K[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,D,j,R,le,U){var L=j.ref;return h={$$typeof:C,type:h,key:D,props:j,_owner:R},(L!==void 0?L: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,D,j,R,le,U){var L=D.children;if(L!==void 0)if(R)if(V(L)){for(R=0;R<L.length;R++)f(L[R]);Object.freeze&&Object.freeze(L)}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(L);if(P.call(D,"key")){L=e(h);var J=Object.keys(D).filter(function(_){return _!=="key"});R=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",me[L+R]||(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} />`,P,_,W,_),he[_+P]=!0)}if(_=null,I!==void 0&&(n(I),_=""+I),s(y)&&(n(y.key),_=""+y.key),"key"in y){I={};for(var q in y)q!=="key"&&(I[q]=y[q])}else I=y;return _&&a(I,typeof d=="function"?d.displayName||d.name||"Unknown":d),u(d,_,I,o(),oe,Y)}function g(d){p(d)?d._store&&(d._store.validated=1):typeof d=="object"&&d!==null&&d.$$typeof===A&&(d._payload.status==="fulfilled"?p(d._payload.value)&&d._payload.value._store&&(d._payload.value._store.validated=1):d._store&&(d._store.validated=1))}function p(d){return typeof d=="object"&&d!==null&&d.$$typeof===m}var h=l,m=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),D=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),L=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,Q=Array.isArray,ce=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(d){return d()}};var we,$={},Ce=h.react_stack_bottom_frame.bind(h,i)(),Z=ce(r(i)),he={};Pe.Fragment=b,Pe.jsx=function(d,y,I){var P=1e4>L.recentlyCreatedOwnerStacks++;return f(d,y,I,!1,P?Error("react-stack-top-frame"):Ce,P?ce(r(d)):Z)},Pe.jsxs=function(d,y,I){var P=1e4>L.recentlyCreatedOwnerStacks++;return f(d,y,I,!0,P?Error("react-stack-top-frame"):Ce,P?ce(r(d)):Z)}})()),Pe}var Rt;function Rn(){return Rt||(Rt=1,process.env.NODE_ENV==="production"?Je.exports=Mn():Je.exports=jn()),Je.exports}var R=Rn();const Pn=l.lazy(()=>Promise.resolve().then(()=>Mo)),gt=({schema:e})=>{const t=l.useMemo(()=>{const{columns:n=[],data:r,groupBy:o}=e;if(r&&o&&Array.isArray(r)){const i=r.reduce((s,a)=>{const c=a[o];return s[c]||(s[c]=[]),s[c].push(a),s},{});return n.map(s=>({...s,cards:[...s.cards||[],...i[s.id]||[]]}))}return n},[e]);return R.jsx(l.Suspense,{fallback:R.jsx(le.Skeleton,{className:"w-full h-[600px]"}),children:R.jsx(Pn,{columns:t,onCardMove:e.onCardMove,className:e.className})})};In.ComponentRegistry.register("kanban",gt,{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 _n={kanban:gt};function Ln(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Ge=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Se(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ht(e){return"nodeType"in e}function U(e){var t,n;return e?Se(e)?e:ht(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function vt(e){const{Document:t}=U(e);return e instanceof t}function _e(e){return Se(e)?!1:e instanceof U(e).HTMLElement}function Pt(e){return e instanceof U(e).SVGElement}function Ee(e){return e?Se(e)?e.document:ht(e)?vt(e)?e:_e(e)||Pt(e)?e.ownerDocument:document:document:document}const ne=Ge?l.useLayoutEffect:l.useEffect;function Qe(e){const t=l.useRef(e);return ne(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function zn(){const e=l.useRef(null),t=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Le(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return ne(()=>{n.current!==e&&(n.current=e)},t),n}function ze(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ze(e){const t=Qe(e),n=l.useRef(null),r=l.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function et(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let pt={};function Be(e,t){return l.useMemo(()=>{if(t)return t;const n=pt[e]==null?0:pt[e]+1;return pt[e]=n,e+"-"+n},[e,t])}function _t(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[c,u]of a){const f=i[c];f!=null&&(i[c]=f+e*u)}return i},{...t})}}const De=_t(1),tt=_t(-1);function Bn(e){return"clientX"in e&&"clientY"in e}function nt(e){if(!e)return!1;const{KeyboardEvent:t}=U(e.target);return t&&e instanceof t}function Fn(e){if(!e)return!1;const{TouchEvent:t}=U(e.target);return t&&e instanceof t}function rt(e){if(Fn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Bn(e)?{x:e.clientX,y:e.clientY}:null}const fe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[fe.Translate.toString(e),fe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Lt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function $n(e){return e.matches(Lt)?e:e.querySelector(Lt)}const Yn={display:"none"};function Xn(e){let{id:t,value:n}=e;return l.createElement("div",{id:t,style:Yn},n)}function Un(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={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 l.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Wn(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const zt=l.createContext(null);function Kn(e){const t=l.useContext(zt);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function qn(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Vn={draggable:`
|
|
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:`
|
|
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
|
-
`},Hn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Jn(e){let{announcements:t=Hn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Vn}=e;const{announce:i,announcement:s}=Wn(),a=Be("DndLiveRegion"),[c,u]=l.useState(!1);if(l.useEffect(()=>{u(!0)},[]),Kn(l.useMemo(()=>({onDragStart(g){let{active:p}=g;i(t.onDragStart({active:p}))},onDragMove(g){let{active:p,over:h}=g;t.onDragMove&&i(t.onDragMove({active:p,over:h}))},onDragOver(g){let{active:p,over:h}=g;i(t.onDragOver({active:p,over:h}))},onDragEnd(g){let{active:p,over:h}=g;i(t.onDragEnd({active:p,over:h}))},onDragCancel(g){let{active:p,over:h}=g;i(t.onDragCancel({active:p,over:h}))}}),[i,t])),!c)return null;const f=l.createElement(l.Fragment,null,l.createElement(Xn,{id:r,value:o.draggable}),l.createElement(Un,{id:a,announcement:s}));return n?je.createPortal(f,n):f}var z;(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"})(z||(z={}));function ot(){}function Gn(e,t){return l.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Qn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const re=Object.freeze({x:0,y:0});function Zn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function er(e,t){const n=rt(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function tr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function nr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Bt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function rr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const or=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Bt(t),i=[];for(const s of r){const{id:a}=s,c=n.get(a);if(c){const u=Bt(c),f=o.reduce((p,h,m)=>p+Zn(u[m],h),0),g=Number((f/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:g}})}}return i.sort(tr)};function ir(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const c=t.width*t.height,u=e.width*e.height,f=s*a,g=f/(c+u-f);return Number(g.toFixed(4))}return 0}const sr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const c=ir(a,t);c>0&&o.push({id:s,data:{droppableContainer:i,value:c}})}}return o.sort(nr)};function ar(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ft(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:re}function lr(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const cr=lr(1);function $t(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ur(e,t,n){const r=$t(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,c=e.left-s-(1-o)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,g=i?e.height/i:e.height;return{width:f,height:g,top:u,right:c+f,bottom:u+g,left:c}}const dr={ignoreTransform:!1};function Te(e,t){t===void 0&&(t=dr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=U(e).getComputedStyle(e);u&&(n=ur(n,u,f))}const{top:r,left:o,width:i,height:s,bottom:a,right:c}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:c}}function Yt(e){return Te(e,{ignoreTransform:!0})}function fr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function gr(e,t){return t===void 0&&(t=U(e).getComputedStyle(e)),t.position==="fixed"}function hr(e,t){t===void 0&&(t=U(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function bt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(vt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!_e(o)||Pt(o)||n.includes(o))return n;const i=U(e).getComputedStyle(o);return o!==e&&hr(o,i)&&n.push(o),gr(o,i)?n:r(o.parentNode)}return e?r(e):n}function Xt(e){const[t]=bt(e,1);return t??null}function mt(e){return!Ge||!e?null:Se(e)?e:ht(e)?vt(e)||e===Ee(e).scrollingElement?window:_e(e)?e:null:null}function Ut(e){return Se(e)?e.scrollX:e.scrollLeft}function Wt(e){return Se(e)?e.scrollY:e.scrollTop}function yt(e){return{x:Ut(e),y:Wt(e)}}var B;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(B||(B={}));function Kt(e){return!Ge||!e?!1:e===document.scrollingElement}function qt(e){const t={x:0,y:0},n=Kt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const vr={x:.2,y:.2};function pr(e,t,n,r,o){let{top:i,left:s,right:a,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=vr);const{isTop:u,isBottom:f,isLeft:g,isRight:p}=qt(e),h={x:0,y:0},m={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(h.y=B.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!f&&c>=t.bottom-v.height&&(h.y=B.Forward,m.y=r*Math.abs((t.bottom-v.height-c)/v.height)),!p&&a>=t.right-v.width?(h.x=B.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!g&&s<=t.left+v.width&&(h.x=B.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:h,speed:m}}function br(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Vt(e){return e.reduce((t,n)=>De(t,yt(n)),re)}function mr(e){return e.reduce((t,n)=>t+Ut(n),0)}function yr(e){return e.reduce((t,n)=>t+Wt(n),0)}function Ht(e,t){if(t===void 0&&(t=Te),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Xt(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const xr=[["x",["left","right"],mr],["y",["top","bottom"],yr]];class xt{constructor(t,n){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=bt(n),o=Vt(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of xr)for(const c of s)Object.defineProperty(this,c,{get:()=>{const u=a(r),f=o[i]-u;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Fe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function wr(e){const{EventTarget:t}=U(e);return e instanceof t?e:Ee(e)}function wt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var G;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(G||(G={}));function Jt(e){e.preventDefault()}function Cr(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 Gt={start:[k.Space,k.Enter],cancel:[k.Esc],end:[k.Space,k.Enter,k.Tab]},Sr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case k.Right:return{...n,x:n.x+25};case k.Left:return{...n,x:n.x-25};case k.Down:return{...n,y:n.y+25};case k.Up:return{...n,y:n.y-25}}};class Qt{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Fe(Ee(n)),this.windowListeners=new Fe(U(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(G.Resize,this.handleCancel),this.windowListeners.add(G.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(G.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ht(r),n(re)}handleKeyDown(t){if(nt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=Gt,coordinateGetter:s=Sr,scrollBehavior:a="smooth"}=o,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:re;this.referenceCoordinates||(this.referenceCoordinates=f);const g=s(t,{active:n,context:r.current,currentCoordinates:f});if(g){const p=tt(g,f),h={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const b=t.code,{isTop:x,isRight:C,isLeft:w,isBottom:D,maxScroll:S,minScroll:O}=qt(v),E=br(v),T={x:Math.min(b===k.Right?E.right-E.width/2:E.right,Math.max(b===k.Right?E.left:E.left+E.width/2,g.x)),y:Math.min(b===k.Down?E.bottom-E.height/2:E.bottom,Math.max(b===k.Down?E.top:E.top+E.height/2,g.y))},A=b===k.Right&&!C||b===k.Left&&!w,j=b===k.Down&&!D||b===k.Up&&!x;if(A&&T.x!==g.x){const N=v.scrollLeft+p.x,L=b===k.Right&&N<=S.x||b===k.Left&&N>=O.x;if(L&&!p.y){v.scrollTo({left:N,behavior:a});return}L?h.x=v.scrollLeft-N:h.x=b===k.Right?v.scrollLeft-S.x:v.scrollLeft-O.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(j&&T.y!==g.y){const N=v.scrollTop+p.y,L=b===k.Down&&N<=S.y||b===k.Up&&N>=O.y;if(L&&!p.x){v.scrollTo({top:N,behavior:a});return}L?h.y=v.scrollTop-N:h.y=b===k.Down?v.scrollTop-S.y:v.scrollTop-O.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,De(tt(g,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Qt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Gt,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Zt(e){return!!(e&&"distance"in e)}function en(e){return!!(e&&"delay"in e)}class Ct{constructor(t,n,r){var o;r===void 0&&(r=wr(t.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=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=Ee(s),this.documentListeners=new Fe(this.document),this.listeners=new Fe(r),this.windowListeners=new Fe(U(s)),this.initialCoordinates=(o=rt(i))!=null?o:re,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:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(G.Resize,this.handleCancel),this.windowListeners.add(G.DragStart,Jt),this.windowListeners.add(G.VisibilityChange,this.handleCancel),this.windowListeners.add(G.ContextMenu,Jt),this.documentListeners.add(G.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(en(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Zt(n)){this.handlePending(n);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(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(G.Click,Cr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(G.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const c=(n=rt(t))!=null?n:re,u=tt(o,c);if(!r&&a){if(Zt(a)){if(a.tolerance!=null&&wt(u,a.tolerance))return this.handleCancel();if(wt(u,a.distance))return this.handleStart()}if(en(a)&&wt(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),s(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===k.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Er={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class St extends Ct{constructor(t){const{event:n}=t,r=Ee(n.target);super(t,Er,r)}}St.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Dr={move:{name:"mousemove"},end:{name:"mouseup"}};var Et;(function(e){e[e.RightClick=2]="RightClick"})(Et||(Et={}));class Tr extends Ct{constructor(t){super(t,Dr,Ee(t.event.target))}}Tr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Et.RightClick?!1:(r?.({event:n}),!0)}}];const Dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Or extends Ct{constructor(t){super(t,Dt)}static setup(){return window.addEventListener(Dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Dt.move.name,t)};function t(){}}}Or.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var $e;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})($e||($e={}));var it;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(it||(it={}));function Ar(e){let{acceleration:t,activator:n=$e.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=it.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:f,delta:g,threshold:p}=e;const h=Ir({delta:g,disabled:!i}),[m,v]=zn(),b=l.useRef({x:0,y:0}),x=l.useRef({x:0,y:0}),C=l.useMemo(()=>{switch(n){case $e.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case $e.DraggableRect:return o}},[n,o,c]),w=l.useRef(null),D=l.useCallback(()=>{const O=w.current;if(!O)return;const E=b.current.x*x.current.x,T=b.current.y*x.current.y;O.scrollBy(E,T)},[]),S=l.useMemo(()=>a===it.TreeOrder?[...u].reverse():u,[a,u]);l.useEffect(()=>{if(!i||!u.length||!C){v();return}for(const O of S){if(r?.(O)===!1)continue;const E=u.indexOf(O),T=f[E];if(!T)continue;const{direction:A,speed:j}=pr(O,T,C,t,p);for(const N of["x","y"])h[N][A[N]]||(j[N]=0,A[N]=0);if(j.x>0||j.y>0){v(),w.current=O,m(D,s),b.current=j,x.current=A;return}}b.current={x:0,y:0},x.current={x:0,y:0},v()},[t,D,r,v,i,s,JSON.stringify(C),JSON.stringify(h),m,u,S,f,JSON.stringify(p)])}const Nr={x:{[B.Backward]:!1,[B.Forward]:!1},y:{[B.Backward]:!1,[B.Forward]:!1}};function Ir(e){let{delta:t,disabled:n}=e;const r=et(t);return ze(o=>{if(n||!r||!o)return Nr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[B.Backward]:o.x[B.Backward]||i.x===-1,[B.Forward]:o.x[B.Forward]||i.x===1},y:{[B.Backward]:o.y[B.Backward]||i.y===-1,[B.Forward]:o.y[B.Forward]||i.y===1}}},[n,t,r])}function kr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return ze(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Mr(e,t){return l.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Ye;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ye||(Ye={}));var Tt;(function(e){e.Optimized="optimized"})(Tt||(Tt={}));const tn=new Map;function jr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=l.useState(null),{frequency:a,measure:c,strategy:u}=o,f=l.useRef(e),g=b(),p=Le(g),h=l.useCallback(function(x){x===void 0&&(x=[]),!p.current&&s(C=>C===null?x:C.concat(x.filter(w=>!C.includes(w))))},[p]),m=l.useRef(null),v=ze(x=>{if(g&&!n)return tn;if(!x||x===tn||f.current!==e||i!=null){const C=new Map;for(let w of e){if(!w)continue;if(i&&i.length>0&&!i.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const D=w.node.current,S=D?new xt(c(D),D):null;w.rect.current=S,S&&C.set(w.id,S)}return C}return x},[e,i,n,g,c]);return l.useEffect(()=>{f.current=e},[e]),l.useEffect(()=>{g||h()},[n,g]),l.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),l.useEffect(()=>{g||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{h(),m.current=null},a))},[a,g,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:i!=null};function b(){switch(u){case Ye.Always:return!1;case Ye.BeforeDragging:return n;default:return!n}}}function Ot(e,t){return ze(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Rr(e,t){return Ot(e,t)}function Pr(e){let{callback:t,disabled:n}=e;const r=Qe(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function st(e){let{callback:t,disabled:n}=e;const r=Qe(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function _r(e){return new xt(Te(e),e)}function nn(e,t,n){t===void 0&&(t=_r);const[r,o]=l.useState(null);function i(){o(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const f=t(e);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const s=Pr({callback(c){if(e)for(const u of c){const{type:f,target:g}=u;if(f==="childList"&&g instanceof HTMLElement&&g.contains(e)){i();break}}}}),a=st({callback:i});return ne(()=>{i(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Lr(e){const t=Ot(e);return Ft(e,t)}const rn=[];function zr(e){const t=l.useRef(e),n=ze(r=>e?r&&r!==rn&&e&&t.current&&e.parentNode===t.current.parentNode?r:bt(e):rn,[e]);return l.useEffect(()=>{t.current=e},[e]),n}function Br(e){const[t,n]=l.useState(null),r=l.useRef(e),o=l.useCallback(i=>{const s=mt(i.target);s&&n(a=>a?(a.set(s,yt(s)),new Map(a)):null)},[]);return l.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(c=>{const u=mt(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,yt(u)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(c=>{const u=mt(c);u?.removeEventListener("scroll",o)})}},[o,e]),l.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>De(i,s),re):Vt(e):re,[e,t])}function on(e,t){t===void 0&&(t=[]);const n=l.useRef(null);return l.useEffect(()=>{n.current=null},t),l.useEffect(()=>{const r=e!==re;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?tt(e,n.current):re}function Fr(e){l.useEffect(()=>{if(!Ge)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function $r(e,t){return l.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function sn(e){return l.useMemo(()=>e?fr(e):null,[e])}const an=[];function Yr(e,t){t===void 0&&(t=Te);const[n]=e,r=sn(n?U(n):null),[o,i]=l.useState(an);function s(){i(()=>e.length?e.map(c=>Kt(c)?r:new xt(t(c),c)):an)}const a=st({callback:s});return ne(()=>{a?.disconnect(),s(),e.forEach(c=>a?.observe(c))},[e]),o}function ln(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return _e(t)?t:e}function Xr(e){let{measure:t}=e;const[n,r]=l.useState(null),o=l.useCallback(u=>{for(const{target:f}of u)if(_e(f)){r(g=>{const p=t(f);return g?{...g,width:p.width,height:p.height}:p});break}},[t]),i=st({callback:o}),s=l.useCallback(u=>{const f=ln(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[a,c]=Ze(s);return l.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const Ur=[{sensor:St,options:{}},{sensor:Qt,options:{}}],Wr={current:{}},at={draggable:{measure:Yt},droppable:{measure:Yt,strategy:Ye.WhileDragging,frequency:Tt.Optimized},dragOverlay:{measure:Te}};class Xe extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Kr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ot},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:at,measureDroppableContainers:ot,windowRect:null,measuringScheduled:!1},cn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ot,draggableNodes:new Map,over:null,measureDroppableContainers:ot},Ue=l.createContext(cn),un=l.createContext(Kr);function qr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function Vr(e,t){switch(t.type){case z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case z.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case z.DragEnd:case z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case z.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Xe(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Xe(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Hr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=l.useContext(Ue),i=et(r),s=et(n?.id);return l.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!nt(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[c.current,u.current]){if(!f)continue;const g=$n(f);if(g){g.focus();break}}})}},[r,t,o,s,i]),null}function dn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Jr(e){return l.useMemo(()=>({draggable:{...at.draggable,...e?.draggable},droppable:{...at.droppable,...e?.droppable},dragOverlay:{...at.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Gr(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;ne(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),g=Ft(f,r);if(s||(g.x=0),a||(g.y=0),i.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const p=Xt(u);p&&p.scrollBy({top:g.y,left:g.x})}},[t,s,a,r,n])}const lt=l.createContext({...re,scaleX:1,scaleY:1});var ge;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ge||(ge={}));const Qr=l.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:c=!0,children:u,sensors:f=Ur,collisionDetection:g=sr,measuring:p,modifiers:h,...m}=t;const v=l.useReducer(Vr,void 0,qr),[b,x]=v,[C,w]=qn(),[D,S]=l.useState(ge.Uninitialized),O=D===ge.Initialized,{draggable:{active:E,nodes:T,translate:A},droppable:{containers:j}}=b,N=E!=null?T.get(E):null,L=l.useRef({initial:null,translated:null}),K=l.useMemo(()=>{var X;return E!=null?{id:E,data:(X=N?.data)!=null?X:Wr,rect:L}:null},[E,N]),Q=l.useRef(null),[ce,we]=l.useState(null),[$,Ce]=l.useState(null),Z=Le(m,Object.values(m)),he=Be("DndDescribedBy",s),d=l.useMemo(()=>j.getEnabled(),[j]),y=Jr(p),{droppableRects:I,measureDroppableContainers:P,measuringScheduled:oe}=jr(d,{dragging:O,dependencies:[A.x,A.y],config:y.droppable}),Y=kr(T,E),_=l.useMemo(()=>$?rt($):null,[$]),W=Fo(),q=Rr(Y,y.draggable.measure);Gr({activeNode:E!=null?T.get(E):null,config:W.layoutShiftCompensation,initialRect:q,measure:y.draggable.measure});const M=nn(Y,y.draggable.measure,q),We=nn(Y?Y.parentElement:null),ie=l.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Oe=j.getNodeFor((n=ie.current.over)==null?void 0:n.id),ue=Xr({measure:y.dragOverlay.measure}),Ae=(r=ue.nodeRef.current)!=null?r:Y,Ne=O?(o=ue.rect)!=null?o:M:null,Cn=!!(ue.nodeRef.current&&ue.rect),Sn=Lr(Cn?null:M),Nt=sn(Ae?U(Ae):null),ve=zr(O?Oe??Y:null),dt=Yr(ve),ft=dn(h,{transform:{x:A.x-Sn.x,y:A.y-Sn.y,scaleX:1,scaleY:1},activatorEvent:$,active:K,activeNodeRect:M,containerNodeRect:We,draggingNodeRect:Ne,over:ie.current.over,overlayNodeRect:ue.rect,scrollableAncestors:ve,scrollableAncestorRects:dt,windowRect:Nt}),En=_?De(_,A):null,Dn=Br(ve),jo=on(Dn),Ro=on(Dn,[M]),Ie=De(ft,jo),ke=Ne?cr(Ne,ft):null,Ke=K&&ke?g({active:K,collisionRect:ke,droppableRects:I,droppableContainers:d,pointerCoordinates:En}):null,Tn=rr(Ke,"id"),[pe,On]=l.useState(null),Po=Cn?ft:De(ft,Ro),_o=ar(Po,(i=pe?.rect)!=null?i:null,M),It=l.useRef(null),An=l.useCallback((X,V)=>{let{sensor:H,options:be}=V;if(Q.current==null)return;const ee=T.get(Q.current);if(!ee)return;const J=X.nativeEvent,se=new H({active:Q.current,activeNode:ee,event:J,options:be,context:ie,onAbort(F){if(!T.get(F))return;const{onDragAbort:ae}=Z.current,de={id:F};ae?.(de),C({type:"onDragAbort",event:de})},onPending(F,me,ae,de){if(!T.get(F))return;const{onDragPending:Ve}=Z.current,ye={id:F,constraint:me,initialCoordinates:ae,offset:de};Ve?.(ye),C({type:"onDragPending",event:ye})},onStart(F){const me=Q.current;if(me==null)return;const ae=T.get(me);if(!ae)return;const{onDragStart:de}=Z.current,qe={activatorEvent:J,active:{id:me,data:ae.data,rect:L}};je.unstable_batchedUpdates(()=>{de?.(qe),S(ge.Initializing),x({type:z.DragStart,initialCoordinates:F,active:me}),C({type:"onDragStart",event:qe}),we(It.current),Ce(J)})},onMove(F){x({type:z.DragMove,coordinates:F})},onEnd:Me(z.DragEnd),onCancel:Me(z.DragCancel)});It.current=se;function Me(F){return async function(){const{active:ae,collisions:de,over:qe,scrollAdjustedTranslate:Ve}=ie.current;let ye=null;if(ae&&Ve){const{cancelDrop:He}=Z.current;ye={activatorEvent:J,active:ae,collisions:de,delta:Ve,over:qe},F===z.DragEnd&&typeof He=="function"&&await Promise.resolve(He(ye))&&(F=z.DragCancel)}Q.current=null,je.unstable_batchedUpdates(()=>{x({type:F}),S(ge.Uninitialized),On(null),we(null),Ce(null),It.current=null;const He=F===z.DragEnd?"onDragEnd":"onDragCancel";if(ye){const kt=Z.current[He];kt?.(ye),C({type:He,event:ye})}})}}},[T]),Lo=l.useCallback((X,V)=>(H,be)=>{const ee=H.nativeEvent,J=T.get(be);if(Q.current!==null||!J||ee.dndKit||ee.defaultPrevented)return;const se={active:J};X(H,V.options,se)===!0&&(ee.dndKit={capturedBy:V.sensor},Q.current=be,An(H,V))},[T,An]),Nn=Mr(f,Lo);Fr(f),ne(()=>{M&&D===ge.Initializing&&S(ge.Initialized)},[M,D]),l.useEffect(()=>{const{onDragMove:X}=Z.current,{active:V,activatorEvent:H,collisions:be,over:ee}=ie.current;if(!V||!H)return;const J={active:V,activatorEvent:H,collisions:be,delta:{x:Ie.x,y:Ie.y},over:ee};je.unstable_batchedUpdates(()=>{X?.(J),C({type:"onDragMove",event:J})})},[Ie.x,Ie.y]),l.useEffect(()=>{const{active:X,activatorEvent:V,collisions:H,droppableContainers:be,scrollAdjustedTranslate:ee}=ie.current;if(!X||Q.current==null||!V||!ee)return;const{onDragOver:J}=Z.current,se=be.get(Tn),Me=se&&se.rect.current?{id:se.id,rect:se.rect.current,data:se.data,disabled:se.disabled}:null,F={active:X,activatorEvent:V,collisions:H,delta:{x:ee.x,y:ee.y},over:Me};je.unstable_batchedUpdates(()=>{On(Me),J?.(F),C({type:"onDragOver",event:F})})},[Tn]),ne(()=>{ie.current={activatorEvent:$,active:K,activeNode:Y,collisionRect:ke,collisions:Ke,droppableRects:I,draggableNodes:T,draggingNode:Ae,draggingNodeRect:Ne,droppableContainers:j,over:pe,scrollableAncestors:ve,scrollAdjustedTranslate:Ie},L.current={initial:Ne,translated:ke}},[K,Y,Ke,ke,T,Ae,Ne,I,j,pe,ve,Ie]),Ar({...W,delta:A,draggingRect:ke,pointerCoordinates:En,scrollableAncestors:ve,scrollableAncestorRects:dt});const zo=l.useMemo(()=>({active:K,activeNode:Y,activeNodeRect:M,activatorEvent:$,collisions:Ke,containerNodeRect:We,dragOverlay:ue,draggableNodes:T,droppableContainers:j,droppableRects:I,over:pe,measureDroppableContainers:P,scrollableAncestors:ve,scrollableAncestorRects:dt,measuringConfiguration:y,measuringScheduled:oe,windowRect:Nt}),[K,Y,M,$,Ke,We,ue,T,j,I,pe,P,ve,dt,y,oe,Nt]),Bo=l.useMemo(()=>({activatorEvent:$,activators:Nn,active:K,activeNodeRect:M,ariaDescribedById:{draggable:he},dispatch:x,draggableNodes:T,over:pe,measureDroppableContainers:P}),[$,Nn,K,M,x,he,T,pe,P]);return l.createElement(zt.Provider,{value:w},l.createElement(Ue.Provider,{value:Bo},l.createElement(un.Provider,{value:zo},l.createElement(lt.Provider,{value:_o},u)),l.createElement(Hr,{disabled:a?.restoreFocus===!1})),l.createElement(Jn,{...a,hiddenTextDescribedById:he}));function Fo(){const X=ce?.autoScrollEnabled===!1,V=typeof c=="object"?c.enabled===!1:c===!1,H=O&&!X&&!V;return typeof c=="object"?{...c,enabled:H}:{enabled:H}}}),Zr=l.createContext(null),fn="button",eo="Draggable";function to(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Be(eo),{activators:s,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:f,draggableNodes:g,over:p}=l.useContext(Ue),{role:h=fn,roleDescription:m="draggable",tabIndex:v=0}=o??{},b=c?.id===t,x=l.useContext(b?lt:Zr),[C,w]=Ze(),[D,S]=Ze(),O=$r(s,t),E=Le(n);ne(()=>(g.set(t,{id:t,key:i,node:C,activatorNode:D,data:E}),()=>{const A=g.get(t);A&&A.key===i&&g.delete(t)}),[g,t]);const T=l.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&h===fn?!0:void 0,"aria-roledescription":m,"aria-describedby":f.draggable}),[r,h,v,b,m,f.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:T,isDragging:b,listeners:r?void 0:O,node:C,over:p,setNodeRef:w,setActivatorNodeRef:S,transform:x}}function gn(){return l.useContext(un)}const no="Droppable",ro={timeout:25};function oo(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Be(no),{active:s,dispatch:a,over:c,measureDroppableContainers:u}=l.useContext(Ue),f=l.useRef({disabled:n}),g=l.useRef(!1),p=l.useRef(null),h=l.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:b}={...ro,...o},x=Le(v??r),C=l.useCallback(()=>{if(!g.current){g.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(x.current)?x.current:[x.current]),h.current=null},b)},[b]),w=st({callback:C,disabled:m||!s}),D=l.useCallback((T,A)=>{w&&(A&&(w.unobserve(A),g.current=!1),T&&w.observe(T))},[w]),[S,O]=Ze(D),E=Le(t);return l.useEffect(()=>{!w||!S.current||(w.disconnect(),g.current=!1,w.observe(S.current))},[S,w]),l.useEffect(()=>(a({type:z.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:p,data:E}}),()=>a({type:z.UnregisterDroppable,key:i,id:r})),[r]),l.useEffect(()=>{n!==f.current.disabled&&(a({type:z.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,a]),{active:s,rect:p,isOver:c?.id===r,node:S,over:c,setNodeRef:O}}function io(e){let{animation:t,children:n}=e;const[r,o]=l.useState(null),[i,s]=l.useState(null),a=et(n);return!n&&!r&&a&&o(a),ne(()=>{if(!i)return;const c=r?.key,u=r?.props.id;if(c==null||u==null){o(null);return}Promise.resolve(t(u,i)).then(()=>{o(null)})},[t,r,i]),l.createElement(l.Fragment,null,n,r?l.cloneElement(r,{ref:s}):null)}const so={x:0,y:0,scaleX:1,scaleY:1};function ao(e){let{children:t}=e;return l.createElement(Ue.Provider,{value:cn},l.createElement(lt.Provider,{value:so},t))}const lo={position:"fixed",touchAction:"none"},co=e=>nt(e)?"transform 250ms ease":void 0,uo=l.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:s,rect:a,style:c,transform:u,transition:f=co}=e;if(!a)return null;const g=o?u:{...u,scaleX:1,scaleY:1},p={...lo,width:a.width,height:a.height,top:a.top,left:a.left,transform:fe.Transform.toString(g),transformOrigin:o&&r?er(r,a):void 0,transition:typeof f=="function"?f(r):f,...c};return l.createElement(n,{className:s,style:p,ref:t},i)}),fo={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:fe.Transform.toString(t)},{transform:fe.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:s}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(o[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&r.node.style.setProperty(a,c);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[c,u]of Object.entries(o))n.node.style.setProperty(c,u);s!=null&&s.active&&n.node.classList.remove(s.active)}})({styles:{active:{opacity:"0"}}})};function go(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return Qe((i,s)=>{if(t===null)return;const a=n.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=ln(s);if(!u)return;const{transform:f}=U(s).getComputedStyle(s),g=$t(f);if(!g)return;const p=typeof t=="function"?t:ho(t);return Ht(c,o.draggable.measure),p({active:{id:i,data:a.data,node:c,rect:o.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:s,rect:o.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:o,transform:g})})}function ho(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...fo,...e};return i=>{let{active:s,dragOverlay:a,transform:c,...u}=i;if(!t)return;const f={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},g={scaleX:c.scaleX!==1?s.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?s.rect.height*c.scaleY/a.rect.height:1},p={x:c.x-f.x,y:c.y-f.y,...g},h=o({...u,active:s,dragOverlay:a,transform:{initial:c,final:p}}),[m]=h,v=h[h.length-1];if(JSON.stringify(m)===JSON.stringify(v))return;const b=r?.({active:s,dragOverlay:a,...u}),x=a.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(C=>{x.onfinish=()=>{b?.(),C()}})}}let hn=0;function vo(e){return l.useMemo(()=>{if(e!=null)return hn++,hn},[e])}const po=l.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:s,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:f,active:g,activeNodeRect:p,containerNodeRect:h,draggableNodes:m,droppableContainers:v,dragOverlay:b,over:x,measuringConfiguration:C,scrollableAncestors:w,scrollableAncestorRects:D,windowRect:S}=gn(),O=l.useContext(lt),E=vo(g?.id),T=dn(s,{activatorEvent:f,active:g,activeNodeRect:p,containerNodeRect:h,draggingNodeRect:b.rect,over:x,overlayNodeRect:b.rect,scrollableAncestors:w,scrollableAncestorRects:D,transform:O,windowRect:S}),A=Ot(p),j=go({config:r,draggableNodes:m,droppableContainers:v,measuringConfiguration:C}),N=A?b.setRef:void 0;return l.createElement(ao,null,l.createElement(io,{animation:j},g&&E?l.createElement(uo,{key:E,id:g.id,ref:N,as:a,activatorEvent:f,adjustScale:t,className:c,transition:i,rect:A,style:{zIndex:u,...o},transform:T},n):null))});function At(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function bo(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function ct(e){return e!==null&&e>=0}function mo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function yo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const vn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=At(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},ut={scaleX:1,scaleY:1},xo=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const u=i[s];return u?{x:0,y:n<s?u.top+u.height-(a.top+a.height):u.top-a.top,...ut}:null}const c=wo(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-c,...ut}:o<n&&o>=s?{x:0,y:a.height+c,...ut}:{x:0,y:0,...ut}};function wo(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const pn="Sortable",bn=l.createContext({activeIndex:-1,containerId:pn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:vn,disabled:{draggable:!1,droppable:!1}});function Co(e){let{children:t,id:n,items:r,strategy:o=vn,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:f}=gn(),g=Be(pn,n),p=a.rect!==null,h=l.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),m=s!=null,v=s?h.indexOf(s.id):-1,b=u?h.indexOf(u.id):-1,x=l.useRef(h),C=!mo(h,x.current),w=b!==-1&&v===-1||C,D=yo(i);ne(()=>{C&&m&&f(h)},[C,h,m,f]),l.useEffect(()=>{x.current=h},[h]);const S=l.useMemo(()=>({activeIndex:v,containerId:g,disabled:D,disableTransforms:w,items:h,overIndex:b,useDragOverlay:p,sortedRects:bo(h,c),strategy:o}),[v,g,D.draggable,D.droppable,w,h,b,c,p,o]);return l.createElement(bn.Provider,{value:S},t)}const So=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return At(n,r,o).indexOf(t)},Eo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:c,transition:u}=e;return!u||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===c},Do={duration:200,easing:"ease"},mn="transform",To=fe.Transition.toString({property:mn,duration:0,easing:"linear"}),Oo={roleDescription:"sortable"};function Ao(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=l.useState(null),a=l.useRef(n);return ne(()=>{if(!t&&n!==a.current&&r.current){const c=o.current;if(c){const u=Te(r.current,{ignoreTransform:!0}),f={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(f.x||f.y)&&s(f)}}n!==a.current&&(a.current=n)},[t,n,r,o]),l.useEffect(()=>{i&&s(null)},[i]),i}function yn(e){let{animateLayoutChanges:t=Eo,attributes:n,disabled:r,data:o,getNewIndex:i=So,id:s,strategy:a,resizeObserverConfig:c,transition:u=Do}=e;const{items:f,containerId:g,activeIndex:p,disabled:h,disableTransforms:m,sortedRects:v,overIndex:b,useDragOverlay:x,strategy:C}=l.useContext(bn),w=No(r,h),D=f.indexOf(s),S=l.useMemo(()=>({sortable:{containerId:g,index:D,items:f},...o}),[g,o,D,f]),O=l.useMemo(()=>f.slice(f.indexOf(s)),[f,s]),{rect:E,node:T,isOver:A,setNodeRef:j}=oo({id:s,data:S,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...c}}),{active:N,activatorEvent:L,activeNodeRect:K,attributes:Q,setNodeRef:ce,listeners:we,isDragging:$,over:Ce,setActivatorNodeRef:Z,transform:he}=to({id:s,data:S,attributes:{...Oo,...n},disabled:w.draggable}),d=Ln(j,ce),y=!!N,I=y&&!m&&ct(p)&&ct(b),P=!x&&$,oe=P&&I?he:null,_=I?oe??(a??C)({rects:v,activeNodeRect:K,activeIndex:p,overIndex:b,index:D}):null,W=ct(p)&&ct(b)?i({id:s,items:f,activeIndex:p,overIndex:b}):D,q=N?.id,M=l.useRef({activeId:q,items:f,newIndex:W,containerId:g}),We=f!==M.current.items,ie=t({active:N,containerId:g,isDragging:$,isSorting:y,id:s,index:D,items:f,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),Oe=Ao({disabled:!ie,index:D,node:T,rect:E});return l.useEffect(()=>{y&&M.current.newIndex!==W&&(M.current.newIndex=W),g!==M.current.containerId&&(M.current.containerId=g),f!==M.current.items&&(M.current.items=f)},[y,W,g,f]),l.useEffect(()=>{if(q===M.current.activeId)return;if(q!=null&&M.current.activeId==null){M.current.activeId=q;return}const Ae=setTimeout(()=>{M.current.activeId=q},50);return()=>clearTimeout(Ae)},[q]),{active:N,activeIndex:p,attributes:Q,data:S,rect:E,index:D,newIndex:W,items:f,isOver:A,isSorting:y,isDragging:$,listeners:we,node:T,overIndex:b,over:Ce,setNodeRef:d,setActivatorNodeRef:Z,setDroppableNodeRef:j,setDraggableNodeRef:ce,transform:Oe??_,transition:ue()};function ue(){if(Oe||We&&M.current.newIndex===D)return To;if(!(P&&!nt(L)||!u)&&(y||ie))return fe.Transition.toString({...u,property:mn})}}function No(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}k.Down,k.Right,k.Up,k.Left;const xn=(...e)=>e.filter(Boolean).join(" ");function wn({card:e}){const{attributes:t,listeners:n,setNodeRef:r,transform:o,transition:i,isDragging:s}=yn({id:e.id}),a={transform:fe.Transform.toString(o),transition:i,opacity:s?.5:void 0};return R.jsx("div",{ref:r,style:a,...t,...n,children:R.jsxs(le.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:[R.jsxs(le.CardHeader,{className:"p-4",children:[R.jsx(le.CardTitle,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&R.jsx(le.CardDescription,{className:"text-xs text-muted-foreground font-mono",children:e.description})]}),e.badges&&e.badges.length>0&&R.jsx(le.CardContent,{className:"p-4 pt-0",children:R.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((c,u)=>R.jsx(le.Badge,{variant:c.variant||"default",className:"text-xs",children:c.label},u))})})]})})}function Io({column:e,cards:t}){const n=t||[],{setNodeRef:r}=yn({id:e.id,data:{type:"column"}}),o=e.limit&&n.length>=e.limit;return R.jsxs("div",{ref:r,className:xn("flex flex-col w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl",e.className),children:[R.jsx("div",{className:"p-4 border-b border-border/50 bg-muted/20",children:R.jsxs("div",{className:"flex items-center justify-between",children:[R.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase",children:e.title}),R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[n.length,e.limit&&` / ${e.limit}`]}),o&&R.jsx(le.Badge,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),R.jsx(le.ScrollArea,{className:"flex-1 p-4",children:R.jsx(Co,{items:n.map(i=>i.id),strategy:xo,children:R.jsx("div",{className:"space-y-2",children:n.map(i=>R.jsx(wn,{card:i},i.id))})})})]})}function ko({columns:e,onCardMove:t,className:n}){const[r,o]=xe.useState(null),i=xe.useMemo(()=>(e||[]).map(m=>({...m,cards:m.cards||[]})),[e]),[s,a]=xe.useState(i);xe.useEffect(()=>{a(i)},[i]);const c=Qn(Gn(St,{activationConstraint:{distance:8}})),u=m=>{const{active:v}=m,b=g(v.id);o(b)},f=m=>{const{active:v,over:b}=m;if(o(null),!b)return;const x=v.id,C=b.id;if(x===C)return;const w=p(x),D=p(C)||h(C);if(!(!w||!D))if(w.id===D.id){const S=[...w.cards],O=S.findIndex(A=>A.id===x),E=S.findIndex(A=>A.id===C),T=At(S,O,E);a(A=>A.map(j=>j.id===w.id?{...j,cards:T}:j))}else{const S=[...w.cards],O=[...D.cards],E=S.findIndex(N=>N.id===x),A=C===D.id?O.length:O.findIndex(N=>N.id===C),[j]=S.splice(E,1);O.splice(A,0,j),a(N=>N.map(L=>L.id===w.id?{...L,cards:S}:L.id===D.id?{...L,cards:O}:L)),t&&t(x,w.id,D.id,A)}},g=xe.useCallback(m=>{for(const v of s){const b=v.cards.find(x=>x.id===m);if(b)return b}return null},[s]),p=xe.useCallback(m=>s.find(v=>v.cards.some(b=>b.id===m))||null,[s]),h=xe.useCallback(m=>s.find(v=>v.id===m)||null,[s]);return R.jsxs(Qr,{sensors:c,collisionDetection:or,onDragStart:u,onDragEnd:f,children:[R.jsx("div",{className:xn("flex gap-4 overflow-x-auto p-4",n),children:s.map(m=>R.jsx(Io,{column:m,cards:m.cards},m.id))}),R.jsx(po,{children:r?R.jsx(wn,{card:r}):null})]})}const Mo=Object.freeze(Object.defineProperty({__proto__:null,default:ko},Symbol.toStringTag,{value:"Module"}));te.KanbanRenderer=gt,te.kanbanComponents=_n,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|
|
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`,`
|
|
11
|
+
font-size: .6rem;
|
|
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"})}));
|