<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import{s as b,e as Be}from"./Error-d98d8644.js";import{l as De,i as Le,r as Ue,a as Ge,o as He}from"./colorUtils-3135ee39.js";import{e as Ke}from"./screenUtils-a5a0a98c.js";import{e as Et}from"./mat4f32-1b45b54f.js";import{r as j,s as P}from"./mat4-a854caf0.js";const Qe=(t,n)=&gt;{const a=j(t,n,0,0,0,0,n,0,0,0,0,n,0,0,0,0,1);return P(a,a)},Ve=(t,n)=&gt;{const a=j(t,n,0,0,.5-.5*n,0,n,0,.5-.5*n,0,0,n,.5-.5*n,0,0,0,1);return P(a,a)},We=(t,n)=&gt;{const a=1-n,e=j(t,.2126+.7874*a,.7152-.7152*a,.0722-.0722*a,0,.2126-.2126*a,.7152+.2848*a,.0722-.0722*a,0,.2126-.2126*a,.7152-.7152*a,.0722+.9278*a,0,0,0,0,1);return P(e,e)},Ze=(t,n)=&gt;{const a=Math.sin(n*Math.PI/180),e=Math.cos(n*Math.PI/180),f=j(t,.213+.787*e-.213*a,.715-.715*e-.715*a,.072-.072*e+.928*a,0,.213-.213*e+.143*a,.715+.285*e+.14*a,.072-.072*e-.283*a,0,.213-.213*e-.787*a,.715-.715*e+.715*a,.072+.928*e+.072*a,0,0,0,0,1);return P(f,f)},tr=(t,n)=&gt;{const a=1-2*n,e=j(t,a,0,0,n,0,a,0,n,0,0,a,n,0,0,0,1);return P(e,e)},er=(t,n)=&gt;{const a=j(t,.213+.787*n,.715-.715*n,.072-.072*n,0,.213-.213*n,.715+.285*n,.072-.072*n,0,.213-.213*n,.715-.715*n,.072+.928*n,0,0,0,0,1);return P(a,a)},rr=(t,n)=&gt;{const a=1-n,e=j(t,.393+.607*a,.769-.769*a,.189-.189*a,0,.349-.349*a,.686+.314*a,.168-.168*a,0,.272-.272*a,.534-.534*a,.131+.869*a,0,0,0,0,1);return P(e,e)};let V=class{constructor(n,a,e){this.strength=n,this.radius=a,this.threshold=e,this.type="bloom"}interpolate(n,a,e){this.strength=A(n.strength,a.strength,e),this.radius=A(n.radius,a.radius,e),this.threshold=A(n.threshold,a.threshold,e)}clone(){return new V(this.strength,this.radius,this.threshold)}toJSON(){return{type:"bloom",radius:T(this.radius),strength:this.strength,threshold:this.threshold}}},W=class{constructor(n){this.radius=n,this.type="blur"}interpolate(n,a,e){this.radius=Math.round(A(n.radius,a.radius,e))}clone(){return new W(this.radius)}toJSON(){return{type:"blur",radius:T(this.radius)}}};class B{constructor(n,a){this.type=n,this.amount=a,this.type!=="invert"&amp;&amp;this.type!=="grayscale"&amp;&amp;this.type!=="sepia"||(this.amount=Math.min(this.amount,1))}get colorMatrix(){return this._colorMatrix||this._updateMatrix(),this._colorMatrix}interpolate(n,a,e){this.amount=A(n.amount,a.amount,e),this._updateMatrix()}clone(){return new B(this.type,this.amount)}toJSON(){return{type:this.type,amount:this.amount}}_updateMatrix(){const n=this._colorMatrix||Et();switch(this.type){case"brightness":this._colorMatrix=Qe(n,this.amount);break;case"contrast":this._colorMatrix=Ve(n,this.amount);break;case"grayscale":this._colorMatrix=We(n,this.amount);break;case"invert":this._colorMatrix=tr(n,this.amount);break;case"saturate":this._colorMatrix=er(n,this.amount);break;case"sepia":this._colorMatrix=rr(n,this.amount)}}}let Z=class{constructor(n,a,e,f){this.offsetX=n,this.offsetY=a,this.blurRadius=e,this.color=f,this.type="drop-shadow"}interpolate(n,a,e){this.offsetX=A(n.offsetX,a.offsetX,e),this.offsetY=A(n.offsetY,a.offsetY,e),this.blurRadius=A(n.blurRadius,a.blurRadius,e),this.color[0]=Math.round(A(n.color[0],a.color[0],e)),this.color[1]=Math.round(A(n.color[1],a.color[1],e)),this.color[2]=Math.round(A(n.color[2],a.color[2],e)),this.color[3]=A(n.color[3],a.color[3],e)}clone(){return new Z(this.offsetX,this.offsetY,this.blurRadius,[...this.color])}toJSON(){const n=[...this.color];return n[3]*=255,{type:"drop-shadow",xoffset:T(this.offsetX),yoffset:T(this.offsetY),blurRadius:T(this.blurRadius),color:n}}},tt=class{constructor(n){this.angle=n,this.type="hue-rotate"}get colorMatrix(){return this._colorMatrix||this._updateMatrix(),this._colorMatrix}interpolate(n,a,e){this.angle=A(n.angle,a.angle,e),this._updateMatrix()}clone(){return new tt(this.angle)}toJSON(){return{type:"hue-rotate",angle:this.angle}}_updateMatrix(){const n=this._colorMatrix||Et();this._colorMatrix=Ze(n,this.angle)}},et=class{constructor(n){this.amount=n,this.type="opacity",this.amount=Math.min(this.amount,1)}interpolate(n,a,e){this.amount=A(n.amount,a.amount,e)}clone(){return new et(this.amount)}toJSON(){return{type:"opacity",amount:this.amount}}};function A(t,n,a){return t+(n-t)*a}function T(t){return Math.round(1e3*Ke(t))/1e3}function nr(t){switch(t.type){case"grayscale":case"sepia":case"invert":return new B(t.type,0);case"saturate":case"brightness":case"contrast":return new B(t.type,1);case"opacity":return new et(1);case"hue-rotate":return new tt(0);case"blur":return new W(0);case"drop-shadow":return new Z(0,0,0,[...De("transparent")]);case"bloom":return new V(0,0,1)}}function ar(t,n){const a=t.length&gt;n.length?t:n;return(t.length&gt;n.length?n:t).every((e,f)=&gt;e.type===a[f].type)}function ur(t,n){const a=t.length&gt;n.length?t:n,e=t.length&gt;n.length?n:t;for(let f=e.length;f&lt;a.length;f++)e.push(nr(a[f]))}function or(t){const n=t[0];return!!n&amp;&amp;"type"in n}function Yr(t,n){return JSON.stringify(t??null)===JSON.stringify(n??null)}function sr(t,n){function a(){this.constructor=t}a.prototype=n.prototype,t.prototype=new a}function X(t,n,a,e){var f=Error.call(this,t);return Object.setPrototypeOf&amp;&amp;Object.setPrototypeOf(f,X.prototype),f.expected=n,f.found=a,f.location=e,f.name="SyntaxError",f}function Q(t,n,a){return a=a||" ",t.length&gt;n?t:(n-=t.length,t+(a+=a.repeat(n)).slice(0,n))}function ir(t,n){var a,e={},f=(n=n!==void 0?n:{}).grammarSource,F={start:Ft},R=Ft,J="none",I=")",p=",",d="(",_="%",v="px",ut="cm",ot="mm",st="in",it="pt",ct="pc",lt="deg",ft="rad",ht="grad",pt="turn",Nt="#",Rt=".",Jt="e",mt=/^[ \t\n\r]/,gt=/^[a-z\-]/,dt=/^[0-9a-fA-F]/,yt=/^[+\-]/,k=/^[0-9]/,jt=E("none"),Pt=w("none",!1),It=w(")",!1),vt=w(",",!1),qt=E("whitespace"),wt=z([" ","	",`
`,"\r"],!1,!1),Xt=E("function"),Yt=w("(",!1),zt=E("identifier"),xt=z([["a","z"],"-"],!1,!1),Tt=E("percentage"),Bt=w("%",!1),Dt=E("length"),Lt=w("px",!1),Ut=w("cm",!1),Gt=w("mm",!1),Ht=w("in",!1),Kt=w("pt",!1),Qt=w("pc",!1),Vt=E("angle"),Wt=w("deg",!1),Zt=w("rad",!1),te=w("grad",!1),ee=w("turn",!1),re=E("number"),ne=E("color"),ae=w("#",!1),bt=z([["0","9"],["a","f"],["A","F"]],!1,!1),$t=z(["+","-"],!1,!1),N=z([["0","9"]],!1,!1),ue=w(".",!1),oe=w("e",!1),se=function(){return[]},ie=function(r,o){return{type:"function",name:r,parameters:o||[]}},ce=function(r,o){return o.length&gt;0?Te(r,o,3):[r]},le=function(r){return{type:"quantity",value:r.value,unit:r.unit}},fe=function(r){return{type:"color",colorType:r.type,value:r.value}},he=function(r){return r},pe=function(){return U()},me=function(r){return{value:r,unit:"%"}},ge=function(r){return{value:r,unit:"px"}},de=function(r){return{value:r,unit:"cm"}},ye=function(r){return{value:r,unit:"mm"}},ve=function(r){return{value:r,unit:"in"}},we=function(r){return{value:r,unit:"pt"}},xe=function(r){return{value:r,unit:"pc"}},be=function(r){return{value:r,unit:"deg"}},$e=function(r){return{value:r,unit:"rad"}},Ae=function(r){return{value:r,unit:"grad"}},Me=function(r){return{value:r,unit:"turn"}},Fe=function(r){return{value:r,unit:null}},_e=function(){return{type:"hex",value:U()}},Ce=function(r){return{type:"function",value:r}},Oe=function(){return{type:"named",value:U()}},Ee=function(){return parseFloat(U())},u=0|n.peg$currPos,m=u,q=[{line:1,column:1}],C=u,L=n.peg$maxFailExpected||[],i=0|n.peg$silentFails;if(n.startRule){if(!(n.startRule in F))throw new Error(`Can't start parsing from rule "`+n.startRule+'".');R=F[n.startRule]}function U(){return t.substring(m,u)}function w(r,o){return{type:"literal",text:r,ignoreCase:o}}function z(r,o,s){return{type:"class",parts:r,inverted:o,ignoreCase:s}}function Se(){return{type:"end"}}function E(r){return{type:"other",description:r}}function At(r){var o,s=q[r];if(s)return s;if(r&gt;=q.length)o=q.length-1;else for(o=r;!q[--o];);for(s={line:(s=q[o]).line,column:s.column};o&lt;r;)t.charCodeAt(o)===10?(s.line++,s.column=1):s.column++,o++;return q[r]=s,s}function Mt(r,o,s){var c=At(r),h=At(o);return{source:f,start:{offset:r,line:c.line,column:c.column},end:{offset:o,line:h.line,column:h.column}}}function l(r){u&lt;C||(u&gt;C&amp;&amp;(C=u,L=[]),L.push(r))}function ke(r,o,s){return new X(X.buildMessage(r,o),r,o,s)}function Ft(){var r;return(r=Ne())===e&amp;&amp;(r=Re()),r}function Ne(){var r,o;return i++,r=u,x(),t.substr(u,4)===J?(o=J,u+=4):(o=e,i===0&amp;&amp;l(Pt)),o!==e?(x(),m=r,r=se()):(u=r,r=e),i--,r===e&amp;&amp;i===0&amp;&amp;l(jt),r}function Re(){var r,o;if(r=[],(o=H())!==e)for(;o!==e;)r.push(o),o=H();else r=e;return r}function H(){var r,o,s,c;return r=u,x(),(o=je())!==e?(x(),(s=Je())===e&amp;&amp;(s=null),x(),t.charCodeAt(u)===41?(c=I,u++):(c=e,i===0&amp;&amp;l(It)),c!==e?(x(),m=r,r=ie(o,s)):(u=r,r=e)):(u=r,r=e),r}function Je(){var r,o,s,c,h,g,y,$;if(r=u,(o=K())!==e){for(s=[],c=u,h=x(),t.charCodeAt(u)===44?(g=p,u++):(g=e,i===0&amp;&amp;l(vt)),g===e&amp;&amp;(g=null),y=x(),($=K())!==e?c=h=[h,g,y,$]:(u=c,c=e);c!==e;)s.push(c),c=u,h=x(),t.charCodeAt(u)===44?(g=p,u++):(g=e,i===0&amp;&amp;l(vt)),g===e&amp;&amp;(g=null),y=x(),($=K())!==e?c=h=[h,g,y,$]:(u=c,c=e);m=r,r=ce(o,s)}else u=r,r=e;return r}function K(){var r,o;return r=u,(o=Pe())===e&amp;&amp;(o=Ie())===e&amp;&amp;(o=qe())===e&amp;&amp;(o=Xe()),o!==e&amp;&amp;(m=r,o=le(o)),(r=o)===e&amp;&amp;(r=u,(o=Ye())!==e&amp;&amp;(m=r,o=fe(o)),r=o),r}function x(){var r,o;for(i++,r=[],o=t.charAt(u),mt.test(o)?u++:(o=e,i===0&amp;&amp;l(wt));o!==e;)r.push(o),o=t.charAt(u),mt.test(o)?u++:(o=e,i===0&amp;&amp;l(wt));return i--,o=e,i===0&amp;&amp;l(qt),r}function je(){var r,o,s;return i++,r=u,(o=_t())!==e?(t.charCodeAt(u)===40?(s=d,u++):(s=e,i===0&amp;&amp;l(Yt)),s!==e?(m=r,r=he(o)):(u=r,r=e)):(u=r,r=e),i--,r===e&amp;&amp;(o=e,i===0&amp;&amp;l(Xt)),r}function _t(){var r,o,s;if(i++,r=u,o=[],s=t.charAt(u),gt.test(s)?u++:(s=e,i===0&amp;&amp;l(xt)),s!==e)for(;s!==e;)o.push(s),s=t.charAt(u),gt.test(s)?u++:(s=e,i===0&amp;&amp;l(xt));else o=e;return o!==e&amp;&amp;(m=r,o=pe()),i--,(r=o)===e&amp;&amp;(o=e,i===0&amp;&amp;l(zt)),r}function Pe(){var r,o,s;return i++,r=u,x(),(o=M())!==e?(t.charCodeAt(u)===37?(s=_,u++):(s=e,i===0&amp;&amp;l(Bt)),s!==e?(m=r,r=me(o)):(u=r,r=e)):(u=r,r=e),i--,r===e&amp;&amp;i===0&amp;&amp;l(Tt),r}function Ie(){var r,o,s;return i++,r=u,x(),(o=M())!==e?(t.substr(u,2)===v?(s=v,u+=2):(s=e,i===0&amp;&amp;l(Lt)),s!==e?(m=r,r=ge(o)):(u=r,r=e)):(u=r,r=e),r===e&amp;&amp;(r=u,x(),(o=M())!==e?(t.substr(u,2)===ut?(s=ut,u+=2):(s=e,i===0&amp;&amp;l(Ut)),s!==e?(m=r,r=de(o)):(u=r,r=e)):(u=r,r=e),r===e&amp;&amp;(r=u,x(),(o=M())!==e?(t.substr(u,2)===ot?(s=ot,u+=2):(s=e,i===0&amp;&amp;l(Gt)),s!==e?(m=r,r=ye(o)):(u=r,r=e)):(u=r,r=e),r===e&amp;&amp;(r=u,x(),(o=M())!==e?(t.substr(u,2)===st?(s=st,u+=2):(s=e,i===0&amp;&amp;l(Ht)),s!==e?(m=r,r=ve(o)):(u=r,r=e)):(u=r,r=e),r===e&amp;&amp;(r=u,x(),(o=M())!==e?(t.substr(u,2)===it?(s=it,u+=2):(s=e,i===0&amp;&amp;l(Kt)),s!==e?(m=r,r=we(o)):(u=r,r=e)):(u=r,r=e),r===e&amp;&amp;(r=u,x(),(o=M())!==e?(t.substr(u,2)===ct?(s=ct,u+=2):(s=e,i===0&amp;&amp;l(Qt)),s!==e?(m=r,r=xe(o)):(u=r,r=e)):(u=r,r=e)))))),i--,r===e&amp;&amp;i===0&amp;&amp;l(Dt),r}function qe(){var r,o,s;return i++,r=u,(o=M())!==e?(t.substr(u,3)===lt?(s=lt,u+=3):(s=e,i===0&amp;&amp;l(Wt)),s!==e?(m=r,r=be(o)):(u=r,r=e)):(u=r,r=e),r===e&amp;&amp;(r=u,(o=M())!==e?(t.substr(u,3)===ft?(s=ft,u+=3):(s=e,i===0&amp;&amp;l(Zt)),s!==e?(m=r,r=$e(o)):(u=r,r=e)):(u=r,r=e),r===e&amp;&amp;(r=u,(o=M())!==e?(t.substr(u,4)===ht?(s=ht,u+=4):(s=e,i===0&amp;&amp;l(te)),s!==e?(m=r,r=Ae(o)):(u=r,r=e)):(u=r,r=e),r===e&amp;&amp;(r=u,(o=M())!==e?(t.substr(u,4)===pt?(s=pt,u+=4):(s=e,i===0&amp;&amp;l(ee)),s!==e?(m=r,r=Me(o)):(u=r,r=e)):(u=r,r=e)))),i--,r===e&amp;&amp;(o=e,i===0&amp;&amp;l(Vt)),r}function Xe(){var r,o;return i++,r=u,x(),(o=M())!==e?(m=r,r=Fe(o)):(u=r,r=e),i--,r===e&amp;&amp;i===0&amp;&amp;l(re),r}function Ye(){var r,o,s,c;if(i++,r=u,t.charCodeAt(u)===35?(o=Nt,u++):(o=e,i===0&amp;&amp;l(ae)),o!==e){if(s=[],c=t.charAt(u),dt.test(c)?u++:(c=e,i===0&amp;&amp;l(bt)),c!==e)for(;c!==e;)s.push(c),c=t.charAt(u),dt.test(c)?u++:(c=e,i===0&amp;&amp;l(bt));else s=e;s!==e?(m=r,r=_e()):(u=r,r=e)}else u=r,r=e;return r===e&amp;&amp;(r=u,(o=H())!==e&amp;&amp;(m=r,o=Ce(o)),(r=o)===e&amp;&amp;(r=u,(o=_t())!==e&amp;&amp;(m=r,o=Oe()),r=o)),i--,r===e&amp;&amp;(o=e,i===0&amp;&amp;l(ne)),r}function M(){var r,o,s,c,h,g,y,$;for(r=u,o=t.charAt(u),yt.test(o)?u++:(o=e,i===0&amp;&amp;l($t)),o===e&amp;&amp;(o=null),s=u,c=[],h=t.charAt(u),k.test(h)?u++:(h=e,i===0&amp;&amp;l(N));h!==e;)c.push(h),h=t.charAt(u),k.test(h)?u++:(h=e,i===0&amp;&amp;l(N));if(t.charCodeAt(u)===46?(h=Rt,u++):(h=e,i===0&amp;&amp;l(ue)),h!==e){if(g=[],y=t.charAt(u),k.test(y)?u++:(y=e,i===0&amp;&amp;l(N)),y!==e)for(;y!==e;)g.push(y),y=t.charAt(u),k.test(y)?u++:(y=e,i===0&amp;&amp;l(N));else g=e;g!==e?s=c=[c,h,g]:(u=s,s=e)}else u=s,s=e;if(s===e)if(s=[],c=t.charAt(u),k.test(c)?u++:(c=e,i===0&amp;&amp;l(N)),c!==e)for(;c!==e;)s.push(c),c=t.charAt(u),k.test(c)?u++:(c=e,i===0&amp;&amp;l(N));else s=e;if(s!==e){if(c=u,t.charCodeAt(u)===101?(h=Jt,u++):(h=e,i===0&amp;&amp;l(oe)),h!==e){if(g=t.charAt(u),yt.test(g)?u++:(g=e,i===0&amp;&amp;l($t)),g===e&amp;&amp;(g=null),y=[],$=t.charAt(u),k.test($)?u++:($=e,i===0&amp;&amp;l(N)),$!==e)for(;$!==e;)y.push($),$=t.charAt(u),k.test($)?u++:($=e,i===0&amp;&amp;l(N));else y=e;y!==e?c=h=[h,g,y]:(u=c,c=e)}else u=c,c=e;c===e&amp;&amp;(c=null),m=r,r=Ee()}else u=r,r=e;return r}function ze(r,o){return r.map(function(s){return s[o]})}function Te(r,o,s){return[r].concat(ze(o,s))}if(a=R(),n.peg$library)return{peg$result:a,peg$currPos:u,peg$FAILED:e,peg$maxFailExpected:L,peg$maxFailPos:C};if(a!==e&amp;&amp;u===t.length)return a;throw a!==e&amp;&amp;u&lt;t.length&amp;&amp;l(Se()),ke(L,C&lt;t.length?t.charAt(C):null,C&lt;t.length?Mt(C,C+1):Mt(C,C))}function St(t){if(!t||t.length===0)return null;if(typeof t=="string"){const a=Ct(t);return a&amp;&amp;a.length!==0?a:null}const n=t.map(a=&gt;{if(!Number.isFinite(a.scale)||a.scale&lt;=0)throw new b("effect:invalid-scale","scale must be finite and greater than 0",{stop:a});return{scale:a.scale,effects:Ct(a.value)}});n.sort((a,e)=&gt;e.effects.length-a.effects.length);for(let a=0;a&lt;n.length-1;a++){if(!ar(n[a].effects,n[a+1].effects))throw new b("effect:interpolation-impossible","Cannot interpolate by scale between 2 lists of mixed effects",{a:n[a].effects,b:n[a+1].effects});ur(n[a].effects,n[a+1].effects)}return n.sort((a,e)=&gt;e.scale-a.scale),n}function Ct(t){let n;if(!t)return[];try{n=ir(t)}catch(a){throw new b("effect:invalid-syntax","Invalid effect syntax",{value:t,error:a})}return n.map(a=&gt;cr(a))}function cr(t){try{switch(t.name){case"grayscale":case"sepia":case"saturate":case"invert":case"brightness":case"contrast":return lr(t);case"opacity":return fr(t);case"hue-rotate":return hr(t);case"blur":return pr(t);case"drop-shadow":return mr(t);case"bloom":return gr(t)}}catch(n){throw n.details.filter=t,n}throw new b("effect:unknown-effect",`Effect '${t.name}' is not supported`,{effect:t})}function lr(t){let n=1;return Y(t.parameters,1),t.parameters.length===1&amp;&amp;(n=O(t.parameters[0])),new B(t.name,n)}function fr(t){let n=1;return Y(t.parameters,1),t.parameters.length===1&amp;&amp;(n=O(t.parameters[0])),new et(n)}function hr(t){let n=0;return Y(t.parameters,1),t.parameters.length===1&amp;&amp;(n=br(t.parameters[0])),new tt(n)}function pr(t){let n=0;return Y(t.parameters,1),t.parameters.length===1&amp;&amp;(n=at(t.parameters[0]),D(n,t.parameters[0])),new W(n)}function mr(t){const n=[];let a=null;for(const e of t.parameters)if(e.type==="color"){if(n.length&amp;&amp;Object.freeze(n),a)throw new b("effect:type-error","Accepts only one color",{});a=$r(e)}else{const f=at(e);if(Object.isFrozen(n))throw new b("effect:type-error","&lt;length&gt; parameters not consecutive",{lengths:n});n.push(f),n.length===3&amp;&amp;D(f,e)}if(n.length&lt;2||n.length&gt;3)throw new b("effect:type-error",`Expected &lt;length&gt;{2,3}, Actual: &lt;length&gt;{${n.length}}`,{lengths:n});return new Z(n[0],n[1],n[2]||0,a||kt("black"))}function gr(t){let n=1,a=0,e=0;return Y(t.parameters,3),t.parameters[0]&amp;&amp;(n=O(t.parameters[0])),t.parameters[1]&amp;&amp;(a=at(t.parameters[1]),D(a,t.parameters[1])),t.parameters[2]&amp;&amp;(e=O(t.parameters[2])),new V(n,a,e)}function Y(t,n){if(t.length&gt;n)throw new b("effect:type-error",`Function supports up to ${n} parameters, Actual: ${t.length}`,{parameters:t})}function G(t){if(t.type==="color")return"&lt;color&gt;";if(t.unit){if(t.unit in nt)return"&lt;length&gt;";if(t.unit in rt)return"&lt;angle&gt;";if(t.unit==="%")return"&lt;percentage&gt;"}return"&lt;double&gt;"}function D(t,n){if(t&lt;0)throw new b("effect:type-error",`Negative values are not allowed, Actual: ${t}`,{term:n})}function dr(t){if(t.type!=="quantity"||t.unit!==null)throw new b("effect:type-error",`Expected &lt;double&gt;, Actual: ${G(t)}`,{term:t})}function yr(t){if(t.type!=="quantity"||t.unit!==null&amp;&amp;t.unit!=="%")throw new b("effect:type-error",`Expected &lt;double&gt; or &lt;percentage&gt;, Actual: ${G(t)}`,{term:t})}sr(X,Error),X.prototype.format=function(t){var n="Error: "+this.message;if(this.location){var a,e=null;for(a=0;a&lt;t.length;a++)if(t[a].source===this.location.source){e=t[a].text.split(/\r\n|\n|\r/g);break}var f=this.location.start,F=this.location.source&amp;&amp;typeof this.location.source.offset=="function"?this.location.source.offset(f):f,R=this.location.source+":"+F.line+":"+F.column;if(e){var J=this.location.end,I=Q("",F.line.toString().length," "),p=e[f.line-1],d=(f.line===J.line?J.column:p.length+1)-f.column||1;n+=`
 --&gt; `+R+`
`+I+` |
`+F.line+" | "+p+`
`+I+" | "+Q("",f.column-1," ")+Q("",d,"^")}else n+=`
 at `+R}return n},X.buildMessage=function(t,n){var a={literal:function(p){return'"'+f(p.text)+'"'},class:function(p){var d=p.parts.map(function(_){return Array.isArray(_)?F(_[0])+"-"+F(_[1]):F(_)});return"["+(p.inverted?"^":"")+d.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(p){return p.description}};function e(p){return p.charCodeAt(0).toString(16).toUpperCase()}function f(p){return p.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+e(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+e(d)})}function F(p){return p.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+e(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+e(d)})}function R(p){return a[p.type](p)}function J(p){var d,_,v=p.map(R);if(v.sort(),v.length&gt;0){for(d=1,_=1;d&lt;v.length;d++)v[d-1]!==v[d]&amp;&amp;(v[_]=v[d],_++);v.length=_}switch(v.length){case 1:return v[0];case 2:return v[0]+" or "+v[1];default:return v.slice(0,-1).join(", ")+", or "+v[v.length-1]}}function I(p){return p?'"'+f(p)+'"':"end of input"}return"Expected "+J(t)+" but "+I(n)+" found."};const rt={deg:1,grad:.9,rad:180/Math.PI,turn:360};function vr(t){if(t.type!=="quantity"||!(t.value===0&amp;&amp;t.unit===null||t.unit&amp;&amp;rt[t.unit]!=null))throw new b("effect:type-error",`Expected &lt;angle&gt;, Actual: ${G(t)}`,{term:t})}const nt={px:1,cm:96/2.54,mm:96/2.54/10,in:96,pc:16,pt:96/72};function wr(t){if(t.type!=="quantity"||!(t.value===0&amp;&amp;t.unit===null||t.unit&amp;&amp;nt[t.unit]!=null))throw new b("effect:type-error",`Expected &lt;length&gt;, Actual: ${G(t)}`,{term:t})}function O(t){yr(t);const n=t.value;return D(n,t),t.unit==="%"?.01*n:n}function xr(t){return dr(t),D(t.value,t),t.value}function br(t){return vr(t),t.value*rt[t.unit]||0}function at(t){return wr(t),t.value*nt[t.unit]||0}function $r(t){switch(t.colorType){case"hex":return Le(t.value);case"named":return kt(t.value);case"function":return Fr(t.value)}}function kt(t){if(!Ue(t))throw new b("effect:unknown-color",`color '${t}' isn't valid`,{namedColor:t});return Ge(t)}const Ar=/^rgba?/i,Mr=/^hsla?/i;function Fr(t){if(Y(t.parameters,4),Ar.test(t.name))return[O(t.parameters[0]),O(t.parameters[1]),O(t.parameters[2]),t.parameters[3]?O(t.parameters[3]):1];if(Mr.test(t.name))return He(xr(t.parameters[0]),O(t.parameters[1]),O(t.parameters[2]),t.parameters[3]?O(t.parameters[3]):1);throw new b("effect:syntax-error",`Invalid color function '${t.name}'`,{colorFunction:t})}function zr(t,n,a){var e;try{return Cr(t)}catch(f){(e=a==null?void 0:a.messages)==null||e.push(f)}return null}function Tr(t,n,a,e){try{const f=_r(t);Be(a,f,n)}catch(f){e.messages&amp;&amp;e.messages.push(f)}}function _r(t){const n=St(t);return n?or(n)?n.map(a=&gt;a.toJSON()):n.map(({scale:a,effects:e})=&gt;({scale:a,value:e.map(f=&gt;f.toJSON())})):null}function Cr(t){if(!t||t.length===0)return null;if(Or(t)){const n=[];for(const a of t)n.push({scale:a.scale,value:Ot(a.value)});return n}return Ot(t)}function Or(t){const n=t[0];return!!n&amp;&amp;"scale"in n}function Ot(t){if(!(t!=null&amp;&amp;t.length))return"";const n=[];for(const a of t){let e=[];switch(a.type){case"grayscale":case"sepia":case"saturate":case"invert":case"brightness":case"contrast":case"opacity":e=[S(a,"amount")];break;case"blur":e=[S(a,"radius","pt")];break;case"hue-rotate":e=[S(a,"angle","deg")];break;case"drop-shadow":e=[S(a,"xoffset","pt"),S(a,"yoffset","pt"),S(a,"blurRadius","pt"),Er(a,"color")];break;case"bloom":e=[S(a,"strength"),S(a,"radius","pt"),S(a,"threshold")]}const f=`${a.type}(${e.filter(Boolean).join(" ")})`;St(f),n.push(f)}return n.join(" ")}function S(t,n,a){if(t[n]==null)throw new b("effect:missing-parameter",`Missing parameter '${n}' in ${t.type} effect`,{effect:t});return a?t[n]+a:""+t[n]}function Er(t,n){if(t[n]==null)throw new b("effect:missing-parameter",`Missing parameter '${n}' in ${t.type} effect`,{effect:t});const a=t[n];return`rgba(${a[0]||0}, ${a[1]||0}, ${a[2]||0}, ${a[3]/255||0})`}export{Tr as a,St as d,ur as e,Ot as i,zr as n,Yr as r,ar as t};
</pre></body></html>