Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@morgan-stanley/desktopjs

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@morgan-stanley/desktopjs - npm Package Compare versions

Comparing version 3.7.0 to 3.7.1

2

dist/desktop.min.js

@@ -1,2 +0,2 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).desktopJS={})}(this,function(c){"use strict";var o=function(t,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function s(t,n){function e(){this.constructor=t}o(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function w(e,o){var i,r,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function n(n){return function(t){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(a=2&n[0]?r.return:n[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,n[1])).done)return a;switch(r=0,a&&(n=[2&n[0],a.value]),n[0]){case 0:case 1:a=n;break;case 4:return s.label++,{value:n[1],done:!1};case 5:s.label++,r=n[1],n=[0];continue;case 7:n=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){s.label=n[1];break}if(6===n[0]&&s.label<a[1]){s.label=a[1],a=n;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(n);break}a[2]&&s.ops.pop(),s.trys.pop();continue}n=o.call(e,s)}catch(t){n=[6,t],r=0}finally{i=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,t])}}}var a=function(t,n,e){this.sender=t,this.name=n,this.innerEvent=e},i=function(){function r(){this.eventListeners=new Map,this.wrappedListeners=new Map}return r.prototype.addListener=function(t,n){return(this.eventListeners[t]=this.eventListeners[t]||[]).push(n),this},r.prototype.registerAndWrapListener=function(t,n){var e=this.wrapListener(t,n);return this.wrappedListeners.set(n,e),e},r.prototype.wrapListener=function(o,i){var r=this;return function(t){var n=new a(r,o,t);r.preProcessArgs(n);var e=i(n);return r.postProcessArgs(n),e}},r.prototype.preProcessArgs=function(t){},r.prototype.postProcessArgs=function(t){t&&void 0!==t.returnValue&&(t.innerEvent.returnValue=t.returnValue)},r.prototype.unwrapAndUnRegisterListener=function(t){var n=this.wrappedListeners.get(t);return n&&this.wrappedListeners.delete(t),n},r.prototype.removeListener=function(t,n){var e=this.listeners(t);if(e){var o=e.indexOf(n);0<=o&&e.splice(o,1)}return this},r.prototype.listeners=function(t){return this.eventListeners[t]||[]},r.prototype.emit=function(t,n){for(var e=0,o=this.listeners(t);e<o.length;e++){(0,o[e])(n)}},Object.defineProperty(r,"ipc",{set:function(t){t&&t.subscribe(r.staticEventName,function(t,n){r.emit(n.eventName,n.eventArgs)})},enumerable:!0,configurable:!0}),r.addListener=function(t,n){(this.staticEventListeners[t]=this.staticEventListeners[t]||[]).push(n)},r.removeListener=function(t,n){var e=r.listeners(t);if(e){var o=e.indexOf(n);0<=o&&e.splice(o,1)}},r.listeners=function(t){return this.staticEventListeners[t]||[]},r.emit=function(t,n,e){if(e&&e.publish)e.publish(r.staticEventName,{eventName:t,eventArgs:n});else for(var o=0,i=r.listeners(t);o<i.length;o++){(0,i[o])(n)}},r.staticEventListeners=new Map,r.staticEventName="desktopJS.static-event",r}(),p=function(){function t(){}return t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=16*Math.random()|0;return("x"==t?n:3&n|8).toString(16)})},t}(),t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(a),h=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return s(o,e),o.prototype.getInfo=function(){return Promise.resolve(void 0)},o.prototype.ready=function(){return Promise.resolve()},Object.defineProperty(o,"ipc",{get:function(){return o._ipc},set:function(t){i.ipc=o._ipc=t},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"ipc",{get:function(){return o.ipc},set:function(t){o.ipc=t},enumerable:!0,configurable:!0}),o.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},o.prototype.removeListener=function(t,n){return e.prototype.removeListener.call(this,t,n)},o.prototype.emit=function(t,n){e.prototype.emit.call(this,t,n)},o.addListener=function(t,n){i.addListener(o.staticEventScopePrefix+t,n)},o.removeListener=function(t,n){i.removeListener(o.staticEventScopePrefix+t,n)},o.emit=function(t,n){i.emit(o.staticEventScopePrefix+t,n,o.ipc)},o.listeners=function(t){return i.listeners(o.staticEventScopePrefix+t)},o.staticEventScopePrefix="container-",o.windowOptionsPropertyKey="desktopJS-options",o}(i),n=function(n){function r(){var t=null!==n&&n.apply(this,arguments)||this;return t.uuid=p.newGuid(),t.storage="undefined"!=typeof window&&window?window.localStorage:void 0,t}return s(r,n),r.prototype.showNotification=function(t,n){throw new TypeError("Notifications not supported by this container")},r.prototype.addTrayIcon=function(t,n,e){throw new TypeError("Tray icons are not supported by this container.")},r.prototype.getLayoutFromStorage=function(t){return JSON.parse(this.storage.getItem(r.layoutsPropertyKey))[t]},r.prototype.saveLayoutToStorage=function(t,n){var e=JSON.parse(this.storage.getItem(r.layoutsPropertyKey))||{};n.name||(n.name=t),e[t]=n,this.storage.setItem(r.layoutsPropertyKey,JSON.stringify(e)),this.emit("layout-saved",{sender:this,name:"layout-saved",layout:n,layoutName:n.name}),h.emit("layout-saved",{name:"layout-saved",layout:n,layoutName:n.name})},r.prototype.deleteLayoutFromStorage=function(t){var n=JSON.parse(this.storage.getItem(r.layoutsPropertyKey))||{},e=n[t];e&&(delete n[t],this.storage.setItem(r.layoutsPropertyKey,JSON.stringify(n)),this.emit("layout-deleted",{sender:this,name:"layout-deleted",layoutName:e.name}),h.emit("layout-deleted",{name:"layout-deleted",layoutName:e.name}))},r.prototype.loadLayout=function(u){var c=this;return new Promise(function(a,s){c.closeAllWindows(!0).then(function(){var r="string"==typeof u?c.getLayoutFromStorage(u):u;if(r&&r.windows){for(var t=[],n=0,e=r.windows;n<e.length;n++){var o=e[n],i=Object.assign(o.options||{},o.bounds);i.name=o.name,o.main?(c.getMainWindow().setBounds(o.bounds),t.push(Promise.resolve(c.getMainWindow()))):t.push(c.createWindow(o.url,i))}Promise.all(t).then(function(t){var i=new Map;t.forEach(function(e){var t=r.windows.find(function(t){return t.name===e.name});t&&t.state&&e.setState&&e.setState(t.state).catch(function(t){return c.log("error","Error invoking setState: "+t)});var o=!1;if(i.forEach(function(t,n){!o&&0<=t.indexOf(e.id)&&(o=!0)}),!o){var n=t?t.group:void 0;n&&0<n.length&&i.set(e,n.filter(function(t){return t!==e.id}))}}),i.forEach(function(t,e){t.forEach(function(n){c.getWindowByName(r.windows.find(function(t){return t.id===n}).name).then(function(t){t.joinGroup(e)})})})}),c.emit("layout-loaded",{sender:c,name:"layout-loaded",layout:r,layoutName:r.name}),h.emit("layout-loaded",{name:"layout-loaded",layout:r,layoutName:r.name}),a(r)}else s("Layout does not exist or is invalid")})})},r.prototype.saveLayout=function(e){var o=this;return new Promise(function(n,t){o.buildLayout().then(function(t){o.saveLayoutToStorage(e,t),n(t)}).catch(t)})},r.prototype.deleteLayout=function(e){var o=this;return new Promise(function(t,n){t(o.deleteLayoutFromStorage(e))})},r.prototype.getLayouts=function(){var i=this;return new Promise(function(t,n){var e=i.storage.getItem(r.layoutsPropertyKey);if(e){var o=JSON.parse(e);t(Object.getOwnPropertyNames(o).map(function(t){return o[t]}))}t(void 0)})},r.prototype.log=function(e,o){return new Promise(function(t){var n;switch(e){case"debug":n=console.debug;break;case"warn":n=console.warn;break;case"error":n=console.error;break;default:n=console.log}n&&n(o),t()})},r.layoutsPropertyKey="desktopJS-layouts",r}(h),r=function(n){function t(t){var e=n.call(this)||this;e.globalWindow=t||"undefined"!=typeof window&&window||null,e.linkHelper={href:"unknown"};try{e.linkHelper=e.globalWindow.top.document.createElement("a")}catch(t){}if(e.globalWindow){var o=e.globalWindow.open;e.globalWindow.open=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.onOpen.apply(e,function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var o=Array(t),i=0;for(n=0;n<e;n++)for(var r=arguments[n],a=0,s=r.length;a<s;a++,i++)o[i]=r[a];return o}([o],t))}}return e}return s(t,n),t.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t.apply(this.globalWindow,n)},t.prototype.ensureAbsoluteUrl=function(t){return this.linkHelper?(this.linkHelper.href=t,this.linkHelper.href):t},t}(n),d=function(t,n,e){this.topic=t,this.listener=n,this.options=e},e=function(){},u=function(){},f=function(){},l=function(){function n(t,n){}return n.requestPermission=function(t){return t&&t(n.permission),Promise.resolve(n.permission)},n.permission="granted",n}(),y=function(){};(c.ObjectTransform||(c.ObjectTransform={})).transformProperties=function(t,n){var e={};if(t)for(var o in t)try{o in n?e[n[o].target]=n[o].convert?n[o].convert(t[o],t,e):t[o]:e[o]=t[o]}catch(t){console.error("Error transforming property '"+o+"'")}return e};var g,v=function(){function t(t,n,e,o){this.x=t,this.y=n,this.width=e,this.height=o}return Object.defineProperty(t.prototype,"right",{get:function(){return t.getRight(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return t.getBottom(this)},enumerable:!0,configurable:!0}),t.getRight=function(t){return t.x+t.width},t.getBottom=function(t){return t.y+t.height},t}(),m=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(a),b=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(m),W=function(o){function e(t){var n=o.call(this)||this;return n.innerWindow=t,n}return s(e,o),Object.defineProperty(e.prototype,"allowGrouping",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype.getGroup=function(){return Promise.resolve([])},e.prototype.joinGroup=function(t){return Promise.reject("Not supported")},e.prototype.leaveGroup=function(){return Promise.resolve()},e.prototype.bringToFront=function(){return this.focus()},e.prototype.getState=function(){return Promise.resolve(void 0)},e.prototype.setState=function(t){return Promise.resolve()},Object.defineProperty(e.prototype,"nativeWindow",{get:function(){},enumerable:!0,configurable:!0}),e.prototype.addListener=function(t,n){var e=this.registerAndWrapListener(t,n);return this.attachListener(t,e),o.prototype.addListener.call(this,t,e)},e.prototype.removeListener=function(t,n){var e=this.unwrapAndUnRegisterListener(n)||n;return this.detachListener(t,e),o.prototype.removeListener.call(this,t,e)},e.addListener=function(t,n){i.addListener(e.staticEventScopePrefix+t,n)},e.removeListener=function(t,n){i.removeListener(e.staticEventScopePrefix+t,n)},e.emit=function(t,n){i.emit(e.staticEventScopePrefix+t,n,h.ipc)},e.listeners=function(t){return i.listeners(e.staticEventScopePrefix+t)},e.staticEventScopePrefix="containerwindow-",e}(i),P=function(){},x=function(t){this.windows=[],this.name=t};function S(){return"undefined"!=typeof window&&window.fin}(g=c.WindowStateTracking||(c.WindowStateTracking={}))[g.None=0]="None",g[g.Main=1]="Main",g[g.Group=2]="Group";var L=function(){function t(t,n){this.windowStateTracking=c.WindowStateTracking.None,this.container=t,n&&"windowStateTracking"in n&&(this.windowStateTracking=n.windowStateTracking),this.attach()}return t.prototype.attach=function(t){var n=this;t?(t.addListener(S()?"minimized":"minimize",function(t){n.windowStateTracking&c.WindowStateTracking.Main&&n.container.getMainWindow().id===t.sender.id&&n.container.getAllWindows().then(function(t){t.forEach(function(t){return t.minimize()})}),n.windowStateTracking&c.WindowStateTracking.Group&&t.sender.getGroup().then(function(t){t.forEach(function(t){return t.minimize()})})}),t.addListener(S()?"restored":"restore",function(t){n.windowStateTracking&c.WindowStateTracking.Main&&n.container.getMainWindow().id===t.sender.id&&n.container.getAllWindows().then(function(t){t.forEach(function(t){return t.restore()})}),n.windowStateTracking&c.WindowStateTracking.Group&&t.sender.getGroup().then(function(t){t.forEach(function(t){return t.restore()})})})):(W.addListener("window-created",function(t){n.container&&n.container.getWindowById&&n.container.getWindowById(t.windowId).then(function(t){n.attach(t)})}),this.container&&this.container.getAllWindows().then(function(t){t.forEach(function(t){return n.attach(t)})}))},t}(),O=function(o){function t(t,n){var e=o.call(this,t,n)||this;return e.autoGrouping=!0,e.snapThreshold=15,e.snapOffset=15,e.targetGroup=new Map,n&&("snapThreshold"in n&&(e.snapThreshold=n.snapThreshold),"snapOffset"in n&&(e.snapOffset=n.snapOffset),"autoGrouping"in n&&(e.autoGrouping=n.autoGrouping)),e}return s(t,o),t.prototype.onAttached=function(t){var n=this;t.innerWindow&&t.innerWindow.disableFrame&&t.innerWindow.disableFrame(),S()?(t.addListener("disabled-frame-bounds-changed",function(){return n.onMoved(t)}),t.addListener("frame-enabled",function(){return t.innerWindow.disableFrame()})):t.innerWindow&&t.innerWindow.hookWindowMessage&&t.innerWindow.hookWindowMessage(562,function(){return n.onMoved(t)})},t.prototype.attach=function(n){var e=this;o.prototype.attach.call(this,n),n&&n.getOptions().then(function(t){t&&void 0!==t.snap&&!1===t.snap||(e.onAttached(n),n.addListener(S()?"disabled-frame-bounds-changing":"move",function(t){return e.onMoving(t)}))})},t.prototype.onMoving=function(s){var u=this,e=s.sender.id;this.snappingWindow!==e&&s.sender.getOptions().then(function(t){t&&void 0!==t.snap&&!1===t.snap||s.sender.getGroup().then(function(t){(S()?Promise.resolve(new v(s.innerEvent.left,s.innerEvent.top,s.innerEvent.width,s.innerEvent.height)):s.sender.getBounds()).then(function(a){if(0<t.length)S()&&u.moveWindow(s.sender,a);else{var n=[];u.container.getAllWindows().then(function(t){t.filter(function(t){return e!==t.id}).forEach(function(o){n.push(new Promise(function(e){o.getOptions().then(function(n){o.getBounds().then(function(t){return e({window:o,bounds:t,options:n})})})}))}),Promise.all(n).then(function(t){for(var n,e=!1,o=0,i=t.filter(function(t){return!(t.options&&void 0!==t.options.snap&&!1===t.options.snap)});o<i.length;o++){var r=i[o];(n=u.getSnapBounds(n||a,r.bounds))?(e=!0,u.showGroupingHint(r.window),u.moveWindow(s.sender,n)):u.hideGroupingHint(r.window)}!e&&S()&&u.moveWindow(s.sender,a)})})}})})})},t.prototype.moveWindow=function(t,n){var e=this;this.snappingWindow=t.id,t.setBounds(n).then(function(){return e.snappingWindow=void 0},function(){return e.snappingWindow=void 0})},t.prototype.onMoved=function(e){var n=this;if(this.autoGrouping){var t=[];this.targetGroup.forEach(function(e){return t.push(new Promise(function(n){e.getGroup().then(function(t){return n({window:e,isGrouped:0<t.length})})}))}),Promise.all(t).then(function(t){0<t.length&&e.joinGroup(t[0].window);for(var n=1;n<t.length;n++)t[n].isGrouped||t[n].window.joinGroup(e)})}this.targetGroup.forEach(function(t){return n.hideGroupingHint(t)}),this.targetGroup.clear()},t.prototype.showGroupingHint=function(t){t.innerWindow&&t.innerWindow.updateOptions&&t.innerWindow.updateOptions({opacity:.75}),this.targetGroup.set(t.id,t)},t.prototype.hideGroupingHint=function(t){t.innerWindow&&t.innerWindow.updateOptions&&t.innerWindow.updateOptions({opacity:1}),this.targetGroup.delete(t.id)},t.prototype.isHorizontallyAligned=function(t,n){return t.y>=n.y&&t.y<=n.bottom||t.bottom>=n.y&&t.bottom<=n.bottom||t.y<=n.y&&t.bottom>=n.bottom},t.prototype.isVerticallyAligned=function(t,n){return t.x>=n.x&&t.x<=n.right||t.right>=n.x&&t.right<=n.right||t.x<=n.x&&t.right>=n.right},t.prototype.getSnapBounds=function(t,n){var e,o,i,r,a,s,u,c;if(this.isHorizontallyAligned(t,n)&&(e=Math.abs(t.x-(n.right-this.snapOffset))<this.snapThreshold,o=Math.abs(t.x-n.x)<this.snapThreshold,i=Math.abs(t.right-this.snapOffset-n.x)<this.snapThreshold,r=Math.abs(t.right-n.right)<this.snapThreshold),this.isVerticallyAligned(t,n)&&(a=Math.abs(t.y-(n.bottom-this.snapOffset))<this.snapThreshold,s=Math.abs(t.y-n.y)<this.snapThreshold,u=Math.abs(t.bottom-this.snapOffset-n.y)<this.snapThreshold,c=Math.abs(t.bottom-n.bottom)<this.snapThreshold),e||i||a||u){var p=t.x,d=t.y;return e?p=n.x+n.width-this.snapOffset:o&&(p=n.x),i?p=n.x-t.width+this.snapOffset:r&&(p=n.x+n.width-t.width),a?d=n.y+n.height-Math.floor(this.snapOffset/2):s&&(d=n.y),u?d=n.y-t.height+Math.floor(this.snapOffset/2):c&&(d=n.y+n.height-t.height),new v(p,d,t.width,t.height)}},t}(L),E=function(){},M=function(){};!function(t){var e={close:"unload"},n=function(n){function t(t){return n.call(this,t)||this}return s(t,n),Object.defineProperty(t.prototype,"id",{get:function(){return this.innerWindow[a.windowUuidPropertyKey]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.innerWindow[a.windowNamePropertyKey]},enumerable:!0,configurable:!0}),t.prototype.load=function(n,t){var e=this;return new Promise(function(t){e.innerWindow.location.replace(n),t()})},t.prototype.focus=function(){return this.innerWindow.focus(),Promise.resolve()},t.prototype.show=function(){return Promise.resolve()},t.prototype.hide=function(){return Promise.resolve()},t.prototype.close=function(){return this.innerWindow.close(),Promise.resolve()},t.prototype.minimize=function(){var n=this;return new Promise(function(t){n.innerWindow.minimize(),t()})},t.prototype.maximize=function(){var n=this;return new Promise(function(t){n.innerWindow.maximize(),t()})},t.prototype.restore=function(){var n=this;return new Promise(function(t){n.innerWindow.restore(),t()})},t.prototype.isShowing=function(){return Promise.resolve(!0)},t.prototype.getSnapshot=function(){return Promise.reject("getSnapshot requires an implementation.")},t.prototype.flash=function(t,n){return Promise.reject("Not supported")},t.prototype.getBounds=function(){var n=this;return new Promise(function(t){t(new v(n.innerWindow.screenX,n.innerWindow.screenY,n.innerWindow.outerWidth,n.innerWindow.outerHeight))})},t.prototype.setBounds=function(n){var e=this;return new Promise(function(t){e.innerWindow.moveTo(n.x,n.y),e.innerWindow.resizeTo(n.width,n.height),t()})},t.prototype.getOptions=function(){var e=this;return new Promise(function(t,n){t(e.innerWindow[h.windowOptionsPropertyKey])})},t.prototype.getState=function(){var n=this;return new Promise(function(t){n.nativeWindow&&n.nativeWindow.getState?t(n.nativeWindow.getState()):t(void 0)})},t.prototype.setState=function(n){var e=this;return new Promise(function(t){e.nativeWindow&&e.nativeWindow.setState&&e.nativeWindow.setState(n),t()}).then(function(){e.emit("state-changed",{name:"state-changed",sender:e,state:n}),W.emit("state-changed",{name:"state-changed",windowId:e.id,state:n})})},t.prototype.attachListener=function(t,n){this.innerWindow.addEventListener(e[t]||t,n)},t.prototype.detachListener=function(t,n){this.innerWindow.removeEventListener(e[t]||t,n)},Object.defineProperty(t.prototype,"nativeWindow",{get:function(){return this.innerWindow},enumerable:!0,configurable:!0}),t}(W);t.DefaultContainerWindow=n;var o=function(){function u(t){this.container=t}return u.prototype.subscribe=function(r,a,t){var s=this;return new Promise(function(t,n){var e=new d(r,function(t){if(t.origin===s.container.globalWindow.location.origin){var n=t.data,e=n.source,o=n.topic,i=n.message;e===u.messageSource&&r===o&&a({topic:r},i)}});s.container.globalWindow&&s.container.globalWindow.addEventListener&&s.container.globalWindow.addEventListener("message",e.listener),t(e)})},u.prototype.unsubscribe=function(t){return Promise.resolve(this.container.globalWindow.removeEventListener("message",t.listener))},u.prototype.publish=function(t,n,e){var o=this.container.globalWindow?this.container.globalWindow[a.windowsPropertyKey]||this.container.globalWindow.opener&&this.container.globalWindow.opener[a.windowsPropertyKey]:[];if(o)for(var i in o){var r=o[i];e&&e.name&&e.name!==r[a.windowNamePropertyKey]||r.location.origin===this.container.globalWindow.location.origin&&r.postMessage({source:u.messageSource,topic:t,message:n},this.container.globalWindow.location.origin)}return Promise.resolve()},u.messageSource="desktopJS",u}();t.DefaultMessageBus=o;var a=function(e){function u(t){var n=e.call(this,t)||this;return n.windowOptionsMap=u.defaultWindowOptionsMap,n.hostType="Default",n.ipc=n.createMessageBus(),!n.globalWindow||u.windowsPropertyKey in n.globalWindow||(n.globalWindow[u.windowsPropertyKey]={root:n.globalWindow},n.globalWindow[u.windowNamePropertyKey]=n.globalWindow[u.windowUuidPropertyKey]=u.rootWindowUuid),n.screen=new i(n.globalWindow),n}return s(u,e),u.prototype.createMessageBus=function(){return new o(this)},u.prototype.getInfo=function(){return Promise.resolve(this.globalWindow.navigator.appVersion)},u.prototype.getMainWindow=function(){if(!this.mainWindow){var t=this.globalWindow[u.windowsPropertyKey].root;this.mainWindow=t?this.wrapWindow(t):null}return this.mainWindow},u.prototype.getCurrentWindow=function(){return this.wrapWindow(this.globalWindow)},u.prototype.getWindowOptions=function(t){return c.ObjectTransform.transformProperties(t,this.windowOptionsMap)},u.prototype.wrapWindow=function(t){return new n(t)},u.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var o=t.apply(this.globalWindow,n),i=this.globalWindow[u.windowsPropertyKey],r=o[u.windowUuidPropertyKey]=p.newGuid();return(i[r]=o).addEventListener("beforeunload",function(){o.addEventListener("unload",function(){delete i[r]})}),o[u.windowsPropertyKey]=i,h.emit("window-created",{name:"window-created",windowId:r}),W.emit("window-created",{name:"window-created",windowId:r}),o},u.prototype.createWindow=function(t,n){var e,o="_blank",i=this.getWindowOptions(n);if(i){for(var r in i)e=(e||"")+r+"="+i[r]+",";i&&"target"in i&&(o=i.target)}var a=this.globalWindow.open(t,o,e);a[h.windowOptionsPropertyKey]=n,a[u.windowNamePropertyKey]=i.name;var s=this.wrapWindow(a);return this.emit("window-created",{sender:this,name:"window-created",window:s,windowId:s.id,windowName:i.name}),Promise.resolve(s)},u.prototype.showNotification=function(n,e){var o=this;"Notification"in this.globalWindow?this.globalWindow.Notification.requestPermission(function(t){"denied"===t?console.warn("Notifications not permitted"):"granted"===t&&new o.globalWindow.Notification(n,e)}):console.warn("Notifications not supported")},u.prototype.closeAllWindows=function(r){var a=this;return new Promise(function(t,n){var e=a.globalWindow[u.windowsPropertyKey];for(var o in e){var i=e[o];r&&a.globalWindow===i||i.close()}t()})},u.prototype.getAllWindows=function(){var r=this;return new Promise(function(t,n){var e=[],o=r.globalWindow[u.windowsPropertyKey];for(var i in o)e.push(r.wrapWindow(o[i]));t(e)})},u.prototype.getWindowById=function(o){var i=this;return new Promise(function(t,n){var e=i.globalWindow[u.windowsPropertyKey][o];t(e?i.wrapWindow(e):null)})},u.prototype.getWindowByName=function(i){var r=this;return new Promise(function(t,n){var e=r.globalWindow[u.windowsPropertyKey];for(var o in e)if(e[o][u.windowNamePropertyKey]===i)return void t(r.wrapWindow(e[o]));t(null)})},u.prototype.buildLayout=function(){var f=this,l=new x;return new Promise(function(n,e){var o=[];f.getAllWindows().then(function(t){t.forEach(function(c){var p=c.nativeWindow,d=p[h.windowOptionsPropertyKey];d&&"persist"in d&&!d.persist||o.push(new Promise(function(i){return r=f,u=function(){var n,e,o;return w(this,function(t){switch(t.label){case 0:return this.globalWindow===p?[3,2]:(e=(n=l.windows).push,o={name:c.name,url:p&&p.location?p.location.toString():void 0,id:c.id,bounds:{x:p.screenX,y:p.screenY,width:p.outerWidth,height:p.outerHeight},options:d},[4,c.getState()]);case 1:e.apply(n,[(o.state=t.sent(),o)]),t.label=2;case 2:return i(),[2]}})},new((s=a=void 0)||(s=Promise))(function(t,n){function e(t){try{i(u.next(t))}catch(t){n(t)}}function o(t){try{i(u.throw(t))}catch(t){n(t)}}function i(n){n.done?t(n.value):new s(function(t){t(n.value)}).then(e,o)}i((u=u.apply(r,a||[])).next())});var r,a,s,u}))}),Promise.all(o).then(function(){n(l)}).catch(e)})})},u.windowsPropertyKey="desktopJS-windows",u.windowUuidPropertyKey="desktopJS-uuid",u.windowNamePropertyKey="desktopJS-name",u.rootWindowUuid="root",u.defaultWindowOptionsMap={x:{target:"left"},y:{target:"top"}},u}(r);t.DefaultContainer=a;var i=function(){function t(t){this.window=t}return t.prototype.getPrimaryDisplay=function(){var e=this;return new Promise(function(t){var n=new M;n.scaleFactor=e.window.devicePixelRatio,n.id="Current",n.bounds=new v(e.window.screen.availLeft,e.window.screen.availTop,e.window.screen.width,e.window.screen.height),n.workArea=new v(e.window.screen.availLeft,e.window.screen.availTop,e.window.screen.availWidth,e.window.screen.availHeight),t(n)})},t.prototype.getAllDisplays=function(){var t=this;return new Promise(function(n){t.getPrimaryDisplay().then(function(t){return n([t])})})},t.prototype.getMousePosition=function(){var e=this;return new Promise(function(t,n){t({x:e.window.event.screenX,y:e.window.event.screenY})})},t}()}(c.Default||(c.Default={}));var T=function(){},N=[];var k=function(){},G=function(){};c.Container=h,c.ContainerBase=n,c.ContainerNotification=l,c.ContainerRegistration=T,c.ContainerWindow=W,c.Display=M,c.EventArgs=a,c.EventEmitter=i,c.GlobalShortcutManager=G,c.GroupWindowManager=L,c.Guid=p,c.LayoutEventArgs=t,c.MenuItem=u,c.MessageBusOptions=e,c.MessageBusSubscription=d,c.NotificationOptions=f,c.PersistedWindow=P,c.PersistedWindowLayout=x,c.Point=E,c.PropertyMap=y,c.Rectangle=v,c.SnapAssistWindowManager=O,c.TrayIconDetails=k,c.WebContainerBase=r,c.WindowEventArgs=m,c.WindowGroupEventArgs=b,c.clearRegistry=function(){N.splice(0,N.length),c.container=void 0},c.registerContainer=function(t,n){N.push({id:t,registration:n})},c.resolveContainer=function(t,n){var e,o,i=!1,r=n;if("boolean"==typeof t?i=t:r=t,!i&&c.container)return c.container;try{for(var a=0;a<N.length;a++){o=N[a].id;var s=N[a].registration;e=s.condition(r)?s:e}c.container=e.create(r)}catch(t){console.error("Error resolving container '"+o+"' : "+t.toString())}finally{c.container=c.container||new c.Default.DefaultContainer}return c.container},c.version="3.7.0",Object.defineProperty(c,"__esModule",{value:!0})});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).desktopJS={})}(this,function(c){"use strict";var o=function(t,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function s(t,n){function e(){this.constructor=t}o(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function w(e,o){var i,r,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function n(n){return function(t){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(a=2&n[0]?r.return:n[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,n[1])).done)return a;switch(r=0,a&&(n=[2&n[0],a.value]),n[0]){case 0:case 1:a=n;break;case 4:return s.label++,{value:n[1],done:!1};case 5:s.label++,r=n[1],n=[0];continue;case 7:n=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){s.label=n[1];break}if(6===n[0]&&s.label<a[1]){s.label=a[1],a=n;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(n);break}a[2]&&s.ops.pop(),s.trys.pop();continue}n=o.call(e,s)}catch(t){n=[6,t],r=0}finally{i=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,t])}}}var a=function(t,n,e){this.sender=t,this.name=n,this.innerEvent=e},i=function(){function r(){this.eventListeners=new Map,this.wrappedListeners=new Map}return r.prototype.addListener=function(t,n){return(this.eventListeners[t]=this.eventListeners[t]||[]).push(n),this},r.prototype.registerAndWrapListener=function(t,n){var e=this.wrapListener(t,n);return this.wrappedListeners.set(n,e),e},r.prototype.wrapListener=function(o,i){var r=this;return function(t){var n=new a(r,o,t);r.preProcessArgs(n);var e=i(n);return r.postProcessArgs(n),e}},r.prototype.preProcessArgs=function(t){},r.prototype.postProcessArgs=function(t){t&&void 0!==t.returnValue&&(t.innerEvent.returnValue=t.returnValue)},r.prototype.unwrapAndUnRegisterListener=function(t){var n=this.wrappedListeners.get(t);return n&&this.wrappedListeners.delete(t),n},r.prototype.removeListener=function(t,n){var e=this.listeners(t);if(e){var o=e.indexOf(n);0<=o&&e.splice(o,1)}return this},r.prototype.listeners=function(t){return this.eventListeners[t]||[]},r.prototype.emit=function(t,n){for(var e=0,o=this.listeners(t);e<o.length;e++){(0,o[e])(n)}},Object.defineProperty(r,"ipc",{set:function(t){t&&t.subscribe(r.staticEventName,function(t,n){r.emit(n.eventName,n.eventArgs)})},enumerable:!0,configurable:!0}),r.addListener=function(t,n){(this.staticEventListeners[t]=this.staticEventListeners[t]||[]).push(n)},r.removeListener=function(t,n){var e=r.listeners(t);if(e){var o=e.indexOf(n);0<=o&&e.splice(o,1)}},r.listeners=function(t){return this.staticEventListeners[t]||[]},r.emit=function(t,n,e){if(e&&e.publish)e.publish(r.staticEventName,{eventName:t,eventArgs:n});else for(var o=0,i=r.listeners(t);o<i.length;o++){(0,i[o])(n)}},r.staticEventListeners=new Map,r.staticEventName="desktopJS.static-event",r}(),p=function(){function t(){}return t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=16*Math.random()|0;return("x"==t?n:3&n|8).toString(16)})},t}(),t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(a),h=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return s(o,e),o.prototype.getInfo=function(){return Promise.resolve(void 0)},o.prototype.ready=function(){return Promise.resolve()},Object.defineProperty(o,"ipc",{get:function(){return o._ipc},set:function(t){i.ipc=o._ipc=t},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"ipc",{get:function(){return o.ipc},set:function(t){o.ipc=t},enumerable:!0,configurable:!0}),o.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},o.prototype.removeListener=function(t,n){return e.prototype.removeListener.call(this,t,n)},o.prototype.emit=function(t,n){e.prototype.emit.call(this,t,n)},o.addListener=function(t,n){i.addListener(o.staticEventScopePrefix+t,n)},o.removeListener=function(t,n){i.removeListener(o.staticEventScopePrefix+t,n)},o.emit=function(t,n){i.emit(o.staticEventScopePrefix+t,n,o.ipc)},o.listeners=function(t){return i.listeners(o.staticEventScopePrefix+t)},o.staticEventScopePrefix="container-",o.windowOptionsPropertyKey="desktopJS-options",o}(i),n=function(n){function r(){var t=null!==n&&n.apply(this,arguments)||this;return t.uuid=p.newGuid(),t.storage="undefined"!=typeof window&&window?window.localStorage:void 0,t}return s(r,n),r.prototype.showNotification=function(t,n){throw new TypeError("Notifications not supported by this container")},r.prototype.addTrayIcon=function(t,n,e){throw new TypeError("Tray icons are not supported by this container.")},r.prototype.getLayoutFromStorage=function(t){return JSON.parse(this.storage.getItem(r.layoutsPropertyKey))[t]},r.prototype.saveLayoutToStorage=function(t,n){var e=JSON.parse(this.storage.getItem(r.layoutsPropertyKey))||{};n.name||(n.name=t),e[t]=n,this.storage.setItem(r.layoutsPropertyKey,JSON.stringify(e)),this.emit("layout-saved",{sender:this,name:"layout-saved",layout:n,layoutName:n.name}),h.emit("layout-saved",{name:"layout-saved",layout:n,layoutName:n.name})},r.prototype.deleteLayoutFromStorage=function(t){var n=JSON.parse(this.storage.getItem(r.layoutsPropertyKey))||{},e=n[t];e&&(delete n[t],this.storage.setItem(r.layoutsPropertyKey,JSON.stringify(n)),this.emit("layout-deleted",{sender:this,name:"layout-deleted",layoutName:e.name}),h.emit("layout-deleted",{name:"layout-deleted",layoutName:e.name}))},r.prototype.loadLayout=function(u){var c=this;return new Promise(function(a,s){c.closeAllWindows(!0).then(function(){var r="string"==typeof u?c.getLayoutFromStorage(u):u;if(r&&r.windows){for(var t=[],n=0,e=r.windows;n<e.length;n++){var o=e[n],i=Object.assign(o.options||{},o.bounds);i.name=o.name,o.main?(c.getMainWindow().setBounds(o.bounds),t.push(Promise.resolve(c.getMainWindow()))):t.push(c.createWindow(o.url,i))}Promise.all(t).then(function(t){var i=new Map;t.forEach(function(e){var t=r.windows.find(function(t){return t.name===e.name});t&&t.state&&e.setState&&e.setState(t.state).catch(function(t){return c.log("error","Error invoking setState: "+t)});var o=!1;if(i.forEach(function(t,n){!o&&0<=t.indexOf(e.id)&&(o=!0)}),!o){var n=t?t.group:void 0;n&&0<n.length&&i.set(e,n.filter(function(t){return t!==e.id}))}}),i.forEach(function(t,e){t.forEach(function(n){c.getWindowByName(r.windows.find(function(t){return t.id===n}).name).then(function(t){t.joinGroup(e)})})})}),c.emit("layout-loaded",{sender:c,name:"layout-loaded",layout:r,layoutName:r.name}),h.emit("layout-loaded",{name:"layout-loaded",layout:r,layoutName:r.name}),a(r)}else s("Layout does not exist or is invalid")})})},r.prototype.saveLayout=function(e){var o=this;return new Promise(function(n,t){o.buildLayout().then(function(t){o.saveLayoutToStorage(e,t),n(t)}).catch(t)})},r.prototype.deleteLayout=function(e){var o=this;return new Promise(function(t,n){t(o.deleteLayoutFromStorage(e))})},r.prototype.getLayouts=function(){var i=this;return new Promise(function(t,n){var e=i.storage.getItem(r.layoutsPropertyKey);if(e){var o=JSON.parse(e);t(Object.getOwnPropertyNames(o).map(function(t){return o[t]}))}t(void 0)})},r.prototype.log=function(e,o){return new Promise(function(t){var n;switch(e){case"debug":n=console.debug;break;case"warn":n=console.warn;break;case"error":n=console.error;break;default:n=console.log}n&&n(o),t()})},r.layoutsPropertyKey="desktopJS-layouts",r}(h),r=function(n){function t(t){var e=n.call(this)||this;e.globalWindow=t||"undefined"!=typeof window&&window||null,e.linkHelper={href:"unknown"};try{e.linkHelper=e.globalWindow.top.document.createElement("a")}catch(t){}if(e.globalWindow){var o=e.globalWindow.open;e.globalWindow.open=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.onOpen.apply(e,function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var o=Array(t),i=0;for(n=0;n<e;n++)for(var r=arguments[n],a=0,s=r.length;a<s;a++,i++)o[i]=r[a];return o}([o],t))}}return e}return s(t,n),t.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t.apply(this.globalWindow,n)},t.prototype.ensureAbsoluteUrl=function(t){return this.linkHelper?(this.linkHelper.href=t,this.linkHelper.href):t},t}(n),d=function(t,n,e){this.topic=t,this.listener=n,this.options=e},e=function(){},u=function(){},f=function(){},l=function(){function n(t,n){}return n.requestPermission=function(t){return t&&t(n.permission),Promise.resolve(n.permission)},n.permission="granted",n}(),y=function(){};(c.ObjectTransform||(c.ObjectTransform={})).transformProperties=function(t,n){var e={};if(t)for(var o in t)try{o in n?e[n[o].target]=n[o].convert?n[o].convert(t[o],t,e):t[o]:e[o]=t[o]}catch(t){console.error("Error transforming property '"+o+"'")}return e};var g,v=function(){function t(t,n,e,o){this.x=t,this.y=n,this.width=e,this.height=o}return Object.defineProperty(t.prototype,"right",{get:function(){return t.getRight(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return t.getBottom(this)},enumerable:!0,configurable:!0}),t.getRight=function(t){return t.x+t.width},t.getBottom=function(t){return t.y+t.height},t}(),m=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(a),b=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(m),W=function(o){function e(t){var n=o.call(this)||this;return n.innerWindow=t,n}return s(e,o),Object.defineProperty(e.prototype,"allowGrouping",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype.getGroup=function(){return Promise.resolve([])},e.prototype.joinGroup=function(t){return Promise.reject("Not supported")},e.prototype.leaveGroup=function(){return Promise.resolve()},e.prototype.bringToFront=function(){return this.focus()},e.prototype.getState=function(){return Promise.resolve(void 0)},e.prototype.setState=function(t){return Promise.resolve()},Object.defineProperty(e.prototype,"nativeWindow",{get:function(){},enumerable:!0,configurable:!0}),e.prototype.addListener=function(t,n){var e=this.registerAndWrapListener(t,n);return this.attachListener(t,e),o.prototype.addListener.call(this,t,e)},e.prototype.removeListener=function(t,n){var e=this.unwrapAndUnRegisterListener(n)||n;return this.detachListener(t,e),o.prototype.removeListener.call(this,t,e)},e.addListener=function(t,n){i.addListener(e.staticEventScopePrefix+t,n)},e.removeListener=function(t,n){i.removeListener(e.staticEventScopePrefix+t,n)},e.emit=function(t,n){i.emit(e.staticEventScopePrefix+t,n,h.ipc)},e.listeners=function(t){return i.listeners(e.staticEventScopePrefix+t)},e.staticEventScopePrefix="containerwindow-",e}(i),P=function(){},x=function(t){this.windows=[],this.name=t};function S(){return"undefined"!=typeof window&&window.fin}(g=c.WindowStateTracking||(c.WindowStateTracking={}))[g.None=0]="None",g[g.Main=1]="Main",g[g.Group=2]="Group";var L=function(){function t(t,n){this.windowStateTracking=c.WindowStateTracking.None,this.container=t,n&&"windowStateTracking"in n&&(this.windowStateTracking=n.windowStateTracking),this.attach()}return t.prototype.attach=function(t){var n=this;t?(t.addListener(S()?"minimized":"minimize",function(t){n.windowStateTracking&c.WindowStateTracking.Main&&n.container.getMainWindow().id===t.sender.id&&n.container.getAllWindows().then(function(t){t.forEach(function(t){return t.minimize()})}),n.windowStateTracking&c.WindowStateTracking.Group&&t.sender.getGroup().then(function(t){t.forEach(function(t){return t.minimize()})})}),t.addListener(S()?"restored":"restore",function(t){n.windowStateTracking&c.WindowStateTracking.Main&&n.container.getMainWindow().id===t.sender.id&&n.container.getAllWindows().then(function(t){t.forEach(function(t){return t.restore()})}),n.windowStateTracking&c.WindowStateTracking.Group&&t.sender.getGroup().then(function(t){t.forEach(function(t){return t.restore()})})})):(W.addListener("window-created",function(t){n.container&&n.container.getWindowById&&n.container.getWindowById(t.windowId).then(function(t){n.attach(t)})}),this.container&&this.container.getAllWindows().then(function(t){t.forEach(function(t){return n.attach(t)})}))},t}(),O=function(o){function t(t,n){var e=o.call(this,t,n)||this;return e.autoGrouping=!0,e.snapThreshold=15,e.snapOffset=15,e.targetGroup=new Map,n&&("snapThreshold"in n&&(e.snapThreshold=n.snapThreshold),"snapOffset"in n&&(e.snapOffset=n.snapOffset),"autoGrouping"in n&&(e.autoGrouping=n.autoGrouping)),e}return s(t,o),t.prototype.onAttached=function(t){var n=this;t.innerWindow&&t.innerWindow.disableFrame&&t.innerWindow.disableFrame(),S()?(t.addListener("disabled-frame-bounds-changed",function(){return n.onMoved(t)}),t.addListener("frame-enabled",function(){return t.innerWindow.disableFrame()})):t.innerWindow&&t.innerWindow.hookWindowMessage&&t.innerWindow.hookWindowMessage(562,function(){return n.onMoved(t)})},t.prototype.attach=function(n){var e=this;o.prototype.attach.call(this,n),n&&n.getOptions().then(function(t){t&&void 0!==t.snap&&!1===t.snap||(e.onAttached(n),n.addListener(S()?"disabled-frame-bounds-changing":"move",function(t){return e.onMoving(t)}))})},t.prototype.onMoving=function(s){var u=this,e=s.sender.id;this.snappingWindow!==e&&s.sender.getOptions().then(function(t){t&&void 0!==t.snap&&!1===t.snap||s.sender.getGroup().then(function(t){(S()?Promise.resolve(new v(s.innerEvent.left,s.innerEvent.top,s.innerEvent.width,s.innerEvent.height)):s.sender.getBounds()).then(function(a){if(0<t.length)S()&&u.moveWindow(s.sender,a);else{var n=[];u.container.getAllWindows().then(function(t){t.filter(function(t){return e!==t.id}).forEach(function(o){n.push(new Promise(function(e){o.getOptions().then(function(n){o.getBounds().then(function(t){return e({window:o,bounds:t,options:n})})})}))}),Promise.all(n).then(function(t){for(var n,e=!1,o=0,i=t.filter(function(t){return!(t.options&&void 0!==t.options.snap&&!1===t.options.snap)});o<i.length;o++){var r=i[o];(n=u.getSnapBounds(n||a,r.bounds))?(e=!0,u.showGroupingHint(r.window),u.moveWindow(s.sender,n)):u.hideGroupingHint(r.window)}!e&&S()&&u.moveWindow(s.sender,a)})})}})})})},t.prototype.moveWindow=function(t,n){var e=this;this.snappingWindow=t.id,t.setBounds(n).then(function(){return e.snappingWindow=void 0},function(){return e.snappingWindow=void 0})},t.prototype.onMoved=function(e){var n=this;if(this.autoGrouping){var t=[];this.targetGroup.forEach(function(e){return t.push(new Promise(function(n){e.getGroup().then(function(t){return n({window:e,isGrouped:0<t.length})})}))}),Promise.all(t).then(function(t){0<t.length&&e.joinGroup(t[0].window);for(var n=1;n<t.length;n++)t[n].isGrouped||t[n].window.joinGroup(e)})}this.targetGroup.forEach(function(t){return n.hideGroupingHint(t)}),this.targetGroup.clear()},t.prototype.showGroupingHint=function(t){t.innerWindow&&t.innerWindow.updateOptions&&t.innerWindow.updateOptions({opacity:.75}),this.targetGroup.set(t.id,t)},t.prototype.hideGroupingHint=function(t){t.innerWindow&&t.innerWindow.updateOptions&&t.innerWindow.updateOptions({opacity:1}),this.targetGroup.delete(t.id)},t.prototype.isHorizontallyAligned=function(t,n){return t.y>=n.y&&t.y<=n.bottom||t.bottom>=n.y&&t.bottom<=n.bottom||t.y<=n.y&&t.bottom>=n.bottom},t.prototype.isVerticallyAligned=function(t,n){return t.x>=n.x&&t.x<=n.right||t.right>=n.x&&t.right<=n.right||t.x<=n.x&&t.right>=n.right},t.prototype.getSnapBounds=function(t,n){var e,o,i,r,a,s,u,c;if(this.isHorizontallyAligned(t,n)&&(e=Math.abs(t.x-(n.right-this.snapOffset))<this.snapThreshold,o=Math.abs(t.x-n.x)<this.snapThreshold,i=Math.abs(t.right-this.snapOffset-n.x)<this.snapThreshold,r=Math.abs(t.right-n.right)<this.snapThreshold),this.isVerticallyAligned(t,n)&&(a=Math.abs(t.y-(n.bottom-this.snapOffset))<this.snapThreshold,s=Math.abs(t.y-n.y)<this.snapThreshold,u=Math.abs(t.bottom-this.snapOffset-n.y)<this.snapThreshold,c=Math.abs(t.bottom-n.bottom)<this.snapThreshold),e||i||a||u){var p=t.x,d=t.y;return e?p=n.x+n.width-this.snapOffset:o&&(p=n.x),i?p=n.x-t.width+this.snapOffset:r&&(p=n.x+n.width-t.width),a?d=n.y+n.height-Math.floor(this.snapOffset/2):s&&(d=n.y),u?d=n.y-t.height+Math.floor(this.snapOffset/2):c&&(d=n.y+n.height-t.height),new v(p,d,t.width,t.height)}},t}(L),E=function(){},M=function(){};!function(t){var e={close:"unload"},n=function(n){function t(t){return n.call(this,t)||this}return s(t,n),Object.defineProperty(t.prototype,"id",{get:function(){return this.innerWindow[a.windowUuidPropertyKey]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.innerWindow[a.windowNamePropertyKey]},enumerable:!0,configurable:!0}),t.prototype.load=function(n,t){var e=this;return new Promise(function(t){e.innerWindow.location.replace(n),t()})},t.prototype.focus=function(){return this.innerWindow.focus(),Promise.resolve()},t.prototype.show=function(){return Promise.resolve()},t.prototype.hide=function(){return Promise.resolve()},t.prototype.close=function(){return this.innerWindow.close(),Promise.resolve()},t.prototype.minimize=function(){var n=this;return new Promise(function(t){n.innerWindow.minimize(),t()})},t.prototype.maximize=function(){var n=this;return new Promise(function(t){n.innerWindow.maximize(),t()})},t.prototype.restore=function(){var n=this;return new Promise(function(t){n.innerWindow.restore(),t()})},t.prototype.isShowing=function(){return Promise.resolve(!0)},t.prototype.getSnapshot=function(){return Promise.reject("getSnapshot requires an implementation.")},t.prototype.flash=function(t,n){return Promise.reject("Not supported")},t.prototype.getBounds=function(){var n=this;return new Promise(function(t){t(new v(n.innerWindow.screenX,n.innerWindow.screenY,n.innerWindow.outerWidth,n.innerWindow.outerHeight))})},t.prototype.setBounds=function(n){var e=this;return new Promise(function(t){e.innerWindow.moveTo(n.x,n.y),e.innerWindow.resizeTo(n.width,n.height),t()})},t.prototype.getOptions=function(){var e=this;return new Promise(function(t,n){t(e.innerWindow[h.windowOptionsPropertyKey])})},t.prototype.getState=function(){var n=this;return new Promise(function(t){n.nativeWindow&&n.nativeWindow.getState?t(n.nativeWindow.getState()):t(void 0)})},t.prototype.setState=function(n){var e=this;return new Promise(function(t){e.nativeWindow&&e.nativeWindow.setState&&e.nativeWindow.setState(n),t()}).then(function(){e.emit("state-changed",{name:"state-changed",sender:e,state:n}),W.emit("state-changed",{name:"state-changed",windowId:e.id,state:n})})},t.prototype.attachListener=function(t,n){this.innerWindow.addEventListener(e[t]||t,n)},t.prototype.detachListener=function(t,n){this.innerWindow.removeEventListener(e[t]||t,n)},Object.defineProperty(t.prototype,"nativeWindow",{get:function(){return this.innerWindow},enumerable:!0,configurable:!0}),t}(W);t.DefaultContainerWindow=n;var o=function(){function u(t){this.container=t}return u.prototype.subscribe=function(r,a,t){var s=this;return new Promise(function(t,n){var e=new d(r,function(t){if(t.origin===s.container.globalWindow.location.origin){var n=t.data,e=n.source,o=n.topic,i=n.message;e===u.messageSource&&r===o&&a({topic:r},i)}});s.container.globalWindow&&s.container.globalWindow.addEventListener&&s.container.globalWindow.addEventListener("message",e.listener),t(e)})},u.prototype.unsubscribe=function(t){return Promise.resolve(this.container.globalWindow.removeEventListener("message",t.listener))},u.prototype.publish=function(t,n,e){var o=this.container.globalWindow?this.container.globalWindow[a.windowsPropertyKey]||this.container.globalWindow.opener&&this.container.globalWindow.opener[a.windowsPropertyKey]:[];if(o)for(var i in o){var r=o[i];e&&e.name&&e.name!==r[a.windowNamePropertyKey]||r.location.origin===this.container.globalWindow.location.origin&&r.postMessage({source:u.messageSource,topic:t,message:n},this.container.globalWindow.location.origin)}return Promise.resolve()},u.messageSource="desktopJS",u}();t.DefaultMessageBus=o;var a=function(e){function u(t){var n=e.call(this,t)||this;return n.windowOptionsMap=u.defaultWindowOptionsMap,n.hostType="Default",n.ipc=n.createMessageBus(),!n.globalWindow||u.windowsPropertyKey in n.globalWindow||(n.globalWindow[u.windowsPropertyKey]={root:n.globalWindow},n.globalWindow[u.windowNamePropertyKey]=n.globalWindow[u.windowUuidPropertyKey]=u.rootWindowUuid),n.screen=new i(n.globalWindow),n}return s(u,e),u.prototype.createMessageBus=function(){return new o(this)},u.prototype.getInfo=function(){return Promise.resolve(this.globalWindow.navigator.appVersion)},u.prototype.getMainWindow=function(){if(!this.mainWindow){var t=this.globalWindow[u.windowsPropertyKey].root;this.mainWindow=t?this.wrapWindow(t):null}return this.mainWindow},u.prototype.getCurrentWindow=function(){return this.wrapWindow(this.globalWindow)},u.prototype.getWindowOptions=function(t){return c.ObjectTransform.transformProperties(t,this.windowOptionsMap)},u.prototype.wrapWindow=function(t){return new n(t)},u.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var o=t.apply(this.globalWindow,n),i=this.globalWindow[u.windowsPropertyKey],r=o[u.windowUuidPropertyKey]=p.newGuid();return(i[r]=o).addEventListener("beforeunload",function(){o.addEventListener("unload",function(){delete i[r]})}),o[u.windowsPropertyKey]=i,h.emit("window-created",{name:"window-created",windowId:r}),W.emit("window-created",{name:"window-created",windowId:r}),o},u.prototype.createWindow=function(t,n){var e,o="_blank",i=this.getWindowOptions(n);if(i){for(var r in i)e=(e||"")+r+"="+i[r]+",";i&&"target"in i&&(o=i.target)}var a=this.globalWindow.open(t,o,e);a[h.windowOptionsPropertyKey]=n,a[u.windowNamePropertyKey]=i.name;var s=this.wrapWindow(a);return this.emit("window-created",{sender:this,name:"window-created",window:s,windowId:s.id,windowName:i.name}),Promise.resolve(s)},u.prototype.showNotification=function(n,e){var o=this;"Notification"in this.globalWindow?this.globalWindow.Notification.requestPermission(function(t){"denied"===t?console.warn("Notifications not permitted"):"granted"===t&&new o.globalWindow.Notification(n,e)}):console.warn("Notifications not supported")},u.prototype.closeAllWindows=function(r){var a=this;return new Promise(function(t,n){var e=a.globalWindow[u.windowsPropertyKey];for(var o in e){var i=e[o];r&&a.globalWindow===i||i.close()}t()})},u.prototype.getAllWindows=function(){var r=this;return new Promise(function(t,n){var e=[],o=r.globalWindow[u.windowsPropertyKey];for(var i in o)e.push(r.wrapWindow(o[i]));t(e)})},u.prototype.getWindowById=function(o){var i=this;return new Promise(function(t,n){var e=i.globalWindow[u.windowsPropertyKey][o];t(e?i.wrapWindow(e):null)})},u.prototype.getWindowByName=function(i){var r=this;return new Promise(function(t,n){var e=r.globalWindow[u.windowsPropertyKey];for(var o in e)if(e[o][u.windowNamePropertyKey]===i)return void t(r.wrapWindow(e[o]));t(null)})},u.prototype.buildLayout=function(){var f=this,l=new x;return new Promise(function(n,e){var o=[];f.getAllWindows().then(function(t){t.forEach(function(c){var p=c.nativeWindow,d=p[h.windowOptionsPropertyKey];d&&"persist"in d&&!d.persist||o.push(new Promise(function(i){return r=f,u=function(){var n,e,o;return w(this,function(t){switch(t.label){case 0:return this.globalWindow===p?[3,2]:(e=(n=l.windows).push,o={name:c.name,url:p&&p.location?p.location.toString():void 0,id:c.id,bounds:{x:p.screenX,y:p.screenY,width:p.outerWidth,height:p.outerHeight},options:d},[4,c.getState()]);case 1:e.apply(n,[(o.state=t.sent(),o)]),t.label=2;case 2:return i(),[2]}})},new((s=a=void 0)||(s=Promise))(function(t,n){function e(t){try{i(u.next(t))}catch(t){n(t)}}function o(t){try{i(u.throw(t))}catch(t){n(t)}}function i(n){n.done?t(n.value):new s(function(t){t(n.value)}).then(e,o)}i((u=u.apply(r,a||[])).next())});var r,a,s,u}))}),Promise.all(o).then(function(){n(l)}).catch(e)})})},u.windowsPropertyKey="desktopJS-windows",u.windowUuidPropertyKey="desktopJS-uuid",u.windowNamePropertyKey="desktopJS-name",u.rootWindowUuid="root",u.defaultWindowOptionsMap={x:{target:"left"},y:{target:"top"}},u}(r);t.DefaultContainer=a;var i=function(){function t(t){this.window=t}return t.prototype.getPrimaryDisplay=function(){var e=this;return new Promise(function(t){var n=new M;n.scaleFactor=e.window.devicePixelRatio,n.id="Current",n.bounds=new v(e.window.screen.availLeft,e.window.screen.availTop,e.window.screen.width,e.window.screen.height),n.workArea=new v(e.window.screen.availLeft,e.window.screen.availTop,e.window.screen.availWidth,e.window.screen.availHeight),t(n)})},t.prototype.getAllDisplays=function(){var t=this;return new Promise(function(n){t.getPrimaryDisplay().then(function(t){return n([t])})})},t.prototype.getMousePosition=function(){var e=this;return new Promise(function(t,n){t({x:e.window.event.screenX,y:e.window.event.screenY})})},t}()}(c.Default||(c.Default={}));var T=function(){},N=[];var k=function(){},G=function(){};c.Container=h,c.ContainerBase=n,c.ContainerNotification=l,c.ContainerRegistration=T,c.ContainerWindow=W,c.Display=M,c.EventArgs=a,c.EventEmitter=i,c.GlobalShortcutManager=G,c.GroupWindowManager=L,c.Guid=p,c.LayoutEventArgs=t,c.MenuItem=u,c.MessageBusOptions=e,c.MessageBusSubscription=d,c.NotificationOptions=f,c.PersistedWindow=P,c.PersistedWindowLayout=x,c.Point=E,c.PropertyMap=y,c.Rectangle=v,c.SnapAssistWindowManager=O,c.TrayIconDetails=k,c.WebContainerBase=r,c.WindowEventArgs=m,c.WindowGroupEventArgs=b,c.clearRegistry=function(){N.splice(0,N.length),c.container=void 0},c.registerContainer=function(t,n){N.push({id:t,registration:n})},c.resolveContainer=function(t,n){var e,o,i=!1,r=n;if("boolean"==typeof t?i=t:r=t,!i&&c.container)return c.container;try{for(var a=0;a<N.length;a++){o=N[a].id;var s=N[a].registration;e=s.condition(r)?s:e}c.container=e?e.create(r):void 0}catch(t){console.error("Error resolving container '"+o+"' : "+t.toString())}finally{c.container=c.container||new c.Default.DefaultContainer}return c.container},c.version="3.7.1",Object.defineProperty(c,"__esModule",{value:!0})});
//# sourceMappingURL=desktop.min.js.map

@@ -5,3 +5,3 @@ {

"description": "Library for abstracting common container hosting",
"version": "3.7.0",
"version": "3.7.1",
"publishConfig": {

@@ -8,0 +8,0 @@ "access": "public"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc