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.

9 lines
14 KiB

export function create() {
const source = "const e=\"GENERATE_POLYGON_BUFFERS\",t=\"GENERATE_POINT_BUFFERS\",n=\"GENERATE_LINE_STRING_BUFFERS\",r=\"undefined\"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():\"\";r.includes(\"firefox\");r.includes(\"safari\")&&!r.includes(\"chrom\")&&(r.includes(\"version/15.4\")||/cpu (os|iphone os) 15_4 like mac os x/.test(r)),r.includes(\"webkit\")&&r.includes(\"edge\"),r.includes(\"macintosh\"),\"undefined\"!=typeof WorkerGlobalScope&&\"undefined\"!=typeof OffscreenCanvas&&(self,WorkerGlobalScope),function(){let e=!1;try{const t=Object.defineProperty({},\"passive\",{get:function(){e=!0}});window.addEventListener(\"_\",null,t),window.removeEventListener(\"_\",null,t)}catch(e){}}();const o={1:\"The view center is not defined\",2:\"The view resolution is not defined\",3:\"The view rotation is not defined\",4:\"`image` and `src` cannot be provided at the same time\",5:\"`imgSize` must be set when `image` is provided\",7:\"`format` must be set when `url` is set\",8:\"Unknown `serverType` configured\",9:\"`url` must be configured or set using `#setUrl()`\",10:\"The default `geometryFunction` can only handle `Point` geometries\",11:\"`options.featureTypes` must be an Array\",12:\"`options.geometryName` must also be provided when `options.bbox` is set\",13:\"Invalid corner\",14:\"Invalid color\",15:\"Tried to get a value for a key that does not exist in the cache\",16:\"Tried to set a value for a key that is used already\",17:\"`resolutions` must be sorted in descending order\",18:\"Either `origin` or `origins` must be configured, never both\",19:\"Number of `tileSizes` and `resolutions` must be equal\",20:\"Number of `origins` and `resolutions` must be equal\",22:\"Either `tileSize` or `tileSizes` must be configured, never both\",24:\"Invalid extent or geometry provided as `geometry`\",25:\"Cannot fit empty extent provided as `geometry`\",26:\"Features must have an id set\",27:\"Features must have an id set\",28:'`renderMode` must be `\"hybrid\"` or `\"vector\"`',30:\"The passed `feature` was already added to the source\",31:\"Tried to enqueue an `element` that was already added to the queue\",32:\"Transformation matrix cannot be inverted\",33:\"Invalid units\",34:\"Invalid geometry layout\",36:\"Unknown SRS type\",37:\"Unknown geometry type found\",38:\"`styleMapValue` has an unknown type\",39:\"Unknown geometry type\",40:\"Expected `feature` to have a geometry\",41:\"Expected an `ol/style/Style` or an array of `ol/style/Style.js`\",42:\"Question unknown, the answer is 42\",43:\"Expected `layers` to be an array or a `Collection`\",47:\"Expected `controls` to be an array or an `ol/Collection`\",48:\"Expected `interactions` to be an array or an `ol/Collection`\",49:\"Expected `overlays` to be an array or an `ol/Collection`\",50:\"`options.featureTypes` should be an Array\",51:\"Either `url` or `tileJSON` options must be provided\",52:\"Unknown `serverType` configured\",53:\"Unknown `tierSizeCalculation` configured\",55:\"The {-y} placeholder requires a tile grid with extent\",56:\"mapBrowserEvent must originate from a pointer event\",57:\"At least 2 conditions are required\",59:\"Invalid command found in the PBF\",60:\"Missing or invalid `size`\",61:\"Cannot determine IIIF Image API version from provided image information JSON\",62:\"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`\",64:\"Layer opacity must be a number\",66:\"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`\",67:\"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both\",68:\"A VectorTile source can only be rendered if it has a projection compatible with the view projection\"};class i extends Error{constructor(e){const t=o[e];super(t),this.code=e,this.name=\"AssertionError\",this.message=t}}function s(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function a(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new i(t)}(0!==n,32);const o=t[0],s=t[1],a=t[2],u=t[3],x=t[4],f=t[5];return e[0]=u/n,e[1]=-s/n,e[2]=-a/n,e[3]=o/n,e[4]=(a*f-u*x)/n,e[5]=-(o*f-s*x)/n,e}new Array(6);var u={exports:{}};function x(e,t,n){n=n||2;var r,o,i,s,a,u,x,y=t&&t.length,d=y?t[0]*n:e.length,h=f(e,0,d,n,!0),v=[];if(!h||h.next===h.prev)return v;if(y&&(h=function(e,t,n,r){var o,i,s,a=[];for(o=0,i=t.length;o<i;o++)(s=f(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===s.next&&(s.steiner=!0),a.push(w(s));for(a.sort(p),o=0;o<a.length;o++)n=l(n=g(a[o],n),n.next);return n}(e,t,h,n)),e.length>80*n){r=i=e[0],o=s=e[1];for(var b=n;b<d;b+=n)(a=e[b])<r&&(r=a),(u=e[b+1])<o&&(o=u),a>i&&(i=a),u>s&&(s=u);x=0!==(x=Math.max(i-r,s-o))?1/x:0}return c(h,v,n,r,o,x),v}function f(e,t,n,r,o){var i,s;if(o===B(e,t,n,r)>0)for(i=t;i<n;i+=r)s=U(i,e[i],e[i+1],s);else for(i=n-r;i>=t;i-=r)s=U(i,e[i],e[i+1],s);return s&&M(s,s.next)&&(z(s),s=s.next),s}function l(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(z(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function c(e,t,n,r,o,i,s){if(e){!s&&i&&function(e,t,n,r){var o=e;do{null===o.z&&(o.z=m(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,s,a,u,x=1;do{for(n=e,e=null,i=null,s=0;n;){for(s++,r=n,a=0,t=0;t<x&&(a++,r=r.nextZ);t++);for(u=x;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,a--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,x*=2}while(s>1)}(o)}(e,r,o,i);for(var a,u,x=e;e.prev!==e.next;)if(a=e.prev,u=e.next,i?d(e,r,o,i):y(e))t.push(a.i/n),t.push(e.i/n),t.push(u.i/n),z(e),e=u.next,x=u.next;else if((e=u)===x){s?1===s?c(e=h(l(e),t,n),t,n,r,o,i,2):2===s&&v(e,t,n,r,o,i):c(l(e),t,n,r,o,i,1);break}}}function y(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=e.next.next;o!==e.prev;){if(A(t.x,t.y,n.x,n.y,r.x,r.y,o.x,o.y)&&Z(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}function d(e,t,n,r){var o=e.prev,i=e,s=e.next;if(Z(o,i,s)>=0)return!1;for(var a=o.x<i.x?o.x<s.x?o.x:s.x:i.x<s.x?i.x:s.x,u=o.y<i.y?o.y<s.y?o.y:s.y:i.y<s.y?i.y:s.y,x=o.x>i.x?o.x>s.x?o.x:s.x:i.x>s.x?i.x:s.x,f=o.y>i.y?o.y>s.y?o.y:s.y:i.y>s.y?i.y:s.y,l=m(a,u,t,n,r),c=m(x,f,t,n,r),y=e.prevZ,d=e.nextZ;y&&y.z>=l&&d&&d.z<=c;){if(y!==e.prev&&y!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,y.x,y.y)&&Z(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,d!==e.prev&&d!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,d.x,d.y)&&Z(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;y&&y.z>=l;){if(y!==e.prev&&y!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,y.x,y.y)&&Z(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;d&&d.z<=c;){if(d!==e.prev&&d!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,d.x,d.y)&&Z(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function h(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!M(o,i)&&F(o,r,r.next,i)&&k(o,i)&&k(i,o)&&(t.push(o.i/n),t.push(r.i/n),t.push(i.i/n),z(r),z(r.next),r=e=i),r=r.next}while(r!==e);return l(r)}function v(e,t,n,r,o,i){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&E(s,a)){var u=S(s,a);return s=l(s,s.next),u=l(u,u.next),c(s,t,n,r,o,i),void c(u,t,n,r,o,i)}a=a.next}s=s.next}while(s!==e)}function p(e,t){return e.x-t.x}function g(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,s=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var a=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=o&&a>s){if(s=a,a===o){if(i===r.y)return r;if(i===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(o===s)return n;var u,x=n,f=n.x,l=n.y,c=1/0;r=n;do{o>=r.x&&r.x>=f&&o!==r.x&&A(i<l?o:s,i,f,l,i<l?s:o,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(o-r.x),k(r,e)&&(u<c||u===c&&(r.x>n.x||r.x===n.x&&b(n,r)))&&(n=r,c=u)),r=r.next}while(r!==x);return n}(e,t);if(!n)return t;var r=S(n,e),o=l(n,n.next);return l(r,r.next),t===n?o:t}function b(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function m(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*o)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*o)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function w(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function A(e,t,n,r,o,i,s,a){return(o-s)*(t-a)-(e-s)*(i-a)>=0&&(e-s)*(r-a)-(n-s)*(t-a)>=0&&(n-s)*(i-a)-(o-s)*(r-a)>=0}function E(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&&F(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(k(e,t)&&k(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||M(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function M(e,t){return e.x===t.x&&e.y===t.y}function F(e,t,n,r){var o=I(Z(e,t,n)),i=I(Z(e,t,r)),s=I(Z(n,r,e)),a=I(Z(n,r,t));return o!==i&&s!==a||(!(0!==o||!T(e,n,t))||(!(0!==i||!T(e,r,t))||(!(0!==s||!T(n,e,r))||!(0!==a||!T(n,t,r)))))}function T(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function k(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function S(e,t){var n=new R(e.i,e.x,e.y),r=new R(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function U(e,t,n,r){var o=new R(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function B(e,t,n,r){for(var o=0,i=t,s=n-r;i<n;i+=r)o+=(e[s]-e[i])*(e[i+1]+e[s+1]),s=i;return o}u.exports=x,u.exports.default=x,x.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,s=Math.abs(B(e,0,i,n));if(o)for(var a=0,u=t.length;a<u;a++){var x=t[a]*n,f=a<u-1?t[a+1]*n:e.length;s-=Math.abs(B(e,x,f,n))}var l=0;for(a=0;a<r.length;a+=3){var c=r[a]*n,y=r[a+1]*n,d=r[a+2]*n;l+=Math.abs((e[c]-e[d])*(e[y+1]-e[c+1])-(e[c]-e[y])*(e[d+1]-e[c+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},x.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,o=0;o<e.length;o++){for(var i=0;i<e[o].length;i++)for(var s=0;s<t;s++)n.vertices.push(e[o][i][s]);o>0&&(r+=e[o-1].length,n.holes.push(r))}return n};const P=[],C={vertexPosition:0,indexPosition:0};function N(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function _(e,t,n,r,o,i){const s=3+o,a=e[t+0],u=e[t+1],x=P;x.length=o;for(let n=0;n<x.length;n++)x[n]=e[t+2+n];let f=i?i.vertexPosition:0,l=i?i.indexPosition:0;const c=f/s;return N(n,f,a,u,0),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,1),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,2),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,3),x.length&&n.set(x,f+3),f+=s,r[l++]=c,r[l++]=c+1,r[l++]=c+3,r[l++]=c+1,r[l++]=c+2,r[l++]=c+3,C.vertexPosition=f,C.indexPosition=l,C}function L(e,t,n,r,o,i,a,u,x,f){const l=5+u.length,c=i.length/l,y=[e[t+0],e[t+1]],d=[e[n],e[n+1]],h=s(f,[...y]),v=s(f,[...d]);function p(e,t,n){const r=1e4;return Math.round(1500*t)+Math.round(1500*n)*r+e*r*r}function g(e,t,n){const r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=[(t[0]-e[0])/r,(t[1]-e[1])/r],i=[-o[1],o[0]],s=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),a=[(n[0]-e[0])/s,(n[1]-e[1])/s],u=0===r||0===s?0:Math.acos((x=a[0]*o[0]+a[1]*o[1],f=-1,l=1,Math.min(Math.max(x,f),l)));var x,f,l;return a[0]*i[0]+a[1]*i[1]>0?u:2*Math.PI-u}const b=null!==o;let m=0,w=0;if(null!==r){m=g(h,v,s(f,[...[e[r],e[r+1]]]))}if(b){w=g(v,h,s(f,[...[e[o],e[o+1]]]))}i.push(y[0],y[1],d[0],d[1],p(0,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(1,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(2,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(3,m,w)),i.push(...u),a.push(c,c+1,c+2,c+1,c+3,c+2)}function G(e,t,n,r,o){const i=2+o;let s=t;const a=e.slice(s,s+o);s+=o;const x=e[s++];let f=0;const l=new Array(x-1);for(let t=0;t<x;t++)f+=e[s++],t<x-1&&(l[t]=f);const c=e.slice(s,s+2*f),y=u.exports(c,l,2);for(let e=0;e<y.length;e++)r.push(y[e]+n.length/i);for(let e=0;e<c.length;e+=2)n.push(c[e],c[e+1],...a);return s+2*f}const O=self;O.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesCount,r=t+n,i=new Float32Array(o.renderInstructions),s=i.length/r,a=4*s*(n+e),u=new Uint32Array(6*s),x=new Float32Array(a);let f;for(let e=0;e<i.length;e+=r)f=_(i,e,x,u,n,f);const l=Object.assign({vertexBuffer:x.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);O.postMessage(l,[x.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesCount,r=2,i=new Float32Array(o.renderInstructions);let s=0;const u=o.renderInstructionsTransform,x=[1,0,0,1,0,0];let f,l;for(a(x,u);s<i.length;){l=Array.from(i.slice(s,s+n)),s+=n,f=i[s++];for(let n=0;n<f-1;n++)L(i,s+n*r,s+(n+1)*r,n>0?s+(n-1)*r:null,n<f-2?s+(n+2)*r:null,e,t,l,0,x);s+=f*r}const c=Uint32Array.from(t),y=Float32Array.from(e),d=Object.assign({vertexBuffer:y.buffer,indexBuffer:c.buffer,renderInstructions:i.buffer},o);O.postMessage(d,[y.buffer,c.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesCount,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=G(r,i,e,t,n);const s=Uint32Array.from(t),a=Float32Array.from(e),u=Object.assign({vertexBuffer:a.buffer,indexBuffer:s.buffer,renderInstructions:r.buffer},o);O.postMessage(u,[a.buffer,s.buffer,r.buffer]);break}}};";
return new Worker(typeof Blob === 'undefined'
? 'data:application/javascript;base64,' + Buffer.from(source, 'binary').toString('base64')
: URL.createObjectURL(new Blob([source], {type: 'application/javascript'})));
}