mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-04-21 08:21:53 +02:00
3 lines
30 KiB
JavaScript
3 lines
30 KiB
JavaScript
|
// https://d3js.org/d3-shape/ v3.1.0 Copyright 2010-2021 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="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{},t.d3)}(this,(function(t,n){"use strict";function i(t){return function(){return t}}const e=Math.abs,s=Math.atan2,o=Math.cos,h=Math.max,_=Math.min,r=Math.sin,a=Math.sqrt,l=1e-12,c=Math.PI,u=c/2,f=2*c;function y(t){return t>1?0:t<-1?c:Math.acos(t)}function x(t){return t>=1?u:t<=-1?-u:Math.asin(t)}function p(t){return t.innerRadius}function v(t){return t.outerRadius}function d(t){return t.startAngle}function T(t){return t.endAngle}function g(t){return t&&t.padAngle}function b(t,n,i,e,s,o,h,_){var r=i-t,a=e-n,c=h-s,u=_-o,f=u*r-c*a;if(!(f*f<l))return[t+(f=(c*(n-o)-u*(t-s))/f)*r,n+f*a]}function m(t,n,i,e,s,o,_){var r=t-i,l=n-e,c=(_?o:-o)/a(r*r+l*l),u=c*l,f=-c*r,y=t+u,x=n+f,p=i+u,v=e+f,d=(y+p)/2,T=(x+v)/2,g=p-y,b=v-x,m=g*g+b*b,w=s-o,k=y*v-p*x,N=(b<0?-1:1)*a(h(0,w*w*m-k*k)),S=(k*b-g*N)/m,E=(-k*g-b*N)/m,A=(k*b+g*N)/m,P=(-k*g+b*N)/m,M=S-d,C=E-T,O=A-d,R=P-T;return M*M+C*C>O*O+R*R&&(S=A,E=P),{cx:S,cy:E,x01:-u,y01:-f,x11:S*(s/w-1),y11:E*(s/w-1)}}var w=Array.prototype.slice;function k(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function N(t){this._context=t}function S(t){return new N(t)}function E(t){return t[0]}function A(t){return t[1]}function P(t,e){var s=i(!0),o=null,h=S,_=null;function r(i){var r,a,l,c=(i=k(i)).length,u=!1;for(null==o&&(_=h(l=n.path())),r=0;r<=c;++r)!(r<c&&s(a=i[r],r,i))===u&&((u=!u)?_.lineStart():_.lineEnd()),u&&_.point(+t(a,r,i),+e(a,r,i));if(l)return _=null,l+""||null}return t="function"==typeof t?t:void 0===t?E:i(t),e="function"==typeof e?e:void 0===e?A: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 M(t,e,s){var o=null,h=i(!0),_=null,r=S,a=null;function l(i){var l,c,u,f,y,x=(i=k(i)).length,p=!1,v=new Array(x),d=new Array(x);for(null==_&&(a=r(y=n.path())),l=0;l<=x;++l){if(!(l<x&&h(f=i[l],l,i))===p)if(p=!p)c=l,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),u=l-1;u>=c;--u)a.point(v[u],d[u]);a.lineEnd(),a.areaEnd()}p&&(v[l]=+t(f,l,i),d[l]=+e(f,l,i),a.point(o?+o(f,l,i):v[l],s?+s(f,l,i):d[l]))}if(y)return a=null,y+""||null}function c(){return P().defined(h).curve(r).context(_)}return t="function"==typeof t?t:void 0===t?E:i(+t),e="function"==typeof e?e:i(void 0===e?0:+e),s="function"==typeof s?s:void 0===s?A:i(+s),l.x=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),o=null,l):t},l.x0=function(n){return arguments.length?(t="function"==typeof n?n:i(+n),l):t},l.x1=function(t){return arguments.length?(o=null==t?null:"function"==typeof t?t:i(+t),l):o},l.y=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),s=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),l):e},l.y1=function(t){return arguments.length?(s=null==t?null:"function"==typeof t?t:i(+t),l):s},l.lineX0=l.lineY0=function(){return c().x(t).y(e)},l.lineY1=function(){return c().x(t).y(s)},l.lineX1=function(){return c().x(o).y(e)},l.defined=function(t){return arguments.length?(h="function"==typeof t?t:i(!!t),l):h},l.curve=function(t){return arguments.length?(r=t,null!=_&&(a=r(_)),l):r},l.context=function(t){return arguments.length?(null==t?_=a=null:a=r(_=t),l):_},l}function C(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function O(t){return t}N.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._cont
|