vendor: 2,710 bytes, lines 1-83
1/*! Copyright 2026 Fonticons, Inc. - https://webawesome.com/license */ 2import { 3 getBasePath 4} from "./chunk.KNQBIPHQ.js"; 5 6// _bundle_/src/utilities/autoloader.ts 7var observer = new MutationObserver((mutations) => { 8 for (const { addedNodes } of mutations) { 9 for (const node of addedNodes) { 10 if (node.nodeType === Node.ELEMENT_NODE) { 11 discover(node); 12 } 13 } 14 } 15}); 16function startLoader() { 17 discover(document); 18 observer.observe(document.documentElement, { subtree: true, childList: true }); 19} 20function stopLoader() { 21 observer.disconnect(); 22} 23async function discover(root) { 24 const rootTagName = root instanceof Element ? root.tagName.toLowerCase() : ""; 25 const rootIsWebAwesomeComponent = rootTagName?.startsWith("wa-"); 26 const tags = [...root.querySelectorAll(":not(:defined)")].map((el) => el.tagName.toLowerCase()).filter((tag) => tag.startsWith("wa-")); 27 if (rootIsWebAwesomeComponent && !customElements.get(rootTagName)) { 28 tags.push(rootTagName); 29 } 30 const preloadSelectors = root.querySelectorAll("[data-wa-preload]"); 31 const preloadRoots = root instanceof Element && root.hasAttribute("data-wa-preload") ? [root, ...preloadSelectors] : preloadSelectors; 32 for (const el of preloadRoots) { 33 tags.push( 34 ...el.getAttribute("data-wa-preload").split(/\s+/).filter((tag) => tag.startsWith("wa-")) 35 ); 36 } 37 const tagsToRegister = [...new Set(tags)]; 38 const imports = await Promise.allSettled(tagsToRegister.map((tagName) => register(tagName))); 39 for (const imp of imports) { 40 if (imp.status === "rejected") { 41 console.warn(imp.reason); 42 } 43 } 44 await new Promise(requestAnimationFrame); 45 root.dispatchEvent( 46 new CustomEvent("wa-discovery-complete", { 47 bubbles: false, 48 cancelable: false, 49 composed: true 50 }) 51 ); 52} 53function register(tagName) { 54 if (customElements.get(tagName)) { 55 return Promise.resolve(); 56 } 57 const tagWithoutPrefix = tagName.replace(/^wa-/i, ""); 58 const path = getBasePath(`components/${tagWithoutPrefix}/${tagWithoutPrefix}.js`); 59 return new Promise((resolve, reject) => { 60 import(path).then(() => resolve()).catch(() => reject(new Error(`Unable to autoload <${tagName}> from ${path}`))); 61 }); 62} 63var _timeout = 2e3; 64function preventTurboFouce(timeout = 2e3) { 65 _timeout = timeout; 66 document.addEventListener("turbo:before-render", handleRender); 67} 68async function handleRender(event) { 69 const newBody = event.detail.newBody; 70 event.preventDefault(); 71 try { 72 await Promise.race([discover(newBody), new Promise((resolve) => setTimeout(resolve, _timeout))]); 73 } finally { 74 event.detail.resume(); 75 } 76} 77 78export { 79 startLoader, 80 stopLoader, 81 discover, 82 preventTurboFouce 83};
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.