You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
256 KiB

4 months ago
/*!
* @antv/g-lite
* @description A core module for rendering engine implements DOM API.
* @version 2.3.2
* @date 7/30/2025, 1:34:19 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).G={})}(this,function(t){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var e={exports:{}};!function(t){t.exports=function(){function t(t,n,i,a,o){e(t,n,i||0,a||t.length-1,o||r)}function e(t,r,i,a,o){for(;a>i;){if(a-i>600){var s=a-i+1,u=r-i+1,l=Math.log(s),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(s-c)/s)*(0>u-s/2?-1:1);e(t,r,Math.max(i,Math.floor(r-u*c/s+h)),Math.min(a,Math.floor(r+(s-u)*c/s+h)),o)}var f=t[r],d=i,v=a;for(n(t,i,r),o(t[a],f)>0&&n(t,i,a);v>d;){for(n(t,d,v),d++,v--;0>o(t[d],f);)d++;for(;o(t[v],f)>0;)v--}0===o(t[i],f)?n(t,i,v):n(t,++v,a),v>r||(i=v+1),r>v||(a=v-1)}}function n(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function r(t,e){return e>t?-1:t>e?1:0}var i=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(t,e,n){if(!n)return e.indexOf(t);for(var r=0;e.length>r;r++)if(n(t,e[r]))return r;return-1}function o(t,e){s(t,0,t.children.length,e,t)}function s(t,e,n,r,i){i||(i=g(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var a=e;n>a;a++){var o=t.children[a];u(i,t.leaf?r(o):o)}return i}function u(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function l(t,e){return t.minX-e.minX}function c(t,e){return t.minY-e.minY}function h(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function f(t){return t.maxX-t.minX+(t.maxY-t.minY)}function d(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function v(t,e){var n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),a=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,a-r)}function p(t,e){return!(t.minX>e.minX||t.minY>e.minY||e.maxX>t.maxX||e.maxY>t.maxY)}function y(t,e){return!(e.minX>t.maxX||e.minY>t.maxY||t.minX>e.maxX||t.minY>e.maxY)}function g(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(e,n,r,i,a){for(var o=[n,r];o.length;)if((r=o.pop())-(n=o.pop())>i){var s=n+Math.ceil((r-n)/i/2)*i;t(e,s,n,r,a),o.push(n,s,s,r)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(t){var e=this.data,n=[];if(!y(t,e))return n;for(var r=this.toBBox,i=[];e;){for(var a=0;e.children.length>a;a++){var o=e.children[a],s=e.leaf?r(o):o;y(t,s)&&(e.leaf?n.push(o):p(t,s)?this._all(o,n):i.push(o))}e=i.pop()}return n},i.prototype.collides=function(t){var e=this.data;if(!y(t,e))return!1;for(var n=[];e;){for(var r=0;e.children.length>r;r++){var i=e.children[r],a=e.leaf?this.toBBox(i):i;if(y(t,a)){if(e.leaf||p(t,a))return!0;n.push(i)}}e=n.pop()}return!1},i.prototype.load=function(t){if(!t||!t.length)return this;if(this._minEntries>t.length){for(var e=0;t.length>e;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(n.height>this.data.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},i.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},i.prototype.clear=function(){return this.data=g([]),this},i.prototype.remove=function(t,e){if(!t)return this;for(var n,r,i,o=this.data,s=this.toBBox(t),u=[],l=[];o||u.length;){if(o||(o=u.pop(),r=u[u.length-1],n=l.pop(),i=!0),o.leaf){var c=a(t,o.children,e);if(-1!==c)return o.children.splice(c,1),u.push(o),this._condense(u),this}i||o.leaf||!p(o,s)?r?(n++,o=r.children[n],i=!1):o=null:(u.push(o),l.push(n),n=0,r=o,o=o.children[0])}return this},i.prototype.toBBox=function(t){return t},i.prototype.compareMinX=function(t,e){return t.minX-e.minX},i.prototype.compareMinY=function(t,e){return t.minY-e.minY},i.prototype.t
/*!
* @antv/g-math
* @description Geometry util
* @version 3.0.1
* @date 7/30/2025, 1:34:14 PM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/function pi(t,e,n,r){var i=t-n,a=e-r;return Math.sqrt(i*i+a*a)}function yi(t,e){var n=Math.min.apply(Math,g(t)),r=Math.min.apply(Math,g(e));return{x:n,y:r,width:Math.max.apply(Math,g(t))-n,height:Math.max.apply(Math,g(e))-r}}function gi(t,e,n,r,i,a){return n*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a)+t}function mi(t,e,n,r,i,a){return n*Math.sin(i)*Math.cos(a)+r*Math.cos(i)*Math.sin(a)+e}function ki(t,e,n,r,i,a,o){for(var s=function(t,e,n){return Math.atan(-e/t*Math.tan(n))}(n,r,i),u=1/0,l=-1/0,c=[a,o],h=2*-Math.PI;2*Math.PI>=h;h+=Math.PI){var f=s+h;o>a?f>a&&o>f&&c.push(f):f>o&&a>f&&c.push(f)}for(var d=0;c.length>d;d++){var v=gi(t,0,n,r,i,c[d]);u>v&&(u=v),v>l&&(l=v)}for(var p=function(t,e,n){return Math.atan(e/(t*Math.tan(n)))}(n,r,i),y=1/0,g=-1/0,m=[a,o],k=2*-Math.PI;2*Math.PI>=k;k+=Math.PI){var x=p+k;o>a?x>a&&o>x&&m.push(x):x>o&&a>x&&m.push(x)}for(var E=0;m.length>E;E++){var b=mi(0,e,n,r,i,m[E]);y>b&&(y=b),b>g&&(g=b)}return{x:u,y:y,width:l-u,height:g-y}}function xi(t,e,n,r){return pi(t,e,n,r)}function Ei(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}}function bi(t,e,n,r,i){var a=1-i;return a*a*a*t+3*e*i*a*a+3*n*i*i*a+r*i*i*i}function Mi(t,e,n,r){var i,a,o,s=-3*t+9*e-9*n+3*r,u=6*t-12*e+6*n,l=3*e-3*t,c=[];if(oe(s,0))oe(u,0)||0>(i=-l/u)||i>1||c.push(i);else{var h=u*u-4*s*l;oe(h,0)?c.push(-u/(2*s)):h>0&&(a=(-u-(o=Math.sqrt(h)))/(2*s),0>(i=(-u+o)/(2*s))||i>1||c.push(i),0>a||a>1||c.push(a))}return c}function Ti(t,e,n,r,i,a,o,s){for(var u=[t,o],l=[e,s],c=Mi(t,n,i,o),h=Mi(e,r,a,s),f=0;c.length>f;f++)u.push(bi(t,n,i,o,c[f]));for(var d=0;h.length>d;d++)l.push(bi(e,r,a,s,h[d]));return yi(u,l)}function wi(t){return function(t){if(2>t.length)return 0;for(var e=0,n=0;t.length-1>n;n++){var r=t[n],i=t[n+1];e+=pi(r[0],r[1],i[0],i[1])}return e}(t)}function Si(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function Ni(t,e,n){var r=t+n-2*e;if(oe(r,0))return[.5];var i=(t-e)/r;return i>1||0>i?[]:[i]}function Pi(t,e,n,r,i,a){var o=Ni(t,n,i)[0],s=Ni(e,r,a)[0],u=[t,i],l=[e,a];return void 0!==o&&u.push(Si(t,n,i,o)),void 0!==s&&l.push(Si(e,r,a,s)),yi(u,l)}function Ci(t){var e;return 0===t.parsedStyle.d.totalLength&&(t.parsedStyle.d.totalLength=ze(t.parsedStyle.d.absolutePath,void 0,ce(ce({},e),{bbox:!1,length:!0})).length),t.parsedStyle.d.totalLength}function Ai(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ri(t,e){var n=t.prePoint,r=t.currentPoint,i=t.nextPoint,a=Math.pow(r[0]-n[0],2)+Math.pow(r[1]-n[1],2),o=Math.pow(r[0]-i[0],2)+Math.pow(r[1]-i[1],2),s=Math.acos((a+o-(Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2)))/(2*Math.sqrt(a)*Math.sqrt(o)));if(!s||0===Math.sin(s)||oe(s,0))return{xExtra:0,yExtra:0};var u=Math.abs(Math.atan2(i[1]-r[1],i[0]-r[0])),l=Math.abs(Math.atan2(i[0]-r[0],i[1]-r[1]));return l=l>Math.PI/2?Math.PI-l:l,{xExtra:Math.cos(s/2-(u=u>Math.PI/2?Math.PI-u:u))*(e/2*(1/Math.sin(s/2)))-e/2||0,yExtra:Math.cos(l-s/2)*(e/2*(1/Math.sin(s/2)))-e/2||0}}function Oi(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}hr(function(t){return re(t)?t.split(" ").map(hi):t.map(hi)});var Li=function(t,e){return(0>t.x*e.y-t.y*e.x?-1:1)*Math.acos((t.x*e.x+t.y*e.y)/Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2))))},Ii=function(t,e,n,r,i,a,o,s){e=Math.abs(e),n=Math.abs(n);var u=tn(r=se(r,360));if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(0===e||0===n)return{x:0,y:0,ellipticalArcAngle:0};var l=(t.x-o.x)/2,c=(t.y-o.y)/2,h={x:Math.cos(u)*l+Math.sin(u)*c,y:-Math.sin(u)*l+Math.cos(u)*c},f=Math.pow(h.x,2)/Math.pow(e,2)+Math.pow(h.y,2)/Math.pow(n,2);f>1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var d=(Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2))/(Math.pow(e,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2)),v=(i!==a?1:-1)*Math.sqrt(d=0>d?0:d),p=v*(e*h.y/n),y=v*(-n*h.x/e),g={x:Math.cos(u)*p-Math.sin(u)*y+(t.x+o.x)/2,y:Math.sin(u)*p+Math.cos(u)*y+(t.y+o.y)/2},m={x:(h.x-p)/e,y:(h.y-y)/n},k=Li({x:1,y:0},m),x=Li(m,{x:(-h.x-p)/e,y:(-h.y-y)/n});!a&&x>0?x-=2*Math.PI:a&&0>x&&(x+=2*Math.PI);var E=k+(x%=2*Math.PI)*s,b=e*Math.cos(E),M=n*Math.sin(E);return{x:Math.cos(u)*b-Math.si
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,i,a){var u=Object.create((r&&r.prototype instanceof s?r:s).prototype);return no(u,"_invoke",function(n,r,i){var a,s,u,l=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return a=e,s=0,u=t,f.n=n,o}};function d(n,r){for(s=n,u=r,e=0;!h&&l&&!i&&c.length>e;e++){var i,a=c[e],d=f.p,v=a[2];n>3?(i=v===r)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=t):d>=a[0]&&((i=2>n&&a[1]>d)?(s=0,f.v=r,f.n=a[1]):v>d&&(i=3>n||a[0]>r||r>v)&&(a[4]=n,a[5]=r,f.n=v,s=0))}if(i||n>1)return o;throw h=!0,r}return function(i,c,v){if(l>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,v),s=c,u=v;(e=2>s?t:u)||!h;){a||(s?3>s?(s>1&&(f.n=-1),d(s,u)):f.n=u:f.v=u);try{if(l=2,a){if(s||(i="next"),e=a[i]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,2>s&&(s=0)}else 1===s&&(e=a.return)&&e.call(a),2>s&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=t}else if((e=(h=0>f.n)?u:n.call(r,f))!==o)break}catch(e){a=t,s=1,u=e}finally{l=1}}return{value:e,done:h}}}(n,i,a),!0),u}var o={};function s(){}function u(){}function l(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(no(e={},r,function(){return this}),e),h=l.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,no(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return u.prototype=l,no(h,"constructor",l),no(l,"constructor",u),u.displayName="GeneratorFunction",no(l,i,"GeneratorFunction"),no(h),no(h,i,"Generator"),no(h,r,function(){return this}),no(h,"toString",function(){return"[object Generator]"}),(ro=function(){return{w:a,m:f}})()}function io(t,e){function n(r,i,a,o){try{var s=t[r](i),u=s.value;return u instanceof eo?e.resolve(u.v).then(function(t){n("next",t,a,o)},function(t){n("throw",t,a,o)}):e.resolve(u).then(function(t){s.value=t,a(s)},function(t){return n("throw",t,a,o)})}catch(t){o(t)}}var r;this.next||(no(io.prototype),no(io.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),no(this,"_invoke",function(t,i,a){function o(){return new e(function(e,r){n(t,a,e,r)})}return r=r?r.then(o,o):o()},!0)}function ao(t,e,n,r,i){return new io(ro().w(t,e,n,r),i||Promise)}function oo(t,e,n,r,i){var a=ao(t,e,n,r,i);return a.next().then(function(t){return t.done?t.value:a.next()})}function so(t){var e=Object(t),n=[];for(var r in e)n.unshift(r);return function t(){for(;n.length;)if((r=n.pop())in e)return t.value=r,t.done=!1,t;return t.done=!0,t}}function uo(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(r(t)+" is not iterable")}function lo(){var t=ro(),e=t.m(lo),n=(Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__).constructor;function r(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===n||"GeneratorFunction"===(e.displayName||e.name))}var i={throw:1,return:2,break:3,continue:3};function a(t){var e,n;return function(r){e||(e={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(t,e){return n(r.a,i[t],e)},delegateYield:function(t,i,a){return e.resultName=i,n(r.d,uo(t),a)},finish:function(t){return n(r.f,t)}},n=function(t,n,i){r.p=e.prev,r.n=e.next;try{return t(n,i)}finally{e.next=r.n}}),e.resultName&&(e[e.resultName]=r.v,e.resultName=void 0),e.sent=r.v,e.next=r.n;try{return t.call(this,e)}finally{r.p=e.prev,r.n=e.next}}}return(lo=function(){return{wrap:function(e,n,r,i){return t.w(a(e),n,r,i&&i.reverse())},isGeneratorFunction:r,mark:t.m,awrap:function(t,e){return new eo(t,e)},AsyncIterator:io,async:function(t,e,n,i,o){return(r(e)?ao:oo)(a(t),e,n,i,o)},keys:so,values:uo}})()}function co(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function ho(t){return fu
//# sourceMappingURL=index.umd.min.js.map