Socket
Socket
Sign inDemoInstall

d3-shape

Package Overview
Dependencies
1
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-rc.1 to 2.0.0

2

dist/d3-shape.js

@@ -1,2 +0,2 @@

// https://d3js.org/d3-shape/ v2.0.0-rc.1 Copyright 2020 Mike Bostock
// https://d3js.org/d3-shape/ v2.0.0 Copyright 2020 Mike Bostock
(function (global, factory) {

@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-path')) :

@@ -1,2 +0,2 @@

// https://d3js.org/d3-shape/ v2.0.0-rc.1 Copyright 2020 Mike Bostock
// https://d3js.org/d3-shape/ v2.0.0 Copyright 2020 Mike Bostock
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-path"],n):n((t=t||self).d3=t.d3||{},t.d3)}(this,function(t,n){"use strict";function i(t){return function(){return t}}var e=Math.abs,s=Math.atan2,o=Math.cos,h=Math.max,_=Math.min,r=Math.sin,a=Math.sqrt,c=1e-12,u=Math.PI,l=u/2,f=2*u;function y(t){return t>=1?l:t<=-1?-l:Math.asin(t)}function x(t){return t.innerRadius}function p(t){return t.outerRadius}function v(t){return t.startAngle}function d(t){return t.endAngle}function T(t){return t&&t.padAngle}function g(t,n,i,e,s,o,_){var r=t-i,c=n-e,u=(_?o:-o)/a(r*r+c*c),l=u*c,f=-u*r,y=t+l,x=n+f,p=i+l,v=e+f,d=(y+p)/2,T=(x+v)/2,g=p-y,b=v-x,m=g*g+b*b,k=s-o,w=y*v-p*x,N=(b<0?-1:1)*a(h(0,k*k*m-w*w)),M=(w*b-g*N)/m,S=(-w*g-b*N)/m,E=(w*b+g*N)/m,A=(-w*g+b*N)/m,P=M-d,C=S-T,O=E-d,R=A-T;return P*P+C*C>O*O+R*R&&(M=E,S=A),{cx:M,cy:S,x01:-l,y01:-f,x11:M*(s/k-1),y11:S*(s/k-1)}}var b=Array.prototype.slice;function m(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function k(t){this._context=t}function w(t){return new k(t)}function N(t){return t[0]}function M(t){return t[1]}function S(t,e){var s=i(!0),o=null,h=w,_=null;function r(i){var r,a,c,u=(i=m(i)).length,l=!1;for(null==o&&(_=h(c=n.path())),r=0;r<=u;++r)!(r<u&&s(a=i[r],r,i))===l&&((l=!l)?_.lineStart():_.lineEnd()),l&&_.point(+t(a,r,i),+e(a,r,i));if(c)return _=null,c+""||null}return t="function"==typeof t?t:void 0===t?N:i(t),e="function"==typeof e?e:void 0===e?M:i(e),r.x=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),r):e},r.defined=function(t){return arguments.length?(s="function"==typeof t?t:i(!!t),r):s},r.curve=function(t){return arguments.length?(h=t,null!=o&&(_=h(o)),r):h},r.context=function(t){return arguments.length?(null==t?o=_=null:_=h(o=t),r):o},r}function E(t,e,s){var o=null,h=i(!0),_=null,r=w,a=null;function c(i){var c,u,l,f,y,x=(i=m(i)).length,p=!1,v=new Array(x),d=new Array(x);for(null==_&&(a=r(y=n.path())),c=0;c<=x;++c){if(!(c<x&&h(f=i[c],c,i))===p)if(p=!p)u=c,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),l=c-1;l>=u;--l)a.point(v[l],d[l]);a.lineEnd(),a.areaEnd()}p&&(v[c]=+t(f,c,i),d[c]=+e(f,c,i),a.point(o?+o(f,c,i):v[c],s?+s(f,c,i):d[c]))}if(y)return a=null,y+""||null}function u(){return S().defined(h).curve(r).context(_)}return t="function"==typeof t?t:void 0===t?N:i(+t),e="function"==typeof e?e:i(void 0===e?0:+e),s="function"==typeof s?s:void 0===s?M:i(+s),c.x=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),o=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),c):t},c.x1=function(t){return arguments.length?(o=null==t?null:"function"==typeof t?t:i(+t),c):o},c.y=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),s=null,c):e},c.y0=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),c):e},c.y1=function(t){return arguments.length?(s=null==t?null:"function"==typeof t?t:i(+t),c):s},c.lineX0=c.lineY0=function(){return u().x(t).y(e)},c.lineY1=function(){return u().x(t).y(s)},c.lineX1=function(){return u().x(o).y(e)},c.defined=function(t){return arguments.length?(h="function"==typeof t?t:i(!!t),c):h},c.curve=function(t){return arguments.length?(r=t,null!=_&&(a=r(_)),c):r},c.context=function(t){return arguments.length?(null==t?_=a=null:a=r(_=t),c):_},c}function A(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function P(t){return t}k.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var C=R(w);function O(t){this._curve=t}function R(t){function n(n){return new O(t(n))}return n._curve=t,n}function q(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(R(t)):n()._curve},t}function z(){return q(S().curve(C))}function X(){var t=E().curve(C),n=t.curve,i=t.lineX0,e=t.lineX1,s=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return q(i())},delete t.lineX0,t.lineEndAngle=function(){return q(e())},delete t.lineX1,t.lineInnerRadius=function(){return q(s())},delete t.lineY0,t.lineOuterRadius=function(){return q(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(R(t)):n()._curve},t}function Y(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}function B(t){return t.source}function j(t){return t.target}function I(t){var e=B,s=j,o=N,h=M,_=null;function r(){var i,r=b.call(arguments),a=e.apply(this,r),c=s.apply(this,r);if(_||(_=i=n.path()),t(_,+o.apply(this,(r[0]=a,r)),+h.apply(this,r),+o.apply(this,(r[0]=c,r)),+h.apply(this,r)),i)return _=null,i+""||null}return r.source=function(t){return arguments.length?(e=t,r):e},r.target=function(t){return arguments.length?(s=t,r):s},r.x=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),r):o},r.y=function(t){return arguments.length?(h="function"==typeof t?t:i(+t),r):h},r.context=function(t){return arguments.length?(_=null==t?null:t,r):_},r}function D(t,n,i,e,s){t.moveTo(n,i),t.bezierCurveTo(n=(n+e)/2,i,n,s,e,s)}function L(t,n,i,e,s){t.moveTo(n,i),t.bezierCurveTo(n,i=(i+s)/2,e,i,e,s)}function V(t,n,i,e,s){var o=Y(n,i),h=Y(n,i=(i+s)/2),_=Y(e,i),r=Y(e,s);t.moveTo(o[0],o[1]),t.bezierCurveTo(h[0],h[1],_[0],_[1],r[0],r[1])}O.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var W={draw:function(t,n){var i=Math.sqrt(n/u);t.moveTo(i,0),t.arc(0,0,i,0,f)}},H={draw:function(t,n){var i=Math.sqrt(n/5)/2;t.moveTo(-3*i,-i),t.lineTo(-i,-i),t.lineTo(-i,-3*i),t.lineTo(i,-3*i),t.lineTo(i,-i),t.lineTo(3*i,-i),t.lineTo(3*i,i),t.lineTo(i,i),t.lineTo(i,3*i),t.lineTo(-i,3*i),t.lineTo(-i,i),t.lineTo(-3*i,i),t.closePath()}},F=Math.sqrt(1/3),G=2*F,J={draw:function(t,n){var i=Math.sqrt(n/G),e=i*F;t.moveTo(0,-i),t.lineTo(e,0),t.lineTo(0,i),t.lineTo(-e,0),t.closePath()}},K=Math.sin(u/10)/Math.sin(7*u/10),Q=Math.sin(f/10)*K,U=-Math.cos(f/10)*K,Z={draw:function(t,n){var i=Math.sqrt(.8908130915292852*n),e=Q*i,s=U*i;t.moveTo(0,-i),t.lineTo(e,s);for(var o=1;o<5;++o){var h=f*o/5,_=Math.cos(h),r=Math.sin(h);t.lineTo(r*i,-_*i),t.lineTo(_*e-r*s,r*e+_*s)}t.closePath()}},$={draw:function(t,n){var i=Math.sqrt(n),e=-i/2;t.rect(e,e,i,i)}},tt=Math.sqrt(3),nt={draw:function(t,n){var i=-Math.sqrt(n/(3*tt));t.moveTo(0,2*i),t.lineTo(-tt*i,-i),t.lineTo(tt*i,-i),t.closePath()}},it=-.5,et=Math.sqrt(3)/2,st=1/Math.sqrt(12),ot=3*(st/2+1),ht={draw:function(t,n){var i=Math.sqrt(n/ot),e=i/2,s=i*st,o=e,h=i*st+i,_=-o,r=h;t.moveTo(e,s),t.lineTo(o,h),t.lineTo(_,r),t.lineTo(it*e-et*s,et*e+it*s),t.lineTo(it*o-et*h,et*o+it*h),t.lineTo(it*_-et*r,et*_+it*r),t.lineTo(it*e+et*s,it*s-et*e),t.lineTo(it*o+et*h,it*h-et*o),t.lineTo(it*_+et*r,it*r-et*_),t.closePath()}},_t=[W,H,J,$,Z,nt,ht];function rt(){}function at(t,n,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+i)/6)}function ct(t){this._context=t}function ut(t){this._context=t}function lt(t){this._context=t}function ft(t,n){this._basis=new ct(t),this._beta=n}ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:at(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:at(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},ut.prototype={areaStart:rt,areaEnd:rt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:at(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},lt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var i=(this._x0+4*this._x1+t)/6,e=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 3:this._point=4;default:at(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},ft.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,i=t.length-1;if(i>0)for(var e,s=t[0],o=n[0],h=t[i]-s,_=n[i]-o,r=-1;++r<=i;)e=r/i,this._basis.point(this._beta*t[r]+(1-this._beta)*(s+e*h),this._beta*n[r]+(1-this._beta)*(o+e*_));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var yt=function t(n){function i(t){return 1===n?new ct(t):new ft(t,n)}return i.beta=function(n){return t(+n)},i}(.85);function xt(t,n,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function pt(t,n){this._context=t,this._k=(1-n)/6}pt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:xt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:xt(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var vt=function t(n){function i(t){return new pt(t,n)}return i.tension=function(n){return t(+n)},i}(0);function dt(t,n){this._context=t,this._k=(1-n)/6}dt.prototype={areaStart:rt,areaEnd:rt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:xt(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Tt=function t(n){function i(t){return new dt(t,n)}return i.tension=function(n){return t(+n)},i}(0);function gt(t,n){this._context=t,this._k=(1-n)/6}gt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:xt(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var bt=function t(n){function i(t){return new gt(t,n)}return i.tension=function(n){return t(+n)},i}(0);function mt(t,n,i){var e=t._x1,s=t._y1,o=t._x2,h=t._y2;if(t._l01_a>c){var _=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,r=3*t._l01_a*(t._l01_a+t._l12_a);e=(e*_-t._x0*t._l12_2a+t._x2*t._l01_2a)/r,s=(s*_-t._y0*t._l12_2a+t._y2*t._l01_2a)/r}if(t._l23_a>c){var a=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*a+t._x1*t._l23_2a-n*t._l12_2a)/u,h=(h*a+t._y1*t._l23_2a-i*t._l12_2a)/u}t._context.bezierCurveTo(e,s,o,h,t._x2,t._y2)}function kt(t,n){this._context=t,this._alpha=n}kt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:mt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var wt=function t(n){function i(t){return n?new kt(t,n):new pt(t,0)}return i.alpha=function(n){return t(+n)},i}(.5);function Nt(t,n){this._context=t,this._alpha=n}Nt.prototype={areaStart:rt,areaEnd:rt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:mt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Mt=function t(n){function i(t){return n?new Nt(t,n):new dt(t,0)}return i.alpha=function(n){return t(+n)},i}(.5);function St(t,n){this._context=t,this._alpha=n}St.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:mt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Et=function t(n){function i(t){return n?new St(t,n):new gt(t,0)}return i.alpha=function(n){return t(+n)},i}(.5);function At(t){this._context=t}function Pt(t){return t<0?-1:1}function Ct(t,n,i){var e=t._x1-t._x0,s=n-t._x1,o=(t._y1-t._y0)/(e||s<0&&-0),h=(i-t._y1)/(s||e<0&&-0),_=(o*s+h*e)/(e+s);return(Pt(o)+Pt(h))*Math.min(Math.abs(o),Math.abs(h),.5*Math.abs(_))||0}function Ot(t,n){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-n)/2:n}function Rt(t,n,i){var e=t._x0,s=t._y0,o=t._x1,h=t._y1,_=(o-e)/3;t._context.bezierCurveTo(e+_,s+_*n,o-_,h-_*i,o,h)}function qt(t){this._context=t}function zt(t){this._context=new Xt(t)}function Xt(t){this._context=t}function Yt(t){this._context=t}function Bt(t){var n,i,e=t.length-1,s=new Array(e),o=new Array(e),h=new Array(e);for(s[0]=0,o[0]=2,h[0]=t[0]+2*t[1],n=1;n<e-1;++n)s[n]=1,o[n]=4,h[n]=4*t[n]+2*t[n+1];for(s[e-1]=2,o[e-1]=7,h[e-1]=8*t[e-1]+t[e],n=1;n<e;++n)i=s[n]/o[n-1],o[n]-=i,h[n]-=i*h[n-1];for(s[e-1]=h[e-1]/o[e-1],n=e-2;n>=0;--n)s[n]=(h[n]-s[n+1])/o[n];for(o[e-1]=(t[e]+s[e-1])/2,n=0;n<e-1;++n)o[n]=2*t[n+1]-s[n+1];return[s,o]}function jt(t,n){this._context=t,this._t=n}function It(t,n){if((s=t.length)>1)for(var i,e,s,o=1,h=t[n[0]],_=h.length;o<s;++o)for(e=h,h=t[n[o]],i=0;i<_;++i)h[i][1]+=h[i][0]=isNaN(e[i][1])?e[i][0]:e[i][1]}function Dt(t){for(var n=t.length,i=new Array(n);--n>=0;)i[n]=n;return i}function Lt(t,n){return t[n]}function Vt(t){const n=[];return n.key=t,n}function Wt(t){var n=t.map(Ht);return Dt(t).sort(function(t,i){return n[t]-n[i]})}function Ht(t){for(var n,i=-1,e=0,s=t.length,o=-1/0;++i<s;)(n=+t[i][1])>o&&(o=n,e=i);return e}function Ft(t){var n=t.map(Gt);return Dt(t).sort(function(t,i){return n[t]-n[i]})}function Gt(t){for(var n,i=0,e=-1,s=t.length;++e<s;)(n=+t[e][1])&&(i+=n);return i}At.prototype={areaStart:rt,areaEnd:rt,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},qt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Rt(this,this._t0,Ot(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var i=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,Rt(this,Ot(this,i=Ct(this,t,n)),i);break;default:Rt(this,this._t0,i=Ct(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=i}}},(zt.prototype=Object.create(qt.prototype)).point=function(t,n){qt.prototype.point.call(this,n,t)},Xt.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,i,e,s,o){this._context.bezierCurveTo(n,t,e,i,o,s)}},Yt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,i=t.length;if(i)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===i)this._context.lineTo(t[1],n[1]);else for(var e=Bt(t),s=Bt(n),o=0,h=1;h<i;++o,++h)this._context.bezierCurveTo(e[0][o],s[0][o],e[1][o],s[1][o],t[h],n[h]);(this._line||0!==this._line&&1===i)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},jt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,n)}}this._x=t,this._y=n}},t.arc=function(){var t=x,h=p,b=i(0),m=null,k=v,w=d,N=T,M=null;function S(){var i,x,p=+t.apply(this,arguments),v=+h.apply(this,arguments),d=k.apply(this,arguments)-l,T=w.apply(this,arguments)-l,S=e(T-d),E=T>d;if(M||(M=i=n.path()),v<p&&(x=v,v=p,p=x),v>c)if(S>f-c)M.moveTo(v*o(d),v*r(d)),M.arc(0,0,v,d,T,!E),p>c&&(M.moveTo(p*o(T),p*r(T)),M.arc(0,0,p,T,d,E));else{var A,P,C=d,O=T,R=d,q=T,z=S,X=S,Y=N.apply(this,arguments)/2,B=Y>c&&(m?+m.apply(this,arguments):a(p*p+v*v)),j=_(e(v-p)/2,+b.apply(this,arguments)),I=j,D=j;if(B>c){var L=y(B/p*r(Y)),V=y(B/v*r(Y));(z-=2*L)>c?(R+=L*=E?1:-1,q-=L):(z=0,R=q=(d+T)/2),(X-=2*V)>c?(C+=V*=E?1:-1,O-=V):(X=0,C=O=(d+T)/2)}var W=v*o(C),H=v*r(C),F=p*o(q),G=p*r(q);if(j>c){var J,K=v*o(O),Q=v*r(O),U=p*o(R),Z=p*r(R);if(S<u&&(J=function(t,n,i,e,s,o,h,_){var r=i-t,a=e-n,u=h-s,l=_-o,f=l*r-u*a;if(!(f*f<c))return[t+(f=(u*(n-o)-l*(t-s))/f)*r,n+f*a]}(W,H,U,Z,K,Q,F,G))){var $=W-J[0],tt=H-J[1],nt=K-J[0],it=Q-J[1],et=1/r(function(t){return t>1?0:t<-1?u:Math.acos(t)}(($*nt+tt*it)/(a($*$+tt*tt)*a(nt*nt+it*it)))/2),st=a(J[0]*J[0]+J[1]*J[1]);I=_(j,(p-st)/(et-1)),D=_(j,(v-st)/(et+1))}}X>c?D>c?(A=g(U,Z,W,H,v,D,E),P=g(K,Q,F,G,v,D,E),M.moveTo(A.cx+A.x01,A.cy+A.y01),D<j?M.arc(A.cx,A.cy,D,s(A.y01,A.x01),s(P.y01,P.x01),!E):(M.arc(A.cx,A.cy,D,s(A.y01,A.x01),s(A.y11,A.x11),!E),M.arc(0,0,v,s(A.cy+A.y11,A.cx+A.x11),s(P.cy+P.y11,P.cx+P.x11),!E),M.arc(P.cx,P.cy,D,s(P.y11,P.x11),s(P.y01,P.x01),!E))):(M.moveTo(W,H),M.arc(0,0,v,C,O,!E)):M.moveTo(W,H),p>c&&z>c?I>c?(A=g(F,G,K,Q,p,-I,E),P=g(W,H,U,Z,p,-I,E),M.lineTo(A.cx+A.x01,A.cy+A.y01),I<j?M.arc(A.cx,A.cy,I,s(A.y01,A.x01),s(P.y01,P.x01),!E):(M.arc(A.cx,A.cy,I,s(A.y01,A.x01),s(A.y11,A.x11),!E),M.arc(0,0,p,s(A.cy+A.y11,A.cx+A.x11),s(P.cy+P.y11,P.cx+P.x11),E),M.arc(P.cx,P.cy,I,s(P.y11,P.x11),s(P.y01,P.x01),!E))):M.arc(0,0,p,q,R,E):M.lineTo(F,G)}else M.moveTo(0,0);if(M.closePath(),i)return M=null,i+""||null}return S.centroid=function(){var n=(+t.apply(this,arguments)+ +h.apply(this,arguments))/2,i=(+k.apply(this,arguments)+ +w.apply(this,arguments))/2-u/2;return[o(i)*n,r(i)*n]},S.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),S):t},S.outerRadius=function(t){return arguments.length?(h="function"==typeof t?t:i(+t),S):h},S.cornerRadius=function(t){return arguments.length?(b="function"==typeof t?t:i(+t),S):b},S.padRadius=function(t){return arguments.length?(m=null==t?null:"function"==typeof t?t:i(+t),S):m},S.startAngle=function(t){return arguments.length?(k="function"==typeof t?t:i(+t),S):k},S.endAngle=function(t){return arguments.length?(w="function"==typeof t?t:i(+t),S):w},S.padAngle=function(t){return arguments.length?(N="function"==typeof t?t:i(+t),S):N},S.context=function(t){return arguments.length?(M=null==t?null:t,S):M},S},t.area=E,t.areaRadial=X,t.curveBasis=function(t){return new ct(t)},t.curveBasisClosed=function(t){return new ut(t)},t.curveBasisOpen=function(t){return new lt(t)},t.curveBundle=yt,t.curveCardinal=vt,t.curveCardinalClosed=Tt,t.curveCardinalOpen=bt,t.curveCatmullRom=wt,t.curveCatmullRomClosed=Mt,t.curveCatmullRomOpen=Et,t.curveLinear=w,t.curveLinearClosed=function(t){return new At(t)},t.curveMonotoneX=function(t){return new qt(t)},t.curveMonotoneY=function(t){return new zt(t)},t.curveNatural=function(t){return new Yt(t)},t.curveStep=function(t){return new jt(t,.5)},t.curveStepAfter=function(t){return new jt(t,1)},t.curveStepBefore=function(t){return new jt(t,0)},t.line=S,t.lineRadial=z,t.linkHorizontal=function(){return I(D)},t.linkRadial=function(){var t=I(V);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.linkVertical=function(){return I(L)},t.pie=function(){var t=P,n=A,e=null,s=i(0),o=i(f),h=i(0);function _(i){var _,r,a,c,u,l=(i=m(i)).length,y=0,x=new Array(l),p=new Array(l),v=+s.apply(this,arguments),d=Math.min(f,Math.max(-f,o.apply(this,arguments)-v)),T=Math.min(Math.abs(d)/l,h.apply(this,arguments)),g=T*(d<0?-1:1);for(_=0;_<l;++_)(u=p[x[_]=_]=+t(i[_],_,i))>0&&(y+=u);for(null!=n?x.sort(function(t,i){return n(p[t],p[i])}):null!=e&&x.sort(function(t,n){return e(i[t],i[n])}),_=0,a=y?(d-l*g)/y:0;_<l;++_,v=c)r=x[_],c=v+((u=p[r])>0?u*a:0)+g,p[r]={data:i[r],index:_,value:u,startAngle:v,endAngle:c,padAngle:T};return p}return _.value=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),_):t},_.sortValues=function(t){return arguments.length?(n=t,e=null,_):n},_.sort=function(t){return arguments.length?(e=t,n=null,_):e},_.startAngle=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),_):s},_.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),_):o},_.padAngle=function(t){return arguments.length?(h="function"==typeof t?t:i(+t),_):h},_},t.pointRadial=Y,t.radialArea=X,t.radialLine=z,t.stack=function(){var t=i([]),n=Dt,e=It,s=Lt;function o(i){var o,h,_=Array.from(t.apply(this,arguments),Vt),r=_.length,a=-1;for(const t of i)for(o=0,++a;o<r;++o)(_[o][a]=[0,+s(t,_[o].key,a,i)]).data=t;for(o=0,h=m(n(_));o<r;++o)_[h[o]].index=o;return e(_,h),_}return o.keys=function(n){return arguments.length?(t="function"==typeof n?n:i(Array.from(n)),o):t},o.value=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),o):s},o.order=function(t){return arguments.length?(n=null==t?Dt:"function"==typeof t?t:i(Array.from(t)),o):n},o.offset=function(t){return arguments.length?(e=null==t?It:t,o):e},o},t.stackOffsetDiverging=function(t,n){if((_=t.length)>0)for(var i,e,s,o,h,_,r=0,a=t[n[0]].length;r<a;++r)for(o=h=0,i=0;i<_;++i)(s=(e=t[n[i]][r])[1]-e[0])>0?(e[0]=o,e[1]=o+=s):s<0?(e[1]=h,e[0]=h+=s):(e[0]=0,e[1]=s)},t.stackOffsetExpand=function(t,n){if((e=t.length)>0){for(var i,e,s,o=0,h=t[0].length;o<h;++o){for(s=i=0;i<e;++i)s+=t[i][o][1]||0;if(s)for(i=0;i<e;++i)t[i][o][1]/=s}It(t,n)}},t.stackOffsetNone=It,t.stackOffsetSilhouette=function(t,n){if((i=t.length)>0){for(var i,e=0,s=t[n[0]],o=s.length;e<o;++e){for(var h=0,_=0;h<i;++h)_+=t[h][e][1]||0;s[e][1]+=s[e][0]=-_/2}It(t,n)}},t.stackOffsetWiggle=function(t,n){if((s=t.length)>0&&(e=(i=t[n[0]]).length)>0){for(var i,e,s,o=0,h=1;h<e;++h){for(var _=0,r=0,a=0;_<s;++_){for(var c=t[n[_]],u=c[h][1]||0,l=(u-(c[h-1][1]||0))/2,f=0;f<_;++f){var y=t[n[f]];l+=(y[h][1]||0)-(y[h-1][1]||0)}r+=u,a+=l*u}i[h-1][1]+=i[h-1][0]=o,r&&(o-=a/r)}i[h-1][1]+=i[h-1][0]=o,It(t,n)}},t.stackOrderAppearance=Wt,t.stackOrderAscending=Ft,t.stackOrderDescending=function(t){return Ft(t).reverse()},t.stackOrderInsideOut=function(t){var n,i,e=t.length,s=t.map(Gt),o=Wt(t),h=0,_=0,r=[],a=[];for(n=0;n<e;++n)i=o[n],h<_?(h+=s[i],r.push(i)):(_+=s[i],a.push(i));return a.reverse().concat(r)},t.stackOrderNone=Dt,t.stackOrderReverse=function(t){return Dt(t).reverse()},t.symbol=function(t,e){var s=null;function o(){var i;if(s||(s=i=n.path()),t.apply(this,arguments).draw(s,+e.apply(this,arguments)),i)return s=null,i+""||null}return t="function"==typeof t?t:i(t||W),e="function"==typeof e?e:i(void 0===e?64:+e),o.type=function(n){return arguments.length?(t="function"==typeof n?n:i(n),o):t},o.size=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),o):e},o.context=function(t){return arguments.length?(s=null==t?null:t,o):s},o},t.symbolCircle=W,t.symbolCross=H,t.symbolDiamond=J,t.symbolSquare=$,t.symbolStar=Z,t.symbolTriangle=nt,t.symbolWye=ht,t.symbols=_t,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "d3-shape",
"version": "2.0.0-rc.1",
"publishConfig": {
"tag": "next"
},
"version": "2.0.0",
"description": "Graphical primitives for visualization, such as lines and areas.",

@@ -41,7 +38,7 @@ "keywords": [

"dependencies": {
"d3-path": ">=2.0.0-rc.1"
"d3-path": "1 - 2"
},
"sideEffects": false,
"devDependencies": {
"d3-polygon": ">=2.0.0-rc.1",
"d3-polygon": "1 - 2",
"eslint": "6",

@@ -48,0 +45,0 @@ "rollup": "1",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc