import{extend}from"../common/util";import{onRender,removeRender}from"../core/executer";export default function definePlugin(a,b){return c=>{return d=>{let e=b.setup(c,d),f="function"==typeof b.render;const g=a=>{f&&b.render.call(e,a)};return f&&onRender(g),extend({type:"plugin",name:a,render:g,remove:()=>{"function"==typeof b.destroyed&&b.destroyed.call(e),f&&removeRender(g)}},e)}}}