chunk.QAEBPRHD.js 696 B

123456789101112131415161718192021222324252627
  1. // src/utilities/base-path.ts
  2. var basePath = "";
  3. function setBasePath(path) {
  4. basePath = path;
  5. }
  6. function getBasePath() {
  7. return basePath.replace(/\/$/, "");
  8. }
  9. if (!basePath) {
  10. const allScripts = [...document.getElementsByTagName("script")];
  11. const el = allScripts.find((script) => script.hasAttribute("data-shoelace"));
  12. if (el) {
  13. setBasePath(el.getAttribute("data-shoelace"));
  14. } else {
  15. const script = document.querySelector('script[src$="shoelace.js"], script[src$="shoelace.min.js"]');
  16. let path = "";
  17. if (script) {
  18. path = script.getAttribute("src");
  19. }
  20. setBasePath(path.split("/").slice(0, -1).join("/"));
  21. }
  22. }
  23. export {
  24. setBasePath,
  25. getBasePath
  26. };