framework7
Version:
Full featured mobile HTML framework for building iOS & Android apps
13 lines (12 loc) • 804 kB
JavaScript
/**
* Framework7 9.0.2
* Full featured mobile HTML framework for building iOS & Android apps
* https://framework7.io/
*
* Copyright 2014-2025 Vladimir Kharlampidi
*
* Released under the MIT License
*
* Released on: December 5, 2025
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Framework7=t()}(this,function(){"use strict";function e(e){return null!==e&&"object"==typeof e&&"constructor"in e&&e.constructor===Object}function t(r={},a={}){Object.keys(a).forEach(s=>{void 0===r[s]?r[s]=a[s]:e(a[s])&&e(r[s])&&Object.keys(a[s]).length>0&&t(r[s],a[s])})}const r={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector:()=>null,querySelectorAll:()=>[],getElementById:()=>null,createEvent:()=>({initEvent(){}}),createElement:()=>({children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName:()=>[]}),createElementNS:()=>({}),importNode:()=>null,location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function a(){const e="undefined"!=typeof document?document:{};return t(e,r),e}const s={document:r,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle:()=>({getPropertyValue:()=>""}),Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia:()=>({}),requestAnimationFrame:e=>"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0),cancelAnimationFrame(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function o(){const e="undefined"!=typeof window?window:{};return t(e,s),e}class n extends Array{constructor(e){"number"==typeof e?super(e):(super(...e||[]),function(e){const t=e.__proto__;Object.defineProperty(e,"__proto__",{get:()=>t,set(e){t.__proto__=e}})}(this))}}function i(e=[]){const t=[];return e.forEach(e=>{Array.isArray(e)?t.push(...i(e)):t.push(e)}),t}function l(e,t){return Array.prototype.filter.call(e,t)}function c(e){return e.toLowerCase().replace(/-(.)/g,(e,t)=>t.toUpperCase())}function p(e,t){const r=o(),s=a();let i=[];if(!t&&e instanceof n)return e;if(!e)return new n(i);if("string"==typeof e){const r=e.trim();if(r.indexOf("<")>=0&&r.indexOf(">")>=0){let e="div";0===r.indexOf("<li")&&(e="ul"),0===r.indexOf("<tr")&&(e="tbody"),0!==r.indexOf("<td")&&0!==r.indexOf("<th")||(e="tr"),0===r.indexOf("<tbody")&&(e="table"),0===r.indexOf("<option")&&(e="select");const t=s.createElement(e);t.innerHTML=r;for(let e=0;e<t.childNodes.length;e+=1)i.push(t.childNodes[e])}else i=function(e,t){if("string"!=typeof e)return[e];const r=[],a=t.querySelectorAll(e);for(let e=0;e<a.length;e+=1)r.push(a[e]);return r}(e.trim(),t||s)}else if(e.nodeType||e===r||e===s)i.push(e);else if(Array.isArray(e)){if(e instanceof n)return e;i=e}return new n(function(e){const t=[];for(let r=0;r<e.length;r+=1)-1===t.indexOf(e[r])&&t.push(e[r]);return t}(i))}p.fn=n.prototype;const d="resize scroll".split(" ");function u(e){return function(...t){if(void 0===t[0]){for(let t=0;t<this.length;t+=1)d.indexOf(e)<0&&(e in this[t]?this[t][e]():p(this[t]).trigger(e));return this}return this.on(e,...t)}}const h=u("click"),m=u("blur"),f=u("focus"),g=u("focusin"),v=u("focusout"),b=u("keyup"),y=u("keydown"),w=u("keypress"),C=u("submit"),E=u("change"),k=u("mousedown"),x=u("mousemove"),$=u("mouseup"),T=u("mouseenter"),S=u("mouseleave"),P=u("mouseout"),M=u("mouseover"),O=u("touchstart"),I=u("touchend"),B=u("touchmove"),L=u("resize"),D=u("scroll");var A=Object.freeze({__proto__:null,$:p,add:function(...e){const t=this;let r,a;for(r=0;r<e.length;r+=1){const s=p(e[r]);for(a=0;a<s.length;a+=1)t.push(s[a])}return t},addClass:function(...e){const t=i(e.map(e=>e.split(" ")));return this.forEach(e=>{e.classList.add(...t)}),this},animate:function(e,t){const r=o(),a=this,s={props:Object.assign({},e),params:Object.assign({duration:300,easing:"swing"},t),elements:a,animating:!1,que:[],easingProgress:(e,t)=>"swing"===e?.5-Math.cos(t*Math.PI)/2:"function"==typeof e?e(t):t,stop(){s.frameId&&r.cancelAnimationFrame(s.frameId),s.animating=!1,s.elements.each(e=>{delete e.dom7AnimateInstance}),s.que=[]},done(e){if(s.animating=!1,s.elements.each(e=>{delete e.dom7AnimateInstance}),e&&e(a),s.que.length>0){const e=s.que.shift();s.animate(e[0],e[1])}},animate(e,t){if(s.animating)return s.que.push([e,t]),s;const o=[];s.elements.each((t,a)=>{let n,i,l,c,p;t.dom7AnimateInstance||(s.elements[a].dom7AnimateInstance=s),o[a]={container:t},Object.keys(e).forEach(s=>{n=r.getComputedStyle(t,null).getPropertyValue(s).replace(",","."),i=parseFloat(n),l=n.replace(i,""),c=parseFloat(e[s]),p=e[s]+l,o[a][s]={initialFullValue:n,initialValue:i,unit:l,finalValue:c,finalFullValue:p,currentValue:i}})});let n,i,l=null,c=0,p=0,d=!1;return s.animating=!0,s.frameId=r.requestAnimationFrame(function u(){let h,m;n=(new Date).getTime(),d||(d=!0,t.begin&&t.begin(a)),null===l&&(l=n),t.progress&&t.progress(a,Math.max(Math.min((n-l)/t.duration,1),0),l+t.duration-n<0?0:l+t.duration-n,l),o.forEach(r=>{const a=r;i||a.done||Object.keys(e).forEach(r=>{if(i||a.done)return;h=Math.max(Math.min((n-l)/t.duration,1),0),m=s.easingProgress(t.easing,h);const{initialValue:d,finalValue:u,unit:f}=a[r];a[r].currentValue=d+m*(u-d);const g=a[r].currentValue;(u>d&&g>=u||u<d&&g<=u)&&(a.container.style[r]=u+f,p+=1,p===Object.keys(e).length&&(a.done=!0,c+=1),c===o.length&&(i=!0)),i?s.done(t.complete):a.container.style[r]=g+f})}),i||(s.frameId=r.requestAnimationFrame(u))}),s}};if(0===s.elements.length)return a;let n;for(let e=0;e<s.elements.length;e+=1)s.elements[e].dom7AnimateInstance?n=s.elements[e].dom7AnimateInstance:s.elements[e].dom7AnimateInstance=s;return n||(n=s),"stop"===e?n.stop():n.animate(s.props,s.params),a},animationEnd:function(e){const t=this;return e&&t.on("animationend",function r(a){a.target===this&&(e.call(this,a),t.off("animationend",r))}),this},append:function(...e){let t;const r=a();for(let a=0;a<e.length;a+=1){t=e[a];for(let e=0;e<this.length;e+=1)if("string"==typeof t){const a=r.createElement("div");for(a.innerHTML=t;a.firstChild;)this[e].appendChild(a.firstChild)}else if(t instanceof n)for(let r=0;r<t.length;r+=1)this[e].appendChild(t[r]);else this[e].appendChild(t)}return this},appendTo:function(e){return p(e).append(this),this},attr:function(e,t){if(1===arguments.length&&"string"==typeof e)return this[0]?this[0].getAttribute(e):void 0;for(let r=0;r<this.length;r+=1)if(2===arguments.length)this[r].setAttribute(e,t);else for(const t in e)this[r][t]=e[t],this[r].setAttribute(t,e[t]);return this},blur:m,change:E,children:function(e){const t=[];for(let r=0;r<this.length;r+=1){const a=this[r].children;for(let r=0;r<a.length;r+=1)e&&!p(a[r]).is(e)||t.push(a[r])}return p(t)},click:h,closest:function(e){let t=this;return void 0===e?p([]):(t.is(e)||(t=t.parents(e).eq(0)),t)},css:function(e,t){const r=o();let a;if(1===arguments.length){if("string"!=typeof e){for(a=0;a<this.length;a+=1)for(const t in e)this[a].style[t]=e[t];return this}if(this[0])return r.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(a=0;a<this.length;a+=1)this[a].style[e]=t;return this}return this},data:function(e,t){let r;if(void 0===t){if(r=this[0],!r)return;if(r.dom7ElementDataStorage&&e in r.dom7ElementDataStorage)return r.dom7ElementDataStorage[e];const t=r.getAttribute(`data-${e}`);return t||void 0}for(let a=0;a<this.length;a+=1)r=this[a],r.dom7ElementDataStorage||(r.dom7ElementDataStorage={}),r.dom7ElementDataStorage[e]=t;return this},dataset:function(){const e=this[0];if(!e)return;const t={};if(e.dataset)for(const r in e.dataset)t[r]=e.dataset[r];else for(let r=0;r<e.attributes.length;r+=1){const a=e.attributes[r];a.name.indexOf("data-")>=0&&(t[c(a.name.split("data-")[1])]=a.value)}for(const e in t)"false"===t[e]?t[e]=!1:"true"===t[e]?t[e]=!0:parseFloat(t[e])===1*t[e]&&(t[e]*=1);return t},default:p,detach:function(){return this.remove()},each:function(e){return e?(this.forEach((t,r)=>{e.apply(t,[t,r])}),this):this},empty:function(){for(let e=0;e<this.length;e+=1){const t=this[e];if(1===t.nodeType){for(let e=0;e<t.childNodes.length;e+=1)t.childNodes[e].parentNode&&t.childNodes[e].parentNode.removeChild(t.childNodes[e]);t.textContent=""}}return this},eq:function(e){if(void 0===e)return this;const t=this.length;if(e>t-1)return p([]);if(e<0){const r=t+e;return p(r<0?[]:[this[r]])}return p([this[e]])},filter:function(e){return p(l(this,e))},find:function(e){const t=[];for(let r=0;r<this.length;r+=1){const a=this[r].querySelectorAll(e);for(let e=0;e<a.length;e+=1)t.push(a[e])}return p(t)},focus:f,focusin:g,focusout:v,hasClass:function(...e){const t=i(e.map(e=>e.split(" ")));return l(this,e=>t.filter(t=>e.classList.contains(t)).length>0).length>0},height:function(){const e=o();return this[0]===e?e.innerHeight:this.length>0?parseFloat(this.css("height")):null},hide:function(){for(let e=0;e<this.length;e+=1)this[e].style.display="none";return this},html:function(e){if(void 0===e)return this[0]?this[0].innerHTML:null;for(let t=0;t<this.length;t+=1)this[t].innerHTML=e;return this},index:function(){let e,t=this[0];if(t){for(e=0;null!==(t=t.previousSibling);)1===t.nodeType&&(e+=1);return e}},insertAfter:function(e){const t=p(e);for(let e=0;e<this.length;e+=1)if(1===t.length)t[0].parentNode.insertBefore(this[e],t[0].nextSibling);else if(t.length>1)for(let r=0;r<t.length;r+=1)t[r].parentNode.insertBefore(this[e].cloneNode(!0),t[r].nextSibling)},insertBefore:function(e){const t=p(e);for(let e=0;e<this.length;e+=1)if(1===t.length)t[0].parentNode.insertBefore(this[e],t[0]);else if(t.length>1)for(let r=0;r<t.length;r+=1)t[r].parentNode.insertBefore(this[e].cloneNode(!0),t[r])},is:function(e){const t=o(),r=a(),s=this[0];let i,l;if(!s||void 0===e)return!1;if("string"==typeof e){if(s.matches)return s.matches(e);if(s.webkitMatchesSelector)return s.webkitMatchesSelector(e);if(s.msMatchesSelector)return s.msMatchesSelector(e);for(i=p(e),l=0;l<i.length;l+=1)if(i[l]===s)return!0;return!1}if(e===r)return s===r;if(e===t)return s===t;if(e.nodeType||e instanceof n){for(i=e.nodeType?[e]:e,l=0;l<i.length;l+=1)if(i[l]===s)return!0;return!1}return!1},keydown:y,keypress:w,keyup:b,mousedown:k,mouseenter:T,mouseleave:S,mousemove:x,mouseout:P,mouseover:M,mouseup:$,next:function(e){return this.length>0?e?this[0].nextElementSibling&&p(this[0].nextElementSibling).is(e)?p([this[0].nextElementSibling]):p([]):this[0].nextElementSibling?p([this[0].nextElementSibling]):p([]):p([])},nextAll:function(e){const t=[];let r=this[0];if(!r)return p([]);for(;r.nextElementSibling;){const a=r.nextElementSibling;e?p(a).is(e)&&t.push(a):t.push(a),r=a}return p(t)},off:function(...e){let[t,r,a,s]=e;"function"==typeof e[1]&&([t,a,s]=e,r=void 0),s||(s=!1);const o=t.split(" ");for(let e=0;e<o.length;e+=1){const t=o[e];for(let e=0;e<this.length;e+=1){const o=this[e];let n;if(!r&&o.dom7Listeners?n=o.dom7Listeners[t]:r&&o.dom7LiveListeners&&(n=o.dom7LiveListeners[t]),n&&n.length)for(let e=n.length-1;e>=0;e-=1){const r=n[e];a&&r.listener===a||a&&r.listener&&r.listener.dom7proxy&&r.listener.dom7proxy===a?(o.removeEventListener(t,r.proxyListener,s),n.splice(e,1)):a||(o.removeEventListener(t,r.proxyListener,s),n.splice(e,1))}}}return this},offset:function(){if(this.length>0){const e=o(),t=a(),r=this[0],s=r.getBoundingClientRect(),n=t.body,i=r.clientTop||n.clientTop||0,l=r.clientLeft||n.clientLeft||0,c=r===e?e.scrollY:r.scrollTop,p=r===e?e.scrollX:r.scrollLeft;return{top:s.top+c-i,left:s.left+p-l}}return null},on:function(...e){let[t,r,a,s]=e;function o(e){const t=e.target;if(!t)return;const s=e.target.dom7EventData||[];if(s.indexOf(e)<0&&s.unshift(e),p(t).is(r))a.apply(t,s);else{const e=p(t).parents();for(let t=0;t<e.length;t+=1)p(e[t]).is(r)&&a.apply(e[t],s)}}function n(e){const t=e&&e.target&&e.target.dom7EventData||[];t.indexOf(e)<0&&t.unshift(e),a.apply(this,t)}"function"==typeof e[1]&&([t,a,s]=e,r=void 0),s||(s=!1);const i=t.split(" ");let l;for(let e=0;e<this.length;e+=1){const t=this[e];if(r)for(l=0;l<i.length;l+=1){const e=i[l];t.dom7LiveListeners||(t.dom7LiveListeners={}),t.dom7LiveListeners[e]||(t.dom7LiveListeners[e]=[]),t.dom7LiveListeners[e].push({listener:a,proxyListener:o}),t.addEventListener(e,o,s)}else for(l=0;l<i.length;l+=1){const e=i[l];t.dom7Listeners||(t.dom7Listeners={}),t.dom7Listeners[e]||(t.dom7Listeners[e]=[]),t.dom7Listeners[e].push({listener:a,proxyListener:n}),t.addEventListener(e,n,s)}}return this},once:function(...e){const t=this;let[r,a,s,o]=e;function n(...e){s.apply(this,e),t.off(r,a,n,o),n.dom7proxy&&delete n.dom7proxy}return"function"==typeof e[1]&&([r,s,o]=e,a=void 0),n.dom7proxy=s,t.on(r,a,n,o)},outerHeight:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},outerWidth:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},parent:function(e){const t=[];for(let r=0;r<this.length;r+=1)null!==this[r].parentNode&&(e?p(this[r].parentNode).is(e)&&t.push(this[r].parentNode):t.push(this[r].parentNode));return p(t)},parents:function(e){const t=[];for(let r=0;r<this.length;r+=1){let a=this[r].parentNode;for(;a;)e?p(a).is(e)&&t.push(a):t.push(a),a=a.parentNode}return p(t)},prepend:function(e){const t=a();let r,s;for(r=0;r<this.length;r+=1)if("string"==typeof e){const a=t.createElement("div");for(a.innerHTML=e,s=a.childNodes.length-1;s>=0;s-=1)this[r].insertBefore(a.childNodes[s],this[r].childNodes[0])}else if(e instanceof n)for(s=0;s<e.length;s+=1)this[r].insertBefore(e[s],this[r].childNodes[0]);else this[r].insertBefore(e,this[r].childNodes[0]);return this},prependTo:function(e){return p(e).prepend(this),this},prev:function(e){if(this.length>0){const t=this[0];return e?t.previousElementSibling&&p(t.previousElementSibling).is(e)?p([t.previousElementSibling]):p([]):t.previousElementSibling?p([t.previousElementSibling]):p([])}return p([])},prevAll:function(e){const t=[];let r=this[0];if(!r)return p([]);for(;r.previousElementSibling;){const a=r.previousElementSibling;e?p(a).is(e)&&t.push(a):t.push(a),r=a}return p(t)},prop:function(e,t){if(1!==arguments.length||"string"!=typeof e){for(let r=0;r<this.length;r+=1)if(2===arguments.length)this[r][e]=t;else for(const t in e)this[r][t]=e[t];return this}return this[0]?this[0][e]:this},remove:function(){for(let e=0;e<this.length;e+=1)this[e].parentNode&&this[e].parentNode.removeChild(this[e]);return this},removeAttr:function(e){for(let t=0;t<this.length;t+=1)this[t].removeAttribute(e);return this},removeClass:function(...e){const t=i(e.map(e=>e.split(" ")));return this.forEach(e=>{e.classList.remove(...t)}),this},removeData:function(e){for(let t=0;t<this.length;t+=1){const r=this[t];r.dom7ElementDataStorage&&r.dom7ElementDataStorage[e]&&(r.dom7ElementDataStorage[e]=null,delete r.dom7ElementDataStorage[e])}},resize:L,scroll:D,scrollLeft:function(...e){let[t,r,a,s]=e;3===e.length&&"function"==typeof a&&([t,r,s,a]=e);const o=this;return void 0===t?o.length>0?o[0].scrollLeft:null:o.scrollTo(t,void 0,r,a,s)},scrollTo:function(...e){const t=o();let[r,a,s,n,i]=e;return 4===e.length&&"function"==typeof n&&(i=n,[r,a,s,i,n]=e),void 0===n&&(n="swing"),this.each(function(){const e=this;let o,l,c,p,d,u,h,m,f=a>0||0===a,g=r>0||0===r;if(void 0===n&&(n="swing"),f&&(o=e.scrollTop,s||(e.scrollTop=a)),g&&(l=e.scrollLeft,s||(e.scrollLeft=r)),!s)return;f&&(c=e.scrollHeight-e.offsetHeight,d=Math.max(Math.min(a,c),0)),g&&(p=e.scrollWidth-e.offsetWidth,u=Math.max(Math.min(r,p),0));let v=null;f&&d===o&&(f=!1),g&&u===l&&(g=!1),t.requestAnimationFrame(function r(a=(new Date).getTime()){null===v&&(v=a);const c=Math.max(Math.min((a-v)/s,1),0),p="linear"===n?c:.5-Math.cos(c*Math.PI)/2;let b;f&&(h=o+p*(d-o)),g&&(m=l+p*(u-l)),f&&d>o&&h>=d&&(e.scrollTop=d,b=!0),f&&d<o&&h<=d&&(e.scrollTop=d,b=!0),g&&u>l&&m>=u&&(e.scrollLeft=u,b=!0),g&&u<l&&m<=u&&(e.scrollLeft=u,b=!0),b?i&&i():(f&&(e.scrollTop=h),g&&(e.scrollLeft=m),t.requestAnimationFrame(r))})})},scrollTop:function(...e){let[t,r,a,s]=e;3===e.length&&"function"==typeof a&&([t,r,s,a]=e);const o=this;return void 0===t?o.length>0?o[0].scrollTop:null:o.scrollTo(void 0,t,r,a,s)},show:function(){const e=o();for(let t=0;t<this.length;t+=1){const r=this[t];"none"===r.style.display&&(r.style.display=""),"none"===e.getComputedStyle(r,null).getPropertyValue("display")&&(r.style.display="block")}return this},siblings:function(e){return this.nextAll(e).add(this.prevAll(e))},stop:function(){const e=this;for(let t=0;t<e.length;t+=1)e[t].dom7AnimateInstance&&e[t].dom7AnimateInstance.stop()},styles:function(){const e=o();return this[0]?e.getComputedStyle(this[0],null):{}},submit:C,text:function(e){if(void 0===e)return this[0]?this[0].textContent.trim():null;for(let t=0;t<this.length;t+=1)this[t].textContent=e;return this},toggleClass:function(...e){const t=i(e.map(e=>e.split(" ")));this.forEach(e=>{t.forEach(t=>{e.classList.toggle(t)})})},touchend:I,touchmove:B,touchstart:O,transform:function(e){for(let t=0;t<this.length;t+=1)this[t].style.transform=e;return this},transition:function(e){for(let t=0;t<this.length;t+=1)this[t].style.transitionDuration="string"!=typeof e?`${e}ms`:e;return this},transitionEnd:function(e){const t=this;return e&&t.on("transitionend",function r(a){a.target===this&&(e.call(this,a),t.off("transitionend",r))}),this},transitionStart:function(e){const t=this;return e&&t.on("transitionstart",function r(a){a.target===this&&(e.call(this,a),t.off("transitionstart",r))}),this},trigger:function(...e){const t=o(),r=e[0].split(" "),a=e[1];for(let s=0;s<r.length;s+=1){const o=r[s];for(let r=0;r<this.length;r+=1){const s=this[r];if(t.CustomEvent){const r=new t.CustomEvent(o,{detail:a,bubbles:!0,cancelable:!0});s.dom7EventData=e.filter((e,t)=>t>0),s.dispatchEvent(r),s.dom7EventData=[],delete s.dom7EventData}}}return this},val:function(e){if(void 0===e){const e=this[0];if(!e)return;if(e.multiple&&"select"===e.nodeName.toLowerCase()){const t=[];for(let r=0;r<e.selectedOptions.length;r+=1)t.push(e.selectedOptions[r].value);return t}return e.value}for(let t=0;t<this.length;t+=1){const r=this[t];if(Array.isArray(e)&&r.multiple&&"select"===r.nodeName.toLowerCase())for(let t=0;t<r.options.length;t+=1)r.options[t].selected=e.indexOf(r.options[t].value)>=0;else r.value=e}return this},value:function(e){return this.val(e)},width:function(){const e=o();return this[0]===e?e.innerWidth:this.length>0?parseFloat(this.css("width")):null}});Object.keys(A).forEach(e=>{"$"!==e&&(p.fn[e]=A[e])});var R=p;function H(e){return null!==e&&"object"==typeof e&&"constructor"in e&&e.constructor===Object}function z(e={},t={}){const r=["__proto__","constructor","prototype"];Object.keys(t).filter(e=>r.indexOf(e)<0).forEach(r=>{void 0===e[r]?e[r]=t[r]:H(t[r])&&H(e[r])&&Object.keys(t[r]).length>0&&z(e[r],t[r])})}const V={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector:()=>null,querySelectorAll:()=>[],getElementById:()=>null,createEvent:()=>({initEvent(){}}),createElement:()=>({children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName:()=>[]}),createElementNS:()=>({}),importNode:()=>null,location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function _(){const e="undefined"!=typeof document?document:{};return z(e,V),e}const F={document:V,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle:()=>({getPropertyValue:()=>""}),Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia:()=>({}),requestAnimationFrame:e=>"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0),cancelAnimationFrame(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function N(){const e="undefined"!=typeof window?window:{};return z(e,F),e}function q(e){return e<0?-1:0===e?0:1}function j(e,t,r){return(1-r)*e+r*t}function Y(e,t,r){return r<e?e:r>t?t:r}function W(e){return(e%=360)<0&&(e+=360),e}function X(e){return(e%=360)<0&&(e+=360),e}function U(e,t){return[e[0]*t[0][0]+e[1]*t[0][1]+e[2]*t[0][2],e[0]*t[1][0]+e[1]*t[1][1]+e[2]*t[1][2],e[0]*t[2][0]+e[1]*t[2][1]+e[2]*t[2][2]]}const G=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],K=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],Q=[95.047,100,108.883];function J(e,t,r){return(255<<24|(255&e)<<16|(255&t)<<8|255&r)>>>0}function Z(e){return J(ie(e[0]),ie(e[1]),ie(e[2]))}function ee(e){return e>>16&255}function te(e){return e>>8&255}function re(e){return 255&e}function ae(e){return 116*le(function(e){return U([ne(ee(e)),ne(te(e)),ne(re(e))],G)}(e)[1]/100)-16}function se(e){return 100*function(e){const t=e*e*e;return t>216/24389?t:(116*e-16)/903.2962962962963}((e+16)/116)}function oe(e){return 116*le(e/100)-16}function ne(e){const t=e/255;return t<=.040449936?t/12.92*100:100*Math.pow((t+.055)/1.055,2.4)}function ie(e){const t=e/100;let r=0;return r=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,a=0,s=255,(o=Math.round(255*r))<a?a:o>s?s:o;var a,s,o}function le(e){return e>216/24389?Math.pow(e,1/3):(903.2962962962963*e+16)/116}class ce{static make(e=function(){return Q}(),t=200/Math.PI*se(50)/100,r=50,a=2,s=!1){const o=e,n=.401288*o[0]+.650173*o[1]+-.051461*o[2],i=-.250268*o[0]+1.204414*o[1]+.045854*o[2],l=-.002079*o[0]+.048952*o[1]+.953127*o[2],c=.8+a/10,p=c>=.9?j(.59,.69,10*(c-.9)):j(.525,.59,10*(c-.8));let d=s?1:c*(1-1/3.6*Math.exp((-t-42)/92));d=d>1?1:d<0?0:d;const u=c,h=[d*(100/n)+1-d,d*(100/i)+1-d,d*(100/l)+1-d],m=1/(5*t+1),f=m*m*m*m,g=1-f,v=f*t+.1*g*g*Math.cbrt(5*t),b=se(r)/e[1],y=1.48+Math.sqrt(b),w=.725/Math.pow(b,.2),C=w,E=[Math.pow(v*h[0]*n/100,.42),Math.pow(v*h[1]*i/100,.42),Math.pow(v*h[2]*l/100,.42)],k=[400*E[0]/(E[0]+27.13),400*E[1]/(E[1]+27.13),400*E[2]/(E[2]+27.13)];return new ce(b,(2*k[0]+k[1]+.05*k[2])*w,w,C,p,u,h,v,Math.pow(v,.25),y)}constructor(e,t,r,a,s,o,n,i,l,c){this.n=e,this.aw=t,this.nbb=r,this.ncb=a,this.c=s,this.nc=o,this.rgbD=n,this.fl=i,this.fLRoot=l,this.z=c}}ce.DEFAULT=ce.make();class pe{constructor(e,t,r,a,s,o,n,i,l){this.hue=e,this.chroma=t,this.j=r,this.q=a,this.m=s,this.s=o,this.jstar=n,this.astar=i,this.bstar=l}distance(e){const t=this.jstar-e.jstar,r=this.astar-e.astar,a=this.bstar-e.bstar,s=Math.sqrt(t*t+r*r+a*a);return 1.41*Math.pow(s,.63)}static fromInt(e){return pe.fromIntInViewingConditions(e,ce.DEFAULT)}static fromIntInViewingConditions(e,t){const r=(65280&e)>>8,a=255&e,s=ne((16711680&e)>>16),o=ne(r),n=ne(a),i=.41233895*s+.35762064*o+.18051042*n,l=.2126*s+.7152*o+.0722*n,c=.01932141*s+.11916382*o+.95034478*n,p=.401288*i+.650173*l-.051461*c,d=-.250268*i+1.204414*l+.045854*c,u=-.002079*i+.048952*l+.953127*c,h=t.rgbD[0]*p,m=t.rgbD[1]*d,f=t.rgbD[2]*u,g=Math.pow(t.fl*Math.abs(h)/100,.42),v=Math.pow(t.fl*Math.abs(m)/100,.42),b=Math.pow(t.fl*Math.abs(f)/100,.42),y=400*q(h)*g/(g+27.13),w=400*q(m)*v/(v+27.13),C=400*q(f)*b/(b+27.13),E=(11*y+-12*w+C)/11,k=(y+w-2*C)/9,x=(20*y+20*w+21*C)/20,$=(40*y+20*w+C)/20,T=180*Math.atan2(k,E)/Math.PI,S=T<0?T+360:T>=360?T-360:T,P=S*Math.PI/180,M=$*t.nbb,O=100*Math.pow(M/t.aw,t.c*t.z),I=4/t.c*Math.sqrt(O/100)*(t.aw+4)*t.fLRoot,B=S<20.14?S+360:S,L=5e4/13*(.25*(Math.cos(B*Math.PI/180+2)+3.8))*t.nc*t.ncb*Math.sqrt(E*E+k*k)/(x+.305),D=Math.pow(L,.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),A=D*Math.sqrt(O/100),R=A*t.fLRoot,H=50*Math.sqrt(D*t.c/(t.aw+4)),z=(1+100*.007)*O/(1+.007*O),V=1/.0228*Math.log(1+.0228*R),_=V*Math.cos(P),F=V*Math.sin(P);return new pe(S,A,O,I,R,H,z,_,F)}static fromJch(e,t,r){return pe.fromJchInViewingConditions(e,t,r,ce.DEFAULT)}static fromJchInViewingConditions(e,t,r,a){const s=4/a.c*Math.sqrt(e/100)*(a.aw+4)*a.fLRoot,o=t*a.fLRoot,n=t/Math.sqrt(e/100),i=50*Math.sqrt(n*a.c/(a.aw+4)),l=r*Math.PI/180,c=(1+100*.007)*e/(1+.007*e),p=1/.0228*Math.log(1+.0228*o),d=p*Math.cos(l),u=p*Math.sin(l);return new pe(r,t,e,s,o,i,c,d,u)}static fromUcs(e,t,r){return pe.fromUcsInViewingConditions(e,t,r,ce.DEFAULT)}static fromUcsInViewingConditions(e,t,r,a){const s=t,o=r,n=Math.sqrt(s*s+o*o),i=(Math.exp(.0228*n)-1)/.0228/a.fLRoot;let l=Math.atan2(o,s)*(180/Math.PI);l<0&&(l+=360);const c=e/(1-.007*(e-100));return pe.fromJchInViewingConditions(c,i,l,a)}toInt(){return this.viewed(ce.DEFAULT)}viewed(e){const t=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),a=this.hue*Math.PI/180,s=.25*(Math.cos(a+2)+3.8),o=e.aw*Math.pow(this.j/100,1/e.c/e.z),n=s*(5e4/13)*e.nc*e.ncb,i=o/e.nbb,l=Math.sin(a),c=Math.cos(a),p=23*(i+.305)*r/(23*n+11*r*c+108*r*l),d=p*c,u=p*l,h=(460*i+451*d+288*u)/1403,m=(460*i-891*d-261*u)/1403,f=(460*i-220*d-6300*u)/1403,g=Math.max(0,27.13*Math.abs(h)/(400-Math.abs(h))),v=q(h)*(100/e.fl)*Math.pow(g,1/.42),b=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),y=q(m)*(100/e.fl)*Math.pow(b,1/.42),w=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=q(f)*(100/e.fl)*Math.pow(w,1/.42),E=v/e.rgbD[0],k=y/e.rgbD[1],x=C/e.rgbD[2];return function(e,t,r){const a=K,s=a[0][0]*e+a[0][1]*t+a[0][2]*r,o=a[1][0]*e+a[1][1]*t+a[1][2]*r,n=a[2][0]*e+a[2][1]*t+a[2][2]*r;return J(ie(s),ie(o),ie(n))}(1.86206786*E-1.01125463*k+.14918677*x,.38752654*E+.62144744*k-.00897398*x,-.0158415*E-.03412294*k+1.04996444*x)}static fromXyzInViewingConditions(e,t,r,a){const s=.401288*e+.650173*t-.051461*r,o=-.250268*e+1.204414*t+.045854*r,n=-.002079*e+.048952*t+.953127*r,i=a.rgbD[0]*s,l=a.rgbD[1]*o,c=a.rgbD[2]*n,p=Math.pow(a.fl*Math.abs(i)/100,.42),d=Math.pow(a.fl*Math.abs(l)/100,.42),u=Math.pow(a.fl*Math.abs(c)/100,.42),h=400*q(i)*p/(p+27.13),m=400*q(l)*d/(d+27.13),f=400*q(c)*u/(u+27.13),g=(11*h+-12*m+f)/11,v=(h+m-2*f)/9,b=(20*h+20*m+21*f)/20,y=(40*h+20*m+f)/20,w=180*Math.atan2(v,g)/Math.PI,C=w<0?w+360:w>=360?w-360:w,E=C*Math.PI/180,k=y*a.nbb,x=100*Math.pow(k/a.aw,a.c*a.z),$=4/a.c*Math.sqrt(x/100)*(a.aw+4)*a.fLRoot,T=C<20.14?C+360:C,S=5e4/13*(1/4*(Math.cos(T*Math.PI/180+2)+3.8))*a.nc*a.ncb*Math.sqrt(g*g+v*v)/(b+.305),P=Math.pow(S,.9)*Math.pow(1.64-Math.pow(.29,a.n),.73),M=P*Math.sqrt(x/100),O=M*a.fLRoot,I=50*Math.sqrt(P*a.c/(a.aw+4)),B=(1+100*.007)*x/(1+.007*x),L=Math.log(1+.0228*O)/.0228,D=L*Math.cos(E),A=L*Math.sin(E);return new pe(C,M,x,$,O,I,B,D,A)}xyzInViewingConditions(e){const t=0===this.chroma||0===this.j?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),a=this.hue*Math.PI/180,s=.25*(Math.cos(a+2)+3.8),o=e.aw*Math.pow(this.j/100,1/e.c/e.z),n=s*(5e4/13)*e.nc*e.ncb,i=o/e.nbb,l=Math.sin(a),c=Math.cos(a),p=23*(i+.305)*r/(23*n+11*r*c+108*r*l),d=p*c,u=p*l,h=(460*i+451*d+288*u)/1403,m=(460*i-891*d-261*u)/1403,f=(460*i-220*d-6300*u)/1403,g=Math.max(0,27.13*Math.abs(h)/(400-Math.abs(h))),v=q(h)*(100/e.fl)*Math.pow(g,1/.42),b=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),y=q(m)*(100/e.fl)*Math.pow(b,1/.42),w=Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),C=q(f)*(100/e.fl)*Math.pow(w,1/.42),E=v/e.rgbD[0],k=y/e.rgbD[1],x=C/e.rgbD[2];return[1.86206786*E-1.01125463*k+.14918677*x,.38752654*E+.62144744*k-.00897398*x,-.0158415*E-.03412294*k+1.04996444*x]}}class de{static sanitizeRadians(e){return(e+8*Math.PI)%(2*Math.PI)}static trueDelinearized(e){const t=e/100;let r=0;return r=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,255*r}static chromaticAdaptation(e){const t=Math.pow(Math.abs(e),.42);return 400*q(e)*t/(t+27.13)}static hueOf(e){const t=U(e,de.SCALED_DISCOUNT_FROM_LINRGB),r=de.chromaticAdaptation(t[0]),a=de.chromaticAdaptation(t[1]),s=de.chromaticAdaptation(t[2]),o=(11*r+-12*a+s)/11,n=(r+a-2*s)/9;return Math.atan2(n,o)}static areInCyclicOrder(e,t,r){return de.sanitizeRadians(t-e)<de.sanitizeRadians(r-e)}static intercept(e,t,r){return(t-e)/(r-e)}static lerpPoint(e,t,r){return[e[0]+(r[0]-e[0])*t,e[1]+(r[1]-e[1])*t,e[2]+(r[2]-e[2])*t]}static setCoordinate(e,t,r,a){const s=de.intercept(e[a],t,r[a]);return de.lerpPoint(e,s,r)}static isBounded(e){return 0<=e&&e<=100}static nthVertex(e,t){const r=de.Y_FROM_LINRGB[0],a=de.Y_FROM_LINRGB[1],s=de.Y_FROM_LINRGB[2],o=t%4<=1?0:100,n=t%2==0?0:100;if(t<4){const t=o,i=n,l=(e-t*a-i*s)/r;return de.isBounded(l)?[l,t,i]:[-1,-1,-1]}if(t<8){const t=o,i=n,l=(e-i*r-t*s)/a;return de.isBounded(l)?[i,l,t]:[-1,-1,-1]}{const t=o,i=n,l=(e-t*r-i*a)/s;return de.isBounded(l)?[t,i,l]:[-1,-1,-1]}}static bisectToSegment(e,t){let r=[-1,-1,-1],a=r,s=0,o=0,n=!1,i=!0;for(let l=0;l<12;l++){const c=de.nthVertex(e,l);if(c[0]<0)continue;const p=de.hueOf(c);n?(i||de.areInCyclicOrder(s,p,o))&&(i=!1,de.areInCyclicOrder(s,t,p)?(a=c,o=p):(r=c,s=p)):(r=c,a=c,s=p,o=p,n=!0)}return[r,a]}static midpoint(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2,(e[2]+t[2])/2]}static criticalPlaneBelow(e){return Math.floor(e-.5)}static criticalPlaneAbove(e){return Math.ceil(e-.5)}static bisectToLimit(e,t){const r=de.bisectToSegment(e,t);let a=r[0],s=de.hueOf(a),o=r[1];for(let e=0;e<3;e++)if(a[e]!==o[e]){let r=-1,n=255;a[e]<o[e]?(r=de.criticalPlaneBelow(de.trueDelinearized(a[e])),n=de.criticalPlaneAbove(de.trueDelinearized(o[e]))):(r=de.criticalPlaneAbove(de.trueDelinearized(a[e])),n=de.criticalPlaneBelow(de.trueDelinearized(o[e])));for(let i=0;i<8&&!(Math.abs(n-r)<=1);i++){const i=Math.floor((r+n)/2),l=de.CRITICAL_PLANES[i],c=de.setCoordinate(a,l,o,e),p=de.hueOf(c);de.areInCyclicOrder(s,t,p)?(o=c,n=i):(a=c,s=p,r=i)}}return de.midpoint(a,o)}static inverseChromaticAdaptation(e){const t=Math.abs(e),r=Math.max(0,27.13*t/(400-t));return q(e)*Math.pow(r,1/.42)}static findResultByJ(e,t,r){let a=11*Math.sqrt(r);const s=ce.DEFAULT,o=1/Math.pow(1.64-Math.pow(.29,s.n),.73),n=.25*(Math.cos(e+2)+3.8)*(5e4/13)*s.nc*s.ncb,i=Math.sin(e),l=Math.cos(e);for(let e=0;e<5;e++){const c=a/100,p=0===t||0===a?0:t/Math.sqrt(c),d=Math.pow(p*o,1/.9),u=s.aw*Math.pow(c,1/s.c/s.z)/s.nbb,h=23*(u+.305)*d/(23*n+11*d*l+108*d*i),m=h*l,f=h*i,g=(460*u+451*m+288*f)/1403,v=(460*u-891*m-261*f)/1403,b=(460*u-220*m-6300*f)/1403,y=U([de.inverseChromaticAdaptation(g),de.inverseChromaticAdaptation(v),de.inverseChromaticAdaptation(b)],de.LINRGB_FROM_SCALED_DISCOUNT);if(y[0]<0||y[1]<0||y[2]<0)return 0;const w=de.Y_FROM_LINRGB[0],C=de.Y_FROM_LINRGB[1],E=de.Y_FROM_LINRGB[2],k=w*y[0]+C*y[1]+E*y[2];if(k<=0)return 0;if(4===e||Math.abs(k-r)<.002)return y[0]>100.01||y[1]>100.01||y[2]>100.01?0:Z(y);a-=(k-r)*a/(2*k)}return 0}static solveToInt(e,t,r){if(t<1e-4||r<1e-4||r>99.9999)return function(e){const t=ie(se(e));return J(t,t,t)}(r);const a=(e=X(e))/180*Math.PI,s=se(r),o=de.findResultByJ(a,t,s);return 0!==o?o:Z(de.bisectToLimit(s,a))}static solveToCam(e,t,r){return pe.fromInt(de.solveToInt(e,t,r))}}de.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],de.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],de.Y_FROM_LINRGB=[.2126,.7152,.0722],de.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];class ue{static from(e,t,r){return new ue(de.solveToInt(e,t,r))}static fromInt(e){return new ue(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(de.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(de.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(de.solveToInt(this.internalHue,this.internalChroma,e))}setValue(e,t){this[e]=t}toString(){return`HCT(${this.hue.toFixed(0)}, ${this.chroma.toFixed(0)}, ${this.tone.toFixed(0)})`}static isBlue(e){return e>=250&&e<270}static isYellow(e){return e>=105&&e<125}static isCyan(e){return e>=170&&e<207}constructor(e){this.argb=e;const t=pe.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=ae(e),this.argb=e}setInternalState(e){const t=pe.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=ae(e),this.argb=e}inViewingConditions(e){const t=pe.fromInt(this.toInt()).xyzInViewingConditions(e),r=pe.fromXyzInViewingConditions(t[0],t[1],t[2],ce.make());return ue.from(r.hue,r.chroma,oe(t[1]))}}class he{static ratioOfTones(e,t){return e=Y(0,100,e),t=Y(0,100,t),he.ratioOfYs(se(e),se(t))}static ratioOfYs(e,t){const r=e>t?e:t;return(r+5)/((r===t?e:t)+5)}static lighter(e,t){if(e<0||e>100)return-1;const r=se(e),a=t*(r+5)-5,s=he.ratioOfYs(a,r),o=Math.abs(s-t);if(s<t&&o>.04)return-1;const n=oe(a)+.4;return n<0||n>100?-1:n}static darker(e,t){if(e<0||e>100)return-1;const r=se(e),a=(r+5)/t-5,s=he.ratioOfYs(r,a),o=Math.abs(s-t);if(s<t&&o>.04)return-1;const n=oe(a)-.4;return n<0||n>100?-1:n}static lighterUnsafe(e,t){const r=he.lighter(e,t);return r<0?100:r}static darkerUnsafe(e,t){const r=he.darker(e,t);return r<0?0:r}}class me{static isDisliked(e){const t=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,r=Math.round(e.chroma)>16,a=Math.round(e.tone)<65;return t&&r&&a}static fixIfDisliked(e){return me.isDisliked(e)?ue.from(e.hue,e.chroma,70):e}}function fe(e,t,r){return function(e,t,r){if(e.name!==r.name)throw new Error(`Attempting to extend color ${e.name} with color ${r.name} of different name for spec version ${t}.`);if(e.isBackground!==r.isBackground)throw new Error(`Attempting to extend color ${e.name} as a ${e.isBackground?"background":"foreground"} with color ${r.name} as a ${r.isBackground?"background":"foreground"} for spec version ${t}.`)}(e,t,r),ge.fromPalette({name:e.name,palette:a=>a.specVersion===t?r.palette(a):e.palette(a),tone:a=>a.specVersion===t?r.tone(a):e.tone(a),isBackground:e.isBackground,chromaMultiplier:a=>{const s=a.specVersion===t?r.chromaMultiplier:e.chromaMultiplier;return void 0!==s?s(a):1},background:a=>{const s=a.specVersion===t?r.background:e.background;return void 0!==s?s(a):void 0},secondBackground:a=>{const s=a.specVersion===t?r.secondBackground:e.secondBackground;return void 0!==s?s(a):void 0},contrastCurve:a=>{const s=a.specVersion===t?r.contrastCurve:e.contrastCurve;return void 0!==s?s(a):void 0},toneDeltaPair:a=>{const s=a.specVersion===t?r.toneDeltaPair:e.toneDeltaPair;return void 0!==s?s(a):void 0}})}class ge{static fromPalette(e){return new ge(e.name??"",e.palette,e.tone??ge.getInitialToneFromBackground(e.background),e.isBackground??!1,e.chromaMultiplier,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)}static getInitialToneFromBackground(e){return void 0===e?e=>50:t=>e(t)?e(t).getTone(t):50}constructor(e,t,r,a,s,o,n,i,l){if(this.name=e,this.palette=t,this.tone=r,this.isBackground=a,this.chromaMultiplier=s,this.background=o,this.secondBackground=n,this.contrastCurve=i,this.toneDeltaPair=l,this.hctCache=new Map,!o&&n)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!o&&i)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(o&&!i)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}clone(){return ge.fromPalette({name:this.name,palette:this.palette,tone:this.tone,isBackground:this.isBackground,chromaMultiplier:this.chromaMultiplier,background:this.background,secondBackground:this.secondBackground,contrastCurve:this.contrastCurve,toneDeltaPair:this.toneDeltaPair})}clearCache(){this.hctCache.clear()}getArgb(e){return this.getHct(e).toInt()}getHct(e){const t=this.hctCache.get(e);if(null!=t)return t;const r=ye(e.specVersion).getHct(e,this);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,r),r}getTone(e){return ye(e.specVersion).getTone(e,this)}static foregroundTone(e,t){const r=he.lighterUnsafe(e,t),a=he.darkerUnsafe(e,t),s=he.ratioOfTones(r,e),o=he.ratioOfTones(a,e);if(ge.tonePrefersLightForeground(e)){const e=Math.abs(s-o)<.1&&s<t&&o<t;return s>=t||s>=o||e?r:a}return o>=t||o>=s?a:r}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return ge.tonePrefersLightForeground(e)&&!ge.toneAllowsLightForeground(e)?49:e}}const ve=new class{getHct(e,t){const r=t.getTone(e);return t.palette(e).getHct(r)}getTone(e,t){const r=e.contrastLevel<0,a=t.toneDeltaPair?t.toneDeltaPair(e):void 0;if(a){const s=a.roleA,o=a.roleB,n=a.delta,i=a.polarity,l=a.stayTogether,c="nearer"===i||"lighter"===i&&!e.isDark||"darker"===i&&e.isDark,p=c?s:o,d=c?o:s,u=t.name===p.name,h=e.isDark?1:-1;let m=p.tone(e),f=d.tone(e);if(t.background&&p.contrastCurve&&d.contrastCurve){const a=t.background(e),s=p.contrastCurve(e),o=d.contrastCurve(e);if(a&&s&&o){const t=a.getTone(e),n=s.get(e.contrastLevel),i=o.get(e.contrastLevel);he.ratioOfTones(t,m)<n&&(m=ge.foregroundTone(t,n)),he.ratioOfTones(t,f)<i&&(f=ge.foregroundTone(t,i)),r&&(m=ge.foregroundTone(t,n),f=ge.foregroundTone(t,i))}}return(f-m)*h<n&&(f=Y(0,100,m+n*h),(f-m)*h>=n||(m=Y(0,100,f-n*h))),50<=m&&m<60?h>0?(m=60,f=Math.max(f,m+n*h)):(m=49,f=Math.min(f,m+n*h)):50<=f&&f<60&&(l?h>0?(m=60,f=Math.max(f,m+n*h)):(m=49,f=Math.min(f,m+n*h)):f=h>0?60:49),u?m:f}{let a=t.tone(e);if(null==t.background||void 0===t.background(e)||null==t.contrastCurve||void 0===t.contrastCurve(e))return a;const s=t.background(e).getTone(e),o=t.contrastCurve(e).get(e.contrastLevel);if(he.ratioOfTones(s,a)>=o||(a=ge.foregroundTone(s,o)),r&&(a=ge.foregroundTone(s,o)),t.isBackground&&50<=a&&a<60&&(a=he.ratioOfTones(49,s)>=o?49:60),null==t.secondBackground||void 0===t.secondBackground(e))return a;const[n,i]=[t.background,t.secondBackground],[l,c]=[n(e).getTone(e),i(e).getTone(e)],[p,d]=[Math.max(l,c),Math.min(l,c)];if(he.ratioOfTones(p,a)>=o&&he.ratioOfTones(d,a)>=o)return a;const u=he.lighter(p,o),h=he.darker(d,o),m=[];return-1!==u&&m.push(u),-1!==h&&m.push(h),ge.tonePrefersLightForeground(l)||ge.tonePrefersLightForeground(c)?u<0?100:u:1===m.length?m[0]:h<0?0:h}}},be=new class{getHct(e,t){const r=t.palette(e),a=t.getTone(e),s=r.hue,o=r.chroma*(t.chromaMultiplier?t.chromaMultiplier(e):1);return ue.from(s,o,a)}getTone(e,t){const r=t.toneDeltaPair?t.toneDeltaPair(e):void 0;if(r){const a=r.roleA,s=r.roleB,o=r.polarity,n=r.constraint,i="darker"===o||"relative_lighter"===o&&e.isDark||"relative_darker"===o&&!e.isDark?-r.delta:r.delta,l=t.name===a.name,c=l?s:a;let p=(l?a:s).tone(e),d=c.getTone(e);const u=i*(l?1:-1);if("exact"===n?p=Y(0,100,d+u):"nearer"===n?p=Y(0,100,u>0?Y(d,d+u,p):Y(d+u,d,p)):"farther"===n&&(p=u>0?Y(d+u,100,p):Y(0,d+u,p)),t.background&&t.contrastCurve){const r=t.background(e),a=t.contrastCurve(e);if(r&&a){const t=r.getTone(e),s=a.get(e.contrastLevel);p=he.ratioOfTones(t,p)>=s&&e.contrastLevel>=0?p:ge.foregroundTone(t,s)}}return t.isBackground&&!t.name.endsWith("_fixed_dim")&&(p=p>=57?Y(65,100,p):Y(0,49,p)),p}{let r=t.tone(e);if(null==t.background||void 0===t.background(e)||null==t.contrastCurve||void 0===t.contrastCurve(e))return r;const a=t.background(e).getTone(e),s=t.contrastCurve(e).get(e.contrastLevel);if(r=he.ratioOfTones(a,r)>=s&&e.contrastLevel>=0?r:ge.foregroundTone(a,s),t.isBackground&&!t.name.endsWith("_fixed_dim")&&(r=r>=57?Y(65,100,r):Y(0,49,r)),null==t.secondBackground||void 0===t.secondBackground(e))return r;const[o,n]=[t.background,t.secondBackground],[i,l]=[o(e).getTone(e),n(e).getTone(e)],[c,p]=[Math.max(i,l),Math.min(i,l)];if(he.ratioOfTones(c,r)>=s&&he.ratioOfTones(p,r)>=s)return r;const d=he.lighter(c,s),u=he.darker(p,s),h=[];return-1!==d&&h.push(d),-1!==u&&h.push(u),ge.tonePrefersLightForeground(i)||ge.tonePrefersLightForeground(l)?d<0?100:d:1===h.length?h[0]:u<0?0:u}}};function ye(e){return"2025"===e?be:ve}class we{static fromInt(e){const t=ue.fromInt(e);return we.fromHct(t)}static fromHct(e){return new we(e.hue,e.chroma,e)}static fromHueAndChroma(e,t){const r=new Ce(e,t).create();return new we(e,t,r)}constructor(e,t,r){this.hue=e,this.chroma=t,this.keyColor=r,this.cache=new Map}tone(e){let t=this.cache.get(e);return void 0===t&&(t=99==e&&ue.isYellow(this.hue)?this.averageArgb(this.tone(98),this.tone(100)):ue.from(this.hue,this.chroma,e).toInt(),this.cache.set(e,t)),t}getHct(e){return ue.fromInt(this.tone(e))}averageArgb(e,t){const r=e>>>16&255,a=e>>>8&255,s=255&e,o=t>>>16&255,n=t>>>8&255,i=255&t;return(255<<24|(255&Math.round((r+o)/2))<<16|(255&Math.round((a+n)/2))<<8|255&Math.round((s+i)/2))>>>0}}class Ce{constructor(e,t){this.hue=e,this.requestedChroma=t,this.chromaCache=new Map,this.maxChromaValue=200}create(){let e=0,t=100;for(;e<t;){const r=Math.floor((e+t)/2),a=this.maxChroma(r)<this.maxChroma(r+1);if(this.maxChroma(r)>=this.requestedChroma-.01)if(Math.abs(e-50)<Math.abs(t-50))t=r;else{if(e===r)return ue.from(this.hue,this.requestedChroma,e);e=r}else a?e=r+1:t=r}return ue.from(this.hue,this.requestedChroma,e)}maxChroma(e){if(this.chromaCache.has(e))return this.chromaCache.get(e);const t=ue.from(this.hue,this.maxChromaValue,e).chroma;return this.chromaCache.set(e,t),t}}class Ee{constructor(e){this.input=e,this.hctsByTempCache=[],this.hctsByHueCache=[],this.tempsByHctCache=new Map,this.inputRelativeTemperatureCache=-1,this.complementCache=null}get hctsByTemp(){if(this.hctsByTempCache.length>0)return this.hctsByTempCache;const e=this.hctsByHue.concat([this.input]),t=this.tempsByHct;return e.sort((e,r)=>t.get(e)-t.get(r)),this.hctsByTempCache=e,e}get warmest(){return this.hctsByTemp[this.hctsByTemp.length-1]}get coldest(){return this.hctsByTemp[0]}analogous(e=5,t=12){const r=Math.round(this.input.hue),a=this.hctsByHue[r];let s=this.relativeTemperature(a);const o=[a];let n=0;for(let e=0;e<360;e++){const t=W(r+e),a=this.hctsByHue[t],o=this.relativeTemperature(a),i=Math.abs(o-s);s=o,n+=i}let i=1;const l=n/t;let c=0;for(s=this.relativeTemperature(a);o.length<t;){const e=W(r+i),a=this.hctsByHue[e],n=this.relativeTemperature(a);c+=Math.abs(n-s);let p=c>=o.length*l,d=1;for(;p&&o.length<t;)o.push(a),p=c>=(o.length+d)*l,d++;if(s=n,i++,i>360){for(;o.length<t;)o.push(a);break}}const p=[this.input],d=Math.floor((e-1)/2);for(let e=1;e<d+1;e++){let t=0-e;for(;t<0;)t=o.length+t;t>=o.length&&(t%=o.length),p.splice(0,0,o[t])}const u=e-d-1;for(let e=1;e<u+1;e++){let t=e;for(;t<0;)t=o.length+t;t>=o.length&&(t%=o.length),p.push(o[t])}return p}get complement(){if(null!=this.complementCache)return this.complementCache;const e=this.coldest.hue,t=this.tempsByHct.get(this.coldest),r=this.warmest.hue,a=this.tempsByHct.get(this.warmest)-t,s=Ee.isBetween(this.input.hue,e,r),o=s?r:e,n=s?e:r;let i=1e3,l=this.hctsByHue[Math.round(this.input.hue)];const c=1-this.inputRelativeTemperature;for(let e=0;e<=360;e+=1){const r=X(o+1*e);if(!Ee.isBetween(r,o,n))continue;const s=this.hctsByHue[Math.round(r)],p=(this.tempsByHct.get(s)-t)/a,d=Math.abs(c-p);d<i&&(i=d,l=s)}return this.complementCache=l,this.complementCache}relativeTemperature(e){const t=this.tempsByHct.get(this.warmest)-this.tempsByHct.get(this.coldest),r=this.tempsByHct.get(e)-this.tempsByHct.get(this.coldest);return 0===t?.5:r/t}get inputRelativeTemperature(){return this.inputRelativeTemperatureCache>=0||(this.inputRelativeTemperatureCache=this.relativeTemperature(this.input)),this.inputRelativeTemperatureCache}get tempsByHct(){if(this.tempsByHctCache.size>0)return this.tempsByHctCache;const e=this.hctsByHue.concat([this.input]),t=new Map;for(const r of e)t.set(r,Ee.rawTemperature(r));return this.tempsByHctCache=t,t}get hctsByHue(){if(this.hctsByHueCache.length>0)return this.hctsByHueCache;const e=[];for(let t=0;t<=360;t+=1){const r=ue.from(t,this.input.chroma,this.input.tone);e.push(r)}return this.hctsByHueCache=e,this.hctsByHueCache}static isBetween(e,t,r){return t<r?t<=e&&e<=r:t<=e||e<=r}static rawTemperature(e){const t=function(e){const t=ne(ee(e)),r=ne(te(e)),a=ne(re(e)),s=G,o=s[0][0]*t+s[0][1]*r+s[0][2]*a,n=s[1][0]*t+s[1][1]*r+s[1][2]*a,i=s[2][0]*t+s[2][1]*r+s[2][2]*a,l=n/Q[1],c=i/Q[2],p=le(o/Q[0]),d=le(l);return[116*d-16,500*(p-d),200*(d-le(c))]}(e.toInt()),r=X(180*Math.atan2(t[2],t[1])/Math.PI),a=Math.sqrt(t[1]*t[1]+t[2]*t[2]);return.02*Math.pow(a,1.07)*Math.cos(X(r-50)*Math.PI/180)-.5}}class ke{constructor(e,t,r,a){this.low=e,this.normal=t,this.medium=r,this.high=a}get(e){return e<=-1?this.low:e<0?j(this.low,this.normal,(e- -1)/1):e<.5?j(this.normal,this.medium,(e-0)/.5):e<1?j(this.medium,this.high,(e-.5)/.5):this.high}}class xe{constructor(e,t,r,a,s,o){this.roleA=e,this.roleB=t,this.delta=r,this.polarity=a,this.stayTogether=s,this.constraint=o,this.constraint=o??"exact"}}var $e;function Te(e){return e.variant===$e.FIDELITY||e.variant===$e.CONTENT}function Se(e){return e.variant===$e.MONOCHROME}!function(e){e[e.MONOCHROME=0]="MONOCHROME",e[e.NEUTRAL=1]="NEUTRAL",e[e.TONAL_SPOT=2]="TONAL_SPOT",e[e.VIBRANT=3]="VIBRANT",e[e.EXPRESSIVE=4]="EXPRESSIVE",e[e.FIDELITY=5]="FIDELITY",e[e.CONTENT=6]="CONTENT",e[e.RAINBOW=7]="RAINBOW",e[e.FRUIT_SALAD=8]