rlayers
Version:
React Components for OpenLayers
1 lines • 60.5 kB
JavaScript
var rlayers=function(t,e,s,i,r,o,n,l,a,h,c,p,u,d,f,v,g,m,y,b,w,S,O,x,L,R,E,P,j,k,z,F,T,_,A,D,M,C){"use strict";const I=r.createContext({});const W="undefined"==typeof process||void 0===process.env.RLAYERS_DEBUG?()=>{}:console.debug.bind(window.console),U="_rlayers_handlers";class B extends r.PureComponent{static getOLObject(t,e){let s=e.get(t);return void 0===s&&(s={},e.set(t,s)),s}get handlers(){return B.getOLObject(U,this.ol)}getCurrentEvents(){return Object.keys(this.props).filter((t=>t.startsWith("on"))).map((t=>({event:t.toLowerCase().slice(2),prop:t}))).reduce(((t,e)=>Object.assign(Object.assign({},t),{[e.event]:this.props[e.prop]})),{})}getHandlerProp(t){for(const e of Object.keys(this.props))if(e.toLowerCase()==="on"+t)return e}incrementHandlers(t){}decrementHandlers(t){}attachEventHandlers(){var t;const e=this.handlers,s=Object.keys(null!=e?e:{}),i=null!==(t=this.eventSources)&&void 0!==t?t:[this.ol],r=this.getCurrentEvents(),o=Object.keys(r),n=o.concat(s.filter((t=>!o.includes(t))));for(const t of n){if(void 0!==e[t]&&void 0===r[t]){W("removing previously installed handler",this,t,e[t]);for(const s of i)s.un(t,e[t]);e[t]=void 0,this.decrementHandlers(t)}if(void 0===e[t]&&void 0!==r[t]){W("installing handler",this,t,r[t]);const s=this.getHandlerProp(t);if(!s)throw new Error("Internal error");e[t]=t=>(W("handling event",t,this,this.props[s]),this.props[s].call(this,t));for(const s of i)s.on(t,e[t]);this.incrementHandlers(t)}}}attachOldEventHandlers(t){const e=this.handlers,s=this.getCurrentEvents();for(const i of Object.keys(s))s[i]&&(W("reinstalling existing handler",this,i,s[i]),t.on(i,e[i]))}refresh(t){this.attachEventHandlers()}on(t,e){this.ol.on(t,e),this.incrementHandlers(t)}un(t,e){this.decrementHandlers(t),this.ol.un(t,e)}componentDidMount(){W("didMount",this),this.refresh()}propsDiff(t){if(null===this.props||null===t)return this.props!==t&&(W("null props differ",this.props,t),!0);for(const e of Object.keys(this.props))if(this.props[e]!==t[e])return W("because of",e,this.props[e],t[e]),!0;return!1}componentDidUpdate(t,e,s){this.props!==t&&(W("willRefresh",this,t,this.props),this.refresh(t))}componentWillUnmount(){var t;const e=this.handlers;W("willUnmount",this,e);const s=null!==(t=this.eventSources)&&void 0!==t?t:[this.ol];for(const t of Object.keys(null!=e?e:{}))if(W("cleaning up handler",this,t,e[t]),e[t]){for(const i of s)i.un(t,e[t]);e[t]=void 0,this.decrementHandlers(t)}}render(){return null}}B.contextType=I;class G extends B{constructor(t){super(t)}refresh(t){var e;super.refresh(t);for(const s of["visible","opacity","zIndex","minResolution","maxResolution","minZoom","maxZoom"]){const i=s.charAt(0).toUpperCase()+s.substring(1);(null===(e=this.props)||void 0===e?void 0:e[s])!==(null==t?void 0:t[s])&&(W("Setting",this,i,this.props[s]),this.ol["set"+i](this.props[s]))}this.source&&this.props.attributions!==(null==t?void 0:t.attributions)&&(W("Setting attributions",this),this.source.setAttributions(this.props.attributions)),this.props.properties&&this.ol.setProperties(this.props.properties)}componentDidMount(){super.componentDidMount(),this.context.map.addLayer(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.context.map.removeLayer(this.ol)}render(){var t,e;if(!(null===(e=null===(t=this.context)||void 0===t?void 0:t.map)||void 0===e?void 0:e.addLayer))throw new Error("A layer must be part of a map");return r.createElement("div",{className:"_rlayers_RLayer"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{layer:this.ol,source:this.source,rLayer:this})},this.props.children))}}class V extends G{}const N="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,H=new Set,Z="object"==typeof process&&process?process:{},X=(t,e,s,i)=>{"function"==typeof Z.emitWarning?Z.emitWarning(t,e,s,i):console.error(`[${s}] ${e}: ${t}`)};let Y=globalThis.AbortController,q=globalThis.AbortSignal;if(void 0===Y){q=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},Y=class{constructor(){e()}signal=new q;abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=!0;for(const e of this.signal._onabort)e(t);this.signal.onabort?.(t)}}};let t="1"!==Z.env?.LRU_CACHE_IGNORE_AC_WARNING;const e=()=>{t&&(t=!1,X("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const K=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),$=t=>K(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?J:null:null;class J extends Array{constructor(t){super(t),this.fill(0)}}class Q{heap;length;static#t=!1;static create(t){const e=$(t);if(!e)return[];Q.#t=!0;const s=new Q(t,e);return Q.#t=!1,s}constructor(t,e){if(!Q.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class tt{#e;#s;#i;#r;#o;#n;#l;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#h;#c;#p;#u;#d;#f;#v;#g;#m;#y;#b;#w;#S;#O;#x;#L;#R;static unsafeExposeInternals(t){return{starts:t.#w,ttls:t.#S,sizes:t.#b,keyMap:t.#c,keyList:t.#p,valList:t.#u,next:t.#d,prev:t.#f,get head(){return t.#v},get tail(){return t.#g},free:t.#m,isBackgroundFetch:e=>t.#E(e),backgroundFetch:(e,s,i,r)=>t.#P(e,s,i,r),moveToTail:e=>t.#j(e),indexes:e=>t.#k(e),rindexes:e=>t.#z(e),isStale:e=>t.#F(e)}}get max(){return this.#e}get maxSize(){return this.#s}get calculatedSize(){return this.#h}get size(){return this.#a}get fetchMethod(){return this.#n}get memoMethod(){return this.#l}get dispose(){return this.#i}get onInsert(){return this.#r}get disposeAfter(){return this.#o}constructor(t){const{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:n,allowStale:l,dispose:a,onInsert:h,disposeAfter:c,noDisposeOnSet:p,noUpdateTTL:u,maxSize:d=0,maxEntrySize:f=0,sizeCalculation:v,fetchMethod:g,memoMethod:m,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:S,ignoreFetchAbort:O}=t;if(0!==e&&!K(e))throw new TypeError("max option must be a nonnegative integer");const x=e?$(e):Array;if(!x)throw new Error("invalid max value: "+e);if(this.#e=e,this.#s=d,this.maxEntrySize=f||this.#s,this.sizeCalculation=v,this.sizeCalculation){if(!this.#s&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==m&&"function"!=typeof m)throw new TypeError("memoMethod must be a function if defined");if(this.#l=m,void 0!==g&&"function"!=typeof g)throw new TypeError("fetchMethod must be a function if specified");if(this.#n=g,this.#x=!!g,this.#c=new Map,this.#p=new Array(e).fill(void 0),this.#u=new Array(e).fill(void 0),this.#d=new x(e),this.#f=new x(e),this.#v=0,this.#g=0,this.#m=Q.create(e),this.#a=0,this.#h=0,"function"==typeof a&&(this.#i=a),"function"==typeof h&&(this.#r=h),"function"==typeof c?(this.#o=c,this.#y=[]):(this.#o=void 0,this.#y=void 0),this.#O=!!this.#i,this.#R=!!this.#r,this.#L=!!this.#o,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!O,0!==this.maxEntrySize){if(0!==this.#s&&!K(this.#s))throw new TypeError("maxSize must be a positive integer if specified");if(!K(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!n,this.ttlResolution=K(i)||0===i?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!K(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#_()}if(0===this.#e&&0===this.ttl&&0===this.#s)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#s){const t="LRU_CACHE_UNBOUNDED";if((t=>!H.has(t))(t)){H.add(t);X("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,tt)}}}getRemainingTTL(t){return this.#c.has(t)?1/0:0}#_(){const t=new J(this.#e),e=new J(this.#e);this.#S=t,this.#w=e,this.#A=(s,i,r=N.now())=>{if(e[s]=0!==i?r:0,t[s]=i,0!==i&&this.ttlAutopurge){const t=setTimeout((()=>{this.#F(s)&&this.#D(this.#p[s],"expire")}),i+1);t.unref&&t.unref()}},this.#M=s=>{e[s]=0!==t[s]?N.now():0},this.#C=(r,o)=>{if(t[o]){const n=t[o],l=e[o];if(!n||!l)return;r.ttl=n,r.start=l,r.now=s||i();const a=r.now-l;r.remainingTTL=n-a}};let s=0;const i=()=>{const t=N.now();if(this.ttlResolution>0){s=t;const e=setTimeout((()=>s=0),this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=r=>{const o=this.#c.get(r);if(void 0===o)return 0;const n=t[o],l=e[o];if(!n||!l)return 1/0;return n-((s||i())-l)},this.#F=r=>{const o=e[r],n=t[r];return!!n&&!!o&&(s||i())-o>n}}#M=()=>{};#C=()=>{};#A=()=>{};#F=()=>!1;#T(){const t=new J(this.#e);this.#h=0,this.#b=t,this.#I=e=>{this.#h-=t[e],t[e]=0},this.#W=(t,e,s,i)=>{if(this.#E(e))return 0;if(!K(s)){if(!i)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof i)throw new TypeError("sizeCalculation must be a function");if(s=i(e,t),!K(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return s},this.#U=(e,s,i)=>{if(t[e]=s,this.#s){const s=this.#s-t[e];for(;this.#h>s;)this.#B(!0)}this.#h+=t[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#h)}}#I=t=>{};#U=(t,e,s)=>{};#W=(t,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:t=this.allowStale}={}){if(this.#a)for(let e=this.#g;this.#G(e)&&(!t&&this.#F(e)||(yield e),e!==this.#v);)e=this.#f[e]}*#z({allowStale:t=this.allowStale}={}){if(this.#a)for(let e=this.#v;this.#G(e)&&(!t&&this.#F(e)||(yield e),e!==this.#g);)e=this.#d[e]}#G(t){return void 0!==t&&this.#c.get(this.#p[t])===t}*entries(){for(const t of this.#k())void 0===this.#u[t]||void 0===this.#p[t]||this.#E(this.#u[t])||(yield[this.#p[t],this.#u[t]])}*rentries(){for(const t of this.#z())void 0===this.#u[t]||void 0===this.#p[t]||this.#E(this.#u[t])||(yield[this.#p[t],this.#u[t]])}*keys(){for(const t of this.#k()){const e=this.#p[t];void 0===e||this.#E(this.#u[t])||(yield e)}}*rkeys(){for(const t of this.#z()){const e=this.#p[t];void 0===e||this.#E(this.#u[t])||(yield e)}}*values(){for(const t of this.#k()){void 0===this.#u[t]||this.#E(this.#u[t])||(yield this.#u[t])}}*rvalues(){for(const t of this.#z()){void 0===this.#u[t]||this.#E(this.#u[t])||(yield this.#u[t])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const s of this.#k()){const i=this.#u[s],r=this.#E(i)?i.__staleWhileFetching:i;if(void 0!==r&&t(r,this.#p[s],this))return this.get(this.#p[s],e)}}forEach(t,e=this){for(const s of this.#k()){const i=this.#u[s],r=this.#E(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.#p[s],this)}}rforEach(t,e=this){for(const s of this.#z()){const i=this.#u[s],r=this.#E(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.#p[s],this)}}purgeStale(){let t=!1;for(const e of this.#z({allowStale:!0}))this.#F(e)&&(this.#D(this.#p[e],"expire"),t=!0);return t}info(t){const e=this.#c.get(t);if(void 0===e)return;const s=this.#u[e],i=this.#E(s)?s.__staleWhileFetching:s;if(void 0===i)return;const r={value:i};if(this.#S&&this.#w){const t=this.#S[e],s=this.#w[e];if(t&&s){const e=t-(N.now()-s);r.ttl=e,r.start=Date.now()}}return this.#b&&(r.size=this.#b[e]),r}dump(){const t=[];for(const e of this.#k({allowStale:!0})){const s=this.#p[e],i=this.#u[e],r=this.#E(i)?i.__staleWhileFetching:i;if(void 0===r||void 0===s)continue;const o={value:r};if(this.#S&&this.#w){o.ttl=this.#S[e];const t=N.now()-this.#w[e];o.start=Math.floor(Date.now()-t)}this.#b&&(o.size=this.#b[e]),t.unshift([s,o])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=N.now()-t}this.set(e,s.value,s)}}set(t,e,s={}){if(void 0===e)return this.delete(t),this;const{ttl:i=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:n=this.sizeCalculation,status:l}=s;let{noUpdateTTL:a=this.noUpdateTTL}=s;const h=this.#W(t,e,s.size||0,n);if(this.maxEntrySize&&h>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#D(t,"set"),this;let c=0===this.#a?void 0:this.#c.get(t);if(void 0===c)c=0===this.#a?this.#g:0!==this.#m.length?this.#m.pop():this.#a===this.#e?this.#B(!1):this.#a,this.#p[c]=t,this.#u[c]=e,this.#c.set(t,c),this.#d[this.#g]=c,this.#f[c]=this.#g,this.#g=c,this.#a++,this.#U(c,h,l),l&&(l.set="add"),a=!1,this.#R&&this.#r?.(e,t,"add");else{this.#j(c);const s=this.#u[c];if(e!==s){if(this.#x&&this.#E(s)){s.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=s;void 0===e||o||(this.#O&&this.#i?.(e,t,"set"),this.#L&&this.#y?.push([e,t,"set"]))}else o||(this.#O&&this.#i?.(s,t,"set"),this.#L&&this.#y?.push([s,t,"set"]));if(this.#I(c),this.#U(c,h,l),this.#u[c]=e,l){l.set="replace";const t=s&&this.#E(s)?s.__staleWhileFetching:s;void 0!==t&&(l.oldValue=t)}}else l&&(l.set="update");this.#R&&this.onInsert?.(e,t,e===s?"update":"replace")}if(0===i||this.#S||this.#_(),this.#S&&(a||this.#A(c,i,r),l&&this.#C(l,c)),!o&&this.#L&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#o?.(...e)}return this}pop(){try{for(;this.#a;){const t=this.#u[this.#v];if(this.#B(!0),this.#E(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#L&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#o?.(...e)}}}#B(t){const e=this.#v,s=this.#p[e],i=this.#u[e];return this.#x&&this.#E(i)?i.__abortController.abort(new Error("evicted")):(this.#O||this.#L)&&(this.#O&&this.#i?.(i,s,"evict"),this.#L&&this.#y?.push([i,s,"evict"])),this.#I(e),t&&(this.#p[e]=void 0,this.#u[e]=void 0,this.#m.push(e)),1===this.#a?(this.#v=this.#g=0,this.#m.length=0):this.#v=this.#d[e],this.#c.delete(s),this.#a--,e}has(t,e={}){const{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#c.get(t);if(void 0!==r){const t=this.#u[r];if(this.#E(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#F(r))return s&&this.#M(r),i&&(i.has="hit",this.#C(i,r)),!0;i&&(i.has="stale",this.#C(i,r))}else i&&(i.has="miss");return!1}peek(t,e={}){const{allowStale:s=this.allowStale}=e,i=this.#c.get(t);if(void 0===i||!s&&this.#F(i))return;const r=this.#u[i];return this.#E(r)?r.__staleWhileFetching:r}#P(t,e,s,i){const r=void 0===e?void 0:this.#u[e];if(this.#E(r))return r;const o=new Y,{signal:n}=s;n?.addEventListener("abort",(()=>o.abort(n.reason)),{signal:o.signal});const l={signal:o.signal,options:s,context:i},a=(i,r=!1)=>{const{aborted:n}=o.signal,a=s.ignoreFetchAbort&&void 0!==i;if(s.status&&(n&&!r?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,a&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),n&&!a&&!r)return h(o.signal.reason);const p=c;return this.#u[e]===c&&(void 0===i?p.__staleWhileFetching?this.#u[e]=p.__staleWhileFetching:this.#D(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,i,l.options))),i},h=i=>{const{aborted:r}=o.signal,n=r&&s.allowStaleOnFetchAbort,l=n||s.allowStaleOnFetchRejection,a=l||s.noDeleteOnFetchRejection,h=c;if(this.#u[e]===c){!a||void 0===h.__staleWhileFetching?this.#D(t,"fetch"):n||(this.#u[e]=h.__staleWhileFetching)}if(l)return s.status&&void 0!==h.__staleWhileFetching&&(s.status.returnedStale=!0),h.__staleWhileFetching;if(h.__returned===h)throw i};s.status&&(s.status.fetchDispatched=!0);const c=new Promise(((e,i)=>{const n=this.#n?.(t,r,l);n&&n instanceof Promise&&n.then((t=>e(void 0===t?void 0:t)),i),o.signal.addEventListener("abort",(()=>{s.ignoreFetchAbort&&!s.allowStaleOnFetchAbort||(e(void 0),s.allowStaleOnFetchAbort&&(e=t=>a(t,!0)))}))})).then(a,(t=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=t),h(t)))),p=Object.assign(c,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return void 0===e?(this.set(t,p,{...l.options,status:void 0}),e=this.#c.get(t)):this.#u[e]=p,p}#E(t){if(!this.#x)return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Y}async fetch(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:n=this.noDisposeOnSet,size:l=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:u=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:f,forceRefresh:v=!1,status:g,signal:m}=e;if(!this.#x)return g&&(g.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:g});const y={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:n,size:l,sizeCalculation:a,noUpdateTTL:h,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:d,ignoreFetchAbort:u,status:g,signal:m};let b=this.#c.get(t);if(void 0===b){g&&(g.fetch="miss");const e=this.#P(t,b,y,f);return e.__returned=e}{const e=this.#u[b];if(this.#E(e)){const t=s&&void 0!==e.__staleWhileFetching;return g&&(g.fetch="inflight",t&&(g.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}const r=this.#F(b);if(!v&&!r)return g&&(g.fetch="hit"),this.#j(b),i&&this.#M(b),g&&this.#C(g,b),e;const o=this.#P(t,b,y,f),n=void 0!==o.__staleWhileFetching&&s;return g&&(g.fetch=r?"stale":"refresh",n&&r&&(g.returnedStale=!0)),n?o.__staleWhileFetching:o.__returned=o}}async forceFetch(t,e={}){const s=await this.fetch(t,e);if(void 0===s)throw new Error("fetch() returned undefined");return s}memo(t,e={}){const s=this.#l;if(!s)throw new Error("no memoMethod provided to constructor");const{context:i,forceRefresh:r,...o}=e,n=this.get(t,o);if(!r&&void 0!==n)return n;const l=s(t,n,{options:o,context:i});return this.set(t,l,o),l}get(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=e,n=this.#c.get(t);if(void 0!==n){const e=this.#u[n],l=this.#E(e);return o&&this.#C(o,n),this.#F(n)?(o&&(o.get="stale"),l?(o&&s&&void 0!==e.__staleWhileFetching&&(o.returnedStale=!0),s?e.__staleWhileFetching:void 0):(r||this.#D(t,"expire"),o&&s&&(o.returnedStale=!0),s?e:void 0)):(o&&(o.get="hit"),l?e.__staleWhileFetching:(this.#j(n),i&&this.#M(n),e))}o&&(o.get="miss")}#V(t,e){this.#f[e]=t,this.#d[t]=e}#j(t){t!==this.#g&&(t===this.#v?this.#v=this.#d[t]:this.#V(this.#f[t],this.#d[t]),this.#V(this.#g,t),this.#g=t)}delete(t){return this.#D(t,"delete")}#D(t,e){let s=!1;if(0!==this.#a){const i=this.#c.get(t);if(void 0!==i)if(s=!0,1===this.#a)this.#N(e);else{this.#I(i);const s=this.#u[i];if(this.#E(s)?s.__abortController.abort(new Error("deleted")):(this.#O||this.#L)&&(this.#O&&this.#i?.(s,t,e),this.#L&&this.#y?.push([s,t,e])),this.#c.delete(t),this.#p[i]=void 0,this.#u[i]=void 0,i===this.#g)this.#g=this.#f[i];else if(i===this.#v)this.#v=this.#d[i];else{const t=this.#f[i];this.#d[t]=this.#d[i];const e=this.#d[i];this.#f[e]=this.#f[i]}this.#a--,this.#m.push(i)}}if(this.#L&&this.#y?.length){const t=this.#y;let e;for(;e=t?.shift();)this.#o?.(...e)}return s}clear(){return this.#N("delete")}#N(t){for(const e of this.#z({allowStale:!0})){const s=this.#u[e];if(this.#E(s))s.__abortController.abort(new Error("deleted"));else{const i=this.#p[e];this.#O&&this.#i?.(s,i,t),this.#L&&this.#y?.push([s,i,t])}}if(this.#c.clear(),this.#u.fill(void 0),this.#p.fill(void 0),this.#S&&this.#w&&(this.#S.fill(0),this.#w.fill(0)),this.#b&&this.#b.fill(0),this.#v=0,this.#g=0,this.#m.length=0,this.#h=0,this.#a=0,this.#L&&this.#y){const t=this.#y;let e;for(;e=t?.shift();)this.#o?.(...e)}}}class et extends r.PureComponent{constructor(t){super(t),this.style=(t,e)=>{if(this.ol!==this.style)return this.ol;let s;if(this.cache){s=this.props.cacheId(t,e);const i=this.cache.get(s);if(i)return i}const i=new c({zIndex:this.props.zIndex}),o=r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{style:i})},this.props.render(t,e)),n=h.createRoot(document.createElement("div"));return p.flushSync((()=>{n.render(o)})),this.cache&&this.cache.set(s,i),i},t.render?this.ol=this.style:this.ol=new c({zIndex:t.zIndex}),t.render&&t.cacheSize&&t.cacheId&&(this.cache=new tt({max:t.cacheSize}))}componentDidMount(){this.refresh()}componentDidUpdate(t,e,s){this.props!==t&&(W("willRefresh",this,t,this.props),this.refresh(t))}refresh(t){var e,s,i,r,o,n,l;if(!t||(null==t?void 0:t.render)!==this.props.render){if(null===(e=this.context)||void 0===e?void 0:e.styleArray){if(this.ol===this.style)throw new Error("An RStyleArray must contain only static RStyles");this.context.styleArray.includes(this.ol)||this.context.styleArray.push(this.ol)}else(null===(i=null===(s=this.context)||void 0===s?void 0:s.feature)||void 0===i?void 0:i.setStyle)?this.context.feature.setStyle(this.ol):(null===(o=null===(r=this.context)||void 0===r?void 0:r.vectorlayer)||void 0===o?void 0:o.setStyle)?this.context.vectorlayer.setStyle(this.ol):(null===(l=null===(n=this.context)||void 0===n?void 0:n.vectortilelayer)||void 0===l?void 0:l.setStyle)&&this.context.vectortilelayer.setStyle(this.ol);this.cache&&this.cache.clear()}this.ol instanceof c&&(!t||t.zIndex!==this.props.zIndex)&&this.ol.setZIndex(this.props.zIndex)}render(){return this.props.render?null:r.createElement("div",{className:"_rlayers_RStyle"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{style:this.ol})},this.props.children))}static getStyle(t){return null==t?t:"function"==typeof t.style?(e,s)=>t.style(e,s):Object.keys(t).includes("current")?(e,s)=>t.current.style(e,s):t}static getStyleStatic(t){if(null==t)return t;let e;if("function"==typeof t.style&&(e=t),!Object.keys(t).includes("current")||(e=t.current,null!=e)){if(e){if(void 0!==e.ol&&"function"!=typeof e.ol)return e.ol;throw new TypeError("RStyle is dynamic and cannot be converted to Style")}if("function"==typeof t)throw new TypeError("StyleLike is dynamic and cannot be converted to Style");return t}}}et.contextType=I;class st extends e.MapBrowserEvent{}class it extends B{constructor(t){var s;super(t),t.feature?this.ol=t.feature:this.ol=new e.Feature(Object.assign(Object.assign({},null!==(s=t.properties)&&void 0!==s?s:{}),{geometry:t.geometry,style:et.getStyle(t.style)})),this.onchange=()=>this.forceUpdate()}static initEventRelay(t){for(const e of it.pointerEvents)t.on(e,it.eventRelay)}incrementHandlers(t){var e;const s=B.getOLObject(rt,this.context.vectorlayer);s[t]=(null!==(e=s[t])&&void 0!==e?e:0)+1}decrementHandlers(t){B.getOLObject(rt,this.context.vectorlayer)[t]--}static dispatchEvent(t,e){var s;if(!t.feature)return!0;if(t.feature.dispatchEvent){if(!1===t.feature.dispatchEvent(e))return!1}e.target||(e.target=t.feature);const i=null===(s=t.layer)||void 0===s?void 0:s.get(U)[e.type];return!i||i.call(null,e)}static eventRelay(t){const e=[];if(t.map.forEachFeatureAtPixel(t.pixel,((t,s)=>e.push({feature:t,layer:s})&&!1),{hitTolerance:it.hitTolerance,layerFilter:e=>{var s,i,r,o,n;const l=B.getOLObject(rt,e);switch(t.type){case"click":return l.click>0;case"dblclick":return l.dblclick>0;case"singleclick":return l.singleclick>0;case"pointermove":return(null!==(s=l.pointermove)&&void 0!==s?s:0)+(null!==(i=l.pointerenter)&&void 0!==i?i:0)+(null!==(r=l.pointerleave)&&void 0!==r?r:0)>0;case"pointerdrag":return(null!==(o=l.pointerdrag)&&void 0!==o?o:0)+(null!==(n=l.pointerdragend)&&void 0!==n?n:0)>0}return Object.keys(l).reduce(((t,e)=>t+l[e]),0)>0}}),t.dragging){it.lastFeaturesDragged.length||(it.lastFeaturesDragged=[...e]);for(const t of it.lastFeaturesDragged)e.find((e=>e.feature===t.feature))||e.push(t)}else{for(const e of it.lastFeaturesDragged){if(!1===it.dispatchEvent(e,new st("pointerdragend",t.map,t.originalEvent)))return it.lastFeaturesDragged=[],!1}it.lastFeaturesDragged=[]}if("pointermove"===t.type){for(const s of it.lastFeaturesEntered)if(!e.find((t=>t.feature===s.feature))){const e=it.dispatchEvent(s,new st("pointerleave",t.map,t.originalEvent));if(s.feature=null,s.layer=null,!1===e)return it.lastFeaturesEntered=it.lastFeaturesEntered.filter((t=>t.feature)),!1}it.lastFeaturesEntered=it.lastFeaturesEntered.filter((t=>t.feature));for(const s of e)if(!it.lastFeaturesEntered.find((t=>t.feature===s.feature))){const e=it.dispatchEvent(s,new st("pointerenter",t.map,t.originalEvent));if(it.lastFeaturesEntered.push(s),!1===e)return!1}}for(const s of e)if(!1===it.dispatchEvent(s,new st(t.type,t.map,t.originalEvent)))return!1;return!0}refresh(t){super.refresh(t),void 0!==this.props.feature&&this.props.feature!==this.ol&&(W("replacing bound feature",this.ol),this.componentWillUnmount(),this.ol=this.props.feature,this.componentDidMount()),this.props.properties!==(null==t?void 0:t.properties)&&this.ol.setProperties(this.props.properties),this.props.geometry!==(null==t?void 0:t.geometry)&&this.ol.setGeometry(this.props.geometry),this.props.style!==(null==t?void 0:t.style)&&this.ol.setStyle(et.getStyle(this.props.style))}componentDidMount(){W("didMount",this.ol),super.componentDidMount(),this.ol.on("change",this.onchange),this.context.vectorsource.addFeature(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.ol.un("change",this.onchange),this.context.vectorsource.removeFeature(this.ol)}render(){var t,e,s;if(!(null===(t=null==this?void 0:this.context)||void 0===t?void 0:t.vectorlayer))throw new Error("An RFeature must be part of a vector layer");it.initEventRelay(this.context.map);const i=null===(s=null===(e=this.ol)||void 0===e?void 0:e.getGeometry())||void 0===s?void 0:s.getExtent(),o=i&&a.getCenter(i);return r.createElement("div",{className:"_rlayers_RFeature"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{feature:this.ol,rFeature:this,location:o})},this.props.children))}}it.pointerEvents=["click","pointerdrag","pointermove","singleclick","dblclick"],it.lastFeaturesEntered=[],it.lastFeaturesDragged=[],it.hitTolerance=3;const rt="_rlayers_feature_handlers";class ot extends G{constructor(t){super(t),this.eventSources=this.createSource(t),super.refresh()}createSource(t){throw new Error("RLayerBaseVector is an abstract class")}refresh(t){super.refresh(t),(null==t?void 0:t.style)!==this.props.style&&this.ol.setStyle(et.getStyle(this.props.style))}incrementHandlers(t){var e;const s=B.getOLObject(rt,this.ol);s[t]=(null!==(e=s[t])&&void 0!==e?e:0)+1}decrementHandlers(t){B.getOLObject(rt,this.ol)[t]--}render(){return super.render(),it.initEventRelay(this.context.map),r.createElement("div",{className:"_rlayers_RLayerVector"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{layer:this.ol,source:this.source,vectorlayer:this.ol,vectorsource:this.source,rLayer:this,rLayerVector:this})},this.props.children))}}class nt extends r.PureComponent{constructor(t){super(t),this.ol=null}create(t){throw new Error("RBaseStyle is an abstract class")}refresh(t){if(W("refreshStyle",this),t)for(const e of this.classProps){const s=e.charAt(0).toUpperCase()+e.substring(1);(t&&t[e])!==this.props[e]&&(this.ol["set"+s]?this.ol["set"+s](this.props[e]):console.error(`Underlying OpenLayers object does not support updating of ${e} after object creation. If you are using an anonymous constant array or object, consider assigning its value to a constant and then passing the constant or use React.useMemo() to avoid this warning and improve performance.`))}}set(t){}componentDidMount(){this.set(this.ol)}componentDidUpdate(t,e,s){t!==this.props&&this.refresh(t)}componentWillUnmount(){this.set(null)}render(){if(!this.context)throw new Error("A style property must be part of a style");return null===this.ol&&(this.ol=this.create(this.props)),null}}nt.contextType=I,nt.classProps=[];class lt extends nt{create(t){return this.classProps=lt.classProps,new y.Stroke(t)}set(t){if(this.context.style.setStroke)return this.context.style.setStroke(t);throw new Error("Parent element does not support a stroke")}}lt.classProps=["color","width","lineCap","lineJoin","lineDash"];class at extends nt{create(t){return this.classProps=at.classProps,new y.Fill(t)}set(t){if(this.context.style.setFill)return this.context.style.setFill(t);throw new Error("Parent element does not support a fill")}}at.classProps=["color"];class ht extends nt{create(t){throw new Error("RImage is an abstract class")}set(t){if(!this.context.style.setImage)throw new Error("Parent element does not support an image");this.context.style.setImage(t)}}ht.classProps=["opacity","rotateWithView","rotation","scale","displacement"];class ct extends ht{create(t){throw new Error("RImage is an abstract class")}setStroke(t){this.stroke=t,this.ol=this.create(this.props),super.set(this.ol)}setFill(t){this.fill=t,this.ol=this.create(this.props),super.set(this.ol)}render(){return super.render(),r.createElement("div",{className:"_rlayers_RStyle"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{style:this})},this.props.children))}}ct.classProps=ht.classProps.concat(["radius"]);class pt extends ct{create(t){return this.classProps=pt.classProps,new y.Circle(Object.assign(Object.assign({},t),{stroke:this.stroke,fill:this.fill}))}}pt.classProps=ct.classProps.concat(["radius"]);class ut extends ct{create(t){return this.classProps=ut.classProps,new y.RegularShape(Object.assign(Object.assign({},t),{stroke:this.stroke,fill:this.fill}))}}ut.classProps=ct.classProps.concat(["radius1","radius2","points","angle"]);class dt extends nt{create(t){return this.classProps=dt.classProps,new y.Text(t)}set(t){if(!this.context.style.setText)throw new Error("Parent element does not support a text");this.context.style.setText(t)}render(){return super.render(),r.createElement("div",{className:"_rlayers_RStyle_RText"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{style:this.ol})},this.props.children))}}dt.classProps=["text","font","offsetY","offsetX","overflow","scale","rotation","textAlign","padding","placement","textBaseline"];class ft extends nt{create(t){this.classProps=ft.classProps;const e=this.context.style;if(!e.setBackgroundFill||!e.setBackgroundStroke)throw new Error("Parent element does not support a background");return{setFill:e.setBackgroundFill.bind(e),setStroke:e.setBackgroundStroke.bind(e)}}render(){return super.render(),r.createElement("div",{className:"_rlayers_RStyle_RBackground"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{style:this.ol})},this.props.children))}}ft.classProps=[];class vt extends ht{create(t){return this.classProps=vt.classProps,new y.Icon(t)}}vt.classProps=ht.classProps.concat(["anchor","anchorXUnits","anchorYUnits","color","crossOrigin","img","offset","offsetOrigin","size","imgSize","src"]);var gt=Object.freeze({__proto__:null,RBackground:ft,RBaseStyle:nt,RCircle:pt,RFill:at,RIcon:vt,RRegularShape:ut,RStroke:lt,RStyle:et,RStyleArray:class extends et{constructor(t){super(t),this.style=(t,e)=>{if(this.props.render){const s=this.props.render(t,e);r.Children.map(s.props.children,(t=>{if(r.isValidElement(t)&&t.type!==et)throw new TypeError("An RStyleArray should contain only RStyle elements")}));const i=[],o=r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{styleArray:i})},s.props.children);return h.createRoot(document.createElement("div")).render(o),i}return this.ol},this.childRefs=[],t.render?this.ol=this.style:this.ol=[]}refresh(t){super.refresh(t)}render(){return r.Children.map(this.props.children,(t=>{if(r.isValidElement(t)&&t.type!==et)throw new TypeError("An RStyleArray should contain only RStyle elements")})),this.props.render?r.createElement(r.Fragment,null):r.createElement("div",{className:"_rlayers_RStyleArray"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{styleArray:this.ol})},this.props.children))}},RText:dt,createRStyle:()=>r.createRef(),useRStyle:()=>r.useRef(void 0)});class mt extends V{}class yt extends B{constructor(t){super(t)}toOLProps(t){var e;return{className:t.className,target:null===(e=t.target)||void 0===e?void 0:e.current}}refresh(t){super.refresh(t),this.ol.setProperties(this.toOLProps(this.props))}componentDidMount(){super.componentDidMount(),this.context.map.addControl(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.context.map.removeControl(this.ol)}render(){var t;if(!(null===(t=this.context)||void 0===t?void 0:t.map))throw new Error("A control must be part of a map");return super.render()}}var bt=Object.freeze({__proto__:null,RAttribution:class extends yt{constructor(t){super(t),this.ol=new S.Attribution(this.toOLProps(t))}refresh(t){super.refresh(t),(null==t?void 0:t.collapsed)!==this.props.collapsed&&this.ol.setCollapsed(this.props.collapsed)}toOLProps(t){var e;return Object.assign(Object.assign({},super.toOLProps(t)),{collapsible:null===(e=t.collapsible)||void 0===e||e,collapsed:t.collapsed})}},RCustom:class extends yt{constructor(t){super(t),this.targetRef=r.createRef()}componentDidMount(){this.ol=new S.Control(this.toOLProps(this.props)),super.componentDidMount()}toOLProps(t){var e;return Object.assign(Object.assign({},super.toOLProps(t)),{element:null===(e=this.targetRef)||void 0===e?void 0:e.current})}render(){return r.createElement("div",{className:"_rlayers_RCustomControl"},r.createElement("div",{className:["ol-control",this.props.className].join(" "),ref:this.targetRef},this.props.children))}},RFullScreen:class extends yt{constructor(t){super(t),this.ol=new S.FullScreen(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{source:t.source,label:t.label,labelActive:t.labelActive,tipLabel:t.tipLabel})}},RLayers:class extends yt{constructor(t){super(t),this.onchange=()=>this.forceUpdate(),this.clickCollapse=()=>{this.setState({collapsed:!this.state.collapsed})},this.targetRef=r.createRef(),this.state={collapsed:!0,visible:[!0]}}componentDidMount(){this.ol=new S.Control(this.toOLProps(this.props)),super.componentDidMount(),this.context.map.on("change",this.onchange),this.forceUpdate()}componentWillUnmount(){super.componentWillUnmount(),this.context.map.un("change",this.onchange)}toOLProps(t){var e;return Object.assign(Object.assign({},super.toOLProps(t)),{element:null===(e=this.targetRef)||void 0===e?void 0:e.current})}render(){var t,e;const s=r.Children.map(this.props.children,((t,e)=>{var s;if(r.isValidElement(t))return null!==(s=this.state.visible[e])&&void 0!==s&&s})),i=r.Children.map(this.props.children,(t=>{var e,s;if(r.isValidElement(t))return null!==(s=null===(e=t.props.properties)||void 0===e?void 0:e.label)&&void 0!==s?s:"no label"}));return r.createElement(r.Fragment,null,r.createElement("div",{className:["ol-control",null!==(t=this.props.className)&&void 0!==t?t:"ol-layers-control"].join(" "),ref:this.targetRef},r.createElement("span",{onClick:this.clickCollapse},null!==(e=this.props.element)&&void 0!==e?e:r.createElement("button",null,"=")),this.state.collapsed?null:r.createElement("div",null,i.map(((t,e)=>r.createElement("div",{key:e},r.createElement("input",{type:"radio",id:e.toString(),name:t,value:e.toString(),checked:s[e],onChange:()=>{for(const t in s)s[t]=!1;s[e]=!0,this.setState({visible:[...s],collapsed:!0})}}),r.createElement("label",{htmlFor:e.toString()},t)))))),r.Children.map(this.props.children,((t,e)=>r.isValidElement(t)?r.cloneElement(t,{visible:s[e]}):t)))}},RMousePosition:class extends yt{constructor(t){super(t),this.ol=new O(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{coordinateFormat:t.coordinateFormat,projection:t.projection,placeholder:t.placeholder||" "})}},ROverviewMap:class extends yt{constructor(t){super(t),this.ol=new S.OverviewMap(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{collapsible:t.collapsible,collapsed:t.collapsed,label:t.label,collapseLabel:t.collapseLabel})}refresh(t){super.refresh(t),(null==t?void 0:t.collapsed)!==this.props.collapsed&&this.ol.setCollapsed(this.props.collapsed)}render(){return r.createElement("div",{className:this.props.className,style:{width:this.props.width,height:this.props.height}},r.createElement(I.Provider,{value:{map:this.ol.getOverviewMap()}},this.props.children))}},RRotate:class extends yt{constructor(t){super(t),this.ol=new S.Rotate(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{label:t.label,autoHide:t.autoHide})}},RScaleLine:class extends yt{constructor(t){super(t),this.ol=new S.ScaleLine(this.toOLProps(t))}toOLProps(t){var e;return Object.assign(Object.assign({},super.toOLProps(t)),{minWidth:t.minWidth,bar:t.bar,text:t.text,units:null!==(e=t.units)&&void 0!==e?e:"metric"})}},RZoom:class extends yt{constructor(t){super(t),this.ol=new S.Zoom(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{duration:t.duration,zoomInLabel:t.zoomInLabel,zoomOutLabel:t.zoomOutLabel,zoomInTipLabel:t.zoomInTipLabel,zoomOutTipLabel:t.zoomOutTipLabel,delta:t.delta})}},RZoomSlider:class extends yt{constructor(t){super(t),this.ol=new S.ZoomSlider(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{duration:t.duration})}},RZoomToExtent:class extends yt{constructor(t){super(t),this.ol=new x(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{extent:t.extent,label:t.label,tipLabel:t.tipLabel})}}});class wt extends B{constructor(t){super(t),this.ol=null}createOL(t){throw new Error("RBaseInteraction should not be directly instantiated")}refresh(t){for(const e of this.classProps)if(t&&t[e]!==this.props[e]){W("Replacing interaction",this,t),this.componentWillUnmount(),this.ol=this.createOL(this.props),this.componentDidMount();break}super.refresh(t)}componentDidMount(){super.componentDidMount(),this.context.map.addInteraction(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.context.map.removeInteraction(this.ol)}render(){var t,e;if(!(null===(e=null===(t=this.context)||void 0===t?void 0:t.map)||void 0===e?void 0:e.addInteraction))throw new Error("An interaction must be part of a map");return null===this.ol&&(this.ol=this.createOL(this.props)),super.render()}}wt.classProps=[];class St extends wt{}St.classProps=["handleDownEvent","handleDragEvent","handleMoveEvent","handleUpEvent"];class Ot extends St{createOL(t){return this.classProps=Ot.classProps,new L(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Ot.classProps=["className","condition","minArea","boxEndCondition"];class xt extends St{createOL(t){return this.classProps=xt.classProps,new R(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}xt.classProps=["features","layers","filter","hitTolerance"];class Lt extends St{createOL(t){var e;if(!(null===(e=null==this?void 0:this.context)||void 0===e?void 0:e.vectorsource))throw new Error("A Draw interaction must be part of a vector layer");return this.classProps=Lt.classProps,new E(Object.assign({type:t.type,source:this.context.vectorsource},Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{})))}}Lt.classProps=["condition","finishCondition","freehandCondition","style","stopClick","maxPoints","minPoints","snapTolerance"];class Rt extends St{createOL(t){var e;if(!(null===(e=null==this?void 0:this.context)||void 0===e?void 0:e.vectorsource))throw new Error("A Modify interaction must be part of a vector layer");return this.classProps=Rt.classProps,new P(Object.assign({source:this.context.vectorsource},Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{})))}}Rt.classProps=["condition","deleteCondition","insertVertexCondition","style","pixelTolerance","hitDetection"];class Et extends wt{createOL(t){return this.classProps=Et.classProps,new j(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Et.classProps=["duration","delta"];class Pt extends wt{createOL(t){return this.classProps=Pt.classProps,new k(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Pt.classProps=["condition","kinetic"];class jt extends wt{createOL(t){return this.classProps=jt.classProps,new z(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}jt.classProps=["condition","duration"];class kt extends wt{createOL(t){return this.classProps=kt.classProps,new F(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}kt.classProps=["className","condition","duration","out","minArea"];class zt extends wt{createOL(t){return this.classProps=zt.classProps,new T(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}zt.classProps=["condition","maxDelta","duration","useAnchor","constrainResolution"];class Ft extends wt{createOL(t){return this.classProps=Ft.classProps,new _(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Ft.classProps=["threshold","duration"];class Tt extends wt{createOL(t){return this.classProps=Tt.classProps,new A(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Tt.classProps=["duration"];class _t extends wt{createOL(t){return this.classProps=_t.classProps,new D(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}_t.classProps=["condition","duration","pixelDelta"];class At extends wt{createOL(t){return this.classProps=At.classProps,new M(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}At.classProps=["condition","duration","delta"];var Dt=Object.freeze({__proto__:null,RBaseInteraction:wt,RDoubleClickZoom:Et,RDragBox:Ot,RDragPan:Pt,RDragRotate:jt,RDragZoom:kt,RDraw:Lt,RKeyboardPan:_t,RKeyboardZoom:At,RModify:Rt,RMouseWheelZoom:zt,RPinchRotate:Ft,RPinchZoom:Tt,RPointer:St,RTranslate:xt});class Mt extends B{constructor(t){super(t),this.ol=new e.Overlay({autoPan:t.autoPan,offset:t.offset,positioning:t.positioning}),this.containerRef=r.createRef()}setPosition(){var t;if(this.ol.setPosition(this.context.location),this.props.autoPosition&&(null===(t=this.containerRef)||void 0===t?void 0:t.current)){this.containerRef.current.style.position="absolute";const t=this.context.map.getPixelFromCoordinate(this.context.location),e=this.context.map.getSize();t[0]>e[0]/2?(this.containerRef.current.style.left=null,this.containerRef.current.style.right="0px"):(this.containerRef.current.style.left="0px",this.containerRef.current.style.right=null),t[1]>e[1]/2?(this.containerRef.current.style.top=null,this.containerRef.current.style.bottom="0px"):(this.containerRef.current.style.top="0px",this.containerRef.current.style.bottom=null)}}refresh(t){super.refresh(t),this.ol.setElement(this.containerRef.current),this.setPosition(),this.props.offset!==(null==t?void 0:t.offset)&&this.ol.setOffset(this.props.offset),this.props.positioning!==(null==t?void 0:t.positioning)&&this.ol.setPositioning(this.props.positioning)}componentDidMount(){super.componentDidMount(),this.context.map.addOverlay(this.ol)}componentWillUnmount(){super.componentWillUnmount(),this.context.map.removeOverlay(this.ol)}render(){var t;if(!(null===(t=this.context)||void 0===t?void 0:t.location))throw new Error("An overlay must be part of a location provider (ie RFeature)");return this.setPosition(),r.createElement("div",{className:"_rlayers_ROverlay"},r.createElement("div",{ref:this.containerRef,className:this.props.className,onClick:this.props.onClick},this.props.children))}}return Object.defineProperty(t,"MapBrowserEvent",{enumerable:!0,get:function(){return e.MapBrowserEvent}}),Object.defineProperty(t,"MapEvent",{enumerable:!0,get:function(){return e.MapEvent}}),t.RenderEvent=s,Object.defineProperty(t,"VectorSourceEvent",{enumerable:!0,get:function(){return i.VectorSourceEvent}}),t.RContext=I,t.RControl=bt,t.RFeature=it,t.RFeatureBaseEvent=class extends l{},t.RFeatureUIEvent=st,t.RGeolocation=class extends B{constructor(t){super(t),this.ol=null}render(){var t,e;if(!(null===(t=null==this?void 0:this.context)||void 0===t?void 0:t.map))throw new Error("A Geolocation must be part of a map");if(null===this.ol){const t=null!==(e=this.props.projection)&&void 0!==e?e:this.context.map.getView().getProjection();this.ol=new C(Object.assign(Object.assign({},this.props),{projection:t}))}return super.render()}},t.RInteraction=Dt,t.RLayer=G,t.RLayerBaseVector=ot,t.RLayerCluster=class extends ot{createSource(t){return this.cluster=new n.Vector({features:this.props.features,url:this.props.url,format:this.props.format,loader:this.props.loader,wrapX:this.props.wrapX,strategy:this.props.strategy,attributions:this.props.attributions}),this.source=new n.Cluster({source:this.cluster,distance:this.props.distance}),this.ol=new o.Vector(Object.assign(Object.assign({},t),{source:this.source,style:et.getStyle(t.style)})),[this.ol,this.source,this.cluster]}refresh(t){super.refresh(t),(null==t?void 0:t.distance)!==this.props.distance&&this.source.setDistance(this.props.distance),(null==t?void 0:t.url)!==this.props.url&&(this.cluster.setUrl(this.props.url),this.cluster.refresh())}render(){return r.createElement("div",{className:"_rlayers_RLayerCluster"},r.createElement(I.Provider,{value:Object.assign(Object.assign({},this.context),{layer:this.ol,source:this.cluster,vectorlayer:this.ol,vectorsource:this.cluster,rLayer:this,rLayerVector:this})},this.props.children))}},t.RLayerGraticule=class extends G{constructor(t){super(t),this.createSource()}createSource(){var t,e,s,i,r,o;const n=null===(e=null===(t=et.getStyleStatic(this.props.strokeStyle))||void 0===t?void 0:t.getStroke)||void 0===e?void 0:e.call(t),l=null===(i=null===(s=et.getStyleStatic(this.props.lonLabelStyle))||void 0===s?void 0:s.getText)||void 0===i?void 0:i.call(s),a=null===(o=null===(r=et.getStyleStatic(this.props.latLabelStyle))||void 0===r?void 0:r.getText)||void 0===o?void 0:o.call(r);this.ol=new m(Object.assign(Object.assign({},this.props),{strokeStyle:n,lonLabelStyle:l,latLabelStyle:a})),this.eventSources=[this.ol]}refresh(t){super.refresh(t);const e=this.context.map.removeLayer(this.ol);this.createSource(),this.attachOldEventHandlers(this.ol),e&&this.context.map.addLayer(this.ol)}},t.RLayerHeatmap=class extends ot{createSource(t){return this.source=new n.Vector({features:this.props.features,url:this.props.url,format:this.props.format,loader:this.props.loader,wrapX:this.props.wrapX,strategy:this.props.strategy,attributions:this.props.attributions}),this.ol=new o.Heatmap(Object.assign(Object.assign({},t),{source:this.source})),[this.ol,this.source]}refresh(t){super.refresh(t),(null==t?void 0:t.blur)!==this.props.blur&&this.ol.setBlur(this.props.blur),(null==t?void 0:t.radius)!==this.props.radius&&this.ol.setRadius(this.props.radius)}},t.RLayerImage=class extends G{constructor(t){super(t),this.createSource(),this.ol=new f({source:this.source}),this.eventSources=[this.ol,this.source]}createSource(){const t={url:this.props.url,projection:this.props.projection,imageExtent:this.props.extent,imageSize:this.props.size,attributions:this.props.attributions};this.source=new g(t),this.eventSources=[this.ol,this.source]}refresh(t){super.refresh(t),this.props.url&&(null==t?void 0:t.url)!==this.props.url&&(this.createSource(),this.ol.setSource(this.source),this.eventSources=[this.ol,this.source],this.attachOldEventHandlers(this.source))}},t.RLayerTile=class extends V{constructor(t){super(t),this.createSource(),this.ol=new o.Tile({source:this.source}),this.eventSources=[this.ol,this.source]}createSource(){this.source=new n.XYZ({url:this.props.url,interpolate:!this.props.noIterpolation,projection:this.props.projection,tileGrid:this.props.tileGrid,crossOrigin:this.props.crossOrigin,attributions:this.props.attributions}),this.eventSources=[this.ol,this.source]}refresh(t){super.refresh(t),(null==t?void 0:t.tileGrid)===this.props.tileGrid&&(null==t?void 0:t.url)===this.props.url||(W("replacing source",this),this.createSource(),this.ol.setSource(this.source),this.attachOldEventHandlers(this.source))}},t.RLayerTileJSON=class extends V{constructor(t){super(t),this.source=new n.TileJSON({url:this.props.url,tileSize:this.props.tileSize}),this.ol=new o.Tile({source:this.source}),this.eventSources=[this.ol,this.source]}refresh(t){super.refresh(t),this.props.url&&(null==t?void 0:t.url)!==this.props.url&&(this.source.setUrl(this.props.url),this.source.refresh())}},t.RLayerTileWMS=class extends V{constructor(t){super(t),this.createSource(),this.ol=new b({source:this.source}),this.eventSources=