var gcs=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t,n){(function(t,n){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.4+314e4831 */var r;r=function(){"use strict";function e(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,i=void 0,a=void 0,s=function(e,t){m[o]=e,m[o+1]=t,2===(o+=2)&&(a?a(h):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},l=u.MutationObserver||u.WebKitMutationObserver,d="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function f(){var e=setTimeout;return function(){return e(h,1)}}var m=new Array(1e3);function h(){for(var e=0;e"+e+"

",document.body.appendChild(n),setTimeout(function(){n.style.opacity="0",setTimeout(function(){n.parentNode.removeChild(n)},1e3)},1e3*t)},e.prototype.getStorageIconPath=function(e){if(null==this.iconsRelativeDirectory||void 0==this.iconsRelativeDirectory)return null;var t=this.iconsRelativeDirectory;switch(e){case"GoGoogleDrive":t+="googleDrive.jpg";break;case"GoOneDrive":t+="oneDrive.png";break;case"GoLocalStorage":t+="localStorage.png";break;case"GoDropBox":t+="dropBox.png"}return t},e.prototype.selectStorageService=function(){var e=this,t=this.storages;return new i.Promise(function(n,r){var o=e.menu;o.innerHTML="Select Storage Service
";var i=document.createElement("p");i.id="gcsmSelectedStorage",i.innerHTML=e.currentStorage.serviceName,o.appendChild(i),o.onchange=function(){for(var e=document.getElementsByName("storageSelection"),n=null,r=0;r"}),o.appendChild(a);o.innerHTML+="

This will be where you save / load diagram model data to / from. You will need to grant GoCloudStorage permission to access your files on the selected storage service.

";var s=document.createElement("div"),c=document.createElement("button");c.id="actionButton",c.textContent="Select",c.onclick=function(){for(var t=document.getElementsByName("storageSelection"),r=null,o=0;o
",document.getElementsByTagName("body")[0].appendChild(o),o.style.visibility="visible";var s=document.createElement("div");s.id="fileOptions";var c=[],u=(t._MIN_FILES_IN_UI,0),l=!1;return r.getFiles().then(function(t){if(0!==t.length)for(var a in t){var d=t[a];if(c.length":"
"}if(!l){var v=n+50;s.innerHTML+="

There may be more diagram files not shown. Click here to try loading more.

",document.getElementById("netCoreLoadMoreFiles").onclick=function(){r.showUI(e,v)}}if(o.appendChild(s),r.currentDiagramFile.id){var g=document.getElementById(r.currentDiagramFile.id+"-label");g&&(g.style.fontStyle="italic")}if("Save"===e){var y=document.createElement("div");y.id="userInputDiv",y.innerHTML+='Save Diagram As ',o.appendChild(y)}var w=document.createElement("div");w.id="submitDiv";var _=document.createElement("button");_.textContent=e,_.id="actionButton",_.onclick=function(){r.processUIResult(e)},w.appendChild(_),o.appendChild(w);var b=document.createElement("div"),P=document.createElement("button");P.id="cancelButton",P.textContent="Cancel",P.onclick=function(){r.hideUI(!0)},b.appendChild(P),o.appendChild(b)}),r._deferredPromise.promise},t.prototype.processUIResult=function(e){var t=function(){for(var e=document.getElementsByName("localStorageFile"),t=null,n=0;n=200&&o.status<300&&n(JSON.parse(o.response))},o.send()}else r("Cannot get diagram file from ASP .NET Core Web API with id "+e)})},t.prototype.getFiles=function(){var e=this;return new a.Promise(function(t,n){var r=new XMLHttpRequest;r.open("GET",e.rootEndpoint,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status>=200&&r.status<300?t(JSON.parse(r.response)):n(r.response))},r.send()})},t.prototype.checkFileExists=function(e){var t=this.rootEndpoint+e;return new a.Promise(function(e,n){var r=new XMLHttpRequest;r.open("GET",t,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status>=200&&r.status<300?e(!0):e(!1))},r.send()})},t.prototype.saveWithUI=function(){var e=this;return new a.Promise(function(t,n){t(e.showUI("Save"))})},t.prototype.save=function(e){var t=this;return new a.Promise(function(n,r){if(t.currentDiagramFile.id&&!e){var o=new XMLHttpRequest;t.getFile(t.currentDiagramFile.id).then(function(e){var i={id:t.currentDiagramFile.id,name:t.currentDiagramFile.name,file:t.makeSaveFile()},a={id:i.id,name:i.name,path:i.name};o.open("PUT",t.rootEndpoint+t.currentDiagramFile.id,!0),o.setRequestHeader("Content-Type","application/json; charset=utf-8"),o.onreadystatechange=function(){4==o.readyState&&(o.status>200&&o.status<300?n(a):r(o.responseText))},o.send(JSON.stringify(i))})}else{var i=new XMLHttpRequest,a={name:null!==e?e:"New diagram",file:t.makeSaveFile()};i.open("POST",t.rootEndpoint,!0),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),i.onreadystatechange=function(){if(4==i.readyState)if(i.status>200&&i.status<300){var e={id:JSON.parse(i.response).id,name:a.name,path:a.name};t.currentDiagramFile=e,n(e),t._deferredPromise.promise.resolve(e),t._deferredPromise.promise=t.makeDeferredPromise()}else r(i.responseText)},i.send(JSON.stringify(a))}})},t.prototype.loadWithUI=function(){var e=this;return new a.Promise(function(t,n){t(e.showUI("Load"))}).catch(function(e){throw Error(e)})},t.prototype.load=function(e){var t=this;return new a.Promise(function(n,r){if(!e)throw Error("Cannot load file from .NET Core Web API with path "+e);var o=new XMLHttpRequest;o.open("GET",t.rootEndpoint+e,!0),o.onreadystatechange=function(){if(4==o.readyState)if(o.status>=200&&o.status<300){var e=JSON.parse(o.response);t.loadFromFileContents(e.file);var i={id:e.id,path:e.name,name:e.name};t.currentDiagramFile=i,n(i),t._deferredPromise.promise.resolve(i),t._deferredPromise.promise=t.makeDeferredPromise()}else r(o.responseText)},o.send()}).catch(function(e){throw Error(e)})},t.prototype.removeWithUI=function(){var e=this;return new a.Promise(function(t,n){t(e.showUI("Delete"))})},t.prototype.remove=function(e){var t=this;return new a.Promise(function(n,r){if(!e)throw Error("Cannot delete file from local storage with id "+e);t.getFile(e).then(function(o){var i={name:o.name,path:o.name,id:e};t.currentDiagramFile&&o.name===t.currentDiagramFile.name&&(t.currentDiagramFile={name:null,path:null,id:null});var a=new XMLHttpRequest;a.open("DELETE",t.rootEndpoint+e,!0),a.onreadystatechange=function(){4==a.readyState&&(a.status>=200&&a.status<300?(n(i),t._deferredPromise.promise.resolve(i),t._deferredPromise.promise=t.makeDeferredPromise()):r(a.responseText))},a.send()})})},t._MIN_FILES_IN_UI=100,t}(i.GoCloudStorage);t.GoNetCore=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(0),s=function(e){function t(t,n,r,o){var i=e.call(this,t,r,n)||this;return i._oauthToken=null,i.ui.id="goOneDriveSavePrompt",window.OneDrive&&(i._oneDriveFilepicker=window.OneDrive),i.authorize(!1),i._serviceName="Microsoft OneDrive",i._className="GoOneDrive",i}return o(t,e),Object.defineProperty(t.prototype,"oauthToken",{get:function(){return this._oauthToken},set:function(e){this._oauthToken=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"oneDriveFilepicker",{get:function(){return this._oneDriveFilepicker},enumerable:!0,configurable:!0}),t.prototype.authorize=function(e){var t=this;return new a.Promise(function(n,r){if(e||-1===window.location.hash.indexOf("access_token")){if(e){var o="https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id="+t.clientId+"&scope=files.readwrite.all&response_type=token&redirect_uri="+window.location.href;window.location.href=o,n(!0)}}else{var i=window.location.hash.substring(window.location.hash.indexOf("=")+1,window.location.hash.indexOf("&"));t.oauthToken=i,n(!0)}})},t.prototype.getUserInfo=function(){var e=this;return new a.Promise(function(t,n){var r=new XMLHttpRequest;e.oauthToken?(r.open("GET","https://graph.microsoft.com/v1.0/me"),r.setRequestHeader("Authorization","Bearer "+e.oauthToken),r.onreadystatechange=function(){4==r.readyState&&200==r.status?t(JSON.parse(r.response)):401==r.status&&(e.authorize(!0),n(r.response))},r.send()):-1==window.location.hash.indexOf("access_token")?(n("No acessToken in current uri"),e.authorize(!0)):(n("oauthToken not set"),e.authorize(!1))})},t.prototype.checkFileExists=function(e){var t=this;return-1===e.indexOf(".diagram")&&(e+=".diagram"),new a.Promise(function(n,r){var o=new XMLHttpRequest;o.open("GET","https://graph.microsoft.com/v1.0"+e,!0),o.setRequestHeader("Authorization","Bearer "+t.oauthToken),o.onreadystatechange=function(){var e,i;4===o.readyState&&(200===o.status?e=!0:401===o.status?t.authorize(!0):404===o.status?e=!1:i=o.response,n(e),i&&r(i))},o.send()})},t.prototype.getFile=function(e,t){var n=this;return-1===e.indexOf(".diagram")&&(e+=".diagram"),new a.Promise(function(r,o){var i=new XMLHttpRequest;i.open("GET","https://graph.microsoft.com/v1.0"+e,!0);var a=t||n.oauthToken;i.setRequestHeader("Authorization","Bearer "+a),i.onreadystatechange=function(){if(4==i.readyState)if(200==i.status){var e=JSON.parse(i.response);r(e)}else 401==i.status?n.authorize(!0):o(i.response)},i.send()})},t.prototype.showUI=function(){var e=this,t=e.ui;t.innerHTML="",t.style.visibility="visible",t.innerHTML="Save Diagram As
";var n=document.createElement("div");n.id="userInputDiv",n.innerHTML+='',t.appendChild(n);var r=document.createElement("div");r.id="submitDiv";var o=document.createElement("button");o.id="actionButton",o.textContent="Save",o.onclick=function(){e.saveWithUI()},r.appendChild(o),t.appendChild(r);var i=document.createElement("div");i.id="cancelDiv";var a=document.createElement("button");return a.id="cancelButton",a.textContent="Cancel",a.onclick=function(){e.hideUI(!0)},i.appendChild(a),t.appendChild(i),e._deferredPromise.promise},t.prototype.saveWithUI=function(){var e=this,t=e.ui;return new a.Promise(function(n,r){if("hidden"===t.style.visibility)n(e.showUI());else{var o=document.getElementById("userInput").value;o&&-1===o.indexOf(".diagram")&&(o+=".diagram");var i={clientId:e.clientId,action:"query",openInNewWindow:!0,success:function(t){var n=t.value[0],r=t.accessToken;e.currentDiagramFile={id:null,name:o,token:r,parentReference:{driveId:n.parentReference.driveId,id:n.id},path:"placeholder"},e.hideUI(),e.save()}};o&&""!==o&&void 0!==o?e.oneDriveFilepicker.save(i):r("Cannot save file to OneDrive with save name "+o)}})},t.prototype.save=function(e){var t=this;return new a.Promise(function(n,r){if(e){var o=new XMLHttpRequest;-1===e.indexOf(".diagram")&&(e+=".diagram");var i=t.makeSaveFile();o.open("PUT","https://graph.microsoft.com/v1.0"+e+":/content",!0),o.setRequestHeader("Authorization","Bearer "+t.oauthToken),o.setRequestHeader("Content-Type","application/json"),o.onreadystatechange=function(){if(4==o.readyState)if(o.status>=200&&o.status<300){var e=JSON.parse(o.response),r={name:e.name,id:e.id,path:e.parentReference.path+"/"+e.name,parentReference:e.parentReference};n(r)}else{if(401!=o.status)throw Error(o.response);t.authorize(!0)}},o.send(i)}else if(t.currentDiagramFile.path){var a=t.currentDiagramFile.token,s=t.generateGraphUrl(t.currentDiagramFile,!0,!0),c=(i=t.makeSaveFile(),a?t.currentDiagramFile.token:t.oauthToken),u=new XMLHttpRequest;u.open("PUT",s,!0),u.setRequestHeader("Authorization","Bearer "+c),u.onload=function(){if(4!=u.readyState||200!=u.status&&201!=u.status)r(u.response);else{var e=JSON.parse(u.response),o={name:e.name,id:e.id,path:e.parentReference.path+"/"+e.name,token:a,parentReference:e.parentReference};t.currentDiagramFile=o,n(o),t._deferredPromise.promise.resolve(o),t._deferredPromise.promise=t.makeDeferredPromise()}},u.send(i)}else n(t.saveWithUI())})},t.prototype.loadWithUI=function(){var e=this;return new a.Promise(function(t,n){var r={clientId:e.clientId,action:"share",multiSelect:!1,advanced:{filter:".diagram"},success:function(n){var r=n.value[0],o=n.accessToken,i=r.parentReference.path+"/"+r.name;t(e.load(i,o))}};e.oneDriveFilepicker.open(r)})},t.prototype.load=function(e,t){var n=this;return new a.Promise(function(r,o){if(e){var i=t||n.oauthToken;n.getFile(e,i).then(function(e){var o=e["@microsoft.graph.downloadUrl"],i=new XMLHttpRequest;i.open("GET",o,!0),i.onreadystatechange=function(){if(4==i.readyState&&200==i.status){n.loadFromFileContents(i.response);var o={name:e.name,id:e.id,path:e.parentReference.path+"/"+e.name,token:t,parentReference:{id:e.parentReference.id,driveId:e.parentReference.driveId}};n.currentDiagramFile=o,r(o)}},i.send()})}else o("Cannot load file from OneDrive with path "+e)})},t.prototype.removeWithUI=function(){var e=this;return new a.Promise(function(t,n){var r={clientId:e.clientId,action:"share",openInNewWindow:!0,success:function(n){if(n){var r=n.value[0],o=n.accessToken,i=r.parentReference.path+"/"+r.name;t(new a.Promise(function(t,n){t(e.remove(i,o))}))}}};e.oneDriveFilepicker.open(r)})},t.prototype.remove=function(e,t){var n=this,r=t||n.oauthToken;return new a.Promise(function(t,o){n.getFile(e,r).then(function(i){var a={name:i.name,id:i.id,path:i.parentReference.path+"/"+i.name},s=new XMLHttpRequest;s.open("DELETE","https://graph.microsoft.com/v1.0"+e,!0),s.setRequestHeader("Authorization","Bearer"+r),s.onload=function(){4==s.readyState&&204==s.status?(n.currentDiagramFile&&e==n.currentDiagramFile.path&&(n.currentDiagramFile={id:null,path:null,name:null}),t(a)):401==s.status?n.authorize(!0):o(s.response)},s.send()}).catch(function(e){throw Error(e)})})},t.prototype.generateGraphUrl=function(e,t,n){var r="https://graph.microsoft.com/v1.0/";return r+=t?"drives/"+e.parentReference.driveId+"/items/"+e.parentReference.id+"/children/"+e.name:"drives/"+e.parentReference.driveId+"/items/"+e.id,n&&(r+="/content"),r},t}(i.GoCloudStorage);t.GoOneDrive=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(0),s=function(e){function t(t,n,r,o,i){var a=e.call(this,t,o,n)||this;return a._scope="https://www.googleapis.com/auth/drive",a._pickerApiKey=r,a._oauthToken=null,a._gapiClient=null,a._gapiPicker=null,a.ui.id="goGoogleDriveSavePrompt",a._serviceName="Google Drive",a._className="GoGoogleDrive",a}return o(t,e),Object.defineProperty(t.prototype,"pickerApiKey",{get:function(){return this._pickerApiKey},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scope",{get:function(){return this._scope},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gapiClient",{get:function(){return this._gapiClient},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"gapiPicker",{get:function(){return this._gapiPicker},enumerable:!0,configurable:!0}),t.prototype.authorize=function(e){void 0===e&&(e=!1);var t=this,n=null;if(window.gapi){if(n=window.gapi,e){var r=document.location.href;document.location.href="https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue="+r}return new a.Promise(function(e,r){n.load("client:auth",function(){n.auth.authorize({client_id:t.clientId,scope:t.scope,immediate:!1},function(r){r&&!r.error&&(t._oauthToken=r.access_token),t._gapiClient=n.client,window.google&&(t._gapiPicker=window.google.picker),e(!0)})}),n.load("picker",{})})}},t.prototype.createPicker=function(e){if(this._oauthToken){var t=this.clientId.substring(0,this.clientId.indexOf("-")),n=new this.gapiPicker.View(this.gapiPicker.ViewId.DOCS);n.setMimeTypes("application/json"),n.setQuery("*.diagram"),(new this.gapiPicker.PickerBuilder).enableFeature(this.gapiPicker.Feature.NAV_HIDDEN).enableFeature(this.gapiPicker.Feature.MULTISELECT_ENABLED).setAppId(t).setOrigin(window.location.protocol+"//"+window.location.host).setOAuthToken(this._oauthToken).addView(n).setDeveloperKey(this.pickerApiKey).setCallback(function(t){e(t)}).build().setVisible(!0)}},t.prototype.getUserInfo=function(){var e=this;return new a.Promise(function(t,n){e.gapiClient.request({path:"/drive/v3/about",method:"GET",params:{fields:"user"},callback:function(e){e?t(e.user):n(e)}})})},t.prototype.getFile=function(e){var t=this;return new a.Promise(function(n,r){t.gapiClient.request({path:"/drive/v3/files/"+e,method:"GET",callback:function(e){e.error?r(e.error):n(e)}})})},t.prototype.checkFileExists=function(e){var t=this;return new a.Promise(function(n,r){t.gapiClient.request({path:"/drive/v3/files/"+e,method:"GET",callback:function(e){n(!!e)}})})},t.prototype.showUI=function(){var e=this,t=e.ui;t.innerHTML="",t.style.visibility="visible",t.innerHTML="Save Diagram As
";var n=document.createElement("div");n.id="userInputDiv",n.innerHTML+='',t.appendChild(n);var r=document.createElement("div");r.id="submitDiv";var o=document.createElement("button");o.id="actionButton",o.textContent="Save",o.onclick=function(){e.saveWithUI()},r.appendChild(o),t.appendChild(r);var i=document.createElement("div");i.id="cancelDiv";var a=document.createElement("button");return a.id="cancelButton",a.textContent="Cancel",a.onclick=function(){e.hideUI(!0)},i.appendChild(a),t.appendChild(i),e._deferredPromise.promise},t.prototype.saveWithUI=function(){var e=this,t=e.ui;return new a.Promise(function(n,r){if("hidden"===t.style.visibility)n(e.showUI());else{var o=document.getElementById("userInput").value;e.save(o),n(e.hideUI())}})},t.prototype.save=function(e){var t=this;return new a.Promise(function(n,r){if(e){-1===e.indexOf(".diagram")&&(e+=".diagram");t.gapiClient.request({path:"/drive/v3/files",method:"GET",params:{q:'trashed=false and name contains ".diagram" and mimeType = "application/json"'},callback:function(r){var o=r.files;if(o)for(var i=0;iSave Diagram As
";var n=document.createElement("div");n.id="userInputDiv",n.innerHTML+='',t.appendChild(n);var r=document.createElement("div");r.id="submitDiv";var o=document.createElement("button");o.id="actionButton",o.textContent="Save",o.onclick=function(){var n=document.getElementById("gdb-userInput").value;""!=n&&void 0!=n&&null!=n&&(t.style.visibility="hidden",e.saveWithUI(n))},r.appendChild(o),t.appendChild(r);var i=document.createElement("div");i.id="cancelDiv";var a=document.createElement("button");return a.id="cancelButton",a.textContent="Cancel",a.onclick=function(){e.hideUI(!0)},i.appendChild(a),t.appendChild(i),e._deferredPromise.promise},t.prototype.hideUI=function(t){this.menuPath="",e.prototype.hideUI.call(this,t)},t.prototype.processUIResult=function(e){var t=function(){for(var e=document.getElementsByName("dropBoxFile"),t=null,n=0;no&&(c=o,i=s)}var u={name:i.name,path:i.path_lower,id:i.id};t.currentDiagramFile=u,n(u),t._deferredPromise.promise.resolve(u),t._deferredPromise.promise=t.makeDeferredPromise()})};var o="data:text/html,"+encodeURIComponent(t.makeSaveFile());window.Dropbox.save(o,e,t._options)}))},t.prototype.save=function(e){var t=this;return new a.Promise(function(n,r){e?t.dropbox.filesUpload({contents:t.makeSaveFile(),path:e,autorename:!0,mode:{".tag":"add"},mute:!1}).then(function(e){var r={name:e.name,id:e.id,path:e.path_lower};t.currentDiagramFile=r,n(r),t._deferredPromise.promise.resolve(r),t._deferredPromise.promise=t.makeDeferredPromise()}).catch(function(e){400==e.status&&t.authorize(!0)}):t.currentDiagramFile.path?(e=t.currentDiagramFile.path,t.dropbox.filesUpload({contents:t.makeSaveFile(),path:e,autorename:!1,mode:{".tag":"overwrite"},mute:!0}).then(function(e){var t={name:e.name,id:e.id,path:e.path_lower};n(t)}).catch(function(e){400==e.status&&t.authorize(!0)})):n(t.saveWithUI())})},t.prototype.loadWithUI=function(){var e=this;return e._options.success=function(t){var n=t[0];e.dropbox.filesGetMetadata({path:n.id}).then(function(t){var n=t.path_display;e.load(n)})},window.Dropbox.choose(e._options),e._deferredPromise.promise},t.prototype.load=function(e){var t=this;return new a.Promise(function(n,r){if(!e)throw Error("Cannot load file from Dropbox with path "+e);t.dropbox.filesGetTemporaryLink({path:e}).then(function(r){var o=r.link;t.currentDiagramFile.name=r.metadata.name,t.currentDiagramFile.id=r.metadata.id,t.currentDiagramFile.path=e;var i=new XMLHttpRequest;i.open("GET",o,!0),i.setRequestHeader("Authorization","Bearer "+t.dropbox.getAccessToken()),i.onload=function(){if(4!=i.readyState||200!=i.status)throw Error("Cannot load file from Dropbox with path "+e);t.loadFromFileContents(i.response);var o={name:r.metadata.name,id:r.metadata.id,path:r.metadata.path_lower};n(o),t._deferredPromise.promise.resolve(o),t._deferredPromise.promise=t.makeDeferredPromise()},i.send()}).catch(function(e){400==e.status&&t.authorize(!0)})})},t.prototype.removeWithUI=function(){var e=this;return e._options.success=function(t){var n=t[0];e.dropbox.filesGetMetadata({path:n.id}).then(function(t){var n=t.path_display;e.remove(n)})},window.Dropbox.choose(e._options),e._deferredPromise.promise},t.prototype.remove=function(e){var t=this;return new a.Promise(function(n,r){if(!e)throw Error("Cannot delete file from Dropbox with path "+e);t.dropbox.filesDelete({path:e}).then(function(e){t.currentDiagramFile&&t.currentDiagramFile.id===e.id&&(t.currentDiagramFile={name:null,path:null,id:null});var r={name:e.name,id:e.id,path:e.path_lower};n(r),t._deferredPromise.promise.resolve(r),t._deferredPromise.promise=t.makeDeferredPromise()}).catch(function(e){400==e.status&&t.authorize(!0)})})},t._MIN_FILES_IN_UI=100,t}(i.GoCloudStorage);t.GoDropBox=s},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],l=!1,d=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&f())}function f(){if(!l){var e=s(p);l=!0;for(var t=u.length;t;){for(c=u,u=[];++d1)for(var n=1;n";var a=e+" Diagram File";o.innerHTML+=""+a+"
",document.getElementsByTagName("body")[0].appendChild(o),o.style.visibility="visible";var s=document.createElement("div");s.id="fileOptions";var c=[],u=(t._MIN_FILES_IN_UI,0),l=!1;if(0!==r.localStorage.length){for(var d in r.localStorage)if(c.length":"
"}if(!l){var v=n+50;s.innerHTML+="

There may be more diagram files not shown. Click here to try loading more.

",document.getElementById("localStorageLoadMoreFiles").onclick=function(){r.showUI(e,v)}}if(o.appendChild(s),r.currentDiagramFile.id){var g=r.currentDiagramFile.id.replace(/ /g,"qwe45qw34"),y=document.getElementById(g+"-label");y&&(y.style.fontStyle="italic")}if("Save"===e){var w=document.createElement("div");w.id="userInputDiv",w.innerHTML+='Save Diagram As ',o.appendChild(w)}var _=document.createElement("div");_.id="submitDiv";var b=document.createElement("button");b.textContent=e,b.id="actionButton",b.onclick=function(){r.processUIResult(e)},_.appendChild(b),o.appendChild(_);var P=document.createElement("div"),D=document.createElement("button");return D.id="cancelButton",D.textContent="Cancel",D.onclick=function(){r.hideUI(!0)},P.appendChild(D),o.appendChild(P),r._deferredPromise.promise},t.prototype.processUIResult=function(e){var t=function(){for(var e=document.getElementsByName("localStorageFile"),t=null,n=0;n