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ACF,4BACC,KAAK,IAAMD,GAAS,EAGbA,EAAA,CACV,CACD,EACA,KAAK,KACAF,WACF,OAGE,4CAAAI,KAAA,GACF,wBAIK,KACR,EACA,KAAK,IAAM,CACJ,MAAAC,EAAwB,OAAO,aAAa,UAQ9C,cAAOA,EAAsB,SAAY,aACrBA,EAAA,QAAU,SAAiBC,EAAW,CACnD,WACT,GAIK,KACR","names":["shouldLoadPolyfills","ex","shouldLoadIntersectionObserverPolyfill","loadPolyfillsSometimes","resolve","__vitePreload","n","HTMLDocumentPrototype","_selector"],"ignoreList":[],"sources":["../../../app/assets/javascripts/apps/spacious_website/polyfills/index.ts"],"sourcesContent":["\n// Static import\ndeclare global {\n interface Window {\n IntersectionObserverEntry: any\n }\n interface HTMLDocument {\n closest?: (selector: string) => null\n }\n}\n\n/* eslint-disable complexity */\nfunction shouldLoadPolyfills(): boolean {\n if (typeof Object.assign !== \"function\") { return true }\n if (typeof Object.create !== \"function\") { return true }\n if (typeof Object.defineProperty !== \"function\") { return true }\n if (typeof Object.defineProperties !== \"function\") { return true }\n if (typeof Object.keys !== \"function\") { return true }\n\n if (typeof Object.entries !== \"function\") { return true }\n if (typeof Object.values !== \"function\") { return true }\n\n if (typeof Array.isArray !== \"function\") { return true }\n if (typeof Array.from !== \"function\") { return true }\n if (typeof Array.prototype.forEach !== \"function\") { return true }\n if (typeof Array.prototype.map !== \"function\") { return true }\n if (typeof Array.prototype.join !== \"function\") { return true }\n if (typeof Array.prototype.indexOf !== \"function\") { return true }\n if (typeof Array.prototype.slice !== \"function\") { return true }\n if (typeof Array.prototype.every !== \"function\") { return true }\n if (typeof Array.prototype.some !== \"function\") { return true }\n if (typeof Array.prototype.includes !== \"function\") { return true }\n if (typeof Array.prototype.find !== \"function\") { return true }\n if (typeof Array.prototype.reduce !== \"function\") { return true }\n if (typeof Array.prototype.filter !== \"function\") { return true }\n\n if (typeof String.prototype.trim !== \"function\") { return true }\n if (typeof String.prototype.includes !== \"function\") { return true }\n if (typeof String.prototype.replaceAll !== \"function\") { return true }\n\n if (typeof Number.isNaN !== \"function\") { return true }\n\n if (typeof Set !== \"function\") { return true }\n\n // Used by https://github.com/instantpage/instant.page\n // https://dom.spec.whatwg.org/#dom-element-closest\n if (typeof Element.prototype.closest !== \"function\") { return true }\n\n // https://babeljs.io/docs/en/babel-plugin-transform-es2015-for-of\n if (typeof Symbol !== \"function\") { return true }\n\n if (typeof Promise !== \"function\") { return true }\n\n if (typeof fetch !== \"function\") { return true }\n if (typeof AbortController !== \"function\") { return true }\n if (typeof URLSearchParams !== \"function\") { return true }\n\n // Class list support detection\n // Code from https://github.com/eligrey/classList.js\n if (\n !(\"classList\" in document.createElement(\"_\"))\n || document.createElementNS\n && !(\"classList\" in document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\"))\n ) { return true }\n\n // Got error = need event polyfill\n // Code from https://github.com/lifaon74/events-polyfill\n try {\n new Event(\"event\", { bubbles: true, cancelable: true })\n }\n catch (ex) { return true }\n\n return false\n}\n/* eslint-enable complexity */\n\nfunction shouldLoadIntersectionObserverPolyfill(): boolean {\n // Conditional code from\n // https://github.com/w3c/IntersectionObserver\n return !(\"IntersectionObserver\" in window &&\n \"IntersectionObserverEntry\" in window &&\n \"intersectionRatio\" in window.IntersectionObserverEntry.prototype)\n}\n\nconst loadPolyfillsSometimes = (): Promise => {\n return new Promise((resolve) => {\n if (shouldLoadPolyfills()) {\n import(\n \"./optional_content\"\n )\n .then(() => resolve())\n }\n else {\n resolve()\n }\n })\n .then(() => {\n if (shouldLoadIntersectionObserverPolyfill()) {\n import(\n // Since all mobile Safari needs this (even 12)\n // We include the polyfill file in main chunks (one of them)\n \"intersection-observer\"\n )\n }\n\n // Return nothing, that's fine\n return null\n })\n .then(() => {\n const HTMLDocumentPrototype = window.HTMLDocument.prototype\n // Polyfill for `HTMLDocument#closest`\n // Normally only `Element#closest` is needed\n // But the lib `instant.page` this project using\n // https://github.com/instantpage/instant.page/blob/v5.1.0/instantpage.js\n // sometimes encounter `event.target` as `HTMLDocument`\n // and raises `t.target.closest is not a function`\n // So this is just to suppress that error\n if (typeof HTMLDocumentPrototype.closest !== \"function\") {\n HTMLDocumentPrototype.closest = function closest(_selector) {\n return null\n }\n }\n\n // Return nothing, that's fine\n return null\n })\n}\n\nexport {\n loadPolyfillsSometimes,\n}\n"],"file":"assets/index-BtDpTgCk.js"}