import{j as u,aY as x,X as t}from"./vendor-mui-core-CDEc-eG6.js";import{a7 as $}from"./vendor-ux-PO0jFgJf.js";import{y as d}from"./vendor-utils-_C9URqjS.js";import{X as l,a8 as v,b3 as y,W as j,b4 as E,b5 as P}from"./index-CgSpL7jz.js";function R({blocklet:o,ancestors:c=[]}){const e=l(),{inService:s}=e,n=v(o?.status)||y(o?.status),r=`?v=${o?.meta?.version}${n?"~":""}`;let a=s?`${d(E,j,"/blocklet/logo-bundle")}${r}`:d(e.imgPrefix,"blocklet.png");if(o.source==="registry"&&o.deployedFrom&&o.meta.logo)a=`${d(o.deployedFrom,P(o.meta.bundleDid,o.meta.logo))}${r}`;else{const g=window.env?.apiPrefix||"/",i=c.concat(o),p=s?i.slice(1):i;a=`${d(g,`/blocklet/logo-bundle${p.map(m=>`/${m.meta.did}`).join("")}`)}${r}`}return{logoUrl:a,inService:s}}function h({blocklet:o,style:c={},size:e=40,ancestors:s=[],...n}){const r=l(),{logoUrl:a,inService:g}=R({blocklet:o,ancestors:s}),{variant:i}=n,p=g?()=>{}:f=>{f.target.src=`${r.imgPrefix}/blocklet.png`};let m=u.jsx("img",{src:a,onError:p,alt:o.meta.name,style:{width:e}});return o.meta.logo||(m=u.jsx($,{did:o.meta.did||"",responsive:!0})),u.jsx(x,{variant:i||"square",style:Object.assign({backgroundColor:"transparent",width:e,height:e,borderRadius:10},c),...n,children:m})}h.propTypes={blocklet:t.object.isRequired,style:t.object,size:t.oneOfType([t.number,t.string]),ancestors:t.array};export{h as B};
