define((function(){"use strict";class t{static pointDistToLine(t,e,r,n,s,i){let l=((t-r)*(s-r)+(e-n)*(i-n))/((r-s)*(r-s)+(n-i)*(n-i)),a=r+l*(s-r),u=n+l*(i-n);return Math.sqrt((t-a)*(t-a)+(e-u)*(e-u))}static isPointOnSegment(e,r,n,s,i,l){if(e-5>n&&e+5>i||e+5s&&r+5>l||r+5=e||i>=e&&ot&&(n=!n)}}}return n?1:0}static lineIntersects(t,e,r,n,s,i,l,a){var u,o,h,c,f=[null,null];return 0===(u=(a-i)*(r-t)-(l-s)*(n-e))?null!==f[0]&&null!==f[1]&&f:(c=(r-t)*(o=e-i)-(n-e)*(h=t-s),o=((l-s)*o-(a-i)*h)/u,h=c/u,f[0]=t+o*(r-t),f[1]=e+o*(n-e),h>0&&h<1&&f)}static polyWith(e,r){let n,s,i,l,a,u,o,h,c=e.length/2,f=r.length/2;for(let p=0;p0?e[1]+r:e[1]-r;else{let t=Math.sqrt(r*r/(s/n*(s/n)+1));n<0&&(t=-t),i=e[0]+t,l=e[1]+s/n*t}return[i,l]}static lineOffset(e,r){let n=[],s=[];return e.forEach((function(i,l){if(l!==e.length-1){let a=t.processSegment(i,e[l+1],r);if(n.push(a),l>0){let r=n[l-1],i=t.lineIntersects(a[0][0],a[0][1],a[1][0],a[1][1],r[0][0],r[0][1],r[1][0],r[1][1]);!1!==i&&(r[1]=i,a[0]=i),s.push(r[0]),l===e.length-2&&(s.push(a[0]),s.push(a[1]))}2===e.length&&(s.push(a[0]),s.push(a[1]))}})),s}static processSegment(t,e,r){let n=t[0],s=e[0],i=Math.sqrt((n[0]-s[0])*(n[0]-s[0])+(n[1]-s[1])*(n[1]-s[1])),l=n[0]+r*(s[1]-n[1])/i,a=s[0]+r*(s[1]-n[1])/i,u=n[1]+r*(n[0]-s[0])/i,o=s[1]+r*(n[0]-s[0])/i;return[[[l,u],t[1]],[[a,o],e[1]]]}static isInBox(t,e){return t[0]>=e[0]&&t[1]>=e[1]&&t[2]<=e[2]&&t[3]<=e[3]}static Utf8ArrayToStr(t){var e,r,n,s,i,l;for(e="",n=t.length,r=0;r>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=String.fromCharCode(s);break;case 12:case 13:i=t[r++],e+=String.fromCharCode((31&s)<<6|63&i);break;case 14:i=t[r++],l=t[r++],e+=String.fromCharCode((15&s)<<12|(63&i)<<6|(63&l)<<0)}return e}}return t}));