@interopio/workspaces-api 4.1.2 → 4.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).workspaces=e.workspaces||{},e.workspaces.min=t())}(this,function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){if(e&&e.errorHandling&&"function"!=typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"==typeof e.errorHandling&&e.errorHandling,r={};function o(r,o){var n=r instanceof Error?r:new Error(r);if(t)t(n);else{var i='[ERROR] callback-registry: User callback for key "'+o+'" failed: '+n.stack;if(e)switch(e.errorHandling){case"log":return console.error(i);case"silent":return;case"throw":throw new Error(i)}console.error(i)}}return{add:function(e,t,n){var i=r[e];return i||(i=[],r[e]=i),i.push(t),n&&setTimeout(function(){n.forEach(function(n){var i;if(null===(i=r[e])||void 0===i?void 0:i.includes(t))try{Array.isArray(n)?t.apply(void 0,n):t.apply(void 0,[n])}catch(t){o(t,e)}})},0),function(){var o=r[e];o&&(0===(o=o.reduce(function(e,r,o){return r===t&&e.length===o||e.push(r),e},[])).length?delete r[e]:r[e]=o)}},execute:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=r[e];if(!i||0===i.length)return[];var a=[];return i.forEach(function(r){try{var n=r.apply(void 0,t);a.push(n)}catch(t){a.push(void 0),o(t,e)}}),a},clear:function(){r={}},clearKey:function(e){r[e]&&delete r[e]}}}t.default=t;var r=e(t),o=function(e){return{ok:!0,result:e}},n=function(e){return{ok:!1,error:e}},i=function(e,t,r){return!1===t.ok?t:!1===r.ok?r:o(e(t.result,r.result))},a=function(e,t){return!0===t.ok?t:n(e(t.error))},s=function(){return s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},s.apply(this,arguments)};function c(e,t){if(e===t)return!0;if(null===e&&null===t)return!0;if(typeof e!=typeof t)return!1;if("object"==typeof e){if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!c(e[r],t[r]))return!1;return!0}var o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(r=0;r<o.length;r++){if(!t.hasOwnProperty(o[r]))return!1;if(!c(e[o[r]],t[o[r]]))return!1}return!0}}var d=function(e){return Array.isArray(e)},l=function(e){return"object"==typeof e&&null!==e&&!d(e)},h=function(e,t){return"expected "+e+", got "+function(e){switch(typeof e){case"string":return"a string";case"number":return"a number";case"boolean":return"a boolean";case"undefined":return"undefined";case"object":return e instanceof Array?"an array":null===e?"null":"an object";default:return JSON.stringify(e)}}(t)},u=function(e){return e.map(function(e){return"string"==typeof e?"."+e:"["+e+"]"}).join("")},w=function(e,t){var r=t.at,o=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(t,["at"]);return s({at:e+(r||"")},o)},p=function(){function e(t){var r=this;this.decode=t,this.run=function(e){return a(function(t){return{kind:"DecoderError",input:e,at:"input"+(t.at||""),message:t.message||""}},r.decode(e))},this.runPromise=function(e){return!0===(t=r.run(e)).ok?Promise.resolve(t.result):Promise.reject(t.error);var t},this.runWithException=function(e){return function(e){if(!0===e.ok)return e.result;throw e.error}(r.run(e))},this.map=function(t){return new e(function(e){return function(e,t){return!0===t.ok?o(e(t.result)):t}(t,r.decode(e))})},this.andThen=function(t){return new e(function(e){return function(e,t){return!0===t.ok?e(t.result):t}(function(r){return t(r).decode(e)},r.decode(e))})},this.where=function(t,o){return r.andThen(function(r){return t(r)?e.succeed(r):e.fail(o)})}}return e.string=function(){return new e(function(e){return"string"==typeof e?o(e):n({message:h("a string",e)})})},e.number=function(){return new e(function(e){return"number"==typeof e?o(e):n({message:h("a number",e)})})},e.boolean=function(){return new e(function(e){return"boolean"==typeof e?o(e):n({message:h("a boolean",e)})})},e.constant=function(t){return new e(function(e){return c(e,t)?o(t):n({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})})},e.object=function(t){return new e(function(e){if(l(e)&&t){var r={};for(var i in t)if(t.hasOwnProperty(i)){var a=t[i].decode(e[i]);if(!0!==a.ok)return void 0===e[i]?n({message:"the key '"+i+"' is required but was not present"}):n(w("."+i,a.error));void 0!==a.result&&(r[i]=a.result)}return o(r)}return l(e)?o(e):n({message:h("an object",e)})})},e.array=function(t){return new e(function(e){if(d(e)&&t){return e.reduce(function(e,r,o){return i(function(e,t){return e.concat([t])},e,function(e,r){return a(function(e){return w("["+r+"]",e)},t.decode(e))}(r,o))},o([]))}return d(e)?o(e):n({message:h("an array",e)})})},e.tuple=function(t){return new e(function(e){if(d(e)){if(e.length!==t.length)return n({message:"expected a tuple of length "+t.length+", got one of length "+e.length});for(var r=[],i=0;i<t.length;i++){var a=t[i].decode(e[i]);if(!a.ok)return n(w("["+i+"]",a.error));r[i]=a.result}return o(r)}return n({message:h("a tuple of length "+t.length,e)})})},e.union=function(t,r){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];return e.oneOf.apply(e,[t,r].concat(o))},e.intersection=function(t,r){for(var n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return new e(function(e){return[t,r].concat(n).reduce(function(t,r){return i(Object.assign,t,r.decode(e))},o({}))})},e.anyJson=function(){return new e(function(e){return o(e)})},e.unknownJson=function(){return new e(function(e){return o(e)})},e.dict=function(t){return new e(function(e){if(l(e)){var r={};for(var i in e)if(e.hasOwnProperty(i)){var a=t.decode(e[i]);if(!0!==a.ok)return n(w("."+i,a.error));r[i]=a.result}return o(r)}return n({message:h("an object",e)})})},e.optional=function(t){return new e(function(e){return null==e?o(void 0):t.decode(e)})},e.oneOf=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e(function(e){for(var r=[],o=0;o<t.length;o++){var i=t[o].decode(e);if(!0===i.ok)return i;r[o]=i.error}var a=r.map(function(e){return"at error"+(e.at||"")+": "+e.message}).join('", "');return n({message:'expected a value matching one of the decoders, got the errors ["'+a+'"]'})})},e.withDefault=function(t,r){return new e(function(e){return o(function(e,t){return!0===t.ok?t.result:e}(t,r.decode(e)))})},e.valueAt=function(t,r){return new e(function(e){for(var o=e,i=0;i<t.length;i++){if(void 0===o)return n({at:u(t.slice(0,i+1)),message:"path does not exist"});if("string"==typeof t[i]&&!l(o))return n({at:u(t.slice(0,i+1)),message:h("an object",o)});if("number"==typeof t[i]&&!d(o))return n({at:u(t.slice(0,i+1)),message:h("an array",o)});o=o[t[i]]}return a(function(e){return void 0===o?{at:u(t),message:"path does not exist"}:w(u(t),e)},r.decode(o))})},e.succeed=function(t){return new e(function(e){return o(t)})},e.fail=function(t){return new e(function(e){return n({message:t})})},e.lazy=function(t){return new e(function(e){return t().decode(e)})},e}(),m=p.string,g=p.number,f=p.boolean,y=p.anyJson;p.unknownJson;var b=p.constant,k=p.object,W=p.array;p.tuple,p.dict;var I=p.optional,S=p.oneOf;p.union;var x=p.intersection;p.withDefault,p.valueAt,p.succeed,p.fail;var D=p.lazy;const v=m().where(e=>e.length>0,"Expected a non-empty string"),C=g().where(e=>e>=0,"Expected a non-negative number"),E=g().where(e=>e>0,"Expected a positive number"),B=S(b("keepInside"),b("autoEject")),T=k({inWorkspace:f()}),M=k({isVisible:f()}),F=k({base64Image:v}),R=k({icon:F,frameId:v}),L=S(b("workspace"),b("row"),b("column"),b("group")),A=S(b("row"),b("column"),b("group")),P=S(b("maximized"),b("minimized"),b("normal")),z=S(b("workspace")),O=(e,t)=>{const r=typeof e;if(t&&"function"!==r&&"undefined"!==r)throw new Error(`Provided argument must be either undefined or of type function, provided: ${r}`);if(!t&&"function"!==r)throw new Error(`Provided argument must be of type function, provided: ${r}`)},H=I(k({saveLayout:I(f())})),$=k({name:v}),_=k({minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f())}),j=k({minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),allowExtract:I(f()),allowReorder:I(f()),allowDrop:I(f()),allowDropHeader:I(f()),allowDropLeft:I(f()),allowDropRight:I(f()),allowDropTop:I(f()),allowDropBottom:I(f()),showMaximizeButton:I(f()),showEjectButton:I(f()),showAddWindowButton:I(f())}),G=k({minHeight:I(g()),maxHeight:I(g()),allowDrop:I(f()),allowSplitters:I(f()),isPinned:I(f()),maximizationBoundary:I(f())}),N=k({minWidth:I(g()),maxWidth:I(g()),allowDrop:I(f()),allowSplitters:I(f()),isPinned:I(f()),maximizationBoundary:I(f())}),V=k({type:I(b("window")),appName:I(v),windowId:I(v),context:I(y()),config:I(_)}),J=k({type:b("window"),appName:I(v),windowId:I(v),context:I(y()),config:I(_)}),U=I(k({type:I(A),children:I(D(()=>W(S(V,U)))),config:I(y())})),K=k({type:b("column"),children:I(D(()=>W(S(J,X)))),config:I(N)}),q=k({type:b("row"),children:I(D(()=>W(S(J,X)))),config:I(G)}),Q=k({type:b("group"),children:I(D(()=>W(S(J,X)))),config:I(j)}),X=S(Q,K,q);S(m().where(e=>"maximized"===e.toLowerCase(),"Expected a case insensitive variation of 'maximized'"),m().where(e=>"normal"===e.toLowerCase(),"Expected a case insensitive variation of 'normal'"));const Y=k({bounds:I(k({left:I(g()),top:I(g()),width:I(C),height:I(C)})),isVisible:I(f()),frameId:I(v)}),Z=S(b("direct"),b("delayed"),b("lazy")),ee=I(k({app:I(v),context:I(y()),loadingStrategy:I(Z),title:I(v),reuseWorkspaceId:I(v),frameId:I(v),applicationName:I(v),lockdown:I(f()),activateFrame:I(f()),newFrame:I(S(Y,f())),noTabHeader:I(f()),inMemoryLayout:I(f()),icon:I(v),isPinned:I(f()),isSelected:I(f()),positionIndex:I(C),allowSystemHibernation:I(f())})),te=k({name:v,restoreOptions:I(ee)}),re=k({children:I(W(S(V,X))),context:I(y()),config:I(k({title:I(v),position:I(C),isFocused:I(f()),noTabHeader:I(f()),reuseWorkspaceId:I(v),loadingStrategy:I(Z),allowDrop:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),showCloseButton:I(f()),allowSplitters:I(f()),showWindowCloseButtons:I(f()),showEjectButtons:I(f()),showAddWindowButtons:I(f()),icon:I(v),isPinned:I(f()),isSelected:I(f()),positionIndex:I(C),windowDragMode:I(B)})),frame:I(k({activate:I(f()),reuseFrameId:I(v),applicationName:I(v),newFrame:I(S(f(),Y))}))}),oe=k({workspaceId:v}),ne=k({name:v,restoreOptions:I(ee)}),ie=I(k({applicationName:I(m()),frameConfig:I(Y),context:I(k()),layoutComponentId:I(v)})),ae=k({workspaces:W(S(I(re),I(ne)))}),se=k({frameId:v,workspaces:W(S(re,ne))}),ce=k({type:L,definition:I(S(re,U))}),de=x(re,k({saveConfig:I(k({saveLayout:I(f())}))})),le=k({itemId:v}),he=k({context:I(k())}),ue=k({id:v,isFocused:I(f()),isInitialized:I(f()),initializationContext:I(he)});k({type:A,id:v,frameId:v,workspaceId:v,positionIndex:g()});const we=S(b("frame"),b("workspace"),b("container"),b("window")),pe=k({type:we,branch:v}),me=S(b("opened"),b("closing"),b("closed"),b("focus"),b("added"),b("loaded"),b("removed"),b("childrenUpdate"),b("containerChange"),b("maximized"),b("restored"),b("minimized"),b("normal"),b("selected"),b("lock-configuration-changed"),b("hibernated"),b("resumed")),ge=k({frameId:v,title:v,positionIndex:C,name:v,layoutName:I(v),isHibernated:I(f()),isSelected:I(f()),allowDrop:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),allowSplitters:I(f()),showCloseButton:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),showAddWindowButtons:I(f()),showEjectButtons:I(f()),showWindowCloseButtons:I(f()),widthInPx:I(g()),heightInPx:I(g()),isPinned:I(f()),windowDragMode:I(B),loadingStrategy:I(Z)}),fe=k({frameId:v,workspaceId:v,positionIndex:g(),minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g())}),ye=y(),be=x(fe,k({windowId:I(v),isMaximized:I(f()),isFocused:f(),isSelected:I(f()),title:I(m()),appName:I(v),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f()),minWidth:I(g()),minHeight:I(g()),maxWidth:I(g()),maxHeight:I(g()),widthInPx:I(g()),heightInPx:I(g()),context:I(y())})),ke=k({id:I(v),config:ye,children:I(D(()=>W(Ie))),type:S(b("row"),b("column"),b("group"))}),We=k({id:I(v),config:be,type:b("window")}),Ie=S(We,ke),Se=k({id:v,config:ge,children:W(Ie),frameSummary:ue,context:I(y())}),xe=k({type:b("window"),config:k({appName:v,windowId:I(v),context:I(y()),url:I(v),title:I(m()),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f()),minWidth:I(g()),minHeight:I(g()),maxWidth:I(g()),maxHeight:I(g()),isMaximized:I(f())})}),De=k({type:b("group"),config:y(),children:W(S(xe))}),ve=k({type:b("column"),config:y(),children:W(S(De,xe,D(()=>ve),D(()=>Ce)))}),Ce=k({type:b("row"),config:y(),children:W(S(ve,De,xe,D(()=>Ce)))}),Ee=k({name:v,type:b("Workspace"),metadata:I(y()),components:W(k({type:b("Workspace"),application:I(m()),state:k({config:y(),context:y(),children:W(S(Ce,ve,De,xe))})}))}),Be=k({layout:Ee,mode:S(b("replace"),b("merge"))}),Te=k({layouts:W(Ee),mode:S(b("replace"),b("merge"))}),Me=k({layouts:W(Ee)}),Fe=k({id:v,isFocused:I(f()),isInitialized:I(f()),initializationContext:I(he)}),Re=k({summaries:W(Fe)}),Le=k({id:v,config:ge}),Ae=k({summaries:W(Le)}),Pe=k({id:v,config:y(),workspaces:W(Se)}),ze=k({name:v,applicationName:I(m())}),Oe=k({summaries:W(ze)}),He=k({windowId:v}),$e=y(),_e=k({state:P}),je=k({top:g(),left:g(),width:C,height:C}),Ge=k({bounds:je}),Ne=k({icon:I(v)}),Ve=k({id:I(v)}),Je=k({isSupported:f()}),Ue=k({width:I(E),height:I(E),relative:I(f())}),Ke=k({top:I(g()),left:I(g()),relative:I(f())}),qe=k({itemId:v}),Qe=k({allowPrevent:I(f()),showDialog:I(f())}),Xe=k({itemId:v,closeOptions:I(Qe)}),Ye=k({itemId:v,excludeIds:I(f())}),Ze=k({frameId:v,requestedState:P}),et=k({itemId:v,title:v}),tt=k({itemId:v,containerId:v}),rt=x(qe,Ue),ot=k({itemId:v,enabled:f()}),nt=x(qe,Ke);k({id:v,type:A});const it=k({definition:V,parentId:v,parentType:L}),at=k({definition:X,parentId:v,parentType:L}),st=k({itemId:v,windowId:I(v)}),ct=k({live:f()}),dt=k({type:S(b("row"),b("column")),workspaceId:v}),lt=k({type:S(b("row"),b("column")),itemId:v}),ht=k({itemId:v,config:ye}),ut=k({frameSummary:ue,frameBounds:I(je)}),wt=k({workspaceSummary:Le,frameSummary:ue,workspaceSnapshot:I(Se),frameBounds:I(je)}),pt=k({containerSummary:ht}),mt=k({windowSummary:k({itemId:v,parentId:v,config:be})}),gt=k({name:v,workspaceId:v,saveContext:I(f()),allowMultiple:I(f()),metadata:I(k())}),ft=k({allowDrop:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),allowSplitters:I(f()),showCloseButton:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),showWindowCloseButtons:I(f()),showAddWindowButtons:I(f()),showEjectButtons:I(f())}),yt=k({workspaceId:v,config:I(ft)}),bt=k({allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f())}),kt=k({width:I(C),height:I(C)}),Wt=k({windowPlacementId:v,config:I(bt)}),It=k({allowDrop:I(f()),allowSplitters:I(f())}),St=k({allowDrop:I(f()),allowSplitters:I(f())}),xt=k({allowExtract:I(f()),allowReorder:I(f()),allowDrop:I(f()),allowDropLeft:I(f()),allowDropRight:I(f()),allowDropTop:I(f()),allowDropBottom:I(f()),allowDropHeader:I(f()),showMaximizeButton:I(f()),showEjectButton:I(f()),showAddWindowButton:I(f())}),Dt=k({itemId:v,type:b("row"),config:I(It)}),vt=k({itemId:v,type:b("column"),config:I(St)}),Ct=k({itemId:v,type:b("group"),config:I(xt)}),Et=S(Dt,vt,Ct),Bt=k({workspaceId:v,icon:I(v)}),Tt=k({workspaceId:v,icon:I(v)}),Mt=I(k({icon:I(v)})),Ft=I(k({activate:I(f())})),Rt=k({shortcut:v,frameId:v}),Lt=k({shortcut:v,frameId:v}),At=k({frameId:v}),Pt=k({enabled:f()}),zt=k({itemId:v,type:z}),Ot=k({operation:v}),Ht=k({itemId:v,dragMode:B}),$t=k({itemId:v,strategy:Z}),_t=k({prevent:f()}),jt=k({frameId:v,activate:I(f()),isVisible:f()}),Gt=k({width:E,height:E}),Nt=k({mode:I(S(b("Global"),b("WindowContainer"))),type:m(),size:I(Gt),message:v,messageTitle:I(v),movable:I(f()),transparent:I(f()),title:v,context:I(y()),affirmativeButtonName:I(v),showAffirmativeButton:I(f()),cancelButtonName:I(v),showCancelButton:I(f()),negativeButtonName:I(v),showNegativeButton:I(f()),defaultAction:I(S(b("affirmative"),b("negative"),b("cancel"))),timerDuration:I(E),showTimer:I(f()),inputMaxLength:I(E),inputPattern:I(v),inputPatternErrorMessage:I(v),inputPlaceholder:I(m())}),Vt=k({frameId:v,options:Nt}),Jt="T42.Web.Platform.Control",Ut="T42.Web.Platform.WSP.Stream",Kt={control:{name:"T42.Workspaces.Control",isStream:!1},frameStream:{name:"T42.Workspaces.Stream.Frame",isStream:!0},workspaceStream:{name:"T42.Workspaces.Stream.Workspace",isStream:!0},containerStream:{name:"T42.Workspaces.Stream.Container",isStream:!0},windowStream:{name:"T42.Workspaces.Stream.Window",isStream:!0}},qt={control:{name:"T42.Workspaces.Client.Control",isStream:!1}},Qt={frame:{name:"T42.Workspaces.Stream.Frame",payloadDecoder:ut},workspace:{name:"T42.Workspaces.Stream.Workspace",payloadDecoder:wt},container:{name:"T42.Workspaces.Stream.Container",payloadDecoder:pt},window:{name:"T42.Workspaces.Stream.Window",payloadDecoder:mt}},Xt={shortcutClicked:{name:"shortcutClicked",argsDecoder:Lt,resultDecoder:$e},frameClosing:{name:"frameClosing",argsDecoder:At,resultDecoder:_t}},Yt={ping:{name:"ping",resultDecoder:ct},isWindowInWorkspace:{name:"isWindowInWorkspace",argsDecoder:qe,resultDecoder:T},createWorkspace:{name:"createWorkspace",resultDecoder:Se,argsDecoder:de},createFrame:{name:"createFrame",resultDecoder:Fe,argsDecoder:ie},initFrame:{name:"initFrame",resultDecoder:$e,argsDecoder:se},getAllFramesSummaries:{name:"getAllFramesSummaries",resultDecoder:Re},getFrameSummary:{name:"getFrameSummary",resultDecoder:ue,argsDecoder:le},getAllWorkspacesSummaries:{name:"getAllWorkspacesSummaries",resultDecoder:Ae},getWorkspaceSnapshot:{name:"getWorkspaceSnapshot",resultDecoder:Se,argsDecoder:qe},getAllLayoutsSummaries:{name:"getAllLayoutsSummaries",resultDecoder:Oe},openWorkspace:{name:"openWorkspace",argsDecoder:te,resultDecoder:Se},deleteLayout:{name:"deleteLayout",resultDecoder:$e,argsDecoder:$},saveLayout:{name:"saveLayout",resultDecoder:Ee,argsDecoder:gt},importLayout:{name:"importLayout",resultDecoder:$e,argsDecoder:Be},importLayouts:{name:"importLayouts",resultDecoder:$e,argsDecoder:Te},exportAllLayouts:{name:"exportAllLayouts",resultDecoder:Me},restoreItem:{name:"restoreItem",argsDecoder:qe,resultDecoder:$e},maximizeItem:{name:"maximizeItem",argsDecoder:qe,resultDecoder:$e},focusItem:{name:"focusItem",argsDecoder:qe,resultDecoder:$e},closeItem:{name:"closeItem",argsDecoder:Xe,resultDecoder:$e},closeWorkspace:{name:"closeWorkspace",argsDecoder:Xe,resultDecoder:$e},resizeItem:{name:"resizeItem",argsDecoder:rt,resultDecoder:$e},setMaximizationBoundary:{name:"setMaximizationBoundary",argsDecoder:ot,resultDecoder:$e},changeFrameState:{name:"changeFrameState",argsDecoder:Ze,resultDecoder:$e},getFrameState:{name:"getFrameState",argsDecoder:qe,resultDecoder:_e},getFrameBounds:{name:"getFrameBounds",argsDecoder:qe,resultDecoder:Ge},moveFrame:{name:"moveFrame",argsDecoder:nt,resultDecoder:$e},getFrameSnapshot:{name:"getFrameSnapshot",argsDecoder:Ye,resultDecoder:Pe},forceLoadWindow:{name:"forceLoadWindow",argsDecoder:qe,resultDecoder:He},ejectWindow:{name:"ejectWindow",argsDecoder:qe,resultDecoder:He},setItemTitle:{name:"setItemTitle",argsDecoder:et,resultDecoder:$e},moveWindowTo:{name:"moveWindowTo",argsDecoder:tt,resultDecoder:$e},addWindow:{name:"addWindow",argsDecoder:it,resultDecoder:st},addContainer:{name:"addContainer",argsDecoder:at,resultDecoder:st},bundleWorkspace:{name:"bundleWorkspace",argsDecoder:dt,resultDecoder:$e},bundleItem:{name:"bundleItem",argsDecoder:lt,resultDecoder:$e},hibernateWorkspace:{name:"hibernateWorkspace",argsDecoder:oe,resultDecoder:$e},resumeWorkspace:{name:"resumeWorkspace",argsDecoder:oe,resultDecoder:$e},lockWorkspace:{name:"lockWorkspace",argsDecoder:yt,resultDecoder:$e},lockWindow:{name:"lockWindow",argsDecoder:Wt,resultDecoder:$e},lockContainer:{name:"lockContainer",argsDecoder:Et,resultDecoder:$e},pinWorkspace:{name:"pinWorkspace",argsDecoder:Bt,resultDecoder:$e},unpinWorkspace:{name:"unpinWorkspace",argsDecoder:oe,resultDecoder:$e},getWorkspaceIcon:{name:"getWorkspaceIcon",argsDecoder:oe,resultDecoder:Ne},setWorkspaceIcon:{name:"setWorkspaceIcon",argsDecoder:Tt,resultDecoder:$e},registerShortcut:{name:"registerShortcut",argsDecoder:Rt,resultDecoder:$e},unregisterShortcut:{name:"unregisterShortcut",argsDecoder:Rt,resultDecoder:$e},showLoadingAnimation:{name:"showLoadingAnimation",argsDecoder:zt,resultDecoder:$e},hideLoadingAnimation:{name:"hideLoadingAnimation",argsDecoder:zt,resultDecoder:$e},getPlatformFrameId:{name:"getPlatformFrameId",resultDecoder:Ve},operationCheck:{name:"operationCheck",argsDecoder:Ot,resultDecoder:Je},setWindowDragMode:{name:"setWindowDragMode",argsDecoder:Ht,resultDecoder:$e},setLoadingStrategy:{name:"setLoadingStrategy",argsDecoder:$t,resultDecoder:$e},getTaskbarIcon:{name:"getTaskbarIcon",resultDecoder:F},setTaskbarIcon:{name:"setTaskbarIcon",argsDecoder:R,resultDecoder:$e},subscribeToFrameClosing:{name:"subscribeToFrameClosing",argsDecoder:qe,resultDecoder:$e},changeFrameVisibility:{name:"changeFrameVisibility",argsDecoder:jt,resultDecoder:$e},getFrameVisibility:{name:"getFrameVisibility",argsDecoder:qe,resultDecoder:M},showFrameDialog:{name:"showFrameDialog",argsDecoder:Vt,resultDecoder:y()}};class Zt{resolve;reject;promise;constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class er{transport;registry;activeSubscriptions=[];pendingSubScriptions=[];constructor(e,t){this.transport=e,this.registry=t}async createCoreEventSubscription(){await this.transport.coreSubscriptionReady(this.handleCoreEvent.bind(this))}handleCoreSubscription(e){const t=`${e.eventType}-${e.action}`,r=e.scope,o=e.scopeId;return this.registry.add(t,t=>{const n={type:r,id:o},i={frame:t.frameSummary?.id||t.windowSummary?.config.frameId,workspace:t.workspaceSummary?.id||t.windowSummary?.config.workspaceId,container:t.containerSummary?.itemId,window:t.windowSummary?.itemId};this.checkScopeMatch(n,i)&&e.callback(t)})}async send(e,t){const r=Object.values(Yt).find(t=>t.name===e);if(!r)throw new Error(`Cannot find definition for operation name: ${e}`);if(r.argsDecoder)try{r.argsDecoder.runWithException(t)}catch(t){throw new Error(`Unexpected internal outgoing validation error: ${t.message}, for input: ${JSON.stringify(t.input)}, for operation ${e}`)}try{const e=await this.transport.transmitControl(r.name,t);return r.resultDecoder.runWithException(e),e}catch(t){if(t.kind)throw new Error(`Unexpected internal incoming validation error: ${t.message}, for input: ${JSON.stringify(t.input)}, for operation ${e}`);throw new Error(t.message)}}async subscribe(e){const t=this.getPendingSubscription(e);t&&await t.promise;let r=this.getActiveSubscription(e);const o=this.getRegistryKey(e);if(!r){const t=new Zt,o={streamType:e.eventType,level:e.scope,levelId:e.scopeId,promise:t.promise};this.pendingSubScriptions.push(o);try{const o=Qt[e.eventType],n=await this.transport.subscribe(o.name,this.getBranchKey(e),e.eventType);n.onData(e=>{const t=e.data,r=pe.run(e.requestArguments),o=me.run(t.action);if(!r.ok||!o.ok)return;const n=r.result.type,i=`${n}-${r.result.branch}-${o.result}`,a=Qt[n].payloadDecoder.run(t.payload);a.ok&&this.registry.execute(i,a.result)}),r={streamType:e.eventType,level:e.scope,levelId:e.scopeId,callbacksCount:0,gdSub:n},this.activeSubscriptions.push(r),t.resolve()}catch(e){throw t.reject(e),e}finally{this.removePendingSubscription(o)}}const n=this.registry.add(o,e.callback);return++r.callbacksCount,()=>{n(),--r.callbacksCount,0===r.callbacksCount&&(r.gdSub.close(),this.activeSubscriptions.splice(this.activeSubscriptions.indexOf(r),1))}}onOperation(e){return this.transport.onInternalMethodInvoked("control",(t,r)=>{const o=t.operation,n=t.data,i=Object.values(Xt).find(e=>e.name===o);if(!i)throw new Error(`Cannot find definition for operation name: ${o}`);if(i.argsDecoder)try{i.argsDecoder.runWithException(n)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}e(t,r)})}onOperationWithResponse(e){return this.transport.onInternalMethodInvoked("control",async(t,r)=>{const o=t.operation,n=t.data,i=Object.values(Xt).find(e=>e.name===o);if(!i)throw new Error(`Cannot find definition for operation name: ${o}`);if(i.argsDecoder)try{i.argsDecoder.runWithException(n)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}const a=await e(t,r);if(i.resultDecoder)try{i.resultDecoder.runWithException(a)}catch(e){throw new Error(`Unexpected internal outgoing result validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}return a})}checkScopeMatch(e,t){return"global"===e.type||("frame"===e.type&&e.id===t.frame||("workspace"===e.type&&e.id===t.workspace||("container"===e.type&&e.id===t.container||"window"===e.type&&e.id===t.window)))}handleCoreEvent(e){const t=e.data;try{const e=me.runWithException(t.action),r=we.runWithException(t.type),o=Qt[r].payloadDecoder.runWithException(t.payload),n=`${r}-${e}`;this.registry.execute(n,o)}catch(e){console.warn(`Cannot handle event with data ${JSON.stringify(t)}, because of validation error: ${e.message}`)}}getBranchKey(e){return"global"===e.scope?e.scope:`${e.scope}_${e.scopeId}`}getRegistryKey(e){return`${e.eventType}-${this.getBranchKey(e)}-${e.action}`}getActiveSubscription(e){return this.activeSubscriptions.find(t=>t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId)}getPendingSubscription(e){return this.pendingSubScriptions.find(t=>t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId)}removePendingSubscription(e){const t=this.pendingSubScriptions.indexOf(e);t>=0&&this.pendingSubScriptions.splice(t,1)}}const tr=()=>"undefined"==typeof window||(window.glue42gd||window.iodesktop),rr=()=>"undefined"==typeof window?null:window.glue42core||window.iobrowser;class or{agm;registry;defaultTransportTimeout=12e4;coreEventMethodInitiated=!1;corePlatformSubPromise;constructor(e,t){this.agm=e,this.registry=t}async initiate(e){if(tr())return await Promise.all(Object.values(Kt).map(e=>this.verifyMethodLive(e.name))),void await Promise.all(Object.keys(qt).map(e=>this.registerMethod(e)));const t=rr().communicationId;await Promise.all([this.verifyMethodLive(Jt,t),this.verifyMethodLive(Ut,t)]),await this.transmitControl("frameHello",{windowId:e})}coreSubscriptionReady(e){return this.coreEventMethodInitiated||this.subscribePlatform(e),this.corePlatformSubPromise}subscribePlatform(e){this.coreEventMethodInitiated=!0;const t=rr().communicationId;this.corePlatformSubPromise=this.agm.subscribe(Ut,t?{target:{instance:t}}:void 0),this.corePlatformSubPromise.then(t=>{t.onData(t=>e(t.data))})}async subscribe(e,t,r){const o={branch:t,type:r};let n;try{n=await this.agm.subscribe(e,{arguments:o})}catch(r){const o=`Internal subscription error! Error details: stream - ${e}, branch: ${t}. Internal message: ${r.message}`;throw new Error(o)}return n}async transmitControl(e,t){const r=tr()?{operation:e,operationArguments:t}:{operation:e,domain:"workspaces",data:t},o=tr()?Kt.control.name:Jt,n=tr()?void 0:rr().communicationId;let i;const a=`Internal Workspaces Communication Error. Attempted operation: ${JSON.stringify(r)}. `;try{if(i=await this.agm.invoke(o,r,n?{instance:n}:"best",{methodResponseTimeoutMs:this.defaultTransportTimeout}),!i)throw new Error("Received unsupported result from GD - empty result");if(!Array.isArray(i.all_return_values)||0===i.all_return_values.length)throw new Error("Received unsupported result from GD - empty values collection")}catch(e){if(e&&e.all_errors&&e.all_errors.length){const t=e.all_errors[0].message;throw new Error(`${a} -> Inner message: ${t}`)}throw new Error(`${a} -> Inner message: ${e.message}`)}return i.all_return_values[0].returned}onInternalMethodInvoked(e,t){return this.registry.add(e,t)}verifyMethodLive(e,t){return r=()=>new Promise(r=>{if(this.agm.methods().some(r=>{const o=r.name===e,n=!t||r.getServers().some(e=>e.instance===t);return o&&n}))return void r();const o=this.agm.serverMethodAdded(n=>{const i=n.method,a=n.server,s=!t||a.instance===t;i.name===e&&s&&(o(),r())})}),o=15e3,n="Timeout waiting for the Workspaces communication channels",new Promise((e,t)=>{let i=!0;const a=setTimeout(()=>{i&&(i=!1,t(n))},o);r().then(t=>{i&&(i=!1,clearTimeout(a),e(t))}).catch(e=>{i&&(i=!1,clearTimeout(a),t(e))})});var r,o,n}registerMethod(e){const t=qt[e];return this.agm.register(t.name,(t,r)=>Promise.all(this.registry.execute(e,t,r)))}}const nr=new WeakMap;class ir{constructor(e,t){const r=t.wrapChildren(e.children);delete e.children,nr.set(this,{base:t,children:r,definition:e})}get type(){return nr.get(this).definition.type}addColumn(e){return nr.get(this).base.add("column",nr.get(this).children,e)}addRow(e){return nr.get(this).base.add("row",nr.get(this).children,e)}addGroup(e){return nr.get(this).base.add("group",nr.get(this).children,e)}addWindow(e){return nr.get(this).base.addWindow(nr.get(this).children,e),this}serialize(){const e=nr.get(this).definition;return e.children=nr.get(this).base.serializeChildren(nr.get(this).children),e}}class ar{getBuilder;constructor(e){this.getBuilder=e}wrapChildren(e){return e.map(e=>"window"===e.type?e:this.getBuilder({type:e.type,definition:e}))}add(e,t,r){const o=U.runWithException(r),n=this.getBuilder({type:e,definition:o});return t.push(n),n}addWindow(e,t){const r=V.runWithException(t);r.type="window",e.push(r)}serializeChildren(e){return e.map(e=>e instanceof ir?e.serialize():e)}}const sr=new WeakMap;class cr{constructor(e,t,r){const o=t.wrapChildren(e.children);delete e.children,sr.set(this,{base:t,children:o,definition:e,controller:r})}addColumn(e){const t=sr.get(this).children;if(!t.every(e=>e instanceof ir&&"column"===e.type))throw new Error("Cannot add a column to this workspace, because there are already children of another type");return sr.get(this).base.add("column",t,e)}addRow(e){const t=sr.get(this).children;if(!t.every(e=>e instanceof ir&&"row"===e.type))throw new Error("Cannot add a row to this workspace, because there are already children of another type");return sr.get(this).base.add("row",t,e)}addGroup(e){const t=sr.get(this).children;if(0!==t.length)throw new Error("Cannot add a group to this workspace, because there are already defined children.");return sr.get(this).base.add("group",t,e)}addWindow(e){const t=sr.get(this).children;if(0!==t.length)throw new Error("Cannot add a window to this workspace, because there are already defined children.");return sr.get(this).base.addWindow(t,e),this}getChildAt(e){C.runWithException(e);return sr.get(this).children[e]}async create(e){const t=H.runWithException(e),r=sr.get(this).definition;r.children=sr.get(this).base.serializeChildren(sr.get(this).children);return sr.get(this).controller.createWorkspace(r,t)}}const dr=new WeakMap,lr=e=>dr.get(e).base;class hr{constructor(e){dr.set(this,{base:e})}get type(){return"row"}get id(){return lr(this).getId(this)}get frameId(){return lr(this).getFrameId(this)}get workspaceId(){return lr(this).getWorkspaceId(this)}get positionIndex(){return lr(this).getPositionIndex(this)}get children(){return lr(this).getAllChildren(this)}get parent(){return lr(this).getMyParent(this)}get frame(){return lr(this).getMyFrame(this)}get workspace(){return lr(this).getMyWorkspace(this)}get allowDrop(){return lr(this).getAllowDrop(this)}get allowSplitters(){return lr(this).getAllowSplitters(this)}get minWidth(){return lr(this).getMinWidth(this)}get minHeight(){return lr(this).getMinHeight(this)}get maxWidth(){return lr(this).getMaxWidth(this)}get maxHeight(){return lr(this).getMaxHeight(this)}get width(){return lr(this).getWidthInPx(this)}get height(){return lr(this).getHeightInPx(this)}get isPinned(){return lr(this).getIsPinned(this)}get isMaximized(){return lr(this).getIsMaximized(this)}get maximizationBoundary(){return lr(this).getMaximizationBoundary(this)}addWindow(e){return lr(this).addWindow(this,e,"row")}async addGroup(e){if(e?.type&&"group"!==e.type)throw new Error(`Expected a group definition, but received ${e.type}`);return lr(this).addParent(this,"group","row",e)}async addColumn(e){if(e?.type&&"column"!==e.type)throw new Error(`Expected a column definition, but received ${e.type}`);return lr(this).addParent(this,"column","row",e)}async addRow(){throw new Error("Adding rows as row children is not supported")}removeChild(e){return lr(this).removeChild(this,e)}maximize(){return lr(this).maximize(this)}restore(){return lr(this).restore(this)}close(){return lr(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const r=void 0===t?void 0:It.runWithException(t);return lr(this).lockContainer(this,r)}async setHeight(e){return C.runWithException(e),lr(this).setHeight(this,e)}async onLockConfigurationChanged(e){O(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await lr(this).processLocalSubscription(this,t)}async setMaximizationBoundary(e){const t=Pt.runWithException(e);return lr(this).setMaximizationBoundary(this,t)}}const ur=new WeakMap,wr=e=>ur.get(e).base;class pr{constructor(e){ur.set(this,{base:e})}get type(){return"column"}get id(){return wr(this).getId(this)}get frameId(){return wr(this).getFrameId(this)}get workspaceId(){return wr(this).getWorkspaceId(this)}get positionIndex(){return wr(this).getPositionIndex(this)}get children(){return wr(this).getAllChildren(this)}get parent(){return wr(this).getMyParent(this)}get frame(){return wr(this).getMyFrame(this)}get workspace(){return wr(this).getMyWorkspace(this)}get allowDrop(){return wr(this).getAllowDrop(this)}get allowSplitters(){return wr(this).getAllowSplitters(this)}get minWidth(){return wr(this).getMinWidth(this)}get minHeight(){return wr(this).getMinHeight(this)}get maxWidth(){return wr(this).getMaxWidth(this)}get maxHeight(){return wr(this).getMaxHeight(this)}get width(){return wr(this).getWidthInPx(this)}get height(){return wr(this).getHeightInPx(this)}get isPinned(){return wr(this).getIsPinned(this)}get isMaximized(){return wr(this).getIsMaximized(this)}get maximizationBoundary(){return wr(this).getMaximizationBoundary(this)}addWindow(e){return wr(this).addWindow(this,e,"column")}async addGroup(e){if(e?.type&&"group"!==e.type)throw new Error(`Expected a group definition, but received ${e.type}`);return wr(this).addParent(this,"group","column",e)}async addColumn(){throw new Error("Adding columns as column children is not supported")}async addRow(e){if(e?.type&&"row"!==e.type)throw new Error(`Expected a row definition, but received ${e.type}`);return wr(this).addParent(this,"row","column",e)}removeChild(e){return wr(this).removeChild(this,e)}maximize(){return wr(this).maximize(this)}restore(){return wr(this).restore(this)}close(){return wr(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const r=void 0===t?void 0:St.runWithException(t);return wr(this).lockContainer(this,r)}async setWidth(e){return C.runWithException(e),wr(this).setWidth(this,e)}async onLockConfigurationChanged(e){O(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await wr(this).processLocalSubscription(this,t)}async setMaximizationBoundary(e){const t=Pt.runWithException(e);return wr(this).setMaximizationBoundary(this,t)}}const mr=new WeakMap,gr=e=>mr.get(e).base;class fr{constructor(e){mr.set(this,{base:e})}get type(){return"group"}get id(){return gr(this).getId(this)}get frameId(){return gr(this).getFrameId(this)}get workspaceId(){return gr(this).getWorkspaceId(this)}get positionIndex(){return gr(this).getPositionIndex(this)}get children(){return gr(this).getAllChildren(this)}get parent(){return gr(this).getMyParent(this)}get frame(){return gr(this).getMyFrame(this)}get workspace(){return gr(this).getMyWorkspace(this)}get allowExtract(){return gr(this).getAllowExtract(this)}get allowReorder(){return gr(this).getAllowReorder(this)}get allowDropLeft(){return gr(this).getAllowDropLeft(this)}get allowDropRight(){return gr(this).getAllowDropRight(this)}get allowDropTop(){return gr(this).getAllowDropTop(this)}get allowDropBottom(){return gr(this).getAllowDropBottom(this)}get allowDropHeader(){return gr(this).getAllowDropHeader(this)}get allowDrop(){return gr(this).getAllowDrop(this)}get showMaximizeButton(){return gr(this).getShowMaximizeButton(this)}get showEjectButton(){return gr(this).getShowEjectButton(this)}get showAddWindowButton(){return gr(this).getShowAddWindowButton(this)}get minWidth(){return gr(this).getMinWidth(this)}get minHeight(){return gr(this).getMinHeight(this)}get maxWidth(){return gr(this).getMaxWidth(this)}get maxHeight(){return gr(this).getMaxHeight(this)}get width(){return gr(this).getWidthInPx(this)}get height(){return gr(this).getHeightInPx(this)}get isMaximized(){return gr(this).getIsMaximized(this)}addWindow(e){return gr(this).addWindow(this,e,"group")}async addGroup(){throw new Error("Adding groups as group child is not supported")}async addColumn(){throw new Error("Adding columns as group child is not supported")}async addRow(){throw new Error("Adding rows as group child is not supported")}removeChild(e){return gr(this).removeChild(this,e)}maximize(){return gr(this).maximize(this)}restore(){return gr(this).restore(this)}close(){return gr(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowDropHeader:this.allowDropHeader,allowDropLeft:this.allowDropLeft,allowDropRight:this.allowDropRight,allowDropTop:this.allowDropTop,allowDropBottom:this.allowDropBottom,allowExtract:this.allowExtract,allowReorder:this.allowReorder,showAddWindowButton:this.showAddWindowButton,showEjectButton:this.showEjectButton,showMaximizeButton:this.showMaximizeButton})}else t=e;const r=void 0===t?void 0:xt.runWithException(t);return gr(this).lockContainer(this,r)}async setSize(e){const t=kt.runWithException(e);if(!t.width&&!t.height)throw new Error("Expected either width or height to be passed.");return gr(this).setSize(this,e.width,e.height)}async bundleToRow(){await gr(this).bundleTo(this,"row"),await this.workspace.refreshReference()}async bundleToColumn(){await gr(this).bundleTo(this,"column"),await this.workspace.refreshReference()}async onLockConfigurationChanged(e){O(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowDropHeader:this.allowDropHeader,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowExtract:this.allowExtract,allowReorder:this.allowReorder,showAddWindowButton:this.showAddWindowButton,showEjectButton:this.showEjectButton,showMaximizeButton:this.showMaximizeButton})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await gr(this).processLocalSubscription(this,t)}}const yr=new WeakMap,br=e=>yr.get(e).manager.getWorkspaceData(e),kr=e=>yr.get(e).manager;class Wr{constructor(e){yr.set(this,{manager:e})}get id(){return br(this).id}get frameId(){return br(this).config.frameId}get positionIndex(){return br(this).config.positionIndex}get title(){return br(this).config.title}get layoutName(){return br(this).config.layoutName}get isHibernated(){return br(this).config.isHibernated}get isSelected(){return br(this).config.isSelected}get children(){return br(this).children}get frame(){return br(this).frame}get allowSplitters(){return br(this).config.allowSplitters}get allowSystemHibernation(){return br(this).config.allowSystemHibernation}get allowDrop(){return br(this).config.allowDrop}get allowDropLeft(){return br(this).config.allowDropLeft}get allowDropTop(){return br(this).config.allowDropTop}get allowDropRight(){return br(this).config.allowDropRight}get allowDropBottom(){return br(this).config.allowDropBottom}get allowExtract(){return br(this).config.allowExtract}get allowWindowReorder(){return br(this).config.allowWindowReorder}get showCloseButton(){return br(this).config.showCloseButton}get showSaveButton(){return br(this).config.showSaveButton}get allowWorkspaceTabReorder(){return br(this).config.allowWorkspaceTabReorder}get allowWorkspaceTabExtract(){return br(this).config.allowWorkspaceTabExtract}get minWidth(){return br(this).config.minWidth}get minHeight(){return br(this).config.minHeight}get maxWidth(){return br(this).config.maxWidth}get maxHeight(){return br(this).config.maxHeight}get width(){return br(this).config.widthInPx}get height(){return br(this).config.heightInPx}get showWindowCloseButtons(){return br(this).config.showWindowCloseButtons}get showEjectButtons(){return br(this).config.showEjectButtons}get showAddWindowButtons(){return br(this).config.showAddWindowButtons}get isPinned(){return br(this).config.isPinned}get windowDragMode(){return tr()?br(this).config.windowDragMode:"keepInside"}get loadingStrategy(){return tr()||console.warn("The workspace.loadingStrategy property is not supported in IO Connect Browser"),br(this).config.loadingStrategy}async setLoadingStrategy(e){if(!tr())throw new Error("Not supported in IO Connect Browser");const t=br(this).controller;await t.setLoadingStrategy(this.id,e),await this.refreshReference()}async removeChild(e){O(e);const t=this.children.find(e);t&&(await t.close(),await this.refreshReference())}async remove(e){O(e);const t=br(this).controller.iterateFindChild(this.children,e);await t.close(),await this.refreshReference()}async focus(){await br(this).controller.focusItem(this.id),await this.refreshReference()}async close(){const e=br(this).controller;await e.closeWorkspace(this.id,this.frameId)}snapshot(){return br(this).controller.getSnapshot(this.id,"workspace")}async saveLayout(e,t){v.runWithException(e),await br(this).controller.saveLayout({name:e,workspaceId:this.id,saveContext:t?.saveContext,metadata:t?.metadata,allowMultiple:t?.allowMultiple})}async setTitle(e){v.runWithException(e);const t=br(this).controller;await t.setItemTitle(this.id,e),await this.refreshReference()}getContext(){return br(this).controller.getWorkspaceContext(this.id)}setContext(e){return br(this).controller.setWorkspaceContext(this.id,e)}updateContext(e){return br(this).controller.updateWorkspaceContext(this.id,e)}onContextUpdated(e){return br(this).controller.subscribeWorkspaceContextUpdated(this.id,e)}async refreshReference(){const e=await br(this).controller.getSnapshot(this.id,"workspace"),t=br(this).controller.flatChildren(br(this).children),r=br(this).controller.refreshChildren({existingChildren:t,workspace:this,parent:this,children:e.children}),o=this.frame;let n;if(o.id===e.config.frameId)kr(this).remapFrame(o,e.frameSummary),n=o;else{const t={summary:e.frameSummary};n=br(this).ioc.getModel("frame",t)}kr(this).remapWorkspace(this,{config:e.config,children:r,frame:n})}async getIcon(){return br(this).controller.getWorkspaceIcon(this.id)}async setIcon(e){return br(this).controller.setWorkspaceIcon(this.id,e)}getBox(e){O(e);const t=br(this).children;return br(this).controller.iterateFindChild(t,t=>"window"!==t.type&&e(t))}getAllBoxes(e){O(e,!0);const t=br(this).children,r=br(this).controller.iterateFilterChildren(t,e=>"window"!==e.type);return e?r.filter(e):r}getRow(e){return O(e),this.getBox(t=>"row"===t.type&&e(t))}getAllRows(e){return O(e,!0),e?this.getAllBoxes(t=>"row"===t.type&&e(t)):this.getAllBoxes(e=>"row"===e.type)}getColumn(e){return O(e),this.getBox(t=>"column"===t.type&&e(t))}getAllColumns(e){return O(e,!0),e?this.getAllBoxes(t=>"column"===t.type&&e(t)):this.getAllBoxes(e=>"column"===e.type)}getGroup(e){return O(e),this.getBox(t=>"group"===t.type&&e(t))}getAllGroups(e){return O(e,!0),e?this.getAllBoxes(t=>"group"===t.type&&e(t)):this.getAllBoxes(e=>"group"===e.type)}getWindow(e){O(e);const t=br(this).children;return br(this).controller.iterateFindChild(t,t=>"window"===t.type&&e(t))}getAllWindows(e){O(e,!0);const t=br(this).children,r=br(this).controller.iterateFilterChildren(t,e=>"window"===e.type);return e?r.filter(e):r}addRow(e){return br(this).base.addParent(this,"row","workspace",e)}addColumn(e){return br(this).base.addParent(this,"column","workspace",e)}addGroup(e){return br(this).base.addParent(this,"group","workspace",e)}addWindow(e){return br(this).base.addWindow(this,e,"workspace")}async bundleToRow(){await br(this).controller.bundleWorkspaceTo("row",this.id),await this.refreshReference()}async bundleToColumn(){await br(this).controller.bundleWorkspaceTo("column",this.id),await this.refreshReference()}async hibernate(){await br(this).controller.hibernateWorkspace(this.id),await this.refreshReference()}async resume(){await br(this).controller.resumeWorkspace(this.id),await this.refreshReference()}async lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowSystemHibernation:this.allowSystemHibernation,allowExtract:this.allowExtract,allowWindowReorder:this.allowWindowReorder,allowSplitters:this.allowSplitters,showCloseButton:this.showCloseButton,showSaveButton:this.showSaveButton,allowWorkspaceTabReorder:this.allowWorkspaceTabReorder,allowWorkspaceTabExtract:this.allowWorkspaceTabExtract,showAddWindowButtons:this.showAddWindowButtons,showEjectButtons:this.showEjectButtons,showWindowCloseButtons:this.showWindowCloseButtons})}else t=e;const r=void 0===t?void 0:ft.runWithException(t);await br(this).controller.lockWorkspace(this.id,r),await this.refreshReference()}async pin(e){Mt.runWithException(e),await br(this).controller.pinWorkspace(this.id,e?.icon),await this.refreshReference()}async unpin(){await br(this).controller.unpinWorkspace(this.id),await this.refreshReference()}async showLoadingAnimation(){if(!tr())throw new Error("Not supported in IO Connect Browser");await br(this).controller.showWorkspaceLoadingAnimation(this.id)}async hideLoadingAnimation(){if(!tr())throw new Error("Not supported in IO Connect Browser");await br(this).controller.hideWorkspaceLoadingAnimation(this.id)}async setWindowDragMode(e){if(!tr())throw new Error("Not supported in IO Connect Browser");B.runWithException(e),await br(this).controller.setWindowDragMode(this.id,e),await this.refreshReference()}async onClosed(e){O(e);const t=br(this).id,r={action:"closed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})}};return await br(this).controller.processLocalSubscription(r,t)}async onHibernated(e){O(e);const t=br(this).id,r={action:"hibernated",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e()}};return await br(this).controller.processLocalSubscription(r,t)}async onResumed(e){O(e);const t=br(this).id,r={action:"resumed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e()}};return await br(this).controller.processLocalSubscription(r,t)}async onWindowAdded(e){O(e);const t=br(this).id,r={action:"added",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox(e=>e.id===t.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===t.windowSummary.itemId);e(r)}};return await br(this).controller.processLocalSubscription(r,t)}async onWindowRemoved(e){O(e);const t=br(this).id,r={action:"removed",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})}};return await br(this).controller.processLocalSubscription(r,t)}async onWindowLoaded(e){O(e);const t=br(this).id,r={action:"loaded",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getWindow(e=>e.id&&e.id===t.windowSummary.config.windowId);e(r)}};return await br(this).controller.processLocalSubscription(r,t)}async onWindowMaximized(e){O(e);const t=br(this).id,r={action:"maximized",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox(e=>e.id===t.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===t.windowSummary.itemId);e(r)}};return await br(this).controller.processLocalSubscription(r,t)}async onWindowRestored(e){O(e);const t=br(this).id,r={action:"restored",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox(e=>e.id===t.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===t.windowSummary.itemId);e(r)}};return await br(this).controller.processLocalSubscription(r,t)}async onWindowSelected(e){O(e);const t=br(this).id,r={action:"selected",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox(e=>e.id===t.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===t.windowSummary.itemId);e(r)}};return await br(this).controller.processLocalSubscription(r,t)}async onLockConfigurationChanged(e){O(e);const t=br(this).id,r={action:"lock-configuration-changed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e({allowDrop:this.allowDrop,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowSystemHibernation:this.allowSystemHibernation,allowExtract:this.allowExtract,allowSplitters:this.allowSplitters,allowWindowReorder:this.allowWindowReorder,allowWorkspaceTabExtract:this.allowWorkspaceTabExtract,allowWorkspaceTabReorder:this.allowWorkspaceTabReorder,showAddWindowButtons:this.showAddWindowButtons,showCloseButton:this.showCloseButton,showEjectButtons:this.showEjectButtons,showSaveButton:this.showSaveButton,showWindowCloseButtons:this.showWindowCloseButtons})}};return await br(this).controller.processLocalSubscription(r,t)}}const Ir=new WeakMap,Sr=e=>Ir.get(e).manager.getWindowData(e);class xr{constructor(e){Ir.set(this,{manager:e})}get id(){return Sr(this).config.windowId}get elementId(){return Sr(this).id}get type(){return"window"}get frameId(){return Sr(this).frame.id}get workspaceId(){return Sr(this).workspace.id}get positionIndex(){return Sr(this).config.positionIndex}get isMaximized(){return Sr(this).config.isMaximized}get isLoaded(){return Sr(this).controller.checkIsWindowLoaded(this.id)}get isSelected(){return Sr(this).config.isSelected}get focused(){return this.getGdWindow().isFocused}get title(){return Sr(this).config.title}get allowExtract(){return Sr(this).config.allowExtract}get allowReorder(){return Sr(this).config.allowReorder}get showCloseButton(){return Sr(this).config.showCloseButton}get width(){return Sr(this).config.widthInPx}get height(){return Sr(this).config.heightInPx}get minWidth(){return Sr(this).config.minWidth}get minHeight(){return Sr(this).config.minHeight}get maxWidth(){return Sr(this).config.maxWidth}get maxHeight(){return Sr(this).config.maxHeight}get workspace(){return Sr(this).workspace}get frame(){return Sr(this).frame}get parent(){return Sr(this).parent}get appName(){return Sr(this).config.appName}async forceLoad(){if(this.isLoaded)return;const e=Sr(this).controller,t=Sr(this).id,r=await e.forceLoadWindow(t);Sr(this).config.windowId=r,await this.workspace.refreshReference()}async focus(){const e=Sr(this).id,t=Sr(this).controller;await t.focusItem(e),await this.workspace.refreshReference()}async close(){const e=Sr(this).id,t=Sr(this).controller;await t.closeItem(e),await Sr(this).parent.removeChild(t=>t.id===e),await this.workspace.refreshReference()}async setTitle(e){v.runWithException(e);const t=Sr(this).id,r=Sr(this).controller;await r.setItemTitle(t,e),await this.workspace.refreshReference()}async maximize(){const e=Sr(this).id,t=Sr(this).controller;await t.maximizeItem(e),await this.workspace.refreshReference()}async restore(){const e=Sr(this).id,t=Sr(this).controller;await t.restoreItem(e),await this.workspace.refreshReference()}async eject(){if(!this.isLoaded)throw new Error("Cannot eject this window, because it is not loaded yet");const e=Sr(this).id,t=Sr(this).config.windowId,r=await Sr(this).controller.ejectWindow(e,t);return Sr(this).config.windowId=r,await this.workspace.refreshReference(),this.getGdWindow()}getGdWindow(){if(!this.isLoaded)throw new Error("Cannot fetch this GD window, because the window is not yet loaded");const e=Sr(this).config.windowId;return Sr(this).controller.getGDWindow(e)}async moveTo(e){if(!(e instanceof hr||e instanceof pr||e instanceof fr))throw new Error("Cannot add to the provided parent, because the provided parent is not an instance of Row, Column or Group");const t=Sr(this).id,r=Sr(this).controller;if(!await r.getParent(t=>t.id===e.id))throw new Error("Cannot move the window to the selected parent, because this parent does not exist.");await r.moveWindowTo(t,e.id),await this.workspace.refreshReference()}async lock(e){let t;if("function"==typeof e){t=e({allowExtract:this.allowExtract,allowReorder:this.allowReorder,showCloseButton:this.showCloseButton})}else t=e;const r=void 0===t?void 0:bt.runWithException(t),o=Sr(this).id;await Sr(this).controller.lockWindow(o,r),await this.workspace.refreshReference()}async setSize(e){const t=kt.runWithException(e);if(!t.width&&!t.height)throw new Error("Expected either width or height to be passed.");const r=Sr(this).id,o=Sr(this).controller;await o.resizeItem(r,{height:t.height,width:t.width,relative:!1}),await this.workspace.refreshReference()}async onRemoved(e){O(e);const t=Sr(this).id,r={callback:async()=>{await this.workspace.refreshReference(),e()},action:"removed",eventType:"window",scope:"window"};return await Sr(this).controller.processLocalSubscription(r,t)}async onLockConfigurationChanged(e){O(e);const t=Sr(this).id,r={callback:async()=>{await this.workspace.refreshReference(),e({allowExtract:this.allowExtract,allowReorder:this.allowReorder,showCloseButton:this.showCloseButton})},action:"lock-configuration-changed",eventType:"window",scope:"window"};return await Sr(this).controller.processLocalSubscription(r,t)}}const Dr=new WeakMap,vr=e=>Dr.get(e).manager.getFrameData(e);class Cr{constructor(e){Dr.set(this,{manager:e})}async registerShortcut(e,t){v.runWithException(e),O(t);const r=vr(this).summary.id;return await vr(this).controller.registerShortcut(e,r,t)}get id(){return vr(this).summary.id}get isInitialized(){return vr(this).summary.isInitialized}getBounds(){const e=vr(this).summary.id;return vr(this).controller.getFrameBounds(e)}async resize(e){const t=Ue.runWithException(e),r=vr(this).summary.id;return vr(this).controller.resizeItem(r,t)}async move(e){const t=Ke.runWithException(e),r=vr(this).summary.id;return vr(this).controller.moveFrame(r,t)}focus(){const e=vr(this).summary.id;return vr(this).controller.focusItem(e)}async state(){if(!tr())throw new Error("State operations are not supported in IO Connect Browser");const e=vr(this).summary.id;return vr(this).controller.getFrameState(e)}setIcon(e){if(!tr())throw new Error("frame.setIcon() is not supported in IO Connect Browser");F.runWithException(e);const t=this.id;return vr(this).controller.setTaskbarIcon(e,t)}getIcon(){if(!tr())throw new Error("frame.getIcon() is not supported in IO Connect Browser");const e=this.id;return vr(this).controller.getTaskbarIcon(e)}isVisible(){if(!tr())throw new Error("frame.isVisible() is not supported in IO Connect Browser");const e=this.id;return vr(this).controller.getFrameVisibility(e)}async minimize(){if(!tr())throw new Error("State operations are not supported in IO Connect Browser");const e=vr(this).summary.id;return vr(this).controller.changeFrameState(e,"minimized")}async maximize(){if(!tr())throw new Error("State operations are not supported in IO Connect Browser");const e=vr(this).summary.id;return vr(this).controller.changeFrameState(e,"maximized")}async restore(){if(!tr())throw new Error("State operations are not supported in IO Connect Browser");const e=vr(this).summary.id;return vr(this).controller.changeFrameState(e,"normal")}close(e){const t=I(Qe).runWithException(e),r=vr(this).summary.id;return vr(this).controller.closeFrame(r,t)}snapshot(){const e=vr(this).summary.id;return vr(this).controller.getSnapshot(e,"frame")}async workspaces(){return vr(this).controller.getWorkspacesByFrameId(this.id)}async getConstraints(){const e=vr(this).controller,t=vr(this).summary.id;return e.getFrameConstraints(t)}async restoreWorkspace(e,t){v.runWithException(e);const r=ee.runWithException(t);return vr(this).controller.restoreWorkspace(e,r)}createWorkspace(e,t){const r=re.runWithException(e),o=H.runWithException(t);return vr(this).controller.createWorkspace(r,o)}async init(e){if(ae.runWithException(e),vr(this).summary.isInitialized)throw new Error("The frame has already been initialized");return vr(this).controller.initFrame(this.id,e)}async show(e){if(!tr())throw new Error("The show operation is not supported in IO Connect Browser");const t=Ft.runWithException(e);return vr(this).controller.showFrame(this.id,t)}async hide(){if(!tr())throw new Error("The hide operation is not supported in IO Connect Browser");return vr(this).controller.hideFrame(this.id)}async showDialog(e){if(!tr())throw new Error("The showModal operation is not supported in IO Connect Browser");return Nt.runWithException(e),vr(this).controller.showFrameDialog(this.id,e)}async onClosing(e){if(!tr())throw new Error("Frame closing operations are not supported in io.Connect Browser");O(e);return await vr(this).controller.registerFrameOnClosing(this.id,async()=>{let t=!1;return await e({prevent:()=>t=!0}),{prevent:t}})}async onClosed(e){O(e);const t=vr(this).summary.id,r={callback:t=>{e({frameId:t.frameSummary.id,frameBounds:t.frameBounds})},action:"closed",eventType:"frame",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onMaximized(e){O(e);const t=vr(this).summary.id,r={callback:()=>{e()},action:"maximized",eventType:"frame",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onMinimized(e){O(e);const t=vr(this).summary.id,r={callback:()=>{e()},action:"minimized",eventType:"frame",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onNormal(e){O(e);const t=vr(this).summary.id,r={callback:()=>{e()},action:"normal",eventType:"frame",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onWorkspaceOpened(e){O(e);const t=vr(this).summary.id,r={callback:async t=>{const r=await vr(this).controller.transformStreamPayloadToWorkspace(t);e(r)},action:"opened",eventType:"workspace",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onWorkspaceSelected(e){O(e);const t=vr(this).summary.id,r={callback:async t=>{const r=await vr(this).controller.getWorkspaceById(t.workspaceSummary.id);e(r)},action:"selected",eventType:"workspace",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onWorkspaceClosed(e){O(e);const t=vr(this).summary.id,r={callback:t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})},action:"closed",eventType:"workspace",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onWindowAdded(e){O(e);const t=vr(this).summary.id,r={callback:async t=>{const r=(await vr(this).controller.getParent(e=>e.id===t.windowSummary.parentId)).children.find(e=>"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex);e(r)},action:"added",eventType:"window",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onWindowRemoved(e){O(e);const t=vr(this).summary.id,r={callback:t=>{const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})},action:"removed",eventType:"window",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onWindowLoaded(e){O(e);const t=vr(this).summary.id,r={callback:async t=>{const r=(await vr(this).controller.getParent(e=>e.id===t.windowSummary.parentId)).children.find(e=>"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex);e(r)},action:"loaded",eventType:"window",scope:"frame"};return await vr(this).controller.processLocalSubscription(r,t)}async onInitializationRequested(e){return O(e),this.isInitialized||e(vr(this).summary.initializationContext),()=>{}}async onFocusChanged(e){O(e);const t=vr(this),{id:r}=t.summary,o={callback:t=>{e({isFocused:t.frameSummary.isFocused})},action:"focus",eventType:"frame",scope:"frame"};return await t.controller.processLocalSubscription(o,r)}}class Er{parentsData=new WeakMap;workspacesData=new WeakMap;windowsData=new WeakMap;framesData=new WeakMap;deleteData(e){e instanceof xr&&this.windowsData.delete(e),e instanceof Wr&&this.workspacesData.delete(e),(e instanceof hr||e instanceof pr||e instanceof fr)&&this.parentsData.delete(e),e instanceof Cr&&this.framesData.delete(e)}setWindowData(e,t){this.windowsData.set(e,t)}setWorkspaceData(e,t){this.workspacesData.set(e,t)}setParentData(e,t){this.parentsData.set(e,t)}setFrameData(e,t){this.framesData.set(e,t)}getWindowData(e){return this.windowsData.get(e)}getWorkspaceData(e){return this.workspacesData.get(e)}getParentData(e){return this.parentsData.get(e)}getFrameData(e){return this.framesData.get(e)}remapChild(e,t){if(e instanceof xr){const r=this.windowsData.get(e);r.parent=t.parent||r.parent,r.config=t.config||r.config}if(e instanceof hr||e instanceof pr||e instanceof fr){const r=this.parentsData.get(e);r.parent=t.parent||r.parent,r.config=t.config||r.config,r.children=t.children||r.children}}remapFrame(e,t){this.framesData.get(e).summary=t}remapWorkspace(e,t){const r=this.workspacesData.get(e);r.frame=t.frame||r.frame,r.config=t.config||r.config,r.children=t.children||r.children}}const Br=new WeakMap,Tr=(e,t)=>{const r=Br.get(e).manager;return t instanceof Wr?r.getWorkspaceData(t):Br.get(e).manager.getParentData(t)};class Mr{frameId;workspaceId;positionIndex;constructor(e){Br.set(this,{manager:e})}getId(e){return Tr(this,e).id}getPositionIndex(e){return Tr(this,e).config.positionIndex}getWorkspaceId(e){const t=Tr(this,e);return t.config.workspaceId||t.workspace.id}getFrameId(e){return Tr(this,e).frame.id}getAllChildren(e,t){O(t,!0);const r=Tr(this,e).children;return void 0===t?r:r.filter(t)}getMyParent(e){return e instanceof Wr?e:Tr(this,e).parent}getMyFrame(e){return Tr(this,e).frame}getMyWorkspace(e){return e instanceof Wr?e:Tr(this,e).workspace}async addWindow(e,t,r){if(!t.appName&&!t.windowId)throw new Error("The window definition should contain either an appName or a windowId");const o=V.runWithException(t),n=Tr(this,e).controller,i=await n.add("window",Tr(this,e).id,r,o);if(e instanceof Wr)return await e.refreshReference(),e.getWindow(e=>e.elementId===i.itemId);const a=this.getMyWorkspace(e);return await a.refreshReference(),a.getWindow(e=>e.elementId===i.itemId)}async addParent(e,t,r,o){const n=this.transformDefinition(t,o),i=Tr(this,e).controller,a=(await i.add("container",Tr(this,e).id,r,n)).itemId;if(e instanceof Wr)return await e.refreshReference(),e.getBox(e=>e.id===a);const s=this.getMyWorkspace(e);return await s.refreshReference(),s.getBox(e=>e.id===a)}async removeChild(e,t){O(t);const r=this.getAllChildren(e).find(t);r&&(await r.close(),e instanceof Wr?await e.refreshReference():await this.getMyWorkspace(e).refreshReference())}async maximize(e){const{controller:t,id:r}=Tr(this,e);await t.maximizeItem(r),await this.getMyWorkspace(e.parent).refreshReference()}async restore(e){const{controller:t,id:r}=Tr(this,e);await t.restoreItem(r),await this.getMyWorkspace(e.parent).refreshReference()}async close(e){const t=Tr(this,e),r=Tr(this,e).controller;await r.closeItem(t.id),await this.getMyWorkspace(t.parent).refreshReference()}async lockContainer(e,t){const r=Tr(this,e),o=Tr(this,e).controller;await o.lockContainer(r.id,e.type,t),await this.getMyWorkspace(r.parent).refreshReference()}getAllowDrop(e){return Tr(this,e).config.allowDrop}getAllowDropLeft(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Property allowDropLeft is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropLeft}getAllowDropRight(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Property allowDropRight is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropRight}getAllowDropTop(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Property allowDropTop is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropTop}getAllowDropBottom(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Property allowDropBottom is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropBottom}getAllowDropHeader(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Property allowDropHeader is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropHeader}getAllowSplitters(e){const t=Tr(this,e);if("group"===t.type)throw new Error(`Cannot get allow splitters from private data ${t.type}`);return t.config.allowSplitters}getAllowExtract(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Cannot get allow extract from private data ${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.allowExtract}getAllowReorder(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Cannot get allow extract from private data ${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.allowReorder}getShowMaximizeButton(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Cannot get show maximize button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showMaximizeButton}getShowEjectButton(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Cannot get show eject button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showEjectButton}getShowAddWindowButton(e){const t=Tr(this,e);if("group"!==t.type)throw new Error(`Cannot get add window button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showAddWindowButton}getMinWidth(e){return Tr(this,e).config.minWidth}getMaxWidth(e){return Tr(this,e).config.maxWidth}getMinHeight(e){return Tr(this,e).config.minHeight}getMaxHeight(e){return Tr(this,e).config.maxHeight}getWidthInPx(e){return Tr(this,e).config.widthInPx}getHeightInPx(e){return Tr(this,e).config.heightInPx}getIsPinned(e){return Tr(this,e).config.isPinned}getIsMaximized(e){return Tr(this,e).config.isMaximized}getMaximizationBoundary(e){return Tr(this,e).config.maximizationBoundary}async setHeight(e,t){const r=Tr(this,e),{controller:o,id:n}=r;await o.resizeItem(n,{height:t}),await this.getMyWorkspace(r.parent).refreshReference()}async setWidth(e,t){const r=Tr(this,e),{controller:o,id:n}=r;await o.resizeItem(n,{width:t}),await this.getMyWorkspace(r.parent).refreshReference()}async setSize(e,t,r){const o=Tr(this,e),{controller:n,id:i}=o;await n.resizeItem(i,{width:t,height:r}),await this.getMyWorkspace(o.parent).refreshReference()}async setMaximizationBoundary(e,t){const r=Tr(this,e),{controller:o,id:n}=r;await o.setMaximizationBoundary(n,t),await this.getMyWorkspace(r.parent).refreshReference()}async bundleTo(e,t){const r=Tr(this,e),{controller:o,id:n}=r;await o.bundleItemTo(t,n)}async processLocalSubscription(e,t){return Tr(this,e).controller.processLocalSubscription(t,this.getId(e))}transformDefinition(e,t){let r;return void 0===t?r={type:e,children:[]}:t instanceof ir?r=t.serialize():(void 0===t.type&&(t.type=e),r=X.runWithException(t),r.children=r.children||[]),r}}class Fr{ioc;windows;contexts;layouts;constructor(e,t,r,o){this.ioc=e,this.windows=t,this.contexts=r,this.layouts=o}get bridge(){return this.ioc.bridge}get privateDataManager(){return this.ioc.privateDataManager}checkIsWindowLoaded(e){return!!e&&this.windows.list().some(t=>t.id===e)}async createWorkspace(e){const t=await this.bridge.send(Yt.createWorkspace.name,e),r={summary:t.frameSummary},o={frame:this.ioc.getModel("frame",r),snapshot:t};return this.ioc.getModel("workspace",o)}async createEmptyFrame(e){const t={summary:await this.bridge.send(Yt.createFrame.name,e)};return this.ioc.getModel("frame",t)}async initFrame(e,t){await this.bridge.send(Yt.initFrame.name,{frameId:e,...t})}async restoreWorkspace(e,t){const r=await this.bridge.send(Yt.openWorkspace.name,{name:e,restoreOptions:t}),o={summary:await this.bridge.send(Yt.getFrameSummary.name,{itemId:r.config.frameId})},n={frame:this.ioc.getModel("frame",o),snapshot:r};return this.ioc.getModel("workspace",n)}async add(e,t,r,o){let n;const i={definition:o,parentId:t,parentType:r};if("window"===e)n=Yt.addWindow.name;else{if("container"!==e)throw new Error(`Unrecognized add type: ${e}`);n=Yt.addContainer.name}return await this.bridge.send(n,i)}async getFrame(e){const t={summary:await this.bridge.send(Yt.getFrameSummary.name,{itemId:e})};return this.ioc.getModel("frame",t)}getFrames(e,t){return e.reduce((e,r)=>{const o={summary:r},n=this.ioc.getModel("frame",o);return t&&!t(n)||e.push(n),e},[])}getAllWorkspaceSummaries(...e){return e.reduce((e,t)=>(e.push(...t.summaries),e),[]).map(e=>Object.assign({},{id:e.id,width:e.config.widthInPx,height:e.config.heightInPx},e.config))}handleOnSaved(e){const t=t=>{"Workspace"===t.type&&e(t)},r=this.layouts.onAdded(t),o=this.layouts.onChanged(t);return()=>{r(),o()}}handleOnRemoved(e){return this.layouts.onRemoved(t=>{"Workspace"===t.type&&e(t)})}async importLayouts(e,t){await this.layouts.import(e,t)}async transformStreamPayloadToWorkspace(e){const t={summary:e.frameSummary},r={frame:this.ioc.getModel("frame",t),snapshot:e.workspaceSnapshot||await this.bridge.send(Yt.getWorkspaceSnapshot.name,{itemId:e.workspaceSummary.id})};return this.ioc.getModel("workspace",r)}async fetchWorkspace(e){const t=await this.bridge.send(Yt.getWorkspaceSnapshot.name,{itemId:e}),r={summary:t.frameSummary},o={frame:this.ioc.getModel("frame",r),snapshot:t};return this.ioc.getModel("workspace",o)}async bundleWorkspaceTo(e,t){await this.bridge.send(Yt.bundleWorkspace.name,{type:e,workspaceId:t})}async bundleItemTo(e,t){if(!await this.isOperationSupported(Yt.bundleItem.name))throw new Error(`Operation ${Yt.bundleItem.name} is not supported. Ensure that you are running the latest version of all packages`);await this.bridge.send(Yt.bundleItem.name,{type:e,itemId:t})}async getTaskbarIcon(e){return await this.bridge.send(Yt.getTaskbarIcon.name,{frameId:e})}async setTaskbarIcon(e,t){await this.bridge.send(Yt.setTaskbarIcon.name,{icon:e,frameId:t})}getWorkspaceContext(e){const t=`___workspace___${e}`;return this.contexts.get(t)}setWorkspaceContext(e,t){const r=`___workspace___${e}`;return this.contexts.set(r,t)}updateWorkspaceContext(e,t){const r=`___workspace___${e}`;return this.contexts.update(r,t)}subscribeWorkspaceContextUpdated(e,t){const r=`___workspace___${e}`;return this.contexts.subscribe(r,t)}async restoreItem(e){await this.bridge.send(Yt.restoreItem.name,{itemId:e})}async maximizeItem(e){await this.bridge.send(Yt.maximizeItem.name,{itemId:e})}async focusItem(e){await this.bridge.send(Yt.focusItem.name,{itemId:e})}async closeWorkspace(e){await this.bridge.send(Yt.closeWorkspace.name,{itemId:e})}async closeItem(e){await this.bridge.send(Yt.closeItem.name,{itemId:e})}async closeFrame(e,t){await this.bridge.send(Yt.closeItem.name,{itemId:e,closeOptions:t})}async resizeItem(e,t){await this.bridge.send(Yt.resizeItem.name,Object.assign({},{itemId:e},t))}async setMaximizationBoundary(e,t){await this.bridge.send(Yt.setMaximizationBoundary.name,Object.assign({},{itemId:e},t))}async showWorkspaceLoadingAnimation(e){await this.bridge.send(Yt.showLoadingAnimation.name,{itemId:e,type:"workspace"})}async hideWorkspaceLoadingAnimation(e){await this.bridge.send(Yt.hideLoadingAnimation.name,{itemId:e,type:"workspace"})}async setWindowDragMode(e,t){await this.bridge.send(Yt.setWindowDragMode.name,{itemId:e,dragMode:t})}async moveFrame(e,t){await this.bridge.send(Yt.moveFrame.name,Object.assign({},{itemId:e},t))}getGDWindow(e){return this.windows.list().find(t=>t.id===e)}async forceLoadWindow(e){return(await this.bridge.send(Yt.forceLoadWindow.name,{itemId:e})).windowId}async ejectWindow(e,t){return await this.bridge.send(Yt.ejectWindow.name,{itemId:e,windowId:t})}async moveWindowTo(e,t){await this.bridge.send(Yt.moveWindowTo.name,{itemId:e,containerId:t})}async getSnapshot(e,t){let r;return"workspace"===t?r=await this.bridge.send(Yt.getWorkspaceSnapshot.name,{itemId:e}):"frame"===t&&(r=await this.bridge.send(Yt.getFrameSnapshot.name,{itemId:e})),r}async setItemTitle(e,t){await this.bridge.send(Yt.setItemTitle.name,{itemId:e,title:t})}refreshChildren(e){const{parent:t,children:r,existingChildren:o,workspace:n}=e;if(t instanceof xr||"window"===t.type)return;const i=r.map(e=>{let r=o.find(t=>"window"===t.type?t.elementId===e.id:t.id===e.id);if(r)this.privateDataManager.remapChild(r,{parent:t,children:[],config:e.config});else{let o;o="window"===e.type?{id:e.id,parent:t,frame:n.frame,workspace:n,config:e.config}:{id:e.id,parent:t,frame:n.frame,workspace:n,config:e.config,children:[]},r=this.ioc.getModel(e.type,o)}return"window"!==e.type&&this.refreshChildren({workspace:n,existingChildren:o,children:e.children,parent:r}),r});return t instanceof Wr||this.privateDataManager.remapChild(t,{children:i}),i}iterateFindChild(e,t){let r=e.find(e=>t(e));return r||(e.some(e=>!(e instanceof xr)&&(r=this.iterateFindChild(e.children,t),!!r||void 0)),r)}iterateFilterChildren(e,t){const r=e.filter(e=>t(e)),o=e.reduce((e,r)=>(r instanceof xr||e.push(...this.iterateFilterChildren(r.children,t)),e),[]);return r.push(...o),r}notifyWindowAdded(e){return new Promise(t=>{if(this.windows.list().some(t=>t.id===e))return t();const r=this.windows.onWindowAdded(o=>{o.id===e&&(r&&r(),t())})})}async hibernateWorkspace(e){await this.bridge.send(Yt.hibernateWorkspace.name,{workspaceId:e})}async resumeWorkspace(e){await this.bridge.send(Yt.resumeWorkspace.name,{workspaceId:e})}async lockWorkspace(e,t){await this.bridge.send(Yt.lockWorkspace.name,{workspaceId:e,config:t})}async lockWindow(e,t){await this.bridge.send(Yt.lockWindow.name,{windowPlacementId:e,config:t})}async lockContainer(e,t,r){await this.bridge.send(Yt.lockContainer.name,{itemId:e,type:t,config:r})}async pinWorkspace(e,t){await this.bridge.send(Yt.pinWorkspace.name,{workspaceId:e,icon:t})}async unpinWorkspace(e){await this.bridge.send(Yt.unpinWorkspace.name,{workspaceId:e})}async getWorkspaceIcon(e){return(await this.bridge.send(Yt.getWorkspaceIcon.name,{workspaceId:e})).icon}setWorkspaceIcon(e,t){return this.bridge.send(Yt.setWorkspaceIcon.name,{workspaceId:e,icon:t})}async getPlatformFrameId(){try{return await this.bridge.send(Yt.getPlatformFrameId.name,{})}catch(e){return{}}}async setLoadingStrategy(e,t){return await this.isOperationSupported(Yt.setLoadingStrategy.name),this.bridge.send(Yt.setLoadingStrategy.name,{itemId:e,strategy:t})}async showFrame(e,t){const r={frameId:e,isVisible:!0,...t};return this.bridge.send(Yt.changeFrameVisibility.name,r)}async hideFrame(e){return this.bridge.send(Yt.changeFrameVisibility.name,{frameId:e,isVisible:!1})}async getFrameVisibility(e){return(await this.bridge.send(Yt.getFrameVisibility.name,{itemId:e})).isVisible}async showFrameDialog(e,t){return await this.bridge.send(Yt.showFrameDialog.name,{frameId:e,options:t})}async isOperationSupported(e){return tr()?{isSupported:!0}:await this.bridge.send(Yt.operationCheck.name,{operation:e})}}class Rr{bridge;base;shortcutsController;closingController;constructor(e,t,r,o){this.bridge=e,this.base=t,this.shortcutsController=r,this.closingController=o}setTaskbarIcon(e,t){return this.base.setTaskbarIcon(e,t)}getTaskbarIcon(e){return this.base.getTaskbarIcon(e)}checkIsWindowLoaded(e){return this.base.checkIsWindowLoaded(e)}async checkIsInSwimlane(e){return(await this.bridge.send(Yt.isWindowInWorkspace.name,{itemId:e})).inWorkspace}async createWorkspace(e,t){const r=Object.assign({},e,{saveConfig:t});return await this.base.createWorkspace(r)}async createEmptyFrame(e){return await this.base.createEmptyFrame(e)}async initFrame(e,t){return this.base.initFrame(e,t)}async restoreWorkspace(e,t){if(!(await this.getLayoutSummaries()).some(t=>t.name===e))throw new Error(`This layout: ${e} cannot be restored, because it doesn't exist.`);if(t?.frameId){if(!(await this.bridge.send(Yt.getAllFramesSummaries.name)).summaries.some(e=>e.id===t.frameId))throw new Error(`Cannot reuse the frame with id: ${t.frameId}, because there is no frame with that ID found`)}return await this.base.restoreWorkspace(e,t)}async add(e,t,r,o){return await this.base.add(e,t,r,o)}processLocalSubscription(e,t){return tr()?this.handleEnterpriseLocalSubscription(e,t):this.handleCoreLocalSubscription(e,t)}processGlobalSubscription(e,t,r){return tr()?this.handleEnterpriseGlobalSubscription(e,t,r):this.handleCoreGlobalSubscription(e,t,r)}async getFrame(e){if(e.windowId)return await this.base.getFrame(e.windowId);if(e.predicate)return(await this.getFrames(e.predicate))[0];throw new Error(`The provided selector is not valid: ${JSON.stringify(e)}`)}async getFrames(e){const t=await this.bridge.send(Yt.getAllFramesSummaries.name);return this.base.getFrames(t.summaries,e)}getWorkspaceById(e){return this.base.fetchWorkspace(e)}async getWorkspaceByWindowId(e){return tr()?this.base.fetchWorkspace(e):(await this.getWorkspaces(t=>!!t.getWindow(t=>t.id===e)))[0]}transformStreamPayloadToWorkspace(e){return this.base.transformStreamPayloadToWorkspace(e)}async getWorkspace(e){let t;return await this.iterateWorkspaces((r,o)=>{e(r)&&(t=r,o())}),t}async getWorkspaces(e){const t=[];return await this.iterateWorkspaces(r=>{e&&!e(r)||t.push(r)}),t}async getWorkspacesByFrameId(e){const t=(await this.getAllWorkspaceSummaries()).filter(t=>t.frameId===e);return await Promise.all(t.map(e=>this.base.fetchWorkspace(e.id)))}async isLastWorkspaceInFrame(e,t){const r=(await this.getAllWorkspaceSummaries()).filter(e=>e.frameId===t);return 1===r.length&&r[0].id===e}async getAllWorkspaceSummaries(){const e=await this.bridge.send(Yt.getAllWorkspacesSummaries.name,{});return this.base.getAllWorkspaceSummaries(e)}async getWindow(e){let t;return await this.iterateWorkspaces((r,o)=>{const n=r.getWindow(e);n&&(t=n,o())}),t}async getParent(e){let t;return await this.iterateWorkspaces((r,o)=>{const n=r.getBox(e);n&&(t=n,o())}),t}async getLayoutSummaries(){return(await this.bridge.send(Yt.getAllLayoutsSummaries.name)).summaries}async deleteLayout(e){await this.bridge.send(Yt.deleteLayout.name,{name:e})}async exportLayout(e){return(await this.bridge.send(Yt.exportAllLayouts.name)).layouts.reduce((t,r)=>(e&&!e(r)||t.push(r),t),[])}async saveLayout(e){return await this.bridge.send(Yt.saveLayout.name,e)}async importLayouts(e,t){if(tr())try{await this.bridge.send(Yt.importLayouts.name,{layouts:e,mode:t})}catch(r){await Promise.all(e.map(e=>this.bridge.send(Yt.importLayout.name,{layout:e,mode:t})))}else await this.base.importLayouts(e,t)}handleOnSaved(e){return this.base.handleOnSaved(e)}handleOnRemoved(e){return this.base.handleOnRemoved(e)}async bundleWorkspaceTo(e,t){return await this.base.bundleWorkspaceTo(e,t)}async bundleItemTo(e,t){return await this.base.bundleItemTo(e,t)}getWorkspaceContext(e){return this.base.getWorkspaceContext(e)}setWorkspaceContext(e,t){return this.base.setWorkspaceContext(e,t)}updateWorkspaceContext(e,t){return this.base.updateWorkspaceContext(e,t)}subscribeWorkspaceContextUpdated(e,t){return this.base.subscribeWorkspaceContextUpdated(e,t)}async restoreItem(e){return await this.base.restoreItem(e)}async maximizeItem(e){return await this.base.maximizeItem(e)}async focusItem(e){return await this.base.focusItem(e)}async changeFrameState(e,t){await this.bridge.send(Yt.changeFrameState.name,{frameId:e,requestedState:t})}async getFrameBounds(e){return(await this.bridge.send(Yt.getFrameBounds.name,{itemId:e})).bounds}async getFrameState(e){return(await this.bridge.send(Yt.getFrameState.name,{itemId:e})).state}async closeWorkspace(e,t){if(tr())return await this.closeItem(e);let r=!1;try{const{isSupported:e}=await this.base.isOperationSupported(Yt.closeWorkspace.name);r=e}catch(e){r=!1}return r?await this.base.closeWorkspace(e):await this.legacyCloseWorkspace(e,t)}async closeItem(e){return await this.base.closeItem(e)}async closeFrame(e,t){return await this.base.closeFrame(e,t)}async resizeItem(e,t){return await this.base.resizeItem(e,t)}async setMaximizationBoundary(e,t){return await this.base.setMaximizationBoundary(e,t)}async showWorkspaceLoadingAnimation(e){return await this.base.showWorkspaceLoadingAnimation(e)}async hideWorkspaceLoadingAnimation(e){return await this.base.hideWorkspaceLoadingAnimation(e)}async setWindowDragMode(e,t){return await this.base.setWindowDragMode(e,t)}async moveFrame(e,t){return await this.base.moveFrame(e,t)}getGDWindow(e){return this.base.getGDWindow(e)}async forceLoadWindow(e){const t=await this.base.forceLoadWindow(e);return await this.base.notifyWindowAdded(t),t}async ejectWindow(e,t){const r=(await this.base.ejectWindow(e,t)).windowId;return await this.base.notifyWindowAdded(r),r}async moveWindowTo(e,t){return await this.base.moveWindowTo(e,t)}async getSnapshot(e,t){return await this.base.getSnapshot(e,t)}async setItemTitle(e,t){return await this.base.setItemTitle(e,t)}flatChildren(e){return e.reduce((e,t)=>(e.push(t),"window"!==t.type&&e.push(...this.flatChildren(t.children)),e),[])}refreshChildren(e){return this.base.refreshChildren(e)}iterateFindChild(e,t){return this.base.iterateFindChild(e,t)}iterateFilterChildren(e,t){return this.base.iterateFilterChildren(e,t)}hibernateWorkspace(e){return this.base.hibernateWorkspace(e)}resumeWorkspace(e){return this.base.resumeWorkspace(e)}lockWorkspace(e,t){return this.base.lockWorkspace(e,t)}lockWindow(e,t){return this.base.lockWindow(e,t)}lockContainer(e,t,r){return this.base.lockContainer(e,t,r)}pinWorkspace(e,t){return this.base.pinWorkspace(e,t)}unpinWorkspace(e){return this.base.unpinWorkspace(e)}getWorkspaceIcon(e){return this.base.getWorkspaceIcon(e)}setWorkspaceIcon(e,t){return this.base.setWorkspaceIcon(e,t)}async getFrameConstraints(e){const t=await this.getSnapshot(e,"frame");return{minWidth:t.config.minWidth,maxWidth:t.config.maxWidth,minHeight:t.config.minHeight,maxHeight:t.config.maxHeight}}registerShortcut(e,t,r){return this.shortcutsController.registerShortcut(e,t,r)}getPlatformFrameId(){return this.base.getPlatformFrameId()}setLoadingStrategy(e,t){return this.base.setLoadingStrategy(e,t)}registerFrameOnClosing(e,t){return this.closingController.registerFrameOnClosing(e,t)}async showFrame(e,t){return this.base.showFrame(e,t)}async hideFrame(e){return this.base.hideFrame(e)}async getFrameVisibility(e){return this.base.getFrameVisibility(e)}async showFrameDialog(e,t){return this.base.showFrameDialog(e,t)}async handleCoreLocalSubscription(e,t){if(await this.bridge.createCoreEventSubscription(),e.scopeId=e.scopeId||t,"window"===e.eventType&&"loaded"===e.action){const t=e.callback,r=async e=>{await this.base.notifyWindowAdded(e.windowSummary.config.windowId),t(e)};e.callback=r}return this.bridge.handleCoreSubscription(e)}handleEnterpriseLocalSubscription(e,t){if(e.scopeId=e.scopeId||t,"window"===e.eventType&&"loaded"===e.action){const t=e.callback,r=async e=>{await this.base.notifyWindowAdded(e.windowSummary.config.windowId),t(e)};e.callback=r}return this.bridge.subscribe(e)}async handleCoreGlobalSubscription(e,t,r){await this.bridge.createCoreEventSubscription();const o={eventType:t,callback:e,action:r,scope:"global"};if("window"===t&&"loaded"===r){const t=async t=>{await this.base.notifyWindowAdded(t.windowSummary.config.windowId),e(t)};o.callback=t}return this.bridge.handleCoreSubscription(o)}handleEnterpriseGlobalSubscription(e,t,r){const o={eventType:t,callback:e,action:r,scope:"global"};if("window"===t&&"loaded"===r){const t=async t=>{await this.base.notifyWindowAdded(t.windowSummary.config.windowId),e(t)};o.callback=t}return this.bridge.subscribe(o)}async iterateWorkspaces(e){let t=!1;const r=()=>{t=!0},o=await this.getAllWorkspaceSummaries();for(const n of o){if(t)return;e(await this.base.fetchWorkspace(n.id),r)}}async legacyCloseWorkspace(e,t){const r=await this.isLastWorkspaceInFrame(e,t),o=(await this.getPlatformFrameId()).id;if(r&&o!==t)return await this.closeFrame(t,{});await this.closeItem(e)}}class Lr{bridge;_shortcuts=r();constructor(e){this.bridge=e,this.bridge.onOperation(e=>{if(e.operation===Xt.shortcutClicked.name){const t=e.data;this._shortcuts.execute(`${t.frameId}-${t.shortcut}`)}})}async registerShortcut(e,t,r){await this.bridge.send(Yt.registerShortcut.name,{shortcut:e,frameId:t});const o=this._shortcuts.add(`${t}-${e}`,r);return()=>{o(),this.bridge.send(Yt.unregisterShortcut.name,{shortcut:e,frameId:t})}}}class Ar{bridge;registry=r();constructor(e){this.bridge=e,this.subscribeToFrameClosing()}async registerFrameOnClosing(e,t){return await this.bridge.send(Yt.subscribeToFrameClosing.name,{itemId:e}),this.registry.add(e,t)}subscribeToFrameClosing(){this.bridge.onOperationWithResponse(async e=>{if(e.operation!==Xt.frameClosing.name)return;const t=e.data,r=await Promise.all(this.registry.execute(t.frameId));return this.aggregateFrameClosingResult(r)})}aggregateFrameClosingResult(e){return{prevent:e.some(e=>e?.prevent)}}}class Pr{agm;windows;layouts;contexts;_controllerInstance;_bridgeInstance;_transportInstance;_privateDataManagerInstance;_parentBaseInstance;_baseController;_shortcutsController;_closingController;constructor(e,t,r,o){this.agm=e,this.windows=t,this.layouts=r,this.contexts=o}get baseController(){return this._baseController||(this._baseController=new Fr(this,this.windows,this.contexts,this.layouts)),this._baseController}get controller(){return this._controllerInstance||(this._controllerInstance=new Rr(this.bridge,this.baseController,this.shortcutsController,this.closingController)),this._controllerInstance}get shortcutsController(){return this._shortcutsController||(this._shortcutsController=new Lr(this.bridge)),this._shortcutsController}get closingController(){return this._closingController||(this._closingController=new Ar(this.bridge)),this._closingController}get bridge(){return this._bridgeInstance||(this._bridgeInstance=new er(this.transport,r())),this._bridgeInstance}get transport(){return this._transportInstance||(this._transportInstance=new or(this.agm,r())),this._transportInstance}get privateDataManager(){return this._privateDataManagerInstance||(this._privateDataManagerInstance=new Er),this._privateDataManagerInstance}get parentBase(){return this._parentBaseInstance||(this._parentBaseInstance=new Mr(this.privateDataManager)),this._parentBaseInstance}async initiate(e){await this.transport.initiate(e)}getModel(e,t){switch(e){case"frame":{const e=new Cr(this.privateDataManager),{summary:r}=t,o={summary:r,controller:this.controller};return this.privateDataManager.setFrameData(e,o),e}case"window":{const{id:e,parent:r,frame:o,workspace:n,config:i}=t,a={type:"window",controller:this.controller,config:i,id:e,parent:r,frame:o,workspace:n},s=new xr(this.privateDataManager);return this.privateDataManager.setWindowData(s,a),s}case"row":case"column":case"group":{const{id:r,children:o,parent:n,frame:i,workspace:a,config:s}=t,c="column"===e?new pr(this.parentBase):"row"===e?new hr(this.parentBase):new fr(this.parentBase),d=this.buildChildren(o,i,a,c),l={id:r,parent:n,frame:i,workspace:a,config:s,type:e,controller:this.controller,children:d};return this.privateDataManager.setParentData(c,l),c}case"workspace":{const{snapshot:e,frame:r}=t,o=new Wr(this.privateDataManager),n=this.buildChildren(e.children,r,o,o),i={id:e.id,type:"workspace",config:e.config,base:this.parentBase,controller:this.controller,children:n,frame:r,ioc:this};return this.privateDataManager.setWorkspaceData(o,i),o}default:throw new Error(`Unrecognized type: ${e}`)}}getBuilder(e){e.definition=e.definition||{},Array.isArray(e.definition.children)||(e.definition.children=[]);const t=new ar(this.getBuilder.bind(this));switch(e.type){case"workspace":return new cr(e.definition,t,this.controller);case"row":case"column":case"group":return e.definition.type=e.type,new ir(e.definition,t);default:throw new Error(`Unexpected Builder creation error, provided config: ${JSON.stringify(e)}`)}}buildChildren(e,t,r,o){return e.map(e=>{switch(e.type){case"window":return this.getModel("window",{id:e.id,config:e.config,frame:t,workspace:r,parent:o});case"column":case"row":case"group":return this.getModel(e.type,{id:e.id,config:e.config,children:e.children,frame:t,workspace:r,parent:o});default:throw new Error(`Unsupported child type: ${e.type}`)}})}}const zr=async e=>{const t=new Pr(e.agm,e.windows,e.layouts,e.contexts),r=e.interop.instance.windowId;await t.initiate(r),e.workspaces=((e,t)=>{const r=t.controller,o=async e=>(O(e,!0),r.getFrames(e)),n=async e=>(O(e),await r.processGlobalSubscription(r=>{const o={summary:r.frameSummary},n=t.getModel("frame",o);e(n)},"frame","opened"));return{inWorkspace:()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my frame, because my id is undefined.");return r.checkIsInSwimlane(t)},getBuilder:e=>{const r=ce.runWithException(e);return t.getBuilder(r)},getMyFrame:async()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my frame, because my id is undefined.");if(!await r.checkIsInSwimlane(t))throw new Error("Cannot fetch your frame, because this window is not in a workspace");return r.getFrame({windowId:t})},getFrame:async e=>(O(e),r.getFrame({predicate:e})),getAllFrames:o,getAllWorkspacesSummaries:()=>r.getAllWorkspaceSummaries(),getMyWorkspace:async()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my workspace, because my id is undefined.");if(!await r.checkIsInSwimlane(t))throw new Error("Cannot fetch your workspace, because this window is not in a workspace");return await r.getWorkspaceByWindowId(t)},getWorkspace:async e=>(O(e),(await r.getWorkspaces(e))[0]),getWorkspaceById:async e=>(v.runWithException(e),r.getWorkspaceById(e)),getAllWorkspaces:e=>(O(e,!0),r.getWorkspaces(e)),getWindow:async e=>(O(e),r.getWindow(e)),getBox:async e=>(O(e),r.getParent(e)),restoreWorkspace:async(e,t)=>{v.runWithException(e);const o=ee.runWithException(t);return r.restoreWorkspace(e,o)},createWorkspace:async(e,t)=>{const o=re.runWithException(e),n=H.runWithException(t);return r.createWorkspace(o,n)},createEmptyFrame:async e=>{const t=ie.runWithException(e);return r.createEmptyFrame(t??{})},waitForFrame:async e=>(v.runWithException(e),new Promise((t,r)=>{let i=()=>{};n(r=>{r.id===e&&(t(r),i())}).then(e=>(i=e,o())).then(r=>{const o=r.find(t=>t.id===e);o&&(t(o),i())}).catch(r)})),layouts:{getSummaries:()=>r.getLayoutSummaries(),delete:async e=>(v.runWithException(e),r.deleteLayout(e)),export:async e=>(O(e,!0),r.exportLayout(e)),import:async(e,t="replace")=>{if(!Array.isArray(e))throw new Error(`The provided layouts argument is not an array: ${JSON.stringify(e)}`);return e.forEach(e=>Ee.runWithException(e)),r.importLayouts(e,t)},save:async e=>{const t=gt.runWithException(e);return r.saveLayout(t)},onSaved:async e=>(O(e),r.handleOnSaved(e)),onRemoved:async e=>(O(e),r.handleOnRemoved(e))},onFrameOpened:n,onFrameClosed:async e=>(O(e),await r.processGlobalSubscription(t=>{e({frameId:t.frameSummary.id,frameBounds:t.frameBounds})},"frame","closed")),onWorkspaceOpened:async e=>(O(e),await r.processGlobalSubscription(async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)},"workspace","opened")),onWorkspaceClosed:async e=>(O(e),await r.processGlobalSubscription(t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})},"workspace","closed")),onWorkspaceHibernated:async e=>(O(e),await r.processGlobalSubscription(async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)},"workspace","hibernated")),onWorkspaceResumed:async e=>(O(e),await r.processGlobalSubscription(async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)},"workspace","resumed")),onWindowAdded:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox(e=>e.id===o.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===o.windowSummary.itemId);e(s)},"window","added")),onWindowLoaded:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getWindow(e=>e.id&&e.id===o.windowSummary.config.windowId);e(s)},"window","loaded")),onWindowRemoved:async e=>(O(e),await r.processGlobalSubscription(t=>{const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})},"window","removed")),onWindowMaximized:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox(e=>e.id===o.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===o.windowSummary.itemId);e(s)},"window","maximized")),onWindowRestored:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox(e=>e.id===o.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===o.windowSummary.itemId);e(s)},"window","restored")),onWindowSelected:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox(e=>e.id===o.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===o.windowSummary.itemId);e(s)},"window","selected")),version:"4.1.2"}})(e,t)};return"undefined"!=typeof window&&(window.IOWorkspaces=zr),zr});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).workspaces=e.workspaces||{},e.workspaces.min=t())}(this,function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){if(e&&e.errorHandling&&"function"!=typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"==typeof e.errorHandling&&e.errorHandling,r={};function o(r,o){var n=r instanceof Error?r:new Error(r);if(t)t(n);else{var i='[ERROR] callback-registry: User callback for key "'+o+'" failed: '+n.stack;if(e)switch(e.errorHandling){case"log":return console.error(i);case"silent":return;case"throw":throw new Error(i)}console.error(i)}}return{add:function(e,t,n){var i=r[e];return i||(i=[],r[e]=i),i.push(t),n&&setTimeout(function(){n.forEach(function(n){var i;if(null===(i=r[e])||void 0===i?void 0:i.includes(t))try{Array.isArray(n)?t.apply(void 0,n):t.apply(void 0,[n])}catch(t){o(t,e)}})},0),function(){var o=r[e];o&&(0===(o=o.reduce(function(e,r,o){return r===t&&e.length===o||e.push(r),e},[])).length?delete r[e]:r[e]=o)}},execute:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=r[e];if(!i||0===i.length)return[];var a=[];return i.forEach(function(r){try{var n=r.apply(void 0,t);a.push(n)}catch(t){a.push(void 0),o(t,e)}}),a},clear:function(){r={}},clearKey:function(e){r[e]&&delete r[e]}}}t.default=t;var r=e(t),o=function(e){return{ok:!0,result:e}},n=function(e){return{ok:!1,error:e}},i=function(e,t,r){return!1===t.ok?t:!1===r.ok?r:o(e(t.result,r.result))},a=function(e,t){return!0===t.ok?t:n(e(t.error))},s=function(){return s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},s.apply(this,arguments)};function c(e,t){if(e===t)return!0;if(null===e&&null===t)return!0;if(typeof e!=typeof t)return!1;if("object"==typeof e){if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!c(e[r],t[r]))return!1;return!0}var o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(r=0;r<o.length;r++){if(!t.hasOwnProperty(o[r]))return!1;if(!c(e[o[r]],t[o[r]]))return!1}return!0}}var d=function(e){return Array.isArray(e)},l=function(e){return"object"==typeof e&&null!==e&&!d(e)},h=function(e,t){return"expected "+e+", got "+function(e){switch(typeof e){case"string":return"a string";case"number":return"a number";case"boolean":return"a boolean";case"undefined":return"undefined";case"object":return e instanceof Array?"an array":null===e?"null":"an object";default:return JSON.stringify(e)}}(t)},u=function(e){return e.map(function(e){return"string"==typeof e?"."+e:"["+e+"]"}).join("")},w=function(e,t){var r=t.at,o=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(t,["at"]);return s({at:e+(r||"")},o)},p=function(){function e(t){var r=this;this.decode=t,this.run=function(e){return a(function(t){return{kind:"DecoderError",input:e,at:"input"+(t.at||""),message:t.message||""}},r.decode(e))},this.runPromise=function(e){return!0===(t=r.run(e)).ok?Promise.resolve(t.result):Promise.reject(t.error);var t},this.runWithException=function(e){return function(e){if(!0===e.ok)return e.result;throw e.error}(r.run(e))},this.map=function(t){return new e(function(e){return function(e,t){return!0===t.ok?o(e(t.result)):t}(t,r.decode(e))})},this.andThen=function(t){return new e(function(e){return function(e,t){return!0===t.ok?e(t.result):t}(function(r){return t(r).decode(e)},r.decode(e))})},this.where=function(t,o){return r.andThen(function(r){return t(r)?e.succeed(r):e.fail(o)})}}return e.string=function(){return new e(function(e){return"string"==typeof e?o(e):n({message:h("a string",e)})})},e.number=function(){return new e(function(e){return"number"==typeof e?o(e):n({message:h("a number",e)})})},e.boolean=function(){return new e(function(e){return"boolean"==typeof e?o(e):n({message:h("a boolean",e)})})},e.constant=function(t){return new e(function(e){return c(e,t)?o(t):n({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})})},e.object=function(t){return new e(function(e){if(l(e)&&t){var r={};for(var i in t)if(t.hasOwnProperty(i)){var a=t[i].decode(e[i]);if(!0!==a.ok)return void 0===e[i]?n({message:"the key '"+i+"' is required but was not present"}):n(w("."+i,a.error));void 0!==a.result&&(r[i]=a.result)}return o(r)}return l(e)?o(e):n({message:h("an object",e)})})},e.array=function(t){return new e(function(e){if(d(e)&&t){return e.reduce(function(e,r,o){return i(function(e,t){return e.concat([t])},e,function(e,r){return a(function(e){return w("["+r+"]",e)},t.decode(e))}(r,o))},o([]))}return d(e)?o(e):n({message:h("an array",e)})})},e.tuple=function(t){return new e(function(e){if(d(e)){if(e.length!==t.length)return n({message:"expected a tuple of length "+t.length+", got one of length "+e.length});for(var r=[],i=0;i<t.length;i++){var a=t[i].decode(e[i]);if(!a.ok)return n(w("["+i+"]",a.error));r[i]=a.result}return o(r)}return n({message:h("a tuple of length "+t.length,e)})})},e.union=function(t,r){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];return e.oneOf.apply(e,[t,r].concat(o))},e.intersection=function(t,r){for(var n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return new e(function(e){return[t,r].concat(n).reduce(function(t,r){return i(Object.assign,t,r.decode(e))},o({}))})},e.anyJson=function(){return new e(function(e){return o(e)})},e.unknownJson=function(){return new e(function(e){return o(e)})},e.dict=function(t){return new e(function(e){if(l(e)){var r={};for(var i in e)if(e.hasOwnProperty(i)){var a=t.decode(e[i]);if(!0!==a.ok)return n(w("."+i,a.error));r[i]=a.result}return o(r)}return n({message:h("an object",e)})})},e.optional=function(t){return new e(function(e){return null==e?o(void 0):t.decode(e)})},e.oneOf=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e(function(e){for(var r=[],o=0;o<t.length;o++){var i=t[o].decode(e);if(!0===i.ok)return i;r[o]=i.error}var a=r.map(function(e){return"at error"+(e.at||"")+": "+e.message}).join('", "');return n({message:'expected a value matching one of the decoders, got the errors ["'+a+'"]'})})},e.withDefault=function(t,r){return new e(function(e){return o(function(e,t){return!0===t.ok?t.result:e}(t,r.decode(e)))})},e.valueAt=function(t,r){return new e(function(e){for(var o=e,i=0;i<t.length;i++){if(void 0===o)return n({at:u(t.slice(0,i+1)),message:"path does not exist"});if("string"==typeof t[i]&&!l(o))return n({at:u(t.slice(0,i+1)),message:h("an object",o)});if("number"==typeof t[i]&&!d(o))return n({at:u(t.slice(0,i+1)),message:h("an array",o)});o=o[t[i]]}return a(function(e){return void 0===o?{at:u(t),message:"path does not exist"}:w(u(t),e)},r.decode(o))})},e.succeed=function(t){return new e(function(e){return o(t)})},e.fail=function(t){return new e(function(e){return n({message:t})})},e.lazy=function(t){return new e(function(e){return t().decode(e)})},e}(),m=p.string,g=p.number,f=p.boolean,y=p.anyJson;p.unknownJson;var b=p.constant,k=p.object,W=p.array;p.tuple,p.dict;var I=p.optional,S=p.oneOf;p.union;var x=p.intersection;p.withDefault,p.valueAt,p.succeed,p.fail;var D=p.lazy;const v=m().where(e=>e.length>0,"Expected a non-empty string"),C=g().where(e=>e>=0,"Expected a non-negative number"),E=g().where(e=>e>0,"Expected a positive number"),B=S(b("keepInside"),b("autoEject")),T=k({inWorkspace:f()}),M=k({isVisible:f()}),F=k({base64Image:v}),R=k({icon:F,frameId:v}),L=S(b("workspace"),b("row"),b("column"),b("group")),A=S(b("row"),b("column"),b("group")),P=S(b("maximized"),b("minimized"),b("normal")),z=S(b("workspace")),O=(e,t)=>{const r=typeof e;if(t&&"function"!==r&&"undefined"!==r)throw new Error(`Provided argument must be either undefined or of type function, provided: ${r}`);if(!t&&"function"!==r)throw new Error(`Provided argument must be of type function, provided: ${r}`)},H=I(k({saveLayout:I(f())})),$=k({name:v}),_=k({minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f())}),j=k({minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),allowExtract:I(f()),allowReorder:I(f()),allowDrop:I(f()),allowDropHeader:I(f()),allowDropLeft:I(f()),allowDropRight:I(f()),allowDropTop:I(f()),allowDropBottom:I(f()),showMaximizeButton:I(f()),showEjectButton:I(f()),showAddWindowButton:I(f())}),G=k({minHeight:I(g()),maxHeight:I(g()),allowDrop:I(f()),allowSplitters:I(f()),isPinned:I(f()),maximizationBoundary:I(f())}),N=k({minWidth:I(g()),maxWidth:I(g()),allowDrop:I(f()),allowSplitters:I(f()),isPinned:I(f()),maximizationBoundary:I(f())}),V=k({type:I(b("window")),appName:I(v),windowId:I(v),context:I(y()),config:I(_)}),J=k({type:b("window"),appName:I(v),windowId:I(v),context:I(y()),config:I(_)}),U=I(k({type:I(A),children:I(D(()=>W(S(V,U)))),config:I(y())})),K=k({type:b("column"),children:I(D(()=>W(S(J,X)))),config:I(N)}),q=k({type:b("row"),children:I(D(()=>W(S(J,X)))),config:I(G)}),Q=k({type:b("group"),children:I(D(()=>W(S(J,X)))),config:I(j)}),X=S(Q,K,q);S(m().where(e=>"maximized"===e.toLowerCase(),"Expected a case insensitive variation of 'maximized'"),m().where(e=>"normal"===e.toLowerCase(),"Expected a case insensitive variation of 'normal'"));const Y=k({bounds:I(k({left:I(g()),top:I(g()),width:I(C),height:I(C)})),isVisible:I(f()),frameId:I(v)}),Z=S(b("direct"),b("delayed"),b("lazy")),ee=I(k({app:I(v),context:I(y()),loadingStrategy:I(Z),title:I(v),reuseWorkspaceId:I(v),frameId:I(v),applicationName:I(v),lockdown:I(f()),activateFrame:I(f()),newFrame:I(S(Y,f())),noTabHeader:I(f()),inMemoryLayout:I(f()),icon:I(v),isPinned:I(f()),isSelected:I(f()),positionIndex:I(C),allowSystemHibernation:I(f())})),te=k({name:v,restoreOptions:I(ee)}),re=k({children:I(W(S(V,X))),context:I(y()),config:I(k({title:I(v),position:I(C),isFocused:I(f()),noTabHeader:I(f()),reuseWorkspaceId:I(v),loadingStrategy:I(Z),allowDrop:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),showCloseButton:I(f()),allowSplitters:I(f()),showWindowCloseButtons:I(f()),showEjectButtons:I(f()),showAddWindowButtons:I(f()),icon:I(v),isPinned:I(f()),isSelected:I(f()),positionIndex:I(C),windowDragMode:I(B)})),frame:I(k({activate:I(f()),reuseFrameId:I(v),applicationName:I(v),newFrame:I(S(f(),Y))}))}),oe=k({workspaceId:v}),ne=k({name:v,restoreOptions:I(ee)}),ie=I(k({applicationName:I(m()),frameConfig:I(Y),context:I(k()),layoutComponentId:I(v)})),ae=k({workspaces:W(S(I(re),I(ne)))}),se=k({frameId:v,workspaces:W(S(re,ne))}),ce=k({type:L,definition:I(S(re,U))}),de=x(re,k({saveConfig:I(k({saveLayout:I(f())}))})),le=k({itemId:v}),he=k({context:I(k())}),ue=k({id:v,isFocused:I(f()),isInitialized:I(f()),initializationContext:I(he)});k({type:A,id:v,frameId:v,workspaceId:v,positionIndex:g()});const we=S(b("frame"),b("workspace"),b("container"),b("window")),pe=k({type:we,branch:v}),me=S(b("opened"),b("closing"),b("closed"),b("focus"),b("added"),b("loaded"),b("removed"),b("childrenUpdate"),b("containerChange"),b("maximized"),b("restored"),b("minimized"),b("normal"),b("selected"),b("lock-configuration-changed"),b("hibernated"),b("resumed")),ge=k({frameId:v,title:v,positionIndex:C,name:v,layoutName:I(v),isHibernated:I(f()),isSelected:I(f()),allowDrop:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),allowSplitters:I(f()),showCloseButton:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),showAddWindowButtons:I(f()),showEjectButtons:I(f()),showWindowCloseButtons:I(f()),widthInPx:I(g()),heightInPx:I(g()),isPinned:I(f()),windowDragMode:I(B),loadingStrategy:I(Z)}),fe=k({frameId:v,workspaceId:v,positionIndex:g(),minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g())}),ye=y(),be=x(fe,k({windowId:I(v),isMaximized:I(f()),isFocused:f(),isSelected:I(f()),title:I(m()),appName:I(v),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f()),minWidth:I(g()),minHeight:I(g()),maxWidth:I(g()),maxHeight:I(g()),widthInPx:I(g()),heightInPx:I(g()),context:I(y())})),ke=k({id:I(v),config:ye,children:I(D(()=>W(Ie))),type:S(b("row"),b("column"),b("group"))}),We=k({id:I(v),config:be,type:b("window")}),Ie=S(We,ke),Se=k({id:v,config:ge,children:W(Ie),frameSummary:ue,context:I(y())}),xe=k({type:b("window"),config:k({appName:v,windowId:I(v),context:I(y()),url:I(v),title:I(m()),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f()),minWidth:I(g()),minHeight:I(g()),maxWidth:I(g()),maxHeight:I(g()),isMaximized:I(f())})}),De=k({type:b("group"),config:y(),children:W(S(xe))}),ve=k({type:b("column"),config:y(),children:W(S(De,xe,D(()=>ve),D(()=>Ce)))}),Ce=k({type:b("row"),config:y(),children:W(S(ve,De,xe,D(()=>Ce)))}),Ee=k({name:v,type:b("Workspace"),metadata:I(y()),components:W(k({type:b("Workspace"),application:I(m()),state:k({config:y(),context:y(),children:W(S(Ce,ve,De,xe))})}))}),Be=k({layout:Ee,mode:S(b("replace"),b("merge"))}),Te=k({layouts:W(Ee),mode:S(b("replace"),b("merge"))}),Me=k({layouts:W(Ee)}),Fe=k({id:v,isFocused:I(f()),isInitialized:I(f()),initializationContext:I(he)}),Re=k({summaries:W(Fe)}),Le=k({id:v,config:ge}),Ae=k({summaries:W(Le)}),Pe=k({id:v,config:y(),workspaces:W(Se)}),ze=k({name:v,applicationName:I(m())}),Oe=k({summaries:W(ze)}),He=k({windowId:v}),$e=y(),_e=k({state:P}),je=k({top:g(),left:g(),width:C,height:C}),Ge=k({bounds:je}),Ne=k({icon:I(v)}),Ve=k({id:I(v)}),Je=k({isSupported:f()}),Ue=k({width:I(E),height:I(E),relative:I(f())}),Ke=k({top:I(g()),left:I(g()),relative:I(f())}),qe=k({itemId:v}),Qe=k({allowPrevent:I(f()),showDialog:I(f())}),Xe=k({itemId:v,closeOptions:I(Qe)}),Ye=k({itemId:v,excludeIds:I(f())}),Ze=k({frameId:v,requestedState:P}),et=k({itemId:v,title:v}),tt=k({itemId:v,containerId:v}),rt=x(qe,Ue),ot=k({itemId:v,enabled:f()}),nt=x(qe,Ke);k({id:v,type:A});const it=k({definition:V,parentId:v,parentType:L}),at=k({definition:X,parentId:v,parentType:L}),st=k({itemId:v,windowId:I(v)}),ct=k({live:f()}),dt=k({type:S(b("row"),b("column")),workspaceId:v}),lt=k({type:S(b("row"),b("column")),itemId:v}),ht=k({itemId:v,config:ye}),ut=k({frameSummary:ue,frameBounds:I(je)}),wt=k({workspaceSummary:Le,frameSummary:ue,workspaceSnapshot:I(Se),frameBounds:I(je)}),pt=k({containerSummary:ht}),mt=k({windowSummary:k({itemId:v,parentId:v,config:be})}),gt=k({name:v,workspaceId:v,saveContext:I(f()),allowMultiple:I(f()),metadata:I(k())}),ft=k({allowDrop:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),allowSplitters:I(f()),showCloseButton:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),showWindowCloseButtons:I(f()),showAddWindowButtons:I(f()),showEjectButtons:I(f())}),yt=k({workspaceId:v,config:I(ft)}),bt=k({allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f())}),kt=k({width:I(C),height:I(C)}),Wt=k({windowPlacementId:v,config:I(bt)}),It=k({allowDrop:I(f()),allowSplitters:I(f())}),St=k({allowDrop:I(f()),allowSplitters:I(f())}),xt=k({allowExtract:I(f()),allowReorder:I(f()),allowDrop:I(f()),allowDropLeft:I(f()),allowDropRight:I(f()),allowDropTop:I(f()),allowDropBottom:I(f()),allowDropHeader:I(f()),showMaximizeButton:I(f()),showEjectButton:I(f()),showAddWindowButton:I(f())}),Dt=k({itemId:v,type:b("row"),config:I(It)}),vt=k({itemId:v,type:b("column"),config:I(St)}),Ct=k({itemId:v,type:b("group"),config:I(xt)}),Et=S(Dt,vt,Ct),Bt=k({workspaceId:v,icon:I(v)}),Tt=k({workspaceId:v,icon:I(v)}),Mt=I(k({icon:I(v)})),Ft=I(k({activate:I(f())})),Rt=k({shortcut:v,frameId:v}),Lt=k({shortcut:v,frameId:v}),At=k({frameId:v}),Pt=k({enabled:f()}),zt=k({itemId:v,type:z}),Ot=k({operation:v}),Ht=k({itemId:v,dragMode:B}),$t=k({itemId:v,strategy:Z}),_t=k({prevent:f()}),jt=k({width:C,height:C}),Gt=k({left:g(),top:g(),width:C,height:C}),Nt=S(b("none"),b("left"),b("right"),b("top"),b("bottom")),Vt=k({size:jt,targetBounds:Gt,targetLocation:Nt,windowId:v,horizontalOffset:I(g()),verticalOffset:I(g()),focus:I(f())}),Jt=k({frameId:v,size:jt,targetBounds:Gt,targetLocation:Nt,windowId:v,horizontalOffset:I(g()),verticalOffset:I(g()),focus:I(f())}),Ut=k({frameId:v,activate:I(f()),isVisible:f()}),Kt=k({mode:I(S(b("Global"),b("WindowContainer"))),type:m(),size:I(jt),message:v,messageTitle:I(v),movable:I(f()),transparent:I(f()),title:v,context:I(y()),affirmativeButtonName:I(v),showAffirmativeButton:I(f()),cancelButtonName:I(v),showCancelButton:I(f()),negativeButtonName:I(v),showNegativeButton:I(f()),defaultAction:I(S(b("affirmative"),b("negative"),b("cancel"))),timerDuration:I(E),showTimer:I(f()),inputMaxLength:I(E),inputPattern:I(v),inputPatternErrorMessage:I(v),inputPlaceholder:I(m())}),qt=k({frameId:v,options:Kt}),Qt="T42.Web.Platform.Control",Xt="T42.Web.Platform.WSP.Stream",Yt={control:{name:"T42.Workspaces.Control",isStream:!1},frameStream:{name:"T42.Workspaces.Stream.Frame",isStream:!0},workspaceStream:{name:"T42.Workspaces.Stream.Workspace",isStream:!0},containerStream:{name:"T42.Workspaces.Stream.Container",isStream:!0},windowStream:{name:"T42.Workspaces.Stream.Window",isStream:!0}},Zt={control:{name:"T42.Workspaces.Client.Control",isStream:!1}},er={frame:{name:"T42.Workspaces.Stream.Frame",payloadDecoder:ut},workspace:{name:"T42.Workspaces.Stream.Workspace",payloadDecoder:wt},container:{name:"T42.Workspaces.Stream.Container",payloadDecoder:pt},window:{name:"T42.Workspaces.Stream.Window",payloadDecoder:mt}},tr={shortcutClicked:{name:"shortcutClicked",argsDecoder:Lt,resultDecoder:$e},frameClosing:{name:"frameClosing",argsDecoder:At,resultDecoder:_t}},rr={ping:{name:"ping",resultDecoder:ct},isWindowInWorkspace:{name:"isWindowInWorkspace",argsDecoder:qe,resultDecoder:T},createWorkspace:{name:"createWorkspace",resultDecoder:Se,argsDecoder:de},createFrame:{name:"createFrame",resultDecoder:Fe,argsDecoder:ie},initFrame:{name:"initFrame",resultDecoder:$e,argsDecoder:se},getAllFramesSummaries:{name:"getAllFramesSummaries",resultDecoder:Re},getFrameSummary:{name:"getFrameSummary",resultDecoder:ue,argsDecoder:le},getAllWorkspacesSummaries:{name:"getAllWorkspacesSummaries",resultDecoder:Ae},getWorkspaceSnapshot:{name:"getWorkspaceSnapshot",resultDecoder:Se,argsDecoder:qe},getAllLayoutsSummaries:{name:"getAllLayoutsSummaries",resultDecoder:Oe},openWorkspace:{name:"openWorkspace",argsDecoder:te,resultDecoder:Se},deleteLayout:{name:"deleteLayout",resultDecoder:$e,argsDecoder:$},saveLayout:{name:"saveLayout",resultDecoder:Ee,argsDecoder:gt},importLayout:{name:"importLayout",resultDecoder:$e,argsDecoder:Be},importLayouts:{name:"importLayouts",resultDecoder:$e,argsDecoder:Te},exportAllLayouts:{name:"exportAllLayouts",resultDecoder:Me},restoreItem:{name:"restoreItem",argsDecoder:qe,resultDecoder:$e},maximizeItem:{name:"maximizeItem",argsDecoder:qe,resultDecoder:$e},focusItem:{name:"focusItem",argsDecoder:qe,resultDecoder:$e},closeItem:{name:"closeItem",argsDecoder:Xe,resultDecoder:$e},closeWorkspace:{name:"closeWorkspace",argsDecoder:Xe,resultDecoder:$e},resizeItem:{name:"resizeItem",argsDecoder:rt,resultDecoder:$e},setMaximizationBoundary:{name:"setMaximizationBoundary",argsDecoder:ot,resultDecoder:$e},changeFrameState:{name:"changeFrameState",argsDecoder:Ze,resultDecoder:$e},getFrameState:{name:"getFrameState",argsDecoder:qe,resultDecoder:_e},getFrameBounds:{name:"getFrameBounds",argsDecoder:qe,resultDecoder:Ge},moveFrame:{name:"moveFrame",argsDecoder:nt,resultDecoder:$e},getFrameSnapshot:{name:"getFrameSnapshot",argsDecoder:Ye,resultDecoder:Pe},forceLoadWindow:{name:"forceLoadWindow",argsDecoder:qe,resultDecoder:He},ejectWindow:{name:"ejectWindow",argsDecoder:qe,resultDecoder:He},setItemTitle:{name:"setItemTitle",argsDecoder:et,resultDecoder:$e},moveWindowTo:{name:"moveWindowTo",argsDecoder:tt,resultDecoder:$e},addWindow:{name:"addWindow",argsDecoder:it,resultDecoder:st},addContainer:{name:"addContainer",argsDecoder:at,resultDecoder:st},bundleWorkspace:{name:"bundleWorkspace",argsDecoder:dt,resultDecoder:$e},bundleItem:{name:"bundleItem",argsDecoder:lt,resultDecoder:$e},hibernateWorkspace:{name:"hibernateWorkspace",argsDecoder:oe,resultDecoder:$e},resumeWorkspace:{name:"resumeWorkspace",argsDecoder:oe,resultDecoder:$e},lockWorkspace:{name:"lockWorkspace",argsDecoder:yt,resultDecoder:$e},lockWindow:{name:"lockWindow",argsDecoder:Wt,resultDecoder:$e},lockContainer:{name:"lockContainer",argsDecoder:Et,resultDecoder:$e},pinWorkspace:{name:"pinWorkspace",argsDecoder:Bt,resultDecoder:$e},unpinWorkspace:{name:"unpinWorkspace",argsDecoder:oe,resultDecoder:$e},getWorkspaceIcon:{name:"getWorkspaceIcon",argsDecoder:oe,resultDecoder:Ne},setWorkspaceIcon:{name:"setWorkspaceIcon",argsDecoder:Tt,resultDecoder:$e},registerShortcut:{name:"registerShortcut",argsDecoder:Rt,resultDecoder:$e},unregisterShortcut:{name:"unregisterShortcut",argsDecoder:Rt,resultDecoder:$e},showLoadingAnimation:{name:"showLoadingAnimation",argsDecoder:zt,resultDecoder:$e},hideLoadingAnimation:{name:"hideLoadingAnimation",argsDecoder:zt,resultDecoder:$e},getPlatformFrameId:{name:"getPlatformFrameId",resultDecoder:Ve},operationCheck:{name:"operationCheck",argsDecoder:Ot,resultDecoder:Je},setWindowDragMode:{name:"setWindowDragMode",argsDecoder:Ht,resultDecoder:$e},setLoadingStrategy:{name:"setLoadingStrategy",argsDecoder:$t,resultDecoder:$e},getTaskbarIcon:{name:"getTaskbarIcon",resultDecoder:F},setTaskbarIcon:{name:"setTaskbarIcon",argsDecoder:R,resultDecoder:$e},subscribeToFrameClosing:{name:"subscribeToFrameClosing",argsDecoder:qe,resultDecoder:$e},showPopup:{name:"showPopup",argsDecoder:Jt,resultDecoder:$e},changeFrameVisibility:{name:"changeFrameVisibility",argsDecoder:Ut,resultDecoder:$e},getFrameVisibility:{name:"getFrameVisibility",argsDecoder:qe,resultDecoder:M},showFrameDialog:{name:"showFrameDialog",argsDecoder:qt,resultDecoder:y()}};class or{resolve;reject;promise;constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class nr{transport;registry;activeSubscriptions=[];pendingSubScriptions=[];constructor(e,t){this.transport=e,this.registry=t}async createCoreEventSubscription(){await this.transport.coreSubscriptionReady(this.handleCoreEvent.bind(this))}handleCoreSubscription(e){const t=`${e.eventType}-${e.action}`,r=e.scope,o=e.scopeId;return this.registry.add(t,t=>{const n={type:r,id:o},i={frame:t.frameSummary?.id||t.windowSummary?.config.frameId,workspace:t.workspaceSummary?.id||t.windowSummary?.config.workspaceId,container:t.containerSummary?.itemId,window:t.windowSummary?.itemId};this.checkScopeMatch(n,i)&&e.callback(t)})}async send(e,t){const r=Object.values(rr).find(t=>t.name===e);if(!r)throw new Error(`Cannot find definition for operation name: ${e}`);if(r.argsDecoder)try{r.argsDecoder.runWithException(t)}catch(t){throw new Error(`Unexpected internal outgoing validation error: ${t.message}, for input: ${JSON.stringify(t.input)}, for operation ${e}`)}try{const e=await this.transport.transmitControl(r.name,t);return r.resultDecoder.runWithException(e),e}catch(t){if(t.kind)throw new Error(`Unexpected internal incoming validation error: ${t.message}, for input: ${JSON.stringify(t.input)}, for operation ${e}`);throw new Error(t.message)}}async subscribe(e){const t=this.getPendingSubscription(e);t&&await t.promise;let r=this.getActiveSubscription(e);const o=this.getRegistryKey(e);if(!r){const t=new or,o={streamType:e.eventType,level:e.scope,levelId:e.scopeId,promise:t.promise};this.pendingSubScriptions.push(o);try{const o=er[e.eventType],n=await this.transport.subscribe(o.name,this.getBranchKey(e),e.eventType);n.onData(e=>{const t=e.data,r=pe.run(e.requestArguments),o=me.run(t.action);if(!r.ok||!o.ok)return;const n=r.result.type,i=`${n}-${r.result.branch}-${o.result}`,a=er[n].payloadDecoder.run(t.payload);a.ok&&this.registry.execute(i,a.result)}),r={streamType:e.eventType,level:e.scope,levelId:e.scopeId,callbacksCount:0,gdSub:n},this.activeSubscriptions.push(r),t.resolve()}catch(e){throw t.reject(e),e}finally{this.removePendingSubscription(o)}}const n=this.registry.add(o,e.callback);return++r.callbacksCount,()=>{n(),--r.callbacksCount,0===r.callbacksCount&&(r.gdSub.close(),this.activeSubscriptions.splice(this.activeSubscriptions.indexOf(r),1))}}onOperation(e){return this.transport.onInternalMethodInvoked("control",(t,r)=>{const o=t.operation,n=t.data,i=Object.values(tr).find(e=>e.name===o);if(!i)throw new Error(`Cannot find definition for operation name: ${o}`);if(i.argsDecoder)try{i.argsDecoder.runWithException(n)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}e(t,r)})}onOperationWithResponse(e){return this.transport.onInternalMethodInvoked("control",async(t,r)=>{const o=t.operation,n=t.data,i=Object.values(tr).find(e=>e.name===o);if(!i)throw new Error(`Cannot find definition for operation name: ${o}`);if(i.argsDecoder)try{i.argsDecoder.runWithException(n)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}const a=await e(t,r);if(i.resultDecoder)try{i.resultDecoder.runWithException(a)}catch(e){throw new Error(`Unexpected internal outgoing result validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}return a})}checkScopeMatch(e,t){return"global"===e.type||("frame"===e.type&&e.id===t.frame||("workspace"===e.type&&e.id===t.workspace||("container"===e.type&&e.id===t.container||"window"===e.type&&e.id===t.window)))}handleCoreEvent(e){const t=e.data;try{const e=me.runWithException(t.action),r=we.runWithException(t.type),o=er[r].payloadDecoder.runWithException(t.payload),n=`${r}-${e}`;this.registry.execute(n,o)}catch(e){console.warn(`Cannot handle event with data ${JSON.stringify(t)}, because of validation error: ${e.message}`)}}getBranchKey(e){return"global"===e.scope?e.scope:`${e.scope}_${e.scopeId}`}getRegistryKey(e){return`${e.eventType}-${this.getBranchKey(e)}-${e.action}`}getActiveSubscription(e){return this.activeSubscriptions.find(t=>t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId)}getPendingSubscription(e){return this.pendingSubScriptions.find(t=>t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId)}removePendingSubscription(e){const t=this.pendingSubScriptions.indexOf(e);t>=0&&this.pendingSubScriptions.splice(t,1)}}const ir=()=>"undefined"==typeof window||(window.glue42gd||window.iodesktop),ar=()=>"undefined"==typeof window?null:window.glue42core||window.iobrowser;class sr{agm;registry;defaultTransportTimeout=12e4;coreEventMethodInitiated=!1;corePlatformSubPromise;constructor(e,t){this.agm=e,this.registry=t}async initiate(e){if(ir())return await Promise.all(Object.values(Yt).map(e=>this.verifyMethodLive(e.name))),void await Promise.all(Object.keys(Zt).map(e=>this.registerMethod(e)));const t=ar().communicationId;await Promise.all([this.verifyMethodLive(Qt,t),this.verifyMethodLive(Xt,t)]),await this.transmitControl("frameHello",{windowId:e})}coreSubscriptionReady(e){return this.coreEventMethodInitiated||this.subscribePlatform(e),this.corePlatformSubPromise}subscribePlatform(e){this.coreEventMethodInitiated=!0;const t=ar().communicationId;this.corePlatformSubPromise=this.agm.subscribe(Xt,t?{target:{instance:t}}:void 0),this.corePlatformSubPromise.then(t=>{t.onData(t=>e(t.data))})}async subscribe(e,t,r){const o={branch:t,type:r};let n;try{n=await this.agm.subscribe(e,{arguments:o})}catch(r){const o=`Internal subscription error! Error details: stream - ${e}, branch: ${t}. Internal message: ${r.message}`;throw new Error(o)}return n}async transmitControl(e,t){const r=ir()?{operation:e,operationArguments:t}:{operation:e,domain:"workspaces",data:t},o=ir()?Yt.control.name:Qt,n=ir()?void 0:ar().communicationId;let i;const a=`Internal Workspaces Communication Error. Attempted operation: ${JSON.stringify(r)}. `;try{if(i=await this.agm.invoke(o,r,n?{instance:n}:"best",{methodResponseTimeoutMs:this.defaultTransportTimeout}),!i)throw new Error("Received unsupported result from GD - empty result");if(!Array.isArray(i.all_return_values)||0===i.all_return_values.length)throw new Error("Received unsupported result from GD - empty values collection")}catch(e){if(e&&e.all_errors&&e.all_errors.length){const t=e.all_errors[0].message;throw new Error(`${a} -> Inner message: ${t}`)}throw new Error(`${a} -> Inner message: ${e.message}`)}return i.all_return_values[0].returned}onInternalMethodInvoked(e,t){return this.registry.add(e,t)}verifyMethodLive(e,t){return r=()=>new Promise(r=>{if(this.agm.methods().some(r=>{const o=r.name===e,n=!t||r.getServers().some(e=>e.instance===t);return o&&n}))return void r();const o=this.agm.serverMethodAdded(n=>{const i=n.method,a=n.server,s=!t||a.instance===t;i.name===e&&s&&(o(),r())})}),o=15e3,n="Timeout waiting for the Workspaces communication channels",new Promise((e,t)=>{let i=!0;const a=setTimeout(()=>{i&&(i=!1,t(n))},o);r().then(t=>{i&&(i=!1,clearTimeout(a),e(t))}).catch(e=>{i&&(i=!1,clearTimeout(a),t(e))})});var r,o,n}registerMethod(e){const t=Zt[e];return this.agm.register(t.name,(t,r)=>Promise.all(this.registry.execute(e,t,r)))}}const cr=new WeakMap;class dr{constructor(e,t){const r=t.wrapChildren(e.children);delete e.children,cr.set(this,{base:t,children:r,definition:e})}get type(){return cr.get(this).definition.type}addColumn(e){return cr.get(this).base.add("column",cr.get(this).children,e)}addRow(e){return cr.get(this).base.add("row",cr.get(this).children,e)}addGroup(e){return cr.get(this).base.add("group",cr.get(this).children,e)}addWindow(e){return cr.get(this).base.addWindow(cr.get(this).children,e),this}serialize(){const e=cr.get(this).definition;return e.children=cr.get(this).base.serializeChildren(cr.get(this).children),e}}class lr{getBuilder;constructor(e){this.getBuilder=e}wrapChildren(e){return e.map(e=>"window"===e.type?e:this.getBuilder({type:e.type,definition:e}))}add(e,t,r){const o=U.runWithException(r),n=this.getBuilder({type:e,definition:o});return t.push(n),n}addWindow(e,t){const r=V.runWithException(t);r.type="window",e.push(r)}serializeChildren(e){return e.map(e=>e instanceof dr?e.serialize():e)}}const hr=new WeakMap;class ur{constructor(e,t,r){const o=t.wrapChildren(e.children);delete e.children,hr.set(this,{base:t,children:o,definition:e,controller:r})}addColumn(e){const t=hr.get(this).children;if(!t.every(e=>e instanceof dr&&"column"===e.type))throw new Error("Cannot add a column to this workspace, because there are already children of another type");return hr.get(this).base.add("column",t,e)}addRow(e){const t=hr.get(this).children;if(!t.every(e=>e instanceof dr&&"row"===e.type))throw new Error("Cannot add a row to this workspace, because there are already children of another type");return hr.get(this).base.add("row",t,e)}addGroup(e){const t=hr.get(this).children;if(0!==t.length)throw new Error("Cannot add a group to this workspace, because there are already defined children.");return hr.get(this).base.add("group",t,e)}addWindow(e){const t=hr.get(this).children;if(0!==t.length)throw new Error("Cannot add a window to this workspace, because there are already defined children.");return hr.get(this).base.addWindow(t,e),this}getChildAt(e){C.runWithException(e);return hr.get(this).children[e]}async create(e){const t=H.runWithException(e),r=hr.get(this).definition;r.children=hr.get(this).base.serializeChildren(hr.get(this).children);return hr.get(this).controller.createWorkspace(r,t)}}const wr=new WeakMap,pr=e=>wr.get(e).base;class mr{constructor(e){wr.set(this,{base:e})}get type(){return"row"}get id(){return pr(this).getId(this)}get frameId(){return pr(this).getFrameId(this)}get workspaceId(){return pr(this).getWorkspaceId(this)}get positionIndex(){return pr(this).getPositionIndex(this)}get children(){return pr(this).getAllChildren(this)}get parent(){return pr(this).getMyParent(this)}get frame(){return pr(this).getMyFrame(this)}get workspace(){return pr(this).getMyWorkspace(this)}get allowDrop(){return pr(this).getAllowDrop(this)}get allowSplitters(){return pr(this).getAllowSplitters(this)}get minWidth(){return pr(this).getMinWidth(this)}get minHeight(){return pr(this).getMinHeight(this)}get maxWidth(){return pr(this).getMaxWidth(this)}get maxHeight(){return pr(this).getMaxHeight(this)}get width(){return pr(this).getWidthInPx(this)}get height(){return pr(this).getHeightInPx(this)}get isPinned(){return pr(this).getIsPinned(this)}get isMaximized(){return pr(this).getIsMaximized(this)}get maximizationBoundary(){return pr(this).getMaximizationBoundary(this)}addWindow(e){return pr(this).addWindow(this,e,"row")}async addGroup(e){if(e?.type&&"group"!==e.type)throw new Error(`Expected a group definition, but received ${e.type}`);return pr(this).addParent(this,"group","row",e)}async addColumn(e){if(e?.type&&"column"!==e.type)throw new Error(`Expected a column definition, but received ${e.type}`);return pr(this).addParent(this,"column","row",e)}async addRow(){throw new Error("Adding rows as row children is not supported")}removeChild(e){return pr(this).removeChild(this,e)}maximize(){return pr(this).maximize(this)}restore(){return pr(this).restore(this)}close(){return pr(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const r=void 0===t?void 0:It.runWithException(t);return pr(this).lockContainer(this,r)}async setHeight(e){return C.runWithException(e),pr(this).setHeight(this,e)}async onLockConfigurationChanged(e){O(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await pr(this).processLocalSubscription(this,t)}async setMaximizationBoundary(e){const t=Pt.runWithException(e);return pr(this).setMaximizationBoundary(this,t)}}const gr=new WeakMap,fr=e=>gr.get(e).base;class yr{constructor(e){gr.set(this,{base:e})}get type(){return"column"}get id(){return fr(this).getId(this)}get frameId(){return fr(this).getFrameId(this)}get workspaceId(){return fr(this).getWorkspaceId(this)}get positionIndex(){return fr(this).getPositionIndex(this)}get children(){return fr(this).getAllChildren(this)}get parent(){return fr(this).getMyParent(this)}get frame(){return fr(this).getMyFrame(this)}get workspace(){return fr(this).getMyWorkspace(this)}get allowDrop(){return fr(this).getAllowDrop(this)}get allowSplitters(){return fr(this).getAllowSplitters(this)}get minWidth(){return fr(this).getMinWidth(this)}get minHeight(){return fr(this).getMinHeight(this)}get maxWidth(){return fr(this).getMaxWidth(this)}get maxHeight(){return fr(this).getMaxHeight(this)}get width(){return fr(this).getWidthInPx(this)}get height(){return fr(this).getHeightInPx(this)}get isPinned(){return fr(this).getIsPinned(this)}get isMaximized(){return fr(this).getIsMaximized(this)}get maximizationBoundary(){return fr(this).getMaximizationBoundary(this)}addWindow(e){return fr(this).addWindow(this,e,"column")}async addGroup(e){if(e?.type&&"group"!==e.type)throw new Error(`Expected a group definition, but received ${e.type}`);return fr(this).addParent(this,"group","column",e)}async addColumn(){throw new Error("Adding columns as column children is not supported")}async addRow(e){if(e?.type&&"row"!==e.type)throw new Error(`Expected a row definition, but received ${e.type}`);return fr(this).addParent(this,"row","column",e)}removeChild(e){return fr(this).removeChild(this,e)}maximize(){return fr(this).maximize(this)}restore(){return fr(this).restore(this)}close(){return fr(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const r=void 0===t?void 0:St.runWithException(t);return fr(this).lockContainer(this,r)}async setWidth(e){return C.runWithException(e),fr(this).setWidth(this,e)}async onLockConfigurationChanged(e){O(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await fr(this).processLocalSubscription(this,t)}async setMaximizationBoundary(e){const t=Pt.runWithException(e);return fr(this).setMaximizationBoundary(this,t)}}const br=new WeakMap,kr=e=>br.get(e).base;class Wr{constructor(e){br.set(this,{base:e})}get type(){return"group"}get id(){return kr(this).getId(this)}get frameId(){return kr(this).getFrameId(this)}get workspaceId(){return kr(this).getWorkspaceId(this)}get positionIndex(){return kr(this).getPositionIndex(this)}get children(){return kr(this).getAllChildren(this)}get parent(){return kr(this).getMyParent(this)}get frame(){return kr(this).getMyFrame(this)}get workspace(){return kr(this).getMyWorkspace(this)}get allowExtract(){return kr(this).getAllowExtract(this)}get allowReorder(){return kr(this).getAllowReorder(this)}get allowDropLeft(){return kr(this).getAllowDropLeft(this)}get allowDropRight(){return kr(this).getAllowDropRight(this)}get allowDropTop(){return kr(this).getAllowDropTop(this)}get allowDropBottom(){return kr(this).getAllowDropBottom(this)}get allowDropHeader(){return kr(this).getAllowDropHeader(this)}get allowDrop(){return kr(this).getAllowDrop(this)}get showMaximizeButton(){return kr(this).getShowMaximizeButton(this)}get showEjectButton(){return kr(this).getShowEjectButton(this)}get showAddWindowButton(){return kr(this).getShowAddWindowButton(this)}get minWidth(){return kr(this).getMinWidth(this)}get minHeight(){return kr(this).getMinHeight(this)}get maxWidth(){return kr(this).getMaxWidth(this)}get maxHeight(){return kr(this).getMaxHeight(this)}get width(){return kr(this).getWidthInPx(this)}get height(){return kr(this).getHeightInPx(this)}get isMaximized(){return kr(this).getIsMaximized(this)}addWindow(e){return kr(this).addWindow(this,e,"group")}async addGroup(){throw new Error("Adding groups as group child is not supported")}async addColumn(){throw new Error("Adding columns as group child is not supported")}async addRow(){throw new Error("Adding rows as group child is not supported")}removeChild(e){return kr(this).removeChild(this,e)}maximize(){return kr(this).maximize(this)}restore(){return kr(this).restore(this)}close(){return kr(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowDropHeader:this.allowDropHeader,allowDropLeft:this.allowDropLeft,allowDropRight:this.allowDropRight,allowDropTop:this.allowDropTop,allowDropBottom:this.allowDropBottom,allowExtract:this.allowExtract,allowReorder:this.allowReorder,showAddWindowButton:this.showAddWindowButton,showEjectButton:this.showEjectButton,showMaximizeButton:this.showMaximizeButton})}else t=e;const r=void 0===t?void 0:xt.runWithException(t);return kr(this).lockContainer(this,r)}async setSize(e){const t=kt.runWithException(e);if(!t.width&&!t.height)throw new Error("Expected either width or height to be passed.");return kr(this).setSize(this,e.width,e.height)}async bundleToRow(){await kr(this).bundleTo(this,"row"),await this.workspace.refreshReference()}async bundleToColumn(){await kr(this).bundleTo(this,"column"),await this.workspace.refreshReference()}async onLockConfigurationChanged(e){O(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowDropHeader:this.allowDropHeader,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowExtract:this.allowExtract,allowReorder:this.allowReorder,showAddWindowButton:this.showAddWindowButton,showEjectButton:this.showEjectButton,showMaximizeButton:this.showMaximizeButton})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await kr(this).processLocalSubscription(this,t)}}const Ir=new WeakMap,Sr=e=>Ir.get(e).manager.getWorkspaceData(e),xr=e=>Ir.get(e).manager;class Dr{constructor(e){Ir.set(this,{manager:e})}get id(){return Sr(this).id}get frameId(){return Sr(this).config.frameId}get positionIndex(){return Sr(this).config.positionIndex}get title(){return Sr(this).config.title}get layoutName(){return Sr(this).config.layoutName}get isHibernated(){return Sr(this).config.isHibernated}get isSelected(){return Sr(this).config.isSelected}get children(){return Sr(this).children}get frame(){return Sr(this).frame}get allowSplitters(){return Sr(this).config.allowSplitters}get allowSystemHibernation(){return Sr(this).config.allowSystemHibernation}get allowDrop(){return Sr(this).config.allowDrop}get allowDropLeft(){return Sr(this).config.allowDropLeft}get allowDropTop(){return Sr(this).config.allowDropTop}get allowDropRight(){return Sr(this).config.allowDropRight}get allowDropBottom(){return Sr(this).config.allowDropBottom}get allowExtract(){return Sr(this).config.allowExtract}get allowWindowReorder(){return Sr(this).config.allowWindowReorder}get showCloseButton(){return Sr(this).config.showCloseButton}get showSaveButton(){return Sr(this).config.showSaveButton}get allowWorkspaceTabReorder(){return Sr(this).config.allowWorkspaceTabReorder}get allowWorkspaceTabExtract(){return Sr(this).config.allowWorkspaceTabExtract}get minWidth(){return Sr(this).config.minWidth}get minHeight(){return Sr(this).config.minHeight}get maxWidth(){return Sr(this).config.maxWidth}get maxHeight(){return Sr(this).config.maxHeight}get width(){return Sr(this).config.widthInPx}get height(){return Sr(this).config.heightInPx}get showWindowCloseButtons(){return Sr(this).config.showWindowCloseButtons}get showEjectButtons(){return Sr(this).config.showEjectButtons}get showAddWindowButtons(){return Sr(this).config.showAddWindowButtons}get isPinned(){return Sr(this).config.isPinned}get windowDragMode(){return ir()?Sr(this).config.windowDragMode:"keepInside"}get loadingStrategy(){return ir()||console.warn("The workspace.loadingStrategy property is not supported in IO Connect Browser"),Sr(this).config.loadingStrategy}async setLoadingStrategy(e){if(!ir())throw new Error("Not supported in IO Connect Browser");const t=Sr(this).controller;await t.setLoadingStrategy(this.id,e),await this.refreshReference()}async removeChild(e){O(e);const t=this.children.find(e);t&&(await t.close(),await this.refreshReference())}async remove(e){O(e);const t=Sr(this).controller.iterateFindChild(this.children,e);await t.close(),await this.refreshReference()}async focus(){await Sr(this).controller.focusItem(this.id),await this.refreshReference()}async close(){const e=Sr(this).controller;await e.closeWorkspace(this.id,this.frameId)}snapshot(){return Sr(this).controller.getSnapshot(this.id,"workspace")}async saveLayout(e,t){v.runWithException(e),await Sr(this).controller.saveLayout({name:e,workspaceId:this.id,saveContext:t?.saveContext,metadata:t?.metadata,allowMultiple:t?.allowMultiple})}async setTitle(e){v.runWithException(e);const t=Sr(this).controller;await t.setItemTitle(this.id,e),await this.refreshReference()}getContext(){return Sr(this).controller.getWorkspaceContext(this.id)}setContext(e){return Sr(this).controller.setWorkspaceContext(this.id,e)}updateContext(e){return Sr(this).controller.updateWorkspaceContext(this.id,e)}onContextUpdated(e){return Sr(this).controller.subscribeWorkspaceContextUpdated(this.id,e)}async refreshReference(){const e=await Sr(this).controller.getSnapshot(this.id,"workspace"),t=Sr(this).controller.flatChildren(Sr(this).children),r=Sr(this).controller.refreshChildren({existingChildren:t,workspace:this,parent:this,children:e.children}),o=this.frame;let n;if(o.id===e.config.frameId)xr(this).remapFrame(o,e.frameSummary),n=o;else{const t={summary:e.frameSummary};n=Sr(this).ioc.getModel("frame",t)}xr(this).remapWorkspace(this,{config:e.config,children:r,frame:n})}async getIcon(){return Sr(this).controller.getWorkspaceIcon(this.id)}async setIcon(e){return Sr(this).controller.setWorkspaceIcon(this.id,e)}getBox(e){O(e);const t=Sr(this).children;return Sr(this).controller.iterateFindChild(t,t=>"window"!==t.type&&e(t))}getAllBoxes(e){O(e,!0);const t=Sr(this).children,r=Sr(this).controller.iterateFilterChildren(t,e=>"window"!==e.type);return e?r.filter(e):r}getRow(e){return O(e),this.getBox(t=>"row"===t.type&&e(t))}getAllRows(e){return O(e,!0),e?this.getAllBoxes(t=>"row"===t.type&&e(t)):this.getAllBoxes(e=>"row"===e.type)}getColumn(e){return O(e),this.getBox(t=>"column"===t.type&&e(t))}getAllColumns(e){return O(e,!0),e?this.getAllBoxes(t=>"column"===t.type&&e(t)):this.getAllBoxes(e=>"column"===e.type)}getGroup(e){return O(e),this.getBox(t=>"group"===t.type&&e(t))}getAllGroups(e){return O(e,!0),e?this.getAllBoxes(t=>"group"===t.type&&e(t)):this.getAllBoxes(e=>"group"===e.type)}getWindow(e){O(e);const t=Sr(this).children;return Sr(this).controller.iterateFindChild(t,t=>"window"===t.type&&e(t))}getAllWindows(e){O(e,!0);const t=Sr(this).children,r=Sr(this).controller.iterateFilterChildren(t,e=>"window"===e.type);return e?r.filter(e):r}addRow(e){return Sr(this).base.addParent(this,"row","workspace",e)}addColumn(e){return Sr(this).base.addParent(this,"column","workspace",e)}addGroup(e){return Sr(this).base.addParent(this,"group","workspace",e)}addWindow(e){return Sr(this).base.addWindow(this,e,"workspace")}async bundleToRow(){await Sr(this).controller.bundleWorkspaceTo("row",this.id),await this.refreshReference()}async bundleToColumn(){await Sr(this).controller.bundleWorkspaceTo("column",this.id),await this.refreshReference()}async hibernate(){await Sr(this).controller.hibernateWorkspace(this.id),await this.refreshReference()}async resume(){await Sr(this).controller.resumeWorkspace(this.id),await this.refreshReference()}async lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowSystemHibernation:this.allowSystemHibernation,allowExtract:this.allowExtract,allowWindowReorder:this.allowWindowReorder,allowSplitters:this.allowSplitters,showCloseButton:this.showCloseButton,showSaveButton:this.showSaveButton,allowWorkspaceTabReorder:this.allowWorkspaceTabReorder,allowWorkspaceTabExtract:this.allowWorkspaceTabExtract,showAddWindowButtons:this.showAddWindowButtons,showEjectButtons:this.showEjectButtons,showWindowCloseButtons:this.showWindowCloseButtons})}else t=e;const r=void 0===t?void 0:ft.runWithException(t);await Sr(this).controller.lockWorkspace(this.id,r),await this.refreshReference()}async pin(e){Mt.runWithException(e),await Sr(this).controller.pinWorkspace(this.id,e?.icon),await this.refreshReference()}async unpin(){await Sr(this).controller.unpinWorkspace(this.id),await this.refreshReference()}async showLoadingAnimation(){if(!ir())throw new Error("Not supported in IO Connect Browser");await Sr(this).controller.showWorkspaceLoadingAnimation(this.id)}async hideLoadingAnimation(){if(!ir())throw new Error("Not supported in IO Connect Browser");await Sr(this).controller.hideWorkspaceLoadingAnimation(this.id)}async setWindowDragMode(e){if(!ir())throw new Error("Not supported in IO Connect Browser");B.runWithException(e),await Sr(this).controller.setWindowDragMode(this.id,e),await this.refreshReference()}async onClosed(e){O(e);const t=Sr(this).id,r={action:"closed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})}};return await Sr(this).controller.processLocalSubscription(r,t)}async onHibernated(e){O(e);const t=Sr(this).id,r={action:"hibernated",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e()}};return await Sr(this).controller.processLocalSubscription(r,t)}async onResumed(e){O(e);const t=Sr(this).id,r={action:"resumed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e()}};return await Sr(this).controller.processLocalSubscription(r,t)}async onWindowAdded(e){O(e);const t=Sr(this).id,r={action:"added",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox(e=>e.id===t.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===t.windowSummary.itemId);e(r)}};return await Sr(this).controller.processLocalSubscription(r,t)}async onWindowRemoved(e){O(e);const t=Sr(this).id,r={action:"removed",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})}};return await Sr(this).controller.processLocalSubscription(r,t)}async onWindowLoaded(e){O(e);const t=Sr(this).id,r={action:"loaded",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getWindow(e=>e.id&&e.id===t.windowSummary.config.windowId);e(r)}};return await Sr(this).controller.processLocalSubscription(r,t)}async onWindowMaximized(e){O(e);const t=Sr(this).id,r={action:"maximized",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox(e=>e.id===t.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===t.windowSummary.itemId);e(r)}};return await Sr(this).controller.processLocalSubscription(r,t)}async onWindowRestored(e){O(e);const t=Sr(this).id,r={action:"restored",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox(e=>e.id===t.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===t.windowSummary.itemId);e(r)}};return await Sr(this).controller.processLocalSubscription(r,t)}async onWindowSelected(e){O(e);const t=Sr(this).id,r={action:"selected",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox(e=>e.id===t.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===t.windowSummary.itemId);e(r)}};return await Sr(this).controller.processLocalSubscription(r,t)}async onLockConfigurationChanged(e){O(e);const t=Sr(this).id,r={action:"lock-configuration-changed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e({allowDrop:this.allowDrop,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowSystemHibernation:this.allowSystemHibernation,allowExtract:this.allowExtract,allowSplitters:this.allowSplitters,allowWindowReorder:this.allowWindowReorder,allowWorkspaceTabExtract:this.allowWorkspaceTabExtract,allowWorkspaceTabReorder:this.allowWorkspaceTabReorder,showAddWindowButtons:this.showAddWindowButtons,showCloseButton:this.showCloseButton,showEjectButtons:this.showEjectButtons,showSaveButton:this.showSaveButton,showWindowCloseButtons:this.showWindowCloseButtons})}};return await Sr(this).controller.processLocalSubscription(r,t)}}const vr=new WeakMap,Cr=e=>vr.get(e).manager.getWindowData(e);class Er{constructor(e){vr.set(this,{manager:e})}get id(){return Cr(this).config.windowId}get elementId(){return Cr(this).id}get type(){return"window"}get frameId(){return Cr(this).frame.id}get workspaceId(){return Cr(this).workspace.id}get positionIndex(){return Cr(this).config.positionIndex}get isMaximized(){return Cr(this).config.isMaximized}get isLoaded(){return Cr(this).controller.checkIsWindowLoaded(this.id)}get isSelected(){return Cr(this).config.isSelected}get focused(){return this.getGdWindow().isFocused}get title(){return Cr(this).config.title}get allowExtract(){return Cr(this).config.allowExtract}get allowReorder(){return Cr(this).config.allowReorder}get showCloseButton(){return Cr(this).config.showCloseButton}get width(){return Cr(this).config.widthInPx}get height(){return Cr(this).config.heightInPx}get minWidth(){return Cr(this).config.minWidth}get minHeight(){return Cr(this).config.minHeight}get maxWidth(){return Cr(this).config.maxWidth}get maxHeight(){return Cr(this).config.maxHeight}get workspace(){return Cr(this).workspace}get frame(){return Cr(this).frame}get parent(){return Cr(this).parent}get appName(){return Cr(this).config.appName}async forceLoad(){if(this.isLoaded)return;const e=Cr(this).controller,t=Cr(this).id,r=await e.forceLoadWindow(t);Cr(this).config.windowId=r,await this.workspace.refreshReference()}async focus(){const e=Cr(this).id,t=Cr(this).controller;await t.focusItem(e),await this.workspace.refreshReference()}async close(){const e=Cr(this).id,t=Cr(this).controller;await t.closeItem(e),await Cr(this).parent.removeChild(t=>t.id===e),await this.workspace.refreshReference()}async setTitle(e){v.runWithException(e);const t=Cr(this).id,r=Cr(this).controller;await r.setItemTitle(t,e),await this.workspace.refreshReference()}async maximize(){const e=Cr(this).id,t=Cr(this).controller;await t.maximizeItem(e),await this.workspace.refreshReference()}async restore(){const e=Cr(this).id,t=Cr(this).controller;await t.restoreItem(e),await this.workspace.refreshReference()}async eject(){if(!this.isLoaded)throw new Error("Cannot eject this window, because it is not loaded yet");const e=Cr(this).id,t=Cr(this).config.windowId,r=await Cr(this).controller.ejectWindow(e,t);return Cr(this).config.windowId=r,await this.workspace.refreshReference(),this.getGdWindow()}getGdWindow(){if(!this.isLoaded)throw new Error("Cannot fetch this GD window, because the window is not yet loaded");const e=Cr(this).config.windowId;return Cr(this).controller.getGDWindow(e)}async moveTo(e){if(!(e instanceof mr||e instanceof yr||e instanceof Wr))throw new Error("Cannot add to the provided parent, because the provided parent is not an instance of Row, Column or Group");const t=Cr(this).id,r=Cr(this).controller;if(!await r.getParent(t=>t.id===e.id))throw new Error("Cannot move the window to the selected parent, because this parent does not exist.");await r.moveWindowTo(t,e.id),await this.workspace.refreshReference()}async lock(e){let t;if("function"==typeof e){t=e({allowExtract:this.allowExtract,allowReorder:this.allowReorder,showCloseButton:this.showCloseButton})}else t=e;const r=void 0===t?void 0:bt.runWithException(t),o=Cr(this).id;await Cr(this).controller.lockWindow(o,r),await this.workspace.refreshReference()}async setSize(e){const t=kt.runWithException(e);if(!t.width&&!t.height)throw new Error("Expected either width or height to be passed.");const r=Cr(this).id,o=Cr(this).controller;await o.resizeItem(r,{height:t.height,width:t.width,relative:!1}),await this.workspace.refreshReference()}async onRemoved(e){O(e);const t=Cr(this).id,r={callback:async()=>{await this.workspace.refreshReference(),e()},action:"removed",eventType:"window",scope:"window"};return await Cr(this).controller.processLocalSubscription(r,t)}async onLockConfigurationChanged(e){O(e);const t=Cr(this).id,r={callback:async()=>{await this.workspace.refreshReference(),e({allowExtract:this.allowExtract,allowReorder:this.allowReorder,showCloseButton:this.showCloseButton})},action:"lock-configuration-changed",eventType:"window",scope:"window"};return await Cr(this).controller.processLocalSubscription(r,t)}}const Br=new WeakMap,Tr=e=>Br.get(e).manager.getFrameData(e);class Mr{constructor(e){Br.set(this,{manager:e})}async registerShortcut(e,t){v.runWithException(e),O(t);const r=Tr(this).summary.id;return await Tr(this).controller.registerShortcut(e,r,t)}get id(){return Tr(this).summary.id}get isInitialized(){return Tr(this).summary.isInitialized}getBounds(){const e=Tr(this).summary.id;return Tr(this).controller.getFrameBounds(e)}async resize(e){const t=Ue.runWithException(e),r=Tr(this).summary.id;return Tr(this).controller.resizeItem(r,t)}async move(e){const t=Ke.runWithException(e),r=Tr(this).summary.id;return Tr(this).controller.moveFrame(r,t)}focus(){const e=Tr(this).summary.id;return Tr(this).controller.focusItem(e)}async state(){if(!ir())throw new Error("State operations are not supported in IO Connect Browser");const e=Tr(this).summary.id;return Tr(this).controller.getFrameState(e)}setIcon(e){if(!ir())throw new Error("frame.setIcon() is not supported in IO Connect Browser");F.runWithException(e);const t=this.id;return Tr(this).controller.setTaskbarIcon(e,t)}getIcon(){if(!ir())throw new Error("frame.getIcon() is not supported in IO Connect Browser");const e=this.id;return Tr(this).controller.getTaskbarIcon(e)}isVisible(){if(!ir())throw new Error("frame.isVisible() is not supported in IO Connect Browser");const e=this.id;return Tr(this).controller.getFrameVisibility(e)}async minimize(){if(!ir())throw new Error("State operations are not supported in IO Connect Browser");const e=Tr(this).summary.id;return Tr(this).controller.changeFrameState(e,"minimized")}async maximize(){if(!ir())throw new Error("State operations are not supported in IO Connect Browser");const e=Tr(this).summary.id;return Tr(this).controller.changeFrameState(e,"maximized")}async restore(){if(!ir())throw new Error("State operations are not supported in IO Connect Browser");const e=Tr(this).summary.id;return Tr(this).controller.changeFrameState(e,"normal")}close(e){const t=I(Qe).runWithException(e),r=Tr(this).summary.id;return Tr(this).controller.closeFrame(r,t)}snapshot(){const e=Tr(this).summary.id;return Tr(this).controller.getSnapshot(e,"frame")}async workspaces(){return Tr(this).controller.getWorkspacesByFrameId(this.id)}async getConstraints(){const e=Tr(this).controller,t=Tr(this).summary.id;return e.getFrameConstraints(t)}async restoreWorkspace(e,t){v.runWithException(e);const r=ee.runWithException(t);return Tr(this).controller.restoreWorkspace(e,r)}createWorkspace(e,t){const r=re.runWithException(e),o=H.runWithException(t);return Tr(this).controller.createWorkspace(r,o)}async init(e){if(ae.runWithException(e),Tr(this).summary.isInitialized)throw new Error("The frame has already been initialized");return Tr(this).controller.initFrame(this.id,e)}async showPopup(e){if(!ir())throw new Error("Popup operations are not supported in IO Connect Browser");const t=Vt.runWithException(e),r=Tr(this).controller;return await r.showPopup(t,this.id),r.getGDWindow(t.windowId)}async show(e){if(!ir())throw new Error("The show operation is not supported in IO Connect Browser");const t=Ft.runWithException(e);return Tr(this).controller.showFrame(this.id,t)}async hide(){if(!ir())throw new Error("The hide operation is not supported in IO Connect Browser");return Tr(this).controller.hideFrame(this.id)}async showDialog(e){if(!ir())throw new Error("The showModal operation is not supported in IO Connect Browser");return Kt.runWithException(e),Tr(this).controller.showFrameDialog(this.id,e)}async onClosing(e){if(!ir())throw new Error("Frame closing operations are not supported in io.Connect Browser");O(e);return await Tr(this).controller.registerFrameOnClosing(this.id,async()=>{let t=!1;return await e({prevent:()=>t=!0}),{prevent:t}})}async onClosed(e){O(e);const t=Tr(this).summary.id,r={callback:t=>{e({frameId:t.frameSummary.id,frameBounds:t.frameBounds})},action:"closed",eventType:"frame",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onMaximized(e){O(e);const t=Tr(this).summary.id,r={callback:()=>{e()},action:"maximized",eventType:"frame",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onMinimized(e){O(e);const t=Tr(this).summary.id,r={callback:()=>{e()},action:"minimized",eventType:"frame",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onNormal(e){O(e);const t=Tr(this).summary.id,r={callback:()=>{e()},action:"normal",eventType:"frame",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onWorkspaceOpened(e){O(e);const t=Tr(this).summary.id,r={callback:async t=>{const r=await Tr(this).controller.transformStreamPayloadToWorkspace(t);e(r)},action:"opened",eventType:"workspace",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onWorkspaceSelected(e){O(e);const t=Tr(this).summary.id,r={callback:async t=>{const r=await Tr(this).controller.getWorkspaceById(t.workspaceSummary.id);e(r)},action:"selected",eventType:"workspace",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onWorkspaceClosed(e){O(e);const t=Tr(this).summary.id,r={callback:t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})},action:"closed",eventType:"workspace",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onWindowAdded(e){O(e);const t=Tr(this).summary.id,r={callback:async t=>{const r=(await Tr(this).controller.getParent(e=>e.id===t.windowSummary.parentId)).children.find(e=>"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex);e(r)},action:"added",eventType:"window",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onWindowRemoved(e){O(e);const t=Tr(this).summary.id,r={callback:t=>{const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})},action:"removed",eventType:"window",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onWindowLoaded(e){O(e);const t=Tr(this).summary.id,r={callback:async t=>{const r=(await Tr(this).controller.getParent(e=>e.id===t.windowSummary.parentId)).children.find(e=>"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex);e(r)},action:"loaded",eventType:"window",scope:"frame"};return await Tr(this).controller.processLocalSubscription(r,t)}async onInitializationRequested(e){return O(e),this.isInitialized||e(Tr(this).summary.initializationContext),()=>{}}async onFocusChanged(e){O(e);const t=Tr(this),{id:r}=t.summary,o={callback:t=>{e({isFocused:t.frameSummary.isFocused})},action:"focus",eventType:"frame",scope:"frame"};return await t.controller.processLocalSubscription(o,r)}}class Fr{parentsData=new WeakMap;workspacesData=new WeakMap;windowsData=new WeakMap;framesData=new WeakMap;deleteData(e){e instanceof Er&&this.windowsData.delete(e),e instanceof Dr&&this.workspacesData.delete(e),(e instanceof mr||e instanceof yr||e instanceof Wr)&&this.parentsData.delete(e),e instanceof Mr&&this.framesData.delete(e)}setWindowData(e,t){this.windowsData.set(e,t)}setWorkspaceData(e,t){this.workspacesData.set(e,t)}setParentData(e,t){this.parentsData.set(e,t)}setFrameData(e,t){this.framesData.set(e,t)}getWindowData(e){return this.windowsData.get(e)}getWorkspaceData(e){return this.workspacesData.get(e)}getParentData(e){return this.parentsData.get(e)}getFrameData(e){return this.framesData.get(e)}remapChild(e,t){if(e instanceof Er){const r=this.windowsData.get(e);r.parent=t.parent||r.parent,r.config=t.config||r.config}if(e instanceof mr||e instanceof yr||e instanceof Wr){const r=this.parentsData.get(e);r.parent=t.parent||r.parent,r.config=t.config||r.config,r.children=t.children||r.children}}remapFrame(e,t){this.framesData.get(e).summary=t}remapWorkspace(e,t){const r=this.workspacesData.get(e);r.frame=t.frame||r.frame,r.config=t.config||r.config,r.children=t.children||r.children}}const Rr=new WeakMap,Lr=(e,t)=>{const r=Rr.get(e).manager;return t instanceof Dr?r.getWorkspaceData(t):Rr.get(e).manager.getParentData(t)};class Ar{frameId;workspaceId;positionIndex;constructor(e){Rr.set(this,{manager:e})}getId(e){return Lr(this,e).id}getPositionIndex(e){return Lr(this,e).config.positionIndex}getWorkspaceId(e){const t=Lr(this,e);return t.config.workspaceId||t.workspace.id}getFrameId(e){return Lr(this,e).frame.id}getAllChildren(e,t){O(t,!0);const r=Lr(this,e).children;return void 0===t?r:r.filter(t)}getMyParent(e){return e instanceof Dr?e:Lr(this,e).parent}getMyFrame(e){return Lr(this,e).frame}getMyWorkspace(e){return e instanceof Dr?e:Lr(this,e).workspace}async addWindow(e,t,r){if(!t.appName&&!t.windowId)throw new Error("The window definition should contain either an appName or a windowId");const o=V.runWithException(t),n=Lr(this,e).controller,i=await n.add("window",Lr(this,e).id,r,o);if(e instanceof Dr)return await e.refreshReference(),e.getWindow(e=>e.elementId===i.itemId);const a=this.getMyWorkspace(e);return await a.refreshReference(),a.getWindow(e=>e.elementId===i.itemId)}async addParent(e,t,r,o){const n=this.transformDefinition(t,o),i=Lr(this,e).controller,a=(await i.add("container",Lr(this,e).id,r,n)).itemId;if(e instanceof Dr)return await e.refreshReference(),e.getBox(e=>e.id===a);const s=this.getMyWorkspace(e);return await s.refreshReference(),s.getBox(e=>e.id===a)}async removeChild(e,t){O(t);const r=this.getAllChildren(e).find(t);r&&(await r.close(),e instanceof Dr?await e.refreshReference():await this.getMyWorkspace(e).refreshReference())}async maximize(e){const{controller:t,id:r}=Lr(this,e);await t.maximizeItem(r),await this.getMyWorkspace(e.parent).refreshReference()}async restore(e){const{controller:t,id:r}=Lr(this,e);await t.restoreItem(r),await this.getMyWorkspace(e.parent).refreshReference()}async close(e){const t=Lr(this,e),r=Lr(this,e).controller;await r.closeItem(t.id),await this.getMyWorkspace(t.parent).refreshReference()}async lockContainer(e,t){const r=Lr(this,e),o=Lr(this,e).controller;await o.lockContainer(r.id,e.type,t),await this.getMyWorkspace(r.parent).refreshReference()}getAllowDrop(e){return Lr(this,e).config.allowDrop}getAllowDropLeft(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Property allowDropLeft is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropLeft}getAllowDropRight(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Property allowDropRight is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropRight}getAllowDropTop(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Property allowDropTop is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropTop}getAllowDropBottom(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Property allowDropBottom is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropBottom}getAllowDropHeader(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Property allowDropHeader is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropHeader}getAllowSplitters(e){const t=Lr(this,e);if("group"===t.type)throw new Error(`Cannot get allow splitters from private data ${t.type}`);return t.config.allowSplitters}getAllowExtract(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Cannot get allow extract from private data ${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.allowExtract}getAllowReorder(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Cannot get allow extract from private data ${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.allowReorder}getShowMaximizeButton(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Cannot get show maximize button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showMaximizeButton}getShowEjectButton(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Cannot get show eject button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showEjectButton}getShowAddWindowButton(e){const t=Lr(this,e);if("group"!==t.type)throw new Error(`Cannot get add window button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showAddWindowButton}getMinWidth(e){return Lr(this,e).config.minWidth}getMaxWidth(e){return Lr(this,e).config.maxWidth}getMinHeight(e){return Lr(this,e).config.minHeight}getMaxHeight(e){return Lr(this,e).config.maxHeight}getWidthInPx(e){return Lr(this,e).config.widthInPx}getHeightInPx(e){return Lr(this,e).config.heightInPx}getIsPinned(e){return Lr(this,e).config.isPinned}getIsMaximized(e){return Lr(this,e).config.isMaximized}getMaximizationBoundary(e){return Lr(this,e).config.maximizationBoundary}async setHeight(e,t){const r=Lr(this,e),{controller:o,id:n}=r;await o.resizeItem(n,{height:t}),await this.getMyWorkspace(r.parent).refreshReference()}async setWidth(e,t){const r=Lr(this,e),{controller:o,id:n}=r;await o.resizeItem(n,{width:t}),await this.getMyWorkspace(r.parent).refreshReference()}async setSize(e,t,r){const o=Lr(this,e),{controller:n,id:i}=o;await n.resizeItem(i,{width:t,height:r}),await this.getMyWorkspace(o.parent).refreshReference()}async setMaximizationBoundary(e,t){const r=Lr(this,e),{controller:o,id:n}=r;await o.setMaximizationBoundary(n,t),await this.getMyWorkspace(r.parent).refreshReference()}async bundleTo(e,t){const r=Lr(this,e),{controller:o,id:n}=r;await o.bundleItemTo(t,n)}async processLocalSubscription(e,t){return Lr(this,e).controller.processLocalSubscription(t,this.getId(e))}transformDefinition(e,t){let r;return void 0===t?r={type:e,children:[]}:t instanceof dr?r=t.serialize():(void 0===t.type&&(t.type=e),r=X.runWithException(t),r.children=r.children||[]),r}}class Pr{ioc;windows;contexts;layouts;constructor(e,t,r,o){this.ioc=e,this.windows=t,this.contexts=r,this.layouts=o}get bridge(){return this.ioc.bridge}get privateDataManager(){return this.ioc.privateDataManager}checkIsWindowLoaded(e){return!!e&&this.windows.list().some(t=>t.id===e)}async createWorkspace(e){const t=await this.bridge.send(rr.createWorkspace.name,e),r={summary:t.frameSummary},o={frame:this.ioc.getModel("frame",r),snapshot:t};return this.ioc.getModel("workspace",o)}async createEmptyFrame(e){const t={summary:await this.bridge.send(rr.createFrame.name,e)};return this.ioc.getModel("frame",t)}async initFrame(e,t){await this.bridge.send(rr.initFrame.name,{frameId:e,...t})}async restoreWorkspace(e,t){const r=await this.bridge.send(rr.openWorkspace.name,{name:e,restoreOptions:t}),o={summary:await this.bridge.send(rr.getFrameSummary.name,{itemId:r.config.frameId})},n={frame:this.ioc.getModel("frame",o),snapshot:r};return this.ioc.getModel("workspace",n)}async add(e,t,r,o){let n;const i={definition:o,parentId:t,parentType:r};if("window"===e)n=rr.addWindow.name;else{if("container"!==e)throw new Error(`Unrecognized add type: ${e}`);n=rr.addContainer.name}return await this.bridge.send(n,i)}async getFrame(e){const t={summary:await this.bridge.send(rr.getFrameSummary.name,{itemId:e})};return this.ioc.getModel("frame",t)}getFrames(e,t){return e.reduce((e,r)=>{const o={summary:r},n=this.ioc.getModel("frame",o);return t&&!t(n)||e.push(n),e},[])}getAllWorkspaceSummaries(...e){return e.reduce((e,t)=>(e.push(...t.summaries),e),[]).map(e=>Object.assign({},{id:e.id,width:e.config.widthInPx,height:e.config.heightInPx},e.config))}handleOnSaved(e){const t=t=>{"Workspace"===t.type&&e(t)},r=this.layouts.onAdded(t),o=this.layouts.onChanged(t);return()=>{r(),o()}}handleOnRemoved(e){return this.layouts.onRemoved(t=>{"Workspace"===t.type&&e(t)})}async importLayouts(e,t){await this.layouts.import(e,t)}async transformStreamPayloadToWorkspace(e){const t={summary:e.frameSummary},r={frame:this.ioc.getModel("frame",t),snapshot:e.workspaceSnapshot||await this.bridge.send(rr.getWorkspaceSnapshot.name,{itemId:e.workspaceSummary.id})};return this.ioc.getModel("workspace",r)}async fetchWorkspace(e){const t=await this.bridge.send(rr.getWorkspaceSnapshot.name,{itemId:e}),r={summary:t.frameSummary},o={frame:this.ioc.getModel("frame",r),snapshot:t};return this.ioc.getModel("workspace",o)}async bundleWorkspaceTo(e,t){await this.bridge.send(rr.bundleWorkspace.name,{type:e,workspaceId:t})}async bundleItemTo(e,t){if(!await this.isOperationSupported(rr.bundleItem.name))throw new Error(`Operation ${rr.bundleItem.name} is not supported. Ensure that you are running the latest version of all packages`);await this.bridge.send(rr.bundleItem.name,{type:e,itemId:t})}async getTaskbarIcon(e){return await this.bridge.send(rr.getTaskbarIcon.name,{frameId:e})}async setTaskbarIcon(e,t){await this.bridge.send(rr.setTaskbarIcon.name,{icon:e,frameId:t})}getWorkspaceContext(e){const t=`___workspace___${e}`;return this.contexts.get(t)}setWorkspaceContext(e,t){const r=`___workspace___${e}`;return this.contexts.set(r,t)}updateWorkspaceContext(e,t){const r=`___workspace___${e}`;return this.contexts.update(r,t)}subscribeWorkspaceContextUpdated(e,t){const r=`___workspace___${e}`;return this.contexts.subscribe(r,t)}async restoreItem(e){await this.bridge.send(rr.restoreItem.name,{itemId:e})}async maximizeItem(e){await this.bridge.send(rr.maximizeItem.name,{itemId:e})}async focusItem(e){await this.bridge.send(rr.focusItem.name,{itemId:e})}async closeWorkspace(e){await this.bridge.send(rr.closeWorkspace.name,{itemId:e})}async closeItem(e){await this.bridge.send(rr.closeItem.name,{itemId:e})}async closeFrame(e,t){await this.bridge.send(rr.closeItem.name,{itemId:e,closeOptions:t})}async resizeItem(e,t){await this.bridge.send(rr.resizeItem.name,Object.assign({},{itemId:e},t))}async setMaximizationBoundary(e,t){await this.bridge.send(rr.setMaximizationBoundary.name,Object.assign({},{itemId:e},t))}async showWorkspaceLoadingAnimation(e){await this.bridge.send(rr.showLoadingAnimation.name,{itemId:e,type:"workspace"})}async hideWorkspaceLoadingAnimation(e){await this.bridge.send(rr.hideLoadingAnimation.name,{itemId:e,type:"workspace"})}async setWindowDragMode(e,t){await this.bridge.send(rr.setWindowDragMode.name,{itemId:e,dragMode:t})}async moveFrame(e,t){await this.bridge.send(rr.moveFrame.name,Object.assign({},{itemId:e},t))}getGDWindow(e){return this.windows.list().find(t=>t.id===e)}async forceLoadWindow(e){return(await this.bridge.send(rr.forceLoadWindow.name,{itemId:e})).windowId}async ejectWindow(e,t){return await this.bridge.send(rr.ejectWindow.name,{itemId:e,windowId:t})}async moveWindowTo(e,t){await this.bridge.send(rr.moveWindowTo.name,{itemId:e,containerId:t})}async getSnapshot(e,t){let r;return"workspace"===t?r=await this.bridge.send(rr.getWorkspaceSnapshot.name,{itemId:e}):"frame"===t&&(r=await this.bridge.send(rr.getFrameSnapshot.name,{itemId:e})),r}async setItemTitle(e,t){await this.bridge.send(rr.setItemTitle.name,{itemId:e,title:t})}refreshChildren(e){const{parent:t,children:r,existingChildren:o,workspace:n}=e;if(t instanceof Er||"window"===t.type)return;const i=r.map(e=>{let r=o.find(t=>"window"===t.type?t.elementId===e.id:t.id===e.id);if(r)this.privateDataManager.remapChild(r,{parent:t,children:[],config:e.config});else{let o;o="window"===e.type?{id:e.id,parent:t,frame:n.frame,workspace:n,config:e.config}:{id:e.id,parent:t,frame:n.frame,workspace:n,config:e.config,children:[]},r=this.ioc.getModel(e.type,o)}return"window"!==e.type&&this.refreshChildren({workspace:n,existingChildren:o,children:e.children,parent:r}),r});return t instanceof Dr||this.privateDataManager.remapChild(t,{children:i}),i}iterateFindChild(e,t){let r=e.find(e=>t(e));return r||(e.some(e=>!(e instanceof Er)&&(r=this.iterateFindChild(e.children,t),!!r||void 0)),r)}iterateFilterChildren(e,t){const r=e.filter(e=>t(e)),o=e.reduce((e,r)=>(r instanceof Er||e.push(...this.iterateFilterChildren(r.children,t)),e),[]);return r.push(...o),r}notifyWindowAdded(e){return new Promise(t=>{if(this.windows.list().some(t=>t.id===e))return t();const r=this.windows.onWindowAdded(o=>{o.id===e&&(r&&r(),t())})})}async hibernateWorkspace(e){await this.bridge.send(rr.hibernateWorkspace.name,{workspaceId:e})}async resumeWorkspace(e){await this.bridge.send(rr.resumeWorkspace.name,{workspaceId:e})}async lockWorkspace(e,t){await this.bridge.send(rr.lockWorkspace.name,{workspaceId:e,config:t})}async lockWindow(e,t){await this.bridge.send(rr.lockWindow.name,{windowPlacementId:e,config:t})}async lockContainer(e,t,r){await this.bridge.send(rr.lockContainer.name,{itemId:e,type:t,config:r})}async pinWorkspace(e,t){await this.bridge.send(rr.pinWorkspace.name,{workspaceId:e,icon:t})}async unpinWorkspace(e){await this.bridge.send(rr.unpinWorkspace.name,{workspaceId:e})}async getWorkspaceIcon(e){return(await this.bridge.send(rr.getWorkspaceIcon.name,{workspaceId:e})).icon}setWorkspaceIcon(e,t){return this.bridge.send(rr.setWorkspaceIcon.name,{workspaceId:e,icon:t})}async getPlatformFrameId(){try{return await this.bridge.send(rr.getPlatformFrameId.name,{})}catch(e){return{}}}async setLoadingStrategy(e,t){return await this.isOperationSupported(rr.setLoadingStrategy.name),this.bridge.send(rr.setLoadingStrategy.name,{itemId:e,strategy:t})}async showFrame(e,t){const r={frameId:e,isVisible:!0,...t};return this.bridge.send(rr.changeFrameVisibility.name,r)}async hideFrame(e){return this.bridge.send(rr.changeFrameVisibility.name,{frameId:e,isVisible:!1})}async getFrameVisibility(e){return(await this.bridge.send(rr.getFrameVisibility.name,{itemId:e})).isVisible}async showFrameDialog(e,t){return await this.bridge.send(rr.showFrameDialog.name,{frameId:e,options:t})}async isOperationSupported(e){return ir()?{isSupported:!0}:await this.bridge.send(rr.operationCheck.name,{operation:e})}async showPopup(e,t){return this.bridge.send(rr.showPopup.name,{...e,frameId:t})}}class zr{bridge;base;shortcutsController;closingController;constructor(e,t,r,o){this.bridge=e,this.base=t,this.shortcutsController=r,this.closingController=o}setTaskbarIcon(e,t){return this.base.setTaskbarIcon(e,t)}getTaskbarIcon(e){return this.base.getTaskbarIcon(e)}checkIsWindowLoaded(e){return this.base.checkIsWindowLoaded(e)}async checkIsInSwimlane(e){return(await this.bridge.send(rr.isWindowInWorkspace.name,{itemId:e})).inWorkspace}async createWorkspace(e,t){const r=Object.assign({},e,{saveConfig:t});return await this.base.createWorkspace(r)}async createEmptyFrame(e){return await this.base.createEmptyFrame(e)}async initFrame(e,t){return this.base.initFrame(e,t)}async restoreWorkspace(e,t){if(!(await this.getLayoutSummaries()).some(t=>t.name===e))throw new Error(`This layout: ${e} cannot be restored, because it doesn't exist.`);if(t?.frameId){if(!(await this.bridge.send(rr.getAllFramesSummaries.name)).summaries.some(e=>e.id===t.frameId))throw new Error(`Cannot reuse the frame with id: ${t.frameId}, because there is no frame with that ID found`)}return await this.base.restoreWorkspace(e,t)}async add(e,t,r,o){return await this.base.add(e,t,r,o)}processLocalSubscription(e,t){return ir()?this.handleEnterpriseLocalSubscription(e,t):this.handleCoreLocalSubscription(e,t)}processGlobalSubscription(e,t,r){return ir()?this.handleEnterpriseGlobalSubscription(e,t,r):this.handleCoreGlobalSubscription(e,t,r)}async getFrame(e){if(e.windowId)return await this.base.getFrame(e.windowId);if(e.predicate)return(await this.getFrames(e.predicate))[0];throw new Error(`The provided selector is not valid: ${JSON.stringify(e)}`)}async getFrames(e){const t=await this.bridge.send(rr.getAllFramesSummaries.name);return this.base.getFrames(t.summaries,e)}getWorkspaceById(e){return this.base.fetchWorkspace(e)}async getWorkspaceByWindowId(e){return ir()?this.base.fetchWorkspace(e):(await this.getWorkspaces(t=>!!t.getWindow(t=>t.id===e)))[0]}transformStreamPayloadToWorkspace(e){return this.base.transformStreamPayloadToWorkspace(e)}async getWorkspace(e){let t;return await this.iterateWorkspaces((r,o)=>{e(r)&&(t=r,o())}),t}async getWorkspaces(e){const t=[];return await this.iterateWorkspaces(r=>{e&&!e(r)||t.push(r)}),t}async getWorkspacesByFrameId(e){const t=(await this.getAllWorkspaceSummaries()).filter(t=>t.frameId===e);return await Promise.all(t.map(e=>this.base.fetchWorkspace(e.id)))}async isLastWorkspaceInFrame(e,t){const r=(await this.getAllWorkspaceSummaries()).filter(e=>e.frameId===t);return 1===r.length&&r[0].id===e}async getAllWorkspaceSummaries(){const e=await this.bridge.send(rr.getAllWorkspacesSummaries.name,{});return this.base.getAllWorkspaceSummaries(e)}async getWindow(e){let t;return await this.iterateWorkspaces((r,o)=>{const n=r.getWindow(e);n&&(t=n,o())}),t}async getParent(e){let t;return await this.iterateWorkspaces((r,o)=>{const n=r.getBox(e);n&&(t=n,o())}),t}async getLayoutSummaries(){return(await this.bridge.send(rr.getAllLayoutsSummaries.name)).summaries}async deleteLayout(e){await this.bridge.send(rr.deleteLayout.name,{name:e})}async exportLayout(e){return(await this.bridge.send(rr.exportAllLayouts.name)).layouts.reduce((t,r)=>(e&&!e(r)||t.push(r),t),[])}async saveLayout(e){return await this.bridge.send(rr.saveLayout.name,e)}async importLayouts(e,t){if(ir())try{await this.bridge.send(rr.importLayouts.name,{layouts:e,mode:t})}catch(r){await Promise.all(e.map(e=>this.bridge.send(rr.importLayout.name,{layout:e,mode:t})))}else await this.base.importLayouts(e,t)}handleOnSaved(e){return this.base.handleOnSaved(e)}handleOnRemoved(e){return this.base.handleOnRemoved(e)}async bundleWorkspaceTo(e,t){return await this.base.bundleWorkspaceTo(e,t)}async bundleItemTo(e,t){return await this.base.bundleItemTo(e,t)}getWorkspaceContext(e){return this.base.getWorkspaceContext(e)}setWorkspaceContext(e,t){return this.base.setWorkspaceContext(e,t)}updateWorkspaceContext(e,t){return this.base.updateWorkspaceContext(e,t)}subscribeWorkspaceContextUpdated(e,t){return this.base.subscribeWorkspaceContextUpdated(e,t)}async restoreItem(e){return await this.base.restoreItem(e)}async maximizeItem(e){return await this.base.maximizeItem(e)}async focusItem(e){return await this.base.focusItem(e)}async changeFrameState(e,t){await this.bridge.send(rr.changeFrameState.name,{frameId:e,requestedState:t})}async getFrameBounds(e){return(await this.bridge.send(rr.getFrameBounds.name,{itemId:e})).bounds}async getFrameState(e){return(await this.bridge.send(rr.getFrameState.name,{itemId:e})).state}async closeWorkspace(e,t){if(ir())return await this.closeItem(e);let r=!1;try{const{isSupported:e}=await this.base.isOperationSupported(rr.closeWorkspace.name);r=e}catch(e){r=!1}return r?await this.base.closeWorkspace(e):await this.legacyCloseWorkspace(e,t)}async closeItem(e){return await this.base.closeItem(e)}async closeFrame(e,t){return await this.base.closeFrame(e,t)}async resizeItem(e,t){return await this.base.resizeItem(e,t)}async setMaximizationBoundary(e,t){return await this.base.setMaximizationBoundary(e,t)}async showWorkspaceLoadingAnimation(e){return await this.base.showWorkspaceLoadingAnimation(e)}async hideWorkspaceLoadingAnimation(e){return await this.base.hideWorkspaceLoadingAnimation(e)}async setWindowDragMode(e,t){return await this.base.setWindowDragMode(e,t)}async moveFrame(e,t){return await this.base.moveFrame(e,t)}getGDWindow(e){return this.base.getGDWindow(e)}async forceLoadWindow(e){const t=await this.base.forceLoadWindow(e);return await this.base.notifyWindowAdded(t),t}async ejectWindow(e,t){const r=(await this.base.ejectWindow(e,t)).windowId;return await this.base.notifyWindowAdded(r),r}async moveWindowTo(e,t){return await this.base.moveWindowTo(e,t)}async getSnapshot(e,t){return await this.base.getSnapshot(e,t)}async setItemTitle(e,t){return await this.base.setItemTitle(e,t)}flatChildren(e){return e.reduce((e,t)=>(e.push(t),"window"!==t.type&&e.push(...this.flatChildren(t.children)),e),[])}refreshChildren(e){return this.base.refreshChildren(e)}iterateFindChild(e,t){return this.base.iterateFindChild(e,t)}iterateFilterChildren(e,t){return this.base.iterateFilterChildren(e,t)}hibernateWorkspace(e){return this.base.hibernateWorkspace(e)}resumeWorkspace(e){return this.base.resumeWorkspace(e)}lockWorkspace(e,t){return this.base.lockWorkspace(e,t)}lockWindow(e,t){return this.base.lockWindow(e,t)}lockContainer(e,t,r){return this.base.lockContainer(e,t,r)}pinWorkspace(e,t){return this.base.pinWorkspace(e,t)}unpinWorkspace(e){return this.base.unpinWorkspace(e)}getWorkspaceIcon(e){return this.base.getWorkspaceIcon(e)}setWorkspaceIcon(e,t){return this.base.setWorkspaceIcon(e,t)}async getFrameConstraints(e){const t=await this.getSnapshot(e,"frame");return{minWidth:t.config.minWidth,maxWidth:t.config.maxWidth,minHeight:t.config.minHeight,maxHeight:t.config.maxHeight}}registerShortcut(e,t,r){return this.shortcutsController.registerShortcut(e,t,r)}getPlatformFrameId(){return this.base.getPlatformFrameId()}setLoadingStrategy(e,t){return this.base.setLoadingStrategy(e,t)}registerFrameOnClosing(e,t){return this.closingController.registerFrameOnClosing(e,t)}showPopup(e,t){return this.base.showPopup(e,t)}async showFrame(e,t){return this.base.showFrame(e,t)}async hideFrame(e){return this.base.hideFrame(e)}async getFrameVisibility(e){return this.base.getFrameVisibility(e)}async showFrameDialog(e,t){return this.base.showFrameDialog(e,t)}async handleCoreLocalSubscription(e,t){if(await this.bridge.createCoreEventSubscription(),e.scopeId=e.scopeId||t,"window"===e.eventType&&"loaded"===e.action){const t=e.callback,r=async e=>{await this.base.notifyWindowAdded(e.windowSummary.config.windowId),t(e)};e.callback=r}return this.bridge.handleCoreSubscription(e)}handleEnterpriseLocalSubscription(e,t){if(e.scopeId=e.scopeId||t,"window"===e.eventType&&"loaded"===e.action){const t=e.callback,r=async e=>{await this.base.notifyWindowAdded(e.windowSummary.config.windowId),t(e)};e.callback=r}return this.bridge.subscribe(e)}async handleCoreGlobalSubscription(e,t,r){await this.bridge.createCoreEventSubscription();const o={eventType:t,callback:e,action:r,scope:"global"};if("window"===t&&"loaded"===r){const t=async t=>{await this.base.notifyWindowAdded(t.windowSummary.config.windowId),e(t)};o.callback=t}return this.bridge.handleCoreSubscription(o)}handleEnterpriseGlobalSubscription(e,t,r){const o={eventType:t,callback:e,action:r,scope:"global"};if("window"===t&&"loaded"===r){const t=async t=>{await this.base.notifyWindowAdded(t.windowSummary.config.windowId),e(t)};o.callback=t}return this.bridge.subscribe(o)}async iterateWorkspaces(e){let t=!1;const r=()=>{t=!0},o=await this.getAllWorkspaceSummaries();for(const n of o){if(t)return;e(await this.base.fetchWorkspace(n.id),r)}}async legacyCloseWorkspace(e,t){const r=await this.isLastWorkspaceInFrame(e,t),o=(await this.getPlatformFrameId()).id;if(r&&o!==t)return await this.closeFrame(t,{});await this.closeItem(e)}}class Or{bridge;_shortcuts=r();constructor(e){this.bridge=e,this.bridge.onOperation(e=>{if(e.operation===tr.shortcutClicked.name){const t=e.data;this._shortcuts.execute(`${t.frameId}-${t.shortcut}`)}})}async registerShortcut(e,t,r){await this.bridge.send(rr.registerShortcut.name,{shortcut:e,frameId:t});const o=this._shortcuts.add(`${t}-${e}`,r);return()=>{o(),this.bridge.send(rr.unregisterShortcut.name,{shortcut:e,frameId:t})}}}class Hr{bridge;registry=r();constructor(e){this.bridge=e,this.subscribeToFrameClosing()}async registerFrameOnClosing(e,t){return await this.bridge.send(rr.subscribeToFrameClosing.name,{itemId:e}),this.registry.add(e,t)}subscribeToFrameClosing(){this.bridge.onOperationWithResponse(async e=>{if(e.operation!==tr.frameClosing.name)return;const t=e.data,r=await Promise.all(this.registry.execute(t.frameId));return this.aggregateFrameClosingResult(r)})}aggregateFrameClosingResult(e){return{prevent:e.some(e=>e?.prevent)}}}class $r{agm;windows;layouts;contexts;_controllerInstance;_bridgeInstance;_transportInstance;_privateDataManagerInstance;_parentBaseInstance;_baseController;_shortcutsController;_closingController;constructor(e,t,r,o){this.agm=e,this.windows=t,this.layouts=r,this.contexts=o}get baseController(){return this._baseController||(this._baseController=new Pr(this,this.windows,this.contexts,this.layouts)),this._baseController}get controller(){return this._controllerInstance||(this._controllerInstance=new zr(this.bridge,this.baseController,this.shortcutsController,this.closingController)),this._controllerInstance}get shortcutsController(){return this._shortcutsController||(this._shortcutsController=new Or(this.bridge)),this._shortcutsController}get closingController(){return this._closingController||(this._closingController=new Hr(this.bridge)),this._closingController}get bridge(){return this._bridgeInstance||(this._bridgeInstance=new nr(this.transport,r())),this._bridgeInstance}get transport(){return this._transportInstance||(this._transportInstance=new sr(this.agm,r())),this._transportInstance}get privateDataManager(){return this._privateDataManagerInstance||(this._privateDataManagerInstance=new Fr),this._privateDataManagerInstance}get parentBase(){return this._parentBaseInstance||(this._parentBaseInstance=new Ar(this.privateDataManager)),this._parentBaseInstance}async initiate(e){await this.transport.initiate(e)}getModel(e,t){switch(e){case"frame":{const e=new Mr(this.privateDataManager),{summary:r}=t,o={summary:r,controller:this.controller};return this.privateDataManager.setFrameData(e,o),e}case"window":{const{id:e,parent:r,frame:o,workspace:n,config:i}=t,a={type:"window",controller:this.controller,config:i,id:e,parent:r,frame:o,workspace:n},s=new Er(this.privateDataManager);return this.privateDataManager.setWindowData(s,a),s}case"row":case"column":case"group":{const{id:r,children:o,parent:n,frame:i,workspace:a,config:s}=t,c="column"===e?new yr(this.parentBase):"row"===e?new mr(this.parentBase):new Wr(this.parentBase),d=this.buildChildren(o,i,a,c),l={id:r,parent:n,frame:i,workspace:a,config:s,type:e,controller:this.controller,children:d};return this.privateDataManager.setParentData(c,l),c}case"workspace":{const{snapshot:e,frame:r}=t,o=new Dr(this.privateDataManager),n=this.buildChildren(e.children,r,o,o),i={id:e.id,type:"workspace",config:e.config,base:this.parentBase,controller:this.controller,children:n,frame:r,ioc:this};return this.privateDataManager.setWorkspaceData(o,i),o}default:throw new Error(`Unrecognized type: ${e}`)}}getBuilder(e){e.definition=e.definition||{},Array.isArray(e.definition.children)||(e.definition.children=[]);const t=new lr(this.getBuilder.bind(this));switch(e.type){case"workspace":return new ur(e.definition,t,this.controller);case"row":case"column":case"group":return e.definition.type=e.type,new dr(e.definition,t);default:throw new Error(`Unexpected Builder creation error, provided config: ${JSON.stringify(e)}`)}}buildChildren(e,t,r,o){return e.map(e=>{switch(e.type){case"window":return this.getModel("window",{id:e.id,config:e.config,frame:t,workspace:r,parent:o});case"column":case"row":case"group":return this.getModel(e.type,{id:e.id,config:e.config,children:e.children,frame:t,workspace:r,parent:o});default:throw new Error(`Unsupported child type: ${e.type}`)}})}}const _r=async e=>{const t=new $r(e.agm,e.windows,e.layouts,e.contexts),r=e.interop.instance.windowId;await t.initiate(r),e.workspaces=((e,t)=>{const r=t.controller,o=async e=>(O(e,!0),r.getFrames(e)),n=async e=>(O(e),await r.processGlobalSubscription(r=>{const o={summary:r.frameSummary},n=t.getModel("frame",o);e(n)},"frame","opened"));return{inWorkspace:()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my frame, because my id is undefined.");return r.checkIsInSwimlane(t)},getBuilder:e=>{const r=ce.runWithException(e);return t.getBuilder(r)},getMyFrame:async()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my frame, because my id is undefined.");if(!await r.checkIsInSwimlane(t))throw new Error("Cannot fetch your frame, because this window is not in a workspace");return r.getFrame({windowId:t})},getFrame:async e=>(O(e),r.getFrame({predicate:e})),getAllFrames:o,getAllWorkspacesSummaries:()=>r.getAllWorkspaceSummaries(),getMyWorkspace:async()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my workspace, because my id is undefined.");if(!await r.checkIsInSwimlane(t))throw new Error("Cannot fetch your workspace, because this window is not in a workspace");return await r.getWorkspaceByWindowId(t)},getWorkspace:async e=>(O(e),(await r.getWorkspaces(e))[0]),getWorkspaceById:async e=>(v.runWithException(e),r.getWorkspaceById(e)),getAllWorkspaces:e=>(O(e,!0),r.getWorkspaces(e)),getWindow:async e=>(O(e),r.getWindow(e)),getBox:async e=>(O(e),r.getParent(e)),restoreWorkspace:async(e,t)=>{v.runWithException(e);const o=ee.runWithException(t);return r.restoreWorkspace(e,o)},createWorkspace:async(e,t)=>{const o=re.runWithException(e),n=H.runWithException(t);return r.createWorkspace(o,n)},createEmptyFrame:async e=>{const t=ie.runWithException(e);return r.createEmptyFrame(t??{})},waitForFrame:async e=>(v.runWithException(e),new Promise((t,r)=>{let i=()=>{};n(r=>{r.id===e&&(t(r),i())}).then(e=>(i=e,o())).then(r=>{const o=r.find(t=>t.id===e);o&&(t(o),i())}).catch(r)})),layouts:{getSummaries:()=>r.getLayoutSummaries(),delete:async e=>(v.runWithException(e),r.deleteLayout(e)),export:async e=>(O(e,!0),r.exportLayout(e)),import:async(e,t="replace")=>{if(!Array.isArray(e))throw new Error(`The provided layouts argument is not an array: ${JSON.stringify(e)}`);return e.forEach(e=>Ee.runWithException(e)),r.importLayouts(e,t)},save:async e=>{const t=gt.runWithException(e);return r.saveLayout(t)},onSaved:async e=>(O(e),r.handleOnSaved(e)),onRemoved:async e=>(O(e),r.handleOnRemoved(e))},onFrameOpened:n,onFrameClosed:async e=>(O(e),await r.processGlobalSubscription(t=>{e({frameId:t.frameSummary.id,frameBounds:t.frameBounds})},"frame","closed")),onWorkspaceOpened:async e=>(O(e),await r.processGlobalSubscription(async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)},"workspace","opened")),onWorkspaceClosed:async e=>(O(e),await r.processGlobalSubscription(t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})},"workspace","closed")),onWorkspaceHibernated:async e=>(O(e),await r.processGlobalSubscription(async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)},"workspace","hibernated")),onWorkspaceResumed:async e=>(O(e),await r.processGlobalSubscription(async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)},"workspace","resumed")),onWindowAdded:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox(e=>e.id===o.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===o.windowSummary.itemId);e(s)},"window","added")),onWindowLoaded:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getWindow(e=>e.id&&e.id===o.windowSummary.config.windowId);e(s)},"window","loaded")),onWindowRemoved:async e=>(O(e),await r.processGlobalSubscription(t=>{const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})},"window","removed")),onWindowMaximized:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox(e=>e.id===o.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===o.windowSummary.itemId);e(s)},"window","maximized")),onWindowRestored:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox(e=>e.id===o.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===o.windowSummary.itemId);e(s)},"window","restored")),onWindowSelected:async e=>(O(e),await r.processGlobalSubscription(async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox(e=>e.id===o.windowSummary.parentId).children.find(e=>"window"===e.type&&e.elementId===o.windowSummary.itemId);e(s)},"window","selected")),version:"4.1.4"}})(e,t)};return"undefined"!=typeof window&&(window.IOWorkspaces=_r),_r});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interopio/workspaces-api",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "description": "IOConnect Workspaces API",
5
5
  "main": "dist/workspaces.umd.js",
6
6
  "module": "dist/workspaces.es.js",
@@ -32,7 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "devDependencies": {
35
- "@interopio/core": "^6.7.1"
35
+ "@interopio/core": "^6.7.2"
36
36
  },
37
- "gitHead": "ac23c0e3cafb7d405165736cd40db6053a64d1ed"
37
+ "gitHead": "968dc63051ba208bda488d22c27fec909a26e9bd"
38
38
  }
package/workspaces.d.ts CHANGED
@@ -212,9 +212,9 @@ export namespace IOConnectWorkspaces {
212
212
  }
213
213
 
214
214
  /**
215
- * Describes the bounds of a Workspaces Frame.
215
+ * Describes the bounds of a window.
216
216
  */
217
- export interface FrameBounds extends Size {
217
+ export interface Bounds extends Size {
218
218
 
219
219
  /**
220
220
  * Distance of the top left window corner from the top edge of the screen in pixels.
@@ -227,6 +227,11 @@ export namespace IOConnectWorkspaces {
227
227
  left: number;
228
228
  }
229
229
 
230
+ /**
231
+ * Describes the bounds of a Frame instance.
232
+ */
233
+ export type FrameBounds = Bounds;
234
+
230
235
  /** An object describing the possible settings when defining a new frame. */
231
236
  export interface NewFrameConfig {
232
237
 
@@ -284,6 +289,7 @@ export namespace IOConnectWorkspaces {
284
289
  * If `true`, will allow preventing the operation for closing the Frame.
285
290
  */
286
291
  allowPrevent?: boolean;
292
+
287
293
  /**
288
294
  * If `true`, will show a dialog for the user to confirm or cancel closing the Frame.
289
295
  */
@@ -878,7 +884,57 @@ export namespace IOConnectWorkspaces {
878
884
  }
879
885
 
880
886
  /**
881
- * Type of the dialog to show. Can be either a predefined io.Connect dialog type, or a custom one.
887
+ * Location of the popup window relative to the area around which the popup window will appear.
888
+ */
889
+ type PopupTargetLocation = "none" | "left" | "top" | "right" | "bottom";
890
+
891
+ /**
892
+ * Options for creating a popup window.
893
+ */
894
+ export interface PopupOptions {
895
+
896
+ /**
897
+ * Horizontal offset from the area around which the popup will appear (the area defined in the `targetBounds` property).
898
+ * Valid only if the target location of the popup window is set to `"left"` or `"right"`.
899
+ */
900
+ horizontalOffset?: number;
901
+
902
+ /**
903
+ * Vertical offset from the area around which the popup will appear (the area defined in the `targetBounds` property).
904
+ * Valid only if the target location of the popup window is set to `"top"` or `"bottom"`.
905
+ */
906
+ verticalOffset?: number;
907
+
908
+ /**
909
+ * Size for the popup window.
910
+ */
911
+ size: Size;
912
+
913
+ /**
914
+ * Bounds of the area around which the popup window will appear.
915
+ */
916
+ targetBounds: Bounds;
917
+
918
+ /**
919
+ * Location where the popup will appear relative to the area around which the popup window will appear (the area defined in the `targetBounds` property).
920
+ * If `"none"` is passed, the popup will appear at the top left corner of the area defined in the `targetBounds` property.
921
+ */
922
+ targetLocation: PopupTargetLocation;
923
+
924
+ /**
925
+ * ID of the window which will be used as a popup window.
926
+ */
927
+ windowId: string;
928
+
929
+ /**
930
+ * If `true`, the popup window will gain focus when shown and will hide automatically when it loses focus. If `false`, the popup window won't be on focus when shown and won't hide automatically if it gains and loses focus afterwards. If you set this to `false`, you will be responsible for implementing the conditions and the mechanism for hiding/closing the popup window.
931
+ * @default true
932
+ * @since io.Connect Desktop 10.0
933
+ */
934
+ focus?: boolean;
935
+ }
936
+ /**
937
+ * Type of the dialog to show. Can be either a predefined io.Connect dialog type, or a custom one.
882
938
  *
883
939
  * - `YesNo` - dialog with "Yes" and "No" buttons;
884
940
  * - `YesNoCancel` - dialog with "Yes", "No" and "Cancel" buttons;
@@ -1178,6 +1234,14 @@ export namespace IOConnectWorkspaces {
1178
1234
  */
1179
1235
  createWorkspace(definition: WorkspaceDefinition, config?: WorkspaceCreateConfig): Promise<Workspace>;
1180
1236
 
1237
+ /**
1238
+ * Creates a popup window.
1239
+ * *Available only in **io.Connect Desktop**.*
1240
+ * @param config Options for creating a popup window.
1241
+ * @since io.Connect Desktop 10.0
1242
+ */
1243
+ showPopup(config: PopupOptions): Promise<any>;
1244
+
1181
1245
  /**
1182
1246
  * Shows a dialog with a title, message, and response buttons to the user.
1183
1247
  * *Available only in **io.Connect Desktop**.*