import{d as W,a as u,I as j,J as C,s as m,u as c,e as l,f as o,F as f,j as D,n as S,t as A,A as y,g as R}from"./index.0308b213.js";import{i as H}from"./isBetween.903653b2.js";import{i as I,M as O,g as Y}from"./timeline.e28e5f81.js";const L={class:"task-timeline"},q={key:0,class:"task-timeline-scale",style:{height:"100%"}},P={key:1,class:"task-timeline-scale"},V={style:{"font-weight":"bold"}},K=W({props:{start:{type:Object,required:!0},end:{type:Object,required:!0},taskMode:{type:String,default:"date"},cellWidth:{type:Number,default:0},scale:{type:Number,default:0},endTimeOfRenderArea:[u,null],startTimeOfRenderArea:[u,null],getPositionOffset:{type:Function}},setup(p){const n=p;u.extend(j),u.extend(C),u.extend(H);const B=Symbol(),_=Symbol(),g=Symbol(),N={0:"\u65E5",1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D"};function k(t,s){return t.isSame(s,"day")}function M(t,s,e){return e.isSameOrAfter(t)&&e.isSameOrBefore(s)}const v=m(()=>n.startTimeOfRenderArea.startOf("day")),x=m(()=>n.endTimeOfRenderArea.endOf("day")),b=m(()=>I(n.scale)),E=m(()=>{const t=[],{start:s,end:e,scale:a}=n;let i=s.clone().startOf("day"),r=c(b)&&a>O?a/O:1;for(;i.isSameOrBefore(e);)t.push(i),i=i.add(r,"day");return t}),w=m(()=>({width:`${n.cellWidth}px`})),F=t=>{const{scale:s}=n,e=c(v),a=c(x);return s>=O&&e.isBetween(t,t.add(s/O,"day"))?!0:!!M(e,a,t)},T=t=>{const{start:s,end:e}=n;return k(t,s)?h(B):k(t,e)?h(g):h(_)},h=t=>{const s=[],{start:e,end:a,scale:i}=n;let r,d;switch(t){case B:r=Y(e,i),k(e,a)?d=a:d=e.endOf("day");break;case g:r=a.startOf("day"),d=a;break;case _:r=e.startOf("day"),d=e.endOf("day");break;default:throw new TypeError("\u9519\u8BEF\u7684\u8BA1\u7B97\u7C7B\u578B")}for(;!r.isAfter(d);)s.push(r),r=r.add(i,"minute");return s};return(t,s)=>(l(),o("div",L,[n.taskMode==="date"?(l(!0),o(f,{key:0},D(c(E),(e,a)=>(l(),o(f,{key:a},[F(e)?(l(),o("div",{key:0,class:"task-timeline-block",style:S({width:T(e).length*p.cellWidth+"px"})},[c(b)?y("",!0):(l(),o("div",q,[(l(!0),o(f,null,D(T(e),(i,r)=>(l(),o("div",{style:S(c(w)),key:r},A(p.scale>=60?i.format("HH"):i.format("HH:mm")),5))),128))]))],4)):y("",!0)],64))),128)):y("",!0),n.taskMode==="week"?(l(),o("div",P,[(l(!0),o(f,null,D(c(E),(e,a)=>(l(),o("div",{style:S(c(w)),key:a},[R("span",V,A(e.format("DD")),1),R("span",null,A(N[a]),1)],4))),128))])):y("",!0)]))}});export{K as _};
