@glue42/workspaces-api
Version:
Glue42 Core workspaces API
1 lines • 98.8 kB
JavaScript
!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,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{d(o.next(e))}catch(e){n(e)}}function a(e){try{d(o.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((o=o.apply(e,t||[])).next())}))}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,i={};function o(i,o){var r=i instanceof Error?i:new Error(i);if(t)t(r);else{var n='[ERROR] callback-registry: User callback for key "'+o+'" failed: '+r.stack;if(e)switch(e.errorHandling){case"log":return console.error(n);case"silent":return;case"throw":throw new Error(n)}console.error(n)}}return{add:function(e,t,r){var n=i[e];return n||(n=[],i[e]=n),n.push(t),r&&setTimeout((function(){r.forEach((function(r){var n;if(null===(n=i[e])||void 0===n?void 0:n.includes(t))try{Array.isArray(r)?t.apply(void 0,r):t.apply(void 0,[r])}catch(t){o(t,e)}}))}),0),function(){var o=i[e];o&&(0===(o=o.reduce((function(e,i,o){return i===t&&e.length===o||e.push(i),e}),[])).length?delete i[e]:i[e]=o)}},execute:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=i[e];if(!n||0===n.length)return[];var s=[];return n.forEach((function(i){try{var r=i.apply(void 0,t);s.push(r)}catch(t){s.push(void 0),o(t,e)}})),s},clear:function(){i={}},clearKey:function(e){i[e]&&delete i[e]}}}t.default=t;var i=t,o=function(e){return{ok:!0,result:e}},r=function(e){return{ok:!1,error:e}},n=function(e){return!0===e.ok?Promise.resolve(e.result):Promise.reject(e.error)},s=function(e){if(!0===e.ok)return e.result;throw e.error},a=function(e,t){return!0===t.ok?o(e(t.result)):t},d=function(e,t,i){return!1===t.ok?t:!1===i.ok?i:o(e(t.result,i.result))},c=function(e,t){return!0===t.ok?t:r(e(t.error))},l=function(e,t){return!0===t.ok?e(t.result):t},u=function(){return u=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},u.apply(this,arguments)};function h(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 i=0;i<e.length;i++)if(!h(e[i],t[i]))return!1;return!0}var o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(i=0;i<o.length;i++){if(!t.hasOwnProperty(o[i]))return!1;if(!h(e[o[i]],t[o[i]]))return!1}return!0}}var p=function(e){return Array.isArray(e)},m=function(e){return"object"==typeof e&&null!==e&&!p(e)},w=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)},g=function(e){return e.map((function(e){return"string"==typeof e?"."+e:"["+e+"]"})).join("")},f=function(e,t){var i=t.at,o=function(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(i[o[r]]=e[o[r]])}return i}(t,["at"]);return u({at:e+(i||"")},o)},y=function(){function e(t){var i=this;this.decode=t,this.run=function(e){return c((function(t){return{kind:"DecoderError",input:e,at:"input"+(t.at||""),message:t.message||""}}),i.decode(e))},this.runPromise=function(e){return n(i.run(e))},this.runWithException=function(e){return s(i.run(e))},this.map=function(t){return new e((function(e){return a(t,i.decode(e))}))},this.andThen=function(t){return new e((function(e){return l((function(i){return t(i).decode(e)}),i.decode(e))}))},this.where=function(t,o){return i.andThen((function(i){return t(i)?e.succeed(i):e.fail(o)}))}}return e.string=function(){return new e((function(e){return"string"==typeof e?o(e):r({message:w("a string",e)})}))},e.number=function(){return new e((function(e){return"number"==typeof e?o(e):r({message:w("a number",e)})}))},e.boolean=function(){return new e((function(e){return"boolean"==typeof e?o(e):r({message:w("a boolean",e)})}))},e.constant=function(t){return new e((function(e){return h(e,t)?o(t):r({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})}))},e.object=function(t){return new e((function(e){if(m(e)&&t){var i={};for(var n in t)if(t.hasOwnProperty(n)){var s=t[n].decode(e[n]);if(!0!==s.ok)return void 0===e[n]?r({message:"the key '"+n+"' is required but was not present"}):r(f("."+n,s.error));void 0!==s.result&&(i[n]=s.result)}return o(i)}return m(e)?o(e):r({message:w("an object",e)})}))},e.array=function(t){return new e((function(e){if(p(e)&&t){return e.reduce((function(e,i,o){return d((function(e,t){return e.concat([t])}),e,function(e,i){return c((function(e){return f("["+i+"]",e)}),t.decode(e))}(i,o))}),o([]))}return p(e)?o(e):r({message:w("an array",e)})}))},e.tuple=function(t){return new e((function(e){if(p(e)){if(e.length!==t.length)return r({message:"expected a tuple of length "+t.length+", got one of length "+e.length});for(var i=[],n=0;n<t.length;n++){var s=t[n].decode(e[n]);if(!s.ok)return r(f("["+n+"]",s.error));i[n]=s.result}return o(i)}return r({message:w("a tuple of length "+t.length,e)})}))},e.union=function(t,i){for(var o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];return e.oneOf.apply(e,[t,i].concat(o))},e.intersection=function(t,i){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return new e((function(e){return[t,i].concat(r).reduce((function(t,i){return d(Object.assign,t,i.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(m(e)){var i={};for(var n in e)if(e.hasOwnProperty(n)){var s=t.decode(e[n]);if(!0!==s.ok)return r(f("."+n,s.error));i[n]=s.result}return o(i)}return r({message:w("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=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new e((function(e){for(var i=[],o=0;o<t.length;o++){var n=t[o].decode(e);if(!0===n.ok)return n;i[o]=n.error}var s=i.map((function(e){return"at error"+(e.at||"")+": "+e.message})).join('", "');return r({message:'expected a value matching one of the decoders, got the errors ["'+s+'"]'})}))},e.withDefault=function(t,i){return new e((function(e){return o(function(e,t){return!0===t.ok?t.result:e}(t,i.decode(e)))}))},e.valueAt=function(t,i){return new e((function(e){for(var o=e,n=0;n<t.length;n++){if(void 0===o)return r({at:g(t.slice(0,n+1)),message:"path does not exist"});if("string"==typeof t[n]&&!m(o))return r({at:g(t.slice(0,n+1)),message:w("an object",o)});if("number"==typeof t[n]&&!p(o))return r({at:g(t.slice(0,n+1)),message:w("an array",o)});o=o[t[n]]}return c((function(e){return void 0===o?{at:g(t),message:"path does not exist"}:f(g(t),e)}),i.decode(o))}))},e.succeed=function(t){return new e((function(e){return o(t)}))},e.fail=function(t){return new e((function(e){return r({message:t})}))},e.lazy=function(t){return new e((function(e){return t().decode(e)}))},e}(),v=y.string,k=y.number,b=y.boolean,W=y.anyJson;y.unknownJson;var I=y.constant,x=y.object,S=y.array;y.tuple,y.dict;var D=y.optional,C=y.oneOf;y.union;var E=y.intersection;y.withDefault,y.valueAt,y.succeed,y.fail;var B=y.lazy;const T=v().where((e=>e.length>0),"Expected a non-empty string"),M=k().where((e=>e>=0),"Expected a non-negative number"),R=k().where((e=>e>0),"Expected a positive number"),A=x({inWorkspace:b()}),L=C(I("workspace"),I("row"),I("column"),I("group")),P=C(I("row"),I("column"),I("group")),F=C(I("maximized"),I("minimized"),I("normal")),z=C(I("workspace")),H=(e,t)=>{const i=typeof e;if(t&&"function"!==i&&"undefined"!==i)throw new Error(`Provided argument must be either undefined or of type function, provided: ${i}`);if(!t&&"function"!==i)throw new Error(`Provided argument must be of type function, provided: ${i}`)},$=D(x({saveLayout:D(b())})),O=x({name:T}),j=x({minWidth:D(k()),maxWidth:D(k()),minHeight:D(k()),maxHeight:D(k()),allowExtract:D(b()),allowReorder:D(b()),showCloseButton:D(b())}),_=x({minWidth:D(k()),maxWidth:D(k()),minHeight:D(k()),maxHeight:D(k()),allowExtract:D(b()),allowReorder:D(b()),allowDrop:D(b()),allowDropHeader:D(b()),allowDropLeft:D(b()),allowDropRight:D(b()),allowDropTop:D(b()),allowDropBottom:D(b()),showMaximizeButton:D(b()),showEjectButton:D(b()),showAddWindowButton:D(b())}),G=x({minHeight:D(k()),maxHeight:D(k()),allowDrop:D(b()),allowSplitters:D(b()),isPinned:D(b()),maximizationBoundary:D(b())}),N=x({minWidth:D(k()),maxWidth:D(k()),allowDrop:D(b()),allowSplitters:D(b()),isPinned:D(b()),maximizationBoundary:D(b())}),J=x({type:D(I("window")),appName:D(T),windowId:D(T),context:D(W()),config:D(j)}),U=x({type:I("window"),appName:D(T),windowId:D(T),context:D(W()),config:D(j)}),K=D(x({type:D(P),children:D(B((()=>S(C(J,K))))),config:D(W())})),q=x({type:I("column"),children:D(B((()=>S(C(U,X))))),config:D(N)}),Q=x({type:I("row"),children:D(B((()=>S(C(U,X))))),config:D(G)}),V=x({type:I("group"),children:D(B((()=>S(C(U,X))))),config:D(_)}),X=C(V,q,Q);C(v().where((e=>"maximized"===e.toLowerCase()),"Expected a case insensitive variation of 'maximized'"),v().where((e=>"normal"===e.toLowerCase()),"Expected a case insensitive variation of 'normal'"));const Y=x({bounds:D(x({left:D(k()),top:D(k()),width:D(M),height:D(M)})),frameId:D(T)}),Z=C(I("direct"),I("delayed"),I("lazy")),ee=D(x({app:D(T),context:D(W()),loadingStrategy:D(Z),title:D(T),reuseWorkspaceId:D(T),frameId:D(T),applicationName:D(T),lockdown:D(b()),activateFrame:D(b()),newFrame:D(C(Y,b())),noTabHeader:D(b()),inMemoryLayout:D(b()),icon:D(T),isPinned:D(b()),isSelected:D(b()),positionIndex:D(M),allowSystemHibernation:D(b())})),te=x({name:T,restoreOptions:D(ee)}),ie=x({children:D(S(C(J,X))),context:D(W()),config:D(x({title:D(T),position:D(M),isFocused:D(b()),noTabHeader:D(b()),reuseWorkspaceId:D(T),loadingStrategy:D(Z),allowDrop:D(b()),allowDropLeft:D(b()),allowDropTop:D(b()),allowDropRight:D(b()),allowDropBottom:D(b()),allowSystemHibernation:D(b()),allowExtract:D(b()),allowWindowReorder:D(b()),showSaveButton:D(b()),allowWorkspaceTabReorder:D(b()),allowWorkspaceTabExtract:D(b()),showCloseButton:D(b()),allowSplitters:D(b()),showWindowCloseButtons:D(b()),showEjectButtons:D(b()),showAddWindowButtons:D(b()),icon:D(T),isPinned:D(b()),isSelected:D(b()),positionIndex:D(M)})),frame:D(x({reuseFrameId:D(T),applicationName:D(T),newFrame:D(C(b(),Y))}))}),oe=x({workspaceId:T}),re=x({name:T,restoreOptions:D(ee)}),ne=D(x({applicationName:D(v()),frameConfig:D(Y),context:D(x()),layoutComponentId:D(T)})),se=x({workspaces:S(C(D(ie),D(re)))}),ae=x({frameId:T,workspaces:S(C(ie,re))}),de=x({type:L,definition:D(C(ie,K))}),ce=E(ie,x({saveConfig:D(x({saveLayout:D(b())}))})),le=x({itemId:T}),ue=x({context:D(x())}),he=x({id:T,isFocused:D(b()),isInitialized:D(b()),initializationContext:D(ue)});x({type:P,id:T,frameId:T,workspaceId:T,positionIndex:k()});const pe=C(I("frame"),I("workspace"),I("container"),I("window")),me=x({type:pe,branch:T}),we=C(I("opened"),I("closing"),I("closed"),I("focus"),I("added"),I("loaded"),I("removed"),I("childrenUpdate"),I("containerChange"),I("maximized"),I("restored"),I("minimized"),I("normal"),I("selected"),I("lock-configuration-changed"),I("hibernated"),I("resumed")),ge=x({frameId:T,title:T,positionIndex:M,name:T,layoutName:D(T),isHibernated:D(b()),isSelected:D(b()),allowDrop:D(b()),allowSystemHibernation:D(b()),allowExtract:D(b()),allowWindowReorder:D(b()),allowSplitters:D(b()),showCloseButton:D(b()),showSaveButton:D(b()),allowWorkspaceTabReorder:D(b()),allowWorkspaceTabExtract:D(b()),allowDropLeft:D(b()),allowDropTop:D(b()),allowDropRight:D(b()),allowDropBottom:D(b()),minWidth:D(k()),maxWidth:D(k()),minHeight:D(k()),maxHeight:D(k()),showAddWindowButtons:D(b()),showEjectButtons:D(b()),showWindowCloseButtons:D(b()),widthInPx:D(k()),heightInPx:D(k()),isPinned:D(b())}),fe=x({frameId:T,workspaceId:T,positionIndex:k(),minWidth:D(k()),maxWidth:D(k()),minHeight:D(k()),maxHeight:D(k())}),ye=W(),ve=E(fe,x({windowId:D(T),isMaximized:D(b()),isFocused:b(),isSelected:D(b()),title:D(v()),appName:D(T),allowExtract:D(b()),allowReorder:D(b()),showCloseButton:D(b()),minWidth:D(k()),minHeight:D(k()),maxWidth:D(k()),maxHeight:D(k()),widthInPx:D(k()),heightInPx:D(k()),context:D(W())})),ke=x({id:D(T),config:ye,children:D(B((()=>S(We)))),type:C(I("row"),I("column"),I("group"))}),be=x({id:D(T),config:ve,type:I("window")}),We=C(be,ke),Ie=x({id:T,config:ge,children:S(We),frameSummary:he,context:D(W())}),xe=x({type:I("window"),config:x({appName:T,windowId:D(T),context:D(W()),url:D(T),title:D(v()),allowExtract:D(b()),allowReorder:D(b()),showCloseButton:D(b()),minWidth:D(k()),minHeight:D(k()),maxWidth:D(k()),maxHeight:D(k()),isMaximized:D(b())})}),Se=x({type:I("group"),config:W(),children:S(C(xe))}),De=x({type:I("column"),config:W(),children:S(C(Se,xe,B((()=>De)),B((()=>Ce))))}),Ce=x({type:I("row"),config:W(),children:S(C(De,Se,xe,B((()=>Ce))))}),Ee=x({name:T,type:I("Workspace"),metadata:D(W()),components:S(x({type:I("Workspace"),application:D(v()),state:x({config:W(),context:W(),children:S(C(Ce,De,Se,xe))})}))}),Be=x({layout:Ee,mode:C(I("replace"),I("merge"))}),Te=x({layouts:S(Ee),mode:C(I("replace"),I("merge"))}),Me=x({layouts:S(Ee)}),Re=x({id:T,isFocused:D(b()),isInitialized:D(b()),initializationContext:D(ue)}),Ae=x({summaries:S(Re)}),Le=x({id:T,config:ge}),Pe=x({summaries:S(Le)}),Fe=x({id:T,config:W(),workspaces:S(Ie)}),ze=x({name:T,applicationName:D(v())}),He=x({summaries:S(ze)}),$e=x({windowId:T}),Oe=W(),je=x({state:F}),_e=x({top:k(),left:k(),width:M,height:M}),Ge=x({bounds:_e}),Ne=x({icon:D(T)}),Je=x({id:D(T)}),Ue=x({isSupported:b()}),Ke=x({width:D(R),height:D(R),relative:D(b())}),qe=x({top:D(k()),left:D(k()),relative:D(b())}),Qe=x({itemId:T}),Ve=x({itemId:T,excludeIds:D(b())}),Xe=x({frameId:T,requestedState:F}),Ye=x({itemId:T,title:T}),Ze=x({itemId:T,containerId:T}),et=E(Qe,Ke),tt=x({itemId:T,enabled:b()}),it=E(Qe,qe);x({id:T,type:P});const ot=x({definition:J,parentId:T,parentType:L}),rt=x({definition:X,parentId:T,parentType:L}),nt=x({itemId:T,windowId:D(T)}),st=x({live:b()}),at=x({type:C(I("row"),I("column")),workspaceId:T}),dt=x({type:C(I("row"),I("column")),itemId:T}),ct=x({itemId:T,config:ye}),lt=x({frameSummary:he,frameBounds:D(_e)}),ut=x({workspaceSummary:Le,frameSummary:he,workspaceSnapshot:D(Ie),frameBounds:D(_e)}),ht=x({containerSummary:ct}),pt=x({windowSummary:x({itemId:T,parentId:T,config:ve})}),mt=x({name:T,workspaceId:T,saveContext:D(b()),metadata:D(x())}),wt=x({allowDrop:D(b()),allowDropLeft:D(b()),allowDropTop:D(b()),allowDropRight:D(b()),allowDropBottom:D(b()),allowSystemHibernation:D(b()),allowExtract:D(b()),allowWindowReorder:D(b()),allowSplitters:D(b()),showCloseButton:D(b()),showSaveButton:D(b()),allowWorkspaceTabReorder:D(b()),allowWorkspaceTabExtract:D(b()),showWindowCloseButtons:D(b()),showAddWindowButtons:D(b()),showEjectButtons:D(b())}),gt=x({workspaceId:T,config:D(wt)}),ft=x({allowExtract:D(b()),allowReorder:D(b()),showCloseButton:D(b())}),yt=x({width:D(M),height:D(M)}),vt=x({windowPlacementId:T,config:D(ft)}),kt=x({allowDrop:D(b()),allowSplitters:D(b())}),bt=x({allowDrop:D(b()),allowSplitters:D(b())}),Wt=x({allowExtract:D(b()),allowReorder:D(b()),allowDrop:D(b()),allowDropLeft:D(b()),allowDropRight:D(b()),allowDropTop:D(b()),allowDropBottom:D(b()),allowDropHeader:D(b()),showMaximizeButton:D(b()),showEjectButton:D(b()),showAddWindowButton:D(b())}),It=x({itemId:T,type:I("row"),config:D(kt)}),xt=x({itemId:T,type:I("column"),config:D(bt)}),St=x({itemId:T,type:I("group"),config:D(Wt)}),Dt=C(It,xt,St),Ct=x({workspaceId:T,icon:D(T)}),Et=x({workspaceId:T,icon:D(T)}),Bt=D(x({icon:D(T)})),Tt=x({shortcut:T,frameId:T}),Mt=x({shortcut:T,frameId:T}),Rt=x({enabled:b()}),At=x({itemId:T,type:z}),Lt=x({operation:T}),Pt="T42.Web.Platform.Control",Ft="T42.Web.Platform.WSP.Stream",zt={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}},Ht={control:{name:"T42.Workspaces.Client.Control",isStream:!1}},$t={frame:{name:"T42.Workspaces.Stream.Frame",payloadDecoder:lt},workspace:{name:"T42.Workspaces.Stream.Workspace",payloadDecoder:ut},container:{name:"T42.Workspaces.Stream.Container",payloadDecoder:ht},window:{name:"T42.Workspaces.Stream.Window",payloadDecoder:pt}},Ot={shortcutClicked:{name:"shortcutClicked",argsDecoder:Mt,resultDecoder:Oe}},jt={ping:{name:"ping",resultDecoder:st},isWindowInWorkspace:{name:"isWindowInWorkspace",argsDecoder:Qe,resultDecoder:A},createWorkspace:{name:"createWorkspace",resultDecoder:Ie,argsDecoder:ce},createFrame:{name:"createFrame",resultDecoder:Re,argsDecoder:ne},initFrame:{name:"initFrame",resultDecoder:Oe,argsDecoder:ae},getAllFramesSummaries:{name:"getAllFramesSummaries",resultDecoder:Ae},getFrameSummary:{name:"getFrameSummary",resultDecoder:he,argsDecoder:le},getAllWorkspacesSummaries:{name:"getAllWorkspacesSummaries",resultDecoder:Pe},getWorkspaceSnapshot:{name:"getWorkspaceSnapshot",resultDecoder:Ie,argsDecoder:Qe},getAllLayoutsSummaries:{name:"getAllLayoutsSummaries",resultDecoder:He},openWorkspace:{name:"openWorkspace",argsDecoder:te,resultDecoder:Ie},deleteLayout:{name:"deleteLayout",resultDecoder:Oe,argsDecoder:O},saveLayout:{name:"saveLayout",resultDecoder:Ee,argsDecoder:mt},importLayout:{name:"importLayout",resultDecoder:Oe,argsDecoder:Be},importLayouts:{name:"importLayouts",resultDecoder:Oe,argsDecoder:Te},exportAllLayouts:{name:"exportAllLayouts",resultDecoder:Me},restoreItem:{name:"restoreItem",argsDecoder:Qe,resultDecoder:Oe},maximizeItem:{name:"maximizeItem",argsDecoder:Qe,resultDecoder:Oe},focusItem:{name:"focusItem",argsDecoder:Qe,resultDecoder:Oe},closeItem:{name:"closeItem",argsDecoder:Qe,resultDecoder:Oe},resizeItem:{name:"resizeItem",argsDecoder:et,resultDecoder:Oe},setMaximizationBoundary:{name:"setMaximizationBoundary",argsDecoder:tt,resultDecoder:Oe},changeFrameState:{name:"changeFrameState",argsDecoder:Xe,resultDecoder:Oe},getFrameState:{name:"getFrameState",argsDecoder:Qe,resultDecoder:je},getFrameBounds:{name:"getFrameBounds",argsDecoder:Qe,resultDecoder:Ge},moveFrame:{name:"moveFrame",argsDecoder:it,resultDecoder:Oe},getFrameSnapshot:{name:"getFrameSnapshot",argsDecoder:Ve,resultDecoder:Fe},forceLoadWindow:{name:"forceLoadWindow",argsDecoder:Qe,resultDecoder:$e},ejectWindow:{name:"ejectWindow",argsDecoder:Qe,resultDecoder:$e},setItemTitle:{name:"setItemTitle",argsDecoder:Ye,resultDecoder:Oe},moveWindowTo:{name:"moveWindowTo",argsDecoder:Ze,resultDecoder:Oe},addWindow:{name:"addWindow",argsDecoder:ot,resultDecoder:nt},addContainer:{name:"addContainer",argsDecoder:rt,resultDecoder:nt},bundleWorkspace:{name:"bundleWorkspace",argsDecoder:at,resultDecoder:Oe},bundleItem:{name:"bundleItem",argsDecoder:dt,resultDecoder:Oe},hibernateWorkspace:{name:"hibernateWorkspace",argsDecoder:oe,resultDecoder:Oe},resumeWorkspace:{name:"resumeWorkspace",argsDecoder:oe,resultDecoder:Oe},lockWorkspace:{name:"lockWorkspace",argsDecoder:gt,resultDecoder:Oe},lockWindow:{name:"lockWindow",argsDecoder:vt,resultDecoder:Oe},lockContainer:{name:"lockContainer",argsDecoder:Dt,resultDecoder:Oe},pinWorkspace:{name:"pinWorkspace",argsDecoder:Ct,resultDecoder:Oe},unpinWorkspace:{name:"unpinWorkspace",argsDecoder:oe,resultDecoder:Oe},getWorkspaceIcon:{name:"getWorkspaceIcon",argsDecoder:oe,resultDecoder:Ne},setWorkspaceIcon:{name:"setWorkspaceIcon",argsDecoder:Et,resultDecoder:Oe},registerShortcut:{name:"registerShortcut",argsDecoder:Tt,resultDecoder:Oe},unregisterShortcut:{name:"unregisterShortcut",argsDecoder:Tt,resultDecoder:Oe},showLoadingAnimation:{name:"showLoadingAnimation",argsDecoder:At,resultDecoder:Oe},hideLoadingAnimation:{name:"hideLoadingAnimation",argsDecoder:At,resultDecoder:Oe},getPlatformFrameId:{name:"getPlatformFrameId",resultDecoder:Je},operationCheck:{name:"operationCheck",argsDecoder:Lt,resultDecoder:Ue}};class _t{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class Gt{constructor(e,t){this.transport=e,this.registry=t,this.activeSubscriptions=[],this.pendingSubScriptions=[]}createCoreEventSubscription(){return e(this,void 0,void 0,(function*(){yield this.transport.coreSubscriptionReady(this.handleCoreEvent.bind(this))}))}handleCoreSubscription(e){const t=`${e.eventType}-${e.action}`,i=e.scope,o=e.scopeId;return this.registry.add(t,(t=>{var r,n,s,a,d,c;const l={type:i,id:o},u={frame:(null===(r=t.frameSummary)||void 0===r?void 0:r.id)||(null===(n=t.windowSummary)||void 0===n?void 0:n.config.frameId),workspace:(null===(s=t.workspaceSummary)||void 0===s?void 0:s.id)||(null===(a=t.windowSummary)||void 0===a?void 0:a.config.workspaceId),container:null===(d=t.containerSummary)||void 0===d?void 0:d.itemId,window:null===(c=t.windowSummary)||void 0===c?void 0:c.itemId};this.checkScopeMatch(l,u)&&e.callback(t)}))}send(t,i){return e(this,void 0,void 0,(function*(){const e=Object.values(jt).find((e=>e.name===t));if(!e)throw new Error(`Cannot find definition for operation name: ${t}`);if(e.argsDecoder)try{e.argsDecoder.runWithException(i)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${t}`)}try{const t=yield this.transport.transmitControl(e.name,i);return e.resultDecoder.runWithException(t),t}catch(e){if(e.kind)throw new Error(`Unexpected internal incoming validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${t}`);throw new Error(e.message)}}))}subscribe(t){return e(this,void 0,void 0,(function*(){const e=this.getPendingSubscription(t);e&&(yield e.promise);let i=this.getActiveSubscription(t);const o=this.getRegistryKey(t);if(!i){const e=new _t,o={streamType:t.eventType,level:t.scope,levelId:t.scopeId,promise:e.promise};this.pendingSubScriptions.push(o);try{const r=$t[t.eventType],n=yield this.transport.subscribe(r.name,this.getBranchKey(t),t.eventType);n.onData((e=>{const t=e.data,i=me.run(e.requestArguments),o=we.run(t.action);if(!i.ok||!o.ok)return;const r=i.result.type,n=`${r}-${i.result.branch}-${o.result}`,s=$t[r].payloadDecoder.run(t.payload);s.ok&&this.registry.execute(n,s.result)})),i={streamType:t.eventType,level:t.scope,levelId:t.scopeId,callbacksCount:0,gdSub:n},this.activeSubscriptions.push(i),e.resolve()}catch(t){throw e.reject(t),t}finally{this.removePendingSubscription(o)}}const r=this.registry.add(o,t.callback);return++i.callbacksCount,()=>{r(),--i.callbacksCount,0===i.callbacksCount&&(i.gdSub.close(),this.activeSubscriptions.splice(this.activeSubscriptions.indexOf(i),1))}}))}onOperation(e){return this.transport.onInternalMethodInvoked("control",((t,i)=>{const o=t.operation,r=t.data,n=Object.values(Ot).find((e=>e.name===o));if(!n)throw new Error(`Cannot find definition for operation name: ${o}`);if(n.argsDecoder)try{n.argsDecoder.runWithException(r)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}e(t,i)}))}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=we.runWithException(t.action),i=pe.runWithException(t.type),o=$t[i].payloadDecoder.runWithException(t.payload),r=`${i}-${e}`;this.registry.execute(r,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)}}class Nt{constructor(e,t){this.agm=e,this.registry=t,this.defaultTransportTimeout=3e4,this.coreEventMethodInitiated=!1}initiate(t){return e(this,void 0,void 0,(function*(){if(window.glue42gd)return yield Promise.all(Object.values(zt).map((e=>this.verifyMethodLive(e.name)))),void(yield Promise.all(Object.keys(Ht).map((e=>this.registerMethod(e)))));const e=window.glue42core.communicationId;yield Promise.all([this.verifyMethodLive(Pt,e),this.verifyMethodLive(Ft,e)]),yield this.transmitControl("frameHello",{windowId:t})}))}coreSubscriptionReady(e){return this.coreEventMethodInitiated||this.subscribePlatform(e),this.corePlatformSubPromise}subscribePlatform(e){this.coreEventMethodInitiated=!0;const t=window.glue42core.communicationId;this.corePlatformSubPromise=this.agm.subscribe(Ft,t?{target:{instance:t}}:void 0),this.corePlatformSubPromise.then((t=>{t.onData((t=>e(t.data)))}))}subscribe(t,i,o){return e(this,void 0,void 0,(function*(){const e={branch:i,type:o};let r;try{r=yield this.agm.subscribe(t,{arguments:e})}catch(e){const o=`Internal subscription error! Error details: stream - ${t}, branch: ${i}. Internal message: ${e.message}`;throw new Error(o)}return r}))}transmitControl(t,i){return e(this,void 0,void 0,(function*(){const e=window.glue42gd?{operation:t,operationArguments:i}:{operation:t,domain:"workspaces",data:i},o=window.glue42gd?zt.control.name:Pt,r=window.glue42gd?void 0:window.glue42core.communicationId;let n;const s=`Internal Workspaces Communication Error. Attempted operation: ${JSON.stringify(e)}. `;try{if(n=yield this.agm.invoke(o,e,r?{instance:r}:"best",{methodResponseTimeoutMs:this.defaultTransportTimeout}),!n)throw new Error("Received unsupported result from GD - empty result");if(!Array.isArray(n.all_return_values)||0===n.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(`${s} -> Inner message: ${t}`)}throw new Error(`${s} -> Inner message: ${e.message}`)}return n.all_return_values[0].returned}))}onInternalMethodInvoked(e,t){return this.registry.add(e,t)}verifyMethodLive(e,t){return i=()=>new Promise((i=>{if(this.agm.methods().some((i=>{const o=i.name===e,r=!t||i.getServers().some((e=>e.instance===t));return o&&r})))return void i();const o=this.agm.serverMethodAdded((r=>{const n=r.method,s=r.server,a=!t||s.instance===t;n.name===e&&a&&(o(),i())}))})),o=15e3,r="Timeout waiting for the Workspaces communication channels",new Promise(((e,t)=>{let n=!0;const s=setTimeout((()=>{n&&(n=!1,t(r||`Promise timeout hit: ${o}`))}),o);i().then((t=>{n&&(n=!1,clearTimeout(s),e(t))})).catch((e=>{n&&(n=!1,clearTimeout(s),t(e))}))}));var i,o,r}registerMethod(e){const t=Ht[e];return this.agm.register(t.name,((t,i)=>{this.registry.execute(e,t,i)}))}}const Jt=new WeakMap;class Ut{constructor(e,t){const i=t.wrapChildren(e.children);delete e.children,Jt.set(this,{base:t,children:i,definition:e})}get type(){return Jt.get(this).definition.type}addColumn(e){return Jt.get(this).base.add("column",Jt.get(this).children,e)}addRow(e){return Jt.get(this).base.add("row",Jt.get(this).children,e)}addGroup(e){return Jt.get(this).base.add("group",Jt.get(this).children,e)}addWindow(e){return Jt.get(this).base.addWindow(Jt.get(this).children,e),this}serialize(){const e=Jt.get(this).definition;return e.children=Jt.get(this).base.serializeChildren(Jt.get(this).children),e}}class Kt{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,i){const o=K.runWithException(i),r=this.getBuilder({type:e,definition:o});return t.push(r),r}addWindow(e,t){const i=J.runWithException(t);i.type="window",e.push(i)}serializeChildren(e){return e.map((e=>e instanceof Ut?e.serialize():e))}}const qt=new WeakMap;class Qt{constructor(e,t,i){const o=t.wrapChildren(e.children);delete e.children,qt.set(this,{base:t,children:o,definition:e,controller:i})}addColumn(e){const t=qt.get(this).children;if(!t.every((e=>e instanceof Ut&&"column"===e.type)))throw new Error("Cannot add a column to this workspace, because there are already children of another type");return qt.get(this).base.add("column",t,e)}addRow(e){const t=qt.get(this).children;if(!t.every((e=>e instanceof Ut&&"row"===e.type)))throw new Error("Cannot add a row to this workspace, because there are already children of another type");return qt.get(this).base.add("row",t,e)}addGroup(e){const t=qt.get(this).children;if(0!==t.length)throw new Error("Cannot add a group to this workspace, because there are already defined children.");return qt.get(this).base.add("group",t,e)}addWindow(e){const t=qt.get(this).children;if(0!==t.length)throw new Error("Cannot add a window to this workspace, because there are already defined children.");return qt.get(this).base.addWindow(t,e),this}getChildAt(e){M.runWithException(e);return qt.get(this).children[e]}create(t){return e(this,void 0,void 0,(function*(){const e=$.runWithException(t),i=qt.get(this).definition;i.children=qt.get(this).base.serializeChildren(qt.get(this).children);return qt.get(this).controller.createWorkspace(i,e)}))}}const Vt=new WeakMap,Xt=e=>Vt.get(e).base;class Yt{constructor(e){Vt.set(this,{base:e})}get type(){return"row"}get id(){return Xt(this).getId(this)}get frameId(){return Xt(this).getFrameId(this)}get workspaceId(){return Xt(this).getWorkspaceId(this)}get positionIndex(){return Xt(this).getPositionIndex(this)}get children(){return Xt(this).getAllChildren(this)}get parent(){return Xt(this).getMyParent(this)}get frame(){return Xt(this).getMyFrame(this)}get workspace(){return Xt(this).getMyWorkspace(this)}get allowDrop(){return Xt(this).getAllowDrop(this)}get allowSplitters(){return Xt(this).getAllowSplitters(this)}get minWidth(){return Xt(this).getMinWidth(this)}get minHeight(){return Xt(this).getMinHeight(this)}get maxWidth(){return Xt(this).getMaxWidth(this)}get maxHeight(){return Xt(this).getMaxHeight(this)}get width(){return Xt(this).getWidthInPx(this)}get height(){return Xt(this).getHeightInPx(this)}get isPinned(){return Xt(this).getIsPinned(this)}get isMaximized(){return Xt(this).getIsMaximized(this)}get maximizationBoundary(){return Xt(this).getMaximizationBoundary(this)}addWindow(e){return Xt(this).addWindow(this,e,"row")}addGroup(t){return e(this,void 0,void 0,(function*(){if((null==t?void 0:t.type)&&"group"!==t.type)throw new Error(`Expected a group definition, but received ${t.type}`);return Xt(this).addParent(this,"group","row",t)}))}addColumn(t){return e(this,void 0,void 0,(function*(){if((null==t?void 0:t.type)&&"column"!==t.type)throw new Error(`Expected a column definition, but received ${t.type}`);return Xt(this).addParent(this,"column","row",t)}))}addRow(){return e(this,void 0,void 0,(function*(){throw new Error("Adding rows as row children is not supported")}))}removeChild(e){return Xt(this).removeChild(this,e)}maximize(){return Xt(this).maximize(this)}restore(){return Xt(this).restore(this)}close(){return Xt(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const i=void 0===t?void 0:kt.runWithException(t);return Xt(this).lockContainer(this,i)}setHeight(t){return e(this,void 0,void 0,(function*(){return M.runWithException(t),Xt(this).setHeight(this,t)}))}onLockConfigurationChanged(t){return e(this,void 0,void 0,(function*(){H(t),Xt(this).getId(this);const i={callback:()=>e(this,void 0,void 0,(function*(){yield this.workspace.refreshReference(),t({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})})),action:"lock-configuration-changed",eventType:"container",scope:"container"};return yield Xt(this).processLocalSubscription(this,i)}))}setMaximizationBoundary(t){return e(this,void 0,void 0,(function*(){const e=Rt.runWithException(t);return Xt(this).setMaximizationBoundary(this,e)}))}}const Zt=new WeakMap,ei=e=>Zt.get(e).base;class ti{constructor(e){Zt.set(this,{base:e})}get type(){return"column"}get id(){return ei(this).getId(this)}get frameId(){return ei(this).getFrameId(this)}get workspaceId(){return ei(this).getWorkspaceId(this)}get positionIndex(){return ei(this).getPositionIndex(this)}get children(){return ei(this).getAllChildren(this)}get parent(){return ei(this).getMyParent(this)}get frame(){return ei(this).getMyFrame(this)}get workspace(){return ei(this).getMyWorkspace(this)}get allowDrop(){return ei(this).getAllowDrop(this)}get allowSplitters(){return ei(this).getAllowSplitters(this)}get minWidth(){return ei(this).getMinWidth(this)}get minHeight(){return ei(this).getMinHeight(this)}get maxWidth(){return ei(this).getMaxWidth(this)}get maxHeight(){return ei(this).getMaxHeight(this)}get width(){return ei(this).getWidthInPx(this)}get height(){return ei(this).getHeightInPx(this)}get isPinned(){return ei(this).getIsPinned(this)}get isMaximized(){return ei(this).getIsMaximized(this)}get maximizationBoundary(){return ei(this).getMaximizationBoundary(this)}addWindow(e){return ei(this).addWindow(this,e,"column")}addGroup(t){return e(this,void 0,void 0,(function*(){if((null==t?void 0:t.type)&&"group"!==t.type)throw new Error(`Expected a group definition, but received ${t.type}`);return ei(this).addParent(this,"group","column",t)}))}addColumn(t){return e(this,void 0,void 0,(function*(){throw new Error("Adding columns as column children is not supported")}))}addRow(t){return e(this,void 0,void 0,(function*(){if((null==t?void 0:t.type)&&"row"!==t.type)throw new Error(`Expected a row definition, but received ${t.type}`);return ei(this).addParent(this,"row","column",t)}))}removeChild(e){return ei(this).removeChild(this,e)}maximize(){return ei(this).maximize(this)}restore(){return ei(this).restore(this)}close(){return ei(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const i=void 0===t?void 0:bt.runWithException(t);return ei(this).lockContainer(this,i)}setWidth(t){return e(this,void 0,void 0,(function*(){return M.runWithException(t),ei(this).setWidth(this,t)}))}onLockConfigurationChanged(t){return e(this,void 0,void 0,(function*(){H(t),ei(this).getId(this);const i={callback:()=>e(this,void 0,void 0,(function*(){yield this.workspace.refreshReference(),t({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})})),action:"lock-configuration-changed",eventType:"container",scope:"container"};return yield ei(this).processLocalSubscription(this,i)}))}setMaximizationBoundary(t){return e(this,void 0,void 0,(function*(){const e=Rt.runWithException(t);return ei(this).setMaximizationBoundary(this,e)}))}}const ii=new WeakMap,oi=e=>ii.get(e).base;class ri{constructor(e){ii.set(this,{base:e})}get type(){return"group"}get id(){return oi(this).getId(this)}get frameId(){return oi(this).getFrameId(this)}get workspaceId(){return oi(this).getWorkspaceId(this)}get positionIndex(){return oi(this).getPositionIndex(this)}get children(){return oi(this).getAllChildren(this)}get parent(){return oi(this).getMyParent(this)}get frame(){return oi(this).getMyFrame(this)}get workspace(){return oi(this).getMyWorkspace(this)}get allowExtract(){return oi(this).getAllowExtract(this)}get allowReorder(){return oi(this).getAllowReorder(this)}get allowDropLeft(){return oi(this).getAllowDropLeft(this)}get allowDropRight(){return oi(this).getAllowDropRight(this)}get allowDropTop(){return oi(this).getAllowDropTop(this)}get allowDropBottom(){return oi(this).getAllowDropBottom(this)}get allowDropHeader(){return oi(this).getAllowDropHeader(this)}get allowDrop(){return oi(this).getAllowDrop(this)}get showMaximizeButton(){return oi(this).getShowMaximizeButton(this)}get showEjectButton(){return oi(this).getShowEjectButton(this)}get showAddWindowButton(){return oi(this).getShowAddWindowButton(this)}get minWidth(){return oi(this).getMinWidth(this)}get minHeight(){return oi(this).getMinHeight(this)}get maxWidth(){return oi(this).getMaxWidth(this)}get maxHeight(){return oi(this).getMaxHeight(this)}get width(){return oi(this).getWidthInPx(this)}get height(){return oi(this).getHeightInPx(this)}get isMaximized(){return oi(this).getIsMaximized(this)}addWindow(e){return oi(this).addWindow(this,e,"group")}addGroup(){return e(this,void 0,void 0,(function*(){throw new Error("Adding groups as group child is not supported")}))}addColumn(){return e(this,void 0,void 0,(function*(){throw new Error("Adding columns as group child is not supported")}))}addRow(){return e(this,void 0,void 0,(function*(){throw new Error("Adding rows as group child is not supported")}))}removeChild(e){return oi(this).removeChild(this,e)}maximize(){return oi(this).maximize(this)}restore(){return oi(this).restore(this)}close(){return oi(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 i=void 0===t?void 0:Wt.runWithException(t);return oi(this).lockContainer(this,i)}setSize(t){return e(this,void 0,void 0,(function*(){const e=yt.runWithException(t);if(!e.width&&!e.height)throw new Error("Expected either width or height to be passed.");return oi(this).setSize(this,t.width,t.height)}))}bundleToRow(){return e(this,void 0,void 0,(function*(){yield oi(this).bundleTo(this,"row"),yield this.workspace.refreshReference()}))}bundleToColumn(){return e(this,void 0,void 0,(function*(){yield oi(this).bundleTo(this,"column"),yield this.workspace.refreshReference()}))}onLockConfigurationChanged(t){return e(this,void 0,void 0,(function*(){H(t);const i={callback:()=>e(this,void 0,void 0,(function*(){yield this.workspace.refreshReference(),t({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 yield oi(this).processLocalSubscription(this,i)}))}}const ni=new WeakMap,si=e=>ni.get(e).manager.getWorkspaceData(e),ai=e=>ni.get(e).manager;class di{constructor(e){ni.set(this,{manager:e})}get id(){return si(this).id}get frameId(){return si(this).config.frameId}get positionIndex(){return si(this).config.positionIndex}get title(){return si(this).config.title}get layoutName(){return si(this).config.layoutName}get isHibernated(){return si(this).config.isHibernated}get isSelected(){return si(this).config.isSelected}get children(){return si(this).children}get frame(){return si(this).frame}get allowSplitters(){return si(this).config.allowSplitters}get allowSystemHibernation(){return si(this).config.allowSystemHibernation}get allowDrop(){return si(this).config.allowDrop}get allowDropLeft(){return si(this).config.allowDropLeft}get allowDropTop(){return si(this).config.allowDropTop}get allowDropRight(){return si(this).config.allowDropRight}get allowDropBottom(){return si(this).config.allowDropBottom}get allowExtract(){return si(this).config.allowExtract}get allowWindowReorder(){return si(this).config.allowWindowReorder}get showCloseButton(){return si(this).config.showCloseButton}get showSaveButton(){return si(this).config.showSaveButton}get allowWorkspaceTabReorder(){return si(this).config.allowWorkspaceTabReorder}get allowWorkspaceTabExtract(){return si(this).config.allowWorkspaceTabExtract}get minWidth(){return si(this).config.minWidth}get minHeight(){return si(this).config.minHeight}get maxWidth(){return si(this).config.maxWidth}get maxHeight(){return si(this).config.maxHeight}get width(){return si(this).config.widthInPx}get height(){return si(this).config.heightInPx}get showWindowCloseButtons(){return si(this).config.showWindowCloseButtons}get showEjectButtons(){return si(this).config.showEjectButtons}get showAddWindowButtons(){return si(this).config.showAddWindowButtons}get isPinned(){return si(this).config.isPinned}removeChild(t){return e(this,void 0,void 0,(function*(){H(t);const e=this.children.find(t);e&&(yield e.close(),yield this.refreshReference())}))}remove(t){return e(this,void 0,void 0,(function*(){H(t);const e=si(this).controller.iterateFindChild(this.children,t);yield e.close(),yield this.refreshReference()}))}focus(){return e(this,void 0,void 0,(function*(){yield si(this).controller.focusItem(this.id),yield this.refreshReference()}))}close(){return e(this,void 0,void 0,(function*(){const e=si(this).controller,t=yield si(this).frame.workspaces(),i=(yield e.getPlatformFrameId()).id;if(1===t.length&&t.every((e=>e.id===this.id))&&i!==this.frame.id)return this.frame.close();yield e.closeItem(this.id)}))}snapshot(){return si(this).controller.getSnapshot(this.id,"workspace")}saveLayout(t,i){return e(this,void 0,void 0,(function*(){T.runWithException(t),yield si(this).controller.saveLayout({name:t,workspaceId:this.id,saveContext:null==i?void 0:i.saveContext,metadata:null==i?void 0:i.metadata})}))}setTitle(t){return e(this,void 0,void 0,(function*(){T.runWithException(t);const e=si(this).controller;yield e.setItemTitle(this.id,t),yield this.refreshReference()}))}getContext(){return si(this).controller.getWorkspaceContext(this.id)}setContext(e){return si(this).controller.setWorkspaceContext(this.id,e)}updateContext(e){return si(this).controller.updateWorkspaceContext(this.id,e)}onContextUpdated(e){return si(this).controller.subscribeWorkspaceContextUpdated(this.id,e)}refreshReference(){return e(this,void 0,void 0,(function*(){const e=yield si(this).controller.getSnapshot(this.id,"workspace"),t=si(this).controller.flatChildren(si(this).children),i=si(this).controller.refreshChildren({existingChildren:t,workspace:this,parent:this,children:e.children}),o=this.frame;let r;if(o.id===e.config.frameId)ai(this).remapFrame(o,e.frameSummary),r=o;else{const t={summary:e.frameSummary};r=si(this).ioc.getModel("frame",t)}ai(this).remapWorkspace(this,{config:e.config,children:i,frame:r})}))}getIcon(){return e(this,void 0,void 0,(function*(){return si(this).controller.getWorkspaceIcon(this.id)}))}setIcon(t){return e(this,void 0,void 0,(function*(){return si(this).controller.setWorkspaceIcon(this.id,t)}))}getBox(e){H(e);const t=si(this).children;return si(this).controller.iterateFindChild(t,(t=>"window"!==t.type&&e(t)))}getAllBoxes(e){H(e,!0);const t=si(this).children,i=si(this).controller.iterateFilterChildren(t,(e=>"window"!==e.type));return e?i.filter(e):i}getRow(e){return H(e),this.getBox((t=>"row"===t.type&&e(t)))}getAllRows(e){return H(e,!0),e?this.getAllBoxes((t=>"row"===t.type&&e(t))):this.getAllBoxes((e=>"row"===e.type))}getColumn(e){return H(e),this.getBox((t=>"column"===t.type&&e(t)))}getAllColumns(e){return H(e,!0),e?this.getAllBoxes((t=>"column"===t.type&&e(t))):this.getAllBoxes((e=>"column"===e.type))}getGroup(e){return H(e),this.getBox((t=>"group"===t.type&&e(t)))}getAllGroups(e){return H(e,!0),e?this.getAllBoxes((t=>"group"===t.type&&e(t))):this.getAllBoxes((e=>"group"===e.type))}getWindow(e){H(e);const t=si(this).children;return si(this).controller.iterateFindChild(t,(t=>"window"===t.type&&e(t)))}getAllWindows(e){H(e,!0);const t=si(this).children,i=si(this).controller.iterateFilterChildren(t,(e=>"window"===e.type));return e?i.filter(e):i}addRow(e){return si(this).base.addParent(this,"row","workspace",e)}addColumn(e){return si(this).base.addParent(this,"column","workspace",e)}addGroup(e){return si(this).base.addParent(this,"group","workspace",e)}addWindow(e){return si(this).base.addWindow(this,e,"workspace")}bundleToRow(){return e(this,void 0,void 0,(function*(){yield si(this).controller.bundleWorkspaceTo("row",this.id),yield this.refreshReference()}))}bundleToColumn(){return e(this,void 0,void 0,(function*(){yield si(this).controller.bundleWorkspaceTo("column",this.id),yield this.refreshReference()}))}hibernate(){return e(this,void 0,void 0,(function*(){yield si(this).controller.hibernateWorkspace(this.id),yield this.refreshReference()}))}resume(){return e(this,void 0,void 0,(function*(){yield si(this).controller.resumeWorkspace(this.id),yield this.refreshReference()}))}lock(t){return e(this,void 0,void 0,(function*(){let e;if("function"==typeof t){const i={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};e=t(i)}else e=t;const i=void 0===e?void 0:wt.runWithException(e);yield si(this).controller.lockWorkspace(this.id,i),yield this.refreshReference()}))}pin(t){return e(this,void 0,void 0,(function*(){Bt.runWithException(t),yield si(this).controller.pinWorkspace(this.id,null==t?void 0:t.icon),yield this.refreshReference()}))}unpin(){return e(this,void 0,void 0,(function*(){yield si(this).controller.unpinWorkspace(this.id),yield this.refreshReference()}))}showLoadingAnimation(){return e(this,void 0,void 0,(function*(){if(!window.glue42gd)throw new Error("Not supported in Glue42 Core");yield si(this).controller.showWorkspaceLoadingAnimation(this.id)}))}hideLoadingAnimation(){return e(this,void 0,void 0,(function*(){if(!window.glue42gd)throw new Error("Not supported in Glue42 Core");yield si(this).controller.hideWorkspaceLoadingAnimation(this.id)}))}onClosed(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"closed",eventType:"workspace",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){t({frameId:i.frameSummary.id,workspaceId:i.workspaceSummary.id,frameBounds:i.frameBounds})}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onHibernated(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"hibernated",eventType:"workspace",scope:"workspace",scopeId:i,callback:()=>e(this,void 0,void 0,(function*(){yield this.refreshReference(),t()}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onResumed(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"resumed",eventType:"workspace",scope:"workspace",scopeId:i,callback:()=>e(this,void 0,void 0,(function*(){yield this.refreshReference(),t()}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowAdded(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"added",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const e=this.getBox((e=>e.id===i.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===i.windowSummary.itemId));t(e)}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowRemoved(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"removed",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const{windowId:e,workspaceId:o,frameId:r}=i.windowSummary.config;t({windowId:e,workspaceId:o,frameId:r})}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowLoaded(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"loaded",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const e=this.getWindow((e=>e.id&&e.id===i.windowSummary.config.windowId));t(e)}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowMaximized(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"maximized",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const e=this.getBox((e=>e.id===i.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===i.windowSummary.itemId));t(e)}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowRestored(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"restored",eventType:"window