mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-26 10:02:25 +01:00
1 line
2.6 KiB
JavaScript
1 line
2.6 KiB
JavaScript
!function(){"use strict";var t,n=!1,o=[],d=!1;function e(){window.WebComponents.ready=!0,document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))}function r(){window.customElements&&customElements.polyfillWrapFlushCallback&&customElements.polyfillWrapFlushCallback(function(e){t=e,d&&t()})}function c(){window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(window.document),n=!0,i().then(e)}function i(){d=!1;var e=o.map(function(e){return e instanceof Function?e():e});return o=[],Promise.all(e).then(function(){d=!0,t&&t()}).catch(function(e){console.error(e)})}window.WebComponents=window.WebComponents||{},window.WebComponents.ready=window.WebComponents.ready||!1,window.WebComponents.waitFor=window.WebComponents.waitFor||function(e){e&&(o.push(e),n&&i())},window.WebComponents._batchCustomElements=r;var s,a,l="webcomponents-loader.js",w=[],m=("attachShadow"in Element.prototype&&"getRootNode"in Element.prototype&&(!window.ShadyDOM||!window.ShadyDOM.force)||w.push("sd"),window.customElements&&!window.customElements.forcePolyfill||w.push("ce"),function(){var e=document.createElement("template");if(!("content"in e))return!0;if(!(e.content.cloneNode()instanceof DocumentFragment))return!0;var t=document.createElement("template"),t=(t.content.appendChild(document.createElement("div")),e.content.appendChild(t),e.cloneNode(!0));return 0===t.content.childNodes.length||0===t.content.firstChild.content.childNodes.length}());function u(e){return e}(w=window.Promise&&Array.from&&window.URL&&window.Symbol&&!m?w:["sd-ce-pf"]).length?(m={createHTML:u,createScript:u,createScriptURL:u},m=window.trustedTypes&&window.trustedTypes.createPolicy("webcomponents-loader",m)||m,w="bundles/webcomponents-"+w.join("-")+".js",window.WebComponents.root?(s=window.WebComponents.root+w,window.trustedTypes&&window.trustedTypes.isScriptURL(window.WebComponents.root)&&(s=m.createScriptURL(s))):(a=document.querySelector('script[src*="'+l+'"]'),s=m.createScriptURL(a.src.replace(l,w))),(a=document.createElement("script")).src=s,"loading"===document.readyState?(a.setAttribute("onload",m.createScript("window.WebComponents._batchCustomElements()")),document.write(m.createHTML(a.outerHTML)),document.addEventListener("DOMContentLoaded",c)):(a.addEventListener("load",function(){r(),c()}),a.addEventListener("error",function(){throw new Error("Could not load polyfill bundle"+s)}),document.head.appendChild(a))):"complete"===document.readyState?(n=!0,e()):(window.addEventListener("load",c),window.addEventListener("DOMContentLoaded",function(){window.removeEventListener("load",c),c()}))}(); |