define(["exports","./when-54c2dc71","./Check-6c0211bc","./Math-fc8cecf5","./Cartesian2-bddc1162","./WebGLConstants-76bb35d1","./ComponentDatatype-6d99a1ee","./GeometryAttribute-44fb48f1","./EllipsoidRhumbLine-c704bf4c"],function(e,T,t,W,P,n,I,B,N){"use strict";function r(e,t,n){n=n||2;var r,a,i,x,u,o,s,p=t&&t.length,h=p?t[0]*n:e.length,f=l(e,0,h,n,!0),y=[];if(!f||f.next===f.prev)return y;if(p&&(f=function(e,t,n,r){var a,i,x,u,o,s=[];for(a=0,i=t.length;a=r.next.y&&r.next.y!==r.y){var u=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(u<=a&&x=r.x&&r.x>=p&&a!==r.x&&g(in.x||r.x===n.x&&function(e,t){return b(e.prev,e,t.prev)<0&&b(t.next,e,e.next)<0}(n,r)))&&(n=r,f=o)),r=r.next,r!==s;);return n}(e,t))&&c(n=E(t,e),n.next)}}(s[a],n),n=c(n,n.next);return n}(e,t,f,n)),e.length>80*n){r=i=e[0],a=x=e[1];for(var v=n;vi.x?a.x>x.x?a.x:x.x:i.x>x.x?i.x:x.x,p=a.y>i.y?a.y>x.y?a.y:x.y:i.y>x.y?i.y:x.y,h=C(u,o,t,n,r),f=C(s,p,t,n,r),y=e.prevZ,v=e.nextZ;for(;y&&y.z>=h&&v&&v.z<=f;){if(y!==e.prev&&y!==e.next&&g(a.x,a.y,i.x,i.y,x.x,x.y,y.x,y.y)&&0<=b(y.prev,y,y.next))return!1;if(y=y.prevZ,v!==e.prev&&v!==e.next&&g(a.x,a.y,i.x,i.y,x.x,x.y,v.x,v.y)&&0<=b(v.prev,v,v.next))return!1;v=v.nextZ}for(;y&&y.z>=h;){if(y!==e.prev&&y!==e.next&&g(a.x,a.y,i.x,i.y,x.x,x.y,y.x,y.y)&&0<=b(y.prev,y,y.next))return!1;y=y.prevZ}for(;v&&v.z<=f;){if(v!==e.prev&&v!==e.next&&g(a.x,a.y,i.x,i.y,x.x,x.y,v.x,v.y)&&0<=b(v.prev,v,v.next))return!1;v=v.nextZ}return!0}(e,r,a,i):function(e){var t=e.prev,n=e,r=e.next;if(0<=b(t,n,r))return!1;var a=e.next.next;for(;a!==e.prev;){if(g(t.x,t.y,n.x,n.y,r.x,r.y,a.x,a.y)&&0<=b(a.prev,a,a.next))return!1;a=a.next}return!0}(e))t.push(u.i/n),t.push(e.i/n),t.push(o.i/n),f(e),e=o.next,s=o.next;else if((e=o)===s){x?1===x?d(e=function(e,t,n){var r=e;do{var a=r.prev,i=r.next.next;!p(a,i)&&h(a,r,r.next,i)&&w(a,i)&&w(i,a)&&(t.push(a.i/n),t.push(r.i/n),t.push(i.i/n),f(r),f(r.next),r=e=i),r=r.next}while(r!==e);return c(r)}(c(e),t,n),t,n,r,a,i,2):2===x&&function(e,t,n,r,a,i){var x=e;do{for(var u=x.next.next;u!==x.prev;){if(x.i!==u.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&h(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(w(e,t)&&w(t,e)&&function(e,t){var n=e,r=!1,a=(e.x+t.x)/2,i=(e.y+t.y)/2;for(;n.y>i!=n.next.y>i&&n.next.y!==n.y&&a<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next,n!==e;);return r}(e,t)&&(b(e.prev,e,t.prev)||b(e,t.prev,t))||p(e,t)&&0=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function s(e){return 0