@atlaskit/editor-extension-dropbox 0.3.6 → 0.3.7

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.
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
-
12
9
  /*
13
10
  Hi! This file is a copy of the dropbox dropin API, originally found here:
14
11
 
@@ -30,7 +27,6 @@ Please reach out to the Editor team if you need more information
30
27
  }
31
28
  }(window, function (e) {
32
29
  var o = {};
33
-
34
30
  function n(t) {
35
31
  if (o[t]) return o[t].exports;
36
32
  var r = o[t] = {
@@ -40,7 +36,6 @@ Please reach out to the Editor team if you need more information
40
36
  };
41
37
  return e[t].call(r.exports, r, r.exports, n), r.l = !0, r.exports;
42
38
  }
43
-
44
39
  return n.m = e, n.c = o, n.d = function (e, o, t) {
45
40
  n.o(e, o) || Object.defineProperty(e, o, {
46
41
  enumerable: !0,
@@ -79,41 +74,36 @@ Please reach out to the Editor team if you need more information
79
74
  "use strict";
80
75
 
81
76
  var t,
82
- r = this && this.__assign || function () {
83
- return (r = Object.assign || function (e) {
84
- for (var o, n = 1, t = arguments.length; n < t; n++) {
85
- for (var r in o = arguments[n]) {
86
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
77
+ r = this && this.__assign || function () {
78
+ return (r = Object.assign || function (e) {
79
+ for (var o, n = 1, t = arguments.length; n < t; n++) {
80
+ for (var r in o = arguments[n]) {
81
+ Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
82
+ }
87
83
  }
88
- }
89
-
90
- return e;
91
- }).apply(this, arguments);
92
- };
93
-
84
+ return e;
85
+ }).apply(this, arguments);
86
+ };
94
87
  function i(e, o, n) {
95
88
  return e + (-1 === e.indexOf("?") ? "?" : "&") + o + "=" + n;
96
89
  }
97
-
98
90
  function s(e) {
99
91
  return i(e, "version", encodeURIComponent(Dropbox.VERSION));
100
92
  }
101
-
102
93
  function a(e, o) {
103
94
  var n = encodeURIComponent(window.location.protocol + "//" + window.location.host),
104
- t = encodeURIComponent(Dropbox.appKey),
105
- r = encodeURIComponent(e.linkType || ""),
106
- a = encodeURIComponent(e._trigger || "js"),
107
- c = Boolean(e.multiselect),
108
- l = encodeURIComponent(d(e.extensions, "join", function (e) {
109
- return e.join(" ");
110
- }) || ""),
111
- u = Boolean(e.folderselect);
95
+ t = encodeURIComponent(Dropbox.appKey),
96
+ r = encodeURIComponent(e.linkType || ""),
97
+ a = encodeURIComponent(e._trigger || "js"),
98
+ c = Boolean(e.multiselect),
99
+ l = encodeURIComponent(d(e.extensions, "join", function (e) {
100
+ return e.join(" ");
101
+ }) || ""),
102
+ u = Boolean(e.folderselect);
112
103
  o = Boolean(o);
113
104
  var p = Dropbox.baseUrl + "/chooser?origin=" + n + "&app_key=" + t + "&link_type=" + r + "&trigger=" + a + "&multiselect=" + c + "&extensions=" + l + "&folderselect=" + u + "&iframe=" + o;
114
105
  return void 0 !== e.fileselect && (p = i(p, "fileselect", Boolean(e.fileselect))), void 0 !== e.sizeLimit && (p = i(p, "size_limit", e.sizeLimit)), null != e.initialNavigation && (null != e.initialNavigation.mode && (p = i(p, "initial_navigation_mode", encodeURIComponent(e.initialNavigation.mode))), null != e.initialNavigation.role && (p = i(p, "initial_navigation_role", encodeURIComponent(e.initialNavigation.role))), e.initialNavigation.cursor && (p = i(p, "initial_navigation_cursor", encodeURIComponent(e.initialNavigation.cursor)))), null != e.initialViewType && (p = i(p, "initial_view_type", encodeURIComponent(e.initialViewType))), null != e.fields && (p = i(p, "fields", encodeURIComponent("function" == typeof e.fields.join ? e.fields.join(" ") : void 0))), !1 === e.showSignOut && (p = i(p, "show_sign_out", "false")), null !== e.initialNavigationPath && (p = i(p, "initial_navigation_path", encodeURIComponent(e.initialNavigationPath))), s(p);
115
106
  }
116
-
117
107
  function c(e) {
118
108
  var n = {
119
109
  options: r({}, e, {
@@ -127,22 +117,18 @@ Please reach out to the Editor team if you need more information
127
117
  };
128
118
  return o.currentChooserSession = n, n;
129
119
  }
130
-
131
120
  function l(e) {
132
121
  var o = document.createElement("iframe");
133
122
  return o.src = "about:blank", o._postAction = e, o.name = "dropbox-dropins", o.style.display = "block", o.style.backgroundColor = "white", o.style.border = "none", o;
134
123
  }
135
-
136
124
  function u(e, o) {
137
125
  var n,
138
- r = encodeURIComponent(Dropbox.appKey),
139
- i = Dropbox.baseUrl + "/dropins/job_status?job=" + o + "&app_key=" + r;
126
+ r = encodeURIComponent(Dropbox.appKey),
127
+ i = Dropbox.baseUrl + "/dropins/job_status?job=" + o + "&app_key=" + r;
140
128
  i = s(i);
141
-
142
129
  var a = function a(o) {
143
130
  "COMPLETE" === o.status ? ("function" == typeof e.progress && e.progress(1), "function" == typeof e.success && e.success()) : "PENDING" === o.status || "DOWNLOADING" === o.status ? (null != o.progress && "function" == typeof e.progress && e.progress(o.progress / 100), setTimeout(n, 1500)) : "FAILED" === o.status && "function" == typeof e.error && e.error(o.error);
144
131
  };
145
-
146
132
  if ("withCredentials" in new XMLHttpRequest()) n = function n() {
147
133
  var o = new XMLHttpRequest();
148
134
  return o.onload = function () {
@@ -152,7 +138,6 @@ Please reach out to the Editor team if you need more information
152
138
  }, o.open("GET", i, !0), o.send();
153
139
  };else if (Dropbox.disableJSONP) {
154
140
  if ("undefined" == typeof XDomainRequest || null === XDomainRequest || "https:" !== document.location.protocol) throw new Error("Unable to find suitable means of cross domain communication");
155
-
156
141
  n = function n() {
157
142
  var o = new XDomainRequest();
158
143
  return o.onload = function () {
@@ -163,12 +148,10 @@ Please reach out to the Editor team if you need more information
163
148
  };
164
149
  } else n = function n() {
165
150
  var o = "DropboxJsonpCallback" + t++,
166
- n = !1;
167
-
151
+ n = !1;
168
152
  window[o] = function (e) {
169
153
  return n = !0, a(e);
170
154
  };
171
-
172
155
  var r = document.createElement("script");
173
156
  return r.src = i + "&callback=" + o, r.onreadystatechange = function () {
174
157
  if ("loaded" === r.readyState) return n || "function" == typeof e.error && e.error(), null != r.parentNode ? r.parentNode.removeChild(r) : void 0;
@@ -176,11 +159,9 @@ Please reach out to the Editor team if you need more information
176
159
  };
177
160
  return "function" == typeof e.progress && e.progress(0), n();
178
161
  }
179
-
180
162
  function p(e, n, t) {
181
163
  var r,
182
- i = JSON.parse(e.data);
183
-
164
+ i = JSON.parse(e.data);
184
165
  switch (r = null != o.ieframe && t._popup ? o.ieframe.contentWindow : e.source, void 0 !== i.sequence_number && r.postMessage(JSON.stringify({
185
166
  method: "ack",
186
167
  sequence_number: i.sequence_number
@@ -190,11 +171,9 @@ Please reach out to the Editor team if you need more information
190
171
  method: "origin"
191
172
  }), Dropbox.baseUrl);
192
173
  break;
193
-
194
174
  case "ready":
195
175
  if (null != t.files) {
196
176
  var s = void 0;
197
-
198
177
  if (t._fetch_url_on_save) {
199
178
  for (var a = [], c = 0; c < t.files.length; c++) {
200
179
  var l = t.files[c];
@@ -202,7 +181,6 @@ Please reach out to the Editor team if you need more information
202
181
  filename: l.filename
203
182
  });
204
183
  }
205
-
206
184
  s = JSON.stringify({
207
185
  method: "files_with_callback",
208
186
  params: a
@@ -211,7 +189,6 @@ Please reach out to the Editor team if you need more information
211
189
  method: "files",
212
190
  params: t.files
213
191
  });
214
-
215
192
  if (r.postMessage(s, Dropbox.baseUrl), null != t._ews_auth_token) {
216
193
  var p = JSON.stringify({
217
194
  method: "ews_auth_token",
@@ -222,45 +199,35 @@ Please reach out to the Editor team if you need more information
222
199
  r.postMessage(p, Dropbox.baseUrl);
223
200
  }
224
201
  }
225
-
226
202
  "function" == typeof t.ready && t.ready();
227
203
  break;
228
-
229
204
  case "files_selected":
230
205
  case "files_saved":
231
206
  "function" == typeof n && n(), "function" == typeof t.success && t.success(i.params, o.last_navigation);
232
207
  break;
233
-
234
208
  case "cursor_changed":
235
209
  o.last_navigation = {
236
210
  cursor: i.params
237
211
  };
238
212
  break;
239
-
240
213
  case "progress":
241
214
  "function" == typeof t.progress && t.progress(i.params);
242
215
  break;
243
-
244
216
  case "close_dialog":
245
217
  "function" == typeof n && n(), "function" == typeof t.cancel && t.cancel(o.last_navigation);
246
218
  break;
247
-
248
219
  case "resize":
249
220
  "function" == typeof t.resize && t.resize(i.params);
250
221
  break;
251
-
252
222
  case "error":
253
223
  "function" == typeof t.error && t.error(i.params);
254
224
  break;
255
-
256
225
  case "error_and_close":
257
226
  "function" == typeof n && n(), "function" == typeof t.error && t.error(i.params);
258
227
  break;
259
-
260
228
  case "job_id":
261
229
  "function" == typeof n && n(), u(t, i.params);
262
230
  break;
263
-
264
231
  case "save_callback":
265
232
  !function (e, o, n) {
266
233
  if (e._fetch_url_on_save) {
@@ -279,16 +246,13 @@ Please reach out to the Editor team if you need more information
279
246
  }
280
247
  }(t, i.params);
281
248
  break;
282
-
283
249
  case "_debug_log":
284
250
  "undefined" != typeof console && null !== console && console.log(i.params.msg);
285
251
  }
286
252
  }
287
-
288
253
  function d(e, o, n) {
289
254
  return void 0 !== e && null !== e && "function" == typeof e[o] ? n(e, o) : void 0;
290
255
  }
291
-
292
256
  Object.defineProperty(o, "__esModule", {
293
257
  value: !0
294
258
  }), null == window.Dropbox && (window.Dropbox = {}), o.popupDimensionsString = function (e, o) {
@@ -297,7 +261,7 @@ Please reach out to the Editor team if you need more information
297
261
  /\bTrident\b/.test(navigator.userAgent) && null != document.body && null == o.ieframe && (o.ieframe = document.createElement("iframe"), o.ieframe.setAttribute("id", "dropbox_xcomm"), o.ieframe.setAttribute("src", Dropbox.baseUrl + "/static/api/1/xcomm.html"), o.ieframe.style.display = "none", document.body.appendChild(o.ieframe));
298
262
  }, o.createChooserSession = c, o.createWidgetElement = l, o.handleJobId = u, o.handleMessageEvent = p, o.saverUrl = function (e) {
299
263
  var o = encodeURIComponent(window.location.protocol + "//" + window.location.host),
300
- n = encodeURIComponent(Dropbox.appKey);
264
+ n = encodeURIComponent(Dropbox.appKey);
301
265
  return e = Boolean(e), s(Dropbox.baseUrl + "/saver?origin=" + o + "&app_key=" + n + "&iframe=" + e);
302
266
  }, o.__guardMethod__ = d, o.__guard__ = function (e, o) {
303
267
  return void 0 !== e && null !== e ? o(e) : void 0;
@@ -312,7 +276,7 @@ Please reach out to the Editor team if you need more information
312
276
  e.removeEventListener ? e.removeEventListener(o, n, !1) : e.detachEvent("on" + o, n);
313
277
  }, Dropbox.createChooserWidget = function (e) {
314
278
  var o = c(e),
315
- n = l(a(o.options, !0));
279
+ n = l(a(o.options, !0));
316
280
  return n._handler = function (e) {
317
281
  e.source === n.contentWindow && e.origin === Dropbox.baseUrl && p(e, null, o.options);
318
282
  }, Dropbox.addListener(window, "message", n._handler), n;
@@ -328,37 +292,31 @@ Please reach out to the Editor team if you need more information
328
292
  value: !0
329
293
  });
330
294
  var t = n(0),
331
- r = ["text", "documents", "images", "video", "audio"];
295
+ r = ["text", "documents", "images", "video", "audio"];
332
296
  o.genericDropins = {
333
297
  init: function init() {}
334
298
  };
335
-
336
299
  var i = function i(e) {
337
300
  return e;
338
301
  };
339
-
340
302
  function s(e, o) {
341
303
  null != o ? o.innerHTML = "" : (o = document.createElement("a")).href = "#", o.className += " dropbox-dropin-btn", Dropbox.isBrowserSupported() ? o.className += " dropbox-dropin-default" : o.className += " dropbox-dropin-disabled";
342
304
  var n = document.createElement("span");
343
305
  return n.className = "dropin-btn-status", o.appendChild(n), e = document.createTextNode(e), o.appendChild(e), o;
344
306
  }
345
-
346
307
  function a(e) {
347
308
  return e.replace(/\/+$/g, "").split("/").pop();
348
309
  }
349
-
350
310
  function c(e) {
351
311
  var o = document.createElement("a");
352
312
  return o.href = e, a(o.pathname);
353
313
  }
354
-
355
314
  o.createDropinButton = s, o.filenameFromPath = a, o.initModule = function () {
356
315
  t.initModule(), null == Dropbox.appKey && (Dropbox.appKey = t.__guard__(document.getElementById("dropboxjs"), function (e) {
357
316
  return e.getAttribute("data-app-key");
358
317
  })), Dropbox.init = function (e) {
359
318
  null != e.translation_function && (i = e.translation_function), null != e.appKey && (Dropbox.appKey = e.appKey);
360
319
  };
361
-
362
320
  var e = function e(_e) {
363
321
  var o, n, t;
364
322
  if ("string" == typeof _e[0]) t = _e.shift(), o = "string" == typeof _e[0] ? _e.shift() : c(t), (n = _e.shift() || {}).files = [{
@@ -367,12 +325,10 @@ Please reach out to the Editor team if you need more information
367
325
  }];else {
368
326
  if (null == (n = _e.shift())) throw new Error("Missing arguments. See documentation.");
369
327
  if ((null == n.files || !n.files.length) && "function" != typeof n.files) throw new Error("Missing files. See documentation.");
370
-
371
328
  if (null != n.fetch_urls_fn) {
372
329
  if ("function" != typeof n.fetch_urls_fn) throw new Error("fetch_urls_fn must be a function if supplied. See documentation.");
373
330
  n._fetch_url_on_save = !0;
374
331
  }
375
-
376
332
  for (var r = 0; r < n.files.length; r++) {
377
333
  var i = n.files[r];
378
334
  if ("function" == typeof i.url && (n._fetch_url_on_save = !0, n.fetch_urls_fn = i.url, i.url = null, r > 0)) throw new Error("Old style url as callback is only supported for single files.");
@@ -381,110 +337,95 @@ Please reach out to the Editor team if you need more information
381
337
  }
382
338
  return n;
383
339
  };
384
-
385
340
  Dropbox.save = function () {
386
341
  for (var o = [], r = 0; r < arguments.length; r++) {
387
342
  o[r] = arguments[r];
388
343
  }
389
-
390
344
  var s = e(o);
391
-
392
345
  if (Dropbox.isBrowserSupported()) {
393
346
  if (s._popup = !0, "object" != (0, _typeof2.default)(s.files) || !s.files.length) throw new Error("The object passed in must have a 'files' property that contains a list of objects. See documentation.");
394
347
  if (s.iframe && !s.windowName) throw new Error("Dropbox.save does not yet support creating its own iframe. windowName must be provided when the iframe option is present.");
395
-
396
348
  for (var a = 0, c = s.files; a < c.length; a++) {
397
349
  var l = c[a];
398
-
399
350
  if (s._fetch_url_on_save) {
400
351
  if (s.fetch_urls_fn) {
401
352
  if (null != l.url) throw new Error("You passed in a 'fetch_urls_fn' option to specify the file URLs. Don't include individual URLs in each file objects.");
402
353
  } else if ("function" != typeof l.url) throw new Error("File urls should be all urls, or a single file with function. See documentation.");
403
354
  } else if ("string" != typeof l.url) throw new Error("File urls to download incorrectly configured. Each file must have a url. See documentation.");
404
355
  }
405
-
406
356
  var u = t.popupDimensionsString(735, 670);
407
357
  return n(t.saverUrl(s.iframe), u, s).window;
408
358
  }
409
-
410
359
  alert(i("Your browser does not support the Dropbox Saver"));
411
360
  };
412
-
413
361
  var n = function n(e, o, _n) {
414
- var r = function r() {
415
- a.closed || (a.close(), a.postMessage(JSON.stringify({
416
- method: "close"
417
- }), Dropbox.baseUrl)), Dropbox.removeListener(window, "message", i), clearInterval(c);
418
- },
362
+ var r = function r() {
363
+ a.closed || (a.close(), a.postMessage(JSON.stringify({
364
+ method: "close"
365
+ }), Dropbox.baseUrl)), Dropbox.removeListener(window, "message", i), clearInterval(c);
366
+ },
419
367
  i = function i(e) {
420
- e.source !== a && e.source !== (void 0 !== t.ieframe && null !== t.ieframe ? t.ieframe.contentWindow : void 0) || t.handleMessageEvent(e, r, _n);
421
- },
368
+ e.source !== a && e.source !== (void 0 !== t.ieframe && null !== t.ieframe ? t.ieframe.contentWindow : void 0) || t.handleMessageEvent(e, r, _n);
369
+ },
422
370
  s = _n.iframe ? "" : o + ",resizable,scrollbars",
423
371
  a = window.open(e, _n.windowName || "dropbox", s);
424
-
425
- if (!a) throw new Error("Failed to open/load the window. Dropbox.choose and Dropbox.save should only be called from within a user-triggered event handler such as a tap or click event.");
426
- a.focus();
427
- var c = setInterval(function () {
428
- (function () {
429
- try {
430
- return a.closed;
431
- } catch (e) {}
432
- })() && (r(), "function" == typeof _n.cancel && _n.cancel(t.last_navigation));
433
- }, 100);
434
- return Dropbox.addListener(window, "message", i), {
435
- window: a,
436
- onClose: r
437
- };
438
- },
439
- a = function a(e) {
440
- null == e.success && t.__guardMethod__(console, "warn", function (e) {
441
- return e.warn("You must provide a success callback to the Chooser to see the files that the user selects");
442
- }), void 0 === e.fileselect || Boolean(e.fileselect) || Boolean(e.folderselect) || t.__guardMethod__(console, "error", function (e) {
443
- return e.error("You must enable either fileselect or folderselect on the Chooser so the user can select something");
444
- });
445
-
446
- var o = function o() {
447
- return t.__guardMethod__(console, "warn", function (e) {
448
- return e.warn("The provided list of extensions or file types is not valid. See Chooser documentation: https://www.dropbox.com/developers/dropins/chooser/js");
449
- }), t.__guardMethod__(console, "warn", function (e) {
450
- return e.warn("Available file types are: " + r.join(", "));
451
- }), delete e.extensions;
452
- };
453
-
454
- if (null != e.extensions && null != Array.isArray) if (Array.isArray(e.extensions)) for (var n = 0, i = e.extensions; n < i.length; n++) {
455
- var s = i[n];
456
- s.match(/^\.[\.\w$#&+@!()\-'`_~]+$/) || -1 !== r.indexOf(s) || o();
457
- } else o();
458
- return void 0 !== e.sizeLimit && "number" != typeof e.sizeLimit && e.sizeLimit <= 0 && t.__guardMethod__(console, "error", function (e) {
459
- return e.error("The sizeLimit option, if provided, must be a positive number");
460
- }), e;
461
- },
462
- l = function l(e) {
463
- if (Dropbox.isBrowserSupported()) {
464
- var o,
372
+ if (!a) throw new Error("Failed to open/load the window. Dropbox.choose and Dropbox.save should only be called from within a user-triggered event handler such as a tap or click event.");
373
+ a.focus();
374
+ var c = setInterval(function () {
375
+ (function () {
376
+ try {
377
+ return a.closed;
378
+ } catch (e) {}
379
+ })() && (r(), "function" == typeof _n.cancel && _n.cancel(t.last_navigation));
380
+ }, 100);
381
+ return Dropbox.addListener(window, "message", i), {
382
+ window: a,
383
+ onClose: r
384
+ };
385
+ },
386
+ a = function a(e) {
387
+ null == e.success && t.__guardMethod__(console, "warn", function (e) {
388
+ return e.warn("You must provide a success callback to the Chooser to see the files that the user selects");
389
+ }), void 0 === e.fileselect || Boolean(e.fileselect) || Boolean(e.folderselect) || t.__guardMethod__(console, "error", function (e) {
390
+ return e.error("You must enable either fileselect or folderselect on the Chooser so the user can select something");
391
+ });
392
+ var o = function o() {
393
+ return t.__guardMethod__(console, "warn", function (e) {
394
+ return e.warn("The provided list of extensions or file types is not valid. See Chooser documentation: https://www.dropbox.com/developers/dropins/chooser/js");
395
+ }), t.__guardMethod__(console, "warn", function (e) {
396
+ return e.warn("Available file types are: " + r.join(", "));
397
+ }), delete e.extensions;
398
+ };
399
+ if (null != e.extensions && null != Array.isArray) if (Array.isArray(e.extensions)) for (var n = 0, i = e.extensions; n < i.length; n++) {
400
+ var s = i[n];
401
+ s.match(/^\.[\.\w$#&+@!()\-'`_~]+$/) || -1 !== r.indexOf(s) || o();
402
+ } else o();
403
+ return void 0 !== e.sizeLimit && "number" != typeof e.sizeLimit && e.sizeLimit <= 0 && t.__guardMethod__(console, "error", function (e) {
404
+ return e.error("The sizeLimit option, if provided, must be a positive number");
405
+ }), e;
406
+ },
407
+ l = function l(e) {
408
+ if (Dropbox.isBrowserSupported()) {
409
+ var o,
465
410
  r,
466
411
  s = t.createChooserSession(e);
467
-
468
- if (e.iframe && !e.windowName) {
469
- var a = (o = t.chooserUrl(e, !0), (r = document.createElement("iframe")).src = o, r.style.display = "block", r.style.backgroundColor = "white", r.style.border = "none", r);
470
- a.style.width = "735px", a.style.height = "552px", a.style.margin = "125px auto 0 auto", a.style.border = "1px solid #ACACAC", a.style.boxShadow = "rgba(0, 0, 0, .2) 0px 4px 16px";
471
- var c = document.createElement("div");
472
- c.style.position = "fixed", c.style.left = c.style.right = c.style.top = c.style.bottom = "0", c.style.zIndex = "1000", c.style.backgroundColor = "rgba(160, 160, 160, 0.2)", c.appendChild(a), document.body.appendChild(c);
473
-
474
- var l = function l(e) {
475
- e.source === a.contentWindow && (s.onClose = function () {
476
- document.body.removeChild(c), Dropbox.removeListener(window, "message", l);
477
- }, t.handleMessageEvent(e, s.onClose, s.options));
478
- };
479
-
480
- Dropbox.addListener(window, "message", l);
481
- } else {
482
- var u = t.popupDimensionsString(735, 552);
483
- s.onClose = n(t.chooserUrl(s.options, s.options.iframe), u, s.options).onClose;
484
- }
485
- } else alert(i("Your browser does not support the Dropbox Chooser"));
486
- };
487
-
412
+ if (e.iframe && !e.windowName) {
413
+ var a = (o = t.chooserUrl(e, !0), (r = document.createElement("iframe")).src = o, r.style.display = "block", r.style.backgroundColor = "white", r.style.border = "none", r);
414
+ a.style.width = "735px", a.style.height = "552px", a.style.margin = "125px auto 0 auto", a.style.border = "1px solid #ACACAC", a.style.boxShadow = "rgba(0, 0, 0, .2) 0px 4px 16px";
415
+ var c = document.createElement("div");
416
+ c.style.position = "fixed", c.style.left = c.style.right = c.style.top = c.style.bottom = "0", c.style.zIndex = "1000", c.style.backgroundColor = "rgba(160, 160, 160, 0.2)", c.appendChild(a), document.body.appendChild(c);
417
+ var l = function l(e) {
418
+ e.source === a.contentWindow && (s.onClose = function () {
419
+ document.body.removeChild(c), Dropbox.removeListener(window, "message", l);
420
+ }, t.handleMessageEvent(e, s.onClose, s.options));
421
+ };
422
+ Dropbox.addListener(window, "message", l);
423
+ } else {
424
+ var u = t.popupDimensionsString(735, 552);
425
+ s.onClose = n(t.chooserUrl(s.options, s.options.iframe), u, s.options).onClose;
426
+ }
427
+ } else alert(i("Your browser does not support the Dropbox Chooser"));
428
+ };
488
429
  Dropbox.choose = function (e) {
489
430
  null == e && (e = {}), e = a(e), l(e);
490
431
  }, Dropbox.cancelChooser = function () {
@@ -494,10 +435,8 @@ Please reach out to the Editor team if you need more information
494
435
  for (var e = 0, o = [/IEMobile\/(7|8|9|10)\./, /BB10;/, /CriOS/]; e < o.length; e++) {
495
436
  if (o[e].test(navigator.userAgent)) return !1;
496
437
  }
497
-
498
438
  return "undefined" != typeof JSON && null !== JSON && null != window.postMessage && null != window.addEventListener && !/MSIE [7-9]/.test(navigator.userAgent);
499
439
  }();
500
-
501
440
  return Dropbox.isBrowserSupported = function () {
502
441
  return e;
503
442
  }, e;
@@ -524,9 +463,8 @@ Please reach out to the Editor team if you need more information
524
463
  for (var o = [], n = 0; n < arguments.length; n++) {
525
464
  o[n] = arguments[n];
526
465
  }
527
-
528
466
  var t = e(o),
529
- r = o.shift();
467
+ r = o.shift();
530
468
  return r = s(i("Save to Dropbox"), r), Dropbox.addListener(r, "click", function (e) {
531
469
  if (e.preventDefault(), r.className.indexOf("dropbox-dropin-error") >= 0 || r.className.indexOf("dropbox-dropin-default") >= 0 || r.className.indexOf("dropbox-dropin-disabled") >= 0) {
532
470
  var o = ("function" == typeof t.files ? t.files() : void 0) || t.files;
@@ -549,20 +487,16 @@ Please reach out to the Editor team if you need more information
549
487
  }
550
488
  }), r;
551
489
  };
552
-
553
490
  var u = function u(e, o) {
554
- return " background: " + e + ";\n background: -moz-linear-gradient(top, " + e + " 0%, " + o + " 100%);\n background: -webkit-linear-gradient(top, " + e + " 0%, " + o + " 100%);\n background: linear-gradient(to bottom, " + e + " 0%, " + o + " 100%);\n filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='" + e + "', endColorstr='" + o + "',GradientType=0); ";
555
- },
556
- p = document.createElement("style");
557
-
491
+ return " background: " + e + ";\n background: -moz-linear-gradient(top, " + e + " 0%, " + o + " 100%);\n background: -webkit-linear-gradient(top, " + e + " 0%, " + o + " 100%);\n background: linear-gradient(to bottom, " + e + " 0%, " + o + " 100%);\n filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='" + e + "', endColorstr='" + o + "',GradientType=0); ";
492
+ },
493
+ p = document.createElement("style");
558
494
  p.type = "text/css";
559
495
  var d = ' @-webkit-keyframes rotate {\n from { -webkit-transform: rotate(0deg); }\n to { -webkit-transform: rotate(360deg); }\n }\n\n @keyframes rotate {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n .dropbox-dropin-btn, .dropbox-dropin-btn:link, .dropbox-dropin-btn:hover {\n display: inline-block;\n height: 14px;\n font-family: "Lucida Grande", "Segoe UI", "Tahoma", "Helvetica Neue", "Helvetica", sans-serif;\n font-size: 11px;\n font-weight: 600;\n color: #636363;\n text-decoration: none;\n padding: 1px 7px 5px 3px;\n border: 1px solid #ebebeb;\n border-radius: 2px;\n border-bottom-color: #d4d4d4;\n ' + u("#fcfcfc", "#f5f5f5") + "\n }\n\n .dropbox-dropin-default:hover, .dropbox-dropin-error:hover {\n border-color: #dedede;\n border-bottom-color: #cacaca;\n " + u("#fdfdfd", "#f5f5f5") + "\n }\n\n .dropbox-dropin-default:active, .dropbox-dropin-error:active {\n border-color: #d1d1d1;\n box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);\n }\n\n .dropbox-dropin-btn .dropin-btn-status {\n display: inline-block;\n width: 15px;\n height: 14px;\n vertical-align: bottom;\n margin: 0 5px 0 2px;\n background: transparent url('" + Dropbox.baseUrl + "/static/images/widgets/dbx-saver-status.png') no-repeat;\n position: relative;\n top: 2px;\n }\n\n .dropbox-dropin-default .dropin-btn-status {\n background-position: 0px 0px;\n }\n\n .dropbox-dropin-progress .dropin-btn-status {\n width: 18px;\n margin: 0 4px 0 0;\n background: url('" + Dropbox.baseUrl + "/static/images/widgets/dbx-progress.png') no-repeat center center;\n -webkit-animation-name: rotate;\n -webkit-animation-duration: 1.7s;\n -webkit-animation-iteration-count: infinite;\n -webkit-animation-timing-function: linear;\n animation-name: rotate;\n animation-duration: 1.7s;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n }\n\n .dropbox-dropin-success .dropin-btn-status {\n background-position: -15px 0px;\n }\n\n .dropbox-dropin-disabled {\n background: #e0e0e0;\n border: 1px #dadada solid;\n border-bottom: 1px solid #ccc;\n box-shadow: none;\n }\n\n .dropbox-dropin-disabled .dropin-btn-status {\n background-position: -30px 0px;\n }\n\n .dropbox-dropin-error .dropin-btn-status {\n background-position: -45px 0px;\n }\n\n @media only screen and (-webkit-min-device-pixel-ratio: 1.4) {\n .dropbox-dropin-btn .dropin-btn-status {\n background-image: url('" + Dropbox.baseUrl + "/static/images/widgets/dbx-saver-status-2x.png');\n background-size: 60px 14px;\n -webkit-background-size: 60px 14px;\n }\n\n .dropbox-dropin-progress .dropin-btn-status {\n background: url('" + Dropbox.baseUrl + "/static/images/widgets/dbx-progress-2x.png') no-repeat center center;\n background-size: 20px 20px;\n -webkit-background-size: 20px 20px;\n }\n }\n\n .dropbox-saver:hover, .dropbox-chooser:hover {\n text-decoration: none;\n cursor: pointer;\n }\n\n .dropbox-chooser, .dropbox-dropin-btn {\n line-height: 11px !important;\n text-decoration: none !important;\n box-sizing: content-box !important;\n -webkit-box-sizing: content-box !important;\n -moz-box-sizing: content-box !important;\n }\n ";
560
496
  p.styleSheet ? p.styleSheet.cssText = d : p.textContent = d, document.getElementsByTagName("head")[0].appendChild(p), setTimeout(t.createIEFrame, 0);
561
-
562
497
  var f = function f() {
563
498
  document.removeEventListener ? document.removeEventListener("DOMContentLoaded", f, !1) : document.detachEvent && document.detachEvent("onreadystatechange", f), t.createIEFrame(), o.genericDropins.init();
564
499
  };
565
-
566
500
  "interactive" === document.readyState || "complete" === document.readyState ? setTimeout(f, 0) : document.addEventListener ? document.addEventListener("DOMContentLoaded", f, !1) : document.attachEvent("onreadystatechange", f);
567
501
  };
568
502
  }, function (e, o, n) {
@@ -571,209 +505,181 @@ Please reach out to the Editor team if you need more information
571
505
  Object.defineProperty(o, "__esModule", {
572
506
  value: !0
573
507
  });
574
-
575
508
  var t = window.location.protocol + "//" + window.location.host,
576
- r = function () {
577
- function e(o) {
578
- if (this.origin = t, this.sendMessage = function (e) {}, this.state = {}, this.options = o, !this.options) throw new Error("options must be provided");
579
- if (!this.options.appKey) throw new Error("appKey must be provided");
580
- e.validateOnError(this.options.onError);
581
- }
582
-
583
- return e.validateOnError = function (e) {
584
- if (e && "function" != typeof e) throw new Error("onError must be a function");
585
- }, e.prototype.setOnError = function (o) {
586
- e.validateOnError(o), this.options.onError = o;
587
- }, e.prototype.hasOnCloseDialogMessage = function () {
588
- return void 0 !== this.onCloseDialogMessage;
589
- }, e.prototype.setOnCloseDialogMessage = function (e) {
590
- if ("function" != typeof e) throw new Error("onCloseDialogMessage must be a function");
591
- this.onCloseDialogMessage = e;
592
- }, e.prototype.sendState = function () {
593
- this.sendMessage({
594
- method: "state",
595
- params: this.state
596
- });
597
- }, e.prototype.url = function () {
598
- var e = [{
599
- key: "app_key",
600
- value: this.options.appKey
601
- }, {
602
- key: "origin",
603
- value: this.origin
604
- }].concat(this.urlParams()).map(function (e) {
605
- return encodeURIComponent(e.key) + "=" + encodeURIComponent(e.value);
606
- }).join("&");
607
- return {
608
- pathname: this.urlPathname(),
609
- search: "?" + e
610
- };
611
- }, e.prototype.windowDimensions = function () {
612
- return {
613
- width: 735,
614
- height: 552
615
- };
616
- }, e.prototype.handleMessage = function (e) {
617
- switch (void 0 !== e.sequenceNumber && this.sendMessage({
618
- method: "ack",
619
- sequenceNumber: e.sequenceNumber
620
- }), e.method) {
621
- case "origin_request":
622
- this.sendMessage({
623
- method: "origin"
624
- });
625
- break;
626
-
627
- case "ready":
628
- this.sendState();
629
- break;
630
-
631
- case "error":
632
- this.options.onError && this.options.onError(e.params);
633
- break;
634
-
635
- case "close_dialog":
636
- this.onCloseDialogMessage && this.onCloseDialogMessage(), this.onCloseDialogMessage = void 0;
509
+ r = function () {
510
+ function e(o) {
511
+ if (this.origin = t, this.sendMessage = function (e) {}, this.state = {}, this.options = o, !this.options) throw new Error("options must be provided");
512
+ if (!this.options.appKey) throw new Error("appKey must be provided");
513
+ e.validateOnError(this.options.onError);
637
514
  }
638
- }, e;
639
- }();
640
-
515
+ return e.validateOnError = function (e) {
516
+ if (e && "function" != typeof e) throw new Error("onError must be a function");
517
+ }, e.prototype.setOnError = function (o) {
518
+ e.validateOnError(o), this.options.onError = o;
519
+ }, e.prototype.hasOnCloseDialogMessage = function () {
520
+ return void 0 !== this.onCloseDialogMessage;
521
+ }, e.prototype.setOnCloseDialogMessage = function (e) {
522
+ if ("function" != typeof e) throw new Error("onCloseDialogMessage must be a function");
523
+ this.onCloseDialogMessage = e;
524
+ }, e.prototype.sendState = function () {
525
+ this.sendMessage({
526
+ method: "state",
527
+ params: this.state
528
+ });
529
+ }, e.prototype.url = function () {
530
+ var e = [{
531
+ key: "app_key",
532
+ value: this.options.appKey
533
+ }, {
534
+ key: "origin",
535
+ value: this.origin
536
+ }].concat(this.urlParams()).map(function (e) {
537
+ return encodeURIComponent(e.key) + "=" + encodeURIComponent(e.value);
538
+ }).join("&");
539
+ return {
540
+ pathname: this.urlPathname(),
541
+ search: "?" + e
542
+ };
543
+ }, e.prototype.windowDimensions = function () {
544
+ return {
545
+ width: 735,
546
+ height: 552
547
+ };
548
+ }, e.prototype.handleMessage = function (e) {
549
+ switch (void 0 !== e.sequenceNumber && this.sendMessage({
550
+ method: "ack",
551
+ sequenceNumber: e.sequenceNumber
552
+ }), e.method) {
553
+ case "origin_request":
554
+ this.sendMessage({
555
+ method: "origin"
556
+ });
557
+ break;
558
+ case "ready":
559
+ this.sendState();
560
+ break;
561
+ case "error":
562
+ this.options.onError && this.options.onError(e.params);
563
+ break;
564
+ case "close_dialog":
565
+ this.onCloseDialogMessage && this.onCloseDialogMessage(), this.onCloseDialogMessage = void 0;
566
+ }
567
+ }, e;
568
+ }();
641
569
  o.Dropin = r;
642
570
  }, function (e, o, n) {
643
571
  "use strict";
644
572
 
645
573
  var _t,
646
- r = this && this.__extends || (_t = function t(e, o) {
647
- return (_t = Object.setPrototypeOf || {
648
- __proto__: []
649
- } instanceof Array && function (e, o) {
650
- e.__proto__ = o;
651
- } || function (e, o) {
652
- for (var n in o) {
653
- o.hasOwnProperty(n) && (e[n] = o[n]);
574
+ r = this && this.__extends || (_t = function t(e, o) {
575
+ return (_t = Object.setPrototypeOf || {
576
+ __proto__: []
577
+ } instanceof Array && function (e, o) {
578
+ e.__proto__ = o;
579
+ } || function (e, o) {
580
+ for (var n in o) {
581
+ o.hasOwnProperty(n) && (e[n] = o[n]);
582
+ }
583
+ })(e, o);
584
+ }, function (e, o) {
585
+ function n() {
586
+ this.constructor = e;
654
587
  }
655
- })(e, o);
656
- }, function (e, o) {
657
- function n() {
658
- this.constructor = e;
659
- }
660
-
661
- _t(e, o), e.prototype = null === o ? Object.create(o) : (n.prototype = o.prototype, new n());
662
- });
663
-
588
+ _t(e, o), e.prototype = null === o ? Object.create(o) : (n.prototype = o.prototype, new n());
589
+ });
664
590
  Object.defineProperty(o, "__esModule", {
665
591
  value: !0
666
592
  });
667
-
668
593
  var i = "https://www.dropbox.com/developers/dropins/chooser/js",
669
- s = ["text", "documents", "images", "video", "audio"],
670
- a = function (e) {
671
- function o(o) {
672
- var n = e.call(this, o) || this;
673
- return n.validateOptions = function () {
674
- var e = function e(_e2, o) {
675
- if (void 0 !== n.options[_e2] && (0, _typeof2.default)(n.options[_e2]) !== o) throw new Error("The " + _e2 + " option, if provided, must have type " + o);
676
- };
677
-
678
- if (e("linkType", "string"), e("_trigger", "string"), void 0 !== n.options.extensions) {
679
- if (!(n.options.extensions instanceof Array)) throw new Error("The extensions option, if provided, must be an array");
680
-
681
- for (var o = 0, t = n.options.extensions; o < t.length; o++) {
682
- var r = t[o];
683
- if ("string" != typeof r || !r.match(/^\.[\.\w$#&+@!()\-'`_~]+$/) && -1 === s.indexOf(r)) throw new Error("The provided list of extensions or file types is not valid. See Chooser documentation: " + i + ". Available file types are: " + s.join(", "));
594
+ s = ["text", "documents", "images", "video", "audio"],
595
+ a = function (e) {
596
+ function o(o) {
597
+ var n = e.call(this, o) || this;
598
+ return n.validateOptions = function () {
599
+ var e = function e(_e2, o) {
600
+ if (void 0 !== n.options[_e2] && (0, _typeof2.default)(n.options[_e2]) !== o) throw new Error("The " + _e2 + " option, if provided, must have type " + o);
601
+ };
602
+ if (e("linkType", "string"), e("_trigger", "string"), void 0 !== n.options.extensions) {
603
+ if (!(n.options.extensions instanceof Array)) throw new Error("The extensions option, if provided, must be an array");
604
+ for (var o = 0, t = n.options.extensions; o < t.length; o++) {
605
+ var r = t[o];
606
+ if ("string" != typeof r || !r.match(/^\.[\.\w$#&+@!()\-'`_~]+$/) && -1 === s.indexOf(r)) throw new Error("The provided list of extensions or file types is not valid. See Chooser documentation: " + i + ". Available file types are: " + s.join(", "));
607
+ }
684
608
  }
685
- }
686
-
687
- if (e("multiselect", "boolean"), e("iframe", "boolean"), e("folderselect", "boolean"), e("fileselect", "boolean"), void 0 !== n.options.fileselect && !n.options.fileselect && !n.options.folderselect) throw new Error("You must enable either fileselect or folderselect on the Chooser so the user can select something");
688
- if (e("sizeLimit", "number"), void 0 !== n.options.sizeLimit && n.options.sizeLimit <= 0) throw new Error("The sizeLimit option, if provided, must be a positive number");
689
- var a = n.options.initialNavigation;
690
-
691
- if (void 0 !== a) {
692
- if (void 0 !== a.mode && "string" != typeof a.mode) throw new Error("The initialNavigation.mode option, if provided, must be a string");
693
- if (void 0 !== a.role && "string" != typeof a.role) throw new Error("The initialNavigation.role option, if provided, must be a string");
694
- if (void 0 !== a.cursor && "string" != typeof a.cursor) throw new Error("The initialNavigation.cursor option, if provided, must be a string");
695
- }
696
-
697
- if (e("initialViewType", "string"), void 0 !== n.options.fields) {
698
- if (!(n.options.fields instanceof Array)) throw new Error("The fields option, if provided, must be an array");
699
-
700
- for (var c = 0, l = n.options.fields; c < l.length; c++) {
701
- if ("string" != typeof l[c]) throw new Error("The fields option, if provided, must be an array of strings");
609
+ if (e("multiselect", "boolean"), e("iframe", "boolean"), e("folderselect", "boolean"), e("fileselect", "boolean"), void 0 !== n.options.fileselect && !n.options.fileselect && !n.options.folderselect) throw new Error("You must enable either fileselect or folderselect on the Chooser so the user can select something");
610
+ if (e("sizeLimit", "number"), void 0 !== n.options.sizeLimit && n.options.sizeLimit <= 0) throw new Error("The sizeLimit option, if provided, must be a positive number");
611
+ var a = n.options.initialNavigation;
612
+ if (void 0 !== a) {
613
+ if (void 0 !== a.mode && "string" != typeof a.mode) throw new Error("The initialNavigation.mode option, if provided, must be a string");
614
+ if (void 0 !== a.role && "string" != typeof a.role) throw new Error("The initialNavigation.role option, if provided, must be a string");
615
+ if (void 0 !== a.cursor && "string" != typeof a.cursor) throw new Error("The initialNavigation.cursor option, if provided, must be a string");
702
616
  }
703
- }
704
-
705
- if (e("showSignOut", "boolean"), e("version", "string"), e("cl", "string"), "function" != typeof n.options.onSuccess) throw new Error("You must provide a success callback to the Chooser to see the files that the user selects");
706
- e("onReady", "function"), e("onCancel", "function"), e("onError", "function"), e("onResize", "function");
707
- }, n.validateOptions(), n;
708
- }
709
-
710
- return r(o, e), o.prototype.urlParams = function () {
711
- var e = [],
617
+ if (e("initialViewType", "string"), void 0 !== n.options.fields) {
618
+ if (!(n.options.fields instanceof Array)) throw new Error("The fields option, if provided, must be an array");
619
+ for (var c = 0, l = n.options.fields; c < l.length; c++) {
620
+ if ("string" != typeof l[c]) throw new Error("The fields option, if provided, must be an array of strings");
621
+ }
622
+ }
623
+ if (e("showSignOut", "boolean"), e("version", "string"), e("cl", "string"), "function" != typeof n.options.onSuccess) throw new Error("You must provide a success callback to the Chooser to see the files that the user selects");
624
+ e("onReady", "function"), e("onCancel", "function"), e("onError", "function"), e("onResize", "function");
625
+ }, n.validateOptions(), n;
626
+ }
627
+ return r(o, e), o.prototype.urlParams = function () {
628
+ var e = [],
712
629
  o = function o(_o, n) {
713
- void 0 !== n && e.push({
714
- key: _o,
715
- value: "" + n
716
- });
717
- };
718
-
719
- return o("link_type", this.options.linkType), e.push({
720
- key: "trigger",
721
- value: this.options._trigger || "js"
722
- }), void 0 !== this.options.extensions && e.push({
723
- key: "extensions",
724
- value: this.options.extensions.join(" ")
725
- }), o("multiselect", this.options.multiselect), o("iframe", this.options.iframe), o("folderselect", this.options.folderselect), o("fileselect", this.options.fileselect), o("size_limit", this.options.sizeLimit), void 0 !== this.options.initialNavigation && (o("initial_navigation_mode", this.options.initialNavigation.mode), o("initial_navigation_role", this.options.initialNavigation.role), o("initial_navigation_cursor", this.options.initialNavigation.cursor)), o("initial_view_type", this.options.initialViewType), void 0 !== this.options.fields && e.push({
726
- key: "fields",
727
- value: this.options.fields.join(" ")
728
- }), o("show_sign_out", this.options.showSignOut), o("version", this.options.version), o("cl", this.options.cl), e;
729
- }, o.prototype.urlPathname = function () {
730
- return "/chooser";
731
- }, o.prototype.close = function () {
732
- "function" == typeof this.onCloseDialogMessage && this.onCloseDialogMessage();
733
- }, o.prototype.handleMessage = function (o) {
734
- switch (e.prototype.handleMessage.call(this, o), o.method) {
735
- case "ready":
736
- void 0 !== this.options.onReady && this.options.onReady();
737
- break;
738
-
739
- case "files_selected":
740
- this.close(), this.options.onSuccess(o.params, this.lastNavigation);
741
- break;
742
-
743
- case "cursor_changed":
744
- this.lastNavigation = {
745
- cursor: o.params
630
+ void 0 !== n && e.push({
631
+ key: _o,
632
+ value: "" + n
633
+ });
746
634
  };
747
- break;
748
-
749
- case "close_dialog":
750
- void 0 !== this.options.onCancel && this.options.onCancel(this.lastNavigation);
751
- break;
752
-
753
- case "resize":
754
- void 0 !== this.options.onResize && this.options.onResize(o.params);
755
- break;
756
-
757
- case "error":
758
- this.close();
759
- break;
760
-
761
- case "_debug_log":
762
- void 0 !== console && null !== console && console.log(o.params.msg);
763
- }
764
- }, o;
765
- }(n(2).Dropin);
766
-
635
+ return o("link_type", this.options.linkType), e.push({
636
+ key: "trigger",
637
+ value: this.options._trigger || "js"
638
+ }), void 0 !== this.options.extensions && e.push({
639
+ key: "extensions",
640
+ value: this.options.extensions.join(" ")
641
+ }), o("multiselect", this.options.multiselect), o("iframe", this.options.iframe), o("folderselect", this.options.folderselect), o("fileselect", this.options.fileselect), o("size_limit", this.options.sizeLimit), void 0 !== this.options.initialNavigation && (o("initial_navigation_mode", this.options.initialNavigation.mode), o("initial_navigation_role", this.options.initialNavigation.role), o("initial_navigation_cursor", this.options.initialNavigation.cursor)), o("initial_view_type", this.options.initialViewType), void 0 !== this.options.fields && e.push({
642
+ key: "fields",
643
+ value: this.options.fields.join(" ")
644
+ }), o("show_sign_out", this.options.showSignOut), o("version", this.options.version), o("cl", this.options.cl), e;
645
+ }, o.prototype.urlPathname = function () {
646
+ return "/chooser";
647
+ }, o.prototype.close = function () {
648
+ "function" == typeof this.onCloseDialogMessage && this.onCloseDialogMessage();
649
+ }, o.prototype.handleMessage = function (o) {
650
+ switch (e.prototype.handleMessage.call(this, o), o.method) {
651
+ case "ready":
652
+ void 0 !== this.options.onReady && this.options.onReady();
653
+ break;
654
+ case "files_selected":
655
+ this.close(), this.options.onSuccess(o.params, this.lastNavigation);
656
+ break;
657
+ case "cursor_changed":
658
+ this.lastNavigation = {
659
+ cursor: o.params
660
+ };
661
+ break;
662
+ case "close_dialog":
663
+ void 0 !== this.options.onCancel && this.options.onCancel(this.lastNavigation);
664
+ break;
665
+ case "resize":
666
+ void 0 !== this.options.onResize && this.options.onResize(o.params);
667
+ break;
668
+ case "error":
669
+ this.close();
670
+ break;
671
+ case "_debug_log":
672
+ void 0 !== console && null !== console && console.log(o.params.msg);
673
+ }
674
+ }, o;
675
+ }(n(2).Dropin);
767
676
  o.BaseChooser = a;
768
-
769
677
  var c = function (e) {
770
678
  function o(o) {
771
679
  return e.call(this, o) || this;
772
680
  }
773
-
774
681
  return r(o, e), o;
775
682
  }(a);
776
-
777
683
  o.Chooser = c;
778
684
  },,, function (e, o, n) {
779
685
  "use strict";
@@ -788,12 +694,11 @@ Please reach out to the Editor team if you need more information
788
694
  value: !0
789
695
  });
790
696
  var t = n(8),
791
- r = n(1),
792
- i = n(3),
793
- s = n(10),
794
- a = n(11),
795
- c = n(12);
796
-
697
+ r = n(1),
698
+ i = n(3),
699
+ s = n(10),
700
+ a = n(11),
701
+ c = n(12);
797
702
  o.initModule = function () {
798
703
  r.initModule(), Dropbox.VERSION = "2";
799
704
  var e = new t.BrowserEnvironment();
@@ -822,7 +727,6 @@ Please reach out to the Editor team if you need more information
822
727
  value: !0
823
728
  });
824
729
  var t = n(9);
825
-
826
730
  function r(e) {
827
731
  return function () {
828
732
  for (var o = 0, n = e; o < n.length; o++) {
@@ -830,113 +734,101 @@ Please reach out to the Editor team if you need more information
830
734
  }
831
735
  };
832
736
  }
833
-
834
737
  o.TARGET_ORIGIN = "https://www.dropbox.com";
835
-
836
738
  var i = function i() {},
837
- s = function () {
838
- function e() {
839
- var e = this;
840
- this.activeDropins = [], this.deleteActiveDropin = function (o) {
841
- return function () {
842
- var n = e.activeDropins.indexOf(o);
843
- -1 !== n && e.activeDropins.splice(n, 1);
844
- };
845
- }, this.openWindow = function (n) {
846
- e.throwIfAlreadyActive(n);
847
- var s = r([]);
848
-
849
- try {
850
- var a = n.url(),
739
+ s = function () {
740
+ function e() {
741
+ var e = this;
742
+ this.activeDropins = [], this.deleteActiveDropin = function (o) {
743
+ return function () {
744
+ var n = e.activeDropins.indexOf(o);
745
+ -1 !== n && e.activeDropins.splice(n, 1);
746
+ };
747
+ }, this.openWindow = function (n) {
748
+ e.throwIfAlreadyActive(n);
749
+ var s = r([]);
750
+ try {
751
+ var a = n.url(),
851
752
  c = "" + o.TARGET_ORIGIN + a.pathname + a.search,
852
753
  l = t.PopupEnvironment.open(c, n.windowDimensions(), function () {
853
- s();
854
- });
855
- s = r([l.stopInterval, s]);
856
- var u = e.attach(n, l.messagingWindow);
857
- s = r([function () {
858
- n.sendMessage({
859
- method: "close"
860
- });
861
- }, s = r([u, s])]);
862
- var p = {
863
- dropin: n,
754
+ s();
755
+ });
756
+ s = r([l.stopInterval, s]);
757
+ var u = e.attach(n, l.messagingWindow);
758
+ s = r([function () {
759
+ n.sendMessage({
760
+ method: "close"
761
+ });
762
+ }, s = r([u, s])]);
763
+ var p = {
764
+ dropin: n,
765
+ cleanup: i
766
+ };
767
+ e.activeDropins.push(p), s = r([e.deleteActiveDropin(p), s]), n.hasOnCloseDialogMessage() || n.setOnCloseDialogMessage(s), p.cleanup = s;
768
+ } catch (e) {
769
+ throw s(), e;
770
+ }
771
+ };
772
+ }
773
+ return e.prototype.mount = function (e, n) {
774
+ if (!e) throw new Error("Dropbox component must be provided");
775
+ if (!n) throw new Error("Container element must be provided");
776
+ this.throwIfAlreadyActive(e);
777
+ var t = r([]);
778
+ try {
779
+ var s = this.createIframe();
780
+ t = r([this.attach(e, function () {
781
+ if (!s.contentWindow) throw new Error("iframe does not contain a contentWindow");
782
+ return s.contentWindow;
783
+ }), t]);
784
+ var a = e.url();
785
+ s.src = "" + o.TARGET_ORIGIN + a.pathname + a.search + "&iframe=true", n.appendChild(s), t = r([function () {
786
+ n.removeChild(s);
787
+ }, t]);
788
+ var c = {
789
+ dropin: e,
864
790
  cleanup: i
865
791
  };
866
- e.activeDropins.push(p), s = r([e.deleteActiveDropin(p), s]), n.hasOnCloseDialogMessage() || n.setOnCloseDialogMessage(s), p.cleanup = s;
792
+ this.activeDropins.push(c), t = r([this.deleteActiveDropin(c), t]), e.hasOnCloseDialogMessage() || e.setOnCloseDialogMessage(t), c.cleanup = t;
867
793
  } catch (e) {
868
- throw s(), e;
869
- }
870
- };
871
- }
872
-
873
- return e.prototype.mount = function (e, n) {
874
- if (!e) throw new Error("Dropbox component must be provided");
875
- if (!n) throw new Error("Container element must be provided");
876
- this.throwIfAlreadyActive(e);
877
- var t = r([]);
878
-
879
- try {
880
- var s = this.createIframe();
881
- t = r([this.attach(e, function () {
882
- if (!s.contentWindow) throw new Error("iframe does not contain a contentWindow");
883
- return s.contentWindow;
884
- }), t]);
885
- var a = e.url();
886
- s.src = "" + o.TARGET_ORIGIN + a.pathname + a.search + "&iframe=true", n.appendChild(s), t = r([function () {
887
- n.removeChild(s);
888
- }, t]);
889
- var c = {
890
- dropin: e,
891
- cleanup: i
892
- };
893
- this.activeDropins.push(c), t = r([this.deleteActiveDropin(c), t]), e.hasOnCloseDialogMessage() || e.setOnCloseDialogMessage(t), c.cleanup = t;
894
- } catch (e) {
895
- throw t(), e;
896
- }
897
- }, e.prototype.remove = function (e) {
898
- if (!e) throw new Error("Dropbox component must be provided");
899
-
900
- for (var o = 0, n = this.activeDropins; o < n.length; o++) {
901
- var t = n[o];
902
-
903
- if (t.dropin === e) {
904
- t.cleanup();
905
- break;
794
+ throw t(), e;
906
795
  }
907
- }
908
- }, e.prototype.throwIfAlreadyActive = function (e) {
909
- for (var o = 0, n = this.activeDropins; o < n.length; o++) {
910
- if (n[o].dropin === e) throw new Error("Component is already in use");
911
- }
912
- }, e.prototype.attach = function (e, n) {
913
- e.sendMessage = function (e) {
914
- n().postMessage(JSON.stringify(e), o.TARGET_ORIGIN);
915
- };
916
-
917
- var t = function t(_t2) {
918
- if (_t2.source === n() && _t2.origin === o.TARGET_ORIGIN) {
919
- var r, i;
920
-
921
- try {
922
- r = JSON.parse(_t2.data);
923
- } catch (e) {
924
- return;
796
+ }, e.prototype.remove = function (e) {
797
+ if (!e) throw new Error("Dropbox component must be provided");
798
+ for (var o = 0, n = this.activeDropins; o < n.length; o++) {
799
+ var t = n[o];
800
+ if (t.dropin === e) {
801
+ t.cleanup();
802
+ break;
925
803
  }
926
-
927
- "object" == (0, _typeof2.default)(i = r) && "string" == typeof i.method && e.handleMessage(r);
928
804
  }
929
- };
930
-
931
- return window.addEventListener("message", t), function () {
932
- e.sendMessage = i, window.removeEventListener("message", t);
933
- };
934
- }, e.prototype.createIframe = function () {
935
- var e = window.document.createElement("iframe");
936
- return e.style.height = "100%", e.style.width = "100%", e.style.border = "none", e;
937
- }, e;
938
- }();
939
-
805
+ }, e.prototype.throwIfAlreadyActive = function (e) {
806
+ for (var o = 0, n = this.activeDropins; o < n.length; o++) {
807
+ if (n[o].dropin === e) throw new Error("Component is already in use");
808
+ }
809
+ }, e.prototype.attach = function (e, n) {
810
+ e.sendMessage = function (e) {
811
+ n().postMessage(JSON.stringify(e), o.TARGET_ORIGIN);
812
+ };
813
+ var t = function t(_t2) {
814
+ if (_t2.source === n() && _t2.origin === o.TARGET_ORIGIN) {
815
+ var r, i;
816
+ try {
817
+ r = JSON.parse(_t2.data);
818
+ } catch (e) {
819
+ return;
820
+ }
821
+ "object" == (0, _typeof2.default)(i = r) && "string" == typeof i.method && e.handleMessage(r);
822
+ }
823
+ };
824
+ return window.addEventListener("message", t), function () {
825
+ e.sendMessage = i, window.removeEventListener("message", t);
826
+ };
827
+ }, e.prototype.createIframe = function () {
828
+ var e = window.document.createElement("iframe");
829
+ return e.style.height = "100%", e.style.width = "100%", e.style.border = "none", e;
830
+ }, e;
831
+ }();
940
832
  o.BrowserEnvironment = s;
941
833
  }, function (e, o, n) {
942
834
  "use strict";
@@ -944,67 +836,59 @@ Please reach out to the Editor team if you need more information
944
836
  Object.defineProperty(o, "__esModule", {
945
837
  value: !0
946
838
  });
947
-
948
839
  var t = n(0),
949
- r = function () {
950
- function e(e, o) {
951
- var n = this;
952
- this.popupWindow = e, this.onClose = o, this.stopInterval = function () {
953
- clearInterval(n.intervalId);
954
- }, this.isWindowClosedByUser = function () {
955
- try {
956
- return n.popupWindow.closed;
957
- } catch (e) {}
958
-
959
- return !1;
960
- }, this.messagingWindow = function () {
961
- return void 0 !== t.ieframe && null !== t.ieframe ? t.ieframe.contentWindow : n.popupWindow;
962
- }, this.handleInterval = function () {
963
- n.isWindowClosedByUser() && (n.onClose(), n.stopInterval());
964
- }, this.intervalId = setInterval(this.handleInterval, 100);
965
- }
966
-
967
- return e.open = function (o, n, r) {
968
- var i = t.popupDimensionsString(n.width, n.height) + ",resizable,scrollbars",
840
+ r = function () {
841
+ function e(e, o) {
842
+ var n = this;
843
+ this.popupWindow = e, this.onClose = o, this.stopInterval = function () {
844
+ clearInterval(n.intervalId);
845
+ }, this.isWindowClosedByUser = function () {
846
+ try {
847
+ return n.popupWindow.closed;
848
+ } catch (e) {}
849
+ return !1;
850
+ }, this.messagingWindow = function () {
851
+ return void 0 !== t.ieframe && null !== t.ieframe ? t.ieframe.contentWindow : n.popupWindow;
852
+ }, this.handleInterval = function () {
853
+ n.isWindowClosedByUser() && (n.onClose(), n.stopInterval());
854
+ }, this.intervalId = setInterval(this.handleInterval, 100);
855
+ }
856
+ return e.open = function (o, n, r) {
857
+ var i = t.popupDimensionsString(n.width, n.height) + ",resizable,scrollbars",
969
858
  s = window.open(o, "_blank", i);
970
- if (null === s) throw new Error("Failed to open the window. Dropbox popups may only be attached to a user-triggered event handler such as a tap or click event.");
971
- return s.focus(), new e(s, r);
972
- }, e;
973
- }();
974
-
859
+ if (null === s) throw new Error("Failed to open the window. Dropbox popups may only be attached to a user-triggered event handler such as a tap or click event.");
860
+ return s.focus(), new e(s, r);
861
+ }, e;
862
+ }();
975
863
  o.PopupEnvironment = r;
976
864
  }, function (e, o, n) {
977
865
  "use strict";
978
866
 
979
867
  var _t3,
980
- r = this && this.__extends || (_t3 = function t(e, o) {
981
- return (_t3 = Object.setPrototypeOf || {
982
- __proto__: []
983
- } instanceof Array && function (e, o) {
984
- e.__proto__ = o;
985
- } || function (e, o) {
986
- for (var n in o) {
987
- o.hasOwnProperty(n) && (e[n] = o[n]);
868
+ r = this && this.__extends || (_t3 = function t(e, o) {
869
+ return (_t3 = Object.setPrototypeOf || {
870
+ __proto__: []
871
+ } instanceof Array && function (e, o) {
872
+ e.__proto__ = o;
873
+ } || function (e, o) {
874
+ for (var n in o) {
875
+ o.hasOwnProperty(n) && (e[n] = o[n]);
876
+ }
877
+ })(e, o);
878
+ }, function (e, o) {
879
+ function n() {
880
+ this.constructor = e;
988
881
  }
989
- })(e, o);
990
- }, function (e, o) {
991
- function n() {
992
- this.constructor = e;
993
- }
994
-
995
- _t3(e, o), e.prototype = null === o ? Object.create(o) : (n.prototype = o.prototype, new n());
996
- });
997
-
882
+ _t3(e, o), e.prototype = null === o ? Object.create(o) : (n.prototype = o.prototype, new n());
883
+ });
998
884
  Object.defineProperty(o, "__esModule", {
999
885
  value: !0
1000
886
  });
1001
-
1002
887
  var i = function (e) {
1003
888
  function o(o) {
1004
889
  var n = e.call(this, o) || this;
1005
890
  return n.validateNoOptionLinkType(), n;
1006
891
  }
1007
-
1008
892
  return r(o, e), o.prototype.validateNoOptionLinkType = function () {
1009
893
  if (void 0 !== this.options.linkType) throw new Error("The ZoomChooser SDK does not accept a linkType.");
1010
894
  }, o.prototype.urlParams = function () {
@@ -1015,45 +899,40 @@ Please reach out to the Editor team if you need more information
1015
899
  }), o;
1016
900
  }, o;
1017
901
  }(n(3).BaseChooser);
1018
-
1019
902
  o.ZoomChooser = i;
1020
903
  }, function (e, o, n) {
1021
904
  "use strict";
1022
905
 
1023
906
  var _t4,
1024
- r = this && this.__extends || (_t4 = function t(e, o) {
1025
- return (_t4 = Object.setPrototypeOf || {
1026
- __proto__: []
1027
- } instanceof Array && function (e, o) {
1028
- e.__proto__ = o;
1029
- } || function (e, o) {
1030
- for (var n in o) {
1031
- o.hasOwnProperty(n) && (e[n] = o[n]);
1032
- }
1033
- })(e, o);
1034
- }, function (e, o) {
1035
- function n() {
1036
- this.constructor = e;
1037
- }
1038
-
1039
- _t4(e, o), e.prototype = null === o ? Object.create(o) : (n.prototype = o.prototype, new n());
1040
- }),
1041
- i = this && this.__assign || function () {
1042
- return (i = Object.assign || function (e) {
1043
- for (var o, n = 1, t = arguments.length; n < t; n++) {
1044
- for (var r in o = arguments[n]) {
1045
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
907
+ r = this && this.__extends || (_t4 = function t(e, o) {
908
+ return (_t4 = Object.setPrototypeOf || {
909
+ __proto__: []
910
+ } instanceof Array && function (e, o) {
911
+ e.__proto__ = o;
912
+ } || function (e, o) {
913
+ for (var n in o) {
914
+ o.hasOwnProperty(n) && (e[n] = o[n]);
1046
915
  }
916
+ })(e, o);
917
+ }, function (e, o) {
918
+ function n() {
919
+ this.constructor = e;
1047
920
  }
1048
-
1049
- return e;
1050
- }).apply(this, arguments);
1051
- };
1052
-
921
+ _t4(e, o), e.prototype = null === o ? Object.create(o) : (n.prototype = o.prototype, new n());
922
+ }),
923
+ i = this && this.__assign || function () {
924
+ return (i = Object.assign || function (e) {
925
+ for (var o, n = 1, t = arguments.length; n < t; n++) {
926
+ for (var r in o = arguments[n]) {
927
+ Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
928
+ }
929
+ }
930
+ return e;
931
+ }).apply(this, arguments);
932
+ };
1053
933
  Object.defineProperty(o, "__esModule", {
1054
934
  value: !0
1055
935
  });
1056
-
1057
936
  var s = function (e) {
1058
937
  function o(n) {
1059
938
  var t = e.call(this, n) || this;
@@ -1062,7 +941,6 @@ Please reach out to the Editor team if you need more information
1062
941
  initialFolderSelection: t.options.initialFolderSelection
1063
942
  }, t.onSuccess = t.options.onSuccess, t.onCancel = t.options.onCancel, t;
1064
943
  }
1065
-
1066
944
  return r(o, e), o.validateOnSuccess = function (e) {
1067
945
  if (e && "function" != typeof e) throw new Error("onSuccess must be a function");
1068
946
  }, o.validateOnCancel = function (e) {
@@ -1082,7 +960,6 @@ Please reach out to the Editor team if you need more information
1082
960
  case "success":
1083
961
  this.onSuccess && this.onSuccess();
1084
962
  break;
1085
-
1086
963
  case "cancel":
1087
964
  this.onCancel && this.onCancel();
1088
965
  }
@@ -1100,45 +977,40 @@ Please reach out to the Editor team if you need more information
1100
977
  o.validateOnCancel(e), this.onCancel = e;
1101
978
  }, o;
1102
979
  }(n(2).Dropin);
1103
-
1104
980
  o.Mover = s;
1105
981
  }, function (e, o, n) {
1106
982
  "use strict";
1107
983
 
1108
984
  var _t5,
1109
- r = this && this.__extends || (_t5 = function t(e, o) {
1110
- return (_t5 = Object.setPrototypeOf || {
1111
- __proto__: []
1112
- } instanceof Array && function (e, o) {
1113
- e.__proto__ = o;
1114
- } || function (e, o) {
1115
- for (var n in o) {
1116
- o.hasOwnProperty(n) && (e[n] = o[n]);
1117
- }
1118
- })(e, o);
1119
- }, function (e, o) {
1120
- function n() {
1121
- this.constructor = e;
1122
- }
1123
-
1124
- _t5(e, o), e.prototype = null === o ? Object.create(o) : (n.prototype = o.prototype, new n());
1125
- }),
1126
- i = this && this.__assign || function () {
1127
- return (i = Object.assign || function (e) {
1128
- for (var o, n = 1, t = arguments.length; n < t; n++) {
1129
- for (var r in o = arguments[n]) {
1130
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
985
+ r = this && this.__extends || (_t5 = function t(e, o) {
986
+ return (_t5 = Object.setPrototypeOf || {
987
+ __proto__: []
988
+ } instanceof Array && function (e, o) {
989
+ e.__proto__ = o;
990
+ } || function (e, o) {
991
+ for (var n in o) {
992
+ o.hasOwnProperty(n) && (e[n] = o[n]);
1131
993
  }
994
+ })(e, o);
995
+ }, function (e, o) {
996
+ function n() {
997
+ this.constructor = e;
1132
998
  }
1133
-
1134
- return e;
1135
- }).apply(this, arguments);
1136
- };
1137
-
999
+ _t5(e, o), e.prototype = null === o ? Object.create(o) : (n.prototype = o.prototype, new n());
1000
+ }),
1001
+ i = this && this.__assign || function () {
1002
+ return (i = Object.assign || function (e) {
1003
+ for (var o, n = 1, t = arguments.length; n < t; n++) {
1004
+ for (var r in o = arguments[n]) {
1005
+ Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
1006
+ }
1007
+ }
1008
+ return e;
1009
+ }).apply(this, arguments);
1010
+ };
1138
1011
  Object.defineProperty(o, "__esModule", {
1139
1012
  value: !0
1140
1013
  });
1141
-
1142
1014
  var s = function (e) {
1143
1015
  function o(o) {
1144
1016
  void 0 === o && (o = {});
@@ -1152,7 +1024,6 @@ Please reach out to the Editor team if you need more information
1152
1024
  openLinksWithSDK: !!n.options.onOpenLink
1153
1025
  }, n;
1154
1026
  }
1155
-
1156
1027
  return r(o, e), o.prototype.urlPathname = function () {
1157
1028
  return "/dropins/previewer";
1158
1029
  }, o.prototype.urlParams = function () {
@@ -1180,15 +1051,12 @@ Please reach out to the Editor team if you need more information
1180
1051
  view: n
1181
1052
  }), this.options.onViewChange && this.options.onViewChange(n);
1182
1053
  break;
1183
-
1184
1054
  case "open_link":
1185
1055
  this.options.onOpenLink && this.options.onOpenLink(o.params.link);
1186
1056
  break;
1187
-
1188
1057
  case "update_size":
1189
1058
  this.options.onSizeChanged && this.options.onSizeChanged(o.params);
1190
1059
  break;
1191
-
1192
1060
  default:
1193
1061
  e.prototype.handleMessage.call(this, o);
1194
1062
  }
@@ -1210,7 +1078,6 @@ Please reach out to the Editor team if you need more information
1210
1078
  }), this.sendState();
1211
1079
  }, o;
1212
1080
  }(n(2).Dropin);
1213
-
1214
1081
  o.Previewer = s;
1215
1082
  }]));
1216
1083
  var _default = {};