@neshan-maps-platform/react-openlayers 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,780 @@
1
+ import Ie, { createContext as ur, forwardRef as cr, useContext as lr, useRef as fr, useState as ce, useImperativeHandle as dr, useEffect as vr } from "react";
2
+ var le = {}, pr = {
3
+ get exports() {
4
+ return le;
5
+ },
6
+ set exports(c) {
7
+ le = c;
8
+ }
9
+ }, N = {};
10
+ /**
11
+ * @license React
12
+ * react-jsx-runtime.production.min.js
13
+ *
14
+ * Copyright (c) Facebook, Inc. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */
19
+ var Fe;
20
+ function mr() {
21
+ if (Fe)
22
+ return N;
23
+ Fe = 1;
24
+ var c = Ie, C = Symbol.for("react.element"), D = Symbol.for("react.fragment"), w = Object.prototype.hasOwnProperty, g = c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, F = { key: !0, ref: !0, __self: !0, __source: !0 };
25
+ function k(O, v, S) {
26
+ var m, E = {}, x = null, R = null;
27
+ S !== void 0 && (x = "" + S), v.key !== void 0 && (x = "" + v.key), v.ref !== void 0 && (R = v.ref);
28
+ for (m in v)
29
+ w.call(v, m) && !F.hasOwnProperty(m) && (E[m] = v[m]);
30
+ if (O && O.defaultProps)
31
+ for (m in v = O.defaultProps, v)
32
+ E[m] === void 0 && (E[m] = v[m]);
33
+ return { $$typeof: C, type: O, key: x, ref: R, props: E, _owner: g.current };
34
+ }
35
+ return N.Fragment = D, N.jsx = k, N.jsxs = k, N;
36
+ }
37
+ var W = {};
38
+ /**
39
+ * @license React
40
+ * react-jsx-runtime.development.js
41
+ *
42
+ * Copyright (c) Facebook, Inc. and its affiliates.
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ */
47
+ var Ae;
48
+ function yr() {
49
+ return Ae || (Ae = 1, process.env.NODE_ENV !== "production" && function() {
50
+ var c = Ie, C = Symbol.for("react.element"), D = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), O = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), R = Symbol.for("react.offscreen"), T = Symbol.iterator, Y = "@@iterator";
51
+ function H(e) {
52
+ if (e === null || typeof e != "object")
53
+ return null;
54
+ var r = T && e[T] || e[Y];
55
+ return typeof r == "function" ? r : null;
56
+ }
57
+ var P = c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
+ function p(e) {
59
+ {
60
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
61
+ t[n - 1] = arguments[n];
62
+ M("error", e, t);
63
+ }
64
+ }
65
+ function M(e, r, t) {
66
+ {
67
+ var n = P.ReactDebugCurrentFrame, i = n.getStackAddendum();
68
+ i !== "" && (r += "%s", t = t.concat([i]));
69
+ var s = t.map(function(o) {
70
+ return String(o);
71
+ });
72
+ s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
73
+ }
74
+ }
75
+ var X = !1, V = !1, Z = !1, Q = !1, ee = !1, B;
76
+ B = Symbol.for("react.module.reference");
77
+ function U(e) {
78
+ return !!(typeof e == "string" || typeof e == "function" || e === w || e === F || ee || e === g || e === S || e === m || Q || e === R || X || V || Z || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === E || e.$$typeof === k || e.$$typeof === O || e.$$typeof === v || // This needs to include all possible module reference object
79
+ // types supported by any Flight configuration anywhere since
80
+ // we don't know which Flight build this will end up being used
81
+ // with.
82
+ e.$$typeof === B || e.getModuleId !== void 0));
83
+ }
84
+ function u(e, r, t) {
85
+ var n = e.displayName;
86
+ if (n)
87
+ return n;
88
+ var i = r.displayName || r.name || "";
89
+ return i !== "" ? t + "(" + i + ")" : t;
90
+ }
91
+ function h(e) {
92
+ return e.displayName || "Context";
93
+ }
94
+ function d(e) {
95
+ if (e == null)
96
+ return null;
97
+ if (typeof e.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
98
+ return e.displayName || e.name || null;
99
+ if (typeof e == "string")
100
+ return e;
101
+ switch (e) {
102
+ case w:
103
+ return "Fragment";
104
+ case D:
105
+ return "Portal";
106
+ case F:
107
+ return "Profiler";
108
+ case g:
109
+ return "StrictMode";
110
+ case S:
111
+ return "Suspense";
112
+ case m:
113
+ return "SuspenseList";
114
+ }
115
+ if (typeof e == "object")
116
+ switch (e.$$typeof) {
117
+ case O:
118
+ var r = e;
119
+ return h(r) + ".Consumer";
120
+ case k:
121
+ var t = e;
122
+ return h(t._context) + ".Provider";
123
+ case v:
124
+ return u(e, e.render, "ForwardRef");
125
+ case E:
126
+ var n = e.displayName || null;
127
+ return n !== null ? n : d(e.type) || "Memo";
128
+ case x: {
129
+ var i = e, s = i._payload, o = i._init;
130
+ try {
131
+ return d(o(s));
132
+ } catch {
133
+ return null;
134
+ }
135
+ }
136
+ }
137
+ return null;
138
+ }
139
+ var _ = Object.assign, $ = 0, fe, de, ve, pe, me, ye, ge;
140
+ function he() {
141
+ }
142
+ he.__reactDisabledLog = !0;
143
+ function $e() {
144
+ {
145
+ if ($ === 0) {
146
+ fe = console.log, de = console.info, ve = console.warn, pe = console.error, me = console.group, ye = console.groupCollapsed, ge = console.groupEnd;
147
+ var e = {
148
+ configurable: !0,
149
+ enumerable: !0,
150
+ value: he,
151
+ writable: !0
152
+ };
153
+ Object.defineProperties(console, {
154
+ info: e,
155
+ log: e,
156
+ warn: e,
157
+ error: e,
158
+ group: e,
159
+ groupCollapsed: e,
160
+ groupEnd: e
161
+ });
162
+ }
163
+ $++;
164
+ }
165
+ }
166
+ function Le() {
167
+ {
168
+ if ($--, $ === 0) {
169
+ var e = {
170
+ configurable: !0,
171
+ enumerable: !0,
172
+ writable: !0
173
+ };
174
+ Object.defineProperties(console, {
175
+ log: _({}, e, {
176
+ value: fe
177
+ }),
178
+ info: _({}, e, {
179
+ value: de
180
+ }),
181
+ warn: _({}, e, {
182
+ value: ve
183
+ }),
184
+ error: _({}, e, {
185
+ value: pe
186
+ }),
187
+ group: _({}, e, {
188
+ value: me
189
+ }),
190
+ groupCollapsed: _({}, e, {
191
+ value: ye
192
+ }),
193
+ groupEnd: _({}, e, {
194
+ value: ge
195
+ })
196
+ });
197
+ }
198
+ $ < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
199
+ }
200
+ }
201
+ var re = P.ReactCurrentDispatcher, te;
202
+ function q(e, r, t) {
203
+ {
204
+ if (te === void 0)
205
+ try {
206
+ throw Error();
207
+ } catch (i) {
208
+ var n = i.stack.trim().match(/\n( *(at )?)/);
209
+ te = n && n[1] || "";
210
+ }
211
+ return `
212
+ ` + te + e;
213
+ }
214
+ }
215
+ var ne = !1, z;
216
+ {
217
+ var Ne = typeof WeakMap == "function" ? WeakMap : Map;
218
+ z = new Ne();
219
+ }
220
+ function _e(e, r) {
221
+ if (!e || ne)
222
+ return "";
223
+ {
224
+ var t = z.get(e);
225
+ if (t !== void 0)
226
+ return t;
227
+ }
228
+ var n;
229
+ ne = !0;
230
+ var i = Error.prepareStackTrace;
231
+ Error.prepareStackTrace = void 0;
232
+ var s;
233
+ s = re.current, re.current = null, $e();
234
+ try {
235
+ if (r) {
236
+ var o = function() {
237
+ throw Error();
238
+ };
239
+ if (Object.defineProperty(o.prototype, "props", {
240
+ set: function() {
241
+ throw Error();
242
+ }
243
+ }), typeof Reflect == "object" && Reflect.construct) {
244
+ try {
245
+ Reflect.construct(o, []);
246
+ } catch (j) {
247
+ n = j;
248
+ }
249
+ Reflect.construct(e, [], o);
250
+ } else {
251
+ try {
252
+ o.call();
253
+ } catch (j) {
254
+ n = j;
255
+ }
256
+ e.call(o.prototype);
257
+ }
258
+ } else {
259
+ try {
260
+ throw Error();
261
+ } catch (j) {
262
+ n = j;
263
+ }
264
+ e();
265
+ }
266
+ } catch (j) {
267
+ if (j && n && typeof j.stack == "string") {
268
+ for (var a = j.stack.split(`
269
+ `), y = n.stack.split(`
270
+ `), l = a.length - 1, f = y.length - 1; l >= 1 && f >= 0 && a[l] !== y[f]; )
271
+ f--;
272
+ for (; l >= 1 && f >= 0; l--, f--)
273
+ if (a[l] !== y[f]) {
274
+ if (l !== 1 || f !== 1)
275
+ do
276
+ if (l--, f--, f < 0 || a[l] !== y[f]) {
277
+ var b = `
278
+ ` + a[l].replace(" at new ", " at ");
279
+ return e.displayName && b.includes("<anonymous>") && (b = b.replace("<anonymous>", e.displayName)), typeof e == "function" && z.set(e, b), b;
280
+ }
281
+ while (l >= 1 && f >= 0);
282
+ break;
283
+ }
284
+ }
285
+ } finally {
286
+ ne = !1, re.current = s, Le(), Error.prepareStackTrace = i;
287
+ }
288
+ var I = e ? e.displayName || e.name : "", De = I ? q(I) : "";
289
+ return typeof e == "function" && z.set(e, De), De;
290
+ }
291
+ function We(e, r, t) {
292
+ return _e(e, !1);
293
+ }
294
+ function Ye(e) {
295
+ var r = e.prototype;
296
+ return !!(r && r.isReactComponent);
297
+ }
298
+ function J(e, r, t) {
299
+ if (e == null)
300
+ return "";
301
+ if (typeof e == "function")
302
+ return _e(e, Ye(e));
303
+ if (typeof e == "string")
304
+ return q(e);
305
+ switch (e) {
306
+ case S:
307
+ return q("Suspense");
308
+ case m:
309
+ return q("SuspenseList");
310
+ }
311
+ if (typeof e == "object")
312
+ switch (e.$$typeof) {
313
+ case v:
314
+ return We(e.render);
315
+ case E:
316
+ return J(e.type, r, t);
317
+ case x: {
318
+ var n = e, i = n._payload, s = n._init;
319
+ try {
320
+ return J(s(i), r, t);
321
+ } catch {
322
+ }
323
+ }
324
+ }
325
+ return "";
326
+ }
327
+ var G = Object.prototype.hasOwnProperty, be = {}, Ee = P.ReactDebugCurrentFrame;
328
+ function K(e) {
329
+ if (e) {
330
+ var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
331
+ Ee.setExtraStackFrame(t);
332
+ } else
333
+ Ee.setExtraStackFrame(null);
334
+ }
335
+ function Ve(e, r, t, n, i) {
336
+ {
337
+ var s = Function.call.bind(G);
338
+ for (var o in e)
339
+ if (s(e, o)) {
340
+ var a = void 0;
341
+ try {
342
+ if (typeof e[o] != "function") {
343
+ var y = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
+ throw y.name = "Invariant Violation", y;
345
+ }
346
+ a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
+ } catch (l) {
348
+ a = l;
349
+ }
350
+ a && !(a instanceof Error) && (K(i), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), K(null)), a instanceof Error && !(a.message in be) && (be[a.message] = !0, K(i), p("Failed %s type: %s", t, a.message), K(null));
351
+ }
352
+ }
353
+ }
354
+ var Be = Array.isArray;
355
+ function ae(e) {
356
+ return Be(e);
357
+ }
358
+ function Ue(e) {
359
+ {
360
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
361
+ return t;
362
+ }
363
+ }
364
+ function qe(e) {
365
+ try {
366
+ return Re(e), !1;
367
+ } catch {
368
+ return !0;
369
+ }
370
+ }
371
+ function Re(e) {
372
+ return "" + e;
373
+ }
374
+ function Te(e) {
375
+ if (qe(e))
376
+ return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ue(e)), Re(e);
377
+ }
378
+ var L = P.ReactCurrentOwner, ze = {
379
+ key: !0,
380
+ ref: !0,
381
+ __self: !0,
382
+ __source: !0
383
+ }, Ce, we, oe;
384
+ oe = {};
385
+ function Je(e) {
386
+ if (G.call(e, "ref")) {
387
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
388
+ if (r && r.isReactWarning)
389
+ return !1;
390
+ }
391
+ return e.ref !== void 0;
392
+ }
393
+ function Ge(e) {
394
+ if (G.call(e, "key")) {
395
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
396
+ if (r && r.isReactWarning)
397
+ return !1;
398
+ }
399
+ return e.key !== void 0;
400
+ }
401
+ function Ke(e, r) {
402
+ if (typeof e.ref == "string" && L.current && r && L.current.stateNode !== r) {
403
+ var t = d(L.current.type);
404
+ oe[t] || (p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', d(L.current.type), e.ref), oe[t] = !0);
405
+ }
406
+ }
407
+ function He(e, r) {
408
+ {
409
+ var t = function() {
410
+ Ce || (Ce = !0, p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
411
+ };
412
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
413
+ get: t,
414
+ configurable: !0
415
+ });
416
+ }
417
+ }
418
+ function Xe(e, r) {
419
+ {
420
+ var t = function() {
421
+ we || (we = !0, p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
422
+ };
423
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
424
+ get: t,
425
+ configurable: !0
426
+ });
427
+ }
428
+ }
429
+ var Ze = function(e, r, t, n, i, s, o) {
430
+ var a = {
431
+ // This tag allows us to uniquely identify this as a React Element
432
+ $$typeof: C,
433
+ // Built-in properties that belong on the element
434
+ type: e,
435
+ key: r,
436
+ ref: t,
437
+ props: o,
438
+ // Record the component responsible for creating this element.
439
+ _owner: s
440
+ };
441
+ return a._store = {}, Object.defineProperty(a._store, "validated", {
442
+ configurable: !1,
443
+ enumerable: !1,
444
+ writable: !0,
445
+ value: !1
446
+ }), Object.defineProperty(a, "_self", {
447
+ configurable: !1,
448
+ enumerable: !1,
449
+ writable: !1,
450
+ value: n
451
+ }), Object.defineProperty(a, "_source", {
452
+ configurable: !1,
453
+ enumerable: !1,
454
+ writable: !1,
455
+ value: i
456
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
457
+ };
458
+ function Qe(e, r, t, n, i) {
459
+ {
460
+ var s, o = {}, a = null, y = null;
461
+ t !== void 0 && (Te(t), a = "" + t), Ge(r) && (Te(r.key), a = "" + r.key), Je(r) && (y = r.ref, Ke(r, i));
462
+ for (s in r)
463
+ G.call(r, s) && !ze.hasOwnProperty(s) && (o[s] = r[s]);
464
+ if (e && e.defaultProps) {
465
+ var l = e.defaultProps;
466
+ for (s in l)
467
+ o[s] === void 0 && (o[s] = l[s]);
468
+ }
469
+ if (a || y) {
470
+ var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
471
+ a && He(o, f), y && Xe(o, f);
472
+ }
473
+ return Ze(e, a, y, i, n, L.current, o);
474
+ }
475
+ }
476
+ var ie = P.ReactCurrentOwner, Pe = P.ReactDebugCurrentFrame;
477
+ function A(e) {
478
+ if (e) {
479
+ var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
480
+ Pe.setExtraStackFrame(t);
481
+ } else
482
+ Pe.setExtraStackFrame(null);
483
+ }
484
+ var se;
485
+ se = !1;
486
+ function ue(e) {
487
+ return typeof e == "object" && e !== null && e.$$typeof === C;
488
+ }
489
+ function Oe() {
490
+ {
491
+ if (ie.current) {
492
+ var e = d(ie.current.type);
493
+ if (e)
494
+ return `
495
+
496
+ Check the render method of \`` + e + "`.";
497
+ }
498
+ return "";
499
+ }
500
+ }
501
+ function er(e) {
502
+ {
503
+ if (e !== void 0) {
504
+ var r = e.fileName.replace(/^.*[\\\/]/, ""), t = e.lineNumber;
505
+ return `
506
+
507
+ Check your code at ` + r + ":" + t + ".";
508
+ }
509
+ return "";
510
+ }
511
+ }
512
+ var Se = {};
513
+ function rr(e) {
514
+ {
515
+ var r = Oe();
516
+ if (!r) {
517
+ var t = typeof e == "string" ? e : e.displayName || e.name;
518
+ t && (r = `
519
+
520
+ Check the top-level render call using <` + t + ">.");
521
+ }
522
+ return r;
523
+ }
524
+ }
525
+ function xe(e, r) {
526
+ {
527
+ if (!e._store || e._store.validated || e.key != null)
528
+ return;
529
+ e._store.validated = !0;
530
+ var t = rr(r);
531
+ if (Se[t])
532
+ return;
533
+ Se[t] = !0;
534
+ var n = "";
535
+ e && e._owner && e._owner !== ie.current && (n = " It was passed a child from " + d(e._owner.type) + "."), A(e), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), A(null);
536
+ }
537
+ }
538
+ function je(e, r) {
539
+ {
540
+ if (typeof e != "object")
541
+ return;
542
+ if (ae(e))
543
+ for (var t = 0; t < e.length; t++) {
544
+ var n = e[t];
545
+ ue(n) && xe(n, r);
546
+ }
547
+ else if (ue(e))
548
+ e._store && (e._store.validated = !0);
549
+ else if (e) {
550
+ var i = H(e);
551
+ if (typeof i == "function" && i !== e.entries)
552
+ for (var s = i.call(e), o; !(o = s.next()).done; )
553
+ ue(o.value) && xe(o.value, r);
554
+ }
555
+ }
556
+ }
557
+ function tr(e) {
558
+ {
559
+ var r = e.type;
560
+ if (r == null || typeof r == "string")
561
+ return;
562
+ var t;
563
+ if (typeof r == "function")
564
+ t = r.propTypes;
565
+ else if (typeof r == "object" && (r.$$typeof === v || // Note: Memo only checks outer props here.
566
+ // Inner props are checked in the reconciler.
567
+ r.$$typeof === E))
568
+ t = r.propTypes;
569
+ else
570
+ return;
571
+ if (t) {
572
+ var n = d(r);
573
+ Ve(t, e.props, "prop", n, e);
574
+ } else if (r.PropTypes !== void 0 && !se) {
575
+ se = !0;
576
+ var i = d(r);
577
+ p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
578
+ }
579
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
580
+ }
581
+ }
582
+ function nr(e) {
583
+ {
584
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
585
+ var n = r[t];
586
+ if (n !== "children" && n !== "key") {
587
+ A(e), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), A(null);
588
+ break;
589
+ }
590
+ }
591
+ e.ref !== null && (A(e), p("Invalid attribute `ref` supplied to `React.Fragment`."), A(null));
592
+ }
593
+ }
594
+ function ke(e, r, t, n, i, s) {
595
+ {
596
+ var o = U(e);
597
+ if (!o) {
598
+ var a = "";
599
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
600
+ var y = er(i);
601
+ y ? a += y : a += Oe();
602
+ var l;
603
+ e === null ? l = "null" : ae(e) ? l = "array" : e !== void 0 && e.$$typeof === C ? (l = "<" + (d(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a);
604
+ }
605
+ var f = Qe(e, r, t, i, s);
606
+ if (f == null)
607
+ return f;
608
+ if (o) {
609
+ var b = r.children;
610
+ if (b !== void 0)
611
+ if (n)
612
+ if (ae(b)) {
613
+ for (var I = 0; I < b.length; I++)
614
+ je(b[I], e);
615
+ Object.freeze && Object.freeze(b);
616
+ } else
617
+ p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
618
+ else
619
+ je(b, e);
620
+ }
621
+ return e === w ? nr(f) : tr(f), f;
622
+ }
623
+ }
624
+ function ar(e, r, t) {
625
+ return ke(e, r, t, !0);
626
+ }
627
+ function or(e, r, t) {
628
+ return ke(e, r, t, !1);
629
+ }
630
+ var ir = or, sr = ar;
631
+ W.Fragment = w, W.jsx = ir, W.jsxs = sr;
632
+ }()), W;
633
+ }
634
+ (function(c) {
635
+ process.env.NODE_ENV === "production" ? c.exports = mr() : c.exports = yr();
636
+ })(pr);
637
+ const gr = le.jsx;
638
+ const hr = "_map_an20y_2", _r = "_touch_an20y_26", br = "_floaten_an20y_45", Er = "_float_an20y_45", Rr = {
639
+ map: hr,
640
+ "map-popup-container": "_map-popup-container_an20y_7",
641
+ touch: _r,
642
+ "mobile-layers-button": "_mobile-layers-button_an20y_30",
643
+ floaten: br,
644
+ float: Er
645
+ }, Me = (c) => c ? c instanceof Object ? [c.longitude, c.latitude] : c : void 0, Tr = async () => {
646
+ try {
647
+ const C = await new Promise(
648
+ (D, w) => {
649
+ navigator.geolocation.getCurrentPosition(
650
+ (g) => {
651
+ D(g);
652
+ },
653
+ (g) => w(g)
654
+ );
655
+ }
656
+ );
657
+ return C && Me(C.coords) || Object.values(Cr());
658
+ } catch (c) {
659
+ return console.error(c), {};
660
+ }
661
+ }, Cr = () => ({
662
+ longitude: 59.5870851,
663
+ latitude: 36.311559
664
+ }), wr = {
665
+ reverse: "https://api.neshan.org/v4/reverse",
666
+ search: "https://api.neshan.org/v1/search",
667
+ map: "https://static.neshan.org/sdk/openlayers/7.1.0/ol.js"
668
+ }, Pr = ur({
669
+ map: null,
670
+ mapType: "neshan",
671
+ mapContainer: null,
672
+ setMap: (c) => {
673
+ },
674
+ setMapType: (c) => {
675
+ },
676
+ setMapContainer: (c) => {
677
+ }
678
+ }), Sr = cr(
679
+ ({
680
+ options: c,
681
+ mapKey: C,
682
+ serviceKey: D = "",
683
+ zoom: w = 12,
684
+ defaultType: g = "neshan",
685
+ scale: F,
686
+ center: k,
687
+ poi: O = !0,
688
+ traffic: v = !0,
689
+ onInit: S,
690
+ className: m,
691
+ style: E
692
+ }, x) => {
693
+ const R = lr(Pr), T = fr(null), [Y, H] = ce(!1), [P, p] = ce(null), [M, X] = ce();
694
+ dr(
695
+ x,
696
+ () => ({
697
+ get mapContainer() {
698
+ return T;
699
+ },
700
+ get ol() {
701
+ return typeof ol < "u" ? ol : void 0;
702
+ },
703
+ get map() {
704
+ return R.map;
705
+ },
706
+ get isInitiated() {
707
+ return Y;
708
+ }
709
+ }),
710
+ [T, R.map, Y]
711
+ );
712
+ const V = () => {
713
+ var h, d;
714
+ if (P)
715
+ return P;
716
+ const u = (d = (h = T.current) == null ? void 0 : h.querySelector(".ol-viewport")) == null ? void 0 : d.querySelectorAll("div:last-child");
717
+ if (u)
718
+ return p(
719
+ Array.from(u)[u.length - 1]
720
+ ), P;
721
+ }, Z = () => {
722
+ const u = V();
723
+ u == null || u.style.setProperty("scale", "" + F);
724
+ }, Q = () => {
725
+ const u = V();
726
+ u == null || u.style.setProperty("bottom", "0.2em"), u == null || u.style.setProperty("left", "0.4em");
727
+ }, ee = (u, h = "my-openlayer") => {
728
+ const d = document.getElementById(h);
729
+ if (d)
730
+ return d;
731
+ const _ = document.createElement("script");
732
+ return _.src = u, _.id = h, document.getElementsByTagName("head")[0].appendChild(_), _;
733
+ }, B = async () => {
734
+ var d;
735
+ if (!T.current)
736
+ return;
737
+ const u = M || await Tr(), h = new ol.Map({
738
+ target: T.current,
739
+ key: C || "",
740
+ mapType: g,
741
+ // poi: store.state.poiLayer,
742
+ poi: O,
743
+ // traffic: store.state.trafficLayer,
744
+ traffic: v,
745
+ view: new ol.View({
746
+ // @ts-ignore
747
+ center: ol.proj.fromLonLat(u),
748
+ zoom: w,
749
+ smoothExtentConstraint: !0
750
+ // projection: 'EPSG:4326' //Default was EPSG:3857
751
+ }),
752
+ controls: [],
753
+ ...c
754
+ });
755
+ h.setMapType(g), R.setMap(h), (d = R.map) == null || d.setMapType(g), R.setMapType(g), H(!0), S && S(ol, h);
756
+ }, U = async () => {
757
+ await B();
758
+ };
759
+ return vr(() => {
760
+ if (T.current && R.setMapContainer(T.current), M)
761
+ typeof ol < "u" ? U() : ee(wr.map).addEventListener("load", () => {
762
+ U();
763
+ }), Z(), Q();
764
+ else {
765
+ const u = Me(k);
766
+ X((h) => u);
767
+ }
768
+ }, [M]), /* @__PURE__ */ gr(
769
+ "div",
770
+ {
771
+ ref: T,
772
+ className: m || Rr.map,
773
+ style: E
774
+ }
775
+ );
776
+ }
777
+ );
778
+ export {
779
+ Sr as NeshanMap
780
+ };
@@ -0,0 +1,27 @@
1
+ (function(D,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(D=typeof globalThis<"u"?globalThis:D||self,m(D.ReactNeshanMapOpenlayers={},D.React))})(this,function(D,m){"use strict";var q={},Ne={get exports(){return q},set exports(c){q=c}},L={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var de;function Le(){if(de)return L;de=1;var c=m,w=Symbol.for("react.element"),A=Symbol.for("react.fragment"),S=Object.prototype.hasOwnProperty,g=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,I={key:!0,ref:!0,__self:!0,__source:!0};function F(P,p,x){var y,R={},j=null,T=null;x!==void 0&&(j=""+x),p.key!==void 0&&(j=""+p.key),p.ref!==void 0&&(T=p.ref);for(y in p)S.call(p,y)&&!I.hasOwnProperty(y)&&(R[y]=p[y]);if(P&&P.defaultProps)for(y in p=P.defaultProps,p)R[y]===void 0&&(R[y]=p[y]);return{$$typeof:w,type:P,key:j,ref:T,props:R,_owner:g.current}}return L.Fragment=A,L.jsx=F,L.jsxs=F,L}var W={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var pe;function We(){return pe||(pe=1,process.env.NODE_ENV!=="production"&&function(){var c=m,w=Symbol.for("react.element"),A=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),P=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),C=Symbol.iterator,U="@@iterator";function Q(e){if(e===null||typeof e!="object")return null;var r=C&&e[C]||e[U];return typeof r=="function"?r:null}var O=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Y("error",e,t)}}function Y(e,r,t){{var n=O.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var ee=!1,z=!1,re=!1,te=!1,ne=!1,J;J=Symbol.for("react.module.reference");function G(e){return!!(typeof e=="string"||typeof e=="function"||e===S||e===I||ne||e===g||e===x||e===y||te||e===T||ee||z||re||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===R||e.$$typeof===F||e.$$typeof===P||e.$$typeof===p||e.$$typeof===J||e.getModuleId!==void 0))}function u(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function _(e){return e.displayName||"Context"}function d(e){if(e==null)return null;if(typeof e.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case A:return"Portal";case I:return"Profiler";case g:return"StrictMode";case x:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case P:var r=e;return _(r)+".Consumer";case F:var t=e;return _(t._context)+".Provider";case p:return u(e,e.render,"ForwardRef");case R:var n=e.displayName||null;return n!==null?n:d(e.type)||"Memo";case j:{var i=e,s=i._payload,o=i._init;try{return d(o(s))}catch{return null}}}return null}var b=Object.assign,V=0,me,ye,he,ge,_e,be,Ee;function Re(){}Re.__reactDisabledLog=!0;function Ke(){{if(V===0){me=console.log,ye=console.info,he=console.warn,ge=console.error,_e=console.group,be=console.groupCollapsed,Ee=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Re,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function He(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:b({},e,{value:me}),info:b({},e,{value:ye}),warn:b({},e,{value:he}),error:b({},e,{value:ge}),group:b({},e,{value:_e}),groupCollapsed:b({},e,{value:be}),groupEnd:b({},e,{value:Ee})})}V<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=O.ReactCurrentDispatcher,oe;function K(e,r,t){{if(oe===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);oe=n&&n[1]||""}return`
18
+ `+oe+e}}var ie=!1,H;{var Xe=typeof WeakMap=="function"?WeakMap:Map;H=new Xe}function Te(e,r){if(!e||ie)return"";{var t=H.get(e);if(t!==void 0)return t}var n;ie=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=ae.current,ae.current=null,Ke();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(k){n=k}Reflect.construct(e,[],o)}else{try{o.call()}catch(k){n=k}e.call(o.prototype)}}else{try{throw Error()}catch(k){n=k}e()}}catch(k){if(k&&n&&typeof k.stack=="string"){for(var a=k.stack.split(`
19
+ `),h=n.stack.split(`
20
+ `),l=a.length-1,f=h.length-1;l>=1&&f>=0&&a[l]!==h[f];)f--;for(;l>=1&&f>=0;l--,f--)if(a[l]!==h[f]){if(l!==1||f!==1)do if(l--,f--,f<0||a[l]!==h[f]){var E=`
21
+ `+a[l].replace(" at new "," at ");return e.displayName&&E.includes("<anonymous>")&&(E=E.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,E),E}while(l>=1&&f>=0);break}}}finally{ie=!1,ae.current=s,He(),Error.prepareStackTrace=i}var N=e?e.displayName||e.name:"",Me=N?K(N):"";return typeof e=="function"&&H.set(e,Me),Me}function $e(e,r,t){return Te(e,!1)}function Ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function X(e,r,t){if(e==null)return"";if(typeof e=="function")return Te(e,Ze(e));if(typeof e=="string")return K(e);switch(e){case x:return K("Suspense");case y:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return $e(e.render);case R:return X(e.type,r,t);case j:{var n=e,i=n._payload,s=n._init;try{return X(s(i),r,t)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,Ce={},we=O.ReactDebugCurrentFrame;function Z(e){if(e){var r=e._owner,t=X(e.type,e._source,r?r.type:null);we.setExtraStackFrame(t)}else we.setExtraStackFrame(null)}function qe(e,r,t,n,i){{var s=Function.call.bind($);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var h=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&(Z(i),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),Z(null)),a instanceof Error&&!(a.message in Ce)&&(Ce[a.message]=!0,Z(i),v("Failed %s type: %s",t,a.message),Z(null))}}}var Qe=Array.isArray;function se(e){return Qe(e)}function er(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function rr(e){try{return Se(e),!1}catch{return!0}}function Se(e){return""+e}function Oe(e){if(rr(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",er(e)),Se(e)}var B=O.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},Pe,xe,ue;ue={};function nr(e){if($.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ar(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function or(e,r){if(typeof e.ref=="string"&&B.current&&r&&B.current.stateNode!==r){var t=d(B.current.type);ue[t]||(v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',d(B.current.type),e.ref),ue[t]=!0)}}function ir(e,r){{var t=function(){Pe||(Pe=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function sr(e,r){{var t=function(){xe||(xe=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ur=function(e,r,t,n,i,s,o){var a={$$typeof:w,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function cr(e,r,t,n,i){{var s,o={},a=null,h=null;t!==void 0&&(Oe(t),a=""+t),ar(r)&&(Oe(r.key),a=""+r.key),nr(r)&&(h=r.ref,or(r,i));for(s in r)$.call(r,s)&&!tr.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)o[s]===void 0&&(o[s]=l[s])}if(a||h){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ir(o,f),h&&sr(o,f)}return ur(e,a,h,i,n,B.current,o)}}var ce=O.ReactCurrentOwner,je=O.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,t=X(e.type,e._source,r?r.type:null);je.setExtraStackFrame(t)}else je.setExtraStackFrame(null)}var le;le=!1;function fe(e){return typeof e=="object"&&e!==null&&e.$$typeof===w}function ke(){{if(ce.current){var e=d(ce.current.type);if(e)return`
22
+
23
+ Check the render method of \``+e+"`."}return""}}function lr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
24
+
25
+ Check your code at `+r+":"+t+"."}return""}}var De={};function fr(e){{var r=ke();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
26
+
27
+ Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=fr(r);if(De[t])return;De[t]=!0;var n="";e&&e._owner&&e._owner!==ce.current&&(n=" It was passed a child from "+d(e._owner.type)+"."),M(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),M(null)}}function Ae(e,r){{if(typeof e!="object")return;if(se(e))for(var t=0;t<e.length;t++){var n=e[t];fe(n)&&Fe(n,r)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var i=Q(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)fe(o.value)&&Fe(o.value,r)}}}function dr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===p||r.$$typeof===R))t=r.propTypes;else return;if(t){var n=d(r);qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!le){le=!0;var i=d(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){M(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),M(null);break}}e.ref!==null&&(M(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}function Ie(e,r,t,n,i,s){{var o=G(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var h=lr(i);h?a+=h:a+=ke();var l;e===null?l="null":se(e)?l="array":e!==void 0&&e.$$typeof===w?(l="<"+(d(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var f=cr(e,r,t,i,s);if(f==null)return f;if(o){var E=r.children;if(E!==void 0)if(n)if(se(E)){for(var N=0;N<E.length;N++)Ae(E[N],e);Object.freeze&&Object.freeze(E)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ae(E,e)}return e===S?pr(f):dr(f),f}}function vr(e,r,t){return Ie(e,r,t,!0)}function mr(e,r,t){return Ie(e,r,t,!1)}var yr=mr,hr=vr;W.Fragment=S,W.jsx=yr,W.jsxs=hr}()),W}(function(c){process.env.NODE_ENV==="production"?c.exports=Le():c.exports=We()})(Ne);const Ye=q.jsx,gr="",Ve={map:"_map_an20y_2","map-popup-container":"_map-popup-container_an20y_7",touch:"_touch_an20y_26","mobile-layers-button":"_mobile-layers-button_an20y_30",floaten:"_floaten_an20y_45",float:"_float_an20y_45"},ve=c=>c?c instanceof Object?[c.longitude,c.latitude]:c:void 0,Be=async()=>{try{const w=await new Promise((A,S)=>{navigator.geolocation.getCurrentPosition(g=>{A(g)},g=>S(g))});return w&&ve(w.coords)||Object.values(Ue())}catch(c){return console.error(c),{}}},Ue=()=>({longitude:59.5870851,latitude:36.311559}),ze={reverse:"https://api.neshan.org/v4/reverse",search:"https://api.neshan.org/v1/search",map:"https://static.neshan.org/sdk/openlayers/7.1.0/ol.js"},Je=m.createContext({map:null,mapType:"neshan",mapContainer:null,setMap:c=>{},setMapType:c=>{},setMapContainer:c=>{}}),Ge=m.forwardRef(({options:c,mapKey:w,serviceKey:A="",zoom:S=12,defaultType:g="neshan",scale:I,center:F,poi:P=!0,traffic:p=!0,onInit:x,className:y,style:R},j)=>{const T=m.useContext(Je),C=m.useRef(null),[U,Q]=m.useState(!1),[O,v]=m.useState(null),[Y,ee]=m.useState();m.useImperativeHandle(j,()=>({get mapContainer(){return C},get ol(){return typeof ol<"u"?ol:void 0},get map(){return T.map},get isInitiated(){return U}}),[C,T.map,U]);const z=()=>{var _,d;if(O)return O;const u=(d=(_=C.current)==null?void 0:_.querySelector(".ol-viewport"))==null?void 0:d.querySelectorAll("div:last-child");if(u)return v(Array.from(u)[u.length-1]),O},re=()=>{const u=z();u==null||u.style.setProperty("scale",""+I)},te=()=>{const u=z();u==null||u.style.setProperty("bottom","0.2em"),u==null||u.style.setProperty("left","0.4em")},ne=(u,_="my-openlayer")=>{const d=document.getElementById(_);if(d)return d;const b=document.createElement("script");return b.src=u,b.id=_,document.getElementsByTagName("head")[0].appendChild(b),b},J=async()=>{var d;if(!C.current)return;const u=Y||await Be(),_=new ol.Map({target:C.current,key:w||"",mapType:g,poi:P,traffic:p,view:new ol.View({center:ol.proj.fromLonLat(u),zoom:S,smoothExtentConstraint:!0}),controls:[],...c});_.setMapType(g),T.setMap(_),(d=T.map)==null||d.setMapType(g),T.setMapType(g),Q(!0),x&&x(ol,_)},G=async()=>{await J()};return m.useEffect(()=>{if(C.current&&T.setMapContainer(C.current),Y)typeof ol<"u"?G():ne(ze.map).addEventListener("load",()=>{G()}),re(),te();else{const u=ve(F);ee(_=>u)}},[Y]),Ye("div",{ref:C,className:y||Ve.map,style:R})});D.NeshanMap=Ge,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ @import"https://static.neshan.org/sdk/openlayers/7.1.0/ol.css";:root{--sm: .25em;--md: .5em;--lg: 1em;--text-xl: 1.3em;--text-lg: 1.05em;--text-nm: 1em;--text-sm: .85em;--text-xs: .8em;--text-xxs: .75em;--primary: #03a9f4}.pos-relative{position:relative}.pos-absolute{position:absolute}.pos-sticky{position:sticky}.d-block{display:block}.d-flex{display:flex}.flex-column{flex-flow:column}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-around{justify-content:space-around}.align-center{align-items:center}.text-center{text-align:center}.text-xl{font-size:var(--text-xl)}.text-lg{font-size:var(--text-lg)}.text-nm{font-size:var(--text-nm)}.text-sm{font-size:var(--text-sm)}.text-xs{font-size:var(--text-xs)}.text-xxs{font-size:var(--text-xxs)}.text-caption{font-size:var(--text-sm);color:gray}.mx-auto{margin-left:auto;margin-right:auto}.px-1{padding-left:var(--md);padding-right:var(--md)}.px-2{padding-left:var(--lg);padding-right:var(--lg)}.mt-1{margin-top:var(--sm)}.mt-2{margin-top:var(--md)}.mx-1{margin-left:var(--md);margin-right:var(--md)}.mx-2{margin-left:var(--lg);margin-right:var(--lg)}.my-2{margin-top:var(--md);margin-bottom:var(--md)}.box-shadow{box-shadow:0 2px 4px 1px #a8a8a8}.o-auto{overflow:auto}.o-hidden{overflow:hidden}.pointer{cursor:pointer}.select-none{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mamad .asghar{position:relative}._map_an20y_2{height:100%;direction:rtl}._map-popup-container_an20y_7{background-color:#fff;-webkit-box-shadow:0px 0px 4px 2px rgba(0,0,0,.5529411765);box-shadow:0 0 4px 2px #00000046;border-radius:5px;padding:2px 5px;font-size:var(--text-sm)}._map-popup-container_an20y_7:after{content:" ";position:absolute;top:100%;left:50%;margin-left:-10px;border-width:10px;border-style:solid;border-color:rgb(255,255,255) transparent transparent transparent}._touch_an20y_26 ._map-popup-container_an20y_7{font-size:var(--text-xs)}._mobile-layers-button_an20y_30{top:20%;right:10%;z-index:2;background:rgba(255,255,255,.701);border:none;border-radius:50%;height:2.3em;width:2.3em;padding:.25em;box-shadow:0 3px 10px #0003}._mobile-layers-button_an20y_30 img{width:100%}._mobile-layers-button_an20y_30._floaten_an20y_45{animation-name:_float_an20y_45;animation-duration:.35s;animation-iteration-count:1}@keyframes _float_an20y_45{0%,to{transform:translateY(0)}50%{transform:translateY(5px)}}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare function App(): JSX.Element;
3
+ export default App;
@@ -0,0 +1,3 @@
1
+ export declare interface Props {
2
+ children: any;
3
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import "../assets/main.scss";
3
+ import { MapProps, NeshanMapRef } from "./Map.model";
4
+ export declare const NeshanMap: import("react").ForwardRefExoticComponent<MapProps & import("react").RefAttributes<NeshanMapRef>>;
@@ -0,0 +1,85 @@
1
+ import mainOl, { Map } from "ol";
2
+ import { MapOptions as MainMapOptions } from "ol/PluggableMap";
3
+ import React from "react";
4
+ export interface BaseMapOptions extends MainMapOptions {
5
+ mapType?: MapType;
6
+ poi?: boolean;
7
+ traffic?: boolean;
8
+ }
9
+ interface MapOptionsWithKey extends BaseMapOptions {
10
+ key: string;
11
+ }
12
+ type MapOptionsUnion = {
13
+ options?: BaseMapOptions;
14
+ mapKey: string;
15
+ } | {
16
+ options: MapOptionsWithKey;
17
+ mapKey?: undefined;
18
+ };
19
+ export interface BaseMapProps {
20
+ serviceKey?: string;
21
+ zoom?: number;
22
+ center?: CoordsObj;
23
+ scale?: number;
24
+ defaultType?: MapType;
25
+ poi?: boolean;
26
+ traffic?: boolean;
27
+ onInit?: (ol: typeof mainOl, map: OlMap) => {};
28
+ className?: React.HTMLAttributes<HTMLDivElement>["className"];
29
+ style?: React.HtmlHTMLAttributes<HTMLDivElement>["style"];
30
+ }
31
+ export type MapProps = BaseMapProps & MapOptionsUnion;
32
+ export interface NeshanMapRef {
33
+ mapContainer: React.RefObject<HTMLDivElement>;
34
+ ol?: Ol;
35
+ map: OlMap | null;
36
+ isInitiated: boolean;
37
+ }
38
+ export declare interface CoordsObj {
39
+ latitude: number;
40
+ longitude: number;
41
+ }
42
+ export declare class OlMap extends Map {
43
+ constructor(options: MapOptionsWithKey);
44
+ setMapType(value: MapType): void;
45
+ switchPoiLayer(value: boolean): void;
46
+ switchTrafficLayer(value: boolean): void;
47
+ }
48
+ declare const customizedOl: {
49
+ Map: typeof OlMap;
50
+ AssertionError: typeof mainOl.AssertionError;
51
+ Collection: typeof mainOl.Collection;
52
+ Disposable: typeof mainOl.Disposable;
53
+ Feature: typeof mainOl.Feature;
54
+ Geolocation: typeof mainOl.Geolocation;
55
+ Graticule: typeof mainOl.Graticule;
56
+ Image: typeof mainOl.Image;
57
+ ImageBase: typeof mainOl.ImageBase;
58
+ ImageCanvas: typeof mainOl.ImageCanvas;
59
+ ImageTile: typeof mainOl.ImageTile;
60
+ Kinetic: typeof mainOl.Kinetic;
61
+ MapBrowserEvent: typeof mainOl.MapBrowserEvent;
62
+ MapBrowserEventHandler: typeof mainOl.MapBrowserEventHandler;
63
+ MapEvent: typeof mainOl.MapEvent;
64
+ Object: typeof mainOl.Object;
65
+ Observable: typeof mainOl.Observable;
66
+ Overlay: typeof mainOl.Overlay;
67
+ PluggableMap: typeof mainOl.PluggableMap;
68
+ Tile: typeof mainOl.Tile;
69
+ TileCache: typeof mainOl.TileCache;
70
+ TileQueue: typeof mainOl.TileQueue;
71
+ TileRange: typeof mainOl.TileRange;
72
+ VectorRenderTile: typeof mainOl.VectorRenderTile;
73
+ VectorTile: typeof mainOl.VectorTile;
74
+ View: typeof mainOl.View;
75
+ getUid: typeof mainOl.getUid;
76
+ VERSION: string;
77
+ };
78
+ export declare type Ol = typeof customizedOl;
79
+ export declare type MapType = "neshan" | "dreamy" | "dreamy-gold" | "standard-night" | "standard-day" | "osm-bright";
80
+ export declare type ViewType = undefined | "desktop" | "mobile";
81
+ export declare interface Tile {
82
+ title: MapType;
83
+ url: string;
84
+ }
85
+ export {};
@@ -0,0 +1,2 @@
1
+ export { NeshanMap } from "./Map";
2
+ export type { NeshanMapRef } from "./Map.model";
@@ -0,0 +1 @@
1
+ import "./index.css";
@@ -0,0 +1,47 @@
1
+ import { Tile } from "../components/Map.model";
2
+ export declare const urls: {
3
+ reverse: string;
4
+ search: string;
5
+ map: string;
6
+ };
7
+ export declare const markerUrls: {
8
+ main: string;
9
+ search: string;
10
+ colorSvg: string;
11
+ greySvg: string;
12
+ preview256: string;
13
+ searchPrev: string;
14
+ };
15
+ export declare const tiles: Tile[];
16
+ export declare const breakpointsSegments: {
17
+ xs: boolean;
18
+ sm: boolean;
19
+ md: boolean;
20
+ lg: boolean;
21
+ xl: boolean;
22
+ };
23
+ export declare const breakpointsSegmentsPixels: {
24
+ xs: number;
25
+ sm: number;
26
+ md: number;
27
+ lg: number;
28
+ xl: number;
29
+ };
30
+ export declare const drawerConstants: {
31
+ width: string;
32
+ bottomSheetNormalHeight: string;
33
+ bottomSheetloadingHeight: string;
34
+ bottomSheetBorderRadius: string;
35
+ };
36
+ export declare const unsetMapDimnensions: {
37
+ width: string;
38
+ height: string;
39
+ };
40
+ export declare const zoomConstants: {
41
+ initialZoom: number;
42
+ maxZoom: number;
43
+ };
44
+ export declare const markersOffset: {
45
+ high: number[];
46
+ short: number[];
47
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { Props } from "../App.model";
3
+ export declare const ContextProvider: (props: Props) => JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { MapType, OlMap } from "../components/Map.model";
2
+ export declare type Actions = {
3
+ type: "SET_MAP";
4
+ payload: OlMap;
5
+ } | {
6
+ type: "SET_MAP_TYPE";
7
+ payload: MapType;
8
+ } | {
9
+ type: "SET_MAP_CONTAINER";
10
+ payload: HTMLDivElement;
11
+ };
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { MapType, OlMap } from "../components/Map.model";
3
+ declare const Context: import("react").Context<{
4
+ map: OlMap | null;
5
+ mapType: MapType;
6
+ mapContainer: HTMLDivElement | null;
7
+ setMap: (map: OlMap) => void;
8
+ setMapType: (mapType: MapType) => void;
9
+ setMapContainer: (el: HTMLDivElement) => void;
10
+ }>;
11
+ export default Context;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ export * from "./location.util";
2
+ export * from "./features.util";
3
+ /**
4
+ * Tells if current platform is mobile/tablet or a desktop/non-touchable device
5
+ * @returns
6
+ */
7
+ export declare function isTouchPlatform(): boolean;
@@ -0,0 +1,30 @@
1
+ import { Coordinate } from "ol/coordinate";
2
+ import { CoordsObj } from "../components/Map.model";
3
+ /**
4
+ * Get the object of location and turns it into array
5
+ * @param loc - location object
6
+ * @returns
7
+ */
8
+ export declare const sanitizeLocation: (loc?: CoordsObj) => Coordinate | undefined;
9
+ /**
10
+ * Gets the device location
11
+ * if it was succesfull, formats it and returns
12
+ * otherwise, sends Neshan locaton
13
+ * @returns location array
14
+ */
15
+ export declare const getLocation: () => Promise<Coordinate>;
16
+ /**
17
+ * Create an object for a quick lat lng access
18
+ */
19
+ export declare const createCoordsObject: () => {
20
+ longitude: number;
21
+ latitude: number;
22
+ };
23
+ /**
24
+ * Transforms common latlng to open layers-friendly latlng
25
+ * @param point
26
+ * @param from
27
+ * @param to
28
+ * @returns points
29
+ */
30
+ export declare const transformCoords: (point: Coordinate, from?: string, to?: string) => Coordinate;
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@neshan-maps-platform/react-openlayers",
3
+ "private": false,
4
+ "version": "2.0.0",
5
+ "type": "module",
6
+ "types": "./dist/types/components/index.ts",
7
+ "files": [
8
+ "./dist/**"
9
+ ],
10
+ "main": "./dist/React-NeshanMap-Openlayers.js",
11
+ "module": "./dist/React-NeshanMap-Openlayers.js",
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "build": "vite build && tsc",
15
+ "preview": "vite preview",
16
+ "prepublish": "yarn build"
17
+ },
18
+ "peerDependencies": {
19
+ "react": "18.x",
20
+ "react-dom": "18.x"
21
+ },
22
+ "devDependencies": {
23
+ "react": "^18.2.0",
24
+ "react-dom": "^18.2.0",
25
+ "@types/node": "^18.11.18",
26
+ "@types/ol": "^6.5.3",
27
+ "@types/react": "^18.0.27",
28
+ "@types/react-dom": "^18.0.10",
29
+ "@vitejs/plugin-react": "^3.1.0",
30
+ "sass": "^1.58.0",
31
+ "typescript": "^4.9.3",
32
+ "vite": "^4.1.0"
33
+ }
34
+ }