@shgysk8zer0/polyfills 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/all.min.js +5 -5
- package/all.min.js.map +1 -1
- package/array.js +23 -0
- package/assets/CookieStore.js +12 -14
- package/element.js +23 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [v0.2.7] - 2023-11-26
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Add `Array.prototype.lastIndex` and `Array.prototype.lastItem`
|
|
13
|
+
|
|
14
|
+
## [v0.2.6]- 2023-10-29
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- `cookieStore` now supports `partitioned`
|
|
18
|
+
- `<iframe credentialless>` & `<iframe loading="lazy">` (just the attributes / getters & setters)
|
|
19
|
+
|
|
20
|
+
### Removed
|
|
21
|
+
- Do not set `httpOnly` in `cookieStore`
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Change default `sameSite` to `'lax'` for `cookieStore`s
|
|
25
|
+
|
|
9
26
|
## [v0.2.5] - 2023-10-26
|
|
10
27
|
|
|
11
28
|
### Added
|
package/all.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(){"use strict";function e(e,t,n,{writable:o=!0,enumerable:r=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:n,writable:o,enumerable:r,configurable:i})}function t(e,t,{get:n,set:o,enumerable:r=!0,configurable:i=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:n,set:o,enumerable:r,configurable:i})}var n;!function(){"undefined"==typeof globalThis&&("undefined"!=typeof window?Object.defineProperty(Window.prototype,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:window}):"undefined"!=typeof global?Object.defineProperty(global,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:global}):"undefined"!=typeof self?Object.defineProperty(self,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:self}):Object.defineProperty(this,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:this}))}(),!("crypto"in window)&&"msCrypto"in window&&(globalThis.crypto=globalThis.msCrypto),"Notification"in window||(globalThis.Notification=globalThis.notifications||globalThis.webkitNotifications||globalThis.oNotifications||globalThis.msNotifications||!1),"doNotTrack"in navigator||(navigator.doNotTrack=globalThis.doNotTrack||navigator.msDoNotTrack||"unspecified"),"indexedDB"in window||(globalThis.indexedDB=globalThis.indexedDB||globalThis.mozIndexedDB||globalThis.webkitIndexedDB||globalThis.msIndexedDB||!1),"hidden"in document||(document.hidden=document.webkitHidden||document.msHidden||document.mozHidden||!1),"visibilityState"in document||(document.visibilityState=document.webkitVisibilityState||document.msVisibilityState||document.mozVisibilityState||"visible"),"fullscreenElement"in document||(document.fullscreenElement=document.mozFullScreenElement||document.webkitFullscreenElement||!1),"requestAnimationFrame"in window||(globalThis.requestAnimationFrame=globalThis.mozRequestAnimationFrame||globalThis.webkitRequestAnimationFrame||globalThis.msRequestAnimationFrame||!1),"exitFullscreen"in Document.prototype||(Document.prototype.exitFullscreen=document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msCancelFullScreen||!1),"requestFullscreen"in HTMLElement.prototype||(HTMLElement.prototype.requestFullscreen=HTMLElement.prototype.requestFullScreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.webkitRequestFullScreen||!1),"fullscreen"in Document.prototype||Object.defineProperty(Document.prototype,"fullscreen",{get:()=>document.fullscreenElement instanceof Element}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce(((e,n,o)=>{const r=t.call(e,n,o);return e.hasOwnProperty(r)?e[r].push(n):e[r]=[n],e}),{})}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:n}={}){const o=this.has(e);if(o&&n instanceof Function){const t=this.get(e),o=n.call(this,t,e,this);return o!==t&&this.set(e,o),o}if(o)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}throw new Error("Key is not found and no `insert()` given")}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce(((e,n,o)=>(e.emplace(t.call(e,n,o),{insert:()=>[n],update:e=>(e.push(n),e)}),e)),new Map)}),function(){const e=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const n=(e,o)=>{Array.isArray(e)&&o>=0?e.forEach((e=>n(e,o-1))):t.push(e)};return n(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let n;return this.forEach(((o,r,i)=>{e.call(t,o,r,i)&&(n=o)}),t),n}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let n=-1;return this.forEach(((o,r,i)=>{e.call(t,o,r,i)&&(n=r)}),t),n}),!(Array.prototype.at instanceof Function)){const t=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const n of e)void 0!==n&&Object.defineProperty(n.prototype,"at",{value:t,writable:!0,enumerable:!1,configurable:!0})}!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,n=globalThis){let o=[];for await(const t of e)o.push(await t);return Array.from(o,t,n)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every(((t,n)=>{const o=e[n];return Array.isArray(t)?Array.isArray(o)&&t.equals(o):Object.is(t,o)})))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){if(void 0===e)return[...new Set(this)];if("string"==typeof e){const t=[];return this.filter((n=>{const o=n[e];return!t.includes(o)&&(t.push(o),!0)}))}if(e instanceof Function){const t=[];return this.filter(((...n)=>{try{const o=e.apply(this,n);return"string"==typeof o&&(!t.includes(o)&&(t.push(o),!0))}catch(e){return!1}}))}throw new TypeError("Not a valid argument for uniqueBy")}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...n){const o=[...this];return o.splice(e,t,...n),o}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const n=[...this];return n[e]=t,n})}(),"Symbol"in globalThis&&(void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator"))),function(){if(!(Function.prototype.once instanceof Function)){const e=new WeakMap;Function.prototype.once=function(t){const n=this;return function(...o){if(e.has(n))return e.get(n);if("AsyncFunction"===n.constructor.name){const r=n.apply(t||n,o).catch((t=>{throw e.delete(n),t}));return e.set(n,r),r}if(n instanceof Function){const r=n.apply(t||n,o);return e.set(n,r),r}}}}}(),e(URL,"canParse",((e,t)=>{try{return new URL(e,t),!0}catch{return!1}})),Number.range instanceof Function||(Number.range=function(e,t,n=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:n})}),function(){"Iterator"in globalThis||(globalThis.Iterator={prototype:Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))});const e=globalThis.Iterator;e.range instanceof Function||(e.range=function*(t,n,o){if("number"==typeof o||"bigint"==typeof o)for(const r of e.range(t,n,{step:o}))yield r;else if("object"!=typeof o||Object.is(o,null))for(const o of e.range(t,n,{}))yield o;else{const{step:e=("number"==typeof t?t<n?1:-1:t<n?1n:-1n),inclusive:r=!1}=o;if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("Start must be a number");if(Number.isNaN(t))throw new RangeError("Invalid start");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("End must be a number");if(Number.isNaN(n))throw new RangeError("Invalid end");if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Step must be a number");if(Number.isNaN(e))throw new RangeError("Invalid step");if(0===e)throw new RangeError("Step must not be 0");if(e<0&&t<n||e>0&&t>n)return;if(r)if(e>0)for(let o=t;o<=n;o+=e)yield o;else for(let o=t;o>=n;o+=e)yield o;else if(e>0)for(let o=t;o<n;o+=e)yield o;else for(let o=t;o>n;o+=e)yield o}}),e.prototype[Symbol.toStringTag]||(e.prototype[Symbol.toStringTag]="Iterator"),e.prototype.take instanceof Function||(e.prototype.take=function*(e){let t=0;for(const n of this){if(++t>e)break;yield n}}),e.prototype.drop instanceof Function||(e.prototype.drop=function*(e){let t=0;for(const n of this)t++>=e&&(yield n)}),e.prototype.toArray instanceof Function||(e.prototype.toArray=function(){return Array.from(this)}),e.prototype.forEach instanceof Function||(e.prototype.forEach=function(e){for(const t of this)e(t)}),e.prototype.map instanceof Function||(e.prototype.map=function*(e){for(const t of this)yield e(t)}),e.prototype.reduce instanceof Function||(e.prototype.reduce=function(e,t){let n=void 0===t?this.next().value:t;for(const t of this)n=e(n,t);return n}),e.prototype.filter instanceof Function||(e.prototype.filter=function*(e){for(const t of this)e(t)&&(yield t)}),e.prototype.some instanceof Function||(e.prototype.some=function(e){let t=!1;for(const n of this)if(e(n)){t=!0;break}return t}),e.prototype.every instanceof Function||(e.prototype.every=function(e){let t=!0;for(const n of this)if(!e(n)){t=!1;break}return t}),e.prototype.find instanceof Function||(e.prototype.find=function(e){for(const t of this)if(e(t))return t}),e.prototype.indexed instanceof Function||(e.prototype.indexed=function*(){let e=0;for(const t of this)yield[e++,t]})}(),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=e=>e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=e=>(e>0)-(e<0)||+e),Math.hasOwnProperty("trunc")||(Math.trunc=e=>{const t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t}),Math.hasOwnProperty("expm1")||(Math.expm1=e=>Math.exp(e)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...e)=>Math.sqrt(e.reduce(((e,t)=>e+t**2),0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=e=>e**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=e=>Math.log(e)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=e=>Math.log(e)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=e=>Math.log(1+e)),Math.hasOwnProperty("fround")||(Math.fround=(n=new Float32Array(1),function(e){return n[0]=e,n[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,n){return Math.min(Math.max(e,t),n)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",n=[t,"file:","wss:"],o=(e=globalThis.document)=>[...e.scripts].every((({src:n})=>{if(0===n.length)return!0;{const{protocol:o,hostname:r}=new URL(n,e.baseURI);return o===t||r===location.hostname}}));Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!n.includes(location.protocol)&&!e.includes(location.hostname))&&o())}})}}();const o=new WeakMap;function r(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}function i(e){return"object"==typeof e&&!Object.is(e,null)&&!Array.isArray(e)}function a(e){switch(typeof e){case"undefined":return"Undefined";case"function":return"prototype"in e?a(e.prototype):"constructor"in e?e.constructor.name:"Function";case"object":return Object.is(e,null)?"Null":"constructor"in e?e.constructor.name:Symbol.toStringTag in e?e[Symbol.toStringTag]:"prototype"in e?a(e.prototype):(console.log(e),"Unknown Object");case"string":return"String";case"number":return Number.isNaN(e)?"NaN":"Number";case"bigint":return"BigInt";case"boolean":return"Boolean";case"symbol":return"Symbol";default:return"Unknown"}}function s(e,t){return e.once instanceof Function?e.once(t):function(...n){if(o.has(e))return o.get(e);if(r(e)){const r=e.apply(t||this,n).catch((t=>{throw o.delete(e),t}));return o.set(e,r),r}if(e instanceof Function){const r=e.apply(t||this,n);return o.set(e,r),r}}}
|
|
1
|
+
!function(){"use strict";function e(e,t,n,{writable:o=!0,enumerable:r=!0,configurable:i=!0}={}){e[t]instanceof Function||Object.defineProperty(e,t,{value:n,writable:o,enumerable:r,configurable:i})}function t(e,t,{get:n,set:o,enumerable:r=!0,configurable:i=!0}={}){e.hasOwnProperty(t)||Object.defineProperty(e,t,{get:n,set:o,enumerable:r,configurable:i})}var n;!function(){"undefined"==typeof globalThis&&("undefined"!=typeof window?Object.defineProperty(Window.prototype,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:window}):"undefined"!=typeof global?Object.defineProperty(global,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:global}):"undefined"!=typeof self?Object.defineProperty(self,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:self}):Object.defineProperty(this,"globalThis",{enumerable:!1,writable:!0,configurable:!0,value:this}))}(),!("crypto"in window)&&"msCrypto"in window&&(globalThis.crypto=globalThis.msCrypto),"Notification"in window||(globalThis.Notification=globalThis.notifications||globalThis.webkitNotifications||globalThis.oNotifications||globalThis.msNotifications||!1),"doNotTrack"in navigator||(navigator.doNotTrack=globalThis.doNotTrack||navigator.msDoNotTrack||"unspecified"),"indexedDB"in window||(globalThis.indexedDB=globalThis.indexedDB||globalThis.mozIndexedDB||globalThis.webkitIndexedDB||globalThis.msIndexedDB||!1),"hidden"in document||(document.hidden=document.webkitHidden||document.msHidden||document.mozHidden||!1),"visibilityState"in document||(document.visibilityState=document.webkitVisibilityState||document.msVisibilityState||document.mozVisibilityState||"visible"),"fullscreenElement"in document||(document.fullscreenElement=document.mozFullScreenElement||document.webkitFullscreenElement||!1),"requestAnimationFrame"in window||(globalThis.requestAnimationFrame=globalThis.mozRequestAnimationFrame||globalThis.webkitRequestAnimationFrame||globalThis.msRequestAnimationFrame||!1),"exitFullscreen"in Document.prototype||(Document.prototype.exitFullscreen=document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msCancelFullScreen||!1),"requestFullscreen"in HTMLElement.prototype||(HTMLElement.prototype.requestFullscreen=HTMLElement.prototype.requestFullScreen||HTMLElement.prototype.mozRequestFullScreen||HTMLElement.prototype.webkitRequestFullScreen||!1),"fullscreen"in Document.prototype||Object.defineProperty(Document.prototype,"fullscreen",{get:()=>document.fullscreenElement instanceof Element}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Array.from(e).reduce(((e,n,o)=>{const r=t.call(e,n,o);return e.hasOwnProperty(r)?e[r].push(n):e[r]=[n],e}),{})}),Map.prototype.emplace instanceof Function||(Map.prototype.emplace=function(e,{insert:t,update:n}={}){const o=this.has(e);if(o&&n instanceof Function){const t=this.get(e),o=n.call(this,t,e,this);return o!==t&&this.set(e,o),o}if(o)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}throw new Error("Key is not found and no `insert()` given")}),Map.groupBy instanceof Function||(Map.groupBy=function(e,t){return Array.from(e).reduce(((e,n,o)=>(e.emplace(t.call(e,n,o),{insert:()=>[n],update:e=>(e.push(n),e)}),e)),new Map)}),function(){const e=[Array,String,globalThis.Int8Array,globalThis.Uint8Array,globalThis.Uint8ClampedArray,globalThis.Int16Array,globalThis.Uint16Array,globalThis.Int32Array,globalThis.Uint32Array,globalThis.Float32Array,globalThis.Float64Array,globalThis.BigInt64Array,globalThis.BigUint64Array];if(Array.prototype.flat instanceof Function||(Array.prototype.flat=function(e=1){const t=[];e=Math.min(Number.MAX_SAFE_INTEGER,Math.max(0,e));const n=(e,o)=>{Array.isArray(e)&&o>=0?e.forEach((e=>n(e,o-1))):t.push(e)};return n(this,Number.isNaN(e)?0:e),t}),Array.prototype.flatMap instanceof Function||(Array.prototype.flatMap=function(e,t){return this.map(e,t).flat(1)}),Array.prototype.findLast instanceof Function||(Array.prototype.findLast=function(e,t){let n;return this.forEach(((o,r,i)=>{e.call(t,o,r,i)&&(n=o)}),t),n}),"lastIndex"in Array.prototype||Object.defineProperty(Array.prototype,"lastIndex",{enumerable:!1,configurable:!1,get:function(){return Math.max(0,this.length-1)}}),"lastItem"in Array.prototype||Object.defineProperty(Array.prototype,"lastItem",{enumerable:!1,configurable:!1,get:function(){return this[this.lastIndex]},set:function(e){this[this.lastIndex]=e}}),Array.prototype.findLastIndex instanceof Function||(Array.prototype.findLastIndex=function(e,t){let n=-1;return this.forEach(((o,r,i)=>{e.call(t,o,r,i)&&(n=r)}),t),n}),!(Array.prototype.at instanceof Function)){const t=function(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]};for(const n of e)void 0!==n&&Object.defineProperty(n.prototype,"at",{value:t,writable:!0,enumerable:!1,configurable:!0})}!(Array.prototype.group instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.group=function(e){return console.warn("`Array.group()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupBy instanceof Function)&&Object.groupBy instanceof Function&&(Array.prototype.groupBy=function(e){return console.warn("`Array.goupBy()` is deprecated. Please use `Object.groupBy()` instead."),Object.groupBy(this,e)}),!(Array.prototype.groupToMap instanceof Function)&&Map.groupBy instanceof Function&&(Array.prototype.groupToMap=function(e){return console.warn("`Array.groupToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Map.groupBy instanceof Function&&(Array.prototype.groupByToMap=function(e){return console.warn("`Array.groupByToMap()` is deprecated. Please use `Map.groupBy()` instead."),Map.groupBy(this,e)}),Array.fromAsync instanceof Function||(Array.fromAsync=async function(e,t,n=globalThis){let o=[];for await(const t of e)o.push(await t);return Array.from(o,t,n)}),Array.prototype.equals instanceof Function||(Array.prototype.equals=function(e){return this===e||!!Array.isArray(e)&&(this.length===e.length&&this.every(((t,n)=>{const o=e[n];return Array.isArray(t)?Array.isArray(o)&&t.equals(o):Object.is(t,o)})))}),Array.prototype.uniqueBy instanceof Function||(Array.prototype.uniqueBy=function(e){if(void 0===e)return[...new Set(this)];if("string"==typeof e){const t=[];return this.filter((n=>{const o=n[e];return!t.includes(o)&&(t.push(o),!0)}))}if(e instanceof Function){const t=[];return this.filter(((...n)=>{try{const o=e.apply(this,n);return"string"==typeof o&&(!t.includes(o)&&(t.push(o),!0))}catch(e){return!1}}))}throw new TypeError("Not a valid argument for uniqueBy")}),Array.prototype.toReversed instanceof Function||(Array.prototype.toReversed=function(){return[...this].reverse()}),Array.prototype.toSorted instanceof Function||(Array.prototype.toSorted=function(e){return[...this].sort(e)}),Array.prototype.toSpliced instanceof Function||(Array.prototype.toSpliced=function(e,t,...n){const o=[...this];return o.splice(e,t,...n),o}),Array.prototype.with instanceof Function||(Array.prototype.with=function(e,t){const n=[...this];return n[e]=t,n})}(),"Symbol"in globalThis&&(void 0===Symbol.toStringTag&&(Symbol.toStringTag=Symbol("Symbol.toStringTag")),void 0===Symbol.iterator&&(Symbol.iterator=Symbol("Symbol.iterator"))),function(){if(!(Function.prototype.once instanceof Function)){const e=new WeakMap;Function.prototype.once=function(t){const n=this;return function(...o){if(e.has(n))return e.get(n);if("AsyncFunction"===n.constructor.name){const r=n.apply(t||n,o).catch((t=>{throw e.delete(n),t}));return e.set(n,r),r}if(n instanceof Function){const r=n.apply(t||n,o);return e.set(n,r),r}}}}}(),e(URL,"canParse",((e,t)=>{try{return new URL(e,t),!0}catch{return!1}})),Number.range instanceof Function||(Number.range=function(e,t,n=1){return console.warn("`Number.range()` is deprecated. Use `Iterator.range()` instead."),globalThis.Iterator.range(e,t,{step:n})}),function(){"Iterator"in globalThis||(globalThis.Iterator={prototype:Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))});const e=globalThis.Iterator;e.range instanceof Function||(e.range=function*(t,n,o){if("number"==typeof o||"bigint"==typeof o)for(const r of e.range(t,n,{step:o}))yield r;else if("object"!=typeof o||Object.is(o,null))for(const o of e.range(t,n,{}))yield o;else{const{step:e=("number"==typeof t?t<n?1:-1:t<n?1n:-1n),inclusive:r=!1}=o;if("number"!=typeof t&&"bigint"!=typeof t)throw new TypeError("Start must be a number");if(Number.isNaN(t))throw new RangeError("Invalid start");if("number"!=typeof n&&"bigint"!=typeof n)throw new TypeError("End must be a number");if(Number.isNaN(n))throw new RangeError("Invalid end");if("number"!=typeof e&&"bigint"!=typeof e)throw new TypeError("Step must be a number");if(Number.isNaN(e))throw new RangeError("Invalid step");if(0===e)throw new RangeError("Step must not be 0");if(e<0&&t<n||e>0&&t>n)return;if(r)if(e>0)for(let o=t;o<=n;o+=e)yield o;else for(let o=t;o>=n;o+=e)yield o;else if(e>0)for(let o=t;o<n;o+=e)yield o;else for(let o=t;o>n;o+=e)yield o}}),e.prototype[Symbol.toStringTag]||(e.prototype[Symbol.toStringTag]="Iterator"),e.prototype.take instanceof Function||(e.prototype.take=function*(e){let t=0;for(const n of this){if(++t>e)break;yield n}}),e.prototype.drop instanceof Function||(e.prototype.drop=function*(e){let t=0;for(const n of this)t++>=e&&(yield n)}),e.prototype.toArray instanceof Function||(e.prototype.toArray=function(){return Array.from(this)}),e.prototype.forEach instanceof Function||(e.prototype.forEach=function(e){for(const t of this)e(t)}),e.prototype.map instanceof Function||(e.prototype.map=function*(e){for(const t of this)yield e(t)}),e.prototype.reduce instanceof Function||(e.prototype.reduce=function(e,t){let n=void 0===t?this.next().value:t;for(const t of this)n=e(n,t);return n}),e.prototype.filter instanceof Function||(e.prototype.filter=function*(e){for(const t of this)e(t)&&(yield t)}),e.prototype.some instanceof Function||(e.prototype.some=function(e){let t=!1;for(const n of this)if(e(n)){t=!0;break}return t}),e.prototype.every instanceof Function||(e.prototype.every=function(e){let t=!0;for(const n of this)if(!e(n)){t=!1;break}return t}),e.prototype.find instanceof Function||(e.prototype.find=function(e){for(const t of this)if(e(t))return t}),e.prototype.indexed instanceof Function||(e.prototype.indexed=function*(){let e=0;for(const t of this)yield[e++,t]})}(),Number.hasOwnProperty("isSafeInteger")||(Number.MAX_SAFE_INTEGER=2**53-1,Number.MIN_SAFE_INTEGER=-Number.MAX_SAFE_INTEGER,Number.isSafeInteger=e=>e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER),Number.hasOwnProperty("EPSILON")||(Number.EPSILON=2**-52),Math.hasOwnProperty("sign")||(Math.sign=e=>(e>0)-(e<0)||+e),Math.hasOwnProperty("trunc")||(Math.trunc=e=>{const t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t}),Math.hasOwnProperty("expm1")||(Math.expm1=e=>Math.exp(e)-1),Math.hasOwnProperty("hypot")||(Math.hypot=(...e)=>Math.sqrt(e.reduce(((e,t)=>e+t**2),0))),Math.hasOwnProperty("cbrt")||(Math.cbrt=e=>e**(1/3)),Math.hasOwnProperty("log10")||(Math.log10=e=>Math.log(e)*Math.LOG10E),Math.hasOwnProperty("log2")||(Math.log2=e=>Math.log(e)*Math.LOG2E),Math.hasOwnProperty("log1p")||(Math.log1p=e=>Math.log(1+e)),Math.hasOwnProperty("fround")||(Math.fround=(n=new Float32Array(1),function(e){return n[0]=e,n[0]})),Math.clamp instanceof Function||(Math.clamp=function(e,t,n){return Math.min(Math.max(e,t),n)}),Math.constrain instanceof Function||(Math.constrain=Math.clamp),function(){if(!("isSecureContext"in globalThis)){const e=["localhost","127.0.0.1"],t="https:",n=[t,"file:","wss:"],o=(e=globalThis.document)=>[...e.scripts].every((({src:n})=>{if(0===n.length)return!0;{const{protocol:o,hostname:r}=new URL(n,e.baseURI);return o===t||r===location.hostname}}));Object.defineProperty(globalThis,"isSecureContext",{enumerable:!0,configurable:!0,get:function(){return window.parent===window&&(!(!n.includes(location.protocol)&&!e.includes(location.hostname))&&o())}})}}();const o=new WeakMap;function r(e){return e instanceof Function&&"AsyncFunction"===e.constructor.name}function i(e){return"object"==typeof e&&!Object.is(e,null)&&!Array.isArray(e)}function a(e){switch(typeof e){case"undefined":return"Undefined";case"function":return"prototype"in e?a(e.prototype):"constructor"in e?e.constructor.name:"Function";case"object":return Object.is(e,null)?"Null":"constructor"in e?e.constructor.name:Symbol.toStringTag in e?e[Symbol.toStringTag]:"prototype"in e?a(e.prototype):(console.log(e),"Unknown Object");case"string":return"String";case"number":return Number.isNaN(e)?"NaN":"Number";case"bigint":return"BigInt";case"boolean":return"Boolean";case"symbol":return"Symbol";default:return"Unknown"}}function s(e,t){return e.once instanceof Function?e.once(t):function(...n){if(o.has(e))return o.get(e);if(r(e)){const r=e.apply(t||this,n).catch((t=>{throw o.delete(e),t}));return o.set(e,r),r}if(e instanceof Function){const r=e.apply(t||this,n);return o.set(e,r),r}}}
|
|
2
2
|
/**
|
|
3
3
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
4
4
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Lock
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/;class F{get encoding(){return"utf-8"}encode(e){return new Uint8Array(e.split("").flatMap((e=>{const t=e.charCodeAt(0);if(t<128)return[t];return[194+Math.floor((t-128)/64),t%64+128]})))}encodeInto(e,t){if(t instanceof Uint8Array){const n=this.encode(e),o=Math.min(t.length,n.length);return n.length>t.length?t.set(n.slice(0,o)):t.set(n),{read:o,written:o}}throw new TypeError("TextEncoder.encodeInto: Argument 2 does not implement interface Uint8Array.")}}
|
|
12
12
|
/**
|
|
13
13
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
14
|
-
*/const k=["utf-8","utf8"];class
|
|
14
|
+
*/const k=["utf-8","utf8"];class P{constructor(e="utf-8",{fatal:t=!1,ignoreBOM:n=!1}={}){if(e="string"!=typeof e?e.toString().toLowerCase():e.toLowerCase(),!k.includes(e))throw new RangeError(`TextDecoder constructor: The given encoding '${e}' is not supported.`);Object.defineProperties(this,{encoding:{configurable:!1,enumerable:!0,writable:!1,value:e},fatal:{configurable:!1,enumerable:!0,writable:!1,value:t},ignoreBOM:{configurable:!1,enumerable:!0,writable:!1,value:n}})}decode(e){switch(this.encoding){case"utf-8":case"utf8":{let t=NaN;return e.reduce(((e,n,o)=>{if(Number.isNaN(t)&&n<128)return e+String.fromCharCode(n);if(Number.isNaN(t)&&n>193)return t=n,e;if(t>193&&(r=128,a=194,"number"==typeof(i=n)&&i>=r&&i<=a)){const o=64*(t-194);return t=NaN,e+String.fromCharCode(o+n)}if(this.fatal)throw new RangeError(`Unhandled character at postion ${o}`);return t=NaN,e;var r,i,a}),"")}default:throw new TypeError(`Unsupported encoding '${this.encoding}'`)}}}"TextEncoder"in globalThis||(globalThis.TextEncoder=F),"TextDecoder"in globalThis||(globalThis.TextDecoder=P),globalThis.TextEncoder.prototype.encodeInto instanceof Function||(globalThis.TextEncoder.prototype.encodeInto=function(...e){return F.prototype.encodeInto.apply(this,e)}),!(crypto in globalThis)||crypto.randomUUID instanceof Function||(crypto.randomUUID=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)))})
|
|
15
15
|
/**
|
|
16
16
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
17
17
|
* @SEE https://wicg.github.io/cookie-store/
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
* cookie properties, such as expires, etc.
|
|
21
21
|
*
|
|
22
22
|
* @TODO verify spec compliance as best as is possible
|
|
23
|
-
*/;const
|
|
23
|
+
*/;const O="cookieStore"in globalThis,N={constructor:Symbol("constructor")};function x(){return 0===document.cookie.length?[]:document.cookie.split(";").map((e=>{const[t,n=null]=e.split("=");return{name:decodeURIComponent(t.trim()),value:"string"==typeof n?decodeURIComponent(n.trim()):null,path:void 0,expires:void 0,domain:void 0,sameSite:void 0,secure:void 0,partitioned:!1}}))}function C({name:e=null,value:t=null}={}){return"string"==typeof e&&(e=decodeURIComponent(e)),"string"==typeof t&&(t=decodeURIComponent(t)),"string"==typeof e&&"string"==typeof t?x().filter((n=>n.name===e&&n.value===t)):"string"==typeof e?x().filter((t=>t.name===e)):"string"==typeof t?x().filter((e=>e.value===t)):x()}function I({name:e,value:t,expires:n=null,maxAge:o=null,path:r="/",sameSite:i="lax",domain:a=null,secure:s=!1,partitioned:l=!1}){if(Number.isInteger(o))I({name:e,value:t,expires:Date.now()+o,path:r,sameSite:i,domain:a,secure:s,partitioned:l});else{let o=`${encodeURIComponent(e)}=`;t&&(o+=encodeURIComponent(t)),Number.isInteger(n)?o+=`;expires=${new Date(n).toUTCString()}`:n instanceof Date&&(o+=`;expires=${n.toUTCString()}`),"string"==typeof r&&(o+=`;path=${r}`),"string"==typeof a&&(o+=`;domain=${a}`),"string"==typeof i&&(o+=`;sameSite=${i}`),!0===s&&(o+=";secure"),!0===l&&(o+=";partitioned"),document.cookie=o}}class D extends EventTarget{constructor(e){if(e!==N.constructor)throw new DOMException("Invalid constructor");super(),Object.defineProperty(this,N.onchange,{enumerable:!1,configurable:!1,writable:!0,value:null})}get onchange(){return this[N.onchange]}set onchange(e){this[N.onchange]instanceof Function&&this.removeEventListener("change",this[N.onchange]),e instanceof Function&&this.addEventListener("change",e)}async get(e){const t=await this.getAll(e);return Array.isArray(t)&&0!==t.length?t[0]:null}async getAll(e){return C("string"==typeof e?{name:e}:e)}async set(...e){if(1===e.length&&"object"==typeof e[0]&&"string"==typeof e[0].name){const t=function({name:e,value:t=null,domain:n=null,path:o="/",expires:r=null,maxAge:i=null,sameSite:a="lax",secure:s=!1,partitioned:l=!1}){return{name:e,value:t,domain:n,path:o,expires:r,maxAge:i,sameSite:a,secure:s,partitioned:l}}(e[0]);I(t);const n=new Event("change");n.changed=[t],n.deleted=[],this.dispatchEvent(n)}else{if(2!==e.length)throw new Error("Invalid arguments");this.set({name:e[0],value:e[1]})}}async delete(e={}){if("string"==typeof e)this.delete({name:e});else{if("object"!=typeof e||"string"!=typeof e.name)throw new TypeError("Failed to execute 'delete' on 'CookieStore': required member name is undefined.");{const t=await this.getAll(e);if(0!==t.length){const n=new Event("change");n.changed=[],n.deleted=new Array(t.length),t.forEach(((t,o)=>{t.path=e.path||"/",t.domain=e.domain||null,t.secure=e.secure||null,delete t.value,t.sameSite=e.sameSite||"lax",n.deleted[o]=t,I({...t,value:null,expires:1})})),this.dispatchEvent(n)}}}}}const R=new D(N.constructor);
|
|
24
24
|
/**
|
|
25
25
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
26
26
|
*/
|
|
27
|
-
function j(){return"trustedTypes"in globalThis&&trustedTypes instanceof EventTarget&&trustedTypes.createPolicy instanceof Function}!
|
|
27
|
+
function j(){return"trustedTypes"in globalThis&&trustedTypes instanceof EventTarget&&trustedTypes.createPolicy instanceof Function}!O&&(globalThis.cookieStore=R),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("finished")&&Object.defineProperty(Animation.prototype,"finished",{get:function(){return new Promise(((e,t)=>{"finished"===this.playState?e(this):(this.addEventListener("finish",(()=>e(this)),{once:!0}),this.addEventListener("error",(e=>t(e)),{once:!0}))}))}}),globalThis.hasOwnProperty("Animation")&&!Animation.prototype.hasOwnProperty("ready")&&Object.defineProperty(Animation.prototype,"ready",{get:function(){return new Promise(((e,t)=>{this.pending?(this.addEventListener("ready",(()=>e(this)),{once:!0}),this.addEventListener("error",(e=>t(e)),{once:!0})):e(this)}))}});
|
|
28
28
|
/**
|
|
29
29
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
30
30
|
*/
|
|
@@ -40,7 +40,7 @@ const oe=JSON.parse('{\n "allowCustomElements": false,\n "allowUnknownMarkup":
|
|
|
40
40
|
/**
|
|
41
41
|
* @copyright 2022-2023 Chris Zuber <admin@kernvalley.us>
|
|
42
42
|
*/
|
|
43
|
-
const me=new WeakMap;const{setHTML:fe,polyfill:he}=function(e,t){return{setHTML:re,polyfill:function(){let n=!1;if("Sanitizer"in globalThis){if(globalThis.Sanitizer.getDefaultConfiguration instanceof Function||(globalThis.Sanitizer.getDefaultConfiguration=function(){return t},n=!0),!(globalThis.Sanitizer.prototype.getConfiguration instanceof Function)){const e=new WeakMap,t=globalThis.Sanitizer;globalThis.Sanitizer=class extends t{constructor({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}=t.getDefaultConfiguration()){super({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}),e.set(this,{allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c})}getConfiguration(){return e.get(this)}},n=!0}globalThis.Sanitizer.prototype.sanitize instanceof Function||(globalThis.Sanitizer.prototype.sanitize=function(e){if(e instanceof Node){if([Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].includes(e.nodeType))return pe(e,this.getConfiguration());throw new TypeError("Expected a Document or DocumentFragment in `Sanitizer.sanitize()`.")}throw new TypeError("`Sanitizer.sanitize()` expects a `Node`")},n=!0),globalThis.Sanitizer.prototype.sanitizeFor instanceof Function||(globalThis.Sanitizer.prototype.sanitizeFor=function(e,t){const n=document.createElement(e);return re(n,t,this.getConfiguration()),n},n=!0),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,n=t){re(this,e,n)},n=!0)}else globalThis.Sanitizer=e,n=!0;return n}}}(class e{constructor({allowElements:t,allowAttributes:n,blockElements:o,dropAttributes:r,dropElements:i,allowComments:a=oe.allowComments,allowCustomElements:s=oe.allowCustomElements,allowUnknownMarkup:l=oe.allowUnknownMarkup}=e.getDefaultConfiguration()){me.set(this,{allowElements:t,allowComments:a,allowAttributes:n,allowCustomElements:s,blockElements:o,dropAttributes:r,dropElements:i,allowUnknownMarkup:l})}getConfiguration(){return me.get(this)}sanitize(e){return pe(e,this.getConfiguration())}sanitizeFor(e,t){const n=document.createElement(e);return n.setHTML(t,this.getConfiguration()),n}static getDefaultConfiguration(){return oe}},oe);he();const ye={get(){return Array.from(this.styleSheets).filter((e=>e.ownerNode.classList.contains("_adopted")))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach((e=>e.ownerNode.remove()));const n=[...new Set(e).difference(t)].map((e=>{const t=document.createElement("link"),n=new AbortController,o=n.signal,r=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=r,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",(({target:o})=>{n.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach(((e,t)=>{o.sheet.insertRule(e.cssText,t)})),setTimeout((()=>URL.revokeObjectURL(o.href)),100)}),{once:!0,signal:o}),t.addEventListener("error",(({target:e})=>{n.abort(),URL.revokeObjectURL(e.href)}),{once:!0,signal:o}),t}));this instanceof Document?this.head.append(...n):this.append(...n)}}};function ge(e){for(;e.cssRules.length>0;)e.deleteRule(0)}e(Document,"parseHTML",((...e)=>ue(...e))),t(Document.prototype,"adoptedStyleSheets",ye),"ShadowRoot"in globalThis&&t(ShadowRoot.prototype,"adoptedStyleSheets",ye);try{new CSSStyleSheet}catch{const e=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const n=function(e="",{disabled:t=!1,media:n}={}){const o=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);return"string"==typeof n&&o.media.appendMedium(n),o.disabled=t,o}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return n.deleteRule(0),n},globalThis.CSSStyleSheet.prototype=e.prototype,e.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),n=new AbortController,{resolve:o,reject:r,promise:i}=Promise.withResolvers();return t.addEventListener("load",(({target:e})=>{ge(this),[...e.sheet.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t))),o(this),n.abort(),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.addEventListener("error",(({target:e})=>{const t=new DOMException("Error loading stylesheet.");r(t),n.abort(t),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),i}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);ge(this),[...t.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t)))});const be={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"};if(HTMLScriptElement.supports instanceof Function||(HTMLScriptElement.supports=function(e){switch(e.toLowerCase()){case"classic":return!0;case"module":return"noModule"in HTMLScriptElement.prototype;default:return!1}}),!Element.prototype.hasOwnProperty(be.role)){const e=!0,t=!0,n=Object.fromEntries(Object.entries(be).map((([n,o])=>[n,{get:function(){return this.getAttribute(o)},set:function(e){"string"==typeof e?this.setAttribute(o,e):this.removeAttribute(o)},enumerable:e,configurable:t}])));Object.defineProperties(Element.prototype,n)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const e=new WeakMap,t=n=>{e.has(n)&&(n.tabIndex=e.get(n)),n.hasChildNodes()&&[...n.children].forEach(t)},n=t=>{-1!==t.tabIndex&&(e.set(t,t.tabIndex),t.tabIndex=-1),t.hasChildNodes()&&[...t.children].forEach(n)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),n(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),t(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise(((e,t)=>{const n=()=>{this.removeEventListener("error",o),this.removeEventListener("load",n),e()},o=e=>{this.removeEventListener("error",o),this.removeEventListener("load",n),t(e)};this.addEventListener("load",n),this.addEventListener("error",o)}))}),Element.prototype.setHTML instanceof Function?function(e,t,n){const{value:o,enumerable:r,configurable:i,writable:a}=Object.getOwnPropertyDescriptor(e,t),s=n(o);if(!(s instanceof Function))throw new TypeError(`Error overwriting ${t}. The func MUST be a function that accepts the original as an argument and return a function.`);Object.defineProperty(e,t,{value:s,enumerable:r,configurable:i,writable:a})}(Element.prototype,"setHTML",(function(e){return function(t,n={}){if(n.sanitizer instanceof Sanitizer)e.call(this,t,n);else{const o=new Sanitizer(function({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}={}){return void 0===e&&void 0===i&&(e=oe.allowAttributes),void 0===n&&void 0===a&&(n=oe.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}}(n));e.call(this,t,{sanitizer:o})}}})):Element.prototype.setHTML=function(e,t=oe){re(this,e,t)},!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){Object.defineProperty(HTMLTemplateElement.prototype,"shadowRootMode",{get:function(){return this.getAttribute("shadowrootmode")},set:function(e){this.setAttribute("shadowrootmode",e)},enumerable:!0,configurable:!0});const e=(t=document)=>{t.querySelectorAll("template[shadowrootmode]").forEach((t=>{const n=t.parentElement.attachShadow({mode:t.shadowRootMode});n.append(t.content),t.remove(),e(n)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>e(document)),{once:!0}):e(document)}HTMLFormElement.prototype.requestSubmit instanceof Function||(HTMLFormElement.prototype.requestSubmit=function(e){if(void 0===e){const e=document.createElement("button");e.type="submit",e.hidden=!0,this.append(e),this.requestSubmit(e),setTimeout((()=>e.remove()),100)}else{if(!(e instanceof HTMLButtonElement||e instanceof HTMLInputElement))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!("submit"===e.type||e instanceof HTMLInputElement&&"image"===e.type))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!this.isSameNode(e.form))throw new DOMException("HTMLFormElement.requestSubmit: The submitter is not owned by this form.","NotFoundError");e.click()}}),Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>!e.has(t))))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){return e instanceof Set||(e=new Set(e)),[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){return e instanceof Set||(e=new Set(e)),e.isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this.difference(e),...e.difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:n}={}){const o=this.has(e);if(o&&n instanceof Function){const t=this.get(e),o=n.call(this,t,e,this);return o!==t&&this.set(e,t),o}if(o)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}throw new Error("Key is not found and no `insert()` given")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
|
|
43
|
+
const me=new WeakMap;const{setHTML:fe,polyfill:he}=function(e,t){return{setHTML:re,polyfill:function(){let n=!1;if("Sanitizer"in globalThis){if(globalThis.Sanitizer.getDefaultConfiguration instanceof Function||(globalThis.Sanitizer.getDefaultConfiguration=function(){return t},n=!0),!(globalThis.Sanitizer.prototype.getConfiguration instanceof Function)){const e=new WeakMap,t=globalThis.Sanitizer;globalThis.Sanitizer=class extends t{constructor({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}=t.getDefaultConfiguration()){super({allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c}),e.set(this,{allowAttributes:n,allowComments:o,allowElements:r,allowCustomElements:i,blockElements:a,dropAttributes:s,dropElements:l,allowUnknownMarkup:c})}getConfiguration(){return e.get(this)}},n=!0}globalThis.Sanitizer.prototype.sanitize instanceof Function||(globalThis.Sanitizer.prototype.sanitize=function(e){if(e instanceof Node){if([Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE].includes(e.nodeType))return pe(e,this.getConfiguration());throw new TypeError("Expected a Document or DocumentFragment in `Sanitizer.sanitize()`.")}throw new TypeError("`Sanitizer.sanitize()` expects a `Node`")},n=!0),globalThis.Sanitizer.prototype.sanitizeFor instanceof Function||(globalThis.Sanitizer.prototype.sanitizeFor=function(e,t){const n=document.createElement(e);return re(n,t,this.getConfiguration()),n},n=!0),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,n=t){re(this,e,n)},n=!0)}else globalThis.Sanitizer=e,n=!0;return n}}}(class e{constructor({allowElements:t,allowAttributes:n,blockElements:o,dropAttributes:r,dropElements:i,allowComments:a=oe.allowComments,allowCustomElements:s=oe.allowCustomElements,allowUnknownMarkup:l=oe.allowUnknownMarkup}=e.getDefaultConfiguration()){me.set(this,{allowElements:t,allowComments:a,allowAttributes:n,allowCustomElements:s,blockElements:o,dropAttributes:r,dropElements:i,allowUnknownMarkup:l})}getConfiguration(){return me.get(this)}sanitize(e){return pe(e,this.getConfiguration())}sanitizeFor(e,t){const n=document.createElement(e);return n.setHTML(t,this.getConfiguration()),n}static getDefaultConfiguration(){return oe}},oe);he();const ye={get(){return Array.from(this.styleSheets).filter((e=>e.ownerNode.classList.contains("_adopted")))},set(e){if(!Array.isArray(e))throw new TypeError("Must be an array");{const t=new Set(this.adoptedStyleSheets);t.difference(e).forEach((e=>e.ownerNode.remove()));const n=[...new Set(e).difference(t)].map((e=>{const t=document.createElement("link"),n=new AbortController,o=n.signal,r=URL.createObjectURL(new File([],"adopted.css",{type:"text/css"}));return t.rel="stylesheet",t.href=r,t.classList.add("_adopted"),t.disabled=e.disabled,t.addEventListener("load",(({target:o})=>{n.abort(),t.media=e.media.mediaText,[...e.cssRules].forEach(((e,t)=>{o.sheet.insertRule(e.cssText,t)})),setTimeout((()=>URL.revokeObjectURL(o.href)),100)}),{once:!0,signal:o}),t.addEventListener("error",(({target:e})=>{n.abort(),URL.revokeObjectURL(e.href)}),{once:!0,signal:o}),t}));this instanceof Document?this.head.append(...n):this.append(...n)}}};function ge(e){for(;e.cssRules.length>0;)e.deleteRule(0)}e(Document,"parseHTML",((...e)=>ue(...e))),t(Document.prototype,"adoptedStyleSheets",ye),"ShadowRoot"in globalThis&&t(ShadowRoot.prototype,"adoptedStyleSheets",ye);try{new CSSStyleSheet}catch{const e=globalThis.CSSStyleSheet;globalThis.CSSStyleSheet=function({disabled:e=!1,media:t}={}){const n=function(e="",{disabled:t=!1,media:n}={}){const o=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);return"string"==typeof n&&o.media.appendMedium(n),o.disabled=t,o}("#dfgbkjdfg{color:red;}",{disabled:e,media:t});return n.deleteRule(0),n},globalThis.CSSStyleSheet.prototype=e.prototype,e.prototype.constructor=globalThis.CSSStyleSheet}CSSStyleSheet.prototype.replace instanceof Function||(CSSStyleSheet.prototype.replace=function(e){const t=document.createElement("link"),n=new AbortController,{resolve:o,reject:r,promise:i}=Promise.withResolvers();return t.addEventListener("load",(({target:e})=>{ge(this),[...e.sheet.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t))),o(this),n.abort(),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.addEventListener("error",(({target:e})=>{const t=new DOMException("Error loading stylesheet.");r(t),n.abort(t),URL.revokeObjectURL(e.href),e.remove()}),{once:!0,signal:n.signal}),t.rel="stylesheet",t.crossOrigin="anonymous",t.referrerPolicy="no-referrer",t.media="no-op",t.href=URL.createObjectURL(new File([e],"tmp.css",{type:"text/css"})),document.head.append(t),i}),CSSStyleSheet.prototype.replaceSync instanceof Function||(CSSStyleSheet.prototype.replaceSync=function(e){const t=Document.parseHTML(`<style>${e}</style>`,{sanitizer:new Sanitizer({allowElements:["style","html","head","body"]})}).styleSheets.item(0);ge(this),[...t.cssRules].forEach(((e,t)=>this.insertRule(e.cssText,t)))});const be={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"};if(HTMLScriptElement.supports instanceof Function||(HTMLScriptElement.supports=function(e){switch(e.toLowerCase()){case"classic":return!0;case"module":return"noModule"in HTMLScriptElement.prototype;default:return!1}}),!Element.prototype.hasOwnProperty(be.role)){const e=!0,t=!0,n=Object.fromEntries(Object.entries(be).map((([n,o])=>[n,{get:function(){return this.getAttribute(o)},set:function(e){"string"==typeof e?this.setAttribute(o,e):this.removeAttribute(o)},enumerable:e,configurable:t}])));Object.defineProperties(Element.prototype,n)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const e=new WeakMap,t=n=>{e.has(n)&&(n.tabIndex=e.get(n)),n.hasChildNodes()&&[...n.children].forEach(t)},n=t=>{-1!==t.tabIndex&&(e.set(t,t.tabIndex),t.tabIndex=-1),t.hasChildNodes()&&[...t.children].forEach(n)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),n(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),t(this))},enumerable:!0,configurable:!0})}if(HTMLImageElement.prototype.hasOwnProperty("complete")||Object.defineProperty(HTMLImageElement.prototype,"complete",{get:function(){return""===this.src||this.naturalHeight>0}}),HTMLImageElement.prototype.decode instanceof Function||(HTMLImageElement.prototype.decode=function(){return this.complete?Promise.resolve():new Promise(((e,t)=>{const n=()=>{this.removeEventListener("error",o),this.removeEventListener("load",n),e()},o=e=>{this.removeEventListener("error",o),this.removeEventListener("load",n),t(e)};this.addEventListener("load",n),this.addEventListener("error",o)}))}),Element.prototype.setHTML instanceof Function?function(e,t,n){const{value:o,enumerable:r,configurable:i,writable:a}=Object.getOwnPropertyDescriptor(e,t),s=n(o);if(!(s instanceof Function))throw new TypeError(`Error overwriting ${t}. The func MUST be a function that accepts the original as an argument and return a function.`);Object.defineProperty(e,t,{value:s,enumerable:r,configurable:i,writable:a})}(Element.prototype,"setHTML",(function(e){return function(t,n={}){if(n.sanitizer instanceof Sanitizer)e.call(this,t,n);else{const o=new Sanitizer(function({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}={}){return void 0===e&&void 0===i&&(e=oe.allowAttributes),void 0===n&&void 0===a&&(n=oe.allowElements),{allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s}}(n));e.call(this,t,{sanitizer:o})}}})):Element.prototype.setHTML=function(e,t=oe){re(this,e,t)},!HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode")){Object.defineProperty(HTMLTemplateElement.prototype,"shadowRootMode",{get:function(){return this.getAttribute("shadowrootmode")},set:function(e){this.setAttribute("shadowrootmode",e)},enumerable:!0,configurable:!0});const e=(t=document)=>{t.querySelectorAll("template[shadowrootmode]").forEach((t=>{const n=t.parentElement.attachShadow({mode:t.shadowRootMode});n.append(t.content),t.remove(),e(n)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>e(document)),{once:!0}):e(document)}HTMLFormElement.prototype.requestSubmit instanceof Function||(HTMLFormElement.prototype.requestSubmit=function(e){if(void 0===e){const e=document.createElement("button");e.type="submit",e.hidden=!0,this.append(e),this.requestSubmit(e),setTimeout((()=>e.remove()),100)}else{if(!(e instanceof HTMLButtonElement||e instanceof HTMLInputElement))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!("submit"===e.type||e instanceof HTMLInputElement&&"image"===e.type))throw new TypeError("HTMLFormElement.requestSubmit: The submitter is not a submit button.");if(!this.isSameNode(e.form))throw new DOMException("HTMLFormElement.requestSubmit: The submitter is not owned by this form.","NotFoundError");e.click()}}),"loading"in HTMLIFrameElement.prototype||t(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||t(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}}),Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this].filter((t=>!e.has(t))))}),Set.prototype.union instanceof Function||(Set.prototype.union=function(e){return new Set([...this,...e])}),Set.prototype.isSubsetOf instanceof Function||(Set.prototype.isSubsetOf=function(e){return e instanceof Set||(e=new Set(e)),[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){return e instanceof Set||(e=new Set(e)),e.isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this.difference(e),...e.difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){return e instanceof Set||(e=new Set(e)),new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:n}={}){const o=this.has(e);if(o&&n instanceof Function){const t=this.get(e),o=n.call(this,t,e,this);return o!==t&&this.set(e,t),o}if(o)return this.get(e);if(t instanceof Function){const n=t.call(this,e,this);return this.set(e,n),n}throw new Error("Key is not found and no `insert()` given")}),function(){if("screen"in globalThis&&!(globalThis.getScreenDetails instanceof Function)){class e extends EventTarget{get availHeight(){return screen.availHeight}get availLeft(){return screen.availLeft}get availTop(){return screen.availTop}get availWidth(){return screen.availWidth}get colorDepth(){return screen.colorDepth}get devicePixelRatio(){return globalThis.devicePixelRatio||1}get height(){return screen.height}get isExtended(){return screen.isExtended}get isInternal(){return!0}get isPrimary(){return!0}get label(){return"Unknown"}get orientation(){return screen.orientation}get pixelDepth(){return screen.pixelDepth}get top(){return screen.top}get width(){return screen.width}}class t extends EventTarget{get currentScreen(){return new e}get screens(){return[this.currentScreen]}}Object.defineProperty(Screen.prototype,"isExtended",{enumerable:!0,configurable:!0,get:()=>!1}),globalThis.getScreenDetails=async()=>new t}}();
|
|
44
44
|
/**
|
|
45
45
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
46
46
|
*/
|