4 lines
3.0 KiB
JavaScript
4 lines
3.0 KiB
JavaScript
/*! third party licenses: js/vendor.LICENSE.txt */
|
|
(()=>{var b,v,C;(b=Path2D.prototype).roundRect??(b.roundRect=u),globalThis.CanvasRenderingContext2D&&((v=globalThis.CanvasRenderingContext2D.prototype).roundRect??(v.roundRect=u)),globalThis.OffscreenCanvasRenderingContext2D&&((C=globalThis.OffscreenCanvasRenderingContext2D.prototype).roundRect??(C.roundRect=u));function u(t,h,o,y,n){if(![t,h,o,y].every(i=>Number.isFinite(i)))return;n=D(n);let e,a,s,l;if(n.length===4)e=x(n[0]),a=x(n[1]),s=x(n[2]),l=x(n[3]);else if(n.length===3)e=x(n[0]),a=x(n[1]),l=x(n[1]),s=x(n[2]);else if(n.length===2)e=x(n[0]),s=x(n[0]),a=x(n[1]),l=x(n[1]);else if(n.length===1)e=x(n[0]),a=x(n[0]),s=x(n[0]),l=x(n[0]);else throw new RangeError(`${d(this)} ${n.length} is not a valid size for radii sequence.`);const I=[e,a,s,l],M=I.find(({x:i,y:r})=>i<0||r<0);if(M?.x<0?M.x:M?.y,I.some(({x:i,y:r})=>!Number.isFinite(i)||!Number.isFinite(r)))return;if(M)throw new RangeError(`${d(this)} Radius value ${M} is negative.`);T(I),o<0&&y<0?(this.moveTo(t-e.x,h),this.ellipse(t+o+a.x,h-a.y,a.x,a.y,0,-Math.PI*1.5,-Math.PI),this.ellipse(t+o+s.x,h+y+s.y,s.x,s.y,0,-Math.PI,-Math.PI/2),this.ellipse(t-l.x,h+y+l.y,l.x,l.y,0,-Math.PI/2,0),this.ellipse(t-e.x,h-e.y,e.x,e.y,0,0,-Math.PI/2)):o<0?(this.moveTo(t-e.x,h),this.ellipse(t+o+a.x,h+a.y,a.x,a.y,0,-Math.PI/2,-Math.PI,1),this.ellipse(t+o+s.x,h+y-s.y,s.x,s.y,0,-Math.PI,-Math.PI*1.5,1),this.ellipse(t-l.x,h+y-l.y,l.x,l.y,0,Math.PI/2,0,1),this.ellipse(t-e.x,h+e.y,e.x,e.y,0,0,-Math.PI/2,1)):y<0?(this.moveTo(t+e.x,h),this.ellipse(t+o-a.x,h-a.y,a.x,a.y,0,Math.PI/2,0,1),this.ellipse(t+o-s.x,h+y+s.y,s.x,s.y,0,0,-Math.PI/2,1),this.ellipse(t+l.x,h+y+l.y,l.x,l.y,0,-Math.PI/2,-Math.PI,1),this.ellipse(t+e.x,h-e.y,e.x,e.y,0,-Math.PI,-Math.PI*1.5,1)):(this.moveTo(t+e.x,h),this.ellipse(t+o-a.x,h+a.y,a.x,a.y,0,-Math.PI/2,0),this.ellipse(t+o-s.x,h+y-s.y,s.x,s.y,0,0,Math.PI/2),this.ellipse(t+l.x,h+y-l.y,l.x,l.y,0,Math.PI/2,Math.PI),this.ellipse(t+e.x,h+e.y,e.x,e.y,0,Math.PI,Math.PI*1.5)),this.closePath(),this.moveTo(t,h);function m(i){const{x:r,y:f,z:c,w:P}=i;return{x:r,y:f,z:c,w:P}}function D(i){const r=typeof i;return r==="undefined"||i===null?[0]:r==="function"?[NaN]:r==="object"?typeof i[Symbol.iterator]=="function"?[...i].map(f=>{const c=typeof f;return c==="undefined"||f===null?0:c==="function"?NaN:c==="object"?m(f):p(f)}):[m(i)]:[p(i)]}function p(i){return+i}function x(i){const r=p(i);return Number.isFinite(r)?{x:r,y:r}:Object(i)===i?{x:p(i.x??0),y:p(i.y??0)}:{x:NaN,y:NaN}}function T(i){const[r,f,c,P]=i,w=[Math.abs(o)/(r.x+f.x),Math.abs(y)/(f.y+c.y),Math.abs(o)/(c.x+P.x),Math.abs(y)/(r.y+P.y)],g=Math.min(...w);if(g<=1)for(const R of i)R.x*=g,R.y*=g}}function d(t){return`Failed to execute 'roundRect' on '${N(t)}':`}function N(t){return Object(t)===t&&t instanceof Path2D?"Path2D":t instanceof globalThis?.CanvasRenderingContext2D?"CanvasRenderingContext2D":t instanceof globalThis?.OffscreenCanvasRenderingContext2D?"OffscreenCanvasRenderingContext2D":t?.constructor.name||t}})();
|
|
//# sourceMappingURL=roundRect-bNOhDTzS.chunk.mjs.map
|