UNPKG

xel

Version:

Widget toolkit for building native-like Web, Electron and Hybrid apps

1 lines 454 kB
if(!1===MouseEvent.prototype.hasOwnProperty("pointerType")&&Object.defineProperty(MouseEvent.prototype,"pointerType",{get(){return this.sourceCapabilities.firesTouchEvents?"touch":"mouse"}}),Element.prototype.setPointerCapture){let t=Element.prototype.setPointerCapture;Element.prototype.setPointerCapture=function(e){if(t.call(this,e),!1!==this.hasPointerCapture(e)){{let t,i,s,n=!1,a=!1,r=()=>{this.removeEventListener("pointerup",t),this.removeEventListener("pointercancel",i),this.removeEventListener("lostpointercapture",s)};this.addEventListener("pointerup",t=t=>{t.pointerId===e&&(n=!0,r())}),this.addEventListener("pointercancel",i=t=>{t.pointerId===e&&(a=!0,r())}),this.addEventListener("lostpointercapture",s=t=>{if(t.pointerId===e&&(r(),!1===n&&!1===a)){let i=new PointerEvent("pointercancel",{pointerId:e,isPrimary:t.isPrimary});this.dispatchEvent(i)}})}{let t,i,s=`* {cursor: ${getComputedStyle(this).cursor} !important; user-select: none !important; -webkit-user-select: none !important;}`,n=[];for(let t=this.parentNode||this.host;t&&t!==document;t=t.parentNode||t.host)if(t.nodeType===document.DOCUMENT_FRAGMENT_NODE){let e=document.createElementNS(t.host.namespaceURI,"style");e.textContent=s,t.append(e),n.push(e)}else if(t.nodeType===document.DOCUMENT_NODE){let e=document.createElement("style");e.textContent=s,t.head.append(e),n.push(e)}this.addEventListener("lostpointercapture",t=s=>{if(s.pointerId===e){this.removeEventListener("lostpointercapture",t),window.removeEventListener("pointerup",i,!0);for(let t of n)t.remove()}}),window.addEventListener("pointerup",i=s=>{if(s.pointerId===e){this.removeEventListener("lostpointercapture",t),window.removeEventListener("pointerup",i,!0);for(let t of n)t.remove()}},!0)}}}}Object.defineProperty(Animation.prototype,"finished",{get(){return new Promise((t=>{"finished"===this.playState?t():this.addEventListener("finish",(()=>t()),{once:!0})}))}}),window.requestIdleCallback||(window.requestIdleCallback=(t,e={})=>{let i=e.timeout||1,s=performance.now();return setTimeout((()=>{t({get didTimeout(){return!e.timeout&&performance.now()-s-1>i},timeRemaining:()=>Math.max(0,performance.now()-s+1)})}),1)}),Node.prototype.append||(Node.prototype.append=function(t){this.appendChild(t)}),Node.prototype.prepend||(Node.prototype.prepend=function(t){this.insertBefore(t,this.firstElementChild)}),Node.prototype.before||(Node.prototype.before=function(t){this.parentElement.insertBefore(t,this)}),Node.prototype.after||(Node.prototype.after=function(t){this.parentElement.insertBefore(t,this.nextElementSibling)}),Node.prototype.closest||(Node.prototype.closest=function(t){return this.parentNode?this.parentNode.closest(t):null}),Node.prototype.replaceWith||(Node.prototype.replaceWith=function(t){this.parentNode.replaceChild(t,this)});const{entries:t,setPrototypeOf:e,isFrozen:i,getPrototypeOf:s,getOwnPropertyDescriptor:n}=Object;let{freeze:a,seal:r,create:o}=Object,{apply:l,construct:h}="undefined"!=typeof Reflect&&Reflect;a||(a=function(t){return t}),r||(r=function(t){return t}),l||(l=function(t,e,i){return t.apply(e,i)}),h||(h=function(t,e){return new t(...e)});const d=E(Array.prototype.forEach),c=E(Array.prototype.lastIndexOf),u=E(Array.prototype.pop),p=E(Array.prototype.push),m=E(Array.prototype.splice),b=E(String.prototype.toLowerCase),g=E(String.prototype.toString),f=E(String.prototype.match),x=E(String.prototype.replace),w=E(String.prototype.indexOf),v=E(String.prototype.trim),k=E(Object.prototype.hasOwnProperty),y=E(RegExp.prototype.test),C=(z=TypeError,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return h(z,e)});var z;function E(t){return function(e){for(var i=arguments.length,s=new Array(i>1?i-1:0),n=1;n<i;n++)s[n-1]=arguments[n];return l(t,e,s)}}function $(t,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:b;e&&e(t,null);let a=s.length;for(;a--;){let e=s[a];if("string"==typeof e){const t=n(e);t!==e&&(i(s)||(s[a]=t),e=t)}t[e]=!0}return t}function S(t){for(let e=0;e<t.length;e++){k(t,e)||(t[e]=null)}return t}function M(e){const i=o(null);for(const[s,n]of t(e)){k(e,s)&&(Array.isArray(n)?i[s]=S(n):n&&"object"==typeof n&&n.constructor===Object?i[s]=M(n):i[s]=n)}return i}function L(t,e){for(;null!==t;){const i=n(t,e);if(i){if(i.get)return E(i.get);if("function"==typeof i.value)return E(i.value)}t=s(t)}return function(){return null}}const A=a(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),R=a(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),P=a(["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"]),T=a(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),D=a(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),B=a(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),I=a(["#text"]),O=a(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),H=a(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","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","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),j=a(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","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","supscriptshift","symmetric","voffset","width","xmlns"]),N=a(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),F=r(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G=r(/<%[\w\W]*|[\w\W]*%>/gm),X=r(/\$\{[\w\W]*/gm),_=r(/^data-[\-\w.\u00B7-\uFFFF]+$/),Z=r(/^aria-[\-\w]+$/),U=r(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Y=r(/^(?:\w+script|data):/i),V=r(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),q=r(/^html$/i),W=r(/^[a-z][.\w]*(-[.\w]+)+$/i);var K=Object.freeze({__proto__:null,ARIA_ATTR:Z,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:W,DATA_ATTR:_,DOCTYPE_NAME:q,ERB_EXPR:G,IS_ALLOWED_URI:U,IS_SCRIPT_OR_DATA:Y,MUSTACHE_EXPR:F,TMPLIT_EXPR:X});const J=1,Q=3,tt=7,et=8,it=9,st=function(){return"undefined"==typeof window?null:window};var nt=function e(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:st();const s=t=>e(t);if(s.version="3.2.4",s.removed=[],!i||!i.document||i.document.nodeType!==it||!i.Element)return s.isSupported=!1,s;let{document:n}=i;const r=n,l=r.currentScript,{DocumentFragment:h,HTMLTemplateElement:z,Node:E,Element:S,NodeFilter:F,NamedNodeMap:G=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:X,DOMParser:_,trustedTypes:Z}=i,Y=S.prototype,V=L(Y,"cloneNode"),W=L(Y,"remove"),nt=L(Y,"nextSibling"),at=L(Y,"childNodes"),rt=L(Y,"parentNode");if("function"==typeof z){const t=n.createElement("template");t.content&&t.content.ownerDocument&&(n=t.content.ownerDocument)}let ot,lt="";const{implementation:ht,createNodeIterator:dt,createDocumentFragment:ct,getElementsByTagName:ut}=n,{importNode:pt}=r;let mt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};s.isSupported="function"==typeof t&&"function"==typeof rt&&ht&&void 0!==ht.createHTMLDocument;const{MUSTACHE_EXPR:bt,ERB_EXPR:gt,TMPLIT_EXPR:ft,DATA_ATTR:xt,ARIA_ATTR:wt,IS_SCRIPT_OR_DATA:vt,ATTR_WHITESPACE:kt,CUSTOM_ELEMENT:yt}=K;let{IS_ALLOWED_URI:Ct}=K,zt=null;const Et=$({},[...A,...R,...P,...D,...I]);let $t=null;const St=$({},[...O,...H,...j,...N]);let Mt=Object.seal(o(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Lt=null,At=null,Rt=!0,Pt=!0,Tt=!1,Dt=!0,Bt=!1,It=!0,Ot=!1,Ht=!1,jt=!1,Nt=!1,Ft=!1,Gt=!1,Xt=!0,_t=!1,Zt=!0,Ut=!1,Yt={},Vt=null;const qt=$({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Wt=null;const Kt=$({},["audio","video","img","source","image","track"]);let Jt=null;const Qt=$({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),te="http://www.w3.org/1998/Math/MathML",ee="http://www.w3.org/2000/svg",ie="http://www.w3.org/1999/xhtml";let se=ie,ne=!1,ae=null;const re=$({},[te,ee,ie],g);let oe=$({},["mi","mo","mn","ms","mtext"]),le=$({},["annotation-xml"]);const he=$({},["title","style","font","a","script"]);let de=null;const ce=["application/xhtml+xml","text/html"];let ue=null,pe=null;const me=n.createElement("form"),be=function(t){return t instanceof RegExp||t instanceof Function},ge=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!pe||pe!==t){if(t&&"object"==typeof t||(t={}),t=M(t),de=-1===ce.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,ue="application/xhtml+xml"===de?g:b,zt=k(t,"ALLOWED_TAGS")?$({},t.ALLOWED_TAGS,ue):Et,$t=k(t,"ALLOWED_ATTR")?$({},t.ALLOWED_ATTR,ue):St,ae=k(t,"ALLOWED_NAMESPACES")?$({},t.ALLOWED_NAMESPACES,g):re,Jt=k(t,"ADD_URI_SAFE_ATTR")?$(M(Qt),t.ADD_URI_SAFE_ATTR,ue):Qt,Wt=k(t,"ADD_DATA_URI_TAGS")?$(M(Kt),t.ADD_DATA_URI_TAGS,ue):Kt,Vt=k(t,"FORBID_CONTENTS")?$({},t.FORBID_CONTENTS,ue):qt,Lt=k(t,"FORBID_TAGS")?$({},t.FORBID_TAGS,ue):{},At=k(t,"FORBID_ATTR")?$({},t.FORBID_ATTR,ue):{},Yt=!!k(t,"USE_PROFILES")&&t.USE_PROFILES,Rt=!1!==t.ALLOW_ARIA_ATTR,Pt=!1!==t.ALLOW_DATA_ATTR,Tt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Dt=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Bt=t.SAFE_FOR_TEMPLATES||!1,It=!1!==t.SAFE_FOR_XML,Ot=t.WHOLE_DOCUMENT||!1,Nt=t.RETURN_DOM||!1,Ft=t.RETURN_DOM_FRAGMENT||!1,Gt=t.RETURN_TRUSTED_TYPE||!1,jt=t.FORCE_BODY||!1,Xt=!1!==t.SANITIZE_DOM,_t=t.SANITIZE_NAMED_PROPS||!1,Zt=!1!==t.KEEP_CONTENT,Ut=t.IN_PLACE||!1,Ct=t.ALLOWED_URI_REGEXP||U,se=t.NAMESPACE||ie,oe=t.MATHML_TEXT_INTEGRATION_POINTS||oe,le=t.HTML_INTEGRATION_POINTS||le,Mt=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&be(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Mt.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&be(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Mt.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Mt.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Bt&&(Pt=!1),Ft&&(Nt=!0),Yt&&(zt=$({},I),$t=[],!0===Yt.html&&($(zt,A),$($t,O)),!0===Yt.svg&&($(zt,R),$($t,H),$($t,N)),!0===Yt.svgFilters&&($(zt,P),$($t,H),$($t,N)),!0===Yt.mathMl&&($(zt,D),$($t,j),$($t,N))),t.ADD_TAGS&&(zt===Et&&(zt=M(zt)),$(zt,t.ADD_TAGS,ue)),t.ADD_ATTR&&($t===St&&($t=M($t)),$($t,t.ADD_ATTR,ue)),t.ADD_URI_SAFE_ATTR&&$(Jt,t.ADD_URI_SAFE_ATTR,ue),t.FORBID_CONTENTS&&(Vt===qt&&(Vt=M(Vt)),$(Vt,t.FORBID_CONTENTS,ue)),Zt&&(zt["#text"]=!0),Ot&&$(zt,["html","head","body"]),zt.table&&($(zt,["tbody"]),delete Lt.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw C('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw C('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ot=t.TRUSTED_TYPES_POLICY,lt=ot.createHTML("")}else void 0===ot&&(ot=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let i=null;const s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(i=e.getAttribute(s));const n="dompurify"+(i?"#"+i:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(Z,l)),null!==ot&&"string"==typeof lt&&(lt=ot.createHTML(""));a&&a(t),pe=t}},fe=$({},[...R,...P,...T]),xe=$({},[...D,...B]),we=function(t){p(s.removed,{element:t});try{rt(t).removeChild(t)}catch(e){W(t)}},ve=function(t,e){try{p(s.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){p(s.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(Nt||Ft)try{we(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},ke=function(t){let e=null,i=null;if(jt)t="<remove></remove>"+t;else{const e=f(t,/^[\r\n\t ]+/);i=e&&e[0]}"application/xhtml+xml"===de&&se===ie&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const s=ot?ot.createHTML(t):t;if(se===ie)try{e=(new _).parseFromString(s,de)}catch(t){}if(!e||!e.documentElement){e=ht.createDocument(se,"template",null);try{e.documentElement.innerHTML=ne?lt:s}catch(t){}}const a=e.body||e.documentElement;return t&&i&&a.insertBefore(n.createTextNode(i),a.childNodes[0]||null),se===ie?ut.call(e,Ot?"html":"body")[0]:Ot?e.documentElement:a},ye=function(t){return dt.call(t.ownerDocument||t,t,F.SHOW_ELEMENT|F.SHOW_COMMENT|F.SHOW_TEXT|F.SHOW_PROCESSING_INSTRUCTION|F.SHOW_CDATA_SECTION,null)},Ce=function(t){return t instanceof X&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof G)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},ze=function(t){return"function"==typeof E&&t instanceof E};function Ee(t,e,i){d(t,(t=>{t.call(s,e,i,pe)}))}const $e=function(t){let e=null;if(Ee(mt.beforeSanitizeElements,t,null),Ce(t))return we(t),!0;const i=ue(t.nodeName);if(Ee(mt.uponSanitizeElement,t,{tagName:i,allowedTags:zt}),t.hasChildNodes()&&!ze(t.firstElementChild)&&y(/<[/\w]/g,t.innerHTML)&&y(/<[/\w]/g,t.textContent))return we(t),!0;if(t.nodeType===tt)return we(t),!0;if(It&&t.nodeType===et&&y(/<[/\w]/g,t.data))return we(t),!0;if(!zt[i]||Lt[i]){if(!Lt[i]&&Me(i)){if(Mt.tagNameCheck instanceof RegExp&&y(Mt.tagNameCheck,i))return!1;if(Mt.tagNameCheck instanceof Function&&Mt.tagNameCheck(i))return!1}if(Zt&&!Vt[i]){const e=rt(t)||t.parentNode,i=at(t)||t.childNodes;if(i&&e){for(let s=i.length-1;s>=0;--s){const n=V(i[s],!0);n.o=(t.o||0)+1,e.insertBefore(n,nt(t))}}}return we(t),!0}return t instanceof S&&!function(t){let e=rt(t);e&&e.tagName||(e={namespaceURI:se,tagName:"template"});const i=b(t.tagName),s=b(e.tagName);return!!ae[t.namespaceURI]&&(t.namespaceURI===ee?e.namespaceURI===ie?"svg"===i:e.namespaceURI===te?"svg"===i&&("annotation-xml"===s||oe[s]):Boolean(fe[i]):t.namespaceURI===te?e.namespaceURI===ie?"math"===i:e.namespaceURI===ee?"math"===i&&le[s]:Boolean(xe[i]):t.namespaceURI===ie?!(e.namespaceURI===ee&&!le[s])&&!(e.namespaceURI===te&&!oe[s])&&!xe[i]&&(he[i]||!fe[i]):!("application/xhtml+xml"!==de||!ae[t.namespaceURI]))}(t)?(we(t),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!y(/<\/no(script|embed|frames)/i,t.innerHTML)?(Bt&&t.nodeType===Q&&(e=t.textContent,d([bt,gt,ft],(t=>{e=x(e,t," ")})),t.textContent!==e&&(p(s.removed,{element:t.cloneNode()}),t.textContent=e)),Ee(mt.afterSanitizeElements,t,null),!1):(we(t),!0)},Se=function(t,e,i){if(Xt&&("id"===e||"name"===e)&&(i in n||i in me))return!1;if(Pt&&!At[e]&&y(xt,e));else if(Rt&&y(wt,e));else if(!$t[e]||At[e]){if(!(Me(t)&&(Mt.tagNameCheck instanceof RegExp&&y(Mt.tagNameCheck,t)||Mt.tagNameCheck instanceof Function&&Mt.tagNameCheck(t))&&(Mt.attributeNameCheck instanceof RegExp&&y(Mt.attributeNameCheck,e)||Mt.attributeNameCheck instanceof Function&&Mt.attributeNameCheck(e))||"is"===e&&Mt.allowCustomizedBuiltInElements&&(Mt.tagNameCheck instanceof RegExp&&y(Mt.tagNameCheck,i)||Mt.tagNameCheck instanceof Function&&Mt.tagNameCheck(i))))return!1}else if(Jt[e]);else if(y(Ct,x(i,kt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==w(i,"data:")||!Wt[t]){if(Tt&&!y(vt,x(i,kt,"")));else if(i)return!1}else;return!0},Me=function(t){return"annotation-xml"!==t&&f(t,yt)},Le=function(t){Ee(mt.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||Ce(t))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$t,forceKeepAttr:void 0};let n=e.length;for(;n--;){const a=e[n],{name:r,namespaceURI:o,value:l}=a,h=ue(r);let c="value"===r?l:v(l);if(i.attrName=h,i.attrValue=c,i.keepAttr=!0,i.forceKeepAttr=void 0,Ee(mt.uponSanitizeAttribute,t,i),c=i.attrValue,!_t||"id"!==h&&"name"!==h||(ve(r,t),c="user-content-"+c),It&&y(/((--!?|])>)|<\/(style|title)/i,c)){ve(r,t);continue}if(i.forceKeepAttr)continue;if(ve(r,t),!i.keepAttr)continue;if(!Dt&&y(/\/>/i,c)){ve(r,t);continue}Bt&&d([bt,gt,ft],(t=>{c=x(c,t," ")}));const p=ue(t.nodeName);if(Se(p,h,c)){if(ot&&"object"==typeof Z&&"function"==typeof Z.getAttributeType)if(o);else switch(Z.getAttributeType(p,h)){case"TrustedHTML":c=ot.createHTML(c);break;case"TrustedScriptURL":c=ot.createScriptURL(c)}try{o?t.setAttributeNS(o,r,c):t.setAttribute(r,c),Ce(t)?we(t):u(s.removed)}catch(t){}}}Ee(mt.afterSanitizeAttributes,t,null)},Ae=function t(e){let i=null;const s=ye(e);for(Ee(mt.beforeSanitizeShadowDOM,e,null);i=s.nextNode();)Ee(mt.uponSanitizeShadowNode,i,null),$e(i),Le(i),i.content instanceof h&&t(i.content);Ee(mt.afterSanitizeShadowDOM,e,null)};return s.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,n=null,a=null,o=null;if(ne=!t,ne&&(t="\x3c!--\x3e"),"string"!=typeof t&&!ze(t)){if("function"!=typeof t.toString)throw C("toString is not a function");if("string"!=typeof(t=t.toString()))throw C("dirty is not a string, aborting")}if(!s.isSupported)return t;if(Ht||ge(e),s.removed=[],"string"==typeof t&&(Ut=!1),Ut){if(t.nodeName){const e=ue(t.nodeName);if(!zt[e]||Lt[e])throw C("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof E)i=ke("\x3c!----\x3e"),n=i.ownerDocument.importNode(t,!0),n.nodeType===J&&"BODY"===n.nodeName||"HTML"===n.nodeName?i=n:i.appendChild(n);else{if(!Nt&&!Bt&&!Ot&&-1===t.indexOf("<"))return ot&&Gt?ot.createHTML(t):t;if(i=ke(t),!i)return Nt?null:Gt?lt:""}i&&jt&&we(i.firstChild);const l=ye(Ut?t:i);for(;a=l.nextNode();)$e(a),Le(a),a.content instanceof h&&Ae(a.content);if(Ut)return t;if(Nt){if(Ft)for(o=ct.call(i.ownerDocument);i.firstChild;)o.appendChild(i.firstChild);else o=i;return($t.shadowroot||$t.shadowrootmode)&&(o=pt.call(r,o,!0)),o}let c=Ot?i.outerHTML:i.innerHTML;return Ot&&zt["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&y(q,i.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+c),Bt&&d([bt,gt,ft],(t=>{c=x(c,t," ")})),ot&&Gt?ot.createHTML(c):c},s.setConfig=function(){ge(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ht=!0},s.clearConfig=function(){pe=null,Ht=!1},s.isValidAttribute=function(t,e,i){pe||ge({});const s=ue(t),n=ue(e);return Se(s,n,i)},s.addHook=function(t,e){"function"==typeof e&&p(mt[t],e)},s.removeHook=function(t,e){if(void 0!==e){const i=c(mt[t],e);return-1===i?void 0:m(mt[t],i,1)[0]}return u(mt[t])},s.removeHooks=function(t){mt[t]=[]},s.removeAllHooks=function(){mt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},s}();class at{#t={};addEventListener(t,e){this.#t||(this.#t={});let i=this.#t[t];i||(this.#t[t]=i=[]),i.push(e),i.length>1e4&&console.warn(`Potential EventEmitter memory leak: ${i.length} listeners subscribed to event "${t}"`)}removeEventListener(t,e){if(this.#t&&this.#t[t]){for(var i=[],s=0;s<this.#t[t].length;s+=1)this.#t[t][s]!==e&&i.push(this.#t[t][s]);this.#t[t]=i}}dispatchEvent(t){if(!this.#t)return;let e=this.#t[t.type];if(!e)return;let i=null;for(let s=e.length-1;s>=0;s-=1){let n,a=e[s];try{n=a.call(window,t)}catch(t){null===i&&(i=t)}if(!1===n)break}if(i)throw i}}let rt=(t,e,i=!1)=>{if(t.length!==e.length)return!1;if(i)for(let i in t){if(t[i]!==e[i])return!1}else{for(let i=0;i<t.length;i+=1)if(!e.includes(t[i]))return!1;for(let i=0;i<e.length;i+=1)if(!t.includes(e[i]))return!1}return!0};function ot(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function lt(t,e,i=[0,0,0]){const s=ot(t,e[0]),n=ot(t,e[1]),a=ot(t,e[2]);return i[0]=s,i[1]=n,i[2]=a,i}function ht(t){return"string"===dt(t)}function dt(t){return(Object.prototype.toString.call(t).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function ct(t,{precision:e=16,unit:i}){return ut(t)?"none":(t=+mt(t,e))+(i??"")}function ut(t){return null===t}function pt(t){return ut(t)?0:t}function mt(t,e){if(0===t)return 0;let i=~~t,s=0;i&&e&&(s=1+~~Math.log10(Math.abs(i)));const n=10**(e-s);return Math.floor(t*n+.5)/n}function bt(t,e,i){return isNaN(t)?e:isNaN(e)?t:t+(e-t)*i}function gt(t,e,i){return!t||!e||t===e||t[0]===e[0]&&t[1]===e[1]||isNaN(i)||null===i?i:bt(e[0],e[1],function(t,e,i){return(i-t)/(e-t)}(t[0],t[1],i))}function ft(t,e,i){return Math.max(Math.min(i,e),t)}function xt(t,e){return Math.sign(t)===Math.sign(e)?t:-t}function wt(t,e){return xt(Math.abs(t)**e,t)}function vt(t,e){return 0===e?0:t/e}function kt(t,e){if(t instanceof e)return!0;const i=e.name;for(;t;){const e=Object.getPrototypeOf(t),s=e?.constructor?.name;if(s===i)return!0;if(!s||"Object"===s)return!1;t=e}return!1}class yt{type;coordMeta;coordRange;range;constructor(t,e){if("object"==typeof t&&(this.coordMeta=t),e&&(this.coordMeta=e,this.coordRange=e.range??e.refRange),"string"==typeof t){let e=t.trim().match(/^(?<type><[a-z]+>)(\[(?<min>-?[.\d]+),\s*(?<max>-?[.\d]+)\])?$/);if(!e)throw new TypeError(`Cannot parse ${t} as a type definition.`);this.type=e.groups.type;let{min:i,max:s}=e.groups;(i||s)&&(this.range=[+i,+s])}}get computedRange(){return this.range?this.range:"<percentage>"===this.type?this.percentageRange():"<angle>"===this.type?[0,360]:null}get unit(){return"<percentage>"===this.type?"%":"<angle>"===this.type?"deg":""}resolve(t){if("<angle>"===this.type)return t;let e=this.computedRange,i=this.coordRange;return"<percentage>"===this.type&&(i??=this.percentageRange()),gt(e,i,t)}serialize(t,e){let i="<percentage>"===this.type?this.percentageRange(100):this.computedRange,s=this.unit;return ct(t=gt(this.coordRange,i,t),{unit:s,precision:e})}toString(){let t=this.type;if(this.range){let[e="",i=""]=this.range;t+=`[${e},${i}]`}return t}percentageRange(t=1){let e;return e=this.coordMeta&&this.coordMeta.range||this.coordRange&&this.coordRange[0]>=0?[0,1]:[-1,1],[e[0]*t,e[1]*t]}static get(t,...e){return kt(t,this)?t:new this(t,...e)}}const Ct=Symbol("instance");class zt{type;name;spaceCoords;coords;constructor(t,e=t.space){t[Ct]=this,this.type="function",this.name="color",Object.assign(this,t),this.space=e,"custom"!==this.type&&(this.spaceCoords=Object.values(e.coords),this.coords||(this.coords=this.spaceCoords.map((t=>{let e=["<number>","<percentage>"];return"angle"===t.type&&e.push("<angle>"),e}))),this.coords=this.coords.map(((t,e)=>{let i=this.spaceCoords[e];return"string"==typeof t&&(t=t.trim().split(/\s*\|\s*/)),t.map((t=>yt.get(t,i)))})))}serializeCoords(t,e,i){return i=t.map(((t,e)=>yt.get(i?.[e]??this.coords[e][0],this.spaceCoords[e]))),t.map(((t,s)=>i[s].serialize(t,e)))}coerceCoords(t,e){return Object.entries(this.space.coords).map((([i,s],n)=>{let a=t[n];if(ut(a)||isNaN(a))return a;let r=e[n],o=this.coords[n].find((t=>t.type==r));if(!o){let t=s.name||i;throw new TypeError(`${r??a?.raw??a} not allowed for ${t} in ${this.name}()`)}return a=o.resolve(a),o.range&&(e[n]=o.toString()),a}))}canSerialize(){return"function"===this.type||this.serialize}static get(t,...e){return!t||kt(t,this)?t:t[Ct]?t[Ct]:new zt(t,...e)}}const Et=new class{add(t,e,i){if("string"==typeof arguments[0])(Array.isArray(t)?t:[t]).forEach((function(t){this[t]=this[t]||[],e&&this[t][i?"unshift":"push"](e)}),this);else for(var t in arguments[0])this.add(t,arguments[0][t],arguments[1])}run(t,e){this[t]=this[t]||[],this[t].forEach((function(t){t.call(e&&e.context?e.context:e,e)}))}},$t={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function St(t){return Array.isArray(t)?t:$t[t]}function Mt(t,e,i,s={}){if(t=St(t),e=St(e),!t||!e)throw new TypeError(`Missing white point to convert ${t?"":"from"}${t||e?"":"/"}${e?"":"to"}`);if(t===e)return i;let n={W1:t,W2:e,XYZ:i,options:s};if(Et.run("chromatic-adaptation-start",n),n.M||(n.W1===$t.D65&&n.W2===$t.D50?n.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:n.W1===$t.D50&&n.W2===$t.D65&&(n.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),Et.run("chromatic-adaptation-end",n),n.M)return lt(n.XYZ,n.M);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}var Lt={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==globalThis?.process?.env?.NODE_ENV?.toLowerCase(),warn:function(t){this.verbose&&globalThis?.console?.warn?.(t)}};function At(t,e){let i,s={str:String(t)?.trim(),options:e};if(Et.run("parse-start",s),s.color)return s.color;s.parsed=function(t){if(!t)return;t=t.trim();let e=t.match(Pt.function);if(e){let t=[],i=[],s=!1,n=e[2].replace(Pt.singleArgument,((e,n)=>{let{value:a,meta:r}=function(t){let e={},i=t.match(Pt.unitValue)?.[0],s=e.raw=t;i?(e.type="%"===i?"<percentage>":"<angle>",e.unit=i,e.unitless=Number(s.slice(0,-i.length)),s=e.unitless*Rt[i]):Pt.number.test(s)?(s=Number(s),e.type="<number>"):"none"===s?s=null:"NaN"===s||"calc(NaN)"===s?(s=NaN,e.type="<number>"):e.type="<ident>";return{value:s,meta:e}}(n);return e.startsWith("/")&&(s=!0),t.push(a),i.push(r),""}));return{name:e[1].toLowerCase(),args:t,argMeta:i,lastAlpha:s,commas:n.includes(","),rawName:e[1],rawArgs:e[2]}}}(s.str);let n=s.options?s.options.parseMeta??s.options.meta:null;if(s.parsed){let e,a,r=s.parsed.name,o=s.parsed.args,l=o.map(((t,e)=>s.parsed.argMeta[e]?.type));if("color"===r){let i=o.shift();l.shift();let n=i.startsWith("--")?i.substring(2):`--${i}`,h=[i,n];if(e=Dt.findFormat({name:r,id:h,type:"function"}),!e){let e,a=i in Dt.registry?i:n;if(a in Dt.registry){let s=Dt.registry[a].formats?.color?.id;if(s){e=`Did you mean ${t.replace("color("+i,"color("+s)}?`}}throw new TypeError(`Cannot parse ${s.str}. `+(e??"Missing a plugin?"))}a=e.space,e.id.startsWith("--")&&!i.startsWith("--")&&Lt.warn(`${a.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${e.id}) instead of color(${i}).`),i.startsWith("--")&&!e.id.startsWith("--")&&Lt.warn(`${a.name} is a standard space and supported in the CSS spec. Use color(${e.id}) instead of prefixed color(${i}).`)}else e=Dt.findFormat({name:r,type:"function"}),a=e.space;n&&Object.assign(n,{format:e,formatId:e.name,types:l,commas:s.parsed.commas});let h=1;(!0===e.alpha||s.parsed.lastAlpha)&&(h=s.parsed.args.pop(),n&&(n.alphaType=l.pop()));let d=e.coords.length;if(o.length!==d)throw new TypeError(`Expected ${d} coordinates for ${a.id} in ${s.str}), got ${o.length}`);o=e.coerceCoords(o,l),i={spaceId:a.id,coords:o,alpha:h}}else for(let t of Dt.all)for(let e in t.formats){let a=t.formats[e];if("custom"!==a.type)continue;if(a.test&&!a.test(s.str))continue;a=t.getFormat(a);let r=a.parse(s.str);if(r){n&&Object.assign(n,{format:a,formatId:e}),i=r;break}}if(!i)throw new TypeError(`Could not parse ${t} as a color. Missing a plugin?`);return i.alpha=ut(i.alpha)?i.alpha:void 0===i.alpha?1:ft(0,i.alpha,1),i}const Rt={"%":.01,deg:1,grad:.9,rad:180/Math.PI,turn:360},Pt={function:/^([a-z]+)\(((?:calc\(NaN\)|.)+?)\)$/i,number:/^([-+]?(?:[0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?)$/i,unitValue:RegExp(`(${Object.keys(Rt).join("|")})$`),singleArgument:/\/?\s*(none|NaN|calc\(NaN\)|[-+\w.]+(?:%|deg|g?rad|turn)?)/g};function Tt(t,e){if(Array.isArray(t))return t.map((t=>Tt(t,e)));if(!t)throw new TypeError("Empty color reference");ht(t)&&(t=At(t,e));let i=t.space||t.spaceId;return"string"==typeof i&&(t.space=Dt.get(i)),void 0===t.alpha&&(t.alpha=1),t}class Dt{constructor(t){this.id=t.id,this.name=t.name,this.base=t.base?Dt.get(t.base):null,this.aliases=t.aliases,this.base&&(this.fromBase=t.fromBase,this.toBase=t.toBase);let e=t.coords??this.base.coords;for(let t in e)"name"in e[t]||(e[t].name=t);this.coords=e;let i=t.white??this.base.white??"D65";this.white=St(i),this.formats=t.formats??{};for(let t in this.formats){let e=this.formats[t];e.type||="function",e.name||=t}this.formats.color?.id||(this.formats.color={...this.formats.color??{},id:t.cssId||this.id}),t.gamutSpace?this.gamutSpace="self"===t.gamutSpace?this:Dt.get(t.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(t,e)=>!0),this.referred=t.referred,Object.defineProperty(this,"path",{value:Bt(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),Et.run("colorspace-init-end",this)}inGamut(t,{epsilon:e=75e-6}={}){if(!this.equals(this.gamutSpace))return t=this.to(this.gamutSpace,t),this.gamutSpace.inGamut(t,{epsilon:e});let i=Object.values(this.coords);return t.every(((t,s)=>{let n=i[s];if("angle"!==n.type&&n.range){if(ut(t))return!0;let[i,s]=n.range;return(void 0===i||t>=i-e)&&(void 0===s||t<=s+e)}return!0}))}get isUnbounded(){return Object.values(this.coords).every((t=>!("range"in t)))}get cssId(){return this.formats?.color?.id||this.id}get isPolar(){for(let t in this.coords)if("angle"===this.coords[t].type)return!0;return!1}getFormat(t){if(!t)return null;"default"===t?t=Object.values(this.formats)[0]:"string"==typeof t&&(t=this.formats[t]);let e=zt.get(t,this);return e!==t&&t.name in this.formats&&(this.formats[t.name]=e),e}equals(t){return!!t&&(this===t||this.id===t||this.id===t.id)}to(t,e){if(1===arguments.length){const i=Tt(t);[t,e]=[i.space,i.coords]}if(t=Dt.get(t),this.equals(t))return e;e=e.map((t=>ut(t)?0:t));let i,s,n=this.path,a=t.path;for(let t=0;t<n.length&&n[t].equals(a[t]);t++)i=n[t],s=t;if(!i)throw new Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);for(let t=n.length-1;t>s;t--)e=n[t].toBase(e);for(let t=s+1;t<a.length;t++)e=a[t].fromBase(e);return e}from(t,e){if(1===arguments.length){const i=Tt(t);[t,e]=[i.space,i.coords]}return(t=Dt.get(t)).to(this,e)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let t=[];for(let e in this.coords){let i=this.coords[e],s=i.range||i.refRange;t.push(s?.min??0)}return t}static registry={};static get all(){return[...new Set(Object.values(Dt.registry))]}static register(t,e){if(1===arguments.length&&(t=(e=arguments[0]).id),e=this.get(e),this.registry[t]&&this.registry[t]!==e)throw new Error(`Duplicate color space registration: '${t}'`);if(this.registry[t]=e,1===arguments.length&&e.aliases)for(let t of e.aliases)this.register(t,e);return e}static get(t,...e){if(!t||kt(t,this))return t;if("string"===dt(t)){let e=Dt.registry[t.toLowerCase()];if(!e)throw new TypeError(`No color space found with id = "${t}"`);return e}if(e.length)return Dt.get(...e);throw new TypeError(`${t} is not a valid color space`)}static findFormat(t,e=Dt.all){if(!t)return null;"string"==typeof t&&(t={name:t});for(let i of e)for(let[e,s]of Object.entries(i.formats)){s.name??=e,s.type??="function";let n=!(t.name&&s.name!==t.name||t.type&&s.type!==t.type);if(t.id){let e=s.ids||[s.id],i=Array.isArray(t.id)?t.id:[t.id];n&&=i.some((t=>e.includes(t)))}if(n){let t=zt.get(s,i);return t!==s&&(i.formats[s.name]=t),t}}return null}static resolveCoord(t,e){let i,s,n=dt(t);if("string"===n?t.includes(".")?[i,s]=t.split("."):[i,s]=[,t]:Array.isArray(t)?[i,s]=t:(i=t.space,s=t.coordId),i=Dt.get(i),i||(i=e),!i)throw new TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);if(n=dt(s),"number"===n||"string"===n&&s>=0){let t=Object.entries(i.coords)[s];if(t)return{space:i,id:t[0],index:s,...t[1]}}i=Dt.get(i);let a=s.toLowerCase(),r=0;for(let t in i.coords){let e=i.coords[t];if(t.toLowerCase()===a||e.name?.toLowerCase()===a)return{space:i,id:t,index:r,...e};r++}throw new TypeError(`No "${s}" coordinate found in ${i.name}. Its coordinates are: ${Object.keys(i.coords).join(", ")}`)}static DEFAULT_FORMAT={type:"functions",name:"color"}}function Bt(t){let e=[t];for(let i=t;i=i.base;)e.push(i);return e}var It=new Dt({id:"xyz-d65",name:"XYZ D65",coords:{x:{refRange:[0,1],name:"X"},y:{refRange:[0,1],name:"Y"},z:{refRange:[0,1],name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]}),Ot=new Dt({id:"xyz-d50",name:"XYZ D50",white:"D50",base:It,fromBase:t=>Mt(It.white,"D50",t),toBase:t=>Mt("D50",It.white,t)});const Ht=216/24389,jt=24/116,Nt=24389/27;let Ft=$t.D50;var Gt=new Dt({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Ft,base:Ot,fromBase(t){let e=t.map(((t,e)=>t/Ft[e])).map((t=>t>Ht?Math.cbrt(t):(Nt*t+16)/116));return[116*e[1]-16,500*(e[0]-e[1]),200*(e[1]-e[2])]},toBase(t){let[e,i,s]=t,n=[];return n[1]=(e+16)/116,n[0]=i/500+n[1],n[2]=n[1]-s/200,[n[0]>jt?Math.pow(n[0],3):(116*n[0]-16)/Nt,t[0]>8?Math.pow((t[0]+16)/116,3):t[0]/Nt,n[2]>jt?Math.pow(n[2],3):(116*n[2]-16)/Nt].map(((t,e)=>t*Ft[e]))},formats:{lab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function Xt(t){return"number"!=typeof t?t:(t%360+360)%360}var _t=new Dt({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Gt,fromBase(t){if(void 0===this.ε){let t=Object.values(this.base.coords)[1].refRange,e=t[1]-t[0];this.ε=e/1e5}let[e,i,s]=t,n=Math.abs(i)<this.ε&&Math.abs(s)<this.ε,a=n?null:Xt(180*Math.atan2(s,i)/Math.PI);return[e,n?0:Math.sqrt(i**2+s**2),a]},toBase(t){let[e,i,s]=t,n=null,a=null;return ut(s)||(i=i<0?0:i,n=i*Math.cos(s*Math.PI/180),a=i*Math.sin(s*Math.PI/180)),[e,n,a]},formats:{lch:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}});const Zt=25**7,Ut=Math.PI,Yt=180/Ut,Vt=Ut/180;function qt(t){const e=t*t;return e*e*e*t}function Wt(t,e,{kL:i=1,kC:s=1,kH:n=1}={}){[t,e]=Tt([t,e]);let[a,r,o]=Gt.from(t),l=_t.from(Gt,[a,r,o])[1],[h,d,c]=Gt.from(e),u=_t.from(Gt,[h,d,c])[1];l<0&&(l=0),u<0&&(u=0);let p=qt((l+u)/2),m=.5*(1-Math.sqrt(p/(p+Zt))),b=(1+m)*r,g=(1+m)*d,f=Math.sqrt(b**2+o**2),x=Math.sqrt(g**2+c**2),w=0===b&&0===o?0:Math.atan2(o,b),v=0===g&&0===c?0:Math.atan2(c,g);w<0&&(w+=2*Ut),v<0&&(v+=2*Ut),w*=Yt,v*=Yt;let k,y=h-a,C=x-f,z=v-w,E=w+v,$=Math.abs(z);f*x==0?k=0:$<=180?k=z:z>180?k=z-360:z<-180?k=z+360:Lt.warn("the unthinkable has happened");let S,M=2*Math.sqrt(x*f)*Math.sin(k*Vt/2),L=(a+h)/2,A=(f+x)/2,R=qt(A);S=f*x==0?E:$<=180?E/2:E<360?(E+360)/2:(E-360)/2;let P=(L-50)**2,T=1+.015*P/Math.sqrt(20+P),D=1+.045*A,B=1;B-=.17*Math.cos((S-30)*Vt),B+=.24*Math.cos(2*S*Vt),B+=.32*Math.cos((3*S+6)*Vt),B-=.2*Math.cos((4*S-63)*Vt);let I=1+.015*A*B,O=30*Math.exp(-1*((S-275)/25)**2),H=2*Math.sqrt(R/(R+Zt)),j=(y/(i*T))**2;return j+=(C/(s*D))**2,j+=(M/(n*I))**2,j+=-1*Math.sin(2*O*Vt)*H*(C/(s*D))*(M/(n*I)),Math.sqrt(j)}const Kt=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],Jt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],Qt=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],te=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var ee=new Dt({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:It,fromBase(t){let e=lt(t,Kt);return e[0]=Math.cbrt(e[0]),e[1]=Math.cbrt(e[1]),e[2]=Math.cbrt(e[2]),lt(e,Qt,e)},toBase(t){let e=lt(t,te);return e[0]=e[0]**3,e[1]=e[1]**3,e[2]=e[2]**3,lt(e,Jt,e)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function ie(t,e){[t,e]=Tt([t,e]);let[i,s,n]=ee.from(t),[a,r,o]=ee.from(e),l=i-a,h=s-r,d=n-o;return Math.sqrt(l**2+h**2+d**2)}function se(t,e,{epsilon:i=75e-6}={}){t=Tt(t),e||(e=t.space),e=Dt.get(e);let s=t.coords;return e!==t.space&&(s=e.from(t)),e.inGamut(s,{epsilon:i})}function ne(t,e){t=Tt(t);let i,s=Dt.get(e,e?.space),n=e?.precision;return i=!s||t.space.equals(s)?t.coords.slice():s.from(t),void 0===n?i:i.map((t=>mt(t,n)))}function ae(t,e){if(t=Tt(t),"alpha"===e)return t.alpha??1;let{space:i,index:s}=Dt.resolveCoord(e,t.space);return ne(t,i)[s]}function re(t,e,i,s){return t=Tt(t),Array.isArray(e)&&([e,i,s]=[t.space,e,i]),e=Dt.get(e),t.coords=e===t.space?i.slice():e.to(t.space,i),void 0!==s&&(t.alpha=s),t}function oe(t,e,i){if(t=Tt(t),2===arguments.length&&"object"===dt(arguments[1])){let e=arguments[1];for(let i in e)oe(t,i,e[i])}else if("function"==typeof i&&(i=i(ae(t,e))),"alpha"===e)t.alpha=i;else{let{space:s,index:n}=Dt.resolveCoord(e,t.space),a=ne(t,s);a[n]=i,re(t,s,a)}return t}function le(t){return{space:t.space,coords:t.coords.slice(),alpha:t.alpha}}re.returns="color",oe.returns="color";const he=Math.PI/180;var de=new Dt({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:It,fromBase:t=>t.map((t=>Math.max(203*t,0))),toBase:t=>t.map((t=>Math.max(t/203,0)))});const ce=1.15,ue=.66,pe=2610/16384,me=16384/2610,be=.8359375,ge=2413/128,fe=18.6875,xe=1.7*2523/32,we=32/(1.7*2523),ve=-.56,ke=16295499532821565e-27,ye=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],Ce=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],ze=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],Ee=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var $e=new Dt({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:de,fromBase(t){let[e,i,s]=t,n=lt([ce*e-(ce-1)*s,ue*i-(ue-1)*e,s],ye).map((function(t){return((be+ge*(t/1e4)**pe)/(1+fe*(t/1e4)**pe))**xe})),[a,r,o]=lt(n,ze);return[(1+ve)*a/(1+ve*a)-ke,r,o]},toBase(t){let[e,i,s]=t,n=lt([(e+ke)/(1+ve-ve*(e+ke)),i,s],Ee).map((function(t){return 1e4*((be-t**we)/(fe*t**we-ge))**me})),[a,r,o]=lt(n,Ce),l=(a+(ce-1)*o)/ce;return[l,(r+(ue-1)*l)/ue,o]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <percentage>"]}}}),Se=new Dt({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:$e,fromBase:_t.fromBase,toBase:_t.toBase});const Me=.8359375,Le=2413/128,Ae=18.6875,Re=2610/16384,Pe=2523/32,Te=16384/2610,De=32/2523,Be=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],Ie=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],Oe=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],He=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var je=new Dt({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:de,fromBase:t=>function(t){let e=t.map((function(t){return((Me+Le*(t/1e4)**Re)/(1+Ae*(t/1e4)**Re))**Pe}));return lt(e,Ie)}(lt(t,Be)),toBase(t){let e=function(t){let e=lt(t,Oe),i=e.map((function(t){return 1e4*(Math.max(t**De-Me,0)/(Le-Ae*t**De))**Te}));return i}(t);return lt(e,He)}});const Ne=$t.D65,Fe=1/.42,Ge=2*Math.PI,Xe=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],_e=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],Ze=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Ue={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Ye={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Ve=180/Math.PI,qe=Math.PI/180;function We(t,e){return t.map((t=>{const i=wt(e*Math.abs(t)*.01,.42);return 400*xt(i,t)/(i+27.13)}))}function Ke(t,e,i,s,n){const a={};a.discounting=n,a.refWhite=t,a.surround=s;const r=t.map((t=>100*t));a.la=e,a.yb=i;const o=r[1],l=lt(r,Xe),h=(s=Ue[a.surround])[0];a.c=s[1],a.nc=s[2];const d=(1/(5*a.la+1))**4;a.fl=d*a.la+.1*(1-d)*(1-d)*Math.cbrt(5*a.la),a.flRoot=a.fl**.25,a.n=a.yb/o,a.z=1.48+Math.sqrt(a.n),a.nbb=.725*a.n**-.2,a.ncb=a.nbb;const c=Math.max(Math.min(h*(1-1/3.6*Math.exp((-a.la-42)/92)),1),0);a.dRgb=l.map((t=>bt(1,o/t,c))),a.dRgbInv=a.dRgb.map((t=>1/t));const u=We(l.map(((t,e)=>t*a.dRgb[e])),a.fl);return a.aW=a.nbb*(2*u[0]+u[1]+.05*u[2]),a}const Je=Ke(Ne,64/Math.PI*.2,20,"average",!1);function Qe(t,e){if(!(void 0!==t.J^void 0!==t.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==t.C^void 0!==t.M^void 0!==t.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==t.h^void 0!==t.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===t.J||0===t.Q)return[0,0,0];let i=0;i=void 0!==t.h?Xt(t.h)*qe:function(t){let e=(t%400+400)%400;const i=Math.floor(.01*e);e%=100;const[s,n]=Ye.h.slice(i,i+2),[a,r]=Ye.e.slice(i,i+2);return Xt((e*(r*s-a*n)-100*s*r)/(e*(r-a)-100*r))}(t.H)*qe;const s=Math.cos(i),n=Math.sin(i);let a=0;void 0!==t.J?a=.1*wt(t.J,.5):void 0!==t.Q&&(a=.25*e.c*t.Q/((e.aW+4)*e.flRoot));let r=0;void 0!==t.C?r=t.C/a:void 0!==t.M?r=t.M/e.flRoot/a:void 0!==t.s&&(r=4e-4*t.s**2*(e.aW+4)/e.c);const o=wt(r*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),l=.25*(Math.cos(i+2)+3.8),h=e.aW*wt(a,2/e.c/e.z),d=5e4/13*e.nc*e.ncb*l,c=h/e.nbb,u=23*(c+.305)*vt(o,23*d+o*(11*s+108*n)),p=function(t,e){const i=100/e*2588.068098016295;return t.map((t=>{const e=Math.abs(t);return xt(i*wt(e/(400-e),Fe),t)}))}(lt([c,u*s,u*n],Ze).map((t=>1*t/1403)),e.fl);return lt(p.map(((t,i)=>t*e.dRgbInv[i])),_e).map((t=>t/100))}function ti(t,e){const i=We(lt(t.map((t=>100*t)),Xe).map(((t,i)=>t*e.dRgb[i])),e.fl),s=i[0]+(-12*i[1]+i[2])/11,n=(i[0]+i[1]-2*i[2])/9,a=(Math.atan2(n,s)%Ge+Ge)%Ge,r=.25*(Math.cos(a+2)+3.8),o=wt(5e4/13*e.nc*e.ncb*vt(r*Math.sqrt(s**2+n**2),i[0]+i[1]+1.05*i[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),l=wt(e.nbb*(2*i[0]+i[1]+.05*i[2])/e.aW,.5*e.c*e.z),h=100*wt(l,2),d=4/e.c*l*(e.aW+4)*e.flRoot,c=o*l,u=c*e.flRoot,p=Xt(a*Ve),m=function(t){let e=Xt(t);e<=Ye.h[0]&&(e+=360);const i=function(t,e,i=0,s=t.length){for(;i<s;){const n=i+s>>1;t[n]<e?i=n+1:s=n}return i}(Ye.h,e)-1,[s,n]=Ye.h.slice(i,i+2),[a,r]=Ye.e.slice(i,i+2),o=(e-s)/a;return Ye.H[i]+100*o/(o+(n-e)/r)}(p);return{J:h,C:c,h:p,s:50*wt(e.c*o/(e.aW+4),.5),Q:d,M:u,H:m}}new Dt({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:It,fromBase(t){const e=ti(t,Je);return[e.J,e.M,e.h]},toBase:t=>Qe({J:t[0],M:t[1],h:t[2]},Je)});const ei=216/24389,ii=24389/27;function si(t){return t>8?Math.pow((t+16)/116,3):t/ii}function ni(t,e){const i=116*((s=t[1])>ei?Math.cbrt(s):(ii*s+16)/116)-16;var s;if(0===i)return[0,0,0];const n=ti(t,ai);return[Xt(n.h),n.C,i]}const ai=Ke($t.D65,200/Math.PI*si(50),100*si(50),"average",!1);var ri=new Dt({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:It,fromBase:t=>ni(t),toBase:t=>function(t,e){let[i,s,n]=t,a=[],r=0;if(0===n)return[0,0,0];let o=si(n);r=n>0?.00379058511492914*n**2+.608983189401032*n+.9155088574762233:9514440756550361e-21*n**2+.08693057439788597*n-21.928975842194614;let l=0,h=Infinity;for(;l<=15;){a=Qe({J:r,C:s,h:i},e);const t=Math.abs(a[1]-o);if(t<h){if(t<=2e-12)return a;h=t}r-=(a[1]-o)*r/(2*a[1]),l+=1}return Qe({J:r,C:s,h:i},e)}(t,ai),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const oi=Math.PI/180,li=[1,.007,.0228];function hi(t){t[1]<0&&(t=r