1import{dq as K,dr as ye,ds as he,dt as T,du as me,dv as q,dw as v,dx as we,dy as _e,ad as Te}from"./ResourceNode-OBIHQGrc.js";import{r as M}from"./react-CiToEmDU.js";import"./tiptap-nRqHaR__.js";import"./faPencil-i7LcEqDF.js";import"./index-BYjFgc3L.js";import"./media-CVQTa9EZ.js";import"./utils-D0PJbLwx.js";import"./analytics-BXHdaAVG.js";import"./index-VeBbZI0v.js";import"./faArrowRight-4u0hryvz.js";import"./ui-RDrFZQ6P.js";import"./faXmark-B7G55HuF.js";import"./faListCheck-DLKcNtcQ.js";import"./faScaleBalanced-D5aakmWf.js";import"./faClipboardCheck-S11E7M81.js";import"./faHouse-U1l3zx8N.js";import"./default-COrDvlHP.js";import"./TrackMixpanel-C5L6PEAt.js";import"./module-xE8hoDfr.js";(function(){try{var i=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{};i.SENTRY_RELEASE={id:"e15ff996bbe7105fef2b7e48186cc5ea2cf1c022"};var n=new i.Error().stack;n&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[n]="aadcc45e-c8d8-46bd-92f0-9ac547d67fc2",i._sentryDebugIdIdentifier="sentry-dbid-aadcc45e-c8d8-46bd-92f0-9ac547d67fc2")}catch{}})();var d=function(){return d=Object.assign||function(i){for(var n,s=1,c=arguments.length;s<c;s++){n=arguments[s];for(var f in n)Object.prototype.hasOwnProperty.call(n,f)&&(i[f]=n[f])}return i},d.apply(this,arguments)},V=function(i,n,s){if(s||arguments.length===2)for(var c=0,f=n.length,u;c<f;c++)(u||!(c in n))&&(u||(u=Array.prototype.slice.call(n,0,c)),u[c]=n[c]);return i.concat(u||Array.prototype.slice.call(n))},Ye=function(i,n,s){var c=s!=null?s:{},f=c.defaultColor,u=f===void 0?"rgba(175, 51, 242, 1)":f,I=c.defaultGradient,A=I===void 0?"linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%)":I,o=K(i,u,A),L=ye(i),W=L.degrees,N=L.degreeStr,P=L.isGradient,C=L.gradientType,k=he(o,A),p=k.currentColor,U=k.selectedColor,x=k.currentLeft,B=M.useState([]),G=B[0],z=B[1],F=function(e){if(e&&(o=K(e,u,A)),i)return P?{isGradient:!0,gradientType:C,degrees:N,colors:o==null?void 0:o.map(function(t){var r;return d(d({},t),{value:(r=t.value)===null||r===void 0?void 0:r.toLowerCase()})})}:{isGradient:!1,gradientType:null,degrees:null,colors:o==null?void 0:o.map(function(t){var r;return d(d({},t),{value:(r=t.value)===null||r===void 0?void 0:r.toLowerCase()})})};console.log("RBGCP ERROR - YOU MUST PASS A VALUE AND CALLBACK TO THE useColorPicker HOOK")},y=T(p),H=y.toRgb(),h=H.r,m=H.g,w=H.b,b=H.a,O=y.toHsl(),E=O.h,D=O.s,j=O.l;M.useEffect(function(){var e;!((e=T(p))===null||e===void 0)&&e.isValid()&&G[0]!==p&&z(V([p],G.slice(0,19),!0))},[p,G]);var J=function(){var e=i.split(/,(.+)/)[1];n("linear-gradient(90deg, ".concat(e))},Q=function(){var e=i.split(/,(.+)/)[1];n("radial-gradient(circle, ".concat(e))},X=function(e){var t=i.split(/,(.+)/)[1];n("linear-gradient(".concat(v(e,0,360),"deg, ").concat(t)),C!=="linear-gradient"&&console.log("Warning: you are updating degrees when the gradient type is not linear. This will change the gradients type which may be undesired")},Z=function(e){var t,r=(t=e!=null?e:u)!==null&&t!==void 0?t:"rgba(175, 51, 242, 1)";n(r)},$=function(e){var t,r=(t=e!=null?e:A)!==null&&t!==void 0?t:"linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%)";n(r)},R=function(e){var t=e.sort(function(a,l){return a.left-l.left}),r=t==null?void 0:t.map(function(a){return"".concat(a==null?void 0:a.value," ").concat(a.left,"%")});n("".concat(C,"(").concat(N,", ").concat(r.join(", "),")"))},Y=function(e,t){var r=o==null?void 0:o.filter(function(l){return!_e(l.value)}),a=V([{value:e.toUpperCase(),left:t!=null?t:x}],r,!0);R(a)},g=function(e){e=e==null?void 0:e.replace(/\s+/g,""),P?Y(e):n(e)},ee=function(e){var t=v(e,0,255);g("rgba(".concat(t,", ").concat(m,", ").concat(w,", ").concat(b,")"))},te=function(e){var t=v(e,0,255);g("rgba(".concat(h,", ").concat(t,", ").concat(w,", ").concat(b,")"))},re=function(e){var t=v(e,0,255);g("rgba(".concat(h,", ").concat(m,", ").concat(t,", ").concat(b,")"))},ae=function(e){var t=v(e,0,100);g("rgba(".concat(h,", ").concat(m,", ").concat(w,", ").concat(t/100,")"))},ne=function(e){var t=v(e,0,360),r=T({h:t,s:D,l:j}),a=r.toRgb(),l=a.r,_=a.g,S=a.b;g("rgba(".concat(l,", ").concat(_,", ").concat(S,", ").concat(b,")"))},oe=function(e){var t=v(e,0,100),r=T({h:E,s:t/100,l:j}),a=r.toRgb(),l=a.r,_=a.g,S=a.b;g("rgba(".concat(l,", ").concat(_,", ").concat(S,", ").concat(b,")"))},ie=function(e){var t=v(e,0,100),r=T({h:E,s:D,l:t/100});if(r!=null&&r.isValid()){var a=r.toRgb(),l=a.r,_=a.g,S=a.b;g("rgba(".concat(l,", ").concat(_,", ").concat(S,", ").concat(b,")"))}
1else console.log("The new color was invalid, perhaps the lightness you passed in was a decimal? Please pass the new value between 0 - 100")},le=function(){return y.toHslString()},ce=function(){return y.toHsvString()},se=function(){return y.toHexString()},de=function(){var e=we(h,m,w),t=e.c,r=e.m,a=e.y,l=e.k;return"cmyk(".concat(t,", ").concat(r,", ").concat(a,", ").concat(l,")")},ue=function(e){if(P){var t=o==null?void 0:o.map(function(r,a){return d(d({},r),{value:a===e?me(r):q(r)})});R(t)}else console.log("This function is only relevant when the picker is in gradient mode")},ve=function(e){var t=V(V([],o.map(function(r){return d(d({},r),{value:q(r)})}),!0),[{value:p,left:e}],!1);R(t),e||console.log("You did not pass a stop value (left amount) for the new color point so it defaulted to 50")},fe=function(e){if((o==null?void 0:o.length)>2){var t=e!=null?e:U,r=o==null?void 0:o.filter(function(a,l){return l!==t});R(r),e||console.log("You did not pass in the index of the point you wanted to delete so the function default to the currently selected point")}else console.log("A gradient must have atleast two colors, disable your delete button when necessary")},ge=function(e){Y(p,v(e,0,100))},pe=[h,m,w,b],be=[E,D,j];return{setR:ee,setG:te,setB:re,setA:ae,setHue:ne,addPoint:ve,setSolid:Z,setLinear:J,setRadial:Q,valueToHSL:le,valueToHSV:ce,valueToHex:se,valueToCmyk:de,setDegrees:X,setGradient:$,setLightness:ie,setSaturation:oe,setSelectedPoint:ue,deletePoint:fe,isGradient:P,gradientType:C,degrees:W,setPointLeft:ge,currentLeft:x,rgbaArr:pe,hslArr:be,handleChange:g,previousColors:G,getGradientObject:F,selectedPoint:U}};export{Te as default,Ye as useColorPicker};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.