import{r as R,I as Ue,f as le,l as Fe,i as Ge,j as v,d as Xe,B as Y,X as ge,C as Z,m as J,n as Q,k as ee,p as Ve,q as me}from"./i18n.js";function qe({i18n:e,defaultNS:r,children:n}){const t=R.useMemo(()=>({i18n:e,defaultNS:r}),[e,r]);return R.createElement(Ue.Provider,{value:t},n)}/**
* @license lucide-react v0.468.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ke=le("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
* @license lucide-react v0.468.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ye=le("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
* @license lucide-react v0.468.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ze=le("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function O(e){return/^#[0-9A-Fa-f]{6}$/.test(e)}function Je(e,r=.3){const n=parseInt(e.slice(1,3),16),t=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`rgba(${n}, ${t}, ${i}, ${r})`}/*!
* iro.js v5.5.2
* 2016-2021 James Daniel
* Licensed under MPL 2.0
* github.com/jaames/iro.js
*/var x,U,Se,ie,Ce,M={},ce=[],Qe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;function j(e,r){for(var n in r)e[n]=r[n];return e}function Ie(e){var r=e.parentNode;r&&r.removeChild(e)}function b(e,r,n){var t,i,a,o,s=arguments;if(r=j({},r),arguments.length>3)for(n=[n],t=3;t<arguments.length;t++)n.push(s[t]);if(n!=null&&(r.children=n),e!=null&&e.defaultProps!=null)for(i in e.defaultProps)r[i]===void 0&&(r[i]=e.defaultProps[i]);return o=r.key,(a=r.ref)!=null&&delete r.ref,o!=null&&delete r.key,ae(e,r,o,a)}function ae(e,r,n,t){var i={type:e,props:r,key:n,ref:t,__k:null,__p:null,__b:0,__e:null,l:null,__c:null,constructor:void 0};return x.vnode&&x.vnode(i),i}function X(e){return e.children}function et(e){if(e==null||typeof e=="boolean")return null;if(typeof e=="string"||typeof e=="number")return ae(null,e,null,null);if(e.__e!=null||e.__c!=null){var r=ae(e.type,e.props,e.key,null);return r.__e=e.__e,r}return e}function L(e,r){this.props=e,this.context=r}function F(e,r){if(r==null)return e.__p?F(e.__p,e.__p.__k.indexOf(e)+1):null;for(var n;r<e.__k.length;r++)if((n=e.__k[r])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?F(e):null}function Ne(e){var r,n;if((e=e.__p)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,r=0;r<e.__k.length;r++)if((n=e.__k[r])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Ne(e)}}function te(e){(!e.__d&&(e.__d=!0)&&U.push(e)===1||ie!==x.debounceRendering)&&(ie=x.debounceRendering,(x.debounceRendering||Se)(tt))}function tt(){var e,r,n,t,i,a,o,s;for(U.sort(function(c,u){return u.__v.__b-c.__v.__b});e=U.pop();)e.__d&&(n=void 0,t=void 0,a=(i=(r=e).__v).__e,o=r.__P,s=r.u,r.u=!1,o&&(n=[],t=ue(o,i,j({},i),r.__n,o.ownerSVGElement!==void 0,null,n,s,a??F(i)),je(n,i),t!=a&&Ne(i)))}function Re(e,r,n,t,i,a,o,s,c){var u,h,l,d,f,y,_,p=n&&n.__k||ce,m=p.length;if(s==M&&(s=a!=null?a[0]:m?F(n,0):null),u=0,r.__k=he(r.__k,function(g){if(g!=null){if(g.__p=r,g.__b=r.__b+1,(l=p[u])===null||l&&g.key==l.key&&g.type===l.type)p[u]=void 0;else for(h=0;h<m;h++){if((l=p[h])&&g.key==l.key&&g.type===l.type){p[h]=void 0;break}l=null}if(d=ue(e,g,l=l||M,t,i,a,o,null,s,c),(h=g.ref)&&l.ref!=h&&(_||(_=[])).push(h,g.__c||d,g),d!=null){if(y==null&&(y=d),g.l!=null)d=g.l,g.l=null;else if(a==l||d!=s||d.parentNode==null){e:if(s==null||s.parentNode!==e)e.appendChild(d);else{for(f=s,h=0;(f=f.nextSibling)&&h<m;h+=2)if(f==d)break e;e.insertBefore(d,s)}r.type=="option"&&(e.value="")}s=d.nextSibling,typeof r.type=="function"&&(r.l=d)}}return u++,g}),r.__e=y,a!=null&&typeof r.type!="function")for(u=a.length;u--;)a[u]!=null&&Ie(a[u]);for(u=m;u--;)p[u]!=null&&Ae(p[u],p[u]);if(_)for(u=0;u<_.length;u++)Me(_[u],_[++u],_[++u])}function he(e,r,n){if(n==null&&(n=[]),e==null||typeof e=="boolean")r&&n.push(r(null));else if(Array.isArray(e))for(var t=0;t<e.length;t++)he(e[t],r,n);else n.push(r?r(et(e)):e);return n}function rt(e,r,n,t,i){var a;for(a in n)a in r||be(e,a,null,n[a],t);for(a in r)i&&typeof r[a]!="function"||a==="value"||a==="checked"||n[a]===r[a]||be(e,a,r[a],n[a],t)}function _e(e,r,n){r[0]==="-"?e.setProperty(r,n):e[r]=typeof n=="number"&&Qe.test(r)===!1?n+"px":n??""}function be(e,r,n,t,i){var a,o,s,c,u;if(!((r=i?r==="className"?"class":r:r==="class"?"className":r)==="key"||r==="children"))if(r==="style")if(a=e.style,typeof n=="string")a.cssText=n;else{if(typeof t=="string"&&(a.cssText="",t=null),t)for(o in t)n&&o in n||_e(a,o,"");if(n)for(s in n)t&&n[s]===t[s]||_e(a,s,n[s])}else r[0]==="o"&&r[1]==="n"?(c=r!==(r=r.replace(/Capture$/,"")),u=r.toLowerCase(),r=(u in e?u:r).slice(2),n?(t||e.addEventListener(r,xe,c),(e.t||(e.t={}))[r]=n):e.removeEventListener(r,xe,c)):r!=="list"&&r!=="tagName"&&r!=="form"&&!i&&r in e?e[r]=n??"":typeof n!="function"&&r!=="dangerouslySetInnerHTML"&&(r!==(r=r.replace(/^xlink:?/,""))?n==null||n===!1?e.removeAttributeNS("http://www.w3.org/1999/xlink",r.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",r.toLowerCase(),n):n==null||n===!1?e.removeAttribute(r):e.setAttribute(r,n))}function xe(e){return this.t[e.type](x.event?x.event(e):e)}function ue(e,r,n,t,i,a,o,s,c,u){var h,l,d,f,y,_,p,m,g,N,I=r.type;if(r.constructor!==void 0)return null;(h=x.__b)&&h(r);try{e:if(typeof I=="function"){if(m=r.props,g=(h=I.contextType)&&t[h.__c],N=h?g?g.props.value:h.__p:t,n.__c?p=(l=r.__c=n.__c).__p=l.__E:("prototype"in I&&I.prototype.render?r.__c=l=new I(m,N):(r.__c=l=new L(m,N),l.constructor=I,l.render=it),g&&g.sub(l),l.props=m,l.state||(l.state={}),l.context=N,l.__n=t,d=l.__d=!0,l.__h=[]),l.__s==null&&(l.__s=l.state),I.getDerivedStateFromProps!=null&&j(l.__s==l.state?l.__s=j({},l.__s):l.__s,I.getDerivedStateFromProps(m,l.__s)),d)I.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&o.push(l);else{if(I.getDerivedStateFromProps==null&&s==null&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(m,N),!s&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(m,l.__s,N)===!1){for(l.props=m,l.state=l.__s,l.__d=!1,l.__v=r,r.__e=c!=null?c!==n.__e?c:n.__e:null,r.__k=n.__k,h=0;h<r.__k.length;h++)r.__k[h]&&(r.__k[h].__p=r);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(m,l.__s,N)}for(f=l.props,y=l.state,l.context=N,l.props=m,l.state=l.__s,(h=x.__r)&&h(r),l.__d=!1,l.__v=r,l.__P=e,h=l.render(l.props,l.state,l.context),r.__k=he(h!=null&&h.type==X&&h.key==null?h.props.children:h),l.getChildContext!=null&&(t=j(j({},t),l.getChildContext())),d||l.getSnapshotBeforeUpdate==null||(_=l.getSnapshotBeforeUpdate(f,y)),Re(e,r,n,t,i,a,o,c,u),l.base=r.__e;h=l.__h.pop();)l.__s&&(l.state=l.__s),h.call(l);d||f==null||l.componentDidUpdate==null||l.componentDidUpdate(f,y,_),p&&(l.__E=l.__p=null)}else r.__e=nt(n.__e,r,n,t,i,a,o,u);(h=x.diffed)&&h(r)}catch(ze){x.__e(ze,r,n)}return r.__e}function je(e,r){for(var n;n=e.pop();)try{n.componentDidMount()}catch(t){x.__e(t,n.__v)}x.__c&&x.__c(r)}function nt(e,r,n,t,i,a,o,s){var c,u,h,l,d=n.props,f=r.props;if(i=r.type==="svg"||i,e==null&&a!=null){for(c=0;c<a.length;c++)if((u=a[c])!=null&&(r.type===null?u.nodeType===3:u.localName===r.type)){e=u,a[c]=null;break}}if(e==null){if(r.type===null)return document.createTextNode(f);e=i?document.createElementNS("http://www.w3.org/2000/svg",r.type):document.createElement(r.type),a=null}return r.type===null?d!==f&&(a!=null&&(a[a.indexOf(e)]=null),e.data=f):r!==n&&(a!=null&&(a=ce.slice.call(e.childNodes)),h=(d=n.props||M).dangerouslySetInnerHTML,l=f.dangerouslySetInnerHTML,s||(l||h)&&(l&&h&&l.__html==h.__html||(e.innerHTML=l&&l.__html||"")),rt(e,f,d,i,s),r.__k=r.props.children,l||Re(e,r,n,t,r.type!=="foreignObject"&&i,a,o,M,s),s||("value"in f&&f.value!==void 0&&f.value!==e.value&&(e.value=f.value==null?"":f.value),"checked"in f&&f.checked!==void 0&&f.checked!==e.checked&&(e.checked=f.checked))),e}function Me(e,r,n){try{typeof e=="function"?e(r):e.current=r}catch(t){x.__e(t,n)}}function Ae(e,r,n){var t,i,a;if(x.unmount&&x.unmount(e),(t=e.ref)&&Me(t,null,r),n||typeof e.type=="function"||(n=(i=e.__e)!=null),e.__e=e.l=null,(t=e.__c)!=null){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(o){x.__e(o,r)}t.base=t.__P=null}if(t=e.__k)for(a=0;a<t.length;a++)t[a]&&Ae(t[a],r,n);i!=null&&Ie(i)}function it(e,r,n){return this.constructor(e,n)}function at(e,r,n){var t,i,a;x.__p&&x.__p(e,r),i=(t=n===Ce)?null:r.__k,e=b(X,null,[e]),a=[],ue(r,r.__k=e,i||M,M,r.ownerSVGElement!==void 0,i?null:ce.slice.call(r.childNodes),a,!1,M,t),je(a,e)}x={},L.prototype.setState=function(e,r){var n=this.__s!==this.state&&this.__s||(this.__s=j({},this.state));(typeof e!="function"||(e=e(n,this.props)))&&j(n,e),e!=null&&this.__v&&(this.u=!1,r&&this.__h.push(r),te(this))},L.prototype.forceUpdate=function(e){this.__v&&(e&&this.__h.push(e),this.u=!0,te(this))},L.prototype.render=X,U=[],Se=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ie=x.debounceRendering,x.__e=function(e,r,n){for(var t;r=r.__p;)if((t=r.__c)&&!t.__p)try{if(t.constructor&&t.constructor.getDerivedStateFromError!=null)t.setState(t.constructor.getDerivedStateFromError(e));else{if(t.componentDidCatch==null)continue;t.componentDidCatch(e)}return te(t.__E=t)}catch(i){e=i}throw e},Ce=M;function ot(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function st(e,r,n){return r&&ot(e.prototype,r),e}function S(){return S=Object.assign||function(e){for(var r=arguments,n=1;n<arguments.length;n++){var t=r[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},S.apply(this,arguments)}var lt="[-\\+]?\\d+%?",ct="[-\\+]?\\d*\\.\\d+%?",P="(?:"+ct+")|(?:"+lt+")",Pe="[\\s|\\(]+("+P+")[,|\\s]+("+P+")[,|\\s]+("+P+")\\s*\\)?",Te="[\\s|\\(]+("+P+")[,|\\s]+("+P+")[,|\\s]+("+P+")[,|\\s]+("+P+")\\s*\\)?",ht=new RegExp("rgb"+Pe),ut=new RegExp("rgba"+Te),dt=new RegExp("hsl"+Pe),ft=new RegExp("hsla"+Te),V="^(?:#?|0x?)",T="([0-9a-fA-F]{1})",H="([0-9a-fA-F]{2})",vt=new RegExp(V+T+T+T+"$"),gt=new RegExp(V+T+T+T+T+"$"),mt=new RegExp(V+H+H+H+"$"),_t=new RegExp(V+H+H+H+H+"$"),bt=2e3,xt=4e4,z=Math.log,$=Math.round,B=Math.floor;function C(e,r,n){return Math.min(Math.max(e,r),n)}function k(e,r){var n=e.indexOf("%")>-1,t=parseFloat(e);return n?r/100*t:t}function E(e){return parseInt(e,16)}function A(e){return e.toString(16).padStart(2,"0")}var W=(function(){function e(n,t){this.$={h:0,s:0,v:0,a:1},n&&this.set(n),this.onChange=t,this.initialValue=S({},this.$)}var r=e.prototype;return r.set=function(t){if(typeof t=="string")/^(?:#?|0x?)[0-9a-fA-F]{3,8}$/.test(t)?this.hexString=t:/^rgba?/.test(t)?this.rgbString=t:/^hsla?/.test(t)&&(this.hslString=t);else if(typeof t=="object")t instanceof e?this.hsva=t.hsva:"r"in t&&"g"in t&&"b"in t?this.rgb=t:"h"in t&&"s"in t&&"v"in t?this.hsv=t:"h"in t&&"s"in t&&"l"in t?this.hsl=t:"kelvin"in t&&(this.kelvin=t.kelvin);else throw new Error("Invalid color value")},r.setChannel=function(t,i,a){var o;this[t]=S({},this[t],(o={},o[i]=a,o))},r.reset=function(){this.hsva=this.initialValue},r.clone=function(){return new e(this)},r.unbind=function(){this.onChange=void 0},e.hsvToRgb=function(t){var i=t.h/60,a=t.s/100,o=t.v/100,s=B(i),c=i-s,u=o*(1-a),h=o*(1-c*a),l=o*(1-(1-c)*a),d=s%6,f=[o,h,u,u,l,o][d],y=[l,o,o,h,u,u][d],_=[u,u,l,o,o,h][d];return{r:C(f*255,0,255),g:C(y*255,0,255),b:C(_*255,0,255)}},e.rgbToHsv=function(t){var i=t.r/255,a=t.g/255,o=t.b/255,s=Math.max(i,a,o),c=Math.min(i,a,o),u=s-c,h=0,l=s,d=s===0?0:u/s;switch(s){case c:h=0;break;case i:h=(a-o)/u+(a<o?6:0);break;case a:h=(o-i)/u+2;break;case o:h=(i-a)/u+4;break}return{h:h*60%360,s:C(d*100,0,100),v:C(l*100,0,100)}},e.hsvToHsl=function(t){var i=t.s/100,a=t.v/100,o=(2-i)*a,s=o<=1?o:2-o,c=s<1e-9?0:i*a/s;return{h:t.h,s:C(c*100,0,100),l:C(o*50,0,100)}},e.hslToHsv=function(t){var i=t.l*2,a=t.s*(i<=100?i:200-i)/100,o=i+a<1e-9?0:2*a/(i+a);return{h:t.h,s:C(o*100,0,100),v:C((i+a)/2,0,100)}},e.kelvinToRgb=function(t){var i=t/100,a,o,s;return i<66?(a=255,o=-155.25485562709179-.44596950469579133*(o=i-2)+104.49216199393888*z(o),s=i<20?0:-254.76935184120902+.8274096064007395*(s=i-10)+115.67994401066147*z(s)):(a=351.97690566805693+.114206453784165*(a=i-55)-40.25366309332127*z(a),o=325.4494125711974+.07943456536662342*(o=i-50)-28.0852963507957*z(o),s=255),{r:C(B(a),0,255),g:C(B(o),0,255),b:C(B(s),0,255)}},e.rgbToKelvin=function(t){for(var i=t.r,a=t.b,o=.4,s=bt,c=xt,u;c-s>o;){u=(c+s)*.5;var h=e.kelvinToRgb(u);h.b/h.r>=a/i?c=u:s=u}return u},st(e,[{key:"hsv",get:function(){var t=this.$;return{h:t.h,s:t.s,v:t.v}},set:function(t){var i=this.$;if(t=S({},i,t),this.onChange){var a={h:!1,v:!1,s:!1,a:!1};for(var o in i)a[o]=t[o]!=i[o];this.$=t,(a.h||a.s||a.v||a.a)&&this.onChange(this,a)}else this.$=t}},{key:"hsva",get:function(){return S({},this.$)},set:function(t){this.hsv=t}},{key:"hue",get:function(){return this.$.h},set:function(t){this.hsv={h:t}}},{key:"saturation",get:function(){return this.$.s},set:function(t){this.hsv={s:t}}},{key:"value",get:function(){return this.$.v},set:function(t){this.hsv={v:t}}},{key:"alpha",get:function(){return this.$.a},set:function(t){this.hsv=S({},this.hsv,{a:t})}},{key:"kelvin",get:function(){return e.rgbToKelvin(this.rgb)},set:function(t){this.rgb=e.kelvinToRgb(t)}},{key:"red",get:function(){var t=this.rgb;return t.r},set:function(t){this.rgb=S({},this.rgb,{r:t})}},{key:"green",get:function(){var t=this.rgb;return t.g},set:function(t){this.rgb=S({},this.rgb,{g:t})}},{key:"blue",get:function(){var t=this.rgb;return t.b},set:function(t){this.rgb=S({},this.rgb,{b:t})}},{key:"rgb",get:function(){var t=e.hsvToRgb(this.$),i=t.r,a=t.g,o=t.b;return{r:$(i),g:$(a),b:$(o)}},set:function(t){this.hsv=S({},e.rgbToHsv(t),{a:t.a===void 0?1:t.a})}},{key:"rgba",get:function(){return S({},this.rgb,{a:this.alpha})},set:function(t){this.rgb=t}},{key:"hsl",get:function(){var t=e.hsvToHsl(this.$),i=t.h,a=t.s,o=t.l;return{h:$(i),s:$(a),l:$(o)}},set:function(t){this.hsv=S({},e.hslToHsv(t),{a:t.a===void 0?1:t.a})}},{key:"hsla",get:function(){return S({},this.hsl,{a:this.alpha})},set:function(t){this.hsl=t}},{key:"rgbString",get:function(){var t=this.rgb;return"rgb("+t.r+", "+t.g+", "+t.b+")"},set:function(t){var i,a,o,s,c=1;if((i=ht.exec(t))?(a=k(i[1],255),o=k(i[2],255),s=k(i[3],255)):(i=ut.exec(t))&&(a=k(i[1],255),o=k(i[2],255),s=k(i[3],255),c=k(i[4],1)),i)this.rgb={r:a,g:o,b:s,a:c};else throw new Error("Invalid rgb string")}},{key:"rgbaString",get:function(){var t=this.rgba;return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},set:function(t){this.rgbString=t}},{key:"hexString",get:function(){var t=this.rgb;return"#"+A(t.r)+A(t.g)+A(t.b)},set:function(t){var i,a,o,s,c=255;if((i=vt.exec(t))?(a=E(i[1])*17,o=E(i[2])*17,s=E(i[3])*17):(i=gt.exec(t))?(a=E(i[1])*17,o=E(i[2])*17,s=E(i[3])*17,c=E(i[4])*17):(i=mt.exec(t))?(a=E(i[1]),o=E(i[2]),s=E(i[3])):(i=_t.exec(t))&&(a=E(i[1]),o=E(i[2]),s=E(i[3]),c=E(i[4])),i)this.rgb={r:a,g:o,b:s,a:c/255};else throw new Error("Invalid hex string")}},{key:"hex8String",get:function(){var t=this.rgba;return"#"+A(t.r)+A(t.g)+A(t.b)+A(B(t.a*255))},set:function(t){this.hexString=t}},{key:"hslString",get:function(){var t=this.hsl;return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},set:function(t){var i,a,o,s,c=1;if((i=dt.exec(t))?(a=k(i[1],360),o=k(i[2],100),s=k(i[3],100)):(i=ft.exec(t))&&(a=k(i[1],360),o=k(i[2],100),s=k(i[3],100),c=k(i[4],1)),i)this.hsl={h:a,s:o,l:s,a:c};else throw new Error("Invalid hsl string")}},{key:"hslaString",get:function(){var t=this.hsla;return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},set:function(t){this.hslString=t}}]),e})(),yt={sliderShape:"bar",sliderType:"value",minTemperature:2200,maxTemperature:11e3};function de(e){var r,n=e.width,t=e.sliderSize,i=e.borderWidth,a=e.handleRadius,o=e.padding,s=e.sliderShape,c=e.layoutDirection==="horizontal";return t=(r=t)!=null?r:o*2+a*2,s==="circle"?{handleStart:e.padding+e.handleRadius,handleRange:n-o*2-a*2,width:n,height:n,cx:n/2,cy:n/2,radius:n/2-i/2}:{handleStart:t/2,handleRange:n-t,radius:t/2,x:0,y:0,width:c?t:n,height:c?n:t}}function pt(e,r){var n=r.hsva,t=r.rgb;switch(e.sliderType){case"red":return t.r/2.55;case"green":return t.g/2.55;case"blue":return t.b/2.55;case"alpha":return n.a*100;case"kelvin":var i=e.minTemperature,a=e.maxTemperature,o=a-i,s=(r.kelvin-i)/o*100;return Math.max(0,Math.min(s,100));case"hue":return n.h/=3.6;case"saturation":return n.s;case"value":default:return n.v}}function wt(e,r,n){var t=de(e),i=t.handleRange,a=t.handleStart,o;e.layoutDirection==="horizontal"?o=-1*n+i+a:o=r-a,o=Math.max(Math.min(o,i),0);var s=Math.round(100/i*o);switch(e.sliderType){case"kelvin":var c=e.minTemperature,u=e.maxTemperature,h=u-c;return c+h*(s/100);case"alpha":return s/100;case"hue":return s*3.6;case"red":case"blue":case"green":return s*2.55;default:return s}}function kt(e,r){var n=de(e),t=n.width,i=n.height,a=n.handleRange,o=n.handleStart,s=e.layoutDirection==="horizontal",c=pt(e,r),u=s?t/2:i/2,h=o+c/100*a;return s&&(h=-1*h+a+o*2),{x:s?u:h,y:s?h:u}}function Et(e,r){var n=r.hsv,t=r.rgb;switch(e.sliderType){case"red":return[[0,"rgb(0,"+t.g+","+t.b+")"],[100,"rgb(255,"+t.g+","+t.b+")"]];case"green":return[[0,"rgb("+t.r+",0,"+t.b+")"],[100,"rgb("+t.r+",255,"+t.b+")"]];case"blue":return[[0,"rgb("+t.r+","+t.g+",0)"],[100,"rgb("+t.r+","+t.g+",255)"]];case"alpha":return[[0,"rgba("+t.r+","+t.g+","+t.b+",0)"],[100,"rgb("+t.r+","+t.g+","+t.b+")"]];case"kelvin":for(var i=[],a=e.minTemperature,o=e.maxTemperature,s=8,c=o-a,u=a,h=0;u<o;u+=c/s,h+=1){var l=W.kelvinToRgb(u),d=l.r,f=l.g,y=l.b;i.push([100/s*h,"rgb("+d+","+f+","+y+")"])}return i;case"hue":return[[0,"#f00"],[16.666,"#ff0"],[33.333,"#0f0"],[50,"#0ff"],[66.666,"#00f"],[83.333,"#f0f"],[100,"#f00"]];case"saturation":var _=W.hsvToHsl({h:n.h,s:0,v:n.v}),p=W.hsvToHsl({h:n.h,s:100,v:n.v});return[[0,"hsl("+_.h+","+_.s+"%,"+_.l+"%)"],[100,"hsl("+p.h+","+p.s+"%,"+p.l+"%)"]];case"value":default:var m=W.hsvToHsl({h:n.h,s:n.s,v:100});return[[0,"#000"],[100,"hsl("+m.h+","+m.s+"%,"+m.l+"%)"]]}}var He=Math.PI*2,St=function(r,n){return(r%n+n)%n},De=function(r,n){return Math.sqrt(r*r+n*n)};function Oe(e){return e.width/2-e.padding-e.handleRadius-e.borderWidth}function Ct(e,r,n){var t=q(e),i=t.cx,a=t.cy,o=e.width/2;return De(i-r,a-n)<o}function q(e){var r=e.width/2;return{width:e.width,radius:r-e.borderWidth,cx:r,cy:r}}function $e(e,r,n){var t=e.wheelAngle,i=e.wheelDirection;return n&&i==="clockwise"?r=t+r:i==="clockwise"?r=360-t+r:n&&i==="anticlockwise"?r=t+180-r:i==="anticlockwise"&&(r=t-r),St(r,360)}function It(e,r){var n=r.hsv,t=q(e),i=t.cx,a=t.cy,o=Oe(e),s=(180+$e(e,n.h,!0))*(He/360),c=n.s/100*o,u=e.wheelDirection==="clockwise"?-1:1;return{x:i+c*Math.cos(s)*u,y:a+c*Math.sin(s)*u}}function ye(e,r,n){var t=q(e),i=t.cx,a=t.cy,o=Oe(e);r=i-r,n=a-n;var s=$e(e,Math.atan2(-n,-r)*(360/He)),c=Math.min(De(r,n),o);return{h:Math.round(s),s:Math.round(100/o*c)}}function fe(e){var r=e.width,n=e.boxHeight,t=e.padding,i=e.handleRadius;return{width:r,height:n??r,radius:t+i}}function pe(e,r,n){var t=fe(e),i=t.width,a=t.height,o=t.radius,s=o,c=i-o*2,u=a-o*2,h=(r-s)/c*100,l=(n-s)/u*100;return{s:Math.max(0,Math.min(h,100)),v:Math.max(0,Math.min(100-l,100))}}function Nt(e,r){var n=fe(e),t=n.width,i=n.height,a=n.radius,o=r.hsv,s=a,c=t-a*2,u=i-a*2;return{x:s+o.s/100*c,y:s+(u-o.v/100*u)}}function Rt(e,r){var n=r.hue;return[[[0,"#fff"],[100,"hsl("+n+",100%,50%)"]],[[0,"rgba(0,0,0,0)"],[100,"#000"]]]}var re;function jt(e){re||(re=document.getElementsByTagName("base"));var r=window.navigator.userAgent,n=/^((?!chrome|android).)*safari/i.test(r),t=/iPhone|iPod|iPad/i.test(r),i=window.location;return(n||t)&&re.length>0?i.protocol+"//"+i.host+i.pathname+i.search+e:e}function We(e,r,n,t){for(var i=0;i<t.length;i++){var a=t[i].x-r,o=t[i].y-n,s=Math.sqrt(a*a+o*o);if(s<e.handleRadius)return i}return null}function ve(e){return{boxSizing:"border-box",border:e.borderWidth+"px solid "+e.borderColor}}function oe(e,r,n){return e+"-gradient("+r+", "+n.map(function(t){var i=t[0],a=t[1];return a+" "+i+"%"}).join(",")+")"}function w(e){return typeof e=="string"?e:e+"px"}var Mt={width:300,height:300,color:"#fff",colors:[],padding:6,layoutDirection:"vertical",borderColor:"#fff",borderWidth:0,handleRadius:8,activeHandleRadius:null,handleSvg:null,handleProps:{x:0,y:0},wheelLightness:!0,wheelAngle:0,wheelDirection:"anticlockwise",sliderSize:null,sliderMargin:12,boxHeight:null},we=["mousemove","touchmove","mouseup","touchend"],K=(function(e){function r(n){e.call(this,n),this.uid=(Math.random()+1).toString(36).substring(5)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.render=function(t){var i=this.handleEvent.bind(this),a={onMouseDown:i,ontouchstart:i},o=t.layoutDirection==="horizontal",s=t.margin===null?t.sliderMargin:t.margin,c={overflow:"visible",display:o?"inline-block":"block"};return t.index>0&&(c[o?"marginLeft":"marginTop"]=s),b(X,null,t.children(this.uid,a,c))},r.prototype.handleEvent=function(t){var i=this,a=this.props.onInput,o=this.base.getBoundingClientRect();t.preventDefault();var s=t.touches?t.changedTouches[0]:t,c=s.clientX-o.left,u=s.clientY-o.top;switch(t.type){case"mousedown":case"touchstart":var h=a(c,u,0);h!==!1&&we.forEach(function(l){document.addEventListener(l,i,{passive:!1})});break;case"mousemove":case"touchmove":a(c,u,1);break;case"mouseup":case"touchend":a(c,u,2),we.forEach(function(l){document.removeEventListener(l,i,{passive:!1})});break}},r})(L);function D(e){var r=e.r,n=e.url,t=r,i=r;return b("svg",{className:"IroHandle IroHandle--"+e.index+" "+(e.isActive?"IroHandle--isActive":""),style:{"-webkit-tap-highlight-color":"rgba(0, 0, 0, 0);",transform:"translate("+w(e.x)+", "+w(e.y)+")",willChange:"transform",top:w(-r),left:w(-r),width:w(r*2),height:w(r*2),position:"absolute",overflow:"visible"}},n&&b("use",Object.assign({xlinkHref:jt(n)},e.props)),!n&&b("circle",{cx:t,cy:i,r,fill:"none","stroke-width":2,stroke:"#000"}),!n&&b("circle",{cx:t,cy:i,r:r-2,fill:e.fill,"stroke-width":2,stroke:"#fff"}))}D.defaultProps={fill:"none",x:0,y:0,r:8,url:null,props:{x:0,y:0}};function G(e){var r=e.activeIndex,n=r!==void 0&&r<e.colors.length?e.colors[r]:e.color,t=de(e),i=t.width,a=t.height,o=t.radius,s=kt(e,n),c=Et(e,n);function u(h,l,d){var f=wt(e,h,l);e.parent.inputActive=!0,n[e.sliderType]=f,e.onInput(d,e.id)}return b(K,Object.assign({},e,{onInput:u}),function(h,l,d){return b("div",Object.assign({},l,{className:"IroSlider",style:Object.assign({},{position:"relative",width:w(i),height:w(a),borderRadius:w(o),background:"conic-gradient(#ccc 25%, #fff 0 50%, #ccc 0 75%, #fff 0)",backgroundSize:"8px 8px"},d)}),b("div",{className:"IroSliderGradient",style:Object.assign({},{position:"absolute",top:0,left:0,width:"100%",height:"100%",borderRadius:w(o),background:oe("linear",e.layoutDirection==="horizontal"?"to top":"to right",c)},ve(e))}),b(D,{isActive:!0,index:n.index,r:e.handleRadius,url:e.handleSvg,props:e.handleProps,x:s.x,y:s.y}))})}G.defaultProps=Object.assign({},yt);function At(e){var r=fe(e),n=r.width,t=r.height,i=r.radius,a=e.colors,o=e.parent,s=e.activeIndex,c=s!==void 0&&s<e.colors.length?e.colors[s]:e.color,u=Rt(e,c),h=a.map(function(d){return Nt(e,d)});function l(d,f,y){if(y===0){var _=We(e,d,f,h);_!==null?o.setActiveColor(_):(o.inputActive=!0,c.hsv=pe(e,d,f),e.onInput(y,e.id))}else y===1&&(o.inputActive=!0,c.hsv=pe(e,d,f));e.onInput(y,e.id)}return b(K,Object.assign({},e,{onInput:l}),function(d,f,y){return b("div",Object.assign({},f,{className:"IroBox",style:Object.assign({},{width:w(n),height:w(t),position:"relative"},y)}),b("div",{className:"IroBox",style:Object.assign({},{width:"100%",height:"100%",borderRadius:w(i)},ve(e),{background:oe("linear","to bottom",u[1])+","+oe("linear","to right",u[0])})}),a.filter(function(_){return _!==c}).map(function(_){return b(D,{isActive:!1,index:_.index,fill:_.hslString,r:e.handleRadius,url:e.handleSvg,props:e.handleProps,x:h[_.index].x,y:h[_.index].y})}),b(D,{isActive:!0,index:c.index,fill:c.hslString,r:e.activeHandleRadius||e.handleRadius,url:e.handleSvg,props:e.handleProps,x:h[c.index].x,y:h[c.index].y}))})}var Pt="conic-gradient(red, yellow, lime, aqua, blue, magenta, red)",Tt="conic-gradient(red, magenta, blue, aqua, lime, yellow, red)";function Le(e){var r=q(e),n=r.width,t=e.colors;e.borderWidth;var i=e.parent,a=e.color,o=a.hsv,s=t.map(function(h){return It(e,h)}),c={position:"absolute",top:0,left:0,width:"100%",height:"100%",borderRadius:"50%",boxSizing:"border-box"};function u(h,l,d){if(d===0){if(!Ct(e,h,l))return!1;var f=We(e,h,l,s);f!==null?i.setActiveColor(f):(i.inputActive=!0,a.hsv=ye(e,h,l),e.onInput(d,e.id))}else d===1&&(i.inputActive=!0,a.hsv=ye(e,h,l));e.onInput(d,e.id)}return b(K,Object.assign({},e,{onInput:u}),function(h,l,d){return b("div",Object.assign({},l,{className:"IroWheel",style:Object.assign({},{width:w(n),height:w(n),position:"relative"},d)}),b("div",{className:"IroWheelHue",style:Object.assign({},c,{transform:"rotateZ("+(e.wheelAngle+90)+"deg)",background:e.wheelDirection==="clockwise"?Pt:Tt})}),b("div",{className:"IroWheelSaturation",style:Object.assign({},c,{background:"radial-gradient(circle closest-side, #fff, transparent)"})}),e.wheelLightness&&b("div",{className:"IroWheelLightness",style:Object.assign({},c,{background:"#000",opacity:1-o.v/100})}),b("div",{className:"IroWheelBorder",style:Object.assign({},c,ve(e))}),t.filter(function(f){return f!==a}).map(function(f){return b(D,{isActive:!1,index:f.index,fill:f.hslString,r:e.handleRadius,url:e.handleSvg,props:e.handleProps,x:s[f.index].x,y:s[f.index].y})}),b(D,{isActive:!0,index:a.index,fill:a.hslString,r:e.activeHandleRadius||e.handleRadius,url:e.handleSvg,props:e.handleProps,x:s[a.index].x,y:s[a.index].y}))})}function Ht(e){var r=function(n,t){var i,a=document.createElement("div");at(b(e,Object.assign({},{ref:function(s){return i=s}},t)),a);function o(){var s=n instanceof Element?n:document.querySelector(n);s.appendChild(i.base),i.onMount(s)}return document.readyState!=="loading"?o():document.addEventListener("DOMContentLoaded",o),i};return r.prototype=e.prototype,Object.assign(r,e),r.__component=e,r}var Be=(function(e){function r(n){var t=this;e.call(this,n),this.colors=[],this.inputActive=!1,this.events={},this.activeEvents={},this.deferredEvents={},this.id=n.id;var i=n.colors.length>0?n.colors:[n.color];i.forEach(function(a){return t.addColor(a)}),this.setActiveColor(0),this.state=Object.assign({},n,{color:this.color,colors:this.colors,layout:n.layout})}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.addColor=function(t,i){i===void 0&&(i=this.colors.length);var a=new W(t,this.onColorChange.bind(this));this.colors.splice(i,0,a),this.colors.forEach(function(o,s){return o.index=s}),this.state&&this.setState({colors:this.colors}),this.deferredEmit("color:init",a)},r.prototype.removeColor=function(t){var i=this.colors.splice(t,1)[0];i.unbind(),this.colors.forEach(function(a,o){return a.index=o}),this.state&&this.setState({colors:this.colors}),i.index===this.color.index&&this.setActiveColor(0),this.emit("color:remove",i)},r.prototype.setActiveColor=function(t){this.color=this.colors[t],this.state&&this.setState({color:this.color}),this.emit("color:setActive",this.color)},r.prototype.setColors=function(t,i){var a=this;i===void 0&&(i=0),this.colors.forEach(function(o){return o.unbind()}),this.colors=[],t.forEach(function(o){return a.addColor(o)}),this.setActiveColor(i),this.emit("color:setAll",this.colors)},r.prototype.on=function(t,i){var a=this,o=this.events;(Array.isArray(t)?t:[t]).forEach(function(s){(o[s]||(o[s]=[])).push(i),a.deferredEvents[s]&&(a.deferredEvents[s].forEach(function(c){i.apply(null,c)}),a.deferredEvents[s]=[])})},r.prototype.off=function(t,i){var a=this;(Array.isArray(t)?t:[t]).forEach(function(o){var s=a.events[o];s&&s.splice(s.indexOf(i),1)})},r.prototype.emit=function(t){for(var i=this,a=[],o=arguments.length-1;o-- >0;)a[o]=arguments[o+1];var s=this.activeEvents,c=s.hasOwnProperty(t)?s[t]:!1;if(!c){s[t]=!0;var u=this.events[t]||[];u.forEach(function(h){return h.apply(i,a)}),s[t]=!1}},r.prototype.deferredEmit=function(t){for(var i,a=[],o=arguments.length-1;o-- >0;)a[o]=arguments[o+1];var s=this.deferredEvents;(i=this).emit.apply(i,[t].concat(a)),(s[t]||(s[t]=[])).push(a)},r.prototype.setOptions=function(t){this.setState(t)},r.prototype.resize=function(t){this.setOptions({width:t})},r.prototype.reset=function(){this.colors.forEach(function(t){return t.reset()}),this.setState({colors:this.colors})},r.prototype.onMount=function(t){this.el=t,this.deferredEmit("mount",this)},r.prototype.onColorChange=function(t,i){this.setState({color:this.color}),this.inputActive&&(this.inputActive=!1,this.emit("input:change",t,i)),this.emit("color:change",t,i)},r.prototype.emitInputEvent=function(t,i){t===0?this.emit("input:start",this.color,i):t===1?this.emit("input:move",this.color,i):t===2&&this.emit("input:end",this.color,i)},r.prototype.render=function(t,i){var a=this,o=i.layout;return Array.isArray(o)||(o=[{component:Le},{component:G}],i.transparency&&o.push({component:G,options:{sliderType:"alpha"}})),b("div",{class:"IroColorPicker",id:i.id,style:{display:i.display}},o.map(function(s,c){var u=s.component,h=s.options;return b(u,Object.assign({},i,h,{ref:void 0,onInput:a.emitInputEvent.bind(a),parent:a,index:c}))}))},r})(L);Be.defaultProps=Object.assign({},Mt,{colors:[],display:"block",id:null,layout:"default",margin:null});var Dt=Ht(Be),se;(function(e){e.version="5.5.2",e.Color=W,e.ColorPicker=Dt,(function(r){r.h=b,r.ComponentBase=K,r.Handle=D,r.Slider=G,r.Wheel=Le,r.Box=At})(e.ui||(e.ui={}))})(se||(se={}));var ne=se;function Ot({selectedText:e,existingComment:r,onSave:n,onCancel:t}){const i=Fe(),{t:a}=Ge(),[o,s]=R.useState(r?.text||""),[c,u]=R.useState(r?.highlightColor?.border||"#FFEB3B"),[h,l]=R.useState(null),d=R.useRef(null);R.useEffect(()=>{if(d.current&&!h){const m=new ne.ColorPicker(d.current,{width:200,color:c,borderWidth:2,borderColor:"#fff",layout:[{component:ne.ui.Wheel,options:{}},{component:ne.ui.Slider,options:{sliderType:"value"}}]});m.on("color:change",g=>{u(g.hexString.toUpperCase())}),l(m)}return()=>{h&&h.off("color:change")}},[h]),R.useEffect(()=>{const m=g=>{(g.ctrlKey||g.metaKey)&&g.key==="Enter"?(g.preventDefault(),f()):g.key==="Escape"&&(g.preventDefault(),t())};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[o,c,t]);const f=()=>{o.trim()&&O(c)&&n(o.trim(),c)},y=m=>{const g=m.target.value.toUpperCase();O(g)?(u(g),h&&(h.color.hexString=g)):u(g)},_=()=>O(c)?{backgroundColor:Je(c,.3),borderColor:c,borderWidth:"2px"}:{},p=o.trim().length>0&&O(c);return v.jsxs("div",{className:Xe("h-full flex flex-col overflow-hidden p-6",`vscode-${i}`),children:[v.jsxs("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Ke,{className:"h-5 w-5 text-primary"}),v.jsx("h1",{className:"text-lg font-semibold",children:a(r?"commentModal.title.edit":"commentModal.title.add")})]}),v.jsx(Y,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:v.jsx(ge,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 min-h-0",children:[v.jsxs(Z,{children:[v.jsx(J,{className:"pb-3",children:v.jsx(Q,{className:"text-sm",children:a("commentModal.selectedText")})}),v.jsx(ee,{children:v.jsx("div",{className:"p-3 rounded-md bg-muted font-mono text-sm leading-relaxed max-h-32 overflow-y-auto border",style:_(),children:e})})]}),v.jsxs(Z,{children:[v.jsx(J,{className:"pb-3",children:v.jsxs(Q,{className:"text-sm flex items-center gap-2",children:[v.jsx(Ye,{className:"h-4 w-4"}),a("commentModal.highlightColor")]})}),v.jsxs(ee,{className:"space-y-4",children:[v.jsx("div",{className:"flex justify-center p-4 bg-muted/30 rounded-lg border",children:v.jsx("div",{ref:d})}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1",children:[v.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:a("commentModal.hexColor")}),v.jsx("input",{type:"text",value:c,onChange:y,className:"w-full px-3 py-2 text-sm font-mono bg-background border rounded-md focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"#FFEB3B",maxLength:7})]}),v.jsxs("div",{className:"flex flex-col items-center gap-1",children:[v.jsx("div",{className:"w-12 h-12 border-2 rounded-md shadow-sm",style:{backgroundColor:O(c)?c:"#gray",borderColor:O(c)?c:"#gray"}}),v.jsx("span",{className:"text-xs text-muted-foreground",children:a("commentModal.preview")})]})]})]})]}),v.jsxs(Z,{children:[v.jsx(J,{className:"pb-3",children:v.jsx(Q,{className:"text-sm",children:a("commentModal.yourComment")})}),v.jsxs(ee,{children:[v.jsx("textarea",{value:o,onChange:m=>s(m.target.value),className:"w-full min-h-24 px-3 py-2 text-sm bg-background border rounded-md resize-y focus:outline-none focus:ring-2 focus:ring-ring",placeholder:a("commentModal.placeholder"),autoFocus:!0}),v.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:a("commentModal.tip")})]})]})]}),v.jsxs("div",{className:"flex justify-end gap-2 pt-4 mt-4 border-t border-border flex-shrink-0",children:[v.jsxs(Y,{variant:"outline",onClick:t,className:"flex items-center gap-2",children:[v.jsx(ge,{className:"h-4 w-4"}),a("commentModal.cancel")]}),v.jsxs(Y,{onClick:f,disabled:!p,className:"flex items-center gap-2",children:[v.jsx(Ze,{className:"h-4 w-4"}),a(r?"commentModal.update":"commentModal.add")]})]})]})}const ke=window.acquireVsCodeApi?.();function $t(){const e=window.initialState?.selectedText||me.t("commentModal.noTextSelected"),r=window.initialState?.existingComment||null,n=(i,a)=>{const o={command:"save",comment:i,color:a};ke?.postMessage(o)},t=()=>{const i={command:"cancel"};ke?.postMessage(i)};return v.jsx(qe,{i18n:me,children:v.jsx(Ot,{selectedText:e,existingComment:r,onSave:n,onCancel:t})})}const Ee=document.getElementById("root");Ee&&Ve.createRoot(Ee).render(v.jsx($t,{}));