"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),l=require("lodash"),r=require("../../utils/json2css.js"),m=["onClick"],x=t.defineComponent({name:"zv-interaction-tabs"}),g=t.defineComponent({...x,props:{basicOption:{},sceneOption:{},useEvents:{}},emits:["on-click-item","on-change"],setup(i,{emit:b}){const d=b,n=i,p=()=>{const o=t.ref(),a=e=>!e.startsWith("http")&&!e.startsWith("//")?"../"+e:e;return{rendererTabDomStyle:e=>o.value?{...r.jsonToCssStyle(e)}:{},rendererTabItemDomStyle:e=>{if(o.value){r.autoInstallFont(e.fontFamily),r.autoInstallFont(e.selected.fontFamily);const y=`url(${e.backgroundImage})`,w=`url(${a(e.selected.backgroundImage)})`;return{...r.jsonToCssStyle(e),...r.jsonToCssStyle(e.selected,"selected"),...e.textShadow&&e.textShadow.show?{"--text-shadow":`${e.textShadow.x}px ${e.textShadow.y}px ${e.textShadow.value}px ${e.textShadow.color}`}:{},...e.selected.textShadow&&e.selected.textShadow.show?{"--selected-text-shadow":`${e.selected.textShadow.x}px ${e.selected.textShadow.y}px ${e.selected.textShadow.value}px ${e.selected.textShadow.color}`}:{},"--item-background-image":y,"--selected-background-image":w}}return{}},tabsRef:o}},c=t.ref(n.basicOption.value),S=o=>{c.value.map(a=>a.selected=!1),o.selected=!0,d("on-click-item",o),n.useEvents&&l.isArray(n.useEvents)&&window.SHJParseEvent(n.useEvents.filter(a=>a.clickname===o.id),"on-click-item"),d("on-change",o),n.useEvents&&l.isArray(n.useEvents)&&window.SHJParseEvent(n.useEvents,"on-change",{data:o.label})},{rendererTabDomStyle:h,rendererTabItemDomStyle:f,tabsRef:v}=p();return t.watch(()=>l.cloneDeep(n.basicOption),(o,a)=>{l.isEqual(o,a)||(c.value=n.basicOption.value)},{deep:!0}),(o,a)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"tabsRef",ref:v,class:"zerov-widget-tabs",style:t.normalizeStyle({...t.unref(h)(o.basicOption.css.tab)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(s,u)=>(t.openBlock(),t.createElementBlock("div",{key:u,class:t.normalizeClass(["tab-item",{selected:s.selected}]),style:t.normalizeStyle({...t.unref(f)(o.basicOption.css.item),borderRadius:o.basicOption.css.tab.borderRadius+"px"}),onClick:t.withModifiers(e=>S(s),["stop"])},t.toDisplayString(s.label),15,m))),128))],4))}});exports.default=g;
