@yappkit/front-module-map 0.1.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,500 @@
1
+ import { c as T } from "../_commonjsHelpers.js";
2
+ var z = W, J = Object.prototype.hasOwnProperty;
3
+ function W() {
4
+ for (var r = {}, e = 0; e < arguments.length; e++) {
5
+ var t = arguments[e];
6
+ for (var n in t)
7
+ J.call(t, n) && (r[n] = t[n]);
8
+ }
9
+ return r;
10
+ }
11
+ var x = { exports: {} };
12
+ /*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */
13
+ x.exports;
14
+ (function(r, e) {
15
+ (function(t) {
16
+ var n = e, a = r && r.exports == n && r, u = typeof T == "object" && T;
17
+ (u.global === u || u.window === u) && (t = u);
18
+ var p = function(s) {
19
+ this.message = s;
20
+ };
21
+ p.prototype = new Error(), p.prototype.name = "InvalidCharacterError";
22
+ var d = function(s) {
23
+ throw new p(s);
24
+ }, i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = /[\t\n\f\r ]/g, f = function(s) {
25
+ s = String(s).replace(c, "");
26
+ var b = s.length;
27
+ b % 4 == 0 && (s = s.replace(/==?$/, ""), b = s.length), (b % 4 == 1 || // http://whatwg.org/C#alphanumeric-ascii-characters
28
+ /[^+a-zA-Z0-9/]/.test(s)) && d(
29
+ "Invalid character: the string to be decoded is not correctly encoded."
30
+ );
31
+ for (var o = 0, g, R, h = "", w = -1; ++w < b; )
32
+ R = i.indexOf(s.charAt(w)), g = o % 4 ? g * 64 + R : R, o++ % 4 && (h += String.fromCharCode(
33
+ 255 & g >> (-2 * o & 6)
34
+ ));
35
+ return h;
36
+ }, l = function(s) {
37
+ s = String(s), /[^\0-\xFF]/.test(s) && d(
38
+ "The string to be encoded contains characters outside of the Latin1 range."
39
+ );
40
+ for (var b = s.length % 3, o = "", g = -1, R, h, w, E, X = s.length - b; ++g < X; )
41
+ R = s.charCodeAt(g) << 16, h = s.charCodeAt(++g) << 8, w = s.charCodeAt(++g), E = R + h + w, o += i.charAt(E >> 18 & 63) + i.charAt(E >> 12 & 63) + i.charAt(E >> 6 & 63) + i.charAt(E & 63);
42
+ return b == 2 ? (R = s.charCodeAt(g) << 8, h = s.charCodeAt(++g), E = R + h, o += i.charAt(E >> 10) + i.charAt(E >> 4 & 63) + i.charAt(E << 2 & 63) + "=") : b == 1 && (E = s.charCodeAt(g), o += i.charAt(E >> 2) + i.charAt(E << 4 & 63) + "=="), o;
43
+ }, v = {
44
+ encode: l,
45
+ decode: f,
46
+ version: "0.1.0"
47
+ };
48
+ if (n && !n.nodeType)
49
+ if (a)
50
+ a.exports = v;
51
+ else
52
+ for (var y in v)
53
+ v.hasOwnProperty(y) && (n[y] = v[y]);
54
+ else
55
+ t.base64 = v;
56
+ })(T);
57
+ })(x, x.exports);
58
+ var Z = x.exports, K = Z, S = {};
59
+ function Y(r) {
60
+ if (S[r])
61
+ return S[r];
62
+ var e = r.split("."), t = e[0], n = e[1];
63
+ if (!n)
64
+ throw new Error("Invalid token");
65
+ var a = ee(n), u = {
66
+ usage: t,
67
+ user: a.u
68
+ };
69
+ return _(a, "a") && (u.authorization = a.a), _(a, "exp") && (u.expires = a.exp * 1e3), _(a, "iat") && (u.created = a.iat * 1e3), _(a, "scopes") && (u.scopes = a.scopes), _(a, "client") && (u.client = a.client), _(a, "ll") && (u.lastLogin = a.ll), _(a, "iu") && (u.impersonator = a.iu), S[r] = u, u;
70
+ }
71
+ function ee(r) {
72
+ try {
73
+ return JSON.parse(K.decode(r));
74
+ } catch {
75
+ throw new Error("Invalid token");
76
+ }
77
+ }
78
+ function _(r, e) {
79
+ return Object.prototype.hasOwnProperty.call(r, e);
80
+ }
81
+ var F = Y, M = { exports: {} };
82
+ (function(r) {
83
+ var e = Object.prototype.hasOwnProperty, t = "~";
84
+ function n() {
85
+ }
86
+ Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (t = !1));
87
+ function a(i, c, f) {
88
+ this.fn = i, this.context = c, this.once = f || !1;
89
+ }
90
+ function u(i, c, f, l, v) {
91
+ if (typeof f != "function")
92
+ throw new TypeError("The listener must be a function");
93
+ var y = new a(f, l || i, v), s = t ? t + c : c;
94
+ return i._events[s] ? i._events[s].fn ? i._events[s] = [i._events[s], y] : i._events[s].push(y) : (i._events[s] = y, i._eventsCount++), i;
95
+ }
96
+ function p(i, c) {
97
+ --i._eventsCount === 0 ? i._events = new n() : delete i._events[c];
98
+ }
99
+ function d() {
100
+ this._events = new n(), this._eventsCount = 0;
101
+ }
102
+ d.prototype.eventNames = function() {
103
+ var c = [], f, l;
104
+ if (this._eventsCount === 0)
105
+ return c;
106
+ for (l in f = this._events)
107
+ e.call(f, l) && c.push(t ? l.slice(1) : l);
108
+ return Object.getOwnPropertySymbols ? c.concat(Object.getOwnPropertySymbols(f)) : c;
109
+ }, d.prototype.listeners = function(c) {
110
+ var f = t ? t + c : c, l = this._events[f];
111
+ if (!l)
112
+ return [];
113
+ if (l.fn)
114
+ return [l.fn];
115
+ for (var v = 0, y = l.length, s = new Array(y); v < y; v++)
116
+ s[v] = l[v].fn;
117
+ return s;
118
+ }, d.prototype.listenerCount = function(c) {
119
+ var f = t ? t + c : c, l = this._events[f];
120
+ return l ? l.fn ? 1 : l.length : 0;
121
+ }, d.prototype.emit = function(c, f, l, v, y, s) {
122
+ var b = t ? t + c : c;
123
+ if (!this._events[b])
124
+ return !1;
125
+ var o = this._events[b], g = arguments.length, R, h;
126
+ if (o.fn) {
127
+ switch (o.once && this.removeListener(c, o.fn, void 0, !0), g) {
128
+ case 1:
129
+ return o.fn.call(o.context), !0;
130
+ case 2:
131
+ return o.fn.call(o.context, f), !0;
132
+ case 3:
133
+ return o.fn.call(o.context, f, l), !0;
134
+ case 4:
135
+ return o.fn.call(o.context, f, l, v), !0;
136
+ case 5:
137
+ return o.fn.call(o.context, f, l, v, y), !0;
138
+ case 6:
139
+ return o.fn.call(o.context, f, l, v, y, s), !0;
140
+ }
141
+ for (h = 1, R = new Array(g - 1); h < g; h++)
142
+ R[h - 1] = arguments[h];
143
+ o.fn.apply(o.context, R);
144
+ } else {
145
+ var w = o.length, E;
146
+ for (h = 0; h < w; h++)
147
+ switch (o[h].once && this.removeListener(c, o[h].fn, void 0, !0), g) {
148
+ case 1:
149
+ o[h].fn.call(o[h].context);
150
+ break;
151
+ case 2:
152
+ o[h].fn.call(o[h].context, f);
153
+ break;
154
+ case 3:
155
+ o[h].fn.call(o[h].context, f, l);
156
+ break;
157
+ case 4:
158
+ o[h].fn.call(o[h].context, f, l, v);
159
+ break;
160
+ default:
161
+ if (!R)
162
+ for (E = 1, R = new Array(g - 1); E < g; E++)
163
+ R[E - 1] = arguments[E];
164
+ o[h].fn.apply(o[h].context, R);
165
+ }
166
+ }
167
+ return !0;
168
+ }, d.prototype.on = function(c, f, l) {
169
+ return u(this, c, f, l, !1);
170
+ }, d.prototype.once = function(c, f, l) {
171
+ return u(this, c, f, l, !0);
172
+ }, d.prototype.removeListener = function(c, f, l, v) {
173
+ var y = t ? t + c : c;
174
+ if (!this._events[y])
175
+ return this;
176
+ if (!f)
177
+ return p(this, y), this;
178
+ var s = this._events[y];
179
+ if (s.fn)
180
+ s.fn === f && (!v || s.once) && (!l || s.context === l) && p(this, y);
181
+ else {
182
+ for (var b = 0, o = [], g = s.length; b < g; b++)
183
+ (s[b].fn !== f || v && !s[b].once || l && s[b].context !== l) && o.push(s[b]);
184
+ o.length ? this._events[y] = o.length === 1 ? o[0] : o : p(this, y);
185
+ }
186
+ return this;
187
+ }, d.prototype.removeAllListeners = function(c) {
188
+ var f;
189
+ return c ? (f = t ? t + c : c, this._events[f] && p(this, f)) : (this._events = new n(), this._eventsCount = 0), this;
190
+ }, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = t, d.EventEmitter = d, r.exports = d;
191
+ })(M);
192
+ var re = M.exports;
193
+ function te(r) {
194
+ return r.map(encodeURIComponent).join(",");
195
+ }
196
+ function U(r) {
197
+ return Array.isArray(r) ? te(r) : encodeURIComponent(String(r));
198
+ }
199
+ function j(r, e, t) {
200
+ if (t === !1 || t === null)
201
+ return r;
202
+ var n = /\?/.test(r) ? "&" : "?", a = encodeURIComponent(e);
203
+ return t !== void 0 && t !== "" && t !== !0 && (a += "=" + U(t)), "" + r + n + a;
204
+ }
205
+ function ne(r, e) {
206
+ if (!e)
207
+ return r;
208
+ var t = r;
209
+ return Object.keys(e).forEach(function(n) {
210
+ var a = e[n];
211
+ a !== void 0 && (Array.isArray(a) && (a = a.filter(function(u) {
212
+ return u != null;
213
+ }).join(",")), t = j(t, n, a));
214
+ }), t;
215
+ }
216
+ function ae(r, e) {
217
+ if (!e || r.slice(0, 4) === "http")
218
+ return r;
219
+ var t = r[0] === "/" ? "" : "/";
220
+ return "" + e.replace(/\/$/, "") + t + r;
221
+ }
222
+ function se(r, e) {
223
+ return e ? r.replace(/\/:([a-zA-Z0-9]+)/g, function(t, n) {
224
+ var a = e[n];
225
+ if (a === void 0)
226
+ throw new Error("Unspecified route parameter " + n);
227
+ var u = U(a);
228
+ return "/" + u;
229
+ }) : r;
230
+ }
231
+ var oe = {
232
+ appendQueryObject: ne,
233
+ appendQueryParam: j,
234
+ prependOrigin: ae,
235
+ interpolateRouteParams: se
236
+ }, C = {
237
+ API_ORIGIN: "https://api.mapbox.com",
238
+ EVENT_PROGRESS_DOWNLOAD: "downloadProgress",
239
+ EVENT_PROGRESS_UPLOAD: "uploadProgress",
240
+ EVENT_ERROR: "error",
241
+ EVENT_RESPONSE: "response",
242
+ ERROR_HTTP: "HttpError",
243
+ ERROR_REQUEST_ABORTED: "RequestAbortedError"
244
+ }, ie = F, q = z, ue = re, O = oe, N = C, ce = 1;
245
+ function m(r, e) {
246
+ if (!r)
247
+ throw new Error("MapiRequest requires a client");
248
+ if (!e || !e.path || !e.method)
249
+ throw new Error(
250
+ "MapiRequest requires an options object with path and method properties"
251
+ );
252
+ var t = {};
253
+ e.body && (t["content-type"] = "application/json");
254
+ var n = q(t, e.headers), a = Object.keys(n).reduce(function(u, p) {
255
+ return u[p.toLowerCase()] = n[p], u;
256
+ }, {});
257
+ this.id = ce++, this._options = e, this.emitter = new ue(), this.client = r, this.response = null, this.error = null, this.sent = !1, this.aborted = !1, this.path = e.path, this.method = e.method, this.origin = e.origin || r.origin, this.query = e.query || {}, this.params = e.params || {}, this.body = e.body || null, this.file = e.file || null, this.encoding = e.encoding || "utf8", this.sendFileAs = e.sendFileAs || null, this.headers = a;
258
+ }
259
+ m.prototype.url = function(e) {
260
+ var t = O.prependOrigin(this.path, this.origin);
261
+ t = O.appendQueryObject(t, this.query);
262
+ var n = this.params, a = e ?? this.client.accessToken;
263
+ if (a) {
264
+ t = O.appendQueryParam(t, "access_token", a);
265
+ var u = ie(a).user;
266
+ n = q({ ownerId: u }, n);
267
+ }
268
+ return t = O.interpolateRouteParams(t, n), t;
269
+ };
270
+ m.prototype.send = function() {
271
+ var e = this;
272
+ if (e.sent)
273
+ throw new Error(
274
+ "This request has already been sent. Check the response and error properties. Create a new request with clone()."
275
+ );
276
+ return e.sent = !0, e.client.sendRequest(e).then(
277
+ function(t) {
278
+ return e.response = t, e.emitter.emit(N.EVENT_RESPONSE, t), t;
279
+ },
280
+ function(t) {
281
+ throw e.error = t, e.emitter.emit(N.EVENT_ERROR, t), t;
282
+ }
283
+ );
284
+ };
285
+ m.prototype.abort = function() {
286
+ this._nextPageRequest && (this._nextPageRequest.abort(), delete this._nextPageRequest), !(this.response || this.error || this.aborted) && (this.aborted = !0, this.client.abortRequest(this));
287
+ };
288
+ m.prototype.eachPage = function(e) {
289
+ var t = this;
290
+ function n(p) {
291
+ function d() {
292
+ delete t._nextPageRequest;
293
+ var i = p.nextPage();
294
+ i && (t._nextPageRequest = i, u(i));
295
+ }
296
+ e(null, p, d);
297
+ }
298
+ function a(p) {
299
+ e(p, null, function() {
300
+ });
301
+ }
302
+ function u(p) {
303
+ p.send().then(n, a);
304
+ }
305
+ u(this);
306
+ };
307
+ m.prototype.clone = function() {
308
+ return this._extend();
309
+ };
310
+ m.prototype._extend = function(e) {
311
+ var t = q(this._options, e);
312
+ return new m(this.client, t);
313
+ };
314
+ var fe = m, le = F, pe = fe, he = C;
315
+ function V(r) {
316
+ if (!r || !r.accessToken)
317
+ throw new Error("Cannot create a client without an access token");
318
+ le(r.accessToken), this.accessToken = r.accessToken, this.origin = r.origin || he.API_ORIGIN;
319
+ }
320
+ V.prototype.createRequest = function(e) {
321
+ return new pe(this, e);
322
+ };
323
+ var de = V;
324
+ function ve(r) {
325
+ var e = r.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);
326
+ return e ? {
327
+ key: e[1],
328
+ value: e[2]
329
+ } : null;
330
+ }
331
+ function ye(r) {
332
+ var e = r.match(/<?([^>]*)>(.*)/);
333
+ if (!e)
334
+ return null;
335
+ var t = e[1], n = e[2].split(";"), a = null, u = n.reduce(function(p, d) {
336
+ var i = ve(d);
337
+ return i ? i.key === "rel" ? (a || (a = i.value), p) : (p[i.key] = i.value, p) : p;
338
+ }, {});
339
+ return a ? {
340
+ url: t,
341
+ rel: a,
342
+ params: u
343
+ } : null;
344
+ }
345
+ function ge(r) {
346
+ return r ? r.split(/,\s*</).reduce(function(e, t) {
347
+ var n = ye(t);
348
+ if (!n)
349
+ return e;
350
+ var a = n.rel.split(/\s+/);
351
+ return a.forEach(function(u) {
352
+ e[u] || (e[u] = {
353
+ url: n.url,
354
+ params: n.params
355
+ });
356
+ }), e;
357
+ }, {}) : {};
358
+ }
359
+ var be = ge, Ee = be;
360
+ function L(r, e) {
361
+ this.request = r, this.headers = e.headers, this.rawBody = e.body, this.statusCode = e.statusCode;
362
+ try {
363
+ this.body = JSON.parse(e.body || "{}");
364
+ } catch {
365
+ this.body = e.body;
366
+ }
367
+ this.links = Ee(this.headers.link);
368
+ }
369
+ L.prototype.hasNextPage = function() {
370
+ return !!this.links.next;
371
+ };
372
+ L.prototype.nextPage = function() {
373
+ return this.hasNextPage() ? this.request._extend({
374
+ path: this.links.next.url
375
+ }) : null;
376
+ };
377
+ var Re = L, I = C;
378
+ function me(r) {
379
+ var e = r.type || I.ERROR_HTTP, t;
380
+ if (r.body)
381
+ try {
382
+ t = JSON.parse(r.body);
383
+ } catch {
384
+ t = r.body;
385
+ }
386
+ else
387
+ t = null;
388
+ var n = r.message || null;
389
+ n || (typeof t == "string" ? n = t : t && typeof t.message == "string" ? n = t.message : e === I.ERROR_REQUEST_ABORTED && (n = "Request aborted")), this.message = n, this.type = e, this.statusCode = r.statusCode || null, this.request = r.request, this.body = t;
390
+ }
391
+ var we = me;
392
+ function _e(r) {
393
+ var e = r.indexOf(":"), t = r.substring(0, e).trim().toLowerCase(), n = r.substring(e + 1).trim();
394
+ return {
395
+ name: t,
396
+ value: n
397
+ };
398
+ }
399
+ function Pe(r) {
400
+ var e = {};
401
+ return r && r.trim().split(/[\r|\n]+/).forEach(function(t) {
402
+ var n = _e(t);
403
+ e[n.name] = n.value;
404
+ }), e;
405
+ }
406
+ var Oe = Pe, xe = Re, $ = we, k = C, Ae = Oe, A = {};
407
+ function Ce(r) {
408
+ var e = A[r.id];
409
+ e && (e.abort(), delete A[r.id]);
410
+ }
411
+ function Te(r, e) {
412
+ return new xe(r, {
413
+ body: e.response,
414
+ headers: Ae(e.getAllResponseHeaders()),
415
+ statusCode: e.status
416
+ });
417
+ }
418
+ function H(r) {
419
+ var e = r.total, t = r.loaded, n = 100 * t / e;
420
+ return {
421
+ total: e,
422
+ transferred: t,
423
+ percent: n
424
+ };
425
+ }
426
+ function G(r, e) {
427
+ return new Promise(function(t, n) {
428
+ e.onprogress = function(p) {
429
+ r.emitter.emit(
430
+ k.EVENT_PROGRESS_DOWNLOAD,
431
+ H(p)
432
+ );
433
+ };
434
+ var a = r.file;
435
+ a && (e.upload.onprogress = function(p) {
436
+ r.emitter.emit(
437
+ k.EVENT_PROGRESS_UPLOAD,
438
+ H(p)
439
+ );
440
+ }), e.onerror = function(p) {
441
+ n(p);
442
+ }, e.onabort = function() {
443
+ var p = new $({
444
+ request: r,
445
+ type: k.ERROR_REQUEST_ABORTED
446
+ });
447
+ n(p);
448
+ }, e.onload = function() {
449
+ if (delete A[r.id], e.status < 200 || e.status >= 400) {
450
+ var p = new $({
451
+ request: r,
452
+ body: e.response,
453
+ statusCode: e.status
454
+ });
455
+ n(p);
456
+ return;
457
+ }
458
+ t(e);
459
+ };
460
+ var u = r.body;
461
+ typeof u == "string" ? e.send(u) : u ? e.send(JSON.stringify(u)) : a ? e.send(a) : e.send(), A[r.id] = e;
462
+ }).then(function(t) {
463
+ return Te(r, t);
464
+ });
465
+ }
466
+ function Q(r, e) {
467
+ var t = r.url(e), n = new window.XMLHttpRequest();
468
+ return n.open(r.method, t), Object.keys(r.headers).forEach(function(a) {
469
+ n.setRequestHeader(a, r.headers[a]);
470
+ }), n;
471
+ }
472
+ function Se(r) {
473
+ return Promise.resolve().then(function() {
474
+ var e = Q(r, r.client.accessToken);
475
+ return G(r, e);
476
+ });
477
+ }
478
+ var ke = {
479
+ browserAbort: Ce,
480
+ sendRequestXhr: G,
481
+ browserSend: Se,
482
+ createRequestXhr: Q
483
+ }, B = ke, D = de;
484
+ function P(r) {
485
+ D.call(this, r);
486
+ }
487
+ P.prototype = Object.create(D.prototype);
488
+ P.prototype.constructor = P;
489
+ P.prototype.sendRequest = B.browserSend;
490
+ P.prototype.abortRequest = B.browserAbort;
491
+ function qe(r) {
492
+ return new P(r);
493
+ }
494
+ var Ne = qe;
495
+ export {
496
+ Ne as b,
497
+ z as i,
498
+ de as m,
499
+ oe as u
500
+ };