import{d as I,a as h,I as L,J as Y,s as E,u as m,e as c,f as d,F as O,j as D,n as S,t as F,A as k,g as C}from"./index.0308b213.js";import{i as $}from"./isBetween.903653b2.js";const T=[15,30,45,60,1440],y=60*24;function R(r){return r>=y&&r%y===0}function M(r){if(!T.includes(r)&&!R(r))throw new RangeError(`\u9519\u8BEF\u7684scale\u503C\uFF0C\u8F93\u5165\u503C\u4E3A${r},\u53EF\u7528\u7684scale\u503C\u4E3A${T.join(",")},\u6216\u8005\u4E3A1440\u7684\u6574\u6570\u500D`);return!0}function N(r,t=60){M(t);let o,a=r.clone(),f=t/60;return t>60?(o=Math.floor(r.hour()/f),a=a.hour(o*f).minute(0).second(0)):(o=Math.floor(r.minute()/t),a=a.minute(o*t).second(0)),a}function U(r,t,o=60){if(r.isAfter(t))throw new TypeError("\u9519\u8BEF\u7684\u53C2\u6570\u987A\u5E8F\uFF0C\u51FD\u6570calcScalesAbout2Times\u7684\u7B2C\u4E00\u4E2A\u65F6\u95F4\u53C2\u6570\u5FC5\u987B\u5927\u4E8E\u7B2C\u4E8C\u4E2A\u65F6\u95F4\u53C2\u6570");M(o);let a=N(r,o),f=0;for(;!a.isAfter(t);)f++,a=a.add(o,"minute");return f}const q={class:"task-timeline"},P={key:0,class:"task-timeline-scale",style:{height:"100%"}},V={key:1,class:"task-timeline-scale"},z={style:{"font-weight":"bold"}},G=I({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:[h,null],startTimeOfRenderArea:[h,null],getPositionOffset:{type:Function}},setup(r){const t=r;h.extend(L),h.extend(Y),h.extend($);const o=Symbol(),a=Symbol(),f=Symbol(),v={0:"\u65E5",1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D"};function p(s,n){return s.isSame(n,"day")}function x(s,n,e){return e.isSameOrAfter(s)&&e.isSameOrBefore(n)}const j=E(()=>t.startTimeOfRenderArea.startOf("day")),W=E(()=>t.endTimeOfRenderArea.endOf("day")),w=E(()=>R(t.scale)),_=E(()=>{const s=[],{start:n,end:e,scale:u}=t;let l=n.clone().startOf("day"),i=m(w)&&u>y?u/y:1;for(;l.isSameOrBefore(e);)s.push(l),l=l.add(i,"day");return s}),b=E(()=>({width:`${t.cellWidth}px`})),H=s=>{const{scale:n}=t,e=m(j),u=m(W);return n>=y&&e.isBetween(s,s.add(n/y,"day"))?!0:!!x(e,u,s)},g=s=>{const{start:n,end:e}=t;return p(s,n)?B(o):p(s,e)?B(f):B(a)},B=s=>{const n=[],{start:e,end:u,scale:l}=t;let i,A;switch(s){case o:i=N(e,l),p(e,u)?A=u:A=e.endOf("day");break;case f:i=u.startOf("day"),A=u;break;case a:i=e.startOf("day"),A=e.endOf("day");break;default:throw new TypeError("\u9519\u8BEF\u7684\u8BA1\u7B97\u7C7B\u578B")}for(;!i.isAfter(A);)n.push(i),i=i.add(l,"minute");return n};return(s,n)=>(c(),d("div",q,[t.taskMode==="date"?(c(!0),d(O,{key:0},D(m(_),(e,u)=>(c(),d(O,{key:u},[H(e)?(c(),d("div",{key:0,class:"task-timeline-block",style:S({width:g(e).length*r.cellWidth+"px"})},[m(w)?k("",!0):(c(),d("div",P,[(c(!0),d(O,null,D(g(e),(l,i)=>(c(),d("div",{style:S(m(b)),key:i},F(r.scale>=60?l.format("HH"):l.format("HH:mm")),5))),128))]))],4)):k("",!0)],64))),128)):k("",!0),t.taskMode==="week"?(c(),d("div",V,[(c(!0),d(O,null,D(m(_),(e,u)=>(c(),d("div",{style:S(m(b)),key:u},[C("span",z,F(e.format("DD")),1),C("span",null,F(v[u]),1)],4))),128))])):k("",!0)]))}});export{G as _,U as c,N as g};
