1var t;t=function(){if(void 0===customElements.get("base-fetch-container")){const t=document.createElement("template");t.innerHTML='\n <style>\n :host {\n display: block;\n }\n :host([overlay-loader]) [part="wrapper"] {\n display: grid;\n grid-template-areas: "def";\n }\n :host([overlay-loader]) [part="body"] {\n grid-area: def;\n transition: opacity .5s ease;\n }\n :host([overlay-loader][loading]) [part="body"] {\n opacity: 0;\n }\n :host(:not([overlay-loader])) [part="loader-container"],\n :host([overlay-loader]:not([loading])) [part="loader-container"] {\n display: none;\n }\n :host([overlay-loader]) [part="loader-container"] {\n grid-area: def;\n display: flex;\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n }\n /* no slot loader (default/fallback) */\n [part="loader"] {\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, .75);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n [part="loader-text"]::before {\n content: "Loading"; \n }\n </style>\n <div part="wrapper">\n <div part="body">\n <slot></slot>\n </div>\n <div part="loader-container">\n <slot name="overlay-loader"><div part="loader"><span part="loader-text"></span></div></slot>\n </div>\n </div>\n ',customElements.define("base-fetch-container",class extends HTMLElement{get target(){return this.getAttribute("target")?this.querySelector(this.getAttribute("target")):this}get history(){return this.getAttribute("history")}constructor(){super(),this.attachShadow({mode:"open"}).appendChild(t.content.cloneNode(!0)),this.items=[],new MutationObserver((()=>{this.updateItems()})).observe(this,{childList:!0,subtree:!0})}connectedCallback(){this.updateItems()}updateItems(){this.items=this.items.filter((t=>t.isConnected));const t=Array.from(this.querySelectorAll("[data-fetch]")).filter((t=>t.closest("base-fetch-container")===this));for(let e of t)this.addItem(e)}addItem(t){if(-1===this.items.indexOf(t)){this.items.push(t);const e=async e=>{const n=this.getAttribute("target")?this.querySelector(this.getAttribute("target")):this;if(this.getAttribute("extract")){const t=(new DOMParser).parseFromString(e,"text/html").querySelector(this.getAttribute("extract"));n.innerHTML="",n.insertAdjacentElement("afterbegin",t)}else n.innerHTML=e;return this.dispatchEvent(new CustomEvent("fetch.end",{bubbles:!0,detail:{item:t,target:n}})),!0},n=t=>{"push"===this.history?history.pushState({},null,t):"replace"===this.history&&history.replaceState({},null,t)};t instanceof HTMLAnchorElement?t.addEventListener("click",(r=>{r.preventDefault();const a=new CustomEvent("fetch.start",{bubbles:!0,cancelable:!0,detail:{item:t}});this.dispatchEvent(a),a.defaultPrevented||(this.setAttribute("loading",t.dataset.fetch),fetch(t.dataset.fetch).then((t=>t.text())).then((e=>(this.history&&t.href&&n(t.href),e))).then((t=>e(t))).then((()=>{this.removeAttribute("loading")})).catch((t=>{console.error(t),this.removeAttribute("loading")})))})):t instanceof HTMLFormElement&&t.addEventListener("submit",(async r=>{r.preventDefault();let a=t.dataset.fetch,i={method:t.method};const s=new FormData(t);r.submitter&&r.submitter.getAttribute("name")&&!s.has(r.submitter.getAttribute("name"))&&s.append(r.submitter.getAttribute("name").toString(),r.submitter.getAttribute("value").toString());const o="GET"===t.method.toUpperCase();o?(a+=a.indexOf("?")>-1?"&":"?",a+=new URLSearchParams(s).toString()):"multipart/form-data"===t.enctype.toLowerCase()?i.body=s:(i.body=new URLSearchParams(s),i.headers={},i.headers["Content-Type"]="application/x-www-form-urlencoded");const d=new CustomEvent("fetch.start",{bubbles:!0,cancelable:!0,detail:{item:t,formData:s,uri:a,options:i}});this.dispatchEvent(d),d.defaultPrevented||(this.setAttribute("loading",a),fetch(a,i).then((t=>t.text())).then((e=>{if(this.history&&o){let e=t.action;e+=e.indexOf("?")>-1?"&":"?",e+=new URLSearchParams(s).toString(),n(e)}return e})).then((t=>e(t))).then((()=>{this.removeAttribute("loading")})).catch((t=>{console.error(t),this.removeAttribute("loading")})))}
1))}}})}},"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t,{once:!0,passive:!0}); 2//# sourceMappingURL=base-fetch-container.js.map
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.