import{L as c,b as D}from"./app-core.82d0a9b8.js";import{S as b}from"./Calendar.6723ace6.js";import{S}from"./Pencil.b091de6b.js";import{E as V,e as C}from"./vendor-date-picker.f5050174.js";import{as as d,f as s,i as n,a0 as p,j as m,O as f,ae as h,U as i,M as u,T as x,P as R}from"./vendor-vue-ui.02763c14.js";import{_ as A}from"./_plugin-vue_export-helper.eefbdd86.js";import{_ as g}from"./vendor-other.2cdd5822.js";const _="all-in-one-seo-pack",B={emits:["change","updated"],setup(){return{rootStore:D(),locale:C}},components:{ElDatePicker:V,SvgCalendar:b,SvgCircleClose:S},props:{size:{type:String,default(){return"default"}},type:{type:String,default(){return"daterange"}},separator:{type:String,default(){return"-"}},clearable:{type:Boolean,default(){return!0}},isDisabledDate:{type:Function,default(){return!1}},shortcuts:{type:Array,default(){return[]}},defaultRolling:{type:String,default(){return null}},placeholder:{type:String,default(){return null}},dateFormat:String,defaultValue:[Array,Object]},data(){return{rolling:null,value:null,strings:{startDate:g("Start Date",_),endDate:g("End Date",_)}}},computed:{format(){return this.rootStore.aioseo.data.dateFormat},label(){if(!this.value)return" ";if(!this.isDateRange)return c(this.value,this.format);const o=c(this.value[0],this.format),t=c(this.value[1],this.format);return[o,t]},isDateRange(){return Array.isArray(this.value)}},methods:{openPicker(){this.$refs.picker.focus()},clear(){this.value=null,this.$emit("change",this.value,this.rolling)}},mounted(){this.$nextTick(()=>{!this.value&&this.defaultValue&&(this.value=this.defaultValue)}),this.rolling=this.defaultRolling,window.aioseoBus.$on("rolling",o=>{this.rolling=o}),this.$emit("updated",this.rolling)},updated(){this.$emit("updated",this.rolling),this.$nextTick(()=>{this.rolling=""})}},P={class:"aioseo-datepicker"},z={class:"label"},E={key:0},F={key:1,class:"placeholder"};function N(o,t,a,T,l,e){const y=d("el-date-picker"),k=d("svg-calendar"),v=d("svg-circle-close");return s(),n("div",P,[p(y,{modelValue:l.value,"onUpdate:modelValue":t[0]||(t[0]=r=>l.value=r),ref:"picker",type:a.type,size:a.size,"range-separator":a.separator,onChange:t[1]||(t[1]=r=>o.$emit("change",r,l.rolling)),clearable:!1,shortcuts:a.shortcuts,"disabled-date":a.isDisabledDate,"start-placeholder":l.strings.startDate,"end-placeholder":l.strings.endDate},null,8,["modelValue","type","size","range-separator","shortcuts","disabled-date","start-placeholder","end-placeholder"]),m("div",{class:R(["aioseo-datepicker-picker",[`aioseo-datepicker-picker--${a.size}`]]),onClick:t[3]||(t[3]=(...r)=>e.openPicker&&e.openPicker(...r))},[p(k),m("div",z,[e.isDateRange?(s(),n(f,{key:0},[h(i(e.label[0])+" ",1),m("span",null,i(a.separator),1),h(" "+i(e.label[1]),1)],64)):u("",!0),e.isDateRange?u("",!0):(s(),n(f,{key:1},[e.label.trim()?(s(),n("span",E,i(e.label),1)):u("",!0),!e.label.trim()&&a.placeholder?(s(),n("span",F,i(a.placeholder),1)):u("",!0)],64))]),a.clearable&&l.value?(s(),n("div",{key:0,class:"clear",onClick:t[2]||(t[2]=x((...r)=>e.clear&&e.clear(...r),["stop"]))},[p(v)])):u("",!0)],2)])}const G=A(B,[["render",N]]);export{G as B};
