UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) • 817 B
import{blobImageSize as u}from"../../../../utils/blob-image-size";import{isSvgBlob as c,svgToPngBlob as g}from"../../../../utils/rasterize-svg";export function boothLogoExhibitor(e){return e.exhibitors.find(t=>t.logoInBooth&&t.logo)}export function statedLogoAspectRatio(e){const t=boothLogoExhibitor(e)?.logoAspectRatio;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0}export function createLogoPreparer(){const e=new Map,t=o=>{let n=e.get(o);return n||(n=f(o),e.set(o,n)),n},i=new Map,s=o=>{let n=i.get(o);return n||(n=l(o),i.set(o,n)),n};return async(o,n)=>{const r=await t(n);if(!r)return null;const a=statedLogoAspectRatio(o)??await s(r);return a===null?null:{blob:r,aspectRatio:a}}}async function f(e){return c(e)?g(e):e}async function l(e){const t=await u(e);return t?.height?t.width/t.height:null}