import{c_ as T,U as L,a as x,r as j,c$ as B,at as w,n as E,aG as M}from"./index-DGnN4tUo.js";import{i as R,u as q,a as G,b as _,c as A,d as D,e as H,f as I,g as J,h as K,j as N,k as P,l as Q,m as V,n as W,o as X,p as Y,q as Z,r as F}from"./installCanvasRenderer-DwMtZqT-.js";q([G,_,A,D,H,I,J,K,N,P,Q,V,W,X,Y,Z,F]);function ta(h,$={}){const d=T(),g=L(),l=x(()=>g.darkMode),i=j(null),e={width:0,height:0},{width:m,height:b}=B(i,e);let a=null;const o=h(),{onRender:c=t=>{const n=l.value?"rgb(224, 224, 224)":"rgb(31, 31, 31)",C=l.value?"rgba(0, 0, 0, 0.4)":"rgba(255, 255, 255, 0.8)";t.showLoading({color:g.themeColor,textColor:n,fontSize:14,maskColor:C})},onUpdated:s=t=>{t.hideLoading()},onDestroy:u}=$;function k(){return i.value&&e.width>0&&e.height>0}function r(){return!!(i.value&&a)}async function O(t=()=>o){if(!r())return;const n=t(o,h);Object.assign(o,n),r()&&(a==null||a.clear()),a==null||a.setOption({...n,backgroundColor:"transparent"}),await(s==null?void 0:s(a))}function S(t){a==null||a.setOption(t)}async function p(){if(!r()){const t=l.value?"dark":"light";await M(),a=R(i.value,t),a.setOption({...o,backgroundColor:"transparent"}),await(c==null?void 0:c(a)),await(s==null?void 0:s(a))}}function v(){a==null||a.resize()}async function f(){a&&(await(u==null?void 0:u(a)),a==null||a.dispose(),a=null)}async function y(){await f(),await p(),await(s==null?void 0:s(a))}async function z(t,n){if(e.width=t,e.height=n,!k()){await f();return}r()&&v(),await p()}return d.run(()=>{w([m,b],([t,n])=>{z(t,n)}),w(l,()=>{y()})}),E(()=>{f(),d.stop()}),{domRef:i,updateOptions:O,setOptions:S}}export{ta as u};
