(self.webpackChunk=self.webpackChunk||[]).push([[50756],{239920:(e,t,n)=>{"use strict";n.d(t,{default:()=>s});var r,i=n(827378);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=n(296863);(e.exports=n(931506)(!1)).push([e.id,".app-authorization-modal {\n width: 100%;\n height: 100%;\n position: relative;\n}\n.app-authorization-modal iframe {\n width: 100%;\n height: 100%;\n border: none;\n}\n.app-authorization-modal .app-authorization-modal__spinner {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n}\n.app-authorization-modal .app-authorization-modal__btn-close {\n position: absolute;\n right: -20px;\n top: -20px;\n width: 40px;\n height: 40px;\n border-radius: 20px;\n background-image: url("+r(n(870064))+");\n background-repeat: no-repeat;\n background-color: #050038;\n background-size: 24px;\n background-position: 50%;\n cursor: pointer;\n}\n.app-authorization-modal.app-authorization-modal--loading {\n width: 100px;\n height: 100px;\n}\n.app-authorization-modal.app-authorization-modal--loading iframe {\n visibility: hidden;\n}\n.app-authorization-modal.app-authorization-modal--custom-postinstall-page {\n width: 800px;\n height: 600px;\n}\n.app-authorization-modal.app-authorization-modal--custom-postinstall-page iframe {\n background: white;\n border-radius: 8px;\n}\n.app-authorization-modal__overlay {\n position: fixed;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n}\n",""])},439454:(e,t,n)=>{(e.exports=n(931506)(!1)).push([e.id,".iframe-modal .md-content iframe {\n display: block;\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 16px;\n}\n.iframe-modal .md-content .rtb-material-spinner {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n}\n",""])},222765:(e,t,n)=>{(e.exports=n(931506)(!1)).push([e.id,".rtb-material-spinner {\n position: relative;\n margin: 0 auto;\n width: 40px;\n}\n.rtb-material-spinner:before {\n content: '';\n display: block;\n padding-top: 100%;\n}\n.rtb-material-spinner-circular {\n animation: rotate 2s linear infinite;\n height: 100%;\n transform-origin: center center;\n width: 100%;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n}\n.rtb-material-spinner-path {\n stroke-dasharray: 1, 200;\n stroke-dashoffset: 0;\n animation: dash 1.5s ease-in-out infinite;\n stroke-linecap: round;\n stroke: #4262ff;\n}\n.rtb-material-spinner--white .rtb-material-spinner-path {\n stroke: #ffffff;\n stroke-width: 4;\n}\n@keyframes rotate {\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes dash {\n 0% {\n stroke-dasharray: 1, 200;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 89, 200;\n stroke-dashoffset: -35px;\n }\n 100% {\n stroke-dasharray: 89, 200;\n stroke-dashoffset: -124px;\n }\n}\n",""])},259618:(e,t,n)=>{(e.exports=n(931506)(!1)).push([e.id,".rtb-modal-container.iframe-modal {\n width: auto;\n max-width: 100%;\n max-height: 100%;\n}\n.rtb-modal-container.iframe-modal .rtb-modal-container__content {\n padding-top: 56px;\n padding-bottom: 60px;\n}\n.iframe-modal.iframe-modal--fullscreen {\n width: 100%;\n height: 100%;\n border-radius: 0;\n}\n.iframe-modal.iframe-modal--fullscreen .rtb-modal-container__content {\n border-radius: 0;\n}\n.iframe-modal.iframe-modal--fullscreen .iframe-modal__iframe {\n width: 100%;\n height: 100%;\n}\n.iframe-modal .rtb-modal-container__content {\n height: 100%;\n}\n.iframe-modal .rtb-modal-container__content .rtb-modal-content__body,\n.iframe-modal .rtb-modal-container__content section {\n height: 100%;\n margin: 0;\n}\n.iframe-modal .rtb-modal-container__content section {\n max-width: 100%;\n overflow: hidden;\n}\n.iframe-modal .rtb-modal-container__content .iframe-modal__iframe--loading {\n opacity: 0;\n}\n.iframe-modal .rtb-modal-container__content .rtb-material-spinner {\n position: absolute;\n left: 50%;\n top: 50%;\n margin-left: -20px;\n}\n.iframe-modal .rtb-modal-container__content .iframe-modal__iframe {\n border: 0;\n max-width: 100%;\n max-height: calc(100vh - 56px - 60px);\n}\n",""])},424576:(e,t,n)=>{(t=e.exports=n(931506)(!1)).push([e.id,".chip-2U_KS {\n box-sizing: border-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -ms-flex-align: center;\n align-items: center;\n max-width: 300px;\n border-radius: 125px;\n}\n.chip-2U_KS.chip_clickable,\n.chip-2U_KS.chip_hoverable {\n cursor: pointer;\n}\n.chip-2U_KS .chip__content {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n.chip-2U_KS .chip__deleteButton {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n padding-right: 6px;\n padding-left: 6px;\n margin-right: -8px;\n color: #d9e0ff;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n cursor: pointer;\n}\n.chip-2U_KS .chip__deleteButton[disabled] {\n opacity: 0.4;\n}\n.chip-2U_KS.chip_large {\n height: 32px;\n line-height: 32px;\n padding-right: 12px;\n padding-left: 12px;\n}\n.chip-2U_KS.chip_large .chip__deleteButton {\n height: 32px;\n}\n.chip-2U_KS.chip_medium {\n height: 28px;\n line-height: 28px;\n padding-right: 10px;\n padding-left: 10px;\n}\n.chip-2U_KS.chip_medium .chip__deleteButton {\n height: 28px;\n}\n.chip-2U_KS.chip_small {\n height: 24px;\n line-height: 24px;\n font-size: 12px;\n padding-right: 6px;\n padding-left: 6px;\n}\n.chip-2U_KS.chip_small .chip__deleteButton {\n height: 24px;\n}\n.chip-2U_KS.chip_primary {\n background-color: #4262ff;\n color: #ffffff;\n}\n.chip-2U_KS.chip_primary:not(.chip_noHover):not(.chip_transparent):hover,\n.chip-2U_KS.chip_primary:not(.chip_noHover):not(.chip_transparent):focus-visible {\n background-color: #455bed;\n}\n.chip-2U_KS.chip_primary .chip__deleteButton {\n color: #d9e0ff;\n}\n.chip-2U_KS.chip_primary .chip__deleteButton:hover,\n.chip-2U_KS.chip_primary .chip__deleteButton:focus-visible {\n color: #6881ff;\n}\n.chip-2U_KS.chip_secondary {\n background-color: #f0f0f3;\n}\n.chip-2U_KS.chip_secondary:not(.chip_noHover):not(.chip_transparent):hover,\n.chip-2U_KS.chip_secondary:not(.chip_noHover):not(.chip_transparent):focus-visible {\n background-color: #ebebef;\n}\n.chip-2U_KS.chip_secondary .chip__deleteButton {\n color: #5f5c80;\n}\n.chip-2U_KS.chip_secondary .chip__deleteButton:hover,\n.chip-2U_KS.chip_secondary .chip__deleteButton:focus-visible {\n color: #050038;\n}\n.chip-2U_KS.chip_danger {\n background: #fdf2f2;\n color: #050038;\n}\n.chip-2U_KS.chip_danger:not(.chip_noHover):not(.chip_transparent):hover,\n.chip-2U_KS.chip_danger:not(.chip_noHover):not(.chip_transparent):focus-visible {\n background-color: #f7d4d4;\n}\n.chip-2U_KS.chip_danger .chip__deleteButton {\n color: #5f5c80;\n}\n.chip-2U_KS.chip_danger .chip__deleteButton:hover,\n.chip-2U_KS.chip_danger .chip__deleteButton:focus-visible {\n color: #050038;\n}\n.chip-2U_KS.chip_primaryBordered {\n border: 1px solid #d9e0ff;\n color: #4262ff;\n}\n.chip-2U_KS.chip_primaryBordered .chip__deleteButton {\n color: #d9e0ff;\n}\n.chip-2U_KS.chip_primaryBordered .chip__deleteButton:hover,\n.chip-2U_KS.chip_primaryBordered .chip__deleteButton:focus-visible {\n color: #6881ff;\n}\n.chip-2U_KS.chip_transparent {\n background-color: transparent;\n border: none;\n color: #050038;\n}\n.chip-2U_KS.chip_transparent .chip__deleteButton {\n opacity: 0;\n pointer-events: none;\n}\n.chip-2U_KS.chip_disabled {\n pointer-events: none;\n}\n",""]),t.locals={chip:"chip-2U_KS"}},441475:(e,t,n)=>{(t=e.exports=n(931506)(!1)).push([e.id,".searchInput-EMTVA {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-direction: row;\n flex-direction: row;\n font-size: 14px;\n padding-left: 38px;\n padding-right: 14px;\n position: relative;\n}\n.searchInput-EMTVA:hover .searchInput__icon-zKryY,\n.searchInput-EMTVA:focus-within .searchInput__icon-zKryY,\n.searchInput-EMTVA .searchInput__input-3nsfs:focus + .searchInput__icon-zKryY {\n color: #455bed;\n}\n.searchInput-EMTVA .searchInput__icon-zKryY {\n width: 24px;\n height: 24px;\n position: absolute;\n left: 0;\n}\n.searchInput-EMTVA .searchInput__icon-zKryY svg {\n transition-property: color;\n transition-duration: 500ms;\n}\n.searchInput-EMTVA .searchInput__buttonsContainer-lnjeU {\n display: inline-block;\n}\n.searchInput-EMTVA .searchInput__buttonsContainer-lnjeU .searchInput__button-2RspY {\n top: 6px;\n right: 0;\n width: 24px;\n height: 24px;\n padding: 6px 2px;\n margin-left: 10px;\n cursor: pointer;\n display: inline-block;\n}\n.searchInput-EMTVA .searchInput__clearIconButton-3zy_I {\n padding: 0;\n position: relative;\n}\n.searchInput-EMTVA .searchInput__clearIconButton-3zy_I:focus,\n.searchInput-EMTVA .searchInput__clearIconButton-3zy_I:focus-visible {\n outline: none;\n}\n.searchInput-EMTVA .searchInput__clearIconButton-3zy_I:focus-visible:before {\n box-shadow: inset 0 0 0 1px #455bed, 0 0 0 1px #455bed, 0 0 0 5px #d9e0ff;\n border-radius: 4px;\n content: '';\n position: absolute;\n left: -1px;\n right: -1px;\n top: -1px;\n bottom: -1px;\n}\n.searchInput-EMTVA .searchInput__inputContainer-3U6wl {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex: 0 1 100%;\n flex: 0 1 100%;\n font-size: inherit;\n}\n.searchInput-EMTVA .searchInput__bricks-2gvDc {\n display: -ms-flexbox;\n display: flex;\n}\n.searchInput-EMTVA .searchInput__brick-3A4CN {\n margin-right: 8px;\n animation: fadein-33BW_ 0.2s ease;\n}\n.searchInput-EMTVA .searchInput__input-3nsfs {\n -ms-flex: 0 1 100%;\n flex: 0 1 100%;\n width: 100%;\n padding: 2px 0 4px;\n font-size: inherit;\n height: 36px;\n border-radius: 0;\n background-origin: border-box;\n background-size: 0 0;\n color: #050038;\n border: none transparent;\n background: transparent;\n}\n.searchInput-EMTVA .searchInput__input-3nsfs:-ms-input-placeholder {\n color: #5f5c80;\n -ms-user-select: none;\n user-select: none;\n}\n.searchInput-EMTVA .searchInput__input-3nsfs::placeholder {\n color: #5f5c80;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n@keyframes fadein {\n from {\n opacity: 0.5;\n }\n to {\n opacity: 1;\n }\n}\n",""]),t.locals={searchInput:"searchInput-EMTVA",searchInput__icon:"searchInput__icon-zKryY",searchInput__input:"searchInput__input-3nsfs",searchInput__buttonsContainer:"searchInput__buttonsContainer-lnjeU",searchInput__button:"searchInput__button-2RspY",searchInput__clearIconButton:"searchInput__clearIconButton-3zy_I",searchInput__inputContainer:"searchInput__inputContainer-3U6wl",searchInput__bricks:"searchInput__bricks-2gvDc",searchInput__brick:"searchInput__brick-3A4CN",fadein:"fadein-33BW_"}},860902:e=>{e.exports='\n\t\n\t\n\n'},598129:(e,t,n)=>{var r=n(752033);e.exports=function(e,t){var n=[];return r(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}},262690:(e,t,n)=>{var r=n(339158),i=n(825348),o=n(863528),a=n(365567);e.exports=function(e){return function(t){t=a(t);var n=i(t)?o(t):void 0,s=n?n[0]:t.charAt(0),c=n?r(n,1).join(""):t.slice(1);return s[e]()+c}}},797429:(e,t,n)=>{var r=n(698052),i=n(368267)((function(e,t,n){return t=t.toLowerCase(),e+(n?r(t):t)}));e.exports=i},698052:(e,t,n)=>{var r=n(365567),i=n(276744);e.exports=function(e){return i(r(e).toLowerCase())}},36874:(e,t,n)=>{e.exports=n(301827)},669238:(e,t,n)=>{var r=n(610263),i=n(598129),o=n(189278),a=n(719785);e.exports=function(e,t){return(a(e)?r:i)(e,o(t,3))}},931091:(e,t,n)=>{var r=n(189278),i=n(692198);e.exports=function(e,t){return e&&e.length?i(e,r(t,2)):[]}},276744:(e,t,n)=>{var r=n(262690)("toUpperCase");e.exports=r},22077:(e,t,n)=>{var r=n(401892),i=n(691585);"string"===typeof(i=i.__esModule?i.default:i)&&(i=[[e.id,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},660875:(e,t,n)=>{var r=n(401892),i=n(439454);"string"===typeof(i=i.__esModule?i.default:i)&&(i=[[e.id,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},851362:(e,t,n)=>{var r=n(401892),i=n(222765);"string"===typeof(i=i.__esModule?i.default:i)&&(i=[[e.id,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},631375:(e,t,n)=>{var r=n(401892),i=n(259618);"string"===typeof(i=i.__esModule?i.default:i)&&(i=[[e.id,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},720541:(e,t,n)=>{var r=n(401892),i=n(424576);"string"===typeof(i=i.__esModule?i.default:i)&&(i=[[e.id,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},631:(e,t,n)=>{var r=n(401892),i=n(441475);"string"===typeof(i=i.__esModule?i.default:i)&&(i=[[e.id,i,""]]);var o={insert:"head",singleton:!1};r(i,o);e.exports=i.locals||{}},534426:(e,t,n)=>{"use strict";n.d(t,{default:()=>l});var r=n(334529),i=n(759312),o=function(e){function t(t,n,r){var i=this.constructor,o=e.call(this,n)||this;return Object.setPrototypeOf(o,i.prototype),o.name=t,o.commandId=r.commandId,o.pluginId=r.context.pluginId,o}return(0,i.__extends)(t,e),t}(Error),a=function(e){function t(t,n){var r=this,i=n instanceof Error?n.message:"Some error while command execution";return(r=e.call(this,"CommandExecutionError",i,t)||this).originalError=n,r}return(0,i.__extends)(t,e),t}(o),s=function(e){function t(t){return e.call(this,"CommandNotFoundError","Command for '".concat(JSON.stringify(t.context),"' not found"),t)||this}return(0,i.__extends)(t,e),t}(o),c=function(e){function t(t){return e.call(this,"CommandReceiverNotFoundError","Command ".concat(t.commandId," not found. Context ='").concat(JSON.stringify(t.context),"'"),t)||this}return(0,i.__extends)(t,e),t}(o),u=function(e){function t(t){return e.call(this,"CommandResponseByTokenNotFoundError","Response by token not found ".concat(t.commandToken),t)||this}return(0,i.__extends)(t,e),t}(o);const l=function(){function e(e,t){this.waitingForResponseCommands=new Map,this.sendHandler=e,this.findReceiverByContext=t}return e.prototype.sendCommand=function(e,t,n){var i=this;return new Promise((function(o,a){var s="".concat(e,"-").concat((0,r.getRandomString)()),c={commandId:e,commandToken:s,context:t,data:n};i.waitingForResponseCommands.set(s,{resolve:o,reject:a}),i.sendHandler(c)}))},e.prototype.processCommand=function(t){var n,r,i=this;if(t.commandId===e.RESPONSE_COMMAND_ID){var o=this.waitingForResponseCommands.get(t.commandToken);if(o)return this.waitingForResponseCommands.delete(t.commandToken),t.errorInResponse?(o.reject(t.data),Promise.resolve({error:t.data})):(o.resolve(t.data),Promise.resolve({result:t.data}));var l=new u(t);return console.error(l.message),Promise.resolve({error:l})}var d=this.findReceiverByContext(t.context);if(!d){l=new c(t);return console.error(l.message),Promise.resolve({error:l})}var p,f=t.commandId.slice(1).split("."),h=d;if(f.forEach((function(e,t){t===f.length-1?p=h[e]:h=h[e]})),!p){l=new s(t);return console.error(l.message),Promise.resolve({error:l})}if(h.isInternal&&!0!==(null===(r=null===(n=h.controller.appInstallation)||void 0===n?void 0:n.application)||void 0===r?void 0:r.internal)){l=new c(t);return Promise.resolve({error:l})}try{var g=p.apply(h,t.data);return this.isPromise(g)?g.then((function(e){return i.sendResponse(t,e,!0),{result:e}})).catch((function(e){return console.error(e),i.sendResponse(t,"Some error while command execution",!1),{error:new a(t,e)}})):(this.sendResponse(t,g,!0),Promise.resolve({result:g}))}catch(e){return this.sendResponse(t,"Error while command execution: ".concat(e.message),!1),Promise.resolve({error:new a(t,e)})}},e.prototype.isPromise=function(e){return e&&void 0!==e.then&&void 0!==e.catch},e.prototype.sendResponse=function(t,n,r){var i={commandId:e.RESPONSE_COMMAND_ID,commandToken:t.commandToken,context:t.context,errorInResponse:!r,data:n};this.sendHandler(i)},e.RESPONSE_COMMAND_ID="IS_RESPONSE_FOR_SOME_COMMAND",e}()},786339:(e,t,n)=>{"use strict";n.d(t,{remote:()=>a,remoteReceiver:()=>s,internalReceiverClass:()=>c,encode:()=>u,buildConnector:()=>l,getMethodPath:()=>d});var r=n(759312),i="__receiverDescriptionFieldName";function o(e){e[i]||(e[i]={methods:[],nestedReceivers:[]})}function a(e,t){o(e),e[i].methods.push(t)}function s(e){return function(t,n){if(o(t),!e.prototype[i])throw new Error("NestedReceiver does not contain any remote methods");t[i].nestedReceivers.push({key:n,isInternal:!0===e.isInternal,receiver:e.prototype[i]})}}function c(e){return e.isInternal=!0,function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isInternal=!0,t}return(0,r.__extends)(t,e),t}(e)}function u(e){var t=e.commandsReceiver,n=e.includeInternals;return void 0!==n&&n?t.prototype[i]:{methods:t.prototype[i].methods,nestedReceivers:t.prototype[i].nestedReceivers.filter((function(e){return!e.isInternal}))}}function l(e,t,n,r){n.methods.forEach((function(n){t[n]=function(){for(var t=[],i=0;i{"use strict";n.d(t,{default:()=>a});var r=n(399887),i=n(237216),o=n(563882);function a(){n(851362),(0,i.getRtbApp)().component("materialSpinner",(0,r.react2angular)(e)(o.default,["width","color","strokeWidth"]))}e=n.hmd(e)},292562:(e,t,n)=>{"use strict";var r;n.d(t,{default:()=>i}),function(e){e.HELLO_APP_FROM_IFRAME="HELLO_APP_FROM_IFRAME",e.HELLO_IFRAME_FROM_APP="HELLO_IFRAME_FROM_APP",e.IFRAME_CHANNEL_COMMAND="IFRAME_CHANNEL_COMMAND"}(r||(r={}));const i=r},450645:(e,t,n)=>{"use strict";n.d(t,{default:()=>d});var r=n(100319),i=n(502009),o=n(8994),a=n(955833),s=n(445569),c=n(127192),u=n(576163),l=i.FieldType.createFieldStr({id:{},title:{},createdAt:{},permissions:{},role:{},installedApplications:{array:!0,fields:{currentUserAuthorization:{},application:{id:{}}}},picture:{}});function d(e,t){if((0,s.default)().userType!==c.UserType.REGULAR)throw Error("Account requests not available for guests");return r.default.accounts.selectById(t).get({fields:l}).then((function(t){var n,r,i=[];(0,u.hasRoleInAccount)(t)&&(null===(n=t.permissions)||void 0===n?void 0:n.includes(o.AccountRolePermissions.SETUP_PLUGINS))&&i.push("MANAGE_APPS");var s=t.installedApplications.find((function(t){return t.application.id===e}));return{scopes:(null===(r=null===s||void 0===s?void 0:s.currentUserAuthorization)||void 0===r?void 0:r.scopes)||[],account:{id:t.id,title:t.title,currentUserPermissions:i,createdAt:t.createdAt,picture:(0,a.getSdkPicture)(t.picture)}}}))}},312914:(e,t,n)=>{"use strict";n.d(t,{default:()=>s});var r=n(759312),i=n(786339);const o=function(e,t){this.controller=e,this.root=t};var a=n(450645);const s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype.get=function(){return(0,a.default)(this.controller.appKey,this.controller.getAccountId()).then((function(e){return e.account}))},(0,r.__decorate)([i.remote],t.prototype,"get",null),t}(o)},504481:(e,t,n)=>{"use strict";n.d(t,{default:()=>i});var r=n(292562);function i(e,t,n,i){if(void 0===i&&(i=!1),n.data.rtbSuperCommandID)if(n.data.rtbSuperCommandID===r.default.IFRAME_CHANNEL_COMMAND){if("IS_RESPONSE_FOR_SOME_COMMAND"===n.data.data.commandId&&!i)return;console.info("%c".concat(e),"color: ".concat(t,";"),n.data.data.commandId,n.data)}else console.info("%c".concat(e),"color: ".concat(t,";"),n.data)}},699165:(e,t,n)=>{"use strict";n.d(t,{default:()=>c});var r=n(759312),i=n(786339),o=n(728692),a=Promise.resolve(!0);function s(e){return"object"!==typeof e?("WidgetMenuItem is '".concat(typeof e,"', but have to be 'object'"),!1):e.hasOwnProperty("tooltip")&&"string"===typeof e.tooltip?e.hasOwnProperty("svgIcon")&&"string"===typeof e.svgIcon?!(!e.hasOwnProperty("onClick")||"function"!==typeof e.onClick)||("WidgetMenuItem.onClick is '".concat(typeof e.onClick,"', but have to be 'function'"),!1):("WidgetMenuItem.svgIcon is '".concat(typeof e.svgIcon,"', but have to be 'string'"),!1):("WidgetMenuItem.tooltip is '".concat(typeof e.tooltip,"', but have to be 'string'"),!1)}const c=function(){function e(e){this.buttonsClickListeners={},this.menuItemsClickListeners={},this.currentDraggableItemOptions={},this.eventDispatcher=e}return e.prototype.setDraggableItemOption=function(e,t){this.currentDraggableItemOptions[e]=t},e.prototype.setDraggableItem=function(e){this.currentDraggableItem=e},e.prototype.addOnWidgetSelectedListener=function(e){"function"!==typeof e||(this.getMenuItems=e)},e.prototype.addButtonClickListener=function(e,t){this.buttonsClickListeners[e]=t},e.prototype.onWidgetsSelected=function(e,t){return(0,r.__awaiter)(this,void 0,void 0,(function(){var n,i=this;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.getMenuItems(e,t)];case 1:return n=r.sent(),Array.isArray(n)||(n=[n]),n.every(s)?(n.forEach((function(e,t){e.onClick&&(i.menuItemsClickListeners["widgetMenuItems_".concat(t)]=e.onClick)})),[2,n.map((function(e){return{tooltip:e.tooltip,svgIcon:e.svgIcon}}))]):[2,[]]}}))}))},e.prototype.callMenuItemClickListener=function(e){this.menuItemsClickListeners["widgetMenuItems_".concat(e)]()},e.prototype.dispatchEvent=function(e){var t=!1;return this.eventDispatcher.dispatchEvent(new o.default(e.type,e.data,(function(){t=!0}))),Promise.resolve(t)},e.prototype.callExtensionPointClickListener=function(e){this.buttonsClickListeners[e]()},e.prototype.areYouAlive=function(){return a},e.prototype.currentDraggableItemDropped=function(e,t,n){this.currentDraggableItemOptions[e]&&this.currentDraggableItem&&this.currentDraggableItemOptions[e].onDrop(t,n,this.currentDraggableItem)},e.prototype.currentDraggableItemCanceled=function(e){var t,n=null===(t=this.currentDraggableItemOptions[e])||void 0===t?void 0:t.onCancel;n&&n()},(0,r.__decorate)([i.remote],e.prototype,"onWidgetsSelected",null),(0,r.__decorate)([i.remote],e.prototype,"callMenuItemClickListener",null),(0,r.__decorate)([i.remote],e.prototype,"dispatchEvent",null),(0,r.__decorate)([i.remote],e.prototype,"callExtensionPointClickListener",null),(0,r.__decorate)([i.remote],e.prototype,"areYouAlive",null),(0,r.__decorate)([i.remote],e.prototype,"currentDraggableItemDropped",null),(0,r.__decorate)([i.remote],e.prototype,"currentDraggableItemCanceled",null),e}()},955833:(e,t,n)=>{"use strict";function r(e){return{big:e.big,medium:e.medium,small:e.small,image:e.image}}function i(e){return{id:e.id,name:e.name,email:e.email,picture:r(e.picture)}}n.d(t,{getSdkPicture:()=>r,getSdkUser:()=>i})},678230:(e,t,n)=>{"use strict";var r;n.d(t,{default:()=>i}),function(e){e.TOP="t",e.MIDDLE="m",e.BOTTOM="b"}(r||(r={}));const i=r},990155:(e,t,n)=>{"use strict";n.d(t,{openGoogleDrive:()=>m,init:()=>v});var r,i,o,a=n(445569),s=n(628285),c=n(363591),u=n(105603),l=a.getInjectionPoint(),d=s.getInjectionPoint(),p=c.getInjectionPoint(),f=u.getInjectionPoint(),h=!1;function g(e,t){p().load("picker").then((function(){h=!0,function(e,t){if("ImageSearch"==e){var n=new google.picker.View(google.picker.ViewId.IMAGE_SEARCH);n.setMimeTypes("image/png,image/jpeg,image/jpg,image/bmp,image/gif"),(r=(new google.picker.PickerBuilder).addView(n).enableFeature(google.picker.Feature.MULTISELECT_ENABLED).enableFeature(google.picker.Feature.NAV_HIDDEN).hideTitleBar().setCallback(t).build()).setVisible(!0)}"VideoSearch"==e&&(i=(new google.picker.PickerBuilder).addView(new google.picker.View(google.picker.ViewId.VIDEO_SEARCH)).enableFeature(google.picker.Feature.NAV_HIDDEN).hideTitleBar().setCallback(t).build()).setVisible(!0);"GoogleDrive"==e&&_(t)}(e,t)})).fail((function(e){return f().showErrorByData(e)}))}function _(e){var t=new google.picker.DocsView(google.picker.ViewId.DOCS);t.setEnableTeamDrives(!0),(o=(new google.picker.PickerBuilder).addView(google.picker.ViewId.DOCS).addView(t).enableFeature(google.picker.Feature.MULTISELECT_ENABLED).enableFeature(google.picker.Feature.SUPPORT_TEAM_DRIVES).hideTitleBar().setCallback(e).setOAuthToken(l().socialAccounts.google.getGoogleDriveToken()).build()).setVisible(!0)}function m(e){l().socialAccounts.google.authorizeOrRefreshGoogleDrive().then((function(){h?_(e):g("GoogleDrive",e)})).catch((function(){return e({action:"cancel"})}))}function v(){d().routeChanged.add((function(){y(r),y(i),y(o)}))}function y(e){e&&e.setVisible(!1)}},810104:(e,t,n)=>{"use strict";n.d(t,{produceDOMDummyController:()=>d,produceLibraryDummyController:()=>f});var r=n(759312),i=n(438464),o=n(393917),a=n(250399),s=n(215139),c=n(128481),u=n(648398),l=n(332378);function d(e,t,n){var r;return{create:function(){for(var t,n=[],i=0;i'))},e.prototype.dropFn=function(e){(0,a.initPosition)(new i.default.Point(e.x,e.y)),(0,o.dropResourceToCanvas)(this.data)},e.prototype.produceLibraryDummyController=function(){var e=d(this.createFn.bind(this),this.dropFn.bind(this));return e.droppableFromToolbar=!1,e},e}();!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,r.__extends)(t,e),t.prototype.createFn=function(e,t,n){this.data=n;var r=this.data.skin||this.data.code;(0,a.initPosition)(new i.default.Point(e.x,e.y));var o=c.EMOJI_SIZE*u.canvasController.canvasScale/2,d=c.EMOJI_SIZE_COEFF/u.canvasController.canvasScale;return l('
').concat((0,s.emojiSvgTemplate)(r,d),"
"))}}(p);function f(){return(new p).produceLibraryDummyController()}},165957:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>xi});var r=n(759312),i=n(270204),o=n(103238),a=n(534426),s=n(292562),c=n(366115),u=n(786339),l=n(699165),d=n(264495),p=n(548966),f=n(250399),h=n(521420),g=n(272473),_=n(810104),m=n(648398),v=n(957453),y=n(612830),E=n(669238),T=n.n(E);const I=function(e,t){this.controller=e,this.root=t};var w;!function(e){e.EDIT_INFO="EDIT_INFO",e.EDIT_CONTENT="EDIT_CONTENT",e.EDIT_COMMENTS="EDIT_COMMENTS"}(w||(w={}));const A=w;var S=n(480573),b=n(901646),C=n(22043),D=n(438464),O=n(100319),R=n(126978),P=n(36874),N=n.n(P),k=n(913993);const x={wrongInputWidgetArgument:function(){return"..."},valueHasNotAssignableType:function(e,t){return"Value '".concat(e,"' is not assignable to '").concat(t,"'")},rateLimitExceeded:function(e,t){return"Plugins calls are limited for ".concat(e," points per ").concat(t,"sec")},totalPointsLimitsExceeded:function(){return"Total points limits exceeded for all plugins. Please reload the page"},noInputWidgetsPassed:function(){return"No widgets passed. Method can accept string[] or {id: string}[]"},noWidgetsPassedForCreateOrUpdate:function(){return"Wrong argument. Please, pass array of widgets"},fieldIsUnsupported:function(e,t){return"Field '".concat(e,"' is unsupported for '").concat(t,"' widget")},updatingWidgetNotFound:function(e){return"Widget with id=".concat(e," not found and skipped")},createNotSupported:function(e){return"Sorry, miro.board.widgets.create() does not support widgetType '".concat(e,"' yet")},updateNotSupported:function(e){return"Sorry, miro.board.widgets.update() does not support widgetType '".concat(e,"' yet")},convertNotSupported:function(e){return"Sorry, conversion to '".concat(e,"' isn't supported")},creatingWidgetIsNotAnObject:function(){return"Wrong argument passed to miro.board.widgets.create(widgets: {type: string; [index: string]: any}[]).\n\n\t\t'widgets' should have 'object' type.\n"},updatingWidgetIsNotAnObject:function(){return"Wrong argument passed to miro.board.widgets.update(widgets: {id: string; [index: string]: any}[]).\n\n\t\t'widgets' should have 'object' type.\n"},typeFieldIsRequiredForCreate:function(){return"Wrong argument passed to miro.board.widgets.create(widgets: {type: string; [index: string]: any}[]).\n\n\t\tField 'type:string' is required.\n"},idFieldIsRequiredForUpdate:function(){return"Wrong argument passed to miro.board.widgets.update(widgets: {id: string; [index: string]: any}[]).\n\n\tField 'id:string' is required\n"},equalStartAndEndWidgetsInLine:function(){return"'line.startWidgetId' can not be equal 'line.endWidgetId'"},urlSchemaNotWhitelisted:function(e,t){return"URL schema not supported for '".concat(e,"'. Supported schemas are: ").concat(t)},pluginUrlHasWrongFormat:function(e){return'Plugin main uri "'.concat(e,'" has wrong format')},pluginUrlMustBeAbsoluteOutsidePlugin:function(){return"Url must be absolute when API is called outside plugin"},tagDoesntExist:function(e){return"Tag with id: ".concat(e," does not exist")},widgetDoesntExist:function(e){return"Widget with id: ".concat(e," does not exist")},widgetWithTypeDoesntSupportTags:function(e,t){return"Widget with id: ".concat(e," - ").concat(t," does not support tags")},tagWithTitleAlreadyExists:function(e){return"Widget with title: ".concat(e," already exists")},tagMustHaveNonEmptyTitle:function(){return"The tag must have a non-empty title"},totalTagsOnBoardLimitsExceeded:function(){return"Total tags on board limits exceeded"},unsupportedFieldForTag:function(e){return"Field '".concat(e,"' is unsupported for tag")},svgContentFieldIsRequired:function(){return"Field 'content' is required"},invalidSvgContent:function(){return"Invalid svg content"},maximumSvgSizeExceeded:function(e,t){return"Exceeded maximum SVG size. ".concat(e,"/").concat(t)},svgSizeNotSet:function(){return"Size of the svg element are not set explicitly and will set by default. Use 'width' and 'height' attributes on the svg root."}};function L(e,t,n){return function(r){return!(!t||"undefined"!==typeof r)||(typeof r===n||x.valueHasNotAssignableType("".concat(r,":").concat(typeof r),"".concat(e,":").concat(n)))}}function M(e,t){return void 0===t&&(t=!1),L(e,t,"number")}function W(e,t){return void 0===t&&(t=!1),L(e,t,"string")}function U(e,t){return void 0===t&&(t=!1),L(e,t,"boolean")}function B(e){return function(t){return"object"===typeof t||x.valueHasNotAssignableType("".concat(t,":").concat(typeof t),"".concat(e,":Style"))}}function F(e){return function(t){return"object"===typeof t||x.valueHasNotAssignableType(t,"".concat(e,":object"))}}function G(e){return function(t){return!!Array.isArray(t)||x.valueHasNotAssignableType(t,"".concat(e,":Array"))}}function z(e,t){return void 0===t&&(t=0),"number"===typeof e?e:t}function V(e){return function(){return"'".concat(e,"' does not support modifying yet"),!0}}const H=function(){function e(){this.requiredFieldsToCreate=[]}return e.prototype.create=function(e){throw new Error(x.createNotSupported(Zt(this.widgetType)))},e.prototype.update=function(e,t){throw new Error(x.updateNotSupported(Zt(this.widgetType)))},e.prototype.convert=function(e,t){throw new Error(x.convertNotSupported(Zt(this.widgetType)))},e.prototype.convertInnerToSdkData=function(e){throw new Error("convertInnerToSdkData not implemented")},e.prototype.convertSdkToInnerData=function(e,t){throw new Error("convertSdkToInnerData not implemented")},e}();const K=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.widgetType=b.WidgetType.EMBED,t.supportedFieldsForWrite={x:M("embed.x"),y:M("embed.y"),scale:M("embed.scale"),html:W("embed.html")},t.requiredFieldsToCreate=["html"],t}return(0,r.__extends)(t,e),t.prototype.create=function(e){var t=this;if(void 0===e&&(e={}),!e.html)throw new Error("'html' field is required for EmbedWidget");var n=e.html;return(0,C.EmbedWidgetController)().isEmbed(n)?this.createEmbed((function(e,t){(0,C.EmbedWidgetController)().createFromIFrame(n,e,t)}),e):this.createEmbed((function(e,r){t.createEmbedURL(n,e,r)}),e)},t.prototype.update=function(e,t){var n=this.convertSdkToInnerData(t,e);return(0,C.EmbedWidgetController)().update(e,n),Promise.resolve(e)},t.prototype.createEmbed=function(e,t){var n=this;return new Promise((function(r){(0,C.EmbedWidgetController)().widgetCreated.addOnce((function(e){setTimeout((function(){r(e)}),1e3)}));var i=new D.default.Point(t.x||0,t.y||0),o=n.convertSdkToInnerData(t).custom_data;e(o,i)}))},t.prototype.createEmbedURL=function(e,t,n){O.default.embedly.get(e).then((function(r){var i=N()(r,t,(function(e,t){return t||e}));(0,C.EmbedWidgetController)().createFromOEmbed(e,i,n||new D.default.Point,!0)})).catch((function(e){var t=(0,R.getJsonError)(e).message||"Create embed widget failed";throw new Error(t)}))},t.prototype.convertSdkToInnerData=function(e,t){var n=z(t&&t.height,0),r=z(t&&t.width,0);return{custom_data:{height:n,width:r,html:e.html||"",prv:k.EMBED_PROVIDER.UNKNOWN},size:{height:n,width:r},position:{x:z(e.x,t&&t.x),y:z(e.y,t&&t.y)},rotation:{rotation:t&&t.rotation||0},scale:{scale:t&&t.scale||1}}},t.prototype.convertInnerToSdkData=function(e){var t=Pt(this,e);return t.x=e.x,t.y=e.y,t.scale=e.scale,t.html=e.getHTML(),t},t}(H);var j=n(897842),Y=n(178909),X=n(620579),Z=n(201014),J=n(850348),q=n(988082),Q=function(e){return e},$={},ee={};function te(e,t,n,r){$[e]={name:t,converter:n||Q},ee[t]={name:e,converter:r||Q}}te("backgroundOpacity",J.Style.BACKGROUND_OPACITY),te("backgroundColor",J.Style.BACKGROUND_COLOR,re,ie),te("stickerBackgroundColor",J.Style.STICKER_BACKGROUND_COLOR,re,ie),te("borderColor",J.Style.BORDER_COLOR,re,ie),te("borderWidth",J.Style.BORDER_WIDTH),te("borderStyle",J.Style.BORDER_STYLE),te("borderOpacity",J.Style.BORDER_OPACITY),te("fontSize",J.Style.FONT_SIZE),te("fontFamily",J.Style.FONT_FAMILY),te("textColor",J.Style.TEXT_COLOR,re,ie),te("textAlign",J.Style.TEXT_ALIGN),te("textAlignVertical",J.Style.TEXT_ALIGN_VERTICAL),te("shapeType",J.Style.SHAPE_STYLE),te("lineColor",J.Style.LINE_COLOR,re,ie),te("lineStyle",J.Style.LINE_STYLE),te("lineThickness",J.Style.LINE_THICKNESS),te("lineType",q.LineStyleObject.STYLE.LINE_TYPE),te("lineStartStyle",q.LineStyleObject.STYLE.HEAD_TYPE_START),te("lineEndStyle",q.LineStyleObject.STYLE.HEAD_TYPE_END),te("padding",J.Style.PADDING),te("bold",J.Style.BOLD),te("italic",J.Style.ITALIC),te("underline",J.Style.UNDERLINE),te("strike",J.Style.STRIKE),te("highlighting",J.Style.HIGHLIGHTING),te("stickerType",J.Style.STICKER_TYPE),te("shapeColor",J.Style.SHAPE_COLOR,re,ie);var ne=new Z.Color;function re(e){return"number"===typeof e?e:"transparent"===e?-1:"string"===typeof e?(ne.setColor(e),ne.getNumber()):0}function ie(e){return-1===e?"transparent":(ne.setIntColor(e),ne.getHEX())}function oe(e){var t={};for(var n in e)if(e.hasOwnProperty(n)&&$.hasOwnProperty(n)){var r=$[n];t[r.name]=r.converter(e[n])}else"Converting sdk to inner format, unknown style '".concat(n,"'");return t}var ae=n(309996);function se(e,t){return t?new X.PositionData(z(e.x,t.x),z(e.y,t.y)):"number"===typeof e.x&&"number"===typeof e.y?new X.PositionData(e.x,e.y):new X.PositionData(0,0)}function ce(e){return"number"===typeof e.scale?new X.ScaleData(e.scale):new X.ScaleData(1)}function ue(e,t,n){var i={};t?"number"!==typeof e.x&&"number"!==typeof e.y||(i.position={x:z(e.x,t.x),y:z(e.y,t.y)}):"number"===typeof e.x&&"number"===typeof e.y&&(i.position={x:e.x,y:e.y}),"number"===typeof e.rotation&&(i.rotation={rotation:e.rotation}),"number"===typeof e.scale&&(i.scale={scale:e.scale});var o=function(e,t){var n;if((null===t||void 0===t?void 0:t.widgetType)!==b.WidgetType.TEXT||null==e.style)return 0;var r=null!==(n=null===t||void 0===t?void 0:t.getStyle())&&void 0!==n?n:{};return 0===r[J.Style.PADDING]&&e.style.padding===ae.BG_OFFSET?ae.BG_OFFSET:r[J.Style.PADDING]===ae.BG_OFFSET&&0===e.style.padding?-ae.BG_OFFSET:0}(e,t);if(t?"number"===typeof e.width||"number"===typeof e.height?i.size={width:z(e.width,t.width),height:z(e.height,t.height)}:t.width&&t.height&&(i.size={width:z(e.width,t.width)+2*o,height:z(e.height,t.height)+2*o}):"number"===typeof e.width&&"number"===typeof e.height&&(i.size={width:e.width,height:e.height}),e.style){var a=t?t.getStyle():{};i.style=JSON.stringify((0,r.__assign)((0,r.__assign)({},a),oe(e.style)))}return n&&n(i),i}var le=n(785911),de=n(678230),pe=n(412407);const fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.widgetType=b.WidgetType.SHAPE,t.supportedFieldsForWrite={x:M("shape.x"),y:M("shape.y"),width:M("shape.width"),height:M("shape.height"),rotation:M("shape.rotation"),text:W("shape.text"),style:B("shape.style")},t.supportedStylesForRead={shapeType:!0,backgroundColor:!0,backgroundOpacity:!0,borderColor:!0,borderWidth:!0,borderStyle:!0,borderOpacity:!0,fontSize:!0,fontFamily:!0,textColor:!0,textAlign:!0,textAlignVertical:!0,highlighting:!0,italic:!0,strike:!0,underline:!0,bold:!0},t.defaultNewShapeData={x:0,y:0,width:100,height:100,rotation:0,text:"",style:{shapeType:Y.ShapeType.RECTANGLE,backgroundColor:"transparent",backgroundOpacity:1,borderColor:"#1a1a1a",borderWidth:2,borderStyle:2,borderOpacity:1,fontSize:14,fontFamily:0,textColor:"#1a1a1a",textAlign:le.default.CENTER,textAlignVertical:de.default.MIDDLE,italic:0,strike:0,underline:0,bold:0,highlighting:""}},t}return(0,r.__extends)(t,e),t.prototype.create=function(e){void 0===e&&(e={});var t=this.convertSdkToInnerData(this.getDefaultData(e));this.fixBugWithShapeStyle(t);var n=(0,pe.ShapeWidgetService)().createFromData(t,!0);return n.updateVisual(),Promise.resolve(n)},t.prototype.getDefaultData=function(e){var t=Object.assign({},this.defaultNewShapeData,e);return t.style=Object.assign({},this.defaultNewShapeData.style,e.style),t},t.prototype.fixBugWithShapeStyle=function(e){if(e.style){var t=JSON.parse(e.style),n=Object.assign({},j.SHAPE_WIDGET_DEFAULT_STYLE,t);e.style=JSON.stringify(n)}else e.style=JSON.stringify(j.SHAPE_WIDGET_DEFAULT_STYLE)},t.prototype.update=function(e,t){var n=this.convertSdkToInnerData(t,e);return(0,pe.ShapeWidgetService)().update(e,n),Promise.resolve(e)},t.prototype.convertInnerToSdkData=function(e){var t=Pt(this,e);return t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t.rotation=e.rotation,t.text=e.text,t.plainText=e.getPlainText(),t.style.shapeType=e.shapeType,t},t.prototype.convertSdkToInnerData=function(e,t){return ue(e,t,(function(t){"string"===typeof e.text&&(t.text=e.text),e.style&&e.style.shapeType&&(t.shape=e.style.shapeType.toString())}))},t}(H);const he=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.widgetType=b.WidgetType.STENCIL,t.supportedFieldsForWrite={x:M("stencil.x"),y:M("stencil.y"),width:M("stencil.width"),height:M("stencil.height"),rotation:M("stencil.rotation")},t}return(0,r.__extends)(t,e),t.prototype.convertInnerToSdkData=function(e){var t=Pt(this,e);return t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t.rotation=e.rotation,t},t}(H);const ge=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.widgetType=b.WidgetType.TEXT,t.supportedFieldsForWrite={x:M("text.x"),y:M("text.y"),width:M("text.width"),rotation:M("text.rotation"),scale:M("text.scale"),text:W("text.text"),style:B("text.style")},t.supportedStylesForRead={backgroundColor:!0,backgroundOpacity:!0,borderColor:!0,borderWidth:!0,borderStyle:!0,borderOpacity:!0,fontFamily:!0,textColor:!0,textAlign:!0,highlighting:!0,italic:!0,strike:!0,underline:!0,bold:!0,padding:!0},t.defaultTextStyles={backgroundColor:"transparent",backgroundOpacity:1,borderColor:"transparent",borderOpacity:1,borderStyle:2,borderWidth:2,fontFamily:0,textAlign:"l",textColor:"#1a1a1a",highlighting:0,italic:0,strike:0,underline:0,bold:0,padding:0},t}return(0,r.__extends)(t,e),t.prototype.create=function(e){void 0===e&&(e={});var t=m.textWidgetController.create({x:e.x||0,y:e.y||0,canvasScale:0,text:e.text||"",style:oe((0,r.__assign)((0,r.__assign)({},this.defaultTextStyles),e.style)),textScale:e.scale||1,addToHistory:!0,width:e.width,rotation:e.rotation,enableEditMode:!1,__overrideXForSdk:!1,__overrideWidthForSdk:!1,setLastUsedTextType:!1});return Promise.resolve(t)},t.prototype.update=function(e,t){null!=t.style&&null!=t.style.padding&&0!==t.style.padding&&8!==t.style.padding&&(t.style.padding=0);var n=this.convertSdkToInnerData(t,e);return m.textWidgetController.update(e,n),Promise.resolve(e)},t.prototype.convertSdkToInnerData=function(e,t){return ue(e,t,(function(t){t.text=e.text}))},t.prototype.convertInnerToSdkData=function(e){var t=Pt(this,e);return t.x=e.x,t.y=e.y,t.width=e.width,t.scale=e.scale,t.rotation=e.rotation,t.text=e.text,t.plainText=e.getPlainText(),t},t}(H);var _e=n(792746),me=n(395893);function ve(){var e=[];return(0,_e.default)().currentBoard.hasPermission(me.UserBoardPermission.EDIT_BOARD_PARAMS)&&e.push(A.EDIT_INFO),(0,_e.default)().currentBoard.canCreateAndEditWidgets()&&e.push(A.EDIT_CONTENT),(0,_e.default)().currentBoard.canCreateAndEditComments()&&e.push(A.EDIT_COMMENTS),e}function ye(e){return function(t,n,r){void 0===r&&(r=Object.getOwnPropertyDescriptor(t,n));var i=r.value;return r.value=function(){return ve().includes(e)?i.apply(this,arguments):Promise.reject(new Error("Operation requires '".concat(e,"' which user does not have")))},r}}function Ee(e){return function(t,n,r){void 0===r&&(r=Object.getOwnPropertyDescriptor(t,n));var i=r.value;return r.value=function(){var t=this;if(!t.controller.isCurrentUserAuthorizedScope(e)){var o="root"in t?t.root:t,a=(0,u.getMethodPath)(o,r.value)||n;throw new Error("Method '".concat(a,"' requires scope '").concat(e,"'"))}return i.apply(this,arguments)},r}}function Te(e,t,n){void 0===n&&(n=Object.getOwnPropertyDescriptor(e,t));var r=n.value;return n.value=function(){return console.info("'".concat(t,"' is experimental api. It can be changed at any moment.")),r.apply(this,arguments)},n}function Ie(e,t,n){void 0===n&&(n=Object.getOwnPropertyDescriptor(e,t));var r=n.value;return n.value=function(){return console.info("'".concat(t,"' is deprecated api. It will be removed soon.")),r.apply(this,arguments)},n}var we=n(618568),Ae=n(470625),Se=n(776935),be=0,Ce=0;function De(e){if(be>=5e5)throw new Error(x.totalPointsLimitsExceeded());if(Ce>=1e4)throw new Error(x.rateLimitExceeded(1e4,60));be+=e,Ce+=e}setInterval((function(){Ce=0}),6e4);var Oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.MAX_BOARD_TAGS=100,t.TagsService=(0,Ae.default)(),t}return(0,r.__extends)(t,e),t.prototype.get=function(e){var t=this.TagsService.tags.map(Pe),n=this.filterTags(t,e);return Promise.resolve(n)},t.prototype.create=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n,i,o,a,s,c,u,l,d;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:t=jt(e),n={color:null,title:"",widgetIds:null},this.checkInputFields(t,Object.keys(n)),De(t.length),i=[],o=0,a=t,r.label=1;case 1:if(!(othis.MAX_BOARD_TAGS?(x.totalTagsOnBoardLimitsExceeded(),[3,5]):(c=re(s.color),u=this.findTargetTagHolders(s.widgetIds),l=this.TagsService.create(s.title,c,u),[4,Ht()]):(x.tagMustHaveNonEmptyTitle(),[3,5]);case 3:return r.sent(),i&&i.push(l),[3,5];case 4:return r.sent(),[3,5];case 5:return o++,[3,1];case 6:return d=i.map(Pe),[2,Promise.resolve(d)]}}))}))},t.prototype.update=function(e){var t,n=jt(e);this.checkInputFields(n,Object.keys({id:"",color:null,title:"",widgetIds:null})),De(n.length);for(var r=this.findTargetTags(n.map((function(e){return e.id}))),i=r.map((function(e){return e.tokenizer.id.toString()})),o=n.filter((function(e){return i.includes(e.id)})),a=this.getTagsUpdateData(o),s=0,c=a;s0&&a.length>0&&this.TagsService.update(o.map((function(e){return r.find((function(t){return e.id===t.tokenizer.id.toString()}))})),a);var l=this.findTargetTags(i).map(Pe);return Promise.resolve(l)},t.prototype.delete=function(e){var t=Kt(e);De(t.length);var n=this.findTargetTags(t);return n.length>0&&this.TagsService.remove(n),Promise.resolve()},t.prototype.findTargetTagHolders=function(e){var t=this,n=Kt(e||[]),r=m.widgetController.existingWidgets.filter((function(e){return n.includes(e.tokenizer.id.toString())}));this.checkWidgetsExisting(r,n);var i=r.filter((function(e){return t.isWidgetTypeSupportTags(e.widgetType)&&t.isTagsHolder(e)}));if(i.length1)throw new Error("You can write metadata only for your app ID '".concat(n,"'. Your keys are ").concat(r));if(1===r.length&&r[0]!==n)throw new Error("You can write metadata only for your app ID '".concat(n,"'. Your key is ").concat(r[0]))}}var vt=n(803655),yt=n(861486),Et=1e6,Tt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.widgetType=b.WidgetType.SVG,t.supportedFieldsForWrite={x:M("svg.x"),y:M("svg.y"),scale:M("svg.scale"),rotation:M("svg.rotation"),content:W("svg.content"),colorPickerVisible:U("svg.colorPickerVisible"),style:B("svg.style")},t.supportedStylesForRead={color:!0},t.requiredFieldsToCreate=["content"],t.defaultSvgWidgetData={colorPickerVisible:!1,position:{x:0,y:0},rotation:{rotation:0},scale:{scale:1},size:{height:0,width:0},svg:void 0},t.svgWidgetController=(0,yt.ISvgWidgetController)(),t}return(0,r.__extends)(t,e),t.prototype.create=function(e){De(100),this.validateSvgContent(e.content);var t=this.convertSdkToInnerDataBasedOnSource(e,this.defaultSvgWidgetData),n=this.svgWidgetController.createFromData(t);return Promise.resolve(n)},t.prototype.update=function(e,t){De(100),t.content&&!this.safeValidateSvgContent(t.content)&&(x.invalidSvgContent(),t.content=void 0);var n=e.getData(),r=this.convertSdkToInnerDataBasedOnSource(t,n);return(0,xe.default)().update([e],[r]),Promise.resolve(e)},t.prototype.convertInnerToSdkData=function(e){var t=ie(e.styleObject.getStyle()[J.Style.BACKGROUND_COLOR]),n=Pt(this,e);return n.style={color:t},n},t.prototype.convertSdkToInnerDataBasedOnSource=function(e,t){var n,r,i,o,a,s;return{colorPickerVisible:null!==(n=e.colorPickerVisible)&&void 0!==n?n:t.colorPickerVisible,position:{x:null!==(r=e.x)&&void 0!==r?r:t.position.x,y:null!==(i=e.y)&&void 0!==i?i:t.position.y},rotation:{rotation:null!==(o=e.rotation)&&void 0!==o?o:t.rotation.rotation},scale:{scale:null!==(a=e.scale)&&void 0!==a?a:t.scale.scale},size:t.size,svg:null!==(s=e.content)&&void 0!==s?s:t.svg,style:e.style?JSON.stringify(oe(e.style)):t.style}},t.prototype.safeValidateSvgContent=function(e){try{return this.validateSvgContent(e),!0}catch(e){return!1}},t.prototype.validateSvgContent=function(e){if(!e)throw new Error(x.svgContentFieldIsRequired());if(e.length>Et)throw new Error(x.maximumSvgSizeExceeded(e.length,Et));var t=(new DOMParser).parseFromString(e,"application/xml");if(!this.isSvgValid(null===t||void 0===t?void 0:t.documentElement))throw new Error(x.invalidSvgContent());t.documentElement.getAttribute("width")||t.documentElement.getAttribute("height")||x.svgSizeNotSet()},t.prototype.isSvgValid=function(e){var t;return"svg"===(null===(t=null===e||void 0===e?void 0:e.nodeName)||void 0===t?void 0:t.toLowerCase())},t}(H);const It=Tt;var wt,At=((wt={})[b.WidgetType.TEXT]=ge,wt[b.WidgetType.STICKER]=Ue,wt[b.WidgetType.IMAGE]=Ve,wt[b.WidgetType.DOCUMENT]=Je,wt[b.WidgetType.MOCKUP]=Qe,wt[b.WidgetType.SHAPE]=fe,wt[b.WidgetType.STENCIL]=he,wt[b.WidgetType.LINE]=je,wt[b.WidgetType.CURVE]=qe,wt[b.WidgetType.WEBSCREEN]=et,wt[b.WidgetType.FRAME]=Ze,wt[b.WidgetType.PREVIEW]=tt,wt[b.WidgetType.EMOJI]=ot,wt[b.WidgetType.EMBED]=K,wt[b.WidgetType.CARD]=gt,wt[b.WidgetType.SVG]=It,wt),St=new Map;function bt(e){var t=St.get(e);if(!t){var n=At[e];t=n?new n:void 0,St.set(e,t)}return t}function Ct(e){var t=bt(e.widgetType);return t?t.convertInnerToSdkData(e):Pt(t,e)}function Dt(e){return e.map((function(e){return Ct(e)}))}function Ot(e){return{id:e.tokenizer.id.toString(),type:"COMMENT",bounds:Nt(new D.default.Rectangle(e.x,e.y,0,0)),groupId:void 0,style:{},metadata:{},capabilities:xt,clientVisible:!e.isHidden("sdk"),createdUserId:e.historyData.creationUserId.toString(),lastModifiedUserId:e.historyData.lastChangeUserId.toString()}}function Rt(e){return{id:e.tokenizer.id.toString(),type:b.WidgetType[e.widgetType],metadata:kt(e)}}function Pt(e,t){var n=e&&function(e){return!!e.getStyle}(t)?function(e,t){var n={};if(t)for(var r in e)if(e.hasOwnProperty(r)&&ee.hasOwnProperty(r)){var i=ee[r];t[i.name]&&(n[i.name]=i.converter(e[r]))}return n}(t.getStyle(),e.supportedStylesForRead):{};return{id:t.tokenizer.id.toString(),type:b.WidgetType[t.widgetType],bounds:Nt(t.bounds),groupId:t.group?t.group.tokenizer.id.toString():void 0,style:n,metadata:kt(t),capabilities:Lt(t),clientVisible:!t.isHidden("sdk"),createdUserId:t.historyData.creationUserId.toString(),lastModifiedUserId:t.historyData.lastChangeUserId.toString()}}function Nt(e){return{x:e.left+e.width/2,y:e.top+e.height/2,top:e.top,left:e.left,bottom:e.bottom,right:e.right,width:e.width,height:e.height}}function kt(e){var t=e.asNs("metadata");return t?t.getJsonData():{}}var xt={editable:!0};function Lt(e){return e.isNs("capabilities")?e.asNs("capabilities").getJsonData():xt}function Mt(e,t){return function(e,t,n){if(Object.keys(n).some((function(e){return"id"!==e&&"clientVisible"!==e&&"clientVisible"!==e}))){if(e)return De(1),e.update(t,n);throw new Error(x.updateNotSupported(Zt(t.widgetType)))}return Promise.resolve(t)}(bt(e.widgetType),e,t).then((function(e){return Ft(e,t),_t(e,t),Ut(e,t),e}))}function Wt(e,t){var n=Yt(e);if(!n)throw new Error(x.widgetDoesntExist(e));var r=bt(Xt(t.type));if(!r)throw new Error(x.wrongInputWidgetArgument());return De(1),r.convert(n,t).then((function(e){return Ft(e,t),_t(e,t),Ut(e,t),e}))}function Ut(e,t){return Bt(e,"capabilities",t)}function Bt(e,t,n){if(n&&n[t]){var r=at.Namespaces.setNsData(t,n[t]);(0,xe.default)().update([e],[r])}return e}function Ft(e,t){return void 0!==t.clientVisible&&e.setHidden("sdk",!t.clientVisible),e}function Gt(e){if("object"!==typeof e)throw new Error(x.creatingWidgetIsNotAnObject());if("string"!==typeof e.type)throw new Error(x.typeFieldIsRequiredForCreate());var t=bt(Xt(e.type));if(!t)throw new Error(x.createNotSupported(e.type));!function(e,t){for(var n in e)if(e.hasOwnProperty(n)){var r=t.supportedFieldsForWrite;if(r[n])r[n](e[n]);else if(Vt[n])Vt[n](e[n]);else zt.includes(n)||x.fieldIsUnsupported(n,Zt(t.widgetType))}}(e,t)}var zt=["id","type","bounds","groupId","zIndex","createdUserId","lastModifiedUserId","metadata","clientVisible","capabilities","plainText"],Vt={metadata:F("metadata"),clientVisible:U("clientVisible"),capabilities:F("capabilities")};function Ht(){return(0,y.CanvasEngine)().history.awaitTransactionComplete((0,y.CanvasEngine)().history.getCurrentTransactionId())}function Kt(e){if(Array.isArray(e))return function(e){return"string"===typeof e[0]}(e)?e:e.map((function(e){return e.id}));if("string"===typeof e)return[e];if(e&&e.id)return[e.id];throw new Error(x.noInputWidgetsPassed())}function jt(e){if(Array.isArray(e))return e;if("object"===typeof e)return[e];throw new Error(x.noWidgetsPassedForCreateOrUpdate())}function Yt(e){var t=(0,y.CanvasEngine)().objectsRepository.getObjectById(vt.Long.fromString(e));return t&&t.isPresent?t:void 0}function Xt(e){return b.WidgetType[e.toUpperCase()]}function Zt(e){return b.WidgetType[e]}var Jt=n(753057),qt=n(660720),Qt=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i.widgetsReceiver=r,i}return(0,r.__extends)(t,e),t.prototype.createByURL=function(e,t){return void 0===t&&(t={}),t.type="IMAGE",t.url=e,this.widgetsReceiver.create(t).then((function(e){return e[0]}))},t.prototype.get=function(){return this.widgetsReceiver.get({type:"image"})},(0,r.__decorate)([u.remote,Ie],t.prototype,"createByURL",null),(0,r.__decorate)([u.remote,Ie],t.prototype,"get",null),t}(I),$t=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i.widgetsReceiver=r,i}return(0,r.__extends)(t,e),t.prototype.create=function(e){return void 0===e&&(e={}),(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(t){return e.type="STICKER",[2,this.widgetsReceiver.create(e).then((function(e){return e[0]}))]}))}))},t.prototype.get=function(){return this.widgetsReceiver.get({type:"sticker"})},(0,r.__decorate)([u.remote,Ie],t.prototype,"create",null),(0,r.__decorate)([u.remote,Ie],t.prototype,"get",null),t}(I),en=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i.widgetsReceiver=r,i}return(0,r.__extends)(t,e),t.prototype.create=function(e){return void 0===e&&(e={}),(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(t){return e.type="SHAPE",[2,this.widgetsReceiver.create(e).then((function(e){return e[0]}))]}))}))},t.prototype.update=function(e,t){var n=(e=Kt(e)).map((function(e){return(0,r.__assign)({id:e},t)}));return this.widgetsReceiver.update(n)},(0,r.__decorate)([u.remote,Ie],t.prototype,"create",null),(0,r.__decorate)([u.remote,Ie],t.prototype,"update",null),t}(I),tn=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.images=new Qt(t.controller,t.root,t),t.stickers=new $t(t.controller,t.root,t),t.shapes=new en(t.controller,t.root,t),t}return(0,r.__extends)(t,e),t.prototype.get=function(e){var t=Dt((0,r.__spreadArray)((0,r.__spreadArray)([],(0,S.FramesService)().framesList.items,!0),m.widgetController.existingWidgets,!0));return e&&("string"===typeof e.type&&(e.type=e.type.toUpperCase()),t=T()(t,e)),Promise.resolve(t)},t.prototype.create=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n,i=this;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return e=jt(e),this.sendWidgetsBeforeCreateStat(e),e.forEach((function(e){Gt(e),mt(e,i.controller)})),t=e.map((function(e){return function(e){var t=bt(Xt(e.type));if(t)return De(1),t.create(e).then((function(t){return Ft(t,e),_t(t,e),Ut(t,e),t}));throw new Error(x.createNotSupported(e.type))}(e)})),[4,Promise.all(t)];case 1:return n=r.sent(),[4,Ht()];case 2:return r.sent(),this.sendWidgetsCreatedStat(n),[2,n.map((function(e){return Ct(e)}))]}}))}))},t.prototype.update=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n,i=this;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return e=jt(e),this.sendWidgetsBeforeUpdateStat(e),t=[],e.forEach((function(e){mt(e,i.controller),function(e){if("object"!==typeof e)throw new Error(x.updatingWidgetIsNotAnObject());if("string"!==typeof e.id)throw new Error(x.idFieldIsRequiredForUpdate())}(e);var n=Yt(e.id);n?t.push(n):x.updatingWidgetNotFound(e.id)})),n=e.map((function(e,n){return Mt(t[n],e)})),[4,Ht()];case 1:return r.sent(),[2,Promise.all(n).then((function(e){return i.sendWidgetsUpdatedStat(e),e.map((function(e){return Ct(e)}))}))]}}))}))},t.prototype.transformDelta=function(e,t,n,i){return(0,r.__awaiter)(this,void 0,Promise,(function(){var o,a,s;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return e=Kt(e),De(100),o=[],a=[],e.forEach((function(e){var r=Yt(e);if(r){var s=new X.TransformationData;(t||n)&&(s.positionData=new X.PositionData(r.x+(t||0),r.y+(n||0))),i&&(s.rotationData=new X.RotationData(r.rotation+i)),o.push(r),a.push(s)}})),m.transformationController.transform(o,a),[4,Ht()];case 1:return r.sent(),e=Kt(e),s=[],e.forEach((function(e){var t=Yt(e);t&&s.push(t)})),[2,Dt(s)]}}))}))},t.prototype.deleteById=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t;return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return e=Kt(e),this.sendWidgetsBeforeRemoveStat(e),De(e.length),t=[],e.forEach((function(e){var n=Yt(e);n&&t.push(n.tokenizer)})),t.length>0?((0,y.CanvasEngine)().presence.removeObjects(t),[4,Ht()]):[3,2];case 1:n.sent(),this.sendWidgetsRemovedStat(t.map((function(e){return e.id.toString()}))),n.label=2;case 2:return[2]}}))}))},t.prototype.bringForward=function(e){De((e=Kt(e)).length);var t=e.map((function(e){return Yt(e)}));return m.widgetController.setTopmostZIndex(t),Promise.resolve()},t.prototype.sendBackward=function(e){De((e=Kt(e)).length);var t=e.map((function(e){return Yt(e)}));return m.widgetController.setLowermostZIndex(t),Promise.resolve()},t.prototype.__blinkWidget=function(e){return Kt(e).forEach((function(e){var t=Yt(e);t&&m.widgetController.blinkWidget(t)})),Promise.resolve()},t.prototype.__getIntersectedObjects=function(e){var t="width"in e?e:{x:e.x,y:e.y,width:1,height:1},n=D.default.Rectangle.createFromRect(t),r=m.quadTree.getIntersectedObjects(n,Jt.default.TOUCH);return Promise.resolve(Dt(r))},t.prototype.areAllWidgetsLoaded=function(){return Promise.resolve(m.widgetController.isAllWidgetsLoaded())},t.prototype.sendWidgetsCreatedStat=function(e){var t=this.getStatCommonParameters();e.forEach((function(e){return(0,qt.sdkWidgetCreated)(e.tokenizer.id.toString(),t.initiatorId,t.accountId,t.boardId,t.appId,b.WidgetType[e.widgetType])}))},t.prototype.sendWidgetsUpdatedStat=function(e){var t=this.getStatCommonParameters();e.forEach((function(e){(0,qt.sdkWidgetUpdated)(e.tokenizer.id.toString(),t.initiatorId,t.accountId,t.boardId,t.appId,b.WidgetType[e.widgetType])}))},t.prototype.sendWidgetsRemovedStat=function(e){var t=this.getStatCommonParameters();e.forEach((function(e){(0,qt.sdkWidgetRemoved)(e,t.initiatorId,t.accountId,t.boardId,t.appId)}))},t.prototype.sendWidgetsBeforeCreateStat=function(e){var t=this.getStatCommonParameters();e.forEach((function(e){(0,qt.sdkMethodWidgetsUsed)("create",t.initiatorId,t.accountId,t.boardId,t.appId,e.type,{id:e.id})}))},t.prototype.sendWidgetsBeforeUpdateStat=function(e){var t=this.getStatCommonParameters();e.forEach((function(e){(0,qt.sdkMethodWidgetsUsed)("update",t.initiatorId,t.accountId,t.boardId,t.appId,e.type,{id:e.id})}))},t.prototype.sendWidgetsBeforeRemoveStat=function(e){var t=this.getStatCommonParameters();e.forEach((function(e){(0,qt.sdkMethodWidgetsUsed)("deleteById",t.initiatorId,t.accountId,t.boardId,t.appId,void 0,{id:e})}))},t.prototype.getStatCommonParameters=function(){return{accountId:this.controller.getAccountId(),appId:this.controller.appKey,boardId:this.controller.getBoardId(),initiatorId:this.controller.getUserId()}},(0,r.__decorate)([u.remote,Ee(we.OAuthScope.BOARDS_READ)],t.prototype,"get",null),(0,r.__decorate)([u.remote,ye(A.EDIT_CONTENT),Ee(we.OAuthScope.BOARDS_WRITE)],t.prototype,"create",null),(0,r.__decorate)([u.remote,ye(A.EDIT_CONTENT),Ee(we.OAuthScope.BOARDS_WRITE)],t.prototype,"update",null),(0,r.__decorate)([u.remote,ye(A.EDIT_CONTENT),Ee(we.OAuthScope.BOARDS_WRITE)],t.prototype,"transformDelta",null),(0,r.__decorate)([u.remote,ye(A.EDIT_CONTENT),Ee(we.OAuthScope.BOARDS_WRITE)],t.prototype,"deleteById",null),(0,r.__decorate)([u.remote,ye(A.EDIT_CONTENT),Ee(we.OAuthScope.BOARDS_WRITE)],t.prototype,"bringForward",null),(0,r.__decorate)([u.remote,ye(A.EDIT_CONTENT),Ee(we.OAuthScope.BOARDS_WRITE)],t.prototype,"sendBackward",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__blinkWidget",null),(0,r.__decorate)([u.remote,Te,Ee(we.OAuthScope.BOARDS_READ)],t.prototype,"__getIntersectedObjects",null),(0,r.__decorate)([u.remote],t.prototype,"areAllWidgetsLoaded",null),(0,r.__decorate)([(0,u.remoteReceiver)(Qt)],t.prototype,"images",void 0),(0,r.__decorate)([(0,u.remoteReceiver)($t)],t.prototype,"stickers",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(en)],t.prototype,"shapes",void 0),t}(I);const nn=tn;var rn=n(415401);const on=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype.get=function(){return Promise.resolve((0,rn.CommentsController)().getAllComments().map((function(e){return Ot(e)})))},(0,r.__decorate)([u.remote,Te,Ee(we.OAuthScope.BOARDS_READ)],t.prototype,"get",null),t}(I);const an=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype.get=function(){return Promise.resolve(m.groupController.getPresentedGroups().map((function(e){return function(e){return{id:e.tokenizer.id.toString(),bounds:Nt(e.bounds),childrenIds:e.asContainer.existingChildren.map((function(e){return e.tokenizer.id.toString()}))}}(e)})))},(0,r.__decorate)([u.remote,Te,Ee(we.OAuthScope.BOARDS_READ)],t.prototype,"get",null),t}(I);var sn=n(955833),cn=n(320615),un=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype.get=function(){var e,t=v.UICurrentBoard.getInfo();return Promise.resolve({id:t.id,title:t.title,description:t.description,owner:(null===(e=t.ownerConnection)||void 0===e?void 0:e.user)?(0,sn.getSdkUser)(t.ownerConnection.user):void 0,picture:(0,sn.getSdkPicture)(t.picture),currentUserPermissions:ve(),lastModifyingUser:(0,sn.getSdkUser)(t.lastModifyingUser),lastViewedByMeDate:t.lastViewedByMeDate,modifiedByMeDate:t.modifiedByMeDate,createdAt:t.createdAt,updatedAt:t.updatedAt})},t.prototype.__getBoardAccessByLink=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){var e;return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return De(100),[4,(0,cn.getBoardsAPI)().selectById(v.UICurrentBoard.getInfo().id).get({fields:"sharingPolicy"})];case 1:return e=t.sent(),[2,Promise.resolve(e.sharingPolicy)]}}))}))},t.prototype.__setBoardAccessByLink=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return De(100),[4,(0,cn.getBoardsAPI)().selectById(v.UICurrentBoard.getInfo().id).changePublicity(e)];case 1:return t.sent(),[4,(0,_e.default)().currentBoard.updateUserPermissions()];case 2:return t.sent(),[2,this.__getBoardAccessByLink()]}}))}))},(0,r.__decorate)([u.remote],t.prototype,"get",null),(0,r.__decorate)([u.remote,Te,ye(A.EDIT_CONTENT)],t.prototype,"__getBoardAccessByLink",null),(0,r.__decorate)([u.remote,Te,ye(A.EDIT_CONTENT)],t.prototype,"__setBoardAccessByLink",null),t}(I);const ln=un;var dn=n(636304);const pn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype.enterSelectWidgetsMode=function(e){return new Promise((function(t){var n=function(e){"Escape"===e.key&&(t({selectedWidgets:[]}),(0,dn.default)().exitSelectionMode(),window.removeEventListener("keydown",n))};window.addEventListener("keydown",n),(0,dn.default)().enterSelectionMode((function(e){t({selectedWidgets:e.map((function(e){return Ct(e)}))}),(0,dn.default)().exitSelectionMode(),window.removeEventListener("keydown",n)}),void 0,e&&e.allowMultiSelection)}))},t.prototype.get=function(){return Promise.resolve(m.mySelection.selection.map((function(e){return Ct(e)})))},t.prototype.selectWidgets=function(e){return(0,r.__awaiter)(this,void 0,void 0,(function(){var t;return(0,r.__generator)(this,(function(n){return e=Kt(e),m.mySelection.clearSelection(),t=e.map((function(e){return Yt(e)})).filter((function(e){return void 0!==e})),m.mySelection.addToSelection(t),[2,this.get()]}))}))},t.prototype.clear=function(){return m.mySelection.clearSelection(),Promise.resolve()},(0,r.__decorate)([u.remote,Te],t.prototype,"enterSelectWidgetsMode",null),(0,r.__decorate)([u.remote,Ee(we.OAuthScope.BOARDS_READ)],t.prototype,"get",null),(0,r.__decorate)([u.remote,Ee(we.OAuthScope.BOARDS_READ)],t.prototype,"selectWidgets",null),(0,r.__decorate)([u.remote],t.prototype,"clear",null),t}(I);var fn=n(852766),hn=n(400893),gn=n(258445),_n=n(757213),mn=n(860902),vn=n.n(mn),yn=n(266123),En=n(279991);const Tn=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.loaded=!1,t}return(0,r.__extends)(t,e),t.prototype.init=function(){this.params.fullscreen?this.element.find(".md-content").css({width:document.body.clientWidth,height:document.body.clientHeight}):this.element.find(".md-content").css({width:Math.min(document.body.clientWidth,this.params.maxWidth),height:Math.min(document.body.clientHeight,this.params.maxHeight)})},t.prototype.getIFrameURL=function(){return this.params.iframeUrl},t.prototype.getIFrameAllow=function(){return this.params.iframeAllow||""},t.prototype.onLoad=function(){this.loaded=!0},t}(n(445868).default);var In=n(908612),wn=n(598192);var An=n(812366),Sn=n(780415),bn=n(752221),Cn=n(512351),Dn=n(614926),On=n(266188),Rn=n(239867),Pn=n(475378),Nn=n(827378),kn=n(783049),xn=n(508981),Ln=n(410674),Mn=n(95706),Wn=n(456747),Un=n(664281),Bn=n(696899),Fn="There is no opened iframe modal",Gn="microphone; camera";function zn(e){return(0,On.default)().$sce.trustAsResourceUrl(e)}var Vn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype.openLeftSidebar=function(e,t){var n=this;return new Promise((function(r){if((null===t||void 0===t?void 0:t.placement)===Bn.AppsPlacements.LeftApps){var i=zn(n.controller.getIframeURL(e));return n.openNavStack(i,t),void r()}n.controller.deactivateBottomBarButtonHandler=function(){(0,fn.default)().leftSidebar.deactivate()},(0,fn.default)().leftSidebar.activate(n.controller.appKey,{iframeURL:zn(n.controller.getIframeURL(e)),iframeAllow:Gn}),(0,fn.default)().leftSidebar.activePluginsChanged.addOnce((function(){n.controller.deactivateBottomBarButtonHandler=void 0,r()}))}))},t.prototype.openNavStack=function(e,t){this.registerSDKLeftAppUiSlot(e,null===t||void 0===t?void 0:t.width);var n=Bn.appsService.getOpenedPlugin(Bn.AppsTypes.EXTERNAL_LEFT_APP);void 0!==n&&n.appKey===this.controller.appKey?Bn.appsService.close(Bn.AppsTypes.EXTERNAL_LEFT_APP):Bn.appsService.open(Bn.AppsTypes.EXTERNAL_LEFT_APP,{placement:Bn.AppsPlacements.LeftApps,appKey:this.controller.appKey})},t.prototype.registerSDKLeftAppUiSlot=function(e,t){!function(e){var t=e.url,n=e.width;(0,xn.default)().emitter.emit(kn.UISystemMessagesEnum.REGISTER_COMPONENT,{receiverId:"NAV_STACK_".concat(Ln.NavStackExtensionPointNames.EXTERNAL_LEFT_APP),payload:{component:function(){return Nn.createElement(Nn.Suspense,{fallback:null},Nn.createElement("div",{style:{height:"100%"}},Nn.createElement(Wn.SDKLeftApp,{url:t,width:n}),Nn.createElement(Mn.SidebarClose,{id:Un.AppsTypes.EXTERNAL_LEFT_APP})))}}})}({url:e,width:t})},t.prototype.openLibrary=function(e,t){var n=this;if(void 0===t&&(t=Pn.DEFAULT_PLUGIN_OPTIONS),!t||!t.title)throw new Error("'title' option should be provided");return new Promise((function(r){n.controller.deactivateToolBarButtonHandler=function(){(0,hn.default)().close()},(0,hn.default)().showIframeContent(n.controller.appKey,zn(n.controller.getIframeURL(e)),t,Gn),(0,hn.default)().activePluginIdChanged.addOnce((function(){n.controller.deactivateToolBarButtonHandler=void 0,r()}))}))},t.prototype.openModal=function(e,t){var r={iframeUrl:zn(this.controller.getIframeURL(e)),fullscreen:t&&"fullscreen"in t&&t.fullscreen,maxWidth:t&&"width"in t&&t.width||800,maxHeight:t&&"height"in t&&t.height||600,iframeAllow:Gn};return new Promise((function(e){var t,i=(0,_n.default)().show((t=r,(0,wn.default)(),(0,In.default)(),n(660875),yn.mergeParams(En.default.IFRAME_EXTENSION_POINT,Tn,vn(),t)));i.submitted.add(e),i.canceled.add(e)}))},t.prototype.openBottomPanel=function(e,t){var n=this;return new Promise((function(r){n.controller.deactivateBottomBarButtonHandler=function(){n.closeBottomPanel()};var i=(null===t||void 0===t?void 0:t.width)||120,o=(null===t||void 0===t?void 0:t.height)||48;i=Math.min(Math.max(i,80),320),o=Math.min(Math.max(o,48),200),(0,Rn.default)().bottomPanel.activate(n.controller.appKey,{iframeURL:zn(n.controller.getIframeURL(e)),iframeAllow:Gn,width:i,height:o}),(0,Rn.default)().bottomPanel.activePluginsChanged.addOnce((function(){n.controller.deactivateBottomBarButtonHandler=void 0,r()}))}))},t.prototype.closeBottomPanel=function(e){(0,Rn.default)().bottomPanel.deactivate(this.controller.appKey)},t.prototype.closeLeftSidebar=function(e){(0,fn.default)().leftSidebar.deactivate(this.controller.appKey),Bn.appsService.close(Bn.AppsTypes.EXTERNAL_LEFT_APP)},t.prototype.closeLibrary=function(e){if((0,gn.default)().getActivePluginId()!==this.controller.appKey)throw new Error(Fn);(0,hn.default)().close()},t.prototype.closeModal=function(e){var t=(0,_n.default)().currentModal;if(!t||(0,_n.default)().getCurrentModalName()!==En.default.IFRAME_EXTENSION_POINT)throw new Error(Fn);t.submit(e)},t.prototype.__hideButtonsPanels=function(e){this.applyPanelsVisible(e,!1)},t.prototype.__showButtonsPanels=function(e){this.applyPanelsVisible(e,!0)},t.prototype.applyPanelsVisible=function(e,t){var n=[];(n="all"===e?["toolbar","top","bottomBar","map"]:"string"===typeof e?[e]:e).includes("toolbar")&&(0,An.default)().setPanelVisible(Sn.PanelName.CANVAS_TOOLS,t),n.includes("top")&&(0,An.default)().setPanelVisible(Sn.PanelName.CANVAS_TOP,t),n.includes("bottomBar")&&(0,An.default)().setPanelVisible(Sn.PanelName.BOTTOM_BAR,t),n.includes("map")&&((0,An.default)().setPanelVisible(Sn.PanelName.MINI_MAP,t),(0,An.default)().setPanelVisible(Sn.PanelName.ZOOM_BUTTON,t))},t.prototype.__limitToolbarMode=function(e){switch(e.toLowerCase()){case"editor":bn.limitUserRights(Cn.UserBoardRole.EDITOR);break;case"commentor":bn.limitUserRights(Cn.UserBoardRole.COMMENTATOR);break;case"viewer":bn.limitUserRights(Cn.UserBoardRole.VIEWER);break;default:throw new Error("Unknown toolbar mode '".concat(e,"'"))}},t.prototype.__clearToolbarModeLimit=function(){this.__limitToolbarMode("editor")},t.prototype.__selectDefaultTool=function(){(0,Dn.default)().setDefaultTool()},t.prototype.resizeTo=function(e){},t.prototype.resizeToInner=function(e){var t=this.root.currentIframeInfo.iframeElement.getAttribute("data-container-type");switch(t){case"sandbox":throw new Error("Use 'resizeTo' in iframe custom views only");case"bottom-panel":(0,Rn.default)().bottomPanel.changeSize(e);break;case"modal":var n=(0,_n.default)().currentModal;null!==n&&n.changeSize(e);break;case"library":e.height&&(0,hn.default)().changeHeight(e.height);break;default:throw new Error("Unknown containerType '".concat(t,"'"))}},t.prototype.initDraggableItemsContainer=function(e,t){},(0,r.__decorate)([u.remote],t.prototype,"openLeftSidebar",null),(0,r.__decorate)([u.remote],t.prototype,"openLibrary",null),(0,r.__decorate)([u.remote],t.prototype,"openModal",null),(0,r.__decorate)([u.remote],t.prototype,"openBottomPanel",null),(0,r.__decorate)([u.remote],t.prototype,"closeBottomPanel",null),(0,r.__decorate)([u.remote],t.prototype,"closeLeftSidebar",null),(0,r.__decorate)([u.remote],t.prototype,"closeLibrary",null),(0,r.__decorate)([u.remote],t.prototype,"closeModal",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__hideButtonsPanels",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__showButtonsPanels",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__limitToolbarMode",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__clearToolbarModeLimit",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__selectDefaultTool",null),(0,r.__decorate)([u.remote],t.prototype,"resizeToInner",null),t}(I);const Hn=Vn;var Kn=n(721715),jn=n(19490),Yn=n(411861),Xn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype.get=function(){var e=(0,fn.default)(),t={left:e.leftSidebar.visibleWidth,right:e.rightSidebar.visibleWidth,top:0,bottom:0},n=this.translateOffsetFromScreenToCanvas(t),r=m.canvasController.viewport,i=this.addMarginToRect(r,n);return Promise.resolve(i)},t.prototype.set=function(e,t){var n,r=this,i=null!==(n=null===t||void 0===t?void 0:t.padding)&&void 0!==n?n:{top:0,left:0,bottom:0,right:0},o=(0,fn.default)(),a={left:o.leftSidebar.visibleWidth+i.left,right:o.rightSidebar.visibleWidth+i.right,top:i.top,bottom:i.bottom},s=this.addScreenPaddingToViewport(e,a),c=D.default.Rectangle.createFromRect(s);return(null===t||void 0===t?void 0:t.animationTimeInMS)?new Promise((function(e){var n,i=null!==(n=null===t||void 0===t?void 0:t.animationTimeInMS)&&void 0!==n?n:0;Kn.default.setViewport(c).jumpWithAnimation("move_viewport_to",i),setTimeout((function(){r.get().then(e)}),10*i)})):(m.canvasController.setViewport(c,void 0,"move_viewport_to"),Promise.resolve(s))},t.prototype.getScale=function(){return Promise.resolve(m.canvasController.canvasScale)},t.prototype.getBoardUIPadding=function(){throw new Error("fake implementation to mute TypeScript")},t.prototype.__mask=function(e,t){t||(t={top:0,bottom:0,left:0,right:0});var n=this.addScreenPaddingToViewport(e,t);(0,jn.PresentationService)().showMask(e),m.canvasController.restrictMoveAndScaleLimits(D.default.Rectangle.createFromRect(n))},t.prototype.__unmask=function(){(0,jn.PresentationService)().hideMask(),m.canvasController.freeMoveAndScaleLimits()},t.prototype.translateOffsetFromScreenToCanvas=function(e){return{left:e.left*m.canvasController.canvasScale,right:e.right*m.canvasController.canvasScale,top:e.top*m.canvasController.canvasScale,bottom:e.bottom*m.canvasController.canvasScale}},t.prototype.addMarginToRect=function(e,t){return{x:e.x+t.left,y:e.y+t.top,width:e.width-(t.left+t.right),height:e.height-(t.top+t.bottom)}},t.prototype.addScreenPaddingToViewport=function(e,t){var n=document.body.clientHeight,r=document.body.clientWidth,i=(n-t.top-t.bottom)/e.height,o=(r-t.left-t.right)/e.width;return{x:e.x-t.left/o,y:e.y-t.top/i,width:e.width+(t.left+t.right)/o,height:e.height+(t.top+t.bottom)/i}},t.prototype.getViewport=function(){var e=m.canvasController.viewport;return Promise.resolve({x:e.x,y:e.y,width:e.width,height:e.height})},t.prototype.setViewport=function(e,t){t||(t={top:0,bottom:0,left:0,right:0});var n=this.addScreenPaddingToViewport(e,t);return m.canvasController.setViewport(D.default.Rectangle.createFromRect(n),void 0,"move_viewport_to"),this.getViewport()},t.prototype.setViewportWithAnimation=function(e){var t=this;return new Promise((function(n){Kn.default.setViewport(D.default.Rectangle.createFromRect(e)).jumpWithAnimation("move_viewport_to",100),setTimeout((function(){t.getViewport().then(n)}),1e3)}))},t.prototype.getZoom=function(){return Promise.resolve(m.canvasController.canvasScale)},t.prototype.setZoom=function(e){var t=this;return new Promise((function(n){m.canvasActions.applyScale(e),setTimeout((function(){t.getZoom().then(n)}),800)}))},t.prototype.zoomToObject=function(e){var t=Kt(e).map((function(e){return Yt(e)})).filter((function(e){return"undefined"!==typeof e}));if(t.length>0){var n=(0,Yn.calcWidgetsMultiBounds)(t);Kn.default.setViewport(n).calculateScreenOffset().jumpWithAnimation("move_viewport_to")}return new Promise((function(e){setTimeout(e,200)}))},(0,r.__decorate)([u.remote],t.prototype,"get",null),(0,r.__decorate)([u.remote],t.prototype,"set",null),(0,r.__decorate)([u.remote],t.prototype,"getScale",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__mask",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__unmask",null),(0,r.__decorate)([u.remote,Ie],t.prototype,"getViewport",null),(0,r.__decorate)([u.remote,Ie],t.prototype,"setViewport",null),(0,r.__decorate)([u.remote,Ie],t.prototype,"setViewportWithAnimation",null),(0,r.__decorate)([u.remote,Ie],t.prototype,"getZoom",null),(0,r.__decorate)([u.remote,Ie],t.prototype,"setZoom",null),(0,r.__decorate)([u.remote],t.prototype,"zoomToObject",null),t}(I);const Zn=Xn;var Jn=n(484447),qn=n(638377);const Qn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.metadataPath="app_metadata/".concat(r.controller.appKey),r}return(0,r.__extends)(t,e),t.prototype.get=function(){var e=(0,qn.default)().documentJson.getJson(this.metadataPath);return Promise.resolve(e||{})},t.prototype.update=function(e){var t=(0,qn.default)().documentJson;t.jsonUpdate(this.metadataPath,e),De(1);var n=t.getJson(this.metadataPath)||{};return Promise.resolve(n)},(0,r.__decorate)([Te,u.remote,Ee(we.OAuthScope.BOARDS_READ)],t.prototype,"get",null),(0,r.__decorate)([Te,u.remote,Ee(we.OAuthScope.BOARDS_WRITE)],t.prototype,"update",null),t}(I);var $n=n(268218),er=n(445569),tr=n(931091),nr=n.n(tr);function rr(){var e=(0,er.default)(),t=(0,$n.default)(),n=t.getAttachedClientIds().map((function(e){return{clientId:e,userId:t.getUserId(e)}})),r=nr()(n,(function(e){return e.userId})),i=r.map((function(e){return t.getUserInfo(e.clientId)}));return r.some((function(t){return t.userId===e.myUserId}))||i.push(Promise.resolve(e.userInfo)),Promise.all(i).then((function(e){return e.map((function(e){return{id:e.id,name:e.name}}))}))}const ir=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.info=new ln(t.controller,t.root),t.widgets=new nn(t.controller,t.root),t.tags=new Re(t.controller,t.root),t.metadata=new Qn(t.controller,t.root),t.comments=new on(t.controller,t.root),t.groups=new an(t.controller,t.root),t.selection=new pn(t.controller,t.root),t.ui=new Hn(t.controller,t.root),t.viewport=new Zn(t.controller,t.root),t}return(0,r.__extends)(t,e),t.prototype.getOnlineUsers=function(){return rr()},t.prototype.__getParamsFromURL=function(){var e=new URL(location.href),t=JSON.parse(e.searchParams.get("miro_sdk"));return Promise.resolve(t||{})},t.prototype.__disableLeftClickOnCanvas=function(){Jn.getInjectionPoint()().leftClickEnabled=!1},t.prototype.__enableLeftClickOnCanvas=function(){Jn.getInjectionPoint()().leftClickEnabled=!0},t.prototype.getAllObjects=function(){return Promise.resolve(Dt(m.quadTree.getObjects()))},t.prototype.openLeftSidebar=function(e){this.ui.openLeftSidebar(e)},t.prototype.openLibrary=function(e,t){this.ui.openLibrary(t,{title:e,isOldStyles:!0})},t.prototype.openModal=function(e,t){void 0===t&&(t={}),this.ui.openModal(e)},t.prototype.getInfo=function(){return Promise.resolve(v.UICurrentBoard.getInfo())},t.prototype.getSelection=function(){return Promise.resolve(m.mySelection.selection.map((function(e){return Ct(e)})))},(0,r.__decorate)([(0,u.remoteReceiver)(ln)],t.prototype,"info",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(nn)],t.prototype,"widgets",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(Re)],t.prototype,"tags",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(Qn)],t.prototype,"metadata",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(on)],t.prototype,"comments",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(an)],t.prototype,"groups",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(pn)],t.prototype,"selection",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(Hn)],t.prototype,"ui",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(Zn)],t.prototype,"viewport",void 0),(0,r.__decorate)([u.remote,Te],t.prototype,"getOnlineUsers",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__getParamsFromURL",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__disableLeftClickOnCanvas",null),(0,r.__decorate)([u.remote,Te],t.prototype,"__enableLeftClickOnCanvas",null),(0,r.__decorate)([u.remote],t.prototype,"getAllObjects",null),(0,r.__decorate)([u.remote],t.prototype,"openLeftSidebar",null),(0,r.__decorate)([u.remote],t.prototype,"openLibrary",null),(0,r.__decorate)([u.remote],t.prototype,"openModal",null),(0,r.__decorate)([u.remote],t.prototype,"getInfo",null),(0,r.__decorate)([u.remote],t.prototype,"getSelection",null),t}(I);var or,ar=n(105603),sr=n(45282),cr=n(286011),ur=n(767526);!function(e){e.SELECTION_UPDATED="SELECTION_UPDATED",e.WIDGETS_CREATED="WIDGETS_CREATED",e.WIDGETS_DELETED="WIDGETS_DELETED",e.WIDGETS_TRANSFORMATION_UPDATED="WIDGETS_TRANSFORMATION_UPDATED",e.COMMENT_CREATED="COMMENT_CREATED",e.ESC_PRESSED="ESC_PRESSED",e.CANVAS_CLICKED="CANVAS_CLICKED",e.ALL_WIDGETS_LOADED="ALL_WIDGETS_LOADED",e.DATA_BROADCASTED="DATA_BROADCASTED",e.METADATA_CHANGED="METADATA_CHANGED",e.ONLINE_USERS_CHANGED="ONLINE_USERS_CHANGED"}(or||(or={}));const lr=or;var dr=function(){function e(){}return e.init=function(e){this.getPluginControllers=e,window.addEventListener("blur",(function(){var e=function(){(0,o.returnFocusFromIFrame)(),document.body.removeEventListener("click",e,!0)};document.activeElement&&"IFRAME"===document.activeElement.nodeName&&document.body.addEventListener("click",e,!0)}))},e.destroy=function(){var e=this;this.alreadyListeningEvents.forEach((function(t){switch(t){case lr.SELECTION_UPDATED:e.stopListenSelectionUpdated();break;case lr.WIDGETS_CREATED:e.stopListenWidgetsCreated();break;case lr.WIDGETS_TRANSFORMATION_UPDATED:e.stopListenWidgetsTransformationUpdated();break;case lr.WIDGETS_DELETED:e.stopListenWidgetsDeleted();break;case lr.COMMENT_CREATED:e.stopListenCommentCreated();break;case lr.ESC_PRESSED:e.stopListenEscPressed();break;case lr.CANVAS_CLICKED:e.stopListenCanvasClicked();break;case lr.ALL_WIDGETS_LOADED:case lr.DATA_BROADCASTED:break;case lr.METADATA_CHANGED:e.stopListenMetadataChanged();break;case lr.ONLINE_USERS_CHANGED:e.stopListenOnlineUsersChanged();break;default:throw new Error("'".concat(t,"' is unknown event"))}})),this.alreadyListeningEvents=[]},e.startListenEvent=function(e){if(!this.alreadyListeningEvents.includes(e))switch(this.alreadyListeningEvents.push(e),e){case lr.SELECTION_UPDATED:this.startListenSelectionUpdated();break;case lr.WIDGETS_CREATED:this.startListenWidgetsCreated();break;case lr.WIDGETS_TRANSFORMATION_UPDATED:this.startListenWidgetsTransformationUpdated();break;case lr.WIDGETS_DELETED:this.startListenWidgetsDeleted();break;case lr.COMMENT_CREATED:this.startListenCommentCreated();break;case lr.ESC_PRESSED:this.startListenEscPressed();break;case lr.CANVAS_CLICKED:this.startListenCanvasClicked();break;case lr.ALL_WIDGETS_LOADED:this.startListenAllWidgetsLoaded();break;case lr.DATA_BROADCASTED:break;case lr.METADATA_CHANGED:this.startListenMetadataChanged();break;case lr.ONLINE_USERS_CHANGED:this.startListenOnlineUsersChanged();break;default:throw new Error("'".concat(e,"' is unknown event"))}},e.onKeyUp=function(t){"Escape"===t.key&&e.dispatchEvent(lr.ESC_PRESSED,[])},e.startListenEscPressed=function(){window.addEventListener("keyup",this.onKeyUp)},e.stopListenEscPressed=function(){window.removeEventListener("keyup",this.onKeyUp)},e.startListenAllWidgetsLoaded=function(){m.widgetController.isAllWidgetsLoaded()||m.widgetController.allWidgetsLoaded.addOnce((function(){e.dispatchEvent(lr.ALL_WIDGETS_LOADED,[])}))},e.onCanvasClicked=function(){var t=sr.getMousePosition(),n=(0,Yn.getScreenToCanvasX)(t.x),r=(0,Yn.getScreenToCanvasY)(t.y);e.dispatchEvent(lr.CANVAS_CLICKED,{x:n,y:r})},e.startListenCanvasClicked=function(){m.mouseController.mouseReleased.add(this.onCanvasClicked)},e.stopListenCanvasClicked=function(){m.mouseController.mouseReleased.remove(this.onCanvasClicked)},e.onSelectionChanged=function(t){return(0,r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,a,s;return(0,r.__generator)(this,(function(r){for(n=new Map,i=new Array(t.length),o=0;o").concat(Tr(e),"")}function wr(e,t){var n=(new DOMParser).parseFromString(e,"image/svg+xml"),r=n.firstChild;return 1===n.childNodes.length&&r instanceof SVGElement?t(r):(n.children[0].innerHTML,"")}var Ar="data:image/svg+xml,",Sr=["https://","data:image/png;base64,",Ar];function br(e){if(Sr.some((function(t){return e.startsWith(t)}))){if(e.startsWith(Ar)){var t=e.substring(Ar.length);return Ar+encodeURIComponent(function(e){return wr(e,Ir)}(decodeURIComponent(t)))}return e}throw new Error(x.urlSchemaNotWhitelisted(e,Sr))}var Cr=n(753180),Dr=n(150814),Or=n(424766);function Rr(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n,i,o,a;return(0,r.__generator)(this,(function(r){if(!(t=v.UICurrentBoard.getInfo().account.installedApplications.find((function(t){return t.id===e}))))throw new Error("Application is not installed in the team.");return n=t.currentUserAuthorization,i=t.application,n&&n.scopes?(o=i.scopes.map((function(e){return e.key})),a=n.scopes,[2,o.every((function(e){return a.includes(e)}))]):[2,!1]}))}))}var Pr=n(123798),Nr=n(984918),kr=n(468431),xr=n(357003),Lr=n(164025),Mr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.__extends)(t,e),t.prototype.convertWidget=function(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){var n;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:if(mt(t,this.controller),!Yt(e))throw new Error(x.widgetDoesntExist(e));if(mt(t,this.controller),!bt(Xt(t.type)))throw new Error(x.wrongInputWidgetArgument());return[4,Wt(e,t)];case 1:return n=r.sent(),[4,Ht()];case 2:return r.sent(),[2,Ct(n)]}}))}))},t.prototype.isConvertibleWidget=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n,i,o,a;return(0,r.__generator)(this,(function(r){if(!(t=Yt(e)))throw new Error(x.widgetDoesntExist(e));return n=t.asNs("metadata"),i=n?n.getJsonData():null,o=!i||0===Object.keys(i).length,a=(0,Nr.asFrameworkChild)(t,kr.default.USM),[2,o&&(!a||a.isStory)&&!(0,xr.isJiraCardWidget)(t)&&!(0,xr.isRallyCardWidget)(t)&&!(0,Lr.isAppCardWidget)(t)]}))}))},t.prototype.awaitTransactionComplete=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){return[2,Ht()]}))}))},(0,r.__decorate)([u.remote,ye(A.EDIT_CONTENT)],t.prototype,"convertWidget",null),(0,r.__decorate)([u.remote],t.prototype,"isConvertibleWidget",null),(0,r.__decorate)([u.remote],t.prototype,"awaitTransactionComplete",null),t=(0,r.__decorate)([u.internalReceiverClass],t)}(I);const Wr=Mr;var Ur=n(332378),Br=function(){function e(e,t){this.draggingItemsCallbacks=new Map,this.controller=e,this.currentIframeInfo=t,this.board=new ir(this.controller,this),this.account=new fr.default(this.controller,this),this.currentUser=new mr(this.controller,this),this.internal=new Wr(this.controller,this)}return e.prototype.initializeInner=function(e){return this.controller.registerPlugin(e),Promise.resolve()},e.prototype.addButtonExtensionPoint=function(e){this.controller.addButtonExtensionPoint(e)},e.prototype.showNotification=function(e){(0,ar.default)().show(e)},e.prototype.showErrorNotification=function(e){(0,ar.default)().showError(e)},e.prototype.startListenEvent=function(e){pr.startListenEvent(e)},e.prototype.broadcastEventInner=function(e){if("ESC_PRESSED"===e.type)this.controller.dispatchEventToIframes({type:"ESC_PRESSED",data:void 0});else{if("BROADCAST_DATA"!==e.type)throw new Error("Unknown sdk inner event ".concat(e));this.controller.dispatchEventToIframes({type:"DATA_BROADCASTED",data:e.data})}},e.prototype.isAuthorized=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){var e;return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return(0,Cr.isExternalEditor)()&&this.controller.isAvailableForExternalEditors()?[2,!0]:(e=this.controller.appInstallation.id,[4,this.controller.updatePluginAuthorizationInfo()]);case 1:return t.sent(),[2,Rr(e)]}}))}))},e.prototype.getIdToken=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){var e,t,n;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:if((0,er.default)().userType!==hr.UserType.REGULAR)throw new Error("You don't have permissions to call getIdToken()");if(e=v.UICurrentBoard.getInfo().account.id,!(t=this.controller.appInstallation.id))throw new Error("You are trying to call getIdToken() from the developer console.");r.label=1;case 1:return r.trys.push([1,3,,4]),[4,O.default.accounts.selectById(e).getSignedIdentity(t)];case 2:return[2,r.sent()];case 3:if("number"===typeof(null===(n=r.sent())||void 0===n?void 0:n.status)&&n.status>499&&n.status<=599)throw new Error("An error occurred when retrieving signed identity.");throw new Error("you are not authorised to call getIdToken()");case 4:return[2]}}))}))},e.prototype.requestAuthorization=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t=this;return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return[4,(0,Dr.default)().show({componentFactory:(0,Or.default)({applicationId:this.controller.appInstallation.application.id,accountId:v.UICurrentBoard.getInfo().account.id,isAuthorized:function(){return t.isAuthorized()},redirectUri:null===e||void 0===e?void 0:e.redirect_uri,state:null===e||void 0===e?void 0:e.state})})];case 1:return[4,(0,n.sent().waitForClose)()];case 2:if(n.sent()instanceof Error)throw"Authorization request rejected by user or failed";return[4,this.__invalidateAuthorization()];case 3:return n.sent(),[2]}}))}))},e.prototype.__invalidateAuthorization=function(){return this.controller.updatePluginAuthorizationInfo()},e.prototype.__setRuntimeState=function(e){if("object"!==typeof e)throw new Error("Runtime data should have 'object' type");return this.controller.sharedRuntimeData=(0,r.__assign)((0,r.__assign)({},this.controller.sharedRuntimeData),e),this.__getRuntimeState()},e.prototype.__getRuntimeState=function(){return Promise.resolve(this.controller.sharedRuntimeData)},e.prototype.onDraggableItemStartDrag=function(e,t){var n=this.currentIframeInfo.iframeElement;this.createDummy(e,n,(0,_.produceDOMDummyController)((function(){var e=t.preview.width||100,n=t.preview.height||100;return Ur('
')).css({width:e,height:n,margin:"-".concat(Math.round(n/2),"px 0 0 -").concat(Math.round(e/2),"px")})}),(function(){})),[],t.isTouchEvent)},e.prototype.onDraggableImageStartDrag=function(e,t){var n=this.currentIframeInfo.iframeElement,r=[t.preview.url,{image:t.image.url}];this.createDummy(e,n,(0,_.produceLibraryDummyController)(),r,t.isTouchEvent)},e.prototype.createDummy=function(e,t,n,i,o){var a,s,c=this,u="disableMouseEvents",l=!1;t.classList.add(u),s=t.getBoundingClientRect();var p,f=Pr.bowser.firefox;f&&(p=getComputedStyle(t).display,t.style.display="none");var _=Ur(t).offset();setTimeout((function(){f&&(t.style.display=p),o?c.draggingItemsCallbacks.set(e,{onTouchMove:function(e,t){m((0,d.createFakeMouseEvent)(e+_.left,t+_.top))},onTouchEnd:v,onTouchCancel:y}):(Ur(document).on("mousemove",m),Ur(document).on("mouseup",v))}));var m=function(e){a=h.getClientXY(e),l?n.move(a):(l=!0,n.create.apply(n,(0,r.__spreadArray)([a],i,!1))),e.preventDefault(),e.stopPropagation()},v=function(){l&&((0,g.isBoundsContainsPoint)(s,a)?(n.cancel(),c.currentIframeInfo.connector.currentDraggableItemCanceled(e)):(n.drop(a),c.currentIframeInfo.connector.currentDraggableItemDropped(e,(0,Yn.getScreenToCanvasX)(a.x),(0,Yn.getScreenToCanvasY)(a.y)))),t.classList.remove(u),E()},y=function(){l&&n.cancel(),E()},E=function(){Ur(document).off("mousemove",m),Ur(document).off("mouseup",v),c.draggingItemsCallbacks.delete(e)}},e.prototype.onDraggableImageClick=function(e){f.initPosition(),(0,p.default)().createWidgetFromUrl(e.url)},e.prototype.onDraggableItemTouchMove=function(e,t,n){var r=this.draggingItemsCallbacks.get(e);r&&r.onTouchMove(t,n)},e.prototype.onDraggableItemTouchEnd=function(e){var t=this.draggingItemsCallbacks.get(e);t&&t.onTouchEnd()},e.prototype.onDraggableItemTouchCancel=function(e){var t=this.draggingItemsCallbacks.get(e);t&&t.onTouchCancel()},(0,r.__decorate)([(0,u.remoteReceiver)(ir)],e.prototype,"board",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(fr.default)],e.prototype,"account",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(mr)],e.prototype,"currentUser",void 0),(0,r.__decorate)([(0,u.remoteReceiver)(Wr)],e.prototype,"internal",void 0),(0,r.__decorate)([u.remote],e.prototype,"initializeInner",null),(0,r.__decorate)([u.remote],e.prototype,"addButtonExtensionPoint",null),(0,r.__decorate)([u.remote],e.prototype,"showNotification",null),(0,r.__decorate)([u.remote],e.prototype,"showErrorNotification",null),(0,r.__decorate)([u.remote,Ee(we.OAuthScope.BOARDS_READ)],e.prototype,"startListenEvent",null),(0,r.__decorate)([u.remote],e.prototype,"broadcastEventInner",null),(0,r.__decorate)([u.remote],e.prototype,"isAuthorized",null),(0,r.__decorate)([u.remote],e.prototype,"getIdToken",null),(0,r.__decorate)([u.remote],e.prototype,"requestAuthorization",null),(0,r.__decorate)([u.remote],e.prototype,"__invalidateAuthorization",null),(0,r.__decorate)([u.remote],e.prototype,"__setRuntimeState",null),(0,r.__decorate)([u.remote],e.prototype,"__getRuntimeState",null),(0,r.__decorate)([u.remote],e.prototype,"onDraggableItemStartDrag",null),(0,r.__decorate)([u.remote],e.prototype,"onDraggableImageStartDrag",null),(0,r.__decorate)([u.remote],e.prototype,"onDraggableImageClick",null),(0,r.__decorate)([u.remote],e.prototype,"onDraggableItemTouchMove",null),(0,r.__decorate)([u.remote],e.prototype,"onDraggableItemTouchEnd",null),(0,r.__decorate)([u.remote],e.prototype,"onDraggableItemTouchCancel",null),e}();const Fr=Br;var Gr=n(599442);var zr,Vr=n(500431);!function(e){e[e.ARIAL=0]="ARIAL",e[e.CURSIVE=1]="CURSIVE",e[e.ABRIL_FATFACE=2]="ABRIL_FATFACE",e[e.BANGERS=3]="BANGERS",e[e.EB_GARAMOND=4]="EB_GARAMOND",e[e.GEORGIA=5]="GEORGIA",e[e.GRADUATE=6]="GRADUATE",e[e.GRAVITAS_ONE=7]="GRAVITAS_ONE",e[e.FREDOKA_ONE=8]="FREDOKA_ONE",e[e.NIXIE_ONE=9]="NIXIE_ONE",e[e.OPEN_SANS=10]="OPEN_SANS",e[e.PERMANENT_MARKER=11]="PERMANENT_MARKER",e[e.PT_SANS=12]="PT_SANS",e[e.PT_SANS_NARROW=13]="PT_SANS_NARROW",e[e.PT_SERIF=14]="PT_SERIF",e[e.RAMMETTO_ONE=15]="RAMMETTO_ONE",e[e.ROBOTO=16]="ROBOTO",e[e.ROBOTO_CONDENSED=17]="ROBOTO_CONDENSED",e[e.ROBOTO_SLAB=18]="ROBOTO_SLAB",e[e.CAVEAT=19]="CAVEAT",e[e.TIMES_NEW_ROMAN=20]="TIMES_NEW_ROMAN",e[e.TITAN_ONE=21]="TITAN_ONE",e[e.LEMON_TUESDAY=22]="LEMON_TUESDAY",e[e.ROBOTO_MONO=23]="ROBOTO_MONO",e[e.NOTO_SANS=24]="NOTO_SANS",e[e.PLEX_SANS=25]="PLEX_SANS",e[e.PLEX_SERIF=26]="PLEX_SERIF",e[e.PLEX_MONO=27]="PLEX_MONO",e[e.SPOOF=28]="SPOOF",e[e.TIEMPOS_TEXT=29]="TIEMPOS_TEXT",e[e.NOTO_SERIF=1e3]="NOTO_SERIF",e[e.NOTO_SERIF_JP=1001]="NOTO_SERIF_JP",e[e.NOTO_SANS_JP=1002]="NOTO_SANS_JP",e[e.NOTO_SANS_HEBREW=1003]="NOTO_SANS_HEBREW",e[e.NOTO_SERIF_KR=1004]="NOTO_SERIF_KR",e[e.NOTO_SANS_KR=1005]="NOTO_SANS_KR",e[e.SERIF=1006]="SERIF",e[e.SANS_SERIF=1007]="SANS_SERIF",e[e.MONOSPACE=1008]="MONOSPACE"}(zr||(zr={}));const Hr=zr;var Kr=n(290257),jr=n(338207),Yr=n(378895);var Xr=n(368159),Zr=n(626829),Jr="DEV_TOOL_CONSOLE_PLUGIN_NAME",qr="dev_tool_console_plugin_frame_uid";function Qr(){var e={onReady:function(e){setTimeout(e)}},t=new Gr.default;pr.fakeSDKEventDispatcher=t,function(e,t){var n=t;n.addListener=function(n,r){return e.addEventListener(n,r),t.startListenEvent(n)},n.removeListener=function(t,n){return e.removeEventListener(t,n),Promise.resolve()},n.broadcastData=function(e){return t.broadcastEventInner({type:"BROADCAST_DATA",data:e})},window.addEventListener("keyup",(function(e){"Escape"===e.key&&t.broadcastEventInner({type:"ESC_PRESSED"})}))}(t,e),e.enums={event:lr,shapeType:Y.ShapeType,stickerType:Ne.default,borderStyle:Vr.default,fontFamily:Hr,textAlign:le.default,textAlignVertical:de.default,lineStyle:Kr.default,lineType:Yr.default,lineArrowheadStyle:jr.default};var n={pluginId:Jr,iframeUID:qr},r=u.encode({commandsReceiver:Fr});u.buildConnector("",e,r,(function(e,t){return s.sendCommand(e,n,t)}));var i,o=new l.default(t),s=new a.default((function(e){setTimeout((function(){c.processCommand($r(e))}))}),(function(e){return o})),c=new a.default((function(e){s.processCommand($r(e))}),(function(e){return i})),d={pluginId:Jr,iframeUID:qr},p={};u.buildConnector("",p,hi,(function(e,t){return c.sendCommand(e,d,t)}));var f={uid:qr,connector:p,channel:c,iframeElement:void 0,iframeWindow:void 0},h=(0,Xr.createFakeAppInstallation)(Jr);h.application.clientPlugin={enabled:!0,mainJSUri:"",sdkVersion:Zr.ApplicationWebSdkVersion.SDK_V1};var g=new _i(h);return i=new Fr(g,f),{instance:e,controller:g}}function $r(e){return JSON.parse(JSON.stringify(e))}var ei=n(703581),ti=n(341469),ni=n(980534);function ri(e){if(!e)return[];e=Array.isArray(e)?e:[e];for(var t=[],n=-1,r=function(r){var i="arg"+ ++n;if(!ii(r))return t.includes(i)||t.push(i),"continue";if(Array.isArray(r))return r.forEach((function(n){if((o=n)!==Object(o))t.includes(i)||t.push(i);else{var r={};r[i]=n,e.push(r)}var o})),"continue";for(var o=oi(r),a=function(e){var n=e[0],r=e[1];return Array.isArray(r)?(r.length>0?r.forEach((function(e){return o.push([n,e])})):n&&!t.includes(n)&&t.push(n),"continue"):ii(r)?(oi(r).forEach((function(e){return o.push([n+"."+e[0],e[1]])})),"continue"):void(n&&void 0!==r&&!t.includes(n)&&t.push(n))},s=0,c=o;s').concat(function(e){return wr(''.concat(e,""),Tr)}(e),"")}function bi(e){if(e.data&&e.data.rtbSuperCommandID){var t,n=e.data;switch(vi&&(0,Ei.default)("PLUGIN \u2192 APP","green",e,"showResponses"===vi),n.rtbSuperCommandID){case s.default.HELLO_APP_FROM_IFRAME:if(!Ci().some((function(t){return t.createIframeCommandChannelAndSayHello(e.source)})))throw new Error("HELLO_APP_FROM_IFRAME:: PluginController not found for origin '".concat(e.origin,"'"));break;case s.default.IFRAME_CHANNEL_COMMAND:var r=n.data,i=(t=r.context.pluginId,Ci().find((function(e){return e.appKey===t})));if(!i)throw new Error("IFRAME_CHANNEL_COMMAND:: PluginController not found for pluginId=".concat(r.context.pluginId));!function(e,t){var n=e.data.commandId,r=e.data.context&&e.data.context.pluginId;if(r&&n&&n!==a.default.RESPONSE_COMMAND_ID){var i=(0,_e.default)().canvasBoardInfo,o=ri(e.data.data);qt.sdkMethodUsed(n,t,r,i.id,i.account.id,o)}}(n,"iframe"),i.processCommandFromIFrame(e.source,r)}}}function Ci(){return(0,r.__spreadArray)((0,r.__spreadArray)([],wi,!0),[yi],!1)}function Di(e){var t=new _i(e);return wi.push(t),qt.pluginMainJSLoaded(t.appKey),t}Ai.reloadSandbox=function(){var e=(0,Rn.default)(),t=wi.slice();wi.forEach((function(t){e.stopSdkPlugin(t.appKey)})),t.forEach((function(e){Di(e.appInstallation)}))};var Oi=n(658348),Ri=n(112677),Pi="BoardSdkV2";Ri.register(Pi,(function(){return n.e(14615).then(n.bind(n,344973)).then((function(e){return e.default}))}));const Ni=Ri.createModuleDef(Pi);var ki=function(){function e(){this.sdkV2Loaded=!1,i.default.board.runWebPlugins&&(!function(){vi=(0,o.getParameterByName)(Ii.LogParameter.LOG_SDK_COMMANDS),window.addEventListener("message",bi),pr.init((function(){return wi}));var e=Qr();yi=e.controller,Ai.miro={v1:e.instance},(0,Ti.default)().sdkDisabled.add((function(){wi.forEach((function(e){(0,Rn.default)().stopSdkPlugin(e.appKey)}))}))}(),Oi.init())}return e.prototype.loadAndStartPlugin=function(e){var t;return(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return!i.default.board.runWebPlugins||(0,Ti.default)().isSdkDisabled?[2,Promise.resolve()]:(null===(t=e.application.clientPlugin)||void 0===t?void 0:t.sdkVersion)!==Zr.ApplicationWebSdkVersion.SDK_V2?[3,2]:(this.sdkV2Loaded=!0,[4,Ni()]);case 1:return[2,n.sent().loadAndStartPlugin(e)];case 2:return[2,Di(e)]}}))}))},e.prototype.unloadPlugin=function(e){i.default.board.runWebPlugins&&!(0,Ti.default)().isSdkDisabled&&(this.sdkV2Loaded&&Ni().then((function(t){t.unloadPlugin(e)})),function(e){var t=wi.findIndex((function(t){return t.appKey===e})),n=wi[t];n&&(n.destroy(),wi.splice(t,1))}(e))},e.prototype.onRouteMount=function(){},e.prototype.onRouteUnmount=function(){i.default.board.runWebPlugins&&(this.sdkV2Loaded&&(Ni().then((function(e){e.onRouteUnmount()})),this.sdkV2Loaded=!1),pr.destroy())},e}();const xi=new ki},614511:(e,t,n)=>{"use strict";n.d(t,{IFRAME_APP_KEY_ATTRIBUTE:()=>i,SdkV2IframeType:()=>r});var r,i="data-miro-app-key";!function(e){e.MAIN="MAIN",e.PANEL="PANEL",e.MODAL="MODAL"}(r||(r={}))},402529:(e,t,n)=>{"use strict";n.d(t,{isInitialized:()=>o,setPluginsController:()=>a,getPluginsController:()=>s,destroy:()=>c});var r,i=n(941090);function o(){return void 0!==r}function a(e){r=e}function s(){if(!r)throw new Error(i.initialization.initializeSdkFail());return r}function c(){r&&(r.destroy(),r=void 0)}},941090:(e,t,n)=>{"use strict";n.d(t,{auth:()=>r,backendAPI:()=>i,rateLimiter:()=>o,failedCRUD:()=>a,initialization:()=>s,inputValidation:()=>c,installation:()=>u,ui:()=>l,unknownError:()=>d,unknownId:()=>p,unsupported:()=>f});var r={authorizeAppOnInstallFail:function(){return"The authorization request failed, or the user rejected it."},insufficientAppPermissions:function(e){var t=e.command,n=e.appId,r=e.requiredScope;return"Cannot execute ".concat(t,", because the ").concat(n," app doesn't have the following permission: ").concat(r,".")},insufficientUserPermissions:function(){return"The user doesn't have the necessary permissions in the team to obtain an ID token."},unauthorizedUser:function(){return"The user is unauthorized in Miro. Only authorized users can obtain ID tokens."}},i={getIdTokenFail:function(){return"An error occurred while retrieving an ID token."},uploadResourceFail:function(e){var t=e.msg;return"Cannot upload ".concat(t)}},o={perHourExceeded:function(e){return"The API rate limit was exceeded. Requests can use up to ".concat(e," credits in total per hour.")},perMinuteExceeded:function(e){return"The API rate limit was exceeded. Requests can use up to ".concat(e," credits in total per minute.")}},a={childWidgetOutsideParent:function(e){var t=e.id;return"Cannot set item ".concat(t," as a child, because the item isn't inside the parent frame.")},createImageFail:function(){return"Cannot create the image."},nonExistingChildWidget:function(e){var t=e.id;return"Cannot set item ".concat(t," as a child, because the item doesn't exist.")},readOnlyProperty:function(e){var t=e.prop;return"Cannot change this property, because it's read-only: \"".concat(t,'"')},removeWidgetFail:function(e){var t=e.type,n=e.id;return"Cannot remove the ".concat(t," item (id=").concat(n,").")},uploadImageFail:function(e){var t=e.msg;return"Cannot upload the image: ".concat(t)},duplicateTagTitle:function(){return"The title must be unique. Specify a different title for the tag."},maxBoardTags:function(e){var t=e.limit;return"Cannot create more tags. The board has reached the limit of ".concat(t," tags. ")},unknownTagColor:function(e){var t=e.color;return"The canvas API returned an unknown color: ".concat(t)},embedlyFailed:function(e){var t=e.url;return"Cannot resolve the embed URL ".concat(t,". Please try again later.")},changeParentForRemoteLockedWidget:function(e){var t=e.id;return"Cannot change parent, because item ".concat(t," is locked by another client.")},updateRemoteLockedWidget:function(e){var t=e.id;return"Cannot commit the update, because item ".concat(t," is locked by another client.")},cannotResizeFrame:function(e){var t=e.id;return"Cannot resize the frame (".concat(t,") to the specified size, because one or more children would exist outside the parent frame.")},cannotMoveAWidgetOutsideOfItsParent:function(e){var t=e.id,n=e.type;return"Cannot move the ".concat(n," item with ID (").concat(t,") to the specified location, because it's a child of another board item. Remove the child item from its parent, and then move it.")}},s={initializeDragStateFail:function(){return"The drag state hasn't initialized."},initializeIFrameFail:function(){return"Cannot execute the command, because the app iFrame hasn't initialized."},initializeSdkFail:function(){return"The Web SDK hasn't initialized."},initializeWidgetFail:function(){return"The item instance hasn't initialized."},getIFrameFail:function(e){var t=e.type;return"Cannot open the modal or the panel, because no iFrame is registered with the ".concat(t,".")},loadAndStartPluginFail:function(){return"Cannot load the app, because the method to load it is called on a destroyed app instance."}},c={invalidDateFormat:function(){return"The date format isn't valid. Specify dates as YYYY-MM-DD. Example: 2021-08-29"},missingTypeProperty:function(){return"The payload isn't valid, because the 'type' property is missing."},invalidStyleProperty:function(e){var t=e.prop;return"The value of the ".concat(t," style property isn't valid.")},invalidSvg:function(e){var t=e.svgIcon;return'"svgIcon" isn\'t a valid SVG element: '.concat(t)},invalidUrl:function(e){var t=e.url;return"The URL isn't valid: ".concat(t)},invalidWidgetId:function(){return"The specified item has no valid ID. Cannot perform actions on items with no valid ID."},moveFrameZIndexFail:function(e){var t=e.command;return"You're passing one or more frames to board.".concat(t,"().\nFrames cannot move to the back or the front. Other supported items can.\nPass an item that supports sending to front and moving to back.")},unexpectedWidgetType:function(e){var t=e.widgetType;return"This is an unexpected item type: ".concat(t)},unknownProperty:function(e){var t=e.prop;return"The ".concat(t," property for the item is unknown.")},unknownStyleProperty:function(e){var t=e.prop;return"The ".concat(t," style property is unknown.")},zoomToInvalidArgument:function(){return"The argument you're passing isn't valid. Pass the item(s) you want to zoom to."}},u={missingAppforTeam:function(e){var t=e.appName,n=e.appId,r=e.teamName;return'The "'.concat(t,'" app (').concat(n,") isn't installed for the \"").concat(r,'" team.\nTo use the app with this team, install it for them.')}},l={noOpenPanelForApp:function(){return"The app is trying to close a panel, but there's no open panel associated with this app."},noOpenModalForApp:function(){return"The app is trying to close a modal, but there's no open modal associated with this app."},openPanelFail:function(){return"Cannot open the panel. The board GUI may be inactive or hidden."},openPanelToDrag:function(){return"You can drag on the board only items from panels that are opened with the 'openPanel' method."}},d={unknownError:function(e){var t=e.payload;return"An unknown error occurred: ".concat(t)}},p={getAppIdFail:function(e){var t=e.pluginId;return"Cannot update the app, because the corresponding client ID ".concat(t," wasn't found.")},getAppDataFail:function(){return"Cannot retrieve app data for this app. The app doesn't have a valid client ID."},getWidgetMetadataFail:function(){return"Cannot retrieve metadata for this item. The app doesn't have a valid client ID."},getWidgetIdFail:function(e){var t=e.id;return"Cannot find the item with ID: ".concat(t)},setAppDataFail:function(){return"Cannot set app data for this app. The app doesn't have a valid client ID."}},f={unknownCommand:function(e){var t=e.command;return"The specified command is unknown: ".concat(t)},unknownShapeType:function(e){var t=e.shape;return"This is an unknown shape type: ".concat(t,". Specify a supported shape type.")},unknownAppCardStatus:function(e){var t=e.status;return"This is an unknown app card status: ".concat(t,".")},unsupportedCommand:function(e){var t=e.command;return"The specified command is unsupported: ".concat(t)},unsupportedItemType:function(e){var t=e.itemType;return"The item type is unsupported. Specify a supported item type. Received: ".concat(t)},unsupportedEmbedType:function(){return"The specified embed type is unsupported. Supported embed types: video, audio, and web pages."},unsupportedAppUrl:function(e){var t=e.name;return"The URL for the ".concat(t,' app isn\'t valid. The URL must start with "https" or "http://localhost".')},resizeOnlyWidthOrHeight:function(){return'Change either "width", or "height". It\'s not possible to change both properties at the same time.'}}},658348:(e,t,n)=>{"use strict";n.d(t,{destroy:()=>Fu,init:()=>Bu,loadAndStartPlugin:()=>Gu,unloadPlugin:()=>zu});var r=n(759312),i=n(123798),o=n(239867),a=n(258445),s=n(105603),c=n(863188),u=n(285087),l="sdkv2-plugin-message";function d(e){var t;return(null===(t=e.data)||void 0===t?void 0:t.commandId)===l}var p=function(){function e(e){var t=this;this.destroyed=!1,this.destroy=function(){t.clients.forEach((function(e){e.waiting.clear()})),t.clients.clear(),t.hostWindow.removeEventListener("message",t.handlePostMessage),t.destroyed=!0},this.createBus=function(e,n){if(t.destroyed)throw new Error("SdkCommunicationBus: createBus is called on a destroyed instance");t.clients.set(e.container,{handler:n,target:e,waiting:new Map});var r=t.dispatch,i=t.destroyBus;return{target:e,dispatch:function(t,n){return r(e.container,t,n)},destroy:function(){return i(e.container)}}},this.destroyBus=function(e){var n=t.clients.get(e);n&&(n.waiting.clear(),t.clients.delete(e))},this.hostWindow=e,this.clients=new Map,this.handlePostMessage=this.handlePostMessage.bind(this),this.dispatch=this.dispatch.bind(this),this.destroyBus=this.destroyBus.bind(this),this.hostWindow.addEventListener("message",this.handlePostMessage)}return e.prototype.getId=function(){return Math.random().toString(36).slice(-10)},e.prototype.handlePostMessage=function(e){var t=this;if(d(e)&&null!==(n=e.source)&&"window"in n){var n,r=this.clients.get(e.source);if(r&&("*"===r.target.origin||e.origin===r.target.origin)){var i=e.data,o=r.waiting.get(i.msgId);if(o)r.waiting.delete(i.msgId),o.resolve(i.payload);else{var a=function(e){e&&t.dispatch(r.target.container,e,i.msgId)};r.handler(i.payload).then(a).catch(a)}}}},e.prototype.dispatch=function(e,t,n){var r=this;return new Promise((function(i,o){var a=!n,s=r.clients.get(e);if(s){var c;a?(c=r.getId(),s.waiting.set(c,{resolve:i,reject:o})):c=n;var u={commandId:l,payload:t,msgId:c};s.target.container.postMessage(u,s.target.origin),!a&&n&&(s.waiting.delete(n),i(null))}}))},e}(),f=n(648398),h=n(612830),g=n(315380),_=n(703809),m=n(901646),v=n(603932),y=n(166699),E=n(237439),T=n(406824),I=n(164025),w=n(913993),A=n(353076),S=n(917890),b=n(850348),C=n(897842),D=n(178909),O=n(338207),R=n(290257),P=n(168357),N=n(631787),k=n(803655),x=n(941090),L=n(6719),M=n(620579),W=n(575948),U=b.Style,B={SHAPE_WIDGET_DEFAULT_STYLE:C.SHAPE_WIDGET_DEFAULT_STYLE,BORDER_COLOR_DEFAULT:C.BORDER_COLOR_DEFAULT,MIN_SIZE:C.MIN_SIZE,SHAPE_TYPE_SORT:C.SHAPE_TYPE_SORT,LINE_TYPE_SORT:C.LINE_TYPE_SORT,SHAPE_AVAILABLE_FORMATS:C.SHAPE_AVAILABLE_FORMATS},F=m.WidgetType;function G(){return(0,h.CanvasEngine)().history.awaitTransactionComplete((0,h.CanvasEngine)().history.getCurrentTransactionId())}function z(e){var t=(0,h.CanvasEngine)().objectsRepository.getObjectById(e);return(null===t||void 0===t?void 0:t.isPresent)?t:void 0}function V(e){return z(k.Long.fromString(e))}function H(e){var t=e.widgetType;if(t!==F.TEXT)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:F[t]}));return e}function K(e){var t=e.widgetType;if(e.widgetType!==F.STICKER)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:F[t]}));return e}function j(e){var t=e.widgetType;if(t!==F.SHAPE)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:F[t]}));return e}function Y(e){var t=e.widgetType;if(t!==F.IMAGE)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:F[t]}));return e}function X(e){return e.widgetType===m.WidgetType.CARD}function Z(e){if(!X(e))throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:m.WidgetType[e.widgetType]}));return e}function J(e){if(!(0,I.isAppCardWidget)(e))throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:m.WidgetType[e.widgetType]}));return e}function q(e){var t=e.widgetType;if(t!==m.WidgetType.FRAME)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:m.WidgetType[t]}));return e}function Q(e){var t=e.widgetType;if(t!==m.WidgetType.PREVIEW)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:m.WidgetType[t]}));return e}function $(e){return void 0!==e&&"widgetType"in e}function ee(e){var t=e.type;if(t!==L.default.TAG)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:m.WidgetType[t]}));return e}function te(e){var t=e.widgetType;if(t!==m.WidgetType.EMBED)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:m.WidgetType[t]}));return e}function ne(e){var t=e.widgetType;if(t!==m.WidgetType.LINE)throw new Error(x.inputValidation.unexpectedWidgetType({widgetType:m.WidgetType[t]}));return e}function re(e){var t,n;return null!==(n=null===(t=e.getData().appCard)||void 0===t?void 0:t.appId)&&void 0!==n?n:""}function ie(e){var t,n;return null!==(n=null===(t=null===e||void 0===e?void 0:e.parentTokenizer)||void 0===t?void 0:t.id.toString())&&void 0!==n?n:null}function oe(e){var t=e.parent,n=e.child,r=t.width/2,i=t.height/2,o=Math.abs(t.x-n.x),a=Math.abs(t.y-n.y);return o>r||a>i}n(368159);var ae,se=n(984918),ce=n(468431),ue=n(245420),le=n(161320),de=n.n(le);function pe(e){return Object.keys(e)}function fe(e){for(var t={},n=0,r=pe(e);n1e-9};function Fe(e){var t=e.canvasWidget,n=e.props,r=e.defaultSize,i=r.width,o=r.height,a=n.size,s=a.width,c=a.height,u=!1,l=!1;if(t){var d=t.scaledHeight,p=t.scaledWidth;u=Be(c,d),l=Be(s,p)}else u=Be(c,o),l=Be(s,i);if(l&&u)throw new Error(x.unsupported.resizeOnlyWidthOrHeight());return u?c/o||1:s/i||1}var Ge={width:100,height:100,x:0,y:0,rotation:0},ze={x:ue.number().default(Ge.x),y:ue.number().default(Ge.y)},Ve={rotation:ue.number().default(Ge.rotation)},He={width:ue.number().default(Ge.width),height:ue.number().default(Ge.height)},Ke=n(298784),je=n(470625),Ye=n(776935);function Xe(e){return void 0!=e&&"object"===typeof e&&!Array.isArray(e)}function Ze(e){for(var t=[],n=1;ne.DRAG_THRESHOLD||Math.abs(n-this.dragStartPosition.y)>e.DRAG_THRESHOLD},e.prototype.addListener=function(e,t,n){this.listeners.push({type:e,selector:t,handler:n})},e.prototype.removeListener=function(e,t,n){this.listeners=this.listeners.filter((function(r){return r.type!==e||null!=t&&r.selector!==t||null!=n&&r.handler!==n}))},e.prototype.isDraggableElement=function(e){return(e instanceof HTMLElement||e instanceof SVGElement)&&this.listeners.some((function(t){var n=t.selector;return!!e.closest(n)}))},e.prototype.disableClickEvents=function(){var e=this;Object.entries(yt).forEach((function(t){var n=t[0],r=t[1];e.originalBodyStyle[n]=document.body.style.getPropertyValue(n),document.body.style.setProperty(n,r)}))},e.prototype.restoreClickEvents=function(){Object.entries(this.originalBodyStyle).forEach((function(e){var t=e[0],n=e[1];document.body.style.setProperty(t,n)})),this.originalBodyStyle={}},e.prototype.dragEnd=function(e){this.dispatch("dragend",{target:e,clientX:NaN,clientY:NaN,screenX:NaN,screenY:NaN})},e.prototype.dispatch=function(e,t){this.listeners.forEach((function(n){var i=n.selector,o=n.handler,a=n.type;if(e===a){var s=t.target.closest(i);if(s)o(new CustomEvent(e,{detail:(0,r.__assign)((0,r.__assign)({},t),{target:s,type:e})}))}}))},e.DRAG_THRESHOLD=8,e}(),Tt=function(e){function t(){var t=e.call(this)||this;return t.isDragging=!1,t.onMouseDown=function(e){var n=e.target;t.isDraggableElement(n)&&(t.target=n,t.setDragStartPosition(e.clientX,e.clientY),window.addEventListener("mouseup",t.onMouseUp),document.addEventListener("mousemove",t.onMouseMove,{passive:!0}))},t.onMouseMove=function(e){if(t.target){var n=e.clientX,r=e.clientY,i=e.screenX,o=e.screenY;if(t.isDragging||t.shouldDispatchDrag(n,r)){var a=t.isDragging?"drag":"dragstart";t.isDragging||t.disableClickEvents(),t.isDragging=!0,t.dispatch(a,{target:t.target,clientX:n,clientY:r,screenX:i,screenY:o})}}},t.onMouseUp=function(e){if(t.isDragging&&t.target){var n=e.clientX,r=e.clientY,i=e.screenX,o=e.screenY;t.dispatch("drop",{target:t.target,clientX:n,clientY:r,screenX:i,screenY:o})}t.resetDragging()},t.resetDragging=function(){window.removeEventListener("mouseup",t.onMouseUp),document.removeEventListener("mousemove",t.onMouseMove),t.isDragging&&t.target&&t.dragEnd(t.target),t.target&&t.restoreClickEvents(),t.isDragging=!1,t.target=void 0},document.addEventListener("mousedown",t.onMouseDown),window.addEventListener("blur",t.resetDragging),t}return(0,r.__extends)(t,e),t}(Et),It=!1;window.addEventListener("touchmove",(function(e){It&&e.preventDefault()}),{passive:!1});var wt,At=function(e){function t(){var t=e.call(this)||this;return t.onTouchStart=function(e){var n=e.target;if(t.isDraggableElement(n)){var r=e.touches[0],i=r.clientX,o=r.clientY,a=r.screenX,s=r.screenY;t.setDragStartPosition(i,o),t.target=n,t.tapTimeout=window.setTimeout((function(){t.startDragging({target:n,clientX:i,clientY:o,screenX:a,screenY:s})}),100),window.addEventListener("touchend",t.onTouchEnd),window.addEventListener("touchcancel",t.resetDragging),window.addEventListener("touchmove",t.resetDragging)}},t.onTouchMove=function(e){if(t.target){var n=e.touches[0],r=n.clientX,i=n.clientY,o=n.screenX,a=n.screenY;t.dispatch("drag",{target:t.target,clientX:r,clientY:i,screenX:o,screenY:a})}},t.onTouchEnd=function(e){if(It&&t.target){var n=e.changedTouches[0],r=n.clientX,i=n.clientY,o=n.screenX,a=n.screenY;t.dispatch("drop",{target:t.target,clientX:r,clientY:i,screenX:o,screenY:a})}t.resetDragging()},t.startDragging=function(e){t.shouldDispatchDrag(e.clientX,e.clientY)&&(window.removeEventListener("touchmove",t.resetDragging),window.addEventListener("touchmove",t.onTouchMove,{passive:!0}),It=!0,t.disableClickEvents(),t.dispatch("dragstart",e))},t.resetDragging=function(){window.removeEventListener("touchend",t.onTouchEnd),window.removeEventListener("touchcancel",t.resetDragging),window.removeEventListener("touchmove",t.resetDragging),window.removeEventListener("touchmove",t.onTouchMove),It&&t.target&&(t.restoreClickEvents(),t.dragEnd(t.target)),t.target=void 0,It=!1,void 0!==t.tapTimeout&&(clearTimeout(t.tapTimeout),t.tapTimeout=void 0)},window.addEventListener("touchstart",t.onTouchStart),window.addEventListener("blur",t.resetDragging),t}return(0,r.__extends)(t,e),t}(Et);!function(){function e(e){this.touchSensor=new At,this.mouseSensor=new Tt,Object.assign(this,e)}e.prototype.addListener=function(e,t){this.mouseSensor.addListener(e,this.selector,t),this.touchSensor.addListener(e,this.selector,t)},e.prototype.removeListener=function(e,t){this.mouseSensor.removeListener(e,void 0,t),this.touchSensor.removeListener(e,void 0,t)},e.prototype.reset=function(){var e=this;vt.forEach((function(t){e.mouseSensor.removeListener(t),e.touchSensor.removeListener(t)}))}}();function St(e){switch(e.type){case"text":return new at(e);case"sticky_note":return new st(e);case"shape":return new ct(e);case"image":return new ut(e);case"frame":return new pt(e);case"preview":return new ht(e);case"card":return new lt(e);case"app_card":return new dt(e);case"embed":return new gt(e);case"connector":return new _t(e);case"tag":return new mt(e);default:return new ft(e)}}function bt(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return[4,et().push("UI_REGISTER_EVENT",{name:e})];case 1:return t.sent(),[2]}}))}))}function Ct(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return[4,et().push("UI_UNREGISTER_EVENT",{name:e})];case 1:return t.sent(),[2]}}))}))}var Dt="icon:click",Ot="app_card:open",Rt="app_card:connect",Pt="selection:update",Nt=function(e){return e.startsWith("custom:")},kt=function(){function e(){var e;this.listeners=((e={})[Dt]=[],e[Ot]=[],e[Rt]=[],e[Pt]=[],e)}return e.prototype.addListener=function(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){var n;return(0,r.__generator)(this,(function(r){return this.listeners[e]||(this.listeners[e]=[]),(n=this.listeners[e]).push(t),1===n.length?[2,bt(e)]:[2]}))}))},e.prototype.removeListener=function(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(n){return this.listeners[e]=this.listeners[e].filter((function(e){return e!==t})),0===this.listeners[e].length?[2,Ct(e)]:[2]}))}))},e.prototype.listen=function(){var e=this;(function(e){return Object.keys(e)})(this.listeners).forEach((function(t){et().unsubscribe(t),et().subscribe(t,(function(n){return(0,r.__awaiter)(e,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return this.listeners[t].forEach((function(e){return e(n)})),[2]}))}))}))}))},e}(),xt={drop:new Map,"app_card:connect":new Map,"app_card:open":new Map,"icon:click":new Map,"selection:update":new Map};function Lt(e,t,n){return xt[e]||(xt[e]=new Map),xt[e].set(t,n),n}function Mt(e,t){var n=xt[e],r=n.get(t);return n.delete(t),r}var Wt=new kt;function Ut(e){0===xt.drop.size&&(xt.dragstart=function(){var e=this;return function(t){return(0,r.__awaiter)(e,void 0,void 0,(function(){var e,n,i;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return e=t.detail,n=e.clientX,i=e.clientY,[4,tt("UI_DRAG_START",{clientX:n,clientY:i,dragImage:void 0})];case 1:return r.sent(),[2]}}))}))}}(),xt.drag=function(){var e;return function(t){if(!e){e=requestAnimationFrame((function(){e=void 0}));var n=t.detail;tt("UI_DRAG_MOVE",{clientX:n.clientX,clientY:n.clientY})}}}(),xt.dragend=function(){var e=this;return function(){return(0,r.__awaiter)(e,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return[4,tt("UI_DRAG_END")];case 1:return e.sent(),[2]}}))}))}}(),wt.addListener("dragstart",xt.dragstart),wt.addListener("drag",xt.drag),wt.addListener("dragend",xt.dragend)),wt.addListener("drop",Lt("drop",e,function(e){var t=this;return function(n){return(0,r.__awaiter)(t,void 0,void 0,(function(){var t,i,o,a,s,c,u;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return t=n.detail,i=t.target,o=t.clientX,a=t.clientY,[4,tt("UI_DRAG_DROP",{clientX:o,clientY:a})];case 1:return null==(s=r.sent())||(c=s.x,u=s.y,e({x:c,y:u,target:i})),[2]}}))}))}}(e)))}function Bt(e,t){var n=this;switch(e){case"drop":return Ut(t),Promise.resolve();case Dt:return Wt.addListener(e,Lt(e,t,(function(){return(0,r.__awaiter)(n,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return[2,t()]}))}))})));case Ot:case Rt:return Wt.addListener(e,Lt(e,t,(function(e){return(0,r.__awaiter)(n,void 0,void 0,(function(){var n,i;return(0,r.__generator)(this,(function(r){return n=e.payload.appCard,i={appCard:St(n)},t(i),[2]}))}))})));case Pt:return Wt.addListener(e,Lt(e,t,(function(e){return(0,r.__awaiter)(n,void 0,void 0,(function(){var n,i;return(0,r.__generator)(this,(function(r){return n=e.payload.items,i={items:n.map((function(e){return St(e)}))},t(i),[2]}))}))})));default:if(Nt(e)){var i=function(e){return(0,r.__awaiter)(n,void 0,void 0,(function(){var n,i;return(0,r.__generator)(this,(function(r){return n=e.payload.items,i={items:n.map((function(e){return St(e)}))},t(i),[2]}))}))};return et().subscribe(e,i),Lt(e,t,i),Wt.addListener(e,i)}throw new Error("unknown event: ".concat(e))}}function Ft(e,t){switch(e){case"drop":return function(e){wt.removeListener("drop",Mt("drop",e)),0===xt.drop.size&&(wt.removeListener("dragstart",xt.dragstart),wt.removeListener("drag",xt.drag),wt.removeListener("dragend",xt.dragend))}(t),Promise.resolve();case Dt:case Ot:case Rt:case Pt:return Wt.removeListener(e,Mt(e,t));default:if(Nt(e)){var n=Mt(e,t);return et().unsubscribe(e,n),Wt.removeListener(e,n)}throw new Error("unknown event: ".concat(e))}}var Gt,zt,Vt,Ht,Kt,jt,Yt,Xt,Zt=function(){function e(){this.on=Bt,this.off=Ft}return e.prototype.openPanel=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return[4,tt("UI_OPEN_PANEL",e)];case 1:return t.sent(),[2]}}))}))},e.prototype.closePanel=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return[4,tt("UI_CLOSE_PANEL")];case 1:return e.sent(),[2]}}))}))},e.prototype.openModal=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return[4,tt("UI_OPEN_MODAL",e)];case 1:return t.sent(),[2]}}))}))},e.prototype.closeModal=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return[4,tt("UI_CLOSE_MODAL")];case 1:return e.sent(),[2]}}))}))},e}();(zt=Gt||(Gt={})).Red="red",zt.Magenta="magenta",zt.Violet="violet",zt.LightGreen="light_green",zt.Green="green",zt.DarkGreen="dark_green",zt.Cyan="cyan",zt.Blue="blue",zt.DarkBlue="dark_blue",zt.Yellow="yellow",zt.Gray="gray",zt.Black="black",(Ht=Vt||(Vt={})).Gray="gray",Ht.LightYellow="light_yellow",Ht.Yellow="yellow",Ht.Orange="orange",Ht.LightGreen="light_green",Ht.Green="green",Ht.DarkGreen="dark_green",Ht.Cyan="cyan",Ht.LightPink="light_pink",Ht.Pink="pink",Ht.Violet="violet",Ht.Red="red",Ht.LightBlue="light_blue",Ht.Blue="blue",Ht.DarkBlue="dark_blue",Ht.Black="black",(jt=Kt||(Kt={})).Rectangle="rectangle",jt.Circle="circle",jt.Triangle="triangle",jt.WedgeRoundRectangleCallout="wedge_round_rectangle_callout",jt.RoundRectangle="round_rectangle",jt.Rhombus="rhombus",jt.Parallelogram="parallelogram",jt.Star="star",jt.RightArrow="right_arrow",jt.LeftArrow="left_arrow",jt.Pentagon="pentagon",jt.Hexagon="hexagon",jt.Octagon="octagon",jt.Trapezoid="trapezoid",jt.FlowChartPredefinedProcess="flow_chart_predefined_process",jt.LeftRightArrow="left_right_arrow",jt.Cloud="cloud",jt.LeftBrace="left_brace",jt.RightBrace="right_brace",jt.Cross="cross",jt.Can="can",(Xt=Yt||(Yt={})).Error="error",Xt.Info="info";var Jt="SHOW_NOTIFICATION",qt=function(){function e(){}return e.prototype.showInfo=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t;return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return t={message:e,type:Yt.Info},[4,tt(Jt,t)];case 1:return n.sent(),[2]}}))}))},e.prototype.showError=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t;return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return t={message:e,type:Yt.Error},[4,tt(Jt,t)];case 1:return n.sent(),[2]}}))}))},e.prototype.show=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return[4,tt(Jt,e)];case 1:return t.sent(),[2]}}))}))},e}(),Qt=function(){function e(){}return e.prototype.get=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return[4,tt("VIEWPORT_GET")];case 1:return[2,e.sent()]}}))}))},e.prototype.set=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return[4,tt("VIEWPORT_SET",e)];case 1:return[2,t.sent()]}}))}))},e.prototype.zoomTo=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return Array.isArray(e)?[2,tt("VIEWPORT_ZOOM_TO",{items:e.map((function(e){return e.id}))})]:[2,this.zoomTo([e])]}))}))},e}();function $t(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(n){return Ze(t,e),[2,t]}))}))}function en(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,tt("WIDGET_CREATE",Je(e)).then((function(t){return $t(t,e)}))]}))}))}var tn;!function(){function e(){this.ui=new Zt,this.notifications=new qt,this.viewport=new Qt}e.prototype.createCard=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new lt(e))]}))}))},e.prototype.createAppCard=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new dt(e))]}))}))},e.prototype.createFrame=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new pt(e))]}))}))},e.prototype.createImage=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new ut(e))]}))}))},e.prototype.createPreview=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new ht(e))]}))}))},e.prototype.createShape=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new ct(e))]}))}))},e.prototype.createStickyNote=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new st(e))]}))}))},e.prototype.createText=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new at(e))]}))}))},e.prototype.createEmbed=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new gt(e))]}))}))},e.prototype.createConnector=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new _t(e))]}))}))},e.prototype.createTag=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,en(new mt(e))]}))}))},e.prototype.sync=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return[2,tt("WIDGET_UPDATE",Je(e)).then((function(t){$t(t,e)}))]}))}))},e.prototype.remove=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return t=e.id,n=e.type,[4,tt("WIDGET_REMOVE",{id:t,type:n})];case 1:return r.sent(),[2]}}))}))},e.prototype.bringToFront=function(e){return Array.isArray(e)?tt("BRING_TO_FRONT",{items:e.map((function(e){return e.id}))}):this.bringToFront([e])},e.prototype.sendToBack=function(e){return Array.isArray(e)?tt("SEND_TO_BACK",{items:e.map((function(e){return e.id}))}):this.sendToBack([e])},e.prototype.getById=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t;return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.get({id:e})];case 1:if(t=n.sent(),Array.isArray(t)&&t.length)return[2,St(t[0])];throw new Error("Can not retrieve item with id ".concat(e))}}))}))},e.prototype.get=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t;return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return[4,tt("WIDGET_GET",e)];case 1:if(t=n.sent(),!Array.isArray(t))throw new Error("Error retrieving items");return[2,t.map(St)]}}))}))},e.prototype.getInfo=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){return[2,tt("GET_BOARD_INFO")]}))}))},e.prototype.getUserInfo=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){return[2,tt("GET_USER_INFO")]}))}))},e.prototype.getSelection=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return[4,tt("GET_SELECTION")];case 1:return[2,e.sent().map(St)]}}))}))},e.prototype.getAppData=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return[4,tt("GET_BOARD_APP_DATA",{key:e})];case 1:return[2,t.sent()]}}))}))},e.prototype.setAppData=function(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return[4,tt("SET_BOARD_APP_DATA",{key:e,value:t})];case 1:return[2,n.sent()]}}))}))},e.prototype.setMetadata=function(e,t,n){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return[4,tt("WIDGET_SET_METADATA",{itemId:e.id,key:t,value:n})];case 1:return[2,r.sent()]}}))}))},e.prototype.getMetadata=function(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return[4,tt("WIDGET_GET_METADATA",{itemId:e.id,key:t})];case 1:return[2,n.sent()]}}))}))},e.prototype.getIdToken=function(){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return[4,tt("GET_ID_TOKEN")];case 1:return[2,e.sent()]}}))}))}}();!function(e){e.Success="S",e.Fail="F"}(tn||(tn={}));!function(){function e(e){var t=e.clientWindow,n=void 0===t?window:t,r=new p(n);this.waitingResponse=new Map,this.handlers=new Map,this.responseHandler=this.responseHandler.bind(this),this.handle=this.handle.bind(this),this.busDispatcher=r.createBus({container:n.parent,origin:"*"},this.handle)}e.prototype.push=function(e,t){var n=this,r=Math.random().toString(36).slice(-10),i=[{name:e,payload:t,id:r}];return new Promise((function(e,t){n.waitingResponse.set(r,{resolve:e,reject:t}),n.busDispatcher.dispatch(i).then(n.responseHandler)}))},e.prototype.responseHandler=function(e){for(var t=e,n=0;n100)throw new Error(x.failedCRUD.maxBoardTags({limit:100}));return{type:L.default.TAG,color:an[t.color],text:t.title,widgets:[]}}function pn(e){var t,n=e.type,r=e.payload,i=ln(r);if(void 0!=r.id){var o=function(e){var t=V(e);if(void 0===t)throw new Error(x.unknownId.getWidgetIdFail({id:e}));return ee(t)}(r.id);t=ee(o)}return{type:n,input:i,props:dn({input:i,entity:t}),instance:t}}function fn(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n;return(0,r.__generator)(this,(function(r){return t=e.color,n=e.text,[2,on((0,je.default)().create(n,t,[]))]}))}))}function hn(e){return(0,je.default)().tags.filter((function(t){return e.includes(t.tokenizer.id)}))}function gn(e,t){var n=(0,je.default)().getTagsForWidget(e).map((function(e){return e.tokenizer.id})),r=(0,Ke.difference)(t,n),i=(0,Ke.difference)(n,t);(0,je.default)().addTagsToWidget(hn(r),e),(0,je.default)().removeTagsFromWidget(hn(i),e)}function _n(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){var n,i,o;return(0,r.__generator)(this,(function(r){return n=new M.StyleData(JSON.stringify({c:t.color})),i=new M.TextData(t.text),o=new Ye.WidgetLabelData(n,i),(0,je.default)().update([e],[o]),[2,e]}))}))}var mn=n(201014),vn=n(240658),yn=n(500431),En=n(378895),Tn=n(802430),In=n(785911),wn=n(678230),An=n(988082),Sn=new mn.Color;function bn(e){return"string"===typeof e&&("transparent"===e||Sn.setColor(e))}function Cn(e){return Number.isFinite(e)}function Dn(e){return 1===e||0===e}for(var On=[{sdkName:"backgroundColor",innerName:b.Style.BACKGROUND_COLOR,isColor:!0,validate:bn},{sdkName:"backgroundOpacity",innerName:b.Style.BACKGROUND_OPACITY,values:vn.OPACITIES},{sdkName:"stickerBackgroundColor",innerName:b.Style.STICKER_BACKGROUND_COLOR},{sdkName:"borderColor",innerName:b.Style.BORDER_COLOR,isColor:!0,validate:bn},{sdkName:"borderWidth",innerName:b.Style.BORDER_WIDTH,validate:Cn},{sdkName:"borderStyle",innerName:b.Style.BORDER_STYLE,values:yn.default},{sdkName:"borderOpacity",innerName:b.Style.BORDER_OPACITY,values:vn.OPACITIES},{sdkName:"fontSize",innerName:b.Style.FONT_SIZE,validate:Cn},{sdkName:"fontFamily",innerName:b.Style.FONT_FAMILY,values:N.default},{sdkName:"textColor",innerName:b.Style.TEXT_COLOR,isColor:!0,validate:bn},{sdkName:"textAlign",innerName:b.Style.TEXT_ALIGN,values:In.default},{sdkName:"textAlignVertical",innerName:b.Style.TEXT_ALIGN_VERTICAL,values:wn.default},{sdkName:"shapeType",innerName:b.Style.SHAPE_TYPE,values:D.ShapeType},{sdkName:"lineColor",innerName:b.Style.LINE_COLOR,isColor:!0,validate:bn},{sdkName:"lineThickness",innerName:b.Style.LINE_THICKNESS,validate:Cn},{sdkName:"lineType",innerName:An.LineStyleObject.STYLE.LINE_TYPE,values:En.default},{sdkName:"lineStartStyle",innerName:An.LineStyleObject.STYLE.HEAD_TYPE_START,values:O.default},{sdkName:"padding",innerName:b.Style.PADDING,validate:Cn},{sdkName:"bold",innerName:b.Style.BOLD,validate:Dn},{sdkName:"italic",innerName:b.Style.ITALIC,validate:Dn},{sdkName:"underline",innerName:b.Style.UNDERLINE,validate:Dn},{sdkName:"strike",innerName:b.Style.STRIKE,validate:Dn},{sdkName:"highlighting",innerName:b.Style.HIGHLIGHTING,validate:Dn},{sdkName:"shapeColor",innerName:b.Style.SHAPE_COLOR,isColor:!0,validate:bn},{sdkName:"stickerType",innerName:b.Style.STICKER_TYPE,values:Tn.default}],Rn=new Map,Pn=0;Pn').concat(ir().sanitize(t),"")}var lr=n(480573),dr=ue.object({id:ue.union([ue.array(ue.string()),ue.string()]).optional(),type:ue.union([ue.array(ue.flexEnum(rn,(function(e){return e.toLowerCase()}))),ue.flexEnum(rn,(function(e){return e.toLowerCase()}))]).optional(),tags:ue.union([ue.array(ue.string()),ue.string()]).optional()}).strict();function pr(e){return!$(e)||!Re(e)}var fr=function(e){return e.tokenizer.id!==k.Long.ZERO},hr=function(e){var t=e.map((function(e){return function(e){return{sticky_note:"STICKER",table:"GRID",table_text:"GRID_TEXT",connector:"LINE",app_card:"CARD"}[e.toLowerCase()]||e.toUpperCase()}(e)})),n=t.map((function(e){return F[e]})).filter(Boolean),r=["TAG"].filter((function(e){return t.includes(e)})).map((function(e){return L.default[e]})),i=function(e){var t=e.includes("app_card"),n=e.includes("card");return t===n?function(){return t}:function(e){return t===(0,I.isAppCardWidget)(e)}}(e);return function(e){return $(e)?X(e)?i(e):n.includes(e.widgetType):r.includes(e.type)}};function gr(e){if(e.filterType===Qn.ID)return function(e){for(var t=[],n=0,r=e;n0&&(a.customFields=t.fields.map((function(e){var t={value:e.value,fieldType:Zn.CardWidgetFieldType.STRING,mainColor:e.fillColor,fontColor:e.textColor,iconUrl:e.iconUrl,roundedIcon:null==e.iconShape?void 0:"round"===e.iconShape,tooltip:e.tooltip};return pe(t).forEach((function(e){null==t[e]&&delete t[e]})),t})),kn.Namespaces.setNsData(xn.CardWidgetNamespaces.CARD,a,o)),o.appCard={appId:n.id,status:t.status},o}function gi(e,t){var n,i=Hn(e),o=t.id,a=null!==(n=e.getExtensionData(A.CardWidgetExtensionId.CUSTOM_FIELDS))&&void 0!==n?n:[],s=(i.assignee,i.dueDate,(0,r.__rest)(i,["assignee","dueDate"]));return pi((0,r.__assign)((0,r.__assign)({},s),{type:"app_card",parentId:ie(e),owned:ai(e,o),fields:fi(a),status:ui(e)}))}function _i(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t;return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return[4,Kn(e)];case 1:return[4,si(J(t=n.sent()))];case 2:return n.sent(),[2,t]}}))}))}function mi(e,t){var n,i;return(0,r.__awaiter)(this,void 0,Promise,(function(){var o,a,s;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return o=null!==(i=null===(n=t.appCard)||void 0===n?void 0:n.appId)&&void 0!==i?i:"",ai(e,o)?[4,jn(e,t)]:(a=t.position,Jn.default.widgets.move(e,a.x,a.y),[2,e]);case 1:return[4,si(J(s=r.sent()))];case 2:return r.sent(),[2,s]}}))}))}var vi=n(844043),yi=n(847376),Ei=new mn.Color;function Ti(e){return"transparent"===e?-1:(Ei.setColor(e),Ei.getNumber())}function Ii(e){return-1===e?"transparent":(Ei.setIntColor(e),Ei.getHEX())}var wi="",Ai=100,Si=100,bi=ue.object({fillColor:ue.string()}).strict(),Ci=ue.object((0,r.__assign)((0,r.__assign)((0,r.__assign)({type:ue.literal("frame"),title:ue.string(),childrenIds:ue.array(ue.string())},we),ze),{width:ue.number().min(Ai).default(Ai),height:ue.number().min(Si).default(Si),style:bi})).strict();function Di(e){return Ci.parse(e)}function Oi(e){var t=e.children;return(null===t||void 0===t?void 0:t.length)?t.reduce((function(e,t){if(t.id){var n=V(t.id);n&&e.push(n)}return e}),[]):[]}function Ri(e){var t,n,i,o=e.input,a=e.widget,s=o.width,c=o.height,u=o.title,l=o.style,d=null!==(n=null===a||void 0===a?void 0:a.getStyle())&&void 0!==n?n:{},p=null!==(i=null!==u&&void 0!==u?u:null===a||void 0===a?void 0:a.text)&&void 0!==i?i:wi,f=function(e,t){if(!e.length||!t)return[];for(var n=new Set(W.getWidgetsInsideFrame(t).map((function(e){return e.tokenizer.id}))),r=[],i=0,o=e;i30)&&!t.match(Es)}(e)}),"invalid custom event").transform((function(e){return e}))])}).strict(),Ws=Ms;function Us(e,t,n){return(0,r.__awaiter)(this,void 0,void 0,(function(){var i;return(0,r.__generator)(this,(function(r){return i=n.appKey,jr.getPluginsController().registerEventHandler({pluginId:i,iframe:t},e.options.name),[2]}))}))}function Bs(e,t,n){return(0,r.__awaiter)(this,void 0,void 0,(function(){var i;return(0,r.__generator)(this,(function(r){return i=n.appKey,jr.getPluginsController().unregisterEventHandler({pluginId:i,iframe:t},e.options.name),[2]}))}))}function Fs(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){var n,i,o;return(0,r.__generator)(this,(function(r){switch(n=t.plugin,i=t.iframe,o=t.iframeType,e.type){case Xn.UI_OPEN_PANEL:return[2,Ss(e.options,n)];case Xn.UI_CLOSE_PANEL:return[2,fs(n.appKey)];case Xn.UI_OPEN_MODAL:return[2,bs(e.options,n)];case Xn.UI_CLOSE_MODAL:return[2,hs(n.appKey)];case Xn.UI_DRAG_START:return[2,Rs(e.options,i,o)];case Xn.UI_DRAG_MOVE:return[2,Ns(e.options)];case Xn.UI_DRAG_DROP:return[2,xs(e.options)];case Xn.UI_DRAG_END:return[2,Ls()];case Xn.UI_REGISTER_EVENT:return[2,Us(e,i,n)];case Xn.UI_UNREGISTER_EVENT:return[2,Bs(e,i,n)];default:tr(e)}return[2]}))}))}var Gs=n(127192);function zs(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n,i;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:if((0,Ba.default)().userType!==Gs.UserType.REGULAR)throw new Error(x.auth.unauthorizedUser());if(t=vr.UICurrentBoard.getInfo().account,!(n=t.installedApplications.find((function(t){return t.application.id===e.id}))))throw new Error(x.installation.missingAppforTeam({appName:e.name,appId:e.id,teamName:t.name}));r.label=1;case 1:return r.trys.push([1,3,,4]),[4,wr.default.accounts.selectById(t.id).getSignedIdentity(n.id)];case 2:return[2,r.sent()];case 3:if("number"===typeof(null===(i=r.sent())||void 0===i?void 0:i.status)&&(401===i.status||403===i.status))throw new Error(x.auth.insufficientUserPermissions());throw new Error(x.backendAPI.getIdTokenFail());case 4:return[2]}}))}))}function Vs(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(n){return e.type===Xn.GET_ID_TOKEN?[2,zs(t)]:(tr(e),[2])}))}))}var Hs=n(852766),Ks=n(438464),js=n(721715),Ys=ue.object({viewport:ue.object({x:ue.number(),y:ue.number(),width:ue.number(),height:ue.number()}),padding:ue.object({top:ue.number(),left:ue.number(),bottom:ue.number(),right:ue.number()}).optional(),animationDurationInMs:ue.number().min(0).optional()}),Xs=ue.object({items:ue.array(ue.string())}).strict();function Zs(){return(0,r.__awaiter)(this,void 0,Promise,(function(){var e,t,n,i;return(0,r.__generator)(this,(function(r){var o,a,s;return e=(0,Hs.default)(),t={left:e.leftSidebar.visibleWidth,right:e.rightSidebar.visibleWidth,top:0,bottom:0},n={left:(o=t).left*f.canvasController.canvasScale,right:o.right*f.canvasController.canvasScale,top:o.top*f.canvasController.canvasScale,bottom:o.bottom*f.canvasController.canvasScale},i=f.canvasController.viewport,s=n,[2,{x:(a=i).x+s.left,y:a.y+s.top,width:a.width-(s.left+s.right),height:a.height-(s.top+s.bottom)}]}))}))}function Js(e){var t=e.viewport,n=e.animationDurationInMs,i=void 0===n?void 0:n,o=e.padding,a=void 0===o?{top:0,left:0,bottom:0,right:0}:o;return(0,r.__awaiter)(this,void 0,Promise,(function(){var e,n,o,s;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return e=(0,Hs.default)(),n={left:e.leftSidebar.visibleWidth+a.left,right:e.rightSidebar.visibleWidth+a.right,top:a.top,bottom:a.bottom},o=function(e,t){var n=document.body.clientHeight,r=document.body.clientWidth,i=(n-t.top-t.bottom)/e.height,o=(r-t.left-t.right)/e.width;return{x:e.x-t.left/o,y:e.y-t.top/i,width:e.width+(t.left+t.right)/o,height:e.height+(t.top+t.bottom)/i}}(t,n),s=Ks.default.Rectangle.createFromRect(o),[4,js.default.setViewport(s).jumpWithAnimationPromise("move_viewport_to",i)];case 1:return r.sent(),[4,Zs()];case 2:return[2,r.sent()]}}))}))}function qs(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t;return(0,r.__generator)(this,(function(n){if(0===e.length)throw new Error(x.inputValidation.zoomToInvalidArgument());return t=(0,ms.calcWidgetsMultiBounds)(e),[2,js.default.setViewport(t).calculateScreenOffset().jumpWithAnimationPromise("move_viewport_to")]}))}))}function Qs(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(e.type){case Xn.VIEWPORT_GET:return[2,Zs()];case Xn.VIEWPORT_SET:return[2,Js(e.options)];case Xn.VIEWPORT_ZOOM_TO:return[2,qs(e.widgets)];default:tr(e)}return[2]}))}))}var $s=n(357003),ec=ue.json().refine((function(e){return null!==e}),"cannot be null"),tc=ue.object({itemId:ue.string(),key:ue.string().optional()}).strict(),nc=ue.object({itemId:ue.string(),key:ue.string(),value:ec}).strict();function rc(e){var t,n=e.asNs("metadata");return n&&null!==(t=n.getJsonData())&&void 0!==t?t:{}}function ic(e,t,n,i){var o;return(0,r.__awaiter)(this,void 0,Promise,(function(){var a,s,c,u,l,d,p;return(0,r.__generator)(this,(function(f){switch(f.label){case 0:a=rc(e),s=null!==(o=a[t])&&void 0!==o?o:{},c=(0,r.__assign)((0,r.__assign)({},s),((d={})[n]=i,d)),u=(0,r.__assign)((0,r.__assign)({},a),((p={})[t]=c,p)),l=kn.Namespaces.setNsData("metadata",u),f.label=1;case 1:return f.trys.push([1,3,,4]),(0,g.default)().update([e],[l]),[4,G()];case 2:return f.sent(),[3,4];case 3:throw f.sent(),new Error(x.unknownError.unknownError({payload:"Metadata update failed."}));case 4:return[2]}}))}))}function oc(e){var t=e.plugin,n=e.itemId,i=e.key;return(0,r.__awaiter)(this,void 0,Promise,(function(){var e,o,a;return(0,r.__generator)(this,(function(r){if(!t.id)throw new Error(x.unknownId.getWidgetMetadataFail());if(e=Ie(n),(0,$s.isFrameWidget)(e))throw new Error(x.unsupported.unsupportedCommand({command:"Frame.getMetadata()"}));return o=rc(e),(a=o[t.id])&&i?[2,a[i]]:[2,a]}))}))}function ac(e){var t,n=e.plugin,i=e.itemId,o=e.key,a=e.value;return(0,r.__awaiter)(this,void 0,Promise,(function(){var e,s;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:if(!n.id)throw new Error(x.unknownId.getWidgetMetadataFail());if(e=Ie(i),(0,$s.isFrameWidget)(e))throw new Error(x.unsupported.unsupportedCommand({command:"Frame.setMetadata()"}));return[4,ic(e,n.id,o,a)];case 1:return r.sent(),s=rc(e),[2,null!==(t=s[n.id])&&void 0!==t?t:{}]}}))}))}function sc(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(n){switch(e.type){case Xn.WIDGET_GET_METADATA:return[2,oc((0,r.__assign)((0,r.__assign)({},e),{plugin:t}))];case Xn.WIDGET_SET_METADATA:return[2,ac((0,r.__assign)((0,r.__assign)({},e),{plugin:t}))];default:tr(e)}return[2]}))}))}var cc=ue.object({id:ue.string().optional(),type:ue.flexEnum(rn,(function(e){return e.toLowerCase()}))}).keep();function uc(e,t){var n=e.type;switch(n){case"text":return function(e){var t,n=e.type,r=e.payload,i=Uo(r);return void 0!=r.id&&(t=H(Ie(r.id))),{type:n,input:i,props:Fo({input:i,widget:t}),instance:t}}({type:n,payload:e});case"sticky_note":return function(e){var t,n=e.type,r=e.payload,i=So(r);return void 0!=r.id&&(t=K(Ie(r.id))),{type:n,input:i,props:bo({input:i,widget:t}),instance:t}}({type:n,payload:e});case"shape":return function(e){var t,n=e.type,r=e.payload,i=po(r);return void 0!=r.id&&(t=j(Ie(r.id))),{type:n,input:i,props:ho({input:i,widget:t}),instance:t}}({type:n,payload:e});case"image":return function(e){var t,n=e.type,r=e.payload,i=zi(r);if(void 0!=r.id){var o=(t=Y(Ie(r.id))).resourceComponent.resourceController.getEditLink();if(i.url!==o)throw new Error(x.failedCRUD.readOnlyProperty({prop:"url"}))}return{type:n,input:i,props:Vi({input:i,widget:t}),instance:t}}({type:n,payload:e});case"card":return function(e){var t,n=e.type,r=e.payload,i=zn(r);return void 0!=r.id&&(t=Z(Ie(r.id))),{type:n,input:i,props:Vn({input:i,widget:t}),instance:t}}({type:n,payload:e});case"app_card":return function(e){var t,n=e.type,r=e.payload,i=e.plugin,o=pi(r);return void 0!=r.id&&(t=Z(Ie(r.id))),{type:n,input:o,props:hi({input:o,plugin:i,widget:t}),instance:t}}({type:n,payload:e,plugin:t});case"frame":return Pi({type:n,payload:e});case"preview":return function(e){var t,n=e.type,r=e.payload,i=jo(r);return void 0!=r.id&&(t=Q(Ie(r.id)),be({widget:t,input:i,keys:["url"]})),{type:n,input:i,props:Yo({input:i,widget:t}),instance:t}}({type:n,payload:e});case"embed":return function(e){var t,n=e.type,r=e.payload,i=na(r);return void 0!=r.id&&(t=te(Ie(r.id)),be({widget:t,input:i,keys:["width","height","url"]})),{type:n,input:i,props:ia({input:i,item:t}),instance:t}}({type:n,payload:e});case"connector":return function(e){var t,n=e.type,r=e.payload,i=pa(r);return void 0!=r.id&&(t=ne(Ie(r.id))),{type:n,input:i,props:ma({input:i,widget:t}),instance:t}}({type:n,payload:e});case"tag":return pn({type:n,payload:e});case"curve":case"document":case"emoji":case"table":case"kanban":case"pipmatrix":case"mockup":case"svg":case"usm":case"mindmap":case"webscreen":case"unsupported":case"stencil":case"code":return function(e){var t,n=e.type,r=e.payload,i=Xi(r);return void 0!=r.id&&(t=Ie(r.id)),{type:n,input:i,props:Zi({input:i,widget:t}),instance:t}}({type:n,payload:e});case"table_text":case"rallycard":case"red":case"stamp":throw new Error(x.unsupported.unsupportedItemType({itemType:n}));default:Oe(n)}}function lc(e,t){var n=function(e){void 0===e&&(e={});var t=dr.parse(e),n=t.id,r=t.type,i=t.tags;return void 0!=n?{id:"string"===typeof n?[n]:n,filterType:Qn.ID}:{filterType:Qn.Attributes,type:"string"===typeof r?[r]:r,tags:"string"===typeof i?[i]:i}}(t);return{type:e,filter:n}}function dc(e,t,n){if(!Object.prototype.hasOwnProperty.call(Xn,e))throw new Error(x.unsupported.unsupportedCommand({command:e}));var r=e;switch(r){case Xn.WIDGET_CREATE:return function(e,t,n){var r=uc(cc.parse(t),n);return Ce(r),{type:e,widget:r}}(r,n,t);case Xn.WIDGET_UPDATE:return function(e,t,n){var r=cc.parse(t),i=uc(r,n);if(!i.instance)throw new Error(x.initialization.initializeWidgetFail());var o=$(i.instance)?i.instance:void 0;if(void 0!=r.id&&o&&o.isLocked())throw new Error(x.failedCRUD.updateRemoteLockedWidget({id:r.id}));return Ce(i),De(i),{type:e,widget:i}}(r,n,t);case Xn.WIDGET_REMOVE:return function(e,t){var n=cc.parse(t),r=n.id,i=n.type;if(void 0==r)throw new Error(x.inputValidation.invalidWidgetId());var o=V(r);if(void 0===o)throw new Error(x.unknownId.getWidgetIdFail({id:r}));if("tag"===i)return{type:e,widget:{id:r,type:i,instance:o}};if($(o))return{type:e,widget:{id:r,type:i,instance:o}};throw new Error(x.failedCRUD.removeWidgetFail({type:i,id:r}))}(r,n);case Xn.WIDGET_GET:return lc(r,n);case Xn.WIDGET_GET_METADATA:case Xn.WIDGET_SET_METADATA:return function(e,t,n){switch(e){case Xn.WIDGET_GET_METADATA:var r=tc.parse(t);return{type:e,itemId:r.itemId,key:r.key};case Xn.WIDGET_SET_METADATA:var i=nc.parse(t);return{type:e,itemId:i.itemId,key:i.key,value:i.value};default:nr(e)}}(r,n);case Xn.BRING_TO_FRONT:case Xn.SEND_TO_BACK:return function(e,t){var n=xa.parse(t).items.map((function(e){return Ie(e)}));if(n.some((function(e){return e.widgetType===F.FRAME})))throw new Error(x.inputValidation.moveFrameZIndexFail({command:ka()(e)}));return{type:e,widgets:n}}(r,n);case Xn.GET_SELECTION:return{type:r};case Xn.GET_USER_INFO:return function(e){return{type:e}}(r);case Xn.GET_BOARD_INFO:case Xn.GET_BOARD_APP_DATA:case Xn.SET_BOARD_APP_DATA:case Xn.CLEAR_BOARD_APP_DATA:return function(e,t){switch(e){case Xn.GET_BOARD_INFO:return{type:e};case Xn.GET_BOARD_APP_DATA:return{type:e,key:r=Ia.parse(t).key};case Xn.SET_BOARD_APP_DATA:var n=wa.parse(t);return{type:e,key:r=n.key,value:n.value};case Xn.CLEAR_BOARD_APP_DATA:var r=Aa.parse(t).key;return{type:e,keys:Array.isArray(r)?r:[r]};default:nr(e)}}(r,n);case Xn.UI_OPEN_PANEL:case Xn.UI_CLOSE_PANEL:case Xn.UI_OPEN_MODAL:case Xn.UI_CLOSE_MODAL:case Xn.UI_DRAG_START:case Xn.UI_DRAG_MOVE:case Xn.UI_DRAG_DROP:case Xn.UI_DRAG_END:case Xn.UI_REGISTER_EVENT:case Xn.UI_UNREGISTER_EVENT:return function(e,t){switch(e){case Xn.UI_OPEN_PANEL:return{type:e,options:ws.parse(t)};case Xn.UI_OPEN_MODAL:return{type:e,options:As.parse(t)};case Xn.UI_CLOSE_PANEL:case Xn.UI_CLOSE_MODAL:return{type:e};case Xn.UI_DRAG_START:return{type:e,options:Ds.parse(t)};case Xn.UI_DRAG_MOVE:return{type:e,options:Ps.parse(t)};case Xn.UI_DRAG_DROP:return{type:e,options:ks.parse(t)};case Xn.UI_DRAG_END:return{type:e};case Xn.UI_REGISTER_EVENT:return{type:e,options:Ms.parse(t)};case Xn.UI_UNREGISTER_EVENT:return{type:e,options:Ws.parse(t)};default:nr(e)}}(r,n);case Xn.GET_ID_TOKEN:return function(e){if(e===Xn.GET_ID_TOKEN)return{type:e};nr(e)}(r);case Xn.VIEWPORT_GET:case Xn.VIEWPORT_SET:case Xn.VIEWPORT_ZOOM_TO:return function(e,t){switch(void 0===t&&(t={}),e){case Xn.VIEWPORT_GET:return{type:e};case Xn.VIEWPORT_SET:return{type:e,options:Ys.parse(t)};case Xn.VIEWPORT_ZOOM_TO:return{type:e,widgets:Xs.parse(t).items.map((function(e){return Ie(e)}))};default:nr(e)}}(r,n);case Xn.SHOW_NOTIFICATION:return function(e,t){return{type:e,options:Ma.parse(t)}}(r,n);default:tr(r)}}function pc(e,t){if(e.name===$n){var n=e.payload,r="UNKNOWN";(null===n||void 0===n?void 0:n.clientVersion)&&(r=n.clientVersion),t.externalSDKVersion=r}}var fc=1e5,hc=function(){function e(){this.hourly=0,this.minutely=0,this.checks=[],this.checks=[{key:"hourly",limit:1e6,error:x.rateLimiter.perHourExceeded,interval:36e5},{key:"minutely",limit:fc,error:x.rateLimiter.perMinuteExceeded,interval:6e4}],this.startResetInterval()}return e.prototype.consume=function(e){var t=this;this.checks.forEach((function(n){var r=n.key,i=n.limit,o=n.error;if(t[r]+e>=i)throw new Error(o(i))})),this.checks.forEach((function(n){var r=n.key;t[r]+=e}))},e.prototype.startResetInterval=function(){var e=this;this.checks.forEach((function(t){var n=t.key,r=t.interval;setInterval((function(){e[n]=0}),r)}))},e}();!function(){function e(){}e.prototype.consume=function(e){}}();function gc(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(e.type){case"text":return[2,Go(e.props)];case"sticky_note":return[2,Ro(e.props)];case"shape":return[2,_o(e.props)];case"image":return[2,Hi(e.props)];case"card":return[2,Kn(e.props)];case"app_card":return[2,_i(e.props)];case"frame":return[2,Ni(e.props)];case"preview":return[2,Xo(e.props)];case"embed":return[2,aa(e.props)];case"connector":return[2,va(e.props)];case"tag":return[2,fn(e.props)];case"curve":case"document":case"emoji":case"table":case"kanban":case"pipmatrix":case"mockup":case"svg":case"usm":case"mindmap":case"webscreen":case"stencil":case"code":case"unsupported":return[2,qi(e.props)];default:Oe(e)}return[2]}))}))}function _c(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){if(void 0==e.instance)throw new Error(x.initialization.initializeWidgetFail());switch(e.type){case"document":case"emoji":case"webscreen":case"curve":case"table":case"mockup":case"kanban":case"pipmatrix":case"svg":case"usm":case"mindmap":case"stencil":case"code":case"unsupported":break;case"text":return[2,zo(e.instance,e.props)];case"sticky_note":return[2,Po(e.instance,e.props)];case"shape":return[2,mo(e.instance,e.props)];case"card":return[2,jn(e.instance,e.props)];case"app_card":return[2,mi(e.instance,e.props)];case"image":return[2,Ki(e.instance,e.props)];case"frame":return[2,ki(e.instance,e.props)];case"tag":return[2,_n(e.instance,e.props)];case"embed":return[2,oa(e.instance,e.props)];case"preview":return[2,Zo(e.instance,e.props)];case"connector":return[2,ya(e.instance,e.props)];default:Oe(e)}return(0,g.default)().update([e.instance],[e.props],!0),[2,e.instance]}))}))}function mc(e){if(e.type===L.default.TAG)return function(e){var t={id:e.tokenizer.id.toString()};return ln((0,r.__assign)((0,r.__assign)({},t),{type:"tag",title:e.text,color:sn(e.color)}))}(ee(e));throw new Error(x.unsupported.unsupportedItemType({itemType:"unknown"}))}function vc(e,t){switch(e.widgetType){case F.TEXT:return Pe(e)||Re(e)?Ji(e):function(e){var t=ye(e),n=ve(e),i=n.x,o=n.y;return Uo((0,r.__assign)((0,r.__assign)({},t),{type:"text",x:i,y:o,width:e.scaledWidth,height:e.scaledHeight,parentId:ie(e),rotation:e.rotation,content:e.text,style:Bo(e)}))}(H(e));case F.STICKER:return function(e){var t=ye(e),n=ve(e),i=n.x,o=n.y,a=e.shapeType===Tn.default.RECTANGLE?"rectangle":"square",s=e.getStyle(),c=(0,r.__assign)((0,r.__assign)({},t),{x:i,y:o,parentId:ie(e),shape:a,width:e.scaledWidth,height:e.scaledHeight,type:"sticky_note",content:e.text,style:{fillColor:Do(s[U.STICKER_BACKGROUND_COLOR]),textAlign:oo.textAlign[s[U.TEXT_ALIGN]],textAlignVertical:oo.textAlignVertical[s[U.TEXT_ALIGN_VERTICAL]]},tagIds:e.tags.map((function(e){return e.tokenizer.id.toString()}))});return So(c)}(K(e));case F.SHAPE:return function(e){var t=ye(e),n=ve(e),i=n.x,o=n.y,a=e.require($i.StyleComponent).getStyle();return po((0,r.__assign)((0,r.__assign)({},t),{type:"shape",x:i,y:o,width:e.scaledWidth,height:e.scaledHeight,rotation:e.rotation,parentId:ie(e),content:e.text,style:go(a),shape:co[e.shapeType]}))}(j(e));case F.IMAGE:return function(e){var t=ye(e),n=ve(e),i=n.x,o=n.y;return zi((0,r.__assign)((0,r.__assign)({},t),{x:i,y:o,width:e.scaledWidth,height:e.scaledHeight,rotation:e.rotation,parentId:ie(e),type:"image",title:e.title||"",url:e.resourceComponent.resourceController.getEditLink()}))}(Y(e));case F.CARD:var n=Z(e);return function(e){return Boolean(re(e))}(n)?gi(n,t):Hn(n);case F.FRAME:return function(e){var t,n=ye(e),i=ve(e),o=i.x,a=i.y,s=((null===(t=e.asContainer)||void 0===t?void 0:t.existingChildren)||[]).map((function(e){return e.tokenizer.id.toString()}));return Di((0,r.__assign)((0,r.__assign)({},n),{type:"frame",x:o,y:a,parentId:ie(e),height:e.scaledHeight,width:e.scaledWidth,title:e.text,childrenIds:s,style:xi(e)}))}(q(e));case F.PREVIEW:return function(e){var t=(0,r.__rest)(ye(e),[]),n=ve(e),i=n.x,o=n.y;return jo((0,r.__assign)((0,r.__assign)({},t),{type:"preview",url:e.url,parentId:ie(e),x:i,y:o,width:e.scaledWidth,height:e.scaledHeight}))}(Q(e));case F.EMBED:return function(e){var t=(0,r.__rest)(ye(e),[]),n=ve(e),i=n.x,o=n.y;return na((0,r.__assign)((0,r.__assign)({},t),{type:"embed",url:e.url,parentId:ie(e),previewUrl:null===e||void 0===e?void 0:e.externalThumbnailUrl,mode:e.mode===w.EMBED_VIEW.OVERLAY?"modal":"inline",x:i,y:o,width:e.bounds.width,height:e.bounds.height}))}(te(e));case F.LINE:return function(e){var t,n=ye(e),i=e.getStyle(!1);return pa((0,r.__assign)((0,r.__assign)({},n),{type:"connector",parentId:ie(e),shape:null!==(t=oo.connectorShape(i[U.LINE_TYPE]))&&void 0!==t?t:"curved",style:ha(e),start:ga(e.end0),end:ga(e.end1)}))}(ne(e));case F.GRID_TEXT:}return Ji(e)}function yc(e,t){return $(e)?vc(e,t):mc(e)}function Ec(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){var n,i,o,a,s;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return n=e.widget,i=n,[4,gc(n)];case 1:return i.instance=r.sent(),ie(n.instance)&&n.instance&&"tag"!==n.type&&(o=n.instance.position,a=o.x,s=o.y,(new _.default).attachToCanvas(n.instance,a,s)),[2,yc(n.instance,t)]}}))}))}function Tc(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){var n;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:if(void 0==(n=e.widget).instance)throw new Error(x.initialization.initializeWidgetFail());return[4,_c(n)];case 1:return r.sent(),[2,yc(n.instance,t)]}}))}))}function Ic(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n,i,o;return(0,r.__generator)(this,(function(r){switch(t=e.widget,n=t.id,i=t.type,o=t.instance,i){case"text":case"sticky_note":case"shape":case"image":case"frame":case"preview":case"card":case"app_card":case"embed":case"connector":case"rallycard":if(Ne(o))throw new Error(x.failedCRUD.removeWidgetFail({type:i,id:n}));try{return(0,h.CanvasEngine)().presence.removeObjects([o.tokenizer]),[2,G()]}catch(e){throw new Error(x.failedCRUD.removeWidgetFail({type:i,id:n}))}case"tag":try{return function(e){var t=(0,je.default)().tags.find((function(t){return t.tokenizer.id===e.tokenizer.id}));if(void 0===t)throw new Error(x.unknownId.getWidgetIdFail({id:e.tokenizer.id.toString()}));(0,je.default)().remove([t])}(ee(o)),[2,!0]}catch(e){throw new Error(x.failedCRUD.removeWidgetFail({type:i,id:n}))}case"usm":case"mindmap":case"kanban":case"pipmatrix":case"table":case"table_text":case"curve":case"document":case"mockup":case"webscreen":case"svg":case"emoji":case"stencil":case"code":case"unsupported":case"red":case"stamp":throw new Error(x.failedCRUD.removeWidgetFail({type:i,id:n}));default:nr(i)}return[2]}))}))}function wc(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){var n;return(0,r.__generator)(this,(function(r){return n=e.filter,[2,gr(n).map((function(e){return yc(e,t)}))]}))}))}function Ac(e,t){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(e){return[2,f.mySelection.selection.filter(pr).map((function(e){return yc(e,t)}))]}))}))}function Sc(e,t){var n=function(e){switch(e.type){case Xn.WIDGET_CREATE:case Xn.WIDGET_UPDATE:if(["image","embed"].includes(e.widget.type))return 500;break;case Xn.UI_DRAG_START:case Xn.UI_DRAG_MOVE:case Xn.UI_DRAG_DROP:case Xn.UI_DRAG_END:case Xn.SHOW_NOTIFICATION:return 0}return 50}(t);e.consume(n)}function bc(e){var t=e.command,n=e.rawPayload,i=e.context;return(0,r.__awaiter)(this,void 0,Promise,(function(){var e,o,a,s;return(0,r.__generator)(this,(function(r){switch(e=i.plugin,o=i.iframe,a=i.iframeType,s=dc(t,e,n),Sc(i.rateLimiter,s),s.type){case Xn.WIDGET_CREATE:return[2,Ec(s,e)];case Xn.WIDGET_UPDATE:return[2,Tc(s,e)];case Xn.WIDGET_REMOVE:return[2,Ic(s)];case Xn.WIDGET_GET:return[2,wc(s,e)];case Xn.BRING_TO_FRONT:case Xn.SEND_TO_BACK:return[2,La(s)];case Xn.GET_SELECTION:return[2,Ac(0,e)];case Xn.GET_USER_INFO:return[2,za(s)];case Xn.GET_BOARD_INFO:case Xn.GET_BOARD_APP_DATA:case Xn.SET_BOARD_APP_DATA:case Xn.CLEAR_BOARD_APP_DATA:return[2,Pa(s,e)];case Xn.UI_OPEN_PANEL:case Xn.UI_CLOSE_PANEL:case Xn.UI_OPEN_MODAL:case Xn.UI_CLOSE_MODAL:case Xn.UI_DRAG_START:case Xn.UI_DRAG_MOVE:case Xn.UI_DRAG_DROP:case Xn.UI_DRAG_END:case Xn.UI_REGISTER_EVENT:case Xn.UI_UNREGISTER_EVENT:return[2,Fs(s,{plugin:e,iframe:o,iframeType:a})];case Xn.GET_ID_TOKEN:return[2,Vs(s,e)];case Xn.VIEWPORT_GET:case Xn.VIEWPORT_SET:case Xn.VIEWPORT_ZOOM_TO:return[2,Qs(s)];case Xn.SHOW_NOTIFICATION:return[2,Ua(s)];case Xn.WIDGET_GET_METADATA:case Xn.WIDGET_SET_METADATA:return[2,sc(s,e)];default:tr(s)}return[2]}))}))}var Cc,Dc,Oc=n(903565),Rc=n(783049);!function(e){e.INITIALIZATION_TIMED_OUT="INITIALIZATION_TIMED_OUT",e.PLUGIN_STOPPED_RESPONDING="PLUGIN_STOPPED_RESPONDING",e.IFRAME_ELEMENT_UNMOUNTED="IFRAME_ELEMENT_UNMOUNTED"}(Cc||(Cc={})),function(e){e.INITIALIZING="INITIALIZING",e.INITIALIZED="INITIALIZED",e.DESTROYED="DESTROYED"}(Dc||(Dc={}));var Pc={id:$n,payload:"ok",status:tn.Success},Nc=function(){function e(e){var t=this;this.state=Dc.INITIALIZING,this.events=new vs,this.notResponded=new u.default.Signal,this.slowInit=new u.default.Signal,this.initialized=new u.default.Signal,this.communicationChannelEstablished=new u.default.Signal,this.startInitializationMonitor=function(){t.monitorInterval=window.setTimeout((function(){t.monitorInterval=void 0,t.onPluginIframeNotResponded(Cc.INITIALIZATION_TIMED_OUT)}),6e4),t.slowInitTimeout=window.setTimeout((function(){t.slowInitTimeout=void 0,t.slowInit.dispatch()}),5e3)},this.handlePostMessage=Hr((function(e){return(0,r.__awaiter)(t,void 0,void 0,(function(){var t,n,i,o=this;return(0,r.__generator)(this,(function(a){switch(a.label){case 0:return this.isTrustedOrigin(e.origin)&&this.isSameIframeWindow(e.source)&&d(e)&&!this.isCommunicationChannelAlreadyEstablished(e.source)?(t=e.data.payload,this.isHandshakeMessage(e)?[4,this.handleHandshakeRequest({busWindow:e.source,commands:t,msgId:e.data.msgId})]:[3,2]):[2];case 1:return a.sent(),[3,4];case 2:return i=this.createCommunicationBus({container:e.source,origin:this.plugin.origin},(function(){return(0,r.__awaiter)(o,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return[2,void 0]}))}))})),n=t.map((function(e){var t=o.plugin.appInstallation.application;return Mr(t,e),Wr({app:t,error:"uninitialized",command:e}),{id:e.id,payload:x.initialization.initializeIFrameFail(),status:tn.Fail}})),[4,i.dispatch(n,e.data.msgId)];case 3:a.sent(),i.destroy(),a.label=4;case 4:return[2]}}))}))})),this.plugin=e.plugin,this.iframe=e.iframe,this.type=e.type,this.createCommunicationBus=e.createCommunicationBus,this.handlePluginCommand=e.handlePluginCommand,this.rateLimiter=e.rateLimiter,this.startInitializationMonitor(),window.addEventListener("message",this.handlePostMessage)}return e.prototype.destroy=function(){this.isDestroyed()||(this.destroyCommunicationChannel(),this.stopMonitor(),window.removeEventListener("message",this.handlePostMessage),this.initialized.dispose(),this.notResponded.dispose(),this.slowInit.dispose(),this.communicationChannelEstablished.dispose(),this.state=Dc.DESTROYED)},e.prototype.isInitialized=function(){return this.state===Dc.INITIALIZED},e.prototype.getExternalSDKVersion=function(){return this.plugin.externalSDKVersion},e.prototype.runAfterInit=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){switch(t.label){case 0:return this.isInitialized()?[4,e()]:[3,2];case 1:return t.sent(),[3,3];case 2:this.initialized.addOnce((function(){return e()})),t.label=3;case 3:return[2]}}))}))},e.prototype.sendEventCommandToIframe=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){var t,n=this;return(0,r.__generator)(this,(function(r){return this.bus?(t=e.filter((function(e){var t=e.id;return n.isEventRegistered(t)})),t.length>0?[2,this.bus.dispatch(t)]:[2]):[2]}))}))},e.prototype.sendCommandToIframe=function(e){return(0,r.__awaiter)(this,void 0,Promise,(function(){return(0,r.__generator)(this,(function(t){return this.bus?[2,this.bus.dispatch(e)]:[2]}))}))},e.prototype.isEventRegistered=function(e){return this.events.has(e)},e.prototype.registerEventHandler=function(e){return this.events.add(e)},e.prototype.unregisterEventHandler=function(e){return this.events.delete(e)},e.prototype.isDestroyed=function(){return this.state===Dc.DESTROYED},e.prototype.onPluginIframeNotResponded=function(e){this.destroyCommunicationChannel(),this.notResponded.dispatch({plugin:this.plugin,iframe:this.iframe,iframeType:this.type,reason:e})},e.prototype.destroyCommunicationChannel=function(){this.bus&&(this.bus.destroy(),this.bus=void 0)},e.prototype.isSameIframeWindow=function(e){return null!==this.iframe.contentWindow&&this.iframe.contentWindow===e},e.prototype.isHandshakeMessage=function(e){var t;if(d(e)){var n=e.data.payload;return!!((null===(t=n[0])||void 0===t?void 0:t.name)===$n?n[0]:void 0)}},e.prototype.isTrustedOrigin=function(e){return e===this.plugin.origin},e.prototype.isCommunicationChannelAlreadyEstablished=function(e){var t;return e===(null===(t=this.bus)||void 0===t?void 0:t.target.container)},e.prototype.handleHandshakeRequest=function(e){return(0,r.__awaiter)(this,void 0,void 0,(function(){var t,n,i,o,a,s,c,u;return(0,r.__generator)(this,(function(l){switch(l.label){case 0:return t=e.commands,n=e.busWindow,i=e.msgId,o=t[0],a=t.slice(1),Mr(this.plugin.appInstallation.application,o),s=this.establishCommunicationChannel(n),this.isInitialized()||(this.stopMonitor(),Zr(this.plugin.pluginId)||this.startHealthMonitor(),this.state=Dc.INITIALIZED,pc(o,this.plugin),this.initialized.dispatch({plugin:this.plugin,iframe:this.iframe,iframeType:this.type})),[4,this.handlePluginCommand({installation:this.plugin.appInstallation,plugin:this.plugin.appInstallation.application,iframe:this.iframe,iframeType:this.type,rateLimiter:this.rateLimiter,application:this.plugin},a)];case 1:return c=l.sent(),u=(0,r.__spreadArray)([Pc],c,!0),[4,s.dispatch(u,i)];case 2:return l.sent(),[2]}}))}))},e.prototype.establishCommunicationChannel=function(e){var t=this;this.bus&&this.destroyCommunicationChannel();var n=this.createCommunicationBus({container:e,origin:this.plugin.origin},(function(e){return t.handlePluginCommand({installation:t.plugin.appInstallation,plugin:t.plugin.appInstallation.application,iframe:t.iframe,iframeType:t.type,rateLimiter:t.rateLimiter,application:t.plugin},e)}));return this.bus=n,this.communicationChannelEstablished.dispatch({plugin:this.plugin,iframe:this.iframe,iframeType:this.type}),n},e.prototype.startHealthMonitor=function(){var e=this;if(void 0===this.monitorInterval){var t=0;this.monitorInterval=window.setInterval((function(){return(0,r.__awaiter)(e,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return document.body.contains(this.iframe)?this.bus?t>=3?(this.onPluginIframeNotResponded(Cc.PLUGIN_STOPPED_RESPONDING),[2]):(t++,[4,this.bus.dispatch("HEALTH_CHECK")]):(t=0,[2]):(this.onPluginIframeNotResponded(Cc.IFRAME_ELEMENT_UNMOUNTED),this.destroy(),[2]);case 1:return e.sent(),t=0,[2]}}))}))}),1e4)}},e.prototype.stopMonitor=function(){void 0!==this.monitorInterval&&(clearInterval(this.monitorInterval),this.monitorInterval=void 0),clearTimeout(this.slowInitTimeout),this.slowInitTimeout=void 0},e}();const kc=Nc;var xc=n(990939),Lc="/app/static/sdk/v2/miro.js?v=".concat(Date.now()/1e3/3600|0);function Mc(e){return{id:e.id,payload:"ok",status:tn.Success}}function Wc(e){var t=e.hostWindow,n=e.info,r=e.plugin;if(void 0===r.clientPlugin)throw new Error("not an SDK app?");var i=r.appKey,o=function(e){try{var t=new URL(e.clientPlugin.mainJSUri);return"https:"===t.protocol||"localhost"===t.hostname?t:{}}catch(e){return{}}}(r),a=Zr(i);if(!a&&!o.hostname)throw new Error(x.unsupported.unsupportedAppUrl({name:r.name}));var s=o.href,c=o.origin,u=function(e){var t=e.hostWindow,n=e.src,r=e.srcdoc,i=e.allow,o=e.pluginId,a=t.document.createElement("iframe");return n?a.setAttribute("src",n):r&&a.setAttribute("srcdoc",r),a.setAttribute("data-container-type","sandbox"),a.setAttribute(is.IFRAME_APP_KEY_ATTRIBUTE,o),a.setAttribute("allow",i),a.setAttribute("class","plugins_sandbox_iframe"),a.setAttribute("tabindex","-1"),a.style.width="1px",a.style.height="1px",t.document.body.appendChild(a),a}({hostWindow:t,src:a?"":s,srcdoc:a?'