'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkEPG4VVQB_cjs=require('../chunk-EPG4VVQB.cjs'),chunkBBEOVRYB_cjs=require('../chunk-BBEOVRYB.cjs');require('../chunk-IHOZOJHA.cjs');var chunkX5FCFNQN_cjs=require('../chunk-X5FCFNQN.cjs');require('../chunk-GYCEEHZT.cjs');var chunkEXPXWBLP_cjs=require('../chunk-EXPXWBLP.cjs');var C=.8224619687,_=.1775380313,G=.0331941989,A=.9668058011,w=.0170826307,F=.0723974407,B=.9105199286,v=1.2249401762805598,N=-0.22494017628055996,O=-0.04205695470968816,z=1.042056954709688,E=-0.019637554590334432,K=-0.07863604555063189,U=1.0982736001409663,I=(r,n,o,e)=>{r[0]=C*n+_*o,r[1]=G*n+A*o,r[2]=w*n+F*o+B*e;},i=(r,n,o)=>[C*r+_*n,G*r+A*n,w*r+F*n+B*o];var P=(r,n,o)=>[v*r+N*n,O*r+z*n,E*r+K*n+U*o],$=({r,g:n,b:o,alpha:e})=>{let[t,m,u]=i(chunkX5FCFNQN_cjs.a(r/255),chunkX5FCFNQN_cjs.a(n/255),chunkX5FCFNQN_cjs.a(o/255));return {r:chunkEXPXWBLP_cjs.b(chunkX5FCFNQN_cjs.b(t),4),g:chunkEXPXWBLP_cjs.b(chunkX5FCFNQN_cjs.b(m),4),b:chunkEXPXWBLP_cjs.b(chunkX5FCFNQN_cjs.b(u),4),alpha:e,colorSpace:"display-p3"}};var j=({r,g:n,b:o,alpha:e})=>{let[t,m,u]=P(chunkX5FCFNQN_cjs.a(r),chunkX5FCFNQN_cjs.a(n),chunkX5FCFNQN_cjs.a(o));return {r:chunkX5FCFNQN_cjs.b(t)*255,g:chunkX5FCFNQN_cjs.b(m)*255,b:chunkX5FCFNQN_cjs.b(u)*255,alpha:e}},g=r=>{if(!chunkEXPXWBLP_cjs.h(r)||r.colorSpace!=="display-p3"||!chunkEXPXWBLP_cjs.i(r,["r","g","b"]))return null;let{r:n,g:o,b:e,alpha:t=1}=r;return !chunkEXPXWBLP_cjs.f(n)||!chunkEXPXWBLP_cjs.f(o)||!chunkEXPXWBLP_cjs.f(e)||!chunkEXPXWBLP_cjs.f(t)?null:j({r:chunkEXPXWBLP_cjs.g(n),g:chunkEXPXWBLP_cjs.g(o),b:chunkEXPXWBLP_cjs.g(e),alpha:chunkEXPXWBLP_cjs.a(chunkEXPXWBLP_cjs.g(t),0,1)})},q=/^color\(\s*display-p3\s+([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,d=r=>{if(typeof r!="string")return null;let n=q.exec(r.trim());if(!n)return null;let o=n[4]===void 0?1:Number(n[4])/(n[5]?100:1);return j({r:Number(n[1]),g:Number(n[2]),b:Number(n[3]),alpha:chunkEXPXWBLP_cjs.a(o,0,1)})},S=(r,n,o)=>i(...chunkBBEOVRYB_cjs.f(r,n,o));var D=(r,n,o)=>chunkBBEOVRYB_cjs.a(...P(r,n,o)),H=(r,n,o)=>{let[e,t,m]=i(r,n,o);return [chunkX5FCFNQN_cjs.b(e),chunkX5FCFNQN_cjs.b(t),chunkX5FCFNQN_cjs.b(m)]},J=(r,n,o,e)=>{I(r,n,o,e),r[0]=chunkX5FCFNQN_cjs.b(r[0]),r[1]=chunkX5FCFNQN_cjs.b(r[1]),r[2]=chunkX5FCFNQN_cjs.b(r[2]);},tr=(r,n,o)=>H(...chunkEPG4VVQB_cjs.e(r,n,o)),br=(r,n,o,e)=>{chunkEPG4VVQB_cjs.f(r,n,o,e),J(r,r[0],r[1],r[2]);},mr=r=>chunkEPG4VVQB_cjs.c(r,S),M=(r,n,o)=>{r.toGamutP3=e=>{let t=chunkEPG4VVQB_cjs.d(e,S,D);return t!==null?r._makeFromOklab(t):new r(e)},r.prototype.toP3=function(){return $(this._rawRgb())},r.prototype.toP3String=function(){let{r:e,g:t,b:m,alpha:u}=this.toP3();return u<1?`color(display-p3 ${e} ${t} ${m} / ${u})`:`color(display-p3 ${e} ${t} ${m})`},n.push(d,g),o.push([d,"p3"],[g,"p3"]);},ar=M;exports.default=ar;exports.inGamutP3=mr;exports.linearToP3Channels=H;exports.linearToP3ChannelsInto=J;exports.oklchToP3Channels=tr;exports.oklchToP3ChannelsInto=br;//# sourceMappingURL=p3.cjs.map
//# sourceMappingURL=p3.cjs.map