Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

26.6 KB
Raw Blame
"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([["5867"],{36308:function(e,r,t){t.d(r,{Z:()=>G});var l=t(19595),o=t(98965),a=t(97931),i=t(34649),n=t(20013),s=t(23967),u=t(58786),d=t(1257),c=t(53242),p=t(67553),h=t(56946),b=t(32196),v=t(3616),g=t(54470),m=t(53198),f=t(61730),x=t(44267),k=t(71309),w=t(15496),y=t(50906),C=t(82518);function $(e){return null===e?null:/^ *#/.test(e)?"hex":e.includes("rgb")?"rgb":e.includes("hsl")?"hsl":e.includes("hsv")?"hsv":null}let U={rgb:{hex:e=>(0,l.XA)((0,l.m4)(e)),hsl(e){let[r,t,a,i]=(0,l.m4)(e);return(0,l.f4)([...(0,o.XL)(r,t,a),i])},hsv(e){let[r,t,a,i]=(0,l.m4)(e);return(0,l.nE)([...(0,o.DM)(r,t,a),i])}},hex:{rgb:e=>(0,l.e3)((0,l.m4)(e)),hsl(e){let[r,t,a,i]=(0,l.m4)(e);return(0,l.f4)([...(0,o.XL)(r,t,a),i])},hsv(e){let[r,t,a,i]=(0,l.m4)(e);return(0,l.nE)([...(0,o.DM)(r,t,a),i])}},hsl:{hex(e){let[r,t,a,i]=(0,l.Jn)(e);return(0,l.XA)([...(0,o.wX)(r,t,a),i])},rgb(e){let[r,t,a,i]=(0,l.Jn)(e);return(0,l.e3)([...(0,o.wX)(r,t,a),i])},hsv(e){let[r,t,a,i]=(0,l.Jn)(e);return(0,l.nE)([...(0,o.EV)(r,t,a),i])}},hsv:{hex(e){let[r,t,a,i]=(0,l.ap)(e);return(0,l.XA)([...(0,o.XG)(r,t,a),i])},rgb(e){let[r,t,a,i]=(0,l.ap)(e);return(0,l.e3)([...(0,o.XG)(r,t,a),i])},hsl(e){let[r,t,a,i]=(0,l.ap)(e);return(0,l.f4)([...(0,o.pL)(r,t,a),i])}}};function S(e,r,t){return(t=t||$(e))?t===r?e:U[t][r](e):null}let B="12px",A=(0,u.aZ)({name:"AlphaSlider",props:{clsPrefix:{type:String,required:!0},rgba:{type:Array,default:null},alpha:{type:Number,default:0},onUpdateAlpha:{type:Function,required:!0},onComplete:Function},setup(e){let r=(0,u.iH)(null);function t(t){var l;let{value:o}=r;if(!o)return;let{width:a,left:i}=o.getBoundingClientRect(),n=(t.clientX-i)/(a-12);e.onUpdateAlpha((l=Math.round(100*(l=n))/100)>1?1:l<0?0:l)}function l(){var r;(0,C.S)("mousemove",document,t),(0,C.S)("mouseup",document,l),null==(r=e.onComplete)||r.call(e)}return{railRef:r,railBackgroundImage:(0,u.Fl)(()=>{let{rgba:r}=e;return r?`linear-gradient(to right, rgba(${r[0]}, ${r[1]}, ${r[2]}, 0) 0%, rgba(${r[0]}, ${r[1]}, ${r[2]}, 1) 100%)`:""}),handleMouseDown:function(o){r.value&&e.rgba&&((0,C.on)("mousemove",document,t),(0,C.on)("mouseup",document,l),t(o))}}},render(){let{clsPrefix:e}=this;return(0,u.h)("div",{class:`${e}-color-picker-slider`,ref:"railRef",style:{height:B,borderRadius:"6px"},onMousedown:this.handleMouseDown},(0,u.h)("div",{style:{borderRadius:"6px",position:"absolute",left:0,right:0,top:0,bottom:0,overflow:"hidden"}},(0,u.h)("div",{class:`${e}-color-picker-checkboard`}),(0,u.h)("div",{class:`${e}-color-picker-slider__image`,style:{backgroundImage:this.railBackgroundImage}})),this.rgba&&(0,u.h)("div",{style:{position:"absolute",left:"6px",right:"6px",top:0,bottom:0}},(0,u.h)("div",{class:`${e}-color-picker-handle`,style:{left:`calc(${100*this.alpha}% - 6px)`,borderRadius:"6px",width:B,height:B}},(0,u.h)("div",{class:`${e}-color-picker-handle__fill`,style:{backgroundColor:(0,l.e3)(this.rgba),borderRadius:"6px",width:B,height:B}}))))}});var D=t(79537),z=t(73084);let V=(0,t(19050).U)("n-color-picker"),F={paddingSmall:"0 4px"},P=(0,u.aZ)({name:"ColorInputUnit",props:{label:{type:String,required:!0},value:{type:[Number,String],default:null},showAlpha:Boolean,onUpdateValue:{type:Function,required:!0}},setup(e){let r=(0,u.iH)(""),{themeRef:t}=(0,u.f3)(V,null);function l(){let{value:r}=e;if(null===r)return"";let{label:t}=e;return"HEX"===t?r:"A"===t?`${Math.floor(100*r)}%`:String(Math.floor(r))}return(0,u.m0)(()=>{r.value=l()}),{mergedTheme:t,inputValue:r,handleInputChange:function(t){let o;switch(e.label){case"HEX":(function(e){let r=e.trim();return!!/^#[0-9a-fA-F]+$/.test(r)&&[4,5,7,9].includes(r.length)})(t)&&e.onUpdateValue(t),r.value=l();break;case"H":!1===(o=!!/^\d{1,3}\.?\d*$/.test(t.trim())&&Math.max(0,Math.min(Number.parseInt(t),360)))?r.value=l():e.onUpdateValue(o);break;case"S":case"L":case"V":!1===(o=!!/^\d{1,3}\.?\d*$/.test(t.trim())&&Math.max(0,Math.min(Number.parseInt(t),100)))?r.value=l():e.onUpdateValue(o);break;case"A":!1===(o=!!/^\d{1,3}\.?\d*%$/.test(t.trim())&&Math.max(0,Math.min(Number.parseInt(t)/100,100)))?r.value=l():e.onUpdateValue(o);break;case"R":case"G":case"B":!1===(o=!!/^\d{1,3}\.?\d*$/.test(t.trim())&&Math.max(0,Math.min(Number.parseInt(t),255)))?r.value=l():e.onUpdateValue(o)}},handleInputUpdateValue:function(e){r.value=e}}},render(){let{mergedTheme:e}=this;return(0,u.h)(z.Z,{size:"small",placeholder:this.label,theme:e.peers.Input,themeOverrides:e.peerOverrides.Input,builtinThemeOverrides:F,value:this.inputValue,onUpdateValue:this.handleInputUpdateValue,onChange:this.handleInputChange,style:"A"===this.label?"flex-grow: 1.25;":""})}}),Z=(0,u.aZ)({name:"ColorInput",props:{clsPrefix:{type:String,required:!0},mode:{type:String,required:!0},modes:{type:Array,required:!0},showAlpha:{type:Boolean,required:!0},value:{type:String,default:null},valueArr:{type:Array,default:null},onUpdateValue:{type:Function,required:!0},onUpdateMode:{type:Function,required:!0}},setup:e=>({handleUnitUpdateValue(r,t){let o,{showAlpha:a}=e;if("hex"===e.mode)return void e.onUpdateValue((a?l.XA:l.zv)(t));switch(o=null===e.valueArr?[0,0,0,0]:Array.from(e.valueArr),e.mode){case"hsv":o[r]=t,e.onUpdateValue((a?l.nE:l.wW)(o));break;case"rgb":o[r]=t,e.onUpdateValue((a?l.e3:l.U8)(o));break;case"hsl":o[r]=t,e.onUpdateValue((a?l.f4:l.DU)(o))}}}),render(){let{clsPrefix:e,modes:r}=this;return(0,u.h)("div",{class:`${e}-color-picker-input`},(0,u.h)("div",{class:`${e}-color-picker-input__mode`,onClick:this.onUpdateMode,style:{cursor:1===r.length?"":"pointer"}},this.mode.toUpperCase()+(this.showAlpha?"A":"")),(0,u.h)(D.Z,null,{default:()=>{let{mode:e,valueArr:r,showAlpha:t}=this;if("hex"===e){let e=null;try{e=null===r?null:(t?l.XA:l.zv)(r)}catch(e){}return(0,u.h)(P,{label:"HEX",showAlpha:t,value:e,onUpdateValue:e=>{this.handleUnitUpdateValue(0,e)}})}return(e+(t?"a":"")).split("").map((e,t)=>(0,u.h)(P,{label:e.toUpperCase(),value:null===r?null:r[t],onUpdateValue:e=>{this.handleUnitUpdateValue(t,e)}}))}}))}});var M=t(14501);let E=(0,u.aZ)({name:"ColorPickerSwatches",props:{clsPrefix:{type:String,required:!0},mode:{type:String,required:!0},swatches:{type:Array,required:!0},onUpdateColor:{type:Function,required:!0}},setup(e){function r(r){e.onUpdateColor(function(r){let{mode:t}=e,{value:l,mode:o}=r;return(o||(o="hex",/^[a-zA-Z]+$/.test(l)?l=function(e){let r=document.createElement("canvas").getContext("2d");return r?(r.fillStyle=e,r.fillStyle):"#000000"}(l):((0,M.ZK)("color-picker",`color ${l} in swatches is invalid.`),l="#000000")),o===t)?l:S(l,t,o)}(r))}return{parsedSwatchesRef:(0,u.Fl)(()=>e.swatches.map(e=>{let r=$(e);return{value:e,mode:r,legalValue:function(e,r){if("hsv"===r){let[r,t,a,i]=(0,l.ap)(e);return(0,l.e3)([...(0,o.XG)(r,t,a),i])}return e}(e,r)}})),handleSwatchSelect:r,handleSwatchKeyDown:function(e,t){"Enter"===e.key&&r(t)}}},render(){let{clsPrefix:e}=this;return(0,u.h)("div",{class:`${e}-color-picker-swatches`},this.parsedSwatchesRef.map(r=>(0,u.h)("div",{class:`${e}-color-picker-swatch`,tabindex:0,onClick:()=>{this.handleSwatchSelect(r)},onKeydown:e=>{this.handleSwatchKeyDown(e,r)}},(0,u.h)("div",{class:`${e}-color-picker-swatch__fill`,style:{background:r.legalValue}}))))}}),_=(0,u.aZ)({name:"ColorPickerTrigger",slots:Object,props:{clsPrefix:{type:String,required:!0},value:{type:String,default:null},hsla:{type:Array,default:null},disabled:Boolean,onClick:Function},setup(e){let{colorPickerSlots:r,renderLabelRef:t}=(0,u.f3)(V,null);return()=>{let{hsla:o,value:a,clsPrefix:i,onClick:n,disabled:s}=e,d=r.label||t.value;return(0,u.h)("div",{class:[`${i}-color-picker-trigger`,s&&`${i}-color-picker-trigger--disabled`],onClick:s?void 0:n},(0,u.h)("div",{class:`${i}-color-picker-trigger__fill`},(0,u.h)("div",{class:`${i}-color-picker-checkboard`}),(0,u.h)("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,backgroundColor:o?(0,l.f4)(o):""}}),a&&o?(0,u.h)("div",{class:`${i}-color-picker-trigger__value`,style:{color:o[2]>50||o[3]<.5?"black":"white"}},d?d(a):a):null))}}}),X=(0,u.aZ)({name:"ColorPreview",props:{clsPrefix:{type:String,required:!0},mode:{type:String,required:!0},color:{type:String,default:null,validator:e=>{let r=$(e);return!!(!e||r&&"hsv"!==r)}},onUpdateColor:{type:Function,required:!0}},setup:e=>({handleChange:function(r){var t;let l=r.target.value;null==(t=e.onUpdateColor)||t.call(e,S(l.toUpperCase(),e.mode,"hex")),r.stopPropagation()}}),render(){let{clsPrefix:e}=this;return(0,u.h)("div",{class:`${e}-color-picker-preview__preview`},(0,u.h)("span",{class:`${e}-color-picker-preview__fill`,style:{background:this.color||"#000000"}}),(0,u.h)("input",{class:`${e}-color-picker-preview__input`,type:"color",value:this.color,onChange:this.handleChange}))}}),R="12px",q=(0,u.aZ)({name:"HueSlider",props:{clsPrefix:{type:String,required:!0},hue:{type:Number,required:!0},onUpdateHue:{type:Function,required:!0},onComplete:Function},setup(e){let r=(0,u.iH)(null);function t(t){var l;let{value:o}=r;if(!o)return;let{width:a,left:i}=o.getBoundingClientRect(),n=(l=Math.round(l=(t.clientX-i-6)/(a-12)*360))>=360?359:l<0?0:l;e.onUpdateHue(n)}function l(){var r;(0,C.S)("mousemove",document,t),(0,C.S)("mouseup",document,l),null==(r=e.onComplete)||r.call(e)}return{railRef:r,handleMouseDown:function(e){r.value&&((0,C.on)("mousemove",document,t),(0,C.on)("mouseup",document,l),t(e))}}},render(){let{clsPrefix:e}=this;return(0,u.h)("div",{class:`${e}-color-picker-slider`,style:{height:R,borderRadius:"6px"}},(0,u.h)("div",{ref:"railRef",style:{boxShadow:"inset 0 0 2px 0 rgba(0, 0, 0, .24)",boxSizing:"border-box",backgroundImage:"linear-gradient(90deg,red,#ff0 16.66%,#0f0 33.33%,#0ff 50%,#00f 66.66%,#f0f 83.33%,red)",height:R,borderRadius:"6px",position:"relative"},onMousedown:this.handleMouseDown},(0,u.h)("div",{style:{position:"absolute",left:"6px",right:"6px",top:0,bottom:0}},(0,u.h)("div",{class:`${e}-color-picker-handle`,style:{left:`calc((${this.hue}%) / 359 * 100 - 6px)`,borderRadius:"6px",width:R,height:R}},(0,u.h)("div",{class:`${e}-color-picker-handle__fill`,style:{backgroundColor:`hsl(${this.hue}, 100%, 50%)`,borderRadius:"6px",width:R,height:R}})))))}}),H="12px",I=(0,u.aZ)({name:"Pallete",props:{clsPrefix:{type:String,required:!0},rgba:{type:Array,default:null},displayedHue:{type:Number,required:!0},displayedSv:{type:Array,required:!0},onUpdateSV:{type:Function,required:!0},onComplete:Function},setup(e){let r=(0,u.iH)(null);function t(t){let{value:l}=r;if(!l)return;let{width:o,height:a,left:i,bottom:n}=l.getBoundingClientRect(),s=(n-t.clientY)/a,u=(t.clientX-i)/o;e.onUpdateSV(100*(u>1?1:u<0?0:u),100*(s>1?1:s<0?0:s))}function l(){var r;(0,C.S)("mousemove",document,t),(0,C.S)("mouseup",document,l),null==(r=e.onComplete)||r.call(e)}return{palleteRef:r,handleColor:(0,u.Fl)(()=>{let{rgba:r}=e;return r?`rgb(${r[0]}, ${r[1]}, ${r[2]})`:""}),handleMouseDown:function(e){r.value&&((0,C.on)("mousemove",document,t),(0,C.on)("mouseup",document,l),t(e))}}},render(){let{clsPrefix:e}=this;return(0,u.h)("div",{class:`${e}-color-picker-pallete`,onMousedown:this.handleMouseDown,ref:"palleteRef"},(0,u.h)("div",{class:`${e}-color-picker-pallete__layer`,style:{backgroundImage:`linear-gradient(90deg, white, hsl(${this.displayedHue}, 100%, 50%))`}}),(0,u.h)("div",{class:`${e}-color-picker-pallete__layer ${e}-color-picker-pallete__layer--shadowed`,style:{backgroundImage:"linear-gradient(180deg, rgba(0, 0, 0, 0%), rgba(0, 0, 0, 100%))"}}),this.rgba&&(0,u.h)("div",{class:`${e}-color-picker-handle`,style:{width:H,height:H,borderRadius:"6px",left:`calc(${this.displayedSv[0]}% - 6px)`,bottom:`calc(${this.displayedSv[1]}% - 6px)`}},(0,u.h)("div",{class:`${e}-color-picker-handle__fill`,style:{backgroundColor:this.handleColor,borderRadius:"6px",width:H,height:H}})))}});var O=t(74732);let T=(0,k.c)([(0,k.cB)("color-picker",`
 display: inline-block;
 box-sizing: border-box;
 height: var(--n-height);
 font-size: var(--n-font-size);
 width: 100%;
 position: relative;
 `),(0,k.cB)("color-picker-panel",`
 margin: 4px 0;
 width: 240px;
 font-size: var(--n-panel-font-size);
 color: var(--n-text-color);
 background-color: var(--n-color);
 transition:
 box-shadow .3s var(--n-bezier),
 color .3s var(--n-bezier),
 background-color .3s var(--n-bezier);
 border-radius: var(--n-border-radius);
 box-shadow: var(--n-box-shadow);
 `,[(0,O.h)(),(0,k.cB)("input",`
 text-align: center;
 `)]),(0,k.cB)("color-picker-checkboard",`
 background: white; 
 position: absolute;
 left: 0;
 right: 0;
 top: 0;
 bottom: 0;
 `,[(0,k.c)("&::after",`
 background-image: linear-gradient(45deg, #DDD 25%, #0000 25%), linear-gradient(-45deg, #DDD 25%, #0000 25%), linear-gradient(45deg, #0000 75%, #DDD 75%), linear-gradient(-45deg, #0000 75%, #DDD 75%);
 background-size: 12px 12px;
 background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
 background-repeat: repeat;
 content: "";
 position: absolute;
 left: 0;
 right: 0;
 top: 0;
 bottom: 0;
 `)]),(0,k.cB)("color-picker-slider",`
 margin-bottom: 8px;
 position: relative;
 box-sizing: border-box;
 `,[(0,k.cE)("image",`
 position: absolute;
 left: 0;
 right: 0;
 top: 0;
 bottom: 0;
 `),(0,k.c)("&::after",`
 content: "";
 position: absolute;
 border-radius: inherit;
 left: 0;
 right: 0;
 top: 0;
 bottom: 0;
 box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, .24);
 pointer-events: none;
 `)]),(0,k.cB)("color-picker-handle",`
 z-index: 1;
 box-shadow: 0 0 2px 0 rgba(0, 0, 0, .45);
 position: absolute;
 background-color: white;
 overflow: hidden;
 `,[(0,k.cE)("fill",`
 box-sizing: border-box;
 border: 2px solid white;
 `)]),(0,k.cB)("color-picker-pallete",`
 height: 180px;
 position: relative;
 margin-bottom: 8px;
 cursor: crosshair;
 `,[(0,k.cE)("layer",`
 position: absolute;
 left: 0;
 right: 0;
 top: 0;
 bottom: 0;
 `,[(0,k.cM)("shadowed",`
 box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, .24);
 `)])]),(0,k.cB)("color-picker-preview",`
 display: flex;
 `,[(0,k.cE)("sliders",`
 flex: 1 0 auto;
 `),(0,k.cE)("preview",`
 position: relative;
 height: 30px;
 width: 30px;
 margin: 0 0 8px 6px;
 border-radius: 50%;
 box-shadow: rgba(0, 0, 0, .15) 0px 0px 0px 1px inset;
 overflow: hidden;
 `),(0,k.cE)("fill",`
 display: block;
 width: 30px;
 height: 30px;
 `),(0,k.cE)("input",`
 position: absolute;
 top: 0;
 left: 0;
 width: 30px;
 height: 30px;
 opacity: 0;
 z-index: 1;
 `)]),(0,k.cB)("color-picker-input",`
 display: flex;
 align-items: center;
 `,[(0,k.cB)("input",`
 flex-grow: 1;
 flex-basis: 0;
 `),(0,k.cE)("mode",`
 width: 72px;
 text-align: center;
 `)]),(0,k.cB)("color-picker-control",`
 padding: 12px;
 `),(0,k.cB)("color-picker-action",`
 display: flex;
 margin-top: -4px;
 border-top: 1px solid var(--n-divider-color);
 padding: 8px 12px;
 justify-content: flex-end;
 `,[(0,k.cB)("button","margin-left: 8px;")]),(0,k.cB)("color-picker-trigger",`
 border: var(--n-border);
 height: 100%;
 box-sizing: border-box;
 border-radius: var(--n-border-radius);
 transition: border-color .3s var(--n-bezier);
 cursor: pointer;
 `,[(0,k.cE)("value",`
 white-space: nowrap;
 position: relative;
 `),(0,k.cE)("fill",`
 border-radius: var(--n-border-radius);
 position: absolute;
 display: flex;
 align-items: center;
 justify-content: center;
 left: 4px;
 right: 4px;
 top: 4px;
 bottom: 4px;
 `),(0,k.cM)("disabled","cursor: not-allowed"),(0,k.cB)("color-picker-checkboard",`
 border-radius: var(--n-border-radius);
 `,[(0,k.c)("&::after",`
 --n-block-size: calc((var(--n-height) - 8px) / 3);
 background-size: calc(var(--n-block-size) * 2) calc(var(--n-block-size) * 2);
 background-position: 0 0, 0 var(--n-block-size), var(--n-block-size) calc(-1 * var(--n-block-size)), calc(-1 * var(--n-block-size)) 0px; 
 `)])]),(0,k.cB)("color-picker-swatches",`
 display: grid;
 grid-gap: 8px;
 flex-wrap: wrap;
 position: relative;
 grid-template-columns: repeat(auto-fill, 18px);
 margin-top: 10px;
 `,[(0,k.cB)("color-picker-swatch",`
 width: 18px;
 height: 18px;
 background-image: linear-gradient(45deg, #DDD 25%, #0000 25%), linear-gradient(-45deg, #DDD 25%, #0000 25%), linear-gradient(45deg, #0000 75%, #DDD 75%), linear-gradient(-45deg, #0000 75%, #DDD 75%);
 background-size: 8px 8px;
 background-position: 0px 0, 0px 4px, 4px -4px, -4px 0px;
 background-repeat: repeat;
 `,[(0,k.cE)("fill",`
 position: relative;
 width: 100%;
 height: 100%;
 border-radius: 3px;
 box-shadow: rgba(0, 0, 0, .15) 0px 0px 0px 1px inset;
 cursor: pointer;
 `),(0,k.c)("&:focus",`
 outline: none;
 `,[(0,k.cE)("fill",[(0,k.c)("&::after",`
 position: absolute;
 top: 0;
 right: 0;
 bottom: 0;
 left: 0;
 background: inherit;
 filter: blur(2px);
 content: "";
 `)])])])])]),L=Object.assign(Object.assign({},h.Z.props),{value:String,show:{type:Boolean,default:void 0},defaultShow:Boolean,defaultValue:String,modes:{type:Array,default:()=>["rgb","hex","hsl"]},placement:{type:String,default:"bottom-start"},to:f.n.propTo,showAlpha:{type:Boolean,default:!0},showPreview:Boolean,swatches:Array,disabled:{type:Boolean,default:void 0},actions:{type:Array,default:null},internalActions:Array,size:String,renderLabel:Function,onComplete:Function,onConfirm:Function,onClear:Function,"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array]}),G=(0,u.aZ)({name:"ColorPicker",props:L,slots:Object,setup(e,{slots:r}){let t,i,d,c,p,C,U,S,B=(0,u.iH)(null),D=null,z=(0,b.Z)(e),{mergedSizeRef:F,mergedDisabledRef:P}=z,{localeRef:M}=(0,v.Z)("global"),{mergedClsPrefixRef:_,namespaceRef:R,inlineThemeDisabled:H}=(0,g.ZP)(e),O=(0,h.Z)("ColorPicker","-color-picker",T,y.Z,e,_);(0,u.JJ)(V,{themeRef:O,renderLabelRef:(0,u.Vh)(e,"renderLabel"),colorPickerSlots:r});let L=(0,u.iH)(e.defaultShow),G=(0,n.Z)((0,u.Vh)(e,"show"),L);function j(r){let{onUpdateShow:t,"onUpdate:show":l}=e;t&&(0,x.R)(t,r),l&&(0,x.R)(l,r),L.value=r}let{defaultValue:J}=e,N=(0,u.iH)(void 0===J?function(e,r){switch(e[0]){case"hex":return r?"#000000FF":"#000000";case"rgb":return r?"rgba(0, 0, 0, 1)":"rgb(0, 0, 0)";case"hsl":return r?"hsla(0, 0%, 0%, 1)":"hsl(0, 0%, 0%)";case"hsv":return r?"hsva(0, 0%, 0%, 1)":"hsv(0, 0%, 0%)"}return"#000000"}(e.modes,e.showAlpha):J),K=(0,n.Z)((0,u.Vh)(e,"value"),N),W=(0,u.iH)([K.value]),Y=(0,u.iH)(0),Q=(0,u.Fl)(()=>$(K.value)),{modes:ee}=e,er=(0,u.iH)($(K.value)||ee[0]||"rgb");function et(){let{modes:r}=e,{value:t}=er,l=r.findIndex(e=>e===t);~l?er.value=r[(l+1)%r.length]:er.value="rgb"}let el=(0,u.Fl)(()=>{let{value:e}=K;if(!e)return null;switch(Q.value){case"hsv":return(0,l.ap)(e);case"hsl":return[t,i,d,S]=(0,l.Jn)(e),[...(0,o.EV)(t,i,d),S];case"rgb":case"hex":return[p,C,U,S]=(0,l.m4)(e),[...(0,o.DM)(p,C,U),S]}}),eo=(0,u.Fl)(()=>{let{value:e}=K;if(!e)return null;switch(Q.value){case"rgb":case"hex":return(0,l.m4)(e);case"hsv":return[t,i,c,S]=(0,l.ap)(e),[...(0,o.XG)(t,i,c),S];case"hsl":return[t,i,d,S]=(0,l.Jn)(e),[...(0,o.wX)(t,i,d),S]}}),ea=(0,u.Fl)(()=>{let{value:e}=K;if(!e)return null;switch(Q.value){case"hsl":return(0,l.Jn)(e);case"hsv":return[t,i,c,S]=(0,l.ap)(e),[...(0,o.pL)(t,i,c),S];case"rgb":case"hex":return[p,C,U,S]=(0,l.m4)(e),[...(0,o.XL)(p,C,U),S]}}),ei=(0,u.Fl)(()=>{switch(er.value){case"rgb":case"hex":return eo.value;case"hsv":return el.value;case"hsl":return ea.value}}),en=(0,u.iH)(0),es=(0,u.iH)(1),eu=(0,u.iH)([0,0]);function ed(r,t){let{value:a}=el,i=en.value,n=a?a[3]:1;eu.value=[r,t];let{showAlpha:s}=e;switch(er.value){case"hsv":eh((s?l.nE:l.wW)([i,r,t,n]),"cursor");break;case"hsl":eh((s?l.f4:l.DU)([...(0,o.pL)(i,r,t),n]),"cursor");break;case"rgb":eh((s?l.e3:l.U8)([...(0,o.XG)(i,r,t),n]),"cursor");break;case"hex":eh((s?l.XA:l.zv)([...(0,o.XG)(i,r,t),n]),"cursor")}}function ec(r){en.value=r;let{value:t}=el;if(!t)return;let[,a,i,n]=t,{showAlpha:s}=e;switch(er.value){case"hsv":eh((s?l.nE:l.wW)([r,a,i,n]),"cursor");break;case"rgb":eh((s?l.e3:l.U8)([...(0,o.XG)(r,a,i),n]),"cursor");break;case"hex":eh((s?l.XA:l.zv)([...(0,o.XG)(r,a,i),n]),"cursor");break;case"hsl":eh((s?l.f4:l.DU)([...(0,o.pL)(r,a,i),n]),"cursor")}}function ep(e){switch(er.value){case"hsv":[t,i,c]=el.value,eh((0,l.nE)([t,i,c,e]),"cursor");break;case"rgb":[p,C,U]=eo.value,eh((0,l.e3)([p,C,U,e]),"cursor");break;case"hex":[p,C,U]=eo.value,eh((0,l.XA)([p,C,U,e]),"cursor");break;case"hsl":[t,i,d]=ea.value,eh((0,l.f4)([t,i,d,e]),"cursor")}es.value=e}function eh(r,t){D="cursor"===t?r:null;let{nTriggerFormChange:l,nTriggerFormInput:o}=z,{onUpdateValue:a,"onUpdate:value":i}=e;a&&(0,x.R)(a,r),i&&(0,x.R)(i,r),l(),o(),N.value=r}function eb(e){eh(e,"input"),(0,u.Y3)(ev)}function ev(r=!0){let{value:t}=K;if(t){let{nTriggerFormChange:l,nTriggerFormInput:o}=z,{onComplete:a}=e;a&&a(t);let{value:i}=W,{value:n}=Y;r&&(i.splice(n+1,i.length,t),Y.value=n+1),l(),o()}}function eg(){let{value:e}=Y;e-1<0||(eh(W.value[e-1],"input"),ev(!1),Y.value=e-1)}function em(){let{value:e}=Y;e<0||e+1>=W.value.length||(eh(W.value[e+1],"input"),ev(!1),Y.value=e+1)}function ef(){eh(null,"input");let{onClear:r}=e;r&&r(),j(!1)}function ex(){let{value:r}=K,{onConfirm:t}=e;t&&t(r),j(!1)}let ek=(0,u.Fl)(()=>Y.value>=1),ew=(0,u.Fl)(()=>{let{value:e}=W;return e.length>1&&Y.value<e.length-1});(0,u.YP)(G,e=>{e||(W.value=[K.value],Y.value=0)}),(0,u.m0)(()=>{if(D&&D===K.value);else{let{value:e}=el;e&&(en.value=e[0],es.value=e[3],eu.value=[e[1],e[2]])}D=null});let ey=(0,u.Fl)(()=>{let{value:e}=F,{common:{cubicBezierEaseInOut:r},self:{textColor:t,color:l,panelFontSize:o,boxShadow:a,border:i,borderRadius:n,dividerColor:s,[(0,k.Tl)("height",e)]:u,[(0,k.Tl)("fontSize",e)]:d}}=O.value;return{"--n-bezier":r,"--n-text-color":t,"--n-color":l,"--n-panel-font-size":o,"--n-font-size":d,"--n-box-shadow":a,"--n-border":i,"--n-border-radius":n,"--n-height":u,"--n-divider-color":s}}),eC=H?(0,m.F)("color-picker",(0,u.Fl)(()=>F.value[0]),ey,e):void 0;return{mergedClsPrefix:_,namespace:R,selfRef:B,hsla:ea,rgba:eo,mergedShow:G,mergedDisabled:P,isMounted:(0,s.Z)(),adjustedTo:(0,f.n)(e),mergedValue:K,handleTriggerClick(){j(!0)},handleClickOutside(e){var r;null!=(r=B.value)&&r.contains((0,a.p)(e))||j(!1)},renderPanel:function(){var t;let{value:o}=eo,{value:a}=en,{internalActions:i,modes:n,actions:s}=e,{value:d}=O,{value:c}=_;return(0,u.h)("div",{class:[`${c}-color-picker-panel`,null==eC?void 0:eC.themeClass.value],onDragstart:e=>{e.preventDefault()},style:H?void 0:ey.value},(0,u.h)("div",{class:`${c}-color-picker-control`},(0,u.h)(I,{clsPrefix:c,rgba:o,displayedHue:a,displayedSv:eu.value,onUpdateSV:ed,onComplete:ev}),(0,u.h)("div",{class:`${c}-color-picker-preview`},(0,u.h)("div",{class:`${c}-color-picker-preview__sliders`},(0,u.h)(q,{clsPrefix:c,hue:a,onUpdateHue:ec,onComplete:ev}),e.showAlpha?(0,u.h)(A,{clsPrefix:c,rgba:o,alpha:es.value,onUpdateAlpha:ep,onComplete:ev}):null),e.showPreview?(0,u.h)(X,{clsPrefix:c,mode:er.value,color:eo.value&&(0,l.zv)(eo.value),onUpdateColor:e=>{eh(e,"input")}}):null),(0,u.h)(Z,{clsPrefix:c,showAlpha:e.showAlpha,mode:er.value,modes:n,onUpdateMode:et,value:K.value,valueArr:ei.value,onUpdateValue:eb}),(null==(t=e.swatches)?void 0:t.length)&&(0,u.h)(E,{clsPrefix:c,mode:er.value,swatches:e.swatches,onUpdateColor:e=>{eh(e,"input")}})),(null==s?void 0:s.length)?(0,u.h)("div",{class:`${c}-color-picker-action`},s.includes("confirm")&&(0,u.h)(w.ZP,{size:"small",onClick:ex,theme:d.peers.Button,themeOverrides:d.peerOverrides.Button},{default:()=>M.value.confirm}),s.includes("clear")&&(0,u.h)(w.ZP,{size:"small",onClick:ef,disabled:!K.value,theme:d.peers.Button,themeOverrides:d.peerOverrides.Button},{default:()=>M.value.clear})):null,r.action?(0,u.h)("div",{class:`${c}-color-picker-action`},{default:r.action}):i?(0,u.h)("div",{class:`${c}-color-picker-action`},i.includes("undo")&&(0,u.h)(w.ZP,{size:"small",onClick:eg,disabled:!ek.value,theme:d.peers.Button,themeOverrides:d.peerOverrides.Button},{default:()=>M.value.undo}),i.includes("redo")&&(0,u.h)(w.ZP,{size:"small",onClick:em,disabled:!ew.value,theme:d.peers.Button,themeOverrides:d.peerOverrides.Button},{default:()=>M.value.redo})):null)},cssVars:H?void 0:ey,themeClass:null==eC?void 0:eC.themeClass,onRender:null==eC?void 0:eC.onRender}},render(){let{mergedClsPrefix:e,onRender:r}=this;return null==r||r(),(0,u.h)("div",{class:[this.themeClass,`${e}-color-picker`],ref:"selfRef",style:this.cssVars},(0,u.h)(d.Z,null,{default:()=>[(0,u.h)(c.Z,null,{default:()=>(0,u.h)(_,{clsPrefix:e,value:this.mergedValue,hsla:this.hsla,disabled:this.mergedDisabled,onClick:this.handleTriggerClick})}),(0,u.h)(p.Z,{placement:this.placement,show:this.mergedShow,containerClass:this.namespace,teleportDisabled:this.adjustedTo===f.n.tdkey,to:this.adjustedTo},{default:()=>(0,u.h)(u.uT,{name:"fade-in-scale-up-transition",appear:this.isMounted},{default:()=>this.mergedShow?(0,u.wy)(this.renderPanel(),[[i.Z,this.handleClickOutside,void 0,{capture:!0}]]):null})})]}))}})},79537:function(e,r,t){t.d(r,{Z:()=>s});var l=t(58786),o=t(54470),a=t(27046),i=t(71309);let n=(0,i.cB)("input-group",`
 display: inline-flex;
 width: 100%;
 flex-wrap: nowrap;
 vertical-align: bottom;
`,[(0,i.c)(">",[(0,i.cB)("input",[(0,i.c)("&:not(:last-child)",`
 border-top-right-radius: 0!important;
 border-bottom-right-radius: 0!important;
 `),(0,i.c)("&:not(:first-child)",`
 border-top-left-radius: 0!important;
 border-bottom-left-radius: 0!important;
 margin-left: -1px!important;
 `)]),(0,i.cB)("button",[(0,i.c)("&:not(:last-child)",`
 border-top-right-radius: 0!important;
 border-bottom-right-radius: 0!important;
 `,[(0,i.cE)("state-border, border",`
 border-top-right-radius: 0!important;
 border-bottom-right-radius: 0!important;
 `)]),(0,i.c)("&:not(:first-child)",`
 border-top-left-radius: 0!important;
 border-bottom-left-radius: 0!important;
 `,[(0,i.cE)("state-border, border",`
 border-top-left-radius: 0!important;
 border-bottom-left-radius: 0!important;
 `)])]),(0,i.c)("*",[(0,i.c)("&:not(:last-child)",`
 border-top-right-radius: 0!important;
 border-bottom-right-radius: 0!important;
 `,[(0,i.c)(">",[(0,i.cB)("input",`
 border-top-right-radius: 0!important;
 border-bottom-right-radius: 0!important;
 `),(0,i.cB)("base-selection",[(0,i.cB)("base-selection-label",`
 border-top-right-radius: 0!important;
 border-bottom-right-radius: 0!important;
 `),(0,i.cB)("base-selection-tags",`
 border-top-right-radius: 0!important;
 border-bottom-right-radius: 0!important;
 `),(0,i.cE)("box-shadow, border, state-border",`
 border-top-right-radius: 0!important;
 border-bottom-right-radius: 0!important;
 `)])])]),(0,i.c)("&:not(:first-child)",`
 margin-left: -1px!important;
 border-top-left-radius: 0!important;
 border-bottom-left-radius: 0!important;
 `,[(0,i.c)(">",[(0,i.cB)("input",`
 border-top-left-radius: 0!important;
 border-bottom-left-radius: 0!important;
 `),(0,i.cB)("base-selection",[(0,i.cB)("base-selection-label",`
 border-top-left-radius: 0!important;
 border-bottom-left-radius: 0!important;
 `),(0,i.cB)("base-selection-tags",`
 border-top-left-radius: 0!important;
 border-bottom-left-radius: 0!important;
 `),(0,i.cE)("box-shadow, border, state-border",`
 border-top-left-radius: 0!important;
 border-bottom-left-radius: 0!important;
 `)])])])])])]),s=(0,l.aZ)({name:"InputGroup",props:{},setup(e){let{mergedClsPrefixRef:r}=(0,o.ZP)(e);return(0,a.Z)("-input-group",n,r),{mergedClsPrefix:r}},render(){let{mergedClsPrefix:e}=this;return(0,l.h)("div",{class:`${e}-input-group`},this.$slots)}})}}]);