vendor: 1,219 bytes, lines 1-38
1// src/utilities/base-path.ts 2var basePath = ""; 3var kitCode = ""; 4function setBasePath(path) { 5 basePath = path; 6} 7function getBasePath(subpath = "") { 8 if (!basePath) { 9 const el = document.querySelector("[data-webawesome]"); 10 if (el?.hasAttribute("data-webawesome")) { 11 const rootRelativeUrl = new URL(el.getAttribute("data-webawesome") ?? "", window.location.href).pathname; 12 setBasePath(rootRelativeUrl); 13 } else { 14 const scripts = [...document.getElementsByTagName("script")]; 15 const waScript = scripts.find( 16 (script) => script.src.endsWith("webawesome.js") || script.src.endsWith("webawesome.loader.js") || script.src.endsWith("webawesome.ssr-loader.js") 17 ); 18 if (waScript) { 19 const path = String(waScript.getAttribute("src")); 20 setBasePath(path.split("/").slice(0, -1).join("/")); 21 } 22 } 23 } 24 return basePath.replace(/\/$/, "") + (subpath ? `/${subpath.replace(/^\//, "")}` : ``); 25} 26function setKitCode(code) { 27 kitCode = code; 28} 29function getKitCode() { 30 if (!kitCode) { 31 const el = document.querySelector("[data-fa-kit-code]"); 32 if (el) { 33 setKitCode(el.getAttribute("data-fa-kit-code") || ""); 34 } 35 } 36 return kitCode; 37} 38
39// src/components/icon/library.default.ts 40function getIconUrl(name, family, variant) { 41 const kitCode2 = getKitCode(); 42 const isPro = kitCode2.length > 0; 43 let folder = "solid"; 44 if (family === "classic") { 45 if (variant === "thin") folder = "thin"; 46 if (variant === "light") folder = "light"; 47 if (variant === "regular") folder = "regular"; 48 if (variant === "solid") folder = "solid"; 49 } 50 if (family === "sharp") { 51 if (variant === "thin") folder = "sharp-thin"; 52 if (variant === "light") folder = "sharp-light"; 53 if (variant === "regular") folder = "sharp-regular"; 54 if (variant === "solid") folder = "sharp-solid"; 55 } 56 if (family === "duotone") { 57 if (variant === "thin") folder = "duotone-thin"; 58 if (variant === "light") folder = "duotone-light"; 59 if (variant === "regular") folder = "duotone-regular"; 60 if (variant === "solid") folder = "duotone"; 61 } 62 if (family === "sharp-duotone") { 63 if (variant === "thin") folder = "sharp-duotone-thin"; 64 if (variant === "light") folder = "sharp-duotone-light"; 65 if (variant === "regular") folder = "sharp-duotone-regular"; 66 if (variant === "solid") folder = "sharp-duotone-solid"; 67 } 68 if (family === "brands") { 69 folder = "brands"; 70 } 71 return isPro ? `https://ka-p.fontawesome.com/releases/v6.7.2/svgs/${folder}/${name}.svg?token=${encodeURIComponent(kitCode2)}` : `https://ka-f.fontawesome.com/releases/v6.7.2/svgs/${folder}/${name}.svg`; 72} 73var library = { 74 name: "default", 75 resolver: (name, family = "classic", variant = "solid") => { 76 return getIconUrl(name, family, variant); 77 } 78}; 79var library_default_default = library; 80 81export { 82 setBasePath, 83 getBasePath, 84 setKitCode, 85 getKitCode, 86 library_default_default 87};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.