"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),s=require("lodash"),i=require("dayjs");require("dayjs/locale/zh-cn");const d=require("../../commons/utils/json2css.js"),S=["ztitle"],w=t.defineComponent({name:"zv-text-real-time"}),T=t.defineComponent({...w,props:{basicOption:{},datasource:{},useEvents:{}},emits:["on-change"],setup(f,{emit:m}){const u=m,r=f,v=o=>{const n=t.ref(),a=t.ref(i().locale("zh-cn").format(o.format)),x=e=>{d.autoInstallFont(e.fontFamily);const l={};e.color&&e.color.includes("linear-gradient")&&(l.backgroundImage=e.color,l["-webkit-background-clip"]="text",l.color="transparent");const y={};return e.textAlign==="left"&&(e.justifyContent="flex-start"),e.textAlign==="center"&&(e.justifyContent="center"),e.textAlign==="right"&&(e.justifyContent="flex-end"),{...d.jsonToCssStyle(e),...l,...y,...e.textShadow.show?{"--text-shadow":`${e.textShadow.x}px ${e.textShadow.y}px ${e.textShadow.value}px ${e.textShadow.color}`}:{}}},g=e=>{n.value&&clearInterval(n.value),n.value=setInterval(()=>{a.value=i().locale("zh-cn").format(e),u("on-change",a.value),window.SHJParseEvent(r.useEvents,"on-change",a.value)},1e3)};return t.onMounted(()=>{n.value=setInterval(()=>{a.value=i().locale("zh-cn").format(o.format),u("on-change",a.value),window.SHJParseEvent(r.useEvents,"on-change",a.value)},1e3)}),t.onBeforeUnmount(()=>{n.value&&clearInterval(n.value)}),{updateRealTime:g,realTime:a,rendererDomStyle:x}},{updateRealTime:p,realTime:c,rendererDomStyle:h}=v(r.basicOption);return t.watch(()=>s.cloneDeep(r.basicOption.format),(o,n)=>{s.isEqual(o,n)||p(o)},{deep:!0}),(o,n)=>(t.openBlock(),t.createElementBlock("div",{class:"real-time",style:t.normalizeStyle(t.unref(h)(o.basicOption.css)),ztitle:t.unref(c)},t.toDisplayString(t.unref(c)),13,S))}});exports.default=T;
