-
Notifications
You must be signed in to change notification settings - Fork 1
/
html-includes.min.js.map
1 lines (1 loc) · 47.2 KB
/
html-includes.min.js.map
1
{"version":3,"sources":["src/html-includes.js"],"names":["scope","newCustomEvent","type","params","window","CustomEvent","event","document","createEvent","initCustomEvent","bubbles","cancelable","detail","includeForElement","element","useNative","ownerDocument","doc","parentNode","closest","includeSelector","isIncludeLink","whenIncludesReady","callback","includes","QSA","rootIncludeSelector","pending","length","forEach","imp","whenElementLoaded","whenWebComponentsReady","stateChanged","removeEventListener","addEventListener","whenReady","localName","src","firstChild","onLoadingDone","isIE","node","nodeType","Node","ELEMENT_NODE","rel","constructor","Includer","documents","inflight","dynamicIncludesMO","MutationObserver","m","handleMutations","observe","head","childList","subtree","loadIncludes","replaceScripts","fragment","template","content","scriptsSelector","script","clone","createElement","attributes","attr","setAttribute","name","value","textContent","replaceChild","selector","childNodes","querySelectorAll","emptyNodeList","list","inverseOrder","increment","i","link","currentScript","Object","defineProperty","get","readyState","scripts","configurable","CSS_URL_REGEXP","CSS_INCLUDE_REGEXP","STYLESHEET_REGEXP","Path","fixUrls","base","href","resolveUrl","getAttribute","r","replaceUrls","text","linkUrl","regexp","replace","pre","url","post","urlPath","undefined","__workingURL","u","URL","pathname","e","__tempDoc","implementation","createHTMLDocument","__base","appendChild","__anchor","Xhr","async","load","success","fail","match","pieces","split","resource","header","indexOf","atob","decodeURIComponent","request","XMLHttpRequest","open","onload","request.onload","redirectedUrl","responseURL","getResponseHeader","location","origin","protocol","host","response","responseText","status","send","test","navigator","userAgent","links","loadInclude","fireEventIfNeeded","makeDocument","processIncludesIfLoadingDone","createDocumentFragment","p1","p2","innerHTML","baseEl","querySelector","removeAttribute","inlineScriptIndex","n$","includeDependenciesSelector","n","includeDependencyAttr","Error","encodeURIComponent","num","disconnect","flatten","scriptsOk","stylesOk","fireEvents","waitForStyles","runScripts","DOCUMENT_FRAGMENT_NODE","cloneScript","l","s","s$","pendingScriptsSelector","pendingStylesSelector","needsMove","disabledLinkSelector","placeholder","insertBefore","nextSibling","newSibling","include","dispatchEvent","eventType","mutations","addedNodes","elem","includer","imps","target","native_baseURI","getOwnPropertyDescriptor","prototype","klass","Element","ownerDoc","call","enumerable","HTMLLinkElement","HTMLIncludes"],"mappings":"A;;;;;;;;;aASC,SAAA,CAAAA,CAAA,CAAS,CAyqBeC,QAAA,EAAA,CAACC,CAAD,CAAOC,CAAP,CAAkB,CACvC,GAAkC,UAAlC,GAAI,MAAOC,OAAAC,YAAX,CACE,MAAO,KAAIA,WAAJ,CAAgBH,CAAhB,CAAsBC,CAAtB,CAET,KAAMG,EAAqCC,QAAAC,YAAA,CAAqB,aAArB,CAC3CF,EAAAG,gBAAA,CAAsBP,CAAtB,CAA4B,CAAA,CAAQC,CAAAO,QAApC,CAAqD,CAAA,CAAQP,CAAAQ,WAA7D,CAAiFR,CAAAS,OAAjF,CACA,OAAON,EANgC,CAjCfO,QAAA,EAAA,CAAAC,CAAA,CAAW,CACnC,GAAIC,CAAJ,CAEE,MAAOD,EAAAE,cAAA,GAA0BT,QAA1B,CAAqCO,CAAAE,cAArC,CAA6D,IAEtE,KAAIC,EAAMH,CAAA,aACV,IAAI,CAACG,CAAL,EAAYH,CAAAI,WAAZ,CAAgC,CAC9BD,CAAA,CAA+BH,CAAAI,WAC/B,IAA2B,UAA3B,GAAI,MAAOD,EAAAE,QAAX,CAGEF,CAAA,CAAMA,CAAAE,QAAA,CAtdYC,mBAsdZ,CAHR,KAME,KAAA,CAAO,CAACC,CAAA,CAAcJ,CAAd,CAAR,GAA+BA,CAA/B,CAAqCA,CAAAC,WAArC,EAAA,EAEFJ,CAAA,aAAA,CAA0BG,CAVI,CAYhC,MAAOA,EAlB4B,CApBXK,QAAA,EAAA,CAAAC,CAAA,CAAY,CACpC,IAAIC,EACDC,CAAA,CAAIlB,QAAJ;AA1auBmB,6CA0avB,CADH,CAEIC,EAAUH,CAAAI,OACTD,EAAL,CAIAE,CAAA,CAAQL,CAAR,CAAkB,QAAA,CAAA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n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n(scope => {\r\n\r\n /********************* base setup *********************/\r\n const link = document.createElement('link');\r\n const useNative = Boolean('include' in link);\r\n const emptyNodeList = link.querySelectorAll('*');\r\n\r\n // Polyfill `currentScript` for browsers without it.\r\n let currentScript = null;\r\n if ('currentScript' in document === false) {\r\n Object.defineProperty(document, 'currentScript', {\r\n get() {\r\n return currentScript ||\r\n // NOTE: only works when called in synchronously executing code.\r\n // readyState should check if `loading` but IE10 is\r\n // interactive when scripts run so we cheat. This is not needed by\r\n // html-includes polyfill but helps generally polyfill `currentScript`.\r\n (document.readyState !== 'complete' ?\r\n document.scripts[document.scripts.length - 1] : null);\r\n },\r\n configurable: true\r\n });\r\n }\r\n\r\n /**\r\n * @param {Array|NodeList|NamedNodeMap} list\r\n * @param {!Function} callback\r\n * @param {boolean=} inverseOrder\r\n */\r\n const forEach = (list, callback, inverseOrder) => {\r\n const length = list ? list.length : 0;\r\n const increment = inverseOrder ? -1 : 1;\r\n let i = inverseOrder ? length - 1 : 0;\r\n for (; i < length && i >= 0; i = i + increment) {\r\n callback(list[i], i);\r\n }\r\n };\r\n\r\n /**\r\n * @param {!Node} node\r\n * @param {!string} selector\r\n * @return {!NodeList<!Element>}\r\n */\r\n const QSA = (node, selector) => {\r\n // IE 11 throws a SyntaxError if a node with no children is queried with\r\n // a selector containing the `:not([type])` syntax.\r\n if (!node.childNodes.length) {\r\n return emptyNodeList;\r\n }\r\n return node.querySelectorAll(selector);\r\n };\r\n\r\n /**\r\n * @param {!DocumentFragment} fragment\r\n */\r\n const replaceScripts = (fragment) => {\r\n forEach(QSA(fragment, 'template'), template => {\r\n forEach(QSA(template.content, scriptsSelector), script => {\r\n const clone = /** @type {!HTMLScriptElement} */\r\n (document.createElement('script'));\r\n forEach(script.attributes, attr => clone.setAttribute(attr.name, attr.value));\r\n clone.textContent = script.textContent;\r\n script.parentNode.replaceChild(clone, script);\r\n });\r\n replaceScripts(template.content);\r\n });\r\n };\r\n\r\n /********************* path fixup *********************/\r\n const CSS_URL_REGEXP = /(url\\()([^)]*)(\\))/g;\r\n const CSS_INCLUDE_REGEXP = /(@include[\\s]+(?!url\\())([^;]*)(;)/g;\r\n const STYLESHEET_REGEXP = /(<link[^>]*)(rel=['|\"]?stylesheet['|\"]?[^>]*>)/g;\r\n\r\n // path fixup: style elements in includes must be made relative to the main\r\n // document. We fixup url's in url() and @include.\r\n const Path = {\r\n\r\n fixUrls(element, base) {\r\n if (element.href) {\r\n element.setAttribute('href',\r\n Path.resolveUrl(element.getAttribute('href'), base));\r\n }\r\n if (element.src) {\r\n element.setAttribute('src',\r\n Path.resolveUrl(element.getAttribute('src'), base));\r\n }\r\n if (element.localName === 'style') {\r\n const r = Path.replaceUrls(element.textContent, base, CSS_URL_REGEXP);\r\n element.textContent = Path.replaceUrls(r, base, CSS_INCLUDE_REGEXP);\r\n }\r\n },\r\n\r\n replaceUrls(text, linkUrl, regexp) {\r\n return text.replace(regexp, (m, pre, url, post) => {\r\n let urlPath = url.replace(/[\"']/g, '');\r\n if (linkUrl) {\r\n urlPath = Path.resolveUrl(urlPath, linkUrl);\r\n }\r\n return pre + '\\'' + urlPath + '\\'' + post;\r\n });\r\n },\r\n\r\n resolveUrl(url, base) {\r\n // Lazy feature detection.\r\n if (Path.__workingURL === undefined) {\r\n Path.__workingURL = false;\r\n try {\r\n const u = new URL('b', 'http://a');\r\n u.pathname = 'c%20d';\r\n Path.__workingURL = (u.href === 'http://a/c%20d');\r\n } catch (e) {}\r\n }\r\n\r\n if (Path.__workingURL) {\r\n return (new URL(url, base)).href;\r\n }\r\n\r\n // Fallback to creating an anchor into a disconnected document.\r\n let doc = Path.__tempDoc;\r\n if (!doc) {\r\n doc = document.implementation.createHTMLDocument('temp');\r\n Path.__tempDoc = doc;\r\n doc.__base = doc.createElement('base');\r\n doc.head.appendChild(doc.__base);\r\n doc.__anchor = doc.createElement('a');\r\n }\r\n doc.__base.href = base;\r\n doc.__anchor.href = url;\r\n return doc.__anchor.href || url;\r\n }\r\n };\r\n\r\n /********************* Xhr processor *********************/\r\n const Xhr = {\r\n\r\n async: true,\r\n\r\n /**\r\n * @param {!string} url\r\n * @param {!function(!string, string=)} success\r\n * @param {!function(!string)} fail\r\n */\r\n load(url, success, fail) {\r\n if (!url) {\r\n fail('error: href must be specified');\r\n } else if (url.match(/^data:/)) {\r\n // Handle Data URI Scheme\r\n const pieces = url.split(',');\r\n const header = pieces[0];\r\n let resource = pieces[1];\r\n if (header.indexOf(';base64') > -1) {\r\n resource = atob(resource);\r\n } else {\r\n resource = decodeURIComponent(resource);\r\n }\r\n success(resource);\r\n } else {\r\n const request = new XMLHttpRequest();\r\n request.open('GET', url, Xhr.async);\r\n request.onload = () => {\r\n // Servers redirecting an include can add a Location header to help us\r\n // polyfill correctly. Handle relative and full paths.\r\n // Prefer responseURL which already resolves redirects\r\n // https://xhr.spec.whatwg.org/#the-responseurl-attribute\r\n let redirectedUrl = request.responseURL || request.getResponseHeader('Location');\r\n if (redirectedUrl && redirectedUrl.indexOf('/') === 0) {\r\n // In IE location.origin might not work\r\n // https://connect.microsoft.com/IE/feedback/details/1763802/location-origin-is-undefined-in-ie-11-on-windows-10-but-works-on-windows-7\r\n const origin = (location.origin || location.protocol + '//' + location.host);\r\n redirectedUrl = origin + redirectedUrl;\r\n }\r\n const resource = /** @type {string} */ (request.response || request.responseText);\r\n if (request.status === 304 || request.status === 0 ||\r\n request.status >= 200 && request.status < 300) {\r\n success(resource, redirectedUrl);\r\n } else {\r\n fail(resource);\r\n }\r\n };\r\n request.send();\r\n }\r\n }\r\n };\r\n\r\n /********************* includer *********************/\r\n\r\n const isIE = /Trident/.test(navigator.userAgent) ||\r\n /Edge\\/\\d./i.test(navigator.userAgent);\r\n\r\n const includeSelector = 'link[rel=include]';\r\n\r\n // Used to disable loading of resources.\r\n const includeDisableType = 'include-disable';\r\n\r\n const disabledLinkSelector = `link[rel=stylesheet][href][type=${includeDisableType}]`;\r\n\r\n const scriptsSelector = `script:not([type]),script[type=\"application/javascript\"],` +\r\n `script[type=\"text/javascript\"],script[type=\"module\"]`;\r\n\r\n const includeDependenciesSelector = `${includeSelector},${disabledLinkSelector},` +\r\n `style:not([type]),link[rel=stylesheet][href]:not([type]),` + scriptsSelector;\r\n\r\n const includeDependencyAttr = 'include-dependency';\r\n\r\n const rootIncludeSelector = `${includeSelector}:not([${includeDependencyAttr}])`;\r\n\r\n const pendingScriptsSelector = `script[${includeDependencyAttr}]`;\r\n\r\n const pendingStylesSelector = `style[${includeDependencyAttr}],` +\r\n `link[rel=stylesheet][${includeDependencyAttr}]`;\r\n\r\n /**\r\n * Includer will:\r\n * - load any linked include documents (with deduping)\r\n * - whenever an include is loaded, prompt the parser to try to parse\r\n * - observe included documents for new elements (these are handled via the\r\n * dynamic includer)\r\n */\r\n class Includer {\r\n constructor() {\r\n this.documents = {};\r\n // Used to keep track of pending loads, so that flattening and firing of\r\n // events can be done when all resources are ready.\r\n this.inflight = 0;\r\n this.dynamicIncludesMO = new MutationObserver(m => this.handleMutations(m));\r\n // Observe changes on <head>.\r\n this.dynamicIncludesMO.observe(document.head, {\r\n childList: true,\r\n subtree: true\r\n });\r\n // 1. Load includes contents\r\n // 2. Assign them to first include links on the document\r\n // 3. Wait for include styles & scripts to be done loading/running\r\n // 4. Fire load/error events\r\n this.loadIncludes(document);\r\n }\r\n\r\n /**\r\n * @param {!(HTMLDocument|DocumentFragment|Element)} doc\r\n */\r\n loadIncludes(doc) {\r\n const links = /** @type {!NodeList<!HTMLLinkElement>} */\r\n (QSA(doc, includeSelector));\r\n forEach(links, link => this.loadInclude(link));\r\n }\r\n\r\n /**\r\n * @param {!HTMLLinkElement} link\r\n */\r\n loadInclude(link) {\r\n const url = link.href;\r\n // This resource is already being handled by another include.\r\n if (this.documents[url] !== undefined) {\r\n // If include is already loaded, we can safely associate it to the link\r\n // and fire the load/error event.\r\n const imp = this.documents[url];\r\n if (imp && imp['__loaded']) {\r\n link['__include'] = imp;\r\n this.fireEventIfNeeded(link);\r\n }\r\n return;\r\n }\r\n this.inflight++;\r\n // Mark it as pending to notify others this url is being loaded.\r\n this.documents[url] = 'pending';\r\n Xhr.load(url, (resource, redirectedUrl) => {\r\n const doc = this.makeDocument(resource, redirectedUrl || url);\r\n this.documents[url] = doc;\r\n this.inflight--;\r\n // Load subtree.\r\n this.loadIncludes(doc);\r\n this.processIncludesIfLoadingDone();\r\n }, () => {\r\n // If load fails, handle error.\r\n this.documents[url] = null;\r\n this.inflight--;\r\n this.processIncludesIfLoadingDone();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a new document containing resource and normalizes urls accordingly.\r\n * @param {string=} resource\r\n * @param {string=} url\r\n * @return {!DocumentFragment}\r\n */\r\n makeDocument(resource, url) {\r\n if (!resource) {\r\n return document.createDocumentFragment();\r\n }\r\n\r\n if (isIE) {\r\n // <link rel=stylesheet> should be appended to <head>. Not doing so\r\n // in IE/Edge breaks the cascading order. We disable the loading by\r\n // setting the type before setting innerHTML to avoid loading\r\n // resources twice.\r\n resource = resource.replace(STYLESHEET_REGEXP, (match, p1, p2) => {\r\n if (match.indexOf('type=') === -1) {\r\n return `${p1} type=${includeDisableType} ${p2}`;\r\n }\r\n return match;\r\n });\r\n }\r\n\r\n let content;\r\n const template = /** @type {!HTMLTemplateElement} */\r\n (document.createElement('template'));\r\n template.innerHTML = resource;\r\n if (template.content) {\r\n content = template.content;\r\n // Clone scripts inside templates since they won't execute when the\r\n // hosting template is cloned.\r\n replaceScripts(content);\r\n } else {\r\n // <template> not supported, create fragment and move content into it.\r\n content = document.createDocumentFragment();\r\n while (template.firstChild) {\r\n content.appendChild(template.firstChild);\r\n }\r\n }\r\n\r\n // Support <base> in included docs. Resolve url and remove its href.\r\n const baseEl = content.querySelector('base');\r\n if (baseEl) {\r\n url = Path.resolveUrl(baseEl.getAttribute('href'), url);\r\n baseEl.removeAttribute('href');\r\n }\r\n\r\n const n$ = /** @type {!NodeList<!(HTMLLinkElement|HTMLScriptElement|HTMLStyleElement)>} */\r\n (QSA(content, includeDependenciesSelector));\r\n // For source map hints.\r\n let inlineScriptIndex = 0;\r\n forEach(n$, n => {\r\n // Listen for load/error events, then fix urls.\r\n whenElementLoaded(n);\r\n Path.fixUrls(n, url);\r\n // Mark for easier selectors.\r\n n.setAttribute(includeDependencyAttr, '');\r\n // Generate source map hints for inline scripts.\r\n if (n.localName === 'script' && !n.src && n.textContent) {\r\n if(n.type === 'module') {\r\n throw new Error('Inline module scripts are not supported in HTML Includes.');\r\n }\r\n const num = inlineScriptIndex ? `-${inlineScriptIndex}` : '';\r\n const content = n.textContent + `\\n//# sourceURL=${url}${num}.js\\n`;\r\n // We use the src attribute so it triggers load/error events, and it's\r\n // easier to capture errors (e.g. parsing) like this.\r\n n.setAttribute('src', 'data:text/javascript;charset=utf-8,' + encodeURIComponent(content));\r\n n.textContent = '';\r\n inlineScriptIndex++;\r\n }\r\n });\r\n return content;\r\n }\r\n\r\n /**\r\n * Waits for loaded includes to finish loading scripts and styles, then fires\r\n * the load/error events.\r\n */\r\n processIncludesIfLoadingDone() {\r\n // Wait until all resources are ready, then load include resources.\r\n if (this.inflight) return;\r\n\r\n // Stop observing, flatten & load resource, then restart observing <head>.\r\n this.dynamicIncludesMO.disconnect();\r\n this.flatten(document);\r\n // We wait for styles to load, and at the same time we execute the scripts,\r\n // then fire the load/error events for includes to have faster whenReady\r\n // callback execution.\r\n // NOTE: This is different for native behavior where scripts would be\r\n // executed after the styles before them are loaded.\r\n // To achieve that, we could select pending styles and scripts in the\r\n // document and execute them sequentially in their dom order.\r\n let scriptsOk = false,\r\n stylesOk = false;\r\n const onLoadingDone = () => {\r\n if (stylesOk && scriptsOk) {\r\n // Catch any includes that might have been added while we\r\n // weren't looking, wait for them as well.\r\n this.loadIncludes(document);\r\n if (this.inflight) return;\r\n\r\n // Restart observing.\r\n this.dynamicIncludesMO.observe(document.head, {\r\n childList: true,\r\n subtree: true\r\n });\r\n this.fireEvents();\r\n }\r\n }\r\n this.waitForStyles(() => {\r\n stylesOk = true;\r\n onLoadingDone();\r\n });\r\n this.runScripts(() => {\r\n scriptsOk = true;\r\n onLoadingDone();\r\n });\r\n }\r\n\r\n /**\r\n * @param {!HTMLDocument} doc\r\n */\r\n flatten(doc) {\r\n const n$ = /** @type {!NodeList<!HTMLLinkElement>} */\r\n (QSA(doc, includeSelector));\r\n forEach(n$, n => {\r\n const imp = this.documents[n.href];\r\n n['__include'] = /** @type {!Document} */ (imp);\r\n if (imp && imp.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\r\n // We set the .include to be the link itself, and update its readyState.\r\n // Other links with the same href will point to this link.\r\n this.documents[n.href] = n;\r\n n.readyState = 'loading';\r\n n['__include'] = n;\r\n this.flatten(imp);\r\n n.appendChild(imp);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Replaces all the included scripts with a clone in order to execute them.\r\n * Updates the `currentScript`.\r\n * @param {!function()} callback\r\n */\r\n runScripts(callback) {\r\n const s$ = QSA(document, pendingScriptsSelector);\r\n const l = s$.length;\r\n const cloneScript = i => {\r\n if (i < l) {\r\n // The pending scripts have been generated through innerHTML and\r\n // browsers won't execute them for security reasons. We cannot use\r\n // s.cloneNode(true) either, the only way to run the script is manually\r\n // creating a new element and copying its attributes.\r\n const s = s$[i];\r\n const clone = /** @type {!HTMLScriptElement} */\r\n (document.createElement('script'));\r\n // Remove include-dependency attribute to avoid double cloning.\r\n s.removeAttribute(includeDependencyAttr);\r\n forEach(s.attributes, attr => clone.setAttribute(attr.name, attr.value));\r\n // Update currentScript and replace original with clone script.\r\n currentScript = clone;\r\n s.parentNode.replaceChild(clone, s);\r\n whenElementLoaded(clone, () => {\r\n currentScript = null;\r\n cloneScript(i + 1);\r\n });\r\n } else {\r\n callback();\r\n }\r\n };\r\n cloneScript(0);\r\n }\r\n\r\n /**\r\n * Waits for all the included stylesheets/styles to be loaded.\r\n * @param {!function()} callback\r\n */\r\n waitForStyles(callback) {\r\n const s$ = /** @type {!NodeList<!(HTMLLinkElement|HTMLStyleElement)>} */\r\n (QSA(document, pendingStylesSelector));\r\n let pending = s$.length;\r\n if (!pending) {\r\n callback();\r\n return;\r\n }\r\n // <link rel=stylesheet> should be appended to <head>. Not doing so\r\n // in IE/Edge breaks the cascading order\r\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10472273/\r\n // If there is one <link rel=stylesheet> includeed, we must move all included\r\n // links and styles to <head>.\r\n const needsMove = isIE && !!document.querySelector(disabledLinkSelector);\r\n forEach(s$, s => {\r\n // Listen for load/error events, remove selector once is done loading.\r\n whenElementLoaded(s, () => {\r\n s.removeAttribute(includeDependencyAttr);\r\n if (--pending === 0) {\r\n callback();\r\n }\r\n });\r\n // Check if was already moved to head, to handle the case where the element\r\n // has already been moved but it is still loading.\r\n if (needsMove && s.parentNode !== document.head) {\r\n // Replace the element we're about to move with a placeholder.\r\n const placeholder = document.createElement(s.localName);\r\n // Add reference of the moved element.\r\n placeholder['__appliedElement'] = s;\r\n // Disable this from appearing in document.styleSheets.\r\n placeholder.setAttribute('type', 'include-placeholder');\r\n // Append placeholder next to the sibling, and move original to <head>.\r\n s.parentNode.insertBefore(placeholder, s.nextSibling);\r\n let newSibling = includeForElement(s);\r\n while (newSibling && includeForElement(newSibling)) {\r\n newSibling = includeForElement(newSibling);\r\n }\r\n if (newSibling.parentNode !== document.head) {\r\n newSibling = null;\r\n }\r\n document.head.insertBefore(s, newSibling);\r\n // Enable the loading of <link rel=stylesheet>.\r\n s.removeAttribute('type');\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Fires load/error events for includes in the right order .\r\n */\r\n fireEvents() {\r\n const n$ = /** @type {!NodeList<!HTMLLinkElement>} */\r\n (QSA(document, includeSelector));\r\n // Inverse order to have events firing bottom-up.\r\n forEach(n$, n => this.fireEventIfNeeded(n), true);\r\n }\r\n\r\n /**\r\n * Fires load/error event for the include if this wasn't done already.\r\n * @param {!HTMLLinkElement} link\r\n */\r\n fireEventIfNeeded(link) {\r\n // Don't fire twice same event.\r\n if (!link['__loaded']) {\r\n link['__loaded'] = true;\r\n // Update link's include readyState.\r\n link.include && (link.include.readyState = 'complete');\r\n const eventType = link.include ? 'load' : 'error';\r\n link.dispatchEvent(newCustomEvent(eventType, {\r\n bubbles: false,\r\n cancelable: false,\r\n detail: undefined\r\n }));\r\n }\r\n }\r\n\r\n /**\r\n * @param {Array<MutationRecord>} mutations\r\n */\r\n handleMutations(mutations) {\r\n forEach(mutations, m => forEach(m.addedNodes, elem => {\r\n if (elem && elem.nodeType === Node.ELEMENT_NODE) {\r\n // NOTE: added scripts are not updating currentScript in IE.\r\n if (isIncludeLink(elem)) {\r\n this.loadInclude( /** @type {!HTMLLinkElement} */ (elem));\r\n } else {\r\n this.loadIncludes( /** @type {!Element} */ (elem));\r\n }\r\n }\r\n }));\r\n }\r\n }\r\n\r\n /**\r\n * @param {!Node} node\r\n * @return {boolean}\r\n */\r\n const isIncludeLink = node => {\r\n return node.nodeType === Node.ELEMENT_NODE && node.localName === 'link' &&\r\n ( /** @type {!HTMLLinkElement} */ (node).rel === 'include');\r\n };\r\n\r\n /**\r\n * Waits for an element to finish loading. If already done loading, it will\r\n * mark the element accordingly.\r\n * @param {!(HTMLLinkElement|HTMLScriptElement|HTMLStyleElement)} element\r\n * @param {function()=} callback\r\n */\r\n const whenElementLoaded = (element, callback) => {\r\n if (element['__loaded']) {\r\n callback && callback();\r\n } else if ((element.localName === 'script' && !element.src) ||\r\n (element.localName === 'style' && !element.firstChild)) {\r\n // Inline scripts and empty styles don't trigger load/error events,\r\n // consider them already loaded.\r\n element['__loaded'] = true;\r\n callback && callback();\r\n } else {\r\n const onLoadingDone = event => {\r\n element.removeEventListener(event.type, onLoadingDone);\r\n element['__loaded'] = true;\r\n callback && callback();\r\n };\r\n element.addEventListener('load', onLoadingDone);\r\n // NOTE: We listen only for load events in IE/Edge, because in IE/Edge\r\n // <style> with @include will fire error events for each failing @include,\r\n // and finally will trigger the load event when all @include are\r\n // finished (even if all fail).\r\n if (!isIE || element.localName !== 'style') {\r\n element.addEventListener('error', onLoadingDone);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Calls the callback when all includes in the document at call time\r\n * (or at least document ready) have loaded. Callback is called synchronously\r\n * if includes are already done loading.\r\n * @param {function()=} callback\r\n */\r\n const whenReady = callback => {\r\n // 1. ensure the document is in a ready state (has dom), then\r\n // 2. watch for loading of includes and call callback when done\r\n whenWebComponentsReady(() => whenIncludesReady(() => callback && callback()));\r\n }\r\n\r\n /**\r\n * Invokes the callback when document is in ready state. Callback is called\r\n * synchronously if document is already done loading.\r\n * @param {!function()} callback\r\n */\r\n const whenWebComponentsReady = callback => {\r\n const stateChanged = () => {\r\n // NOTE: Firefox can hit readystate interactive without document.body existing.\r\n // This is anti-spec, but we handle it here anyways by waiting for next change.\r\n if (typeof window !== 'undefined') {\r\n window.removeEventListener('WebComponentsReady', stateChanged);\r\n callback();\r\n }\r\n }\r\n window.addEventListener('WebComponentsReady', stateChanged);\r\n stateChanged();\r\n }\r\n\r\n /**\r\n * Invokes the callback after all includes are loaded. Callback is called\r\n * synchronously if includes are already done loading.\r\n * @param {!function()} callback\r\n */\r\n const whenIncludesReady = callback => {\r\n let includes = /** @type {!NodeList<!HTMLLinkElement>} */\r\n (QSA(document, rootIncludeSelector));\r\n let pending = includes.length;\r\n if (!pending) {\r\n callback();\r\n return;\r\n }\r\n forEach(includes, imp => whenElementLoaded(imp, () => {\r\n if (--pending === 0) {\r\n callback();\r\n }\r\n }));\r\n }\r\n\r\n /**\r\n * Returns the include document containing the element.\r\n * @param {!Node} element\r\n * @return {HTMLLinkElement|Document|undefined}\r\n */\r\n const includeForElement = element => {\r\n if (useNative) {\r\n // Return only if not in the main doc!\r\n return element.ownerDocument !== document ? element.ownerDocument : null;\r\n }\r\n let doc = element['__includeDoc'];\r\n if (!doc && element.parentNode) {\r\n doc = /** @type {!Element} */ (element.parentNode);\r\n if (typeof doc.closest === 'function') {\r\n // Element.closest returns the element itself if it matches the selector,\r\n // so we search the closest include starting from the parent.\r\n doc = doc.closest(includeSelector);\r\n } else {\r\n // Walk up the parent tree until we find an include.\r\n while (!isIncludeLink(doc) && (doc = doc.parentNode)) {}\r\n }\r\n element['__includeDoc'] = doc;\r\n }\r\n return doc;\r\n }\r\n\r\n let includer = null;\r\n /**\r\n * Ensures includes contained in the element are included.\r\n * Use this to handle dynamic includes attached to body.\r\n * @param {!(HTMLDocument|Element)} doc\r\n */\r\n const loadIncludes = (doc) => {\r\n if (includer) {\r\n includer.loadIncludes(doc);\r\n }\r\n };\r\n\r\n const newCustomEvent = (type, params) => {\r\n if (typeof window.CustomEvent === 'function') {\r\n return new CustomEvent(type, params);\r\n }\r\n const event = /** @type {!CustomEvent} */ (document.createEvent('CustomEvent'));\r\n event.initCustomEvent(type, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);\r\n return event;\r\n };\r\n\r\n if (useNative) {\r\n // Check for includes that might already be done loading by the time this\r\n // script is actually executed. Native includes are blocking, so the ones\r\n // available in the document by this time should already have failed\r\n // or have .include defined.\r\n const imps = /** @type {!NodeList<!HTMLLinkElement>} */\r\n (QSA(document, includeSelector));\r\n forEach(imps, imp => {\r\n if (!imp.include || imp.include.readyState !== 'loading') {\r\n imp['__loaded'] = true;\r\n }\r\n });\r\n // Listen for load/error events to capture dynamically added scripts.\r\n /**\r\n * @type {!function(!Event)}\r\n */\r\n const onLoadingDone = event => {\r\n const elem = /** @type {!Element} */ (event.target);\r\n if (isIncludeLink(elem)) {\r\n elem['__loaded'] = true;\r\n }\r\n };\r\n document.addEventListener('load', onLoadingDone, true /* useCapture */ );\r\n document.addEventListener('error', onLoadingDone, true /* useCapture */ );\r\n } else {\r\n // Override baseURI so that included elements' baseURI can be used seemlessly\r\n // on native or polyfilled html-includes.\r\n // NOTE: a <link rel=include> will have `link.baseURI === link.href`, as the link\r\n // itself is used as the `include` document.\r\n /** @type {Object|undefined} */\r\n const native_baseURI = Object.getOwnPropertyDescriptor(Node.prototype, 'baseURI');\r\n // NOTE: if not configurable (e.g. safari9), set it on the Element prototype.\r\n const klass = !native_baseURI || native_baseURI.configurable ? Node : Element;\r\n Object.defineProperty(klass.prototype, 'baseURI', {\r\n get() {\r\n const ownerDoc = /** @type {HTMLLinkElement} */ (isIncludeLink(this) ? this : includeForElement(this));\r\n if (ownerDoc) return ownerDoc.href;\r\n // Use native baseURI if possible.\r\n if (native_baseURI && native_baseURI.get) return native_baseURI.get.call(this);\r\n // Polyfill it if not available.\r\n const base = /** @type {HTMLBaseElement} */ (document.querySelector('base'));\r\n return (base || window.location).href;\r\n },\r\n configurable: true,\r\n enumerable: true\r\n });\r\n\r\n // Define 'include' read-only property.\r\n Object.defineProperty(HTMLLinkElement.prototype, 'include', {\r\n get() {\r\n return /** @type {HTMLLinkElement} */ (this)['__include'] || null;\r\n },\r\n configurable: true,\r\n enumerable: true\r\n });\r\n\r\n whenWebComponentsReady(() => {\r\n includer = new Includer()\r\n });\r\n }\r\n\r\n /**\r\n Add support for the `HTMLIncludesLoaded` event and the `HTMLIncludes.whenReady`\r\n method. This api is necessary because unlike the native implementation,\r\n script elements do not force includes to resolve. Instead, users should wrap\r\n code in either an `HTMLIncludesLoaded` handler or after load time in an\r\n `HTMLIncludes.whenReady(callback)` call.\r\n\r\n NOTE: This module also supports these apis under the native implementation.\r\n Therefore, if this file is loaded, the same code can be used under both\r\n the polyfill and native implementation.\r\n */\r\n whenReady(() => document.dispatchEvent(newCustomEvent('HTMLIncludesLoaded', {\r\n cancelable: true,\r\n bubbles: true,\r\n detail: undefined\r\n })));\r\n\r\n // exports\r\n scope.useNative = useNative;\r\n scope.whenReady = whenReady;\r\n scope.includeForElement = includeForElement;\r\n scope.loadIncludes = loadIncludes;\r\n\r\n})(window.HTMLIncludes = (window.HTMLIncludes || {}));\r\n"]}