"use strict";var ColorPicker=function(){"use strict";var De=Object.defineProperty,Me=(r,t,e)=>t in r?De(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,b=(r,t,e)=>Me(r,typeof t!="symbol"?t+"":t,e);function je(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var At={exports:{}},Q=typeof Reflect=="object"?Reflect:null,Vt=Q&&typeof Q.apply=="function"?Q.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},vt;Q&&typeof Q.ownKeys=="function"?vt=Q.ownKeys:Object.getOwnPropertySymbols?vt=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:vt=function(t){return Object.getOwnPropertyNames(t)};function Re(r){console&&console.warn&&console.warn(r)}var Xt=Number.isNaN||function(t){return t!==t};function m(){m.init.call(this)}At.exports=m,At.exports.once=Be,m.EventEmitter=m,m.prototype._events=void 0,m.prototype._eventsCount=0,m.prototype._maxListeners=void 0;var Yt=10;function gt(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(m,"defaultMaxListeners",{enumerable:!0,get:function(){return Yt},set:function(r){if(typeof r!="number"||r<0||Xt(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");Yt=r}}),m.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},m.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Xt(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Ut(r){return r._maxListeners===void 0?m.defaultMaxListeners:r._maxListeners}m.prototype.getMaxListeners=function(){return Ut(this)},m.prototype.emit=function(t){for(var e=[],i=1;i0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[t];if(l===void 0)return!1;if(typeof l=="function")Vt(l,this,e);else for(var u=l.length,c=Jt(l,u),i=0;i0&&s.length>n&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=r,a.type=t,a.count=s.length,Re(a)}return r}m.prototype.addListener=function(t,e){return Kt(this,t,e,!1)},m.prototype.on=m.prototype.addListener,m.prototype.prependListener=function(t,e){return Kt(this,t,e,!0)};function Te(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function zt(r,t,e){var i={fired:!1,wrapFn:void 0,target:r,type:t,listener:e},n=Te.bind(i);return n.listener=e,i.wrapFn=n,n}m.prototype.once=function(t,e){return gt(e),this.on(t,zt(this,t,e)),this},m.prototype.prependOnceListener=function(t,e){return gt(e),this.prependListener(t,zt(this,t,e)),this},m.prototype.removeListener=function(t,e){var i,n,o,s,a;if(gt(e),n=this._events,n===void 0)return this;if(i=n[t],i===void 0)return this;if(i===e||i.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,i.listener||e));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===e||i[s].listener===e){a=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():He(i,o),i.length===1&&(n[t]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",t,a||e)}return this},m.prototype.off=m.prototype.removeListener,m.prototype.removeAllListeners=function(t){var e,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var o=Object.keys(i),s;for(n=0;n=0;n--)this.removeListener(t,e[n]);return this};function Zt(r,t,e){var i=r._events;if(i===void 0)return[];var n=i[t];return n===void 0?[]:typeof n=="function"?e?[n.listener||n]:[n]:e?Ne(n):Jt(n,n.length)}m.prototype.listeners=function(t){return Zt(this,t,!0)},m.prototype.rawListeners=function(t){return Zt(this,t,!1)},m.listenerCount=function(r,t){return typeof r.listenerCount=="function"?r.listenerCount(t):Gt.call(r,t)},m.prototype.listenerCount=Gt;function Gt(r){var t=this._events;if(t!==void 0){var e=t[r];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}m.prototype.eventNames=function(){return this._eventsCount>0?vt(this._events):[]};function Jt(r,t){for(var e=new Array(t),i=0;i"u")return!1;var t=M(r).ShadowRoot;return r instanceof t||r instanceof ShadowRoot}function tr(r){var t=r.state;Object.keys(t.elements).forEach(function(e){var i=t.styles[e]||{},n=t.attributes[e]||{},o=t.elements[e];!H(o)||!I(o)||(Object.assign(o.style,i),Object.keys(n).forEach(function(s){var a=n[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function er(r){var t=r.state,e={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,e.popper),t.styles=e,t.elements.arrow&&Object.assign(t.elements.arrow.style,e.arrow),function(){Object.keys(t.elements).forEach(function(i){var n=t.elements[i],o=t.attributes[i]||{},s=Object.keys(t.styles.hasOwnProperty(i)?t.styles[i]:e[i]),a=s.reduce(function(l,u){return l[u]="",l},{});!H(n)||!I(n)||(Object.assign(n.style,a),Object.keys(o).forEach(function(l){n.removeAttribute(l)}))})}}const rr={name:"applyStyles",enabled:!0,phase:"write",fn:tr,effect:er,requires:["computeStyles"]};function W(r){return r.split("-")[0]}var U=Math.max,mt=Math.min,et=Math.round;function kt(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function ne(){return!/^((?!chrome|android).)*safari/i.test(kt())}function rt(r,t,e){t===void 0&&(t=!1),e===void 0&&(e=!1);var i=r.getBoundingClientRect(),n=1,o=1;t&&H(r)&&(n=r.offsetWidth>0&&et(i.width)/r.offsetWidth||1,o=r.offsetHeight>0&&et(i.height)/r.offsetHeight||1);var s=Y(r)?M(r):window,a=s.visualViewport,l=!ne()&&e,u=(i.left+(l&&a?a.offsetLeft:0))/n,c=(i.top+(l&&a?a.offsetTop:0))/o,h=i.width/n,g=i.height/o;return{width:h,height:g,top:c,right:u+h,bottom:c+g,left:u,x:u,y:c}}function Dt(r){var t=rt(r),e=r.offsetWidth,i=r.offsetHeight;return Math.abs(t.width-e)<=1&&(e=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:r.offsetLeft,y:r.offsetTop,width:e,height:i}}function oe(r,t){var e=t.getRootNode&&t.getRootNode();if(r.contains(t))return!0;if(e&&Pt(e)){var i=t;do{if(i&&r.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function q(r){return M(r).getComputedStyle(r)}function ir(r){return["table","td","th"].indexOf(I(r))>=0}function V(r){return((Y(r)?r.ownerDocument:r.document)||window.document).documentElement}function yt(r){return I(r)==="html"?r:r.assignedSlot||r.parentNode||(Pt(r)?r.host:null)||V(r)}function se(r){return!H(r)||q(r).position==="fixed"?null:r.offsetParent}function nr(r){var t=/firefox/i.test(kt()),e=/Trident/i.test(kt());if(e&&H(r)){var i=q(r);if(i.position==="fixed")return null}var n=yt(r);for(Pt(n)&&(n=n.host);H(n)&&["html","body"].indexOf(I(n))<0;){var o=q(n);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return n;n=n.parentNode}return null}function ct(r){for(var t=M(r),e=se(r);e&&ir(e)&&q(e).position==="static";)e=se(e);return e&&(I(e)==="html"||I(e)==="body"&&q(e).position==="static")?t:e||nr(r)||t}function Mt(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function ut(r,t,e){return U(r,mt(t,e))}function or(r,t,e){var i=ut(r,t,e);return i>e?e:i}function ae(){return{top:0,right:0,bottom:0,left:0}}function le(r){return Object.assign({},ae(),r)}function ce(r,t){return t.reduce(function(e,i){return e[i]=r,e},{})}var sr=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,le(typeof t!="number"?t:ce(t,st))};function ar(r){var t,e=r.state,i=r.name,n=r.options,o=e.elements.arrow,s=e.modifiersData.popperOffsets,a=W(e.placement),l=Mt(a),u=[D,T].indexOf(a)>=0,c=u?"height":"width";if(!(!o||!s)){var h=sr(n.padding,e),g=Dt(o),p=l==="y"?k:D,$=l==="y"?R:T,v=e.rects.reference[c]+e.rects.reference[l]-s[l]-e.rects.popper[c],d=s[l]-e.rects.reference[l],x=ct(o),O=x?l==="y"?x.clientHeight||0:x.clientWidth||0:0,L=v/2-d/2,f=h[p],y=O-g[c]-h[$],w=O/2-g[c]/2+L,_=ut(f,w,y),A=l;e.modifiersData[i]=(t={},t[A]=_,t.centerOffset=_-w,t)}}function lr(r){var t=r.state,e=r.options,i=e.element,n=i===void 0?"[data-popper-arrow]":i;n!=null&&(typeof n=="string"&&(n=t.elements.popper.querySelector(n),!n)||oe(t.elements.popper,n)&&(t.elements.arrow=n))}const cr={name:"arrow",enabled:!0,phase:"main",fn:ar,effect:lr,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function it(r){return r.split("-")[1]}var ur={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pr(r,t){var e=r.x,i=r.y,n=t.devicePixelRatio||1;return{x:et(e*n)/n||0,y:et(i*n)/n||0}}function ue(r){var t,e=r.popper,i=r.popperRect,n=r.placement,o=r.variation,s=r.offsets,a=r.position,l=r.gpuAcceleration,u=r.adaptive,c=r.roundOffsets,h=r.isFixed,g=s.x,p=g===void 0?0:g,$=s.y,v=$===void 0?0:$,d=typeof c=="function"?c({x:p,y:v}):{x:p,y:v};p=d.x,v=d.y;var x=s.hasOwnProperty("x"),O=s.hasOwnProperty("y"),L=D,f=k,y=window;if(u){var w=ct(e),_="clientHeight",A="clientWidth";if(w===M(e)&&(w=V(e),q(w).position!=="static"&&a==="absolute"&&(_="scrollHeight",A="scrollWidth")),w=w,n===k||(n===D||n===T)&&o===at){f=R;var E=h&&w===y&&y.visualViewport?y.visualViewport.height:w[_];v-=E-i.height,v*=l?1:-1}if(n===D||(n===k||n===R)&&o===at){L=T;var C=h&&w===y&&y.visualViewport?y.visualViewport.width:w[A];p-=C-i.width,p*=l?1:-1}}var S=Object.assign({position:a},u&&ur),N=c===!0?pr({x:p,y:v},M(e)):{x:p,y:v};if(p=N.x,v=N.y,l){var P;return Object.assign({},S,(P={},P[f]=O?"0":"",P[L]=x?"0":"",P.transform=(y.devicePixelRatio||1)<=1?"translate("+p+"px, "+v+"px)":"translate3d("+p+"px, "+v+"px, 0)",P))}return Object.assign({},S,(t={},t[f]=O?v+"px":"",t[L]=x?p+"px":"",t.transform="",t))}function fr(r){var t=r.state,e=r.options,i=e.gpuAcceleration,n=i===void 0?!0:i,o=e.adaptive,s=o===void 0?!0:o,a=e.roundOffsets,l=a===void 0?!0:a,u={placement:W(t.placement),variation:it(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,ue(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,ue(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const hr={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:fr,data:{}};var wt={passive:!0};function dr(r){var t=r.state,e=r.instance,i=r.options,n=i.scroll,o=n===void 0?!0:n,s=i.resize,a=s===void 0?!0:s,l=M(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(c){c.addEventListener("scroll",e.update,wt)}),a&&l.addEventListener("resize",e.update,wt),function(){o&&u.forEach(function(c){c.removeEventListener("scroll",e.update,wt)}),a&&l.removeEventListener("resize",e.update,wt)}}const vr={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:dr,data:{}};var gr={left:"right",right:"left",bottom:"top",top:"bottom"};function bt(r){return r.replace(/left|right|bottom|top/g,function(t){return gr[t]})}var mr={start:"end",end:"start"};function pe(r){return r.replace(/start|end/g,function(t){return mr[t]})}function jt(r){var t=M(r),e=t.pageXOffset,i=t.pageYOffset;return{scrollLeft:e,scrollTop:i}}function Rt(r){return rt(V(r)).left+jt(r).scrollLeft}function yr(r,t){var e=M(r),i=V(r),n=e.visualViewport,o=i.clientWidth,s=i.clientHeight,a=0,l=0;if(n){o=n.width,s=n.height;var u=ne();(u||!u&&t==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:o,height:s,x:a+Rt(r),y:l}}function wr(r){var t,e=V(r),i=jt(r),n=(t=r.ownerDocument)==null?void 0:t.body,o=U(e.scrollWidth,e.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),s=U(e.scrollHeight,e.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),a=-i.scrollLeft+Rt(r),l=-i.scrollTop;return q(n||e).direction==="rtl"&&(a+=U(e.clientWidth,n?n.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function Tt(r){var t=q(r),e=t.overflow,i=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(e+n+i)}function fe(r){return["html","body","#document"].indexOf(I(r))>=0?r.ownerDocument.body:H(r)&&Tt(r)?r:fe(yt(r))}function pt(r,t){var e;t===void 0&&(t=[]);var i=fe(r),n=i===((e=r.ownerDocument)==null?void 0:e.body),o=M(i),s=n?[o].concat(o.visualViewport||[],Tt(i)?i:[]):i,a=t.concat(s);return n?a:a.concat(pt(yt(s)))}function Ht(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function br(r,t){var e=rt(r,!1,t==="fixed");return e.top=e.top+r.clientTop,e.left=e.left+r.clientLeft,e.bottom=e.top+r.clientHeight,e.right=e.left+r.clientWidth,e.width=r.clientWidth,e.height=r.clientHeight,e.x=e.left,e.y=e.top,e}function he(r,t,e){return t===ee?Ht(yr(r,e)):Y(t)?br(t,e):Ht(wr(V(r)))}function xr(r){var t=pt(yt(r)),e=["absolute","fixed"].indexOf(q(r).position)>=0,i=e&&H(r)?ct(r):r;return Y(i)?t.filter(function(n){return Y(n)&&oe(n,i)&&I(n)!=="body"}):[]}function $r(r,t,e,i){var n=t==="clippingParents"?xr(r):[].concat(t),o=[].concat(n,[e]),s=o[0],a=o.reduce(function(l,u){var c=he(r,u,i);return l.top=U(c.top,l.top),l.right=mt(c.right,l.right),l.bottom=mt(c.bottom,l.bottom),l.left=U(c.left,l.left),l},he(r,s,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function de(r){var t=r.reference,e=r.element,i=r.placement,n=i?W(i):null,o=i?it(i):null,s=t.x+t.width/2-e.width/2,a=t.y+t.height/2-e.height/2,l;switch(n){case k:l={x:s,y:t.y-e.height};break;case R:l={x:s,y:t.y+t.height};break;case T:l={x:t.x+t.width,y:a};break;case D:l={x:t.x-e.width,y:a};break;default:l={x:t.x,y:t.y}}var u=n?Mt(n):null;if(u!=null){var c=u==="y"?"height":"width";switch(o){case tt:l[u]=l[u]-(t[c]/2-e[c]/2);break;case at:l[u]=l[u]+(t[c]/2-e[c]/2);break}}return l}function ft(r,t){t===void 0&&(t={});var e=t,i=e.placement,n=i===void 0?r.placement:i,o=e.strategy,s=o===void 0?r.strategy:o,a=e.boundary,l=a===void 0?Fe:a,u=e.rootBoundary,c=u===void 0?ee:u,h=e.elementContext,g=h===void 0?lt:h,p=e.altBoundary,$=p===void 0?!1:p,v=e.padding,d=v===void 0?0:v,x=le(typeof d!="number"?d:ce(d,st)),O=g===lt?qe:lt,L=r.rects.popper,f=r.elements[$?O:g],y=$r(Y(f)?f:f.contextElement||V(r.elements.popper),l,c,s),w=rt(r.elements.reference),_=de({reference:w,element:L,strategy:"absolute",placement:n}),A=Ht(Object.assign({},L,_)),E=g===lt?A:w,C={top:y.top-E.top+x.top,bottom:E.bottom-y.bottom+x.bottom,left:y.left-E.left+x.left,right:E.right-y.right+x.right},S=r.modifiersData.offset;if(g===lt&&S){var N=S[n];Object.keys(C).forEach(function(P){var K=[T,R].indexOf(P)>=0?1:-1,z=[k,R].indexOf(P)>=0?"y":"x";C[P]+=N[z]*K})}return C}function _r(r,t){t===void 0&&(t={});var e=t,i=e.placement,n=e.boundary,o=e.rootBoundary,s=e.padding,a=e.flipVariations,l=e.allowedAutoPlacements,u=l===void 0?ie:l,c=it(i),h=c?a?re:re.filter(function($){return it($)===c}):st,g=h.filter(function($){return u.indexOf($)>=0});g.length===0&&(g=h);var p=g.reduce(function($,v){return $[v]=ft(r,{placement:v,boundary:n,rootBoundary:o,padding:s})[W(v)],$},{});return Object.keys(p).sort(function($,v){return p[$]-p[v]})}function Or(r){if(W(r)===St)return[];var t=bt(r);return[pe(r),t,pe(t)]}function Lr(r){var t=r.state,e=r.options,i=r.name;if(!t.modifiersData[i]._skip){for(var n=e.mainAxis,o=n===void 0?!0:n,s=e.altAxis,a=s===void 0?!0:s,l=e.fallbackPlacements,u=e.padding,c=e.boundary,h=e.rootBoundary,g=e.altBoundary,p=e.flipVariations,$=p===void 0?!0:p,v=e.allowedAutoPlacements,d=t.options.placement,x=W(d),O=x===d,L=l||(O||!$?[bt(d)]:Or(d)),f=[d].concat(L).reduce(function(ot,X){return ot.concat(W(X)===St?_r(t,{placement:X,boundary:c,rootBoundary:h,padding:u,flipVariations:$,allowedAutoPlacements:v}):X)},[]),y=t.rects.reference,w=t.rects.popper,_=new Map,A=!0,E=f[0],C=0;C=0,z=K?"width":"height",j=ft(t,{placement:S,boundary:c,rootBoundary:h,altBoundary:g,padding:u}),B=K?P?T:D:P?R:k;y[z]>w[z]&&(B=bt(B));var _t=bt(B),Z=[];if(o&&Z.push(j[N]<=0),a&&Z.push(j[B]<=0,j[_t]<=0),Z.every(function(ot){return ot})){E=S,A=!1;break}_.set(S,Z)}if(A)for(var Ot=$?3:1,It=function(X){var dt=f.find(function(Ct){var G=_.get(Ct);if(G)return G.slice(0,X).every(function(Wt){return Wt})});if(dt)return E=dt,"break"},ht=Ot;ht>0;ht--){var Lt=It(ht);if(Lt==="break")break}t.placement!==E&&(t.modifiersData[i]._skip=!0,t.placement=E,t.reset=!0)}}const Cr={name:"flip",enabled:!0,phase:"main",fn:Lr,requiresIfExists:["offset"],data:{_skip:!1}};function ve(r,t,e){return e===void 0&&(e={x:0,y:0}),{top:r.top-t.height-e.y,right:r.right-t.width+e.x,bottom:r.bottom-t.height+e.y,left:r.left-t.width-e.x}}function ge(r){return[k,T,R,D].some(function(t){return r[t]>=0})}function Er(r){var t=r.state,e=r.name,i=t.rects.reference,n=t.rects.popper,o=t.modifiersData.preventOverflow,s=ft(t,{elementContext:"reference"}),a=ft(t,{altBoundary:!0}),l=ve(s,i),u=ve(a,n,o),c=ge(l),h=ge(u);t.modifiersData[e]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":h})}const Ar={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Er};function Sr(r,t,e){var i=W(r),n=[D,k].indexOf(i)>=0?-1:1,o=typeof e=="function"?e(Object.assign({},t,{placement:r})):e,s=o[0],a=o[1];return s=s||0,a=(a||0)*n,[D,T].indexOf(i)>=0?{x:a,y:s}:{x:s,y:a}}function Pr(r){var t=r.state,e=r.options,i=r.name,n=e.offset,o=n===void 0?[0,0]:n,s=ie.reduce(function(c,h){return c[h]=Sr(h,t.rects,o),c},{}),a=s[t.placement],l=a.x,u=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[i]=s}const kr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Pr};function Dr(r){var t=r.state,e=r.name;t.modifiersData[e]=de({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Mr={name:"popperOffsets",enabled:!0,phase:"read",fn:Dr,data:{}};function jr(r){return r==="x"?"y":"x"}function Rr(r){var t=r.state,e=r.options,i=r.name,n=e.mainAxis,o=n===void 0?!0:n,s=e.altAxis,a=s===void 0?!1:s,l=e.boundary,u=e.rootBoundary,c=e.altBoundary,h=e.padding,g=e.tether,p=g===void 0?!0:g,$=e.tetherOffset,v=$===void 0?0:$,d=ft(t,{boundary:l,rootBoundary:u,padding:h,altBoundary:c}),x=W(t.placement),O=it(t.placement),L=!O,f=Mt(x),y=jr(f),w=t.modifiersData.popperOffsets,_=t.rects.reference,A=t.rects.popper,E=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,C=typeof E=="number"?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),S=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,N={x:0,y:0};if(w){if(o){var P,K=f==="y"?k:D,z=f==="y"?R:T,j=f==="y"?"height":"width",B=w[f],_t=B+d[K],Z=B-d[z],Ot=p?-A[j]/2:0,It=O===tt?_[j]:A[j],ht=O===tt?-A[j]:-_[j],Lt=t.elements.arrow,ot=p&&Lt?Dt(Lt):{width:0,height:0},X=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:ae(),dt=X[K],Ct=X[z],G=ut(0,_[j],ot[j]),Wt=L?_[j]/2-Ot-G-dt-C.mainAxis:It-G-dt-C.mainAxis,oi=L?-_[j]/2+Ot+G+Ct+C.mainAxis:ht+G+Ct+C.mainAxis,Ft=t.elements.arrow&&ct(t.elements.arrow),si=Ft?f==="y"?Ft.clientTop||0:Ft.clientLeft||0:0,_e=(P=S?.[f])!=null?P:0,ai=B+Wt-_e-si,li=B+oi-_e,Oe=ut(p?mt(_t,ai):_t,B,p?U(Z,li):Z);w[f]=Oe,N[f]=Oe-B}if(a){var Le,ci=f==="x"?k:D,ui=f==="x"?R:T,J=w[y],Et=y==="y"?"height":"width",Ce=J+d[ci],Ee=J-d[ui],qt=[k,D].indexOf(x)!==-1,Ae=(Le=S?.[y])!=null?Le:0,Se=qt?Ce:J-_[Et]-A[Et]-Ae+C.altAxis,Pe=qt?J+_[Et]+A[Et]-Ae-C.altAxis:Ee,ke=p&&qt?or(Se,J,Pe):ut(p?Se:Ce,J,p?Pe:Ee);w[y]=ke,N[y]=ke-J}t.modifiersData[i]=N}}const Tr={name:"preventOverflow",enabled:!0,phase:"main",fn:Rr,requiresIfExists:["offset"]};function Hr(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function Nr(r){return r===M(r)||!H(r)?jt(r):Hr(r)}function Br(r){var t=r.getBoundingClientRect(),e=et(t.width)/r.offsetWidth||1,i=et(t.height)/r.offsetHeight||1;return e!==1||i!==1}function Ir(r,t,e){e===void 0&&(e=!1);var i=H(t),n=H(t)&&Br(t),o=V(t),s=rt(r,n,e),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!e)&&((I(t)!=="body"||Tt(o))&&(a=Nr(t)),H(t)?(l=rt(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=Rt(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function Wr(r){var t=new Map,e=new Set,i=[];r.forEach(function(o){t.set(o.name,o)});function n(o){e.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!e.has(a)){var l=t.get(a);l&&n(l)}}),i.push(o)}return r.forEach(function(o){e.has(o.name)||n(o)}),i}function Fr(r){var t=Wr(r);return Qe.reduce(function(e,i){return e.concat(t.filter(function(n){return n.phase===i}))},[])}function qr(r){var t;return function(){return t||(t=new Promise(function(e){Promise.resolve().then(function(){t=void 0,e(r())})})),t}}function Vr(r){var t=r.reduce(function(e,i){var n=e[i.name];return e[i.name]=n?Object.assign({},n,i,{options:Object.assign({},n.options,i.options),data:Object.assign({},n.data,i.data)}):i,e},{});return Object.keys(t).map(function(e){return t[e]})}var me={placement:"bottom",modifiers:[],strategy:"absolute"};function ye(){for(var r=arguments.length,t=new Array(r),e=0;e{const n=Math.max(r,t,e),o=n-Math.min(r,t,e),s=o&&(n==r?(t-e)/o:n==t?2+(e-r)/o:4+(r-t)/o);return[60*(s<0?s+6:s),n&&o/n,n,i]},we=r=>r.replace(/[^0-9%.,]/g,"").split(",").map(t=>parseFloat(t)/(t.endsWith("%")?100:1)),zr=r=>{const t=document.createElement("span");t.style.display="none",t.style.color=r,document.body.append(t);const{color:e}=getComputedStyle(t);if(t.remove(),!e)return null;const[i,n,o,s]=we(e);return Kr([i/255,n/255,o/255,s])},Zr=r=>{const t=we(r).map((e,i)=>Math.min(e,i?1:255));return t.length<3||t.some(e=>isNaN(e))?null:t},be=r=>{let t;/^hsva?\(/i.test(r)?t="hsv":/^hsla?\(/i.test(r)?t="hsl":/^rgba?\(/i.test(r)?t="rgb":t="hex";const e=t==="hsv"?Zr(r):zr(r);if(!e)throw new Error("Color could not be parsed!");return e[3]=e[3]??1,{color:e,format:t}},nt=r=>r.toFixed(),Gr=(r,t)=>(""+ +r.toFixed(t)).replace(/^0\./g,"."),Jr=([r,t,e,i])=>{const n=e-e*t/2,o=Math.min(n,1-n);return[r,o?(e-n)/o:0,n,i]},Nt=([r,t,e,i])=>{const n=(o,s=(o+r/60)%6)=>e-e*t*Math.max(Math.min(s,4-s,1),0);return[n(5),n(3),n(1),i]},xt=([r,t,e,i],n,o=!1)=>{const s=o||i<1;n==="rgb"&&s&&(n="rgba");const a=n.startsWith("hs")?[nt(r),nt(t*100)+"%",nt(e*100)+"%"]:[nt(r*255),nt(t*255),nt(e*255)];return s&&a.push(Gr(i,2)),`${n}(${a.join()})`},Qr=r=>"#"+r.slice(0,r[3]<1?4:3).map(t=>Math.round(t*255).toString(16).padStart(2,"0")).join(""),ti=(r,t)=>t==="hsv"?xt(r,t):t==="hsl"?xt(Jr(r),t):t==="rgb"?xt(Nt(r),t):t==="rgba"?xt(Nt(r),t,!0):Qr(Nt(r));class F{constructor(t){if(b(this,"color"),!t)this.color=[0,0,0,1];else if(t instanceof F)this.color=[...t.color];else if(Array.isArray(t)){const[e=0,i=0,n=0,o=1]=t;this.color=[e,i,n,o]}else this.color=be(t).color}getSet(t,e){if(e===void 0)return this.color[t];const i=[...this.color];return i[t]=e,new F(i)}hue(t){return this.getSet(0,t)}saturation(t){return this.getSet(1,t)}value(t){return this.getSet(2,t)}alpha(t){return this.getSet(3,t)}string(t){return ti(this.color,t)}toString(){return this.string("hex")}clone(){return new F(this)}}class Bt extends We{constructor(t){super(),b(this,"x",0),b(this,"y",0),b(this,"$track"),b(this,"$thumb"),this.$track=t,this.$thumb=t.querySelector(".cp_thumb"),this.$track.addEventListener("pointerdown",e=>{this.$track.setPointerCapture(e.pointerId),this.handleDrag(e),e.preventDefault()}),this.$track.addEventListener("pointermove",e=>{this.$track.hasPointerCapture(e.pointerId)&&(this.handleDrag(e),e.preventDefault())}),this.$track.addEventListener("pointerup",e=>{this.$track.releasePointerCapture(e.pointerId),this.$thumb.focus(),e.preventDefault()}),this.$track.addEventListener("keydown",e=>{e.key==="ArrowLeft"?(this.handleNudge(-1,0,e.shiftKey),e.preventDefault()):e.key==="ArrowRight"?(this.handleNudge(1,0,e.shiftKey),e.preventDefault()):e.key==="ArrowUp"?(this.handleNudge(0,-1,e.shiftKey),e.preventDefault()):e.key==="ArrowDown"&&(this.handleNudge(0,1,e.shiftKey),e.preventDefault())})}handleDrag(t){const e=this.$track.getBoundingClientRect();this.fireDrag((t.clientX-e.x)/e.width,(t.clientY-e.y)/e.height)}handleNudge(t,e,i){const n=i?.1:.01;this.fireDrag(this.x+t*n,this.y+e*n)}fireDrag(t,e){t<0?t=0:t>1&&(t=1),e<0?e=0:e>1&&(e=1),this.emit("drag",t,e)}move(t,e){t!==void 0&&(this.x=t,this.$thumb.style.left=`${t*100}%`),e!==void 0&&(this.y=e,this.$thumb.style.top=`${e*100}%`)}}const ei={headless:!1,toggleStyle:"button",container:null,color:null,swatches:null,swatchesOnly:!1,enableAlpha:!0,enableEyedropper:!0,formats:["hex","rgb","hsv","hsl"],defaultFormat:"hex",submitMode:"confirm",showClearButton:!1,dismissOnOutsideClick:!0,dismissOnEscape:!0,dialogPlacement:"top",dialogOffset:8,staticPlacement:"center",staticOffset:8},xe=r=>r?r instanceof HTMLElement?r:document.querySelector(r):null,ri=(r,t,e)=>{const[i,n="center"]=t.split(" "),o=`${e}px`,s=i==="bottom"?"bottom":"top",a=i==="center";r.style[s]=a?"50%":o;const l=n==="right"?"right":"left",u=n==="center";r.style[l]=u?"50%":o,r.style.position="fixed",r.style.transform=`translate(${u?"-50%":"0%"}, ${a?"-50%":"0%"})`},ii='
',ni='
';let $t;class $e extends te.EventEmitter{constructor(t,e={}){super(),b(this,"_open",!1),b(this,"_unset",!0),b(this,"_firingChange",!1),b(this,"_format"),b(this,"_color"),b(this,"_newColor"),b(this,"_swatches"),b(this,"config"),b(this,"popper"),b(this,"isInput"),b(this,"$toggle"),b(this,"$dialog"),b(this,"$button"),b(this,"$input"),b(this,"changeHandler"),b(this,"clickHandler"),b(this,"hsvSlider"),b(this,"hueSlider"),b(this,"alphaSlider"),b(this,"$formats"),b(this,"$colorInput"),this.config={...ei,...e},t=xe(t)??document.createElement("button"),this.$toggle=t;const i=this.config.color||t.value||t.dataset.color||void 0;this.config.headless||this.createToggle(t),this._setCurrentColor(new F(i),!1),i||this.clear(!1),this.setSwatches(this.config.swatches),this.config.dismissOnOutsideClick&&window.addEventListener("pointerdown",n=>{if(!this._open)return;const o=n.target;!o.closest(".cp_dialog")&&!o.closest(".color-picker")&&this.close()}),this.config.dismissOnEscape&&window.addEventListener("keydown",n=>{if(n.key==="Escape"){const o=document.querySelector(":focus");(!o||o.closest(".cp_dialog"))&&this.close();return}}),this.close()}get isOpen(){return this._open}get color(){return this._unset?null:this._color}get swatches(){return this._swatches}get selectedColor(){return this._newColor}get format(){return this._format}get element(){return this.$toggle}createToggle(t){const e=t instanceof HTMLInputElement;this.isInput=e,this.$toggle=e?document.createElement("button"):t,this.$input=e?t:document.createElement("input"),this.isInput&&t.type=="color"&&(t.type="text"),t.replaceWith(this.$toggle),this.$input.tabIndex=-1,this.$input.readOnly=!0,this.$input.classList.add("cp_input"),this.config.toggleStyle==="input"&&this.$toggle.classList.add("cp_wide"),this.$button=document.createElement("div"),this.$button.classList.add("cp_button"),this.$button.innerHTML=ni,this.$toggle.classList.add("color-picker"),this.$toggle.setAttribute("type","button"),this.$toggle.append(this.$input,this.$button),this.changeHandler=()=>{this._firingChange||this.setColor(this.isInput?this.$input.value:this.$toggle.getAttribute("data-color"),!1)},this.clickHandler=()=>this.toggle(),this.$toggle.addEventListener("click",this.clickHandler),(e?this.$input:this.$toggle).addEventListener("change",this.changeHandler)}appendTo(t){t.append(this.element)}setSwatches(t){this._swatches=t||[],this.updateSwatches()}toggle(t=!this._open,e=!0){t?this.open(e):this.close(e)}open(t=!0){var e;if(this._open)return;this._open=!0,$t?.close(),$t=this;const i=xe(this.config.container)??document.body;i.insertAdjacentHTML("beforeend",ii),this.$dialog=i.lastElementChild,this.$colorInput=this.$dialog.querySelector(".cp_value"),this.populateDialog(),this.updateSwatches(),this.bindDialog(),this.setFormat(this.config.defaultFormat,!1),this.updateColor(),document.documentElement.contains(this.$toggle)?this.popper=Ur(this.$toggle,this.$dialog,{placement:this.config.dialogPlacement,strategy:"absolute",modifiers:[{name:"offset",options:{offset:[0,this.config.dialogOffset]}}]}):(this.popper=void 0,ri(this.$dialog,this.config.staticPlacement,this.config.staticOffset)),this.$colorInput.focus({preventScroll:!0}),(e=this.$button)==null||e.classList.add("cp_open"),setTimeout(()=>this.$dialog.classList.add("cp_open")),t&&(this.emit("open"),setTimeout(()=>this.emit("opened"),this.getAnimationDuration()))}prompt(t=!1){return new Promise(e=>{this.once("close",()=>e(this.color)),t&&this.once("closed",()=>this.destroy()),this.open()})}populateDialog(){this.config.formats&&(this.$formats=this.config.formats.map(t=>{const e=document.createElement("button");return e.className="cp_format",e.dataset.format=t,e.textContent=t.toUpperCase(),e.addEventListener("click",()=>this.setFormat(t)),e}),this.$dialog.querySelector(".cp_formats").append(...this.$formats))}bindDialog(){const t=this.$dialog.querySelector(".cp_area-hsv");this.hsvSlider=new Bt(t),this.hsvSlider.on("drag",(a,l)=>{this._setNewColor(this._newColor.saturation(a).value(1-l))});const e=this.$dialog.querySelector(".cp_slider-hue");this.hueSlider=new Bt(e),this.hueSlider.on("drag",a=>{this._setNewColor(this._newColor.hue(a*360))});const i=this.$dialog.querySelector(".cp_slider-alpha");this.config.enableAlpha?(this.alphaSlider=new Bt(i),this.alphaSlider.on("drag",a=>{this._setNewColor(this._newColor.alpha(a),!0)})):i.remove();const n=this.$dialog.querySelector(".cp_eyedrop");this.config.enableEyedropper&&"EyeDropper"in window?n.addEventListener("click",()=>{new EyeDropper().open().then(a=>{const l=new F(a.sRGBHex);this._setNewColor(l)}).catch(()=>{})}):n.remove();const o=this.$dialog.querySelector(".cp_submit");this.config.submitMode==="confirm"?o.addEventListener("click",()=>this.submit()):o.remove();const s=this.$dialog.querySelector(".cp_clear");if(this.config.showClearButton?s.addEventListener("click",()=>{this.clear(),this.close()}):s.remove(),this.$colorInput.addEventListener("input",()=>{try{const{color:a,format:l}=be(this.$colorInput.value);this.setFormat(l,!1),this._setNewColor(new F(a),!1)}catch{}}),this.$colorInput.addEventListener("keydown",a=>{a.key==="Enter"&&this.submit()}),this.$colorInput.addEventListener("dblclick",()=>{navigator.clipboard&&navigator.clipboard.writeText(this.$colorInput.value)}),this.config.swatchesOnly){const a=this.$dialog.querySelector(".cp_input-group");a&&a.remove();const l=this.$dialog.querySelector(".cp_formats");l&&l.remove(),e&&e.remove(),t&&t.remove(),i&&i.remove()}}getAnimationDuration(){const e=window.getComputedStyle(this.$toggle).getPropertyValue("--cp-delay");return parseFloat(e)*(e.endsWith("ms")?1:1e3)}close(t=!0){var e;if(!this._open)return;this._open=!1,$t=void 0,(e=this.$button)==null||e.classList.remove("cp_open");const i=this.$dialog,n=this.popper;this.$dialog=void 0,this.popper=void 0,i?.classList.remove("cp_open"),setTimeout(()=>{i?.remove(),n?.destroy(),t&&this.emit("closed")},this.getAnimationDuration()),t&&this.emit("close")}submit(t=this._newColor,e=!0){this._setCurrentColor(t,e,!0),this.close(e)}destroy(){var t;if(this.close(),(t=this.$dialog)==null||t.remove(),this.isInput){if(!this.$input)return;this.$toggle.removeChild(this.$input),this.$toggle.replaceWith(this.$input),this.$input.classList.remove("cp_input"),this.$input.removeAttribute("tabindex"),this.$input.removeAttribute("readonly"),this.changeHandler&&this.$input.removeEventListener("change",this.changeHandler)}else{if(!this.$toggle)return;this.$toggle.classList.remove("color-picker","cp_open"),this.$toggle.removeAttribute("data-color"),this.$toggle.removeAttribute("type"),this.$toggle.textContent="",this.clickHandler&&this.$toggle.removeEventListener("click",this.clickHandler)}}clear(t=!0){this._unset=!0,this.updateAppliedColor(t)}setColor(t,e=!0){if(!t)return this.clear(e);this._setCurrentColor(new F(t),e)}setFormat(t,e=!0){this._format=t,this.updateFormat(),e&&(this.updateColor(),this.updateAppliedColor(!1))}_setNewColor(t,e=!0){this._newColor=t,(this.config.submitMode==="instant"||this.config.swatchesOnly)&&(this._unset=!1,this._color=t,this.updateAppliedColor(!0)),this.updateColor(e)}_setCurrentColor(t,e=!0,i=!0){this._unset=!1,this._newColor=this._color=t,this.updateColor(i),this.updateAppliedColor(e)}updateColor(t=!0){var e,i,n,o,s,a,l,u,c,h;const g=((e=this.color)==null?void 0:e.toString())??"transparent",p=this._newColor.string("hex");(i=this.$dialog)==null||i.style.setProperty("--cp-base-color",p.substring(0,7)),(n=this.$button)==null||n.style.setProperty("--cp-current-color",g),(o=this.$dialog)==null||o.style.setProperty("--cp-current-color",g),(s=this.$dialog)==null||s.style.setProperty("--cp-color",p),(a=this.$dialog)==null||a.style.setProperty("--cp-hue",this._newColor.hue().toString()),(l=this.$dialog)==null||l.style.setProperty("--cp-alpha",this._newColor.alpha().toString()),(u=this.hsvSlider)==null||u.move(this._newColor.saturation(),1-this._newColor.value()),(c=this.hueSlider)==null||c.move(this._newColor.hue()/360),(h=this.alphaSlider)==null||h.move(this._newColor.alpha()),t&&this.$colorInput&&(this.$colorInput.value=this._newColor.string(this._format))}updateAppliedColor(t=!0){const e=this._unset?"":this._color.string(this.config.defaultFormat);this.$input&&(this.$input.value=e,this.$input.dataset.color=e),this.$toggle&&(this.$toggle.dataset.color=e),this.$button&&this.$button.classList.toggle("cp_unset",this._unset),t&&(this.emit("pick",this.color),this.$input&&(this._firingChange=!0,this.$input.dispatchEvent(new Event("change")),this._firingChange=!1))}updateFormat(){if(!this.$formats)return;this.$formats.forEach(e=>e.removeAttribute("aria-checked"));const t=this.$formats.find(e=>e.dataset.format===this._format);t&&(t.ariaChecked="true")}updateSwatches(){if(!this.$dialog)return;const t=this.$dialog.querySelector(".cp_swatches");t.textContent="",this._swatches.forEach(e=>{const i=document.createElement("button");i.className="cp_swatch",i.style.setProperty("--cp-color",e),i.dataset.color=e;const n=new F(i.dataset.color);i.addEventListener("click",()=>{this._setNewColor(n),this.config.swatchesOnly&&this.close()}),t.append(i)})}}return b($e,"Color",F),$e}();