"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),y=require("element-plus"),f=Symbol("ModalStateToken"),g=()=>e.inject(f,{});function S(r,n){var l,o;const s=e.getCurrentInstance(),i=s.provides[f];let t=g();i&&(t=i);const a=(l=t.action)==null?void 0:l.getModalId(r),d=e.ref(!0),h=(o=t.store)==null?void 0:o[a];return{show:c=>{var p,m;if((d.value||!h)&&((p=t.action)==null||p.register(a,r,n,s==null?void 0:s.provides),d.value=!1),!t.modalPromise[a]){let v,_;const b=new Promise((w,T)=>{v=w,_=T});t.modalPromise[a]={promise:b,reject:_,resolve:v}}return(m=t.action)==null||m.show(a,c),t.modalPromise[a].promise},hide:()=>{var c;return(c=t.action)==null?void 0:c.hide(a)}}}const u=new WeakMap,P=(...r)=>{var n;const l=r[0],o=(n=e.getCurrentInstance())==null?void 0:n.proxy;if(o==null)throw new Error("injectLocal must be called in setup");return u.has(o)&&l in u.get(o)?u.get(o)[l]:e.inject(...r)};typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const k=Symbol("FORM_PROVIDER_CONTEXT"),M=()=>P(k),C=e.defineComponent({__name:"Action",props:{component:{},params:{},label:{},row:{},buttonType:{}},setup(r){const n=r,l=S(n.component),o=M(),s=()=>{l.show({...n.params,row:n.row}).then(()=>{o==null||o.reload()})};return(i,t)=>(e.openBlock(),e.createBlock(e.unref(y.ElButton),{size:"small",plain:"",type:i.buttonType,onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["type"]))}});exports.default=C;
//# sourceMappingURL=Action.js.map
