@openfin/workspace-platform 6.2.3 → 6.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,467 @@
1
+ /**
2
+ * Use relative paths here rather than aliases which mess
3
+ * up the packaged typing files. When writing code examples,
4
+ * for documentation, please use async/await syntax over .then()!
5
+ */
6
+ /**
7
+ * Describes the type of the app directory entry `manifest` attributes.
8
+ * Launch mechanics are determined by the manifest type.
9
+ */
10
+ export declare enum AppManifestType {
11
+ /**
12
+ * A snapshot manifest.
13
+ */
14
+ Snapshot = "snapshot",
15
+ /**
16
+ * A classic OpenFin app manifest.
17
+ */
18
+ Manifest = "manifest",
19
+ /**
20
+ * A view manifest.
21
+ */
22
+ View = "view",
23
+ /**
24
+ * A manifest for an external application.
25
+ */
26
+ External = "external"
27
+ }
28
+ export interface AppIntent {
29
+ name: string;
30
+ displayName: string;
31
+ contexts: string[];
32
+ }
33
+ /**
34
+ * Detailed metadata describing an image.
35
+ */
36
+ export interface Image {
37
+ src: string;
38
+ type?: string;
39
+ size?: string;
40
+ purpose?: string;
41
+ }
42
+ /**
43
+ * Detailed metadata describing an application.
44
+ */
45
+ export interface App {
46
+ /**
47
+ * Unique identifier for an application.
48
+ */
49
+ appId: string;
50
+ /**
51
+ * A UI friendly title for the application.
52
+ */
53
+ title: string;
54
+ /**
55
+ * URL to application manifest.
56
+ */
57
+ manifest: string;
58
+ /**
59
+ * UI friendly description for an application.
60
+ */
61
+ description?: string;
62
+ /**
63
+ * Describes the type of manifest resolved by the `manifest` field.
64
+ * Launch mechanics are determined by the manifest type.
65
+ */
66
+ manifestType: AppManifestType | string;
67
+ /**
68
+ * A list of icons that can be rendered in UI for this application.
69
+ */
70
+ icons: Image[];
71
+ /**
72
+ * A list of optional images that highlight application functionality.
73
+ */
74
+ images?: Image[];
75
+ intents?: AppIntent[];
76
+ tags?: string[];
77
+ version?: string;
78
+ publisher: string;
79
+ contactEmail?: string;
80
+ supportEmail?: string;
81
+ }
82
+ export declare enum StorefrontTemplate {
83
+ LandingPage = "landingPage",
84
+ AppGrid = "appGrid"
85
+ }
86
+ /**
87
+ * Represents a link to be rendered inside Storefront.
88
+ */
89
+ export interface StorefrontLink {
90
+ /**
91
+ * A UI friendly title to render the link as.
92
+ */
93
+ title: string;
94
+ /**
95
+ * When the rendered `title` text is clicked, the user will be navigated to this URL.
96
+ */
97
+ url: string;
98
+ }
99
+ export interface StorefrontFooter {
100
+ /**
101
+ * A logo to be displayed on the Storefront's footer.
102
+ */
103
+ logo: Image;
104
+ /**
105
+ * A set of links to display on Storefront's footer.
106
+ */
107
+ links: [StorefrontLink?, StorefrontLink?, StorefrontLink?];
108
+ text: string;
109
+ }
110
+ /**
111
+ * Render a navigation section on the left panel of Storefront.
112
+ */
113
+ export interface StorefrontNavigationSection {
114
+ /**
115
+ * Unique identifier for the navigation section.
116
+ */
117
+ id: string;
118
+ /**
119
+ * The UI friendly title of the navigation section.
120
+ */
121
+ title: string;
122
+ /**
123
+ * Navigation items to render under this section.
124
+ * 1-5 Navigation Items are supported.
125
+ */
126
+ items: [
127
+ StorefrontNavigationItem,
128
+ StorefrontNavigationItem?,
129
+ StorefrontNavigationItem?,
130
+ StorefrontNavigationItem?,
131
+ StorefrontNavigationItem?
132
+ ];
133
+ }
134
+ export interface StorefrontLandingPage {
135
+ hero?: {
136
+ title: string;
137
+ description: string;
138
+ cta: StorefrontNavigationItem;
139
+ image: Image;
140
+ };
141
+ topRow: {
142
+ title: string;
143
+ items: [
144
+ StorefrontDetailedNavigationItem?,
145
+ StorefrontDetailedNavigationItem?,
146
+ StorefrontDetailedNavigationItem?,
147
+ StorefrontDetailedNavigationItem?
148
+ ];
149
+ };
150
+ middleRow: {
151
+ title: string;
152
+ apps: [App?, App?, App?, App?, App?, App?];
153
+ };
154
+ bottomRow: {
155
+ title: string;
156
+ items: [
157
+ StorefrontDetailedNavigationItem?,
158
+ StorefrontDetailedNavigationItem?,
159
+ StorefrontDetailedNavigationItem?
160
+ ];
161
+ };
162
+ }
163
+ /**
164
+ * Render a grid of applications in Storefront.
165
+ */
166
+ export interface StorefrontAppGrid {
167
+ /**
168
+ * The apps to render in the grid.
169
+ */
170
+ apps: App[];
171
+ }
172
+ export interface StorefrontNavigationItemBase {
173
+ /**
174
+ * An ID for referencing the navigation item. Must be unique.
175
+ */
176
+ id: string;
177
+ /**
178
+ * UI friendly name for the navigation item.
179
+ */
180
+ title: string;
181
+ }
182
+ export interface StorefrontNavigationItemDetails {
183
+ description: string;
184
+ image: Image;
185
+ }
186
+ /**
187
+ * Template for rendering a navigation item that renders a app grid when clicked.
188
+ */
189
+ export interface StorefrontNavigationItemAppGrid extends StorefrontNavigationItemBase {
190
+ templateId: StorefrontTemplate.AppGrid;
191
+ /**
192
+ * Render an app grid when navigation item is pressed.
193
+ */
194
+ templateData: StorefrontAppGrid;
195
+ }
196
+ /**
197
+ * Template for rendering a navigation item that renders another landing page when clicked.
198
+ */
199
+ export interface StorefrontNavigationItemLandingPage extends StorefrontNavigationItemBase {
200
+ templateId: StorefrontTemplate.LandingPage;
201
+ /**
202
+ * Render a landing page when navigation item is pressed.
203
+ */
204
+ templateData: StorefrontLandingPage;
205
+ }
206
+ /**
207
+ * Render an item in the navigation bar of Storefront.
208
+ */
209
+ export declare type StorefrontNavigationItem = StorefrontNavigationItemAppGrid | StorefrontNavigationItemLandingPage;
210
+ /**
211
+ * Render an item in the navigation bar of Storefront with a description and image.
212
+ */
213
+ export declare type StorefrontDetailedNavigationItem = StorefrontNavigationItem & StorefrontNavigationItemDetails;
214
+ export interface StorefrontProviderInfo {
215
+ /**
216
+ * Unique identifier for the Storefront provider.
217
+ */
218
+ id: string;
219
+ /**
220
+ * A UI friendly title for the platform Storefront.
221
+ * This will be used in the Storefront selection dropdown.
222
+ */
223
+ title: string;
224
+ /**
225
+ * Icon for storefront provider.
226
+ * Visible next to title in storefront provider selector UI
227
+ */
228
+ icon: string;
229
+ }
230
+ /**
231
+ * Describes a Storefront provided by a platform.
232
+ * A platform must provide an object that satisfies this interface in order to register with the Storefront.
233
+ */
234
+ export interface StorefrontProvider extends StorefrontProviderInfo {
235
+ /**
236
+ * Get a list of apps to populate the platform's Storefront with.
237
+ *
238
+ * ```ts
239
+ *
240
+ * const app : App = {
241
+ * appId: 'uid'
242
+ * title: 'My App'
243
+ * manifest: `https://openfin-iex.experolabs.com/openfin/manifests/cash-flow.json`,
244
+ * icons: [
245
+ * {
246
+ * src: '/icon.png'
247
+ * }
248
+ * ],
249
+ * contactEmail: contact@email.com,
250
+ * supportEmail: support@email.com,
251
+ * publisher: 'My Publisher',
252
+ * tags: [],
253
+ * images: [],
254
+ * intents: []
255
+ * }
256
+ *
257
+ * const getApps = async (): Promise<App[]> => {
258
+ * return [app];
259
+ * }
260
+ * ```
261
+ */
262
+ getApps(): Promise<App[]>;
263
+ /**
264
+ * Get the main landing page for the platform's Storefront.
265
+ *
266
+ * ```ts
267
+ *
268
+ * const landingPage : StorefrontLandingPage = {
269
+ * hero: {
270
+ * title: 'My Landing Page',
271
+ * description: 'description',
272
+ * cta: navigationItems[0],
273
+ * image: {
274
+ * src: './images/image.png'
275
+ * }
276
+ * },
277
+ * topRow: {
278
+ * title: 'Top Row Title',
279
+ * items: //array of StorefrontNavigationItem
280
+ * },
281
+ * middleRow: {
282
+ * title: 'Middle Row Title',
283
+ * apps: //array of apps
284
+ * },
285
+ * bottomRow: {
286
+ * title: 'Bottom Row Title',
287
+ * items: //array of StorefrontNavigationItem
288
+ * }
289
+ * }
290
+ *
291
+ * const getLandingPage = async (): Promise<StorefrontLandingPage> => {
292
+ * return landingPage;
293
+ * }
294
+ *```
295
+ */
296
+ getLandingPage(): Promise<StorefrontLandingPage>;
297
+ /**
298
+ * Get the Storefront navigation sections for the left nav bar.
299
+ * ```ts
300
+ * const navigationSections: [StorefrontNavigationSection, StorefrontNavigationSection] = [
301
+ * {
302
+ * id: 'first id',
303
+ * title: 'title',
304
+ * items: //array of navigation items
305
+ * },
306
+ * {
307
+ * id: 'second id'
308
+ * title: 'title',
309
+ * items: //array of navigation items
310
+ * }
311
+ * ]
312
+ *
313
+ * const getNavigation = async (): Promise<[StorefrontNavigationSection, StorefrontNavigationSection]> => {
314
+ * return navigationSections;
315
+ * }
316
+ *```
317
+ */
318
+ getNavigation(): Promise<[StorefrontNavigationSection?, StorefrontNavigationSection?]>;
319
+ /**
320
+ * Get the footer for the platform's Storefront.
321
+ *
322
+ * ```ts
323
+ * const footer: StorefrontFooter = {
324
+ * logo: { src: './images/image', size: '32' },
325
+ * text: 'footer text',
326
+ * links: [
327
+ * { title:'title', url: 'https://openfin.co' },
328
+ * { title: 'title', url: 'https://openfin.co'}
329
+ * ]
330
+ * }
331
+ *
332
+ * const getFooter = async (): Promise<StorefrontFooter> => {
333
+ * return footer;
334
+ * }
335
+ * ```
336
+ */
337
+ getFooter(): Promise<StorefrontFooter>;
338
+ /**
339
+ * Launch an app provided by the platform's Storefront.
340
+ *
341
+ * ```ts
342
+ * import { getStorefrontProvider } from "./my-provider";
343
+ *
344
+ * //Grab your provider
345
+ * const myStoreFrontProvider: StorefrontProvider = getStorefrontProvider();
346
+ *
347
+ * const app : App = {
348
+ * appId: 'uid'
349
+ * title: 'My App'
350
+ * manifest: `https://openfin-iex.experolabs.com/openfin/manifests/cash-flow.json`,
351
+ * icons: [
352
+ * {
353
+ * src: './image.png'
354
+ * }
355
+ * ],
356
+ * contactEmail: contact@email.com,
357
+ * supportEmail: support@email.com,
358
+ * publisher: 'My Publisher',
359
+ * tags: [],
360
+ * images: [],
361
+ * intents: []
362
+ * }
363
+ *
364
+ * const launch = async () => {
365
+ * await myStorefrontProvider.launchApp(app);
366
+ * }
367
+ * ```
368
+ * @param app the app to launch.
369
+ */
370
+ launchApp(app: App): Promise<void>;
371
+ }
372
+ /**
373
+ * Interface that contains functions for integrating with Storefront.
374
+ */
375
+ export interface StorefrontAPI {
376
+ /**
377
+ * Registers a [[`StorefrontProvider`]]. Upon registering a provider,
378
+ * the title of your provider appears in the menu of the Storefront UI.
379
+ * When a user selects your Storefront, the methods on the provider
380
+ * object are called to populate the UI. Throws an error if a provider with
381
+ * the same `id` already exists.
382
+ *
383
+ * ```ts
384
+ * import { Storefront, StorefrontProvider } from "@openfin/workspace";
385
+ *
386
+ * //Declare a provider
387
+ * const myStorefrontProvider: StorefrontProvider = {
388
+ * id: "my-storefront-id"
389
+ * title: "My StorefrontProvider"
390
+ * icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
391
+ * getApps: () => {...},
392
+ * getNavigation: () => {...},
393
+ * getLandingPage: () => {...},
394
+ * getFooter: () => {...},
395
+ * launchApp: () => {...}
396
+ * };
397
+ *
398
+ * const registerProvider = async () => {
399
+ * await Storefront.register(myStorefrontProvider);
400
+ * }
401
+ * ```
402
+ * @param provider the implementation of a Storefront provider.
403
+
404
+ */
405
+ register(provider: StorefrontProvider): Promise<void>;
406
+ /**
407
+ * Deregister a provider.
408
+ *
409
+ * ```ts
410
+ * import { Storefront, StorefrontProvider } from "@openfin/workspace";
411
+ *
412
+ * //Instantiate a StorefrontProvider
413
+ * const myStorefrontProvider: StorefrontProvider = {
414
+ * id: "my-storefront-id"
415
+ * title: "My StoreFrontProvider"
416
+ * icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
417
+ * getApps: () => {...},
418
+ * getNavigation: () => {...},
419
+ * getLandingPage: () => {...},
420
+ * getFooter: () => {...},
421
+ * launchApp: () => {...}
422
+ * };
423
+ *
424
+ * const register = async () => {
425
+ * await Storefront.register(myStorefrontProvider);
426
+ * }
427
+ *
428
+ * //Do work with myStorefrontProvider
429
+ *
430
+ * const deregister = async () => {
431
+ * await Storefront.deregister("my-storefront-id");
432
+ * }
433
+ * ```
434
+ * @param id the id of the provider.
435
+ */
436
+ deregister(id: string): Promise<void>;
437
+ /**
438
+ * Shows the Storefront window. Awaits for the latest [[`Storefront.register()`]]
439
+ * internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
440
+ * doesn't exist (i.e., because `register()` not called previously).
441
+ *
442
+ * ```ts
443
+ * import { Storefront } from "@openfin/workspace";
444
+ *
445
+ * const show = async () => {
446
+ * await Storefront.show();
447
+ * //Do thing after show
448
+ * }
449
+ * ```
450
+ */
451
+ show(): Promise<void>;
452
+ /**
453
+ * Hides the Storefront window. Awaits for the latest [[`Storefront.register()`]]
454
+ * internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
455
+ * doesn't exist (i.e., because `register()` was not called previously).
456
+ *
457
+ * ```ts
458
+ * import { Storefront } from "@openfin/workspace";
459
+ *
460
+ * const hide = async () => {
461
+ * await Storefront.hidef();
462
+ * //Do thing after show
463
+ * }
464
+ * ```
465
+ */
466
+ hide(): Promise<void>;
467
+ }
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{AppManifestType:()=>i,BrowserButtonType:()=>u,CustomActionCallerType:()=>g,GlobalContextMenuOptionType:()=>p,PageTabContextMenuOptionType:()=>w,ViewTabMenuOptionType:()=>l,getCurrentSync:()=>wt,init:()=>Qt,wrapSync:()=>pt});var a,n,o,i,r,s,c,d,p,w,l,u,g,h;!function(e){e.Primary="primary",e.Secondary="secondary",e.TextOnly="textOnly"}(a||(a={})),function(e){e.Fetching="fetching",e.Fetched="fetched",e.Complete="complete"}(n||(n={})),function(e){e.Active="active",e.Default="default"}(o||(o={})),function(e){e.Snapshot="snapshot",e.Manifest="manifest",e.View="view",e.External="external"}(i||(i={})),function(e){e.LandingPage="landingPage",e.AppGrid="appGrid"}(r||(r={})),function(e){e.Suggestion="suggestion"}(s||(s={})),function(e){e.Contact="Contact",e.Custom="Custom",e.List="List",e.Plain="Plain",e.SimpleText="SimpleText"}(c||(c={})),function(e){e.MultiSelect="MultiSelect"}(d||(d={})),function(e){e.NewWindow="NewWindow",e.NewPage="NewPage",e.CloseWindow="CloseWindow",e.OpenStorefront="OpenStorefront",e.Quit="Quit",e.Custom="Custom"}(p||(p={})),function(e){e.Close="Close",e.Duplicate="Duplicate",e.Rename="Rename",e.Save="Save",e.Custom="Custom"}(w||(w={})),function(e){e.NewView="NewView",e.DuplicateViews="DuplicateView",e.OpenWithDefaultBrowser="OpenWithDefaultBrowser",e.ReloadViews="ReloadTab",e.CloseViews="CloseTab",e.AddToChannel="AddToChannel",e.RemoveFromChannel="RemoveFromChannel",e.Custom="Custom"}(l||(l={})),function(e){e.ShowHideTabs="ShowHideTabs",e.ColorLinking="ColorLinking",e.PresetLayouts="PresetLayouts",e.SavePage="SavePage",e.Minimise="Minimise",e.Maximise="Maximise",e.Close="Close",e.Custom="Custom"}(u||(u={})),function(e){e.CustomButton="CustomButton",e.GlobalContextMenu="GlobalContextMenu",e.ViewTabContextMenu="ViewTabContextMenu",e.PageTabContextMenu="PageTabContextMenu",e.API="API"}(g||(g={})),function(e){e.Local="local",e.Dev="dev",e.Staging="staging",e.Prod="prod"}(h||(h={}));const y="undefined"!=typeof window&&"undefined"!=typeof fin,f=("undefined"==typeof process||process.env?.JEST_WORKER_ID,"undefined"!=typeof window),m=f&&"undefined"!=typeof indexedDB,P=f?window.origin:h.Local,v=y&&fin.me.uuid,S=y&&fin.me.name,b=y&&fin.me.entityType,C=(h.Local,h.Dev,h.Staging,h.Prod,e=>e.startsWith("http://")||e.startsWith("https://")?e:P+e),W=(C("https://cdn.openfin.co/workspace/6.2.3"),C("https://cdn.openfin.co/workspace/6.2.3")),I=("undefined"!=typeof WORKSPACE_DOCS_PLATFORM_URL&&C(WORKSPACE_DOCS_PLATFORM_URL),"undefined"!=typeof WORKSPACE_DOCS_CLIENT_URL&&C(WORKSPACE_DOCS_CLIENT_URL),"23.96.68.3");var T;!function(e){e.LastLaunchedWorkspaceId="activeWorkspaceId",e.LastFocusedBrowserWindow="lastFocusedBrowserWindow",e.MachineName="machineName",e.NewTabPageLayout="NewTabPageLayout",e.NewTabPageSort="NewTabPageSort"}(T||(T={}));const k=T;var A,M,V;!function(e){e.Workspace="openfin-browser"}(A||(A={})),function(e){e.RunRequested="run-requested",e.WindowOptionsChanged="window-options-changed",e.WindowClosed="window-closed",e.WindowCreated="window-created"}(M||(M={})),function(e){e.FinProtocol="fin-protocol"}(V||(V={}));const O={uuid:v,name:v},x=(A.Workspace,A.Workspace,e=>{if(!y)throw new Error("getApplication cannot be used in a non OpenFin env. Avoid using this during pre-rendering.");return fin.Application.wrapSync(e)});var F,L;!function(e){e.Home="openfin-home",e.Dock="openfin-dock",e.Storefront="openfin-storefront",e.HomeInternal="openfin-home-internal",e.BrowserMenu="openfin-browser-menu",e.BrowserIndicator="openfin-browser-indicator",e.BrowserWindow="internal-generated-window"}(F||(F={})),function(e){e.Shown="shown",e.BoundsChanged="bounds-changed",e.LayoutReady="layout-ready",e.EndUserBoundsChanging="end-user-bounds-changing",e.Blurred="blurred",e.CloseRequested="close-requested",e.Focused="focused",e.ShowRequested="show-requested",e.ViewCrashed="view-crashed",e.ViewAttached="view-attached",e.ViewDetached="view-detached",e.ViewPageTitleUpdated="view-page-title-updated",e.ViewDestroyed="view-destroyed",e.OptionsChanged="options-changed"}(L||(L={}));function D(e){if(!y)throw new Error("getOFWindow can only be used in an OpenFin env. Avoid calling this method during pre-rendering.");return fin.Window.wrapSync(e)}const R={name:S,uuid:v};function U(){return D(R)}F.Home,A.Workspace,F.Dock,A.Workspace;const E={name:F.Storefront,uuid:A.Workspace};A.Workspace,A.Workspace;async function G(e){const t=D(e);"minimized"===await t.getState()&&await t.restore(),await t.show(),await t.bringToFront(),await t.focus()}const B=e=>e.startsWith(F.BrowserWindow);async function _(){return(await fin.Application.getCurrentSync().getChildWindows()).filter((e=>B(e.identity.name)))}const N=e=>D(e).getOptions().then((()=>!0)).catch((()=>!1)),H=()=>N(E);async function $(){if("undefined"!=typeof localStorage)try{const e=localStorage.getItem(k.LastFocusedBrowserWindow),t=JSON.parse(e);if(await N(t))return t}catch(e){throw new Error(`failed to get last focused browser window: ${e}`)}}function q(e=fin.me.identity){B(e.name)&&function(e){if("undefined"!=typeof localStorage)try{const t=JSON.stringify(e);localStorage.setItem(k.LastFocusedBrowserWindow,t)}catch(e){}}(e)}const j=(e,t=0)=>{let a,n,o=!1;const i=async n=>{const r=await e(...n);if(o){await new Promise((e=>setTimeout(e,t)));const e=a;return a=void 0,o=!1,i(e)}return r};return(...e)=>(n?(o=!0,a=e):n=i(e).then((e=>(n=void 0,e))),n)};var Q;!function(e){e.TabCreated="tab-created",e.ContainerCreated="container-created",e.ContainerResized="container-resized"}(Q||(Q={}));const K=e=>{const t=[];return(e&&Array.isArray(e)?e:[]).forEach((e=>{if("component"===e.type)return t.push(e.componentState);const a=K(e.content);t.push(...a)})),t},z=async(e,t,a=R)=>{let n;if(B(a.name)){n=(await D(a).getOptions()).layout||{settings:{}}}return{...n,content:[{type:"stack",content:[{type:"component",componentName:"view",componentState:{title:e,url:t}}]}]}};new Map;const J=f&&"complete"!==document.readyState&&new Promise((e=>document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&e()}))));function X(e){let t;return()=>{if(!y)throw new Error("getChannelClient cannot be used outside an OpenFin env. Avoid using this method during pre-rendering.");return t||(t=(async()=>{await J;const a=await fin.InterApplicationBus.Channel.connect(e);return a.onDisconnection((async()=>{t=void 0})),a})().then((e=>e)).catch((a=>{throw t=void 0,new Error(`failed to connect to channel provider ${e}: ${a}`)}))),t}}const Y=e=>`__browser_window__-${e.uuid}-${e.name}`,Z=new Map,ee=e=>{const t=Y(e);return Z.has(t)||Z.set(t,X(t)),Z.get(t)()};var te,ae,ne;!function(e){e.CloseBrowserWindow="close-browser-window",e.QuitPlatform="quit-platform",e.ClosePage="close-page",e.AddToChannel="add-to-channel",e.RemoveFromChannel="remove-from-channel",e.SavePage="save-page",e.DuplicatePage="duplicate-page"}(te||(te={})),function(e){e.GetPages="get-pages",e.GetActivePageForWindow="get-active-page-for-window",e.AttachPagesToWindow="attach-pages-to-window",e.DetachPagesFromWindow="detach-pages-from-window",e.SetActivePageForWindow="set-active-page-for-window",e.RenamePage="rename-page",e.ReorderPagesForWindow="reorder-pages-for-window",e.UpdatePageForWindow="update-page-for-window",e.UpdatePagesWindowOptions="update-pages-window-options",e.IsDetachingPages="is-detaching-pages",e.IsActivePageChanging="is-active-page-changing"}(ae||(ae={})),function(e){e.AttachedPagesToWindow="attached-pages-to-window",e.DetachedPagesFromWindow="detached-pages-from-window"}(ne||(ne={}));new Map;const oe=async e=>{const t=await ee(e);return await t.dispatch(ae.GetPages)},ie=async e=>(await ee(e.identity)).dispatch(ae.UpdatePageForWindow,e);var re;!function(e){e.LaunchApp="launchApp",e.SavePage="savePage",e.GetSavedPage="getSavedPage",e.CreateSavedPage="createSavedPage",e.UpdateSavedPage="updateSavedPage",e.DeleteSavedPage="deleteSavedPage",e.GetSavedPages="getSavedPages",e.CreateSavedPageInternal="createSavedPageInternal",e.UpdateSavedPageInternal="updateSavedPageInternal",e.DeleteSavedPageInternal="deleteSavedPageInternal",e.SharePage="sharePage",e.UpdatePageForWindow="updatePageForWindow",e.AttachPagesToWindow="attachPagesToWindow",e.DetachPagesFromWindow="detachPagesFromWindow",e.ReorderPagesForWindow="reorderPagesForWindow",e.SetActivePage="setActivePage",e.GetAllAttachedPages="getAllAttachedPages",e.GetActivePageIdForWindow="getActivePageIdForWindow",e.GetPagesForWindow="getPagesForWindow",e.GetPageForWindow="getPageForWindow",e.GetSavedPageMetadata="getSavedPageMetadata",e.GetUniquePageTitle="getUniquePageTitle",e.GetLastFocusedBrowserWindow="getLastFocusedBrowserWindow",e.GetThemes="getThemes",e.OpenGlobalContextMenuInternal="openGlobalContextMenuInternal",e.OpenViewTabContextMenuInternal="openViewTabContextMenuInternal",e.OpenPageTabContextMenuInternal="openPageTabContextMenuInternal",e.InvokeCustomActionInternal="invokeCustomActionInternal"}(re||(re={}));const se=async e=>{const t=fin.Platform.wrapSync(e),a=await t.getClient(),n="Target is not a Workspace Platform. Target must call WorkspacePlatform.init";try{if(!0===await a.dispatch("isWorkspacePlatform"))return a;throw new Error(n)}catch(e){throw new Error(n)}},ce=async()=>{const e=await _();return(await Promise.all(e.map((async({identity:e})=>oe(e))))).reduce(((e,t)=>e.concat(t)),[])},de=async()=>(await se(R)).dispatch(re.GetSavedPages,void 0),pe=async e=>(await se(R)).dispatch(re.GetSavedPage,e),we=async(e,t)=>{const a=await(async e=>(await ce()).find((t=>t.pageId===e)))(e);return!a||a.title===t.title&&e===t.pageId||await ie({identity:a.parentIdentity,pageId:e,page:{pageId:t.pageId,title:t.title}}),a},le=async({page:e})=>{await we(e.pageId,e),await(async e=>(await se(R)).dispatch(re.CreateSavedPage,e))({page:e})},ue=async e=>{await pe(e)&&await(async e=>(await se(R)).dispatch(re.DeleteSavedPage,e))(e)},ge=async({pageId:e,page:t})=>{await we(e,t);return await(async e=>(await se(R)).dispatch(re.UpdateSavedPage,e))({pageId:e,page:t})},he=async e=>await pe(e.pageId)?ge({pageId:e.pageId,page:e}):le({page:e}),ye=async e=>{await(async e=>(await ee(e.identity)).dispatch(ae.AttachPagesToWindow,e))(e)},fe=async e=>{await ie(e)},me=async e=>{await(async e=>(await ee(e.identity)).dispatch(ae.DetachPagesFromWindow,e))(e)},Pe=async e=>{await(async e=>(await ee(e.identity)).dispatch(ae.SetActivePageForWindow,e))(e)},ve=e=>oe(e),Se=async({identity:e,pageId:t})=>(await ve(e)).find((e=>e.pageId===t)),be=async e=>{await(async e=>(await ee(e.identity)).dispatch(ae.ReorderPagesForWindow,e))(e)},Ce=(e,t)=>!t.find((t=>t===e)),We=(e,t)=>`${e} (${t})`;async function Ie(e="Untitled Page"){const[t,a]=await Promise.all([de(),ce()]),n=[...t,...a].map((({title:e})=>e));if(!n.find((t=>t===e)))return e;let o=1;const i=e.replace(/ \(.+\)$/,"");for(;!Ce(We(i,o),n);)o+=1;return We(i,o)}const Te=new Map,ke=e=>`${e.uuid}-${e.name}`;const Ae=j((async function(){const e=await ce(),t=new Set;e.forEach((e=>{K(e.layout.content).forEach((e=>{if(e.name){const a=ke(e);t.add(a)}}))}));const a=U();(await a.getCurrentViews()).forEach((({identity:e})=>{const a=ke(e);if(t.has(a)||Te.has(a))return;const n=setTimeout((()=>{fin.View.wrapSync(e).destroy(),Te.delete(a)}),5e3);Te.set(a,n)})),Te.forEach(((e,a)=>{t.has(a)&&(clearTimeout(e),Te.delete(a))}))}),2500),Me=({name:e})=>{B(e)&&Ae().catch((()=>{}))};function Ve(){const e=x(O);e.addListener(M.WindowOptionsChanged,Ae),e.addListener(M.WindowClosed,Me),e.addListener(M.WindowCreated,Me)}let Oe={};const xe=({actionId:e,payload:t})=>{if("function"!=typeof Oe[e])throw new Error(`Cannot find a configured function for the action '${e}'`);return Oe[e](t)};function Fe(){return localStorage.getItem(k.MachineName)}let Le,De;async function Re(){return Le||(Le=await fin.System.getMachineId()),Le}async function Ue(e){const t=e||await fin.Platform.getCurrentSync().getSnapshot();if(t.snapshotDetails?.machineId)return t;const a=Fe();return{...t,snapshotDetails:{...e.snapshotDetails,machineId:await Re(),machineName:a}}}function Ee(e){return new Promise(((t,a)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>a(e.error)}))}function Ge(e,t){const a=indexedDB.open(e);a.onupgradeneeded=()=>a.result.createObjectStore(t);const n=Ee(a);return(e,a)=>n.then((n=>a(n.transaction(t,e).objectStore(t))))}function Be(){return De||(De=Ge("keyval-store","keyval")),De}function _e(e,t){return e("readonly",(e=>(e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Ee(e.transaction))))}const Ne=m&&Ge("openfin-home-pages","pages");async function He(e){const t=await function(e,t=Be()){return t("readonly",(t=>Ee(t.get(e))))}(e,Ne);return t?(t.pageId=e.toString(),t.title=t.title||t.pageId,t):null}async function $e(e){const t=await function(e=Be()){const t=[];return _e(e,(e=>t.push(e.key))).then((()=>t))}(Ne),a=await Promise.all(t.map((e=>He(e.toString()))));return e?a.filter((t=>((e,t="")=>e.toLowerCase().includes(t.toLowerCase()))(t.title,e))):a}async function qe({page:e}){await function(e,t,a=Be()){return a("readwrite",(a=>(a.put(t,e),Ee(a.transaction))))}(e.pageId,e,Ne)}async function je(e){await function(e,t=Be()){return t("readwrite",(t=>(t.delete(e),Ee(t.transaction))))}(e,Ne)}async function Qe({pageId:e,page:t}){if(void 0===await He(e))throw new Error("page not found");await qe({page:t}),e!==t.pageId&&await je(e)}var Ke,ze;!function(e){e.Label="normal",e.Separator="separator",e.Submenu="submenu",e.Checkbox="checkbox"}(Ke||(Ke={}));var Je=new Uint8Array(16);function Xe(){if(!ze&&!(ze="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ze(Je)}const Ye=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Ze=function(e){return"string"==typeof e&&Ye.test(e)};for(var et=[],tt=0;tt<256;++tt)et.push((tt+256).toString(16).substr(1));const at=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase();if(!Ze(a))throw TypeError("Stringified UUID is invalid");return a};const nt=function(e,t,a){var n=(e=e||{}).random||(e.rng||Xe)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){a=a||0;for(var o=0;o<16;++o)t[a+o]=n[o];return t}return at(n)};var ot;!function(e){e.RegisterStorefrontProvider="register-storefront-provider",e.DeregisterStorefrontProvider="deregister-storefront-provider",e.GetStorefrontProviders="get-storefront-providers",e.HideStorefront="hide-storefront",e.GetStorefrontProviderApps="get-storefront-provider-apps",e.GetStorefrontProviderLandingPage="get-storefront-provider-landing-page",e.GetStorefrontProviderFooter="get-storefront-provider-footer",e.GetStorefrontProviderNavigation="get-storefront-provider-navigation",e.LaunchStorefrontProviderApp="launch-storefront-provider-app",e.ShowStorefront="show-storefront",e.CreateStorefrontWindow="create-storefront-window",e.ShowHome="show-home",e.HideHome="hide-home",e.AssignHomeSearchContext="assign-home-search-context",e.GetLegacyPages="get-legacy-pages",e.GetLegacyWorkspaces="get-legacy-workspaces",e.GetComputedPlatformTheme="get-computed-platform-theme"}(ot||(ot={}));X("__of_workspace_protocol__");const it=async(e,t)=>{const a=await(async e=>({...e,layoutDetails:{machineId:await Re(),machineName:Fe()}}))(t);return{pageId:nt(),title:e,layout:a,isReadOnly:!1,hasUnsavedChanges:!0}},rt=e=>({identity:e,openfinWindow:fin.Window.wrapSync(e),getPages:async()=>(await se(e)).dispatch(re.GetPagesForWindow,e),getPage:async t=>(await se(e)).dispatch(re.GetPageForWindow,{identity:e,pageId:t}),addPage:async t=>{const a=await se(e);t?.title||(t.title=await a.dispatch(re.GetUniquePageTitle,void 0));const n=(await a.dispatch(re.GetAllAttachedPages,void 0)).find((e=>e.pageId===t.pageId||e.title===t.title));if(n)throw n.pageId===t.pageId?new Error(`page with id ${t.pageId} is already attached to a browser window ${n.parentIdentity.name}`):new Error(`page with title ${t.title} is already attached to a browser window ${n.parentIdentity.name}`);const o={identity:e,pages:[t]};return a.dispatch(re.AttachPagesToWindow,o)},removePage:async t=>(await se(e)).dispatch(re.DetachPagesFromWindow,{identity:e,pageIds:[t]}),setActivePage:async t=>(await se(e)).dispatch(re.SetActivePage,{identity:e,pageId:t}),updatePage:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.UpdatePageForWindow,t)},reorderPages:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.ReorderPagesForWindow,t)},_openGlobalContextMenu:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.OpenGlobalContextMenuInternal,t)},replaceToolbarOptions:async t=>{const a=fin.Window.wrapSync(e);await a.updateOptions({workspacePlatform:{toolbarOptions:t}})},replaceWindowStateButtonOptions:async t=>{const a=fin.Window.wrapSync(e);await a.updateOptions({workspacePlatform:{windowStateButtonOptions:t}})},_openViewTabContextMenu:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.OpenViewTabContextMenuInternal,t)},_openPageTabContextMenu:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.OpenPageTabContextMenuInternal,t)}}),st=e=>{const t=fin.Platform.wrapSync(e);return{wrapSync:e=>rt(e),createWindow:async e=>{const a=await t.createWindow(e);return rt(a.identity)},getAllAttachedPages:async()=>(await t.getClient()).dispatch(re.GetAllAttachedPages,void 0),getAllWindows:async()=>(await fin.Application.wrapSync(e).getChildWindows()).filter((e=>e.identity.name.includes("internal-generated-window-"))).map((e=>rt(e.identity))),getUniquePageTitle:async t=>(await se(e)).dispatch(re.GetUniquePageTitle,t),getLastFocusedWindow:async()=>(await se(e)).dispatch(re.GetLastFocusedBrowserWindow,void 0)}},ct=e=>({createPage:async t=>(await se(e)).dispatch(re.CreateSavedPageInternal,t),deletePage:async t=>(await se(e)).dispatch(re.DeleteSavedPageInternal,t),updatePage:async t=>(await se(e)).dispatch(re.UpdateSavedPageInternal,t),getPage:async t=>(await se(e)).dispatch(re.GetSavedPage,t),getPages:async t=>(await se(e)).dispatch(re.GetSavedPages,t),savePage:async t=>(await se(e)).dispatch(re.SavePage,t)}),dt=e=>({getThemes:async()=>(await se(e)).dispatch(re.GetThemes,void 0)}),pt=e=>{const t=fin.Platform.wrapSync(e);return Object.assign(t,{applySnapshot:async t=>{if("string"!=typeof t&&!t?.windows)throw new Error("Not a valid browser snapshot");return fin.Platform.wrapSync(e).applySnapshot(t)},getSnapshot:()=>fin.Platform.wrapSync(e).getSnapshot().then((e=>e)),launchApp:async t=>{t.target||(t.target={uuid:v,name:S,entityType:b||"unknown"});return(await se(e)).dispatch(re.LaunchApp,t)},_invokeCustomAction:async(t,a)=>{const n=await se(e),o={actionId:t,payload:{...a,callerType:a.callerType||g.API}};return n.dispatch(re.InvokeCustomActionInternal,o)},Theme:dt(e),Browser:st(e),Storage:ct(e)})},wt=()=>pt(fin.me.identity),lt=async(e=R)=>{const{workspacePlatform:t}=await D(e).getOptions();return{newPageUrl:t?.newPageUrl,newTabUrl:t?.newTabUrl}},ut=async(e=R)=>{const t=await wt().Browser.getUniquePageTitle("Untitled Page"),a=await(async(e=R)=>{const{newPageUrl:t}=await lt(e);if(!t)throw new Error("Trying to create a new page without a newPageUrl set");return z("New Tab",t,e)})(e);return it(t,a)},gt=[{type:Ke.Label,label:"Close Window",data:{type:p.CloseWindow}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Open Storefront",data:{type:p.OpenStorefront}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Quit Workspace",data:{type:p.Quit}}],ht=[{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Close Window",data:{type:p.CloseWindow}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Quit",data:{type:p.Quit}}],yt=async e=>{const t=await H(),{newPageUrl:a}=await lt(e),n=await(async e=>{const t=D(e),{workspacePlatform:a}=await t.getOptions();return a?.disableMultiplePages})(e),o=[];return a&&(o.push({type:Ke.Label,label:"New Window",data:{type:p.NewWindow}}),n||o.push({type:Ke.Label,label:"New Page",data:{type:p.NewPage}})),t?[...o,...gt]:[...o,...ht]},ft=async(e,t)=>{if(!e)return;const a=t.identity,n=await ee(a);switch(e.type){case p.NewWindow:const{newPageUrl:t}=await lt(a);if(!t)throw new Error("Trying to create a new empty window without a newPageUrl set");wt().createView({target:void 0,url:t});break;case p.NewPage:await(async e=>{const t=await ut(e);await wt().Browser.wrapSync(e).addPage(t)})(a);break;case p.CloseWindow:n.dispatch(te.CloseBrowserWindow);break;case p.Quit:n.dispatch(te.QuitPlatform);break;case p.OpenStorefront:(async()=>{await H()&&G(E)})();break;case p.Custom:if(e.action){const t={callerType:g.GlobalContextMenu,windowIdentity:a,customData:e.action.customData};wt()._invokeCustomAction(e.action.id,t)}}},mt=async(e,t)=>{const a=await ee(t.identity);switch(e.type){case w.Save:case w.Rename:a.dispatch(te.SavePage,t.pageId);break;case w.Duplicate:a.dispatch(te.DuplicatePage,t.pageId);break;case w.Close:a.dispatch(te.ClosePage,t.pageId);break;case w.Custom:if(e.action){const a={callerType:g.PageTabContextMenu,windowIdentity:t.identity,pageId:t.pageId,customData:e.action.customData};wt()._invokeCustomAction(e.action.id,a)}}},Pt=async(e,t)=>{const a=t.selectedViews[0],n=fin.View.wrapSync(a),o=await(async e=>{const{newTabUrl:t}=await lt(e);if(!t)throw new Error("Trying to create a new page without a newTabUrl set");return{...z("New View",t),url:t,target:e}})(e);await wt().createView(o,e,n.identity)},vt=async(e,t)=>{const a=await(e=>Promise.all(e.map((async e=>fin.View.wrapSync(e).getInfo()))))(t),{newPageUrl:n,newTabUrl:o}=await lt(e);a.forEach((async e=>{e.url!==n&&e.url!==o&&await fin.System.openUrlWithBrowser(e.url)}))},St=(e,t)=>{t.forEach((async t=>{const a=fin.View.wrapSync(t);await(async(e,t)=>{const{url:a}=await t.getInfo(),n={...await t.getOptions(),url:a,target:e,name:void 0};await wt().createView(n,e,t.identity)})(e,a)}))},bt=async(e,t)=>{if(!e)return;const a=t.identity;switch(e.type){case l.CloseViews:await(async(e,t)=>{if((await fin.Window.wrapSync(e).getCurrentViews()).length!==t.length)t.forEach((async e=>{const t=fin.View.wrapSync(e);await t.destroy()}));else{const t=(await wt().Browser.wrapSync(e).getPages()).find((e=>e.isActive));(await ee(e)).dispatch(te.ClosePage,t?.pageId)}})(a,t.selectedViews);break;case l.OpenWithDefaultBrowser:await vt(a,t.selectedViews);break;case l.ReloadViews:t.selectedViews.forEach((async e=>{const t=fin.View.wrapSync(e);await t.reload()}));break;case l.NewView:await Pt(a,t);break;case l.DuplicateViews:St(a,t.selectedViews);break;case l.AddToChannel:(async(e,t,a)=>{const n={newChannelId:t,selectedViews:a};(await ee(e)).dispatch(te.AddToChannel,n)})(a,e.option,t.selectedViews);break;case l.RemoveFromChannel:(async(e,t)=>{(await ee(e)).dispatch(te.RemoveFromChannel,t)})(a,t.selectedViews);break;case l.Custom:if(e.action){const n={callerType:g.ViewTabContextMenu,windowIdentity:a,selectedViews:t.selectedViews,customData:e.action.customData};wt()._invokeCustomAction(e.action.id,n)}}};async function Ct(e,t){const a=await yt(e.identity),n={...e,template:a,callback:ft};await this.openGlobalContextMenu(n,t)}const Wt=async(e,t)=>{const{x:a,y:n,identity:o,template:i,callback:r}=e,{data:s}=await function(e,t){if(!y)throw new Error("showContextMenu can only be used in an OpenFin env. Avoid calling this method during pre-rendering.");if(!t&&!fin.me.isWindow)throw new Error("showContextMenu can only be used in an OpenFin window.");return(t||fin.Window.getCurrentSync()).showPopupMenu(e)}({x:a,y:n,template:i},fin.Window.wrapSync(o));r(s,e)};async function It(e,t){const a={...e,callback:bt};await this.openViewTabContextMenu(a,t)}async function Tt(e,t){const a=await wt().Storage.getPage(e.pageId),n=await(o=!!a,[{type:Ke.Label,label:"Save Page",data:{type:w.Save}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Rename Page",data:{type:w.Rename},enabled:o},{type:Ke.Label,label:"Duplicate Page",data:{type:w.Duplicate}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Close Page",data:{type:w.Close}}]);var o;const i={...e,template:n,callback:mt};await this.openPageTabContextMenu(i,t)}async function kt({app:e,target:t}){const a=fin.Platform.getCurrentSync();switch(e.manifestType){case i.Snapshot:return a.applySnapshot(e.manifest);case i.View:return async function(e,t){const a=fin.Platform.getCurrentSync();if("view"===t.entityType){const a=fin.View.wrapSync(t),n=await a.getParentLayout();return await n.replaceView(t,{manifestUrl:e.manifest,url:void 0,target:void 0}),a.destroy()}return a.createView({name:void 0,url:void 0,manifestUrl:e.manifest,target:void 0})}(e,t);case i.External:return fin.System.launchExternalProcess({path:e.manifest,uuid:e.appId});default:return fin.Application.startFromManifest(e.manifest)}}const At=e=>e&&"object"==typeof e&&!Array.isArray(e);function Mt(e,...t){if(!t.length)return e;const a=t.shift();return At(e)&&At(a)&&Object.entries(a).forEach((([t,a])=>{if(At(a))return e[t]||(e[t]={}),Mt(e[t],a);e[t]=a})),Mt(e,...t)}var Vt,Ot;!function(e){e.HomeIndex="/home/",e.HomeSearch="/home/search/",e.HomePagesRename="/home/pages/rename/",e.Dock="/home/dock/",e.BrowserPagesLanding="/browser/pages/landing/",e.HomeIndicator="/home/indicator/",e.Browser="/browser/",e.BrowserPopupMenu="/browser/popup-menu/",e.Provider="/provider/",e.BrowserPopupMenuSharePage="/browser/popup-menu/share-page/",e.BrowserPopupMenuSavePage="/browser/popup-menu/save-page/",e.BrowserPopupMenuLayouts="/browser/popup-menu/layouts/layouts/",e.BrowserPopupMenuColorLinking="/browser/popup-menu/color-linking/color-linking/",e.BrowserIndicator="/browser/indicator/",e.ResponseModal="/browser/popup-menu/response-modal/",e.Docs="/provider/docs/",e.Storefront="/storefront/",e.DeprecatedAlert="/provider/deprecated-alert/"}(Vt||(Vt={})),function(e){e.IconOpenFinLogo="/icons/openfinlogo.svg",e.IconFilter="/icons/filter.svg"}(Ot||(Ot={}));const xt=W+{...Ot,...Vt}.Browser;function Ft(e,t){const a=Mt({},t,e);return a.detachOnClose=!0,a}async function Lt(e,t,a){const n=e.manifestUrl?await t({manifestUrl:e.manifestUrl},a):void 0;if(n?.interop&&e.interop){const t={...e,...n,interop:e.interop};return delete t.manifestUrl,t}return e}const Dt=e=>{const t=e.name===F.Home,a=e.name?.startsWith(F.HomeInternal),n=e.name?.startsWith(F.BrowserMenu);return!t&&!a&&!n},Rt=e=>"workspacePlatform"in e?e:(({workstacks:e,pages:t,...a})=>({...a,workspacePlatform:{pages:t||e||null}}))(e),Ut={contextMenuSettings:{reload:!1},backgroundThrottling:!0,url:xt,contextMenu:!0,cornerRounding:{height:8,width:8},closeOnLastViewRemoved:!1,experimental:{showFavicons:!0,defaultFaviconUrl:`${W}/icons/defaultFavicon.svg`},permissions:{System:{openUrlWithBrowser:{enabled:!0,protocols:["mailto"]}}}},Et={dimensions:{borderWidth:3,headerHeight:30}},Gt=(e,t)=>t?e.map((e=>({...t,...e}))):e,Bt=e=>{const t=fin.Window.wrapSync(e);return Promise.all([t.bringToFront(),t.restore(),t.focus()])};async function _t(e){const t=await _();return await Promise.all(t.map((({identity:e})=>(async e=>(await ee(e)).dispatch(ae.UpdatePagesWindowOptions))(e)))),e?e():Ue()}let Nt=[];const Ht=()=>Nt;const $t=e=>async t=>{class a extends t{constructor(){super(),this.isWorkspacePlatform=()=>!0,this.addPage=this.attachPagesToWindow,this.detachPagesFromWindow=me,this.getAllAttachedPages=ce,this.getPagesForWindow=ve,this.getPageForWindow=Se,this.setActivePage=Pe,this.launchApp=kt,this.savePage=he,this.createSavedPageInternal=le,this.updateSavedPageInternal=ge,this.deleteSavedPageInternal=ue,this.reorderPagesForWindow=be,this.getUniquePageTitle=Ie,this.updatePageForWindow=fe,this.getLastFocusedBrowserWindow=$,this.getThemes=Ht,this.invokeCustomActionInternal=xe,this.openGlobalContextMenuInternal=this.openGlobalContextMenuInternal.bind(this),this.openGlobalContextMenu=this.openGlobalContextMenu.bind(this),this.getSavedPages=this.getSavedPages.bind(this),this.getSavedPage=this.getSavedPage.bind(this),this.createSavedPage=this.createSavedPage.bind(this),this.updateSavedPage=this.updateSavedPage.bind(this),this.deleteSavedPage=this.deleteSavedPage.bind(this),this.attachPagesToWindow=this.attachPagesToWindow.bind(this),this.openViewTabContextMenuInternal=this.openViewTabContextMenuInternal.bind(this),this.openViewTabContextMenu=this.openViewTabContextMenu.bind(this),this.openPageTabContextMenuInternal=this.openPageTabContextMenuInternal.bind(this),this.openPageTabContextMenu=this.openPageTabContextMenu.bind(this)}async getSnapshot(){const e=await _t((async()=>Ue(await super.getSnapshot(void 0,fin.me.identity))));return{...e,windows:e.windows.filter(Dt)}}async applySnapshot({snapshot:e,options:t}){t?.closeExistingWindows&&await async function(){const e=await _();await Promise.all(e.map((e=>e.close(!0).catch((()=>{})))))}();let a=e;return"string"==typeof a&&(a=await super.fetchManifest({manifestUrl:a},fin.me.identity)),async function(e,t){const a=await ce(),n=e.snapshotDetails?.monitorInfo||await fin.System.getMonitorInfo(),o=(e.windows||[]).filter((({layout:e})=>!!e)),i=new Map;a.forEach((e=>i.set(e.pageId,e)));const r=[],s=o.map((async e=>{const t=Rt(e),a=[],n=(e=>{let t=!1;const a=(e||[]).map((e=>{const a=function({id:e,name:t,...a}){return{pageId:e,title:t,...a}}(e);return t&&a.isActive&&(a.isActive=!1),a.isActive&&(t=!0),a}));return!t&&a.length&&(a[0].isActive=!0),a})(t?.workspacePlatform?.pages);if(!n?.length){const e=await Ie();a.push(await it(e,t.layout))}let o;n.forEach((e=>{const t=i.get(e.pageId);t?o=t:a.push(e)})),o&&await Promise.all([Pe({identity:o.parentIdentity,pageId:o.pageId}),Bt(o.parentIdentity)]),a.length&&r.push({...t,workspacePlatform:{...t.workspacePlatform,pages:a}})}));if(await Promise.all(s),!r.length)return;const c=fin.Platform.getCurrentSync();return(t||c.applySnapshot.bind(c))({...e,snapshotDetails:{...e.snapshotDetails,monitorInfo:n},windows:r})}(a,(e=>super.applySnapshot({snapshot:e,options:{...t,closeExistingWindows:!1}})))}async createWindow(t,a){let n=Rt(t);const o=await this.getThemes();n=((e,t,a)=>{let n=e;const o=n?.workspacePlatform?.pages;if(o){const e=o.find((e=>e.isActive));e?n.layout=e.layout:(o[0].isActive=!0,n.layout=o[0].layout)}if(n.layout){if(n=Mt({},t.defaultWindowOptions,n,Ut),n.layout=Mt(n.layout,Et),(n.icon||n.taskbarIcon)&&(n.taskbarIconGroup=n.taskbarIconGroup||fin.me.identity.uuid),!n.backgroundColor){const e=a?.palette;n.backgroundColor=e?.background2||e?.backgroundPrimary}const e=n.workspacePlatform.newTabUrl;e&&(n.layout.settings||(n.layout.settings={}),n.layout.settings.newTabButton={url:e}),n=(e=>{const t=e;return t.workspacePlatform||(t.workspacePlatform={}),t.workspacePlatform._internalDeferShowEnabled=!0,t.workspacePlatform._internalAutoShow=t.workspacePlatform?._internalAutoShow||void 0===t.autoShow||t.autoShow,t.autoShow=!1,t})(n)}return n.workspacePlatform?.pages&&(n.workspacePlatform.pages=Gt(n.workspacePlatform.pages,t?.defaultPageOptions)),n})(n,e,o[0]),n=await(async e=>{const t=await fin.System.getMonitorInfo(),a=t.primaryMonitor.availableRect.bottom-t.primaryMonitor.availableRect.top,n=t.primaryMonitor.availableRect.right-t.primaryMonitor.availableRect.left;return e.defaultHeight=e.defaultHeight||"800",e.defaultWidth=e.defaultWidth||"800",a<e.defaultHeight&&(e.defaultHeight=a),n<e.defaultWidth&&(e.defaultWidth=n),e})(n);return(e=>async(t,a)=>{const n=await e(t,a);return t?.workspacePlatform?._internalDeferShowEnabled?(await n.addListener(L.ShowRequested,(()=>{})),n):n})(((e,t)=>super.createWindow(e,t)))(n,a)}async createView(t,a){return t.opts=Ft(t.opts,e?.defaultViewOptions),t.opts=await Lt(t.opts,this.fetchManifest,a),super.createView(t,a)}async replaceView(t,a){return t.opts.newView=await Ft(t.opts.newView,e?.defaultViewOptions),t.opts.newView=await Lt(t.opts.newView,this.fetchManifest,a),super.replaceView(t,a)}async replaceLayout(e,t){return e.opts.layout?.dimensions,super.replaceLayout(e,t)}async closeView(e,t){const a=fin.View.wrapSync(e.view);await super.closeView(e,t),await a.destroy().catch((e=>e))}async getSavedPage(...e){return He.apply(this,e)}async getSavedPages(...e){return $e.apply(this,e)}async createSavedPage(...e){return qe.apply(this,e)}async deleteSavedPage(...e){return je.apply(this,e)}async updateSavedPage(...e){return Qe.apply(this,e)}async attachPagesToWindow(t){t.pages=Gt(t.pages,e?.defaultPageOptions),await ye(t)}async openGlobalContextMenuInternal(...e){return Ct.apply(this,e)}async openGlobalContextMenu(...e){return Wt.apply(this,e)}async openViewTabContextMenuInternal(...e){return It.apply(this,e)}async openViewTabContextMenu(...e){return Wt.apply(this,e)}async openPageTabContextMenuInternal(...e){return Tt.apply(this,e)}async openPageTabContextMenu(...e){return Wt.apply(this,e)}}return"function"==typeof e?.overrideCallback?e.overrideCallback(a):new a};async function qt(){Ve(),async function(){const e=fin.Application.getCurrentSync();await e.addListener("window-focused",q)}()}let jt;const Qt=async e=>{const t=I.split(".").map((e=>parseInt(e))),a=await(async e=>new Promise((async t=>{const a=(await fin.System.getVersion()).split(".").map((e=>parseInt(e)));t(e.every(((t,n)=>!(n<3)||a[n]===e[n])))})))(t),n=e?.theme;var o;if(n&&((o=n).forEach((e=>{const t=e.palette.backgroundPrimary;if(!t.includes("#")&&!t.includes("rgb")&&!t.includes("hsl"))throw new Error("Background primary color is not the right format.")})),Nt=o),e?.customActions&&(Oe=e?.customActions),a){return function(e){if(!y)throw new Error("Cannot be used outside an OpenFin env.");jt||(fin.Platform.getCurrentSync().once("platform-api-ready",(()=>qt())),jt=fin.Platform.init({overrideCallback:$t(e),interopOverride:e?.interopOverride}));return jt}(e?.browser)}throw new Error(`Runtime version is not supported. ${t[0]}.${t[1]}.${t[2]}.* is required`)};module.exports=t})();
1
+ (()=>{"use strict";var e,t,a,n,o,i,r,s={d:(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},c={};s.r(c),s.d(c,{AppManifestType:()=>i,BrowserButtonType:()=>u,CustomActionCallerType:()=>g,GlobalContextMenuOptionType:()=>p,PageTabContextMenuOptionType:()=>w,ViewTabMenuOptionType:()=>l,getCurrentSync:()=>wt,init:()=>Qt,wrapSync:()=>pt}),function(e){e.Fetching="fetching",e.Fetched="fetched",e.Complete="complete"}(e||(e={})),function(e){e.Active="active",e.Default="default"}(t||(t={})),function(e){e.Suggestion="suggestion"}(a||(a={})),function(e){e.Contact="Contact",e.Custom="Custom",e.List="List",e.Plain="Plain",e.SimpleText="SimpleText"}(n||(n={})),function(e){e.MultiSelect="MultiSelect"}(o||(o={})),function(e){e.Snapshot="snapshot",e.Manifest="manifest",e.View="view",e.External="external"}(i||(i={})),function(e){e.LandingPage="landingPage",e.AppGrid="appGrid"}(r||(r={}));var d,p,w,l,u,g,h;!function(e){e.Primary="primary",e.Secondary="secondary",e.TextOnly="textOnly"}(d||(d={})),function(e){e.NewWindow="NewWindow",e.NewPage="NewPage",e.CloseWindow="CloseWindow",e.OpenStorefront="OpenStorefront",e.Quit="Quit",e.Custom="Custom"}(p||(p={})),function(e){e.Close="Close",e.Duplicate="Duplicate",e.Rename="Rename",e.Save="Save",e.Custom="Custom"}(w||(w={})),function(e){e.NewView="NewView",e.DuplicateViews="DuplicateView",e.OpenWithDefaultBrowser="OpenWithDefaultBrowser",e.ReloadViews="ReloadTab",e.CloseViews="CloseTab",e.AddToChannel="AddToChannel",e.RemoveFromChannel="RemoveFromChannel",e.Custom="Custom"}(l||(l={})),function(e){e.ShowHideTabs="ShowHideTabs",e.ColorLinking="ColorLinking",e.PresetLayouts="PresetLayouts",e.SavePage="SavePage",e.Minimise="Minimise",e.Maximise="Maximise",e.Close="Close",e.Custom="Custom"}(u||(u={})),function(e){e.CustomButton="CustomButton",e.GlobalContextMenu="GlobalContextMenu",e.ViewTabContextMenu="ViewTabContextMenu",e.PageTabContextMenu="PageTabContextMenu",e.API="API"}(g||(g={})),function(e){e.Local="local",e.Dev="dev",e.Staging="staging",e.Prod="prod"}(h||(h={}));const y="undefined"!=typeof window&&"undefined"!=typeof fin,f=("undefined"==typeof process||process.env?.JEST_WORKER_ID,"undefined"!=typeof window),m=f&&"undefined"!=typeof indexedDB,P=f?window.origin:h.Local,v=y&&fin.me.uuid,S=y&&fin.me.name,b=y&&fin.me.entityType,C=(h.Local,h.Dev,h.Staging,h.Prod,e=>e.startsWith("http://")||e.startsWith("https://")?e:P+e),W=(C("https://cdn.openfin.co/workspace/6.3.1"),C("https://cdn.openfin.co/workspace/6.3.1")),I=("undefined"!=typeof WORKSPACE_DOCS_PLATFORM_URL&&C(WORKSPACE_DOCS_PLATFORM_URL),"undefined"!=typeof WORKSPACE_DOCS_CLIENT_URL&&C(WORKSPACE_DOCS_CLIENT_URL),"23.96.68.3");var T;!function(e){e.LastLaunchedWorkspaceId="activeWorkspaceId",e.LastFocusedBrowserWindow="lastFocusedBrowserWindow",e.MachineName="machineName",e.NewTabPageLayout="NewTabPageLayout",e.NewTabPageSort="NewTabPageSort"}(T||(T={}));const k=T;var A,M,V;!function(e){e.Workspace="openfin-browser"}(A||(A={})),function(e){e.RunRequested="run-requested",e.WindowOptionsChanged="window-options-changed",e.WindowClosed="window-closed",e.WindowCreated="window-created"}(M||(M={})),function(e){e.FinProtocol="fin-protocol"}(V||(V={}));const O={uuid:v,name:v},x=(A.Workspace,A.Workspace,e=>{if(!y)throw new Error("getApplication cannot be used in a non OpenFin env. Avoid using this during pre-rendering.");return fin.Application.wrapSync(e)});var F,L;!function(e){e.Home="openfin-home",e.Dock="openfin-dock",e.Storefront="openfin-storefront",e.HomeInternal="openfin-home-internal",e.BrowserMenu="openfin-browser-menu",e.BrowserIndicator="openfin-browser-indicator",e.BrowserWindow="internal-generated-window"}(F||(F={})),function(e){e.Shown="shown",e.BoundsChanged="bounds-changed",e.LayoutReady="layout-ready",e.EndUserBoundsChanging="end-user-bounds-changing",e.Blurred="blurred",e.CloseRequested="close-requested",e.Focused="focused",e.ShowRequested="show-requested",e.ViewCrashed="view-crashed",e.ViewAttached="view-attached",e.ViewDetached="view-detached",e.ViewPageTitleUpdated="view-page-title-updated",e.ViewDestroyed="view-destroyed",e.OptionsChanged="options-changed"}(L||(L={}));function D(e){if(!y)throw new Error("getOFWindow can only be used in an OpenFin env. Avoid calling this method during pre-rendering.");return fin.Window.wrapSync(e)}const R={name:S,uuid:v};function U(){return D(R)}F.Home,A.Workspace,F.Dock,A.Workspace;const E={name:F.Storefront,uuid:A.Workspace};A.Workspace,A.Workspace;async function G(e){const t=D(e);"minimized"===await t.getState()&&await t.restore(),await t.show(),await t.bringToFront(),await t.focus()}const B=e=>e.startsWith(F.BrowserWindow);async function _(){return(await fin.Application.getCurrentSync().getChildWindows()).filter((e=>B(e.identity.name)))}const N=e=>D(e).getOptions().then((()=>!0)).catch((()=>!1)),H=()=>N(E);async function $(){if("undefined"!=typeof localStorage)try{const e=localStorage.getItem(k.LastFocusedBrowserWindow),t=JSON.parse(e);if(await N(t))return t}catch(e){throw new Error(`failed to get last focused browser window: ${e}`)}}function q(e=fin.me.identity){B(e.name)&&function(e){if("undefined"!=typeof localStorage)try{const t=JSON.stringify(e);localStorage.setItem(k.LastFocusedBrowserWindow,t)}catch(e){}}(e)}const j=(e,t=0)=>{let a,n,o=!1;const i=async n=>{const r=await e(...n);if(o){await new Promise((e=>setTimeout(e,t)));const e=a;return a=void 0,o=!1,i(e)}return r};return(...e)=>(n?(o=!0,a=e):n=i(e).then((e=>(n=void 0,e))),n)};var Q;!function(e){e.TabCreated="tab-created",e.ContainerCreated="container-created",e.ContainerResized="container-resized"}(Q||(Q={}));const K=e=>{const t=[];return(e&&Array.isArray(e)?e:[]).forEach((e=>{if("component"===e.type)return t.push(e.componentState);const a=K(e.content);t.push(...a)})),t},z=async(e,t,a=R)=>{let n;if(B(a.name)){n=(await D(a).getOptions()).layout||{settings:{}}}return{...n,content:[{type:"stack",content:[{type:"component",componentName:"view",componentState:{title:e,url:t}}]}]}};new Map;const J=f&&"complete"!==document.readyState&&new Promise((e=>document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&e()}))));function X(e){let t;return()=>{if(!y)throw new Error("getChannelClient cannot be used outside an OpenFin env. Avoid using this method during pre-rendering.");return t||(t=(async()=>{await J;const a=await fin.InterApplicationBus.Channel.connect(e);return a.onDisconnection((async()=>{t=void 0})),a})().then((e=>e)).catch((a=>{throw t=void 0,new Error(`failed to connect to channel provider ${e}: ${a}`)}))),t}}const Y=e=>`__browser_window__-${e.uuid}-${e.name}`,Z=new Map,ee=e=>{const t=Y(e);return Z.has(t)||Z.set(t,X(t)),Z.get(t)()};var te,ae,ne;!function(e){e.CloseBrowserWindow="close-browser-window",e.QuitPlatform="quit-platform",e.ClosePage="close-page",e.AddToChannel="add-to-channel",e.RemoveFromChannel="remove-from-channel",e.SavePage="save-page",e.DuplicatePage="duplicate-page"}(te||(te={})),function(e){e.GetPages="get-pages",e.GetActivePageForWindow="get-active-page-for-window",e.AttachPagesToWindow="attach-pages-to-window",e.DetachPagesFromWindow="detach-pages-from-window",e.SetActivePageForWindow="set-active-page-for-window",e.RenamePage="rename-page",e.ReorderPagesForWindow="reorder-pages-for-window",e.UpdatePageForWindow="update-page-for-window",e.UpdatePagesWindowOptions="update-pages-window-options",e.IsDetachingPages="is-detaching-pages",e.IsActivePageChanging="is-active-page-changing"}(ae||(ae={})),function(e){e.AttachedPagesToWindow="attached-pages-to-window",e.DetachedPagesFromWindow="detached-pages-from-window"}(ne||(ne={}));new Map;const oe=async e=>{const t=await ee(e);return await t.dispatch(ae.GetPages)},ie=async e=>(await ee(e.identity)).dispatch(ae.UpdatePageForWindow,e);var re;!function(e){e.LaunchApp="launchApp",e.SavePage="savePage",e.GetSavedPage="getSavedPage",e.CreateSavedPage="createSavedPage",e.UpdateSavedPage="updateSavedPage",e.DeleteSavedPage="deleteSavedPage",e.GetSavedPages="getSavedPages",e.CreateSavedPageInternal="createSavedPageInternal",e.UpdateSavedPageInternal="updateSavedPageInternal",e.DeleteSavedPageInternal="deleteSavedPageInternal",e.SharePage="sharePage",e.UpdatePageForWindow="updatePageForWindow",e.AttachPagesToWindow="attachPagesToWindow",e.DetachPagesFromWindow="detachPagesFromWindow",e.ReorderPagesForWindow="reorderPagesForWindow",e.SetActivePage="setActivePage",e.GetAllAttachedPages="getAllAttachedPages",e.GetActivePageIdForWindow="getActivePageIdForWindow",e.GetPagesForWindow="getPagesForWindow",e.GetPageForWindow="getPageForWindow",e.GetSavedPageMetadata="getSavedPageMetadata",e.GetUniquePageTitle="getUniquePageTitle",e.GetLastFocusedBrowserWindow="getLastFocusedBrowserWindow",e.GetThemes="getThemes",e.OpenGlobalContextMenuInternal="openGlobalContextMenuInternal",e.OpenViewTabContextMenuInternal="openViewTabContextMenuInternal",e.OpenPageTabContextMenuInternal="openPageTabContextMenuInternal",e.InvokeCustomActionInternal="invokeCustomActionInternal"}(re||(re={}));const se=async e=>{const t=fin.Platform.wrapSync(e),a=await t.getClient(),n="Target is not a Workspace Platform. Target must call WorkspacePlatform.init";try{if(!0===await a.dispatch("isWorkspacePlatform"))return a;throw new Error(n)}catch(e){throw new Error(n)}},ce=async()=>{const e=await _();return(await Promise.all(e.map((async({identity:e})=>oe(e))))).reduce(((e,t)=>e.concat(t)),[])},de=async()=>(await se(R)).dispatch(re.GetSavedPages,void 0),pe=async e=>(await se(R)).dispatch(re.GetSavedPage,e),we=async(e,t)=>{const a=await(async e=>(await ce()).find((t=>t.pageId===e)))(e);return!a||a.title===t.title&&e===t.pageId||await ie({identity:a.parentIdentity,pageId:e,page:{pageId:t.pageId,title:t.title}}),a},le=async({page:e})=>{await we(e.pageId,e),await(async e=>(await se(R)).dispatch(re.CreateSavedPage,e))({page:e})},ue=async e=>{await pe(e)&&await(async e=>(await se(R)).dispatch(re.DeleteSavedPage,e))(e)},ge=async({pageId:e,page:t})=>{await we(e,t);return await(async e=>(await se(R)).dispatch(re.UpdateSavedPage,e))({pageId:e,page:t})},he=async e=>await pe(e.pageId)?ge({pageId:e.pageId,page:e}):le({page:e}),ye=async e=>{await(async e=>(await ee(e.identity)).dispatch(ae.AttachPagesToWindow,e))(e)},fe=async e=>{await ie(e)},me=async e=>{await(async e=>(await ee(e.identity)).dispatch(ae.DetachPagesFromWindow,e))(e)},Pe=async e=>{await(async e=>(await ee(e.identity)).dispatch(ae.SetActivePageForWindow,e))(e)},ve=e=>oe(e),Se=async({identity:e,pageId:t})=>(await ve(e)).find((e=>e.pageId===t)),be=async e=>{await(async e=>(await ee(e.identity)).dispatch(ae.ReorderPagesForWindow,e))(e)},Ce=(e,t)=>!t.find((t=>t===e)),We=(e,t)=>`${e} (${t})`;async function Ie(e="Untitled Page"){const[t,a]=await Promise.all([de(),ce()]),n=[...t,...a].map((({title:e})=>e));if(!n.find((t=>t===e)))return e;let o=1;const i=e.replace(/ \(.+\)$/,"");for(;!Ce(We(i,o),n);)o+=1;return We(i,o)}const Te=new Map,ke=e=>`${e.uuid}-${e.name}`;const Ae=j((async function(){const e=await ce(),t=new Set;e.forEach((e=>{K(e.layout.content).forEach((e=>{if(e.name){const a=ke(e);t.add(a)}}))}));const a=U();(await a.getCurrentViews()).forEach((({identity:e})=>{const a=ke(e);if(t.has(a)||Te.has(a))return;const n=setTimeout((()=>{fin.View.wrapSync(e).destroy(),Te.delete(a)}),5e3);Te.set(a,n)})),Te.forEach(((e,a)=>{t.has(a)&&(clearTimeout(e),Te.delete(a))}))}),2500),Me=({name:e})=>{B(e)&&Ae().catch((()=>{}))};function Ve(){const e=x(O);e.addListener(M.WindowOptionsChanged,Ae),e.addListener(M.WindowClosed,Me),e.addListener(M.WindowCreated,Me)}let Oe={};const xe=({actionId:e,payload:t})=>{if("function"!=typeof Oe[e])throw new Error(`Cannot find a configured function for the action '${e}'`);return Oe[e](t)};function Fe(){return localStorage.getItem(k.MachineName)}let Le,De;async function Re(){return Le||(Le=await fin.System.getMachineId()),Le}async function Ue(e){const t=e||await fin.Platform.getCurrentSync().getSnapshot();if(t.snapshotDetails?.machineId)return t;const a=Fe();return{...t,snapshotDetails:{...e.snapshotDetails,machineId:await Re(),machineName:a}}}function Ee(e){return new Promise(((t,a)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>a(e.error)}))}function Ge(e,t){const a=indexedDB.open(e);a.onupgradeneeded=()=>a.result.createObjectStore(t);const n=Ee(a);return(e,a)=>n.then((n=>a(n.transaction(t,e).objectStore(t))))}function Be(){return De||(De=Ge("keyval-store","keyval")),De}function _e(e,t){return e("readonly",(e=>(e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Ee(e.transaction))))}const Ne=m&&Ge("openfin-home-pages","pages");async function He(e){const t=await function(e,t=Be()){return t("readonly",(t=>Ee(t.get(e))))}(e,Ne);return t?(t.pageId=e.toString(),t.title=t.title||t.pageId,t):null}async function $e(e){const t=await function(e=Be()){const t=[];return _e(e,(e=>t.push(e.key))).then((()=>t))}(Ne),a=await Promise.all(t.map((e=>He(e.toString()))));return e?a.filter((t=>((e,t="")=>e.toLowerCase().includes(t.toLowerCase()))(t.title,e))):a}async function qe({page:e}){await function(e,t,a=Be()){return a("readwrite",(a=>(a.put(t,e),Ee(a.transaction))))}(e.pageId,e,Ne)}async function je(e){await function(e,t=Be()){return t("readwrite",(t=>(t.delete(e),Ee(t.transaction))))}(e,Ne)}async function Qe({pageId:e,page:t}){if(void 0===await He(e))throw new Error("page not found");await qe({page:t}),e!==t.pageId&&await je(e)}var Ke,ze;!function(e){e.Label="normal",e.Separator="separator",e.Submenu="submenu",e.Checkbox="checkbox"}(Ke||(Ke={}));var Je=new Uint8Array(16);function Xe(){if(!ze&&!(ze="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ze(Je)}const Ye=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Ze=function(e){return"string"==typeof e&&Ye.test(e)};for(var et=[],tt=0;tt<256;++tt)et.push((tt+256).toString(16).substr(1));const at=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase();if(!Ze(a))throw TypeError("Stringified UUID is invalid");return a};const nt=function(e,t,a){var n=(e=e||{}).random||(e.rng||Xe)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){a=a||0;for(var o=0;o<16;++o)t[a+o]=n[o];return t}return at(n)};var ot;!function(e){e.RegisterStorefrontProvider="register-storefront-provider",e.DeregisterStorefrontProvider="deregister-storefront-provider",e.GetStorefrontProviders="get-storefront-providers",e.HideStorefront="hide-storefront",e.GetStorefrontProviderApps="get-storefront-provider-apps",e.GetStorefrontProviderLandingPage="get-storefront-provider-landing-page",e.GetStorefrontProviderFooter="get-storefront-provider-footer",e.GetStorefrontProviderNavigation="get-storefront-provider-navigation",e.LaunchStorefrontProviderApp="launch-storefront-provider-app",e.ShowStorefront="show-storefront",e.CreateStorefrontWindow="create-storefront-window",e.ShowHome="show-home",e.HideHome="hide-home",e.AssignHomeSearchContext="assign-home-search-context",e.GetLegacyPages="get-legacy-pages",e.GetLegacyWorkspaces="get-legacy-workspaces",e.GetComputedPlatformTheme="get-computed-platform-theme"}(ot||(ot={}));X("__of_workspace_protocol__");const it=async(e,t)=>{const a=await(async e=>({...e,layoutDetails:{machineId:await Re(),machineName:Fe()}}))(t);return{pageId:nt(),title:e,layout:a,isReadOnly:!1,hasUnsavedChanges:!0}},rt=e=>({identity:e,openfinWindow:fin.Window.wrapSync(e),getPages:async()=>(await se(e)).dispatch(re.GetPagesForWindow,e),getPage:async t=>(await se(e)).dispatch(re.GetPageForWindow,{identity:e,pageId:t}),addPage:async t=>{const a=await se(e);t?.title||(t.title=await a.dispatch(re.GetUniquePageTitle,void 0));const n=(await a.dispatch(re.GetAllAttachedPages,void 0)).find((e=>e.pageId===t.pageId||e.title===t.title));if(n)throw n.pageId===t.pageId?new Error(`page with id ${t.pageId} is already attached to a browser window ${n.parentIdentity.name}`):new Error(`page with title ${t.title} is already attached to a browser window ${n.parentIdentity.name}`);const o={identity:e,pages:[t]};return a.dispatch(re.AttachPagesToWindow,o)},removePage:async t=>(await se(e)).dispatch(re.DetachPagesFromWindow,{identity:e,pageIds:[t]}),setActivePage:async t=>(await se(e)).dispatch(re.SetActivePage,{identity:e,pageId:t}),updatePage:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.UpdatePageForWindow,t)},reorderPages:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.ReorderPagesForWindow,t)},_openGlobalContextMenu:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.OpenGlobalContextMenuInternal,t)},replaceToolbarOptions:async t=>{const a=fin.Window.wrapSync(e);await a.updateOptions({workspacePlatform:{toolbarOptions:t}})},replaceWindowStateButtonOptions:async t=>{const a=fin.Window.wrapSync(e);await a.updateOptions({workspacePlatform:{windowStateButtonOptions:t}})},_openViewTabContextMenu:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.OpenViewTabContextMenuInternal,t)},_openPageTabContextMenu:async t=>{const a=await se(e);return t.identity=e,a.dispatch(re.OpenPageTabContextMenuInternal,t)}}),st=e=>{const t=fin.Platform.wrapSync(e);return{wrapSync:e=>rt(e),createWindow:async e=>{const a=await t.createWindow(e);return rt(a.identity)},getAllAttachedPages:async()=>(await t.getClient()).dispatch(re.GetAllAttachedPages,void 0),getAllWindows:async()=>(await fin.Application.wrapSync(e).getChildWindows()).filter((e=>e.identity.name.includes("internal-generated-window-"))).map((e=>rt(e.identity))),getUniquePageTitle:async t=>(await se(e)).dispatch(re.GetUniquePageTitle,t),getLastFocusedWindow:async()=>(await se(e)).dispatch(re.GetLastFocusedBrowserWindow,void 0)}},ct=e=>({createPage:async t=>(await se(e)).dispatch(re.CreateSavedPageInternal,t),deletePage:async t=>(await se(e)).dispatch(re.DeleteSavedPageInternal,t),updatePage:async t=>(await se(e)).dispatch(re.UpdateSavedPageInternal,t),getPage:async t=>(await se(e)).dispatch(re.GetSavedPage,t),getPages:async t=>(await se(e)).dispatch(re.GetSavedPages,t),savePage:async t=>(await se(e)).dispatch(re.SavePage,t)}),dt=e=>({getThemes:async()=>(await se(e)).dispatch(re.GetThemes,void 0)}),pt=e=>{const t=fin.Platform.wrapSync(e);return Object.assign(t,{applySnapshot:async t=>{if("string"!=typeof t&&!t?.windows)throw new Error("Not a valid browser snapshot");return fin.Platform.wrapSync(e).applySnapshot(t)},getSnapshot:()=>fin.Platform.wrapSync(e).getSnapshot().then((e=>e)),launchApp:async t=>{t.target||(t.target={uuid:v,name:S,entityType:b||"unknown"});return(await se(e)).dispatch(re.LaunchApp,t)},_invokeCustomAction:async(t,a)=>{const n=await se(e),o={actionId:t,payload:{...a,callerType:a.callerType||g.API}};return n.dispatch(re.InvokeCustomActionInternal,o)},Theme:dt(e),Browser:st(e),Storage:ct(e)})},wt=()=>pt(fin.me.identity),lt=async(e=R)=>{const{workspacePlatform:t}=await D(e).getOptions();return{newPageUrl:t?.newPageUrl,newTabUrl:t?.newTabUrl}},ut=async(e=R)=>{const t=await wt().Browser.getUniquePageTitle("Untitled Page"),a=await(async(e=R)=>{const{newPageUrl:t}=await lt(e);if(!t)throw new Error("Trying to create a new page without a newPageUrl set");return z("New Tab",t,e)})(e);return it(t,a)},gt=[{type:Ke.Label,label:"Close Window",data:{type:p.CloseWindow}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Open Storefront",data:{type:p.OpenStorefront}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Quit Workspace",data:{type:p.Quit}}],ht=[{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Close Window",data:{type:p.CloseWindow}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Quit",data:{type:p.Quit}}],yt=async e=>{const t=await H(),{newPageUrl:a}=await lt(e),n=await(async e=>{const t=D(e),{workspacePlatform:a}=await t.getOptions();return a?.disableMultiplePages})(e),o=[];return a&&(o.push({type:Ke.Label,label:"New Window",data:{type:p.NewWindow}}),n||o.push({type:Ke.Label,label:"New Page",data:{type:p.NewPage}})),t?[...o,...gt]:[...o,...ht]},ft=async(e,t)=>{if(!e)return;const a=t.identity,n=await ee(a);switch(e.type){case p.NewWindow:const{newPageUrl:t}=await lt(a);if(!t)throw new Error("Trying to create a new empty window without a newPageUrl set");wt().createView({target:void 0,url:t});break;case p.NewPage:await(async e=>{const t=await ut(e);await wt().Browser.wrapSync(e).addPage(t)})(a);break;case p.CloseWindow:n.dispatch(te.CloseBrowserWindow);break;case p.Quit:n.dispatch(te.QuitPlatform);break;case p.OpenStorefront:(async()=>{await H()&&G(E)})();break;case p.Custom:if(e.action){const t={callerType:g.GlobalContextMenu,windowIdentity:a,customData:e.action.customData};wt()._invokeCustomAction(e.action.id,t)}}},mt=async(e,t)=>{const a=await ee(t.identity);switch(e.type){case w.Save:case w.Rename:a.dispatch(te.SavePage,t.pageId);break;case w.Duplicate:a.dispatch(te.DuplicatePage,t.pageId);break;case w.Close:a.dispatch(te.ClosePage,t.pageId);break;case w.Custom:if(e.action){const a={callerType:g.PageTabContextMenu,windowIdentity:t.identity,pageId:t.pageId,customData:e.action.customData};wt()._invokeCustomAction(e.action.id,a)}}},Pt=async(e,t)=>{const a=t.selectedViews[0],n=fin.View.wrapSync(a),o=await(async e=>{const{newTabUrl:t}=await lt(e);if(!t)throw new Error("Trying to create a new page without a newTabUrl set");return{...z("New View",t),url:t,target:e}})(e);await wt().createView(o,e,n.identity)},vt=async(e,t)=>{const a=await(e=>Promise.all(e.map((async e=>fin.View.wrapSync(e).getInfo()))))(t),{newPageUrl:n,newTabUrl:o}=await lt(e);a.forEach((async e=>{e.url!==n&&e.url!==o&&await fin.System.openUrlWithBrowser(e.url)}))},St=(e,t)=>{t.forEach((async t=>{const a=fin.View.wrapSync(t);await(async(e,t)=>{const{url:a}=await t.getInfo(),n={...await t.getOptions(),url:a,target:e,name:void 0};await wt().createView(n,e,t.identity)})(e,a)}))},bt=async(e,t)=>{if(!e)return;const a=t.identity;switch(e.type){case l.CloseViews:await(async(e,t)=>{if((await fin.Window.wrapSync(e).getCurrentViews()).length!==t.length)t.forEach((async e=>{const t=fin.View.wrapSync(e);await t.destroy()}));else{const t=(await wt().Browser.wrapSync(e).getPages()).find((e=>e.isActive));(await ee(e)).dispatch(te.ClosePage,t?.pageId)}})(a,t.selectedViews);break;case l.OpenWithDefaultBrowser:await vt(a,t.selectedViews);break;case l.ReloadViews:t.selectedViews.forEach((async e=>{const t=fin.View.wrapSync(e);await t.reload()}));break;case l.NewView:await Pt(a,t);break;case l.DuplicateViews:St(a,t.selectedViews);break;case l.AddToChannel:(async(e,t,a)=>{const n={newChannelId:t,selectedViews:a};(await ee(e)).dispatch(te.AddToChannel,n)})(a,e.option,t.selectedViews);break;case l.RemoveFromChannel:(async(e,t)=>{(await ee(e)).dispatch(te.RemoveFromChannel,t)})(a,t.selectedViews);break;case l.Custom:if(e.action){const n={callerType:g.ViewTabContextMenu,windowIdentity:a,selectedViews:t.selectedViews,customData:e.action.customData};wt()._invokeCustomAction(e.action.id,n)}}};async function Ct(e,t){const a=await yt(e.identity),n={...e,template:a,callback:ft};await this.openGlobalContextMenu(n,t)}const Wt=async(e,t)=>{const{x:a,y:n,identity:o,template:i,callback:r}=e,{data:s}=await function(e,t){if(!y)throw new Error("showContextMenu can only be used in an OpenFin env. Avoid calling this method during pre-rendering.");if(!t&&!fin.me.isWindow)throw new Error("showContextMenu can only be used in an OpenFin window.");return(t||fin.Window.getCurrentSync()).showPopupMenu(e)}({x:a,y:n,template:i},fin.Window.wrapSync(o));r(s,e)};async function It(e,t){const a={...e,callback:bt};await this.openViewTabContextMenu(a,t)}async function Tt(e,t){const a=await wt().Storage.getPage(e.pageId),n=await(o=!!a,[{type:Ke.Label,label:"Save Page",data:{type:w.Save}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Rename Page",data:{type:w.Rename},enabled:o},{type:Ke.Label,label:"Duplicate Page",data:{type:w.Duplicate}},{type:Ke.Separator,data:void 0},{type:Ke.Label,label:"Close Page",data:{type:w.Close}}]);var o;const i={...e,template:n,callback:mt};await this.openPageTabContextMenu(i,t)}async function kt({app:e,target:t}){const a=fin.Platform.getCurrentSync();switch(e.manifestType){case i.Snapshot:return a.applySnapshot(e.manifest);case i.View:return async function(e,t){const a=fin.Platform.getCurrentSync();if("view"===t.entityType){const a=fin.View.wrapSync(t),n=await a.getParentLayout();return await n.replaceView(t,{manifestUrl:e.manifest,url:void 0,target:void 0}),a.destroy()}return a.createView({name:void 0,url:void 0,manifestUrl:e.manifest,target:void 0})}(e,t);case i.External:return fin.System.launchExternalProcess({path:e.manifest,uuid:e.appId});default:return fin.Application.startFromManifest(e.manifest)}}const At=e=>e&&"object"==typeof e&&!Array.isArray(e);function Mt(e,...t){if(!t.length)return e;const a=t.shift();return At(e)&&At(a)&&Object.entries(a).forEach((([t,a])=>{if(At(a))return e[t]||(e[t]={}),Mt(e[t],a);e[t]=a})),Mt(e,...t)}var Vt,Ot;!function(e){e.HomeIndex="/home/",e.HomeSearch="/home/search/",e.HomePagesRename="/home/pages/rename/",e.Dock="/home/dock/",e.BrowserPagesLanding="/browser/pages/landing/",e.HomeIndicator="/home/indicator/",e.Browser="/browser/",e.BrowserPopupMenu="/browser/popup-menu/",e.Provider="/provider/",e.BrowserPopupMenuSharePage="/browser/popup-menu/share-page/",e.BrowserPopupMenuSavePage="/browser/popup-menu/save-page/",e.BrowserPopupMenuLayouts="/browser/popup-menu/layouts/layouts/",e.BrowserPopupMenuColorLinking="/browser/popup-menu/color-linking/color-linking/",e.BrowserIndicator="/browser/indicator/",e.ResponseModal="/browser/popup-menu/response-modal/",e.Docs="/provider/docs/",e.Storefront="/storefront/",e.DeprecatedAlert="/provider/deprecated-alert/"}(Vt||(Vt={})),function(e){e.IconOpenFinLogo="/icons/openfinlogo.svg",e.IconFilter="/icons/filter.svg"}(Ot||(Ot={}));const xt=W+{...Ot,...Vt}.Browser;function Ft(e,t){const a=Mt({},t,e);return a.detachOnClose=!0,a}async function Lt(e,t,a){const n=e.manifestUrl?await t({manifestUrl:e.manifestUrl},a):void 0;if(n?.interop&&e.interop){const t={...e,...n,interop:e.interop};return delete t.manifestUrl,t}return e}const Dt=e=>{const t=e.name===F.Home,a=e.name?.startsWith(F.HomeInternal),n=e.name?.startsWith(F.BrowserMenu);return!t&&!a&&!n},Rt=e=>"workspacePlatform"in e?e:(({workstacks:e,pages:t,...a})=>({...a,workspacePlatform:{pages:t||e||null}}))(e),Ut={contextMenuSettings:{reload:!1},backgroundThrottling:!0,url:xt,contextMenu:!0,cornerRounding:{height:8,width:8},closeOnLastViewRemoved:!1,experimental:{showFavicons:!0,defaultFaviconUrl:`${W}/icons/defaultFavicon.svg`},permissions:{System:{openUrlWithBrowser:{enabled:!0,protocols:["mailto"]}}}},Et={dimensions:{borderWidth:3,headerHeight:30}},Gt=(e,t)=>t?e.map((e=>({...t,...e}))):e,Bt=e=>{const t=fin.Window.wrapSync(e);return Promise.all([t.bringToFront(),t.restore(),t.focus()])};async function _t(e){const t=await _();return await Promise.all(t.map((({identity:e})=>(async e=>(await ee(e)).dispatch(ae.UpdatePagesWindowOptions))(e)))),e?e():Ue()}let Nt=[];const Ht=()=>Nt;const $t=e=>async t=>{class a extends t{constructor(){super(),this.isWorkspacePlatform=()=>!0,this.addPage=this.attachPagesToWindow,this.detachPagesFromWindow=me,this.getAllAttachedPages=ce,this.getPagesForWindow=ve,this.getPageForWindow=Se,this.setActivePage=Pe,this.launchApp=kt,this.savePage=he,this.createSavedPageInternal=le,this.updateSavedPageInternal=ge,this.deleteSavedPageInternal=ue,this.reorderPagesForWindow=be,this.getUniquePageTitle=Ie,this.updatePageForWindow=fe,this.getLastFocusedBrowserWindow=$,this.getThemes=Ht,this.invokeCustomActionInternal=xe,this.openGlobalContextMenuInternal=this.openGlobalContextMenuInternal.bind(this),this.openGlobalContextMenu=this.openGlobalContextMenu.bind(this),this.getSavedPages=this.getSavedPages.bind(this),this.getSavedPage=this.getSavedPage.bind(this),this.createSavedPage=this.createSavedPage.bind(this),this.updateSavedPage=this.updateSavedPage.bind(this),this.deleteSavedPage=this.deleteSavedPage.bind(this),this.attachPagesToWindow=this.attachPagesToWindow.bind(this),this.openViewTabContextMenuInternal=this.openViewTabContextMenuInternal.bind(this),this.openViewTabContextMenu=this.openViewTabContextMenu.bind(this),this.openPageTabContextMenuInternal=this.openPageTabContextMenuInternal.bind(this),this.openPageTabContextMenu=this.openPageTabContextMenu.bind(this)}async getSnapshot(){const e=await _t((async()=>Ue(await super.getSnapshot(void 0,fin.me.identity))));return{...e,windows:e.windows.filter(Dt)}}async applySnapshot({snapshot:e,options:t}){t?.closeExistingWindows&&await async function(){const e=await _();await Promise.all(e.map((e=>e.close(!0).catch((()=>{})))))}();let a=e;return"string"==typeof a&&(a=await super.fetchManifest({manifestUrl:a},fin.me.identity)),async function(e,t){const a=await ce(),n=e.snapshotDetails?.monitorInfo||await fin.System.getMonitorInfo(),o=(e.windows||[]).filter((({layout:e})=>!!e)),i=new Map;a.forEach((e=>i.set(e.pageId,e)));const r=[],s=o.map((async e=>{const t=Rt(e),a=[],n=(e=>{let t=!1;const a=(e||[]).map((e=>{const a=function({id:e,name:t,...a}){return{pageId:e,title:t,...a}}(e);return t&&a.isActive&&(a.isActive=!1),a.isActive&&(t=!0),a}));return!t&&a.length&&(a[0].isActive=!0),a})(t?.workspacePlatform?.pages);if(!n?.length){const e=await Ie();a.push(await it(e,t.layout))}let o;n.forEach((e=>{const t=i.get(e.pageId);t?o=t:a.push(e)})),o&&await Promise.all([Pe({identity:o.parentIdentity,pageId:o.pageId}),Bt(o.parentIdentity)]),a.length&&r.push({...t,workspacePlatform:{...t.workspacePlatform,pages:a}})}));if(await Promise.all(s),!r.length)return;const c=fin.Platform.getCurrentSync();return(t||c.applySnapshot.bind(c))({...e,snapshotDetails:{...e.snapshotDetails,monitorInfo:n},windows:r})}(a,(e=>super.applySnapshot({snapshot:e,options:{...t,closeExistingWindows:!1}})))}async createWindow(t,a){let n=Rt(t);const o=await this.getThemes();n=((e,t,a)=>{let n=e;const o=n?.workspacePlatform?.pages;if(o){const e=o.find((e=>e.isActive));e?n.layout=e.layout:(o[0].isActive=!0,n.layout=o[0].layout)}if(n.layout){if(n=Mt({},t.defaultWindowOptions,n,Ut),n.layout=Mt(n.layout,Et),(n.icon||n.taskbarIcon)&&(n.taskbarIconGroup=n.taskbarIconGroup||fin.me.identity.uuid),!n.backgroundColor){const e=a?.palette;n.backgroundColor=e?.background2||e?.backgroundPrimary}const e=n.workspacePlatform.newTabUrl;e&&(n.layout.settings||(n.layout.settings={}),n.layout.settings.newTabButton={url:e}),n=(e=>{const t=e;return t.workspacePlatform||(t.workspacePlatform={}),t.workspacePlatform._internalDeferShowEnabled=!0,t.workspacePlatform._internalAutoShow=t.workspacePlatform?._internalAutoShow||void 0===t.autoShow||t.autoShow,t.autoShow=!1,t})(n)}return n.workspacePlatform?.pages&&(n.workspacePlatform.pages=Gt(n.workspacePlatform.pages,t?.defaultPageOptions)),n})(n,e,o[0]),n=await(async e=>{const t=await fin.System.getMonitorInfo(),a=t.primaryMonitor.availableRect.bottom-t.primaryMonitor.availableRect.top,n=t.primaryMonitor.availableRect.right-t.primaryMonitor.availableRect.left;return e.defaultHeight=e.defaultHeight||"800",e.defaultWidth=e.defaultWidth||"800",a<e.defaultHeight&&(e.defaultHeight=a),n<e.defaultWidth&&(e.defaultWidth=n),e})(n);return(e=>async(t,a)=>{const n=await e(t,a);return t?.workspacePlatform?._internalDeferShowEnabled?(await n.addListener(L.ShowRequested,(()=>{})),n):n})(((e,t)=>super.createWindow(e,t)))(n,a)}async createView(t,a){return t.opts=Ft(t.opts,e?.defaultViewOptions),t.opts=await Lt(t.opts,this.fetchManifest,a),super.createView(t,a)}async replaceView(t,a){return t.opts.newView=await Ft(t.opts.newView,e?.defaultViewOptions),t.opts.newView=await Lt(t.opts.newView,this.fetchManifest,a),super.replaceView(t,a)}async replaceLayout(e,t){return e.opts.layout?.dimensions,super.replaceLayout(e,t)}async closeView(e,t){const a=fin.View.wrapSync(e.view);await super.closeView(e,t),await a.destroy().catch((e=>e))}async getSavedPage(...e){return He.apply(this,e)}async getSavedPages(...e){return $e.apply(this,e)}async createSavedPage(...e){return qe.apply(this,e)}async deleteSavedPage(...e){return je.apply(this,e)}async updateSavedPage(...e){return Qe.apply(this,e)}async attachPagesToWindow(t){t.pages=Gt(t.pages,e?.defaultPageOptions),await ye(t)}async openGlobalContextMenuInternal(...e){return Ct.apply(this,e)}async openGlobalContextMenu(...e){return Wt.apply(this,e)}async openViewTabContextMenuInternal(...e){return It.apply(this,e)}async openViewTabContextMenu(...e){return Wt.apply(this,e)}async openPageTabContextMenuInternal(...e){return Tt.apply(this,e)}async openPageTabContextMenu(...e){return Wt.apply(this,e)}}return"function"==typeof e?.overrideCallback?e.overrideCallback(a):new a};async function qt(){Ve(),async function(){const e=fin.Application.getCurrentSync();await e.addListener("window-focused",q)}()}let jt;const Qt=async e=>{const t=I.split(".").map((e=>parseInt(e))),a=await(async e=>new Promise((async t=>{const a=(await fin.System.getVersion()).split(".").map((e=>parseInt(e)));t(e.every(((t,n)=>!(n<3)||a[n]===e[n])))})))(t),n=e?.theme;var o;if(n&&((o=n).forEach((e=>{const t=e.palette.backgroundPrimary;if(!t.includes("#")&&!t.includes("rgb")&&!t.includes("hsl"))throw new Error("Background primary color is not the right format.")})),Nt=o),e?.customActions&&(Oe=e?.customActions),a){return function(e){if(!y)throw new Error("Cannot be used outside an OpenFin env.");jt||(fin.Platform.getCurrentSync().once("platform-api-ready",(()=>qt())),jt=fin.Platform.init({overrideCallback:$t(e),interopOverride:e?.interopOverride}));return jt}(e?.browser)}throw new Error(`Runtime version is not supported. ${t[0]}.${t[1]}.${t[2]}.* is required`)};module.exports=c})();
2
2
  //# sourceMappingURL=index.js.map