import{Q}from"./vue-datepicker-DJOolBJW.js";/* empty css             */import{u as z,c as I,n as j,m as G,a as J,p as K,o as O}from"./widget-BUAABBRb.js";import{c as X}from"./ThankYouPage-bf4cLsjC.js";import{_ as Y}from"./RequiredHint.vue_vue_type_style_index_0_lang-R4Bqx90z.js";import{u as Z}from"./translationsStore-DBJu9sBR.js";import{a as ee,C as ae,b as l,m as u,g as o,p as g,q as c,f as te,L as le,n as P,D as _,u as s,I as se}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./index-CEuXXsrq.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const re={class:"ccb-field__label"},ne={class:"ccb-field__title"},ie={key:0,class:"ccb-field-required-mark"},oe={key:0,class:"ccb-field__descriptions ccb-before"},ue={key:0,class:"ccb-field__description"},ce={class:"ccb-field__input-wrapper"},de={key:1,class:"ccb-field__descriptions ccb-after"},ve={key:0,class:"ccb-field__description"},Se=ee({__name:"DatePicker",props:{field:{}},setup(F){const A=F,{field:e}=ae(A),b=z(),k=I(),T=j(),h=O(),q=G(),d=Z(),w=J(),{parseDate:S,getDaysDifference:x,displayValueHelper:D}=K(),$=l(()=>{var a;return((a=w.getWarningTexts)==null?void 0:a.requiredMsg)||""}),p=l(()=>w.getLanguage),E=()=>D(r.value,p.value),r=l({get(){return e.value.selectedDate},set(a){e.value.selectedDate=a}}),C=l(()=>k.checkFieldRequired(e.value)),H=l(()=>e.value.placeholder?e.value.placeholder:d.getTranslations.selectDate),y=l(()=>{var a;return e.value.isHaveUnselectable?(a=e.value.notAllowedWeekDays)==null?void 0:a.map(t=>t===7?0:t):[]}),B=l(()=>{var n;const a=new Date;let t=[];if(!e.value.isHaveUnselectable)return t;for(let i=1;i<=e.value.daysFromCurrent;i++){const v=new Date(a);v.setDate(v.getDate()+i),t.push(v)}return(n=e.value.notAllowedDates)!=null&&n.current&&t.push(a),t}),U=l(()=>{var a;return e.value.isHaveUnselectable&&((a=e.value.notAllowedDates)!=null&&a.allPast)?new Date:""}),N=l(()=>{const a=[];if(!e.value.isHaveUnselectable)return a;const t=e.value.notAllowedDates;if(t&&t.period&&t.period.length)for(const n of t.period){const i=new Date(S(n.start||"")),v=new Date(S(n.end||""));for(let f=new Date(i);f<=v;f.setDate(f.getDate()+1))a.push(new Date(f))}return a}),m=l(()=>[...N.value,...B.value]),W=l(()=>{var a;return e.value.dayPriceEnabled?e.value.useCurrency||e.value.fieldCurrency?h.getCommonFieldDisplayView(e.value):((a=e.value.value)==null?void 0:a.toString())||"":D(r.value,p.value)}),L=l(()=>{var a;if(e.value.dayPriceEnabled){const t=[D(r.value,p.value)],n=e.value.useCurrency||e.value.fieldCurrency?h.getCommonFieldDisplayView(e.value):(a=e.value.value)==null?void 0:a.toString();if(e.value.range&&Array.isArray(r.value)){const i=x(r.value[0],r.value[1],e.value,m.value,y.value);i&&t.push(`${i} ${d.getTranslations.days} x ${e.value.dayPrice}`)}else r.value&&t.push(`1 ${d.getTranslations.days} x ${n}`);return t}return[]}),M=l(()=>e.value.dayPriceEnabled?Array.isArray(r.value)?x(r.value[0],r.value[1],e.value,m.value,y.value)*e.value.dayPrice:(r.value?1:0)*e.value.dayPrice:0),V=(a,t,n)=>{t&&t!==e.value.alias||(e.value.selectedDate=a||void 0,e.value.value=M.value,e.value.displayValue=W.value,e.value.extraDisplayView=L.value,k.updateField(e.value.alias,e.value,n),T.applyConditionForField(e.value.alias))},R=l(()=>{var a;return((a=e.value)==null?void 0:a.additionalStyles)||""});return q.add("updateDatePicker",V),(a,t)=>(o(),u("div",{class:se(["ccb-field ccb-datePicker",{required:C.value,"ccb-field-disabled":s(e).disabled,[R.value]:!0}])},[g("div",re,[C.value?(o(),te(Y,{key:0,text:$.value},null,8,["text"])):c("",!0),g("div",ne,[le(_(s(e).label),1),s(e).required?(o(),u("span",ie,"*")):c("",!0),P(X)])]),s(b).descriptionPosition==="before"?(o(),u("div",oe,[s(e).description?(o(),u("div",ue,_(s(e).description),1)):c("",!0)])):c("",!0),g("div",ce,[P(s(Q),{modelValue:r.value,"onUpdate:modelValue":[t[0]||(t[0]=n=>r.value=n),V],locale:p.value,"auto-apply":s(e).autoCloseEnabled,range:s(e).range,placeholder:H.value,"enable-time-picker":!1,"disabled-week-days":y.value,"disabled-dates":m.value,"min-date":U.value,format:E,"select-text":s(d).getTranslations.select,"cancel-text":s(d).getTranslations.cancel},null,8,["modelValue","locale","auto-apply","range","placeholder","disabled-week-days","disabled-dates","min-date","select-text","cancel-text"])]),s(b).descriptionPosition==="after"?(o(),u("div",de,[s(e).description?(o(),u("div",ve,_(s(e).description),1)):c("",!0)])):c("",!0)],2))}});export{Se as default};
//# sourceMappingURL=index-B6EmZjMg.js.map
