quantizationUtils.4f3ed95a.js 2.6 KB

1
  1. import{aQ as d,aN as L,au as M,aR as A,aO as N,a as g,t as O}from"./index.6c049565.js";const f=(r,n,t)=>[n,t],s=(r,n,t)=>[n,t,r[2]],m=(r,n,t)=>[n,t,r[2],r[3]];function T(r){return r?{originPosition:r.originPosition==="upper-left"?"upperLeft":r.originPosition==="lower-left"?"lowerLeft":r.originPosition,scale:r.tolerance?[r.tolerance,r.tolerance]:[1,1],translate:g(r.extent)?[r.extent.xmin,r.extent.ymax]:[0,0]}:null}function h({scale:r,translate:n},t){return Math.round((t-n[0])/r[0])}function x({scale:r,translate:n},t){return Math.round((n[1]-t)/r[1])}function p(r,n,t){const u=[];let o,i,l,e;for(let c=0;c<t.length;c++){const a=t[c];c>0?(l=h(r,a[0]),e=x(r,a[1]),l===o&&e===i||(u.push(n(a,l-o,e-i)),o=l,i=e)):(o=h(r,a[0]),i=x(r,a[1]),u.push(n(a,o,i)))}return u.length>0?u:null}function b(r,n,t,u){return p(r,t?u?m:s:u?s:f,n)}function q(r,n,t,u){const o=[],i=t?u?m:s:u?s:f;for(let l=0;l<n.length;l++){const e=p(r,i,n[l]);e&&e.length>=3&&o.push(e)}return o.length?o:null}function v(r,n,t,u){const o=[],i=t?u?m:s:u?s:f;for(let l=0;l<n.length;l++){const e=p(r,i,n[l]);e&&e.length>=2&&o.push(e)}return o.length?o:null}function y({scale:r,translate:n},t){return t*r[0]+n[0]}function z({scale:r,translate:n},t){return n[1]-t*r[1]}function w(r,n,t){const u=new Array(t.length);if(!t.length)return u;const[o,i]=r.scale;let l=y(r,t[0][0]),e=z(r,t[0][1]);u[0]=n(t[0],l,e);for(let c=1;c<t.length;c++){const a=t[c];l+=a[0]*o,e-=a[1]*i,u[c]=n(a,l,e)}return u}function P(r,n,t){const u=new Array(t.length);for(let o=0;o<t.length;o++)u[o]=w(r,n,t[o]);return u}function B(r,n,t,u){return w(r,t?u?m:s:u?s:f,n)}function C(r,n,t,u){return P(r,t?u?m:s:u?s:f,n)}function E(r,n,t,u){return P(r,t?u?m:s:u?s:f,n)}function F(r,n,t,u,o){return n.xmin=h(r,t.xmin),n.ymin=x(r,t.ymin),n.xmax=h(r,t.xmax),n.ymax=x(r,t.ymax),n!==t&&(u&&(n.zmin=t.zmin,n.zmax=t.zmax),o&&(n.mmin=t.mmin,n.mmax=t.mmax)),n}function G(r,n,t,u,o){var i;return n.points=(i=b(r,t.points,u,o))!=null?i:[],n}function I(r,n,t,u,o){return n.x=h(r,t.x),n.y=x(r,t.y),n!==t&&(u&&(n.z=t.z),o&&(n.m=t.m)),n}function Q(r,n,t,u,o){const i=q(r,t.rings,u,o);return i?(n.rings=i,n):null}function R(r,n,t,u,o){const i=v(r,t.paths,u,o);return i?(n.paths=i,n):null}function U(r,n){return r&&n?d(n)?I(r,{},n,!1,!1):L(n)?R(r,{},n,!1,!1):M(n)?Q(r,{},n,!1,!1):A(n)?G(r,{},n,!1,!1):N(n)?F(r,{},n,!1,!1):null:null}function V(r,n,t,u,o){return g(t)&&(n.points=B(r,t.points,u,o)),n}function j(r,n,t,u,o){return O(t)||(n.x=y(r,t.x),n.y=z(r,t.y),n!==t&&(u&&(n.z=t.z),o&&(n.m=t.m))),n}function k(r,n,t,u,o){return g(t)&&(n.rings=E(r,t.rings,u,o)),n}function D(r,n,t,u,o){return g(t)&&(n.paths=C(r,t.paths,u,o)),n}export{k as B,D as C,I as O,U,V as q,T as s,j as v};