"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),u=require("lodash"),y=require("../../commons/core/datasource/index.js"),c=require("../../commons/utils/json2css.js"),v=["ztitle"],w=t.defineComponent({name:"zv-text-text-dynamic"}),S=t.defineComponent({...w,props:{basicOption:{},sources:{},useEvents:{},uuid:{}},setup(d,{expose:f}){const o=d,p=()=>{const n=t.ref(""),r=e=>{c.autoInstallFont(e.fontFamily);const a={};e.color&&e.color.includes("linear-gradient")&&(a.backgroundImage=e.color,a["-webkit-background-clip"]="text",a.color="transparent");const h={};return e.textAlign==="left"&&(e.justifyContent="flex-start"),e.textAlign==="center"&&(e.justifyContent="center"),e.textAlign==="right"&&(e.justifyContent="flex-end"),{...c.jsonToCssStyle(e),...a,...h,...e.textShadow.show?{"--text-shadow":`${e.textShadow.x}px ${e.textShadow.y}px ${e.textShadow.value}px ${e.textShadow.color}`}:{}}},s=()=>{y.SHJDatasourceV2.parse({tId:o.uuid,sources:o.sources,callback:({data:e})=>{try{window.SHJParseEvent(o.useEvents,"dataListener",e),n.value=e[0].data[0].value}catch{window.SHJParseEvent(o.useEvents,"dataListener",null)}}})};return t.onMounted(()=>t.nextTick(()=>s())),{rendererDomStyle:r,init:s,value:n}},{rendererDomStyle:x,init:i,value:l}=p();return t.watch(()=>u.cloneDeep(o.basicOption),(n,r)=>{u.isEqual(n,r)||i()},{deep:!0}),t.watch(()=>u.cloneDeep(o.sources),(n,r)=>{u.isEqual(n,r)||i()},{deep:!0}),f({refresh:()=>i(),refreshView:()=>i(),refreshData:()=>i()}),(n,r)=>(t.openBlock(),t.createElementBlock("p",{class:"zerov-widget-text",style:t.normalizeStyle(t.unref(x)(n.basicOption.css)),ztitle:t.unref(l)},t.toDisplayString(t.unref(l)),13,v))}});exports.default=S;
