@shgysk8zer0/polyfills 0.3.4 → 0.3.5

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 CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [v0.3.5] - 2024-03-27
10
+
11
+ ### Fixed
12
+ - Update `@aegisjsprject/sanitizer` to use `aegis-sanitizer#html` in `parseHTML`
13
+
9
14
  ## [v0.3.4] - 2024-03-27
10
15
 
11
16
  ### Fixed
package/all.min.js CHANGED
@@ -35,7 +35,7 @@ const H=Object.keys(Object.getOwnPropertyDescriptors(HTMLElement.prototype)).fil
35
35
  /**
36
36
  * @copyright 2023-2024 Chris Zuber <admin@kernvalley.us>
37
37
  * @see https://wicg.github.io/sanitizer-api/#default-configuration-dictionary
38
- */"https:"===location.protocol&&Se.add("http:");const Ee=function(e,{createHTML:t,createScript:r,createScriptURL:n}){return"trustedTypes"in globalThis?globalThis.trustedTypes.createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}):Object.freeze({[Symbol.for("policy-name")]:e,createHTML:t instanceof Function?(e,...r)=>t(e.toString(),...r).toString():null,createScript:r instanceof Function?(e,...t)=>r(e.toString(),...t).toString():null,createScriptURL:n instanceof Function?(e,...t)=>n(e.toString(),...t).toString():null})}("aegis-sanitizer#html",{createHTML:e=>e});function Ae(e,t=ve){if(e instanceof Node){const r=function(e,{elementNS:t=se,attributeNS:r=""}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");if(e.getConfiguration instanceof Function){console.warn("`Sanitzer` objects are deprecated and will be removed.");const{allowElements:n,allowAttributes:o,allowComments:a}=e.getConfiguration();return Object.freeze({elements:he({elements:n},t),attributes:me({attributes:o},r),comments:a})}return Object.freeze({elements:he(e,t),attributes:me(e,r),comments:fe(e)})}(t);return Me(e,r)}throw new TypeError("Not a node.")}function xe(e,t){return e.name.startsWith("data-")||(e.namespaceURI??"")in t.attributes&&t.attributes[e.namespaceURI??""].some((t=>t.name===e.localName))&&!le.has(e.localName)&&!function(e){if(Te.has(e.localName)){if(URL.canParse(e.value)){const{protocol:t}=new URL(e.value);return Se.has(t)}return!1}return!1}(e)}function Me(e,t){switch(e.nodeType){case Node.ELEMENT_NODE:!function(e,t){!function(e,t){return e.namespaceURI in t.elements&&t.elements[e.namespaceURI].some((t=>t.name===e.localName))}(e,t)?e.remove():([...e.attributes].forEach((e=>Oe(e,t))),"TEMPLATE"===e.tagName?ke(e.content,t):e.hasChildNodes()&&e.childNodes.forEach((e=>Me(e,t))))}(e,t);break;case Node.DOCUMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:ke(e,t);break;case Node.COMMENT_NODE:!function(e,t){t.comments||e.remove()}(e,t);break;case Node.ATTRIBUTE_NODE:Oe(e,t);break;case Node.TEXT_NODE:case Node.DOCUMENT_TYPE_NODE:break;default:e.ownerElement instanceof Element&&e.ownerElement.removeChild(e)}}function Oe(e,t){!xe(e,t)&&e.ownerElement instanceof Element&&e.ownerElement.removeAttributeNode(e)}function ke(e,t){e.childNodes.forEach((e=>Me(e,t)))}URL.canParse instanceof Function||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch{return!1}}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Object.fromEntries(e.map((e=>[t(e),e])))}),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,{sanitizer:{elements:t=be,attributes:r=we,comments:n=false}=ve}={}){!function(e,t,{sanitizer:r=ve}={}){const n=document.createElement("template");n.innerHTML=Ee.createHTML(t),Ae(n.content,r),e.replaceChildren(n.content)}(this,e,{sanitizer:{elements:t,attributes:r,comments:n}})}),Document.parseHTML instanceof Function||(Document.parseHTML=function(e,{sanitizer:{elements:t=be,attributes:r=we,comments:n=false}=ve}={}){return function(e,{sanitizer:t=ve}={}){const r=(new DOMParser).parseFromString(e,"text/html");return Ae(r,t),r}(e,{sanitizer:{elements:t,attributes:r,comments:n}})});const Le=Object.freeze(["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","view","missing-glyph","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","hkern","vkern","glyph","glyphRef","tref","cursor"].map((e=>ce(e,"http://www.w3.org/2000/svg")))),Pe=Object.freeze(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","class","clip","clipPathUnits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","crossorigin","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","fill","fill-opacity","fill-rule","filter","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","height","href","hreflang","horiz-adv-x","horiz-origin-x","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lang","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","max","media","method","min","mode","name","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","ping","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","referrerPolicy","refX","refY","rel","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfaceScale","systemLanguage","tabindex","tableValues","target","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:lang","xml:space","y","y1","y2","yChannelSelector","z","zoomAndPan","autoReverse","accelerate"].map((e=>pe(e,""))).concat(ye)),Fe=Object.freeze(["math","maction","annotation","annotation-xml","menclose","merror","mfenced","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"].map((e=>ce(e,"http://www.w3.org/1998/Math/MathML")))),Ne=Object.freeze(["accent","accentunder","actiontype","align","background","close","color","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","fence","fontfamily","fontsize","fontstyle","fontweight","frame","framespacing","height","href","id","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","superscriptshift","symmetric","voffset","width","xmlns"].map((e=>pe(e,""))).concat(ye));function je({currentTarget:e}){switch(e.popoverTargetAction){case"show":e.popoverTargetElement.showPopover();break;case"hide":e.popoverTargetElement.hidePopover();break;default:e.popoverTargetElement.togglePopover()}}if(Object.freeze([...be,...Le]),Object.freeze(Array.from(new Set([...we,...Pe]))),Object.freeze([...be,...Le,...Fe]),Object.freeze(Array.from(new Set([...we,...Pe,...Ne]))),globalThis.ToggleEvent instanceof Function){class Ke extends Event{#e;#t;constructor(e,{newState:t,oldState:r}){super(e,{bubbles:!0}),this.#e=t,this.#t=r}get newState(){return this.#e}get oldState(){return this.#t}}globalThis.ToggleEvent=Ke}if(!(HTMLElement.prototype.showPopover instanceof Function)){const Qe=e=>e.classList.contains("_popover-open");Object.defineProperties(HTMLElement.prototype,{showPopover:{value:function(){if(!Qe(this)){if(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"closed",newState:"open"})),"auto"===this.getAttribute("popover")){const e=new AbortController;document.body.addEventListener("click",(({target:t})=>{this.contains(t)||this.isSameNode(t.popoverTargetElement)||(e.abort(),this.hidePopover())}),{signal:e.signal,capture:!0}),document.body.addEventListener("keydown",(({key:t})=>{"Escape"===t&&(e.abort(),this.hidePopover())}),{signal:e.signal,capture:!0}),document.addEventListener("beforetoggle",(({target:t})=>{t.isSameNode(this)||"auto"!==t.getAttribute("popover")||(e.abort(),this.hidePopover())}),{signal:e.signal})}this.classList.add("_popover-open"),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"closed",newState:"open"}))}}},hidePopover:{value:function(){Qe(this)&&(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"open",newState:"closed"})),queueMicrotask((()=>this.classList.remove("_popover-open"))),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"open",newState:"closed"})))}},togglePopover:{value:function(){Qe(this)?this.hidePopover():this.showPopover()}}}),Object.defineProperties(HTMLButtonElement.prototype,{popoverTargetElement:{get(){return document.getElementById(this.getAttribute("popovertarget"))}},popoverTargetAction:{get(){return this.getAttribute("popovertargetaction")||"toggle"},set(e){this.setAttribute("popovertargetaction",e)}}}),function(e=document.body){e.querySelectorAll('button[popovertarget], input[type="button"][popovertarget]').forEach((e=>e.addEventListener("click",je)))}()}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(ie.role)){const Xe=!0,Je=!0,Ye=Object.fromEntries(Object.entries(ie).map((([e,t])=>[e,{get:function(){return this.getAttribute(t)},set:function(e){"string"==typeof e?this.setAttribute(t,e):this.removeAttribute(t)},enumerable:Xe,configurable:Je}])));Object.defineProperties(Element.prototype,Ye)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const Ze=new WeakMap,et=e=>{Ze.has(e)&&(e.tabIndex=Ze.get(e)),e.hasChildNodes()&&[...e.children].forEach(et)},tt=e=>{-1!==e.tabIndex&&(Ze.set(e,e.tabIndex),e.tabIndex=-1),e.hasChildNodes()&&[...e.children].forEach(tt)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),tt(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),et(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 r=()=>{this.removeEventListener("error",n),this.removeEventListener("load",r),e()},n=e=>{this.removeEventListener("error",n),this.removeEventListener("load",r),t(e)};this.addEventListener("load",r),this.addEventListener("error",n)}))}),!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 rt=(e=document)=>{e.querySelectorAll("template[shadowrootmode]").forEach((e=>{const t=e.parentElement.attachShadow({mode:e.shadowRootMode});t.append(e.content),e.remove(),rt(t)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>rt(document)),{once:!0}):rt(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||r(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||r(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}});const Ie="Expected a set-like object.",Ce=["has","keys"],Re=["size"],De=e=>e instanceof Set,He=e=>De(e)||"object"==typeof e&&null!==e&&Ce.every((t=>e[t]instanceof Function))&&Re.every((t=>t in e));Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){if(!He(e))throw new TypeError(Ie);return new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){if(!He(e))throw new TypeError(Ie);return 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){if(!He(e))throw new TypeError(Ie);return[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){if(!He(e))throw new TypeError(Ie);return De(e)?e.isSubsetOf(this):new Set(e.keys()).isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){if(!He(e))throw new TypeError(Ie);return De(e)?new Set([...this.difference(e),...e.difference(this)]):new Set([...this.difference(e),...new Set(e.keys()).difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){if(!He(e))throw new TypeError(Ie);return new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:r}={}){const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,t),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}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}}();
38
+ */"https:"===location.protocol&&Se.add("http:");const Ee=function(e,{createHTML:t,createScript:r,createScriptURL:n}){return"trustedTypes"in globalThis?globalThis.trustedTypes.createPolicy(e,{createHTML:t,createScript:r,createScriptURL:n}):Object.freeze({[Symbol.for("policy-name")]:e,createHTML:t instanceof Function?(e,...r)=>t(e.toString(),...r).toString():null,createScript:r instanceof Function?(e,...t)=>r(e.toString(),...t).toString():null,createScriptURL:n instanceof Function?(e,...t)=>n(e.toString(),...t).toString():null})}("aegis-sanitizer#html",{createHTML:e=>e});function Ae(e,t=ve){if(e instanceof Node){const r=function(e,{elementNS:t=se,attributeNS:r=""}={}){if("object"!=typeof e||null===e)throw new TypeError("Sanitizer config must be an object.");if(e.getConfiguration instanceof Function){console.warn("`Sanitzer` objects are deprecated and will be removed.");const{allowElements:n,allowAttributes:o,allowComments:a}=e.getConfiguration();return Object.freeze({elements:he({elements:n},t),attributes:me({attributes:o},r),comments:a})}return Object.freeze({elements:he(e,t),attributes:me(e,r),comments:fe(e)})}(t);return Me(e,r)}throw new TypeError("Not a node.")}function xe(e,t){return e.name.startsWith("data-")||(e.namespaceURI??"")in t.attributes&&t.attributes[e.namespaceURI??""].some((t=>t.name===e.localName))&&!le.has(e.localName)&&!function(e){if(Te.has(e.localName)){if(URL.canParse(e.value)){const{protocol:t}=new URL(e.value);return Se.has(t)}return!1}return!1}(e)}function Me(e,t){switch(e.nodeType){case Node.ELEMENT_NODE:!function(e,t){!function(e,t){return e.namespaceURI in t.elements&&t.elements[e.namespaceURI].some((t=>t.name===e.localName))}(e,t)?e.remove():([...e.attributes].forEach((e=>Oe(e,t))),"TEMPLATE"===e.tagName?ke(e.content,t):e.hasChildNodes()&&e.childNodes.forEach((e=>Me(e,t))))}(e,t);break;case Node.DOCUMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:ke(e,t);break;case Node.COMMENT_NODE:!function(e,t){t.comments||e.remove()}(e,t);break;case Node.ATTRIBUTE_NODE:Oe(e,t);break;case Node.TEXT_NODE:case Node.DOCUMENT_TYPE_NODE:break;default:e.ownerElement instanceof Element&&e.ownerElement.removeChild(e)}}function Oe(e,t){!xe(e,t)&&e.ownerElement instanceof Element&&e.ownerElement.removeAttributeNode(e)}function ke(e,t){e.childNodes.forEach((e=>Me(e,t)))}URL.canParse instanceof Function||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch{return!1}}),Object.groupBy instanceof Function||(Object.groupBy=function(e,t){return Object.fromEntries(e.map((e=>[t(e),e])))}),Element.prototype.setHTML instanceof Function||(Element.prototype.setHTML=function(e,{sanitizer:{elements:t=be,attributes:r=we,comments:n=false}=ve}={}){!function(e,t,{sanitizer:r=ve}={}){const n=document.createElement("template");n.innerHTML=Ee.createHTML(t),Ae(n.content,r),e.replaceChildren(n.content)}(this,e,{sanitizer:{elements:t,attributes:r,comments:n}})}),Document.parseHTML instanceof Function||(Document.parseHTML=function(e,{sanitizer:{elements:t=be,attributes:r=we,comments:n=false}=ve}={}){return function(e,{sanitizer:t=ve}={}){const r=(new DOMParser).parseFromString(Ee.createHTML(e),"text/html");return Ae(r,t),r}(e,{sanitizer:{elements:t,attributes:r,comments:n}})});const Le=Object.freeze(["a","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tspan","view","missing-glyph","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","hkern","vkern","glyph","glyphRef","tref","cursor"].map((e=>ce(e,"http://www.w3.org/2000/svg")))),Pe=Object.freeze(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","class","clip","clipPathUnits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","crossorigin","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","fill","fill-opacity","fill-rule","filter","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fr","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","height","href","hreflang","horiz-adv-x","horiz-origin-x","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lang","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","max","media","method","min","mode","name","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","paint-order","path","pathLength","patternContentUnits","patternTransform","patternUnits","ping","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","referrerPolicy","refX","refY","rel","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfaceScale","systemLanguage","tabindex","tableValues","target","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","to","transform","transform-origin","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","vector-effect","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:lang","xml:space","y","y1","y2","yChannelSelector","z","zoomAndPan","autoReverse","accelerate"].map((e=>pe(e,""))).concat(ye)),Fe=Object.freeze(["math","maction","annotation","annotation-xml","menclose","merror","mfenced","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","semantics","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"].map((e=>ce(e,"http://www.w3.org/1998/Math/MathML")))),Ne=Object.freeze(["accent","accentunder","actiontype","align","background","close","color","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","fence","fontfamily","fontsize","fontstyle","fontweight","frame","framespacing","height","href","id","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","superscriptshift","symmetric","voffset","width","xmlns"].map((e=>pe(e,""))).concat(ye));function je({currentTarget:e}){switch(e.popoverTargetAction){case"show":e.popoverTargetElement.showPopover();break;case"hide":e.popoverTargetElement.hidePopover();break;default:e.popoverTargetElement.togglePopover()}}if(Object.freeze([...be,...Le]),Object.freeze(Array.from(new Set([...we,...Pe]))),Object.freeze([...be,...Le,...Fe]),Object.freeze(Array.from(new Set([...we,...Pe,...Ne]))),globalThis.ToggleEvent instanceof Function){class Ke extends Event{#e;#t;constructor(e,{newState:t,oldState:r}){super(e,{bubbles:!0}),this.#e=t,this.#t=r}get newState(){return this.#e}get oldState(){return this.#t}}globalThis.ToggleEvent=Ke}if(!(HTMLElement.prototype.showPopover instanceof Function)){const Qe=e=>e.classList.contains("_popover-open");Object.defineProperties(HTMLElement.prototype,{showPopover:{value:function(){if(!Qe(this)){if(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"closed",newState:"open"})),"auto"===this.getAttribute("popover")){const e=new AbortController;document.body.addEventListener("click",(({target:t})=>{this.contains(t)||this.isSameNode(t.popoverTargetElement)||(e.abort(),this.hidePopover())}),{signal:e.signal,capture:!0}),document.body.addEventListener("keydown",(({key:t})=>{"Escape"===t&&(e.abort(),this.hidePopover())}),{signal:e.signal,capture:!0}),document.addEventListener("beforetoggle",(({target:t})=>{t.isSameNode(this)||"auto"!==t.getAttribute("popover")||(e.abort(),this.hidePopover())}),{signal:e.signal})}this.classList.add("_popover-open"),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"closed",newState:"open"}))}}},hidePopover:{value:function(){Qe(this)&&(this.dispatchEvent(new ToggleEvent("beforetoggle",{oldState:"open",newState:"closed"})),queueMicrotask((()=>this.classList.remove("_popover-open"))),this.dispatchEvent(new ToggleEvent("toggle",{oldState:"open",newState:"closed"})))}},togglePopover:{value:function(){Qe(this)?this.hidePopover():this.showPopover()}}}),Object.defineProperties(HTMLButtonElement.prototype,{popoverTargetElement:{get(){return document.getElementById(this.getAttribute("popovertarget"))}},popoverTargetAction:{get(){return this.getAttribute("popovertargetaction")||"toggle"},set(e){this.setAttribute("popovertargetaction",e)}}}),function(e=document.body){e.querySelectorAll('button[popovertarget], input[type="button"][popovertarget]').forEach((e=>e.addEventListener("click",je)))}()}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(ie.role)){const Xe=!0,Je=!0,Ye=Object.fromEntries(Object.entries(ie).map((([e,t])=>[e,{get:function(){return this.getAttribute(t)},set:function(e){"string"==typeof e?this.setAttribute(t,e):this.removeAttribute(t)},enumerable:Xe,configurable:Je}])));Object.defineProperties(Element.prototype,Ye)}if(!HTMLElement.prototype.hasOwnProperty("inert")){const Ze=new WeakMap,et=e=>{Ze.has(e)&&(e.tabIndex=Ze.get(e)),e.hasChildNodes()&&[...e.children].forEach(et)},tt=e=>{-1!==e.tabIndex&&(Ze.set(e,e.tabIndex),e.tabIndex=-1),e.hasChildNodes()&&[...e.children].forEach(tt)};Object.defineProperty(HTMLElement.prototype,"inert",{get:function(){return this.hasAttribute("inert")},set:function(e){e?(this.setAttribute("aria-hidden","true"),this.setAttribute("inert",""),tt(this)):(this.removeAttribute("aria-hidden"),this.removeAttribute("inert"),et(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 r=()=>{this.removeEventListener("error",n),this.removeEventListener("load",r),e()},n=e=>{this.removeEventListener("error",n),this.removeEventListener("load",r),t(e)};this.addEventListener("load",r),this.addEventListener("error",n)}))}),!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 rt=(e=document)=>{e.querySelectorAll("template[shadowrootmode]").forEach((e=>{const t=e.parentElement.attachShadow({mode:e.shadowRootMode});t.append(e.content),e.remove(),rt(t)}))};"loading"===document.readyState?document.addEventListener("readystatechange",(()=>rt(document)),{once:!0}):rt(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||r(HTMLIFrameElement.prototype,"loading",{get:function(){return this.getAttribute("loading")||"auto"},set:function(e){this.setAttribute("loading",e)}}),"credentialless"in HTMLIFrameElement.prototype||r(HTMLIFrameElement.prototype,"credentialless",{get:function(){return this.hasAttribute("credentialless")},set:function(e){this.toggleAttribute("credentialless",e)}});const Ie="Expected a set-like object.",Ce=["has","keys"],Re=["size"],De=e=>e instanceof Set,He=e=>De(e)||"object"==typeof e&&null!==e&&Ce.every((t=>e[t]instanceof Function))&&Re.every((t=>t in e));Set.prototype.intersection instanceof Function||(Set.prototype.intersection=function(e){if(!He(e))throw new TypeError(Ie);return new Set([...this].filter((t=>e.has(t))))}),Set.prototype.difference instanceof Function||(Set.prototype.difference=function(e){if(!He(e))throw new TypeError(Ie);return 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){if(!He(e))throw new TypeError(Ie);return[...this].every((t=>e.has(t)))}),Set.prototype.isSupersetOf instanceof Function||(Set.prototype.isSupersetOf=function(e){if(!He(e))throw new TypeError(Ie);return De(e)?e.isSubsetOf(this):new Set(e.keys()).isSubsetOf(this)}),Set.prototype.symmetricDifference instanceof Function||(Set.prototype.symmetricDifference=function(e){if(!He(e))throw new TypeError(Ie);return De(e)?new Set([...this.difference(e),...e.difference(this)]):new Set([...this.difference(e),...new Set(e.keys()).difference(this)])}),Set.prototype.isDisjointFrom instanceof Function||(Set.prototype.isDisjointFrom=function(e){if(!He(e))throw new TypeError(Ie);return new Set([...this,...e]).size===this.size+e.size}),WeakMap.prototype.emplace instanceof Function||(WeakMap.prototype.emplace=function(e,{insert:t,update:r}={}){const n=this.has(e);if(n&&r instanceof Function){const t=this.get(e),n=r.call(this,t,e,this);return n!==t&&this.set(e,t),n}if(n)return this.get(e);if(t instanceof Function){const r=t.call(this,e,this);return this.set(e,r),r}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}}();
39
39
  /**
40
40
  * @copyright 2023 Chris Zuber <admin@kernvalley.us>
41
41
  */