UNPKG

geostyler-openlayers-parser

Version:

GeoStyler Style Parser implementation for OpenLayers styles

1 lines 87.9 kB
var GeoStylerOpenlayersParser=function(b){"use strict";var pn=Object.defineProperty;var Sn=(b,I,R)=>I in b?pn(b,I,{enumerable:!0,configurable:!0,writable:!0,value:R}):b[I]=R;var k=(b,I,R)=>Sn(b,typeof I!="symbol"?I+"":I,R);function I(s){return!/^(-?\d|--)/.test(s)}function R(s){const t=[];let e="",i="",n=7;for(let r,o=0;r=s.charAt(o);o++)if(/[a-zA-Z\d\xa0-\uffff_-]/.test(r)&&n===7)e+=r;else if(r==="\\"&&n===7)n=6;else if(r===" "&&n===7){if(e!==""){if(!I(e))return null;t.push(e),e=""}}else if(n===6)/[0-9a-f]/i.test(r)?(i+=r,n=8):(e+=r,n=7);else{if(n!==8)return null;/[0-9a-f]/i.test(r)&&i.length<6?i+=r:(e+=String.fromCodePoint(parseInt(i,16)),e+=r,i="",n=7)}if(e!==""){if(!I(e))return null;t.push(e)}return t.join(" ")}function Ne(s,t){let e=t,i="";const n={"font-family":[]};for(let r,o=0;r=s.charAt(o);o+=1)if(e!==4||r!=='"'&&r!=="'")if(e===3&&r===",")e=4,i="";else if(e===4&&r===","){const a=R(i);a&&n["font-family"].push(a),i=""}else if(e===5&&r===" ")/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:deg|grad|rad|turn)$/.test(i)?(n["font-style"]+=" "+i,i=""):o-=1,e=1;else if(e!==1||r!==" "&&r!=="/")e===2&&r===" "?(/^(?:\+|-)?([0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(i)&&(n["line-height"]=i),e=4,i=""):i+=r;else{if(/^(?:(?:xx|x)-large|(?:xx|s)-small|small|large|medium)$/.test(i)||/^(?:larg|small)er$/.test(i)||/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(i))e=r==="/"?2:4,n["font-size"]=i;else if(/^italic$/.test(i))n["font-style"]=i;else if(/^oblique$/.test(i))n["font-style"]=i,e=5;else if(/^small-caps$/.test(i))n["font-variant"]=i;else if(/^(?:bold(?:er)?|lighter|normal)$/.test(i))n["font-weight"]=i;else if(/^[+-]?(?:[0-9]*\.)?[0-9]+(?:e[+-]?(?:0|[1-9][0-9]*))?$/.test(i)){const a=parseFloat(i);a>=1&&a<=1e3&&(n["font-weight"]=i)}else/^(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)$/.test(i)&&(n["font-stretch"]=i);i=""}else{let a=o+1;do if(a=s.indexOf(r,a)+1,!a)return null;while(s.charAt(a-2)==="\\");n["font-family"].push(s.slice(o+1,a-1).replace(/\\('|")/g,"$1")),o=a-1,e=3,i=""}if(e===3&&!/^\s*$/.test(i))return null;if(e===4){const r=R(i);r&&n["font-family"].push(r)}return n}function Ge(s){const t=Ne(s,1);return t!==null&&t["font-size"]&&t["font-family"].length?t:null}function Xe(s){return s!=null&&typeof s.valueOf()=="string"}const Ye=s=>(s==null?void 0:s.kind)==="Icon",qe=s=>(s==null?void 0:s.kind)==="Mark"&&Xe(s==null?void 0:s.wellKnownName),dt=s=>["abs","acos","add","asin","atan","atan2","ceil","cos","div","exp","floor","interpolate","log","max","min","modulo","mul","pi","pow","random","rint","round","sin","sqrt","strIndexOf","strLastIndexOf","strLength","sub","tan","toDegrees","toNumber","toRadians"].includes(s==null?void 0:s.name),q=s=>["numberFormat","strAbbreviate","strCapitalize","strConcat","strDefaultIfBlank","strReplace","strStripAccents","strSubstring","strSubstringStart","strToLowerCase","strToString","strToUpperCase","strTrim"].includes(s==null?void 0:s.name),Z=s=>["all","any","between","double2bool","equalTo","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","not","notEqualTo","parseBoolean","strEndsWith","strEqualsIgnoreCase","strMatches","strStartsWith"].includes(s==null?void 0:s.name),jt=s=>["case","property","step"].includes(s==null?void 0:s.name),v=s=>Z(s)||dt(s)||q(s)||jt(s),mt=s=>typeof(s==null?void 0:s.source)=="string"||v(s==null?void 0:s.source)&&Array.isArray(s.position)&&Array.isArray(s.size);var y={IDLE:0,LOADING:1,LOADED:2,ERROR:3};function $e(s,t,e){return s[0]<=t&&t<=s[2]&&s[1]<=e&&e<=s[3]}function Be(){return[1/0,1/0,-1/0,-1/0]}function Ht(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function Vt(s){return Ht(1/0,1/0,-1/0,-1/0,s)}function je(s,t){const e=s[0],i=s[1];return Ht(e,i,e,i,t)}function He(s,t,e,i,n){const r=Vt(n);return Ve(r,s,t,e,i)}function Ve(s,t,e,i,n){for(;e<i;e+=n)Ue(s,t[e],t[e+1]);return s}function Ue(s,t,e){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}function Je(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function Ut(s){return s[3]-s[1]}function $(s,t){return s[0]<=t[2]&&s[2]>=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function Ke(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s}function Q(s,t,e){return Math.min(Math.max(s,t),e)}function Ze(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function Jt(s){return s*180/Math.PI}function tt(s){return s*Math.PI/180}function Kt(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function _t(s,t,e){if(s>=t&&s<e)return s;const i=e-t;return((s-t)%i+i)%i+t}function w(){throw new Error("Unimplemented abstract method.")}let Qe=0;function yt(s){return s.ol_uid||(s.ol_uid=String(++Qe))}var ti={PROPERTYCHANGE:"propertychange"},W={CHANGE:"change"};class ei{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Zt(s,t){const e=s.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(s[i]!==t[i])return!1;return!0}function Qt(){}function ii(s){let t,e,i;return function(){const n=Array.prototype.slice.call(arguments);return(!e||this!==i||!Zt(n,e))&&(i=this,e=n,t=s.apply(this,arguments)),t}}function te(s){for(const t in s)delete s[t]}function ni(s){let t;for(t in s)return!1;return!t}class ee{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class ie extends ei{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new ee(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let c=0,h=n.length;c<h;++c)if("handleEvent"in n[c]?l=n[c].handleEvent(r):l=n[c].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let c=a[i];for(delete a[i];c--;)this.removeEventListener(i,Qt);delete o[i]}return l}disposeInternal(){this.listeners_&&te(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);n!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=Qt,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}function pt(s,t,e,i,n){if(n){const o=e;e=function(a){return s.removeEventListener(t,e),o.call(this,a)}}const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function ne(s,t,e,i){return pt(s,t,e,i,!0)}function se(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),te(s))}class si extends ie{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(W.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=pt(this,t[r],e);return n}return pt(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=ne(this,t[r],e)}else i=ne(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)ri(i);else if(Array.isArray(t))for(let n=0,r=t.length;n<r;++n)this.removeEventListener(t[n],e);else this.removeEventListener(t,e)}}function ri(s){if(Array.isArray(s))for(let t=0,e=s.length;t<e;++t)se(s[t]);else se(s)}class re extends ee{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class oe extends si{constructor(t){super(),this.on,this.once,this.un,yt(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new re(i,t,e)),i=ti.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new re(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const r=n[t];n[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],ni(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const ae={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class St{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ae[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const B=6378137,z=Math.PI*B,oi=[-z,-z,z,z],ai=[-180,-85,180,85],et=B*Math.log(Math.tan(Math.PI/2));class N extends St{constructor(t){super({code:t,units:"m",extent:oi,global:!0,worldExtent:ai,getPointResolution:function(e,i){return e/Math.cosh(i[1]/B)}})}}const le=[new N("EPSG:3857"),new N("EPSG:102100"),new N("EPSG:102113"),new N("EPSG:900913"),new N("http://www.opengis.net/def/crs/EPSG/0/3857"),new N("http://www.opengis.net/gml/srs/epsg.xml#3857")];function li(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i){t[r]=z*s[r]/180;let o=B*Math.log(Math.tan(Math.PI*(+s[r+1]+90)/360));o>et?o=et:o<-et&&(o=-et),t[r+1]=o}return t}function ci(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i)t[r]=180*s[r]/z,t[r+1]=360*Math.atan(Math.exp(s[r+1]/B))/Math.PI-90;return t}const hi=6378137,ce=[-180,-90,180,90],ui=Math.PI*hi/180;class L extends St{constructor(t,e){super({code:t,units:"degrees",extent:ce,axisOrientation:e,global:!0,metersPerUnit:ui,worldExtent:ce})}}const he=[new L("CRS:84"),new L("EPSG:4326","neu"),new L("urn:ogc:def:crs:OGC:1.3:CRS84"),new L("urn:ogc:def:crs:OGC:2:84"),new L("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new L("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new L("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ct={};function fi(s){return Ct[s]||Ct[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function gi(s,t){Ct[s]=t}let G={};function j(s,t,e){const i=s.getCode(),n=t.getCode();i in G||(G[i]={}),G[i][n]=e}function xt(s,t){return s in G&&t in G[s]?G[s][t]:null}const it=.9996,F=.00669438,nt=F*F,st=nt*F,M=F/(1-F),ue=Math.sqrt(1-F),X=(1-ue)/(1+ue),fe=X*X,wt=fe*X,Ot=wt*X,ge=Ot*X,de=1-F/4-3*nt/64-5*st/256,di=3*F/8+3*nt/32+45*st/1024,mi=15*nt/256+45*st/1024,_i=35*st/3072,yi=3/2*X-27/32*wt+269/512*ge,pi=21/16*fe-55/32*Ot,Si=151/96*wt-417/128*ge,Ci=1097/512*Ot,rt=6378137;function xi(s,t,e){const i=s-5e5,o=(e.north?t:t-1e7)/it/(rt*de),a=o+yi*Math.sin(2*o)+pi*Math.sin(4*o)+Si*Math.sin(6*o)+Ci*Math.sin(8*o),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,f=u*u,d=f*f,g=1-F*c,_=Math.sqrt(1-F*c),C=rt/_,p=(1-F)/g,S=M*h**2,x=S*S,O=i/(C*it),E=O*O,P=E*O,We=P*O,ze=We*O,_n=ze*O,yn=a-u/p*(E/2-We/24*(5+3*f+10*S-4*x-9*M))+_n/720*(61+90*f+298*S+45*d-252*M-3*x);let Bt=(O-P/6*(1+2*f+S)+ze/120*(5-2*S+28*f-3*x+8*M+24*d))/h;return Bt=_t(Bt+tt(ye(e.number)),-Math.PI,Math.PI),[Jt(Bt),Jt(yn)]}const me=-80,_e=84,wi=-180,Oi=180;function vi(s,t,e){s=_t(s,wi,Oi),t<me?t=me:t>_e&&(t=_e);const i=tt(t),n=Math.sin(i),r=Math.cos(i),o=n/r,a=o*o,l=a*a,c=tt(s),h=ye(e.number),u=tt(h),f=rt/Math.sqrt(1-F*n**2),d=M*r**2,g=r*_t(c-u,-Math.PI,Math.PI),_=g*g,C=_*g,p=C*g,S=p*g,x=S*g,O=rt*(de*i-di*Math.sin(2*i)+mi*Math.sin(4*i)-_i*Math.sin(6*i)),E=it*f*(g+C/6*(1-a+d)+S/120*(5-18*a+l+72*d-58*M))+5e5;let P=it*(O+f*o*(_/2+p/24*(5-a+9*d+4*d**2)+x/720*(61-58*a+l+600*d-330*M)));return e.north||(P+=1e7),[E,P]}function ye(s){return(s-1)*6-180+3}const ki=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function pe(s){let t=0;for(const n of ki){const r=s.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function Se(s,t){return function(e,i,n,r){const o=e.length;n=n>1?n:2,r=r??n,i||(n>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],c=e[a+1],h=s(l,c,t);i[a]=h[0],i[a+1]=h[1]}return i}}function Fi(s){return pe(s)?new St({code:s,units:"m"}):null}function bi(s){const t=pe(s.getCode());return t?{forward:Se(vi,t),inverse:Se(xi,t)}:null}const Ii=[bi],Ti=[Fi];function Ce(s,t){if(t!==void 0){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];t=t}else t=s.slice();return t}function vt(s){gi(s.getCode(),s),j(s,s,Ce)}function Ei(s){s.forEach(vt)}function kt(s){if(typeof s!="string")return s;const t=fi(s);if(t)return t;for(const e of Ti){const i=e(s);if(i)return i}return null}function xe(s){Ei(s),s.forEach(function(t){s.forEach(function(e){t!==e&&j(t,e,Ce)})})}function Pi(s,t,e,i){s.forEach(function(n){t.forEach(function(r){j(n,r,e),j(r,n,i)})})}function Ai(s,t){const e=s.getCode(),i=t.getCode();let n=xt(e,i);if(n)return n;let r=null,o=null;for(const l of Ii)r||(r=l(s)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=Ft(r.inverse,o.forward);else{const l=xt(e,a);l&&(n=Ft(l,o.forward))}else{const l=xt(a,i);l&&(n=Ft(r.inverse,l))}return n&&(vt(s),vt(t),j(s,t,n)),n}function Ft(s,t){return function(e,i,n,r){return i=s(e,i,n,r),t(i,i,n,r)}}function we(s,t){const e=kt(s),i=kt(t);return Ai(e,i)}function Ri(){xe(le),xe(he),Pi(he,le,li,ci)}Ri();function bt(s,t){if(!s)throw new Error(t)}const Li=new Array(6);function It(){return[1,0,0,1,0,0]}function Mi(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=s[4],a=s[5],l=t[0],c=t[1],h=t[2],u=t[3],f=t[4],d=t[5];return s[0]=e*l+n*c,s[1]=i*l+r*c,s[2]=e*h+n*u,s[3]=i*h+r*u,s[4]=e*f+n*d+o,s[5]=i*f+r*d+a,s}function Di(s,t,e,i,n,r,o){return s[0]=t,s[1]=e,s[2]=i,s[3]=n,s[4]=r,s[5]=o,s}function Wi(s,t,e){return Mi(s,Di(Li,t,0,0,e,0,0))}function Oe(s,t,e,i,n,r,o,a){const l=Math.sin(r),c=Math.cos(r);return s[0]=i*c,s[1]=n*l,s[2]=-i*l,s[3]=n*c,s[4]=o*i*c-a*i*l+t,s[5]=o*n*l+a*n*c+e,s}function H(s,t,e,i,n,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const c=s[l],h=s[l+1];r[a++]=n[0]*c+n[2]*h+n[4],r[a++]=n[1]*c+n[3]*h+n[5];for(let u=2;u<o;u++)r[a++]=s[l+u]}return r&&r.length!=a&&(r.length=a),r}function zi(s,t,e,i,n,r,o){o=o||[];const a=Math.cos(n),l=Math.sin(n),c=r[0],h=r[1];let u=0;for(let f=t;f<e;f+=i){const d=s[f]-c,g=s[f+1]-h;o[u++]=c+d*a-g*l,o[u++]=h+d*l+g*a;for(let _=f+2;_<f+i;++_)o[u++]=s[_]}return o&&o.length!=u&&(o.length=u),o}function Ni(s,t,e,i,n,r,o,a){a=a||[];const l=o[0],c=o[1];let h=0;for(let u=t;u<e;u+=i){const f=s[u]-l,d=s[u+1]-c;a[h++]=l+n*f,a[h++]=c+r*d;for(let g=u+2;g<u+i;++g)a[h++]=s[g]}return a&&a.length!=h&&(a.length=h),a}function Gi(s,t,e,i,n,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=s[l]+n,o[a++]=s[l+1]+r;for(let c=l+2;c<l+i;++c)o[a++]=s[c]}return o&&o.length!=a&&(o.length=a),o}const ve=It(),Xi=[NaN,NaN];class Yi extends oe{constructor(){super(),this.extent_=Be(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=ii((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return w()}closestPointXY(t,e,i,n){return w()}containsXY(t,e){return this.closestPointXY(t,e,Xi,Number.MIN_VALUE)===0}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return w()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Vt(e),this.extentRevision_=this.getRevision()}return Ke(this.extent_,t)}rotate(t,e){w()}scale(t,e,i){w()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return w()}getType(){return w()}applyTransform(t){w()}intersectsExtent(t){return w()}translate(t,e){w()}transform(t,e){const i=kt(t),n=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),c=i.getWorldExtent(),h=Ut(c)/Ut(l);Oe(ve,c[0],c[3],h,-h,0,0,0);const u=H(r,0,r.length,a,ve,o),f=we(i,e);return f?f(u,u,a):u}:we(i,e);return this.applyTransform(n),this}}class qi extends Yi{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return He(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return w()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=ke(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){w()}setLayout(t,e,i){let n;if(t)n=ke(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}n=e.length,t=$i(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();zi(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Je(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();Ni(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Gi(i,0,i.length,n,t,e,i),this.changed()}}}function $i(s){let t;return s==2?t="XY":s==3?t="XYZ":s==4&&(t="XYZM"),t}function ke(s){let t;return s=="XY"?t=2:s=="XYZ"||s=="XYM"?t=3:s=="XYZM"&&(t=4),t}function Bi(s,t,e){const i=s.getFlatCoordinates();if(!i)return null;const n=s.getStride();return H(i,0,i.length,n,t,e)}function ji(s,t,e,i){for(let n=0,r=e.length;n<r;++n)s[t++]=e[n];return t}class Tt extends qi{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Tt(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=Ze(t,e,r[0],r[1]);if(o<n){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return je(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return $e(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ji(this.flatCoordinates,0,t,this.stride),this.changed()}}const D=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";D.includes("safari")&&!D.includes("chrom")&&(D.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(D)),D.includes("webkit")&&D.includes("edge"),D.includes("macintosh");const Hi=typeof devicePixelRatio<"u"?devicePixelRatio:1,Vi=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Ui=typeof Image<"u"&&Image.prototype.decode;(function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s})();function A(s,t,e,i){let n;return Vi?n=new OffscreenCanvas(s||300,t||300):n=document.createElement("canvas"),s&&(n.width=s),t&&(n.height=t),n.getContext("2d",i)}let Et;function Fe(){return Et||(Et=A(1,1)),Et}const Ji=[NaN,NaN,NaN,0];let Pt;function Ki(){return Pt||(Pt=A(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Pt}const Zi=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Qi=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,tn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,en=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function ot(s,t){return s.endsWith("%")?Number(s.substring(0,s.length-1))/t:Number(s)}function V(s){throw new Error('failed to parse "'+s+'" as color')}function be(s){if(s.toLowerCase().startsWith("rgb")){const r=s.match(Qi)||s.match(Zi)||s.match(tn);if(r){const o=r[4],a=100/255;return[Q(ot(r[1],a)+.5|0,0,255),Q(ot(r[2],a)+.5|0,0,255),Q(ot(r[3],a)+.5|0,0,255),o!==void 0?Q(ot(o,100),0,1):1]}V(s)}if(s.startsWith("#")){if(en.test(s)){const r=s.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=r.length;l<c;l+=o){let h=parseInt(r.substring(l,l+o),16);o===1&&(h+=h<<4),a[l/o]=h}return a[3]=a[3]/255,a}V(s)}const t=Ki();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=s,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=s,t.fillStyle===e&&V(s));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return be(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const n=Array.from(t.getImageData(0,0,1,1).data);return n[3]=Kt(n[3]/255,3),n}function nn(s){return typeof s=="string"?s:Ie(s)}const sn=1024,U={};let At=0;function rn(s){if(s==="none")return Ji;if(U.hasOwnProperty(s))return U[s];if(At>=sn){let e=0;for(const i in U)(e++&3)===0&&(delete U[i],--At)}const t=be(s);t.length!==4&&V(s);for(const e of t)isNaN(e)&&V(s);return U[s]=t,++At,t}function at(s){return Array.isArray(s)?s:rn(s)}function Ie(s){let t=s[0];t!=(t|0)&&(t=t+.5|0);let e=s[1];e!=(e|0)&&(e=e+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+n+")"}function on(s,t){return new Promise((e,i)=>{function n(){o(),e(s)}function r(){o(),i(new Error("Image load error"))}function o(){s.removeEventListener("load",n),s.removeEventListener("error",r)}s.addEventListener("load",n),s.addEventListener("error",r)})}function an(s,t){return t&&(s.src=t),s.src&&Ui?new Promise((e,i)=>s.decode().then(()=>e(s)).catch(n=>s.complete&&s.width?e(s):i(n))):on(s)}class ln{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=Rt(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=Rt(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,r){const o=Rt(t,e,i),a=o in this.cache_;this.cache_[o]=n,r&&(n.getImageState()===y.IDLE&&n.load(),n.getImageState()===y.LOADING?n.ready().then(()=>{this.patternCache_[o]=Fe().createPattern(n.getImage(1),"repeat")}):this.patternCache_[o]=Fe().createPattern(n.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Rt(s,t,e){const i=e?at(e):"null";return t+":"+s+":"+i}const T=new ln;let J=null;class Te extends ie{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=n===void 0?y.IDLE:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===y.LOADED){J||(J=A(1,1,void 0,{willReadFrequently:!0})),J.drawImage(this.image_,0,0);try{J.getImageData(0,0,1,1),this.tainted_=!1}catch{J=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(W.CHANGE)}handleImageError_(){this.imageState_=y.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=y.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=A(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===y.IDLE){this.image_||this.initializeImage_(),this.imageState_=y.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&an(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==y.LOADED)return;const e=this.image_,i=A(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=nn(this.color_),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===y.LOADED||this.imageState_===y.ERROR)t();else{const e=()=>{(this.imageState_===y.LOADED||this.imageState_===y.ERROR)&&(this.removeEventListener(W.CHANGE,e),t())};this.addEventListener(W.CHANGE,e)}})),this.ready_}}function Lt(s,t,e,i,n,r){let o=t===void 0?void 0:T.get(t,e,n);return o||(o=new Te(s,s&&"src"in s?s.src||void 0:t,e,i,n),T.set(t,e,n,o,r)),r&&o&&!T.getPattern(t,e,n)&&T.set(t,e,n,o,r),o}function Y(s){return s?Array.isArray(s)?Ie(s):typeof s=="object"&&"src"in s?cn(s):s:null}function cn(s){if(!s.offset||!s.size)return T.getPattern(s.src,"anonymous",s.color);const t=s.src+":"+s.offset,e=T.getPattern(t,void 0,s.color);if(e)return e;const i=T.get(s.src,"anonymous",null);if(i.getImageState()!==y.LOADED)return null;const n=A(s.size[0],s.size[1]);return n.drawImage(i.getImage(1),s.offset[0],s.offset[1],s.size[0],s.size[1],0,0,s.size[0],s.size[1]),Lt(n.canvas,t,void 0,y.LOADED,s.color,!0),T.getPattern(t,void 0,s.color)}const hn="10px sans-serif",lt="#000",ct="round",Ee=[],Pe=0,ht="round",Mt=10,Dt="#000",Ae="center",un="middle",Wt=1;new oe;function ut(s,t){return Array.isArray(s)?s:(t===void 0?t=[s,s]:(t[0]=s,t[1]=s),t)}class K{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ut(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new K({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return w()}getImage(t){return w()}getHitDetectionImage(){return w()}getPixelRatio(t){return 1}getImageState(){return w()}getImageSize(){return w()}getOrigin(){return w()}getSize(){return w()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=ut(t)}listenImageChange(t){w()}load(){w()}unlistenImageChange(t){w()}ready(){return Promise.resolve()}}class ft extends K{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?y.LOADING:y.LOADED,this.imageState_===y.LOADING&&this.ready().then(()=>this.imageState_=y.LOADED),this.render()}clone(){const t=this.getScale(),e=new ft({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){var r,o;const e=(r=this.fill_)==null?void 0:r.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=(o=T.get(i,null,null))==null?void 0:o.getImage(1);if(!n){const a=this.renderOptions_,l=Math.ceil(a.size*t),c=A(l,l);this.draw_(a,c,t),n=c.canvas,T.set(i,null,null,new Te(n,void 0,null,y.LOADED,null))}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let n=this.radius,r=this.radius2_===void 0?n:this.radius2_;if(n<r){const P=n;n=r,r=P}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),c=Math.sqrt(r*r-l*l),h=n-c,u=Math.sqrt(l*l+h*h),f=u/l;if(t==="miter"&&f<=i)return f*e;const d=e/2/f,g=e/2*(h/u),C=Math.sqrt((n+d)*(n+d)+g*g)-n;if(this.radius2_===void 0||t==="bevel")return C*2;const p=n*Math.sin(a),S=Math.sqrt(n*n-p*p),x=r-S,E=Math.sqrt(p*p+x*x)/p;if(E<=i){const P=E*e/2-r-n;return 2*Math.max(C,P)}return C*2}createRenderOptions(){let t=ct,e=ht,i=0,n=null,r=0,o,a=0;this.stroke_&&(o=Y(this.stroke_.getColor()??Dt),a=this.stroke_.getWidth()??Wt,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??ht,t=this.stroke_.getLineCap()??ct,i=this.stroke_.getMiterLimit()??Mt);const l=this.calculateLineJoinSize_(e,a,i),c=Math.max(this.radius,this.radius2_||0),h=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:h,lineCap:t,lineDash:n,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let n=this.fill_.getColor();n===null&&(n=lt),e.fillStyle=Y(n),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;typeof i=="string"&&(i=at(i)),i===null?n=1:Array.isArray(i)&&(n=i.length===4?i[3]:1),n===0&&(e=A(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,c=a%2===0?i:n;t.lineTo(c*Math.cos(l),c*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=lt,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class zt extends ft{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new zt({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}class gt{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new gt({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=Lt(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===y.IDLE&&e.load(),e.getImageState()===y.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?yt(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:at(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class Nt{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new Nt({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}class Gt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Re,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new Gt({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Re,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Re(s){return s.getGeometry()}const fn="#333";class Xt{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=ut(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new gt({color:fn}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Xt({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=ut(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}function Le(s,t,e,i){return e!==void 0&&i!==void 0?[e/s,i/t]:e!==void 0?e/s:i!==void 0?i/t:1}class Yt extends K{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,n=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:n,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;bt(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||yt(o)),bt(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),bt(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=y.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?y.LOADED:y.IDLE:l=y.LOADING:l=y.LOADED),this.color_=t.color!==void 0?at(t.color):null,this.iconImage_=Lt(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let c,h;if(t.size)[c,h]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)c=u.width,h=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const f=()=>{if(this.unlistenImageChange(f),!this.initialOptions_)return;const d=this.iconImage_.getSize();this.setScale(Le(d[0],d[1],t.width,t.height))};this.listenImageChange(f);return}}c!==void 0&&this.setScale(Le(c,h,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Yt({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=n[0]),this.anchorYUnits_=="fraction"&&(t[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+n[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==y.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==y.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(W.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(W.CHANGE,t)}ready(){return this.iconImage_.ready()}}const Me={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slate