@object-ui/runner 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{j as r}from"./index-8emMxspz.js";import{R as l,B as n,C as d,X as f,Y as p,T as x,L as u,a as c}from"./BarChart-DYbBv-5t.js";function j({data:e=[],dataKey:s="value",xAxisKey:a="name",height:t=400,className:i="",color:o="hsl(var(--primary))"}){return r.jsx("div",{className:`p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,children:r.jsx(l,{width:"100%",height:t,children:r.jsxs(n,{data:e,margin:{top:10,right:10,left:10,bottom:5},children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"barGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:1}),r.jsx("stop",{offset:"90%",stopColor:o,stopOpacity:.6}),r.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:.3})]}),r.jsxs("filter",{id:"glow",height:"130%",children:[r.jsx("feGaussianBlur",{in:"SourceAlpha",stdDeviation:"3",result:"blur"}),r.jsx("feOffset",{in:"blur",dx:"0",dy:"0",result:"offsetBlur"}),r.jsx("feFlood",{floodColor:o,floodOpacity:"0.5",result:"offsetColor"}),r.jsx("feComposite",{in:"offsetColor",in2:"offsetBlur",operator:"in",result:"offsetBlur"}),r.jsxs("feMerge",{children:[r.jsx("feMergeNode",{in:"offsetBlur"}),r.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),r.jsx(d,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",vertical:!1}),r.jsx(f,{dataKey:a,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12,fontFamily:"monospace"},tickLine:!1,axisLine:{stroke:"hsl(var(--border))"},dy:10}),r.jsx(p,{tick:{fill:"hsl(var(--muted-foreground))",fontSize:12,fontFamily:"monospace"},tickLine:!1,axisLine:!1}),r.jsx(x,{cursor:{fill:"hsl(var(--muted))",opacity:.2},contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"8px",fontFamily:"monospace",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)"},itemStyle:{color:"hsl(var(--primary))"}}),r.jsx(u,{wrapperStyle:{paddingTop:"20px",fontFamily:"monospace"}}),r.jsx(c,{dataKey:s,fill:"url(#barGradient)",radius:[4,4,0,0],filter:"url(#glow)",animationDuration:1500})]})})})}export{j as default};
1
+ import{j as r,k as l}from"./index-AYz2yBxa.js";import{B as n,C as d,X as f,Y as p,T as x,L as u,a as c}from"./BarChart-GEH9HInN.js";function j({data:e=[],dataKey:s="value",xAxisKey:a="name",height:t=400,className:i="",color:o="hsl(var(--primary))"}){return r.jsx("div",{className:`p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,children:r.jsx(l,{width:"100%",height:t,children:r.jsxs(n,{data:e,margin:{top:10,right:10,left:10,bottom:5},children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"barGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:1}),r.jsx("stop",{offset:"90%",stopColor:o,stopOpacity:.6}),r.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:.3})]}),r.jsxs("filter",{id:"glow",height:"130%",children:[r.jsx("feGaussianBlur",{in:"SourceAlpha",stdDeviation:"3",result:"blur"}),r.jsx("feOffset",{in:"blur",dx:"0",dy:"0",result:"offsetBlur"}),r.jsx("feFlood",{floodColor:o,floodOpacity:"0.5",result:"offsetColor"}),r.jsx("feComposite",{in:"offsetColor",in2:"offsetBlur",operator:"in",result:"offsetBlur"}),r.jsxs("feMerge",{children:[r.jsx("feMergeNode",{in:"offsetBlur"}),r.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),r.jsx(d,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",vertical:!1}),r.jsx(f,{dataKey:a,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12,fontFamily:"monospace"},tickLine:!1,axisLine:{stroke:"hsl(var(--border))"},dy:10}),r.jsx(p,{tick:{fill:"hsl(var(--muted-foreground))",fontSize:12,fontFamily:"monospace"},tickLine:!1,axisLine:!1}),r.jsx(x,{cursor:{fill:"hsl(var(--muted))",opacity:.2},contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"8px",fontFamily:"monospace",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)"},itemStyle:{color:"hsl(var(--primary))"}}),r.jsx(u,{wrapperStyle:{paddingTop:"20px",fontFamily:"monospace"}}),r.jsx(c,{dataKey:s,fill:"url(#barGradient)",radius:[4,4,0,0],filter:"url(#glow)",animationDuration:1500})]})})})}export{j as default};
@@ -0,0 +1,4 @@
1
+ import{r as g,g as G,j as a,f as U,h as J,i as Q,B as L,T as Z,C as ee,b as te,c as se,d as ne,e as ie,P as re,I as le}from"./index-AYz2yBxa.js";import{u as oe,a as ae,D as ce,c as he,b as de,d as ue,P as fe,e as X,S as me,v as ge,C as pe}from"./sortable.esm-BVWPU3MA.js";function N(i,o,e){let s=e.initialDeps??[],t,n=!0;function l(){var r,h,d;let u;e.key&&((r=e.debug)!=null&&r.call(e))&&(u=Date.now());const m=i();if(!(m.length!==s.length||m.some((E,v)=>s[v]!==E)))return t;s=m;let x;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(x=Date.now()),t=o(...m),e.key&&((d=e.debug)!=null&&d.call(e))){const E=Math.round((Date.now()-u)*100)/100,v=Math.round((Date.now()-x)*100)/100,y=v/16,M=(S,k)=>{for(S=String(S);S.length<k;)S=" "+S;return S};console.info(`%c⏱ ${M(v,5)} /${M(E,5)} ms`,`
2
+ font-size: .6rem;
3
+ font-weight: bold;
4
+ color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,e==null?void 0:e.key)}return e!=null&&e.onChange&&!(n&&e.skipInitialOnChange)&&e.onChange(t),n=!1,t}return l.updateDeps=r=>{s=r},l}function P(i,o){if(i===void 0)throw new Error("Unexpected undefined");return i}const xe=(i,o)=>Math.abs(i-o)<1.01,ve=(i,o,e)=>{let s;return function(...t){i.clearTimeout(s),s=i.setTimeout(()=>o.apply(this,t),e)}},H=i=>{const{offsetWidth:o,offsetHeight:e}=i;return{width:o,height:e}},be=i=>i,Se=i=>{const o=Math.max(i.startIndex-i.overscan,0),e=Math.min(i.endIndex+i.overscan,i.count-1),s=[];for(let t=o;t<=e;t++)s.push(t);return s},Ce=(i,o)=>{const e=i.scrollElement;if(!e)return;const s=i.targetWindow;if(!s)return;const t=l=>{const{width:r,height:h}=l;o({width:Math.round(r),height:Math.round(h)})};if(t(H(e)),!s.ResizeObserver)return()=>{};const n=new s.ResizeObserver(l=>{const r=()=>{const h=l[0];if(h!=null&&h.borderBoxSize){const d=h.borderBoxSize[0];if(d){t({width:d.inlineSize,height:d.blockSize});return}}t(H(e))};i.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return n.observe(e,{box:"border-box"}),()=>{n.unobserve(e)}},$={passive:!0},K=typeof window>"u"?!0:"onscrollend"in window,we=(i,o)=>{const e=i.scrollElement;if(!e)return;const s=i.targetWindow;if(!s)return;let t=0;const n=i.options.useScrollendEvent&&K?()=>{}:ve(s,()=>{o(t,!1)},i.options.isScrollingResetDelay),l=u=>()=>{const{horizontal:m,isRtl:c}=i.options;t=m?e.scrollLeft*(c&&-1||1):e.scrollTop,n(),o(t,u)},r=l(!0),h=l(!1);e.addEventListener("scroll",r,$);const d=i.options.useScrollendEvent&&K;return d&&e.addEventListener("scrollend",h,$),()=>{e.removeEventListener("scroll",r),d&&e.removeEventListener("scrollend",h)}},Ee=(i,o,e)=>{if(o!=null&&o.borderBoxSize){const s=o.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return i[e.options.horizontal?"offsetWidth":"offsetHeight"]},ye=(i,{adjustments:o=0,behavior:e},s)=>{var t,n;const l=i+o;(n=(t=s.scrollElement)==null?void 0:t.scrollTo)==null||n.call(t,{[s.options.horizontal?"left":"top"]:l,behavior:e})};class Ie{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=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.now=()=>{var e,s,t;return((t=(s=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:s.now)==null?void 0:t.call(s))??Date.now()},this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(t=>{t.forEach(n=>{const l=()=>{this._measureElement(n.target,n)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var t;(t=s())==null||t.disconnect(),e=null},observe:t=>{var n;return(n=s())==null?void 0:n.observe(t,{box:"border-box"})},unobserve:t=>{var n;return(n=s())==null?void 0:n.unobserve(t)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,t])=>{typeof t>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:be,rangeExtractor:Se,onChange:()=>{},measureElement:Ee,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,...e}},this.notify=e=>{var s,t;(t=(s=this.options).onChange)==null||t.call(s,this,e)},this.maybeNotify=N(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,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(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=n,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,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=(e,s)=>{const t=new Map,n=new Map;for(let l=s-1;l>=0;l--){const r=e[l];if(t.has(r.lane))continue;const h=n.get(r.lane);if(h==null||r.end>h.end?n.set(r.lane,r):r.end<h.end&&t.set(r.lane,!0),t.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((l,r)=>l.end===r.end?l.index-r.index:l.end-r.end)[0]:void 0},this.getMeasurementOptions=N(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,s,t,n,l,r)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=!0),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:l,lanes:r}),{key:!1}),this.getMeasurements=N(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:l,lanes:r},h)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const c of this.laneAssignments.keys())c>=e&&this.laneAssignments.delete(c);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(c=>{this.itemSizeCache.set(c.key,c.size)}));const d=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const u=this.measurementsCache.slice(0,d),m=new Array(r).fill(void 0);for(let c=0;c<d;c++){const x=u[c];x&&(m[x.lane]=c)}for(let c=d;c<e;c++){const x=n(c),E=this.laneAssignments.get(c);let v,y;if(E!==void 0&&this.options.lanes>1){v=E;const w=m[v],f=w!==void 0?u[w]:void 0;y=f?f.end+this.options.gap:s+t}else{const w=this.options.lanes===1?u[c-1]:this.getFurthestMeasurement(u,c);y=w?w.end+this.options.gap:s+t,v=w?w.lane:c%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(c,v)}const M=h.get(x),S=typeof M=="number"?M:this.options.estimateSize(c),k=y+S;u[c]={index:c,start:y,size:S,end:k,key:x,lane:v},m[v]=c}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=N(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,t,n)=>this.range=e.length>0&&s>0?Me({measurements:e,outerSize:s,scrollOffset:t,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=N(()=>{let e=null,s=null;const t=this.calculateRange();return t&&(e=t.startIndex,s=t.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,t,n,l)=>n===null||l===null?[]:e({startIndex:n,endIndex:l,overscan:s,count:t}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,t=e.getAttribute(s);return t?parseInt(t,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const t=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(t!==void 0&&this.range){const n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,t-n),r=Math.min(this.options.count-1,t+n);return e>=l&&e<=r}return!0},this._measureElement=(e,s)=>{if(!e.isConnected){this.observer.unobserve(e);return}const t=this.indexFromElement(e),n=this.measurementsCache[t];if(!n)return;const l=n.key,r=this.elementsCache.get(l);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(l,e)),this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{var t;const n=this.measurementsCache[e];if(!n)return;const l=this.itemSizeCache.get(n.key)??n.size,r=s-l;r!==0&&(((t=this.scrollState)==null?void 0:t.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,s)),this.notify(!1))},this.measureElement=e=>{if(!e){this.elementsCache.forEach((s,t)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(t))});return}this._measureElement(e,void 0)},this.getVirtualItems=N(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const t=[];for(let n=0,l=e.length;n<l;n++){const r=e[n],h=s[r];t.push(h)}return t},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return P(s[Y(0,s.length-1,t=>P(s[t]).start,e)])},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 e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,s,t=0)=>{if(!this.scrollElement)return 0;const n=this.getSize(),l=this.getScrollOffset();s==="auto"&&(s=e>=l+n?"end":"start"),s==="center"?e+=(t-n)/2:s==="end"&&(e-=n);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const t=this.getSize(),n=this.getScrollOffset(),l=this.measurementsCache[e];if(!l)return;if(s==="auto")if(l.end>=n+t-this.options.scrollPaddingEnd)s="end";else if(l.start<=n+this.options.scrollPaddingStart)s="start";else return[n,s];if(s==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),s];const r=s==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,s,l.size),s]},this.scrollToOffset=(e,{align:s="start",behavior:t="auto"}={})=>{const n=this.getOffsetForAlignment(e,s),l=this.now();this.scrollState={index:null,align:s,behavior:t,startedAt:l,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:s="auto",behavior:t="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.getOffsetForIndex(e,s);if(!n)return;const[l,r]=n,h=this.now();this.scrollState={index:e,align:r,behavior:t,startedAt:h,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:s="auto"}={})=>{const t=this.getScrollOffset()+e,n=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:n,lastTargetOffset:t,stableFrames:0},this._scrollToOffset(t,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let t;if(s.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=((e=s[s.length-1])==null?void 0:e.end)??0;else{const n=Array(this.options.lanes).fill(null);let l=s.length-1;for(;l>=0&&n.some(r=>r===null);){const r=s[l];n[r.lane]===null&&(n[r.lane]=r.end),l--}t=Math.max(...n.filter(r=>r!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:t})=>{this.options.scrollToFn(e,{behavior:t,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(o)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=s?s[0]:this.scrollState.lastTargetOffset,n=1,l=t!==this.scrollState.lastTargetOffset;if(!l&&xe(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.scrollState=null;return}}else this.scrollState.stableFrames=0,l&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior="auto",this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Y=(i,o,e,s)=>{for(;i<=o;){const t=(i+o)/2|0,n=e(t);if(n<s)i=t+1;else if(n>s)o=t-1;else return t}return i>0?i-1:0};function Me({measurements:i,outerSize:o,scrollOffset:e,lanes:s}){const t=i.length-1,n=h=>i[h].start;if(i.length<=s)return{startIndex:0,endIndex:t};let l=Y(0,t,n,e),r=l;if(s===1)for(;r<t&&i[r].end<e+o;)r++;else if(s>1){const h=Array(s).fill(0);for(;r<t&&h.some(u=>u<e+o);){const u=i[r];h[u.lane]=u.end,r++}const d=Array(s).fill(e+o);for(;l>=0&&d.some(u=>u>=e);){const u=i[l];d[u.lane]=u.start,l--}l=Math.max(0,l-l%s),r=Math.min(t,r+(s-1-r%s))}return{startIndex:l,endIndex:r}}const q=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Oe({useFlushSync:i=!0,...o}){const e=g.useReducer(()=>({}),{})[1],s={...o,onChange:(n,l)=>{var r;i&&l?G.flushSync(e):e(),(r=o.onChange)==null||r.call(o,n,l)}},[t]=g.useState(()=>new Ie(s));return t.setOptions(s),q(()=>t._didMount(),[]),q(()=>t._willUpdate()),t}function ze(i){return Oe({observeElementRect:Ce,observeElementOffset:we,scrollToFn:ye,...i})}const W=(...i)=>i.filter(Boolean).join(" ");function je(i,o){if(!o||o.length===0)return{};for(const e of o){const s=i[e.field];if(s==null)continue;let t=!1;const n=String(s);switch(e.operator){case"equals":t=n===String(e.value);break;case"not_equals":t=n!==String(e.value);break;case"contains":t=n.toLowerCase().includes(String(e.value).toLowerCase());break;case"in":t=Array.isArray(e.value)&&e.value.includes(n);break}if(t)return{...e.backgroundColor?{backgroundColor:e.backgroundColor}:{},...e.borderColor?{borderColor:e.borderColor}:{}}}return{}}function B({card:i,conditionalFormatting:o}){const{attributes:e,listeners:s,setNodeRef:t,transform:n,transition:l,isDragging:r}=X({id:i.id}),h={transform:pe.Transform.toString(n),transition:l,opacity:r?.5:void 0},d=je(i,o);return a.jsx("div",{ref:t,style:h,...e,...s,children:a.jsxs(ee,{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",style:d,children:[i.coverImage&&a.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:a.jsx("img",{src:i.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),a.jsxs(te,{className:"p-4",children:[a.jsx(se,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:i.title}),i.description&&a.jsx(ne,{className:"text-xs text-muted-foreground font-mono",children:i.description})]}),i.badges&&i.badges.length>0&&a.jsx(ie,{className:"p-4 pt-0",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:i.badges.map((u,m)=>a.jsx(L,{variant:u.variant||"default",className:"text-xs",children:u.label},m))})})]})})}function Ae({cards:i,parentRef:o,conditionalFormatting:e}){const s=ze({count:i.length,getScrollElement:()=>o.current,estimateSize:()=>120,overscan:5});return a.jsx("div",{style:{height:`${s.getTotalSize()}px`,width:"100%",position:"relative"},children:s.getVirtualItems().map(t=>{const n=i[t.index];return a.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${t.start}px)`},children:a.jsx(B,{card:n,conditionalFormatting:e})},n.id)})})}function Re({columnId:i,onAdd:o}){const[e,s]=g.useState(!1),[t,n]=g.useState(""),l=g.useRef(null),r=()=>{const d=t.trim();d&&(o(i,d),n("")),s(!1)},h=d=>{d.key==="Enter"?(d.preventDefault(),r()):d.key==="Escape"&&(n(""),s(!1))};return e?a.jsx("div",{className:"mt-2 space-y-2",children:a.jsx(le,{ref:l,value:t,onChange:d=>n(d.target.value),onKeyDown:h,onBlur:r,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):a.jsxs(U,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{s(!0),setTimeout(()=>{var d;return(d=l.current)==null?void 0:d.focus()},0)},children:[a.jsx(re,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function Ne({column:i,cards:o,onToggle:e,enableVirtual:s,quickAdd:t,onQuickAdd:n,conditionalFormatting:l}){const r=o||[],h=g.useRef(null),{setNodeRef:d}=X({id:i.id,data:{type:"column"}}),u=i.limit&&r.length>=i.limit,m=i.limit&&r.length>=i.limit*.8;return a.jsxs("div",{ref:d,className:W("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",i.collapsed?"w-16":"w-80",i.className),children:[a.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>e(!i.collapsed),children:i.collapsed?a.jsx(J,{className:"h-4 w-4"}):a.jsx(Q,{className:"h-4 w-4"})}),!i.collapsed&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:i.title}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:W("font-mono text-xs",u?"text-destructive":m?"text-yellow-500":"text-muted-foreground"),children:[r.length,i.limit&&` / ${i.limit}`]}),u&&a.jsx(L,{variant:"destructive",className:"text-xs",children:"Full"}),m&&!u&&a.jsx(Z,{className:"h-3 w-3 text-yellow-500"})]})]})]}),i.collapsed&&a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:i.title}),a.jsx(L,{variant:"secondary",className:"text-xs",children:r.length})]})]}),!i.collapsed&&a.jsxs("div",{ref:h,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:[a.jsx(me,{items:r.map(c=>c.id),strategy:ge,children:s?a.jsx(Ae,{cards:r,parentRef:h,conditionalFormatting:l}):a.jsx("div",{className:"space-y-2",children:r.map(c=>a.jsx(B,{card:c,conditionalFormatting:l},c.id))})}),t&&n&&a.jsx(Re,{columnId:i.id,onAdd:n})]})]})}function Fe({columns:i,onCardMove:o,onColumnToggle:e,enableVirtualScrolling:s=!1,virtualScrollThreshold:t=50,className:n,quickAdd:l,onQuickAdd:r,conditionalFormatting:h}){const[d,u]=g.useState(null),m=g.useMemo(()=>(i||[]).map(f=>({...f,cards:f.cards||[]})),[i]),[c,x]=g.useState(m);g.useEffect(()=>{x(m)},[m]);const E=oe(ae(fe,{activationConstraint:{distance:8}})),v=f=>{const{active:p}=f,b=M(p.id);u(b)},y=f=>{const{active:p,over:b}=f;if(u(null),!b)return;const C=p.id,j=b.id;if(C===j)return;const O=S(C),A=S(j)||k(j);if(!(!O||!A))if(O.id===A.id){const z=[...O.cards],R=z.findIndex(I=>I.id===C),T=z.findIndex(I=>I.id===j),V=ue(z,R,T);x(I=>I.map(_=>_.id===O.id?{..._,cards:V}:_))}else{const z=[...O.cards],R=[...A.cards],T=z.findIndex(F=>F.id===C),I=j===A.id?R.length:R.findIndex(F=>F.id===j),[_]=z.splice(T,1);R.splice(I,0,_),x(F=>F.map(D=>D.id===O.id?{...D,cards:z}:D.id===A.id?{...D,cards:R}:D)),o&&o(C,O.id,A.id,I)}},M=g.useCallback(f=>{for(const p of c){const b=p.cards.find(C=>C.id===f);if(b)return b}return null},[c]),S=g.useCallback(f=>c.find(p=>p.cards.some(b=>b.id===f))||null,[c]),k=g.useCallback(f=>c.find(p=>p.id===f)||null,[c]),w=g.useCallback((f,p)=>{x(b=>b.map(C=>C.id===f?{...C,collapsed:p}:C)),e==null||e(f,p)},[e]);return a.jsxs(ce,{sensors:E,collisionDetection:he,onDragStart:v,onDragEnd:y,children:[a.jsx("div",{className:W("flex gap-4 overflow-x-auto p-4",n),children:c.map(f=>{const p=s&&f.cards.length>t;return a.jsx(Ne,{column:f,cards:f.cards,onToggle:b=>w(f.id,b),enableVirtual:p,quickAdd:l,onQuickAdd:r,conditionalFormatting:h},f.id)})}),a.jsx(de,{children:d?a.jsx(B,{card:d,conditionalFormatting:h}):null})]})}export{Fe as KanbanEnhanced,Fe as default};
@@ -1 +1 @@
1
- import{u as Q,j as e,a as F,r as p,C as ee,b as se,c as te,d as re,e as ae,B as $,S as ne,f as ie,P as oe,I as le}from"./index-8emMxspz.js";import{u as de,a as V,D as ce,c as ue,S as _,v as H,b as me,d as xe,T as fe,P as pe,e as J,C as ge}from"./sortable.esm-Z3XZC_LB.js";const E=(...s)=>s.filter(Boolean).join(" "),T="Uncategorized";function he(s,l){if(!l||l.length===0)return{};for(const i of l){const u=s[i.field];if(u==null)continue;let a=!1;const m=String(u);switch(i.operator){case"equals":a=m===String(i.value);break;case"not_equals":a=m!==String(i.value);break;case"contains":a=m.toLowerCase().includes(String(i.value).toLowerCase());break;case"in":a=Array.isArray(i.value)&&i.value.includes(m);break}if(a)return{...i.backgroundColor?{backgroundColor:i.backgroundColor}:{},...i.borderColor?{borderColor:i.borderColor}:{}}}return{}}function O({card:s,onCardClick:l,conditionalFormatting:i}){const{attributes:u,listeners:a,setNodeRef:m,transform:x,transition:b,isDragging:g}=J({id:s.id}),r={transform:ge.Transform.toString(x),transition:b,opacity:g?.5:void 0},v=he(s,i);return e.jsx("div",{ref:m,style:r,...u,...a,role:"listitem","aria-label":s.title,onClick:()=>l==null?void 0:l(s),children:e.jsxs(ee,{className:"mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",style:v,children:[s.coverImage&&e.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:e.jsx("img",{src:s.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),e.jsxs(se,{className:"p-2 sm:p-4",children:[e.jsx(te,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(re,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(ae,{className:"p-2 sm:p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((w,y)=>e.jsx($,{variant:w.variant||"default",className:"text-xs",children:w.label},y))})})]})})}function be({columnId:s,onAdd:l}){const[i,u]=p.useState(!1),[a,m]=p.useState(""),x=p.useRef(null),b=()=>{const r=a.trim();r&&(l(s,r),m("")),u(!1)},g=r=>{r.key==="Enter"?(r.preventDefault(),b()):r.key==="Escape"&&(m(""),u(!1))};return i?e.jsx("div",{className:"mt-2 space-y-2",children:e.jsx(le,{ref:x,value:a,onChange:r=>m(r.target.value),onKeyDown:g,onBlur:b,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):e.jsxs(ie,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{u(!0),setTimeout(()=>{var r;return(r=x.current)==null?void 0:r.focus()},0)},children:[e.jsx(oe,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function ve({column:s,cards:l,onCardClick:i,quickAdd:u,onQuickAdd:a,conditionalFormatting:m}){const x=l||[],{setNodeRef:b}=J({id:s.id,data:{type:"column"}}),g=s.limit&&x.length>=s.limit;return e.jsxs("div",{ref:b,role:"group","aria-label":s.title,className:E("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",s.className),children:[e.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/30 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{id:`kanban-col-${s.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs($,{variant:"secondary",className:"text-xs font-mono tabular-nums",children:[x.length,s.limit&&` / ${s.limit}`]}),g&&e.jsx($,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),e.jsxs(ne,{className:"flex-1 p-4",children:[e.jsx(_,{items:x.map(r=>r.id),strategy:H,children:e.jsxs("div",{className:"space-y-2",role:"list","aria-label":`${s.title} cards`,children:[x.length===0&&e.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground/50",children:e.jsx("span",{className:"text-xs font-mono",children:"No cards"})}),x.map(r=>e.jsx(O,{card:r,onCardClick:i,conditionalFormatting:m},r.id))]})}),u&&a&&e.jsx(be,{columnId:s.id,onAdd:a})]})]})}function je({children:s}){const l=F();return e.jsx(e.Fragment,{children:s(l)})}function Ne({columns:s,onCardMove:l,onCardClick:i,className:u,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g}){return Q()?e.jsx(je,{children:v=>e.jsx(z,{columns:s,onCardMove:l,onCardClick:i,className:u,dnd:v,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g})}):e.jsx(z,{columns:s,onCardMove:l,onCardClick:i,className:u,dnd:null,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g})}function z({columns:s,onCardMove:l,onCardClick:i,className:u,dnd:a,quickAdd:m,onQuickAdd:x,coverImageField:b,conditionalFormatting:g,swimlaneField:r}){const[v,w]=p.useState(null),y=r?`objectui:kanban-collapsed:${r}`:null,[M,U]=p.useState(()=>{if(!y)return new Set;try{const t=localStorage.getItem(y);if(t){const o=JSON.parse(t);if(Array.isArray(o))return new Set(o.filter(n=>typeof n=="string"))}}catch{}return new Set}),A=p.useMemo(()=>(s||[]).map(t=>({...t,cards:t.cards||[]})),[s]),[f,B]=p.useState(A);p.useEffect(()=>{B(A)},[A]);const R=p.useMemo(()=>{if(!r)return null;const t=f.flatMap(n=>n.cards),o=new Set;return t.forEach(n=>{const d=n[r];o.add(d!=null?String(d):T)}),Array.from(o).sort()},[f,r]),q=p.useCallback(t=>{U(o=>{const n=new Set(o);if(n.has(t)?n.delete(t):n.add(t),y)try{localStorage.setItem(y,JSON.stringify([...n]))}catch{}return n})},[y]),G=de(V(pe,{activationConstraint:{distance:5}}),V(fe,{activationConstraint:{delay:200,tolerance:5}})),Z=t=>{const{active:o}=t,n=X(o.id);if(w(n),a&&n){const d=K(n.id);d&&a.startDrag({id:n.id,type:"kanban-card",data:n,sourceId:d.id})}},W=t=>{const{active:o,over:n}=t;if(w(null),!n){a&&a.endDrag();return}const d=o.id,h=n.id;if(d===h){a&&a.endDrag();return}const c=K(d),C=K(h)||Y(h);if(!c||!C){a&&a.endDrag();return}if(c.id===C.id){const N=[...c.cards],S=N.findIndex(j=>j.id===d),L=N.findIndex(j=>j.id===h),P=xe(N,S,L);B(j=>j.map(D=>D.id===c.id?{...D,cards:P}:D))}else{const N=[...c.cards],S=[...C.cards],L=N.findIndex(I=>I.id===d),j=h===C.id?S.length:S.findIndex(I=>I.id===h),[D]=N.splice(L,1);S.splice(j,0,D),B(I=>I.map(k=>k.id===c.id?{...k,cards:N}:k.id===C.id?{...k,cards:S}:k)),l&&l(d,c.id,C.id,j)}a&&a.endDrag(C.id)},X=p.useCallback(t=>{for(const o of f){const n=o.cards.find(d=>d.id===t);if(n)return n}return null},[f]),K=p.useCallback(t=>f.find(o=>o.cards.some(n=>n.id===t))||null,[f]),Y=p.useCallback(t=>f.find(o=>o.id===t)||null,[f]);return e.jsxs(ce,{sensors:G,collisionDetection:ue,onDragStart:Z,onDragEnd:W,children:[e.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[f.length," columns"]}),e.jsx("span",{children:"← Swipe to navigate →"})]}),R?e.jsxs("div",{className:E("flex flex-col gap-1 p-2 sm:p-4 min-w-0 overflow-hidden",u),role:"region","aria-label":"Kanban board with swimlanes",children:[e.jsx("div",{className:"flex gap-3 sm:gap-4 pl-36 sm:pl-44 overflow-x-auto",children:f.map(t=>e.jsxs("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 text-center",children:[e.jsx("span",{className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase",children:t.title}),e.jsxs("span",{className:"ml-2 font-mono text-xs text-muted-foreground",children:["(",t.cards.length,")"]})]},t.id))}),R.map(t=>{const o=M.has(t),n=f.reduce((d,h)=>d+h.cards.filter(c=>(c[r]!=null?String(c[r]):T)===t).length,0);return e.jsxs("div",{className:"border rounded-lg bg-muted/10",children:[e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>q(t),"aria-expanded":!o,children:[e.jsx("span",{className:E("transition-transform text-xs",o?"":"rotate-90"),children:"▶"}),e.jsx("span",{className:"font-mono text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:t}),e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["(",n,")"]})]}),!o&&e.jsx("div",{className:"flex gap-3 sm:gap-4 overflow-x-auto px-2 pb-3 pl-36 sm:pl-44",children:f.map(d=>{const h=d.cards.filter(c=>(c[r]!=null?String(c[r]):T)===t);return e.jsx("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 min-h-[60px] rounded-md bg-card/20 p-2",children:e.jsx(_,{items:h.map(c=>c.id),strategy:H,children:e.jsx("div",{className:"space-y-2",role:"list","aria-label":`${d.title} - ${t} cards`,children:h.map(c=>e.jsx(O,{card:c,onCardClick:i,conditionalFormatting:g},c.id))})})},d.id)})})]},t)})]}):e.jsx("div",{className:E("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 bg-muted/10 rounded-lg [-webkit-overflow-scrolling:touch] min-w-0",u),role:"region","aria-label":"Kanban board",children:f.map(t=>e.jsx(ve,{column:t,cards:t.cards,onCardClick:i,quickAdd:m,onQuickAdd:x,conditionalFormatting:g},t.id))}),e.jsx(me,{children:e.jsx("div",{"aria-live":"assertive","aria-label":v?`Dragging ${v.title}`:void 0,children:v?e.jsx(O,{card:v,conditionalFormatting:g}):null})})]})}export{Ne as default};
1
+ import{u as Q,j as e,a as F,r as p,C as ee,b as se,c as te,d as re,e as ae,B as $,S as ne,f as ie,P as oe,I as le}from"./index-AYz2yBxa.js";import{u as de,a as V,D as ce,c as ue,S as _,v as H,b as me,d as xe,T as fe,P as pe,e as J,C as ge}from"./sortable.esm-BVWPU3MA.js";const E=(...s)=>s.filter(Boolean).join(" "),T="Uncategorized";function he(s,l){if(!l||l.length===0)return{};for(const i of l){const u=s[i.field];if(u==null)continue;let a=!1;const m=String(u);switch(i.operator){case"equals":a=m===String(i.value);break;case"not_equals":a=m!==String(i.value);break;case"contains":a=m.toLowerCase().includes(String(i.value).toLowerCase());break;case"in":a=Array.isArray(i.value)&&i.value.includes(m);break}if(a)return{...i.backgroundColor?{backgroundColor:i.backgroundColor}:{},...i.borderColor?{borderColor:i.borderColor}:{}}}return{}}function O({card:s,onCardClick:l,conditionalFormatting:i}){const{attributes:u,listeners:a,setNodeRef:m,transform:x,transition:b,isDragging:g}=J({id:s.id}),r={transform:ge.Transform.toString(x),transition:b,opacity:g?.5:void 0},v=he(s,i);return e.jsx("div",{ref:m,style:r,...u,...a,role:"listitem","aria-label":s.title,onClick:()=>l==null?void 0:l(s),children:e.jsxs(ee,{className:"mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",style:v,children:[s.coverImage&&e.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:e.jsx("img",{src:s.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),e.jsxs(se,{className:"p-2 sm:p-4",children:[e.jsx(te,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(re,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(ae,{className:"p-2 sm:p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((w,y)=>e.jsx($,{variant:w.variant||"default",className:"text-xs",children:w.label},y))})})]})})}function be({columnId:s,onAdd:l}){const[i,u]=p.useState(!1),[a,m]=p.useState(""),x=p.useRef(null),b=()=>{const r=a.trim();r&&(l(s,r),m("")),u(!1)},g=r=>{r.key==="Enter"?(r.preventDefault(),b()):r.key==="Escape"&&(m(""),u(!1))};return i?e.jsx("div",{className:"mt-2 space-y-2",children:e.jsx(le,{ref:x,value:a,onChange:r=>m(r.target.value),onKeyDown:g,onBlur:b,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):e.jsxs(ie,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{u(!0),setTimeout(()=>{var r;return(r=x.current)==null?void 0:r.focus()},0)},children:[e.jsx(oe,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function ve({column:s,cards:l,onCardClick:i,quickAdd:u,onQuickAdd:a,conditionalFormatting:m}){const x=l||[],{setNodeRef:b}=J({id:s.id,data:{type:"column"}}),g=s.limit&&x.length>=s.limit;return e.jsxs("div",{ref:b,role:"group","aria-label":s.title,className:E("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",s.className),children:[e.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/30 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{id:`kanban-col-${s.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs($,{variant:"secondary",className:"text-xs font-mono tabular-nums",children:[x.length,s.limit&&` / ${s.limit}`]}),g&&e.jsx($,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),e.jsxs(ne,{className:"flex-1 p-4",children:[e.jsx(_,{items:x.map(r=>r.id),strategy:H,children:e.jsxs("div",{className:"space-y-2",role:"list","aria-label":`${s.title} cards`,children:[x.length===0&&e.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground/50",children:e.jsx("span",{className:"text-xs font-mono",children:"No cards"})}),x.map(r=>e.jsx(O,{card:r,onCardClick:i,conditionalFormatting:m},r.id))]})}),u&&a&&e.jsx(be,{columnId:s.id,onAdd:a})]})]})}function je({children:s}){const l=F();return e.jsx(e.Fragment,{children:s(l)})}function Ne({columns:s,onCardMove:l,onCardClick:i,className:u,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g}){return Q()?e.jsx(je,{children:v=>e.jsx(z,{columns:s,onCardMove:l,onCardClick:i,className:u,dnd:v,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g})}):e.jsx(z,{columns:s,onCardMove:l,onCardClick:i,className:u,dnd:null,quickAdd:a,onQuickAdd:m,coverImageField:x,conditionalFormatting:b,swimlaneField:g})}function z({columns:s,onCardMove:l,onCardClick:i,className:u,dnd:a,quickAdd:m,onQuickAdd:x,coverImageField:b,conditionalFormatting:g,swimlaneField:r}){const[v,w]=p.useState(null),y=r?`objectui:kanban-collapsed:${r}`:null,[M,U]=p.useState(()=>{if(!y)return new Set;try{const t=localStorage.getItem(y);if(t){const o=JSON.parse(t);if(Array.isArray(o))return new Set(o.filter(n=>typeof n=="string"))}}catch{}return new Set}),A=p.useMemo(()=>(s||[]).map(t=>({...t,cards:t.cards||[]})),[s]),[f,B]=p.useState(A);p.useEffect(()=>{B(A)},[A]);const R=p.useMemo(()=>{if(!r)return null;const t=f.flatMap(n=>n.cards),o=new Set;return t.forEach(n=>{const d=n[r];o.add(d!=null?String(d):T)}),Array.from(o).sort()},[f,r]),q=p.useCallback(t=>{U(o=>{const n=new Set(o);if(n.has(t)?n.delete(t):n.add(t),y)try{localStorage.setItem(y,JSON.stringify([...n]))}catch{}return n})},[y]),G=de(V(pe,{activationConstraint:{distance:5}}),V(fe,{activationConstraint:{delay:200,tolerance:5}})),Z=t=>{const{active:o}=t,n=X(o.id);if(w(n),a&&n){const d=K(n.id);d&&a.startDrag({id:n.id,type:"kanban-card",data:n,sourceId:d.id})}},W=t=>{const{active:o,over:n}=t;if(w(null),!n){a&&a.endDrag();return}const d=o.id,h=n.id;if(d===h){a&&a.endDrag();return}const c=K(d),C=K(h)||Y(h);if(!c||!C){a&&a.endDrag();return}if(c.id===C.id){const N=[...c.cards],S=N.findIndex(j=>j.id===d),L=N.findIndex(j=>j.id===h),P=xe(N,S,L);B(j=>j.map(D=>D.id===c.id?{...D,cards:P}:D))}else{const N=[...c.cards],S=[...C.cards],L=N.findIndex(I=>I.id===d),j=h===C.id?S.length:S.findIndex(I=>I.id===h),[D]=N.splice(L,1);S.splice(j,0,D),B(I=>I.map(k=>k.id===c.id?{...k,cards:N}:k.id===C.id?{...k,cards:S}:k)),l&&l(d,c.id,C.id,j)}a&&a.endDrag(C.id)},X=p.useCallback(t=>{for(const o of f){const n=o.cards.find(d=>d.id===t);if(n)return n}return null},[f]),K=p.useCallback(t=>f.find(o=>o.cards.some(n=>n.id===t))||null,[f]),Y=p.useCallback(t=>f.find(o=>o.id===t)||null,[f]);return e.jsxs(ce,{sensors:G,collisionDetection:ue,onDragStart:Z,onDragEnd:W,children:[e.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[f.length," columns"]}),e.jsx("span",{children:"← Swipe to navigate →"})]}),R?e.jsxs("div",{className:E("flex flex-col gap-1 p-2 sm:p-4 min-w-0 overflow-hidden",u),role:"region","aria-label":"Kanban board with swimlanes",children:[e.jsx("div",{className:"flex gap-3 sm:gap-4 pl-36 sm:pl-44 overflow-x-auto",children:f.map(t=>e.jsxs("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 text-center",children:[e.jsx("span",{className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase",children:t.title}),e.jsxs("span",{className:"ml-2 font-mono text-xs text-muted-foreground",children:["(",t.cards.length,")"]})]},t.id))}),R.map(t=>{const o=M.has(t),n=f.reduce((d,h)=>d+h.cards.filter(c=>(c[r]!=null?String(c[r]):T)===t).length,0);return e.jsxs("div",{className:"border rounded-lg bg-muted/10",children:[e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>q(t),"aria-expanded":!o,children:[e.jsx("span",{className:E("transition-transform text-xs",o?"":"rotate-90"),children:"▶"}),e.jsx("span",{className:"font-mono text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:t}),e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["(",n,")"]})]}),!o&&e.jsx("div",{className:"flex gap-3 sm:gap-4 overflow-x-auto px-2 pb-3 pl-36 sm:pl-44",children:f.map(d=>{const h=d.cards.filter(c=>(c[r]!=null?String(c[r]):T)===t);return e.jsx("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 min-h-[60px] rounded-md bg-card/20 p-2",children:e.jsx(_,{items:h.map(c=>c.id),strategy:H,children:e.jsx("div",{className:"space-y-2",role:"list","aria-label":`${d.title} - ${t} cards`,children:h.map(c=>e.jsx(O,{card:c,onCardClick:i,conditionalFormatting:g},c.id))})})},d.id)})})]},t)})]}):e.jsx("div",{className:E("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 bg-muted/10 rounded-lg [-webkit-overflow-scrolling:touch] min-w-0",u),role:"region","aria-label":"Kanban board",children:f.map(t=>e.jsx(ve,{column:t,cards:t.cards,onCardClick:i,quickAdd:m,onQuickAdd:x,conditionalFormatting:g},t.id))}),e.jsx(me,{children:e.jsx("div",{"aria-live":"assertive","aria-label":v?`Dragging ${v.title}`:void 0,children:v?e.jsx(O,{card:v,conditionalFormatting:g}):null})})]})}export{Ne as default};