site
Version:
Site Engine is the world's first all-in-one engine to build a modern web site, game, or blog. No HTML or CSS knowledge required.
1 lines • 4.8 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var t,r,s,e,a,i,n=require("./shared.manifest"),o=function(t){return null!=t},h=function(t,r,s,e){return t(r)[s](r,...e)},u=function(t,r){var s=t,e=s.split("\n");return s=(e=e.map(t=>{var r=t.indexOf(" #");return-1===r?t:t.substr(0,r)})).join("").replace(/\s/g,""),new RegExp(s,r)};exports.default=(t=Symbol(),r=Symbol(),s=Symbol(),e=Symbol(),a=Symbol(),i=Symbol(),class{constructor(t,r,s,e){((t,r,s,e)=>(void 0===e&&(e=1),(()=>{(0,n.assert)(o(t)&&o(r)&&o(s)),this.red=t,this.green=r,this.blue=s,this.alpha=e})()))(t,r,s,e)}static fromArray(t){return(t=>(()=>new this(t[0],t[1],t[2],t[3]))())(t)}static fromRgb(t,r,s){return((t,r,s)=>(()=>new this(t,r,s))())(t,r,s)}static fromRgba(t,r,s,e){return((t,r,s,e)=>(()=>new this(t,r,s,e))())(t,r,s,e)}static fromHsl(s,e,a){return((s,e,a)=>(()=>{var i;return new this((i=this[t](this[r](s),e,a)).r,i.g,i.b)})())(s,e,a)}static fromHsla(s,e,a,i){return((s,e,a,i)=>(()=>{var n;return new this((n=this[t](this[r](s),e,a)).r,n.g,n.b,i)})())(s,e,a,i)}static fromDegHsl(r,e,a){return((r,e,a)=>(()=>{var i;return new this((i=this[t](this[s](r),e,a)).r,i.g,i.b)})())(r,e,a)}static fromDegHsla(r,e,a,i){return((r,e,a,i)=>(()=>{var n;return new this((n=this[t](this[s](r),e,a)).r,n.g,n.b,i)})())(r,e,a,i)}static from(t){return(t=>(()=>"string"==typeof t?(()=>this.fromString(t))():(()=>t instanceof this?(()=>t)():(()=>(0,n.fail)())())())())(t)}static fromString(r){return(r=>(()=>{var e,a;return(r=r.trim()).startsWith("rgba(")?(()=>r.includes("%")?(()=>new this((e=h(n.dotDot_573300145710716007,r.match(u("\\( (.*)% \\x20* , (.*)% \\x20* , (.*)% \\x20* , (.*) \\)")),"portion",[1]).map(t=>(()=>parseFloat(t))()))[0]/100,e[1]/100,e[2]/100,e[3]))():(()=>new this((e=h(n.dotDot_573300145710716007,r.match(u("\\( (.*),(.*),(.*),(.*) \\)")),"portion",[1]).map(t=>(()=>parseFloat(t))()))[0]/255,e[1]/255,e[2]/255,e[3]))())():(()=>r.startsWith("rgb(")?(()=>r.includes("%")?(()=>new this((e=h(n.dotDot_573300145710716007,r.match(u("\\( (.*)% \\x20* , (.*)% \\x20* , (.*)% \\x20* \\)")),"portion",[1]).map(t=>(()=>parseFloat(t))()))[0]/100,e[1]/100,e[2]/100,1))():(()=>new this((e=h(n.dotDot_573300145710716007,r.match(u("\\( (.*),(.*),(.*) \\)")),"portion",[1]).map(t=>(()=>parseFloat(t))()))[0]/255,e[1]/255,e[2]/255,1))())():(()=>r.startsWith("#")?(()=>7===r.length?(()=>new this((e=h(n.dotDot_573300145710716007,r.match(u("\\# (..) (..) (..)")),"portion",[1]).map(t=>(()=>parseInt(t,16))()))[0]/255,e[1]/255,e[2]/255,1))():(()=>4===r.length?(()=>new this((e=h(n.dotDot_573300145710716007,r.match(u("\\# (.) (.) (.)")),"portion",[1]).map(t=>(()=>17*parseInt(t,16))()))[0]/255,e[1]/255,e[2]/255,1))():(()=>(0,n.fail)())())())():(()=>r.startsWith("hsla(")?(()=>(e=h(n.dotDot_573300145710716007,r.match(u("\\( (.*) , (.*)% \\x20* , (.*)% \\x20* , (.*) \\)")),"portion",[1]).map(t=>(()=>parseFloat(t))()),new this((a=this[t](this[s](e[0]),e[1]/100,e[2]/100)).r,a.g,a.b,e[3])))():(()=>r.startsWith("hsl(")?(()=>(e=h(n.dotDot_573300145710716007,r.match(u("\\( (.*) , (.*)% \\x20* , (.*)% \\x20* \\)")),"portion",[1]).map(t=>(()=>parseFloat(t))()),new this((a=this[t](this[s](e[0]),e[1]/100,e[2]/100)).r,a.g,a.b,1)))():(()=>(0,n.fail)())())())())())()})())(r)}static[e](t){return(t=>(()=>h(n.dotDot_573300145710716007,Math,"principalRadians",[t*(2*Math.PI)]))())(t)}static[a](t){return(t=>(()=>h(n.dotDot_573300145710716007,Math,"principalDegrees",[360*t]))())(t)}static[r](t){return(t=>(()=>{var r;return(r=h(n.dotDot_573300145710716007,Math,"principalRadians",[t])/(2*Math.PI))<0?(()=>r+1)():(()=>r)()})())(t)}static[s](t){return(t=>(()=>{var r;return(r=h(n.dotDot_573300145710716007,Math,"principalDegrees",[t])/360)<0?(()=>r+1)():(()=>r)()})())(t)}static[t](t,r,s){return((t,r,s)=>(()=>{var e,a,i;return e=(t=>(()=>(t<0&&(t+=1),t>1&&(t-=1),6*t<1?(()=>i+(a-i)*t*6)():(()=>2*t<1?(()=>a)():(()=>3*t<2?(()=>i+(a-i)*(2/3-t)*6)():(()=>i)())())()))()),a=s<=.5?(()=>s*(r+1))():(()=>s+r-s*r)(),i=2*s-a,{r:e(t+1/3),g:e(t),b:e(t-1/3)}})())(t,r,s)}toString(){return(()=>(()=>"rgba("+100*this.red+"%,"+100*this.green+"%,"+100*this.blue+"%,"+this.alpha+")")())()}[i](){return(()=>(()=>{var t,r,s,e,a,i,o,h,u;return[t,r,s]=[this.red,this.green,this.blue],e=Math.max(t,r,s),a=Math.min(t,r,s),i=(e+a)/2,e===a?o=h=0:(u=e-a,h=i>.5?(()=>u/(2-e-a))():(()=>u/(e+a))(),o=(()=>{var a=e;return a===t?(()=>(r-s)/u+(r<s?6:0))():a===r?(()=>(s-t)/u+2)():a===s?(()=>(t-r)/u+4)():(()=>(0,n.fail)())()})(),o/=6),[o,h,i,this.alpha]})())()}toHsla(){return(()=>(()=>{var t;return(t=this[i]())[0]=this.constructor[e](t[0]),t})())()}toDegHsla(){return(()=>(()=>{var t;return(t=this[i]())[0]=this.constructor[a](t[0]),t})())()}equals(t){return(t=>(()=>this.red===t.red&&this.green===t.green&&this.blue===t.blue&&this.alpha===t.alpha)())(t)}});