import{d as w,r as l,N as _,G as c,o as u,e as x,z as y,w as f,b as e,a as k,t as E,c as V,aa as b,h as A}from"./BvNnk7SS.js";import{_ as B}from"./DZKfetH0.js";import N from"./MydFM54h.js";import{_ as O}from"./DxIKOKPC.js";import{u as $}from"./CIaRsw82.js";import"./a7ZBoMfv.js";import"./BxD-9MY-.js";import"./BOtdTvFK.js";import"./CYKwSea8.js";import"./BJLPbHX2.js";import"./DQ_4YmnO.js";import"./DGhmaXto.js";import"./9QyWfnsF.js";import"./eQq4h1B_.js";const z=b(B),D=b(N),F={"text-sm":"","font-mono":"","first-letter:capitalize":""},W=w({__name:"ChartEditor",props:{contentRef:{type:[String,Object,Function]},view:{},getPos:{type:Function},setAttrs:{type:Function},node:{},selected:{},decorations:{},innerDecorations:{}},setup(g){const C=g,d=["bar","line","pie","donut"],{getComponentProps:h}=$(),{model:t,mdcAttrs:n}=h(C,{id:{type:String},class:{type:String,default:""},type:{type:String,default:"bar",validator(a){return d.includes(a)}},data:{type:[String,Array,Object]},labels:{type:Array}}),m=l();if(typeof _<"u"){const{editItem:a}=_(),{currentContentKeys:r}=A();c(n,o=>{m.value=o.data}),c(t,()=>{if(typeof t.data!="string")return;const o=`${r.value}:${t.data.replace("/",":")}`,{content:i}=a(o);c(i,async s=>{try{m.value=JSON.parse(s)}catch(p){console.log(p,s)}})})}const S=l(null),v=l("base");return c(t,()=>{}),(a,r)=>{const o=z,i=D,s=O;return u(),x("div",null,[y(i,{mb1:""},{default:f(()=>[y(o,{modelValue:e(n).type,"onUpdate:modelValue":r[0]||(r[0]=p=>e(n).type=p),chevron:"",tooltip:"Type",items:d},{default:f(()=>[k("span",F,E(e(n).type),1)]),_:1},8,["modelValue"])]),_:1}),(u(),V(s,{ref_key:"chart",ref:S,key:v.value,contenteditable:"false",type:e(t).type,data:e(t).data,labels:e(t).labels},null,8,["type","data","labels"]))])}}});export{W as default};
