@esperanca-ui/componentes 2.14.18 → 2.14.20

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.
@@ -108,5 +108,5 @@
108
108
  L ${Ae+Ke-Xe} ${Be+Fe}
109
109
  Q ${Ae+Ke} ${Be+Fe} ${Ae+Ke} ${Be+Fe-Xe}
110
110
  L ${Ae+Ke} ${Be}
111
- Z`,fill:nt.color,className:`esp-bar-chart-bar ${be===null||be===He?"esp-bar-chart-bar-active":"esp-bar-chart-bar-muted"}`}),Q?h.jsx("text",{x:Ot,y:m,textAnchor:ut,className:"esp-bar-chart-value",children:Ka(ge,q)}):null]},nt.key)})},`${Ve.label}-${He}`)}),t.map((Ve,He)=>{const P=Kr(He,it,M.left,M.left+xe);return h.jsx("rect",{x:P.x,y:M.top,width:P.width,height:me,className:"esp-chart-hitbox",tabIndex:0,"aria-label":`Show values for ${Ve.label}`,onMouseEnter:()=>b(He),onFocus:()=>b(He),onBlur:()=>b(oe=>oe===He?null:oe)},`${Ve.label}-${He}`)})]})})})}),Rm="",Hl={todo:"To do",planned:"Planned",in_progress:"In progress",blocked:"Blocked",done:"Done"},V2=e=>e.replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase()),qa=w.forwardRef(function({status:t,size:r="md",variant:n="soft",showDot:a=!0,label:s,name:i,colors:o,className:c,style:l,...f},u){const d={...l,...o!=null&&o.background?{"--esp-task-badge-bg-soft":o.background}:{},...o!=null&&o.solidBackground?{"--esp-task-badge-bg-solid":o.solidBackground}:o!=null&&o.background?{"--esp-task-badge-bg-solid":o.background}:{},...o!=null&&o.text?{"--esp-task-badge-color":o.text}:{},...o!=null&&o.solidText?{"--esp-task-badge-text-solid":o.solidText}:{},...o!=null&&o.border?{"--esp-task-badge-border":o.border}:o!=null&&o.background?{"--esp-task-badge-border":o.background}:{},...o!=null&&o.dot?{"--esp-task-badge-dot":o.dot}:o!=null&&o.text?{"--esp-task-badge-dot":o.text}:{}},x=i??s??(t in Hl?Hl[t]:V2(String(t)));return h.jsxs("span",{ref:u,className:ye("esp-task-badge","esp-task-status-badge",`esp-task-badge-size-${r}`,`esp-task-badge-variant-${n}`,`esp-task-status-badge-status-${t}`,c),style:d,...f,children:[a?h.jsx("span",{className:"esp-task-badge-dot","aria-hidden":"true"}):null,h.jsx("span",{className:"esp-task-badge-label",children:x})]})}),Hm="",Vl={low:"Low",medium:"Medium",high:"High",critical:"Critical"},X2=e=>e.replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase()),ni=w.forwardRef(function({priority:t,size:r="md",variant:n="soft",showDot:a=!0,label:s,name:i,colors:o,className:c,style:l,...f},u){const d={...l,...o!=null&&o.background?{"--esp-task-badge-bg-soft":o.background}:{},...o!=null&&o.solidBackground?{"--esp-task-badge-bg-solid":o.solidBackground}:o!=null&&o.background?{"--esp-task-badge-bg-solid":o.background}:{},...o!=null&&o.text?{"--esp-task-badge-color":o.text}:{},...o!=null&&o.solidText?{"--esp-task-badge-text-solid":o.solidText}:{},...o!=null&&o.border?{"--esp-task-badge-border":o.border}:o!=null&&o.background?{"--esp-task-badge-border":o.background}:{},...o!=null&&o.dot?{"--esp-task-badge-dot":o.dot}:o!=null&&o.text?{"--esp-task-badge-dot":o.text}:{}},x=i??s??(t in Vl?Vl[t]:X2(String(t)));return h.jsxs("span",{ref:u,className:ye("esp-task-badge","esp-task-priority-badge",`esp-task-badge-size-${r}`,`esp-task-badge-variant-${n}`,`esp-task-priority-badge-priority-${t}`,c),style:d,...f,children:[a?h.jsx("span",{className:"esp-task-badge-dot","aria-hidden":"true"}):null,h.jsx("span",{className:"esp-task-badge-label",children:x})]})}),Vm="",G2=(e,t,r)=>Math.min(Math.max(e,t),r),Xl=w.forwardRef(function({title:t,description:r,status:n,priority:a,statusName:s,priorityName:i,statusVariant:o="soft",priorityVariant:c="soft",badgeSize:l="sm",showStatusDot:f=!0,showPriorityDot:u=!0,statusColors:d,priorityColors:x,assignee:v,project:p,startDate:g,endDate:C,dueDate:N,progress:y,tags:D,meta:R,actions:J,className:k,children:L,style:F,...W},B){const V=y!==void 0?G2(y,0,100):void 0,q=[p?{key:"project",label:"Project",value:p}:null,v?{key:"assignee",label:"Assignee",value:v}:null,g?{key:"start",label:"Start",value:g}:null,C?{key:"end",label:"End",value:C}:null].filter(Boolean),G=q.length>0||V!==void 0||!!(D!=null&&D.length)||!!R||!!L,ie={...F,...V!==void 0?{"--esp-task-card-progress":`${V}%`}:{}};return h.jsxs(lt,{ref:B,className:ye("esp-task-card",k),style:ie,...W,children:[h.jsxs(lt.Header,{className:"esp-task-card-header",children:[h.jsxs("div",{className:"esp-task-card-topline",children:[h.jsxs("div",{className:"esp-task-card-badges",children:[h.jsx(qa,{status:n,name:s,size:l,variant:o,showDot:f,colors:d}),a?h.jsx(ni,{priority:a,name:i,size:l,variant:c,showDot:u,colors:x}):null]}),N?h.jsx("div",{className:"esp-task-card-due-date",children:N}):null]}),h.jsx(lt.Title,{className:"esp-task-card-title",children:t}),r?h.jsx(lt.Description,{className:"esp-task-card-description",children:r}):null]}),G?h.jsxs(lt.Body,{className:"esp-task-card-body",children:[q.length>0?h.jsx("div",{className:"esp-task-card-meta-grid",children:q.map(Te=>h.jsxs("div",{className:"esp-task-card-meta-item",children:[h.jsx("span",{className:"esp-task-card-meta-label",children:Te.label}),h.jsx("span",{className:"esp-task-card-meta-value",children:Te.value})]},Te.key))}):null,V!==void 0?h.jsxs("div",{className:"esp-task-card-progress",children:[h.jsxs("div",{className:"esp-task-card-progress-row",children:[h.jsx("span",{className:"esp-task-card-progress-label",children:"Progress"}),h.jsxs("strong",{className:"esp-task-card-progress-value",children:[V,"%"]})]}),h.jsx("div",{className:"esp-task-card-progress-track",role:"progressbar","aria-label":"Task progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":V,children:h.jsx("div",{className:"esp-task-card-progress-bar"})})]}):null,D!=null&&D.length?h.jsx("div",{className:"esp-task-card-tags",children:D.map((Te,Ee)=>h.jsx("span",{className:"esp-task-card-tag",children:Te},Ee))}):null,R?h.jsx("div",{className:"esp-task-card-meta-extra",children:R}):null,L]}):null,J?h.jsx(lt.Footer,{className:"esp-task-card-footer",children:J}):null]})}),Xm="",z2=24*60*60*1e3,Y2=e=>/^\d{4}-\d{2}-\d{2}$/.test(e),Za=e=>{if(!e)return null;if(e instanceof Date)return new Date(e.getTime());if(typeof e=="string"&&Y2(e)){const[r,n,a]=e.split("-").map(Number);return new Date(r,n-1,a)}const t=new Date(e);return Number.isNaN(t.getTime())?null:t},Tn=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Qn=e=>new Date(e.getFullYear(),e.getMonth(),1),Pr=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),j2=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),Gl=(e,t)=>{const r=Tn(e),n=(r.getDay()-t+7)%7;return Pr(r,-n)},En=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Jr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,Qa=e=>Tn(Za(e)??new Date),K2=(e,t)=>{const r=Qn(e),n=new Date(e.getFullYear(),e.getMonth()+1,0),a=(r.getDay()-t+7)%7,s=(t+6-n.getDay()+7)%7,i=Pr(r,-a),o=Pr(n,s),c=[];for(let l=new Date(i);l<=o;l=Pr(l,1))c.push(new Date(l));return c},J2=(e,t)=>{const r=Gl(e,t);return Array.from({length:7},(n,a)=>Pr(r,a))},q2=e=>{const t=Za(e.startDate??e.date??e.dueDate),r=Za(e.endDate??e.startDate??e.date??e.dueDate);if(!t||!r)return null;const n=Tn(t),a=Tn(r);return n<=a?{start:n,end:a}:{start:a,end:n}},Z2=(e,t,r,n)=>{if(e==="day")return new Intl.DateTimeFormat(r,{weekday:"long",day:"numeric",month:"long",year:"numeric"}).format(t);if(e==="week"){const a=Gl(t,n),s=Pr(a,6),i=new Intl.DateTimeFormat(r,{day:"numeric",month:"short"}),o=new Intl.DateTimeFormat(r,{day:"numeric",month:"short",year:"numeric"});return`${i.format(a)} - ${o.format(s)}`}return new Intl.DateTimeFormat(r,{month:"long",year:"numeric"}).format(Qn(t))},Q2=(e,t)=>{if(e)return e instanceof Date?new Intl.DateTimeFormat(t,{day:"numeric",month:"short"}).format(e):e},em={month:"Mes",week:"Semana",day:"Dia"},tm=w.forwardRef(function({tasks:t,view:r,defaultView:n="month",onViewChange:a,date:s,defaultDate:i,month:o,selectedDate:c,onSelectDate:l,onDateChange:f,onMonthChange:u,onTaskClick:d,maxVisibleTasks:x=3,locale:v="pt-BR",weekStartsOn:p=1,heading:g,description:C,emptyLabel:N="Sem tarefas neste periodo.",renderTask:y,showViewSwitcher:D=!1,views:R,className:J,variant:k="outlined",...L},F){const W=r!==void 0,[B,V]=w.useState(n),q=W?r:B,G=R!=null&&R.length?R:["month","week","day"],ie=s===void 0&&o!==void 0&&u!==void 0,Te=s??(ie?o:void 0),[Ee,Oe]=w.useState(()=>Qa(i??o??c));w.useEffect(()=>{r!==void 0&&V(r)},[r]),w.useEffect(()=>{s!==void 0&&Oe(Qa(s))},[s]),w.useEffect(()=>{s===void 0&&ie&&o!==void 0&&Oe(Qn(Qa(o)))},[s,o,ie]);const ve=Te!==void 0?Qa(Te):Ee,Re=Za(c),be=Re?Tn(Re):null,b=Tn(new Date),U=q==="month"?K2(Qn(ve),p):q==="week"?J2(ve,p):[ve],O=new Intl.DateTimeFormat(v,{weekday:"short"}),I=new Intl.DateTimeFormat(v,{day:"numeric",month:"short"}),Y=Array.from({length:7},(M,xe)=>{const me=(p+xe)%7,De=new Date(2026,0,4+me);return O.format(De).replace(".","")}),ne=U[0],he=U[U.length-1],ae={};for(const M of t){const xe=q2(M);if(!xe)continue;const me=xe.start<ne?ne:xe.start,De=xe.end>he?he:xe.end;if(!(me>De))for(let Le=new Date(me);Le<=De;Le=new Date(Le.getTime()+z2)){const ze=Jr(Le);ae[ze]||(ae[ze]=[]),ae[ze].push(M)}}const j=Object.values(ae).reduce((M,xe)=>M+xe.length,0),te=Z2(q,ve,v,p),de=M=>{Te===void 0&&Oe(M),f==null||f(M),q==="month"&&(u==null||u(Qn(M)))},Ie=M=>{const xe=q==="month"?j2(ve,M):q==="week"?Pr(ve,M*7):Pr(ve,M);de(xe)},Q=M=>{W||V(M),a==null||a(M)},le=(M,xe)=>y?y(M,xe):q==="month"?h.jsx(qa,{status:M.status,name:M.title,size:"sm",showDot:!1,colors:M.statusColors,className:"esp-task-calendar-task-badge"}):h.jsx(Xl,{variant:"outlined",className:"esp-task-calendar-task-card",title:M.title,description:M.description,status:M.status,priority:M.priority,statusName:M.statusName,priorityName:M.priorityName,statusColors:M.statusColors,priorityColors:M.priorityColors,project:M.project,assignee:M.assignee,dueDate:Q2(M.dueDate,v),progress:M.progress,tags:M.tags,badgeSize:"sm"}),we=(M,xe)=>{const me=le(M,xe),De=q==="month"?"esp-task-calendar-task-button":"esp-task-calendar-task-card-button";return d?h.jsx("button",{type:"button",className:De,onClick:Le=>{Le.stopPropagation(),d(M,xe.date)},children:me},`${M.id}-${Jr(xe.date)}-${q}`):h.jsx("div",{className:"esp-task-calendar-task-slot",children:me},`${M.id}-${Jr(xe.date)}-${q}`)};return h.jsxs(lt,{ref:F,variant:k,className:ye("esp-task-calendar",J),...L,children:[h.jsxs(lt.Header,{className:"esp-task-calendar-header",children:[g||C?h.jsxs("div",{className:"esp-task-calendar-copy",children:[g?h.jsx(lt.Title,{className:"esp-task-calendar-heading",children:g}):null,C?h.jsx(lt.Description,{className:"esp-task-calendar-description",children:C}):null]}):null,h.jsxs("div",{className:"esp-task-calendar-toolbar",children:[h.jsx("div",{className:"esp-task-calendar-range-label",children:te}),h.jsxs("div",{className:"esp-task-calendar-toolbar-actions",children:[D?h.jsx("div",{className:"esp-task-calendar-view-switcher",role:"tablist","aria-label":"Calendar views",children:G.map(M=>h.jsx("button",{type:"button",className:ye("esp-task-calendar-view-button",M===q&&"is-active"),onClick:()=>Q(M),children:em[M]},M))}):null,h.jsxs("div",{className:"esp-task-calendar-nav",children:[h.jsx(jr,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ie(-1),children:"Anterior"}),h.jsx(jr,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ie(1),children:"Proximo"})]})]})]})]}),h.jsxs(lt.Body,{className:"esp-task-calendar-body",children:[q==="month"?h.jsxs("div",{className:"esp-task-calendar-grid-wrap",children:[h.jsx("div",{className:"esp-task-calendar-weekdays",children:Y.map(M=>h.jsx("div",{className:"esp-task-calendar-weekday",children:M},M))}),h.jsx("div",{className:"esp-task-calendar-grid",children:U.map(M=>{const xe=Jr(M),me=ae[xe]??[],De=me.slice(0,x),Le=me.length-De.length,ze=M.getMonth()!==ve.getMonth(),it=En(M,b),Ne=be?En(M,be):!1,tt={date:M,isOutsideMonth:ze,isToday:it,isSelected:Ne,view:q};return h.jsxs("div",{className:ye("esp-task-calendar-day",ze&&"esp-task-calendar-day-outside",it&&"esp-task-calendar-day-today",Ne&&"esp-task-calendar-day-selected"),children:[h.jsxs("button",{type:"button",className:"esp-task-calendar-day-button",onClick:()=>l==null?void 0:l(new Date(M)),children:[h.jsx("span",{className:"esp-task-calendar-day-number",children:M.getDate()}),me.length?h.jsx("span",{className:"esp-task-calendar-day-count",children:me.length}):null]}),h.jsxs("div",{className:"esp-task-calendar-day-items",children:[De.map(Ue=>we(Ue,tt)),Le>0?h.jsxs("button",{type:"button",className:"esp-task-calendar-more",onClick:()=>l==null?void 0:l(new Date(M)),children:["+",Le," mais"]}):null]})]},xe)})})]}):null,q==="week"?h.jsx("div",{className:"esp-task-calendar-week-grid",children:U.map(M=>{const xe=Jr(M),me=ae[xe]??[],De=En(M,b),Le=be?En(M,be):!1,ze={date:M,isOutsideMonth:!1,isToday:De,isSelected:Le,view:q};return h.jsxs("div",{className:ye("esp-task-calendar-week-column",De&&"esp-task-calendar-week-column-today",Le&&"esp-task-calendar-week-column-selected"),children:[h.jsxs("button",{type:"button",className:"esp-task-calendar-week-head",onClick:()=>l==null?void 0:l(new Date(M)),children:[h.jsx("span",{className:"esp-task-calendar-week-head-label",children:O.format(M).replace(".","")}),h.jsx("span",{className:"esp-task-calendar-week-head-date",children:I.format(M)})]}),h.jsx("div",{className:"esp-task-calendar-week-items",children:me.length?me.map(it=>we(it,ze)):h.jsx("div",{className:"esp-task-calendar-inline-empty",children:"Sem tarefas"})})]},xe)})}):null,q==="day"?h.jsxs("div",{className:"esp-task-calendar-day-panel",children:[h.jsxs("div",{className:"esp-task-calendar-day-panel-head",children:[h.jsx("span",{className:"esp-task-calendar-day-panel-label",children:"Dia selecionado"}),h.jsx("strong",{className:"esp-task-calendar-day-panel-date",children:te})]}),h.jsx("div",{className:"esp-task-calendar-day-panel-list",children:(ae[Jr(ve)]??[]).length?(ae[Jr(ve)]??[]).map(M=>we(M,{date:ve,isOutsideMonth:!1,isToday:En(ve,b),isSelected:be?En(ve,be):!1,view:q})):h.jsx("div",{className:"esp-task-calendar-inline-empty",children:N})})]}):null,q==="month"&&j===0?h.jsx("div",{className:"esp-task-calendar-empty",children:N}):null]})]})}),Gm="",rm=24*60*60*1e3,nm=e=>/^\d{4}-\d{2}-\d{2}$/.test(e),ea=e=>{if(!e)return null;if(e instanceof Date)return new Date(e.getTime());if(typeof e=="string"&&nm(e)){const[r,n,a]=e.split("-").map(Number);return new Date(r,n-1,a)}const t=new Date(e);return Number.isNaN(t.getTime())?null:t},vr=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),zl=e=>new Date(e.getFullYear(),e.getMonth(),1),am=e=>new Date(e.getFullYear(),e.getMonth()+1,0),ta=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),sm=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),Yl=(e,t)=>{const r=vr(e),n=(r.getDay()-t+7)%7;return ta(r,-n)},ai=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),si=(e,t,r)=>Math.min(Math.max(e,t),r),ii=e=>vr(ea(e)??new Date),jl=e=>{const t=ea(e.startDate),r=ea(e.endDate??e.startDate);if(!t||!r)return null;const n=vr(t),a=vr(r);return n<=a?{start:n,end:a}:{start:a,end:n}},im=e=>{const t=ea(e.startDate),r=ea(e.endDate);if(t||r){const a=vr(t??r??new Date),s=vr(r??t??new Date);return a<=s?{start:a,end:s}:{start:s,end:a}}const n=e.items.map(a=>jl(a)).filter(Boolean);return n.length===0?null:n.reduce((a,s)=>({start:s.start<a.start?s.start:a.start,end:s.end>a.end?s.end:a.end}),n[0])},Kl=(e,t)=>Math.round((vr(t).getTime()-vr(e).getTime())/rm),om=(e,t,r)=>{if(e==="week"){const i=Yl(t,r);return Array.from({length:7},(o,c)=>ta(i,c))}const n=zl(t),a=am(t),s=[];for(let i=new Date(n);i<=a;i=ta(i,1))s.push(new Date(i));return s},lm=(e,t,r,n)=>{if(e==="week"){const a=Yl(t,n),s=ta(a,6),i=new Intl.DateTimeFormat(r,{day:"numeric",month:"short"}),o=new Intl.DateTimeFormat(r,{day:"numeric",month:"short",year:"numeric"});return`${i.format(a)} - ${o.format(s)}`}return new Intl.DateTimeFormat(r,{month:"long",year:"numeric"}).format(zl(t))},Jl=(e,t,r,n)=>{if(!e)return null;const a=e.start<t?t:e.start,s=e.end>r?r:e.end;if(a>s)return null;const i=Kl(t,a),o=Kl(t,s),c=i/n*100,l=(o-i+1)/n*100;return{left:c,width:l}},ql=e=>{if(e.progress!==void 0)return si(e.progress,0,100);const t=e.items.map(n=>n.progress).filter(n=>typeof n=="number");if(t.length===0)return;const r=t.reduce((n,a)=>n+a,0)/t.length;return Math.round(r)},cm=e=>e==="project"?"Project":e==="assignee"?"Assignee":"Group",fm={week:"Semana",month:"Mes"},hm=w.forwardRef(function({groups:t,view:r,defaultView:n="month",onViewChange:a,date:s,defaultDate:i,onDateChange:o,locale:c="pt-BR",heading:l,description:f,emptyLabel:u="Sem itens no periodo selecionado.",showViewSwitcher:d=!1,views:x,leftColumnWidth:v=320,onItemClick:p,onGroupClick:g,renderItemLabel:C,renderGroupLabel:N,className:y,variant:D="outlined",...R},J){const k=r!==void 0,[L,F]=w.useState(n),W=x!=null&&x.length?x:["week","month"],B=k?r:L,[V,q]=w.useState(()=>ii(i)),G=s!==void 0?ii(s):V;w.useEffect(()=>{r!==void 0&&F(r)},[r]),w.useEffect(()=>{s!==void 0&&q(ii(s))},[s]);const ie=w.useMemo(()=>om(B,G,1),[B,G]),Te=ie[0],Ee=ie[ie.length-1],Oe=ie.length,ve=B==="week"?96:42,Re=lm(B,G,c,1),be=new Intl.DateTimeFormat(c,{weekday:"short"}),b=new Intl.DateTimeFormat(c,{day:"numeric"}),U=t.reduce((te,de)=>te+de.items.length,0),O=t.length>0&&U>0,I=vr(new Date),Y=te=>{k||F(te),a==null||a(te)},ne=te=>{const de=vr(te);s===void 0&&q(de),o==null||o(de)},he=te=>{if(B==="week"){ne(ta(G,te*7));return}ne(sm(G,te))},ae=te=>{const de=ql(te);return h.jsxs("div",{className:"esp-gantt-chart-group-label",children:[h.jsxs("div",{className:"esp-gantt-chart-group-header",children:[h.jsx("span",{className:"esp-gantt-chart-group-kind",children:cm(te.kind)}),h.jsx("strong",{className:"esp-gantt-chart-group-title",children:te.title})]}),te.subtitle?h.jsx("span",{className:"esp-gantt-chart-group-subtitle",children:te.subtitle}):null,h.jsxs("div",{className:"esp-gantt-chart-group-meta",children:[h.jsxs("span",{children:[te.items.length," tarefas"]}),de!==void 0?h.jsxs("span",{children:[de,"%"]}):null,te.meta?h.jsx("span",{children:te.meta}):null]})]})},j=te=>h.jsxs("div",{className:"esp-gantt-chart-item-label",children:[h.jsxs("div",{className:"esp-gantt-chart-item-header",children:[h.jsx("strong",{className:"esp-gantt-chart-item-title",children:te.title}),te.progress!==void 0?h.jsxs("span",{className:"esp-gantt-chart-item-progress",children:[si(te.progress,0,100),"%"]}):null]}),h.jsxs("div",{className:"esp-gantt-chart-item-badges",children:[te.status?h.jsx(qa,{status:te.status,name:te.statusName,colors:te.statusColors,size:"sm",variant:"soft"}):null,te.priority?h.jsx(ni,{priority:te.priority,name:te.priorityName,colors:te.priorityColors,size:"sm",variant:"soft"}):null]}),te.project||te.assignee?h.jsxs("div",{className:"esp-gantt-chart-item-contexts",children:[te.project?h.jsx("span",{className:"esp-gantt-chart-item-context-badge",children:te.project}):null,te.assignee?h.jsx("span",{className:"esp-gantt-chart-item-context-badge",children:te.assignee}):null]}):null,te.meta?h.jsx("div",{className:"esp-gantt-chart-item-meta",children:h.jsx("span",{children:te.meta})}):null]});return h.jsxs(lt,{ref:J,className:ye("esp-gantt-chart",y),variant:D,...R,children:[h.jsxs(lt.Header,{className:"esp-gantt-chart-header",children:[h.jsxs("div",{children:[l?h.jsx(lt.Title,{children:l}):null,f?h.jsx(lt.Description,{children:f}):null]}),h.jsxs("div",{className:"esp-gantt-chart-toolbar",children:[d?h.jsx(yl,{items:W.map(te=>({value:te,label:fm[te]})),value:B,onValueChange:te=>Y(te),variant:"segmented",size:"sm"}):null,h.jsxs("div",{className:"esp-gantt-chart-nav",children:[h.jsx(jr,{variant:"ghost",size:"sm",onClick:()=>he(-1),children:"Anterior"}),h.jsx("span",{className:"esp-gantt-chart-range-label",children:Re}),h.jsx(jr,{variant:"ghost",size:"sm",onClick:()=>he(1),children:"Proximo"})]})]})]}),h.jsx(lt.Body,{className:"esp-gantt-chart-body",children:h.jsx("div",{className:"esp-gantt-chart-scroll",children:h.jsxs("div",{className:"esp-gantt-chart-table",style:{"--esp-gantt-label-width":`${v}px`,"--esp-gantt-day-count":String(Oe),"--esp-gantt-day-width":`${ve}px`},children:[h.jsxs("div",{className:"esp-gantt-chart-head",children:[h.jsxs("div",{className:"esp-gantt-chart-head-label",children:[h.jsx("span",{children:"Planejamento"}),h.jsxs("strong",{children:[U," itens"]})]}),h.jsx("div",{className:"esp-gantt-chart-head-days",style:{gridTemplateColumns:`repeat(${Oe}, minmax(var(--esp-gantt-day-width), 1fr))`},children:ie.map(te=>h.jsxs("div",{className:ye("esp-gantt-chart-head-day",ai(te,I)&&"is-today"),children:[h.jsx("span",{children:be.format(te).replace(".","")}),h.jsx("strong",{children:b.format(te)})]},te.toISOString()))})]}),O?t.map(te=>{const de=im(te),Ie=Jl(de,Te,Ee,Oe),Q=ql(te);return h.jsxs(w.Fragment,{children:[h.jsxs("div",{className:"esp-gantt-chart-row esp-gantt-chart-row-group",children:[h.jsx("div",{className:ye("esp-gantt-chart-label-cell",g&&"is-clickable"),onClick:()=>g==null?void 0:g(te),children:N?N(te):ae(te)}),h.jsxs("div",{className:"esp-gantt-chart-timeline-cell",children:[h.jsx("div",{className:"esp-gantt-chart-day-grid",style:{gridTemplateColumns:`repeat(${Oe}, minmax(var(--esp-gantt-day-width), 1fr))`},children:ie.map(le=>h.jsx("span",{className:ye("esp-gantt-chart-day-cell",ai(le,I)&&"is-today")},le.toISOString()))}),Ie?h.jsxs("div",{className:"esp-gantt-chart-bar esp-gantt-chart-bar-group",style:{left:`${Ie.left}%`,width:`${Ie.width}%`,...te.color?{"--esp-gantt-bar-bg":te.color}:{}},children:[Q!==void 0?h.jsx("div",{className:"esp-gantt-chart-bar-progress",style:{width:`${Q}%`}}):null,h.jsx("span",{className:"esp-gantt-chart-bar-label",children:te.title})]}):null]})]}),te.items.map(le=>{const we=jl(le),M=Jl(we,Te,Ee,Oe),xe=le.status?`esp-gantt-chart-bar-status-${le.status}`:"",me=C?C(le,te):j(le),De=h.jsxs(h.Fragment,{children:[le.progress!==void 0?h.jsx("div",{className:"esp-gantt-chart-bar-progress",style:{width:`${si(le.progress,0,100)}%`}}):null,h.jsx("span",{className:"esp-gantt-chart-bar-label",children:le.title})]});return h.jsxs("div",{className:"esp-gantt-chart-row esp-gantt-chart-row-item",children:[h.jsx("div",{className:ye("esp-gantt-chart-label-cell",p&&"is-clickable"),onClick:()=>p==null?void 0:p(le,te),children:me}),h.jsxs("div",{className:"esp-gantt-chart-timeline-cell",children:[h.jsx("div",{className:"esp-gantt-chart-day-grid",style:{gridTemplateColumns:`repeat(${Oe}, minmax(var(--esp-gantt-day-width), 1fr))`},children:ie.map(Le=>h.jsx("span",{className:ye("esp-gantt-chart-day-cell",ai(Le,I)&&"is-today")},Le.toISOString()))}),M?p?h.jsx("button",{type:"button",className:ye("esp-gantt-chart-bar",xe),style:{left:`${M.left}%`,width:`${M.width}%`,...le.color?{"--esp-gantt-bar-bg":le.color}:{}},onClick:()=>p(le,te),children:De}):h.jsx("div",{className:ye("esp-gantt-chart-bar",xe),style:{left:`${M.left}%`,width:`${M.width}%`,...le.color?{"--esp-gantt-bar-bg":le.color}:{}},children:De}):null]})]},le.id)})]},te.id)}):h.jsx("div",{className:"esp-gantt-chart-empty",children:u})]})})})]})});function um({theme:e,gradient:t,pattern:r="none",opacity:n,blendMode:a,fullScreen:s=!0,children:i,className:o,style:c}){const l={...c,...t?{background:t}:{},...n!==void 0?{opacity:n}:{},...a?{mixBlendMode:a}:{}};return h.jsx("div",{className:ye("bg-wrap",e&&`bg-wrap--${e}`,!s&&"bg-wrap--auto",r!=="none"&&`bg-pattern-${r}`,o),style:l,children:i})}const zm="",Ym="",jm="",Zl=w.createContext(void 0),dm=({children:e,defaultTheme:t="system",storageKey:r="esperanca-ui-theme",themeVars:n})=>{const[a,s]=w.useState(()=>localStorage.getItem(r)||t),[i,o]=w.useState("light"),c=w.useCallback(f=>{const u=window.document.documentElement;u.classList.remove("light","dark");const d=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f;u.classList.add(d),u.setAttribute("data-theme",d),o(d),n&&Object.entries(n).forEach(([x,v])=>{u.style.setProperty(x.startsWith("--")?x:`--${x}`,v)})},[n]);w.useEffect(()=>{c(a)},[a,c]),w.useEffect(()=>{const f=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>{a==="system"&&c("system")};return f.addEventListener("change",u),()=>f.removeEventListener("change",u)},[a,c]);const l=f=>{localStorage.setItem(r,f),s(f)};return h.jsx(Zl.Provider,{value:{theme:a,setTheme:l,actualTheme:i},children:e})},Km="",pm=({columns:e=1,gap:t="1rem",className:r="",style:n,children:a,...s})=>{const i={...n,"--grid-gap":typeof t=="number"?`${t}px`:t},o=()=>{if(typeof e=="number")return`esp-grid-cols-${e}`;const c=[];return e.base&&c.push(`esp-grid-cols-${e.base}`),e.sm&&c.push(`sm\\:esp-grid-cols-${e.sm}`),e.md&&c.push(`md\\:esp-grid-cols-${e.md}`),e.lg&&c.push(`lg\\:esp-grid-cols-${e.lg}`),e.xl&&c.push(`xl\\:esp-grid-cols-${e.xl}`),c.join(" ")};return h.jsx("div",{className:`esp-grid ${o()} ${r}`,style:i,...s,children:a})},Jm="",Ql=({isOpen:e,onClose:t,title:r,children:n,footer:a,size:s="md",closeOnOverlayClick:i=!0,className:o="",...c})=>{const l=ts(e);return sa({Escape:()=>{e&&t()}}),w.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?h.jsx(Qr,{children:h.jsx("div",{className:"esp-modal-overlay",onClick:i?t:void 0,children:h.jsxs("div",{className:`esp-modal-content esp-modal-${s} ${o}`,onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":r?"esp-modal-title":void 0,ref:l,...c,children:[r&&h.jsxs("div",{className:"esp-modal-header",children:[h.jsx("h2",{id:"esp-modal-title",className:"esp-modal-title",children:r}),h.jsx("button",{className:"esp-modal-close",onClick:t,"aria-label":"Close modal",children:"×"})]}),h.jsx("div",{className:"esp-modal-body",children:n}),a&&h.jsx("div",{className:"esp-modal-footer",children:a})]})})}):null},xm=({message:e,confirmLabel:t="Confirm",cancelLabel:r="Cancel",onConfirm:n,isOpen:a,onClose:s,isDestructive:i=!1,...o})=>{const c=h.jsxs(h.Fragment,{children:[h.jsx(jr,{variant:"secondary",onClick:s,style:{marginRight:"8px"},children:r}),h.jsx(jr,{variant:i?"danger":"primary",style:i?{backgroundColor:"var(--esp-color-danger, #ef4444)",borderColor:"var(--esp-color-danger, #ef4444)",color:"white"}:{},onClick:()=>{n(),s()},children:t})]});return h.jsx(Ql,{isOpen:a,onClose:s,footer:c,size:"sm",...o,children:h.jsx("p",{style:{margin:0,color:"var(--esp-text-base)"},children:e})})},qm="",gm=({id:e,message:t,type:r="info",duration:n=3e3,onClose:a})=>(w.useEffect(()=>{if(n>0){const s=setTimeout(()=>{a(e)},n);return()=>clearTimeout(s)}},[e,n,a]),h.jsxs("div",{className:`esp-toast esp-toast-${r}`,role:"alert",children:[h.jsx("span",{children:t}),h.jsx("button",{className:"esp-toast-close",onClick:()=>a(e),"aria-label":"Close",children:"×"})]})),ec=w.createContext(void 0),vm=({children:e})=>{const[t,r]=w.useState([]),n=w.useCallback((s,i="info",o=3e3)=>{const c=Math.random().toString(36).substr(2,9);r(l=>[...l,{id:c,message:s,type:i,duration:o}])},[]),a=w.useCallback(s=>{r(i=>i.filter(o=>o.id!==s))},[]);return h.jsxs(ec.Provider,{value:{addToast:n},children:[e,h.jsx(Qr,{children:h.jsx("div",{className:"esp-toast-container",children:t.map(s=>h.jsx(gm,{...s,onClose:a},s.id))})})]})},mm=()=>{const e=w.useContext(ec);if(!e)throw new Error("useToast must be used within a ToastProvider");return e},Zm="",wm=({content:e,children:t,position:r="top",delay:n=300})=>{const[a,s]=w.useState(!1),[i,o]=w.useState({top:0,left:0}),c=w.useRef(null),l=w.useRef(null),f=w.useRef(null),u=()=>{f.current=setTimeout(()=>{x(),s(!0)},n)},d=()=>{f.current&&clearTimeout(f.current),s(!1)};w.useEffect(()=>{if(a)return x(),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),()=>{window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[a,e,r]);const x=()=>{if(c.current){const v=c.current.getBoundingClientRect(),p=8;let g=0,C=0;if(l.current){const D=l.current.getBoundingClientRect();g=D.width,C=D.height}let N=0,y=0;switch(r){case"top":N=v.top-C-p,y=v.left+(v.width-g)/2;break;case"bottom":N=v.bottom+p,y=v.left+(v.width-g)/2;break;case"left":N=v.top+(v.height-C)/2,y=v.left-g-p;break;case"right":N=v.top+(v.height-C)/2,y=v.right+p;break}o({top:N,left:y})}};return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:c,onMouseEnter:u,onMouseLeave:d,onFocus:u,onBlur:d,style:{display:"inline-block"},children:t}),a&&h.jsx(Qr,{children:h.jsx("div",{ref:l,className:`esp-tooltip esp-tooltip-${r}`,style:{top:i.top,left:i.left,opacity:l.current?1:0},role:"tooltip",children:e})})]})},Qm="",_m=({size:e="md",variant:t="spinner",skeletonLines:r=3,text:n,description:a,fullScreen:s=!1,className:i="",...o})=>{const c=`esp-loading esp-loading-${e}`,l=t==="skeleton"?h.jsx(h.Fragment,{children:Array.from({length:r}).map((d,x)=>h.jsx("div",{className:`esp-skeleton-line ${x===r-1?"esp-skeleton-short":""}`},x))}):t==="dots"?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"esp-dot"}),h.jsx("span",{className:"esp-dot"}),h.jsx("span",{className:"esp-dot"})]}):h.jsx("svg",{className:"esp-spinner-svg",viewBox:"0 0 50 50",children:h.jsx("circle",{className:"esp-spinner-circle",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"5"})}),f=n||a?h.jsxs("div",{className:"esp-loading-copy",children:[n&&h.jsx("p",{className:"esp-loading-text",children:n}),a&&h.jsx("p",{className:"esp-loading-description",children:a})]}):null,u=t==="skeleton"?"esp-loading-visual esp-loading-visual-skeleton":`esp-loading-visual esp-loading-visual-${t}`;return s?h.jsx("div",{className:`esp-loading-screen ${i}`,role:"status","aria-live":"polite",...o,children:h.jsxs("div",{className:"esp-loading-screen-panel",children:[h.jsx("div",{className:u,children:h.jsx("div",{className:t==="skeleton"?"esp-skeleton-container":`${c} esp-loading-${t}`,children:l})}),f]})}):n||a?h.jsxs("div",{className:`esp-loading-stack ${i}`,role:"status","aria-live":"polite",...o,children:[h.jsx("div",{className:u,children:h.jsx("div",{className:t==="skeleton"?"esp-skeleton-container":`${c} esp-loading-${t}`,children:l})}),f]}):t==="skeleton"?h.jsx("div",{className:`esp-skeleton-container ${i}`,...o,children:l}):t==="dots"?h.jsx("div",{className:`${c} esp-loading-dots ${i}`,...o,children:l}):h.jsx("div",{className:`${c} esp-loading-spinner ${i}`,...o,children:l})},Tm=()=>{const e=w.useContext(Zl);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},Em=()=>{const[e,t]=w.useState("");return w.useEffect(()=>{let n=document.getElementById("esp-live-region");n||(n=document.createElement("div"),n.id="esp-live-region",n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.className="esp-sr-only",n.style.position="absolute",n.style.width="1px",n.style.height="1px",n.style.padding="0",n.style.margin="-1px",n.style.overflow="hidden",n.style.clip="rect(0, 0, 0, 0)",n.style.whiteSpace="nowrap",n.style.border="0",document.body.appendChild(n))},[]),{announce:w.useCallback((n,a="polite")=>{t(n);const s=document.getElementById("esp-live-region");s&&(s.setAttribute("aria-live",a),s.textContent=n,setTimeout(()=>{s.textContent===n&&(s.textContent="")},1e3))},[]),announcement:e}};ke.Background=um,ke.BarChart=H2,ke.Button=jr,ke.Card=lt,ke.CardBody=ti,ke.CardDescription=Al,ke.CardFooter=Cl,ke.CardHeader=Sl,ke.CardTitle=bl,ke.Checkbox=m2,ke.ComboBox=vi,ke.ConfirmDialog=xm,ke.DataTable=f2,ke.FormSidebar=x2,ke.GanttChart=hm,ke.Grid=pm,ke.Input=g2,ke.LineChart=Rl,ke.Loading=_m,ke.MetricCard=N2,ke.Modal=Ql,ke.PageHeader=y2,ke.Portal=Qr,ke.Radio=w2,ke.RadioGroup=_2,ke.Sidebar=p2,ke.StepLineChart=W2,ke.Tabs=yl,ke.TaskCalendar=tm,ke.TaskCard=Xl,ke.TaskPriorityBadge=ni,ke.TaskStatusBadge=qa,ke.Textarea=E2,ke.ThemeProvider=dm,ke.ToastProvider=vm,ke.Tooltip=wm,ke.createComponentClasses=es,ke.mergeClasses=ye,ke.useAnnouncements=Em,ke.useBreakpoint=u2,ke.useFocusTrap=ts,ke.useKeyboardNavigation=sa,ke.useMediaQuery=ei,ke.useTheme=Tm,ke.useToast=mm,Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"})});
111
+ Z`,fill:nt.color,className:`esp-bar-chart-bar ${be===null||be===He?"esp-bar-chart-bar-active":"esp-bar-chart-bar-muted"}`}),Q?h.jsx("text",{x:Ot,y:m,textAnchor:ut,className:"esp-bar-chart-value",children:Ka(ge,q)}):null]},nt.key)})},`${Ve.label}-${He}`)}),t.map((Ve,He)=>{const P=Kr(He,it,M.left,M.left+xe);return h.jsx("rect",{x:P.x,y:M.top,width:P.width,height:me,className:"esp-chart-hitbox",tabIndex:0,"aria-label":`Show values for ${Ve.label}`,onMouseEnter:()=>b(He),onFocus:()=>b(He),onBlur:()=>b(oe=>oe===He?null:oe)},`${Ve.label}-${He}`)})]})})})}),Rm="",Hl={todo:"To do",planned:"Planned",in_progress:"In progress",blocked:"Blocked",done:"Done"},V2=e=>e.replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase()),qa=w.forwardRef(function({status:t,size:r="md",variant:n="soft",showDot:a=!0,label:s,name:i,colors:o,className:c,style:l,...f},u){const d={...l,...o!=null&&o.background?{"--esp-task-badge-bg-soft":o.background}:{},...o!=null&&o.solidBackground?{"--esp-task-badge-bg-solid":o.solidBackground}:o!=null&&o.background?{"--esp-task-badge-bg-solid":o.background}:{},...o!=null&&o.text?{"--esp-task-badge-color":o.text}:{},...o!=null&&o.solidText?{"--esp-task-badge-text-solid":o.solidText}:{},...o!=null&&o.border?{"--esp-task-badge-border":o.border}:o!=null&&o.background?{"--esp-task-badge-border":o.background}:{},...o!=null&&o.dot?{"--esp-task-badge-dot":o.dot}:o!=null&&o.text?{"--esp-task-badge-dot":o.text}:{}},x=i??s??(t in Hl?Hl[t]:V2(String(t)));return h.jsxs("span",{ref:u,className:ye("esp-task-badge","esp-task-status-badge",`esp-task-badge-size-${r}`,`esp-task-badge-variant-${n}`,`esp-task-status-badge-status-${t}`,c),style:d,...f,children:[a?h.jsx("span",{className:"esp-task-badge-dot","aria-hidden":"true"}):null,h.jsx("span",{className:"esp-task-badge-label",children:x})]})}),Hm="",Vl={low:"Low",medium:"Medium",high:"High",critical:"Critical"},X2=e=>e.replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase()),ni=w.forwardRef(function({priority:t,size:r="md",variant:n="soft",showDot:a=!0,label:s,name:i,colors:o,className:c,style:l,...f},u){const d={...l,...o!=null&&o.background?{"--esp-task-badge-bg-soft":o.background}:{},...o!=null&&o.solidBackground?{"--esp-task-badge-bg-solid":o.solidBackground}:o!=null&&o.background?{"--esp-task-badge-bg-solid":o.background}:{},...o!=null&&o.text?{"--esp-task-badge-color":o.text}:{},...o!=null&&o.solidText?{"--esp-task-badge-text-solid":o.solidText}:{},...o!=null&&o.border?{"--esp-task-badge-border":o.border}:o!=null&&o.background?{"--esp-task-badge-border":o.background}:{},...o!=null&&o.dot?{"--esp-task-badge-dot":o.dot}:o!=null&&o.text?{"--esp-task-badge-dot":o.text}:{}},x=i??s??(t in Vl?Vl[t]:X2(String(t)));return h.jsxs("span",{ref:u,className:ye("esp-task-badge","esp-task-priority-badge",`esp-task-badge-size-${r}`,`esp-task-badge-variant-${n}`,`esp-task-priority-badge-priority-${t}`,c),style:d,...f,children:[a?h.jsx("span",{className:"esp-task-badge-dot","aria-hidden":"true"}):null,h.jsx("span",{className:"esp-task-badge-label",children:x})]})}),Vm="",G2=(e,t,r)=>Math.min(Math.max(e,t),r),Xl=w.forwardRef(function({title:t,description:r,status:n,priority:a,statusName:s,priorityName:i,statusVariant:o="soft",priorityVariant:c="soft",badgeSize:l="sm",showStatusDot:f=!0,showPriorityDot:u=!0,statusColors:d,priorityColors:x,assignee:v,project:p,startDate:g,endDate:C,dueDate:N,progress:y,tags:D,meta:R,actions:J,className:k,children:L,style:F,...W},B){const V=y!==void 0?G2(y,0,100):void 0,q=[p?{key:"project",label:"Project",value:p}:null,v?{key:"assignee",label:"Assignee",value:v}:null,g?{key:"start",label:"Start",value:g}:null,C?{key:"end",label:"End",value:C}:null].filter(Boolean),G=q.length>0||V!==void 0||!!(D!=null&&D.length)||!!R||!!L,ie={...F,...V!==void 0?{"--esp-task-card-progress":`${V}%`}:{}};return h.jsxs(lt,{ref:B,className:ye("esp-task-card",k),style:ie,...W,children:[h.jsxs(lt.Header,{className:"esp-task-card-header",children:[h.jsxs("div",{className:"esp-task-card-topline",children:[h.jsxs("div",{className:"esp-task-card-badges",children:[h.jsx(qa,{status:n,name:s,size:l,variant:o,showDot:f,colors:d}),a?h.jsx(ni,{priority:a,name:i,size:l,variant:c,showDot:u,colors:x}):null]}),N?h.jsx("div",{className:"esp-task-card-due-date",children:N}):null]}),h.jsx(lt.Title,{className:"esp-task-card-title",children:t}),r?h.jsx(lt.Description,{className:"esp-task-card-description",children:r}):null]}),G?h.jsxs(lt.Body,{className:"esp-task-card-body",children:[q.length>0?h.jsx("div",{className:"esp-task-card-meta-grid",children:q.map(Te=>h.jsxs("div",{className:"esp-task-card-meta-item",children:[h.jsx("span",{className:"esp-task-card-meta-label",children:Te.label}),h.jsx("span",{className:"esp-task-card-meta-value",children:Te.value})]},Te.key))}):null,V!==void 0?h.jsxs("div",{className:"esp-task-card-progress",children:[h.jsxs("div",{className:"esp-task-card-progress-row",children:[h.jsx("span",{className:"esp-task-card-progress-label",children:"Progress"}),h.jsxs("strong",{className:"esp-task-card-progress-value",children:[V,"%"]})]}),h.jsx("div",{className:"esp-task-card-progress-track",role:"progressbar","aria-label":"Task progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":V,children:h.jsx("div",{className:"esp-task-card-progress-bar"})})]}):null,D!=null&&D.length?h.jsx("div",{className:"esp-task-card-tags",children:D.map((Te,Ee)=>h.jsx("span",{className:"esp-task-card-tag",children:Te},Ee))}):null,R?h.jsx("div",{className:"esp-task-card-meta-extra",children:R}):null,L]}):null,J?h.jsx(lt.Footer,{className:"esp-task-card-footer",children:J}):null]})}),Xm="",z2=24*60*60*1e3,Y2=e=>/^\d{4}-\d{2}-\d{2}$/.test(e),Za=e=>{if(!e)return null;if(e instanceof Date)return new Date(e.getTime());if(typeof e=="string"&&Y2(e)){const[r,n,a]=e.split("-").map(Number);return new Date(r,n-1,a)}const t=new Date(e);return Number.isNaN(t.getTime())?null:t},Tn=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),Qn=e=>new Date(e.getFullYear(),e.getMonth(),1),Pr=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),j2=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),Gl=(e,t)=>{const r=Tn(e),n=(r.getDay()-t+7)%7;return Pr(r,-n)},En=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Jr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,Qa=e=>Tn(Za(e)??new Date),K2=(e,t)=>{const r=Qn(e),n=new Date(e.getFullYear(),e.getMonth()+1,0),a=(r.getDay()-t+7)%7,s=(t+6-n.getDay()+7)%7,i=Pr(r,-a),o=Pr(n,s),c=[];for(let l=new Date(i);l<=o;l=Pr(l,1))c.push(new Date(l));return c},J2=(e,t)=>{const r=Gl(e,t);return Array.from({length:7},(n,a)=>Pr(r,a))},q2=e=>{const t=Za(e.startDate??e.date??e.dueDate),r=Za(e.endDate??e.startDate??e.date??e.dueDate);if(!t||!r)return null;const n=Tn(t),a=Tn(r);return n<=a?{start:n,end:a}:{start:a,end:n}},Z2=(e,t,r,n)=>{if(e==="day")return new Intl.DateTimeFormat(r,{weekday:"long",day:"numeric",month:"long",year:"numeric"}).format(t);if(e==="week"){const a=Gl(t,n),s=Pr(a,6),i=new Intl.DateTimeFormat(r,{day:"numeric",month:"short"}),o=new Intl.DateTimeFormat(r,{day:"numeric",month:"short",year:"numeric"});return`${i.format(a)} - ${o.format(s)}`}return new Intl.DateTimeFormat(r,{month:"long",year:"numeric"}).format(Qn(t))},Q2=(e,t)=>{if(e)return e instanceof Date?new Intl.DateTimeFormat(t,{day:"numeric",month:"short"}).format(e):e},em={month:"Mes",week:"Semana",day:"Dia"},tm=w.forwardRef(function({tasks:t,view:r,defaultView:n="month",onViewChange:a,date:s,defaultDate:i,month:o,selectedDate:c,onSelectDate:l,onDateChange:f,onMonthChange:u,onTaskClick:d,maxVisibleTasks:x=3,locale:v="pt-BR",weekStartsOn:p=1,heading:g,description:C,emptyLabel:N="Sem tarefas neste periodo.",renderTask:y,showViewSwitcher:D=!1,views:R,className:J,variant:k="outlined",...L},F){const W=r!==void 0,[B,V]=w.useState(n),q=W?r:B,G=R!=null&&R.length?R:["month","week","day"],ie=s===void 0&&o!==void 0&&u!==void 0,Te=s??(ie?o:void 0),[Ee,Oe]=w.useState(()=>Qa(i??o??c));w.useEffect(()=>{r!==void 0&&V(r)},[r]),w.useEffect(()=>{s!==void 0&&Oe(Qa(s))},[s]),w.useEffect(()=>{s===void 0&&ie&&o!==void 0&&Oe(Qn(Qa(o)))},[s,o,ie]);const ve=Te!==void 0?Qa(Te):Ee,Re=Za(c),be=Re?Tn(Re):null,b=Tn(new Date),U=q==="month"?K2(Qn(ve),p):q==="week"?J2(ve,p):[ve],O=new Intl.DateTimeFormat(v,{weekday:"short"}),I=new Intl.DateTimeFormat(v,{day:"numeric",month:"short"}),Y=Array.from({length:7},(M,xe)=>{const me=(p+xe)%7,De=new Date(2026,0,4+me);return O.format(De).replace(".","")}),ne=U[0],he=U[U.length-1],ae={};for(const M of t){const xe=q2(M);if(!xe)continue;const me=xe.start<ne?ne:xe.start,De=xe.end>he?he:xe.end;if(!(me>De))for(let Le=new Date(me);Le<=De;Le=new Date(Le.getTime()+z2)){const ze=Jr(Le);ae[ze]||(ae[ze]=[]),ae[ze].push(M)}}const j=Object.values(ae).reduce((M,xe)=>M+xe.length,0),te=Z2(q,ve,v,p),de=M=>{Te===void 0&&Oe(M),f==null||f(M),q==="month"&&(u==null||u(Qn(M)))},Ie=M=>{const xe=q==="month"?j2(ve,M):q==="week"?Pr(ve,M*7):Pr(ve,M);de(xe)},Q=M=>{W||V(M),a==null||a(M)},le=(M,xe)=>y?y(M,xe):q==="month"?h.jsx(qa,{status:M.status,name:M.title,size:"sm",showDot:!1,colors:M.statusColors,className:"esp-task-calendar-task-badge"}):h.jsx(Xl,{variant:"outlined",className:"esp-task-calendar-task-card",title:M.title,description:M.description,status:M.status,priority:M.priority,statusName:M.statusName,priorityName:M.priorityName,statusColors:M.statusColors,priorityColors:M.priorityColors,project:M.project,assignee:M.assignee,dueDate:Q2(M.dueDate,v),progress:M.progress,tags:M.tags,badgeSize:"sm"}),we=(M,xe)=>{const me=le(M,xe),De=q==="month"?"esp-task-calendar-task-button":"esp-task-calendar-task-card-button";return d?h.jsx("button",{type:"button",className:De,onClick:Le=>{Le.stopPropagation(),d(M,xe.date)},children:me},`${M.id}-${Jr(xe.date)}-${q}`):h.jsx("div",{className:"esp-task-calendar-task-slot",children:me},`${M.id}-${Jr(xe.date)}-${q}`)};return h.jsxs(lt,{ref:F,variant:k,className:ye("esp-task-calendar",J),...L,children:[h.jsxs(lt.Header,{className:"esp-task-calendar-header",children:[g||C?h.jsxs("div",{className:"esp-task-calendar-copy",children:[g?h.jsx(lt.Title,{className:"esp-task-calendar-heading",children:g}):null,C?h.jsx(lt.Description,{className:"esp-task-calendar-description",children:C}):null]}):null,h.jsxs("div",{className:"esp-task-calendar-toolbar",children:[h.jsx("div",{className:"esp-task-calendar-range-label",children:te}),h.jsxs("div",{className:"esp-task-calendar-toolbar-actions",children:[D?h.jsx("div",{className:"esp-task-calendar-view-switcher",role:"tablist","aria-label":"Calendar views",children:G.map(M=>h.jsx("button",{type:"button",className:ye("esp-task-calendar-view-button",M===q&&"is-active"),onClick:()=>Q(M),children:em[M]},M))}):null,h.jsxs("div",{className:"esp-task-calendar-nav",children:[h.jsx(jr,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ie(-1),children:"Anterior"}),h.jsx(jr,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ie(1),children:"Proximo"})]})]})]})]}),h.jsxs(lt.Body,{className:"esp-task-calendar-body",children:[q==="month"?h.jsxs("div",{className:"esp-task-calendar-grid-wrap",children:[h.jsx("div",{className:"esp-task-calendar-weekdays",children:Y.map(M=>h.jsx("div",{className:"esp-task-calendar-weekday",children:M},M))}),h.jsx("div",{className:"esp-task-calendar-grid",children:U.map(M=>{const xe=Jr(M),me=ae[xe]??[],De=me.slice(0,x),Le=me.length-De.length,ze=M.getMonth()!==ve.getMonth(),it=En(M,b),Ne=be?En(M,be):!1,tt={date:M,isOutsideMonth:ze,isToday:it,isSelected:Ne,view:q};return h.jsxs("div",{className:ye("esp-task-calendar-day",ze&&"esp-task-calendar-day-outside",it&&"esp-task-calendar-day-today",Ne&&"esp-task-calendar-day-selected"),children:[h.jsxs("button",{type:"button",className:"esp-task-calendar-day-button",onClick:()=>l==null?void 0:l(new Date(M)),children:[h.jsx("span",{className:"esp-task-calendar-day-number",children:M.getDate()}),me.length?h.jsx("span",{className:"esp-task-calendar-day-count",children:me.length}):null]}),h.jsxs("div",{className:"esp-task-calendar-day-items",children:[De.map(Ue=>we(Ue,tt)),Le>0?h.jsxs("button",{type:"button",className:"esp-task-calendar-more",onClick:()=>l==null?void 0:l(new Date(M)),children:["+",Le," mais"]}):null]})]},xe)})})]}):null,q==="week"?h.jsx("div",{className:"esp-task-calendar-week-grid",children:U.map(M=>{const xe=Jr(M),me=ae[xe]??[],De=En(M,b),Le=be?En(M,be):!1,ze={date:M,isOutsideMonth:!1,isToday:De,isSelected:Le,view:q};return h.jsxs("div",{className:ye("esp-task-calendar-week-column",De&&"esp-task-calendar-week-column-today",Le&&"esp-task-calendar-week-column-selected"),children:[h.jsxs("button",{type:"button",className:"esp-task-calendar-week-head",onClick:()=>l==null?void 0:l(new Date(M)),children:[h.jsx("span",{className:"esp-task-calendar-week-head-label",children:O.format(M).replace(".","")}),h.jsx("span",{className:"esp-task-calendar-week-head-date",children:I.format(M)})]}),h.jsx("div",{className:"esp-task-calendar-week-items",children:me.length?me.map(it=>we(it,ze)):h.jsx("div",{className:"esp-task-calendar-inline-empty",children:"Sem tarefas"})})]},xe)})}):null,q==="day"?h.jsxs("div",{className:"esp-task-calendar-day-panel",children:[h.jsxs("div",{className:"esp-task-calendar-day-panel-head",children:[h.jsx("span",{className:"esp-task-calendar-day-panel-label",children:"Dia selecionado"}),h.jsx("strong",{className:"esp-task-calendar-day-panel-date",children:te})]}),h.jsx("div",{className:"esp-task-calendar-day-panel-list",children:(ae[Jr(ve)]??[]).length?(ae[Jr(ve)]??[]).map(M=>we(M,{date:ve,isOutsideMonth:!1,isToday:En(ve,b),isSelected:be?En(ve,be):!1,view:q})):h.jsx("div",{className:"esp-task-calendar-inline-empty",children:N})})]}):null,q==="month"&&j===0?h.jsx("div",{className:"esp-task-calendar-empty",children:N}):null]})]})}),Gm="",rm=24*60*60*1e3,nm=e=>/^\d{4}-\d{2}-\d{2}$/.test(e),ea=e=>{if(!e)return null;if(e instanceof Date)return new Date(e.getTime());if(typeof e=="string"&&nm(e)){const[r,n,a]=e.split("-").map(Number);return new Date(r,n-1,a)}const t=new Date(e);return Number.isNaN(t.getTime())?null:t},vr=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),zl=e=>new Date(e.getFullYear(),e.getMonth(),1),am=e=>new Date(e.getFullYear(),e.getMonth()+1,0),ta=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),sm=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),Yl=(e,t)=>{const r=vr(e),n=(r.getDay()-t+7)%7;return ta(r,-n)},ai=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),si=(e,t,r)=>Math.min(Math.max(e,t),r),ii=e=>vr(ea(e)??new Date),jl=e=>{const t=ea(e.startDate),r=ea(e.endDate??e.startDate);if(!t||!r)return null;const n=vr(t),a=vr(r);return n<=a?{start:n,end:a}:{start:a,end:n}},im=e=>{const t=ea(e.startDate),r=ea(e.endDate);if(t||r){const a=vr(t??r??new Date),s=vr(r??t??new Date);return a<=s?{start:a,end:s}:{start:s,end:a}}const n=e.items.map(a=>jl(a)).filter(Boolean);return n.length===0?null:n.reduce((a,s)=>({start:s.start<a.start?s.start:a.start,end:s.end>a.end?s.end:a.end}),n[0])},Kl=(e,t)=>Math.round((vr(t).getTime()-vr(e).getTime())/rm),om=(e,t,r)=>{if(e==="week"){const i=Yl(t,r);return Array.from({length:7},(o,c)=>ta(i,c))}const n=zl(t),a=am(t),s=[];for(let i=new Date(n);i<=a;i=ta(i,1))s.push(new Date(i));return s},lm=(e,t,r,n)=>{if(e==="week"){const a=Yl(t,n),s=ta(a,6),i=new Intl.DateTimeFormat(r,{day:"numeric",month:"short"}),o=new Intl.DateTimeFormat(r,{day:"numeric",month:"short",year:"numeric"});return`${i.format(a)} - ${o.format(s)}`}return new Intl.DateTimeFormat(r,{month:"long",year:"numeric"}).format(zl(t))},Jl=(e,t,r,n)=>{if(!e)return null;const a=e.start<t?t:e.start,s=e.end>r?r:e.end;if(a>s)return null;const i=Kl(t,a),o=Kl(t,s),c=i/n*100,l=(o-i+1)/n*100;return{left:c,width:l}},ql=e=>{if(e.progress!==void 0)return si(e.progress,0,100);const t=e.items.map(n=>n.progress).filter(n=>typeof n=="number");if(t.length===0)return;const r=t.reduce((n,a)=>n+a,0)/t.length;return Math.round(r)},cm=e=>e==="project"?"Project":e==="assignee"?"Assignee":"Group",fm={week:"Semana",month:"Mes"},hm=w.forwardRef(function({groups:t,view:r,defaultView:n="month",onViewChange:a,date:s,defaultDate:i,onDateChange:o,locale:c="pt-BR",heading:l,description:f,emptyLabel:u="Sem itens no periodo selecionado.",showViewSwitcher:d=!1,views:x,leftColumnWidth:v=320,onItemClick:p,onGroupClick:g,renderItemLabel:C,renderGroupLabel:N,className:y,variant:D="outlined",...R},J){const k=r!==void 0,[L,F]=w.useState(n),W=x!=null&&x.length?x:["week","month"],B=k?r:L,[V,q]=w.useState(()=>ii(i)),G=s!==void 0?ii(s):V;w.useEffect(()=>{r!==void 0&&F(r)},[r]),w.useEffect(()=>{s!==void 0&&q(ii(s))},[s]);const ie=w.useMemo(()=>om(B,G,1),[B,G]),Te=ie[0],Ee=ie[ie.length-1],Oe=ie.length,ve=B==="week"?96:42,Re=lm(B,G,c,1),be=new Intl.DateTimeFormat(c,{weekday:"short"}),b=new Intl.DateTimeFormat(c,{day:"numeric"}),U=t.reduce((te,de)=>te+de.items.length,0),O=t.length>0&&U>0,I=vr(new Date),Y=te=>{k||F(te),a==null||a(te)},ne=te=>{const de=vr(te);s===void 0&&q(de),o==null||o(de)},he=te=>{if(B==="week"){ne(ta(G,te*7));return}ne(sm(G,te))},ae=te=>{const de=ql(te);return h.jsxs("div",{className:"esp-gantt-chart-group-label",children:[h.jsxs("div",{className:"esp-gantt-chart-group-header",children:[h.jsx("span",{className:"esp-gantt-chart-group-kind",children:cm(te.kind)}),h.jsx("strong",{className:"esp-gantt-chart-group-title",children:te.title})]}),te.subtitle?h.jsx("span",{className:"esp-gantt-chart-group-subtitle",children:te.subtitle}):null,h.jsxs("div",{className:"esp-gantt-chart-group-meta",children:[h.jsxs("span",{children:[te.items.length," tarefas"]}),de!==void 0?h.jsxs("span",{children:[de,"%"]}):null,te.meta?h.jsx("span",{children:te.meta}):null]})]})},j=te=>h.jsxs("div",{className:"esp-gantt-chart-item-label",children:[h.jsxs("div",{className:"esp-gantt-chart-item-header",children:[h.jsx("strong",{className:"esp-gantt-chart-item-title",children:te.title}),te.progress!==void 0?h.jsxs("span",{className:"esp-gantt-chart-item-progress",children:[si(te.progress,0,100),"%"]}):null]}),h.jsxs("div",{className:"esp-gantt-chart-item-badges",children:[te.status?h.jsx(qa,{status:te.status,name:te.statusName,colors:te.statusColors,size:"sm",variant:"soft"}):null,te.priority?h.jsx(ni,{priority:te.priority,name:te.priorityName,colors:te.priorityColors,size:"sm",variant:"soft"}):null]}),te.project||te.assignee?h.jsxs("div",{className:"esp-gantt-chart-item-contexts",children:[te.project?h.jsx("span",{className:"esp-gantt-chart-item-context-badge",children:te.project}):null,te.assignee?h.jsx("span",{className:"esp-gantt-chart-item-context-badge",children:te.assignee}):null]}):null,te.meta?h.jsx("div",{className:"esp-gantt-chart-item-meta",children:h.jsx("span",{children:te.meta})}):null]});return h.jsxs(lt,{ref:J,className:ye("esp-gantt-chart",y),variant:D,...R,children:[h.jsxs(lt.Header,{className:"esp-gantt-chart-header",children:[h.jsxs("div",{children:[l?h.jsx(lt.Title,{children:l}):null,f?h.jsx(lt.Description,{children:f}):null]}),h.jsxs("div",{className:"esp-gantt-chart-toolbar",children:[d?h.jsx(yl,{items:W.map(te=>({value:te,label:fm[te]})),value:B,onValueChange:te=>Y(te),variant:"segmented",size:"sm"}):null,h.jsxs("div",{className:"esp-gantt-chart-nav",children:[h.jsx(jr,{variant:"ghost",size:"sm",onClick:()=>he(-1),children:"Anterior"}),h.jsx("span",{className:"esp-gantt-chart-range-label",children:Re}),h.jsx(jr,{variant:"ghost",size:"sm",onClick:()=>he(1),children:"Proximo"})]})]})]}),h.jsx(lt.Body,{className:"esp-gantt-chart-body",children:h.jsx("div",{className:"esp-gantt-chart-scroll",children:h.jsxs("div",{className:"esp-gantt-chart-table",style:{"--esp-gantt-label-width":`${v}px`,"--esp-gantt-day-count":String(Oe),"--esp-gantt-day-width":`${ve}px`},children:[h.jsxs("div",{className:"esp-gantt-chart-head",children:[h.jsxs("div",{className:"esp-gantt-chart-head-label",children:[h.jsx("span",{children:"Planejamento"}),h.jsxs("strong",{children:[U," itens"]})]}),h.jsx("div",{className:"esp-gantt-chart-head-days",style:{gridTemplateColumns:`repeat(${Oe}, minmax(var(--esp-gantt-day-width), 1fr))`},children:ie.map(te=>h.jsxs("div",{className:ye("esp-gantt-chart-head-day",ai(te,I)&&"is-today"),children:[h.jsx("span",{children:be.format(te).replace(".","")}),h.jsx("strong",{children:b.format(te)})]},te.toISOString()))})]}),O?t.map(te=>{const de=im(te),Ie=Jl(de,Te,Ee,Oe),Q=ql(te);return h.jsxs(w.Fragment,{children:[h.jsxs("div",{className:"esp-gantt-chart-row esp-gantt-chart-row-group",children:[h.jsx("div",{className:ye("esp-gantt-chart-label-cell",g&&"is-clickable"),onClick:()=>g==null?void 0:g(te),children:N?N(te):ae(te)}),h.jsxs("div",{className:"esp-gantt-chart-timeline-cell",children:[h.jsx("div",{className:"esp-gantt-chart-day-grid",style:{gridTemplateColumns:`repeat(${Oe}, minmax(var(--esp-gantt-day-width), 1fr))`},children:ie.map(le=>h.jsx("span",{className:ye("esp-gantt-chart-day-cell",ai(le,I)&&"is-today")},le.toISOString()))}),Ie?h.jsxs("div",{className:"esp-gantt-chart-bar esp-gantt-chart-bar-group",style:{left:`${Ie.left}%`,width:`${Ie.width}%`,...te.color?{"--esp-gantt-bar-bg":te.color}:{}},children:[Q!==void 0?h.jsx("div",{className:"esp-gantt-chart-bar-progress",style:{width:`${Q}%`}}):null,h.jsx("span",{className:"esp-gantt-chart-bar-label",children:te.title})]}):null]})]}),te.items.map(le=>{const we=jl(le),M=Jl(we,Te,Ee,Oe),xe=le.status?`esp-gantt-chart-bar-status-${le.status}`:"",me=C?C(le,te):j(le),De=h.jsxs(h.Fragment,{children:[le.progress!==void 0?h.jsx("div",{className:"esp-gantt-chart-bar-progress",style:{width:`${si(le.progress,0,100)}%`}}):null,h.jsx("span",{className:"esp-gantt-chart-bar-label",children:le.title})]});return h.jsxs("div",{className:"esp-gantt-chart-row esp-gantt-chart-row-item",children:[h.jsx("div",{className:ye("esp-gantt-chart-label-cell",p&&"is-clickable"),onClick:()=>p==null?void 0:p(le,te),children:me}),h.jsxs("div",{className:"esp-gantt-chart-timeline-cell",children:[h.jsx("div",{className:"esp-gantt-chart-day-grid",style:{gridTemplateColumns:`repeat(${Oe}, minmax(var(--esp-gantt-day-width), 1fr))`},children:ie.map(Le=>h.jsx("span",{className:ye("esp-gantt-chart-day-cell",ai(Le,I)&&"is-today")},Le.toISOString()))}),M?p?h.jsx("button",{type:"button",className:ye("esp-gantt-chart-bar",xe),style:{left:`${M.left}%`,width:`${M.width}%`,...le.color?{"--esp-gantt-bar-bg":le.color}:{}},onClick:()=>p(le,te),children:De}):h.jsx("div",{className:ye("esp-gantt-chart-bar",xe),style:{left:`${M.left}%`,width:`${M.width}%`,...le.color?{"--esp-gantt-bar-bg":le.color}:{}},children:De}):null]})]},le.id)})]},te.id)}):h.jsx("div",{className:"esp-gantt-chart-empty",children:u})]})})})]})});function um({theme:e,variant:t="decorated",gradient:r,pattern:n="none",opacity:a,blendMode:s,fullScreen:i=!0,children:o,className:c,style:l}){const f={...l,...r?{background:r}:{},...a!==void 0?{opacity:a}:{},...s?{mixBlendMode:s}:{}};return h.jsx("div",{className:ye("bg-wrap",e&&`bg-wrap--${e}`,t==="solid"&&"bg-wrap--solid",!i&&"bg-wrap--auto",n!=="none"&&`bg-pattern-${n}`,c),style:f,children:o})}const zm="",Ym="",jm="",Zl=w.createContext(void 0),dm=({children:e,defaultTheme:t="system",storageKey:r="esperanca-ui-theme",themeVars:n})=>{const[a,s]=w.useState(()=>localStorage.getItem(r)||t),[i,o]=w.useState("light"),c=w.useCallback(f=>{const u=window.document.documentElement;u.classList.remove("light","dark");const d=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f;u.classList.add(d),u.setAttribute("data-theme",d),o(d),n&&Object.entries(n).forEach(([x,v])=>{u.style.setProperty(x.startsWith("--")?x:`--${x}`,v)})},[n]);w.useEffect(()=>{c(a)},[a,c]),w.useEffect(()=>{const f=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>{a==="system"&&c("system")};return f.addEventListener("change",u),()=>f.removeEventListener("change",u)},[a,c]);const l=f=>{localStorage.setItem(r,f),s(f)};return h.jsx(Zl.Provider,{value:{theme:a,setTheme:l,actualTheme:i},children:e})},Km="",pm=({columns:e=1,gap:t="1rem",className:r="",style:n,children:a,...s})=>{const i={...n,"--grid-gap":typeof t=="number"?`${t}px`:t},o=()=>{if(typeof e=="number")return`esp-grid-cols-${e}`;const c=[];return e.base&&c.push(`esp-grid-cols-${e.base}`),e.sm&&c.push(`sm\\:esp-grid-cols-${e.sm}`),e.md&&c.push(`md\\:esp-grid-cols-${e.md}`),e.lg&&c.push(`lg\\:esp-grid-cols-${e.lg}`),e.xl&&c.push(`xl\\:esp-grid-cols-${e.xl}`),c.join(" ")};return h.jsx("div",{className:`esp-grid ${o()} ${r}`,style:i,...s,children:a})},Jm="",Ql=({isOpen:e,onClose:t,title:r,children:n,footer:a,size:s="md",closeOnOverlayClick:i=!0,className:o="",...c})=>{const l=ts(e);return sa({Escape:()=>{e&&t()}}),w.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e?h.jsx(Qr,{children:h.jsx("div",{className:"esp-modal-overlay",onClick:i?t:void 0,children:h.jsxs("div",{className:`esp-modal-content esp-modal-${s} ${o}`,onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":r?"esp-modal-title":void 0,ref:l,...c,children:[r&&h.jsxs("div",{className:"esp-modal-header",children:[h.jsx("h2",{id:"esp-modal-title",className:"esp-modal-title",children:r}),h.jsx("button",{className:"esp-modal-close",onClick:t,"aria-label":"Close modal",children:"×"})]}),h.jsx("div",{className:"esp-modal-body",children:n}),a&&h.jsx("div",{className:"esp-modal-footer",children:a})]})})}):null},xm=({message:e,confirmLabel:t="Confirm",cancelLabel:r="Cancel",onConfirm:n,isOpen:a,onClose:s,isDestructive:i=!1,...o})=>{const c=h.jsxs(h.Fragment,{children:[h.jsx(jr,{variant:"secondary",onClick:s,style:{marginRight:"8px"},children:r}),h.jsx(jr,{variant:i?"danger":"primary",style:i?{backgroundColor:"var(--esp-color-danger, #ef4444)",borderColor:"var(--esp-color-danger, #ef4444)",color:"white"}:{},onClick:()=>{n(),s()},children:t})]});return h.jsx(Ql,{isOpen:a,onClose:s,footer:c,size:"sm",...o,children:h.jsx("p",{style:{margin:0,color:"var(--esp-text-base)"},children:e})})},qm="",gm=({id:e,message:t,type:r="info",duration:n=3e3,onClose:a})=>(w.useEffect(()=>{if(n>0){const s=setTimeout(()=>{a(e)},n);return()=>clearTimeout(s)}},[e,n,a]),h.jsxs("div",{className:`esp-toast esp-toast-${r}`,role:"alert",children:[h.jsx("span",{children:t}),h.jsx("button",{className:"esp-toast-close",onClick:()=>a(e),"aria-label":"Close",children:"×"})]})),ec=w.createContext(void 0),vm=({children:e})=>{const[t,r]=w.useState([]),n=w.useCallback((s,i="info",o=3e3)=>{const c=Math.random().toString(36).substr(2,9);r(l=>[...l,{id:c,message:s,type:i,duration:o}])},[]),a=w.useCallback(s=>{r(i=>i.filter(o=>o.id!==s))},[]);return h.jsxs(ec.Provider,{value:{addToast:n},children:[e,h.jsx(Qr,{children:h.jsx("div",{className:"esp-toast-container",children:t.map(s=>h.jsx(gm,{...s,onClose:a},s.id))})})]})},mm=()=>{const e=w.useContext(ec);if(!e)throw new Error("useToast must be used within a ToastProvider");return e},Zm="",wm=({content:e,children:t,position:r="top",delay:n=300})=>{const[a,s]=w.useState(!1),[i,o]=w.useState({top:0,left:0}),c=w.useRef(null),l=w.useRef(null),f=w.useRef(null),u=()=>{f.current=setTimeout(()=>{x(),s(!0)},n)},d=()=>{f.current&&clearTimeout(f.current),s(!1)};w.useEffect(()=>{if(a)return x(),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),()=>{window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[a,e,r]);const x=()=>{if(c.current){const v=c.current.getBoundingClientRect(),p=8;let g=0,C=0;if(l.current){const D=l.current.getBoundingClientRect();g=D.width,C=D.height}let N=0,y=0;switch(r){case"top":N=v.top-C-p,y=v.left+(v.width-g)/2;break;case"bottom":N=v.bottom+p,y=v.left+(v.width-g)/2;break;case"left":N=v.top+(v.height-C)/2,y=v.left-g-p;break;case"right":N=v.top+(v.height-C)/2,y=v.right+p;break}o({top:N,left:y})}};return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:c,onMouseEnter:u,onMouseLeave:d,onFocus:u,onBlur:d,style:{display:"inline-block"},children:t}),a&&h.jsx(Qr,{children:h.jsx("div",{ref:l,className:`esp-tooltip esp-tooltip-${r}`,style:{top:i.top,left:i.left,opacity:l.current?1:0},role:"tooltip",children:e})})]})},Qm="",_m=({size:e="md",variant:t="spinner",skeletonLines:r=3,text:n,description:a,fullScreen:s=!1,className:i="",...o})=>{const c=`esp-loading esp-loading-${e}`,l=t==="skeleton"?h.jsx(h.Fragment,{children:Array.from({length:r}).map((d,x)=>h.jsx("div",{className:`esp-skeleton-line ${x===r-1?"esp-skeleton-short":""}`},x))}):t==="dots"?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"esp-dot"}),h.jsx("span",{className:"esp-dot"}),h.jsx("span",{className:"esp-dot"})]}):h.jsx("svg",{className:"esp-spinner-svg",viewBox:"0 0 50 50",children:h.jsx("circle",{className:"esp-spinner-circle",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"5"})}),f=n||a?h.jsxs("div",{className:"esp-loading-copy",children:[n&&h.jsx("p",{className:"esp-loading-text",children:n}),a&&h.jsx("p",{className:"esp-loading-description",children:a})]}):null,u=t==="skeleton"?"esp-loading-visual esp-loading-visual-skeleton":`esp-loading-visual esp-loading-visual-${t}`;return s?h.jsx("div",{className:`esp-loading-screen ${i}`,role:"status","aria-live":"polite",...o,children:h.jsxs("div",{className:"esp-loading-screen-panel",children:[h.jsx("div",{className:u,children:h.jsx("div",{className:t==="skeleton"?"esp-skeleton-container":`${c} esp-loading-${t}`,children:l})}),f]})}):n||a?h.jsxs("div",{className:`esp-loading-stack ${i}`,role:"status","aria-live":"polite",...o,children:[h.jsx("div",{className:u,children:h.jsx("div",{className:t==="skeleton"?"esp-skeleton-container":`${c} esp-loading-${t}`,children:l})}),f]}):t==="skeleton"?h.jsx("div",{className:`esp-skeleton-container ${i}`,...o,children:l}):t==="dots"?h.jsx("div",{className:`${c} esp-loading-dots ${i}`,...o,children:l}):h.jsx("div",{className:`${c} esp-loading-spinner ${i}`,...o,children:l})},Tm=()=>{const e=w.useContext(Zl);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},Em=()=>{const[e,t]=w.useState("");return w.useEffect(()=>{let n=document.getElementById("esp-live-region");n||(n=document.createElement("div"),n.id="esp-live-region",n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.className="esp-sr-only",n.style.position="absolute",n.style.width="1px",n.style.height="1px",n.style.padding="0",n.style.margin="-1px",n.style.overflow="hidden",n.style.clip="rect(0, 0, 0, 0)",n.style.whiteSpace="nowrap",n.style.border="0",document.body.appendChild(n))},[]),{announce:w.useCallback((n,a="polite")=>{t(n);const s=document.getElementById("esp-live-region");s&&(s.setAttribute("aria-live",a),s.textContent=n,setTimeout(()=>{s.textContent===n&&(s.textContent="")},1e3))},[]),announcement:e}};ke.Background=um,ke.BarChart=H2,ke.Button=jr,ke.Card=lt,ke.CardBody=ti,ke.CardDescription=Al,ke.CardFooter=Cl,ke.CardHeader=Sl,ke.CardTitle=bl,ke.Checkbox=m2,ke.ComboBox=vi,ke.ConfirmDialog=xm,ke.DataTable=f2,ke.FormSidebar=x2,ke.GanttChart=hm,ke.Grid=pm,ke.Input=g2,ke.LineChart=Rl,ke.Loading=_m,ke.MetricCard=N2,ke.Modal=Ql,ke.PageHeader=y2,ke.Portal=Qr,ke.Radio=w2,ke.RadioGroup=_2,ke.Sidebar=p2,ke.StepLineChart=W2,ke.Tabs=yl,ke.TaskCalendar=tm,ke.TaskCard=Xl,ke.TaskPriorityBadge=ni,ke.TaskStatusBadge=qa,ke.Textarea=E2,ke.ThemeProvider=dm,ke.ToastProvider=vm,ke.Tooltip=wm,ke.createComponentClasses=es,ke.mergeClasses=ye,ke.useAnnouncements=Em,ke.useBreakpoint=u2,ke.useFocusTrap=ts,ke.useKeyboardNavigation=sa,ke.useMediaQuery=ei,ke.useTheme=Tm,ke.useToast=mm,Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"})});
112
112
  //# sourceMappingURL=componentes-esperanca.umd.js.map