@khaos-systems/helm 0.2.2 → 0.3.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/README.md +11 -4
- package/dist/MtIconSelect-CfmehFw5.js +7859 -0
- package/dist/MtIconSelect-D3hqMI_b.cjs +46 -0
- package/dist/components/matter/MtButton.d.ts +2 -2
- package/dist/components/matter/MtDropdown.d.ts +1 -1
- package/dist/components/matter/MtFilter.d.ts +6 -0
- package/dist/components/matter/MtIcon.d.ts +3 -0
- package/dist/components/matter/MtIconSelect.d.ts +19 -0
- package/dist/components/matter/MtInput.d.ts +1 -1
- package/dist/components/matter/MtSearch.d.ts +1 -1
- package/dist/components/matter/MtSelect.d.ts +1 -1
- package/dist/components/matter/MtToast.d.ts +31 -0
- package/dist/components/matter/experimental/collection/MtCollection.d.ts +41 -1
- package/dist/components/matter/experimental/collection/MtCollectionContext.d.ts +26 -3
- package/dist/components/matter/experimental/collection/MtCollectionEntryControls.d.ts +21 -5
- package/dist/components/matter/experimental/collection/MtCollectionEntryUtils.d.ts +24 -0
- package/dist/components/matter/experimental/collection/MtCollectionSelectionToolbar.d.ts +8 -0
- package/dist/components/matter/experimental/collection/MtCollectionTaskListEntry.d.ts +32 -1
- package/dist/components/matter/experimental/collection/MtCollectionToast.d.ts +10 -0
- package/dist/components/matter/experimental/collection/index.d.ts +2 -1
- package/dist/components/matter/experimental/collection/layouts/MtCollectionBoardLayout.d.ts +33 -0
- package/dist/components/matter/experimental/collection/layouts/MtCollectionPlanLayout.d.ts +2 -0
- package/dist/components/matter/experimental/collection/layouts/useBoardDnd.d.ts +40 -0
- package/dist/experimental.cjs +6 -2
- package/dist/experimental.js +6464 -1720
- package/dist/lib.d.ts +4 -1
- package/dist/matter.cjs +2 -2
- package/dist/matter.js +262 -275
- package/dist/styles.css +1 -1
- package/package.json +6 -1
package/dist/experimental.cjs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MtAvatar-DvtEpPF_.cjs"),f=require("react"),_e=require("react-dom");function Oe(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return i.default=t,Object.freeze(i)}const W=Oe(f);const Le=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Te=e.createLucideIcon("arrow-left",Le);const Be=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],se=e.createLucideIcon("bookmark",Be);const Pe=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],ne=e.createLucideIcon("bug",Pe);const qe=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],$e=e.createLucideIcon("calendar-days",qe);const Ge=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],We=e.createLucideIcon("circle-check-big",Ge);const He=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ee=e.createLucideIcon("circle",He);const Ue=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],H=e.createLucideIcon("columns-3",Ue);const Xe=[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Ke=e.createLucideIcon("diamond-plus",Xe);const Qe=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ie=e.createLucideIcon("file-text",Qe);const Ye=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],U=e.createLucideIcon("layers",Ye);const Je=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Ze=e.createLucideIcon("layout-grid",Je);const et=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],re=e.createLucideIcon("list-todo",et);const tt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],st=e.createLucideIcon("list",tt);const nt=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],it=e.createLucideIcon("paperclip",nt);const rt=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ot=e.createLucideIcon("settings",rt);const lt=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],at=e.createLucideIcon("share-2",lt);const ut=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],oe=e.createLucideIcon("sparkles",ut);const ct=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]],dt=e.createLucideIcon("square-kanban",ct);const xt=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],mt=e.createLucideIcon("star",xt);const ht=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],pt=e.createLucideIcon("table-2",ht);const ft=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],gt=e.createLucideIcon("users",ft),ge=f.createContext(null);function q(){const t=f.useContext(ge);if(!t)throw new Error("useMtCollection must be used inside MtCollection");return t}function jt(t){const i=String(t??"").toLowerCase();return i.includes("list")?"list":i.includes("table")?"table":i.includes("grid")?"grid":i.includes("board")||i.includes("kanban")?"board":i.includes("gantt")||i.includes("timeline")?"calendar":"circle"}function yt(t,i,s=16){const n={size:s},r=t??jt(i);return{circle:e.jsxRuntimeExports.jsx(ee,{...n}),list:e.jsxRuntimeExports.jsx(st,{...n}),table:e.jsxRuntimeExports.jsx(pt,{...n}),grid:e.jsxRuntimeExports.jsx(Ze,{...n}),board:e.jsxRuntimeExports.jsx(dt,{...n}),columns:e.jsxRuntimeExports.jsx(H,{...n}),calendar:e.jsxRuntimeExports.jsx($e,{...n}),star:e.jsxRuntimeExports.jsx(mt,{...n})}[r]??e.jsxRuntimeExports.jsx(ee,{...n})}function ce({iconId:t,layoutName:i,size:s=16}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:yt(t,i,s)})}function je(){const{views:t,currentView:i,setCurrentView:s,entries:n,addView:r,deleteView:o,openViewSettings:a,hasCurrentViewUnsavedChanges:l,saveCurrentViewAsDefault:c,revertCurrentViewToDefault:m}=q(),[h,j]=f.useState(!1),[d,y]=f.useState(!1),[w,E]=f.useState(t[0]?.layout?.name??""),k=f.useRef(null),v=f.useRef(t.length+1),M=f.useMemo(()=>{const p=new Set,x=[];return t.forEach(S=>{const I=S.layout?.name??"Layout";p.has(I)||(p.add(I),x.push({id:I,name:I,templateView:S}))}),x},[t]),u=i?.layout.ToolbarActions,b=q(),R=()=>{b.setShowViewSettings(!b.showViewSettings)},C=(i?.settings??{}).quickFilters??{},D=p=>{if(!p||typeof p!="object")return"";const x=p.status;return typeof x=="string"||typeof x=="number"?String(x):""},L=p=>{if(!p||typeof p!="object")return"";const x=p.assignee;if(typeof x=="string"||typeof x=="number")return String(x);if(x&&typeof x=="object"&&"name"in x){const S=x.name;if(typeof S=="string")return S}return""},A=p=>{i&&s({...i,settings:{...i.settings??{},quickFilters:{...C,...p}}})},_=Array.from(new Set(n.map(p=>D(p)).filter(Boolean))).sort(),B=Array.from(new Set(n.map(p=>L(p)).filter(Boolean))).sort(),V=(C.status?.length??0)>0,G=(C.assignee?.length??0)>0;f.useEffect(()=>{(!w||!M.some(p=>p.id===w))&&E(M[0]?.id??"")},[w,M]);const Y=p=>{const S=M.find(Z=>Z.id===p)?.templateView??i??t[0];if(!S)return;const I=S.layout?.name??"View",z=t.filter(Z=>Z.name.startsWith(I)).length,Fe=z>0?`${I} ${z+1}`:I;r({id:`view-${v.current++}`,name:Fe,icon:S.icon,layout:S.layout,groupBy:null,settings:{},renderEntry:S.renderEntry}),y(!1)};f.useEffect(()=>{h&&k.current?.focus()},[h]);const J=p=>{const x=t.find(z=>z.id===p);if(!x)return;const S=t.filter(z=>z.name.startsWith(x.name)).length,I=S>0?`${x.name} ${S+1}`:`${x.name} copy`;r({...x,id:`view-${v.current++}`,name:I})};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b border-[#2A2A2A] h-11 px-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5",children:[t.length>1&&t.map(p=>e.jsxRuntimeExports.jsx(e.WithContextMenu,{getContextMenuItems:()=>[{label:"Rename",onSelect:()=>{s(p),a("root",{focusViewNameEditor:!0})}},{label:"Edit view",onSelect:()=>{s(p),a("root")}},{label:"",separator:!0},{label:"Delete view",disabled:t.length<=1,onSelect:()=>{o(p.id)}},{label:"Duplicate view",onSelect:()=>J(p.id)},{label:"Copy link to view",disabled:!0}],children:({openMenu:x})=>e.jsxRuntimeExports.jsxs(e.MtButton,{variant:"ghost",selected:p.id===i?.id,className:"h-auto min-h-0 items-center gap-2 border border-transparent px-2 py-1 text-sm text-text-muted hover:text-text-primary data-[selected]:border-[#8D8D8D] data-[selected]:text-text-primary",onClick:S=>{if(p.id===i?.id){x(S);return}s(p)},onContextMenu:S=>{s(p),x(S)},children:[e.jsxRuntimeExports.jsx(ce,{iconId:p.icon,layoutName:p.layout?.name}),e.jsxRuntimeExports.jsx("span",{children:p.name})]})},p.id)),e.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),e.jsxRuntimeExports.jsx(e.MtPopover,{open:d,onOpenChange:y,content:e.jsxRuntimeExports.jsxs("div",{className:"w-80 flex flex-col gap-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm text-text-primary",children:"Add view"}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2",children:M.map(p=>e.jsxRuntimeExports.jsx(e.MtButton,{variant:"ghost",selected:w===p.id,onClick:()=>{E(p.id),Y(p.id)},className:"h-auto min-h-0 w-full justify-start rounded border border-[#2A2A2A] px-2 py-2 text-left transition-colors data-[selected]:border-[#8D8D8D] data-[selected]:bg-surface-popover hover:bg-surface-popover",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxRuntimeExports.jsx("div",{className:"w-9 h-9 rounded border border-[#2A2A2A] bg-[#1A1A1A] flex items-center justify-center text-xs text-text-primary",children:p.templateView.icon?e.jsxRuntimeExports.jsx(ce,{iconId:p.templateView.icon,layoutName:p.templateView.layout?.name}):e.jsxRuntimeExports.jsx(ee,{size:16})}),e.jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm text-text-primary truncate",children:p.name}),e.jsxRuntimeExports.jsx("div",{className:"text-xs text-text-muted truncate",children:"Create from layout"})]})]})},p.id))})]}),children:e.jsxRuntimeExports.jsx(e.MtPopover.Trigger,{children:e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",children:e.jsxRuntimeExports.jsx(Ke,{size:16,stroke:"#8D8D8D"})})})})]}),e.jsxRuntimeExports.jsx("div",{className:"flex-1"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5",children:[l?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtButton,{variant:"accent",onClick:c,children:"Save view"}),e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:m,children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})})]}),e.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"})]}):null,u?e.jsxRuntimeExports.jsx(u,{}):null,e.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(We,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:V?"accent":"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsxs("div",{className:"w-44 p-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>A({status:[]}),children:"All statuses"}),_.map(p=>e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>{const x=C.status??[],S=x.includes(p)?x.filter(I=>I!==p):[...x,p];A({status:S})},children:p},p))]})}),V?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>A({status:[]}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(gt,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:G?"accent":"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsxs("div",{className:"w-44 p-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>A({assignee:[]}),children:"All assignees"}),B.map(p=>e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>{const x=C.assignee??[],S=x.includes(p)?x.filter(I=>I!==p):[...x,p];A({assignee:S})},children:p},p))]})}),G?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>A({assignee:[]}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>j(p=>!p),children:e.jsxRuntimeExports.jsx(e.Search,{size:16,stroke:"#8D8D8D"})}),h?e.jsxRuntimeExports.jsx("input",{ref:k,value:C.search??"",onChange:p=>A({search:p.target.value}),onKeyDown:p=>{p.key==="Escape"&&j(!1)},placeholder:"Search entries...",className:"w-56 rounded border border-[#2A2A2A] bg-transparent px-2 py-1 text-sm outline-none transition-all"}):null]}),e.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:R,children:e.jsxRuntimeExports.jsx(ot,{size:16,stroke:"#8D8D8D"})}),e.jsxRuntimeExports.jsx(e.MtButton,{onClick:()=>{},variant:"accent",children:"+ Add"})]})]})}function Et({value:t,cases:i}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i[t]??null})}const ye=f.createContext(null);function Ee(t){if(!f.isValidElement(t))return!1;const i=t.props;return typeof i.id=="string"&&typeof i.title=="string"}function O({children:t}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t})}function vt(t){const i={};return f.Children.forEach(t,s=>{if(!Ee(s))return;const n=s.props;i[n.id]=s}),i}function ve({children:t,initialPageId:i="root",onClose:s}){const n=f.useMemo(()=>vt(t),[t]),[r,o]=f.useState([i]);f.useEffect(()=>{o([i])},[i]);const a=r[r.length-1]??i,l=n[a],c=l?.props?.title??"View Settings",m=f.useCallback(d=>{n[d]&&o(y=>[...y,d])},[n]),h=f.useCallback(()=>{o(d=>d.length>1?d.slice(0,-1):d)},[]),j=r.length>1;return e.jsxRuntimeExports.jsx(ye.Provider,{value:{openPage:m,goBack:h},children:e.jsxRuntimeExports.jsxs(e.MtStack,{children:[e.jsxRuntimeExports.jsxs(e.MtStack,{row:!0,justify:"between",className:`p-2 pr-3 gap-2 border-b text-text-primary border-[#2A2A2A] ${j?"":"pl-3"}`,children:[e.jsxRuntimeExports.jsxs(e.MtStack,{row:!0,className:"text-text-primary",gap:2,children:[j?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:h,children:e.jsxRuntimeExports.jsx(Te,{size:16,stroke:"#8D8D8D"})}):null,e.jsxRuntimeExports.jsx("span",{className:"text-sm text-text-primary",children:c})]}),e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:s,children:e.jsxRuntimeExports.jsx(e.X,{size:16,stroke:"#8D8D8D"})})]}),e.jsxRuntimeExports.jsx(Et,{value:a,cases:{[a]:l}})]})})}function F({title:t,children:i}){return e.jsxRuntimeExports.jsxs(e.MtStack,{gap:1,className:"py-2 border-b border-border-default",children:[t&&e.jsxRuntimeExports.jsx("small",{className:"px-2",children:t}),i]})}function N({icon:t,label:i,trailing:s,onClick:n,disabled:r,active:o,submenu:a}){const l=f.useContext(ye);return e.jsxRuntimeExports.jsxs(e.MtButton,{variant:"ghost",className:"flex row items-center justify-between w-full",onClick:()=>{n?.(),a&&l?.openPage(a)},disabled:r,selected:o,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center gap-3",children:[t,i]}),s?e.jsxRuntimeExports.jsx("div",{className:"flex flex-row items-center gap-3 text-text-muted",children:s}):null]})}function be(){const t=q(),i=t?.properties??[],s=t?.currentView??null,n=f.useRef(null),r=i.map(d=>d.id),o=s?.settings?.visiblePropertyIds??r,a=s?.layout.SettingsMenu;f.useEffect(()=>{t?.focusViewNameEditor&&(n.current?.focus(),n.current?.select())},[t?.focusViewNameEditor]);const l=d=>{!t||!s||t.setCurrentView({...s,settings:{...s.settings??{},...d}})},c=s&&t&&a?a({currentView:s,properties:i,viewSettings:{...s.settings??{},visiblePropertyIds:o},setViewSettings:d=>l(d),setCurrentView:t.setCurrentView}):null,m=[],h=[],j=d=>{f.Children.forEach(d,y=>{if(Ee(y)){h.push(y);return}if(f.isValidElement(y)){if(y.type===f.Fragment){j(y.props.children);return}m.push(y)}})};return c&&j(c),e.jsxRuntimeExports.jsxs(ve,{initialPageId:t?.viewSettingsPageId??"root",onClose:()=>{t?.setShowViewSettings(!1),t?.setViewSettingsPageId("root"),t?.setFocusViewNameEditor(!1)},children:[e.jsxRuntimeExports.jsxs(O,{id:"root",title:"View Settings",children:[e.jsxRuntimeExports.jsx(F,{title:"View",children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtInput,{ref:n,value:s?.name??"",onChange:d=>{!t||!s||t.setCurrentView({...s,name:d.target.value})},placeholder:"View name",className:"w-full px-2!",variant:"ghost"})})}),m,e.jsxRuntimeExports.jsxs(F,{children:[e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(it,{size:14}),label:"Copy link to view",disabled:!0}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(at,{size:14}),label:"Shareing & Permissions",disabled:!0})]})]}),h]})}ve.Page=O;function P(t){return{name:t.name,icon:t.icon,groupBy:t.groupBy??null,settings:t.settings}}function bt(t,i){return!t||!i?!1:t.name===i.name&&t.icon===i.icon&&(t.groupBy??null)===(i.groupBy??null)&&JSON.stringify(t.settings??{})===JSON.stringify(i.settings??{})}function Rt({entries:t,views:i,properties:s=[{id:"id",label:"ID"}],toolbar:n,renderEntry:r,showViewSettings:o=!1,viewSettings:a=e.jsxRuntimeExports.jsx(be,{}),className:l}){const[c,m]=f.useState(i),[h,j]=f.useState(s),[d,y]=f.useState(o),[w,E]=f.useState("root"),[k,v]=f.useState(!1),[M,u]=f.useState(i[0]?.id??null),[b,R]=f.useState(Object.fromEntries(i.map(x=>[x.id,P(x)])));f.useEffect(()=>{m(i),R(Object.fromEntries(i.map(x=>[x.id,P(x)]))),u(x=>i.some(S=>S.id===x)?x:i[0]?.id??null)},[i]),f.useEffect(()=>{j(s)},[s]);const g=c.find(x=>x.id===M)??null,C=x=>{if(!x){u(null);return}m(S=>S.map(I=>I.id===x.id?{...I,...x}:I)),u(x.id)},D=x=>{m(S=>[...S,x]),R(S=>({...S,[x.id]:P(x)})),u(x.id)},L=(x,S)=>{m(I=>I.map(z=>z.id===x?{...z,...S}:z))},A=x=>{m(S=>{const I=S.filter(z=>z.id!==x);return I.length===0?(u(null),S):(M===x&&u(I[0]?.id??null),I)}),R(S=>{const I={...S};return delete I[x],I})},_=(()=>{if(!g)return!1;const x=P(g),S=b[g.id];return S?!bt(x,S):!1})(),B=()=>{g&&R(x=>({...x,[g.id]:P(g)}))},V=()=>{if(!g)return;const x=b[g.id];x&&L(g.id,{name:x.name,icon:x.icon,groupBy:x.groupBy,settings:x.settings})},G=(x="root",S)=>{E(x),v(!!S?.focusViewNameEditor),y(!0)},Y=()=>s.map(x=>x.id),J={visiblePropertyIds:g?.settings?.visiblePropertyIds??Y(),...g?.settings??{}},p=!!(d&&g&&a);return e.jsxRuntimeExports.jsx(ge.Provider,{value:{entries:t,views:c,currentView:g,setCurrentView:C,addView:D,updateView:L,deleteView:A,hasCurrentViewUnsavedChanges:_,saveCurrentViewAsDefault:B,revertCurrentViewToDefault:V,showViewSettings:d,setShowViewSettings:y,viewSettingsPageId:w,setViewSettingsPageId:E,focusViewNameEditor:k,setFocusViewNameEditor:v,openViewSettings:G,properties:h,setProperties:j},children:e.jsxRuntimeExports.jsxs("div",{className:`h-full min-h-0 flex flex-col border border-[#2A2A2A] bg-[#111111] rounded ${l}`,children:[n===void 0&&e.jsxRuntimeExports.jsx(je,{}),n!=null&&f.isValidElement(n)&&f.cloneElement(n),e.jsxRuntimeExports.jsxs("div",{className:"flex-1 min-h-0 flex flex-row overflow-hidden",children:[e.jsxRuntimeExports.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:g?e.jsxRuntimeExports.jsx(g.layout,{entries:t,groupBy:g.groupBy,properties:h,viewSettings:J,renderEntry:g.renderEntry??r}):e.jsxRuntimeExports.jsx("div",{children:"No view selected"})}),e.jsxRuntimeExports.jsx("div",{className:`shrink-0 overflow-hidden transition-[width,opacity,transform] duration-200 ease-out ${p?"border-l border-[#2A2A2A] opacity-100 translate-x-0":"border-l-0 opacity-0 translate-x-1"}`,style:{width:p?"18.75rem":"0rem"},children:p?a:null})]})]})})}function T(t,i,s){let n=s.initialDeps??[],r,o=!0;function a(){var l,c,m;let h;s.key&&((l=s.debug)!=null&&l.call(s))&&(h=Date.now());const j=t();if(!(j.length!==n.length||j.some((w,E)=>n[E]!==w)))return r;n=j;let y;if(s.key&&((c=s.debug)!=null&&c.call(s))&&(y=Date.now()),r=i(...j),s.key&&((m=s.debug)!=null&&m.call(s))){const w=Math.round((Date.now()-h)*100)/100,E=Math.round((Date.now()-y)*100)/100,k=E/16,v=(M,u)=>{for(M=String(M);M.length<u;)M=" "+M;return M};console.info(`%c⏱ ${v(E,5)} /${v(w,5)} ms`,`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./MtIconSelect-D3hqMI_b.cjs"),c=require("react"),We=require("react-dom");function Gs(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const vt=Gs(c);const Ys=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Qs=s.createLucideIcon("arrow-left",Ys);const Js=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],Kn=s.createLucideIcon("calendar-days",Js);const Zs=[["path",{d:"M22 2 2 22",key:"y4kqgn"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],er=s.createLucideIcon("circle-slash-2",Zs);const tr=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Ct=s.createLucideIcon("columns-3",tr);const nr=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],sr=s.createLucideIcon("copy",nr);const rr=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],ir=s.createLucideIcon("corner-left-up",rr);const or=[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]],ar=s.createLucideIcon("diamond-plus",or);const lr=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],cr=s.createLucideIcon("grip-vertical",lr);const ur=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],dr=s.createLucideIcon("layout-grid",ur);const fr=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],xr=s.createLucideIcon("paperclip",fr);const hr=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Xn=s.createLucideIcon("pencil",hr);const pr=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],mr=s.createLucideIcon("share-2",pr);const gr=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]],vr=s.createLucideIcon("square-kanban",gr);const yr=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],br=s.createLucideIcon("table-2",yr);const jr=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Hn=s.createLucideIcon("text-align-start",jr);const Er=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Rr=s.createLucideIcon("user-round",Er),Gn=c.createContext(null);function Ne(){const e=c.useContext(Gn);if(!e)throw new Error("useMtCollection must be used inside MtCollection");return e}function wr(e){const t=String(e??"").toLowerCase();return t.includes("list")?"list":t.includes("table")?"table":t.includes("grid")?"grid":t.includes("board")||t.includes("kanban")?"board":t.includes("gantt")||t.includes("timeline")?"calendar":"circle"}function Sr(e,t,n=16){const r={size:n},i=e??wr(t);return{circle:s.jsxRuntimeExports.jsx(s.Circle,{...r}),list:s.jsxRuntimeExports.jsx(s.List,{...r}),table:s.jsxRuntimeExports.jsx(br,{...r}),grid:s.jsxRuntimeExports.jsx(dr,{...r}),board:s.jsxRuntimeExports.jsx(vr,{...r}),columns:s.jsxRuntimeExports.jsx(Ct,{...r}),calendar:s.jsxRuntimeExports.jsx(Kn,{...r}),star:s.jsxRuntimeExports.jsx(s.Star,{...r})}[i]??s.jsxRuntimeExports.jsx(s.Circle,{...r})}function Yn({iconId:e,layoutName:t,size:n=16}){return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:Sr(e,t,n)})}function Cr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const Mt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Xe(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Yt(e){return"nodeType"in e}function ge(e){var t,n;return e?Xe(e)?e:Yt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Qt(e){const{Document:t}=ge(e);return e instanceof t}function lt(e){return Xe(e)?!1:e instanceof ge(e).HTMLElement}function Qn(e){return e instanceof ge(e).SVGElement}function He(e){return e?Xe(e)?e.document:Yt(e)?Qt(e)?e:lt(e)||Qn(e)?e.ownerDocument:document:document:document}const Ce=Mt?c.useLayoutEffect:c.useEffect;function Dt(e){const t=c.useRef(e);return Ce(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function Mr(){const e=c.useRef(null),t=c.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ot(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Ce(()=>{n.current!==e&&(n.current=e)},t),n}function ct(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function yt(e){const t=Dt(e),n=c.useRef(null),r=c.useCallback(i=>{i!==n.current&&t?.(i,n.current),n.current=i},[]);return[n,r]}function bt(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let Bt={};function ut(e,t){return c.useMemo(()=>{if(t)return t;const n=Bt[e]==null?0:Bt[e]+1;return Bt[e]=n,e+"-"+n},[e,t])}function Jn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((o,l)=>{const a=Object.entries(l);for(const[u,f]of a){const d=o[u];d!=null&&(o[u]=d+e*f)}return o},{...t})}}const qe=Jn(1),jt=Jn(-1);function Dr(e){return"clientX"in e&&"clientY"in e}function kt(e){if(!e)return!1;const{KeyboardEvent:t}=ge(e.target);return t&&e instanceof t}function kr(e){if(!e)return!1;const{TouchEvent:t}=ge(e.target);return t&&e instanceof t}function Et(e){if(kr(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 Dr(e)?{x:e.clientX,y:e.clientY}:null}const Oe=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[Oe.Translate.toString(e),Oe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),yn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ir(e){return e.matches(yn)?e:e.querySelector(yn)}const Nr={display:"none"};function Ar(e){let{id:t,value:n}=e;return c.createElement("div",{id:t,style:Nr},n)}function Or(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={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:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Tr(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Zn=c.createContext(null);function Fr(e){const t=c.useContext(Zn);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Lr(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:i,event:o}=r;e.forEach(l=>{var a;return(a=l[i])==null?void 0:a.call(l,o)})},[e]),t]}const zr={draggable:`
|
|
2
|
+
To pick up a draggable item, press the space bar.
|
|
3
|
+
While dragging, use the arrow keys to move the item.
|
|
4
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
+
`},Vr={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 Pr(e){let{announcements:t=Vr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=zr}=e;const{announce:o,announcement:l}=Tr(),a=ut("DndLiveRegion"),[u,f]=c.useState(!1);if(c.useEffect(()=>{f(!0)},[]),Fr(c.useMemo(()=>({onDragStart(x){let{active:h}=x;o(t.onDragStart({active:h}))},onDragMove(x){let{active:h,over:p}=x;t.onDragMove&&o(t.onDragMove({active:h,over:p}))},onDragOver(x){let{active:h,over:p}=x;o(t.onDragOver({active:h,over:p}))},onDragEnd(x){let{active:h,over:p}=x;o(t.onDragEnd({active:h,over:p}))},onDragCancel(x){let{active:h,over:p}=x;o(t.onDragCancel({active:h,over:p}))}}),[o,t])),!u)return null;const d=c.createElement(c.Fragment,null,c.createElement(Ar,{id:r,value:i.draggable}),c.createElement(Or,{id:a,announcement:l}));return n?We.createPortal(d,n):d}var de;(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"})(de||(de={}));function Rt(){}function Jt(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Zt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Me=Object.freeze({x:0,y:0});function es(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Br(e,t){const n=Et(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 ts(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function _r(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function bn(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function $r(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function jn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ns=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=jn(t,t.left,t.top),o=[];for(const l of r){const{id:a}=l,u=n.get(a);if(u){const f=es(jn(u),i);o.push({id:a,data:{droppableContainer:l,value:f}})}}return o.sort(ts)},ss=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=bn(t),o=[];for(const l of r){const{id:a}=l,u=n.get(a);if(u){const f=bn(u),d=i.reduce((h,p,v)=>h+es(f[v],p),0),x=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:l,value:x}})}}return o.sort(ts)};function Ur(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=i-r,a=o-n;if(r<i&&n<o){const u=t.width*t.height,f=e.width*e.height,d=l*a,x=d/(u+f-d);return Number(x.toFixed(4))}return 0}const Wr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:l}=o,a=n.get(l);if(a){const u=Ur(a,t);u>0&&i.push({id:l,data:{droppableContainer:o,value:u}})}}return i.sort(_r)};function qr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function rs(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Me}function Kr(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((l,a)=>({...l,top:l.top+e*a.y,bottom:l.bottom+e*a.y,left:l.left+e*a.x,right:l.right+e*a.x}),{...n})}}const Xr=Kr(1);function is(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 Hr(e,t,n){const r=is(t);if(!r)return e;const{scaleX:i,scaleY:o,x:l,y:a}=r,u=e.left-l-(1-i)*parseFloat(n),f=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,x=o?e.height/o:e.height;return{width:d,height:x,top:f,right:u+d,bottom:f+x,left:u}}const Gr={ignoreTransform:!1};function Ge(e,t){t===void 0&&(t=Gr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:d}=ge(e).getComputedStyle(e);f&&(n=Hr(n,f,d))}const{top:r,left:i,width:o,height:l,bottom:a,right:u}=n;return{top:r,left:i,width:o,height:l,bottom:a,right:u}}function En(e){return Ge(e,{ignoreTransform:!0})}function Yr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Qr(e,t){return t===void 0&&(t=ge(e).getComputedStyle(e)),t.position==="fixed"}function Jr(e,t){t===void 0&&(t=ge(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function en(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Qt(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!lt(i)||Qn(i)||n.includes(i))return n;const o=ge(e).getComputedStyle(i);return i!==e&&Jr(i,o)&&n.push(i),Qr(i,o)?n:r(i.parentNode)}return e?r(e):n}function os(e){const[t]=en(e,1);return t??null}function _t(e){return!Mt||!e?null:Xe(e)?e:Yt(e)?Qt(e)||e===He(e).scrollingElement?window:lt(e)?e:null:null}function as(e){return Xe(e)?e.scrollX:e.scrollLeft}function ls(e){return Xe(e)?e.scrollY:e.scrollTop}function qt(e){return{x:as(e),y:ls(e)}}var fe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(fe||(fe={}));function cs(e){return!Mt||!e?!1:e===document.scrollingElement}function us(e){const t={x:0,y:0},n=cs(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:l,isRight:a,maxScroll:r,minScroll:t}}const Zr={x:.2,y:.2};function ei(e,t,n,r,i){let{top:o,left:l,right:a,bottom:u}=n;r===void 0&&(r=10),i===void 0&&(i=Zr);const{isTop:f,isBottom:d,isLeft:x,isRight:h}=us(e),p={x:0,y:0},v={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!f&&o<=t.top+g.height?(p.y=fe.Backward,v.y=r*Math.abs((t.top+g.height-o)/g.height)):!d&&u>=t.bottom-g.height&&(p.y=fe.Forward,v.y=r*Math.abs((t.bottom-g.height-u)/g.height)),!h&&a>=t.right-g.width?(p.x=fe.Forward,v.x=r*Math.abs((t.right-g.width-a)/g.width)):!x&&l<=t.left+g.width&&(p.x=fe.Backward,v.x=r*Math.abs((t.left+g.width-l)/g.width)),{direction:p,speed:v}}function ti(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:l}=window;return{top:0,left:0,right:o,bottom:l,width:o,height:l}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function ds(e){return e.reduce((t,n)=>qe(t,qt(n)),Me)}function ni(e){return e.reduce((t,n)=>t+as(n),0)}function si(e){return e.reduce((t,n)=>t+ls(n),0)}function fs(e,t){if(t===void 0&&(t=Ge),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);os(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ri=[["x",["left","right"],ni],["y",["top","bottom"],si]];class tn{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=en(n),i=ds(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,l,a]of ri)for(const u of l)Object.defineProperty(this,u,{get:()=>{const f=a(r),d=i[o]-f;return this.rect[u]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class st{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 i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ii(e){const{EventTarget:t}=ge(e);return e instanceof t?e:He(e)}function $t(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 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 Rn(e){e.preventDefault()}function oi(e){e.stopPropagation()}var se;(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"})(se||(se={}));const xs={start:[se.Space,se.Enter],cancel:[se.Esc],end:[se.Space,se.Enter,se.Tab]},ai=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case se.Right:return{...n,x:n.x+25};case se.Left:return{...n,x:n.x-25};case se.Down:return{...n,y:n.y+25};case se.Up:return{...n,y:n.y-25}}};class hs{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 st(He(n)),this.windowListeners=new st(ge(n)),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:t,onStart:n}=this.props,r=t.node.current;r&&fs(r),n(Me)}handleKeyDown(t){if(kt(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=xs,coordinateGetter:l=ai,scrollBehavior:a="smooth"}=i,{code:u}=t;if(o.end.includes(u)){this.handleEnd(t);return}if(o.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:f}=r.current,d=f?{x:f.left,y:f.top}:Me;this.referenceCoordinates||(this.referenceCoordinates=d);const x=l(t,{active:n,context:r.current,currentCoordinates:d});if(x){const h=jt(x,d),p={x:0,y:0},{scrollableAncestors:v}=r.current;for(const g of v){const j=t.code,{isTop:m,isRight:R,isLeft:z,isBottom:k,maxScroll:P,minScroll:L}=us(g),D=ti(g),E={x:Math.min(j===se.Right?D.right-D.width/2:D.right,Math.max(j===se.Right?D.left:D.left+D.width/2,x.x)),y:Math.min(j===se.Down?D.bottom-D.height/2:D.bottom,Math.max(j===se.Down?D.top:D.top+D.height/2,x.y))},I=j===se.Right&&!R||j===se.Left&&!z,V=j===se.Down&&!k||j===se.Up&&!m;if(I&&E.x!==x.x){const A=g.scrollLeft+h.x,$=j===se.Right&&A<=P.x||j===se.Left&&A>=L.x;if($&&!h.y){g.scrollTo({left:A,behavior:a});return}$?p.x=g.scrollLeft-A:p.x=j===se.Right?g.scrollLeft-P.x:g.scrollLeft-L.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(V&&E.y!==x.y){const A=g.scrollTop+h.y,$=j===se.Down&&A<=P.y||j===se.Up&&A>=L.y;if($&&!h.x){g.scrollTo({top:A,behavior:a});return}$?p.y=g.scrollTop-A:p.y=j===se.Down?g.scrollTop-P.y:g.scrollTop-L.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,qe(jt(x,this.referenceCoordinates),p))}}}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()}}hs.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=xs,onActivation:i}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function wn(e){return!!(e&&"distance"in e)}function Sn(e){return!!(e&&"delay"in e)}class nn{constructor(t,n,r){var i;r===void 0&&(r=ii(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:o}=t,{target:l}=o;this.props=t,this.events=n,this.document=He(l),this.documentListeners=new st(this.document),this.listeners=new st(r),this.windowListeners=new st(ge(l)),this.initialCoordinates=(i=Et(o))!=null?i:Me,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(Re.Resize,this.handleCancel),this.windowListeners.add(Re.DragStart,Rn),this.windowListeners.add(Re.VisibilityChange,this.handleCancel),this.windowListeners.add(Re.ContextMenu,Rn),this.documentListeners.add(Re.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Sn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(wn(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:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Re.Click,oi,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Re.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:l,options:{activationConstraint:a}}=o;if(!i)return;const u=(n=Et(t))!=null?n:Me,f=jt(i,u);if(!r&&a){if(wn(a)){if(a.tolerance!=null&&$t(f,a.tolerance))return this.handleCancel();if($t(f,a.distance))return this.handleStart()}if(Sn(a)&&$t(f,a.tolerance))return this.handleCancel();this.handlePending(a,f);return}t.cancelable&&t.preventDefault(),l(u)}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===se.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const li={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dt extends nn{constructor(t){const{event:n}=t,r=He(n.target);super(t,li,r)}}dt.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 ci={move:{name:"mousemove"},end:{name:"mouseup"}};var Kt;(function(e){e[e.RightClick=2]="RightClick"})(Kt||(Kt={}));class ui extends nn{constructor(t){super(t,ci,He(t.event.target))}}ui.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Kt.RightClick?!1:(r?.({event:n}),!0)}}];const Ut={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class di extends nn{constructor(t){super(t,Ut)}static setup(){return window.addEventListener(Ut.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ut.move.name,t)};function t(){}}}di.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var rt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(rt||(rt={}));var wt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(wt||(wt={}));function fi(e){let{acceleration:t,activator:n=rt.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:l=5,order:a=wt.TreeOrder,pointerCoordinates:u,scrollableAncestors:f,scrollableAncestorRects:d,delta:x,threshold:h}=e;const p=hi({delta:x,disabled:!o}),[v,g]=Mr(),j=c.useRef({x:0,y:0}),m=c.useRef({x:0,y:0}),R=c.useMemo(()=>{switch(n){case rt.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case rt.DraggableRect:return i}},[n,i,u]),z=c.useRef(null),k=c.useCallback(()=>{const L=z.current;if(!L)return;const D=j.current.x*m.current.x,E=j.current.y*m.current.y;L.scrollBy(D,E)},[]),P=c.useMemo(()=>a===wt.TreeOrder?[...f].reverse():f,[a,f]);c.useEffect(()=>{if(!o||!f.length||!R){g();return}for(const L of P){if(r?.(L)===!1)continue;const D=f.indexOf(L),E=d[D];if(!E)continue;const{direction:I,speed:V}=ei(L,E,R,t,h);for(const A of["x","y"])p[A][I[A]]||(V[A]=0,I[A]=0);if(V.x>0||V.y>0){g(),z.current=L,v(k,l),j.current=V,m.current=I;return}}j.current={x:0,y:0},m.current={x:0,y:0},g()},[t,k,r,g,o,l,JSON.stringify(R),JSON.stringify(p),v,f,P,d,JSON.stringify(h)])}const xi={x:{[fe.Backward]:!1,[fe.Forward]:!1},y:{[fe.Backward]:!1,[fe.Forward]:!1}};function hi(e){let{delta:t,disabled:n}=e;const r=bt(t);return ct(i=>{if(n||!r||!i)return xi;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[fe.Backward]:i.x[fe.Backward]||o.x===-1,[fe.Forward]:i.x[fe.Forward]||o.x===1},y:{[fe.Backward]:i.y[fe.Backward]||o.y===-1,[fe.Forward]:i.y[fe.Forward]||o.y===1}}},[n,t,r])}function pi(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return ct(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function mi(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...o]},[]),[e,t])}var Ke;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ke||(Ke={}));var Xt;(function(e){e.Optimized="optimized"})(Xt||(Xt={}));const Cn=new Map;function gi(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,l]=c.useState(null),{frequency:a,measure:u,strategy:f}=i,d=c.useRef(e),x=j(),h=ot(x),p=c.useCallback(function(m){m===void 0&&(m=[]),!h.current&&l(R=>R===null?m:R.concat(m.filter(z=>!R.includes(z))))},[h]),v=c.useRef(null),g=ct(m=>{if(x&&!n)return Cn;if(!m||m===Cn||d.current!==e||o!=null){const R=new Map;for(let z of e){if(!z)continue;if(o&&o.length>0&&!o.includes(z.id)&&z.rect.current){R.set(z.id,z.rect.current);continue}const k=z.node.current,P=k?new tn(u(k),k):null;z.rect.current=P,P&&R.set(z.id,P)}return R}return m},[e,o,n,x,u]);return c.useEffect(()=>{d.current=e},[e]),c.useEffect(()=>{x||p()},[n,x]),c.useEffect(()=>{o&&o.length>0&&l(null)},[JSON.stringify(o)]),c.useEffect(()=>{x||typeof a!="number"||v.current!==null||(v.current=setTimeout(()=>{p(),v.current=null},a))},[a,x,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:o!=null};function j(){switch(f){case Ke.Always:return!1;case Ke.BeforeDragging:return n;default:return!n}}}function sn(e,t){return ct(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function vi(e,t){return sn(e,t)}function yi(e){let{callback:t,disabled:n}=e;const r=Dt(t),i=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return c.useEffect(()=>()=>i?.disconnect(),[i]),i}function It(e){let{callback:t,disabled:n}=e;const r=Dt(t),i=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return c.useEffect(()=>()=>i?.disconnect(),[i]),i}function bi(e){return new tn(Ge(e),e)}function Mn(e,t,n){t===void 0&&(t=bi);const[r,i]=c.useState(null);function o(){i(u=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=u??n)!=null?f:null}const d=t(e);return JSON.stringify(u)===JSON.stringify(d)?u:d})}const l=yi({callback(u){if(e)for(const f of u){const{type:d,target:x}=f;if(d==="childList"&&x instanceof HTMLElement&&x.contains(e)){o();break}}}}),a=It({callback:o});return Ce(()=>{o(),e?(a?.observe(e),l?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),l?.disconnect())},[e]),r}function ji(e){const t=sn(e);return rs(e,t)}const Dn=[];function Ei(e){const t=c.useRef(e),n=ct(r=>e?r&&r!==Dn&&e&&t.current&&e.parentNode===t.current.parentNode?r:en(e):Dn,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function Ri(e){const[t,n]=c.useState(null),r=c.useRef(e),i=c.useCallback(o=>{const l=_t(o.target);l&&n(a=>a?(a.set(l,qt(l)),new Map(a)):null)},[]);return c.useEffect(()=>{const o=r.current;if(e!==o){l(o);const a=e.map(u=>{const f=_t(u);return f?(f.addEventListener("scroll",i,{passive:!0}),[f,qt(f)]):null}).filter(u=>u!=null);n(a.length?new Map(a):null),r.current=e}return()=>{l(e),l(o)};function l(a){a.forEach(u=>{const f=_t(u);f?.removeEventListener("scroll",i)})}},[i,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,l)=>qe(o,l),Me):ds(e):Me,[e,t])}function kn(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==Me;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?jt(e,n.current):Me}function wi(e){c.useEffect(()=>{if(!Mt)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 Si(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=l=>{o(l,t)},n},{}),[e,t])}function ps(e){return c.useMemo(()=>e?Yr(e):null,[e])}const In=[];function Ci(e,t){t===void 0&&(t=Ge);const[n]=e,r=ps(n?ge(n):null),[i,o]=c.useState(In);function l(){o(()=>e.length?e.map(u=>cs(u)?r:new tn(t(u),u)):In)}const a=It({callback:l});return Ce(()=>{a?.disconnect(),l(),e.forEach(u=>a?.observe(u))},[e]),i}function ms(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return lt(t)?t:e}function Mi(e){let{measure:t}=e;const[n,r]=c.useState(null),i=c.useCallback(f=>{for(const{target:d}of f)if(lt(d)){r(x=>{const h=t(d);return x?{...x,width:h.width,height:h.height}:h});break}},[t]),o=It({callback:i}),l=c.useCallback(f=>{const d=ms(f);o?.disconnect(),d&&o?.observe(d),r(d?t(d):null)},[t,o]),[a,u]=yt(l);return c.useMemo(()=>({nodeRef:a,rect:n,setRef:u}),[n,a,u])}const Di=[{sensor:dt,options:{}},{sensor:hs,options:{}}],ki={current:{}},gt={draggable:{measure:En},droppable:{measure:En,strategy:Ke.WhileDragging,frequency:Xt.Optimized},dragOverlay:{measure:Ge}};class it 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 Ii={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new it,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Rt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gt,measureDroppableContainers:Rt,windowRect:null,measuringScheduled:!1},gs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Rt,draggableNodes:new Map,over:null,measureDroppableContainers:Rt},ft=c.createContext(gs),vs=c.createContext(Ii);function Ni(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new it}}}function Ai(e,t){switch(t.type){case de.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case de.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 de.DragEnd:case de.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case de.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new it(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case de.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new it(e.droppable.containers);return l.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:l}}}case de.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new it(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Oi(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=c.useContext(ft),o=bt(r),l=bt(n?.id);return c.useEffect(()=>{if(!t&&!r&&o&&l!=null){if(!kt(o)||document.activeElement===o.target)return;const a=i.get(l);if(!a)return;const{activatorNode:u,node:f}=a;if(!u.current&&!f.current)return;requestAnimationFrame(()=>{for(const d of[u.current,f.current]){if(!d)continue;const x=Ir(d);if(x){x.focus();break}}})}},[r,t,i,l,o]),null}function ys(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function Ti(e){return c.useMemo(()=>({draggable:{...gt.draggable,...e?.draggable},droppable:{...gt.droppable,...e?.droppable},dragOverlay:{...gt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fi(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=c.useRef(!1),{x:l,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Ce(()=>{if(!l&&!a||!t){o.current=!1;return}if(o.current||!r)return;const f=t?.node.current;if(!f||f.isConnected===!1)return;const d=n(f),x=rs(d,r);if(l||(x.x=0),a||(x.y=0),o.current=!0,Math.abs(x.x)>0||Math.abs(x.y)>0){const h=os(f);h&&h.scrollBy({top:x.y,left:x.x})}},[t,l,a,r,n])}const Nt=c.createContext({...Me,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 At=c.memo(function(t){var n,r,i,o;let{id:l,accessibility:a,autoScroll:u=!0,children:f,sensors:d=Di,collisionDetection:x=Wr,measuring:h,modifiers:p,...v}=t;const g=c.useReducer(Ai,void 0,Ni),[j,m]=g,[R,z]=Lr(),[k,P]=c.useState(Pe.Uninitialized),L=k===Pe.Initialized,{draggable:{active:D,nodes:E,translate:I},droppable:{containers:V}}=j,A=D!=null?E.get(D):null,$=c.useRef({initial:null,translated:null}),W=c.useMemo(()=>{var pe;return D!=null?{id:D,data:(pe=A?.data)!=null?pe:ki,rect:$}:null},[D,A]),Y=c.useRef(null),[K,X]=c.useState(null),[q,H]=c.useState(null),w=ot(v,Object.values(v)),B=ut("DndDescribedBy",l),N=c.useMemo(()=>V.getEnabled(),[V]),S=Ti(h),{droppableRects:F,measureDroppableContainers:T,measuringScheduled:te}=gi(N,{dragging:L,dependencies:[I.x,I.y],config:S.droppable}),C=pi(E,D),U=c.useMemo(()=>q?Et(q):null,[q]),Q=Hs(),y=vi(C,S.draggable.measure);Fi({activeNode:D!=null?E.get(D):null,config:Q.layoutShiftCompensation,initialRect:y,measure:S.draggable.measure});const b=Mn(C,S.draggable.measure,y),J=Mn(C?C.parentElement:null),ee=c.useRef({activatorEvent:null,active:null,activeNode:C,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Z=V.getNodeFor((n=ee.current.over)==null?void 0:n.id),ne=Mi({measure:S.dragOverlay.measure}),ce=(r=ne.nodeRef.current)!=null?r:C,oe=L?(i=ne.rect)!=null?i:b:null,re=!!(ne.nodeRef.current&&ne.rect),Se=ji(re?null:b),ae=ps(ce?ge(ce):null),M=Ei(L?Z??C:null),_=Ci(M),G=ys(p,{transform:{x:I.x-Se.x,y:I.y-Se.y,scaleX:1,scaleY:1},activatorEvent:q,active:W,activeNodeRect:b,containerNodeRect:J,draggingNodeRect:oe,over:ee.current.over,overlayNodeRect:ne.rect,scrollableAncestors:M,scrollableAncestorRects:_,windowRect:ae}),le=U?qe(U,I):null,Be=Ri(M),xt=kn(Be),zt=kn(Be,[b]),Fe=qe(G,xt),O=oe?Xr(oe,G):null,ie=W&&O?x({active:W,collisionRect:O,droppableRects:F,droppableContainers:N,pointerCoordinates:le}):null,je=$r(ie,"id"),[xe,De]=c.useState(null),_e=re?G:qe(G,zt),Ws=qr(_e,(o=xe?.rect)!=null?o:null,b),Vt=c.useRef(null),gn=c.useCallback((pe,ve)=>{let{sensor:ye,options:Le}=ve;if(Y.current==null)return;const Ee=E.get(Y.current);if(!Ee)return;const be=pe.nativeEvent,ke=new ye({active:Y.current,activeNode:Ee,event:be,options:Le,context:ee,onAbort(he){if(!E.get(he))return;const{onDragAbort:Ie}=w.current,Ae={id:he};Ie?.(Ae),R({type:"onDragAbort",event:Ae})},onPending(he,ze,Ie,Ae){if(!E.get(he))return;const{onDragPending:et}=w.current,Ve={id:he,constraint:ze,initialCoordinates:Ie,offset:Ae};et?.(Ve),R({type:"onDragPending",event:Ve})},onStart(he){const ze=Y.current;if(ze==null)return;const Ie=E.get(ze);if(!Ie)return;const{onDragStart:Ae}=w.current,Ze={activatorEvent:be,active:{id:ze,data:Ie.data,rect:$}};We.unstable_batchedUpdates(()=>{Ae?.(Ze),P(Pe.Initializing),m({type:de.DragStart,initialCoordinates:he,active:ze}),R({type:"onDragStart",event:Ze}),X(Vt.current),H(be)})},onMove(he){m({type:de.DragMove,coordinates:he})},onEnd:$e(de.DragEnd),onCancel:$e(de.DragCancel)});Vt.current=ke;function $e(he){return async function(){const{active:Ie,collisions:Ae,over:Ze,scrollAdjustedTranslate:et}=ee.current;let Ve=null;if(Ie&&et){const{cancelDrop:tt}=w.current;Ve={activatorEvent:be,active:Ie,collisions:Ae,delta:et,over:Ze},he===de.DragEnd&&typeof tt=="function"&&await Promise.resolve(tt(Ve))&&(he=de.DragCancel)}Y.current=null,We.unstable_batchedUpdates(()=>{m({type:he}),P(Pe.Uninitialized),De(null),X(null),H(null),Vt.current=null;const tt=he===de.DragEnd?"onDragEnd":"onDragCancel";if(Ve){const Pt=w.current[tt];Pt?.(Ve),R({type:tt,event:Ve})}})}}},[E]),qs=c.useCallback((pe,ve)=>(ye,Le)=>{const Ee=ye.nativeEvent,be=E.get(Le);if(Y.current!==null||!be||Ee.dndKit||Ee.defaultPrevented)return;const ke={active:be};pe(ye,ve.options,ke)===!0&&(Ee.dndKit={capturedBy:ve.sensor},Y.current=Le,gn(ye,ve))},[E,gn]),vn=mi(d,qs);wi(d),Ce(()=>{b&&k===Pe.Initializing&&P(Pe.Initialized)},[b,k]),c.useEffect(()=>{const{onDragMove:pe}=w.current,{active:ve,activatorEvent:ye,collisions:Le,over:Ee}=ee.current;if(!ve||!ye)return;const be={active:ve,activatorEvent:ye,collisions:Le,delta:{x:Fe.x,y:Fe.y},over:Ee};We.unstable_batchedUpdates(()=>{pe?.(be),R({type:"onDragMove",event:be})})},[Fe.x,Fe.y]),c.useEffect(()=>{const{active:pe,activatorEvent:ve,collisions:ye,droppableContainers:Le,scrollAdjustedTranslate:Ee}=ee.current;if(!pe||Y.current==null||!ve||!Ee)return;const{onDragOver:be}=w.current,ke=Le.get(je),$e=ke&&ke.rect.current?{id:ke.id,rect:ke.rect.current,data:ke.data,disabled:ke.disabled}:null,he={active:pe,activatorEvent:ve,collisions:ye,delta:{x:Ee.x,y:Ee.y},over:$e};We.unstable_batchedUpdates(()=>{De($e),be?.(he),R({type:"onDragOver",event:he})})},[je]),Ce(()=>{ee.current={activatorEvent:q,active:W,activeNode:C,collisionRect:O,collisions:ie,droppableRects:F,draggableNodes:E,draggingNode:ce,draggingNodeRect:oe,droppableContainers:V,over:xe,scrollableAncestors:M,scrollAdjustedTranslate:Fe},$.current={initial:oe,translated:O}},[W,C,ie,O,E,ce,oe,F,V,xe,M,Fe]),fi({...Q,delta:I,draggingRect:O,pointerCoordinates:le,scrollableAncestors:M,scrollableAncestorRects:_});const Ks=c.useMemo(()=>({active:W,activeNode:C,activeNodeRect:b,activatorEvent:q,collisions:ie,containerNodeRect:J,dragOverlay:ne,draggableNodes:E,droppableContainers:V,droppableRects:F,over:xe,measureDroppableContainers:T,scrollableAncestors:M,scrollableAncestorRects:_,measuringConfiguration:S,measuringScheduled:te,windowRect:ae}),[W,C,b,q,ie,J,ne,E,V,F,xe,T,M,_,S,te,ae]),Xs=c.useMemo(()=>({activatorEvent:q,activators:vn,active:W,activeNodeRect:b,ariaDescribedById:{draggable:B},dispatch:m,draggableNodes:E,over:xe,measureDroppableContainers:T}),[q,vn,W,b,m,B,E,xe,T]);return c.createElement(Zn.Provider,{value:z},c.createElement(ft.Provider,{value:Xs},c.createElement(vs.Provider,{value:Ks},c.createElement(Nt.Provider,{value:Ws},f)),c.createElement(Oi,{disabled:a?.restoreFocus===!1})),c.createElement(Pr,{...a,hiddenTextDescribedById:B}));function Hs(){const pe=K?.autoScrollEnabled===!1,ve=typeof u=="object"?u.enabled===!1:u===!1,ye=L&&!pe&&!ve;return typeof u=="object"?{...u,enabled:ye}:{enabled:ye}}}),Li=c.createContext(null),Nn="button",zi="Draggable";function bs(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=ut(zi),{activators:l,activatorEvent:a,active:u,activeNodeRect:f,ariaDescribedById:d,draggableNodes:x,over:h}=c.useContext(ft),{role:p=Nn,roleDescription:v="draggable",tabIndex:g=0}=i??{},j=u?.id===t,m=c.useContext(j?Nt:Li),[R,z]=yt(),[k,P]=yt(),L=Si(l,t),D=ot(n);Ce(()=>(x.set(t,{id:t,key:o,node:R,activatorNode:k,data:D}),()=>{const I=x.get(t);I&&I.key===o&&x.delete(t)}),[x,t]);const E=c.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":j&&p===Nn?!0:void 0,"aria-roledescription":v,"aria-describedby":d.draggable}),[r,p,g,j,v,d.draggable]);return{active:u,activatorEvent:a,activeNodeRect:f,attributes:E,isDragging:j,listeners:r?void 0:L,node:R,over:h,setNodeRef:z,setActivatorNodeRef:P,transform:m}}function js(){return c.useContext(vs)}const Vi="Droppable",Pi={timeout:25};function rn(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=ut(Vi),{active:l,dispatch:a,over:u,measureDroppableContainers:f}=c.useContext(ft),d=c.useRef({disabled:n}),x=c.useRef(!1),h=c.useRef(null),p=c.useRef(null),{disabled:v,updateMeasurementsFor:g,timeout:j}={...Pi,...i},m=ot(g??r),R=c.useCallback(()=>{if(!x.current){x.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{f(Array.isArray(m.current)?m.current:[m.current]),p.current=null},j)},[j]),z=It({callback:R,disabled:v||!l}),k=c.useCallback((E,I)=>{z&&(I&&(z.unobserve(I),x.current=!1),E&&z.observe(E))},[z]),[P,L]=yt(k),D=ot(t);return c.useEffect(()=>{!z||!P.current||(z.disconnect(),x.current=!1,z.observe(P.current))},[P,z]),c.useEffect(()=>(a({type:de.RegisterDroppable,element:{id:r,key:o,disabled:n,node:P,rect:h,data:D}}),()=>a({type:de.UnregisterDroppable,key:o,id:r})),[r]),c.useEffect(()=>{n!==d.current.disabled&&(a({type:de.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:l,rect:h,isOver:u?.id===r,node:P,over:u,setNodeRef:L}}function Bi(e){let{animation:t,children:n}=e;const[r,i]=c.useState(null),[o,l]=c.useState(null),a=bt(n);return!n&&!r&&a&&i(a),Ce(()=>{if(!o)return;const u=r?.key,f=r?.props.id;if(u==null||f==null){i(null);return}Promise.resolve(t(f,o)).then(()=>{i(null)})},[t,r,o]),c.createElement(c.Fragment,null,n,r?c.cloneElement(r,{ref:l}):null)}const _i={x:0,y:0,scaleX:1,scaleY:1};function $i(e){let{children:t}=e;return c.createElement(ft.Provider,{value:gs},c.createElement(Nt.Provider,{value:_i},t))}const Ui={position:"fixed",touchAction:"none"},Wi=e=>kt(e)?"transform 250ms ease":void 0,qi=c.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:l,rect:a,style:u,transform:f,transition:d=Wi}=e;if(!a)return null;const x=i?f:{...f,scaleX:1,scaleY:1},h={...Ui,width:a.width,height:a.height,top:a.top,left:a.left,transform:Oe.Transform.toString(x),transformOrigin:i&&r?Br(r,a):void 0,transition:typeof d=="function"?d(r):d,...u};return c.createElement(n,{className:l,style:h,ref:t},o)}),Ki=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:l}=e;if(o!=null&&o.active)for(const[a,u]of Object.entries(o.active))u!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,u));if(o!=null&&o.dragOverlay)for(const[a,u]of Object.entries(o.dragOverlay))u!==void 0&&r.node.style.setProperty(a,u);return l!=null&&l.active&&n.node.classList.add(l.active),l!=null&&l.dragOverlay&&r.node.classList.add(l.dragOverlay),function(){for(const[u,f]of Object.entries(i))n.node.style.setProperty(u,f);l!=null&&l.active&&n.node.classList.remove(l.active)}},Xi=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Oe.Transform.toString(t)},{transform:Oe.Transform.toString(n)}]},Hi={duration:250,easing:"ease",keyframes:Xi,sideEffects:Ki({styles:{active:{opacity:"0"}}})};function Gi(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Dt((o,l)=>{if(t===null)return;const a=n.get(o);if(!a)return;const u=a.node.current;if(!u)return;const f=ms(l);if(!f)return;const{transform:d}=ge(l).getComputedStyle(l),x=is(d);if(!x)return;const h=typeof t=="function"?t:Yi(t);return fs(u,i.draggable.measure),h({active:{id:o,data:a.data,node:u,rect:i.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:l,rect:i.dragOverlay.measure(f)},droppableContainers:r,measuringConfiguration:i,transform:x})})}function Yi(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...Hi,...e};return o=>{let{active:l,dragOverlay:a,transform:u,...f}=o;if(!t)return;const d={x:a.rect.left-l.rect.left,y:a.rect.top-l.rect.top},x={scaleX:u.scaleX!==1?l.rect.width*u.scaleX/a.rect.width:1,scaleY:u.scaleY!==1?l.rect.height*u.scaleY/a.rect.height:1},h={x:u.x-d.x,y:u.y-d.y,...x},p=i({...f,active:l,dragOverlay:a,transform:{initial:u,final:h}}),[v]=p,g=p[p.length-1];if(JSON.stringify(v)===JSON.stringify(g))return;const j=r?.({active:l,dragOverlay:a,...f}),m=a.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(R=>{m.onfinish=()=>{j?.(),R()}})}}let An=0;function Qi(e){return c.useMemo(()=>{if(e!=null)return An++,An},[e])}const on=c.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:l,wrapperElement:a="div",className:u,zIndex:f=999}=e;const{activatorEvent:d,active:x,activeNodeRect:h,containerNodeRect:p,draggableNodes:v,droppableContainers:g,dragOverlay:j,over:m,measuringConfiguration:R,scrollableAncestors:z,scrollableAncestorRects:k,windowRect:P}=js(),L=c.useContext(Nt),D=Qi(x?.id),E=ys(l,{activatorEvent:d,active:x,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:j.rect,over:m,overlayNodeRect:j.rect,scrollableAncestors:z,scrollableAncestorRects:k,transform:L,windowRect:P}),I=sn(h),V=Gi({config:r,draggableNodes:v,droppableContainers:g,measuringConfiguration:R}),A=I?j.setRef:void 0;return c.createElement($i,null,c.createElement(Bi,{animation:V},x&&D?c.createElement(qi,{key:D,id:x.id,ref:A,as:a,activatorEvent:d,adjustScale:t,className:u,transition:o,rect:I,style:{zIndex:f,...i},transform:E},n):null))});function Ot(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ji(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function ht(e){return e!==null&&e>=0}function Zi(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 eo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const pt={scaleX:1,scaleY:1},to=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:i,overIndex:o,index:l}=e;const a=(t=n[i])!=null?t:r;if(!a)return null;const u=no(n,l,i);if(l===i){const f=n[o];return f?{x:i<o?f.left+f.width-(a.left+a.width):f.left-a.left,y:0,...pt}:null}return l>i&&l<=o?{x:-a.width-u,y:0,...pt}:l<i&&l>=o?{x:a.width+u,y:0,...pt}:{x:0,y:0,...pt}};function no(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return!r||!i&&!o?0:n<t?i?r.left-(i.left+i.width):o.left-(r.left+r.width):o?o.left-(r.left+r.width):r.left-(i.left+i.width)}const Es=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=Ot(t,r,n),l=t[i],a=o[i];return!a||!l?null:{x:a.left-l.left,y:a.top-l.top,scaleX:a.width/l.width,scaleY:a.height/l.height}},mt={scaleX:1,scaleY:1},so=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:l}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const f=o[l];return f?{x:0,y:n<l?f.top+f.height-(a.top+a.height):f.top-a.top,...mt}:null}const u=ro(o,i,n);return i>n&&i<=l?{x:0,y:-a.height-u,...mt}:i<n&&i>=l?{x:0,y:a.height+u,...mt}:{x:0,y:0,...mt}};function ro(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const Rs="Sortable",ws=c.createContext({activeIndex:-1,containerId:Rs,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Es,disabled:{draggable:!1,droppable:!1}});function Ss(e){let{children:t,id:n,items:r,strategy:i=Es,disabled:o=!1}=e;const{active:l,dragOverlay:a,droppableRects:u,over:f,measureDroppableContainers:d}=js(),x=ut(Rs,n),h=a.rect!==null,p=c.useMemo(()=>r.map(L=>typeof L=="object"&&"id"in L?L.id:L),[r]),v=l!=null,g=l?p.indexOf(l.id):-1,j=f?p.indexOf(f.id):-1,m=c.useRef(p),R=!Zi(p,m.current),z=j!==-1&&g===-1||R,k=eo(o);Ce(()=>{R&&v&&d(p)},[R,p,v,d]),c.useEffect(()=>{m.current=p},[p]);const P=c.useMemo(()=>({activeIndex:g,containerId:x,disabled:k,disableTransforms:z,items:p,overIndex:j,useDragOverlay:h,sortedRects:Ji(p,u),strategy:i}),[g,x,k.draggable,k.droppable,z,p,j,u,h,i]);return c.createElement(ws.Provider,{value:P},t)}const io=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Ot(n,r,i).indexOf(t)},oo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:l,previousItems:a,previousContainerId:u,transition:f}=e;return!f||!r||a!==o&&i===l?!1:n?!0:l!==i&&t===u},ao={duration:200,easing:"ease"},Cs="transform",lo=Oe.Transition.toString({property:Cs,duration:0,easing:"linear"}),co={roleDescription:"sortable"};function uo(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,l]=c.useState(null),a=c.useRef(n);return Ce(()=>{if(!t&&n!==a.current&&r.current){const u=i.current;if(u){const f=Ge(r.current,{ignoreTransform:!0}),d={x:u.left-f.left,y:u.top-f.top,scaleX:u.width/f.width,scaleY:u.height/f.height};(d.x||d.y)&&l(d)}}n!==a.current&&(a.current=n)},[t,n,r,i]),c.useEffect(()=>{o&&l(null)},[o]),o}function Ms(e){let{animateLayoutChanges:t=oo,attributes:n,disabled:r,data:i,getNewIndex:o=io,id:l,strategy:a,resizeObserverConfig:u,transition:f=ao}=e;const{items:d,containerId:x,activeIndex:h,disabled:p,disableTransforms:v,sortedRects:g,overIndex:j,useDragOverlay:m,strategy:R}=c.useContext(ws),z=fo(r,p),k=d.indexOf(l),P=c.useMemo(()=>({sortable:{containerId:x,index:k,items:d},...i}),[x,i,k,d]),L=c.useMemo(()=>d.slice(d.indexOf(l)),[d,l]),{rect:D,node:E,isOver:I,setNodeRef:V}=rn({id:l,data:P,disabled:z.droppable,resizeObserverConfig:{updateMeasurementsFor:L,...u}}),{active:A,activatorEvent:$,activeNodeRect:W,attributes:Y,setNodeRef:K,listeners:X,isDragging:q,over:H,setActivatorNodeRef:w,transform:B}=bs({id:l,data:P,attributes:{...co,...n},disabled:z.draggable}),N=Cr(V,K),S=!!A,F=S&&!v&&ht(h)&&ht(j),T=!m&&q,te=T&&F?B:null,U=F?te??(a??R)({rects:g,activeNodeRect:W,activeIndex:h,overIndex:j,index:k}):null,Q=ht(h)&&ht(j)?o({id:l,items:d,activeIndex:h,overIndex:j}):k,y=A?.id,b=c.useRef({activeId:y,items:d,newIndex:Q,containerId:x}),J=d!==b.current.items,ee=t({active:A,containerId:x,isDragging:q,isSorting:S,id:l,index:k,items:d,newIndex:b.current.newIndex,previousItems:b.current.items,previousContainerId:b.current.containerId,transition:f,wasDragging:b.current.activeId!=null}),Z=uo({disabled:!ee,index:k,node:E,rect:D});return c.useEffect(()=>{S&&b.current.newIndex!==Q&&(b.current.newIndex=Q),x!==b.current.containerId&&(b.current.containerId=x),d!==b.current.items&&(b.current.items=d)},[S,Q,x,d]),c.useEffect(()=>{if(y===b.current.activeId)return;if(y!=null&&b.current.activeId==null){b.current.activeId=y;return}const ce=setTimeout(()=>{b.current.activeId=y},50);return()=>clearTimeout(ce)},[y]),{active:A,activeIndex:h,attributes:Y,data:P,rect:D,index:k,newIndex:Q,items:d,isOver:I,isSorting:S,isDragging:q,listeners:X,node:E,overIndex:j,over:H,setNodeRef:N,setActivatorNodeRef:w,setDroppableNodeRef:V,setDraggableNodeRef:K,transform:Z??U,transition:ne()};function ne(){if(Z||J&&b.current.newIndex===k)return lo;if(!(T&&!kt($)||!f)&&(S||ee))return Oe.Transition.toString({...f,property:Cs})}}function fo(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}}se.Down,se.Right,se.Up,se.Left;function Ds(){const{views:e,viewTemplates:t,currentView:n,setCurrentView:r,entries:i,onAddEntry:o,addView:l,deleteView:a,reorderViews:u,openViewSettings:f,hasCurrentViewUnsavedChanges:d,saveCurrentViewAsDefault:x,revertCurrentViewToDefault:h,quickFilters:p,setQuickFilters:v,transientQuickFilters:g,setTransientQuickFilters:j,currentUserQuickFilter:m}=Ne(),[R,z]=c.useState(!1),[k,P]=c.useState(!1),[L,D]=c.useState(t[0]?.id??e[0]?.id??""),E=c.useRef(null),I=c.useRef(e.length+1),V=c.useMemo(()=>{const C=new Set,U=[];return(t.length>0?t:e).forEach(Q=>{const y=Q.layout;C.has(y)||(C.add(y),U.push({id:Q.id,name:Q.name||Q.layout?.name||"Layout",templateView:Q}))}),U},[t,e]),A=n?.layout.ToolbarActions,$=Ne(),W=()=>{$.setShowViewSettings(!$.showViewSettings)},Y=C=>{if(!C||typeof C!="object")return"";const U=C.status;return typeof U=="string"||typeof U=="number"?String(U):""},K=C=>{if(!C||typeof C!="object")return"";const U=C.assignee;if(typeof U=="string"||typeof U=="number")return String(U);if(U&&typeof U=="object"&&"name"in U){const Q=U.name;if(typeof Q=="string")return Q}return""},X=Array.from(new Set(i.map(C=>Y(C)).filter(Boolean))).sort(),q=Array.from(new Set(i.map(C=>K(C)).filter(Boolean))).sort(),H=(p.status?.length??0)>0,w=(p.assignee?.length??0)>0,B=!!(m&&g.requiredAssignee===m.assignee);c.useEffect(()=>{(!L||!V.some(C=>C.id===L))&&D(V[0]?.id??"")},[L,V]);const N=C=>{const U=V.find(ee=>ee.id===C),Q=U?.templateView??n??e[0];if(!Q)return;const y=U?.name??Q.name??Q.layout?.name??"View",b=e.filter(ee=>ee.name.startsWith(y)).length,J=b>0?`${y} ${b+1}`:y;l({id:`view-${I.current++}`,name:J,icon:Q.icon,layout:Q.layout,groupBy:null,settings:{},renderEntry:Q.renderEntry}),P(!1)};c.useEffect(()=>{R&&E.current?.focus()},[R]);const S=C=>{const U=e.find(b=>b.id===C);if(!U)return;const Q=e.filter(b=>b.name.startsWith(U.name)).length,y=Q>0?`${U.name} ${Q+1}`:`${U.name} copy`;l({...U,id:`view-${I.current++}`,name:y})},F=c.useMemo(()=>e.map(C=>C.id),[e]),T=Zt(Jt(dt,{activationConstraint:{distance:5}})),te=C=>{const{active:U,over:Q}=C;if(!Q||U.id===Q.id)return;const y=F.indexOf(String(U.id)),b=F.indexOf(String(Q.id));if(y===-1||b===-1)return;const J=Ot(F,y,b);u(J)};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b border-[#2A2A2A] h-11 px-4",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxRuntimeExports.jsx(At,{sensors:T,collisionDetection:ns,onDragEnd:te,children:s.jsxRuntimeExports.jsx(Ss,{items:F,strategy:to,children:e.length>0&&e.map(C=>s.jsxRuntimeExports.jsx(xo,{view:C,isActive:C.id===n?.id,onSelect:()=>r(C),onOpenMenu:()=>{r(C)},onRename:()=>{r(C),f("root",{focusViewNameEditor:!0})},onEdit:()=>{r(C),f("root")},onDelete:e.length>1?()=>a(C.id):void 0,onDuplicate:()=>S(C.id)},C.id))})}),e.length===0?s.jsxRuntimeExports.jsx("span",{className:"text-sm text-text-muted",children:"No views"}):null,s.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),s.jsxRuntimeExports.jsx(s.MtPopover,{open:k,onOpenChange:P,content:s.jsxRuntimeExports.jsxs("div",{className:"w-80 flex flex-col gap-2",children:[s.jsxRuntimeExports.jsx("div",{className:"text-sm text-text-primary",children:"Add view"}),s.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2",children:V.map(C=>s.jsxRuntimeExports.jsx(s.MtButton,{variant:"ghost",selected:L===C.id,onClick:()=>{D(C.id),N(C.id)},className:"h-auto min-h-0 w-full justify-start rounded border border-[#2A2A2A] px-2 py-2 text-left transition-colors data-[selected]:border-[#8D8D8D] data-[selected]:bg-surface-popover hover:bg-surface-popover",children:s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxRuntimeExports.jsx("div",{className:"w-9 h-9 rounded border border-[#2A2A2A] bg-[#1A1A1A] flex items-center justify-center text-xs text-text-primary",children:C.templateView.icon?s.jsxRuntimeExports.jsx(Yn,{iconId:C.templateView.icon,layoutName:C.templateView.layout?.name}):s.jsxRuntimeExports.jsx(s.Circle,{size:16})}),s.jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[s.jsxRuntimeExports.jsx("div",{className:"text-sm text-text-primary truncate",children:C.name}),s.jsxRuntimeExports.jsx("div",{className:"text-xs text-text-muted truncate",children:"Create from layout"})]})]})},C.id))})]}),children:s.jsxRuntimeExports.jsx(s.MtPopover.Trigger,{children:s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",children:s.jsxRuntimeExports.jsx(ar,{size:16,stroke:"#8D8D8D"})})})})]}),s.jsxRuntimeExports.jsx("div",{className:"flex-1"}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5",children:[d?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtButton,{variant:"accent",onClick:x,children:"Save view"}),s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:h,children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})})]}),s.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"})]}):null,A?s.jsxRuntimeExports.jsx(A,{}):null,s.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),m?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:B?"accent":"ghost",title:`Filter to ${m.label}`,onClick:()=>j({requiredAssignee:B?void 0:m.assignee}),children:s.jsxRuntimeExports.jsx(s.MtAvatar,{size:"xs",src:m.avatarSrc,name:m.label,className:"pointer-events-none"})}):null,s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtDropdown,{title:s.jsxRuntimeExports.jsx(s.CircleCheckBig,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:H?"accent":"ghost",showCaret:!1,children:s.jsxRuntimeExports.jsxs("div",{className:"w-44 p-1",children:[s.jsxRuntimeExports.jsx(s.MtDropdownItem,{onSelect:()=>v({status:[]}),children:"All statuses"}),X.map(C=>s.jsxRuntimeExports.jsx(s.MtDropdownItem,{onSelect:()=>{const U=p.status??[],Q=U.includes(C)?U.filter(y=>y!==C):[...U,C];v({status:Q})},children:C},C))]})}),H?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>v({status:[]}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtDropdown,{title:s.jsxRuntimeExports.jsx(s.Users,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:w?"accent":"ghost",showCaret:!1,children:s.jsxRuntimeExports.jsxs("div",{className:"w-44 p-1",children:[s.jsxRuntimeExports.jsx(s.MtDropdownItem,{onSelect:()=>v({assignee:[]}),children:"All assignees"}),q.map(C=>s.jsxRuntimeExports.jsx(s.MtDropdownItem,{onSelect:()=>{const U=p.assignee??[],Q=U.includes(C)?U.filter(y=>y!==C):[...U,C];v({assignee:Q})},children:C},C))]})}),w?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>v({assignee:[]}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>z(C=>!C),children:s.jsxRuntimeExports.jsx(s.Search,{size:16,stroke:"#8D8D8D"})}),R?s.jsxRuntimeExports.jsx("input",{ref:E,value:p.search??"",onChange:C=>v({search:C.target.value}),onKeyDown:C=>{C.key==="Escape"&&z(!1)},placeholder:"Search entries...",className:"w-56 rounded border border-[#2A2A2A] bg-transparent px-2 py-1 text-sm outline-none transition-all"}):null]}),s.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:W,children:s.jsxRuntimeExports.jsx(s.Settings,{size:16,stroke:"#8D8D8D"})}),s.jsxRuntimeExports.jsx(s.MtButton,{onClick:()=>{o?.()},variant:"accent",children:"+ Add"})]})]})}function xo({view:e,isActive:t,onSelect:n,onOpenMenu:r,onRename:i,onEdit:o,onDelete:l,onDuplicate:a}){const{attributes:u,listeners:f,setNodeRef:d,transform:x,transition:h,isDragging:p}=Ms({id:e.id}),v={transform:Oe.Transform.toString(x),transition:h,opacity:p?.5:void 0},g=e.layout&&typeof e.layout=="object"&&"name"in e.layout?e.layout.name:void 0;return s.jsxRuntimeExports.jsx(s.WithContextMenu,{getContextMenuItems:()=>[{label:"Rename",onSelect:i},{label:"Edit view",onSelect:o},{label:"",separator:!0},{label:"Delete view",disabled:!l,onSelect:()=>l?.()},{label:"Duplicate view",onSelect:a},{label:"Copy link to view",disabled:!0}],children:({openMenu:j})=>s.jsxRuntimeExports.jsxs(s.MtButton,{ref:d,style:v,...u,...f,variant:"ghost",selected:t,className:"h-auto min-h-0 items-center gap-2 border border-transparent px-2 py-1 text-sm text-text-muted hover:text-text-primary data-[selected]:border-[#8D8D8D] data-[selected]:text-text-primary",onClick:m=>{if(t){j(m);return}n()},onContextMenu:m=>{r(m),j(m)},children:[s.jsxRuntimeExports.jsx(Yn,{iconId:e.icon,layoutName:g}),s.jsxRuntimeExports.jsx("span",{children:e.name})]})})}function ho({value:e,cases:t}){return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:t[e]??null})}const ks=c.createContext(null);function Is(e){if(!c.isValidElement(e))return!1;const t=e.props;return typeof t.id=="string"&&typeof t.title=="string"}function we({children:e}){return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:e})}function po(e){const t={};return c.Children.forEach(e,n=>{if(!Is(n))return;const r=n.props;t[r.id]=n}),t}function Ns({children:e,initialPageId:t="root",onClose:n}){const r=c.useMemo(()=>po(e),[e]),[i,o]=c.useState([t]);c.useEffect(()=>{o([t])},[t]);const l=i[i.length-1]??t,a=r[l],u=a?.props?.title??"View Settings",f=c.useCallback(h=>{r[h]&&o(p=>[...p,h])},[r]),d=c.useCallback(()=>{o(h=>h.length>1?h.slice(0,-1):h)},[]),x=i.length>1;return s.jsxRuntimeExports.jsx(ks.Provider,{value:{openPage:f,goBack:d},children:s.jsxRuntimeExports.jsxs(s.MtStack,{children:[s.jsxRuntimeExports.jsxs(s.MtStack,{row:!0,justify:"between",className:`p-2 pr-3 gap-2 border-b text-text-primary border-[#2A2A2A] ${x?"":"pl-3"}`,children:[s.jsxRuntimeExports.jsxs(s.MtStack,{row:!0,className:"text-text-primary",gap:2,children:[x?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:d,children:s.jsxRuntimeExports.jsx(Qs,{size:16,stroke:"#8D8D8D"})}):null,s.jsxRuntimeExports.jsx("span",{className:"text-sm text-text-primary",children:u})]}),s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:n,children:s.jsxRuntimeExports.jsx(s.X,{size:16,stroke:"#8D8D8D"})})]}),s.jsxRuntimeExports.jsx(ho,{value:l,cases:{[l]:a}})]})})}function me({title:e,children:t}){return s.jsxRuntimeExports.jsxs(s.MtStack,{gap:1,className:"py-2 border-b border-border-default",children:[e&&s.jsxRuntimeExports.jsx("small",{className:"px-2",children:e}),t]})}function ue({icon:e,label:t,trailing:n,onClick:r,disabled:i,active:o,submenu:l}){const a=c.useContext(ks);return s.jsxRuntimeExports.jsxs(s.MtButton,{variant:"ghost",className:"flex row items-center justify-between w-full",onClick:()=>{r?.(),l&&a?.openPage(l)},disabled:i,selected:o,children:[s.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center gap-3",children:[e,t]}),n?s.jsxRuntimeExports.jsx("div",{className:"flex flex-row items-center gap-3 text-text-muted",children:n}):null]})}function As(){const e=Ne(),t=e?.properties??[],n=e?.currentView??null,r=c.useRef(null),i=t.map(h=>h.id),o=n?.settings?.visiblePropertyIds??i,l=n?.layout.SettingsMenu;c.useEffect(()=>{e?.focusViewNameEditor&&(r.current?.focus(),r.current?.select())},[e?.focusViewNameEditor]);const a=h=>{!e||!n||e.setCurrentView({...n,settings:{...n.settings??{},...h}})},u=n&&e&&l?l({currentView:n,properties:t,viewSettings:{...n.settings??{},visiblePropertyIds:o},setViewSettings:h=>a(h),setCurrentView:e.setCurrentView}):null,f=[],d=[],x=h=>{c.Children.forEach(h,p=>{if(Is(p)){d.push(p);return}if(c.isValidElement(p)){if(p.type===c.Fragment){x(p.props.children);return}f.push(p)}})};return u&&x(u),s.jsxRuntimeExports.jsxs(Ns,{initialPageId:e?.viewSettingsPageId??"root",onClose:()=>{e?.setShowViewSettings(!1),e?.setViewSettingsPageId("root"),e?.setFocusViewNameEditor(!1)},children:[s.jsxRuntimeExports.jsxs(we,{id:"root",title:"View Settings",children:[s.jsxRuntimeExports.jsx(me,{title:"View",children:s.jsxRuntimeExports.jsx("div",{className:"px-2",children:s.jsxRuntimeExports.jsx(s.MtInput,{ref:r,value:n?.name??"",onChange:h=>{!e||!n||e.setCurrentView({...n,name:h.target.value})},placeholder:"View name",className:"w-full px-2!",variant:"ghost"})})}),f,s.jsxRuntimeExports.jsxs(me,{children:[s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(xr,{size:14}),label:"Copy link to view",disabled:!0}),s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(mr,{size:14}),label:"Shareing & Permissions",disabled:!0})]})]}),d]})}Ns.Page=we;function mo(){const{selectedIds:e,clearSelection:t,onDeleteEntries:n}=Ne();if(e.size===0)return null;const r=async()=>{await n?.(new Set(e)),t()};return s.jsxRuntimeExports.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-1 px-3 py-2 rounded-lg border border-[#3a3a3a] bg-[#1c1c1c] shadow-xl text-sm select-none",children:[s.jsxRuntimeExports.jsxs("span",{className:"text-text-muted pr-2 tabular-nums whitespace-nowrap",children:[e.size," selected"]}),s.jsxRuntimeExports.jsx("div",{className:"w-px h-4 bg-[#3a3a3a] mx-1"}),s.jsxRuntimeExports.jsxs("button",{type:"button",disabled:!0,title:"Set status (coming soon)",className:"flex items-center gap-1.5 px-2 py-1 rounded text-text-muted opacity-40 cursor-not-allowed transition-colors",children:[s.jsxRuntimeExports.jsx("span",{className:"inline-block w-3 h-3 rounded-full border border-current"}),s.jsxRuntimeExports.jsx("span",{children:"Status"})]}),s.jsxRuntimeExports.jsxs("button",{type:"button",disabled:!0,title:"Set assignee (coming soon)",className:"flex items-center gap-1.5 px-2 py-1 rounded text-text-muted opacity-40 cursor-not-allowed transition-colors",children:[s.jsxRuntimeExports.jsx(Rr,{size:13}),s.jsxRuntimeExports.jsx("span",{children:"Assignee"})]}),s.jsxRuntimeExports.jsxs("button",{type:"button",disabled:!0,title:"Set dates (coming soon)",className:"flex items-center gap-1.5 px-2 py-1 rounded text-text-muted opacity-40 cursor-not-allowed transition-colors",children:[s.jsxRuntimeExports.jsx(Kn,{size:13}),s.jsxRuntimeExports.jsx("span",{children:"Dates"})]}),s.jsxRuntimeExports.jsxs("button",{type:"button",disabled:!0,title:"Set tags (coming soon)",className:"flex items-center gap-1.5 px-2 py-1 rounded text-text-muted opacity-40 cursor-not-allowed transition-colors",children:[s.jsxRuntimeExports.jsx(s.Tag,{size:13}),s.jsxRuntimeExports.jsx("span",{children:"Tags"})]}),s.jsxRuntimeExports.jsx("div",{className:"w-px h-4 bg-[#3a3a3a] mx-1"}),s.jsxRuntimeExports.jsx("button",{type:"button",onClick:r,title:"Delete selected",className:"flex items-center justify-center w-7 h-7 rounded text-red-500 hover:bg-red-500/10 transition-colors",children:s.jsxRuntimeExports.jsx(s.Trash2,{size:14})}),s.jsxRuntimeExports.jsx("button",{type:"button",onClick:t,title:"Clear selection",className:"flex items-center justify-center w-7 h-7 rounded text-text-muted hover:text-text-primary hover:bg-white/5 transition-colors ml-0.5",children:"✕"})]})}function nt(e){return{name:e.name,icon:e.icon,groupBy:e.groupBy??null,settings:e.settings}}function go(e,t){return!e||!t?!1:e.name===t.name&&e.icon===t.icon&&(e.groupBy??null)===(t.groupBy??null)&&JSON.stringify(e.settings??{})===JSON.stringify(t.settings??{})}function vo({entries:e,views:t,viewTemplates:n,properties:r=[{id:"id",label:"ID"}],toolbar:i,renderEntry:o,showViewSettings:l=!1,viewSettings:a=s.jsxRuntimeExports.jsx(As,{}),className:u,assigneeOptions:f,currentUserQuickFilter:d,onUpdateEntry:x,onAddEntry:h,subtasksEnabled:p,onAddSubtask:v,onSaveView:g,onDeleteView:j,onDeleteEntries:m,onReorderViews:R,onEntryClick:z}){const[k,P]=c.useState(t),[L,D]=c.useState(r),[E,I]=c.useState(l),[V,A]=c.useState("root"),[$,W]=c.useState(!1),[Y,K]=c.useState(t[0]?.id??null),[X,q]=c.useState(new Set),[H,w]=c.useState({}),[B,N]=c.useState(Object.fromEntries(t.map(M=>[M.id,nt(M)])));c.useEffect(()=>{P(t),N(Object.fromEntries(t.map(M=>[M.id,nt(M)]))),K(M=>t.some(_=>_.id===M)?M:t[0]?.id??null)},[t]),c.useEffect(()=>{D(r)},[r]);const S=k.find(M=>M.id===Y)??null,F=S?.settings?.quickFilters??{},T=M=>{if(!M){K(null);return}P(_=>_.map(G=>G.id===M.id?{...G,...M}:G)),K(M.id)},te=async M=>{if(g){const _=await g(M);_&&K(_);return}P(_=>[..._,M]),N(_=>({..._,[M.id]:nt(M)})),K(M.id)},C=(M,_)=>{P(G=>G.map(le=>le.id===M?{...le,..._}:le))},U=async M=>{await j?.(M),P(_=>{const G=_.filter(le=>le.id!==M);return G.length===0?(K(null),_):(Y===M&&K(G[0]?.id??null),G)}),N(_=>{const G={..._};return delete G[M],G})},Q=async M=>{P(_=>{const G=new Map(_.map(le=>[le.id,le]));return M.map(le=>G.get(le)).filter(Boolean)}),await R?.(M)},y=(()=>{if(!S)return!1;const M=nt(S),_=B[S.id];return _?!go(M,_):!1})(),b=async()=>{if(!S)return;const M=await g?.(S);M&&M!==S.id&&(P(_=>_.map(G=>G.id===S.id?{...G,id:M}:G)),K(_=>_===S.id?M:_)),N(_=>{const G={..._},le=M??S.id;return M&&M!==S.id&&delete G[S.id],G[le]=nt({...S}),G})},J=()=>{if(!S)return;const M=B[S.id];M&&C(S.id,{name:M.name,icon:M.icon,groupBy:M.groupBy,settings:M.settings})},ee=c.useCallback(M=>{S&&T({...S,settings:{...S.settings??{},quickFilters:{...F,...M}}})},[S,F]),Z=c.useCallback(M=>{w(_=>({..._,...M}))},[]),ne=c.useCallback(M=>{q(_=>{const G=new Set(_);return G.has(M)?G.delete(M):G.add(M),G})},[]),ce=c.useCallback(()=>{q(new Set)},[]),oe=(M="root",_)=>{A(M),W(!!_?.focusViewNameEditor),I(!0)},re=()=>r.map(M=>M.id),Se={visiblePropertyIds:S?.settings?.visiblePropertyIds??re(),...S?.settings??{},quickFilters:{...F,...H}},ae=!!(E&&S&&a);return s.jsxRuntimeExports.jsx(Gn.Provider,{value:{entries:e,onAddEntry:h,views:k,viewTemplates:n??t,currentView:S,setCurrentView:T,addView:te,updateView:C,deleteView:U,reorderViews:Q,hasCurrentViewUnsavedChanges:y,saveCurrentViewAsDefault:b,revertCurrentViewToDefault:J,quickFilters:F,setQuickFilters:ee,transientQuickFilters:H,setTransientQuickFilters:Z,currentUserQuickFilter:d,showViewSettings:E,setShowViewSettings:I,viewSettingsPageId:V,setViewSettingsPageId:A,focusViewNameEditor:$,setFocusViewNameEditor:W,openViewSettings:oe,properties:L,setProperties:D,selectedIds:X,toggleSelected:ne,clearSelection:ce,onDeleteEntries:m,onEntryClick:z},children:s.jsxRuntimeExports.jsxs("div",{className:`relative h-full min-h-0 flex flex-col border border-[#2A2A2A] bg-[#111111] rounded ${u}`,children:[i===void 0&&s.jsxRuntimeExports.jsx(Ds,{}),i!=null&&c.isValidElement(i)&&c.cloneElement(i),s.jsxRuntimeExports.jsxs("div",{className:"flex-1 min-h-0 flex flex-row overflow-hidden",children:[s.jsxRuntimeExports.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:S?s.jsxRuntimeExports.jsx(S.layout,{entries:e,groupBy:S.groupBy,properties:L,viewSettings:Se,renderEntry:S.renderEntry??o,assigneeOptions:f,onUpdateEntry:x,subtasksEnabled:p,onAddSubtask:v}):s.jsxRuntimeExports.jsx("div",{children:"No view selected"})}),s.jsxRuntimeExports.jsx("div",{className:`shrink-0 overflow-hidden transition-[width,opacity,transform] duration-200 ease-out ${ae?"border-l border-[#2A2A2A] opacity-100 translate-x-0":"border-l-0 opacity-0 translate-x-1"}`,style:{width:ae?"18.75rem":"0rem"},children:ae?a:null})]}),s.jsxRuntimeExports.jsx(mo,{})]})})}function Ue(e,t,n){let r=n.initialDeps??[],i,o=!0;function l(){var a,u,f;let d;n.key&&((a=n.debug)!=null&&a.call(n))&&(d=Date.now());const x=e();if(!(x.length!==r.length||x.some((v,g)=>r[g]!==v)))return i;r=x;let p;if(n.key&&((u=n.debug)!=null&&u.call(n))&&(p=Date.now()),i=t(...x),n.key&&((f=n.debug)!=null&&f.call(n))){const v=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-p)*100)/100,j=g/16,m=(R,z)=>{for(R=String(R);R.length<z;)R=" "+R;return R};console.info(`%c⏱ ${m(g,5)} /${m(v,5)} ms`,`
|
|
2
6
|
font-size: .6rem;
|
|
3
7
|
font-weight: bold;
|
|
4
|
-
color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,s?.key)}return s?.onChange&&!(o&&s.skipInitialOnChange)&&s.onChange(r),o=!1,r}return a.updateDeps=l=>{n=l},a}function de(t,i){if(t===void 0)throw new Error("Unexpected undefined");return t}const St=(t,i)=>Math.abs(t-i)<1.01,wt=(t,i,s)=>{let n;return function(...r){t.clearTimeout(n),n=t.setTimeout(()=>i.apply(this,r),s)}},xe=t=>{const{offsetWidth:i,offsetHeight:s}=t;return{width:i,height:s}},Mt=t=>t,kt=t=>{const i=Math.max(t.startIndex-t.overscan,0),s=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let r=i;r<=s;r++)n.push(r);return n},Ct=(t,i)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;const r=a=>{const{width:l,height:c}=a;i({width:Math.round(l),height:Math.round(c)})};if(r(xe(s)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const m=c.borderBoxSize[0];if(m){r({width:m.inlineSize,height:m.blockSize});return}}r(xe(s))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return o.observe(s,{box:"border-box"}),()=>{o.unobserve(s)}},me={passive:!0},he=typeof window>"u"?!0:"onscrollend"in window,It=(t,i)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;let r=0;const o=t.options.useScrollendEvent&&he?()=>{}:wt(n,()=>{i(r,!1)},t.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:j,isRtl:d}=t.options;r=j?s.scrollLeft*(d&&-1||1):s.scrollTop,o(),i(r,h)},l=a(!0),c=a(!1);s.addEventListener("scroll",l,me);const m=t.options.useScrollendEvent&&he;return m&&s.addEventListener("scrollend",c,me),()=>{s.removeEventListener("scroll",l),m&&s.removeEventListener("scrollend",c)}},Nt=(t,i,s)=>{if(i?.borderBoxSize){const n=i.borderBoxSize[0];if(n)return Math.round(n[s.options.horizontal?"inlineSize":"blockSize"])}return t[s.options.horizontal?"offsetWidth":"offsetHeight"]},Dt=(t,{adjustments:i=0,behavior:s},n)=>{var r,o;const a=t+i;(o=(r=n.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[n.options.horizontal?"left":"top"]:a,behavior:s})};class Vt{constructor(i){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 s,n,r;return((r=(n=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:n.now)==null?void 0:r.call(n))??Date.now()},this.observer=(()=>{let s=null;const n=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const a=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),s=null},observe:r=>{var o;return(o=n())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=n())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=s=>{Object.entries(s).forEach(([n,r])=>{typeof r>"u"&&delete s[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Mt,rangeExtractor:kt,onChange:()=>{},measureElement:Nt,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,...s}},this.notify=s=>{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,s)},this.maybeNotify=T(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{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(s=>s()),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 s;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,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=(s,n)=>{const r=new Map,o=new Map;for(let a=n-1;a>=0;a--){const l=s[a];if(r.has(l.lane))continue;const c=o.get(l.lane);if(c==null||l.end>c.end?o.set(l.lane,l):l.end<c.end&&r.set(l.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=T(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(s,n,r,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:s,paddingStart:n,scrollMargin:r,getItemKey:o,enabled:a,lanes:l}),{key:!1}),this.getMeasurements=T(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:n,scrollMargin:r,getItemKey:o,enabled:a,lanes:l},c)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const d of this.laneAssignments.keys())d>=s&&this.laneAssignments.delete(d);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(d=>{this.itemSizeCache.set(d.key,d.size)}));const m=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,m),j=new Array(l).fill(void 0);for(let d=0;d<m;d++){const y=h[d];y&&(j[y.lane]=d)}for(let d=m;d<s;d++){const y=o(d),w=this.laneAssignments.get(d);let E,k;if(w!==void 0&&this.options.lanes>1){E=w;const b=j[E],R=b!==void 0?h[b]:void 0;k=R?R.end+this.options.gap:n+r}else{const b=this.options.lanes===1?h[d-1]:this.getFurthestMeasurement(h,d);k=b?b.end+this.options.gap:n+r,E=b?b.lane:d%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(d,E)}const v=c.get(y),M=typeof v=="number"?v:this.options.estimateSize(d),u=k+M;h[d]={index:d,start:k,size:M,end:u,key:y,lane:E},j[E]=d}return this.measurementsCache=h,h},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=T(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,n,r,o)=>this.range=s.length>0&&n>0?At({measurements:s,outerSize:n,scrollOffset:r,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=T(()=>{let s=null,n=null;const r=this.calculateRange();return r&&(s=r.startIndex,n=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,n]},(s,n,r,o,a)=>o===null||a===null?[]:s({startIndex:o,endIndex:a,overscan:n,count:r}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=s=>{const n=this.options.indexAttribute,r=s.getAttribute(n);return r?parseInt(r,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(r!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,r-o),l=Math.min(this.options.count-1,r+o);return s>=a&&s<=l}return!0},this._measureElement=(s,n)=>{if(!s.isConnected){this.observer.unobserve(s);return}const r=this.indexFromElement(s),o=this.measurementsCache[r];if(!o)return;const a=o.key,l=this.elementsCache.get(a);l!==s&&(l&&this.observer.unobserve(l),this.observer.observe(s),this.elementsCache.set(a,s)),this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(s,n,this))},this.resizeItem=(s,n)=>{var r;const o=this.measurementsCache[s];if(!o)return;const a=this.itemSizeCache.get(o.key)??o.size,l=n-a;l!==0&&(((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,l,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",l),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,n)),this.notify(!1))},this.measureElement=s=>{if(!s){this.elementsCache.forEach((n,r)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(r))});return}this._measureElement(s,void 0)},this.getVirtualItems=T(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,n)=>{const r=[];for(let o=0,a=s.length;o<a;o++){const l=s[o],c=n[l];r.push(c)}return r},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const n=this.getMeasurements();if(n.length!==0)return de(n[Re(0,n.length-1,r=>de(n[r]).start,s)])},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 s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(s,n,r=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),a=this.getScrollOffset();n==="auto"&&(n=s>=a+o?"end":"start"),n==="center"?s+=(r-o)/2:n==="end"&&(s-=o);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,s),0)},this.getOffsetForIndex=(s,n="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const r=this.getSize(),o=this.getScrollOffset(),a=this.measurementsCache[s];if(!a)return;if(n==="auto")if(a.end>=o+r-this.options.scrollPaddingEnd)n="end";else if(a.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];if(n==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),n];const l=n==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,n,a.size),n]},this.scrollToOffset=(s,{align:n="start",behavior:r="auto"}={})=>{const o=this.getOffsetForAlignment(s,n),a=this.now();this.scrollState={index:null,align:n,behavior:r,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:n="auto",behavior:r="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getOffsetForIndex(s,n);if(!o)return;const[a,l]=o,c=this.now();this.scrollState={index:s,align:l,behavior:r,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:n="auto"}={})=>{const r=this.getScrollOffset()+s,o=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:o,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var s;const n=this.getMeasurements();let r;if(n.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((s=n[n.length-1])==null?void 0:s.end)??0;else{const o=Array(this.options.lanes).fill(null);let a=n.length-1;for(;a>=0&&o.some(l=>l===null);){const l=n[a];o[l.lane]===null&&(o[l.lane]=l.end),a--}r=Math.max(...o.filter(l=>l!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(s,{adjustments:n,behavior:r})=>{this.options.scrollToFn(s,{behavior:r,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(i)}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 n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=n?n[0]:this.scrollState.lastTargetOffset,o=1,a=r!==this.scrollState.lastTargetOffset;if(!a&&St(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=r,this.scrollState.behavior="auto",this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Re=(t,i,s,n)=>{for(;t<=i;){const r=(t+i)/2|0,o=s(r);if(o<n)t=r+1;else if(o>n)i=r-1;else return r}return t>0?t-1:0};function At({measurements:t,outerSize:i,scrollOffset:s,lanes:n}){const r=t.length-1,o=c=>t[c].start;if(t.length<=n)return{startIndex:0,endIndex:r};let a=Re(0,r,o,s),l=a;if(n===1)for(;l<r&&t[l].end<s+i;)l++;else if(n>1){const c=Array(n).fill(0);for(;l<r&&c.some(h=>h<s+i);){const h=t[l];c[h.lane]=h.end,l++}const m=Array(n).fill(s+i);for(;a>=0&&m.some(h=>h>=s);){const h=t[a];m[h.lane]=h.start,a--}a=Math.max(0,a-a%n),l=Math.min(r,l+(n-1-l%n))}return{startIndex:a,endIndex:l}}const pe=typeof document<"u"?W.useLayoutEffect:W.useEffect;function zt({useFlushSync:t=!0,...i}){const s=W.useReducer(()=>({}),{})[1],n={...i,onChange:(o,a)=>{var l;t&&a?_e.flushSync(s):s(),(l=i.onChange)==null||l.call(i,o,a)}},[r]=W.useState(()=>new Vt(n));return r.setOptions(n),pe(()=>r._didMount(),[]),pe(()=>r._willUpdate()),r}function Ft(t){return zt({observeElementRect:Ct,observeElementOffset:It,scrollToFn:Dt,...t})}function le(t){return"type"in t&&t.type==="group"}function fe(t){return t==null?!1:typeof t=="string"?t.trim().length>0:typeof t=="number"||typeof t=="boolean"}function X(t){return String(t?.identifier??t?.key??t?.id??"")}function K(t){return typeof t?.summary=="string"?t.summary:typeof t?.title=="string"?t.title:typeof t?.name=="string"?t.name:""}function _t(t){return typeof t?.priority=="string"?t.priority:""}function Ot(t){return typeof t?.assignee=="string"?t.assignee:typeof t?.assignee?.name=="string"?t.assignee.name:""}function Se(t,i){if(!i)return t;if(le(i))return t.filter(l=>Bt(l,i));const s=i,n=String(s.query??"").trim().toLowerCase(),r=s.status??[],o=s.priority??[],a=s.assignee??[];return!n&&r.length===0&&o.length===0&&a.length===0?t:t.filter(l=>{const c=String(l?.status??""),m=String(l?.priority??""),h=String(l?.assignee??"");if(r.length>0&&!r.includes(c)||o.length>0&&!o.includes(m)||a.length>0&&!a.includes(h))return!1;if(!n)return!0;const j=X(l).toLowerCase(),d=K(l).toLowerCase();return j.includes(n)||d.includes(n)})}function Lt(t,i){if(i==="id")return X(t);if(i==="summary")return K(t);const s=t?.[i];if(s!=null)return String(s)}function Tt(t,i){const s=Lt(t,i.field),n=String(s??"").toLowerCase(),r=String(i.value??"").toLowerCase();switch(i.operator){case"is":return n===r;case"is_not":return n!==r;case"contains":return n.includes(r);case"is_empty":return!s;case"is_not_empty":return!!s;default:return!0}}function we(t,i){if(i.type==="rule")return Tt(t,i);if(i.children.length===0)return!0;const s=i.children.map(n=>we(t,n));return i.conjunction==="AND"?s.every(Boolean):s.some(Boolean)}function Bt(t,i){return we(t,i)}function Q(){return{type:"group",conjunction:"AND",children:[{type:"rule",field:"summary",operator:"contains",value:""}]}}function Me(t){if(!t)return 0;if(!le(t))return(t.status?.length??0)+(t.priority?.length??0)+(t.assignee?.length??0)+(t.query?1:0);const i=s=>s.type==="rule"?1:s.children.reduce((n,r)=>n+i(r),0);return i(t)}function ke(t){if(!t)return!1;if(!le(t))return fe(t.query)||(t.status?.length??0)>0||(t.priority?.length??0)>0||(t.assignee?.length??0)>0;const i=s=>s.type==="group"?s.children.some(n=>i(n)):s.operator==="is_empty"||s.operator==="is_not_empty"?!0:fe(s.value);return i(t)}function Ce(t,i,s="updated"){const n=[...t],r={high:3,medium:2,low:1},o={backlog:1,open:2,"in progress":3,done:4},a=(l,c,m)=>{if(m==="priority"){const w=r[String(l?.priority??"").toLowerCase()]??0;return(r[String(c?.priority??"").toLowerCase()]??0)-w}if(m==="status"){const w=o[String(l?.status??"").toLowerCase()]??0;return(o[String(c?.status??"").toLowerCase()]??0)-w}const h=m==="updated"?l?.updatedAt??l?.updated??l?.id:l?.[m],j=m==="updated"?c?.updatedAt??c?.updated??c?.id:c?.[m],d=Number(h),y=Number(j);return!Number.isNaN(d)&&!Number.isNaN(y)?y-d:String(j??"").localeCompare(String(h??""),void 0,{numeric:!0,sensitivity:"base"})};return n.sort((l,c)=>{if(i&&i.length>0){for(const m of i){const h=a(l,c,m.property);if(h!==0)return m.direction==="desc"?h:-h}return 0}return a(l,c,s)}),n}function Ie(t,i){if(!i)return t;const s=i.status??[],n=i.assignee??[],r=String(i.search??"").trim().toLowerCase();return s.length===0&&n.length===0&&!r?t:t.filter(o=>{const a=String(o?.status??""),l=String(o?.assignee??"");if(s.length>0&&!s.includes(a)||n.length>0&&!n.includes(l))return!1;if(!r)return!0;const c=X(o).toLowerCase(),m=K(o).toLowerCase();return c.includes(r)||m.includes(r)})}const Pt=[{value:"low",label:"Low",icon:e.jsxRuntimeExports.jsx(e.MtLowIcon,{})},{value:"medium",label:"Medium",icon:e.jsxRuntimeExports.jsx(e.MtMediumIcon,{})},{value:"high",label:"High",icon:e.jsxRuntimeExports.jsx(e.MtHighIcon,{})}],qt=[{value:"backlog",label:"Backlog",icon:e.jsxRuntimeExports.jsx(e.MtBacklogIcon,{})},{value:"open",label:"Open",icon:e.jsxRuntimeExports.jsx(e.MtOpenIcon,{})},{value:"in progress",label:"In Progress",icon:e.jsxRuntimeExports.jsx(e.MtInProgressIcon,{})},{value:"done",label:"Done",icon:e.jsxRuntimeExports.jsx(e.MtCheckIcon,{})}],$t=[{value:"user story",label:"User story",icon:e.jsxRuntimeExports.jsx(se,{size:14,stroke:"#60A5FA"})},{value:"bug",label:"Bug",icon:e.jsxRuntimeExports.jsx(ne,{size:14,stroke:"#EF4444"})},{value:"docs",label:"Docs",icon:e.jsxRuntimeExports.jsx(ie,{size:14,stroke:"#A78BFA"})},{value:"feature",label:"Feature",icon:e.jsxRuntimeExports.jsx(oe,{size:14,stroke:"#F59E0B"})},{value:"task",label:"Task",icon:e.jsxRuntimeExports.jsx(re,{size:14,stroke:"#22C55E"})}];function Gt({value:t,onChange:i}){return e.jsxRuntimeExports.jsx(e.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:t,onValueChange:i,options:Pt})}const Ne=Gt;function De({value:t,onChange:i}){return e.jsxRuntimeExports.jsx(e.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:t,onValueChange:i,options:qt})}function Ve({value:t,onChange:i}){return e.jsxRuntimeExports.jsx(e.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:t,onValueChange:i,options:$t})}function Ae({value:t,onChange:i,placeholder:s="Summary..."}){return e.jsxRuntimeExports.jsx("input",{value:t,onChange:n=>i(n.target.value),placeholder:s,className:"w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-sm text-text-primary outline-none focus:border-[#2A2A2A]"})}function Wt({entry:t,visiblePropertySet:i,onSummaryChange:s,onPriorityChange:n,onStatusChange:r,onIssueTypeChange:o}){const a=t?.id?String(t.id):"",l=t?.name?String(t.name):t?.title?String(t.title):"",c=t?.status?String(t.status):t?.state?String(t.state):"",m=t?.priority?String(t.priority):void 0,h=t?.assignee?String(t.assignee):"",j=t?.summary?String(t.summary):"",d=String(t?.entryType??t?.issueType??t?.type??"user story").toLowerCase(),y=!!t?.selected,[w,E]=f.useState(j),[k,v]=f.useState(m),[M,u]=f.useState(c),[b,R]=f.useState(d);f.useEffect(()=>{E(j),v(m),u(c),R(d)},[j,m,c,d]);const g=i.has("id"),C=i.has("name")||i.has("title"),D=i.has("status")||i.has("state"),L=i.has("type")||i.has("entryType")||i.has("issueType"),A=i.has("priority"),_=i.has("assignee"),B=(()=>{switch(d){case"bug":return ne;case"docs":case"documentation":return ie;case"feature":return oe;case"task":return re;default:return se}})();return e.jsxRuntimeExports.jsxs("div",{className:"group flex items-center gap-2 px-4 border-b border-[#2A2A2A] h-[44px] bg-[#141414] text-sm",children:[e.jsxRuntimeExports.jsx("div",{className:`${y?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity`,children:e.jsxRuntimeExports.jsx(e.MtCheckbox,{checked:y})}),A?e.jsxRuntimeExports.jsx(Ne,{value:k,onChange:V=>{v(V),n?.(V)}}):null,L?e.jsxRuntimeExports.jsx(Ve,{value:b,onChange:V=>{R(V),o?.(V)}}):null,g?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 text-text-primary min-w-0",children:[L?null:e.jsxRuntimeExports.jsx(B,{size:14,stroke:"#608a23"}),e.jsxRuntimeExports.jsx("span",{className:"truncate",children:a})]}):null,D?e.jsxRuntimeExports.jsx(De,{value:M,onChange:V=>{u(V),r?.(V)}}):null,C?e.jsxRuntimeExports.jsx("span",{className:"text-text-primary truncate max-w-40",children:l||"—"}):null,e.jsxRuntimeExports.jsx("div",{className:"flex-1 min-w-0",children:e.jsxRuntimeExports.jsx(Ae,{value:w,onChange:V=>{E(V),s?.(V)}})}),_?e.jsxRuntimeExports.jsx(e.MtAvatar,{name:h,size:"xs"}):null]})}const Ht=["summary"];function $(t){return Array.from(new Set([...t,...Ht]))}function ze(t){const i=[...t],s=n=>i.some(r=>r.id===n);return s("summary")||i.unshift({id:"summary",label:"Summary"}),!s("type")&&!s("entryType")&&!s("issueType")&&i.push({id:"type",label:"Type"}),i}function Ut({label:t,count:i}){return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between px-6 border-b border-border-default h-11 bg-[#111111] text-sm",children:[e.jsxRuntimeExports.jsx("span",{className:"text-text-primary",children:t}),e.jsxRuntimeExports.jsx("span",{className:"text-text-muted",children:i})]})}const Xt=44;function Kt(t,i){if(!i)return t.map(r=>({type:"entry",key:`entry-${r.id}`,entry:r}));const s=new Map;t.forEach(r=>{const o=r?.[i],a=o==null||o===""?"Ungrouped":String(o),l=s.get(a);if(l){l.push(r);return}s.set(a,[r])});const n=[];return s.forEach((r,o)=>{n.push({type:"group",key:`group-${i}-${o}`,label:o,count:r.length}),r.forEach(a=>{n.push({type:"entry",key:`entry-${a.id}`,entry:a})})}),n}const ae=t=>{const i=f.useMemo(()=>t.properties&&t.properties.length>0?t.properties:[{id:"id",label:"ID"}],[t.properties]),[s,n]=f.useState({}),r=f.useMemo(()=>t.entries.map(M=>{const u=String(M?.id??""),b=s[u];return b?{...M,...b}:M}),[t.entries,s]),o=f.useMemo(()=>$(t.viewSettings?.visiblePropertyIds??i.map(M=>M.id)),[t.viewSettings?.visiblePropertyIds,i]),a=f.useMemo(()=>new Set(o),[o]),l=t.renderEntry,c=f.useRef(null),m=f.useMemo(()=>t.viewSettings?.filter??{},[t.viewSettings?.filter]),h=f.useMemo(()=>t.viewSettings?.quickFilters??{},[t.viewSettings?.quickFilters]),j=f.useMemo(()=>t.viewSettings?.sortRules??[],[t.viewSettings?.sortRules]),d=typeof t.viewSettings?.sortBy=="string"?t.viewSettings.sortBy:"updated",y=f.useMemo(()=>Se(r,m),[r,m]),w=f.useMemo(()=>Ie(y,h),[y,h]),E=f.useMemo(()=>Ce(w,j,d),[w,j,d]),k=f.useMemo(()=>Kt(E,t.groupBy),[E,t.groupBy]),v=Ft({count:k.length,getScrollElement:()=>c.current,overscan:5,estimateSize:()=>Xt});return e.jsxRuntimeExports.jsx("div",{id:"scroll-container",ref:c,className:"h-full min-h-0 overflow-y-auto",children:e.jsxRuntimeExports.jsx("div",{className:"relative",style:{height:v.getTotalSize()},children:v.getVirtualItems().map(M=>{const u=k[M.index];return u?e.jsxRuntimeExports.jsx("div",{className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${M.start}px)`},children:u.type==="group"?e.jsxRuntimeExports.jsx(Ut,{label:u.label,count:u.count}):l?e.jsxRuntimeExports.jsx(l,{entry:u.entry}):e.jsxRuntimeExports.jsx(Wt,{entry:u.entry,visiblePropertySet:a,onSummaryChange:b=>{const R=String(u.entry?.id??"");n(g=>({...g,[R]:{...g[R]??{},summary:b}}))},onPriorityChange:b=>{const R=String(u.entry?.id??"");n(g=>({...g,[R]:{...g[R]??{},priority:b}}))},onStatusChange:b=>{const R=String(u.entry?.id??"");n(g=>({...g,[R]:{...g[R]??{},status:b,state:b}}))},onIssueTypeChange:b=>{const R=String(u.entry?.id??"");n(g=>({...g,[R]:{...g[R]??{},type:b,entryType:b,issueType:b}}))}})},u.key):null})})})};function Qt({currentView:t,properties:i,viewSettings:s,setViewSettings:n,setCurrentView:r}){const o=s.filter??{},a=ze(i),l=$(s.visiblePropertyIds??a.map(u=>u.id)),c=new Set(l),m=i.filter(u=>u.groupable),h=t.groupBy??null,j=h?i.find(u=>u.id===h)?.label??h:"None",d=s.sortRules??[],y=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],w=d.length>0?y.find(u=>u.value===d[0].property)?.label??d[0].property:"None",E=Me(o),k=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}],v=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}],M="type"in o&&o.type==="group"?o:Q();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(F,{title:"View options",children:[e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(e.ListFilter,{size:14}),label:"Filter",submenu:"filter",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[E>0?`${E} active`:"None",e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(H,{size:14}),label:"Properties",submenu:"properties",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[l.length,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(U,{size:14}),label:"Group",submenu:"group",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[j,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(e.ArrowUpDown,{size:14}),label:"Sort",submenu:"sort",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[w,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})})]}),e.jsxRuntimeExports.jsx(O,{id:"filter",title:"Filter",children:e.jsxRuntimeExports.jsx(F,{children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtFilterDropdown,{title:"Filter",value:M,onChange:u=>n({filter:u}),fields:k,operators:v,variant:"ghost"})})})}),e.jsxRuntimeExports.jsx(O,{id:"properties",title:"Properties",children:e.jsxRuntimeExports.jsx(F,{title:"Visible columns",children:a.map(u=>e.jsxRuntimeExports.jsx(N,{label:u.label,active:c.has(u.id),disabled:u.id==="summary",trailing:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:c.has(u.id)?"Visible":"Hidden"}),onClick:()=>{if(u.id==="summary")return;const b=c.has(u.id),R=b?l.filter(g=>g!==u.id):[...l,u.id];n({visiblePropertyIds:$(R)}),b&&t.groupBy===u.id&&r({...t,groupBy:null})}},u.id))})}),e.jsxRuntimeExports.jsx(O,{id:"group",title:"Group",children:e.jsxRuntimeExports.jsxs(F,{title:"Group by",children:[e.jsxRuntimeExports.jsx(N,{label:"None",active:h===null,onClick:()=>{r({...t,groupBy:null})}}),m.length>0?m.map(u=>e.jsxRuntimeExports.jsx(N,{label:u.label,active:t.groupBy===u.id,onClick:()=>{r({...t,groupBy:u.id})}},u.id)):e.jsxRuntimeExports.jsx(N,{label:"No groupable properties",disabled:!0})]})}),e.jsxRuntimeExports.jsx(O,{id:"sort",title:"Sort",children:e.jsxRuntimeExports.jsx(F,{children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtSortDropdown,{title:"Sort",value:d,onChange:u=>n({sortRules:u}),fields:y,variant:"ghost"})})})})]})}ae.SettingsMenu=Qt;function Yt(){const t=q(),i=t.currentView,s=t.properties;if(!i)return null;const n=i.settings??{},r=n.sortRules??[],o=ze(s),a=$(n.visiblePropertyIds??o.map(v=>v.id)),l=s.filter(v=>v.groupable),c=t.setCurrentView,m=v=>{c({...i,settings:{...i.settings??{},...v}})},h=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}],j=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}],d=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],y=n.filter&&typeof n.filter=="object"&&"type"in n.filter?n.filter:Q(),w=!!i.groupBy,E=r.length>0,k=ke(n.filter);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(U,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:w?"accent":"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsxs("div",{className:"w-56 p-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>c({...i,groupBy:null}),children:"None"}),l.map(v=>e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>c({...i,groupBy:v.id}),children:v.label},v.id))]})}),w?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>c({...i,groupBy:null}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtSortDropdown,{title:"Sort",kind:"icon",variant:E?"accent":"ghost",showCaret:!1,value:r,onChange:v=>m({sortRules:v}),fields:d}),E?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>m({sortRules:[]}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtFilterDropdown,{title:"Filter",kind:"icon",variant:k?"accent":"ghost",showCaret:!1,value:y,onChange:v=>m({filter:v}),fields:h,operators:j}),k?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>m({filter:void 0}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(H,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsx("div",{className:"w-56 p-1",children:o.map(v=>{const M=a.includes(v.id),u=M?a.filter(b=>b!==v.id):[...a,v.id];return e.jsxRuntimeExports.jsx(e.MtDropdownItem,{disabled:v.id==="summary",onSelect:()=>{v.id!=="summary"&&m({visiblePropertyIds:$(u)})},children:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center justify-between w-full",children:[e.jsxRuntimeExports.jsx("span",{children:v.label}),e.jsxRuntimeExports.jsx("span",{className:"text-text-muted text-xs",children:M?"Visible":"Hidden"})]})},v.id)})})})]})}ae.ToolbarActions=Yt;function Jt({entry:t}){return e.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-11 bg-[#141414]",children:t.id})}const Zt=t=>{const i=t.renderEntry??Jt;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{children:"Grid Layout"}),t.entries.map(s=>e.jsxRuntimeExports.jsx(i,{entry:s},s.id))]})};function es({entry:t}){return e.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-11 bg-[#141414]",children:t.id})}const ts=t=>{const i=t.renderEntry??es;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{children:"Table Layout"}),t.entries.map(s=>e.jsxRuntimeExports.jsx(i,{entry:s},s.id))]})},ss=["summary"];function te(t){return Array.from(new Set([...t,...ss]))}function ns(t){const i=[...t],s=n=>i.some(r=>r.id===n);return s("summary")||i.unshift({id:"summary",label:"Summary"}),!s("type")&&!s("entryType")&&!s("issueType")&&i.push({id:"type",label:"Type"}),i}function is({entry:t,onSummaryChange:i,onPriorityChange:s,onStatusChange:n,onIssueTypeChange:r,visiblePropertySet:o}){const a=X(t),l=_t(t),c=t?.status?String(t.status):t?.state?String(t.state):"",m=Ot(t),h=K(t),j=String(t?.entryType??t?.issueType??t?.type??"user story").toLowerCase(),d=o.has("summary"),y=o.has("id"),w=o.has("status")||o.has("state"),E=o.has("type")||o.has("entryType")||o.has("issueType"),k=o.has("priority"),v=o.has("assignee"),M=y||E||w||k||v,u=(()=>{switch(j){case"bug":return ne;case"docs":case"documentation":return ie;case"feature":return oe;case"task":return re;default:return se}})();return e.jsxRuntimeExports.jsxs("div",{className:"rounded border border-[#2A2A2A] bg-[#141414] p-3 text-sm",children:[d?e.jsxRuntimeExports.jsx(Ae,{value:h,onChange:i}):null,M?e.jsxRuntimeExports.jsxs("div",{className:"flex row justify-between items-center px-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex row gap-2 items-center min-w-0",children:[E?e.jsxRuntimeExports.jsx(Ve,{value:j,onChange:r}):null,y?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[E?null:e.jsxRuntimeExports.jsx(u,{size:14,stroke:"#608a23"}),e.jsxRuntimeExports.jsx("div",{className:"text-xs text-text-primary",children:a})]}):null,w?e.jsxRuntimeExports.jsx(De,{value:c,onChange:n}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-primary",children:[k?e.jsxRuntimeExports.jsx(Ne,{value:l,onChange:s}):null,v?e.jsxRuntimeExports.jsx(e.MtAvatar,{name:String(m??""),size:"xs"}):null]})]}):null]})}function rs(t,i){if(!i)return[{key:"all",label:"All",entries:t}];const s=new Map;return t.forEach(n=>{const r=n?.[i],o=r==null||r===""?"Ungrouped":String(r);s.has(o)||s.set(o,[]),s.get(o).push(n)}),Array.from(s.entries()).map(([n,r])=>({key:`${i}-${n}`,label:n,entries:r}))}const ue=t=>{const i=t.renderEntry,s=f.useMemo(()=>t.properties&&t.properties.length>0?t.properties:[{id:"id",label:"ID"}],[t.properties]),n=f.useMemo(()=>te(t.viewSettings?.visiblePropertyIds??s.map(R=>R.id)),[t.viewSettings?.visiblePropertyIds,s]),r=f.useMemo(()=>new Set(n),[n]),[o,a]=f.useState(t.entries),[l,c]=f.useState(null),[m,h]=f.useState(null);f.useEffect(()=>{a(t.entries)},[t.entries]);const j=t.groupBy??"status",d=typeof t.viewSettings?.sortBy=="string"?t.viewSettings.sortBy:"updated",y=f.useMemo(()=>t.viewSettings?.quickFilters??{},[t.viewSettings?.quickFilters]),w=t.viewSettings?.sortRules??[],E=f.useMemo(()=>t.viewSettings?.filter??{},[t.viewSettings?.filter]),k=f.useMemo(()=>Se(o,E),[o,E]),v=f.useMemo(()=>Ie(k,y),[k,y]),M=Ce(v,w,d),u=rs(M,j),b=(R,g)=>{a(C=>C.map(D=>String(D?.id)===R?{...D,...g}:D))};return e.jsxRuntimeExports.jsx("div",{className:"h-full min-h-0 overflow-auto p-3",children:e.jsxRuntimeExports.jsx("div",{className:"flex min-w-max gap-3",children:u.map(R=>e.jsxRuntimeExports.jsxs("div",{onDragEnter:g=>{g.preventDefault(),h(R.key)},onDragOver:g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},onDragLeave:()=>{m===R.key&&h(null)},onDrop:g=>{g.preventDefault();const C=g.dataTransfer.getData("text/plain")||l;C&&(a(D=>{if(!D.find(_=>String(_?.id)===C)||!j)return D;const A=R.label==="Ungrouped"?null:R.label;return D.map(_=>String(_?.id)===C?{..._,[j]:A}:_)}),h(null),c(null))},className:`w-72 min-w-72 rounded border bg-[#111111] ${m===R.key?"border-border-default":"border-[#2A2A2A]"}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between border-b border-border-default px-3 py-2 text-sm",children:[e.jsxRuntimeExports.jsx("span",{className:"text-text-primary",children:R.label}),e.jsxRuntimeExports.jsx("span",{className:"text-text-muted",children:R.entries.length})]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2 p-2",children:R.entries.map(g=>e.jsxRuntimeExports.jsx("div",{draggable:!0,onDragStart:C=>{const D=String(g?.id);c(D),C.dataTransfer.setData("text/plain",D),C.dataTransfer.effectAllowed="move"},onDragEnd:()=>{c(null),h(null)},className:`cursor-grab active:cursor-grabbing ${l&&String(g?.id)===l?"opacity-50":""}`,children:i?e.jsxRuntimeExports.jsx(i,{entry:g}):e.jsxRuntimeExports.jsx(is,{entry:g,visiblePropertySet:r,onSummaryChange:C=>{b(String(g?.id),{summary:C})},onPriorityChange:C=>{b(String(g?.id),{priority:C})},onStatusChange:C=>{b(String(g?.id),{status:C})},onIssueTypeChange:C=>{b(String(g?.id),{entryType:C,type:C,issueType:C})}})},g.id))})]},R.key))})})};function os({currentView:t,properties:i,viewSettings:s,setViewSettings:n,setCurrentView:r}){const o=i.filter(u=>u.groupable),a=ns(i),l=te(s.visiblePropertyIds??a.map(u=>u.id)),c=new Set(l),m=t.groupBy??"status",h=m?i.find(u=>u.id===m)?.label??m:"None",j=s.filter??{},d=Me(j),y=s.sortRules??[],w=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],E=y.length>0?w.find(u=>u.value===y[0].property)?.label??y[0].property:"None",k=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}],v=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}],M="type"in j&&j.type==="group"?j:Q();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(F,{title:"View options",children:[e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(e.ListFilter,{size:14}),label:"Filter",submenu:"filter",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d>0?`${d} active`:"None",e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(H,{size:14}),label:"Properties",submenu:"properties",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[l.length,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(U,{size:14}),label:"Group",submenu:"group",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[h,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(e.ArrowUpDown,{size:14}),label:"Sort",submenu:"sort",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[E,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})})]}),e.jsxRuntimeExports.jsx(O,{id:"properties",title:"Properties",children:e.jsxRuntimeExports.jsx(F,{title:"Visible columns",children:a.map(u=>e.jsxRuntimeExports.jsx(N,{label:u.label,active:c.has(u.id),disabled:u.id==="summary",trailing:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:c.has(u.id)?"Visible":"Hidden"}),onClick:()=>{if(u.id==="summary")return;const b=c.has(u.id),R=b?l.filter(g=>g!==u.id):[...l,u.id];n({visiblePropertyIds:te(R)}),b&&t.groupBy===u.id&&r({...t,groupBy:null})}},u.id))})}),e.jsxRuntimeExports.jsx(O,{id:"filter",title:"Filter",children:e.jsxRuntimeExports.jsx(F,{children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtFilterDropdown,{title:"Filter",value:M,onChange:u=>{r({...t,settings:{...t.settings??{},filter:u}})},fields:k,operators:v,variant:"ghost"})})})}),e.jsxRuntimeExports.jsx(O,{id:"group",title:"Group",children:e.jsxRuntimeExports.jsx(F,{title:"Group by",children:o.length>0?o.map(u=>e.jsxRuntimeExports.jsx(N,{label:u.label,active:t.groupBy===u.id,onClick:()=>{r({...t,groupBy:u.id})}},u.id)):e.jsxRuntimeExports.jsx(N,{label:"No groupable properties",disabled:!0})})}),e.jsxRuntimeExports.jsx(O,{id:"sort",title:"Sort",children:e.jsxRuntimeExports.jsx(F,{children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtSortDropdown,{title:"Sort",value:y,onChange:u=>{n({sortRules:u})},fields:w,variant:"ghost"})})})})]})}ue.SettingsMenu=os;function ls(){const t=q(),i=t.currentView,s=t.properties;if(!i)return null;const n=i.settings??{},r=n.sortRules??[],o=s.filter(E=>E.groupable),a=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}],l=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}],c=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],m=n.filter&&typeof n.filter=="object"&&"type"in n.filter?n.filter:Q(),h=!!i.groupBy,j=r.length>0,d=ke(n.filter),y=t.setCurrentView,w=E=>{y({...i,settings:{...i.settings??{},...E}})};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(U,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:h?"accent":"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsxs("div",{className:"w-56 p-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>y({...i,groupBy:null}),children:"None"}),o.map(E=>e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>y({...i,groupBy:E.id}),children:E.label},E.id))]})}),h?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>y({...i,groupBy:null}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtSortDropdown,{title:"Sort",kind:"icon",variant:j?"accent":"ghost",showCaret:!1,value:r,onChange:E=>w({sortRules:E}),fields:c}),j?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>w({sortRules:[]}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtFilterDropdown,{title:"Filter",kind:"icon",variant:d?"accent":"ghost",showCaret:!1,value:m,onChange:E=>w({filter:E}),fields:a,operators:l}),d?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>w({filter:void 0}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]})]})}ue.ToolbarActions=ls;function as({entry:t}){return e.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-11 bg-[#141414]",children:t.id})}const us=t=>{const i=t.renderEntry??as;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{children:"Gantt Layout"}),t.entries.map(s=>e.jsxRuntimeExports.jsx(i,{entry:s},s.id))]})};exports.MtCollection=Rt;exports.MtCollectionBoardLayout=ue;exports.MtCollectionGanttLayout=us;exports.MtCollectionGridLayout=Zt;exports.MtCollectionListLayout=ae;exports.MtCollectionTableLayout=ts;exports.MtCollectionToolbar=je;exports.MtCollectionViewSettings=be;
|
|
8
|
+
color: hsl(${Math.max(0,Math.min(120-120*j,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(i),o=!1,i}return l.updateDeps=a=>{r=a},l}function On(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const yo=(e,t)=>Math.abs(e-t)<1.01,bo=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Tn=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},jo=e=>e,Eo=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},Ro=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=l=>{const{width:a,height:u}=l;t({width:Math.round(a),height:Math.round(u)})};if(i(Tn(n)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(l=>{const a=()=>{const u=l[0];if(u?.borderBoxSize){const f=u.borderBoxSize[0];if(f){i({width:f.inlineSize,height:f.blockSize});return}}i(Tn(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Fn={passive:!0},Ln=typeof window>"u"?!0:"onscrollend"in window,wo=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const o=e.options.useScrollendEvent&&Ln?()=>{}:bo(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),l=d=>()=>{const{horizontal:x,isRtl:h}=e.options;i=x?n.scrollLeft*(h&&-1||1):n.scrollTop,o(),t(i,d)},a=l(!0),u=l(!1);n.addEventListener("scroll",a,Fn);const f=e.options.useScrollendEvent&&Ln;return f&&n.addEventListener("scrollend",u,Fn),()=>{n.removeEventListener("scroll",a),f&&n.removeEventListener("scrollend",u)}},So=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Co=(e,{adjustments:t=0,behavior:n},r)=>{var i,o;const l=e+t;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:l,behavior:n})};class Mo{constructor(t){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 n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const l=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:jo,rangeExtractor:Eo,onChange:()=>{},measureElement:So,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,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=Ue(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{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(n=>n()),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 n;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=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,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=(n,r)=>{const i=new Map,o=new Map;for(let l=r-1;l>=0;l--){const a=n[l];if(i.has(a.lane))continue;const u=o.get(a.lane);if(u==null||a.end>u.end?o.set(a.lane,a):a.end<u.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((l,a)=>l.end===a.end?l.index-a.index:l.end-a.end)[0]:void 0},this.getMeasurementOptions=Ue(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,i,o,l,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:o,enabled:l,lanes:a}),{key:!1}),this.getMeasurements=Ue(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:o,enabled:l,lanes:a},u)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const h of this.laneAssignments.keys())h>=n&&this.laneAssignments.delete(h);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(h=>{this.itemSizeCache.set(h.key,h.size)}));const f=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,f),x=new Array(a).fill(void 0);for(let h=0;h<f;h++){const p=d[h];p&&(x[p.lane]=h)}for(let h=f;h<n;h++){const p=o(h),v=this.laneAssignments.get(h);let g,j;if(v!==void 0&&this.options.lanes>1){g=v;const k=x[g],P=k!==void 0?d[k]:void 0;j=P?P.end+this.options.gap:r+i}else{const k=this.options.lanes===1?d[h-1]:this.getFurthestMeasurement(d,h);j=k?k.end+this.options.gap:r+i,g=k?k.lane:h%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(h,g)}const m=u.get(p),R=typeof m=="number"?m:this.options.estimateSize(h),z=j+R;d[h]={index:h,start:j,size:R,end:z,key:p,lane:g},x[g]=h}return this.measurementsCache=d,d},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ue(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,o)=>this.range=n.length>0&&r>0?Do({measurements:n,outerSize:r,scrollOffset:i,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Ue(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,o,l)=>o===null||l===null?[]:n({startIndex:o,endIndex:l,overscan:r,count:i}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,i-o),a=Math.min(this.options.count-1,i+o);return n>=l&&n<=a}return!0},this._measureElement=(n,r)=>{if(!n.isConnected){this.observer.unobserve(n);return}const i=this.indexFromElement(n),o=this.measurementsCache[i];if(!o)return;const l=o.key,a=this.elementsCache.get(l);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(l,n)),this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{var i;const o=this.measurementsCache[n];if(!o)return;const l=this.itemSizeCache.get(o.key)??o.size,a=r-l;a!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",a),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,i)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(i))});return}this._measureElement(n,void 0)},this.getVirtualItems=Ue(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let o=0,l=n.length;o<l;o++){const a=n[o],u=r[a];i.push(u)}return i},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return On(r[Os(0,r.length-1,i=>On(r[i]).start,n)])},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 n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),l=this.getScrollOffset();r==="auto"&&(r=n>=l+o?"end":"start"),r==="center"?n+=(i-o)/2:r==="end"&&(n-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getSize(),o=this.getScrollOffset(),l=this.measurementsCache[n];if(!l)return;if(r==="auto")if(l.end>=o+i-this.options.scrollPaddingEnd)r="end";else if(l.start<=o+this.options.scrollPaddingStart)r="start";else return[o,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,l.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:i="auto"}={})=>{const o=this.getOffsetForAlignment(n,r),l=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:i="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getOffsetForIndex(n,r);if(!o)return;const[l,a]=o,u=this.now();this.scrollState={index:n,align:a,behavior:i,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+n,o=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((n=r[r.length-1])==null?void 0:n.end)??0;else{const o=Array(this.options.lanes).fill(null);let l=r.length-1;for(;l>=0&&o.some(a=>a===null);){const a=r[l];o[a.lane]===null&&(o[a.lane]=a.end),l--}i=Math.max(...o.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}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 r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,o=1,l=i!==this.scrollState.lastTargetOffset;if(!l&&yo(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,l&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Os=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,o=n(i);if(o<r)e=i+1;else if(o>r)t=i-1;else return i}return e>0?e-1:0};function Do({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const i=e.length-1,o=u=>e[u].start;if(e.length<=r)return{startIndex:0,endIndex:i};let l=Os(0,i,o,n),a=l;if(r===1)for(;a<i&&e[a].end<n+t;)a++;else if(r>1){const u=Array(r).fill(0);for(;a<i&&u.some(d=>d<n+t);){const d=e[a];u[d.lane]=d.end,a++}const f=Array(r).fill(n+t);for(;l>=0&&f.some(d=>d>=n);){const d=e[l];f[d.lane]=d.start,l--}l=Math.max(0,l-l%r),a=Math.min(i,a+(r-1-a%r))}return{startIndex:l,endIndex:a}}const zn=typeof document<"u"?vt.useLayoutEffect:vt.useEffect;function ko({useFlushSync:e=!0,...t}){const n=vt.useReducer(()=>({}),{})[1],r={...t,onChange:(o,l)=>{var a;e&&l?We.flushSync(n):n(),(a=t.onChange)==null||a.call(t,o,l)}},[i]=vt.useState(()=>new Mo(r));return i.setOptions(r),zn(()=>i._didMount(),[]),zn(()=>i._willUpdate()),i}function Io(e){return ko({observeElementRect:Ro,observeElementOffset:wo,scrollToFn:Co,...e})}function an(e){return"type"in e&&e.type==="group"}function Vn(e){return e==null?!1:typeof e=="string"?e.trim().length>0:typeof e=="number"||typeof e=="boolean"}function Tt(e){return String(e?.identifier??e?.key??e?.id??"")}function Ft(e){return typeof e?.summary=="string"?e.summary:typeof e?.title=="string"?e.title:typeof e?.name=="string"?e.name:""}function No(e){return typeof e?.priority=="string"?e.priority:""}function Ao(e){return typeof e?.assignee=="string"?e.assignee:typeof e?.assignee?.name=="string"?e.assignee.name:""}function Ts(e){return String(e?.entryType??e?.issueType??e?.type??"")}function ln(e,t){const n=new Set;return e.forEach(r=>{const i=r?.[t];i==null||i===""||n.add(String(i))}),Array.from(n).sort((r,i)=>r.localeCompare(i,void 0,{numeric:!0,sensitivity:"base"}))}function cn(e,t){if(!t)return e;if(an(t))return e.filter(a=>Fo(a,t));const n=t,r=String(n.query??"").trim().toLowerCase(),i=n.status??[],o=n.priority??[],l=n.assignee??[];return!r&&i.length===0&&o.length===0&&l.length===0?e:e.filter(a=>{const u=String(a?.status??""),f=String(a?.priority??""),d=String(a?.assignee??"");if(i.length>0&&!i.includes(u)||o.length>0&&!o.includes(f)||l.length>0&&!l.includes(d))return!1;if(!r)return!0;const x=Tt(a).toLowerCase(),h=Ft(a).toLowerCase();return x.includes(r)||h.includes(r)})}function Oo(e,t){if(t==="id")return Tt(e);if(t==="summary")return Ft(e);if(t==="type"||t==="entryType"||t==="issueType")return Ts(e);const n=e?.[t];if(n!=null)return String(n)}function To(e,t){const n=Oo(e,t.field),r=String(n??"").toLowerCase(),i=String(t.value??"").toLowerCase();switch(t.operator){case"is":return r===i;case"is_not":return r!==i;case"contains":return r.includes(i);case"is_empty":return!n;case"is_not_empty":return!!n;default:return!0}}function Fs(e,t){if(t.type==="rule")return To(e,t);if(t.children.length===0)return!0;const n=t.children.map(r=>Fs(e,r));return t.conjunction==="AND"?n.every(Boolean):n.some(Boolean)}function Fo(e,t){return Fs(e,t)}function Ye(){return{type:"group",conjunction:"AND",children:[{type:"rule",field:"summary",operator:"contains",value:""}]}}function un(e){if(!e)return 0;if(!an(e))return(e.status?.length??0)+(e.priority?.length??0)+(e.assignee?.length??0)+(e.query?1:0);const t=n=>n.type==="rule"?1:n.children.reduce((r,i)=>r+t(i),0);return t(e)}const Te=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"type",label:"Type"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],Pn=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"type",label:"Type"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}];function Qe(e){if(!e||e.length===0)return Pn;const t=(...n)=>{for(const r of n){const i=e.find(o=>o.id===r);if(i?.discreteValues&&i.discreteValues.length>0)return i.discreteValues.map(o=>typeof o=="string"?{value:o}:{value:o.value,label:o.label})}};return Pn.map(n=>{let r=t(n.value);return!r&&n.value==="status"&&(r=t("state")),!r&&n.value==="type"&&(r=t("entryType","issueType")),r?{...n,options:r}:n})}const Je=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}];function dn(e){if(!e)return!1;if(!an(e))return Vn(e.query)||(e.status?.length??0)>0||(e.priority?.length??0)>0||(e.assignee?.length??0)>0;const t=n=>n.type==="group"?n.children.some(r=>t(r)):n.operator==="is_empty"||n.operator==="is_not_empty"?!0:Vn(n.value);return t(e)}function Lt(e,t,n="updated"){const r=[...e],i={high:3,medium:2,low:1},o={backlog:1,open:2,"in progress":3,done:4},l=(u,f)=>f==="updated"?u?.updatedAt??u?.updated??u?.id:f==="type"||f==="entryType"||f==="issueType"?Ts(u):u?.[f],a=(u,f,d)=>{if(d==="priority"){const g=i[String(u?.priority??"").toLowerCase()]??0;return(i[String(f?.priority??"").toLowerCase()]??0)-g}if(d==="status"){const g=o[String(u?.status??"").toLowerCase()]??0;return(o[String(f?.status??"").toLowerCase()]??0)-g}const x=l(u,d),h=l(f,d),p=Number(x),v=Number(h);return!Number.isNaN(p)&&!Number.isNaN(v)?v-p:String(h??"").localeCompare(String(x??""),void 0,{numeric:!0,sensitivity:"base"})};return r.sort((u,f)=>{if(t&&t.length>0){for(const h of t){const p=a(u,f,h.property);if(p!==0)return h.direction==="desc"?p:-p}return 0}const d=typeof u?.position=="number"?u.position:0,x=typeof f?.position=="number"?f.position:0;return d!==x?x-d:a(u,f,n)}),r}function fn(e,t){if(!t)return e;const n=t.status??[],r=t.assignee??[],i=String(t.requiredAssignee??""),o=String(t.search??"").trim().toLowerCase();return n.length===0&&r.length===0&&!i&&!o?e:e.filter(l=>{const a=String(l?.status??""),u=String(l?.assignee??"");if(n.length>0&&!n.includes(a)||r.length>0&&!r.includes(u)||i&&u!==i)return!1;if(!o)return!0;const f=Tt(l).toLowerCase(),d=Ft(l).toLowerCase();return f.includes(o)||d.includes(o)})}const Lo=[{value:"low",label:"Low",icon:s.jsxRuntimeExports.jsx(s.MtLowIcon,{})},{value:"medium",label:"Medium",icon:s.jsxRuntimeExports.jsx(s.MtMediumIcon,{})},{value:"high",label:"High",icon:s.jsxRuntimeExports.jsx(s.MtHighIcon,{})}],zo=[{value:"backlog",label:"Backlog",icon:s.jsxRuntimeExports.jsx(s.MtBacklogIcon,{})},{value:"open",label:"Open",icon:s.jsxRuntimeExports.jsx(s.MtOpenIcon,{})},{value:"in progress",label:"In Progress",icon:s.jsxRuntimeExports.jsx(s.MtInProgressIcon,{})},{value:"done",label:"Done",icon:s.jsxRuntimeExports.jsx(s.MtCheckIcon,{})},{value:"abandoned",label:"Abandoned",icon:s.jsxRuntimeExports.jsx(er,{size:14,stroke:"#9CA3AF"})},{value:"duplicate",label:"Duplicate",icon:s.jsxRuntimeExports.jsx(sr,{size:14,stroke:"#9CA3AF"})}];function Vo(e){return typeof e=="object"&&e!==null&&"value"in e}function Bn(e){return e.split(" ").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function xn(e,t){if(!e||e.length===0)return t;const n=new Map(t.map(r=>[r.value,r]));return e.map(r=>Vo(r)?{value:r.value,label:r.label??Bn(r.value),icon:r.icon?s.jsxRuntimeExports.jsx(s.MtIconPreview,{name:r.icon,size:14,color:r.color}):void 0}:n.get(r)??{value:r,label:Bn(r)})}function Po({value:e,onChange:t,options:n}){return s.jsxRuntimeExports.jsx(s.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:e,onValueChange:t,options:xn(n,Lo)})}const Ls=Po;function zs({value:e,onChange:t,options:n}){return s.jsxRuntimeExports.jsx(s.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:e,onValueChange:t,options:xn(n,zo)})}function Vs({value:e,onChange:t,options:n}){return s.jsxRuntimeExports.jsx(s.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:e,onValueChange:t,options:xn(n,[])})}function Ps({assignee:e,options:t,onChange:n}){return s.jsxRuntimeExports.jsxs(s.MtSelect,{kind:"icon",variant:"ghost",value:e,placeholder:"?",onValueChange:r=>n(r==="__unassigned__"?void 0:r),children:[s.jsxRuntimeExports.jsx(s.MtSelectItem,{value:"__unassigned__",children:"Unassigned"}),t.map(r=>s.jsxRuntimeExports.jsx(s.MtSelectItem,{value:r.value,icon:s.jsxRuntimeExports.jsx(s.MtAvatar,{name:r.label,size:"xs"}),children:r.label},r.value))]})}function Bo({expanded:e}){return s.jsxRuntimeExports.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`transition-transform duration-150 ${e?"rotate-90":""}`,"aria-hidden":"true",children:s.jsxRuntimeExports.jsx("path",{d:"M3 2.25L7 5L3 7.75V2.25Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.6"})})}function Wt({entry:e,visiblePropertySet:t,properties:n,statusOptions:r,priorityOptions:i,issueTypeOptions:o,onSummaryChange:l,onPriorityChange:a,onStatusChange:u,onIssueTypeChange:f,assigneeOptions:d,onAssigneeChange:x,onPropertyChange:h,depth:p=0,subtasksEnabled:v=!1,hasSubtasks:g=!1,subtaskCount:j=0,isExpanded:m=!1,onToggleExpand:R,onAddSubtask:z,dragHandleProps:k}){const P=e?.id?String(e.id):"",L=String(e?._id??e?.id??""),D=e?.name?String(e.name):e?.title?String(e.title):"",E=e?.status?String(e.status):e?.state?String(e.state):"",I=e?.priority?String(e.priority):void 0,V=e?.assignee?String(e.assignee):"",A=e?.summary?String(e.summary):"",$=String(e?.entryType??e?.issueType??e?.type??"").toLowerCase(),W=typeof e?.commentCount=="number"?e.commentCount:0,Y=!!(e?.descriptionPageId||e?.description),{selectedIds:K,toggleSelected:X,onEntryClick:q}=Ne(),H=L?K.has(L):!1,[w,B]=c.useState(A),[N,S]=c.useState(I),[F,T]=c.useState(E),[te,C]=c.useState($),[U,Q]=c.useState(V||void 0),[y,b]=c.useState(!1),[J,ee]=c.useState(!1),[Z,ne]=c.useState(A),ce=c.useRef(null),oe=c.useRef(null);c.useEffect(()=>{B(A),S(I),T(E),C($),Q(V||void 0),ne(A)},[A,I,E,$,V]),c.useEffect(()=>{J&&ce.current?.focus()},[J]);const re=c.useCallback(()=>{ee(!1),Z!==A&&(B(Z),l?.(Z))},[Z,A,l]),Se=c.useCallback(()=>{ne(w),ee(!0)},[w]),ae=t.has("id"),M=t.has("name")||t.has("title"),_=t.has("status")||t.has("state"),G=t.has("type")||t.has("entryType")||t.has("issueType"),le=t.has("priority"),Be=t.has("assignee"),xt=c.useMemo(()=>{if(!n||n.length===0)return[];const O=new Set(["id","name","title","status","state","type","entryType","issueType","priority","assignee","summary"]);return n.filter(ie=>t.has(ie.id)&&!O.has(ie.id))},[n,t]),zt=c.useCallback((O,ie)=>{if(ie==null||ie==="")return"—";if((O==="startDate"||O==="dueDate")&&typeof ie=="number"){const je=new Date(ie);if(!Number.isNaN(je.getTime()))return je.toLocaleDateString()}return String(ie)},[]),Fe=c.useCallback(O=>{if(typeof O!="number"||!Number.isFinite(O))return"";const ie=new Date(O);if(Number.isNaN(ie.getTime()))return"";const je=ie.getFullYear(),xe=String(ie.getMonth()+1).padStart(2,"0"),De=String(ie.getDate()).padStart(2,"0");return`${je}-${xe}-${De}`},[]);return s.jsxRuntimeExports.jsxs("div",{ref:oe,className:"group relative flex items-center gap-2 px-4 border-b border-[#2A2A2A] h-[44px] bg-[#141414] text-sm cursor-pointer hover:bg-[#1a1a1a] transition-colors",style:{paddingLeft:p>0?`${p*20+16}px`:void 0},tabIndex:0,onClick:()=>q?.(e),onMouseMove:O=>{if(!k)return;const ie=O.currentTarget.getBoundingClientRect(),je=O.clientX-ie.left<=28;b(xe=>xe===je?xe:je)},onMouseLeave:()=>{k&&b(!1)},children:[s.jsxRuntimeExports.jsx("div",{role:"checkbox","aria-checked":H,tabIndex:-1,onClick:O=>{O.stopPropagation(),L&&X(L)},onKeyDown:O=>(O.key===" "||O.key==="Enter")&&L&&X(L),className:`shrink-0 ${H?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity cursor-pointer`,children:s.jsxRuntimeExports.jsx(s.MtCheckbox,{checked:H,readOnly:!0})}),k?s.jsxRuntimeExports.jsx("button",{type:"button",ref:k.ref,className:`absolute left-1 shrink-0 text-text-muted hover:text-text-primary cursor-grab active:cursor-grabbing transition-opacity ${y?"opacity-100":"opacity-0 pointer-events-none"}`,"aria-label":"Drag to reorder",tabIndex:y?0:-1,...k.attributes,...k.listeners,children:s.jsxRuntimeExports.jsx(cr,{size:14})}):null,v?s.jsxRuntimeExports.jsx("button",{type:"button",onClick:O=>{O.stopPropagation(),R?.()},className:"shrink-0 flex items-center justify-center w-4 h-4 text-text-muted hover:text-text-primary transition-opacity opacity-0 group-hover:opacity-100 data-[has-subtasks=true]:opacity-100","data-has-subtasks":g||void 0,tabIndex:-1,"aria-label":m?"Collapse subtasks":"Expand subtasks",children:s.jsxRuntimeExports.jsx(Bo,{expanded:m})}):null,le?s.jsxRuntimeExports.jsx("div",{onClick:O=>O.stopPropagation(),children:s.jsxRuntimeExports.jsx(Ls,{value:N,options:i,onChange:O=>{S(O),a?.(O)}})}):null,G?s.jsxRuntimeExports.jsx("div",{onClick:O=>O.stopPropagation(),children:s.jsxRuntimeExports.jsx(Vs,{value:te,options:o,onChange:O=>{C(O),f?.(O)}})}):null,ae?s.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-1 text-text-primary min-w-0",children:s.jsxRuntimeExports.jsx("span",{className:"truncate text-text-muted text-xs",children:P})}):null,_?s.jsxRuntimeExports.jsx("div",{onClick:O=>O.stopPropagation(),children:s.jsxRuntimeExports.jsx(zs,{value:F,options:r,onChange:O=>{T(O),u?.(O)}})}):null,M?s.jsxRuntimeExports.jsx("span",{className:"text-text-primary truncate max-w-40",children:D||"—"}):null,s.jsxRuntimeExports.jsx("div",{className:"min-w-0",onClick:O=>O.stopPropagation(),children:J?s.jsxRuntimeExports.jsx("input",{ref:ce,value:Z,onChange:O=>ne(O.target.value),onBlur:re,onKeyDown:O=>{O.key==="Enter"&&re(),O.key==="Escape"&&(ne(A),ee(!1)),O.stopPropagation()},className:"w-full rounded border border-[#2A2A2A] bg-transparent px-1 py-0.5 text-sm text-text-primary outline-none focus:border-border-focus"}):s.jsxRuntimeExports.jsxs("div",{className:"group/summary flex items-center gap-1 min-w-0",children:[s.jsxRuntimeExports.jsx("span",{className:"text-sm text-text-primary truncate",children:w||"Untitled"}),s.jsxRuntimeExports.jsx("button",{type:"button",className:"shrink-0 text-text-muted hover:text-text-primary opacity-0 group-hover/summary:opacity-100 transition-opacity",onClick:O=>{O.stopPropagation(),Se()},"aria-label":"Rename",children:s.jsxRuntimeExports.jsx(Xn,{size:11})})]})}),v||Y||W>0?s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 shrink-0",onClick:O=>O.stopPropagation(),children:[v&&g?s.jsxRuntimeExports.jsxs(s.MtButton,{variant:"ghost",className:"shrink-0 px-2 text-text-muted hover:text-text-primary",onClick:R,"aria-label":m?"Collapse subtasks":"Expand subtasks",children:[s.jsxRuntimeExports.jsx(s.MtSubgraphIcon,{size:12}),s.jsxRuntimeExports.jsx("span",{className:"text-sm",children:j})]}):null,Y?s.jsxRuntimeExports.jsx("span",{className:"mx-1 flex items-center text-text-muted shrink-0",title:"Has description",children:s.jsxRuntimeExports.jsx(Hn,{size:12})}):null,W>0?s.jsxRuntimeExports.jsxs("span",{className:"mx-1 flex items-center gap-0.5 text-text-muted shrink-0",title:`${W} comment${W!==1?"s":""}`,children:[s.jsxRuntimeExports.jsx(s.MessageSquare,{size:12}),s.jsxRuntimeExports.jsx("span",{className:"text-[10px]",children:W})]}):null,v?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",className:"shrink-0 text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100",onClick:z,"aria-label":"Add subtask",children:s.jsxRuntimeExports.jsx(s.Plus,{size:12})}):null]}):null,xt.length>0||Be?s.jsxRuntimeExports.jsxs("div",{className:"ml-auto flex items-center gap-2 shrink-0",onClick:O=>O.stopPropagation(),children:[xt.map(O=>{const ie=O.id==="startDate"||O.id==="dueDate",je=O.id==="timeEstimate";return ie?s.jsxRuntimeExports.jsxs("label",{className:"flex items-center gap-1 text-xs text-text-muted",children:[s.jsxRuntimeExports.jsxs("span",{children:[O.label,":"]}),s.jsxRuntimeExports.jsx("input",{type:"date",value:Fe(e?.[O.id]),onChange:xe=>{const De=xe.target.value,_e=De?new Date(`${De}T00:00:00`).getTime():void 0;h?.(O.id,_e)},className:"w-32 rounded border border-[#2A2A2A] bg-transparent px-1 py-0.5 text-xs text-text-primary outline-none"})]},O.id):je?s.jsxRuntimeExports.jsxs("label",{className:"flex items-center gap-1 text-xs text-text-muted",children:[s.jsxRuntimeExports.jsxs("span",{children:[O.label,":"]}),s.jsxRuntimeExports.jsx("input",{type:"number",min:0,step:1,value:typeof e?.[O.id]=="number"?String(e[O.id]):"",onChange:xe=>{const De=xe.target.value,_e=De===""?void 0:Number(De);h?.(O.id,Number.isFinite(_e)?_e:void 0)},className:"w-20 rounded border border-[#2A2A2A] bg-transparent px-1 py-0.5 text-xs text-text-primary outline-none"})]},O.id):s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 text-xs text-text-muted",children:[s.jsxRuntimeExports.jsxs("span",{children:[O.label,":"]}),s.jsxRuntimeExports.jsx("span",{className:"text-text-primary",children:zt(O.id,e?.[O.id])})]},O.id)}),Be?s.jsxRuntimeExports.jsx("div",{className:"shrink-0",children:d&&d.length>0?s.jsxRuntimeExports.jsx(Ps,{assignee:U,options:d,onChange:O=>{Q(O),x?.(O)}}):s.jsxRuntimeExports.jsx(s.MtAvatar,{name:V,size:"xs"})}):null]}):null]})}const _o=["summary"];function $o(e,t){const n=typeof e?.position=="number"?e.position:0,r=typeof t?.position=="number"?t.position:0;return!e&&!t?0:e?t?(n+r)/2:n-1:r+1}function at(e){return Array.from(new Set([...e,..._o]))}function Bs(e){const t=[...e],n=r=>t.some(i=>i.id===r);return n("summary")||t.unshift({id:"summary",label:"Summary"}),!n("type")&&!n("entryType")&&!n("issueType")&&t.push({id:"type",label:"Type"}),t}function _n(e){return(e??[]).map(t=>typeof t=="string"?t:t.value)}function Uo({label:e,count:t}){return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between px-6 border-b border-border-default h-[44px] bg-[#111111] text-sm",children:[s.jsxRuntimeExports.jsx("span",{className:"text-text-primary",children:e}),s.jsxRuntimeExports.jsx("span",{className:"text-text-muted",children:t})]})}const Wo=44;function qo(e,t,n,r){if(!n){if(!t)return e.map(h=>({type:"entry",key:`entry-${h.id??h._id}`,entry:h,depth:0,hasSubtasks:!1,subtaskCount:0,isExpanded:!1}));const d=new Map;e.forEach(h=>{const p=h?.[t],v=p==null||p===""?"Ungrouped":String(p);d.has(v)||d.set(v,[]),d.get(v).push(h)});const x=[];return d.forEach((h,p)=>{x.push({type:"group",key:`group-${t}-${p}`,label:p,count:h.length}),h.forEach(v=>{x.push({type:"entry",key:`entry-${v.id??v._id}`,entry:v,depth:0,hasSubtasks:!1,subtaskCount:0,isExpanded:!1})})}),x}const i=new Set(e.map(d=>String(d._id??d.id??""))),o=new Map;for(const d of e)if(d.parentId){const x=String(d.parentId);o.has(x)||o.set(x,[]),o.get(x).push(d)}const l=e.filter(d=>!d.parentId||!i.has(String(d.parentId)));function a(d,x,h){const p=String(x._id??x.id??""),v=o.get(p)??[],g=v.length>0,j=r.has(p);if(d.push({type:"entry",key:`entry-${x.id??x._id}`,entry:x,depth:h,hasSubtasks:g,subtaskCount:v.length,isExpanded:j}),j){for(const m of v)a(d,m,h+1);d.push({type:"add-subtask",key:`add-subtask-${p}`,parentEntry:x,depth:h+1})}}if(!t){const d=[];for(const x of l)a(d,x,0);return d}const u=new Map;l.forEach(d=>{const x=d?.[t],h=x==null||x===""?"Ungrouped":String(x);u.has(h)||u.set(h,[]),u.get(h).push(d)});const f=[];return u.forEach((d,x)=>{f.push({type:"group",key:`group-${t}-${x}`,label:x,count:d.length});for(const h of d)a(f,h,0)}),f}function Ko(e,t,n,r){if(e.length===0||t.length===0)return e;const i=new Map(t.map(u=>[String(u?._id??u?.id??""),u])),o=new Set,l=u=>{const f=String(u?._id??u?.id??"");f&&o.add(f)};return e.forEach(u=>{l(u);const f=new Set;let d=u?.parentId?String(u.parentId):"";for(;d&&!f.has(d);){f.add(d);const x=i.get(d);if(!x)break;l(x),d=x?.parentId?String(x.parentId):""}}),Lt(t,n,r).filter(u=>o.has(String(u?._id??u?.id??"")))}function $n({position:e,indent:t=0}){return s.jsxRuntimeExports.jsx("div",{className:`absolute right-0 h-0.5 bg-blue-500 pointer-events-none z-10 ${e==="before"?"top-0":"bottom-0"}`,style:{left:t>0?`${t}px`:0},children:t>0&&s.jsxRuntimeExports.jsx("div",{className:"absolute -left-1 top-1/2 -translate-y-1/2 w-2 h-2 rounded-full bg-blue-500"})})}function Xo({id:e,top:t,depth:n,dropTarget:r,activeDragId:i,children:o}){const{attributes:l,listeners:a,setNodeRef:u,setActivatorNodeRef:f,isDragging:d}=bs({id:e}),{setNodeRef:x}=rn({id:e}),h=c.useCallback(R=>{u(R),x(R)},[u,x]),p=r?.entryId===e&&i!==e,v=p&&r.position==="before",g=p&&r.position==="after",j=p&&r.position==="child",m=j?(n+1)*20+16:n*20+16;return s.jsxRuntimeExports.jsxs("div",{ref:h,className:"absolute left-0 w-full",style:{top:t,transition:d?"none":"top 200ms ease, opacity 150ms ease",opacity:d?.3:1,zIndex:d?-1:void 0},children:[v&&s.jsxRuntimeExports.jsx($n,{position:"before",indent:m}),s.jsxRuntimeExports.jsx("div",{className:`transition-shadow duration-150 ${j?"ring-2 ring-blue-500 ring-inset rounded-sm":""}`,children:o({ref:f,attributes:l,listeners:a})}),g&&s.jsxRuntimeExports.jsx($n,{position:"after",indent:m})]})}const hn=e=>{const t=c.useMemo(()=>e.properties&&e.properties.length>0?e.properties:[{id:"id",label:"ID"}],[e.properties]),n=c.useMemo(()=>_n(t.find(y=>y.id==="status"||y.id==="state")?.discreteValues),[t]),r=c.useMemo(()=>_n(t.find(y=>y.id==="priority")?.discreteValues),[t]),i=c.useMemo(()=>t.find(y=>["type","entryType","issueType"].includes(y.id))?.discreteValues,[t]),[o,l]=c.useState({}),[a,u]=c.useState(new Set),[f,d]=c.useState([]),[x,h]=c.useState(null),[p,v]=c.useState(null),g=c.useRef(null),j=c.useRef(null),m=!!e.subtasksEnabled,R=c.useMemo(()=>e.entries.map(y=>{const b=String(y?.id??""),J=o[b];return J?{...y,...J}:y}),[e.entries,o]),z=c.useMemo(()=>at(e.viewSettings?.visiblePropertyIds??t.map(y=>y.id)),[e.viewSettings?.visiblePropertyIds,t]),k=c.useMemo(()=>new Set(z),[z]),P=c.useMemo(()=>e.assigneeOptions&&e.assigneeOptions.length>0?e.assigneeOptions:ln(R,"assignee").map(y=>({value:y,label:y})),[R,e.assigneeOptions]),L=e.renderEntry,D=c.useRef(null),E=c.useMemo(()=>e.viewSettings?.filter??{},[e.viewSettings?.filter]),I=c.useMemo(()=>e.viewSettings?.quickFilters??{},[e.viewSettings?.quickFilters]),V=c.useMemo(()=>e.viewSettings?.sortRules??[],[e.viewSettings?.sortRules]),A=typeof e.viewSettings?.sortBy=="string"?e.viewSettings.sortBy:"updated",$=c.useMemo(()=>cn(R,E),[R,E]),W=c.useMemo(()=>fn($,I),[$,I]),Y=c.useMemo(()=>Lt(W,V,A),[W,V,A]),K=c.useMemo(()=>m?Ko(Y,R,V,A):Y,[R,A,V,Y,m]),X=V.length>0,q=Zt(Jt(dt,{activationConstraint:{distance:6}})),H=s.useMtToast(),w=c.useRef(X);c.useEffect(()=>{const y=K.map(J=>String(J?.id??"")),b=w.current;w.current=X,d(J=>{if(X||b)return y;const ee=J.filter(ne=>y.includes(ne)),Z=y.filter(ne=>!ee.includes(ne));return[...ee,...Z]})},[K,X]);const B=c.useMemo(()=>new Map(K.map(y=>[String(y?.id??""),y])),[K]),N=c.useMemo(()=>f.map(y=>B.get(y)).filter(y=>!!y),[B,f]),S=c.useMemo(()=>qo(N,e.groupBy,m,a),[N,e.groupBy,m,a]),F=c.useCallback(y=>{u(b=>{const J=new Set(b);return J.has(y)?J.delete(y):J.add(y),J})},[]),T=c.useCallback((y,b)=>{const J=String(y?.id??"");l(ee=>({...ee,[J]:{...ee[J]??{},...b}})),e.onUpdateEntry&&e.onUpdateEntry(y,b)},[e]),te=c.useCallback(y=>{j.current!==null&&cancelAnimationFrame(j.current),j.current=requestAnimationFrame(()=>{j.current=null;const{over:b,active:J}=y;if(!b||String(b.id)===String(J.id)){g.current!==null&&(g.current=null,v(null));return}const ee=String(b.id),Z=b.rect,ne=J.rect.current.translated;if(!ne)return;const ce=ne.top+ne.height/2,oe=Math.max(0,Math.min(1,(ce-Z.top)/Z.height));let re;m?oe<.25?re="before":oe>.75?re="after":re="child":re=oe<.5?"before":"after";const Se=g.current;if(Se?.entryId!==ee||Se?.position!==re){const ae={entryId:ee,position:re};g.current=ae,v(ae)}})},[m]),C=c.useCallback(y=>{const b=String(y.active.id??""),J=g.current;if(!J||!b||b===J.entryId){g.current=null,v(null);return}const{entryId:ee,position:Z}=J;if(Z==="child"&&m){const ne=B.get(b),ce=B.get(ee);if(ne&&ce){const oe=String(ce._id??ce.id??"");T(ne,{parentId:oe}),u(re=>new Set([...re,oe]))}}else{if(X){H?.toast("Manual sorting is not available when a sort rule is applied"),g.current=null,v(null);return}const ne=f.filter(M=>M!==b),ce=ne.indexOf(ee),oe=Z==="before"?ce:ce+1,re=[...ne];re.splice(oe,0,b);const Se=re.some(M=>typeof B.get(M)?.position!="number"),ae=B.get(b);if(Se){const M=re.length;re.forEach((_,G)=>{const le=B.get(_);le&&T(le,{position:(M-G)*1e3})})}else{const M=oe>0?re[oe-1]:void 0,_=oe<re.length-1?re[oe+1]:void 0,G=M?B.get(M):void 0,le=_?B.get(_):void 0,Be=$o(G,le);ae&&T(ae,{position:Be})}if(d(re),e.groupBy){const M=B.get(ee);if(ae&&M){const _=ae?.[e.groupBy],G=M?.[e.groupBy];_!==G&&T(ae,{[e.groupBy]:G??null})}}if(m){const M=B.get(ee);if(ae&&M){const _=ae?.parentId?String(ae.parentId):null,G=M?.parentId?String(M.parentId):null;_!==G&&T(ae,{parentId:G})}}}g.current=null,v(null)},[T,B,X,f,e.groupBy,m,H]),U=Io({count:S.length,getScrollElement:()=>D.current,overscan:x?20:5,estimateSize:()=>Wo}),Q=c.useCallback(y=>y.type==="group"?s.jsxRuntimeExports.jsx(Uo,{label:y.label,count:y.count}):y.type==="add-subtask"?s.jsxRuntimeExports.jsx("div",{className:"flex items-center border-b border-[#2A2A2A] h-[44px] bg-[#141414] text-sm",style:{paddingLeft:`${y.depth*20+16}px`},children:s.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center gap-1 text-text-muted hover:text-text-primary transition-colors text-xs",onClick:()=>e.onAddSubtask?.(y.parentEntry),children:[s.jsxRuntimeExports.jsx(s.Plus,{size:12}),"Add subtask"]})}):L?s.jsxRuntimeExports.jsx(L,{entry:y.entry}):s.jsxRuntimeExports.jsx(Wt,{entry:y.entry,properties:t,visiblePropertySet:k,statusOptions:n,priorityOptions:r,issueTypeOptions:i,assigneeOptions:P,depth:y.depth,subtasksEnabled:m,hasSubtasks:y.hasSubtasks,subtaskCount:y.subtaskCount,isExpanded:y.isExpanded,onToggleExpand:()=>F(String(y.entry._id??y.entry.id??"")),onAddSubtask:()=>e.onAddSubtask?.(y.entry),onSummaryChange:b=>{T(y.entry,{summary:b})},onPriorityChange:b=>{T(y.entry,{priority:b})},onStatusChange:b=>{T(y.entry,{status:b,state:b})},onIssueTypeChange:b=>{T(y.entry,{type:b,entryType:b,issueType:b})},onPropertyChange:(b,J)=>{T(y.entry,{[b]:J})},onAssigneeChange:b=>{T(y.entry,{assignee:b})}}),[L,T,P,i,r,t,e,n,m,F,k]);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs(At,{sensors:q,collisionDetection:ns,measuring:{droppable:{strategy:Ke.Always}},onDragStart:y=>{h(String(y.active.id??""))},onDragMove:te,onDragCancel:()=>{h(null),g.current=null,v(null),j.current!==null&&(cancelAnimationFrame(j.current),j.current=null)},onDragEnd:y=>{C(y),h(null)},autoScroll:!0,children:[s.jsxRuntimeExports.jsx("div",{id:"scroll-container",ref:D,className:"h-full min-h-0 overflow-y-auto",children:s.jsxRuntimeExports.jsx("div",{className:"relative",style:{height:U.getTotalSize()},children:U.getVirtualItems().map(y=>{const b=S[y.index];if(!b)return null;if(b.type!=="entry")return s.jsxRuntimeExports.jsx("div",{className:"absolute left-0 w-full",style:{top:y.start,transition:"top 200ms ease"},children:Q(b)},b.key);const J=String(b.entry?.id??"");return s.jsxRuntimeExports.jsx(Xo,{id:J,top:y.start,depth:b.depth,dropTarget:p,activeDragId:x,children:ee=>L?s.jsxRuntimeExports.jsx(L,{entry:b.entry}):s.jsxRuntimeExports.jsx(Wt,{entry:b.entry,properties:t,visiblePropertySet:k,statusOptions:n,priorityOptions:r,issueTypeOptions:i,assigneeOptions:P,depth:b.depth,subtasksEnabled:m,hasSubtasks:b.hasSubtasks,subtaskCount:b.subtaskCount,isExpanded:b.isExpanded,dragHandleProps:ee,onToggleExpand:()=>F(String(b.entry._id??b.entry.id??"")),onAddSubtask:()=>e.onAddSubtask?.(b.entry),onSummaryChange:Z=>{T(b.entry,{summary:Z})},onPriorityChange:Z=>{T(b.entry,{priority:Z})},onStatusChange:Z=>{T(b.entry,{status:Z,state:Z})},onIssueTypeChange:Z=>{T(b.entry,{type:Z,entryType:Z,issueType:Z})},onPropertyChange:(Z,ne)=>{T(b.entry,{[Z]:ne})},onAssigneeChange:Z=>{T(b.entry,{assignee:Z})}})},b.key)})})}),s.jsxRuntimeExports.jsx(on,{dropAnimation:{duration:200,easing:"cubic-bezier(0.22, 1, 0.36, 1)"},children:x?(()=>{const y=B.get(x);return y?s.jsxRuntimeExports.jsx("div",{className:"opacity-90 pointer-events-none bg-[#141414] border border-[#2A2A2A] rounded shadow-lg",children:s.jsxRuntimeExports.jsx(Wt,{entry:y,properties:t,visiblePropertySet:k,statusOptions:n,priorityOptions:r,issueTypeOptions:i,assigneeOptions:P,depth:0,subtasksEnabled:!1})}):null})():null})]})})};function Ho({currentView:e,properties:t,viewSettings:n,setViewSettings:r,setCurrentView:i}){const o=n.filter??{},l=c.useMemo(()=>Qe(t),[t]),a=Bs(t),u=at(n.visiblePropertyIds??a.map(m=>m.id)),f=new Set(u),d=t.filter(m=>m.groupable),x=e.groupBy??null,h=x?t.find(m=>m.id===x)?.label??x:"None",p=n.sortRules??[],v=p.length>0?Te.find(m=>m.value===p[0].property)?.label??p[0].property:"None",g=un(o),j="type"in o&&o.type==="group"?o:Ye();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs(me,{title:"View options",children:[s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(s.ListFilter,{size:14}),label:"Filter",submenu:"filter",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[g>0?`${g} active`:"None",s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})}),s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(Ct,{size:14}),label:"Properties",submenu:"properties",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[u.length,s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})}),s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(s.Layers,{size:14}),label:"Group",submenu:"group",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[h,s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})}),s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(s.ArrowUpDown,{size:14}),label:"Sort",submenu:"sort",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[v,s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})})]}),s.jsxRuntimeExports.jsx(we,{id:"filter",title:"Filter",children:s.jsxRuntimeExports.jsx(me,{children:s.jsxRuntimeExports.jsx("div",{className:"px-2",children:s.jsxRuntimeExports.jsx(s.MtFilterDropdown,{title:"Filter",value:j,onChange:m=>r({filter:m}),fields:l,operators:Je,variant:"ghost"})})})}),s.jsxRuntimeExports.jsx(we,{id:"properties",title:"Properties",children:s.jsxRuntimeExports.jsx(me,{title:"Visible columns",children:a.map(m=>s.jsxRuntimeExports.jsx(ue,{label:m.label,active:f.has(m.id),disabled:m.id==="summary",trailing:s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:f.has(m.id)?"Visible":"Hidden"}),onClick:()=>{if(m.id==="summary")return;const R=f.has(m.id),z=R?u.filter(k=>k!==m.id):[...u,m.id];r({visiblePropertyIds:at(z)}),R&&e.groupBy===m.id&&i({...e,groupBy:null})}},m.id))})}),s.jsxRuntimeExports.jsx(we,{id:"group",title:"Group",children:s.jsxRuntimeExports.jsxs(me,{title:"Group by",children:[s.jsxRuntimeExports.jsx(ue,{label:"None",active:x===null,onClick:()=>{i({...e,groupBy:null})}}),d.length>0?d.map(m=>s.jsxRuntimeExports.jsx(ue,{label:m.label,active:e.groupBy===m.id,onClick:()=>{i({...e,groupBy:m.id})}},m.id)):s.jsxRuntimeExports.jsx(ue,{label:"No groupable properties",disabled:!0})]})}),s.jsxRuntimeExports.jsx(we,{id:"sort",title:"Sort",children:s.jsxRuntimeExports.jsx(me,{children:s.jsxRuntimeExports.jsx("div",{className:"px-2",children:s.jsxRuntimeExports.jsx(s.MtSortDropdown,{title:"Sort",value:p,onChange:m=>r({sortRules:m}),fields:Te,variant:"ghost"})})})})]})}hn.SettingsMenu=Ho;function Go(){const e=Ne(),t=e.currentView,n=e.properties,r=c.useMemo(()=>Qe(n),[n]);if(!t)return null;const i=t.settings??{},o=i.sortRules??[],l=Bs(n),a=at(i.visiblePropertyIds??l.map(g=>g.id)),u=n.filter(g=>g.groupable),f=e.setCurrentView,d=g=>{f({...t,settings:{...t.settings??{},...g}})},x=i.filter&&typeof i.filter=="object"&&"type"in i.filter?i.filter:Ye(),h=!!t.groupBy,p=o.length>0,v=dn(i.filter);return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtDropdown,{title:s.jsxRuntimeExports.jsx(s.Layers,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:h?"accent":"ghost",showCaret:!1,children:s.jsxRuntimeExports.jsxs("div",{className:"w-56 p-1",children:[s.jsxRuntimeExports.jsx(s.MtDropdownItem,{onSelect:()=>f({...t,groupBy:null}),children:"None"}),u.map(g=>s.jsxRuntimeExports.jsx(s.MtDropdownItem,{onSelect:()=>f({...t,groupBy:g.id}),children:g.label},g.id))]})}),h?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>f({...t,groupBy:null}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtSortDropdown,{title:"Sort",kind:"icon",variant:p?"accent":"ghost",showCaret:!1,value:o,onChange:g=>d({sortRules:g}),fields:Te}),p?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>d({sortRules:[]}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtFilterDropdown,{title:"Filter",kind:"icon",variant:v?"accent":"ghost",showCaret:!1,value:x,onChange:g=>d({filter:g}),fields:r,operators:Je}),v?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>d({filter:void 0}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]}),s.jsxRuntimeExports.jsx(s.MtDropdown,{title:s.jsxRuntimeExports.jsx(Ct,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:"ghost",showCaret:!1,children:s.jsxRuntimeExports.jsx("div",{className:"w-56 p-1",children:l.map(g=>{const j=a.includes(g.id),m=j?a.filter(R=>R!==g.id):[...a,g.id];return s.jsxRuntimeExports.jsx(s.MtDropdownItem,{disabled:g.id==="summary",onSelect:()=>{g.id!=="summary"&&d({visiblePropertyIds:at(m)})},children:s.jsxRuntimeExports.jsxs("span",{className:"flex items-center justify-between w-full",children:[s.jsxRuntimeExports.jsx("span",{children:g.label}),s.jsxRuntimeExports.jsx("span",{className:"text-text-muted text-xs",children:j?"Visible":"Hidden"})]})},g.id)})})})]})}hn.ToolbarActions=Go;function Yo({entry:e}){return s.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-[44px] bg-[#141414]",children:e.id})}const Qo=e=>{const t=e.renderEntry??Yo;return s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{children:"Grid Layout"}),e.entries.map(n=>s.jsxRuntimeExports.jsx(t,{entry:n},n.id))]})};function Jo({entry:e}){return s.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-[44px] bg-[#141414]",children:e.id})}const Zo=e=>{const t=e.renderEntry??Jo;return s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{children:"Table Layout"}),e.entries.map(n=>s.jsxRuntimeExports.jsx(t,{entry:n},n.id))]})};function Un(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const o=e[i]??[],l=t[i]??[];if(o.length!==l.length)return!1;for(let a=0;a<o.length;a+=1)if(o[a]!==l[a])return!1}return!0}function _s({columns:e,entriesByColumn:t,onCrossColumnMove:n,onPositionChange:r,disableSameColumnReorder:i,onReorderBlocked:o}){const[l,a]=c.useState({}),[u,f]=c.useState(null),d=c.useRef(null),x=c.useRef(null),h=c.useRef(!1),p=c.useRef(i),v=Zt(Jt(dt,{activationConstraint:{distance:6}}));c.useEffect(()=>{if(h.current)return;const D=p.current;p.current=!!i,a(E=>{const I={};return e.forEach(V=>{const A=(t.get(V.key)??[]).map($=>String($?.id??""));if(i||D)I[V.key]=A;else{const W=(E[V.key]??[]).filter(K=>A.includes(K)),Y=A.filter(K=>!W.includes(K));I[V.key]=[...W,...Y]}}),Un(E,I)?E:I})},[e,i,t]);const g=c.useMemo(()=>{const D=new Map;return t.forEach(E=>{E.forEach(I=>D.set(String(I?.id??""),I))}),D},[t]),j=c.useMemo(()=>e.map(D=>{const E=(t.get(D.key)??[]).map(V=>String(V?.id??"")),I=l[D.key]??E;return{column:D,entryIds:I}}),[l,e,t]),m=c.useMemo(()=>{const D=new Map;return j.forEach(({column:E,entryIds:I})=>D.set(E.key,I)),D},[j]),R=c.useMemo(()=>{const D=new Map;return e.forEach(E=>{(l[E.key]??(t.get(E.key)??[]).map(V=>String(V?.id??""))).forEach(V=>D.set(V,E.key))}),D},[e,l,t]),z=c.useCallback(D=>{const E=String(D.active.id??"");f(E||null),h.current=!0;const I=E?R.get(E)??null:null;d.current=I,x.current=I},[R]),k=c.useCallback(D=>{const E=String(D.active.id??""),I=D.over?String(D.over.id??""):"";if(!E||!I)return;const V=R.get(E),A=I.startsWith("column:")?I.replace("column:",""):R.get(I);!V||!A||V===A||(a($=>{const W=[...$[V]??m.get(V)??[]],Y=[...$[A]??m.get(A)??[]],K=W.indexOf(E);if(K<0)return $;W.splice(K,1);const X=I.startsWith("column:")?Y.length:Y.indexOf(I),q=X<0?Y.length:X;Y.splice(q,0,E);const H={...$,[V]:W,[A]:Y};return Un($,H)?$:H}),x.current=A)},[m,R]),P=c.useCallback(D=>{const E=String(D.active.id??""),I=D.over?String(D.over.id??""):"";if(E&&I){const A=x.current??R.get(E),$=I.startsWith("column:")?I.replace("column:",""):R.get(I);if(A&&$){const W=d.current,Y=W===(x.current??$);A===$?i&&Y?o?.():a(X=>{const q=[...X[A]??m.get(A)??[]],H=q.indexOf(E),w=I.startsWith("column:")?q.length-1:q.indexOf(I);return H<0||w<0||H===w?X:{...X,[A]:Ot(q,H,w)}}):(a(X=>{const q=[...X[A]??m.get(A)??[]],H=[...X[$]??m.get($)??[]],w=q.indexOf(E);if(w<0)return X;q.splice(w,1);const B=I.startsWith("column:")?H.length:H.indexOf(I),N=B<0?H.length:B;return H.splice(N,0,E),{...X,[A]:q,[$]:H}}),x.current=$);const K=x.current??$;if(W&&K&&W!==K&&n){const X=g.get(E),q=e.find(H=>H.key===K);X&&q&&n(E,X,W,K,q)}r&&!(i&&Y)&&a(X=>{const q=x.current??$,H=q?X[q]??[]:[],w=H.indexOf(E);if(w>=0){const B=w>0?H[w-1]:void 0,N=w<H.length-1?H[w+1]:void 0,S=B?g.get(B):void 0,F=N?g.get(N):void 0,T=typeof S?.position=="number"?S.position:0,te=typeof F?.position=="number"?F.position:0;let C;!S&&!F?C=0:S?F?C=(T+te)/2:C=T-1:C=te+1;const U=g.get(E);U&&r(E,U,C)}return X})}}f(null);const V=d.current!==x.current;d.current=null,x.current=null,V?setTimeout(()=>{h.current=!1},500):h.current=!1},[e,m,i,g,R,n,r,o]),L=c.useCallback(()=>{f(null),h.current=!1,d.current=null,x.current=null},[]);return{activeDragId:u,entryById:g,orderedColumns:j,sensors:v,onDragStart:z,onDragOver:k,onDragEnd:P,onDragCancel:L}}const ea=["summary"];function Ht(e){return Array.from(new Set([...e,...ea]))}function ta(e){const t=[...e],n=r=>t.some(i=>i.id===r);return n("summary")||t.unshift({id:"summary",label:"Summary"}),!n("type")&&!n("entryType")&&!n("issueType")&&t.push({id:"type",label:"Type"}),t}function Gt(e){return(e??[]).map(t=>typeof t=="string"?t:t.value)}function St({entry:e,onSummaryChange:t,onPriorityChange:n,onStatusChange:r,onIssueTypeChange:i,onAssigneeChange:o,onClick:l,isDragPreview:a,visiblePropertySet:u,parentDisplayId:f,statusOptions:d,priorityOptions:x,issueTypeOptions:h,assigneeOptions:p}){const v=Tt(e),g=No(e),j=e?.status?String(e.status):e?.state?String(e.state):"",m=Ao(e),R=Ft(e),z=String(e?.entryType??e?.issueType??e?.type??"").toLowerCase(),k=typeof e?.commentCount=="number"?e.commentCount:0,P=!!(e?.descriptionPageId||e?.description),L=u.has("summary"),D=u.has("id"),E=u.has("status")||u.has("state"),I=u.has("type")||u.has("entryType")||u.has("issueType"),V=u.has("priority"),A=u.has("assignee"),$=D||I||E||V||A,[W,Y]=c.useState(!1),[K,X]=c.useState(R),q=c.useRef(null);c.useEffect(()=>{X(R)},[R]),c.useEffect(()=>{W&&q.current?.focus()},[W]);const H=c.useCallback(()=>{Y(!1),K!==R&&t?.(K)},[K,R,t]);return s.jsxRuntimeExports.jsxs("div",{className:"rounded border border-[#2A2A2A] bg-[#141414] p-3 text-sm cursor-pointer hover:border-[#3A3A3A] transition-colors",onClick:l,children:[f?s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 text-text-muted text-xs mb-1.5",children:[s.jsxRuntimeExports.jsx(ir,{size:11}),s.jsxRuntimeExports.jsx("span",{children:f})]}):null,L?W?s.jsxRuntimeExports.jsx("input",{ref:q,value:K,onChange:w=>X(w.target.value),onBlur:H,onKeyDown:w=>{w.key==="Enter"&&H(),w.key==="Escape"&&(X(R),Y(!1))},onClick:w=>w.stopPropagation(),className:"w-full rounded border border-[#2A2A2A] bg-transparent px-1 py-0.5 text-sm text-text-primary outline-none focus:border-border-focus"}):s.jsxRuntimeExports.jsxs("div",{className:"group/summary flex items-center gap-1 px-1 py-0.5 min-w-0",children:[s.jsxRuntimeExports.jsx("span",{className:"text-sm text-text-primary truncate",children:R||"Untitled"}),s.jsxRuntimeExports.jsx("button",{type:"button",className:"shrink-0 text-text-muted hover:text-text-primary opacity-0 group-hover/summary:opacity-100 transition-opacity",onClick:w=>{w.stopPropagation(),Y(!0)},"aria-label":"Rename",children:s.jsxRuntimeExports.jsx(Xn,{size:11})})]}):null,$?s.jsxRuntimeExports.jsxs("div",{className:"flex row justify-between items-center px-1",onClick:w=>w.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:"flex row gap-2 items-center min-w-0",children:[I?a?s.jsxRuntimeExports.jsx("div",{className:"text-xs text-text-muted truncate",children:z||"—"}):s.jsxRuntimeExports.jsx(Vs,{value:z,options:h,onChange:i??(()=>{})}):null,D?s.jsxRuntimeExports.jsx("span",{className:"text-xs text-text-muted",children:v}):null,E?a?s.jsxRuntimeExports.jsx("div",{className:"text-xs text-text-muted truncate",children:j||"—"}):s.jsxRuntimeExports.jsx(zs,{value:j,options:d,onChange:r??(()=>{})}):null]}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-primary",children:[P?s.jsxRuntimeExports.jsx("span",{className:"flex items-center text-text-muted",title:"Has description",children:s.jsxRuntimeExports.jsx(Hn,{size:11})}):null,k>0?s.jsxRuntimeExports.jsxs("span",{className:"flex items-center gap-0.5 text-text-muted",title:`${k} comment${k!==1?"s":""}`,children:[s.jsxRuntimeExports.jsx(s.MessageSquare,{size:11}),s.jsxRuntimeExports.jsx("span",{className:"text-[10px]",children:k})]}):null,V?a?s.jsxRuntimeExports.jsx("div",{className:"text-xs text-text-muted truncate",children:g||"—"}):s.jsxRuntimeExports.jsx(Ls,{value:g,options:x,onChange:n??(()=>{})}):null,A?!a&&p&&p.length>0?s.jsxRuntimeExports.jsx(Ps,{assignee:typeof m=="string"?m:void 0,options:p,onChange:o??(()=>{})}):s.jsxRuntimeExports.jsx(s.MtAvatar,{name:String(m??""),size:"xs"}):null]})]}):null]})}function na(e,t,n){if(!t)return[{key:"all",label:"All",entries:e}];const r=new Map;e.forEach(l=>{const a=l?.[t],u=a==null||a===""?"Ungrouped":String(a);r.has(u)||r.set(u,[]),r.get(u).push(l)});const i=n?.find(l=>l.id===t),o=Gt(i?.discreteValues);if(o.length>0){const l=o.map(a=>({key:`${t}-${a}`,label:a,entries:r.get(a)??[]}));return r.has("Ungrouped")&&l.push({key:`${t}-Ungrouped`,label:"Ungrouped",entries:r.get("Ungrouped")}),l}return Array.from(r.entries()).map(([l,a])=>({key:`${t}-${l}`,label:l,entries:a}))}function $s({id:e,children:t,onClick:n}){const{attributes:r,listeners:i,setNodeRef:o,transform:l,transition:a,isDragging:u}=Ms({id:e}),f={transform:l?Oe.Transform.toString(l):void 0,transition:a??"transform 180ms cubic-bezier(0.22, 1, 0.36, 1)"};return s.jsxRuntimeExports.jsx("div",{ref:o,style:f,...r,...i,onClick:n,className:`cursor-grab active:cursor-grabbing ${u?"opacity-40 z-10":""}`,children:t})}function Us({columnKey:e,label:t,trailing:n,entryIds:r,children:i}){const{setNodeRef:o,isOver:l}=rn({id:`column:${e}`});return s.jsxRuntimeExports.jsxs("div",{ref:o,className:`w-72 min-w-72 flex flex-col rounded border bg-[#111111] transition-[border-color] duration-200 ease-out ${l?"border-border-default":"border-[#2A2A2A]"}`,children:[s.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border-default px-3 py-2 text-sm",children:[s.jsxRuntimeExports.jsx("span",{className:"text-text-primary",children:t}),s.jsxRuntimeExports.jsx("span",{className:"text-text-muted",children:n??r.length})]}),s.jsxRuntimeExports.jsx(Ss,{items:r,strategy:so,children:s.jsxRuntimeExports.jsx("div",{className:"flex flex-1 flex-col gap-2 overflow-y-auto p-2",children:i})})]})}const pn=e=>{const t=e.renderEntry,{onEntryClick:n}=Ne(),r=c.useMemo(()=>e.properties&&e.properties.length>0?e.properties:[{id:"id",label:"ID"}],[e.properties]),i=c.useMemo(()=>Gt(r.find(N=>N.id==="status"||N.id==="state")?.discreteValues),[r]),o=c.useMemo(()=>Gt(r.find(N=>N.id==="priority")?.discreteValues),[r]),l=c.useMemo(()=>r.find(N=>["type","entryType","issueType"].includes(N.id))?.discreteValues,[r]),a=c.useMemo(()=>Ht(e.viewSettings?.visiblePropertyIds??r.map(N=>N.id)),[e.viewSettings?.visiblePropertyIds,r]),u=c.useMemo(()=>new Set(a),[a]),[f,d]=c.useState({}),x=c.useMemo(()=>new Map(e.entries.map(N=>[String(N._id??""),N])),[e.entries]),h=c.useMemo(()=>e.entries.map(N=>{const S=String(N?.id??""),F=f[S];return F?{...N,...F}:N}),[e.entries,f]),p=c.useMemo(()=>e.assigneeOptions&&e.assigneeOptions.length>0?e.assigneeOptions:ln(h,"assignee").map(N=>({value:N,label:N})),[h,e.assigneeOptions]),v=e.groupBy??"status",g=typeof e.viewSettings?.sortBy=="string"?e.viewSettings.sortBy:"updated",j=c.useMemo(()=>e.viewSettings?.quickFilters??{},[e.viewSettings?.quickFilters]),m=c.useMemo(()=>e.viewSettings?.sortRules??[],[e.viewSettings?.sortRules]),R=c.useMemo(()=>e.viewSettings?.filter??{},[e.viewSettings?.filter]),z=c.useMemo(()=>cn(h,R),[h,R]),k=c.useMemo(()=>fn(z,j),[z,j]),P=c.useMemo(()=>Lt(k,m,g),[k,m,g]),L=c.useMemo(()=>na(P,v,r),[v,r,P]),D=c.useMemo(()=>{const N=new Map;return L.forEach(S=>N.set(S.key,S.entries)),N},[L]),E=c.useCallback((N,S)=>{const F=String(N?.id??"");d(T=>({...T,[F]:{...T[F]??{},...S}})),e.onUpdateEntry&&e.onUpdateEntry(N,S)},[e.onUpdateEntry]),I=c.useCallback((N,S,F,T,te)=>{v&&E(S,{[v]:te.label==="Ungrouped"?null:te.label})},[v,E]),V=c.useCallback((N,S,F)=>{E(S,{position:F})},[E]),A=m.length>0,$=s.useMtToast(),{activeDragId:W,entryById:Y,orderedColumns:K,sensors:X,onDragStart:q,onDragOver:H,onDragEnd:w,onDragCancel:B}=_s({columns:L,entriesByColumn:D,onCrossColumnMove:I,onPositionChange:V,disableSameColumnReorder:A,onReorderBlocked:()=>{$?.toast("Manual sorting is not available when a sort rule is applied")}});return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs(At,{sensors:X,collisionDetection:ss,onDragStart:q,onDragOver:H,onDragCancel:B,onDragEnd:w,autoScroll:!0,children:[s.jsxRuntimeExports.jsx("div",{className:"h-full min-h-0 overflow-x-auto p-3",children:s.jsxRuntimeExports.jsx("div",{className:"flex h-full min-w-max gap-3",children:K.map(({column:N,entryIds:S})=>s.jsxRuntimeExports.jsx(Us,{columnKey:N.key,label:N.label,entryIds:S,children:S.map(F=>{const T=Y.get(F);return T?s.jsxRuntimeExports.jsx($s,{id:F,onClick:n?()=>n(T):void 0,children:t?s.jsxRuntimeExports.jsx(t,{entry:T}):s.jsxRuntimeExports.jsx(St,{entry:T,isDragPreview:!1,visiblePropertySet:u,statusOptions:i,priorityOptions:o,issueTypeOptions:l,assigneeOptions:p,parentDisplayId:T?.parentId?String(x.get(String(T.parentId))?.id??x.get(String(T.parentId))?._id??T.parentId):void 0,onSummaryChange:te=>{E(T,{summary:te})},onPriorityChange:te=>{E(T,{priority:te})},onStatusChange:te=>{E(T,{status:te,state:te})},onIssueTypeChange:te=>{E(T,{entryType:te,type:te,issueType:te})},onAssigneeChange:te=>{E(T,{assignee:te})}})},F):null})},N.key))})}),s.jsxRuntimeExports.jsx(on,{children:W?s.jsxRuntimeExports.jsx("div",{className:"w-72 opacity-95 pointer-events-none shadow-lg",children:(()=>{const N=Y.get(W);return N?s.jsxRuntimeExports.jsx(St,{entry:N,isDragPreview:!1,visiblePropertySet:u,statusOptions:i,priorityOptions:o,issueTypeOptions:l,assigneeOptions:p,parentDisplayId:N?.parentId?String(x.get(String(N.parentId))?.id??x.get(String(N.parentId))?._id??N.parentId):void 0}):null})()}):null})]})})};function sa({currentView:e,properties:t,viewSettings:n,setViewSettings:r,setCurrentView:i}){const o=t.filter(m=>m.groupable),l=c.useMemo(()=>Qe(t),[t]),a=ta(t),u=Ht(n.visiblePropertyIds??a.map(m=>m.id)),f=new Set(u),d=e.groupBy??"status",x=d?t.find(m=>m.id===d)?.label??d:"None",h=n.filter??{},p=un(h),v=n.sortRules??[],g=v.length>0?Te.find(m=>m.value===v[0].property)?.label??v[0].property:"None",j="type"in h&&h.type==="group"?h:Ye();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs(me,{title:"View options",children:[s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(s.ListFilter,{size:14}),label:"Filter",submenu:"filter",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[p>0?`${p} active`:"None",s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})}),s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(Ct,{size:14}),label:"Properties",submenu:"properties",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[u.length,s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})}),s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(s.Layers,{size:14}),label:"Group",submenu:"group",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[x,s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})}),s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(s.ArrowUpDown,{size:14}),label:"Sort",submenu:"sort",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[g,s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})})]}),s.jsxRuntimeExports.jsx(we,{id:"properties",title:"Properties",children:s.jsxRuntimeExports.jsx(me,{title:"Visible columns",children:a.map(m=>s.jsxRuntimeExports.jsx(ue,{label:m.label,active:f.has(m.id),disabled:m.id==="summary",trailing:s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:f.has(m.id)?"Visible":"Hidden"}),onClick:()=>{if(m.id==="summary")return;const R=f.has(m.id),z=R?u.filter(k=>k!==m.id):[...u,m.id];r({visiblePropertyIds:Ht(z)}),R&&e.groupBy===m.id&&i({...e,groupBy:null})}},m.id))})}),s.jsxRuntimeExports.jsx(we,{id:"filter",title:"Filter",children:s.jsxRuntimeExports.jsx(me,{children:s.jsxRuntimeExports.jsx("div",{className:"px-2",children:s.jsxRuntimeExports.jsx(s.MtFilterDropdown,{title:"Filter",value:j,onChange:m=>{i({...e,settings:{...e.settings??{},filter:m}})},fields:l,operators:Je,variant:"ghost"})})})}),s.jsxRuntimeExports.jsx(we,{id:"group",title:"Group",children:s.jsxRuntimeExports.jsx(me,{title:"Group by",children:o.length>0?o.map(m=>s.jsxRuntimeExports.jsx(ue,{label:m.label,active:e.groupBy===m.id,onClick:()=>{i({...e,groupBy:m.id})}},m.id)):s.jsxRuntimeExports.jsx(ue,{label:"No groupable properties",disabled:!0})})}),s.jsxRuntimeExports.jsx(we,{id:"sort",title:"Sort",children:s.jsxRuntimeExports.jsx(me,{children:s.jsxRuntimeExports.jsx("div",{className:"px-2",children:s.jsxRuntimeExports.jsx(s.MtSortDropdown,{title:"Sort",value:v,onChange:m=>{r({sortRules:m})},fields:Te,variant:"ghost"})})})})]})}pn.SettingsMenu=sa;function ra(){const e=Ne(),t=e.currentView,n=e.properties,r=c.useMemo(()=>Qe(n),[n]);if(!t)return null;const i=t.settings??{},o=i.sortRules??[],l=n.filter(p=>p.groupable),a=i.filter&&typeof i.filter=="object"&&"type"in i.filter?i.filter:Ye(),u=!!t.groupBy,f=o.length>0,d=dn(i.filter),x=e.setCurrentView,h=p=>{x({...t,settings:{...t.settings??{},...p}})};return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtDropdown,{title:s.jsxRuntimeExports.jsx(s.Layers,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:u?"accent":"ghost",showCaret:!1,children:s.jsxRuntimeExports.jsxs("div",{className:"w-56 p-1",children:[s.jsxRuntimeExports.jsx(s.MtDropdownItem,{onSelect:()=>x({...t,groupBy:null}),children:"None"}),l.map(p=>s.jsxRuntimeExports.jsx(s.MtDropdownItem,{onSelect:()=>x({...t,groupBy:p.id}),children:p.label},p.id))]})}),u?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>x({...t,groupBy:null}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtSortDropdown,{title:"Sort",kind:"icon",variant:f?"accent":"ghost",showCaret:!1,value:o,onChange:p=>h({sortRules:p}),fields:Te}),f?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>h({sortRules:[]}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtFilterDropdown,{title:"Filter",kind:"icon",variant:d?"accent":"ghost",showCaret:!1,value:a,onChange:p=>h({filter:p}),fields:r,operators:Je}),d?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>h({filter:void 0}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]})]})}pn.ToolbarActions=ra;function ia({entry:e}){return s.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-[44px] bg-[#141414]",children:e.id})}const oa=e=>{const t=e.renderEntry??ia;return s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{children:"Gantt Layout"}),e.entries.map(n=>s.jsxRuntimeExports.jsx(t,{entry:n},n.id))]})},aa=["summary"];function la(e){return Array.from(new Set([...e,...aa]))}function Wn(e){return(e??[]).map(t=>typeof t=="string"?t:t.value)}function ca(e){const t=new Date(e);t.setHours(0,0,0,0);const n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function qn(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function ua(e){const t=new Date(e);return t.setHours(23,59,59,999),t}function da(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),n=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-n);const r=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7)}function fa(e){const t=e?.startDate;if(typeof t=="number"&&Number.isFinite(t))return t}function xa(e){const t=Number(e?.timeEstimate??0);return Number.isFinite(t)?t:0}const mn=e=>{const{onEntryClick:t}=Ne(),[n,r]=c.useState({}),i=c.useMemo(()=>e.properties&&e.properties.length>0?e.properties:[{id:"id",label:"ID"}],[e.properties]),o=c.useMemo(()=>Wn(i.find(w=>w.id==="status"||w.id==="state")?.discreteValues),[i]),l=c.useMemo(()=>Wn(i.find(w=>w.id==="priority")?.discreteValues),[i]),a=c.useMemo(()=>i.find(w=>["type","entryType","issueType"].includes(w.id))?.discreteValues,[i]),u=c.useMemo(()=>la(e.viewSettings?.visiblePropertyIds??i.map(w=>w.id)),[e.viewSettings?.visiblePropertyIds,i]),f=c.useMemo(()=>new Set(u),[u]),d=c.useMemo(()=>e.entries.map(w=>{const B=String(w?.id??""),N=n[B];return N?{...w,...N}:w}),[e.entries,n]),x=c.useMemo(()=>e.assigneeOptions&&e.assigneeOptions.length>0?e.assigneeOptions:ln(d,"assignee").map(w=>({value:w,label:w})),[d,e.assigneeOptions]),h=c.useMemo(()=>new Map(d.map(w=>[String(w._id??""),w])),[d]),p=typeof e.viewSettings?.sortBy=="string"?e.viewSettings.sortBy:"updated",v=c.useMemo(()=>e.viewSettings?.sortRules??[],[e.viewSettings?.sortRules]),g=c.useMemo(()=>e.viewSettings?.filter??{},[e.viewSettings?.filter]),j=c.useMemo(()=>e.viewSettings?.quickFilters??{},[e.viewSettings?.quickFilters]),m=c.useMemo(()=>cn(d,g),[d,g]),R=c.useMemo(()=>fn(m,j),[m,j]),z=c.useMemo(()=>Lt(R,v,p),[R,v,p]),k=c.useMemo(()=>{const w=ca(new Date),B=Array.from({length:7},(N,S)=>{const F=qn(w,S*7),T=ua(qn(F,6)),te=da(F);return{key:`week-${S}`,label:`Week ${te}`,weekStartMs:F.getTime(),weekEndMs:T.getTime(),isCurrentWeek:S===0}});return[{key:"week-unscheduled",label:"Not planned / overdue"},...B]},[]),P=c.useMemo(()=>{const w=new Map;return k.forEach(B=>w.set(B.key,[])),z.forEach(B=>{const N=fa(B);if(N===void 0){w.get("week-unscheduled")?.push(B);return}const S=k.find(F=>F.weekStartMs!==void 0&&F.weekEndMs!==void 0&&N>=F.weekStartMs&&N<=F.weekEndMs);S?w.get(S.key)?.push(B):w.get("week-unscheduled")?.push(B)}),w},[k,z]),L=c.useCallback((w,B)=>{const N=String(w?.id??"");r(S=>({...S,[N]:{...S[N]??{},...B}})),e.onUpdateEntry&&e.onUpdateEntry(w,B)},[e.onUpdateEntry]),D=c.useCallback((w,B,N,S,F)=>{const T=F.weekStartMs!==void 0&&F.weekEndMs!==void 0?{startDate:F.weekStartMs,dueDate:F.weekEndMs}:{startDate:void 0,dueDate:void 0};L(B,T)},[L]),E=c.useCallback((w,B,N)=>{L(B,{position:N})},[L]),I=v.length>0,V=s.useMtToast(),{activeDragId:A,entryById:$,orderedColumns:W,sensors:Y,onDragStart:K,onDragOver:X,onDragEnd:q,onDragCancel:H}=_s({columns:k,entriesByColumn:P,onCrossColumnMove:D,onPositionChange:E,disableSameColumnReorder:I,onReorderBlocked:()=>{V?.toast("Manual sorting is not available when a sort rule is applied")}});return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs(At,{sensors:Y,collisionDetection:ss,onDragStart:K,onDragOver:X,onDragCancel:H,onDragEnd:q,autoScroll:!0,children:[s.jsxRuntimeExports.jsx("div",{className:"h-full min-h-0 overflow-x-auto p-3",children:s.jsxRuntimeExports.jsx("div",{className:"flex h-full min-w-max gap-3",children:W.map(({column:w,entryIds:B})=>{const N=B.reduce((S,F)=>S+xa($.get(F)),0);return s.jsxRuntimeExports.jsx(Us,{columnKey:w.key,label:s.jsxRuntimeExports.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsxRuntimeExports.jsx("span",{children:w.label}),w.isCurrentWeek?s.jsxRuntimeExports.jsx("span",{className:"rounded bg-[#1A2A1F] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[#82D29A]",children:"Current Week"}):null]}),trailing:N,entryIds:B,children:B.map(S=>{const F=$.get(S);return F?s.jsxRuntimeExports.jsx($s,{id:S,onClick:t?()=>t(F):void 0,children:s.jsxRuntimeExports.jsx(St,{entry:F,isDragPreview:!1,visiblePropertySet:f,statusOptions:o,priorityOptions:l,issueTypeOptions:a,assigneeOptions:x,parentDisplayId:F?.parentId?String(h.get(String(F.parentId))?.id??h.get(String(F.parentId))?._id??F.parentId):void 0,onSummaryChange:T=>{L(F,{summary:T})},onPriorityChange:T=>{L(F,{priority:T})},onStatusChange:T=>{L(F,{status:T,state:T})},onIssueTypeChange:T=>{L(F,{entryType:T,type:T,issueType:T})},onAssigneeChange:T=>{L(F,{assignee:T})}})},S):null})},w.key)})})}),s.jsxRuntimeExports.jsx(on,{children:A?s.jsxRuntimeExports.jsx("div",{className:"w-72 opacity-95 pointer-events-none shadow-lg",children:(()=>{const w=$.get(A);return w?s.jsxRuntimeExports.jsx(St,{entry:w,isDragPreview:!1,visiblePropertySet:f,statusOptions:o,priorityOptions:l,issueTypeOptions:a,assigneeOptions:x,parentDisplayId:w?.parentId?String(h.get(String(w.parentId))?.id??h.get(String(w.parentId))?._id??w.parentId):void 0}):null})()}):null})]})})};function ha({currentView:e,properties:t,viewSettings:n,setViewSettings:r,setCurrentView:i}){const o=n.filter??{},l=c.useMemo(()=>Qe(t),[t]),a=un(o),u=n.sortRules??[],f=u.length>0?Te.find(x=>x.value===u[0].property)?.label??u[0].property:"None",d="type"in o&&o.type==="group"?o:Ye();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs(me,{title:"View options",children:[s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(s.ListFilter,{size:14}),label:"Filter",submenu:"filter",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[a>0?`${a} active`:"None",s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})}),s.jsxRuntimeExports.jsx(ue,{icon:s.jsxRuntimeExports.jsx(s.ArrowUpDown,{size:14}),label:"Sort",submenu:"sort",trailing:s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[f,s.jsxRuntimeExports.jsx(s.ChevronRight,{size:14})]})})]}),s.jsxRuntimeExports.jsx(we,{id:"filter",title:"Filter",children:s.jsxRuntimeExports.jsx(me,{children:s.jsxRuntimeExports.jsx("div",{className:"px-2",children:s.jsxRuntimeExports.jsx(s.MtFilterDropdown,{title:"Filter",value:d,onChange:x=>{i({...e,settings:{...e.settings??{},filter:x}})},fields:l,operators:Je,variant:"ghost"})})})}),s.jsxRuntimeExports.jsx(we,{id:"sort",title:"Sort",children:s.jsxRuntimeExports.jsx(me,{children:s.jsxRuntimeExports.jsx("div",{className:"px-2",children:s.jsxRuntimeExports.jsx(s.MtSortDropdown,{title:"Sort",value:u,onChange:x=>{r({sortRules:x})},fields:Te,variant:"ghost"})})})})]})}mn.SettingsMenu=ha;function pa(){const e=Ne(),t=e.currentView,n=e.properties,r=c.useMemo(()=>Qe(n),[n]);if(!t)return null;const i=t.settings??{},o=i.sortRules??[],l=i.filter&&typeof i.filter=="object"&&"type"in i.filter?i.filter:Ye(),a=o.length>0,u=dn(i.filter),f=e.setCurrentView,d=x=>{f({...t,settings:{...t.settings??{},...x}})};return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtSortDropdown,{title:"Sort",kind:"icon",variant:a?"accent":"ghost",showCaret:!1,value:o,onChange:x=>d({sortRules:x}),fields:Te}),a?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>d({sortRules:[]}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxRuntimeExports.jsx(s.MtFilterDropdown,{title:"Filter",kind:"icon",variant:u?"accent":"ghost",showCaret:!1,value:l,onChange:x=>d({filter:x}),fields:r,operators:Je}),u?s.jsxRuntimeExports.jsx(s.MtButton,{kind:"icon",variant:"ghost",onClick:()=>d({filter:void 0}),children:s.jsxRuntimeExports.jsx(s.X,{size:14,stroke:"#8D8D8D"})}):null]})]})}mn.ToolbarActions=pa;exports.MtCollection=vo;exports.MtCollectionBoardLayout=pn;exports.MtCollectionGanttLayout=oa;exports.MtCollectionGridLayout=Qo;exports.MtCollectionListLayout=hn;exports.MtCollectionPlanLayout=mn;exports.MtCollectionTableLayout=Zo;exports.MtCollectionToolbar=Ds;exports.MtCollectionViewSettings=As;
|