UNPKG

rlayers

Version:

React Components for OpenLayers

1 lines 61.5 kB
var rlayers=function(t,e,s,i,r,o,n,l,a,h,c,p,u,d,f,v,g,m,y,b,S,w,x,O,L,R,E,P,j,T,k,z,F,_,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;#a;get perf(){return this.#a}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#c;#p;#u;#d;#f;#v;#g;#m;#y;#b;#S;#w;#x;#O;#L;#R;#E;#P;static unsafeExposeInternals(t){return{starts:t.#w,ttls:t.#x,autopurgeTimers:t.#O,sizes:t.#S,keyMap:t.#p,keyList:t.#u,valList:t.#d,next:t.#f,prev:t.#v,get head(){return t.#g},get tail(){return t.#m},free:t.#y,isBackgroundFetch:e=>t.#j(e),backgroundFetch:(e,s,i,r)=>t.#T(e,s,i,r),moveToTail:e=>t.#k(e),indexes:e=>t.#z(e),rindexes:e=>t.#F(e),isStale:e=>t.#_(e)}}get max(){return this.#e}get maxSize(){return this.#s}get calculatedSize(){return this.#c}get size(){return this.#h}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:S,allowStaleOnFetchAbort:w,ignoreFetchAbort:x,perf:O}=t;if(void 0!==O&&"function"!=typeof O?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#a=O??N,0!==e&&!K(e))throw new TypeError("max option must be a nonnegative integer");const L=e?$(e):Array;if(!L)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.#R=!!g,this.#p=new Map,this.#u=new Array(e).fill(void 0),this.#d=new Array(e).fill(void 0),this.#f=new L(e),this.#v=new L(e),this.#g=0,this.#m=0,this.#y=Q.create(e),this.#h=0,this.#c=0,"function"==typeof a&&(this.#i=a),"function"==typeof h&&(this.#r=h),"function"==typeof c?(this.#o=c,this.#b=[]):(this.#o=void 0,this.#b=void 0),this.#L=!!this.#i,this.#P=!!this.#r,this.#E=!!this.#o,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!x,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.#A()}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.#D()}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.#p.has(t)?1/0:0}#D(){const t=new J(this.#e),e=new J(this.#e);this.#x=t,this.#w=e;const s=this.ttlAutopurge?new Array(this.#e):void 0;this.#O=s,this.#M=(i,r,o=this.#a.now())=>{if(e[i]=0!==r?o:0,t[i]=r,s?.[i]&&(clearTimeout(s[i]),s[i]=void 0),0!==r&&s){const t=setTimeout((()=>{this.#_(i)&&this.#C(this.#u[i],"expire")}),r+1);t.unref&&t.unref(),s[i]=t}},this.#I=s=>{e[s]=0!==t[s]?this.#a.now():0},this.#W=(s,o)=>{if(t[o]){const n=t[o],l=e[o];if(!n||!l)return;s.ttl=n,s.start=l,s.now=i||r();const a=s.now-l;s.remainingTTL=n-a}};let i=0;const r=()=>{const t=this.#a.now();if(this.ttlResolution>0){i=t;const e=setTimeout((()=>i=0),this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=s=>{const o=this.#p.get(s);if(void 0===o)return 0;const n=t[o],l=e[o];if(!n||!l)return 1/0;return n-((i||r())-l)},this.#_=s=>{const o=e[s],n=t[s];return!!n&&!!o&&(i||r())-o>n}}#I=()=>{};#W=()=>{};#M=()=>{};#_=()=>!1;#A(){const t=new J(this.#e);this.#c=0,this.#S=t,this.#U=e=>{this.#c-=t[e],t[e]=0},this.#B=(t,e,s,i)=>{if(this.#j(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.#G=(e,s,i)=>{if(t[e]=s,this.#s){const s=this.#s-t[e];for(;this.#c>s;)this.#V(!0)}this.#c+=t[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#c)}}#U=t=>{};#G=(t,e,s)=>{};#B=(t,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#z({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#m;this.#N(e)&&(!t&&this.#_(e)||(yield e),e!==this.#g);)e=this.#v[e]}*#F({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#g;this.#N(e)&&(!t&&this.#_(e)||(yield e),e!==this.#m);)e=this.#f[e]}#N(t){return void 0!==t&&this.#p.get(this.#u[t])===t}*entries(){for(const t of this.#z())void 0===this.#d[t]||void 0===this.#u[t]||this.#j(this.#d[t])||(yield[this.#u[t],this.#d[t]])}*rentries(){for(const t of this.#F())void 0===this.#d[t]||void 0===this.#u[t]||this.#j(this.#d[t])||(yield[this.#u[t],this.#d[t]])}*keys(){for(const t of this.#z()){const e=this.#u[t];void 0===e||this.#j(this.#d[t])||(yield e)}}*rkeys(){for(const t of this.#F()){const e=this.#u[t];void 0===e||this.#j(this.#d[t])||(yield e)}}*values(){for(const t of this.#z()){void 0===this.#d[t]||this.#j(this.#d[t])||(yield this.#d[t])}}*rvalues(){for(const t of this.#F()){void 0===this.#d[t]||this.#j(this.#d[t])||(yield this.#d[t])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const s of this.#z()){const i=this.#d[s],r=this.#j(i)?i.__staleWhileFetching:i;if(void 0!==r&&t(r,this.#u[s],this))return this.get(this.#u[s],e)}}forEach(t,e=this){for(const s of this.#z()){const i=this.#d[s],r=this.#j(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.#u[s],this)}}rforEach(t,e=this){for(const s of this.#F()){const i=this.#d[s],r=this.#j(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.#u[s],this)}}purgeStale(){let t=!1;for(const e of this.#F({allowStale:!0}))this.#_(e)&&(this.#C(this.#u[e],"expire"),t=!0);return t}info(t){const e=this.#p.get(t);if(void 0===e)return;const s=this.#d[e],i=this.#j(s)?s.__staleWhileFetching:s;if(void 0===i)return;const r={value:i};if(this.#x&&this.#w){const t=this.#x[e],s=this.#w[e];if(t&&s){const e=t-(this.#a.now()-s);r.ttl=e,r.start=Date.now()}}return this.#S&&(r.size=this.#S[e]),r}dump(){const t=[];for(const e of this.#z({allowStale:!0})){const s=this.#u[e],i=this.#d[e],r=this.#j(i)?i.__staleWhileFetching:i;if(void 0===r||void 0===s)continue;const o={value:r};if(this.#x&&this.#w){o.ttl=this.#x[e];const t=this.#a.now()-this.#w[e];o.start=Math.floor(Date.now()-t)}this.#S&&(o.size=this.#S[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=this.#a.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.#B(t,e,s.size||0,n);if(this.maxEntrySize&&h>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#C(t,"set"),this;let c=0===this.#h?void 0:this.#p.get(t);if(void 0===c)c=0===this.#h?this.#m:0!==this.#y.length?this.#y.pop():this.#h===this.#e?this.#V(!1):this.#h,this.#u[c]=t,this.#d[c]=e,this.#p.set(t,c),this.#f[this.#m]=c,this.#v[c]=this.#m,this.#m=c,this.#h++,this.#G(c,h,l),l&&(l.set="add"),a=!1,this.#P&&this.#r?.(e,t,"add");else{this.#k(c);const s=this.#d[c];if(e!==s){if(this.#R&&this.#j(s)){s.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=s;void 0===e||o||(this.#L&&this.#i?.(e,t,"set"),this.#E&&this.#b?.push([e,t,"set"]))}else o||(this.#L&&this.#i?.(s,t,"set"),this.#E&&this.#b?.push([s,t,"set"]));if(this.#U(c),this.#G(c,h,l),this.#d[c]=e,l){l.set="replace";const t=s&&this.#j(s)?s.__staleWhileFetching:s;void 0!==t&&(l.oldValue=t)}}else l&&(l.set="update");this.#P&&this.onInsert?.(e,t,e===s?"update":"replace")}if(0===i||this.#x||this.#D(),this.#x&&(a||this.#M(c,i,r),l&&this.#W(l,c)),!o&&this.#E&&this.#b){const t=this.#b;let e;for(;e=t?.shift();)this.#o?.(...e)}return this}pop(){try{for(;this.#h;){const t=this.#d[this.#g];if(this.#V(!0),this.#j(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#E&&this.#b){const t=this.#b;let e;for(;e=t?.shift();)this.#o?.(...e)}}}#V(t){const e=this.#g,s=this.#u[e],i=this.#d[e];return this.#R&&this.#j(i)?i.__abortController.abort(new Error("evicted")):(this.#L||this.#E)&&(this.#L&&this.#i?.(i,s,"evict"),this.#E&&this.#b?.push([i,s,"evict"])),this.#U(e),this.#O?.[e]&&(clearTimeout(this.#O[e]),this.#O[e]=void 0),t&&(this.#u[e]=void 0,this.#d[e]=void 0,this.#y.push(e)),1===this.#h?(this.#g=this.#m=0,this.#y.length=0):this.#g=this.#f[e],this.#p.delete(s),this.#h--,e}has(t,e={}){const{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#p.get(t);if(void 0!==r){const t=this.#d[r];if(this.#j(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#_(r))return s&&this.#I(r),i&&(i.has="hit",this.#W(i,r)),!0;i&&(i.has="stale",this.#W(i,r))}else i&&(i.has="miss");return!1}peek(t,e={}){const{allowStale:s=this.allowStale}=e,i=this.#p.get(t);if(void 0===i||!s&&this.#_(i))return;const r=this.#d[i];return this.#j(r)?r.__staleWhileFetching:r}#T(t,e,s,i){const r=void 0===e?void 0:this.#d[e];if(this.#j(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,u=this.#d[e];return(u===c||a&&r&&void 0===u)&&(void 0===i?void 0!==p.__staleWhileFetching?this.#d[e]=p.__staleWhileFetching:this.#C(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.#d[e]===c){!a||void 0===h.__staleWhileFetching?this.#C(t,"fetch"):n||(this.#d[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.#p.get(t)):this.#d[e]=p,p}#j(t){if(!this.#R)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.#R)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.#p.get(t);if(void 0===b){g&&(g.fetch="miss");const e=this.#T(t,b,y,f);return e.__returned=e}{const e=this.#d[b];if(this.#j(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.#_(b);if(!v&&!r)return g&&(g.fetch="hit"),this.#k(b),i&&this.#I(b),g&&this.#W(g,b),e;const o=this.#T(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.#p.get(t);if(void 0!==n){const e=this.#d[n],l=this.#j(e);return o&&this.#W(o,n),this.#_(n)?(o&&(o.get="stale"),l?(o&&s&&void 0!==e.__staleWhileFetching&&(o.returnedStale=!0),s?e.__staleWhileFetching:void 0):(r||this.#C(t,"expire"),o&&s&&(o.returnedStale=!0),s?e:void 0)):(o&&(o.get="hit"),l?e.__staleWhileFetching:(this.#k(n),i&&this.#I(n),e))}o&&(o.get="miss")}#H(t,e){this.#v[e]=t,this.#f[t]=e}#k(t){t!==this.#m&&(t===this.#g?this.#g=this.#f[t]:this.#H(this.#v[t],this.#f[t]),this.#H(this.#m,t),this.#m=t)}delete(t){return this.#C(t,"delete")}#C(t,e){let s=!1;if(0!==this.#h){const i=this.#p.get(t);if(void 0!==i)if(this.#O?.[i]&&(clearTimeout(this.#O?.[i]),this.#O[i]=void 0),s=!0,1===this.#h)this.#Z(e);else{this.#U(i);const s=this.#d[i];if(this.#j(s)?s.__abortController.abort(new Error("deleted")):(this.#L||this.#E)&&(this.#L&&this.#i?.(s,t,e),this.#E&&this.#b?.push([s,t,e])),this.#p.delete(t),this.#u[i]=void 0,this.#d[i]=void 0,i===this.#m)this.#m=this.#v[i];else if(i===this.#g)this.#g=this.#f[i];else{const t=this.#v[i];this.#f[t]=this.#f[i];const e=this.#f[i];this.#v[e]=this.#v[i]}this.#h--,this.#y.push(i)}}if(this.#E&&this.#b?.length){const t=this.#b;let e;for(;e=t?.shift();)this.#o?.(...e)}return s}clear(){return this.#Z("delete")}#Z(t){for(const e of this.#F({allowStale:!0})){const s=this.#d[e];if(this.#j(s))s.__abortController.abort(new Error("deleted"));else{const i=this.#u[e];this.#L&&this.#i?.(s,i,t),this.#E&&this.#b?.push([s,i,t])}}if(this.#p.clear(),this.#d.fill(void 0),this.#u.fill(void 0),this.#x&&this.#w){this.#x.fill(0),this.#w.fill(0);for(const t of this.#O??[])void 0!==t&&clearTimeout(t);this.#O?.fill(void 0)}if(this.#S&&this.#S.fill(0),this.#g=0,this.#m=0,this.#y.length=0,this.#c=0,this.#h=0,this.#E&&this.#b){const t=this.#b;let e;for(;e=t?.shift();)this.#o?.(...e)}}}function et(t){return!!t&&(Array.isArray(t)?"style"in t[0]:"function"!=typeof t&&(!(t instanceof c)&&(!(t instanceof st)&&!("current"in t))))}class st 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}}}st.contextType=I;class it extends e.MapBrowserEvent{}class rt 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:st.getStyle(t.style)})),this.onchange=()=>this.forceUpdate()}static initEventRelay(t){for(const e of rt.pointerEvents)t.on(e,rt.eventRelay)}incrementHandlers(t){var e;const s=B.getOLObject(ot,this.context.vectorlayer);s[t]=(null!==(e=s[t])&&void 0!==e?e:0)+1}decrementHandlers(t){B.getOLObject(ot,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:rt.hitTolerance,layerFilter:e=>{var s,i,r,o,n;const l=B.getOLObject(ot,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){rt.lastFeaturesDragged.length||(rt.lastFeaturesDragged=[...e]);for(const t of rt.lastFeaturesDragged)e.find((e=>e.feature===t.feature))||e.push(t)}else{for(const e of rt.lastFeaturesDragged){if(!1===rt.dispatchEvent(e,new it("pointerdragend",t.map,t.originalEvent)))return rt.lastFeaturesDragged=[],!1}rt.lastFeaturesDragged=[]}if("pointermove"===t.type){for(const s of rt.lastFeaturesEntered)if(!e.find((t=>t.feature===s.feature))){const e=rt.dispatchEvent(s,new it("pointerleave",t.map,t.originalEvent));if(s.feature=null,s.layer=null,!1===e)return rt.lastFeaturesEntered=rt.lastFeaturesEntered.filter((t=>t.feature)),!1}rt.lastFeaturesEntered=rt.lastFeaturesEntered.filter((t=>t.feature));for(const s of e)if(!rt.lastFeaturesEntered.find((t=>t.feature===s.feature))){const e=rt.dispatchEvent(s,new it("pointerenter",t.map,t.originalEvent));if(rt.lastFeaturesEntered.push(s),!1===e)return!1}}for(const s of e)if(!1===rt.dispatchEvent(s,new it(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(st.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");rt.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))}}rt.pointerEvents=["click","pointerdrag","pointermove","singleclick","dblclick"],rt.lastFeaturesEntered=[],rt.lastFeaturesDragged=[],rt.hitTolerance=3;const ot="_rlayers_feature_handlers";class nt 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&&(et(this.props.style)?this.ol.setStyle(this.props.style):this.ol.setStyle(st.getStyle(this.props.style)))}incrementHandlers(t){var e;const s=B.getOLObject(ot,this.ol);s[t]=(null!==(e=s[t])&&void 0!==e?e:0)+1}decrementHandlers(t){B.getOLObject(ot,this.ol)[t]--}render(){return super.render(),rt.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 lt 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}}lt.contextType=I,lt.classProps=[];class at extends lt{create(t){return this.classProps=at.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")}}at.classProps=["color","width","lineCap","lineJoin","lineDash"];class ht extends lt{create(t){return this.classProps=ht.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")}}ht.classProps=["color"];class ct extends lt{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)}}ct.classProps=["opacity","rotateWithView","rotation","scale","displacement"];class pt extends ct{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))}}pt.classProps=ct.classProps.concat(["radius"]);class ut extends pt{create(t){return this.classProps=ut.classProps,new y.Circle(Object.assign(Object.assign({},t),{stroke:this.stroke,fill:this.fill}))}}ut.classProps=pt.classProps.concat(["radius"]);class dt extends pt{create(t){return this.classProps=dt.classProps,new y.RegularShape(Object.assign(Object.assign({},t),{stroke:this.stroke,fill:this.fill}))}}dt.classProps=pt.classProps.concat(["radius1","radius2","points","angle"]);class ft extends lt{create(t){return this.classProps=ft.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))}}ft.classProps=["text","font","offsetY","offsetX","overflow","scale","rotation","textAlign","padding","placement","textBaseline"];class vt extends lt{create(t){this.classProps=vt.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))}}vt.classProps=[];class gt extends ct{create(t){return this.classProps=gt.classProps,new y.Icon(t)}}gt.classProps=ct.classProps.concat(["anchor","anchorXUnits","anchorYUnits","color","crossOrigin","img","offset","offsetOrigin","size","imgSize","src"]);var mt=Object.freeze({__proto__:null,RBackground:vt,RBaseStyle:lt,RCircle:ut,RFill:ht,RIcon:gt,RRegularShape:dt,RStroke:at,RStyle:st,RStyleArray:class extends st{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!==st)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!==st)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:ft,createRStyle:()=>r.createRef(),useRStyle:()=>r.useRef(void 0)});class yt extends V{}class bt 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 St=Object.freeze({__proto__:null,RAttribution:class extends bt{constructor(t){super(t),this.ol=new w.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 bt{constructor(t){super(t),this.targetRef=r.createRef()}componentDidMount(){this.ol=new w.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 bt{constructor(t){super(t),this.ol=new w.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 bt{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 w.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 bt{constructor(t){super(t),this.ol=new x(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{coordinateFormat:t.coordinateFormat,projection:t.projection,placeholder:t.placeholder||"&nbsp"})}},ROverviewMap:class extends bt{constructor(t){super(t),this.ol=new w.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 bt{constructor(t){super(t),this.ol=new w.Rotate(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{label:t.label,autoHide:t.autoHide})}},RScaleLine:class extends bt{constructor(t){super(t),this.ol=new w.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 bt{constructor(t){super(t),this.ol=new w.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 bt{constructor(t){super(t),this.ol=new w.ZoomSlider(this.toOLProps(t))}toOLProps(t){return Object.assign(Object.assign({},super.toOLProps(t)),{duration:t.duration})}},RZoomToExtent:class extends bt{constructor(t){super(t),this.ol=new O(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 xt extends wt{}xt.classProps=["handleDownEvent","handleDragEvent","handleMoveEvent","handleUpEvent"];class Ot extends xt{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 Lt extends xt{createOL(t){return this.classProps=Lt.classProps,new R(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Lt.classProps=["features","layers","filter","hitTolerance"];class Rt extends xt{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=Rt.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]})),{})))}}Rt.classProps=["condition","finishCondition","freehandCondition","style","stopClick","maxPoints","minPoints","snapTolerance"];class Et extends xt{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=Et.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]})),{})))}}Et.classProps=["condition","deleteCondition","insertVertexCondition","style","pixelTolerance","hitDetection"];class Pt extends wt{createOL(t){return this.classProps=Pt.classProps,new j(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Pt.classProps=["duration","delta"];class jt extends wt{createOL(t){return this.classProps=jt.classProps,new T(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}jt.classProps=["condition","kinetic"];class Tt extends wt{createOL(t){return this.classProps=Tt.classProps,new k(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Tt.classProps=["condition","duration"];class kt extends wt{createOL(t){return this.classProps=kt.classProps,new z(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 F(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 _t extends wt{createOL(t){return this.classProps=_t.classProps,new A(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}_t.classProps=["duration"];class At extends wt{createOL(t){return this.classProps=At.classProps,new D(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}At.classProps=["condition","duration","pixelDelta"];class Dt extends wt{createOL(t){return this.classProps=Dt.classProps,new M(Object.keys(t).filter((t=>this.classProps.includes(t))).reduce(((e,s)=>Object.assign(Object.assign({},e),{[s]:t[s]})),{}))}}Dt.classProps=["condition","duration","delta"];var Mt=Object.freeze({__proto__:null,RBaseInteraction:wt,RDoubleClickZoom:Pt,RDragBox:Ot,RDragPan:jt,RDragRotate:Tt,RDragZoom:kt,RDraw:Rt,RKeyboardPan:At,RKeyboardZoom:Dt,RModify:Et,RMouseWheelZoom:zt,RPinchRotate:Ft,RPinchZoom:_t,RPointer:xt,RTranslate:Lt});class Ct 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=St,t.RFeature=rt,t.RFeatureBaseEvent=class extends l{},t.RFeatureUIEvent=it,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=Mt,t.RLayer=G,t.RLayerBaseVector=nt,t.RLayerCluster=class extends nt{createSource(t){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});const e=et(t.style)?t.style:st.getStyle(t.style);return this.ol=new o.Vector(Object.assign(Object.assign({},t),{source:this.source,style:e})),[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=st.getStyleStatic(this.props.strokeStyle))||void 0===t?void 0:t.getStroke)||void 0===e?void 0:e.call(t),l=null===(i=null===(s=st.getStyleStatic(this.props.lonLabelStyle))||void 0===s?void 0:s.getText)||void 0===i?void 0:i.call(s),a=null===(o=null===(r=st.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 nt{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}