import { getAssetPath, setAssetPath } from "@stencil/core";
export const getSpritePath = (sprite) => `${getContextAssetsPath("../assets/actions-sprite.svg")}#${sprite}`;
let ctxLoaded = false;
function getContextAssetsPath(resource) {
  if (!ctxLoaded) {
    const scriptElem = document.querySelector("script[data-ezui-assets-url]");
    if (scriptElem) {
      let assetsPath = scriptElem.dataset.ezuiAssetsUrl;
      if (assetsPath) {
        if (assetsPath.startsWith('/')) {
          assetsPath = window.location.origin + assetsPath;
        }
        setAssetPath(assetsPath);
      }
    }
    ctxLoaded = true;
  }
  return getAssetPath(resource);
}
