var g=(p,u,a)=>new Promise((t,i)=>{var _=e=>{try{n(a.next(e))}catch(l){i(l)}},v=e=>{try{n(a.throw(e))}catch(l){i(l)}},n=e=>e.done?t(e.value):Promise.resolve(e.value).then(_,v);n((a=a.apply(p,u)).next())});import{_ as x}from"./Dialog.vue_vue_type_style_index_0_lang-Crgw5i7b.js";import{_ as w}from"./check.vue_vue_type_script_setup_true_lang-Bd3x-oqB.js";import{d as b,a8 as h,n as M}from"./element-plus-DNKe9-lk.js";import{l as $,aK as E,r as d,aJ as F,ai as N,m,p as k,F as O,a7 as S,u as r,U as c,O as s,S as f,M as B,R as T,T as C}from"./vue-chunks-DyZSmvoe.js";const D={class:"flex flex-wrap flex-shrink-0"},J=$({__name:"material",props:E({formModel:{type:Object,default:()=>({})},onchange:{type:Function,default:()=>{}},flag:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const u=d(null);let a=F(p,"modelValue");d("");const t=d(!1),i=d(!1),_=e=>{a.value.splice(a.value.indexOf(e),1)},v=()=>{t.value=!0},n=()=>g(this,null,function*(){const e=yield u.value.getSelect(),l=h([...e,...a.value],"materialId");a.value=[...l],t.value=!1});return(e,l)=>{const y=N("BaseButton");return m(),k("div",D,[(m(!0),k(O,null,S(r(a),(o,V)=>(m(),B(r(M),{key:V,closable:"",size:"large",class:"mr-4 mb-3","disable-transitions":!1,onClose:I=>_(o)},{default:s(()=>[f(C(o.name)+" - "+C(o.tag),1)]),_:2},1032,["onClose"]))),128)),c(r(x),{style:{width:"70% !important"},modelValue:t.value,"onUpdate:modelValue":l[1]||(l[1]=o=>t.value=o),title:"选择素材"},{footer:s(()=>[c(y,{type:"primary",loading:i.value,onClick:n},{default:s(()=>[f(" 保存 ")]),_:1},8,["loading"]),c(y,{onClick:l[0]||(l[0]=o=>t.value=!1)},{default:s(()=>[f("关闭")]),_:1})]),default:s(()=>[c(w,{ref_key:"child",ref:u,model:r(a)},null,8,["model"])]),_:1},8,["modelValue"]),t.value?T("",!0):(m(),B(r(b),{key:0,class:"button-new-tag",onClick:v},{default:s(()=>[f(" + 选择素材 ")]),_:1}))])}}});export{J as _};
