@shgysk8zer0/polyfills 0.2.5 → 0.2.6
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 +12 -0
- package/all.min.js +7 -7
- package/all.min.js.map +1 -1
- package/assets/CookieStore.js +12 -14
- package/element.js +23 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [v0.2.6]- 2023-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `cookieStore` now supports `partitioned`
|
|
13
|
+
- `<iframe credentialless>` & `<iframe loading="lazy">` (just the attributes / getters & setters)
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
- Do not set `httpOnly` in `cookieStore`
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Change default `sameSite` to `'lax'` for `cookieStore`s
|
|
20
|
+
|
|
9
21
|
## [v0.2.5] - 2023-10-26
|
|
10
22
|
|
|
11
23
|
### Added
|
package/all.min.js
CHANGED
|
@@ -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,27 +20,27 @@
|
|
|
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
|
|
27
|
+
function H(){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
|
*/
|
|
31
|
-
const
|
|
31
|
+
const j=Object.keys(Object.getOwnPropertyDescriptors(HTMLElement.prototype)).filter((e=>e.startsWith("on"))),U=["action","cite","formaction","href","ping","src"],q=s((async function(){const{ok:e,headers:t}=await fetch(location.href,{method:"HEAD"});if(e&&t.has("Content-Security-Policy")){const e=t.get("Content-Security-Policy").trim().split(";").filter((e=>0!==e.length));return Object.fromEntries(e.map((e=>{const[t,...n]=e.trim().split(" ").filter((e=>0!==e.length));return[t,n]})))}}));function z(){const e=document.head.querySelector('meta[http-equiv="Content-Security-Policy"][content]');if(e instanceof HTMLMetaElement){const t=e.content.trim().split(";").filter((e=>0!==e.length));return Object.fromEntries(t.map((e=>{const[t,...n]=e.trim().split(" ").filter((e=>0!==e.length));return[t,n]})))}return{}}
|
|
32
32
|
/**
|
|
33
33
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
34
|
-
*/const B="1"===document.documentElement.dataset.fetchTrustCsp;function $({"trusted-types":e=null}={}){if(Array.isArray(e)){const t=new Set(e),n=t.has("'allow-duplicates'"),o=t.has("'none'");return n&&t.delete("'allow-duplicates'"),o&&t.clear(),t.add("empty#html"),t.add("empty#script"),{policies:t,allowDuplicates:n,hasNone:o}}return{}}const{allowDuplicates:_,allowedPolicies:V}=function(){const e=$(z());if("object"==typeof e&&e.policies instanceof Set){const{policies:t,allowDuplicates:n}=e;return{allowDuplicates:n,allowedPolicies:t}}{const e=(()=>{const e=$(z());return"object"==typeof e&&"allowDuplicates"in e?e.allowDuplicates:"1"===document.documentElement.dataset.allowTrustDuplicates})(),t=(()=>{if(document.documentElement.dataset.hasOwnProperty("trustedPolicies"))return new Set(["empty#html","empty#script",...document.documentElement.dataset.trustedPolicies.split(" ")]);{const{policies:e}=$(z());return e instanceof Set?e:new Set(["empty#html","empty#script"])}})();return t.has("'none'")&&t.clear(),t.add("empty#html"),t.add("empty#script"),{allowDuplicates:e,allowedPolicies:t}}}();
|
|
34
|
+
*/const B="1"===document.documentElement.dataset.fetchTrustCsp;function $({"trusted-types":e=null}={}){if(Array.isArray(e)){const t=new Set(e),n=t.has("'allow-duplicates'"),o=t.has("'none'");return n&&t.delete("'allow-duplicates'"),o&&t.clear(),t.add("empty#html"),t.add("empty#script"),{policies:t,allowDuplicates:n,hasNone:o}}return{}}const{allowDuplicates:_,allowedPolicies:V}=function(){const e=$(z());if("object"==typeof e&&e.policies instanceof Set){const{policies:t,allowDuplicates:n}=e;return{allowDuplicates:n,allowedPolicies:t}}{const e=(()=>{const e=$(z());return"object"==typeof e&&"allowDuplicates"in e?e.allowDuplicates:"1"===document.documentElement.dataset.allowTrustDuplicates})(),t=(()=>{if(document.documentElement.dataset.hasOwnProperty("trustedPolicies"))return new Set(["empty#html","empty#script",...document.documentElement.dataset.trustedPolicies.split(" ")]);{const{policies:e}=$(z());return e instanceof Set?e:new Set(["empty#html","empty#script"])}})();return t.has("'none'")&&t.clear(),t.add("empty#html"),t.add("empty#script"),{allowDuplicates:e,allowedPolicies:t}}}();H();const W={trustedValue:Symbol("[[Data]]"),trustedKey:Symbol("trusted-key"),emptyHTML:Symbol("policy-empty#html"),emptyScript:Symbol("policy-empty#script"),policy:Symbol.for("trust-policy"),defaultPolicy:Symbol("default-policy"),trustedTypesCSP:Symbol("trusted-types-csp")};Symbol.hasOwnProperty("toStringTag")||(Symbol.toStringTag=Symbol("Symbol.toStringTag"));const G=[];function K(e){return null!==function(e){return G.find((t=>t.name===e))||null}(e)}function Q(e,t){return function(){throw new TypeError(`Failed to execute '${t}' on 'TrustedTypePolicy': Policy ${e.name}'s TrustedTypePolicyOptions did not specify a '${t}' member.`)}}class X{constructor(e,{key:t,policy:n}){if(t!==W.trustedKey)throw new TypeError("Invalid constructor");Object.defineProperties(this,{[W.trustedValue]:{enumerable:!1,configurable:!1,writable:!1,value:e.toString()},[W.policy]:{enumerable:!1,configurable:!1,writable:!1,value:n.name}}),Object.freeze(this)}toString(){return this.valueOf()}toJSON(){return this.valueOf()}valueOf(){return this[W.trustedValue]}}class J extends X{[Symbol.toStringTag](){return"TrustedHTML"}}class Z extends X{[Symbol.toStringTag](){return"TrustedScript"}}class Y extends X{[Symbol.toStringTag](){return"TrustedScriptURL"}}class ee{constructor(e,{createHTML:t,createScript:n,createScriptURL:o}={},{key:r}){if(r!==W.trustedKey)throw new TypeError("Invalid constructor");Object.defineProperties(this,{name:{enumerable:!0,configurable:!1,writable:!1,value:e.toString()},createHTML:{enumerable:!0,configurable:!1,writable:!1,value:t instanceof Function?(e,...n)=>new J(t(e.toString(),...n),{key:W.trustedKey,policy:this}):Q(this,"createHTML")},createScript:{enumerable:!0,configurable:!1,writable:!1,value:n instanceof Function?(e,...t)=>new Z(n(e.toString(),...t),{key:W.trustedKey,policy:this}):Q(this,"createScript")},createScriptURL:{enumerable:!0,configurable:!1,writable:!1,value:o instanceof Function?(e,...t)=>new Y(o(e.toString(),...t),{key:W.trustedKey,policy:this}):Q(this,"createScriptURL")}})}}class te extends EventTarget{constructor(e){if(super(),e!==W.trustedKey)throw new TypeError("Invalid constructor");B&&async function(){const{policies:e,allowDuplicates:t=!1,hasNone:n=!1}=await q().then($);return e instanceof Set?{policies:e,allowDuplicates:t,hasNone:n}:{}}().then((({policies:e,allowDuplicates:t=!1,hasNone:n=!1})=>{void 0!==e&&Object.defineProperty(te,W.trustedTypesCSP,{value:{policies:e,allowDuplicates:t,hasNone:n},enumberable:!1,writable:!1,configurable:!1})})).catch((e=>console.error(e))),Object.defineProperties(this,{[W.defaultPolicy]:{enumerable:!1,configurable:!1,writable:!0,value:null},[W.emptyHTML]:{enumerable:!1,configurable:!1,writable:!1,value:this.createPolicy("empty#html",{createHTML:()=>""})},[W.emptyScript]:{enumerable:!1,configurable:!1,writable:!1,value:this.createPolicy("empty#script",{createScript:()=>""})}})}isHTML(e){return e instanceof globalThis.TrustedHTML}isScript(e){return e instanceof globalThis.TrustedScript}isScriptURL(e){return e instanceof globalThis.TrustedScriptURL}createPolicy(e,{createHTML:t,createScript:n,createScriptURL:o}={}){const r=new ee(e,{createHTML:t,createScript:n,createScriptURL:o},{key:W.trustedKey});if(!e.toString().match(/^[-#a-zA-Z0-9=_/@.%]+$/g))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" contains invalid characters.`);if(te.hasOwnProperty(W.trustedTypesCSP)){const{policies:t,allowDuplicates:n,hasNone:o}=te[W.trustedTypesCSP];if(o&&"empty#html"!==e&&"empty#script"!==e)throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!t.has(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!n&&K(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" already exists.`)}else{if(V.size>2&&!V.has(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" disallowed.`);if(!_&&K(e))throw new TypeError(`Failed to execute 'createPolicy' on 'TrustedTypePolicyFactory': Policy: "${e}" already exists.`)}return"default"===r.name&&(this[W.defaultPolicy]=r),G.push(r),r}getAttributeType(e,t,n){if(e=e.toLowerCase(),t=t.toLowerCase(),"string"==typeof elementNS&&0!==n.length)return j.includes(t)?"TrustedScript":null;if(j.includes(t))return"TrustedScript";switch(e){case"script":return"src"===t?"TrustedScriptURL":null;case"iframe":return"srcdoc"===t?"TrustedHTML":"src"===t?"TrustedScriptURL":null;default:return null}}getPropertyType(e,t){if(e=e.toLowerCase(),j.includes(t.toLowerCase()))return"TrustedScript";switch(e){case"embed":case"iframe":return"src"===t?"TrustedScriptURL":null;case"script":return"src"===t?"TrustedScriptURL":["text","innerText","textContent","innerHTML"].includes(t)?"TrustedScript":["outerHTML"].includes(t)?"TrustedHTML":null;default:return["innerHTML","outerHTML"].includes(t)?"TrustedHTML":null}}get emptyHTML(){return this[W.emptyHTML].createHTML("")}get emptyScript(){return this[W.emptyScript].createScript("")}get defaultPolicy(){return this[W.defaultPolicy]}get _isPolyfill_(){return!0}static get allowDuplicates(){return _}}const ne=new te(W.trustedKey);!function(){if("TrustedTypePolicyFactory"in globalThis||(globalThis.TrustedTypePolicyFactory=te),"TrustedTypePolicy"in globalThis||(globalThis.TrustedTypePolicy=ee),"TrustedType"in globalThis||(globalThis.TrustedType=X),"TrustedHTML"in globalThis||(globalThis.TrustedHTML=J),"TrustedScript"in globalThis||(globalThis.TrustedScript=Z),"TrustedScriptURL"in globalThis||(globalThis.TrustedScriptURL=Y),"trustedTypes"in globalThis)try{globalThis.trustedTypes.createPolicy("empty#html",{createHTML:()=>""}),globalThis.trustedTypes.createPolicy("empty#script",{createScript:()=>""})}catch(e){console.error(e)}else globalThis.trustedTypes=ne}();
|
|
35
35
|
/**
|
|
36
36
|
* @copyright 2023 Chris Zuber <admin@kernvalley.us>
|
|
37
37
|
* @see https://wicg.github.io/sanitizer-api/#default-configuration-dictionary
|
|
38
38
|
*/
|
|
39
|
-
const oe=JSON.parse('{\n "allowCustomElements": false,\n "allowUnknownMarkup": false,\n "allowElements": [\n "a",\n "abbr",\n "acronym",\n "address",\n "area",\n "article",\n "aside",\n "audio",\n "b",\n "bdi",\n "bdo",\n "bgsound",\n "big",\n "blockquote",\n "body",\n "br",\n "button",\n "canvas",\n "caption",\n "center",\n "cite",\n "code",\n "col",\n "colgroup",\n "datalist",\n "dd",\n "del",\n "details",\n "dfn",\n "dialog",\n "dir",\n "div",\n "dl",\n "dt",\n "em",\n "fieldset",\n "figcaption",\n "figure",\n "font",\n "footer",\n "form",\n "h1",\n "h2",\n "h3",\n "h4",\n "h5",\n "h6",\n "head",\n "header",\n "hgroup",\n "hr",\n "html",\n "i",\n "img",\n "input",\n "ins",\n "kbd",\n "keygen",\n "label",\n "layer",\n "legend",\n "li",\n "link",\n "listing",\n "main",\n "map",\n "mark",\n "marquee",\n "menu",\n "meta",\n "meter",\n "nav",\n "nobr",\n "ol",\n "optgroup",\n "option",\n "output",\n "p",\n "picture",\n "popup",\n "pre",\n "progress",\n "q",\n "rb",\n "rp",\n "rt",\n "rtc",\n "ruby",\n "s",\n "samp",\n "section",\n "select",\n "selectmenu",\n "small",\n "source",\n "span",\n "strike",\n "strong",\n "style",\n "sub",\n "summary",\n "sup",\n "table",\n "tbody",\n "td",\n "tfoot",\n "th",\n "thead",\n "time",\n "tr",\n "track",\n "tt",\n "u",\n "ul",\n "var",\n "video",\n "wbr"\n ],\n "allowAttributes": {\n "abbr": [\n "*"\n ],\n "accept": [\n "*"\n ],\n "accept-charset": [\n "*"\n ],\n "accesskey": [\n "*"\n ],\n "action": [\n "*"\n ],\n "align": [\n "*"\n ],\n "alink": [\n "*"\n ],\n "allow": [\n "*"\n ],\n "allowfullscreen": [\n "*"\n ],\n "alt": [\n "*"\n ],\n "anchor": [\n "*"\n ],\n "archive": [\n "*"\n ],\n "as": [\n "*"\n ],\n "async": [\n "*"\n ],\n "autocapitalize": [\n "*"\n ],\n "autocomplete": [\n "*"\n ],\n "autocorrect": [\n "*"\n ],\n "autofocus": [\n "*"\n ],\n "autopictureinpicture": [\n "*"\n ],\n "autoplay": [\n "*"\n ],\n "axis": [\n "*"\n ],\n "background": [\n "*"\n ],\n "behavior": [\n "*"\n ],\n "bgcolor": [\n "*"\n ],\n "border": [\n "*"\n ],\n "bordercolor": [\n "*"\n ],\n "capture": [\n "*"\n ],\n "cellpadding": [\n "*"\n ],\n "cellspacing": [\n "*"\n ],\n "challenge": [\n "*"\n ],\n "char": [\n "*"\n ],\n "charoff": [\n "*"\n ],\n "charset": [\n "*"\n ],\n "checked": [\n "*"\n ],\n "cite": [\n "*"\n ],\n "class": [\n "*"\n ],\n "classid": [\n "*"\n ],\n "clear": [\n "*"\n ],\n "code": [\n "*"\n ],\n "codebase": [\n "*"\n ],\n "codetype": [\n "*"\n ],\n "color": [\n "*"\n ],\n "cols": [\n "*"\n ],\n "colspan": [\n "*"\n ],\n "compact": [\n "*"\n ],\n "content": [\n "*"\n ],\n "contenteditable": [\n "*"\n ],\n "controls": [\n "*"\n ],\n "controlslist": [\n "*"\n ],\n "conversiondestination": [\n "*"\n ],\n "coords": [\n "*"\n ],\n "crossorigin": [\n "*"\n ],\n "csp": [\n "*"\n ],\n "data": [\n "*"\n ],\n "datetime": [\n "*"\n ],\n "declare": [\n "*"\n ],\n "decoding": [\n "*"\n ],\n "default": [\n "*"\n ],\n "defer": [\n "*"\n ],\n "dir": [\n "*"\n ],\n "direction": [\n "*"\n ],\n "dirname": [\n "*"\n ],\n "disabled": [\n "*"\n ],\n "disablepictureinpicture": [\n "*"\n ],\n "disableremoteplayback": [\n "*"\n ],\n "disallowdocumentaccess": [\n "*"\n ],\n "download": [\n "*"\n ],\n "draggable": [\n "*"\n ],\n "elementtiming": [\n "*"\n ],\n "enctype": [\n "*"\n ],\n "end": [\n "*"\n ],\n "enterkeyhint": [\n "*"\n ],\n "event": [\n "*"\n ],\n "exportparts": [\n "*"\n ],\n "face": [\n "*"\n ],\n "for": [\n "*"\n ],\n "form": [\n "*"\n ],\n "formaction": [\n "*"\n ],\n "formenctype": [\n "*"\n ],\n "formmethod": [\n "*"\n ],\n "formnovalidate": [\n "*"\n ],\n "formtarget": [\n "*"\n ],\n "frame": [\n "*"\n ],\n "frameborder": [\n "*"\n ],\n "headers": [\n "*"\n ],\n "height": [\n "*"\n ],\n "hidden": [\n "*"\n ],\n "high": [\n "*"\n ],\n "href": [\n "*"\n ],\n "hreflang": [\n "*"\n ],\n "hreftranslate": [\n "*"\n ],\n "hspace": [\n "*"\n ],\n "http-equiv": [\n "*"\n ],\n "id": [\n "*"\n ],\n "imagesizes": [\n "*"\n ],\n "imagesrcset": [\n "*"\n ],\n "importance": [\n "*"\n ],\n "impressiondata": [\n "*"\n ],\n "impressionexpiry": [\n "*"\n ],\n "incremental": [\n "*"\n ],\n "inert": [\n "*"\n ],\n "inputmode": [\n "*"\n ],\n "integrity": [\n "*"\n ],\n "invisible": [\n "*"\n ],\n "is": [\n "*"\n ],\n "ismap": [\n "*"\n ],\n "keytype": [\n "*"\n ],\n "kind": [\n "*"\n ],\n "label": [\n "*"\n ],\n "lang": [\n "*"\n ],\n "language": [\n "*"\n ],\n "latencyhint": [\n "*"\n ],\n "leftmargin": [\n "*"\n ],\n "link": [\n "*"\n ],\n "list": [\n "*"\n ],\n "loading": [\n "*"\n ],\n "longdesc": [\n "*"\n ],\n "loop": [\n "*"\n ],\n "low": [\n "*"\n ],\n "lowsrc": [\n "*"\n ],\n "manifest": [\n "*"\n ],\n "marginheight": [\n "*"\n ],\n "marginwidth": [\n "*"\n ],\n "max": [\n "*"\n ],\n "maxlength": [\n "*"\n ],\n "mayscript": [\n "*"\n ],\n "media": [\n "*"\n ],\n "method": [\n "*"\n ],\n "min": [\n "*"\n ],\n "minlength": [\n "*"\n ],\n "multiple": [\n "*"\n ],\n "muted": [\n "*"\n ],\n "name": [\n "*"\n ],\n "nohref": [\n "*"\n ],\n "nomodule": [\n "*"\n ],\n "nonce": [\n "*"\n ],\n "noresize": [\n "*"\n ],\n "noshade": [\n "*"\n ],\n "novalidate": [\n "*"\n ],\n "nowrap": [\n "*"\n ],\n "object": [\n "*"\n ],\n "open": [\n "*"\n ],\n "optimum": [\n "*"\n ],\n "part": [\n "*"\n ],\n "pattern": [\n "*"\n ],\n "ping": [\n "*"\n ],\n "placeholder": [\n "*"\n ],\n "playsinline": [\n "*"\n ],\n "policy": [\n "*"\n ],\n "poster": [\n "*"\n ],\n "preload": [\n "*"\n ],\n "pseudo": [\n "*"\n ],\n "readonly": [\n "*"\n ],\n "referrerpolicy": [\n "*"\n ],\n "rel": [\n "*"\n ],\n "reportingorigin": [\n "*"\n ],\n "required": [\n "*"\n ],\n "resources": [\n "*"\n ],\n "rev": [\n "*"\n ],\n "reversed": [\n "*"\n ],\n "role": [\n "*"\n ],\n "rows": [\n "*"\n ],\n "rowspan": [\n "*"\n ],\n "rules": [\n "*"\n ],\n "sandbox": [\n "*"\n ],\n "scheme": [\n "*"\n ],\n "scope": [\n "*"\n ],\n "scopes": [\n "*"\n ],\n "scrollamount": [\n "*"\n ],\n "scrolldelay": [\n "*"\n ],\n "scrolling": [\n "*"\n ],\n "select": [\n "*"\n ],\n "selected": [\n "*"\n ],\n "shadowroot": [\n "*"\n ],\n "shadowrootdelegatesfocus": [\n "*"\n ],\n "shape": [\n "*"\n ],\n "size": [\n "*"\n ],\n "sizes": [\n "*"\n ],\n "slot": [\n "*"\n ],\n "span": [\n "*"\n ],\n "spellcheck": [\n "*"\n ],\n "src": [\n "*"\n ],\n "srcdoc": [\n "*"\n ],\n "srclang": [\n "*"\n ],\n "srcset": [\n "*"\n ],\n "standby": [\n "*"\n ],\n "start": [\n "*"\n ],\n "step": [\n "*"\n ],\n "style": [\n "*"\n ],\n "summary": [\n "*"\n ],\n "tabindex": [\n "*"\n ],\n "target": [\n "*"\n ],\n "text": [\n "*"\n ],\n "title": [\n "*"\n ],\n "topmargin": [\n "*"\n ],\n "translate": [\n "*"\n ],\n "truespeed": [\n "*"\n ],\n "trusttoken": [\n "*"\n ],\n "type": [\n "*"\n ],\n "usemap": [\n "*"\n ],\n "valign": [\n "*"\n ],\n "value": [\n "*"\n ],\n "valuetype": [\n "*"\n ],\n "version": [\n "*"\n ],\n "virtualkeyboardpolicy": [\n "*"\n ],\n "vlink": [\n "*"\n ],\n "vspace": [\n "*"\n ],\n "webkitdirectory": [\n "*"\n ],\n "width": [\n "*"\n ],\n "wrap": [\n "*"\n ]\n }\n}'),re=function(e,t,n=oe){const o=ue(t,n);e.replaceChildren(le(o))},ie=["https:"];ie.includes(location.protocol)||ie.push(location.protocol);const ae=s((()=>function(e,{createHTML:t=(()=>{throw new TypeError("This policy does not provide `createHTML()`")}),createScript:n=(()=>{throw new TypeError("This policy does not provide `createScript()`")}),createScriptURL:o=(()=>{throw new TypeError("This policy does not provide `createScriptURL()`")})}){return j()?trustedTypes.createPolicy(e,{createHTML:t,createScript:n,createScriptURL:o}):Object.freeze({name:e,createHTML:(e,...n)=>t(e.toString(),...n),createScript:(e,...t)=>n(e.toString(),...t),createScriptURL:(e,...t)=>o(e.toString(),...t)})}("sanitizer-raw#html",{createHTML:e=>e}))),se=e=>ae().createHTML(e);function le(e){const t=document.createDocumentFragment(),n=e.cloneNode(!0);return t.append(...n.head.childNodes,...n.body.childNodes),t}function ce({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s,sanitizer:l}={},c){return l instanceof Sanitizer?ce(l.getConfiguration(),c):(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})}function ue(e,t=oe){const n=(new DOMParser).parseFromString(se(e),"text/html");return Array.isArray(t.allowElements)&&!t.allowElements.includes("html")&&(t.allowElements=[...new Set([...t.allowElements,"html","head","body"])]),de(n,t)}function pe(e,t=oe){if(e instanceof Node){if(e.nodeType===Node.DOCUMENT_FRAGMENT_NODE)return de(e,t);if(e.nodeType===Node.DOCUMENT_NODE)return de(le(e),t);throw new TypeError("sanitize requires a Document or DocumentFragment")}throw new TypeError("sanitize requires a Document or DocumentFragment")}function de(e,t=oe){try{if(!(e instanceof Node))throw new TypeError(`Expected a Node but got a ${a(e)}.`);if(!i(t))throw new TypeError(`Expected config to be an object but got ${a(t)}.`);const{allowElements:n,allowComments:o,allowAttributes:r,allowCustomElements:s,blockElements:l,dropAttributes:c,dropElements:u,allowUnknownMarkup:p}=ce(t),d=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let m=d.root.nodeType===Node.ELEMENT_NODE?d.root:d.nextNode();for(;m instanceof Node;){switch(m.nodeType){case Node.ELEMENT_NODE:{if(!p&&(!(m instanceof HTMLElement)||m instanceof HTMLUnknownElement)){m.remove();break}const e=m.tagName.toLowerCase();Array.isArray(u)&&u.includes(e)?m.remove():Array.isArray(l)&&l.includes(e)?m.hasChildNodes()?m.replaceWith(...m.childNodes):m.remove():e.includes("-")&&!s||Array.isArray(n)&&!n.includes(e)?m.remove():m.hasAttributes()&&m.getAttributeNames().forEach((t=>{const n=m.getAttributeNode(t),{value:o}=n;U.includes(t)&&!ie.includes(new URL(o,document.baseURI).protocol)?m.removeAttributeNode(n):i(c)?t in c&&["*",e].some((e=>c[t].includes(e)))&&m.removeAttributeNode(n):i(r)&&(t in r&&["*",e].some((e=>r[t].includes(e)))||m.removeAttributeNode(n))}));break}case Node.COMMENT_NODE:o||m.remove()}"template"===m.localName&&de(m.content,t),m=d.nextNode()}return e}catch(t){console.error(t),e.parentElement.removeChild(e)}}
|
|
39
|
+
const oe=JSON.parse('{\n "allowCustomElements": false,\n "allowUnknownMarkup": false,\n "allowElements": [\n "a",\n "abbr",\n "acronym",\n "address",\n "area",\n "article",\n "aside",\n "audio",\n "b",\n "bdi",\n "bdo",\n "bgsound",\n "big",\n "blockquote",\n "body",\n "br",\n "button",\n "canvas",\n "caption",\n "center",\n "cite",\n "code",\n "col",\n "colgroup",\n "datalist",\n "dd",\n "del",\n "details",\n "dfn",\n "dialog",\n "dir",\n "div",\n "dl",\n "dt",\n "em",\n "fieldset",\n "figcaption",\n "figure",\n "font",\n "footer",\n "form",\n "h1",\n "h2",\n "h3",\n "h4",\n "h5",\n "h6",\n "head",\n "header",\n "hgroup",\n "hr",\n "html",\n "i",\n "img",\n "input",\n "ins",\n "kbd",\n "keygen",\n "label",\n "layer",\n "legend",\n "li",\n "link",\n "listing",\n "main",\n "map",\n "mark",\n "marquee",\n "menu",\n "meta",\n "meter",\n "nav",\n "nobr",\n "ol",\n "optgroup",\n "option",\n "output",\n "p",\n "picture",\n "popup",\n "pre",\n "progress",\n "q",\n "rb",\n "rp",\n "rt",\n "rtc",\n "ruby",\n "s",\n "samp",\n "section",\n "select",\n "selectmenu",\n "small",\n "source",\n "span",\n "strike",\n "strong",\n "style",\n "sub",\n "summary",\n "sup",\n "table",\n "tbody",\n "td",\n "tfoot",\n "th",\n "thead",\n "time",\n "tr",\n "track",\n "tt",\n "u",\n "ul",\n "var",\n "video",\n "wbr"\n ],\n "allowAttributes": {\n "abbr": [\n "*"\n ],\n "accept": [\n "*"\n ],\n "accept-charset": [\n "*"\n ],\n "accesskey": [\n "*"\n ],\n "action": [\n "*"\n ],\n "align": [\n "*"\n ],\n "alink": [\n "*"\n ],\n "allow": [\n "*"\n ],\n "allowfullscreen": [\n "*"\n ],\n "alt": [\n "*"\n ],\n "anchor": [\n "*"\n ],\n "archive": [\n "*"\n ],\n "as": [\n "*"\n ],\n "async": [\n "*"\n ],\n "autocapitalize": [\n "*"\n ],\n "autocomplete": [\n "*"\n ],\n "autocorrect": [\n "*"\n ],\n "autofocus": [\n "*"\n ],\n "autopictureinpicture": [\n "*"\n ],\n "autoplay": [\n "*"\n ],\n "axis": [\n "*"\n ],\n "background": [\n "*"\n ],\n "behavior": [\n "*"\n ],\n "bgcolor": [\n "*"\n ],\n "border": [\n "*"\n ],\n "bordercolor": [\n "*"\n ],\n "capture": [\n "*"\n ],\n "cellpadding": [\n "*"\n ],\n "cellspacing": [\n "*"\n ],\n "challenge": [\n "*"\n ],\n "char": [\n "*"\n ],\n "charoff": [\n "*"\n ],\n "charset": [\n "*"\n ],\n "checked": [\n "*"\n ],\n "cite": [\n "*"\n ],\n "class": [\n "*"\n ],\n "classid": [\n "*"\n ],\n "clear": [\n "*"\n ],\n "code": [\n "*"\n ],\n "codebase": [\n "*"\n ],\n "codetype": [\n "*"\n ],\n "color": [\n "*"\n ],\n "cols": [\n "*"\n ],\n "colspan": [\n "*"\n ],\n "compact": [\n "*"\n ],\n "content": [\n "*"\n ],\n "contenteditable": [\n "*"\n ],\n "controls": [\n "*"\n ],\n "controlslist": [\n "*"\n ],\n "conversiondestination": [\n "*"\n ],\n "coords": [\n "*"\n ],\n "crossorigin": [\n "*"\n ],\n "csp": [\n "*"\n ],\n "data": [\n "*"\n ],\n "datetime": [\n "*"\n ],\n "declare": [\n "*"\n ],\n "decoding": [\n "*"\n ],\n "default": [\n "*"\n ],\n "defer": [\n "*"\n ],\n "dir": [\n "*"\n ],\n "direction": [\n "*"\n ],\n "dirname": [\n "*"\n ],\n "disabled": [\n "*"\n ],\n "disablepictureinpicture": [\n "*"\n ],\n "disableremoteplayback": [\n "*"\n ],\n "disallowdocumentaccess": [\n "*"\n ],\n "download": [\n "*"\n ],\n "draggable": [\n "*"\n ],\n "elementtiming": [\n "*"\n ],\n "enctype": [\n "*"\n ],\n "end": [\n "*"\n ],\n "enterkeyhint": [\n "*"\n ],\n "event": [\n "*"\n ],\n "exportparts": [\n "*"\n ],\n "face": [\n "*"\n ],\n "for": [\n "*"\n ],\n "form": [\n "*"\n ],\n "formaction": [\n "*"\n ],\n "formenctype": [\n "*"\n ],\n "formmethod": [\n "*"\n ],\n "formnovalidate": [\n "*"\n ],\n "formtarget": [\n "*"\n ],\n "frame": [\n "*"\n ],\n "frameborder": [\n "*"\n ],\n "headers": [\n "*"\n ],\n "height": [\n "*"\n ],\n "hidden": [\n "*"\n ],\n "high": [\n "*"\n ],\n "href": [\n "*"\n ],\n "hreflang": [\n "*"\n ],\n "hreftranslate": [\n "*"\n ],\n "hspace": [\n "*"\n ],\n "http-equiv": [\n "*"\n ],\n "id": [\n "*"\n ],\n "imagesizes": [\n "*"\n ],\n "imagesrcset": [\n "*"\n ],\n "importance": [\n "*"\n ],\n "impressiondata": [\n "*"\n ],\n "impressionexpiry": [\n "*"\n ],\n "incremental": [\n "*"\n ],\n "inert": [\n "*"\n ],\n "inputmode": [\n "*"\n ],\n "integrity": [\n "*"\n ],\n "invisible": [\n "*"\n ],\n "is": [\n "*"\n ],\n "ismap": [\n "*"\n ],\n "keytype": [\n "*"\n ],\n "kind": [\n "*"\n ],\n "label": [\n "*"\n ],\n "lang": [\n "*"\n ],\n "language": [\n "*"\n ],\n "latencyhint": [\n "*"\n ],\n "leftmargin": [\n "*"\n ],\n "link": [\n "*"\n ],\n "list": [\n "*"\n ],\n "loading": [\n "*"\n ],\n "longdesc": [\n "*"\n ],\n "loop": [\n "*"\n ],\n "low": [\n "*"\n ],\n "lowsrc": [\n "*"\n ],\n "manifest": [\n "*"\n ],\n "marginheight": [\n "*"\n ],\n "marginwidth": [\n "*"\n ],\n "max": [\n "*"\n ],\n "maxlength": [\n "*"\n ],\n "mayscript": [\n "*"\n ],\n "media": [\n "*"\n ],\n "method": [\n "*"\n ],\n "min": [\n "*"\n ],\n "minlength": [\n "*"\n ],\n "multiple": [\n "*"\n ],\n "muted": [\n "*"\n ],\n "name": [\n "*"\n ],\n "nohref": [\n "*"\n ],\n "nomodule": [\n "*"\n ],\n "nonce": [\n "*"\n ],\n "noresize": [\n "*"\n ],\n "noshade": [\n "*"\n ],\n "novalidate": [\n "*"\n ],\n "nowrap": [\n "*"\n ],\n "object": [\n "*"\n ],\n "open": [\n "*"\n ],\n "optimum": [\n "*"\n ],\n "part": [\n "*"\n ],\n "pattern": [\n "*"\n ],\n "ping": [\n "*"\n ],\n "placeholder": [\n "*"\n ],\n "playsinline": [\n "*"\n ],\n "policy": [\n "*"\n ],\n "poster": [\n "*"\n ],\n "preload": [\n "*"\n ],\n "pseudo": [\n "*"\n ],\n "readonly": [\n "*"\n ],\n "referrerpolicy": [\n "*"\n ],\n "rel": [\n "*"\n ],\n "reportingorigin": [\n "*"\n ],\n "required": [\n "*"\n ],\n "resources": [\n "*"\n ],\n "rev": [\n "*"\n ],\n "reversed": [\n "*"\n ],\n "role": [\n "*"\n ],\n "rows": [\n "*"\n ],\n "rowspan": [\n "*"\n ],\n "rules": [\n "*"\n ],\n "sandbox": [\n "*"\n ],\n "scheme": [\n "*"\n ],\n "scope": [\n "*"\n ],\n "scopes": [\n "*"\n ],\n "scrollamount": [\n "*"\n ],\n "scrolldelay": [\n "*"\n ],\n "scrolling": [\n "*"\n ],\n "select": [\n "*"\n ],\n "selected": [\n "*"\n ],\n "shadowroot": [\n "*"\n ],\n "shadowrootdelegatesfocus": [\n "*"\n ],\n "shape": [\n "*"\n ],\n "size": [\n "*"\n ],\n "sizes": [\n "*"\n ],\n "slot": [\n "*"\n ],\n "span": [\n "*"\n ],\n "spellcheck": [\n "*"\n ],\n "src": [\n "*"\n ],\n "srcdoc": [\n "*"\n ],\n "srclang": [\n "*"\n ],\n "srcset": [\n "*"\n ],\n "standby": [\n "*"\n ],\n "start": [\n "*"\n ],\n "step": [\n "*"\n ],\n "style": [\n "*"\n ],\n "summary": [\n "*"\n ],\n "tabindex": [\n "*"\n ],\n "target": [\n "*"\n ],\n "text": [\n "*"\n ],\n "title": [\n "*"\n ],\n "topmargin": [\n "*"\n ],\n "translate": [\n "*"\n ],\n "truespeed": [\n "*"\n ],\n "trusttoken": [\n "*"\n ],\n "type": [\n "*"\n ],\n "usemap": [\n "*"\n ],\n "valign": [\n "*"\n ],\n "value": [\n "*"\n ],\n "valuetype": [\n "*"\n ],\n "version": [\n "*"\n ],\n "virtualkeyboardpolicy": [\n "*"\n ],\n "vlink": [\n "*"\n ],\n "vspace": [\n "*"\n ],\n "webkitdirectory": [\n "*"\n ],\n "width": [\n "*"\n ],\n "wrap": [\n "*"\n ]\n }\n}'),re=function(e,t,n=oe){const o=ue(t,n);e.replaceChildren(le(o))},ie=["https:"];ie.includes(location.protocol)||ie.push(location.protocol);const ae=s((()=>function(e,{createHTML:t=(()=>{throw new TypeError("This policy does not provide `createHTML()`")}),createScript:n=(()=>{throw new TypeError("This policy does not provide `createScript()`")}),createScriptURL:o=(()=>{throw new TypeError("This policy does not provide `createScriptURL()`")})}){return H()?trustedTypes.createPolicy(e,{createHTML:t,createScript:n,createScriptURL:o}):Object.freeze({name:e,createHTML:(e,...n)=>t(e.toString(),...n),createScript:(e,...t)=>n(e.toString(),...t),createScriptURL:(e,...t)=>o(e.toString(),...t)})}("sanitizer-raw#html",{createHTML:e=>e}))),se=e=>ae().createHTML(e);function le(e){const t=document.createDocumentFragment(),n=e.cloneNode(!0);return t.append(...n.head.childNodes,...n.body.childNodes),t}function ce({allowAttributes:e,allowComments:t,allowElements:n,allowCustomElements:o,blockElements:r,dropAttributes:i,dropElements:a,allowUnknownMarkup:s,sanitizer:l}={},c){return l instanceof Sanitizer?ce(l.getConfiguration(),c):(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})}function ue(e,t=oe){const n=(new DOMParser).parseFromString(se(e),"text/html");return Array.isArray(t.allowElements)&&!t.allowElements.includes("html")&&(t.allowElements=[...new Set([...t.allowElements,"html","head","body"])]),de(n,t)}function pe(e,t=oe){if(e instanceof Node){if(e.nodeType===Node.DOCUMENT_FRAGMENT_NODE)return de(e,t);if(e.nodeType===Node.DOCUMENT_NODE)return de(le(e),t);throw new TypeError("sanitize requires a Document or DocumentFragment")}throw new TypeError("sanitize requires a Document or DocumentFragment")}function de(e,t=oe){try{if(!(e instanceof Node))throw new TypeError(`Expected a Node but got a ${a(e)}.`);if(!i(t))throw new TypeError(`Expected config to be an object but got ${a(t)}.`);const{allowElements:n,allowComments:o,allowAttributes:r,allowCustomElements:s,blockElements:l,dropAttributes:c,dropElements:u,allowUnknownMarkup:p}=ce(t),d=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let m=d.root.nodeType===Node.ELEMENT_NODE?d.root:d.nextNode();for(;m instanceof Node;){switch(m.nodeType){case Node.ELEMENT_NODE:{if(!p&&(!(m instanceof HTMLElement)||m instanceof HTMLUnknownElement)){m.remove();break}const e=m.tagName.toLowerCase();Array.isArray(u)&&u.includes(e)?m.remove():Array.isArray(l)&&l.includes(e)?m.hasChildNodes()?m.replaceWith(...m.childNodes):m.remove():e.includes("-")&&!s||Array.isArray(n)&&!n.includes(e)?m.remove():m.hasAttributes()&&m.getAttributeNames().forEach((t=>{const n=m.getAttributeNode(t),{value:o}=n;U.includes(t)&&!ie.includes(new URL(o,document.baseURI).protocol)?m.removeAttributeNode(n):i(c)?t in c&&["*",e].some((e=>c[t].includes(e)))&&m.removeAttributeNode(n):i(r)&&(t in r&&["*",e].some((e=>r[t].includes(e)))||m.removeAttributeNode(n))}));break}case Node.COMMENT_NODE:o||m.remove()}"template"===m.localName&&de(m.content,t),m=d.nextNode()}return e}catch(t){console.error(t),e.parentElement.removeChild(e)}}
|
|
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
|
*/
|